diff --git a/e2e/react-router/basic-file-based-code-splitting/src/routeTree.gen.ts b/e2e/react-router/basic-file-based-code-splitting/src/routeTree.gen.ts index 442312342af..b90c69bd5f4 100644 --- a/e2e/react-router/basic-file-based-code-splitting/src/routeTree.gen.ts +++ b/e2e/react-router/basic-file-based-code-splitting/src/routeTree.gen.ts @@ -8,8 +8,6 @@ // 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 WithoutLoaderRouteImport } from './routes/without-loader' import { Route as ViewportTestRouteImport } from './routes/viewport-test' @@ -220,97 +218,6 @@ declare module '@tanstack/react-router' { } } -declare module './routes/index' { - const createFileRoute: CreateFileRoute< - '/', - FileRoutesByPath['/']['parentRoute'], - FileRoutesByPath['/']['id'], - FileRoutesByPath['/']['path'], - FileRoutesByPath['/']['fullPath'] - > -} -declare module './routes/_layout' { - const createFileRoute: CreateFileRoute< - '/_layout', - FileRoutesByPath['/_layout']['parentRoute'], - FileRoutesByPath['/_layout']['id'], - FileRoutesByPath['/_layout']['path'], - FileRoutesByPath['/_layout']['fullPath'] - > -} -declare module './routes/posts' { - const createFileRoute: CreateFileRoute< - '/posts', - FileRoutesByPath['/posts']['parentRoute'], - FileRoutesByPath['/posts']['id'], - FileRoutesByPath['/posts']['path'], - FileRoutesByPath['/posts']['fullPath'] - > -} -declare module './routes/viewport-test' { - const createFileRoute: CreateFileRoute< - '/viewport-test', - FileRoutesByPath['/viewport-test']['parentRoute'], - FileRoutesByPath['/viewport-test']['id'], - FileRoutesByPath['/viewport-test']['path'], - FileRoutesByPath['/viewport-test']['fullPath'] - > -} -declare module './routes/without-loader' { - const createFileRoute: CreateFileRoute< - '/without-loader', - FileRoutesByPath['/without-loader']['parentRoute'], - FileRoutesByPath['/without-loader']['id'], - FileRoutesByPath['/without-loader']['path'], - FileRoutesByPath['/without-loader']['fullPath'] - > -} -declare module './routes/_layout/_layout-2' { - const createFileRoute: CreateFileRoute< - '/_layout/_layout-2', - FileRoutesByPath['/_layout/_layout-2']['parentRoute'], - FileRoutesByPath['/_layout/_layout-2']['id'], - FileRoutesByPath['/_layout/_layout-2']['path'], - FileRoutesByPath['/_layout/_layout-2']['fullPath'] - > -} -declare module './routes/posts.$postId' { - const createFileRoute: CreateFileRoute< - '/posts/$postId', - FileRoutesByPath['/posts/$postId']['parentRoute'], - FileRoutesByPath['/posts/$postId']['id'], - FileRoutesByPath['/posts/$postId']['path'], - FileRoutesByPath['/posts/$postId']['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/_layout/_layout-2/layout-a' { - const createFileRoute: CreateFileRoute< - '/_layout/_layout-2/layout-a', - FileRoutesByPath['/_layout/_layout-2/layout-a']['parentRoute'], - FileRoutesByPath['/_layout/_layout-2/layout-a']['id'], - FileRoutesByPath['/_layout/_layout-2/layout-a']['path'], - FileRoutesByPath['/_layout/_layout-2/layout-a']['fullPath'] - > -} -declare module './routes/_layout/_layout-2/layout-b' { - const createFileRoute: CreateFileRoute< - '/_layout/_layout-2/layout-b', - FileRoutesByPath['/_layout/_layout-2/layout-b']['parentRoute'], - FileRoutesByPath['/_layout/_layout-2/layout-b']['id'], - FileRoutesByPath['/_layout/_layout-2/layout-b']['path'], - FileRoutesByPath['/_layout/_layout-2/layout-b']['fullPath'] - > -} - interface LayoutLayout2RouteChildren { LayoutLayout2LayoutARoute: typeof LayoutLayout2LayoutARoute LayoutLayout2LayoutBRoute: typeof LayoutLayout2LayoutBRoute diff --git a/e2e/react-router/basic-file-based-code-splitting/src/routes/_layout.tsx b/e2e/react-router/basic-file-based-code-splitting/src/routes/_layout.tsx index 5c4a461d8d9..02ddbb1cd94 100644 --- a/e2e/react-router/basic-file-based-code-splitting/src/routes/_layout.tsx +++ b/e2e/react-router/basic-file-based-code-splitting/src/routes/_layout.tsx @@ -1,6 +1,6 @@ -import { Outlet } from '@tanstack/react-router' +import { Outlet, createFileRoute } from '@tanstack/react-router' -export const Route = createFileRoute({ +export const Route = createFileRoute('/_layout')({ component: LayoutComponent, }) diff --git a/e2e/react-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2.tsx b/e2e/react-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2.tsx index 483b910862b..3b7dbf29031 100644 --- a/e2e/react-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2.tsx +++ b/e2e/react-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2.tsx @@ -1,6 +1,6 @@ -import { Link, Outlet } from '@tanstack/react-router' +import { Link, Outlet, createFileRoute } from '@tanstack/react-router' -export const Route = createFileRoute({ +export const Route = createFileRoute('/_layout/_layout-2')({ component: LayoutComponent, }) diff --git a/e2e/react-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2/layout-a.tsx b/e2e/react-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2/layout-a.tsx index a190b242028..ed2dea88006 100644 --- a/e2e/react-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2/layout-a.tsx +++ b/e2e/react-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2/layout-a.tsx @@ -1,4 +1,5 @@ -export const Route = createFileRoute({ +import { createFileRoute } from '@tanstack/react-router' +export const Route = createFileRoute('/_layout/_layout-2/layout-a')({ component: LayoutAComponent, }) diff --git a/e2e/react-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2/layout-b.tsx b/e2e/react-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2/layout-b.tsx index 505f8f6fbf8..4799d403e91 100644 --- a/e2e/react-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2/layout-b.tsx +++ b/e2e/react-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2/layout-b.tsx @@ -1,4 +1,5 @@ -export const Route = createFileRoute({ +import { createFileRoute } from '@tanstack/react-router' +export const Route = createFileRoute('/_layout/_layout-2/layout-b')({ component: LayoutBComponent, }) diff --git a/e2e/react-router/basic-file-based-code-splitting/src/routes/index.tsx b/e2e/react-router/basic-file-based-code-splitting/src/routes/index.tsx index b23956ae17a..0a5b7572ba2 100644 --- a/e2e/react-router/basic-file-based-code-splitting/src/routes/index.tsx +++ b/e2e/react-router/basic-file-based-code-splitting/src/routes/index.tsx @@ -1,6 +1,7 @@ +import { createFileRoute } from '@tanstack/react-router' import * as React from 'react' -export const Route = createFileRoute({ +export const Route = createFileRoute('/')({ component: Home, }) diff --git a/e2e/react-router/basic-file-based-code-splitting/src/routes/posts.$postId.tsx b/e2e/react-router/basic-file-based-code-splitting/src/routes/posts.$postId.tsx index 805fa37ed3c..47d1148be22 100644 --- a/e2e/react-router/basic-file-based-code-splitting/src/routes/posts.$postId.tsx +++ b/e2e/react-router/basic-file-based-code-splitting/src/routes/posts.$postId.tsx @@ -1,9 +1,9 @@ import * as React from 'react' -import { ErrorComponent } from '@tanstack/react-router' +import { ErrorComponent, createFileRoute } from '@tanstack/react-router' import { fetchPost } from '../posts' import type { ErrorComponentProps } from '@tanstack/react-router' -export const Route = createFileRoute({ +export const Route = createFileRoute('/posts/$postId')({ loader: async ({ params: { postId } }) => fetchPost(postId), errorComponent: PostErrorComponent as any, notFoundComponent: () => { diff --git a/e2e/react-router/basic-file-based-code-splitting/src/routes/posts.index.tsx b/e2e/react-router/basic-file-based-code-splitting/src/routes/posts.index.tsx index fdbe5865e58..c6b65f18923 100644 --- a/e2e/react-router/basic-file-based-code-splitting/src/routes/posts.index.tsx +++ b/e2e/react-router/basic-file-based-code-splitting/src/routes/posts.index.tsx @@ -1,6 +1,7 @@ +import { createFileRoute } from '@tanstack/react-router' import * as React from 'react' -export const Route = createFileRoute({ +export const Route = createFileRoute('/posts/')({ component: PostsIndexComponent, }) diff --git a/e2e/react-router/basic-file-based-code-splitting/src/routes/posts.tsx b/e2e/react-router/basic-file-based-code-splitting/src/routes/posts.tsx index 4469b2216ab..c7a09ed7f82 100644 --- a/e2e/react-router/basic-file-based-code-splitting/src/routes/posts.tsx +++ b/e2e/react-router/basic-file-based-code-splitting/src/routes/posts.tsx @@ -1,8 +1,8 @@ import * as React from 'react' -import { Link, Outlet } from '@tanstack/react-router' +import { Link, Outlet, createFileRoute } from '@tanstack/react-router' import { fetchPosts } from '../posts' -export const Route = createFileRoute({ +export const Route = createFileRoute('/posts')({ loader: fetchPosts, component: PostsComponent, }) diff --git a/e2e/react-router/basic-file-based-code-splitting/src/routes/viewport-test.tsx b/e2e/react-router/basic-file-based-code-splitting/src/routes/viewport-test.tsx index b182feb7b15..81fd50c98b9 100644 --- a/e2e/react-router/basic-file-based-code-splitting/src/routes/viewport-test.tsx +++ b/e2e/react-router/basic-file-based-code-splitting/src/routes/viewport-test.tsx @@ -1,3 +1,4 @@ -export const Route = createFileRoute({ +import { createFileRoute } from '@tanstack/react-router' +export const Route = createFileRoute('/viewport-test')({ component: () =>
Hello /viewport-test!
, }) diff --git a/e2e/react-router/basic-file-based-code-splitting/src/routes/without-loader.tsx b/e2e/react-router/basic-file-based-code-splitting/src/routes/without-loader.tsx index af692bdaca3..a4f4fac74e1 100644 --- a/e2e/react-router/basic-file-based-code-splitting/src/routes/without-loader.tsx +++ b/e2e/react-router/basic-file-based-code-splitting/src/routes/without-loader.tsx @@ -1,3 +1,4 @@ -export const Route = createFileRoute({ +import { createFileRoute } from '@tanstack/react-router' +export const Route = createFileRoute('/without-loader')({ component: () =>
Hello /without-loader!
, }) diff --git a/e2e/react-router/basic-react-query-file-based/src/routeTree.gen.ts b/e2e/react-router/basic-react-query-file-based/src/routeTree.gen.ts index 88ecb63891b..170a6beadb7 100644 --- a/e2e/react-router/basic-react-query-file-based/src/routeTree.gen.ts +++ b/e2e/react-router/basic-react-query-file-based/src/routeTree.gen.ts @@ -15,7 +15,6 @@ import { Route as IndexRouteImport } from './routes/index' import { Route as PostsIndexRouteImport } from './routes/posts.index' import { Route as PostsPostIdRouteImport } from './routes/posts.$postId' import { Route as LayoutLayout2RouteImport } from './routes/_layout/_layout-2' -import { Route as TransitionCountQueryRouteImport } from './routes/transition/count/query' import { Route as LayoutLayout2LayoutBRouteImport } from './routes/_layout/_layout-2/layout-b' import { Route as LayoutLayout2LayoutARouteImport } from './routes/_layout/_layout-2/layout-a' @@ -47,11 +46,6 @@ const LayoutLayout2Route = LayoutLayout2RouteImport.update({ id: '/_layout-2', getParentRoute: () => LayoutRoute, } as any) -const TransitionCountQueryRoute = TransitionCountQueryRouteImport.update({ - id: '/transition/count/query', - path: '/transition/count/query', - getParentRoute: () => rootRouteImport, -} as any) const LayoutLayout2LayoutBRoute = LayoutLayout2LayoutBRouteImport.update({ id: '/layout-b', path: '/layout-b', @@ -70,7 +64,6 @@ export interface FileRoutesByFullPath { '/posts/': typeof PostsIndexRoute '/layout-a': typeof LayoutLayout2LayoutARoute '/layout-b': typeof LayoutLayout2LayoutBRoute - '/transition/count/query': typeof TransitionCountQueryRoute } export interface FileRoutesByTo { '/': typeof IndexRoute @@ -78,7 +71,6 @@ export interface FileRoutesByTo { '/posts': typeof PostsIndexRoute '/layout-a': typeof LayoutLayout2LayoutARoute '/layout-b': typeof LayoutLayout2LayoutBRoute - '/transition/count/query': typeof TransitionCountQueryRoute } export interface FileRoutesById { __root__: typeof rootRouteImport @@ -90,7 +82,6 @@ export interface FileRoutesById { '/posts/': typeof PostsIndexRoute '/_layout/_layout-2/layout-a': typeof LayoutLayout2LayoutARoute '/_layout/_layout-2/layout-b': typeof LayoutLayout2LayoutBRoute - '/transition/count/query': typeof TransitionCountQueryRoute } export interface FileRouteTypes { fileRoutesByFullPath: FileRoutesByFullPath @@ -101,15 +92,8 @@ export interface FileRouteTypes { | '/posts/' | '/layout-a' | '/layout-b' - | '/transition/count/query' fileRoutesByTo: FileRoutesByTo - to: - | '/' - | '/posts/$postId' - | '/posts' - | '/layout-a' - | '/layout-b' - | '/transition/count/query' + to: '/' | '/posts/$postId' | '/posts' | '/layout-a' | '/layout-b' id: | '__root__' | '/' @@ -120,14 +104,12 @@ export interface FileRouteTypes { | '/posts/' | '/_layout/_layout-2/layout-a' | '/_layout/_layout-2/layout-b' - | '/transition/count/query' fileRoutesById: FileRoutesById } export interface RootRouteChildren { IndexRoute: typeof IndexRoute LayoutRoute: typeof LayoutRouteWithChildren PostsRoute: typeof PostsRouteWithChildren - TransitionCountQueryRoute: typeof TransitionCountQueryRoute } declare module '@tanstack/react-router' { @@ -174,13 +156,6 @@ declare module '@tanstack/react-router' { preLoaderRoute: typeof LayoutLayout2RouteImport parentRoute: typeof LayoutRoute } - '/transition/count/query': { - id: '/transition/count/query' - path: '/transition/count/query' - fullPath: '/transition/count/query' - preLoaderRoute: typeof TransitionCountQueryRouteImport - parentRoute: typeof rootRouteImport - } '/_layout/_layout-2/layout-b': { id: '/_layout/_layout-2/layout-b' path: '/layout-b' @@ -239,7 +214,6 @@ const rootRouteChildren: RootRouteChildren = { IndexRoute: IndexRoute, LayoutRoute: LayoutRouteWithChildren, PostsRoute: PostsRouteWithChildren, - TransitionCountQueryRoute: TransitionCountQueryRoute, } export const routeTree = rootRouteImport ._addFileChildren(rootRouteChildren) diff --git a/e2e/solid-router/basic-file-based-code-splitting/src/routeTree.gen.ts b/e2e/solid-router/basic-file-based-code-splitting/src/routeTree.gen.ts index f52487e717b..4cdb554efff 100644 --- a/e2e/solid-router/basic-file-based-code-splitting/src/routeTree.gen.ts +++ b/e2e/solid-router/basic-file-based-code-splitting/src/routeTree.gen.ts @@ -8,8 +8,6 @@ // 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/solid-router' - import { Route as rootRouteImport } from './routes/__root' import { Route as WithoutLoaderRouteImport } from './routes/without-loader' import { Route as ViewportTestRouteImport } from './routes/viewport-test' @@ -220,97 +218,6 @@ declare module '@tanstack/solid-router' { } } -declare module './routes/index' { - const createFileRoute: CreateFileRoute< - '/', - FileRoutesByPath['/']['parentRoute'], - FileRoutesByPath['/']['id'], - FileRoutesByPath['/']['path'], - FileRoutesByPath['/']['fullPath'] - > -} -declare module './routes/_layout' { - const createFileRoute: CreateFileRoute< - '/_layout', - FileRoutesByPath['/_layout']['parentRoute'], - FileRoutesByPath['/_layout']['id'], - FileRoutesByPath['/_layout']['path'], - FileRoutesByPath['/_layout']['fullPath'] - > -} -declare module './routes/posts' { - const createFileRoute: CreateFileRoute< - '/posts', - FileRoutesByPath['/posts']['parentRoute'], - FileRoutesByPath['/posts']['id'], - FileRoutesByPath['/posts']['path'], - FileRoutesByPath['/posts']['fullPath'] - > -} -declare module './routes/viewport-test' { - const createFileRoute: CreateFileRoute< - '/viewport-test', - FileRoutesByPath['/viewport-test']['parentRoute'], - FileRoutesByPath['/viewport-test']['id'], - FileRoutesByPath['/viewport-test']['path'], - FileRoutesByPath['/viewport-test']['fullPath'] - > -} -declare module './routes/without-loader' { - const createFileRoute: CreateFileRoute< - '/without-loader', - FileRoutesByPath['/without-loader']['parentRoute'], - FileRoutesByPath['/without-loader']['id'], - FileRoutesByPath['/without-loader']['path'], - FileRoutesByPath['/without-loader']['fullPath'] - > -} -declare module './routes/_layout/_layout-2' { - const createFileRoute: CreateFileRoute< - '/_layout/_layout-2', - FileRoutesByPath['/_layout/_layout-2']['parentRoute'], - FileRoutesByPath['/_layout/_layout-2']['id'], - FileRoutesByPath['/_layout/_layout-2']['path'], - FileRoutesByPath['/_layout/_layout-2']['fullPath'] - > -} -declare module './routes/posts.$postId' { - const createFileRoute: CreateFileRoute< - '/posts/$postId', - FileRoutesByPath['/posts/$postId']['parentRoute'], - FileRoutesByPath['/posts/$postId']['id'], - FileRoutesByPath['/posts/$postId']['path'], - FileRoutesByPath['/posts/$postId']['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/_layout/_layout-2/layout-a' { - const createFileRoute: CreateFileRoute< - '/_layout/_layout-2/layout-a', - FileRoutesByPath['/_layout/_layout-2/layout-a']['parentRoute'], - FileRoutesByPath['/_layout/_layout-2/layout-a']['id'], - FileRoutesByPath['/_layout/_layout-2/layout-a']['path'], - FileRoutesByPath['/_layout/_layout-2/layout-a']['fullPath'] - > -} -declare module './routes/_layout/_layout-2/layout-b' { - const createFileRoute: CreateFileRoute< - '/_layout/_layout-2/layout-b', - FileRoutesByPath['/_layout/_layout-2/layout-b']['parentRoute'], - FileRoutesByPath['/_layout/_layout-2/layout-b']['id'], - FileRoutesByPath['/_layout/_layout-2/layout-b']['path'], - FileRoutesByPath['/_layout/_layout-2/layout-b']['fullPath'] - > -} - interface LayoutLayout2RouteChildren { LayoutLayout2LayoutARoute: typeof LayoutLayout2LayoutARoute LayoutLayout2LayoutBRoute: typeof LayoutLayout2LayoutBRoute diff --git a/e2e/solid-router/basic-file-based-code-splitting/src/routes/_layout.tsx b/e2e/solid-router/basic-file-based-code-splitting/src/routes/_layout.tsx index c5491756389..d43b4ef5f5e 100644 --- a/e2e/solid-router/basic-file-based-code-splitting/src/routes/_layout.tsx +++ b/e2e/solid-router/basic-file-based-code-splitting/src/routes/_layout.tsx @@ -1,6 +1,6 @@ -import { Outlet } from '@tanstack/solid-router' +import { Outlet, createFileRoute } from '@tanstack/solid-router' -export const Route = createFileRoute({ +export const Route = createFileRoute('/_layout')({ component: LayoutComponent, }) diff --git a/e2e/solid-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2.tsx b/e2e/solid-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2.tsx index efeca5ce860..7a5a3623a03 100644 --- a/e2e/solid-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2.tsx +++ b/e2e/solid-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2.tsx @@ -1,6 +1,6 @@ -import { Link, Outlet } from '@tanstack/solid-router' +import { Link, Outlet, createFileRoute } from '@tanstack/solid-router' -export const Route = createFileRoute({ +export const Route = createFileRoute('/_layout/_layout-2')({ component: LayoutComponent, }) diff --git a/e2e/solid-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2/layout-a.tsx b/e2e/solid-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2/layout-a.tsx index a190b242028..997e6caf800 100644 --- a/e2e/solid-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2/layout-a.tsx +++ b/e2e/solid-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2/layout-a.tsx @@ -1,4 +1,5 @@ -export const Route = createFileRoute({ +import { createFileRoute } from '@tanstack/solid-router' +export const Route = createFileRoute('/_layout/_layout-2/layout-a')({ component: LayoutAComponent, }) diff --git a/e2e/solid-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2/layout-b.tsx b/e2e/solid-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2/layout-b.tsx index 505f8f6fbf8..70135c5809d 100644 --- a/e2e/solid-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2/layout-b.tsx +++ b/e2e/solid-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2/layout-b.tsx @@ -1,4 +1,5 @@ -export const Route = createFileRoute({ +import { createFileRoute } from '@tanstack/solid-router' +export const Route = createFileRoute('/_layout/_layout-2/layout-b')({ component: LayoutBComponent, }) diff --git a/e2e/solid-router/basic-file-based-code-splitting/src/routes/index.tsx b/e2e/solid-router/basic-file-based-code-splitting/src/routes/index.tsx index 510db79b738..3f905db60c6 100644 --- a/e2e/solid-router/basic-file-based-code-splitting/src/routes/index.tsx +++ b/e2e/solid-router/basic-file-based-code-splitting/src/routes/index.tsx @@ -1,4 +1,5 @@ -export const Route = createFileRoute({ +import { createFileRoute } from '@tanstack/solid-router' +export const Route = createFileRoute('/')({ component: Home, }) diff --git a/e2e/solid-router/basic-file-based-code-splitting/src/routes/posts.$postId.tsx b/e2e/solid-router/basic-file-based-code-splitting/src/routes/posts.$postId.tsx index e23c29a21a5..105f08d64e1 100644 --- a/e2e/solid-router/basic-file-based-code-splitting/src/routes/posts.$postId.tsx +++ b/e2e/solid-router/basic-file-based-code-splitting/src/routes/posts.$postId.tsx @@ -1,4 +1,4 @@ -import { ErrorComponent } from '@tanstack/solid-router' +import { ErrorComponent, createFileRoute } from '@tanstack/solid-router' import { fetchPost } from '../posts' import type { ErrorComponentProps } from '@tanstack/solid-router' @@ -6,7 +6,7 @@ export function PostErrorComponent({ error }: ErrorComponentProps) { return } -export const Route = createFileRoute({ +export const Route = createFileRoute('/posts/$postId')({ loader: async ({ params: { postId } }) => fetchPost(postId), errorComponent: PostErrorComponent as any, notFoundComponent: () => { diff --git a/e2e/solid-router/basic-file-based-code-splitting/src/routes/posts.index.tsx b/e2e/solid-router/basic-file-based-code-splitting/src/routes/posts.index.tsx index 13529228bb4..812b581e0aa 100644 --- a/e2e/solid-router/basic-file-based-code-splitting/src/routes/posts.index.tsx +++ b/e2e/solid-router/basic-file-based-code-splitting/src/routes/posts.index.tsx @@ -1,4 +1,5 @@ -export const Route = createFileRoute({ +import { createFileRoute } from '@tanstack/solid-router' +export const Route = createFileRoute('/posts/')({ component: PostsIndexComponent, }) diff --git a/e2e/solid-router/basic-file-based-code-splitting/src/routes/posts.tsx b/e2e/solid-router/basic-file-based-code-splitting/src/routes/posts.tsx index 2e28f9beb34..11a999f50aa 100644 --- a/e2e/solid-router/basic-file-based-code-splitting/src/routes/posts.tsx +++ b/e2e/solid-router/basic-file-based-code-splitting/src/routes/posts.tsx @@ -1,7 +1,7 @@ -import { Link, Outlet } from '@tanstack/solid-router' +import { Link, Outlet, createFileRoute } from '@tanstack/solid-router' import { fetchPosts } from '../posts' -export const Route = createFileRoute({ +export const Route = createFileRoute('/posts')({ loader: fetchPosts, component: PostsComponent, }) diff --git a/e2e/solid-router/basic-file-based-code-splitting/src/routes/viewport-test.tsx b/e2e/solid-router/basic-file-based-code-splitting/src/routes/viewport-test.tsx index b182feb7b15..c199bc56e01 100644 --- a/e2e/solid-router/basic-file-based-code-splitting/src/routes/viewport-test.tsx +++ b/e2e/solid-router/basic-file-based-code-splitting/src/routes/viewport-test.tsx @@ -1,3 +1,4 @@ -export const Route = createFileRoute({ +import { createFileRoute } from '@tanstack/solid-router' +export const Route = createFileRoute('/viewport-test')({ component: () =>
Hello /viewport-test!
, }) diff --git a/e2e/solid-router/basic-file-based-code-splitting/src/routes/without-loader.tsx b/e2e/solid-router/basic-file-based-code-splitting/src/routes/without-loader.tsx index af692bdaca3..a7bf51fafb2 100644 --- a/e2e/solid-router/basic-file-based-code-splitting/src/routes/without-loader.tsx +++ b/e2e/solid-router/basic-file-based-code-splitting/src/routes/without-loader.tsx @@ -1,3 +1,4 @@ -export const Route = createFileRoute({ +import { createFileRoute } from '@tanstack/solid-router' +export const Route = createFileRoute('/without-loader')({ component: () =>
Hello /without-loader!
, }) diff --git a/e2e/solid-router/basic-solid-query-file-based/src/routeTree.gen.ts b/e2e/solid-router/basic-solid-query-file-based/src/routeTree.gen.ts index 2140687b184..325f0ccfc8f 100644 --- a/e2e/solid-router/basic-solid-query-file-based/src/routeTree.gen.ts +++ b/e2e/solid-router/basic-solid-query-file-based/src/routeTree.gen.ts @@ -15,7 +15,6 @@ import { Route as IndexRouteImport } from './routes/index' import { Route as PostsIndexRouteImport } from './routes/posts.index' import { Route as PostsPostIdRouteImport } from './routes/posts.$postId' import { Route as LayoutLayout2RouteImport } from './routes/_layout/_layout-2' -import { Route as TransitionCountQueryRouteImport } from './routes/transition/count/query' import { Route as LayoutLayout2LayoutBRouteImport } from './routes/_layout/_layout-2/layout-b' import { Route as LayoutLayout2LayoutARouteImport } from './routes/_layout/_layout-2/layout-a' @@ -47,11 +46,6 @@ const LayoutLayout2Route = LayoutLayout2RouteImport.update({ id: '/_layout-2', getParentRoute: () => LayoutRoute, } as any) -const TransitionCountQueryRoute = TransitionCountQueryRouteImport.update({ - id: '/transition/count/query', - path: '/transition/count/query', - getParentRoute: () => rootRouteImport, -} as any) const LayoutLayout2LayoutBRoute = LayoutLayout2LayoutBRouteImport.update({ id: '/layout-b', path: '/layout-b', @@ -70,7 +64,6 @@ export interface FileRoutesByFullPath { '/posts/': typeof PostsIndexRoute '/layout-a': typeof LayoutLayout2LayoutARoute '/layout-b': typeof LayoutLayout2LayoutBRoute - '/transition/count/query': typeof TransitionCountQueryRoute } export interface FileRoutesByTo { '/': typeof IndexRoute @@ -78,7 +71,6 @@ export interface FileRoutesByTo { '/posts': typeof PostsIndexRoute '/layout-a': typeof LayoutLayout2LayoutARoute '/layout-b': typeof LayoutLayout2LayoutBRoute - '/transition/count/query': typeof TransitionCountQueryRoute } export interface FileRoutesById { __root__: typeof rootRouteImport @@ -90,7 +82,6 @@ export interface FileRoutesById { '/posts/': typeof PostsIndexRoute '/_layout/_layout-2/layout-a': typeof LayoutLayout2LayoutARoute '/_layout/_layout-2/layout-b': typeof LayoutLayout2LayoutBRoute - '/transition/count/query': typeof TransitionCountQueryRoute } export interface FileRouteTypes { fileRoutesByFullPath: FileRoutesByFullPath @@ -101,15 +92,8 @@ export interface FileRouteTypes { | '/posts/' | '/layout-a' | '/layout-b' - | '/transition/count/query' fileRoutesByTo: FileRoutesByTo - to: - | '/' - | '/posts/$postId' - | '/posts' - | '/layout-a' - | '/layout-b' - | '/transition/count/query' + to: '/' | '/posts/$postId' | '/posts' | '/layout-a' | '/layout-b' id: | '__root__' | '/' @@ -120,14 +104,12 @@ export interface FileRouteTypes { | '/posts/' | '/_layout/_layout-2/layout-a' | '/_layout/_layout-2/layout-b' - | '/transition/count/query' fileRoutesById: FileRoutesById } export interface RootRouteChildren { IndexRoute: typeof IndexRoute LayoutRoute: typeof LayoutRouteWithChildren PostsRoute: typeof PostsRouteWithChildren - TransitionCountQueryRoute: typeof TransitionCountQueryRoute } declare module '@tanstack/solid-router' { @@ -174,13 +156,6 @@ declare module '@tanstack/solid-router' { preLoaderRoute: typeof LayoutLayout2RouteImport parentRoute: typeof LayoutRoute } - '/transition/count/query': { - id: '/transition/count/query' - path: '/transition/count/query' - fullPath: '/transition/count/query' - preLoaderRoute: typeof TransitionCountQueryRouteImport - parentRoute: typeof rootRouteImport - } '/_layout/_layout-2/layout-b': { id: '/_layout/_layout-2/layout-b' path: '/layout-b' @@ -239,7 +214,6 @@ const rootRouteChildren: RootRouteChildren = { IndexRoute: IndexRoute, LayoutRoute: LayoutRouteWithChildren, PostsRoute: PostsRouteWithChildren, - TransitionCountQueryRoute: TransitionCountQueryRoute, } export const routeTree = rootRouteImport ._addFileChildren(rootRouteChildren) diff --git a/e2e/solid-start/basic-solid-query/test-results/.last-run.json b/e2e/solid-start/basic-solid-query/test-results/.last-run.json new file mode 100644 index 00000000000..6a82cc0eeaa --- /dev/null +++ b/e2e/solid-start/basic-solid-query/test-results/.last-run.json @@ -0,0 +1,11 @@ +{ + "status": "failed", + "failedTests": [ + "c31ff144dc4fee3acd0a-63b89a338be79484e4bb", + "c31ff144dc4fee3acd0a-4f129c35c3de91a27f27", + "c31ff144dc4fee3acd0a-e4cccb546ad3f7426add", + "c31ff144dc4fee3acd0a-d41a04e4f89f1163e5b6", + "c31ff144dc4fee3acd0a-1172e5451c6cb8c08510", + "b1eceb8956f07dfb5861-c24942549d1750f8032a" + ] +} \ No newline at end of file diff --git a/e2e/solid-start/query-integration/test-results/.last-run.json b/e2e/solid-start/query-integration/test-results/.last-run.json new file mode 100644 index 00000000000..46a7e5b9d86 --- /dev/null +++ b/e2e/solid-start/query-integration/test-results/.last-run.json @@ -0,0 +1,8 @@ +{ + "status": "failed", + "failedTests": [ + "c31ff144dc4fee3acd0a-dcba2f2956f7c4784a04", + "c31ff144dc4fee3acd0a-76f29614b7605cade5f2", + "c31ff144dc4fee3acd0a-5c10c5421b657c714e2b" + ] +} \ No newline at end of file diff --git a/examples/react/kitchen-sink-file-based/src/routeTree.gen.ts b/examples/react/kitchen-sink-file-based/src/routeTree.gen.ts index f3accfa48e5..21ebce14db6 100644 --- a/examples/react/kitchen-sink-file-based/src/routeTree.gen.ts +++ b/examples/react/kitchen-sink-file-based/src/routeTree.gen.ts @@ -8,9 +8,7 @@ // 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 Routes - -import { Route as rootRoute } from './routes/__root' +import { Route as rootRouteImport } from './routes/__root' import { Route as LoginRouteImport } from './routes/login' import { Route as PathlessLayoutRouteImport } from './routes/_pathlessLayout' import { Route as AuthRouteImport } from './routes/_auth' @@ -29,103 +27,85 @@ import { Route as DashboardInvoicesIndexRouteImport } from './routes/dashboard.i import { Route as DashboardUsersUserRouteImport } from './routes/dashboard.users.user' import { Route as DashboardInvoicesInvoiceIdRouteImport } from './routes/dashboard.invoices.$invoiceId' -// Create/Update Routes - const LoginRoute = LoginRouteImport.update({ id: '/login', path: '/login', - getParentRoute: () => rootRoute, + getParentRoute: () => rootRouteImport, } as any) - const PathlessLayoutRoute = PathlessLayoutRouteImport.update({ id: '/_pathlessLayout', - getParentRoute: () => rootRoute, + getParentRoute: () => rootRouteImport, } as any) - const AuthRoute = AuthRouteImport.update({ id: '/_auth', - getParentRoute: () => rootRoute, + getParentRoute: () => rootRouteImport, } as any) - const DashboardRouteRoute = DashboardRouteRouteImport.update({ id: '/dashboard', path: '/dashboard', - getParentRoute: () => rootRoute, + getParentRoute: () => rootRouteImport, } as any) - const IndexRoute = IndexRouteImport.update({ id: '/', path: '/', - getParentRoute: () => rootRoute, + getParentRoute: () => rootRouteImport, } as any) - const ExpensiveIndexRoute = ExpensiveIndexRouteImport.update({ id: '/expensive/', path: '/expensive/', - getParentRoute: () => rootRoute, + getParentRoute: () => rootRouteImport, } as any) - const DashboardIndexRoute = DashboardIndexRouteImport.update({ id: '/', path: '/', getParentRoute: () => DashboardRouteRoute, } as any) - const PathlessLayoutRouteBRoute = PathlessLayoutRouteBRouteImport.update({ id: '/route-b', path: '/route-b', getParentRoute: () => PathlessLayoutRoute, } as any) - const PathlessLayoutRouteARoute = PathlessLayoutRouteARouteImport.update({ id: '/route-a', path: '/route-a', getParentRoute: () => PathlessLayoutRoute, } as any) - const AuthProfileRoute = AuthProfileRouteImport.update({ id: '/profile', path: '/profile', getParentRoute: () => AuthRoute, } as any) - const thisFolderIsNotInTheUrlRouteGroupRoute = thisFolderIsNotInTheUrlRouteGroupRouteImport.update({ id: '/(this-folder-is-not-in-the-url)/route-group', path: '/route-group', - getParentRoute: () => rootRoute, + getParentRoute: () => rootRouteImport, } as any) - const DashboardUsersRouteRoute = DashboardUsersRouteRouteImport.update({ id: '/users', path: '/users', getParentRoute: () => DashboardRouteRoute, } as any) - const DashboardInvoicesRouteRoute = DashboardInvoicesRouteRouteImport.update({ id: '/invoices', path: '/invoices', getParentRoute: () => DashboardRouteRoute, } as any) - const DashboardUsersIndexRoute = DashboardUsersIndexRouteImport.update({ id: '/', path: '/', getParentRoute: () => DashboardUsersRouteRoute, } as any) - const DashboardInvoicesIndexRoute = DashboardInvoicesIndexRouteImport.update({ id: '/', path: '/', getParentRoute: () => DashboardInvoicesRouteRoute, } as any) - const DashboardUsersUserRoute = DashboardUsersUserRouteImport.update({ id: '/user', path: '/user', getParentRoute: () => DashboardUsersRouteRoute, } as any) - const DashboardInvoicesInvoiceIdRoute = DashboardInvoicesInvoiceIdRouteImport.update({ id: '/$invoiceId', @@ -133,207 +113,9 @@ const DashboardInvoicesInvoiceIdRoute = getParentRoute: () => DashboardInvoicesRouteRoute, } as any) -// Populate the FileRoutesByPath interface - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRoute - } - '/dashboard': { - id: '/dashboard' - path: '/dashboard' - fullPath: '/dashboard' - preLoaderRoute: typeof DashboardRouteRouteImport - parentRoute: typeof rootRoute - } - '/_auth': { - id: '/_auth' - path: '' - fullPath: '' - preLoaderRoute: typeof AuthRouteImport - parentRoute: typeof rootRoute - } - '/_pathlessLayout': { - id: '/_pathlessLayout' - path: '' - fullPath: '' - preLoaderRoute: typeof PathlessLayoutRouteImport - parentRoute: typeof rootRoute - } - '/login': { - id: '/login' - path: '/login' - fullPath: '/login' - preLoaderRoute: typeof LoginRouteImport - parentRoute: typeof rootRoute - } - '/dashboard/invoices': { - id: '/dashboard/invoices' - path: '/invoices' - fullPath: '/dashboard/invoices' - preLoaderRoute: typeof DashboardInvoicesRouteRouteImport - parentRoute: typeof DashboardRouteRouteImport - } - '/dashboard/users': { - id: '/dashboard/users' - path: '/users' - fullPath: '/dashboard/users' - preLoaderRoute: typeof DashboardUsersRouteRouteImport - parentRoute: typeof DashboardRouteRouteImport - } - '/(this-folder-is-not-in-the-url)/route-group': { - id: '/(this-folder-is-not-in-the-url)/route-group' - path: '/route-group' - fullPath: '/route-group' - preLoaderRoute: typeof thisFolderIsNotInTheUrlRouteGroupRouteImport - parentRoute: typeof rootRoute - } - '/_auth/profile': { - id: '/_auth/profile' - path: '/profile' - fullPath: '/profile' - preLoaderRoute: typeof AuthProfileRouteImport - parentRoute: typeof AuthRouteImport - } - '/_pathlessLayout/route-a': { - id: '/_pathlessLayout/route-a' - path: '/route-a' - fullPath: '/route-a' - preLoaderRoute: typeof PathlessLayoutRouteARouteImport - parentRoute: typeof PathlessLayoutRouteImport - } - '/_pathlessLayout/route-b': { - id: '/_pathlessLayout/route-b' - path: '/route-b' - fullPath: '/route-b' - preLoaderRoute: typeof PathlessLayoutRouteBRouteImport - parentRoute: typeof PathlessLayoutRouteImport - } - '/dashboard/': { - id: '/dashboard/' - path: '/' - fullPath: '/dashboard/' - preLoaderRoute: typeof DashboardIndexRouteImport - parentRoute: typeof DashboardRouteRouteImport - } - '/expensive/': { - id: '/expensive/' - path: '/expensive' - fullPath: '/expensive' - preLoaderRoute: typeof ExpensiveIndexRouteImport - parentRoute: typeof rootRoute - } - '/dashboard/invoices/$invoiceId': { - id: '/dashboard/invoices/$invoiceId' - path: '/$invoiceId' - fullPath: '/dashboard/invoices/$invoiceId' - preLoaderRoute: typeof DashboardInvoicesInvoiceIdRouteImport - parentRoute: typeof DashboardInvoicesRouteRouteImport - } - '/dashboard/users/user': { - id: '/dashboard/users/user' - path: '/user' - fullPath: '/dashboard/users/user' - preLoaderRoute: typeof DashboardUsersUserRouteImport - parentRoute: typeof DashboardUsersRouteRouteImport - } - '/dashboard/invoices/': { - id: '/dashboard/invoices/' - path: '/' - fullPath: '/dashboard/invoices/' - preLoaderRoute: typeof DashboardInvoicesIndexRouteImport - parentRoute: typeof DashboardInvoicesRouteRouteImport - } - '/dashboard/users/': { - id: '/dashboard/users/' - path: '/' - fullPath: '/dashboard/users/' - preLoaderRoute: typeof DashboardUsersIndexRouteImport - parentRoute: typeof DashboardUsersRouteRouteImport - } - } -} - -// Create and export the route tree - -interface DashboardInvoicesRouteRouteChildren { - DashboardInvoicesInvoiceIdRoute: typeof DashboardInvoicesInvoiceIdRoute - DashboardInvoicesIndexRoute: typeof DashboardInvoicesIndexRoute -} - -const DashboardInvoicesRouteRouteChildren: DashboardInvoicesRouteRouteChildren = - { - DashboardInvoicesInvoiceIdRoute: DashboardInvoicesInvoiceIdRoute, - DashboardInvoicesIndexRoute: DashboardInvoicesIndexRoute, - } - -const DashboardInvoicesRouteRouteWithChildren = - DashboardInvoicesRouteRoute._addFileChildren( - DashboardInvoicesRouteRouteChildren, - ) - -interface DashboardUsersRouteRouteChildren { - DashboardUsersUserRoute: typeof DashboardUsersUserRoute - DashboardUsersIndexRoute: typeof DashboardUsersIndexRoute -} - -const DashboardUsersRouteRouteChildren: DashboardUsersRouteRouteChildren = { - DashboardUsersUserRoute: DashboardUsersUserRoute, - DashboardUsersIndexRoute: DashboardUsersIndexRoute, -} - -const DashboardUsersRouteRouteWithChildren = - DashboardUsersRouteRoute._addFileChildren(DashboardUsersRouteRouteChildren) - -interface DashboardRouteRouteChildren { - DashboardInvoicesRouteRoute: typeof DashboardInvoicesRouteRouteWithChildren - DashboardUsersRouteRoute: typeof DashboardUsersRouteRouteWithChildren - DashboardIndexRoute: typeof DashboardIndexRoute -} - -const DashboardRouteRouteChildren: DashboardRouteRouteChildren = { - DashboardInvoicesRouteRoute: DashboardInvoicesRouteRouteWithChildren, - DashboardUsersRouteRoute: DashboardUsersRouteRouteWithChildren, - DashboardIndexRoute: DashboardIndexRoute, -} - -const DashboardRouteRouteWithChildren = DashboardRouteRoute._addFileChildren( - DashboardRouteRouteChildren, -) - -interface AuthRouteChildren { - AuthProfileRoute: typeof AuthProfileRoute -} - -const AuthRouteChildren: AuthRouteChildren = { - AuthProfileRoute: AuthProfileRoute, -} - -const AuthRouteWithChildren = AuthRoute._addFileChildren(AuthRouteChildren) - -interface PathlessLayoutRouteChildren { - PathlessLayoutRouteARoute: typeof PathlessLayoutRouteARoute - PathlessLayoutRouteBRoute: typeof PathlessLayoutRouteBRoute -} - -const PathlessLayoutRouteChildren: PathlessLayoutRouteChildren = { - PathlessLayoutRouteARoute: PathlessLayoutRouteARoute, - PathlessLayoutRouteBRoute: PathlessLayoutRouteBRoute, -} - -const PathlessLayoutRouteWithChildren = PathlessLayoutRoute._addFileChildren( - PathlessLayoutRouteChildren, -) - export interface FileRoutesByFullPath { '/': typeof IndexRoute '/dashboard': typeof DashboardRouteRouteWithChildren - '': typeof PathlessLayoutRouteWithChildren '/login': typeof LoginRoute '/dashboard/invoices': typeof DashboardInvoicesRouteRouteWithChildren '/dashboard/users': typeof DashboardUsersRouteRouteWithChildren @@ -348,10 +130,8 @@ export interface FileRoutesByFullPath { '/dashboard/invoices/': typeof DashboardInvoicesIndexRoute '/dashboard/users/': typeof DashboardUsersIndexRoute } - export interface FileRoutesByTo { '/': typeof IndexRoute - '': typeof PathlessLayoutRouteWithChildren '/login': typeof LoginRoute '/route-group': typeof thisFolderIsNotInTheUrlRouteGroupRoute '/profile': typeof AuthProfileRoute @@ -364,9 +144,8 @@ export interface FileRoutesByTo { '/dashboard/invoices': typeof DashboardInvoicesIndexRoute '/dashboard/users': typeof DashboardUsersIndexRoute } - export interface FileRoutesById { - __root__: typeof rootRoute + __root__: typeof rootRouteImport '/': typeof IndexRoute '/dashboard': typeof DashboardRouteRouteWithChildren '/_auth': typeof AuthRouteWithChildren @@ -385,13 +164,11 @@ export interface FileRoutesById { '/dashboard/invoices/': typeof DashboardInvoicesIndexRoute '/dashboard/users/': typeof DashboardUsersIndexRoute } - export interface FileRouteTypes { fileRoutesByFullPath: FileRoutesByFullPath fullPaths: | '/' | '/dashboard' - | '' | '/login' | '/dashboard/invoices' | '/dashboard/users' @@ -408,7 +185,6 @@ export interface FileRouteTypes { fileRoutesByTo: FileRoutesByTo to: | '/' - | '' | '/login' | '/route-group' | '/profile' @@ -441,7 +217,6 @@ export interface FileRouteTypes { | '/dashboard/users/' fileRoutesById: FileRoutesById } - export interface RootRouteChildren { IndexRoute: typeof IndexRoute DashboardRouteRoute: typeof DashboardRouteRouteWithChildren @@ -452,6 +227,199 @@ export interface RootRouteChildren { ExpensiveIndexRoute: typeof ExpensiveIndexRoute } +declare module '@tanstack/react-router' { + interface FileRoutesByPath { + '/login': { + id: '/login' + path: '/login' + fullPath: '/login' + preLoaderRoute: typeof LoginRouteImport + parentRoute: typeof rootRouteImport + } + '/_pathlessLayout': { + id: '/_pathlessLayout' + path: '' + fullPath: '' + preLoaderRoute: typeof PathlessLayoutRouteImport + parentRoute: typeof rootRouteImport + } + '/_auth': { + id: '/_auth' + path: '' + fullPath: '' + preLoaderRoute: typeof AuthRouteImport + parentRoute: typeof rootRouteImport + } + '/dashboard': { + id: '/dashboard' + path: '/dashboard' + fullPath: '/dashboard' + preLoaderRoute: typeof DashboardRouteRouteImport + parentRoute: typeof rootRouteImport + } + '/': { + id: '/' + path: '/' + fullPath: '/' + preLoaderRoute: typeof IndexRouteImport + parentRoute: typeof rootRouteImport + } + '/expensive/': { + id: '/expensive/' + path: '/expensive' + fullPath: '/expensive' + preLoaderRoute: typeof ExpensiveIndexRouteImport + parentRoute: typeof rootRouteImport + } + '/dashboard/': { + id: '/dashboard/' + path: '/' + fullPath: '/dashboard/' + preLoaderRoute: typeof DashboardIndexRouteImport + parentRoute: typeof DashboardRouteRoute + } + '/_pathlessLayout/route-b': { + id: '/_pathlessLayout/route-b' + path: '/route-b' + fullPath: '/route-b' + preLoaderRoute: typeof PathlessLayoutRouteBRouteImport + parentRoute: typeof PathlessLayoutRoute + } + '/_pathlessLayout/route-a': { + id: '/_pathlessLayout/route-a' + path: '/route-a' + fullPath: '/route-a' + preLoaderRoute: typeof PathlessLayoutRouteARouteImport + parentRoute: typeof PathlessLayoutRoute + } + '/_auth/profile': { + id: '/_auth/profile' + path: '/profile' + fullPath: '/profile' + preLoaderRoute: typeof AuthProfileRouteImport + parentRoute: typeof AuthRoute + } + '/(this-folder-is-not-in-the-url)/route-group': { + id: '/(this-folder-is-not-in-the-url)/route-group' + path: '/route-group' + fullPath: '/route-group' + preLoaderRoute: typeof thisFolderIsNotInTheUrlRouteGroupRouteImport + parentRoute: typeof rootRouteImport + } + '/dashboard/users': { + id: '/dashboard/users' + path: '/users' + fullPath: '/dashboard/users' + preLoaderRoute: typeof DashboardUsersRouteRouteImport + parentRoute: typeof DashboardRouteRoute + } + '/dashboard/invoices': { + id: '/dashboard/invoices' + path: '/invoices' + fullPath: '/dashboard/invoices' + preLoaderRoute: typeof DashboardInvoicesRouteRouteImport + parentRoute: typeof DashboardRouteRoute + } + '/dashboard/users/': { + id: '/dashboard/users/' + path: '/' + fullPath: '/dashboard/users/' + preLoaderRoute: typeof DashboardUsersIndexRouteImport + parentRoute: typeof DashboardUsersRouteRoute + } + '/dashboard/invoices/': { + id: '/dashboard/invoices/' + path: '/' + fullPath: '/dashboard/invoices/' + preLoaderRoute: typeof DashboardInvoicesIndexRouteImport + parentRoute: typeof DashboardInvoicesRouteRoute + } + '/dashboard/users/user': { + id: '/dashboard/users/user' + path: '/user' + fullPath: '/dashboard/users/user' + preLoaderRoute: typeof DashboardUsersUserRouteImport + parentRoute: typeof DashboardUsersRouteRoute + } + '/dashboard/invoices/$invoiceId': { + id: '/dashboard/invoices/$invoiceId' + path: '/$invoiceId' + fullPath: '/dashboard/invoices/$invoiceId' + preLoaderRoute: typeof DashboardInvoicesInvoiceIdRouteImport + parentRoute: typeof DashboardInvoicesRouteRoute + } + } +} + +interface DashboardInvoicesRouteRouteChildren { + DashboardInvoicesInvoiceIdRoute: typeof DashboardInvoicesInvoiceIdRoute + DashboardInvoicesIndexRoute: typeof DashboardInvoicesIndexRoute +} + +const DashboardInvoicesRouteRouteChildren: DashboardInvoicesRouteRouteChildren = + { + DashboardInvoicesInvoiceIdRoute: DashboardInvoicesInvoiceIdRoute, + DashboardInvoicesIndexRoute: DashboardInvoicesIndexRoute, + } + +const DashboardInvoicesRouteRouteWithChildren = + DashboardInvoicesRouteRoute._addFileChildren( + DashboardInvoicesRouteRouteChildren, + ) + +interface DashboardUsersRouteRouteChildren { + DashboardUsersUserRoute: typeof DashboardUsersUserRoute + DashboardUsersIndexRoute: typeof DashboardUsersIndexRoute +} + +const DashboardUsersRouteRouteChildren: DashboardUsersRouteRouteChildren = { + DashboardUsersUserRoute: DashboardUsersUserRoute, + DashboardUsersIndexRoute: DashboardUsersIndexRoute, +} + +const DashboardUsersRouteRouteWithChildren = + DashboardUsersRouteRoute._addFileChildren(DashboardUsersRouteRouteChildren) + +interface DashboardRouteRouteChildren { + DashboardInvoicesRouteRoute: typeof DashboardInvoicesRouteRouteWithChildren + DashboardUsersRouteRoute: typeof DashboardUsersRouteRouteWithChildren + DashboardIndexRoute: typeof DashboardIndexRoute +} + +const DashboardRouteRouteChildren: DashboardRouteRouteChildren = { + DashboardInvoicesRouteRoute: DashboardInvoicesRouteRouteWithChildren, + DashboardUsersRouteRoute: DashboardUsersRouteRouteWithChildren, + DashboardIndexRoute: DashboardIndexRoute, +} + +const DashboardRouteRouteWithChildren = DashboardRouteRoute._addFileChildren( + DashboardRouteRouteChildren, +) + +interface AuthRouteChildren { + AuthProfileRoute: typeof AuthProfileRoute +} + +const AuthRouteChildren: AuthRouteChildren = { + AuthProfileRoute: AuthProfileRoute, +} + +const AuthRouteWithChildren = AuthRoute._addFileChildren(AuthRouteChildren) + +interface PathlessLayoutRouteChildren { + PathlessLayoutRouteARoute: typeof PathlessLayoutRouteARoute + PathlessLayoutRouteBRoute: typeof PathlessLayoutRouteBRoute +} + +const PathlessLayoutRouteChildren: PathlessLayoutRouteChildren = { + PathlessLayoutRouteARoute: PathlessLayoutRouteARoute, + PathlessLayoutRouteBRoute: PathlessLayoutRouteBRoute, +} + +const PathlessLayoutRouteWithChildren = PathlessLayoutRoute._addFileChildren( + PathlessLayoutRouteChildren, +) + const rootRouteChildren: RootRouteChildren = { IndexRoute: IndexRoute, DashboardRouteRoute: DashboardRouteRouteWithChildren, @@ -462,107 +430,6 @@ const rootRouteChildren: RootRouteChildren = { thisFolderIsNotInTheUrlRouteGroupRoute, ExpensiveIndexRoute: ExpensiveIndexRoute, } - -export const routeTree = rootRoute +export const routeTree = rootRouteImport ._addFileChildren(rootRouteChildren) ._addFileTypes() - -/* ROUTE_MANIFEST_START -{ - "routes": { - "__root__": { - "filePath": "__root.tsx", - "children": [ - "/", - "/dashboard", - "/_auth", - "/_pathlessLayout", - "/login", - "/(this-folder-is-not-in-the-url)/route-group", - "/expensive/" - ] - }, - "/": { - "filePath": "index.tsx" - }, - "/dashboard": { - "filePath": "dashboard.route.tsx", - "children": [ - "/dashboard/invoices", - "/dashboard/users", - "/dashboard/" - ] - }, - "/_auth": { - "filePath": "_auth.tsx", - "children": [ - "/_auth/profile" - ] - }, - "/_pathlessLayout": { - "filePath": "_pathlessLayout.tsx", - "children": [ - "/_pathlessLayout/route-a", - "/_pathlessLayout/route-b" - ] - }, - "/login": { - "filePath": "login.tsx" - }, - "/dashboard/invoices": { - "filePath": "dashboard.invoices.route.tsx", - "parent": "/dashboard", - "children": [ - "/dashboard/invoices/$invoiceId", - "/dashboard/invoices/" - ] - }, - "/dashboard/users": { - "filePath": "dashboard.users.route.tsx", - "parent": "/dashboard", - "children": [ - "/dashboard/users/user", - "/dashboard/users/" - ] - }, - "/(this-folder-is-not-in-the-url)/route-group": { - "filePath": "(this-folder-is-not-in-the-url)/route-group.tsx" - }, - "/_auth/profile": { - "filePath": "_auth.profile.tsx", - "parent": "/_auth" - }, - "/_pathlessLayout/route-a": { - "filePath": "_pathlessLayout.route-a.tsx", - "parent": "/_pathlessLayout" - }, - "/_pathlessLayout/route-b": { - "filePath": "_pathlessLayout.route-b.tsx", - "parent": "/_pathlessLayout" - }, - "/dashboard/": { - "filePath": "dashboard.index.tsx", - "parent": "/dashboard" - }, - "/expensive/": { - "filePath": "expensive/index.tsx" - }, - "/dashboard/invoices/$invoiceId": { - "filePath": "dashboard.invoices.$invoiceId.tsx", - "parent": "/dashboard/invoices" - }, - "/dashboard/users/user": { - "filePath": "dashboard.users.user.tsx", - "parent": "/dashboard/users" - }, - "/dashboard/invoices/": { - "filePath": "dashboard.invoices.index.tsx", - "parent": "/dashboard/invoices" - }, - "/dashboard/users/": { - "filePath": "dashboard.users.index.tsx", - "parent": "/dashboard/users" - } - } -} -ROUTE_MANIFEST_END */ diff --git a/examples/react/kitchen-sink-file-based/src/routes/login.tsx b/examples/react/kitchen-sink-file-based/src/routes/login.tsx index d7833bae234..b60c46de31d 100644 --- a/examples/react/kitchen-sink-file-based/src/routes/login.tsx +++ b/examples/react/kitchen-sink-file-based/src/routes/login.tsx @@ -7,7 +7,6 @@ export const Route = createFileRoute('/login')({ validateSearch: z.object({ redirect: z.string().optional(), }), -}).update({ component: LoginComponent, }) diff --git a/examples/react/start-clerk-basic/src/routeTree.gen.ts b/examples/react/start-clerk-basic/src/routeTree.gen.ts index 411606473c5..baaabbc2c03 100644 --- a/examples/react/start-clerk-basic/src/routeTree.gen.ts +++ b/examples/react/start-clerk-basic/src/routeTree.gen.ts @@ -171,9 +171,11 @@ export const routeTree = rootRouteImport ._addFileTypes() import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/react-start' +import type { startInstance } from './start.ts' declare module '@tanstack/react-start' { interface Register { + ssr: true router: Awaited> + config: Awaited> } } diff --git a/examples/solid/kitchen-sink-file-based/src/routes/login.tsx b/examples/solid/kitchen-sink-file-based/src/routes/login.tsx index 7b403ae66f3..9acacb4248e 100644 --- a/examples/solid/kitchen-sink-file-based/src/routes/login.tsx +++ b/examples/solid/kitchen-sink-file-based/src/routes/login.tsx @@ -7,7 +7,6 @@ export const Route = createFileRoute('/login')({ validateSearch: z.object({ redirect: z.string().optional(), }), -}).update({ component: LoginComponent, }) diff --git a/packages/react-router/src/typePrimitives.ts b/packages/react-router/src/typePrimitives.ts index 317ab260c86..2f400702a39 100644 --- a/packages/react-router/src/typePrimitives.ts +++ b/packages/react-router/src/typePrimitives.ts @@ -1,6 +1,5 @@ import type { AnyRouter, - Constrain, InferFrom, InferMaskFrom, InferMaskTo, @@ -19,9 +18,8 @@ export type ValidateLinkOptions< TOptions = unknown, TDefaultFrom extends string = string, TComp = 'a', -> = Constrain< - TOptions, - LinkComponentProps< +> = + TOptions extends LinkComponentProps< TComp, TRouter, InferFrom, @@ -29,7 +27,15 @@ export type ValidateLinkOptions< InferMaskFrom, InferMaskTo > -> + ? TOptions + : LinkComponentProps< + TComp, + TRouter, + InferFrom, + InferTo, + InferMaskFrom, + InferMaskTo + > /** * @private @@ -43,9 +49,8 @@ export type InferStructuralSharing = TOptions extends { export type ValidateUseSearchOptions< TOptions, TRouter extends AnyRouter = RegisteredRouter, -> = Constrain< - TOptions, - UseSearchOptions< +> = + TOptions extends UseSearchOptions< TRouter, InferFrom, InferStrict, @@ -53,14 +58,21 @@ export type ValidateUseSearchOptions< InferSelected, InferStructuralSharing > -> + ? TOptions + : UseSearchOptions< + TRouter, + InferFrom, + InferStrict, + InferShouldThrow, + InferSelected, + InferStructuralSharing + > export type ValidateUseParamsOptions< TOptions, TRouter extends AnyRouter = RegisteredRouter, -> = Constrain< - TOptions, - UseParamsOptions< +> = + TOptions extends UseParamsOptions< TRouter, InferFrom, InferStrict, @@ -68,7 +80,15 @@ export type ValidateUseParamsOptions< InferSelected, InferSelected > -> + ? TOptions + : UseParamsOptions< + TRouter, + InferFrom, + InferStrict, + InferShouldThrow, + InferSelected, + InferSelected + > export type ValidateLinkOptionsArray< TRouter extends AnyRouter = RegisteredRouter, TOptions extends ReadonlyArray = ReadonlyArray, diff --git a/packages/router-core/src/typePrimitives.ts b/packages/router-core/src/typePrimitives.ts index 5f7d4b8e2f0..7c46710718e 100644 --- a/packages/router-core/src/typePrimitives.ts +++ b/packages/router-core/src/typePrimitives.ts @@ -10,7 +10,7 @@ import type { RouteIds } from './routeInfo' import type { AnyRouter, RegisteredRouter } from './router' import type { UseParamsResult } from './useParams' import type { UseSearchResult } from './useSearch' -import type { Constrain, ConstrainLiteral } from './utils' +import type { ConstrainLiteral } from './utils' export type ValidateFromPath< TRouter extends AnyRouter = RegisteredRouter, @@ -75,16 +75,22 @@ export type ValidateNavigateOptions< TRouter extends AnyRouter = RegisteredRouter, TOptions = unknown, TDefaultFrom extends string = string, -> = Constrain< - TOptions, - NavigateOptions< +> = + TOptions extends NavigateOptions< TRouter, InferFrom, InferTo, InferMaskFrom, InferMaskTo > -> + ? TOptions + : NavigateOptions< + TRouter, + InferFrom, + InferTo, + InferMaskFrom, + InferMaskTo + > export type ValidateNavigateOptionsArray< TRouter extends AnyRouter = RegisteredRouter, @@ -102,16 +108,22 @@ export type ValidateRedirectOptions< TRouter extends AnyRouter = RegisteredRouter, TOptions = unknown, TDefaultFrom extends string = string, -> = Constrain< - TOptions, - RedirectOptions< +> = + TOptions extends RedirectOptions< TRouter, InferFrom, InferTo, InferMaskFrom, InferMaskTo > -> + ? TOptions + : RedirectOptions< + TRouter, + InferFrom, + InferTo, + InferMaskFrom, + InferMaskTo + > export type ValidateRedirectOptionsArray< TRouter extends AnyRouter = RegisteredRouter, @@ -170,12 +182,17 @@ export type ValidateUseSearchResult< export type ValidateUseParamsResult< TOptions, TRouter extends AnyRouter = RegisteredRouter, -> = Constrain< - TOptions, - UseParamsResult< +> = + TOptions extends UseParamsResult< TRouter, InferFrom, InferStrict, InferSelected > -> + ? TOptions + : UseParamsResult< + TRouter, + InferFrom, + InferStrict, + InferSelected + > diff --git a/packages/solid-router/src/typePrimitives.ts b/packages/solid-router/src/typePrimitives.ts index b134cb8959b..de5686006db 100644 --- a/packages/solid-router/src/typePrimitives.ts +++ b/packages/solid-router/src/typePrimitives.ts @@ -19,9 +19,8 @@ export type ValidateLinkOptions< TOptions = unknown, TDefaultFrom extends string = string, TComp = 'a', -> = Constrain< - TOptions, - LinkComponentProps< +> = + TOptions extends LinkComponentProps< TComp, TRouter, InferFrom, @@ -29,7 +28,15 @@ export type ValidateLinkOptions< InferMaskFrom, InferMaskTo > -> + ? TOptions + : LinkComponentProps< + TComp, + TRouter, + InferFrom, + InferTo, + InferMaskFrom, + InferMaskTo + > export type ValidateLinkOptionsArray< TRouter extends AnyRouter = RegisteredRouter, @@ -48,27 +55,39 @@ export type ValidateLinkOptionsArray< export type ValidateUseSearchOptions< TOptions, TRouter extends AnyRouter = RegisteredRouter, -> = Constrain< - TOptions, - UseSearchOptions< +> = + TOptions extends UseSearchOptions< TRouter, InferFrom, InferStrict, InferShouldThrow, InferSelected > -> + ? TOptions + : UseSearchOptions< + TRouter, + InferFrom, + InferStrict, + InferShouldThrow, + InferSelected + > export type ValidateUseParamsOptions< TOptions, TRouter extends AnyRouter = RegisteredRouter, -> = Constrain< - TOptions, - UseParamsOptions< +> = + TOptions extends UseParamsOptions< TRouter, InferFrom, InferStrict, InferShouldThrow, InferSelected > -> + ? TOptions + : UseParamsOptions< + TRouter, + InferFrom, + InferStrict, + InferShouldThrow, + InferSelected + >