react-router 0.0.0-experimental-902325fda → 0.0.0-experimental-208f173a8
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/dist/development/{chunk-XX7SEIOE.mjs → chunk-TMQ5JBAV.mjs} +56 -90
- package/dist/development/dom-export.d.mts +2 -2
- package/dist/development/dom-export.d.ts +2 -2
- package/dist/development/dom-export.js +28 -58
- package/dist/development/dom-export.mjs +5 -12
- package/dist/{production/fog-of-war-Ax4Jg2xL.d.ts → development/fog-of-war-BDX71M75.d.ts} +3 -3
- package/dist/development/{fog-of-war-Ax4Jg2xL.d.ts → fog-of-war-CNAMmxww.d.mts} +3 -3
- package/dist/development/index.d.mts +5 -9
- package/dist/development/index.d.ts +5 -9
- package/dist/development/index.js +57 -90
- package/dist/development/index.mjs +4 -2
- package/dist/development/lib/types/route-module.d.mts +1 -3
- package/dist/development/lib/types/route-module.d.ts +1 -3
- package/dist/development/lib/types/route-module.js +1 -1
- package/dist/development/lib/types/route-module.mjs +1 -1
- package/dist/development/{route-data-DQbTMaUY.d.ts → route-data-ii4CGe_J.d.mts} +22 -8
- package/dist/{production/route-data-DQbTMaUY.d.mts → development/route-data-ii4CGe_J.d.ts} +22 -8
- package/dist/production/{chunk-IS6LEE6H.mjs → chunk-MU3TF2QX.mjs} +56 -90
- package/dist/production/dom-export.d.mts +2 -2
- package/dist/production/dom-export.d.ts +2 -2
- package/dist/production/dom-export.js +28 -58
- package/dist/production/dom-export.mjs +5 -12
- package/dist/{development/fog-of-war-Cyo_TZuh.d.mts → production/fog-of-war-BDX71M75.d.ts} +3 -3
- package/dist/production/{fog-of-war-Cyo_TZuh.d.mts → fog-of-war-CNAMmxww.d.mts} +3 -3
- package/dist/production/index.d.mts +5 -9
- package/dist/production/index.d.ts +5 -9
- package/dist/production/index.js +57 -90
- package/dist/production/index.mjs +4 -2
- package/dist/production/lib/types/route-module.d.mts +1 -3
- package/dist/production/lib/types/route-module.d.ts +1 -3
- package/dist/production/lib/types/route-module.js +1 -1
- package/dist/production/lib/types/route-module.mjs +1 -1
- package/dist/production/{route-data-DQbTMaUY.d.ts → route-data-ii4CGe_J.d.mts} +22 -8
- package/dist/{development/route-data-DQbTMaUY.d.mts → production/route-data-ii4CGe_J.d.ts} +22 -8
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-208f173a8
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -154,13 +154,13 @@ function createHashHistory(options = {}) {
|
|
|
154
154
|
}
|
|
155
155
|
function createHashHref(window2, to) {
|
|
156
156
|
let base = window2.document.querySelector("base");
|
|
157
|
-
let
|
|
157
|
+
let href2 = "";
|
|
158
158
|
if (base && base.getAttribute("href")) {
|
|
159
159
|
let url = window2.location.href;
|
|
160
160
|
let hashIndex = url.indexOf("#");
|
|
161
|
-
|
|
161
|
+
href2 = hashIndex === -1 ? url : url.slice(0, hashIndex);
|
|
162
162
|
}
|
|
163
|
-
return
|
|
163
|
+
return href2 + "#" + (typeof to === "string" ? to : createPath(to));
|
|
164
164
|
}
|
|
165
165
|
function validateHashLocation(location, to) {
|
|
166
166
|
warning(
|
|
@@ -302,13 +302,13 @@ function getUrlBasedHistory(getLocation, createHref2, validateLocation, options
|
|
|
302
302
|
}
|
|
303
303
|
function createURL(to) {
|
|
304
304
|
let base = window2.location.origin !== "null" ? window2.location.origin : window2.location.href;
|
|
305
|
-
let
|
|
306
|
-
|
|
305
|
+
let href2 = typeof to === "string" ? to : createPath(to);
|
|
306
|
+
href2 = href2.replace(/ $/, "%20");
|
|
307
307
|
invariant(
|
|
308
308
|
base,
|
|
309
|
-
`No window.location.(origin|href) available to create URL for href: ${
|
|
309
|
+
`No window.location.(origin|href) available to create URL for href: ${href2}`
|
|
310
310
|
);
|
|
311
|
-
return new URL(
|
|
311
|
+
return new URL(href2, base);
|
|
312
312
|
}
|
|
313
313
|
let history = {
|
|
314
314
|
get action() {
|
|
@@ -840,6 +840,18 @@ var ErrorResponseImpl = class {
|
|
|
840
840
|
function isRouteErrorResponse(error) {
|
|
841
841
|
return error != null && typeof error.status === "number" && typeof error.statusText === "string" && typeof error.internal === "boolean" && "data" in error;
|
|
842
842
|
}
|
|
843
|
+
function href(path, ...args) {
|
|
844
|
+
let params = args[0];
|
|
845
|
+
return path.split("/").map((segment) => {
|
|
846
|
+
const match = segment.match(/^:([\w-]+)(\?)?/);
|
|
847
|
+
if (!match) return segment;
|
|
848
|
+
const param = match[1];
|
|
849
|
+
if (params === void 0) {
|
|
850
|
+
throw Error(`Path '${path}' requires params but none were provided`);
|
|
851
|
+
}
|
|
852
|
+
return params[param];
|
|
853
|
+
}).join("/");
|
|
854
|
+
}
|
|
843
855
|
|
|
844
856
|
// lib/router/router.ts
|
|
845
857
|
var validMutationMethodsArr = [
|
|
@@ -1710,7 +1722,7 @@ function createRouter(init) {
|
|
|
1710
1722
|
});
|
|
1711
1723
|
return new Map(state.fetchers);
|
|
1712
1724
|
}
|
|
1713
|
-
async function fetch2(key, routeId,
|
|
1725
|
+
async function fetch2(key, routeId, href2, opts) {
|
|
1714
1726
|
abortFetcher(key);
|
|
1715
1727
|
let flushSync = (opts && opts.flushSync) === true;
|
|
1716
1728
|
let routesToUse = inFlightDataRoutes || dataRoutes;
|
|
@@ -1718,7 +1730,7 @@ function createRouter(init) {
|
|
|
1718
1730
|
state.location,
|
|
1719
1731
|
state.matches,
|
|
1720
1732
|
basename,
|
|
1721
|
-
|
|
1733
|
+
href2,
|
|
1722
1734
|
routeId,
|
|
1723
1735
|
opts?.relative
|
|
1724
1736
|
);
|
|
@@ -5356,7 +5368,7 @@ function getKeyedLinksForMatches(matches, routeModules, manifest) {
|
|
|
5356
5368
|
let module = routeModules[match.route.id];
|
|
5357
5369
|
let route = manifest.routes[match.route.id];
|
|
5358
5370
|
return [
|
|
5359
|
-
route && route.css ? route.css.map((
|
|
5371
|
+
route && route.css ? route.css.map((href2) => ({ rel: "stylesheet", href: href2 })) : [],
|
|
5360
5372
|
module?.links?.() || []
|
|
5361
5373
|
];
|
|
5362
5374
|
}).flat(2);
|
|
@@ -5365,7 +5377,7 @@ function getKeyedLinksForMatches(matches, routeModules, manifest) {
|
|
|
5365
5377
|
}
|
|
5366
5378
|
function getRouteCssDescriptors(route) {
|
|
5367
5379
|
if (!route.css) return [];
|
|
5368
|
-
return route.css.map((
|
|
5380
|
+
return route.css.map((href2) => ({ rel: "stylesheet", href: href2 }));
|
|
5369
5381
|
}
|
|
5370
5382
|
async function prefetchRouteCss(route) {
|
|
5371
5383
|
if (!route.css) return;
|
|
@@ -5664,24 +5676,11 @@ function StreamTransfer({
|
|
|
5664
5676
|
)));
|
|
5665
5677
|
}
|
|
5666
5678
|
}
|
|
5667
|
-
function getSingleFetchDataStrategy(manifest, routeModules,
|
|
5679
|
+
function getSingleFetchDataStrategy(manifest, routeModules, getRouter) {
|
|
5668
5680
|
return async ({ request, matches, fetcherKey }) => {
|
|
5669
5681
|
if (request.method !== "GET") {
|
|
5670
5682
|
return singleFetchActionStrategy(request, matches);
|
|
5671
5683
|
}
|
|
5672
|
-
if (!ssr) {
|
|
5673
|
-
let foundLoaderBelowRoot = matches.some(
|
|
5674
|
-
(m) => m.route.id !== "root" && manifest.routes[m.route.id]?.hasLoader
|
|
5675
|
-
);
|
|
5676
|
-
if (!foundLoaderBelowRoot) {
|
|
5677
|
-
let matchesToLoad = matches.filter((m) => m.shouldLoad);
|
|
5678
|
-
let results = await Promise.all(matchesToLoad.map((m) => m.resolve()));
|
|
5679
|
-
return results.reduce(
|
|
5680
|
-
(acc, result, i) => Object.assign(acc, { [matchesToLoad[i].route.id]: result }),
|
|
5681
|
-
{}
|
|
5682
|
-
);
|
|
5683
|
-
}
|
|
5684
|
-
}
|
|
5685
5684
|
if (fetcherKey) {
|
|
5686
5685
|
return singleFetchLoaderFetcherStrategy(request, matches);
|
|
5687
5686
|
}
|
|
@@ -6155,12 +6154,11 @@ function createServerRoutes(manifest, routeModules, future, isSpaMode, parentId
|
|
|
6155
6154
|
return dataRoute;
|
|
6156
6155
|
});
|
|
6157
6156
|
}
|
|
6158
|
-
function createClientRoutesWithHMRRevalidationOptOut(needsRevalidation, manifest, routeModulesCache, initialState,
|
|
6157
|
+
function createClientRoutesWithHMRRevalidationOptOut(needsRevalidation, manifest, routeModulesCache, initialState, future, isSpaMode) {
|
|
6159
6158
|
return createClientRoutes(
|
|
6160
6159
|
manifest,
|
|
6161
6160
|
routeModulesCache,
|
|
6162
6161
|
initialState,
|
|
6163
|
-
ssr,
|
|
6164
6162
|
isSpaMode,
|
|
6165
6163
|
"",
|
|
6166
6164
|
groupRoutesByParentId(manifest),
|
|
@@ -6169,14 +6167,14 @@ function createClientRoutesWithHMRRevalidationOptOut(needsRevalidation, manifest
|
|
|
6169
6167
|
}
|
|
6170
6168
|
function preventInvalidServerHandlerCall(type, route, isSpaMode) {
|
|
6171
6169
|
if (isSpaMode) {
|
|
6172
|
-
let
|
|
6173
|
-
let
|
|
6174
|
-
console.error(
|
|
6175
|
-
throw new ErrorResponseImpl(400, "Bad Request", new Error(
|
|
6170
|
+
let fn2 = type === "action" ? "serverAction()" : "serverLoader()";
|
|
6171
|
+
let msg2 = `You cannot call ${fn2} in SPA Mode (routeId: "${route.id}")`;
|
|
6172
|
+
console.error(msg2);
|
|
6173
|
+
throw new ErrorResponseImpl(400, "Bad Request", new Error(msg2), true);
|
|
6176
6174
|
}
|
|
6175
|
+
let fn = type === "action" ? "serverAction()" : "serverLoader()";
|
|
6176
|
+
let msg = `You are trying to call ${fn} on a route that does not have a server ${type} (routeId: "${route.id}")`;
|
|
6177
6177
|
if (type === "loader" && !route.hasLoader || type === "action" && !route.hasAction) {
|
|
6178
|
-
let fn = type === "action" ? "serverAction()" : "serverLoader()";
|
|
6179
|
-
let msg = `You are trying to call ${fn} on a route that does not have a server ${type} (routeId: "${route.id}")`;
|
|
6180
6178
|
console.error(msg);
|
|
6181
6179
|
throw new ErrorResponseImpl(400, "Bad Request", new Error(msg), true);
|
|
6182
6180
|
}
|
|
@@ -6187,7 +6185,7 @@ function noActionDefinedError(type, routeId) {
|
|
|
6187
6185
|
console.error(msg);
|
|
6188
6186
|
throw new ErrorResponseImpl(405, "Method Not Allowed", new Error(msg), true);
|
|
6189
6187
|
}
|
|
6190
|
-
function createClientRoutes(manifest, routeModulesCache, initialState,
|
|
6188
|
+
function createClientRoutes(manifest, routeModulesCache, initialState, isSpaMode, parentId = "", routesByParentId = groupRoutesByParentId(manifest), needsRevalidation) {
|
|
6191
6189
|
return (routesByParentId[parentId] || []).map((route) => {
|
|
6192
6190
|
let routeModule = routeModulesCache[route.id];
|
|
6193
6191
|
function fetchServerHandler(singleFetch) {
|
|
@@ -6241,18 +6239,10 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
|
|
|
6241
6239
|
...dataRoute,
|
|
6242
6240
|
...getRouteComponents(route, routeModule, isSpaMode),
|
|
6243
6241
|
handle: routeModule.handle,
|
|
6244
|
-
shouldRevalidate: (
|
|
6245
|
-
|
|
6246
|
-
|
|
6247
|
-
|
|
6248
|
-
// submitting to a clientAction on a non-prerendered path, we don't
|
|
6249
|
-
// try to reach out for a non-existent `.data` file which would have
|
|
6250
|
-
// the "revalidated" root data
|
|
6251
|
-
!ssr && route.id === "root" && route.hasLoader && !route.hasClientLoader ? () => false : getShouldRevalidateFunction(
|
|
6252
|
-
routeModule,
|
|
6253
|
-
route.id,
|
|
6254
|
-
needsRevalidation
|
|
6255
|
-
)
|
|
6242
|
+
shouldRevalidate: getShouldRevalidateFunction(
|
|
6243
|
+
routeModule,
|
|
6244
|
+
route.id,
|
|
6245
|
+
needsRevalidation
|
|
6256
6246
|
)
|
|
6257
6247
|
});
|
|
6258
6248
|
let hasInitialData = initialState && initialState.loaderData && route.id in initialState.loaderData;
|
|
@@ -6268,6 +6258,7 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
|
|
|
6268
6258
|
"No `routeModule` available for critical-route loader"
|
|
6269
6259
|
);
|
|
6270
6260
|
if (!routeModule.clientLoader) {
|
|
6261
|
+
if (isSpaMode) return null;
|
|
6271
6262
|
return fetchServerLoader(singleFetch);
|
|
6272
6263
|
}
|
|
6273
6264
|
return routeModule.clientLoader({
|
|
@@ -6322,6 +6313,7 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
|
|
|
6322
6313
|
} else {
|
|
6323
6314
|
if (!route.hasClientLoader) {
|
|
6324
6315
|
dataRoute.loader = ({ request }, singleFetch) => prefetchStylesAndCallHandler(() => {
|
|
6316
|
+
if (isSpaMode) return Promise.resolve(null);
|
|
6325
6317
|
return fetchServerLoader(singleFetch);
|
|
6326
6318
|
});
|
|
6327
6319
|
} else if (route.clientLoaderModule) {
|
|
@@ -6418,7 +6410,6 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
|
|
|
6418
6410
|
manifest,
|
|
6419
6411
|
routeModulesCache,
|
|
6420
6412
|
initialState,
|
|
6421
|
-
ssr,
|
|
6422
6413
|
isSpaMode,
|
|
6423
6414
|
route.id,
|
|
6424
6415
|
routesByParentId,
|
|
@@ -6526,7 +6517,6 @@ function getPatchRoutesOnNavigationFunction(manifest, routeModules, ssr, isSpaMo
|
|
|
6526
6517
|
[path],
|
|
6527
6518
|
manifest,
|
|
6528
6519
|
routeModules,
|
|
6529
|
-
ssr,
|
|
6530
6520
|
isSpaMode,
|
|
6531
6521
|
basename,
|
|
6532
6522
|
patch,
|
|
@@ -6566,7 +6556,6 @@ function useFogOFWarDiscovery(router, manifest, routeModules, ssr, isSpaMode) {
|
|
|
6566
6556
|
lazyPaths,
|
|
6567
6557
|
manifest,
|
|
6568
6558
|
routeModules,
|
|
6569
|
-
ssr,
|
|
6570
6559
|
isSpaMode,
|
|
6571
6560
|
router.basename,
|
|
6572
6561
|
router.patchRoutes
|
|
@@ -6587,7 +6576,7 @@ function useFogOFWarDiscovery(router, manifest, routeModules, ssr, isSpaMode) {
|
|
|
6587
6576
|
return () => observer.disconnect();
|
|
6588
6577
|
}, [ssr, isSpaMode, manifest, routeModules, router]);
|
|
6589
6578
|
}
|
|
6590
|
-
async function fetchAndApplyManifestPatches(paths, manifest, routeModules,
|
|
6579
|
+
async function fetchAndApplyManifestPatches(paths, manifest, routeModules, isSpaMode, basename, patchRoutes, signal) {
|
|
6591
6580
|
let manifestPath = `${basename != null ? basename : "/"}/__manifest`.replace(
|
|
6592
6581
|
/\/+/g,
|
|
6593
6582
|
"/"
|
|
@@ -6630,7 +6619,7 @@ async function fetchAndApplyManifestPatches(paths, manifest, routeModules, ssr,
|
|
|
6630
6619
|
parentIds.forEach(
|
|
6631
6620
|
(parentId) => patchRoutes(
|
|
6632
6621
|
parentId || null,
|
|
6633
|
-
createClientRoutes(patches, routeModules, null,
|
|
6622
|
+
createClientRoutes(patches, routeModules, null, isSpaMode, parentId)
|
|
6634
6623
|
)
|
|
6635
6624
|
);
|
|
6636
6625
|
}
|
|
@@ -6870,7 +6859,7 @@ function PrefetchPageLinksImpl({
|
|
|
6870
6859
|
[newMatchesForAssets, manifest]
|
|
6871
6860
|
);
|
|
6872
6861
|
let keyedPrefetchLinks = useKeyedPrefetchLinks(newMatchesForAssets);
|
|
6873
|
-
return /* @__PURE__ */ React9.createElement(React9.Fragment, null, dataHrefs.map((
|
|
6862
|
+
return /* @__PURE__ */ React9.createElement(React9.Fragment, null, dataHrefs.map((href2) => /* @__PURE__ */ React9.createElement("link", { key: href2, rel: "prefetch", as: "fetch", href: href2, ...linkProps })), moduleHrefs.map((href2) => /* @__PURE__ */ React9.createElement("link", { key: href2, rel: "modulepreload", href: href2, ...linkProps })), keyedPrefetchLinks.map(({ key, link }) => (
|
|
6874
6863
|
// these don't spread `linkProps` because they are full link descriptors
|
|
6875
6864
|
// already with their own props
|
|
6876
6865
|
/* @__PURE__ */ React9.createElement("link", { key, ...link })
|
|
@@ -7110,7 +7099,7 @@ function mergeRefs(...refs) {
|
|
|
7110
7099
|
var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
7111
7100
|
try {
|
|
7112
7101
|
if (isBrowser) {
|
|
7113
|
-
window.__reactRouterVersion = "0.0.0-experimental-
|
|
7102
|
+
window.__reactRouterVersion = "0.0.0-experimental-208f173a8";
|
|
7114
7103
|
}
|
|
7115
7104
|
} catch (e) {
|
|
7116
7105
|
}
|
|
@@ -7313,7 +7302,7 @@ var Link = React10.forwardRef(
|
|
|
7313
7302
|
}
|
|
7314
7303
|
}
|
|
7315
7304
|
}
|
|
7316
|
-
let
|
|
7305
|
+
let href2 = useHref(to, { relative });
|
|
7317
7306
|
let [shouldPrefetch, prefetchRef, prefetchHandlers] = usePrefetchBehavior(
|
|
7318
7307
|
prefetch,
|
|
7319
7308
|
rest
|
|
@@ -7339,7 +7328,7 @@ var Link = React10.forwardRef(
|
|
|
7339
7328
|
{
|
|
7340
7329
|
...rest,
|
|
7341
7330
|
...prefetchHandlers,
|
|
7342
|
-
href: absoluteHref ||
|
|
7331
|
+
href: absoluteHref || href2,
|
|
7343
7332
|
onClick: isExternal || reloadDocument ? onClick : handleClick,
|
|
7344
7333
|
ref: mergeRefs(forwardedRef, prefetchRef),
|
|
7345
7334
|
target,
|
|
@@ -7347,7 +7336,7 @@ var Link = React10.forwardRef(
|
|
|
7347
7336
|
}
|
|
7348
7337
|
)
|
|
7349
7338
|
);
|
|
7350
|
-
return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React10.createElement(React10.Fragment, null, link, /* @__PURE__ */ React10.createElement(PrefetchPageLinks, { page:
|
|
7339
|
+
return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React10.createElement(React10.Fragment, null, link, /* @__PURE__ */ React10.createElement(PrefetchPageLinks, { page: href2 })) : link;
|
|
7351
7340
|
}
|
|
7352
7341
|
);
|
|
7353
7342
|
Link.displayName = "Link";
|
|
@@ -7703,9 +7692,9 @@ function useFetcher({
|
|
|
7703
7692
|
return () => router.deleteFetcher(fetcherKey);
|
|
7704
7693
|
}, [router, fetcherKey]);
|
|
7705
7694
|
let load = React10.useCallback(
|
|
7706
|
-
async (
|
|
7695
|
+
async (href2, opts) => {
|
|
7707
7696
|
invariant(routeId, "No routeId available for fetcher.load()");
|
|
7708
|
-
await router.fetch(fetcherKey, routeId,
|
|
7697
|
+
await router.fetch(fetcherKey, routeId, href2, opts);
|
|
7709
7698
|
},
|
|
7710
7699
|
[fetcherKey, routeId, router]
|
|
7711
7700
|
);
|
|
@@ -8162,9 +8151,9 @@ function createHref(to) {
|
|
|
8162
8151
|
return typeof to === "string" ? to : createPath(to);
|
|
8163
8152
|
}
|
|
8164
8153
|
function encodeLocation(to) {
|
|
8165
|
-
let
|
|
8166
|
-
|
|
8167
|
-
let encoded = ABSOLUTE_URL_REGEX3.test(
|
|
8154
|
+
let href2 = typeof to === "string" ? to : createPath(to);
|
|
8155
|
+
href2 = href2.replace(/ $/, "%20");
|
|
8156
|
+
let encoded = ABSOLUTE_URL_REGEX3.test(href2) ? new URL(href2) : new URL(href2, "http://localhost");
|
|
8168
8157
|
return {
|
|
8169
8158
|
pathname: encoded.pathname,
|
|
8170
8159
|
search: encoded.search,
|
|
@@ -9115,10 +9104,6 @@ var createRequestHandler = (build, mode) => {
|
|
|
9115
9104
|
errorHandler = derived.errorHandler;
|
|
9116
9105
|
}
|
|
9117
9106
|
let url = new URL(request.url);
|
|
9118
|
-
let normalizedPath = url.pathname.replace(/\.data$/, "").replace(/^\/_root$/, "/");
|
|
9119
|
-
if (normalizedPath !== "/" && normalizedPath.endsWith("/")) {
|
|
9120
|
-
normalizedPath = normalizedPath.slice(0, -1);
|
|
9121
|
-
}
|
|
9122
9107
|
let params = {};
|
|
9123
9108
|
let handleError = (error) => {
|
|
9124
9109
|
if (mode === "development" /* Development */) {
|
|
@@ -9130,25 +9115,6 @@ var createRequestHandler = (build, mode) => {
|
|
|
9130
9115
|
request
|
|
9131
9116
|
});
|
|
9132
9117
|
};
|
|
9133
|
-
if (!_build.ssr && _build.prerender.length > 0 && normalizedPath !== "/" && // Look with/without the trailing slash to be sure
|
|
9134
|
-
!_build.prerender.includes(normalizedPath) && !_build.prerender.includes(normalizedPath + "/")) {
|
|
9135
|
-
errorHandler(
|
|
9136
|
-
new ErrorResponseImpl(
|
|
9137
|
-
404,
|
|
9138
|
-
"Not Found",
|
|
9139
|
-
`Refusing to SSR the path \`${normalizedPath}\` because \`ssr:false\` is set and the path is not included in the \`prerender\` config, so in production the path will be a 404.`
|
|
9140
|
-
),
|
|
9141
|
-
{
|
|
9142
|
-
context: loadContext,
|
|
9143
|
-
params,
|
|
9144
|
-
request
|
|
9145
|
-
}
|
|
9146
|
-
);
|
|
9147
|
-
return new Response("Not Found", {
|
|
9148
|
-
status: 404,
|
|
9149
|
-
statusText: "Not Found"
|
|
9150
|
-
});
|
|
9151
|
-
}
|
|
9152
9118
|
let manifestUrl = `${_build.basename ?? "/"}/__manifest`.replace(
|
|
9153
9119
|
/\/+/g,
|
|
9154
9120
|
"/"
|
|
@@ -9169,7 +9135,7 @@ var createRequestHandler = (build, mode) => {
|
|
|
9169
9135
|
let response;
|
|
9170
9136
|
if (url.pathname.endsWith(".data")) {
|
|
9171
9137
|
let handlerUrl = new URL(request.url);
|
|
9172
|
-
handlerUrl.pathname =
|
|
9138
|
+
handlerUrl.pathname = handlerUrl.pathname.replace(/\.data$/, "").replace(/^\/_root$/, "/");
|
|
9173
9139
|
let singleFetchMatches = matchServerRoutes(
|
|
9174
9140
|
routes,
|
|
9175
9141
|
handlerUrl.pathname,
|
|
@@ -9309,7 +9275,6 @@ async function handleSingleFetchRequest(serverMode, build, staticHandler, reques
|
|
|
9309
9275
|
);
|
|
9310
9276
|
}
|
|
9311
9277
|
async function handleDocumentRequest(serverMode, build, staticHandler, request, loadContext, handleError, criticalCss) {
|
|
9312
|
-
let isSpaMode = request.headers.has("X-React-Router-SPA-Mode");
|
|
9313
9278
|
let context;
|
|
9314
9279
|
try {
|
|
9315
9280
|
context = await staticHandler.query(request, {
|
|
@@ -9349,7 +9314,7 @@ async function handleDocumentRequest(serverMode, build, staticHandler, request,
|
|
|
9349
9314
|
criticalCss,
|
|
9350
9315
|
future: build.future,
|
|
9351
9316
|
ssr: build.ssr,
|
|
9352
|
-
isSpaMode
|
|
9317
|
+
isSpaMode: build.isSpaMode
|
|
9353
9318
|
}),
|
|
9354
9319
|
serverHandoffStream: encodeViaTurboStream(
|
|
9355
9320
|
state,
|
|
@@ -9360,7 +9325,7 @@ async function handleDocumentRequest(serverMode, build, staticHandler, request,
|
|
|
9360
9325
|
renderMeta: {},
|
|
9361
9326
|
future: build.future,
|
|
9362
9327
|
ssr: build.ssr,
|
|
9363
|
-
isSpaMode,
|
|
9328
|
+
isSpaMode: build.isSpaMode,
|
|
9364
9329
|
serializeError: (err) => serializeError(err, serverMode)
|
|
9365
9330
|
};
|
|
9366
9331
|
let handleDocumentRequestFunction = build.entry.module.default;
|
|
@@ -9406,7 +9371,7 @@ async function handleDocumentRequest(serverMode, build, staticHandler, request,
|
|
|
9406
9371
|
basename: build.basename,
|
|
9407
9372
|
future: build.future,
|
|
9408
9373
|
ssr: build.ssr,
|
|
9409
|
-
isSpaMode
|
|
9374
|
+
isSpaMode: build.isSpaMode
|
|
9410
9375
|
}),
|
|
9411
9376
|
serverHandoffStream: encodeViaTurboStream(
|
|
9412
9377
|
state2,
|
|
@@ -9686,6 +9651,7 @@ export {
|
|
|
9686
9651
|
replace,
|
|
9687
9652
|
ErrorResponseImpl,
|
|
9688
9653
|
isRouteErrorResponse,
|
|
9654
|
+
href,
|
|
9689
9655
|
IDLE_NAVIGATION,
|
|
9690
9656
|
IDLE_FETCHER,
|
|
9691
9657
|
IDLE_BLOCKER,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { R as RouterProviderProps$1 } from './fog-of-war-
|
|
3
|
-
import './route-data-
|
|
2
|
+
import { R as RouterProviderProps$1 } from './fog-of-war-CNAMmxww.mjs';
|
|
3
|
+
import './route-data-ii4CGe_J.mjs';
|
|
4
4
|
|
|
5
5
|
type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
|
|
6
6
|
declare function RouterProvider(props: Omit<RouterProviderProps, "flushSync">): React.JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { R as RouterProviderProps$1 } from './fog-of-war-
|
|
3
|
-
import './route-data-
|
|
2
|
+
import { R as RouterProviderProps$1 } from './fog-of-war-BDX71M75.js';
|
|
3
|
+
import './route-data-ii4CGe_J.js';
|
|
4
4
|
|
|
5
5
|
type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
|
|
6
6
|
declare function RouterProvider(props: Omit<RouterProviderProps, "flushSync">): React.JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-208f173a8
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -197,13 +197,13 @@ function getUrlBasedHistory(getLocation, createHref, validateLocation, options =
|
|
|
197
197
|
}
|
|
198
198
|
function createURL(to) {
|
|
199
199
|
let base = window2.location.origin !== "null" ? window2.location.origin : window2.location.href;
|
|
200
|
-
let
|
|
201
|
-
|
|
200
|
+
let href2 = typeof to === "string" ? to : createPath(to);
|
|
201
|
+
href2 = href2.replace(/ $/, "%20");
|
|
202
202
|
invariant(
|
|
203
203
|
base,
|
|
204
|
-
`No window.location.(origin|href) available to create URL for href: ${
|
|
204
|
+
`No window.location.(origin|href) available to create URL for href: ${href2}`
|
|
205
205
|
);
|
|
206
|
-
return new URL(
|
|
206
|
+
return new URL(href2, base);
|
|
207
207
|
}
|
|
208
208
|
let history = {
|
|
209
209
|
get action() {
|
|
@@ -1567,7 +1567,7 @@ function createRouter(init) {
|
|
|
1567
1567
|
});
|
|
1568
1568
|
return new Map(state.fetchers);
|
|
1569
1569
|
}
|
|
1570
|
-
async function fetch2(key, routeId,
|
|
1570
|
+
async function fetch2(key, routeId, href2, opts) {
|
|
1571
1571
|
abortFetcher(key);
|
|
1572
1572
|
let flushSync2 = (opts && opts.flushSync) === true;
|
|
1573
1573
|
let routesToUse = inFlightDataRoutes || dataRoutes;
|
|
@@ -1575,7 +1575,7 @@ function createRouter(init) {
|
|
|
1575
1575
|
state.location,
|
|
1576
1576
|
state.matches,
|
|
1577
1577
|
basename,
|
|
1578
|
-
|
|
1578
|
+
href2,
|
|
1579
1579
|
routeId,
|
|
1580
1580
|
opts?.relative
|
|
1581
1581
|
);
|
|
@@ -4228,7 +4228,7 @@ async function loadRouteModule(route, routeModulesCache) {
|
|
|
4228
4228
|
// lib/dom/ssr/links.ts
|
|
4229
4229
|
function getRouteCssDescriptors(route) {
|
|
4230
4230
|
if (!route.css) return [];
|
|
4231
|
-
return route.css.map((
|
|
4231
|
+
return route.css.map((href2) => ({ rel: "stylesheet", href: href2 }));
|
|
4232
4232
|
}
|
|
4233
4233
|
async function prefetchRouteCss(route) {
|
|
4234
4234
|
if (!route.css) return;
|
|
@@ -4353,24 +4353,11 @@ async function createRequestInit(request) {
|
|
|
4353
4353
|
|
|
4354
4354
|
// lib/dom/ssr/single-fetch.tsx
|
|
4355
4355
|
var SingleFetchRedirectSymbol = Symbol("SingleFetchRedirect");
|
|
4356
|
-
function getSingleFetchDataStrategy(manifest, routeModules,
|
|
4356
|
+
function getSingleFetchDataStrategy(manifest, routeModules, getRouter) {
|
|
4357
4357
|
return async ({ request, matches, fetcherKey }) => {
|
|
4358
4358
|
if (request.method !== "GET") {
|
|
4359
4359
|
return singleFetchActionStrategy(request, matches);
|
|
4360
4360
|
}
|
|
4361
|
-
if (!ssr) {
|
|
4362
|
-
let foundLoaderBelowRoot = matches.some(
|
|
4363
|
-
(m) => m.route.id !== "root" && manifest.routes[m.route.id]?.hasLoader
|
|
4364
|
-
);
|
|
4365
|
-
if (!foundLoaderBelowRoot) {
|
|
4366
|
-
let matchesToLoad = matches.filter((m) => m.shouldLoad);
|
|
4367
|
-
let results = await Promise.all(matchesToLoad.map((m) => m.resolve()));
|
|
4368
|
-
return results.reduce(
|
|
4369
|
-
(acc, result, i) => Object.assign(acc, { [matchesToLoad[i].route.id]: result }),
|
|
4370
|
-
{}
|
|
4371
|
-
);
|
|
4372
|
-
}
|
|
4373
|
-
}
|
|
4374
4361
|
if (fetcherKey) {
|
|
4375
4362
|
return singleFetchLoaderFetcherStrategy(request, matches);
|
|
4376
4363
|
}
|
|
@@ -4804,12 +4791,11 @@ function getRouteComponents(route, routeModule, isSpaMode) {
|
|
|
4804
4791
|
}
|
|
4805
4792
|
return { Component: Component4, ErrorBoundary, HydrateFallback };
|
|
4806
4793
|
}
|
|
4807
|
-
function createClientRoutesWithHMRRevalidationOptOut(needsRevalidation, manifest, routeModulesCache, initialState,
|
|
4794
|
+
function createClientRoutesWithHMRRevalidationOptOut(needsRevalidation, manifest, routeModulesCache, initialState, future, isSpaMode) {
|
|
4808
4795
|
return createClientRoutes(
|
|
4809
4796
|
manifest,
|
|
4810
4797
|
routeModulesCache,
|
|
4811
4798
|
initialState,
|
|
4812
|
-
ssr,
|
|
4813
4799
|
isSpaMode,
|
|
4814
4800
|
"",
|
|
4815
4801
|
groupRoutesByParentId(manifest),
|
|
@@ -4818,14 +4804,14 @@ function createClientRoutesWithHMRRevalidationOptOut(needsRevalidation, manifest
|
|
|
4818
4804
|
}
|
|
4819
4805
|
function preventInvalidServerHandlerCall(type, route, isSpaMode) {
|
|
4820
4806
|
if (isSpaMode) {
|
|
4821
|
-
let
|
|
4822
|
-
let
|
|
4823
|
-
console.error(
|
|
4824
|
-
throw new ErrorResponseImpl(400, "Bad Request", new Error(
|
|
4807
|
+
let fn2 = type === "action" ? "serverAction()" : "serverLoader()";
|
|
4808
|
+
let msg2 = `You cannot call ${fn2} in SPA Mode (routeId: "${route.id}")`;
|
|
4809
|
+
console.error(msg2);
|
|
4810
|
+
throw new ErrorResponseImpl(400, "Bad Request", new Error(msg2), true);
|
|
4825
4811
|
}
|
|
4812
|
+
let fn = type === "action" ? "serverAction()" : "serverLoader()";
|
|
4813
|
+
let msg = `You are trying to call ${fn} on a route that does not have a server ${type} (routeId: "${route.id}")`;
|
|
4826
4814
|
if (type === "loader" && !route.hasLoader || type === "action" && !route.hasAction) {
|
|
4827
|
-
let fn = type === "action" ? "serverAction()" : "serverLoader()";
|
|
4828
|
-
let msg = `You are trying to call ${fn} on a route that does not have a server ${type} (routeId: "${route.id}")`;
|
|
4829
4815
|
console.error(msg);
|
|
4830
4816
|
throw new ErrorResponseImpl(400, "Bad Request", new Error(msg), true);
|
|
4831
4817
|
}
|
|
@@ -4836,7 +4822,7 @@ function noActionDefinedError(type, routeId) {
|
|
|
4836
4822
|
console.error(msg);
|
|
4837
4823
|
throw new ErrorResponseImpl(405, "Method Not Allowed", new Error(msg), true);
|
|
4838
4824
|
}
|
|
4839
|
-
function createClientRoutes(manifest, routeModulesCache, initialState,
|
|
4825
|
+
function createClientRoutes(manifest, routeModulesCache, initialState, isSpaMode, parentId = "", routesByParentId = groupRoutesByParentId(manifest), needsRevalidation) {
|
|
4840
4826
|
return (routesByParentId[parentId] || []).map((route) => {
|
|
4841
4827
|
let routeModule = routeModulesCache[route.id];
|
|
4842
4828
|
function fetchServerHandler(singleFetch) {
|
|
@@ -4890,18 +4876,10 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
|
|
|
4890
4876
|
...dataRoute,
|
|
4891
4877
|
...getRouteComponents(route, routeModule, isSpaMode),
|
|
4892
4878
|
handle: routeModule.handle,
|
|
4893
|
-
shouldRevalidate: (
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
// submitting to a clientAction on a non-prerendered path, we don't
|
|
4898
|
-
// try to reach out for a non-existent `.data` file which would have
|
|
4899
|
-
// the "revalidated" root data
|
|
4900
|
-
!ssr && route.id === "root" && route.hasLoader && !route.hasClientLoader ? () => false : getShouldRevalidateFunction(
|
|
4901
|
-
routeModule,
|
|
4902
|
-
route.id,
|
|
4903
|
-
needsRevalidation
|
|
4904
|
-
)
|
|
4879
|
+
shouldRevalidate: getShouldRevalidateFunction(
|
|
4880
|
+
routeModule,
|
|
4881
|
+
route.id,
|
|
4882
|
+
needsRevalidation
|
|
4905
4883
|
)
|
|
4906
4884
|
});
|
|
4907
4885
|
let hasInitialData = initialState && initialState.loaderData && route.id in initialState.loaderData;
|
|
@@ -4917,6 +4895,7 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
|
|
|
4917
4895
|
"No `routeModule` available for critical-route loader"
|
|
4918
4896
|
);
|
|
4919
4897
|
if (!routeModule.clientLoader) {
|
|
4898
|
+
if (isSpaMode) return null;
|
|
4920
4899
|
return fetchServerLoader(singleFetch);
|
|
4921
4900
|
}
|
|
4922
4901
|
return routeModule.clientLoader({
|
|
@@ -4971,6 +4950,7 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
|
|
|
4971
4950
|
} else {
|
|
4972
4951
|
if (!route.hasClientLoader) {
|
|
4973
4952
|
dataRoute.loader = ({ request }, singleFetch) => prefetchStylesAndCallHandler(() => {
|
|
4953
|
+
if (isSpaMode) return Promise.resolve(null);
|
|
4974
4954
|
return fetchServerLoader(singleFetch);
|
|
4975
4955
|
});
|
|
4976
4956
|
} else if (route.clientLoaderModule) {
|
|
@@ -5067,7 +5047,6 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
|
|
|
5067
5047
|
manifest,
|
|
5068
5048
|
routeModulesCache,
|
|
5069
5049
|
initialState,
|
|
5070
|
-
ssr,
|
|
5071
5050
|
isSpaMode,
|
|
5072
5051
|
route.id,
|
|
5073
5052
|
routesByParentId,
|
|
@@ -5175,7 +5154,6 @@ function getPatchRoutesOnNavigationFunction(manifest, routeModules, ssr, isSpaMo
|
|
|
5175
5154
|
[path],
|
|
5176
5155
|
manifest,
|
|
5177
5156
|
routeModules,
|
|
5178
|
-
ssr,
|
|
5179
5157
|
isSpaMode,
|
|
5180
5158
|
basename,
|
|
5181
5159
|
patch,
|
|
@@ -5215,7 +5193,6 @@ function useFogOFWarDiscovery(router2, manifest, routeModules, ssr, isSpaMode) {
|
|
|
5215
5193
|
lazyPaths,
|
|
5216
5194
|
manifest,
|
|
5217
5195
|
routeModules,
|
|
5218
|
-
ssr,
|
|
5219
5196
|
isSpaMode,
|
|
5220
5197
|
router2.basename,
|
|
5221
5198
|
router2.patchRoutes
|
|
@@ -5236,7 +5213,7 @@ function useFogOFWarDiscovery(router2, manifest, routeModules, ssr, isSpaMode) {
|
|
|
5236
5213
|
return () => observer.disconnect();
|
|
5237
5214
|
}, [ssr, isSpaMode, manifest, routeModules, router2]);
|
|
5238
5215
|
}
|
|
5239
|
-
async function fetchAndApplyManifestPatches(paths, manifest, routeModules,
|
|
5216
|
+
async function fetchAndApplyManifestPatches(paths, manifest, routeModules, isSpaMode, basename, patchRoutes, signal) {
|
|
5240
5217
|
let manifestPath = `${basename != null ? basename : "/"}/__manifest`.replace(
|
|
5241
5218
|
/\/+/g,
|
|
5242
5219
|
"/"
|
|
@@ -5279,7 +5256,7 @@ async function fetchAndApplyManifestPatches(paths, manifest, routeModules, ssr,
|
|
|
5279
5256
|
parentIds.forEach(
|
|
5280
5257
|
(parentId) => patchRoutes(
|
|
5281
5258
|
parentId || null,
|
|
5282
|
-
createClientRoutes(patches, routeModules, null,
|
|
5259
|
+
createClientRoutes(patches, routeModules, null, isSpaMode, parentId)
|
|
5283
5260
|
)
|
|
5284
5261
|
);
|
|
5285
5262
|
}
|
|
@@ -5540,17 +5517,13 @@ function createHydratedRouter() {
|
|
|
5540
5517
|
ssrInfo.manifest.routes,
|
|
5541
5518
|
ssrInfo.routeModules,
|
|
5542
5519
|
ssrInfo.context.state,
|
|
5543
|
-
ssrInfo.context.ssr,
|
|
5544
5520
|
ssrInfo.context.isSpaMode
|
|
5545
5521
|
);
|
|
5546
5522
|
let hydrationData = void 0;
|
|
5547
|
-
|
|
5548
|
-
if (ssrInfo.context.isSpaMode) {
|
|
5549
|
-
hydrationData = { loaderData };
|
|
5550
|
-
} else {
|
|
5523
|
+
if (!ssrInfo.context.isSpaMode) {
|
|
5551
5524
|
hydrationData = {
|
|
5552
5525
|
...ssrInfo.context.state,
|
|
5553
|
-
loaderData: { ...loaderData }
|
|
5526
|
+
loaderData: { ...ssrInfo.context.state.loaderData }
|
|
5554
5527
|
};
|
|
5555
5528
|
let initialMatches = matchRoutes(
|
|
5556
5529
|
routes,
|
|
@@ -5583,12 +5556,9 @@ function createHydratedRouter() {
|
|
|
5583
5556
|
basename: ssrInfo.context.basename,
|
|
5584
5557
|
hydrationData,
|
|
5585
5558
|
mapRouteProperties,
|
|
5586
|
-
|
|
5587
|
-
// to fetch `.data` requests from and no prerendered `.data` files to serve
|
|
5588
|
-
dataStrategy: ssrInfo.context.isSpaMode ? void 0 : getSingleFetchDataStrategy(
|
|
5559
|
+
dataStrategy: getSingleFetchDataStrategy(
|
|
5589
5560
|
ssrInfo.manifest,
|
|
5590
5561
|
ssrInfo.routeModules,
|
|
5591
|
-
ssrInfo.context.ssr,
|
|
5592
5562
|
() => router2
|
|
5593
5563
|
),
|
|
5594
5564
|
patchRoutesOnNavigation: getPatchRoutesOnNavigationFunction(
|