@tanstack/react-router 1.51.2 → 1.51.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/dist/cjs/defer.d.cts +0 -1
  2. package/dist/cjs/fileRoute.cjs +5 -1
  3. package/dist/cjs/fileRoute.cjs.map +1 -1
  4. package/dist/cjs/fileRoute.d.cts +1 -2
  5. package/dist/cjs/index.d.cts +1 -1
  6. package/dist/cjs/lazyRouteComponent.d.cts +0 -1
  7. package/dist/cjs/location.d.cts +0 -1
  8. package/dist/cjs/path.d.cts +0 -1
  9. package/dist/cjs/redirects.d.cts +0 -1
  10. package/dist/cjs/renderRouteNotFound.d.cts +0 -1
  11. package/dist/cjs/routeInfo.d.cts +0 -1
  12. package/dist/cjs/router.d.cts +0 -1
  13. package/dist/cjs/scroll-restoration.d.cts +0 -1
  14. package/dist/cjs/searchParams.d.cts +0 -1
  15. package/dist/cjs/useBlocker.d.cts +0 -1
  16. package/dist/cjs/useLoaderData.d.cts +0 -1
  17. package/dist/cjs/useLoaderDeps.d.cts +0 -1
  18. package/dist/cjs/useLocation.d.cts +0 -1
  19. package/dist/cjs/useMatch.d.cts +0 -1
  20. package/dist/cjs/useNavigate.d.cts +0 -1
  21. package/dist/cjs/useParams.d.cts +0 -1
  22. package/dist/cjs/useRouteContext.d.cts +0 -1
  23. package/dist/cjs/useRouter.d.cts +0 -1
  24. package/dist/cjs/useRouterState.d.cts +0 -1
  25. package/dist/cjs/useSearch.d.cts +0 -1
  26. package/dist/esm/defer.d.ts +0 -1
  27. package/dist/esm/fileRoute.d.ts +1 -2
  28. package/dist/esm/fileRoute.js +5 -1
  29. package/dist/esm/fileRoute.js.map +1 -1
  30. package/dist/esm/index.d.ts +1 -1
  31. package/dist/esm/lazyRouteComponent.d.ts +0 -1
  32. package/dist/esm/location.d.ts +0 -1
  33. package/dist/esm/path.d.ts +0 -1
  34. package/dist/esm/redirects.d.ts +0 -1
  35. package/dist/esm/renderRouteNotFound.d.ts +0 -1
  36. package/dist/esm/routeInfo.d.ts +0 -1
  37. package/dist/esm/router.d.ts +0 -1
  38. package/dist/esm/scroll-restoration.d.ts +0 -1
  39. package/dist/esm/searchParams.d.ts +0 -1
  40. package/dist/esm/useBlocker.d.ts +0 -1
  41. package/dist/esm/useLoaderData.d.ts +0 -1
  42. package/dist/esm/useLoaderDeps.d.ts +0 -1
  43. package/dist/esm/useLocation.d.ts +0 -1
  44. package/dist/esm/useMatch.d.ts +0 -1
  45. package/dist/esm/useNavigate.d.ts +0 -1
  46. package/dist/esm/useParams.d.ts +0 -1
  47. package/dist/esm/useRouteContext.d.ts +0 -1
  48. package/dist/esm/useRouter.d.ts +0 -1
  49. package/dist/esm/useRouterState.d.ts +0 -1
  50. package/dist/esm/useSearch.d.ts +0 -1
  51. package/package.json +1 -2
  52. package/src/fileRoute.ts +8 -1
@@ -1,5 +1,4 @@
1
1
  import { defaultSerializeError } from './router.cjs';
2
-
3
2
  export type DeferredPromiseState<T> = {
4
3
  uid: string;
5
4
  resolve?: () => void;
@@ -70,8 +70,12 @@ function createLazyRoute(id) {
70
70
  return new LazyRoute({ id, ...opts });
71
71
  };
72
72
  }
73
+ const routeGroupPatternRegex = /\(.+\)/g;
74
+ function removeGroups(s) {
75
+ return s.replaceAll(routeGroupPatternRegex, "").replaceAll("//", "/");
76
+ }
73
77
  function createLazyFileRoute(id) {
74
- return (opts) => new LazyRoute({ id, ...opts });
78
+ return (opts) => new LazyRoute({ id: removeGroups(id), ...opts });
75
79
  }
76
80
  exports.FileRoute = FileRoute;
77
81
  exports.FileRouteLoader = FileRouteLoader;
