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
@@ -1,7 +1,7 @@
1
- import { a as RouteModules, b as Router, D as DataStrategyFunction, c as RouteManifest, S as ServerRouteModule, u as unstable_RouterContextProvider, L as LoaderFunctionArgs, A as ActionFunctionArgs, T as To, d as RelativeRoutingType, e as Location, f as Action, P as ParamParseKey, g as Path, h as PathPattern, i as PathMatch, N as NavigateOptions, j as Params$1, k as RouteObject, l as Navigation, m as RevalidationState, U as UIMatch, n as SerializeFrom, B as BlockerFunction, o as Blocker, p as StaticHandlerContext, q as StaticHandler, F as FutureConfig$1, C as CreateStaticHandlerOptions$1, I as InitialEntry, H as HydrationState, r as unstable_InitialContext, s as IndexRouteObject, t as LoaderFunction, v as ActionFunction, M as MetaFunction, w as LinksFunction, x as NonIndexRouteObject, E as Equal, y as RouterState } from './route-data-BL8ToWby.js';
2
- export { au as ClientActionFunction, av as ClientActionFunctionArgs, aw as ClientLoaderFunction, ax as ClientLoaderFunctionArgs, ao as DataRouteMatch, ap as DataRouteObject, W as DataStrategyFunctionArgs, X as DataStrategyMatch, Y as DataStrategyResult, _ as ErrorResponse, J as Fetcher, $ as FormEncType, a0 as FormMethod, G as GetScrollPositionFunction, z as GetScrollRestorationKeyFunction, a1 as HTMLFormMethod, ay as HeadersArgs, az as HeadersFunction, aD as HtmlLinkDescriptor, ae as IDLE_BLOCKER, ad as IDLE_FETCHER, ac as IDLE_NAVIGATION, a2 as LazyRouteFunction, aE as LinkDescriptor, aA as MetaArgs, aB as MetaDescriptor, K as NavigationStates, aq as Navigator, aC as PageLinkDescriptor, ar as PatchRoutesOnNavigationFunction, as as PatchRoutesOnNavigationFunctionArgs, a4 as PathParam, a5 as RedirectFunction, at as RouteMatch, V as RouterFetchOptions, R as RouterInit, Q as RouterNavigateOptions, O as RouterSubscriber, a7 as ShouldRevalidateFunction, a8 as ShouldRevalidateFunctionArgs, aK as UNSAFE_DataRouterContext, aL as UNSAFE_DataRouterStateContext, Z as UNSAFE_DataWithResponseInit, aJ as UNSAFE_ErrorResponseImpl, aM as UNSAFE_FetchersContext, aN as UNSAFE_LocationContext, aO as UNSAFE_NavigationContext, aP as UNSAFE_RouteContext, aQ as UNSAFE_ViewTransitionContext, aG as UNSAFE_createBrowserHistory, aI as UNSAFE_createRouter, aH as UNSAFE_invariant, aa as createPath, af as data, ag as generatePath, ah as isRouteErrorResponse, ai as matchPath, aj as matchRoutes, ab as parsePath, ak as redirect, al as redirectDocument, am as replace, an as resolvePath, a3 as unstable_MiddlewareFunction, a6 as unstable_RouterContext, aF as unstable_SerializesTo, a9 as unstable_createContext } from './route-data-BL8ToWby.js';
3
- import { A as AssetsManifest, a as Route, F as FutureConfig, E as EntryContext, C as CriticalCss } from './fog-of-war-BaM-ohjc.js';
4
- export { g as Await, b as AwaitProps, T as BrowserRouter, B as BrowserRouterProps, D as DOMRouterOpts, w as FetcherFormProps, G as FetcherSubmitFunction, a7 as FetcherSubmitOptions, J as FetcherWithComponents, Y as Form, x as FormProps, U as HashRouter, H as HashRouterProps, s as HistoryRouterProps, I as IndexRouteProps, L as LayoutRouteProps, V as Link, t as LinkProps, ae as Links, h as MemoryRouter, M as MemoryRouterOpts, c as MemoryRouterProps, ad as Meta, X as NavLink, u as NavLinkProps, v as NavLinkRenderProps, i as Navigate, N as NavigateProps, j as Outlet, O as OutletProps, a8 as ParamKeyValuePair, P as PathRouteProps, ag as PrefetchPageLinks, k as Route, d as RouteProps, l as Router, e as RouterProps, m as RouterProvider, R as RouterProviderProps, n as Routes, f as RoutesProps, af as Scripts, ah as ScriptsProps, Z as ScrollRestoration, S as ScrollRestorationProps, y as SetURLSearchParams, z as SubmitFunction, a9 as SubmitOptions, ab as SubmitTarget, aj as UNSAFE_FrameworkContext, am as UNSAFE_createClientRoutes, an as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, ak as UNSAFE_getPatchRoutesOnNavigationFunction, ai as UNSAFE_mapRouteProperties, ao as UNSAFE_shouldHydrateRouteLoader, al as UNSAFE_useFogOFWarDiscovery, ap as UNSAFE_useScrollRestoration, aa as URLSearchParamsInit, K as createBrowserRouter, Q as createHashRouter, o as createMemoryRouter, p as createRoutesFromChildren, q as createRoutesFromElements, ac as createSearchParams, r as renderMatches, W as unstable_HistoryRouter, a5 as unstable_usePrompt, a4 as useBeforeUnload, a2 as useFetcher, a3 as useFetchers, a1 as useFormAction, _ as useLinkClickHandler, $ as useSearchParams, a0 as useSubmit, a6 as useViewTransitionState } from './fog-of-war-BaM-ohjc.js';
1
+ import { a as RouteModules, b as Router, D as DataStrategyFunction, c as RouteManifest, S as ServerRouteModule, u as unstable_RouterContextProvider, L as LoaderFunctionArgs, A as ActionFunctionArgs, T as To, d as RelativeRoutingType, e as Location, f as Action, P as ParamParseKey, g as Path, h as PathPattern, i as PathMatch, N as NavigateOptions, j as Params$1, k as RouteObject, l as Navigation, m as RevalidationState, U as UIMatch, n as SerializeFrom, B as BlockerFunction, o as Blocker, p as StaticHandlerContext, q as StaticHandler, F as FutureConfig$1, C as CreateStaticHandlerOptions$1, I as InitialEntry, H as HydrationState, r as unstable_InitialContext, s as IndexRouteObject, t as LoaderFunction, v as ActionFunction, M as MetaFunction, w as LinksFunction, x as NonIndexRouteObject, E as Equal, y as RouterState } from './route-data-5OzAzQtT.js';
2
+ export { au as ClientActionFunction, av as ClientActionFunctionArgs, aw as ClientLoaderFunction, ax as ClientLoaderFunctionArgs, ao as DataRouteMatch, ap as DataRouteObject, W as DataStrategyFunctionArgs, X as DataStrategyMatch, Y as DataStrategyResult, _ as ErrorResponse, J as Fetcher, $ as FormEncType, a0 as FormMethod, G as GetScrollPositionFunction, z as GetScrollRestorationKeyFunction, a1 as HTMLFormMethod, ay as HeadersArgs, az as HeadersFunction, aD as HtmlLinkDescriptor, ae as IDLE_BLOCKER, ad as IDLE_FETCHER, ac as IDLE_NAVIGATION, a2 as LazyRouteFunction, aE as LinkDescriptor, aA as MetaArgs, aB as MetaDescriptor, K as NavigationStates, aq as Navigator, aC as PageLinkDescriptor, ar as PatchRoutesOnNavigationFunction, as as PatchRoutesOnNavigationFunctionArgs, a4 as PathParam, a5 as RedirectFunction, at as RouteMatch, V as RouterFetchOptions, R as RouterInit, Q as RouterNavigateOptions, O as RouterSubscriber, a7 as ShouldRevalidateFunction, a8 as ShouldRevalidateFunctionArgs, aK as UNSAFE_DataRouterContext, aL as UNSAFE_DataRouterStateContext, Z as UNSAFE_DataWithResponseInit, aJ as UNSAFE_ErrorResponseImpl, aM as UNSAFE_FetchersContext, aN as UNSAFE_LocationContext, aO as UNSAFE_NavigationContext, aP as UNSAFE_RouteContext, aQ as UNSAFE_ViewTransitionContext, aG as UNSAFE_createBrowserHistory, aI as UNSAFE_createRouter, aH as UNSAFE_invariant, aa as createPath, af as data, ag as generatePath, ah as isRouteErrorResponse, ai as matchPath, aj as matchRoutes, ab as parsePath, ak as redirect, al as redirectDocument, am as replace, an as resolvePath, a3 as unstable_MiddlewareFunction, a6 as unstable_RouterContext, aF as unstable_SerializesTo, a9 as unstable_createContext } from './route-data-5OzAzQtT.js';
3
+ import { A as AssetsManifest, a as Route, F as FutureConfig, E as EntryContext, C as CriticalCss } from './fog-of-war-oa9CGk10.js';
4
+ export { g as Await, b as AwaitProps, T as BrowserRouter, B as BrowserRouterProps, D as DOMRouterOpts, w as FetcherFormProps, G as FetcherSubmitFunction, a7 as FetcherSubmitOptions, J as FetcherWithComponents, Y as Form, x as FormProps, U as HashRouter, H as HashRouterProps, s as HistoryRouterProps, I as IndexRouteProps, L as LayoutRouteProps, V as Link, t as LinkProps, ae as Links, h as MemoryRouter, M as MemoryRouterOpts, c as MemoryRouterProps, ad as Meta, X as NavLink, u as NavLinkProps, v as NavLinkRenderProps, i as Navigate, N as NavigateProps, j as Outlet, O as OutletProps, a8 as ParamKeyValuePair, P as PathRouteProps, ag as PrefetchPageLinks, k as Route, d as RouteProps, l as Router, e as RouterProps, m as RouterProvider, R as RouterProviderProps, n as Routes, f as RoutesProps, af as Scripts, ah as ScriptsProps, Z as ScrollRestoration, S as ScrollRestorationProps, y as SetURLSearchParams, z as SubmitFunction, a9 as SubmitOptions, ab as SubmitTarget, aj as UNSAFE_FrameworkContext, am as UNSAFE_createClientRoutes, an as UNSAFE_createClientRoutesWithHMRRevalidationOptOut, ak as UNSAFE_getPatchRoutesOnNavigationFunction, ai as UNSAFE_mapRouteProperties, ao as UNSAFE_shouldHydrateRouteLoader, al as UNSAFE_useFogOFWarDiscovery, ap as UNSAFE_useScrollRestoration, aa as URLSearchParamsInit, K as createBrowserRouter, Q as createHashRouter, o as createMemoryRouter, p as createRoutesFromChildren, q as createRoutesFromElements, ac as createSearchParams, r as renderMatches, W as unstable_HistoryRouter, a5 as unstable_usePrompt, a4 as useBeforeUnload, a2 as useFetcher, a3 as useFetchers, a1 as useFormAction, _ as useLinkClickHandler, $ as useSearchParams, a0 as useSubmit, a6 as useViewTransitionState } from './fog-of-war-oa9CGk10.js';
5
5
  import * as React from 'react';
