react-router 7.13.2 → 7.14.0

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 (60) hide show
  1. package/CHANGELOG.md +67 -0
  2. package/dist/development/{browser-Bfn3xw9E.d.ts → browser-C9Ar1yxG.d.ts} +13 -10
  3. package/dist/development/{browser-Di6-vSl-.d.mts → browser-vtIR1Kpe.d.mts} +13 -10
  4. package/dist/development/{chunk-UALY5CBT.mjs → chunk-2UH5WJXA.mjs} +21 -7
  5. package/dist/development/{chunk-GO74ODU3.js → chunk-IK6APEEG.js} +191 -118
  6. package/dist/development/{chunk-HPFFRPKK.js → chunk-NXTEWSJO.js} +99 -99
  7. package/dist/development/{chunk-UVKPFVEO.mjs → chunk-QFMPRPBF.mjs} +192 -119
  8. package/dist/development/{chunk-LLP6DRWX.js → chunk-WAVMRYR2.js} +7 -7
  9. package/dist/development/dom-export.d.mts +1 -1
  10. package/dist/development/dom-export.d.ts +1 -1
  11. package/dist/development/dom-export.js +65 -54
  12. package/dist/development/dom-export.mjs +34 -23
  13. package/dist/{production/index-react-server-client-BcrVT7Dd.d.mts → development/index-react-server-client-BwWaHAr3.d.mts} +7 -5
  14. package/dist/development/{index-react-server-client-CCwMoQIT.d.ts → index-react-server-client-luDbagNU.d.ts} +7 -5
  15. package/dist/development/index-react-server-client.d.mts +1 -1
  16. package/dist/development/index-react-server-client.d.ts +1 -1
  17. package/dist/development/index-react-server-client.js +4 -4
  18. package/dist/development/index-react-server-client.mjs +2 -2
  19. package/dist/development/index-react-server.d.mts +12 -3
  20. package/dist/development/index-react-server.d.ts +12 -3
  21. package/dist/development/index-react-server.js +58 -18
  22. package/dist/development/index-react-server.mjs +58 -18
  23. package/dist/development/index.d.mts +4 -4
  24. package/dist/development/index.d.ts +4 -4
  25. package/dist/development/index.js +101 -87
  26. package/dist/development/index.mjs +3 -3
  27. package/dist/development/lib/types/internal.d.mts +10 -10
  28. package/dist/development/lib/types/internal.d.ts +10 -10
  29. package/dist/development/lib/types/internal.js +1 -1
  30. package/dist/development/lib/types/internal.mjs +1 -1
  31. package/dist/production/{browser-Bfn3xw9E.d.ts → browser-C9Ar1yxG.d.ts} +13 -10
  32. package/dist/production/{browser-Di6-vSl-.d.mts → browser-vtIR1Kpe.d.mts} +13 -10
  33. package/dist/production/{chunk-CAFVLUDY.js → chunk-355DUZMC.js} +7 -7
  34. package/dist/production/{chunk-LKUVSIBA.js → chunk-4TJ7T2OQ.js} +191 -118
  35. package/dist/production/{chunk-XAAX7KIK.js → chunk-FPT5DLVJ.js} +99 -99
  36. package/dist/production/{chunk-2BDJPJTA.mjs → chunk-HZQGQD2X.mjs} +192 -119
  37. package/dist/production/{chunk-PY35PE22.mjs → chunk-X5LK27NZ.mjs} +21 -7
  38. package/dist/production/dom-export.d.mts +1 -1
  39. package/dist/production/dom-export.d.ts +1 -1
  40. package/dist/production/dom-export.js +65 -54
  41. package/dist/production/dom-export.mjs +34 -23
  42. package/dist/{development/index-react-server-client-BcrVT7Dd.d.mts → production/index-react-server-client-BwWaHAr3.d.mts} +7 -5
  43. package/dist/production/{index-react-server-client-CCwMoQIT.d.ts → index-react-server-client-luDbagNU.d.ts} +7 -5
  44. package/dist/production/index-react-server-client.d.mts +1 -1
  45. package/dist/production/index-react-server-client.d.ts +1 -1
  46. package/dist/production/index-react-server-client.js +4 -4
  47. package/dist/production/index-react-server-client.mjs +2 -2
  48. package/dist/production/index-react-server.d.mts +12 -3
  49. package/dist/production/index-react-server.d.ts +12 -3
  50. package/dist/production/index-react-server.js +58 -18
  51. package/dist/production/index-react-server.mjs +58 -18
  52. package/dist/production/index.d.mts +4 -4
  53. package/dist/production/index.d.ts +4 -4
  54. package/dist/production/index.js +101 -87
  55. package/dist/production/index.mjs +3 -3
  56. package/dist/production/lib/types/internal.d.mts +10 -10
  57. package/dist/production/lib/types/internal.d.ts +10 -10
  58. package/dist/production/lib/types/internal.js +1 -1
  59. package/dist/production/lib/types/internal.mjs +1 -1
  60. package/package.json +1 -1
@@ -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 v7.13.2
2
+ * react-router v7.14.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -13,7 +13,7 @@
13
13
 
14
14
 
15
15
 
16
- var _chunkLLP6DRWXjs = require('./chunk-LLP6DRWX.js');
16
+ var _chunkWAVMRYR2js = require('./chunk-WAVMRYR2.js');
17
17
 
18
18
 
19
19
 
@@ -33,7 +33,7 @@ var _chunkLLP6DRWXjs = require('./chunk-LLP6DRWX.js');
33
33
 
34
34
 
35
35
 
36
- var _chunkGO74ODU3js = require('./chunk-GO74ODU3.js');
36
+ var _chunkIK6APEEGjs = require('./chunk-IK6APEEG.js');
37
37
 
38
38
  // lib/dom-export/dom-router-provider.tsx
39
39
  var _react = require('react'); var React = _interopRequireWildcard(_react); var React2 = _interopRequireWildcard(_react); var React3 = _interopRequireWildcard(_react);
