react-router 7.14.1 → 7.15.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 +105 -0
- package/dist/development/{browser-D-3-U2Jj.d.mts → browser-CRsXgNrY.d.mts} +2 -2
- package/dist/{production/browser-D-3-U2Jj.d.mts → development/browser-wDl1FZEL.d.ts} +2 -2
- package/dist/{production/chunk-3SUPTI2U.js → development/chunk-2D5H3HU3.js} +7 -7
- package/dist/development/{chunk-OE4NN4TA.mjs → chunk-5KNZJZUH.mjs} +362 -213
- package/dist/development/{chunk-YMKMFAYZ.js → chunk-AM3XM4LS.js} +314 -172
- package/dist/development/{chunk-BFXCU3MI.mjs → chunk-RMD3H4O3.mjs} +81 -62
- package/dist/development/{chunk-3F6IB66O.js → chunk-Z5YQYACE.js} +146 -139
- package/dist/{production/context-BzhbVly6.d.mts → development/context-BQs41HrG.d.mts} +94 -42
- package/dist/development/{routeModules-CM_clkdE.d.ts → data-BVUf681J.d.mts} +89 -56
- package/dist/{production/routeModules-CM_clkdE.d.ts → development/data-BqZ2x964.d.ts} +79 -46
- package/dist/development/dom-export.d.mts +9 -9
- package/dist/development/dom-export.d.ts +9 -9
- package/dist/development/dom-export.js +37 -40
- package/dist/development/dom-export.mjs +12 -15
- package/dist/development/{index-react-server-client-CimaPp9o.d.ts → index-react-server-client-CSv-KZBk.d.ts} +123 -121
- package/dist/{production/index-react-server-client-WSaoxloq.d.mts → development/index-react-server-client-Ck_yZ1qL.d.mts} +102 -100
- package/dist/development/index-react-server-client.d.mts +3 -3
- package/dist/development/index-react-server-client.d.ts +3 -3
- package/dist/development/index-react-server-client.js +4 -4
- package/dist/development/index-react-server-client.mjs +2 -2
- package/dist/development/index-react-server.d.mts +107 -36
- package/dist/development/index-react-server.d.ts +107 -36
- package/dist/development/index-react-server.js +60 -33
- package/dist/development/index-react-server.mjs +60 -33
- package/dist/development/index.d.mts +11 -11
- package/dist/development/index.d.ts +11 -11
- package/dist/development/index.js +174 -155
- package/dist/development/index.mjs +3 -3
- package/dist/{production/instrumentation-CMVbvxj9.d.ts → development/instrumentation-DlJ2QV7d.d.ts} +73 -21
- package/dist/development/lib/types/internal.d.mts +2 -2
- package/dist/development/lib/types/internal.d.ts +2 -2
- package/dist/development/lib/types/internal.js +1 -1
- package/dist/development/lib/types/internal.mjs +1 -1
- package/dist/development/{register-D1WlEpq9.d.ts → register-Bsscfj79.d.ts} +1 -1
- package/dist/{production/register-D1WlEpq9.d.ts → development/register-Df8okEea.d.mts} +1 -1
- package/dist/production/{browser-CtktEGQs.d.ts → browser-CRsXgNrY.d.mts} +2 -2
- package/dist/{development/browser-CtktEGQs.d.ts → production/browser-wDl1FZEL.d.ts} +2 -2
- package/dist/production/{chunk-G5ZWO7Q6.mjs → chunk-23ZOHYE5.mjs} +81 -62
- package/dist/{development/chunk-7VLQJKNG.js → production/chunk-7YXKJMLN.js} +7 -7
- package/dist/production/{chunk-SPR7R4GU.mjs → chunk-GM3PW4GX.mjs} +362 -213
- package/dist/production/{chunk-UVEQGZIH.js → chunk-LCJTIOKZ.js} +314 -172
- package/dist/production/{chunk-LIOP3ILM.js → chunk-YBQJ3ABE.js} +146 -139
- package/dist/{development/context-BzhbVly6.d.mts → production/context-BQs41HrG.d.mts} +94 -42
- package/dist/{development/routeModules-Djumx26z.d.mts → production/data-BVUf681J.d.mts} +79 -46
- package/dist/production/{routeModules-Djumx26z.d.mts → data-BqZ2x964.d.ts} +89 -56
- package/dist/production/dom-export.d.mts +9 -9
- package/dist/production/dom-export.d.ts +9 -9
- package/dist/production/dom-export.js +37 -40
- package/dist/production/dom-export.mjs +12 -15
- package/dist/production/{index-react-server-client-CimaPp9o.d.ts → index-react-server-client-CSv-KZBk.d.ts} +123 -121
- package/dist/{development/index-react-server-client-WSaoxloq.d.mts → production/index-react-server-client-Ck_yZ1qL.d.mts} +102 -100
- package/dist/production/index-react-server-client.d.mts +3 -3
- package/dist/production/index-react-server-client.d.ts +3 -3
- package/dist/production/index-react-server-client.js +4 -4
- package/dist/production/index-react-server-client.mjs +2 -2
- package/dist/production/index-react-server.d.mts +107 -36
- package/dist/production/index-react-server.d.ts +107 -36
- package/dist/production/index-react-server.js +60 -33
- package/dist/production/index-react-server.mjs +60 -33
- package/dist/production/index.d.mts +11 -11
- package/dist/production/index.d.ts +11 -11
- package/dist/production/index.js +174 -155
- package/dist/production/index.mjs +3 -3
- package/dist/{development/instrumentation-CMVbvxj9.d.ts → production/instrumentation-DlJ2QV7d.d.ts} +73 -21
- package/dist/production/lib/types/internal.d.mts +2 -2
- package/dist/production/lib/types/internal.d.ts +2 -2
- package/dist/production/lib/types/internal.js +1 -1
- package/dist/production/lib/types/internal.mjs +1 -1
- package/dist/{development/register-aE9ob3TK.d.mts → production/register-Bsscfj79.d.ts} +1 -1
- package/dist/production/{register-aE9ob3TK.d.mts → register-Df8okEea.d.mts} +1 -1
- package/package.json +1 -1
|
@@ -72,7 +72,7 @@ interface Location<State = any> extends Path {
|
|
|
72
72
|
* The masked location displayed in the URL bar, which differs from the URL the
|
|
73
73
|
* router is operating on
|
|
74
74
|
*/
|
|
75
|
-
|
|
75
|
+
mask?: Path;
|
|
76
76
|
}
|
|
77
77
|
/**
|
|
78
78
|
* A change to the current location.
|
|
@@ -445,19 +445,19 @@ interface DataFunctionArgs<Context> {
|
|
|
445
445
|
/** A {@link https://developer.mozilla.org/en-US/docs/Web/API/Request Fetch Request instance} which you can use to read headers (like cookies, and {@link https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams URLSearchParams} from the request. */
|
|
446
446
|
request: Request;
|
|
447
447
|
/**
|
|
448
|
-
* A URL instance representing the application location being navigated to or
|
|
449
|
-
*
|
|
450
|
-
*
|
|
451
|
-
*
|
|
452
|
-
*
|
|
453
|
-
*
|
|
448
|
+
* A URL instance representing the application location being navigated to or
|
|
449
|
+
* fetched. By default, this matches `request.url`.
|
|
450
|
+
*
|
|
451
|
+
* In Framework mode with `future.v8_passThroughRequests` enabled, this is a
|
|
452
|
+
* normalized URL with React-Router-specific implementation details removed
|
|
453
|
+
* (`.data` suffixes, `index`/`_routes` search params).
|
|
454
454
|
*/
|
|
455
|
-
|
|
455
|
+
url: URL;
|
|
456
456
|
/**
|
|
457
457
|
* Matched un-interpolated route pattern for the current path (i.e., /blog/:slug).
|
|
458
458
|
* Mostly useful as a identifier to aggregate on for logging/tracing/etc.
|
|
459
459
|
*/
|
|
460
|
-
|
|
460
|
+
pattern: string;
|
|
461
461
|
/**
|
|
462
462
|
* {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
|
|
463
463
|
* @example
|
|
@@ -846,13 +846,30 @@ type DataNonIndexRouteObject = NonIndexRouteObject & {
|
|
|
846
846
|
type DataRouteObject = DataIndexRouteObject | DataNonIndexRouteObject;
|
|
847
847
|
type RouteManifest<R = DataRouteObject> = Record<string, R | undefined>;
|
|
848
848
|
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";
|
|
849
|
-
type
|
|
849
|
+
type Regex_AZ = Uppercase<Regex_az>;
|
|
850
850
|
type Regex_09 = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9";
|
|
851
|
-
type Regex_w = Regex_az |
|
|
852
|
-
|
|
853
|
-
type RegexMatchPlus<
|
|
854
|
-
type
|
|
855
|
-
type
|
|
851
|
+
type Regex_w = Regex_az | Regex_AZ | Regex_09 | "_";
|
|
852
|
+
/** Emulates Regex `+` operator */
|
|
853
|
+
type RegexMatchPlus<char extends string, T extends string> = _RegexMatchPlus<char, T> extends infer result extends string ? result extends '' ? never : result : never;
|
|
854
|
+
type _RegexMatchPlus<char extends string, T extends string> = T extends `${infer head extends char}${infer rest}` ? `${head}${_RegexMatchPlus<char, rest>}` : '';
|
|
855
|
+
type ParamNameChar = Regex_w | "-";
|
|
856
|
+
type Simplify<T> = {
|
|
857
|
+
[K in keyof T]: T[K];
|
|
858
|
+
} & {};
|
|
859
|
+
type GeneratePathParams<path extends string> = Simplify<ParseParams<path> & {
|
|
860
|
+
[key in string]: string | null | undefined;
|
|
861
|
+
}>;
|
|
862
|
+
type ParseParams<path extends string> = path extends '*' ? {
|
|
863
|
+
'*': string;
|
|
864
|
+
} : path extends `${infer rest}/*` ? {
|
|
865
|
+
'*': string;
|
|
866
|
+
} & ParseParams<rest> : _ParseParams<path>;
|
|
867
|
+
type _ParseParams<path extends string> = path extends `${infer left}/${infer right}` ? _ParseParams<left> & _ParseParams<right> : path extends `:${infer param}?${string}` ? {
|
|
868
|
+
[key in RegexMatchPlus<ParamNameChar, param>]?: string | null | undefined;
|
|
869
|
+
} : path extends `:${infer param}` ? {
|
|
870
|
+
[key in RegexMatchPlus<ParamNameChar, param>]: string;
|
|
871
|
+
} : {};
|
|
872
|
+
type PathParam<path extends string> = (keyof ParseParams<path>) & string;
|
|
856
873
|
type ParamParseKey<Segment extends string> = [
|
|
857
874
|
PathParam<Segment>
|
|
858
875
|
] extends [never] ? string : PathParam<Segment>;
|
|
@@ -939,6 +956,24 @@ interface UIMatch<Data = unknown, Handle = unknown> {
|
|
|
939
956
|
*/
|
|
940
957
|
handle: Handle;
|
|
941
958
|
}
|
|
959
|
+
interface RouteMeta<RouteObjectType extends RouteObject = RouteObject> {
|
|
960
|
+
relativePath: string;
|
|
961
|
+
caseSensitive: boolean;
|
|
962
|
+
childrenIndex: number;
|
|
963
|
+
route: RouteObjectType;
|
|
964
|
+
}
|
|
965
|
+
/**
|
|
966
|
+
* @private
|
|
967
|
+
* PRIVATE - DO NOT USE
|
|
968
|
+
*
|
|
969
|
+
* A "branch" of routes that match a given route pattern.
|
|
970
|
+
* This is an internal interface not intended for direct external usage.
|
|
971
|
+
*/
|
|
972
|
+
interface RouteBranch<RouteObjectType extends RouteObject = RouteObject> {
|
|
973
|
+
path: string;
|
|
974
|
+
score: number;
|
|
975
|
+
routesMeta: RouteMeta<RouteObjectType>[];
|
|
976
|
+
}
|
|
942
977
|
/**
|
|
943
978
|
* Returns a path with params interpolated.
|
|
944
979
|
*
|
|
@@ -953,9 +988,7 @@ interface UIMatch<Data = unknown, Handle = unknown> {
|
|
|
953
988
|
* @param params The parameters to interpolate into the path.
|
|
954
989
|
* @returns The generated path with parameters interpolated.
|
|
955
990
|
*/
|
|
956
|
-
declare function generatePath<Path extends string>(originalPath: Path, params?:
|
|
957
|
-
[key in PathParam<Path>]: string | null;
|
|
958
|
-
}): string;
|
|
991
|
+
declare function generatePath<Path extends string>(originalPath: Path, params?: GeneratePathParams<Path>): string;
|
|
959
992
|
/**
|
|
960
993
|
* Used to match on some portion of a URL pathname.
|
|
961
994
|
*/
|
|
@@ -1011,7 +1044,7 @@ interface PathMatch<ParamKey extends string = string> {
|
|
|
1011
1044
|
* @returns A path match object if the pattern matches the pathname,
|
|
1012
1045
|
* or `null` if it does not match.
|
|
1013
1046
|
*/
|
|
1014
|
-
declare function matchPath<
|
|
1047
|
+
declare function matchPath<Path extends string>(pattern: PathPattern<Path> | Path, pathname: string): PathMatch<ParamParseKey<Path>> | null;
|
|
1015
1048
|
/**
|
|
1016
1049
|
* Returns a resolved {@link Path} object relative to the given pathname.
|
|
1017
1050
|
*
|
|
@@ -1199,16 +1232,6 @@ declare class ErrorResponseImpl implements ErrorResponse {
|
|
|
1199
1232
|
*/
|
|
1200
1233
|
declare function isRouteErrorResponse(error: any): error is ErrorResponse;
|
|
1201
1234
|
|
|
1202
|
-
/**
|
|
1203
|
-
* An object of unknown type for route loaders and actions provided by the
|
|
1204
|
-
* server's `getLoadContext()` function. This is defined as an empty interface
|
|
1205
|
-
* specifically so apps can leverage declaration merging to augment this type
|
|
1206
|
-
* globally: https://www.typescriptlang.org/docs/handbook/declaration-merging.html
|
|
1207
|
-
*/
|
|
1208
|
-
interface AppLoadContext {
|
|
1209
|
-
[key: string]: unknown;
|
|
1210
|
-
}
|
|
1211
|
-
|
|
1212
1235
|
type Primitive = null | undefined | string | number | boolean | symbol | bigint;
|
|
1213
1236
|
type LiteralUnion<LiteralType, BaseType extends Primitive> = LiteralType | (BaseType & Record<never, never>);
|
|
1214
1237
|
interface HtmlLinkProps {
|
|
@@ -1380,14 +1403,14 @@ type ClientDataFunctionArgs<Params> = {
|
|
|
1380
1403
|
**/
|
|
1381
1404
|
request: Request;
|
|
1382
1405
|
/**
|
|
1383
|
-
* A URL instance representing the application location being navigated to or
|
|
1384
|
-
*
|
|
1385
|
-
*
|
|
1386
|
-
*
|
|
1387
|
-
*
|
|
1388
|
-
*
|
|
1406
|
+
* A URL instance representing the application location being navigated to or
|
|
1407
|
+
* fetched. By default, this matches `request.url`.
|
|
1408
|
+
*
|
|
1409
|
+
* In Framework mode with `future.v8_passThroughRequests` enabled, this is a
|
|
1410
|
+
* normalized URL with React-Router-specific implementation details removed
|
|
1411
|
+
* (`.data` suffixes, `index`/`_routes` search params).
|
|
1389
1412
|
*/
|
|
1390
|
-
|
|
1413
|
+
url: URL;
|
|
1391
1414
|
/**
|
|
1392
1415
|
* {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
|
|
1393
1416
|
* @example
|
|
@@ -1407,7 +1430,7 @@ type ClientDataFunctionArgs<Params> = {
|
|
|
1407
1430
|
* Matched un-interpolated route pattern for the current path (i.e., /blog/:slug).
|
|
1408
1431
|
* Mostly useful as a identifier to aggregate on for logging/tracing/etc.
|
|
1409
1432
|
*/
|
|
1410
|
-
|
|
1433
|
+
pattern: string;
|
|
1411
1434
|
/**
|
|
1412
1435
|
* When `future.v8_middleware` is not enabled, this is undefined.
|
|
1413
1436
|
*
|
|
@@ -1422,14 +1445,14 @@ type ServerDataFunctionArgs<Params> = {
|
|
|
1422
1445
|
/** A {@link https://developer.mozilla.org/en-US/docs/Web/API/Request Fetch Request instance} which you can use to read the url, method, headers (such as cookies), and request body from the request. */
|
|
1423
1446
|
request: Request;
|
|
1424
1447
|
/**
|
|
1425
|
-
* A URL instance representing the application location being navigated to or
|
|
1426
|
-
*
|
|
1427
|
-
*
|
|
1428
|
-
*
|
|
1429
|
-
*
|
|
1430
|
-
*
|
|
1448
|
+
* A URL instance representing the application location being navigated to or
|
|
1449
|
+
* fetched. By default, this matches `request.url`.
|
|
1450
|
+
*
|
|
1451
|
+
* In Framework mode with `future.v8_passThroughRequests` enabled, this is a
|
|
1452
|
+
* normalized URL with React-Router-specific implementation details removed
|
|
1453
|
+
* (`.data` suffixes, `index`/`_routes` search params).
|
|
1431
1454
|
*/
|
|
1432
|
-
|
|
1455
|
+
url: URL;
|
|
1433
1456
|
/**
|
|
1434
1457
|
* {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
|
|
1435
1458
|
* @example
|
|
@@ -1449,7 +1472,7 @@ type ServerDataFunctionArgs<Params> = {
|
|
|
1449
1472
|
* Matched un-interpolated route pattern for the current path (i.e., /blog/:slug).
|
|
1450
1473
|
* Mostly useful as a identifier to aggregate on for logging/tracing/etc.
|
|
1451
1474
|
*/
|
|
1452
|
-
|
|
1475
|
+
pattern: string;
|
|
1453
1476
|
/**
|
|
1454
1477
|
* Without `future.v8_middleware` enabled, this is the context passed in
|
|
1455
1478
|
* to your server adapter's `getLoadContext` function. It's a way to bridge the
|
|
@@ -1696,4 +1719,14 @@ type RouteComponent = ComponentType<{}>;
|
|
|
1696
1719
|
*/
|
|
1697
1720
|
type RouteHandle = unknown;
|
|
1698
1721
|
|
|
1699
|
-
|
|
1722
|
+
/**
|
|
1723
|
+
* An object of unknown type for route loaders and actions provided by the
|
|
1724
|
+
* server's `getLoadContext()` function. This is defined as an empty interface
|
|
1725
|
+
* specifically so apps can leverage declaration merging to augment this type
|
|
1726
|
+
* globally: https://www.typescriptlang.org/docs/handbook/declaration-merging.html
|
|
1727
|
+
*/
|
|
1728
|
+
interface AppLoadContext {
|
|
1729
|
+
[key: string]: unknown;
|
|
1730
|
+
}
|
|
1731
|
+
|
|
1732
|
+
export { type Equal as $, type ActionFunction as A, type MiddlewareNextFunction as B, type ClientActionFunction as C, type DataRouteMatch as D, type ClientDataFunctionArgs as E, type FormEncType as F, type GetLoaderData as G, type HeadersFunction as H, type DataStrategyResult as I, type ServerDataFrom as J, type GetActionData as K, type Location as L, type MetaFunction as M, type Normalize as N, type RouteModules as O, type Params as P, type SerializeFrom as Q, type RouteModule$1 as R, type ShouldRevalidateFunction as S, type To as T, type UIMatch as U, type PathPattern as V, type PathMatch as W, type ParamParseKey as X, type InitialEntry as Y, type IndexRouteObject as Z, type NonIndexRouteObject as _, type ClientLoaderFunction as a, type ActionFunctionArgs as a0, type BaseRouteObject as a1, type DataStrategyFunctionArgs as a2, type DataStrategyMatch as a3, DataWithResponseInit as a4, type ErrorResponse as a5, type FormMethod as a6, type LazyRouteFunction as a7, type MiddlewareFunction as a8, type PatchRoutesOnNavigationFunctionArgs as a9, createBrowserHistory as aA, createHashHistory as aB, invariant as aC, ErrorResponseImpl as aD, type ServerRouteModule as aE, type TrackedPromise as aF, type PathParam as aa, type RedirectFunction as ab, type RouteMatch as ac, type RouterContext as ad, type ShouldRevalidateFunctionArgs as ae, createContext as af, createPath as ag, parsePath as ah, data as ai, generatePath as aj, isRouteErrorResponse as ak, matchPath as al, matchRoutes as am, redirect as an, redirectDocument as ao, replace as ap, resolvePath as aq, type ClientActionFunctionArgs as ar, type ClientLoaderFunctionArgs as as, type HeadersArgs as at, type MetaArgs as au, type PageLinkDescriptor as av, type HtmlLinkDescriptor as aw, type Future as ax, type unstable_SerializesTo as ay, createMemoryHistory as az, type LinksFunction as b, RouterContextProvider as c, type LoaderFunction as d, type RouteObject as e, type History as f, type MaybePromise as g, type MapRoutePropertiesFunction as h, Action as i, type Submission as j, type RouteData as k, type DataStrategyFunction as l, type PatchRoutesOnNavigationFunction as m, type DataRouteObject as n, type RouteBranch as o, type RouteManifest as p, type HTMLFormMethod as q, type Path as r, type LoaderFunctionArgs as s, type MiddlewareEnabled as t, type AppLoadContext as u, type LinkDescriptor as v, type Func as w, type Pretty as x, type MetaDescriptor as y, type ServerDataFunctionArgs as z };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { a as RouterProviderProps$1, R as RouterInit,
|
|
3
|
-
export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-
|
|
4
|
-
import './
|
|
2
|
+
import { a as RouterProviderProps$1, R as RouterInit, C as ClientInstrumentation, b as ClientOnErrorFunction } from './context-BQs41HrG.mjs';
|
|
3
|
+
export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-CRsXgNrY.mjs';
|
|
4
|
+
import './data-BVUf681J.mjs';
|
|
5
5
|
|
|
6
6
|
type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
|
|
7
|
-
declare function RouterProvider(props:
|
|
7
|
+
declare function RouterProvider(props: RouterProviderProps): React.JSX.Element;
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Props for the {@link dom.HydratedRouter} component.
|
|
@@ -65,12 +65,12 @@ interface HydratedRouterProps {
|
|
|
65
65
|
* startTransition(() => {
|
|
66
66
|
* hydrateRoot(
|
|
67
67
|
* document,
|
|
68
|
-
* <HydratedRouter
|
|
68
|
+
* <HydratedRouter instrumentations={[logging]} />
|
|
69
69
|
* );
|
|
70
70
|
* });
|
|
71
71
|
* ```
|
|
72
72
|
*/
|
|
73
|
-
|
|
73
|
+
instrumentations?: ClientInstrumentation[];
|
|
74
74
|
/**
|
|
75
75
|
* An error handler function that will be called for any middleware, loader, action,
|
|
76
76
|
* or render errors that are encountered in your application. This is useful for
|
|
@@ -83,7 +83,7 @@ interface HydratedRouterProps {
|
|
|
83
83
|
*
|
|
84
84
|
* ```tsx
|
|
85
85
|
* <HydratedRouter onError=(error, info) => {
|
|
86
|
-
* let { location, params,
|
|
86
|
+
* let { location, params, pattern, errorInfo } = info;
|
|
87
87
|
* console.error(error, location, errorInfo);
|
|
88
88
|
* reportToErrorService(error, location, errorInfo);
|
|
89
89
|
* }} />
|
|
@@ -106,9 +106,9 @@ interface HydratedRouterProps {
|
|
|
106
106
|
* - When set to `false`, the router will not leverage `React.startTransition` or
|
|
107
107
|
* `React.useOptimistic` on any navigations or state changes.
|
|
108
108
|
*
|
|
109
|
-
* For more information, please see the [docs](
|
|
109
|
+
* For more information, please see the [docs](../../explanation/react-transitions).
|
|
110
110
|
*/
|
|
111
|
-
|
|
111
|
+
useTransitions?: boolean;
|
|
112
112
|
}
|
|
113
113
|
/**
|
|
114
114
|
* Framework-mode router component to be used to hydrate a router from a
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { RouterProviderProps as RouterProviderProps$1, RouterInit, ClientOnErrorFunction } from 'react-router';
|
|
3
|
-
import {
|
|
4
|
-
export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-
|
|
5
|
-
import './
|
|
3
|
+
import { C as ClientInstrumentation } from './instrumentation-DlJ2QV7d.js';
|
|
4
|
+
export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-wDl1FZEL.js';
|
|
5
|
+
import './data-BqZ2x964.js';
|
|
6
6
|
|
|
7
7
|
type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
|
|
8
|
-
declare function RouterProvider(props:
|
|
8
|
+
declare function RouterProvider(props: RouterProviderProps): React.JSX.Element;
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Props for the {@link dom.HydratedRouter} component.
|
|
@@ -66,12 +66,12 @@ interface HydratedRouterProps {
|
|
|
66
66
|
* startTransition(() => {
|
|
67
67
|
* hydrateRoot(
|
|
68
68
|
* document,
|
|
69
|
-
* <HydratedRouter
|
|
69
|
+
* <HydratedRouter instrumentations={[logging]} />
|
|
70
70
|
* );
|
|
71
71
|
* });
|
|
72
72
|
* ```
|
|
73
73
|
*/
|
|
74
|
-
|
|
74
|
+
instrumentations?: ClientInstrumentation[];
|
|
75
75
|
/**
|
|
76
76
|
* An error handler function that will be called for any middleware, loader, action,
|
|
77
77
|
* or render errors that are encountered in your application. This is useful for
|
|
@@ -84,7 +84,7 @@ interface HydratedRouterProps {
|
|
|
84
84
|
*
|
|
85
85
|
* ```tsx
|
|
86
86
|
* <HydratedRouter onError=(error, info) => {
|
|
87
|
-
* let { location, params,
|
|
87
|
+
* let { location, params, pattern, errorInfo } = info;
|
|
88
88
|
* console.error(error, location, errorInfo);
|
|
89
89
|
* reportToErrorService(error, location, errorInfo);
|
|
90
90
|
* }} />
|
|
@@ -107,9 +107,9 @@ interface HydratedRouterProps {
|
|
|
107
107
|
* - When set to `false`, the router will not leverage `React.startTransition` or
|
|
108
108
|
* `React.useOptimistic` on any navigations or state changes.
|
|
109
109
|
*
|
|
110
|
-
* For more information, please see the [docs](
|
|
110
|
+
* For more information, please see the [docs](../../explanation/react-transitions).
|
|
111
111
|
*/
|
|
112
|
-
|
|
112
|
+
useTransitions?: boolean;
|
|
113
113
|
}
|
|
114
114
|
/**
|
|
115
115
|
* Framework-mode router component to be used to hydrate a router from a
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }/**
|
|
2
|
-
* react-router v7.
|
|
2
|
+
* react-router v7.15.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _chunk2D5H3HU3js = require('./chunk-2D5H3HU3.js');
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
@@ -33,7 +33,8 @@ var _chunk7VLQJKNGjs = require('./chunk-7VLQJKNG.js');
|
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
|
|
37
|
+
var _chunkAM3XM4LSjs = require('./chunk-AM3XM4LS.js');
|
|
37
38
|
|
|
38
39
|
// lib/dom-export/dom-router-provider.tsx
|
|
39
40
|
var _react = require('react'); var React = _interopRequireWildcard(_react); var React2 = _interopRequireWildcard(_react); var React3 = _interopRequireWildcard(_react);
|
|
@@ -90,7 +91,7 @@ function initSsrInfo() {
|
|
|
90
91
|
}
|
|
91
92
|
function createHydratedRouter({
|
|
92
93
|
getContext,
|
|
93
|
-
|
|
94
|
+
instrumentations
|
|
94
95
|
}) {
|
|
95
96
|
initSsrInfo();
|
|
96
97
|
if (!ssrInfo) {
|
|
@@ -163,10 +164,10 @@ function createHydratedRouter({
|
|
|
163
164
|
getContext,
|
|
164
165
|
hydrationData,
|
|
165
166
|
hydrationRouteProperties: _reactrouter.UNSAFE_hydrationRouteProperties,
|
|
166
|
-
|
|
167
|
+
instrumentations,
|
|
167
168
|
mapRouteProperties: _reactrouter.UNSAFE_mapRouteProperties,
|
|
168
169
|
future: {
|
|
169
|
-
|
|
170
|
+
v8_passThroughRequests: ssrInfo.context.future.v8_passThroughRequests
|
|
170
171
|
},
|
|
171
172
|
dataStrategy: _reactrouter.UNSAFE_getTurboStreamSingleFetchDataStrategy.call(void 0,
|
|
172
173
|
() => router2,
|
|
@@ -200,7 +201,7 @@ function HydratedRouter(props) {
|
|
|
200
201
|
if (!router) {
|
|
201
202
|
router = createHydratedRouter({
|
|
202
203
|
getContext: props.getContext,
|
|
203
|
-
|
|
204
|
+
instrumentations: props.instrumentations
|
|
204
205
|
});
|
|
205
206
|
}
|
|
206
207
|
let [criticalCss, setCriticalCss] = React2.useState(
|
|
@@ -213,7 +214,7 @@ function HydratedRouter(props) {
|
|
|
213
214
|
}, []);
|
|
214
215
|
React2.useEffect(() => {
|
|
215
216
|
if (process.env.NODE_ENV === "development" && criticalCss === void 0) {
|
|
216
|
-
document.querySelectorAll(`[${
|
|
217
|
+
document.querySelectorAll(`[${_chunkAM3XM4LSjs.CRITICAL_CSS_DATA_ATTRIBUTE}]`).forEach((element) => element.remove());
|
|
217
218
|
}
|
|
218
219
|
}, [criticalCss]);
|
|
219
220
|
let [location2, setLocation] = React2.useState(router.state.location);
|
|
@@ -261,7 +262,7 @@ function HydratedRouter(props) {
|
|
|
261
262
|
RouterProvider2,
|
|
262
263
|
{
|
|
263
264
|
router,
|
|
264
|
-
|
|
265
|
+
useTransitions: props.useTransitions,
|
|
265
266
|
onError: props.onError
|
|
266
267
|
}
|
|
267
268
|
))
|
|
@@ -392,7 +393,7 @@ function createRouterFromPayload({
|
|
|
392
393
|
};
|
|
393
394
|
if (payload.type !== "render") throw new Error("Invalid payload type");
|
|
394
395
|
globalVar.__reactRouterRouteModules = _nullishCoalesce(globalVar.__reactRouterRouteModules, () => ( {}));
|
|
395
|
-
|
|
396
|
+
_chunk2D5H3HU3js.populateRSCRouteModules.call(void 0, globalVar.__reactRouterRouteModules, payload.matches);
|
|
396
397
|
let routes = payload.matches.reduceRight((previous, match) => {
|
|
397
398
|
const route = createRouteFromServerManifest(
|
|
398
399
|
match,
|
|
@@ -406,12 +407,12 @@ function createRouterFromPayload({
|
|
|
406
407
|
return [route];
|
|
407
408
|
}, []);
|
|
408
409
|
let applyPatchesPromise;
|
|
409
|
-
globalVar.__reactRouterDataRouter =
|
|
410
|
+
globalVar.__reactRouterDataRouter = _chunkAM3XM4LSjs.createRouter.call(void 0, {
|
|
410
411
|
routes,
|
|
411
412
|
getContext,
|
|
412
413
|
basename: payload.basename,
|
|
413
|
-
history:
|
|
414
|
-
hydrationData:
|
|
414
|
+
history: _chunkAM3XM4LSjs.createBrowserHistory.call(void 0, ),
|
|
415
|
+
hydrationData: _chunk2D5H3HU3js.getHydrationData.call(void 0, {
|
|
415
416
|
state: {
|
|
416
417
|
loaderData: payload.loaderData,
|
|
417
418
|
actionData: payload.actionData,
|
|
@@ -420,7 +421,7 @@ function createRouterFromPayload({
|
|
|
420
421
|
routes,
|
|
421
422
|
getRouteInfo: (routeId) => {
|
|
422
423
|
let match = payload.matches.find((m) => m.id === routeId);
|
|
423
|
-
|
|
424
|
+
_chunkAM3XM4LSjs.invariant.call(void 0, match, "Route not found in payload");
|
|
424
425
|
return {
|
|
425
426
|
clientLoader: match.clientLoader,
|
|
426
427
|
hasLoader: match.hasLoader,
|
|
@@ -535,9 +536,9 @@ function createRouterFromPayload({
|
|
|
535
536
|
routeModules: globalVar.__reactRouterRouteModules
|
|
536
537
|
};
|
|
537
538
|
}
|
|
538
|
-
var renderedRoutesContext =
|
|
539
|
+
var renderedRoutesContext = _chunkAM3XM4LSjs.createContext.call(void 0, );
|
|
539
540
|
function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, createFromReadableStream, fetchImplementation) {
|
|
540
|
-
let dataStrategy =
|
|
541
|
+
let dataStrategy = _chunkAM3XM4LSjs.getSingleFetchDataStrategyImpl.call(void 0,
|
|
541
542
|
getRouter,
|
|
542
543
|
(match) => {
|
|
543
544
|
let M = match;
|
|
@@ -546,8 +547,7 @@ function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, createFromReada
|
|
|
546
547
|
hasClientLoader: M.route.hasClientLoader,
|
|
547
548
|
hasComponent: M.route.hasComponent,
|
|
548
549
|
hasAction: M.route.hasAction,
|
|
549
|
-
hasClientAction: M.route.hasClientAction
|
|
550
|
-
hasShouldRevalidate: M.route.hasShouldRevalidate
|
|
550
|
+
hasClientAction: M.route.hasClientAction
|
|
551
551
|
};
|
|
552
552
|
},
|
|
553
553
|
// pass map into fetchAndDecode so it can add payloads
|
|
@@ -595,20 +595,20 @@ function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, createFromReada
|
|
|
595
595
|
function getFetchAndDecodeViaRSC(createFromReadableStream, fetchImplementation) {
|
|
596
596
|
return async (args, basename, trailingSlashAware, targetRoutes) => {
|
|
597
597
|
let { request, context } = args;
|
|
598
|
-
let url =
|
|
598
|
+
let url = _chunkAM3XM4LSjs.singleFetchUrl.call(void 0, request.url, basename, trailingSlashAware, "rsc");
|
|
599
599
|
if (request.method === "GET") {
|
|
600
|
-
url =
|
|
600
|
+
url = _chunkAM3XM4LSjs.stripIndexParam.call(void 0, url);
|
|
601
601
|
if (targetRoutes) {
|
|
602
602
|
url.searchParams.set("_routes", targetRoutes.join(","));
|
|
603
603
|
}
|
|
604
604
|
}
|
|
605
605
|
let res = await fetchImplementation(
|
|
606
|
-
new Request(url, await
|
|
606
|
+
new Request(url, await _chunkAM3XM4LSjs.createRequestInit.call(void 0, request))
|
|
607
607
|
);
|
|
608
608
|
if (res.status >= 400 && !res.headers.has("X-Remix-Response")) {
|
|
609
|
-
throw new (0,
|
|
609
|
+
throw new (0, _chunkAM3XM4LSjs.ErrorResponseImpl)(res.status, res.statusText, await res.text());
|
|
610
610
|
}
|
|
611
|
-
|
|
611
|
+
_chunkAM3XM4LSjs.invariant.call(void 0, res.body, "No response body to decode");
|
|
612
612
|
try {
|
|
613
613
|
const payload = await createFromReadableStream(res.body, {
|
|
614
614
|
temporaryReferences: void 0
|
|
@@ -632,7 +632,7 @@ function getFetchAndDecodeViaRSC(createFromReadableStream, fetchImplementation)
|
|
|
632
632
|
}
|
|
633
633
|
context.get(renderedRoutesContext).push(...payload.matches);
|
|
634
634
|
let results = { routes: {} };
|
|
635
|
-
const dataKey =
|
|
635
|
+
const dataKey = _chunkAM3XM4LSjs.isMutationMethod.call(void 0, request.method) ? "actionData" : "loaderData";
|
|
636
636
|
for (let [routeId, data] of Object.entries(payload[dataKey] || {})) {
|
|
637
637
|
results.routes[routeId] = { data };
|
|
638
638
|
}
|
|
@@ -665,7 +665,7 @@ function RSCHydratedRouter({
|
|
|
665
665
|
[createFromReadableStream, payload, fetchImplementation, getContext]
|
|
666
666
|
);
|
|
667
667
|
React3.useEffect(() => {
|
|
668
|
-
|
|
668
|
+
_chunkAM3XM4LSjs.setIsHydrated.call(void 0, );
|
|
669
669
|
}, []);
|
|
670
670
|
React3.useLayoutEffect(() => {
|
|
671
671
|
const globalVar = window;
|
|
@@ -750,10 +750,9 @@ function RSCHydratedRouter({
|
|
|
750
750
|
// These flags have no runtime impact so can always be false. If we add
|
|
751
751
|
// flags that drive runtime behavior they'll need to be proxied through.
|
|
752
752
|
v8_middleware: false,
|
|
753
|
-
unstable_subResourceIntegrity: false,
|
|
754
753
|
unstable_trailingSlashAwareDataRequests: true,
|
|
755
754
|
// always on for RSC
|
|
756
|
-
|
|
755
|
+
v8_passThroughRequests: true
|
|
757
756
|
// always on for RSC
|
|
758
757
|
},
|
|
759
758
|
isSpaMode: false,
|
|
@@ -774,8 +773,8 @@ function RSCHydratedRouter({
|
|
|
774
773
|
},
|
|
775
774
|
routeModules
|
|
776
775
|
};
|
|
777
|
-
return /* @__PURE__ */ React3.createElement(
|
|
778
|
-
|
|
776
|
+
return /* @__PURE__ */ React3.createElement(_chunkAM3XM4LSjs.RSCRouterContext.Provider, { value: true }, /* @__PURE__ */ React3.createElement(_chunk2D5H3HU3js.RSCRouterGlobalErrorBoundary, { location: state.location }, /* @__PURE__ */ React3.createElement(_chunkAM3XM4LSjs.FrameworkContext.Provider, { value: frameworkContext }, /* @__PURE__ */ React3.createElement(
|
|
777
|
+
_chunkAM3XM4LSjs.RouterProvider,
|
|
779
778
|
{
|
|
780
779
|
router: transitionEnabledRouter,
|
|
781
780
|
flushSync: ReactDOM2.flushSync
|
|
@@ -791,8 +790,8 @@ function createRouteFromServerManifest(match, payload) {
|
|
|
791
790
|
// the server loader flow regardless of whether the client loader calls
|
|
792
791
|
// `serverLoader` or not, otherwise we'll have nothing to render.
|
|
793
792
|
match.hasComponent && !match.element;
|
|
794
|
-
|
|
795
|
-
|
|
793
|
+
_chunkAM3XM4LSjs.invariant.call(void 0, window.__reactRouterRouteModules);
|
|
794
|
+
_chunk2D5H3HU3js.populateRSCRouteModules.call(void 0, window.__reactRouterRouteModules, match);
|
|
796
795
|
let dataRoute = {
|
|
797
796
|
id: match.id,
|
|
798
797
|
element: match.element,
|
|
@@ -842,7 +841,7 @@ function createRouteFromServerManifest(match, payload) {
|
|
|
842
841
|
return await callSingleFetch(singleFetch);
|
|
843
842
|
}
|
|
844
843
|
}) : match.hasAction ? (_, singleFetch) => callSingleFetch(singleFetch) : () => {
|
|
845
|
-
throw
|
|
844
|
+
throw _chunkAM3XM4LSjs.noActionDefinedError.call(void 0, "action", match.id);
|
|
846
845
|
},
|
|
847
846
|
path: match.path,
|
|
848
847
|
shouldRevalidate: match.shouldRevalidate,
|
|
@@ -851,11 +850,10 @@ function createRouteFromServerManifest(match, payload) {
|
|
|
851
850
|
hasLoader: true,
|
|
852
851
|
hasClientLoader: match.clientLoader != null,
|
|
853
852
|
hasAction: match.hasAction,
|
|
854
|
-
hasClientAction: match.clientAction != null
|
|
855
|
-
hasShouldRevalidate: match.shouldRevalidate != null
|
|
853
|
+
hasClientAction: match.clientAction != null
|
|
856
854
|
};
|
|
857
855
|
if (typeof dataRoute.loader === "function") {
|
|
858
|
-
dataRoute.loader.hydrate =
|
|
856
|
+
dataRoute.loader.hydrate = _chunkAM3XM4LSjs.shouldHydrateRouteLoader.call(void 0,
|
|
859
857
|
match.id,
|
|
860
858
|
match.clientLoader,
|
|
861
859
|
match.hasLoader,
|
|
@@ -865,7 +863,7 @@ function createRouteFromServerManifest(match, payload) {
|
|
|
865
863
|
return dataRoute;
|
|
866
864
|
}
|
|
867
865
|
function callSingleFetch(singleFetch) {
|
|
868
|
-
|
|
866
|
+
_chunkAM3XM4LSjs.invariant.call(void 0, typeof singleFetch === "function", "Invalid singleFetch parameter");
|
|
869
867
|
return singleFetch();
|
|
870
868
|
}
|
|
871
869
|
function preventInvalidServerHandlerCall(type, routeId, hasHandler) {
|
|
@@ -873,13 +871,12 @@ function preventInvalidServerHandlerCall(type, routeId, hasHandler) {
|
|
|
873
871
|
let fn = type === "action" ? "serverAction()" : "serverLoader()";
|
|
874
872
|
let msg = `You are trying to call ${fn} on a route that does not have a server ${type} (routeId: "${routeId}")`;
|
|
875
873
|
console.error(msg);
|
|
876
|
-
throw new (0,
|
|
874
|
+
throw new (0, _chunkAM3XM4LSjs.ErrorResponseImpl)(400, "Bad Request", new Error(msg), true);
|
|
877
875
|
}
|
|
878
876
|
}
|
|
879
877
|
var nextPaths = /* @__PURE__ */ new Set();
|
|
880
878
|
var discoveredPathsMaxSize = 1e3;
|
|
881
879
|
var discoveredPaths = /* @__PURE__ */ new Set();
|
|
882
|
-
var URL_LIMIT = 7680;
|
|
883
880
|
function getManifestUrl(paths) {
|
|
884
881
|
if (paths.length === 0) {
|
|
885
882
|
return null;
|
|
@@ -901,7 +898,7 @@ async function fetchAndApplyManifestPatches(paths, createFromReadableStream, fet
|
|
|
901
898
|
if (url == null) {
|
|
902
899
|
return;
|
|
903
900
|
}
|
|
904
|
-
if (url.toString().length > URL_LIMIT) {
|
|
901
|
+
if (url.toString().length > _chunkAM3XM4LSjs.URL_LIMIT) {
|
|
905
902
|
nextPaths.clear();
|
|
906
903
|
return;
|
|
907
904
|
}
|
|
@@ -946,7 +943,7 @@ function isExternalLocation(location2) {
|
|
|
946
943
|
}
|
|
947
944
|
function hasInvalidProtocol(location2) {
|
|
948
945
|
try {
|
|
949
|
-
return
|
|
946
|
+
return _chunkAM3XM4LSjs.invalidProtocols.includes(new URL(location2).protocol);
|
|
950
947
|
} catch (e2) {
|
|
951
948
|
return false;
|
|
952
949
|
}
|