react-router 7.8.2 → 7.9.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 +28 -0
- package/dist/development/{chunk-5UALIXAM.mjs → chunk-AVXIT45F.mjs} +94 -70
- package/dist/development/{chunk-PVWAREVJ.mjs → chunk-QZH3B547.mjs} +47 -50
- package/dist/development/{chunk-ZO66TDGB.js → chunk-RGB6BZUL.js} +41 -44
- package/dist/development/{chunk-CSDGKXLR.js → chunk-XYB2GISA.js} +135 -135
- package/dist/{production/context-jKip1TFB.d.mts → development/context-BH6Jwdoy.d.mts} +39 -32
- package/dist/development/dom-export.d.mts +3 -3
- package/dist/development/dom-export.d.ts +2 -2
- package/dist/development/dom-export.js +14 -14
- package/dist/development/dom-export.mjs +14 -14
- package/dist/development/{index-react-server-client-DRhjXpk2.d.mts → index-react-server-client-1cWMpKk4.d.mts} +13 -13
- package/dist/{production/index-react-server-client-BKpa2trA.d.ts → development/index-react-server-client-CMC2eQAY.d.ts} +12 -12
- 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 +229 -37
- package/dist/development/index-react-server.d.ts +229 -37
- package/dist/development/index-react-server.js +89 -39
- package/dist/development/index-react-server.mjs +88 -36
- package/dist/development/index.d.mts +31 -24
- package/dist/development/index.d.ts +29 -22
- package/dist/development/index.js +184 -158
- 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-DAVP2QQ0.d.mts → route-data-BQkq8Erj.d.mts} +12 -12
- package/dist/development/{routeModules-rOzWJJ9x.d.ts → routeModules-DSKAn01V.d.ts} +175 -168
- package/dist/production/{chunk-Z56HUDN5.js → chunk-A6EU7LHU.js} +41 -44
- package/dist/production/{chunk-REDRD2MB.mjs → chunk-BQLQLXP4.mjs} +47 -50
- package/dist/production/{chunk-JNT5PWCQ.js → chunk-IR3XRH6J.js} +135 -135
- package/dist/production/{chunk-KWHRV2I7.mjs → chunk-WMHWIEJV.mjs} +94 -70
- package/dist/{development/context-jKip1TFB.d.mts → production/context-BH6Jwdoy.d.mts} +39 -32
- package/dist/production/dom-export.d.mts +3 -3
- package/dist/production/dom-export.d.ts +2 -2
- package/dist/production/dom-export.js +14 -14
- package/dist/production/dom-export.mjs +14 -14
- package/dist/production/{index-react-server-client-DRhjXpk2.d.mts → index-react-server-client-1cWMpKk4.d.mts} +13 -13
- package/dist/{development/index-react-server-client-BKpa2trA.d.ts → production/index-react-server-client-CMC2eQAY.d.ts} +12 -12
- 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 +229 -37
- package/dist/production/index-react-server.d.ts +229 -37
- package/dist/production/index-react-server.js +89 -39
- package/dist/production/index-react-server.mjs +88 -36
- package/dist/production/index.d.mts +31 -24
- package/dist/production/index.d.ts +29 -22
- package/dist/production/index.js +184 -158
- 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-DAVP2QQ0.d.mts → route-data-BQkq8Erj.d.mts} +12 -12
- package/dist/production/{routeModules-rOzWJJ9x.d.ts → routeModules-DSKAn01V.d.ts} +175 -168
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v7.
|
|
2
|
+
* react-router v7.9.0-pre.1
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -31,10 +31,11 @@ import {
|
|
|
31
31
|
isSession,
|
|
32
32
|
routeRSCServerRequest,
|
|
33
33
|
setDevServerHooks
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-AVXIT45F.mjs";
|
|
35
35
|
import {
|
|
36
36
|
Action,
|
|
37
37
|
Await,
|
|
38
|
+
AwaitContextProvider,
|
|
38
39
|
BrowserRouter,
|
|
39
40
|
DataRouterContext,
|
|
40
41
|
DataRouterStateContext,
|
|
@@ -61,6 +62,7 @@ import {
|
|
|
61
62
|
Route,
|
|
62
63
|
RouteContext,
|
|
63
64
|
Router,
|
|
65
|
+
RouterContextProvider,
|
|
64
66
|
RouterProvider,
|
|
65
67
|
Routes,
|
|
66
68
|
Scripts,
|
|
@@ -76,6 +78,7 @@ import {
|
|
|
76
78
|
createBrowserRouter,
|
|
77
79
|
createClientRoutes,
|
|
78
80
|
createClientRoutesWithHMRRevalidationOptOut,
|
|
81
|
+
createContext,
|
|
79
82
|
createHashRouter,
|
|
80
83
|
createMemoryRouter,
|
|
81
84
|
createPath,
|
|
@@ -103,8 +106,6 @@ import {
|
|
|
103
106
|
replace,
|
|
104
107
|
resolvePath,
|
|
105
108
|
shouldHydrateRouteLoader,
|
|
106
|
-
unstable_RouterContextProvider,
|
|
107
|
-
unstable_createContext,
|
|
108
109
|
useActionData,
|
|
109
110
|
useAsyncError,
|
|
110
111
|
useAsyncValue,
|
|
@@ -140,7 +141,7 @@ import {
|
|
|
140
141
|
withComponentProps,
|
|
141
142
|
withErrorBoundaryProps,
|
|
142
143
|
withHydrateFallbackProps
|
|
143
|
-
} from "./chunk-
|
|
144
|
+
} from "./chunk-QZH3B547.mjs";
|
|
144
145
|
export {
|
|
145
146
|
Await,
|
|
146
147
|
BrowserRouter,
|
|
@@ -160,6 +161,7 @@ export {
|
|
|
160
161
|
PrefetchPageLinks,
|
|
161
162
|
Route,
|
|
162
163
|
Router,
|
|
164
|
+
RouterContextProvider,
|
|
163
165
|
RouterProvider,
|
|
164
166
|
Routes,
|
|
165
167
|
Scripts,
|
|
@@ -167,6 +169,7 @@ export {
|
|
|
167
169
|
ServerRouter,
|
|
168
170
|
StaticRouter,
|
|
169
171
|
StaticRouterProvider,
|
|
172
|
+
AwaitContextProvider as UNSAFE_AwaitContextProvider,
|
|
170
173
|
DataRouterContext as UNSAFE_DataRouterContext,
|
|
171
174
|
DataRouterStateContext as UNSAFE_DataRouterStateContext,
|
|
172
175
|
ErrorResponseImpl as UNSAFE_ErrorResponseImpl,
|
|
@@ -202,6 +205,7 @@ export {
|
|
|
202
205
|
withErrorBoundaryProps as UNSAFE_withErrorBoundaryProps,
|
|
203
206
|
withHydrateFallbackProps as UNSAFE_withHydrateFallbackProps,
|
|
204
207
|
createBrowserRouter,
|
|
208
|
+
createContext,
|
|
205
209
|
createCookie,
|
|
206
210
|
createCookieSessionStorage,
|
|
207
211
|
createHashRouter,
|
|
@@ -234,9 +238,7 @@ export {
|
|
|
234
238
|
HistoryRouter as unstable_HistoryRouter,
|
|
235
239
|
RSCHydratedRouter as unstable_RSCHydratedRouter,
|
|
236
240
|
RSCStaticRouter as unstable_RSCStaticRouter,
|
|
237
|
-
unstable_RouterContextProvider,
|
|
238
241
|
createCallServer as unstable_createCallServer,
|
|
239
|
-
unstable_createContext,
|
|
240
242
|
getRSCStream as unstable_getRSCStream,
|
|
241
243
|
routeRSCServerRequest as unstable_routeRSCServerRequest,
|
|
242
244
|
setDevServerHooks as unstable_setDevServerHooks,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as RouteModule, L as LinkDescriptor, F as Func, P as Pretty, M as MetaDescriptor, G as GetLoaderData, S as ServerDataFunctionArgs, C as ClientDataFunctionArgs, a as ServerDataFrom, N as Normalize, b as GetActionData } from '../../route-data-
|
|
2
|
-
import { L as Location,
|
|
1
|
+
import { R as RouteModule, L as LinkDescriptor, F as Func, P as Pretty, M as MetaDescriptor, G as GetLoaderData, S as ServerDataFunctionArgs, C as ClientDataFunctionArgs, a as ServerDataFrom, N as Normalize, b as GetActionData } from '../../route-data-BQkq8Erj.mjs';
|
|
2
|
+
import { L as Location, M as MiddlewareNextFunction, D as DataStrategyResult } from '../../context-BH6Jwdoy.mjs';
|
|
3
3
|
import { R as RouteFiles, P as Pages } from '../../register-DiOIlEq5.mjs';
|
|
4
4
|
import 'react';
|
|
5
5
|
|
|
@@ -57,8 +57,8 @@ type HeadersArgs = {
|
|
|
57
57
|
actionHeaders: Headers;
|
|
58
58
|
errorHeaders: Headers | undefined;
|
|
59
59
|
};
|
|
60
|
-
type CreateServerMiddlewareFunction<T extends RouteInfo> = (args: ServerDataFunctionArgs<T["params"]>, next:
|
|
61
|
-
type CreateClientMiddlewareFunction<T extends RouteInfo> = (args: ClientDataFunctionArgs<T["params"]>, next:
|
|
60
|
+
type CreateServerMiddlewareFunction<T extends RouteInfo> = (args: ServerDataFunctionArgs<T["params"]>, next: MiddlewareNextFunction<Response>) => MaybePromise<Response | void>;
|
|
61
|
+
type CreateClientMiddlewareFunction<T extends RouteInfo> = (args: ClientDataFunctionArgs<T["params"]>, next: MiddlewareNextFunction<Record<string, DataStrategyResult>>) => MaybePromise<Record<string, DataStrategyResult> | void>;
|
|
62
62
|
type CreateServerLoaderArgs<T extends RouteInfo> = ServerDataFunctionArgs<T["params"]>;
|
|
63
63
|
type CreateClientLoaderArgs<T extends RouteInfo> = ClientDataFunctionArgs<T["params"]> & {
|
|
64
64
|
/** This is an asynchronous function to get the data from the server loader for this route. On client-side navigations, this will make a {@link https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API fetch} call to the React Router server loader. If you opt-into running your clientLoader on hydration, then this function will return the data that was already loaded on the server (via Promise.resolve). */
|
|
@@ -135,8 +135,8 @@ type GetAnnotations<Info extends RouteInfo> = {
|
|
|
135
135
|
MetaFunction: (args: CreateMetaArgs<Info>) => MetaDescriptors;
|
|
136
136
|
HeadersArgs: HeadersArgs;
|
|
137
137
|
HeadersFunction: (args: HeadersArgs) => Headers | HeadersInit;
|
|
138
|
-
|
|
139
|
-
|
|
138
|
+
MiddlewareFunction: CreateServerMiddlewareFunction<Info>;
|
|
139
|
+
ClientMiddlewareFunction: CreateClientMiddlewareFunction<Info>;
|
|
140
140
|
LoaderArgs: CreateServerLoaderArgs<Info>;
|
|
141
141
|
ClientLoaderArgs: CreateClientLoaderArgs<Info>;
|
|
142
142
|
ActionArgs: CreateServerActionArgs<Info>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { R as RouteModule, L as LinkDescriptor, a as Location, F as Func, P as Pretty, M as MetaDescriptor, G as GetLoaderData, S as ServerDataFunctionArgs,
|
|
1
|
+
import { R as RouteModule, L as LinkDescriptor, a as Location, F as Func, P as Pretty, M as MetaDescriptor, G as GetLoaderData, S as ServerDataFunctionArgs, b as MiddlewareNextFunction, C as ClientDataFunctionArgs, D as DataStrategyResult, c as ServerDataFrom, N as Normalize, d as GetActionData } from '../../routeModules-DSKAn01V.js';
|
|
2
2
|
import { R as RouteFiles, P as Pages } from '../../register-DiOIlEq5.js';
|
|
3
3
|
import 'react';
|
|
4
4
|
|
|
@@ -56,8 +56,8 @@ type HeadersArgs = {
|
|
|
56
56
|
actionHeaders: Headers;
|
|
57
57
|
errorHeaders: Headers | undefined;
|
|
58
58
|
};
|
|
59
|
-
type CreateServerMiddlewareFunction<T extends RouteInfo> = (args: ServerDataFunctionArgs<T["params"]>, next:
|
|
60
|
-
type CreateClientMiddlewareFunction<T extends RouteInfo> = (args: ClientDataFunctionArgs<T["params"]>, next:
|
|
59
|
+
type CreateServerMiddlewareFunction<T extends RouteInfo> = (args: ServerDataFunctionArgs<T["params"]>, next: MiddlewareNextFunction<Response>) => MaybePromise<Response | void>;
|
|
60
|
+
type CreateClientMiddlewareFunction<T extends RouteInfo> = (args: ClientDataFunctionArgs<T["params"]>, next: MiddlewareNextFunction<Record<string, DataStrategyResult>>) => MaybePromise<Record<string, DataStrategyResult> | void>;
|
|
61
61
|
type CreateServerLoaderArgs<T extends RouteInfo> = ServerDataFunctionArgs<T["params"]>;
|
|
62
62
|
type CreateClientLoaderArgs<T extends RouteInfo> = ClientDataFunctionArgs<T["params"]> & {
|
|
63
63
|
/** This is an asynchronous function to get the data from the server loader for this route. On client-side navigations, this will make a {@link https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API fetch} call to the React Router server loader. If you opt-into running your clientLoader on hydration, then this function will return the data that was already loaded on the server (via Promise.resolve). */
|
|
@@ -134,8 +134,8 @@ type GetAnnotations<Info extends RouteInfo> = {
|
|
|
134
134
|
MetaFunction: (args: CreateMetaArgs<Info>) => MetaDescriptors;
|
|
135
135
|
HeadersArgs: HeadersArgs;
|
|
136
136
|
HeadersFunction: (args: HeadersArgs) => Headers | HeadersInit;
|
|
137
|
-
|
|
138
|
-
|
|
137
|
+
MiddlewareFunction: CreateServerMiddlewareFunction<Info>;
|
|
138
|
+
ClientMiddlewareFunction: CreateClientMiddlewareFunction<Info>;
|
|
139
139
|
LoaderArgs: CreateServerLoaderArgs<Info>;
|
|
140
140
|
ClientLoaderArgs: CreateClientLoaderArgs<Info>;
|
|
141
141
|
ActionArgs: CreateServerActionArgs<Info>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComponentType, ReactElement } from 'react';
|
|
2
|
-
import { A as ActionFunctionArgs,
|
|
2
|
+
import { A as ActionFunctionArgs, b as LoaderFunctionArgs, c as ActionFunction, d as LoaderFunction, P as Params, L as Location, e as DataRouteMatch, f as MiddlewareFunction, D as DataStrategyResult, S as ShouldRevalidateFunction, g as RouterContextProvider, h as DataWithResponseInit, i as MiddlewareEnabled } from './context-BH6Jwdoy.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* An object of unknown type for route loaders and actions provided by the
|
|
@@ -130,7 +130,7 @@ interface RouteModules {
|
|
|
130
130
|
interface RouteModule$1 {
|
|
131
131
|
clientAction?: ClientActionFunction;
|
|
132
132
|
clientLoader?: ClientLoaderFunction;
|
|
133
|
-
|
|
133
|
+
clientMiddleware?: MiddlewareFunction<Record<string, DataStrategyResult>>[];
|
|
134
134
|
ErrorBoundary?: ErrorBoundaryComponent;
|
|
135
135
|
HydrateFallback?: HydrateFallbackComponent;
|
|
136
136
|
Layout?: LayoutComponent;
|
|
@@ -149,7 +149,7 @@ interface ServerRouteModule extends RouteModule$1 {
|
|
|
149
149
|
[name: string]: string;
|
|
150
150
|
};
|
|
151
151
|
loader?: LoaderFunction;
|
|
152
|
-
|
|
152
|
+
middleware?: MiddlewareFunction<Response>[];
|
|
153
153
|
}
|
|
154
154
|
/**
|
|
155
155
|
* A function that handles data mutations for a route on the client
|
|
@@ -404,14 +404,14 @@ type ClientDataFunctionArgs<Params> = {
|
|
|
404
404
|
**/
|
|
405
405
|
params: Params;
|
|
406
406
|
/**
|
|
407
|
-
* When `future.
|
|
407
|
+
* When `future.v8_middleware` is not enabled, this is undefined.
|
|
408
408
|
*
|
|
409
|
-
* When `future.
|
|
410
|
-
* `
|
|
409
|
+
* When `future.v8_middleware` is enabled, this is an instance of
|
|
410
|
+
* `RouterContextProvider` and can be used to access context values
|
|
411
411
|
* from your route middlewares. You may pass in initial context values in your
|
|
412
|
-
* `<HydratedRouter
|
|
412
|
+
* `<HydratedRouter getContext>` prop
|
|
413
413
|
*/
|
|
414
|
-
context: Readonly<
|
|
414
|
+
context: Readonly<RouterContextProvider>;
|
|
415
415
|
};
|
|
416
416
|
type ServerDataFunctionArgs<Params> = {
|
|
417
417
|
/** A {@link https://developer.mozilla.org/en-US/docs/Web/API/Request Fetch Request instance} which you can use to read the url, method, headers (such as cookies), and request body from the request. */
|
|
@@ -432,18 +432,18 @@ type ServerDataFunctionArgs<Params> = {
|
|
|
432
432
|
**/
|
|
433
433
|
params: Params;
|
|
434
434
|
/**
|
|
435
|
-
* Without `future.
|
|
435
|
+
* Without `future.v8_middleware` enabled, this is the context passed in
|
|
436
436
|
* to your server adapter's `getLoadContext` function. It's a way to bridge the
|
|
437
437
|
* gap between the adapter's request/response API with your React Router app.
|
|
438
438
|
* It is only applicable if you are using a custom server adapter.
|
|
439
439
|
*
|
|
440
|
-
* With `future.
|
|
441
|
-
* `
|
|
440
|
+
* With `future.v8_middleware` enabled, this is an instance of
|
|
441
|
+
* `RouterContextProvider` and can be used for type-safe access to
|
|
442
442
|
* context value set in your route middlewares. If you are using a custom
|
|
443
443
|
* server adapter, you may provide an initial set of context values from your
|
|
444
444
|
* `getLoadContext` function.
|
|
445
445
|
*/
|
|
446
|
-
context: MiddlewareEnabled extends true ? Readonly<
|
|
446
|
+
context: MiddlewareEnabled extends true ? Readonly<RouterContextProvider> : AppLoadContext;
|
|
447
447
|
};
|
|
448
448
|
type SerializeFrom<T> = T extends (...args: infer Args) => unknown ? Args extends [
|
|
449
449
|
ClientLoaderFunctionArgs | ClientActionFunctionArgs | ClientDataFunctionArgs<unknown>
|