From bf84668ff82abe12438b40d9199c1e22684c8d32 Mon Sep 17 00:00:00 2001 From: Nico Lynzaad Date: Sat, 20 Dec 2025 12:07:26 +0200 Subject: [PATCH 1/5] remove experimental non-nested from tests --- e2e/react-router/basic-file-based/package.json | 9 ++------- .../basic-file-based/playwright.config.ts | 7 +------ .../src/routes/params-ps/non-nested/$foo_/$bar.tsx | 6 +----- .../src/routes/posts_.$postId.edit.tsx | 11 ++--------- e2e/react-router/basic-file-based/tests/app.spec.ts | 3 ++- .../tests/utils/useExperimentalNonNestedRoutes.ts | 6 ------ e2e/react-router/basic-file-based/vite.config.js | 3 --- e2e/solid-router/basic-file-based/package.json | 9 ++------- .../basic-file-based/playwright.config.ts | 7 +------ .../src/routes/params-ps/non-nested/$foo_/$bar.tsx | 6 +----- .../src/routes/posts_.$postId.edit.tsx | 11 ++--------- .../tests/utils/useExperimentalNonNestedRoutes.ts | 6 ------ e2e/solid-router/basic-file-based/vite.config.js | 3 --- 13 files changed, 14 insertions(+), 73 deletions(-) delete mode 100644 e2e/react-router/basic-file-based/tests/utils/useExperimentalNonNestedRoutes.ts delete mode 100644 e2e/solid-router/basic-file-based/tests/utils/useExperimentalNonNestedRoutes.ts diff --git a/e2e/react-router/basic-file-based/package.json b/e2e/react-router/basic-file-based/package.json index d4ca2bb8136..03f686244ef 100644 --- a/e2e/react-router/basic-file-based/package.json +++ b/e2e/react-router/basic-file-based/package.json @@ -4,17 +4,12 @@ "type": "module", "scripts": { "dev": "vite --port 3000", - "dev:nonnested": "MODE=nonnested VITE_MODE=nonnested vite --port 3000", "dev:e2e": "vite", "build": "vite build && tsc --noEmit", - "build:nonnested": "MODE=nonnested VITE_MODE=nonnested vite build && tsc --noEmit", "preview": "vite preview", - "preview:nonnested": "MODE=nonnested VITE_MODE=nonnested vite preview", "start": "vite", - "start:nonnested": "MODE=nonnested VITE_MODE=nonnested vite", - "test:e2e": "pnpm run test:e2e:nonnested && pnpm run test:e2e:default", - "test:e2e:default": "rm -rf port*.txt; playwright test --project=chromium", - "test:e2e:nonnested": "rm -rf port*.txt; MODE=nonnested playwright test --project=chromium" + "test:e2e": "pnpm run test:e2e:default", + "test:e2e:default": "rm -rf port*.txt; playwright test --project=chromium" }, "dependencies": { "@tailwindcss/postcss": "^4.1.15", diff --git a/e2e/react-router/basic-file-based/playwright.config.ts b/e2e/react-router/basic-file-based/playwright.config.ts index a67747dffd2..6e4e1d7703f 100644 --- a/e2e/react-router/basic-file-based/playwright.config.ts +++ b/e2e/react-router/basic-file-based/playwright.config.ts @@ -4,16 +4,11 @@ import { getTestServerPort, } from '@tanstack/router-e2e-utils' import packageJson from './package.json' with { type: 'json' } -import { useExperimentalNonNestedRoutes } from './tests/utils/useExperimentalNonNestedRoutes' const PORT = await getTestServerPort(packageJson.name) const EXTERNAL_PORT = await getDummyServerPort(packageJson.name) const baseURL = `http://localhost:${PORT}` -const experimentalNonNestedPathsModeCommand = `pnpm build:nonnested && pnpm preview:nonnested --port ${PORT}` -const defaultCommand = `pnpm build && pnpm preview --port ${PORT}` -const command = useExperimentalNonNestedRoutes - ? experimentalNonNestedPathsModeCommand - : defaultCommand +const command = `pnpm build && pnpm preview --port ${PORT}` console.info('Running with mode: ', process.env.MODE || 'default') diff --git a/e2e/react-router/basic-file-based/src/routes/params-ps/non-nested/$foo_/$bar.tsx b/e2e/react-router/basic-file-based/src/routes/params-ps/non-nested/$foo_/$bar.tsx index e9af3da4656..333dead3887 100644 --- a/e2e/react-router/basic-file-based/src/routes/params-ps/non-nested/$foo_/$bar.tsx +++ b/e2e/react-router/basic-file-based/src/routes/params-ps/non-nested/$foo_/$bar.tsx @@ -1,15 +1,11 @@ import { createFileRoute, useParams } from '@tanstack/react-router' -import { useExperimentalNonNestedRoutes } from '../../../../../tests/utils/useExperimentalNonNestedRoutes' export const Route = createFileRoute('/params-ps/non-nested/$foo_/$bar')({ component: RouteComponent, }) function RouteComponent() { - const fooParams = useParams({ - // @ts-expect-error path is updated with new Experimental Non Nested Paths to not include the trailing underscore - from: `/params-ps/non-nested/${useExperimentalNonNestedRoutes ? '$foo' : '$foo_'}`, - }) + const fooParams = useParams({ from: `/params-ps/non-nested/$foo_` }) const routeParams = Route.useParams() return ( diff --git a/e2e/react-router/basic-file-based/src/routes/posts_.$postId.edit.tsx b/e2e/react-router/basic-file-based/src/routes/posts_.$postId.edit.tsx index b747dac6cd7..80b89bdc9e2 100644 --- a/e2e/react-router/basic-file-based/src/routes/posts_.$postId.edit.tsx +++ b/e2e/react-router/basic-file-based/src/routes/posts_.$postId.edit.tsx @@ -1,21 +1,14 @@ import { createFileRoute, getRouteApi, useParams } from '@tanstack/react-router' -import { useExperimentalNonNestedRoutes } from '../../tests/utils/useExperimentalNonNestedRoutes' export const Route = createFileRoute('/posts_/$postId/edit')({ component: PostEditPage, }) -const api = getRouteApi( - // @ts-expect-error path is updated with new Experimental Non Nested Paths to not include the trailing underscore - `/${useExperimentalNonNestedRoutes ? 'posts' : 'posts_'}/$postId/edit`, -) +const api = getRouteApi(`/posts_/$postId/edit`) function PostEditPage() { const paramsViaApi = api.useParams() - const paramsViaHook = useParams({ - // @ts-expect-error path is updated with new Experimental Non Nested Paths to not include the trailing underscore - from: `/${useExperimentalNonNestedRoutes ? 'posts' : 'posts_'}/$postId/edit`, - }) + const paramsViaHook = useParams({ from: `/posts_/$postId/edit` }) const paramsViaRouteHook = Route.useParams() diff --git a/e2e/react-router/basic-file-based/tests/app.spec.ts b/e2e/react-router/basic-file-based/tests/app.spec.ts index ab11a5fb1c6..19361d880a7 100644 --- a/e2e/react-router/basic-file-based/tests/app.spec.ts +++ b/e2e/react-router/basic-file-based/tests/app.spec.ts @@ -221,7 +221,8 @@ testCases.forEach(({ description, testId }) => { test('navigating to an unnested route', async ({ page }) => { const postId = 'hello-world' - page.goto(`/posts/${postId}/edit`) + await page.goto(`/posts/${postId}/edit`) + await page.waitForURL(`/posts/${postId}/edit`) await expect(page.getByTestId('params-via-hook')).toContainText(postId) await expect(page.getByTestId('params-via-route-hook')).toContainText(postId) await expect(page.getByTestId('params-via-route-api')).toContainText(postId) diff --git a/e2e/react-router/basic-file-based/tests/utils/useExperimentalNonNestedRoutes.ts b/e2e/react-router/basic-file-based/tests/utils/useExperimentalNonNestedRoutes.ts deleted file mode 100644 index 1aa7b0d8deb..00000000000 --- a/e2e/react-router/basic-file-based/tests/utils/useExperimentalNonNestedRoutes.ts +++ /dev/null @@ -1,6 +0,0 @@ -export const useExperimentalNonNestedRoutes = - typeof process !== 'undefined' - ? typeof process.env.MODE !== 'undefined' - ? process.env.MODE === 'nonnested' - : process.env.VITE_MODE === 'nonnested' - : import.meta.env.VITE_MODE === 'nonnested' diff --git a/e2e/react-router/basic-file-based/vite.config.js b/e2e/react-router/basic-file-based/vite.config.js index e37b67cfb2c..940c8aa2363 100644 --- a/e2e/react-router/basic-file-based/vite.config.js +++ b/e2e/react-router/basic-file-based/vite.config.js @@ -7,9 +7,6 @@ export default defineConfig({ plugins: [ tanstackRouter({ target: 'react', - experimental: { - nonNestedRoutes: process.env.MODE === 'nonnested', - }, }), react(), ], diff --git a/e2e/solid-router/basic-file-based/package.json b/e2e/solid-router/basic-file-based/package.json index 29bf04a149b..3f9693b0dce 100644 --- a/e2e/solid-router/basic-file-based/package.json +++ b/e2e/solid-router/basic-file-based/package.json @@ -4,17 +4,12 @@ "type": "module", "scripts": { "dev": "vite --port 3000", - "dev:nonnested": "MODE=nonnested VITE_MODE=nonnested vite --port 3000", "dev:e2e": "vite", "build": "vite build && tsc --noEmit", - "build:nonnested": "MODE=nonnested VITE_MODE=nonnested vite build && tsc --noEmit", "preview": "vite preview", - "preview:nonnested": "MODE=nonnested VITE_MODE=nonnested vite preview", "start": "vite", - "start:nonnested": "MODE=nonnested VITE_MODE=nonnested vite", - "test:e2e": "pnpm run test:e2e:nonnested && pnpm run test:e2e:default", - "test:e2e:default": "rm -rf port*.txt; playwright test --project=chromium", - "test:e2e:nonnested": "rm -rf port*.txt; MODE=nonnested playwright test --project=chromium" + "test:e2e": "pnpm run test:e2e:default", + "test:e2e:default": "rm -rf port*.txt; playwright test --project=chromium" }, "dependencies": { "@tailwindcss/postcss": "^4.1.15", diff --git a/e2e/solid-router/basic-file-based/playwright.config.ts b/e2e/solid-router/basic-file-based/playwright.config.ts index a67747dffd2..6e4e1d7703f 100644 --- a/e2e/solid-router/basic-file-based/playwright.config.ts +++ b/e2e/solid-router/basic-file-based/playwright.config.ts @@ -4,16 +4,11 @@ import { getTestServerPort, } from '@tanstack/router-e2e-utils' import packageJson from './package.json' with { type: 'json' } -import { useExperimentalNonNestedRoutes } from './tests/utils/useExperimentalNonNestedRoutes' const PORT = await getTestServerPort(packageJson.name) const EXTERNAL_PORT = await getDummyServerPort(packageJson.name) const baseURL = `http://localhost:${PORT}` -const experimentalNonNestedPathsModeCommand = `pnpm build:nonnested && pnpm preview:nonnested --port ${PORT}` -const defaultCommand = `pnpm build && pnpm preview --port ${PORT}` -const command = useExperimentalNonNestedRoutes - ? experimentalNonNestedPathsModeCommand - : defaultCommand +const command = `pnpm build && pnpm preview --port ${PORT}` console.info('Running with mode: ', process.env.MODE || 'default') diff --git a/e2e/solid-router/basic-file-based/src/routes/params-ps/non-nested/$foo_/$bar.tsx b/e2e/solid-router/basic-file-based/src/routes/params-ps/non-nested/$foo_/$bar.tsx index 221716f9836..3da9f4322a7 100644 --- a/e2e/solid-router/basic-file-based/src/routes/params-ps/non-nested/$foo_/$bar.tsx +++ b/e2e/solid-router/basic-file-based/src/routes/params-ps/non-nested/$foo_/$bar.tsx @@ -1,15 +1,11 @@ import { createFileRoute, useParams } from '@tanstack/solid-router' -import { useExperimentalNonNestedRoutes } from '../../../../../tests/utils/useExperimentalNonNestedRoutes' export const Route = createFileRoute('/params-ps/non-nested/$foo_/$bar')({ component: RouteComponent, }) function RouteComponent() { - const fooParams = useParams({ - // @ts-expect-error path is updated with new Experimental Non Nested Paths to not include the trailing underscore - from: `/params-ps/non-nested/${useExperimentalNonNestedRoutes ? '$foo' : '$foo_'}`, - }) + const fooParams = useParams({ from: `/params-ps/non-nested/$foo_` }) const routeParams = Route.useParams() return ( diff --git a/e2e/solid-router/basic-file-based/src/routes/posts_.$postId.edit.tsx b/e2e/solid-router/basic-file-based/src/routes/posts_.$postId.edit.tsx index 576d1245a5c..b509ebac84d 100644 --- a/e2e/solid-router/basic-file-based/src/routes/posts_.$postId.edit.tsx +++ b/e2e/solid-router/basic-file-based/src/routes/posts_.$postId.edit.tsx @@ -1,21 +1,14 @@ import { createFileRoute, getRouteApi, useParams } from '@tanstack/solid-router' -import { useExperimentalNonNestedRoutes } from '../../tests/utils/useExperimentalNonNestedRoutes' export const Route = createFileRoute('/posts_/$postId/edit')({ component: PostEditPage, }) -const api = getRouteApi( - // @ts-expect-error path is updated with new Experimental Non Nested Paths to not include the trailing underscore - `/${useExperimentalNonNestedRoutes ? 'posts' : 'posts_'}/$postId/edit`, -) +const api = getRouteApi(`/posts_/$postId/edit`) function PostEditPage() { const paramsViaApi = api.useParams() - const paramsViaHook = useParams({ - // @ts-expect-error path is updated with new Experimental Non Nested Paths to not include the trailing underscore - from: `/${useExperimentalNonNestedRoutes ? 'posts' : 'posts_'}/$postId/edit`, - }) + const paramsViaHook = useParams({ from: `/posts_/$postId/edit` }) const paramsViaRouteHook = Route.useParams() return ( diff --git a/e2e/solid-router/basic-file-based/tests/utils/useExperimentalNonNestedRoutes.ts b/e2e/solid-router/basic-file-based/tests/utils/useExperimentalNonNestedRoutes.ts deleted file mode 100644 index 1aa7b0d8deb..00000000000 --- a/e2e/solid-router/basic-file-based/tests/utils/useExperimentalNonNestedRoutes.ts +++ /dev/null @@ -1,6 +0,0 @@ -export const useExperimentalNonNestedRoutes = - typeof process !== 'undefined' - ? typeof process.env.MODE !== 'undefined' - ? process.env.MODE === 'nonnested' - : process.env.VITE_MODE === 'nonnested' - : import.meta.env.VITE_MODE === 'nonnested' diff --git a/e2e/solid-router/basic-file-based/vite.config.js b/e2e/solid-router/basic-file-based/vite.config.js index fa9b80e95d5..ad6e60e8303 100644 --- a/e2e/solid-router/basic-file-based/vite.config.js +++ b/e2e/solid-router/basic-file-based/vite.config.js @@ -7,9 +7,6 @@ export default defineConfig({ plugins: [ tanstackRouter({ target: 'solid', - experimental: { - nonNestedRoutes: process.env.MODE === 'nonnested', - }, }), solid(), ], From 40849b15a3f0c4480777add6318d6c057d4c679b Mon Sep 17 00:00:00 2001 From: Nico Lynzaad Date: Sat, 20 Dec 2025 12:55:21 +0200 Subject: [PATCH 2/5] remove experimental non-nested from router-generator --- packages/router-generator/src/config.ts | 2 - .../src/filesystem/physical/getRouteNodes.ts | 5 +- packages/router-generator/src/generator.ts | 27 +- packages/router-generator/src/types.ts | 1 - packages/router-generator/src/utils.ts | 199 +----- .../tests/deny-route-group-config.test.ts | 20 +- .../router-generator/tests/generator.test.ts | 45 +- .../routeTree.nonnested.snapshot.ts | 61 -- .../routeTree.nonnested.snapshot.ts | 98 --- .../routeTree.nonnested.snapshot.ts | 226 ------- .../routeTree.nonnested.snapshot.ts | 137 ---- .../routeTree.nonnested.snapshot.ts | 78 --- .../routeTree.nonnested.snapshot.ts | 207 ------ .../routeTree.nonnested.snapshot.ts | 155 ----- .../routeTree.nonnested.snapshot.ts | 145 ---- .../flat/routeTree.nonnested.snapshot.ts | 341 ---------- .../routeTree.nonnested.snapshot.ts | 586 ----------------- .../routeTree.nonnested.snapshot.ts | 196 ------ .../routeTree.nonnested.snapshot.ts | 461 ------------- .../tests.nonnested.test-d.ts | 619 ------------------ .../routeTree.nonnested.snapshot.ts | 341 ---------- .../tests.nonnested.test-d.ts | 619 ------------------ .../routeTree.nonnested.snapshot.ts | 86 --- .../routeTree.nonnested.snapshot.ts | 77 --- .../routeTree.nonnested.snapshot.ts | 131 ---- .../routeTree.nonnested.generated.snapshot.ts | 35 - .../only-root/routeTree.nonnested.snapshot.ts | 35 - .../routeTree.nonnested.snapshot.ts | 104 --- .../routeTree.nonnested.snapshot.ts | 129 ---- .../routeTree.nonnested.snapshot.ts | 264 -------- .../routeTree.nonnested.snapshot.ts | 77 --- .../routeTree.nonnested.snapshot.ts | 77 --- .../routeTree.nonnested.snapshot.ts | 77 --- .../routeTree.nonnested.snapshot.js | 49 -- .../routeTree.nonnested.snapshot.ts | 292 --------- .../routeTree.nonnested.snapshot.ts | 292 --------- .../routeTree.nonnested.snapshot.ts | 121 ---- .../virtual/routeTree.nonnested.snapshot.ts | 292 --------- packages/router-generator/tests/utils.test.ts | 362 +++------- 39 files changed, 126 insertions(+), 6943 deletions(-) delete mode 100644 packages/router-generator/tests/generator/append-and-prepend/routeTree.nonnested.snapshot.ts delete mode 100644 packages/router-generator/tests/generator/custom-scaffolding/routeTree.nonnested.snapshot.ts delete mode 100644 packages/router-generator/tests/generator/custom-tokens/routeTree.nonnested.snapshot.ts delete mode 100644 packages/router-generator/tests/generator/dot-escaped/routeTree.nonnested.snapshot.ts delete mode 100644 packages/router-generator/tests/generator/export-variations/routeTree.nonnested.snapshot.ts delete mode 100644 packages/router-generator/tests/generator/file-modification-verboseFileRoutes-false/routeTree.nonnested.snapshot.ts delete mode 100644 packages/router-generator/tests/generator/file-modification-verboseFileRoutes-true/routeTree.nonnested.snapshot.ts delete mode 100644 packages/router-generator/tests/generator/flat-route-group/routeTree.nonnested.snapshot.ts delete mode 100644 packages/router-generator/tests/generator/flat/routeTree.nonnested.snapshot.ts delete mode 100644 packages/router-generator/tests/generator/nested-layouts/routeTree.nonnested.snapshot.ts delete mode 100644 packages/router-generator/tests/generator/nested-route-groups-with-layouts-before-physical/routeTree.nonnested.snapshot.ts delete mode 100644 packages/router-generator/tests/generator/nested-verboseFileRoutes-false/routeTree.nonnested.snapshot.ts delete mode 100644 packages/router-generator/tests/generator/nested-verboseFileRoutes-false/tests.nonnested.test-d.ts delete mode 100644 packages/router-generator/tests/generator/nested-verboseFileRoutes-true/routeTree.nonnested.snapshot.ts delete mode 100644 packages/router-generator/tests/generator/nested-verboseFileRoutes-true/tests.nonnested.test-d.ts delete mode 100644 packages/router-generator/tests/generator/no-duplicate-route-segment/routeTree.nonnested.snapshot.ts delete mode 100644 packages/router-generator/tests/generator/no-formatted-route-tree/routeTree.nonnested.snapshot.ts delete mode 100644 packages/router-generator/tests/generator/numbers-in-path/routeTree.nonnested.snapshot.ts delete mode 100644 packages/router-generator/tests/generator/only-root/routeTree.nonnested.generated.snapshot.ts delete mode 100644 packages/router-generator/tests/generator/only-root/routeTree.nonnested.snapshot.ts delete mode 100644 packages/router-generator/tests/generator/path-above-route-in-group/routeTree.nonnested.snapshot.ts delete mode 100644 packages/router-generator/tests/generator/prefix-suffix/routeTree.nonnested.snapshot.ts delete mode 100644 packages/router-generator/tests/generator/route-groups/routeTree.nonnested.snapshot.ts delete mode 100644 packages/router-generator/tests/generator/routeFileIgnore/routeTree.nonnested.snapshot.ts delete mode 100644 packages/router-generator/tests/generator/routeFilePrefix/routeTree.nonnested.snapshot.ts delete mode 100644 packages/router-generator/tests/generator/single-level/routeTree.nonnested.snapshot.ts delete mode 100644 packages/router-generator/tests/generator/types-disabled/routeTree.nonnested.snapshot.js delete mode 100644 packages/router-generator/tests/generator/virtual-config-file-default-export/routeTree.nonnested.snapshot.ts delete mode 100644 packages/router-generator/tests/generator/virtual-config-file-named-export/routeTree.nonnested.snapshot.ts delete mode 100644 packages/router-generator/tests/generator/virtual-inside-nested/routeTree.nonnested.snapshot.ts delete mode 100644 packages/router-generator/tests/generator/virtual/routeTree.nonnested.snapshot.ts diff --git a/packages/router-generator/src/config.ts b/packages/router-generator/src/config.ts index d44575435f7..0d1ae473391 100644 --- a/packages/router-generator/src/config.ts +++ b/packages/router-generator/src/config.ts @@ -54,8 +54,6 @@ export const configSchema = baseConfigSchema.extend({ .object({ // TODO: This has been made stable and is now "autoCodeSplitting". Remove in next major version. enableCodeSplitting: z.boolean().optional(), - // TODO: This resolves issues with non-nested paths in file-based routing. To be made default in next major version. - nonNestedRoutes: z.boolean().optional(), }) .optional(), plugins: z.array(z.custom()).optional(), diff --git a/packages/router-generator/src/filesystem/physical/getRouteNodes.ts b/packages/router-generator/src/filesystem/physical/getRouteNodes.ts index 4adcf6d7cdd..8f137ebfa12 100644 --- a/packages/router-generator/src/filesystem/physical/getRouteNodes.ts +++ b/packages/router-generator/src/filesystem/physical/getRouteNodes.ts @@ -34,7 +34,6 @@ export async function getRouteNodes( | 'disableLogging' | 'routeToken' | 'indexToken' - | 'experimental' >, root: string, ): Promise { @@ -135,8 +134,7 @@ export async function getRouteNodes( const { routePath: initialRoutePath, originalRoutePath: initialOriginalRoutePath, - isExperimentalNonNestedRoute, - } = determineInitialRoutePath(filePathNoExt, config) + } = determineInitialRoutePath(filePathNoExt) let routePath = initialRoutePath let originalRoutePath = initialOriginalRoutePath @@ -228,7 +226,6 @@ export async function getRouteNodes( routePath, variableName, _fsRouteType: routeType, - _isExperimentalNonNestedRoute: isExperimentalNonNestedRoute, originalRoutePath, }) } diff --git a/packages/router-generator/src/generator.ts b/packages/router-generator/src/generator.ts index f196c298c00..6df57f9f7ab 100644 --- a/packages/router-generator/src/generator.ts +++ b/packages/router-generator/src/generator.ts @@ -34,7 +34,6 @@ import { removeGroups, removeLastSegmentFromPath, removeLayoutSegments, - removeLeadingUnderscores, removeTrailingSlash, removeUnderscores, replaceBackslash, @@ -822,11 +821,8 @@ export class Generator { let fileRoutesByFullPath = '' if (!config.disableTypes) { - const routeNodesByFullPath = createRouteNodesByFullPath( - acc.routeNodes, - config, - ) - const routeNodesByTo = createRouteNodesByTo(acc.routeNodes, config) + const routeNodesByFullPath = createRouteNodesByFullPath(acc.routeNodes) + const routeNodesByTo = createRouteNodesByTo(acc.routeNodes) const routeNodesById = createRouteNodesById(acc.routeNodes) fileRoutesByFullPath = [ @@ -1360,15 +1356,7 @@ ${acc.routeTree.map((child) => `${child.variableName}Route: typeof ${getResolved prefixMap: RoutePrefixMap, config?: Config, ) { - const useExperimentalNonNestedRoutes = - config?.experimental?.nonNestedRoutes ?? false - - const parentRoute = hasParentRoute( - prefixMap, - node, - node.routePath, - node.originalRoutePath, - ) + const parentRoute = hasParentRoute(prefixMap, node, node.routePath) if (parentRoute) node.parent = parentRoute @@ -1383,15 +1371,8 @@ ${acc.routeTree.map((child) => `${child.variableName}Route: typeof ${getResolved lastRouteSegment.startsWith('_') || split.every((part) => this.routeGroupPatternRegex.test(part)) - // with new nonNestedPaths feature we can be sure any remaining trailing underscores are escaped and should remain - // TODO with new major we can remove check and only remove leading underscores node.cleanedPath = removeGroups( - (useExperimentalNonNestedRoutes - ? removeLeadingUnderscores( - removeLayoutSegments(node.path ?? ''), - config?.routeToken ?? '', - ) - : removeUnderscores(removeLayoutSegments(node.path))) ?? '', + removeUnderscores(removeLayoutSegments(node.path)) ?? '', ) if ( diff --git a/packages/router-generator/src/types.ts b/packages/router-generator/src/types.ts index 4c077581521..d8b00e15588 100644 --- a/packages/router-generator/src/types.ts +++ b/packages/router-generator/src/types.ts @@ -13,7 +13,6 @@ export type RouteNode = { children?: Array parent?: RouteNode createFileRouteProps?: Set - _isExperimentalNonNestedRoute?: boolean } export interface GetRouteNodesResult { diff --git a/packages/router-generator/src/utils.ts b/packages/router-generator/src/utils.ts index 2f1bb1441b3..5aca3af56a2 100644 --- a/packages/router-generator/src/utils.ts +++ b/packages/router-generator/src/utils.ts @@ -14,7 +14,6 @@ import type { ImportDeclaration, RouteNode } from './types' export class RoutePrefixMap { private prefixToRoute: Map = new Map() private layoutRoutes: Array = [] - private nonNestedRoutes: Array = [] constructor(routes: Array) { for (const route of routes) { @@ -23,7 +22,6 @@ export class RoutePrefixMap { // Index by exact path for direct lookups this.prefixToRoute.set(route.routePath, route) - // Track layout routes separately for non-nested route handling if ( route._fsRouteType === 'pathless_layout' || route._fsRouteType === 'layout' || @@ -31,20 +29,12 @@ export class RoutePrefixMap { ) { this.layoutRoutes.push(route) } - - // Track non-nested routes separately - if (route._isExperimentalNonNestedRoute) { - this.nonNestedRoutes.push(route) - } } // Sort by path length descending for longest-match-first this.layoutRoutes.sort( (a, b) => (b.routePath?.length ?? 0) - (a.routePath?.length ?? 0), ) - this.nonNestedRoutes.sort( - (a, b) => (b.routePath?.length ?? 0) - (a.routePath?.length ?? 0), - ) } /** @@ -69,48 +59,6 @@ export class RoutePrefixMap { return null } - /** - * Find parent for non-nested routes (needs layout route matching). - */ - findParentForNonNested( - routePath: string, - originalRoutePath: string | undefined, - nonNestedSegments: Array, - ): RouteNode | null { - // First check for other non-nested routes that are prefixes - // Use pre-sorted array for longest-match-first - for (const route of this.nonNestedRoutes) { - if ( - route.routePath !== routePath && - originalRoutePath?.startsWith(`${route.originalRoutePath}/`) - ) { - return route - } - } - - // Then check layout routes - for (const route of this.layoutRoutes) { - if (route.routePath === '/') continue - - // Skip if this route's original path + underscore matches a non-nested segment - if ( - nonNestedSegments.some((seg) => seg === `${route.originalRoutePath}_`) - ) { - continue - } - - // Check if this layout route is a prefix of the path we're looking for - if ( - routePath.startsWith(`${route.routePath}/`) && - route.routePath !== routePath - ) { - return route - } - } - - return null - } - /** * Check if a route exists at the given path. */ @@ -192,10 +140,7 @@ export function removeTrailingSlash(s: string) { const BRACKET_CONTENT_RE = /\[(.*?)\]/g const SPLIT_REGEX = /(?, -) { +export function determineInitialRoutePath(routePath: string) { const DISALLOWED_ESCAPE_CHARS = new Set([ '/', '\\', @@ -216,31 +161,7 @@ export function determineInitialRoutePath( `/${(cleanPath(routePath) || '').split(SPLIT_REGEX).join('/')}`, ) || '' - // check if the route path is a valid non-nested path, - // TODO with new major rename to reflect not experimental anymore - const isExperimentalNonNestedRoute = isValidNonNestedRoute( - originalRoutePath, - config, - ) - - let cleanedRoutePath = routePath - - // we already identified the path as non-nested and can now remove the trailing underscores - // we need to do this now before we encounter any escaped trailing underscores - // this way we can be sure any remaining trailing underscores should remain - // TODO with new major we can remove check and always remove leading underscores - if (config?.experimental?.nonNestedRoutes) { - // we should leave trailing underscores if the route path is the root path - if (originalRoutePath !== `/${rootPathId}`) { - // remove trailing underscores on various path segments - cleanedRoutePath = removeTrailingUnderscores( - originalRoutePath, - config.routeToken, - ) - } - } - - const parts = cleanedRoutePath.split(SPLIT_REGEX) + const parts = routePath.split(SPLIT_REGEX) // Escape any characters that in square brackets // we keep the original path untouched @@ -275,7 +196,6 @@ export function determineInitialRoutePath( return { routePath: final, - isExperimentalNonNestedRoute, originalRoutePath, } } @@ -518,30 +438,6 @@ export function removeLastSegmentFromPath(routePath: string = '/'): string { return segments.join('/') } -const nonNestedSegmentRegex = /_(?=\/|$)/g -const openBracketRegex = /\[/g -const closeBracketRegex = /\]/g - -/** - * Extracts non-nested segments from a route path. - * Used for determining parent routes in non-nested route scenarios. - */ -export function getNonNestedSegments(routePath: string): Array { - nonNestedSegmentRegex.lastIndex = 0 - const result: Array = [] - for (const match of routePath.matchAll(nonNestedSegmentRegex)) { - const beforeStr = routePath.substring(0, match.index) - openBracketRegex.lastIndex = 0 - closeBracketRegex.lastIndex = 0 - const openBrackets = beforeStr.match(openBracketRegex)?.length ?? 0 - const closeBrackets = beforeStr.match(closeBracketRegex)?.length ?? 0 - if (openBrackets === closeBrackets) { - result.push(routePath.substring(0, match.index + 1)) - } - } - return result.reverse() -} - /** * Find parent route using RoutePrefixMap for O(k) lookups instead of O(n). */ @@ -549,21 +445,11 @@ export function hasParentRoute( prefixMap: RoutePrefixMap, node: RouteNode, routePathToCheck: string | undefined, - originalRoutePathToCheck: string | undefined, ): RouteNode | null { if (!routePathToCheck || routePathToCheck === '/') { return null } - if (node._isExperimentalNonNestedRoute && originalRoutePathToCheck) { - const nonNestedSegments = getNonNestedSegments(originalRoutePathToCheck) - return prefixMap.findParentForNonNested( - routePathToCheck, - originalRoutePathToCheck, - nonNestedSegments, - ) - } - return prefixMap.findParent(routePathToCheck) } @@ -606,16 +492,9 @@ export const inferPath = (routeNode: RouteNode): string => { /** * Infers the full path for use by TS */ -export const inferFullPath = ( - routeNode: RouteNode, - config?: Pick, -): string => { - // with new nonNestedPaths feature we can be sure any remaining trailing underscores are escaped and should remain - // TODO with new major we can remove check and only remove leading underscores +export const inferFullPath = (routeNode: RouteNode): string => { const fullPath = removeGroups( - (config?.experimental?.nonNestedRoutes - ? removeLayoutSegments(routeNode.routePath) - : removeUnderscores(removeLayoutSegments(routeNode.routePath))) ?? '', + removeUnderscores(removeLayoutSegments(routeNode.routePath)) ?? '', ) return routeNode.cleanedPath === '/' ? fullPath : fullPath.replace(/\/$/, '') @@ -626,13 +505,9 @@ export const inferFullPath = ( */ export const createRouteNodesByFullPath = ( routeNodes: Array, - config?: Pick, ): Map => { return new Map( - routeNodes.map((routeNode) => [ - inferFullPath(routeNode, config), - routeNode, - ]), + routeNodes.map((routeNode) => [inferFullPath(routeNode), routeNode]), ) } @@ -641,11 +516,10 @@ export const createRouteNodesByFullPath = ( */ export const createRouteNodesByTo = ( routeNodes: Array, - config?: Pick, ): Map => { return new Map( dedupeBranchesAndIndexRoutes(routeNodes).map((routeNode) => [ - inferTo(routeNode, config), + inferTo(routeNode), routeNode, ]), ) @@ -668,11 +542,8 @@ export const createRouteNodesById = ( /** * Infers to path */ -export const inferTo = ( - routeNode: RouteNode, - config?: Pick, -): string => { - const fullPath = inferFullPath(routeNode, config) +export const inferTo = (routeNode: RouteNode): string => { + const fullPath = inferFullPath(routeNode) if (fullPath === '/') return fullPath @@ -711,7 +582,7 @@ export function checkRouteFullPathUniqueness( config: Config, ) { const routes = _routes.map((d) => { - const inferredFullPath = inferFullPath(d, config) + const inferredFullPath = inferFullPath(d) return { ...d, inferredFullPath } }) @@ -849,7 +720,7 @@ export function buildFileRoutesByPathInterface(opts: { routeNodes: Array module: string interfaceName: string - config?: Pick + config?: Pick }): string { return `declare module '${opts.module}' { interface ${opts.interfaceName} { @@ -863,7 +734,7 @@ export function buildFileRoutesByPathInterface(opts: { return `'${filePathId}': { id: '${filePathId}' path: '${inferPath(routeNode)}' - fullPath: '${inferFullPath(routeNode, opts.config)}' + fullPath: '${inferFullPath(routeNode)}' preLoaderRoute: ${preloaderRoute} parentRoute: typeof ${parent} }` @@ -916,51 +787,3 @@ export function getImportForRouteNode( ], } satisfies ImportDeclaration } - -/** - * Used to validate if a route is a pathless layout route - * @param normalizedRoutePath Normalized route path, i.e `/foo/_layout/route.tsx` and `/foo._layout.route.tsx` to `/foo/_layout/route` - * @param config The `router-generator` configuration object - * @returns Boolean indicating if the route is a pathless layout route - */ -export function isValidNonNestedRoute( - normalizedRoutePath: string, - config?: Pick, -): boolean { - if (!config?.experimental?.nonNestedRoutes) { - return false - } - - const segments = normalizedRoutePath.split('/').filter(Boolean) - - if (segments.length === 0) { - return false - } - - const lastRouteSegment = segments[segments.length - 1]! - - // If segment === __root, then exit as false - if (lastRouteSegment === rootPathId) { - return false - } - - if ( - lastRouteSegment !== config.indexToken && - lastRouteSegment !== config.routeToken && - lastRouteSegment.endsWith('_') - ) { - return true - } - - for (const segment of segments.slice(0, -1).reverse()) { - if (segment === config.routeToken) { - return false - } - - if (segment.endsWith('_')) { - return true - } - } - - return false -} diff --git a/packages/router-generator/tests/deny-route-group-config.test.ts b/packages/router-generator/tests/deny-route-group-config.test.ts index bb8329634dd..7af8ddd69a3 100644 --- a/packages/router-generator/tests/deny-route-group-config.test.ts +++ b/packages/router-generator/tests/deny-route-group-config.test.ts @@ -10,22 +10,15 @@ function makeFolderDir(folder: string) { function setupConfig( folder: string, - nonNested: boolean, inlineConfig: Partial> = {}, ) { - const { - generatedRouteTree = `/routeTree.${nonNested ? 'nonnested.' : ''}gen.ts`, - ...rest - } = inlineConfig + const { generatedRouteTree = `/routeTree.gen.ts`, ...rest } = inlineConfig const dir = makeFolderDir(folder) const config = getConfig({ disableLogging: true, routesDirectory: dir, generatedRouteTree: dir + generatedRouteTree, - experimental: { - nonNestedRoutes: nonNested, - }, ...rest, }) return config @@ -34,7 +27,6 @@ function setupConfig( type TestCases = Array<{ folder: string expectedError: string - nonNested: boolean }> describe('deny-route-group-config throws', () => { @@ -59,16 +51,12 @@ describe('deny-route-group-config throws', () => { expectedError: '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?', }, - ].reduce((accum: TestCases, curr) => { - accum.push({ ...curr, nonNested: true }) - accum.push({ ...curr, nonNested: false }) - return accum - }, []) + ] it.each(testCases)( 'should throw an error for the folder: $folder', - async ({ folder, expectedError, nonNested }) => { - const config = setupConfig(folder, nonNested) + async ({ folder, expectedError }) => { + const config = setupConfig(folder) const folderRoot = makeFolderDir(folder) const generator = new Generator({ config, root: folderRoot }) diff --git a/packages/router-generator/tests/generator.test.ts b/packages/router-generator/tests/generator.test.ts index 4caeff1ee4f..8b737e0387a 100644 --- a/packages/router-generator/tests/generator.test.ts +++ b/packages/router-generator/tests/generator.test.ts @@ -42,22 +42,15 @@ async function traverseDirectory( function setupConfig( folder: string, - nonNested: boolean, inlineConfig: Partial> = {}, ) { - const { - generatedRouteTree = `/routeTree.${nonNested ? 'nonnested.' : ''}gen.ts`, - ...rest - } = inlineConfig + const { generatedRouteTree = `/routeTree.gen.ts`, ...rest } = inlineConfig const dir = makeFolderDir(folder) const config = getConfig({ disableLogging: true, routesDirectory: dir + '/routes', generatedRouteTree: dir + generatedRouteTree, - experimental: { - nonNestedRoutes: nonNested, - }, ...rest, }) return config @@ -69,11 +62,7 @@ async function getRouteTreeFileText(config: Config) { return text } -function rewriteConfigByFolderName( - folderName: string, - config: Config, - nonNested: boolean, -) { +function rewriteConfigByFolderName(folderName: string, config: Config) { switch (folderName) { case 'append-and-prepend': config.routeTreeFileHeader = ['// prepend1', '// prepend2'] @@ -114,8 +103,7 @@ function rewriteConfigByFolderName( case 'types-disabled': config.disableTypes = true config.generatedRouteTree = - makeFolderDir(folderName) + - `/routeTree.${nonNested ? 'nonnested.' : ''}gen.js` + makeFolderDir(folderName) + `/routeTree.gen.js` break case 'custom-scaffolding': config.customScaffolding = { @@ -246,19 +234,14 @@ function shouldThrow(folderName: string) { describe('generator works', async () => { const folderNames = await readDir() - const testCases = folderNames.flatMap((folderName) => [ - { folderName, nonNested: true }, - { folderName, nonNested: false }, - ]) - - it.each(testCases)( + it.each(folderNames)( 'should wire-up the routes for a "%s" tree', - async ({ folderName, nonNested }) => { + async (folderName) => { const folderRoot = makeFolderDir(folderName) - const config = await setupConfig(folderName, nonNested) + const config = await setupConfig(folderName) - rewriteConfigByFolderName(folderName, config, nonNested) + rewriteConfigByFolderName(folderName, config) await preprocess(folderName) const generator = new Generator({ config, root: folderRoot }) @@ -275,7 +258,7 @@ describe('generator works', async () => { const generatedRouteTree = await getRouteTreeFileText(config) - const snapshotPath = `routeTree.${nonNested ? 'nonnested.' : ''}snapshot.${config.disableTypes ? 'js' : 'ts'}` + const snapshotPath = `routeTree.snapshot.${config.disableTypes ? 'js' : 'ts'}` await expect(generatedRouteTree).toMatchFileSnapshot( join('generator', folderName, snapshotPath), @@ -286,22 +269,22 @@ describe('generator works', async () => { }, ) - it.each(testCases)( + it.each(folderNames)( 'should create directory for routeTree if it does not exist', - async ({ nonNested }) => { + async () => { const folderName = 'only-root' const folderRoot = makeFolderDir(folderName) let pathCreated = false - const config = await setupConfig(folderName, nonNested) + const config = await setupConfig(folderName) - rewriteConfigByFolderName(folderName, config, nonNested) + rewriteConfigByFolderName(folderName, config) await preprocess(folderName) config.generatedRouteTree = join( folderRoot, 'generated', - `/routeTree.${nonNested ? 'nonnested.' : ''}gen.ts`, + `/routeTree.gen.ts`, ) const generator = new Generator({ config, root: folderRoot }) @@ -322,7 +305,7 @@ describe('generator works', async () => { join( 'generator', folderName, - `routeTree.${nonNested ? 'nonnested.' : ''}generated.snapshot.${config.disableTypes ? 'js' : 'ts'}`, + `routeTree.generated.snapshot.${config.disableTypes ? 'js' : 'ts'}`, ), ) diff --git a/packages/router-generator/tests/generator/append-and-prepend/routeTree.nonnested.snapshot.ts b/packages/router-generator/tests/generator/append-and-prepend/routeTree.nonnested.snapshot.ts deleted file mode 100644 index 4592b6f51d1..00000000000 --- a/packages/router-generator/tests/generator/append-and-prepend/routeTree.nonnested.snapshot.ts +++ /dev/null @@ -1,61 +0,0 @@ -// prepend1 - -// prepend2 - -// This file was automatically generated by TanStack Router. -// You should NOT make any changes in this file as it will be overwritten. -// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified. - -import { Route as rootRouteImport } from './routes/__root' -import { Route as IndexRouteImport } from './routes/index' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' - fileRoutesByTo: FileRoutesByTo - to: '/' - id: '__root__' | '/' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -// append1 - -// append2 diff --git a/packages/router-generator/tests/generator/custom-scaffolding/routeTree.nonnested.snapshot.ts b/packages/router-generator/tests/generator/custom-scaffolding/routeTree.nonnested.snapshot.ts deleted file mode 100644 index e80d1e7e73c..00000000000 --- a/packages/router-generator/tests/generator/custom-scaffolding/routeTree.nonnested.snapshot.ts +++ /dev/null @@ -1,98 +0,0 @@ -/* eslint-disable */ - -// @ts-nocheck - -// noinspection JSUnusedGlobalSymbols - -// This file was automatically generated by TanStack Router. -// You should NOT make any changes in this file as it will be overwritten. -// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified. - -import { createFileRoute } from '@tanstack/react-router' - -import { Route as rootRouteImport } from './routes/__root' -import { Route as IndexRouteImport } from './routes/index' -import { Route as ApiBarRouteImport } from './routes/api/bar' - -const FooLazyRouteImport = createFileRoute('/foo')() - -const FooLazyRoute = FooLazyRouteImport.update({ - id: '/foo', - path: '/foo', - getParentRoute: () => rootRouteImport, -} as any).lazy(() => import('./routes/foo.lazy').then((d) => d.Route)) -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const ApiBarRoute = ApiBarRouteImport.update({ - id: '/api/bar', - path: '/api/bar', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/foo': typeof FooLazyRoute - '/api/bar': typeof ApiBarRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/foo': typeof FooLazyRoute - '/api/bar': typeof ApiBarRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/foo': typeof FooLazyRoute - '/api/bar': typeof ApiBarRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/foo' | '/api/bar' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/foo' | '/api/bar' - id: '__root__' | '/' | '/foo' | '/api/bar' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - FooLazyRoute: typeof FooLazyRoute - ApiBarRoute: typeof ApiBarRoute -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/foo': { - id: '/foo' - path: '/foo' - fullPath: '/foo' - preLoaderRoute: typeof FooLazyRouteImport - parentRoute: typeof rootRouteImport - } - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/api/bar': { - id: '/api/bar' - path: '/api/bar' - fullPath: '/api/bar' - preLoaderRoute: typeof ApiBarRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - FooLazyRoute: FooLazyRoute, - ApiBarRoute: ApiBarRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/packages/router-generator/tests/generator/custom-tokens/routeTree.nonnested.snapshot.ts b/packages/router-generator/tests/generator/custom-tokens/routeTree.nonnested.snapshot.ts deleted file mode 100644 index c82afab07df..00000000000 --- a/packages/router-generator/tests/generator/custom-tokens/routeTree.nonnested.snapshot.ts +++ /dev/null @@ -1,226 +0,0 @@ -/* eslint-disable */ - -// @ts-nocheck - -// noinspection JSUnusedGlobalSymbols - -// This file was automatically generated by TanStack Router. -// You should NOT make any changes in this file as it will be overwritten. -// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified. - -import { Route as rootRouteImport } from './routes/__root' -import { Route as PostsR0ut3RouteImport } from './routes/posts/_r0ut3_' -import { Route as BlogR0ut3RouteImport } from './routes/blog/_r0ut3_' -import { Route as R1nd3xRouteImport } from './routes/_1nd3x' -import { Route as Posts1nd3xRouteImport } from './routes/posts/_1nd3x' -import { Route as Blog1nd3xRouteImport } from './routes/blog/_1nd3x' -import { Route as BlogSlugRouteImport } from './routes/blog/$slug' -import { Route as PostsPostId1nd3xRouteImport } from './routes/posts/$postId/_1nd3x' -import { Route as PostsPostIdDeepRouteImport } from './routes/posts/$postId/deep' - -const PostsR0ut3Route = PostsR0ut3RouteImport.update({ - id: '/posts', - path: '/posts', - getParentRoute: () => rootRouteImport, -} as any) -const BlogR0ut3Route = BlogR0ut3RouteImport.update({ - id: '/blog', - path: '/blog', - getParentRoute: () => rootRouteImport, -} as any) -const R1nd3xRoute = R1nd3xRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const Posts1nd3xRoute = Posts1nd3xRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => PostsR0ut3Route, -} as any) -const Blog1nd3xRoute = Blog1nd3xRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => BlogR0ut3Route, -} as any) -const BlogSlugRoute = BlogSlugRouteImport.update({ - id: '/$slug', - path: '/$slug', - getParentRoute: () => BlogR0ut3Route, -} as any) -const PostsPostId1nd3xRoute = PostsPostId1nd3xRouteImport.update({ - id: '/$postId/', - path: '/$postId/', - getParentRoute: () => PostsR0ut3Route, -} as any) -const PostsPostIdDeepRoute = PostsPostIdDeepRouteImport.update({ - id: '/$postId/deep', - path: '/$postId/deep', - getParentRoute: () => PostsR0ut3Route, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof R1nd3xRoute - '/blog': typeof BlogR0ut3RouteWithChildren - '/posts': typeof PostsR0ut3RouteWithChildren - '/blog/$slug': typeof BlogSlugRoute - '/blog/': typeof Blog1nd3xRoute - '/posts/': typeof Posts1nd3xRoute - '/posts/$postId/deep': typeof PostsPostIdDeepRoute - '/posts/$postId': typeof PostsPostId1nd3xRoute -} -export interface FileRoutesByTo { - '/': typeof R1nd3xRoute - '/blog/$slug': typeof BlogSlugRoute - '/blog': typeof Blog1nd3xRoute - '/posts': typeof Posts1nd3xRoute - '/posts/$postId/deep': typeof PostsPostIdDeepRoute - '/posts/$postId': typeof PostsPostId1nd3xRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof R1nd3xRoute - '/blog': typeof BlogR0ut3RouteWithChildren - '/posts': typeof PostsR0ut3RouteWithChildren - '/blog/$slug': typeof BlogSlugRoute - '/blog/': typeof Blog1nd3xRoute - '/posts/': typeof Posts1nd3xRoute - '/posts/$postId/deep': typeof PostsPostIdDeepRoute - '/posts/$postId/': typeof PostsPostId1nd3xRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: - | '/' - | '/blog' - | '/posts' - | '/blog/$slug' - | '/blog/' - | '/posts/' - | '/posts/$postId/deep' - | '/posts/$postId' - fileRoutesByTo: FileRoutesByTo - to: - | '/' - | '/blog/$slug' - | '/blog' - | '/posts' - | '/posts/$postId/deep' - | '/posts/$postId' - id: - | '__root__' - | '/' - | '/blog' - | '/posts' - | '/blog/$slug' - | '/blog/' - | '/posts/' - | '/posts/$postId/deep' - | '/posts/$postId/' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - R1nd3xRoute: typeof R1nd3xRoute - BlogR0ut3Route: typeof BlogR0ut3RouteWithChildren - PostsR0ut3Route: typeof PostsR0ut3RouteWithChildren -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/posts': { - id: '/posts' - path: '/posts' - fullPath: '/posts' - preLoaderRoute: typeof PostsR0ut3RouteImport - parentRoute: typeof rootRouteImport - } - '/blog': { - id: '/blog' - path: '/blog' - fullPath: '/blog' - preLoaderRoute: typeof BlogR0ut3RouteImport - parentRoute: typeof rootRouteImport - } - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof R1nd3xRouteImport - parentRoute: typeof rootRouteImport - } - '/posts/': { - id: '/posts/' - path: '/' - fullPath: '/posts/' - preLoaderRoute: typeof Posts1nd3xRouteImport - parentRoute: typeof PostsR0ut3Route - } - '/blog/': { - id: '/blog/' - path: '/' - fullPath: '/blog/' - preLoaderRoute: typeof Blog1nd3xRouteImport - parentRoute: typeof BlogR0ut3Route - } - '/blog/$slug': { - id: '/blog/$slug' - path: '/$slug' - fullPath: '/blog/$slug' - preLoaderRoute: typeof BlogSlugRouteImport - parentRoute: typeof BlogR0ut3Route - } - '/posts/$postId/': { - id: '/posts/$postId/' - path: '/$postId' - fullPath: '/posts/$postId' - preLoaderRoute: typeof PostsPostId1nd3xRouteImport - parentRoute: typeof PostsR0ut3Route - } - '/posts/$postId/deep': { - id: '/posts/$postId/deep' - path: '/$postId/deep' - fullPath: '/posts/$postId/deep' - preLoaderRoute: typeof PostsPostIdDeepRouteImport - parentRoute: typeof PostsR0ut3Route - } - } -} - -interface BlogR0ut3RouteChildren { - BlogSlugRoute: typeof BlogSlugRoute - Blog1nd3xRoute: typeof Blog1nd3xRoute -} - -const BlogR0ut3RouteChildren: BlogR0ut3RouteChildren = { - BlogSlugRoute: BlogSlugRoute, - Blog1nd3xRoute: Blog1nd3xRoute, -} - -const BlogR0ut3RouteWithChildren = BlogR0ut3Route._addFileChildren( - BlogR0ut3RouteChildren, -) - -interface PostsR0ut3RouteChildren { - Posts1nd3xRoute: typeof Posts1nd3xRoute - PostsPostIdDeepRoute: typeof PostsPostIdDeepRoute - PostsPostId1nd3xRoute: typeof PostsPostId1nd3xRoute -} - -const PostsR0ut3RouteChildren: PostsR0ut3RouteChildren = { - Posts1nd3xRoute: Posts1nd3xRoute, - PostsPostIdDeepRoute: PostsPostIdDeepRoute, - PostsPostId1nd3xRoute: PostsPostId1nd3xRoute, -} - -const PostsR0ut3RouteWithChildren = PostsR0ut3Route._addFileChildren( - PostsR0ut3RouteChildren, -) - -const rootRouteChildren: RootRouteChildren = { - R1nd3xRoute: R1nd3xRoute, - BlogR0ut3Route: BlogR0ut3RouteWithChildren, - PostsR0ut3Route: PostsR0ut3RouteWithChildren, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/packages/router-generator/tests/generator/dot-escaped/routeTree.nonnested.snapshot.ts b/packages/router-generator/tests/generator/dot-escaped/routeTree.nonnested.snapshot.ts deleted file mode 100644 index 2ccc3a0a381..00000000000 --- a/packages/router-generator/tests/generator/dot-escaped/routeTree.nonnested.snapshot.ts +++ /dev/null @@ -1,137 +0,0 @@ -/* eslint-disable */ - -// @ts-nocheck - -// noinspection JSUnusedGlobalSymbols - -// This file was automatically generated by TanStack Router. -// You should NOT make any changes in this file as it will be overwritten. -// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified. - -import { Route as rootRouteImport } from './routes/__root' -import { Route as ScriptDotjsRouteImport } from './routes/script[.]js' -import { Route as NestedDotjsRouteImport } from './routes/nested[.]js' -import { Route as NestedDotjsScriptDotjsRouteImport } from './routes/nested[.]js.script[.]js' -import { Route as NestedDotjsDoubleDotextDotjsRouteImport } from './routes/nested[.]js.double[.]ext[.]js' - -const ScriptDotjsRoute = ScriptDotjsRouteImport.update({ - id: '/script.js', - path: '/script.js', - getParentRoute: () => rootRouteImport, -} as any) -const NestedDotjsRoute = NestedDotjsRouteImport.update({ - id: '/nested.js', - path: '/nested.js', - getParentRoute: () => rootRouteImport, -} as any) -const NestedDotjsScriptDotjsRoute = NestedDotjsScriptDotjsRouteImport.update({ - id: '/script.js', - path: '/script.js', - getParentRoute: () => NestedDotjsRoute, -} as any) -const NestedDotjsDoubleDotextDotjsRoute = - NestedDotjsDoubleDotextDotjsRouteImport.update({ - id: '/double.ext.js', - path: '/double.ext.js', - getParentRoute: () => NestedDotjsRoute, - } as any) - -export interface FileRoutesByFullPath { - '/nested.js': typeof NestedDotjsRouteWithChildren - '/script.js': typeof ScriptDotjsRoute - '/nested.js/double.ext.js': typeof NestedDotjsDoubleDotextDotjsRoute - '/nested.js/script.js': typeof NestedDotjsScriptDotjsRoute -} -export interface FileRoutesByTo { - '/nested.js': typeof NestedDotjsRouteWithChildren - '/script.js': typeof ScriptDotjsRoute - '/nested.js/double.ext.js': typeof NestedDotjsDoubleDotextDotjsRoute - '/nested.js/script.js': typeof NestedDotjsScriptDotjsRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/nested.js': typeof NestedDotjsRouteWithChildren - '/script.js': typeof ScriptDotjsRoute - '/nested.js/double.ext.js': typeof NestedDotjsDoubleDotextDotjsRoute - '/nested.js/script.js': typeof NestedDotjsScriptDotjsRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: - | '/nested.js' - | '/script.js' - | '/nested.js/double.ext.js' - | '/nested.js/script.js' - fileRoutesByTo: FileRoutesByTo - to: - | '/nested.js' - | '/script.js' - | '/nested.js/double.ext.js' - | '/nested.js/script.js' - id: - | '__root__' - | '/nested.js' - | '/script.js' - | '/nested.js/double.ext.js' - | '/nested.js/script.js' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - NestedDotjsRoute: typeof NestedDotjsRouteWithChildren - ScriptDotjsRoute: typeof ScriptDotjsRoute -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/script.js': { - id: '/script.js' - path: '/script.js' - fullPath: '/script.js' - preLoaderRoute: typeof ScriptDotjsRouteImport - parentRoute: typeof rootRouteImport - } - '/nested.js': { - id: '/nested.js' - path: '/nested.js' - fullPath: '/nested.js' - preLoaderRoute: typeof NestedDotjsRouteImport - parentRoute: typeof rootRouteImport - } - '/nested.js/script.js': { - id: '/nested.js/script.js' - path: '/script.js' - fullPath: '/nested.js/script.js' - preLoaderRoute: typeof NestedDotjsScriptDotjsRouteImport - parentRoute: typeof NestedDotjsRoute - } - '/nested.js/double.ext.js': { - id: '/nested.js/double.ext.js' - path: '/double.ext.js' - fullPath: '/nested.js/double.ext.js' - preLoaderRoute: typeof NestedDotjsDoubleDotextDotjsRouteImport - parentRoute: typeof NestedDotjsRoute - } - } -} - -interface NestedDotjsRouteChildren { - NestedDotjsDoubleDotextDotjsRoute: typeof NestedDotjsDoubleDotextDotjsRoute - NestedDotjsScriptDotjsRoute: typeof NestedDotjsScriptDotjsRoute -} - -const NestedDotjsRouteChildren: NestedDotjsRouteChildren = { - NestedDotjsDoubleDotextDotjsRoute: NestedDotjsDoubleDotextDotjsRoute, - NestedDotjsScriptDotjsRoute: NestedDotjsScriptDotjsRoute, -} - -const NestedDotjsRouteWithChildren = NestedDotjsRoute._addFileChildren( - NestedDotjsRouteChildren, -) - -const rootRouteChildren: RootRouteChildren = { - NestedDotjsRoute: NestedDotjsRouteWithChildren, - ScriptDotjsRoute: ScriptDotjsRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/packages/router-generator/tests/generator/export-variations/routeTree.nonnested.snapshot.ts b/packages/router-generator/tests/generator/export-variations/routeTree.nonnested.snapshot.ts deleted file mode 100644 index 63624894355..00000000000 --- a/packages/router-generator/tests/generator/export-variations/routeTree.nonnested.snapshot.ts +++ /dev/null @@ -1,78 +0,0 @@ -/* eslint-disable */ - -// @ts-nocheck - -// noinspection JSUnusedGlobalSymbols - -// This file was automatically generated by TanStack Router. -// You should NOT make any changes in this file as it will be overwritten. -// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified. - -import { Route as rootRouteImport } from './routes/__root' -import { Route as ExportWithAsRouteImport } from './routes/export-with-as' -import { Route as ExportSeparateFromDeclarationRouteImport } from './routes/export-separate-from-declaration' - -const ExportWithAsRoute = ExportWithAsRouteImport.update({ - id: '/export-with-as', - path: '/export-with-as', - getParentRoute: () => rootRouteImport, -} as any) -const ExportSeparateFromDeclarationRoute = - ExportSeparateFromDeclarationRouteImport.update({ - id: '/export-separate-from-declaration', - path: '/export-separate-from-declaration', - getParentRoute: () => rootRouteImport, - } as any) - -export interface FileRoutesByFullPath { - '/export-separate-from-declaration': typeof ExportSeparateFromDeclarationRoute - '/export-with-as': typeof ExportWithAsRoute -} -export interface FileRoutesByTo { - '/export-separate-from-declaration': typeof ExportSeparateFromDeclarationRoute - '/export-with-as': typeof ExportWithAsRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/export-separate-from-declaration': typeof ExportSeparateFromDeclarationRoute - '/export-with-as': typeof ExportWithAsRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/export-separate-from-declaration' | '/export-with-as' - fileRoutesByTo: FileRoutesByTo - to: '/export-separate-from-declaration' | '/export-with-as' - id: '__root__' | '/export-separate-from-declaration' | '/export-with-as' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - ExportSeparateFromDeclarationRoute: typeof ExportSeparateFromDeclarationRoute - ExportWithAsRoute: typeof ExportWithAsRoute -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/export-with-as': { - id: '/export-with-as' - path: '/export-with-as' - fullPath: '/export-with-as' - preLoaderRoute: typeof ExportWithAsRouteImport - parentRoute: typeof rootRouteImport - } - '/export-separate-from-declaration': { - id: '/export-separate-from-declaration' - path: '/export-separate-from-declaration' - fullPath: '/export-separate-from-declaration' - preLoaderRoute: typeof ExportSeparateFromDeclarationRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - ExportSeparateFromDeclarationRoute: ExportSeparateFromDeclarationRoute, - ExportWithAsRoute: ExportWithAsRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/packages/router-generator/tests/generator/file-modification-verboseFileRoutes-false/routeTree.nonnested.snapshot.ts b/packages/router-generator/tests/generator/file-modification-verboseFileRoutes-false/routeTree.nonnested.snapshot.ts deleted file mode 100644 index 6cd0f9c68ec..00000000000 --- a/packages/router-generator/tests/generator/file-modification-verboseFileRoutes-false/routeTree.nonnested.snapshot.ts +++ /dev/null @@ -1,207 +0,0 @@ -/* eslint-disable */ - -// @ts-nocheck - -// noinspection JSUnusedGlobalSymbols - -// This file was automatically generated by TanStack Router. -// You should NOT make any changes in this file as it will be overwritten. -// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified. - -import { createFileRoute } from '@tanstack/react-router' -import type { - CreateFileRoute, - CreateLazyFileRoute, - FileRoutesByPath, -} from '@tanstack/react-router' - -import { Route as rootRouteImport } from './routes/__root' -import { Route as testInitiallyLazyRouteImport } from './routes/(test)/initiallyLazy' -import { Route as testInitiallyEmptyRouteImport } from './routes/(test)/initiallyEmpty' -import { Route as testFooRouteImport } from './routes/(test)/foo' -import { Route as testFooBarRouteImport } from './routes/(test)/foo.bar' - -const testBarLazyRouteImport = createFileRoute('/(test)/bar')() - -const testBarLazyRoute = testBarLazyRouteImport - .update({ - id: '/(test)/bar', - path: '/bar', - getParentRoute: () => rootRouteImport, - } as any) - .lazy(() => import('./routes/(test)/bar.lazy').then((d) => d.Route)) -const testInitiallyLazyRoute = testInitiallyLazyRouteImport.update({ - id: '/(test)/initiallyLazy', - path: '/initiallyLazy', - getParentRoute: () => rootRouteImport, -} as any) -const testInitiallyEmptyRoute = testInitiallyEmptyRouteImport - .update({ - id: '/(test)/initiallyEmpty', - path: '/initiallyEmpty', - getParentRoute: () => rootRouteImport, - } as any) - .lazy(() => - import('./routes/(test)/initiallyEmpty.lazy').then((d) => d.Route), - ) -const testFooRoute = testFooRouteImport.update({ - id: '/(test)/foo', - path: '/foo', - getParentRoute: () => rootRouteImport, -} as any) -const testFooBarRoute = testFooBarRouteImport.update({ - id: '/bar', - path: '/bar', - getParentRoute: () => testFooRoute, -} as any) - -export interface FileRoutesByFullPath { - '/foo': typeof testFooRouteWithChildren - '/initiallyEmpty': typeof testInitiallyEmptyRoute - '/initiallyLazy': typeof testInitiallyLazyRoute - '/bar': typeof testBarLazyRoute - '/foo/bar': typeof testFooBarRoute -} -export interface FileRoutesByTo { - '/foo': typeof testFooRouteWithChildren - '/initiallyEmpty': typeof testInitiallyEmptyRoute - '/initiallyLazy': typeof testInitiallyLazyRoute - '/bar': typeof testBarLazyRoute - '/foo/bar': typeof testFooBarRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/(test)/foo': typeof testFooRouteWithChildren - '/(test)/initiallyEmpty': typeof testInitiallyEmptyRoute - '/(test)/initiallyLazy': typeof testInitiallyLazyRoute - '/(test)/bar': typeof testBarLazyRoute - '/(test)/foo/bar': typeof testFooBarRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/foo' | '/initiallyEmpty' | '/initiallyLazy' | '/bar' | '/foo/bar' - fileRoutesByTo: FileRoutesByTo - to: '/foo' | '/initiallyEmpty' | '/initiallyLazy' | '/bar' | '/foo/bar' - id: - | '__root__' - | '/(test)/foo' - | '/(test)/initiallyEmpty' - | '/(test)/initiallyLazy' - | '/(test)/bar' - | '/(test)/foo/bar' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - testFooRoute: typeof testFooRouteWithChildren - testInitiallyEmptyRoute: typeof testInitiallyEmptyRoute - testInitiallyLazyRoute: typeof testInitiallyLazyRoute - testBarLazyRoute: typeof testBarLazyRoute -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/(test)/bar': { - id: '/(test)/bar' - path: '/bar' - fullPath: '/bar' - preLoaderRoute: typeof testBarLazyRouteImport - parentRoute: typeof rootRouteImport - } - '/(test)/initiallyLazy': { - id: '/(test)/initiallyLazy' - path: '/initiallyLazy' - fullPath: '/initiallyLazy' - preLoaderRoute: typeof testInitiallyLazyRouteImport - parentRoute: typeof rootRouteImport - } - '/(test)/initiallyEmpty': { - id: '/(test)/initiallyEmpty' - path: '/initiallyEmpty' - fullPath: '/initiallyEmpty' - preLoaderRoute: typeof testInitiallyEmptyRouteImport - parentRoute: typeof rootRouteImport - } - '/(test)/foo': { - id: '/(test)/foo' - path: '/foo' - fullPath: '/foo' - preLoaderRoute: typeof testFooRouteImport - parentRoute: typeof rootRouteImport - } - '/(test)/foo/bar': { - id: '/(test)/foo/bar' - path: '/bar' - fullPath: '/foo/bar' - preLoaderRoute: typeof testFooBarRouteImport - parentRoute: typeof testFooRoute - } - } -} - -declare module './routes/(test)/foo' { - const createFileRoute: CreateFileRoute< - '/(test)/foo', - FileRoutesByPath['/(test)/foo']['parentRoute'], - FileRoutesByPath['/(test)/foo']['id'], - FileRoutesByPath['/(test)/foo']['path'], - FileRoutesByPath['/(test)/foo']['fullPath'] - > -} -declare module './routes/(test)/initiallyEmpty' { - const createFileRoute: CreateFileRoute< - '/(test)/initiallyEmpty', - FileRoutesByPath['/(test)/initiallyEmpty']['parentRoute'], - FileRoutesByPath['/(test)/initiallyEmpty']['id'], - FileRoutesByPath['/(test)/initiallyEmpty']['path'], - FileRoutesByPath['/(test)/initiallyEmpty']['fullPath'] - > -} -declare module './routes/(test)/initiallyLazy' { - const createFileRoute: CreateFileRoute< - '/(test)/initiallyLazy', - FileRoutesByPath['/(test)/initiallyLazy']['parentRoute'], - FileRoutesByPath['/(test)/initiallyLazy']['id'], - FileRoutesByPath['/(test)/initiallyLazy']['path'], - FileRoutesByPath['/(test)/initiallyLazy']['fullPath'] - > -} -declare module './routes/(test)/bar.lazy' { - const createLazyFileRoute: CreateLazyFileRoute< - FileRoutesByPath['/(test)/bar']['preLoaderRoute'] - > -} -declare module './routes/(test)/initiallyEmpty.lazy' { - const createLazyFileRoute: CreateLazyFileRoute< - FileRoutesByPath['/(test)/initiallyEmpty']['preLoaderRoute'] - > -} -declare module './routes/(test)/foo.bar' { - const createFileRoute: CreateFileRoute< - '/(test)/foo/bar', - FileRoutesByPath['/(test)/foo/bar']['parentRoute'], - FileRoutesByPath['/(test)/foo/bar']['id'], - FileRoutesByPath['/(test)/foo/bar']['path'], - FileRoutesByPath['/(test)/foo/bar']['fullPath'] - > -} - -interface testFooRouteChildren { - testFooBarRoute: typeof testFooBarRoute -} - -const testFooRouteChildren: testFooRouteChildren = { - testFooBarRoute: testFooBarRoute, -} - -const testFooRouteWithChildren = - testFooRoute._addFileChildren(testFooRouteChildren) - -const rootRouteChildren: RootRouteChildren = { - testFooRoute: testFooRouteWithChildren, - testInitiallyEmptyRoute: testInitiallyEmptyRoute, - testInitiallyLazyRoute: testInitiallyLazyRoute, - testBarLazyRoute: testBarLazyRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/packages/router-generator/tests/generator/file-modification-verboseFileRoutes-true/routeTree.nonnested.snapshot.ts b/packages/router-generator/tests/generator/file-modification-verboseFileRoutes-true/routeTree.nonnested.snapshot.ts deleted file mode 100644 index 816d3ddaa26..00000000000 --- a/packages/router-generator/tests/generator/file-modification-verboseFileRoutes-true/routeTree.nonnested.snapshot.ts +++ /dev/null @@ -1,155 +0,0 @@ -/* eslint-disable */ - -// @ts-nocheck - -// noinspection JSUnusedGlobalSymbols - -// This file was automatically generated by TanStack Router. -// You should NOT make any changes in this file as it will be overwritten. -// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified. - -import { createFileRoute } from '@tanstack/react-router' - -import { Route as rootRouteImport } from './routes/__root' -import { Route as testInitiallyLazyRouteImport } from './routes/(test)/initiallyLazy' -import { Route as testInitiallyEmptyRouteImport } from './routes/(test)/initiallyEmpty' -import { Route as testFooRouteImport } from './routes/(test)/foo' -import { Route as testFooBarRouteImport } from './routes/(test)/foo.bar' - -const testBarLazyRouteImport = createFileRoute('/(test)/bar')() - -const testBarLazyRoute = testBarLazyRouteImport - .update({ - id: '/(test)/bar', - path: '/bar', - getParentRoute: () => rootRouteImport, - } as any) - .lazy(() => import('./routes/(test)/bar.lazy').then((d) => d.Route)) -const testInitiallyLazyRoute = testInitiallyLazyRouteImport.update({ - id: '/(test)/initiallyLazy', - path: '/initiallyLazy', - getParentRoute: () => rootRouteImport, -} as any) -const testInitiallyEmptyRoute = testInitiallyEmptyRouteImport - .update({ - id: '/(test)/initiallyEmpty', - path: '/initiallyEmpty', - getParentRoute: () => rootRouteImport, - } as any) - .lazy(() => - import('./routes/(test)/initiallyEmpty.lazy').then((d) => d.Route), - ) -const testFooRoute = testFooRouteImport.update({ - id: '/(test)/foo', - path: '/foo', - getParentRoute: () => rootRouteImport, -} as any) -const testFooBarRoute = testFooBarRouteImport.update({ - id: '/bar', - path: '/bar', - getParentRoute: () => testFooRoute, -} as any) - -export interface FileRoutesByFullPath { - '/foo': typeof testFooRouteWithChildren - '/initiallyEmpty': typeof testInitiallyEmptyRoute - '/initiallyLazy': typeof testInitiallyLazyRoute - '/bar': typeof testBarLazyRoute - '/foo/bar': typeof testFooBarRoute -} -export interface FileRoutesByTo { - '/foo': typeof testFooRouteWithChildren - '/initiallyEmpty': typeof testInitiallyEmptyRoute - '/initiallyLazy': typeof testInitiallyLazyRoute - '/bar': typeof testBarLazyRoute - '/foo/bar': typeof testFooBarRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/(test)/foo': typeof testFooRouteWithChildren - '/(test)/initiallyEmpty': typeof testInitiallyEmptyRoute - '/(test)/initiallyLazy': typeof testInitiallyLazyRoute - '/(test)/bar': typeof testBarLazyRoute - '/(test)/foo/bar': typeof testFooBarRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/foo' | '/initiallyEmpty' | '/initiallyLazy' | '/bar' | '/foo/bar' - fileRoutesByTo: FileRoutesByTo - to: '/foo' | '/initiallyEmpty' | '/initiallyLazy' | '/bar' | '/foo/bar' - id: - | '__root__' - | '/(test)/foo' - | '/(test)/initiallyEmpty' - | '/(test)/initiallyLazy' - | '/(test)/bar' - | '/(test)/foo/bar' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - testFooRoute: typeof testFooRouteWithChildren - testInitiallyEmptyRoute: typeof testInitiallyEmptyRoute - testInitiallyLazyRoute: typeof testInitiallyLazyRoute - testBarLazyRoute: typeof testBarLazyRoute -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/(test)/bar': { - id: '/(test)/bar' - path: '/bar' - fullPath: '/bar' - preLoaderRoute: typeof testBarLazyRouteImport - parentRoute: typeof rootRouteImport - } - '/(test)/initiallyLazy': { - id: '/(test)/initiallyLazy' - path: '/initiallyLazy' - fullPath: '/initiallyLazy' - preLoaderRoute: typeof testInitiallyLazyRouteImport - parentRoute: typeof rootRouteImport - } - '/(test)/initiallyEmpty': { - id: '/(test)/initiallyEmpty' - path: '/initiallyEmpty' - fullPath: '/initiallyEmpty' - preLoaderRoute: typeof testInitiallyEmptyRouteImport - parentRoute: typeof rootRouteImport - } - '/(test)/foo': { - id: '/(test)/foo' - path: '/foo' - fullPath: '/foo' - preLoaderRoute: typeof testFooRouteImport - parentRoute: typeof rootRouteImport - } - '/(test)/foo/bar': { - id: '/(test)/foo/bar' - path: '/bar' - fullPath: '/foo/bar' - preLoaderRoute: typeof testFooBarRouteImport - parentRoute: typeof testFooRoute - } - } -} - -interface testFooRouteChildren { - testFooBarRoute: typeof testFooBarRoute -} - -const testFooRouteChildren: testFooRouteChildren = { - testFooBarRoute: testFooBarRoute, -} - -const testFooRouteWithChildren = - testFooRoute._addFileChildren(testFooRouteChildren) - -const rootRouteChildren: RootRouteChildren = { - testFooRoute: testFooRouteWithChildren, - testInitiallyEmptyRoute: testInitiallyEmptyRoute, - testInitiallyLazyRoute: testInitiallyLazyRoute, - testBarLazyRoute: testBarLazyRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/packages/router-generator/tests/generator/flat-route-group/routeTree.nonnested.snapshot.ts b/packages/router-generator/tests/generator/flat-route-group/routeTree.nonnested.snapshot.ts deleted file mode 100644 index b0f4031474d..00000000000 --- a/packages/router-generator/tests/generator/flat-route-group/routeTree.nonnested.snapshot.ts +++ /dev/null @@ -1,145 +0,0 @@ -/* eslint-disable */ - -// @ts-nocheck - -// noinspection JSUnusedGlobalSymbols - -// This file was automatically generated by TanStack Router. -// You should NOT make any changes in this file as it will be overwritten. -// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified. - -import { Route as rootRouteImport } from './routes/__root' -import { Route as AppRouteImport } from './routes/app' -import { Route as AppcomprasComprasOrdenesRouteImport } from './routes/app.(compras)/compras_.ordenes' -import { Route as AppcomprasComprasMasRouteImport } from './routes/app.(compras)/compras_._mas' -import { Route as AppcomprasComprasMasDivisionesRouteImport } from './routes/app.(compras)/compras_._mas.divisiones' - -const AppRoute = AppRouteImport.update({ - id: '/app', - path: '/app', - getParentRoute: () => rootRouteImport, -} as any) -const AppcomprasComprasOrdenesRoute = - AppcomprasComprasOrdenesRouteImport.update({ - id: '/app/(compras)/compras/ordenes', - path: '/app/compras/ordenes', - getParentRoute: () => rootRouteImport, - } as any) -const AppcomprasComprasMasRoute = AppcomprasComprasMasRouteImport.update({ - id: '/(compras)/compras/_mas', - path: '/compras', - getParentRoute: () => AppRoute, -} as any) -const AppcomprasComprasMasDivisionesRoute = - AppcomprasComprasMasDivisionesRouteImport.update({ - id: '/divisiones', - path: '/divisiones', - getParentRoute: () => AppcomprasComprasMasRoute, - } as any) - -export interface FileRoutesByFullPath { - '/app': typeof AppRouteWithChildren - '/app/compras': typeof AppcomprasComprasMasRouteWithChildren - '/app/compras/ordenes': typeof AppcomprasComprasOrdenesRoute - '/app/compras/divisiones': typeof AppcomprasComprasMasDivisionesRoute -} -export interface FileRoutesByTo { - '/app': typeof AppRouteWithChildren - '/app/compras': typeof AppcomprasComprasMasRouteWithChildren - '/app/compras/ordenes': typeof AppcomprasComprasOrdenesRoute - '/app/compras/divisiones': typeof AppcomprasComprasMasDivisionesRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/app': typeof AppRouteWithChildren - '/app/(compras)/compras/_mas': typeof AppcomprasComprasMasRouteWithChildren - '/app/(compras)/compras/ordenes': typeof AppcomprasComprasOrdenesRoute - '/app/(compras)/compras/_mas/divisiones': typeof AppcomprasComprasMasDivisionesRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: - | '/app' - | '/app/compras' - | '/app/compras/ordenes' - | '/app/compras/divisiones' - fileRoutesByTo: FileRoutesByTo - to: - | '/app' - | '/app/compras' - | '/app/compras/ordenes' - | '/app/compras/divisiones' - id: - | '__root__' - | '/app' - | '/app/(compras)/compras/_mas' - | '/app/(compras)/compras/ordenes' - | '/app/(compras)/compras/_mas/divisiones' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - AppRoute: typeof AppRouteWithChildren - AppcomprasComprasOrdenesRoute: typeof AppcomprasComprasOrdenesRoute -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/app': { - id: '/app' - path: '/app' - fullPath: '/app' - preLoaderRoute: typeof AppRouteImport - parentRoute: typeof rootRouteImport - } - '/app/(compras)/compras/ordenes': { - id: '/app/(compras)/compras/ordenes' - path: '/app/compras/ordenes' - fullPath: '/app/compras/ordenes' - preLoaderRoute: typeof AppcomprasComprasOrdenesRouteImport - parentRoute: typeof rootRouteImport - } - '/app/(compras)/compras/_mas': { - id: '/app/(compras)/compras/_mas' - path: '/compras' - fullPath: '/app/compras' - preLoaderRoute: typeof AppcomprasComprasMasRouteImport - parentRoute: typeof AppRoute - } - '/app/(compras)/compras/_mas/divisiones': { - id: '/app/(compras)/compras/_mas/divisiones' - path: '/divisiones' - fullPath: '/app/compras/divisiones' - preLoaderRoute: typeof AppcomprasComprasMasDivisionesRouteImport - parentRoute: typeof AppcomprasComprasMasRoute - } - } -} - -interface AppcomprasComprasMasRouteChildren { - AppcomprasComprasMasDivisionesRoute: typeof AppcomprasComprasMasDivisionesRoute -} - -const AppcomprasComprasMasRouteChildren: AppcomprasComprasMasRouteChildren = { - AppcomprasComprasMasDivisionesRoute: AppcomprasComprasMasDivisionesRoute, -} - -const AppcomprasComprasMasRouteWithChildren = - AppcomprasComprasMasRoute._addFileChildren(AppcomprasComprasMasRouteChildren) - -interface AppRouteChildren { - AppcomprasComprasMasRoute: typeof AppcomprasComprasMasRouteWithChildren -} - -const AppRouteChildren: AppRouteChildren = { - AppcomprasComprasMasRoute: AppcomprasComprasMasRouteWithChildren, -} - -const AppRouteWithChildren = AppRoute._addFileChildren(AppRouteChildren) - -const rootRouteChildren: RootRouteChildren = { - AppRoute: AppRouteWithChildren, - AppcomprasComprasOrdenesRoute: AppcomprasComprasOrdenesRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/packages/router-generator/tests/generator/flat/routeTree.nonnested.snapshot.ts b/packages/router-generator/tests/generator/flat/routeTree.nonnested.snapshot.ts deleted file mode 100644 index 880dddeaf80..00000000000 --- a/packages/router-generator/tests/generator/flat/routeTree.nonnested.snapshot.ts +++ /dev/null @@ -1,341 +0,0 @@ -/* eslint-disable */ - -// @ts-nocheck - -// noinspection JSUnusedGlobalSymbols - -// This file was automatically generated by TanStack Router. -// You should NOT make any changes in this file as it will be overwritten. -// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified. - -import { Route as rootRouteImport } from './routes/__root' -import { Route as PostsRouteRouteImport } from './routes/posts.route' -import { Route as BlogRouteRouteImport } from './routes/blog.route' -import { Route as IndexRouteImport } from './routes/index' -import { Route as PostsIndexRouteImport } from './routes/posts.index' -import { Route as BlogIndexRouteImport } from './routes/blog.index' -import { Route as BlogStatsRouteImport } from './routes/blog_.stats' -import { Route as BlogBlogIdRouteRouteImport } from './routes/blog_.$blogId.route' -import { Route as PostsPostIdIndexRouteImport } from './routes/posts.$postId.index' -import { Route as BlogSlugIndexRouteImport } from './routes/blog.$slug.index' -import { Route as PostsPostIdDeepRouteImport } from './routes/posts.$postId.deep' -import { Route as BlogBlogIdEditRouteImport } from './routes/blog_.$blogId_.edit' -import { Route as BlogBlogIdSlugRouteRouteImport } from './routes/blog_.$blogId.$slug.route' -import { Route as BlogBlogIdSlugBarRouteImport } from './routes/blog_.$blogId.$slug_.bar' - -const PostsRouteRoute = PostsRouteRouteImport.update({ - id: '/posts', - path: '/posts', - getParentRoute: () => rootRouteImport, -} as any) -const BlogRouteRoute = BlogRouteRouteImport.update({ - id: '/blog', - path: '/blog', - getParentRoute: () => rootRouteImport, -} as any) -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const PostsIndexRoute = PostsIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => PostsRouteRoute, -} as any) -const BlogIndexRoute = BlogIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => BlogRouteRoute, -} as any) -const BlogStatsRoute = BlogStatsRouteImport.update({ - id: '/blog/stats', - path: '/blog/stats', - getParentRoute: () => rootRouteImport, -} as any) -const BlogBlogIdRouteRoute = BlogBlogIdRouteRouteImport.update({ - id: '/blog/$blogId', - path: '/blog/$blogId', - getParentRoute: () => rootRouteImport, -} as any) -const PostsPostIdIndexRoute = PostsPostIdIndexRouteImport.update({ - id: '/$postId/', - path: '/$postId/', - getParentRoute: () => PostsRouteRoute, -} as any) -const BlogSlugIndexRoute = BlogSlugIndexRouteImport.update({ - id: '/$slug/', - path: '/$slug/', - getParentRoute: () => BlogRouteRoute, -} as any) -const PostsPostIdDeepRoute = PostsPostIdDeepRouteImport.update({ - id: '/$postId/deep', - path: '/$postId/deep', - getParentRoute: () => PostsRouteRoute, -} as any) -const BlogBlogIdEditRoute = BlogBlogIdEditRouteImport.update({ - id: '/blog/$blogId/edit', - path: '/blog/$blogId/edit', - getParentRoute: () => rootRouteImport, -} as any) -const BlogBlogIdSlugRouteRoute = BlogBlogIdSlugRouteRouteImport.update({ - id: '/$slug', - path: '/$slug', - getParentRoute: () => BlogBlogIdRouteRoute, -} as any) -const BlogBlogIdSlugBarRoute = BlogBlogIdSlugBarRouteImport.update({ - id: '/$slug/bar', - path: '/$slug/bar', - getParentRoute: () => BlogBlogIdRouteRoute, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/blog': typeof BlogRouteRouteWithChildren - '/posts': typeof PostsRouteRouteWithChildren - '/blog/$blogId': typeof BlogBlogIdRouteRouteWithChildren - '/blog/stats': typeof BlogStatsRoute - '/blog/': typeof BlogIndexRoute - '/posts/': typeof PostsIndexRoute - '/blog/$blogId/$slug': typeof BlogBlogIdSlugRouteRoute - '/blog/$blogId/edit': typeof BlogBlogIdEditRoute - '/posts/$postId/deep': typeof PostsPostIdDeepRoute - '/blog/$slug': typeof BlogSlugIndexRoute - '/posts/$postId': typeof PostsPostIdIndexRoute - '/blog/$blogId/$slug/bar': typeof BlogBlogIdSlugBarRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/blog/$blogId': typeof BlogBlogIdRouteRouteWithChildren - '/blog/stats': typeof BlogStatsRoute - '/blog': typeof BlogIndexRoute - '/posts': typeof PostsIndexRoute - '/blog/$blogId/$slug': typeof BlogBlogIdSlugRouteRoute - '/blog/$blogId/edit': typeof BlogBlogIdEditRoute - '/posts/$postId/deep': typeof PostsPostIdDeepRoute - '/blog/$slug': typeof BlogSlugIndexRoute - '/posts/$postId': typeof PostsPostIdIndexRoute - '/blog/$blogId/$slug/bar': typeof BlogBlogIdSlugBarRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/blog': typeof BlogRouteRouteWithChildren - '/posts': typeof PostsRouteRouteWithChildren - '/blog/$blogId': typeof BlogBlogIdRouteRouteWithChildren - '/blog/stats': typeof BlogStatsRoute - '/blog/': typeof BlogIndexRoute - '/posts/': typeof PostsIndexRoute - '/blog/$blogId/$slug': typeof BlogBlogIdSlugRouteRoute - '/blog/$blogId/edit': typeof BlogBlogIdEditRoute - '/posts/$postId/deep': typeof PostsPostIdDeepRoute - '/blog/$slug/': typeof BlogSlugIndexRoute - '/posts/$postId/': typeof PostsPostIdIndexRoute - '/blog/$blogId/$slug/bar': typeof BlogBlogIdSlugBarRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: - | '/' - | '/blog' - | '/posts' - | '/blog/$blogId' - | '/blog/stats' - | '/blog/' - | '/posts/' - | '/blog/$blogId/$slug' - | '/blog/$blogId/edit' - | '/posts/$postId/deep' - | '/blog/$slug' - | '/posts/$postId' - | '/blog/$blogId/$slug/bar' - fileRoutesByTo: FileRoutesByTo - to: - | '/' - | '/blog/$blogId' - | '/blog/stats' - | '/blog' - | '/posts' - | '/blog/$blogId/$slug' - | '/blog/$blogId/edit' - | '/posts/$postId/deep' - | '/blog/$slug' - | '/posts/$postId' - | '/blog/$blogId/$slug/bar' - id: - | '__root__' - | '/' - | '/blog' - | '/posts' - | '/blog/$blogId' - | '/blog/stats' - | '/blog/' - | '/posts/' - | '/blog/$blogId/$slug' - | '/blog/$blogId/edit' - | '/posts/$postId/deep' - | '/blog/$slug/' - | '/posts/$postId/' - | '/blog/$blogId/$slug/bar' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - BlogRouteRoute: typeof BlogRouteRouteWithChildren - PostsRouteRoute: typeof PostsRouteRouteWithChildren - BlogBlogIdRouteRoute: typeof BlogBlogIdRouteRouteWithChildren - BlogStatsRoute: typeof BlogStatsRoute - BlogBlogIdEditRoute: typeof BlogBlogIdEditRoute -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/posts': { - id: '/posts' - path: '/posts' - fullPath: '/posts' - preLoaderRoute: typeof PostsRouteRouteImport - parentRoute: typeof rootRouteImport - } - '/blog': { - id: '/blog' - path: '/blog' - fullPath: '/blog' - preLoaderRoute: typeof BlogRouteRouteImport - parentRoute: typeof rootRouteImport - } - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/posts/': { - id: '/posts/' - path: '/' - fullPath: '/posts/' - preLoaderRoute: typeof PostsIndexRouteImport - parentRoute: typeof PostsRouteRoute - } - '/blog/': { - id: '/blog/' - path: '/' - fullPath: '/blog/' - preLoaderRoute: typeof BlogIndexRouteImport - parentRoute: typeof BlogRouteRoute - } - '/blog/stats': { - id: '/blog/stats' - path: '/blog/stats' - fullPath: '/blog/stats' - preLoaderRoute: typeof BlogStatsRouteImport - parentRoute: typeof rootRouteImport - } - '/blog/$blogId': { - id: '/blog/$blogId' - path: '/blog/$blogId' - fullPath: '/blog/$blogId' - preLoaderRoute: typeof BlogBlogIdRouteRouteImport - parentRoute: typeof rootRouteImport - } - '/posts/$postId/': { - id: '/posts/$postId/' - path: '/$postId' - fullPath: '/posts/$postId' - preLoaderRoute: typeof PostsPostIdIndexRouteImport - parentRoute: typeof PostsRouteRoute - } - '/blog/$slug/': { - id: '/blog/$slug/' - path: '/$slug' - fullPath: '/blog/$slug' - preLoaderRoute: typeof BlogSlugIndexRouteImport - parentRoute: typeof BlogRouteRoute - } - '/posts/$postId/deep': { - id: '/posts/$postId/deep' - path: '/$postId/deep' - fullPath: '/posts/$postId/deep' - preLoaderRoute: typeof PostsPostIdDeepRouteImport - parentRoute: typeof PostsRouteRoute - } - '/blog/$blogId/edit': { - id: '/blog/$blogId/edit' - path: '/blog/$blogId/edit' - fullPath: '/blog/$blogId/edit' - preLoaderRoute: typeof BlogBlogIdEditRouteImport - parentRoute: typeof rootRouteImport - } - '/blog/$blogId/$slug': { - id: '/blog/$blogId/$slug' - path: '/$slug' - fullPath: '/blog/$blogId/$slug' - preLoaderRoute: typeof BlogBlogIdSlugRouteRouteImport - parentRoute: typeof BlogBlogIdRouteRoute - } - '/blog/$blogId/$slug/bar': { - id: '/blog/$blogId/$slug/bar' - path: '/$slug/bar' - fullPath: '/blog/$blogId/$slug/bar' - preLoaderRoute: typeof BlogBlogIdSlugBarRouteImport - parentRoute: typeof BlogBlogIdRouteRoute - } - } -} - -interface BlogRouteRouteChildren { - BlogIndexRoute: typeof BlogIndexRoute - BlogSlugIndexRoute: typeof BlogSlugIndexRoute -} - -const BlogRouteRouteChildren: BlogRouteRouteChildren = { - BlogIndexRoute: BlogIndexRoute, - BlogSlugIndexRoute: BlogSlugIndexRoute, -} - -const BlogRouteRouteWithChildren = BlogRouteRoute._addFileChildren( - BlogRouteRouteChildren, -) - -interface PostsRouteRouteChildren { - PostsIndexRoute: typeof PostsIndexRoute - PostsPostIdDeepRoute: typeof PostsPostIdDeepRoute - PostsPostIdIndexRoute: typeof PostsPostIdIndexRoute -} - -const PostsRouteRouteChildren: PostsRouteRouteChildren = { - PostsIndexRoute: PostsIndexRoute, - PostsPostIdDeepRoute: PostsPostIdDeepRoute, - PostsPostIdIndexRoute: PostsPostIdIndexRoute, -} - -const PostsRouteRouteWithChildren = PostsRouteRoute._addFileChildren( - PostsRouteRouteChildren, -) - -interface BlogBlogIdRouteRouteChildren { - BlogBlogIdSlugRouteRoute: typeof BlogBlogIdSlugRouteRoute - BlogBlogIdSlugBarRoute: typeof BlogBlogIdSlugBarRoute -} - -const BlogBlogIdRouteRouteChildren: BlogBlogIdRouteRouteChildren = { - BlogBlogIdSlugRouteRoute: BlogBlogIdSlugRouteRoute, - BlogBlogIdSlugBarRoute: BlogBlogIdSlugBarRoute, -} - -const BlogBlogIdRouteRouteWithChildren = BlogBlogIdRouteRoute._addFileChildren( - BlogBlogIdRouteRouteChildren, -) - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - BlogRouteRoute: BlogRouteRouteWithChildren, - PostsRouteRoute: PostsRouteRouteWithChildren, - BlogBlogIdRouteRoute: BlogBlogIdRouteRouteWithChildren, - BlogStatsRoute: BlogStatsRoute, - BlogBlogIdEditRoute: BlogBlogIdEditRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/packages/router-generator/tests/generator/nested-layouts/routeTree.nonnested.snapshot.ts b/packages/router-generator/tests/generator/nested-layouts/routeTree.nonnested.snapshot.ts deleted file mode 100644 index 6501b213ecc..00000000000 --- a/packages/router-generator/tests/generator/nested-layouts/routeTree.nonnested.snapshot.ts +++ /dev/null @@ -1,586 +0,0 @@ -/* eslint-disable */ - -// @ts-nocheck - -// noinspection JSUnusedGlobalSymbols - -// This file was automatically generated by TanStack Router. -// You should NOT make any changes in this file as it will be overwritten. -// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified. - -import { Route as rootRouteImport } from './routes/__root' -import { Route as LayoutA2RouteImport } from './routes/_layout-a2' -import { Route as LayoutA1RouteImport } from './routes/_layout-a1' -import { Route as JestedRouteRouteImport } from './routes/jested/route' -import { Route as IndexRouteImport } from './routes/index' -import { Route as NestedLayoutB2RouteImport } from './routes/nested/_layout-b2' -import { Route as NestedLayoutB1RouteImport } from './routes/nested/_layout-b1' -import { Route as JestedLayoutB4RouteImport } from './routes/jested/_layout-b4' -import { Route as JestedLayoutB3RouteImport } from './routes/jested/_layout-b3' -import { Route as FooBarRouteImport } from './routes/foo/bar' -import { Route as LayoutA2BarRouteImport } from './routes/_layout-a2/bar' -import { Route as LayoutA1FooRouteImport } from './routes/_layout-a1/foo' -import { Route as folderInFolderRouteImport } from './routes/(folder)/in-folder' -import { Route as FooLayoutB5RouteRouteImport } from './routes/foo/_layout-b5/route' -import { Route as NestedLayoutB1IndexRouteImport } from './routes/nested/_layout-b1/index' -import { Route as JestedLayoutB3IndexRouteImport } from './routes/jested/_layout-b3/index' -import { Route as FooLayoutB5IndexRouteImport } from './routes/foo/_layout-b5/index' -import { Route as NestedLayoutB2FooRouteImport } from './routes/nested/_layout-b2/foo' -import { Route as NestedLayoutB1LayoutC1RouteImport } from './routes/nested/_layout-b1/_layout-c1' -import { Route as JestedLayoutB4FooRouteImport } from './routes/jested/_layout-b4/foo' -import { Route as JestedLayoutB3LayoutC2RouteImport } from './routes/jested/_layout-b3/_layout-c2' -import { Route as FooLayoutB5IdRouteImport } from './routes/foo/_layout-b5/$id' -import { Route as NestedLayoutB1LayoutC1BarRouteImport } from './routes/nested/_layout-b1/_layout-c1/bar' -import { Route as JestedLayoutB3LayoutC2BarRouteImport } from './routes/jested/_layout-b3/_layout-c2/bar' - -const LayoutA2Route = LayoutA2RouteImport.update({ - id: '/_layout-a2', - getParentRoute: () => rootRouteImport, -} as any) -const LayoutA1Route = LayoutA1RouteImport.update({ - id: '/_layout-a1', - getParentRoute: () => rootRouteImport, -} as any) -const JestedRouteRoute = JestedRouteRouteImport.update({ - id: '/jested', - path: '/jested', - getParentRoute: () => rootRouteImport, -} as any) -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const NestedLayoutB2Route = NestedLayoutB2RouteImport.update({ - id: '/nested/_layout-b2', - path: '/nested', - getParentRoute: () => rootRouteImport, -} as any) -const NestedLayoutB1Route = NestedLayoutB1RouteImport.update({ - id: '/nested/_layout-b1', - path: '/nested', - getParentRoute: () => rootRouteImport, -} as any) -const JestedLayoutB4Route = JestedLayoutB4RouteImport.update({ - id: '/_layout-b4', - getParentRoute: () => JestedRouteRoute, -} as any) -const JestedLayoutB3Route = JestedLayoutB3RouteImport.update({ - id: '/_layout-b3', - getParentRoute: () => JestedRouteRoute, -} as any) -const FooBarRoute = FooBarRouteImport.update({ - id: '/foo/bar', - path: '/foo/bar', - getParentRoute: () => rootRouteImport, -} as any) -const LayoutA2BarRoute = LayoutA2BarRouteImport.update({ - id: '/bar', - path: '/bar', - getParentRoute: () => LayoutA2Route, -} as any) -const LayoutA1FooRoute = LayoutA1FooRouteImport.update({ - id: '/foo', - path: '/foo', - getParentRoute: () => LayoutA1Route, -} as any) -const folderInFolderRoute = folderInFolderRouteImport.update({ - id: '/(folder)/in-folder', - path: '/in-folder', - getParentRoute: () => rootRouteImport, -} as any) -const FooLayoutB5RouteRoute = FooLayoutB5RouteRouteImport.update({ - id: '/foo/_layout-b5', - path: '/foo', - getParentRoute: () => rootRouteImport, -} as any) -const NestedLayoutB1IndexRoute = NestedLayoutB1IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => NestedLayoutB1Route, -} as any) -const JestedLayoutB3IndexRoute = JestedLayoutB3IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => JestedLayoutB3Route, -} as any) -const FooLayoutB5IndexRoute = FooLayoutB5IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => FooLayoutB5RouteRoute, -} as any) -const NestedLayoutB2FooRoute = NestedLayoutB2FooRouteImport.update({ - id: '/foo', - path: '/foo', - getParentRoute: () => NestedLayoutB2Route, -} as any) -const NestedLayoutB1LayoutC1Route = NestedLayoutB1LayoutC1RouteImport.update({ - id: '/_layout-c1', - getParentRoute: () => NestedLayoutB1Route, -} as any) -const JestedLayoutB4FooRoute = JestedLayoutB4FooRouteImport.update({ - id: '/foo', - path: '/foo', - getParentRoute: () => JestedLayoutB4Route, -} as any) -const JestedLayoutB3LayoutC2Route = JestedLayoutB3LayoutC2RouteImport.update({ - id: '/_layout-c2', - getParentRoute: () => JestedLayoutB3Route, -} as any) -const FooLayoutB5IdRoute = FooLayoutB5IdRouteImport.update({ - id: '/$id', - path: '/$id', - getParentRoute: () => FooLayoutB5RouteRoute, -} as any) -const NestedLayoutB1LayoutC1BarRoute = - NestedLayoutB1LayoutC1BarRouteImport.update({ - id: '/bar', - path: '/bar', - getParentRoute: () => NestedLayoutB1LayoutC1Route, - } as any) -const JestedLayoutB3LayoutC2BarRoute = - JestedLayoutB3LayoutC2BarRouteImport.update({ - id: '/bar', - path: '/bar', - getParentRoute: () => JestedLayoutB3LayoutC2Route, - } as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/jested': typeof JestedLayoutB3LayoutC2RouteWithChildren - '/foo': typeof LayoutA1FooRoute - '/in-folder': typeof folderInFolderRoute - '/bar': typeof LayoutA2BarRoute - '/foo/bar': typeof FooBarRoute - '/nested': typeof NestedLayoutB1LayoutC1RouteWithChildren - '/foo/$id': typeof FooLayoutB5IdRoute - '/jested/foo': typeof JestedLayoutB4FooRoute - '/nested/foo': typeof NestedLayoutB2FooRoute - '/foo/': typeof FooLayoutB5IndexRoute - '/jested/': typeof JestedLayoutB3IndexRoute - '/nested/': typeof NestedLayoutB1IndexRoute - '/jested/bar': typeof JestedLayoutB3LayoutC2BarRoute - '/nested/bar': typeof NestedLayoutB1LayoutC1BarRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/jested': typeof JestedLayoutB3IndexRoute - '/in-folder': typeof folderInFolderRoute - '/foo': typeof FooLayoutB5IndexRoute - '/bar': typeof LayoutA2BarRoute - '/foo/bar': typeof FooBarRoute - '/nested': typeof NestedLayoutB1IndexRoute - '/foo/$id': typeof FooLayoutB5IdRoute - '/jested/foo': typeof JestedLayoutB4FooRoute - '/nested/foo': typeof NestedLayoutB2FooRoute - '/jested/bar': typeof JestedLayoutB3LayoutC2BarRoute - '/nested/bar': typeof NestedLayoutB1LayoutC1BarRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/jested': typeof JestedRouteRouteWithChildren - '/_layout-a1': typeof LayoutA1RouteWithChildren - '/_layout-a2': typeof LayoutA2RouteWithChildren - '/foo/_layout-b5': typeof FooLayoutB5RouteRouteWithChildren - '/(folder)/in-folder': typeof folderInFolderRoute - '/_layout-a1/foo': typeof LayoutA1FooRoute - '/_layout-a2/bar': typeof LayoutA2BarRoute - '/foo/bar': typeof FooBarRoute - '/jested/_layout-b3': typeof JestedLayoutB3RouteWithChildren - '/jested/_layout-b4': typeof JestedLayoutB4RouteWithChildren - '/nested/_layout-b1': typeof NestedLayoutB1RouteWithChildren - '/nested/_layout-b2': typeof NestedLayoutB2RouteWithChildren - '/foo/_layout-b5/$id': typeof FooLayoutB5IdRoute - '/jested/_layout-b3/_layout-c2': typeof JestedLayoutB3LayoutC2RouteWithChildren - '/jested/_layout-b4/foo': typeof JestedLayoutB4FooRoute - '/nested/_layout-b1/_layout-c1': typeof NestedLayoutB1LayoutC1RouteWithChildren - '/nested/_layout-b2/foo': typeof NestedLayoutB2FooRoute - '/foo/_layout-b5/': typeof FooLayoutB5IndexRoute - '/jested/_layout-b3/': typeof JestedLayoutB3IndexRoute - '/nested/_layout-b1/': typeof NestedLayoutB1IndexRoute - '/jested/_layout-b3/_layout-c2/bar': typeof JestedLayoutB3LayoutC2BarRoute - '/nested/_layout-b1/_layout-c1/bar': typeof NestedLayoutB1LayoutC1BarRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: - | '/' - | '/jested' - | '/foo' - | '/in-folder' - | '/bar' - | '/foo/bar' - | '/nested' - | '/foo/$id' - | '/jested/foo' - | '/nested/foo' - | '/foo/' - | '/jested/' - | '/nested/' - | '/jested/bar' - | '/nested/bar' - fileRoutesByTo: FileRoutesByTo - to: - | '/' - | '/jested' - | '/in-folder' - | '/foo' - | '/bar' - | '/foo/bar' - | '/nested' - | '/foo/$id' - | '/jested/foo' - | '/nested/foo' - | '/jested/bar' - | '/nested/bar' - id: - | '__root__' - | '/' - | '/jested' - | '/_layout-a1' - | '/_layout-a2' - | '/foo/_layout-b5' - | '/(folder)/in-folder' - | '/_layout-a1/foo' - | '/_layout-a2/bar' - | '/foo/bar' - | '/jested/_layout-b3' - | '/jested/_layout-b4' - | '/nested/_layout-b1' - | '/nested/_layout-b2' - | '/foo/_layout-b5/$id' - | '/jested/_layout-b3/_layout-c2' - | '/jested/_layout-b4/foo' - | '/nested/_layout-b1/_layout-c1' - | '/nested/_layout-b2/foo' - | '/foo/_layout-b5/' - | '/jested/_layout-b3/' - | '/nested/_layout-b1/' - | '/jested/_layout-b3/_layout-c2/bar' - | '/nested/_layout-b1/_layout-c1/bar' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - JestedRouteRoute: typeof JestedRouteRouteWithChildren - LayoutA1Route: typeof LayoutA1RouteWithChildren - LayoutA2Route: typeof LayoutA2RouteWithChildren - FooLayoutB5RouteRoute: typeof FooLayoutB5RouteRouteWithChildren - folderInFolderRoute: typeof folderInFolderRoute - FooBarRoute: typeof FooBarRoute - NestedLayoutB1Route: typeof NestedLayoutB1RouteWithChildren - NestedLayoutB2Route: typeof NestedLayoutB2RouteWithChildren -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/_layout-a2': { - id: '/_layout-a2' - path: '' - fullPath: '' - preLoaderRoute: typeof LayoutA2RouteImport - parentRoute: typeof rootRouteImport - } - '/_layout-a1': { - id: '/_layout-a1' - path: '' - fullPath: '' - preLoaderRoute: typeof LayoutA1RouteImport - parentRoute: typeof rootRouteImport - } - '/jested': { - id: '/jested' - path: '/jested' - fullPath: '/jested' - preLoaderRoute: typeof JestedRouteRouteImport - parentRoute: typeof rootRouteImport - } - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/nested/_layout-b2': { - id: '/nested/_layout-b2' - path: '/nested' - fullPath: '/nested' - preLoaderRoute: typeof NestedLayoutB2RouteImport - parentRoute: typeof rootRouteImport - } - '/nested/_layout-b1': { - id: '/nested/_layout-b1' - path: '/nested' - fullPath: '/nested' - preLoaderRoute: typeof NestedLayoutB1RouteImport - parentRoute: typeof rootRouteImport - } - '/jested/_layout-b4': { - id: '/jested/_layout-b4' - path: '' - fullPath: '/jested' - preLoaderRoute: typeof JestedLayoutB4RouteImport - parentRoute: typeof JestedRouteRoute - } - '/jested/_layout-b3': { - id: '/jested/_layout-b3' - path: '' - fullPath: '/jested' - preLoaderRoute: typeof JestedLayoutB3RouteImport - parentRoute: typeof JestedRouteRoute - } - '/foo/bar': { - id: '/foo/bar' - path: '/foo/bar' - fullPath: '/foo/bar' - preLoaderRoute: typeof FooBarRouteImport - parentRoute: typeof rootRouteImport - } - '/_layout-a2/bar': { - id: '/_layout-a2/bar' - path: '/bar' - fullPath: '/bar' - preLoaderRoute: typeof LayoutA2BarRouteImport - parentRoute: typeof LayoutA2Route - } - '/_layout-a1/foo': { - id: '/_layout-a1/foo' - path: '/foo' - fullPath: '/foo' - preLoaderRoute: typeof LayoutA1FooRouteImport - parentRoute: typeof LayoutA1Route - } - '/(folder)/in-folder': { - id: '/(folder)/in-folder' - path: '/in-folder' - fullPath: '/in-folder' - preLoaderRoute: typeof folderInFolderRouteImport - parentRoute: typeof rootRouteImport - } - '/foo/_layout-b5': { - id: '/foo/_layout-b5' - path: '/foo' - fullPath: '/foo' - preLoaderRoute: typeof FooLayoutB5RouteRouteImport - parentRoute: typeof rootRouteImport - } - '/nested/_layout-b1/': { - id: '/nested/_layout-b1/' - path: '/' - fullPath: '/nested/' - preLoaderRoute: typeof NestedLayoutB1IndexRouteImport - parentRoute: typeof NestedLayoutB1Route - } - '/jested/_layout-b3/': { - id: '/jested/_layout-b3/' - path: '/' - fullPath: '/jested/' - preLoaderRoute: typeof JestedLayoutB3IndexRouteImport - parentRoute: typeof JestedLayoutB3Route - } - '/foo/_layout-b5/': { - id: '/foo/_layout-b5/' - path: '/' - fullPath: '/foo/' - preLoaderRoute: typeof FooLayoutB5IndexRouteImport - parentRoute: typeof FooLayoutB5RouteRoute - } - '/nested/_layout-b2/foo': { - id: '/nested/_layout-b2/foo' - path: '/foo' - fullPath: '/nested/foo' - preLoaderRoute: typeof NestedLayoutB2FooRouteImport - parentRoute: typeof NestedLayoutB2Route - } - '/nested/_layout-b1/_layout-c1': { - id: '/nested/_layout-b1/_layout-c1' - path: '' - fullPath: '/nested' - preLoaderRoute: typeof NestedLayoutB1LayoutC1RouteImport - parentRoute: typeof NestedLayoutB1Route - } - '/jested/_layout-b4/foo': { - id: '/jested/_layout-b4/foo' - path: '/foo' - fullPath: '/jested/foo' - preLoaderRoute: typeof JestedLayoutB4FooRouteImport - parentRoute: typeof JestedLayoutB4Route - } - '/jested/_layout-b3/_layout-c2': { - id: '/jested/_layout-b3/_layout-c2' - path: '' - fullPath: '/jested' - preLoaderRoute: typeof JestedLayoutB3LayoutC2RouteImport - parentRoute: typeof JestedLayoutB3Route - } - '/foo/_layout-b5/$id': { - id: '/foo/_layout-b5/$id' - path: '/$id' - fullPath: '/foo/$id' - preLoaderRoute: typeof FooLayoutB5IdRouteImport - parentRoute: typeof FooLayoutB5RouteRoute - } - '/nested/_layout-b1/_layout-c1/bar': { - id: '/nested/_layout-b1/_layout-c1/bar' - path: '/bar' - fullPath: '/nested/bar' - preLoaderRoute: typeof NestedLayoutB1LayoutC1BarRouteImport - parentRoute: typeof NestedLayoutB1LayoutC1Route - } - '/jested/_layout-b3/_layout-c2/bar': { - id: '/jested/_layout-b3/_layout-c2/bar' - path: '/bar' - fullPath: '/jested/bar' - preLoaderRoute: typeof JestedLayoutB3LayoutC2BarRouteImport - parentRoute: typeof JestedLayoutB3LayoutC2Route - } - } -} - -interface JestedLayoutB3LayoutC2RouteChildren { - JestedLayoutB3LayoutC2BarRoute: typeof JestedLayoutB3LayoutC2BarRoute -} - -const JestedLayoutB3LayoutC2RouteChildren: JestedLayoutB3LayoutC2RouteChildren = - { - JestedLayoutB3LayoutC2BarRoute: JestedLayoutB3LayoutC2BarRoute, - } - -const JestedLayoutB3LayoutC2RouteWithChildren = - JestedLayoutB3LayoutC2Route._addFileChildren( - JestedLayoutB3LayoutC2RouteChildren, - ) - -interface JestedLayoutB3RouteChildren { - JestedLayoutB3LayoutC2Route: typeof JestedLayoutB3LayoutC2RouteWithChildren - JestedLayoutB3IndexRoute: typeof JestedLayoutB3IndexRoute -} - -const JestedLayoutB3RouteChildren: JestedLayoutB3RouteChildren = { - JestedLayoutB3LayoutC2Route: JestedLayoutB3LayoutC2RouteWithChildren, - JestedLayoutB3IndexRoute: JestedLayoutB3IndexRoute, -} - -const JestedLayoutB3RouteWithChildren = JestedLayoutB3Route._addFileChildren( - JestedLayoutB3RouteChildren, -) - -interface JestedLayoutB4RouteChildren { - JestedLayoutB4FooRoute: typeof JestedLayoutB4FooRoute -} - -const JestedLayoutB4RouteChildren: JestedLayoutB4RouteChildren = { - JestedLayoutB4FooRoute: JestedLayoutB4FooRoute, -} - -const JestedLayoutB4RouteWithChildren = JestedLayoutB4Route._addFileChildren( - JestedLayoutB4RouteChildren, -) - -interface JestedRouteRouteChildren { - JestedLayoutB3Route: typeof JestedLayoutB3RouteWithChildren - JestedLayoutB4Route: typeof JestedLayoutB4RouteWithChildren -} - -const JestedRouteRouteChildren: JestedRouteRouteChildren = { - JestedLayoutB3Route: JestedLayoutB3RouteWithChildren, - JestedLayoutB4Route: JestedLayoutB4RouteWithChildren, -} - -const JestedRouteRouteWithChildren = JestedRouteRoute._addFileChildren( - JestedRouteRouteChildren, -) - -interface LayoutA1RouteChildren { - LayoutA1FooRoute: typeof LayoutA1FooRoute -} - -const LayoutA1RouteChildren: LayoutA1RouteChildren = { - LayoutA1FooRoute: LayoutA1FooRoute, -} - -const LayoutA1RouteWithChildren = LayoutA1Route._addFileChildren( - LayoutA1RouteChildren, -) - -interface LayoutA2RouteChildren { - LayoutA2BarRoute: typeof LayoutA2BarRoute -} - -const LayoutA2RouteChildren: LayoutA2RouteChildren = { - LayoutA2BarRoute: LayoutA2BarRoute, -} - -const LayoutA2RouteWithChildren = LayoutA2Route._addFileChildren( - LayoutA2RouteChildren, -) - -interface FooLayoutB5RouteRouteChildren { - FooLayoutB5IdRoute: typeof FooLayoutB5IdRoute - FooLayoutB5IndexRoute: typeof FooLayoutB5IndexRoute -} - -const FooLayoutB5RouteRouteChildren: FooLayoutB5RouteRouteChildren = { - FooLayoutB5IdRoute: FooLayoutB5IdRoute, - FooLayoutB5IndexRoute: FooLayoutB5IndexRoute, -} - -const FooLayoutB5RouteRouteWithChildren = - FooLayoutB5RouteRoute._addFileChildren(FooLayoutB5RouteRouteChildren) - -interface NestedLayoutB1LayoutC1RouteChildren { - NestedLayoutB1LayoutC1BarRoute: typeof NestedLayoutB1LayoutC1BarRoute -} - -const NestedLayoutB1LayoutC1RouteChildren: NestedLayoutB1LayoutC1RouteChildren = - { - NestedLayoutB1LayoutC1BarRoute: NestedLayoutB1LayoutC1BarRoute, - } - -const NestedLayoutB1LayoutC1RouteWithChildren = - NestedLayoutB1LayoutC1Route._addFileChildren( - NestedLayoutB1LayoutC1RouteChildren, - ) - -interface NestedLayoutB1RouteChildren { - NestedLayoutB1LayoutC1Route: typeof NestedLayoutB1LayoutC1RouteWithChildren - NestedLayoutB1IndexRoute: typeof NestedLayoutB1IndexRoute -} - -const NestedLayoutB1RouteChildren: NestedLayoutB1RouteChildren = { - NestedLayoutB1LayoutC1Route: NestedLayoutB1LayoutC1RouteWithChildren, - NestedLayoutB1IndexRoute: NestedLayoutB1IndexRoute, -} - -const NestedLayoutB1RouteWithChildren = NestedLayoutB1Route._addFileChildren( - NestedLayoutB1RouteChildren, -) - -interface NestedLayoutB2RouteChildren { - NestedLayoutB2FooRoute: typeof NestedLayoutB2FooRoute -} - -const NestedLayoutB2RouteChildren: NestedLayoutB2RouteChildren = { - NestedLayoutB2FooRoute: NestedLayoutB2FooRoute, -} - -const NestedLayoutB2RouteWithChildren = NestedLayoutB2Route._addFileChildren( - NestedLayoutB2RouteChildren, -) - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - JestedRouteRoute: JestedRouteRouteWithChildren, - LayoutA1Route: LayoutA1RouteWithChildren, - LayoutA2Route: LayoutA2RouteWithChildren, - FooLayoutB5RouteRoute: FooLayoutB5RouteRouteWithChildren, - folderInFolderRoute: folderInFolderRoute, - FooBarRoute: FooBarRoute, - NestedLayoutB1Route: NestedLayoutB1RouteWithChildren, - NestedLayoutB2Route: NestedLayoutB2RouteWithChildren, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/packages/router-generator/tests/generator/nested-route-groups-with-layouts-before-physical/routeTree.nonnested.snapshot.ts b/packages/router-generator/tests/generator/nested-route-groups-with-layouts-before-physical/routeTree.nonnested.snapshot.ts deleted file mode 100644 index 6c5c9950b22..00000000000 --- a/packages/router-generator/tests/generator/nested-route-groups-with-layouts-before-physical/routeTree.nonnested.snapshot.ts +++ /dev/null @@ -1,196 +0,0 @@ -/* eslint-disable */ - -// @ts-nocheck - -// noinspection JSUnusedGlobalSymbols - -// This file was automatically generated by TanStack Router. -// You should NOT make any changes in this file as it will be overwritten. -// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified. - -import { Route as rootRouteImport } from './routes/__root' -import { Route as groupCLayoutCRouteImport } from './routes/(group-c)/_layout-c' -import { Route as groupBLayoutBRouteImport } from './routes/(group-b)/_layout-b' -import { Route as groupALayoutARouteImport } from './routes/(group-a)/_layout-a' -import { Route as groupCLayoutCIndexRouteImport } from './routes/(group-c)/_layout-c/index' -import { Route as groupBLayoutBDashboardRouteImport } from './routes/(group-b)/_layout-b/dashboard' -import { Route as groupALayoutASignupRouteImport } from './routes/(group-a)/_layout-a/signup' -import { Route as groupALayoutALoginRouteImport } from './routes/(group-a)/_layout-a/login' - -const groupCLayoutCRoute = groupCLayoutCRouteImport.update({ - id: '/(group-c)/_layout-c', - getParentRoute: () => rootRouteImport, -} as any) -const groupBLayoutBRoute = groupBLayoutBRouteImport.update({ - id: '/(group-b)/_layout-b', - getParentRoute: () => rootRouteImport, -} as any) -const groupALayoutARoute = groupALayoutARouteImport.update({ - id: '/(group-a)/_layout-a', - getParentRoute: () => rootRouteImport, -} as any) -const groupCLayoutCIndexRoute = groupCLayoutCIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => groupCLayoutCRoute, -} as any) -const groupBLayoutBDashboardRoute = groupBLayoutBDashboardRouteImport.update({ - id: '/dashboard', - path: '/dashboard', - getParentRoute: () => groupBLayoutBRoute, -} as any) -const groupALayoutASignupRoute = groupALayoutASignupRouteImport.update({ - id: '/signup', - path: '/signup', - getParentRoute: () => groupALayoutARoute, -} as any) -const groupALayoutALoginRoute = groupALayoutALoginRouteImport.update({ - id: '/login', - path: '/login', - getParentRoute: () => groupALayoutARoute, -} as any) - -export interface FileRoutesByFullPath { - '/login': typeof groupALayoutALoginRoute - '/signup': typeof groupALayoutASignupRoute - '/dashboard': typeof groupBLayoutBDashboardRoute - '/': typeof groupCLayoutCIndexRoute -} -export interface FileRoutesByTo { - '/login': typeof groupALayoutALoginRoute - '/signup': typeof groupALayoutASignupRoute - '/dashboard': typeof groupBLayoutBDashboardRoute - '/': typeof groupCLayoutCIndexRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/(group-a)/_layout-a': typeof groupALayoutARouteWithChildren - '/(group-b)/_layout-b': typeof groupBLayoutBRouteWithChildren - '/(group-c)/_layout-c': typeof groupCLayoutCRouteWithChildren - '/(group-a)/_layout-a/login': typeof groupALayoutALoginRoute - '/(group-a)/_layout-a/signup': typeof groupALayoutASignupRoute - '/(group-b)/_layout-b/dashboard': typeof groupBLayoutBDashboardRoute - '/(group-c)/_layout-c/': typeof groupCLayoutCIndexRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/login' | '/signup' | '/dashboard' | '/' - fileRoutesByTo: FileRoutesByTo - to: '/login' | '/signup' | '/dashboard' | '/' - id: - | '__root__' - | '/(group-a)/_layout-a' - | '/(group-b)/_layout-b' - | '/(group-c)/_layout-c' - | '/(group-a)/_layout-a/login' - | '/(group-a)/_layout-a/signup' - | '/(group-b)/_layout-b/dashboard' - | '/(group-c)/_layout-c/' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - groupALayoutARoute: typeof groupALayoutARouteWithChildren - groupBLayoutBRoute: typeof groupBLayoutBRouteWithChildren - groupCLayoutCRoute: typeof groupCLayoutCRouteWithChildren -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/(group-c)/_layout-c': { - id: '/(group-c)/_layout-c' - path: '' - fullPath: '' - preLoaderRoute: typeof groupCLayoutCRouteImport - parentRoute: typeof rootRouteImport - } - '/(group-b)/_layout-b': { - id: '/(group-b)/_layout-b' - path: '' - fullPath: '' - preLoaderRoute: typeof groupBLayoutBRouteImport - parentRoute: typeof rootRouteImport - } - '/(group-a)/_layout-a': { - id: '/(group-a)/_layout-a' - path: '' - fullPath: '' - preLoaderRoute: typeof groupALayoutARouteImport - parentRoute: typeof rootRouteImport - } - '/(group-c)/_layout-c/': { - id: '/(group-c)/_layout-c/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof groupCLayoutCIndexRouteImport - parentRoute: typeof groupCLayoutCRoute - } - '/(group-b)/_layout-b/dashboard': { - id: '/(group-b)/_layout-b/dashboard' - path: '/dashboard' - fullPath: '/dashboard' - preLoaderRoute: typeof groupBLayoutBDashboardRouteImport - parentRoute: typeof groupBLayoutBRoute - } - '/(group-a)/_layout-a/signup': { - id: '/(group-a)/_layout-a/signup' - path: '/signup' - fullPath: '/signup' - preLoaderRoute: typeof groupALayoutASignupRouteImport - parentRoute: typeof groupALayoutARoute - } - '/(group-a)/_layout-a/login': { - id: '/(group-a)/_layout-a/login' - path: '/login' - fullPath: '/login' - preLoaderRoute: typeof groupALayoutALoginRouteImport - parentRoute: typeof groupALayoutARoute - } - } -} - -interface groupALayoutARouteChildren { - groupALayoutALoginRoute: typeof groupALayoutALoginRoute - groupALayoutASignupRoute: typeof groupALayoutASignupRoute -} - -const groupALayoutARouteChildren: groupALayoutARouteChildren = { - groupALayoutALoginRoute: groupALayoutALoginRoute, - groupALayoutASignupRoute: groupALayoutASignupRoute, -} - -const groupALayoutARouteWithChildren = groupALayoutARoute._addFileChildren( - groupALayoutARouteChildren, -) - -interface groupBLayoutBRouteChildren { - groupBLayoutBDashboardRoute: typeof groupBLayoutBDashboardRoute -} - -const groupBLayoutBRouteChildren: groupBLayoutBRouteChildren = { - groupBLayoutBDashboardRoute: groupBLayoutBDashboardRoute, -} - -const groupBLayoutBRouteWithChildren = groupBLayoutBRoute._addFileChildren( - groupBLayoutBRouteChildren, -) - -interface groupCLayoutCRouteChildren { - groupCLayoutCIndexRoute: typeof groupCLayoutCIndexRoute -} - -const groupCLayoutCRouteChildren: groupCLayoutCRouteChildren = { - groupCLayoutCIndexRoute: groupCLayoutCIndexRoute, -} - -const groupCLayoutCRouteWithChildren = groupCLayoutCRoute._addFileChildren( - groupCLayoutCRouteChildren, -) - -const rootRouteChildren: RootRouteChildren = { - groupALayoutARoute: groupALayoutARouteWithChildren, - groupBLayoutBRoute: groupBLayoutBRouteWithChildren, - groupCLayoutCRoute: groupCLayoutCRouteWithChildren, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/packages/router-generator/tests/generator/nested-verboseFileRoutes-false/routeTree.nonnested.snapshot.ts b/packages/router-generator/tests/generator/nested-verboseFileRoutes-false/routeTree.nonnested.snapshot.ts deleted file mode 100644 index 6d0d5ac00ba..00000000000 --- a/packages/router-generator/tests/generator/nested-verboseFileRoutes-false/routeTree.nonnested.snapshot.ts +++ /dev/null @@ -1,461 +0,0 @@ -/* eslint-disable */ - -// @ts-nocheck - -// noinspection JSUnusedGlobalSymbols - -// This file was automatically generated by TanStack Router. -// You should NOT make any changes in this file as it will be overwritten. -// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified. - -import type { CreateFileRoute, FileRoutesByPath } from '@tanstack/react-router' - -import { Route as rootRouteImport } from './routes/__root' -import { Route as PostsRouteRouteImport } from './routes/posts/route' -import { Route as BlogRouteRouteImport } from './routes/blog/route' -import { Route as IndexRouteImport } from './routes/index' -import { Route as PostsIndexRouteImport } from './routes/posts/index' -import { Route as BlogIndexRouteImport } from './routes/blog/index' -import { Route as BlogStatsRouteImport } from './routes/blog_/stats' -import { Route as BlogSlugRouteImport } from './routes/blog/$slug' -import { Route as BlogBlogIdRouteRouteImport } from './routes/blog_/$blogId/route' -import { Route as PostsPostIdIndexRouteImport } from './routes/posts/$postId/index' -import { Route as PostsPostIdDeepRouteImport } from './routes/posts/$postId/deep' -import { Route as BlogBlogIdEditRouteImport } from './routes/blog_/$blogId_/edit' -import { Route as BlogBlogIdSlugRouteRouteImport } from './routes/blog_/$blogId/$slug/route' -import { Route as BlogBlogIdSlugBarRouteImport } from './routes/blog_/$blogId/$slug_/bar' - -const PostsRouteRoute = PostsRouteRouteImport.update({ - id: '/posts', - path: '/posts', - getParentRoute: () => rootRouteImport, -} as any) -const BlogRouteRoute = BlogRouteRouteImport.update({ - id: '/blog', - path: '/blog', - getParentRoute: () => rootRouteImport, -} as any) -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const PostsIndexRoute = PostsIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => PostsRouteRoute, -} as any) -const BlogIndexRoute = BlogIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => BlogRouteRoute, -} as any) -const BlogStatsRoute = BlogStatsRouteImport.update({ - id: '/blog/stats', - path: '/blog/stats', - getParentRoute: () => rootRouteImport, -} as any) -const BlogSlugRoute = BlogSlugRouteImport.update({ - id: '/$slug', - path: '/$slug', - getParentRoute: () => BlogRouteRoute, -} as any) -const BlogBlogIdRouteRoute = BlogBlogIdRouteRouteImport.update({ - id: '/blog/$blogId', - path: '/blog/$blogId', - getParentRoute: () => rootRouteImport, -} as any) -const PostsPostIdIndexRoute = PostsPostIdIndexRouteImport.update({ - id: '/$postId/', - path: '/$postId/', - getParentRoute: () => PostsRouteRoute, -} as any) -const PostsPostIdDeepRoute = PostsPostIdDeepRouteImport.update({ - id: '/$postId/deep', - path: '/$postId/deep', - getParentRoute: () => PostsRouteRoute, -} as any) -const BlogBlogIdEditRoute = BlogBlogIdEditRouteImport.update({ - id: '/blog/$blogId/edit', - path: '/blog/$blogId/edit', - getParentRoute: () => rootRouteImport, -} as any) -const BlogBlogIdSlugRouteRoute = BlogBlogIdSlugRouteRouteImport.update({ - id: '/$slug', - path: '/$slug', - getParentRoute: () => BlogBlogIdRouteRoute, -} as any) -const BlogBlogIdSlugBarRoute = BlogBlogIdSlugBarRouteImport.update({ - id: '/$slug/bar', - path: '/$slug/bar', - getParentRoute: () => BlogBlogIdRouteRoute, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/blog': typeof BlogRouteRouteWithChildren - '/posts': typeof PostsRouteRouteWithChildren - '/blog/$blogId': typeof BlogBlogIdRouteRouteWithChildren - '/blog/$slug': typeof BlogSlugRoute - '/blog/stats': typeof BlogStatsRoute - '/blog/': typeof BlogIndexRoute - '/posts/': typeof PostsIndexRoute - '/blog/$blogId/$slug': typeof BlogBlogIdSlugRouteRoute - '/blog/$blogId/edit': typeof BlogBlogIdEditRoute - '/posts/$postId/deep': typeof PostsPostIdDeepRoute - '/posts/$postId': typeof PostsPostIdIndexRoute - '/blog/$blogId/$slug/bar': typeof BlogBlogIdSlugBarRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/blog/$blogId': typeof BlogBlogIdRouteRouteWithChildren - '/blog/$slug': typeof BlogSlugRoute - '/blog/stats': typeof BlogStatsRoute - '/blog': typeof BlogIndexRoute - '/posts': typeof PostsIndexRoute - '/blog/$blogId/$slug': typeof BlogBlogIdSlugRouteRoute - '/blog/$blogId/edit': typeof BlogBlogIdEditRoute - '/posts/$postId/deep': typeof PostsPostIdDeepRoute - '/posts/$postId': typeof PostsPostIdIndexRoute - '/blog/$blogId/$slug/bar': typeof BlogBlogIdSlugBarRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/blog': typeof BlogRouteRouteWithChildren - '/posts': typeof PostsRouteRouteWithChildren - '/blog/$blogId': typeof BlogBlogIdRouteRouteWithChildren - '/blog/$slug': typeof BlogSlugRoute - '/blog/stats': typeof BlogStatsRoute - '/blog/': typeof BlogIndexRoute - '/posts/': typeof PostsIndexRoute - '/blog/$blogId/$slug': typeof BlogBlogIdSlugRouteRoute - '/blog/$blogId/edit': typeof BlogBlogIdEditRoute - '/posts/$postId/deep': typeof PostsPostIdDeepRoute - '/posts/$postId/': typeof PostsPostIdIndexRoute - '/blog/$blogId/$slug/bar': typeof BlogBlogIdSlugBarRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: - | '/' - | '/blog' - | '/posts' - | '/blog/$blogId' - | '/blog/$slug' - | '/blog/stats' - | '/blog/' - | '/posts/' - | '/blog/$blogId/$slug' - | '/blog/$blogId/edit' - | '/posts/$postId/deep' - | '/posts/$postId' - | '/blog/$blogId/$slug/bar' - fileRoutesByTo: FileRoutesByTo - to: - | '/' - | '/blog/$blogId' - | '/blog/$slug' - | '/blog/stats' - | '/blog' - | '/posts' - | '/blog/$blogId/$slug' - | '/blog/$blogId/edit' - | '/posts/$postId/deep' - | '/posts/$postId' - | '/blog/$blogId/$slug/bar' - id: - | '__root__' - | '/' - | '/blog' - | '/posts' - | '/blog/$blogId' - | '/blog/$slug' - | '/blog/stats' - | '/blog/' - | '/posts/' - | '/blog/$blogId/$slug' - | '/blog/$blogId/edit' - | '/posts/$postId/deep' - | '/posts/$postId/' - | '/blog/$blogId/$slug/bar' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - BlogRouteRoute: typeof BlogRouteRouteWithChildren - PostsRouteRoute: typeof PostsRouteRouteWithChildren - BlogBlogIdRouteRoute: typeof BlogBlogIdRouteRouteWithChildren - BlogStatsRoute: typeof BlogStatsRoute - BlogBlogIdEditRoute: typeof BlogBlogIdEditRoute -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/posts': { - id: '/posts' - path: '/posts' - fullPath: '/posts' - preLoaderRoute: typeof PostsRouteRouteImport - parentRoute: typeof rootRouteImport - } - '/blog': { - id: '/blog' - path: '/blog' - fullPath: '/blog' - preLoaderRoute: typeof BlogRouteRouteImport - parentRoute: typeof rootRouteImport - } - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/posts/': { - id: '/posts/' - path: '/' - fullPath: '/posts/' - preLoaderRoute: typeof PostsIndexRouteImport - parentRoute: typeof PostsRouteRoute - } - '/blog/': { - id: '/blog/' - path: '/' - fullPath: '/blog/' - preLoaderRoute: typeof BlogIndexRouteImport - parentRoute: typeof BlogRouteRoute - } - '/blog/stats': { - id: '/blog/stats' - path: '/blog/stats' - fullPath: '/blog/stats' - preLoaderRoute: typeof BlogStatsRouteImport - parentRoute: typeof rootRouteImport - } - '/blog/$slug': { - id: '/blog/$slug' - path: '/$slug' - fullPath: '/blog/$slug' - preLoaderRoute: typeof BlogSlugRouteImport - parentRoute: typeof BlogRouteRoute - } - '/blog/$blogId': { - id: '/blog/$blogId' - path: '/blog/$blogId' - fullPath: '/blog/$blogId' - preLoaderRoute: typeof BlogBlogIdRouteRouteImport - parentRoute: typeof rootRouteImport - } - '/posts/$postId/': { - id: '/posts/$postId/' - path: '/$postId' - fullPath: '/posts/$postId' - preLoaderRoute: typeof PostsPostIdIndexRouteImport - parentRoute: typeof PostsRouteRoute - } - '/posts/$postId/deep': { - id: '/posts/$postId/deep' - path: '/$postId/deep' - fullPath: '/posts/$postId/deep' - preLoaderRoute: typeof PostsPostIdDeepRouteImport - parentRoute: typeof PostsRouteRoute - } - '/blog/$blogId/edit': { - id: '/blog/$blogId/edit' - path: '/blog/$blogId/edit' - fullPath: '/blog/$blogId/edit' - preLoaderRoute: typeof BlogBlogIdEditRouteImport - parentRoute: typeof rootRouteImport - } - '/blog/$blogId/$slug': { - id: '/blog/$blogId/$slug' - path: '/$slug' - fullPath: '/blog/$blogId/$slug' - preLoaderRoute: typeof BlogBlogIdSlugRouteRouteImport - parentRoute: typeof BlogBlogIdRouteRoute - } - '/blog/$blogId/$slug/bar': { - id: '/blog/$blogId/$slug/bar' - path: '/$slug/bar' - fullPath: '/blog/$blogId/$slug/bar' - preLoaderRoute: typeof BlogBlogIdSlugBarRouteImport - parentRoute: typeof BlogBlogIdRouteRoute - } - } -} - -declare module './routes/index' { - const createFileRoute: CreateFileRoute< - '/', - FileRoutesByPath['/']['parentRoute'], - FileRoutesByPath['/']['id'], - FileRoutesByPath['/']['path'], - FileRoutesByPath['/']['fullPath'] - > -} -declare module './routes/blog/route' { - const createFileRoute: CreateFileRoute< - '/blog', - FileRoutesByPath['/blog']['parentRoute'], - FileRoutesByPath['/blog']['id'], - FileRoutesByPath['/blog']['path'], - FileRoutesByPath['/blog']['fullPath'] - > -} -declare module './routes/posts/route' { - const createFileRoute: CreateFileRoute< - '/posts', - FileRoutesByPath['/posts']['parentRoute'], - FileRoutesByPath['/posts']['id'], - FileRoutesByPath['/posts']['path'], - FileRoutesByPath['/posts']['fullPath'] - > -} -declare module './routes/blog_/$blogId/route' { - const createFileRoute: CreateFileRoute< - '/blog/$blogId', - FileRoutesByPath['/blog/$blogId']['parentRoute'], - FileRoutesByPath['/blog/$blogId']['id'], - FileRoutesByPath['/blog/$blogId']['path'], - FileRoutesByPath['/blog/$blogId']['fullPath'] - > -} -declare module './routes/blog/$slug' { - const createFileRoute: CreateFileRoute< - '/blog/$slug', - FileRoutesByPath['/blog/$slug']['parentRoute'], - FileRoutesByPath['/blog/$slug']['id'], - FileRoutesByPath['/blog/$slug']['path'], - FileRoutesByPath['/blog/$slug']['fullPath'] - > -} -declare module './routes/blog_/stats' { - const createFileRoute: CreateFileRoute< - '/blog/stats', - FileRoutesByPath['/blog/stats']['parentRoute'], - FileRoutesByPath['/blog/stats']['id'], - FileRoutesByPath['/blog/stats']['path'], - FileRoutesByPath['/blog/stats']['fullPath'] - > -} -declare module './routes/blog/index' { - const createFileRoute: CreateFileRoute< - '/blog/', - FileRoutesByPath['/blog/']['parentRoute'], - FileRoutesByPath['/blog/']['id'], - FileRoutesByPath['/blog/']['path'], - FileRoutesByPath['/blog/']['fullPath'] - > -} -declare module './routes/posts/index' { - const createFileRoute: CreateFileRoute< - '/posts/', - FileRoutesByPath['/posts/']['parentRoute'], - FileRoutesByPath['/posts/']['id'], - FileRoutesByPath['/posts/']['path'], - FileRoutesByPath['/posts/']['fullPath'] - > -} -declare module './routes/blog_/$blogId/$slug/route' { - const createFileRoute: CreateFileRoute< - '/blog/$blogId/$slug', - FileRoutesByPath['/blog/$blogId/$slug']['parentRoute'], - FileRoutesByPath['/blog/$blogId/$slug']['id'], - FileRoutesByPath['/blog/$blogId/$slug']['path'], - FileRoutesByPath['/blog/$blogId/$slug']['fullPath'] - > -} -declare module './routes/blog_/$blogId_/edit' { - const createFileRoute: CreateFileRoute< - '/blog/$blogId/edit', - FileRoutesByPath['/blog/$blogId/edit']['parentRoute'], - FileRoutesByPath['/blog/$blogId/edit']['id'], - FileRoutesByPath['/blog/$blogId/edit']['path'], - FileRoutesByPath['/blog/$blogId/edit']['fullPath'] - > -} -declare module './routes/posts/$postId/deep' { - const createFileRoute: CreateFileRoute< - '/posts/$postId/deep', - FileRoutesByPath['/posts/$postId/deep']['parentRoute'], - FileRoutesByPath['/posts/$postId/deep']['id'], - FileRoutesByPath['/posts/$postId/deep']['path'], - FileRoutesByPath['/posts/$postId/deep']['fullPath'] - > -} -declare module './routes/posts/$postId/index' { - const createFileRoute: CreateFileRoute< - '/posts/$postId/', - FileRoutesByPath['/posts/$postId/']['parentRoute'], - FileRoutesByPath['/posts/$postId/']['id'], - FileRoutesByPath['/posts/$postId/']['path'], - FileRoutesByPath['/posts/$postId/']['fullPath'] - > -} -declare module './routes/blog_/$blogId/$slug_/bar' { - const createFileRoute: CreateFileRoute< - '/blog/$blogId/$slug/bar', - FileRoutesByPath['/blog/$blogId/$slug/bar']['parentRoute'], - FileRoutesByPath['/blog/$blogId/$slug/bar']['id'], - FileRoutesByPath['/blog/$blogId/$slug/bar']['path'], - FileRoutesByPath['/blog/$blogId/$slug/bar']['fullPath'] - > -} - -interface BlogRouteRouteChildren { - BlogSlugRoute: typeof BlogSlugRoute - BlogIndexRoute: typeof BlogIndexRoute -} - -const BlogRouteRouteChildren: BlogRouteRouteChildren = { - BlogSlugRoute: BlogSlugRoute, - BlogIndexRoute: BlogIndexRoute, -} - -const BlogRouteRouteWithChildren = BlogRouteRoute._addFileChildren( - BlogRouteRouteChildren, -) - -interface PostsRouteRouteChildren { - PostsIndexRoute: typeof PostsIndexRoute - PostsPostIdDeepRoute: typeof PostsPostIdDeepRoute - PostsPostIdIndexRoute: typeof PostsPostIdIndexRoute -} - -const PostsRouteRouteChildren: PostsRouteRouteChildren = { - PostsIndexRoute: PostsIndexRoute, - PostsPostIdDeepRoute: PostsPostIdDeepRoute, - PostsPostIdIndexRoute: PostsPostIdIndexRoute, -} - -const PostsRouteRouteWithChildren = PostsRouteRoute._addFileChildren( - PostsRouteRouteChildren, -) - -interface BlogBlogIdRouteRouteChildren { - BlogBlogIdSlugRouteRoute: typeof BlogBlogIdSlugRouteRoute - BlogBlogIdSlugBarRoute: typeof BlogBlogIdSlugBarRoute -} - -const BlogBlogIdRouteRouteChildren: BlogBlogIdRouteRouteChildren = { - BlogBlogIdSlugRouteRoute: BlogBlogIdSlugRouteRoute, - BlogBlogIdSlugBarRoute: BlogBlogIdSlugBarRoute, -} - -const BlogBlogIdRouteRouteWithChildren = BlogBlogIdRouteRoute._addFileChildren( - BlogBlogIdRouteRouteChildren, -) - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - BlogRouteRoute: BlogRouteRouteWithChildren, - PostsRouteRoute: PostsRouteRouteWithChildren, - BlogBlogIdRouteRoute: BlogBlogIdRouteRouteWithChildren, - BlogStatsRoute: BlogStatsRoute, - BlogBlogIdEditRoute: BlogBlogIdEditRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/packages/router-generator/tests/generator/nested-verboseFileRoutes-false/tests.nonnested.test-d.ts b/packages/router-generator/tests/generator/nested-verboseFileRoutes-false/tests.nonnested.test-d.ts deleted file mode 100644 index 4cf84c78ecf..00000000000 --- a/packages/router-generator/tests/generator/nested-verboseFileRoutes-false/tests.nonnested.test-d.ts +++ /dev/null @@ -1,619 +0,0 @@ -import { - Link, - createRouter, - redirect, - useLoaderData, - useLoaderDeps, - useMatch, - useNavigate, - useParams, - useRouteContext, - useSearch, -} from '@tanstack/react-router' -import { expectTypeOf, test } from 'vitest' -import { routeTree } from './routeTree.nonnested.gen' -import type { MakeRouteMatch } from '@tanstack/react-router' - -const defaultRouter = createRouter({ - routeTree, -}) - -type DefaultRouter = typeof defaultRouter - -const alwaysTrailingSlashRouter = createRouter({ - routeTree, - trailingSlash: 'always', -}) - -const neverTrailingSlashRouter = createRouter({ - routeTree, - trailingSlash: 'never', -}) - -const preserveTrailingSlashRouter = createRouter({ - routeTree, - trailingSlash: 'preserve', -}) - -test('when navigating to the root', () => { - expectTypeOf(Link) - .parameter(0) - .toHaveProperty('to') - .toEqualTypeOf< - | '/' - | '/blog' - | '/posts' - | '/blog/$blogId' - | '/blog/$blogId/edit' - | '/blog/$blogId/$slug' - | '/blog/$blogId/$slug/bar' - | '/blog/$slug' - | '/blog/stats' - | '/posts/$postId/deep' - | '/posts/$postId' - | undefined - >() - - expectTypeOf(Link) - .parameter(0) - .toHaveProperty('to') - .toEqualTypeOf< - | '/' - | '/blog/' - | '/posts/' - | '/blog/$blogId/' - | '/blog/$blogId/edit/' - | '/blog/$blogId/$slug/' - | '/blog/$blogId/$slug/bar/' - | '/blog/$slug/' - | '/blog/stats/' - | '/posts/$postId/deep/' - | '/posts/$postId/' - | undefined - >() - - expectTypeOf(Link) - .parameter(0) - .toHaveProperty('to') - .toEqualTypeOf< - | '/' - | '/blog' - | '/posts' - | '/blog/$blogId' - | '/blog/$blogId/edit' - | '/blog/$blogId/$slug' - | '/blog/$blogId/$slug/bar' - | '/blog/$slug' - | '/blog/stats' - | '/posts/$postId/deep' - | '/posts/$postId' - | undefined - >() - - expectTypeOf(Link) - .parameter(0) - .toHaveProperty('to') - .toEqualTypeOf< - | '/' - | '/blog' - | '/posts' - | '/blog/$blogId' - | '/blog/$blogId/edit' - | '/blog/$blogId/$slug' - | '/blog/$blogId/$slug/bar' - | '/blog/$slug' - | '/blog/stats' - | '/posts/$postId/deep' - | '/posts/$postId' - | '/blog/' - | '/posts/' - | '/blog/$blogId/' - | '/blog/$blogId/edit/' - | '/blog/$blogId/$slug/' - | '/blog/$blogId/$slug/bar/' - | '/blog/$slug/' - | '/blog/stats/' - | '/posts/$postId/deep/' - | '/posts/$postId/' - | undefined - >() - - expectTypeOf(Link) - .parameter(0) - .toHaveProperty('from') - .toEqualTypeOf< - | '/' - | '/blog' - | '/posts' - | '/blog/$blogId' - | '/blog/$blogId/edit' - | '/blog/$blogId/$slug' - | '/blog/$blogId/$slug/bar' - | '/blog/$slug' - | '/blog/stats' - | '/blog/' - | '/posts/' - | '/posts/$postId/deep' - | '/posts/$postId' - | undefined - >() - - expectTypeOf(Link) - .parameter(0) - .toHaveProperty('search') - .exclude<(...args: any) => any>() - .toEqualTypeOf() - - expectTypeOf(Link) - .parameter(0) - .toHaveProperty('search') - .exclude<(...args: any) => any>() - .toEqualTypeOf() - - expectTypeOf(Link) - .parameter(0) - .toHaveProperty('search') - .exclude<(...args: any) => any>() - .toEqualTypeOf() - - expectTypeOf(Link) - .parameter(0) - .toHaveProperty('search') - .exclude<(...args: any) => any>() - .toEqualTypeOf() -}) - -test('when navigating a index route with search and params', () => { - expectTypeOf(Link) - .parameter(0) - .toHaveProperty('to') - .toEqualTypeOf< - | '.' - | '..' - | '/' - | '/blog' - | '/posts' - | '/blog/$blogId' - | '/blog/$blogId/edit' - | '/blog/$blogId/$slug' - | '/blog/$blogId/$slug/bar' - | '/blog/$slug' - | '/blog/stats' - | '/posts/$postId/deep' - | '/posts/$postId' - >() - - expectTypeOf( - Link, - ) - .parameter(0) - .toHaveProperty('to') - .toEqualTypeOf< - | './' - | '../' - | '/' - | '/blog/' - | '/posts/' - | '/blog/$blogId/' - | '/blog/$blogId/edit/' - | '/blog/$blogId/$slug/' - | '/blog/$blogId/$slug/bar/' - | '/blog/$slug/' - | '/blog/stats/' - | '/posts/$postId/deep/' - | '/posts/$postId/' - >() - - expectTypeOf(Link) - .parameter(0) - .toHaveProperty('to') - .toEqualTypeOf< - | '/' - | '/blog' - | '/posts' - | '/blog/$blogId' - | '/blog/$blogId/edit' - | '/blog/$blogId/$slug' - | '/blog/$blogId/$slug/bar' - | '/blog/$slug' - | '/blog/stats' - | '/posts/$postId/deep' - | '/posts/$postId' - | '.' - | '..' - >() - - expectTypeOf( - Link, - ) - .parameter(0) - .toHaveProperty('to') - .toEqualTypeOf< - | '..' - | '../' - | '.' - | './' - | '/' - | '/blog' - | '/posts' - | '/blog/$blogId' - | '/blog/$blogId/edit' - | '/blog/$blogId/$slug' - | '/blog/$blogId/$slug/bar' - | '/blog/$slug' - | '/blog/stats' - | '/posts/$postId/deep' - | '/posts/$postId' - | '/blog/' - | '/posts/' - | '/blog/$blogId/' - | '/blog/$blogId/edit/' - | '/blog/$blogId/$slug/' - | '/blog/$blogId/$slug/bar/' - | '/blog/$slug/' - | '/blog/stats/' - | '/posts/$postId/deep/' - | '/posts/$postId/' - >() - - expectTypeOf(Link) - .parameter(0) - .toHaveProperty('from') - .toEqualTypeOf< - | '/' - | '/posts/$postId' - | '/blog' - | '/posts' - | '/blog/$blogId' - | '/blog/$blogId/edit' - | '/blog/$blogId/$slug' - | '/blog/$blogId/$slug/bar' - | '/blog/$slug' - | '/blog/stats' - | '/blog/' - | '/posts/' - | '/posts/$postId/deep' - | undefined - >() - - expectTypeOf(Link) - .parameter(0) - .toHaveProperty('search') - .exclude<(...args: any) => any>() - .toEqualTypeOf<{ indexSearch: string }>() - - expectTypeOf(Link) - .parameter(0) - .toHaveProperty('search') - .exclude<(...args: any) => any>() - .toEqualTypeOf() - - expectTypeOf( - Link, - ) - .parameter(0) - .toHaveProperty('search') - .exclude<(...args: any) => any>() - .toEqualTypeOf<{ indexSearch: string }>() - - expectTypeOf(Link) - .parameter(0) - .toHaveProperty('search') - .exclude<(...args: any) => any>() - .toEqualTypeOf() - - expectTypeOf(Link) - .parameter(0) - .toHaveProperty('search') - .exclude<(...args: any) => any>() - .toEqualTypeOf<{ indexSearch: string }>() - - expectTypeOf(Link) - .parameter(0) - .toHaveProperty('search') - .exclude<(...args: any) => any>() - .toEqualTypeOf<{ indexSearch: string }>() - - expectTypeOf(Link) - .parameter(0) - .toHaveProperty('search') - .exclude<(...args: any) => any>() - .toEqualTypeOf<{ indexSearch: string }>() - - expectTypeOf(Link) - .parameter(0) - .toHaveProperty('params') - .exclude<(...args: any) => any>() - .toEqualTypeOf<{ postId: string }>() - - expectTypeOf(Link) - .parameter(0) - .toHaveProperty('params') - .exclude<(...args: any) => any>() - .toEqualTypeOf() - - expectTypeOf( - Link, - ) - .parameter(0) - .toHaveProperty('params') - .exclude<(...args: any) => any>() - .toEqualTypeOf<{ postId: string }>() - - expectTypeOf(Link) - .parameter(0) - .toHaveProperty('params') - .exclude<(...args: any) => any>() - .toEqualTypeOf() - - expectTypeOf(Link) - .parameter(0) - .toHaveProperty('params') - .exclude<(...args: any) => any>() - .toEqualTypeOf<{ postId: string }>() - - expectTypeOf(Link) - .parameter(0) - .toHaveProperty('params') - .exclude<(...args: any) => any>() - .toEqualTypeOf<{ postId: string }>() - - expectTypeOf(Link) - .parameter(0) - .toHaveProperty('params') - .exclude<(...args: any) => any>() - .toEqualTypeOf<{ postId: string }>() -}) - -test('when navigating from a index route with search and params', () => { - expectTypeOf(Link) - .parameter(0) - .toHaveProperty('from') - .toEqualTypeOf< - | '/' - | '/posts/$postId' - | '/blog' - | '/posts' - | '/blog/$blogId' - | '/blog/$blogId/edit' - | '/blog/$blogId/$slug' - | '/blog/$blogId/$slug/bar' - | '/blog/$slug' - | '/blog/stats' - | '/blog/' - | '/posts/' - | '/posts/$postId/deep' - | undefined - >() - - expectTypeOf(Link) - .parameter(0) - .toHaveProperty('search') - .parameter(0) - .toEqualTypeOf<{ indexSearch: string }>() -}) - -test('when using useNavigate', () => { - const navigate = useNavigate() - - expectTypeOf(navigate) - .parameter(0) - .toHaveProperty('to') - .toEqualTypeOf< - | '/' - | '.' - | '..' - | '/blog' - | '/posts' - | '/blog/$blogId' - | '/blog/$blogId/edit' - | '/blog/$blogId/$slug' - | '/blog/$blogId/$slug/bar' - | '/blog/$slug' - | '/blog/stats' - | '/posts/$postId/deep' - | '/posts/$postId' - >() -}) - -test('when using redirect', () => { - expectTypeOf(redirect) - .parameter(0) - .toHaveProperty('to') - .toEqualTypeOf< - | '/' - | '/posts/$postId' - | '/blog' - | '/posts' - | '/blog/$blogId' - | '/blog/$blogId/edit' - | '/blog/$blogId/$slug' - | '/blog/$blogId/$slug/bar' - | '/blog/$slug' - | '/blog/stats' - | '/posts/$postId/deep' - | undefined - >() -}) - -test('when using useSearch from a route with no search', () => { - expectTypeOf(useSearch) - .parameter(0) - .toHaveProperty('from') - .toEqualTypeOf< - | '__root__' - | '/' - | '/blog' - | '/blog/' - | '/posts' - | '/blog/$blogId' - | '/blog/$blogId/edit' - | '/blog/$blogId/$slug' - | '/blog/$blogId/$slug/bar' - | '/blog/$slug' - | '/blog/stats' - | '/posts/' - | '/posts/$postId/deep' - | '/posts/$postId/' - >() - - expectTypeOf(useSearch).returns.toEqualTypeOf<{}>() -}) - -test('when using useSearch from a route with search', () => { - expectTypeOf(useSearch) - .parameter(0) - .toHaveProperty('from') - .toEqualTypeOf< - | '__root__' - | '/' - | '/blog' - | '/blog/' - | '/posts' - | '/blog/$blogId' - | '/blog/$blogId/edit' - | '/blog/$blogId/$slug' - | '/blog/$blogId/$slug/bar' - | '/blog/$slug' - | '/blog/stats' - | '/posts/' - | '/posts/$postId/deep' - | '/posts/$postId/' - >() - - expectTypeOf( - useSearch, - ).returns.toEqualTypeOf<{ indexSearch: string }>() -}) - -test('when using useLoaderData from a route with loaderData', () => { - expectTypeOf(useLoaderData) - .parameter(0) - .toHaveProperty('from') - .toEqualTypeOf< - | '__root__' - | '/' - | '/blog' - | '/blog/' - | '/posts' - | '/blog/$blogId' - | '/blog/$blogId/edit' - | '/blog/$blogId/$slug' - | '/blog/$blogId/$slug/bar' - | '/blog/$slug' - | '/blog/stats' - | '/posts/' - | '/posts/$postId/deep' - | '/posts/$postId/' - >() - - expectTypeOf( - useLoaderData, - ).returns.toEqualTypeOf<{ data: string }>() -}) - -test('when using useLoaderDeps from a route with loaderDeps', () => { - expectTypeOf(useLoaderDeps) - .parameter(0) - .toHaveProperty('from') - .toEqualTypeOf< - | '__root__' - | '/' - | '/blog' - | '/blog/' - | '/posts' - | '/blog/$blogId' - | '/blog/$blogId/edit' - | '/blog/$blogId/$slug' - | '/blog/$blogId/$slug/bar' - | '/blog/$slug' - | '/blog/stats' - | '/posts/' - | '/posts/$postId/deep' - | '/posts/$postId/' - >() - - expectTypeOf( - useLoaderDeps, - ).returns.toEqualTypeOf<{ dep: number }>() -}) - -test('when using useMatch from a route', () => { - expectTypeOf(useMatch) - .parameter(0) - .toHaveProperty('from') - .toEqualTypeOf< - | '__root__' - | '/' - | '/blog' - | '/blog/' - | '/posts' - | '/blog/$blogId' - | '/blog/$blogId/edit' - | '/blog/$blogId/$slug' - | '/blog/$blogId/$slug/bar' - | '/blog/$slug' - | '/blog/stats' - | '/posts/' - | '/posts/$postId/deep' - | '/posts/$postId/' - >() - - expectTypeOf( - useMatch, - ).returns.toEqualTypeOf< - MakeRouteMatch - >() -}) - -test('when using useParams from a route', () => { - expectTypeOf(useParams) - .parameter(0) - .toHaveProperty('from') - .toEqualTypeOf< - | '__root__' - | '/' - | '/blog' - | '/blog/' - | '/posts' - | '/blog/$blogId' - | '/blog/$blogId/edit' - | '/blog/$blogId/$slug' - | '/blog/$blogId/$slug/bar' - | '/blog/$slug' - | '/blog/stats' - | '/posts/' - | '/posts/$postId/deep' - | '/posts/$postId/' - >() - - expectTypeOf( - useParams, - ).returns.toEqualTypeOf<{ postId: string }>() -}) - -test('when using useRouteContext from a route', () => { - expectTypeOf(useRouteContext) - .parameter(0) - .toHaveProperty('from') - .toEqualTypeOf< - | '__root__' - | '/' - | '/blog' - | '/blog/' - | '/posts' - | '/blog/$blogId' - | '/blog/$blogId/edit' - | '/blog/$blogId/$slug' - | '/blog/$blogId/$slug/bar' - | '/blog/$slug' - | '/blog/stats' - | '/posts/' - | '/posts/$postId/deep' - | '/posts/$postId/' - >() - - expectTypeOf( - useRouteContext, - ).returns.toEqualTypeOf<{ someContext: string }>() -}) diff --git a/packages/router-generator/tests/generator/nested-verboseFileRoutes-true/routeTree.nonnested.snapshot.ts b/packages/router-generator/tests/generator/nested-verboseFileRoutes-true/routeTree.nonnested.snapshot.ts deleted file mode 100644 index 5760ba59b43..00000000000 --- a/packages/router-generator/tests/generator/nested-verboseFileRoutes-true/routeTree.nonnested.snapshot.ts +++ /dev/null @@ -1,341 +0,0 @@ -/* eslint-disable */ - -// @ts-nocheck - -// noinspection JSUnusedGlobalSymbols - -// This file was automatically generated by TanStack Router. -// You should NOT make any changes in this file as it will be overwritten. -// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified. - -import { Route as rootRouteImport } from './routes/__root' -import { Route as PostsRouteRouteImport } from './routes/posts/route' -import { Route as BlogRouteRouteImport } from './routes/blog/route' -import { Route as IndexRouteImport } from './routes/index' -import { Route as PostsIndexRouteImport } from './routes/posts/index' -import { Route as BlogIndexRouteImport } from './routes/blog/index' -import { Route as BlogStatsRouteImport } from './routes/blog_/stats' -import { Route as BlogSlugRouteImport } from './routes/blog/$slug' -import { Route as BlogBlogIdRouteRouteImport } from './routes/blog_/$blogId/route' -import { Route as PostsPostIdIndexRouteImport } from './routes/posts/$postId/index' -import { Route as PostsPostIdDeepRouteImport } from './routes/posts/$postId/deep' -import { Route as BlogBlogIdEditRouteImport } from './routes/blog_/$blogId_/edit' -import { Route as BlogBlogIdSlugRouteRouteImport } from './routes/blog_/$blogId/$slug/route' -import { Route as BlogBlogIdSlugBarRouteImport } from './routes/blog_/$blogId/$slug_/bar' - -const PostsRouteRoute = PostsRouteRouteImport.update({ - id: '/posts', - path: '/posts', - getParentRoute: () => rootRouteImport, -} as any) -const BlogRouteRoute = BlogRouteRouteImport.update({ - id: '/blog', - path: '/blog', - getParentRoute: () => rootRouteImport, -} as any) -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const PostsIndexRoute = PostsIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => PostsRouteRoute, -} as any) -const BlogIndexRoute = BlogIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => BlogRouteRoute, -} as any) -const BlogStatsRoute = BlogStatsRouteImport.update({ - id: '/blog/stats', - path: '/blog/stats', - getParentRoute: () => rootRouteImport, -} as any) -const BlogSlugRoute = BlogSlugRouteImport.update({ - id: '/$slug', - path: '/$slug', - getParentRoute: () => BlogRouteRoute, -} as any) -const BlogBlogIdRouteRoute = BlogBlogIdRouteRouteImport.update({ - id: '/blog/$blogId', - path: '/blog/$blogId', - getParentRoute: () => rootRouteImport, -} as any) -const PostsPostIdIndexRoute = PostsPostIdIndexRouteImport.update({ - id: '/$postId/', - path: '/$postId/', - getParentRoute: () => PostsRouteRoute, -} as any) -const PostsPostIdDeepRoute = PostsPostIdDeepRouteImport.update({ - id: '/$postId/deep', - path: '/$postId/deep', - getParentRoute: () => PostsRouteRoute, -} as any) -const BlogBlogIdEditRoute = BlogBlogIdEditRouteImport.update({ - id: '/blog/$blogId/edit', - path: '/blog/$blogId/edit', - getParentRoute: () => rootRouteImport, -} as any) -const BlogBlogIdSlugRouteRoute = BlogBlogIdSlugRouteRouteImport.update({ - id: '/$slug', - path: '/$slug', - getParentRoute: () => BlogBlogIdRouteRoute, -} as any) -const BlogBlogIdSlugBarRoute = BlogBlogIdSlugBarRouteImport.update({ - id: '/$slug/bar', - path: '/$slug/bar', - getParentRoute: () => BlogBlogIdRouteRoute, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/blog': typeof BlogRouteRouteWithChildren - '/posts': typeof PostsRouteRouteWithChildren - '/blog/$blogId': typeof BlogBlogIdRouteRouteWithChildren - '/blog/$slug': typeof BlogSlugRoute - '/blog/stats': typeof BlogStatsRoute - '/blog/': typeof BlogIndexRoute - '/posts/': typeof PostsIndexRoute - '/blog/$blogId/$slug': typeof BlogBlogIdSlugRouteRoute - '/blog/$blogId/edit': typeof BlogBlogIdEditRoute - '/posts/$postId/deep': typeof PostsPostIdDeepRoute - '/posts/$postId': typeof PostsPostIdIndexRoute - '/blog/$blogId/$slug/bar': typeof BlogBlogIdSlugBarRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/blog/$blogId': typeof BlogBlogIdRouteRouteWithChildren - '/blog/$slug': typeof BlogSlugRoute - '/blog/stats': typeof BlogStatsRoute - '/blog': typeof BlogIndexRoute - '/posts': typeof PostsIndexRoute - '/blog/$blogId/$slug': typeof BlogBlogIdSlugRouteRoute - '/blog/$blogId/edit': typeof BlogBlogIdEditRoute - '/posts/$postId/deep': typeof PostsPostIdDeepRoute - '/posts/$postId': typeof PostsPostIdIndexRoute - '/blog/$blogId/$slug/bar': typeof BlogBlogIdSlugBarRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/blog': typeof BlogRouteRouteWithChildren - '/posts': typeof PostsRouteRouteWithChildren - '/blog/$blogId': typeof BlogBlogIdRouteRouteWithChildren - '/blog/$slug': typeof BlogSlugRoute - '/blog/stats': typeof BlogStatsRoute - '/blog/': typeof BlogIndexRoute - '/posts/': typeof PostsIndexRoute - '/blog/$blogId/$slug': typeof BlogBlogIdSlugRouteRoute - '/blog/$blogId/edit': typeof BlogBlogIdEditRoute - '/posts/$postId/deep': typeof PostsPostIdDeepRoute - '/posts/$postId/': typeof PostsPostIdIndexRoute - '/blog/$blogId/$slug/bar': typeof BlogBlogIdSlugBarRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: - | '/' - | '/blog' - | '/posts' - | '/blog/$blogId' - | '/blog/$slug' - | '/blog/stats' - | '/blog/' - | '/posts/' - | '/blog/$blogId/$slug' - | '/blog/$blogId/edit' - | '/posts/$postId/deep' - | '/posts/$postId' - | '/blog/$blogId/$slug/bar' - fileRoutesByTo: FileRoutesByTo - to: - | '/' - | '/blog/$blogId' - | '/blog/$slug' - | '/blog/stats' - | '/blog' - | '/posts' - | '/blog/$blogId/$slug' - | '/blog/$blogId/edit' - | '/posts/$postId/deep' - | '/posts/$postId' - | '/blog/$blogId/$slug/bar' - id: - | '__root__' - | '/' - | '/blog' - | '/posts' - | '/blog/$blogId' - | '/blog/$slug' - | '/blog/stats' - | '/blog/' - | '/posts/' - | '/blog/$blogId/$slug' - | '/blog/$blogId/edit' - | '/posts/$postId/deep' - | '/posts/$postId/' - | '/blog/$blogId/$slug/bar' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - BlogRouteRoute: typeof BlogRouteRouteWithChildren - PostsRouteRoute: typeof PostsRouteRouteWithChildren - BlogBlogIdRouteRoute: typeof BlogBlogIdRouteRouteWithChildren - BlogStatsRoute: typeof BlogStatsRoute - BlogBlogIdEditRoute: typeof BlogBlogIdEditRoute -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/posts': { - id: '/posts' - path: '/posts' - fullPath: '/posts' - preLoaderRoute: typeof PostsRouteRouteImport - parentRoute: typeof rootRouteImport - } - '/blog': { - id: '/blog' - path: '/blog' - fullPath: '/blog' - preLoaderRoute: typeof BlogRouteRouteImport - parentRoute: typeof rootRouteImport - } - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/posts/': { - id: '/posts/' - path: '/' - fullPath: '/posts/' - preLoaderRoute: typeof PostsIndexRouteImport - parentRoute: typeof PostsRouteRoute - } - '/blog/': { - id: '/blog/' - path: '/' - fullPath: '/blog/' - preLoaderRoute: typeof BlogIndexRouteImport - parentRoute: typeof BlogRouteRoute - } - '/blog/stats': { - id: '/blog/stats' - path: '/blog/stats' - fullPath: '/blog/stats' - preLoaderRoute: typeof BlogStatsRouteImport - parentRoute: typeof rootRouteImport - } - '/blog/$slug': { - id: '/blog/$slug' - path: '/$slug' - fullPath: '/blog/$slug' - preLoaderRoute: typeof BlogSlugRouteImport - parentRoute: typeof BlogRouteRoute - } - '/blog/$blogId': { - id: '/blog/$blogId' - path: '/blog/$blogId' - fullPath: '/blog/$blogId' - preLoaderRoute: typeof BlogBlogIdRouteRouteImport - parentRoute: typeof rootRouteImport - } - '/posts/$postId/': { - id: '/posts/$postId/' - path: '/$postId' - fullPath: '/posts/$postId' - preLoaderRoute: typeof PostsPostIdIndexRouteImport - parentRoute: typeof PostsRouteRoute - } - '/posts/$postId/deep': { - id: '/posts/$postId/deep' - path: '/$postId/deep' - fullPath: '/posts/$postId/deep' - preLoaderRoute: typeof PostsPostIdDeepRouteImport - parentRoute: typeof PostsRouteRoute - } - '/blog/$blogId/edit': { - id: '/blog/$blogId/edit' - path: '/blog/$blogId/edit' - fullPath: '/blog/$blogId/edit' - preLoaderRoute: typeof BlogBlogIdEditRouteImport - parentRoute: typeof rootRouteImport - } - '/blog/$blogId/$slug': { - id: '/blog/$blogId/$slug' - path: '/$slug' - fullPath: '/blog/$blogId/$slug' - preLoaderRoute: typeof BlogBlogIdSlugRouteRouteImport - parentRoute: typeof BlogBlogIdRouteRoute - } - '/blog/$blogId/$slug/bar': { - id: '/blog/$blogId/$slug/bar' - path: '/$slug/bar' - fullPath: '/blog/$blogId/$slug/bar' - preLoaderRoute: typeof BlogBlogIdSlugBarRouteImport - parentRoute: typeof BlogBlogIdRouteRoute - } - } -} - -interface BlogRouteRouteChildren { - BlogSlugRoute: typeof BlogSlugRoute - BlogIndexRoute: typeof BlogIndexRoute -} - -const BlogRouteRouteChildren: BlogRouteRouteChildren = { - BlogSlugRoute: BlogSlugRoute, - BlogIndexRoute: BlogIndexRoute, -} - -const BlogRouteRouteWithChildren = BlogRouteRoute._addFileChildren( - BlogRouteRouteChildren, -) - -interface PostsRouteRouteChildren { - PostsIndexRoute: typeof PostsIndexRoute - PostsPostIdDeepRoute: typeof PostsPostIdDeepRoute - PostsPostIdIndexRoute: typeof PostsPostIdIndexRoute -} - -const PostsRouteRouteChildren: PostsRouteRouteChildren = { - PostsIndexRoute: PostsIndexRoute, - PostsPostIdDeepRoute: PostsPostIdDeepRoute, - PostsPostIdIndexRoute: PostsPostIdIndexRoute, -} - -const PostsRouteRouteWithChildren = PostsRouteRoute._addFileChildren( - PostsRouteRouteChildren, -) - -interface BlogBlogIdRouteRouteChildren { - BlogBlogIdSlugRouteRoute: typeof BlogBlogIdSlugRouteRoute - BlogBlogIdSlugBarRoute: typeof BlogBlogIdSlugBarRoute -} - -const BlogBlogIdRouteRouteChildren: BlogBlogIdRouteRouteChildren = { - BlogBlogIdSlugRouteRoute: BlogBlogIdSlugRouteRoute, - BlogBlogIdSlugBarRoute: BlogBlogIdSlugBarRoute, -} - -const BlogBlogIdRouteRouteWithChildren = BlogBlogIdRouteRoute._addFileChildren( - BlogBlogIdRouteRouteChildren, -) - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - BlogRouteRoute: BlogRouteRouteWithChildren, - PostsRouteRoute: PostsRouteRouteWithChildren, - BlogBlogIdRouteRoute: BlogBlogIdRouteRouteWithChildren, - BlogStatsRoute: BlogStatsRoute, - BlogBlogIdEditRoute: BlogBlogIdEditRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/packages/router-generator/tests/generator/nested-verboseFileRoutes-true/tests.nonnested.test-d.ts b/packages/router-generator/tests/generator/nested-verboseFileRoutes-true/tests.nonnested.test-d.ts deleted file mode 100644 index 5ef92510c05..00000000000 --- a/packages/router-generator/tests/generator/nested-verboseFileRoutes-true/tests.nonnested.test-d.ts +++ /dev/null @@ -1,619 +0,0 @@ -import { - Link, - createRouter, - redirect, - useLoaderData, - useLoaderDeps, - useMatch, - useNavigate, - useParams, - useRouteContext, - useSearch, -} from '@tanstack/react-router' -import { expectTypeOf, test } from 'vitest' -import { routeTree } from './routeTree.nonnested.gen' -import type { MakeRouteMatch } from '@tanstack/react-router' - -const defaultRouter = createRouter({ - routeTree, -}) - -type DefaultRouter = typeof defaultRouter - -const alwaysTrailingSlashRouter = createRouter({ - routeTree, - trailingSlash: 'always', -}) - -const neverTrailingSlashRouter = createRouter({ - routeTree, - trailingSlash: 'never', -}) - -const preserveTrailingSlashRouter = createRouter({ - routeTree, - trailingSlash: 'preserve', -}) - -test('when navigating to the root', () => { - expectTypeOf(Link) - .parameter(0) - .toHaveProperty('to') - .toEqualTypeOf< - | '/' - | '/blog' - | '/posts' - | '/blog/$blogId' - | '/blog/$blogId/edit' - | '/blog/$blogId/$slug' - | '/blog/$blogId/$slug/bar' - | '/blog/$slug' - | '/blog/stats' - | '/posts/$postId/deep' - | '/posts/$postId' - | undefined - >() - - expectTypeOf(Link) - .parameter(0) - .toHaveProperty('to') - .toEqualTypeOf< - | '/' - | '/blog/' - | '/posts/' - | '/blog/$blogId/' - | '/blog/$blogId/edit/' - | '/blog/$blogId/$slug/' - | '/blog/$blogId/$slug/bar/' - | '/blog/$slug/' - | '/blog/stats/' - | '/posts/$postId/deep/' - | '/posts/$postId/' - | undefined - >() - - expectTypeOf(Link) - .parameter(0) - .toHaveProperty('to') - .toEqualTypeOf< - | '/' - | '/blog' - | '/posts' - | '/blog/$blogId' - | '/blog/$blogId/edit' - | '/blog/$blogId/$slug' - | '/blog/$blogId/$slug/bar' - | '/blog/$slug' - | '/blog/stats' - | '/posts/$postId/deep' - | '/posts/$postId' - | undefined - >() - - expectTypeOf(Link) - .parameter(0) - .toHaveProperty('to') - .toEqualTypeOf< - | '/' - | '/blog' - | '/posts' - | '/blog/$blogId' - | '/blog/$blogId/edit' - | '/blog/$blogId/$slug' - | '/blog/$blogId/$slug/bar' - | '/blog/$slug' - | '/blog/stats' - | '/posts/$postId/deep' - | '/posts/$postId' - | '/blog/' - | '/posts/' - | '/blog/$blogId/' - | '/blog/$blogId/edit/' - | '/blog/$blogId/$slug/' - | '/blog/$blogId/$slug/bar/' - | '/blog/$slug/' - | '/blog/stats/' - | '/posts/$postId/deep/' - | '/posts/$postId/' - | undefined - >() - - expectTypeOf(Link) - .parameter(0) - .toHaveProperty('from') - .toEqualTypeOf< - | '/' - | '/blog' - | '/posts' - | '/blog/$blogId' - | '/blog/$blogId/edit' - | '/blog/$blogId/$slug' - | '/blog/$blogId/$slug/bar' - | '/blog/$slug' - | '/blog/stats' - | '/blog/' - | '/posts/' - | '/posts/$postId/deep' - | '/posts/$postId' - | undefined - >() - - expectTypeOf(Link) - .parameter(0) - .toHaveProperty('search') - .exclude<(...args: any) => any>() - .toEqualTypeOf() - - expectTypeOf(Link) - .parameter(0) - .toHaveProperty('search') - .exclude<(...args: any) => any>() - .toEqualTypeOf() - - expectTypeOf(Link) - .parameter(0) - .toHaveProperty('search') - .exclude<(...args: any) => any>() - .toEqualTypeOf() - - expectTypeOf(Link) - .parameter(0) - .toHaveProperty('search') - .exclude<(...args: any) => any>() - .toEqualTypeOf() -}) - -test('when navigating a index route with search and params', () => { - expectTypeOf(Link) - .parameter(0) - .toHaveProperty('to') - .toEqualTypeOf< - | '.' - | '..' - | '/' - | '/blog' - | '/posts' - | '/blog/$blogId' - | '/blog/$blogId/edit' - | '/blog/$blogId/$slug' - | '/blog/$blogId/$slug/bar' - | '/blog/$slug' - | '/blog/stats' - | '/posts/$postId/deep' - | '/posts/$postId' - >() - - expectTypeOf( - Link, - ) - .parameter(0) - .toHaveProperty('to') - .toEqualTypeOf< - | './' - | '../' - | '/' - | '/blog/' - | '/posts/' - | '/blog/$blogId/' - | '/blog/$blogId/edit/' - | '/blog/$blogId/$slug/' - | '/blog/$blogId/$slug/bar/' - | '/blog/$slug/' - | '/blog/stats/' - | '/posts/$postId/deep/' - | '/posts/$postId/' - >() - - expectTypeOf(Link) - .parameter(0) - .toHaveProperty('to') - .toEqualTypeOf< - | '/' - | '/blog' - | '/posts' - | '/blog/$blogId' - | '/blog/$blogId/edit' - | '/blog/$blogId/$slug' - | '/blog/$blogId/$slug/bar' - | '/blog/$slug' - | '/blog/stats' - | '/posts/$postId/deep' - | '/posts/$postId' - | '.' - | '..' - >() - - expectTypeOf( - Link, - ) - .parameter(0) - .toHaveProperty('to') - .toEqualTypeOf< - | '..' - | '../' - | '.' - | './' - | '/' - | '/blog' - | '/posts' - | '/blog/$blogId' - | '/blog/$blogId/edit' - | '/blog/$blogId/$slug' - | '/blog/$blogId/$slug/bar' - | '/blog/$slug' - | '/blog/stats' - | '/posts/$postId/deep' - | '/posts/$postId' - | '/blog/' - | '/posts/' - | '/blog/$blogId/' - | '/blog/$blogId/edit/' - | '/blog/$blogId/$slug/' - | '/blog/$blogId/$slug/bar/' - | '/blog/$slug/' - | '/blog/stats/' - | '/posts/$postId/deep/' - | '/posts/$postId/' - >() - - expectTypeOf(Link) - .parameter(0) - .toHaveProperty('from') - .toEqualTypeOf< - | '/' - | '/posts/$postId' - | '/blog' - | '/posts' - | '/blog/$blogId' - | '/blog/$blogId/edit' - | '/blog/$blogId/$slug' - | '/blog/$blogId/$slug/bar' - | '/blog/$slug' - | '/blog/stats' - | '/blog/' - | '/posts/' - | '/posts/$postId/deep' - | undefined - >() - - expectTypeOf(Link) - .parameter(0) - .toHaveProperty('search') - .exclude<(...args: any) => any>() - .toEqualTypeOf<{ indexSearch: string }>() - - expectTypeOf(Link) - .parameter(0) - .toHaveProperty('search') - .exclude<(...args: any) => any>() - .toEqualTypeOf() - - expectTypeOf( - Link, - ) - .parameter(0) - .toHaveProperty('search') - .exclude<(...args: any) => any>() - .toEqualTypeOf<{ indexSearch: string }>() - - expectTypeOf(Link) - .parameter(0) - .toHaveProperty('search') - .exclude<(...args: any) => any>() - .toEqualTypeOf() - - expectTypeOf(Link) - .parameter(0) - .toHaveProperty('search') - .exclude<(...args: any) => any>() - .toEqualTypeOf<{ indexSearch: string }>() - - expectTypeOf(Link) - .parameter(0) - .toHaveProperty('search') - .exclude<(...args: any) => any>() - .toEqualTypeOf<{ indexSearch: string }>() - - expectTypeOf(Link) - .parameter(0) - .toHaveProperty('search') - .exclude<(...args: any) => any>() - .toEqualTypeOf<{ indexSearch: string }>() - - expectTypeOf(Link) - .parameter(0) - .toHaveProperty('params') - .exclude<(...args: any) => any>() - .toEqualTypeOf<{ postId: string }>() - - expectTypeOf(Link) - .parameter(0) - .toHaveProperty('params') - .exclude<(...args: any) => any>() - .toEqualTypeOf() - - expectTypeOf( - Link, - ) - .parameter(0) - .toHaveProperty('params') - .exclude<(...args: any) => any>() - .toEqualTypeOf<{ postId: string }>() - - expectTypeOf(Link) - .parameter(0) - .toHaveProperty('params') - .exclude<(...args: any) => any>() - .toEqualTypeOf() - - expectTypeOf(Link) - .parameter(0) - .toHaveProperty('params') - .exclude<(...args: any) => any>() - .toEqualTypeOf<{ postId: string }>() - - expectTypeOf(Link) - .parameter(0) - .toHaveProperty('params') - .exclude<(...args: any) => any>() - .toEqualTypeOf<{ postId: string }>() - - expectTypeOf(Link) - .parameter(0) - .toHaveProperty('params') - .exclude<(...args: any) => any>() - .toEqualTypeOf<{ postId: string }>() -}) - -test('when navigating from a index route with search and params', () => { - expectTypeOf(Link) - .parameter(0) - .toHaveProperty('from') - .toEqualTypeOf< - | '/' - | '/posts/$postId' - | '/blog' - | '/posts' - | '/blog/$blogId' - | '/blog/$blogId/edit' - | '/blog/$blogId/$slug' - | '/blog/$blogId/$slug/bar' - | '/blog/$slug' - | '/blog/stats' - | '/blog/' - | '/posts/' - | '/posts/$postId/deep' - | undefined - >() - - expectTypeOf(Link) - .parameter(0) - .toHaveProperty('search') - .parameter(0) - .toEqualTypeOf<{ indexSearch: string }>() -}) - -test('when using useNavigate', () => { - const navigate = useNavigate() - - expectTypeOf(navigate) - .parameter(0) - .toHaveProperty('to') - .toEqualTypeOf< - | '/' - | '.' - | '..' - | '/blog' - | '/posts' - | '/blog/$blogId' - | '/blog/$blogId/edit' - | '/blog/$blogId/$slug' - | '/blog/$blogId/$slug/bar' - | '/blog/$slug' - | '/blog/stats' - | '/posts/$postId/deep' - | '/posts/$postId' - >() -}) - -test('when using redirect', () => { - expectTypeOf(redirect) - .parameter(0) - .toHaveProperty('to') - .toEqualTypeOf< - | '/' - | '/posts/$postId' - | '/blog' - | '/posts' - | '/blog/$blogId' - | '/blog/$blogId/edit' - | '/blog/$blogId/$slug' - | '/blog/$blogId/$slug/bar' - | '/blog/$slug' - | '/blog/stats' - | '/posts/$postId/deep' - | undefined - >() -}) - -test('when using useSearch from a route with no search', () => { - expectTypeOf(useSearch) - .parameter(0) - .toHaveProperty('from') - .toEqualTypeOf< - | '__root__' - | '/' - | '/blog' - | '/posts' - | '/blog/$blogId' - | '/blog/$blogId/edit' - | '/blog/$blogId/$slug' - | '/blog/$blogId/$slug/bar' - | '/blog/$slug' - | '/blog/stats' - | '/blog/' - | '/posts/' - | '/posts/$postId/deep' - | '/posts/$postId/' - >() - - expectTypeOf(useSearch).returns.toEqualTypeOf<{}>() -}) - -test('when using useSearch from a route with search', () => { - expectTypeOf(useSearch) - .parameter(0) - .toHaveProperty('from') - .toEqualTypeOf< - | '__root__' - | '/' - | '/blog' - | '/posts' - | '/blog/$blogId' - | '/blog/$blogId/edit' - | '/blog/$blogId/$slug' - | '/blog/$blogId/$slug/bar' - | '/blog/$slug' - | '/blog/stats' - | '/blog/' - | '/posts/' - | '/posts/$postId/deep' - | '/posts/$postId/' - >() - - expectTypeOf( - useSearch, - ).returns.toEqualTypeOf<{ indexSearch: string }>() -}) - -test('when using useLoaderData from a route with loaderData', () => { - expectTypeOf(useLoaderData) - .parameter(0) - .toHaveProperty('from') - .toEqualTypeOf< - | '__root__' - | '/' - | '/blog' - | '/posts' - | '/blog/$blogId' - | '/blog/$blogId/edit' - | '/blog/$blogId/$slug' - | '/blog/$blogId/$slug/bar' - | '/blog/$slug' - | '/blog/stats' - | '/blog/' - | '/posts/' - | '/posts/$postId/deep' - | '/posts/$postId/' - >() - - expectTypeOf( - useLoaderData, - ).returns.toEqualTypeOf<{ data: string }>() -}) - -test('when using useLoaderDeps from a route with loaderDeps', () => { - expectTypeOf(useLoaderDeps) - .parameter(0) - .toHaveProperty('from') - .toEqualTypeOf< - | '__root__' - | '/' - | '/blog' - | '/posts' - | '/blog/$blogId' - | '/blog/$blogId/edit' - | '/blog/$blogId/$slug' - | '/blog/$blogId/$slug/bar' - | '/blog/$slug' - | '/blog/stats' - | '/blog/' - | '/posts/' - | '/posts/$postId/deep' - | '/posts/$postId/' - >() - - expectTypeOf( - useLoaderDeps, - ).returns.toEqualTypeOf<{ dep: number }>() -}) - -test('when using useMatch from a route', () => { - expectTypeOf(useMatch) - .parameter(0) - .toHaveProperty('from') - .toEqualTypeOf< - | '__root__' - | '/' - | '/blog' - | '/posts' - | '/blog/$blogId' - | '/blog/$blogId/edit' - | '/blog/$blogId/$slug' - | '/blog/$blogId/$slug/bar' - | '/blog/$slug' - | '/blog/stats' - | '/blog/' - | '/posts/' - | '/posts/$postId/deep' - | '/posts/$postId/' - >() - - expectTypeOf( - useMatch, - ).returns.toEqualTypeOf< - MakeRouteMatch - >() -}) - -test('when using useParams from a route', () => { - expectTypeOf(useParams) - .parameter(0) - .toHaveProperty('from') - .toEqualTypeOf< - | '__root__' - | '/' - | '/blog' - | '/posts' - | '/blog/$blogId' - | '/blog/$blogId/edit' - | '/blog/$blogId/$slug' - | '/blog/$blogId/$slug/bar' - | '/blog/$slug' - | '/blog/stats' - | '/blog/' - | '/posts/' - | '/posts/$postId/deep' - | '/posts/$postId/' - >() - - expectTypeOf( - useParams, - ).returns.toEqualTypeOf<{ postId: string }>() -}) - -test('when using useRouteContext from a route', () => { - expectTypeOf(useRouteContext) - .parameter(0) - .toHaveProperty('from') - .toEqualTypeOf< - | '__root__' - | '/' - | '/blog' - | '/posts' - | '/blog/$blogId' - | '/blog/$blogId/edit' - | '/blog/$blogId/$slug' - | '/blog/$blogId/$slug/bar' - | '/blog/$slug' - | '/blog/stats' - | '/blog/' - | '/posts/' - | '/posts/$postId/deep' - | '/posts/$postId/' - >() - - expectTypeOf( - useRouteContext, - ).returns.toEqualTypeOf<{ someContext: string }>() -}) diff --git a/packages/router-generator/tests/generator/no-duplicate-route-segment/routeTree.nonnested.snapshot.ts b/packages/router-generator/tests/generator/no-duplicate-route-segment/routeTree.nonnested.snapshot.ts deleted file mode 100644 index 9eea11a3f04..00000000000 --- a/packages/router-generator/tests/generator/no-duplicate-route-segment/routeTree.nonnested.snapshot.ts +++ /dev/null @@ -1,86 +0,0 @@ -/* eslint-disable */ - -// @ts-nocheck - -// noinspection JSUnusedGlobalSymbols - -// This file was automatically generated by TanStack Router. -// You should NOT make any changes in this file as it will be overwritten. -// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified. - -import { Route as rootRouteImport } from './routes/__root' -import { Route as FooLayoutRouteRouteImport } from './routes/foo/_layout/route' -import { Route as FooLayoutIndexRouteImport } from './routes/foo/_layout/index' - -const FooLayoutRouteRoute = FooLayoutRouteRouteImport.update({ - id: '/foo/_layout', - path: '/foo', - getParentRoute: () => rootRouteImport, -} as any) -const FooLayoutIndexRoute = FooLayoutIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => FooLayoutRouteRoute, -} as any) - -export interface FileRoutesByFullPath { - '/foo': typeof FooLayoutRouteRouteWithChildren - '/foo/': typeof FooLayoutIndexRoute -} -export interface FileRoutesByTo { - '/foo': typeof FooLayoutIndexRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/foo/_layout': typeof FooLayoutRouteRouteWithChildren - '/foo/_layout/': typeof FooLayoutIndexRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/foo' | '/foo/' - fileRoutesByTo: FileRoutesByTo - to: '/foo' - id: '__root__' | '/foo/_layout' | '/foo/_layout/' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - FooLayoutRouteRoute: typeof FooLayoutRouteRouteWithChildren -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/foo/_layout': { - id: '/foo/_layout' - path: '/foo' - fullPath: '/foo' - preLoaderRoute: typeof FooLayoutRouteRouteImport - parentRoute: typeof rootRouteImport - } - '/foo/_layout/': { - id: '/foo/_layout/' - path: '/' - fullPath: '/foo/' - preLoaderRoute: typeof FooLayoutIndexRouteImport - parentRoute: typeof FooLayoutRouteRoute - } - } -} - -interface FooLayoutRouteRouteChildren { - FooLayoutIndexRoute: typeof FooLayoutIndexRoute -} - -const FooLayoutRouteRouteChildren: FooLayoutRouteRouteChildren = { - FooLayoutIndexRoute: FooLayoutIndexRoute, -} - -const FooLayoutRouteRouteWithChildren = FooLayoutRouteRoute._addFileChildren( - FooLayoutRouteRouteChildren, -) - -const rootRouteChildren: RootRouteChildren = { - FooLayoutRouteRoute: FooLayoutRouteRouteWithChildren, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/packages/router-generator/tests/generator/no-formatted-route-tree/routeTree.nonnested.snapshot.ts b/packages/router-generator/tests/generator/no-formatted-route-tree/routeTree.nonnested.snapshot.ts deleted file mode 100644 index e4f872ce3a9..00000000000 --- a/packages/router-generator/tests/generator/no-formatted-route-tree/routeTree.nonnested.snapshot.ts +++ /dev/null @@ -1,77 +0,0 @@ -/* eslint-disable */ - -// @ts-nocheck - -// noinspection JSUnusedGlobalSymbols - -// This file was automatically generated by TanStack Router. -// You should NOT make any changes in this file as it will be overwritten. -// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified. - -import { Route as rootRouteImport } from './routes/__root' -import { Route as IndexRouteImport } from './routes/index' -import { Route as NestedIndexRouteImport } from './routes/nested/index' -import { Route as NestedChildRouteImport } from './routes/nested/child' - -const IndexRoute = IndexRouteImport.update({ - id: '/',path: '/',getParentRoute: () => rootRouteImport - }as any) -const NestedIndexRoute = NestedIndexRouteImport.update({ - id: '/nested/',path: '/nested/',getParentRoute: () => rootRouteImport - }as any) -const NestedChildRoute = NestedChildRouteImport.update({ - id: '/nested/child',path: '/nested/child',getParentRoute: () => rootRouteImport - }as any) - -export interface FileRoutesByFullPath { -'/': typeof IndexRoute,'/nested/child': typeof NestedChildRoute,'/nested': typeof NestedIndexRoute -} -export interface FileRoutesByTo { -'/': typeof IndexRoute,'/nested/child': typeof NestedChildRoute,'/nested': typeof NestedIndexRoute -} -export interface FileRoutesById { -'__root__': typeof rootRouteImport, -'/': typeof IndexRoute,'/nested/child': typeof NestedChildRoute,'/nested/': typeof NestedIndexRoute -} -export interface FileRouteTypes { -fileRoutesByFullPath: FileRoutesByFullPath -fullPaths: '/'|'/nested/child'|'/nested' -fileRoutesByTo: FileRoutesByTo -to: '/'|'/nested/child'|'/nested' -id: '__root__'|'/'|'/nested/child'|'/nested/' -fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { -IndexRoute: typeof IndexRoute,NestedChildRoute: typeof NestedChildRoute,NestedIndexRoute: typeof NestedIndexRoute -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } -'/nested/': { - id: '/nested/' - path: '/nested' - fullPath: '/nested' - preLoaderRoute: typeof NestedIndexRouteImport - parentRoute: typeof rootRouteImport - } -'/nested/child': { - id: '/nested/child' - path: '/nested/child' - fullPath: '/nested/child' - preLoaderRoute: typeof NestedChildRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute,NestedChildRoute: NestedChildRoute,NestedIndexRoute: NestedIndexRoute -} -export const routeTree = rootRouteImport._addFileChildren(rootRouteChildren)._addFileTypes() \ No newline at end of file diff --git a/packages/router-generator/tests/generator/numbers-in-path/routeTree.nonnested.snapshot.ts b/packages/router-generator/tests/generator/numbers-in-path/routeTree.nonnested.snapshot.ts deleted file mode 100644 index 754b730b7ae..00000000000 --- a/packages/router-generator/tests/generator/numbers-in-path/routeTree.nonnested.snapshot.ts +++ /dev/null @@ -1,131 +0,0 @@ -/* eslint-disable */ - -// @ts-nocheck - -// noinspection JSUnusedGlobalSymbols - -// This file was automatically generated by TanStack Router. -// You should NOT make any changes in this file as it will be overwritten. -// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified. - -import { Route as rootRouteImport } from './routes/__root' -import { Route as AboutRouteImport } from './routes/about' -import { Route as R03RouteImport } from './routes/03' -import { Route as IndexRouteImport } from './routes/index' -import { Route as R02IndexRouteImport } from './routes/02.index' -import { Route as R01ExampleIndexRouteImport } from './routes/01-example/index' - -const AboutRoute = AboutRouteImport.update({ - id: '/about', - path: '/about', - getParentRoute: () => rootRouteImport, -} as any) -const R03Route = R03RouteImport.update({ - id: '/03', - path: '/03', - getParentRoute: () => rootRouteImport, -} as any) -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const R02IndexRoute = R02IndexRouteImport.update({ - id: '/02/', - path: '/02/', - getParentRoute: () => rootRouteImport, -} as any) -const R01ExampleIndexRoute = R01ExampleIndexRouteImport.update({ - id: '/01-example/', - path: '/01-example/', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/03': typeof R03Route - '/about': typeof AboutRoute - '/01-example': typeof R01ExampleIndexRoute - '/02': typeof R02IndexRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/03': typeof R03Route - '/about': typeof AboutRoute - '/01-example': typeof R01ExampleIndexRoute - '/02': typeof R02IndexRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/03': typeof R03Route - '/about': typeof AboutRoute - '/01-example/': typeof R01ExampleIndexRoute - '/02/': typeof R02IndexRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/03' | '/about' | '/01-example' | '/02' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/03' | '/about' | '/01-example' | '/02' - id: '__root__' | '/' | '/03' | '/about' | '/01-example/' | '/02/' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - R03Route: typeof R03Route - AboutRoute: typeof AboutRoute - R01ExampleIndexRoute: typeof R01ExampleIndexRoute - R02IndexRoute: typeof R02IndexRoute -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/about': { - id: '/about' - path: '/about' - fullPath: '/about' - preLoaderRoute: typeof AboutRouteImport - parentRoute: typeof rootRouteImport - } - '/03': { - id: '/03' - path: '/03' - fullPath: '/03' - preLoaderRoute: typeof R03RouteImport - parentRoute: typeof rootRouteImport - } - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/02/': { - id: '/02/' - path: '/02' - fullPath: '/02' - preLoaderRoute: typeof R02IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/01-example/': { - id: '/01-example/' - path: '/01-example' - fullPath: '/01-example' - preLoaderRoute: typeof R01ExampleIndexRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - R03Route: R03Route, - AboutRoute: AboutRoute, - R01ExampleIndexRoute: R01ExampleIndexRoute, - R02IndexRoute: R02IndexRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/packages/router-generator/tests/generator/only-root/routeTree.nonnested.generated.snapshot.ts b/packages/router-generator/tests/generator/only-root/routeTree.nonnested.generated.snapshot.ts deleted file mode 100644 index 7766df98323..00000000000 --- a/packages/router-generator/tests/generator/only-root/routeTree.nonnested.generated.snapshot.ts +++ /dev/null @@ -1,35 +0,0 @@ -/* eslint-disable */ - -// @ts-nocheck - -// noinspection JSUnusedGlobalSymbols - -// This file was automatically generated by TanStack Router. -// You should NOT make any changes in this file as it will be overwritten. -// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified. - -import { Route as rootRouteImport } from './../routes/__root' - -export interface FileRoutesByFullPath {} -export interface FileRoutesByTo {} -export interface FileRoutesById { - __root__: typeof rootRouteImport -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: never - fileRoutesByTo: FileRoutesByTo - to: never - id: '__root__' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren {} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath {} -} - -const rootRouteChildren: RootRouteChildren = {} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/packages/router-generator/tests/generator/only-root/routeTree.nonnested.snapshot.ts b/packages/router-generator/tests/generator/only-root/routeTree.nonnested.snapshot.ts deleted file mode 100644 index d9b0e2be238..00000000000 --- a/packages/router-generator/tests/generator/only-root/routeTree.nonnested.snapshot.ts +++ /dev/null @@ -1,35 +0,0 @@ -/* eslint-disable */ - -// @ts-nocheck - -// noinspection JSUnusedGlobalSymbols - -// This file was automatically generated by TanStack Router. -// You should NOT make any changes in this file as it will be overwritten. -// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified. - -import { Route as rootRouteImport } from './routes/__root' - -export interface FileRoutesByFullPath {} -export interface FileRoutesByTo {} -export interface FileRoutesById { - __root__: typeof rootRouteImport -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: never - fileRoutesByTo: FileRoutesByTo - to: never - id: '__root__' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren {} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath {} -} - -const rootRouteChildren: RootRouteChildren = {} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/packages/router-generator/tests/generator/path-above-route-in-group/routeTree.nonnested.snapshot.ts b/packages/router-generator/tests/generator/path-above-route-in-group/routeTree.nonnested.snapshot.ts deleted file mode 100644 index c937f95ba87..00000000000 --- a/packages/router-generator/tests/generator/path-above-route-in-group/routeTree.nonnested.snapshot.ts +++ /dev/null @@ -1,104 +0,0 @@ -/* eslint-disable */ - -// @ts-nocheck - -// noinspection JSUnusedGlobalSymbols - -// This file was automatically generated by TanStack Router. -// You should NOT make any changes in this file as it will be overwritten. -// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified. - -import { Route as rootRouteImport } from './routes/__root' -import { Route as ABcRouteRouteImport } from './routes/a/$b/(c)/route' -import { Route as ABcIndexRouteImport } from './routes/a/$b/(c)/index' -import { Route as ABcDEIndexRouteImport } from './routes/a/$b/(c)/d/e/index' - -const ABcRouteRoute = ABcRouteRouteImport.update({ - id: '/a/$b/(c)', - path: '/a/$b', - getParentRoute: () => rootRouteImport, -} as any) -const ABcIndexRoute = ABcIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => ABcRouteRoute, -} as any) -const ABcDEIndexRoute = ABcDEIndexRouteImport.update({ - id: '/d/e/', - path: '/d/e/', - getParentRoute: () => ABcRouteRoute, -} as any) - -export interface FileRoutesByFullPath { - '/a/$b': typeof ABcRouteRouteWithChildren - '/a/$b/': typeof ABcIndexRoute - '/a/$b/d/e': typeof ABcDEIndexRoute -} -export interface FileRoutesByTo { - '/a/$b': typeof ABcIndexRoute - '/a/$b/d/e': typeof ABcDEIndexRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/a/$b/(c)': typeof ABcRouteRouteWithChildren - '/a/$b/(c)/': typeof ABcIndexRoute - '/a/$b/(c)/d/e/': typeof ABcDEIndexRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/a/$b' | '/a/$b/' | '/a/$b/d/e' - fileRoutesByTo: FileRoutesByTo - to: '/a/$b' | '/a/$b/d/e' - id: '__root__' | '/a/$b/(c)' | '/a/$b/(c)/' | '/a/$b/(c)/d/e/' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - ABcRouteRoute: typeof ABcRouteRouteWithChildren -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/a/$b/(c)': { - id: '/a/$b/(c)' - path: '/a/$b' - fullPath: '/a/$b' - preLoaderRoute: typeof ABcRouteRouteImport - parentRoute: typeof rootRouteImport - } - '/a/$b/(c)/': { - id: '/a/$b/(c)/' - path: '/' - fullPath: '/a/$b/' - preLoaderRoute: typeof ABcIndexRouteImport - parentRoute: typeof ABcRouteRoute - } - '/a/$b/(c)/d/e/': { - id: '/a/$b/(c)/d/e/' - path: '/d/e' - fullPath: '/a/$b/d/e' - preLoaderRoute: typeof ABcDEIndexRouteImport - parentRoute: typeof ABcRouteRoute - } - } -} - -interface ABcRouteRouteChildren { - ABcIndexRoute: typeof ABcIndexRoute - ABcDEIndexRoute: typeof ABcDEIndexRoute -} - -const ABcRouteRouteChildren: ABcRouteRouteChildren = { - ABcIndexRoute: ABcIndexRoute, - ABcDEIndexRoute: ABcDEIndexRoute, -} - -const ABcRouteRouteWithChildren = ABcRouteRoute._addFileChildren( - ABcRouteRouteChildren, -) - -const rootRouteChildren: RootRouteChildren = { - ABcRouteRoute: ABcRouteRouteWithChildren, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/packages/router-generator/tests/generator/prefix-suffix/routeTree.nonnested.snapshot.ts b/packages/router-generator/tests/generator/prefix-suffix/routeTree.nonnested.snapshot.ts deleted file mode 100644 index 5f7f854d9f1..00000000000 --- a/packages/router-generator/tests/generator/prefix-suffix/routeTree.nonnested.snapshot.ts +++ /dev/null @@ -1,129 +0,0 @@ -/* eslint-disable */ - -// @ts-nocheck - -// noinspection JSUnusedGlobalSymbols - -// This file was automatically generated by TanStack Router. -// You should NOT make any changes in this file as it will be overwritten. -// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified. - -import { Route as rootRouteImport } from './routes/__root' -import { Route as WildcardChar123Char125suffixRouteImport } from './routes/wildcard/{$}suffix' -import { Route as WildcardChar123Char125DotsuffixRouteImport } from './routes/wildcard/{$}[.]suffix' -import { Route as WildcardPrefixChar123Char125RouteImport } from './routes/wildcard/prefix{$}' -import { Route as WildcardSplatRouteImport } from './routes/wildcard/$' - -const WildcardChar123Char125suffixRoute = - WildcardChar123Char125suffixRouteImport.update({ - id: '/wildcard/{$}suffix', - path: '/wildcard/{$}suffix', - getParentRoute: () => rootRouteImport, - } as any) -const WildcardChar123Char125DotsuffixRoute = - WildcardChar123Char125DotsuffixRouteImport.update({ - id: '/wildcard/{$}.suffix', - path: '/wildcard/{$}.suffix', - getParentRoute: () => rootRouteImport, - } as any) -const WildcardPrefixChar123Char125Route = - WildcardPrefixChar123Char125RouteImport.update({ - id: '/wildcard/prefix{$}', - path: '/wildcard/prefix{$}', - getParentRoute: () => rootRouteImport, - } as any) -const WildcardSplatRoute = WildcardSplatRouteImport.update({ - id: '/wildcard/$', - path: '/wildcard/$', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/wildcard/$': typeof WildcardSplatRoute - '/wildcard/prefix{$}': typeof WildcardPrefixChar123Char125Route - '/wildcard/{$}.suffix': typeof WildcardChar123Char125DotsuffixRoute - '/wildcard/{$}suffix': typeof WildcardChar123Char125suffixRoute -} -export interface FileRoutesByTo { - '/wildcard/$': typeof WildcardSplatRoute - '/wildcard/prefix{$}': typeof WildcardPrefixChar123Char125Route - '/wildcard/{$}.suffix': typeof WildcardChar123Char125DotsuffixRoute - '/wildcard/{$}suffix': typeof WildcardChar123Char125suffixRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/wildcard/$': typeof WildcardSplatRoute - '/wildcard/prefix{$}': typeof WildcardPrefixChar123Char125Route - '/wildcard/{$}.suffix': typeof WildcardChar123Char125DotsuffixRoute - '/wildcard/{$}suffix': typeof WildcardChar123Char125suffixRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: - | '/wildcard/$' - | '/wildcard/prefix{$}' - | '/wildcard/{$}.suffix' - | '/wildcard/{$}suffix' - fileRoutesByTo: FileRoutesByTo - to: - | '/wildcard/$' - | '/wildcard/prefix{$}' - | '/wildcard/{$}.suffix' - | '/wildcard/{$}suffix' - id: - | '__root__' - | '/wildcard/$' - | '/wildcard/prefix{$}' - | '/wildcard/{$}.suffix' - | '/wildcard/{$}suffix' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - WildcardSplatRoute: typeof WildcardSplatRoute - WildcardPrefixChar123Char125Route: typeof WildcardPrefixChar123Char125Route - WildcardChar123Char125DotsuffixRoute: typeof WildcardChar123Char125DotsuffixRoute - WildcardChar123Char125suffixRoute: typeof WildcardChar123Char125suffixRoute -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/wildcard/{$}suffix': { - id: '/wildcard/{$}suffix' - path: '/wildcard/{$}suffix' - fullPath: '/wildcard/{$}suffix' - preLoaderRoute: typeof WildcardChar123Char125suffixRouteImport - parentRoute: typeof rootRouteImport - } - '/wildcard/{$}.suffix': { - id: '/wildcard/{$}.suffix' - path: '/wildcard/{$}.suffix' - fullPath: '/wildcard/{$}.suffix' - preLoaderRoute: typeof WildcardChar123Char125DotsuffixRouteImport - parentRoute: typeof rootRouteImport - } - '/wildcard/prefix{$}': { - id: '/wildcard/prefix{$}' - path: '/wildcard/prefix{$}' - fullPath: '/wildcard/prefix{$}' - preLoaderRoute: typeof WildcardPrefixChar123Char125RouteImport - parentRoute: typeof rootRouteImport - } - '/wildcard/$': { - id: '/wildcard/$' - path: '/wildcard/$' - fullPath: '/wildcard/$' - preLoaderRoute: typeof WildcardSplatRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - WildcardSplatRoute: WildcardSplatRoute, - WildcardPrefixChar123Char125Route: WildcardPrefixChar123Char125Route, - WildcardChar123Char125DotsuffixRoute: WildcardChar123Char125DotsuffixRoute, - WildcardChar123Char125suffixRoute: WildcardChar123Char125suffixRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/packages/router-generator/tests/generator/route-groups/routeTree.nonnested.snapshot.ts b/packages/router-generator/tests/generator/route-groups/routeTree.nonnested.snapshot.ts deleted file mode 100644 index f2e84bbbb7e..00000000000 --- a/packages/router-generator/tests/generator/route-groups/routeTree.nonnested.snapshot.ts +++ /dev/null @@ -1,264 +0,0 @@ -/* eslint-disable */ - -// @ts-nocheck - -// noinspection JSUnusedGlobalSymbols - -// This file was automatically generated by TanStack Router. -// You should NOT make any changes in this file as it will be overwritten. -// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified. - -import { createFileRoute } from '@tanstack/react-router' - -import { Route as rootRouteImport } from './routes/__root' -import { Route as barBarRouteImport } from './routes/(bar)/_bar' -import { Route as fooAsdfLayoutRouteImport } from './routes/(foo)/asdf/_layout' -import { Route as barBarHelloRouteImport } from './routes/(bar)/_bar.hello' -import { Route as fooAsdfLayoutFooRouteImport } from './routes/(foo)/asdf/_layout.foo' -import { Route as fooAsdfbarIdRouteImport } from './routes/(foo)/asdf/(bar)/$id' -import { Route as fooAsdfanotherGroupLayoutRouteImport } from './routes/(foo)/asdf/(another-group)/_layout' -import { Route as fooAsdfbarLayoutAboutRouteImport } from './routes/(foo)/asdf/(bar)/_layout.about' -import { Route as fooAsdfanotherGroupLayoutBazRouteImport } from './routes/(foo)/asdf/(another-group)/_layout.baz' - -const fooAsdfbarLayoutXyzLazyRouteImport = createFileRoute( - '/(foo)/asdf/(bar)/_layout/xyz', -)() - -const barBarRoute = barBarRouteImport.update({ - id: '/(bar)/_bar', - getParentRoute: () => rootRouteImport, -} as any) -const fooAsdfLayoutRoute = fooAsdfLayoutRouteImport.update({ - id: '/(foo)/asdf/_layout', - path: '/asdf', - getParentRoute: () => rootRouteImport, -} as any) -const barBarHelloRoute = barBarHelloRouteImport.update({ - id: '/hello', - path: '/hello', - getParentRoute: () => barBarRoute, -} as any) -const fooAsdfLayoutFooRoute = fooAsdfLayoutFooRouteImport.update({ - id: '/foo', - path: '/foo', - getParentRoute: () => fooAsdfLayoutRoute, -} as any) -const fooAsdfbarIdRoute = fooAsdfbarIdRouteImport.update({ - id: '/(foo)/asdf/(bar)/$id', - path: '/asdf/$id', - getParentRoute: () => rootRouteImport, -} as any) -const fooAsdfanotherGroupLayoutRoute = - fooAsdfanotherGroupLayoutRouteImport.update({ - id: '/(foo)/asdf/(another-group)/_layout', - path: '/asdf', - getParentRoute: () => rootRouteImport, - } as any) -const fooAsdfbarLayoutXyzLazyRoute = fooAsdfbarLayoutXyzLazyRouteImport - .update({ - id: '/(foo)/asdf/(bar)/_layout/xyz', - path: '/asdf/xyz', - getParentRoute: () => rootRouteImport, - } as any) - .lazy(() => - import('./routes/(foo)/asdf/(bar)/_layout.xyz.lazy').then((d) => d.Route), - ) -const fooAsdfbarLayoutAboutRoute = fooAsdfbarLayoutAboutRouteImport.update({ - id: '/(foo)/asdf/(bar)/_layout/about', - path: '/asdf/about', - getParentRoute: () => rootRouteImport, -} as any) -const fooAsdfanotherGroupLayoutBazRoute = - fooAsdfanotherGroupLayoutBazRouteImport.update({ - id: '/baz', - path: '/baz', - getParentRoute: () => fooAsdfanotherGroupLayoutRoute, - } as any) - -export interface FileRoutesByFullPath { - '/hello': typeof barBarHelloRoute - '/asdf': typeof fooAsdfanotherGroupLayoutRouteWithChildren - '/asdf/$id': typeof fooAsdfbarIdRoute - '/asdf/foo': typeof fooAsdfLayoutFooRoute - '/asdf/baz': typeof fooAsdfanotherGroupLayoutBazRoute - '/asdf/about': typeof fooAsdfbarLayoutAboutRoute - '/asdf/xyz': typeof fooAsdfbarLayoutXyzLazyRoute -} -export interface FileRoutesByTo { - '/hello': typeof barBarHelloRoute - '/asdf': typeof fooAsdfanotherGroupLayoutRouteWithChildren - '/asdf/$id': typeof fooAsdfbarIdRoute - '/asdf/foo': typeof fooAsdfLayoutFooRoute - '/asdf/baz': typeof fooAsdfanotherGroupLayoutBazRoute - '/asdf/about': typeof fooAsdfbarLayoutAboutRoute - '/asdf/xyz': typeof fooAsdfbarLayoutXyzLazyRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/(bar)/_bar': typeof barBarRouteWithChildren - '/(bar)/_bar/hello': typeof barBarHelloRoute - '/(foo)/asdf/_layout': typeof fooAsdfLayoutRouteWithChildren - '/(foo)/asdf/(another-group)/_layout': typeof fooAsdfanotherGroupLayoutRouteWithChildren - '/(foo)/asdf/(bar)/$id': typeof fooAsdfbarIdRoute - '/(foo)/asdf/_layout/foo': typeof fooAsdfLayoutFooRoute - '/(foo)/asdf/(another-group)/_layout/baz': typeof fooAsdfanotherGroupLayoutBazRoute - '/(foo)/asdf/(bar)/_layout/about': typeof fooAsdfbarLayoutAboutRoute - '/(foo)/asdf/(bar)/_layout/xyz': typeof fooAsdfbarLayoutXyzLazyRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: - | '/hello' - | '/asdf' - | '/asdf/$id' - | '/asdf/foo' - | '/asdf/baz' - | '/asdf/about' - | '/asdf/xyz' - fileRoutesByTo: FileRoutesByTo - to: - | '/hello' - | '/asdf' - | '/asdf/$id' - | '/asdf/foo' - | '/asdf/baz' - | '/asdf/about' - | '/asdf/xyz' - id: - | '__root__' - | '/(bar)/_bar' - | '/(bar)/_bar/hello' - | '/(foo)/asdf/_layout' - | '/(foo)/asdf/(another-group)/_layout' - | '/(foo)/asdf/(bar)/$id' - | '/(foo)/asdf/_layout/foo' - | '/(foo)/asdf/(another-group)/_layout/baz' - | '/(foo)/asdf/(bar)/_layout/about' - | '/(foo)/asdf/(bar)/_layout/xyz' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - barBarRoute: typeof barBarRouteWithChildren - fooAsdfLayoutRoute: typeof fooAsdfLayoutRouteWithChildren - fooAsdfanotherGroupLayoutRoute: typeof fooAsdfanotherGroupLayoutRouteWithChildren - fooAsdfbarIdRoute: typeof fooAsdfbarIdRoute - fooAsdfbarLayoutAboutRoute: typeof fooAsdfbarLayoutAboutRoute - fooAsdfbarLayoutXyzLazyRoute: typeof fooAsdfbarLayoutXyzLazyRoute -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/(bar)/_bar': { - id: '/(bar)/_bar' - path: '' - fullPath: '' - preLoaderRoute: typeof barBarRouteImport - parentRoute: typeof rootRouteImport - } - '/(foo)/asdf/_layout': { - id: '/(foo)/asdf/_layout' - path: '/asdf' - fullPath: '/asdf' - preLoaderRoute: typeof fooAsdfLayoutRouteImport - parentRoute: typeof rootRouteImport - } - '/(bar)/_bar/hello': { - id: '/(bar)/_bar/hello' - path: '/hello' - fullPath: '/hello' - preLoaderRoute: typeof barBarHelloRouteImport - parentRoute: typeof barBarRoute - } - '/(foo)/asdf/_layout/foo': { - id: '/(foo)/asdf/_layout/foo' - path: '/foo' - fullPath: '/asdf/foo' - preLoaderRoute: typeof fooAsdfLayoutFooRouteImport - parentRoute: typeof fooAsdfLayoutRoute - } - '/(foo)/asdf/(bar)/$id': { - id: '/(foo)/asdf/(bar)/$id' - path: '/asdf/$id' - fullPath: '/asdf/$id' - preLoaderRoute: typeof fooAsdfbarIdRouteImport - parentRoute: typeof rootRouteImport - } - '/(foo)/asdf/(another-group)/_layout': { - id: '/(foo)/asdf/(another-group)/_layout' - path: '/asdf' - fullPath: '/asdf' - preLoaderRoute: typeof fooAsdfanotherGroupLayoutRouteImport - parentRoute: typeof rootRouteImport - } - '/(foo)/asdf/(bar)/_layout/xyz': { - id: '/(foo)/asdf/(bar)/_layout/xyz' - path: '/asdf/xyz' - fullPath: '/asdf/xyz' - preLoaderRoute: typeof fooAsdfbarLayoutXyzLazyRouteImport - parentRoute: typeof rootRouteImport - } - '/(foo)/asdf/(bar)/_layout/about': { - id: '/(foo)/asdf/(bar)/_layout/about' - path: '/asdf/about' - fullPath: '/asdf/about' - preLoaderRoute: typeof fooAsdfbarLayoutAboutRouteImport - parentRoute: typeof rootRouteImport - } - '/(foo)/asdf/(another-group)/_layout/baz': { - id: '/(foo)/asdf/(another-group)/_layout/baz' - path: '/baz' - fullPath: '/asdf/baz' - preLoaderRoute: typeof fooAsdfanotherGroupLayoutBazRouteImport - parentRoute: typeof fooAsdfanotherGroupLayoutRoute - } - } -} - -interface barBarRouteChildren { - barBarHelloRoute: typeof barBarHelloRoute -} - -const barBarRouteChildren: barBarRouteChildren = { - barBarHelloRoute: barBarHelloRoute, -} - -const barBarRouteWithChildren = - barBarRoute._addFileChildren(barBarRouteChildren) - -interface fooAsdfLayoutRouteChildren { - fooAsdfLayoutFooRoute: typeof fooAsdfLayoutFooRoute -} - -const fooAsdfLayoutRouteChildren: fooAsdfLayoutRouteChildren = { - fooAsdfLayoutFooRoute: fooAsdfLayoutFooRoute, -} - -const fooAsdfLayoutRouteWithChildren = fooAsdfLayoutRoute._addFileChildren( - fooAsdfLayoutRouteChildren, -) - -interface fooAsdfanotherGroupLayoutRouteChildren { - fooAsdfanotherGroupLayoutBazRoute: typeof fooAsdfanotherGroupLayoutBazRoute -} - -const fooAsdfanotherGroupLayoutRouteChildren: fooAsdfanotherGroupLayoutRouteChildren = - { - fooAsdfanotherGroupLayoutBazRoute: fooAsdfanotherGroupLayoutBazRoute, - } - -const fooAsdfanotherGroupLayoutRouteWithChildren = - fooAsdfanotherGroupLayoutRoute._addFileChildren( - fooAsdfanotherGroupLayoutRouteChildren, - ) - -const rootRouteChildren: RootRouteChildren = { - barBarRoute: barBarRouteWithChildren, - fooAsdfLayoutRoute: fooAsdfLayoutRouteWithChildren, - fooAsdfanotherGroupLayoutRoute: fooAsdfanotherGroupLayoutRouteWithChildren, - fooAsdfbarIdRoute: fooAsdfbarIdRoute, - fooAsdfbarLayoutAboutRoute: fooAsdfbarLayoutAboutRoute, - fooAsdfbarLayoutXyzLazyRoute: fooAsdfbarLayoutXyzLazyRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/packages/router-generator/tests/generator/routeFileIgnore/routeTree.nonnested.snapshot.ts b/packages/router-generator/tests/generator/routeFileIgnore/routeTree.nonnested.snapshot.ts deleted file mode 100644 index 33a4093b9e8..00000000000 --- a/packages/router-generator/tests/generator/routeFileIgnore/routeTree.nonnested.snapshot.ts +++ /dev/null @@ -1,77 +0,0 @@ -/* eslint-disable */ - -// @ts-nocheck - -// noinspection JSUnusedGlobalSymbols - -// This file was automatically generated by TanStack Router. -// You should NOT make any changes in this file as it will be overwritten. -// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified. - -import { Route as rootRouteImport } from './routes/__root' -import { Route as BlogRouteRouteImport } from './routes/blog.route' -import { Route as IndexRouteImport } from './routes/index' - -const BlogRouteRoute = BlogRouteRouteImport.update({ - id: '/blog', - path: '/blog', - getParentRoute: () => rootRouteImport, -} as any) -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/blog': typeof BlogRouteRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/blog': typeof BlogRouteRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/blog': typeof BlogRouteRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/blog' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/blog' - id: '__root__' | '/' | '/blog' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - BlogRouteRoute: typeof BlogRouteRoute -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/blog': { - id: '/blog' - path: '/blog' - fullPath: '/blog' - preLoaderRoute: typeof BlogRouteRouteImport - parentRoute: typeof rootRouteImport - } - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - BlogRouteRoute: BlogRouteRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/packages/router-generator/tests/generator/routeFilePrefix/routeTree.nonnested.snapshot.ts b/packages/router-generator/tests/generator/routeFilePrefix/routeTree.nonnested.snapshot.ts deleted file mode 100644 index 46ee215c03d..00000000000 --- a/packages/router-generator/tests/generator/routeFilePrefix/routeTree.nonnested.snapshot.ts +++ /dev/null @@ -1,77 +0,0 @@ -/* eslint-disable */ - -// @ts-nocheck - -// noinspection JSUnusedGlobalSymbols - -// This file was automatically generated by TanStack Router. -// You should NOT make any changes in this file as it will be overwritten. -// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified. - -import { Route as rootRouteImport } from './routes/r&__root' -import { Route as BlogRouteRouteImport } from './routes/r&blog.route' -import { Route as IndexRouteImport } from './routes/r&index' - -const BlogRouteRoute = BlogRouteRouteImport.update({ - id: '/blog', - path: '/blog', - getParentRoute: () => rootRouteImport, -} as any) -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/blog': typeof BlogRouteRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/blog': typeof BlogRouteRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/blog': typeof BlogRouteRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/blog' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/blog' - id: '__root__' | '/' | '/blog' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - BlogRouteRoute: typeof BlogRouteRoute -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/blog': { - id: '/blog' - path: '/blog' - fullPath: '/blog' - preLoaderRoute: typeof BlogRouteRouteImport - parentRoute: typeof rootRouteImport - } - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - BlogRouteRoute: BlogRouteRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/packages/router-generator/tests/generator/single-level/routeTree.nonnested.snapshot.ts b/packages/router-generator/tests/generator/single-level/routeTree.nonnested.snapshot.ts deleted file mode 100644 index b60f0b934fc..00000000000 --- a/packages/router-generator/tests/generator/single-level/routeTree.nonnested.snapshot.ts +++ /dev/null @@ -1,77 +0,0 @@ -/* eslint-disable */ - -// @ts-nocheck - -// noinspection JSUnusedGlobalSymbols - -// This file was automatically generated by TanStack Router. -// You should NOT make any changes in this file as it will be overwritten. -// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified. - -import { Route as rootRouteImport } from './routes/__root' -import { Route as PostsRouteImport } from './routes/posts' -import { Route as IndexRouteImport } from './routes/index' - -const PostsRoute = PostsRouteImport.update({ - id: '/posts', - path: '/posts', - getParentRoute: () => rootRouteImport, -} as any) -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/posts': typeof PostsRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/posts': typeof PostsRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/posts': typeof PostsRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/posts' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/posts' - id: '__root__' | '/' | '/posts' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - PostsRoute: typeof PostsRoute -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/posts': { - id: '/posts' - path: '/posts' - fullPath: '/posts' - preLoaderRoute: typeof PostsRouteImport - parentRoute: typeof rootRouteImport - } - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - PostsRoute: PostsRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/packages/router-generator/tests/generator/types-disabled/routeTree.nonnested.snapshot.js b/packages/router-generator/tests/generator/types-disabled/routeTree.nonnested.snapshot.js deleted file mode 100644 index 9c410eea0f4..00000000000 --- a/packages/router-generator/tests/generator/types-disabled/routeTree.nonnested.snapshot.js +++ /dev/null @@ -1,49 +0,0 @@ -/* eslint-disable */ - -// @ts-nocheck - -// noinspection JSUnusedGlobalSymbols - -// This file was automatically generated by TanStack Router. -// You should NOT make any changes in this file as it will be overwritten. -// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified. - -import { Route as rootRouteImport } from './routes/__root' -import { Route as PostsRouteImport } from './routes/posts' -import { Route as IndexRouteImport } from './routes/index' -import { Route as UsersUserIdRouteImport } from './routes/users.$userId' -import { Route as PostsPostIdRouteImport } from './routes/posts/$postId' - -const PostsRoute = PostsRouteImport.update({ - id: '/posts', - path: '/posts', - getParentRoute: () => rootRouteImport, -}) -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -}) -const UsersUserIdRoute = UsersUserIdRouteImport.update({ - id: '/users/$userId', - path: '/users/$userId', - getParentRoute: () => rootRouteImport, -}) -const PostsPostIdRoute = PostsPostIdRouteImport.update({ - id: '/$postId', - path: '/$postId', - getParentRoute: () => PostsRoute, -}) - -const PostsRouteChildren = { - PostsPostIdRoute: PostsPostIdRoute, -} - -const PostsRouteWithChildren = PostsRoute._addFileChildren(PostsRouteChildren) - -const rootRouteChildren = { - IndexRoute: IndexRoute, - PostsRoute: PostsRouteWithChildren, - UsersUserIdRoute: UsersUserIdRoute, -} -export const routeTree = rootRouteImport._addFileChildren(rootRouteChildren) diff --git a/packages/router-generator/tests/generator/virtual-config-file-default-export/routeTree.nonnested.snapshot.ts b/packages/router-generator/tests/generator/virtual-config-file-default-export/routeTree.nonnested.snapshot.ts deleted file mode 100644 index ab31f63e997..00000000000 --- a/packages/router-generator/tests/generator/virtual-config-file-default-export/routeTree.nonnested.snapshot.ts +++ /dev/null @@ -1,292 +0,0 @@ -/* eslint-disable */ - -// @ts-nocheck - -// noinspection JSUnusedGlobalSymbols - -// This file was automatically generated by TanStack Router. -// You should NOT make any changes in this file as it will be overwritten. -// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified. - -import { Route as rootRouteImport } from './routes/root' -import { Route as layoutRouteImport } from './routes/layout' -import { Route as indexRouteImport } from './routes/index' -import { Route as dbDashboardRouteImport } from './routes/db/dashboard' -import { Route as pagesRouteImport } from './routes/pages' -import { Route as HelloIndexRouteImport } from './routes/subtree/index' -import { Route as dbDashboardInvoicesRouteImport } from './routes/db/dashboard-invoices' -import { Route as dbDashboardIndexRouteImport } from './routes/db/dashboard-index' -import { Route as HelloFooIndexRouteImport } from './routes/subtree/foo/index' -import { Route as HelloFooIdRouteImport } from './routes/subtree/foo/$id' -import { Route as dbInvoiceDetailRouteImport } from './routes/db/invoice-detail' -import { Route as dbInvoicesIndexRouteImport } from './routes/db/invoices-index' - -const layoutRoute = layoutRouteImport.update({ - id: '/_layout', - getParentRoute: () => rootRouteImport, -} as any) -const indexRoute = indexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const dbDashboardRoute = dbDashboardRouteImport.update({ - id: '/dashboard', - path: '/dashboard', - getParentRoute: () => layoutRoute, -} as any) -const pagesRoute = pagesRouteImport.update({ - id: '/$lang/', - path: '/$lang/', - getParentRoute: () => rootRouteImport, -} as any) -const HelloIndexRoute = HelloIndexRouteImport.update({ - id: '/hello/', - path: '/hello/', - getParentRoute: () => layoutRoute, -} as any) -const dbDashboardInvoicesRoute = dbDashboardInvoicesRouteImport.update({ - id: '/invoices', - path: '/invoices', - getParentRoute: () => dbDashboardRoute, -} as any) -const dbDashboardIndexRoute = dbDashboardIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => dbDashboardRoute, -} as any) -const HelloFooIndexRoute = HelloFooIndexRouteImport.update({ - id: '/hello/foo/', - path: '/hello/foo/', - getParentRoute: () => layoutRoute, -} as any) -const HelloFooIdRoute = HelloFooIdRouteImport.update({ - id: '/hello/foo/$id', - path: '/hello/foo/$id', - getParentRoute: () => layoutRoute, -} as any) -const dbInvoiceDetailRoute = dbInvoiceDetailRouteImport.update({ - id: '/$id', - path: '/$id', - getParentRoute: () => dbDashboardInvoicesRoute, -} as any) -const dbInvoicesIndexRoute = dbInvoicesIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => dbDashboardInvoicesRoute, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof indexRoute - '/$lang': typeof pagesRoute - '/dashboard': typeof dbDashboardRouteWithChildren - '/dashboard/': typeof dbDashboardIndexRoute - '/dashboard/invoices': typeof dbDashboardInvoicesRouteWithChildren - '/hello': typeof HelloIndexRoute - '/dashboard/invoices/': typeof dbInvoicesIndexRoute - '/dashboard/invoices/$id': typeof dbInvoiceDetailRoute - '/hello/foo/$id': typeof HelloFooIdRoute - '/hello/foo': typeof HelloFooIndexRoute -} -export interface FileRoutesByTo { - '/': typeof indexRoute - '/$lang': typeof pagesRoute - '/dashboard': typeof dbDashboardIndexRoute - '/hello': typeof HelloIndexRoute - '/dashboard/invoices': typeof dbInvoicesIndexRoute - '/dashboard/invoices/$id': typeof dbInvoiceDetailRoute - '/hello/foo/$id': typeof HelloFooIdRoute - '/hello/foo': typeof HelloFooIndexRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof indexRoute - '/_layout': typeof layoutRouteWithChildren - '/$lang/': typeof pagesRoute - '/_layout/dashboard': typeof dbDashboardRouteWithChildren - '/_layout/dashboard/': typeof dbDashboardIndexRoute - '/_layout/dashboard/invoices': typeof dbDashboardInvoicesRouteWithChildren - '/_layout/hello/': typeof HelloIndexRoute - '/_layout/dashboard/invoices/': typeof dbInvoicesIndexRoute - '/_layout/dashboard/invoices/$id': typeof dbInvoiceDetailRoute - '/_layout/hello/foo/$id': typeof HelloFooIdRoute - '/_layout/hello/foo/': typeof HelloFooIndexRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: - | '/' - | '/$lang' - | '/dashboard' - | '/dashboard/' - | '/dashboard/invoices' - | '/hello' - | '/dashboard/invoices/' - | '/dashboard/invoices/$id' - | '/hello/foo/$id' - | '/hello/foo' - fileRoutesByTo: FileRoutesByTo - to: - | '/' - | '/$lang' - | '/dashboard' - | '/hello' - | '/dashboard/invoices' - | '/dashboard/invoices/$id' - | '/hello/foo/$id' - | '/hello/foo' - id: - | '__root__' - | '/' - | '/_layout' - | '/$lang/' - | '/_layout/dashboard' - | '/_layout/dashboard/' - | '/_layout/dashboard/invoices' - | '/_layout/hello/' - | '/_layout/dashboard/invoices/' - | '/_layout/dashboard/invoices/$id' - | '/_layout/hello/foo/$id' - | '/_layout/hello/foo/' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - indexRoute: typeof indexRoute - layoutRoute: typeof layoutRouteWithChildren - pagesRoute: typeof pagesRoute -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/_layout': { - id: '/_layout' - path: '' - fullPath: '' - preLoaderRoute: typeof layoutRouteImport - parentRoute: typeof rootRouteImport - } - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof indexRouteImport - parentRoute: typeof rootRouteImport - } - '/_layout/dashboard': { - id: '/_layout/dashboard' - path: '/dashboard' - fullPath: '/dashboard' - preLoaderRoute: typeof dbDashboardRouteImport - parentRoute: typeof layoutRoute - } - '/$lang/': { - id: '/$lang/' - path: '/$lang' - fullPath: '/$lang' - preLoaderRoute: typeof pagesRouteImport - parentRoute: typeof rootRouteImport - } - '/_layout/hello/': { - id: '/_layout/hello/' - path: '/hello' - fullPath: '/hello' - preLoaderRoute: typeof HelloIndexRouteImport - parentRoute: typeof layoutRoute - } - '/_layout/dashboard/invoices': { - id: '/_layout/dashboard/invoices' - path: '/invoices' - fullPath: '/dashboard/invoices' - preLoaderRoute: typeof dbDashboardInvoicesRouteImport - parentRoute: typeof dbDashboardRoute - } - '/_layout/dashboard/': { - id: '/_layout/dashboard/' - path: '/' - fullPath: '/dashboard/' - preLoaderRoute: typeof dbDashboardIndexRouteImport - parentRoute: typeof dbDashboardRoute - } - '/_layout/hello/foo/': { - id: '/_layout/hello/foo/' - path: '/hello/foo' - fullPath: '/hello/foo' - preLoaderRoute: typeof HelloFooIndexRouteImport - parentRoute: typeof layoutRoute - } - '/_layout/hello/foo/$id': { - id: '/_layout/hello/foo/$id' - path: '/hello/foo/$id' - fullPath: '/hello/foo/$id' - preLoaderRoute: typeof HelloFooIdRouteImport - parentRoute: typeof layoutRoute - } - '/_layout/dashboard/invoices/$id': { - id: '/_layout/dashboard/invoices/$id' - path: '/$id' - fullPath: '/dashboard/invoices/$id' - preLoaderRoute: typeof dbInvoiceDetailRouteImport - parentRoute: typeof dbDashboardInvoicesRoute - } - '/_layout/dashboard/invoices/': { - id: '/_layout/dashboard/invoices/' - path: '/' - fullPath: '/dashboard/invoices/' - preLoaderRoute: typeof dbInvoicesIndexRouteImport - parentRoute: typeof dbDashboardInvoicesRoute - } - } -} - -interface dbDashboardInvoicesRouteChildren { - dbInvoicesIndexRoute: typeof dbInvoicesIndexRoute - dbInvoiceDetailRoute: typeof dbInvoiceDetailRoute -} - -const dbDashboardInvoicesRouteChildren: dbDashboardInvoicesRouteChildren = { - dbInvoicesIndexRoute: dbInvoicesIndexRoute, - dbInvoiceDetailRoute: dbInvoiceDetailRoute, -} - -const dbDashboardInvoicesRouteWithChildren = - dbDashboardInvoicesRoute._addFileChildren(dbDashboardInvoicesRouteChildren) - -interface dbDashboardRouteChildren { - dbDashboardIndexRoute: typeof dbDashboardIndexRoute - dbDashboardInvoicesRoute: typeof dbDashboardInvoicesRouteWithChildren -} - -const dbDashboardRouteChildren: dbDashboardRouteChildren = { - dbDashboardIndexRoute: dbDashboardIndexRoute, - dbDashboardInvoicesRoute: dbDashboardInvoicesRouteWithChildren, -} - -const dbDashboardRouteWithChildren = dbDashboardRoute._addFileChildren( - dbDashboardRouteChildren, -) - -interface layoutRouteChildren { - dbDashboardRoute: typeof dbDashboardRouteWithChildren - HelloIndexRoute: typeof HelloIndexRoute - HelloFooIdRoute: typeof HelloFooIdRoute - HelloFooIndexRoute: typeof HelloFooIndexRoute -} - -const layoutRouteChildren: layoutRouteChildren = { - dbDashboardRoute: dbDashboardRouteWithChildren, - HelloIndexRoute: HelloIndexRoute, - HelloFooIdRoute: HelloFooIdRoute, - HelloFooIndexRoute: HelloFooIndexRoute, -} - -const layoutRouteWithChildren = - layoutRoute._addFileChildren(layoutRouteChildren) - -const rootRouteChildren: RootRouteChildren = { - indexRoute: indexRoute, - layoutRoute: layoutRouteWithChildren, - pagesRoute: pagesRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/packages/router-generator/tests/generator/virtual-config-file-named-export/routeTree.nonnested.snapshot.ts b/packages/router-generator/tests/generator/virtual-config-file-named-export/routeTree.nonnested.snapshot.ts deleted file mode 100644 index ab31f63e997..00000000000 --- a/packages/router-generator/tests/generator/virtual-config-file-named-export/routeTree.nonnested.snapshot.ts +++ /dev/null @@ -1,292 +0,0 @@ -/* eslint-disable */ - -// @ts-nocheck - -// noinspection JSUnusedGlobalSymbols - -// This file was automatically generated by TanStack Router. -// You should NOT make any changes in this file as it will be overwritten. -// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified. - -import { Route as rootRouteImport } from './routes/root' -import { Route as layoutRouteImport } from './routes/layout' -import { Route as indexRouteImport } from './routes/index' -import { Route as dbDashboardRouteImport } from './routes/db/dashboard' -import { Route as pagesRouteImport } from './routes/pages' -import { Route as HelloIndexRouteImport } from './routes/subtree/index' -import { Route as dbDashboardInvoicesRouteImport } from './routes/db/dashboard-invoices' -import { Route as dbDashboardIndexRouteImport } from './routes/db/dashboard-index' -import { Route as HelloFooIndexRouteImport } from './routes/subtree/foo/index' -import { Route as HelloFooIdRouteImport } from './routes/subtree/foo/$id' -import { Route as dbInvoiceDetailRouteImport } from './routes/db/invoice-detail' -import { Route as dbInvoicesIndexRouteImport } from './routes/db/invoices-index' - -const layoutRoute = layoutRouteImport.update({ - id: '/_layout', - getParentRoute: () => rootRouteImport, -} as any) -const indexRoute = indexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const dbDashboardRoute = dbDashboardRouteImport.update({ - id: '/dashboard', - path: '/dashboard', - getParentRoute: () => layoutRoute, -} as any) -const pagesRoute = pagesRouteImport.update({ - id: '/$lang/', - path: '/$lang/', - getParentRoute: () => rootRouteImport, -} as any) -const HelloIndexRoute = HelloIndexRouteImport.update({ - id: '/hello/', - path: '/hello/', - getParentRoute: () => layoutRoute, -} as any) -const dbDashboardInvoicesRoute = dbDashboardInvoicesRouteImport.update({ - id: '/invoices', - path: '/invoices', - getParentRoute: () => dbDashboardRoute, -} as any) -const dbDashboardIndexRoute = dbDashboardIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => dbDashboardRoute, -} as any) -const HelloFooIndexRoute = HelloFooIndexRouteImport.update({ - id: '/hello/foo/', - path: '/hello/foo/', - getParentRoute: () => layoutRoute, -} as any) -const HelloFooIdRoute = HelloFooIdRouteImport.update({ - id: '/hello/foo/$id', - path: '/hello/foo/$id', - getParentRoute: () => layoutRoute, -} as any) -const dbInvoiceDetailRoute = dbInvoiceDetailRouteImport.update({ - id: '/$id', - path: '/$id', - getParentRoute: () => dbDashboardInvoicesRoute, -} as any) -const dbInvoicesIndexRoute = dbInvoicesIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => dbDashboardInvoicesRoute, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof indexRoute - '/$lang': typeof pagesRoute - '/dashboard': typeof dbDashboardRouteWithChildren - '/dashboard/': typeof dbDashboardIndexRoute - '/dashboard/invoices': typeof dbDashboardInvoicesRouteWithChildren - '/hello': typeof HelloIndexRoute - '/dashboard/invoices/': typeof dbInvoicesIndexRoute - '/dashboard/invoices/$id': typeof dbInvoiceDetailRoute - '/hello/foo/$id': typeof HelloFooIdRoute - '/hello/foo': typeof HelloFooIndexRoute -} -export interface FileRoutesByTo { - '/': typeof indexRoute - '/$lang': typeof pagesRoute - '/dashboard': typeof dbDashboardIndexRoute - '/hello': typeof HelloIndexRoute - '/dashboard/invoices': typeof dbInvoicesIndexRoute - '/dashboard/invoices/$id': typeof dbInvoiceDetailRoute - '/hello/foo/$id': typeof HelloFooIdRoute - '/hello/foo': typeof HelloFooIndexRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof indexRoute - '/_layout': typeof layoutRouteWithChildren - '/$lang/': typeof pagesRoute - '/_layout/dashboard': typeof dbDashboardRouteWithChildren - '/_layout/dashboard/': typeof dbDashboardIndexRoute - '/_layout/dashboard/invoices': typeof dbDashboardInvoicesRouteWithChildren - '/_layout/hello/': typeof HelloIndexRoute - '/_layout/dashboard/invoices/': typeof dbInvoicesIndexRoute - '/_layout/dashboard/invoices/$id': typeof dbInvoiceDetailRoute - '/_layout/hello/foo/$id': typeof HelloFooIdRoute - '/_layout/hello/foo/': typeof HelloFooIndexRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: - | '/' - | '/$lang' - | '/dashboard' - | '/dashboard/' - | '/dashboard/invoices' - | '/hello' - | '/dashboard/invoices/' - | '/dashboard/invoices/$id' - | '/hello/foo/$id' - | '/hello/foo' - fileRoutesByTo: FileRoutesByTo - to: - | '/' - | '/$lang' - | '/dashboard' - | '/hello' - | '/dashboard/invoices' - | '/dashboard/invoices/$id' - | '/hello/foo/$id' - | '/hello/foo' - id: - | '__root__' - | '/' - | '/_layout' - | '/$lang/' - | '/_layout/dashboard' - | '/_layout/dashboard/' - | '/_layout/dashboard/invoices' - | '/_layout/hello/' - | '/_layout/dashboard/invoices/' - | '/_layout/dashboard/invoices/$id' - | '/_layout/hello/foo/$id' - | '/_layout/hello/foo/' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - indexRoute: typeof indexRoute - layoutRoute: typeof layoutRouteWithChildren - pagesRoute: typeof pagesRoute -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/_layout': { - id: '/_layout' - path: '' - fullPath: '' - preLoaderRoute: typeof layoutRouteImport - parentRoute: typeof rootRouteImport - } - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof indexRouteImport - parentRoute: typeof rootRouteImport - } - '/_layout/dashboard': { - id: '/_layout/dashboard' - path: '/dashboard' - fullPath: '/dashboard' - preLoaderRoute: typeof dbDashboardRouteImport - parentRoute: typeof layoutRoute - } - '/$lang/': { - id: '/$lang/' - path: '/$lang' - fullPath: '/$lang' - preLoaderRoute: typeof pagesRouteImport - parentRoute: typeof rootRouteImport - } - '/_layout/hello/': { - id: '/_layout/hello/' - path: '/hello' - fullPath: '/hello' - preLoaderRoute: typeof HelloIndexRouteImport - parentRoute: typeof layoutRoute - } - '/_layout/dashboard/invoices': { - id: '/_layout/dashboard/invoices' - path: '/invoices' - fullPath: '/dashboard/invoices' - preLoaderRoute: typeof dbDashboardInvoicesRouteImport - parentRoute: typeof dbDashboardRoute - } - '/_layout/dashboard/': { - id: '/_layout/dashboard/' - path: '/' - fullPath: '/dashboard/' - preLoaderRoute: typeof dbDashboardIndexRouteImport - parentRoute: typeof dbDashboardRoute - } - '/_layout/hello/foo/': { - id: '/_layout/hello/foo/' - path: '/hello/foo' - fullPath: '/hello/foo' - preLoaderRoute: typeof HelloFooIndexRouteImport - parentRoute: typeof layoutRoute - } - '/_layout/hello/foo/$id': { - id: '/_layout/hello/foo/$id' - path: '/hello/foo/$id' - fullPath: '/hello/foo/$id' - preLoaderRoute: typeof HelloFooIdRouteImport - parentRoute: typeof layoutRoute - } - '/_layout/dashboard/invoices/$id': { - id: '/_layout/dashboard/invoices/$id' - path: '/$id' - fullPath: '/dashboard/invoices/$id' - preLoaderRoute: typeof dbInvoiceDetailRouteImport - parentRoute: typeof dbDashboardInvoicesRoute - } - '/_layout/dashboard/invoices/': { - id: '/_layout/dashboard/invoices/' - path: '/' - fullPath: '/dashboard/invoices/' - preLoaderRoute: typeof dbInvoicesIndexRouteImport - parentRoute: typeof dbDashboardInvoicesRoute - } - } -} - -interface dbDashboardInvoicesRouteChildren { - dbInvoicesIndexRoute: typeof dbInvoicesIndexRoute - dbInvoiceDetailRoute: typeof dbInvoiceDetailRoute -} - -const dbDashboardInvoicesRouteChildren: dbDashboardInvoicesRouteChildren = { - dbInvoicesIndexRoute: dbInvoicesIndexRoute, - dbInvoiceDetailRoute: dbInvoiceDetailRoute, -} - -const dbDashboardInvoicesRouteWithChildren = - dbDashboardInvoicesRoute._addFileChildren(dbDashboardInvoicesRouteChildren) - -interface dbDashboardRouteChildren { - dbDashboardIndexRoute: typeof dbDashboardIndexRoute - dbDashboardInvoicesRoute: typeof dbDashboardInvoicesRouteWithChildren -} - -const dbDashboardRouteChildren: dbDashboardRouteChildren = { - dbDashboardIndexRoute: dbDashboardIndexRoute, - dbDashboardInvoicesRoute: dbDashboardInvoicesRouteWithChildren, -} - -const dbDashboardRouteWithChildren = dbDashboardRoute._addFileChildren( - dbDashboardRouteChildren, -) - -interface layoutRouteChildren { - dbDashboardRoute: typeof dbDashboardRouteWithChildren - HelloIndexRoute: typeof HelloIndexRoute - HelloFooIdRoute: typeof HelloFooIdRoute - HelloFooIndexRoute: typeof HelloFooIndexRoute -} - -const layoutRouteChildren: layoutRouteChildren = { - dbDashboardRoute: dbDashboardRouteWithChildren, - HelloIndexRoute: HelloIndexRoute, - HelloFooIdRoute: HelloFooIdRoute, - HelloFooIndexRoute: HelloFooIndexRoute, -} - -const layoutRouteWithChildren = - layoutRoute._addFileChildren(layoutRouteChildren) - -const rootRouteChildren: RootRouteChildren = { - indexRoute: indexRoute, - layoutRoute: layoutRouteWithChildren, - pagesRoute: pagesRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/packages/router-generator/tests/generator/virtual-inside-nested/routeTree.nonnested.snapshot.ts b/packages/router-generator/tests/generator/virtual-inside-nested/routeTree.nonnested.snapshot.ts deleted file mode 100644 index 174f18465b8..00000000000 --- a/packages/router-generator/tests/generator/virtual-inside-nested/routeTree.nonnested.snapshot.ts +++ /dev/null @@ -1,121 +0,0 @@ -/* eslint-disable */ - -// @ts-nocheck - -// noinspection JSUnusedGlobalSymbols - -// This file was automatically generated by TanStack Router. -// You should NOT make any changes in this file as it will be overwritten. -// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified. - -import { Route as rootRouteImport } from './routes/__root' -import { Route as IndexRouteImport } from './routes/index' -import { Route as FooBarRouteImport } from './routes/foo/bar' -import { Route as fooBarDetailsRouteImport } from './routes/foo/bar/details' -import { Route as fooBarHomeRouteImport } from './routes/foo/bar/home' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const FooBarRoute = FooBarRouteImport.update({ - id: '/foo/bar', - path: '/foo/bar', - getParentRoute: () => rootRouteImport, -} as any) -const fooBarDetailsRoute = fooBarDetailsRouteImport.update({ - id: '/$id', - path: '/$id', - getParentRoute: () => FooBarRoute, -} as any) -const fooBarHomeRoute = fooBarHomeRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => FooBarRoute, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/foo/bar': typeof FooBarRouteWithChildren - '/foo/bar/': typeof fooBarHomeRoute - '/foo/bar/$id': typeof fooBarDetailsRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/foo/bar': typeof fooBarHomeRoute - '/foo/bar/$id': typeof fooBarDetailsRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/foo/bar': typeof FooBarRouteWithChildren - '/foo/bar/': typeof fooBarHomeRoute - '/foo/bar/$id': typeof fooBarDetailsRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/foo/bar' | '/foo/bar/' | '/foo/bar/$id' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/foo/bar' | '/foo/bar/$id' - id: '__root__' | '/' | '/foo/bar' | '/foo/bar/' | '/foo/bar/$id' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - FooBarRoute: typeof FooBarRouteWithChildren -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/foo/bar': { - id: '/foo/bar' - path: '/foo/bar' - fullPath: '/foo/bar' - preLoaderRoute: typeof FooBarRouteImport - parentRoute: typeof rootRouteImport - } - '/foo/bar/$id': { - id: '/foo/bar/$id' - path: '/$id' - fullPath: '/foo/bar/$id' - preLoaderRoute: typeof fooBarDetailsRouteImport - parentRoute: typeof FooBarRoute - } - '/foo/bar/': { - id: '/foo/bar/' - path: '/' - fullPath: '/foo/bar/' - preLoaderRoute: typeof fooBarHomeRouteImport - parentRoute: typeof FooBarRoute - } - } -} - -interface FooBarRouteChildren { - fooBarHomeRoute: typeof fooBarHomeRoute - fooBarDetailsRoute: typeof fooBarDetailsRoute -} - -const FooBarRouteChildren: FooBarRouteChildren = { - fooBarHomeRoute: fooBarHomeRoute, - fooBarDetailsRoute: fooBarDetailsRoute, -} - -const FooBarRouteWithChildren = - FooBarRoute._addFileChildren(FooBarRouteChildren) - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - FooBarRoute: FooBarRouteWithChildren, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/packages/router-generator/tests/generator/virtual/routeTree.nonnested.snapshot.ts b/packages/router-generator/tests/generator/virtual/routeTree.nonnested.snapshot.ts deleted file mode 100644 index ab31f63e997..00000000000 --- a/packages/router-generator/tests/generator/virtual/routeTree.nonnested.snapshot.ts +++ /dev/null @@ -1,292 +0,0 @@ -/* eslint-disable */ - -// @ts-nocheck - -// noinspection JSUnusedGlobalSymbols - -// This file was automatically generated by TanStack Router. -// You should NOT make any changes in this file as it will be overwritten. -// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified. - -import { Route as rootRouteImport } from './routes/root' -import { Route as layoutRouteImport } from './routes/layout' -import { Route as indexRouteImport } from './routes/index' -import { Route as dbDashboardRouteImport } from './routes/db/dashboard' -import { Route as pagesRouteImport } from './routes/pages' -import { Route as HelloIndexRouteImport } from './routes/subtree/index' -import { Route as dbDashboardInvoicesRouteImport } from './routes/db/dashboard-invoices' -import { Route as dbDashboardIndexRouteImport } from './routes/db/dashboard-index' -import { Route as HelloFooIndexRouteImport } from './routes/subtree/foo/index' -import { Route as HelloFooIdRouteImport } from './routes/subtree/foo/$id' -import { Route as dbInvoiceDetailRouteImport } from './routes/db/invoice-detail' -import { Route as dbInvoicesIndexRouteImport } from './routes/db/invoices-index' - -const layoutRoute = layoutRouteImport.update({ - id: '/_layout', - getParentRoute: () => rootRouteImport, -} as any) -const indexRoute = indexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const dbDashboardRoute = dbDashboardRouteImport.update({ - id: '/dashboard', - path: '/dashboard', - getParentRoute: () => layoutRoute, -} as any) -const pagesRoute = pagesRouteImport.update({ - id: '/$lang/', - path: '/$lang/', - getParentRoute: () => rootRouteImport, -} as any) -const HelloIndexRoute = HelloIndexRouteImport.update({ - id: '/hello/', - path: '/hello/', - getParentRoute: () => layoutRoute, -} as any) -const dbDashboardInvoicesRoute = dbDashboardInvoicesRouteImport.update({ - id: '/invoices', - path: '/invoices', - getParentRoute: () => dbDashboardRoute, -} as any) -const dbDashboardIndexRoute = dbDashboardIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => dbDashboardRoute, -} as any) -const HelloFooIndexRoute = HelloFooIndexRouteImport.update({ - id: '/hello/foo/', - path: '/hello/foo/', - getParentRoute: () => layoutRoute, -} as any) -const HelloFooIdRoute = HelloFooIdRouteImport.update({ - id: '/hello/foo/$id', - path: '/hello/foo/$id', - getParentRoute: () => layoutRoute, -} as any) -const dbInvoiceDetailRoute = dbInvoiceDetailRouteImport.update({ - id: '/$id', - path: '/$id', - getParentRoute: () => dbDashboardInvoicesRoute, -} as any) -const dbInvoicesIndexRoute = dbInvoicesIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => dbDashboardInvoicesRoute, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof indexRoute - '/$lang': typeof pagesRoute - '/dashboard': typeof dbDashboardRouteWithChildren - '/dashboard/': typeof dbDashboardIndexRoute - '/dashboard/invoices': typeof dbDashboardInvoicesRouteWithChildren - '/hello': typeof HelloIndexRoute - '/dashboard/invoices/': typeof dbInvoicesIndexRoute - '/dashboard/invoices/$id': typeof dbInvoiceDetailRoute - '/hello/foo/$id': typeof HelloFooIdRoute - '/hello/foo': typeof HelloFooIndexRoute -} -export interface FileRoutesByTo { - '/': typeof indexRoute - '/$lang': typeof pagesRoute - '/dashboard': typeof dbDashboardIndexRoute - '/hello': typeof HelloIndexRoute - '/dashboard/invoices': typeof dbInvoicesIndexRoute - '/dashboard/invoices/$id': typeof dbInvoiceDetailRoute - '/hello/foo/$id': typeof HelloFooIdRoute - '/hello/foo': typeof HelloFooIndexRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof indexRoute - '/_layout': typeof layoutRouteWithChildren - '/$lang/': typeof pagesRoute - '/_layout/dashboard': typeof dbDashboardRouteWithChildren - '/_layout/dashboard/': typeof dbDashboardIndexRoute - '/_layout/dashboard/invoices': typeof dbDashboardInvoicesRouteWithChildren - '/_layout/hello/': typeof HelloIndexRoute - '/_layout/dashboard/invoices/': typeof dbInvoicesIndexRoute - '/_layout/dashboard/invoices/$id': typeof dbInvoiceDetailRoute - '/_layout/hello/foo/$id': typeof HelloFooIdRoute - '/_layout/hello/foo/': typeof HelloFooIndexRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: - | '/' - | '/$lang' - | '/dashboard' - | '/dashboard/' - | '/dashboard/invoices' - | '/hello' - | '/dashboard/invoices/' - | '/dashboard/invoices/$id' - | '/hello/foo/$id' - | '/hello/foo' - fileRoutesByTo: FileRoutesByTo - to: - | '/' - | '/$lang' - | '/dashboard' - | '/hello' - | '/dashboard/invoices' - | '/dashboard/invoices/$id' - | '/hello/foo/$id' - | '/hello/foo' - id: - | '__root__' - | '/' - | '/_layout' - | '/$lang/' - | '/_layout/dashboard' - | '/_layout/dashboard/' - | '/_layout/dashboard/invoices' - | '/_layout/hello/' - | '/_layout/dashboard/invoices/' - | '/_layout/dashboard/invoices/$id' - | '/_layout/hello/foo/$id' - | '/_layout/hello/foo/' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - indexRoute: typeof indexRoute - layoutRoute: typeof layoutRouteWithChildren - pagesRoute: typeof pagesRoute -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/_layout': { - id: '/_layout' - path: '' - fullPath: '' - preLoaderRoute: typeof layoutRouteImport - parentRoute: typeof rootRouteImport - } - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof indexRouteImport - parentRoute: typeof rootRouteImport - } - '/_layout/dashboard': { - id: '/_layout/dashboard' - path: '/dashboard' - fullPath: '/dashboard' - preLoaderRoute: typeof dbDashboardRouteImport - parentRoute: typeof layoutRoute - } - '/$lang/': { - id: '/$lang/' - path: '/$lang' - fullPath: '/$lang' - preLoaderRoute: typeof pagesRouteImport - parentRoute: typeof rootRouteImport - } - '/_layout/hello/': { - id: '/_layout/hello/' - path: '/hello' - fullPath: '/hello' - preLoaderRoute: typeof HelloIndexRouteImport - parentRoute: typeof layoutRoute - } - '/_layout/dashboard/invoices': { - id: '/_layout/dashboard/invoices' - path: '/invoices' - fullPath: '/dashboard/invoices' - preLoaderRoute: typeof dbDashboardInvoicesRouteImport - parentRoute: typeof dbDashboardRoute - } - '/_layout/dashboard/': { - id: '/_layout/dashboard/' - path: '/' - fullPath: '/dashboard/' - preLoaderRoute: typeof dbDashboardIndexRouteImport - parentRoute: typeof dbDashboardRoute - } - '/_layout/hello/foo/': { - id: '/_layout/hello/foo/' - path: '/hello/foo' - fullPath: '/hello/foo' - preLoaderRoute: typeof HelloFooIndexRouteImport - parentRoute: typeof layoutRoute - } - '/_layout/hello/foo/$id': { - id: '/_layout/hello/foo/$id' - path: '/hello/foo/$id' - fullPath: '/hello/foo/$id' - preLoaderRoute: typeof HelloFooIdRouteImport - parentRoute: typeof layoutRoute - } - '/_layout/dashboard/invoices/$id': { - id: '/_layout/dashboard/invoices/$id' - path: '/$id' - fullPath: '/dashboard/invoices/$id' - preLoaderRoute: typeof dbInvoiceDetailRouteImport - parentRoute: typeof dbDashboardInvoicesRoute - } - '/_layout/dashboard/invoices/': { - id: '/_layout/dashboard/invoices/' - path: '/' - fullPath: '/dashboard/invoices/' - preLoaderRoute: typeof dbInvoicesIndexRouteImport - parentRoute: typeof dbDashboardInvoicesRoute - } - } -} - -interface dbDashboardInvoicesRouteChildren { - dbInvoicesIndexRoute: typeof dbInvoicesIndexRoute - dbInvoiceDetailRoute: typeof dbInvoiceDetailRoute -} - -const dbDashboardInvoicesRouteChildren: dbDashboardInvoicesRouteChildren = { - dbInvoicesIndexRoute: dbInvoicesIndexRoute, - dbInvoiceDetailRoute: dbInvoiceDetailRoute, -} - -const dbDashboardInvoicesRouteWithChildren = - dbDashboardInvoicesRoute._addFileChildren(dbDashboardInvoicesRouteChildren) - -interface dbDashboardRouteChildren { - dbDashboardIndexRoute: typeof dbDashboardIndexRoute - dbDashboardInvoicesRoute: typeof dbDashboardInvoicesRouteWithChildren -} - -const dbDashboardRouteChildren: dbDashboardRouteChildren = { - dbDashboardIndexRoute: dbDashboardIndexRoute, - dbDashboardInvoicesRoute: dbDashboardInvoicesRouteWithChildren, -} - -const dbDashboardRouteWithChildren = dbDashboardRoute._addFileChildren( - dbDashboardRouteChildren, -) - -interface layoutRouteChildren { - dbDashboardRoute: typeof dbDashboardRouteWithChildren - HelloIndexRoute: typeof HelloIndexRoute - HelloFooIdRoute: typeof HelloFooIdRoute - HelloFooIndexRoute: typeof HelloFooIndexRoute -} - -const layoutRouteChildren: layoutRouteChildren = { - dbDashboardRoute: dbDashboardRouteWithChildren, - HelloIndexRoute: HelloIndexRoute, - HelloFooIdRoute: HelloFooIdRoute, - HelloFooIndexRoute: HelloFooIndexRoute, -} - -const layoutRouteWithChildren = - layoutRoute._addFileChildren(layoutRouteChildren) - -const rootRouteChildren: RootRouteChildren = { - indexRoute: indexRoute, - layoutRoute: layoutRouteWithChildren, - pagesRoute: pagesRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/packages/router-generator/tests/utils.test.ts b/packages/router-generator/tests/utils.test.ts index 1d185639ad7..b6acd86825b 100644 --- a/packages/router-generator/tests/utils.test.ts +++ b/packages/router-generator/tests/utils.test.ts @@ -3,7 +3,6 @@ import { RoutePrefixMap, cleanPath, determineInitialRoutePath, - isValidNonNestedRoute, mergeImportDeclarations, multiSortBy, removeExt, @@ -20,137 +19,52 @@ describe('cleanPath', () => { }) }) -describe('multiSortBy', () => { - it('sorts by single accessor', () => { - const arr = [{ v: 3 }, { v: 1 }, { v: 2 }] - const result = multiSortBy(arr, [(d) => d.v]) - expect(result.map((d) => d.v)).toEqual([1, 2, 3]) - }) - - it('sorts by multiple accessors', () => { - const arr = [ - { a: 2, b: 1 }, - { a: 1, b: 2 }, - { a: 1, b: 1 }, - ] - const result = multiSortBy(arr, [(d) => d.a, (d) => d.b]) - expect(result).toEqual([ - { a: 1, b: 1 }, - { a: 1, b: 2 }, - { a: 2, b: 1 }, - ]) - }) - - it('preserves original order for equal elements', () => { - const arr = [ - { a: 1, id: 'first' }, - { a: 1, id: 'second' }, - { a: 1, id: 'third' }, - ] - const result = multiSortBy(arr, [(d) => d.a]) - expect(result.map((d) => d.id)).toEqual(['first', 'second', 'third']) - }) - - it('handles undefined values', () => { - const arr = [{ v: 1 }, { v: undefined }, { v: 2 }] - const result = multiSortBy(arr, [(d) => d.v]) - // undefined sorts to end - expect(result.map((d) => d.v)).toEqual([1, 2, undefined]) - }) - - it('handles empty array', () => { - const result = multiSortBy([], [(d) => d]) - expect(result).toEqual([]) - }) - - it('handles single element array', () => { - const result = multiSortBy([{ v: 1 }], [(d) => d.v]) - expect(result).toEqual([{ v: 1 }]) - }) - - it('uses default accessor when none provided', () => { - const arr = [3, 1, 2] - const result = multiSortBy(arr) - expect(result).toEqual([1, 2, 3]) - }) - - it('sorts strings correctly', () => { - const arr = [{ s: 'c' }, { s: 'a' }, { s: 'b' }] - const result = multiSortBy(arr, [(d) => d.s]) - expect(result.map((d) => d.s)).toEqual(['a', 'b', 'c']) - }) - - it('handles negative numbers in accessors for reverse sort', () => { - const arr = [{ v: 1 }, { v: 3 }, { v: 2 }] - const result = multiSortBy(arr, [(d) => -d.v]) - expect(result.map((d) => d.v)).toEqual([3, 2, 1]) - }) -}) - -describe.each([ - { nonNested: true, mode: 'experimental nonNestedPaths' }, - { nonNested: false, mode: 'default' }, -])('determineInitialRoutePath - $mode', ({ nonNested }) => { - const config = { - experimental: { - nonNestedRoutes: nonNested, - }, - routeToken: 'route', - indexToken: 'index', - } - +describe('determineInitialRoutePath', () => { it('removes dots and adds slashes', () => { - expect(determineInitialRoutePath('test.test', config)).toStrictEqual({ + expect(determineInitialRoutePath('test.test')).toStrictEqual({ routePath: '/test/test', - isExperimentalNonNestedRoute: false, originalRoutePath: '/test/test', }) }) it('keeps leading slash', () => { - expect(determineInitialRoutePath('/test.test', config)).toStrictEqual({ + expect(determineInitialRoutePath('/test.test')).toStrictEqual({ routePath: '/test/test', - isExperimentalNonNestedRoute: false, originalRoutePath: '/test/test', }) }) it('keeps trailing slash', () => { - expect(determineInitialRoutePath('test.test/', config)).toStrictEqual({ + expect(determineInitialRoutePath('test.test/')).toStrictEqual({ routePath: '/test/test/', - isExperimentalNonNestedRoute: false, originalRoutePath: '/test/test/', }) }) it('removes dots and adds slashes with leading and trailing slashes', () => { - expect(determineInitialRoutePath('/test.test/', config)).toStrictEqual({ + expect(determineInitialRoutePath('/test.test/')).toStrictEqual({ routePath: '/test/test/', - isExperimentalNonNestedRoute: false, originalRoutePath: '/test/test/', }) }) it("returns '/' if path is empty", () => { - expect(determineInitialRoutePath('', config)).toStrictEqual({ + expect(determineInitialRoutePath('')).toStrictEqual({ routePath: '/', - isExperimentalNonNestedRoute: false, originalRoutePath: '/', }) }) it("returns '/' if path is '.'", () => { - expect(determineInitialRoutePath('.', config)).toStrictEqual({ + expect(determineInitialRoutePath('.')).toStrictEqual({ routePath: '/', - isExperimentalNonNestedRoute: false, originalRoutePath: '/', }) }) it("returns '/' if path is './'", () => { - expect(determineInitialRoutePath('./', config)).toStrictEqual({ + expect(determineInitialRoutePath('./')).toStrictEqual({ routePath: '/', - isExperimentalNonNestedRoute: false, originalRoutePath: '/', }) }) @@ -158,7 +72,7 @@ describe.each([ it('errors on disallowed escaped character', () => { const consoleSpy = vi.spyOn(console, 'error') - expect(() => determineInitialRoutePath('/a[/]', config)).toThrowError() + expect(() => determineInitialRoutePath('/a[/]')).toThrowError() expect(consoleSpy).toBeCalledWith( 'Error: Disallowed character "/" found in square brackets in route path "/a[/]".\n' + @@ -170,77 +84,122 @@ describe.each([ }) it('escapes characters correctly', () => { - expect(determineInitialRoutePath('/a[.]', config)).toStrictEqual({ + expect(determineInitialRoutePath('/a[.]')).toStrictEqual({ routePath: '/a.', - isExperimentalNonNestedRoute: false, originalRoutePath: '/a[.]', }) - expect(determineInitialRoutePath('/a[_]', config)).toStrictEqual({ + expect(determineInitialRoutePath('/a[_]')).toStrictEqual({ routePath: '/a_', - isExperimentalNonNestedRoute: false, originalRoutePath: '/a[_]', }) }) - // this is changed with experimental non-nested paths. - // currently trailing underscores are not removed - // with experimental non-nested paths this is removed to allow escaped '_' to be processed correctly later it('should handle trailing underscores correctly', () => { - expect(determineInitialRoutePath('a_', config)).toStrictEqual({ - routePath: `/a${nonNested ? '' : '_'}`, - isExperimentalNonNestedRoute: nonNested, + expect(determineInitialRoutePath('a_')).toStrictEqual({ + routePath: `/a_`, originalRoutePath: '/a_', }) - expect(determineInitialRoutePath('a_.route', config)).toStrictEqual({ - routePath: `/a${nonNested ? '' : '_'}/route`, - isExperimentalNonNestedRoute: nonNested, + expect(determineInitialRoutePath('a_.route')).toStrictEqual({ + routePath: `/a_/route`, originalRoutePath: '/a_/route', }) - expect(determineInitialRoutePath('a_.b.c', config)).toStrictEqual({ - routePath: `/a${nonNested ? '' : '_'}/b/c`, - isExperimentalNonNestedRoute: nonNested, + expect(determineInitialRoutePath('a_.b.c')).toStrictEqual({ + routePath: `/a_/b/c`, originalRoutePath: '/a_/b/c', }) - expect(determineInitialRoutePath('a.b_.c.d', config)).toStrictEqual({ - routePath: `/a/b${nonNested ? '' : '_'}/c/d`, - isExperimentalNonNestedRoute: nonNested, + expect(determineInitialRoutePath('a.b_.c.d')).toStrictEqual({ + routePath: `/a/b_/c/d`, originalRoutePath: '/a/b_/c/d', }) - expect(determineInitialRoutePath('a_.route.b', config)).toStrictEqual({ - routePath: `/a${nonNested ? '' : '_'}/route/b`, - isExperimentalNonNestedRoute: false, + expect(determineInitialRoutePath('a_.route.b')).toStrictEqual({ + routePath: `/a_/route/b`, originalRoutePath: '/a_/route/b', }) - expect( - determineInitialRoutePath('/a_/_route_/b_/c/d[_]', { - ...config, - routeToken: 'route', - }), - ).toStrictEqual({ - routePath: `/a${nonNested ? '' : '_'}/_route${nonNested ? '' : '_'}/b${nonNested ? '' : '_'}/c/d_`, - isExperimentalNonNestedRoute: nonNested, + expect(determineInitialRoutePath('/a_/_route_/b_/c/d[_]')).toStrictEqual({ + routePath: `/a_/_route_/b_/c/d_`, originalRoutePath: '/a_/_route_/b_/c/d[_]', }) - expect( - determineInitialRoutePath('/a_/_route_/b_/c/d[_]', { - ...config, - routeToken: '_route_', - }), - ).toStrictEqual({ - routePath: `/a${nonNested ? '' : '_'}/_route_/b${nonNested ? '' : '_'}/c/d_`, - isExperimentalNonNestedRoute: nonNested, + expect(determineInitialRoutePath('/a_/_route_/b_/c/d[_]')).toStrictEqual({ + routePath: `/a_/_route_/b_/c/d_`, originalRoutePath: '/a_/_route_/b_/c/d[_]', }) }) }) +describe('multiSortBy', () => { + it('sorts by single accessor', () => { + const arr = [{ v: 3 }, { v: 1 }, { v: 2 }] + const result = multiSortBy(arr, [(d) => d.v]) + expect(result.map((d) => d.v)).toEqual([1, 2, 3]) + }) + + it('sorts by multiple accessors', () => { + const arr = [ + { a: 2, b: 1 }, + { a: 1, b: 2 }, + { a: 1, b: 1 }, + ] + const result = multiSortBy(arr, [(d) => d.a, (d) => d.b]) + expect(result).toEqual([ + { a: 1, b: 1 }, + { a: 1, b: 2 }, + { a: 2, b: 1 }, + ]) + }) + + it('preserves original order for equal elements', () => { + const arr = [ + { a: 1, id: 'first' }, + { a: 1, id: 'second' }, + { a: 1, id: 'third' }, + ] + const result = multiSortBy(arr, [(d) => d.a]) + expect(result.map((d) => d.id)).toEqual(['first', 'second', 'third']) + }) + + it('handles undefined values', () => { + const arr = [{ v: 1 }, { v: undefined }, { v: 2 }] + const result = multiSortBy(arr, [(d) => d.v]) + // undefined sorts to end + expect(result.map((d) => d.v)).toEqual([1, 2, undefined]) + }) + + it('handles empty array', () => { + const result = multiSortBy([], [(d) => d]) + expect(result).toEqual([]) + }) + + it('handles single element array', () => { + const result = multiSortBy([{ v: 1 }], [(d) => d.v]) + expect(result).toEqual([{ v: 1 }]) + }) + + it('uses default accessor when none provided', () => { + const arr = [3, 1, 2] + const result = multiSortBy(arr) + expect(result).toEqual([1, 2, 3]) + }) + + it('sorts strings correctly', () => { + const arr = [{ s: 'c' }, { s: 'a' }, { s: 'b' }] + const result = multiSortBy(arr, [(d) => d.s]) + expect(result.map((d) => d.s)).toEqual(['a', 'b', 'c']) + }) + + it('handles negative numbers in accessors for reverse sort', () => { + const arr = [{ v: 1 }, { v: 3 }, { v: 2 }] + const result = multiSortBy(arr, [(d) => -d.v]) + expect(result.map((d) => d.v)).toEqual([3, 2, 1]) + }) +}) + describe('multiSortBy', () => { it('sorts by multiple criteria', () => { const data = [ @@ -438,40 +397,6 @@ describe('mergeImportDeclarations', () => { }) }) -describe('isValidNonNestedRoute', () => { - const config = { - experimental: { - nonNestedRoutes: true, - }, - routeToken: 'route', - indexToken: 'index', - } - - it('should identify valid non-nested routes', () => { - expect(isValidNonNestedRoute('/a_', config)).toBe(true) - expect(isValidNonNestedRoute('/a/b_', config)).toBe(true) - expect(isValidNonNestedRoute('/a_/route', config)).toBe(true) - expect(isValidNonNestedRoute('/a/route/b_', config)).toBe(true) - expect(isValidNonNestedRoute('/a_/b', config)).toBe(true) - }) - - it('should identify invalid non-nested routes', () => { - expect(isValidNonNestedRoute('/a', config)).toBe(false) - expect(isValidNonNestedRoute('/a/b', config)).toBe(false) - expect(isValidNonNestedRoute('/a/route/false', config)).toBe(false) - expect(isValidNonNestedRoute('/a_/route/b', config)).toBe(false) - }) - - it('should return false if not enabled', () => { - expect( - isValidNonNestedRoute('/a_', { - ...config, - experimental: { nonNestedRoutes: false }, - }), - ).toBe(false) - }) -}) - describe('RoutePrefixMap', () => { const createRoute = ( overrides: Partial & { routePath: string }, @@ -583,107 +508,4 @@ describe('RoutePrefixMap', () => { expect(map.findParent('/users')).toBeNull() }) }) - - describe('findParentForNonNested', () => { - it('finds other non-nested route as parent', () => { - const nonNestedParent = createRoute({ - routePath: '/app/users', - originalRoutePath: '/app_/users', - _isExperimentalNonNestedRoute: true, - }) - const map = new RoutePrefixMap([nonNestedParent]) - - // originalRoutePath must start with parent's originalRoutePath + '/' - const result = map.findParentForNonNested( - '/app/users/profile', - '/app_/users/profile', - [], - ) - expect(result).toBe(nonNestedParent) - }) - - it('finds layout route as parent for non-nested', () => { - const layout = createRoute({ - routePath: '/app', - _fsRouteType: 'layout', - }) - const map = new RoutePrefixMap([layout]) - - const result = map.findParentForNonNested('/app/users', '/app_/users', []) - expect(result).toBe(layout) - }) - - it('skips root layout route', () => { - const rootLayout = createRoute({ - routePath: '/', - _fsRouteType: 'layout', - }) - const map = new RoutePrefixMap([rootLayout]) - - const result = map.findParentForNonNested('/users', '/users_', []) - expect(result).toBeNull() - }) - - it('skips layout routes matching non-nested segments', () => { - const layout = createRoute({ - routePath: '/app', - originalRoutePath: '/app', - _fsRouteType: 'layout', - }) - const map = new RoutePrefixMap([layout]) - - const result = map.findParentForNonNested('/app/users', '/app_/users', [ - '/app_', - ]) - expect(result).toBeNull() - }) - - it('returns null when no suitable parent', () => { - const map = new RoutePrefixMap([]) - - const result = map.findParentForNonNested('/users', '/users_', []) - expect(result).toBeNull() - }) - - it('finds longest matching non-nested parent when multiple exist', () => { - const parentRoute = createRoute({ - routePath: '/non-nested/deep/$baz/bar', - originalRoutePath: '/non-nested/deep/$baz_/bar', - _isExperimentalNonNestedRoute: true, - }) - const grandparentRoute = createRoute({ - routePath: '/non-nested/deep/$baz', - originalRoutePath: '/non-nested/deep/$baz', - _fsRouteType: 'layout', - }) - const map = new RoutePrefixMap([grandparentRoute, parentRoute]) - - // Child route should find the closest non-nested parent - const result = map.findParentForNonNested( - '/non-nested/deep/$baz/bar/$foo', - '/non-nested/deep/$baz_/bar/$foo', - ['/non-nested/deep/$baz_'], - ) - expect(result).toBe(parentRoute) - }) - - it('correctly handles index vs route distinction via parent matching', () => { - // Simulates route.tsx and index.tsx for same path prefix - const layoutRoute = createRoute({ - routePath: '/non-nested/deep/$baz/bar/$foo', - originalRoutePath: '/non-nested/deep/$baz_/bar/$foo', - _isExperimentalNonNestedRoute: true, - _fsRouteType: 'layout', - }) - const map = new RoutePrefixMap([layoutRoute]) - - // Index route looking for parent should find layout - const result = map.findParentForNonNested( - '/non-nested/deep/$baz/bar/$foo/', - '/non-nested/deep/$baz_/bar/$foo/', - ['/non-nested/deep/$baz_'], - ) - expect(result).toBe(layoutRoute) - }) - }) }) From 31fb5cc9ccb78b6654cdf1a50ee20c155f7be47c Mon Sep 17 00:00:00 2001 From: Nico Lynzaad Date: Sat, 20 Dec 2025 13:30:37 +0200 Subject: [PATCH 3/5] add underscore to list of disallowed escaped characters --- packages/router-generator/src/utils.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/router-generator/src/utils.ts b/packages/router-generator/src/utils.ts index 5aca3af56a2..9d9e58286bd 100644 --- a/packages/router-generator/src/utils.ts +++ b/packages/router-generator/src/utils.ts @@ -154,6 +154,7 @@ export function determineInitialRoutePath(routePath: string) { '!', '$', '%', + '_', ]) const originalRoutePath = From 7169ff3028d896120136e13d1e1f4179409c2a6c Mon Sep 17 00:00:00 2001 From: Nico Lynzaad Date: Sat, 20 Dec 2025 13:30:47 +0200 Subject: [PATCH 4/5] update docs --- .../react/routing/file-naming-conventions.md | 3 -- .../react/routing/routing-concepts.md | 34 ------------------- 2 files changed, 37 deletions(-) diff --git a/docs/router/framework/react/routing/file-naming-conventions.md b/docs/router/framework/react/routing/file-naming-conventions.md index 7923809bd61..9ea52459783 100644 --- a/docs/router/framework/react/routing/file-naming-conventions.md +++ b/docs/router/framework/react/routing/file-naming-conventions.md @@ -19,9 +19,6 @@ File-based routing requires that you follow a few simple file naming conventions > **💡 Remember:** The file-naming conventions for your project could be affected by what [options](../../../api/file-based-routing.md) are configured. -> [!NOTE] -> To escape a trailing underscore, for example `/posts[_].tsx`, usage of the upgraded [Non-Nested Routes](./routing-concepts#non-nested-routes) is required. - ## Dynamic Path Params Dynamic 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: diff --git a/docs/router/framework/react/routing/routing-concepts.md b/docs/router/framework/react/routing/routing-concepts.md index 21020b1ed14..139ce34913a 100644 --- a/docs/router/framework/react/routing/routing-concepts.md +++ b/docs/router/framework/react/routing/routing-concepts.md @@ -352,40 +352,6 @@ The following table shows which component will be rendered based on the URL: - The `posts.$postId.tsx` route is nested as normal under the `posts.tsx` route and will render ``. - 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 ``. -> [!NOTE] -> While using non-nested routes with file-based routing already works brilliantly, it might misbehave in certain conditions. -> Many of these limitations have already been addressed and will be released in the next major version of TanStack Router. -> -> To start enjoying these benefits early, you can enable the experimental `nonNestedRoutes` flag in the router plugin configuration: -> -> ```ts -> export default defineConfig({ -> plugins: [ -> tanstackRouter({ -> // some config, -> experimental: { -> nonNestedRoutes: true, -> }, -> }), -> ], -> }) -> ``` -> -> _It is important to note that this does bring a slight change in how non-nested routes are referenced in useParams, useNavigate, etc. For this reason this has been released as a feature flag. -> The trailing underscore is no longer expected in the path:_ -> -> Previously: -> -> ```ts -> useParams({ from: '/posts_/$postId/edit' }) -> ``` -> -> Now: -> -> ```ts -> useParams({ from: '/posts/$postId/edit' }) -> ``` - ## Excluding Files and Folders from Routes Files 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. From 12d9acd91895fcf6ff682f6a607971811c6d270f Mon Sep 17 00:00:00 2001 From: Nico Lynzaad Date: Sat, 20 Dec 2025 13:48:44 +0200 Subject: [PATCH 5/5] fix tests --- packages/router-generator/tests/utils.test.ts | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/packages/router-generator/tests/utils.test.ts b/packages/router-generator/tests/utils.test.ts index b6acd86825b..c556edeaf55 100644 --- a/packages/router-generator/tests/utils.test.ts +++ b/packages/router-generator/tests/utils.test.ts @@ -76,7 +76,7 @@ describe('determineInitialRoutePath', () => { expect(consoleSpy).toBeCalledWith( 'Error: Disallowed character "/" found in square brackets in route path "/a[/]".\n' + - 'You cannot use any of the following characters in square brackets: /, \\, ?, #, :, *, <, >, |, !, $, %\n' + + 'You cannot use any of the following characters in square brackets: /, \\, ?, #, :, *, <, >, |, !, $, %, _\n' + 'Please remove and/or replace them.', ) @@ -88,11 +88,6 @@ describe('determineInitialRoutePath', () => { routePath: '/a.', originalRoutePath: '/a[.]', }) - - expect(determineInitialRoutePath('/a[_]')).toStrictEqual({ - routePath: '/a_', - originalRoutePath: '/a[_]', - }) }) it('should handle trailing underscores correctly', () => { @@ -120,16 +115,6 @@ describe('determineInitialRoutePath', () => { routePath: `/a_/route/b`, originalRoutePath: '/a_/route/b', }) - - expect(determineInitialRoutePath('/a_/_route_/b_/c/d[_]')).toStrictEqual({ - routePath: `/a_/_route_/b_/c/d_`, - originalRoutePath: '/a_/_route_/b_/c/d[_]', - }) - - expect(determineInitialRoutePath('/a_/_route_/b_/c/d[_]')).toStrictEqual({ - routePath: `/a_/_route_/b_/c/d_`, - originalRoutePath: '/a_/_route_/b_/c/d[_]', - }) }) })