@tanstack/react-router 1.9.0 → 1.11.0
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.
- package/dist/cjs/Matches.cjs.map +1 -1
- package/dist/cjs/Matches.d.cts +3 -0
- package/dist/cjs/RouterProvider.cjs.map +1 -1
- package/dist/cjs/RouterProvider.d.cts +1 -1
- package/dist/cjs/fileRoute.cjs +54 -1
- package/dist/cjs/fileRoute.cjs.map +1 -1
- package/dist/cjs/fileRoute.d.cts +42 -2
- package/dist/cjs/index.cjs +8 -0
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/route.cjs +17 -1
- package/dist/cjs/route.cjs.map +1 -1
- package/dist/cjs/route.d.cts +77 -5
- package/dist/cjs/router.cjs +44 -18
- package/dist/cjs/router.cjs.map +1 -1
- package/dist/cjs/router.d.cts +5 -1
- package/dist/esm/Matches.d.ts +3 -0
- package/dist/esm/Matches.js.map +1 -1
- package/dist/esm/RouterProvider.d.ts +1 -1
- package/dist/esm/RouterProvider.js.map +1 -1
- package/dist/esm/fileRoute.d.ts +42 -2
- package/dist/esm/fileRoute.js +56 -3
- package/dist/esm/fileRoute.js.map +1 -1
- package/dist/esm/index.js +11 -3
- package/dist/esm/route.d.ts +77 -5
- package/dist/esm/route.js +17 -1
- package/dist/esm/route.js.map +1 -1
- package/dist/esm/router.d.ts +5 -1
- package/dist/esm/router.js +44 -18
- package/dist/esm/router.js.map +1 -1
- package/package.json +1 -1
- package/src/Matches.tsx +3 -0
- package/src/RouterProvider.tsx +7 -2
- package/src/fileRoute.ts +123 -6
- package/src/route.ts +237 -29
- package/src/router.ts +56 -12
package/dist/esm/fileRoute.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { NoInfer } from '@tanstack/react-store';
|
|
2
2
|
import { ParsePathParams } from './link';
|
|
3
|
-
import { AnyRoute, ResolveFullPath, ResolveFullSearchSchema, MergeFromFromParent, RouteContext, AnyContext, RouteOptions, UpdatableRouteOptions, Route, RootRouteId, TrimPathLeft, RouteConstraints, ResolveFullSearchSchemaInput, SearchSchemaInput, RouteLoaderFn } from './route';
|
|
3
|
+
import { AnyRoute, ResolveFullPath, ResolveFullSearchSchema, MergeFromFromParent, RouteContext, AnyContext, RouteOptions, UpdatableRouteOptions, Route, RootRouteId, TrimPathLeft, RouteConstraints, ResolveFullSearchSchemaInput, SearchSchemaInput, RouteLoaderFn, AnySearchSchema } from './route';
|
|
4
4
|
import { Assign, Expand, IsAny } from './utils';
|
|
5
|
+
import { RegisteredRouter, RouteById, RouteIds } from '.';
|
|
5
6
|
export interface FileRoutesByPath {
|
|
6
7
|
}
|
|
7
8
|
type Replace<S extends string, From extends string, To extends string> = S extends `${infer Start}${From}${infer Rest}` ? `${Start}${To}${Replace<Rest, From, To>}` : S;
|
|
@@ -12,10 +13,49 @@ export type RemoveUnderScores<T extends string> = Replace<Replace<TrimRight<Trim
|
|
|
12
13
|
type ReplaceFirstOccurrence<T extends string, Search extends string, Replacement extends string> = T extends `${infer Prefix}${Search}${infer Suffix}` ? `${Prefix}${Replacement}${Suffix}` : T;
|
|
13
14
|
export type ResolveFilePath<TParentRoute extends AnyRoute, TFilePath extends string> = TParentRoute['id'] extends RootRouteId ? TrimPathLeft<TFilePath> : ReplaceFirstOccurrence<TrimPathLeft<TFilePath>, TrimPathLeft<TParentRoute['types']['customId']>, ''>;
|
|
14
15
|
export type FileRoutePath<TParentRoute extends AnyRoute, TFilePath extends string> = ResolveFilePath<TParentRoute, TFilePath> extends `_${infer _}` ? '' : ResolveFilePath<TParentRoute, TFilePath> extends `/_${infer _}` ? '' : ResolveFilePath<TParentRoute, TFilePath>;
|
|
16
|
+
export declare function createFileRoute<TFilePath extends keyof FileRoutesByPath, TParentRoute extends AnyRoute = FileRoutesByPath[TFilePath]['parentRoute'], TId extends RouteConstraints['TId'] = TFilePath, TPath extends RouteConstraints['TPath'] = FileRoutePath<TParentRoute, TFilePath>, TFullPath extends RouteConstraints['TFullPath'] = ResolveFullPath<TParentRoute, RemoveUnderScores<TPath>>>(path: TFilePath): <TSearchSchemaInput extends AnySearchSchema = {}, TSearchSchema extends AnySearchSchema = {}, TSearchSchemaUsed extends Record<string, any> = TSearchSchemaInput extends SearchSchemaInput ? Omit<TSearchSchemaInput, "__TSearchSchemaInput__"> : TSearchSchema, TFullSearchSchemaInput extends AnySearchSchema = Expand<Assign<Omit<import("./route").InferFullSearchSchemaInput<TParentRoute>, "__TRootSearchSchema__">, TSearchSchemaUsed>>, TFullSearchSchema extends AnySearchSchema = Expand<Assign<Omit<import("./route").InferFullSearchSchema<TParentRoute>, "__TRootSearchSchema__">, TSearchSchema>>, TParams extends Record<string, any> = Expand<Record<TrimLeft<TrimRight<import("./link").Split<TPath, true>[number], "_">, "_"> extends infer T ? T extends TrimLeft<TrimRight<import("./link").Split<TPath, true>[number], "_">, "_"> ? T extends `$${infer L}` ? L extends "" ? "_splat" : L : never : never : never, string>>, TAllParams extends Record<string, any> = IsAny<TParentRoute["types"]["allParams"], TParams, TParentRoute["types"]["allParams"] & TParams>, TRouteContextReturn extends RouteContext = RouteContext, TRouteContext extends RouteContext = [TRouteContextReturn] extends [never] ? RouteContext : TRouteContextReturn, TAllContext extends Expand<Assign<IsAny<TParentRoute["types"]["allContext"], {}, TParentRoute["types"]["allContext"]>, TRouteContext>> = Expand<Assign<IsAny<TParentRoute["types"]["allContext"], {}, TParentRoute["types"]["allContext"]>, TRouteContext>>, TRouterContext extends AnyContext = AnyContext, TLoaderDeps extends Record<string, any> = {}, TLoaderData extends unknown = unknown, TChildren extends unknown = unknown, TRouteTree extends AnyRoute = AnyRoute>(options?: (Omit<RouteOptions<TParentRoute, string, TPath, TSearchSchemaInput, TSearchSchema, TSearchSchemaUsed, TFullSearchSchemaInput, TFullSearchSchema, TParams, TAllParams, TRouteContextReturn, TRouteContext, TRouterContext, TAllContext, TLoaderDeps, TLoaderData>, "path" | "id" | "getParentRoute"> & UpdatableRouteOptions<TFullSearchSchema, TLoaderData>) | undefined) => Route<TParentRoute, TPath, TFullPath, TFilePath, TId, TSearchSchemaInput, TSearchSchema, TSearchSchemaUsed, TFullSearchSchemaInput, TFullSearchSchema, TParams, TAllParams, TRouteContextReturn, TRouteContext, TAllContext, TRouterContext, TLoaderDeps, TLoaderData, TChildren, TRouteTree>;
|
|
17
|
+
/**
|
|
18
|
+
@deprecated It's no longer recommended to use the `FileRoute` class directly.
|
|
19
|
+
Instead, use `createFileRoute('/path/to/file')(options)` to create a file route.
|
|
20
|
+
*/
|
|
15
21
|
export declare class FileRoute<TFilePath extends keyof FileRoutesByPath, TParentRoute extends AnyRoute = FileRoutesByPath[TFilePath]['parentRoute'], TId extends RouteConstraints['TId'] = TFilePath, TPath extends RouteConstraints['TPath'] = FileRoutePath<TParentRoute, TFilePath>, TFullPath extends RouteConstraints['TFullPath'] = ResolveFullPath<TParentRoute, RemoveUnderScores<TPath>>> {
|
|
16
22
|
path: TFilePath;
|
|
17
23
|
constructor(path: TFilePath);
|
|
18
|
-
createRoute: <TSearchSchemaInput extends
|
|
24
|
+
createRoute: <TSearchSchemaInput extends AnySearchSchema = {}, TSearchSchema extends AnySearchSchema = {}, TSearchSchemaUsed extends Record<string, any> = TSearchSchemaInput extends SearchSchemaInput ? Omit<TSearchSchemaInput, "__TSearchSchemaInput__"> : TSearchSchema, TFullSearchSchemaInput extends AnySearchSchema = ResolveFullSearchSchemaInput<TParentRoute, TSearchSchemaUsed>, TFullSearchSchema extends AnySearchSchema = ResolveFullSearchSchema<TParentRoute, TSearchSchema>, TParams extends Record<string, any> = Expand<Record<ParsePathParams<TPath>, string>>, TAllParams extends Record<string, any> = MergeFromFromParent<TParentRoute["types"]["allParams"], TParams>, TRouteContextReturn extends RouteContext = RouteContext, TRouteContext extends RouteContext = [TRouteContextReturn] extends [never] ? RouteContext : TRouteContextReturn, TAllContext extends Expand<Assign<IsAny<TParentRoute["types"]["allContext"], {}>, TRouteContext>> = Expand<Assign<IsAny<TParentRoute["types"]["allContext"], {}>, TRouteContext>>, TRouterContext extends AnyContext = AnyContext, TLoaderDeps extends Record<string, any> = {}, TLoaderData extends unknown = unknown, TChildren extends unknown = unknown, TRouteTree extends AnyRoute = AnyRoute>(options?: (Omit<RouteOptions<TParentRoute, string, TPath, TSearchSchemaInput, TSearchSchema, TSearchSchemaUsed, TFullSearchSchemaInput, TFullSearchSchema, TParams, TAllParams, TRouteContextReturn, TRouteContext, TRouterContext, TAllContext, TLoaderDeps, TLoaderData>, "path" | "id" | "getParentRoute"> & UpdatableRouteOptions<TFullSearchSchema, TLoaderData>) | undefined) => Route<TParentRoute, TPath, TFullPath, TFilePath, TId, TSearchSchemaInput, TSearchSchema, TSearchSchemaUsed, TFullSearchSchemaInput, TFullSearchSchema, TParams, TAllParams, TRouteContextReturn, TRouteContext, TAllContext, TRouterContext, TLoaderDeps, TLoaderData, TChildren, TRouteTree>;
|
|
19
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
@deprecated It's recommended not to split loaders into separate files.
|
|
28
|
+
Instead, place the loader function in the the main route file, inside the
|
|
29
|
+
`createFileRoute('/path/to/file)(options)` options.
|
|
30
|
+
*/
|
|
20
31
|
export declare function FileRouteLoader<TFilePath extends keyof FileRoutesByPath, TRoute extends FileRoutesByPath[TFilePath]['preLoaderRoute']>(_path: TFilePath): <TLoaderData extends any>(loaderFn: RouteLoaderFn<TRoute['types']['allParams'], TRoute['types']['loaderDeps'], TRoute['types']['allContext'], TRoute['types']['routeContext'], TLoaderData>) => RouteLoaderFn<TRoute['types']['allParams'], TRoute['types']['loaderDeps'], TRoute['types']['allContext'], TRoute['types']['routeContext'], NoInfer<TLoaderData>>;
|
|
32
|
+
export type LazyRouteOptions = Pick<UpdatableRouteOptions<AnySearchSchema, any>, 'component' | 'errorComponent' | 'pendingComponent'>;
|
|
33
|
+
export declare class LazyRoute<TRoute extends AnyRoute> {
|
|
34
|
+
options: {
|
|
35
|
+
id: string;
|
|
36
|
+
} & LazyRouteOptions;
|
|
37
|
+
constructor(opts: {
|
|
38
|
+
id: string;
|
|
39
|
+
} & LazyRouteOptions);
|
|
40
|
+
useMatch: <TSelected = TRoute["types"]["allContext"]>(opts?: {
|
|
41
|
+
select?: ((s: TRoute['types']['allContext']) => TSelected) | undefined;
|
|
42
|
+
} | undefined) => TSelected;
|
|
43
|
+
useRouteContext: <TSelected = TRoute["types"]["allContext"]>(opts?: {
|
|
44
|
+
select?: ((s: TRoute['types']['allContext']) => TSelected) | undefined;
|
|
45
|
+
} | undefined) => TSelected;
|
|
46
|
+
useSearch: <TSelected = TRoute["types"]["fullSearchSchema"]>(opts?: {
|
|
47
|
+
select?: ((s: TRoute['types']['fullSearchSchema']) => TSelected) | undefined;
|
|
48
|
+
} | undefined) => TSelected;
|
|
49
|
+
useParams: <TSelected = TRoute["types"]["allParams"]>(opts?: {
|
|
50
|
+
select?: ((s: TRoute['types']['allParams']) => TSelected) | undefined;
|
|
51
|
+
} | undefined) => TSelected;
|
|
52
|
+
useLoaderDeps: <TSelected = TRoute["types"]["loaderDeps"]>(opts?: {
|
|
53
|
+
select?: ((s: TRoute['types']['loaderDeps']) => TSelected) | undefined;
|
|
54
|
+
} | undefined) => TSelected;
|
|
55
|
+
useLoaderData: <TSelected = TRoute["types"]["loaderData"]>(opts?: {
|
|
56
|
+
select?: ((s: TRoute['types']['loaderData']) => TSelected) | undefined;
|
|
57
|
+
} | undefined) => TSelected;
|
|
58
|
+
}
|
|
59
|
+
export declare function createLazyRoute<TId extends RouteIds<RegisteredRouter['routeTree']>, TRoute extends RouteById<RegisteredRouter['routeTree'], TId> = AnyRoute>(id: TId): (opts: LazyRouteOptions) => LazyRoute<TRoute>;
|
|
60
|
+
export declare function createLazyFileRoute<TFilePath extends keyof FileRoutesByPath, TRoute extends FileRoutesByPath[TFilePath]['preLoaderRoute']>(id: TFilePath): (opts: LazyRouteOptions) => LazyRoute<TRoute>;
|
|
21
61
|
export {};
|
package/dist/esm/fileRoute.js
CHANGED
|
@@ -1,19 +1,72 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createRoute } from "./route.js";
|
|
2
|
+
import { useMatch, useLoaderDeps, useLoaderData } from "./Matches.js";
|
|
3
|
+
import { useSearch } from "./useSearch.js";
|
|
4
|
+
import { useParams } from "./useParams.js";
|
|
5
|
+
import warning from "tiny-warning";
|
|
6
|
+
function createFileRoute(path) {
|
|
7
|
+
return new FileRoute(path).createRoute;
|
|
8
|
+
}
|
|
2
9
|
class FileRoute {
|
|
3
10
|
constructor(path) {
|
|
4
11
|
this.path = path;
|
|
5
12
|
this.createRoute = (options) => {
|
|
6
|
-
|
|
13
|
+
warning(
|
|
14
|
+
false,
|
|
15
|
+
"FileRoute is deprecated and will be removed in the next major version. Use the createFileRoute(path)(options) function instead."
|
|
16
|
+
);
|
|
17
|
+
const route = createRoute(options);
|
|
7
18
|
route.isRoot = false;
|
|
8
19
|
return route;
|
|
9
20
|
};
|
|
10
21
|
}
|
|
11
22
|
}
|
|
12
23
|
function FileRouteLoader(_path) {
|
|
24
|
+
warning(
|
|
25
|
+
false,
|
|
26
|
+
`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`
|
|
27
|
+
);
|
|
13
28
|
return (loaderFn) => loaderFn;
|
|
14
29
|
}
|
|
30
|
+
class LazyRoute {
|
|
31
|
+
constructor(opts) {
|
|
32
|
+
this.useMatch = (opts2) => {
|
|
33
|
+
return useMatch({ select: opts2 == null ? void 0 : opts2.select, from: this.options.id });
|
|
34
|
+
};
|
|
35
|
+
this.useRouteContext = (opts2) => {
|
|
36
|
+
return useMatch({
|
|
37
|
+
from: this.options.id,
|
|
38
|
+
select: (d) => (opts2 == null ? void 0 : opts2.select) ? opts2.select(d.context) : d.context
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
this.useSearch = (opts2) => {
|
|
42
|
+
return useSearch({ ...opts2, from: this.options.id });
|
|
43
|
+
};
|
|
44
|
+
this.useParams = (opts2) => {
|
|
45
|
+
return useParams({ ...opts2, from: this.options.id });
|
|
46
|
+
};
|
|
47
|
+
this.useLoaderDeps = (opts2) => {
|
|
48
|
+
return useLoaderDeps({ ...opts2, from: this.options.id });
|
|
49
|
+
};
|
|
50
|
+
this.useLoaderData = (opts2) => {
|
|
51
|
+
return useLoaderData({ ...opts2, from: this.options.id });
|
|
52
|
+
};
|
|
53
|
+
this.options = opts;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function createLazyRoute(id) {
|
|
57
|
+
return (opts) => {
|
|
58
|
+
return new LazyRoute({ id, ...opts });
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function createLazyFileRoute(id) {
|
|
62
|
+
return (opts) => new LazyRoute({ id, ...opts });
|
|
63
|
+
}
|
|
15
64
|
export {
|
|
16
65
|
FileRoute,
|
|
17
|
-
FileRouteLoader
|
|
66
|
+
FileRouteLoader,
|
|
67
|
+
LazyRoute,
|
|
68
|
+
createFileRoute,
|
|
69
|
+
createLazyFileRoute,
|
|
70
|
+
createLazyRoute
|
|
18
71
|
};
|
|
19
72
|
//# sourceMappingURL=fileRoute.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fileRoute.js","sources":["../../src/fileRoute.ts"],"sourcesContent":["import { NoInfer } from '@tanstack/react-store'\nimport { ParsePathParams } from './link'\nimport {\n AnyRoute,\n ResolveFullPath,\n ResolveFullSearchSchema,\n MergeFromFromParent,\n RouteContext,\n AnyContext,\n RouteOptions,\n UpdatableRouteOptions,\n Route,\n RootRouteId,\n TrimPathLeft,\n RouteConstraints,\n ResolveFullSearchSchemaInput,\n SearchSchemaInput,\n LoaderFnContext,\n RouteLoaderFn,\n} from './route'\nimport { Assign, Expand, IsAny } from './utils'\n\nexport interface FileRoutesByPath {\n // '/': {\n // parentRoute: typeof rootRoute\n // }\n}\n\ntype Replace<\n S extends string,\n From extends string,\n To extends string,\n> = S extends `${infer Start}${From}${infer Rest}`\n ? `${Start}${To}${Replace<Rest, From, To>}`\n : S\n\nexport type TrimLeft<\n T extends string,\n S extends string,\n> = T extends `${S}${infer U}` ? U : T\n\nexport type TrimRight<\n T extends string,\n S extends string,\n> = T extends `${infer U}${S}` ? U : T\n\nexport type Trim<T extends string, S extends string> = TrimLeft<\n TrimRight<T, S>,\n S\n>\n\nexport type RemoveUnderScores<T extends string> = Replace<\n Replace<TrimRight<TrimLeft<T, '/_'>, '_'>, '_/', '/'>,\n '/_',\n '/'\n>\n\ntype ReplaceFirstOccurrence<\n T extends string,\n Search extends string,\n Replacement extends string,\n> = T extends `${infer Prefix}${Search}${infer Suffix}`\n ? `${Prefix}${Replacement}${Suffix}`\n : T\n\nexport type ResolveFilePath<\n TParentRoute extends AnyRoute,\n TFilePath extends string,\n> = TParentRoute['id'] extends RootRouteId\n ? TrimPathLeft<TFilePath>\n : ReplaceFirstOccurrence<\n TrimPathLeft<TFilePath>,\n TrimPathLeft<TParentRoute['types']['customId']>,\n ''\n >\n\nexport type FileRoutePath<\n TParentRoute extends AnyRoute,\n TFilePath extends string,\n> = ResolveFilePath<TParentRoute, TFilePath> extends `_${infer _}`\n ? ''\n : ResolveFilePath<TParentRoute, TFilePath> extends `/_${infer _}`\n ? ''\n : ResolveFilePath<TParentRoute, TFilePath>\n\nexport class FileRoute<\n TFilePath extends keyof FileRoutesByPath,\n TParentRoute extends AnyRoute = FileRoutesByPath[TFilePath]['parentRoute'],\n TId extends RouteConstraints['TId'] = TFilePath,\n TPath extends RouteConstraints['TPath'] = FileRoutePath<\n TParentRoute,\n TFilePath\n >,\n TFullPath extends RouteConstraints['TFullPath'] = ResolveFullPath<\n TParentRoute,\n RemoveUnderScores<TPath>\n >,\n> {\n constructor(public path: TFilePath) {}\n\n createRoute = <\n TSearchSchemaInput extends RouteConstraints['TSearchSchema'] = {},\n TSearchSchema extends RouteConstraints['TSearchSchema'] = {},\n TSearchSchemaUsed extends Record<\n string,\n any\n > = TSearchSchemaInput extends SearchSchemaInput\n ? Omit<TSearchSchemaInput, keyof SearchSchemaInput>\n : TSearchSchema,\n TFullSearchSchemaInput extends\n RouteConstraints['TFullSearchSchema'] = ResolveFullSearchSchemaInput<\n TParentRoute,\n TSearchSchemaUsed\n >,\n TFullSearchSchema extends\n RouteConstraints['TFullSearchSchema'] = ResolveFullSearchSchema<\n TParentRoute,\n TSearchSchema\n >,\n TParams extends RouteConstraints['TParams'] = Expand<\n Record<ParsePathParams<TPath>, string>\n >,\n TAllParams extends RouteConstraints['TAllParams'] = MergeFromFromParent<\n TParentRoute['types']['allParams'],\n TParams\n >,\n TRouteContextReturn extends\n RouteConstraints['TRouteContext'] = RouteContext,\n TRouteContext extends RouteConstraints['TRouteContext'] = [\n TRouteContextReturn,\n ] extends [never]\n ? RouteContext\n : TRouteContextReturn,\n TAllContext extends Expand<\n Assign<IsAny<TParentRoute['types']['allContext'], {}>, TRouteContext>\n > = Expand<\n Assign<IsAny<TParentRoute['types']['allContext'], {}>, TRouteContext>\n >,\n TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderData extends any = unknown,\n TChildren extends RouteConstraints['TChildren'] = unknown,\n TRouteTree extends RouteConstraints['TRouteTree'] = AnyRoute,\n >(\n options?: Omit<\n RouteOptions<\n TParentRoute,\n string,\n TPath,\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TFullSearchSchemaInput,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TRouteContext,\n TRouterContext,\n TAllContext,\n TLoaderDeps,\n TLoaderData\n >,\n 'getParentRoute' | 'path' | 'id'\n > &\n UpdatableRouteOptions<TFullSearchSchema>,\n ): Route<\n TParentRoute,\n TPath,\n TFullPath,\n TFilePath,\n TId,\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TFullSearchSchemaInput,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TRouteContext,\n TAllContext,\n TRouterContext,\n TLoaderDeps,\n TLoaderData,\n TChildren,\n TRouteTree\n > => {\n const route = new Route(options as any)\n ;(route as any).isRoot = false\n return route as any\n }\n}\n\nexport function FileRouteLoader<\n TFilePath extends keyof FileRoutesByPath,\n TRoute extends FileRoutesByPath[TFilePath]['preLoaderRoute'],\n>(\n _path: TFilePath,\n): <TLoaderData extends any>(\n loaderFn: RouteLoaderFn<\n TRoute['types']['allParams'],\n TRoute['types']['loaderDeps'],\n TRoute['types']['allContext'],\n TRoute['types']['routeContext'],\n TLoaderData\n >,\n) => RouteLoaderFn<\n TRoute['types']['allParams'],\n TRoute['types']['loaderDeps'],\n TRoute['types']['allContext'],\n TRoute['types']['routeContext'],\n NoInfer<TLoaderData>\n> {\n return (loaderFn) => loaderFn\n}\n"],"names":[],"mappings":";AAqFO,MAAM,UAYX;AAAA,EACA,YAAmB,MAAiB;AAAjB,SAAA,OAAA;AAEnB,SAAA,cAAc,CA4CZ,YA2CG;AACG,YAAA,QAAQ,IAAI,MAAM,OAAc;AACpC,YAAc,SAAS;AAClB,aAAA;AAAA,IAAA;AAAA,EA5F4B;AA8FvC;AAEO,SAAS,gBAId,OAeA;AACA,SAAO,CAAC,aAAa;AACvB;"}
|
|
1
|
+
{"version":3,"file":"fileRoute.js","sources":["../../src/fileRoute.ts"],"sourcesContent":["import { NoInfer } from '@tanstack/react-store'\nimport { ParsePathParams } from './link'\nimport {\n AnyRoute,\n ResolveFullPath,\n ResolveFullSearchSchema,\n MergeFromFromParent,\n RouteContext,\n AnyContext,\n RouteOptions,\n UpdatableRouteOptions,\n Route,\n createRoute,\n RootRouteId,\n TrimPathLeft,\n RouteConstraints,\n ResolveFullSearchSchemaInput,\n SearchSchemaInput,\n LoaderFnContext,\n RouteLoaderFn,\n AnyPathParams,\n AnySearchSchema,\n} from './route'\nimport { Assign, Expand, IsAny } from './utils'\nimport { useMatch, useLoaderDeps, useLoaderData } from './Matches'\nimport { useSearch } from './useSearch'\nimport { useParams } from './useParams'\nimport warning from 'tiny-warning'\nimport { RegisteredRouter, RouteById, RouteIds } from '.'\n\nexport interface FileRoutesByPath {\n // '/': {\n // parentRoute: typeof rootRoute\n // }\n}\n\ntype Replace<\n S extends string,\n From extends string,\n To extends string,\n> = S extends `${infer Start}${From}${infer Rest}`\n ? `${Start}${To}${Replace<Rest, From, To>}`\n : S\n\nexport type TrimLeft<\n T extends string,\n S extends string,\n> = T extends `${S}${infer U}` ? U : T\n\nexport type TrimRight<\n T extends string,\n S extends string,\n> = T extends `${infer U}${S}` ? U : T\n\nexport type Trim<T extends string, S extends string> = TrimLeft<\n TrimRight<T, S>,\n S\n>\n\nexport type RemoveUnderScores<T extends string> = Replace<\n Replace<TrimRight<TrimLeft<T, '/_'>, '_'>, '_/', '/'>,\n '/_',\n '/'\n>\n\ntype ReplaceFirstOccurrence<\n T extends string,\n Search extends string,\n Replacement extends string,\n> = T extends `${infer Prefix}${Search}${infer Suffix}`\n ? `${Prefix}${Replacement}${Suffix}`\n : T\n\nexport type ResolveFilePath<\n TParentRoute extends AnyRoute,\n TFilePath extends string,\n> = TParentRoute['id'] extends RootRouteId\n ? TrimPathLeft<TFilePath>\n : ReplaceFirstOccurrence<\n TrimPathLeft<TFilePath>,\n TrimPathLeft<TParentRoute['types']['customId']>,\n ''\n >\n\nexport type FileRoutePath<\n TParentRoute extends AnyRoute,\n TFilePath extends string,\n> =\n ResolveFilePath<TParentRoute, TFilePath> extends `_${infer _}`\n ? ''\n : ResolveFilePath<TParentRoute, TFilePath> extends `/_${infer _}`\n ? ''\n : ResolveFilePath<TParentRoute, TFilePath>\n\nexport function createFileRoute<\n TFilePath extends keyof FileRoutesByPath,\n TParentRoute extends AnyRoute = FileRoutesByPath[TFilePath]['parentRoute'],\n TId extends RouteConstraints['TId'] = TFilePath,\n TPath extends RouteConstraints['TPath'] = FileRoutePath<\n TParentRoute,\n TFilePath\n >,\n TFullPath extends RouteConstraints['TFullPath'] = ResolveFullPath<\n TParentRoute,\n RemoveUnderScores<TPath>\n >,\n>(path: TFilePath) {\n return new FileRoute<TFilePath, TParentRoute, TId, TPath, TFullPath>(path)\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'] = TFilePath,\n TPath extends RouteConstraints['TPath'] = FileRoutePath<\n TParentRoute,\n TFilePath\n >,\n TFullPath extends RouteConstraints['TFullPath'] = ResolveFullPath<\n TParentRoute,\n RemoveUnderScores<TPath>\n >,\n> {\n constructor(public path: TFilePath) {}\n\n createRoute = <\n TSearchSchemaInput extends RouteConstraints['TSearchSchema'] = {},\n TSearchSchema extends RouteConstraints['TSearchSchema'] = {},\n TSearchSchemaUsed extends Record<\n string,\n any\n > = TSearchSchemaInput extends SearchSchemaInput\n ? Omit<TSearchSchemaInput, keyof SearchSchemaInput>\n : TSearchSchema,\n TFullSearchSchemaInput extends\n RouteConstraints['TFullSearchSchema'] = ResolveFullSearchSchemaInput<\n TParentRoute,\n TSearchSchemaUsed\n >,\n TFullSearchSchema extends\n RouteConstraints['TFullSearchSchema'] = ResolveFullSearchSchema<\n TParentRoute,\n TSearchSchema\n >,\n TParams extends RouteConstraints['TParams'] = Expand<\n Record<ParsePathParams<TPath>, string>\n >,\n TAllParams extends RouteConstraints['TAllParams'] = MergeFromFromParent<\n TParentRoute['types']['allParams'],\n TParams\n >,\n TRouteContextReturn extends\n RouteConstraints['TRouteContext'] = RouteContext,\n TRouteContext extends RouteConstraints['TRouteContext'] = [\n TRouteContextReturn,\n ] extends [never]\n ? RouteContext\n : TRouteContextReturn,\n TAllContext extends Expand<\n Assign<IsAny<TParentRoute['types']['allContext'], {}>, TRouteContext>\n > = Expand<\n Assign<IsAny<TParentRoute['types']['allContext'], {}>, TRouteContext>\n >,\n TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderData extends any = unknown,\n TChildren extends RouteConstraints['TChildren'] = unknown,\n TRouteTree extends RouteConstraints['TRouteTree'] = AnyRoute,\n >(\n options?: Omit<\n RouteOptions<\n TParentRoute,\n string,\n TPath,\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TFullSearchSchemaInput,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TRouteContext,\n TRouterContext,\n TAllContext,\n TLoaderDeps,\n TLoaderData\n >,\n 'getParentRoute' | 'path' | 'id'\n > &\n UpdatableRouteOptions<TFullSearchSchema, TLoaderData>,\n ): Route<\n TParentRoute,\n TPath,\n TFullPath,\n TFilePath,\n TId,\n TSearchSchemaInput,\n TSearchSchema,\n TSearchSchemaUsed,\n TFullSearchSchemaInput,\n TFullSearchSchema,\n TParams,\n TAllParams,\n TRouteContextReturn,\n TRouteContext,\n TAllContext,\n TRouterContext,\n TLoaderDeps,\n TLoaderData,\n TChildren,\n TRouteTree\n > => {\n warning(\n false,\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): <TLoaderData extends any>(\n loaderFn: RouteLoaderFn<\n TRoute['types']['allParams'],\n TRoute['types']['loaderDeps'],\n TRoute['types']['allContext'],\n TRoute['types']['routeContext'],\n TLoaderData\n >,\n) => RouteLoaderFn<\n TRoute['types']['allParams'],\n TRoute['types']['loaderDeps'],\n TRoute['types']['allContext'],\n TRoute['types']['routeContext'],\n NoInfer<TLoaderData>\n> {\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\n}\n\nexport type LazyRouteOptions = Pick<\n UpdatableRouteOptions<AnySearchSchema, any>,\n 'component' | 'errorComponent' | 'pendingComponent'\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 }\n\n useMatch = <TSelected = TRoute['types']['allContext']>(opts?: {\n select?: (s: TRoute['types']['allContext']) => 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\nexport function createLazyRoute<\n TId extends RouteIds<RegisteredRouter['routeTree']>,\n TRoute extends RouteById<RegisteredRouter['routeTree'], TId> = AnyRoute,\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":";;;;;AA8FO,SAAS,gBAYd,MAAiB;AACV,SAAA,IAAI,UAA0D,IAAI,EACtE;AACL;AAMO,MAAM,UAYX;AAAA,EACA,YAAmB,MAAiB;AAAjB,SAAA,OAAA;AAEnB,SAAA,cAAc,CA4CZ,YA2CG;AACH;AAAA,QACE;AAAA,QACA;AAAA,MAAA;AAEI,YAAA,QAAQ,YAAY,OAAc;AACtC,YAAc,SAAS;AAClB,aAAA;AAAA,IAAA;AAAA,EAhG4B;AAkGvC;AAOO,SAAS,gBAId,OAeA;AACA;AAAA,IACE;AAAA,IACA;AAAA,EAAA;AAEF,SAAO,CAAC,aAAa;AACvB;AAOO,MAAM,UAAmC;AAAA,EAK9C,YACE,MAGA;AAIF,SAAA,WAAW,CAA4CA,UAEtC;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;AAvC9D,SAAK,UAAU;AAAA,EACjB;AAwCF;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;"}
|
package/dist/esm/index.js
CHANGED
|
@@ -4,15 +4,15 @@ import { default as default3 } from "tiny-warning";
|
|
|
4
4
|
import { Await, useAwaited } from "./awaited.js";
|
|
5
5
|
import { defer, isDehydratedDeferred } from "./defer.js";
|
|
6
6
|
import { CatchBoundary, CatchBoundaryImpl, ErrorComponent } from "./CatchBoundary.js";
|
|
7
|
-
import { FileRoute, FileRouteLoader } from "./fileRoute.js";
|
|
7
|
+
import { FileRoute, FileRouteLoader, LazyRoute, createFileRoute, createLazyFileRoute, createLazyRoute } from "./fileRoute.js";
|
|
8
8
|
import { lazyRouteComponent } from "./lazyRouteComponent.js";
|
|
9
9
|
import { Link, useLinkProps } from "./link.js";
|
|
10
10
|
import { Match, MatchRoute, Matches, Outlet, defaultDeserializeError, getRenderedMatches, isServerSideError, matchContext, useLoaderData, useLoaderDeps, useMatch, useMatchRoute, useMatches, useParentMatches } from "./Matches.js";
|
|
11
11
|
import { cleanPath, interpolatePath, joinPaths, matchByPath, matchPathname, parsePathname, removeBasepath, resolvePath, trimPath, trimPathLeft, trimPathRight } from "./path.js";
|
|
12
12
|
import { decode, encode } from "./qss.js";
|
|
13
13
|
import { isRedirect, redirect } from "./redirects.js";
|
|
14
|
-
import { NotFoundRoute, RootRoute, Route, RouteApi, createRouteMask, rootRouteId, rootRouteWithContext } from "./route.js";
|
|
15
|
-
import { PathParamError, Router, SearchParamError, componentTypes, defaultSerializeError, getInitialRouterState, lazyFn } from "./router.js";
|
|
14
|
+
import { NotFoundRoute, RootRoute, Route, RouteApi, createRootRoute, createRoute, createRouteMask, getRouteApi, rootRouteId, rootRouteWithContext } from "./route.js";
|
|
15
|
+
import { PathParamError, Router, SearchParamError, componentTypes, createRouter, defaultSerializeError, getInitialRouterState, lazyFn } from "./router.js";
|
|
16
16
|
import { RouterProvider, getRouteMatch } from "./RouterProvider.js";
|
|
17
17
|
import { ScrollRestoration, useElementScrollRestoration, useScrollRestoration } from "./scroll-restoration.js";
|
|
18
18
|
import { defaultParseSearch, defaultStringifySearch, parseSearchWith, stringifySearchWith } from "./searchParams.js";
|
|
@@ -33,6 +33,7 @@ export {
|
|
|
33
33
|
ErrorComponent,
|
|
34
34
|
FileRoute,
|
|
35
35
|
FileRouteLoader,
|
|
36
|
+
LazyRoute,
|
|
36
37
|
Link,
|
|
37
38
|
Match,
|
|
38
39
|
MatchRoute,
|
|
@@ -50,7 +51,13 @@ export {
|
|
|
50
51
|
SearchParamError,
|
|
51
52
|
cleanPath,
|
|
52
53
|
componentTypes,
|
|
54
|
+
createFileRoute,
|
|
55
|
+
createLazyFileRoute,
|
|
56
|
+
createLazyRoute,
|
|
57
|
+
createRootRoute,
|
|
58
|
+
createRoute,
|
|
53
59
|
createRouteMask,
|
|
60
|
+
createRouter,
|
|
54
61
|
decode,
|
|
55
62
|
deepEqual,
|
|
56
63
|
defaultDeserializeError,
|
|
@@ -63,6 +70,7 @@ export {
|
|
|
63
70
|
functionalUpdate,
|
|
64
71
|
getInitialRouterState,
|
|
65
72
|
getRenderedMatches,
|
|
73
|
+
getRouteApi,
|
|
66
74
|
getRouteMatch,
|
|
67
75
|
interpolatePath,
|
|
68
76
|
default2 as invariant,
|
package/dist/esm/route.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { RouteById, RouteIds, RoutePaths } from './routeInfo';
|
|
|
6
6
|
import { AnyRouter, RegisteredRouter } from './router';
|
|
7
7
|
import { Assign, Expand, IsAny, NoInfer, UnionToIntersection } from './utils';
|
|
8
8
|
import { BuildLocationFn, NavigateFn } from './RouterProvider';
|
|
9
|
+
import { LazyRoute } from '.';
|
|
9
10
|
export declare const rootRouteId: "__root__";
|
|
10
11
|
export type RootRouteId = typeof rootRouteId;
|
|
11
12
|
export type AnyPathParams = {};
|
|
@@ -25,7 +26,7 @@ export type RoutePathOptions<TCustomId, TPath> = {
|
|
|
25
26
|
id: TCustomId;
|
|
26
27
|
};
|
|
27
28
|
export type RoutePathOptionsIntersection<TCustomId, TPath> = UnionToIntersection<RoutePathOptions<TCustomId, TPath>>;
|
|
28
|
-
export type RouteOptions<TParentRoute extends AnyRoute = AnyRoute, TCustomId extends string = string, TPath extends string = string, TSearchSchemaInput extends Record<string, any> = {}, TSearchSchema extends Record<string, any> = {}, TSearchSchemaUsed extends Record<string, any> = {}, TFullSearchSchemaInput extends Record<string, any> = TSearchSchemaUsed, TFullSearchSchema extends Record<string, any> = TSearchSchema, TParams extends AnyPathParams = AnyPathParams, TAllParams extends AnyPathParams = TParams, TRouteContextReturn extends RouteContext = RouteContext, TRouteContext extends RouteContext = RouteContext, TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext, TAllContext extends Record<string, any> = AnyContext, TLoaderDeps extends Record<string, any> = {}, TLoaderData extends any = unknown> = BaseRouteOptions<TParentRoute, TCustomId, TPath, TSearchSchemaInput, TSearchSchema, TSearchSchemaUsed, TFullSearchSchemaInput, TFullSearchSchema, TParams, TAllParams, TRouteContextReturn, TRouteContext, TRouterContext, TAllContext, TLoaderDeps, TLoaderData> & UpdatableRouteOptions<NoInfer<TFullSearchSchema>>;
|
|
29
|
+
export type RouteOptions<TParentRoute extends AnyRoute = AnyRoute, TCustomId extends string = string, TPath extends string = string, TSearchSchemaInput extends Record<string, any> = {}, TSearchSchema extends Record<string, any> = {}, TSearchSchemaUsed extends Record<string, any> = {}, TFullSearchSchemaInput extends Record<string, any> = TSearchSchemaUsed, TFullSearchSchema extends Record<string, any> = TSearchSchema, TParams extends AnyPathParams = AnyPathParams, TAllParams extends AnyPathParams = TParams, TRouteContextReturn extends RouteContext = RouteContext, TRouteContext extends RouteContext = RouteContext, TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext, TAllContext extends Record<string, any> = AnyContext, TLoaderDeps extends Record<string, any> = {}, TLoaderData extends any = unknown> = BaseRouteOptions<TParentRoute, TCustomId, TPath, TSearchSchemaInput, TSearchSchema, TSearchSchemaUsed, TFullSearchSchemaInput, TFullSearchSchema, TParams, TAllParams, TRouteContextReturn, TRouteContext, TRouterContext, TAllContext, TLoaderDeps, TLoaderData> & UpdatableRouteOptions<NoInfer<TFullSearchSchema>, NoInfer<TLoaderData>>;
|
|
29
30
|
export type ParamsFallback<TPath extends string, TParams> = unknown extends TParams ? Record<ParsePathParams<TPath>, string> : TParams;
|
|
30
31
|
export type BaseRouteOptions<TParentRoute extends AnyRoute = AnyRoute, TCustomId extends string = string, TPath extends string = string, TSearchSchemaInput extends Record<string, any> = {}, TSearchSchema extends Record<string, any> = {}, TSearchSchemaUsed extends Record<string, any> = {}, TFullSearchSchemaInput extends Record<string, any> = TSearchSchemaUsed, TFullSearchSchema extends Record<string, any> = TSearchSchema, TParams extends AnyPathParams = {}, TAllParams = ParamsFallback<TPath, TParams>, TRouteContextReturn extends RouteContext = RouteContext, TRouteContext extends RouteContext = RouteContext, TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext, TAllContext extends Record<string, any> = AnyContext, TLoaderDeps extends Record<string, any> = {}, TLoaderData extends any = unknown> = RoutePathOptions<TCustomId, TPath> & {
|
|
31
32
|
getParentRoute: () => TParentRoute;
|
|
@@ -56,7 +57,7 @@ type BeforeLoadFn<TFullSearchSchema extends Record<string, any>, TParentRoute ex
|
|
|
56
57
|
buildLocation: BuildLocationFn<TParentRoute>;
|
|
57
58
|
cause: 'preload' | 'enter' | 'stay';
|
|
58
59
|
}) => Promise<TRouteContextReturn> | TRouteContextReturn | void;
|
|
59
|
-
export type UpdatableRouteOptions<TFullSearchSchema extends Record<string, any
|
|
60
|
+
export type UpdatableRouteOptions<TFullSearchSchema extends Record<string, any>, TLoaderData extends any> = {
|
|
60
61
|
caseSensitive?: boolean;
|
|
61
62
|
wrapInSuspense?: boolean;
|
|
62
63
|
component?: RouteComponent;
|
|
@@ -74,7 +75,42 @@ export type UpdatableRouteOptions<TFullSearchSchema extends Record<string, any>>
|
|
|
74
75
|
onEnter?: (match: AnyRouteMatch) => void;
|
|
75
76
|
onStay?: (match: AnyRouteMatch) => void;
|
|
76
77
|
onLeave?: (match: AnyRouteMatch) => void;
|
|
78
|
+
meta?: (ctx: {
|
|
79
|
+
loaderData: TLoaderData;
|
|
80
|
+
}) => JSX.IntrinsicElements['meta'][];
|
|
81
|
+
links?: () => JSX.IntrinsicElements['link'][];
|
|
82
|
+
scripts?: () => JSX.IntrinsicElements['script'][];
|
|
77
83
|
};
|
|
84
|
+
export type MetaDescriptor = {
|
|
85
|
+
charSet: 'utf-8';
|
|
86
|
+
} | {
|
|
87
|
+
title: string;
|
|
88
|
+
} | {
|
|
89
|
+
name: string;
|
|
90
|
+
content: string;
|
|
91
|
+
} | {
|
|
92
|
+
property: string;
|
|
93
|
+
content: string;
|
|
94
|
+
} | {
|
|
95
|
+
httpEquiv: string;
|
|
96
|
+
content: string;
|
|
97
|
+
} | {
|
|
98
|
+
'script:ld+json': LdJsonObject;
|
|
99
|
+
} | {
|
|
100
|
+
tagName: 'meta' | 'link';
|
|
101
|
+
[name: string]: string;
|
|
102
|
+
} | {
|
|
103
|
+
[name: string]: unknown;
|
|
104
|
+
};
|
|
105
|
+
type LdJsonObject = {
|
|
106
|
+
[Key in string]: LdJsonValue;
|
|
107
|
+
} & {
|
|
108
|
+
[Key in string]?: LdJsonValue | undefined;
|
|
109
|
+
};
|
|
110
|
+
type LdJsonArray = LdJsonValue[] | readonly LdJsonValue[];
|
|
111
|
+
type LdJsonPrimitive = string | number | boolean | null;
|
|
112
|
+
type LdJsonValue = LdJsonPrimitive | LdJsonObject | LdJsonArray;
|
|
113
|
+
export type RouteLinkEntry = {};
|
|
78
114
|
export type ParseParamsOption<TPath extends string, TParams> = ParseParamsFn<TPath, TParams>;
|
|
79
115
|
export type ParseParamsFn<TPath extends string, TParams> = (rawParams: IsAny<TPath, any, Record<ParsePathParams<TPath>, string>>) => TParams extends Record<ParsePathParams<TPath>, any> ? TParams : 'parseParams must return an object';
|
|
80
116
|
export type ParseParamsObj<TPath extends string, TParams> = {
|
|
@@ -134,6 +170,10 @@ export type RouteConstraints = {
|
|
|
134
170
|
TChildren: unknown;
|
|
135
171
|
TRouteTree: AnyRoute;
|
|
136
172
|
};
|
|
173
|
+
export declare function getRouteApi<TId extends RouteIds<RegisteredRouter['routeTree']>, TRoute extends AnyRoute = RouteById<RegisteredRouter['routeTree'], TId>, TFullSearchSchema extends Record<string, any> = TRoute['types']['fullSearchSchema'], TAllParams extends AnyPathParams = TRoute['types']['allParams'], TAllContext extends Record<string, any> = TRoute['types']['allContext'], TLoaderDeps extends Record<string, any> = TRoute['types']['loaderDeps'], TLoaderData extends any = TRoute['types']['loaderData']>(id: TId): RouteApi<TId, TRoute, TFullSearchSchema, TAllParams, TAllContext, TLoaderDeps, TLoaderData>;
|
|
174
|
+
/**
|
|
175
|
+
* @deprecated Use the `getRouteApi` function instead.
|
|
176
|
+
*/
|
|
137
177
|
export declare class RouteApi<TId extends RouteIds<RegisteredRouter['routeTree']>, TRoute extends AnyRoute = RouteById<RegisteredRouter['routeTree'], TId>, TFullSearchSchema extends Record<string, any> = TRoute['types']['fullSearchSchema'], TAllParams extends AnyPathParams = TRoute['types']['allParams'], TAllContext extends Record<string, any> = TRoute['types']['allContext'], TLoaderDeps extends Record<string, any> = TRoute['types']['loaderDeps'], TLoaderData extends any = TRoute['types']['loaderData']> {
|
|
138
178
|
id: TId;
|
|
139
179
|
constructor({ id }: {
|
|
@@ -158,12 +198,14 @@ export declare class RouteApi<TId extends RouteIds<RegisteredRouter['routeTree']
|
|
|
158
198
|
select?: ((s: TLoaderData) => TSelected) | undefined;
|
|
159
199
|
} | undefined) => TSelected;
|
|
160
200
|
}
|
|
201
|
+
/**
|
|
202
|
+
* @deprecated Use the `createRoute` function instead.
|
|
203
|
+
*/
|
|
161
204
|
export declare class Route<TParentRoute extends RouteConstraints['TParentRoute'] = AnyRoute, TPath extends RouteConstraints['TPath'] = '/', TFullPath extends RouteConstraints['TFullPath'] = ResolveFullPath<TParentRoute, TPath>, TCustomId extends RouteConstraints['TCustomId'] = string, TId extends RouteConstraints['TId'] = ResolveId<TParentRoute, TCustomId, TPath>, TSearchSchemaInput extends RouteConstraints['TSearchSchema'] = {}, TSearchSchema extends RouteConstraints['TSearchSchema'] = {}, TSearchSchemaUsed extends Record<string, any> = TSearchSchemaInput extends SearchSchemaInput ? Omit<TSearchSchemaInput, keyof SearchSchemaInput> : TSearchSchema, TFullSearchSchemaInput extends Record<string, any> = ResolveFullSearchSchemaInput<TParentRoute, TSearchSchemaUsed>, TFullSearchSchema extends RouteConstraints['TFullSearchSchema'] = ResolveFullSearchSchema<TParentRoute, TSearchSchema>, TParams extends RouteConstraints['TParams'] = Expand<Record<ParsePathParams<TPath>, string>>, TAllParams extends RouteConstraints['TAllParams'] = ResolveAllParams<TParentRoute, TParams>, TRouteContextReturn extends RouteConstraints['TRouteContext'] = RouteContext, TRouteContext extends RouteConstraints['TRouteContext'] = [
|
|
162
205
|
TRouteContextReturn
|
|
163
206
|
] extends [never] ? RouteContext : TRouteContextReturn, TAllContext extends Expand<Assign<IsAny<TParentRoute['types']['allContext'], {}>, TRouteContext>> = Expand<Assign<IsAny<TParentRoute['types']['allContext'], {}>, TRouteContext>>, TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext, TLoaderDeps extends Record<string, any> = {}, TLoaderData extends any = unknown, TChildren extends RouteConstraints['TChildren'] = unknown, TRouteTree extends RouteConstraints['TRouteTree'] = AnyRoute> {
|
|
164
207
|
isRoot: TParentRoute extends Route<any> ? true : false;
|
|
165
208
|
options: RouteOptions<TParentRoute, TCustomId, TPath, TSearchSchemaInput, TSearchSchema, TSearchSchemaUsed, TFullSearchSchemaInput, TFullSearchSchema, TParams, TAllParams, TRouteContextReturn, TRouteContext, TRouterContext, TAllContext, TLoaderDeps, TLoaderData>;
|
|
166
|
-
test: Expand<Assign<IsAny<TParentRoute['types']['allContext'], {}>, TRouteContext>>;
|
|
167
209
|
parentRoute: TParentRoute;
|
|
168
210
|
id: TId;
|
|
169
211
|
path: TPath;
|
|
@@ -173,6 +215,7 @@ export declare class Route<TParentRoute extends RouteConstraints['TParentRoute']
|
|
|
173
215
|
originalIndex?: number;
|
|
174
216
|
router?: AnyRouter;
|
|
175
217
|
rank: number;
|
|
218
|
+
lazyFn?: () => Promise<LazyRoute<any>>;
|
|
176
219
|
constructor(options: RouteOptions<TParentRoute, TCustomId, TPath, TSearchSchemaInput, TSearchSchema, TSearchSchemaUsed, TFullSearchSchemaInput, TFullSearchSchema, TParams, TAllParams, TRouteContextReturn, TRouteContext, TRouterContext, TAllContext, TLoaderDeps, TLoaderData>);
|
|
177
220
|
types: {
|
|
178
221
|
parentRoute: TParentRoute;
|
|
@@ -203,7 +246,8 @@ export declare class Route<TParentRoute extends RouteConstraints['TParentRoute']
|
|
|
203
246
|
updateLoader: <TNewLoaderData extends unknown = unknown>(options: {
|
|
204
247
|
loader: RouteLoaderFn<TAllParams, TLoaderDeps, TAllContext, TRouteContext, TNewLoaderData>;
|
|
205
248
|
}) => Route<TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchSchemaInput, TSearchSchema, TSearchSchemaUsed, TFullSearchSchemaInput, TFullSearchSchema, TParams, TAllParams, TRouteContextReturn, TRouteContext, TAllContext, TRouterContext, TLoaderDeps, TNewLoaderData, TChildren, TRouteTree>;
|
|
206
|
-
update: (options: UpdatableRouteOptions<TFullSearchSchema>) => this;
|
|
249
|
+
update: (options: UpdatableRouteOptions<TFullSearchSchema, TLoaderData>) => this;
|
|
250
|
+
lazy: (lazyFn: () => Promise<LazyRoute<any>>) => this;
|
|
207
251
|
useMatch: <TSelected = TAllContext>(opts?: {
|
|
208
252
|
select?: ((search: TAllContext) => TSelected) | undefined;
|
|
209
253
|
} | undefined) => TSelected;
|
|
@@ -223,11 +267,17 @@ export declare class Route<TParentRoute extends RouteConstraints['TParentRoute']
|
|
|
223
267
|
select?: ((search: TLoaderData) => TSelected) | undefined;
|
|
224
268
|
} | undefined) => TSelected;
|
|
225
269
|
}
|
|
270
|
+
export declare function createRoute<TParentRoute extends RouteConstraints['TParentRoute'] = AnyRoute, TPath extends RouteConstraints['TPath'] = '/', TFullPath extends RouteConstraints['TFullPath'] = ResolveFullPath<TParentRoute, TPath>, TCustomId extends RouteConstraints['TCustomId'] = string, TId extends RouteConstraints['TId'] = ResolveId<TParentRoute, TCustomId, TPath>, TSearchSchemaInput extends RouteConstraints['TSearchSchema'] = {}, TSearchSchema extends RouteConstraints['TSearchSchema'] = {}, TSearchSchemaUsed extends Record<string, any> = TSearchSchemaInput extends SearchSchemaInput ? Omit<TSearchSchemaInput, keyof SearchSchemaInput> : TSearchSchema, TFullSearchSchemaInput extends Record<string, any> = ResolveFullSearchSchemaInput<TParentRoute, TSearchSchemaUsed>, TFullSearchSchema extends RouteConstraints['TFullSearchSchema'] = ResolveFullSearchSchema<TParentRoute, TSearchSchema>, TParams extends RouteConstraints['TParams'] = Expand<Record<ParsePathParams<TPath>, string>>, TAllParams extends RouteConstraints['TAllParams'] = ResolveAllParams<TParentRoute, TParams>, TRouteContextReturn extends RouteConstraints['TRouteContext'] = RouteContext, TRouteContext extends RouteConstraints['TRouteContext'] = [
|
|
271
|
+
TRouteContextReturn
|
|
272
|
+
] extends [never] ? RouteContext : TRouteContextReturn, TAllContext extends Expand<Assign<IsAny<TParentRoute['types']['allContext'], {}>, TRouteContext>> = Expand<Assign<IsAny<TParentRoute['types']['allContext'], {}>, TRouteContext>>, TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext, TLoaderDeps extends Record<string, any> = {}, TLoaderData extends any = unknown, TChildren extends RouteConstraints['TChildren'] = unknown, TRouteTree extends RouteConstraints['TRouteTree'] = AnyRoute>(options: RouteOptions<TParentRoute, TCustomId, TPath, TSearchSchemaInput, TSearchSchema, TSearchSchemaUsed, TFullSearchSchemaInput, TFullSearchSchema, TParams, TAllParams, TRouteContextReturn, TRouteContext, TRouterContext, TAllContext, TLoaderDeps, TLoaderData>): Route<TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchSchemaInput, TSearchSchema, TSearchSchemaUsed, TFullSearchSchemaInput, TFullSearchSchema, TParams, TAllParams, TRouteContextReturn, TRouteContext, TAllContext, TRouterContext, TLoaderDeps, TLoaderData, TChildren, TRouteTree>;
|
|
226
273
|
export type AnyRootRoute = RootRoute<any, any, any, any, any, any, any, any>;
|
|
227
274
|
export declare function rootRouteWithContext<TRouterContext extends {}>(): <TSearchSchemaInput extends Record<string, any> = RootSearchSchema, TSearchSchema extends Record<string, any> = RootSearchSchema, TSearchSchemaUsed extends Record<string, any> = RootSearchSchema, TRouteContextReturn extends RouteContext = RouteContext, TRouteContext extends RouteContext = [TRouteContextReturn] extends [never] ? RouteContext : TRouteContextReturn, TLoaderDeps extends Record<string, any> = {}, TLoaderData extends unknown = unknown>(options?: Omit<RouteOptions<AnyRoute, "__root__", "", TSearchSchemaInput, TSearchSchema, TSearchSchemaUsed, TSearchSchemaUsed, TSearchSchema, {}, {}, TRouteContextReturn, TRouteContext, TRouterContext, Assign<TRouterContext, TRouteContext>, TLoaderDeps, TLoaderData>, "path" | "id" | "getParentRoute" | "stringifyParams" | "parseParams" | "caseSensitive"> | undefined) => RootRoute<TSearchSchemaInput, TSearchSchema, TSearchSchemaUsed, TRouteContextReturn, TRouteContext, TRouterContext, {}, unknown>;
|
|
228
275
|
export type RootSearchSchema = {
|
|
229
276
|
__TRootSearchSchema__: '__TRootSearchSchema__';
|
|
230
277
|
};
|
|
278
|
+
/**
|
|
279
|
+
* @deprecated `RootRoute` is now an internal implementation detail. Use `createRootRoute()` instead.
|
|
280
|
+
*/
|
|
231
281
|
export declare class RootRoute<TSearchSchemaInput extends Record<string, any> = RootSearchSchema, TSearchSchema extends Record<string, any> = RootSearchSchema, TSearchSchemaUsed extends Record<string, any> = RootSearchSchema, TRouteContextReturn extends RouteContext = RouteContext, TRouteContext extends RouteContext = [TRouteContextReturn] extends [never] ? RouteContext : TRouteContextReturn, TRouterContext extends {} = {}, TLoaderDeps extends Record<string, any> = {}, TLoaderData extends any = unknown> extends Route<any, // TParentRoute
|
|
232
282
|
'/', // TPath
|
|
233
283
|
'/', // TFullPath
|
|
@@ -259,6 +309,19 @@ any> {
|
|
|
259
309
|
TRouterContext, Assign<TRouterContext, TRouteContext>, // TAllContext
|
|
260
310
|
TLoaderDeps, TLoaderData>, 'path' | 'id' | 'getParentRoute' | 'caseSensitive' | 'parseParams' | 'stringifyParams'>);
|
|
261
311
|
}
|
|
312
|
+
export declare function createRootRoute<TSearchSchemaInput extends Record<string, any> = RootSearchSchema, TSearchSchema extends Record<string, any> = RootSearchSchema, TSearchSchemaUsed extends Record<string, any> = RootSearchSchema, TRouteContextReturn extends RouteContext = RouteContext, TRouteContext extends RouteContext = [TRouteContextReturn] extends [never] ? RouteContext : TRouteContextReturn, TRouterContext extends {} = {}, TLoaderDeps extends Record<string, any> = {}, TLoaderData extends any = unknown>(options?: Omit<RouteOptions<AnyRoute, // TParentRoute
|
|
313
|
+
RootRouteId, // TCustomId
|
|
314
|
+
'', // TPath
|
|
315
|
+
TSearchSchemaInput, // TSearchSchemaInput
|
|
316
|
+
TSearchSchema, // TSearchSchema
|
|
317
|
+
TSearchSchemaUsed, TSearchSchemaUsed, // TFullSearchSchemaInput
|
|
318
|
+
TSearchSchema, // TFullSearchSchema
|
|
319
|
+
{}, // TParams
|
|
320
|
+
{}, // TAllParams
|
|
321
|
+
TRouteContextReturn, // TRouteContextReturn
|
|
322
|
+
TRouteContext, // TRouteContext
|
|
323
|
+
TRouterContext, Assign<TRouterContext, TRouteContext>, // TAllContext
|
|
324
|
+
TLoaderDeps, TLoaderData>, 'path' | 'id' | 'getParentRoute' | 'caseSensitive' | 'parseParams' | 'stringifyParams'>): RootRoute<TSearchSchemaInput, TSearchSchema, TSearchSchemaUsed, TRouteContextReturn, TRouteContext, TRouterContext, TLoaderDeps, TLoaderData>;
|
|
262
325
|
export type ResolveFullPath<TParentRoute extends AnyRoute, TPath extends string, TPrefixed = RoutePrefix<TParentRoute['fullPath'], TPath>> = TPrefixed extends RootRouteId ? '/' : TPrefixed;
|
|
263
326
|
type RoutePrefix<TPrefix extends string, TPath extends string> = string extends TPath ? RootRouteId : TPath extends string ? TPrefix extends RootRouteId ? TPath extends '/' ? '/' : `/${TrimPath<TPath>}` : `${TPrefix}/${TPath}` extends '/' ? '/' : `/${TrimPathLeft<`${TrimPathRight<TPrefix>}/${TrimPath<TPath>}`>}` : never;
|
|
264
327
|
export type TrimPath<T extends string> = '' extends T ? '' : TrimPathRight<TrimPathLeft<T>>;
|
|
@@ -277,19 +340,28 @@ export type RouteMask<TRouteTree extends AnyRoute> = {
|
|
|
277
340
|
export declare function createRouteMask<TRouteTree extends AnyRoute, TFrom extends RoutePaths<TRouteTree>, TTo extends string>(opts: {
|
|
278
341
|
routeTree: TRouteTree;
|
|
279
342
|
} & ToSubOptions<TRouteTree, TFrom, TTo>): RouteMask<TRouteTree>;
|
|
343
|
+
/**
|
|
344
|
+
* @deprecated Use `ErrorComponentProps` instead.
|
|
345
|
+
*/
|
|
280
346
|
export type ErrorRouteProps = {
|
|
281
347
|
error: unknown;
|
|
282
348
|
info: {
|
|
283
349
|
componentStack: string;
|
|
284
350
|
};
|
|
285
351
|
};
|
|
352
|
+
export type ErrorComponentProps = {
|
|
353
|
+
error: unknown;
|
|
354
|
+
info: {
|
|
355
|
+
componentStack: string;
|
|
356
|
+
};
|
|
357
|
+
};
|
|
286
358
|
export type ReactNode = any;
|
|
287
359
|
export type SyncRouteComponent<TProps> = ((props: TProps) => ReactNode) | React.LazyExoticComponent<(props: TProps) => ReactNode>;
|
|
288
360
|
export type AsyncRouteComponent<TProps> = SyncRouteComponent<TProps> & {
|
|
289
361
|
preload?: () => Promise<void>;
|
|
290
362
|
};
|
|
291
363
|
export type RouteComponent<TProps = any> = SyncRouteComponent<TProps> & AsyncRouteComponent<TProps>;
|
|
292
|
-
export type ErrorRouteComponent = RouteComponent<
|
|
364
|
+
export type ErrorRouteComponent = RouteComponent<ErrorComponentProps>;
|
|
293
365
|
export declare class NotFoundRoute<TParentRoute extends AnyRootRoute, TSearchSchemaInput extends Record<string, any> = {}, TSearchSchema extends RouteConstraints['TSearchSchema'] = {}, TSearchSchemaUsed extends RouteConstraints['TSearchSchema'] = {}, TFullSearchSchemaInput extends RouteConstraints['TFullSearchSchema'] = ResolveFullSearchSchemaInput<TParentRoute, TSearchSchemaUsed>, TFullSearchSchema extends RouteConstraints['TFullSearchSchema'] = ResolveFullSearchSchema<TParentRoute, TSearchSchema>, TRouteContextReturn extends RouteConstraints['TRouteContext'] = AnyContext, TRouteContext extends RouteConstraints['TRouteContext'] = RouteContext, TAllContext extends Expand<Assign<IsAny<TParentRoute['types']['allContext'], {}>, TRouteContext>> = Expand<Assign<IsAny<TParentRoute['types']['allContext'], {}>, TRouteContext>>, TRouterContext extends RouteConstraints['TRouterContext'] = AnyContext, TLoaderDeps extends Record<string, any> = {}, TLoaderData extends any = unknown, TChildren extends RouteConstraints['TChildren'] = unknown, TRouteTree extends RouteConstraints['TRouteTree'] = AnyRoute> extends Route<TParentRoute, '/404', '/404', '404', '404', TSearchSchemaInput, TSearchSchema, TSearchSchemaUsed, TFullSearchSchemaInput, TFullSearchSchema, {}, {}, TRouteContextReturn, TRouteContext, TAllContext, TRouterContext, TLoaderDeps, TLoaderData, TChildren, TRouteTree> {
|
|
294
366
|
constructor(options: Omit<RouteOptions<TParentRoute, string, string, TSearchSchemaInput, TSearchSchema, TSearchSchemaUsed, TFullSearchSchemaInput, TFullSearchSchema, {}, {}, TRouteContextReturn, TRouteContext, TRouterContext, TAllContext, TLoaderDeps, TLoaderData>, 'caseSensitive' | 'parseParams' | 'stringifyParams' | 'path' | 'id'>);
|
|
295
367
|
}
|
package/dist/esm/route.js
CHANGED
|
@@ -4,6 +4,9 @@ import { trimPath, joinPaths } from "./path.js";
|
|
|
4
4
|
import { useParams } from "./useParams.js";
|
|
5
5
|
import { useSearch } from "./useSearch.js";
|
|
6
6
|
const rootRouteId = "__root__";
|
|
7
|
+
function getRouteApi(id) {
|
|
8
|
+
return new RouteApi({ id });
|
|
9
|
+
}
|
|
7
10
|
class RouteApi {
|
|
8
11
|
constructor({ id }) {
|
|
9
12
|
this.useMatch = (opts) => {
|
|
@@ -79,6 +82,10 @@ class Route {
|
|
|
79
82
|
Object.assign(this.options, options2);
|
|
80
83
|
return this;
|
|
81
84
|
};
|
|
85
|
+
this.lazy = (lazyFn) => {
|
|
86
|
+
this.lazyFn = lazyFn;
|
|
87
|
+
return this;
|
|
88
|
+
};
|
|
82
89
|
this.useMatch = (opts) => {
|
|
83
90
|
return useMatch({ ...opts, from: this.id });
|
|
84
91
|
};
|
|
@@ -110,9 +117,12 @@ class Route {
|
|
|
110
117
|
this.$$typeof = Symbol.for("react.memo");
|
|
111
118
|
}
|
|
112
119
|
}
|
|
120
|
+
function createRoute(options) {
|
|
121
|
+
return new Route(options);
|
|
122
|
+
}
|
|
113
123
|
function rootRouteWithContext() {
|
|
114
124
|
return (options) => {
|
|
115
|
-
return
|
|
125
|
+
return createRootRoute(options);
|
|
116
126
|
};
|
|
117
127
|
}
|
|
118
128
|
class RootRoute extends Route {
|
|
@@ -120,6 +130,9 @@ class RootRoute extends Route {
|
|
|
120
130
|
super(options);
|
|
121
131
|
}
|
|
122
132
|
}
|
|
133
|
+
function createRootRoute(options) {
|
|
134
|
+
return new RootRoute(options);
|
|
135
|
+
}
|
|
123
136
|
function createRouteMask(opts) {
|
|
124
137
|
return opts;
|
|
125
138
|
}
|
|
@@ -136,7 +149,10 @@ export {
|
|
|
136
149
|
RootRoute,
|
|
137
150
|
Route,
|
|
138
151
|
RouteApi,
|
|
152
|
+
createRootRoute,
|
|
153
|
+
createRoute,
|
|
139
154
|
createRouteMask,
|
|
155
|
+
getRouteApi,
|
|
140
156
|
rootRouteId,
|
|
141
157
|
rootRouteWithContext
|
|
142
158
|
};
|