Skip to content

generator refactor #4337

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 41 commits into from
Jun 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
1986325
chore: rename interface
schiller-manuel Jun 7, 2025
076e23c
chore: add filter to vite-plugin-minify-script
schiller-manuel Jun 7, 2025
1e4d08e
chore: remove unused dependencies
schiller-manuel Jun 7, 2025
c7f384f
remove virtual modules from externalDeps
schiller-manuel Jun 7, 2025
f3c9393
bump deps
schiller-manuel Jun 7, 2025
01b723a
centralize magic strings for virtual module names
schiller-manuel Jun 7, 2025
25c1369
feat: refactored router generator
schiller-manuel Jun 7, 2025
677b96f
re-run generator on all projects
schiller-manuel Jun 7, 2025
1281915
fix lint
schiller-manuel Jun 7, 2025
de269ab
ci: apply automated fixes
autofix-ci[bot] Jun 7, 2025
a2d54c5
formatting
schiller-manuel Jun 7, 2025
81fafec
properly handle rejections
schiller-manuel Jun 7, 2025
9402cc0
move generator snapshots into 'snapshots' folder
schiller-manuel Jun 7, 2025
23614bd
remove disableManifestGeneration
schiller-manuel Jun 7, 2025
d096f1c
add option to configure tmpDir locationo
schiller-manuel Jun 7, 2025
65c0633
configure CI to use a custom tmp dir for router generator
schiller-manuel Jun 7, 2025
43d52c2
fix tsconfig
schiller-manuel Jun 7, 2025
2a7b3a6
disable type checking for router-generator on TS 5.3 and 5.4
schiller-manuel Jun 7, 2025
dcd829a
only emit virtual root route if needed
schiller-manuel Jun 7, 2025
b741198
fix lint
schiller-manuel Jun 7, 2025
f040710
ensure tmp dir exists
schiller-manuel Jun 7, 2025
815e1d1
fix env for CI
schiller-manuel Jun 7, 2025
8635d4b
debug env
schiller-manuel Jun 7, 2025
83eba7e
env
schiller-manuel Jun 7, 2025
1d44694
env
schiller-manuel Jun 7, 2025
2d78b94
fix lint
schiller-manuel Jun 7, 2025
e1c9a93
propagate TSR_TMP_DIR to nx cloud agent
schiller-manuel Jun 7, 2025
9b0c498
fix generator
schiller-manuel Jun 7, 2025
0597c35
remove separate server route trees
schiller-manuel Jun 8, 2025
4d94495
format
schiller-manuel Jun 8, 2025
26e7670
verboseFileRoutes:false for one start project
schiller-manuel Jun 8, 2025
9250b96
handle createServerRootRoute in start compiler
schiller-manuel Jun 8, 2025
544f202
make compileStartOutputFactory more generic
schiller-manuel Jun 8, 2025
89bf676
ci: apply automated fixes
autofix-ci[bot] Jun 8, 2025
42f76c2
remove tanstack-start.d.ts
schiller-manuel Jun 9, 2025
d991fcf
always generate fileRoutesByPathInterface
schiller-manuel Jun 9, 2025
cd9a1a8
re-run generator, add vite client reference for css import
schiller-manuel Jun 9, 2025
c5ebbd4
run typechecks on examples, fix examples
schiller-manuel Jun 9, 2025
942b67e
ignore generated route tree in workos example
schiller-manuel Jun 9, 2025
197de0c
run generator tests with verboseFileRoutes disabled
schiller-manuel Jun 9, 2025
b177056
ci: apply automated fixes
autofix-ci[bot] Jun 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,15 @@ jobs:
name: Test & Publish
if: github.repository_owner == 'TanStack'
runs-on: ubuntu-latest
env:
TSR_TMP_DIR: ./tmp
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0
- name: Start Nx Agents
run: npx nx-cloud start-ci-run --distribute-on=".nx/workflows/dynamic-changesets.yaml"
run: npx nx-cloud start-ci-run --distribute-on=".nx/workflows/dynamic-changesets.yaml" --with-env-vars="TSR_TMP_DIR"
- name: Setup Tools
uses: tanstack/config/.github/setup@main
- name: Run Tests
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ jobs:
test:
name: Test
runs-on: ubuntu-latest
env:
TSR_TMP_DIR: ./tmp
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0
- name: Start Nx Agents
run: npx nx-cloud start-ci-run --distribute-on=".nx/workflows/dynamic-changesets.yaml"
run: npx nx-cloud start-ci-run --distribute-on=".nx/workflows/dynamic-changesets.yaml" --with-env-vars="TSR_TMP_DIR"
- name: Setup Tools
uses: tanstack/config/.github/setup@main
- name: Get base and head commits for `nx affected`
Expand Down
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ node_modules
**/test-results
**/tests/generator/file-modification/routes/(test)/*
**/tests/generator/no-formatted-route-tree/routeTree.snapshot.ts
/.nx/workspace-data
/.nx/workspace-data
**/src/routeTree.gen.ts
19 changes: 10 additions & 9 deletions docs/router/api/file-based-routing.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ The following options are available for configuring the file-based routing:
- [`disableLogging`](#disablelogging)
- [`routeTreeFileHeader`](#routetreefileheader)
- [`routeTreeFileFooter`](#routetreefilefooter)
- [`disableManifestGeneration`](#disablemanifestgeneration)
- [`enableRouteTreeFormatting`](#enableroutetreeformatting)
- [`tmpDir`](#tmpdir)

> [!WARNING]
> Do not set the `routeFilePrefix`, `routeFileIgnorePrefix`, or `routeFileIgnorePattern` options, to match any of the tokens used in the **File Naming Conventions** guide, or you may run into unexpected behavior.
Expand Down Expand Up @@ -187,16 +187,17 @@ By default, this value is set to:
[]
```

### `disableManifestGeneration`

[TanStack Start](/start) leverages the `generatedRouteTree` file to also store a JSON tree which allows Start to easily traverse the available route tree to understand the routing structure of the application. This JSON tree is saved at the end of the generated route tree file.

This option allows you to disable the generation of the manifest.

By default, this value is set to `false`.

### `enableRouteTreeFormatting`

This option turns on the formatting function on the generated route tree file, which can be time-consuming for large projects.

By default, this value is set to `true`.

### `tmpDir`

Atomic file writes (route files and the generated route tree file) are implemented by creating a temporary file first and then renaming it to their actual location.

This config option allows to configure the path of the temp directory that will be used for creating those temporary files.
If it is a relative path, it will be resolved to the current working directory.
If this value is not set, `process.env.TSR_TMP_DIR` will be used.
If `process.env.TSR_TMP_DIR` is not set, it will default to `os.tmpdir()`.
Loading