react-router 7.16.0 → 7.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -1
- package/dist/development/{browser-D3uq9sI1.d.ts → browser-B2PdsXXH.d.ts} +2 -2
- package/dist/development/{browser-nIQ4Nsyi.d.mts → browser-DBmQ1yAR.d.mts} +2 -2
- package/dist/development/{chunk-QUQL4437.mjs → chunk-4ZMWKKQ3.mjs} +115 -38
- package/dist/development/{chunk-S54KXAEJ.mjs → chunk-E4MTK73K.mjs} +45 -113
- package/dist/development/{chunk-SRID2YZ2.js → chunk-U7ORXROY.js} +113 -35
- package/dist/development/{chunk-XEJDWL2B.js → chunk-WW7PN6QI.js} +7 -7
- package/dist/{production/chunk-SKEDDLRM.js → development/chunk-YL5M26XI.js} +111 -108
- package/dist/development/{context-m8rizgnE.d.mts → context-CeD5LmaF.d.mts} +13 -5
- package/dist/{production/data-D4xhSy90.d.ts → development/data-CjO11-hU.d.ts} +9 -1
- package/dist/{production/data-U8FS-wNn.d.mts → development/data-DEjBmEfD.d.mts} +9 -1
- package/dist/development/dom-export.d.mts +4 -4
- package/dist/development/dom-export.d.ts +4 -4
- package/dist/development/dom-export.js +46 -44
- package/dist/development/dom-export.mjs +23 -21
- package/dist/{production/index-react-server-client-BLiUx67a.d.ts → development/index-react-server-client-3ykjivgQ.d.ts} +30 -8
- package/dist/development/{index-react-server-client-CdKROblb.d.mts → index-react-server-client-CACgcj2J.d.mts} +19 -5
- 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 +9 -1
- package/dist/development/index-react-server.d.ts +9 -1
- package/dist/development/index-react-server.js +144 -121
- package/dist/development/index-react-server.mjs +143 -120
- package/dist/development/index.d.mts +15 -14
- package/dist/development/index.d.ts +15 -14
- package/dist/development/index.js +137 -205
- package/dist/development/index.mjs +3 -5
- package/dist/{production/instrumentation-1q4YhLGP.d.ts → development/instrumentation-Dkmpzd13.d.ts} +2 -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-CqK96Zfk.d.mts → register-CmkRspdl.d.mts} +1 -1
- package/dist/development/{register-CNAx3TXj.d.ts → register-roq_0qYo.d.ts} +1 -1
- package/dist/production/{browser-D3uq9sI1.d.ts → browser-B2PdsXXH.d.ts} +2 -2
- package/dist/production/{browser-nIQ4Nsyi.d.mts → browser-DBmQ1yAR.d.mts} +2 -2
- package/dist/production/{chunk-EAQNHM3N.js → chunk-3Z6WS2WZ.js} +7 -7
- package/dist/{development/chunk-IBI7OMNB.js → production/chunk-BIP66BKV.js} +111 -108
- package/dist/production/{chunk-NALGHHKE.mjs → chunk-EGOTSXNH.mjs} +45 -113
- package/dist/production/{chunk-Y7DNFQZP.js → chunk-IUPBOWYO.js} +113 -35
- package/dist/production/{chunk-Q65P7S7Y.mjs → chunk-M7NGGUU6.mjs} +115 -38
- package/dist/production/{context-m8rizgnE.d.mts → context-CeD5LmaF.d.mts} +13 -5
- package/dist/{development/data-D4xhSy90.d.ts → production/data-CjO11-hU.d.ts} +9 -1
- package/dist/{development/data-U8FS-wNn.d.mts → production/data-DEjBmEfD.d.mts} +9 -1
- package/dist/production/dom-export.d.mts +4 -4
- package/dist/production/dom-export.d.ts +4 -4
- package/dist/production/dom-export.js +46 -44
- package/dist/production/dom-export.mjs +23 -21
- package/dist/{development/index-react-server-client-BLiUx67a.d.ts → production/index-react-server-client-3ykjivgQ.d.ts} +30 -8
- package/dist/production/{index-react-server-client-CdKROblb.d.mts → index-react-server-client-CACgcj2J.d.mts} +19 -5
- 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 +9 -1
- package/dist/production/index-react-server.d.ts +9 -1
- package/dist/production/index-react-server.js +144 -121
- package/dist/production/index-react-server.mjs +143 -120
- package/dist/production/index.d.mts +15 -14
- package/dist/production/index.d.ts +15 -14
- package/dist/production/index.js +137 -205
- package/dist/production/index.mjs +3 -5
- package/dist/{development/instrumentation-1q4YhLGP.d.ts → production/instrumentation-Dkmpzd13.d.ts} +2 -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-CqK96Zfk.d.mts → register-CmkRspdl.d.mts} +1 -1
- package/dist/production/{register-CNAx3TXj.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 +280 -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.0
|
|
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";
|
|
@@ -373,7 +380,7 @@ function createBrowserURLImpl(windowImpl, to, isAbsolute = false) {
|
|
|
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,6 +778,9 @@ 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];
|
|
@@ -839,7 +870,6 @@ function prependBasename({
|
|
|
839
870
|
}) {
|
|
840
871
|
return pathname === "/" ? basename : joinPaths([basename, pathname]);
|
|
841
872
|
}
|
|
842
|
-
var ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
|
|
843
873
|
var isAbsoluteUrl = (url) => ABSOLUTE_URL_REGEX.test(url);
|
|
844
874
|
function resolvePath(to, fromPathname = "/") {
|
|
845
875
|
let {
|
|
@@ -936,7 +966,7 @@ function resolveTo(toArg, routePathnames, locationPathname, isPathRelative = fal
|
|
|
936
966
|
}
|
|
937
967
|
return path;
|
|
938
968
|
}
|
|
939
|
-
var removeDoubleSlashes = (path) => path.replace(
|
|
969
|
+
var removeDoubleSlashes = (path) => path.replace(/[\\/]{2,}/g, "/");
|
|
940
970
|
var joinPaths = (paths) => removeDoubleSlashes(paths.join("/"));
|
|
941
971
|
var removeTrailingSlash = (path) => path.replace(/\/+$/, "");
|
|
942
972
|
var normalizePathname = (pathname) => removeTrailingSlash(pathname).replace(/^\/*/, "/");
|
|
@@ -976,6 +1006,14 @@ var replace = (url, init) => {
|
|
|
976
1006
|
response.headers.set("X-Remix-Replace", "true");
|
|
977
1007
|
return response;
|
|
978
1008
|
};
|
|
1009
|
+
var SUPPORTED_ERROR_TYPES = [
|
|
1010
|
+
"EvalError",
|
|
1011
|
+
"RangeError",
|
|
1012
|
+
"ReferenceError",
|
|
1013
|
+
"SyntaxError",
|
|
1014
|
+
"TypeError",
|
|
1015
|
+
"URIError"
|
|
1016
|
+
];
|
|
979
1017
|
var ErrorResponseImpl = class {
|
|
980
1018
|
constructor(status, statusText, data2, internal = false) {
|
|
981
1019
|
this.status = status;
|
|
@@ -1011,7 +1049,7 @@ function parseToInfo(_to, basename) {
|
|
|
1011
1049
|
if (isBrowser) {
|
|
1012
1050
|
try {
|
|
1013
1051
|
let currentUrl = new URL(window.location.href);
|
|
1014
|
-
let targetUrl =
|
|
1052
|
+
let targetUrl = PROTOCOL_RELATIVE_URL_REGEX.test(to) ? new URL(normalizeProtocolRelativeUrl(to, currentUrl.protocol)) : new URL(to);
|
|
1015
1053
|
let path = stripBasename(targetUrl.pathname, basename);
|
|
1016
1054
|
if (targetUrl.origin === currentUrl.origin && path != null) {
|
|
1017
1055
|
to = path + targetUrl.search + targetUrl.hash;
|
|
@@ -5203,11 +5241,20 @@ var invalidProtocols = [
|
|
|
5203
5241
|
// eslint-disable-next-line no-script-url
|
|
5204
5242
|
"javascript:"
|
|
5205
5243
|
];
|
|
5244
|
+
function hasInvalidProtocol(location) {
|
|
5245
|
+
try {
|
|
5246
|
+
return invalidProtocols.includes(new URL(location).protocol);
|
|
5247
|
+
} catch (e2) {
|
|
5248
|
+
return false;
|
|
5249
|
+
}
|
|
5250
|
+
}
|
|
5206
5251
|
function normalizeRedirectLocation(location, currentUrl, basename, historyInstance) {
|
|
5207
5252
|
if (isAbsoluteUrl(location)) {
|
|
5208
5253
|
let normalizedLocation = location;
|
|
5209
|
-
let url =
|
|
5210
|
-
|
|
5254
|
+
let url = PROTOCOL_RELATIVE_URL_REGEX.test(normalizedLocation) ? new URL(
|
|
5255
|
+
normalizeProtocolRelativeUrl(normalizedLocation, currentUrl.protocol)
|
|
5256
|
+
) : new URL(normalizedLocation);
|
|
5257
|
+
if (hasInvalidProtocol(url.toString())) {
|
|
5211
5258
|
throw new Error("Invalid redirect location");
|
|
5212
5259
|
}
|
|
5213
5260
|
let isSameBasename = stripBasename(url.pathname, basename) != null;
|
|
@@ -5217,7 +5264,7 @@ function normalizeRedirectLocation(location, currentUrl, basename, historyInstan
|
|
|
5217
5264
|
}
|
|
5218
5265
|
try {
|
|
5219
5266
|
let url = historyInstance.createURL(location);
|
|
5220
|
-
if (
|
|
5267
|
+
if (hasInvalidProtocol(url.toString())) {
|
|
5221
5268
|
throw new Error("Invalid redirect location");
|
|
5222
5269
|
}
|
|
5223
5270
|
} catch (e) {
|
|
@@ -5757,14 +5804,6 @@ var TYPE_SET = "S";
|
|
|
5757
5804
|
var TYPE_SYMBOL = "Y";
|
|
5758
5805
|
var TYPE_URL = "U";
|
|
5759
5806
|
var TYPE_PREVIOUS_RESOLVED = "Z";
|
|
5760
|
-
var SUPPORTED_ERROR_TYPES = [
|
|
5761
|
-
"EvalError",
|
|
5762
|
-
"RangeError",
|
|
5763
|
-
"ReferenceError",
|
|
5764
|
-
"SyntaxError",
|
|
5765
|
-
"TypeError",
|
|
5766
|
-
"URIError"
|
|
5767
|
-
];
|
|
5768
5807
|
var Deferred = class {
|
|
5769
5808
|
constructor() {
|
|
5770
5809
|
this.promise = new Promise((resolve, reject) => {
|
|
@@ -7046,7 +7085,7 @@ function decodeRedirectErrorDigest(digest) {
|
|
|
7046
7085
|
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
7086
|
return parsed;
|
|
7048
7087
|
}
|
|
7049
|
-
} catch (
|
|
7088
|
+
} catch (e3) {
|
|
7050
7089
|
}
|
|
7051
7090
|
}
|
|
7052
7091
|
}
|
|
@@ -7063,7 +7102,7 @@ function decodeRouteErrorResponseDigest(digest) {
|
|
|
7063
7102
|
parsed.data
|
|
7064
7103
|
);
|
|
7065
7104
|
}
|
|
7066
|
-
} catch (
|
|
7105
|
+
} catch (e4) {
|
|
7067
7106
|
}
|
|
7068
7107
|
}
|
|
7069
7108
|
}
|
|
@@ -7404,9 +7443,13 @@ function RSCErrorHandler({
|
|
|
7404
7443
|
let existingRedirect = errorRedirectHandledMap.get(error);
|
|
7405
7444
|
if (existingRedirect) throw existingRedirect;
|
|
7406
7445
|
let parsed = parseToInfo(redirect2.location, basename);
|
|
7446
|
+
let target = parsed.absoluteURL || parsed.to;
|
|
7447
|
+
if (hasInvalidProtocol(target)) {
|
|
7448
|
+
throw new Error("Invalid redirect location");
|
|
7449
|
+
}
|
|
7407
7450
|
if (isBrowser && !errorRedirectHandledMap.get(error)) {
|
|
7408
7451
|
if (parsed.isExternal || redirect2.reloadDocument) {
|
|
7409
|
-
window.location.href =
|
|
7452
|
+
window.location.href = target;
|
|
7410
7453
|
} else {
|
|
7411
7454
|
const redirectPromise = Promise.resolve().then(
|
|
7412
7455
|
() => window.__reactRouterDataRouter.navigate(parsed.to, {
|
|
@@ -7417,13 +7460,7 @@ function RSCErrorHandler({
|
|
|
7417
7460
|
throw redirectPromise;
|
|
7418
7461
|
}
|
|
7419
7462
|
}
|
|
7420
|
-
return /* @__PURE__ */ React3.createElement(
|
|
7421
|
-
"meta",
|
|
7422
|
-
{
|
|
7423
|
-
httpEquiv: "refresh",
|
|
7424
|
-
content: `0;url=${parsed.absoluteURL || parsed.to}`
|
|
7425
|
-
}
|
|
7426
|
-
);
|
|
7463
|
+
return /* @__PURE__ */ React3.createElement("meta", { httpEquiv: "refresh", content: `0;url=${target}` });
|
|
7427
7464
|
}
|
|
7428
7465
|
}
|
|
7429
7466
|
return children;
|
|
@@ -8055,9 +8092,11 @@ function warnOnce(condition, message) {
|
|
|
8055
8092
|
// lib/dom/ssr/fallback.tsx
|
|
8056
8093
|
|
|
8057
8094
|
function RemixRootDefaultHydrateFallback() {
|
|
8095
|
+
let { nonce } = useFrameworkContext();
|
|
8058
8096
|
return /* @__PURE__ */ React4.createElement(BoundaryShell, { title: "Loading...", renderScripts: true }, ENABLE_DEV_WARNINGS ? /* @__PURE__ */ React4.createElement(
|
|
8059
8097
|
"script",
|
|
8060
8098
|
{
|
|
8099
|
+
nonce,
|
|
8061
8100
|
dangerouslySetInnerHTML: {
|
|
8062
8101
|
__html: `
|
|
8063
8102
|
console.log(
|
|
@@ -8477,6 +8516,21 @@ var nextPaths = /* @__PURE__ */ new Set();
|
|
|
8477
8516
|
var discoveredPathsMaxSize = 1e3;
|
|
8478
8517
|
var discoveredPaths = /* @__PURE__ */ new Set();
|
|
8479
8518
|
var URL_LIMIT = 7680;
|
|
8519
|
+
function getPathsWithAncestors(paths) {
|
|
8520
|
+
let result = /* @__PURE__ */ new Set();
|
|
8521
|
+
paths.forEach((path) => {
|
|
8522
|
+
if (!path.startsWith("/")) {
|
|
8523
|
+
path = `/${path}`;
|
|
8524
|
+
}
|
|
8525
|
+
for (let i = 1; i < path.length; i++) {
|
|
8526
|
+
if (path[i] === "/") {
|
|
8527
|
+
result.add(path.slice(0, i));
|
|
8528
|
+
}
|
|
8529
|
+
}
|
|
8530
|
+
result.add(path);
|
|
8531
|
+
});
|
|
8532
|
+
return Array.from(result);
|
|
8533
|
+
}
|
|
8480
8534
|
function isFogOfWarEnabled(routeDiscovery, ssr) {
|
|
8481
8535
|
return routeDiscovery.mode === "lazy" && ssr === true;
|
|
8482
8536
|
}
|
|
@@ -8598,6 +8652,7 @@ function getManifestPath(_manifestPath, basename) {
|
|
|
8598
8652
|
}
|
|
8599
8653
|
var MANIFEST_VERSION_STORAGE_KEY = "react-router-manifest-version";
|
|
8600
8654
|
async function fetchAndApplyManifestPatches(paths, errorReloadPath, manifest, routeModules, ssr, isSpaMode, basename, manifestPath, patchRoutes, signal) {
|
|
8655
|
+
paths = getPathsWithAncestors(paths);
|
|
8601
8656
|
const searchParams = new URLSearchParams();
|
|
8602
8657
|
searchParams.set("paths", paths.sort().join(","));
|
|
8603
8658
|
searchParams.set("version", manifest.version);
|
|
@@ -8630,7 +8685,7 @@ async function fetchAndApplyManifestPatches(paths, errorReloadPath, manifest, ro
|
|
|
8630
8685
|
return;
|
|
8631
8686
|
}
|
|
8632
8687
|
sessionStorage.setItem(MANIFEST_VERSION_STORAGE_KEY, manifest.version);
|
|
8633
|
-
} catch (
|
|
8688
|
+
} catch (e5) {
|
|
8634
8689
|
}
|
|
8635
8690
|
window.location.href = errorReloadPath;
|
|
8636
8691
|
console.warn("Detected manifest version mismatch, reloading...");
|
|
@@ -8641,7 +8696,7 @@ async function fetchAndApplyManifestPatches(paths, errorReloadPath, manifest, ro
|
|
|
8641
8696
|
}
|
|
8642
8697
|
try {
|
|
8643
8698
|
sessionStorage.removeItem(MANIFEST_VERSION_STORAGE_KEY);
|
|
8644
|
-
} catch (
|
|
8699
|
+
} catch (e6) {
|
|
8645
8700
|
}
|
|
8646
8701
|
serverPatches = await res.json();
|
|
8647
8702
|
} catch (e) {
|
|
@@ -8790,13 +8845,22 @@ function getActiveMatches(matches, errors, isSpaMode) {
|
|
|
8790
8845
|
}
|
|
8791
8846
|
var CRITICAL_CSS_DATA_ATTRIBUTE = "data-react-router-critical-css";
|
|
8792
8847
|
function Links({ nonce, crossOrigin }) {
|
|
8793
|
-
let {
|
|
8848
|
+
let {
|
|
8849
|
+
isSpaMode,
|
|
8850
|
+
manifest,
|
|
8851
|
+
routeModules,
|
|
8852
|
+
criticalCss,
|
|
8853
|
+
nonce: contextNonce
|
|
8854
|
+
} = useFrameworkContext();
|
|
8794
8855
|
let { errors, matches: routerMatches } = useDataRouterStateContext();
|
|
8795
8856
|
let matches = getActiveMatches(routerMatches, errors, isSpaMode);
|
|
8796
8857
|
let keyedLinks = React7.useMemo(
|
|
8797
8858
|
() => getKeyedLinksForMatches(matches, routeModules, manifest),
|
|
8798
8859
|
[matches, routeModules, manifest]
|
|
8799
8860
|
);
|
|
8861
|
+
if (nonce == null && contextNonce) {
|
|
8862
|
+
nonce = contextNonce;
|
|
8863
|
+
}
|
|
8800
8864
|
return /* @__PURE__ */ React7.createElement(React7.Fragment, null, typeof criticalCss === "string" ? /* @__PURE__ */ React7.createElement(
|
|
8801
8865
|
"style",
|
|
8802
8866
|
{
|
|
@@ -8835,6 +8899,7 @@ function Links({ nonce, crossOrigin }) {
|
|
|
8835
8899
|
}
|
|
8836
8900
|
function PrefetchPageLinks({ page, ...linkProps }) {
|
|
8837
8901
|
let rsc = useIsRSCRouterContext();
|
|
8902
|
+
let { nonce: contextNonce } = useFrameworkContext();
|
|
8838
8903
|
let { router } = useDataRouterContext2();
|
|
8839
8904
|
let matches = React7.useMemo(
|
|
8840
8905
|
() => matchRoutes(router.routes, page, router.basename),
|
|
@@ -8843,6 +8908,9 @@ function PrefetchPageLinks({ page, ...linkProps }) {
|
|
|
8843
8908
|
if (!matches) {
|
|
8844
8909
|
return null;
|
|
8845
8910
|
}
|
|
8911
|
+
if (linkProps.nonce == null && contextNonce) {
|
|
8912
|
+
linkProps = { ...linkProps, nonce: contextNonce };
|
|
8913
|
+
}
|
|
8846
8914
|
if (rsc) {
|
|
8847
8915
|
return /* @__PURE__ */ React7.createElement(RSCPrefetchPageLinksImpl, { page, matches, ...linkProps });
|
|
8848
8916
|
}
|
|
@@ -9116,12 +9184,16 @@ function Scripts(scriptProps) {
|
|
|
9116
9184
|
isSpaMode,
|
|
9117
9185
|
renderMeta,
|
|
9118
9186
|
routeDiscovery,
|
|
9119
|
-
ssr
|
|
9187
|
+
ssr,
|
|
9188
|
+
nonce: contextNonce
|
|
9120
9189
|
} = useFrameworkContext();
|
|
9121
9190
|
let { router, static: isStatic, staticContext } = useDataRouterContext2();
|
|
9122
9191
|
let { matches: routerMatches } = useDataRouterStateContext();
|
|
9123
9192
|
let isRSCRouterContext = useIsRSCRouterContext();
|
|
9124
9193
|
let enableFogOfWar = isFogOfWarEnabled(routeDiscovery, ssr);
|
|
9194
|
+
if (scriptProps.nonce == null && contextNonce) {
|
|
9195
|
+
scriptProps = { ...scriptProps, nonce: contextNonce };
|
|
9196
|
+
}
|
|
9125
9197
|
if (renderMeta) {
|
|
9126
9198
|
renderMeta.didRenderScripts = true;
|
|
9127
9199
|
}
|
|
@@ -9317,10 +9389,12 @@ function RemixRootDefaultErrorBoundary({
|
|
|
9317
9389
|
error,
|
|
9318
9390
|
isOutsideRemixApp
|
|
9319
9391
|
}) {
|
|
9392
|
+
let { nonce } = useFrameworkContext();
|
|
9320
9393
|
console.error(error);
|
|
9321
9394
|
let heyDeveloper = /* @__PURE__ */ React8.createElement(
|
|
9322
9395
|
"script",
|
|
9323
9396
|
{
|
|
9397
|
+
nonce,
|
|
9324
9398
|
dangerouslySetInnerHTML: {
|
|
9325
9399
|
__html: `
|
|
9326
9400
|
console.log(
|
|
@@ -10226,4 +10300,8 @@ function withErrorBoundaryProps(ErrorBoundary) {
|
|
|
10226
10300
|
|
|
10227
10301
|
|
|
10228
10302
|
|
|
10229
|
-
|
|
10303
|
+
|
|
10304
|
+
|
|
10305
|
+
|
|
10306
|
+
|
|
10307
|
+
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.encode = encode; exports.instrumentHandler = instrumentHandler; 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.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;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }/**
|
|
2
|
-
* react-router v7.
|
|
2
|
+
* react-router v7.18.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
var
|
|
17
|
+
var _chunkU7ORXROYjs = require('./chunk-U7ORXROY.js');
|
|
18
18
|
|
|
19
19
|
// lib/dom/ssr/hydration.tsx
|
|
20
20
|
function getHydrationData({
|
|
@@ -29,12 +29,12 @@ function getHydrationData({
|
|
|
29
29
|
...state,
|
|
30
30
|
loaderData: { ...state.loaderData }
|
|
31
31
|
};
|
|
32
|
-
let initialMatches =
|
|
32
|
+
let initialMatches = _chunkU7ORXROYjs.matchRoutes.call(void 0, routes, location, basename);
|
|
33
33
|
if (initialMatches) {
|
|
34
34
|
for (let match of initialMatches) {
|
|
35
35
|
let routeId = match.route.id;
|
|
36
36
|
let routeInfo = getRouteInfo(routeId);
|
|
37
|
-
if (
|
|
37
|
+
if (_chunkU7ORXROYjs.shouldHydrateRouteLoader.call(void 0,
|
|
38
38
|
routeId,
|
|
39
39
|
routeInfo.clientLoader,
|
|
40
40
|
routeInfo.hasLoader,
|
|
@@ -112,7 +112,7 @@ function RSCDefaultRootErrorBoundaryImpl({
|
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
);
|
|
115
|
-
if (
|
|
115
|
+
if (_chunkU7ORXROYjs.isRouteErrorResponse.call(void 0, error)) {
|
|
116
116
|
return /* @__PURE__ */ _react2.default.createElement(
|
|
117
117
|
ErrorWrapper,
|
|
118
118
|
{
|
|
@@ -120,7 +120,7 @@ function RSCDefaultRootErrorBoundaryImpl({
|
|
|
120
120
|
title: "Unhandled Thrown Response!"
|
|
121
121
|
},
|
|
122
122
|
/* @__PURE__ */ _react2.default.createElement("h1", { style: { fontSize: "24px" } }, error.status, " ", error.statusText),
|
|
123
|
-
|
|
123
|
+
_chunkU7ORXROYjs.ENABLE_DEV_WARNINGS ? heyDeveloper : null
|
|
124
124
|
);
|
|
125
125
|
}
|
|
126
126
|
let errorInstance;
|
|
@@ -146,7 +146,7 @@ function RSCDefaultRootErrorBoundaryImpl({
|
|
|
146
146
|
function RSCDefaultRootErrorBoundary({
|
|
147
147
|
hasRootLayout
|
|
148
148
|
}) {
|
|
149
|
-
let error =
|
|
149
|
+
let error = _chunkU7ORXROYjs.useRouteError.call(void 0, );
|
|
150
150
|
if (hasRootLayout === void 0) {
|
|
151
151
|
throw new Error("Missing 'hasRootLayout' prop");
|
|
152
152
|
}
|