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
|
*
|
|
@@ -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, createHref, 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, createHref, 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 (e2) {
|
|
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 (e3) {
|
|
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: _nullishCoalesce(partialPath.pathname, () => ( "")),
|
|
1910
|
+
search: _nullishCoalesce(partialPath.search, () => ( "")),
|
|
1911
|
+
hash: _nullishCoalesce(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 (e4) {
|
|
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) {
|
|
@@ -5757,14 +5888,6 @@ var TYPE_SET = "S";
|
|
|
5757
5888
|
var TYPE_SYMBOL = "Y";
|
|
5758
5889
|
var TYPE_URL = "U";
|
|
5759
5890
|
var TYPE_PREVIOUS_RESOLVED = "Z";
|
|
5760
|
-
var SUPPORTED_ERROR_TYPES = [
|
|
5761
|
-
"EvalError",
|
|
5762
|
-
"RangeError",
|
|
5763
|
-
"ReferenceError",
|
|
5764
|
-
"SyntaxError",
|
|
5765
|
-
"TypeError",
|
|
5766
|
-
"URIError"
|
|
5767
|
-
];
|
|
5768
5891
|
var Deferred = class {
|
|
5769
5892
|
constructor() {
|
|
5770
5893
|
this.promise = new Promise((resolve, reject) => {
|
|
@@ -6028,6 +6151,7 @@ function hydrate(index) {
|
|
|
6028
6151
|
set(-0);
|
|
6029
6152
|
continue;
|
|
6030
6153
|
}
|
|
6154
|
+
validateIndex(index2, values.length);
|
|
6031
6155
|
if (hydrated[index2]) {
|
|
6032
6156
|
set(hydrated[index2]);
|
|
6033
6157
|
continue;
|
|
@@ -6116,6 +6240,7 @@ function hydrate(index) {
|
|
|
6116
6240
|
set(obj);
|
|
6117
6241
|
continue;
|
|
6118
6242
|
case TYPE_PROMISE:
|
|
6243
|
+
validateIndex(b, values.length);
|
|
6119
6244
|
if (hydrated[b]) {
|
|
6120
6245
|
set(hydrated[index2] = hydrated[b]);
|
|
6121
6246
|
} else {
|
|
@@ -6131,6 +6256,7 @@ function hydrate(index) {
|
|
|
6131
6256
|
set(error);
|
|
6132
6257
|
continue;
|
|
6133
6258
|
case TYPE_PREVIOUS_RESOLVED:
|
|
6259
|
+
validateIndex(b, values.length);
|
|
6134
6260
|
set(hydrated[index2] = hydrated[b]);
|
|
6135
6261
|
continue;
|
|
6136
6262
|
default:
|
|
@@ -6195,7 +6321,12 @@ function hydrate(index) {
|
|
|
6195
6321
|
}
|
|
6196
6322
|
]);
|
|
6197
6323
|
postRun.push(() => {
|
|
6198
|
-
object
|
|
6324
|
+
Object.defineProperty(object, r[0], {
|
|
6325
|
+
value: r[1],
|
|
6326
|
+
enumerable: true,
|
|
6327
|
+
configurable: true,
|
|
6328
|
+
writable: true
|
|
6329
|
+
});
|
|
6199
6330
|
});
|
|
6200
6331
|
}
|
|
6201
6332
|
set(object);
|
|
@@ -6207,6 +6338,11 @@ function hydrate(index) {
|
|
|
6207
6338
|
}
|
|
6208
6339
|
return result;
|
|
6209
6340
|
}
|
|
6341
|
+
function validateIndex(index, length) {
|
|
6342
|
+
if (!Number.isSafeInteger(index) || index < 0 || index >= length) {
|
|
6343
|
+
throw new SyntaxError();
|
|
6344
|
+
}
|
|
6345
|
+
}
|
|
6210
6346
|
|
|
6211
6347
|
// vendor/turbo-stream-v2/turbo-stream.ts
|
|
6212
6348
|
async function decode(readable, options) {
|
|
@@ -6475,6 +6611,9 @@ var ESCAPE_REGEX = /[&><\u2028\u2029]/g;
|
|
|
6475
6611
|
function escapeHtml(html) {
|
|
6476
6612
|
return html.replace(ESCAPE_REGEX, (match) => ESCAPE_LOOKUP[match]);
|
|
6477
6613
|
}
|
|
6614
|
+
function escapeAttribute(value) {
|
|
6615
|
+
return value.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">");
|
|
6616
|
+
}
|
|
6478
6617
|
|
|
6479
6618
|
// lib/dom/ssr/invariant.ts
|
|
6480
6619
|
function invariant2(value, message) {
|
|
@@ -7046,7 +7185,7 @@ function decodeRedirectErrorDigest(digest) {
|
|
|
7046
7185
|
if (typeof parsed === "object" && parsed && typeof parsed.status === "number" && typeof parsed.statusText === "string" && typeof parsed.location === "string" && typeof parsed.reloadDocument === "boolean" && typeof parsed.replace === "boolean") {
|
|
7047
7186
|
return parsed;
|
|
7048
7187
|
}
|
|
7049
|
-
} catch (
|
|
7188
|
+
} catch (e5) {
|
|
7050
7189
|
}
|
|
7051
7190
|
}
|
|
7052
7191
|
}
|
|
@@ -7063,7 +7202,7 @@ function decodeRouteErrorResponseDigest(digest) {
|
|
|
7063
7202
|
parsed.data
|
|
7064
7203
|
);
|
|
7065
7204
|
}
|
|
7066
|
-
} catch (
|
|
7205
|
+
} catch (e6) {
|
|
7067
7206
|
}
|
|
7068
7207
|
}
|
|
7069
7208
|
}
|
|
@@ -7156,6 +7295,12 @@ function useNavigateUnstable() {
|
|
|
7156
7295
|
if (dataRouterContext == null && basename !== "/") {
|
|
7157
7296
|
path.pathname = path.pathname === "/" ? basename : joinPaths([basename, path.pathname]);
|
|
7158
7297
|
}
|
|
7298
|
+
validateNavigationTarget(
|
|
7299
|
+
typeof to === "string" ? to : createPath(to),
|
|
7300
|
+
navigator.createHref(path),
|
|
7301
|
+
getNavigatorCurrentUrl(navigator),
|
|
7302
|
+
"reject"
|
|
7303
|
+
);
|
|
7159
7304
|
(!!options.replace ? navigator.replace : navigator.push)(
|
|
7160
7305
|
path,
|
|
7161
7306
|
options.state,
|
|
@@ -7397,16 +7542,26 @@ function RSCErrorHandler({
|
|
|
7397
7542
|
children,
|
|
7398
7543
|
error
|
|
7399
7544
|
}) {
|
|
7400
|
-
let { basename } = React3.useContext(NavigationContext);
|
|
7545
|
+
let { basename, navigator } = React3.useContext(NavigationContext);
|
|
7401
7546
|
if (typeof error === "object" && error && "digest" in error && typeof error.digest === "string") {
|
|
7402
7547
|
let redirect2 = decodeRedirectErrorDigest(error.digest);
|
|
7403
7548
|
if (redirect2) {
|
|
7404
7549
|
let existingRedirect = errorRedirectHandledMap.get(error);
|
|
7405
7550
|
if (existingRedirect) throw existingRedirect;
|
|
7406
7551
|
let parsed = parseToInfo(redirect2.location, basename);
|
|
7552
|
+
let target = parsed.absoluteURL || parsed.to;
|
|
7553
|
+
validateNavigationTarget(
|
|
7554
|
+
redirect2.location,
|
|
7555
|
+
target,
|
|
7556
|
+
getNavigatorCurrentUrl(navigator),
|
|
7557
|
+
"allow-explicit"
|
|
7558
|
+
);
|
|
7559
|
+
if (hasInvalidProtocol(target)) {
|
|
7560
|
+
throw new Error("Invalid redirect location");
|
|
7561
|
+
}
|
|
7407
7562
|
if (isBrowser && !errorRedirectHandledMap.get(error)) {
|
|
7408
7563
|
if (parsed.isExternal || redirect2.reloadDocument) {
|
|
7409
|
-
window.location.href =
|
|
7564
|
+
window.location.href = target;
|
|
7410
7565
|
} else {
|
|
7411
7566
|
const redirectPromise = Promise.resolve().then(
|
|
7412
7567
|
() => window.__reactRouterDataRouter.navigate(parsed.to, {
|
|
@@ -7417,13 +7572,7 @@ function RSCErrorHandler({
|
|
|
7417
7572
|
throw redirectPromise;
|
|
7418
7573
|
}
|
|
7419
7574
|
}
|
|
7420
|
-
return /* @__PURE__ */ React3.createElement(
|
|
7421
|
-
"meta",
|
|
7422
|
-
{
|
|
7423
|
-
httpEquiv: "refresh",
|
|
7424
|
-
content: `0;url=${parsed.absoluteURL || parsed.to}`
|
|
7425
|
-
}
|
|
7426
|
-
);
|
|
7575
|
+
return /* @__PURE__ */ React3.createElement("meta", { httpEquiv: "refresh", content: `0;url=${target}` });
|
|
7427
7576
|
}
|
|
7428
7577
|
}
|
|
7429
7578
|
return children;
|
|
@@ -8055,9 +8204,11 @@ function warnOnce(condition, message) {
|
|
|
8055
8204
|
// lib/dom/ssr/fallback.tsx
|
|
8056
8205
|
|
|
8057
8206
|
function RemixRootDefaultHydrateFallback() {
|
|
8207
|
+
let { nonce } = useFrameworkContext();
|
|
8058
8208
|
return /* @__PURE__ */ React4.createElement(BoundaryShell, { title: "Loading...", renderScripts: true }, ENABLE_DEV_WARNINGS ? /* @__PURE__ */ React4.createElement(
|
|
8059
8209
|
"script",
|
|
8060
8210
|
{
|
|
8211
|
+
nonce,
|
|
8061
8212
|
dangerouslySetInnerHTML: {
|
|
8062
8213
|
__html: `
|
|
8063
8214
|
console.log(
|
|
@@ -8477,9 +8628,31 @@ var nextPaths = /* @__PURE__ */ new Set();
|
|
|
8477
8628
|
var discoveredPathsMaxSize = 1e3;
|
|
8478
8629
|
var discoveredPaths = /* @__PURE__ */ new Set();
|
|
8479
8630
|
var URL_LIMIT = 7680;
|
|
8631
|
+
function getPathsWithAncestors(paths) {
|
|
8632
|
+
let result = /* @__PURE__ */ new Set();
|
|
8633
|
+
paths.forEach((path) => {
|
|
8634
|
+
if (!path.startsWith("/")) {
|
|
8635
|
+
path = `/${path}`;
|
|
8636
|
+
}
|
|
8637
|
+
for (let i = 1; i < path.length; i++) {
|
|
8638
|
+
if (path[i] === "/") {
|
|
8639
|
+
result.add(path.slice(0, i));
|
|
8640
|
+
}
|
|
8641
|
+
}
|
|
8642
|
+
result.add(path);
|
|
8643
|
+
});
|
|
8644
|
+
return Array.from(result);
|
|
8645
|
+
}
|
|
8480
8646
|
function isFogOfWarEnabled(routeDiscovery, ssr) {
|
|
8481
8647
|
return routeDiscovery.mode === "lazy" && ssr === true;
|
|
8482
8648
|
}
|
|
8649
|
+
var MANIFEST_MATCH_COST_LIMIT = 5e4;
|
|
8650
|
+
var MANIFEST_MATCH_COST_SEGMENT_THRESHOLD = 10;
|
|
8651
|
+
function shouldUseInitialRouteDiscovery(pathname, matchCost = 0) {
|
|
8652
|
+
let segmentCount = pathname.split("/").length - 1;
|
|
8653
|
+
let ancestorCount = Math.max(segmentCount - 1, 0);
|
|
8654
|
+
return ancestorCount * pathname.length + 1 > URL_LIMIT || segmentCount > MANIFEST_MATCH_COST_SEGMENT_THRESHOLD && segmentCount * matchCost > MANIFEST_MATCH_COST_LIMIT;
|
|
8655
|
+
}
|
|
8483
8656
|
function getPartialManifest({ sri, ...manifest }, router) {
|
|
8484
8657
|
let routeIds = new Set(router.state.matches.map((m) => m.route.id));
|
|
8485
8658
|
let segments = router.state.location.pathname.split("/").filter(Boolean);
|
|
@@ -8598,6 +8771,7 @@ function getManifestPath(_manifestPath, basename) {
|
|
|
8598
8771
|
}
|
|
8599
8772
|
var MANIFEST_VERSION_STORAGE_KEY = "react-router-manifest-version";
|
|
8600
8773
|
async function fetchAndApplyManifestPatches(paths, errorReloadPath, manifest, routeModules, ssr, isSpaMode, basename, manifestPath, patchRoutes, signal) {
|
|
8774
|
+
paths = getPathsWithAncestors(paths);
|
|
8601
8775
|
const searchParams = new URLSearchParams();
|
|
8602
8776
|
searchParams.set("paths", paths.sort().join(","));
|
|
8603
8777
|
searchParams.set("version", manifest.version);
|
|
@@ -8630,7 +8804,7 @@ async function fetchAndApplyManifestPatches(paths, errorReloadPath, manifest, ro
|
|
|
8630
8804
|
return;
|
|
8631
8805
|
}
|
|
8632
8806
|
sessionStorage.setItem(MANIFEST_VERSION_STORAGE_KEY, manifest.version);
|
|
8633
|
-
} catch (
|
|
8807
|
+
} catch (e7) {
|
|
8634
8808
|
}
|
|
8635
8809
|
window.location.href = errorReloadPath;
|
|
8636
8810
|
console.warn("Detected manifest version mismatch, reloading...");
|
|
@@ -8641,7 +8815,7 @@ async function fetchAndApplyManifestPatches(paths, errorReloadPath, manifest, ro
|
|
|
8641
8815
|
}
|
|
8642
8816
|
try {
|
|
8643
8817
|
sessionStorage.removeItem(MANIFEST_VERSION_STORAGE_KEY);
|
|
8644
|
-
} catch (
|
|
8818
|
+
} catch (e8) {
|
|
8645
8819
|
}
|
|
8646
8820
|
serverPatches = await res.json();
|
|
8647
8821
|
} catch (e) {
|
|
@@ -8790,13 +8964,22 @@ function getActiveMatches(matches, errors, isSpaMode) {
|
|
|
8790
8964
|
}
|
|
8791
8965
|
var CRITICAL_CSS_DATA_ATTRIBUTE = "data-react-router-critical-css";
|
|
8792
8966
|
function Links({ nonce, crossOrigin }) {
|
|
8793
|
-
let {
|
|
8967
|
+
let {
|
|
8968
|
+
isSpaMode,
|
|
8969
|
+
manifest,
|
|
8970
|
+
routeModules,
|
|
8971
|
+
criticalCss,
|
|
8972
|
+
nonce: contextNonce
|
|
8973
|
+
} = useFrameworkContext();
|
|
8794
8974
|
let { errors, matches: routerMatches } = useDataRouterStateContext();
|
|
8795
8975
|
let matches = getActiveMatches(routerMatches, errors, isSpaMode);
|
|
8796
8976
|
let keyedLinks = React7.useMemo(
|
|
8797
8977
|
() => getKeyedLinksForMatches(matches, routeModules, manifest),
|
|
8798
8978
|
[matches, routeModules, manifest]
|
|
8799
8979
|
);
|
|
8980
|
+
if (nonce == null && contextNonce) {
|
|
8981
|
+
nonce = contextNonce;
|
|
8982
|
+
}
|
|
8800
8983
|
return /* @__PURE__ */ React7.createElement(React7.Fragment, null, typeof criticalCss === "string" ? /* @__PURE__ */ React7.createElement(
|
|
8801
8984
|
"style",
|
|
8802
8985
|
{
|
|
@@ -8835,6 +9018,7 @@ function Links({ nonce, crossOrigin }) {
|
|
|
8835
9018
|
}
|
|
8836
9019
|
function PrefetchPageLinks({ page, ...linkProps }) {
|
|
8837
9020
|
let rsc = useIsRSCRouterContext();
|
|
9021
|
+
let { nonce: contextNonce } = useFrameworkContext();
|
|
8838
9022
|
let { router } = useDataRouterContext2();
|
|
8839
9023
|
let matches = React7.useMemo(
|
|
8840
9024
|
() => matchRoutes(router.routes, page, router.basename),
|
|
@@ -8843,6 +9027,9 @@ function PrefetchPageLinks({ page, ...linkProps }) {
|
|
|
8843
9027
|
if (!matches) {
|
|
8844
9028
|
return null;
|
|
8845
9029
|
}
|
|
9030
|
+
if (linkProps.nonce == null && contextNonce) {
|
|
9031
|
+
linkProps = { ...linkProps, nonce: contextNonce };
|
|
9032
|
+
}
|
|
8846
9033
|
if (rsc) {
|
|
8847
9034
|
return /* @__PURE__ */ React7.createElement(RSCPrefetchPageLinksImpl, { page, matches, ...linkProps });
|
|
8848
9035
|
}
|
|
@@ -8881,7 +9068,7 @@ function RSCPrefetchPageLinksImpl({
|
|
|
8881
9068
|
let url = singleFetchUrl(
|
|
8882
9069
|
page,
|
|
8883
9070
|
basename,
|
|
8884
|
-
future.
|
|
9071
|
+
future.v8_trailingSlashAwareDataRequests,
|
|
8885
9072
|
"rsc"
|
|
8886
9073
|
);
|
|
8887
9074
|
let hasSomeRoutesWithShouldRevalidate = false;
|
|
@@ -8899,7 +9086,7 @@ function RSCPrefetchPageLinksImpl({
|
|
|
8899
9086
|
return [url.pathname + url.search];
|
|
8900
9087
|
}, [
|
|
8901
9088
|
basename,
|
|
8902
|
-
future.
|
|
9089
|
+
future.v8_trailingSlashAwareDataRequests,
|
|
8903
9090
|
page,
|
|
8904
9091
|
location,
|
|
8905
9092
|
nextMatches
|
|
@@ -8962,7 +9149,7 @@ function PrefetchPageLinksImpl({
|
|
|
8962
9149
|
let url = singleFetchUrl(
|
|
8963
9150
|
page,
|
|
8964
9151
|
basename,
|
|
8965
|
-
future.
|
|
9152
|
+
future.v8_trailingSlashAwareDataRequests,
|
|
8966
9153
|
"data"
|
|
8967
9154
|
);
|
|
8968
9155
|
if (foundOptOutRoute && routesParams.size > 0) {
|
|
@@ -8974,7 +9161,7 @@ function PrefetchPageLinksImpl({
|
|
|
8974
9161
|
return [url.pathname + url.search];
|
|
8975
9162
|
}, [
|
|
8976
9163
|
basename,
|
|
8977
|
-
future.
|
|
9164
|
+
future.v8_trailingSlashAwareDataRequests,
|
|
8978
9165
|
loaderData,
|
|
8979
9166
|
location,
|
|
8980
9167
|
manifest,
|
|
@@ -9116,12 +9303,16 @@ function Scripts(scriptProps) {
|
|
|
9116
9303
|
isSpaMode,
|
|
9117
9304
|
renderMeta,
|
|
9118
9305
|
routeDiscovery,
|
|
9119
|
-
ssr
|
|
9306
|
+
ssr,
|
|
9307
|
+
nonce: contextNonce
|
|
9120
9308
|
} = useFrameworkContext();
|
|
9121
9309
|
let { router, static: isStatic, staticContext } = useDataRouterContext2();
|
|
9122
9310
|
let { matches: routerMatches } = useDataRouterStateContext();
|
|
9123
9311
|
let isRSCRouterContext = useIsRSCRouterContext();
|
|
9124
9312
|
let enableFogOfWar = isFogOfWarEnabled(routeDiscovery, ssr);
|
|
9313
|
+
if (scriptProps.nonce == null && contextNonce) {
|
|
9314
|
+
scriptProps = { ...scriptProps, nonce: contextNonce };
|
|
9315
|
+
}
|
|
9125
9316
|
if (renderMeta) {
|
|
9126
9317
|
renderMeta.didRenderScripts = true;
|
|
9127
9318
|
}
|
|
@@ -9317,10 +9508,12 @@ function RemixRootDefaultErrorBoundary({
|
|
|
9317
9508
|
error,
|
|
9318
9509
|
isOutsideRemixApp
|
|
9319
9510
|
}) {
|
|
9511
|
+
let { nonce } = useFrameworkContext();
|
|
9320
9512
|
console.error(error);
|
|
9321
9513
|
let heyDeveloper = /* @__PURE__ */ React8.createElement(
|
|
9322
9514
|
"script",
|
|
9323
9515
|
{
|
|
9516
|
+
nonce,
|
|
9324
9517
|
dangerouslySetInnerHTML: {
|
|
9325
9518
|
__html: `
|
|
9326
9519
|
console.log(
|
|
@@ -9656,6 +9849,7 @@ function RouterProvider({
|
|
|
9656
9849
|
let navigator = React9.useMemo(() => {
|
|
9657
9850
|
return {
|
|
9658
9851
|
createHref: router.createHref,
|
|
9852
|
+
createURL: router.createURL,
|
|
9659
9853
|
encodeLocation: router.encodeLocation,
|
|
9660
9854
|
go: (n) => router.navigate(n),
|
|
9661
9855
|
push: (to, state2, opts) => router.navigate(to, {
|
|
@@ -9788,7 +9982,7 @@ function Navigate({
|
|
|
9788
9982
|
// the router loaded. We can help them understand how to avoid that.
|
|
9789
9983
|
`<Navigate> may be used only in the context of a <Router> component.`
|
|
9790
9984
|
);
|
|
9791
|
-
let { static: isStatic } = React9.useContext(NavigationContext);
|
|
9985
|
+
let { static: isStatic, navigator } = React9.useContext(NavigationContext);
|
|
9792
9986
|
warning(
|
|
9793
9987
|
!isStatic,
|
|
9794
9988
|
`<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.`
|
|
@@ -9802,6 +9996,12 @@ function Navigate({
|
|
|
9802
9996
|
locationPathname,
|
|
9803
9997
|
relative === "path"
|
|
9804
9998
|
);
|
|
9999
|
+
validateNavigationTarget(
|
|
10000
|
+
typeof to === "string" ? to : createPath(to),
|
|
10001
|
+
navigator.createHref(path),
|
|
10002
|
+
getNavigatorCurrentUrl(navigator),
|
|
10003
|
+
"reject"
|
|
10004
|
+
);
|
|
9805
10005
|
let jsonPath = JSON.stringify(path);
|
|
9806
10006
|
React9.useEffect(() => {
|
|
9807
10007
|
navigate(JSON.parse(jsonPath), { replace: replace2, state, relative });
|
|
@@ -10226,4 +10426,12 @@ function withErrorBoundaryProps(ErrorBoundary) {
|
|
|
10226
10426
|
|
|
10227
10427
|
|
|
10228
10428
|
|
|
10229
|
-
|
|
10429
|
+
|
|
10430
|
+
|
|
10431
|
+
|
|
10432
|
+
|
|
10433
|
+
|
|
10434
|
+
|
|
10435
|
+
|
|
10436
|
+
|
|
10437
|
+
exports.ABSOLUTE_URL_REGEX = ABSOLUTE_URL_REGEX; exports.PROTOCOL_RELATIVE_URL_REGEX = PROTOCOL_RELATIVE_URL_REGEX; exports.Action = Action; exports.createMemoryHistory = createMemoryHistory; exports.createBrowserHistory = createBrowserHistory; exports.createHashHistory = createHashHistory; exports.invariant = invariant; exports.warning = warning; exports.createPath = createPath; exports.parsePath = parsePath; exports.createContext = createContext; exports.RouterContextProvider = RouterContextProvider; exports.convertRoutesToDataRoutes = convertRoutesToDataRoutes; exports.matchRoutes = matchRoutes; exports.matchRoutesImpl = matchRoutesImpl; exports.generatePath = generatePath; exports.matchPath = matchPath; exports.stripBasename = stripBasename; exports.resolvePath = resolvePath; exports.resolveTo = resolveTo; exports.joinPaths = joinPaths; exports.data = data; exports.redirect = redirect; exports.redirectDocument = redirectDocument; exports.replace = replace; exports.SUPPORTED_ERROR_TYPES = SUPPORTED_ERROR_TYPES; exports.ErrorResponseImpl = ErrorResponseImpl; exports.isRouteErrorResponse = isRouteErrorResponse; exports.parseToInfo = parseToInfo; exports.escapeHtml = escapeHtml; exports.escapeAttribute = escapeAttribute; exports.encode = encode; exports.instrumentHandler = instrumentHandler; exports.validateNavigationTarget = validateNavigationTarget; exports.IDLE_NAVIGATION = IDLE_NAVIGATION; exports.IDLE_FETCHER = IDLE_FETCHER; exports.IDLE_BLOCKER = IDLE_BLOCKER; exports.createRouter = createRouter; exports.createStaticHandler = createStaticHandler; exports.getStaticContextFromError = getStaticContextFromError; exports.hasInvalidProtocol = hasInvalidProtocol; exports.isDataWithResponseInit = isDataWithResponseInit; exports.isResponse = isResponse; exports.isRedirectStatusCode = isRedirectStatusCode; exports.isRedirectResponse = isRedirectResponse; exports.isMutationMethod = isMutationMethod; exports.createRequestInit = createRequestInit; exports.SingleFetchRedirectSymbol = SingleFetchRedirectSymbol; exports.SINGLE_FETCH_REDIRECT_STATUS = SINGLE_FETCH_REDIRECT_STATUS; exports.NO_BODY_STATUS_CODES = NO_BODY_STATUS_CODES; exports.StreamTransfer = StreamTransfer; exports.getTurboStreamSingleFetchDataStrategy = getTurboStreamSingleFetchDataStrategy; exports.getSingleFetchDataStrategyImpl = getSingleFetchDataStrategyImpl; exports.stripIndexParam = stripIndexParam; exports.singleFetchUrl = singleFetchUrl; exports.decodeViaTurboStream = decodeViaTurboStream; exports.DataRouterContext = DataRouterContext; exports.DataRouterStateContext = DataRouterStateContext; exports.RSCRouterContext = RSCRouterContext; exports.ViewTransitionContext = ViewTransitionContext; exports.FetchersContext = FetchersContext; exports.AwaitContextProvider = AwaitContextProvider; exports.NavigationContext = NavigationContext; exports.LocationContext = LocationContext; exports.RouteContext = RouteContext; exports.ENABLE_DEV_WARNINGS = ENABLE_DEV_WARNINGS; exports.warnOnce = warnOnce; exports.decodeRedirectErrorDigest = decodeRedirectErrorDigest; exports.decodeRouteErrorResponseDigest = decodeRouteErrorResponseDigest; exports.useHref = useHref; exports.useInRouterContext = useInRouterContext; exports.useLocation = useLocation; exports.useNavigationType = useNavigationType; exports.useMatch = useMatch; exports.useNavigate = useNavigate; exports.useOutletContext = useOutletContext; exports.useOutlet = useOutlet; exports.useParams = useParams; exports.useResolvedPath = useResolvedPath; exports.useRoutes = useRoutes; exports.useRouteId = useRouteId; exports.useNavigation = useNavigation; exports.useRevalidator = useRevalidator; exports.useMatches = useMatches; exports.useLoaderData = useLoaderData; exports.useRouteLoaderData = useRouteLoaderData; exports.useActionData = useActionData; exports.useRouteError = useRouteError; exports.useAsyncValue = useAsyncValue; exports.useAsyncError = useAsyncError; exports.useBlocker = useBlocker; exports.useRoute = useRoute; exports.useRouterState = useRouterState; exports.RemixErrorBoundary = RemixErrorBoundary; exports.createServerRoutes = createServerRoutes; exports.createClientRoutesWithHMRRevalidationOptOut = createClientRoutesWithHMRRevalidationOptOut; exports.noActionDefinedError = noActionDefinedError; exports.createClientRoutes = createClientRoutes; exports.shouldHydrateRouteLoader = shouldHydrateRouteLoader; exports.URL_LIMIT = URL_LIMIT; exports.getPathsWithAncestors = getPathsWithAncestors; exports.isFogOfWarEnabled = isFogOfWarEnabled; exports.shouldUseInitialRouteDiscovery = shouldUseInitialRouteDiscovery; exports.getPatchRoutesOnNavigationFunction = getPatchRoutesOnNavigationFunction; exports.useFogOFWarDiscovery = useFogOFWarDiscovery; exports.getManifestPath = getManifestPath; exports.FrameworkContext = FrameworkContext; exports.usePrefetchBehavior = usePrefetchBehavior; exports.CRITICAL_CSS_DATA_ATTRIBUTE = CRITICAL_CSS_DATA_ATTRIBUTE; exports.Links = Links; exports.PrefetchPageLinks = PrefetchPageLinks; exports.Meta = Meta; exports.setIsHydrated = setIsHydrated; exports.Scripts = Scripts; exports.mergeRefs = mergeRefs; exports.mapRouteProperties = mapRouteProperties; exports.hydrationRouteProperties = hydrationRouteProperties; exports.createMemoryRouter = createMemoryRouter; exports.RouterProvider = RouterProvider; exports.DataRoutes = DataRoutes2; exports.MemoryRouter = MemoryRouter; exports.Navigate = Navigate; exports.Outlet = Outlet; exports.Route = Route; exports.Router = Router; exports.Routes = Routes; exports.Await = Await; exports.createRoutesFromChildren = createRoutesFromChildren; exports.createRoutesFromElements = createRoutesFromElements; exports.renderMatches = renderMatches; exports.WithComponentProps = WithComponentProps; exports.withComponentProps = withComponentProps; exports.WithHydrateFallbackProps = WithHydrateFallbackProps; exports.withHydrateFallbackProps = withHydrateFallbackProps; exports.WithErrorBoundaryProps = WithErrorBoundaryProps; exports.withErrorBoundaryProps = withErrorBoundaryProps;
|