react-router 7.13.1 → 7.13.2
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 +53 -0
- package/dist/{production/browser-DzsJABDQ.d.mts → development/browser-Bfn3xw9E.d.ts} +2 -1
- package/dist/development/{browser-DzsJABDQ.d.mts → browser-Di6-vSl-.d.mts} +2 -1
- package/dist/development/{chunk-XOLAXE2Z.js → chunk-GO74ODU3.js} +190 -111
- package/dist/{production/chunk-B5UMK6O7.js → development/chunk-HPFFRPKK.js} +100 -99
- package/dist/development/{chunk-KSEWV2VO.js → chunk-LLP6DRWX.js} +7 -7
- package/dist/{production/chunk-TXB4YXR2.mjs → development/chunk-UALY5CBT.mjs} +83 -49
- package/dist/development/{chunk-LFPYN7LY.mjs → chunk-UVKPFVEO.mjs} +124 -44
- package/dist/development/context-phCt_zmH.d.mts +1713 -0
- package/dist/development/dom-export.d.mts +3 -2
- package/dist/development/dom-export.d.ts +3 -2
- package/dist/development/dom-export.js +45 -29
- package/dist/development/dom-export.mjs +21 -5
- package/dist/development/{index-react-server-client-C4tCIird.d.ts → index-react-server-client-BcrVT7Dd.d.mts} +4 -2
- package/dist/{production/index-react-server-client-EzWJGpN_.d.mts → development/index-react-server-client-CCwMoQIT.d.ts} +1067 -10
- package/dist/development/index-react-server-client.d.mts +3 -2
- package/dist/development/index-react-server-client.d.ts +3 -2
- 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 +293 -246
- package/dist/development/index-react-server.d.ts +293 -246
- package/dist/development/index-react-server.js +121 -43
- package/dist/development/index-react-server.mjs +121 -43
- package/dist/development/index.d.mts +15 -13
- package/dist/development/index.d.ts +15 -13
- package/dist/development/index.js +176 -142
- package/dist/development/index.mjs +3 -3
- package/dist/development/instrumentation-BYr6ff5D.d.ts +657 -0
- 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-CBoanF80.d.ts → register-CTxsJBKQ.d.mts} +1 -1
- package/dist/development/{register-cRYJ3CjG.d.mts → register-CkcGwv27.d.ts} +1 -1
- package/dist/development/routeModules-BRrCYrSL.d.mts +1693 -0
- package/dist/development/routeModules-CA7kSxJJ.d.ts +1693 -0
- package/dist/production/{browser-sPQ7eaK4.d.ts → browser-Bfn3xw9E.d.ts} +2 -1
- package/dist/{development/browser-sPQ7eaK4.d.ts → production/browser-Di6-vSl-.d.mts} +2 -1
- package/dist/production/{chunk-RJCJ3EYF.mjs → chunk-2BDJPJTA.mjs} +124 -44
- package/dist/production/{chunk-ZJMCM6KT.js → chunk-CAFVLUDY.js} +7 -7
- package/dist/production/{chunk-772H4TVR.js → chunk-LKUVSIBA.js} +190 -111
- package/dist/{development/chunk-JPUPSTYD.mjs → production/chunk-PY35PE22.mjs} +83 -49
- package/dist/{development/chunk-2YMDXNOJ.js → production/chunk-XAAX7KIK.js} +100 -99
- package/dist/production/context-phCt_zmH.d.mts +1713 -0
- package/dist/production/dom-export.d.mts +3 -2
- package/dist/production/dom-export.d.ts +3 -2
- package/dist/production/dom-export.js +45 -29
- package/dist/production/dom-export.mjs +21 -5
- package/dist/{development/index-react-server-client-EzWJGpN_.d.mts → production/index-react-server-client-BcrVT7Dd.d.mts} +4 -2
- package/dist/production/{index-react-server-client-C4tCIird.d.ts → index-react-server-client-CCwMoQIT.d.ts} +1067 -10
- package/dist/production/index-react-server-client.d.mts +3 -2
- package/dist/production/index-react-server-client.d.ts +3 -2
- 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 +293 -246
- package/dist/production/index-react-server.d.ts +293 -246
- package/dist/production/index-react-server.js +121 -43
- package/dist/production/index-react-server.mjs +121 -43
- package/dist/production/index.d.mts +15 -13
- package/dist/production/index.d.ts +15 -13
- package/dist/production/index.js +176 -142
- package/dist/production/index.mjs +3 -3
- package/dist/production/instrumentation-BYr6ff5D.d.ts +657 -0
- 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-CBoanF80.d.ts → register-CTxsJBKQ.d.mts} +1 -1
- package/dist/production/{register-cRYJ3CjG.d.mts → register-CkcGwv27.d.ts} +1 -1
- package/dist/production/routeModules-BRrCYrSL.d.mts +1693 -0
- package/dist/production/routeModules-CA7kSxJJ.d.ts +1693 -0
- package/package.json +1 -1
- package/dist/development/instrumentation--6Pioq_G.d.ts +0 -3344
- package/dist/development/router-cLsU7kHk.d.mts +0 -3344
- package/dist/production/instrumentation--6Pioq_G.d.ts +0 -3344
- package/dist/production/router-cLsU7kHk.d.mts +0 -3344
|
@@ -27,7 +27,7 @@ function _interopNamespace(e) {
|
|
|
27
27
|
var React2__namespace = /*#__PURE__*/_interopNamespace(React2);
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
|
-
* react-router v7.13.
|
|
30
|
+
* react-router v7.13.2
|
|
31
31
|
*
|
|
32
32
|
* Copyright (c) Remix Software Inc.
|
|
33
33
|
*
|
|
@@ -902,6 +902,10 @@ function createStaticHandler(routes, opts) {
|
|
|
902
902
|
let basename = (opts ? opts.basename : null) || "/";
|
|
903
903
|
let _mapRouteProperties = opts?.mapRouteProperties || defaultMapRouteProperties;
|
|
904
904
|
let mapRouteProperties = _mapRouteProperties;
|
|
905
|
+
({
|
|
906
|
+
// unused in static handler
|
|
907
|
+
...opts?.future
|
|
908
|
+
});
|
|
905
909
|
if (opts?.unstable_instrumentations) {
|
|
906
910
|
let instrumentations = opts.unstable_instrumentations;
|
|
907
911
|
mapRouteProperties = (route) => {
|
|
@@ -926,11 +930,12 @@ function createStaticHandler(routes, opts) {
|
|
|
926
930
|
skipLoaderErrorBubbling,
|
|
927
931
|
skipRevalidation,
|
|
928
932
|
dataStrategy,
|
|
929
|
-
generateMiddlewareResponse
|
|
933
|
+
generateMiddlewareResponse,
|
|
934
|
+
unstable_normalizePath
|
|
930
935
|
} = {}) {
|
|
931
|
-
let
|
|
936
|
+
let normalizePath = unstable_normalizePath || defaultNormalizePath;
|
|
932
937
|
let method = request.method;
|
|
933
|
-
let location = createLocation("",
|
|
938
|
+
let location = createLocation("", normalizePath(request), null, "default");
|
|
934
939
|
let matches = matchRoutes(dataRoutes, location, basename);
|
|
935
940
|
requestContext = requestContext != null ? requestContext : new RouterContextProvider();
|
|
936
941
|
if (!isValidMethod(method) && method !== "HEAD") {
|
|
@@ -983,6 +988,7 @@ function createStaticHandler(routes, opts) {
|
|
|
983
988
|
let response = await runServerMiddlewarePipeline(
|
|
984
989
|
{
|
|
985
990
|
request,
|
|
991
|
+
unstable_url: createDataFunctionUrl(request, location),
|
|
986
992
|
unstable_pattern: getRoutePattern(matches),
|
|
987
993
|
matches,
|
|
988
994
|
params: matches[0].params,
|
|
@@ -1099,11 +1105,12 @@ function createStaticHandler(routes, opts) {
|
|
|
1099
1105
|
routeId,
|
|
1100
1106
|
requestContext,
|
|
1101
1107
|
dataStrategy,
|
|
1102
|
-
generateMiddlewareResponse
|
|
1108
|
+
generateMiddlewareResponse,
|
|
1109
|
+
unstable_normalizePath
|
|
1103
1110
|
} = {}) {
|
|
1104
|
-
let
|
|
1111
|
+
let normalizePath = unstable_normalizePath || defaultNormalizePath;
|
|
1105
1112
|
let method = request.method;
|
|
1106
|
-
let location = createLocation("",
|
|
1113
|
+
let location = createLocation("", normalizePath(request), null, "default");
|
|
1107
1114
|
let matches = matchRoutes(dataRoutes, location, basename);
|
|
1108
1115
|
requestContext = requestContext != null ? requestContext : new RouterContextProvider();
|
|
1109
1116
|
if (!isValidMethod(method) && method !== "HEAD" && method !== "OPTIONS") {
|
|
@@ -1129,6 +1136,7 @@ function createStaticHandler(routes, opts) {
|
|
|
1129
1136
|
let response = await runServerMiddlewarePipeline(
|
|
1130
1137
|
{
|
|
1131
1138
|
request,
|
|
1139
|
+
unstable_url: createDataFunctionUrl(request, location),
|
|
1132
1140
|
unstable_pattern: getRoutePattern(matches),
|
|
1133
1141
|
matches,
|
|
1134
1142
|
params: matches[0].params,
|
|
@@ -1206,6 +1214,7 @@ function createStaticHandler(routes, opts) {
|
|
|
1206
1214
|
if (isMutationMethod(request.method)) {
|
|
1207
1215
|
let result2 = await submit(
|
|
1208
1216
|
request,
|
|
1217
|
+
location,
|
|
1209
1218
|
matches,
|
|
1210
1219
|
routeMatch || getTargetMatch(matches, location),
|
|
1211
1220
|
requestContext,
|
|
@@ -1219,6 +1228,7 @@ function createStaticHandler(routes, opts) {
|
|
|
1219
1228
|
}
|
|
1220
1229
|
let result = await loadRouteData(
|
|
1221
1230
|
request,
|
|
1231
|
+
location,
|
|
1222
1232
|
matches,
|
|
1223
1233
|
requestContext,
|
|
1224
1234
|
dataStrategy,
|
|
@@ -1244,7 +1254,7 @@ function createStaticHandler(routes, opts) {
|
|
|
1244
1254
|
throw e;
|
|
1245
1255
|
}
|
|
1246
1256
|
}
|
|
1247
|
-
async function submit(request, matches, actionMatch, requestContext, dataStrategy, skipLoaderErrorBubbling, isRouteRequest, filterMatchesToLoad, skipRevalidation) {
|
|
1257
|
+
async function submit(request, location, matches, actionMatch, requestContext, dataStrategy, skipLoaderErrorBubbling, isRouteRequest, filterMatchesToLoad, skipRevalidation) {
|
|
1248
1258
|
let result;
|
|
1249
1259
|
if (!actionMatch.route.action && !actionMatch.route.lazy) {
|
|
1250
1260
|
let error = getInternalRouterError(405, {
|
|
@@ -1264,6 +1274,7 @@ function createStaticHandler(routes, opts) {
|
|
|
1264
1274
|
mapRouteProperties,
|
|
1265
1275
|
manifest,
|
|
1266
1276
|
request,
|
|
1277
|
+
location,
|
|
1267
1278
|
matches,
|
|
1268
1279
|
actionMatch,
|
|
1269
1280
|
[],
|
|
@@ -1271,6 +1282,7 @@ function createStaticHandler(routes, opts) {
|
|
|
1271
1282
|
);
|
|
1272
1283
|
let results = await callDataStrategy(
|
|
1273
1284
|
request,
|
|
1285
|
+
location,
|
|
1274
1286
|
dsMatches,
|
|
1275
1287
|
isRouteRequest,
|
|
1276
1288
|
requestContext,
|
|
@@ -1344,6 +1356,7 @@ function createStaticHandler(routes, opts) {
|
|
|
1344
1356
|
let boundaryMatch = skipLoaderErrorBubbling ? actionMatch : findNearestBoundary(matches, actionMatch.route.id);
|
|
1345
1357
|
let handlerContext2 = await loadRouteData(
|
|
1346
1358
|
loaderRequest,
|
|
1359
|
+
location,
|
|
1347
1360
|
matches,
|
|
1348
1361
|
requestContext,
|
|
1349
1362
|
dataStrategy,
|
|
@@ -1363,6 +1376,7 @@ function createStaticHandler(routes, opts) {
|
|
|
1363
1376
|
}
|
|
1364
1377
|
let handlerContext = await loadRouteData(
|
|
1365
1378
|
loaderRequest,
|
|
1379
|
+
location,
|
|
1366
1380
|
matches,
|
|
1367
1381
|
requestContext,
|
|
1368
1382
|
dataStrategy,
|
|
@@ -1380,7 +1394,7 @@ function createStaticHandler(routes, opts) {
|
|
|
1380
1394
|
actionHeaders: result.headers ? { [actionMatch.route.id]: result.headers } : {}
|
|
1381
1395
|
};
|
|
1382
1396
|
}
|
|
1383
|
-
async function loadRouteData(request, matches, requestContext, dataStrategy, skipLoaderErrorBubbling, routeMatch, filterMatchesToLoad, pendingActionResult) {
|
|
1397
|
+
async function loadRouteData(request, location, matches, requestContext, dataStrategy, skipLoaderErrorBubbling, routeMatch, filterMatchesToLoad, pendingActionResult) {
|
|
1384
1398
|
let isRouteRequest = routeMatch != null;
|
|
1385
1399
|
if (isRouteRequest && !routeMatch?.route.loader && !routeMatch?.route.lazy) {
|
|
1386
1400
|
throw getInternalRouterError(400, {
|
|
@@ -1395,6 +1409,7 @@ function createStaticHandler(routes, opts) {
|
|
|
1395
1409
|
mapRouteProperties,
|
|
1396
1410
|
manifest,
|
|
1397
1411
|
request,
|
|
1412
|
+
location,
|
|
1398
1413
|
matches,
|
|
1399
1414
|
routeMatch,
|
|
1400
1415
|
[],
|
|
@@ -1412,6 +1427,7 @@ function createStaticHandler(routes, opts) {
|
|
|
1412
1427
|
mapRouteProperties,
|
|
1413
1428
|
manifest,
|
|
1414
1429
|
request,
|
|
1430
|
+
location,
|
|
1415
1431
|
pattern,
|
|
1416
1432
|
match,
|
|
1417
1433
|
[],
|
|
@@ -1423,6 +1439,7 @@ function createStaticHandler(routes, opts) {
|
|
|
1423
1439
|
mapRouteProperties,
|
|
1424
1440
|
manifest,
|
|
1425
1441
|
request,
|
|
1442
|
+
location,
|
|
1426
1443
|
pattern,
|
|
1427
1444
|
match,
|
|
1428
1445
|
[],
|
|
@@ -1444,6 +1461,7 @@ function createStaticHandler(routes, opts) {
|
|
|
1444
1461
|
}
|
|
1445
1462
|
let results = await callDataStrategy(
|
|
1446
1463
|
request,
|
|
1464
|
+
location,
|
|
1447
1465
|
dsMatches,
|
|
1448
1466
|
isRouteRequest,
|
|
1449
1467
|
requestContext,
|
|
@@ -1464,10 +1482,11 @@ function createStaticHandler(routes, opts) {
|
|
|
1464
1482
|
matches
|
|
1465
1483
|
};
|
|
1466
1484
|
}
|
|
1467
|
-
async function callDataStrategy(request, matches, isRouteRequest, requestContext, dataStrategy) {
|
|
1485
|
+
async function callDataStrategy(request, location, matches, isRouteRequest, requestContext, dataStrategy) {
|
|
1468
1486
|
let results = await callDataStrategyImpl(
|
|
1469
1487
|
dataStrategy || defaultDataStrategy,
|
|
1470
1488
|
request,
|
|
1489
|
+
location,
|
|
1471
1490
|
matches,
|
|
1472
1491
|
null,
|
|
1473
1492
|
requestContext);
|
|
@@ -1525,6 +1544,14 @@ function throwStaticHandlerAbortedError(request, isRouteRequest) {
|
|
|
1525
1544
|
`${method}() call aborted without an \`AbortSignal.reason\`: ${request.method} ${request.url}`
|
|
1526
1545
|
);
|
|
1527
1546
|
}
|
|
1547
|
+
function defaultNormalizePath(request) {
|
|
1548
|
+
let url = new URL(request.url);
|
|
1549
|
+
return {
|
|
1550
|
+
pathname: url.pathname,
|
|
1551
|
+
search: url.search,
|
|
1552
|
+
hash: url.hash
|
|
1553
|
+
};
|
|
1554
|
+
}
|
|
1528
1555
|
function normalizeTo(location, matches, basename, to, fromRouteId, relative) {
|
|
1529
1556
|
let contextualMatches;
|
|
1530
1557
|
let activeRouteMatch;
|
|
@@ -1762,17 +1789,12 @@ function runServerMiddlewarePipeline(args, handler, errorHandler) {
|
|
|
1762
1789
|
}
|
|
1763
1790
|
}
|
|
1764
1791
|
async function runMiddlewarePipeline(args, handler, processResult, isResult, errorHandler) {
|
|
1765
|
-
let { matches,
|
|
1792
|
+
let { matches, ...dataFnArgs } = args;
|
|
1766
1793
|
let tuples = matches.flatMap(
|
|
1767
1794
|
(m) => m.route.middleware ? m.route.middleware.map((fn) => [m.route.id, fn]) : []
|
|
1768
1795
|
);
|
|
1769
1796
|
let result = await callRouteMiddleware(
|
|
1770
|
-
|
|
1771
|
-
request,
|
|
1772
|
-
params,
|
|
1773
|
-
context,
|
|
1774
|
-
unstable_pattern
|
|
1775
|
-
},
|
|
1797
|
+
dataFnArgs,
|
|
1776
1798
|
tuples,
|
|
1777
1799
|
handler,
|
|
1778
1800
|
processResult,
|
|
@@ -1850,7 +1872,7 @@ function getDataStrategyMatchLazyPromises(mapRouteProperties, manifest, request,
|
|
|
1850
1872
|
handler: lazyRoutePromises.lazyHandlerPromise
|
|
1851
1873
|
};
|
|
1852
1874
|
}
|
|
1853
|
-
function getDataStrategyMatch(mapRouteProperties, manifest, request, unstable_pattern, match, lazyRoutePropertiesToSkip, scopedContext, shouldLoad, shouldRevalidateArgs = null, callSiteDefaultShouldRevalidate) {
|
|
1875
|
+
function getDataStrategyMatch(mapRouteProperties, manifest, request, path, unstable_pattern, match, lazyRoutePropertiesToSkip, scopedContext, shouldLoad, shouldRevalidateArgs = null, callSiteDefaultShouldRevalidate) {
|
|
1854
1876
|
let isUsingNewApi = false;
|
|
1855
1877
|
let _lazyPromises = getDataStrategyMatchLazyPromises(
|
|
1856
1878
|
mapRouteProperties,
|
|
@@ -1884,6 +1906,7 @@ function getDataStrategyMatch(mapRouteProperties, manifest, request, unstable_pa
|
|
|
1884
1906
|
if (callHandler && (isMutationMethod(request.method) || !isMiddlewareOnlyRoute)) {
|
|
1885
1907
|
return callLoaderOrAction({
|
|
1886
1908
|
request,
|
|
1909
|
+
path,
|
|
1887
1910
|
unstable_pattern,
|
|
1888
1911
|
match,
|
|
1889
1912
|
lazyHandlerPromise: _lazyPromises?.handler,
|
|
@@ -1896,7 +1919,7 @@ function getDataStrategyMatch(mapRouteProperties, manifest, request, unstable_pa
|
|
|
1896
1919
|
}
|
|
1897
1920
|
};
|
|
1898
1921
|
}
|
|
1899
|
-
function getTargetedDataStrategyMatches(mapRouteProperties, manifest, request, matches, targetMatch, lazyRoutePropertiesToSkip, scopedContext, shouldRevalidateArgs = null) {
|
|
1922
|
+
function getTargetedDataStrategyMatches(mapRouteProperties, manifest, request, path, matches, targetMatch, lazyRoutePropertiesToSkip, scopedContext, shouldRevalidateArgs = null) {
|
|
1900
1923
|
return matches.map((match) => {
|
|
1901
1924
|
if (match.route.id !== targetMatch.route.id) {
|
|
1902
1925
|
return {
|
|
@@ -1918,6 +1941,7 @@ function getTargetedDataStrategyMatches(mapRouteProperties, manifest, request, m
|
|
|
1918
1941
|
mapRouteProperties,
|
|
1919
1942
|
manifest,
|
|
1920
1943
|
request,
|
|
1944
|
+
path,
|
|
1921
1945
|
getRoutePattern(matches),
|
|
1922
1946
|
match,
|
|
1923
1947
|
lazyRoutePropertiesToSkip,
|
|
@@ -1927,12 +1951,13 @@ function getTargetedDataStrategyMatches(mapRouteProperties, manifest, request, m
|
|
|
1927
1951
|
);
|
|
1928
1952
|
});
|
|
1929
1953
|
}
|
|
1930
|
-
async function callDataStrategyImpl(dataStrategyImpl, request, matches, fetcherKey, scopedContext, isStaticHandler) {
|
|
1954
|
+
async function callDataStrategyImpl(dataStrategyImpl, request, path, matches, fetcherKey, scopedContext, isStaticHandler) {
|
|
1931
1955
|
if (matches.some((m) => m._lazyPromises?.middleware)) {
|
|
1932
1956
|
await Promise.all(matches.map((m) => m._lazyPromises?.middleware));
|
|
1933
1957
|
}
|
|
1934
1958
|
let dataStrategyArgs = {
|
|
1935
1959
|
request,
|
|
1960
|
+
unstable_url: createDataFunctionUrl(request, path),
|
|
1936
1961
|
unstable_pattern: getRoutePattern(matches),
|
|
1937
1962
|
params: matches[0].params,
|
|
1938
1963
|
context: scopedContext,
|
|
@@ -1961,6 +1986,7 @@ async function callDataStrategyImpl(dataStrategyImpl, request, matches, fetcherK
|
|
|
1961
1986
|
}
|
|
1962
1987
|
async function callLoaderOrAction({
|
|
1963
1988
|
request,
|
|
1989
|
+
path,
|
|
1964
1990
|
unstable_pattern,
|
|
1965
1991
|
match,
|
|
1966
1992
|
lazyHandlerPromise,
|
|
@@ -1988,6 +2014,7 @@ async function callLoaderOrAction({
|
|
|
1988
2014
|
return handler(
|
|
1989
2015
|
{
|
|
1990
2016
|
request,
|
|
2017
|
+
unstable_url: createDataFunctionUrl(request, path),
|
|
1991
2018
|
unstable_pattern,
|
|
1992
2019
|
params: match.params,
|
|
1993
2020
|
context: scopedContext
|
|
@@ -2145,6 +2172,24 @@ function normalizeRelativeRoutingRedirectResponse(response, request, routeId, ma
|
|
|
2145
2172
|
}
|
|
2146
2173
|
return response;
|
|
2147
2174
|
}
|
|
2175
|
+
function createDataFunctionUrl(request, path) {
|
|
2176
|
+
let url = new URL(request.url);
|
|
2177
|
+
let parsed = typeof path === "string" ? parsePath(path) : path;
|
|
2178
|
+
url.pathname = parsed.pathname || "/";
|
|
2179
|
+
if (parsed.search) {
|
|
2180
|
+
let searchParams = new URLSearchParams(parsed.search);
|
|
2181
|
+
let indexValues = searchParams.getAll("index");
|
|
2182
|
+
searchParams.delete("index");
|
|
2183
|
+
for (let value of indexValues.filter(Boolean)) {
|
|
2184
|
+
searchParams.append("index", value);
|
|
2185
|
+
}
|
|
2186
|
+
url.search = searchParams.size ? `?${searchParams.toString()}` : "";
|
|
2187
|
+
} else {
|
|
2188
|
+
url.search = "";
|
|
2189
|
+
}
|
|
2190
|
+
url.hash = parsed.hash || "";
|
|
2191
|
+
return url;
|
|
2192
|
+
}
|
|
2148
2193
|
function processRouteLoaderData(matches, results, pendingActionResult, isStaticHandler = false, skipLoaderErrorBubbling = false) {
|
|
2149
2194
|
let loaderData = {};
|
|
2150
2195
|
let errors = null;
|
|
@@ -2512,6 +2557,35 @@ function createRouteErrorResponseDigest(response) {
|
|
|
2512
2557
|
)}`;
|
|
2513
2558
|
}
|
|
2514
2559
|
|
|
2560
|
+
// lib/server-runtime/urls.ts
|
|
2561
|
+
function getNormalizedPath(request, basename, future) {
|
|
2562
|
+
basename = basename || "/";
|
|
2563
|
+
let url = new URL(request.url);
|
|
2564
|
+
let pathname = url.pathname;
|
|
2565
|
+
{
|
|
2566
|
+
if (stripBasename(pathname, basename) === "/_root.data") {
|
|
2567
|
+
pathname = basename;
|
|
2568
|
+
} else if (pathname.endsWith(".data")) {
|
|
2569
|
+
pathname = pathname.replace(/\.data$/, "");
|
|
2570
|
+
}
|
|
2571
|
+
if (stripBasename(pathname, basename) !== "/" && pathname.endsWith("/")) {
|
|
2572
|
+
pathname = pathname.slice(0, -1);
|
|
2573
|
+
}
|
|
2574
|
+
}
|
|
2575
|
+
let searchParams = new URLSearchParams(url.search);
|
|
2576
|
+
searchParams.delete("_routes");
|
|
2577
|
+
let search = searchParams.toString();
|
|
2578
|
+
if (search) {
|
|
2579
|
+
search = `?${search}`;
|
|
2580
|
+
}
|
|
2581
|
+
return {
|
|
2582
|
+
pathname,
|
|
2583
|
+
search,
|
|
2584
|
+
// No hashes on the server
|
|
2585
|
+
hash: ""
|
|
2586
|
+
};
|
|
2587
|
+
}
|
|
2588
|
+
|
|
2515
2589
|
// lib/rsc/server.rsc.ts
|
|
2516
2590
|
var Outlet = reactServerClient.Outlet;
|
|
2517
2591
|
var WithComponentProps = reactServerClient.UNSAFE_WithComponentProps;
|
|
@@ -2800,7 +2874,8 @@ async function generateResourceResponse(request, routes, basename, routeId, requ
|
|
|
2800
2874
|
} catch (error) {
|
|
2801
2875
|
return generateErrorResponse(error);
|
|
2802
2876
|
}
|
|
2803
|
-
}
|
|
2877
|
+
},
|
|
2878
|
+
unstable_normalizePath: (r) => getNormalizedPath(r, basename, null)
|
|
2804
2879
|
});
|
|
2805
2880
|
return response;
|
|
2806
2881
|
} catch (error) {
|
|
@@ -2856,6 +2931,7 @@ async function generateRenderResponse(request, routes, basename, isDataRequest,
|
|
|
2856
2931
|
skipLoaderErrorBubbling: isDataRequest,
|
|
2857
2932
|
skipRevalidation: isSubmission,
|
|
2858
2933
|
...routeIdsToLoad ? { filterMatchesToLoad: (m) => routeIdsToLoad.includes(m.route.id) } : {},
|
|
2934
|
+
unstable_normalizePath: (r) => getNormalizedPath(r, basename),
|
|
2859
2935
|
async generateMiddlewareResponse(query) {
|
|
2860
2936
|
let formState;
|
|
2861
2937
|
let skipRevalidation = false;
|
|
@@ -3103,16 +3179,17 @@ async function getRSCRouteMatch({
|
|
|
3103
3179
|
routeIdsToLoad,
|
|
3104
3180
|
parentId
|
|
3105
3181
|
}) {
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
const
|
|
3109
|
-
const
|
|
3110
|
-
const
|
|
3111
|
-
const
|
|
3112
|
-
const
|
|
3182
|
+
const route = match.route;
|
|
3183
|
+
await explodeLazyRoute(route);
|
|
3184
|
+
const Layout = route.Layout || React2__namespace.Fragment;
|
|
3185
|
+
const Component = route.Component;
|
|
3186
|
+
const ErrorBoundary = route.ErrorBoundary;
|
|
3187
|
+
const HydrateFallback = route.HydrateFallback;
|
|
3188
|
+
const loaderData = staticContext.loaderData[route.id];
|
|
3189
|
+
const actionData = staticContext.actionData?.[route.id];
|
|
3113
3190
|
const params = match.params;
|
|
3114
3191
|
let element = void 0;
|
|
3115
|
-
let shouldLoadRoute = !routeIdsToLoad || routeIdsToLoad.includes(
|
|
3192
|
+
let shouldLoadRoute = !routeIdsToLoad || routeIdsToLoad.includes(route.id);
|
|
3116
3193
|
if (Component && shouldLoadRoute) {
|
|
3117
3194
|
element = !isBelowErrorBoundary ? React2__namespace.createElement(
|
|
3118
3195
|
Layout,
|
|
@@ -3131,7 +3208,7 @@ async function getRSCRouteMatch({
|
|
|
3131
3208
|
}
|
|
3132
3209
|
let error = void 0;
|
|
3133
3210
|
if (ErrorBoundary && staticContext.errors) {
|
|
3134
|
-
error = staticContext.errors[
|
|
3211
|
+
error = staticContext.errors[route.id];
|
|
3135
3212
|
}
|
|
3136
3213
|
const errorElement = ErrorBoundary ? React2__namespace.createElement(
|
|
3137
3214
|
Layout,
|
|
@@ -3156,31 +3233,32 @@ async function getRSCRouteMatch({
|
|
|
3156
3233
|
params
|
|
3157
3234
|
})
|
|
3158
3235
|
) : void 0;
|
|
3236
|
+
const hmrRoute = route;
|
|
3159
3237
|
return {
|
|
3160
|
-
clientAction:
|
|
3161
|
-
clientLoader:
|
|
3238
|
+
clientAction: route.clientAction,
|
|
3239
|
+
clientLoader: route.clientLoader,
|
|
3162
3240
|
element,
|
|
3163
3241
|
errorElement,
|
|
3164
|
-
handle:
|
|
3165
|
-
hasAction: !!
|
|
3242
|
+
handle: route.handle,
|
|
3243
|
+
hasAction: !!route.action,
|
|
3166
3244
|
hasComponent: !!Component,
|
|
3167
3245
|
hasErrorBoundary: !!ErrorBoundary,
|
|
3168
|
-
hasLoader: !!
|
|
3246
|
+
hasLoader: !!route.loader,
|
|
3169
3247
|
hydrateFallbackElement,
|
|
3170
|
-
id:
|
|
3171
|
-
index:
|
|
3172
|
-
links:
|
|
3173
|
-
meta:
|
|
3248
|
+
id: route.id,
|
|
3249
|
+
index: "index" in route ? route.index : void 0,
|
|
3250
|
+
links: route.links,
|
|
3251
|
+
meta: route.meta,
|
|
3174
3252
|
params,
|
|
3175
3253
|
parentId,
|
|
3176
|
-
path:
|
|
3254
|
+
path: route.path,
|
|
3177
3255
|
pathname: match.pathname,
|
|
3178
3256
|
pathnameBase: match.pathnameBase,
|
|
3179
|
-
shouldRevalidate:
|
|
3257
|
+
shouldRevalidate: route.shouldRevalidate,
|
|
3180
3258
|
// Add an unused client-only export (if present) so HMR can support
|
|
3181
3259
|
// switching between server-first and client-only routes during development
|
|
3182
|
-
...
|
|
3183
|
-
__ensureClientRouteModuleForHMR:
|
|
3260
|
+
...hmrRoute.__ensureClientRouteModuleForHMR ? {
|
|
3261
|
+
__ensureClientRouteModuleForHMR: hmrRoute.__ensureClientRouteModuleForHMR
|
|
3184
3262
|
} : {}
|
|
3185
3263
|
};
|
|
3186
3264
|
}
|