@@ -1 +1 @@
1
- {"version":3,"file":"fileRoute.cjs","sources":["../../src/fileRoute.ts"],"sourcesContent":["import warning from 'tiny-warning'\nimport { createRoute } from './route'\nimport { useMatch } from './useMatch'\nimport { useLoaderDeps } from './useLoaderDeps'\nimport { useLoaderData } from './useLoaderData'\nimport { useSearch } from './useSearch'\nimport { useParams } from './useParams'\nimport { useNavigate } from './useNavigate'\nimport type { Constrain } from './utils'\nimport type {\n AnyContext,\n AnyPathParams,\n AnyRoute,\n AnySearchValidator,\n FileBaseRouteOptions,\n ResolveParams,\n Route,\n RouteConstraints,\n RouteLoaderFn,\n UpdatableRouteOptions,\n} from './route'\nimport type { MakeRouteMatch } from './Matches'\nimport type { RegisteredRouter } from './router'\nimport type { RouteById, RouteIds } from './routeInfo'\n\nexport interface FileRoutesByPath {\n // '/': {\n // parentRoute: typeof rootRoute\n // }\n}\n\nexport function createFileRoute<\n TFilePath extends keyof FileRoutesByPath,\n TParentRoute extends AnyRoute = FileRoutesByPath[TFilePath]['parentRoute'],\n TId extends RouteConstraints['TId'] = FileRoutesByPath[TFilePath]['id'],\n TPath extends RouteConstraints['TPath'] = FileRoutesByPath[TFilePath]['path'],\n TFullPath extends\n RouteConstraints['TFullPath'] = FileRoutesByPath[TFilePath]['fullPath'],\n>(\n path: TFilePath,\n): FileRoute<TFilePath, TParentRoute, TId, TPath, TFullPath>['createRoute'] {\n return new FileRoute<TFilePath, TParentRoute, TId, TPath, TFullPath>(path, {\n silent: true,\n }).createRoute\n}\n\n/** \n @deprecated It's no longer recommended to use the `FileRoute` class directly.\n Instead, use `createFileRoute('/path/to/file')(options)` to create a file route.\n*/\nexport class FileRoute<\n TFilePath extends keyof FileRoutesByPath,\n TParentRoute extends AnyRoute = FileRoutesByPath[TFilePath]['parentRoute'],\n TId extends RouteConstraints['TId'] = FileRoutesByPath[TFilePath]['id'],\n TPath extends RouteConstraints['TPath'] = FileRoutesByPath[TFilePath]['path'],\n TFullPath extends\n RouteConstraints['TFullPath'] = FileRoutesByPath[TFilePath]['fullPath'],\n> {\n silent?: boolean\n\n constructor(\n public path: TFilePath,\n _opts?: { silent: boolean },\n ) {\n this.silent = _opts?.silent\n }\n\n createRoute = <\n TSearchValidator = undefined,\n TParams = ResolveParams<TPath>,\n TRouteContextFn = AnyContext,\n TBeforeLoadFn = AnyContext,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderFn = undefined,\n TChildren = unknown,\n >(\n options?: FileBaseRouteOptions<\n TParentRoute,\n TPath,\n TSearchValidator,\n TParams,\n TLoaderDeps,\n TLoaderFn,\n AnyContext,\n TRouteContextFn,\n TBeforeLoadFn\n > &\n UpdatableRouteOptions<\n TParentRoute,\n TId,\n TFullPath,\n TParams,\n TSearchValidator,\n TLoaderFn,\n TLoaderDeps,\n AnyContext,\n TRouteContextFn,\n TBeforeLoadFn\n >,\n ): Route<\n TParentRoute,\n TPath,\n TFullPath,\n TFilePath,\n TId,\n TSearchValidator,\n TParams,\n AnyContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn,\n TChildren\n > => {\n warning(\n this.silent,\n 'FileRoute is deprecated and will be removed in the next major version. Use the createFileRoute(path)(options) function instead.',\n )\n const route = createRoute(options as any)\n ;(route as any).isRoot = false\n return route as any\n }\n}\n\n/** \n @deprecated It's recommended not to split loaders into separate files.\n Instead, place the loader function in the the main route file, inside the\n `createFileRoute('/path/to/file)(options)` options.\n*/\nexport function FileRouteLoader<\n TFilePath extends keyof FileRoutesByPath,\n TRoute extends FileRoutesByPath[TFilePath]['preLoaderRoute'],\n>(\n _path: TFilePath,\n): <TLoaderFn>(\n loaderFn: Constrain<\n TLoaderFn,\n RouteLoaderFn<\n TRoute['parentRoute'],\n TRoute['types']['params'],\n TRoute['types']['loaderDeps'],\n TRoute['types']['routerContext'],\n TRoute['types']['routeContextFn'],\n TRoute['types']['beforeLoadFn']\n >\n >,\n) => TLoaderFn {\n warning(\n false,\n `FileRouteLoader is deprecated and will be removed in the next major version. Please place the loader function in the the main route file, inside the \\`createFileRoute('/path/to/file')(options)\\` options`,\n )\n return (loaderFn) => loaderFn as any\n}\n\nexport type LazyRouteOptions = Pick<\n UpdatableRouteOptions<\n AnyRoute,\n string,\n string,\n AnyPathParams,\n AnySearchValidator,\n {},\n AnyContext,\n AnyContext,\n AnyContext,\n AnyContext\n >,\n 'component' | 'errorComponent' | 'pendingComponent' | 'notFoundComponent'\n>\n\nexport class LazyRoute<TRoute extends AnyRoute> {\n options: {\n id: string\n } & LazyRouteOptions\n\n constructor(\n opts: {\n id: string\n } & LazyRouteOptions,\n ) {\n this.options = opts\n ;(this as any).$$typeof = Symbol.for('react.memo')\n }\n\n useMatch = <\n TRouteMatch = MakeRouteMatch<\n RegisteredRouter['routeTree'],\n TRoute['types']['id']\n >,\n TSelected = TRouteMatch,\n >(opts?: {\n select?: (match: TRouteMatch) => TSelected\n }): TSelected => {\n return useMatch({ select: opts?.select, from: this.options.id })\n }\n\n useRouteContext = <TSelected = TRoute['types']['allContext']>(opts?: {\n select?: (s: TRoute['types']['allContext']) => TSelected\n }): TSelected => {\n return useMatch({\n from: this.options.id,\n select: (d: any) => (opts?.select ? opts.select(d.context) : d.context),\n })\n }\n\n useSearch = <TSelected = TRoute['types']['fullSearchSchema']>(opts?: {\n select?: (s: TRoute['types']['fullSearchSchema']) => TSelected\n }): TSelected => {\n return useSearch({ ...opts, from: this.options.id })\n }\n\n useParams = <TSelected = TRoute['types']['allParams']>(opts?: {\n select?: (s: TRoute['types']['allParams']) => TSelected\n }): TSelected => {\n return useParams({ ...opts, from: this.options.id })\n }\n\n useLoaderDeps = <TSelected = TRoute['types']['loaderDeps']>(opts?: {\n select?: (s: TRoute['types']['loaderDeps']) => TSelected\n }): TSelected => {\n return useLoaderDeps({ ...opts, from: this.options.id } as any)\n }\n\n useLoaderData = <TSelected = TRoute['types']['loaderData']>(opts?: {\n select?: (s: TRoute['types']['loaderData']) => TSelected\n }): TSelected => {\n return useLoaderData({ ...opts, from: this.options.id } as any)\n }\n\n useNavigate = () => {\n return useNavigate({ from: this.options.id })\n }\n}\n\nexport function createLazyRoute<\n TId extends RouteIds<RegisteredRouter['routeTree']>,\n TRoute extends AnyRoute = RouteById<RegisteredRouter['routeTree'], TId>,\n>(id: TId) {\n return (opts: LazyRouteOptions) => {\n return new LazyRoute<TRoute>({ id: id as any, ...opts })\n }\n}\n\nexport function createLazyFileRoute<\n TFilePath extends keyof FileRoutesByPath,\n TRoute extends FileRoutesByPath[TFilePath]['preLoaderRoute'],\n>(id: TFilePath) {\n return (opts: LazyRouteOptions) => new LazyRoute<TRoute>({ id, ...opts })\n}\n"],"names":["route","createRoute","opts","useMatch","useSearch","useParams","useLoaderDeps","useLoaderData","useNavigate"],"mappings":";;;;;;;;;;AA+BO,SAAS,gBAQd,MAC0E;AACnE,SAAA,IAAI,UAA0D,MAAM;AAAA,IACzE,QAAQ;AAAA,EACT,CAAA,EAAE;AACL;AAMO,MAAM,UAOX;AAAA,EAGA,YACS,MACP,OACA;AAFO,SAAA,OAAA;AAMT,SAAA,cAAc,CASZ,YAqCG;AACH;AAAA,QACE,KAAK;AAAA,QACL;AAAA,MAAA;AAEI,YAAAA,UAAQC,kBAAY,OAAc;AACtCD,cAAc,SAAS;AAClB,aAAAA;AAAAA,IAAA;AAxDP,SAAK,SAAS,+BAAO;AAAA,EACvB;AAyDF;AAOO,SAAS,gBAId,OAaa;AACb;AAAA,IACE;AAAA,IACA;AAAA,EAAA;AAEF,SAAO,CAAC,aAAa;AACvB;AAkBO,MAAM,UAAmC;AAAA,EAK9C,YACE,MAGA;AAKF,SAAA,WAAW,CAMTE,UAEe;AACR,aAAAC,SAAA,SAAS,EAAE,QAAQD,SAAA,gBAAAA,MAAM,QAAQ,MAAM,KAAK,QAAQ,GAAA,CAAI;AAAA,IAAA;AAGjE,SAAA,kBAAkB,CAA4CA,UAE7C;AACf,aAAOC,kBAAS;AAAA,QACd,MAAM,KAAK,QAAQ;AAAA,QACnB,QAAQ,CAAC,OAAYD,SAAA,gBAAAA,MAAM,UAASA,MAAK,OAAO,EAAE,OAAO,IAAI,EAAE;AAAA,MAAA,CAChE;AAAA,IAAA;AAGH,SAAA,YAAY,CAAkDA,UAE7C;AACR,aAAAE,UAAA,UAAU,EAAE,GAAGF,OAAM,MAAM,KAAK,QAAQ,IAAI;AAAA,IAAA;AAGrD,SAAA,YAAY,CAA2CA,UAEtC;AACR,aAAAG,UAAA,UAAU,EAAE,GAAGH,OAAM,MAAM,KAAK,QAAQ,IAAI;AAAA,IAAA;AAGrD,SAAA,gBAAgB,CAA4CA,UAE3C;AACR,aAAAI,cAAA,cAAc,EAAE,GAAGJ,OAAM,MAAM,KAAK,QAAQ,IAAW;AAAA,IAAA;AAGhE,SAAA,gBAAgB,CAA4CA,UAE3C;AACR,aAAAK,cAAA,cAAc,EAAE,GAAGL,OAAM,MAAM,KAAK,QAAQ,IAAW;AAAA,IAAA;AAGhE,SAAA,cAAc,MAAM;AAClB,aAAOM,YAAAA,YAAY,EAAE,MAAM,KAAK,QAAQ,IAAI;AAAA,IAAA;AAlD5C,SAAK,UAAU;AACb,SAAa,WAAW,OAAO,IAAI,YAAY;AAAA,EACnD;AAkDF;AAEO,SAAS,gBAGd,IAAS;AACT,SAAO,CAAC,SAA2B;AACjC,WAAO,IAAI,UAAkB,EAAE,IAAe,GAAG,KAAM,CAAA;AAAA,EAAA;AAE3D;AAEO,SAAS,oBAGd,IAAe;AACR,SAAA,CAAC,SAA2B,IAAI,UAAkB,EAAE,IAAI,GAAG,MAAM;AAC1E;;;;;;;"}
1
+ {"version":3,"file":"fileRoute.cjs","sources":["../../src/fileRoute.ts"],"sourcesContent":["import warning from 'tiny-warning'\nimport { createRoute } from './route'\nimport { useMatch } from './useMatch'\nimport { useLoaderDeps } from './useLoaderDeps'\nimport { useLoaderData } from './useLoaderData'\nimport { useSearch } from './useSearch'\nimport { useParams } from './useParams'\nimport { useNavigate } from './useNavigate'\nimport type { Constrain } from './utils'\nimport type {\n AnyContext,\n AnyPathParams,\n AnyRoute,\n AnySearchValidator,\n FileBaseRouteOptions,\n ResolveParams,\n Route,\n RouteConstraints,\n RouteLoaderFn,\n UpdatableRouteOptions,\n} from './route'\nimport type { MakeRouteMatch } from './Matches'\nimport type { RegisteredRouter } from './router'\nimport type { RouteById, RouteIds } from './routeInfo'\n\nexport interface FileRoutesByPath {\n // '/': {\n // parentRoute: typeof rootRoute\n // }\n}\n\nexport function createFileRoute<\n TFilePath extends keyof FileRoutesByPath,\n TParentRoute extends AnyRoute = FileRoutesByPath[TFilePath]['parentRoute'],\n TId extends RouteConstraints['TId'] = FileRoutesByPath[TFilePath]['id'],\n TPath extends RouteConstraints['TPath'] = FileRoutesByPath[TFilePath]['path'],\n TFullPath extends\n RouteConstraints['TFullPath'] = FileRoutesByPath[TFilePath]['fullPath'],\n>(\n path: TFilePath,\n): FileRoute<TFilePath, TParentRoute, TId, TPath, TFullPath>['createRoute'] {\n return new FileRoute<TFilePath, TParentRoute, TId, TPath, TFullPath>(path, {\n silent: true,\n }).createRoute\n}\n\n/** \n @deprecated It's no longer recommended to use the `FileRoute` class directly.\n Instead, use `createFileRoute('/path/to/file')(options)` to create a file route.\n*/\nexport class FileRoute<\n TFilePath extends keyof FileRoutesByPath,\n TParentRoute extends AnyRoute = FileRoutesByPath[TFilePath]['parentRoute'],\n TId extends RouteConstraints['TId'] = FileRoutesByPath[TFilePath]['id'],\n TPath extends RouteConstraints['TPath'] = FileRoutesByPath[TFilePath]['path'],\n TFullPath extends\n RouteConstraints['TFullPath'] = FileRoutesByPath[TFilePath]['fullPath'],\n> {\n silent?: boolean\n\n constructor(\n public path: TFilePath,\n _opts?: { silent: boolean },\n ) {\n this.silent = _opts?.silent\n }\n\n createRoute = <\n TSearchValidator = undefined,\n TParams = ResolveParams<TPath>,\n TRouteContextFn = AnyContext,\n TBeforeLoadFn = AnyContext,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderFn = undefined,\n TChildren = unknown,\n >(\n options?: FileBaseRouteOptions<\n TParentRoute,\n TPath,\n TSearchValidator,\n TParams,\n TLoaderDeps,\n TLoaderFn,\n AnyContext,\n TRouteContextFn,\n TBeforeLoadFn\n > &\n UpdatableRouteOptions<\n TParentRoute,\n TId,\n TFullPath,\n TParams,\n TSearchValidator,\n TLoaderFn,\n TLoaderDeps,\n AnyContext,\n TRouteContextFn,\n TBeforeLoadFn\n >,\n ): Route<\n TParentRoute,\n TPath,\n TFullPath,\n TFilePath,\n TId,\n TSearchValidator,\n TParams,\n AnyContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn,\n TChildren\n > => {\n warning(\n this.silent,\n 'FileRoute is deprecated and will be removed in the next major version. Use the createFileRoute(path)(options) function instead.',\n )\n const route = createRoute(options as any)\n ;(route as any).isRoot = false\n return route as any\n }\n}\n\n/** \n @deprecated It's recommended not to split loaders into separate files.\n Instead, place the loader function in the the main route file, inside the\n `createFileRoute('/path/to/file)(options)` options.\n*/\nexport function FileRouteLoader<\n TFilePath extends keyof FileRoutesByPath,\n TRoute extends FileRoutesByPath[TFilePath]['preLoaderRoute'],\n>(\n _path: TFilePath,\n): <TLoaderFn>(\n loaderFn: Constrain<\n TLoaderFn,\n RouteLoaderFn<\n TRoute['parentRoute'],\n TRoute['types']['params'],\n TRoute['types']['loaderDeps'],\n TRoute['types']['routerContext'],\n TRoute['types']['routeContextFn'],\n TRoute['types']['beforeLoadFn']\n >\n >,\n) => TLoaderFn {\n warning(\n false,\n `FileRouteLoader is deprecated and will be removed in the next major version. Please place the loader function in the the main route file, inside the \\`createFileRoute('/path/to/file')(options)\\` options`,\n )\n return (loaderFn) => loaderFn as any\n}\n\nexport type LazyRouteOptions = Pick<\n UpdatableRouteOptions<\n AnyRoute,\n string,\n string,\n AnyPathParams,\n AnySearchValidator,\n {},\n AnyContext,\n AnyContext,\n AnyContext,\n AnyContext\n >,\n 'component' | 'errorComponent' | 'pendingComponent' | 'notFoundComponent'\n>\n\nexport class LazyRoute<TRoute extends AnyRoute> {\n options: {\n id: string\n } & LazyRouteOptions\n\n constructor(\n opts: {\n id: string\n } & LazyRouteOptions,\n ) {\n this.options = opts\n ;(this as any).$$typeof = Symbol.for('react.memo')\n }\n\n useMatch = <\n TRouteMatch = MakeRouteMatch<\n RegisteredRouter['routeTree'],\n TRoute['types']['id']\n >,\n TSelected = TRouteMatch,\n >(opts?: {\n select?: (match: TRouteMatch) => TSelected\n }): TSelected => {\n return useMatch({ select: opts?.select, from: this.options.id })\n }\n\n useRouteContext = <TSelected = TRoute['types']['allContext']>(opts?: {\n select?: (s: TRoute['types']['allContext']) => TSelected\n }): TSelected => {\n return useMatch({\n from: this.options.id,\n select: (d: any) => (opts?.select ? opts.select(d.context) : d.context),\n })\n }\n\n useSearch = <TSelected = TRoute['types']['fullSearchSchema']>(opts?: {\n select?: (s: TRoute['types']['fullSearchSchema']) => TSelected\n }): TSelected => {\n return useSearch({ ...opts, from: this.options.id })\n }\n\n useParams = <TSelected = TRoute['types']['allParams']>(opts?: {\n select?: (s: TRoute['types']['allParams']) => TSelected\n }): TSelected => {\n return useParams({ ...opts, from: this.options.id })\n }\n\n useLoaderDeps = <TSelected = TRoute['types']['loaderDeps']>(opts?: {\n select?: (s: TRoute['types']['loaderDeps']) => TSelected\n }): TSelected => {\n return useLoaderDeps({ ...opts, from: this.options.id } as any)\n }\n\n useLoaderData = <TSelected = TRoute['types']['loaderData']>(opts?: {\n select?: (s: TRoute['types']['loaderData']) => TSelected\n }): TSelected => {\n return useLoaderData({ ...opts, from: this.options.id } as any)\n }\n\n useNavigate = () => {\n return useNavigate({ from: this.options.id })\n }\n}\n\nexport function createLazyRoute<\n TId extends RouteIds<RegisteredRouter['routeTree']>,\n TRoute extends AnyRoute = RouteById<RegisteredRouter['routeTree'], TId>,\n>(id: TId) {\n return (opts: LazyRouteOptions) => {\n return new LazyRoute<TRoute>({ id: id as any, ...opts })\n }\n}\n\nconst routeGroupPatternRegex = /\\(.+\\)/g\n\nfunction removeGroups(s: string) {\n return s.replaceAll(routeGroupPatternRegex, '').replaceAll('//', '/')\n}\n\nexport function createLazyFileRoute<\n TFilePath extends keyof FileRoutesByPath,\n TRoute extends FileRoutesByPath[TFilePath]['preLoaderRoute'],\n>(id: TFilePath) {\n return (opts: LazyRouteOptions) =>\n new LazyRoute<TRoute>({ id: removeGroups(id), ...opts })\n}\n"],"names":["route","createRoute","opts","useMatch","useSearch","useParams","useLoaderDeps","useLoaderData","useNavigate"],"mappings":";;;;;;;;;;AA+BO,SAAS,gBAQd,MAC0E;AACnE,SAAA,IAAI,UAA0D,MAAM;AAAA,IACzE,QAAQ;AAAA,EACT,CAAA,EAAE;AACL;AAMO,MAAM,UAOX;AAAA,EAGA,YACS,MACP,OACA;AAFO,SAAA,OAAA;AAMT,SAAA,cAAc,CASZ,YAqCG;AACH;AAAA,QACE,KAAK;AAAA,QACL;AAAA,MAAA;AAEI,YAAAA,UAAQC,kBAAY,OAAc;AACtCD,cAAc,SAAS;AAClB,aAAAA;AAAAA,IAAA;AAxDP,SAAK,SAAS,+BAAO;AAAA,EACvB;AAyDF;AAOO,SAAS,gBAId,OAaa;AACb;AAAA,IACE;AAAA,IACA;AAAA,EAAA;AAEF,SAAO,CAAC,aAAa;AACvB;AAkBO,MAAM,UAAmC;AAAA,EAK9C,YACE,MAGA;AAKF,SAAA,WAAW,CAMTE,UAEe;AACR,aAAAC,SAAA,SAAS,EAAE,QAAQD,SAAA,gBAAAA,MAAM,QAAQ,MAAM,KAAK,QAAQ,GAAA,CAAI;AAAA,IAAA;AAGjE,SAAA,kBAAkB,CAA4CA,UAE7C;AACf,aAAOC,kBAAS;AAAA,QACd,MAAM,KAAK,QAAQ;AAAA,QACnB,QAAQ,CAAC,OAAYD,SAAA,gBAAAA,MAAM,UAASA,MAAK,OAAO,EAAE,OAAO,IAAI,EAAE;AAAA,MAAA,CAChE;AAAA,IAAA;AAGH,SAAA,YAAY,CAAkDA,UAE7C;AACR,aAAAE,UAAA,UAAU,EAAE,GAAGF,OAAM,MAAM,KAAK,QAAQ,IAAI;AAAA,IAAA;AAGrD,SAAA,YAAY,CAA2CA,UAEtC;AACR,aAAAG,UAAA,UAAU,EAAE,GAAGH,OAAM,MAAM,KAAK,QAAQ,IAAI;AAAA,IAAA;AAGrD,SAAA,gBAAgB,CAA4CA,UAE3C;AACR,aAAAI,cAAA,cAAc,EAAE,GAAGJ,OAAM,MAAM,KAAK,QAAQ,IAAW;AAAA,IAAA;AAGhE,SAAA,gBAAgB,CAA4CA,UAE3C;AACR,aAAAK,cAAA,cAAc,EAAE,GAAGL,OAAM,MAAM,KAAK,QAAQ,IAAW;AAAA,IAAA;AAGhE,SAAA,cAAc,MAAM;AAClB,aAAOM,YAAAA,YAAY,EAAE,MAAM,KAAK,QAAQ,IAAI;AAAA,IAAA;AAlD5C,SAAK,UAAU;AACb,SAAa,WAAW,OAAO,IAAI,YAAY;AAAA,EACnD;AAkDF;AAEO,SAAS,gBAGd,IAAS;AACT,SAAO,CAAC,SAA2B;AACjC,WAAO,IAAI,UAAkB,EAAE,IAAe,GAAG,KAAM,CAAA;AAAA,EAAA;AAE3D;AAEA,MAAM,yBAAyB;AAE/B,SAAS,aAAa,GAAW;AAC/B,SAAO,EAAE,WAAW,wBAAwB,EAAE,EAAE,WAAW,MAAM,GAAG;AACtE;AAEO,SAAS,oBAGd,IAAe;AACR,SAAA,CAAC,SACN,IAAI,UAAkB,EAAE,IAAI,aAAa,EAAE,GAAG,GAAG,KAAA,CAAM;AAC3D;;;;;;;"}
@@ -3,7 +3,6 @@ import { AnyContext, AnyPathParams, AnyRoute, AnySearchValidator, FileBaseRouteO
3
3
  import { MakeRouteMatch } from './Matches.cjs';
4
4
  import { RegisteredRouter } from './router.cjs';
5
5
  import { RouteById, RouteIds } from './routeInfo.cjs';
6
-
7
6
  export interface FileRoutesByPath {
8
7
  }
9
8
  export declare function createFileRoute<TFilePath extends keyof FileRoutesByPath, TParentRoute extends AnyRoute = FileRoutesByPath[TFilePath]['parentRoute'], TId extends RouteConstraints['TId'] = FileRoutesByPath[TFilePath]['id'], TPath extends RouteConstraints['TPath'] = FileRoutesByPath[TFilePath]['path'], TFullPath extends RouteConstraints['TFullPath'] = FileRoutesByPath[TFilePath]['fullPath']>(path: TFilePath): FileRoute<TFilePath, TParentRoute, TId, TPath, TFullPath>['createRoute'];
@@ -51,7 +50,7 @@ export declare class LazyRoute<TRoute extends AnyRoute> {
51
50
  useLoaderData: <TSelected = TRoute["types"]["loaderData"]>(opts?: {
52
51
  select?: (s: TRoute["types"]["loaderData"]) => TSelected;
53
52
  }) => TSelected;
54
- useNavigate: () => import('./useNavigate').UseNavigateResult<string>;
53
+ useNavigate: () => import('./useNavigate.cjs').UseNavigateResult<string>;
55
54
  }
56
55
  export declare function createLazyRoute<TId extends RouteIds<RegisteredRouter['routeTree']>, TRoute extends AnyRoute = RouteById<RegisteredRouter['routeTree'], TId>>(id: TId): (opts: LazyRouteOptions) => LazyRoute<TRoute>;
57
56
  export declare function createLazyFileRoute<TFilePath extends keyof FileRoutesByPath, TRoute extends FileRoutesByPath[TFilePath]['preLoaderRoute']>(id: TFilePath): (opts: LazyRouteOptions) => LazyRoute<TRoute>;
@@ -55,7 +55,7 @@ export { useRouterState } from './useRouterState.cjs';
55
55
  export { useLocation } from './useLocation.cjs';
56
56
  export { escapeJSON, // SSR
57
57
  useLayoutEffect, // SSR
58
- pick, functionalUpdate, replaceEqualDeep, isPlainObject, isPlainArray, deepEqual, useStableCallback, shallow, } from './utils';
58
+ pick, functionalUpdate, replaceEqualDeep, isPlainObject, isPlainArray, deepEqual, useStableCallback, shallow, } from './utils.cjs';
59
59
  export { notFound, isNotFound, CatchNotFound, DefaultGlobalNotFound, } from './not-found.cjs';
