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
|
/**
|
|
2
|
-
* react-router v7.
|
|
2
|
+
* react-router v7.18.5
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -16,6 +16,13 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
|
|
|
16
16
|
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
17
17
|
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
18
18
|
|
|
19
|
+
// lib/router/url.ts
|
|
20
|
+
var ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i;
|
|
21
|
+
var PROTOCOL_RELATIVE_URL_REGEX = /^[\\/]{2}/;
|
|
22
|
+
function normalizeProtocolRelativeUrl(url, protocol) {
|
|
23
|
+
return protocol + url.replace(/\\/g, "/");
|
|
24
|
+
}
|
|
25
|
+
|
|
19
26
|
// lib/router/history.ts
|
|
20
27
|
var Action = /* @__PURE__ */ ((Action2) => {
|
|
21
28
|
Action2["Pop"] = "POP";
|
|
@@ -325,7 +332,7 @@ function getUrlBasedHistory(getLocation, createHref2, validateLocation, options
|
|
|
325
332
|
}
|
|
326
333
|
}
|
|
327
334
|
function createURL(to) {
|
|
328
|
-
return createBrowserURLImpl(to);
|
|
335
|
+
return createBrowserURLImpl(window2, to);
|
|
329
336
|
}
|
|
330
337
|
let history = {
|
|
331
338
|
get action() {
|
|
@@ -365,15 +372,15 @@ function getUrlBasedHistory(getLocation, createHref2, validateLocation, options
|
|
|
365
372
|
};
|
|
366
373
|
return history;
|
|
367
374
|
}
|
|
368
|
-
function createBrowserURLImpl(to, isAbsolute = false) {
|
|
375
|
+
function createBrowserURLImpl(windowImpl, to, isAbsolute = false) {
|
|
369
376
|
let base = "http://localhost";
|
|
370
|
-
if (
|
|
371
|
-
base =
|
|
377
|
+
if (windowImpl) {
|
|
378
|
+
base = windowImpl.location.origin !== "null" ? windowImpl.location.origin : windowImpl.location.href;
|
|
372
379
|
}
|
|
373
380
|
invariant(base, "No window.location.(origin|href) available to create URL");
|
|
374
381
|
let href = typeof to === "string" ? to : createPath(to);
|
|
375
382
|
href = href.replace(/ $/, "%20");
|
|
376
|
-
if (!isAbsolute &&
|
|
383
|
+
if (!isAbsolute && PROTOCOL_RELATIVE_URL_REGEX.test(href)) {
|
|
377
384
|
href = base + href;
|
|
378
385
|
}
|
|
379
386
|
return new URL(href, base);
|
|
@@ -591,7 +598,18 @@ function flattenRoutes(routes, branches = [], parentsMeta = [], parentPath = "",
|
|
|
591
598
|
branches.push({
|
|
592
599
|
path,
|
|
593
600
|
score: computeScore(path, route.index),
|
|
594
|
-
routesMeta
|
|
601
|
+
routesMeta: routesMeta.map((meta2, i) => {
|
|
602
|
+
let [matcher, params] = compilePath(
|
|
603
|
+
meta2.relativePath,
|
|
604
|
+
meta2.caseSensitive,
|
|
605
|
+
i === routesMeta.length - 1
|
|
606
|
+
);
|
|
607
|
+
return {
|
|
608
|
+
...meta2,
|
|
609
|
+
matcher,
|
|
610
|
+
compiledParams: params
|
|
611
|
+
};
|
|
612
|
+
})
|
|
595
613
|
});
|
|
596
614
|
};
|
|
597
615
|
routes.forEach((route, index) => {
|
|
@@ -680,9 +698,19 @@ function matchRouteBranch(branch, pathname, allowPartial = false) {
|
|
|
680
698
|
let meta = routesMeta[i];
|
|
681
699
|
let end = i === routesMeta.length - 1;
|
|
682
700
|
let remainingPathname = matchedPathname === "/" ? pathname : pathname.slice(matchedPathname.length) || "/";
|
|
683
|
-
let
|
|
684
|
-
|
|
685
|
-
|
|
701
|
+
let pattern = {
|
|
702
|
+
path: meta.relativePath,
|
|
703
|
+
caseSensitive: meta.caseSensitive,
|
|
704
|
+
end
|
|
705
|
+
};
|
|
706
|
+
let match = (
|
|
707
|
+
// Use precomputed matcher if it exists
|
|
708
|
+
meta.matcher && meta.compiledParams ? matchPathImpl(
|
|
709
|
+
pattern,
|
|
710
|
+
remainingPathname,
|
|
711
|
+
meta.matcher,
|
|
712
|
+
meta.compiledParams
|
|
713
|
+
) : matchPath(pattern, remainingPathname)
|
|
686
714
|
);
|
|
687
715
|
let route = meta.route;
|
|
688
716
|
if (!match && end && allowPartial && !routesMeta[routesMeta.length - 1].route.index) {
|
|
@@ -750,16 +778,22 @@ function matchPath(pattern, pathname) {
|
|
|
750
778
|
pattern.caseSensitive,
|
|
751
779
|
pattern.end
|
|
752
780
|
);
|
|
781
|
+
return matchPathImpl(pattern, pathname, matcher, compiledParams);
|
|
782
|
+
}
|
|
783
|
+
function matchPathImpl(pattern, pathname, matcher, compiledParams) {
|
|
753
784
|
let match = pathname.match(matcher);
|
|
754
785
|
if (!match) return null;
|
|
755
786
|
let matchedPathname = match[0];
|
|
756
|
-
let pathnameBase = matchedPathname
|
|
787
|
+
let pathnameBase = removeTrailingSlash(matchedPathname, 1);
|
|
757
788
|
let captureGroups = match.slice(1);
|
|
758
789
|
let params = compiledParams.reduce(
|
|
759
790
|
(memo2, { paramName, isOptional }, index) => {
|
|
760
791
|
if (paramName === "*") {
|
|
761
792
|
let splatValue = captureGroups[index] || "";
|
|
762
|
-
pathnameBase =
|
|
793
|
+
pathnameBase = removeTrailingSlash(
|
|
794
|
+
matchedPathname.slice(0, matchedPathname.length - splatValue.length),
|
|
795
|
+
1
|
|
796
|
+
);
|
|
763
797
|
}
|
|
764
798
|
const value = captureGroups[index];
|
|
765
799
|
if (isOptional && !value) {
|
|
@@ -839,7 +873,6 @@ function prependBasename({
|
|
|
839
873
|
}) {
|
|
840
874
|
return pathname === "/" ? basename : joinPaths([basename, pathname]);
|
|
841
875
|
}
|
|
842
|
-
var ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
|
|
843
876
|
var isAbsoluteUrl = (url) => ABSOLUTE_URL_REGEX.test(url);
|
|
844
877
|
function resolvePath(to, fromPathname = "/") {
|
|
845
878
|
let {
|
|
@@ -850,7 +883,7 @@ function resolvePath(to, fromPathname = "/") {
|
|
|
850
883
|
let pathname;
|
|
851
884
|
if (toPathname) {
|
|
852
885
|
toPathname = removeDoubleSlashes(toPathname);
|
|
853
|
-
if (toPathname.startsWith("/")) {
|
|
886
|
+
if (toPathname.startsWith("/") || toPathname.startsWith("\\")) {
|
|
854
887
|
pathname = resolvePathname(toPathname.substring(1), "/");
|
|
855
888
|
} else {
|
|
856
889
|
pathname = resolvePathname(toPathname, fromPathname);
|
|
@@ -936,9 +969,15 @@ function resolveTo(toArg, routePathnames, locationPathname, isPathRelative = fal
|
|
|
936
969
|
}
|
|
937
970
|
return path;
|
|
938
971
|
}
|
|
939
|
-
var removeDoubleSlashes = (path) => path.replace(
|
|
972
|
+
var removeDoubleSlashes = (path) => path.replace(/[\\/]{2,}/g, "/");
|
|
940
973
|
var joinPaths = (paths) => removeDoubleSlashes(paths.join("/"));
|
|
941
|
-
|
|
974
|
+
function removeTrailingSlash(path, minLength = 0) {
|
|
975
|
+
let end = path.length;
|
|
976
|
+
while (end > minLength && path.charCodeAt(end - 1) === 47) {
|
|
977
|
+
end--;
|
|
978
|
+
}
|
|
979
|
+
return end === path.length ? path : path.slice(0, end);
|
|
980
|
+
}
|
|
942
981
|
var normalizePathname = (pathname) => removeTrailingSlash(pathname).replace(/^\/*/, "/");
|
|
943
982
|
var normalizeSearch = (search) => !search || search === "?" ? "" : search.startsWith("?") ? search : "?" + search;
|
|
944
983
|
var normalizeHash = (hash) => !hash || hash === "#" ? "" : hash.startsWith("#") ? hash : "#" + hash;
|
|
@@ -976,6 +1015,14 @@ var replace = (url, init) => {
|
|
|
976
1015
|
response.headers.set("X-Remix-Replace", "true");
|
|
977
1016
|
return response;
|
|
978
1017
|
};
|
|
1018
|
+
var SUPPORTED_ERROR_TYPES = [
|
|
1019
|
+
"EvalError",
|
|
1020
|
+
"RangeError",
|
|
1021
|
+
"ReferenceError",
|
|
1022
|
+
"SyntaxError",
|
|
1023
|
+
"TypeError",
|
|
1024
|
+
"URIError"
|
|
1025
|
+
];
|
|
979
1026
|
var ErrorResponseImpl = class {
|
|
980
1027
|
constructor(status, statusText, data2, internal = false) {
|
|
981
1028
|
this.status = status;
|
|
@@ -1011,7 +1058,7 @@ function parseToInfo(_to, basename) {
|
|
|
1011
1058
|
if (isBrowser) {
|
|
1012
1059
|
try {
|
|
1013
1060
|
let currentUrl = new URL(window.location.href);
|
|
1014
|
-
let targetUrl =
|
|
1061
|
+
let targetUrl = PROTOCOL_RELATIVE_URL_REGEX.test(to) ? new URL(normalizeProtocolRelativeUrl(to, currentUrl.protocol)) : new URL(to);
|
|
1015
1062
|
let path = stripBasename(targetUrl.pathname, basename);
|
|
1016
1063
|
if (targetUrl.origin === currentUrl.origin && path != null) {
|
|
1017
1064
|
to = path + targetUrl.search + targetUrl.hash;
|
|
@@ -1303,6 +1350,51 @@ function isPlainObject(thing) {
|
|
|
1303
1350
|
return proto === Object.prototype || proto === null || Object.getOwnPropertyNames(proto).sort().join("\0") === objectProtoNames;
|
|
1304
1351
|
}
|
|
1305
1352
|
|
|
1353
|
+
// lib/router/navigation.ts
|
|
1354
|
+
var DEFAULT_NAVIGATION_URL = new URL("http://localhost");
|
|
1355
|
+
function getNavigatorCurrentUrl(navigator) {
|
|
1356
|
+
if (navigator.createURL) {
|
|
1357
|
+
return navigator.createURL("/");
|
|
1358
|
+
}
|
|
1359
|
+
try {
|
|
1360
|
+
return new URL(navigator.createHref("/"), DEFAULT_NAVIGATION_URL);
|
|
1361
|
+
} catch {
|
|
1362
|
+
return DEFAULT_NAVIGATION_URL;
|
|
1363
|
+
}
|
|
1364
|
+
}
|
|
1365
|
+
function isSameOrigin(a, b) {
|
|
1366
|
+
return a.origin === b.origin && (a.origin !== "null" || a.protocol === b.protocol && a.host === b.host);
|
|
1367
|
+
}
|
|
1368
|
+
function isExplicitUrl(destination, target) {
|
|
1369
|
+
if (destination.startsWith("//")) {
|
|
1370
|
+
return true;
|
|
1371
|
+
}
|
|
1372
|
+
let protocol = target.protocol.toLowerCase();
|
|
1373
|
+
if (!destination.toLowerCase().startsWith(protocol)) {
|
|
1374
|
+
return false;
|
|
1375
|
+
}
|
|
1376
|
+
return target.host === "" || destination.slice(protocol.length).startsWith("//");
|
|
1377
|
+
}
|
|
1378
|
+
function validateNavigationTarget(original, resolved, currentUrl, externalPolicy) {
|
|
1379
|
+
let originalUrl = null;
|
|
1380
|
+
try {
|
|
1381
|
+
originalUrl = original == null ? null : new URL(original, currentUrl);
|
|
1382
|
+
} catch {
|
|
1383
|
+
}
|
|
1384
|
+
let resolvedUrl = new URL(resolved, currentUrl);
|
|
1385
|
+
let originalIsExternal = originalUrl != null && !isSameOrigin(originalUrl, currentUrl);
|
|
1386
|
+
let resolvedIsExternal = !isSameOrigin(resolvedUrl, currentUrl);
|
|
1387
|
+
if (externalPolicy === "reject") {
|
|
1388
|
+
if (originalIsExternal || resolvedIsExternal) {
|
|
1389
|
+
throw new Error("External navigation is not allowed");
|
|
1390
|
+
}
|
|
1391
|
+
} else if (resolvedIsExternal) {
|
|
1392
|
+
if (originalUrl == null || !isExplicitUrl(original, originalUrl) || !isSameOrigin(originalUrl, resolvedUrl)) {
|
|
1393
|
+
throw new Error("External navigation is not allowed");
|
|
1394
|
+
}
|
|
1395
|
+
}
|
|
1396
|
+
}
|
|
1397
|
+
|
|
1306
1398
|
// lib/router/router.ts
|
|
1307
1399
|
var validMutationMethodsArr = [
|
|
1308
1400
|
"POST",
|
|
@@ -1726,7 +1818,7 @@ function createRouter(init) {
|
|
|
1726
1818
|
init.history.replace(location, location.state);
|
|
1727
1819
|
}
|
|
1728
1820
|
let viewTransitionOpts;
|
|
1729
|
-
if (pendingAction === "POP" /* Pop */) {
|
|
1821
|
+
if (pendingAction === "POP" /* Pop */ && !isUninterruptedRevalidation && location !== state.location) {
|
|
1730
1822
|
let priorPaths = appliedViewTransitions.get(state.location.pathname);
|
|
1731
1823
|
if (priorPaths && priorPaths.has(location.pathname)) {
|
|
1732
1824
|
viewTransitionOpts = {
|
|
@@ -1814,11 +1906,21 @@ function createRouter(init) {
|
|
|
1814
1906
|
...opts.mask
|
|
1815
1907
|
};
|
|
1816
1908
|
maskPath = {
|
|
1817
|
-
pathname: "",
|
|
1818
|
-
search: "",
|
|
1819
|
-
hash: ""
|
|
1820
|
-
...partialPath
|
|
1909
|
+
pathname: partialPath.pathname ?? "",
|
|
1910
|
+
search: partialPath.search ?? "",
|
|
1911
|
+
hash: partialPath.hash ?? ""
|
|
1821
1912
|
};
|
|
1913
|
+
if (PROTOCOL_RELATIVE_URL_REGEX.test(maskPath.pathname)) {
|
|
1914
|
+
throw new Error("External navigation is not allowed");
|
|
1915
|
+
} else if (maskPath.pathname.startsWith("\\")) {
|
|
1916
|
+
maskPath.pathname = maskPath.pathname.replace(/^\\+/, "/");
|
|
1917
|
+
}
|
|
1918
|
+
validateNavigationTarget(
|
|
1919
|
+
typeof opts.mask === "string" ? opts.mask : createPath(opts.mask),
|
|
1920
|
+
createPath(maskPath),
|
|
1921
|
+
init.history.createURL("/"),
|
|
1922
|
+
"reject"
|
|
1923
|
+
);
|
|
1822
1924
|
}
|
|
1823
1925
|
let currentLocation = state.location;
|
|
1824
1926
|
let nextLocation = createLocation(
|
|
@@ -1832,6 +1934,12 @@ function createRouter(init) {
|
|
|
1832
1934
|
...nextLocation,
|
|
1833
1935
|
...init.history.encodeLocation(nextLocation)
|
|
1834
1936
|
};
|
|
1937
|
+
validateNavigationTarget(
|
|
1938
|
+
to == null ? init.history.createHref(state.location) : typeof to === "string" ? to : createPath(to),
|
|
1939
|
+
init.history.createHref(nextLocation.mask || nextLocation),
|
|
1940
|
+
init.history.createURL("/"),
|
|
1941
|
+
"reject"
|
|
1942
|
+
);
|
|
1835
1943
|
let userReplace = opts && opts.replace != null ? opts.replace : void 0;
|
|
1836
1944
|
let historyAction = "PUSH" /* Push */;
|
|
1837
1945
|
if (userReplace === true) {
|
|
@@ -2842,12 +2950,20 @@ function createRouter(init) {
|
|
|
2842
2950
|
}
|
|
2843
2951
|
let location = redirect2.response.headers.get("Location");
|
|
2844
2952
|
invariant(location, "Expected a Location header on the redirect Response");
|
|
2953
|
+
let originalLocation = location;
|
|
2954
|
+
let currentUrl = new URL(request.url);
|
|
2845
2955
|
location = normalizeRedirectLocation(
|
|
2846
2956
|
location,
|
|
2847
|
-
|
|
2957
|
+
currentUrl,
|
|
2848
2958
|
basename,
|
|
2849
2959
|
init.history
|
|
2850
2960
|
);
|
|
2961
|
+
validateNavigationTarget(
|
|
2962
|
+
originalLocation,
|
|
2963
|
+
location,
|
|
2964
|
+
currentUrl,
|
|
2965
|
+
"allow-explicit"
|
|
2966
|
+
);
|
|
2851
2967
|
let redirectLocation = createLocation(state.location, location, {
|
|
2852
2968
|
_isRedirect: true
|
|
2853
2969
|
});
|
|
@@ -2856,7 +2972,7 @@ function createRouter(init) {
|
|
|
2856
2972
|
if (redirect2.response.headers.has("X-Remix-Reload-Document")) {
|
|
2857
2973
|
isDocumentReload = true;
|
|
2858
2974
|
} else if (isAbsoluteUrl(location)) {
|
|
2859
|
-
const url = createBrowserURLImpl(location, true);
|
|
2975
|
+
const url = createBrowserURLImpl(routerWindow, location, true);
|
|
2860
2976
|
isDocumentReload = // Hard reload if it's an absolute URL to a new origin
|
|
2861
2977
|
url.origin !== routerWindow.location.origin || // Hard reload if it's an absolute URL that does not match our basename
|
|
2862
2978
|
stripBasename(url.pathname, basename) == null;
|
|
@@ -3366,6 +3482,7 @@ function createRouter(init) {
|
|
|
3366
3482
|
// Passthrough to history-aware createHref used by useHref so we get proper
|
|
3367
3483
|
// hash-aware URLs in DOM paths
|
|
3368
3484
|
createHref: (to) => init.history.createHref(to),
|
|
3485
|
+
createURL: (to) => init.history.createURL(to),
|
|
3369
3486
|
encodeLocation: (to) => init.history.encodeLocation(to),
|
|
3370
3487
|
getFetcher,
|
|
3371
3488
|
resetFetcher,
|
|
@@ -3421,6 +3538,10 @@ function createStaticHandler(routes, opts) {
|
|
|
3421
3538
|
manifest
|
|
3422
3539
|
);
|
|
3423
3540
|
let routeBranches = flattenAndRankRoutes(dataRoutes);
|
|
3541
|
+
let matchCost = routeBranches.reduce(
|
|
3542
|
+
(total, branch) => total + branch.routesMeta.length,
|
|
3543
|
+
0
|
|
3544
|
+
);
|
|
3424
3545
|
async function query(request, {
|
|
3425
3546
|
requestContext,
|
|
3426
3547
|
filterMatchesToLoad,
|
|
@@ -4042,6 +4163,7 @@ function createStaticHandler(routes, opts) {
|
|
|
4042
4163
|
}
|
|
4043
4164
|
return {
|
|
4044
4165
|
dataRoutes,
|
|
4166
|
+
_matchCost: matchCost,
|
|
4045
4167
|
_internalRouteBranches: routeBranches,
|
|
4046
4168
|
query,
|
|
4047
4169
|
queryRoute
|
|
@@ -5203,11 +5325,20 @@ var invalidProtocols = [
|
|
|
5203
5325
|
// eslint-disable-next-line no-script-url
|
|
5204
5326
|
"javascript:"
|
|
5205
5327
|
];
|
|
5328
|
+
function hasInvalidProtocol(location) {
|
|
5329
|
+
try {
|
|
5330
|
+
return invalidProtocols.includes(new URL(location).protocol);
|
|
5331
|
+
} catch {
|
|
5332
|
+
return false;
|
|
5333
|
+
}
|
|
5334
|
+
}
|
|
5206
5335
|
function normalizeRedirectLocation(location, currentUrl, basename, historyInstance) {
|
|
5207
5336
|
if (isAbsoluteUrl(location)) {
|
|
5208
5337
|
let normalizedLocation = location;
|
|
5209
|
-
let url =
|
|
5210
|
-
|
|
5338
|
+
let url = PROTOCOL_RELATIVE_URL_REGEX.test(normalizedLocation) ? new URL(
|
|
5339
|
+
normalizeProtocolRelativeUrl(normalizedLocation, currentUrl.protocol)
|
|
5340
|
+
) : new URL(normalizedLocation);
|
|
5341
|
+
if (hasInvalidProtocol(url.toString())) {
|
|
5211
5342
|
throw new Error("Invalid redirect location");
|
|
5212
5343
|
}
|
|
5213
5344
|
let isSameBasename = stripBasename(url.pathname, basename) != null;
|
|
@@ -5217,7 +5348,7 @@ function normalizeRedirectLocation(location, currentUrl, basename, historyInstan
|
|
|
5217
5348
|
}
|
|
5218
5349
|
try {
|
|
5219
5350
|
let url = historyInstance.createURL(location);
|
|
5220
|
-
if (
|
|
5351
|
+
if (hasInvalidProtocol(url.toString())) {
|
|
5221
5352
|
throw new Error("Invalid redirect location");
|
|
5222
5353
|
}
|
|
5223
5354
|
} catch (e) {
|
|
@@ -5898,6 +6029,12 @@ function useNavigateUnstable() {
|
|
|
5898
6029
|
if (dataRouterContext == null && basename !== "/") {
|
|
5899
6030
|
path.pathname = path.pathname === "/" ? basename : joinPaths([basename, path.pathname]);
|
|
5900
6031
|
}
|
|
6032
|
+
validateNavigationTarget(
|
|
6033
|
+
typeof to === "string" ? to : createPath(to),
|
|
6034
|
+
navigator.createHref(path),
|
|
6035
|
+
getNavigatorCurrentUrl(navigator),
|
|
6036
|
+
"reject"
|
|
6037
|
+
);
|
|
5901
6038
|
(!!options.replace ? navigator.replace : navigator.push)(
|
|
5902
6039
|
path,
|
|
5903
6040
|
options.state,
|
|
@@ -6139,16 +6276,26 @@ function RSCErrorHandler({
|
|
|
6139
6276
|
children,
|
|
6140
6277
|
error
|
|
6141
6278
|
}) {
|
|
6142
|
-
let { basename } = React2.useContext(NavigationContext);
|
|
6279
|
+
let { basename, navigator } = React2.useContext(NavigationContext);
|
|
6143
6280
|
if (typeof error === "object" && error && "digest" in error && typeof error.digest === "string") {
|
|
6144
6281
|
let redirect2 = decodeRedirectErrorDigest(error.digest);
|
|
6145
6282
|
if (redirect2) {
|
|
6146
6283
|
let existingRedirect = errorRedirectHandledMap.get(error);
|
|
6147
6284
|
if (existingRedirect) throw existingRedirect;
|
|
6148
6285
|
let parsed = parseToInfo(redirect2.location, basename);
|
|
6286
|
+
let target = parsed.absoluteURL || parsed.to;
|
|
6287
|
+
validateNavigationTarget(
|
|
6288
|
+
redirect2.location,
|
|
6289
|
+
target,
|
|
6290
|
+
getNavigatorCurrentUrl(navigator),
|
|
6291
|
+
"allow-explicit"
|
|
6292
|
+
);
|
|
6293
|
+
if (hasInvalidProtocol(target)) {
|
|
6294
|
+
throw new Error("Invalid redirect location");
|
|
6295
|
+
}
|
|
6149
6296
|
if (isBrowser && !errorRedirectHandledMap.get(error)) {
|
|
6150
6297
|
if (parsed.isExternal || redirect2.reloadDocument) {
|
|
6151
|
-
window.location.href =
|
|
6298
|
+
window.location.href = target;
|
|
6152
6299
|
} else {
|
|
6153
6300
|
const redirectPromise = Promise.resolve().then(
|
|
6154
6301
|
() => window.__reactRouterDataRouter.navigate(parsed.to, {
|
|
@@ -6159,13 +6306,7 @@ function RSCErrorHandler({
|
|
|
6159
6306
|
throw redirectPromise;
|
|
6160
6307
|
}
|
|
6161
6308
|
}
|
|
6162
|
-
return /* @__PURE__ */ React2.createElement(
|
|
6163
|
-
"meta",
|
|
6164
|
-
{
|
|
6165
|
-
httpEquiv: "refresh",
|
|
6166
|
-
content: `0;url=${parsed.absoluteURL || parsed.to}`
|
|
6167
|
-
}
|
|
6168
|
-
);
|
|
6309
|
+
return /* @__PURE__ */ React2.createElement("meta", { httpEquiv: "refresh", content: `0;url=${target}` });
|
|
6169
6310
|
}
|
|
6170
6311
|
}
|
|
6171
6312
|
return children;
|
|
@@ -6826,6 +6967,7 @@ function RouterProvider({
|
|
|
6826
6967
|
let navigator = React3.useMemo(() => {
|
|
6827
6968
|
return {
|
|
6828
6969
|
createHref: router.createHref,
|
|
6970
|
+
createURL: router.createURL,
|
|
6829
6971
|
encodeLocation: router.encodeLocation,
|
|
6830
6972
|
go: (n) => router.navigate(n),
|
|
6831
6973
|
push: (to, state2, opts) => router.navigate(to, {
|
|
@@ -6958,7 +7100,7 @@ function Navigate({
|
|
|
6958
7100
|
// the router loaded. We can help them understand how to avoid that.
|
|
6959
7101
|
`<Navigate> may be used only in the context of a <Router> component.`
|
|
6960
7102
|
);
|
|
6961
|
-
let { static: isStatic } = React3.useContext(NavigationContext);
|
|
7103
|
+
let { static: isStatic, navigator } = React3.useContext(NavigationContext);
|
|
6962
7104
|
warning(
|
|
6963
7105
|
!isStatic,
|
|
6964
7106
|
`<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`
|
|
@@ -6972,6 +7114,12 @@ function Navigate({
|
|
|
6972
7114
|
locationPathname,
|
|
6973
7115
|
relative === "path"
|
|
6974
7116
|
);
|
|
7117
|
+
validateNavigationTarget(
|
|
7118
|
+
typeof to === "string" ? to : createPath(to),
|
|
7119
|
+
navigator.createHref(path),
|
|
7120
|
+
getNavigatorCurrentUrl(navigator),
|
|
7121
|
+
"reject"
|
|
7122
|
+
);
|
|
6975
7123
|
let jsonPath = JSON.stringify(path);
|
|
6976
7124
|
React3.useEffect(() => {
|
|
6977
7125
|
navigate(JSON.parse(jsonPath), { replace: replace2, state, relative });
|
|
@@ -7417,14 +7565,6 @@ var TYPE_SET = "S";
|
|
|
7417
7565
|
var TYPE_SYMBOL = "Y";
|
|
7418
7566
|
var TYPE_URL = "U";
|
|
7419
7567
|
var TYPE_PREVIOUS_RESOLVED = "Z";
|
|
7420
|
-
var SUPPORTED_ERROR_TYPES = [
|
|
7421
|
-
"EvalError",
|
|
7422
|
-
"RangeError",
|
|
7423
|
-
"ReferenceError",
|
|
7424
|
-
"SyntaxError",
|
|
7425
|
-
"TypeError",
|
|
7426
|
-
"URIError"
|
|
7427
|
-
];
|
|
7428
7568
|
var Deferred2 = class {
|
|
7429
7569
|
constructor() {
|
|
7430
7570
|
this.promise = new Promise((resolve, reject) => {
|
|
@@ -7688,6 +7828,7 @@ function hydrate(index) {
|
|
|
7688
7828
|
set(-0);
|
|
7689
7829
|
continue;
|
|
7690
7830
|
}
|
|
7831
|
+
validateIndex(index2, values.length);
|
|
7691
7832
|
if (hydrated[index2]) {
|
|
7692
7833
|
set(hydrated[index2]);
|
|
7693
7834
|
continue;
|
|
@@ -7776,6 +7917,7 @@ function hydrate(index) {
|
|
|
7776
7917
|
set(obj);
|
|
7777
7918
|
continue;
|
|
7778
7919
|
case TYPE_PROMISE:
|
|
7920
|
+
validateIndex(b, values.length);
|
|
7779
7921
|
if (hydrated[b]) {
|
|
7780
7922
|
set(hydrated[index2] = hydrated[b]);
|
|
7781
7923
|
} else {
|
|
@@ -7791,6 +7933,7 @@ function hydrate(index) {
|
|
|
7791
7933
|
set(error);
|
|
7792
7934
|
continue;
|
|
7793
7935
|
case TYPE_PREVIOUS_RESOLVED:
|
|
7936
|
+
validateIndex(b, values.length);
|
|
7794
7937
|
set(hydrated[index2] = hydrated[b]);
|
|
7795
7938
|
continue;
|
|
7796
7939
|
default:
|
|
@@ -7855,7 +7998,12 @@ function hydrate(index) {
|
|
|
7855
7998
|
}
|
|
7856
7999
|
]);
|
|
7857
8000
|
postRun.push(() => {
|
|
7858
|
-
object
|
|
8001
|
+
Object.defineProperty(object, r[0], {
|
|
8002
|
+
value: r[1],
|
|
8003
|
+
enumerable: true,
|
|
8004
|
+
configurable: true,
|
|
8005
|
+
writable: true
|
|
8006
|
+
});
|
|
7859
8007
|
});
|
|
7860
8008
|
}
|
|
7861
8009
|
set(object);
|
|
@@ -7867,6 +8015,11 @@ function hydrate(index) {
|
|
|
7867
8015
|
}
|
|
7868
8016
|
return result;
|
|
7869
8017
|
}
|
|
8018
|
+
function validateIndex(index, length) {
|
|
8019
|
+
if (!Number.isSafeInteger(index) || index < 0 || index >= length) {
|
|
8020
|
+
throw new SyntaxError();
|
|
8021
|
+
}
|
|
8022
|
+
}
|
|
7870
8023
|
|
|
7871
8024
|
// vendor/turbo-stream-v2/turbo-stream.ts
|
|
7872
8025
|
async function decode(readable, options) {
|
|
@@ -8135,6 +8288,9 @@ var ESCAPE_REGEX = /[&><\u2028\u2029]/g;
|
|
|
8135
8288
|
function escapeHtml(html) {
|
|
8136
8289
|
return html.replace(ESCAPE_REGEX, (match) => ESCAPE_LOOKUP[match]);
|
|
8137
8290
|
}
|
|
8291
|
+
function escapeAttribute(value) {
|
|
8292
|
+
return value.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">");
|
|
8293
|
+
}
|
|
8138
8294
|
|
|
8139
8295
|
// lib/dom/ssr/invariant.ts
|
|
8140
8296
|
function invariant2(value, message) {
|
|
@@ -8901,9 +9057,11 @@ import * as React6 from "react";
|
|
|
8901
9057
|
// lib/dom/ssr/fallback.tsx
|
|
8902
9058
|
import * as React5 from "react";
|
|
8903
9059
|
function RemixRootDefaultHydrateFallback() {
|
|
9060
|
+
let { nonce } = useFrameworkContext();
|
|
8904
9061
|
return /* @__PURE__ */ React5.createElement(BoundaryShell, { title: "Loading...", renderScripts: true }, ENABLE_DEV_WARNINGS ? /* @__PURE__ */ React5.createElement(
|
|
8905
9062
|
"script",
|
|
8906
9063
|
{
|
|
9064
|
+
nonce,
|
|
8907
9065
|
dangerouslySetInnerHTML: {
|
|
8908
9066
|
__html: `
|
|
8909
9067
|
console.log(
|
|
@@ -9323,9 +9481,31 @@ var nextPaths = /* @__PURE__ */ new Set();
|
|
|
9323
9481
|
var discoveredPathsMaxSize = 1e3;
|
|
9324
9482
|
var discoveredPaths = /* @__PURE__ */ new Set();
|
|
9325
9483
|
var URL_LIMIT = 7680;
|
|
9484
|
+
function getPathsWithAncestors(paths) {
|
|
9485
|
+
let result = /* @__PURE__ */ new Set();
|
|
9486
|
+
paths.forEach((path) => {
|
|
9487
|
+
if (!path.startsWith("/")) {
|
|
9488
|
+
path = `/${path}`;
|
|
9489
|
+
}
|
|
9490
|
+
for (let i = 1; i < path.length; i++) {
|
|
9491
|
+
if (path[i] === "/") {
|
|
9492
|
+
result.add(path.slice(0, i));
|
|
9493
|
+
}
|
|
9494
|
+
}
|
|
9495
|
+
result.add(path);
|
|
9496
|
+
});
|
|
9497
|
+
return Array.from(result);
|
|
9498
|
+
}
|
|
9326
9499
|
function isFogOfWarEnabled(routeDiscovery, ssr) {
|
|
9327
9500
|
return routeDiscovery.mode === "lazy" && ssr === true;
|
|
9328
9501
|
}
|
|
9502
|
+
var MANIFEST_MATCH_COST_LIMIT = 5e4;
|
|
9503
|
+
var MANIFEST_MATCH_COST_SEGMENT_THRESHOLD = 10;
|
|
9504
|
+
function shouldUseInitialRouteDiscovery(pathname, matchCost = 0) {
|
|
9505
|
+
let segmentCount = pathname.split("/").length - 1;
|
|
9506
|
+
let ancestorCount = Math.max(segmentCount - 1, 0);
|
|
9507
|
+
return ancestorCount * pathname.length + 1 > URL_LIMIT || segmentCount > MANIFEST_MATCH_COST_SEGMENT_THRESHOLD && segmentCount * matchCost > MANIFEST_MATCH_COST_LIMIT;
|
|
9508
|
+
}
|
|
9329
9509
|
function getPartialManifest({ sri, ...manifest }, router) {
|
|
9330
9510
|
let routeIds = new Set(router.state.matches.map((m) => m.route.id));
|
|
9331
9511
|
let segments = router.state.location.pathname.split("/").filter(Boolean);
|
|
@@ -9444,6 +9624,7 @@ function getManifestPath(_manifestPath, basename) {
|
|
|
9444
9624
|
}
|
|
9445
9625
|
var MANIFEST_VERSION_STORAGE_KEY = "react-router-manifest-version";
|
|
9446
9626
|
async function fetchAndApplyManifestPatches(paths, errorReloadPath, manifest, routeModules, ssr, isSpaMode, basename, manifestPath, patchRoutes, signal) {
|
|
9627
|
+
paths = getPathsWithAncestors(paths);
|
|
9447
9628
|
const searchParams = new URLSearchParams();
|
|
9448
9629
|
searchParams.set("paths", paths.sort().join(","));
|
|
9449
9630
|
searchParams.set("version", manifest.version);
|
|
@@ -9636,13 +9817,22 @@ function getActiveMatches(matches, errors, isSpaMode) {
|
|
|
9636
9817
|
}
|
|
9637
9818
|
var CRITICAL_CSS_DATA_ATTRIBUTE = "data-react-router-critical-css";
|
|
9638
9819
|
function Links({ nonce, crossOrigin }) {
|
|
9639
|
-
let {
|
|
9820
|
+
let {
|
|
9821
|
+
isSpaMode,
|
|
9822
|
+
manifest,
|
|
9823
|
+
routeModules,
|
|
9824
|
+
criticalCss,
|
|
9825
|
+
nonce: contextNonce
|
|
9826
|
+
} = useFrameworkContext();
|
|
9640
9827
|
let { errors, matches: routerMatches } = useDataRouterStateContext();
|
|
9641
9828
|
let matches = getActiveMatches(routerMatches, errors, isSpaMode);
|
|
9642
9829
|
let keyedLinks = React8.useMemo(
|
|
9643
9830
|
() => getKeyedLinksForMatches(matches, routeModules, manifest),
|
|
9644
9831
|
[matches, routeModules, manifest]
|
|
9645
9832
|
);
|
|
9833
|
+
if (nonce == null && contextNonce) {
|
|
9834
|
+
nonce = contextNonce;
|
|
9835
|
+
}
|
|
9646
9836
|
return /* @__PURE__ */ React8.createElement(React8.Fragment, null, typeof criticalCss === "string" ? /* @__PURE__ */ React8.createElement(
|
|
9647
9837
|
"style",
|
|
9648
9838
|
{
|
|
@@ -9681,6 +9871,7 @@ function Links({ nonce, crossOrigin }) {
|
|
|
9681
9871
|
}
|
|
9682
9872
|
function PrefetchPageLinks({ page, ...linkProps }) {
|
|
9683
9873
|
let rsc = useIsRSCRouterContext();
|
|
9874
|
+
let { nonce: contextNonce } = useFrameworkContext();
|
|
9684
9875
|
let { router } = useDataRouterContext2();
|
|
9685
9876
|
let matches = React8.useMemo(
|
|
9686
9877
|
() => matchRoutes(router.routes, page, router.basename),
|
|
@@ -9689,6 +9880,9 @@ function PrefetchPageLinks({ page, ...linkProps }) {
|
|
|
9689
9880
|
if (!matches) {
|
|
9690
9881
|
return null;
|
|
9691
9882
|
}
|
|
9883
|
+
if (linkProps.nonce == null && contextNonce) {
|
|
9884
|
+
linkProps = { ...linkProps, nonce: contextNonce };
|
|
9885
|
+
}
|
|
9692
9886
|
if (rsc) {
|
|
9693
9887
|
return /* @__PURE__ */ React8.createElement(RSCPrefetchPageLinksImpl, { page, matches, ...linkProps });
|
|
9694
9888
|
}
|
|
@@ -9727,7 +9921,7 @@ function RSCPrefetchPageLinksImpl({
|
|
|
9727
9921
|
let url = singleFetchUrl(
|
|
9728
9922
|
page,
|
|
9729
9923
|
basename,
|
|
9730
|
-
future.
|
|
9924
|
+
future.v8_trailingSlashAwareDataRequests,
|
|
9731
9925
|
"rsc"
|
|
9732
9926
|
);
|
|
9733
9927
|
let hasSomeRoutesWithShouldRevalidate = false;
|
|
@@ -9745,7 +9939,7 @@ function RSCPrefetchPageLinksImpl({
|
|
|
9745
9939
|
return [url.pathname + url.search];
|
|
9746
9940
|
}, [
|
|
9747
9941
|
basename,
|
|
9748
|
-
future.
|
|
9942
|
+
future.v8_trailingSlashAwareDataRequests,
|
|
9749
9943
|
page,
|
|
9750
9944
|
location,
|
|
9751
9945
|
nextMatches
|
|
@@ -9808,7 +10002,7 @@ function PrefetchPageLinksImpl({
|
|
|
9808
10002
|
let url = singleFetchUrl(
|
|
9809
10003
|
page,
|
|
9810
10004
|
basename,
|
|
9811
|
-
future.
|
|
10005
|
+
future.v8_trailingSlashAwareDataRequests,
|
|
9812
10006
|
"data"
|
|
9813
10007
|
);
|
|
9814
10008
|
if (foundOptOutRoute && routesParams.size > 0) {
|
|
@@ -9820,7 +10014,7 @@ function PrefetchPageLinksImpl({
|
|
|
9820
10014
|
return [url.pathname + url.search];
|
|
9821
10015
|
}, [
|
|
9822
10016
|
basename,
|
|
9823
|
-
future.
|
|
10017
|
+
future.v8_trailingSlashAwareDataRequests,
|
|
9824
10018
|
loaderData,
|
|
9825
10019
|
location,
|
|
9826
10020
|
manifest,
|
|
@@ -9962,12 +10156,16 @@ function Scripts(scriptProps) {
|
|
|
9962
10156
|
isSpaMode,
|
|
9963
10157
|
renderMeta,
|
|
9964
10158
|
routeDiscovery,
|
|
9965
|
-
ssr
|
|
10159
|
+
ssr,
|
|
10160
|
+
nonce: contextNonce
|
|
9966
10161
|
} = useFrameworkContext();
|
|
9967
10162
|
let { router, static: isStatic, staticContext } = useDataRouterContext2();
|
|
9968
10163
|
let { matches: routerMatches } = useDataRouterStateContext();
|
|
9969
10164
|
let isRSCRouterContext = useIsRSCRouterContext();
|
|
9970
10165
|
let enableFogOfWar = isFogOfWarEnabled(routeDiscovery, ssr);
|
|
10166
|
+
if (scriptProps.nonce == null && contextNonce) {
|
|
10167
|
+
scriptProps = { ...scriptProps, nonce: contextNonce };
|
|
10168
|
+
}
|
|
9971
10169
|
if (renderMeta) {
|
|
9972
10170
|
renderMeta.didRenderScripts = true;
|
|
9973
10171
|
}
|
|
@@ -10163,10 +10361,12 @@ function RemixRootDefaultErrorBoundary({
|
|
|
10163
10361
|
error,
|
|
10164
10362
|
isOutsideRemixApp
|
|
10165
10363
|
}) {
|
|
10364
|
+
let { nonce } = useFrameworkContext();
|
|
10166
10365
|
console.error(error);
|
|
10167
10366
|
let heyDeveloper = /* @__PURE__ */ React9.createElement(
|
|
10168
10367
|
"script",
|
|
10169
10368
|
{
|
|
10369
|
+
nonce,
|
|
10170
10370
|
dangerouslySetInnerHTML: {
|
|
10171
10371
|
__html: `
|
|
10172
10372
|
console.log(
|
|
@@ -10233,7 +10433,7 @@ var isBrowser2 = typeof window !== "undefined" && typeof window.document !== "un
|
|
|
10233
10433
|
try {
|
|
10234
10434
|
if (isBrowser2) {
|
|
10235
10435
|
window.__reactRouterVersion = // @ts-expect-error
|
|
10236
|
-
"7.
|
|
10436
|
+
"7.18.5";
|
|
10237
10437
|
}
|
|
10238
10438
|
} catch (e) {
|
|
10239
10439
|
}
|
|
@@ -10292,7 +10492,7 @@ function deserializeErrors(errors) {
|
|
|
10292
10492
|
val.internal === true
|
|
10293
10493
|
);
|
|
10294
10494
|
} else if (val && val.__type === "Error") {
|
|
10295
|
-
if (val.__subType) {
|
|
10495
|
+
if (typeof val.__subType === "string" && SUPPORTED_ERROR_TYPES.includes(val.__subType)) {
|
|
10296
10496
|
let ErrorConstructor = window[val.__subType];
|
|
10297
10497
|
if (typeof ErrorConstructor === "function") {
|
|
10298
10498
|
try {
|
|
@@ -10424,7 +10624,6 @@ function HistoryRouter({
|
|
|
10424
10624
|
);
|
|
10425
10625
|
}
|
|
10426
10626
|
HistoryRouter.displayName = "unstable_HistoryRouter";
|
|
10427
|
-
var ABSOLUTE_URL_REGEX2 = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
|
|
10428
10627
|
var Link = React10.forwardRef(
|
|
10429
10628
|
function LinkWithRef({
|
|
10430
10629
|
onClick,
|
|
@@ -10443,7 +10642,7 @@ var Link = React10.forwardRef(
|
|
|
10443
10642
|
...rest
|
|
10444
10643
|
}, forwardedRef) {
|
|
10445
10644
|
let { basename, navigator, useTransitions } = React10.useContext(NavigationContext);
|
|
10446
|
-
let isAbsolute = typeof to === "string" &&
|
|
10645
|
+
let isAbsolute = typeof to === "string" && ABSOLUTE_URL_REGEX.test(to);
|
|
10447
10646
|
let parsed = parseToInfo(to, basename);
|
|
10448
10647
|
to = parsed.to;
|
|
10449
10648
|
let href = useHref(to, { relative });
|
|
@@ -10590,7 +10789,7 @@ var Form = React10.forwardRef(
|
|
|
10590
10789
|
let submit = useSubmit();
|
|
10591
10790
|
let formAction = useFormAction(action, { relative });
|
|
10592
10791
|
let formMethod = method.toLowerCase() === "get" ? "get" : "post";
|
|
10593
|
-
let isAbsolute = typeof action === "string" &&
|
|
10792
|
+
let isAbsolute = typeof action === "string" && ABSOLUTE_URL_REGEX.test(action);
|
|
10594
10793
|
let submitHandler = (event) => {
|
|
10595
10794
|
onSubmit && onSubmit(event);
|
|
10596
10795
|
if (event.defaultPrevented) return;
|
|
@@ -10672,6 +10871,9 @@ function ScrollRestoration({
|
|
|
10672
10871
|
sessionStorage.removeItem(storageKey2);
|
|
10673
10872
|
}
|
|
10674
10873
|
}).toString();
|
|
10874
|
+
if (props.nonce == null && remixContext?.nonce) {
|
|
10875
|
+
props.nonce = remixContext.nonce;
|
|
10876
|
+
}
|
|
10675
10877
|
return /* @__PURE__ */ React10.createElement(
|
|
10676
10878
|
"script",
|
|
10677
10879
|
{
|
|
@@ -11282,6 +11484,7 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
11282
11484
|
return {
|
|
11283
11485
|
v8_middleware: false,
|
|
11284
11486
|
v8_passThroughRequests: false,
|
|
11487
|
+
v8_trailingSlashAwareDataRequests: false,
|
|
11285
11488
|
...opts?.future
|
|
11286
11489
|
};
|
|
11287
11490
|
},
|
|
@@ -11371,16 +11574,16 @@ function createHref(to) {
|
|
|
11371
11574
|
function encodeLocation(to) {
|
|
11372
11575
|
let href = typeof to === "string" ? to : createPath(to);
|
|
11373
11576
|
href = href.replace(/ $/, "%20");
|
|
11374
|
-
let encoded =
|
|
11577
|
+
let encoded = ABSOLUTE_URL_REGEX.test(href) ? new URL(href) : new URL(href, "http://localhost");
|
|
11375
11578
|
return {
|
|
11376
11579
|
pathname: encoded.pathname,
|
|
11377
11580
|
search: encoded.search,
|
|
11378
11581
|
hash: encoded.hash
|
|
11379
11582
|
};
|
|
11380
11583
|
}
|
|
11381
|
-
var ABSOLUTE_URL_REGEX3 = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
|
|
11382
11584
|
|
|
11383
11585
|
export {
|
|
11586
|
+
PROTOCOL_RELATIVE_URL_REGEX,
|
|
11384
11587
|
Action,
|
|
11385
11588
|
createMemoryHistory,
|
|
11386
11589
|
createBrowserHistory,
|
|
@@ -11404,13 +11607,14 @@ export {
|
|
|
11404
11607
|
ErrorResponseImpl,
|
|
11405
11608
|
isRouteErrorResponse,
|
|
11406
11609
|
instrumentHandler,
|
|
11610
|
+
validateNavigationTarget,
|
|
11407
11611
|
IDLE_NAVIGATION,
|
|
11408
11612
|
IDLE_FETCHER,
|
|
11409
11613
|
IDLE_BLOCKER,
|
|
11410
11614
|
createRouter,
|
|
11411
11615
|
createStaticHandler,
|
|
11412
11616
|
getStaticContextFromError,
|
|
11413
|
-
|
|
11617
|
+
hasInvalidProtocol,
|
|
11414
11618
|
isDataWithResponseInit,
|
|
11415
11619
|
isResponse,
|
|
11416
11620
|
isRedirectStatusCode,
|
|
@@ -11474,6 +11678,7 @@ export {
|
|
|
11474
11678
|
withErrorBoundaryProps,
|
|
11475
11679
|
createSearchParams,
|
|
11476
11680
|
escapeHtml,
|
|
11681
|
+
escapeAttribute,
|
|
11477
11682
|
encode,
|
|
11478
11683
|
createRequestInit,
|
|
11479
11684
|
SingleFetchRedirectSymbol,
|
|
@@ -11492,6 +11697,9 @@ export {
|
|
|
11492
11697
|
createClientRoutes,
|
|
11493
11698
|
shouldHydrateRouteLoader,
|
|
11494
11699
|
URL_LIMIT,
|
|
11700
|
+
getPathsWithAncestors,
|
|
11701
|
+
isFogOfWarEnabled,
|
|
11702
|
+
shouldUseInitialRouteDiscovery,
|
|
11495
11703
|
getPatchRoutesOnNavigationFunction,
|
|
11496
11704
|
useFogOFWarDiscovery,
|
|
11497
11705
|
getManifestPath,
|