react-router 0.0.0-experimental-902325fda → 0.0.0-experimental-004e483a8
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-VZXENIAS.mjs} +47 -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-Cb_zl3s5.d.mts} +3 -3
- package/dist/development/{fog-of-war-Ax4Jg2xL.d.ts → fog-of-war-DedGgQYl.d.ts} +3 -3
- package/dist/development/index.d.mts +5 -9
- package/dist/development/index.d.ts +5 -9
- package/dist/development/index.js +48 -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-C9TPjece.d.mts} +12 -1
- package/dist/{production/route-data-DQbTMaUY.d.mts → development/route-data-C9TPjece.d.ts} +12 -1
- package/dist/production/{chunk-IS6LEE6H.mjs → chunk-F4BNNTOO.mjs} +47 -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-Cb_zl3s5.d.mts} +3 -3
- package/dist/production/{fog-of-war-Cyo_TZuh.d.mts → fog-of-war-DedGgQYl.d.ts} +3 -3
- package/dist/production/index.d.mts +5 -9
- package/dist/production/index.d.ts +5 -9
- package/dist/production/index.js +48 -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-C9TPjece.d.mts} +12 -1
- package/dist/{development/route-data-DQbTMaUY.d.mts → production/route-data-C9TPjece.d.ts} +12 -1
- 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-004e483a8
|
|
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,9 @@ 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
|
+
return "";
|
|
845
|
+
}
|
|
843
846
|
|
|
844
847
|
// lib/router/router.ts
|
|
845
848
|
var validMutationMethodsArr = [
|
|
@@ -1710,7 +1713,7 @@ function createRouter(init) {
|
|
|
1710
1713
|
});
|
|
1711
1714
|
return new Map(state.fetchers);
|
|
1712
1715
|
}
|
|
1713
|
-
async function fetch2(key, routeId,
|
|
1716
|
+
async function fetch2(key, routeId, href2, opts) {
|
|
1714
1717
|
abortFetcher(key);
|
|
1715
1718
|
let flushSync = (opts && opts.flushSync) === true;
|
|
1716
1719
|
let routesToUse = inFlightDataRoutes || dataRoutes;
|
|
@@ -1718,7 +1721,7 @@ function createRouter(init) {
|
|
|
1718
1721
|
state.location,
|
|
1719
1722
|
state.matches,
|
|
1720
1723
|
basename,
|
|
1721
|
-
|
|
1724
|
+
href2,
|
|
1722
1725
|
routeId,
|
|
1723
1726
|
opts?.relative
|
|
1724
1727
|
);
|
|
@@ -5356,7 +5359,7 @@ function getKeyedLinksForMatches(matches, routeModules, manifest) {
|
|
|
5356
5359
|
let module = routeModules[match.route.id];
|
|
5357
5360
|
let route = manifest.routes[match.route.id];
|
|
5358
5361
|
return [
|
|
5359
|
-
route && route.css ? route.css.map((
|
|
5362
|
+
route && route.css ? route.css.map((href2) => ({ rel: "stylesheet", href: href2 })) : [],
|
|
5360
5363
|
module?.links?.() || []
|
|
5361
5364
|
];
|
|
5362
5365
|
}).flat(2);
|
|
@@ -5365,7 +5368,7 @@ function getKeyedLinksForMatches(matches, routeModules, manifest) {
|
|
|
5365
5368
|
}
|
|
5366
5369
|
function getRouteCssDescriptors(route) {
|
|
5367
5370
|
if (!route.css) return [];
|
|
5368
|
-
return route.css.map((
|
|
5371
|
+
return route.css.map((href2) => ({ rel: "stylesheet", href: href2 }));
|
|
5369
5372
|
}
|
|
5370
5373
|
async function prefetchRouteCss(route) {
|
|
5371
5374
|
if (!route.css) return;
|
|
@@ -5664,24 +5667,11 @@ function StreamTransfer({
|
|
|
5664
5667
|
)));
|
|
5665
5668
|
}
|
|
5666
5669
|
}
|
|
5667
|
-
function getSingleFetchDataStrategy(manifest, routeModules,
|
|
5670
|
+
function getSingleFetchDataStrategy(manifest, routeModules, getRouter) {
|
|
5668
5671
|
return async ({ request, matches, fetcherKey }) => {
|
|
5669
5672
|
if (request.method !== "GET") {
|
|
5670
5673
|
return singleFetchActionStrategy(request, matches);
|
|
5671
5674
|
}
|
|
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
5675
|
if (fetcherKey) {
|
|
5686
5676
|
return singleFetchLoaderFetcherStrategy(request, matches);
|
|
5687
5677
|
}
|
|
@@ -6155,12 +6145,11 @@ function createServerRoutes(manifest, routeModules, future, isSpaMode, parentId
|
|
|
6155
6145
|
return dataRoute;
|
|
6156
6146
|
});
|
|
6157
6147
|
}
|
|
6158
|
-
function createClientRoutesWithHMRRevalidationOptOut(needsRevalidation, manifest, routeModulesCache, initialState,
|
|
6148
|
+
function createClientRoutesWithHMRRevalidationOptOut(needsRevalidation, manifest, routeModulesCache, initialState, future, isSpaMode) {
|
|
6159
6149
|
return createClientRoutes(
|
|
6160
6150
|
manifest,
|
|
6161
6151
|
routeModulesCache,
|
|
6162
6152
|
initialState,
|
|
6163
|
-
ssr,
|
|
6164
6153
|
isSpaMode,
|
|
6165
6154
|
"",
|
|
6166
6155
|
groupRoutesByParentId(manifest),
|
|
@@ -6169,14 +6158,14 @@ function createClientRoutesWithHMRRevalidationOptOut(needsRevalidation, manifest
|
|
|
6169
6158
|
}
|
|
6170
6159
|
function preventInvalidServerHandlerCall(type, route, isSpaMode) {
|
|
6171
6160
|
if (isSpaMode) {
|
|
6172
|
-
let
|
|
6173
|
-
let
|
|
6174
|
-
console.error(
|
|
6175
|
-
throw new ErrorResponseImpl(400, "Bad Request", new Error(
|
|
6161
|
+
let fn2 = type === "action" ? "serverAction()" : "serverLoader()";
|
|
6162
|
+
let msg2 = `You cannot call ${fn2} in SPA Mode (routeId: "${route.id}")`;
|
|
6163
|
+
console.error(msg2);
|
|
6164
|
+
throw new ErrorResponseImpl(400, "Bad Request", new Error(msg2), true);
|
|
6176
6165
|
}
|
|
6166
|
+
let fn = type === "action" ? "serverAction()" : "serverLoader()";
|
|
6167
|
+
let msg = `You are trying to call ${fn} on a route that does not have a server ${type} (routeId: "${route.id}")`;
|
|
6177
6168
|
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
6169
|
console.error(msg);
|
|
6181
6170
|
throw new ErrorResponseImpl(400, "Bad Request", new Error(msg), true);
|
|
6182
6171
|
}
|
|
@@ -6187,7 +6176,7 @@ function noActionDefinedError(type, routeId) {
|
|
|
6187
6176
|
console.error(msg);
|
|
6188
6177
|
throw new ErrorResponseImpl(405, "Method Not Allowed", new Error(msg), true);
|
|
6189
6178
|
}
|
|
6190
|
-
function createClientRoutes(manifest, routeModulesCache, initialState,
|
|
6179
|
+
function createClientRoutes(manifest, routeModulesCache, initialState, isSpaMode, parentId = "", routesByParentId = groupRoutesByParentId(manifest), needsRevalidation) {
|
|
6191
6180
|
return (routesByParentId[parentId] || []).map((route) => {
|
|
6192
6181
|
let routeModule = routeModulesCache[route.id];
|
|
6193
6182
|
function fetchServerHandler(singleFetch) {
|
|
@@ -6241,18 +6230,10 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
|
|
|
6241
6230
|
...dataRoute,
|
|
6242
6231
|
...getRouteComponents(route, routeModule, isSpaMode),
|
|
6243
6232
|
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
|
-
)
|
|
6233
|
+
shouldRevalidate: getShouldRevalidateFunction(
|
|
6234
|
+
routeModule,
|
|
6235
|
+
route.id,
|
|
6236
|
+
needsRevalidation
|
|
6256
6237
|
)
|
|
6257
6238
|
});
|
|
6258
6239
|
let hasInitialData = initialState && initialState.loaderData && route.id in initialState.loaderData;
|
|
@@ -6268,6 +6249,7 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
|
|
|
6268
6249
|
"No `routeModule` available for critical-route loader"
|
|
6269
6250
|
);
|
|
6270
6251
|
if (!routeModule.clientLoader) {
|
|
6252
|
+
if (isSpaMode) return null;
|
|
6271
6253
|
return fetchServerLoader(singleFetch);
|
|
6272
6254
|
}
|
|
6273
6255
|
return routeModule.clientLoader({
|
|
@@ -6322,6 +6304,7 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
|
|
|
6322
6304
|
} else {
|
|
6323
6305
|
if (!route.hasClientLoader) {
|
|
6324
6306
|
dataRoute.loader = ({ request }, singleFetch) => prefetchStylesAndCallHandler(() => {
|
|
6307
|
+
if (isSpaMode) return Promise.resolve(null);
|
|
6325
6308
|
return fetchServerLoader(singleFetch);
|
|
6326
6309
|
});
|
|
6327
6310
|
} else if (route.clientLoaderModule) {
|
|
@@ -6418,7 +6401,6 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
|
|
|
6418
6401
|
manifest,
|
|
6419
6402
|
routeModulesCache,
|
|
6420
6403
|
initialState,
|
|
6421
|
-
ssr,
|
|
6422
6404
|
isSpaMode,
|
|
6423
6405
|
route.id,
|
|
6424
6406
|
routesByParentId,
|
|
@@ -6526,7 +6508,6 @@ function getPatchRoutesOnNavigationFunction(manifest, routeModules, ssr, isSpaMo
|
|
|
6526
6508
|
[path],
|
|
6527
6509
|
manifest,
|
|
6528
6510
|
routeModules,
|
|
6529
|
-
ssr,
|
|
6530
6511
|
isSpaMode,
|
|
6531
6512
|
basename,
|
|
6532
6513
|
patch,
|
|
@@ -6566,7 +6547,6 @@ function useFogOFWarDiscovery(router, manifest, routeModules, ssr, isSpaMode) {
|
|
|
6566
6547
|
lazyPaths,
|
|
6567
6548
|
manifest,
|
|
6568
6549
|
routeModules,
|
|
6569
|
-
ssr,
|
|
6570
6550
|
isSpaMode,
|
|
6571
6551
|
router.basename,
|
|
6572
6552
|
router.patchRoutes
|
|
@@ -6587,7 +6567,7 @@ function useFogOFWarDiscovery(router, manifest, routeModules, ssr, isSpaMode) {
|
|
|
6587
6567
|
return () => observer.disconnect();
|
|
6588
6568
|
}, [ssr, isSpaMode, manifest, routeModules, router]);
|
|
6589
6569
|
}
|
|
6590
|
-
async function fetchAndApplyManifestPatches(paths, manifest, routeModules,
|
|
6570
|
+
async function fetchAndApplyManifestPatches(paths, manifest, routeModules, isSpaMode, basename, patchRoutes, signal) {
|
|
6591
6571
|
let manifestPath = `${basename != null ? basename : "/"}/__manifest`.replace(
|
|
6592
6572
|
/\/+/g,
|
|
6593
6573
|
"/"
|
|
@@ -6630,7 +6610,7 @@ async function fetchAndApplyManifestPatches(paths, manifest, routeModules, ssr,
|
|
|
6630
6610
|
parentIds.forEach(
|
|
6631
6611
|
(parentId) => patchRoutes(
|
|
6632
6612
|
parentId || null,
|
|
6633
|
-
createClientRoutes(patches, routeModules, null,
|
|
6613
|
+
createClientRoutes(patches, routeModules, null, isSpaMode, parentId)
|
|
6634
6614
|
)
|
|
6635
6615
|
);
|
|
6636
6616
|
}
|
|
@@ -6870,7 +6850,7 @@ function PrefetchPageLinksImpl({
|
|
|
6870
6850
|
[newMatchesForAssets, manifest]
|
|
6871
6851
|
);
|
|
6872
6852
|
let keyedPrefetchLinks = useKeyedPrefetchLinks(newMatchesForAssets);
|
|
6873
|
-
return /* @__PURE__ */ React9.createElement(React9.Fragment, null, dataHrefs.map((
|
|
6853
|
+
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
6854
|
// these don't spread `linkProps` because they are full link descriptors
|
|
6875
6855
|
// already with their own props
|
|
6876
6856
|
/* @__PURE__ */ React9.createElement("link", { key, ...link })
|
|
@@ -7110,7 +7090,7 @@ function mergeRefs(...refs) {
|
|
|
7110
7090
|
var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
7111
7091
|
try {
|
|
7112
7092
|
if (isBrowser) {
|
|
7113
|
-
window.__reactRouterVersion = "0.0.0-experimental-
|
|
7093
|
+
window.__reactRouterVersion = "0.0.0-experimental-004e483a8";
|
|
7114
7094
|
}
|
|
7115
7095
|
} catch (e) {
|
|
7116
7096
|
}
|
|
@@ -7313,7 +7293,7 @@ var Link = React10.forwardRef(
|
|
|
7313
7293
|
}
|
|
7314
7294
|
}
|
|
7315
7295
|
}
|
|
7316
|
-
let
|
|
7296
|
+
let href2 = useHref(to, { relative });
|
|
7317
7297
|
let [shouldPrefetch, prefetchRef, prefetchHandlers] = usePrefetchBehavior(
|
|
7318
7298
|
prefetch,
|
|
7319
7299
|
rest
|
|
@@ -7339,7 +7319,7 @@ var Link = React10.forwardRef(
|
|
|
7339
7319
|
{
|
|
7340
7320
|
...rest,
|
|
7341
7321
|
...prefetchHandlers,
|
|
7342
|
-
href: absoluteHref ||
|
|
7322
|
+
href: absoluteHref || href2,
|
|
7343
7323
|
onClick: isExternal || reloadDocument ? onClick : handleClick,
|
|
7344
7324
|
ref: mergeRefs(forwardedRef, prefetchRef),
|
|
7345
7325
|
target,
|
|
@@ -7347,7 +7327,7 @@ var Link = React10.forwardRef(
|
|
|
7347
7327
|
}
|
|
7348
7328
|
)
|
|
7349
7329
|
);
|
|
7350
|
-
return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React10.createElement(React10.Fragment, null, link, /* @__PURE__ */ React10.createElement(PrefetchPageLinks, { page:
|
|
7330
|
+
return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React10.createElement(React10.Fragment, null, link, /* @__PURE__ */ React10.createElement(PrefetchPageLinks, { page: href2 })) : link;
|
|
7351
7331
|
}
|
|
7352
7332
|
);
|
|
7353
7333
|
Link.displayName = "Link";
|
|
@@ -7703,9 +7683,9 @@ function useFetcher({
|
|
|
7703
7683
|
return () => router.deleteFetcher(fetcherKey);
|
|
7704
7684
|
}, [router, fetcherKey]);
|
|
7705
7685
|
let load = React10.useCallback(
|
|
7706
|
-
async (
|
|
7686
|
+
async (href2, opts) => {
|
|
7707
7687
|
invariant(routeId, "No routeId available for fetcher.load()");
|
|
7708
|
-
await router.fetch(fetcherKey, routeId,
|
|
7688
|
+
await router.fetch(fetcherKey, routeId, href2, opts);
|
|
7709
7689
|
},
|
|
7710
7690
|
[fetcherKey, routeId, router]
|
|
7711
7691
|
);
|
|
@@ -8162,9 +8142,9 @@ function createHref(to) {
|
|
|
8162
8142
|
return typeof to === "string" ? to : createPath(to);
|
|
8163
8143
|
}
|
|
8164
8144
|
function encodeLocation(to) {
|
|
8165
|
-
let
|
|
8166
|
-
|
|
8167
|
-
let encoded = ABSOLUTE_URL_REGEX3.test(
|
|
8145
|
+
let href2 = typeof to === "string" ? to : createPath(to);
|
|
8146
|
+
href2 = href2.replace(/ $/, "%20");
|
|
8147
|
+
let encoded = ABSOLUTE_URL_REGEX3.test(href2) ? new URL(href2) : new URL(href2, "http://localhost");
|
|
8168
8148
|
return {
|
|
8169
8149
|
pathname: encoded.pathname,
|
|
8170
8150
|
search: encoded.search,
|
|
@@ -9115,10 +9095,6 @@ var createRequestHandler = (build, mode) => {
|
|
|
9115
9095
|
errorHandler = derived.errorHandler;
|
|
9116
9096
|
}
|
|
9117
9097
|
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
9098
|
let params = {};
|
|
9123
9099
|
let handleError = (error) => {
|
|
9124
9100
|
if (mode === "development" /* Development */) {
|
|
@@ -9130,25 +9106,6 @@ var createRequestHandler = (build, mode) => {
|
|
|
9130
9106
|
request
|
|
9131
9107
|
});
|
|
9132
9108
|
};
|
|
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
9109
|
let manifestUrl = `${_build.basename ?? "/"}/__manifest`.replace(
|
|
9153
9110
|
/\/+/g,
|
|
9154
9111
|
"/"
|
|
@@ -9169,7 +9126,7 @@ var createRequestHandler = (build, mode) => {
|
|
|
9169
9126
|
let response;
|
|
9170
9127
|
if (url.pathname.endsWith(".data")) {
|
|
9171
9128
|
let handlerUrl = new URL(request.url);
|
|
9172
|
-
handlerUrl.pathname =
|
|
9129
|
+
handlerUrl.pathname = handlerUrl.pathname.replace(/\.data$/, "").replace(/^\/_root$/, "/");
|
|
9173
9130
|
let singleFetchMatches = matchServerRoutes(
|
|
9174
9131
|
routes,
|
|
9175
9132
|
handlerUrl.pathname,
|
|
@@ -9309,7 +9266,6 @@ async function handleSingleFetchRequest(serverMode, build, staticHandler, reques
|
|
|
9309
9266
|
);
|
|
9310
9267
|
}
|
|
9311
9268
|
async function handleDocumentRequest(serverMode, build, staticHandler, request, loadContext, handleError, criticalCss) {
|
|
9312
|
-
let isSpaMode = request.headers.has("X-React-Router-SPA-Mode");
|
|
9313
9269
|
let context;
|
|
9314
9270
|
try {
|
|
9315
9271
|
context = await staticHandler.query(request, {
|
|
@@ -9349,7 +9305,7 @@ async function handleDocumentRequest(serverMode, build, staticHandler, request,
|
|
|
9349
9305
|
criticalCss,
|
|
9350
9306
|
future: build.future,
|
|
9351
9307
|
ssr: build.ssr,
|
|
9352
|
-
isSpaMode
|
|
9308
|
+
isSpaMode: build.isSpaMode
|
|
9353
9309
|
}),
|
|
9354
9310
|
serverHandoffStream: encodeViaTurboStream(
|
|
9355
9311
|
state,
|
|
@@ -9360,7 +9316,7 @@ async function handleDocumentRequest(serverMode, build, staticHandler, request,
|
|
|
9360
9316
|
renderMeta: {},
|
|
9361
9317
|
future: build.future,
|
|
9362
9318
|
ssr: build.ssr,
|
|
9363
|
-
isSpaMode,
|
|
9319
|
+
isSpaMode: build.isSpaMode,
|
|
9364
9320
|
serializeError: (err) => serializeError(err, serverMode)
|
|
9365
9321
|
};
|
|
9366
9322
|
let handleDocumentRequestFunction = build.entry.module.default;
|
|
@@ -9406,7 +9362,7 @@ async function handleDocumentRequest(serverMode, build, staticHandler, request,
|
|
|
9406
9362
|
basename: build.basename,
|
|
9407
9363
|
future: build.future,
|
|
9408
9364
|
ssr: build.ssr,
|
|
9409
|
-
isSpaMode
|
|
9365
|
+
isSpaMode: build.isSpaMode
|
|
9410
9366
|
}),
|
|
9411
9367
|
serverHandoffStream: encodeViaTurboStream(
|
|
9412
9368
|
state2,
|
|
@@ -9686,6 +9642,7 @@ export {
|
|
|
9686
9642
|
replace,
|
|
9687
9643
|
ErrorResponseImpl,
|
|
9688
9644
|
isRouteErrorResponse,
|
|
9645
|
+
href,
|
|
9689
9646
|
IDLE_NAVIGATION,
|
|
9690
9647
|
IDLE_FETCHER,
|
|
9691
9648
|
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-Cb_zl3s5.mjs';
|
|
3
|
+
import './route-data-C9TPjece.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-DedGgQYl.js';
|
|
3
|
+
import './route-data-C9TPjece.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-004e483a8
|
|
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(
|