react-router 0.0.0-experimental-a25096010 → 0.0.0-experimental-235eba2

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 (59) hide show
  1. package/dist/development/{browser-B02esi_h.d.mts → browser-Dy-ESm-r.d.mts} +1 -1
  2. package/dist/development/{chunk-XWD7ABXG.js → chunk-FMGWC27P.js} +33 -53
  3. package/dist/development/{chunk-JTD5PWHB.mjs → chunk-G5SITQUG.mjs} +48 -7
  4. package/dist/development/chunk-IPBRDHM5.js +42 -0
  5. package/dist/development/{chunk-OTZ3EGEK.mjs → chunk-QIMD7XHI.mjs} +28 -48
  6. package/dist/{production/chunk-TTGOW5M2.js → development/chunk-VI6JQQJE.js} +1 -1
  7. package/dist/development/{components-MOzEzb5N.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/development/{index-react-server-client-d0m7XgRZ.d.ts → index-react-server-client-BM01za3r.d.ts} +3 -29
  13. package/dist/{production/index-react-server-client-lW36X-5S.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.js +1 -1
  19. package/dist/development/index-react-server.mjs +1 -1
  20. package/dist/development/index.d.mts +16 -12
  21. package/dist/development/index.d.ts +12 -8
  22. package/dist/development/index.js +114 -101
  23. package/dist/development/index.mjs +3 -3
  24. package/dist/development/lib/types/internal.d.mts +1 -1
  25. package/dist/development/lib/types/internal.d.ts +1 -1
  26. package/dist/development/lib/types/internal.js +1 -1
  27. package/dist/development/lib/types/internal.mjs +1 -1
  28. package/dist/{production/route-data-Cxmm6DBJ.d.mts → development/route-data-DJcKSHWq.d.mts} +29 -1
  29. package/dist/{production/route-data-iMPjm8Hn.d.ts → development/routeModules-C82B1sOz.d.ts} +192 -164
  30. package/dist/production/{browser-B02esi_h.d.mts → browser-Dy-ESm-r.d.mts} +1 -1
  31. package/dist/production/chunk-IPBRDHM5.js +42 -0
  32. package/dist/production/{chunk-7IAZ4QFY.mjs → chunk-K5OF4EJE.mjs} +48 -7
  33. package/dist/production/{chunk-YSMGG6Y7.mjs → chunk-RNB2MV7B.mjs} +28 -48
  34. package/dist/{development/chunk-TTGOW5M2.js → production/chunk-VI6JQQJE.js} +1 -1
  35. package/dist/production/{chunk-XOATTKMN.js → chunk-ZGVHHRGW.js} +33 -53
  36. package/dist/production/{components-MOzEzb5N.d.mts → components-Yh5Jx3In.d.mts} +1 -1
  37. package/dist/production/dom-export.d.mts +8 -3
  38. package/dist/production/dom-export.d.ts +6 -0
  39. package/dist/production/dom-export.js +16 -6
  40. package/dist/production/dom-export.mjs +14 -6
  41. package/dist/production/{index-react-server-client-d0m7XgRZ.d.ts → index-react-server-client-BM01za3r.d.ts} +3 -29
  42. package/dist/{development/index-react-server-client-lW36X-5S.d.mts → production/index-react-server-client-CdDCHn2r.d.mts} +4 -30
  43. package/dist/production/index-react-server-client.d.mts +3 -3
  44. package/dist/production/index-react-server-client.d.ts +2 -2
  45. package/dist/production/index-react-server-client.js +4 -4
  46. package/dist/production/index-react-server-client.mjs +2 -2
  47. package/dist/production/index-react-server.js +1 -1
  48. package/dist/production/index-react-server.mjs +1 -1
  49. package/dist/production/index.d.mts +16 -12
  50. package/dist/production/index.d.ts +12 -8
  51. package/dist/production/index.js +114 -101
  52. package/dist/production/index.mjs +3 -3
  53. package/dist/production/lib/types/internal.d.mts +1 -1
  54. package/dist/production/lib/types/internal.d.ts +1 -1
  55. package/dist/production/lib/types/internal.js +1 -1
  56. package/dist/production/lib/types/internal.mjs +1 -1
  57. package/dist/{development/route-data-iMPjm8Hn.d.ts → production/route-data-DJcKSHWq.d.mts} +39 -11
  58. package/dist/{development/route-data-Cxmm6DBJ.d.mts → production/routeModules-C82B1sOz.d.ts} +182 -154
  59. package/package.json +1 -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-Cxmm6DBJ.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 = {
@@ -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-a25096010
2
+ * react-router v0.0.0-experimental-235eba2
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -11,7 +11,7 @@
11
11
 
12
12
 
13
13
 
14
- var _chunkTTGOW5M2js = require('./chunk-TTGOW5M2.js');
14
+ var _chunkVI6JQQJEjs = require('./chunk-VI6JQQJE.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
- _chunkTTGOW5M2js.__privateAdd.call(void 0, this, _map, /* @__PURE__ */ new Map());
369
+ _chunkVI6JQQJEjs.__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 (_chunkTTGOW5M2js.__privateGet.call(void 0, this, _map).has(context)) {
378
- return _chunkTTGOW5M2js.__privateGet.call(void 0, this, _map).get(context);
377
+ if (_chunkVI6JQQJEjs.__privateGet.call(void 0, this, _map).has(context)) {
378
+ return _chunkVI6JQQJEjs.__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
- _chunkTTGOW5M2js.__privateGet.call(void 0, this, _map).set(context, value);
386
+ _chunkVI6JQQJEjs.__privateGet.call(void 0, this, _map).set(context, value);
387
387
  }
388
388
  };
389
389
  _map = new WeakMap();
@@ -7324,34 +7324,6 @@ function createDeferred2() {
7324
7324
  // lib/dom/ssr/components.tsx
7325
7325
 
7326
7326
 
7327
- // lib/dom/ssr/routeModules.ts
7328
- async function loadRouteModule(route, routeModulesCache) {
7329
- if (route.id in routeModulesCache) {
7330
- return routeModulesCache[route.id];
7331
- }
7332
- try {
7333
- let routeModule = await Promise.resolve().then(() => _interopRequireWildcard(require(
7334
- /* @vite-ignore */
7335
- /* webpackIgnore: true */
7336
- route.module
7337
- )));
7338
- routeModulesCache[route.id] = routeModule;
7339
- return routeModule;
7340
- } catch (error) {
7341
- console.error(
7342
- `Error loading route module \`${route.module}\`, reloading page...`
7343
- );
7344
- console.error(error);
7345
- if (window.__reactRouterContext && window.__reactRouterContext.isSpaMode && // @ts-expect-error
7346
- void 0) {
7347
- throw error;
7348
- }
7349
- window.location.reload();
7350
- return new Promise(() => {
7351
- });
7352
- }
7353
- }
7354
-
7355
7327
  // lib/dom/ssr/links.ts
7356
7328
  function getKeyedLinksForMatches(matches, routeModules, manifest) {
7357
7329
  let descriptors = matches.map((match) => {
@@ -7433,7 +7405,7 @@ function isHtmlLinkDescriptor(object) {
7433
7405
  }
7434
7406
  return typeof object.rel === "string" && typeof object.href === "string";
7435
7407
  }
7436
- async function getKeyedPrefetchLinks(matches, manifest, routeModules) {
7408
+ async function getKeyedPrefetchLinks(matches, manifest, routeModules, loadRouteModule) {
7437
7409
  let links = await Promise.all(
7438
7410
  matches.map(async (match) => {
7439
7411
  let route = manifest.routes[match.route.id];
@@ -7656,13 +7628,14 @@ function createServerRoutes(manifest, routeModules, future, isSpaMode, parentId
7656
7628
  return dataRoute;
7657
7629
  });
7658
7630
  }
7659
- function createClientRoutesWithHMRRevalidationOptOut(needsRevalidation, manifest, routeModulesCache, initialState, ssr, isSpaMode) {
7631
+ function createClientRoutesWithHMRRevalidationOptOut(needsRevalidation, manifest, routeModulesCache, initialState, ssr, isSpaMode, loadRouteModule) {
7660
7632
  return createClientRoutes(
7661
7633
  manifest,
7662
7634
  routeModulesCache,
7663
7635
  initialState,
7664
7636
  ssr,
7665
7637
  isSpaMode,
7638
+ loadRouteModule,
7666
7639
  "",
7667
7640
  groupRoutesByParentId(manifest),
7668
7641
  needsRevalidation
@@ -7682,7 +7655,7 @@ function noActionDefinedError(type, routeId) {
7682
7655
  console.error(msg);
7683
7656
  throw new ErrorResponseImpl(405, "Method Not Allowed", new Error(msg), true);
7684
7657
  }
7685
- 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) {
7686
7659
  return (routesByParentId[parentId] || []).map((route) => {
7687
7660
  let routeModule = routeModulesCache[route.id];
7688
7661
  function fetchServerHandler(singleFetch) {
@@ -7837,7 +7810,8 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
7837
7810
  }
7838
7811
  let routeModulePromise = loadRouteModuleWithBlockingLinks(
7839
7812
  route,
7840
- routeModulesCache
7813
+ routeModulesCache,
7814
+ loadRouteModule
7841
7815
  );
7842
7816
  prefetchRouteModuleChunks(route);
7843
7817
  return await routeModulePromise;
@@ -7912,6 +7886,7 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
7912
7886
  initialState,
7913
7887
  ssr,
7914
7888
  isSpaMode,
7889
+ loadRouteModule,
7915
7890
  route.id,
7916
7891
  routesByParentId,
7917
7892
  needsRevalidation
@@ -7957,7 +7932,7 @@ function wrapShouldRevalidateForHdr(routeId, routeShouldRevalidate, needsRevalid
7957
7932
  return routeShouldRevalidate ? routeShouldRevalidate(arg) : arg.defaultShouldRevalidate;
7958
7933
  };
7959
7934
  }
7960
- async function loadRouteModuleWithBlockingLinks(route, routeModules) {
7935
+ async function loadRouteModuleWithBlockingLinks(route, routeModules, loadRouteModule) {
7961
7936
  let routeModulePromise = loadRouteModule(route, routeModules);
7962
7937
  let prefetchRouteCssPromise = prefetchRouteCss(route);
7963
7938
  let routeModule = await routeModulePromise;
@@ -8021,7 +7996,7 @@ function getPartialManifest({ sri, ...manifest }, router) {
8021
7996
  sri: sri ? true : void 0
8022
7997
  };
8023
7998
  }
8024
- function getPatchRoutesOnNavigationFunction(manifest, routeModules, ssr, routeDiscovery, isSpaMode, basename) {
7999
+ function getPatchRoutesOnNavigationFunction(manifest, routeModules, ssr, routeDiscovery, isSpaMode, basename, loadRouteModule) {
8025
8000
  if (!isFogOfWarEnabled(routeDiscovery, ssr)) {
8026
8001
  return void 0;
8027
8002
  }
@@ -8036,6 +8011,7 @@ function getPatchRoutesOnNavigationFunction(manifest, routeModules, ssr, routeDi
8036
8011
  routeModules,
8037
8012
  ssr,
8038
8013
  isSpaMode,
8014
+ loadRouteModule,
8039
8015
  basename,
8040
8016
  routeDiscovery.manifestPath,
8041
8017
  patch,
@@ -8043,7 +8019,7 @@ function getPatchRoutesOnNavigationFunction(manifest, routeModules, ssr, routeDi
8043
8019
  );
8044
8020
  };
8045
8021
  }
8046
- function useFogOFWarDiscovery(router, manifest, routeModules, ssr, routeDiscovery, isSpaMode) {
8022
+ function useFogOFWarDiscovery(router, manifest, routeModules, ssr, routeDiscovery, isSpaMode, loadRouteModule) {
8047
8023
  React7.useEffect(() => {
8048
8024
  if (!isFogOfWarEnabled(routeDiscovery, ssr) || // @ts-expect-error - TS doesn't know about this yet
8049
8025
  _optionalChain([window, 'access', _97 => _97.navigator, 'optionalAccess', _98 => _98.connection, 'optionalAccess', _99 => _99.saveData]) === true) {
@@ -8079,6 +8055,7 @@ function useFogOFWarDiscovery(router, manifest, routeModules, ssr, routeDiscover
8079
8055
  routeModules,
8080
8056
  ssr,
8081
8057
  isSpaMode,
8058
+ loadRouteModule,
8082
8059
  router.basename,
8083
8060
  routeDiscovery.manifestPath,
8084
8061
  router.patchRoutes
@@ -8097,7 +8074,7 @@ function useFogOFWarDiscovery(router, manifest, routeModules, ssr, routeDiscover
8097
8074
  attributeFilter: ["data-discover", "href", "action"]
8098
8075
  });
8099
8076
  return () => observer.disconnect();
8100
- }, [ssr, isSpaMode, manifest, routeModules, router, routeDiscovery]);
8077
+ }, [ssr, isSpaMode, manifest, routeModules, router, routeDiscovery, loadRouteModule]);
8101
8078
  }
8102
8079
  function getManifestPath(_manifestPath, basename) {
8103
8080
  let manifestPath = _manifestPath || "/__manifest";
@@ -8107,7 +8084,7 @@ function getManifestPath(_manifestPath, basename) {
8107
8084
  return `${basename}${manifestPath}`.replace(/\/+/g, "/");
8108
8085
  }
8109
8086
  var MANIFEST_VERSION_STORAGE_KEY = "react-router-manifest-version";
8110
- 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) {
8111
8088
  let url = new URL(
8112
8089
  getManifestPath(manifestPath, basename),
8113
8090
  window.location.origin
@@ -8168,7 +8145,7 @@ async function fetchAndApplyManifestPatches(paths, errorReloadPath, manifest, ro
8168
8145
  parentIds.forEach(
8169
8146
  (parentId) => patchRoutes(
8170
8147
  parentId || null,
8171
- createClientRoutes(patches, routeModules, null, ssr, isSpaMode, parentId)
8148
+ createClientRoutes(patches, routeModules, null, ssr, isSpaMode, loadRouteModule, parentId)
8172
8149
  )
8173
8150
  );
8174
8151
  }
@@ -8317,21 +8294,24 @@ function PrefetchPageLinks({
8317
8294
  return /* @__PURE__ */ React8.createElement(PrefetchPageLinksImpl, { page, matches, ...dataLinkProps });
8318
8295
  }
8319
8296
  function useKeyedPrefetchLinks(matches) {
8320
- let { manifest, routeModules } = useFrameworkContext();
8297
+ let { manifest, routeModules, loadRouteModule } = useFrameworkContext();
8321
8298
  let [keyedPrefetchLinks, setKeyedPrefetchLinks] = React8.useState([]);
8322
8299
  React8.useEffect(() => {
8323
8300
  let interrupted = false;
8324
- void getKeyedPrefetchLinks(matches, manifest, routeModules).then(
8325
- (links) => {
8326
- if (!interrupted) {
8327
- setKeyedPrefetchLinks(links);
8328
- }
8301
+ void getKeyedPrefetchLinks(
8302
+ matches,
8303
+ manifest,
8304
+ routeModules,
8305
+ loadRouteModule
8306
+ ).then((links) => {
8307
+ if (!interrupted) {
8308
+ setKeyedPrefetchLinks(links);
8329
8309
  }
8330
- );
8310
+ });
8331
8311
  return () => {
8332
8312
  interrupted = true;
8333
8313
  };
8334
- }, [matches, manifest, routeModules]);
8314
+ }, [matches, manifest, routeModules, loadRouteModule]);
8335
8315
  return keyedPrefetchLinks;
8336
8316
  }
8337
8317
  function PrefetchPageLinksImpl({
@@ -8792,7 +8772,7 @@ var isBrowser = typeof window !== "undefined" && typeof window.document !== "und
8792
8772
  try {
8793
8773
  if (isBrowser) {
8794
8774
  window.__reactRouterVersion = // @ts-expect-error
8795
- "0.0.0-experimental-a25096010";
8775
+ "0.0.0-experimental-235eba2";
8796
8776
  }
8797
8777
  } catch (e) {
8798
8778
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v0.0.0-experimental-a25096010
2
+ * react-router v0.0.0-experimental-235eba2
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -57,10 +57,40 @@ import {
57
57
  withComponentProps,
58
58
  withErrorBoundaryProps,
59
59
  withHydrateFallbackProps
60
- } from "./chunk-OTZ3EGEK.mjs";
60
+ } from "./chunk-QIMD7XHI.mjs";
61
61
 
62
62
  // lib/dom/ssr/server.tsx
63
63
  import * as React from "react";
64
+
65
+ // lib/dom/ssr/routeModules.ts
66
+ var defaultLoadRouteModule = async (route, routeModulesCache) => {
67
+ if (route.id in routeModulesCache) {
68
+ return routeModulesCache[route.id];
69
+ }
70
+ try {
71
+ let routeModule = await import(
72
+ /* @vite-ignore */
73
+ /* webpackIgnore: true */
74
+ route.module
75
+ );
76
+ routeModulesCache[route.id] = routeModule;
77
+ return routeModule;
78
+ } catch (error) {
79
+ console.error(
80
+ `Error loading route module \`${route.module}\`, reloading page...`
81
+ );
82
+ console.error(error);
83
+ if (window.__reactRouterContext && window.__reactRouterContext.isSpaMode && // @ts-expect-error
84
+ import.meta.hot) {
85
+ throw error;
86
+ }
87
+ window.location.reload();
88
+ return new Promise(() => {
89
+ });
90
+ }
91
+ };
92
+
93
+ // lib/dom/ssr/server.tsx
64
94
  function ServerRouter({
65
95
  context,
66
96
  url,
@@ -106,7 +136,8 @@ function ServerRouter({
106
136
  isSpaMode: context.isSpaMode,
107
137
  routeDiscovery: context.routeDiscovery,
108
138
  serializeError: context.serializeError,
109
- renderMeta: context.renderMeta
139
+ renderMeta: context.renderMeta,
140
+ loadRouteModule: defaultLoadRouteModule
110
141
  }
111
142
  },
112
143
  /* @__PURE__ */ React.createElement(RemixErrorBoundary, { location: router.state.location }, /* @__PURE__ */ React.createElement(
@@ -136,7 +167,8 @@ function createRoutesStub(routes, unstable_getContext) {
136
167
  initialEntries,
137
168
  initialIndex,
138
169
  hydrationData,
139
- future
170
+ future,
171
+ loadRouteModule = defaultLoadRouteModule
140
172
  }) {
141
173
  let routerRef = React2.useRef();
142
174
  let remixContextRef = React2.useRef();
@@ -155,6 +187,7 @@ function createRoutesStub(routes, unstable_getContext) {
155
187
  routeModules: {},
156
188
  ssr: false,
157
189
  isSpaMode: false,
190
+ loadRouteModule,
158
191
  routeDiscovery: { mode: "lazy", manifestPath: "/__manifest" }
159
192
  };
160
193
  let patched = processRoutes(
@@ -1360,7 +1393,8 @@ async function handleDocumentRequest(serverMode, build, staticHandler, request,
1360
1393
  ssr: build.ssr,
1361
1394
  routeDiscovery: build.routeDiscovery,
1362
1395
  isSpaMode: isSpaMode2,
1363
- serializeError: (err) => serializeError(err, serverMode)
1396
+ serializeError: (err) => serializeError(err, serverMode),
1397
+ loadRouteModule: defaultLoadRouteModule
1364
1398
  };
1365
1399
  let handleDocumentRequestFunction = build.entry.module.default;
1366
1400
  try {
@@ -2177,7 +2211,10 @@ function RSCHydratedRouter({
2177
2211
  }
2178
2212
  },
2179
2213
  routeDiscovery: { mode: "lazy", manifestPath: "/__manifest" },
2180
- routeModules: {}
2214
+ routeModules: {},
2215
+ loadRouteModule: () => {
2216
+ throw new Error("Not required in RSC Mode");
2217
+ }
2181
2218
  };
2182
2219
  return /* @__PURE__ */ React4.createElement(RSCRouterContext.Provider, { value: true }, /* @__PURE__ */ React4.createElement(RSCRouterGlobalErrorBoundary, { location: location2 }, /* @__PURE__ */ React4.createElement(FrameworkContext.Provider, { value: frameworkContext }, /* @__PURE__ */ React4.createElement(RouterProvider, { router, flushSync: ReactDOM.flushSync }))));
2183
2220
  }
@@ -2566,7 +2603,10 @@ function RSCStaticRouter({
2566
2603
  }
2567
2604
  },
2568
2605
  routeDiscovery: { mode: "lazy", manifestPath: "/__manifest" },
2569
- routeModules: {}
2606
+ routeModules: {},
2607
+ loadRouteModule: () => {
2608
+ throw new Error("Not required in RSC Mode");
2609
+ }
2570
2610
  };
2571
2611
  return /* @__PURE__ */ React5.createElement(RSCRouterContext.Provider, { value: true }, /* @__PURE__ */ React5.createElement(RSCRouterGlobalErrorBoundary, { location: payload.location }, /* @__PURE__ */ React5.createElement(FrameworkContext.Provider, { value: frameworkContext }, /* @__PURE__ */ React5.createElement(
2572
2612
  StaticRouterProvider,
@@ -2658,6 +2698,7 @@ function deserializeErrors(errors) {
2658
2698
  }
2659
2699
 
2660
2700
  export {
2701
+ defaultLoadRouteModule,
2661
2702
  ServerRouter,
2662
2703
  createRoutesStub,
2663
2704
  createCookie,
@@ -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-235eba2
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-a25096010
2
+ * react-router v0.0.0-experimental-235eba2
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -7326,34 +7326,6 @@ import * as React9 from "react";
7326
7326
  // lib/dom/ssr/components.tsx
7327
7327
  import * as React8 from "react";
7328
7328
 
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 import(
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
- import.meta.hot) {
7349
- throw error;
7350
- }
7351
- window.location.reload();
7352
- return new Promise(() => {
7353
- });
7354
- }
7355
- }
7356
-
7357
7329
  // lib/dom/ssr/links.ts
7358
7330
  function getKeyedLinksForMatches(matches, routeModules, manifest) {
7359
7331
  let descriptors = matches.map((match) => {
@@ -7435,7 +7407,7 @@ function isHtmlLinkDescriptor(object) {
7435
7407
  }
7436
7408
  return typeof object.rel === "string" && typeof object.href === "string";
7437
7409
  }
7438
- async function getKeyedPrefetchLinks(matches, manifest, routeModules) {
7410
+ async function getKeyedPrefetchLinks(matches, manifest, routeModules, loadRouteModule) {
7439
7411
  let links = await Promise.all(
7440
7412
  matches.map(async (match) => {
7441
7413
  let route = manifest.routes[match.route.id];
@@ -7658,13 +7630,14 @@ function createServerRoutes(manifest, routeModules, future, isSpaMode, parentId
7658
7630
  return dataRoute;
7659
7631
  });
7660
7632
  }
7661
- function createClientRoutesWithHMRRevalidationOptOut(needsRevalidation, manifest, routeModulesCache, initialState, ssr, isSpaMode) {
7633
+ function createClientRoutesWithHMRRevalidationOptOut(needsRevalidation, manifest, routeModulesCache, initialState, ssr, isSpaMode, loadRouteModule) {
7662
7634
  return createClientRoutes(
7663
7635
  manifest,
7664
7636
  routeModulesCache,
7665
7637
  initialState,
7666
7638
  ssr,
7667
7639
  isSpaMode,
7640
+ loadRouteModule,
7668
7641
  "",
7669
7642
  groupRoutesByParentId(manifest),
7670
7643
  needsRevalidation
@@ -7684,7 +7657,7 @@ function noActionDefinedError(type, routeId) {
7684
7657
  console.error(msg);
7685
7658
  throw new ErrorResponseImpl(405, "Method Not Allowed", new Error(msg), true);
7686
7659
  }
7687
- 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) {
7688
7661
  return (routesByParentId[parentId] || []).map((route) => {
7689
7662
  let routeModule = routeModulesCache[route.id];
7690
7663
  function fetchServerHandler(singleFetch) {
@@ -7839,7 +7812,8 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
7839
7812
  }
7840
7813
  let routeModulePromise = loadRouteModuleWithBlockingLinks(
7841
7814
  route,
7842
- routeModulesCache
7815
+ routeModulesCache,
7816
+ loadRouteModule
7843
7817
  );
7844
7818
  prefetchRouteModuleChunks(route);
7845
7819
  return await routeModulePromise;
@@ -7914,6 +7888,7 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
7914
7888
  initialState,
7915
7889
  ssr,
7916
7890
  isSpaMode,
7891
+ loadRouteModule,
7917
7892
  route.id,
7918
7893
  routesByParentId,
7919
7894
  needsRevalidation
@@ -7959,7 +7934,7 @@ function wrapShouldRevalidateForHdr(routeId, routeShouldRevalidate, needsRevalid
7959
7934
  return routeShouldRevalidate ? routeShouldRevalidate(arg) : arg.defaultShouldRevalidate;
7960
7935
  };
7961
7936
  }
7962
- async function loadRouteModuleWithBlockingLinks(route, routeModules) {
7937
+ async function loadRouteModuleWithBlockingLinks(route, routeModules, loadRouteModule) {
7963
7938
  let routeModulePromise = loadRouteModule(route, routeModules);
7964
7939
  let prefetchRouteCssPromise = prefetchRouteCss(route);
7965
7940
  let routeModule = await routeModulePromise;
@@ -8023,7 +7998,7 @@ function getPartialManifest({ sri, ...manifest }, router) {
8023
7998
  sri: sri ? true : void 0
8024
7999
  };
8025
8000
  }
8026
- function getPatchRoutesOnNavigationFunction(manifest, routeModules, ssr, routeDiscovery, isSpaMode, basename) {
8001
+ function getPatchRoutesOnNavigationFunction(manifest, routeModules, ssr, routeDiscovery, isSpaMode, basename, loadRouteModule) {
8027
8002
  if (!isFogOfWarEnabled(routeDiscovery, ssr)) {
8028
8003
  return void 0;
8029
8004
  }
@@ -8038,6 +8013,7 @@ function getPatchRoutesOnNavigationFunction(manifest, routeModules, ssr, routeDi
8038
8013
  routeModules,
8039
8014
  ssr,
8040
8015
  isSpaMode,
8016
+ loadRouteModule,
8041
8017
  basename,
8042
8018
  routeDiscovery.manifestPath,
8043
8019
  patch,
@@ -8045,7 +8021,7 @@ function getPatchRoutesOnNavigationFunction(manifest, routeModules, ssr, routeDi
8045
8021
  );
8046
8022
  };
8047
8023
  }
8048
- function useFogOFWarDiscovery(router, manifest, routeModules, ssr, routeDiscovery, isSpaMode) {
8024
+ function useFogOFWarDiscovery(router, manifest, routeModules, ssr, routeDiscovery, isSpaMode, loadRouteModule) {
8049
8025
  React7.useEffect(() => {
8050
8026
  if (!isFogOfWarEnabled(routeDiscovery, ssr) || // @ts-expect-error - TS doesn't know about this yet
8051
8027
  window.navigator?.connection?.saveData === true) {
@@ -8081,6 +8057,7 @@ function useFogOFWarDiscovery(router, manifest, routeModules, ssr, routeDiscover
8081
8057
  routeModules,
8082
8058
  ssr,
8083
8059
  isSpaMode,
8060
+ loadRouteModule,
8084
8061
  router.basename,
8085
8062
  routeDiscovery.manifestPath,
8086
8063
  router.patchRoutes
@@ -8099,7 +8076,7 @@ function useFogOFWarDiscovery(router, manifest, routeModules, ssr, routeDiscover
8099
8076
  attributeFilter: ["data-discover", "href", "action"]
8100
8077
  });
8101
8078
  return () => observer.disconnect();
8102
- }, [ssr, isSpaMode, manifest, routeModules, router, routeDiscovery]);
8079
+ }, [ssr, isSpaMode, manifest, routeModules, router, routeDiscovery, loadRouteModule]);
8103
8080
  }
8104
8081
  function getManifestPath(_manifestPath, basename) {
8105
8082
  let manifestPath = _manifestPath || "/__manifest";
@@ -8109,7 +8086,7 @@ function getManifestPath(_manifestPath, basename) {
8109
8086
  return `${basename}${manifestPath}`.replace(/\/+/g, "/");
8110
8087
  }
8111
8088
  var MANIFEST_VERSION_STORAGE_KEY = "react-router-manifest-version";
8112
- 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) {
8113
8090
  let url = new URL(
8114
8091
  getManifestPath(manifestPath, basename),
8115
8092
  window.location.origin
@@ -8170,7 +8147,7 @@ async function fetchAndApplyManifestPatches(paths, errorReloadPath, manifest, ro
8170
8147
  parentIds.forEach(
8171
8148
  (parentId) => patchRoutes(
8172
8149
  parentId || null,
8173
- createClientRoutes(patches, routeModules, null, ssr, isSpaMode, parentId)
8150
+ createClientRoutes(patches, routeModules, null, ssr, isSpaMode, loadRouteModule, parentId)
8174
8151
  )
8175
8152
  );
8176
8153
  }
@@ -8319,21 +8296,24 @@ function PrefetchPageLinks({
8319
8296
  return /* @__PURE__ */ React8.createElement(PrefetchPageLinksImpl, { page, matches, ...dataLinkProps });
8320
8297
  }
8321
8298
  function useKeyedPrefetchLinks(matches) {
8322
- let { manifest, routeModules } = useFrameworkContext();
8299
+ let { manifest, routeModules, loadRouteModule } = useFrameworkContext();
8323
8300
  let [keyedPrefetchLinks, setKeyedPrefetchLinks] = React8.useState([]);
8324
8301
  React8.useEffect(() => {
8325
8302
  let interrupted = false;
8326
- void getKeyedPrefetchLinks(matches, manifest, routeModules).then(
8327
- (links) => {
8328
- if (!interrupted) {
8329
- setKeyedPrefetchLinks(links);
8330
- }
8303
+ void getKeyedPrefetchLinks(
8304
+ matches,
8305
+ manifest,
8306
+ routeModules,
8307
+ loadRouteModule
8308
+ ).then((links) => {
8309
+ if (!interrupted) {
8310
+ setKeyedPrefetchLinks(links);
8331
8311
  }
8332
- );
8312
+ });
8333
8313
  return () => {
8334
8314
  interrupted = true;
8335
8315
  };
8336
- }, [matches, manifest, routeModules]);
8316
+ }, [matches, manifest, routeModules, loadRouteModule]);
8337
8317
  return keyedPrefetchLinks;
8338
8318
  }
8339
8319
  function PrefetchPageLinksImpl({
@@ -8794,7 +8774,7 @@ var isBrowser = typeof window !== "undefined" && typeof window.document !== "und
8794
8774
  try {
8795
8775
  if (isBrowser) {
8796
8776
  window.__reactRouterVersion = // @ts-expect-error
8797
- "0.0.0-experimental-a25096010";
8777
+ "0.0.0-experimental-235eba2";
8798
8778
  }
8799
8779
  } catch (e) {
8800
8780
  }
@@ -1,5 +1,5 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});/**
2
- * react-router v0.0.0-experimental-a25096010
2
+ * react-router v0.0.0-experimental-235eba2
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -1,4 +1,4 @@
1
- import { T as To, N as NavigateOptions, B as BlockerFunction, a as Blocker, S as SerializeFrom, b as RelativeRoutingType, L as Location, P as ParamParseKey, c as Path, d as PathPattern, e as PathMatch, U as UIMatch, f as Navigation, A as Action, g as Params, h as Router$1, i as RouteObject, I as InitialEntry, j as NonIndexRouteObject, k as LazyRouteFunction, l as IndexRouteObject, m as Navigator, R as RouterInit, F as FutureConfig, H as HydrationState, D as DataStrategyFunction, n as PatchRoutesOnNavigationFunction, o as RouteMatch } from './route-data-Cxmm6DBJ.mjs';
1
+ import { T as To, N as NavigateOptions, B as BlockerFunction, a as Blocker, S as SerializeFrom, b as RelativeRoutingType, c as Location, P as ParamParseKey, d as Path, e as PathPattern, f as PathMatch, U as UIMatch, g as Navigation, A as Action, h as Params, i as Router$1, j as RouteObject, I as InitialEntry, k as NonIndexRouteObject, l as LazyRouteFunction, m as IndexRouteObject, n as Navigator, R as RouterInit, F as FutureConfig, H as HydrationState, D as DataStrategyFunction, o as PatchRoutesOnNavigationFunction, p as RouteMatch } from './route-data-DJcKSHWq.mjs';
2
2
  import * as React from 'react';
3
3
 
4
4
  /**
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
- import { R as RouterProviderProps$1 } from './components-MOzEzb5N.mjs';
3
- import './browser-B02esi_h.mjs';
4
- import { R as RouterInit } from './route-data-Cxmm6DBJ.mjs';
2
+ import { R as RouterProviderProps$1 } from './components-Yh5Jx3In.mjs';
3
+ import './browser-Dy-ESm-r.mjs';
4
+ import { R as RouterInit, L as LoadRouteModuleFunction } from './route-data-DJcKSHWq.mjs';
5
5
  import 'node:async_hooks';
6
6
 
7
7
  type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
@@ -13,6 +13,11 @@ interface HydratedRouterProps {
13
13
  * to `clientLoader`/`clientActon` functions
14
14
  */
15
15
  unstable_getContext?: RouterInit["unstable_getContext"];
16
+ /**
17
+ * Optional function to take control over how route modules are loaded into
18
+ * the browser. Primarily for use by bundler plugins.
19
+ */
20
+ unstable_loadRouteModule?: LoadRouteModuleFunction;
16
21
  }
17
22
  /**
18
23
  * Framework-mode router component to be used in `entry.client.tsx` to hydrate a
@@ -1,5 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { RouterProviderProps as RouterProviderProps$1, RouterInit } from 'react-router';
3
+ import { L as LoadRouteModuleFunction } from './routeModules-C82B1sOz.js';
3
4
 
4
5
  type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
5
6
  declare function RouterProvider(props: Omit<RouterProviderProps, "flushSync">): React.JSX.Element;
@@ -10,6 +11,11 @@ interface HydratedRouterProps {
10
11
  * to `clientLoader`/`clientActon` functions
11
12
  */
12
13
  unstable_getContext?: RouterInit["unstable_getContext"];
14
+ /**
15
+ * Optional function to take control over how route modules are loaded into
16
+ * the browser. Primarily for use by bundler plugins.
17
+ */
18
+ unstable_loadRouteModule?: LoadRouteModuleFunction;
13
19
  }
14
20
  /**
15
21
  * Framework-mode router component to be used in `entry.client.tsx` to hydrate a