react-router 0.0.0-experimental-345f1da12 → 0.0.0-experimental-df6bc686c
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-JDHHU2L7.mjs → chunk-UDQUAXYC.mjs} +94 -61
- package/dist/development/data-CQbyyGzl.d.mts +11 -0
- package/dist/development/data-CQbyyGzl.d.ts +11 -0
- package/dist/development/dom-export.d.mts +2 -2
- package/dist/development/dom-export.d.ts +2 -2
- package/dist/development/dom-export.js +89 -20
- package/dist/development/dom-export.mjs +2 -2
- package/dist/{production/fog-of-war-BCniP0AZ.d.mts → development/fog-of-war-B3edLoNW.d.ts} +71 -68
- package/dist/development/{fog-of-war-DFo9BKir.d.ts → fog-of-war-CTZ6x_bd.d.mts} +71 -68
- package/dist/development/index.d.mts +6 -5
- package/dist/development/index.d.ts +6 -5
- package/dist/development/index.js +94 -62
- package/dist/development/index.mjs +2 -4
- package/dist/development/lib/types/route-module.d.mts +108 -1
- package/dist/development/lib/types/route-module.d.ts +108 -1
- package/dist/development/lib/types/route-module.js +1 -1
- package/dist/development/lib/types/route-module.mjs +1 -1
- package/dist/development/{router-BYH9f2xg.d.mts → route-data-JFOfNyPS.d.mts} +783 -1084
- package/dist/{production/router-BYH9f2xg.d.mts → development/route-data-JFOfNyPS.d.ts} +783 -1084
- package/dist/production/{chunk-LHBKIBVZ.mjs → chunk-VOIZN74L.mjs} +94 -61
- package/dist/production/data-CQbyyGzl.d.mts +11 -0
- package/dist/production/data-CQbyyGzl.d.ts +11 -0
- package/dist/production/dom-export.d.mts +2 -2
- package/dist/production/dom-export.d.ts +2 -2
- package/dist/production/dom-export.js +89 -20
- package/dist/production/dom-export.mjs +2 -2
- package/dist/{development/fog-of-war-BCniP0AZ.d.mts → production/fog-of-war-B3edLoNW.d.ts} +71 -68
- package/dist/production/{fog-of-war-DFo9BKir.d.ts → fog-of-war-CTZ6x_bd.d.mts} +71 -68
- package/dist/production/index.d.mts +6 -5
- package/dist/production/index.d.ts +6 -5
- package/dist/production/index.js +94 -62
- package/dist/production/index.mjs +2 -4
- package/dist/production/lib/types/route-module.d.mts +108 -1
- package/dist/production/lib/types/route-module.d.ts +108 -1
- package/dist/production/lib/types/route-module.js +1 -1
- package/dist/production/lib/types/route-module.mjs +1 -1
- package/dist/production/{router-BYH9f2xg.d.ts → route-data-JFOfNyPS.d.mts} +783 -1084
- package/dist/{development/router-BYH9f2xg.d.ts → production/route-data-JFOfNyPS.d.ts} +783 -1084
- package/package.json +1 -9
- package/dist/development/lib/types/index.d.mts +0 -2
- package/dist/development/lib/types/index.d.ts +0 -2
- package/dist/development/lib/types/index.js +0 -28
- package/dist/development/lib/types/index.mjs +0 -10
- package/dist/production/lib/types/index.d.mts +0 -2
- package/dist/production/lib/types/index.d.ts +0 -2
- package/dist/production/lib/types/index.js +0 -28
- package/dist/production/lib/types/index.mjs +0 -10
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-df6bc686c
|
|
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 href = "";
|
|
158
158
|
if (base && base.getAttribute("href")) {
|
|
159
159
|
let url = window2.location.href;
|
|
160
160
|
let hashIndex = url.indexOf("#");
|
|
161
|
-
|
|
161
|
+
href = hashIndex === -1 ? url : url.slice(0, hashIndex);
|
|
162
162
|
}
|
|
163
|
-
return
|
|
163
|
+
return href + "#" + (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 href = typeof to === "string" ? to : createPath(to);
|
|
306
|
+
href = href.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: ${href}`
|
|
310
310
|
);
|
|
311
|
-
return new URL(
|
|
311
|
+
return new URL(href, base);
|
|
312
312
|
}
|
|
313
313
|
let history = {
|
|
314
314
|
get action() {
|
|
@@ -840,15 +840,6 @@ 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
|
-
}
|
|
852
843
|
|
|
853
844
|
// lib/router/router.ts
|
|
854
845
|
var validMutationMethodsArr = [
|
|
@@ -1714,7 +1705,7 @@ function createRouter(init) {
|
|
|
1714
1705
|
});
|
|
1715
1706
|
return new Map(state.fetchers);
|
|
1716
1707
|
}
|
|
1717
|
-
async function fetch2(key, routeId,
|
|
1708
|
+
async function fetch2(key, routeId, href, opts) {
|
|
1718
1709
|
abortFetcher(key);
|
|
1719
1710
|
let flushSync = (opts && opts.flushSync) === true;
|
|
1720
1711
|
let routesToUse = inFlightDataRoutes || dataRoutes;
|
|
@@ -1722,7 +1713,7 @@ function createRouter(init) {
|
|
|
1722
1713
|
state.location,
|
|
1723
1714
|
state.matches,
|
|
1724
1715
|
basename,
|
|
1725
|
-
|
|
1716
|
+
href,
|
|
1726
1717
|
routeId,
|
|
1727
1718
|
opts?.relative
|
|
1728
1719
|
);
|
|
@@ -5353,18 +5344,18 @@ function getKeyedLinksForMatches(matches, routeModules, manifest) {
|
|
|
5353
5344
|
let module = routeModules[match.route.id];
|
|
5354
5345
|
let route = manifest.routes[match.route.id];
|
|
5355
5346
|
return [
|
|
5356
|
-
route && route.css ? route.css.map((
|
|
5347
|
+
route && route.css ? route.css.map((href) => ({ rel: "stylesheet", href })) : [],
|
|
5357
5348
|
module?.links?.() || []
|
|
5358
5349
|
];
|
|
5359
5350
|
}).flat(2);
|
|
5360
|
-
let preloads =
|
|
5351
|
+
let preloads = getModuleLinkHrefs(matches, manifest);
|
|
5361
5352
|
return dedupeLinkDescriptors(descriptors, preloads);
|
|
5362
5353
|
}
|
|
5363
5354
|
async function prefetchStyleLinks(route, routeModule) {
|
|
5364
5355
|
if (!route.css && !routeModule.links || !isPreloadSupported()) return;
|
|
5365
5356
|
let descriptors = [];
|
|
5366
5357
|
if (route.css) {
|
|
5367
|
-
descriptors.push(...route.css.map((
|
|
5358
|
+
descriptors.push(...route.css.map((href) => ({ rel: "stylesheet", href })));
|
|
5368
5359
|
}
|
|
5369
5360
|
if (routeModule.links) {
|
|
5370
5361
|
descriptors.push(...routeModule.links());
|
|
@@ -5481,25 +5472,18 @@ function getNewMatchesForLinks(page, nextMatches, currentMatches, manifest, loca
|
|
|
5481
5472
|
}
|
|
5482
5473
|
return [];
|
|
5483
5474
|
}
|
|
5484
|
-
function getModuleLinkHrefs(matches,
|
|
5485
|
-
return dedupeHrefs(
|
|
5486
|
-
matches.map((match) => {
|
|
5487
|
-
let route = manifestPatch.routes[match.route.id];
|
|
5488
|
-
if (!route) return [];
|
|
5489
|
-
let hrefs = [route.module];
|
|
5490
|
-
if (route.imports) {
|
|
5491
|
-
hrefs = hrefs.concat(route.imports);
|
|
5492
|
-
}
|
|
5493
|
-
return hrefs;
|
|
5494
|
-
}).flat(1)
|
|
5495
|
-
);
|
|
5496
|
-
}
|
|
5497
|
-
function getCurrentPageModulePreloadHrefs(matches, manifest) {
|
|
5475
|
+
function getModuleLinkHrefs(matches, manifest) {
|
|
5498
5476
|
return dedupeHrefs(
|
|
5499
5477
|
matches.map((match) => {
|
|
5500
5478
|
let route = manifest.routes[match.route.id];
|
|
5501
5479
|
if (!route) return [];
|
|
5502
5480
|
let hrefs = [route.module];
|
|
5481
|
+
if (route.clientActionModule) {
|
|
5482
|
+
hrefs = hrefs.concat(route.clientActionModule);
|
|
5483
|
+
}
|
|
5484
|
+
if (route.clientLoaderModule) {
|
|
5485
|
+
hrefs = hrefs.concat(route.clientLoaderModule);
|
|
5486
|
+
}
|
|
5503
5487
|
if (route.imports) {
|
|
5504
5488
|
hrefs = hrefs.concat(route.imports);
|
|
5505
5489
|
}
|
|
@@ -6271,6 +6255,21 @@ function createClientRoutes(manifest, routeModulesCache, initialState, isSpaMode
|
|
|
6271
6255
|
if (isSpaMode) return Promise.resolve(null);
|
|
6272
6256
|
return fetchServerLoader(singleFetch);
|
|
6273
6257
|
});
|
|
6258
|
+
} else if (route.clientLoaderModule) {
|
|
6259
|
+
dataRoute.loader = async (args, singleFetch) => {
|
|
6260
|
+
invariant2(route.clientLoaderModule);
|
|
6261
|
+
let { clientLoader } = await import(
|
|
6262
|
+
/* webpackIgnore: true */
|
|
6263
|
+
route.clientLoaderModule
|
|
6264
|
+
);
|
|
6265
|
+
return clientLoader({
|
|
6266
|
+
...args,
|
|
6267
|
+
async serverLoader() {
|
|
6268
|
+
preventInvalidServerHandlerCall("loader", route, isSpaMode);
|
|
6269
|
+
return fetchServerLoader(singleFetch);
|
|
6270
|
+
}
|
|
6271
|
+
});
|
|
6272
|
+
};
|
|
6274
6273
|
}
|
|
6275
6274
|
if (!route.hasClientAction) {
|
|
6276
6275
|
dataRoute.action = ({ request }, singleFetch) => prefetchStylesAndCallHandler(() => {
|
|
@@ -6279,14 +6278,32 @@ function createClientRoutes(manifest, routeModulesCache, initialState, isSpaMode
|
|
|
6279
6278
|
}
|
|
6280
6279
|
return fetchServerAction(singleFetch);
|
|
6281
6280
|
});
|
|
6281
|
+
} else if (route.clientActionModule) {
|
|
6282
|
+
dataRoute.action = async (args, singleFetch) => {
|
|
6283
|
+
invariant2(route.clientActionModule);
|
|
6284
|
+
let { clientAction } = await import(
|
|
6285
|
+
/* webpackIgnore: true */
|
|
6286
|
+
route.clientActionModule
|
|
6287
|
+
);
|
|
6288
|
+
return clientAction({
|
|
6289
|
+
...args,
|
|
6290
|
+
async serverAction() {
|
|
6291
|
+
preventInvalidServerHandlerCall("action", route, isSpaMode);
|
|
6292
|
+
return fetchServerAction(singleFetch);
|
|
6293
|
+
}
|
|
6294
|
+
});
|
|
6295
|
+
};
|
|
6282
6296
|
}
|
|
6283
6297
|
dataRoute.lazy = async () => {
|
|
6298
|
+
if (route.clientLoaderModule || route.clientActionModule) {
|
|
6299
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
6300
|
+
}
|
|
6284
6301
|
let mod = await loadRouteModuleWithBlockingLinks(
|
|
6285
6302
|
route,
|
|
6286
6303
|
routeModulesCache
|
|
6287
6304
|
);
|
|
6288
6305
|
let lazyRoute = { ...mod };
|
|
6289
|
-
if (mod.clientLoader) {
|
|
6306
|
+
if (mod.clientLoader && !route.clientLoaderModule) {
|
|
6290
6307
|
let clientLoader = mod.clientLoader;
|
|
6291
6308
|
lazyRoute.loader = (args, singleFetch) => clientLoader({
|
|
6292
6309
|
...args,
|
|
@@ -6296,7 +6313,7 @@ function createClientRoutes(manifest, routeModulesCache, initialState, isSpaMode
|
|
|
6296
6313
|
}
|
|
6297
6314
|
});
|
|
6298
6315
|
}
|
|
6299
|
-
if (mod.clientAction) {
|
|
6316
|
+
if (mod.clientAction && !route.clientActionModule) {
|
|
6300
6317
|
let clientAction = mod.clientAction;
|
|
6301
6318
|
lazyRoute.action = (args, singleFetch) => clientAction({
|
|
6302
6319
|
...args,
|
|
@@ -6784,7 +6801,7 @@ function PrefetchPageLinksImpl({
|
|
|
6784
6801
|
[newMatchesForAssets, manifest]
|
|
6785
6802
|
);
|
|
6786
6803
|
let keyedPrefetchLinks = useKeyedPrefetchLinks(newMatchesForAssets);
|
|
6787
|
-
return /* @__PURE__ */ React9.createElement(React9.Fragment, null, dataHrefs.map((
|
|
6804
|
+
return /* @__PURE__ */ React9.createElement(React9.Fragment, null, dataHrefs.map((href) => /* @__PURE__ */ React9.createElement("link", { key: href, rel: "prefetch", as: "fetch", href, ...linkProps })), moduleHrefs.map((href) => /* @__PURE__ */ React9.createElement("link", { key: href, rel: "modulepreload", href, ...linkProps })), keyedPrefetchLinks.map(({ key, link }) => (
|
|
6788
6805
|
// these don't spread `linkProps` because they are full link descriptors
|
|
6789
6806
|
// already with their own props
|
|
6790
6807
|
/* @__PURE__ */ React9.createElement("link", { key, ...link })
|
|
@@ -6908,11 +6925,29 @@ function Scripts(props) {
|
|
|
6908
6925
|
let streamScript = "window.__reactRouterContext.stream = new ReadableStream({start(controller){window.__reactRouterContext.streamController = controller;}}).pipeThrough(new TextEncoderStream());";
|
|
6909
6926
|
let contextScript = staticContext ? `window.__reactRouterContext = ${serverHandoffString};${streamScript}` : " ";
|
|
6910
6927
|
let routeModulesScript = !isStatic ? " " : `${manifest.hmr?.runtime ? `import ${JSON.stringify(manifest.hmr.runtime)};` : ""}${!enableFogOfWar ? `import ${JSON.stringify(manifest.url)}` : ""};
|
|
6911
|
-
${matches.map(
|
|
6912
|
-
|
|
6913
|
-
|
|
6914
|
-
)
|
|
6915
|
-
|
|
6928
|
+
${matches.map((match, routeIndex) => {
|
|
6929
|
+
let routeVarName = `route${routeIndex}`;
|
|
6930
|
+
let manifestEntry = manifest.routes[match.route.id];
|
|
6931
|
+
invariant2(manifestEntry, `Route ${match.route.id} not found in manifest`);
|
|
6932
|
+
let {
|
|
6933
|
+
clientActionModule,
|
|
6934
|
+
clientLoaderModule,
|
|
6935
|
+
hydrateFallbackModule,
|
|
6936
|
+
module
|
|
6937
|
+
} = manifestEntry;
|
|
6938
|
+
let chunks = [
|
|
6939
|
+
...clientActionModule ? [{ module: clientActionModule, varName: `${routeVarName}_a` }] : [],
|
|
6940
|
+
...clientLoaderModule ? [{ module: clientLoaderModule, varName: `${routeVarName}_l` }] : [],
|
|
6941
|
+
...hydrateFallbackModule ? [{ module: hydrateFallbackModule, varName: `${routeVarName}_h` }] : [],
|
|
6942
|
+
{ module, varName: `${routeVarName}_m` }
|
|
6943
|
+
];
|
|
6944
|
+
if (chunks.length === 1) {
|
|
6945
|
+
return `import * as ${routeVarName} from ${JSON.stringify(module)};`;
|
|
6946
|
+
}
|
|
6947
|
+
let chunkImportsSnippet = chunks.map((chunk) => `import * as ${chunk.varName} from "${chunk.module}";`).join("\n");
|
|
6948
|
+
let mergedChunksSnippet = `const ${routeVarName} = {${chunks.map((chunk) => `...${chunk.varName}`).join(",")}};`;
|
|
6949
|
+
return [chunkImportsSnippet, mergedChunksSnippet].join("\n");
|
|
6950
|
+
}).join("\n")}
|
|
6916
6951
|
${enableFogOfWar ? (
|
|
6917
6952
|
// Inline a minimal manifest with the SSR matches
|
|
6918
6953
|
`window.__reactRouterManifest = ${JSON.stringify(
|
|
@@ -6943,11 +6978,7 @@ import(${JSON.stringify(manifest.entry.module)});`;
|
|
|
6943
6978
|
}
|
|
6944
6979
|
));
|
|
6945
6980
|
}, []);
|
|
6946
|
-
let
|
|
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);
|
|
6981
|
+
let preloads = isHydrated ? [] : manifest.entry.imports.concat(getModuleLinkHrefs(matches, manifest));
|
|
6951
6982
|
return isHydrated ? null : /* @__PURE__ */ React9.createElement(React9.Fragment, null, !enableFogOfWar ? /* @__PURE__ */ React9.createElement(
|
|
6952
6983
|
"link",
|
|
6953
6984
|
{
|
|
@@ -6991,7 +7022,7 @@ function mergeRefs(...refs) {
|
|
|
6991
7022
|
var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
6992
7023
|
try {
|
|
6993
7024
|
if (isBrowser) {
|
|
6994
|
-
window.__reactRouterVersion = "0.0.0-experimental-
|
|
7025
|
+
window.__reactRouterVersion = "0.0.0-experimental-df6bc686c";
|
|
6995
7026
|
}
|
|
6996
7027
|
} catch (e) {
|
|
6997
7028
|
}
|
|
@@ -7194,7 +7225,7 @@ var Link = React10.forwardRef(
|
|
|
7194
7225
|
}
|
|
7195
7226
|
}
|
|
7196
7227
|
}
|
|
7197
|
-
let
|
|
7228
|
+
let href = useHref(to, { relative });
|
|
7198
7229
|
let [shouldPrefetch, prefetchRef, prefetchHandlers] = usePrefetchBehavior(
|
|
7199
7230
|
prefetch,
|
|
7200
7231
|
rest
|
|
@@ -7220,7 +7251,7 @@ var Link = React10.forwardRef(
|
|
|
7220
7251
|
{
|
|
7221
7252
|
...rest,
|
|
7222
7253
|
...prefetchHandlers,
|
|
7223
|
-
href: absoluteHref ||
|
|
7254
|
+
href: absoluteHref || href,
|
|
7224
7255
|
onClick: isExternal || reloadDocument ? onClick : handleClick,
|
|
7225
7256
|
ref: mergeRefs(forwardedRef, prefetchRef),
|
|
7226
7257
|
target,
|
|
@@ -7228,7 +7259,7 @@ var Link = React10.forwardRef(
|
|
|
7228
7259
|
}
|
|
7229
7260
|
)
|
|
7230
7261
|
);
|
|
7231
|
-
return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React10.createElement(React10.Fragment, null, link, /* @__PURE__ */ React10.createElement(PrefetchPageLinks, { page:
|
|
7262
|
+
return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React10.createElement(React10.Fragment, null, link, /* @__PURE__ */ React10.createElement(PrefetchPageLinks, { page: href })) : link;
|
|
7232
7263
|
}
|
|
7233
7264
|
);
|
|
7234
7265
|
Link.displayName = "Link";
|
|
@@ -7584,9 +7615,9 @@ function useFetcher({
|
|
|
7584
7615
|
return () => router.deleteFetcher(fetcherKey);
|
|
7585
7616
|
}, [router, fetcherKey]);
|
|
7586
7617
|
let load = React10.useCallback(
|
|
7587
|
-
async (
|
|
7618
|
+
async (href, opts) => {
|
|
7588
7619
|
invariant(routeId, "No routeId available for fetcher.load()");
|
|
7589
|
-
await router.fetch(fetcherKey, routeId,
|
|
7620
|
+
await router.fetch(fetcherKey, routeId, href, opts);
|
|
7590
7621
|
},
|
|
7591
7622
|
[fetcherKey, routeId, router]
|
|
7592
7623
|
);
|
|
@@ -8043,9 +8074,9 @@ function createHref(to) {
|
|
|
8043
8074
|
return typeof to === "string" ? to : createPath(to);
|
|
8044
8075
|
}
|
|
8045
8076
|
function encodeLocation(to) {
|
|
8046
|
-
let
|
|
8047
|
-
|
|
8048
|
-
let encoded = ABSOLUTE_URL_REGEX3.test(
|
|
8077
|
+
let href = typeof to === "string" ? to : createPath(to);
|
|
8078
|
+
href = href.replace(/ $/, "%20");
|
|
8079
|
+
let encoded = ABSOLUTE_URL_REGEX3.test(href) ? new URL(href) : new URL(href, "http://localhost");
|
|
8049
8080
|
return {
|
|
8050
8081
|
pathname: encoded.pathname,
|
|
8051
8082
|
search: encoded.search,
|
|
@@ -8200,8 +8231,11 @@ function processRoutes(routes, context, manifest, routeModules, parentId) {
|
|
|
8200
8231
|
hasClientAction: false,
|
|
8201
8232
|
hasClientLoader: false,
|
|
8202
8233
|
hasErrorBoundary: route.ErrorBoundary != null,
|
|
8203
|
-
|
|
8204
|
-
|
|
8234
|
+
// any need for these?
|
|
8235
|
+
module: "build/stub-path-to-module.js",
|
|
8236
|
+
clientActionModule: void 0,
|
|
8237
|
+
clientLoaderModule: void 0,
|
|
8238
|
+
hydrateFallbackModule: void 0
|
|
8205
8239
|
};
|
|
8206
8240
|
manifest.routes[newRoute.id] = entryRoute;
|
|
8207
8241
|
routeModules[route.id] = {
|
|
@@ -9529,7 +9563,6 @@ export {
|
|
|
9529
9563
|
replace,
|
|
9530
9564
|
ErrorResponseImpl,
|
|
9531
9565
|
isRouteErrorResponse,
|
|
9532
|
-
href,
|
|
9533
9566
|
IDLE_NAVIGATION,
|
|
9534
9567
|
IDLE_FETCHER,
|
|
9535
9568
|
IDLE_BLOCKER,
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An object of unknown type for route loaders and actions provided by the
|
|
3
|
+
* server's `getLoadContext()` function. This is defined as an empty interface
|
|
4
|
+
* specifically so apps can leverage declaration merging to augment this type
|
|
5
|
+
* globally: https://www.typescriptlang.org/docs/handbook/declaration-merging.html
|
|
6
|
+
*/
|
|
7
|
+
interface AppLoadContext {
|
|
8
|
+
[key: string]: unknown;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export type { AppLoadContext as A };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An object of unknown type for route loaders and actions provided by the
|
|
3
|
+
* server's `getLoadContext()` function. This is defined as an empty interface
|
|
4
|
+
* specifically so apps can leverage declaration merging to augment this type
|
|
5
|
+
* globally: https://www.typescriptlang.org/docs/handbook/declaration-merging.html
|
|
6
|
+
*/
|
|
7
|
+
interface AppLoadContext {
|
|
8
|
+
[key: string]: unknown;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export type { AppLoadContext as A };
|
|
@@ -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-CTZ6x_bd.mjs';
|
|
3
|
+
import './route-data-JFOfNyPS.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-B3edLoNW.js';
|
|
3
|
+
import './route-data-JFOfNyPS.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-df6bc686c
|
|
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 href = typeof to === "string" ? to : createPath(to);
|
|
201
|
+
href = href.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: ${href}`
|
|
205
205
|
);
|
|
206
|
-
return new URL(
|
|
206
|
+
return new URL(href, 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, href, 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
|
+
href,
|
|
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((href) => ({ rel: "stylesheet", href })));
|
|
4222
4222
|
}
|
|
4223
4223
|
if (routeModule.links) {
|
|
4224
4224
|
descriptors.push(...routeModule.links());
|
|
@@ -4262,6 +4262,28 @@ 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) {
|
|
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 (route.imports) {
|
|
4278
|
+
hrefs = hrefs.concat(route.imports);
|
|
4279
|
+
}
|
|
4280
|
+
return hrefs;
|
|
4281
|
+
}).flat(1)
|
|
4282
|
+
);
|
|
4283
|
+
}
|
|
4284
|
+
function dedupeHrefs(hrefs) {
|
|
4285
|
+
return [...new Set(hrefs)];
|
|
4286
|
+
}
|
|
4265
4287
|
var _isPreloadSupported;
|
|
4266
4288
|
function isPreloadSupported() {
|
|
4267
4289
|
if (_isPreloadSupported !== void 0) {
|
|
@@ -4882,6 +4904,21 @@ function createClientRoutes(manifest, routeModulesCache, initialState, isSpaMode
|
|
|
4882
4904
|
if (isSpaMode) return Promise.resolve(null);
|
|
4883
4905
|
return fetchServerLoader(singleFetch);
|
|
4884
4906
|
});
|
|
4907
|
+
} else if (route.clientLoaderModule) {
|
|
4908
|
+
dataRoute.loader = async (args, singleFetch) => {
|
|
4909
|
+
invariant2(route.clientLoaderModule);
|
|
4910
|
+
let { clientLoader } = await import(
|
|
4911
|
+
/* webpackIgnore: true */
|
|
4912
|
+
route.clientLoaderModule
|
|
4913
|
+
);
|
|
4914
|
+
return clientLoader({
|
|
4915
|
+
...args,
|
|
4916
|
+
async serverLoader() {
|
|
4917
|
+
preventInvalidServerHandlerCall("loader", route, isSpaMode);
|
|
4918
|
+
return fetchServerLoader(singleFetch);
|
|
4919
|
+
}
|
|
4920
|
+
});
|
|
4921
|
+
};
|
|
4885
4922
|
}
|
|
4886
4923
|
if (!route.hasClientAction) {
|
|
4887
4924
|
dataRoute.action = ({ request }, singleFetch) => prefetchStylesAndCallHandler(() => {
|
|
@@ -4890,14 +4927,32 @@ function createClientRoutes(manifest, routeModulesCache, initialState, isSpaMode
|
|
|
4890
4927
|
}
|
|
4891
4928
|
return fetchServerAction(singleFetch);
|
|
4892
4929
|
});
|
|
4930
|
+
} else if (route.clientActionModule) {
|
|
4931
|
+
dataRoute.action = async (args, singleFetch) => {
|
|
4932
|
+
invariant2(route.clientActionModule);
|
|
4933
|
+
let { clientAction } = await import(
|
|
4934
|
+
/* webpackIgnore: true */
|
|
4935
|
+
route.clientActionModule
|
|
4936
|
+
);
|
|
4937
|
+
return clientAction({
|
|
4938
|
+
...args,
|
|
4939
|
+
async serverAction() {
|
|
4940
|
+
preventInvalidServerHandlerCall("action", route, isSpaMode);
|
|
4941
|
+
return fetchServerAction(singleFetch);
|
|
4942
|
+
}
|
|
4943
|
+
});
|
|
4944
|
+
};
|
|
4893
4945
|
}
|
|
4894
4946
|
dataRoute.lazy = async () => {
|
|
4947
|
+
if (route.clientLoaderModule || route.clientActionModule) {
|
|
4948
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
4949
|
+
}
|
|
4895
4950
|
let mod = await loadRouteModuleWithBlockingLinks(
|
|
4896
4951
|
route,
|
|
4897
4952
|
routeModulesCache
|
|
4898
4953
|
);
|
|
4899
4954
|
let lazyRoute = { ...mod };
|
|
4900
|
-
if (mod.clientLoader) {
|
|
4955
|
+
if (mod.clientLoader && !route.clientLoaderModule) {
|
|
4901
4956
|
let clientLoader = mod.clientLoader;
|
|
4902
4957
|
lazyRoute.loader = (args, singleFetch) => clientLoader({
|
|
4903
4958
|
...args,
|
|
@@ -4907,7 +4962,7 @@ function createClientRoutes(manifest, routeModulesCache, initialState, isSpaMode
|
|
|
4907
4962
|
}
|
|
4908
4963
|
});
|
|
4909
4964
|
}
|
|
4910
|
-
if (mod.clientAction) {
|
|
4965
|
+
if (mod.clientAction && !route.clientActionModule) {
|
|
4911
4966
|
let clientAction = mod.clientAction;
|
|
4912
4967
|
lazyRoute.action = (args, singleFetch) => clientAction({
|
|
4913
4968
|
...args,
|
|
@@ -5228,11 +5283,29 @@ function Scripts(props) {
|
|
|
5228
5283
|
let streamScript = "window.__reactRouterContext.stream = new ReadableStream({start(controller){window.__reactRouterContext.streamController = controller;}}).pipeThrough(new TextEncoderStream());";
|
|
5229
5284
|
let contextScript = staticContext ? `window.__reactRouterContext = ${serverHandoffString};${streamScript}` : " ";
|
|
5230
5285
|
let routeModulesScript = !isStatic ? " " : `${manifest.hmr?.runtime ? `import ${JSON.stringify(manifest.hmr.runtime)};` : ""}${!enableFogOfWar ? `import ${JSON.stringify(manifest.url)}` : ""};
|
|
5231
|
-
${matches.map(
|
|
5232
|
-
|
|
5233
|
-
|
|
5234
|
-
)
|
|
5235
|
-
|
|
5286
|
+
${matches.map((match, routeIndex) => {
|
|
5287
|
+
let routeVarName = `route${routeIndex}`;
|
|
5288
|
+
let manifestEntry = manifest.routes[match.route.id];
|
|
5289
|
+
invariant2(manifestEntry, `Route ${match.route.id} not found in manifest`);
|
|
5290
|
+
let {
|
|
5291
|
+
clientActionModule,
|
|
5292
|
+
clientLoaderModule,
|
|
5293
|
+
hydrateFallbackModule,
|
|
5294
|
+
module: module2
|
|
5295
|
+
} = manifestEntry;
|
|
5296
|
+
let chunks = [
|
|
5297
|
+
...clientActionModule ? [{ module: clientActionModule, varName: `${routeVarName}_a` }] : [],
|
|
5298
|
+
...clientLoaderModule ? [{ module: clientLoaderModule, varName: `${routeVarName}_l` }] : [],
|
|
5299
|
+
...hydrateFallbackModule ? [{ module: hydrateFallbackModule, varName: `${routeVarName}_h` }] : [],
|
|
5300
|
+
{ module: module2, varName: `${routeVarName}_m` }
|
|
5301
|
+
];
|
|
5302
|
+
if (chunks.length === 1) {
|
|
5303
|
+
return `import * as ${routeVarName} from ${JSON.stringify(module2)};`;
|
|
5304
|
+
}
|
|
5305
|
+
let chunkImportsSnippet = chunks.map((chunk) => `import * as ${chunk.varName} from "${chunk.module}";`).join("\n");
|
|
5306
|
+
let mergedChunksSnippet = `const ${routeVarName} = {${chunks.map((chunk) => `...${chunk.varName}`).join(",")}};`;
|
|
5307
|
+
return [chunkImportsSnippet, mergedChunksSnippet].join("\n");
|
|
5308
|
+
}).join("\n")}
|
|
5236
5309
|
${enableFogOfWar ? (
|
|
5237
5310
|
// Inline a minimal manifest with the SSR matches
|
|
5238
5311
|
`window.__reactRouterManifest = ${JSON.stringify(
|
|
@@ -5263,11 +5336,7 @@ import(${JSON.stringify(manifest.entry.module)});`;
|
|
|
5263
5336
|
}
|
|
5264
5337
|
));
|
|
5265
5338
|
}, []);
|
|
5266
|
-
let
|
|
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);
|
|
5339
|
+
let preloads = isHydrated ? [] : manifest.entry.imports.concat(getModuleLinkHrefs(matches, manifest));
|
|
5271
5340
|
return isHydrated ? null : /* @__PURE__ */ React9.createElement(React9.Fragment, null, !enableFogOfWar ? /* @__PURE__ */ React9.createElement(
|
|
5272
5341
|
"link",
|
|
5273
5342
|
{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-df6bc686c
|
|
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-UDQUAXYC.mjs";
|
|
29
29
|
|
|
30
30
|
// lib/dom-export/dom-router-provider.tsx
|
|
31
31
|
import * as React from "react";
|