@tanstack/solid-router 1.108.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/LICENSE +21 -0
- package/README.md +29 -0
- package/dist/cjs/Asset.cjs +59 -0
- package/dist/cjs/Asset.cjs.map +1 -0
- package/dist/cjs/Asset.d.cts +2 -0
- package/dist/cjs/CatchBoundary.cjs +92 -0
- package/dist/cjs/CatchBoundary.cjs.map +1 -0
- package/dist/cjs/CatchBoundary.d.cts +11 -0
- package/dist/cjs/HeadContent.cjs +129 -0
- package/dist/cjs/HeadContent.cjs.map +1 -0
- package/dist/cjs/HeadContent.d.cts +8 -0
- package/dist/cjs/Match.cjs +340 -0
- package/dist/cjs/Match.cjs.map +1 -0
- package/dist/cjs/Match.d.cts +8 -0
- package/dist/cjs/Matches.cjs +151 -0
- package/dist/cjs/Matches.cjs.map +1 -0
- package/dist/cjs/Matches.d.cts +69 -0
- package/dist/cjs/RouterProvider.cjs +45 -0
- package/dist/cjs/RouterProvider.cjs.map +1 -0
- package/dist/cjs/RouterProvider.d.cts +35 -0
- package/dist/cjs/SafeFragment.cjs +8 -0
- package/dist/cjs/SafeFragment.cjs.map +1 -0
- package/dist/cjs/SafeFragment.d.cts +1 -0
- package/dist/cjs/ScriptOnce.cjs +23 -0
- package/dist/cjs/ScriptOnce.cjs.map +1 -0
- package/dist/cjs/ScriptOnce.d.cts +5 -0
- package/dist/cjs/Scripts.cjs +48 -0
- package/dist/cjs/Scripts.cjs.map +1 -0
- package/dist/cjs/Scripts.d.cts +1 -0
- package/dist/cjs/ScrollRestoration.cjs +37 -0
- package/dist/cjs/ScrollRestoration.cjs.map +1 -0
- package/dist/cjs/ScrollRestoration.d.cts +15 -0
- package/dist/cjs/Transitioner.cjs +132 -0
- package/dist/cjs/Transitioner.cjs.map +1 -0
- package/dist/cjs/Transitioner.d.cts +1 -0
- package/dist/cjs/awaited.cjs +53 -0
- package/dist/cjs/awaited.cjs.map +1 -0
- package/dist/cjs/awaited.d.cts +11 -0
- package/dist/cjs/fileRoute.cjs +90 -0
- package/dist/cjs/fileRoute.cjs.map +1 -0
- package/dist/cjs/fileRoute.d.cts +58 -0
- package/dist/cjs/history.d.cts +8 -0
- package/dist/cjs/index.cjs +260 -0
- package/dist/cjs/index.cjs.map +1 -0
- package/dist/cjs/index.d.cts +53 -0
- package/dist/cjs/lazyRouteComponent.cjs +74 -0
- package/dist/cjs/lazyRouteComponent.cjs.map +1 -0
- package/dist/cjs/lazyRouteComponent.d.cts +7 -0
- package/dist/cjs/link.cjs +279 -0
- package/dist/cjs/link.cjs.map +1 -0
- package/dist/cjs/link.d.cts +113 -0
- package/dist/cjs/matchContext.cjs +25 -0
- package/dist/cjs/matchContext.cjs.map +1 -0
- package/dist/cjs/matchContext.d.cts +3 -0
- package/dist/cjs/not-found.cjs +51 -0
- package/dist/cjs/not-found.cjs.map +1 -0
- package/dist/cjs/not-found.d.cts +27 -0
- package/dist/cjs/redirects.cjs +29 -0
- package/dist/cjs/redirects.cjs.map +1 -0
- package/dist/cjs/redirects.d.cts +21 -0
- package/dist/cjs/renderRouteNotFound.cjs +23 -0
- package/dist/cjs/renderRouteNotFound.cjs.map +1 -0
- package/dist/cjs/renderRouteNotFound.d.cts +3 -0
- package/dist/cjs/route.cjs +233 -0
- package/dist/cjs/route.cjs.map +1 -0
- package/dist/cjs/route.d.cts +297 -0
- package/dist/cjs/routeInfo.d.cts +53 -0
- package/dist/cjs/router.cjs +1687 -0
- package/dist/cjs/router.cjs.map +1 -0
- package/dist/cjs/router.d.cts +555 -0
- package/dist/cjs/routerContext.cjs +33 -0
- package/dist/cjs/routerContext.cjs.map +1 -0
- package/dist/cjs/routerContext.d.cts +8 -0
- package/dist/cjs/scroll-restoration.cjs +183 -0
- package/dist/cjs/scroll-restoration.cjs.map +1 -0
- package/dist/cjs/scroll-restoration.d.cts +29 -0
- package/dist/cjs/typePrimitives.d.cts +66 -0
- package/dist/cjs/useBlocker.cjs +165 -0
- package/dist/cjs/useBlocker.cjs.map +1 -0
- package/dist/cjs/useBlocker.d.cts +68 -0
- package/dist/cjs/useCanGoBack.cjs +8 -0
- package/dist/cjs/useCanGoBack.cjs.map +1 -0
- package/dist/cjs/useCanGoBack.d.cts +1 -0
- package/dist/cjs/useLoaderData.cjs +14 -0
- package/dist/cjs/useLoaderData.cjs.map +1 -0
- package/dist/cjs/useLoaderData.d.cts +13 -0
- package/dist/cjs/useLoaderDeps.cjs +17 -0
- package/dist/cjs/useLoaderDeps.cjs.map +1 -0
- package/dist/cjs/useLoaderDeps.d.cts +12 -0
- package/dist/cjs/useLocation.cjs +10 -0
- package/dist/cjs/useLocation.cjs.map +1 -0
- package/dist/cjs/useLocation.d.cts +7 -0
- package/dist/cjs/useMatch.cjs +39 -0
- package/dist/cjs/useMatch.cjs.map +1 -0
- package/dist/cjs/useMatch.d.cts +14 -0
- package/dist/cjs/useNavigate.cjs +45 -0
- package/dist/cjs/useNavigate.cjs.map +1 -0
- package/dist/cjs/useNavigate.d.cts +7 -0
- package/dist/cjs/useParams.cjs +15 -0
- package/dist/cjs/useParams.cjs.map +1 -0
- package/dist/cjs/useParams.d.cts +15 -0
- package/dist/cjs/useRouteContext.cjs +11 -0
- package/dist/cjs/useRouteContext.cjs.map +1 -0
- package/dist/cjs/useRouteContext.d.cts +13 -0
- package/dist/cjs/useRouter.cjs +29 -0
- package/dist/cjs/useRouter.cjs.map +1 -0
- package/dist/cjs/useRouter.d.cts +4 -0
- package/dist/cjs/useRouterState.cjs +16 -0
- package/dist/cjs/useRouterState.cjs.map +1 -0
- package/dist/cjs/useRouterState.d.cts +8 -0
- package/dist/cjs/useSearch.cjs +15 -0
- package/dist/cjs/useSearch.cjs.map +1 -0
- package/dist/cjs/useSearch.d.cts +15 -0
- package/dist/cjs/utils.cjs +58 -0
- package/dist/cjs/utils.cjs.map +1 -0
- package/dist/cjs/utils.d.cts +44 -0
- package/dist/esm/Asset.d.ts +2 -0
- package/dist/esm/Asset.js +59 -0
- package/dist/esm/Asset.js.map +1 -0
- package/dist/esm/CatchBoundary.d.ts +11 -0
- package/dist/esm/CatchBoundary.js +75 -0
- package/dist/esm/CatchBoundary.js.map +1 -0
- package/dist/esm/HeadContent.d.ts +8 -0
- package/dist/esm/HeadContent.js +112 -0
- package/dist/esm/HeadContent.js.map +1 -0
- package/dist/esm/Match.d.ts +8 -0
- package/dist/esm/Match.js +323 -0
- package/dist/esm/Match.js.map +1 -0
- package/dist/esm/Matches.d.ts +69 -0
- package/dist/esm/Matches.js +134 -0
- package/dist/esm/Matches.js.map +1 -0
- package/dist/esm/RouterProvider.d.ts +35 -0
- package/dist/esm/RouterProvider.js +45 -0
- package/dist/esm/RouterProvider.js.map +1 -0
- package/dist/esm/SafeFragment.d.ts +1 -0
- package/dist/esm/SafeFragment.js +8 -0
- package/dist/esm/SafeFragment.js.map +1 -0
- package/dist/esm/ScriptOnce.d.ts +5 -0
- package/dist/esm/ScriptOnce.js +23 -0
- package/dist/esm/ScriptOnce.js.map +1 -0
- package/dist/esm/Scripts.d.ts +1 -0
- package/dist/esm/Scripts.js +48 -0
- package/dist/esm/Scripts.js.map +1 -0
- package/dist/esm/ScrollRestoration.d.ts +15 -0
- package/dist/esm/ScrollRestoration.js +37 -0
- package/dist/esm/ScrollRestoration.js.map +1 -0
- package/dist/esm/Transitioner.d.ts +1 -0
- package/dist/esm/Transitioner.js +115 -0
- package/dist/esm/Transitioner.js.map +1 -0
- package/dist/esm/awaited.d.ts +11 -0
- package/dist/esm/awaited.js +36 -0
- package/dist/esm/awaited.js.map +1 -0
- package/dist/esm/fileRoute.d.ts +58 -0
- package/dist/esm/fileRoute.js +90 -0
- package/dist/esm/fileRoute.js.map +1 -0
- package/dist/esm/history.d.ts +8 -0
- package/dist/esm/index.d.ts +53 -0
- package/dist/esm/index.js +149 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/lazyRouteComponent.d.ts +7 -0
- package/dist/esm/lazyRouteComponent.js +74 -0
- package/dist/esm/lazyRouteComponent.js.map +1 -0
- package/dist/esm/link.d.ts +113 -0
- package/dist/esm/link.js +262 -0
- package/dist/esm/link.js.map +1 -0
- package/dist/esm/matchContext.d.ts +3 -0
- package/dist/esm/matchContext.js +8 -0
- package/dist/esm/matchContext.js.map +1 -0
- package/dist/esm/not-found.d.ts +27 -0
- package/dist/esm/not-found.js +51 -0
- package/dist/esm/not-found.js.map +1 -0
- package/dist/esm/redirects.d.ts +21 -0
- package/dist/esm/redirects.js +29 -0
- package/dist/esm/redirects.js.map +1 -0
- package/dist/esm/renderRouteNotFound.d.ts +3 -0
- package/dist/esm/renderRouteNotFound.js +23 -0
- package/dist/esm/renderRouteNotFound.js.map +1 -0
- package/dist/esm/route.d.ts +297 -0
- package/dist/esm/route.js +233 -0
- package/dist/esm/route.js.map +1 -0
- package/dist/esm/routeInfo.d.ts +53 -0
- package/dist/esm/router.d.ts +555 -0
- package/dist/esm/router.js +1687 -0
- package/dist/esm/router.js.map +1 -0
- package/dist/esm/routerContext.d.ts +8 -0
- package/dist/esm/routerContext.js +16 -0
- package/dist/esm/routerContext.js.map +1 -0
- package/dist/esm/scroll-restoration.d.ts +29 -0
- package/dist/esm/scroll-restoration.js +183 -0
- package/dist/esm/scroll-restoration.js.map +1 -0
- package/dist/esm/typePrimitives.d.ts +66 -0
- package/dist/esm/useBlocker.d.ts +68 -0
- package/dist/esm/useBlocker.js +148 -0
- package/dist/esm/useBlocker.js.map +1 -0
- package/dist/esm/useCanGoBack.d.ts +1 -0
- package/dist/esm/useCanGoBack.js +8 -0
- package/dist/esm/useCanGoBack.js.map +1 -0
- package/dist/esm/useLoaderData.d.ts +13 -0
- package/dist/esm/useLoaderData.js +14 -0
- package/dist/esm/useLoaderData.js.map +1 -0
- package/dist/esm/useLoaderDeps.d.ts +12 -0
- package/dist/esm/useLoaderDeps.js +17 -0
- package/dist/esm/useLoaderDeps.js.map +1 -0
- package/dist/esm/useLocation.d.ts +7 -0
- package/dist/esm/useLocation.js +10 -0
- package/dist/esm/useLocation.js.map +1 -0
- package/dist/esm/useMatch.d.ts +14 -0
- package/dist/esm/useMatch.js +22 -0
- package/dist/esm/useMatch.js.map +1 -0
- package/dist/esm/useNavigate.d.ts +7 -0
- package/dist/esm/useNavigate.js +28 -0
- package/dist/esm/useNavigate.js.map +1 -0
- package/dist/esm/useParams.d.ts +15 -0
- package/dist/esm/useParams.js +15 -0
- package/dist/esm/useParams.js.map +1 -0
- package/dist/esm/useRouteContext.d.ts +13 -0
- package/dist/esm/useRouteContext.js +11 -0
- package/dist/esm/useRouteContext.js.map +1 -0
- package/dist/esm/useRouter.d.ts +4 -0
- package/dist/esm/useRouter.js +12 -0
- package/dist/esm/useRouter.js.map +1 -0
- package/dist/esm/useRouterState.d.ts +8 -0
- package/dist/esm/useRouterState.js +16 -0
- package/dist/esm/useRouterState.js.map +1 -0
- package/dist/esm/useSearch.d.ts +15 -0
- package/dist/esm/useSearch.js +15 -0
- package/dist/esm/useSearch.js.map +1 -0
- package/dist/esm/utils.d.ts +44 -0
- package/dist/esm/utils.js +41 -0
- package/dist/esm/utils.js.map +1 -0
- package/package.json +75 -0
- package/src/Asset.tsx +23 -0
- package/src/CatchBoundary.tsx +78 -0
- package/src/HeadContent.tsx +146 -0
- package/src/Match.tsx +356 -0
- package/src/Matches.tsx +348 -0
- package/src/RouterProvider.tsx +130 -0
- package/src/SafeFragment.tsx +3 -0
- package/src/ScriptOnce.tsx +30 -0
- package/src/Scripts.tsx +65 -0
- package/src/ScrollRestoration.tsx +65 -0
- package/src/Transitioner.tsx +152 -0
- package/src/awaited.tsx +49 -0
- package/src/fileRoute.ts +274 -0
- package/src/history.ts +9 -0
- package/src/index.tsx +359 -0
- package/src/lazyRouteComponent.tsx +114 -0
- package/src/link.tsx +1002 -0
- package/src/matchContext.tsx +10 -0
- package/src/not-found.tsx +69 -0
- package/src/redirects.ts +71 -0
- package/src/renderRouteNotFound.tsx +27 -0
- package/src/route.ts +1477 -0
- package/src/routeInfo.ts +239 -0
- package/src/router.ts +3066 -0
- package/src/routerContext.tsx +26 -0
- package/src/scroll-restoration.tsx +337 -0
- package/src/typePrimitives.ts +195 -0
- package/src/useBlocker.tsx +298 -0
- package/src/useCanGoBack.ts +5 -0
- package/src/useLoaderData.tsx +64 -0
- package/src/useLoaderDeps.tsx +52 -0
- package/src/useLocation.tsx +26 -0
- package/src/useMatch.tsx +96 -0
- package/src/useNavigate.tsx +61 -0
- package/src/useParams.tsx +83 -0
- package/src/useRouteContext.ts +62 -0
- package/src/useRouter.tsx +15 -0
- package/src/useRouterState.tsx +32 -0
- package/src/useSearch.tsx +84 -0
- package/src/utils.ts +96 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { UseParamsRoute } from './useParams.cjs';
|
|
2
|
+
import { UseMatchRoute } from './useMatch.cjs';
|
|
3
|
+
import { UseSearchRoute } from './useSearch.cjs';
|
|
4
|
+
import { AnyContext, AnyPathParams, AnyValidator, Constrain, ResolveParams } from '@tanstack/router-core';
|
|
5
|
+
import { AnyRoute, FileBaseRouteOptions, RootRoute, Route, RouteConstraints, RouteLoaderFn, UpdatableRouteOptions } from './route.cjs';
|
|
6
|
+
import { RegisteredRouter } from './router.cjs';
|
|
7
|
+
import { RouteById, RouteIds } from './routeInfo.cjs';
|
|
8
|
+
import { UseLoaderDepsRoute } from './useLoaderDeps.cjs';
|
|
9
|
+
import { UseLoaderDataRoute } from './useLoaderData.cjs';
|
|
10
|
+
import { UseRouteContextRoute } from './useRouteContext.cjs';
|
|
11
|
+
export interface FileRoutesByPath {
|
|
12
|
+
}
|
|
13
|
+
export interface FileRouteTypes {
|
|
14
|
+
fileRoutesByFullPath: any;
|
|
15
|
+
fullPaths: any;
|
|
16
|
+
to: any;
|
|
17
|
+
fileRoutesByTo: any;
|
|
18
|
+
id: any;
|
|
19
|
+
fileRoutesById: any;
|
|
20
|
+
}
|
|
21
|
+
export type InferFileRouteTypes<TRouteTree extends AnyRoute> = TRouteTree extends RootRoute<any, any, any, any, any, any, any, infer TFileRouteTypes extends FileRouteTypes> ? TFileRouteTypes : never;
|
|
22
|
+
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'];
|
|
23
|
+
/**
|
|
24
|
+
@deprecated It's no longer recommended to use the `FileRoute` class directly.
|
|
25
|
+
Instead, use `createFileRoute('/path/to/file')(options)` to create a file route.
|
|
26
|
+
*/
|
|
27
|
+
export declare class FileRoute<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']> {
|
|
28
|
+
path: TFilePath;
|
|
29
|
+
silent?: boolean;
|
|
30
|
+
constructor(path: TFilePath, _opts?: {
|
|
31
|
+
silent: boolean;
|
|
32
|
+
});
|
|
33
|
+
createRoute: <TSearchValidator = undefined, TParams = ResolveParams<TPath>, TRouteContextFn = AnyContext, TBeforeLoadFn = AnyContext, TLoaderDeps extends Record<string, any> = {}, TLoaderFn = undefined, TChildren = unknown>(options?: FileBaseRouteOptions<TParentRoute, TId, TPath, TSearchValidator, TParams, TLoaderDeps, TLoaderFn, AnyContext, TRouteContextFn, TBeforeLoadFn> & UpdatableRouteOptions<TParentRoute, TId, TFullPath, TParams, TSearchValidator, TLoaderFn, TLoaderDeps, AnyContext, TRouteContextFn, TBeforeLoadFn>) => Route<TParentRoute, TPath, TFullPath, TFilePath, TId, TSearchValidator, TParams, AnyContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren>;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
@deprecated It's recommended not to split loaders into separate files.
|
|
37
|
+
Instead, place the loader function in the the main route file, inside the
|
|
38
|
+
`createFileRoute('/path/to/file)(options)` options.
|
|
39
|
+
*/
|
|
40
|
+
export declare function FileRouteLoader<TFilePath extends keyof FileRoutesByPath, TRoute extends FileRoutesByPath[TFilePath]['preLoaderRoute']>(_path: TFilePath): <TLoaderFn>(loaderFn: Constrain<TLoaderFn, RouteLoaderFn<TRoute['parentRoute'], TRoute['types']['id'], TRoute['types']['params'], TRoute['types']['loaderDeps'], TRoute['types']['routerContext'], TRoute['types']['routeContextFn'], TRoute['types']['beforeLoadFn']>>) => TLoaderFn;
|
|
41
|
+
export type LazyRouteOptions = Pick<UpdatableRouteOptions<AnyRoute, string, string, AnyPathParams, AnyValidator, {}, AnyContext, AnyContext, AnyContext, AnyContext>, 'component' | 'errorComponent' | 'pendingComponent' | 'notFoundComponent'>;
|
|
42
|
+
export declare class LazyRoute<TRoute extends AnyRoute> {
|
|
43
|
+
options: {
|
|
44
|
+
id: string;
|
|
45
|
+
} & LazyRouteOptions;
|
|
46
|
+
constructor(opts: {
|
|
47
|
+
id: string;
|
|
48
|
+
} & LazyRouteOptions);
|
|
49
|
+
useMatch: UseMatchRoute<TRoute['id']>;
|
|
50
|
+
useRouteContext: UseRouteContextRoute<TRoute['id']>;
|
|
51
|
+
useSearch: UseSearchRoute<TRoute['id']>;
|
|
52
|
+
useParams: UseParamsRoute<TRoute['id']>;
|
|
53
|
+
useLoaderDeps: UseLoaderDepsRoute<TRoute['id']>;
|
|
54
|
+
useLoaderData: UseLoaderDataRoute<TRoute['id']>;
|
|
55
|
+
useNavigate: () => import('./useNavigate.cjs').UseNavigateResult<string>;
|
|
56
|
+
}
|
|
57
|
+
export declare function createLazyRoute<TId extends RouteIds<RegisteredRouter['routeTree']>, TRoute extends AnyRoute = RouteById<RegisteredRouter['routeTree'], TId>>(id: TId): (opts: LazyRouteOptions) => LazyRoute<TRoute>;
|
|
58
|
+
export declare function createLazyFileRoute<TFilePath extends keyof FileRoutesByPath, TRoute extends FileRoutesByPath[TFilePath]['preLoaderRoute']>(id: TFilePath): (opts: LazyRouteOptions) => LazyRoute<TRoute>;
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const invariant = require("tiny-invariant");
|
|
4
|
+
const warning = require("tiny-warning");
|
|
5
|
+
const routerCore = require("@tanstack/router-core");
|
|
6
|
+
const history = require("@tanstack/history");
|
|
7
|
+
const awaited = require("./awaited.cjs");
|
|
8
|
+
const CatchBoundary = require("./CatchBoundary.cjs");
|
|
9
|
+
const fileRoute = require("./fileRoute.cjs");
|
|
10
|
+
const lazyRouteComponent = require("./lazyRouteComponent.cjs");
|
|
11
|
+
const link = require("./link.cjs");
|
|
12
|
+
const Matches = require("./Matches.cjs");
|
|
13
|
+
const matchContext = require("./matchContext.cjs");
|
|
14
|
+
const Match = require("./Match.cjs");
|
|
15
|
+
const useMatch = require("./useMatch.cjs");
|
|
16
|
+
const useLoaderDeps = require("./useLoaderDeps.cjs");
|
|
17
|
+
const useLoaderData = require("./useLoaderData.cjs");
|
|
18
|
+
const redirects = require("./redirects.cjs");
|
|
19
|
+
const route = require("./route.cjs");
|
|
20
|
+
const router = require("./router.cjs");
|
|
21
|
+
const RouterProvider = require("./RouterProvider.cjs");
|
|
22
|
+
const ScrollRestoration = require("./ScrollRestoration.cjs");
|
|
23
|
+
const useBlocker = require("./useBlocker.cjs");
|
|
24
|
+
const useNavigate = require("./useNavigate.cjs");
|
|
25
|
+
const useParams = require("./useParams.cjs");
|
|
26
|
+
const useSearch = require("./useSearch.cjs");
|
|
27
|
+
const routerContext = require("./routerContext.cjs");
|
|
28
|
+
const useRouteContext = require("./useRouteContext.cjs");
|
|
29
|
+
const useRouter = require("./useRouter.cjs");
|
|
30
|
+
const useRouterState = require("./useRouterState.cjs");
|
|
31
|
+
const useLocation = require("./useLocation.cjs");
|
|
32
|
+
const useCanGoBack = require("./useCanGoBack.cjs");
|
|
33
|
+
const utils = require("./utils.cjs");
|
|
34
|
+
const notFound = require("./not-found.cjs");
|
|
35
|
+
const ScriptOnce = require("./ScriptOnce.cjs");
|
|
36
|
+
const Asset = require("./Asset.cjs");
|
|
37
|
+
const HeadContent = require("./HeadContent.cjs");
|
|
38
|
+
const Scripts = require("./Scripts.cjs");
|
|
39
|
+
exports.invariant = invariant;
|
|
40
|
+
exports.warning = warning;
|
|
41
|
+
Object.defineProperty(exports, "TSR_DEFERRED_PROMISE", {
|
|
42
|
+
enumerable: true,
|
|
43
|
+
get: () => routerCore.TSR_DEFERRED_PROMISE
|
|
44
|
+
});
|
|
45
|
+
Object.defineProperty(exports, "cleanPath", {
|
|
46
|
+
enumerable: true,
|
|
47
|
+
get: () => routerCore.cleanPath
|
|
48
|
+
});
|
|
49
|
+
Object.defineProperty(exports, "createControlledPromise", {
|
|
50
|
+
enumerable: true,
|
|
51
|
+
get: () => routerCore.createControlledPromise
|
|
52
|
+
});
|
|
53
|
+
Object.defineProperty(exports, "decode", {
|
|
54
|
+
enumerable: true,
|
|
55
|
+
get: () => routerCore.decode
|
|
56
|
+
});
|
|
57
|
+
Object.defineProperty(exports, "deepEqual", {
|
|
58
|
+
enumerable: true,
|
|
59
|
+
get: () => routerCore.deepEqual
|
|
60
|
+
});
|
|
61
|
+
Object.defineProperty(exports, "defaultParseSearch", {
|
|
62
|
+
enumerable: true,
|
|
63
|
+
get: () => routerCore.defaultParseSearch
|
|
64
|
+
});
|
|
65
|
+
Object.defineProperty(exports, "defaultSerializeError", {
|
|
66
|
+
enumerable: true,
|
|
67
|
+
get: () => routerCore.defaultSerializeError
|
|
68
|
+
});
|
|
69
|
+
Object.defineProperty(exports, "defaultStringifySearch", {
|
|
70
|
+
enumerable: true,
|
|
71
|
+
get: () => routerCore.defaultStringifySearch
|
|
72
|
+
});
|
|
73
|
+
Object.defineProperty(exports, "defer", {
|
|
74
|
+
enumerable: true,
|
|
75
|
+
get: () => routerCore.defer
|
|
76
|
+
});
|
|
77
|
+
Object.defineProperty(exports, "encode", {
|
|
78
|
+
enumerable: true,
|
|
79
|
+
get: () => routerCore.encode
|
|
80
|
+
});
|
|
81
|
+
Object.defineProperty(exports, "escapeJSON", {
|
|
82
|
+
enumerable: true,
|
|
83
|
+
get: () => routerCore.escapeJSON
|
|
84
|
+
});
|
|
85
|
+
Object.defineProperty(exports, "functionalUpdate", {
|
|
86
|
+
enumerable: true,
|
|
87
|
+
get: () => routerCore.functionalUpdate
|
|
88
|
+
});
|
|
89
|
+
Object.defineProperty(exports, "interpolatePath", {
|
|
90
|
+
enumerable: true,
|
|
91
|
+
get: () => routerCore.interpolatePath
|
|
92
|
+
});
|
|
93
|
+
Object.defineProperty(exports, "isMatch", {
|
|
94
|
+
enumerable: true,
|
|
95
|
+
get: () => routerCore.isMatch
|
|
96
|
+
});
|
|
97
|
+
Object.defineProperty(exports, "isPlainArray", {
|
|
98
|
+
enumerable: true,
|
|
99
|
+
get: () => routerCore.isPlainArray
|
|
100
|
+
});
|
|
101
|
+
Object.defineProperty(exports, "isPlainObject", {
|
|
102
|
+
enumerable: true,
|
|
103
|
+
get: () => routerCore.isPlainObject
|
|
104
|
+
});
|
|
105
|
+
Object.defineProperty(exports, "joinPaths", {
|
|
106
|
+
enumerable: true,
|
|
107
|
+
get: () => routerCore.joinPaths
|
|
108
|
+
});
|
|
109
|
+
Object.defineProperty(exports, "matchByPath", {
|
|
110
|
+
enumerable: true,
|
|
111
|
+
get: () => routerCore.matchByPath
|
|
112
|
+
});
|
|
113
|
+
Object.defineProperty(exports, "matchPathname", {
|
|
114
|
+
enumerable: true,
|
|
115
|
+
get: () => routerCore.matchPathname
|
|
116
|
+
});
|
|
117
|
+
Object.defineProperty(exports, "parsePathname", {
|
|
118
|
+
enumerable: true,
|
|
119
|
+
get: () => routerCore.parsePathname
|
|
120
|
+
});
|
|
121
|
+
Object.defineProperty(exports, "parseSearchWith", {
|
|
122
|
+
enumerable: true,
|
|
123
|
+
get: () => routerCore.parseSearchWith
|
|
124
|
+
});
|
|
125
|
+
Object.defineProperty(exports, "pick", {
|
|
126
|
+
enumerable: true,
|
|
127
|
+
get: () => routerCore.pick
|
|
128
|
+
});
|
|
129
|
+
Object.defineProperty(exports, "removeBasepath", {
|
|
130
|
+
enumerable: true,
|
|
131
|
+
get: () => routerCore.removeBasepath
|
|
132
|
+
});
|
|
133
|
+
Object.defineProperty(exports, "replaceEqualDeep", {
|
|
134
|
+
enumerable: true,
|
|
135
|
+
get: () => routerCore.replaceEqualDeep
|
|
136
|
+
});
|
|
137
|
+
Object.defineProperty(exports, "resolvePath", {
|
|
138
|
+
enumerable: true,
|
|
139
|
+
get: () => routerCore.resolvePath
|
|
140
|
+
});
|
|
141
|
+
Object.defineProperty(exports, "retainSearchParams", {
|
|
142
|
+
enumerable: true,
|
|
143
|
+
get: () => routerCore.retainSearchParams
|
|
144
|
+
});
|
|
145
|
+
Object.defineProperty(exports, "rootRouteId", {
|
|
146
|
+
enumerable: true,
|
|
147
|
+
get: () => routerCore.rootRouteId
|
|
148
|
+
});
|
|
149
|
+
Object.defineProperty(exports, "shallow", {
|
|
150
|
+
enumerable: true,
|
|
151
|
+
get: () => routerCore.shallow
|
|
152
|
+
});
|
|
153
|
+
Object.defineProperty(exports, "stringifySearchWith", {
|
|
154
|
+
enumerable: true,
|
|
155
|
+
get: () => routerCore.stringifySearchWith
|
|
156
|
+
});
|
|
157
|
+
Object.defineProperty(exports, "stripSearchParams", {
|
|
158
|
+
enumerable: true,
|
|
159
|
+
get: () => routerCore.stripSearchParams
|
|
160
|
+
});
|
|
161
|
+
Object.defineProperty(exports, "trimPath", {
|
|
162
|
+
enumerable: true,
|
|
163
|
+
get: () => routerCore.trimPath
|
|
164
|
+
});
|
|
165
|
+
Object.defineProperty(exports, "trimPathLeft", {
|
|
166
|
+
enumerable: true,
|
|
167
|
+
get: () => routerCore.trimPathLeft
|
|
168
|
+
});
|
|
169
|
+
Object.defineProperty(exports, "trimPathRight", {
|
|
170
|
+
enumerable: true,
|
|
171
|
+
get: () => routerCore.trimPathRight
|
|
172
|
+
});
|
|
173
|
+
Object.defineProperty(exports, "createBrowserHistory", {
|
|
174
|
+
enumerable: true,
|
|
175
|
+
get: () => history.createBrowserHistory
|
|
176
|
+
});
|
|
177
|
+
Object.defineProperty(exports, "createHashHistory", {
|
|
178
|
+
enumerable: true,
|
|
179
|
+
get: () => history.createHashHistory
|
|
180
|
+
});
|
|
181
|
+
Object.defineProperty(exports, "createHistory", {
|
|
182
|
+
enumerable: true,
|
|
183
|
+
get: () => history.createHistory
|
|
184
|
+
});
|
|
185
|
+
Object.defineProperty(exports, "createMemoryHistory", {
|
|
186
|
+
enumerable: true,
|
|
187
|
+
get: () => history.createMemoryHistory
|
|
188
|
+
});
|
|
189
|
+
exports.Await = awaited.Await;
|
|
190
|
+
exports.useAwaited = awaited.useAwaited;
|
|
191
|
+
exports.CatchBoundary = CatchBoundary.CatchBoundary;
|
|
192
|
+
exports.ErrorComponent = CatchBoundary.ErrorComponent;
|
|
193
|
+
exports.FileRoute = fileRoute.FileRoute;
|
|
194
|
+
exports.FileRouteLoader = fileRoute.FileRouteLoader;
|
|
195
|
+
exports.LazyRoute = fileRoute.LazyRoute;
|
|
196
|
+
exports.createFileRoute = fileRoute.createFileRoute;
|
|
197
|
+
exports.createLazyFileRoute = fileRoute.createLazyFileRoute;
|
|
198
|
+
exports.createLazyRoute = fileRoute.createLazyRoute;
|
|
199
|
+
exports.lazyRouteComponent = lazyRouteComponent.lazyRouteComponent;
|
|
200
|
+
exports.Link = link.Link;
|
|
201
|
+
exports.createLink = link.createLink;
|
|
202
|
+
exports.linkOptions = link.linkOptions;
|
|
203
|
+
exports.useLinkProps = link.useLinkProps;
|
|
204
|
+
exports.MatchRoute = Matches.MatchRoute;
|
|
205
|
+
exports.Matches = Matches.Matches;
|
|
206
|
+
exports.useChildMatches = Matches.useChildMatches;
|
|
207
|
+
exports.useMatchRoute = Matches.useMatchRoute;
|
|
208
|
+
exports.useMatches = Matches.useMatches;
|
|
209
|
+
exports.useParentMatches = Matches.useParentMatches;
|
|
210
|
+
exports.matchContext = matchContext.matchContext;
|
|
211
|
+
exports.Match = Match.Match;
|
|
212
|
+
exports.Outlet = Match.Outlet;
|
|
213
|
+
exports.useMatch = useMatch.useMatch;
|
|
214
|
+
exports.useLoaderDeps = useLoaderDeps.useLoaderDeps;
|
|
215
|
+
exports.useLoaderData = useLoaderData.useLoaderData;
|
|
216
|
+
exports.isRedirect = redirects.isRedirect;
|
|
217
|
+
exports.redirect = redirects.redirect;
|
|
218
|
+
exports.NotFoundRoute = route.NotFoundRoute;
|
|
219
|
+
exports.RootRoute = route.RootRoute;
|
|
220
|
+
exports.Route = route.Route;
|
|
221
|
+
exports.RouteApi = route.RouteApi;
|
|
222
|
+
exports.createRootRoute = route.createRootRoute;
|
|
223
|
+
exports.createRootRouteWithContext = route.createRootRouteWithContext;
|
|
224
|
+
exports.createRoute = route.createRoute;
|
|
225
|
+
exports.createRouteMask = route.createRouteMask;
|
|
226
|
+
exports.getRouteApi = route.getRouteApi;
|
|
227
|
+
exports.rootRouteWithContext = route.rootRouteWithContext;
|
|
228
|
+
exports.PathParamError = router.PathParamError;
|
|
229
|
+
exports.Router = router.Router;
|
|
230
|
+
exports.SearchParamError = router.SearchParamError;
|
|
231
|
+
exports.componentTypes = router.componentTypes;
|
|
232
|
+
exports.createRouter = router.createRouter;
|
|
233
|
+
exports.getInitialRouterState = router.getInitialRouterState;
|
|
234
|
+
exports.lazyFn = router.lazyFn;
|
|
235
|
+
exports.RouterContextProvider = RouterProvider.RouterContextProvider;
|
|
236
|
+
exports.RouterProvider = RouterProvider.RouterProvider;
|
|
237
|
+
exports.ScrollRestoration = ScrollRestoration.ScrollRestoration;
|
|
238
|
+
exports.useElementScrollRestoration = ScrollRestoration.useElementScrollRestoration;
|
|
239
|
+
exports.Block = useBlocker.Block;
|
|
240
|
+
exports.useBlocker = useBlocker.useBlocker;
|
|
241
|
+
exports.Navigate = useNavigate.Navigate;
|
|
242
|
+
exports.useNavigate = useNavigate.useNavigate;
|
|
243
|
+
exports.useParams = useParams.useParams;
|
|
244
|
+
exports.useSearch = useSearch.useSearch;
|
|
245
|
+
exports.getRouterContext = routerContext.getRouterContext;
|
|
246
|
+
exports.useRouteContext = useRouteContext.useRouteContext;
|
|
247
|
+
exports.useRouter = useRouter.useRouter;
|
|
248
|
+
exports.useRouterState = useRouterState.useRouterState;
|
|
249
|
+
exports.useLocation = useLocation.useLocation;
|
|
250
|
+
exports.useCanGoBack = useCanGoBack.useCanGoBack;
|
|
251
|
+
exports.useLayoutEffect = utils.useLayoutEffect;
|
|
252
|
+
exports.CatchNotFound = notFound.CatchNotFound;
|
|
253
|
+
exports.DefaultGlobalNotFound = notFound.DefaultGlobalNotFound;
|
|
254
|
+
exports.isNotFound = notFound.isNotFound;
|
|
255
|
+
exports.notFound = notFound.notFound;
|
|
256
|
+
exports.ScriptOnce = ScriptOnce.ScriptOnce;
|
|
257
|
+
exports.Asset = Asset.Asset;
|
|
258
|
+
exports.HeadContent = HeadContent.HeadContent;
|
|
259
|
+
exports.Scripts = Scripts.Scripts;
|
|
260
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export { default as invariant } from 'tiny-invariant';
|
|
2
|
+
export { default as warning } from 'tiny-warning';
|
|
3
|
+
export { defer, TSR_DEFERRED_PROMISE, isMatch, joinPaths, cleanPath, trimPathLeft, trimPathRight, trimPath, resolvePath, parsePathname, interpolatePath, matchPathname, removeBasepath, matchByPath, encode, decode, rootRouteId, defaultSerializeError, defaultParseSearch, defaultStringifySearch, parseSearchWith, stringifySearchWith, escapeJSON, // SSR
|
|
4
|
+
pick, functionalUpdate, replaceEqualDeep, isPlainObject, isPlainArray, deepEqual, shallow, createControlledPromise, retainSearchParams, stripSearchParams, } from '@tanstack/router-core';
|
|
5
|
+
export type { StartSerializer, Serializable, SerializerParse, SerializerParseBy, SerializerStringify, SerializerStringifyBy, DeferredPromiseState, DeferredPromise, ParsedLocation, ParsePathParams, RemoveTrailingSlashes, RemoveLeadingSlashes, ActiveOptions, Segment, ResolveRelativePath, RootRouteId, AnyPathParams, ResolveParams, SearchSchemaInput, AnyContext, RouteContext, PreloadableObj, RoutePathOptions, StaticDataRouteOption, RoutePathOptionsIntersection, UpdatableStaticRouteOption, MetaDescriptor, RouteLinkEntry, ParseParamsFn, SearchFilter, ResolveId, InferFullSearchSchema, InferFullSearchSchemaInput, ErrorRouteProps, ErrorComponentProps, NotFoundRouteProps, TrimPath, TrimPathLeft, TrimPathRight, ParseSplatParams, SplatParams, StringifyParamsFn, ParamsOptions, InferAllParams, InferAllContext, LooseReturnType, LooseAsyncReturnType, ContextReturnType, ContextAsyncReturnType, ResolveLoaderData, ResolveRouteContext, SearchSerializer, SearchParser, TrailingSlashOption, ExtractedEntry, ExtractedStream, ExtractedPromise, StreamState, Manifest, RouterManagedTag, ControlledPromise, Constrain, Expand, MergeAll, Assign, IntersectAssign, ResolveValidatorInput, ResolveValidatorOutput, AnyValidator, DefaultValidator, ValidatorFn, AnySchema, AnyValidatorAdapter, AnyValidatorFn, AnyValidatorObj, ResolveValidatorInputFn, ResolveValidatorOutputFn, ResolveSearchValidatorInput, ResolveSearchValidatorInputFn, Validator, ValidatorAdapter, ValidatorObj, } from '@tanstack/router-core';
|
|
6
|
+
export { createHistory, createBrowserHistory, createHashHistory, createMemoryHistory, } from '@tanstack/history';
|
|
7
|
+
export type { BlockerFn, HistoryLocation, RouterHistory, ParsedPath, HistoryState, } from '@tanstack/history';
|
|
8
|
+
export { useAwaited, Await } from './awaited.cjs';
|
|
9
|
+
export type { AwaitOptions } from './awaited.cjs';
|
|
10
|
+
export { CatchBoundary, ErrorComponent } from './CatchBoundary.cjs';
|
|
11
|
+
export { FileRoute, createFileRoute, FileRouteLoader, LazyRoute, createLazyRoute, createLazyFileRoute, } from './fileRoute.cjs';
|
|
12
|
+
export type { FileRoutesByPath, FileRouteTypes, LazyRouteOptions, } from './fileRoute.cjs';
|
|
13
|
+
export * from './history.cjs';
|
|
14
|
+
export { lazyRouteComponent } from './lazyRouteComponent.cjs';
|
|
15
|
+
export { useLinkProps, createLink, Link, linkOptions } from './link.cjs';
|
|
16
|
+
export type { InferDescendantToPaths, RelativeToPath, RelativeToParentPath, RelativeToCurrentPath, AbsoluteToPath, RelativeToPathAutoComplete, NavigateOptions, ToOptions, ToMaskOptions, ToSubOptions, ResolveRoute, SearchParamOptions, PathParamOptions, ToPathOption, LinkOptions, UseLinkPropsOptions, ActiveLinkOptions, LinkProps, LinkComponent, LinkComponentProps, CreateLinkProps, MakeOptionalPathParams, } from './link.cjs';
|
|
17
|
+
export { Matches, useMatchRoute, MatchRoute, useMatches, useParentMatches, useChildMatches, } from './Matches.cjs';
|
|
18
|
+
export type { RouteMatch, AnyRouteMatch, MatchRouteOptions, UseMatchRouteOptions, MakeMatchRouteOptions, MakeRouteMatch, MakeRouteMatchUnion, } from './Matches.cjs';
|
|
19
|
+
export { matchContext } from './matchContext.cjs';
|
|
20
|
+
export { Match, Outlet } from './Match.cjs';
|
|
21
|
+
export { useMatch } from './useMatch.cjs';
|
|
22
|
+
export { useLoaderDeps } from './useLoaderDeps.cjs';
|
|
23
|
+
export { useLoaderData } from './useLoaderData.cjs';
|
|
24
|
+
export { redirect, isRedirect } from './redirects.cjs';
|
|
25
|
+
export type { AnyRedirect, Redirect, ResolvedRedirect } from './redirects.cjs';
|
|
26
|
+
export { RouteApi, getRouteApi, Route, createRoute, RootRoute, rootRouteWithContext, createRootRoute, createRootRouteWithContext, createRouteMask, NotFoundRoute, } from './route.cjs';
|
|
27
|
+
export type { RouteOptions, FileBaseRouteOptions, BaseRouteOptions, UpdatableRouteOptions, RouteLoaderFn, LoaderFnContext, ResolveFullSearchSchema, ResolveFullSearchSchemaInput, AnyRoute, RouteConstraints, AnyRootRoute, ResolveFullPath, RouteMask, SolidNode, SyncRouteComponent, AsyncRouteComponent, RouteComponent, ErrorRouteComponent, NotFoundRouteComponent, RootRouteOptions, AnyRouteWithContext, FullSearchSchemaOption, RouteContextFn, RouteContextOptions, BeforeLoadFn, BeforeLoadContextOptions, ContextOptions, RouteContextParameter, BeforeLoadContextParameter, ResolveAllContext, ResolveAllParamsFromParent, MakeRemountDepsOptionsUnion, RemountDepsOptions, } from './route.cjs';
|
|
28
|
+
export type { ParseRoute, RoutesById, RouteById, RouteIds, RoutesByPath, RouteByPath, RoutePaths, FullSearchSchema, AllParams, AllLoaderData, FullSearchSchemaInput, AllContext, } from './routeInfo.cjs';
|
|
29
|
+
export { componentTypes, createRouter, Router, lazyFn, SearchParamError, PathParamError, getInitialRouterState, } from './router.cjs';
|
|
30
|
+
export type { Register, AnyRouter, RegisteredRouter, RouterContextOptions, RouterOptions, RouterErrorSerializer, RouterState, ListenerFn, BuildNextOptions, RouterConstructorOptions, RouterEvents, RouterEvent, RouterListener, AnyRouterWithContext, ControllablePromise, InjectedHtmlEntry, } from './router.cjs';
|
|
31
|
+
export { RouterProvider, RouterContextProvider } from './RouterProvider.cjs';
|
|
32
|
+
export type { RouterProps, CommitLocationOptions, MatchLocation, NavigateFn, BuildLocationFn, } from './RouterProvider.cjs';
|
|
33
|
+
export { useElementScrollRestoration, ScrollRestoration, } from './ScrollRestoration.cjs';
|
|
34
|
+
export type { UseBlockerOpts, ShouldBlockFn } from './useBlocker.cjs';
|
|
35
|
+
export { useBlocker, Block } from './useBlocker.cjs';
|
|
36
|
+
export { useNavigate, Navigate } from './useNavigate.cjs';
|
|
37
|
+
export type { UseNavigateResult } from './useNavigate.cjs';
|
|
38
|
+
export { useParams } from './useParams.cjs';
|
|
39
|
+
export { useSearch } from './useSearch.cjs';
|
|
40
|
+
export { getRouterContext, } from './routerContext.cjs';
|
|
41
|
+
export { useRouteContext } from './useRouteContext.cjs';
|
|
42
|
+
export { useRouter } from './useRouter.cjs';
|
|
43
|
+
export { useRouterState } from './useRouterState.cjs';
|
|
44
|
+
export { useLocation } from './useLocation.cjs';
|
|
45
|
+
export { useCanGoBack } from './useCanGoBack.cjs';
|
|
46
|
+
export { useLayoutEffect } from './utils.cjs';
|
|
47
|
+
export { notFound, isNotFound, CatchNotFound, DefaultGlobalNotFound, } from './not-found.cjs';
|
|
48
|
+
export type { NotFoundError } from './not-found.cjs';
|
|
49
|
+
export * from './typePrimitives.cjs';
|
|
50
|
+
export { ScriptOnce } from './ScriptOnce.cjs';
|
|
51
|
+
export { Asset } from './Asset.cjs';
|
|
52
|
+
export { HeadContent } from './HeadContent.cjs';
|
|
53
|
+
export { Scripts } from './Scripts.cjs';
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const web = require("solid-js/web");
|
|
4
|
+
const Match = require("./Match.cjs");
|
|
5
|
+
function isModuleNotFoundError(error) {
|
|
6
|
+
return typeof (error == null ? void 0 : error.message) === "string" && /Failed to fetch dynamically imported module/.test(error.message);
|
|
7
|
+
}
|
|
8
|
+
function ClientOnly(props) {
|
|
9
|
+
return useHydrated() ? web.memo(() => props.children) : web.memo(() => props.fallback);
|
|
10
|
+
}
|
|
11
|
+
function useHydrated() {
|
|
12
|
+
return web.isServer;
|
|
13
|
+
}
|
|
14
|
+
function lazyRouteComponent(importer, exportName, ssr) {
|
|
15
|
+
let loadPromise;
|
|
16
|
+
let comp;
|
|
17
|
+
let error;
|
|
18
|
+
const load = () => {
|
|
19
|
+
if (typeof document === "undefined" && (ssr == null ? void 0 : ssr()) === false) {
|
|
20
|
+
comp = () => null;
|
|
21
|
+
return Promise.resolve();
|
|
22
|
+
}
|
|
23
|
+
if (!loadPromise) {
|
|
24
|
+
loadPromise = importer().then((res) => {
|
|
25
|
+
loadPromise = void 0;
|
|
26
|
+
comp = res[exportName ?? "default"];
|
|
27
|
+
}).catch((err) => {
|
|
28
|
+
error = err;
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
return loadPromise;
|
|
32
|
+
};
|
|
33
|
+
const lazyComp = function Lazy(props) {
|
|
34
|
+
if (error) {
|
|
35
|
+
if (isModuleNotFoundError(error)) {
|
|
36
|
+
if (error instanceof Error && typeof window !== "undefined" && typeof sessionStorage !== "undefined") {
|
|
37
|
+
const storageKey = `tanstack_router_reload:${error.message}`;
|
|
38
|
+
if (!sessionStorage.getItem(storageKey)) {
|
|
39
|
+
sessionStorage.setItem(storageKey, "1");
|
|
40
|
+
window.location.reload();
|
|
41
|
+
return {
|
|
42
|
+
default: () => null
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
throw error;
|
|
48
|
+
}
|
|
49
|
+
if (!comp) {
|
|
50
|
+
throw load();
|
|
51
|
+
}
|
|
52
|
+
if ((ssr == null ? void 0 : ssr()) === false) {
|
|
53
|
+
return web.createComponent(ClientOnly, {
|
|
54
|
+
get fallback() {
|
|
55
|
+
return web.createComponent(Match.Outlet, {});
|
|
56
|
+
},
|
|
57
|
+
get children() {
|
|
58
|
+
return web.createComponent(web.Dynamic, web.mergeProps({
|
|
59
|
+
component: comp
|
|
60
|
+
}, props));
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
return web.createComponent(web.Dynamic, web.mergeProps({
|
|
65
|
+
component: comp
|
|
66
|
+
}, props));
|
|
67
|
+
};
|
|
68
|
+
lazyComp.preload = load;
|
|
69
|
+
return lazyComp;
|
|
70
|
+
}
|
|
71
|
+
exports.ClientOnly = ClientOnly;
|
|
72
|
+
exports.lazyRouteComponent = lazyRouteComponent;
|
|
73
|
+
exports.useHydrated = useHydrated;
|
|
74
|
+
//# sourceMappingURL=lazyRouteComponent.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lazyRouteComponent.cjs","sources":["../../src/lazyRouteComponent.tsx"],"sourcesContent":["import { Dynamic, isServer } from 'solid-js/web'\nimport { Outlet } from './Match'\nimport type * as Solid from 'solid-js'\nimport type { AsyncRouteComponent } from './route'\n\n// If the load fails due to module not found, it may mean a new version of\n// the build was deployed and the user's browser is still using an old version.\n// If this happens, the old version in the user's browser would have an outdated\n// URL to the lazy module.\n// In that case, we want to attempt one window refresh to get the latest.\nfunction isModuleNotFoundError(error: any): boolean {\n return (\n typeof error?.message === 'string' &&\n /Failed to fetch dynamically imported module/.test(error.message)\n )\n}\n\nexport function ClientOnly(\n props: Solid.ParentProps<{ fallback?: Solid.JSX.Element }>,\n) {\n return useHydrated() ? <>{props.children}</> : <>{props.fallback}</>\n}\n\nexport function useHydrated() {\n return isServer\n}\n\nexport function lazyRouteComponent<\n T extends Record<string, any>,\n TKey extends keyof T = 'default',\n>(\n importer: () => Promise<T>,\n exportName?: TKey,\n ssr?: () => boolean,\n): T[TKey] extends (props: infer TProps) => any\n ? AsyncRouteComponent<TProps>\n : never {\n let loadPromise: Promise<any> | undefined\n let comp: T[TKey] | T['default']\n let error: any\n\n const load = () => {\n if (typeof document === 'undefined' && ssr?.() === false) {\n comp = (() => null) as any\n return Promise.resolve()\n }\n if (!loadPromise) {\n loadPromise = importer()\n .then((res) => {\n loadPromise = undefined\n comp = res[exportName ?? 'default']\n })\n .catch((err) => {\n error = err\n })\n }\n\n return loadPromise\n }\n\n const lazyComp = function Lazy(props: any) {\n // Now that we're out of preload and into actual render path,\n // throw the error if it was a module not found error during preload\n if (error) {\n if (isModuleNotFoundError(error)) {\n // We don't want an error thrown from preload in this case, because\n // there's nothing we want to do about module not found during preload.\n // Record the error, recover the promise with a null return,\n // and we will attempt module not found resolution during the render path.\n\n if (\n error instanceof Error &&\n typeof window !== 'undefined' &&\n typeof sessionStorage !== 'undefined'\n ) {\n // Again, we want to reload one time on module not found error and not enter\n // a reload loop if there is some other issue besides an old deploy.\n // That's why we store our reload attempt in sessionStorage.\n // Use error.message as key because it contains the module path that failed.\n const storageKey = `tanstack_router_reload:${error.message}`\n if (!sessionStorage.getItem(storageKey)) {\n sessionStorage.setItem(storageKey, '1')\n window.location.reload()\n\n // Return empty component while we wait for window to reload\n return {\n default: () => null,\n }\n }\n }\n }\n\n // Otherwise, just throw the error\n throw error\n }\n\n if (!comp) {\n throw load()\n }\n\n if (ssr?.() === false) {\n return (\n <ClientOnly fallback={<Outlet />}>\n <Dynamic component={comp} {...props} />\n </ClientOnly>\n )\n }\n return <Dynamic component={comp} {...props} />\n }\n\n ;(lazyComp as any).preload = load\n\n return lazyComp as any\n}\n"],"names":["isModuleNotFoundError","error","message","test","ClientOnly","props","useHydrated","_$memo","children","fallback","isServer","lazyRouteComponent","importer","exportName","ssr","loadPromise","comp","load","document","Promise","resolve","then","res","undefined","catch","err","lazyComp","Lazy","Error","window","sessionStorage","storageKey","getItem","setItem","location","reload","default","_$createComponent","Outlet","Dynamic","_$mergeProps","component","preload"],"mappings":";;;;AAUA,SAASA,sBAAsBC,OAAqB;AAClD,SACE,QAAOA,+BAAOC,aAAY,YAC1B,8CAA8CC,KAAKF,MAAMC,OAAO;AAEpE;AAEO,SAASE,WACdC,OACA;AACOC,SAAAA,YAAAA,IAAaC,IAAAA,KAAMF,MAAAA,MAAMG,QAAQ,IAAAD,IAAAA,KAAA,MAAUF,MAAMI,QAAQ;AAClE;AAEO,SAASH,cAAc;AACrBI,SAAAA,IAAAA;AACT;AAEgBC,SAAAA,mBAIdC,UACAC,YACAC,KAGQ;AACJC,MAAAA;AACAC,MAAAA;AACAf,MAAAA;AAEJ,QAAMgB,OAAOA,MAAM;AACjB,QAAI,OAAOC,aAAa,gBAAeJ,kCAAY,OAAO;AACxDE,aAAQ,MAAM;AACd,aAAOG,QAAQC,QAAQ;AAAA,IAAA;AAEzB,QAAI,CAACL,aAAa;AACFH,oBAAAA,SAAAA,EACXS,KAAMC,CAAQ,QAAA;AACCC,sBAAAA;AACPD,eAAAA,IAAIT,cAAc,SAAS;AAAA,MAAA,CACnC,EACAW,MAAOC,CAAQ,QAAA;AACNA,gBAAAA;AAAAA,MAAAA,CACT;AAAA,IAAA;AAGEV,WAAAA;AAAAA,EACT;AAEMW,QAAAA,WAAW,SAASC,KAAKtB,OAAY;AAGzC,QAAIJ,OAAO;AACLD,UAAAA,sBAAsBC,KAAK,GAAG;AAMhC,YACEA,iBAAiB2B,SACjB,OAAOC,WAAW,eAClB,OAAOC,mBAAmB,aAC1B;AAKMC,gBAAAA,aAAa,0BAA0B9B,MAAMC,OAAO;AAC1D,cAAI,CAAC4B,eAAeE,QAAQD,UAAU,GAAG;AACxBE,2BAAAA,QAAQF,YAAY,GAAG;AACtCF,mBAAOK,SAASC,OAAO;AAGhB,mBAAA;AAAA,cACLC,SAASA,MAAM;AAAA,YACjB;AAAA,UAAA;AAAA,QACF;AAAA,MACF;AAIInC,YAAAA;AAAAA,IAAAA;AAGR,QAAI,CAACe,MAAM;AACT,YAAMC,KAAK;AAAA,IAAA;AAGTH,SAAAA,kCAAY,OAAO;AACrB,aAAAuB,IAAAA,gBACGjC,YAAU;AAAA,QAAA,IAACK,WAAQ;AAAA4B,iBAAAA,IAAAA,gBAAGC,MAAM,QAAA,EAAA;AAAA,QAAA;AAAA,QAAA,IAAA9B,WAAA;AAAA6B,iBAAAA,IAAAA,gBAC1BE,aAAOC,eAAA;AAAA,YAACC,WAAWzB;AAAAA,UAAI,GAAMX,KAAK,CAAA;AAAA,QAAA;AAAA,MAAA,CAAA;AAAA,IAAA;AAIzCgC,WAAAA,IAAAA,gBAAQE,aAAOC,eAAA;AAAA,MAACC,WAAWzB;AAAAA,IAAI,GAAMX,KAAK,CAAA;AAAA,EAC5C;AAEEqB,WAAiBgB,UAAUzB;AAEtBS,SAAAA;AACT;;;;"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AsyncRouteComponent } from './route.cjs';
|
|
2
|
+
import type * as Solid from 'solid-js';
|
|
3
|
+
export declare function ClientOnly(props: Solid.ParentProps<{
|
|
4
|
+
fallback?: Solid.JSX.Element;
|
|
5
|
+
}>): Solid.JSX.Element;
|
|
6
|
+
export declare function useHydrated(): boolean;
|
|
7
|
+
export declare function lazyRouteComponent<T extends Record<string, any>, TKey extends keyof T = 'default'>(importer: () => Promise<T>, exportName?: TKey, ssr?: () => boolean): T[TKey] extends (props: infer TProps) => any ? AsyncRouteComponent<TProps> : never;
|