react-router 7.17.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 +13 -1
- package/dist/development/{browser-D3uq9sI1.d.ts → browser-B2PdsXXH.d.ts} +2 -2
- package/dist/development/{browser-CGcs-0pD.d.mts → browser-DBmQ1yAR.d.mts} +2 -2
- package/dist/development/{chunk-6CSD65Y2.mjs → chunk-4ZMWKKQ3.mjs} +115 -38
- package/dist/{production/chunk-5TQZEVD5.mjs → development/chunk-E4MTK73K.mjs} +45 -113
- package/dist/development/{chunk-KFNXW4AL.js → chunk-U7ORXROY.js} +113 -35
- package/dist/development/{chunk-PBLBZ3QU.js → chunk-WW7PN6QI.js} +7 -7
- package/dist/development/{chunk-PULC7NLK.js → chunk-YL5M26XI.js} +111 -108
- package/dist/{production/context-CmHpk1Ws.d.mts → development/context-CeD5LmaF.d.mts} +12 -4
- package/dist/{production/data-D4xhSy90.d.ts → development/data-CjO11-hU.d.ts} +9 -1
- package/dist/development/{data-U8FS-wNn.d.mts → data-DEjBmEfD.d.mts} +9 -1
- package/dist/development/dom-export.d.mts +3 -3
- package/dist/development/dom-export.d.ts +3 -3
- package/dist/development/dom-export.js +46 -44
- package/dist/development/dom-export.mjs +23 -21
- package/dist/development/{index-react-server-client-CwU9bE5R.d.ts → index-react-server-client-3ykjivgQ.d.ts} +29 -7
- package/dist/development/{index-react-server-client-DPrDrCew.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-CGcs-0pD.d.mts → browser-DBmQ1yAR.d.mts} +2 -2
- package/dist/production/{chunk-CTIXC7EV.js → chunk-3Z6WS2WZ.js} +7 -7
- package/dist/production/{chunk-EN242BO4.js → chunk-BIP66BKV.js} +111 -108
- package/dist/{development/chunk-ASILSGTR.mjs → production/chunk-EGOTSXNH.mjs} +45 -113
- package/dist/production/{chunk-RTRY3JFT.js → chunk-IUPBOWYO.js} +113 -35
- package/dist/production/{chunk-OSYEOCBT.mjs → chunk-M7NGGUU6.mjs} +115 -38
- package/dist/{development/context-CmHpk1Ws.d.mts → production/context-CeD5LmaF.d.mts} +12 -4
- package/dist/{development/data-D4xhSy90.d.ts → production/data-CjO11-hU.d.ts} +9 -1
- package/dist/production/{data-U8FS-wNn.d.mts → data-DEjBmEfD.d.mts} +9 -1
- package/dist/production/dom-export.d.mts +3 -3
- package/dist/production/dom-export.d.ts +3 -3
- package/dist/production/dom-export.js +46 -44
- package/dist/production/dom-export.mjs +23 -21
- package/dist/production/{index-react-server-client-CwU9bE5R.d.ts → index-react-server-client-3ykjivgQ.d.ts} +29 -7
- package/dist/production/{index-react-server-client-DPrDrCew.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/type-safety.md +1 -1
- package/docs/how-to/headers.md +2 -1
- package/docs/how-to/security.md +8 -6
- package/docs/start/data/installation.md +4 -0
- package/docs/start/framework/deploying.md +4 -0
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
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 {
|
|
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) {
|
|
@@ -6146,9 +6193,13 @@ function RSCErrorHandler({
|
|
|
6146
6193
|
let existingRedirect = errorRedirectHandledMap.get(error);
|
|
6147
6194
|
if (existingRedirect) throw existingRedirect;
|
|
6148
6195
|
let parsed = parseToInfo(redirect2.location, basename);
|
|
6196
|
+
let target = parsed.absoluteURL || parsed.to;
|
|
6197
|
+
if (hasInvalidProtocol(target)) {
|
|
6198
|
+
throw new Error("Invalid redirect location");
|
|
6199
|
+
}
|
|
6149
6200
|
if (isBrowser && !errorRedirectHandledMap.get(error)) {
|
|
6150
6201
|
if (parsed.isExternal || redirect2.reloadDocument) {
|
|
6151
|
-
window.location.href =
|
|
6202
|
+
window.location.href = target;
|
|
6152
6203
|
} else {
|
|
6153
6204
|
const redirectPromise = Promise.resolve().then(
|
|
6154
6205
|
() => window.__reactRouterDataRouter.navigate(parsed.to, {
|
|
@@ -6159,13 +6210,7 @@ function RSCErrorHandler({
|
|
|
6159
6210
|
throw redirectPromise;
|
|
6160
6211
|
}
|
|
6161
6212
|
}
|
|
6162
|
-
return /* @__PURE__ */ React2.createElement(
|
|
6163
|
-
"meta",
|
|
6164
|
-
{
|
|
6165
|
-
httpEquiv: "refresh",
|
|
6166
|
-
content: `0;url=${parsed.absoluteURL || parsed.to}`
|
|
6167
|
-
}
|
|
6168
|
-
);
|
|
6213
|
+
return /* @__PURE__ */ React2.createElement("meta", { httpEquiv: "refresh", content: `0;url=${target}` });
|
|
6169
6214
|
}
|
|
6170
6215
|
}
|
|
6171
6216
|
return children;
|
|
@@ -7417,14 +7462,6 @@ var TYPE_SET = "S";
|
|
|
7417
7462
|
var TYPE_SYMBOL = "Y";
|
|
7418
7463
|
var TYPE_URL = "U";
|
|
7419
7464
|
var TYPE_PREVIOUS_RESOLVED = "Z";
|
|
7420
|
-
var SUPPORTED_ERROR_TYPES = [
|
|
7421
|
-
"EvalError",
|
|
7422
|
-
"RangeError",
|
|
7423
|
-
"ReferenceError",
|
|
7424
|
-
"SyntaxError",
|
|
7425
|
-
"TypeError",
|
|
7426
|
-
"URIError"
|
|
7427
|
-
];
|
|
7428
7465
|
var Deferred2 = class {
|
|
7429
7466
|
constructor() {
|
|
7430
7467
|
this.promise = new Promise((resolve, reject) => {
|
|
@@ -8901,9 +8938,11 @@ import * as React6 from "react";
|
|
|
8901
8938
|
// lib/dom/ssr/fallback.tsx
|
|
8902
8939
|
import * as React5 from "react";
|
|
8903
8940
|
function RemixRootDefaultHydrateFallback() {
|
|
8941
|
+
let { nonce } = useFrameworkContext();
|
|
8904
8942
|
return /* @__PURE__ */ React5.createElement(BoundaryShell, { title: "Loading...", renderScripts: true }, ENABLE_DEV_WARNINGS ? /* @__PURE__ */ React5.createElement(
|
|
8905
8943
|
"script",
|
|
8906
8944
|
{
|
|
8945
|
+
nonce,
|
|
8907
8946
|
dangerouslySetInnerHTML: {
|
|
8908
8947
|
__html: `
|
|
8909
8948
|
console.log(
|
|
@@ -9323,6 +9362,21 @@ var nextPaths = /* @__PURE__ */ new Set();
|
|
|
9323
9362
|
var discoveredPathsMaxSize = 1e3;
|
|
9324
9363
|
var discoveredPaths = /* @__PURE__ */ new Set();
|
|
9325
9364
|
var URL_LIMIT = 7680;
|
|
9365
|
+
function getPathsWithAncestors(paths) {
|
|
9366
|
+
let result = /* @__PURE__ */ new Set();
|
|
9367
|
+
paths.forEach((path) => {
|
|
9368
|
+
if (!path.startsWith("/")) {
|
|
9369
|
+
path = `/${path}`;
|
|
9370
|
+
}
|
|
9371
|
+
for (let i = 1; i < path.length; i++) {
|
|
9372
|
+
if (path[i] === "/") {
|
|
9373
|
+
result.add(path.slice(0, i));
|
|
9374
|
+
}
|
|
9375
|
+
}
|
|
9376
|
+
result.add(path);
|
|
9377
|
+
});
|
|
9378
|
+
return Array.from(result);
|
|
9379
|
+
}
|
|
9326
9380
|
function isFogOfWarEnabled(routeDiscovery, ssr) {
|
|
9327
9381
|
return routeDiscovery.mode === "lazy" && ssr === true;
|
|
9328
9382
|
}
|
|
@@ -9444,6 +9498,7 @@ function getManifestPath(_manifestPath, basename) {
|
|
|
9444
9498
|
}
|
|
9445
9499
|
var MANIFEST_VERSION_STORAGE_KEY = "react-router-manifest-version";
|
|
9446
9500
|
async function fetchAndApplyManifestPatches(paths, errorReloadPath, manifest, routeModules, ssr, isSpaMode, basename, manifestPath, patchRoutes, signal) {
|
|
9501
|
+
paths = getPathsWithAncestors(paths);
|
|
9447
9502
|
const searchParams = new URLSearchParams();
|
|
9448
9503
|
searchParams.set("paths", paths.sort().join(","));
|
|
9449
9504
|
searchParams.set("version", manifest.version);
|
|
@@ -9636,13 +9691,22 @@ function getActiveMatches(matches, errors, isSpaMode) {
|
|
|
9636
9691
|
}
|
|
9637
9692
|
var CRITICAL_CSS_DATA_ATTRIBUTE = "data-react-router-critical-css";
|
|
9638
9693
|
function Links({ nonce, crossOrigin }) {
|
|
9639
|
-
let {
|
|
9694
|
+
let {
|
|
9695
|
+
isSpaMode,
|
|
9696
|
+
manifest,
|
|
9697
|
+
routeModules,
|
|
9698
|
+
criticalCss,
|
|
9699
|
+
nonce: contextNonce
|
|
9700
|
+
} = useFrameworkContext();
|
|
9640
9701
|
let { errors, matches: routerMatches } = useDataRouterStateContext();
|
|
9641
9702
|
let matches = getActiveMatches(routerMatches, errors, isSpaMode);
|
|
9642
9703
|
let keyedLinks = React8.useMemo(
|
|
9643
9704
|
() => getKeyedLinksForMatches(matches, routeModules, manifest),
|
|
9644
9705
|
[matches, routeModules, manifest]
|
|
9645
9706
|
);
|
|
9707
|
+
if (nonce == null && contextNonce) {
|
|
9708
|
+
nonce = contextNonce;
|
|
9709
|
+
}
|
|
9646
9710
|
return /* @__PURE__ */ React8.createElement(React8.Fragment, null, typeof criticalCss === "string" ? /* @__PURE__ */ React8.createElement(
|
|
9647
9711
|
"style",
|
|
9648
9712
|
{
|
|
@@ -9681,6 +9745,7 @@ function Links({ nonce, crossOrigin }) {
|
|
|
9681
9745
|
}
|
|
9682
9746
|
function PrefetchPageLinks({ page, ...linkProps }) {
|
|
9683
9747
|
let rsc = useIsRSCRouterContext();
|
|
9748
|
+
let { nonce: contextNonce } = useFrameworkContext();
|
|
9684
9749
|
let { router } = useDataRouterContext2();
|
|
9685
9750
|
let matches = React8.useMemo(
|
|
9686
9751
|
() => matchRoutes(router.routes, page, router.basename),
|
|
@@ -9689,6 +9754,9 @@ function PrefetchPageLinks({ page, ...linkProps }) {
|
|
|
9689
9754
|
if (!matches) {
|
|
9690
9755
|
return null;
|
|
9691
9756
|
}
|
|
9757
|
+
if (linkProps.nonce == null && contextNonce) {
|
|
9758
|
+
linkProps = { ...linkProps, nonce: contextNonce };
|
|
9759
|
+
}
|
|
9692
9760
|
if (rsc) {
|
|
9693
9761
|
return /* @__PURE__ */ React8.createElement(RSCPrefetchPageLinksImpl, { page, matches, ...linkProps });
|
|
9694
9762
|
}
|
|
@@ -9962,12 +10030,16 @@ function Scripts(scriptProps) {
|
|
|
9962
10030
|
isSpaMode,
|
|
9963
10031
|
renderMeta,
|
|
9964
10032
|
routeDiscovery,
|
|
9965
|
-
ssr
|
|
10033
|
+
ssr,
|
|
10034
|
+
nonce: contextNonce
|
|
9966
10035
|
} = useFrameworkContext();
|
|
9967
10036
|
let { router, static: isStatic, staticContext } = useDataRouterContext2();
|
|
9968
10037
|
let { matches: routerMatches } = useDataRouterStateContext();
|
|
9969
10038
|
let isRSCRouterContext = useIsRSCRouterContext();
|
|
9970
10039
|
let enableFogOfWar = isFogOfWarEnabled(routeDiscovery, ssr);
|
|
10040
|
+
if (scriptProps.nonce == null && contextNonce) {
|
|
10041
|
+
scriptProps = { ...scriptProps, nonce: contextNonce };
|
|
10042
|
+
}
|
|
9971
10043
|
if (renderMeta) {
|
|
9972
10044
|
renderMeta.didRenderScripts = true;
|
|
9973
10045
|
}
|
|
@@ -10163,10 +10235,12 @@ function RemixRootDefaultErrorBoundary({
|
|
|
10163
10235
|
error,
|
|
10164
10236
|
isOutsideRemixApp
|
|
10165
10237
|
}) {
|
|
10238
|
+
let { nonce } = useFrameworkContext();
|
|
10166
10239
|
console.error(error);
|
|
10167
10240
|
let heyDeveloper = /* @__PURE__ */ React9.createElement(
|
|
10168
10241
|
"script",
|
|
10169
10242
|
{
|
|
10243
|
+
nonce,
|
|
10170
10244
|
dangerouslySetInnerHTML: {
|
|
10171
10245
|
__html: `
|
|
10172
10246
|
console.log(
|
|
@@ -10233,7 +10307,7 @@ var isBrowser2 = typeof window !== "undefined" && typeof window.document !== "un
|
|
|
10233
10307
|
try {
|
|
10234
10308
|
if (isBrowser2) {
|
|
10235
10309
|
window.__reactRouterVersion = // @ts-expect-error
|
|
10236
|
-
"7.
|
|
10310
|
+
"7.18.0";
|
|
10237
10311
|
}
|
|
10238
10312
|
} catch (e) {
|
|
10239
10313
|
}
|
|
@@ -10292,7 +10366,7 @@ function deserializeErrors(errors) {
|
|
|
10292
10366
|
val.internal === true
|
|
10293
10367
|
);
|
|
10294
10368
|
} else if (val && val.__type === "Error") {
|
|
10295
|
-
if (val.__subType) {
|
|
10369
|
+
if (typeof val.__subType === "string" && SUPPORTED_ERROR_TYPES.includes(val.__subType)) {
|
|
10296
10370
|
let ErrorConstructor = window[val.__subType];
|
|
10297
10371
|
if (typeof ErrorConstructor === "function") {
|
|
10298
10372
|
try {
|
|
@@ -10424,7 +10498,6 @@ function HistoryRouter({
|
|
|
10424
10498
|
);
|
|
10425
10499
|
}
|
|
10426
10500
|
HistoryRouter.displayName = "unstable_HistoryRouter";
|
|
10427
|
-
var ABSOLUTE_URL_REGEX2 = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
|
|
10428
10501
|
var Link = React10.forwardRef(
|
|
10429
10502
|
function LinkWithRef({
|
|
10430
10503
|
onClick,
|
|
@@ -10443,7 +10516,7 @@ var Link = React10.forwardRef(
|
|
|
10443
10516
|
...rest
|
|
10444
10517
|
}, forwardedRef) {
|
|
10445
10518
|
let { basename, navigator, useTransitions } = React10.useContext(NavigationContext);
|
|
10446
|
-
let isAbsolute = typeof to === "string" &&
|
|
10519
|
+
let isAbsolute = typeof to === "string" && ABSOLUTE_URL_REGEX.test(to);
|
|
10447
10520
|
let parsed = parseToInfo(to, basename);
|
|
10448
10521
|
to = parsed.to;
|
|
10449
10522
|
let href = useHref(to, { relative });
|
|
@@ -10590,7 +10663,7 @@ var Form = React10.forwardRef(
|
|
|
10590
10663
|
let submit = useSubmit();
|
|
10591
10664
|
let formAction = useFormAction(action, { relative });
|
|
10592
10665
|
let formMethod = method.toLowerCase() === "get" ? "get" : "post";
|
|
10593
|
-
let isAbsolute = typeof action === "string" &&
|
|
10666
|
+
let isAbsolute = typeof action === "string" && ABSOLUTE_URL_REGEX.test(action);
|
|
10594
10667
|
let submitHandler = (event) => {
|
|
10595
10668
|
onSubmit && onSubmit(event);
|
|
10596
10669
|
if (event.defaultPrevented) return;
|
|
@@ -10672,6 +10745,9 @@ function ScrollRestoration({
|
|
|
10672
10745
|
sessionStorage.removeItem(storageKey2);
|
|
10673
10746
|
}
|
|
10674
10747
|
}).toString();
|
|
10748
|
+
if (props.nonce == null && remixContext?.nonce) {
|
|
10749
|
+
props.nonce = remixContext.nonce;
|
|
10750
|
+
}
|
|
10675
10751
|
return /* @__PURE__ */ React10.createElement(
|
|
10676
10752
|
"script",
|
|
10677
10753
|
{
|
|
@@ -11372,16 +11448,16 @@ function createHref(to) {
|
|
|
11372
11448
|
function encodeLocation(to) {
|
|
11373
11449
|
let href = typeof to === "string" ? to : createPath(to);
|
|
11374
11450
|
href = href.replace(/ $/, "%20");
|
|
11375
|
-
let encoded =
|
|
11451
|
+
let encoded = ABSOLUTE_URL_REGEX.test(href) ? new URL(href) : new URL(href, "http://localhost");
|
|
11376
11452
|
return {
|
|
11377
11453
|
pathname: encoded.pathname,
|
|
11378
11454
|
search: encoded.search,
|
|
11379
11455
|
hash: encoded.hash
|
|
11380
11456
|
};
|
|
11381
11457
|
}
|
|
11382
|
-
var ABSOLUTE_URL_REGEX3 = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
|
|
11383
11458
|
|
|
11384
11459
|
export {
|
|
11460
|
+
PROTOCOL_RELATIVE_URL_REGEX,
|
|
11385
11461
|
Action,
|
|
11386
11462
|
createMemoryHistory,
|
|
11387
11463
|
createBrowserHistory,
|
|
@@ -11411,7 +11487,7 @@ export {
|
|
|
11411
11487
|
createRouter,
|
|
11412
11488
|
createStaticHandler,
|
|
11413
11489
|
getStaticContextFromError,
|
|
11414
|
-
|
|
11490
|
+
hasInvalidProtocol,
|
|
11415
11491
|
isDataWithResponseInit,
|
|
11416
11492
|
isResponse,
|
|
11417
11493
|
isRedirectStatusCode,
|
|
@@ -11493,6 +11569,7 @@ export {
|
|
|
11493
11569
|
createClientRoutes,
|
|
11494
11570
|
shouldHydrateRouteLoader,
|
|
11495
11571
|
URL_LIMIT,
|
|
11572
|
+
getPathsWithAncestors,
|
|
11496
11573
|
getPatchRoutesOnNavigationFunction,
|
|
11497
11574
|
useFogOFWarDiscovery,
|
|
11498
11575
|
getManifestPath,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { m as HTMLFormMethod, n as FormEncType, o as LoaderFunctionArgs, p as MiddlewareEnabled, c as RouterContextProvider, q as AppLoadContext, r as RouteObject, s as History, t as MaybePromise, u as MapRoutePropertiesFunction, v as Action, L as Location, w as DataRouteMatch, x as Submission, y as RouteData, z as DataStrategyFunction, B as PatchRoutesOnNavigationFunction, E as DataRouteObject, I as RouteBranch, J as RouteManifest, U as UIMatch, T as To, K as Path, P as Params, O as InitialEntry, Q as NonIndexRouteObject, V as LazyRouteFunction, W as IndexRouteObject, X as RouteMatch, Y as TrackedPromise } from './data-
|
|
1
|
+
import { m as HTMLFormMethod, n as FormEncType, o as LoaderFunctionArgs, p as MiddlewareEnabled, c as RouterContextProvider, q as AppLoadContext, r as RouteObject, s as History, t as MaybePromise, u as MapRoutePropertiesFunction, v as Action, L as Location, w as DataRouteMatch, x as Submission, y as RouteData, z as DataStrategyFunction, B as PatchRoutesOnNavigationFunction, E as DataRouteObject, I as RouteBranch, J as RouteManifest, U as UIMatch, T as To, K as Path, P as Params, O as InitialEntry, Q as NonIndexRouteObject, V as LazyRouteFunction, W as IndexRouteObject, X as RouteMatch, Y as TrackedPromise } from './data-DEjBmEfD.mjs';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
|
|
4
4
|
type ServerInstrumentation = {
|
|
@@ -838,6 +838,10 @@ interface MemoryRouterOpts {
|
|
|
838
838
|
* in-memory [`History`](https://developer.mozilla.org/en-US/docs/Web/API/History)
|
|
839
839
|
* stack. Useful for non-browser environments without a DOM API.
|
|
840
840
|
*
|
|
841
|
+
* Data Routers should not be held in React state. You should create your router
|
|
842
|
+
* once outside of the React tree and pass it to {@link RouterProvider | `<RouterProvider>`}.
|
|
843
|
+
* You can use `patchRoutesOnNavigation` to add additional routes programmatically.
|
|
844
|
+
*
|
|
841
845
|
* @public
|
|
842
846
|
* @category Data Routers
|
|
843
847
|
* @mode data
|
|
@@ -872,7 +876,9 @@ interface ClientOnErrorFunction {
|
|
|
872
876
|
*/
|
|
873
877
|
interface RouterProviderProps {
|
|
874
878
|
/**
|
|
875
|
-
* The {@link DataRouter} instance to use for navigation and data fetching.
|
|
879
|
+
* The {@link DataRouter} instance to use for navigation and data fetching. The
|
|
880
|
+
* router prop should be a single router instance created outside of the React
|
|
881
|
+
* tree. Avoid creating new routers during React renders/re-renders.
|
|
876
882
|
*/
|
|
877
883
|
router: Router$1;
|
|
878
884
|
/**
|
|
@@ -926,7 +932,9 @@ interface RouterProviderProps {
|
|
|
926
932
|
}
|
|
927
933
|
/**
|
|
928
934
|
* Render the UI for the given {@link DataRouter}. This component should
|
|
929
|
-
* typically be at the top of an app's element tree.
|
|
935
|
+
* typically be at the top of an app's element tree. The router prop should
|
|
936
|
+
* be a single router instance created outside of the React tree. Avoid
|
|
937
|
+
* creating new routers during React renders/re-renders.
|
|
930
938
|
*
|
|
931
939
|
* ```tsx
|
|
932
940
|
* import { createBrowserRouter } from "react-router";
|
|
@@ -1768,4 +1776,4 @@ interface RouteContextObject {
|
|
|
1768
1776
|
}
|
|
1769
1777
|
declare const RouteContext: React.Context<RouteContextObject>;
|
|
1770
1778
|
|
|
1771
|
-
export { createRoutesFromElements as $, AwaitContextProvider as A, type BlockerFunction as B, type ClientInstrumentation as C, type RouteProps as D, type RouterProps as E, type Fetcher as F, type GetScrollPositionFunction as G, type HydrationState as H, type InstrumentRequestHandlerFunction as I, type RoutesProps as J, Await as K, type LayoutRouteProps as L, type MemoryRouterOpts as M, type NavigateOptions as N, type OutletProps as O, type PathRouteProps as P, MemoryRouter as Q, type RouterInit as R, type StaticHandler as S, Navigate as T, Outlet as U, Route as V, Router as W, RouterProvider as X, Routes as Y, createMemoryRouter as Z, createRoutesFromChildren as _, type RouterProviderProps as a, renderMatches as a0, createRouter as a1, DataRouterContext as a2, DataRouterStateContext as a3, FetchersContext as a4, LocationContext as a5, NavigationContext as a6, RouteContext as a7, ViewTransitionContext as a8, hydrationRouteProperties as a9, mapRouteProperties as aa, WithComponentProps as ab, withComponentProps as ac, WithHydrateFallbackProps as ad, withHydrateFallbackProps as ae, WithErrorBoundaryProps as af, withErrorBoundaryProps as ag, type FutureConfig as ah, type CreateStaticHandlerOptions as ai, type ClientOnErrorFunction as b, type Router$1 as c, type NavigationStates as d, type Blocker as e, type RelativeRoutingType as f, type
|
|
1779
|
+
export { createRoutesFromElements as $, AwaitContextProvider as A, type BlockerFunction as B, type ClientInstrumentation as C, type RouteProps as D, type RouterProps as E, type Fetcher as F, type GetScrollPositionFunction as G, type HydrationState as H, type InstrumentRequestHandlerFunction as I, type RoutesProps as J, Await as K, type LayoutRouteProps as L, type MemoryRouterOpts as M, type NavigateOptions as N, type OutletProps as O, type PathRouteProps as P, MemoryRouter as Q, type RouterInit as R, type StaticHandler as S, Navigate as T, Outlet as U, Route as V, Router as W, RouterProvider as X, Routes as Y, createMemoryRouter as Z, createRoutesFromChildren as _, type RouterProviderProps as a, renderMatches as a0, createRouter as a1, DataRouterContext as a2, DataRouterStateContext as a3, FetchersContext as a4, LocationContext as a5, NavigationContext as a6, RouteContext as a7, ViewTransitionContext as a8, hydrationRouteProperties as a9, mapRouteProperties as aa, WithComponentProps as ab, withComponentProps as ac, WithHydrateFallbackProps as ad, withHydrateFallbackProps as ae, WithErrorBoundaryProps as af, withErrorBoundaryProps as ag, type FutureConfig as ah, type CreateStaticHandlerOptions as ai, type ClientOnErrorFunction as b, type Router$1 as c, type NavigationStates as d, type Blocker as e, type RelativeRoutingType as f, type GetScrollRestorationKeyFunction as g, type StaticHandlerContext as h, type Navigation as i, type RouterState as j, type RouterSubscriber as k, type RouterNavigateOptions as l, type RouterFetchOptions as m, type RevalidationState as n, type ServerInstrumentation as o, type InstrumentRouterFunction as p, type InstrumentRouteFunction as q, type InstrumentationHandlerResult as r, IDLE_NAVIGATION as s, IDLE_FETCHER as t, IDLE_BLOCKER as u, type Navigator as v, type AwaitProps as w, type IndexRouteProps as x, type MemoryRouterProps as y, type NavigateProps as z };
|
|
@@ -961,6 +961,8 @@ interface RouteMeta<RouteObjectType extends RouteObject = RouteObject> {
|
|
|
961
961
|
caseSensitive: boolean;
|
|
962
962
|
childrenIndex: number;
|
|
963
963
|
route: RouteObjectType;
|
|
964
|
+
matcher?: RegExp;
|
|
965
|
+
compiledParams?: CompiledPathParam[];
|
|
964
966
|
}
|
|
965
967
|
/**
|
|
966
968
|
* @private
|
|
@@ -1045,6 +1047,10 @@ interface PathMatch<ParamKey extends string = string> {
|
|
|
1045
1047
|
* or `null` if it does not match.
|
|
1046
1048
|
*/
|
|
1047
1049
|
declare function matchPath<Path extends string>(pattern: PathPattern<Path> | Path, pathname: string): PathMatch<ParamParseKey<Path>> | null;
|
|
1050
|
+
type CompiledPathParam = {
|
|
1051
|
+
paramName: string;
|
|
1052
|
+
isOptional?: boolean;
|
|
1053
|
+
};
|
|
1048
1054
|
/**
|
|
1049
1055
|
* Returns a resolved {@link Path} object relative to the given pathname.
|
|
1050
1056
|
*
|
|
@@ -1332,7 +1338,9 @@ interface PageLinkDescriptor extends Omit<HtmlLinkDescriptor, "href" | "rel" | "
|
|
|
1332
1338
|
/**
|
|
1333
1339
|
* A [`nonce`](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/nonce)
|
|
1334
1340
|
* attribute to render on the [`<link>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link)
|
|
1335
|
-
* element
|
|
1341
|
+
* element. If not provided in Framework Mode, it will default to any
|
|
1342
|
+
* {@link ServerRouter | `<ServerRouter nonce>`} prop.
|
|
1343
|
+
|
|
1336
1344
|
*/
|
|
1337
1345
|
nonce?: string | undefined;
|
|
1338
1346
|
/**
|
|
@@ -961,6 +961,8 @@ interface RouteMeta<RouteObjectType extends RouteObject = RouteObject> {
|
|
|
961
961
|
caseSensitive: boolean;
|
|
962
962
|
childrenIndex: number;
|
|
963
963
|
route: RouteObjectType;
|
|
964
|
+
matcher?: RegExp;
|
|
965
|
+
compiledParams?: CompiledPathParam[];
|
|
964
966
|
}
|
|
965
967
|
/**
|
|
966
968
|
* @private
|
|
@@ -1045,6 +1047,10 @@ interface PathMatch<ParamKey extends string = string> {
|
|
|
1045
1047
|
* or `null` if it does not match.
|
|
1046
1048
|
*/
|
|
1047
1049
|
declare function matchPath<Path extends string>(pattern: PathPattern<Path> | Path, pathname: string): PathMatch<ParamParseKey<Path>> | null;
|
|
1050
|
+
type CompiledPathParam = {
|
|
1051
|
+
paramName: string;
|
|
1052
|
+
isOptional?: boolean;
|
|
1053
|
+
};
|
|
1048
1054
|
/**
|
|
1049
1055
|
* Returns a resolved {@link Path} object relative to the given pathname.
|
|
1050
1056
|
*
|
|
@@ -1332,7 +1338,9 @@ interface PageLinkDescriptor extends Omit<HtmlLinkDescriptor, "href" | "rel" | "
|
|
|
1332
1338
|
/**
|
|
1333
1339
|
* A [`nonce`](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/nonce)
|
|
1334
1340
|
* attribute to render on the [`<link>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link)
|
|
1335
|
-
* element
|
|
1341
|
+
* element. If not provided in Framework Mode, it will default to any
|
|
1342
|
+
* {@link ServerRouter | `<ServerRouter nonce>`} prop.
|
|
1343
|
+
|
|
1336
1344
|
*/
|
|
1337
1345
|
nonce?: string | undefined;
|
|
1338
1346
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { a as RouterProviderProps$1, R as RouterInit, C as ClientInstrumentation, b as ClientOnErrorFunction } from './context-
|
|
3
|
-
export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-
|
|
4
|
-
import './data-
|
|
2
|
+
import { a as RouterProviderProps$1, R as RouterInit, C as ClientInstrumentation, b as ClientOnErrorFunction } from './context-CeD5LmaF.mjs';
|
|
3
|
+
export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-DBmQ1yAR.mjs';
|
|
4
|
+
import './data-DEjBmEfD.mjs';
|
|
5
5
|
|
|
6
6
|
type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
|
|
7
7
|
declare function RouterProvider(props: RouterProviderProps): React.JSX.Element;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { RouterProviderProps as RouterProviderProps$1, RouterInit, ClientOnErrorFunction } from 'react-router';
|
|
3
|
-
import { C as ClientInstrumentation } from './instrumentation-
|
|
4
|
-
export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-
|
|
5
|
-
import './data-
|
|
3
|
+
import { C as ClientInstrumentation } from './instrumentation-Dkmpzd13.js';
|
|
4
|
+
export { D as unstable_DecodeActionFunction, a as unstable_DecodeFormStateFunction, b as unstable_DecodeReplyFunction, R as unstable_RSCHydratedRouter, d as unstable_RSCManifestPayload, e as unstable_RSCPayload, f as unstable_RSCRenderPayload, c as unstable_createCallServer } from './browser-B2PdsXXH.js';
|
|
5
|
+
import './data-CjO11-hU.js';
|
|
6
6
|
|
|
7
7
|
type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
|
|
8
8
|
declare function RouterProvider(props: RouterProviderProps): React.JSX.Element;
|