react-router 7.4.1 → 7.5.0-pre.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 (36) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/dist/development/{chunk-XJI4KG32.mjs → chunk-YTH545ZN.mjs} +244 -154
  3. package/dist/development/dom-export.d.mts +2 -2
  4. package/dist/development/dom-export.d.ts +2 -2
  5. package/dist/development/dom-export.js +246 -149
  6. package/dist/development/dom-export.mjs +14 -2
  7. package/dist/development/{fog-of-war-BjgPfDmv.d.mts → fog-of-war-1hWhK5ey.d.mts} +3 -1
  8. package/dist/{production/fog-of-war-BaM-ohjc.d.ts → development/fog-of-war-oa9CGk10.d.ts} +3 -1
  9. package/dist/development/index.d.mts +4 -4
  10. package/dist/development/index.d.ts +4 -4
  11. package/dist/development/index.js +244 -154
  12. package/dist/development/index.mjs +2 -2
  13. package/dist/development/lib/types/route-module.d.mts +1 -1
  14. package/dist/development/lib/types/route-module.d.ts +1 -1
  15. package/dist/development/lib/types/route-module.js +1 -1
  16. package/dist/development/lib/types/route-module.mjs +1 -1
  17. package/dist/development/{route-data-BL8ToWby.d.ts → route-data-5OzAzQtT.d.mts} +19 -14
  18. package/dist/{production/route-data-BL8ToWby.d.mts → development/route-data-5OzAzQtT.d.ts} +19 -14
  19. package/dist/production/{chunk-T6D7EGPT.mjs → chunk-RSOGH2WR.mjs} +244 -154
  20. package/dist/production/dom-export.d.mts +2 -2
  21. package/dist/production/dom-export.d.ts +2 -2
  22. package/dist/production/dom-export.js +246 -149
  23. package/dist/production/dom-export.mjs +14 -2
  24. package/dist/production/{fog-of-war-BjgPfDmv.d.mts → fog-of-war-1hWhK5ey.d.mts} +3 -1
  25. package/dist/{development/fog-of-war-BaM-ohjc.d.ts → production/fog-of-war-oa9CGk10.d.ts} +3 -1
  26. package/dist/production/index.d.mts +4 -4
  27. package/dist/production/index.d.ts +4 -4
  28. package/dist/production/index.js +244 -154
  29. package/dist/production/index.mjs +2 -2
  30. package/dist/production/lib/types/route-module.d.mts +1 -1
  31. package/dist/production/lib/types/route-module.d.ts +1 -1
  32. package/dist/production/lib/types/route-module.js +1 -1
  33. package/dist/production/lib/types/route-module.mjs +1 -1
  34. package/dist/production/{route-data-BL8ToWby.d.ts → route-data-5OzAzQtT.d.mts} +19 -14
  35. package/dist/{development/route-data-BL8ToWby.d.mts → production/route-data-5OzAzQtT.d.ts} +19 -14
  36. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,45 @@
1
1
  # `react-router`
2
2
 
