react-router 7.0.0-pre.5 → 7.0.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/CHANGELOG.md +98 -184
- package/dist/{chunk-ICGFMBUV.mjs → development/chunk-U6WQEHBI.mjs} +4 -3
- package/dist/development/data-CQbyyGzl.d.mts +11 -0
- package/dist/development/data-CQbyyGzl.d.ts +11 -0
- package/dist/development/dom-export.d.mts +13 -0
- package/dist/{dom-export.d.ts → development/dom-export.d.ts} +2 -2
- package/dist/{dom-export.js → development/dom-export.js} +1 -1
- package/dist/{dom-export.mjs → development/dom-export.mjs} +2 -2
- package/dist/development/fog-of-war-BDQTYoRQ.d.mts +1595 -0
- package/dist/{fog-of-war-BijhfqFM.d.ts → development/fog-of-war-CbNQuoo8.d.ts} +2 -2
- package/dist/development/index.d.mts +840 -0
- package/dist/{index.d.ts → development/index.d.ts} +6 -5
- package/dist/{index.js → development/index.js} +4 -3
- package/dist/{index.mjs → development/index.mjs} +2 -2
- package/dist/development/lib/types/route-module.d.mts +102 -0
- package/dist/development/lib/types/route-module.d.ts +102 -0
- package/dist/{lib/types.js → development/lib/types/route-module.js} +4 -4
- package/dist/{lib/types.mjs → development/lib/types/route-module.mjs} +1 -1
- package/dist/{types-BlYP8xpH.d.mts → development/route-data-DuV3tXo2.d.mts} +20 -94
- package/dist/{types-BlYP8xpH.d.ts → development/route-data-DuV3tXo2.d.ts} +20 -94
- package/dist/production/chunk-L6MGG5FJ.mjs +9618 -0
- package/dist/production/data-CQbyyGzl.d.mts +11 -0
- package/dist/production/data-CQbyyGzl.d.ts +11 -0
- package/dist/production/dom-export.d.mts +13 -0
- package/dist/{dom-export.d.mts → production/dom-export.d.ts} +2 -2
- package/dist/production/dom-export.js +5502 -0
- package/dist/production/dom-export.mjs +199 -0
- package/dist/production/fog-of-war-BDQTYoRQ.d.mts +1595 -0
- package/dist/{fog-of-war-Bz_EDtxF.d.mts → production/fog-of-war-CbNQuoo8.d.ts} +2 -2
- package/dist/production/index.d.mts +840 -0
- package/dist/{index.d.mts → production/index.d.ts} +6 -5
- package/dist/production/index.js +9764 -0
- package/dist/production/index.mjs +235 -0
- package/dist/production/lib/types/route-module.d.mts +102 -0
- package/dist/production/lib/types/route-module.d.ts +102 -0
- package/dist/production/lib/types/route-module.js +28 -0
- package/dist/production/lib/types/route-module.mjs +10 -0
- package/dist/production/route-data-DuV3tXo2.d.mts +1546 -0
- package/dist/production/route-data-DuV3tXo2.d.ts +1546 -0
- package/package.json +37 -23
- package/dist/lib/types.d.mts +0 -2
- package/dist/lib/types.d.ts +0 -2
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* react-router v7.0.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) Remix Software Inc.
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
8
|
+
*
|
|
9
|
+
* @license MIT
|
|
10
|
+
*/
|
|
11
|
+
import {
|
|
12
|
+
Action,
|
|
13
|
+
Await,
|
|
14
|
+
BrowserRouter,
|
|
15
|
+
DataRouterContext,
|
|
16
|
+
DataRouterStateContext,
|
|
17
|
+
ErrorResponseImpl,
|
|
18
|
+
FetchersContext,
|
|
19
|
+
Form,
|
|
20
|
+
FrameworkContext,
|
|
21
|
+
HashRouter,
|
|
22
|
+
HistoryRouter,
|
|
23
|
+
IDLE_BLOCKER,
|
|
24
|
+
IDLE_FETCHER,
|
|
25
|
+
IDLE_NAVIGATION,
|
|
26
|
+
Link,
|
|
27
|
+
Links,
|
|
28
|
+
LocationContext,
|
|
29
|
+
MemoryRouter,
|
|
30
|
+
Meta,
|
|
31
|
+
NavLink,
|
|
32
|
+
Navigate,
|
|
33
|
+
NavigationContext,
|
|
34
|
+
Outlet,
|
|
35
|
+
PrefetchPageLinks,
|
|
36
|
+
RemixErrorBoundary,
|
|
37
|
+
Route,
|
|
38
|
+
RouteContext,
|
|
39
|
+
Router,
|
|
40
|
+
RouterProvider,
|
|
41
|
+
Routes,
|
|
42
|
+
Scripts,
|
|
43
|
+
ScrollRestoration,
|
|
44
|
+
ServerMode,
|
|
45
|
+
ServerRouter,
|
|
46
|
+
SingleFetchRedirectSymbol,
|
|
47
|
+
StaticRouter,
|
|
48
|
+
StaticRouterProvider,
|
|
49
|
+
ViewTransitionContext,
|
|
50
|
+
createBrowserHistory,
|
|
51
|
+
createBrowserRouter,
|
|
52
|
+
createClientRoutes,
|
|
53
|
+
createClientRoutesWithHMRRevalidationOptOut,
|
|
54
|
+
createCookie,
|
|
55
|
+
createCookieSessionStorage,
|
|
56
|
+
createHashRouter,
|
|
57
|
+
createMemoryRouter,
|
|
58
|
+
createMemorySessionStorage,
|
|
59
|
+
createPath,
|
|
60
|
+
createRequestHandler,
|
|
61
|
+
createRouter,
|
|
62
|
+
createRoutesFromChildren,
|
|
63
|
+
createRoutesStub,
|
|
64
|
+
createSearchParams,
|
|
65
|
+
createSession,
|
|
66
|
+
createSessionStorage,
|
|
67
|
+
createStaticHandler,
|
|
68
|
+
createStaticRouter,
|
|
69
|
+
data,
|
|
70
|
+
decodeViaTurboStream,
|
|
71
|
+
deserializeErrors,
|
|
72
|
+
generatePath,
|
|
73
|
+
getPatchRoutesOnNavigationFunction,
|
|
74
|
+
getSingleFetchDataStrategy,
|
|
75
|
+
invariant,
|
|
76
|
+
isCookie,
|
|
77
|
+
isRouteErrorResponse,
|
|
78
|
+
isSession,
|
|
79
|
+
mapRouteProperties,
|
|
80
|
+
matchPath,
|
|
81
|
+
matchRoutes,
|
|
82
|
+
parsePath,
|
|
83
|
+
redirect,
|
|
84
|
+
redirectDocument,
|
|
85
|
+
renderMatches,
|
|
86
|
+
replace,
|
|
87
|
+
resolvePath,
|
|
88
|
+
setDevServerHooks,
|
|
89
|
+
shouldHydrateRouteLoader,
|
|
90
|
+
useActionData,
|
|
91
|
+
useAsyncError,
|
|
92
|
+
useAsyncValue,
|
|
93
|
+
useBeforeUnload,
|
|
94
|
+
useBlocker,
|
|
95
|
+
useFetcher,
|
|
96
|
+
useFetchers,
|
|
97
|
+
useFogOFWarDiscovery,
|
|
98
|
+
useFormAction,
|
|
99
|
+
useHref,
|
|
100
|
+
useInRouterContext,
|
|
101
|
+
useLinkClickHandler,
|
|
102
|
+
useLoaderData,
|
|
103
|
+
useLocation,
|
|
104
|
+
useMatch,
|
|
105
|
+
useMatches,
|
|
106
|
+
useNavigate,
|
|
107
|
+
useNavigation,
|
|
108
|
+
useNavigationType,
|
|
109
|
+
useOutlet,
|
|
110
|
+
useOutletContext,
|
|
111
|
+
useParams,
|
|
112
|
+
usePrompt,
|
|
113
|
+
useResolvedPath,
|
|
114
|
+
useRevalidator,
|
|
115
|
+
useRouteError,
|
|
116
|
+
useRouteLoaderData,
|
|
117
|
+
useRoutes,
|
|
118
|
+
useScrollRestoration,
|
|
119
|
+
useSearchParams,
|
|
120
|
+
useSubmit,
|
|
121
|
+
useViewTransitionState
|
|
122
|
+
} from "./chunk-L6MGG5FJ.mjs";
|
|
123
|
+
export {
|
|
124
|
+
Await,
|
|
125
|
+
BrowserRouter,
|
|
126
|
+
Form,
|
|
127
|
+
HashRouter,
|
|
128
|
+
IDLE_BLOCKER,
|
|
129
|
+
IDLE_FETCHER,
|
|
130
|
+
IDLE_NAVIGATION,
|
|
131
|
+
Link,
|
|
132
|
+
Links,
|
|
133
|
+
MemoryRouter,
|
|
134
|
+
Meta,
|
|
135
|
+
NavLink,
|
|
136
|
+
Navigate,
|
|
137
|
+
Action as NavigationType,
|
|
138
|
+
Outlet,
|
|
139
|
+
PrefetchPageLinks,
|
|
140
|
+
Route,
|
|
141
|
+
Router,
|
|
142
|
+
RouterProvider,
|
|
143
|
+
Routes,
|
|
144
|
+
Scripts,
|
|
145
|
+
ScrollRestoration,
|
|
146
|
+
ServerRouter,
|
|
147
|
+
StaticRouter,
|
|
148
|
+
StaticRouterProvider,
|
|
149
|
+
DataRouterContext as UNSAFE_DataRouterContext,
|
|
150
|
+
DataRouterStateContext as UNSAFE_DataRouterStateContext,
|
|
151
|
+
ErrorResponseImpl as UNSAFE_ErrorResponseImpl,
|
|
152
|
+
FetchersContext as UNSAFE_FetchersContext,
|
|
153
|
+
FrameworkContext as UNSAFE_FrameworkContext,
|
|
154
|
+
LocationContext as UNSAFE_LocationContext,
|
|
155
|
+
NavigationContext as UNSAFE_NavigationContext,
|
|
156
|
+
RemixErrorBoundary as UNSAFE_RemixErrorBoundary,
|
|
157
|
+
RouteContext as UNSAFE_RouteContext,
|
|
158
|
+
ServerMode as UNSAFE_ServerMode,
|
|
159
|
+
SingleFetchRedirectSymbol as UNSAFE_SingleFetchRedirectSymbol,
|
|
160
|
+
ViewTransitionContext as UNSAFE_ViewTransitionContext,
|
|
161
|
+
createBrowserHistory as UNSAFE_createBrowserHistory,
|
|
162
|
+
createClientRoutes as UNSAFE_createClientRoutes,
|
|
163
|
+
createClientRoutesWithHMRRevalidationOptOut as UNSAFE_createClientRoutesWithHMRRevalidationOptOut,
|
|
164
|
+
createRouter as UNSAFE_createRouter,
|
|
165
|
+
decodeViaTurboStream as UNSAFE_decodeViaTurboStream,
|
|
166
|
+
deserializeErrors as UNSAFE_deserializeErrors,
|
|
167
|
+
getPatchRoutesOnNavigationFunction as UNSAFE_getPatchRoutesOnNavigationFunction,
|
|
168
|
+
getSingleFetchDataStrategy as UNSAFE_getSingleFetchDataStrategy,
|
|
169
|
+
invariant as UNSAFE_invariant,
|
|
170
|
+
mapRouteProperties as UNSAFE_mapRouteProperties,
|
|
171
|
+
shouldHydrateRouteLoader as UNSAFE_shouldHydrateRouteLoader,
|
|
172
|
+
useFogOFWarDiscovery as UNSAFE_useFogOFWarDiscovery,
|
|
173
|
+
useScrollRestoration as UNSAFE_useScrollRestoration,
|
|
174
|
+
createBrowserRouter,
|
|
175
|
+
createCookie,
|
|
176
|
+
createCookieSessionStorage,
|
|
177
|
+
createHashRouter,
|
|
178
|
+
createMemoryRouter,
|
|
179
|
+
createMemorySessionStorage,
|
|
180
|
+
createPath,
|
|
181
|
+
createRequestHandler,
|
|
182
|
+
createRoutesFromChildren,
|
|
183
|
+
createRoutesFromChildren as createRoutesFromElements,
|
|
184
|
+
createRoutesStub,
|
|
185
|
+
createSearchParams,
|
|
186
|
+
createSession,
|
|
187
|
+
createSessionStorage,
|
|
188
|
+
createStaticHandler,
|
|
189
|
+
createStaticRouter,
|
|
190
|
+
data,
|
|
191
|
+
generatePath,
|
|
192
|
+
isCookie,
|
|
193
|
+
isRouteErrorResponse,
|
|
194
|
+
isSession,
|
|
195
|
+
matchPath,
|
|
196
|
+
matchRoutes,
|
|
197
|
+
parsePath,
|
|
198
|
+
redirect,
|
|
199
|
+
redirectDocument,
|
|
200
|
+
renderMatches,
|
|
201
|
+
replace,
|
|
202
|
+
resolvePath,
|
|
203
|
+
HistoryRouter as unstable_HistoryRouter,
|
|
204
|
+
setDevServerHooks as unstable_setDevServerHooks,
|
|
205
|
+
usePrompt as unstable_usePrompt,
|
|
206
|
+
useActionData,
|
|
207
|
+
useAsyncError,
|
|
208
|
+
useAsyncValue,
|
|
209
|
+
useBeforeUnload,
|
|
210
|
+
useBlocker,
|
|
211
|
+
useFetcher,
|
|
212
|
+
useFetchers,
|
|
213
|
+
useFormAction,
|
|
214
|
+
useHref,
|
|
215
|
+
useInRouterContext,
|
|
216
|
+
useLinkClickHandler,
|
|
217
|
+
useLoaderData,
|
|
218
|
+
useLocation,
|
|
219
|
+
useMatch,
|
|
220
|
+
useMatches,
|
|
221
|
+
useNavigate,
|
|
222
|
+
useNavigation,
|
|
223
|
+
useNavigationType,
|
|
224
|
+
useOutlet,
|
|
225
|
+
useOutletContext,
|
|
226
|
+
useParams,
|
|
227
|
+
useResolvedPath,
|
|
228
|
+
useRevalidator,
|
|
229
|
+
useRouteError,
|
|
230
|
+
useRouteLoaderData,
|
|
231
|
+
useRoutes,
|
|
232
|
+
useSearchParams,
|
|
233
|
+
useSubmit,
|
|
234
|
+
useViewTransitionState
|
|
235
|
+
};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { av as LinkDescriptor, as as MetaDescriptor, aJ as ServerDataFrom, aK as ClientDataFrom, aL as Func, aM as Equal, aN as Pretty } from '../../route-data-DuV3tXo2.mjs';
|
|
2
|
+
import { A as AppLoadContext } from '../../data-CQbyyGzl.mjs';
|
|
3
|
+
import 'react';
|
|
4
|
+
|
|
5
|
+
type IsDefined<T> = Equal<T, undefined> extends true ? false : true;
|
|
6
|
+
type RouteModule = {
|
|
7
|
+
meta?: Func;
|
|
8
|
+
links?: Func;
|
|
9
|
+
loader?: Func;
|
|
10
|
+
clientLoader?: Func;
|
|
11
|
+
action?: Func;
|
|
12
|
+
clientAction?: Func;
|
|
13
|
+
HydrateFallback?: unknown;
|
|
14
|
+
default?: unknown;
|
|
15
|
+
ErrorBoundary?: unknown;
|
|
16
|
+
[key: string]: unknown;
|
|
17
|
+
};
|
|
18
|
+
type LinkDescriptors = LinkDescriptor[];
|
|
19
|
+
type RouteInfo = {
|
|
20
|
+
parents: RouteInfo[];
|
|
21
|
+
module: RouteModule;
|
|
22
|
+
id: unknown;
|
|
23
|
+
file: string;
|
|
24
|
+
path: string;
|
|
25
|
+
params: unknown;
|
|
26
|
+
loaderData: unknown;
|
|
27
|
+
actionData: unknown;
|
|
28
|
+
};
|
|
29
|
+
type MetaMatch<T extends RouteInfo> = Pretty<Pick<T, "id" | "params"> & {
|
|
30
|
+
pathname: string;
|
|
31
|
+
meta: MetaDescriptor[];
|
|
32
|
+
data: T["loaderData"];
|
|
33
|
+
handle?: unknown;
|
|
34
|
+
error?: unknown;
|
|
35
|
+
}>;
|
|
36
|
+
type MetaMatches<T extends RouteInfo[]> = T extends [infer F extends RouteInfo, ...infer R extends RouteInfo[]] ? [MetaMatch<F>, ...MetaMatches<R>] : [];
|
|
37
|
+
type CreateMetaArgs<T extends RouteInfo> = {
|
|
38
|
+
location: Location;
|
|
39
|
+
params: T["params"];
|
|
40
|
+
data: T["loaderData"];
|
|
41
|
+
error?: unknown;
|
|
42
|
+
matches: MetaMatches<T["parents"]>;
|
|
43
|
+
};
|
|
44
|
+
type MetaDescriptors = MetaDescriptor[];
|
|
45
|
+
type IsHydrate<ClientLoader> = ClientLoader extends {
|
|
46
|
+
hydrate: true;
|
|
47
|
+
} ? true : ClientLoader extends {
|
|
48
|
+
hydrate: false;
|
|
49
|
+
} ? false : false;
|
|
50
|
+
type CreateLoaderData<T extends RouteModule> = _CreateLoaderData<ServerDataFrom<T["loader"]>, ClientDataFrom<T["clientLoader"]>, IsHydrate<T["clientLoader"]>, T extends {
|
|
51
|
+
HydrateFallback: Func;
|
|
52
|
+
} ? true : false>;
|
|
53
|
+
type _CreateLoaderData<ServerLoaderData, ClientLoaderData, ClientLoaderHydrate extends boolean, HasHydrateFallback> = [
|
|
54
|
+
HasHydrateFallback,
|
|
55
|
+
ClientLoaderHydrate
|
|
56
|
+
] extends [true, true] ? IsDefined<ClientLoaderData> extends true ? ClientLoaderData : undefined : [
|
|
57
|
+
IsDefined<ClientLoaderData>,
|
|
58
|
+
IsDefined<ServerLoaderData>
|
|
59
|
+
] extends [true, true] ? ServerLoaderData | ClientLoaderData : IsDefined<ClientLoaderData> extends true ? ClientLoaderData : IsDefined<ServerLoaderData> extends true ? ServerLoaderData : undefined;
|
|
60
|
+
type CreateActionData<T extends RouteModule> = _CreateActionData<ServerDataFrom<T["action"]>, ClientDataFrom<T["clientAction"]>>;
|
|
61
|
+
type _CreateActionData<ServerActionData, ClientActionData> = Awaited<[
|
|
62
|
+
IsDefined<ServerActionData>,
|
|
63
|
+
IsDefined<ClientActionData>
|
|
64
|
+
] extends [true, true] ? ServerActionData | ClientActionData : IsDefined<ClientActionData> extends true ? ClientActionData : IsDefined<ServerActionData> extends true ? ServerActionData : undefined>;
|
|
65
|
+
type ClientDataFunctionArgs<T extends RouteInfo> = {
|
|
66
|
+
request: Request;
|
|
67
|
+
params: T["params"];
|
|
68
|
+
};
|
|
69
|
+
type ServerDataFunctionArgs<T extends RouteInfo> = ClientDataFunctionArgs<T> & {
|
|
70
|
+
context: AppLoadContext;
|
|
71
|
+
};
|
|
72
|
+
type CreateServerLoaderArgs<T extends RouteInfo> = ServerDataFunctionArgs<T>;
|
|
73
|
+
type CreateClientLoaderArgs<T extends RouteInfo> = ClientDataFunctionArgs<T> & {
|
|
74
|
+
serverLoader: () => Promise<ServerDataFrom<T["module"]["loader"]>>;
|
|
75
|
+
};
|
|
76
|
+
type CreateServerActionArgs<T extends RouteInfo> = ServerDataFunctionArgs<T>;
|
|
77
|
+
type CreateClientActionArgs<T extends RouteInfo> = ClientDataFunctionArgs<T> & {
|
|
78
|
+
serverAction: () => Promise<ServerDataFrom<T["module"]["action"]>>;
|
|
79
|
+
};
|
|
80
|
+
type CreateHydrateFallbackProps<T extends RouteInfo> = {
|
|
81
|
+
params: T["params"];
|
|
82
|
+
};
|
|
83
|
+
type Match<T extends RouteInfo> = Pretty<Pick<T, "id" | "params"> & {
|
|
84
|
+
pathname: string;
|
|
85
|
+
data: T["loaderData"];
|
|
86
|
+
handle: unknown;
|
|
87
|
+
}>;
|
|
88
|
+
type Matches<T extends RouteInfo[]> = T extends [infer F extends RouteInfo, ...infer R extends RouteInfo[]] ? [Match<F>, ...Matches<R>] : [];
|
|
89
|
+
type CreateComponentProps<T extends RouteInfo> = {
|
|
90
|
+
params: T["params"];
|
|
91
|
+
loaderData: T["loaderData"];
|
|
92
|
+
actionData?: T["actionData"];
|
|
93
|
+
matches: Matches<T["parents"]>;
|
|
94
|
+
};
|
|
95
|
+
type CreateErrorBoundaryProps<T extends RouteInfo> = {
|
|
96
|
+
params: T["params"];
|
|
97
|
+
error: unknown;
|
|
98
|
+
loaderData?: T["loaderData"];
|
|
99
|
+
actionData?: T["actionData"];
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export type { CreateActionData, CreateClientActionArgs, CreateClientLoaderArgs, CreateComponentProps, CreateErrorBoundaryProps, CreateHydrateFallbackProps, CreateLoaderData, CreateMetaArgs, CreateServerActionArgs, CreateServerLoaderArgs, LinkDescriptors, MetaDescriptors };
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { av as LinkDescriptor, as as MetaDescriptor, aJ as ServerDataFrom, aK as ClientDataFrom, aL as Func, aM as Equal, aN as Pretty } from '../../route-data-DuV3tXo2.js';
|
|
2
|
+
import { A as AppLoadContext } from '../../data-CQbyyGzl.js';
|
|
3
|
+
import 'react';
|
|
4
|
+
|
|
5
|
+
type IsDefined<T> = Equal<T, undefined> extends true ? false : true;
|
|
6
|
+
type RouteModule = {
|
|
7
|
+
meta?: Func;
|
|
8
|
+
links?: Func;
|
|
9
|
+
loader?: Func;
|
|
10
|
+
clientLoader?: Func;
|
|
11
|
+
action?: Func;
|
|
12
|
+
clientAction?: Func;
|
|
13
|
+
HydrateFallback?: unknown;
|
|
14
|
+
default?: unknown;
|
|
15
|
+
ErrorBoundary?: unknown;
|
|
16
|
+
[key: string]: unknown;
|
|
17
|
+
};
|
|
18
|
+
type LinkDescriptors = LinkDescriptor[];
|
|
19
|
+
type RouteInfo = {
|
|
20
|
+
parents: RouteInfo[];
|
|
21
|
+
module: RouteModule;
|
|
22
|
+
id: unknown;
|
|
23
|
+
file: string;
|
|
24
|
+
path: string;
|
|
25
|
+
params: unknown;
|
|
26
|
+
loaderData: unknown;
|
|
27
|
+
actionData: unknown;
|
|
28
|
+
};
|
|
29
|
+
type MetaMatch<T extends RouteInfo> = Pretty<Pick<T, "id" | "params"> & {
|
|
30
|
+
pathname: string;
|
|
31
|
+
meta: MetaDescriptor[];
|
|
32
|
+
data: T["loaderData"];
|
|
33
|
+
handle?: unknown;
|
|
34
|
+
error?: unknown;
|
|
35
|
+
}>;
|
|
36
|
+
type MetaMatches<T extends RouteInfo[]> = T extends [infer F extends RouteInfo, ...infer R extends RouteInfo[]] ? [MetaMatch<F>, ...MetaMatches<R>] : [];
|
|
37
|
+
type CreateMetaArgs<T extends RouteInfo> = {
|
|
38
|
+
location: Location;
|
|
39
|
+
params: T["params"];
|
|
40
|
+
data: T["loaderData"];
|
|
41
|
+
error?: unknown;
|
|
42
|
+
matches: MetaMatches<T["parents"]>;
|
|
43
|
+
};
|
|
44
|
+
type MetaDescriptors = MetaDescriptor[];
|
|
45
|
+
type IsHydrate<ClientLoader> = ClientLoader extends {
|
|
46
|
+
hydrate: true;
|
|
47
|
+
} ? true : ClientLoader extends {
|
|
48
|
+
hydrate: false;
|
|
49
|
+
} ? false : false;
|
|
50
|
+
type CreateLoaderData<T extends RouteModule> = _CreateLoaderData<ServerDataFrom<T["loader"]>, ClientDataFrom<T["clientLoader"]>, IsHydrate<T["clientLoader"]>, T extends {
|
|
51
|
+
HydrateFallback: Func;
|
|
52
|
+
} ? true : false>;
|
|
53
|
+
type _CreateLoaderData<ServerLoaderData, ClientLoaderData, ClientLoaderHydrate extends boolean, HasHydrateFallback> = [
|
|
54
|
+
HasHydrateFallback,
|
|
55
|
+
ClientLoaderHydrate
|
|
56
|
+
] extends [true, true] ? IsDefined<ClientLoaderData> extends true ? ClientLoaderData : undefined : [
|
|
57
|
+
IsDefined<ClientLoaderData>,
|
|
58
|
+
IsDefined<ServerLoaderData>
|
|
59
|
+
] extends [true, true] ? ServerLoaderData | ClientLoaderData : IsDefined<ClientLoaderData> extends true ? ClientLoaderData : IsDefined<ServerLoaderData> extends true ? ServerLoaderData : undefined;
|
|
60
|
+
type CreateActionData<T extends RouteModule> = _CreateActionData<ServerDataFrom<T["action"]>, ClientDataFrom<T["clientAction"]>>;
|
|
61
|
+
type _CreateActionData<ServerActionData, ClientActionData> = Awaited<[
|
|
62
|
+
IsDefined<ServerActionData>,
|
|
63
|
+
IsDefined<ClientActionData>
|
|
64
|
+
] extends [true, true] ? ServerActionData | ClientActionData : IsDefined<ClientActionData> extends true ? ClientActionData : IsDefined<ServerActionData> extends true ? ServerActionData : undefined>;
|
|
65
|
+
type ClientDataFunctionArgs<T extends RouteInfo> = {
|
|
66
|
+
request: Request;
|
|
67
|
+
params: T["params"];
|
|
68
|
+
};
|
|
69
|
+
type ServerDataFunctionArgs<T extends RouteInfo> = ClientDataFunctionArgs<T> & {
|
|
70
|
+
context: AppLoadContext;
|
|
71
|
+
};
|
|
72
|
+
type CreateServerLoaderArgs<T extends RouteInfo> = ServerDataFunctionArgs<T>;
|
|
73
|
+
type CreateClientLoaderArgs<T extends RouteInfo> = ClientDataFunctionArgs<T> & {
|
|
74
|
+
serverLoader: () => Promise<ServerDataFrom<T["module"]["loader"]>>;
|
|
75
|
+
};
|
|
76
|
+
type CreateServerActionArgs<T extends RouteInfo> = ServerDataFunctionArgs<T>;
|
|
77
|
+
type CreateClientActionArgs<T extends RouteInfo> = ClientDataFunctionArgs<T> & {
|
|
78
|
+
serverAction: () => Promise<ServerDataFrom<T["module"]["action"]>>;
|
|
79
|
+
};
|
|
80
|
+
type CreateHydrateFallbackProps<T extends RouteInfo> = {
|
|
81
|
+
params: T["params"];
|
|
82
|
+
};
|
|
83
|
+
type Match<T extends RouteInfo> = Pretty<Pick<T, "id" | "params"> & {
|
|
84
|
+
pathname: string;
|
|
85
|
+
data: T["loaderData"];
|
|
86
|
+
handle: unknown;
|
|
87
|
+
}>;
|
|
88
|
+
type Matches<T extends RouteInfo[]> = T extends [infer F extends RouteInfo, ...infer R extends RouteInfo[]] ? [Match<F>, ...Matches<R>] : [];
|
|
89
|
+
type CreateComponentProps<T extends RouteInfo> = {
|
|
90
|
+
params: T["params"];
|
|
91
|
+
loaderData: T["loaderData"];
|
|
92
|
+
actionData?: T["actionData"];
|
|
93
|
+
matches: Matches<T["parents"]>;
|
|
94
|
+
};
|
|
95
|
+
type CreateErrorBoundaryProps<T extends RouteInfo> = {
|
|
96
|
+
params: T["params"];
|
|
97
|
+
error: unknown;
|
|
98
|
+
loaderData?: T["loaderData"];
|
|
99
|
+
actionData?: T["actionData"];
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export type { CreateActionData, CreateClientActionArgs, CreateClientLoaderArgs, CreateComponentProps, CreateErrorBoundaryProps, CreateHydrateFallbackProps, CreateLoaderData, CreateMetaArgs, CreateServerActionArgs, CreateServerLoaderArgs, LinkDescriptors, MetaDescriptors };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* react-router v7.0.0
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) Remix Software Inc.
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
8
|
+
*
|
|
9
|
+
* @license MIT
|
|
10
|
+
*/
|
|
11
|
+
"use strict";
|
|
12
|
+
var __defProp = Object.defineProperty;
|
|
13
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
14
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
15
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
16
|
+
var __copyProps = (to, from, except, desc) => {
|
|
17
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
18
|
+
for (let key of __getOwnPropNames(from))
|
|
19
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
20
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
21
|
+
}
|
|
22
|
+
return to;
|
|
23
|
+
};
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
|
|
26
|
+
// lib/types/route-module.ts
|
|
27
|
+
var route_module_exports = {};
|
|
28
|
+
module.exports = __toCommonJS(route_module_exports);
|