60
60
  export type { NotFoundError } from './not-found.cjs';
61
61
  export type { Manifest, RouterManagedTag } from './manifest.cjs';
@@ -1,3 +1,2 @@
1
1
  import { AsyncRouteComponent } from './route.cjs';
2
-
3
2
  export declare function lazyRouteComponent<T extends Record<string, any>, TKey extends keyof T = 'default'>(importer: () => Promise<T>, exportName?: TKey): T[TKey] extends (props: infer TProps) => any ? AsyncRouteComponent<TProps> : never;
@@ -1,6 +1,5 @@
1
1
  import { HistoryState } from '@tanstack/history';
2
2
  import { AnySearchSchema } from './route.cjs';
3
-
4
3
  export interface ParsedLocation<TSearchObj extends AnySearchSchema = {}> {
5
4
  href: string;
6
5
  pathname: string;
@@ -1,6 +1,5 @@
1
1
  import { MatchLocation } from './RouterProvider.cjs';
2
2
  import { AnyPathParams } from './route.cjs';
3
-
4
3
  export interface Segment {
5
4
  type: 'pathname' | 'param' | 'wildcard';
6
5
  value: string;
@@ -2,7 +2,6 @@ import { NavigateOptions } from './link.cjs';
2
2
  import { RoutePaths } from './routeInfo.cjs';
3
3
  import { AnyRouter, RegisteredRouter } from './router.cjs';
4
4
  import { PickAsRequired } from './utils.cjs';
5
-
6
5
  export type AnyRedirect = Redirect<any, any, any, any, any>;
7
6
  export type Redirect<TRouter extends AnyRouter = RegisteredRouter, TFrom extends RoutePaths<TRouter['routeTree']> = '/', TTo extends string = '', TMaskFrom extends RoutePaths<TRouter['routeTree']> = TFrom, TMaskTo extends string = ''> = {
8
7
  /**
@@ -1,4 +1,3 @@
1
1
  import { AnyRouter } from './router.cjs';
2
2
  import { AnyRoute } from './route.cjs';
3
-
4
3
  export declare function renderRouteNotFound(router: AnyRouter, route: AnyRoute, data: any): import("react/jsx-runtime").JSX.Element;
@@ -1,7 +1,6 @@
1
1
  import { AnyRoute } from './route.cjs';
2
2
  import { AnyRouter, TrailingSlashOption } from './router.cjs';
3
3
  import { MergeUnion } from './utils.cjs';
4
-
5
4
  export type ParseRoute<TRouteTree, TAcc = TRouteTree> = TRouteTree extends {
6
5
  types: {
7
6
  children: infer TChildren;
@@ -12,7 +12,6 @@ import { AnyRedirect, ResolvedRedirect } from './redirects.cjs';
12
12
  import { NotFoundError } from './not-found.cjs';
13
13
  import { NavigateOptions, ResolveRelativePath, ToOptions } from './link.cjs';
14
14
  import { RouterTransformer } from './transformer.cjs';
15
-
16
15
  import type * as React from 'react';
17
16
  declare global {
18
17
  interface Window {
@@ -1,5 +1,4 @@
1
1
  import { ParsedLocation } from './location.cjs';
2
-
3
2
  export type ScrollRestorationOptions = {
4
3
  getKey?: (location: ParsedLocation) => string;
5
4
  };
@@ -1,5 +1,4 @@
1
1
  import { AnySearchSchema } from './route.cjs';
2
-
3
2
  export declare const defaultParseSearch: (searchStr: string) => AnySearchSchema;
4
3
  export declare const defaultStringifySearch: (search: Record<string, any>) => string;
5
4
  export declare function parseSearchWith(parser: (str: string) => any): (searchStr: string) => AnySearchSchema;
@@ -1,6 +1,5 @@
1
1
  import { BlockerFn } from '@tanstack/history';
2
2
  import { ReactNode } from './route.cjs';
3
-
4
3
  type BlockerResolver = {
5
4
  status: 'idle' | 'blocked';
6
5
  proceed: () => void;
@@ -3,7 +3,6 @@ import { AnyRoute } from './route.cjs';
3
3
  import { MakeRouteMatch } from './Matches.cjs';
4
4
  import { RouteIds } from './routeInfo.cjs';
5
5
  import { StrictOrFrom } from './utils.cjs';
6
-
7
6
  export type UseLoaderDataOptions<TRouteTree extends AnyRoute, TFrom, TStrict extends boolean, TRouteMatch extends MakeRouteMatch<TRouteTree, TFrom, TStrict>, TSelected> = StrictOrFrom<TFrom, TStrict> & {
8
7
  select?: (match: Required<TRouteMatch>['loaderData']) => TSelected;
9
8
  };
@@ -3,7 +3,6 @@ import { AnyRoute } from './route.cjs';
3
3
  import { MakeRouteMatch } from './Matches.cjs';
4
4
  import { RouteIds } from './routeInfo.cjs';
5
5
  import { StrictOrFrom } from './utils.cjs';
6
-
7
6
  export declare function useLoaderDeps<TRouteTree extends AnyRoute = RegisteredRouter['routeTree'], TFrom extends RouteIds<TRouteTree> = RouteIds<TRouteTree>, TRouteMatch extends MakeRouteMatch<TRouteTree, TFrom> = MakeRouteMatch<TRouteTree, TFrom>, TSelected = Required<TRouteMatch>['loaderDeps']>(opts: StrictOrFrom<TFrom> & {
8
7
  select?: (match: TRouteMatch) => TSelected;
9
8
  }): TSelected;
@@ -1,5 +1,4 @@
1
1
  import { AnyRouter, RegisteredRouter, RouterState } from './router.cjs';
2
-
3
2
  export declare function useLocation<TRouter extends AnyRouter = RegisteredRouter, TLocationState = RouterState<TRouter['routeTree']>['location'], TSelected = TLocationState>(opts?: {
4
3
  select?: (state: TLocationState) => TSelected;
5
4
  }): TSelected;
@@ -3,7 +3,6 @@ import { AnyRoute } from './route.cjs';
3
3
  import { MakeRouteMatch } from './Matches.cjs';
4
4
  import { RouteIds } from './routeInfo.cjs';
5
5
  import { StrictOrFrom } from './utils.cjs';
6
-
7
6
  export type UseMatchOptions<TFrom, TStrict extends boolean, TRouteMatch, TSelected, TThrow extends boolean> = StrictOrFrom<TFrom, TStrict> & {
8
7
  select?: (match: TRouteMatch) => TSelected;
9
8
  shouldThrow?: TThrow;
@@ -1,7 +1,6 @@
1
1
  import { FromPathOption, NavigateOptions } from './link.cjs';
2
2
  import { RoutePaths } from './routeInfo.cjs';
3
3
  import { AnyRouter, RegisteredRouter } from './router.cjs';
4
-
5
4
  export type UseNavigateResult<TDefaultFrom extends string> = <TTo extends string, TRouter extends AnyRouter = RegisteredRouter, TFrom extends RoutePaths<TRouter['routeTree']> | string = TDefaultFrom, TMaskFrom extends RoutePaths<TRouter['routeTree']> | string = TFrom, TMaskTo extends string = ''>({ from, ...rest }: NavigateOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>) => Promise<void>;
6
5
  export declare function useNavigate<TRouter extends AnyRouter = RegisteredRouter, TDefaultFrom extends string = string>(_defaultOpts?: {
7
6
  from?: FromPathOption<TRouter, TDefaultFrom>;
@@ -2,7 +2,6 @@ import { AnyRoute } from './route.cjs';
2
2
  import { AllParams, RouteById, RouteIds } from './routeInfo.cjs';
3
3
  import { RegisteredRouter } from './router.cjs';
4
4
  import { StrictOrFrom } from './utils.cjs';
5
-
6
5
  export type UseParamsOptions<TFrom, TStrict extends boolean, TParams, TSelected> = StrictOrFrom<TFrom, TStrict> & {
7
6
  select?: (params: TParams) => TSelected;
8
7
  };
@@ -2,7 +2,6 @@ import { AnyRoute } from './route.cjs';
2
2
  import { AllContext, RouteById, RouteIds } from './routeInfo.cjs';
3
3
  import { RegisteredRouter } from './router.cjs';
4
4
  import { Expand, StrictOrFrom } from './utils.cjs';
5
-
6
5
  export type UseRouteContextOptions<TFrom, TStrict extends boolean, TRouteContext, TSelected> = StrictOrFrom<TFrom, TStrict> & {
7
6
  select?: (search: TRouteContext) => TSelected;
8
7
  };
@@ -1,5 +1,4 @@
1
1
  import { AnyRouter, RegisteredRouter } from './router.cjs';
2
-
3
2
  export declare function useRouter<TRouter extends AnyRouter = RegisteredRouter>(opts?: {
4
3
  warn?: boolean;
5
4
  }): TRouter;
@@ -1,5 +1,4 @@
1
1
  import { AnyRouter, RegisteredRouter, RouterState } from './router.cjs';
2
-
3
2
  export declare function useRouterState<TRouter extends AnyRouter = RegisteredRouter, TSelected = RouterState<TRouter['routeTree']>>(opts?: {
4
3
  router?: TRouter;
5
4
  select: (state: RouterState<RegisteredRouter['routeTree']>) => TSelected;
@@ -2,7 +2,6 @@ import { AnyRoute } from './route.cjs';
2
2
  import { FullSearchSchema, RouteById, RouteIds } from './routeInfo.cjs';
3
3
  import { RegisteredRouter } from './router.cjs';
4
4
  import { Expand, StrictOrFrom } from './utils.cjs';
5
-
6
5
  export type UseSearchOptions<TFrom, TStrict extends boolean, TSearch, TSelected> = StrictOrFrom<TFrom, TStrict> & {
7
6
  select?: (search: TSearch) => TSelected;
8
7
  };
@@ -1,5 +1,4 @@
1
1
  import { defaultSerializeError } from './router.js';
2
-
3
2
  export type DeferredPromiseState<T> = {
4
3
  uid: string;
5
4
  resolve?: () => void;
@@ -3,7 +3,6 @@ import { AnyContext, AnyPathParams, AnyRoute, AnySearchValidator, FileBaseRouteO
3
3
  import { MakeRouteMatch } from './Matches.js';
4
4
  import { RegisteredRouter } from './router.js';
5
5
  import { RouteById, RouteIds } from './routeInfo.js';
6
-
7
6
  export interface FileRoutesByPath {
8
7
  }
9
8
  export declare function createFileRoute<TFilePath extends keyof FileRoutesByPath, TParentRoute extends AnyRoute = FileRoutesByPath[TFilePath]['parentRoute'], TId extends RouteConstraints['TId'] = FileRoutesByPath[TFilePath]['id'], TPath extends RouteConstraints['TPath'] = FileRoutesByPath[TFilePath]['path'], TFullPath extends RouteConstraints['TFullPath'] = FileRoutesByPath[TFilePath]['fullPath']>(path: TFilePath): FileRoute<TFilePath, TParentRoute, TId, TPath, TFullPath>['createRoute'];
@@ -51,7 +50,7 @@ export declare class LazyRoute<TRoute extends AnyRoute> {
51
50
  useLoaderData: <TSelected = TRoute["types"]["loaderData"]>(opts?: {
52
51
  select?: (s: TRoute["types"]["loaderData"]) => TSelected;
53
52
  }) => TSelected;
54
- useNavigate: () => import('./useNavigate').UseNavigateResult<string>;
53
+ useNavigate: () => import('./useNavigate.js').UseNavigateResult<string>;
55
54
  }
56
55
  export declare function createLazyRoute<TId extends RouteIds<RegisteredRouter['routeTree']>, TRoute extends AnyRoute = RouteById<RegisteredRouter['routeTree'], TId>>(id: TId): (opts: LazyRouteOptions) => LazyRoute<TRoute>;
57
56
  export declare function createLazyFileRoute<TFilePath extends keyof FileRoutesByPath, TRoute extends FileRoutesByPath[TFilePath]['preLoaderRoute']>(id: TFilePath): (opts: LazyRouteOptions) => LazyRoute<TRoute>;
@@ -68,8 +68,12 @@ function createLazyRoute(id) {
68
68
  return new LazyRoute({ id, ...opts });
69
69
  };
70
70
  }
71
+ const routeGroupPatternRegex = /\(.+\)/g;
72
+ function removeGroups(s) {
73
+ return s.replaceAll(routeGroupPatternRegex, "").replaceAll("//", "/");
74
+ }
71
75
  function createLazyFileRoute(id) {
72
- return (opts) => new LazyRoute({ id, ...opts });
76
+ return (opts) => new LazyRoute({ id: removeGroups(id), ...opts });
73
77
  }
74
78
  export {
75
79
  FileRoute,
@@ -1 +1 @@
1
- {"version":3,"file":"fileRoute.js","sources":["../../src/fileRoute.ts"],"sourcesContent":["import warning from 'tiny-warning'\nimport { createRoute } from './route'\nimport { useMatch } from './useMatch'\nimport { useLoaderDeps } from './useLoaderDeps'\nimport { useLoaderData } from './useLoaderData'\nimport { useSearch } from './useSearch'\nimport { useParams } from './useParams'\nimport { useNavigate } from './useNavigate'\nimport type { Constrain } from './utils'\nimport type {\n AnyContext,\n AnyPathParams,\n AnyRoute,\n AnySearchValidator,\n FileBaseRouteOptions,\n ResolveParams,\n Route,\n RouteConstraints,\n RouteLoaderFn,\n UpdatableRouteOptions,\n} from './route'\nimport type { MakeRouteMatch } from './Matches'\nimport type { RegisteredRouter } from './router'\nimport type { RouteById, RouteIds } from './routeInfo'\n\nexport interface FileRoutesByPath {\n // '/': {\n // parentRoute: typeof rootRoute\n // }\n}\n\nexport function createFileRoute<\n TFilePath extends keyof FileRoutesByPath,\n TParentRoute extends AnyRoute = FileRoutesByPath[TFilePath]['parentRoute'],\n TId extends RouteConstraints['TId'] = FileRoutesByPath[TFilePath]['id'],\n TPath extends RouteConstraints['TPath'] = FileRoutesByPath[TFilePath]['path'],\n TFullPath extends\n RouteConstraints['TFullPath'] = FileRoutesByPath[TFilePath]['fullPath'],\n>(\n path: TFilePath,\n): FileRoute<TFilePath, TParentRoute, TId, TPath, TFullPath>['createRoute'] {\n return new FileRoute<TFilePath, TParentRoute, TId, TPath, TFullPath>(path, {\n silent: true,\n }).createRoute\n}\n\n/** \n @deprecated It's no longer recommended to use the `FileRoute` class directly.\n Instead, use `createFileRoute('/path/to/file')(options)` to create a file route.\n*/\nexport class FileRoute<\n TFilePath extends keyof FileRoutesByPath,\n TParentRoute extends AnyRoute = FileRoutesByPath[TFilePath]['parentRoute'],\n TId extends RouteConstraints['TId'] = FileRoutesByPath[TFilePath]['id'],\n TPath extends RouteConstraints['TPath'] = FileRoutesByPath[TFilePath]['path'],\n TFullPath extends\n RouteConstraints['TFullPath'] = FileRoutesByPath[TFilePath]['fullPath'],\n> {\n silent?: boolean\n\n constructor(\n public path: TFilePath,\n _opts?: { silent: boolean },\n ) {\n this.silent = _opts?.silent\n }\n\n createRoute = <\n TSearchValidator = undefined,\n TParams = ResolveParams<TPath>,\n TRouteContextFn = AnyContext,\n TBeforeLoadFn = AnyContext,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderFn = undefined,\n TChildren = unknown,\n >(\n options?: FileBaseRouteOptions<\n TParentRoute,\n TPath,\n TSearchValidator,\n TParams,\n TLoaderDeps,\n TLoaderFn,\n AnyContext,\n TRouteContextFn,\n TBeforeLoadFn\n > &\n UpdatableRouteOptions<\n TParentRoute,\n TId,\n TFullPath,\n TParams,\n TSearchValidator,\n TLoaderFn,\n TLoaderDeps,\n AnyContext,\n TRouteContextFn,\n TBeforeLoadFn\n >,\n ): Route<\n TParentRoute,\n TPath,\n TFullPath,\n TFilePath,\n TId,\n TSearchValidator,\n TParams,\n AnyContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn,\n TChildren\n > => {\n warning(\n this.silent,\n 'FileRoute is deprecated and will be removed in the next major version. Use the createFileRoute(path)(options) function instead.',\n )\n const route = createRoute(options as any)\n ;(route as any).isRoot = false\n return route as any\n }\n}\n\n/** \n @deprecated It's recommended not to split loaders into separate files.\n Instead, place the loader function in the the main route file, inside the\n `createFileRoute('/path/to/file)(options)` options.\n*/\nexport function FileRouteLoader<\n TFilePath extends keyof FileRoutesByPath,\n TRoute extends FileRoutesByPath[TFilePath]['preLoaderRoute'],\n>(\n _path: TFilePath,\n): <TLoaderFn>(\n loaderFn: Constrain<\n TLoaderFn,\n RouteLoaderFn<\n TRoute['parentRoute'],\n TRoute['types']['params'],\n TRoute['types']['loaderDeps'],\n TRoute['types']['routerContext'],\n TRoute['types']['routeContextFn'],\n TRoute['types']['beforeLoadFn']\n >\n >,\n) => TLoaderFn {\n warning(\n false,\n `FileRouteLoader is deprecated and will be removed in the next major version. Please place the loader function in the the main route file, inside the \\`createFileRoute('/path/to/file')(options)\\` options`,\n )\n return (loaderFn) => loaderFn as any\n}\n\nexport type LazyRouteOptions = Pick<\n UpdatableRouteOptions<\n AnyRoute,\n string,\n string,\n AnyPathParams,\n AnySearchValidator,\n {},\n AnyContext,\n AnyContext,\n AnyContext,\n AnyContext\n >,\n 'component' | 'errorComponent' | 'pendingComponent' | 'notFoundComponent'\n>\n\nexport class LazyRoute<TRoute extends AnyRoute> {\n options: {\n id: string\n } & LazyRouteOptions\n\n constructor(\n opts: {\n id: string\n } & LazyRouteOptions,\n ) {\n this.options = opts\n ;(this as any).$$typeof = Symbol.for('react.memo')\n }\n\n useMatch = <\n TRouteMatch = MakeRouteMatch<\n RegisteredRouter['routeTree'],\n TRoute['types']['id']\n >,\n TSelected = TRouteMatch,\n >(opts?: {\n select?: (match: TRouteMatch) => TSelected\n }): TSelected => {\n return useMatch({ select: opts?.select, from: this.options.id })\n }\n\n useRouteContext = <TSelected = TRoute['types']['allContext']>(opts?: {\n select?: (s: TRoute['types']['allContext']) => TSelected\n }): TSelected => {\n return useMatch({\n from: this.options.id,\n select: (d: any) => (opts?.select ? opts.select(d.context) : d.context),\n })\n }\n\n useSearch = <TSelected = TRoute['types']['fullSearchSchema']>(opts?: {\n select?: (s: TRoute['types']['fullSearchSchema']) => TSelected\n }): TSelected => {\n return useSearch({ ...opts, from: this.options.id })\n }\n\n useParams = <TSelected = TRoute['types']['allParams']>(opts?: {\n select?: (s: TRoute['types']['allParams']) => TSelected\n }): TSelected => {\n return useParams({ ...opts, from: this.options.id })\n }\n\n useLoaderDeps = <TSelected = TRoute['types']['loaderDeps']>(opts?: {\n select?: (s: TRoute['types']['loaderDeps']) => TSelected\n }): TSelected => {\n return useLoaderDeps({ ...opts, from: this.options.id } as any)\n }\n\n useLoaderData = <TSelected = TRoute['types']['loaderData']>(opts?: {\n select?: (s: TRoute['types']['loaderData']) => TSelected\n }): TSelected => {\n return useLoaderData({ ...opts, from: this.options.id } as any)\n }\n\n useNavigate = () => {\n return useNavigate({ from: this.options.id })\n }\n}\n\nexport function createLazyRoute<\n TId extends RouteIds<RegisteredRouter['routeTree']>,\n TRoute extends AnyRoute = RouteById<RegisteredRouter['routeTree'], TId>,\n>(id: TId) {\n return (opts: LazyRouteOptions) => {\n return new LazyRoute<TRoute>({ id: id as any, ...opts })\n }\n}\n\nexport function createLazyFileRoute<\n TFilePath extends keyof FileRoutesByPath,\n TRoute extends FileRoutesByPath[TFilePath]['preLoaderRoute'],\n>(id: TFilePath) {\n return (opts: LazyRouteOptions) => new LazyRoute<TRoute>({ id, ...opts })\n}\n"],"names":["opts"],"mappings":";;;;;;;;AA+BO,SAAS,gBAQd,MAC0E;AACnE,SAAA,IAAI,UAA0D,MAAM;AAAA,IACzE,QAAQ;AAAA,EACT,CAAA,EAAE;AACL;AAMO,MAAM,UAOX;AAAA,EAGA,YACS,MACP,OACA;AAFO,SAAA,OAAA;AAMT,SAAA,cAAc,CASZ,YAqCG;AACH;AAAA,QACE,KAAK;AAAA,QACL;AAAA,MAAA;AAEI,YAAA,QAAQ,YAAY,OAAc;AACtC,YAAc,SAAS;AAClB,aAAA;AAAA,IAAA;AAxDP,SAAK,SAAS,+BAAO;AAAA,EACvB;AAyDF;AAOO,SAAS,gBAId,OAaa;AACb;AAAA,IACE;AAAA,IACA;AAAA,EAAA;AAEF,SAAO,CAAC,aAAa;AACvB;AAkBO,MAAM,UAAmC;AAAA,EAK9C,YACE,MAGA;AAKF,SAAA,WAAW,CAMTA,UAEe;AACR,aAAA,SAAS,EAAE,QAAQA,SAAA,gBAAAA,MAAM,QAAQ,MAAM,KAAK,QAAQ,GAAA,CAAI;AAAA,IAAA;AAGjE,SAAA,kBAAkB,CAA4CA,UAE7C;AACf,aAAO,SAAS;AAAA,QACd,MAAM,KAAK,QAAQ;AAAA,QACnB,QAAQ,CAAC,OAAYA,SAAA,gBAAAA,MAAM,UAASA,MAAK,OAAO,EAAE,OAAO,IAAI,EAAE;AAAA,MAAA,CAChE;AAAA,IAAA;AAGH,SAAA,YAAY,CAAkDA,UAE7C;AACR,aAAA,UAAU,EAAE,GAAGA,OAAM,MAAM,KAAK,QAAQ,IAAI;AAAA,IAAA;AAGrD,SAAA,YAAY,CAA2CA,UAEtC;AACR,aAAA,UAAU,EAAE,GAAGA,OAAM,MAAM,KAAK,QAAQ,IAAI;AAAA,IAAA;AAGrD,SAAA,gBAAgB,CAA4CA,UAE3C;AACR,aAAA,cAAc,EAAE,GAAGA,OAAM,MAAM,KAAK,QAAQ,IAAW;AAAA,IAAA;AAGhE,SAAA,gBAAgB,CAA4CA,UAE3C;AACR,aAAA,cAAc,EAAE,GAAGA,OAAM,MAAM,KAAK,QAAQ,IAAW;AAAA,IAAA;AAGhE,SAAA,cAAc,MAAM;AAClB,aAAO,YAAY,EAAE,MAAM,KAAK,QAAQ,IAAI;AAAA,IAAA;AAlD5C,SAAK,UAAU;AACb,SAAa,WAAW,OAAO,IAAI,YAAY;AAAA,EACnD;AAkDF;AAEO,SAAS,gBAGd,IAAS;AACT,SAAO,CAAC,SAA2B;AACjC,WAAO,IAAI,UAAkB,EAAE,IAAe,GAAG,KAAM,CAAA;AAAA,EAAA;AAE3D;AAEO,SAAS,oBAGd,IAAe;AACR,SAAA,CAAC,SAA2B,IAAI,UAAkB,EAAE,IAAI,GAAG,MAAM;AAC1E;"}
1
+ {"version":3,"file":"fileRoute.js","sources":["../../src/fileRoute.ts"],"sourcesContent":["import warning from 'tiny-warning'\nimport { createRoute } from './route'\nimport { useMatch } from './useMatch'\nimport { useLoaderDeps } from './useLoaderDeps'\nimport { useLoaderData } from './useLoaderData'\nimport { useSearch } from './useSearch'\nimport { useParams } from './useParams'\nimport { useNavigate } from './useNavigate'\nimport type { Constrain } from './utils'\nimport type {\n AnyContext,\n AnyPathParams,\n AnyRoute,\n AnySearchValidator,\n FileBaseRouteOptions,\n ResolveParams,\n Route,\n RouteConstraints,\n RouteLoaderFn,\n UpdatableRouteOptions,\n} from './route'\nimport type { MakeRouteMatch } from './Matches'\nimport type { RegisteredRouter } from './router'\nimport type { RouteById, RouteIds } from './routeInfo'\n\nexport interface FileRoutesByPath {\n // '/': {\n // parentRoute: typeof rootRoute\n // }\n}\n\nexport function createFileRoute<\n TFilePath extends keyof FileRoutesByPath,\n TParentRoute extends AnyRoute = FileRoutesByPath[TFilePath]['parentRoute'],\n TId extends RouteConstraints['TId'] = FileRoutesByPath[TFilePath]['id'],\n TPath extends RouteConstraints['TPath'] = FileRoutesByPath[TFilePath]['path'],\n TFullPath extends\n RouteConstraints['TFullPath'] = FileRoutesByPath[TFilePath]['fullPath'],\n>(\n path: TFilePath,\n): FileRoute<TFilePath, TParentRoute, TId, TPath, TFullPath>['createRoute'] {\n return new FileRoute<TFilePath, TParentRoute, TId, TPath, TFullPath>(path, {\n silent: true,\n }).createRoute\n}\n\n/** \n @deprecated It's no longer recommended to use the `FileRoute` class directly.\n Instead, use `createFileRoute('/path/to/file')(options)` to create a file route.\n*/\nexport class FileRoute<\n TFilePath extends keyof FileRoutesByPath,\n TParentRoute extends AnyRoute = FileRoutesByPath[TFilePath]['parentRoute'],\n TId extends RouteConstraints['TId'] = FileRoutesByPath[TFilePath]['id'],\n TPath extends RouteConstraints['TPath'] = FileRoutesByPath[TFilePath]['path'],\n TFullPath extends\n RouteConstraints['TFullPath'] = FileRoutesByPath[TFilePath]['fullPath'],\n> {\n silent?: boolean\n\n constructor(\n public path: TFilePath,\n _opts?: { silent: boolean },\n ) {\n this.silent = _opts?.silent\n }\n\n createRoute = <\n TSearchValidator = undefined,\n TParams = ResolveParams<TPath>,\n TRouteContextFn = AnyContext,\n TBeforeLoadFn = AnyContext,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderFn = undefined,\n TChildren = unknown,\n >(\n options?: FileBaseRouteOptions<\n TParentRoute,\n TPath,\n TSearchValidator,\n TParams,\n TLoaderDeps,\n TLoaderFn,\n AnyContext,\n TRouteContextFn,\n TBeforeLoadFn\n > &\n UpdatableRouteOptions<\n TParentRoute,\n TId,\n TFullPath,\n TParams,\n TSearchValidator,\n TLoaderFn,\n TLoaderDeps,\n AnyContext,\n TRouteContextFn,\n TBeforeLoadFn\n >,\n ): Route<\n TParentRoute,\n TPath,\n TFullPath,\n TFilePath,\n TId,\n TSearchValidator,\n TParams,\n AnyContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn,\n TChildren\n > => {\n warning(\n this.silent,\n 'FileRoute is deprecated and will be removed in the next major version. Use the createFileRoute(path)(options) function instead.',\n )\n const route = createRoute(options as any)\n ;(route as any).isRoot = false\n return route as any\n }\n}\n\n/** \n @deprecated It's recommended not to split loaders into separate files.\n Instead, place the loader function in the the main route file, inside the\n `createFileRoute('/path/to/file)(options)` options.\n*/\nexport function FileRouteLoader<\n TFilePath extends keyof FileRoutesByPath,\n TRoute extends FileRoutesByPath[TFilePath]['preLoaderRoute'],\n>(\n _path: TFilePath,\n): <TLoaderFn>(\n loaderFn: Constrain<\n TLoaderFn,\n RouteLoaderFn<\n TRoute['parentRoute'],\n TRoute['types']['params'],\n TRoute['types']['loaderDeps'],\n TRoute['types']['routerContext'],\n TRoute['types']['routeContextFn'],\n TRoute['types']['beforeLoadFn']\n >\n >,\n) => TLoaderFn {\n warning(\n false,\n `FileRouteLoader is deprecated and will be removed in the next major version. Please place the loader function in the the main route file, inside the \\`createFileRoute('/path/to/file')(options)\\` options`,\n )\n return (loaderFn) => loaderFn as any\n}\n\nexport type LazyRouteOptions = Pick<\n UpdatableRouteOptions<\n AnyRoute,\n string,\n string,\n AnyPathParams,\n AnySearchValidator,\n {},\n AnyContext,\n AnyContext,\n AnyContext,\n AnyContext\n >,\n 'component' | 'errorComponent' | 'pendingComponent' | 'notFoundComponent'\n>\n\nexport class LazyRoute<TRoute extends AnyRoute> {\n options: {\n id: string\n } & LazyRouteOptions\n\n constructor(\n opts: {\n id: string\n } & LazyRouteOptions,\n ) {\n this.options = opts\n ;(this as any).$$typeof = Symbol.for('react.memo')\n }\n\n useMatch = <\n TRouteMatch = MakeRouteMatch<\n RegisteredRouter['routeTree'],\n TRoute['types']['id']\n >,\n TSelected = TRouteMatch,\n >(opts?: {\n select?: (match: TRouteMatch) => TSelected\n }): TSelected => {\n return useMatch({ select: opts?.select, from: this.options.id })\n }\n\n useRouteContext = <TSelected = TRoute['types']['allContext']>(opts?: {\n select?: (s: TRoute['types']['allContext']) => TSelected\n }): TSelected => {\n return useMatch({\n from: this.options.id,\n select: (d: any) => (opts?.select ? opts.select(d.context) : d.context),\n })\n }\n\n useSearch = <TSelected = TRoute['types']['fullSearchSchema']>(opts?: {\n select?: (s: TRoute['types']['fullSearchSchema']) => TSelected\n }): TSelected => {\n return useSearch({ ...opts, from: this.options.id })\n }\n\n useParams = <TSelected = TRoute['types']['allParams']>(opts?: {\n select?: (s: TRoute['types']['allParams']) => TSelected\n }): TSelected => {\n return useParams({ ...opts, from: this.options.id })\n }\n\n useLoaderDeps = <TSelected = TRoute['types']['loaderDeps']>(opts?: {\n select?: (s: TRoute['types']['loaderDeps']) => TSelected\n }): TSelected => {\n return useLoaderDeps({ ...opts, from: this.options.id } as any)\n }\n\n useLoaderData = <TSelected = TRoute['types']['loaderData']>(opts?: {\n select?: (s: TRoute['types']['loaderData']) => TSelected\n }): TSelected => {\n return useLoaderData({ ...opts, from: this.options.id } as any)\n }\n\n useNavigate = () => {\n return useNavigate({ from: this.options.id })\n }\n}\n\nexport function createLazyRoute<\n TId extends RouteIds<RegisteredRouter['routeTree']>,\n TRoute extends AnyRoute = RouteById<RegisteredRouter['routeTree'], TId>,\n>(id: TId) {\n return (opts: LazyRouteOptions) => {\n return new LazyRoute<TRoute>({ id: id as any, ...opts })\n }\n}\n\nconst routeGroupPatternRegex = /\\(.+\\)/g\n\nfunction removeGroups(s: string) {\n return s.replaceAll(routeGroupPatternRegex, '').replaceAll('//', '/')\n}\n\nexport function createLazyFileRoute<\n TFilePath extends keyof FileRoutesByPath,\n TRoute extends FileRoutesByPath[TFilePath]['preLoaderRoute'],\n>(id: TFilePath) {\n return (opts: LazyRouteOptions) =>\n new LazyRoute<TRoute>({ id: removeGroups(id), ...opts })\n}\n"],"names":["opts"],"mappings":";;;;;;;;AA+BO,SAAS,gBAQd,MAC0E;AACnE,SAAA,IAAI,UAA0D,MAAM;AAAA,IACzE,QAAQ;AAAA,EACT,CAAA,EAAE;AACL;AAMO,MAAM,UAOX;AAAA,EAGA,YACS,MACP,OACA;AAFO,SAAA,OAAA;AAMT,SAAA,cAAc,CASZ,YAqCG;AACH;AAAA,QACE,KAAK;AAAA,QACL;AAAA,MAAA;AAEI,YAAA,QAAQ,YAAY,OAAc;AACtC,YAAc,SAAS;AAClB,aAAA;AAAA,IAAA;AAxDP,SAAK,SAAS,+BAAO;AAAA,EACvB;AAyDF;AAOO,SAAS,gBAId,OAaa;AACb;AAAA,IACE;AAAA,IACA;AAAA,EAAA;AAEF,SAAO,CAAC,aAAa;AACvB;AAkBO,MAAM,UAAmC;AAAA,EAK9C,YACE,MAGA;AAKF,SAAA,WAAW,CAMTA,UAEe;AACR,aAAA,SAAS,EAAE,QAAQA,SAAA,gBAAAA,MAAM,QAAQ,MAAM,KAAK,QAAQ,GAAA,CAAI;AAAA,IAAA;AAGjE,SAAA,kBAAkB,CAA4CA,UAE7C;AACf,aAAO,SAAS;AAAA,QACd,MAAM,KAAK,QAAQ;AAAA,QACnB,QAAQ,CAAC,OAAYA,SAAA,gBAAAA,MAAM,UAASA,MAAK,OAAO,EAAE,OAAO,IAAI,EAAE;AAAA,MAAA,CAChE;AAAA,IAAA;AAGH,SAAA,YAAY,CAAkDA,UAE7C;AACR,aAAA,UAAU,EAAE,GAAGA,OAAM,MAAM,KAAK,QAAQ,IAAI;AAAA,IAAA;AAGrD,SAAA,YAAY,CAA2CA,UAEtC;AACR,aAAA,UAAU,EAAE,GAAGA,OAAM,MAAM,KAAK,QAAQ,IAAI;AAAA,IAAA;AAGrD,SAAA,gBAAgB,CAA4CA,UAE3C;AACR,aAAA,cAAc,EAAE,GAAGA,OAAM,MAAM,KAAK,QAAQ,IAAW;AAAA,IAAA;AAGhE,SAAA,gBAAgB,CAA4CA,UAE3C;AACR,aAAA,cAAc,EAAE,GAAGA,OAAM,MAAM,KAAK,QAAQ,IAAW;AAAA,IAAA;AAGhE,SAAA,cAAc,MAAM;AAClB,aAAO,YAAY,EAAE,MAAM,KAAK,QAAQ,IAAI;AAAA,IAAA;AAlD5C,SAAK,UAAU;AACb,SAAa,WAAW,OAAO,IAAI,YAAY;AAAA,EACnD;AAkDF;AAEO,SAAS,gBAGd,IAAS;AACT,SAAO,CAAC,SAA2B;AACjC,WAAO,IAAI,UAAkB,EAAE,IAAe,GAAG,KAAM,CAAA;AAAA,EAAA;AAE3D;AAEA,MAAM,yBAAyB;AAE/B,SAAS,aAAa,GAAW;AAC/B,SAAO,EAAE,WAAW,wBAAwB,EAAE,EAAE,WAAW,MAAM,GAAG;AACtE;AAEO,SAAS,oBAGd,IAAe;AACR,SAAA,CAAC,SACN,IAAI,UAAkB,EAAE,IAAI,aAAa,EAAE,GAAG,GAAG,KAAA,CAAM;AAC3D;"}
@@ -55,7 +55,7 @@ export { useRouterState } from './useRouterState.js';
55
55
  export { useLocation } from './useLocation.js';
56
56
  export { escapeJSON, // SSR
57
57
  useLayoutEffect, // SSR
58
- pick, functionalUpdate, replaceEqualDeep, isPlainObject, isPlainArray, deepEqual, useStableCallback, shallow, } from './utils';
58
+ pick, functionalUpdate, replaceEqualDeep, isPlainObject, isPlainArray, deepEqual, useStableCallback, shallow, } from './utils.js';
59
59
  export { notFound, isNotFound, CatchNotFound, DefaultGlobalNotFound, } from './not-found.js';
60
60
  export type { NotFoundError } from './not-found.js';
61
61
  export type { Manifest, RouterManagedTag } from './manifest.js';
@@ -1,3 +1,2 @@
1
1
  import { AsyncRouteComponent } from './route.js';
2
-
3
2
  export declare function lazyRouteComponent<T extends Record<string, any>, TKey extends keyof T = 'default'>(importer: () => Promise<T>, exportName?: TKey): T[TKey] extends (props: infer TProps) => any ? AsyncRouteComponent<TProps> : never;
@@ -1,6 +1,5 @@
1
1
  import { HistoryState } from '@tanstack/history';
2
2
  import { AnySearchSchema } from './route.js';
3
-
4
3
  export interface ParsedLocation<TSearchObj extends AnySearchSchema = {}> {
5
4
  href: string;
6
5
  pathname: string;
@@ -1,6 +1,5 @@
1
1
  import { MatchLocation } from './RouterProvider.js';
2
2
  import { AnyPathParams } from './route.js';
3
-
4
3
  export interface Segment {
5
4
  type: 'pathname' | 'param' | 'wildcard';
6
5
  value: string;
@@ -2,7 +2,6 @@ import { NavigateOptions } from './link.js';
2
2
  import { RoutePaths } from './routeInfo.js';
3
3
  import { AnyRouter, RegisteredRouter } from './router.js';
4
4
  import { PickAsRequired } from './utils.js';
5
-
6
5
  export type AnyRedirect = Redirect<any, any, any, any, any>;
7
6
  export type Redirect<TRouter extends AnyRouter = RegisteredRouter, TFrom extends RoutePaths<TRouter['routeTree']> = '/', TTo extends string = '', TMaskFrom extends RoutePaths<TRouter['routeTree']> = TFrom, TMaskTo extends string = ''> = {
8
7
  /**
@@ -1,4 +1,3 @@
1
1
  import { AnyRouter } from './router.js';
2
2
  import { AnyRoute } from './route.js';
3
-
4
3
  export declare function renderRouteNotFound(router: AnyRouter, route: AnyRoute, data: any): import("react/jsx-runtime").JSX.Element;
@@ -1,7 +1,6 @@
1
1
  import { AnyRoute } from './route.js';
2
2
  import { AnyRouter, TrailingSlashOption } from './router.js';
3
3
  import { MergeUnion } from './utils.js';
4
-
5
4
  export type ParseRoute<TRouteTree, TAcc = TRouteTree> = TRouteTree extends {
6
5
  types: {
7
6
  children: infer TChildren;
@@ -12,7 +12,6 @@ import { AnyRedirect, ResolvedRedirect } from './redirects.js';
12
12
  import { NotFoundError } from './not-found.js';
13
13
  import { NavigateOptions, ResolveRelativePath, ToOptions } from './link.js';
14
14
  import { RouterTransformer } from './transformer.js';
15
-
16
15
  import type * as React from 'react';
17
16
  declare global {
18
17
  interface Window {
@@ -1,5 +1,4 @@
1
1
  import { ParsedLocation } from './location.js';
2
-
3
2
  export type ScrollRestorationOptions = {
4
3
  getKey?: (location: ParsedLocation) => string;
5
4
  };
@@ -1,5 +1,4 @@
1
1
  import { AnySearchSchema } from './route.js';
2
-
3
2
  export declare const defaultParseSearch: (searchStr: string) => AnySearchSchema;
4
3
  export declare const defaultStringifySearch: (search: Record<string, any>) => string;
5
4
  export declare function parseSearchWith(parser: (str: string) => any): (searchStr: string) => AnySearchSchema;
@@ -1,6 +1,5 @@
1
1
  import { BlockerFn } from '@tanstack/history';
2
2
  import { ReactNode } from './route.js';
3
-
4
3
  type BlockerResolver = {
5
4
  status: 'idle' | 'blocked';
6
5
  proceed: () => void;
@@ -3,7 +3,6 @@ import { AnyRoute } from './route.js';
3
3
  import { MakeRouteMatch } from './Matches.js';
4
4
  import { RouteIds } from './routeInfo.js';
5
5
  import { StrictOrFrom } from './utils.js';
6
-
7
6
  export type UseLoaderDataOptions<TRouteTree extends AnyRoute, TFrom, TStrict extends boolean, TRouteMatch extends MakeRouteMatch<TRouteTree, TFrom, TStrict>, TSelected> = StrictOrFrom<TFrom, TStrict> & {
8
7
  select?: (match: Required<TRouteMatch>['loaderData']) => TSelected;
9
8
  };
@@ -3,7 +3,6 @@ import { AnyRoute } from './route.js';
3
3
  import { MakeRouteMatch } from './Matches.js';
4
4
  import { RouteIds } from './routeInfo.js';
5
5
  import { StrictOrFrom } from './utils.js';
6
-
7
6
  export declare function useLoaderDeps<TRouteTree extends AnyRoute = RegisteredRouter['routeTree'], TFrom extends RouteIds<TRouteTree> = RouteIds<TRouteTree>, TRouteMatch extends MakeRouteMatch<TRouteTree, TFrom> = MakeRouteMatch<TRouteTree, TFrom>, TSelected = Required<TRouteMatch>['loaderDeps']>(opts: StrictOrFrom<TFrom> & {
8
7
  select?: (match: TRouteMatch) => TSelected;
9
8
  }): TSelected;
@@ -1,5 +1,4 @@
1
1
  import { AnyRouter, RegisteredRouter, RouterState } from './router.js';
2
-
3
2
  export declare function useLocation<TRouter extends AnyRouter = RegisteredRouter, TLocationState = RouterState<TRouter['routeTree']>['location'], TSelected = TLocationState>(opts?: {
4
3
  select?: (state: TLocationState) => TSelected;
5
4
  }): TSelected;
@@ -3,7 +3,6 @@ import { AnyRoute } from './route.js';
3
3
  import { MakeRouteMatch } from './Matches.js';
4
4
  import { RouteIds } from './routeInfo.js';
5
5
  import { StrictOrFrom } from './utils.js';
6
-
7
6
  export type UseMatchOptions<TFrom, TStrict extends boolean, TRouteMatch, TSelected, TThrow extends boolean> = StrictOrFrom<TFrom, TStrict> & {
8
7
  select?: (match: TRouteMatch) => TSelected;
9
8
  shouldThrow?: TThrow;
@@ -1,7 +1,6 @@
1
1
  import { FromPathOption, NavigateOptions } from './link.js';
2
2
  import { RoutePaths } from './routeInfo.js';
3
3
  import { AnyRouter, RegisteredRouter } from './router.js';
4
-
5
4
  export type UseNavigateResult<TDefaultFrom extends string> = <TTo extends string, TRouter extends AnyRouter = RegisteredRouter, TFrom extends RoutePaths<TRouter['routeTree']> | string = TDefaultFrom, TMaskFrom extends RoutePaths<TRouter['routeTree']> | string = TFrom, TMaskTo extends string = ''>({ from, ...rest }: NavigateOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>) => Promise<void>;
6
5
  export declare function useNavigate<TRouter extends AnyRouter = RegisteredRouter, TDefaultFrom extends string = string>(_defaultOpts?: {
7
6
  from?: FromPathOption<TRouter, TDefaultFrom>;
@@ -2,7 +2,6 @@ import { AnyRoute } from './route.js';
2
2
  import { AllParams, RouteById, RouteIds } from './routeInfo.js';
3
3
  import { RegisteredRouter } from './router.js';
4
4
  import { StrictOrFrom } from './utils.js';
5
-
6
5
  export type UseParamsOptions<TFrom, TStrict extends boolean, TParams, TSelected> = StrictOrFrom<TFrom, TStrict> & {
7
6
  select?: (params: TParams) => TSelected;
8
7
  };
@@ -2,7 +2,6 @@ import { AnyRoute } from './route.js';
2
2
  import { AllContext, RouteById, RouteIds } from './routeInfo.js';
3
3
  import { RegisteredRouter } from './router.js';
4
4
  import { Expand, StrictOrFrom } from './utils.js';
5
-
6
5
  export type UseRouteContextOptions<TFrom, TStrict extends boolean, TRouteContext, TSelected> = StrictOrFrom<TFrom, TStrict> & {
7
6
  select?: (search: TRouteContext) => TSelected;
8
7
  };
@@ -1,5 +1,4 @@
1
1
  import { AnyRouter, RegisteredRouter } from './router.js';
2
-
3
2
  export declare function useRouter<TRouter extends AnyRouter = RegisteredRouter>(opts?: {
4
3
  warn?: boolean;
5
4
  }): TRouter;
@@ -1,5 +1,4 @@
1
1
  import { AnyRouter, RegisteredRouter, RouterState } from './router.js';
2
-
3
2
  export declare function useRouterState<TRouter extends AnyRouter = RegisteredRouter, TSelected = RouterState<TRouter['routeTree']>>(opts?: {
4
3
  router?: TRouter;
5
4
  select: (state: RouterState<RegisteredRouter['routeTree']>) => TSelected;
@@ -2,7 +2,6 @@ import { AnyRoute } from './route.js';
2
2
  import { FullSearchSchema, RouteById, RouteIds } from './routeInfo.js';
3
3
  import { RegisteredRouter } from './router.js';
4
4
  import { Expand, StrictOrFrom } from './utils.js';
5
-
6
5
  export type UseSearchOptions<TFrom, TStrict extends boolean, TSearch, TSelected> = StrictOrFrom<TFrom, TStrict> & {
7
6
  select?: (search: TSearch) => TSelected;
8
7
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/react-router",
3
- "version": "1.51.2",
3
+ "version": "1.51.4",
4
4
  "description": "Modern and scalable routing for React applications",
5
5
  "author": "Tanner Linsley",
6
6
  "license": "MIT",
@@ -59,7 +59,6 @@
59
59
  "@testing-library/react": "^16.0.0",
60
60
  "@vitejs/plugin-react": "^4.3.1",
61
61
  "combinate": "^1.1.11",
62
- "jsdom": "^24.1.1",
63
62
  "react": "^18.2.0",
64
63
  "react-dom": "^18.2.0",
65
64
  "zod": "^3.23.8"
package/src/fileRoute.ts CHANGED
@@ -241,9 +241,16 @@ export function createLazyRoute<
241
241
  }
242
242
  }
243
243
 
244
+ const routeGroupPatternRegex = /\(.+\)/g
245
+
246
+ function removeGroups(s: string) {
247
+ return s.replaceAll(routeGroupPatternRegex, '').replaceAll('//', '/')
248
+ }
249
+
244
250
  export function createLazyFileRoute<
245
251
  TFilePath extends keyof FileRoutesByPath,
246
252
  TRoute extends FileRoutesByPath[TFilePath]['preLoaderRoute'],
247
253
  >(id: TFilePath) {
248
- return (opts: LazyRouteOptions) => new LazyRoute<TRoute>({ id, ...opts })
254
+ return (opts: LazyRouteOptions) =>
255
+ new LazyRoute<TRoute>({ id: removeGroups(id), ...opts })
249
256
  }