@@ -213,7 +213,7 @@ function HydratedRouter(props) {
213
213
  }, []);
214
214
  React2.useEffect(() => {
215
215
  if (process.env.NODE_ENV === "development" && criticalCss === void 0) {
216
- document.querySelectorAll(`[${_chunkGO74ODU3js.CRITICAL_CSS_DATA_ATTRIBUTE}]`).forEach((element) => element.remove());
216
+ document.querySelectorAll(`[${_chunkIK6APEEGjs.CRITICAL_CSS_DATA_ATTRIBUTE}]`).forEach((element) => element.remove());
217
217
  }
218
218
  }, [criticalCss]);
219
219
  let [location2, setLocation] = React2.useState(router.state.location);
@@ -272,6 +272,7 @@ function HydratedRouter(props) {
272
272
  // lib/rsc/browser.tsx
273
273
 
274
274
 
275
+ var defaultManifestPath = "/__manifest";
275
276
  function createCallServer({
276
277
  createFromReadableStream,
277
278
  createTemporaryReferenceSet,
@@ -391,15 +392,7 @@ function createRouterFromPayload({
391
392
  };
392
393
  if (payload.type !== "render") throw new Error("Invalid payload type");
393
394
  globalVar.__reactRouterRouteModules = _nullishCoalesce(globalVar.__reactRouterRouteModules, () => ( {}));
394
- _chunkLLP6DRWXjs.populateRSCRouteModules.call(void 0, globalVar.__reactRouterRouteModules, payload.matches);
395
- let patches = /* @__PURE__ */ new Map();
396
- _optionalChain([payload, 'access', _22 => _22.patches, 'optionalAccess', _23 => _23.forEach, 'call', _24 => _24((patch) => {
397
- _chunkGO74ODU3js.invariant.call(void 0, patch.parentId, "Invalid patch parentId");
398
- if (!patches.has(patch.parentId)) {
399
- patches.set(patch.parentId, []);
400
- }
401
- _optionalChain([patches, 'access', _25 => _25.get, 'call', _26 => _26(patch.parentId), 'optionalAccess', _27 => _27.push, 'call', _28 => _28(patch)]);
402
- })]);
395
+ _chunkWAVMRYR2js.populateRSCRouteModules.call(void 0, globalVar.__reactRouterRouteModules, payload.matches);
403
396
  let routes = payload.matches.reduceRight((previous, match) => {
404
397
  const route = createRouteFromServerManifest(
405
398
  match,
@@ -407,21 +400,18 @@ function createRouterFromPayload({
407
400
  );
408
401
  if (previous.length > 0) {
409
402
  route.children = previous;
410
- let childrenToPatch = patches.get(match.id);
411
- if (childrenToPatch) {
412
- route.children.push(
413
- ...childrenToPatch.map((r) => createRouteFromServerManifest(r))
414
- );
415
- }
403
+ } else if (!route.index) {
404
+ route.children = [];
416
405
  }
417
406
  return [route];
418
407
  }, []);
419
- globalVar.__reactRouterDataRouter = _chunkGO74ODU3js.createRouter.call(void 0, {
408
+ let applyPatchesPromise;
409
+ globalVar.__reactRouterDataRouter = _chunkIK6APEEGjs.createRouter.call(void 0, {
420
410
  routes,
421
411
  getContext,
422
412
  basename: payload.basename,
423
- history: _chunkGO74ODU3js.createBrowserHistory.call(void 0, ),
424
- hydrationData: _chunkLLP6DRWXjs.getHydrationData.call(void 0, {
413
+ history: _chunkIK6APEEGjs.createBrowserHistory.call(void 0, ),
414
+ hydrationData: _chunkWAVMRYR2js.getHydrationData.call(void 0, {
425
415
  state: {
426
416
  loaderData: payload.loaderData,
427
417
  actionData: payload.actionData,
@@ -430,7 +420,7 @@ function createRouterFromPayload({
430
420
  routes,
431
421
  getRouteInfo: (routeId) => {
432
422
  let match = payload.matches.find((m) => m.id === routeId);
433
- _chunkGO74ODU3js.invariant.call(void 0, match, "Route not found in payload");
423
+ _chunkIK6APEEGjs.invariant.call(void 0, match, "Route not found in payload");
434
424
  return {
435
425
  clientLoader: match.clientLoader,
436
426
  hasLoader: match.hasLoader,
@@ -442,6 +432,23 @@ function createRouterFromPayload({
442
432
  isSpaMode: false
443
433
  }),
444
434
  async patchRoutesOnNavigation({ path, signal }) {
435
+ if (payload.routeDiscovery.mode === "initial") {
436
+ if (!applyPatchesPromise) {
437
+ applyPatchesPromise = (async () => {
438
+ if (!payload.patches) return;
439
+ let patches = await payload.patches;
440
+ React3.startTransition(() => {
441
+ patches.forEach((p) => {
442
+ window.__reactRouterDataRouter.patchRoutes(_nullishCoalesce(p.parentId, () => ( null)), [
443
+ createRouteFromServerManifest(p)
444
+ ]);
445
+ });
446
+ });
447
+ })();
448
+ }
449
+ await applyPatchesPromise;
450
+ return;
451
+ }
445
452
  if (discoveredPaths.has(path)) {
446
453
  return;
447
454
  }
@@ -528,9 +535,9 @@ function createRouterFromPayload({
528
535
  routeModules: globalVar.__reactRouterRouteModules
529
536
  };
530
537
  }
531
- var renderedRoutesContext = _chunkGO74ODU3js.createContext.call(void 0, );
538
+ var renderedRoutesContext = _chunkIK6APEEGjs.createContext.call(void 0, );
532
539
  function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, createFromReadableStream, fetchImplementation) {
533
- let dataStrategy = _chunkGO74ODU3js.getSingleFetchDataStrategyImpl.call(void 0,
540
+ let dataStrategy = _chunkIK6APEEGjs.getSingleFetchDataStrategyImpl.call(void 0,
534
541
  getRouter,
535
542
  (match) => {
536
543
  let M = match;
@@ -588,20 +595,20 @@ function getRSCSingleFetchDataStrategy(getRouter, ssr, basename, createFromReada
588
595
  function getFetchAndDecodeViaRSC(createFromReadableStream, fetchImplementation) {
589
596
  return async (args, basename, trailingSlashAware, targetRoutes) => {
590
597
  let { request, context } = args;
591
- let url = _chunkGO74ODU3js.singleFetchUrl.call(void 0, request.url, basename, trailingSlashAware, "rsc");
598
+ let url = _chunkIK6APEEGjs.singleFetchUrl.call(void 0, request.url, basename, trailingSlashAware, "rsc");
592
599
  if (request.method === "GET") {
593
- url = _chunkGO74ODU3js.stripIndexParam.call(void 0, url);
600
+ url = _chunkIK6APEEGjs.stripIndexParam.call(void 0, url);
594
601
  if (targetRoutes) {
595
602
  url.searchParams.set("_routes", targetRoutes.join(","));
596
603
  }
597
604
  }
598
605
  let res = await fetchImplementation(
599
- new Request(url, await _chunkGO74ODU3js.createRequestInit.call(void 0, request))
606
+ new Request(url, await _chunkIK6APEEGjs.createRequestInit.call(void 0, request))
600
607
  );
601
608
  if (res.status >= 400 && !res.headers.has("X-Remix-Response")) {
602
- throw new (0, _chunkGO74ODU3js.ErrorResponseImpl)(res.status, res.statusText, await res.text());
609
+ throw new (0, _chunkIK6APEEGjs.ErrorResponseImpl)(res.status, res.statusText, await res.text());
603
610
  }
604
- _chunkGO74ODU3js.invariant.call(void 0, res.body, "No response body to decode");
611
+ _chunkIK6APEEGjs.invariant.call(void 0, res.body, "No response body to decode");
605
612
  try {
606
613
  const payload = await createFromReadableStream(res.body, {
607
614
  temporaryReferences: void 0
@@ -625,7 +632,7 @@ function getFetchAndDecodeViaRSC(createFromReadableStream, fetchImplementation)
625
632
  }
626
633
  context.get(renderedRoutesContext).push(...payload.matches);
627
634
  let results = { routes: {} };
628
- const dataKey = _chunkGO74ODU3js.isMutationMethod.call(void 0, request.method) ? "actionData" : "loaderData";
635
+ const dataKey = _chunkIK6APEEGjs.isMutationMethod.call(void 0, request.method) ? "actionData" : "loaderData";
629
636
  for (let [routeId, data] of Object.entries(payload[dataKey] || {})) {
630
637
  results.routes[routeId] = { data };
631
638
  }
@@ -635,8 +642,8 @@ function getFetchAndDecodeViaRSC(createFromReadableStream, fetchImplementation)
635
642
  }
636
643
  }
637
644
  return { status: res.status, data: results };
638
- } catch (e) {
639
- throw new Error("Unable to decode RSC response");
645
+ } catch (cause) {
646
+ throw new Error("Unable to decode RSC response", { cause });
640
647
  }
641
648
  };
642
649
  }
@@ -644,10 +651,10 @@ function RSCHydratedRouter({
644
651
  createFromReadableStream,
645
652
  fetch: fetchImplementation = fetch,
646
653
  payload,
647
- routeDiscovery = "eager",
648
654
  getContext
649
655
  }) {
650
656
  if (payload.type !== "render") throw new Error("Invalid payload type");
657
+ let { routeDiscovery } = payload;
651
658
  let { router: router2, routeModules } = React3.useMemo(
652
659
  () => createRouterFromPayload({
653
660
  payload,
@@ -658,7 +665,7 @@ function RSCHydratedRouter({
658
665
  [createFromReadableStream, payload, fetchImplementation, getContext]
659
666
  );
660
667
  React3.useEffect(() => {
661
- _chunkGO74ODU3js.setIsHydrated.call(void 0, );
668
+ _chunkIK6APEEGjs.setIsHydrated.call(void 0, );
662
669
  }, []);
663
670
  React3.useLayoutEffect(() => {
664
671
  const globalVar = window;
@@ -692,8 +699,8 @@ function RSCHydratedRouter({
692
699
  [router2, routes, state]
693
700
  );
694
701
  React3.useEffect(() => {
695
- if (routeDiscovery === "lazy" || // @ts-expect-error - TS doesn't know about this yet
696
- _optionalChain([window, 'access', _29 => _29.navigator, 'optionalAccess', _30 => _30.connection, 'optionalAccess', _31 => _31.saveData]) === true) {
702
+ if (routeDiscovery.mode === "initial" || // @ts-expect-error - TS doesn't know about this yet
703
+ _optionalChain([window, 'access', _22 => _22.navigator, 'optionalAccess', _23 => _23.connection, 'optionalAccess', _24 => _24.saveData]) === true) {
697
704
  return;
698
705
  }
699
706
  function registerElement(el) {
@@ -761,11 +768,14 @@ function RSCHydratedRouter({
761
768
  imports: []
762
769
  }
763
770
  },
764
- routeDiscovery: { mode: "lazy", manifestPath: "/__manifest" },
771
+ routeDiscovery: payload.routeDiscovery.mode === "initial" ? { mode: "initial", manifestPath: defaultManifestPath } : {
772
+ mode: "lazy",
773
+ manifestPath: payload.routeDiscovery.manifestPath || defaultManifestPath
774
+ },
765
775
  routeModules
766
776
  };
767
- return /* @__PURE__ */ React3.createElement(_chunkGO74ODU3js.RSCRouterContext.Provider, { value: true }, /* @__PURE__ */ React3.createElement(_chunkLLP6DRWXjs.RSCRouterGlobalErrorBoundary, { location: state.location }, /* @__PURE__ */ React3.createElement(_chunkGO74ODU3js.FrameworkContext.Provider, { value: frameworkContext }, /* @__PURE__ */ React3.createElement(
768
- _chunkGO74ODU3js.RouterProvider,
777
+ return /* @__PURE__ */ React3.createElement(_chunkIK6APEEGjs.RSCRouterContext.Provider, { value: true }, /* @__PURE__ */ React3.createElement(_chunkWAVMRYR2js.RSCRouterGlobalErrorBoundary, { location: state.location }, /* @__PURE__ */ React3.createElement(_chunkIK6APEEGjs.FrameworkContext.Provider, { value: frameworkContext }, /* @__PURE__ */ React3.createElement(
778
+ _chunkIK6APEEGjs.RouterProvider,
769
779
  {
770
780
  router: transitionEnabledRouter,
771
781
  flushSync: ReactDOM2.flushSync
@@ -774,15 +784,15 @@ function RSCHydratedRouter({
774
784
  }
775
785
  function createRouteFromServerManifest(match, payload) {
776
786
  let hasInitialData = payload && match.id in payload.loaderData;
777
- let initialData = _optionalChain([payload, 'optionalAccess', _32 => _32.loaderData, 'access', _33 => _33[match.id]]);
778
- let hasInitialError = _optionalChain([payload, 'optionalAccess', _34 => _34.errors]) && match.id in payload.errors;
779
- let initialError = _optionalChain([payload, 'optionalAccess', _35 => _35.errors, 'optionalAccess', _36 => _36[match.id]]);
780
- let isHydrationRequest = _optionalChain([match, 'access', _37 => _37.clientLoader, 'optionalAccess', _38 => _38.hydrate]) === true || !match.hasLoader || // If the route has a component but we don't have an element, we need to hit
787
+ let initialData = _optionalChain([payload, 'optionalAccess', _25 => _25.loaderData, 'access', _26 => _26[match.id]]);
788
+ let hasInitialError = _optionalChain([payload, 'optionalAccess', _27 => _27.errors]) && match.id in payload.errors;
789
+ let initialError = _optionalChain([payload, 'optionalAccess', _28 => _28.errors, 'optionalAccess', _29 => _29[match.id]]);
790
+ let isHydrationRequest = _optionalChain([match, 'access', _30 => _30.clientLoader, 'optionalAccess', _31 => _31.hydrate]) === true || !match.hasLoader || // If the route has a component but we don't have an element, we need to hit
781
791
  // the server loader flow regardless of whether the client loader calls
782
792
  // `serverLoader` or not, otherwise we'll have nothing to render.
783
793
  match.hasComponent && !match.element;
784
- _chunkGO74ODU3js.invariant.call(void 0, window.__reactRouterRouteModules);
785
- _chunkLLP6DRWXjs.populateRSCRouteModules.call(void 0, window.__reactRouterRouteModules, match);
794
+ _chunkIK6APEEGjs.invariant.call(void 0, window.__reactRouterRouteModules);
795
+ _chunkWAVMRYR2js.populateRSCRouteModules.call(void 0, window.__reactRouterRouteModules, match);
786
796
  let dataRoute = {
787
797
  id: match.id,
788
798
  element: match.element,
@@ -832,7 +842,7 @@ function createRouteFromServerManifest(match, payload) {
832
842
  return await callSingleFetch(singleFetch);
833
843
  }
834
844
  }) : match.hasAction ? (_, singleFetch) => callSingleFetch(singleFetch) : () => {
835
- throw _chunkGO74ODU3js.noActionDefinedError.call(void 0, "action", match.id);
845
+ throw _chunkIK6APEEGjs.noActionDefinedError.call(void 0, "action", match.id);
836
846
  },
837
847
  path: match.path,
838
848
  shouldRevalidate: match.shouldRevalidate,
@@ -845,7 +855,7 @@ function createRouteFromServerManifest(match, payload) {
845
855
  hasShouldRevalidate: match.shouldRevalidate != null
846
856
  };
847
857
  if (typeof dataRoute.loader === "function") {
848
- dataRoute.loader.hydrate = _chunkGO74ODU3js.shouldHydrateRouteLoader.call(void 0,
858
+ dataRoute.loader.hydrate = _chunkIK6APEEGjs.shouldHydrateRouteLoader.call(void 0,
849
859
  match.id,
850
860
  match.clientLoader,
851
861
  match.hasLoader,
@@ -855,7 +865,7 @@ function createRouteFromServerManifest(match, payload) {
855
865
  return dataRoute;
856
866
  }
857
867
  function callSingleFetch(singleFetch) {
858
- _chunkGO74ODU3js.invariant.call(void 0, typeof singleFetch === "function", "Invalid singleFetch parameter");
868
+ _chunkIK6APEEGjs.invariant.call(void 0, typeof singleFetch === "function", "Invalid singleFetch parameter");
859
869
  return singleFetch();
860
870
  }
861
871
  function preventInvalidServerHandlerCall(type, routeId, hasHandler) {
@@ -863,7 +873,7 @@ function preventInvalidServerHandlerCall(type, routeId, hasHandler) {
863
873
  let fn = type === "action" ? "serverAction()" : "serverLoader()";
864
874
  let msg = `You are trying to call ${fn} on a route that does not have a server ${type} (routeId: "${routeId}")`;
865
875
  console.error(msg);
866
- throw new (0, _chunkGO74ODU3js.ErrorResponseImpl)(400, "Bad Request", new Error(msg), true);
876
+ throw new (0, _chunkIK6APEEGjs.ErrorResponseImpl)(400, "Bad Request", new Error(msg), true);
867
877
  }
868
878
  }
869
879
  var nextPaths = /* @__PURE__ */ new Set();
@@ -906,8 +916,9 @@ async function fetchAndApplyManifestPatches(paths, createFromReadableStream, fet
906
916
  throw new Error("Failed to patch routes");
907
917
  }
908
918
  paths.forEach((p) => addToFifoQueue(p, discoveredPaths));
919
+ let patches = await payload.patches;
909
920
  React3.startTransition(() => {
910
- payload.patches.forEach((p) => {
921
+ patches.forEach((p) => {
911
922
  window.__reactRouterDataRouter.patchRoutes(
912
923
  _nullishCoalesce(p.parentId, () => ( null)),
913
924
  [createRouteFromServerManifest(p)]
@@ -935,7 +946,7 @@ function isExternalLocation(location2) {
935
946
  }
936
947
  function hasInvalidProtocol(location2) {
937
948
  try {
938
- return _chunkGO74ODU3js.invalidProtocols.includes(new URL(location2).protocol);
949
+ return _chunkIK6APEEGjs.invalidProtocols.includes(new URL(location2).protocol);
939
950
  } catch (e2) {
940
951
  return false;
941
952
  }
@@ -994,10 +1005,10 @@ function getRSCStream() {
994
1005
  });
995
1006
  if (typeof document !== "undefined" && document.readyState === "loading") {
996
1007
  document.addEventListener("DOMContentLoaded", () => {
997
- _optionalChain([streamController, 'optionalAccess', _39 => _39.close, 'call', _40 => _40()]);
1008
+ _optionalChain([streamController, 'optionalAccess', _32 => _32.close, 'call', _33 => _33()]);
998
1009
  });
999
1010
  } else {
1000
- _optionalChain([streamController, 'optionalAccess', _41 => _41.close, 'call', _42 => _42()]);
1011
+ _optionalChain([streamController, 'optionalAccess', _34 => _34.close, 'call', _35 => _35()]);
1001
1012
  }
1002
1013
  return rscStream;
1003
1014
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v7.13.2
2
+ * react-router v7.14.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -14,7 +14,7 @@ import {
14
14
  deserializeErrors,
15
15
  getHydrationData,
16
16
  populateRSCRouteModules
17
- } from "./chunk-UALY5CBT.mjs";
17
+ } from "./chunk-2UH5WJXA.mjs";
18
18
  import {
19
19
  CRITICAL_CSS_DATA_ATTRIBUTE,
20
20
  ErrorResponseImpl,
@@ -43,7 +43,7 @@ import {
43
43
  singleFetchUrl,
44
44
  stripIndexParam,
45
45
  useFogOFWarDiscovery
46
- } from "./chunk-UVKPFVEO.mjs";
46
+ } from "./chunk-QFMPRPBF.mjs";
47
47
 
48
48
  // lib/dom-export/dom-router-provider.tsx
49
49
  import * as React from "react";
@@ -264,6 +264,7 @@ function HydratedRouter(props) {
264
264
  // lib/rsc/browser.tsx
265
265
  import * as React3 from "react";
266
266
  import * as ReactDOM2 from "react-dom";
267
+ var defaultManifestPath = "/__manifest";
267
268
  function createCallServer({
268
269
  createFromReadableStream,
269
270
  createTemporaryReferenceSet,
@@ -384,14 +385,6 @@ function createRouterFromPayload({
384
385
  if (payload.type !== "render") throw new Error("Invalid payload type");
385
386
  globalVar.__reactRouterRouteModules = globalVar.__reactRouterRouteModules ?? {};
386
387
  populateRSCRouteModules(globalVar.__reactRouterRouteModules, payload.matches);
387
- let patches = /* @__PURE__ */ new Map();
388
- payload.patches?.forEach((patch) => {
389
- invariant(patch.parentId, "Invalid patch parentId");
390
- if (!patches.has(patch.parentId)) {
391
- patches.set(patch.parentId, []);
392
- }
393
- patches.get(patch.parentId)?.push(patch);
394
- });
395
388
  let routes = payload.matches.reduceRight((previous, match) => {
396
389
  const route = createRouteFromServerManifest(
397
390
  match,
@@ -399,15 +392,12 @@ function createRouterFromPayload({
399
392
  );
400
393
  if (previous.length > 0) {
401
394
  route.children = previous;
402
- let childrenToPatch = patches.get(match.id);
403
- if (childrenToPatch) {
404
- route.children.push(
405
- ...childrenToPatch.map((r) => createRouteFromServerManifest(r))
406
- );
407
- }
395
+ } else if (!route.index) {
396
+ route.children = [];
408
397
  }
409
398
  return [route];
410
399
  }, []);
400
+ let applyPatchesPromise;
411
401
  globalVar.__reactRouterDataRouter = createRouter({
412
402
  routes,
413
403
  getContext,
@@ -434,6 +424,23 @@ function createRouterFromPayload({
434
424
  isSpaMode: false
435
425
  }),
436
426
  async patchRoutesOnNavigation({ path, signal }) {
427
+ if (payload.routeDiscovery.mode === "initial") {
428
+ if (!applyPatchesPromise) {
429
+ applyPatchesPromise = (async () => {
430
+ if (!payload.patches) return;
431
+ let patches = await payload.patches;
432
+ React3.startTransition(() => {
433
+ patches.forEach((p) => {
434
+ window.__reactRouterDataRouter.patchRoutes(p.parentId ?? null, [
435
+ createRouteFromServerManifest(p)
436
+ ]);
437
+ });
438
+ });
439
+ })();
440
+ }
441
+ await applyPatchesPromise;
442
+ return;
443
+ }
437
444
  if (discoveredPaths.has(path)) {
438
445
  return;
439
446
  }
@@ -627,8 +634,8 @@ function getFetchAndDecodeViaRSC(createFromReadableStream, fetchImplementation)
627
634
  }
628
635
  }
629
636
  return { status: res.status, data: results };
630
- } catch (e) {
631
- throw new Error("Unable to decode RSC response");
637
+ } catch (cause) {
638
+ throw new Error("Unable to decode RSC response", { cause });
632
639
  }
633
640
  };
634
641
  }
@@ -636,10 +643,10 @@ function RSCHydratedRouter({
636
643
  createFromReadableStream,
637
644
  fetch: fetchImplementation = fetch,
638
645
  payload,
639
- routeDiscovery = "eager",
640
646
  getContext
641
647
  }) {
642
648
  if (payload.type !== "render") throw new Error("Invalid payload type");
649
+ let { routeDiscovery } = payload;
643
650
  let { router: router2, routeModules } = React3.useMemo(
644
651
  () => createRouterFromPayload({
645
652
  payload,
@@ -684,7 +691,7 @@ function RSCHydratedRouter({
684
691
  [router2, routes, state]
685
692
  );
686
693
  React3.useEffect(() => {
687
- if (routeDiscovery === "lazy" || // @ts-expect-error - TS doesn't know about this yet
694
+ if (routeDiscovery.mode === "initial" || // @ts-expect-error - TS doesn't know about this yet
688
695
  window.navigator?.connection?.saveData === true) {
689
696
  return;
690
697
  }
@@ -753,7 +760,10 @@ function RSCHydratedRouter({
753
760
  imports: []
754
761
  }
755
762
  },
756
- routeDiscovery: { mode: "lazy", manifestPath: "/__manifest" },
763
+ routeDiscovery: payload.routeDiscovery.mode === "initial" ? { mode: "initial", manifestPath: defaultManifestPath } : {
764
+ mode: "lazy",
765
+ manifestPath: payload.routeDiscovery.manifestPath || defaultManifestPath
766
+ },
757
767
  routeModules
758
768
  };
759
769
  return /* @__PURE__ */ React3.createElement(RSCRouterContext.Provider, { value: true }, /* @__PURE__ */ React3.createElement(RSCRouterGlobalErrorBoundary, { location: state.location }, /* @__PURE__ */ React3.createElement(FrameworkContext.Provider, { value: frameworkContext }, /* @__PURE__ */ React3.createElement(
@@ -898,8 +908,9 @@ async function fetchAndApplyManifestPatches(paths, createFromReadableStream, fet
898
908
  throw new Error("Failed to patch routes");
899
909
  }
900
910
  paths.forEach((p) => addToFifoQueue(p, discoveredPaths));
911
+ let patches = await payload.patches;
901
912
  React3.startTransition(() => {
902
- payload.patches.forEach((p) => {
913
+ patches.forEach((p) => {
903
914
  window.__reactRouterDataRouter.patchRoutes(
904
915
  p.parentId ?? null,
905
916
  [createRouteFromServerManifest(p)]
@@ -2167,8 +2167,8 @@ type FetcherWithComponents<TData> = Fetcher<TData> & {
2167
2167
  * If the fetcher is currently in-flight, the
2168
2168
  * [`AbortController`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController)
2169
2169
  * will be aborted with the `reason`, if provided.
2170
- *
2171
- * @param reason Optional `reason` to provide to [`AbortController.abort()`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort)
2170
+ * @param opts Options for resetting the fetcher.
2171
+ * @param opts.reason Optional `reason` to provide to [`AbortController.abort()`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort)
2172
2172
  * @returns void
2173
2173
  */
2174
2174
  reset: (opts?: {
@@ -2413,7 +2413,8 @@ declare function usePrompt({ when, message, }: {
2413
2413
  }): void;
2414
2414
  /**
2415
2415
  * This hook returns `true` when there is an active [View Transition](https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API)
2416
- * to the specified location. This can be used to apply finer-grained styles to
2416
+ * and the specified location matches either side of the navigation (the URL you are
2417
+ * navigating **to** or the URL you are navigating **from**). This can be used to apply finer-grained styles to
2417
2418
  * elements to further customize the view transition. This requires that view
2418
2419
  * transitions have been enabled for the given navigation via {@link LinkProps.viewTransition}
2419
2420
  * (or the `Form`, `submit`, or `navigate` call)
@@ -2422,13 +2423,14 @@ declare function usePrompt({ when, message, }: {
2422
2423
  * @category Hooks
2423
2424
  * @mode framework
2424
2425
  * @mode data
2425
- * @param to The {@link To} location to check for an active [View Transition](https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API).
2426
+ * @param to The {@link To} location to compare against the active transition's current
2427
+ * and next URLs.
2426
2428
  * @param options Options
2427
2429
  * @param options.relative The relative routing type to use when resolving the
2428
2430
  * `to` location, defaults to `"route"`. See {@link RelativeRoutingType} for
2429
2431
  * more details.
2430
2432
  * @returns `true` if there is an active [View Transition](https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API)
2431
- * to the specified {@link Location}, otherwise `false`.
2433
+ * and the resolved path matches the transition's destination or source pathname, otherwise `false`.
2432
2434
  */
2433
2435
  declare function useViewTransitionState(to: To, { relative }?: {
2434
2436
  relative?: RelativeRoutingType;
@@ -3222,8 +3222,8 @@ type FetcherWithComponents<TData> = Fetcher<TData> & {
3222
3222
  * If the fetcher is currently in-flight, the
3223
3223
  * [`AbortController`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController)
3224
3224
  * will be aborted with the `reason`, if provided.
3225
- *
3226
- * @param reason Optional `reason` to provide to [`AbortController.abort()`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort)
3225
+ * @param opts Options for resetting the fetcher.
3226
+ * @param opts.reason Optional `reason` to provide to [`AbortController.abort()`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController/abort)
3227
3227
  * @returns void
3228
3228
  */
3229
3229
  reset: (opts?: {
@@ -3468,7 +3468,8 @@ declare function usePrompt({ when, message, }: {
3468
3468
  }): void;
3469
3469
  /**
3470
3470
  * This hook returns `true` when there is an active [View Transition](https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API)
3471
- * to the specified location. This can be used to apply finer-grained styles to
3471
+ * and the specified location matches either side of the navigation (the URL you are
3472
+ * navigating **to** or the URL you are navigating **from**). This can be used to apply finer-grained styles to
3472
3473
  * elements to further customize the view transition. This requires that view
3473
3474
  * transitions have been enabled for the given navigation via {@link LinkProps.viewTransition}
3474
3475
  * (or the `Form`, `submit`, or `navigate` call)
@@ -3477,13 +3478,14 @@ declare function usePrompt({ when, message, }: {
3477
3478
  * @category Hooks
3478
3479
  * @mode framework
3479
3480
  * @mode data
3480
- * @param to The {@link To} location to check for an active [View Transition](https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API).
3481
+ * @param to The {@link To} location to compare against the active transition's current
3482
+ * and next URLs.
3481
3483
  * @param options Options
3482
3484
  * @param options.relative The relative routing type to use when resolving the
3483
3485
  * `to` location, defaults to `"route"`. See {@link RelativeRoutingType} for
3484
3486
  * more details.
3485
3487
  * @returns `true` if there is an active [View Transition](https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API)
3486
- * to the specified {@link Location}, otherwise `false`.
3488
+ * and the resolved path matches the transition's destination or source pathname, otherwise `false`.
3487
3489
  */
3488
3490
  declare function useViewTransitionState(to: To, { relative }?: {
3489
3491
  relative?: RelativeRoutingType;
@@ -1,4 +1,4 @@
1
1
  export { Q as MemoryRouter, T as Navigate, U as Outlet, V as Route, W as Router, X as RouterProvider, Y as Routes, A as UNSAFE_AwaitContextProvider, ab as UNSAFE_WithComponentProps, af as UNSAFE_WithErrorBoundaryProps, ad as UNSAFE_WithHydrateFallbackProps } from './context-phCt_zmH.mjs';
2
- export { l as BrowserRouter, q as Form, m as HashRouter, n as Link, X as Links, W as Meta, p as NavLink, r as ScrollRestoration, T as StaticRouter, V as StaticRouterProvider, o as unstable_HistoryRouter } from './index-react-server-client-BcrVT7Dd.mjs';
2
+ export { l as BrowserRouter, q as Form, m as HashRouter, n as Link, X as Links, W as Meta, p as NavLink, r as ScrollRestoration, T as StaticRouter, V as StaticRouterProvider, o as unstable_HistoryRouter } from './index-react-server-client-BwWaHAr3.mjs';
3
3
  import './routeModules-BRrCYrSL.mjs';
4
4
  import 'react';
@@ -1,4 +1,4 @@
1
- export { W as BrowserRouter, $ as Form, X as HashRouter, Y as Link, an as Links, j as MemoryRouter, am as Meta, _ as NavLink, k as Navigate, l as Outlet, m as Route, n as Router, o as RouterProvider, p as Routes, a0 as ScrollRestoration, ak as StaticRouter, al as StaticRouterProvider, b as UNSAFE_AwaitContextProvider, aH as UNSAFE_WithComponentProps, aL as UNSAFE_WithErrorBoundaryProps, aJ as UNSAFE_WithHydrateFallbackProps, Z as unstable_HistoryRouter } from './index-react-server-client-CCwMoQIT.js';
1
+ export { W as BrowserRouter, $ as Form, X as HashRouter, Y as Link, an as Links, j as MemoryRouter, am as Meta, _ as NavLink, k as Navigate, l as Outlet, m as Route, n as Router, o as RouterProvider, p as Routes, a0 as ScrollRestoration, ak as StaticRouter, al as StaticRouterProvider, b as UNSAFE_AwaitContextProvider, aH as UNSAFE_WithComponentProps, aL as UNSAFE_WithErrorBoundaryProps, aJ as UNSAFE_WithHydrateFallbackProps, Z as unstable_HistoryRouter } from './index-react-server-client-luDbagNU.js';
2
2
  import './instrumentation-BYr6ff5D.js';
3
3
  import './routeModules-CA7kSxJJ.js';
4
4
  import 'react';
@@ -1,5 +1,5 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});/**
2
- * react-router v7.13.2
2
+ * react-router v7.14.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -19,7 +19,7 @@
19
19
 
20
20
 
21
21
 
22
- var _chunkHPFFRPKKjs = require('./chunk-HPFFRPKK.js');
22
+ var _chunkNXTEWSJOjs = require('./chunk-NXTEWSJO.js');
23
23
 
24
24
 
25
25
 
@@ -34,7 +34,7 @@ var _chunkHPFFRPKKjs = require('./chunk-HPFFRPKK.js');
34
34
 
35
35
 
36
36
 
37
- var _chunkGO74ODU3js = require('./chunk-GO74ODU3.js');
37
+ var _chunkIK6APEEGjs = require('./chunk-IK6APEEG.js');
38
38
 
39
39
 
40
40
 
@@ -58,4 +58,4 @@ var _chunkGO74ODU3js = require('./chunk-GO74ODU3.js');
58
58
 
59
59
 
60
60
 
61
- exports.BrowserRouter = _chunkHPFFRPKKjs.BrowserRouter; exports.Form = _chunkHPFFRPKKjs.Form; exports.HashRouter = _chunkHPFFRPKKjs.HashRouter; exports.Link = _chunkHPFFRPKKjs.Link; exports.Links = _chunkGO74ODU3js.Links; exports.MemoryRouter = _chunkGO74ODU3js.MemoryRouter; exports.Meta = _chunkGO74ODU3js.Meta; exports.NavLink = _chunkHPFFRPKKjs.NavLink; exports.Navigate = _chunkGO74ODU3js.Navigate; exports.Outlet = _chunkGO74ODU3js.Outlet; exports.Route = _chunkGO74ODU3js.Route; exports.Router = _chunkGO74ODU3js.Router; exports.RouterProvider = _chunkGO74ODU3js.RouterProvider; exports.Routes = _chunkGO74ODU3js.Routes; exports.ScrollRestoration = _chunkHPFFRPKKjs.ScrollRestoration; exports.StaticRouter = _chunkHPFFRPKKjs.StaticRouter; exports.StaticRouterProvider = _chunkHPFFRPKKjs.StaticRouterProvider; exports.UNSAFE_AwaitContextProvider = _chunkGO74ODU3js.AwaitContextProvider; exports.UNSAFE_WithComponentProps = _chunkGO74ODU3js.WithComponentProps; exports.UNSAFE_WithErrorBoundaryProps = _chunkGO74ODU3js.WithErrorBoundaryProps; exports.UNSAFE_WithHydrateFallbackProps = _chunkGO74ODU3js.WithHydrateFallbackProps; exports.unstable_HistoryRouter = _chunkHPFFRPKKjs.HistoryRouter;
61
+ exports.BrowserRouter = _chunkNXTEWSJOjs.BrowserRouter; exports.Form = _chunkNXTEWSJOjs.Form; exports.HashRouter = _chunkNXTEWSJOjs.HashRouter; exports.Link = _chunkNXTEWSJOjs.Link; exports.Links = _chunkIK6APEEGjs.Links; exports.MemoryRouter = _chunkIK6APEEGjs.MemoryRouter; exports.Meta = _chunkIK6APEEGjs.Meta; exports.NavLink = _chunkNXTEWSJOjs.NavLink; exports.Navigate = _chunkIK6APEEGjs.Navigate; exports.Outlet = _chunkIK6APEEGjs.Outlet; exports.Route = _chunkIK6APEEGjs.Route; exports.Router = _chunkIK6APEEGjs.Router; exports.RouterProvider = _chunkIK6APEEGjs.RouterProvider; exports.Routes = _chunkIK6APEEGjs.Routes; exports.ScrollRestoration = _chunkNXTEWSJOjs.ScrollRestoration; exports.StaticRouter = _chunkNXTEWSJOjs.StaticRouter; exports.StaticRouterProvider = _chunkNXTEWSJOjs.StaticRouterProvider; exports.UNSAFE_AwaitContextProvider = _chunkIK6APEEGjs.AwaitContextProvider; exports.UNSAFE_WithComponentProps = _chunkIK6APEEGjs.WithComponentProps; exports.UNSAFE_WithErrorBoundaryProps = _chunkIK6APEEGjs.WithErrorBoundaryProps; exports.UNSAFE_WithHydrateFallbackProps = _chunkIK6APEEGjs.WithHydrateFallbackProps; exports.unstable_HistoryRouter = _chunkNXTEWSJOjs.HistoryRouter;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v7.13.2
2
+ * react-router v7.14.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -32,7 +32,7 @@ import {
32
32
  WithComponentProps,
33
33
  WithErrorBoundaryProps,
34
34
  WithHydrateFallbackProps
35
- } from "./chunk-UVKPFVEO.mjs";
35
+ } from "./chunk-QFMPRPBF.mjs";
36
36
  export {
37
37
  BrowserRouter,
38
38
  Form,
@@ -2221,14 +2221,15 @@ type RSCRenderPayload = {
2221
2221
  errors: Record<string, any> | null;
2222
2222
  loaderData: Record<string, any>;
2223
2223
  location: Location;
2224
+ routeDiscovery: RouteDiscovery;
2224
2225
  matches: RSCRouteMatch[];
2225
- patches?: RSCRouteManifest[];
2226
+ patches?: Promise<RSCRouteManifest[]>;
2226
2227
  nonce?: string;
2227
2228
  formState?: unknown;
2228
2229
  };
2229
2230
  type RSCManifestPayload = {
2230
2231
  type: "manifest";
2231
- patches: RSCRouteManifest[];
2232
+ patches: Promise<RSCRouteManifest[]>;
2232
2233
  };
2233
2234
  type RSCActionPayload = {
2234
2235
  type: "action";
@@ -2255,6 +2256,12 @@ type DecodeReplyFunction = (reply: FormData | string, options: {
2255
2256
  temporaryReferences: unknown;
2256
2257
  }) => Promise<unknown[]>;
2257
2258
  type LoadServerActionFunction = (id: string) => Promise<Function>;
2259
+ type RouteDiscovery = {
2260
+ mode: "lazy";
2261
+ manifestPath?: string | undefined;
2262
+ } | {
2263
+ mode: "initial";
2264
+ };
2258
2265
  /**
2259
2266
  * Matches the given routes to a [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request)
2260
2267
  * and returns an [RSC](https://react.dev/reference/rsc/server-components)
@@ -2321,12 +2328,13 @@ type LoadServerActionFunction = (id: string) => Promise<Function>;
2321
2328
  * @param opts.requestContext An instance of {@link RouterContextProvider}
2322
2329
  * that should be created per request, to be passed to [`action`](../../start/data/route-object#action)s,
2323
2330
  * [`loader`](../../start/data/route-object#loader)s and [middleware](../../how-to/middleware).
2331
+ * @param opts.routeDiscovery The route discovery configuration, used to determine how the router should discover new routes during navigations.
2324
2332
  * @param opts.routes Your {@link unstable_RSCRouteConfigEntry | route definitions}.
2325
2333
  * @returns A [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)
2326
2334
  * that contains the [RSC](https://react.dev/reference/rsc/server-components)
2327
2335
  * data for hydration.
2328
2336
  */
2329
- declare function matchRSCServerRequest({ allowedActionOrigins, createTemporaryReferenceSet, basename, decodeReply, requestContext, loadServerAction, decodeAction, decodeFormState, onError, request, routes, generateResponse, }: {
2337
+ declare function matchRSCServerRequest({ allowedActionOrigins, createTemporaryReferenceSet, basename, decodeReply, requestContext, routeDiscovery, loadServerAction, decodeAction, decodeFormState, onError, request, routes, generateResponse, }: {
2330
2338
  allowedActionOrigins?: string[];
2331
2339
  createTemporaryReferenceSet: () => unknown;
2332
2340
  basename?: string;
@@ -2338,6 +2346,7 @@ declare function matchRSCServerRequest({ allowedActionOrigins, createTemporaryRe
2338
2346
  onError?: (error: unknown) => void;
2339
2347
  request: Request;
2340
2348
  routes: RSCRouteConfigEntry[];
2349
+ routeDiscovery?: RouteDiscovery;
2341
2350
  generateResponse: (match: RSCMatch, { onError, temporaryReferences, }: {
2342
2351
  onError(error: unknown): string | undefined;
2343
2352
  temporaryReferences: unknown;