react-router 8.0.1 → 8.2.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 +24 -0
- package/dist/development/dom-export.js +1 -1
- package/dist/development/index-react-server-client.js +1 -1
- package/dist/development/index-react-server.d.ts +35 -9
- package/dist/development/index-react-server.js +190 -157
- package/dist/development/index.d.ts +2 -2
- package/dist/development/index.js +1 -1
- package/dist/development/lib/actions.js +1 -1
- package/dist/development/lib/components.js +1 -1
- package/dist/development/lib/context.js +1 -1
- package/dist/development/lib/dom/dom.js +1 -1
- package/dist/development/lib/dom/lib.js +2 -2
- package/dist/development/lib/dom/server.js +1 -1
- package/dist/development/lib/dom/ssr/components.js +1 -1
- package/dist/development/lib/dom/ssr/data.js +1 -1
- package/dist/development/lib/dom/ssr/errorBoundaries.js +1 -1
- package/dist/development/lib/dom/ssr/fallback.js +1 -1
- package/dist/development/lib/dom/ssr/fog-of-war.js +1 -1
- package/dist/development/lib/dom/ssr/hydration.js +1 -1
- package/dist/development/lib/dom/ssr/invariant.js +1 -1
- package/dist/development/lib/dom/ssr/links.js +1 -1
- package/dist/development/lib/dom/ssr/markup.js +1 -1
- package/dist/development/lib/dom/ssr/routeModules.js +1 -1
- package/dist/development/lib/dom/ssr/routes-test-stub.js +1 -1
- package/dist/development/lib/dom/ssr/routes.js +1 -1
- package/dist/development/lib/dom/ssr/server.js +1 -1
- package/dist/development/lib/dom/ssr/single-fetch.js +1 -1
- package/dist/development/lib/dom-export/dom-router-provider.js +1 -1
- package/dist/development/lib/dom-export/hydrated-router.js +1 -1
- package/dist/development/lib/errors.js +1 -1
- package/dist/development/lib/hooks.d.ts +33 -6
- package/dist/development/lib/hooks.js +34 -7
- package/dist/development/lib/href.js +6 -3
- package/dist/development/lib/router/history.js +1 -1
- package/dist/development/lib/router/instrumentation.d.ts +33 -8
- package/dist/development/lib/router/instrumentation.js +176 -99
- package/dist/development/lib/router/router.js +20 -20
- package/dist/development/lib/router/url.js +1 -1
- package/dist/development/lib/router/utils.js +21 -4
- package/dist/development/lib/rsc/browser.js +1 -1
- package/dist/development/lib/rsc/errorBoundaries.js +1 -1
- package/dist/development/lib/rsc/html-stream/browser.js +1 -1
- package/dist/development/lib/rsc/html-stream/server.js +1 -1
- package/dist/development/lib/rsc/route-modules.js +1 -1
- package/dist/development/lib/rsc/server.rsc.d.ts +3 -2
- package/dist/development/lib/rsc/server.ssr.js +1 -1
- package/dist/development/lib/server-runtime/cookies.js +1 -1
- package/dist/development/lib/server-runtime/crypto.js +1 -1
- package/dist/development/lib/server-runtime/data.js +1 -1
- package/dist/development/lib/server-runtime/dev.js +1 -1
- package/dist/development/lib/server-runtime/entry.js +1 -1
- package/dist/development/lib/server-runtime/errors.js +1 -1
- package/dist/development/lib/server-runtime/headers.js +1 -1
- package/dist/development/lib/server-runtime/invariant.js +1 -1
- package/dist/development/lib/server-runtime/mode.js +1 -1
- package/dist/development/lib/server-runtime/routeMatching.js +1 -1
- package/dist/development/lib/server-runtime/routes.js +1 -1
- package/dist/development/lib/server-runtime/server.js +12 -5
- package/dist/development/lib/server-runtime/serverHandoff.js +1 -1
- package/dist/development/lib/server-runtime/sessions/cookieStorage.js +1 -1
- package/dist/development/lib/server-runtime/sessions/memoryStorage.js +1 -1
- package/dist/development/lib/server-runtime/sessions.js +1 -1
- package/dist/development/lib/server-runtime/single-fetch.js +1 -1
- package/dist/development/lib/server-runtime/urls.js +1 -1
- package/dist/development/lib/server-runtime/warnings.js +1 -1
- package/dist/development/lib/types/internal.js +1 -1
- package/dist/development/vendor/turbo-stream-v2/flatten.js +1 -1
- package/dist/development/vendor/turbo-stream-v2/turbo-stream.js +1 -1
- package/dist/development/vendor/turbo-stream-v2/unflatten.js +1 -1
- package/dist/development/vendor/turbo-stream-v2/utils.js +1 -1
- package/dist/production/dom-export.js +1 -1
- package/dist/production/index-react-server-client.js +1 -1
- package/dist/production/index-react-server.d.ts +35 -9
- package/dist/production/index-react-server.js +190 -157
- package/dist/production/index.d.ts +2 -2
- package/dist/production/index.js +1 -1
- package/dist/production/lib/actions.js +1 -1
- package/dist/production/lib/components.js +1 -1
- package/dist/production/lib/context.js +1 -1
- package/dist/production/lib/dom/dom.js +1 -1
- package/dist/production/lib/dom/lib.js +2 -2
- package/dist/production/lib/dom/server.js +1 -1
- package/dist/production/lib/dom/ssr/components.js +1 -1
- package/dist/production/lib/dom/ssr/data.js +1 -1
- package/dist/production/lib/dom/ssr/errorBoundaries.js +1 -1
- package/dist/production/lib/dom/ssr/fallback.js +1 -1
- package/dist/production/lib/dom/ssr/fog-of-war.js +1 -1
- package/dist/production/lib/dom/ssr/hydration.js +1 -1
- package/dist/production/lib/dom/ssr/invariant.js +1 -1
- package/dist/production/lib/dom/ssr/links.js +1 -1
- package/dist/production/lib/dom/ssr/markup.js +1 -1
- package/dist/production/lib/dom/ssr/routeModules.js +1 -1
- package/dist/production/lib/dom/ssr/routes-test-stub.js +1 -1
- package/dist/production/lib/dom/ssr/routes.js +1 -1
- package/dist/production/lib/dom/ssr/server.js +1 -1
- package/dist/production/lib/dom/ssr/single-fetch.js +1 -1
- package/dist/production/lib/dom-export/dom-router-provider.js +1 -1
- package/dist/production/lib/dom-export/hydrated-router.js +1 -1
- package/dist/production/lib/errors.js +1 -1
- package/dist/production/lib/hooks.d.ts +33 -6
- package/dist/production/lib/hooks.js +34 -7
- package/dist/production/lib/href.js +6 -3
- package/dist/production/lib/router/history.js +1 -1
- package/dist/production/lib/router/instrumentation.d.ts +33 -8
- package/dist/production/lib/router/instrumentation.js +176 -99
- package/dist/production/lib/router/router.js +20 -20
- package/dist/production/lib/router/url.js +1 -1
- package/dist/production/lib/router/utils.js +21 -4
- package/dist/production/lib/rsc/browser.js +1 -1
- package/dist/production/lib/rsc/errorBoundaries.js +1 -1
- package/dist/production/lib/rsc/html-stream/browser.js +1 -1
- package/dist/production/lib/rsc/html-stream/server.js +1 -1
- package/dist/production/lib/rsc/route-modules.js +1 -1
- package/dist/production/lib/rsc/server.rsc.d.ts +3 -2
- package/dist/production/lib/rsc/server.ssr.js +1 -1
- package/dist/production/lib/server-runtime/cookies.js +1 -1
- package/dist/production/lib/server-runtime/crypto.js +1 -1
- package/dist/production/lib/server-runtime/data.js +1 -1
- package/dist/production/lib/server-runtime/dev.js +1 -1
- package/dist/production/lib/server-runtime/entry.js +1 -1
- package/dist/production/lib/server-runtime/errors.js +1 -1
- package/dist/production/lib/server-runtime/headers.js +1 -1
- package/dist/production/lib/server-runtime/invariant.js +1 -1
- package/dist/production/lib/server-runtime/mode.js +1 -1
- package/dist/production/lib/server-runtime/routeMatching.js +1 -1
- package/dist/production/lib/server-runtime/routes.js +1 -1
- package/dist/production/lib/server-runtime/server.js +12 -5
- package/dist/production/lib/server-runtime/serverHandoff.js +1 -1
- package/dist/production/lib/server-runtime/sessions/cookieStorage.js +1 -1
- package/dist/production/lib/server-runtime/sessions/memoryStorage.js +1 -1
- package/dist/production/lib/server-runtime/sessions.js +1 -1
- package/dist/production/lib/server-runtime/single-fetch.js +1 -1
- package/dist/production/lib/server-runtime/urls.js +1 -1
- package/dist/production/lib/server-runtime/warnings.js +1 -1
- package/dist/production/lib/types/internal.js +1 -1
- package/dist/production/vendor/turbo-stream-v2/flatten.js +1 -1
- package/dist/production/vendor/turbo-stream-v2/turbo-stream.js +1 -1
- package/dist/production/vendor/turbo-stream-v2/unflatten.js +1 -1
- package/dist/production/vendor/turbo-stream-v2/utils.js +1 -1
- package/docs/explanation/hot-module-replacement.md +1 -1
- package/docs/how-to/data-strategy.md +1 -1
- package/docs/how-to/instrumentation.md +131 -26
- package/docs/start/framework/deploying.md +4 -0
- package/docs/upgrading/component-routes.md +2 -2
- package/docs/upgrading/future.md +33 -0
- package/docs/upgrading/router-provider.md +6 -6
- package/docs/upgrading/v7.md +39 -22
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# `react-router`
|
|
2
2
|
|
|
3
|
+
## v8.2.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Fix `href()` to properly stringify and URL-encode param values, matching `generatePath()` ([#15277](https://github.com/remix-run/react-router/pull/15277))
|
|
8
|
+
- splat params preserve path separators while encoding each segment individually
|
|
9
|
+
- Fix dynamic param extraction for routes with optional static segments ([#15200](https://github.com/remix-run/react-router/pull/15200))
|
|
10
|
+
- When a route path contains optional static segments (e.g. `/school?/user/:id`), the internal regex's incorrectly shifted parameter indices resulting in incorrect parameter extraction
|
|
11
|
+
- Consecutive optional static segments (e.g. `/one?/two?`) were only partially handled
|
|
12
|
+
- Preserve navigation blocker state through a revalidation ([#15246](https://github.com/remix-run/react-router/pull/15246))
|
|
13
|
+
- Fix route ranking for dynamic parameters with static extension suffixes ([#15273](https://github.com/remix-run/react-router/pull/15273))
|
|
14
|
+
- These were not being detected as dynamic param segments and instead got incorrectly scored higher as a static segment
|
|
15
|
+
- This meant they could potentially tie truly static routes like `/sitemap.xml` and outrank them based on definition order
|
|
16
|
+
- These are now correctly identified as dynamic parameter segments and scored correctly
|
|
17
|
+
- Use ReactFormState types instead of unknown ([#15263](https://github.com/remix-run/react-router/pull/15263))
|
|
18
|
+
|
|
19
|
+
## v8.1.0
|
|
20
|
+
|
|
21
|
+
### Minor Changes
|
|
22
|
+
|
|
23
|
+
- Return route metadata from server request, client navigation, and client fetcher instrumentations ([#15235](https://github.com/remix-run/react-router/pull/15235))
|
|
24
|
+
- Adds result metadata after instrumented calls complete, including the URL, matched route pattern, and params
|
|
25
|
+
- Adds known HTTP status codes to server request handler instrumentation results
|
|
26
|
+
|
|
3
27
|
## v8.0.1
|
|
4
28
|
|
|
5
29
|
### Patch Changes
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { CookieParseOptions, CookieParseOptions as CookieParseOptions$1, CookieSerializeOptions, CookieSerializeOptions as CookieSerializeOptions$1 } from "cookie-es";
|
|
4
4
|
import { BrowserRouter, Form, HashRouter, Link, Links, MemoryRouter, Meta, NavLink, Navigate, Outlet, Route, Router, RouterProvider, Routes, ScrollRestoration, StaticRouter, StaticRouterProvider, unstable_HistoryRouter } from "react-router/internal/react-server-client";
|
|
5
|
+
import { ReactFormState } from "react-dom/client";
|
|
5
6
|
|
|
6
7
|
//#region lib/router/history.d.ts
|
|
7
8
|
/**
|
|
@@ -1009,6 +1010,19 @@ type ClientInstrumentation = {
|
|
|
1009
1010
|
type InstrumentRequestHandlerFunction = (handler: InstrumentableRequestHandler) => void;
|
|
1010
1011
|
type InstrumentRouterFunction = (router: InstrumentableRouter) => void;
|
|
1011
1012
|
type InstrumentRouteFunction = (route: InstrumentableRoute) => void;
|
|
1013
|
+
/**
|
|
1014
|
+
* Route metadata available after React Router has matched an instrumented
|
|
1015
|
+
* request, navigation, or fetcher call.
|
|
1016
|
+
*/
|
|
1017
|
+
type InstrumentationResultMeta = {
|
|
1018
|
+
url: LoaderFunctionArgs["url"];
|
|
1019
|
+
pattern: string;
|
|
1020
|
+
params: LoaderFunctionArgs["params"];
|
|
1021
|
+
};
|
|
1022
|
+
/**
|
|
1023
|
+
* Result returned by route-level instrumented handler calls, such as
|
|
1024
|
+
* instrumented loaders, actions, middleware, and lazy route functions.
|
|
1025
|
+
*/
|
|
1012
1026
|
type InstrumentationHandlerResult = {
|
|
1013
1027
|
status: "success";
|
|
1014
1028
|
error: undefined;
|
|
@@ -1016,7 +1030,21 @@ type InstrumentationHandlerResult = {
|
|
|
1016
1030
|
status: "error";
|
|
1017
1031
|
error: Error;
|
|
1018
1032
|
};
|
|
1019
|
-
|
|
1033
|
+
/**
|
|
1034
|
+
* Result returned by client-side router instrumented navigation and fetcher
|
|
1035
|
+
* calls.
|
|
1036
|
+
*/
|
|
1037
|
+
type InstrumentationClientRouterResult = InstrumentationHandlerResult & {
|
|
1038
|
+
meta: InstrumentationResultMeta | undefined;
|
|
1039
|
+
};
|
|
1040
|
+
/**
|
|
1041
|
+
* Result returned by server request handler instrumentation.
|
|
1042
|
+
*/
|
|
1043
|
+
type InstrumentationServerHandlerResult = InstrumentationHandlerResult & {
|
|
1044
|
+
statusCode: number;
|
|
1045
|
+
meta: InstrumentationResultMeta | undefined;
|
|
1046
|
+
};
|
|
1047
|
+
type InstrumentFunction<T, TInnerResult = InstrumentationHandlerResult> = (handler: () => Promise<TInnerResult>, info: T) => Promise<void>;
|
|
1020
1048
|
type ReadonlyRequest = {
|
|
1021
1049
|
method: string;
|
|
1022
1050
|
url: string;
|
|
@@ -1039,18 +1067,16 @@ type RouteInstrumentations = {
|
|
|
1039
1067
|
action?: InstrumentFunction<RouteHandlerInstrumentationInfo>;
|
|
1040
1068
|
};
|
|
1041
1069
|
type RouteLazyInstrumentationInfo = undefined;
|
|
1042
|
-
type RouteHandlerInstrumentationInfo = Readonly<{
|
|
1070
|
+
type RouteHandlerInstrumentationInfo = Readonly<Omit<LoaderFunctionArgs, "request" | "context"> & {
|
|
1043
1071
|
request: ReadonlyRequest;
|
|
1044
|
-
params: LoaderFunctionArgs["params"];
|
|
1045
|
-
pattern: string;
|
|
1046
1072
|
context: ReadonlyContext;
|
|
1047
1073
|
}>;
|
|
1048
1074
|
type InstrumentableRouter = {
|
|
1049
1075
|
instrument(instrumentations: RouterInstrumentations): void;
|
|
1050
1076
|
};
|
|
1051
1077
|
type RouterInstrumentations = {
|
|
1052
|
-
navigate?: InstrumentFunction<RouterNavigationInstrumentationInfo>;
|
|
1053
|
-
fetch?: InstrumentFunction<RouterFetchInstrumentationInfo>;
|
|
1078
|
+
navigate?: InstrumentFunction<RouterNavigationInstrumentationInfo, InstrumentationClientRouterResult>;
|
|
1079
|
+
fetch?: InstrumentFunction<RouterFetchInstrumentationInfo, InstrumentationClientRouterResult>;
|
|
1054
1080
|
};
|
|
1055
1081
|
type RouterNavigationInstrumentationInfo = Readonly<{
|
|
1056
1082
|
to: string | number;
|
|
@@ -1073,7 +1099,7 @@ type InstrumentableRequestHandler = {
|
|
|
1073
1099
|
instrument(instrumentations: RequestHandlerInstrumentations): void;
|
|
1074
1100
|
};
|
|
1075
1101
|
type RequestHandlerInstrumentations = {
|
|
1076
|
-
request?: InstrumentFunction<RequestHandlerInstrumentationInfo>;
|
|
1102
|
+
request?: InstrumentFunction<RequestHandlerInstrumentationInfo, InstrumentationServerHandlerResult>;
|
|
1077
1103
|
};
|
|
1078
1104
|
type RequestHandlerInstrumentationInfo = Readonly<{
|
|
1079
1105
|
request: ReadonlyRequest;
|
|
@@ -2299,7 +2325,7 @@ type RSCRenderPayload = {
|
|
|
2299
2325
|
matches: RSCRouteMatch[];
|
|
2300
2326
|
patches?: Promise<RSCRouteManifest[]>;
|
|
2301
2327
|
nonce?: string;
|
|
2302
|
-
formState?:
|
|
2328
|
+
formState?: ReactFormState;
|
|
2303
2329
|
};
|
|
2304
2330
|
type RSCManifestPayload = {
|
|
2305
2331
|
type: "manifest";
|
|
@@ -2325,7 +2351,7 @@ type RSCMatch = {
|
|
|
2325
2351
|
payload: RSCPayload;
|
|
2326
2352
|
};
|
|
2327
2353
|
type DecodeActionFunction = (formData: FormData) => Promise<() => Promise<unknown>>;
|
|
2328
|
-
type DecodeFormStateFunction = (result: unknown, formData: FormData) =>
|
|
2354
|
+
type DecodeFormStateFunction = (result: unknown, formData: FormData) => Promise<ReactFormState | undefined>;
|
|
2329
2355
|
type DecodeReplyFunction = (reply: FormData | string, options: {
|
|
2330
2356
|
temporaryReferences: unknown;
|
|
2331
2357
|
}) => Promise<unknown[]>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v8.0
|
|
2
|
+
* react-router v8.2.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -77,142 +77,6 @@ function parsePath(path) {
|
|
|
77
77
|
return parsedPath;
|
|
78
78
|
}
|
|
79
79
|
//#endregion
|
|
80
|
-
//#region lib/router/instrumentation.ts
|
|
81
|
-
const UninstrumentedSymbol = Symbol("Uninstrumented");
|
|
82
|
-
function getRouteInstrumentationUpdates(fns, route) {
|
|
83
|
-
let aggregated = {
|
|
84
|
-
lazy: [],
|
|
85
|
-
"lazy.loader": [],
|
|
86
|
-
"lazy.action": [],
|
|
87
|
-
"lazy.middleware": [],
|
|
88
|
-
middleware: [],
|
|
89
|
-
loader: [],
|
|
90
|
-
action: []
|
|
91
|
-
};
|
|
92
|
-
fns.forEach((fn) => fn({
|
|
93
|
-
id: route.id,
|
|
94
|
-
index: route.index,
|
|
95
|
-
path: route.path,
|
|
96
|
-
instrument(i) {
|
|
97
|
-
let keys = Object.keys(aggregated);
|
|
98
|
-
for (let key of keys) if (i[key]) aggregated[key].push(i[key]);
|
|
99
|
-
}
|
|
100
|
-
}));
|
|
101
|
-
let updates = {};
|
|
102
|
-
if (typeof route.lazy === "function" && aggregated.lazy.length > 0) {
|
|
103
|
-
let instrumented = wrapImpl(aggregated.lazy, route.lazy, () => void 0);
|
|
104
|
-
if (instrumented) updates.lazy = instrumented;
|
|
105
|
-
}
|
|
106
|
-
if (typeof route.lazy === "object") {
|
|
107
|
-
let lazyObject = route.lazy;
|
|
108
|
-
[
|
|
109
|
-
"middleware",
|
|
110
|
-
"loader",
|
|
111
|
-
"action"
|
|
112
|
-
].forEach((key) => {
|
|
113
|
-
let lazyFn = lazyObject[key];
|
|
114
|
-
let instrumentations = aggregated[`lazy.${key}`];
|
|
115
|
-
if (typeof lazyFn === "function" && instrumentations.length > 0) {
|
|
116
|
-
let instrumented = wrapImpl(instrumentations, lazyFn, () => void 0);
|
|
117
|
-
if (instrumented) updates.lazy = Object.assign(updates.lazy || {}, { [key]: instrumented });
|
|
118
|
-
}
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
["loader", "action"].forEach((key) => {
|
|
122
|
-
let handler = route[key];
|
|
123
|
-
if (typeof handler === "function" && aggregated[key].length > 0) {
|
|
124
|
-
let original = handler[UninstrumentedSymbol] ?? handler;
|
|
125
|
-
let instrumented = wrapImpl(aggregated[key], original, (...args) => getHandlerInfo(args[0]));
|
|
126
|
-
if (instrumented) {
|
|
127
|
-
if (key === "loader" && original.hydrate === true) instrumented.hydrate = true;
|
|
128
|
-
instrumented[UninstrumentedSymbol] = original;
|
|
129
|
-
updates[key] = instrumented;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
if (route.middleware && route.middleware.length > 0 && aggregated.middleware.length > 0) updates.middleware = route.middleware.map((middleware) => {
|
|
134
|
-
let original = middleware[UninstrumentedSymbol] ?? middleware;
|
|
135
|
-
let instrumented = wrapImpl(aggregated.middleware, original, (...args) => getHandlerInfo(args[0]));
|
|
136
|
-
if (instrumented) {
|
|
137
|
-
instrumented[UninstrumentedSymbol] = original;
|
|
138
|
-
return instrumented;
|
|
139
|
-
}
|
|
140
|
-
return middleware;
|
|
141
|
-
});
|
|
142
|
-
return updates;
|
|
143
|
-
}
|
|
144
|
-
function wrapImpl(impls, handler, getInfo) {
|
|
145
|
-
if (impls.length === 0) return null;
|
|
146
|
-
return async (...args) => {
|
|
147
|
-
let result = await recurseRight(impls, getInfo(...args), () => handler(...args), impls.length - 1);
|
|
148
|
-
if (result.type === "error") throw result.value;
|
|
149
|
-
return result.value;
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
async function recurseRight(impls, info, handler, index) {
|
|
153
|
-
let impl = impls[index];
|
|
154
|
-
let result;
|
|
155
|
-
if (!impl) try {
|
|
156
|
-
result = {
|
|
157
|
-
type: "success",
|
|
158
|
-
value: await handler()
|
|
159
|
-
};
|
|
160
|
-
} catch (e) {
|
|
161
|
-
result = {
|
|
162
|
-
type: "error",
|
|
163
|
-
value: e
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
else {
|
|
167
|
-
let handlerPromise = void 0;
|
|
168
|
-
let callHandler = async () => {
|
|
169
|
-
if (handlerPromise) console.error("You cannot call instrumented handlers more than once");
|
|
170
|
-
else handlerPromise = recurseRight(impls, info, handler, index - 1);
|
|
171
|
-
result = await handlerPromise;
|
|
172
|
-
invariant$1(result, "Expected a result");
|
|
173
|
-
if (result.type === "error" && result.value instanceof Error) return {
|
|
174
|
-
status: "error",
|
|
175
|
-
error: result.value
|
|
176
|
-
};
|
|
177
|
-
return {
|
|
178
|
-
status: "success",
|
|
179
|
-
error: void 0
|
|
180
|
-
};
|
|
181
|
-
};
|
|
182
|
-
try {
|
|
183
|
-
await impl(callHandler, info);
|
|
184
|
-
} catch (e) {
|
|
185
|
-
console.error("An instrumentation function threw an error:", e);
|
|
186
|
-
}
|
|
187
|
-
if (!handlerPromise) await callHandler();
|
|
188
|
-
await handlerPromise;
|
|
189
|
-
}
|
|
190
|
-
if (result) return result;
|
|
191
|
-
return {
|
|
192
|
-
type: "error",
|
|
193
|
-
value: /* @__PURE__ */ new Error("No result assigned in instrumentation chain.")
|
|
194
|
-
};
|
|
195
|
-
}
|
|
196
|
-
function getHandlerInfo(args) {
|
|
197
|
-
let { request, context, params, pattern } = args;
|
|
198
|
-
return {
|
|
199
|
-
request: getReadonlyRequest(request),
|
|
200
|
-
params: { ...params },
|
|
201
|
-
pattern,
|
|
202
|
-
context: getReadonlyContext(context)
|
|
203
|
-
};
|
|
204
|
-
}
|
|
205
|
-
function getReadonlyRequest(request) {
|
|
206
|
-
return {
|
|
207
|
-
method: request.method,
|
|
208
|
-
url: request.url,
|
|
209
|
-
headers: { get: (...args) => request.headers.get(...args) }
|
|
210
|
-
};
|
|
211
|
-
}
|
|
212
|
-
function getReadonlyContext(context) {
|
|
213
|
-
return { get: (ctx) => context.get(ctx) };
|
|
214
|
-
}
|
|
215
|
-
//#endregion
|
|
216
80
|
//#region lib/router/utils.ts
|
|
217
81
|
/**
|
|
218
82
|
* Creates a type-safe {@link RouterContext} object that can be used to
|
|
@@ -525,6 +389,8 @@ function rankRouteBranches(branches) {
|
|
|
525
389
|
branches.sort((a, b) => a.score !== b.score ? b.score - a.score : compareIndexes(a.routesMeta.map((meta) => meta.childrenIndex), b.routesMeta.map((meta) => meta.childrenIndex)));
|
|
526
390
|
}
|
|
527
391
|
const paramRe = /^:[\w-]+$/;
|
|
392
|
+
const partialParamRe = /^:[\w-]+/;
|
|
393
|
+
const partialDynamicSegmentValue = 3.5;
|
|
528
394
|
const dynamicSegmentValue = 3;
|
|
529
395
|
const indexRouteValue = 2;
|
|
530
396
|
const emptySegmentValue = 1;
|
|
@@ -536,7 +402,7 @@ function computeScore(path, index) {
|
|
|
536
402
|
let initialScore = segments.length;
|
|
537
403
|
if (segments.some(isSplat)) initialScore += splatPenalty;
|
|
538
404
|
if (index) initialScore += indexRouteValue;
|
|
539
|
-
return segments.filter((s) => !isSplat(s)).reduce((score, segment) => score + (paramRe.test(segment) ? dynamicSegmentValue : segment === "" ? emptySegmentValue : staticSegmentValue), initialScore);
|
|
405
|
+
return segments.filter((s) => !isSplat(s)).reduce((score, segment) => score + (paramRe.test(segment) ? dynamicSegmentValue : partialParamRe.test(segment) ? partialDynamicSegmentValue : segment === "" ? emptySegmentValue : staticSegmentValue), initialScore);
|
|
540
406
|
}
|
|
541
407
|
function compareIndexes(a, b) {
|
|
542
408
|
return a.length === b.length && a.slice(0, -1).every((n, i) => n === b[i]) ? a[a.length - 1] - b[b.length - 1] : 0;
|
|
@@ -633,7 +499,7 @@ function compilePath(path, caseSensitive = false, end = true) {
|
|
|
633
499
|
return "(?:/([^\\/]*))?";
|
|
634
500
|
}
|
|
635
501
|
return "/([^\\/]+)";
|
|
636
|
-
}).replace(/\/([\w-]+)\?(
|
|
502
|
+
}).replace(/\/([\w-]+)\?(?=\/|$|\()/g, "(?:/$1)?");
|
|
637
503
|
if (path.endsWith("*")) {
|
|
638
504
|
params.push({ paramName: "*" });
|
|
639
505
|
regexpSource += path === "*" || path === "/*" ? "(.*)$" : "(?:\\/(.+)|\\/*)$";
|
|
@@ -941,8 +807,187 @@ function isRouteErrorResponse(error) {
|
|
|
941
807
|
function getRoutePattern(matches) {
|
|
942
808
|
return joinPaths(matches.map((m) => m.route.path).filter(Boolean)) || "/";
|
|
943
809
|
}
|
|
810
|
+
function createDataFunctionUrl(request, path) {
|
|
811
|
+
let url = new URL(typeof request === "string" || request instanceof URL ? request : request.url);
|
|
812
|
+
let parsed = typeof path === "string" ? parsePath(path) : path;
|
|
813
|
+
url.pathname = parsed.pathname || "/";
|
|
814
|
+
if (parsed.search) {
|
|
815
|
+
let searchParams = new URLSearchParams(parsed.search);
|
|
816
|
+
let indexValues = searchParams.getAll("index");
|
|
817
|
+
searchParams.delete("index");
|
|
818
|
+
for (let value of indexValues.filter(Boolean)) searchParams.append("index", value);
|
|
819
|
+
let search = searchParams.toString();
|
|
820
|
+
url.search = search ? `?${search}` : "";
|
|
821
|
+
} else url.search = "";
|
|
822
|
+
url.hash = parsed.hash || "";
|
|
823
|
+
return url;
|
|
824
|
+
}
|
|
944
825
|
typeof window !== "undefined" && typeof window.document !== "undefined" && window.document.createElement;
|
|
945
826
|
//#endregion
|
|
827
|
+
//#region lib/router/instrumentation.ts
|
|
828
|
+
const UninstrumentedSymbol = Symbol("Uninstrumented");
|
|
829
|
+
function getRouteInstrumentationUpdates(fns, route) {
|
|
830
|
+
let aggregated = {
|
|
831
|
+
lazy: [],
|
|
832
|
+
"lazy.loader": [],
|
|
833
|
+
"lazy.action": [],
|
|
834
|
+
"lazy.middleware": [],
|
|
835
|
+
middleware: [],
|
|
836
|
+
loader: [],
|
|
837
|
+
action: []
|
|
838
|
+
};
|
|
839
|
+
fns.forEach((fn) => fn({
|
|
840
|
+
id: route.id,
|
|
841
|
+
index: route.index,
|
|
842
|
+
path: route.path,
|
|
843
|
+
instrument(i) {
|
|
844
|
+
if (i.lazy != null) aggregated.lazy.push(i.lazy);
|
|
845
|
+
if (i["lazy.loader"] != null) aggregated["lazy.loader"].push(i["lazy.loader"]);
|
|
846
|
+
if (i["lazy.action"] != null) aggregated["lazy.action"].push(i["lazy.action"]);
|
|
847
|
+
if (i["lazy.middleware"] != null) aggregated["lazy.middleware"].push(i["lazy.middleware"]);
|
|
848
|
+
if (i.middleware != null) aggregated.middleware.push(i.middleware);
|
|
849
|
+
if (i.loader != null) aggregated.loader.push(i.loader);
|
|
850
|
+
if (i.action != null) aggregated.action.push(i.action);
|
|
851
|
+
}
|
|
852
|
+
}));
|
|
853
|
+
let updates = {};
|
|
854
|
+
if (typeof route.lazy === "function" && aggregated.lazy.length > 0) {
|
|
855
|
+
let lazy = route.lazy;
|
|
856
|
+
updates.lazy = async (...args) => {
|
|
857
|
+
return throwOrReturnResult(await recurseRight(aggregated.lazy, void 0, () => lazy(...args), getInstrumentationInnerResult));
|
|
858
|
+
};
|
|
859
|
+
}
|
|
860
|
+
if (typeof route.lazy === "object") {
|
|
861
|
+
let lazyObject = route.lazy;
|
|
862
|
+
if (typeof lazyObject.middleware === "function" && aggregated["lazy.middleware"].length > 0) {
|
|
863
|
+
let middleware = lazyObject.middleware;
|
|
864
|
+
updates.lazy = Object.assign(updates.lazy || {}, { middleware: async (...args) => {
|
|
865
|
+
return throwOrReturnResult(await recurseRight(aggregated["lazy.middleware"], void 0, () => middleware(...args), getInstrumentationInnerResult));
|
|
866
|
+
} });
|
|
867
|
+
}
|
|
868
|
+
if (typeof lazyObject.loader === "function" && aggregated["lazy.loader"].length > 0) {
|
|
869
|
+
let loader = lazyObject.loader;
|
|
870
|
+
updates.lazy = Object.assign(updates.lazy || {}, { loader: async (...args) => {
|
|
871
|
+
return throwOrReturnResult(await recurseRight(aggregated["lazy.loader"], void 0, () => loader(...args), getInstrumentationInnerResult));
|
|
872
|
+
} });
|
|
873
|
+
}
|
|
874
|
+
if (typeof lazyObject.action === "function" && aggregated["lazy.action"].length > 0) {
|
|
875
|
+
let action = lazyObject.action;
|
|
876
|
+
updates.lazy = Object.assign(updates.lazy || {}, { action: async (...args) => {
|
|
877
|
+
return throwOrReturnResult(await recurseRight(aggregated["lazy.action"], void 0, () => action(...args), getInstrumentationInnerResult));
|
|
878
|
+
} });
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
if (typeof route.loader === "function" && aggregated.loader.length > 0) {
|
|
882
|
+
let original = getUninstrumentedHandler(route.loader);
|
|
883
|
+
let instrumented = async (...args) => {
|
|
884
|
+
return throwOrReturnResult(await recurseRight(aggregated.loader, getHandlerInfo(args[0]), () => original(...args), getInstrumentationInnerResult));
|
|
885
|
+
};
|
|
886
|
+
if (original.hydrate === true) instrumented.hydrate = true;
|
|
887
|
+
setUninstrumentedHandler(instrumented, original);
|
|
888
|
+
updates.loader = instrumented;
|
|
889
|
+
}
|
|
890
|
+
if (typeof route.action === "function" && aggregated.action.length > 0) {
|
|
891
|
+
let original = getUninstrumentedHandler(route.action);
|
|
892
|
+
let instrumented = async (...args) => {
|
|
893
|
+
return throwOrReturnResult(await recurseRight(aggregated.action, getHandlerInfo(args[0]), () => original(...args), getInstrumentationInnerResult));
|
|
894
|
+
};
|
|
895
|
+
setUninstrumentedHandler(instrumented, original);
|
|
896
|
+
updates.action = instrumented;
|
|
897
|
+
}
|
|
898
|
+
if (route.middleware && route.middleware.length > 0 && aggregated.middleware.length > 0) updates.middleware = route.middleware.map((middleware) => {
|
|
899
|
+
let original = getUninstrumentedHandler(middleware);
|
|
900
|
+
let instrumented = async (...args) => {
|
|
901
|
+
return throwOrReturnResult(await recurseRight(aggregated.middleware, getHandlerInfo(args[0]), () => original(...args), getInstrumentationInnerResult));
|
|
902
|
+
};
|
|
903
|
+
setUninstrumentedHandler(instrumented, original);
|
|
904
|
+
return instrumented;
|
|
905
|
+
});
|
|
906
|
+
return updates;
|
|
907
|
+
}
|
|
908
|
+
function getUninstrumentedHandler(handler) {
|
|
909
|
+
return handler[UninstrumentedSymbol] ?? handler;
|
|
910
|
+
}
|
|
911
|
+
function setUninstrumentedHandler(handler, uninstrumentedHandler) {
|
|
912
|
+
handler[UninstrumentedSymbol] = uninstrumentedHandler;
|
|
913
|
+
}
|
|
914
|
+
function throwOrReturnResult(result) {
|
|
915
|
+
if (result.type === "error") throw result.value;
|
|
916
|
+
return result.value;
|
|
917
|
+
}
|
|
918
|
+
async function recurseRight(impls, info, handler, getInnerResult, state = {
|
|
919
|
+
result: null,
|
|
920
|
+
innerResult: null
|
|
921
|
+
}, index = impls.length - 1) {
|
|
922
|
+
let impl = impls[index];
|
|
923
|
+
if (!impl) {
|
|
924
|
+
try {
|
|
925
|
+
state.result = {
|
|
926
|
+
type: "success",
|
|
927
|
+
value: await handler()
|
|
928
|
+
};
|
|
929
|
+
} catch (e) {
|
|
930
|
+
state.result = {
|
|
931
|
+
type: "error",
|
|
932
|
+
value: e
|
|
933
|
+
};
|
|
934
|
+
}
|
|
935
|
+
state.innerResult = getInnerResult(state.result, info);
|
|
936
|
+
} else {
|
|
937
|
+
let handlerPromise = void 0;
|
|
938
|
+
let callHandler = async () => {
|
|
939
|
+
if (handlerPromise) console.error("You cannot call instrumented handlers more than once");
|
|
940
|
+
else handlerPromise = recurseRight(impls, info, handler, getInnerResult, state, index - 1);
|
|
941
|
+
await handlerPromise;
|
|
942
|
+
invariant$1(state.innerResult, "Expected an inner result");
|
|
943
|
+
return state.innerResult;
|
|
944
|
+
};
|
|
945
|
+
try {
|
|
946
|
+
await impl(callHandler, info);
|
|
947
|
+
} catch (e) {
|
|
948
|
+
console.error("An instrumentation function threw an error:", e);
|
|
949
|
+
}
|
|
950
|
+
if (!handlerPromise) await callHandler();
|
|
951
|
+
await handlerPromise;
|
|
952
|
+
}
|
|
953
|
+
if (state.result) return state.result;
|
|
954
|
+
state.result = {
|
|
955
|
+
type: "error",
|
|
956
|
+
value: /* @__PURE__ */ new Error("No result assigned in instrumentation chain.")
|
|
957
|
+
};
|
|
958
|
+
state.innerResult = getInnerResult(state.result, info);
|
|
959
|
+
return state.result;
|
|
960
|
+
}
|
|
961
|
+
function getInstrumentationInnerResult(result) {
|
|
962
|
+
if (result.type === "error" && result.value instanceof Error) return {
|
|
963
|
+
status: "error",
|
|
964
|
+
error: result.value
|
|
965
|
+
};
|
|
966
|
+
return {
|
|
967
|
+
status: "success",
|
|
968
|
+
error: void 0
|
|
969
|
+
};
|
|
970
|
+
}
|
|
971
|
+
function getHandlerInfo(args) {
|
|
972
|
+
let { request, context, params } = args;
|
|
973
|
+
return {
|
|
974
|
+
...args,
|
|
975
|
+
request: getReadonlyRequest(request),
|
|
976
|
+
params: { ...params },
|
|
977
|
+
context: getReadonlyContext(context)
|
|
978
|
+
};
|
|
979
|
+
}
|
|
980
|
+
function getReadonlyRequest(request) {
|
|
981
|
+
return {
|
|
982
|
+
method: request.method,
|
|
983
|
+
url: request.url,
|
|
984
|
+
headers: { get: (...args) => request.headers.get(...args) }
|
|
985
|
+
};
|
|
986
|
+
}
|
|
987
|
+
function getReadonlyContext(context) {
|
|
988
|
+
return { get: (ctx) => context.get(ctx) };
|
|
989
|
+
}
|
|
990
|
+
//#endregion
|
|
946
991
|
//#region lib/router/router.ts
|
|
947
992
|
const validMutationMethodsArr = [
|
|
948
993
|
"POST",
|
|
@@ -1877,21 +1922,6 @@ function normalizeRelativeRoutingRedirectResponse(response, request, routeId, ma
|
|
|
1877
1922
|
}
|
|
1878
1923
|
return response;
|
|
1879
1924
|
}
|
|
1880
|
-
function createDataFunctionUrl(request, path) {
|
|
1881
|
-
let url = new URL(request.url);
|
|
1882
|
-
let parsed = typeof path === "string" ? parsePath(path) : path;
|
|
1883
|
-
url.pathname = parsed.pathname || "/";
|
|
1884
|
-
if (parsed.search) {
|
|
1885
|
-
let searchParams = new URLSearchParams(parsed.search);
|
|
1886
|
-
let indexValues = searchParams.getAll("index");
|
|
1887
|
-
searchParams.delete("index");
|
|
1888
|
-
for (let value of indexValues.filter(Boolean)) searchParams.append("index", value);
|
|
1889
|
-
let search = searchParams.toString();
|
|
1890
|
-
url.search = search ? `?${search}` : "";
|
|
1891
|
-
} else url.search = "";
|
|
1892
|
-
url.hash = parsed.hash || "";
|
|
1893
|
-
return url;
|
|
1894
|
-
}
|
|
1895
1925
|
function processRouteLoaderData(matches, results, pendingActionResult, isStaticHandler = false, skipLoaderErrorBubbling = false) {
|
|
1896
1926
|
let loaderData = {};
|
|
1897
1927
|
let errors = null;
|
|
@@ -2440,7 +2470,7 @@ async function processServerAction(request, basename, decodeReply, loadServerAct
|
|
|
2440
2470
|
try {
|
|
2441
2471
|
let result = await action();
|
|
2442
2472
|
if (isRedirectResponse(result)) result = prependBasenameToRedirectResponse(result, basename);
|
|
2443
|
-
formState = decodeFormState?.(result, formData);
|
|
2473
|
+
formState = await decodeFormState?.(result, formData);
|
|
2444
2474
|
} catch (error) {
|
|
2445
2475
|
if (isRedirectResponse(error)) return prependBasenameToRedirectResponse(error, basename);
|
|
2446
2476
|
if (isResponse(error)) return error;
|
|
@@ -2778,6 +2808,9 @@ function canDecodeWithFormData(contentType) {
|
|
|
2778
2808
|
}
|
|
2779
2809
|
//#endregion
|
|
2780
2810
|
//#region lib/href.ts
|
|
2811
|
+
function stringify(p) {
|
|
2812
|
+
return p == null ? "" : typeof p === "string" ? p : String(p);
|
|
2813
|
+
}
|
|
2781
2814
|
/**
|
|
2782
2815
|
Returns a resolved URL path for the specified route.
|
|
2783
2816
|
|
|
@@ -2794,11 +2827,11 @@ function href(path, ...args) {
|
|
|
2794
2827
|
const isRequired = questionMark === void 0;
|
|
2795
2828
|
const value = params?.[param];
|
|
2796
2829
|
if (isRequired && value === void 0) throw new Error(`Path '${path}' requires param '${param}' but it was not provided`);
|
|
2797
|
-
return value
|
|
2830
|
+
return value == null ? "" : "/" + encodeURIComponent(stringify(value));
|
|
2798
2831
|
});
|
|
2799
2832
|
if (path.endsWith("*")) {
|
|
2800
2833
|
const value = params?.["*"];
|
|
2801
|
-
if (value !== void 0) result += "/" + value;
|
|
2834
|
+
if (value !== void 0) result += "/" + stringify(value).split("/").map(encodeURIComponent).join("/");
|
|
2802
2835
|
}
|
|
2803
2836
|
return result || "/";
|
|
2804
2837
|
}
|
|
@@ -35,10 +35,10 @@ import { createClientRoutes, createClientRoutesWithHMRRevalidationOptOut, should
|
|
|
35
35
|
import { AssetsManifest, EntryContext } from "./lib/dom/ssr/entry.js";
|
|
36
36
|
import { HandleDataRequestFunction, HandleDocumentRequestFunction, HandleErrorFunction, ServerBuild, ServerEntryModule } from "./lib/server-runtime/build.js";
|
|
37
37
|
import { CreateRequestHandlerFunction, RequestHandler, createRequestHandler } from "./lib/server-runtime/server.js";
|
|
38
|
-
import { ClientInstrumentation, InstrumentRequestHandlerFunction, InstrumentRouteFunction, InstrumentRouterFunction, InstrumentationHandlerResult, ServerInstrumentation } from "./lib/router/instrumentation.js";
|
|
38
|
+
import { ClientInstrumentation, InstrumentRequestHandlerFunction, InstrumentRouteFunction, InstrumentRouterFunction, InstrumentationClientRouterResult, InstrumentationHandlerResult, InstrumentationServerHandlerResult, ServerInstrumentation } from "./lib/router/instrumentation.js";
|
|
39
39
|
|
|
40
40
|
//#region index.d.ts
|
|
41
41
|
declare const unstable_getRequest: typeof getRequest;
|
|
42
42
|
declare const unstable_matchRSCServerRequest: typeof matchRSCServerRequest;
|
|
43
43
|
//#endregion
|
|
44
|
-
export { type ActionFunction, type ActionFunctionArgs, Await, type AwaitProps, type BaseRouteObject, type Blocker, type BlockerFunction, BrowserRouter, type BrowserRouterProps, type ClientActionFunction, type ClientActionFunctionArgs, type ClientInstrumentation, type ClientLoaderFunction, type ClientLoaderFunctionArgs, type ClientOnErrorFunction, type Cookie, type CookieOptions, type CookieParseOptions, type CookieSerializeOptions, type CookieSignatureOptions, type CreateRequestHandlerFunction, type DOMRouterOpts, type DataRouteMatch, type DataRouteObject, type Router as DataRouter, type DataStrategyFunction, type DataStrategyFunctionArgs, type DataStrategyMatch, type DataStrategyResult, type DiscoverBehavior, type EntryContext, type ErrorResponse, type Fetcher, type FetcherFormProps, type FetcherSubmitFunction, type FetcherSubmitOptions, type FetcherWithComponents, type FlashSessionData, Form, type FormEncType, type FormMethod, type FormProps, type Future, type GetScrollPositionFunction, type GetScrollRestorationKeyFunction, type HTMLFormMethod, type HandleDataRequestFunction, type HandleDocumentRequestFunction, type HandleErrorFunction, HashRouter, type HashRouterProps, type HeadersArgs, type HeadersFunction, type HistoryRouterProps, type HtmlLinkDescriptor, type HydrationState, IDLE_BLOCKER, IDLE_FETCHER, IDLE_NAVIGATION, type IndexRouteObject, type IndexRouteProps, type InitialEntry, type InstrumentRequestHandlerFunction, type InstrumentRouteFunction, type InstrumentRouterFunction, type InstrumentationHandlerResult, type IsCookieFunction, type IsSessionFunction, type LayoutRouteProps, type LazyRouteFunction, Link, type LinkDescriptor, type LinkProps, Links, type LinksFunction, type LinksProps, type LoaderFunction, type LoaderFunctionArgs, type Location, MemoryRouter, type MemoryRouterOpts, type MemoryRouterProps, Meta, type MetaArgs, type MetaDescriptor, type MetaFunction, type MiddlewareFunction, NavLink, type NavLinkProps, type NavLinkRenderProps, Navigate, type NavigateFunction, type NavigateOptions, type NavigateProps, type Navigation, type NavigationStates, Action as NavigationType, type Navigator, type NonIndexRouteObject, Outlet, type OutletProps, type PageLinkDescriptor, type ParamKeyValuePair, type ParamParseKey, type Params, type PatchRoutesOnNavigationFunction, type PatchRoutesOnNavigationFunctionArgs, type Path, type PathMatch, type PathParam, type PathPattern, type PathRouteProps, type PrefetchBehavior, PrefetchPageLinks, type RedirectFunction, type Register, type RelativeRoutingType, type RequestHandler, type RevalidationState, Route, type RouteMatch, type RouteObject, type RouteProps, Router$1 as Router, type RouterContext, RouterContextProvider, type RouterFetchOptions, type RouterInit, type RouterNavigateOptions, type RouterProps, RouterProvider, type RouterProviderProps, type RouterState, type RouterSubscriber, Routes, type RoutesProps, type RoutesTestStubProps, Scripts, type ScriptsProps, ScrollRestoration, type ScrollRestorationProps, type ServerBuild, type ServerEntryModule, type ServerInstrumentation, ServerRouter, type ServerRouterProps, type Session, type SessionData, type SessionIdStorageStrategy, type SessionStorage, type SetURLSearchParams, type ShouldRevalidateFunction, type ShouldRevalidateFunctionArgs, type StaticHandler, type StaticHandlerContext, StaticRouter, type StaticRouterProps, StaticRouterProvider, type StaticRouterProviderProps, type SubmitFunction, type SubmitOptions, type SubmitTarget, type To, type UIMatch, type AssetsManifest as UNSAFE_AssetsManifest, AwaitContextProvider as UNSAFE_AwaitContextProvider, DataRouterContext as UNSAFE_DataRouterContext, DataRouterStateContext as UNSAFE_DataRouterStateContext, type DataWithResponseInit as UNSAFE_DataWithResponseInit, ErrorResponseImpl as UNSAFE_ErrorResponseImpl, FetchersContext as UNSAFE_FetchersContext, FrameworkContext as UNSAFE_FrameworkContext, LocationContext as UNSAFE_LocationContext, NavigationContext as UNSAFE_NavigationContext, RSCDefaultRootErrorBoundary as UNSAFE_RSCDefaultRootErrorBoundary, RemixErrorBoundary as UNSAFE_RemixErrorBoundary, RouteContext as UNSAFE_RouteContext, type RouteModules as UNSAFE_RouteModules, ServerMode as UNSAFE_ServerMode, SingleFetchRedirectSymbol as UNSAFE_SingleFetchRedirectSymbol, ViewTransitionContext as UNSAFE_ViewTransitionContext, WithComponentProps as UNSAFE_WithComponentProps, WithErrorBoundaryProps as UNSAFE_WithErrorBoundaryProps, WithHydrateFallbackProps as UNSAFE_WithHydrateFallbackProps, createBrowserHistory as UNSAFE_createBrowserHistory, createClientRoutes as UNSAFE_createClientRoutes, createClientRoutesWithHMRRevalidationOptOut as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, createHashHistory as UNSAFE_createHashHistory, createMemoryHistory as UNSAFE_createMemoryHistory, createRouter as UNSAFE_createRouter, decodeViaTurboStream as UNSAFE_decodeViaTurboStream, defaultMapRouteProperties as UNSAFE_defaultMapRouteProperties, getHydrationData as UNSAFE_getHydrationData, getPatchRoutesOnNavigationFunction as UNSAFE_getPatchRoutesOnNavigationFunction, getTurboStreamSingleFetchDataStrategy as UNSAFE_getTurboStreamSingleFetchDataStrategy, hydrationRouteProperties as UNSAFE_hydrationRouteProperties, invariant as UNSAFE_invariant, shouldHydrateRouteLoader as UNSAFE_shouldHydrateRouteLoader, useFogOFWarDiscovery as UNSAFE_useFogOFWarDiscovery, useScrollRestoration as UNSAFE_useScrollRestoration, withComponentProps as UNSAFE_withComponentProps, withErrorBoundaryProps as UNSAFE_withErrorBoundaryProps, withHydrateFallbackProps as UNSAFE_withHydrateFallbackProps, type URLSearchParamsInit, createBrowserRouter, createContext, createCookie, createCookieSessionStorage, createHashRouter, createMemoryRouter, createMemorySessionStorage, createPath, createRequestHandler, createRoutesFromChildren, createRoutesFromElements, createRoutesStub, createSearchParams, createSession, createSessionStorage, createStaticHandler, createStaticRouter, data, generatePath, href, isCookie, isRouteErrorResponse, isSession, matchPath, matchRoutes, parsePath, redirect, redirectDocument, renderMatches, replace, resolvePath, type BrowserCreateFromReadableStreamFunction as unstable_BrowserCreateFromReadableStreamFunction, type DecodeActionFunction as unstable_DecodeActionFunction, type DecodeFormStateFunction as unstable_DecodeFormStateFunction, type DecodeReplyFunction as unstable_DecodeReplyFunction, type EncodeReplyFunction as unstable_EncodeReplyFunction, HistoryRouter as unstable_HistoryRouter, type LoadServerActionFunction as unstable_LoadServerActionFunction, type RSCHydratedRouterProps as unstable_RSCHydratedRouterProps, type RSCManifestPayload as unstable_RSCManifestPayload, type RSCMatch as unstable_RSCMatch, type RSCPayload as unstable_RSCPayload, type RSCRenderPayload as unstable_RSCRenderPayload, type RSCRouteConfig as unstable_RSCRouteConfig, type RSCRouteConfigEntry as unstable_RSCRouteConfigEntry, type RSCRouteManifest as unstable_RSCRouteManifest, type RSCRouteMatch as unstable_RSCRouteMatch, RSCStaticRouter as unstable_RSCStaticRouter, type RSCStaticRouterProps as unstable_RSCStaticRouterProps, type unstable_RouterState, type unstable_RouterStateActiveVariant, type unstable_RouterStatePendingVariant, type SSRCreateFromReadableStreamFunction as unstable_SSRCreateFromReadableStreamFunction, type unstable_SerializesTo, unstable_getRequest, unstable_matchRSCServerRequest, routeRSCServerRequest as unstable_routeRSCServerRequest, setDevServerHooks as unstable_setDevServerHooks, usePrompt as unstable_usePrompt, useRoute as unstable_useRoute, useRouterState as unstable_useRouterState, useActionData, useAsyncError, useAsyncValue, useBeforeUnload, useBlocker, useFetcher, useFetchers, useFormAction, useHref, useInRouterContext, useLinkClickHandler, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes, useSearchParams, useSubmit, useViewTransitionState };
|
|
44
|
+
export { type ActionFunction, type ActionFunctionArgs, Await, type AwaitProps, type BaseRouteObject, type Blocker, type BlockerFunction, BrowserRouter, type BrowserRouterProps, type ClientActionFunction, type ClientActionFunctionArgs, type ClientInstrumentation, type ClientLoaderFunction, type ClientLoaderFunctionArgs, type ClientOnErrorFunction, type Cookie, type CookieOptions, type CookieParseOptions, type CookieSerializeOptions, type CookieSignatureOptions, type CreateRequestHandlerFunction, type DOMRouterOpts, type DataRouteMatch, type DataRouteObject, type Router as DataRouter, type DataStrategyFunction, type DataStrategyFunctionArgs, type DataStrategyMatch, type DataStrategyResult, type DiscoverBehavior, type EntryContext, type ErrorResponse, type Fetcher, type FetcherFormProps, type FetcherSubmitFunction, type FetcherSubmitOptions, type FetcherWithComponents, type FlashSessionData, Form, type FormEncType, type FormMethod, type FormProps, type Future, type GetScrollPositionFunction, type GetScrollRestorationKeyFunction, type HTMLFormMethod, type HandleDataRequestFunction, type HandleDocumentRequestFunction, type HandleErrorFunction, HashRouter, type HashRouterProps, type HeadersArgs, type HeadersFunction, type HistoryRouterProps, type HtmlLinkDescriptor, type HydrationState, IDLE_BLOCKER, IDLE_FETCHER, IDLE_NAVIGATION, type IndexRouteObject, type IndexRouteProps, type InitialEntry, type InstrumentRequestHandlerFunction, type InstrumentRouteFunction, type InstrumentRouterFunction, type InstrumentationClientRouterResult, type InstrumentationHandlerResult, type InstrumentationServerHandlerResult, type IsCookieFunction, type IsSessionFunction, type LayoutRouteProps, type LazyRouteFunction, Link, type LinkDescriptor, type LinkProps, Links, type LinksFunction, type LinksProps, type LoaderFunction, type LoaderFunctionArgs, type Location, MemoryRouter, type MemoryRouterOpts, type MemoryRouterProps, Meta, type MetaArgs, type MetaDescriptor, type MetaFunction, type MiddlewareFunction, NavLink, type NavLinkProps, type NavLinkRenderProps, Navigate, type NavigateFunction, type NavigateOptions, type NavigateProps, type Navigation, type NavigationStates, Action as NavigationType, type Navigator, type NonIndexRouteObject, Outlet, type OutletProps, type PageLinkDescriptor, type ParamKeyValuePair, type ParamParseKey, type Params, type PatchRoutesOnNavigationFunction, type PatchRoutesOnNavigationFunctionArgs, type Path, type PathMatch, type PathParam, type PathPattern, type PathRouteProps, type PrefetchBehavior, PrefetchPageLinks, type RedirectFunction, type Register, type RelativeRoutingType, type RequestHandler, type RevalidationState, Route, type RouteMatch, type RouteObject, type RouteProps, Router$1 as Router, type RouterContext, RouterContextProvider, type RouterFetchOptions, type RouterInit, type RouterNavigateOptions, type RouterProps, RouterProvider, type RouterProviderProps, type RouterState, type RouterSubscriber, Routes, type RoutesProps, type RoutesTestStubProps, Scripts, type ScriptsProps, ScrollRestoration, type ScrollRestorationProps, type ServerBuild, type ServerEntryModule, type ServerInstrumentation, ServerRouter, type ServerRouterProps, type Session, type SessionData, type SessionIdStorageStrategy, type SessionStorage, type SetURLSearchParams, type ShouldRevalidateFunction, type ShouldRevalidateFunctionArgs, type StaticHandler, type StaticHandlerContext, StaticRouter, type StaticRouterProps, StaticRouterProvider, type StaticRouterProviderProps, type SubmitFunction, type SubmitOptions, type SubmitTarget, type To, type UIMatch, type AssetsManifest as UNSAFE_AssetsManifest, AwaitContextProvider as UNSAFE_AwaitContextProvider, DataRouterContext as UNSAFE_DataRouterContext, DataRouterStateContext as UNSAFE_DataRouterStateContext, type DataWithResponseInit as UNSAFE_DataWithResponseInit, ErrorResponseImpl as UNSAFE_ErrorResponseImpl, FetchersContext as UNSAFE_FetchersContext, FrameworkContext as UNSAFE_FrameworkContext, LocationContext as UNSAFE_LocationContext, NavigationContext as UNSAFE_NavigationContext, RSCDefaultRootErrorBoundary as UNSAFE_RSCDefaultRootErrorBoundary, RemixErrorBoundary as UNSAFE_RemixErrorBoundary, RouteContext as UNSAFE_RouteContext, type RouteModules as UNSAFE_RouteModules, ServerMode as UNSAFE_ServerMode, SingleFetchRedirectSymbol as UNSAFE_SingleFetchRedirectSymbol, ViewTransitionContext as UNSAFE_ViewTransitionContext, WithComponentProps as UNSAFE_WithComponentProps, WithErrorBoundaryProps as UNSAFE_WithErrorBoundaryProps, WithHydrateFallbackProps as UNSAFE_WithHydrateFallbackProps, createBrowserHistory as UNSAFE_createBrowserHistory, createClientRoutes as UNSAFE_createClientRoutes, createClientRoutesWithHMRRevalidationOptOut as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, createHashHistory as UNSAFE_createHashHistory, createMemoryHistory as UNSAFE_createMemoryHistory, createRouter as UNSAFE_createRouter, decodeViaTurboStream as UNSAFE_decodeViaTurboStream, defaultMapRouteProperties as UNSAFE_defaultMapRouteProperties, getHydrationData as UNSAFE_getHydrationData, getPatchRoutesOnNavigationFunction as UNSAFE_getPatchRoutesOnNavigationFunction, getTurboStreamSingleFetchDataStrategy as UNSAFE_getTurboStreamSingleFetchDataStrategy, hydrationRouteProperties as UNSAFE_hydrationRouteProperties, invariant as UNSAFE_invariant, shouldHydrateRouteLoader as UNSAFE_shouldHydrateRouteLoader, useFogOFWarDiscovery as UNSAFE_useFogOFWarDiscovery, useScrollRestoration as UNSAFE_useScrollRestoration, withComponentProps as UNSAFE_withComponentProps, withErrorBoundaryProps as UNSAFE_withErrorBoundaryProps, withHydrateFallbackProps as UNSAFE_withHydrateFallbackProps, type URLSearchParamsInit, createBrowserRouter, createContext, createCookie, createCookieSessionStorage, createHashRouter, createMemoryRouter, createMemorySessionStorage, createPath, createRequestHandler, createRoutesFromChildren, createRoutesFromElements, createRoutesStub, createSearchParams, createSession, createSessionStorage, createStaticHandler, createStaticRouter, data, generatePath, href, isCookie, isRouteErrorResponse, isSession, matchPath, matchRoutes, parsePath, redirect, redirectDocument, renderMatches, replace, resolvePath, type BrowserCreateFromReadableStreamFunction as unstable_BrowserCreateFromReadableStreamFunction, type DecodeActionFunction as unstable_DecodeActionFunction, type DecodeFormStateFunction as unstable_DecodeFormStateFunction, type DecodeReplyFunction as unstable_DecodeReplyFunction, type EncodeReplyFunction as unstable_EncodeReplyFunction, HistoryRouter as unstable_HistoryRouter, type LoadServerActionFunction as unstable_LoadServerActionFunction, type RSCHydratedRouterProps as unstable_RSCHydratedRouterProps, type RSCManifestPayload as unstable_RSCManifestPayload, type RSCMatch as unstable_RSCMatch, type RSCPayload as unstable_RSCPayload, type RSCRenderPayload as unstable_RSCRenderPayload, type RSCRouteConfig as unstable_RSCRouteConfig, type RSCRouteConfigEntry as unstable_RSCRouteConfigEntry, type RSCRouteManifest as unstable_RSCRouteManifest, type RSCRouteMatch as unstable_RSCRouteMatch, RSCStaticRouter as unstable_RSCStaticRouter, type RSCStaticRouterProps as unstable_RSCStaticRouterProps, type unstable_RouterState, type unstable_RouterStateActiveVariant, type unstable_RouterStatePendingVariant, type SSRCreateFromReadableStreamFunction as unstable_SSRCreateFromReadableStreamFunction, type unstable_SerializesTo, unstable_getRequest, unstable_matchRSCServerRequest, routeRSCServerRequest as unstable_routeRSCServerRequest, setDevServerHooks as unstable_setDevServerHooks, usePrompt as unstable_usePrompt, useRoute as unstable_useRoute, useRouterState as unstable_useRouterState, useActionData, useAsyncError, useAsyncValue, useBeforeUnload, useBlocker, useFetcher, useFetchers, useFormAction, useHref, useInRouterContext, useLinkClickHandler, useLoaderData, useLocation, useMatch, useMatches, useNavigate, useNavigation, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRevalidator, useRouteError, useRouteLoaderData, useRoutes, useSearchParams, useSubmit, useViewTransitionState };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v8.0
|
|
2
|
+
* react-router v8.2.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -22,7 +22,7 @@ import * as React$1 from "react";
|
|
|
22
22
|
//#region lib/dom/lib.tsx
|
|
23
23
|
const isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
24
24
|
try {
|
|
25
|
-
if (isBrowser) window.__reactRouterVersion = "8.0
|
|
25
|
+
if (isBrowser) window.__reactRouterVersion = "8.2.0";
|
|
26
26
|
} catch (e) {}
|
|
27
27
|
/**
|
|
28
28
|
* Create a new {@link DataRouter| data router} that manages the application
|