react-router 7.15.1 → 7.18.5
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 +73 -2
- package/dist/development/{browser-BOdXz9dK.d.ts → browser-7x6a6gQP.d.ts} +2 -2
- package/dist/development/{browser-3AnU12UI.d.mts → browser-CiGxXXOl.d.mts} +2 -2
- package/dist/development/{chunk-D6LUOGOQ.js → chunk-2ZBLYC7V.js} +265 -57
- package/dist/development/{chunk-4N6VE7H7.mjs → chunk-6KYCQHYJ.mjs} +268 -60
- package/dist/{production/chunk-Y6IFXO7V.js → development/chunk-IFHLIXZW.js} +7 -7
- package/dist/development/{chunk-RJYABSBD.mjs → chunk-JAHXRPFV.mjs} +71 -122
- package/dist/development/{chunk-66UKHEGQ.js → chunk-NDF5KBLP.js} +112 -108
- package/dist/{production/context-ByvtofY2.d.mts → development/context-BlYKn1tE.d.mts} +24 -5
- package/dist/development/{data-BqZ2x964.d.ts → data-CjO11-hU.d.ts} +10 -2
- package/dist/{production/data-BVUf681J.d.mts → development/data-DEjBmEfD.d.mts} +10 -2
- package/dist/development/dom-export.d.mts +4 -4
- package/dist/development/dom-export.d.ts +4 -4
- package/dist/development/dom-export.js +61 -46
- package/dist/development/dom-export.mjs +39 -24
- package/dist/{production/index-react-server-client-BS5F89FR.d.ts → development/index-react-server-client-BaaZU3sM.d.ts} +32 -9
- package/dist/{production/index-react-server-client-DY04-103.d.mts → development/index-react-server-client-KK-TR-t7.d.mts} +20 -6
- 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 +20 -2
- package/dist/development/index-react-server.d.ts +20 -2
- package/dist/development/index-react-server.js +212 -144
- package/dist/development/index-react-server.mjs +211 -143
- package/dist/development/index.d.mts +22 -15
- package/dist/development/index.d.ts +22 -15
- package/dist/development/index.js +160 -211
- package/dist/development/index.mjs +3 -5
- package/dist/{production/instrumentation-cRWWLfsU.d.ts → development/instrumentation-CPkMwccd.d.ts} +12 -2
- 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-Df8okEea.d.mts → register-CmkRspdl.d.mts} +1 -1
- package/dist/development/{register-Bsscfj79.d.ts → register-roq_0qYo.d.ts} +1 -1
- package/dist/production/{browser-BOdXz9dK.d.ts → browser-7x6a6gQP.d.ts} +2 -2
- package/dist/production/{browser-3AnU12UI.d.mts → browser-CiGxXXOl.d.mts} +2 -2
- package/dist/production/{chunk-PNZCCTKT.js → chunk-75HN637G.js} +112 -108
- package/dist/production/{chunk-JAKZPQZC.mjs → chunk-7RTFRKQW.mjs} +268 -60
- package/dist/production/{chunk-HUBUW7R3.js → chunk-HNBICOIU.js} +265 -57
- package/dist/production/{chunk-6S4627ZB.mjs → chunk-IAM5GYT3.mjs} +71 -122
- package/dist/{development/chunk-4YRVXM2U.js → production/chunk-K3NA4NUH.js} +7 -7
- package/dist/{development/context-ByvtofY2.d.mts → production/context-BlYKn1tE.d.mts} +24 -5
- package/dist/production/{data-BqZ2x964.d.ts → data-CjO11-hU.d.ts} +10 -2
- package/dist/{development/data-BVUf681J.d.mts → production/data-DEjBmEfD.d.mts} +10 -2
- package/dist/production/dom-export.d.mts +4 -4
- package/dist/production/dom-export.d.ts +4 -4
- package/dist/production/dom-export.js +61 -46
- package/dist/production/dom-export.mjs +39 -24
- package/dist/{development/index-react-server-client-BS5F89FR.d.ts → production/index-react-server-client-BaaZU3sM.d.ts} +32 -9
- package/dist/{development/index-react-server-client-DY04-103.d.mts → production/index-react-server-client-KK-TR-t7.d.mts} +20 -6
- 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 +20 -2
- package/dist/production/index-react-server.d.ts +20 -2
- package/dist/production/index-react-server.js +212 -144
- package/dist/production/index-react-server.mjs +211 -143
- package/dist/production/index.d.mts +22 -15
- package/dist/production/index.d.ts +22 -15
- package/dist/production/index.js +160 -211
- package/dist/production/index.mjs +3 -5
- package/dist/{development/instrumentation-cRWWLfsU.d.ts → production/instrumentation-CPkMwccd.d.ts} +12 -2
- 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/production/{register-Df8okEea.d.mts → register-CmkRspdl.d.mts} +1 -1
- package/dist/production/{register-Bsscfj79.d.ts → register-roq_0qYo.d.ts} +1 -1
- package/docs/explanation/backend-for-frontend.md +50 -0
- package/docs/explanation/code-splitting.md +61 -0
- package/docs/explanation/concurrency.md +135 -0
- package/docs/explanation/form-vs-fetcher.md +292 -0
- package/docs/explanation/hot-module-replacement.md +137 -0
- package/docs/explanation/hydration.md +14 -0
- package/docs/explanation/index-query-param.md +86 -0
- package/docs/explanation/index.md +4 -0
- package/docs/explanation/lazy-route-discovery.md +78 -0
- package/docs/explanation/location.md +6 -0
- package/docs/explanation/progressive-enhancement.md +150 -0
- package/docs/explanation/race-conditions.md +88 -0
- package/docs/explanation/react-transitions.md +160 -0
- package/docs/explanation/route-matching.md +7 -0
- package/docs/explanation/server-client-execution.md +4 -0
- package/docs/explanation/sessions-and-cookies.md +465 -0
- package/docs/explanation/special-files.md +16 -0
- package/docs/explanation/state-management.md +524 -0
- package/docs/explanation/styling.md +87 -0
- package/docs/explanation/type-safety.md +82 -0
- package/docs/how-to/accessibility.md +44 -0
- package/docs/how-to/client-data.md +199 -0
- package/docs/how-to/data-strategy.md +317 -0
- package/docs/how-to/error-boundary.md +231 -0
- package/docs/how-to/error-reporting.md +142 -0
- package/docs/how-to/fetchers.md +307 -0
- package/docs/how-to/file-route-conventions.md +410 -0
- package/docs/how-to/file-uploads.md +217 -0
- package/docs/how-to/form-validation.md +120 -0
- package/docs/how-to/headers.md +165 -0
- package/docs/how-to/index.md +4 -0
- package/docs/how-to/instrumentation.md +556 -0
- package/docs/how-to/meta.md +40 -0
- package/docs/how-to/middleware.md +763 -0
- package/docs/how-to/navigation-blocking.md +233 -0
- package/docs/how-to/optimize-revalidation.md +12 -0
- package/docs/how-to/pre-rendering.md +225 -0
- package/docs/how-to/presets.md +103 -0
- package/docs/how-to/react-server-components.md +899 -0
- package/docs/how-to/resource-routes.md +126 -0
- package/docs/how-to/route-module-type-safety.md +100 -0
- package/docs/how-to/search-params.md +4 -0
- package/docs/how-to/security.md +32 -0
- package/docs/how-to/server-bundles.md +66 -0
- package/docs/how-to/spa.md +120 -0
- package/docs/how-to/status.md +63 -0
- package/docs/how-to/suspense.md +132 -0
- package/docs/how-to/using-handle.md +117 -0
- package/docs/how-to/view-transitions.md +237 -0
- package/docs/how-to/webhook.md +50 -0
- package/docs/index.md +39 -0
- package/docs/start/data/actions.md +138 -0
- package/docs/start/data/custom.md +198 -0
- package/docs/start/data/data-loading.md +44 -0
- package/docs/start/data/index.md +4 -0
- package/docs/start/data/installation.md +56 -0
- package/docs/start/data/navigating.md +12 -0
- package/docs/start/data/pending-ui.md +12 -0
- package/docs/start/data/route-object.md +268 -0
- package/docs/start/data/routing.md +281 -0
- package/docs/start/data/testing.md +8 -0
- package/docs/start/declarative/index.md +4 -0
- package/docs/start/declarative/installation.md +43 -0
- package/docs/start/declarative/navigating.md +133 -0
- package/docs/start/declarative/routing.md +237 -0
- package/docs/start/declarative/url-values.md +65 -0
- package/docs/start/framework/actions.md +174 -0
- package/docs/start/framework/data-loading.md +201 -0
- package/docs/start/framework/deploying.md +100 -0
- package/docs/start/framework/index.md +4 -0
- package/docs/start/framework/installation.md +41 -0
- package/docs/start/framework/navigating.md +182 -0
- package/docs/start/framework/pending-ui.md +142 -0
- package/docs/start/framework/rendering.md +59 -0
- package/docs/start/framework/route-module.md +527 -0
- package/docs/start/framework/routing.md +362 -0
- package/docs/start/framework/testing.md +133 -0
- package/docs/start/index.md +4 -0
- package/docs/start/modes.md +201 -0
- package/docs/upgrading/component-routes.md +363 -0
- package/docs/upgrading/future.md +490 -0
- package/docs/upgrading/index.md +4 -0
- package/docs/upgrading/remix.md +403 -0
- package/docs/upgrading/router-provider.md +442 -0
- package/docs/upgrading/v6.md +382 -0
- package/package.json +2 -1
|
@@ -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.18.5
|
|
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 _chunkK3NA4NUHjs = require('./chunk-K3NA4NUH.js');
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
@@ -34,7 +34,11 @@ var _chunkY6IFXO7Vjs = require('./chunk-Y6IFXO7V.js');
|
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
var _chunkHNBICOIUjs = require('./chunk-HNBICOIU.js');
|
|
38
42
|
|
|
39
43
|
// lib/dom-export/dom-router-provider.tsx
|
|
40
44
|
var _react = require('react'); var React = _interopRequireWildcard(_react); var React2 = _interopRequireWildcard(_react); var React3 = _interopRequireWildcard(_react);
|
|
@@ -62,7 +66,6 @@ function RouterProvider2(props) {
|
|
|
62
66
|
|
|
63
67
|
|
|
64
68
|
|
|
65
|
-
|
|
66
69
|
var ssrInfo = null;
|
|
67
70
|
var router = null;
|
|
68
71
|
function initSsrInfo() {
|
|
@@ -147,9 +150,6 @@ function createHydratedRouter({
|
|
|
147
150
|
basename: _optionalChain([window, 'access', _17 => _17.__reactRouterContext, 'optionalAccess', _18 => _18.basename]),
|
|
148
151
|
isSpaMode: ssrInfo.context.isSpaMode
|
|
149
152
|
});
|
|
150
|
-
if (hydrationData && hydrationData.errors) {
|
|
151
|
-
hydrationData.errors = _reactrouter.UNSAFE_deserializeErrors.call(void 0, hydrationData.errors);
|
|
152
|
-
}
|
|
153
153
|
}
|
|
154
154
|
if (window.history.state && window.history.state.masked) {
|
|
155
155
|
window.history.replaceState(
|
|
@@ -175,7 +175,7 @@ function createHydratedRouter({
|
|
|
175
175
|
ssrInfo.routeModules,
|
|
176
176
|
ssrInfo.context.ssr,
|
|
177
177
|
ssrInfo.context.basename,
|
|
178
|
-
ssrInfo.context.future.
|
|
178
|
+
ssrInfo.context.future.v8_trailingSlashAwareDataRequests
|
|
179
179
|
),
|
|
180
180
|
patchRoutesOnNavigation: _reactrouter.UNSAFE_getPatchRoutesOnNavigationFunction.call(void 0,
|
|
181
181
|
() => router2,
|
|
@@ -214,7 +214,7 @@ function HydratedRouter(props) {
|
|
|
214
214
|
}, []);
|
|
215
215
|
React2.useEffect(() => {
|
|
216
216
|
if (process.env.NODE_ENV === "development" && criticalCss === void 0) {
|
|
217
|
-
document.querySelectorAll(`[${
|
|
217
|
+
document.querySelectorAll(`[${_chunkHNBICOIUjs.CRITICAL_CSS_DATA_ATTRIBUTE}]`).forEach((element) => element.remove());
|
|
218
218
|
}
|
|
219
219
|
}, [criticalCss]);
|
|
220
220
|
let [location2, setLocation] = React2.useState(router.state.location);
|
|
@@ -307,15 +307,22 @@ function createCallServer({
|
|
|
307
307
|
// @ts-expect-error - Needs React 19 types
|
|
308
308
|
Promise.resolve(payloadPromise).then(async (payload) => {
|
|
309
309
|
if (payload.type === "redirect") {
|
|
310
|
-
|
|
311
|
-
|
|
310
|
+
let location2 = normalizeRedirectLocation(payload.location);
|
|
311
|
+
_chunkHNBICOIUjs.validateNavigationTarget.call(void 0,
|
|
312
|
+
payload.location,
|
|
313
|
+
location2,
|
|
314
|
+
new URL(window.location.href),
|
|
315
|
+
"allow-explicit"
|
|
316
|
+
);
|
|
317
|
+
if (payload.reload || isExternalLocation(location2)) {
|
|
318
|
+
if (_chunkHNBICOIUjs.hasInvalidProtocol.call(void 0, location2)) {
|
|
312
319
|
throw new Error("Invalid redirect location");
|
|
313
320
|
}
|
|
314
|
-
window.location.href =
|
|
321
|
+
window.location.href = location2;
|
|
315
322
|
return;
|
|
316
323
|
}
|
|
317
324
|
React3.startTransition(() => {
|
|
318
|
-
globalVar.__reactRouterDataRouter.navigate(
|
|
325
|
+
globalVar.__reactRouterDataRouter.navigate(location2, {
|
|
319
326
|
replace: payload.replace
|
|
320
327
|
});
|
|
321
328
|
});
|
|
@@ -327,15 +334,22 @@ function createCallServer({
|
|
|
327
334
|
const rerender = await payload.rerender;
|
|
328
335
|
if (rerender && landedActionId < actionId && globalVar.__routerActionID <= actionId) {
|
|
329
336
|
if (rerender.type === "redirect") {
|
|
330
|
-
|
|
331
|
-
|
|
337
|
+
let location2 = normalizeRedirectLocation(rerender.location);
|
|
338
|
+
_chunkHNBICOIUjs.validateNavigationTarget.call(void 0,
|
|
339
|
+
rerender.location,
|
|
340
|
+
location2,
|
|
341
|
+
new URL(window.location.href),
|
|
342
|
+
"allow-explicit"
|
|
343
|
+
);
|
|
344
|
+
if (rerender.reload || isExternalLocation(location2)) {
|
|
345
|
+
if (_chunkHNBICOIUjs.hasInvalidProtocol.call(void 0, location2)) {
|
|
332
346
|
throw new Error("Invalid redirect location");
|
|
333
347
|
}
|
|
334
|
-
window.location.href =
|
|
348
|
+
window.location.href = location2;
|
|
335
349
|
return;
|
|
336
350
|
}
|
|
337
351
|
React3.startTransition(() => {
|
|
338
|
-
globalVar.__reactRouterDataRouter.navigate(
|
|
352
|
+
globalVar.__reactRouterDataRouter.navigate(location2, {
|
|
339
353
|
replace: rerender.replace
|
|
340
354
|
});
|
|
341
355
|
});
|
|
@@ -393,7 +407,7 @@ function createRouterFromPayload({
|
|
|
393
407
|
};
|
|
394
408
|
if (payload.type !== "render") throw new Error("Invalid payload type");
|
|
395
409
|
globalVar.__reactRouterRouteModules = _nullishCoalesce(globalVar.__reactRouterRouteModules, () => ( {}));
|
|
396
|
-
|
|
410
|
+
_chunkK3NA4NUHjs.populateRSCRouteModules.call(void 0, globalVar.__reactRouterRouteModules, payload.matches);
|
|
397
411
|
let routes = payload.matches.reduceRight((previous, match) => {
|
|
398
412
|
const route = createRouteFromServerManifest(
|
|
399
413
|
match,
|
|
@@ -407,12 +421,12 @@ function createRouterFromPayload({
|
|
|
407
421
|
return [route];
|
|
408
422
|
}, []);
|
|
409
423
|
let applyPatchesPromise;
|
|
410
|
-
globalVar.__reactRouterDataRouter =
|
|
424
|
+
globalVar.__reactRouterDataRouter = _chunkHNBICOIUjs.createRouter.call(void 0, {
|
|
411
425
|
routes,
|
|
412
426
|
getContext,
|
|
413
427
|
basename: payload.basename,
|
|
414
|
-
history:
|
|
415
|
-
hydrationData:
|
|
428
|
+
history: _chunkHNBICOIUjs.createBrowserHistory.call(void 0, ),
|
|
429
|
+
hydrationData: _chunkK3NA4NUHjs.getHydrationData.call(void 0, {
|
|
416
430
|
state: {
|
|
417
431
|
loaderData: payload.loaderData,
|
|
418
432
|
actionData: payload.actionData,
|
|
@@ -421,7 +435,7 @@ function createRouterFromPayload({
|
|
|
421
435
|
routes,
|
|
422
436
|
getRouteInfo: (routeId) => {
|
|
423
437
|
let match = payload.matches.find((m) => m.id === routeId);
|
|
424
|
-
|
|
438
|
+
_chunkHNBICOIUjs.invariant.call(void 0, match, "Route not found in payload");
|
|
425
439
|
return {
|
|
426
440
|
clientLoader: match.clientLoader,
|
|
427
441
|
hasLoader: match.hasLoader,
|
|
@@ -536,9 +550,9 @@ function createRouterFromPayload({
|
|
|
536
550
|
routeModules: globalVar.__reactRouterRouteModules
|
|
537
551
|
};
|
|
538
552
|
}
|
|
539
|
-
var renderedRoutesContext =
|
|
553
|
+
var renderedRoutesContext = _chunkHNBICOIUjs.createContext.call(void 0, );
|
|
540
554
|
function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, createFromReadableStream, fetchImplementation) {
|
|
541
|
-
let dataStrategy =
|
|
555
|
+
let dataStrategy = _chunkHNBICOIUjs.getSingleFetchDataStrategyImpl.call(void 0,
|
|
542
556
|
getRouter,
|
|
543
557
|
(match) => {
|
|
544
558
|
let M = match;
|
|
@@ -595,20 +609,20 @@ function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, createFromReada
|
|
|
595
609
|
function getFetchAndDecodeViaRSC(createFromReadableStream, fetchImplementation) {
|
|
596
610
|
return async (args, basename, trailingSlashAware, targetRoutes) => {
|
|
597
611
|
let { request, context } = args;
|
|
598
|
-
let url =
|
|
612
|
+
let url = _chunkHNBICOIUjs.singleFetchUrl.call(void 0, request.url, basename, trailingSlashAware, "rsc");
|
|
599
613
|
if (request.method === "GET") {
|
|
600
|
-
url =
|
|
614
|
+
url = _chunkHNBICOIUjs.stripIndexParam.call(void 0, url);
|
|
601
615
|
if (targetRoutes) {
|
|
602
616
|
url.searchParams.set("_routes", targetRoutes.join(","));
|
|
603
617
|
}
|
|
604
618
|
}
|
|
605
619
|
let res = await fetchImplementation(
|
|
606
|
-
new Request(url, await
|
|
620
|
+
new Request(url, await _chunkHNBICOIUjs.createRequestInit.call(void 0, request))
|
|
607
621
|
);
|
|
608
622
|
if (res.status >= 400 && !res.headers.has("X-Remix-Response")) {
|
|
609
|
-
throw new (0,
|
|
623
|
+
throw new (0, _chunkHNBICOIUjs.ErrorResponseImpl)(res.status, res.statusText, await res.text());
|
|
610
624
|
}
|
|
611
|
-
|
|
625
|
+
_chunkHNBICOIUjs.invariant.call(void 0, res.body, "No response body to decode");
|
|
612
626
|
try {
|
|
613
627
|
const payload = await createFromReadableStream(res.body, {
|
|
614
628
|
temporaryReferences: void 0
|
|
@@ -632,7 +646,7 @@ function getFetchAndDecodeViaRSC(createFromReadableStream, fetchImplementation)
|
|
|
632
646
|
}
|
|
633
647
|
context.get(renderedRoutesContext).push(...payload.matches);
|
|
634
648
|
let results = { routes: {} };
|
|
635
|
-
const dataKey =
|
|
649
|
+
const dataKey = _chunkHNBICOIUjs.isMutationMethod.call(void 0, request.method) ? "actionData" : "loaderData";
|
|
636
650
|
for (let [routeId, data] of Object.entries(payload[dataKey] || {})) {
|
|
637
651
|
results.routes[routeId] = { data };
|
|
638
652
|
}
|
|
@@ -665,7 +679,7 @@ function RSCHydratedRouter({
|
|
|
665
679
|
[createFromReadableStream, payload, fetchImplementation, getContext]
|
|
666
680
|
);
|
|
667
681
|
React3.useEffect(() => {
|
|
668
|
-
|
|
682
|
+
_chunkHNBICOIUjs.setIsHydrated.call(void 0, );
|
|
669
683
|
}, []);
|
|
670
684
|
React3.useLayoutEffect(() => {
|
|
671
685
|
const globalVar = window;
|
|
@@ -750,7 +764,7 @@ function RSCHydratedRouter({
|
|
|
750
764
|
// These flags have no runtime impact so can always be false. If we add
|
|
751
765
|
// flags that drive runtime behavior they'll need to be proxied through.
|
|
752
766
|
v8_middleware: false,
|
|
753
|
-
|
|
767
|
+
v8_trailingSlashAwareDataRequests: true,
|
|
754
768
|
// always on for RSC
|
|
755
769
|
v8_passThroughRequests: true
|
|
756
770
|
// always on for RSC
|
|
@@ -773,8 +787,8 @@ function RSCHydratedRouter({
|
|
|
773
787
|
},
|
|
774
788
|
routeModules
|
|
775
789
|
};
|
|
776
|
-
return /* @__PURE__ */ React3.createElement(
|
|
777
|
-
|
|
790
|
+
return /* @__PURE__ */ React3.createElement(_chunkHNBICOIUjs.RSCRouterContext.Provider, { value: true }, /* @__PURE__ */ React3.createElement(_chunkK3NA4NUHjs.RSCRouterGlobalErrorBoundary, { location: state.location }, /* @__PURE__ */ React3.createElement(_chunkHNBICOIUjs.FrameworkContext.Provider, { value: frameworkContext }, /* @__PURE__ */ React3.createElement(
|
|
791
|
+
_chunkHNBICOIUjs.RouterProvider,
|
|
778
792
|
{
|
|
779
793
|
router: transitionEnabledRouter,
|
|
780
794
|
flushSync: ReactDOM2.flushSync
|
|
@@ -790,8 +804,8 @@ function createRouteFromServerManifest(match, payload) {
|
|
|
790
804
|
// the server loader flow regardless of whether the client loader calls
|
|
791
805
|
// `serverLoader` or not, otherwise we'll have nothing to render.
|
|
792
806
|
match.hasComponent && !match.element;
|
|
793
|
-
|
|
794
|
-
|
|
807
|
+
_chunkHNBICOIUjs.invariant.call(void 0, window.__reactRouterRouteModules);
|
|
808
|
+
_chunkK3NA4NUHjs.populateRSCRouteModules.call(void 0, window.__reactRouterRouteModules, match);
|
|
795
809
|
let dataRoute = {
|
|
796
810
|
id: match.id,
|
|
797
811
|
element: match.element,
|
|
@@ -839,7 +853,7 @@ function createRouteFromServerManifest(match, payload) {
|
|
|
839
853
|
return await callSingleFetch(singleFetch);
|
|
840
854
|
}
|
|
841
855
|
}) : match.hasAction ? (_, singleFetch) => callSingleFetch(singleFetch) : () => {
|
|
842
|
-
throw
|
|
856
|
+
throw _chunkHNBICOIUjs.noActionDefinedError.call(void 0, "action", match.id);
|
|
843
857
|
},
|
|
844
858
|
path: match.path,
|
|
845
859
|
shouldRevalidate: match.shouldRevalidate,
|
|
@@ -851,7 +865,7 @@ function createRouteFromServerManifest(match, payload) {
|
|
|
851
865
|
hasClientAction: match.clientAction != null
|
|
852
866
|
};
|
|
853
867
|
if (typeof dataRoute.loader === "function") {
|
|
854
|
-
dataRoute.loader.hydrate =
|
|
868
|
+
dataRoute.loader.hydrate = _chunkHNBICOIUjs.shouldHydrateRouteLoader.call(void 0,
|
|
855
869
|
match.id,
|
|
856
870
|
match.clientLoader,
|
|
857
871
|
match.hasLoader,
|
|
@@ -861,7 +875,7 @@ function createRouteFromServerManifest(match, payload) {
|
|
|
861
875
|
return dataRoute;
|
|
862
876
|
}
|
|
863
877
|
function callSingleFetch(singleFetch) {
|
|
864
|
-
|
|
878
|
+
_chunkHNBICOIUjs.invariant.call(void 0, typeof singleFetch === "function", "Invalid singleFetch parameter");
|
|
865
879
|
return singleFetch();
|
|
866
880
|
}
|
|
867
881
|
function preventInvalidServerHandlerCall(type, routeId, hasHandler) {
|
|
@@ -869,7 +883,7 @@ function preventInvalidServerHandlerCall(type, routeId, hasHandler) {
|
|
|
869
883
|
let fn = type === "action" ? "serverAction()" : "serverLoader()";
|
|
870
884
|
let msg = `You are trying to call ${fn} on a route that does not have a server ${type} (routeId: "${routeId}")`;
|
|
871
885
|
console.error(msg);
|
|
872
|
-
throw new (0,
|
|
886
|
+
throw new (0, _chunkHNBICOIUjs.ErrorResponseImpl)(400, "Bad Request", new Error(msg), true);
|
|
873
887
|
}
|
|
874
888
|
}
|
|
875
889
|
var nextPaths = /* @__PURE__ */ new Set();
|
|
@@ -892,11 +906,12 @@ function getManifestUrl(paths) {
|
|
|
892
906
|
return url;
|
|
893
907
|
}
|
|
894
908
|
async function fetchAndApplyManifestPatches(paths, createFromReadableStream, fetchImplementation, signal) {
|
|
909
|
+
paths = _chunkHNBICOIUjs.getPathsWithAncestors.call(void 0, paths);
|
|
895
910
|
let url = getManifestUrl(paths);
|
|
896
911
|
if (url == null) {
|
|
897
912
|
return;
|
|
898
913
|
}
|
|
899
|
-
if (url.toString().length >
|
|
914
|
+
if (url.toString().length > _chunkHNBICOIUjs.URL_LIMIT) {
|
|
900
915
|
nextPaths.clear();
|
|
901
916
|
return;
|
|
902
917
|
}
|
|
@@ -939,12 +954,12 @@ function isExternalLocation(location2) {
|
|
|
939
954
|
const newLocation = new URL(location2, window.location.href);
|
|
940
955
|
return newLocation.origin !== window.location.origin;
|
|
941
956
|
}
|
|
942
|
-
function
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
return false;
|
|
957
|
+
function normalizeRedirectLocation(location2) {
|
|
958
|
+
if (_chunkHNBICOIUjs.PROTOCOL_RELATIVE_URL_REGEX.test(location2)) {
|
|
959
|
+
let path = _chunkHNBICOIUjs.resolvePath.call(void 0, location2);
|
|
960
|
+
return path.pathname + path.search + path.hash;
|
|
947
961
|
}
|
|
962
|
+
return location2;
|
|
948
963
|
}
|
|
949
964
|
function cloneRoutes(routes) {
|
|
950
965
|
if (!routes) return void 0;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v7.
|
|
2
|
+
* react-router v7.18.5
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -11,14 +11,14 @@
|
|
|
11
11
|
"use client";
|
|
12
12
|
import {
|
|
13
13
|
RSCRouterGlobalErrorBoundary,
|
|
14
|
-
deserializeErrors,
|
|
15
14
|
getHydrationData,
|
|
16
15
|
populateRSCRouteModules
|
|
17
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-IAM5GYT3.mjs";
|
|
18
17
|
import {
|
|
19
18
|
CRITICAL_CSS_DATA_ATTRIBUTE,
|
|
20
19
|
ErrorResponseImpl,
|
|
21
20
|
FrameworkContext,
|
|
21
|
+
PROTOCOL_RELATIVE_URL_REGEX,
|
|
22
22
|
RSCRouterContext,
|
|
23
23
|
RemixErrorBoundary,
|
|
24
24
|
RouterProvider,
|
|
@@ -31,20 +31,23 @@ import {
|
|
|
31
31
|
createRouter,
|
|
32
32
|
decodeViaTurboStream,
|
|
33
33
|
getPatchRoutesOnNavigationFunction,
|
|
34
|
+
getPathsWithAncestors,
|
|
34
35
|
getSingleFetchDataStrategyImpl,
|
|
35
36
|
getTurboStreamSingleFetchDataStrategy,
|
|
37
|
+
hasInvalidProtocol,
|
|
36
38
|
hydrationRouteProperties,
|
|
37
|
-
invalidProtocols,
|
|
38
39
|
invariant,
|
|
39
40
|
isMutationMethod,
|
|
40
41
|
mapRouteProperties,
|
|
41
42
|
noActionDefinedError,
|
|
43
|
+
resolvePath,
|
|
42
44
|
setIsHydrated,
|
|
43
45
|
shouldHydrateRouteLoader,
|
|
44
46
|
singleFetchUrl,
|
|
45
47
|
stripIndexParam,
|
|
46
|
-
useFogOFWarDiscovery
|
|
47
|
-
|
|
48
|
+
useFogOFWarDiscovery,
|
|
49
|
+
validateNavigationTarget
|
|
50
|
+
} from "./chunk-7RTFRKQW.mjs";
|
|
48
51
|
|
|
49
52
|
// lib/dom-export/dom-router-provider.tsx
|
|
50
53
|
import * as React from "react";
|
|
@@ -139,9 +142,6 @@ function createHydratedRouter({
|
|
|
139
142
|
basename: window.__reactRouterContext?.basename,
|
|
140
143
|
isSpaMode: ssrInfo.context.isSpaMode
|
|
141
144
|
});
|
|
142
|
-
if (hydrationData && hydrationData.errors) {
|
|
143
|
-
hydrationData.errors = deserializeErrors(hydrationData.errors);
|
|
144
|
-
}
|
|
145
145
|
}
|
|
146
146
|
if (window.history.state && window.history.state.masked) {
|
|
147
147
|
window.history.replaceState(
|
|
@@ -167,7 +167,7 @@ function createHydratedRouter({
|
|
|
167
167
|
ssrInfo.routeModules,
|
|
168
168
|
ssrInfo.context.ssr,
|
|
169
169
|
ssrInfo.context.basename,
|
|
170
|
-
ssrInfo.context.future.
|
|
170
|
+
ssrInfo.context.future.v8_trailingSlashAwareDataRequests
|
|
171
171
|
),
|
|
172
172
|
patchRoutesOnNavigation: getPatchRoutesOnNavigationFunction(
|
|
173
173
|
() => router2,
|
|
@@ -299,15 +299,22 @@ function createCallServer({
|
|
|
299
299
|
// @ts-expect-error - Needs React 19 types
|
|
300
300
|
Promise.resolve(payloadPromise).then(async (payload) => {
|
|
301
301
|
if (payload.type === "redirect") {
|
|
302
|
-
|
|
303
|
-
|
|
302
|
+
let location2 = normalizeRedirectLocation(payload.location);
|
|
303
|
+
validateNavigationTarget(
|
|
304
|
+
payload.location,
|
|
305
|
+
location2,
|
|
306
|
+
new URL(window.location.href),
|
|
307
|
+
"allow-explicit"
|
|
308
|
+
);
|
|
309
|
+
if (payload.reload || isExternalLocation(location2)) {
|
|
310
|
+
if (hasInvalidProtocol(location2)) {
|
|
304
311
|
throw new Error("Invalid redirect location");
|
|
305
312
|
}
|
|
306
|
-
window.location.href =
|
|
313
|
+
window.location.href = location2;
|
|
307
314
|
return;
|
|
308
315
|
}
|
|
309
316
|
React3.startTransition(() => {
|
|
310
|
-
globalVar.__reactRouterDataRouter.navigate(
|
|
317
|
+
globalVar.__reactRouterDataRouter.navigate(location2, {
|
|
311
318
|
replace: payload.replace
|
|
312
319
|
});
|
|
313
320
|
});
|
|
@@ -319,15 +326,22 @@ function createCallServer({
|
|
|
319
326
|
const rerender = await payload.rerender;
|
|
320
327
|
if (rerender && landedActionId < actionId && globalVar.__routerActionID <= actionId) {
|
|
321
328
|
if (rerender.type === "redirect") {
|
|
322
|
-
|
|
323
|
-
|
|
329
|
+
let location2 = normalizeRedirectLocation(rerender.location);
|
|
330
|
+
validateNavigationTarget(
|
|
331
|
+
rerender.location,
|
|
332
|
+
location2,
|
|
333
|
+
new URL(window.location.href),
|
|
334
|
+
"allow-explicit"
|
|
335
|
+
);
|
|
336
|
+
if (rerender.reload || isExternalLocation(location2)) {
|
|
337
|
+
if (hasInvalidProtocol(location2)) {
|
|
324
338
|
throw new Error("Invalid redirect location");
|
|
325
339
|
}
|
|
326
|
-
window.location.href =
|
|
340
|
+
window.location.href = location2;
|
|
327
341
|
return;
|
|
328
342
|
}
|
|
329
343
|
React3.startTransition(() => {
|
|
330
|
-
globalVar.__reactRouterDataRouter.navigate(
|
|
344
|
+
globalVar.__reactRouterDataRouter.navigate(location2, {
|
|
331
345
|
replace: rerender.replace
|
|
332
346
|
});
|
|
333
347
|
});
|
|
@@ -742,7 +756,7 @@ function RSCHydratedRouter({
|
|
|
742
756
|
// These flags have no runtime impact so can always be false. If we add
|
|
743
757
|
// flags that drive runtime behavior they'll need to be proxied through.
|
|
744
758
|
v8_middleware: false,
|
|
745
|
-
|
|
759
|
+
v8_trailingSlashAwareDataRequests: true,
|
|
746
760
|
// always on for RSC
|
|
747
761
|
v8_passThroughRequests: true
|
|
748
762
|
// always on for RSC
|
|
@@ -884,6 +898,7 @@ function getManifestUrl(paths) {
|
|
|
884
898
|
return url;
|
|
885
899
|
}
|
|
886
900
|
async function fetchAndApplyManifestPatches(paths, createFromReadableStream, fetchImplementation, signal) {
|
|
901
|
+
paths = getPathsWithAncestors(paths);
|
|
887
902
|
let url = getManifestUrl(paths);
|
|
888
903
|
if (url == null) {
|
|
889
904
|
return;
|
|
@@ -931,12 +946,12 @@ function isExternalLocation(location2) {
|
|
|
931
946
|
const newLocation = new URL(location2, window.location.href);
|
|
932
947
|
return newLocation.origin !== window.location.origin;
|
|
933
948
|
}
|
|
934
|
-
function
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
return false;
|
|
949
|
+
function normalizeRedirectLocation(location2) {
|
|
950
|
+
if (PROTOCOL_RELATIVE_URL_REGEX.test(location2)) {
|
|
951
|
+
let path = resolvePath(location2);
|
|
952
|
+
return path.pathname + path.search + path.hash;
|
|
939
953
|
}
|
|
954
|
+
return location2;
|
|
940
955
|
}
|
|
941
956
|
function cloneRoutes(routes) {
|
|
942
957
|
if (!routes) return void 0;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { l as ServerInstrumentation, H as HydrationState,
|
|
1
|
+
import { l as ServerInstrumentation, H as HydrationState, e as StaticHandlerContext, c as RelativeRoutingType, a as Router$1, g as RouterState, R as RouterInit, t as FutureConfig$1, C as ClientInstrumentation, d as GetScrollRestorationKeyFunction, F as Fetcher, B as BlockerFunction, u as CreateStaticHandlerOptions$1, S as StaticHandler } from './instrumentation-CPkMwccd.js';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { p as RouteManifest, aE as ServerRouteModule, t as MiddlewareEnabled, c as RouterContextProvider, u as AppLoadContext, s as LoaderFunctionArgs, a0 as ActionFunctionArgs, O as RouteModules, n as DataRouteObject, a as ClientLoaderFunction, o as RouteBranch, aF as TrackedPromise, f as History, T as To, L as Location, i as Action, ac as RouteMatch, Y as InitialEntry, _ as NonIndexRouteObject, a7 as LazyRouteFunction, Z as IndexRouteObject, P as Params, l as DataStrategyFunction, m as PatchRoutesOnNavigationFunction, e as RouteObject, U as UIMatch, q as HTMLFormMethod, F as FormEncType, av as PageLinkDescriptor, Q as SerializeFrom } from './data-
|
|
3
|
+
import { p as RouteManifest, aE as ServerRouteModule, t as MiddlewareEnabled, c as RouterContextProvider, u as AppLoadContext, s as LoaderFunctionArgs, a0 as ActionFunctionArgs, O as RouteModules, n as DataRouteObject, a as ClientLoaderFunction, o as RouteBranch, aF as TrackedPromise, f as History, T as To, L as Location, i as Action, ac as RouteMatch, Y as InitialEntry, _ as NonIndexRouteObject, a7 as LazyRouteFunction, Z as IndexRouteObject, P as Params, l as DataStrategyFunction, m as PatchRoutesOnNavigationFunction, e as RouteObject, U as UIMatch, q as HTMLFormMethod, F as FormEncType, av as PageLinkDescriptor, Q as SerializeFrom } from './data-CjO11-hU.js';
|
|
4
4
|
|
|
5
5
|
type ServerRouteManifest = RouteManifest<Omit<ServerRoute, "children">>;
|
|
6
6
|
interface ServerRoute extends Route$1 {
|
|
@@ -106,6 +106,7 @@ interface FrameworkContextObject {
|
|
|
106
106
|
ssr: boolean;
|
|
107
107
|
isSpaMode: boolean;
|
|
108
108
|
routeDiscovery: ServerBuild["routeDiscovery"];
|
|
109
|
+
nonce?: string;
|
|
109
110
|
serializeError?(error: Error): SerializedError;
|
|
110
111
|
renderMeta?: {
|
|
111
112
|
didRenderScripts?: boolean;
|
|
@@ -125,7 +126,7 @@ interface EntryContext extends FrameworkContextObject {
|
|
|
125
126
|
}
|
|
126
127
|
interface FutureConfig {
|
|
127
128
|
v8_passThroughRequests: boolean;
|
|
128
|
-
|
|
129
|
+
v8_trailingSlashAwareDataRequests: boolean;
|
|
129
130
|
v8_middleware: boolean;
|
|
130
131
|
}
|
|
131
132
|
type CriticalCss = string | {
|
|
@@ -196,6 +197,7 @@ interface NavigateOptions {
|
|
|
196
197
|
*/
|
|
197
198
|
interface Navigator {
|
|
198
199
|
createHref: History["createHref"];
|
|
200
|
+
createURL?: History["createURL"];
|
|
199
201
|
encodeLocation?: History["encodeLocation"];
|
|
200
202
|
go: History["go"];
|
|
201
203
|
push(to: To, state?: any, opts?: NavigateOptions): void;
|
|
@@ -346,6 +348,10 @@ interface MemoryRouterOpts {
|
|
|
346
348
|
* in-memory [`History`](https://developer.mozilla.org/en-US/docs/Web/API/History)
|
|
347
349
|
* stack. Useful for non-browser environments without a DOM API.
|
|
348
350
|
*
|
|
351
|
+
* Data Routers should not be held in React state. You should create your router
|
|
352
|
+
* once outside of the React tree and pass it to {@link RouterProvider | `<RouterProvider>`}.
|
|
353
|
+
* You can use `patchRoutesOnNavigation` to add additional routes programmatically.
|
|
354
|
+
*
|
|
349
355
|
* @public
|
|
350
356
|
* @category Data Routers
|
|
351
357
|
* @mode data
|
|
@@ -380,7 +386,9 @@ interface ClientOnErrorFunction {
|
|
|
380
386
|
*/
|
|
381
387
|
interface RouterProviderProps {
|
|
382
388
|
/**
|
|
383
|
-
* The {@link DataRouter} instance to use for navigation and data fetching.
|
|
389
|
+
* The {@link DataRouter} instance to use for navigation and data fetching. The
|
|
390
|
+
* router prop should be a single router instance created outside of the React
|
|
391
|
+
* tree. Avoid creating new routers during React renders/re-renders.
|
|
384
392
|
*/
|
|
385
393
|
router: Router$1;
|
|
386
394
|
/**
|
|
@@ -404,7 +412,7 @@ interface RouterProviderProps {
|
|
|
404
412
|
* and is only present for render errors.
|
|
405
413
|
*
|
|
406
414
|
* ```tsx
|
|
407
|
-
* <RouterProvider onError=(error, info) => {
|
|
415
|
+
* <RouterProvider onError={(error, info) => {
|
|
408
416
|
* let { location, params, pattern, errorInfo } = info;
|
|
409
417
|
* console.error(error, location, errorInfo);
|
|
410
418
|
* reportToErrorService(error, location, errorInfo);
|
|
@@ -434,7 +442,9 @@ interface RouterProviderProps {
|
|
|
434
442
|
}
|
|
435
443
|
/**
|
|
436
444
|
* Render the UI for the given {@link DataRouter}. This component should
|
|
437
|
-
* typically be at the top of an app's element tree.
|
|
445
|
+
* typically be at the top of an app's element tree. The router prop should
|
|
446
|
+
* be a single router instance created outside of the React tree. Avoid
|
|
447
|
+
* creating new routers during React renders/re-renders.
|
|
438
448
|
*
|
|
439
449
|
* ```tsx
|
|
440
450
|
* import { createBrowserRouter } from "react-router";
|
|
@@ -1347,7 +1357,8 @@ interface LinksProps {
|
|
|
1347
1357
|
/**
|
|
1348
1358
|
* A [`nonce`](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/nonce)
|
|
1349
1359
|
* attribute to render on the [`<link>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link)
|
|
1350
|
-
* element
|
|
1360
|
+
* element. If not provided in Framework Mode, it will default to any
|
|
1361
|
+
* {@link ServerRouter | `<ServerRouter nonce>`} prop.
|
|
1351
1362
|
*/
|
|
1352
1363
|
nonce?: string | undefined;
|
|
1353
1364
|
/**
|
|
@@ -1464,7 +1475,8 @@ type ScriptsProps = Omit<React.HTMLProps<HTMLScriptElement>, "async" | "children
|
|
|
1464
1475
|
/**
|
|
1465
1476
|
* A [`nonce`](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/nonce)
|
|
1466
1477
|
* attribute to render on the [`<script>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script)
|
|
1467
|
-
* element
|
|
1478
|
+
* element. If not provided in Framework Mode, it will default to any
|
|
1479
|
+
* {@link ServerRouter | `<ServerRouter nonce>`} prop.
|
|
1468
1480
|
*/
|
|
1469
1481
|
nonce?: string | undefined;
|
|
1470
1482
|
};
|
|
@@ -1996,6 +2008,10 @@ interface DOMRouterOpts {
|
|
|
1996
2008
|
* path via [`history.pushState`](https://developer.mozilla.org/en-US/docs/Web/API/History/pushState)
|
|
1997
2009
|
* and [`history.replaceState`](https://developer.mozilla.org/en-US/docs/Web/API/History/replaceState).
|
|
1998
2010
|
*
|
|
2011
|
+
* Data Routers should not be held in React state. You should create your router
|
|
2012
|
+
* once outside of the React tree and pass it to {@link RouterProvider | `<RouterProvider>`}.
|
|
2013
|
+
* You can use `patchRoutesOnNavigation` to add additional routes programmatically.
|
|
2014
|
+
*
|
|
1999
2015
|
* @public
|
|
2000
2016
|
* @category Data Routers
|
|
2001
2017
|
* @mode data
|
|
@@ -2016,6 +2032,10 @@ declare function createBrowserRouter(routes: RouteObject[], opts?: DOMRouterOpts
|
|
|
2016
2032
|
* Create a new {@link DataRouter| data router} that manages the application
|
|
2017
2033
|
* path via the URL [`hash`](https://developer.mozilla.org/en-US/docs/Web/API/URL/hash).
|
|
2018
2034
|
*
|
|
2035
|
+
* Data Routers should not be held in React state. You should create your router
|
|
2036
|
+
* once outside of the React tree and pass it to {@link RouterProvider | `<RouterProvider>`}.
|
|
2037
|
+
* You can use `patchRoutesOnNavigation` to add additional routes programmatically.
|
|
2038
|
+
*
|
|
2019
2039
|
* @public
|
|
2020
2040
|
* @category Data Routers
|
|
2021
2041
|
* @mode data
|
|
@@ -2836,7 +2856,10 @@ type ScrollRestorationProps = ScriptsProps & {
|
|
|
2836
2856
|
* }
|
|
2837
2857
|
* ```
|
|
2838
2858
|
*
|
|
2839
|
-
* This component renders an inline `<script>` to prevent scroll flashing. The
|
|
2859
|
+
* This component renders an inline `<script>` to prevent scroll flashing. The
|
|
2860
|
+
* `nonce` prop will be passed down to the script tag to allow CSP nonce usage.
|
|
2861
|
+
* If not provided in Framework Mode, it will default to any
|
|
2862
|
+
* {@link ServerRouter | `<ServerRouter nonce>`} prop.
|
|
2840
2863
|
*
|
|
2841
2864
|
* ```tsx
|
|
2842
2865
|
* <ScrollRestoration nonce={cspNonce} />
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { o as ServerInstrumentation, H as HydrationState,
|
|
1
|
+
import { o as ServerInstrumentation, H as HydrationState, h as StaticHandlerContext, f as RelativeRoutingType, g as GetScrollRestorationKeyFunction, R as RouterInit, ah as FutureConfig$1, C as ClientInstrumentation, N as NavigateOptions, F as Fetcher, c as Router, B as BlockerFunction, ai as CreateStaticHandlerOptions$1, S as StaticHandler } from './context-BlYKn1tE.mjs';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { J as RouteManifest, aF as ServerRouteModule, p as MiddlewareEnabled, c as RouterContextProvider, q as AppLoadContext, o as LoaderFunctionArgs, a3 as ActionFunctionArgs, Z as RouteModules, E as DataRouteObject, a as ClientLoaderFunction, I as RouteBranch, m as HTMLFormMethod, n as FormEncType, aw as PageLinkDescriptor, T as To, s as History, z as DataStrategyFunction, B as PatchRoutesOnNavigationFunction, r as RouteObject, _ as SerializeFrom, L as Location } from './data-
|
|
3
|
+
import { J as RouteManifest, aF as ServerRouteModule, p as MiddlewareEnabled, c as RouterContextProvider, q as AppLoadContext, o as LoaderFunctionArgs, a3 as ActionFunctionArgs, Z as RouteModules, E as DataRouteObject, a as ClientLoaderFunction, I as RouteBranch, m as HTMLFormMethod, n as FormEncType, aw as PageLinkDescriptor, T as To, s as History, z as DataStrategyFunction, B as PatchRoutesOnNavigationFunction, r as RouteObject, _ as SerializeFrom, L as Location } from './data-DEjBmEfD.mjs';
|
|
4
4
|
|
|
5
5
|
type ServerRouteManifest = RouteManifest<Omit<ServerRoute, "children">>;
|
|
6
6
|
interface ServerRoute extends Route {
|
|
@@ -106,6 +106,7 @@ interface FrameworkContextObject {
|
|
|
106
106
|
ssr: boolean;
|
|
107
107
|
isSpaMode: boolean;
|
|
108
108
|
routeDiscovery: ServerBuild["routeDiscovery"];
|
|
109
|
+
nonce?: string;
|
|
109
110
|
serializeError?(error: Error): SerializedError;
|
|
110
111
|
renderMeta?: {
|
|
111
112
|
didRenderScripts?: boolean;
|
|
@@ -125,7 +126,7 @@ interface EntryContext extends FrameworkContextObject {
|
|
|
125
126
|
}
|
|
126
127
|
interface FutureConfig {
|
|
127
128
|
v8_passThroughRequests: boolean;
|
|
128
|
-
|
|
129
|
+
v8_trailingSlashAwareDataRequests: boolean;
|
|
129
130
|
v8_middleware: boolean;
|
|
130
131
|
}
|
|
131
132
|
type CriticalCss = string | {
|
|
@@ -292,7 +293,8 @@ interface LinksProps {
|
|
|
292
293
|
/**
|
|
293
294
|
* A [`nonce`](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/nonce)
|
|
294
295
|
* attribute to render on the [`<link>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link)
|
|
295
|
-
* element
|
|
296
|
+
* element. If not provided in Framework Mode, it will default to any
|
|
297
|
+
* {@link ServerRouter | `<ServerRouter nonce>`} prop.
|
|
296
298
|
*/
|
|
297
299
|
nonce?: string | undefined;
|
|
298
300
|
/**
|
|
@@ -409,7 +411,8 @@ type ScriptsProps = Omit<React.HTMLProps<HTMLScriptElement>, "async" | "children
|
|
|
409
411
|
/**
|
|
410
412
|
* A [`nonce`](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/nonce)
|
|
411
413
|
* attribute to render on the [`<script>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script)
|
|
412
|
-
* element
|
|
414
|
+
* element. If not provided in Framework Mode, it will default to any
|
|
415
|
+
* {@link ServerRouter | `<ServerRouter nonce>`} prop.
|
|
413
416
|
*/
|
|
414
417
|
nonce?: string | undefined;
|
|
415
418
|
};
|
|
@@ -941,6 +944,10 @@ interface DOMRouterOpts {
|
|
|
941
944
|
* path via [`history.pushState`](https://developer.mozilla.org/en-US/docs/Web/API/History/pushState)
|
|
942
945
|
* and [`history.replaceState`](https://developer.mozilla.org/en-US/docs/Web/API/History/replaceState).
|
|
943
946
|
*
|
|
947
|
+
* Data Routers should not be held in React state. You should create your router
|
|
948
|
+
* once outside of the React tree and pass it to {@link RouterProvider | `<RouterProvider>`}.
|
|
949
|
+
* You can use `patchRoutesOnNavigation` to add additional routes programmatically.
|
|
950
|
+
*
|
|
944
951
|
* @public
|
|
945
952
|
* @category Data Routers
|
|
946
953
|
* @mode data
|
|
@@ -961,6 +968,10 @@ declare function createBrowserRouter(routes: RouteObject[], opts?: DOMRouterOpts
|
|
|
961
968
|
* Create a new {@link DataRouter| data router} that manages the application
|
|
962
969
|
* path via the URL [`hash`](https://developer.mozilla.org/en-US/docs/Web/API/URL/hash).
|
|
963
970
|
*
|
|
971
|
+
* Data Routers should not be held in React state. You should create your router
|
|
972
|
+
* once outside of the React tree and pass it to {@link RouterProvider | `<RouterProvider>`}.
|
|
973
|
+
* You can use `patchRoutesOnNavigation` to add additional routes programmatically.
|
|
974
|
+
*
|
|
964
975
|
* @public
|
|
965
976
|
* @category Data Routers
|
|
966
977
|
* @mode data
|
|
@@ -1781,7 +1792,10 @@ type ScrollRestorationProps = ScriptsProps & {
|
|
|
1781
1792
|
* }
|
|
1782
1793
|
* ```
|
|
1783
1794
|
*
|
|
1784
|
-
* This component renders an inline `<script>` to prevent scroll flashing. The
|
|
1795
|
+
* This component renders an inline `<script>` to prevent scroll flashing. The
|
|
1796
|
+
* `nonce` prop will be passed down to the script tag to allow CSP nonce usage.
|
|
1797
|
+
* If not provided in Framework Mode, it will default to any
|
|
1798
|
+
* {@link ServerRouter | `<ServerRouter nonce>`} prop.
|
|
1785
1799
|
*
|
|
1786
1800
|
* ```tsx
|
|
1787
1801
|
* <ScrollRestoration nonce={cspNonce} />
|