react-router 0.0.0-experimental-23decd7bc → 0.0.0-experimental-1d8f3ee

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.
Files changed (63) hide show
  1. package/dist/development/{browser-CmIT056Z.d.mts → browser-Dy-ESm-r.d.mts} +1 -1
  2. package/dist/development/chunk-DUZSUZPY.js +42 -0
  3. package/dist/development/{chunk-GJVCYY62.mjs → chunk-LCKD6EHG.mjs} +29 -51
  4. package/dist/development/{chunk-H2M6MMUH.js → chunk-PACOJA5V.js} +34 -56
  5. package/dist/development/{chunk-3E3CD4NY.mjs → chunk-RCYOOFMP.mjs} +64 -10
  6. package/dist/development/{chunk-I3MHZ4NU.js → chunk-XDNTV7B4.js} +1 -1
  7. package/dist/development/{components-CwtESh53.d.mts → components-Yh5Jx3In.d.mts} +1 -1
  8. package/dist/development/dom-export.d.mts +8 -3
  9. package/dist/development/dom-export.d.ts +6 -0
  10. package/dist/development/dom-export.js +16 -6
  11. package/dist/development/dom-export.mjs +14 -6
  12. package/dist/{production/index-react-server-client-unV28389.d.ts → development/index-react-server-client-BM01za3r.d.ts} +3 -29
  13. package/dist/{production/index-react-server-client-CzKQ01cq.d.mts → development/index-react-server-client-CdDCHn2r.d.mts} +4 -30
  14. package/dist/development/index-react-server-client.d.mts +3 -3
  15. package/dist/development/index-react-server-client.d.ts +2 -2
  16. package/dist/development/index-react-server-client.js +4 -4
  17. package/dist/development/index-react-server-client.mjs +2 -2
  18. package/dist/development/index-react-server.d.mts +1 -1
  19. package/dist/development/index-react-server.d.ts +1 -1
  20. package/dist/development/index-react-server.js +2 -2
  21. package/dist/development/index-react-server.mjs +2 -2
  22. package/dist/development/index.d.mts +15 -11
  23. package/dist/development/index.d.ts +11 -7
  24. package/dist/development/index.js +129 -103
  25. package/dist/development/index.mjs +3 -3
  26. package/dist/development/lib/types/internal.d.mts +1 -1
  27. package/dist/development/lib/types/internal.d.ts +1 -1
  28. package/dist/development/lib/types/internal.js +1 -1
  29. package/dist/development/lib/types/internal.mjs +1 -1
  30. package/dist/{production/route-data-Csr8hE3v.d.mts → development/route-data-DJcKSHWq.d.mts} +30 -2
  31. package/dist/{production/route-data-x_b_BLCv.d.ts → development/routeModules-C82B1sOz.d.ts} +193 -165
  32. package/dist/production/{browser-CmIT056Z.d.mts → browser-Dy-ESm-r.d.mts} +1 -1
  33. package/dist/production/chunk-DUZSUZPY.js +42 -0
  34. package/dist/production/{chunk-7TUGB72O.js → chunk-F3UQRILU.js} +34 -56
  35. package/dist/production/{chunk-XNTCWHOK.mjs → chunk-FDXAKVCT.mjs} +64 -10
  36. package/dist/production/{chunk-YWCG2M57.mjs → chunk-VJ4SUXKA.mjs} +29 -51
  37. package/dist/production/{chunk-I3MHZ4NU.js → chunk-XDNTV7B4.js} +1 -1
  38. package/dist/production/{components-CwtESh53.d.mts → components-Yh5Jx3In.d.mts} +1 -1
  39. package/dist/production/dom-export.d.mts +8 -3
  40. package/dist/production/dom-export.d.ts +6 -0
  41. package/dist/production/dom-export.js +16 -6
  42. package/dist/production/dom-export.mjs +14 -6
  43. package/dist/{development/index-react-server-client-unV28389.d.ts → production/index-react-server-client-BM01za3r.d.ts} +3 -29
  44. package/dist/{development/index-react-server-client-CzKQ01cq.d.mts → production/index-react-server-client-CdDCHn2r.d.mts} +4 -30
  45. package/dist/production/index-react-server-client.d.mts +3 -3
  46. package/dist/production/index-react-server-client.d.ts +2 -2
  47. package/dist/production/index-react-server-client.js +4 -4
  48. package/dist/production/index-react-server-client.mjs +2 -2
  49. package/dist/production/index-react-server.d.mts +1 -1
  50. package/dist/production/index-react-server.d.ts +1 -1
  51. package/dist/production/index-react-server.js +2 -2
  52. package/dist/production/index-react-server.mjs +2 -2
  53. package/dist/production/index.d.mts +15 -11
  54. package/dist/production/index.d.ts +11 -7
  55. package/dist/production/index.js +129 -103
  56. package/dist/production/index.mjs +3 -3
  57. package/dist/production/lib/types/internal.d.mts +1 -1
  58. package/dist/production/lib/types/internal.d.ts +1 -1
  59. package/dist/production/lib/types/internal.js +1 -1
  60. package/dist/production/lib/types/internal.mjs +1 -1
  61. package/dist/{development/route-data-x_b_BLCv.d.ts → production/route-data-DJcKSHWq.d.mts} +40 -12
  62. package/dist/{development/route-data-Csr8hE3v.d.mts → production/routeModules-C82B1sOz.d.ts} +183 -155
  63. package/package.json +6 -1
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { p as ActionFunction, C as ClientActionFunction, q as ClientLoaderFunction, r as HeadersFunction, s as LinksFunction, t as LoaderFunction, M as MetaFunction, u as ShouldRevalidateFunction, L as Location, g as Params, h as Router } from './route-data-Csr8hE3v.mjs';
2
+ import { q as ActionFunction, C as ClientActionFunction, r as ClientLoaderFunction, s as HeadersFunction, t as LinksFunction, u as LoaderFunction, M as MetaFunction, v as ShouldRevalidateFunction, c as Location, h as Params, i as Router } from './route-data-DJcKSHWq.mjs';
3
3
  import { AsyncLocalStorage } from 'node:async_hooks';