3
+ ## 7.5.0-pre.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Add granular object-based API for `route.lazy` to support lazy loading of individual route properties, for example: ([#13294](https://github.com/remix-run/react-router/pull/13294))
8
+
9
+ ```ts
10
+ createBrowserRouter([
11
+ {
12
+ path: "/show/:showId",
13
+ lazy: {
14
+ loader: async () => (await import("./show.loader.js")).loader,
15
+ action: async () => (await import("./show.action.js")).action,
16
+ Component: async () => (await import("./show.component.js")).Component,
17
+ },
18
+ },
19
+ ]);
20
+ ```
21
+
22
+ **Breaking change for `route.unstable_lazyMiddleware` consumers**
23
+
24
+ The `route.unstable_lazyMiddleware` property is no longer supported. If you want to lazily load middleware, you must use the new object-based `route.lazy` API with `route.lazy.unstable_middleware`, for example:
25
+
26
+ ```ts
27
+ createBrowserRouter([
28
+ {
29
+ path: "/show/:showId",
30
+ lazy: {
31
+ unstable_middleware: async () =>
32
+ (await import("./show.middleware.js")).middleware,
33
+ // etc.
34
+ },
35
+ },
36
+ ]);
37
+ ```
38
+
39
+ ### Patch Changes
40
+
41
+ - Introduce `unstable_subResourceIntegrity` future flag that enables generation of an importmap with integrity for the scripts that will be loaded by the browser. ([#13163](https://github.com/remix-run/react-router/pull/13163))
42
+
3
43
  ## 7.4.1
4
44
 
5
45
  ### Patch Changes
@@ -1,5 +1,5 @@
1
1
  /**
2
- * react-router v7.4.1
2
+ * react-router v7.5.0-pre.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
@@ -383,6 +383,19 @@ var unstable_RouterContextProvider = class {
383
383
  }
384
384
  };
385
385
  _map = new WeakMap();
386
+ var unsupportedLazyRouteObjectKeys = /* @__PURE__ */ new Set([
387
+ "lazy",
388
+ "caseSensitive",
389
+ "path",
390
+ "id",
391
+ "index",
392
+ "children"
393
+ ]);
394
+ function isUnsupportedLazyRouteObjectKey(key) {
395
+ return unsupportedLazyRouteObjectKeys.has(
396
+ key
397
+ );
398
+ }
386
399
  var unsupportedLazyRouteFunctionKeys = /* @__PURE__ */ new Set([
387
400
  "lazy",
388
401
  "caseSensitive",
@@ -390,9 +403,13 @@ var unsupportedLazyRouteFunctionKeys = /* @__PURE__ */ new Set([
390
403
  "id",
391
404
  "index",
392
405
  "unstable_middleware",
393
- "unstable_lazyMiddleware",
394
406
  "children"
395
407
  ]);
408
+ function isUnsupportedLazyRouteFunctionKey(key) {
409
+ return unsupportedLazyRouteFunctionKeys.has(
410
+ key
411
+ );
412
+ }
396
413
  function isIndexRoute(route) {
397
414
  return route.index === true;
398
415
  }
@@ -2683,14 +2700,18 @@ function createStaticHandler(routes, opts) {
2683
2700
  return respond ? respond(staticContext) : staticContext;
2684
2701
  }
2685
2702
  if (respond && matches.some(
2686
- (m) => m.route.unstable_middleware || m.route.unstable_lazyMiddleware
2703
+ (m) => m.route.unstable_middleware || typeof m.route.lazy === "object" && m.route.lazy.unstable_middleware
2687
2704
  )) {
2688
2705
  invariant(
2689
2706
  requestContext instanceof unstable_RouterContextProvider,
2690
2707
  "When using middleware in `staticHandler.query()`, any provided `requestContext` must be an instance of `unstable_RouterContextProvider`"
2691
2708
  );
2692
2709
  try {
2693
- await loadLazyMiddlewareForMatches(matches, manifest);
2710
+ await loadLazyMiddlewareForMatches(
2711
+ matches,
2712
+ manifest,
2713
+ mapRouteProperties2
2714
+ );
2694
2715
  let renderedStaticContext;
2695
2716
  let response = await runMiddlewarePipeline(
2696
2717
  {
@@ -2807,13 +2828,13 @@ function createStaticHandler(routes, opts) {
2807
2828
  throw getInternalRouterError(404, { pathname: location.pathname });
2808
2829
  }
2809
2830
  if (respond && matches.some(
2810
- (m) => m.route.unstable_middleware || m.route.unstable_lazyMiddleware
2831
+ (m) => m.route.unstable_middleware || typeof m.route.lazy === "object" && m.route.lazy.unstable_middleware
2811
2832
  )) {
2812
2833
  invariant(
2813
2834
  requestContext instanceof unstable_RouterContextProvider,
2814
2835
  "When using middleware in `staticHandler.queryRoute()`, any provided `requestContext` must be an instance of `unstable_RouterContextProvider`"
2815
2836
  );
2816
- await loadLazyMiddlewareForMatches(matches, manifest);
2837
+ await loadLazyMiddlewareForMatches(matches, manifest, mapRouteProperties2);
2817
2838
  let response = await runMiddlewarePipeline(
2818
2839
  {
2819
2840
  request,
@@ -3531,79 +3552,139 @@ function isSameRoute(newRoute, existingRoute) {
3531
3552
  (aChild, i) => existingRoute.children?.some((bChild) => isSameRoute(aChild, bChild))
3532
3553
  );
3533
3554
  }
3534
- var lazyRouteFunctionCache = /* @__PURE__ */ new WeakMap();
3535
- async function loadLazyRouteModule(route, mapRouteProperties2, manifest) {
3555
+ var lazyRoutePropertyCache = /* @__PURE__ */ new WeakMap();
3556
+ var loadLazyRouteProperty = ({
3557
+ key,
3558
+ route,
3559
+ manifest,
3560
+ mapRouteProperties: mapRouteProperties2
3561
+ }) => {
3536
3562
  let routeToUpdate = manifest[route.id];
3537
3563
  invariant(routeToUpdate, "No route found in manifest");
3538
- if (!route.lazy) {
3564
+ if (!routeToUpdate.lazy || typeof routeToUpdate.lazy !== "object") {
3539
3565
  return;
3540
3566
  }
3541
- let cachedPromise = lazyRouteFunctionCache.get(routeToUpdate);
3542
- if (cachedPromise) {
3543
- await cachedPromise;
3567
+ let lazyFn = routeToUpdate.lazy[key];
3568
+ if (!lazyFn) {
3544
3569
  return;
3545
3570
  }
3546
- let lazyRoutePromise = route.lazy().then((lazyRoute) => {
3547
- let routeUpdates = {};
3548
- for (let lazyRouteProperty in lazyRoute) {
3549
- let staticRouteValue = routeToUpdate[lazyRouteProperty];
3550
- let isPropertyStaticallyDefined = staticRouteValue !== void 0 && // This property isn't static since it should always be updated based
3551
- // on the route updates
3552
- lazyRouteProperty !== "hasErrorBoundary";
3571
+ let cache = lazyRoutePropertyCache.get(routeToUpdate);
3572
+ if (!cache) {
3573
+ cache = {};
3574
+ lazyRoutePropertyCache.set(routeToUpdate, cache);
3575
+ }
3576
+ let cachedPromise = cache[key];
3577
+ if (cachedPromise) {
3578
+ return cachedPromise;
3579
+ }
3580
+ let propertyPromise = (async () => {
3581
+ let isUnsupported = isUnsupportedLazyRouteObjectKey(key);
3582
+ let staticRouteValue = routeToUpdate[key];
3583
+ let isStaticallyDefined = staticRouteValue !== void 0 && key !== "hasErrorBoundary";
3584
+ if (isUnsupported) {
3553
3585
  warning(
3554
- !isPropertyStaticallyDefined,
3555
- `Route "${routeToUpdate.id}" has a static property "${lazyRouteProperty}" defined but its lazy function is also returning a value for this property. The lazy route property "${lazyRouteProperty}" will be ignored.`
3586
+ !isUnsupported,
3587
+ "Route property " + key + " is not a supported lazy route property. This property will be ignored."
3556
3588
  );
3589
+ cache[key] = Promise.resolve();
3590
+ } else if (isStaticallyDefined) {
3557
3591
  warning(
3558
- !unsupportedLazyRouteFunctionKeys.has(
3559
- lazyRouteProperty
3560
- ),
3561
- "Route property " + lazyRouteProperty + " is not a supported property to be returned from a lazy route function. This property will be ignored."
3592
+ false,
3593
+ `Route "${routeToUpdate.id}" has a static property "${key}" defined. The lazy property will be ignored.`
3562
3594
  );
3563
- if (!isPropertyStaticallyDefined && !unsupportedLazyRouteFunctionKeys.has(
3564
- lazyRouteProperty
3565
- )) {
3566
- routeUpdates[lazyRouteProperty] = lazyRoute[lazyRouteProperty];
3595
+ } else {
3596
+ let value = await lazyFn();
3597
+ if (value != null) {
3598
+ Object.assign(routeToUpdate, { [key]: value });
3599
+ Object.assign(routeToUpdate, mapRouteProperties2(routeToUpdate));
3567
3600
  }
3568
3601
  }
3569
- Object.assign(routeToUpdate, routeUpdates);
3570
- Object.assign(routeToUpdate, {
3571
- // To keep things framework agnostic, we use the provided `mapRouteProperties`
3572
- // function to set the framework-aware properties (`element`/`hasErrorBoundary`)
3573
- // since the logic will differ between frameworks.
3574
- ...mapRouteProperties2(routeToUpdate),
3575
- lazy: void 0
3576
- });
3577
- });
3578
- lazyRouteFunctionCache.set(routeToUpdate, lazyRoutePromise);
3579
- await lazyRoutePromise;
3580
- }
3581
- async function loadLazyMiddleware(route, manifest) {
3582
- if (!route.unstable_lazyMiddleware) {
3583
- return;
3584
- }
3602
+ if (typeof routeToUpdate.lazy === "object") {
3603
+ routeToUpdate.lazy[key] = void 0;
3604
+ if (Object.values(routeToUpdate.lazy).every((value) => value === void 0)) {
3605
+ routeToUpdate.lazy = void 0;
3606
+ }
3607
+ }
3608
+ })();
3609
+ cache[key] = propertyPromise;
3610
+ return propertyPromise;
3611
+ };
3612
+ var lazyRouteFunctionCache = /* @__PURE__ */ new WeakMap();
3613
+ async function loadLazyRoute(route, manifest, mapRouteProperties2) {
3585
3614
  let routeToUpdate = manifest[route.id];
3586
3615
  invariant(routeToUpdate, "No route found in manifest");
3587
- if (routeToUpdate.unstable_middleware) {
3588
- warning(
3589
- false,
3590
- `Route "${routeToUpdate.id}" has a static property "unstable_middleware" defined. The "unstable_lazyMiddleware" function will be ignored.`
3591
- );
3592
- } else {
3593
- let middleware = await route.unstable_lazyMiddleware();
3594
- if (!route.unstable_lazyMiddleware) {
3616
+ if (!route.lazy) {
3617
+ return;
3618
+ }
3619
+ if (typeof route.lazy === "function") {
3620
+ let cachedPromise = lazyRouteFunctionCache.get(routeToUpdate);
3621
+ if (cachedPromise) {
3622
+ await cachedPromise;
3595
3623
  return;
3596
3624
  }
3597
- if (!routeToUpdate.unstable_middleware) {
3598
- routeToUpdate.unstable_middleware = middleware;
3599
- }
3625
+ let lazyRoutePromise = route.lazy().then((lazyRoute) => {
3626
+ let routeUpdates = {};
3627
+ for (let lazyRouteProperty in lazyRoute) {
3628
+ let lazyValue = lazyRoute[lazyRouteProperty];
3629
+ if (lazyValue === void 0) {
3630
+ continue;
3631
+ }
3632
+ let isUnsupported = isUnsupportedLazyRouteFunctionKey(lazyRouteProperty);
3633
+ let staticRouteValue = routeToUpdate[lazyRouteProperty];
3634
+ let isStaticallyDefined = staticRouteValue !== void 0 && // This property isn't static since it should always be updated based
3635
+ // on the route updates
3636
+ lazyRouteProperty !== "hasErrorBoundary";
3637
+ if (isUnsupported) {
3638
+ warning(
3639
+ !isUnsupported,
3640
+ "Route property " + lazyRouteProperty + " is not a supported property to be returned from a lazy route function. This property will be ignored."
3641
+ );
3642
+ } else if (isStaticallyDefined) {
3643
+ warning(
3644
+ !isStaticallyDefined,
3645
+ `Route "${routeToUpdate.id}" has a static property "${lazyRouteProperty}" defined but its lazy function is also returning a value for this property. The lazy route property "${lazyRouteProperty}" will be ignored.`
3646
+ );
3647
+ } else {
3648
+ routeUpdates[lazyRouteProperty] = lazyValue;
3649
+ }
3650
+ }
3651
+ Object.assign(routeToUpdate, routeUpdates);
3652
+ Object.assign(routeToUpdate, {
3653
+ // To keep things framework agnostic, we use the provided `mapRouteProperties`
3654
+ // function to set the framework-aware properties (`element`/`hasErrorBoundary`)
3655
+ // since the logic will differ between frameworks.
3656
+ ...mapRouteProperties2(routeToUpdate),
3657
+ lazy: void 0
3658
+ });
3659
+ });
3660
+ lazyRouteFunctionCache.set(routeToUpdate, lazyRoutePromise);
3661
+ await lazyRoutePromise;
3662
+ return;
3600
3663
  }
3601
- routeToUpdate.unstable_lazyMiddleware = void 0;
3664
+ let lazyKeys = Object.keys(route.lazy);
3665
+ await Promise.all(
3666
+ lazyKeys.map(
3667
+ (key) => loadLazyRouteProperty({
3668
+ key,
3669
+ route,
3670
+ manifest,
3671
+ mapRouteProperties: mapRouteProperties2
3672
+ })
3673
+ )
3674
+ );
3602
3675
  }
3603
- function loadLazyMiddlewareForMatches(matches, manifest) {
3604
- let promises = matches.map(
3605
- (m) => m.route.unstable_lazyMiddleware ? loadLazyMiddleware(m.route, manifest) : void 0
3606
- ).filter(Boolean);
3676
+ function loadLazyMiddlewareForMatches(matches, manifest, mapRouteProperties2) {
3677
+ let promises = matches.map(({ route }) => {
3678
+ if (typeof route.lazy !== "object" || !route.lazy.unstable_middleware) {
3679
+ return void 0;
3680
+ }
3681
+ return loadLazyRouteProperty({
3682
+ key: "unstable_middleware",
3683
+ route,
3684
+ manifest,
3685
+ mapRouteProperties: mapRouteProperties2
3686
+ });
3687
+ }).filter((p) => p != null);
3607
3688
  return promises.length > 0 ? Promise.all(promises) : void 0;
3608
3689
  }
3609
3690
  async function defaultDataStrategy(args) {
@@ -3721,15 +3802,19 @@ async function callRouteMiddleware(args, middlewares, propagateResult, middlewar
3721
3802
  }
3722
3803
  }
3723
3804
  async function callDataStrategyImpl(dataStrategyImpl, type, request, matchesToLoad, matches, fetcherKey, manifest, mapRouteProperties2, scopedContext) {
3724
- let loadMiddlewarePromise = loadLazyMiddlewareForMatches(matches, manifest);
3725
- let loadRouteDefinitionsPromises = matches.map(
3726
- (m) => m.route.lazy ? loadLazyRouteModule(m.route, mapRouteProperties2, manifest) : void 0
3805
+ let loadMiddlewarePromise = loadLazyMiddlewareForMatches(
3806
+ matches,
3807
+ manifest,
3808
+ mapRouteProperties2
3809
+ );
3810
+ let loadLazyRoutePromises = matches.map(
3811
+ (m) => m.route.lazy ? loadLazyRoute(m.route, manifest, mapRouteProperties2) : void 0
3727
3812
  );
3728
3813
  if (loadMiddlewarePromise) {
3729
3814
  await loadMiddlewarePromise;
3730
3815
  }
3731
3816
  let dsMatches = matches.map((match, i) => {
3732
- let loadRoutePromise = loadRouteDefinitionsPromises[i];
3817
+ let loadRoutePromise = loadLazyRoutePromises[i];
3733
3818
  let shouldLoad = matchesToLoad.some((m) => m.route.id === match.route.id);
3734
3819
  let resolve = async (handlerOverride) => {
3735
3820
  if (handlerOverride && request.method === "GET" && (match.route.lazy || match.route.loader)) {
@@ -3758,7 +3843,7 @@ async function callDataStrategyImpl(dataStrategyImpl, type, request, matchesToLo
3758
3843
  context: scopedContext
3759
3844
  });
3760
3845
  try {
3761
- await Promise.all(loadRouteDefinitionsPromises);
3846
+ await Promise.all(loadLazyRoutePromises);
3762
3847
  } catch (e) {
3763
3848
  }
3764
3849
  return results;
@@ -6746,22 +6831,6 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
6746
6831
  dataRoute.loader = (_, singleFetch) => prefetchStylesAndCallHandler(() => {
6747
6832
  return fetchServerLoader(singleFetch);
6748
6833
  });
6749
- } else if (route.clientLoaderModule) {
6750
- dataRoute.loader = async (args, singleFetch) => {
6751
- invariant2(route.clientLoaderModule);
6752
- let { clientLoader } = await import(
6753
- /* @vite-ignore */
6754
- /* webpackIgnore: true */
6755
- route.clientLoaderModule
6756
- );
6757
- return clientLoader({
6758
- ...args,
6759
- async serverLoader() {
6760
- preventInvalidServerHandlerCall("loader", route);
6761
- return fetchServerLoader(singleFetch);
6762
- }
6763
- });
6764
- };
6765
6834
  }
6766
6835
  if (!route.hasClientAction) {
6767
6836
  dataRoute.action = (_, singleFetch) => prefetchStylesAndCallHandler(() => {
@@ -6770,86 +6839,84 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
6770
6839
  }
6771
6840
  return fetchServerAction(singleFetch);
6772
6841
  });
6773
- } else if (route.clientActionModule) {
6774
- dataRoute.action = async (args, singleFetch) => {
6775
- invariant2(route.clientActionModule);
6776
- prefetchRouteModuleChunks(route);
6777
- let { clientAction } = await import(
6778
- /* @vite-ignore */
6779
- /* webpackIgnore: true */
6780
- route.clientActionModule
6842
+ }
6843
+ let lazyRoutePromise;
6844
+ async function getLazyRoute() {
6845
+ if (lazyRoutePromise) {
6846
+ return await lazyRoutePromise;
6847
+ }
6848
+ lazyRoutePromise = (async () => {
6849
+ if (route.clientLoaderModule || route.clientActionModule) {
6850
+ await new Promise((resolve) => setTimeout(resolve, 0));
6851
+ }
6852
+ let routeModulePromise = loadRouteModuleWithBlockingLinks(
6853
+ route,
6854
+ routeModulesCache
6781
6855
  );
6782
- return clientAction({
6783
- ...args,
6784
- async serverAction() {
6785
- preventInvalidServerHandlerCall("action", route);
6786
- return fetchServerAction(singleFetch);
6787
- }
6788
- });
6789
- };
6856
+ prefetchRouteModuleChunks(route);
6857
+ return await routeModulePromise;
6858
+ })();
6859
+ return await lazyRoutePromise;
6790
6860
  }
6791
- if (route.hasClientMiddleware) {
6792
- dataRoute.unstable_lazyMiddleware = async () => {
6793
- invariant2(route);
6794
- let clientMiddlewareModule = await import(
6861
+ dataRoute.lazy = {
6862
+ loader: route.hasClientLoader ? async () => {
6863
+ let { clientLoader } = route.clientLoaderModule ? await import(
6795
6864
  /* @vite-ignore */
6796
6865
  /* webpackIgnore: true */
6797
- route.clientMiddlewareModule || route.module
6798
- );
6799
- invariant2(
6800
- clientMiddlewareModule?.unstable_clientMiddleware,
6801
- "No `unstable_clientMiddleware` export in chunk"
6802
- );
6803
- return clientMiddlewareModule.unstable_clientMiddleware;
6804
- };
6805
- }
6806
- dataRoute.lazy = async () => {
6807
- if (route.clientLoaderModule || route.clientActionModule) {
6808
- await new Promise((resolve) => setTimeout(resolve, 0));
6809
- }
6810
- let modPromise = loadRouteModuleWithBlockingLinks(
6811
- route,
6812
- routeModulesCache
6813
- );
6814
- prefetchRouteModuleChunks(route);
6815
- let mod = await modPromise;
6816
- let lazyRoute = { ...mod };
6817
- if (mod.clientLoader) {
6818
- let clientLoader = mod.clientLoader;
6819
- lazyRoute.loader = (args, singleFetch) => clientLoader({
6866
+ route.clientLoaderModule
6867
+ ) : await getLazyRoute();
6868
+ invariant2(clientLoader, "No `clientLoader` export found");
6869
+ return (args, singleFetch) => clientLoader({
6820
6870
  ...args,
6821
6871
  async serverLoader() {
6822
6872
  preventInvalidServerHandlerCall("loader", route);
6823
6873
  return fetchServerLoader(singleFetch);
6824
6874
  }
6825
6875
  });
6826
- }
6827
- if (mod.clientAction) {
6828
- let clientAction = mod.clientAction;
6829
- lazyRoute.action = (args, singleFetch) => clientAction({
6876
+ } : void 0,
6877
+ action: route.hasClientAction ? async () => {
6878
+ let clientActionPromise = route.clientActionModule ? import(
6879
+ /* @vite-ignore */
6880
+ /* webpackIgnore: true */
6881
+ route.clientActionModule
6882
+ ) : getLazyRoute();
6883
+ prefetchRouteModuleChunks(route);
6884
+ let { clientAction } = await clientActionPromise;
6885
+ invariant2(clientAction, "No `clientAction` export found");
6886
+ return (args, singleFetch) => clientAction({
6830
6887
  ...args,
6831
6888
  async serverAction() {
6832
6889
  preventInvalidServerHandlerCall("action", route);
6833
6890
  return fetchServerAction(singleFetch);
6834
6891
  }
6835
6892
  });
6836
- }
6837
- return {
6838
- ...lazyRoute.loader ? { loader: lazyRoute.loader } : {},
6839
- ...lazyRoute.action ? { action: lazyRoute.action } : {},
6840
- hasErrorBoundary: lazyRoute.hasErrorBoundary,
6841
- shouldRevalidate: getShouldRevalidateFunction(
6893
+ } : void 0,
6894
+ unstable_middleware: route.hasClientMiddleware ? async () => {
6895
+ let { unstable_clientMiddleware } = route.clientMiddlewareModule ? await import(
6896
+ /* @vite-ignore */
6897
+ /* webpackIgnore: true */
6898
+ route.clientMiddlewareModule
6899
+ ) : await getLazyRoute();
6900
+ invariant2(
6901
+ unstable_clientMiddleware,
6902
+ "No `unstable_clientMiddleware` export found"
6903
+ );
6904
+ return unstable_clientMiddleware;
6905
+ } : void 0,
6906
+ shouldRevalidate: async () => {
6907
+ let lazyRoute = await getLazyRoute();
6908
+ return getShouldRevalidateFunction(
6842
6909
  lazyRoute,
6843
6910
  route,
6844
6911
  ssr,
6845
6912
  needsRevalidation
6846
- ),
6847
- handle: lazyRoute.handle,
6848
- // No need to wrap these in layout since the root route is never
6849
- // loaded via route.lazy()
6850
- Component: lazyRoute.Component,
6851
- ErrorBoundary: lazyRoute.ErrorBoundary
6852
- };
6913
+ );
6914
+ },
6915
+ handle: async () => (await getLazyRoute()).handle,
6916
+ // No need to wrap these in layout since the root route is never
6917
+ // loaded via route.lazy()
6918
+ Component: async () => (await getLazyRoute()).Component,
6919
+ ErrorBoundary: route.hasErrorBoundary ? async () => (await getLazyRoute()).ErrorBoundary : void 0
6853
6920
  };
6854
6921
  }
6855
6922
  let children = createClientRoutes(
@@ -6937,7 +7004,7 @@ var URL_LIMIT = 7680;
6937
7004
  function isFogOfWarEnabled(ssr) {
6938
7005
  return ssr === true;
6939
7006
  }
6940
- function getPartialManifest(manifest, router) {
7007
+ function getPartialManifest({ sri, ...manifest }, router) {
6941
7008
  let routeIds = new Set(router.state.matches.map((m) => m.route.id));
6942
7009
  let segments = router.state.location.pathname.split("/").filter(Boolean);
6943
7010
  let paths = ["/"];
@@ -6958,7 +7025,8 @@ function getPartialManifest(manifest, router) {
6958
7025
  );
6959
7026
  return {
6960
7027
  ...manifest,
6961
- routes: initialRoutes
7028
+ routes: initialRoutes,
7029
+ sri: sri ? true : void 0
6962
7030
  };
6963
7031
  }
6964
7032
  function getPatchRoutesOnNavigationFunction(manifest, routeModules, ssr, isSpaMode, basename) {
@@ -7538,32 +7606,53 @@ import(${JSON.stringify(manifest.entry.module)});`;
7538
7606
  }
7539
7607
  ));
7540
7608
  }, []);
7541
- let preloads = isHydrated ? [] : manifest.entry.imports.concat(
7542
- getModuleLinkHrefs(matches, manifest, {
7543
- includeHydrateFallback: true
7544
- })
7609
+ let preloads = isHydrated ? [] : dedupe(
7610
+ manifest.entry.imports.concat(
7611
+ getModuleLinkHrefs(matches, manifest, {
7612
+ includeHydrateFallback: true
7613
+ })
7614
+ )
7545
7615
  );
7546
- return isHydrated ? null : /* @__PURE__ */ React9.createElement(React9.Fragment, null, !enableFogOfWar ? /* @__PURE__ */ React9.createElement(
7616
+ let sri = typeof manifest.sri === "object" ? manifest.sri : {};
7617
+ return isHydrated ? null : /* @__PURE__ */ React9.createElement(React9.Fragment, null, typeof manifest.sri === "object" ? /* @__PURE__ */ React9.createElement(
7618
+ "script",
7619
+ {
7620
+ "rr-importmap": "",
7621
+ type: "importmap",
7622
+ suppressHydrationWarning: true,
7623
+ dangerouslySetInnerHTML: {
7624
+ __html: JSON.stringify({
7625
+ integrity: sri
7626
+ })
7627
+ }
7628
+ }
7629
+ ) : null, !enableFogOfWar ? /* @__PURE__ */ React9.createElement(
7547
7630
  "link",
7548
7631
  {
7549
7632
  rel: "modulepreload",
7550
7633
  href: manifest.url,
7551
- crossOrigin: props.crossOrigin
7634
+ crossOrigin: props.crossOrigin,
7635
+ integrity: sri[manifest.url],
7636
+ suppressHydrationWarning: true
7552
7637
  }
7553
7638
  ) : null, /* @__PURE__ */ React9.createElement(
7554
7639
  "link",
7555
7640
  {
7556
7641
  rel: "modulepreload",
7557
7642
  href: manifest.entry.module,
7558
- crossOrigin: props.crossOrigin
7643
+ crossOrigin: props.crossOrigin,
7644
+ integrity: sri[manifest.entry.module],
7645
+ suppressHydrationWarning: true
7559
7646
  }
7560
- ), dedupe(preloads).map((path) => /* @__PURE__ */ React9.createElement(
7647
+ ), preloads.map((path) => /* @__PURE__ */ React9.createElement(
7561
7648
  "link",
7562
7649
  {
7563
7650
  key: path,
7564
7651
  rel: "modulepreload",
7565
7652
  href: path,
7566
- crossOrigin: props.crossOrigin
7653
+ crossOrigin: props.crossOrigin,
7654
+ integrity: sri[path],
7655
+ suppressHydrationWarning: true
7567
7656
  }
7568
7657
  )), initialScripts);
7569
7658
  }
@@ -7586,7 +7675,7 @@ function mergeRefs(...refs) {
7586
7675
  var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
7587
7676
  try {
7588
7677
  if (isBrowser) {
7589
- window.__reactRouterVersion = "7.4.1";
7678
+ window.__reactRouterVersion = "7.5.0-pre.0";
7590
7679
  }
7591
7680
  } catch (e) {
7592
7681
  }
@@ -8741,6 +8830,7 @@ function createRoutesStub(routes, unstable_getContext) {
8741
8830
  if (routerRef.current == null) {
8742
8831
  remixContextRef.current = {
8743
8832
  future: {
8833
+ unstable_subResourceIntegrity: future?.unstable_subResourceIntegrity === true,
8744
8834
  unstable_middleware: future?.unstable_middleware === true
8745
8835
  },
8746
8836
  manifest: {
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
- import { R as RouterProviderProps$1 } from './fog-of-war-BjgPfDmv.mjs';
3
- import { R as RouterInit } from './route-data-BL8ToWby.mjs';
2
+ import { R as RouterProviderProps$1 } from './fog-of-war-1hWhK5ey.mjs';
3
+ import { R as RouterInit } from './route-data-5OzAzQtT.mjs';
4
4
 
5
5
  type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
6
6
  declare function RouterProvider(props: Omit<RouterProviderProps, "flushSync">): React.JSX.Element;
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
- import { R as RouterProviderProps$1 } from './fog-of-war-BaM-ohjc.js';
3
- import { R as RouterInit } from './route-data-BL8ToWby.js';
2
+ import { R as RouterProviderProps$1 } from './fog-of-war-oa9CGk10.js';
3
+ import { R as RouterInit } from './route-data-5OzAzQtT.js';
4
4
 
5
5
  type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
6
6
  declare function RouterProvider(props: Omit<RouterProviderProps, "flushSync">): React.JSX.Element;