react-router 7.14.2 → 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 +59 -0
- package/dist/development/{browser-I6n6wVSO.d.mts → browser-CRsXgNrY.d.mts} +2 -2
- package/dist/{production/browser-I6n6wVSO.d.mts → development/browser-wDl1FZEL.d.ts} +2 -2
- package/dist/{production/chunk-PQL4HLVQ.js → development/chunk-2D5H3HU3.js} +7 -7
- package/dist/development/{chunk-EVOBXE3Y.mjs → chunk-5KNZJZUH.mjs} +341 -208
- package/dist/development/{chunk-ZZNWZ5Q3.js → chunk-AM3XM4LS.js} +331 -205
- package/dist/development/{chunk-YQSHRJWW.mjs → chunk-RMD3H4O3.mjs} +80 -61
- package/dist/development/{chunk-YZKCRDTN.js → chunk-Z5YQYACE.js} +146 -139
- package/dist/{production/context-DGGUoDIu.d.mts → development/context-BQs41HrG.d.mts} +94 -42
- package/dist/development/{routeModules-7rtk67cd.d.ts → data-BVUf681J.d.mts} +64 -46
- package/dist/development/{routeModules-BW4a8k3I.d.mts → data-BqZ2x964.d.ts} +64 -46
- package/dist/development/dom-export.d.mts +8 -8
- package/dist/development/dom-export.d.ts +8 -8
- package/dist/development/dom-export.js +37 -40
- package/dist/development/dom-export.mjs +12 -15
- package/dist/development/{index-react-server-client-BBd0A0TL.d.ts → index-react-server-client-CSv-KZBk.d.ts} +123 -121
- package/dist/{production/index-react-server-client-BjhKIe3u.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 +10 -10
- package/dist/development/index.d.ts +10 -10
- package/dist/development/index.js +173 -154
- package/dist/development/index.mjs +3 -3
- package/dist/{production/instrumentation-g0dG8UL0.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-DcBltf5q.d.ts → register-Bsscfj79.d.ts} +1 -1
- package/dist/{production/register-DcBltf5q.d.ts → development/register-Df8okEea.d.mts} +1 -1
- package/dist/production/{browser-C-UvoYvi.d.ts → browser-CRsXgNrY.d.mts} +2 -2
- package/dist/{development/browser-C-UvoYvi.d.ts → production/browser-wDl1FZEL.d.ts} +2 -2
- package/dist/production/{chunk-2WLZNCK5.mjs → chunk-23ZOHYE5.mjs} +80 -61
- package/dist/{development/chunk-PZFPF4X7.js → production/chunk-7YXKJMLN.js} +7 -7
- package/dist/production/{chunk-LK6U7ULH.mjs → chunk-GM3PW4GX.mjs} +341 -208
- package/dist/production/{chunk-X5SKXJ4A.js → chunk-LCJTIOKZ.js} +331 -205
- package/dist/production/{chunk-UJQ4OJF4.js → chunk-YBQJ3ABE.js} +146 -139
- package/dist/{development/context-DGGUoDIu.d.mts → production/context-BQs41HrG.d.mts} +94 -42
- package/dist/production/{routeModules-7rtk67cd.d.ts → data-BVUf681J.d.mts} +64 -46
- package/dist/production/{routeModules-BW4a8k3I.d.mts → data-BqZ2x964.d.ts} +64 -46
- package/dist/production/dom-export.d.mts +8 -8
- package/dist/production/dom-export.d.ts +8 -8
- package/dist/production/dom-export.js +37 -40
- package/dist/production/dom-export.mjs +12 -15
- package/dist/production/{index-react-server-client-BBd0A0TL.d.ts → index-react-server-client-CSv-KZBk.d.ts} +123 -121
- package/dist/{development/index-react-server-client-BjhKIe3u.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 +10 -10
- package/dist/production/index.d.ts +10 -10
- package/dist/production/index.js +173 -154
- package/dist/production/index.mjs +3 -3
- package/dist/{development/instrumentation-g0dG8UL0.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-D9d2sMQ7.d.mts → production/register-Bsscfj79.d.ts} +1 -1
- package/dist/production/{register-D9d2sMQ7.d.mts → register-Df8okEea.d.mts} +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ComponentType, ReactElement } from 'react';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* An augmentable interface users can modify in their app-code to opt into
|
|
6
|
+
* future-flag-specific types
|
|
7
|
+
*/
|
|
8
|
+
interface Future {
|
|
9
|
+
}
|
|
10
|
+
type MiddlewareEnabled = Future extends {
|
|
11
|
+
v8_middleware: infer T extends boolean;
|
|
12
|
+
} ? T : false;
|
|
13
|
+
|
|
4
14
|
/**
|
|
5
15
|
* Actions represent the type of change to a location value.
|
|
6
16
|
*/
|
|
@@ -62,7 +72,7 @@ interface Location<State = any> extends Path {
|
|
|
62
72
|
* The masked location displayed in the URL bar, which differs from the URL the
|
|
63
73
|
* router is operating on
|
|
64
74
|
*/
|
|
65
|
-
|
|
75
|
+
mask?: Path;
|
|
66
76
|
}
|
|
67
77
|
/**
|
|
68
78
|
* A change to the current location.
|
|
@@ -255,16 +265,6 @@ type UrlHistoryOptions = {
|
|
|
255
265
|
v5Compat?: boolean;
|
|
256
266
|
};
|
|
257
267
|
|
|
258
|
-
/**
|
|
259
|
-
* An augmentable interface users can modify in their app-code to opt into
|
|
260
|
-
* future-flag-specific types
|
|
261
|
-
*/
|
|
262
|
-
interface Future {
|
|
263
|
-
}
|
|
264
|
-
type MiddlewareEnabled = Future extends {
|
|
265
|
-
v8_middleware: infer T extends boolean;
|
|
266
|
-
} ? T : false;
|
|
267
|
-
|
|
268
268
|
type MaybePromise<T> = T | Promise<T>;
|
|
269
269
|
/**
|
|
270
270
|
* Map of routeId -> data returned from a loader/action/error
|
|
@@ -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
|
|
@@ -956,6 +956,24 @@ interface UIMatch<Data = unknown, Handle = unknown> {
|
|
|
956
956
|
*/
|
|
957
957
|
handle: Handle;
|
|
958
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
|
+
}
|
|
959
977
|
/**
|
|
960
978
|
* Returns a path with params interpolated.
|
|
961
979
|
*
|
|
@@ -1214,16 +1232,6 @@ declare class ErrorResponseImpl implements ErrorResponse {
|
|
|
1214
1232
|
*/
|
|
1215
1233
|
declare function isRouteErrorResponse(error: any): error is ErrorResponse;
|
|
1216
1234
|
|
|
1217
|
-
/**
|
|
1218
|
-
* An object of unknown type for route loaders and actions provided by the
|
|
1219
|
-
* server's `getLoadContext()` function. This is defined as an empty interface
|
|
1220
|
-
* specifically so apps can leverage declaration merging to augment this type
|
|
1221
|
-
* globally: https://www.typescriptlang.org/docs/handbook/declaration-merging.html
|
|
1222
|
-
*/
|
|
1223
|
-
interface AppLoadContext {
|
|
1224
|
-
[key: string]: unknown;
|
|
1225
|
-
}
|
|
1226
|
-
|
|
1227
1235
|
type Primitive = null | undefined | string | number | boolean | symbol | bigint;
|
|
1228
1236
|
type LiteralUnion<LiteralType, BaseType extends Primitive> = LiteralType | (BaseType & Record<never, never>);
|
|
1229
1237
|
interface HtmlLinkProps {
|
|
@@ -1395,14 +1403,14 @@ type ClientDataFunctionArgs<Params> = {
|
|
|
1395
1403
|
**/
|
|
1396
1404
|
request: Request;
|
|
1397
1405
|
/**
|
|
1398
|
-
* A URL instance representing the application location being navigated to or
|
|
1399
|
-
*
|
|
1400
|
-
*
|
|
1401
|
-
*
|
|
1402
|
-
*
|
|
1403
|
-
*
|
|
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).
|
|
1404
1412
|
*/
|
|
1405
|
-
|
|
1413
|
+
url: URL;
|
|
1406
1414
|
/**
|
|
1407
1415
|
* {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
|
|
1408
1416
|
* @example
|
|
@@ -1422,7 +1430,7 @@ type ClientDataFunctionArgs<Params> = {
|
|
|
1422
1430
|
* Matched un-interpolated route pattern for the current path (i.e., /blog/:slug).
|
|
1423
1431
|
* Mostly useful as a identifier to aggregate on for logging/tracing/etc.
|
|
1424
1432
|
*/
|
|
1425
|
-
|
|
1433
|
+
pattern: string;
|
|
1426
1434
|
/**
|
|
1427
1435
|
* When `future.v8_middleware` is not enabled, this is undefined.
|
|
1428
1436
|
*
|
|
@@ -1437,14 +1445,14 @@ type ServerDataFunctionArgs<Params> = {
|
|
|
1437
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. */
|
|
1438
1446
|
request: Request;
|
|
1439
1447
|
/**
|
|
1440
|
-
* A URL instance representing the application location being navigated to or
|
|
1441
|
-
*
|
|
1442
|
-
*
|
|
1443
|
-
*
|
|
1444
|
-
*
|
|
1445
|
-
*
|
|
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).
|
|
1446
1454
|
*/
|
|
1447
|
-
|
|
1455
|
+
url: URL;
|
|
1448
1456
|
/**
|
|
1449
1457
|
* {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
|
|
1450
1458
|
* @example
|
|
@@ -1464,7 +1472,7 @@ type ServerDataFunctionArgs<Params> = {
|
|
|
1464
1472
|
* Matched un-interpolated route pattern for the current path (i.e., /blog/:slug).
|
|
1465
1473
|
* Mostly useful as a identifier to aggregate on for logging/tracing/etc.
|
|
1466
1474
|
*/
|
|
1467
|
-
|
|
1475
|
+
pattern: string;
|
|
1468
1476
|
/**
|
|
1469
1477
|
* Without `future.v8_middleware` enabled, this is the context passed in
|
|
1470
1478
|
* to your server adapter's `getLoadContext` function. It's a way to bridge the
|
|
@@ -1711,4 +1719,14 @@ type RouteComponent = ComponentType<{}>;
|
|
|
1711
1719
|
*/
|
|
1712
1720
|
type RouteHandle = unknown;
|
|
1713
1721
|
|
|
1714
|
-
|
|
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,7 +1,7 @@
|
|
|
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
7
|
declare function RouterProvider(props: RouterProviderProps): React.JSX.Element;
|
|
@@ -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,8 +1,8 @@
|
|
|
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
8
|
declare function RouterProvider(props: RouterProviderProps): React.JSX.Element;
|
|
@@ -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 _chunkPZFPF4X7js = require('./chunk-PZFPF4X7.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
|
}
|