react-router 0.0.0-experimental-9ea41ead4 → 0.0.0-experimental-759a11a62
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-RSP5WONC.mjs → chunk-5WLC4F5Z.mjs} +62 -137
- package/dist/development/dom-export.d.mts +2 -2
- package/dist/development/dom-export.d.ts +2 -2
- package/dist/development/dom-export.js +21 -132
- package/dist/development/dom-export.mjs +2 -2
- package/dist/{production/fog-of-war-B3edLoNW.d.ts → development/fog-of-war-BCniP0AZ.d.mts} +68 -71
- package/dist/development/{fog-of-war-B3edLoNW.d.ts → fog-of-war-DFo9BKir.d.ts} +68 -71
- package/dist/development/index.d.mts +5 -6
- package/dist/development/index.d.ts +5 -6
- package/dist/development/index.js +63 -137
- package/dist/development/index.mjs +4 -2
- package/dist/development/lib/types/index.d.mts +2 -0
- package/dist/development/lib/types/index.d.ts +2 -0
- package/dist/development/lib/types/index.js +28 -0
- package/dist/development/lib/types/index.mjs +10 -0
- package/dist/development/lib/types/route-module.d.mts +1 -108
- package/dist/development/lib/types/route-module.d.ts +1 -108
- package/dist/development/lib/types/route-module.js +1 -1
- package/dist/development/lib/types/route-module.mjs +1 -1
- package/dist/{production/route-data-JFOfNyPS.d.mts → development/router-BYH9f2xg.d.mts} +1452 -1151
- package/dist/development/{route-data-JFOfNyPS.d.mts → router-BYH9f2xg.d.ts} +1452 -1151
- package/dist/production/{chunk-3VYQCA5J.mjs → chunk-QJ3CF3ZA.mjs} +62 -137
- package/dist/production/dom-export.d.mts +2 -2
- package/dist/production/dom-export.d.ts +2 -2
- package/dist/production/dom-export.js +21 -132
- package/dist/production/dom-export.mjs +2 -2
- package/dist/{development/fog-of-war-CTZ6x_bd.d.mts → production/fog-of-war-BCniP0AZ.d.mts} +68 -71
- package/dist/production/{fog-of-war-CTZ6x_bd.d.mts → fog-of-war-DFo9BKir.d.ts} +68 -71
- package/dist/production/index.d.mts +5 -6
- package/dist/production/index.d.ts +5 -6
- package/dist/production/index.js +63 -137
- package/dist/production/index.mjs +4 -2
- package/dist/production/lib/types/index.d.mts +2 -0
- package/dist/production/lib/types/index.d.ts +2 -0
- package/dist/production/lib/types/index.js +28 -0
- package/dist/production/lib/types/index.mjs +10 -0
- package/dist/production/lib/types/route-module.d.mts +1 -108
- package/dist/production/lib/types/route-module.d.ts +1 -108
- package/dist/production/lib/types/route-module.js +1 -1
- package/dist/production/lib/types/route-module.mjs +1 -1
- package/dist/{development/route-data-JFOfNyPS.d.ts → production/router-BYH9f2xg.d.mts} +1452 -1151
- package/dist/production/{route-data-JFOfNyPS.d.ts → router-BYH9f2xg.d.ts} +1452 -1151
- package/package.json +9 -1
- package/dist/development/data-CQbyyGzl.d.mts +0 -11
- package/dist/development/data-CQbyyGzl.d.ts +0 -11
- package/dist/production/data-CQbyyGzl.d.mts +0 -11
- package/dist/production/data-CQbyyGzl.d.ts +0 -11
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-759a11a62
|
|
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,15 @@ 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
|
+
return params[param];
|
|
850
|
+
}).join("/");
|
|
851
|
+
}
|
|
843
852
|
|
|
844
853
|
// lib/router/router.ts
|
|
845
854
|
var validMutationMethodsArr = [
|
|
@@ -1705,7 +1714,7 @@ function createRouter(init) {
|
|
|
1705
1714
|
});
|
|
1706
1715
|
return new Map(state.fetchers);
|
|
1707
1716
|
}
|
|
1708
|
-
async function fetch2(key, routeId,
|
|
1717
|
+
async function fetch2(key, routeId, href2, opts) {
|
|
1709
1718
|
abortFetcher(key);
|
|
1710
1719
|
let flushSync = (opts && opts.flushSync) === true;
|
|
1711
1720
|
let routesToUse = inFlightDataRoutes || dataRoutes;
|
|
@@ -1713,7 +1722,7 @@ function createRouter(init) {
|
|
|
1713
1722
|
state.location,
|
|
1714
1723
|
state.matches,
|
|
1715
1724
|
basename,
|
|
1716
|
-
|
|
1725
|
+
href2,
|
|
1717
1726
|
routeId,
|
|
1718
1727
|
opts?.relative
|
|
1719
1728
|
);
|
|
@@ -5344,18 +5353,18 @@ function getKeyedLinksForMatches(matches, routeModules, manifest) {
|
|
|
5344
5353
|
let module = routeModules[match.route.id];
|
|
5345
5354
|
let route = manifest.routes[match.route.id];
|
|
5346
5355
|
return [
|
|
5347
|
-
route && route.css ? route.css.map((
|
|
5356
|
+
route && route.css ? route.css.map((href2) => ({ rel: "stylesheet", href: href2 })) : [],
|
|
5348
5357
|
module?.links?.() || []
|
|
5349
5358
|
];
|
|
5350
5359
|
}).flat(2);
|
|
5351
|
-
let preloads =
|
|
5360
|
+
let preloads = getCurrentPageModulePreloadHrefs(matches, manifest);
|
|
5352
5361
|
return dedupeLinkDescriptors(descriptors, preloads);
|
|
5353
5362
|
}
|
|
5354
5363
|
async function prefetchStyleLinks(route, routeModule) {
|
|
5355
5364
|
if (!route.css && !routeModule.links || !isPreloadSupported()) return;
|
|
5356
5365
|
let descriptors = [];
|
|
5357
5366
|
if (route.css) {
|
|
5358
|
-
descriptors.push(...route.css.map((
|
|
5367
|
+
descriptors.push(...route.css.map((href2) => ({ rel: "stylesheet", href: href2 })));
|
|
5359
5368
|
}
|
|
5360
5369
|
if (routeModule.links) {
|
|
5361
5370
|
descriptors.push(...routeModule.links());
|
|
@@ -5472,21 +5481,25 @@ function getNewMatchesForLinks(page, nextMatches, currentMatches, manifest, loca
|
|
|
5472
5481
|
}
|
|
5473
5482
|
return [];
|
|
5474
5483
|
}
|
|
5475
|
-
function getModuleLinkHrefs(matches,
|
|
5484
|
+
function getModuleLinkHrefs(matches, manifestPatch) {
|
|
5476
5485
|
return dedupeHrefs(
|
|
5477
5486
|
matches.map((match) => {
|
|
5478
|
-
let route =
|
|
5487
|
+
let route = manifestPatch.routes[match.route.id];
|
|
5479
5488
|
if (!route) return [];
|
|
5480
5489
|
let hrefs = [route.module];
|
|
5481
|
-
if (route.
|
|
5482
|
-
hrefs = hrefs.concat(route.
|
|
5483
|
-
}
|
|
5484
|
-
if (route.clientLoaderModule) {
|
|
5485
|
-
hrefs = hrefs.concat(route.clientLoaderModule);
|
|
5486
|
-
}
|
|
5487
|
-
if (includeHydrateFallback && route.hydrateFallbackModule) {
|
|
5488
|
-
hrefs = hrefs.concat(route.hydrateFallbackModule);
|
|
5490
|
+
if (route.imports) {
|
|
5491
|
+
hrefs = hrefs.concat(route.imports);
|
|
5489
5492
|
}
|
|
5493
|
+
return hrefs;
|
|
5494
|
+
}).flat(1)
|
|
5495
|
+
);
|
|
5496
|
+
}
|
|
5497
|
+
function getCurrentPageModulePreloadHrefs(matches, manifest) {
|
|
5498
|
+
return dedupeHrefs(
|
|
5499
|
+
matches.map((match) => {
|
|
5500
|
+
let route = manifest.routes[match.route.id];
|
|
5501
|
+
if (!route) return [];
|
|
5502
|
+
let hrefs = [route.module];
|
|
5490
5503
|
if (route.imports) {
|
|
5491
5504
|
hrefs = hrefs.concat(route.imports);
|
|
5492
5505
|
}
|
|
@@ -6162,21 +6175,6 @@ function createClientRoutes(manifest, routeModulesCache, initialState, isSpaMode
|
|
|
6162
6175
|
}
|
|
6163
6176
|
return fetchServerHandler(singleFetch);
|
|
6164
6177
|
}
|
|
6165
|
-
function prefetchModule(modulePath) {
|
|
6166
|
-
import(
|
|
6167
|
-
/* @vite-ignore */
|
|
6168
|
-
/* webpackIgnore: true */
|
|
6169
|
-
modulePath
|
|
6170
|
-
);
|
|
6171
|
-
}
|
|
6172
|
-
function prefetchRouteModuleChunks(route2) {
|
|
6173
|
-
if (route2.clientActionModule) {
|
|
6174
|
-
prefetchModule(route2.clientActionModule);
|
|
6175
|
-
}
|
|
6176
|
-
if (route2.clientLoaderModule) {
|
|
6177
|
-
prefetchModule(route2.clientLoaderModule);
|
|
6178
|
-
}
|
|
6179
|
-
}
|
|
6180
6178
|
async function prefetchStylesAndCallHandler(handler) {
|
|
6181
6179
|
let cachedModule = routeModulesCache[route.id];
|
|
6182
6180
|
let linkPrefetchPromise = cachedModule ? prefetchStyleLinks(route, cachedModule) : Promise.resolve();
|
|
@@ -6273,22 +6271,6 @@ function createClientRoutes(manifest, routeModulesCache, initialState, isSpaMode
|
|
|
6273
6271
|
if (isSpaMode) return Promise.resolve(null);
|
|
6274
6272
|
return fetchServerLoader(singleFetch);
|
|
6275
6273
|
});
|
|
6276
|
-
} else if (route.clientLoaderModule) {
|
|
6277
|
-
dataRoute.loader = async (args, singleFetch) => {
|
|
6278
|
-
invariant2(route.clientLoaderModule);
|
|
6279
|
-
let { clientLoader } = await import(
|
|
6280
|
-
/* @vite-ignore */
|
|
6281
|
-
/* webpackIgnore: true */
|
|
6282
|
-
route.clientLoaderModule
|
|
6283
|
-
);
|
|
6284
|
-
return clientLoader({
|
|
6285
|
-
...args,
|
|
6286
|
-
async serverLoader() {
|
|
6287
|
-
preventInvalidServerHandlerCall("loader", route, isSpaMode);
|
|
6288
|
-
return fetchServerLoader(singleFetch);
|
|
6289
|
-
}
|
|
6290
|
-
});
|
|
6291
|
-
};
|
|
6292
6274
|
}
|
|
6293
6275
|
if (!route.hasClientAction) {
|
|
6294
6276
|
dataRoute.action = ({ request }, singleFetch) => prefetchStylesAndCallHandler(() => {
|
|
@@ -6297,36 +6279,14 @@ function createClientRoutes(manifest, routeModulesCache, initialState, isSpaMode
|
|
|
6297
6279
|
}
|
|
6298
6280
|
return fetchServerAction(singleFetch);
|
|
6299
6281
|
});
|
|
6300
|
-
} else if (route.clientActionModule) {
|
|
6301
|
-
dataRoute.action = async (args, singleFetch) => {
|
|
6302
|
-
invariant2(route.clientActionModule);
|
|
6303
|
-
prefetchRouteModuleChunks(route);
|
|
6304
|
-
let { clientAction } = await import(
|
|
6305
|
-
/* @vite-ignore */
|
|
6306
|
-
/* webpackIgnore: true */
|
|
6307
|
-
route.clientActionModule
|
|
6308
|
-
);
|
|
6309
|
-
return clientAction({
|
|
6310
|
-
...args,
|
|
6311
|
-
async serverAction() {
|
|
6312
|
-
preventInvalidServerHandlerCall("action", route, isSpaMode);
|
|
6313
|
-
return fetchServerAction(singleFetch);
|
|
6314
|
-
}
|
|
6315
|
-
});
|
|
6316
|
-
};
|
|
6317
6282
|
}
|
|
6318
6283
|
dataRoute.lazy = async () => {
|
|
6319
|
-
|
|
6320
|
-
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
6321
|
-
}
|
|
6322
|
-
let modPromise = loadRouteModuleWithBlockingLinks(
|
|
6284
|
+
let mod = await loadRouteModuleWithBlockingLinks(
|
|
6323
6285
|
route,
|
|
6324
6286
|
routeModulesCache
|
|
6325
6287
|
);
|
|
6326
|
-
prefetchRouteModuleChunks(route);
|
|
6327
|
-
let mod = await modPromise;
|
|
6328
6288
|
let lazyRoute = { ...mod };
|
|
6329
|
-
if (mod.clientLoader
|
|
6289
|
+
if (mod.clientLoader) {
|
|
6330
6290
|
let clientLoader = mod.clientLoader;
|
|
6331
6291
|
lazyRoute.loader = (args, singleFetch) => clientLoader({
|
|
6332
6292
|
...args,
|
|
@@ -6336,7 +6296,7 @@ function createClientRoutes(manifest, routeModulesCache, initialState, isSpaMode
|
|
|
6336
6296
|
}
|
|
6337
6297
|
});
|
|
6338
6298
|
}
|
|
6339
|
-
if (mod.clientAction
|
|
6299
|
+
if (mod.clientAction) {
|
|
6340
6300
|
let clientAction = mod.clientAction;
|
|
6341
6301
|
lazyRoute.action = (args, singleFetch) => clientAction({
|
|
6342
6302
|
...args,
|
|
@@ -6824,7 +6784,7 @@ function PrefetchPageLinksImpl({
|
|
|
6824
6784
|
[newMatchesForAssets, manifest]
|
|
6825
6785
|
);
|
|
6826
6786
|
let keyedPrefetchLinks = useKeyedPrefetchLinks(newMatchesForAssets);
|
|
6827
|
-
return /* @__PURE__ */ React9.createElement(React9.Fragment, null, dataHrefs.map((
|
|
6787
|
+
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 }) => (
|
|
6828
6788
|
// these don't spread `linkProps` because they are full link descriptors
|
|
6829
6789
|
// already with their own props
|
|
6830
6790
|
/* @__PURE__ */ React9.createElement("link", { key, ...link })
|
|
@@ -6948,44 +6908,11 @@ function Scripts(props) {
|
|
|
6948
6908
|
let streamScript = "window.__reactRouterContext.stream = new ReadableStream({start(controller){window.__reactRouterContext.streamController = controller;}}).pipeThrough(new TextEncoderStream());";
|
|
6949
6909
|
let contextScript = staticContext ? `window.__reactRouterContext = ${serverHandoffString};${streamScript}` : " ";
|
|
6950
6910
|
let routeModulesScript = !isStatic ? " " : `${manifest.hmr?.runtime ? `import ${JSON.stringify(manifest.hmr.runtime)};` : ""}${!enableFogOfWar ? `import ${JSON.stringify(manifest.url)}` : ""};
|
|
6951
|
-
${matches.map(
|
|
6952
|
-
|
|
6953
|
-
|
|
6954
|
-
|
|
6955
|
-
|
|
6956
|
-
clientActionModule,
|
|
6957
|
-
clientLoaderModule,
|
|
6958
|
-
hydrateFallbackModule,
|
|
6959
|
-
module
|
|
6960
|
-
} = manifestEntry;
|
|
6961
|
-
let chunks = [
|
|
6962
|
-
...clientActionModule ? [
|
|
6963
|
-
{
|
|
6964
|
-
module: clientActionModule,
|
|
6965
|
-
varName: `${routeVarName}_clientAction`
|
|
6966
|
-
}
|
|
6967
|
-
] : [],
|
|
6968
|
-
...clientLoaderModule ? [
|
|
6969
|
-
{
|
|
6970
|
-
module: clientLoaderModule,
|
|
6971
|
-
varName: `${routeVarName}_clientLoader`
|
|
6972
|
-
}
|
|
6973
|
-
] : [],
|
|
6974
|
-
...hydrateFallbackModule ? [
|
|
6975
|
-
{
|
|
6976
|
-
module: hydrateFallbackModule,
|
|
6977
|
-
varName: `${routeVarName}_HydrateFallback`
|
|
6978
|
-
}
|
|
6979
|
-
] : [],
|
|
6980
|
-
{ module, varName: `${routeVarName}_main` }
|
|
6981
|
-
];
|
|
6982
|
-
if (chunks.length === 1) {
|
|
6983
|
-
return `import * as ${routeVarName} from ${JSON.stringify(module)};`;
|
|
6984
|
-
}
|
|
6985
|
-
let chunkImportsSnippet = chunks.map((chunk) => `import * as ${chunk.varName} from "${chunk.module}";`).join("\n");
|
|
6986
|
-
let mergedChunksSnippet = `const ${routeVarName} = {${chunks.map((chunk) => `...${chunk.varName}`).join(",")}};`;
|
|
6987
|
-
return [chunkImportsSnippet, mergedChunksSnippet].join("\n");
|
|
6988
|
-
}).join("\n")}
|
|
6911
|
+
${matches.map(
|
|
6912
|
+
(match, index) => `import * as route${index} from ${JSON.stringify(
|
|
6913
|
+
manifest.routes[match.route.id].module
|
|
6914
|
+
)};`
|
|
6915
|
+
).join("\n")}
|
|
6989
6916
|
${enableFogOfWar ? (
|
|
6990
6917
|
// Inline a minimal manifest with the SSR matches
|
|
6991
6918
|
`window.__reactRouterManifest = ${JSON.stringify(
|
|
@@ -7016,11 +6943,11 @@ import(${JSON.stringify(manifest.entry.module)});`;
|
|
|
7016
6943
|
}
|
|
7017
6944
|
));
|
|
7018
6945
|
}, []);
|
|
7019
|
-
let
|
|
7020
|
-
|
|
7021
|
-
|
|
7022
|
-
|
|
7023
|
-
);
|
|
6946
|
+
let routePreloads = matches.map((match) => {
|
|
6947
|
+
let route = manifest.routes[match.route.id];
|
|
6948
|
+
return route ? (route.imports || []).concat([route.module]) : [];
|
|
6949
|
+
}).flat(1);
|
|
6950
|
+
let preloads = isHydrated ? [] : manifest.entry.imports.concat(routePreloads);
|
|
7024
6951
|
return isHydrated ? null : /* @__PURE__ */ React9.createElement(React9.Fragment, null, !enableFogOfWar ? /* @__PURE__ */ React9.createElement(
|
|
7025
6952
|
"link",
|
|
7026
6953
|
{
|
|
@@ -7064,7 +6991,7 @@ function mergeRefs(...refs) {
|
|
|
7064
6991
|
var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
7065
6992
|
try {
|
|
7066
6993
|
if (isBrowser) {
|
|
7067
|
-
window.__reactRouterVersion = "0.0.0-experimental-
|
|
6994
|
+
window.__reactRouterVersion = "0.0.0-experimental-759a11a62";
|
|
7068
6995
|
}
|
|
7069
6996
|
} catch (e) {
|
|
7070
6997
|
}
|
|
@@ -7267,7 +7194,7 @@ var Link = React10.forwardRef(
|
|
|
7267
7194
|
}
|
|
7268
7195
|
}
|
|
7269
7196
|
}
|
|
7270
|
-
let
|
|
7197
|
+
let href2 = useHref(to, { relative });
|
|
7271
7198
|
let [shouldPrefetch, prefetchRef, prefetchHandlers] = usePrefetchBehavior(
|
|
7272
7199
|
prefetch,
|
|
7273
7200
|
rest
|
|
@@ -7293,7 +7220,7 @@ var Link = React10.forwardRef(
|
|
|
7293
7220
|
{
|
|
7294
7221
|
...rest,
|
|
7295
7222
|
...prefetchHandlers,
|
|
7296
|
-
href: absoluteHref ||
|
|
7223
|
+
href: absoluteHref || href2,
|
|
7297
7224
|
onClick: isExternal || reloadDocument ? onClick : handleClick,
|
|
7298
7225
|
ref: mergeRefs(forwardedRef, prefetchRef),
|
|
7299
7226
|
target,
|
|
@@ -7301,7 +7228,7 @@ var Link = React10.forwardRef(
|
|
|
7301
7228
|
}
|
|
7302
7229
|
)
|
|
7303
7230
|
);
|
|
7304
|
-
return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React10.createElement(React10.Fragment, null, link, /* @__PURE__ */ React10.createElement(PrefetchPageLinks, { page:
|
|
7231
|
+
return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React10.createElement(React10.Fragment, null, link, /* @__PURE__ */ React10.createElement(PrefetchPageLinks, { page: href2 })) : link;
|
|
7305
7232
|
}
|
|
7306
7233
|
);
|
|
7307
7234
|
Link.displayName = "Link";
|
|
@@ -7657,9 +7584,9 @@ function useFetcher({
|
|
|
7657
7584
|
return () => router.deleteFetcher(fetcherKey);
|
|
7658
7585
|
}, [router, fetcherKey]);
|
|
7659
7586
|
let load = React10.useCallback(
|
|
7660
|
-
async (
|
|
7587
|
+
async (href2, opts) => {
|
|
7661
7588
|
invariant(routeId, "No routeId available for fetcher.load()");
|
|
7662
|
-
await router.fetch(fetcherKey, routeId,
|
|
7589
|
+
await router.fetch(fetcherKey, routeId, href2, opts);
|
|
7663
7590
|
},
|
|
7664
7591
|
[fetcherKey, routeId, router]
|
|
7665
7592
|
);
|
|
@@ -8116,9 +8043,9 @@ function createHref(to) {
|
|
|
8116
8043
|
return typeof to === "string" ? to : createPath(to);
|
|
8117
8044
|
}
|
|
8118
8045
|
function encodeLocation(to) {
|
|
8119
|
-
let
|
|
8120
|
-
|
|
8121
|
-
let encoded = ABSOLUTE_URL_REGEX3.test(
|
|
8046
|
+
let href2 = typeof to === "string" ? to : createPath(to);
|
|
8047
|
+
href2 = href2.replace(/ $/, "%20");
|
|
8048
|
+
let encoded = ABSOLUTE_URL_REGEX3.test(href2) ? new URL(href2) : new URL(href2, "http://localhost");
|
|
8122
8049
|
return {
|
|
8123
8050
|
pathname: encoded.pathname,
|
|
8124
8051
|
search: encoded.search,
|
|
@@ -8273,11 +8200,8 @@ function processRoutes(routes, context, manifest, routeModules, parentId) {
|
|
|
8273
8200
|
hasClientAction: false,
|
|
8274
8201
|
hasClientLoader: false,
|
|
8275
8202
|
hasErrorBoundary: route.ErrorBoundary != null,
|
|
8276
|
-
|
|
8277
|
-
|
|
8278
|
-
clientActionModule: void 0,
|
|
8279
|
-
clientLoaderModule: void 0,
|
|
8280
|
-
hydrateFallbackModule: void 0
|
|
8203
|
+
module: "build/stub-path-to-module.js"
|
|
8204
|
+
// any need for this?
|
|
8281
8205
|
};
|
|
8282
8206
|
manifest.routes[newRoute.id] = entryRoute;
|
|
8283
8207
|
routeModules[route.id] = {
|
|
@@ -9605,6 +9529,7 @@ export {
|
|
|
9605
9529
|
replace,
|
|
9606
9530
|
ErrorResponseImpl,
|
|
9607
9531
|
isRouteErrorResponse,
|
|
9532
|
+
href,
|
|
9608
9533
|
IDLE_NAVIGATION,
|
|
9609
9534
|
IDLE_FETCHER,
|
|
9610
9535
|
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 './
|
|
2
|
+
import { R as RouterProviderProps$1 } from './fog-of-war-BCniP0AZ.mjs';
|
|
3
|
+
import './router-BYH9f2xg.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 './
|
|
2
|
+
import { R as RouterProviderProps$1 } from './fog-of-war-DFo9BKir.js';
|
|
3
|
+
import './router-BYH9f2xg.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-759a11a62
|
|
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() {
|
|
@@ -1562,7 +1562,7 @@ function createRouter(init) {
|
|
|
1562
1562
|
});
|
|
1563
1563
|
return new Map(state.fetchers);
|
|
1564
1564
|
}
|
|
1565
|
-
async function fetch2(key, routeId,
|
|
1565
|
+
async function fetch2(key, routeId, href2, opts) {
|
|
1566
1566
|
abortFetcher(key);
|
|
1567
1567
|
let flushSync2 = (opts && opts.flushSync) === true;
|
|
1568
1568
|
let routesToUse = inFlightDataRoutes || dataRoutes;
|
|
@@ -1570,7 +1570,7 @@ function createRouter(init) {
|
|
|
1570
1570
|
state.location,
|
|
1571
1571
|
state.matches,
|
|
1572
1572
|
basename,
|
|
1573
|
-
|
|
1573
|
+
href2,
|
|
1574
1574
|
routeId,
|
|
1575
1575
|
opts?.relative
|
|
1576
1576
|
);
|
|
@@ -4218,7 +4218,7 @@ async function prefetchStyleLinks(route, routeModule) {
|
|
|
4218
4218
|
if (!route.css && !routeModule.links || !isPreloadSupported()) return;
|
|
4219
4219
|
let descriptors = [];
|
|
4220
4220
|
if (route.css) {
|
|
4221
|
-
descriptors.push(...route.css.map((
|
|
4221
|
+
descriptors.push(...route.css.map((href2) => ({ rel: "stylesheet", href: href2 })));
|
|
4222
4222
|
}
|
|
4223
4223
|
if (routeModule.links) {
|
|
4224
4224
|
descriptors.push(...routeModule.links());
|
|
@@ -4262,31 +4262,6 @@ async function prefetchStyleLink(descriptor) {
|
|
|
4262
4262
|
function isPageLinkDescriptor(object) {
|
|
4263
4263
|
return object != null && typeof object.page === "string";
|
|
4264
4264
|
}
|
|
4265
|
-
function getModuleLinkHrefs(matches, manifest, { includeHydrateFallback } = {}) {
|
|
4266
|
-
return dedupeHrefs(
|
|
4267
|
-
matches.map((match) => {
|
|
4268
|
-
let route = manifest.routes[match.route.id];
|
|
4269
|
-
if (!route) return [];
|
|
4270
|
-
let hrefs = [route.module];
|
|
4271
|
-
if (route.clientActionModule) {
|
|
4272
|
-
hrefs = hrefs.concat(route.clientActionModule);
|
|
4273
|
-
}
|
|
4274
|
-
if (route.clientLoaderModule) {
|
|
4275
|
-
hrefs = hrefs.concat(route.clientLoaderModule);
|
|
4276
|
-
}
|
|
4277
|
-
if (includeHydrateFallback && route.hydrateFallbackModule) {
|
|
4278
|
-
hrefs = hrefs.concat(route.hydrateFallbackModule);
|
|
4279
|
-
}
|
|
4280
|
-
if (route.imports) {
|
|
4281
|
-
hrefs = hrefs.concat(route.imports);
|
|
4282
|
-
}
|
|
4283
|
-
return hrefs;
|
|
4284
|
-
}).flat(1)
|
|
4285
|
-
);
|
|
4286
|
-
}
|
|
4287
|
-
function dedupeHrefs(hrefs) {
|
|
4288
|
-
return [...new Set(hrefs)];
|
|
4289
|
-
}
|
|
4290
4265
|
var _isPreloadSupported;
|
|
4291
4266
|
function isPreloadSupported() {
|
|
4292
4267
|
if (_isPreloadSupported !== void 0) {
|
|
@@ -4811,21 +4786,6 @@ function createClientRoutes(manifest, routeModulesCache, initialState, isSpaMode
|
|
|
4811
4786
|
}
|
|
4812
4787
|
return fetchServerHandler(singleFetch);
|
|
4813
4788
|
}
|
|
4814
|
-
function prefetchModule(modulePath) {
|
|
4815
|
-
import(
|
|
4816
|
-
/* @vite-ignore */
|
|
4817
|
-
/* webpackIgnore: true */
|
|
4818
|
-
modulePath
|
|
4819
|
-
);
|
|
4820
|
-
}
|
|
4821
|
-
function prefetchRouteModuleChunks(route2) {
|
|
4822
|
-
if (route2.clientActionModule) {
|
|
4823
|
-
prefetchModule(route2.clientActionModule);
|
|
4824
|
-
}
|
|
4825
|
-
if (route2.clientLoaderModule) {
|
|
4826
|
-
prefetchModule(route2.clientLoaderModule);
|
|
4827
|
-
}
|
|
4828
|
-
}
|
|
4829
4789
|
async function prefetchStylesAndCallHandler(handler) {
|
|
4830
4790
|
let cachedModule = routeModulesCache[route.id];
|
|
4831
4791
|
let linkPrefetchPromise = cachedModule ? prefetchStyleLinks(route, cachedModule) : Promise.resolve();
|
|
@@ -4922,22 +4882,6 @@ function createClientRoutes(manifest, routeModulesCache, initialState, isSpaMode
|
|
|
4922
4882
|
if (isSpaMode) return Promise.resolve(null);
|
|
4923
4883
|
return fetchServerLoader(singleFetch);
|
|
4924
4884
|
});
|
|
4925
|
-
} else if (route.clientLoaderModule) {
|
|
4926
|
-
dataRoute.loader = async (args, singleFetch) => {
|
|
4927
|
-
invariant2(route.clientLoaderModule);
|
|
4928
|
-
let { clientLoader } = await import(
|
|
4929
|
-
/* @vite-ignore */
|
|
4930
|
-
/* webpackIgnore: true */
|
|
4931
|
-
route.clientLoaderModule
|
|
4932
|
-
);
|
|
4933
|
-
return clientLoader({
|
|
4934
|
-
...args,
|
|
4935
|
-
async serverLoader() {
|
|
4936
|
-
preventInvalidServerHandlerCall("loader", route, isSpaMode);
|
|
4937
|
-
return fetchServerLoader(singleFetch);
|
|
4938
|
-
}
|
|
4939
|
-
});
|
|
4940
|
-
};
|
|
4941
4885
|
}
|
|
4942
4886
|
if (!route.hasClientAction) {
|
|
4943
4887
|
dataRoute.action = ({ request }, singleFetch) => prefetchStylesAndCallHandler(() => {
|
|
@@ -4946,36 +4890,14 @@ function createClientRoutes(manifest, routeModulesCache, initialState, isSpaMode
|
|
|
4946
4890
|
}
|
|
4947
4891
|
return fetchServerAction(singleFetch);
|
|
4948
4892
|
});
|
|
4949
|
-
} else if (route.clientActionModule) {
|
|
4950
|
-
dataRoute.action = async (args, singleFetch) => {
|
|
4951
|
-
invariant2(route.clientActionModule);
|
|
4952
|
-
prefetchRouteModuleChunks(route);
|
|
4953
|
-
let { clientAction } = await import(
|
|
4954
|
-
/* @vite-ignore */
|
|
4955
|
-
/* webpackIgnore: true */
|
|
4956
|
-
route.clientActionModule
|
|
4957
|
-
);
|
|
4958
|
-
return clientAction({
|
|
4959
|
-
...args,
|
|
4960
|
-
async serverAction() {
|
|
4961
|
-
preventInvalidServerHandlerCall("action", route, isSpaMode);
|
|
4962
|
-
return fetchServerAction(singleFetch);
|
|
4963
|
-
}
|
|
4964
|
-
});
|
|
4965
|
-
};
|
|
4966
4893
|
}
|
|
4967
4894
|
dataRoute.lazy = async () => {
|
|
4968
|
-
|
|
4969
|
-
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
4970
|
-
}
|
|
4971
|
-
let modPromise = loadRouteModuleWithBlockingLinks(
|
|
4895
|
+
let mod = await loadRouteModuleWithBlockingLinks(
|
|
4972
4896
|
route,
|
|
4973
4897
|
routeModulesCache
|
|
4974
4898
|
);
|
|
4975
|
-
prefetchRouteModuleChunks(route);
|
|
4976
|
-
let mod = await modPromise;
|
|
4977
4899
|
let lazyRoute = { ...mod };
|
|
4978
|
-
if (mod.clientLoader
|
|
4900
|
+
if (mod.clientLoader) {
|
|
4979
4901
|
let clientLoader = mod.clientLoader;
|
|
4980
4902
|
lazyRoute.loader = (args, singleFetch) => clientLoader({
|
|
4981
4903
|
...args,
|
|
@@ -4985,7 +4907,7 @@ function createClientRoutes(manifest, routeModulesCache, initialState, isSpaMode
|
|
|
4985
4907
|
}
|
|
4986
4908
|
});
|
|
4987
4909
|
}
|
|
4988
|
-
if (mod.clientAction
|
|
4910
|
+
if (mod.clientAction) {
|
|
4989
4911
|
let clientAction = mod.clientAction;
|
|
4990
4912
|
lazyRoute.action = (args, singleFetch) => clientAction({
|
|
4991
4913
|
...args,
|
|
@@ -5306,44 +5228,11 @@ function Scripts(props) {
|
|
|
5306
5228
|
let streamScript = "window.__reactRouterContext.stream = new ReadableStream({start(controller){window.__reactRouterContext.streamController = controller;}}).pipeThrough(new TextEncoderStream());";
|
|
5307
5229
|
let contextScript = staticContext ? `window.__reactRouterContext = ${serverHandoffString};${streamScript}` : " ";
|
|
5308
5230
|
let routeModulesScript = !isStatic ? " " : `${manifest.hmr?.runtime ? `import ${JSON.stringify(manifest.hmr.runtime)};` : ""}${!enableFogOfWar ? `import ${JSON.stringify(manifest.url)}` : ""};
|
|
5309
|
-
${matches.map(
|
|
5310
|
-
|
|
5311
|
-
|
|
5312
|
-
|
|
5313
|
-
|
|
5314
|
-
clientActionModule,
|
|
5315
|
-
clientLoaderModule,
|
|
5316
|
-
hydrateFallbackModule,
|
|
5317
|
-
module: module2
|
|
5318
|
-
} = manifestEntry;
|
|
5319
|
-
let chunks = [
|
|
5320
|
-
...clientActionModule ? [
|
|
5321
|
-
{
|
|
5322
|
-
module: clientActionModule,
|
|
5323
|
-
varName: `${routeVarName}_clientAction`
|
|
5324
|
-
}
|
|
5325
|
-
] : [],
|
|
5326
|
-
...clientLoaderModule ? [
|
|
5327
|
-
{
|
|
5328
|
-
module: clientLoaderModule,
|
|
5329
|
-
varName: `${routeVarName}_clientLoader`
|
|
5330
|
-
}
|
|
5331
|
-
] : [],
|
|
5332
|
-
...hydrateFallbackModule ? [
|
|
5333
|
-
{
|
|
5334
|
-
module: hydrateFallbackModule,
|
|
5335
|
-
varName: `${routeVarName}_HydrateFallback`
|
|
5336
|
-
}
|
|
5337
|
-
] : [],
|
|
5338
|
-
{ module: module2, varName: `${routeVarName}_main` }
|
|
5339
|
-
];
|
|
5340
|
-
if (chunks.length === 1) {
|
|
5341
|
-
return `import * as ${routeVarName} from ${JSON.stringify(module2)};`;
|
|
5342
|
-
}
|
|
5343
|
-
let chunkImportsSnippet = chunks.map((chunk) => `import * as ${chunk.varName} from "${chunk.module}";`).join("\n");
|
|
5344
|
-
let mergedChunksSnippet = `const ${routeVarName} = {${chunks.map((chunk) => `...${chunk.varName}`).join(",")}};`;
|
|
5345
|
-
return [chunkImportsSnippet, mergedChunksSnippet].join("\n");
|
|
5346
|
-
}).join("\n")}
|
|
5231
|
+
${matches.map(
|
|
5232
|
+
(match, index) => `import * as route${index} from ${JSON.stringify(
|
|
5233
|
+
manifest.routes[match.route.id].module
|
|
5234
|
+
)};`
|
|
5235
|
+
).join("\n")}
|
|
5347
5236
|
${enableFogOfWar ? (
|
|
5348
5237
|
// Inline a minimal manifest with the SSR matches
|
|
5349
5238
|
`window.__reactRouterManifest = ${JSON.stringify(
|
|
@@ -5374,11 +5263,11 @@ import(${JSON.stringify(manifest.entry.module)});`;
|
|
|
5374
5263
|
}
|
|
5375
5264
|
));
|
|
5376
5265
|
}, []);
|
|
5377
|
-
let
|
|
5378
|
-
|
|
5379
|
-
|
|
5380
|
-
|
|
5381
|
-
);
|
|
5266
|
+
let routePreloads = matches.map((match) => {
|
|
5267
|
+
let route = manifest.routes[match.route.id];
|
|
5268
|
+
return route ? (route.imports || []).concat([route.module]) : [];
|
|
5269
|
+
}).flat(1);
|
|
5270
|
+
let preloads = isHydrated ? [] : manifest.entry.imports.concat(routePreloads);
|
|
5382
5271
|
return isHydrated ? null : /* @__PURE__ */ React9.createElement(React9.Fragment, null, !enableFogOfWar ? /* @__PURE__ */ React9.createElement(
|
|
5383
5272
|
"link",
|
|
5384
5273
|
{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-759a11a62
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
matchRoutes,
|
|
26
26
|
shouldHydrateRouteLoader,
|
|
27
27
|
useFogOFWarDiscovery
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-5WLC4F5Z.mjs";
|
|
29
29
|
|
|
30
30
|
// lib/dom-export/dom-router-provider.tsx
|
|
31
31
|
import * as React from "react";
|