react-router 7.18.5 → 7.18.6
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 +14 -0
- package/dist/{production/chunk-K3NA4NUH.js → development/chunk-3QTLHDUO.js} +7 -7
- package/dist/{production/chunk-IAM5GYT3.mjs → development/chunk-E2PF4K4Z.mjs} +14 -5
- package/dist/development/{chunk-NDF5KBLP.js → chunk-QM7ETCUK.js} +109 -104
- package/dist/development/{chunk-2ZBLYC7V.js → chunk-S47XUPN5.js} +105 -65
- package/dist/development/{chunk-6KYCQHYJ.mjs → chunk-YDNE64FV.mjs} +107 -63
- package/dist/development/dom-export.js +37 -35
- package/dist/development/dom-export.mjs +6 -4
- 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.js +72 -3
- package/dist/development/index-react-server.mjs +72 -3
- package/dist/development/index.d.mts +1 -1
- package/dist/development/index.d.ts +1 -1
- package/dist/development/index.js +111 -102
- package/dist/development/index.mjs +3 -3
- package/dist/development/lib/types/internal.js +1 -1
- package/dist/development/lib/types/internal.mjs +1 -1
- package/dist/production/{chunk-75HN637G.js → chunk-2WUBOUFU.js} +109 -104
- package/dist/{development/chunk-IFHLIXZW.js → production/chunk-3IBQ4CTZ.js} +7 -7
- package/dist/production/{chunk-HNBICOIU.js → chunk-AC65NKOP.js} +105 -65
- package/dist/production/{chunk-7RTFRKQW.mjs → chunk-HEAXLYUI.mjs} +107 -63
- package/dist/{development/chunk-JAHXRPFV.mjs → production/chunk-JRCXCPLA.mjs} +14 -5
- package/dist/production/dom-export.js +37 -35
- package/dist/production/dom-export.mjs +6 -4
- 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.js +72 -3
- package/dist/production/index-react-server.mjs +72 -3
- package/dist/production/index.d.mts +1 -1
- package/dist/production/index.d.ts +1 -1
- package/dist/production/index.js +111 -102
- package/dist/production/index.mjs +3 -3
- package/dist/production/lib/types/internal.js +1 -1
- package/dist/production/lib/types/internal.mjs +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v7.18.
|
|
2
|
+
* react-router v7.18.6
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -386,6 +386,67 @@ function createBrowserURLImpl(windowImpl, to, isAbsolute = false) {
|
|
|
386
386
|
return new URL(href, base);
|
|
387
387
|
}
|
|
388
388
|
|
|
389
|
+
// lib/router/navigation.ts
|
|
390
|
+
var DEFAULT_NAVIGATION_URL = new URL("http://localhost");
|
|
391
|
+
function getNavigatorCurrentUrl(navigator) {
|
|
392
|
+
if (navigator.createURL) {
|
|
393
|
+
return navigator.createURL("/");
|
|
394
|
+
}
|
|
395
|
+
try {
|
|
396
|
+
return new URL(navigator.createHref("/"), DEFAULT_NAVIGATION_URL);
|
|
397
|
+
} catch {
|
|
398
|
+
return DEFAULT_NAVIGATION_URL;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
function isSameOrigin(a, b) {
|
|
402
|
+
return a.origin === b.origin && (a.origin !== "null" || a.protocol === b.protocol && a.host === b.host);
|
|
403
|
+
}
|
|
404
|
+
function isExplicitUrl(destination, target) {
|
|
405
|
+
if (destination.startsWith("//")) {
|
|
406
|
+
return true;
|
|
407
|
+
}
|
|
408
|
+
let protocol = target.protocol.toLowerCase();
|
|
409
|
+
if (!destination.toLowerCase().startsWith(protocol)) {
|
|
410
|
+
return false;
|
|
411
|
+
}
|
|
412
|
+
return target.host === "" || destination.slice(protocol.length).startsWith("//");
|
|
413
|
+
}
|
|
414
|
+
function validateDocumentNavigationTarget(destination) {
|
|
415
|
+
let normalized = destination.replace(/[\t\n\r]/g, "");
|
|
416
|
+
let start = 0;
|
|
417
|
+
while (normalized.charCodeAt(start) <= 32) start++;
|
|
418
|
+
normalized = normalized.slice(start);
|
|
419
|
+
if (!ABSOLUTE_URL_REGEX.test(normalized)) return;
|
|
420
|
+
let target;
|
|
421
|
+
try {
|
|
422
|
+
target = new URL(destination, DEFAULT_NAVIGATION_URL);
|
|
423
|
+
} catch {
|
|
424
|
+
return;
|
|
425
|
+
}
|
|
426
|
+
if (!isExplicitUrl(destination, target)) {
|
|
427
|
+
throw new Error("External navigation is not allowed");
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
function validateNavigationTarget(original, resolved, currentUrl, externalPolicy) {
|
|
431
|
+
let originalUrl = null;
|
|
432
|
+
try {
|
|
433
|
+
originalUrl = original == null ? null : new URL(original, currentUrl);
|
|
434
|
+
} catch {
|
|
435
|
+
}
|
|
436
|
+
let resolvedUrl = new URL(resolved, currentUrl);
|
|
437
|
+
let originalIsExternal = originalUrl != null && !isSameOrigin(originalUrl, currentUrl);
|
|
438
|
+
let resolvedIsExternal = !isSameOrigin(resolvedUrl, currentUrl);
|
|
439
|
+
if (externalPolicy === "reject") {
|
|
440
|
+
if (originalIsExternal || resolvedIsExternal) {
|
|
441
|
+
throw new Error("External navigation is not allowed");
|
|
442
|
+
}
|
|
443
|
+
} else if (resolvedIsExternal) {
|
|
444
|
+
if (originalUrl == null || !isExplicitUrl(original, originalUrl) || !isSameOrigin(originalUrl, resolvedUrl)) {
|
|
445
|
+
throw new Error("External navigation is not allowed");
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
|
|
389
450
|
// lib/router/utils.ts
|
|
390
451
|
function createContext(defaultValue) {
|
|
391
452
|
return { defaultValue };
|
|
@@ -767,7 +828,12 @@ function generatePath(originalPath, params = {}) {
|
|
|
767
828
|
}
|
|
768
829
|
return segment.replace(/\?$/g, "");
|
|
769
830
|
}).filter((segment) => !!segment);
|
|
770
|
-
|
|
831
|
+
let result = (prefix + segments.join("/")).replace(/^[\\/]{2,}/, "/");
|
|
832
|
+
if (!prefix && (path.startsWith(":") || path === "*")) {
|
|
833
|
+
result = result.replace(/^([a-z][a-z0-9+.-]*):/i, "$1%3A");
|
|
834
|
+
}
|
|
835
|
+
validateDocumentNavigationTarget(result);
|
|
836
|
+
return result;
|
|
771
837
|
}
|
|
772
838
|
function matchPath(pattern, pathname) {
|
|
773
839
|
if (typeof pattern === "string") {
|
|
@@ -995,6 +1061,7 @@ function data(data2, init) {
|
|
|
995
1061
|
);
|
|
996
1062
|
}
|
|
997
1063
|
var redirect = (url, init = 302) => {
|
|
1064
|
+
validateDocumentNavigationTarget(url);
|
|
998
1065
|
let responseInit = init;
|
|
999
1066
|
if (typeof responseInit === "number") {
|
|
1000
1067
|
responseInit = { status: responseInit };
|
|
@@ -1350,51 +1417,6 @@ function isPlainObject(thing) {
|
|
|
1350
1417
|
return proto === Object.prototype || proto === null || Object.getOwnPropertyNames(proto).sort().join("\0") === objectProtoNames;
|
|
1351
1418
|
}
|
|
1352
1419
|
|
|
1353
|
-
// lib/router/navigation.ts
|
|
1354
|
-
var DEFAULT_NAVIGATION_URL = new URL("http://localhost");
|
|
1355
|
-
function getNavigatorCurrentUrl(navigator) {
|
|
1356
|
-
if (navigator.createURL) {
|
|
1357
|
-
return navigator.createURL("/");
|
|
1358
|
-
}
|
|
1359
|
-
try {
|
|
1360
|
-
return new URL(navigator.createHref("/"), DEFAULT_NAVIGATION_URL);
|
|
1361
|
-
} catch {
|
|
1362
|
-
return DEFAULT_NAVIGATION_URL;
|
|
1363
|
-
}
|
|
1364
|
-
}
|
|
1365
|
-
function isSameOrigin(a, b) {
|
|
1366
|
-
return a.origin === b.origin && (a.origin !== "null" || a.protocol === b.protocol && a.host === b.host);
|
|
1367
|
-
}
|
|
1368
|
-
function isExplicitUrl(destination, target) {
|
|
1369
|
-
if (destination.startsWith("//")) {
|
|
1370
|
-
return true;
|
|
1371
|
-
}
|
|
1372
|
-
let protocol = target.protocol.toLowerCase();
|
|
1373
|
-
if (!destination.toLowerCase().startsWith(protocol)) {
|
|
1374
|
-
return false;
|
|
1375
|
-
}
|
|
1376
|
-
return target.host === "" || destination.slice(protocol.length).startsWith("//");
|
|
1377
|
-
}
|
|
1378
|
-
function validateNavigationTarget(original, resolved, currentUrl, externalPolicy) {
|
|
1379
|
-
let originalUrl = null;
|
|
1380
|
-
try {
|
|
1381
|
-
originalUrl = original == null ? null : new URL(original, currentUrl);
|
|
1382
|
-
} catch {
|
|
1383
|
-
}
|
|
1384
|
-
let resolvedUrl = new URL(resolved, currentUrl);
|
|
1385
|
-
let originalIsExternal = originalUrl != null && !isSameOrigin(originalUrl, currentUrl);
|
|
1386
|
-
let resolvedIsExternal = !isSameOrigin(resolvedUrl, currentUrl);
|
|
1387
|
-
if (externalPolicy === "reject") {
|
|
1388
|
-
if (originalIsExternal || resolvedIsExternal) {
|
|
1389
|
-
throw new Error("External navigation is not allowed");
|
|
1390
|
-
}
|
|
1391
|
-
} else if (resolvedIsExternal) {
|
|
1392
|
-
if (originalUrl == null || !isExplicitUrl(original, originalUrl) || !isSameOrigin(originalUrl, resolvedUrl)) {
|
|
1393
|
-
throw new Error("External navigation is not allowed");
|
|
1394
|
-
}
|
|
1395
|
-
}
|
|
1396
|
-
}
|
|
1397
|
-
|
|
1398
1420
|
// lib/router/router.ts
|
|
1399
1421
|
var validMutationMethodsArr = [
|
|
1400
1422
|
"POST",
|
|
@@ -2527,6 +2549,12 @@ function createRouter(init) {
|
|
|
2527
2549
|
routeId,
|
|
2528
2550
|
opts?.relative
|
|
2529
2551
|
);
|
|
2552
|
+
validateNavigationTarget(
|
|
2553
|
+
null,
|
|
2554
|
+
normalizedPath,
|
|
2555
|
+
init.history.createURL("/"),
|
|
2556
|
+
"reject"
|
|
2557
|
+
);
|
|
2530
2558
|
let matches = matchRoutesImpl(
|
|
2531
2559
|
routesToUse,
|
|
2532
2560
|
normalizedPath,
|
|
@@ -5297,6 +5325,12 @@ function normalizeRelativeRoutingRedirectResponse(response, request, routeId, ma
|
|
|
5297
5325
|
location,
|
|
5298
5326
|
"Redirects returned/thrown from loaders/actions must have a Location header"
|
|
5299
5327
|
);
|
|
5328
|
+
validateNavigationTarget(
|
|
5329
|
+
location,
|
|
5330
|
+
location,
|
|
5331
|
+
new URL(request.url),
|
|
5332
|
+
"allow-explicit"
|
|
5333
|
+
);
|
|
5300
5334
|
if (!isAbsoluteUrl(location)) {
|
|
5301
5335
|
let trimmedMatches = matches.slice(
|
|
5302
5336
|
0,
|
|
@@ -8126,20 +8160,22 @@ function encode(input, options) {
|
|
|
8126
8160
|
};
|
|
8127
8161
|
const textEncoder = new TextEncoder();
|
|
8128
8162
|
let lastSentIndex = 0;
|
|
8163
|
+
let cancelled = false;
|
|
8129
8164
|
const readable = new ReadableStream({
|
|
8130
8165
|
async start(controller) {
|
|
8166
|
+
const enqueue = (chunk) => {
|
|
8167
|
+
if (!cancelled) controller.enqueue(chunk);
|
|
8168
|
+
};
|
|
8131
8169
|
const id = await flatten.call(encoder, input);
|
|
8132
8170
|
if (Array.isArray(id)) {
|
|
8133
8171
|
throw new Error("This should never happen");
|
|
8134
8172
|
}
|
|
8135
8173
|
if (id < 0) {
|
|
8136
|
-
|
|
8174
|
+
enqueue(textEncoder.encode(`${id}
|
|
8137
8175
|
`));
|
|
8138
8176
|
} else {
|
|
8139
|
-
|
|
8140
|
-
|
|
8141
|
-
`)
|
|
8142
|
-
);
|
|
8177
|
+
enqueue(textEncoder.encode(`[${encoder.stringified.join(",")}]
|
|
8178
|
+
`));
|
|
8143
8179
|
lastSentIndex = encoder.stringified.length - 1;
|
|
8144
8180
|
}
|
|
8145
8181
|
const seenPromises = /* @__PURE__ */ new WeakSet();
|
|
@@ -8174,7 +8210,7 @@ function encode(input, options) {
|
|
|
8174
8210
|
processingChain = processingChain.then(async () => {
|
|
8175
8211
|
const id2 = await flatten.call(encoder, resolved);
|
|
8176
8212
|
if (Array.isArray(id2)) {
|
|
8177
|
-
|
|
8213
|
+
enqueue(
|
|
8178
8214
|
textEncoder.encode(
|
|
8179
8215
|
`${TYPE_PROMISE}${deferredId}:[["${TYPE_PREVIOUS_RESOLVED}",${id2[0]}]]
|
|
8180
8216
|
`
|
|
@@ -8183,7 +8219,7 @@ function encode(input, options) {
|
|
|
8183
8219
|
encoder.index++;
|
|
8184
8220
|
lastSentIndex++;
|
|
8185
8221
|
} else if (id2 < 0) {
|
|
8186
|
-
|
|
8222
|
+
enqueue(
|
|
8187
8223
|
textEncoder.encode(
|
|
8188
8224
|
`${TYPE_PROMISE}${deferredId}:${id2}
|
|
8189
8225
|
`
|
|
@@ -8191,7 +8227,7 @@ function encode(input, options) {
|
|
|
8191
8227
|
);
|
|
8192
8228
|
} else {
|
|
8193
8229
|
const values = encoder.stringified.slice(lastSentIndex + 1).join(",");
|
|
8194
|
-
|
|
8230
|
+
enqueue(
|
|
8195
8231
|
textEncoder.encode(
|
|
8196
8232
|
`${TYPE_PROMISE}${deferredId}:[${values}]
|
|
8197
8233
|
`
|
|
@@ -8209,7 +8245,7 @@ function encode(input, options) {
|
|
|
8209
8245
|
}
|
|
8210
8246
|
const id2 = await flatten.call(encoder, reason);
|
|
8211
8247
|
if (Array.isArray(id2)) {
|
|
8212
|
-
|
|
8248
|
+
enqueue(
|
|
8213
8249
|
textEncoder.encode(
|
|
8214
8250
|
`${TYPE_ERROR}${deferredId}:[["${TYPE_PREVIOUS_RESOLVED}",${id2[0]}]]
|
|
8215
8251
|
`
|
|
@@ -8218,7 +8254,7 @@ function encode(input, options) {
|
|
|
8218
8254
|
encoder.index++;
|
|
8219
8255
|
lastSentIndex++;
|
|
8220
8256
|
} else if (id2 < 0) {
|
|
8221
|
-
|
|
8257
|
+
enqueue(
|
|
8222
8258
|
textEncoder.encode(
|
|
8223
8259
|
`${TYPE_ERROR}${deferredId}:${id2}
|
|
8224
8260
|
`
|
|
@@ -8226,7 +8262,7 @@ function encode(input, options) {
|
|
|
8226
8262
|
);
|
|
8227
8263
|
} else {
|
|
8228
8264
|
const values = encoder.stringified.slice(lastSentIndex + 1).join(",");
|
|
8229
|
-
|
|
8265
|
+
enqueue(
|
|
8230
8266
|
textEncoder.encode(
|
|
8231
8267
|
`${TYPE_ERROR}${deferredId}:[${values}]
|
|
8232
8268
|
`
|
|
@@ -8248,8 +8284,11 @@ function encode(input, options) {
|
|
|
8248
8284
|
}
|
|
8249
8285
|
await Promise.all(Object.values(encoder.deferred));
|
|
8250
8286
|
await processingChain;
|
|
8251
|
-
controller.close();
|
|
8287
|
+
if (!cancelled) controller.close();
|
|
8252
8288
|
onComplete?.();
|
|
8289
|
+
},
|
|
8290
|
+
cancel() {
|
|
8291
|
+
cancelled = true;
|
|
8253
8292
|
}
|
|
8254
8293
|
});
|
|
8255
8294
|
return readable;
|
|
@@ -10433,7 +10472,7 @@ var isBrowser2 = typeof window !== "undefined" && typeof window.document !== "un
|
|
|
10433
10472
|
try {
|
|
10434
10473
|
if (isBrowser2) {
|
|
10435
10474
|
window.__reactRouterVersion = // @ts-expect-error
|
|
10436
|
-
"7.18.
|
|
10475
|
+
"7.18.6";
|
|
10437
10476
|
}
|
|
10438
10477
|
} catch (e) {
|
|
10439
10478
|
}
|
|
@@ -10682,6 +10721,8 @@ var Link = React10.forwardRef(
|
|
|
10682
10721
|
}
|
|
10683
10722
|
}
|
|
10684
10723
|
let isSpaLink = !(parsed.isExternal || reloadDocument);
|
|
10724
|
+
let renderedHref = (isSpaLink ? maskedHref : void 0) || parsed.absoluteURL || href;
|
|
10725
|
+
validateDocumentNavigationTarget(renderedHref);
|
|
10685
10726
|
let link = (
|
|
10686
10727
|
// eslint-disable-next-line jsx-a11y/anchor-has-content
|
|
10687
10728
|
/* @__PURE__ */ React10.createElement(
|
|
@@ -10689,7 +10730,7 @@ var Link = React10.forwardRef(
|
|
|
10689
10730
|
{
|
|
10690
10731
|
...rest,
|
|
10691
10732
|
...prefetchHandlers,
|
|
10692
|
-
href:
|
|
10733
|
+
href: renderedHref,
|
|
10693
10734
|
onClick: isSpaLink ? handleClick : onClick,
|
|
10694
10735
|
ref: mergeRefs(forwardedRef, prefetchRef),
|
|
10695
10736
|
target,
|
|
@@ -11055,7 +11096,9 @@ function useFormAction(action, { relative } = {}) {
|
|
|
11055
11096
|
if (basename !== "/") {
|
|
11056
11097
|
path.pathname = path.pathname === "/" ? basename : joinPaths([basename, path.pathname]);
|
|
11057
11098
|
}
|
|
11058
|
-
|
|
11099
|
+
let formAction = createPath(path);
|
|
11100
|
+
validateDocumentNavigationTarget(formAction);
|
|
11101
|
+
return formAction;
|
|
11059
11102
|
}
|
|
11060
11103
|
function useFetcher({
|
|
11061
11104
|
key
|
|
@@ -11591,6 +11634,8 @@ export {
|
|
|
11591
11634
|
invariant,
|
|
11592
11635
|
createPath,
|
|
11593
11636
|
parsePath,
|
|
11637
|
+
validateDocumentNavigationTarget,
|
|
11638
|
+
validateNavigationTarget,
|
|
11594
11639
|
createContext,
|
|
11595
11640
|
RouterContextProvider,
|
|
11596
11641
|
convertRoutesToDataRoutes,
|
|
@@ -11607,7 +11652,6 @@ export {
|
|
|
11607
11652
|
ErrorResponseImpl,
|
|
11608
11653
|
isRouteErrorResponse,
|
|
11609
11654
|
instrumentHandler,
|
|
11610
|
-
validateNavigationTarget,
|
|
11611
11655
|
IDLE_NAVIGATION,
|
|
11612
11656
|
IDLE_FETCHER,
|
|
11613
11657
|
IDLE_BLOCKER,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v7.18.
|
|
2
|
+
* react-router v7.18.6
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -54,11 +54,12 @@ import {
|
|
|
54
54
|
shouldUseInitialRouteDiscovery,
|
|
55
55
|
stripBasename,
|
|
56
56
|
useRouteError,
|
|
57
|
+
validateDocumentNavigationTarget,
|
|
57
58
|
warnOnce,
|
|
58
59
|
withComponentProps,
|
|
59
60
|
withErrorBoundaryProps,
|
|
60
61
|
withHydrateFallbackProps
|
|
61
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-HEAXLYUI.mjs";
|
|
62
63
|
|
|
63
64
|
// lib/dom/ssr/server.tsx
|
|
64
65
|
import * as React from "react";
|
|
@@ -887,7 +888,9 @@ async function singleFetchAction(build, serverMode, staticHandler, request, hand
|
|
|
887
888
|
return handleQueryError(error);
|
|
888
889
|
}
|
|
889
890
|
} : void 0,
|
|
890
|
-
|
|
891
|
+
// Normalize the original request because handlerRequest may already have
|
|
892
|
+
// its .data suffix removed when v8_passThroughRequests is disabled.
|
|
893
|
+
normalizePath: () => getNormalizedPath(request, build.basename, build.future)
|
|
891
894
|
});
|
|
892
895
|
return handleQueryResult(result);
|
|
893
896
|
} catch (error) {
|
|
@@ -952,7 +955,9 @@ async function singleFetchLoaders(build, serverMode, staticHandler, request, han
|
|
|
952
955
|
return handleQueryError(error);
|
|
953
956
|
}
|
|
954
957
|
} : void 0,
|
|
955
|
-
|
|
958
|
+
// Normalize the original request because handlerRequest may already have
|
|
959
|
+
// its .data suffix removed when v8_passThroughRequests is disabled.
|
|
960
|
+
normalizePath: () => getNormalizedPath(request, build.basename, build.future)
|
|
956
961
|
});
|
|
957
962
|
return handleQueryResult(result);
|
|
958
963
|
} catch (error) {
|
|
@@ -1307,6 +1312,8 @@ function derive(build, mode) {
|
|
|
1307
1312
|
);
|
|
1308
1313
|
}
|
|
1309
1314
|
if (request.method === "HEAD") {
|
|
1315
|
+
response.body?.cancel().catch(() => {
|
|
1316
|
+
});
|
|
1310
1317
|
return new Response(null, {
|
|
1311
1318
|
headers: response.headers,
|
|
1312
1319
|
status: response.status,
|
|
@@ -1819,7 +1826,9 @@ function href(path, ...args) {
|
|
|
1819
1826
|
result += "/" + value;
|
|
1820
1827
|
}
|
|
1821
1828
|
}
|
|
1822
|
-
|
|
1829
|
+
result = result.replace(/^[\\/]{2,}/, "/") || "/";
|
|
1830
|
+
validateDocumentNavigationTarget(result);
|
|
1831
|
+
return result;
|
|
1823
1832
|
}
|
|
1824
1833
|
function trimTrailingSplat(path) {
|
|
1825
1834
|
let i = path.length - 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.18.
|
|
2
|
+
* react-router v7.18.6
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _chunk3IBQ4CTZjs = require('./chunk-3IBQ4CTZ.js');
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
@@ -38,7 +38,7 @@ var _chunkK3NA4NUHjs = require('./chunk-K3NA4NUH.js');
|
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
|
|
41
|
-
var
|
|
41
|
+
var _chunkAC65NKOPjs = require('./chunk-AC65NKOP.js');
|
|
42
42
|
|
|
43
43
|
// lib/dom-export/dom-router-provider.tsx
|
|
44
44
|
var _react = require('react'); var React = _interopRequireWildcard(_react); var React2 = _interopRequireWildcard(_react); var React3 = _interopRequireWildcard(_react);
|
|
@@ -209,12 +209,14 @@ function HydratedRouter(props) {
|
|
|
209
209
|
);
|
|
210
210
|
React2.useEffect(() => {
|
|
211
211
|
if (process.env.NODE_ENV === "development") {
|
|
212
|
-
|
|
212
|
+
React2.startTransition(() => {
|
|
213
|
+
setCriticalCss(void 0);
|
|
214
|
+
});
|
|
213
215
|
}
|
|
214
216
|
}, []);
|
|
215
217
|
React2.useEffect(() => {
|
|
216
218
|
if (process.env.NODE_ENV === "development" && criticalCss === void 0) {
|
|
217
|
-
document.querySelectorAll(`[${
|
|
219
|
+
document.querySelectorAll(`[${_chunkAC65NKOPjs.CRITICAL_CSS_DATA_ATTRIBUTE}]`).forEach((element) => element.remove());
|
|
218
220
|
}
|
|
219
221
|
}, [criticalCss]);
|
|
220
222
|
let [location2, setLocation] = React2.useState(router.state.location);
|
|
@@ -308,14 +310,14 @@ function createCallServer({
|
|
|
308
310
|
Promise.resolve(payloadPromise).then(async (payload) => {
|
|
309
311
|
if (payload.type === "redirect") {
|
|
310
312
|
let location2 = normalizeRedirectLocation(payload.location);
|
|
311
|
-
|
|
313
|
+
_chunkAC65NKOPjs.validateNavigationTarget.call(void 0,
|
|
312
314
|
payload.location,
|
|
313
315
|
location2,
|
|
314
316
|
new URL(window.location.href),
|
|
315
317
|
"allow-explicit"
|
|
316
318
|
);
|
|
317
319
|
if (payload.reload || isExternalLocation(location2)) {
|
|
318
|
-
if (
|
|
320
|
+
if (_chunkAC65NKOPjs.hasInvalidProtocol.call(void 0, location2)) {
|
|
319
321
|
throw new Error("Invalid redirect location");
|
|
320
322
|
}
|
|
321
323
|
window.location.href = location2;
|
|
@@ -335,14 +337,14 @@ function createCallServer({
|
|
|
335
337
|
if (rerender && landedActionId < actionId && globalVar.__routerActionID <= actionId) {
|
|
336
338
|
if (rerender.type === "redirect") {
|
|
337
339
|
let location2 = normalizeRedirectLocation(rerender.location);
|
|
338
|
-
|
|
340
|
+
_chunkAC65NKOPjs.validateNavigationTarget.call(void 0,
|
|
339
341
|
rerender.location,
|
|
340
342
|
location2,
|
|
341
343
|
new URL(window.location.href),
|
|
342
344
|
"allow-explicit"
|
|
343
345
|
);
|
|
344
346
|
if (rerender.reload || isExternalLocation(location2)) {
|
|
345
|
-
if (
|
|
347
|
+
if (_chunkAC65NKOPjs.hasInvalidProtocol.call(void 0, location2)) {
|
|
346
348
|
throw new Error("Invalid redirect location");
|
|
347
349
|
}
|
|
348
350
|
window.location.href = location2;
|
|
@@ -407,7 +409,7 @@ function createRouterFromPayload({
|
|
|
407
409
|
};
|
|
408
410
|
if (payload.type !== "render") throw new Error("Invalid payload type");
|
|
409
411
|
globalVar.__reactRouterRouteModules = _nullishCoalesce(globalVar.__reactRouterRouteModules, () => ( {}));
|
|
410
|
-
|
|
412
|
+
_chunk3IBQ4CTZjs.populateRSCRouteModules.call(void 0, globalVar.__reactRouterRouteModules, payload.matches);
|
|
411
413
|
let routes = payload.matches.reduceRight((previous, match) => {
|
|
412
414
|
const route = createRouteFromServerManifest(
|
|
413
415
|
match,
|
|
@@ -421,12 +423,12 @@ function createRouterFromPayload({
|
|
|
421
423
|
return [route];
|
|
422
424
|
}, []);
|
|
423
425
|
let applyPatchesPromise;
|
|
424
|
-
globalVar.__reactRouterDataRouter =
|
|
426
|
+
globalVar.__reactRouterDataRouter = _chunkAC65NKOPjs.createRouter.call(void 0, {
|
|
425
427
|
routes,
|
|
426
428
|
getContext,
|
|
427
429
|
basename: payload.basename,
|
|
428
|
-
history:
|
|
429
|
-
hydrationData:
|
|
430
|
+
history: _chunkAC65NKOPjs.createBrowserHistory.call(void 0, ),
|
|
431
|
+
hydrationData: _chunk3IBQ4CTZjs.getHydrationData.call(void 0, {
|
|
430
432
|
state: {
|
|
431
433
|
loaderData: payload.loaderData,
|
|
432
434
|
actionData: payload.actionData,
|
|
@@ -435,7 +437,7 @@ function createRouterFromPayload({
|
|
|
435
437
|
routes,
|
|
436
438
|
getRouteInfo: (routeId) => {
|
|
437
439
|
let match = payload.matches.find((m) => m.id === routeId);
|
|
438
|
-
|
|
440
|
+
_chunkAC65NKOPjs.invariant.call(void 0, match, "Route not found in payload");
|
|
439
441
|
return {
|
|
440
442
|
clientLoader: match.clientLoader,
|
|
441
443
|
hasLoader: match.hasLoader,
|
|
@@ -550,9 +552,9 @@ function createRouterFromPayload({
|
|
|
550
552
|
routeModules: globalVar.__reactRouterRouteModules
|
|
551
553
|
};
|
|
552
554
|
}
|
|
553
|
-
var renderedRoutesContext =
|
|
555
|
+
var renderedRoutesContext = _chunkAC65NKOPjs.createContext.call(void 0, );
|
|
554
556
|
function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, createFromReadableStream, fetchImplementation) {
|
|
555
|
-
let dataStrategy =
|
|
557
|
+
let dataStrategy = _chunkAC65NKOPjs.getSingleFetchDataStrategyImpl.call(void 0,
|
|
556
558
|
getRouter,
|
|
557
559
|
(match) => {
|
|
558
560
|
let M = match;
|
|
@@ -609,20 +611,20 @@ function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, createFromReada
|
|
|
609
611
|
function getFetchAndDecodeViaRSC(createFromReadableStream, fetchImplementation) {
|
|
610
612
|
return async (args, basename, trailingSlashAware, targetRoutes) => {
|
|
611
613
|
let { request, context } = args;
|
|
612
|
-
let url =
|
|
614
|
+
let url = _chunkAC65NKOPjs.singleFetchUrl.call(void 0, request.url, basename, trailingSlashAware, "rsc");
|
|
613
615
|
if (request.method === "GET") {
|
|
614
|
-
url =
|
|
616
|
+
url = _chunkAC65NKOPjs.stripIndexParam.call(void 0, url);
|
|
615
617
|
if (targetRoutes) {
|
|
616
618
|
url.searchParams.set("_routes", targetRoutes.join(","));
|
|
617
619
|
}
|
|
618
620
|
}
|
|
619
621
|
let res = await fetchImplementation(
|
|
620
|
-
new Request(url, await
|
|
622
|
+
new Request(url, await _chunkAC65NKOPjs.createRequestInit.call(void 0, request))
|
|
621
623
|
);
|
|
622
624
|
if (res.status >= 400 && !res.headers.has("X-Remix-Response")) {
|
|
623
|
-
throw new (0,
|
|
625
|
+
throw new (0, _chunkAC65NKOPjs.ErrorResponseImpl)(res.status, res.statusText, await res.text());
|
|
624
626
|
}
|
|
625
|
-
|
|
627
|
+
_chunkAC65NKOPjs.invariant.call(void 0, res.body, "No response body to decode");
|
|
626
628
|
try {
|
|
627
629
|
const payload = await createFromReadableStream(res.body, {
|
|
628
630
|
temporaryReferences: void 0
|
|
@@ -646,7 +648,7 @@ function getFetchAndDecodeViaRSC(createFromReadableStream, fetchImplementation)
|
|
|
646
648
|
}
|
|
647
649
|
context.get(renderedRoutesContext).push(...payload.matches);
|
|
648
650
|
let results = { routes: {} };
|
|
649
|
-
const dataKey =
|
|
651
|
+
const dataKey = _chunkAC65NKOPjs.isMutationMethod.call(void 0, request.method) ? "actionData" : "loaderData";
|
|
650
652
|
for (let [routeId, data] of Object.entries(payload[dataKey] || {})) {
|
|
651
653
|
results.routes[routeId] = { data };
|
|
652
654
|
}
|
|
@@ -679,7 +681,7 @@ function RSCHydratedRouter({
|
|
|
679
681
|
[createFromReadableStream, payload, fetchImplementation, getContext]
|
|
680
682
|
);
|
|
681
683
|
React3.useEffect(() => {
|
|
682
|
-
|
|
684
|
+
_chunkAC65NKOPjs.setIsHydrated.call(void 0, );
|
|
683
685
|
}, []);
|
|
684
686
|
React3.useLayoutEffect(() => {
|
|
685
687
|
const globalVar = window;
|
|
@@ -787,8 +789,8 @@ function RSCHydratedRouter({
|
|
|
787
789
|
},
|
|
788
790
|
routeModules
|
|
789
791
|
};
|
|
790
|
-
return /* @__PURE__ */ React3.createElement(
|
|
791
|
-
|
|
792
|
+
return /* @__PURE__ */ React3.createElement(_chunkAC65NKOPjs.RSCRouterContext.Provider, { value: true }, /* @__PURE__ */ React3.createElement(_chunk3IBQ4CTZjs.RSCRouterGlobalErrorBoundary, { location: state.location }, /* @__PURE__ */ React3.createElement(_chunkAC65NKOPjs.FrameworkContext.Provider, { value: frameworkContext }, /* @__PURE__ */ React3.createElement(
|
|
793
|
+
_chunkAC65NKOPjs.RouterProvider,
|
|
792
794
|
{
|
|
793
795
|
router: transitionEnabledRouter,
|
|
794
796
|
flushSync: ReactDOM2.flushSync
|
|
@@ -804,8 +806,8 @@ function createRouteFromServerManifest(match, payload) {
|
|
|
804
806
|
// the server loader flow regardless of whether the client loader calls
|
|
805
807
|
// `serverLoader` or not, otherwise we'll have nothing to render.
|
|
806
808
|
match.hasComponent && !match.element;
|
|
807
|
-
|
|
808
|
-
|
|
809
|
+
_chunkAC65NKOPjs.invariant.call(void 0, window.__reactRouterRouteModules);
|
|
810
|
+
_chunk3IBQ4CTZjs.populateRSCRouteModules.call(void 0, window.__reactRouterRouteModules, match);
|
|
809
811
|
let dataRoute = {
|
|
810
812
|
id: match.id,
|
|
811
813
|
element: match.element,
|
|
@@ -853,7 +855,7 @@ function createRouteFromServerManifest(match, payload) {
|
|
|
853
855
|
return await callSingleFetch(singleFetch);
|
|
854
856
|
}
|
|
855
857
|
}) : match.hasAction ? (_, singleFetch) => callSingleFetch(singleFetch) : () => {
|
|
856
|
-
throw
|
|
858
|
+
throw _chunkAC65NKOPjs.noActionDefinedError.call(void 0, "action", match.id);
|
|
857
859
|
},
|
|
858
860
|
path: match.path,
|
|
859
861
|
shouldRevalidate: match.shouldRevalidate,
|
|
@@ -865,7 +867,7 @@ function createRouteFromServerManifest(match, payload) {
|
|
|
865
867
|
hasClientAction: match.clientAction != null
|
|
866
868
|
};
|
|
867
869
|
if (typeof dataRoute.loader === "function") {
|
|
868
|
-
dataRoute.loader.hydrate =
|
|
870
|
+
dataRoute.loader.hydrate = _chunkAC65NKOPjs.shouldHydrateRouteLoader.call(void 0,
|
|
869
871
|
match.id,
|
|
870
872
|
match.clientLoader,
|
|
871
873
|
match.hasLoader,
|
|
@@ -875,7 +877,7 @@ function createRouteFromServerManifest(match, payload) {
|
|
|
875
877
|
return dataRoute;
|
|
876
878
|
}
|
|
877
879
|
function callSingleFetch(singleFetch) {
|
|
878
|
-
|
|
880
|
+
_chunkAC65NKOPjs.invariant.call(void 0, typeof singleFetch === "function", "Invalid singleFetch parameter");
|
|
879
881
|
return singleFetch();
|
|
880
882
|
}
|
|
881
883
|
function preventInvalidServerHandlerCall(type, routeId, hasHandler) {
|
|
@@ -883,7 +885,7 @@ function preventInvalidServerHandlerCall(type, routeId, hasHandler) {
|
|
|
883
885
|
let fn = type === "action" ? "serverAction()" : "serverLoader()";
|
|
884
886
|
let msg = `You are trying to call ${fn} on a route that does not have a server ${type} (routeId: "${routeId}")`;
|
|
885
887
|
console.error(msg);
|
|
886
|
-
throw new (0,
|
|
888
|
+
throw new (0, _chunkAC65NKOPjs.ErrorResponseImpl)(400, "Bad Request", new Error(msg), true);
|
|
887
889
|
}
|
|
888
890
|
}
|
|
889
891
|
var nextPaths = /* @__PURE__ */ new Set();
|
|
@@ -906,12 +908,12 @@ function getManifestUrl(paths) {
|
|
|
906
908
|
return url;
|
|
907
909
|
}
|
|
908
910
|
async function fetchAndApplyManifestPatches(paths, createFromReadableStream, fetchImplementation, signal) {
|
|
909
|
-
paths =
|
|
911
|
+
paths = _chunkAC65NKOPjs.getPathsWithAncestors.call(void 0, paths);
|
|
910
912
|
let url = getManifestUrl(paths);
|
|
911
913
|
if (url == null) {
|
|
912
914
|
return;
|
|
913
915
|
}
|
|
914
|
-
if (url.toString().length >
|
|
916
|
+
if (url.toString().length > _chunkAC65NKOPjs.URL_LIMIT) {
|
|
915
917
|
nextPaths.clear();
|
|
916
918
|
return;
|
|
917
919
|
}
|
|
@@ -955,8 +957,8 @@ function isExternalLocation(location2) {
|
|
|
955
957
|
return newLocation.origin !== window.location.origin;
|
|
956
958
|
}
|
|
957
959
|
function normalizeRedirectLocation(location2) {
|
|
958
|
-
if (
|
|
959
|
-
let path =
|
|
960
|
+
if (_chunkAC65NKOPjs.PROTOCOL_RELATIVE_URL_REGEX.test(location2)) {
|
|
961
|
+
let path = _chunkAC65NKOPjs.resolvePath.call(void 0, location2);
|
|
960
962
|
return path.pathname + path.search + path.hash;
|
|
961
963
|
}
|
|
962
964
|
return location2;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v7.18.
|
|
2
|
+
* react-router v7.18.6
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
RSCRouterGlobalErrorBoundary,
|
|
14
14
|
getHydrationData,
|
|
15
15
|
populateRSCRouteModules
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-JRCXCPLA.mjs";
|
|
17
17
|
import {
|
|
18
18
|
CRITICAL_CSS_DATA_ATTRIBUTE,
|
|
19
19
|
ErrorResponseImpl,
|
|
@@ -47,7 +47,7 @@ import {
|
|
|
47
47
|
stripIndexParam,
|
|
48
48
|
useFogOFWarDiscovery,
|
|
49
49
|
validateNavigationTarget
|
|
50
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-HEAXLYUI.mjs";
|
|
51
51
|
|
|
52
52
|
// lib/dom-export/dom-router-provider.tsx
|
|
53
53
|
import * as React from "react";
|
|
@@ -201,7 +201,9 @@ function HydratedRouter(props) {
|
|
|
201
201
|
);
|
|
202
202
|
React2.useEffect(() => {
|
|
203
203
|
if (process.env.NODE_ENV === "development") {
|
|
204
|
-
|
|
204
|
+
React2.startTransition(() => {
|
|
205
|
+
setCriticalCss(void 0);
|
|
206
|
+
});
|
|
205
207
|
}
|
|
206
208
|
}, []);
|
|
207
209
|
React2.useEffect(() => {
|