react-router 7.7.0 → 7.7.1-pre.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -28
- package/dist/development/{browser-CcxeZJcQ.d.mts → browser-7LYX59NK.d.mts} +97 -1
- package/dist/development/{chunk-V6PEDDZI.js → chunk-4DODSFAK.js} +79 -76
- package/dist/development/{chunk-EF7DTUVF.mjs → chunk-FSG5FGWQ.mjs} +83 -80
- package/dist/{production/chunk-2TYFPE3B.js → development/chunk-JKVEU2V7.js} +132 -132
- package/dist/{production/chunk-GNZILI6H.mjs → development/chunk-KFHXRAUZ.mjs} +3 -5
- package/dist/development/components-CjQijYga.d.mts +802 -0
- package/dist/development/dom-export.d.mts +13 -6
- package/dist/development/dom-export.d.ts +10 -3
- package/dist/development/dom-export.js +3 -3
- package/dist/development/dom-export.mjs +3 -3
- package/dist/development/index-react-server-client-Bi_fx8qz.d.ts +3163 -0
- package/dist/development/index-react-server-client-KLg-U4nr.d.mts +2366 -0
- 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 +2 -2
- package/dist/development/index-react-server.d.mts +109 -2
- package/dist/development/index-react-server.d.ts +109 -2
- package/dist/development/index-react-server.js +28 -20
- package/dist/development/index-react-server.mjs +29 -21
- package/dist/development/index.d.mts +918 -287
- package/dist/development/index.d.ts +1010 -283
- package/dist/development/index.js +98 -100
- package/dist/development/index.mjs +3 -3
- package/dist/development/lib/types/internal.d.mts +1 -1
- 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/{production/route-data-DjzmHYNR.d.mts → development/route-data-CqEmXQub.d.mts} +48 -2
- package/dist/{production/routeModules-g5PTiDfO.d.ts → development/routeModules-BR2FO0ix.d.ts} +48 -2
- package/dist/production/{browser-CcxeZJcQ.d.mts → browser-7LYX59NK.d.mts} +97 -1
- package/dist/production/{chunk-5KHO4FML.js → chunk-BPUKNCMM.js} +79 -76
- package/dist/production/{chunk-WPPIQDYG.mjs → chunk-J4LDCI7O.mjs} +83 -80
- package/dist/{development/chunk-T3VM44WY.mjs → production/chunk-MZVTKUZ4.mjs} +3 -5
- package/dist/{development/chunk-4ADB4KIO.js → production/chunk-PVPY6FX7.js} +132 -132
- package/dist/production/components-CjQijYga.d.mts +802 -0
- package/dist/production/dom-export.d.mts +13 -6
- package/dist/production/dom-export.d.ts +10 -3
- package/dist/production/dom-export.js +3 -3
- package/dist/production/dom-export.mjs +3 -3
- package/dist/production/index-react-server-client-Bi_fx8qz.d.ts +3163 -0
- package/dist/production/index-react-server-client-KLg-U4nr.d.mts +2366 -0
- 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 +2 -2
- package/dist/production/index-react-server.d.mts +109 -2
- package/dist/production/index-react-server.d.ts +109 -2
- package/dist/production/index-react-server.js +28 -20
- package/dist/production/index-react-server.mjs +29 -21
- package/dist/production/index.d.mts +918 -287
- package/dist/production/index.d.ts +1010 -283
- package/dist/production/index.js +98 -100
- package/dist/production/index.mjs +3 -3
- package/dist/production/lib/types/internal.d.mts +1 -1
- 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/{development/route-data-DjzmHYNR.d.mts → production/route-data-CqEmXQub.d.mts} +48 -2
- package/dist/{development/routeModules-g5PTiDfO.d.ts → production/routeModules-BR2FO0ix.d.ts} +48 -2
- package/package.json +1 -1
- package/dist/development/components-DzqPLVI1.d.mts +0 -464
- package/dist/development/index-react-server-client-CUidsuu_.d.mts +0 -1360
- package/dist/development/index-react-server-client-kY8DvDF3.d.ts +0 -1819
- package/dist/production/components-DzqPLVI1.d.mts +0 -464
- package/dist/production/index-react-server-client-CUidsuu_.d.mts +0 -1360
- package/dist/production/index-react-server-client-kY8DvDF3.d.ts +0 -1819
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v7.7.0
|
|
2
|
+
* react-router v7.7.1-pre.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
isSession,
|
|
32
32
|
routeRSCServerRequest,
|
|
33
33
|
setDevServerHooks
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-KFHXRAUZ.mjs";
|
|
35
35
|
import {
|
|
36
36
|
Action,
|
|
37
37
|
Await,
|
|
@@ -140,7 +140,7 @@ import {
|
|
|
140
140
|
withComponentProps,
|
|
141
141
|
withErrorBoundaryProps,
|
|
142
142
|
withHydrateFallbackProps
|
|
143
|
-
} from "./chunk-
|
|
143
|
+
} from "./chunk-FSG5FGWQ.mjs";
|
|
144
144
|
export {
|
|
145
145
|
Await,
|
|
146
146
|
BrowserRouter,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as RouteModule, o as LinkDescriptor, c as Location, p as Pretty, q as MetaDescriptor, G as GetLoaderData, r as ServerDataFunctionArgs, s as unstable_MiddlewareNextFunction, t as ClientDataFunctionArgs, v as ServerDataFrom, w as Normalize, x as GetActionData } from '../../route-data-
|
|
1
|
+
import { n as RouteModule, o as LinkDescriptor, c as Location, p as Pretty, q as MetaDescriptor, G as GetLoaderData, r as ServerDataFunctionArgs, s as unstable_MiddlewareNextFunction, t as ClientDataFunctionArgs, v as ServerDataFrom, w as Normalize, x as GetActionData } from '../../route-data-CqEmXQub.mjs';
|
|
2
2
|
import { R as RouteFiles, P as Pages } from '../../register-DiOIlEq5.mjs';
|
|
3
3
|
import 'react';
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { R as RouteModule, L as LinkDescriptor, a as Location, P as Pretty, M as MetaDescriptor, G as GetLoaderData, S as ServerDataFunctionArgs, u as unstable_MiddlewareNextFunction, C as ClientDataFunctionArgs, b as ServerDataFrom, N as Normalize, c as GetActionData } from '../../routeModules-
|
|
1
|
+
import { R as RouteModule, L as LinkDescriptor, a as Location, P as Pretty, M as MetaDescriptor, G as GetLoaderData, S as ServerDataFunctionArgs, u as unstable_MiddlewareNextFunction, C as ClientDataFunctionArgs, b as ServerDataFrom, N as Normalize, c as GetActionData } from '../../routeModules-BR2FO0ix.js';
|
|
2
2
|
import { R as RouteFiles, P as Pages } from '../../register-DiOIlEq5.js';
|
|
3
3
|
import 'react';
|
|
4
4
|
|
|
@@ -448,14 +448,56 @@ interface DataStrategyMatch extends AgnosticRouteMatch<string, AgnosticDataRoute
|
|
|
448
448
|
handler: Promise<void> | undefined;
|
|
449
449
|
route: Promise<void> | undefined;
|
|
450
450
|
};
|
|
451
|
+
/**
|
|
452
|
+
* A boolean value indicating whether this route handler should be called in this pass.
|
|
453
|
+
*
|
|
454
|
+
* The `matches` array always includes _all_ matched routes even when only _some_
|
|
455
|
+
* route handlers need to be called so that things like middleware can be implemented.
|
|
456
|
+
*
|
|
457
|
+
* `shouldLoad` is usually only interesting if you are skipping the route handler
|
|
458
|
+
* entirely and implementing custom handler logic - since it lets you determine
|
|
459
|
+
* if that custom logic should run for this route or not.
|
|
460
|
+
*
|
|
461
|
+
* For example:
|
|
462
|
+
* - If you are on `/parent/child/a` and you navigate to `/parent/child/b` -
|
|
463
|
+
* you'll get an array of three matches (`[parent, child, b]`), but only `b`
|
|
464
|
+
* will have `shouldLoad=true` because the data for `parent` and `child` is
|
|
465
|
+
* already loaded
|
|
466
|
+
* - If you are on `/parent/child/a` and you submit to `a`'s `action`, then only
|
|
467
|
+
* `a` will have `shouldLoad=true` for the action execution of `dataStrategy`
|
|
468
|
+
* - After the `action`, `dataStrategy` will be called again for the `loader`
|
|
469
|
+
* revalidation, and all matches will have `shouldLoad=true` (assuming no custom
|
|
470
|
+
* `shouldRevalidate` implementations)
|
|
471
|
+
*/
|
|
451
472
|
shouldLoad: boolean;
|
|
452
473
|
unstable_shouldRevalidateArgs: ShouldRevalidateFunctionArgs | null;
|
|
453
474
|
unstable_shouldCallHandler(defaultShouldRevalidate?: boolean): boolean;
|
|
475
|
+
/**
|
|
476
|
+
* An async function that will resolve any `route.lazy` implementations and
|
|
477
|
+
* execute the route's handler (if necessary), returning a `DataStrategyResult`
|
|
478
|
+
*
|
|
479
|
+
* - Calling `match.resolve` does not mean you're calling the `loader`/`action`
|
|
480
|
+
* (the "handler") - `resolve` will only call the `handler` internally if
|
|
481
|
+
* needed _and_ if you don't pass your own `handlerOverride` function parameter
|
|
482
|
+
* - It is safe to call `match.resolve` for all matches, even if they have
|
|
483
|
+
* `shouldLoad=false`, and it will no-op if no loading is required
|
|
484
|
+
* - You should generally always call `match.resolve()` for `shouldLoad:true`
|
|
485
|
+
* routes to ensure that any `route.lazy` implementations are processed
|
|
486
|
+
* - See the examples below for how to implement custom handler execution via
|
|
487
|
+
* `match.resolve`
|
|
488
|
+
*/
|
|
454
489
|
resolve: (handlerOverride?: (handler: (ctx?: unknown) => DataFunctionReturnValue) => DataFunctionReturnValue) => Promise<DataStrategyResult>;
|
|
455
490
|
}
|
|
456
491
|
interface DataStrategyFunctionArgs<Context = DefaultContext> extends DataFunctionArgs<Context> {
|
|
492
|
+
/**
|
|
493
|
+
* Matches for this route extended with Data strategy APIs
|
|
494
|
+
*/
|
|
457
495
|
matches: DataStrategyMatch[];
|
|
458
496
|
unstable_runClientMiddleware: (cb: DataStrategyFunction<Context>) => Promise<Record<string, DataStrategyResult>>;
|
|
497
|
+
/**
|
|
498
|
+
* The key of the fetcher we are calling `dataStrategy` for, otherwise `null`
|
|
499
|
+
* for navigational executions
|
|
500
|
+
*/
|
|
459
501
|
fetcherKey: string | null;
|
|
460
502
|
}
|
|
461
503
|
/**
|
|
@@ -1092,8 +1134,12 @@ interface GetScrollPositionFunction {
|
|
|
1092
1134
|
(): number;
|
|
1093
1135
|
}
|
|
1094
1136
|
/**
|
|
1095
|
-
|
|
1096
|
-
|
|
1137
|
+
* - "route": relative to the route hierarchy so `..` means remove all segments
|
|
1138
|
+
* of the current route even if it has many. For example, a `route("posts/:id")`
|
|
1139
|
+
* would have both `:id` and `posts` removed from the url.
|
|
1140
|
+
* - "path": relative to the pathname so `..` means remove one segment of the
|
|
1141
|
+
* pathname. For example, a `route("posts/:id")` would have only `:id` removed
|
|
1142
|
+
* from the url.
|
|
1097
1143
|
*/
|
|
1098
1144
|
type RelativeRoutingType = "route" | "path";
|
|
1099
1145
|
type BaseNavigateOrFetchOptions = {
|
package/dist/{production/routeModules-g5PTiDfO.d.ts → development/routeModules-BR2FO0ix.d.ts}
RENAMED
|
@@ -448,14 +448,56 @@ interface DataStrategyMatch extends AgnosticRouteMatch<string, AgnosticDataRoute
|
|
|
448
448
|
handler: Promise<void> | undefined;
|
|
449
449
|
route: Promise<void> | undefined;
|
|
450
450
|
};
|
|
451
|
+
/**
|
|
452
|
+
* A boolean value indicating whether this route handler should be called in this pass.
|
|
453
|
+
*
|
|
454
|
+
* The `matches` array always includes _all_ matched routes even when only _some_
|
|
455
|
+
* route handlers need to be called so that things like middleware can be implemented.
|
|
456
|
+
*
|
|
457
|
+
* `shouldLoad` is usually only interesting if you are skipping the route handler
|
|
458
|
+
* entirely and implementing custom handler logic - since it lets you determine
|
|
459
|
+
* if that custom logic should run for this route or not.
|
|
460
|
+
*
|
|
461
|
+
* For example:
|
|
462
|
+
* - If you are on `/parent/child/a` and you navigate to `/parent/child/b` -
|
|
463
|
+
* you'll get an array of three matches (`[parent, child, b]`), but only `b`
|
|
464
|
+
* will have `shouldLoad=true` because the data for `parent` and `child` is
|
|
465
|
+
* already loaded
|
|
466
|
+
* - If you are on `/parent/child/a` and you submit to `a`'s `action`, then only
|
|
467
|
+
* `a` will have `shouldLoad=true` for the action execution of `dataStrategy`
|
|
468
|
+
* - After the `action`, `dataStrategy` will be called again for the `loader`
|
|
469
|
+
* revalidation, and all matches will have `shouldLoad=true` (assuming no custom
|
|
470
|
+
* `shouldRevalidate` implementations)
|
|
471
|
+
*/
|
|
451
472
|
shouldLoad: boolean;
|
|
452
473
|
unstable_shouldRevalidateArgs: ShouldRevalidateFunctionArgs | null;
|
|
453
474
|
unstable_shouldCallHandler(defaultShouldRevalidate?: boolean): boolean;
|
|
475
|
+
/**
|
|
476
|
+
* An async function that will resolve any `route.lazy` implementations and
|
|
477
|
+
* execute the route's handler (if necessary), returning a `DataStrategyResult`
|
|
478
|
+
*
|
|
479
|
+
* - Calling `match.resolve` does not mean you're calling the `loader`/`action`
|
|
480
|
+
* (the "handler") - `resolve` will only call the `handler` internally if
|
|
481
|
+
* needed _and_ if you don't pass your own `handlerOverride` function parameter
|
|
482
|
+
* - It is safe to call `match.resolve` for all matches, even if they have
|
|
483
|
+
* `shouldLoad=false`, and it will no-op if no loading is required
|
|
484
|
+
* - You should generally always call `match.resolve()` for `shouldLoad:true`
|
|
485
|
+
* routes to ensure that any `route.lazy` implementations are processed
|
|
486
|
+
* - See the examples below for how to implement custom handler execution via
|
|
487
|
+
* `match.resolve`
|
|
488
|
+
*/
|
|
454
489
|
resolve: (handlerOverride?: (handler: (ctx?: unknown) => DataFunctionReturnValue) => DataFunctionReturnValue) => Promise<DataStrategyResult>;
|
|
455
490
|
}
|
|
456
491
|
interface DataStrategyFunctionArgs<Context = DefaultContext> extends DataFunctionArgs<Context> {
|
|
492
|
+
/**
|
|
493
|
+
* Matches for this route extended with Data strategy APIs
|
|
494
|
+
*/
|
|
457
495
|
matches: DataStrategyMatch[];
|
|
458
496
|
unstable_runClientMiddleware: (cb: DataStrategyFunction<Context>) => Promise<Record<string, DataStrategyResult>>;
|
|
497
|
+
/**
|
|
498
|
+
* The key of the fetcher we are calling `dataStrategy` for, otherwise `null`
|
|
499
|
+
* for navigational executions
|
|
500
|
+
*/
|
|
459
501
|
fetcherKey: string | null;
|
|
460
502
|
}
|
|
461
503
|
/**
|
|
@@ -1092,8 +1134,12 @@ interface GetScrollPositionFunction {
|
|
|
1092
1134
|
(): number;
|
|
1093
1135
|
}
|
|
1094
1136
|
/**
|
|
1095
|
-
|
|
1096
|
-
|
|
1137
|
+
* - "route": relative to the route hierarchy so `..` means remove all segments
|
|
1138
|
+
* of the current route even if it has many. For example, a `route("posts/:id")`
|
|
1139
|
+
* would have both `:id` and `posts` removed from the url.
|
|
1140
|
+
* - "path": relative to the pathname so `..` means remove one segment of the
|
|
1141
|
+
* pathname. For example, a `route("posts/:id")` would have only `:id` removed
|
|
1142
|
+
* from the url.
|
|
1097
1143
|
*/
|
|
1098
1144
|
type RelativeRoutingType = "route" | "path";
|
|
1099
1145
|
type BaseNavigateOrFetchOptions = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { u as unstable_RouterContextProvider, i as ActionFunction, C as ClientActionFunction, j as ClientLoaderFunction, k as HeadersFunction, l as LinksFunction, m as LoaderFunction, M as MetaFunction, S as ShouldRevalidateFunction, c as Location, h as Params } from './route-data-
|
|
3
|
+
import { u as unstable_RouterContextProvider, i as ActionFunction, C as ClientActionFunction, j as ClientLoaderFunction, k as HeadersFunction, l as LinksFunction, m as LoaderFunction, M as MetaFunction, S as ShouldRevalidateFunction, c as Location, h as Params } from './route-data-CqEmXQub.mjs';
|
|
4
4
|
|
|
5
5
|
type ServerContext = {
|
|
6
6
|
redirect?: Response;
|
|
@@ -104,6 +104,67 @@ type DecodeReplyFunction = (reply: FormData | string, { temporaryReferences }: {
|
|
|
104
104
|
temporaryReferences: unknown;
|
|
105
105
|
}) => Promise<unknown[]>;
|
|
106
106
|
type LoadServerActionFunction = (id: string) => Promise<Function>;
|
|
107
|
+
/**
|
|
108
|
+
* Matches the given routes to a Request and returns a RSC Response encoding an
|
|
109
|
+
* `RSCPayload` for consumption by a RSC enabled client router.
|
|
110
|
+
*
|
|
111
|
+
* @example
|
|
112
|
+
* import {
|
|
113
|
+
* createTemporaryReferenceSet,
|
|
114
|
+
* decodeAction,
|
|
115
|
+
* decodeReply,
|
|
116
|
+
* loadServerAction,
|
|
117
|
+
* renderToReadableStream,
|
|
118
|
+
* } from "@vitejs/plugin-rsc/rsc";
|
|
119
|
+
* import { unstable_matchRSCServerRequest as matchRSCServerRequest } from "react-router";
|
|
120
|
+
*
|
|
121
|
+
* matchRSCServerRequest({
|
|
122
|
+
* createTemporaryReferenceSet,
|
|
123
|
+
* decodeAction,
|
|
124
|
+
* decodeFormState,
|
|
125
|
+
* decodeReply,
|
|
126
|
+
* loadServerAction,
|
|
127
|
+
* request,
|
|
128
|
+
* routes: routes(),
|
|
129
|
+
* generateResponse(match) {
|
|
130
|
+
* return new Response(
|
|
131
|
+
* renderToReadableStream(match.payload),
|
|
132
|
+
* {
|
|
133
|
+
* status: match.statusCode,
|
|
134
|
+
* headers: match.headers,
|
|
135
|
+
* }
|
|
136
|
+
* );
|
|
137
|
+
* },
|
|
138
|
+
* });
|
|
139
|
+
*
|
|
140
|
+
* @name unstable_matchRSCServerRequest
|
|
141
|
+
* @public
|
|
142
|
+
* @category RSC
|
|
143
|
+
* @mode data
|
|
144
|
+
* @param opts Options
|
|
145
|
+
* @param opts.basename The basename to use when matching the request.
|
|
146
|
+
* @param opts.decodeAction Your `react-server-dom-xyz/server`'s `decodeAction`
|
|
147
|
+
* function, responsible for loading a server action.
|
|
148
|
+
* @param opts.decodeReply Your `react-server-dom-xyz/server`'s `decodeReply`
|
|
149
|
+
* function, used to decode the server function's arguments and bind them to the
|
|
150
|
+
* implementation for invocation by the router.
|
|
151
|
+
* @param opts.decodeFormState A function responsible for decoding form state for
|
|
152
|
+
* progressively enhanceable forms with `useActionState` using your
|
|
153
|
+
* `react-server-dom-xyz/server`'s `decodeFormState`.
|
|
154
|
+
* @param opts.generateResponse A function responsible for using your
|
|
155
|
+
* `renderToReadableStream` to generate a Response encoding the `RSCPayload`.
|
|
156
|
+
* @param opts.loadServerAction Your `react-server-dom-xyz/server`'s
|
|
157
|
+
* `loadServerAction` function, used to load a server action by ID.
|
|
158
|
+
* @param opts.request The request to match against.
|
|
159
|
+
* @param opts.requestContext An instance of `unstable_RouterContextProvider`
|
|
160
|
+
* that should be created per request, to be passed to loaders, actions and middleware.
|
|
161
|
+
* @param opts.routes Your route definitions.
|
|
162
|
+
* @param opts.createTemporaryReferenceSet A function that returns a temporary
|
|
163
|
+
* reference set for the request, used to track temporary references in the RSC stream.
|
|
164
|
+
* @param opts.onError An optional error handler that will be called with any
|
|
165
|
+
* errors that occur during the request processing.
|
|
166
|
+
* @returns A Response that contains the RSC data for hydration.
|
|
167
|
+
*/
|
|
107
168
|
declare function matchRSCServerRequest({ createTemporaryReferenceSet, basename, decodeReply, requestContext, loadServerAction, decodeAction, decodeFormState, onError, request, routes, generateResponse, }: {
|
|
108
169
|
createTemporaryReferenceSet: () => unknown;
|
|
109
170
|
basename?: string;
|
|
@@ -125,6 +186,41 @@ declare global {
|
|
|
125
186
|
__FLIGHT_DATA: any[];
|
|
126
187
|
}
|
|
127
188
|
}
|
|
189
|
+
/**
|
|
190
|
+
* Get the prerendered RSC stream for hydration. Usually passed directly to your
|
|
191
|
+
* `react-server-dom-xyz/client`'s `createFromReadableStream`.
|
|
192
|
+
*
|
|
193
|
+
* @example
|
|
194
|
+
* import { startTransition, StrictMode } from "react";
|
|
195
|
+
* import { hydrateRoot } from "react-dom/client";
|
|
196
|
+
* import {
|
|
197
|
+
* unstable_getRSCStream as getRSCStream,
|
|
198
|
+
* unstable_RSCHydratedRouter as RSCHydratedRouter,
|
|
199
|
+
* } from "react-router";
|
|
200
|
+
* import type { unstable_RSCPayload as RSCPayload } from "react-router";
|
|
201
|
+
*
|
|
202
|
+
* createFromReadableStream(getRSCStream()).then(
|
|
203
|
+
* (payload: RSCServerPayload) => {
|
|
204
|
+
* startTransition(async () => {
|
|
205
|
+
* hydrateRoot(
|
|
206
|
+
* document,
|
|
207
|
+
* <StrictMode>
|
|
208
|
+
* <RSCHydratedRouter ...props />
|
|
209
|
+
* </StrictMode>,
|
|
210
|
+
* {
|
|
211
|
+
* // Options
|
|
212
|
+
* }
|
|
213
|
+
* );
|
|
214
|
+
* });
|
|
215
|
+
* }
|
|
216
|
+
* );
|
|
217
|
+
*
|
|
218
|
+
* @name unstable_getRSCStream
|
|
219
|
+
* @public
|
|
220
|
+
* @category RSC
|
|
221
|
+
* @mode data
|
|
222
|
+
* @returns A `ReadableStream` that contains the RSC data for hydration.
|
|
223
|
+
*/
|
|
128
224
|
declare function getRSCStream(): ReadableStream<any>;
|
|
129
225
|
|
|
130
226
|
export { type DecodeActionFunction as D, type LoadServerActionFunction as L, type RSCPayload as R, type DecodeFormStateFunction as a, type DecodeReplyFunction as b, type RSCManifestPayload as c, type RSCMatch as d, type RSCRenderPayload as e, type RSCRouteManifest as f, getRSCStream as g, type RSCRouteMatch as h, type RSCRouteConfigEntry as i, type RSCRouteConfig as j, matchRSCServerRequest as m };
|
|
@@ -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 _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } 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.7.0
|
|
2
|
+
* react-router v7.7.1-pre.0
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Remix Software Inc.
|
|
5
5
|
*
|
|
@@ -2305,9 +2305,7 @@ function createRouter(init) {
|
|
|
2305
2305
|
)
|
|
2306
2306
|
};
|
|
2307
2307
|
} else {
|
|
2308
|
-
dataResults[routeId] = await convertDataStrategyResultToDataResult(
|
|
2309
|
-
result
|
|
2310
|
-
);
|
|
2308
|
+
dataResults[routeId] = await convertDataStrategyResultToDataResult(result);
|
|
2311
2309
|
}
|
|
2312
2310
|
}
|
|
2313
2311
|
return dataResults;
|
|
@@ -4163,7 +4161,10 @@ async function callDataStrategyImpl(dataStrategyImpl, request, matches, fetcherK
|
|
|
4163
4161
|
});
|
|
4164
4162
|
try {
|
|
4165
4163
|
await Promise.all(
|
|
4166
|
-
matches.flatMap((m) => [
|
|
4164
|
+
matches.flatMap((m) => [
|
|
4165
|
+
_optionalChain([m, 'access', _43 => _43._lazyPromises, 'optionalAccess', _44 => _44.handler]),
|
|
4166
|
+
_optionalChain([m, 'access', _45 => _45._lazyPromises, 'optionalAccess', _46 => _46.route])
|
|
4167
|
+
])
|
|
4167
4168
|
);
|
|
4168
4169
|
} catch (e) {
|
|
4169
4170
|
}
|
|
@@ -5478,8 +5479,10 @@ function encode(input, options) {
|
|
|
5478
5479
|
lastSentIndex++;
|
|
5479
5480
|
} else if (id2 < 0) {
|
|
5480
5481
|
controller.enqueue(
|
|
5481
|
-
textEncoder.encode(
|
|
5482
|
-
|
|
5482
|
+
textEncoder.encode(
|
|
5483
|
+
`${TYPE_ERROR}${deferredId}:${id2}
|
|
5484
|
+
`
|
|
5485
|
+
)
|
|
5483
5486
|
);
|
|
5484
5487
|
} else {
|
|
5485
5488
|
const values = encoder.stringified.slice(lastSentIndex + 1).join(",");
|
|
@@ -6406,68 +6409,71 @@ function _renderMatches(matches, parentMatches = [], dataRouterState = null, fut
|
|
|
6406
6409
|
}
|
|
6407
6410
|
}
|
|
6408
6411
|
}
|
|
6409
|
-
return renderedMatches.reduceRight(
|
|
6410
|
-
|
|
6411
|
-
|
|
6412
|
-
|
|
6413
|
-
|
|
6414
|
-
|
|
6415
|
-
|
|
6416
|
-
|
|
6417
|
-
|
|
6418
|
-
if (
|
|
6419
|
-
|
|
6420
|
-
|
|
6421
|
-
|
|
6422
|
-
|
|
6423
|
-
|
|
6424
|
-
|
|
6425
|
-
|
|
6426
|
-
|
|
6427
|
-
|
|
6428
|
-
|
|
6412
|
+
return renderedMatches.reduceRight(
|
|
6413
|
+
(outlet, match, index) => {
|
|
6414
|
+
let error;
|
|
6415
|
+
let shouldRenderHydrateFallback = false;
|
|
6416
|
+
let errorElement = null;
|
|
6417
|
+
let hydrateFallbackElement = null;
|
|
6418
|
+
if (dataRouterState) {
|
|
6419
|
+
error = errors && match.route.id ? errors[match.route.id] : void 0;
|
|
6420
|
+
errorElement = match.route.errorElement || defaultErrorElement;
|
|
6421
|
+
if (renderFallback) {
|
|
6422
|
+
if (fallbackIndex < 0 && index === 0) {
|
|
6423
|
+
warningOnce(
|
|
6424
|
+
"route-fallback",
|
|
6425
|
+
false,
|
|
6426
|
+
"No `HydrateFallback` element provided to render during initial hydration"
|
|
6427
|
+
);
|
|
6428
|
+
shouldRenderHydrateFallback = true;
|
|
6429
|
+
hydrateFallbackElement = null;
|
|
6430
|
+
} else if (fallbackIndex === index) {
|
|
6431
|
+
shouldRenderHydrateFallback = true;
|
|
6432
|
+
hydrateFallbackElement = match.route.hydrateFallbackElement || null;
|
|
6433
|
+
}
|
|
6429
6434
|
}
|
|
6430
6435
|
}
|
|
6431
|
-
|
|
6432
|
-
|
|
6433
|
-
|
|
6434
|
-
|
|
6435
|
-
|
|
6436
|
-
|
|
6437
|
-
|
|
6438
|
-
|
|
6439
|
-
|
|
6440
|
-
|
|
6441
|
-
|
|
6442
|
-
|
|
6443
|
-
|
|
6444
|
-
|
|
6445
|
-
|
|
6446
|
-
|
|
6447
|
-
|
|
6436
|
+
let matches2 = parentMatches.concat(renderedMatches.slice(0, index + 1));
|
|
6437
|
+
let getChildren = () => {
|
|
6438
|
+
let children;
|
|
6439
|
+
if (error) {
|
|
6440
|
+
children = errorElement;
|
|
6441
|
+
} else if (shouldRenderHydrateFallback) {
|
|
6442
|
+
children = hydrateFallbackElement;
|
|
6443
|
+
} else if (match.route.Component) {
|
|
6444
|
+
children = /* @__PURE__ */ React3.createElement(match.route.Component, null);
|
|
6445
|
+
} else if (match.route.element) {
|
|
6446
|
+
children = match.route.element;
|
|
6447
|
+
} else {
|
|
6448
|
+
children = outlet;
|
|
6449
|
+
}
|
|
6450
|
+
return /* @__PURE__ */ React3.createElement(
|
|
6451
|
+
RenderedRoute,
|
|
6452
|
+
{
|
|
6453
|
+
match,
|
|
6454
|
+
routeContext: {
|
|
6455
|
+
outlet,
|
|
6456
|
+
matches: matches2,
|
|
6457
|
+
isDataRoute: dataRouterState != null
|
|
6458
|
+
},
|
|
6459
|
+
children
|
|
6460
|
+
}
|
|
6461
|
+
);
|
|
6462
|
+
};
|
|
6463
|
+
return dataRouterState && (match.route.ErrorBoundary || match.route.errorElement || index === 0) ? /* @__PURE__ */ React3.createElement(
|
|
6464
|
+
RenderErrorBoundary,
|
|
6448
6465
|
{
|
|
6449
|
-
|
|
6450
|
-
|
|
6451
|
-
|
|
6452
|
-
|
|
6453
|
-
|
|
6454
|
-
}
|
|
6455
|
-
children
|
|
6466
|
+
location: dataRouterState.location,
|
|
6467
|
+
revalidation: dataRouterState.revalidation,
|
|
6468
|
+
component: errorElement,
|
|
6469
|
+
error,
|
|
6470
|
+
children: getChildren(),
|
|
6471
|
+
routeContext: { outlet: null, matches: matches2, isDataRoute: true }
|
|
6456
6472
|
}
|
|
6457
|
-
);
|
|
6458
|
-
}
|
|
6459
|
-
|
|
6460
|
-
|
|
6461
|
-
{
|
|
6462
|
-
location: dataRouterState.location,
|
|
6463
|
-
revalidation: dataRouterState.revalidation,
|
|
6464
|
-
component: errorElement,
|
|
6465
|
-
error,
|
|
6466
|
-
children: getChildren(),
|
|
6467
|
-
routeContext: { outlet: null, matches: matches2, isDataRoute: true }
|
|
6468
|
-
}
|
|
6469
|
-
) : getChildren();
|
|
6470
|
-
}, null);
|
|
6473
|
+
) : getChildren();
|
|
6474
|
+
},
|
|
6475
|
+
null
|
|
6476
|
+
);
|
|
6471
6477
|
}
|
|
6472
6478
|
function getDataRouterConsoleError(hookName) {
|
|
6473
6479
|
return `${hookName} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
|
|
@@ -7630,10 +7636,7 @@ function Links() {
|
|
|
7630
7636
|
({ key, link }) => isPageLinkDescriptor(link) ? /* @__PURE__ */ React7.createElement(PrefetchPageLinks, { key, ...link }) : /* @__PURE__ */ React7.createElement("link", { key, ...link })
|
|
7631
7637
|
));
|
|
7632
7638
|
}
|
|
7633
|
-
function PrefetchPageLinks({
|
|
7634
|
-
page,
|
|
7635
|
-
...dataLinkProps
|
|
7636
|
-
}) {
|
|
7639
|
+
function PrefetchPageLinks({ page, ...linkProps }) {
|
|
7637
7640
|
let { router } = useDataRouterContext2();
|
|
7638
7641
|
let matches = React7.useMemo(
|
|
7639
7642
|
() => matchRoutes(router.routes, page, router.basename),
|
|
@@ -7642,7 +7645,7 @@ function PrefetchPageLinks({
|
|
|
7642
7645
|
if (!matches) {
|
|
7643
7646
|
return null;
|
|
7644
7647
|
}
|
|
7645
|
-
return /* @__PURE__ */ React7.createElement(PrefetchPageLinksImpl, { page, matches, ...
|
|
7648
|
+
return /* @__PURE__ */ React7.createElement(PrefetchPageLinksImpl, { page, matches, ...linkProps });
|
|
7646
7649
|
}
|
|
7647
7650
|
function useKeyedPrefetchLinks(matches) {
|
|
7648
7651
|
let { manifest, routeModules } = useFrameworkContext();
|
|
@@ -7846,7 +7849,7 @@ function isValidMetaTag(tagName) {
|
|
|
7846
7849
|
return typeof tagName === "string" && /^(meta|link)$/.test(tagName);
|
|
7847
7850
|
}
|
|
7848
7851
|
var isHydrated = false;
|
|
7849
|
-
function Scripts(
|
|
7852
|
+
function Scripts(scriptProps) {
|
|
7850
7853
|
let {
|
|
7851
7854
|
manifest,
|
|
7852
7855
|
serverHandoffString,
|
|
@@ -7932,7 +7935,7 @@ import(${JSON.stringify(manifest.entry.module)});`;
|
|
|
7932
7935
|
return /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(
|
|
7933
7936
|
"script",
|
|
7934
7937
|
{
|
|
7935
|
-
...
|
|
7938
|
+
...scriptProps,
|
|
7936
7939
|
suppressHydrationWarning: true,
|
|
7937
7940
|
dangerouslySetInnerHTML: createHtml(contextScript),
|
|
7938
7941
|
type: void 0
|
|
@@ -7940,7 +7943,7 @@ import(${JSON.stringify(manifest.entry.module)});`;
|
|
|
7940
7943
|
), /* @__PURE__ */ React7.createElement(
|
|
7941
7944
|
"script",
|
|
7942
7945
|
{
|
|
7943
|
-
...
|
|
7946
|
+
...scriptProps,
|
|
7944
7947
|
suppressHydrationWarning: true,
|
|
7945
7948
|
dangerouslySetInnerHTML: createHtml(routeModulesScript),
|
|
7946
7949
|
type: "module",
|
|
@@ -7977,7 +7980,7 @@ import(${JSON.stringify(manifest.entry.module)});`;
|
|
|
7977
7980
|
{
|
|
7978
7981
|
rel: "modulepreload",
|
|
7979
7982
|
href: manifest.url,
|
|
7980
|
-
crossOrigin:
|
|
7983
|
+
crossOrigin: scriptProps.crossOrigin,
|
|
7981
7984
|
integrity: sri[manifest.url],
|
|
7982
7985
|
suppressHydrationWarning: true
|
|
7983
7986
|
}
|
|
@@ -7986,7 +7989,7 @@ import(${JSON.stringify(manifest.entry.module)});`;
|
|
|
7986
7989
|
{
|
|
7987
7990
|
rel: "modulepreload",
|
|
7988
7991
|
href: manifest.entry.module,
|
|
7989
|
-
crossOrigin:
|
|
7992
|
+
crossOrigin: scriptProps.crossOrigin,
|
|
7990
7993
|
integrity: sri[manifest.entry.module],
|
|
7991
7994
|
suppressHydrationWarning: true
|
|
7992
7995
|
}
|
|
@@ -7996,7 +7999,7 @@ import(${JSON.stringify(manifest.entry.module)});`;
|
|
|
7996
7999
|
key: path,
|
|
7997
8000
|
rel: "modulepreload",
|
|
7998
8001
|
href: path,
|
|
7999
|
-
crossOrigin:
|
|
8002
|
+
crossOrigin: scriptProps.crossOrigin,
|
|
8000
8003
|
integrity: sri[path],
|
|
8001
8004
|
suppressHydrationWarning: true
|
|
8002
8005
|
}
|