react-router 0.0.0-experimental-7ed11be → 0.0.0-experimental-795b50c5b
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 +24 -0
- package/dist/development/{chunk-MUVPFEOF.mjs → chunk-7T5JZQAV.mjs} +47 -59
- package/dist/{production/chunk-W6BB3ISI.js → development/chunk-F3UYON6A.js} +136 -141
- package/dist/development/{chunk-2OYLVAZB.mjs → chunk-KHKNSFUT.mjs} +110 -122
- package/dist/development/{chunk-BELBAVMB.js → chunk-VNH3JIG2.js} +86 -93
- package/dist/development/{context-CRZ6DK7I.d.mts → context-BH6Jwdoy.d.mts} +41 -43
- package/dist/development/dom-export.d.mts +3 -3
- package/dist/development/dom-export.d.ts +2 -2
- package/dist/development/dom-export.js +7 -7
- package/dist/development/dom-export.mjs +7 -7
- package/dist/{production/index-react-server-client-DbUtZHNh.d.mts → development/index-react-server-client-1cWMpKk4.d.mts} +35 -51
- package/dist/{production/index-react-server-client-DM3R9ovf.d.ts → development/index-react-server-client-CMC2eQAY.d.ts} +34 -50
- package/dist/development/index-react-server-client.d.mts +3 -3
- package/dist/development/index-react-server-client.d.ts +2 -2
- package/dist/development/index-react-server-client.js +4 -4
- package/dist/development/index-react-server-client.mjs +4 -4
- package/dist/development/index-react-server.d.mts +197 -48
- package/dist/development/index-react-server.d.ts +197 -48
- package/dist/development/index-react-server.js +81 -43
- package/dist/development/index-react-server.mjs +81 -40
- package/dist/development/index.d.mts +15 -15
- package/dist/development/index.d.ts +13 -13
- package/dist/development/index.js +194 -204
- package/dist/development/index.mjs +9 -7
- package/dist/development/lib/types/internal.d.mts +6 -6
- package/dist/development/lib/types/internal.d.ts +5 -5
- package/dist/development/lib/types/internal.js +1 -1
- package/dist/development/lib/types/internal.mjs +1 -1
- package/dist/development/{route-data-gwXJPIqL.d.mts → route-data-BQkq8Erj.d.mts} +12 -12
- package/dist/development/{routeModules-Dz64j-T-.d.ts → routeModules-DSKAn01V.d.ts} +177 -179
- package/dist/production/{chunk-A4J35SEJ.js → chunk-GBRGDNKH.js} +86 -93
- package/dist/{development/chunk-X5OYM2ET.js → production/chunk-LWO6LYIZ.js} +136 -141
- package/dist/production/{chunk-IC5TORKA.mjs → chunk-RNMWSLFV.mjs} +47 -59
- package/dist/production/{chunk-7A6GBCQS.mjs → chunk-XHECLLLG.mjs} +110 -122
- package/dist/production/{context-CRZ6DK7I.d.mts → context-BH6Jwdoy.d.mts} +41 -43
- package/dist/production/dom-export.d.mts +3 -3
- package/dist/production/dom-export.d.ts +2 -2
- package/dist/production/dom-export.js +7 -7
- package/dist/production/dom-export.mjs +7 -7
- package/dist/{development/index-react-server-client-DbUtZHNh.d.mts → production/index-react-server-client-1cWMpKk4.d.mts} +35 -51
- package/dist/{development/index-react-server-client-DM3R9ovf.d.ts → production/index-react-server-client-CMC2eQAY.d.ts} +34 -50
- package/dist/production/index-react-server-client.d.mts +3 -3
- package/dist/production/index-react-server-client.d.ts +2 -2
- package/dist/production/index-react-server-client.js +4 -4
- package/dist/production/index-react-server-client.mjs +4 -4
- package/dist/production/index-react-server.d.mts +197 -48
- package/dist/production/index-react-server.d.ts +197 -48
- package/dist/production/index-react-server.js +81 -43
- package/dist/production/index-react-server.mjs +81 -40
- package/dist/production/index.d.mts +15 -15
- package/dist/production/index.d.ts +13 -13
- package/dist/production/index.js +194 -204
- package/dist/production/index.mjs +9 -7
- package/dist/production/lib/types/internal.d.mts +6 -6
- package/dist/production/lib/types/internal.d.ts +5 -5
- package/dist/production/lib/types/internal.js +1 -1
- package/dist/production/lib/types/internal.mjs +1 -1
- package/dist/production/{route-data-gwXJPIqL.d.mts → route-data-BQkq8Erj.d.mts} +12 -12
- package/dist/production/{routeModules-Dz64j-T-.d.ts → routeModules-DSKAn01V.d.ts} +177 -179
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# `react-router`
|
|
2
2
|
|
|
3
|
+
## 7.8.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- \[UNSTABLE] Remove Data Mode `future.unstable_middleware` flag from `createBrowserRouter` ([#14213](https://github.com/remix-run/react-router/pull/14213))
|
|
8
|
+
- This is only needed as a Framework Mode flag because of the route modules and the `getLoadContext` type behavior change
|
|
9
|
+
- In Data Mode, it's an opt-in feature because it's just a new property on a route object, so there's no behavior changes that necessitate a flag
|
|
10
|
+
|
|
11
|
+
- \[UNSTABLE] Add `<RouterProvider unstable_onError>`/`<HydratedRouter unstable_onError>` prop for client side error reporting ([#14162](https://github.com/remix-run/react-router/pull/14162))
|
|
12
|
+
|
|
13
|
+
- server action revalidation opt out via $SKIP_REVALIDATION field ([#14154](https://github.com/remix-run/react-router/pull/14154))
|
|
14
|
+
|
|
15
|
+
- Properly escape interpolated param values in `generatePath()` ([#13530](https://github.com/remix-run/react-router/pull/13530))
|
|
16
|
+
|
|
17
|
+
- Maintain `ReadonlyMap` and `ReadonlySet` types in server response data. ([#13092](https://github.com/remix-run/react-router/pull/13092))
|
|
18
|
+
|
|
19
|
+
- \[UNSTABLE] Delay serialization of `.data` redirects to 202 responses until after middleware chain ([#14205](https://github.com/remix-run/react-router/pull/14205))
|
|
20
|
+
|
|
21
|
+
- Fix `TypeError` if you throw from `patchRoutesOnNavigation` when no partial matches exist ([#14198](https://github.com/remix-run/react-router/pull/14198))
|
|
22
|
+
|
|
23
|
+
- Fix `basename` usage without a leading slash in data routers ([#11671](https://github.com/remix-run/react-router/pull/11671))
|
|
24
|
+
|
|
25
|
+
- \[UNSTABLE] Update client middleware so it returns the data strategy results allowing for more advanced post-processing middleware ([#14151](https://github.com/remix-run/react-router/pull/14151))
|
|
26
|
+
|
|
3
27
|
## 7.8.1
|
|
4
28
|
|
|
5
29
|
### Patch Changes
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v0.0.0-experimental-
|
|
2
|
+
* react-router v0.0.0-experimental-795b50c5b
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -362,13 +362,13 @@ function createBrowserURLImpl(to, isAbsolute = false) {
|
|
|
362
362
|
}
|
|
363
363
|
|
|
364
364
|
// lib/router/utils.ts
|
|
365
|
-
function
|
|
365
|
+
function createContext(defaultValue) {
|
|
366
366
|
return { defaultValue };
|
|
367
367
|
}
|
|
368
368
|
var _map;
|
|
369
|
-
var
|
|
369
|
+
var RouterContextProvider = class {
|
|
370
370
|
/**
|
|
371
|
-
* Create a new `
|
|
371
|
+
* Create a new `RouterContextProvider` instance
|
|
372
372
|
* @param init An optional initial context map to populate the provider with
|
|
373
373
|
*/
|
|
374
374
|
constructor(init) {
|
|
@@ -428,7 +428,7 @@ var unsupportedLazyRouteFunctionKeys = /* @__PURE__ */ new Set([
|
|
|
428
428
|
"path",
|
|
429
429
|
"id",
|
|
430
430
|
"index",
|
|
431
|
-
"
|
|
431
|
+
"middleware",
|
|
432
432
|
"children"
|
|
433
433
|
]);
|
|
434
434
|
function isUnsupportedLazyRouteFunctionKey(key) {
|
|
@@ -1009,7 +1009,6 @@ function createRouter(init) {
|
|
|
1009
1009
|
}
|
|
1010
1010
|
let dataStrategyImpl = init.dataStrategy || defaultDataStrategyWithMiddleware;
|
|
1011
1011
|
let future = {
|
|
1012
|
-
unstable_middleware: false,
|
|
1013
1012
|
...init.future
|
|
1014
1013
|
};
|
|
1015
1014
|
let unlistenHistory = null;
|
|
@@ -1467,7 +1466,7 @@ function createRouter(init) {
|
|
|
1467
1466
|
pendingNavigationController.signal,
|
|
1468
1467
|
opts && opts.submission
|
|
1469
1468
|
);
|
|
1470
|
-
let scopedContext = init.
|
|
1469
|
+
let scopedContext = init.getContext ? await init.getContext() : new RouterContextProvider();
|
|
1471
1470
|
let pendingActionResult;
|
|
1472
1471
|
if (opts && opts.pendingError) {
|
|
1473
1472
|
pendingActionResult = [
|
|
@@ -1757,7 +1756,7 @@ function createRouter(init) {
|
|
|
1757
1756
|
pendingActionResult
|
|
1758
1757
|
);
|
|
1759
1758
|
pendingNavigationLoadId = ++incrementingLoadId;
|
|
1760
|
-
if (!init.dataStrategy && !dsMatches.some((m) => m.shouldLoad) && !dsMatches.some((m) => m.route.
|
|
1759
|
+
if (!init.dataStrategy && !dsMatches.some((m) => m.shouldLoad) && !dsMatches.some((m) => m.route.middleware) && revalidatingFetchers.length === 0) {
|
|
1761
1760
|
let updatedFetchers2 = markFetchRedirectsDone();
|
|
1762
1761
|
completeNavigation(
|
|
1763
1762
|
location,
|
|
@@ -1911,7 +1910,7 @@ function createRouter(init) {
|
|
|
1911
1910
|
setFetcherError(key, routeId, error, { flushSync });
|
|
1912
1911
|
return;
|
|
1913
1912
|
}
|
|
1914
|
-
let scopedContext = init.
|
|
1913
|
+
let scopedContext = init.getContext ? await init.getContext() : new RouterContextProvider();
|
|
1915
1914
|
let preventScrollReset = (opts && opts.preventScrollReset) === true;
|
|
1916
1915
|
if (submission && isMutationMethod(submission.formMethod)) {
|
|
1917
1916
|
await handleFetcherAction(
|
|
@@ -2438,10 +2437,6 @@ function createRouter(init) {
|
|
|
2438
2437
|
}
|
|
2439
2438
|
return state.fetchers.get(key) || IDLE_FETCHER;
|
|
2440
2439
|
}
|
|
2441
|
-
function resetFetcher(key, opts) {
|
|
2442
|
-
abortFetcher(key, opts?.reason);
|
|
2443
|
-
updateFetcherState(key, getDoneFetcher(null));
|
|
2444
|
-
}
|
|
2445
2440
|
function deleteFetcher(key) {
|
|
2446
2441
|
let fetcher = state.fetchers.get(key);
|
|
2447
2442
|
if (fetchControllers.has(key) && !(fetcher && fetcher.state === "loading" && fetchReloadIds.has(key))) {
|
|
@@ -2464,10 +2459,10 @@ function createRouter(init) {
|
|
|
2464
2459
|
}
|
|
2465
2460
|
updateState({ fetchers: new Map(state.fetchers) });
|
|
2466
2461
|
}
|
|
2467
|
-
function abortFetcher(key
|
|
2462
|
+
function abortFetcher(key) {
|
|
2468
2463
|
let controller = fetchControllers.get(key);
|
|
2469
2464
|
if (controller) {
|
|
2470
|
-
controller.abort(
|
|
2465
|
+
controller.abort();
|
|
2471
2466
|
fetchControllers.delete(key);
|
|
2472
2467
|
}
|
|
2473
2468
|
}
|
|
@@ -2731,7 +2726,6 @@ function createRouter(init) {
|
|
|
2731
2726
|
createHref: (to) => init.history.createHref(to),
|
|
2732
2727
|
encodeLocation: (to) => init.history.encodeLocation(to),
|
|
2733
2728
|
getFetcher,
|
|
2734
|
-
resetFetcher,
|
|
2735
2729
|
deleteFetcher: queueFetcherForDeletion,
|
|
2736
2730
|
dispose,
|
|
2737
2731
|
getBlocker,
|
|
@@ -2767,13 +2761,13 @@ function createStaticHandler(routes, opts) {
|
|
|
2767
2761
|
skipLoaderErrorBubbling,
|
|
2768
2762
|
skipRevalidation,
|
|
2769
2763
|
dataStrategy,
|
|
2770
|
-
|
|
2764
|
+
generateMiddlewareResponse
|
|
2771
2765
|
} = {}) {
|
|
2772
2766
|
let url = new URL(request.url);
|
|
2773
2767
|
let method = request.method;
|
|
2774
2768
|
let location = createLocation("", createPath(url), null, "default");
|
|
2775
2769
|
let matches = matchRoutes(dataRoutes, location, basename);
|
|
2776
|
-
requestContext = requestContext != null ? requestContext : new
|
|
2770
|
+
requestContext = requestContext != null ? requestContext : new RouterContextProvider();
|
|
2777
2771
|
if (!isValidMethod(method) && method !== "HEAD") {
|
|
2778
2772
|
let error = getInternalRouterError(405, { method });
|
|
2779
2773
|
let { matches: methodNotAllowedMatches, route } = getShortCircuitMatches(dataRoutes);
|
|
@@ -2811,8 +2805,8 @@ function createStaticHandler(routes, opts) {
|
|
|
2811
2805
|
}
|
|
2812
2806
|
if (generateMiddlewareResponse) {
|
|
2813
2807
|
invariant(
|
|
2814
|
-
requestContext instanceof
|
|
2815
|
-
"When using middleware in `staticHandler.query()`, any provided `requestContext` must be an instance of `
|
|
2808
|
+
requestContext instanceof RouterContextProvider,
|
|
2809
|
+
"When using middleware in `staticHandler.query()`, any provided `requestContext` must be an instance of `RouterContextProvider`"
|
|
2816
2810
|
);
|
|
2817
2811
|
try {
|
|
2818
2812
|
await loadLazyMiddlewareForMatches(
|
|
@@ -2832,7 +2826,7 @@ function createStaticHandler(routes, opts) {
|
|
|
2832
2826
|
},
|
|
2833
2827
|
async () => {
|
|
2834
2828
|
let res = await generateMiddlewareResponse(
|
|
2835
|
-
async (revalidationRequest) => {
|
|
2829
|
+
async (revalidationRequest, opts2 = {}) => {
|
|
2836
2830
|
let result2 = await queryImpl(
|
|
2837
2831
|
revalidationRequest,
|
|
2838
2832
|
location,
|
|
@@ -2841,7 +2835,7 @@ function createStaticHandler(routes, opts) {
|
|
|
2841
2835
|
dataStrategy || null,
|
|
2842
2836
|
skipLoaderErrorBubbling === true,
|
|
2843
2837
|
null,
|
|
2844
|
-
filterMatchesToLoad
|
|
2838
|
+
"filterMatchesToLoad" in opts2 ? opts2.filterMatchesToLoad ?? null : null,
|
|
2845
2839
|
skipRevalidation === true
|
|
2846
2840
|
);
|
|
2847
2841
|
if (isResponse(result2)) {
|
|
@@ -2939,13 +2933,13 @@ function createStaticHandler(routes, opts) {
|
|
|
2939
2933
|
routeId,
|
|
2940
2934
|
requestContext,
|
|
2941
2935
|
dataStrategy,
|
|
2942
|
-
|
|
2936
|
+
generateMiddlewareResponse
|
|
2943
2937
|
} = {}) {
|
|
2944
2938
|
let url = new URL(request.url);
|
|
2945
2939
|
let method = request.method;
|
|
2946
2940
|
let location = createLocation("", createPath(url), null, "default");
|
|
2947
2941
|
let matches = matchRoutes(dataRoutes, location, basename);
|
|
2948
|
-
requestContext = requestContext != null ? requestContext : new
|
|
2942
|
+
requestContext = requestContext != null ? requestContext : new RouterContextProvider();
|
|
2949
2943
|
if (!isValidMethod(method) && method !== "HEAD" && method !== "OPTIONS") {
|
|
2950
2944
|
throw getInternalRouterError(405, { method });
|
|
2951
2945
|
} else if (!matches) {
|
|
@@ -2962,8 +2956,8 @@ function createStaticHandler(routes, opts) {
|
|
|
2962
2956
|
}
|
|
2963
2957
|
if (generateMiddlewareResponse) {
|
|
2964
2958
|
invariant(
|
|
2965
|
-
requestContext instanceof
|
|
2966
|
-
"When using middleware in `staticHandler.queryRoute()`, any provided `requestContext` must be an instance of `
|
|
2959
|
+
requestContext instanceof RouterContextProvider,
|
|
2960
|
+
"When using middleware in `staticHandler.queryRoute()`, any provided `requestContext` must be an instance of `RouterContextProvider`"
|
|
2967
2961
|
);
|
|
2968
2962
|
await loadLazyMiddlewareForMatches(matches, manifest, mapRouteProperties2);
|
|
2969
2963
|
let response = await runServerMiddlewarePipeline(
|
|
@@ -3953,11 +3947,11 @@ function isNonNullable(value) {
|
|
|
3953
3947
|
}
|
|
3954
3948
|
function loadLazyMiddlewareForMatches(matches, manifest, mapRouteProperties2) {
|
|
3955
3949
|
let promises = matches.map(({ route }) => {
|
|
3956
|
-
if (typeof route.lazy !== "object" || !route.lazy.
|
|
3950
|
+
if (typeof route.lazy !== "object" || !route.lazy.middleware) {
|
|
3957
3951
|
return void 0;
|
|
3958
3952
|
}
|
|
3959
3953
|
return loadLazyRouteProperty({
|
|
3960
|
-
key: "
|
|
3954
|
+
key: "middleware",
|
|
3961
3955
|
route,
|
|
3962
3956
|
manifest,
|
|
3963
3957
|
mapRouteProperties: mapRouteProperties2
|
|
@@ -3975,7 +3969,7 @@ async function defaultDataStrategy(args) {
|
|
|
3975
3969
|
return keyedResults;
|
|
3976
3970
|
}
|
|
3977
3971
|
async function defaultDataStrategyWithMiddleware(args) {
|
|
3978
|
-
if (!args.matches.some((m) => m.route.
|
|
3972
|
+
if (!args.matches.some((m) => m.route.middleware)) {
|
|
3979
3973
|
return defaultDataStrategy(args);
|
|
3980
3974
|
}
|
|
3981
3975
|
return runClientMiddlewarePipeline(args, () => defaultDataStrategy(args));
|
|
@@ -4029,7 +4023,7 @@ function runClientMiddlewarePipeline(args, handler) {
|
|
|
4029
4023
|
async function runMiddlewarePipeline(args, handler, processResult, isResult, errorHandler) {
|
|
4030
4024
|
let { matches, request, params, context } = args;
|
|
4031
4025
|
let tuples = matches.flatMap(
|
|
4032
|
-
(m) => m.route.
|
|
4026
|
+
(m) => m.route.middleware ? m.route.middleware.map((fn) => [m.route.id, fn]) : []
|
|
4033
4027
|
);
|
|
4034
4028
|
let result = await callRouteMiddleware(
|
|
4035
4029
|
{ request, params, context },
|
|
@@ -4092,7 +4086,7 @@ async function callRouteMiddleware(args, middlewares, handler, processResult, is
|
|
|
4092
4086
|
}
|
|
4093
4087
|
function getDataStrategyMatchLazyPromises(mapRouteProperties2, manifest, request, match, lazyRoutePropertiesToSkip) {
|
|
4094
4088
|
let lazyMiddlewarePromise = loadLazyRouteProperty({
|
|
4095
|
-
key: "
|
|
4089
|
+
key: "middleware",
|
|
4096
4090
|
route: match.route,
|
|
4097
4091
|
manifest,
|
|
4098
4092
|
mapRouteProperties: mapRouteProperties2
|
|
@@ -4192,9 +4186,9 @@ async function callDataStrategyImpl(dataStrategyImpl, request, matches, fetcherK
|
|
|
4192
4186
|
context: scopedContext,
|
|
4193
4187
|
matches
|
|
4194
4188
|
};
|
|
4195
|
-
let
|
|
4189
|
+
let runClientMiddleware = isStaticHandler ? () => {
|
|
4196
4190
|
throw new Error(
|
|
4197
|
-
"You cannot call `
|
|
4191
|
+
"You cannot call `runClientMiddleware()` from a static handler `dataStrategy`. Middleware is run outside of `dataStrategy` during SSR in order to bubble up the Response. You can enable middleware via the `respond` API in `query`/`queryRoute`"
|
|
4198
4192
|
);
|
|
4199
4193
|
} : (cb) => {
|
|
4200
4194
|
let typedDataStrategyArgs = dataStrategyArgs;
|
|
@@ -4202,9 +4196,9 @@ async function callDataStrategyImpl(dataStrategyImpl, request, matches, fetcherK
|
|
|
4202
4196
|
return cb({
|
|
4203
4197
|
...typedDataStrategyArgs,
|
|
4204
4198
|
fetcherKey,
|
|
4205
|
-
|
|
4199
|
+
runClientMiddleware: () => {
|
|
4206
4200
|
throw new Error(
|
|
4207
|
-
"Cannot call `
|
|
4201
|
+
"Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler"
|
|
4208
4202
|
);
|
|
4209
4203
|
}
|
|
4210
4204
|
});
|
|
@@ -4213,7 +4207,7 @@ async function callDataStrategyImpl(dataStrategyImpl, request, matches, fetcherK
|
|
|
4213
4207
|
let results = await dataStrategyImpl({
|
|
4214
4208
|
...dataStrategyArgs,
|
|
4215
4209
|
fetcherKey,
|
|
4216
|
-
|
|
4210
|
+
runClientMiddleware
|
|
4217
4211
|
});
|
|
4218
4212
|
try {
|
|
4219
4213
|
await Promise.all(
|
|
@@ -4932,6 +4926,7 @@ var FetchersContext = React.createContext(
|
|
|
4932
4926
|
FetchersContext.displayName = "Fetchers";
|
|
4933
4927
|
var AwaitContext = React.createContext(null);
|
|
4934
4928
|
AwaitContext.displayName = "Await";
|
|
4929
|
+
var AwaitContextProvider = (props) => React.createElement(AwaitContext.Provider, props);
|
|
4935
4930
|
var NavigationContext = React.createContext(
|
|
4936
4931
|
null
|
|
4937
4932
|
);
|
|
@@ -5599,7 +5594,7 @@ var hydrationRouteProperties = [
|
|
|
5599
5594
|
function createMemoryRouter(routes, opts) {
|
|
5600
5595
|
return createRouter({
|
|
5601
5596
|
basename: opts?.basename,
|
|
5602
|
-
|
|
5597
|
+
getContext: opts?.getContext,
|
|
5603
5598
|
future: opts?.future,
|
|
5604
5599
|
history: createMemoryHistory({
|
|
5605
5600
|
initialEntries: opts?.initialEntries,
|
|
@@ -7103,7 +7098,7 @@ function getTurboStreamSingleFetchDataStrategy(getRouter, manifest, routeModules
|
|
|
7103
7098
|
ssr,
|
|
7104
7099
|
basename
|
|
7105
7100
|
);
|
|
7106
|
-
return async (args) => args.
|
|
7101
|
+
return async (args) => args.runClientMiddleware(dataStrategy);
|
|
7107
7102
|
}
|
|
7108
7103
|
function getSingleFetchDataStrategyImpl(getRouter, getRouteInfo, fetchAndDecode, ssr, basename, shouldAllowOptOut = () => true) {
|
|
7109
7104
|
return async (args) => {
|
|
@@ -7899,7 +7894,7 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
|
|
|
7899
7894
|
Object.assign(dataRoute, {
|
|
7900
7895
|
...dataRoute,
|
|
7901
7896
|
...getRouteComponents(route, routeModule, isSpaMode),
|
|
7902
|
-
|
|
7897
|
+
middleware: routeModule.clientMiddleware,
|
|
7903
7898
|
handle: routeModule.handle,
|
|
7904
7899
|
shouldRevalidate: getShouldRevalidateFunction(
|
|
7905
7900
|
dataRoute.path,
|
|
@@ -8041,17 +8036,14 @@ function createClientRoutes(manifest, routeModulesCache, initialState, ssr, isSp
|
|
|
8041
8036
|
}
|
|
8042
8037
|
});
|
|
8043
8038
|
} : void 0,
|
|
8044
|
-
|
|
8045
|
-
let {
|
|
8039
|
+
middleware: route.hasClientMiddleware ? async () => {
|
|
8040
|
+
let { clientMiddleware } = route.clientMiddlewareModule ? await import(
|
|
8046
8041
|
/* @vite-ignore */
|
|
8047
8042
|
/* webpackIgnore: true */
|
|
8048
8043
|
route.clientMiddlewareModule
|
|
8049
8044
|
) : await getLazyRoute();
|
|
8050
|
-
invariant2(
|
|
8051
|
-
|
|
8052
|
-
"No `unstable_clientMiddleware` export found"
|
|
8053
|
-
);
|
|
8054
|
-
return unstable_clientMiddleware;
|
|
8045
|
+
invariant2(clientMiddleware, "No `clientMiddleware` export found");
|
|
8046
|
+
return clientMiddleware;
|
|
8055
8047
|
} : void 0,
|
|
8056
8048
|
shouldRevalidate: async () => {
|
|
8057
8049
|
let lazyRoute = await getLazyRoute();
|
|
@@ -8132,7 +8124,7 @@ async function loadRouteModuleWithBlockingLinks(route, routeModules) {
|
|
|
8132
8124
|
return {
|
|
8133
8125
|
Component: getRouteModuleComponent(routeModule),
|
|
8134
8126
|
ErrorBoundary: routeModule.ErrorBoundary,
|
|
8135
|
-
|
|
8127
|
+
clientMiddleware: routeModule.clientMiddleware,
|
|
8136
8128
|
clientAction: routeModule.clientAction,
|
|
8137
8129
|
clientLoader: routeModule.clientLoader,
|
|
8138
8130
|
handle: routeModule.handle,
|
|
@@ -8975,14 +8967,14 @@ var isBrowser = typeof window !== "undefined" && typeof window.document !== "und
|
|
|
8975
8967
|
try {
|
|
8976
8968
|
if (isBrowser) {
|
|
8977
8969
|
window.__reactRouterVersion = // @ts-expect-error
|
|
8978
|
-
"0.0.0-experimental-
|
|
8970
|
+
"0.0.0-experimental-795b50c5b";
|
|
8979
8971
|
}
|
|
8980
8972
|
} catch (e) {
|
|
8981
8973
|
}
|
|
8982
8974
|
function createBrowserRouter(routes, opts) {
|
|
8983
8975
|
return createRouter({
|
|
8984
8976
|
basename: opts?.basename,
|
|
8985
|
-
|
|
8977
|
+
getContext: opts?.getContext,
|
|
8986
8978
|
future: opts?.future,
|
|
8987
8979
|
history: createBrowserHistory({ window: opts?.window }),
|
|
8988
8980
|
hydrationData: opts?.hydrationData || parseHydrationData(),
|
|
@@ -8997,7 +8989,7 @@ function createBrowserRouter(routes, opts) {
|
|
|
8997
8989
|
function createHashRouter(routes, opts) {
|
|
8998
8990
|
return createRouter({
|
|
8999
8991
|
basename: opts?.basename,
|
|
9000
|
-
|
|
8992
|
+
getContext: opts?.getContext,
|
|
9001
8993
|
future: opts?.future,
|
|
9002
8994
|
history: createHashHistory({ window: opts?.window }),
|
|
9003
8995
|
hydrationData: opts?.hydrationData || parseHydrationData(),
|
|
@@ -9589,7 +9581,6 @@ function useFetcher({
|
|
|
9589
9581
|
},
|
|
9590
9582
|
[fetcherKey, submitImpl]
|
|
9591
9583
|
);
|
|
9592
|
-
let unstable_reset = React10.useCallback((opts) => router.resetFetcher(fetcherKey, opts), [router, fetcherKey]);
|
|
9593
9584
|
let FetcherForm = React10.useMemo(() => {
|
|
9594
9585
|
let FetcherForm2 = React10.forwardRef(
|
|
9595
9586
|
(props, ref) => {
|
|
@@ -9606,11 +9597,10 @@ function useFetcher({
|
|
|
9606
9597
|
Form: FetcherForm,
|
|
9607
9598
|
submit,
|
|
9608
9599
|
load,
|
|
9609
|
-
unstable_reset,
|
|
9610
9600
|
...fetcher,
|
|
9611
9601
|
data: data2
|
|
9612
9602
|
}),
|
|
9613
|
-
[FetcherForm, submit, load,
|
|
9603
|
+
[FetcherForm, submit, load, fetcher, data2]
|
|
9614
9604
|
);
|
|
9615
9605
|
return fetcherWithComponents;
|
|
9616
9606
|
}
|
|
@@ -9968,7 +9958,7 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
9968
9958
|
},
|
|
9969
9959
|
get future() {
|
|
9970
9960
|
return {
|
|
9971
|
-
|
|
9961
|
+
v8_middleware: false,
|
|
9972
9962
|
...opts?.future
|
|
9973
9963
|
};
|
|
9974
9964
|
},
|
|
@@ -10021,9 +10011,6 @@ function createStaticRouter(routes, context, opts = {}) {
|
|
|
10021
10011
|
deleteFetcher() {
|
|
10022
10012
|
throw msg("deleteFetcher");
|
|
10023
10013
|
},
|
|
10024
|
-
resetFetcher() {
|
|
10025
|
-
throw msg("resetFetcher");
|
|
10026
|
-
},
|
|
10027
10014
|
dispose() {
|
|
10028
10015
|
throw msg("dispose");
|
|
10029
10016
|
},
|
|
@@ -10077,8 +10064,8 @@ export {
|
|
|
10077
10064
|
invariant,
|
|
10078
10065
|
createPath,
|
|
10079
10066
|
parsePath,
|
|
10080
|
-
|
|
10081
|
-
|
|
10067
|
+
createContext,
|
|
10068
|
+
RouterContextProvider,
|
|
10082
10069
|
convertRoutesToDataRoutes,
|
|
10083
10070
|
matchRoutes,
|
|
10084
10071
|
generatePath,
|
|
@@ -10107,6 +10094,7 @@ export {
|
|
|
10107
10094
|
RSCRouterContext,
|
|
10108
10095
|
ViewTransitionContext,
|
|
10109
10096
|
FetchersContext,
|
|
10097
|
+
AwaitContextProvider,
|
|
10110
10098
|
NavigationContext,
|
|
10111
10099
|
LocationContext,
|
|
10112
10100
|
RouteContext,
|