@tanstack/solid-router 1.167.1 → 1.167.2
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/Asset.cjs +84 -127
- package/dist/cjs/Asset.cjs.map +1 -1
- package/dist/cjs/CatchBoundary.cjs +50 -68
- package/dist/cjs/CatchBoundary.cjs.map +1 -1
- package/dist/cjs/ClientOnly.cjs +61 -39
- package/dist/cjs/ClientOnly.cjs.map +1 -1
- package/dist/cjs/HeadContent.cjs +25 -19
- package/dist/cjs/HeadContent.cjs.map +1 -1
- package/dist/cjs/HeadContent.dev.cjs +38 -33
- package/dist/cjs/HeadContent.dev.cjs.map +1 -1
- package/dist/cjs/Match.cjs +330 -398
- package/dist/cjs/Match.cjs.map +1 -1
- package/dist/cjs/Matches.cjs +109 -151
- package/dist/cjs/Matches.cjs.map +1 -1
- package/dist/cjs/RouterProvider.cjs +28 -40
- package/dist/cjs/RouterProvider.cjs.map +1 -1
- package/dist/cjs/SafeFragment.cjs +7 -5
- package/dist/cjs/SafeFragment.cjs.map +1 -1
- package/dist/cjs/ScriptOnce.cjs +18 -20
- package/dist/cjs/ScriptOnce.cjs.map +1 -1
- package/dist/cjs/Scripts.cjs +41 -54
- package/dist/cjs/Scripts.cjs.map +1 -1
- package/dist/cjs/ScrollRestoration.cjs +26 -28
- package/dist/cjs/ScrollRestoration.cjs.map +1 -1
- package/dist/cjs/Transitioner.cjs +94 -129
- package/dist/cjs/Transitioner.cjs.map +1 -1
- package/dist/cjs/_virtual/_rolldown/runtime.cjs +23 -0
- package/dist/cjs/awaited.cjs +24 -51
- package/dist/cjs/awaited.cjs.map +1 -1
- package/dist/cjs/fileRoute.cjs +96 -91
- package/dist/cjs/fileRoute.cjs.map +1 -1
- package/dist/cjs/headContentUtils.cjs +132 -170
- package/dist/cjs/headContentUtils.cjs.map +1 -1
- package/dist/cjs/index.cjs +245 -176
- package/dist/cjs/index.dev.cjs +245 -176
- package/dist/cjs/lazyRouteComponent.cjs +48 -54
- package/dist/cjs/lazyRouteComponent.cjs.map +1 -1
- package/dist/cjs/link.cjs +304 -331
- package/dist/cjs/link.cjs.map +1 -1
- package/dist/cjs/matchContext.cjs +9 -23
- package/dist/cjs/matchContext.cjs.map +1 -1
- package/dist/cjs/not-found.cjs +26 -34
- package/dist/cjs/not-found.cjs.map +1 -1
- package/dist/cjs/renderRouteNotFound.cjs +23 -16
- package/dist/cjs/renderRouteNotFound.cjs.map +1 -1
- package/dist/cjs/route.cjs +200 -215
- package/dist/cjs/route.cjs.map +1 -1
- package/dist/cjs/router.cjs +18 -16
- package/dist/cjs/router.cjs.map +1 -1
- package/dist/cjs/routerContext.cjs +8 -22
- package/dist/cjs/routerContext.cjs.map +1 -1
- package/dist/cjs/scroll-restoration.cjs +25 -35
- package/dist/cjs/scroll-restoration.cjs.map +1 -1
- package/dist/cjs/ssr/RouterClient.cjs +31 -42
- package/dist/cjs/ssr/RouterClient.cjs.map +1 -1
- package/dist/cjs/ssr/RouterServer.cjs +44 -51
- package/dist/cjs/ssr/RouterServer.cjs.map +1 -1
- package/dist/cjs/ssr/client.cjs +2 -4
- package/dist/cjs/ssr/defaultRenderHandler.cjs +12 -16
- package/dist/cjs/ssr/defaultRenderHandler.cjs.map +1 -1
- package/dist/cjs/ssr/defaultStreamHandler.cjs +13 -18
- package/dist/cjs/ssr/defaultStreamHandler.cjs.map +1 -1
- package/dist/cjs/ssr/renderRouterToStream.cjs +27 -55
- package/dist/cjs/ssr/renderRouterToStream.cjs.map +1 -1
- package/dist/cjs/ssr/renderRouterToString.cjs +33 -57
- package/dist/cjs/ssr/renderRouterToString.cjs.map +1 -1
- package/dist/cjs/ssr/server.cjs +18 -18
- package/dist/cjs/useBlocker.cjs +138 -173
- package/dist/cjs/useBlocker.cjs.map +1 -1
- package/dist/cjs/useBlocker.d.cts +8 -5
- package/dist/cjs/useCanGoBack.cjs +6 -5
- package/dist/cjs/useCanGoBack.cjs.map +1 -1
- package/dist/cjs/useLoaderData.cjs +12 -11
- package/dist/cjs/useLoaderData.cjs.map +1 -1
- package/dist/cjs/useLoaderDeps.cjs +12 -14
- package/dist/cjs/useLoaderDeps.cjs.map +1 -1
- package/dist/cjs/useLocation.cjs +6 -7
- package/dist/cjs/useLocation.cjs.map +1 -1
- package/dist/cjs/useMatch.cjs +27 -49
- package/dist/cjs/useMatch.cjs.map +1 -1
- package/dist/cjs/useNavigate.cjs +20 -38
- package/dist/cjs/useNavigate.cjs.map +1 -1
- package/dist/cjs/useParams.cjs +14 -13
- package/dist/cjs/useParams.cjs.map +1 -1
- package/dist/cjs/useRouteContext.cjs +9 -8
- package/dist/cjs/useRouteContext.cjs.map +1 -1
- package/dist/cjs/useRouter.cjs +13 -26
- package/dist/cjs/useRouter.cjs.map +1 -1
- package/dist/cjs/useRouterState.cjs +29 -37
- package/dist/cjs/useRouterState.cjs.map +1 -1
- package/dist/cjs/useSearch.cjs +13 -12
- package/dist/cjs/useSearch.cjs.map +1 -1
- package/dist/cjs/utils.cjs +58 -51
- package/dist/cjs/utils.cjs.map +1 -1
- package/dist/esm/Asset.js +82 -126
- package/dist/esm/Asset.js.map +1 -1
- package/dist/esm/CatchBoundary.js +46 -50
- package/dist/esm/CatchBoundary.js.map +1 -1
- package/dist/esm/ClientOnly.js +58 -22
- package/dist/esm/ClientOnly.js.map +1 -1
- package/dist/esm/HeadContent.dev.js +36 -32
- package/dist/esm/HeadContent.dev.js.map +1 -1
- package/dist/esm/HeadContent.js +23 -18
- package/dist/esm/HeadContent.js.map +1 -1
- package/dist/esm/Match.js +322 -378
- package/dist/esm/Match.js.map +1 -1
- package/dist/esm/Matches.js +102 -135
- package/dist/esm/Matches.js.map +1 -1
- package/dist/esm/RouterProvider.js +25 -39
- package/dist/esm/RouterProvider.js.map +1 -1
- package/dist/esm/SafeFragment.js +6 -5
- package/dist/esm/SafeFragment.js.map +1 -1
- package/dist/esm/ScriptOnce.js +16 -19
- package/dist/esm/ScriptOnce.js.map +1 -1
- package/dist/esm/Scripts.js +40 -54
- package/dist/esm/Scripts.js.map +1 -1
- package/dist/esm/ScrollRestoration.js +25 -29
- package/dist/esm/ScrollRestoration.js.map +1 -1
- package/dist/esm/Transitioner.js +90 -110
- package/dist/esm/Transitioner.js.map +1 -1
- package/dist/esm/awaited.js +21 -34
- package/dist/esm/awaited.js.map +1 -1
- package/dist/esm/fileRoute.js +90 -92
- package/dist/esm/fileRoute.js.map +1 -1
- package/dist/esm/headContentUtils.js +129 -152
- package/dist/esm/headContentUtils.js.map +1 -1
- package/dist/esm/index.dev.js +15 -115
- package/dist/esm/index.js +17 -116
- package/dist/esm/lazyRouteComponent.js +47 -54
- package/dist/esm/lazyRouteComponent.js.map +1 -1
- package/dist/esm/link.js +299 -314
- package/dist/esm/link.js.map +1 -1
- package/dist/esm/matchContext.js +7 -7
- package/dist/esm/matchContext.js.map +1 -1
- package/dist/esm/not-found.js +23 -33
- package/dist/esm/not-found.js.map +1 -1
- package/dist/esm/renderRouteNotFound.js +20 -15
- package/dist/esm/renderRouteNotFound.js.map +1 -1
- package/dist/esm/route.js +193 -218
- package/dist/esm/route.js.map +1 -1
- package/dist/esm/router.js +17 -17
- package/dist/esm/router.js.map +1 -1
- package/dist/esm/routerContext.js +6 -5
- package/dist/esm/routerContext.js.map +1 -1
- package/dist/esm/scroll-restoration.js +23 -34
- package/dist/esm/scroll-restoration.js.map +1 -1
- package/dist/esm/ssr/RouterClient.js +29 -41
- package/dist/esm/ssr/RouterClient.js.map +1 -1
- package/dist/esm/ssr/RouterServer.js +40 -48
- package/dist/esm/ssr/RouterServer.js.map +1 -1
- package/dist/esm/ssr/client.js +1 -4
- package/dist/esm/ssr/defaultRenderHandler.js +11 -15
- package/dist/esm/ssr/defaultRenderHandler.js.map +1 -1
- package/dist/esm/ssr/defaultStreamHandler.js +12 -17
- package/dist/esm/ssr/defaultStreamHandler.js.map +1 -1
- package/dist/esm/ssr/renderRouterToStream.js +24 -37
- package/dist/esm/ssr/renderRouterToStream.js.map +1 -1
- package/dist/esm/ssr/renderRouterToString.js +31 -40
- package/dist/esm/ssr/renderRouterToString.js.map +1 -1
- package/dist/esm/ssr/server.js +3 -10
- package/dist/esm/useBlocker.d.ts +8 -5
- package/dist/esm/useBlocker.js +134 -155
- package/dist/esm/useBlocker.js.map +1 -1
- package/dist/esm/useCanGoBack.js +6 -5
- package/dist/esm/useCanGoBack.js.map +1 -1
- package/dist/esm/useLoaderData.js +12 -11
- package/dist/esm/useLoaderData.js.map +1 -1
- package/dist/esm/useLoaderDeps.js +12 -14
- package/dist/esm/useLoaderDeps.js.map +1 -1
- package/dist/esm/useLocation.js +6 -7
- package/dist/esm/useLocation.js.map +1 -1
- package/dist/esm/useMatch.js +23 -31
- package/dist/esm/useMatch.js.map +1 -1
- package/dist/esm/useNavigate.js +18 -22
- package/dist/esm/useNavigate.js.map +1 -1
- package/dist/esm/useParams.js +14 -13
- package/dist/esm/useParams.js.map +1 -1
- package/dist/esm/useRouteContext.js +9 -8
- package/dist/esm/useRouteContext.js.map +1 -1
- package/dist/esm/useRouter.js +9 -8
- package/dist/esm/useRouter.js.map +1 -1
- package/dist/esm/useRouterState.js +28 -37
- package/dist/esm/useRouterState.js.map +1 -1
- package/dist/esm/useSearch.js +13 -12
- package/dist/esm/useSearch.js.map +1 -1
- package/dist/esm/utils.js +56 -35
- package/dist/esm/utils.js.map +1 -1
- package/dist/source/useBlocker.d.ts +8 -5
- package/dist/source/useBlocker.jsx +2 -2
- package/dist/source/useBlocker.jsx.map +1 -1
- package/package.json +3 -3
- package/src/useBlocker.tsx +15 -10
- package/dist/cjs/index.cjs.map +0 -1
- package/dist/cjs/index.dev.cjs.map +0 -1
- package/dist/cjs/ssr/client.cjs.map +0 -1
- package/dist/cjs/ssr/server.cjs.map +0 -1
- package/dist/esm/index.dev.js.map +0 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/ssr/client.js.map +0 -1
- package/dist/esm/ssr/server.js.map +0 -1
package/dist/esm/index.dev.js
CHANGED
|
@@ -1,132 +1,32 @@
|
|
|
1
|
-
import { DEFAULT_PROTOCOL_ALLOWLIST, SearchParamError, cleanPath, composeRewrites, createControlledPromise, createSerializationAdapter, deepEqual, defaultParseSearch, defaultStringifySearch, defer, functionalUpdate, interpolatePath, isMatch, isNotFound, isPlainArray, isPlainObject, isRedirect, joinPaths, lazyFn, notFound, parseSearchWith, redirect, replaceEqualDeep, resolvePath, retainSearchParams, rootRouteId, stringifySearchWith, stripSearchParams, trimPath, trimPathLeft, trimPathRight } from "@tanstack/router-core";
|
|
2
|
-
import { createBrowserHistory, createHashHistory, createHistory, createMemoryHistory } from "@tanstack/history";
|
|
3
1
|
import { Await, useAwaited } from "./awaited.js";
|
|
4
2
|
import { CatchBoundary, ErrorComponent } from "./CatchBoundary.js";
|
|
5
3
|
import { ClientOnly, useHydrated } from "./ClientOnly.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
4
|
+
import { useRouter } from "./useRouter.js";
|
|
5
|
+
import { useRouterState } from "./useRouterState.js";
|
|
8
6
|
import { Link, createLink, linkOptions, useLinkProps } from "./link.js";
|
|
9
|
-
import { MatchRoute, Matches, useChildMatches, useMatchRoute, useMatches, useParentMatches } from "./Matches.js";
|
|
10
|
-
import { Match, Outlet } from "./Match.js";
|
|
11
7
|
import { useMatch } from "./useMatch.js";
|
|
12
|
-
import { useLoaderDeps } from "./useLoaderDeps.js";
|
|
13
8
|
import { useLoaderData } from "./useLoaderData.js";
|
|
9
|
+
import { useLoaderDeps } from "./useLoaderDeps.js";
|
|
10
|
+
import { useParams } from "./useParams.js";
|
|
11
|
+
import { useSearch } from "./useSearch.js";
|
|
12
|
+
import { Navigate, useNavigate } from "./useNavigate.js";
|
|
13
|
+
import { useRouteContext } from "./useRouteContext.js";
|
|
14
14
|
import { NotFoundRoute, RootRoute, Route, RouteApi, createRootRoute, createRootRouteWithContext, createRoute, createRouteMask, getRouteApi, rootRouteWithContext } from "./route.js";
|
|
15
|
+
import { FileRoute, FileRouteLoader, LazyRoute, createFileRoute, createLazyFileRoute, createLazyRoute } from "./fileRoute.js";
|
|
16
|
+
import { lazyRouteComponent } from "./lazyRouteComponent.js";
|
|
17
|
+
import { CatchNotFound, DefaultGlobalNotFound } from "./not-found.js";
|
|
18
|
+
import { ScriptOnce } from "./ScriptOnce.js";
|
|
19
|
+
import { Match, Outlet } from "./Match.js";
|
|
20
|
+
import { MatchRoute, Matches, useChildMatches, useMatchRoute, useMatches, useParentMatches } from "./Matches.js";
|
|
15
21
|
import { Router, createRouter } from "./router.js";
|
|
16
22
|
import { RouterContextProvider, RouterProvider } from "./RouterProvider.js";
|
|
17
23
|
import { ScrollRestoration, useElementScrollRestoration } from "./ScrollRestoration.js";
|
|
18
24
|
import { Block, useBlocker } from "./useBlocker.js";
|
|
19
|
-
import { Navigate, useNavigate } from "./useNavigate.js";
|
|
20
|
-
import { useParams } from "./useParams.js";
|
|
21
|
-
import { useSearch } from "./useSearch.js";
|
|
22
|
-
import { useRouteContext } from "./useRouteContext.js";
|
|
23
|
-
import { useRouter } from "./useRouter.js";
|
|
24
|
-
import { useRouterState } from "./useRouterState.js";
|
|
25
25
|
import { useLocation } from "./useLocation.js";
|
|
26
26
|
import { useCanGoBack } from "./useCanGoBack.js";
|
|
27
|
-
import { CatchNotFound, DefaultGlobalNotFound } from "./not-found.js";
|
|
28
|
-
import { ScriptOnce } from "./ScriptOnce.js";
|
|
29
27
|
import { Asset } from "./Asset.js";
|
|
30
28
|
import { useTags } from "./headContentUtils.js";
|
|
31
29
|
import { Scripts } from "./Scripts.js";
|
|
30
|
+
import { DEFAULT_PROTOCOL_ALLOWLIST, SearchParamError, cleanPath, composeRewrites, createBrowserHistory, createControlledPromise, createHashHistory, createHistory, createMemoryHistory, createSerializationAdapter, deepEqual, defaultParseSearch, defaultStringifySearch, defer, functionalUpdate, interpolatePath, isMatch, isNotFound, isPlainArray, isPlainObject, isRedirect, joinPaths, lazyFn, notFound, parseSearchWith, redirect, replaceEqualDeep, resolvePath, retainSearchParams, rootRouteId, stringifySearchWith, stripSearchParams, trimPath, trimPathLeft, trimPathRight } from "./index.js";
|
|
32
31
|
import { HeadContent } from "./HeadContent.dev.js";
|
|
33
|
-
export {
|
|
34
|
-
Asset,
|
|
35
|
-
Await,
|
|
36
|
-
Block,
|
|
37
|
-
CatchBoundary,
|
|
38
|
-
CatchNotFound,
|
|
39
|
-
ClientOnly,
|
|
40
|
-
DEFAULT_PROTOCOL_ALLOWLIST,
|
|
41
|
-
DefaultGlobalNotFound,
|
|
42
|
-
ErrorComponent,
|
|
43
|
-
FileRoute,
|
|
44
|
-
FileRouteLoader,
|
|
45
|
-
HeadContent,
|
|
46
|
-
LazyRoute,
|
|
47
|
-
Link,
|
|
48
|
-
Match,
|
|
49
|
-
MatchRoute,
|
|
50
|
-
Matches,
|
|
51
|
-
Navigate,
|
|
52
|
-
NotFoundRoute,
|
|
53
|
-
Outlet,
|
|
54
|
-
RootRoute,
|
|
55
|
-
Route,
|
|
56
|
-
RouteApi,
|
|
57
|
-
Router,
|
|
58
|
-
RouterContextProvider,
|
|
59
|
-
RouterProvider,
|
|
60
|
-
ScriptOnce,
|
|
61
|
-
Scripts,
|
|
62
|
-
ScrollRestoration,
|
|
63
|
-
SearchParamError,
|
|
64
|
-
cleanPath,
|
|
65
|
-
composeRewrites,
|
|
66
|
-
createBrowserHistory,
|
|
67
|
-
createControlledPromise,
|
|
68
|
-
createFileRoute,
|
|
69
|
-
createHashHistory,
|
|
70
|
-
createHistory,
|
|
71
|
-
createLazyFileRoute,
|
|
72
|
-
createLazyRoute,
|
|
73
|
-
createLink,
|
|
74
|
-
createMemoryHistory,
|
|
75
|
-
createRootRoute,
|
|
76
|
-
createRootRouteWithContext,
|
|
77
|
-
createRoute,
|
|
78
|
-
createRouteMask,
|
|
79
|
-
createRouter,
|
|
80
|
-
createSerializationAdapter,
|
|
81
|
-
deepEqual,
|
|
82
|
-
defaultParseSearch,
|
|
83
|
-
defaultStringifySearch,
|
|
84
|
-
defer,
|
|
85
|
-
functionalUpdate,
|
|
86
|
-
getRouteApi,
|
|
87
|
-
interpolatePath,
|
|
88
|
-
isMatch,
|
|
89
|
-
isNotFound,
|
|
90
|
-
isPlainArray,
|
|
91
|
-
isPlainObject,
|
|
92
|
-
isRedirect,
|
|
93
|
-
joinPaths,
|
|
94
|
-
lazyFn,
|
|
95
|
-
lazyRouteComponent,
|
|
96
|
-
linkOptions,
|
|
97
|
-
notFound,
|
|
98
|
-
parseSearchWith,
|
|
99
|
-
redirect,
|
|
100
|
-
replaceEqualDeep,
|
|
101
|
-
resolvePath,
|
|
102
|
-
retainSearchParams,
|
|
103
|
-
rootRouteId,
|
|
104
|
-
rootRouteWithContext,
|
|
105
|
-
stringifySearchWith,
|
|
106
|
-
stripSearchParams,
|
|
107
|
-
trimPath,
|
|
108
|
-
trimPathLeft,
|
|
109
|
-
trimPathRight,
|
|
110
|
-
useAwaited,
|
|
111
|
-
useBlocker,
|
|
112
|
-
useCanGoBack,
|
|
113
|
-
useChildMatches,
|
|
114
|
-
useElementScrollRestoration,
|
|
115
|
-
useHydrated,
|
|
116
|
-
useLinkProps,
|
|
117
|
-
useLoaderData,
|
|
118
|
-
useLoaderDeps,
|
|
119
|
-
useLocation,
|
|
120
|
-
useMatch,
|
|
121
|
-
useMatchRoute,
|
|
122
|
-
useMatches,
|
|
123
|
-
useNavigate,
|
|
124
|
-
useParams,
|
|
125
|
-
useParentMatches,
|
|
126
|
-
useRouteContext,
|
|
127
|
-
useRouter,
|
|
128
|
-
useRouterState,
|
|
129
|
-
useSearch,
|
|
130
|
-
useTags
|
|
131
|
-
};
|
|
132
|
-
//# sourceMappingURL=index.dev.js.map
|
|
32
|
+
export { Asset, Await, Block, CatchBoundary, CatchNotFound, ClientOnly, DEFAULT_PROTOCOL_ALLOWLIST, DefaultGlobalNotFound, ErrorComponent, FileRoute, FileRouteLoader, HeadContent, LazyRoute, Link, Match, MatchRoute, Matches, Navigate, NotFoundRoute, Outlet, RootRoute, Route, RouteApi, Router, RouterContextProvider, RouterProvider, ScriptOnce, Scripts, ScrollRestoration, SearchParamError, cleanPath, composeRewrites, createBrowserHistory, createControlledPromise, createFileRoute, createHashHistory, createHistory, createLazyFileRoute, createLazyRoute, createLink, createMemoryHistory, createRootRoute, createRootRouteWithContext, createRoute, createRouteMask, createRouter, createSerializationAdapter, deepEqual, defaultParseSearch, defaultStringifySearch, defer, functionalUpdate, getRouteApi, interpolatePath, isMatch, isNotFound, isPlainArray, isPlainObject, isRedirect, joinPaths, lazyFn, lazyRouteComponent, linkOptions, notFound, parseSearchWith, redirect, replaceEqualDeep, resolvePath, retainSearchParams, rootRouteId, rootRouteWithContext, stringifySearchWith, stripSearchParams, trimPath, trimPathLeft, trimPathRight, useAwaited, useBlocker, useCanGoBack, useChildMatches, useElementScrollRestoration, useHydrated, useLinkProps, useLoaderData, useLoaderDeps, useLocation, useMatch, useMatchRoute, useMatches, useNavigate, useParams, useParentMatches, useRouteContext, useRouter, useRouterState, useSearch, useTags };
|
package/dist/esm/index.js
CHANGED
|
@@ -1,132 +1,33 @@
|
|
|
1
|
-
import { DEFAULT_PROTOCOL_ALLOWLIST, SearchParamError, cleanPath, composeRewrites, createControlledPromise, createSerializationAdapter, deepEqual, defaultParseSearch, defaultStringifySearch, defer, functionalUpdate, interpolatePath, isMatch, isNotFound, isPlainArray, isPlainObject, isRedirect, joinPaths, lazyFn, notFound, parseSearchWith, redirect, replaceEqualDeep, resolvePath, retainSearchParams, rootRouteId, stringifySearchWith, stripSearchParams, trimPath, trimPathLeft, trimPathRight } from "@tanstack/router-core";
|
|
2
|
-
import { createBrowserHistory, createHashHistory, createHistory, createMemoryHistory } from "@tanstack/history";
|
|
3
1
|
import { Await, useAwaited } from "./awaited.js";
|
|
4
2
|
import { CatchBoundary, ErrorComponent } from "./CatchBoundary.js";
|
|
5
3
|
import { ClientOnly, useHydrated } from "./ClientOnly.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
4
|
+
import { useRouter } from "./useRouter.js";
|
|
5
|
+
import { useRouterState } from "./useRouterState.js";
|
|
8
6
|
import { Link, createLink, linkOptions, useLinkProps } from "./link.js";
|
|
9
|
-
import { MatchRoute, Matches, useChildMatches, useMatchRoute, useMatches, useParentMatches } from "./Matches.js";
|
|
10
|
-
import { Match, Outlet } from "./Match.js";
|
|
11
7
|
import { useMatch } from "./useMatch.js";
|
|
12
|
-
import { useLoaderDeps } from "./useLoaderDeps.js";
|
|
13
8
|
import { useLoaderData } from "./useLoaderData.js";
|
|
9
|
+
import { useLoaderDeps } from "./useLoaderDeps.js";
|
|
10
|
+
import { useParams } from "./useParams.js";
|
|
11
|
+
import { useSearch } from "./useSearch.js";
|
|
12
|
+
import { Navigate, useNavigate } from "./useNavigate.js";
|
|
13
|
+
import { useRouteContext } from "./useRouteContext.js";
|
|
14
14
|
import { NotFoundRoute, RootRoute, Route, RouteApi, createRootRoute, createRootRouteWithContext, createRoute, createRouteMask, getRouteApi, rootRouteWithContext } from "./route.js";
|
|
15
|
+
import { FileRoute, FileRouteLoader, LazyRoute, createFileRoute, createLazyFileRoute, createLazyRoute } from "./fileRoute.js";
|
|
16
|
+
import { lazyRouteComponent } from "./lazyRouteComponent.js";
|
|
17
|
+
import { CatchNotFound, DefaultGlobalNotFound } from "./not-found.js";
|
|
18
|
+
import { ScriptOnce } from "./ScriptOnce.js";
|
|
19
|
+
import { Match, Outlet } from "./Match.js";
|
|
20
|
+
import { MatchRoute, Matches, useChildMatches, useMatchRoute, useMatches, useParentMatches } from "./Matches.js";
|
|
15
21
|
import { Router, createRouter } from "./router.js";
|
|
16
22
|
import { RouterContextProvider, RouterProvider } from "./RouterProvider.js";
|
|
17
23
|
import { ScrollRestoration, useElementScrollRestoration } from "./ScrollRestoration.js";
|
|
18
24
|
import { Block, useBlocker } from "./useBlocker.js";
|
|
19
|
-
import { Navigate, useNavigate } from "./useNavigate.js";
|
|
20
|
-
import { useParams } from "./useParams.js";
|
|
21
|
-
import { useSearch } from "./useSearch.js";
|
|
22
|
-
import { useRouteContext } from "./useRouteContext.js";
|
|
23
|
-
import { useRouter } from "./useRouter.js";
|
|
24
|
-
import { useRouterState } from "./useRouterState.js";
|
|
25
25
|
import { useLocation } from "./useLocation.js";
|
|
26
26
|
import { useCanGoBack } from "./useCanGoBack.js";
|
|
27
|
-
import { CatchNotFound, DefaultGlobalNotFound } from "./not-found.js";
|
|
28
|
-
import { ScriptOnce } from "./ScriptOnce.js";
|
|
29
27
|
import { Asset } from "./Asset.js";
|
|
30
|
-
import { HeadContent } from "./HeadContent.js";
|
|
31
28
|
import { useTags } from "./headContentUtils.js";
|
|
29
|
+
import { HeadContent } from "./HeadContent.js";
|
|
32
30
|
import { Scripts } from "./Scripts.js";
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
Block,
|
|
37
|
-
CatchBoundary,
|
|
38
|
-
CatchNotFound,
|
|
39
|
-
ClientOnly,
|
|
40
|
-
DEFAULT_PROTOCOL_ALLOWLIST,
|
|
41
|
-
DefaultGlobalNotFound,
|
|
42
|
-
ErrorComponent,
|
|
43
|
-
FileRoute,
|
|
44
|
-
FileRouteLoader,
|
|
45
|
-
HeadContent,
|
|
46
|
-
LazyRoute,
|
|
47
|
-
Link,
|
|
48
|
-
Match,
|
|
49
|
-
MatchRoute,
|
|
50
|
-
Matches,
|
|
51
|
-
Navigate,
|
|
52
|
-
NotFoundRoute,
|
|
53
|
-
Outlet,
|
|
54
|
-
RootRoute,
|
|
55
|
-
Route,
|
|
56
|
-
RouteApi,
|
|
57
|
-
Router,
|
|
58
|
-
RouterContextProvider,
|
|
59
|
-
RouterProvider,
|
|
60
|
-
ScriptOnce,
|
|
61
|
-
Scripts,
|
|
62
|
-
ScrollRestoration,
|
|
63
|
-
SearchParamError,
|
|
64
|
-
cleanPath,
|
|
65
|
-
composeRewrites,
|
|
66
|
-
createBrowserHistory,
|
|
67
|
-
createControlledPromise,
|
|
68
|
-
createFileRoute,
|
|
69
|
-
createHashHistory,
|
|
70
|
-
createHistory,
|
|
71
|
-
createLazyFileRoute,
|
|
72
|
-
createLazyRoute,
|
|
73
|
-
createLink,
|
|
74
|
-
createMemoryHistory,
|
|
75
|
-
createRootRoute,
|
|
76
|
-
createRootRouteWithContext,
|
|
77
|
-
createRoute,
|
|
78
|
-
createRouteMask,
|
|
79
|
-
createRouter,
|
|
80
|
-
createSerializationAdapter,
|
|
81
|
-
deepEqual,
|
|
82
|
-
defaultParseSearch,
|
|
83
|
-
defaultStringifySearch,
|
|
84
|
-
defer,
|
|
85
|
-
functionalUpdate,
|
|
86
|
-
getRouteApi,
|
|
87
|
-
interpolatePath,
|
|
88
|
-
isMatch,
|
|
89
|
-
isNotFound,
|
|
90
|
-
isPlainArray,
|
|
91
|
-
isPlainObject,
|
|
92
|
-
isRedirect,
|
|
93
|
-
joinPaths,
|
|
94
|
-
lazyFn,
|
|
95
|
-
lazyRouteComponent,
|
|
96
|
-
linkOptions,
|
|
97
|
-
notFound,
|
|
98
|
-
parseSearchWith,
|
|
99
|
-
redirect,
|
|
100
|
-
replaceEqualDeep,
|
|
101
|
-
resolvePath,
|
|
102
|
-
retainSearchParams,
|
|
103
|
-
rootRouteId,
|
|
104
|
-
rootRouteWithContext,
|
|
105
|
-
stringifySearchWith,
|
|
106
|
-
stripSearchParams,
|
|
107
|
-
trimPath,
|
|
108
|
-
trimPathLeft,
|
|
109
|
-
trimPathRight,
|
|
110
|
-
useAwaited,
|
|
111
|
-
useBlocker,
|
|
112
|
-
useCanGoBack,
|
|
113
|
-
useChildMatches,
|
|
114
|
-
useElementScrollRestoration,
|
|
115
|
-
useHydrated,
|
|
116
|
-
useLinkProps,
|
|
117
|
-
useLoaderData,
|
|
118
|
-
useLoaderDeps,
|
|
119
|
-
useLocation,
|
|
120
|
-
useMatch,
|
|
121
|
-
useMatchRoute,
|
|
122
|
-
useMatches,
|
|
123
|
-
useNavigate,
|
|
124
|
-
useParams,
|
|
125
|
-
useParentMatches,
|
|
126
|
-
useRouteContext,
|
|
127
|
-
useRouter,
|
|
128
|
-
useRouterState,
|
|
129
|
-
useSearch,
|
|
130
|
-
useTags
|
|
131
|
-
};
|
|
132
|
-
//# sourceMappingURL=index.js.map
|
|
31
|
+
import { DEFAULT_PROTOCOL_ALLOWLIST, SearchParamError, cleanPath, composeRewrites, createControlledPromise, createSerializationAdapter, deepEqual, defaultParseSearch, defaultStringifySearch, defer, functionalUpdate, interpolatePath, isMatch, isNotFound, isPlainArray, isPlainObject, isRedirect, joinPaths, lazyFn, notFound, parseSearchWith, redirect, replaceEqualDeep, resolvePath, retainSearchParams, rootRouteId, stringifySearchWith, stripSearchParams, trimPath, trimPathLeft, trimPathRight } from "@tanstack/router-core";
|
|
32
|
+
import { createBrowserHistory, createHashHistory, createHistory, createMemoryHistory } from "@tanstack/history";
|
|
33
|
+
export { Asset, Await, Block, CatchBoundary, CatchNotFound, ClientOnly, DEFAULT_PROTOCOL_ALLOWLIST, DefaultGlobalNotFound, ErrorComponent, FileRoute, FileRouteLoader, HeadContent, LazyRoute, Link, Match, MatchRoute, Matches, Navigate, NotFoundRoute, Outlet, RootRoute, Route, RouteApi, Router, RouterContextProvider, RouterProvider, ScriptOnce, Scripts, ScrollRestoration, SearchParamError, cleanPath, composeRewrites, createBrowserHistory, createControlledPromise, createFileRoute, createHashHistory, createHistory, createLazyFileRoute, createLazyRoute, createLink, createMemoryHistory, createRootRoute, createRootRouteWithContext, createRoute, createRouteMask, createRouter, createSerializationAdapter, deepEqual, defaultParseSearch, defaultStringifySearch, defer, functionalUpdate, getRouteApi, interpolatePath, isMatch, isNotFound, isPlainArray, isPlainObject, isRedirect, joinPaths, lazyFn, lazyRouteComponent, linkOptions, notFound, parseSearchWith, redirect, replaceEqualDeep, resolvePath, retainSearchParams, rootRouteId, rootRouteWithContext, stringifySearchWith, stripSearchParams, trimPath, trimPathLeft, trimPathRight, useAwaited, useBlocker, useCanGoBack, useChildMatches, useElementScrollRestoration, useHydrated, useLinkProps, useLoaderData, useLoaderDeps, useLocation, useMatch, useMatchRoute, useMatches, useNavigate, useParams, useParentMatches, useRouteContext, useRouter, useRouterState, useSearch, useTags };
|
|
@@ -1,57 +1,50 @@
|
|
|
1
|
-
import { createComponent, Dynamic, mergeProps } from "solid-js/web";
|
|
2
|
-
import { createResource } from "solid-js";
|
|
3
1
|
import { isModuleNotFoundError } from "@tanstack/router-core";
|
|
2
|
+
import { Dynamic, createComponent, mergeProps } from "solid-js/web";
|
|
3
|
+
import { createResource } from "solid-js";
|
|
4
|
+
//#region src/lazyRouteComponent.tsx
|
|
4
5
|
function lazyRouteComponent(importer, exportName) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}, props));
|
|
46
|
-
}
|
|
47
|
-
return createComponent(Dynamic, mergeProps({
|
|
48
|
-
component: comp
|
|
49
|
-
}, props));
|
|
50
|
-
};
|
|
51
|
-
lazyComp.preload = load;
|
|
52
|
-
return lazyComp;
|
|
6
|
+
let loadPromise;
|
|
7
|
+
let comp;
|
|
8
|
+
let error;
|
|
9
|
+
const load = () => {
|
|
10
|
+
if (!loadPromise) loadPromise = importer().then((res) => {
|
|
11
|
+
loadPromise = void 0;
|
|
12
|
+
comp = res[exportName ?? "default"];
|
|
13
|
+
return comp;
|
|
14
|
+
}).catch((err) => {
|
|
15
|
+
error = err;
|
|
16
|
+
});
|
|
17
|
+
return loadPromise;
|
|
18
|
+
};
|
|
19
|
+
const lazyComp = function Lazy(props) {
|
|
20
|
+
if (error) {
|
|
21
|
+
if (isModuleNotFoundError(error)) {
|
|
22
|
+
if (error instanceof Error && typeof window !== "undefined" && typeof sessionStorage !== "undefined") {
|
|
23
|
+
const storageKey = `tanstack_router_reload:${error.message}`;
|
|
24
|
+
if (!sessionStorage.getItem(storageKey)) {
|
|
25
|
+
sessionStorage.setItem(storageKey, "1");
|
|
26
|
+
window.location.reload();
|
|
27
|
+
return { default: () => null };
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
throw error;
|
|
32
|
+
}
|
|
33
|
+
if (!comp) {
|
|
34
|
+
const [compResource] = createResource(load, {
|
|
35
|
+
initialValue: comp,
|
|
36
|
+
ssrLoadFrom: "initial"
|
|
37
|
+
});
|
|
38
|
+
return createComponent(Dynamic, mergeProps({ get component() {
|
|
39
|
+
return compResource();
|
|
40
|
+
} }, props));
|
|
41
|
+
}
|
|
42
|
+
return createComponent(Dynamic, mergeProps({ component: comp }, props));
|
|
43
|
+
};
|
|
44
|
+
lazyComp.preload = load;
|
|
45
|
+
return lazyComp;
|
|
53
46
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
//# sourceMappingURL=lazyRouteComponent.js.map
|
|
47
|
+
//#endregion
|
|
48
|
+
export { lazyRouteComponent };
|
|
49
|
+
|
|
50
|
+
//# sourceMappingURL=lazyRouteComponent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lazyRouteComponent.js","sources":["../../src/lazyRouteComponent.tsx"],"sourcesContent":["import { Dynamic } from 'solid-js/web'\nimport { createResource } from 'solid-js'\nimport { isModuleNotFoundError } from '@tanstack/router-core'\nimport type { AsyncRouteComponent } from './route'\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): 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 (!loadPromise) {\n loadPromise = importer()\n .then((res) => {\n loadPromise = undefined\n comp = res[exportName ?? 'default']\n return comp\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 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.\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 const [compResource] = createResource(load, {\n initialValue: comp,\n ssrLoadFrom: 'initial',\n })\n return <Dynamic component={compResource()} {...props} />\n }\n\n return <Dynamic component={comp} {...props} />\n }\n\n ;(lazyComp as any).preload = load\n\n return lazyComp as any\n}\n"],"
|
|
1
|
+
{"version":3,"file":"lazyRouteComponent.js","names":["Dynamic","createResource","isModuleNotFoundError","AsyncRouteComponent","lazyRouteComponent","Record","T","importer","Promise","exportName","TKey","props","TProps","loadPromise","comp","error","load","then","res","undefined","catch","err","lazyComp","Lazy","Error","window","sessionStorage","storageKey","message","getItem","setItem","location","reload","default","compResource","initialValue","ssrLoadFrom","_$createComponent","_$mergeProps","component","preload"],"sources":["../../src/lazyRouteComponent.tsx"],"sourcesContent":["import { Dynamic } from 'solid-js/web'\nimport { createResource } from 'solid-js'\nimport { isModuleNotFoundError } from '@tanstack/router-core'\nimport type { AsyncRouteComponent } from './route'\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): 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 (!loadPromise) {\n loadPromise = importer()\n .then((res) => {\n loadPromise = undefined\n comp = res[exportName ?? 'default']\n return comp\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 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.\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 const [compResource] = createResource(load, {\n initialValue: comp,\n ssrLoadFrom: 'initial',\n })\n return <Dynamic component={compResource()} {...props} />\n }\n\n return <Dynamic component={comp} {...props} />\n }\n\n ;(lazyComp as any).preload = load\n\n return lazyComp as any\n}\n"],"mappings":";;;;AAKA,SAAgBI,mBAIdG,UACAE,YAGQ;CACR,IAAII;CACJ,IAAIC;CACJ,IAAIC;CAEJ,MAAMC,aAAa;AACjB,MAAI,CAACH,YACHA,eAAcN,UAAU,CACrBU,MAAMC,QAAQ;AACbL,iBAAcM,KAAAA;AACdL,UAAOI,IAAIT,cAAc;AACzB,UAAOK;IACP,CACDM,OAAOC,QAAQ;AACdN,WAAQM;IACR;AAGN,SAAOR;;CAGT,MAAMS,WAAW,SAASC,KAAKZ,OAAY;AAGzC,MAAII,OAAO;AAMT,OAAIb,sBAAsBa,MAAM;QAO5BA,iBAAiBS,SACjB,OAAOC,WAAW,eAClB,OAAOC,mBAAmB,aAC1B;KAKA,MAAMC,aAAa,0BAA0BZ,MAAMa;AACnD,SAAI,CAACF,eAAeG,QAAQF,WAAW,EAAE;AACvCD,qBAAeI,QAAQH,YAAY,IAAI;AACvCF,aAAOM,SAASC,QAAQ;AAGxB,aAAO,EACLC,eAAe,MAChB;;;;AAMP,SAAMlB;;AAGR,MAAI,CAACD,MAAM;GACT,MAAM,CAACoB,gBAAgBjC,eAAee,MAAM;IAC1CmB,cAAcrB;IACdsB,aAAa;IACd,CAAC;AACF,UAAAC,gBAAQrC,SAAOsC,WAAA,EAAA,IAACC,YAAS;AAAA,WAAEL,cAAc;MAAA,EAAMvB,MAAK,CAAA;;AAGtD,SAAA0B,gBAAQrC,SAAOsC,WAAA,EAACC,WAAWzB,MAAI,EAAMH,MAAK,CAAA;;AAG1CW,UAAiBkB,UAAUxB;AAE7B,QAAOM"}
|