4
4
 
5
5
  type ServerContext = {
@@ -0,0 +1,42 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }/**
2
+ * react-router v0.0.0-experimental-1d8f3ee
3
+ *
4
+ * Copyright (c) Remix Software Inc.
5
+ *
6
+ * This source code is licensed under the MIT license found in the
7
+ * LICENSE.md file in the root directory of this source tree.
8
+ *
9
+ * @license MIT
10
+ */
11
+
12
+ // lib/dom/ssr/routeModules.ts
13
+ var defaultLoadRouteModule = async (route, routeModulesCache) => {
14
+ if (route.id in routeModulesCache) {
15
+ return routeModulesCache[route.id];
16
+ }
17
+ try {
18
+ let routeModule = await Promise.resolve().then(() => _interopRequireWildcard(require(
19
+ /* @vite-ignore */
20
+ /* webpackIgnore: true */
21
+ route.module
22
+ )));
23
+ routeModulesCache[route.id] = routeModule;
24
+ return routeModule;
25
+ } catch (error) {
26
+ console.error(
27
+ `Error loading route module \`${route.module}\`, reloading page...`
28
+ );
29
+ console.error(error);
30
+ if (window.__reactRouterContext && window.__reactRouterContext.isSpaMode && // @ts-expect-error
31
+ void 0) {
32
+ throw error;
33
+ }
34
+ window.location.reload();
35
+ return new Promise(() => {
36
+ });
37
+ }
38
+ };
39
+
40
+
41
+
42
+ exports.defaultLoadRouteModule = defaultLoadRouteModule;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v0.0.0-experimental-23decd7bc
2
+ * react-router v0.0.0-experimental-1d8f3ee
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1214,6 +1214,7 @@ function createRouter(init) {
1214
1214
  blockers = new Map(blockers);
1215
1215
  blockers.forEach((_, k) => blockers.set(k, IDLE_BLOCKER));
1216
1216
  }
1217
+ let restoreScrollPosition = isUninterruptedRevalidation ? false : getSavedScrollPosition(location, newState.matches || state.matches);
1217
1218
  let preventScrollReset = pendingPreventScrollReset === true || state.navigation.formMethod != null && isMutationMethod(state.navigation.formMethod) && location.state?._isRedirect !== true;
