-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
fix: Fix escape sequence handling for routes defined in __virtual.ts files #6250
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
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
113 changes: 113 additions & 0 deletions
113
...er-generator/tests/generator/virtual-inside-with-escaped-underscore/routeTree.snapshot.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,113 @@ | ||
| /* eslint-disable */ | ||
|
|
||
| // @ts-nocheck | ||
|
|
||
| // noinspection JSUnusedGlobalSymbols | ||
|
|
||
| // This file was automatically generated by TanStack Router. | ||
| // You should NOT make any changes in this file as it will be overwritten. | ||
| // Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified. | ||
|
|
||
| import { Route as rootRouteImport } from './routes/__root' | ||
| import { Route as IndexRouteImport } from './routes/index' | ||
| import { Route as nestedCallbackRouteImport } from './routes/nested/callback' | ||
| import { Route as nestedAuthRouteImport } from './routes/nested/auth' | ||
| import { Route as nestedHomeRouteImport } from './routes/nested/home' | ||
|
|
||
| const IndexRoute = IndexRouteImport.update({ | ||
| id: '/', | ||
| path: '/', | ||
| getParentRoute: () => rootRouteImport, | ||
| } as any) | ||
| const nestedCallbackRoute = nestedCallbackRouteImport.update({ | ||
| id: '/nested/_callback', | ||
| path: '/nested/_callback', | ||
| getParentRoute: () => rootRouteImport, | ||
| } as any) | ||
| const nestedAuthRoute = nestedAuthRouteImport.update({ | ||
| id: '/nested/_auth', | ||
| path: '/nested/_auth', | ||
| getParentRoute: () => rootRouteImport, | ||
| } as any) | ||
| const nestedHomeRoute = nestedHomeRouteImport.update({ | ||
| id: '/nested/', | ||
| path: '/nested/', | ||
| getParentRoute: () => rootRouteImport, | ||
| } as any) | ||
|
|
||
| export interface FileRoutesByFullPath { | ||
| '/': typeof IndexRoute | ||
| '/nested': typeof nestedHomeRoute | ||
| '/nested/_auth': typeof nestedAuthRoute | ||
| '/nested/_callback': typeof nestedCallbackRoute | ||
| } | ||
| export interface FileRoutesByTo { | ||
| '/': typeof IndexRoute | ||
| '/nested': typeof nestedHomeRoute | ||
| '/nested/_auth': typeof nestedAuthRoute | ||
| '/nested/_callback': typeof nestedCallbackRoute | ||
| } | ||
| export interface FileRoutesById { | ||
| __root__: typeof rootRouteImport | ||
| '/': typeof IndexRoute | ||
| '/nested/': typeof nestedHomeRoute | ||
| '/nested/_auth': typeof nestedAuthRoute | ||
| '/nested/_callback': typeof nestedCallbackRoute | ||
| } | ||
| export interface FileRouteTypes { | ||
| fileRoutesByFullPath: FileRoutesByFullPath | ||
| fullPaths: '/' | '/nested' | '/nested/_auth' | '/nested/_callback' | ||
| fileRoutesByTo: FileRoutesByTo | ||
| to: '/' | '/nested' | '/nested/_auth' | '/nested/_callback' | ||
| id: '__root__' | '/' | '/nested/' | '/nested/_auth' | '/nested/_callback' | ||
| fileRoutesById: FileRoutesById | ||
| } | ||
| export interface RootRouteChildren { | ||
| IndexRoute: typeof IndexRoute | ||
| nestedHomeRoute: typeof nestedHomeRoute | ||
| nestedAuthRoute: typeof nestedAuthRoute | ||
| nestedCallbackRoute: typeof nestedCallbackRoute | ||
| } | ||
|
|
||
| declare module '@tanstack/react-router' { | ||
| interface FileRoutesByPath { | ||
| '/': { | ||
| id: '/' | ||
| path: '/' | ||
| fullPath: '/' | ||
| preLoaderRoute: typeof IndexRouteImport | ||
| parentRoute: typeof rootRouteImport | ||
| } | ||
| '/nested/_callback': { | ||
| id: '/nested/_callback' | ||
| path: '/nested/_callback' | ||
| fullPath: '/nested/_callback' | ||
| preLoaderRoute: typeof nestedCallbackRouteImport | ||
| parentRoute: typeof rootRouteImport | ||
| } | ||
| '/nested/_auth': { | ||
| id: '/nested/_auth' | ||
| path: '/nested/_auth' | ||
| fullPath: '/nested/_auth' | ||
| preLoaderRoute: typeof nestedAuthRouteImport | ||
| parentRoute: typeof rootRouteImport | ||
| } | ||
| '/nested/': { | ||
| id: '/nested/' | ||
| path: '/nested' | ||
| fullPath: '/nested' | ||
| preLoaderRoute: typeof nestedHomeRouteImport | ||
| parentRoute: typeof rootRouteImport | ||
| } | ||
| } | ||
| } | ||
|
|
||
| const rootRouteChildren: RootRouteChildren = { | ||
| IndexRoute: IndexRoute, | ||
| nestedHomeRoute: nestedHomeRoute, | ||
| nestedAuthRoute: nestedAuthRoute, | ||
| nestedCallbackRoute: nestedCallbackRoute, | ||
| } | ||
| export const routeTree = rootRouteImport | ||
| ._addFileChildren(rootRouteChildren) | ||
| ._addFileTypes<FileRouteTypes>() |
2 changes: 2 additions & 0 deletions
2
...router-generator/tests/generator/virtual-inside-with-escaped-underscore/routes/__root.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| import { createRootRoute } from '@tanstack/react-router' | ||
| export const Route = createRootRoute() | ||
2 changes: 2 additions & 0 deletions
2
.../router-generator/tests/generator/virtual-inside-with-escaped-underscore/routes/index.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| import { createFileRoute } from '@tanstack/react-router' | ||
| export const Route = createFileRoute('/')() |
11 changes: 11 additions & 0 deletions
11
...nerator/tests/generator/virtual-inside-with-escaped-underscore/routes/nested/__virtual.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| import { | ||
| defineVirtualSubtreeConfig, | ||
| index, | ||
| route, | ||
| } from '@tanstack/virtual-file-routes' | ||
|
|
||
| export default defineVirtualSubtreeConfig([ | ||
| index('home.tsx'), | ||
| route('[_]auth', 'auth.tsx'), | ||
| route('[_]callback', 'callback.tsx'), | ||
| ]) |
2 changes: 2 additions & 0 deletions
2
...r-generator/tests/generator/virtual-inside-with-escaped-underscore/routes/nested/auth.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| import { createFileRoute } from '@tanstack/react-router' | ||
| export const Route = createFileRoute('/nested/_auth')() |
2 changes: 2 additions & 0 deletions
2
...nerator/tests/generator/virtual-inside-with-escaped-underscore/routes/nested/callback.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| import { createFileRoute } from '@tanstack/react-router' | ||
| export const Route = createFileRoute('/nested/_callback')() |
2 changes: 2 additions & 0 deletions
2
...r-generator/tests/generator/virtual-inside-with-escaped-underscore/routes/nested/home.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| import { createFileRoute } from '@tanstack/react-router' | ||
| export const Route = createFileRoute('/nested/')() |
114 changes: 114 additions & 0 deletions
114
...es/router-generator/tests/generator/virtual-with-escaped-underscore/routeTree.snapshot.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,114 @@ | ||
| /* eslint-disable */ | ||
|
|
||
| // @ts-nocheck | ||
|
|
||
| // noinspection JSUnusedGlobalSymbols | ||
|
|
||
| // This file was automatically generated by TanStack Router. | ||
| // You should NOT make any changes in this file as it will be overwritten. | ||
| // Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified. | ||
|
|
||
| import { Route as rootRouteImport } from './routes/__root' | ||
| import { Route as indexRouteImport } from './routes/index' | ||
| import { Route as ApiIndexRouteImport } from './routes/physical-routes/index' | ||
| import { Route as ApiChar91_Char93helloRouteImport } from './routes/physical-routes/[_]hello' | ||
| import { Route as ApiChar91_Char93authDotrouteRouteImport } from './routes/physical-routes/[_]auth.route' | ||
|
|
||
| const indexRoute = indexRouteImport.update({ | ||
| id: '/', | ||
| path: '/', | ||
| getParentRoute: () => rootRouteImport, | ||
| } as any) | ||
| const ApiIndexRoute = ApiIndexRouteImport.update({ | ||
| id: '/api/', | ||
| path: '/api/', | ||
| getParentRoute: () => rootRouteImport, | ||
| } as any) | ||
| const ApiChar91_Char93helloRoute = ApiChar91_Char93helloRouteImport.update({ | ||
| id: '/api/_hello', | ||
| path: '/api/_hello', | ||
| getParentRoute: () => rootRouteImport, | ||
| } as any) | ||
| const ApiChar91_Char93authDotrouteRoute = | ||
| ApiChar91_Char93authDotrouteRouteImport.update({ | ||
| id: '/api/_auth', | ||
| path: '/api/_auth', | ||
| getParentRoute: () => rootRouteImport, | ||
| } as any) | ||
|
|
||
| export interface FileRoutesByFullPath { | ||
| '/': typeof indexRoute | ||
| '/api/_auth': typeof ApiChar91_Char93authDotrouteRoute | ||
| '/api/_hello': typeof ApiChar91_Char93helloRoute | ||
| '/api': typeof ApiIndexRoute | ||
| } | ||
| export interface FileRoutesByTo { | ||
| '/': typeof indexRoute | ||
| '/api/_auth': typeof ApiChar91_Char93authDotrouteRoute | ||
| '/api/_hello': typeof ApiChar91_Char93helloRoute | ||
| '/api': typeof ApiIndexRoute | ||
| } | ||
| export interface FileRoutesById { | ||
| __root__: typeof rootRouteImport | ||
| '/': typeof indexRoute | ||
| '/api/_auth': typeof ApiChar91_Char93authDotrouteRoute | ||
| '/api/_hello': typeof ApiChar91_Char93helloRoute | ||
| '/api/': typeof ApiIndexRoute | ||
| } | ||
| export interface FileRouteTypes { | ||
| fileRoutesByFullPath: FileRoutesByFullPath | ||
| fullPaths: '/' | '/api/_auth' | '/api/_hello' | '/api' | ||
| fileRoutesByTo: FileRoutesByTo | ||
| to: '/' | '/api/_auth' | '/api/_hello' | '/api' | ||
| id: '__root__' | '/' | '/api/_auth' | '/api/_hello' | '/api/' | ||
| fileRoutesById: FileRoutesById | ||
| } | ||
| export interface RootRouteChildren { | ||
| indexRoute: typeof indexRoute | ||
| ApiChar91_Char93authDotrouteRoute: typeof ApiChar91_Char93authDotrouteRoute | ||
| ApiChar91_Char93helloRoute: typeof ApiChar91_Char93helloRoute | ||
| ApiIndexRoute: typeof ApiIndexRoute | ||
| } | ||
|
|
||
| declare module '@tanstack/react-router' { | ||
| interface FileRoutesByPath { | ||
| '/': { | ||
| id: '/' | ||
| path: '/' | ||
| fullPath: '/' | ||
| preLoaderRoute: typeof indexRouteImport | ||
| parentRoute: typeof rootRouteImport | ||
| } | ||
| '/api/': { | ||
| id: '/api/' | ||
| path: '/api' | ||
| fullPath: '/api' | ||
| preLoaderRoute: typeof ApiIndexRouteImport | ||
| parentRoute: typeof rootRouteImport | ||
| } | ||
| '/api/_hello': { | ||
| id: '/api/_hello' | ||
| path: '/api/_hello' | ||
| fullPath: '/api/_hello' | ||
| preLoaderRoute: typeof ApiChar91_Char93helloRouteImport | ||
| parentRoute: typeof rootRouteImport | ||
| } | ||
| '/api/_auth': { | ||
| id: '/api/_auth' | ||
| path: '/api/_auth' | ||
| fullPath: '/api/_auth' | ||
| preLoaderRoute: typeof ApiChar91_Char93authDotrouteRouteImport | ||
| parentRoute: typeof rootRouteImport | ||
| } | ||
| } | ||
| } | ||
|
|
||
| const rootRouteChildren: RootRouteChildren = { | ||
| indexRoute: indexRoute, | ||
| ApiChar91_Char93authDotrouteRoute: ApiChar91_Char93authDotrouteRoute, | ||
| ApiChar91_Char93helloRoute: ApiChar91_Char93helloRoute, | ||
| ApiIndexRoute: ApiIndexRoute, | ||
| } | ||
| export const routeTree = rootRouteImport | ||
| ._addFileChildren(rootRouteChildren) | ||
| ._addFileTypes<FileRouteTypes>() |
3 changes: 3 additions & 0 deletions
3
packages/router-generator/tests/generator/virtual-with-escaped-underscore/routes/__root.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| import { createRootRoute } from '@tanstack/react-router' | ||
|
|
||
| export const Route = createRootRoute() |
5 changes: 5 additions & 0 deletions
5
packages/router-generator/tests/generator/virtual-with-escaped-underscore/routes/index.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| import { createFileRoute } from '@tanstack/react-router' | ||
|
|
||
| export const Route = createFileRoute('/')({ | ||
| component: () => 'Hello', | ||
| }) |
5 changes: 5 additions & 0 deletions
5
.../tests/generator/virtual-with-escaped-underscore/routes/physical-routes/[_]auth.route.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| import { createFileRoute } from '@tanstack/react-router' | ||
|
|
||
| export const Route = createFileRoute('/api/_auth')({ | ||
| component: () => 'Auth Route', | ||
| }) |
5 changes: 5 additions & 0 deletions
5
...rator/tests/generator/virtual-with-escaped-underscore/routes/physical-routes/[_]hello.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| import { createFileRoute } from '@tanstack/react-router' | ||
|
|
||
| export const Route = createFileRoute('/api/_hello')({ | ||
| component: () => 'Hello API', | ||
| }) |
5 changes: 5 additions & 0 deletions
5
...enerator/tests/generator/virtual-with-escaped-underscore/routes/physical-routes/index.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| import { createFileRoute } from '@tanstack/react-router' | ||
|
|
||
| export const Route = createFileRoute('/api/')({ | ||
| component: () => 'API Index', | ||
| }) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.