react-router 7.8.0-pre.0 → 7.8.0-pre.2
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 +12 -0
- package/dist/development/{chunk-HSC5IU24.mjs → chunk-3D24XHV2.mjs} +19 -4
- package/dist/development/{chunk-IW6UADHO.js → chunk-74TFO7SN.js} +65 -32
- package/dist/{production/chunk-BCLZG6QW.js → development/chunk-HQ37R3FK.js} +130 -130
- package/dist/development/{chunk-SC4OUYO4.mjs → chunk-WSV33ENW.mjs} +45 -12
- package/dist/development/{components-uUh0svuC.d.mts → components-CuPfnyiZ.d.mts} +1 -1
- package/dist/{production/context-DZWGFcKX.d.mts → development/context-DohQKLID.d.mts} +6 -7
- package/dist/development/dom-export.d.mts +2 -2
- package/dist/development/dom-export.js +3 -3
- package/dist/development/dom-export.mjs +3 -3
- package/dist/{production/index-react-server-client-DSU6bZil.d.ts → development/index-react-server-client-CMphySRb.d.ts} +19 -2
- package/dist/{production/index-react-server-client-BUK-oRcG.d.mts → development/index-react-server-client-DXb0OgpJ.d.mts} +21 -4
- package/dist/development/index-react-server-client.d.mts +4 -4
- 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 +2 -2
- package/dist/development/index-react-server.d.mts +6 -7
- package/dist/development/index-react-server.d.ts +6 -7
- package/dist/development/index-react-server.js +82 -35
- package/dist/development/index-react-server.mjs +82 -35
- package/dist/development/index.d.mts +8 -8
- package/dist/development/index.d.ts +4 -4
- package/dist/development/index.js +117 -102
- package/dist/development/index.mjs +3 -3
- package/dist/development/lib/types/internal.d.mts +2 -2
- package/dist/development/lib/types/internal.d.ts +1 -1
- package/dist/development/lib/types/internal.js +1 -1
- package/dist/development/lib/types/internal.mjs +1 -1
- package/dist/development/{route-data-UTmTa8an.d.mts → route-data-CpB5xtMm.d.mts} +1 -1
- package/dist/development/{routeModules-D5bppTB2.d.ts → routeModules-qBivMBjd.d.ts} +6 -7
- package/dist/production/{chunk-YC2ENCM3.js → chunk-DDK3XFL6.js} +65 -32
- package/dist/{development/chunk-Z4NNCWGU.js → production/chunk-GSF7DANI.js} +130 -130
- package/dist/production/{chunk-X2NPJMV2.mjs → chunk-IEIDJVF4.mjs} +45 -12
- package/dist/production/{chunk-KQ5567DT.mjs → chunk-Q6IGLNPQ.mjs} +19 -4
- package/dist/production/{components-uUh0svuC.d.mts → components-CuPfnyiZ.d.mts} +1 -1
- package/dist/{development/context-DZWGFcKX.d.mts → production/context-DohQKLID.d.mts} +6 -7
- package/dist/production/dom-export.d.mts +2 -2
- package/dist/production/dom-export.js +3 -3
- package/dist/production/dom-export.mjs +3 -3
- package/dist/{development/index-react-server-client-DSU6bZil.d.ts → production/index-react-server-client-CMphySRb.d.ts} +19 -2
- package/dist/{development/index-react-server-client-BUK-oRcG.d.mts → production/index-react-server-client-DXb0OgpJ.d.mts} +21 -4
- package/dist/production/index-react-server-client.d.mts +4 -4
- 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 +2 -2
- package/dist/production/index-react-server.d.mts +6 -7
- package/dist/production/index-react-server.d.ts +6 -7
- package/dist/production/index-react-server.js +82 -35
- package/dist/production/index-react-server.mjs +82 -35
- package/dist/production/index.d.mts +8 -8
- package/dist/production/index.d.ts +4 -4
- package/dist/production/index.js +117 -102
- package/dist/production/index.mjs +3 -3
- package/dist/production/lib/types/internal.d.mts +2 -2
- package/dist/production/lib/types/internal.d.ts +1 -1
- package/dist/production/lib/types/internal.js +1 -1
- package/dist/production/lib/types/internal.mjs +1 -1
- package/dist/production/{route-data-UTmTa8an.d.mts → route-data-CpB5xtMm.d.mts} +1 -1
- package/dist/production/{routeModules-D5bppTB2.d.ts → routeModules-qBivMBjd.d.ts} +6 -7
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v7.8.0-pre.
|
|
2
|
+
* react-router v7.8.0-pre.2
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -2942,6 +2942,9 @@ function createStaticHandler(routes, opts) {
|
|
|
2942
2942
|
return res;
|
|
2943
2943
|
},
|
|
2944
2944
|
(error) => {
|
|
2945
|
+
if (isRouteErrorResponse(error)) {
|
|
2946
|
+
return Promise.resolve(errorResponseToResponse(error));
|
|
2947
|
+
}
|
|
2945
2948
|
if (isResponse(error)) {
|
|
2946
2949
|
return Promise.resolve(error);
|
|
2947
2950
|
}
|
|
@@ -3934,12 +3937,6 @@ async function runServerMiddlewarePipeline(args, handler, errorHandler) {
|
|
|
3934
3937
|
handler,
|
|
3935
3938
|
errorHandler
|
|
3936
3939
|
);
|
|
3937
|
-
if (isDataWithResponseInit(result)) {
|
|
3938
|
-
return new Response(
|
|
3939
|
-
typeof result.data === "string" ? result.data : JSON.stringify(result.data),
|
|
3940
|
-
{ ...result.init }
|
|
3941
|
-
);
|
|
3942
|
-
}
|
|
3943
3940
|
if (isResponse(result)) {
|
|
3944
3941
|
return result;
|
|
3945
3942
|
}
|
|
@@ -3976,10 +3973,17 @@ async function callServerRouteMiddleware(args, middlewares, handler, errorHandle
|
|
|
3976
3973
|
errorHandler,
|
|
3977
3974
|
idx + 1
|
|
3978
3975
|
);
|
|
3976
|
+
if (isDataWithResponseInit(result)) {
|
|
3977
|
+
result = dataWithResponseInitToResponse(result);
|
|
3978
|
+
}
|
|
3979
3979
|
nextResult = result;
|
|
3980
3980
|
return nextResult;
|
|
3981
3981
|
} catch (e) {
|
|
3982
|
-
nextResult = await errorHandler(
|
|
3982
|
+
nextResult = await errorHandler(
|
|
3983
|
+
// Convert thrown data() values to ErrorResponses
|
|
3984
|
+
isDataWithResponseInit(e) ? dataWithResponseInitToErrorResponse(e) : e,
|
|
3985
|
+
routeId
|
|
3986
|
+
);
|
|
3983
3987
|
return nextResult;
|
|
3984
3988
|
}
|
|
3985
3989
|
};
|
|
@@ -3992,16 +3996,23 @@ async function callServerRouteMiddleware(args, middlewares, handler, errorHandle
|
|
|
3992
3996
|
},
|
|
3993
3997
|
next
|
|
3994
3998
|
);
|
|
3999
|
+
if (isDataWithResponseInit(result)) {
|
|
4000
|
+
result = dataWithResponseInitToResponse(result);
|
|
4001
|
+
}
|
|
3995
4002
|
if (nextCalled) {
|
|
3996
4003
|
return typeof result === "undefined" ? nextResult : result;
|
|
3997
|
-
} else if (isResponse(result)
|
|
4004
|
+
} else if (isResponse(result)) {
|
|
3998
4005
|
return result;
|
|
3999
4006
|
} else {
|
|
4000
4007
|
nextResult = await next();
|
|
4001
4008
|
return nextResult;
|
|
4002
4009
|
}
|
|
4003
|
-
} catch (
|
|
4004
|
-
let response = await errorHandler(
|
|
4010
|
+
} catch (e) {
|
|
4011
|
+
let response = await errorHandler(
|
|
4012
|
+
// Convert thrown data() values to ErrorResponses
|
|
4013
|
+
isDataWithResponseInit(e) ? dataWithResponseInitToErrorResponse(e) : e,
|
|
4014
|
+
routeId
|
|
4015
|
+
);
|
|
4005
4016
|
return response;
|
|
4006
4017
|
}
|
|
4007
4018
|
}
|
|
@@ -4663,6 +4674,28 @@ function isHashChangeOnly(a, b) {
|
|
|
4663
4674
|
}
|
|
4664
4675
|
return false;
|
|
4665
4676
|
}
|
|
4677
|
+
function dataWithResponseInitToResponse(data2) {
|
|
4678
|
+
return new Response(
|
|
4679
|
+
typeof data2.data === "string" ? data2.data : JSON.stringify(data2.data),
|
|
4680
|
+
data2.init || void 0
|
|
4681
|
+
);
|
|
4682
|
+
}
|
|
4683
|
+
function dataWithResponseInitToErrorResponse(data2) {
|
|
4684
|
+
return new ErrorResponseImpl(
|
|
4685
|
+
data2.init?.status ?? 500,
|
|
4686
|
+
data2.init?.statusText ?? "Internal Server Error",
|
|
4687
|
+
data2.data
|
|
4688
|
+
);
|
|
4689
|
+
}
|
|
4690
|
+
function errorResponseToResponse(error) {
|
|
4691
|
+
return new Response(
|
|
4692
|
+
typeof error.data === "string" ? error.data : JSON.stringify(error.data),
|
|
4693
|
+
{
|
|
4694
|
+
status: error.status,
|
|
4695
|
+
statusText: error.statusText
|
|
4696
|
+
}
|
|
4697
|
+
);
|
|
4698
|
+
}
|
|
4666
4699
|
function isDataStrategyResult(result) {
|
|
4667
4700
|
return result != null && typeof result === "object" && "type" in result && "result" in result && (result.type === "data" /* data */ || result.type === "error" /* error */);
|
|
4668
4701
|
}
|
|
@@ -8908,7 +8941,7 @@ var isBrowser = typeof window !== "undefined" && typeof window.document !== "und
|
|
|
8908
8941
|
try {
|
|
8909
8942
|
if (isBrowser) {
|
|
8910
8943
|
window.__reactRouterVersion = // @ts-expect-error
|
|
8911
|
-
"7.8.0-pre.
|
|
8944
|
+
"7.8.0-pre.2";
|
|
8912
8945
|
}
|
|
8913
8946
|
} catch (e) {
|
|
8914
8947
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { R as Router$1, I as InitialEntry, T as To, a as RelativeRoutingType, N as NonIndexRouteObject, L as LazyRouteFunction, b as IndexRouteObject, c as Location, A as Action, d as Navigator, e as RouterInit, F as FutureConfig, H as HydrationState, D as DataStrategyFunction, P as PatchRoutesOnNavigationFunction, f as RouteObject, g as RouteMatch, h as Params, U as UIMatch } from './context-
|
|
1
|
+
import { R as Router$1, I as InitialEntry, T as To, a as RelativeRoutingType, N as NonIndexRouteObject, L as LazyRouteFunction, b as IndexRouteObject, c as Location, A as Action, d as Navigator, e as RouterInit, F as FutureConfig, H as HydrationState, D as DataStrategyFunction, P as PatchRoutesOnNavigationFunction, f as RouteObject, g as RouteMatch, h as Params, U as UIMatch } from './context-DohQKLID.mjs';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
|
|
4
4
|
declare function mapRouteProperties(route: RouteObject): Partial<RouteObject> & {
|
|
@@ -280,12 +280,10 @@ interface unstable_RouterContext<T = unknown> {
|
|
|
280
280
|
}
|
|
281
281
|
/**
|
|
282
282
|
* Creates a type-safe {@link unstable_RouterContext} object that can be used to
|
|
283
|
-
*
|
|
284
|
-
*
|
|
285
|
-
*
|
|
286
|
-
*
|
|
287
|
-
*
|
|
288
|
-
* <docs-warning>Enable this API with the `future.unstable_middleware` flag.</docs-warning>
|
|
283
|
+
* store and retrieve arbitrary values in [`action`](../../start/framework/route-module#action)s,
|
|
284
|
+
* [`loader`](../../start/framework/route-module#loader)s, and [middleware](../../how-to/middleware).
|
|
285
|
+
* Similar to React's [`createContext`](https://react.dev/reference/react/createContext),
|
|
286
|
+
* but specifically designed for React Router's request/response lifecycle.
|
|
289
287
|
*
|
|
290
288
|
* If a `defaultValue` is provided, it will be returned from `context.get()`
|
|
291
289
|
* when no value has been set for the context. Otherwise, reading this context
|
|
@@ -352,6 +350,7 @@ declare function unstable_createContext<T>(defaultValue?: T): unstable_RouterCon
|
|
|
352
350
|
* const userContext = unstable_createContext<User | null>(null);
|
|
353
351
|
* const contextProvider = new unstable_RouterContextProvider();
|
|
354
352
|
* contextProvider.set(userContext, getUser());
|
|
353
|
+
* // ^ Type-safe
|
|
355
354
|
* const user = contextProvider.get(userContext);
|
|
356
355
|
* // ^ User
|
|
357
356
|
*
|
|
@@ -422,7 +421,7 @@ interface DataFunctionArgs<Context> {
|
|
|
422
421
|
* middlewares from the bottom-up
|
|
423
422
|
*/
|
|
424
423
|
interface unstable_MiddlewareNextFunction<Result = unknown> {
|
|
425
|
-
():
|
|
424
|
+
(): Promise<Result>;
|
|
426
425
|
}
|
|
427
426
|
/**
|
|
428
427
|
* Route middleware function signature. Receives the same "data" arguments as a
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { R as RouterProviderProps$1 } from './components-
|
|
2
|
+
import { R as RouterProviderProps$1 } from './components-CuPfnyiZ.mjs';
|
|
3
3
|
import './browser-z32v5KVN.mjs';
|
|
4
|
-
import { e as RouterInit } from './context-
|
|
4
|
+
import { e as RouterInit } from './context-DohQKLID.mjs';
|
|
5
5
|
|
|
6
6
|
type RouterProviderProps = Omit<RouterProviderProps$1, "flushSync">;
|
|
7
7
|
declare function RouterProvider(props: Omit<RouterProviderProps, "flushSync">): React.JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }/**
|
|
2
|
-
* react-router v7.8.0-pre.
|
|
2
|
+
* react-router v7.8.0-pre.2
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"use client";
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _chunk74TFO7SNjs = require('./chunk-74TFO7SN.js');
|
|
15
15
|
|
|
16
16
|
// lib/dom-export/dom-router-provider.tsx
|
|
17
17
|
var _react = require('react'); var React = _interopRequireWildcard(_react); var React2 = _interopRequireWildcard(_react);
|
|
@@ -180,7 +180,7 @@ function HydratedRouter(props) {
|
|
|
180
180
|
}, []);
|
|
181
181
|
React2.useEffect(() => {
|
|
182
182
|
if (process.env.NODE_ENV === "development" && criticalCss === void 0) {
|
|
183
|
-
document.querySelectorAll(`[${
|
|
183
|
+
document.querySelectorAll(`[${_chunk74TFO7SNjs.CRITICAL_CSS_DATA_ATTRIBUTE}]`).forEach((element) => element.remove());
|
|
184
184
|
}
|
|
185
185
|
}, [criticalCss]);
|
|
186
186
|
let [location, setLocation] = React2.useState(router.state.location);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v7.8.0-pre.
|
|
2
|
+
* react-router v7.8.0-pre.2
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
import {
|
|
13
13
|
deserializeErrors,
|
|
14
14
|
getHydrationData
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-3D24XHV2.mjs";
|
|
16
16
|
import {
|
|
17
17
|
CRITICAL_CSS_DATA_ATTRIBUTE,
|
|
18
18
|
FrameworkContext,
|
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
invariant,
|
|
30
30
|
mapRouteProperties,
|
|
31
31
|
useFogOFWarDiscovery
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-WSV33ENW.mjs";
|
|
33
33
|
|
|
34
34
|
// lib/dom-export/dom-router-provider.tsx
|
|
35
35
|
import * as React from "react";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { I as InitialEntry, T as To, i as RelativeRoutingType, w as NonIndexRouteObject, af as LazyRouteFunction, q as IndexRouteObject, a as Location, A as Action, aC as Navigator, d as Router$1, Q as RouterInit, aY as FutureConfig$1, H as HydrationState, D as DataStrategyFunction, W as PatchRoutesOnNavigationFunction, p as RouteObject, aE as RouteMatch, o as Params, U as UIMatch, ae as HTMLFormMethod, ac as FormEncType, aZ as RouteManifest, a_ as ServerRouteModule, z as MiddlewareEnabled, y as unstable_RouterContextProvider, x as AppLoadContext, ag as LoaderFunctionArgs, a6 as ActionFunctionArgs, e as RouteModules, X as DataRouteObject, J as ClientLoaderFunction, $ as StaticHandlerContext, aJ as PageLinkDescriptor, a$ as History, _ as GetScrollRestorationKeyFunction, f as NavigateOptions, a0 as Fetcher, h as SerializeFrom, B as BlockerFunction, b0 as CreateStaticHandlerOptions$1, Y as StaticHandler } from './routeModules-
|
|
1
|
+
import { I as InitialEntry, T as To, i as RelativeRoutingType, w as NonIndexRouteObject, af as LazyRouteFunction, q as IndexRouteObject, a as Location, A as Action, aC as Navigator, d as Router$1, Q as RouterInit, aY as FutureConfig$1, H as HydrationState, D as DataStrategyFunction, W as PatchRoutesOnNavigationFunction, p as RouteObject, aE as RouteMatch, o as Params, U as UIMatch, ae as HTMLFormMethod, ac as FormEncType, aZ as RouteManifest, a_ as ServerRouteModule, z as MiddlewareEnabled, y as unstable_RouterContextProvider, x as AppLoadContext, ag as LoaderFunctionArgs, a6 as ActionFunctionArgs, e as RouteModules, X as DataRouteObject, J as ClientLoaderFunction, $ as StaticHandlerContext, aJ as PageLinkDescriptor, a$ as History, _ as GetScrollRestorationKeyFunction, f as NavigateOptions, a0 as Fetcher, h as SerializeFrom, B as BlockerFunction, b0 as CreateStaticHandlerOptions$1, Y as StaticHandler } from './routeModules-qBivMBjd.js';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
|
|
4
4
|
declare function mapRouteProperties(route: RouteObject): Partial<RouteObject> & {
|
|
@@ -1239,6 +1239,23 @@ interface DOMRouterOpts {
|
|
|
1239
1239
|
* [`loader`](../../start/data/route-object#loader)s and [middleware](../../how-to/middleware).
|
|
1240
1240
|
* This function is called to generate a fresh `context` instance on each
|
|
1241
1241
|
* navigation or fetcher call.
|
|
1242
|
+
*
|
|
1243
|
+
* ```tsx
|
|
1244
|
+
* import {
|
|
1245
|
+
* unstable_createContext,
|
|
1246
|
+
* unstable_RouterContextProvider,
|
|
1247
|
+
* } from "react-router";
|
|
1248
|
+
*
|
|
1249
|
+
* const apiClientContext = unstable_createContext<APIClient>();
|
|
1250
|
+
*
|
|
1251
|
+
* function createBrowserRouter(routes, {
|
|
1252
|
+
* unstable_getContext() {
|
|
1253
|
+
* let context = new unstable_RouterContextProvider();
|
|
1254
|
+
* context.set(apiClientContext, getApiClient());
|
|
1255
|
+
* return context;
|
|
1256
|
+
* }
|
|
1257
|
+
* })
|
|
1258
|
+
* ```
|
|
1242
1259
|
*/
|
|
1243
1260
|
unstable_getContext?: RouterInit["unstable_getContext"];
|
|
1244
1261
|
/**
|
|
@@ -1249,7 +1266,7 @@ interface DOMRouterOpts {
|
|
|
1249
1266
|
* When Server-Rendering and opting-out of automatic hydration, the
|
|
1250
1267
|
* `hydrationData` option allows you to pass in hydration data from your
|
|
1251
1268
|
* server-render. This will almost always be a subset of data from the
|
|
1252
|
-
* {@link StaticHandlerContext} value you get back from {@link StaticHandler}'s
|
|
1269
|
+
* {@link StaticHandlerContext} value you get back from the {@link StaticHandler}'s
|
|
1253
1270
|
* `query` method:
|
|
1254
1271
|
*
|
|
1255
1272
|
* ```tsx
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import './components-
|
|
1
|
+
import './components-CuPfnyiZ.mjs';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { az as RouteManifest, M as MiddlewareEnabled, o as unstable_RouterContextProvider, j as LoaderFunctionArgs, i as ActionFunctionArgs, J as StaticHandlerContext, H as HydrationState, z as DataRouteObject, a2 as HTMLFormMethod, a0 as FormEncType, a as RelativeRoutingType, T as To, aA as History, E as GetScrollRestorationKeyFunction, e as RouterInit, F as FutureConfig$1, D as DataStrategyFunction, P as PatchRoutesOnNavigationFunction, q as NavigateOptions, K as Fetcher, f as RouteObject, R as Router, B as BlockerFunction, c as Location, aB as CreateStaticHandlerOptions$1, C as StaticHandler } from './context-
|
|
4
|
-
import { o as ServerRouteModule, A as AppLoadContext, c as RouteModules, h as ClientLoaderFunction, m as PageLinkDescriptor, d as SerializeFrom } from './route-data-
|
|
3
|
+
import { az as RouteManifest, M as MiddlewareEnabled, o as unstable_RouterContextProvider, j as LoaderFunctionArgs, i as ActionFunctionArgs, J as StaticHandlerContext, H as HydrationState, z as DataRouteObject, a2 as HTMLFormMethod, a0 as FormEncType, a as RelativeRoutingType, T as To, aA as History, E as GetScrollRestorationKeyFunction, e as RouterInit, F as FutureConfig$1, D as DataStrategyFunction, P as PatchRoutesOnNavigationFunction, q as NavigateOptions, K as Fetcher, f as RouteObject, R as Router, B as BlockerFunction, c as Location, aB as CreateStaticHandlerOptions$1, C as StaticHandler } from './context-DohQKLID.mjs';
|
|
4
|
+
import { o as ServerRouteModule, A as AppLoadContext, c as RouteModules, h as ClientLoaderFunction, m as PageLinkDescriptor, d as SerializeFrom } from './route-data-CpB5xtMm.mjs';
|
|
5
5
|
|
|
6
6
|
type ServerRouteManifest = RouteManifest<Omit<ServerRoute, "children">>;
|
|
7
7
|
interface ServerRoute extends Route {
|
|
@@ -431,6 +431,23 @@ interface DOMRouterOpts {
|
|
|
431
431
|
* [`loader`](../../start/data/route-object#loader)s and [middleware](../../how-to/middleware).
|
|
432
432
|
* This function is called to generate a fresh `context` instance on each
|
|
433
433
|
* navigation or fetcher call.
|
|
434
|
+
*
|
|
435
|
+
* ```tsx
|
|
436
|
+
* import {
|
|
437
|
+
* unstable_createContext,
|
|
438
|
+
* unstable_RouterContextProvider,
|
|
439
|
+
* } from "react-router";
|
|
440
|
+
*
|
|
441
|
+
* const apiClientContext = unstable_createContext<APIClient>();
|
|
442
|
+
*
|
|
443
|
+
* function createBrowserRouter(routes, {
|
|
444
|
+
* unstable_getContext() {
|
|
445
|
+
* let context = new unstable_RouterContextProvider();
|
|
446
|
+
* context.set(apiClientContext, getApiClient());
|
|
447
|
+
* return context;
|
|
448
|
+
* }
|
|
449
|
+
* })
|
|
450
|
+
* ```
|
|
434
451
|
*/
|
|
435
452
|
unstable_getContext?: RouterInit["unstable_getContext"];
|
|
436
453
|
/**
|
|
@@ -441,7 +458,7 @@ interface DOMRouterOpts {
|
|
|
441
458
|
* When Server-Rendering and opting-out of automatic hydration, the
|
|
442
459
|
* `hydrationData` option allows you to pass in hydration data from your
|
|
443
460
|
* server-render. This will almost always be a subset of data from the
|
|
444
|
-
* {@link StaticHandlerContext} value you get back from {@link StaticHandler}'s
|
|
461
|
+
* {@link StaticHandlerContext} value you get back from the {@link StaticHandler}'s
|
|
445
462
|
* `query` method:
|
|
446
463
|
*
|
|
447
464
|
* ```tsx
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { f as Await, g as MemoryRouter, h as Navigate, i as Outlet, j as Route, k as Router, l as RouterProvider, m as Routes, W as UNSAFE_WithComponentProps, v as UNSAFE_WithErrorBoundaryProps, t as UNSAFE_WithHydrateFallbackProps } from './components-
|
|
2
|
-
export { l as BrowserRouter, q as Form, m as HashRouter, n as Link, X as Links, W as Meta, p as NavLink, r as ScrollRestoration, T as StaticRouter, V as StaticRouterProvider, o as unstable_HistoryRouter } from './index-react-server-client-
|
|
3
|
-
import './context-
|
|
1
|
+
export { f as Await, g as MemoryRouter, h as Navigate, i as Outlet, j as Route, k as Router, l as RouterProvider, m as Routes, W as UNSAFE_WithComponentProps, v as UNSAFE_WithErrorBoundaryProps, t as UNSAFE_WithHydrateFallbackProps } from './components-CuPfnyiZ.mjs';
|
|
2
|
+
export { l as BrowserRouter, q as Form, m as HashRouter, n as Link, X as Links, W as Meta, p as NavLink, r as ScrollRestoration, T as StaticRouter, V as StaticRouterProvider, o as unstable_HistoryRouter } from './index-react-server-client-DXb0OgpJ.mjs';
|
|
3
|
+
import './context-DohQKLID.mjs';
|
|
4
4
|
import 'react';
|
|
5
|
-
import './route-data-
|
|
5
|
+
import './route-data-CpB5xtMm.mjs';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { h as Await, V as BrowserRouter, _ as Form, W as HashRouter, X as Link, am as Links, i as MemoryRouter, al as Meta, Z as NavLink, j as Navigate, k as Outlet, l as Route, m as Router, n as RouterProvider, o as Routes, $ as ScrollRestoration, aj as StaticRouter, ak as StaticRouterProvider, az as UNSAFE_WithComponentProps, aD as UNSAFE_WithErrorBoundaryProps, aB as UNSAFE_WithHydrateFallbackProps, Y as unstable_HistoryRouter } from './index-react-server-client-
|
|
2
|
-
import './routeModules-
|
|
1
|
+
export { h as Await, V as BrowserRouter, _ as Form, W as HashRouter, X as Link, am as Links, i as MemoryRouter, al as Meta, Z as NavLink, j as Navigate, k as Outlet, l as Route, m as Router, n as RouterProvider, o as Routes, $ as ScrollRestoration, aj as StaticRouter, ak as StaticRouterProvider, az as UNSAFE_WithComponentProps, aD as UNSAFE_WithErrorBoundaryProps, aB as UNSAFE_WithHydrateFallbackProps, Y as unstable_HistoryRouter } from './index-react-server-client-CMphySRb.js';
|
|
2
|
+
import './routeModules-qBivMBjd.js';
|
|
3
3
|
import 'react';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});/**
|
|
2
|
-
* react-router v7.8.0-pre.
|
|
2
|
+
* react-router v7.8.0-pre.2
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -30,11 +30,11 @@
|
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
|
|
33
|
-
var
|
|
33
|
+
var _chunkHQ37R3FKjs = require('./chunk-HQ37R3FK.js');
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
|
|
37
|
-
var
|
|
37
|
+
var _chunk74TFO7SNjs = require('./chunk-74TFO7SN.js');
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
|
|
@@ -58,4 +58,4 @@ var _chunkIW6UADHOjs = require('./chunk-IW6UADHO.js');
|
|
|
58
58
|
|
|
59
59
|
|
|
60
60
|
|
|
61
|
-
exports.Await =
|
|
61
|
+
exports.Await = _chunkHQ37R3FKjs.Await; exports.BrowserRouter = _chunkHQ37R3FKjs.BrowserRouter; exports.Form = _chunkHQ37R3FKjs.Form; exports.HashRouter = _chunkHQ37R3FKjs.HashRouter; exports.Link = _chunkHQ37R3FKjs.Link; exports.Links = _chunk74TFO7SNjs.Links; exports.MemoryRouter = _chunkHQ37R3FKjs.MemoryRouter; exports.Meta = _chunk74TFO7SNjs.Meta; exports.NavLink = _chunkHQ37R3FKjs.NavLink; exports.Navigate = _chunkHQ37R3FKjs.Navigate; exports.Outlet = _chunkHQ37R3FKjs.Outlet; exports.Route = _chunkHQ37R3FKjs.Route; exports.Router = _chunkHQ37R3FKjs.Router; exports.RouterProvider = _chunkHQ37R3FKjs.RouterProvider; exports.Routes = _chunkHQ37R3FKjs.Routes; exports.ScrollRestoration = _chunkHQ37R3FKjs.ScrollRestoration; exports.StaticRouter = _chunkHQ37R3FKjs.StaticRouter; exports.StaticRouterProvider = _chunkHQ37R3FKjs.StaticRouterProvider; exports.UNSAFE_WithComponentProps = _chunkHQ37R3FKjs.WithComponentProps; exports.UNSAFE_WithErrorBoundaryProps = _chunkHQ37R3FKjs.WithErrorBoundaryProps; exports.UNSAFE_WithHydrateFallbackProps = _chunkHQ37R3FKjs.WithHydrateFallbackProps; exports.unstable_HistoryRouter = _chunkHQ37R3FKjs.HistoryRouter;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v7.8.0-pre.
|
|
2
|
+
* react-router v7.8.0-pre.2
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
WithComponentProps,
|
|
33
33
|
WithErrorBoundaryProps,
|
|
34
34
|
WithHydrateFallbackProps
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-WSV33ENW.mjs";
|
|
36
36
|
export {
|
|
37
37
|
Await,
|
|
38
38
|
BrowserRouter,
|
|
@@ -237,12 +237,10 @@ interface unstable_RouterContext<T = unknown> {
|
|
|
237
237
|
}
|
|
238
238
|
/**
|
|
239
239
|
* Creates a type-safe {@link unstable_RouterContext} object that can be used to
|
|
240
|
-
*
|
|
241
|
-
*
|
|
242
|
-
*
|
|
243
|
-
*
|
|
244
|
-
*
|
|
245
|
-
* <docs-warning>Enable this API with the `future.unstable_middleware` flag.</docs-warning>
|
|
240
|
+
* store and retrieve arbitrary values in [`action`](../../start/framework/route-module#action)s,
|
|
241
|
+
* [`loader`](../../start/framework/route-module#loader)s, and [middleware](../../how-to/middleware).
|
|
242
|
+
* Similar to React's [`createContext`](https://react.dev/reference/react/createContext),
|
|
243
|
+
* but specifically designed for React Router's request/response lifecycle.
|
|
246
244
|
*
|
|
247
245
|
* If a `defaultValue` is provided, it will be returned from `context.get()`
|
|
248
246
|
* when no value has been set for the context. Otherwise, reading this context
|
|
@@ -309,6 +307,7 @@ declare function unstable_createContext<T>(defaultValue?: T): unstable_RouterCon
|
|
|
309
307
|
* const userContext = unstable_createContext<User | null>(null);
|
|
310
308
|
* const contextProvider = new unstable_RouterContextProvider();
|
|
311
309
|
* contextProvider.set(userContext, getUser());
|
|
310
|
+
* // ^ Type-safe
|
|
312
311
|
* const user = contextProvider.get(userContext);
|
|
313
312
|
* // ^ User
|
|
314
313
|
*
|
|
@@ -379,7 +378,7 @@ interface DataFunctionArgs<Context> {
|
|
|
379
378
|
* middlewares from the bottom-up
|
|
380
379
|
*/
|
|
381
380
|
interface unstable_MiddlewareNextFunction<Result = unknown> {
|
|
382
|
-
():
|
|
381
|
+
(): Promise<Result>;
|
|
383
382
|
}
|
|
384
383
|
/**
|
|
385
384
|
* Route middleware function signature. Receives the same "data" arguments as a
|
|
@@ -237,12 +237,10 @@ interface unstable_RouterContext<T = unknown> {
|
|
|
237
237
|
}
|
|
238
238
|
/**
|
|
239
239
|
* Creates a type-safe {@link unstable_RouterContext} object that can be used to
|
|
240
|
-
*
|
|
241
|
-
*
|
|
242
|
-
*
|
|
243
|
-
*
|
|
244
|
-
*
|
|
245
|
-
* <docs-warning>Enable this API with the `future.unstable_middleware` flag.</docs-warning>
|
|
240
|
+
* store and retrieve arbitrary values in [`action`](../../start/framework/route-module#action)s,
|
|
241
|
+
* [`loader`](../../start/framework/route-module#loader)s, and [middleware](../../how-to/middleware).
|
|
242
|
+
* Similar to React's [`createContext`](https://react.dev/reference/react/createContext),
|
|
243
|
+
* but specifically designed for React Router's request/response lifecycle.
|
|
246
244
|
*
|
|
247
245
|
* If a `defaultValue` is provided, it will be returned from `context.get()`
|
|
248
246
|
* when no value has been set for the context. Otherwise, reading this context
|
|
@@ -309,6 +307,7 @@ declare function unstable_createContext<T>(defaultValue?: T): unstable_RouterCon
|
|
|
309
307
|
* const userContext = unstable_createContext<User | null>(null);
|
|
310
308
|
* const contextProvider = new unstable_RouterContextProvider();
|
|
311
309
|
* contextProvider.set(userContext, getUser());
|
|
310
|
+
* // ^ Type-safe
|
|
312
311
|
* const user = contextProvider.get(userContext);
|
|
313
312
|
* // ^ User
|
|
314
313
|
*
|
|
@@ -379,7 +378,7 @@ interface DataFunctionArgs<Context> {
|
|
|
379
378
|
* middlewares from the bottom-up
|
|
380
379
|
*/
|
|
381
380
|
interface unstable_MiddlewareNextFunction<Result = unknown> {
|
|
382
|
-
():
|
|
381
|
+
(): Promise<Result>;
|
|
383
382
|
}
|
|
384
383
|
/**
|
|
385
384
|
* Route middleware function signature. Receives the same "data" arguments as a
|