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
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { R as RouteModules, a as Router, D as DataStrategyFunction, A as ActionFunction, L as LoaderFunction, C as ClientActionFunction, b as ClientLoaderFunction, c as LinksFunction, M as MetaFunction, d as RouteManifest, e as
|
|
2
|
-
export {
|
|
3
|
-
import { A as AssetsManifest, a as Route, F as FutureConfig, E as EntryContext } from './fog-of-war-
|
|
4
|
-
export { f as Await, b as AwaitProps, G as BrowserRouter, B as BrowserRouterProps, u as FetcherFormProps, y as FetcherSubmitFunction, a3 as FetcherSubmitOptions, z as FetcherWithComponents, U as Form, v as FormProps, J as HashRouter, H as HashRouterProps, p as HistoryRouterProps, I as IndexRouteProps, L as LayoutRouteProps, K as Link, q as LinkProps, aa as Links, g as MemoryRouter, M as MemoryRouterProps, a9 as Meta, T as NavLink, s as NavLinkProps, t as NavLinkRenderProps, h as Navigate, N as NavigateProps, i as Outlet, O as OutletProps, a4 as ParamKeyValuePair, P as PathRouteProps, ac as PrefetchPageLinks, j as Route, c as RouteProps, k as Router, d as RouterProps, l as RouterProvider, R as RouterProviderProps, m as Routes, e as RoutesProps, ab as Scripts, ad as ScriptsProps, V as ScrollRestoration, S as ScrollRestorationProps, w as SetURLSearchParams, x as SubmitFunction, a5 as SubmitOptions, a7 as SubmitTarget, af as UNSAFE_FrameworkContext, ai as UNSAFE_createClientRoutes, aj as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, ag as UNSAFE_getPatchRoutesOnNavigationFunction, ae as UNSAFE_mapRouteProperties, ak as UNSAFE_shouldHydrateRouteLoader, ah as UNSAFE_useFogOFWarDiscovery, al as UNSAFE_useScrollRestoration, a6 as URLSearchParamsInit, C as createBrowserRouter, D as createHashRouter, n as createMemoryRouter, o as createRoutesFromChildren, o as createRoutesFromElements, a8 as createSearchParams, r as renderMatches, Q as unstable_HistoryRouter, a1 as unstable_usePrompt, a0 as useBeforeUnload, _ as useFetcher, $ as useFetchers, Z as useFormAction, W as useLinkClickHandler, X as useSearchParams, Y as useSubmit, a2 as useViewTransitionState } from './fog-of-war-
|
|
1
|
+
import { R as RouteModules, a as Router, D as DataStrategyFunction, A as ActionFunction, L as LoaderFunction, C as ClientActionFunction, b as ClientLoaderFunction, c as LinksFunction, M as MetaFunction, d as RouteManifest, e as LoaderFunctionArgs, f as ActionFunctionArgs, T as To, g as RelativeRoutingType, h as Location, i as Action, P as ParamParseKey, j as Path, k as PathPattern, l as PathMatch, N as NavigateOptions, m as Params, n as RouteObject, o as Navigation, p as RevalidationState, U as UIMatch, S as SerializeFrom, B as BlockerFunction, q as Blocker, r as StaticHandlerContext, s as StaticHandler, F as FutureConfig$1, t as CreateStaticHandlerOptions$1, I as InitialEntry, H as HydrationState, u as IndexRouteObject, v as NonIndexRouteObject, w as RouterState } from './route-data-DuV3tXo2.js';
|
|
2
|
+
export { ap as ClientActionFunctionArgs, aq as ClientLoaderFunctionArgs, aj as DataRouteMatch, ak as DataRouteObject, Q as DataStrategyFunctionArgs, V as DataStrategyMatch, W as DataStrategyResult, Y as ErrorResponse, y as Fetcher, Z as FormEncType, _ as FormMethod, G as GetScrollPositionFunction, x as GetScrollRestorationKeyFunction, $ as HTMLFormMethod, au as HtmlLinkDescriptor, a9 as IDLE_BLOCKER, a8 as IDLE_FETCHER, a7 as IDLE_NAVIGATION, a0 as LazyRouteFunction, av as LinkDescriptor, ar as MetaArgs, as as MetaDescriptor, z as NavigationStates, al as Navigator, at as PageLinkDescriptor, am as PatchRoutesOnNavigationFunction, an as PatchRoutesOnNavigationFunctionArgs, a1 as PathParam, a2 as RedirectFunction, ao as RouteMatch, O as RouterFetchOptions, E as RouterInit, K as RouterNavigateOptions, J as RouterSubscriber, a3 as ShouldRevalidateFunction, a4 as ShouldRevalidateFunctionArgs, aA as UNSAFE_DataRouterContext, aB as UNSAFE_DataRouterStateContext, X as UNSAFE_DataWithResponseInit, az as UNSAFE_ErrorResponseImpl, aC as UNSAFE_FetchersContext, aD as UNSAFE_LocationContext, aE as UNSAFE_NavigationContext, aF as UNSAFE_RouteContext, aG as UNSAFE_ViewTransitionContext, aw as UNSAFE_createBrowserHistory, ay as UNSAFE_createRouter, ax as UNSAFE_invariant, a5 as createPath, aa as data, ab as generatePath, ac as isRouteErrorResponse, ad as matchPath, ae as matchRoutes, a6 as parsePath, af as redirect, ag as redirectDocument, ah as replace, ai as resolvePath } from './route-data-DuV3tXo2.js';
|
|
3
|
+
import { A as AssetsManifest, a as Route, F as FutureConfig, E as EntryContext } from './fog-of-war-CbNQuoo8.js';
|
|
4
|
+
export { f as Await, b as AwaitProps, G as BrowserRouter, B as BrowserRouterProps, u as FetcherFormProps, y as FetcherSubmitFunction, a3 as FetcherSubmitOptions, z as FetcherWithComponents, U as Form, v as FormProps, J as HashRouter, H as HashRouterProps, p as HistoryRouterProps, I as IndexRouteProps, L as LayoutRouteProps, K as Link, q as LinkProps, aa as Links, g as MemoryRouter, M as MemoryRouterProps, a9 as Meta, T as NavLink, s as NavLinkProps, t as NavLinkRenderProps, h as Navigate, N as NavigateProps, i as Outlet, O as OutletProps, a4 as ParamKeyValuePair, P as PathRouteProps, ac as PrefetchPageLinks, j as Route, c as RouteProps, k as Router, d as RouterProps, l as RouterProvider, R as RouterProviderProps, m as Routes, e as RoutesProps, ab as Scripts, ad as ScriptsProps, V as ScrollRestoration, S as ScrollRestorationProps, w as SetURLSearchParams, x as SubmitFunction, a5 as SubmitOptions, a7 as SubmitTarget, af as UNSAFE_FrameworkContext, ai as UNSAFE_createClientRoutes, aj as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, ag as UNSAFE_getPatchRoutesOnNavigationFunction, ae as UNSAFE_mapRouteProperties, ak as UNSAFE_shouldHydrateRouteLoader, ah as UNSAFE_useFogOFWarDiscovery, al as UNSAFE_useScrollRestoration, a6 as URLSearchParamsInit, C as createBrowserRouter, D as createHashRouter, n as createMemoryRouter, o as createRoutesFromChildren, o as createRoutesFromElements, a8 as createSearchParams, r as renderMatches, Q as unstable_HistoryRouter, a1 as unstable_usePrompt, a0 as useBeforeUnload, _ as useFetcher, $ as useFetchers, Z as useFormAction, W as useLinkClickHandler, X as useSearchParams, Y as useSubmit, a2 as useViewTransitionState } from './fog-of-war-CbNQuoo8.js';
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import { ReactElement } from 'react';
|
|
7
7
|
import { ParseOptions, SerializeOptions } from 'cookie';
|
|
8
8
|
export { ParseOptions as CookieParseOptions, SerializeOptions as CookieSerializeOptions } from 'cookie';
|
|
9
|
+
import { A as AppLoadContext$1 } from './data-CQbyyGzl.js';
|
|
9
10
|
|
|
10
11
|
declare const SingleFetchRedirectSymbol: unique symbol;
|
|
11
12
|
declare function getSingleFetchDataStrategy(manifest: AssetsManifest, routeModules: RouteModules, getRouter: () => Router): DataStrategyFunction;
|
|
@@ -562,7 +563,7 @@ interface RoutesTestStubProps {
|
|
|
562
563
|
*/
|
|
563
564
|
hydrationData?: HydrationState;
|
|
564
565
|
/**
|
|
565
|
-
* Future flags mimicking the settings in
|
|
566
|
+
* Future flags mimicking the settings in react-router.config.ts
|
|
566
567
|
*/
|
|
567
568
|
future?: Partial<FutureConfig>;
|
|
568
569
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v7.0.0
|
|
2
|
+
* react-router v7.0.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -7125,7 +7125,7 @@ function mergeRefs(...refs) {
|
|
|
7125
7125
|
var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
7126
7126
|
try {
|
|
7127
7127
|
if (isBrowser) {
|
|
7128
|
-
window.__reactRouterVersion = "7.0.0
|
|
7128
|
+
window.__reactRouterVersion = "7.0.0";
|
|
7129
7129
|
}
|
|
7130
7130
|
} catch (e) {
|
|
7131
7131
|
}
|
|
@@ -8716,9 +8716,10 @@ function createStaticHandlerDataRoutes(manifest, future, parentId = "", routesBy
|
|
|
8716
8716
|
// context even though we know it'll always be provided in remix
|
|
8717
8717
|
loader: route.module.loader ? async (args) => {
|
|
8718
8718
|
if (args.request.headers.has("X-React-Router-Prerender-Data")) {
|
|
8719
|
-
|
|
8719
|
+
const preRenderedData = args.request.headers.get(
|
|
8720
8720
|
"X-React-Router-Prerender-Data"
|
|
8721
8721
|
);
|
|
8722
|
+
let encoded = preRenderedData ? decodeURI(preRenderedData) : preRenderedData;
|
|
8722
8723
|
invariant3(encoded, "Missing prerendered data for route");
|
|
8723
8724
|
let uint8array = new TextEncoder().encode(encoded);
|
|
8724
8725
|
let stream = new ReadableStream({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v7.0.0
|
|
2
|
+
* react-router v7.0.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -119,7 +119,7 @@ import {
|
|
|
119
119
|
useSearchParams,
|
|
120
120
|
useSubmit,
|
|
121
121
|
useViewTransitionState
|
|
122
|
-
} from "./chunk-
|
|
122
|
+
} from "./chunk-U6WQEHBI.mjs";
|
|
123
123
|
export {
|
|
124
124
|
Await,
|
|
125
125
|
BrowserRouter,
|
|
@@ -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 };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v7.0.0
|
|
2
|
+
* react-router v7.0.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -23,6 +23,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
23
23
|
};
|
|
24
24
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
25
|
|
|
26
|
-
// lib/types.ts
|
|
27
|
-
var
|
|
28
|
-
module.exports = __toCommonJS(
|
|
26
|
+
// lib/types/route-module.ts
|
|
27
|
+
var route_module_exports = {};
|
|
28
|
+
module.exports = __toCommonJS(route_module_exports);
|
|
@@ -423,16 +423,13 @@ type AgnosticDataNonIndexRouteObject = AgnosticNonIndexRouteObject & {
|
|
|
423
423
|
*/
|
|
424
424
|
type AgnosticDataRouteObject = AgnosticDataIndexRouteObject | AgnosticDataNonIndexRouteObject;
|
|
425
425
|
type RouteManifest<R = AgnosticDataRouteObject> = Record<string, R | undefined>;
|
|
426
|
-
type
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
* "/:a/:b" -> "a" | "b"
|
|
434
|
-
* "/:a/b/:c/*" -> "a" | "c" | "*"
|
|
435
|
-
*/
|
|
426
|
+
type Regex_az = "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z";
|
|
427
|
+
type Regez_AZ = "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | "S" | "T" | "U" | "V" | "W" | "X" | "Y" | "Z";
|
|
428
|
+
type Regex_09 = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9";
|
|
429
|
+
type Regex_w = Regex_az | Regez_AZ | Regex_09 | "_";
|
|
430
|
+
type ParamChar = Regex_w | "-";
|
|
431
|
+
type RegexMatchPlus<CharPattern extends string, T extends string> = T extends `${infer First}${infer Rest}` ? First extends CharPattern ? RegexMatchPlus<CharPattern, Rest> extends never ? First : `${First}${RegexMatchPlus<CharPattern, Rest>}` : never : never;
|
|
432
|
+
type _PathParam<Path extends string> = Path extends `${infer L}/${infer R}` ? _PathParam<L> | _PathParam<R> : Path extends `:${infer Param}` ? Param extends `${infer Optional}?${string}` ? RegexMatchPlus<ParamChar, Optional> : RegexMatchPlus<ParamChar, Param> : never;
|
|
436
433
|
type PathParam<Path extends string> = Path extends "*" | "/*" ? "*" : Path extends `${infer Rest}/*` ? "*" | _PathParam<Rest> : _PathParam<Path>;
|
|
437
434
|
type ParamParseKey<Segment extends string> = [
|
|
438
435
|
PathParam<Segment>
|
|
@@ -1350,9 +1347,9 @@ interface PageLinkDescriptor extends Omit<HtmlLinkDescriptor, "href" | "rel" | "
|
|
|
1350
1347
|
type LinkDescriptor = HtmlLinkDescriptor | PageLinkDescriptor;
|
|
1351
1348
|
|
|
1352
1349
|
interface RouteModules {
|
|
1353
|
-
[routeId: string]: RouteModule
|
|
1350
|
+
[routeId: string]: RouteModule | undefined;
|
|
1354
1351
|
}
|
|
1355
|
-
interface RouteModule
|
|
1352
|
+
interface RouteModule {
|
|
1356
1353
|
clientAction?: ClientActionFunction;
|
|
1357
1354
|
clientLoader?: ClientLoaderFunction;
|
|
1358
1355
|
ErrorBoundary?: ErrorBoundaryComponent;
|
|
@@ -1524,97 +1521,26 @@ type RouteComponent = ComponentType<{}>;
|
|
|
1524
1521
|
*/
|
|
1525
1522
|
type RouteHandle = unknown;
|
|
1526
1523
|
|
|
1527
|
-
/**
|
|
1528
|
-
* An object of unknown type for route loaders and actions provided by the
|
|
1529
|
-
* server's `getLoadContext()` function. This is defined as an empty interface
|
|
1530
|
-
* specifically so apps can leverage declaration merging to augment this type
|
|
1531
|
-
* globally: https://www.typescriptlang.org/docs/handbook/declaration-merging.html
|
|
1532
|
-
*/
|
|
1533
|
-
interface AppLoadContext {
|
|
1534
|
-
[key: string]: unknown;
|
|
1535
|
-
}
|
|
1536
|
-
|
|
1537
1524
|
type Serializable = undefined | null | boolean | string | symbol | number | Array<Serializable> | {
|
|
1538
1525
|
[key: PropertyKey]: Serializable;
|
|
1539
1526
|
} | bigint | Date | URL | RegExp | Error | Map<Serializable, Serializable> | Set<Serializable> | Promise<Serializable>;
|
|
1540
1527
|
|
|
1541
|
-
type Expect<T extends true> = T;
|
|
1542
1528
|
type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends (<T>() => T extends Y ? 1 : 2) ? true : false;
|
|
1543
1529
|
type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
1544
|
-
type
|
|
1545
|
-
type
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
default?: unknown;
|
|
1553
|
-
ErrorBoundary?: unknown;
|
|
1554
|
-
};
|
|
1530
|
+
type Func = (...args: any[]) => unknown;
|
|
1531
|
+
type Pretty<T> = {
|
|
1532
|
+
[K in keyof T]: T[K];
|
|
1533
|
+
} & {};
|
|
1534
|
+
|
|
1535
|
+
type Serialize<T> = T extends Serializable ? T : T extends (...args: any[]) => unknown ? undefined : T extends Promise<infer U> ? Promise<Serialize<U>> : T extends Map<infer K, infer V> ? Map<Serialize<K>, Serialize<V>> : T extends Set<infer U> ? Set<Serialize<U>> : T extends [] ? [] : T extends readonly [infer F, ...infer R] ? [Serialize<F>, ...Serialize<R>] : T extends Array<infer U> ? Array<Serialize<U>> : T extends readonly unknown[] ? readonly Serialize<T[number]>[] : T extends Record<any, any> ? {
|
|
1536
|
+
[K in keyof T]: Serialize<T[K]>;
|
|
1537
|
+
} : undefined;
|
|
1555
1538
|
type VoidToUndefined<T> = Equal<T, void> extends true ? undefined : T;
|
|
1556
|
-
type DataFrom<T> = IsAny<T> extends true ? undefined : T extends
|
|
1539
|
+
type DataFrom<T> = IsAny<T> extends true ? undefined : T extends Func ? VoidToUndefined<Awaited<ReturnType<T>>> : undefined;
|
|
1557
1540
|
type ClientData<T> = T extends DataWithResponseInit<infer U> ? U : T;
|
|
1558
1541
|
type ServerData<T> = T extends DataWithResponseInit<infer U> ? Serialize<U> : Serialize<T>;
|
|
1559
1542
|
type ServerDataFrom<T> = ServerData<DataFrom<T>>;
|
|
1560
1543
|
type ClientDataFrom<T> = ClientData<DataFrom<T>>;
|
|
1561
|
-
type
|
|
1562
|
-
hydrate: true;
|
|
1563
|
-
} ? true : ClientLoader extends {
|
|
1564
|
-
hydrate: false;
|
|
1565
|
-
} ? false : false;
|
|
1566
|
-
type CreateLoaderData<T extends RouteModule> = _CreateLoaderData<ServerDataFrom<T["loader"]>, ClientDataFrom<T["clientLoader"]>, IsHydrate<T["clientLoader"]>, T extends {
|
|
1567
|
-
HydrateFallback: Fn;
|
|
1568
|
-
} ? true : false>;
|
|
1569
|
-
type _CreateLoaderData<ServerLoaderData, ClientLoaderData, ClientLoaderHydrate extends boolean, HasHydrateFallback> = [
|
|
1570
|
-
HasHydrateFallback,
|
|
1571
|
-
ClientLoaderHydrate
|
|
1572
|
-
] extends [true, true] ? IsDefined<ClientLoaderData> extends true ? ClientLoaderData : undefined : [
|
|
1573
|
-
IsDefined<ClientLoaderData>,
|
|
1574
|
-
IsDefined<ServerLoaderData>
|
|
1575
|
-
] extends [true, true] ? ServerLoaderData | ClientLoaderData : IsDefined<ClientLoaderData> extends true ? ClientLoaderData : IsDefined<ServerLoaderData> extends true ? ServerLoaderData : undefined;
|
|
1576
|
-
type CreateActionData<T extends RouteModule> = _CreateActionData<ServerDataFrom<T["action"]>, ClientDataFrom<T["clientAction"]>>;
|
|
1577
|
-
type _CreateActionData<ServerActionData, ClientActionData> = Awaited<[
|
|
1578
|
-
IsDefined<ServerActionData>,
|
|
1579
|
-
IsDefined<ClientActionData>
|
|
1580
|
-
] extends [true, true] ? ServerActionData | ClientActionData : IsDefined<ClientActionData> extends true ? ClientActionData : IsDefined<ServerActionData> extends true ? ServerActionData : undefined>;
|
|
1581
|
-
type ClientDataFunctionArgs<Params> = {
|
|
1582
|
-
request: Request;
|
|
1583
|
-
params: Params;
|
|
1584
|
-
};
|
|
1585
|
-
type ServerDataFunctionArgs<Params> = ClientDataFunctionArgs<Params> & {
|
|
1586
|
-
context: AppLoadContext;
|
|
1587
|
-
};
|
|
1588
|
-
type Serialize<T> = T extends Serializable ? T : T extends (...args: any[]) => unknown ? undefined : T extends Promise<infer U> ? Promise<Serialize<U>> : T extends Map<infer K, infer V> ? Map<Serialize<K>, Serialize<V>> : T extends Set<infer U> ? Set<Serialize<U>> : T extends [] ? [] : T extends readonly [infer F, ...infer R] ? [Serialize<F>, ...Serialize<R>] : T extends Array<infer U> ? Array<Serialize<U>> : T extends readonly unknown[] ? readonly Serialize<T[number]>[] : T extends Record<any, any> ? {
|
|
1589
|
-
[K in keyof T]: Serialize<T[K]>;
|
|
1590
|
-
} : undefined;
|
|
1591
|
-
/**
|
|
1592
|
-
* @deprecated Generics on data APIs such as `useLoaderData`, `useActionData`,
|
|
1593
|
-
* `meta`, etc. are deprecated in favor of the `Route.*` types generated via
|
|
1594
|
-
* `react-router typegen`
|
|
1595
|
-
*/
|
|
1596
|
-
type SerializeFrom<T> = T extends (...args: infer Args) => unknown ? Args extends [ClientLoaderFunctionArgs | ClientActionFunctionArgs] ? ClientData<DataFrom<T>> : ServerData<DataFrom<T>> : T;
|
|
1597
|
-
type CreateServerLoaderArgs<Params> = ServerDataFunctionArgs<Params>;
|
|
1598
|
-
type CreateClientLoaderArgs<Params, T extends RouteModule> = ClientDataFunctionArgs<Params> & {
|
|
1599
|
-
serverLoader: () => Promise<ServerDataFrom<T["loader"]>>;
|
|
1600
|
-
};
|
|
1601
|
-
type CreateServerActionArgs<Params> = ServerDataFunctionArgs<Params>;
|
|
1602
|
-
type CreateClientActionArgs<Params, T extends RouteModule> = ClientDataFunctionArgs<Params> & {
|
|
1603
|
-
serverAction: () => Promise<ServerDataFrom<T["action"]>>;
|
|
1604
|
-
};
|
|
1605
|
-
type CreateHydrateFallbackProps<Params> = {
|
|
1606
|
-
params: Params;
|
|
1607
|
-
};
|
|
1608
|
-
type CreateComponentProps<Params, LoaderData, ActionData> = {
|
|
1609
|
-
params: Params;
|
|
1610
|
-
loaderData: LoaderData;
|
|
1611
|
-
actionData?: ActionData;
|
|
1612
|
-
};
|
|
1613
|
-
type CreateErrorBoundaryProps<Params, LoaderData, ActionData> = {
|
|
1614
|
-
params: Params;
|
|
1615
|
-
error: unknown;
|
|
1616
|
-
loaderData?: LoaderData;
|
|
1617
|
-
actionData?: ActionData;
|
|
1618
|
-
};
|
|
1544
|
+
type SerializeFrom<T> = T extends (...args: infer Args) => unknown ? Args extends [ClientLoaderFunctionArgs | ClientActionFunctionArgs] ? ClientDataFrom<T> : ServerDataFrom<T> : T;
|
|
1619
1545
|
|
|
1620
|
-
export { type
|
|
1546
|
+
export { type HTMLFormMethod as $, type ActionFunction as A, type BlockerFunction as B, type ClientActionFunction as C, type DataStrategyFunction as D, type RouterInit as E, type FutureConfig as F, type GetScrollPositionFunction as G, type HydrationState as H, type InitialEntry as I, type RouterSubscriber as J, type RouterNavigateOptions as K, type LoaderFunction as L, type MetaFunction as M, type NavigateOptions as N, type RouterFetchOptions as O, type ParamParseKey as P, type DataStrategyFunctionArgs as Q, type RouteModules as R, type SerializeFrom as S, type To as T, type UIMatch as U, type DataStrategyMatch as V, type DataStrategyResult as W, DataWithResponseInit as X, type ErrorResponse as Y, type FormEncType as Z, type FormMethod as _, type Router as a, type LazyRouteFunction as a0, type PathParam as a1, type RedirectFunction as a2, type ShouldRevalidateFunction as a3, type ShouldRevalidateFunctionArgs as a4, createPath as a5, parsePath as a6, IDLE_NAVIGATION as a7, IDLE_FETCHER as a8, IDLE_BLOCKER as a9, DataRouterContext as aA, DataRouterStateContext as aB, FetchersContext as aC, LocationContext as aD, NavigationContext as aE, RouteContext as aF, ViewTransitionContext as aG, type RouteModule as aH, type History as aI, type ServerDataFrom as aJ, type ClientDataFrom as aK, type Func as aL, type Equal as aM, type Pretty as aN, data as aa, generatePath as ab, isRouteErrorResponse as ac, matchPath as ad, matchRoutes as ae, redirect as af, redirectDocument as ag, replace as ah, resolvePath as ai, type DataRouteMatch as aj, type DataRouteObject as ak, type Navigator as al, type PatchRoutesOnNavigationFunction as am, type PatchRoutesOnNavigationFunctionArgs as an, type RouteMatch as ao, type ClientActionFunctionArgs as ap, type ClientLoaderFunctionArgs as aq, type MetaArgs as ar, type MetaDescriptor as as, type PageLinkDescriptor as at, type HtmlLinkDescriptor as au, type LinkDescriptor as av, createBrowserHistory as aw, invariant as ax, createRouter as ay, ErrorResponseImpl as az, type ClientLoaderFunction as b, type LinksFunction as c, type RouteManifest as d, type LoaderFunctionArgs as e, type ActionFunctionArgs as f, type RelativeRoutingType as g, type Location as h, Action as i, type Path as j, type PathPattern as k, type PathMatch as l, type Params as m, type RouteObject as n, type Navigation as o, type RevalidationState as p, type Blocker as q, type StaticHandlerContext as r, type StaticHandler as s, type CreateStaticHandlerOptions as t, type IndexRouteObject as u, type NonIndexRouteObject as v, type RouterState as w, type GetScrollRestorationKeyFunction as x, type Fetcher as y, type NavigationStates as z };
|