6
6
  import { ReactElement } from 'react';
7
7
  import { ParseOptions, SerializeOptions } from 'cookie';
@@ -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
  *
@@ -531,6 +531,19 @@ var unstable_RouterContextProvider = class {
531
531
  }
532
532
  };
533
533
  _map = new WeakMap();
534
+ var unsupportedLazyRouteObjectKeys = /* @__PURE__ */ new Set([
535
+ "lazy",
536
+ "caseSensitive",
537
+ "path",
538
+ "id",
539
+ "index",
540
+ "children"
541
+ ]);
542
+ function isUnsupportedLazyRouteObjectKey(key) {
543
+ return unsupportedLazyRouteObjectKeys.has(
544
+ key
545
+ );
546
+ }
534
547
  var unsupportedLazyRouteFunctionKeys = /* @__PURE__ */ new Set([
535
548
  "lazy",
536
549
  "caseSensitive",
@@ -538,9 +551,13 @@ var unsupportedLazyRouteFunctionKeys = /* @__PURE__ */ new Set([
538
551
  "id",
539
552
  "index",
540
553
  "unstable_middleware",
541
- "unstable_lazyMiddleware",
542
554
  "children"
543
555
  ]);
556
+ function isUnsupportedLazyRouteFunctionKey(key) {
557
+ return unsupportedLazyRouteFunctionKeys.has(
558
+ key
559
+ );
560
+ }
544
561
  function isIndexRoute(route) {
545
562
  return route.index === true;
546
563
  }
@@ -2831,14 +2848,18 @@ function createStaticHandler(routes, opts) {
2831
2848
  return respond ? respond(staticContext) : staticContext;
2832
2849
  }
2833
2850
  if (respond && matches.some(
2834
- (m) => m.route.unstable_middleware || m.route.unstable_lazyMiddleware
2851
+ (m) => m.route.unstable_middleware || typeof m.route.lazy === "object" && m.route.lazy.unstable_middleware
2835
2852
  )) {
2836
2853
  invariant(
2837
2854
  requestContext instanceof unstable_RouterContextProvider,
2838
2855
  "When using middleware in `staticHandler.query()`, any provided `requestContext` must be an instance of `unstable_RouterContextProvider`"
2839
2856
  );
2840
2857
  try {
2841
- await loadLazyMiddlewareForMatches(matches, manifest);
2858
+ await loadLazyMiddlewareForMatches(
2859
+ matches,
2860
+ manifest,
2861
+ mapRouteProperties2
2862
+ );
2842
2863
  let renderedStaticContext;
2843
2864
  let response = await runMiddlewarePipeline(
2844
2865
  {
@@ -2955,13 +2976,13 @@ function createStaticHandler(routes, opts) {
2955
2976
  throw getInternalRouterError(404, { pathname: location.pathname });
2956
2977
  }
2957
2978
  if (respond && matches.some(
2958
- (m) => m.route.unstable_middleware || m.route.unstable_lazyMiddleware
2979
+ (m) => m.route.unstable_middleware || typeof m.route.lazy === "object" && m.route.lazy.unstable_middleware
2959
2980
  )) {
2960
2981
  invariant(
2961
2982
  requestContext instanceof unstable_RouterContextProvider,
2962
2983
  "When using middleware in `staticHandler.queryRoute()`, any provided `requestContext` must be an instance of `unstable_RouterContextProvider`"
2963
2984
  );
2964
- await loadLazyMiddlewareForMatches(matches, manifest);
2985
+ await loadLazyMiddlewareForMatches(matches, manifest, mapRouteProperties2);
2965
2986
  let response = await runMiddlewarePipeline(
2966
2987
  {
2967
2988
  request,
@@ -3679,79 +3700,139 @@ function isSameRoute(newRoute, existingRoute) {
3679
3700
  (aChild, i) => existingRoute.children?.some((bChild) => isSameRoute(aChild, bChild))
3680
3701
  );
3681
3702
  }
3682
- var lazyRouteFunctionCache = /* @__PURE__ */ new WeakMap();
3683
- async function loadLazyRouteModule(route, mapRouteProperties2, manifest) {
3703
+ var lazyRoutePropertyCache = /* @__PURE__ */ new WeakMap();
3704
+ var loadLazyRouteProperty = ({
3705
+ key,
3706
+ route,
3707
+ manifest,
3708
+ mapRouteProperties: mapRouteProperties2
3709
+ }) => {
3684
3710
  let routeToUpdate = manifest[route.id];
3685
3711
  invariant(routeToUpdate, "No route found in manifest");
3686
- if (!route.lazy) {
3712
+ if (!routeToUpdate.lazy || typeof routeToUpdate.lazy !== "object") {
3687
3713
  return;
3688
3714
  }
3689
- let cachedPromise = lazyRouteFunctionCache.get(routeToUpdate);
3690
- if (cachedPromise) {
3691
- await cachedPromise;
3715
+ let lazyFn = routeToUpdate.lazy[key];
3716
+ if (!lazyFn) {
3692
3717
  return;
3693
3718
  }
3694
- let lazyRoutePromise = route.lazy().then((lazyRoute) => {
3695
- let routeUpdates = {};
3696
- for (let lazyRouteProperty in lazyRoute) {
3697
- let staticRouteValue = routeToUpdate[lazyRouteProperty];
3698
- let isPropertyStaticallyDefined = staticRouteValue !== void 0 && // This property isn't static since it should always be updated based
3699
- // on the route updates
3700
- lazyRouteProperty !== "hasErrorBoundary";
3719
+ let cache = lazyRoutePropertyCache.get(routeToUpdate);
3720
+ if (!cache) {
3721
+ cache = {};
3722
+ lazyRoutePropertyCache.set(routeToUpdate, cache);
3723
+ }
3724
+ let cachedPromise = cache[key];
3725
+ if (cachedPromise) {
3726
+ return cachedPromise;
3727
+ }
3728
+ let propertyPromise = (async () => {
3729
+ let isUnsupported = isUnsupportedLazyRouteObjectKey(key);
3730
+ let staticRouteValue = routeToUpdate[key];
3731
+ let isStaticallyDefined = staticRouteValue !== void 0 && key !== "hasErrorBoundary";
3732
+ if (isUnsupported) {
3701
3733
  warning(
3702
- !isPropertyStaticallyDefined,
3703
- `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.`
3734
+ !isUnsupported,
3735
+ "Route property " + key + " is not a supported lazy route property. This property will be ignored."
3704
3736
  );
3737
+ cache[key] = Promise.resolve();
3738
+ } else if (isStaticallyDefined) {
3705
3739
  warning(
3706
- !unsupportedLazyRouteFunctionKeys.has(
3707
- lazyRouteProperty
3708
- ),
3709
- "Route property " + lazyRouteProperty + " is not a supported property to be returned from a lazy route function. This property will be ignored."
3740
+ false,
3741
+ `Route "${routeToUpdate.id}" has a static property "${key}" defined. The lazy property will be ignored.`
3710
3742
  );
3711
- if (!isPropertyStaticallyDefined && !unsupportedLazyRouteFunctionKeys.has(
3712
- lazyRouteProperty
3713
- )) {
3714
- routeUpdates[lazyRouteProperty] = lazyRoute[lazyRouteProperty];
3743
+ } else {
3744
+ let value = await lazyFn();
3745
+ if (value != null) {
3746
+ Object.assign(routeToUpdate, { [key]: value });
3747
+ Object.assign(routeToUpdate, mapRouteProperties2(routeToUpdate));
3715
3748
  }
3716
3749
  }
3717
- Object.assign(routeToUpdate, routeUpdates);
3718
- Object.assign(routeToUpdate, {
3719
- // To keep things framework agnostic, we use the provided `mapRouteProperties`
3720
- // function to set the framework-aware properties (`element`/`hasErrorBoundary`)
3721
- // since the logic will differ between frameworks.
3722
- ...mapRouteProperties2(routeToUpdate),
3723
- lazy: void 0
3724
- });
3725
- });
3726
- lazyRouteFunctionCache.set(routeToUpdate, lazyRoutePromise);
3727
- await lazyRoutePromise;
3728
- }
3729
- async function loadLazyMiddleware(route, manifest) {
3730
- if (!route.unstable_lazyMiddleware) {
3731
- return;
3732
- }
3750
+ if (typeof routeToUpdate.lazy === "object") {
3751
+ routeToUpdate.lazy[key] = void 0;
3752
+ if (Object.values(routeToUpdate.lazy).every((value) => value === void 0)) {
3753
+ routeToUpdate.lazy = void 0;
3754
+ }
3755
+ }
3756
+ })();
3757
+ cache[key] = propertyPromise;
3758
+ return propertyPromise;
3759
+ };
3760
+ var lazyRouteFunctionCache = /* @__PURE__ */ new WeakMap();
3761
+ async function loadLazyRoute(route, manifest, mapRouteProperties2) {
3733
3762
  let routeToUpdate = manifest[route.id];
3734
3763
  invariant(routeToUpdate, "No route found in manifest");
3735
- if (routeToUpdate.unstable_middleware) {
3736
- warning(
3737
- false,
3738
- `Route "${routeToUpdate.id}" has a static property "unstable_middleware" defined. The "unstable_lazyMiddleware" function will be ignored.`
3739
- );
3740
- } else {
3741
- let middleware = await route.unstable_lazyMiddleware();
3742
- if (!route.unstable_lazyMiddleware) {
3764
+ if (!route.lazy) {
3765
+ return;
3766
+ }
3767
+ if (typeof route.lazy === "function") {
3768
+ let cachedPromise = lazyRouteFunctionCache.get(routeToUpdate);
3769
+ if (cachedPromise) {
3770
+ await cachedPromise;
3743
3771
  return;
3744
3772
  }
3745
- if (!routeToUpdate.unstable_middleware) {
3746
- routeToUpdate.unstable_middleware = middleware;
3747
- }
3773
+ let lazyRoutePromise = route.lazy().then((lazyRoute) => {
3774
+ let routeUpdates = {};
3775
+ for (let lazyRouteProperty in lazyRoute) {
3776
+ let lazyValue = lazyRoute[lazyRouteProperty];
3777
+ if (lazyValue === void 0) {
3778
+ continue;
3779
+ }
3780
+ let isUnsupported = isUnsupportedLazyRouteFunctionKey(lazyRouteProperty);
3781
+ let staticRouteValue = routeToUpdate[lazyRouteProperty];
3782
+ let isStaticallyDefined = staticRouteValue !== void 0 && // This property isn't static since it should always be updated based
3783
+ // on the route updates
3784
+ lazyRouteProperty !== "hasErrorBoundary";
3785
+ if (isUnsupported) {
3786
+ warning(
3787
+ !isUnsupported,
3788
+ "Route property " + lazyRouteProperty + " is not a supported property to be returned from a lazy route function. This property will be ignored."
3789
+ );
3790
+ } else if (isStaticallyDefined) {
3791
+ warning(
3792
+ !isStaticallyDefined,
3793
+ `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.`
3794
+ );
3795
+ } else {
3796
+ routeUpdates[lazyRouteProperty] = lazyValue;
3797
+ }
3798
+ }
3799
+ Object.assign(routeToUpdate, routeUpdates);
3800
+ Object.assign(routeToUpdate, {
3801
+ // To keep things framework agnostic, we use the provided `mapRouteProperties`
3802
+ // function to set the framework-aware properties (`element`/`hasErrorBoundary`)
3803
+ // since the logic will differ between frameworks.
3804
+ ...mapRouteProperties2(routeToUpdate),
3805
+ lazy: void 0
3806
+ });
3807
+ });
3808
+ lazyRouteFunctionCache.set(routeToUpdate, lazyRoutePromise);
3809
+ await lazyRoutePromise;
3810
+ return;
3748
3811
  }
3749
- routeToUpdate.unstable_lazyMiddleware = void 0;
3812
+ let lazyKeys = Object.keys(route.lazy);
3813
+ await Promise.all(
3814
+ lazyKeys.map(
3815
+ (key) => loadLazyRouteProperty({
3816
+ key,
3817
+ route,
3818
+ manifest,
3819
+ mapRouteProperties: mapRouteProperties2
3820
+ })
3821
+ )
3822
+ );
3750
3823
  }
3751
- function loadLazyMiddlewareForMatches(matches, manifest) {
3752
- let promises = matches.map(
3753
- (m) => m.route.unstable_lazyMiddleware ? loadLazyMiddleware(m.route, manifest) : void 0
3754
- ).filter(Boolean);
3824
+ function loadLazyMiddlewareForMatches(matches, manifest, mapRouteProperties2) {
3825
+ let promises = matches.map(({ route }) => {
3826
+ if (typeof route.lazy !== "object" || !route.lazy.unstable_middleware) {
3827
+ return void 0;
3828
+ }
3829
+ return loadLazyRouteProperty({
3830
+ key: "unstable_middleware",
3831
+ route,
3832
+ manifest,
3833
+ mapRouteProperties: mapRouteProperties2
3834
+ });
3835
+ }).filter((p) => p != null);
3755
3836
  return promises.length > 0 ? Promise.all(promises) : void 0;
3756
3837
  }
3757
3838
  async function defaultDataStrategy(args) {
@@ -3869,15 +3950,19 @@ async function callRouteMiddleware(args, middlewares, propagateResult, middlewar
3869
3950
  }
3870
3951
  }
3871
3952
  async function callDataStrategyImpl(dataStrategyImpl, type, request, matchesToLoad, matches, fetcherKey, manifest, mapRouteProperties2, scopedContext) {
3872
- let loadMiddlewarePromise = loadLazyMiddlewareForMatches(matches, manifest);
3873
- let loadRouteDefinitionsPromises = matches.map(
3874
- (m) => m.route.lazy ? loadLazyRouteModule(m.route, mapRouteProperties2, manifest) : void 0
3953
+ let loadMiddlewarePromise = loadLazyMiddlewareForMatches(
3954
+ matches,
3955
+ manifest,
3956
+ mapRouteProperties2
3957
+ );
3958
+ let loadLazyRoutePromises = matches.map(
3959
+ (m) => m.route.lazy ? loadLazyRoute(m.route, manifest, mapRouteProperties2) : void 0
3875
3960
  );
3876
3961
  if (loadMiddlewarePromise) {
3877
3962
  await loadMiddlewarePromise;
3878
3963
  }
3879
3964
  let dsMatches = matches.map((match, i) => {
3880
- let loadRoutePromise = loadRouteDefinitionsPromises[i];
3965
+ let loadRoutePromise = loadLazyRoutePromises[i];
3881
3966
  let shouldLoad = matchesToLoad.some((m) => m.route.id === match.route.id);
3882
3967
  let resolve = async (handlerOverride) => {
3883
3968
  if (handlerOverride && request.method === "GET" && (match.route.lazy || match.route.loader)) {
@@ -3906,7 +3991,7 @@ async function callDataStrategyImpl(dataStrategyImpl, type, request, matchesToLo
3906
3991
  context: scopedContext
3907
3992
  });
3908
3993
  try {
3909
- await Promise.all(loadRouteDefinitionsPromises);
3994
+ await Promise.all(loadLazyRoutePromises);
3910
3995
  } catch (e) {
3911
3996
  }
3912
3997
  return results;
@@ -6894,22 +6979,6 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
6894
6979
  dataRoute.loader = (_, singleFetch) => prefetchStylesAndCallHandler(() => {
6895
6980
  return fetchServerLoader(singleFetch);
6896
6981
  });
6897
- } else if (route.clientLoaderModule) {
6898
- dataRoute.loader = async (args, singleFetch) => {
6899
- invariant2(route.clientLoaderModule);
6900
- let { clientLoader } = await import(
6901
- /* @vite-ignore */
6902
- /* webpackIgnore: true */
6903
- route.clientLoaderModule
6904
- );
6905
- return clientLoader({
6906
- ...args,
6907
- async serverLoader() {
6908
- preventInvalidServerHandlerCall("loader", route);
6909
- return fetchServerLoader(singleFetch);
6910
- }
6911
- });
6912
- };
6913
6982
  }
6914
6983
  if (!route.hasClientAction) {
6915
6984
  dataRoute.action = (_, singleFetch) => prefetchStylesAndCallHandler(() => {
@@ -6918,86 +6987,84 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
6918
6987
  }
6919
6988
  return fetchServerAction(singleFetch);
6920
6989
  });
6921
- } else if (route.clientActionModule) {
6922
- dataRoute.action = async (args, singleFetch) => {
6923
- invariant2(route.clientActionModule);
6924
- prefetchRouteModuleChunks(route);
6925
- let { clientAction } = await import(
6926
- /* @vite-ignore */
6927
- /* webpackIgnore: true */
6928
- route.clientActionModule
6990
+ }
6991
+ let lazyRoutePromise;
6992
+ async function getLazyRoute() {
6993
+ if (lazyRoutePromise) {
6994
+ return await lazyRoutePromise;
6995
+ }
6996
+ lazyRoutePromise = (async () => {
6997
+ if (route.clientLoaderModule || route.clientActionModule) {
6998
+ await new Promise((resolve) => setTimeout(resolve, 0));
6999
+ }
7000
+ let routeModulePromise = loadRouteModuleWithBlockingLinks(
7001
+ route,
7002
+ routeModulesCache
6929
7003
  );
6930
- return clientAction({
6931
- ...args,
6932
- async serverAction() {
6933
- preventInvalidServerHandlerCall("action", route);
6934
- return fetchServerAction(singleFetch);
6935
- }
6936
- });
6937
- };
7004
+ prefetchRouteModuleChunks(route);
7005
+ return await routeModulePromise;
7006
+ })();
7007
+ return await lazyRoutePromise;
6938
7008
  }
6939
- if (route.hasClientMiddleware) {
6940
- dataRoute.unstable_lazyMiddleware = async () => {
6941
- invariant2(route);
6942
- let clientMiddlewareModule = await import(
7009
+ dataRoute.lazy = {
7010
+ loader: route.hasClientLoader ? async () => {
7011
+ let { clientLoader } = route.clientLoaderModule ? await import(
6943
7012
  /* @vite-ignore */
6944
7013
  /* webpackIgnore: true */
6945
- route.clientMiddlewareModule || route.module
6946
- );
6947
- invariant2(
6948
- clientMiddlewareModule?.unstable_clientMiddleware,
6949
- "No `unstable_clientMiddleware` export in chunk"
6950
- );
6951
- return clientMiddlewareModule.unstable_clientMiddleware;
6952
- };
6953
- }
6954
- dataRoute.lazy = async () => {
6955
- if (route.clientLoaderModule || route.clientActionModule) {
6956
- await new Promise((resolve) => setTimeout(resolve, 0));
6957
- }
6958
- let modPromise = loadRouteModuleWithBlockingLinks(
6959
- route,
6960
- routeModulesCache
6961
- );
6962
- prefetchRouteModuleChunks(route);
6963
- let mod = await modPromise;
6964
- let lazyRoute = { ...mod };
6965
- if (mod.clientLoader) {
6966
- let clientLoader = mod.clientLoader;
6967
- lazyRoute.loader = (args, singleFetch) => clientLoader({
7014
+ route.clientLoaderModule
7015
+ ) : await getLazyRoute();
7016
+ invariant2(clientLoader, "No `clientLoader` export found");
7017
+ return (args, singleFetch) => clientLoader({
6968
7018
  ...args,
6969
7019
  async serverLoader() {
6970
7020
  preventInvalidServerHandlerCall("loader", route);
6971
7021
  return fetchServerLoader(singleFetch);
6972
7022
  }
6973
7023
  });
6974
- }
6975
- if (mod.clientAction) {
6976
- let clientAction = mod.clientAction;
6977
- lazyRoute.action = (args, singleFetch) => clientAction({
7024
+ } : void 0,
7025
+ action: route.hasClientAction ? async () => {
7026
+ let clientActionPromise = route.clientActionModule ? import(
7027
+ /* @vite-ignore */
7028
+ /* webpackIgnore: true */
7029
+ route.clientActionModule
7030
+ ) : getLazyRoute();
7031
+ prefetchRouteModuleChunks(route);
7032
+ let { clientAction } = await clientActionPromise;
7033
+ invariant2(clientAction, "No `clientAction` export found");
7034
+ return (args, singleFetch) => clientAction({
6978
7035
  ...args,
6979
7036
  async serverAction() {
6980
7037
  preventInvalidServerHandlerCall("action", route);
6981
7038
  return fetchServerAction(singleFetch);
6982
7039
  }
6983
7040
  });
6984
- }
6985
- return {
6986
- ...lazyRoute.loader ? { loader: lazyRoute.loader } : {},
6987
- ...lazyRoute.action ? { action: lazyRoute.action } : {},
6988
- hasErrorBoundary: lazyRoute.hasErrorBoundary,
6989
- shouldRevalidate: getShouldRevalidateFunction(
7041
+ } : void 0,
7042
+ unstable_middleware: route.hasClientMiddleware ? async () => {
7043
+ let { unstable_clientMiddleware } = route.clientMiddlewareModule ? await import(
7044
+ /* @vite-ignore */
7045
+ /* webpackIgnore: true */
7046
+ route.clientMiddlewareModule
7047
+ ) : await getLazyRoute();
7048
+ invariant2(
7049
+ unstable_clientMiddleware,
7050
+ "No `unstable_clientMiddleware` export found"
7051
+ );
7052
+ return unstable_clientMiddleware;
7053
+ } : void 0,
7054
+ shouldRevalidate: async () => {
7055
+ let lazyRoute = await getLazyRoute();
7056
+ return getShouldRevalidateFunction(
6990
7057
  lazyRoute,
6991
7058
  route,
6992
7059
  ssr,
6993
7060
  needsRevalidation
6994
- ),
6995
- handle: lazyRoute.handle,
6996
- // No need to wrap these in layout since the root route is never
6997
- // loaded via route.lazy()
6998
- Component: lazyRoute.Component,
6999
- ErrorBoundary: lazyRoute.ErrorBoundary
7000
- };
7061
+ );
7062
+ },
7063
+ handle: async () => (await getLazyRoute()).handle,
7064
+ // No need to wrap these in layout since the root route is never
7065
+ // loaded via route.lazy()
7066
+ Component: async () => (await getLazyRoute()).Component,
7067
+ ErrorBoundary: route.hasErrorBoundary ? async () => (await getLazyRoute()).ErrorBoundary : void 0
7001
7068
  };
7002
7069
  }
7003
7070
  let children = createClientRoutes(
@@ -7085,7 +7152,7 @@ var URL_LIMIT = 7680;
7085
7152
  function isFogOfWarEnabled(ssr) {
7086
7153
  return ssr === true;
7087
7154
  }
7088
- function getPartialManifest(manifest, router) {
7155
+ function getPartialManifest({ sri, ...manifest }, router) {
7089
7156
  let routeIds = new Set(router.state.matches.map((m) => m.route.id));
7090
7157
  let segments = router.state.location.pathname.split("/").filter(Boolean);
7091
7158
  let paths = ["/"];
@@ -7106,7 +7173,8 @@ function getPartialManifest(manifest, router) {
7106
7173
  );
7107
7174
  return {
7108
7175
  ...manifest,
7109
- routes: initialRoutes
7176
+ routes: initialRoutes,
7177
+ sri: sri ? true : void 0
7110
7178
  };
7111
7179
  }
7112
7180
  function getPatchRoutesOnNavigationFunction(manifest, routeModules, ssr, isSpaMode, basename) {
@@ -7686,32 +7754,53 @@ import(${JSON.stringify(manifest.entry.module)});`;
7686
7754
  }
7687
7755
  ));
7688
7756
  }, []);
7689
- let preloads = isHydrated ? [] : manifest.entry.imports.concat(
7690
- getModuleLinkHrefs(matches, manifest, {
7691
- includeHydrateFallback: true
7692
- })
7757
+ let preloads = isHydrated ? [] : dedupe(
7758
+ manifest.entry.imports.concat(
7759
+ getModuleLinkHrefs(matches, manifest, {
7760
+ includeHydrateFallback: true
7761
+ })
7762
+ )
7693
7763
  );
7694
- return isHydrated ? null : /* @__PURE__ */ React9.createElement(React9.Fragment, null, !enableFogOfWar ? /* @__PURE__ */ React9.createElement(
7764
+ let sri = typeof manifest.sri === "object" ? manifest.sri : {};
7765
+ return isHydrated ? null : /* @__PURE__ */ React9.createElement(React9.Fragment, null, typeof manifest.sri === "object" ? /* @__PURE__ */ React9.createElement(
7766
+ "script",
7767
+ {
7768
+ "rr-importmap": "",
7769
+ type: "importmap",
7770
+ suppressHydrationWarning: true,
7771
+ dangerouslySetInnerHTML: {
7772
+ __html: JSON.stringify({
7773
+ integrity: sri
7774
+ })
7775
+ }
7776
+ }
7777
+ ) : null, !enableFogOfWar ? /* @__PURE__ */ React9.createElement(
7695
7778
  "link",
7696
7779
  {
7697
7780
  rel: "modulepreload",
7698
7781
  href: manifest.url,
7699
- crossOrigin: props.crossOrigin
7782
+ crossOrigin: props.crossOrigin,
7783
+ integrity: sri[manifest.url],
7784
+ suppressHydrationWarning: true
7700
7785
  }
7701
7786
  ) : null, /* @__PURE__ */ React9.createElement(
7702
7787
  "link",
7703
7788
  {
7704
7789
  rel: "modulepreload",
7705
7790
  href: manifest.entry.module,
7706
- crossOrigin: props.crossOrigin
7791
+ crossOrigin: props.crossOrigin,
7792
+ integrity: sri[manifest.entry.module],
7793
+ suppressHydrationWarning: true
7707
7794
  }
7708
- ), dedupe(preloads).map((path) => /* @__PURE__ */ React9.createElement(
7795
+ ), preloads.map((path) => /* @__PURE__ */ React9.createElement(
7709
7796
  "link",
7710
7797
  {
7711
7798
  key: path,
7712
7799
  rel: "modulepreload",
7713
7800
  href: path,
7714
- crossOrigin: props.crossOrigin
7801
+ crossOrigin: props.crossOrigin,
7802
+ integrity: sri[path],
7803
+ suppressHydrationWarning: true
7715
7804
  }
7716
7805
  )), initialScripts);
7717
7806
  }
@@ -7734,7 +7823,7 @@ function mergeRefs(...refs) {
7734
7823
  var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
7735
7824
  try {
7736
7825
  if (isBrowser) {
7737
- window.__reactRouterVersion = "7.4.1";
7826
+ window.__reactRouterVersion = "7.5.0-pre.0";
7738
7827
  }
7739
7828
  } catch (e) {
7740
7829
  }
@@ -8889,6 +8978,7 @@ function createRoutesStub(routes, unstable_getContext) {
8889
8978
  if (routerRef.current == null) {
8890
8979
  remixContextRef.current = {
8891
8980
  future: {
8981
+ unstable_subResourceIntegrity: future?.unstable_subResourceIntegrity === true,
8892
8982
  unstable_middleware: future?.unstable_middleware === true
8893
8983
  },
8894
8984
  manifest: {
@@ -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
  *
@@ -123,7 +123,7 @@ import {
123
123
  useSearchParams,
124
124
  useSubmit,
125
125
  useViewTransitionState
126
- } from "./chunk-T6D7EGPT.mjs";
126
+ } from "./chunk-RSOGH2WR.mjs";
127
127
  export {
128
128
  Await,
129
129
  BrowserRouter,
@@ -1,4 +1,4 @@
1
- import { aE as LinkDescriptor, aB as MetaDescriptor, aT as ServerDataFrom, aU as ClientDataFrom, aV as Func, aW as unstable_MiddlewareNextFunction, E as Equal, u as unstable_RouterContextProvider, aX as Pretty } from '../../route-data-BL8ToWby.mjs';
1
+ import { aE as LinkDescriptor, aB as MetaDescriptor, aT as ServerDataFrom, aU as ClientDataFrom, aV as Func, aW as unstable_MiddlewareNextFunction, E as Equal, u as unstable_RouterContextProvider, aX as Pretty } from '../../route-data-5OzAzQtT.mjs';
2
2
  import { M as MiddlewareEnabled, A as AppLoadContext } from '../../future-ldDp5FKH.mjs';
3
3
  import 'react';
4
4
 
@@ -1,4 +1,4 @@
1
- import { aE as LinkDescriptor, aB as MetaDescriptor, aT as ServerDataFrom, aU as ClientDataFrom, aV as Func, aW as unstable_MiddlewareNextFunction, E as Equal, u as unstable_RouterContextProvider, aX as Pretty } from '../../route-data-BL8ToWby.js';
1
+ import { aE as LinkDescriptor, aB as MetaDescriptor, aT as ServerDataFrom, aU as ClientDataFrom, aV as Func, aW as unstable_MiddlewareNextFunction, E as Equal, u as unstable_RouterContextProvider, aX as Pretty } from '../../route-data-5OzAzQtT.js';
2
2
  import { M as MiddlewareEnabled, A as AppLoadContext } from '../../future-ldDp5FKH.js';
3
3
  import 'react';
4
4
 
@@ -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
  *
@@ -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
  *