1218
1219
  if (inFlightDataRoutes) {
1219
1220
  dataRoutes = inFlightDataRoutes;
@@ -1264,10 +1265,7 @@ function createRouter(init) {
1264
1265
  initialized: true,
1265
1266
  navigation: IDLE_NAVIGATION,
1266
1267
  revalidation: "idle",
1267
- restoreScrollPosition: getSavedScrollPosition(
1268
- location,
1269
- newState.matches || state.matches
1270
- ),
1268
+ restoreScrollPosition,
1271
1269
  preventScrollReset,
1272
1270
  blockers
1273
1271
  },
@@ -7328,34 +7326,6 @@ import * as React9 from "react";
7328
7326
  // lib/dom/ssr/components.tsx
7329
7327
  import * as React8 from "react";
7330
7328
 
7331
- // lib/dom/ssr/routeModules.ts
7332
- async function loadRouteModule(route, routeModulesCache) {
7333
- if (route.id in routeModulesCache) {
7334
- return routeModulesCache[route.id];
7335
- }
7336
- try {
7337
- let routeModule = await import(
7338
- /* @vite-ignore */
7339
- /* webpackIgnore: true */
7340
- route.module
7341
- );
7342
- routeModulesCache[route.id] = routeModule;
7343
- return routeModule;
7344
- } catch (error) {
7345
- console.error(
7346
- `Error loading route module \`${route.module}\`, reloading page...`
7347
- );
7348
- console.error(error);
7349
- if (window.__reactRouterContext && window.__reactRouterContext.isSpaMode && // @ts-expect-error
7350
- import.meta.hot) {
7351
- throw error;
7352
- }
7353
- window.location.reload();
7354
- return new Promise(() => {
7355
- });
7356
- }
7357
- }
7358
-
7359
7329
  // lib/dom/ssr/links.ts
7360
7330
  function getKeyedLinksForMatches(matches, routeModules, manifest) {
7361
7331
  let descriptors = matches.map((match) => {
@@ -7437,7 +7407,7 @@ function isHtmlLinkDescriptor(object) {
7437
7407
  }
7438
7408
  return typeof object.rel === "string" && typeof object.href === "string";
7439
7409
  }
7440
- async function getKeyedPrefetchLinks(matches, manifest, routeModules) {
7410
+ async function getKeyedPrefetchLinks(matches, manifest, routeModules, loadRouteModule) {
7441
7411
  let links = await Promise.all(
7442
7412
  matches.map(async (match) => {
7443
7413
  let route = manifest.routes[match.route.id];
@@ -7660,13 +7630,14 @@ function createServerRoutes(manifest, routeModules, future, isSpaMode, parentId
7660
7630
  return dataRoute;
7661
7631
  });
7662
7632
  }
7663
- function createClientRoutesWithHMRRevalidationOptOut(needsRevalidation, manifest, routeModulesCache, initialState, ssr, isSpaMode) {
7633
+ function createClientRoutesWithHMRRevalidationOptOut(needsRevalidation, manifest, routeModulesCache, initialState, ssr, isSpaMode, loadRouteModule) {
7664
7634
  return createClientRoutes(
7665
7635
  manifest,
7666
7636
  routeModulesCache,
7667
7637
  initialState,
7668
7638
  ssr,
7669
7639
  isSpaMode,
7640
+ loadRouteModule,
7670
7641
  "",
7671
7642
  groupRoutesByParentId(manifest),
7672
7643
  needsRevalidation
@@ -7686,7 +7657,7 @@ function noActionDefinedError(type, routeId) {
7686
7657
  console.error(msg);
7687
7658
  throw new ErrorResponseImpl(405, "Method Not Allowed", new Error(msg), true);
7688
7659
  }
7689
- function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSpaMode, parentId = "", routesByParentId = groupRoutesByParentId(manifest), needsRevalidation) {
7660
+ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSpaMode, loadRouteModule, parentId = "", routesByParentId = groupRoutesByParentId(manifest), needsRevalidation) {
7690
7661
  return (routesByParentId[parentId] || []).map((route) => {
7691
7662
  let routeModule = routeModulesCache[route.id];
7692
7663
  function fetchServerHandler(singleFetch) {
@@ -7841,7 +7812,8 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
7841
7812
  }
7842
7813
  let routeModulePromise = loadRouteModuleWithBlockingLinks(
7843
7814
  route,
7844
- routeModulesCache
7815
+ routeModulesCache,
7816
+ loadRouteModule
7845
7817
  );
7846
7818
  prefetchRouteModuleChunks(route);
7847
7819
  return await routeModulePromise;
@@ -7916,6 +7888,7 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
7916
7888
  initialState,
7917
7889
  ssr,
7918
7890
  isSpaMode,
7891
+ loadRouteModule,
7919
7892
  route.id,
7920
7893
  routesByParentId,
7921
7894
  needsRevalidation
@@ -7961,7 +7934,7 @@ function wrapShouldRevalidateForHdr(routeId, routeShouldRevalidate, needsRevalid
7961
7934
  return routeShouldRevalidate ? routeShouldRevalidate(arg) : arg.defaultShouldRevalidate;
7962
7935
  };
7963
7936
  }
7964
- async function loadRouteModuleWithBlockingLinks(route, routeModules) {
7937
+ async function loadRouteModuleWithBlockingLinks(route, routeModules, loadRouteModule) {
7965
7938
  let routeModulePromise = loadRouteModule(route, routeModules);
7966
7939
  let prefetchRouteCssPromise = prefetchRouteCss(route);
7967
7940
  let routeModule = await routeModulePromise;
@@ -8025,7 +7998,7 @@ function getPartialManifest({ sri, ...manifest }, router) {
8025
7998
  sri: sri ? true : void 0
8026
7999
  };
8027
8000
  }
8028
- function getPatchRoutesOnNavigationFunction(manifest, routeModules, ssr, routeDiscovery, isSpaMode, basename) {
8001
+ function getPatchRoutesOnNavigationFunction(manifest, routeModules, ssr, routeDiscovery, isSpaMode, basename, loadRouteModule) {
8029
8002
  if (!isFogOfWarEnabled(routeDiscovery, ssr)) {
8030
8003
  return void 0;
8031
8004
  }
@@ -8040,6 +8013,7 @@ function getPatchRoutesOnNavigationFunction(manifest, routeModules, ssr, routeDi
8040
8013
  routeModules,
8041
8014
  ssr,
8042
8015
  isSpaMode,
8016
+ loadRouteModule,
8043
8017
  basename,
8044
8018
  routeDiscovery.manifestPath,
8045
8019
  patch,
@@ -8047,7 +8021,7 @@ function getPatchRoutesOnNavigationFunction(manifest, routeModules, ssr, routeDi
8047
8021
  );
8048
8022
  };
8049
8023
  }
8050
- function useFogOFWarDiscovery(router, manifest, routeModules, ssr, routeDiscovery, isSpaMode) {
8024
+ function useFogOFWarDiscovery(router, manifest, routeModules, ssr, routeDiscovery, isSpaMode, loadRouteModule) {
8051
8025
  React7.useEffect(() => {
8052
8026
  if (!isFogOfWarEnabled(routeDiscovery, ssr) || // @ts-expect-error - TS doesn't know about this yet
8053
8027
  window.navigator?.connection?.saveData === true) {
@@ -8083,6 +8057,7 @@ function useFogOFWarDiscovery(router, manifest, routeModules, ssr, routeDiscover
8083
8057
  routeModules,
8084
8058
  ssr,
8085
8059
  isSpaMode,
8060
+ loadRouteModule,
8086
8061
  router.basename,
8087
8062
  routeDiscovery.manifestPath,
8088
8063
  router.patchRoutes
@@ -8111,7 +8086,7 @@ function getManifestPath(_manifestPath, basename) {
8111
8086
  return `${basename}${manifestPath}`.replace(/\/+/g, "/");
8112
8087
  }
8113
8088
  var MANIFEST_VERSION_STORAGE_KEY = "react-router-manifest-version";
8114
- async function fetchAndApplyManifestPatches(paths, errorReloadPath, manifest, routeModules, ssr, isSpaMode, basename, manifestPath, patchRoutes, signal) {
8089
+ async function fetchAndApplyManifestPatches(paths, errorReloadPath, manifest, routeModules, ssr, isSpaMode, loadRouteModule, basename, manifestPath, patchRoutes, signal) {
8115
8090
  let url = new URL(
8116
8091
  getManifestPath(manifestPath, basename),
8117
8092
  window.location.origin
@@ -8172,7 +8147,7 @@ async function fetchAndApplyManifestPatches(paths, errorReloadPath, manifest, ro
8172
8147
  parentIds.forEach(
8173
8148
  (parentId) => patchRoutes(
8174
8149
  parentId || null,
8175
- createClientRoutes(patches, routeModules, null, ssr, isSpaMode, parentId)
8150
+ createClientRoutes(patches, routeModules, null, ssr, isSpaMode, loadRouteModule, parentId)
8176
8151
  )
8177
8152
  );
8178
8153
  }
@@ -8321,17 +8296,20 @@ function PrefetchPageLinks({
8321
8296
  return /* @__PURE__ */ React8.createElement(PrefetchPageLinksImpl, { page, matches, ...dataLinkProps });
8322
8297
  }
8323
8298
  function useKeyedPrefetchLinks(matches) {
8324
- let { manifest, routeModules } = useFrameworkContext();
8299
+ let { manifest, routeModules, loadRouteModule } = useFrameworkContext();
8325
8300
  let [keyedPrefetchLinks, setKeyedPrefetchLinks] = React8.useState([]);
8326
8301
  React8.useEffect(() => {
8327
8302
  let interrupted = false;
8328
- void getKeyedPrefetchLinks(matches, manifest, routeModules).then(
8329
- (links) => {
8330
- if (!interrupted) {
8331
- setKeyedPrefetchLinks(links);
8332
- }
8303
+ void getKeyedPrefetchLinks(
8304
+ matches,
8305
+ manifest,
8306
+ routeModules,
8307
+ loadRouteModule
8308
+ ).then((links) => {
8309
+ if (!interrupted) {
8310
+ setKeyedPrefetchLinks(links);
8333
8311
  }
8334
- );
8312
+ });
8335
8313
  return () => {
8336
8314
  interrupted = true;
8337
8315
  };
@@ -8796,7 +8774,7 @@ var isBrowser = typeof window !== "undefined" && typeof window.document !== "und
8796
8774
  try {
8797
8775
  if (isBrowser) {
8798
8776
  window.__reactRouterVersion = // @ts-expect-error
8799
- "0.0.0-experimental-23decd7bc";
8777
+ "0.0.0-experimental-1d8f3ee";
8800
8778
  }
8801
8779
  } catch (e) {
8802
8780
  }
@@ -9293,7 +9271,7 @@ function useSearchParams(defaultInit) {
9293
9271
  let setSearchParams = React10.useCallback(
9294
9272
  (nextInit, navigateOptions) => {
9295
9273
  const newSearchParams = createSearchParams(
9296
- typeof nextInit === "function" ? nextInit(searchParams) : nextInit
9274
+ typeof nextInit === "function" ? nextInit(new URLSearchParams(searchParams)) : nextInit
9297
9275
  );
9298
9276
  hasSetSearchParamsRef.current = true;
9299
9277
  navigate("?" + newSearchParams, navigateOptions);
@@ -1,5 +1,5 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }/**
2
- * react-router v0.0.0-experimental-23decd7bc
2
+ * react-router v0.0.0-experimental-1d8f3ee
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -11,7 +11,7 @@
11
11
 
12
12
 
13
13
 
14
- var _chunkI3MHZ4NUjs = require('./chunk-I3MHZ4NU.js');
14
+ var _chunkXDNTV7B4js = require('./chunk-XDNTV7B4.js');
15
15
 
16
16
  // lib/router/history.ts
17
17
  var Action = /* @__PURE__ */ ((Action2) => {
@@ -366,7 +366,7 @@ function unstable_createContext(defaultValue) {
366
366
  var _map;
367
367
  var unstable_RouterContextProvider = class {
368
368
  constructor(init) {
369
- _chunkI3MHZ4NUjs.__privateAdd.call(void 0, this, _map, /* @__PURE__ */ new Map());
369
+ _chunkXDNTV7B4js.__privateAdd.call(void 0, this, _map, /* @__PURE__ */ new Map());
370
370
  if (init) {
371
371
  for (let [context, value] of init) {
372
372
  this.set(context, value);
@@ -374,8 +374,8 @@ var unstable_RouterContextProvider = class {
374
374
  }
375
375
  }
376
376
  get(context) {
377
- if (_chunkI3MHZ4NUjs.__privateGet.call(void 0, this, _map).has(context)) {
378
- return _chunkI3MHZ4NUjs.__privateGet.call(void 0, this, _map).get(context);
377
+ if (_chunkXDNTV7B4js.__privateGet.call(void 0, this, _map).has(context)) {
378
+ return _chunkXDNTV7B4js.__privateGet.call(void 0, this, _map).get(context);
379
379
  }
380
380
  if (context.defaultValue !== void 0) {
381
381
  return context.defaultValue;
@@ -383,7 +383,7 @@ var unstable_RouterContextProvider = class {
383
383
  throw new Error("No value found for context");
384
384
  }
385
385
  set(context, value) {
386
- _chunkI3MHZ4NUjs.__privateGet.call(void 0, this, _map).set(context, value);
386
+ _chunkXDNTV7B4js.__privateGet.call(void 0, this, _map).set(context, value);
387
387
  }
388
388
  };
389
389
  _map = new WeakMap();
@@ -1212,6 +1212,7 @@ function createRouter(init) {
1212
1212
  blockers = new Map(blockers);
1213
1213
  blockers.forEach((_, k) => blockers.set(k, IDLE_BLOCKER));
1214
1214
  }
1215
+ let restoreScrollPosition = isUninterruptedRevalidation ? false : getSavedScrollPosition(location, newState.matches || state.matches);
1215
1216
  let preventScrollReset = pendingPreventScrollReset === true || state.navigation.formMethod != null && isMutationMethod(state.navigation.formMethod) && _optionalChain([location, 'access', _7 => _7.state, 'optionalAccess', _8 => _8._isRedirect]) !== true;
1216
1217
  if (inFlightDataRoutes) {
1217
1218
  dataRoutes = inFlightDataRoutes;
@@ -1262,10 +1263,7 @@ function createRouter(init) {
1262
1263
  initialized: true,
1263
1264
  navigation: IDLE_NAVIGATION,
1264
1265
  revalidation: "idle",
1265
- restoreScrollPosition: getSavedScrollPosition(
1266
- location,
1267
- newState.matches || state.matches
1268
- ),
1266
+ restoreScrollPosition,
1269
1267
  preventScrollReset,
1270
1268
  blockers
1271
1269
  },
@@ -7326,34 +7324,6 @@ function createDeferred2() {
7326
7324
  // lib/dom/ssr/components.tsx
7327
7325
 
7328
7326
 
7329
- // lib/dom/ssr/routeModules.ts
7330
- async function loadRouteModule(route, routeModulesCache) {
7331
- if (route.id in routeModulesCache) {
7332
- return routeModulesCache[route.id];
7333
- }
7334
- try {
7335
- let routeModule = await Promise.resolve().then(() => _interopRequireWildcard(require(
7336
- /* @vite-ignore */
7337
- /* webpackIgnore: true */
7338
- route.module
7339
- )));
7340
- routeModulesCache[route.id] = routeModule;
7341
- return routeModule;
7342
- } catch (error) {
7343
- console.error(
7344
- `Error loading route module \`${route.module}\`, reloading page...`
7345
- );
7346
- console.error(error);
7347
- if (window.__reactRouterContext && window.__reactRouterContext.isSpaMode && // @ts-expect-error
7348
- void 0) {
7349
- throw error;
7350
- }
7351
- window.location.reload();
7352
- return new Promise(() => {
7353
- });
7354
- }
7355
- }
7356
-
7357
7327
  // lib/dom/ssr/links.ts
7358
7328
  function getKeyedLinksForMatches(matches, routeModules, manifest) {
7359
7329
  let descriptors = matches.map((match) => {
@@ -7435,7 +7405,7 @@ function isHtmlLinkDescriptor(object) {
7435
7405
  }
7436
7406
  return typeof object.rel === "string" && typeof object.href === "string";
7437
7407
  }
7438
- async function getKeyedPrefetchLinks(matches, manifest, routeModules) {
7408
+ async function getKeyedPrefetchLinks(matches, manifest, routeModules, loadRouteModule) {
7439
7409
  let links = await Promise.all(
7440
7410
  matches.map(async (match) => {
7441
7411
  let route = manifest.routes[match.route.id];
@@ -7658,13 +7628,14 @@ function createServerRoutes(manifest, routeModules, future, isSpaMode, parentId
7658
7628
  return dataRoute;
7659
7629
  });
7660
7630
  }
7661
- function createClientRoutesWithHMRRevalidationOptOut(needsRevalidation, manifest, routeModulesCache, initialState, ssr, isSpaMode) {
7631
+ function createClientRoutesWithHMRRevalidationOptOut(needsRevalidation, manifest, routeModulesCache, initialState, ssr, isSpaMode, loadRouteModule) {
7662
7632
  return createClientRoutes(
7663
7633
  manifest,
7664
7634
  routeModulesCache,
7665
7635
  initialState,
7666
7636
  ssr,
7667
7637
  isSpaMode,
7638
+ loadRouteModule,
7668
7639
  "",
7669
7640
  groupRoutesByParentId(manifest),
7670
7641
  needsRevalidation
@@ -7684,7 +7655,7 @@ function noActionDefinedError(type, routeId) {
7684
7655
  console.error(msg);
7685
7656
  throw new ErrorResponseImpl(405, "Method Not Allowed", new Error(msg), true);
7686
7657
  }
7687
- function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSpaMode, parentId = "", routesByParentId = groupRoutesByParentId(manifest), needsRevalidation) {
7658
+ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSpaMode, loadRouteModule, parentId = "", routesByParentId = groupRoutesByParentId(manifest), needsRevalidation) {
7688
7659
  return (routesByParentId[parentId] || []).map((route) => {
7689
7660
  let routeModule = routeModulesCache[route.id];
7690
7661
  function fetchServerHandler(singleFetch) {
@@ -7839,7 +7810,8 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
7839
7810
  }
7840
7811
  let routeModulePromise = loadRouteModuleWithBlockingLinks(
7841
7812
  route,
7842
- routeModulesCache
7813
+ routeModulesCache,
7814
+ loadRouteModule
7843
7815
  );
7844
7816
  prefetchRouteModuleChunks(route);
7845
7817
  return await routeModulePromise;
@@ -7914,6 +7886,7 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
7914
7886
  initialState,
7915
7887
  ssr,
7916
7888
  isSpaMode,
7889
+ loadRouteModule,
7917
7890
  route.id,
7918
7891
  routesByParentId,
7919
7892
  needsRevalidation
@@ -7959,7 +7932,7 @@ function wrapShouldRevalidateForHdr(routeId, routeShouldRevalidate, needsRevalid
7959
7932
  return routeShouldRevalidate ? routeShouldRevalidate(arg) : arg.defaultShouldRevalidate;
7960
7933
  };
7961
7934
  }
7962
- async function loadRouteModuleWithBlockingLinks(route, routeModules) {
7935
+ async function loadRouteModuleWithBlockingLinks(route, routeModules, loadRouteModule) {
7963
7936
  let routeModulePromise = loadRouteModule(route, routeModules);
7964
7937
  let prefetchRouteCssPromise = prefetchRouteCss(route);
7965
7938
  let routeModule = await routeModulePromise;
@@ -8023,7 +7996,7 @@ function getPartialManifest({ sri, ...manifest }, router) {
8023
7996
  sri: sri ? true : void 0
8024
7997
  };
8025
7998
  }
8026
- function getPatchRoutesOnNavigationFunction(manifest, routeModules, ssr, routeDiscovery, isSpaMode, basename) {
7999
+ function getPatchRoutesOnNavigationFunction(manifest, routeModules, ssr, routeDiscovery, isSpaMode, basename, loadRouteModule) {
8027
8000
  if (!isFogOfWarEnabled(routeDiscovery, ssr)) {
8028
8001
  return void 0;
8029
8002
  }
@@ -8038,6 +8011,7 @@ function getPatchRoutesOnNavigationFunction(manifest, routeModules, ssr, routeDi
8038
8011
  routeModules,
8039
8012
  ssr,
8040
8013
  isSpaMode,
8014
+ loadRouteModule,
8041
8015
  basename,
8042
8016
  routeDiscovery.manifestPath,
8043
8017
  patch,
@@ -8045,7 +8019,7 @@ function getPatchRoutesOnNavigationFunction(manifest, routeModules, ssr, routeDi
8045
8019
  );
8046
8020
  };
8047
8021
  }
8048
- function useFogOFWarDiscovery(router, manifest, routeModules, ssr, routeDiscovery, isSpaMode) {
8022
+ function useFogOFWarDiscovery(router, manifest, routeModules, ssr, routeDiscovery, isSpaMode, loadRouteModule) {
8049
8023
  React7.useEffect(() => {
8050
8024
  if (!isFogOfWarEnabled(routeDiscovery, ssr) || // @ts-expect-error - TS doesn't know about this yet
8051
8025
  _optionalChain([window, 'access', _97 => _97.navigator, 'optionalAccess', _98 => _98.connection, 'optionalAccess', _99 => _99.saveData]) === true) {
@@ -8081,6 +8055,7 @@ function useFogOFWarDiscovery(router, manifest, routeModules, ssr, routeDiscover
8081
8055
  routeModules,
8082
8056
  ssr,
8083
8057
  isSpaMode,
8058
+ loadRouteModule,
8084
8059
  router.basename,
8085
8060
  routeDiscovery.manifestPath,
8086
8061
  router.patchRoutes
@@ -8109,7 +8084,7 @@ function getManifestPath(_manifestPath, basename) {
8109
8084
  return `${basename}${manifestPath}`.replace(/\/+/g, "/");
8110
8085
  }
8111
8086
  var MANIFEST_VERSION_STORAGE_KEY = "react-router-manifest-version";
8112
- async function fetchAndApplyManifestPatches(paths, errorReloadPath, manifest, routeModules, ssr, isSpaMode, basename, manifestPath, patchRoutes, signal) {
8087
+ async function fetchAndApplyManifestPatches(paths, errorReloadPath, manifest, routeModules, ssr, isSpaMode, loadRouteModule, basename, manifestPath, patchRoutes, signal) {
8113
8088
  let url = new URL(
8114
8089
  getManifestPath(manifestPath, basename),
8115
8090
  window.location.origin
@@ -8170,7 +8145,7 @@ async function fetchAndApplyManifestPatches(paths, errorReloadPath, manifest, ro
8170
8145
  parentIds.forEach(
8171
8146
  (parentId) => patchRoutes(
8172
8147
  parentId || null,
8173
- createClientRoutes(patches, routeModules, null, ssr, isSpaMode, parentId)
8148
+ createClientRoutes(patches, routeModules, null, ssr, isSpaMode, loadRouteModule, parentId)
8174
8149
  )
8175
8150
  );
8176
8151
  }
@@ -8319,17 +8294,20 @@ function PrefetchPageLinks({
8319
8294
  return /* @__PURE__ */ React8.createElement(PrefetchPageLinksImpl, { page, matches, ...dataLinkProps });
8320
8295
  }
8321
8296
  function useKeyedPrefetchLinks(matches) {
8322
- let { manifest, routeModules } = useFrameworkContext();
8297
+ let { manifest, routeModules, loadRouteModule } = useFrameworkContext();
8323
8298
  let [keyedPrefetchLinks, setKeyedPrefetchLinks] = React8.useState([]);
8324
8299
  React8.useEffect(() => {
8325
8300
  let interrupted = false;
8326
- void getKeyedPrefetchLinks(matches, manifest, routeModules).then(
8327
- (links) => {
8328
- if (!interrupted) {
8329
- setKeyedPrefetchLinks(links);
8330
- }
8301
+ void getKeyedPrefetchLinks(
8302
+ matches,
8303
+ manifest,
8304
+ routeModules,
8305
+ loadRouteModule
8306
+ ).then((links) => {
8307
+ if (!interrupted) {
8308
+ setKeyedPrefetchLinks(links);
8331
8309
  }
8332
- );
8310
+ });
8333
8311
  return () => {
8334
8312
  interrupted = true;
8335
8313
  };
@@ -8794,7 +8772,7 @@ var isBrowser = typeof window !== "undefined" && typeof window.document !== "und
8794
8772
  try {
8795
8773
  if (isBrowser) {
8796
8774
  window.__reactRouterVersion = // @ts-expect-error
8797
- "0.0.0-experimental-23decd7bc";
8775
+ "0.0.0-experimental-1d8f3ee";
8798
8776
  }
8799
8777
  } catch (e) {
8800
8778
  }
@@ -9291,7 +9269,7 @@ function useSearchParams(defaultInit) {
9291
9269
  let setSearchParams = React10.useCallback(
9292
9270
  (nextInit, navigateOptions) => {
9293
9271
  const newSearchParams = createSearchParams(
9294
- typeof nextInit === "function" ? nextInit(searchParams) : nextInit
9272
+ typeof nextInit === "function" ? nextInit(new URLSearchParams(searchParams)) : nextInit
9295
9273
  );
9296
9274
  hasSetSearchParamsRef.current = true;
9297
9275
  navigate("?" + newSearchParams, navigateOptions);