react-router 7.4.1 → 7.5.0-pre.1
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.
- package/CHANGELOG.md +46 -0
- package/dist/development/{chunk-XJI4KG32.mjs → chunk-5BSZVSUP.mjs} +293 -162
- package/dist/development/dom-export.d.mts +2 -2
- package/dist/development/dom-export.d.ts +2 -2
- package/dist/development/dom-export.js +295 -157
- package/dist/development/dom-export.mjs +14 -2
- package/dist/development/{fog-of-war-BjgPfDmv.d.mts → fog-of-war-1hWhK5ey.d.mts} +3 -1
- package/dist/{production/fog-of-war-BaM-ohjc.d.ts → development/fog-of-war-oa9CGk10.d.ts} +3 -1
- package/dist/development/index.d.mts +4 -4
- package/dist/development/index.d.ts +4 -4
- package/dist/development/index.js +293 -162
- package/dist/development/index.mjs +2 -2
- package/dist/development/lib/types/route-module.d.mts +1 -1
- package/dist/development/lib/types/route-module.d.ts +1 -1
- package/dist/development/lib/types/route-module.js +1 -1
- package/dist/development/lib/types/route-module.mjs +1 -1
- package/dist/development/{route-data-BL8ToWby.d.ts → route-data-5OzAzQtT.d.mts} +19 -14
- package/dist/{production/route-data-BL8ToWby.d.mts → development/route-data-5OzAzQtT.d.ts} +19 -14
- package/dist/production/{chunk-T6D7EGPT.mjs → chunk-AISJZE44.mjs} +293 -162
- package/dist/production/dom-export.d.mts +2 -2
- package/dist/production/dom-export.d.ts +2 -2
- package/dist/production/dom-export.js +295 -157
- package/dist/production/dom-export.mjs +14 -2
- package/dist/production/{fog-of-war-BjgPfDmv.d.mts → fog-of-war-1hWhK5ey.d.mts} +3 -1
- package/dist/{development/fog-of-war-BaM-ohjc.d.ts → production/fog-of-war-oa9CGk10.d.ts} +3 -1
- package/dist/production/index.d.mts +4 -4
- package/dist/production/index.d.ts +4 -4
- package/dist/production/index.js +293 -162
- package/dist/production/index.mjs +2 -2
- package/dist/production/lib/types/route-module.d.mts +1 -1
- package/dist/production/lib/types/route-module.d.ts +1 -1
- package/dist/production/lib/types/route-module.js +1 -1
- package/dist/production/lib/types/route-module.mjs +1 -1
- package/dist/production/{route-data-BL8ToWby.d.ts → route-data-5OzAzQtT.d.mts} +19 -14
- package/dist/{development/route-data-BL8ToWby.d.mts → production/route-data-5OzAzQtT.d.ts} +19 -14
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v7.
|
|
2
|
+
* react-router v7.5.0-pre.1
|
|
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.
|
|
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(
|
|
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.
|
|
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,166 @@ function isSameRoute(newRoute, existingRoute) {
|
|
|
3679
3700
|
(aChild, i) => existingRoute.children?.some((bChild) => isSameRoute(aChild, bChild))
|
|
3680
3701
|
);
|
|
3681
3702
|
}
|
|
3682
|
-
var
|
|
3683
|
-
|
|
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 (!
|
|
3712
|
+
if (!routeToUpdate.lazy || typeof routeToUpdate.lazy !== "object") {
|
|
3687
3713
|
return;
|
|
3688
3714
|
}
|
|
3689
|
-
let
|
|
3690
|
-
if (
|
|
3691
|
-
await cachedPromise;
|
|
3715
|
+
let lazyFn = routeToUpdate.lazy[key];
|
|
3716
|
+
if (!lazyFn) {
|
|
3692
3717
|
return;
|
|
3693
3718
|
}
|
|
3694
|
-
let
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
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
|
-
!
|
|
3703
|
-
|
|
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
|
-
|
|
3707
|
-
|
|
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
|
-
|
|
3712
|
-
|
|
3713
|
-
)
|
|
3714
|
-
|
|
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
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
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
|
+
function loadLazyRoute(route, type, manifest, mapRouteProperties2) {
|
|
3733
3762
|
let routeToUpdate = manifest[route.id];
|
|
3734
3763
|
invariant(routeToUpdate, "No route found in manifest");
|
|
3735
|
-
if (
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
}
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3764
|
+
if (!route.lazy) {
|
|
3765
|
+
return {
|
|
3766
|
+
lazyRoutePromise: void 0,
|
|
3767
|
+
lazyHandlerPromise: void 0
|
|
3768
|
+
};
|
|
3769
|
+
}
|
|
3770
|
+
if (typeof route.lazy === "function") {
|
|
3771
|
+
let cachedPromise = lazyRouteFunctionCache.get(routeToUpdate);
|
|
3772
|
+
if (cachedPromise) {
|
|
3773
|
+
return {
|
|
3774
|
+
lazyRoutePromise: cachedPromise,
|
|
3775
|
+
lazyHandlerPromise: cachedPromise
|
|
3776
|
+
};
|
|
3744
3777
|
}
|
|
3745
|
-
|
|
3746
|
-
|
|
3778
|
+
let lazyRoutePromise2 = (async () => {
|
|
3779
|
+
invariant(
|
|
3780
|
+
typeof route.lazy === "function",
|
|
3781
|
+
"No lazy route function found"
|
|
3782
|
+
);
|
|
3783
|
+
let lazyRoute = await route.lazy();
|
|
3784
|
+
let routeUpdates = {};
|
|
3785
|
+
for (let lazyRouteProperty in lazyRoute) {
|
|
3786
|
+
let lazyValue = lazyRoute[lazyRouteProperty];
|
|
3787
|
+
if (lazyValue === void 0) {
|
|
3788
|
+
continue;
|
|
3789
|
+
}
|
|
3790
|
+
let isUnsupported = isUnsupportedLazyRouteFunctionKey(lazyRouteProperty);
|
|
3791
|
+
let staticRouteValue = routeToUpdate[lazyRouteProperty];
|
|
3792
|
+
let isStaticallyDefined = staticRouteValue !== void 0 && // This property isn't static since it should always be updated based
|
|
3793
|
+
// on the route updates
|
|
3794
|
+
lazyRouteProperty !== "hasErrorBoundary";
|
|
3795
|
+
if (isUnsupported) {
|
|
3796
|
+
warning(
|
|
3797
|
+
!isUnsupported,
|
|
3798
|
+
"Route property " + lazyRouteProperty + " is not a supported property to be returned from a lazy route function. This property will be ignored."
|
|
3799
|
+
);
|
|
3800
|
+
} else if (isStaticallyDefined) {
|
|
3801
|
+
warning(
|
|
3802
|
+
!isStaticallyDefined,
|
|
3803
|
+
`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.`
|
|
3804
|
+
);
|
|
3805
|
+
} else {
|
|
3806
|
+
routeUpdates[lazyRouteProperty] = lazyValue;
|
|
3807
|
+
}
|
|
3808
|
+
}
|
|
3809
|
+
Object.assign(routeToUpdate, routeUpdates);
|
|
3810
|
+
Object.assign(routeToUpdate, {
|
|
3811
|
+
// To keep things framework agnostic, we use the provided `mapRouteProperties`
|
|
3812
|
+
// function to set the framework-aware properties (`element`/`hasErrorBoundary`)
|
|
3813
|
+
// since the logic will differ between frameworks.
|
|
3814
|
+
...mapRouteProperties2(routeToUpdate),
|
|
3815
|
+
lazy: void 0
|
|
3816
|
+
});
|
|
3817
|
+
})();
|
|
3818
|
+
lazyRouteFunctionCache.set(routeToUpdate, lazyRoutePromise2);
|
|
3819
|
+
return {
|
|
3820
|
+
lazyRoutePromise: lazyRoutePromise2,
|
|
3821
|
+
lazyHandlerPromise: lazyRoutePromise2
|
|
3822
|
+
};
|
|
3823
|
+
}
|
|
3824
|
+
let lazyKeys = Object.keys(route.lazy);
|
|
3825
|
+
let lazyPropertyPromises = [];
|
|
3826
|
+
let lazyHandlerPromise = void 0;
|
|
3827
|
+
for (let key of lazyKeys) {
|
|
3828
|
+
let promise = loadLazyRouteProperty({
|
|
3829
|
+
key,
|
|
3830
|
+
route,
|
|
3831
|
+
manifest,
|
|
3832
|
+
mapRouteProperties: mapRouteProperties2
|
|
3833
|
+
});
|
|
3834
|
+
if (promise) {
|
|
3835
|
+
lazyPropertyPromises.push(promise);
|
|
3836
|
+
if (key === type) {
|
|
3837
|
+
lazyHandlerPromise = promise;
|
|
3838
|
+
}
|
|
3747
3839
|
}
|
|
3748
3840
|
}
|
|
3749
|
-
|
|
3841
|
+
let lazyRoutePromise = Promise.all(lazyPropertyPromises).then(() => {
|
|
3842
|
+
});
|
|
3843
|
+
return {
|
|
3844
|
+
lazyRoutePromise,
|
|
3845
|
+
lazyHandlerPromise
|
|
3846
|
+
};
|
|
3750
3847
|
}
|
|
3751
|
-
function
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3848
|
+
function isNonNullable(value) {
|
|
3849
|
+
return value !== void 0;
|
|
3850
|
+
}
|
|
3851
|
+
function loadLazyMiddlewareForMatches(matches, manifest, mapRouteProperties2) {
|
|
3852
|
+
let promises = matches.map(({ route }) => {
|
|
3853
|
+
if (typeof route.lazy !== "object" || !route.lazy.unstable_middleware) {
|
|
3854
|
+
return void 0;
|
|
3855
|
+
}
|
|
3856
|
+
return loadLazyRouteProperty({
|
|
3857
|
+
key: "unstable_middleware",
|
|
3858
|
+
route,
|
|
3859
|
+
manifest,
|
|
3860
|
+
mapRouteProperties: mapRouteProperties2
|
|
3861
|
+
});
|
|
3862
|
+
}).filter(isNonNullable);
|
|
3755
3863
|
return promises.length > 0 ? Promise.all(promises) : void 0;
|
|
3756
3864
|
}
|
|
3757
3865
|
async function defaultDataStrategy(args) {
|
|
@@ -3869,28 +3977,33 @@ async function callRouteMiddleware(args, middlewares, propagateResult, middlewar
|
|
|
3869
3977
|
}
|
|
3870
3978
|
}
|
|
3871
3979
|
async function callDataStrategyImpl(dataStrategyImpl, type, request, matchesToLoad, matches, fetcherKey, manifest, mapRouteProperties2, scopedContext) {
|
|
3872
|
-
let loadMiddlewarePromise = loadLazyMiddlewareForMatches(
|
|
3873
|
-
|
|
3874
|
-
|
|
3980
|
+
let loadMiddlewarePromise = loadLazyMiddlewareForMatches(
|
|
3981
|
+
matches,
|
|
3982
|
+
manifest,
|
|
3983
|
+
mapRouteProperties2
|
|
3984
|
+
);
|
|
3985
|
+
let lazyRoutePromises = matches.map(
|
|
3986
|
+
(m) => loadLazyRoute(m.route, type, manifest, mapRouteProperties2)
|
|
3875
3987
|
);
|
|
3876
3988
|
if (loadMiddlewarePromise) {
|
|
3877
3989
|
await loadMiddlewarePromise;
|
|
3878
3990
|
}
|
|
3879
3991
|
let dsMatches = matches.map((match, i) => {
|
|
3880
|
-
let
|
|
3992
|
+
let { lazyRoutePromise, lazyHandlerPromise } = lazyRoutePromises[i];
|
|
3881
3993
|
let shouldLoad = matchesToLoad.some((m) => m.route.id === match.route.id);
|
|
3882
3994
|
let resolve = async (handlerOverride) => {
|
|
3883
3995
|
if (handlerOverride && request.method === "GET" && (match.route.lazy || match.route.loader)) {
|
|
3884
3996
|
shouldLoad = true;
|
|
3885
3997
|
}
|
|
3886
|
-
return shouldLoad ? callLoaderOrAction(
|
|
3998
|
+
return shouldLoad ? callLoaderOrAction({
|
|
3887
3999
|
type,
|
|
3888
4000
|
request,
|
|
3889
4001
|
match,
|
|
3890
|
-
|
|
4002
|
+
lazyHandlerPromise,
|
|
4003
|
+
lazyRoutePromise,
|
|
3891
4004
|
handlerOverride,
|
|
3892
4005
|
scopedContext
|
|
3893
|
-
) : Promise.resolve({ type: "data" /* data */, result: void 0 });
|
|
4006
|
+
}) : Promise.resolve({ type: "data" /* data */, result: void 0 });
|
|
3894
4007
|
};
|
|
3895
4008
|
return {
|
|
3896
4009
|
...match,
|
|
@@ -3905,13 +4018,24 @@ async function callDataStrategyImpl(dataStrategyImpl, type, request, matchesToLo
|
|
|
3905
4018
|
fetcherKey,
|
|
3906
4019
|
context: scopedContext
|
|
3907
4020
|
});
|
|
4021
|
+
let allLazyRoutePromises = lazyRoutePromises.flatMap(
|
|
4022
|
+
(promiseMap) => Object.values(promiseMap).filter(isNonNullable)
|
|
4023
|
+
);
|
|
3908
4024
|
try {
|
|
3909
|
-
await Promise.all(
|
|
4025
|
+
await Promise.all(allLazyRoutePromises);
|
|
3910
4026
|
} catch (e) {
|
|
3911
4027
|
}
|
|
3912
4028
|
return results;
|
|
3913
4029
|
}
|
|
3914
|
-
async function callLoaderOrAction(
|
|
4030
|
+
async function callLoaderOrAction({
|
|
4031
|
+
type,
|
|
4032
|
+
request,
|
|
4033
|
+
match,
|
|
4034
|
+
lazyHandlerPromise,
|
|
4035
|
+
lazyRoutePromise,
|
|
4036
|
+
handlerOverride,
|
|
4037
|
+
scopedContext
|
|
4038
|
+
}) {
|
|
3915
4039
|
let result;
|
|
3916
4040
|
let onReject;
|
|
3917
4041
|
let runHandler = (handler) => {
|
|
@@ -3948,7 +4072,7 @@ async function callLoaderOrAction(type, request, match, loadRoutePromise, handle
|
|
|
3948
4072
|
};
|
|
3949
4073
|
try {
|
|
3950
4074
|
let handler = match.route[type];
|
|
3951
|
-
if (
|
|
4075
|
+
if (lazyHandlerPromise || lazyRoutePromise) {
|
|
3952
4076
|
if (handler) {
|
|
3953
4077
|
let handlerError;
|
|
3954
4078
|
let [value] = await Promise.all([
|
|
@@ -3958,17 +4082,19 @@ async function callLoaderOrAction(type, request, match, loadRoutePromise, handle
|
|
|
3958
4082
|
runHandler(handler).catch((e) => {
|
|
3959
4083
|
handlerError = e;
|
|
3960
4084
|
}),
|
|
3961
|
-
|
|
4085
|
+
// Ensure all lazy route promises are resolved before continuing
|
|
4086
|
+
lazyHandlerPromise,
|
|
4087
|
+
lazyRoutePromise
|
|
3962
4088
|
]);
|
|
3963
4089
|
if (handlerError !== void 0) {
|
|
3964
4090
|
throw handlerError;
|
|
3965
4091
|
}
|
|
3966
4092
|
result = value;
|
|
3967
4093
|
} else {
|
|
3968
|
-
await
|
|
4094
|
+
await lazyHandlerPromise;
|
|
3969
4095
|
handler = match.route[type];
|
|
3970
4096
|
if (handler) {
|
|
3971
|
-
result = await runHandler(handler);
|
|
4097
|
+
[result] = await Promise.all([runHandler(handler), lazyRoutePromise]);
|
|
3972
4098
|
} else if (type === "action") {
|
|
3973
4099
|
let url = new URL(request.url);
|
|
3974
4100
|
let pathname = url.pathname + url.search;
|
|
@@ -6894,22 +7020,6 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
|
|
|
6894
7020
|
dataRoute.loader = (_, singleFetch) => prefetchStylesAndCallHandler(() => {
|
|
6895
7021
|
return fetchServerLoader(singleFetch);
|
|
6896
7022
|
});
|
|
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
7023
|
}
|
|
6914
7024
|
if (!route.hasClientAction) {
|
|
6915
7025
|
dataRoute.action = (_, singleFetch) => prefetchStylesAndCallHandler(() => {
|
|
@@ -6918,86 +7028,84 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
|
|
|
6918
7028
|
}
|
|
6919
7029
|
return fetchServerAction(singleFetch);
|
|
6920
7030
|
});
|
|
6921
|
-
}
|
|
6922
|
-
|
|
6923
|
-
|
|
6924
|
-
|
|
6925
|
-
|
|
6926
|
-
|
|
6927
|
-
|
|
6928
|
-
|
|
7031
|
+
}
|
|
7032
|
+
let lazyRoutePromise;
|
|
7033
|
+
async function getLazyRoute() {
|
|
7034
|
+
if (lazyRoutePromise) {
|
|
7035
|
+
return await lazyRoutePromise;
|
|
7036
|
+
}
|
|
7037
|
+
lazyRoutePromise = (async () => {
|
|
7038
|
+
if (route.clientLoaderModule || route.clientActionModule) {
|
|
7039
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
7040
|
+
}
|
|
7041
|
+
let routeModulePromise = loadRouteModuleWithBlockingLinks(
|
|
7042
|
+
route,
|
|
7043
|
+
routeModulesCache
|
|
6929
7044
|
);
|
|
6930
|
-
|
|
6931
|
-
|
|
6932
|
-
|
|
6933
|
-
|
|
6934
|
-
return fetchServerAction(singleFetch);
|
|
6935
|
-
}
|
|
6936
|
-
});
|
|
6937
|
-
};
|
|
7045
|
+
prefetchRouteModuleChunks(route);
|
|
7046
|
+
return await routeModulePromise;
|
|
7047
|
+
})();
|
|
7048
|
+
return await lazyRoutePromise;
|
|
6938
7049
|
}
|
|
6939
|
-
|
|
6940
|
-
|
|
6941
|
-
|
|
6942
|
-
let clientMiddlewareModule = await import(
|
|
7050
|
+
dataRoute.lazy = {
|
|
7051
|
+
loader: route.hasClientLoader ? async () => {
|
|
7052
|
+
let { clientLoader } = route.clientLoaderModule ? await import(
|
|
6943
7053
|
/* @vite-ignore */
|
|
6944
7054
|
/* webpackIgnore: true */
|
|
6945
|
-
route.
|
|
6946
|
-
);
|
|
6947
|
-
invariant2(
|
|
6948
|
-
|
|
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({
|
|
7055
|
+
route.clientLoaderModule
|
|
7056
|
+
) : await getLazyRoute();
|
|
7057
|
+
invariant2(clientLoader, "No `clientLoader` export found");
|
|
7058
|
+
return (args, singleFetch) => clientLoader({
|
|
6968
7059
|
...args,
|
|
6969
7060
|
async serverLoader() {
|
|
6970
7061
|
preventInvalidServerHandlerCall("loader", route);
|
|
6971
7062
|
return fetchServerLoader(singleFetch);
|
|
6972
7063
|
}
|
|
6973
7064
|
});
|
|
6974
|
-
}
|
|
6975
|
-
|
|
6976
|
-
let
|
|
6977
|
-
|
|
7065
|
+
} : void 0,
|
|
7066
|
+
action: route.hasClientAction ? async () => {
|
|
7067
|
+
let clientActionPromise = route.clientActionModule ? import(
|
|
7068
|
+
/* @vite-ignore */
|
|
7069
|
+
/* webpackIgnore: true */
|
|
7070
|
+
route.clientActionModule
|
|
7071
|
+
) : getLazyRoute();
|
|
7072
|
+
prefetchRouteModuleChunks(route);
|
|
7073
|
+
let { clientAction } = await clientActionPromise;
|
|
7074
|
+
invariant2(clientAction, "No `clientAction` export found");
|
|
7075
|
+
return (args, singleFetch) => clientAction({
|
|
6978
7076
|
...args,
|
|
6979
7077
|
async serverAction() {
|
|
6980
7078
|
preventInvalidServerHandlerCall("action", route);
|
|
6981
7079
|
return fetchServerAction(singleFetch);
|
|
6982
7080
|
}
|
|
6983
7081
|
});
|
|
6984
|
-
}
|
|
6985
|
-
|
|
6986
|
-
|
|
6987
|
-
|
|
6988
|
-
|
|
6989
|
-
|
|
7082
|
+
} : void 0,
|
|
7083
|
+
unstable_middleware: route.hasClientMiddleware ? async () => {
|
|
7084
|
+
let { unstable_clientMiddleware } = route.clientMiddlewareModule ? await import(
|
|
7085
|
+
/* @vite-ignore */
|
|
7086
|
+
/* webpackIgnore: true */
|
|
7087
|
+
route.clientMiddlewareModule
|
|
7088
|
+
) : await getLazyRoute();
|
|
7089
|
+
invariant2(
|
|
7090
|
+
unstable_clientMiddleware,
|
|
7091
|
+
"No `unstable_clientMiddleware` export found"
|
|
7092
|
+
);
|
|
7093
|
+
return unstable_clientMiddleware;
|
|
7094
|
+
} : void 0,
|
|
7095
|
+
shouldRevalidate: async () => {
|
|
7096
|
+
let lazyRoute = await getLazyRoute();
|
|
7097
|
+
return getShouldRevalidateFunction(
|
|
6990
7098
|
lazyRoute,
|
|
6991
7099
|
route,
|
|
6992
7100
|
ssr,
|
|
6993
7101
|
needsRevalidation
|
|
6994
|
-
)
|
|
6995
|
-
|
|
6996
|
-
|
|
6997
|
-
|
|
6998
|
-
|
|
6999
|
-
|
|
7000
|
-
|
|
7102
|
+
);
|
|
7103
|
+
},
|
|
7104
|
+
handle: async () => (await getLazyRoute()).handle,
|
|
7105
|
+
// No need to wrap these in layout since the root route is never
|
|
7106
|
+
// loaded via route.lazy()
|
|
7107
|
+
Component: async () => (await getLazyRoute()).Component,
|
|
7108
|
+
ErrorBoundary: route.hasErrorBoundary ? async () => (await getLazyRoute()).ErrorBoundary : void 0
|
|
7001
7109
|
};
|
|
7002
7110
|
}
|
|
7003
7111
|
let children = createClientRoutes(
|
|
@@ -7085,7 +7193,7 @@ var URL_LIMIT = 7680;
|
|
|
7085
7193
|
function isFogOfWarEnabled(ssr) {
|
|
7086
7194
|
return ssr === true;
|
|
7087
7195
|
}
|
|
7088
|
-
function getPartialManifest(manifest, router) {
|
|
7196
|
+
function getPartialManifest({ sri, ...manifest }, router) {
|
|
7089
7197
|
let routeIds = new Set(router.state.matches.map((m) => m.route.id));
|
|
7090
7198
|
let segments = router.state.location.pathname.split("/").filter(Boolean);
|
|
7091
7199
|
let paths = ["/"];
|
|
@@ -7106,7 +7214,8 @@ function getPartialManifest(manifest, router) {
|
|
|
7106
7214
|
);
|
|
7107
7215
|
return {
|
|
7108
7216
|
...manifest,
|
|
7109
|
-
routes: initialRoutes
|
|
7217
|
+
routes: initialRoutes,
|
|
7218
|
+
sri: sri ? true : void 0
|
|
7110
7219
|
};
|
|
7111
7220
|
}
|
|
7112
7221
|
function getPatchRoutesOnNavigationFunction(manifest, routeModules, ssr, isSpaMode, basename) {
|
|
@@ -7686,32 +7795,53 @@ import(${JSON.stringify(manifest.entry.module)});`;
|
|
|
7686
7795
|
}
|
|
7687
7796
|
));
|
|
7688
7797
|
}, []);
|
|
7689
|
-
let preloads = isHydrated ? [] :
|
|
7690
|
-
|
|
7691
|
-
|
|
7692
|
-
|
|
7798
|
+
let preloads = isHydrated ? [] : dedupe(
|
|
7799
|
+
manifest.entry.imports.concat(
|
|
7800
|
+
getModuleLinkHrefs(matches, manifest, {
|
|
7801
|
+
includeHydrateFallback: true
|
|
7802
|
+
})
|
|
7803
|
+
)
|
|
7693
7804
|
);
|
|
7694
|
-
|
|
7805
|
+
let sri = typeof manifest.sri === "object" ? manifest.sri : {};
|
|
7806
|
+
return isHydrated ? null : /* @__PURE__ */ React9.createElement(React9.Fragment, null, typeof manifest.sri === "object" ? /* @__PURE__ */ React9.createElement(
|
|
7807
|
+
"script",
|
|
7808
|
+
{
|
|
7809
|
+
"rr-importmap": "",
|
|
7810
|
+
type: "importmap",
|
|
7811
|
+
suppressHydrationWarning: true,
|
|
7812
|
+
dangerouslySetInnerHTML: {
|
|
7813
|
+
__html: JSON.stringify({
|
|
7814
|
+
integrity: sri
|
|
7815
|
+
})
|
|
7816
|
+
}
|
|
7817
|
+
}
|
|
7818
|
+
) : null, !enableFogOfWar ? /* @__PURE__ */ React9.createElement(
|
|
7695
7819
|
"link",
|
|
7696
7820
|
{
|
|
7697
7821
|
rel: "modulepreload",
|
|
7698
7822
|
href: manifest.url,
|
|
7699
|
-
crossOrigin: props.crossOrigin
|
|
7823
|
+
crossOrigin: props.crossOrigin,
|
|
7824
|
+
integrity: sri[manifest.url],
|
|
7825
|
+
suppressHydrationWarning: true
|
|
7700
7826
|
}
|
|
7701
7827
|
) : null, /* @__PURE__ */ React9.createElement(
|
|
7702
7828
|
"link",
|
|
7703
7829
|
{
|
|
7704
7830
|
rel: "modulepreload",
|
|
7705
7831
|
href: manifest.entry.module,
|
|
7706
|
-
crossOrigin: props.crossOrigin
|
|
7832
|
+
crossOrigin: props.crossOrigin,
|
|
7833
|
+
integrity: sri[manifest.entry.module],
|
|
7834
|
+
suppressHydrationWarning: true
|
|
7707
7835
|
}
|
|
7708
|
-
),
|
|
7836
|
+
), preloads.map((path) => /* @__PURE__ */ React9.createElement(
|
|
7709
7837
|
"link",
|
|
7710
7838
|
{
|
|
7711
7839
|
key: path,
|
|
7712
7840
|
rel: "modulepreload",
|
|
7713
7841
|
href: path,
|
|
7714
|
-
crossOrigin: props.crossOrigin
|
|
7842
|
+
crossOrigin: props.crossOrigin,
|
|
7843
|
+
integrity: sri[path],
|
|
7844
|
+
suppressHydrationWarning: true
|
|
7715
7845
|
}
|
|
7716
7846
|
)), initialScripts);
|
|
7717
7847
|
}
|
|
@@ -7734,7 +7864,7 @@ function mergeRefs(...refs) {
|
|
|
7734
7864
|
var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
7735
7865
|
try {
|
|
7736
7866
|
if (isBrowser) {
|
|
7737
|
-
window.__reactRouterVersion = "7.
|
|
7867
|
+
window.__reactRouterVersion = "7.5.0-pre.1";
|
|
7738
7868
|
}
|
|
7739
7869
|
} catch (e) {
|
|
7740
7870
|
}
|
|
@@ -8889,6 +9019,7 @@ function createRoutesStub(routes, unstable_getContext) {
|
|
|
8889
9019
|
if (routerRef.current == null) {
|
|
8890
9020
|
remixContextRef.current = {
|
|
8891
9021
|
future: {
|
|
9022
|
+
unstable_subResourceIntegrity: future?.unstable_subResourceIntegrity === true,
|
|
8892
9023
|
unstable_middleware: future?.unstable_middleware === true
|
|
8893
9024
|
},
|
|
8894
9025
|
manifest: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v7.
|
|
2
|
+
* react-router v7.5.0-pre.1
|
|
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-
|
|
126
|
+
} from "./chunk-5BSZVSUP.mjs";
|
|
127
127
|
export {
|
|
128
128
|
Await,
|
|
129
129
|
BrowserRouter,
|