react-router 7.7.0 → 7.7.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 +11 -23
- package/dist/development/{browser-CcxeZJcQ.d.mts → browser-7LYX59NK.d.mts} +97 -1
- package/dist/development/{chunk-EF7DTUVF.mjs → chunk-C37GKA54.mjs} +83 -80
- package/dist/development/{chunk-V6PEDDZI.js → chunk-K7YFBME3.js} +79 -76
- package/dist/{production/chunk-GNZILI6H.mjs → development/chunk-KIUJAIYX.mjs} +3 -5
- package/dist/{production/chunk-2TYFPE3B.js → development/chunk-R73PQUJU.js} +132 -132
- 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/{development/chunk-4ADB4KIO.js → production/chunk-4DGLNKXF.js} +132 -132
- package/dist/production/{chunk-5KHO4FML.js → chunk-7OQROU2D.js} +79 -76
- package/dist/production/{chunk-WPPIQDYG.mjs → chunk-IZ57JD2V.mjs} +83 -80
- package/dist/{development/chunk-T3VM44WY.mjs → production/chunk-K3SBCRK4.mjs} +3 -5
- 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,4 +1,4 @@
|
|
|
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 './route-data-
|
|
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-CjQijYga.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-KLg-U4nr.mjs';
|
|
3
|
+
import './route-data-CqEmXQub.mjs';
|
|
4
4
|
import 'react';
|
|
@@ -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,
|
|
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, ay as UNSAFE_WithComponentProps, aC as UNSAFE_WithErrorBoundaryProps, aA as UNSAFE_WithHydrateFallbackProps, Y as unstable_HistoryRouter } from './index-react-server-client-Bi_fx8qz.js';
|
|
2
|
+
import './routeModules-BR2FO0ix.js';
|
|
3
3
|
import 'react';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});/**
|
|
2
|
-
* react-router v7.7.
|
|
2
|
+
* react-router v7.7.1
|
|
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 _chunkR73PQUJUjs = require('./chunk-R73PQUJU.js');
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
|
|
37
|
-
var
|
|
37
|
+
var _chunkK7YFBME3js = require('./chunk-K7YFBME3.js');
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
|
|
@@ -58,4 +58,4 @@ var _chunkV6PEDDZIjs = require('./chunk-V6PEDDZI.js');
|
|
|
58
58
|
|
|
59
59
|
|
|
60
60
|
|
|
61
|
-
exports.Await =
|
|
61
|
+
exports.Await = _chunkR73PQUJUjs.Await; exports.BrowserRouter = _chunkR73PQUJUjs.BrowserRouter; exports.Form = _chunkR73PQUJUjs.Form; exports.HashRouter = _chunkR73PQUJUjs.HashRouter; exports.Link = _chunkR73PQUJUjs.Link; exports.Links = _chunkK7YFBME3js.Links; exports.MemoryRouter = _chunkR73PQUJUjs.MemoryRouter; exports.Meta = _chunkK7YFBME3js.Meta; exports.NavLink = _chunkR73PQUJUjs.NavLink; exports.Navigate = _chunkR73PQUJUjs.Navigate; exports.Outlet = _chunkR73PQUJUjs.Outlet; exports.Route = _chunkR73PQUJUjs.Route; exports.Router = _chunkR73PQUJUjs.Router; exports.RouterProvider = _chunkR73PQUJUjs.RouterProvider; exports.Routes = _chunkR73PQUJUjs.Routes; exports.ScrollRestoration = _chunkR73PQUJUjs.ScrollRestoration; exports.StaticRouter = _chunkR73PQUJUjs.StaticRouter; exports.StaticRouterProvider = _chunkR73PQUJUjs.StaticRouterProvider; exports.UNSAFE_WithComponentProps = _chunkR73PQUJUjs.WithComponentProps; exports.UNSAFE_WithErrorBoundaryProps = _chunkR73PQUJUjs.WithErrorBoundaryProps; exports.UNSAFE_WithHydrateFallbackProps = _chunkR73PQUJUjs.WithHydrateFallbackProps; exports.unstable_HistoryRouter = _chunkR73PQUJUjs.HistoryRouter;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* react-router v7.7.
|
|
2
|
+
* react-router v7.7.1
|
|
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-C37GKA54.mjs";
|
|
36
36
|
export {
|
|
37
37
|
Await,
|
|
38
38
|
BrowserRouter,
|
|
@@ -405,14 +405,56 @@ interface DataStrategyMatch extends AgnosticRouteMatch<string, AgnosticDataRoute
|
|
|
405
405
|
handler: Promise<void> | undefined;
|
|
406
406
|
route: Promise<void> | undefined;
|
|
407
407
|
};
|
|
408
|
+
/**
|
|
409
|
+
* A boolean value indicating whether this route handler should be called in this pass.
|
|
410
|
+
*
|
|
411
|
+
* The `matches` array always includes _all_ matched routes even when only _some_
|
|
412
|
+
* route handlers need to be called so that things like middleware can be implemented.
|
|
413
|
+
*
|
|
414
|
+
* `shouldLoad` is usually only interesting if you are skipping the route handler
|
|
415
|
+
* entirely and implementing custom handler logic - since it lets you determine
|
|
416
|
+
* if that custom logic should run for this route or not.
|
|
417
|
+
*
|
|
418
|
+
* For example:
|
|
419
|
+
* - If you are on `/parent/child/a` and you navigate to `/parent/child/b` -
|
|
420
|
+
* you'll get an array of three matches (`[parent, child, b]`), but only `b`
|
|
421
|
+
* will have `shouldLoad=true` because the data for `parent` and `child` is
|
|
422
|
+
* already loaded
|
|
423
|
+
* - If you are on `/parent/child/a` and you submit to `a`'s `action`, then only
|
|
424
|
+
* `a` will have `shouldLoad=true` for the action execution of `dataStrategy`
|
|
425
|
+
* - After the `action`, `dataStrategy` will be called again for the `loader`
|
|
426
|
+
* revalidation, and all matches will have `shouldLoad=true` (assuming no custom
|
|
427
|
+
* `shouldRevalidate` implementations)
|
|
428
|
+
*/
|
|
408
429
|
shouldLoad: boolean;
|
|
409
430
|
unstable_shouldRevalidateArgs: ShouldRevalidateFunctionArgs | null;
|
|
410
431
|
unstable_shouldCallHandler(defaultShouldRevalidate?: boolean): boolean;
|
|
432
|
+
/**
|
|
433
|
+
* An async function that will resolve any `route.lazy` implementations and
|
|
434
|
+
* execute the route's handler (if necessary), returning a `DataStrategyResult`
|
|
435
|
+
*
|
|
436
|
+
* - Calling `match.resolve` does not mean you're calling the `loader`/`action`
|
|
437
|
+
* (the "handler") - `resolve` will only call the `handler` internally if
|
|
438
|
+
* needed _and_ if you don't pass your own `handlerOverride` function parameter
|
|
439
|
+
* - It is safe to call `match.resolve` for all matches, even if they have
|
|
440
|
+
* `shouldLoad=false`, and it will no-op if no loading is required
|
|
441
|
+
* - You should generally always call `match.resolve()` for `shouldLoad:true`
|
|
442
|
+
* routes to ensure that any `route.lazy` implementations are processed
|
|
443
|
+
* - See the examples below for how to implement custom handler execution via
|
|
444
|
+
* `match.resolve`
|
|
445
|
+
*/
|
|
411
446
|
resolve: (handlerOverride?: (handler: (ctx?: unknown) => DataFunctionReturnValue) => DataFunctionReturnValue) => Promise<DataStrategyResult>;
|
|
412
447
|
}
|
|
413
448
|
interface DataStrategyFunctionArgs<Context = DefaultContext> extends DataFunctionArgs<Context> {
|
|
449
|
+
/**
|
|
450
|
+
* Matches for this route extended with Data strategy APIs
|
|
451
|
+
*/
|
|
414
452
|
matches: DataStrategyMatch[];
|
|
415
453
|
unstable_runClientMiddleware: (cb: DataStrategyFunction<Context>) => Promise<Record<string, DataStrategyResult>>;
|
|
454
|
+
/**
|
|
455
|
+
* The key of the fetcher we are calling `dataStrategy` for, otherwise `null`
|
|
456
|
+
* for navigational executions
|
|
457
|
+
*/
|
|
416
458
|
fetcherKey: string | null;
|
|
417
459
|
}
|
|
418
460
|
/**
|
|
@@ -947,8 +989,12 @@ interface GetScrollPositionFunction {
|
|
|
947
989
|
(): number;
|
|
948
990
|
}
|
|
949
991
|
/**
|
|
950
|
-
|
|
951
|
-
|
|
992
|
+
* - "route": relative to the route hierarchy so `..` means remove all segments
|
|
993
|
+
* of the current route even if it has many. For example, a `route("posts/:id")`
|
|
994
|
+
* would have both `:id` and `posts` removed from the url.
|
|
995
|
+
* - "path": relative to the pathname so `..` means remove one segment of the
|
|
996
|
+
* pathname. For example, a `route("posts/:id")` would have only `:id` removed
|
|
997
|
+
* from the url.
|
|
952
998
|
*/
|
|
953
999
|
type RelativeRoutingType = "route" | "path";
|
|
954
1000
|
type BaseNavigateOrFetchOptions = {
|
|
@@ -1614,6 +1660,67 @@ type DecodeReplyFunction = (reply: FormData | string, { temporaryReferences }: {
|
|
|
1614
1660
|
temporaryReferences: unknown;
|
|
1615
1661
|
}) => Promise<unknown[]>;
|
|
1616
1662
|
type LoadServerActionFunction = (id: string) => Promise<Function>;
|
|
1663
|
+
/**
|
|
1664
|
+
* Matches the given routes to a Request and returns a RSC Response encoding an
|
|
1665
|
+
* `RSCPayload` for consumption by a RSC enabled client router.
|
|
1666
|
+
*
|
|
1667
|
+
* @example
|
|
1668
|
+
* import {
|
|
1669
|
+
* createTemporaryReferenceSet,
|
|
1670
|
+
* decodeAction,
|
|
1671
|
+
* decodeReply,
|
|
1672
|
+
* loadServerAction,
|
|
1673
|
+
* renderToReadableStream,
|
|
1674
|
+
* } from "@vitejs/plugin-rsc/rsc";
|
|
1675
|
+
* import { unstable_matchRSCServerRequest as matchRSCServerRequest } from "react-router";
|
|
1676
|
+
*
|
|
1677
|
+
* matchRSCServerRequest({
|
|
1678
|
+
* createTemporaryReferenceSet,
|
|
1679
|
+
* decodeAction,
|
|
1680
|
+
* decodeFormState,
|
|
1681
|
+
* decodeReply,
|
|
1682
|
+
* loadServerAction,
|
|
1683
|
+
* request,
|
|
1684
|
+
* routes: routes(),
|
|
1685
|
+
* generateResponse(match) {
|
|
1686
|
+
* return new Response(
|
|
1687
|
+
* renderToReadableStream(match.payload),
|
|
1688
|
+
* {
|
|
1689
|
+
* status: match.statusCode,
|
|
1690
|
+
* headers: match.headers,
|
|
1691
|
+
* }
|
|
1692
|
+
* );
|
|
1693
|
+
* },
|
|
1694
|
+
* });
|
|
1695
|
+
*
|
|
1696
|
+
* @name unstable_matchRSCServerRequest
|
|
1697
|
+
* @public
|
|
1698
|
+
* @category RSC
|
|
1699
|
+
* @mode data
|
|
1700
|
+
* @param opts Options
|
|
1701
|
+
* @param opts.basename The basename to use when matching the request.
|
|
1702
|
+
* @param opts.decodeAction Your `react-server-dom-xyz/server`'s `decodeAction`
|
|
1703
|
+
* function, responsible for loading a server action.
|
|
1704
|
+
* @param opts.decodeReply Your `react-server-dom-xyz/server`'s `decodeReply`
|
|
1705
|
+
* function, used to decode the server function's arguments and bind them to the
|
|
1706
|
+
* implementation for invocation by the router.
|
|
1707
|
+
* @param opts.decodeFormState A function responsible for decoding form state for
|
|
1708
|
+
* progressively enhanceable forms with `useActionState` using your
|
|
1709
|
+
* `react-server-dom-xyz/server`'s `decodeFormState`.
|
|
1710
|
+
* @param opts.generateResponse A function responsible for using your
|
|
1711
|
+
* `renderToReadableStream` to generate a Response encoding the `RSCPayload`.
|
|
1712
|
+
* @param opts.loadServerAction Your `react-server-dom-xyz/server`'s
|
|
1713
|
+
* `loadServerAction` function, used to load a server action by ID.
|
|
1714
|
+
* @param opts.request The request to match against.
|
|
1715
|
+
* @param opts.requestContext An instance of `unstable_RouterContextProvider`
|
|
1716
|
+
* that should be created per request, to be passed to loaders, actions and middleware.
|
|
1717
|
+
* @param opts.routes Your route definitions.
|
|
1718
|
+
* @param opts.createTemporaryReferenceSet A function that returns a temporary
|
|
1719
|
+
* reference set for the request, used to track temporary references in the RSC stream.
|
|
1720
|
+
* @param opts.onError An optional error handler that will be called with any
|
|
1721
|
+
* errors that occur during the request processing.
|
|
1722
|
+
* @returns A Response that contains the RSC data for hydration.
|
|
1723
|
+
*/
|
|
1617
1724
|
declare function matchRSCServerRequest({ createTemporaryReferenceSet, basename, decodeReply, requestContext, loadServerAction, decodeAction, decodeFormState, onError, request, routes, generateResponse, }: {
|
|
1618
1725
|
createTemporaryReferenceSet: () => unknown;
|
|
1619
1726
|
basename?: string;
|
|
@@ -405,14 +405,56 @@ interface DataStrategyMatch extends AgnosticRouteMatch<string, AgnosticDataRoute
|
|
|
405
405
|
handler: Promise<void> | undefined;
|
|
406
406
|
route: Promise<void> | undefined;
|
|
407
407
|
};
|
|
408
|
+
/**
|
|
409
|
+
* A boolean value indicating whether this route handler should be called in this pass.
|
|
410
|
+
*
|
|
411
|
+
* The `matches` array always includes _all_ matched routes even when only _some_
|
|
412
|
+
* route handlers need to be called so that things like middleware can be implemented.
|
|
413
|
+
*
|
|
414
|
+
* `shouldLoad` is usually only interesting if you are skipping the route handler
|
|
415
|
+
* entirely and implementing custom handler logic - since it lets you determine
|
|
416
|
+
* if that custom logic should run for this route or not.
|
|
417
|
+
*
|
|
418
|
+
* For example:
|
|
419
|
+
* - If you are on `/parent/child/a` and you navigate to `/parent/child/b` -
|
|
420
|
+
* you'll get an array of three matches (`[parent, child, b]`), but only `b`
|
|
421
|
+
* will have `shouldLoad=true` because the data for `parent` and `child` is
|
|
422
|
+
* already loaded
|
|
423
|
+
* - If you are on `/parent/child/a` and you submit to `a`'s `action`, then only
|
|
424
|
+
* `a` will have `shouldLoad=true` for the action execution of `dataStrategy`
|
|
425
|
+
* - After the `action`, `dataStrategy` will be called again for the `loader`
|
|
426
|
+
* revalidation, and all matches will have `shouldLoad=true` (assuming no custom
|
|
427
|
+
* `shouldRevalidate` implementations)
|
|
428
|
+
*/
|
|
408
429
|
shouldLoad: boolean;
|
|
409
430
|
unstable_shouldRevalidateArgs: ShouldRevalidateFunctionArgs | null;
|
|
410
431
|
unstable_shouldCallHandler(defaultShouldRevalidate?: boolean): boolean;
|
|
432
|
+
/**
|
|
433
|
+
* An async function that will resolve any `route.lazy` implementations and
|
|
434
|
+
* execute the route's handler (if necessary), returning a `DataStrategyResult`
|
|
435
|
+
*
|
|
436
|
+
* - Calling `match.resolve` does not mean you're calling the `loader`/`action`
|
|
437
|
+
* (the "handler") - `resolve` will only call the `handler` internally if
|
|
438
|
+
* needed _and_ if you don't pass your own `handlerOverride` function parameter
|
|
439
|
+
* - It is safe to call `match.resolve` for all matches, even if they have
|
|
440
|
+
* `shouldLoad=false`, and it will no-op if no loading is required
|
|
441
|
+
* - You should generally always call `match.resolve()` for `shouldLoad:true`
|
|
442
|
+
* routes to ensure that any `route.lazy` implementations are processed
|
|
443
|
+
* - See the examples below for how to implement custom handler execution via
|
|
444
|
+
* `match.resolve`
|
|
445
|
+
*/
|
|
411
446
|
resolve: (handlerOverride?: (handler: (ctx?: unknown) => DataFunctionReturnValue) => DataFunctionReturnValue) => Promise<DataStrategyResult>;
|
|
412
447
|
}
|
|
413
448
|
interface DataStrategyFunctionArgs<Context = DefaultContext> extends DataFunctionArgs<Context> {
|
|
449
|
+
/**
|
|
450
|
+
* Matches for this route extended with Data strategy APIs
|
|
451
|
+
*/
|
|
414
452
|
matches: DataStrategyMatch[];
|
|
415
453
|
unstable_runClientMiddleware: (cb: DataStrategyFunction<Context>) => Promise<Record<string, DataStrategyResult>>;
|
|
454
|
+
/**
|
|
455
|
+
* The key of the fetcher we are calling `dataStrategy` for, otherwise `null`
|
|
456
|
+
* for navigational executions
|
|
457
|
+
*/
|
|
416
458
|
fetcherKey: string | null;
|
|
417
459
|
}
|
|
418
460
|
/**
|
|
@@ -947,8 +989,12 @@ interface GetScrollPositionFunction {
|
|
|
947
989
|
(): number;
|
|
948
990
|
}
|
|
949
991
|
/**
|
|
950
|
-
|
|
951
|
-
|
|
992
|
+
* - "route": relative to the route hierarchy so `..` means remove all segments
|
|
993
|
+
* of the current route even if it has many. For example, a `route("posts/:id")`
|
|
994
|
+
* would have both `:id` and `posts` removed from the url.
|
|
995
|
+
* - "path": relative to the pathname so `..` means remove one segment of the
|
|
996
|
+
* pathname. For example, a `route("posts/:id")` would have only `:id` removed
|
|
997
|
+
* from the url.
|
|
952
998
|
*/
|
|
953
999
|
type RelativeRoutingType = "route" | "path";
|
|
954
1000
|
type BaseNavigateOrFetchOptions = {
|
|
@@ -1614,6 +1660,67 @@ type DecodeReplyFunction = (reply: FormData | string, { temporaryReferences }: {
|
|
|
1614
1660
|
temporaryReferences: unknown;
|
|
1615
1661
|
}) => Promise<unknown[]>;
|
|
1616
1662
|
type LoadServerActionFunction = (id: string) => Promise<Function>;
|
|
1663
|
+
/**
|
|
1664
|
+
* Matches the given routes to a Request and returns a RSC Response encoding an
|
|
1665
|
+
* `RSCPayload` for consumption by a RSC enabled client router.
|
|
1666
|
+
*
|
|
1667
|
+
* @example
|
|
1668
|
+
* import {
|
|
1669
|
+
* createTemporaryReferenceSet,
|
|
1670
|
+
* decodeAction,
|
|
1671
|
+
* decodeReply,
|
|
1672
|
+
* loadServerAction,
|
|
1673
|
+
* renderToReadableStream,
|
|
1674
|
+
* } from "@vitejs/plugin-rsc/rsc";
|
|
1675
|
+
* import { unstable_matchRSCServerRequest as matchRSCServerRequest } from "react-router";
|
|
1676
|
+
*
|
|
1677
|
+
* matchRSCServerRequest({
|
|
1678
|
+
* createTemporaryReferenceSet,
|
|
1679
|
+
* decodeAction,
|
|
1680
|
+
* decodeFormState,
|
|
1681
|
+
* decodeReply,
|
|
1682
|
+
* loadServerAction,
|
|
1683
|
+
* request,
|
|
1684
|
+
* routes: routes(),
|
|
1685
|
+
* generateResponse(match) {
|
|
1686
|
+
* return new Response(
|
|
1687
|
+
* renderToReadableStream(match.payload),
|
|
1688
|
+
* {
|
|
1689
|
+
* status: match.statusCode,
|
|
1690
|
+
* headers: match.headers,
|
|
1691
|
+
* }
|
|
1692
|
+
* );
|
|
1693
|
+
* },
|
|
1694
|
+
* });
|
|
1695
|
+
*
|
|
1696
|
+
* @name unstable_matchRSCServerRequest
|
|
1697
|
+
* @public
|
|
1698
|
+
* @category RSC
|
|
1699
|
+
* @mode data
|
|
1700
|
+
* @param opts Options
|
|
1701
|
+
* @param opts.basename The basename to use when matching the request.
|
|
1702
|
+
* @param opts.decodeAction Your `react-server-dom-xyz/server`'s `decodeAction`
|
|
1703
|
+
* function, responsible for loading a server action.
|
|
1704
|
+
* @param opts.decodeReply Your `react-server-dom-xyz/server`'s `decodeReply`
|
|
1705
|
+
* function, used to decode the server function's arguments and bind them to the
|
|
1706
|
+
* implementation for invocation by the router.
|
|
1707
|
+
* @param opts.decodeFormState A function responsible for decoding form state for
|
|
1708
|
+
* progressively enhanceable forms with `useActionState` using your
|
|
1709
|
+
* `react-server-dom-xyz/server`'s `decodeFormState`.
|
|
1710
|
+
* @param opts.generateResponse A function responsible for using your
|
|
1711
|
+
* `renderToReadableStream` to generate a Response encoding the `RSCPayload`.
|
|
1712
|
+
* @param opts.loadServerAction Your `react-server-dom-xyz/server`'s
|
|
1713
|
+
* `loadServerAction` function, used to load a server action by ID.
|
|
1714
|
+
* @param opts.request The request to match against.
|
|
1715
|
+
* @param opts.requestContext An instance of `unstable_RouterContextProvider`
|
|
1716
|
+
* that should be created per request, to be passed to loaders, actions and middleware.
|
|
1717
|
+
* @param opts.routes Your route definitions.
|
|
1718
|
+
* @param opts.createTemporaryReferenceSet A function that returns a temporary
|
|
1719
|
+
* reference set for the request, used to track temporary references in the RSC stream.
|
|
1720
|
+
* @param opts.onError An optional error handler that will be called with any
|
|
1721
|
+
* errors that occur during the request processing.
|
|
1722
|
+
* @returns A Response that contains the RSC data for hydration.
|
|
1723
|
+
*/
|
|
1617
1724
|
declare function matchRSCServerRequest({ createTemporaryReferenceSet, basename, decodeReply, requestContext, loadServerAction, decodeAction, decodeFormState, onError, request, routes, generateResponse, }: {
|
|
1618
1725
|
createTemporaryReferenceSet: () => unknown;
|
|
1619
1726
|
basename?: string;
|
|
@@ -27,7 +27,7 @@ function _interopNamespace(e) {
|
|
|
27
27
|
var React2__namespace = /*#__PURE__*/_interopNamespace(React2);
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
|
-
* react-router v7.7.
|
|
30
|
+
* react-router v7.7.1
|
|
31
31
|
*
|
|
32
32
|
* Copyright (c) Remix Software Inc.
|
|
33
33
|
*
|
|
@@ -1697,7 +1697,10 @@ async function callDataStrategyImpl(dataStrategyImpl, request, matches, fetcherK
|
|
|
1697
1697
|
});
|
|
1698
1698
|
try {
|
|
1699
1699
|
await Promise.all(
|
|
1700
|
-
matches.flatMap((m) => [
|
|
1700
|
+
matches.flatMap((m) => [
|
|
1701
|
+
m._lazyPromises?.handler,
|
|
1702
|
+
m._lazyPromises?.route
|
|
1703
|
+
])
|
|
1701
1704
|
);
|
|
1702
1705
|
} catch (e) {
|
|
1703
1706
|
}
|
|
@@ -2130,6 +2133,7 @@ function prependCookies(parentHeaders, childHeaders) {
|
|
|
2130
2133
|
}
|
|
2131
2134
|
}
|
|
2132
2135
|
var SINGLE_FETCH_REDIRECT_STATUS = 202;
|
|
2136
|
+
var Outlet = reactServerClient.Outlet;
|
|
2133
2137
|
var WithComponentProps = reactServerClient.UNSAFE_WithComponentProps;
|
|
2134
2138
|
var WithErrorBoundaryProps = reactServerClient.UNSAFE_WithErrorBoundaryProps;
|
|
2135
2139
|
var WithHydrateFallbackProps = reactServerClient.UNSAFE_WithHydrateFallbackProps;
|
|
@@ -2532,7 +2536,11 @@ async function generateStaticContextResponse(routes, basename, generateResponse,
|
|
|
2532
2536
|
);
|
|
2533
2537
|
}
|
|
2534
2538
|
staticContext.matches.forEach((m) => {
|
|
2535
|
-
|
|
2539
|
+
const routeHasNoLoaderData = staticContext.loaderData[m.route.id] === void 0;
|
|
2540
|
+
const routeHasError = Boolean(
|
|
2541
|
+
staticContext.errors && m.route.id in staticContext.errors
|
|
2542
|
+
);
|
|
2543
|
+
if (routeHasNoLoaderData && !routeHasError) {
|
|
2536
2544
|
staticContext.loaderData[m.route.id] = null;
|
|
2537
2545
|
}
|
|
2538
2546
|
});
|
|
@@ -2627,23 +2635,23 @@ async function getRSCRouteMatch(staticContext, match, shouldRenderComponent, par
|
|
|
2627
2635
|
const loaderData = staticContext.loaderData[match.route.id];
|
|
2628
2636
|
const actionData = staticContext.actionData?.[match.route.id];
|
|
2629
2637
|
const params = match.params;
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2638
|
+
let element = void 0;
|
|
2639
|
+
if (Component) {
|
|
2640
|
+
element = shouldRenderComponent ? React2__namespace.createElement(
|
|
2641
|
+
Layout,
|
|
2642
|
+
null,
|
|
2643
|
+
isClientReference(Component) ? React2__namespace.createElement(WithComponentProps, {
|
|
2644
|
+
children: React2__namespace.createElement(Component)
|
|
2645
|
+
}) : React2__namespace.createElement(Component, {
|
|
2646
|
+
loaderData,
|
|
2647
|
+
actionData,
|
|
2648
|
+
params,
|
|
2649
|
+
matches: staticContext.matches.map(
|
|
2650
|
+
(match2) => convertRouteMatchToUiMatch(match2, staticContext.loaderData)
|
|
2651
|
+
)
|
|
2652
|
+
})
|
|
2653
|
+
) : React2__namespace.createElement(Outlet);
|
|
2654
|
+
}
|
|
2647
2655
|
let error = void 0;
|
|
2648
2656
|
if (ErrorBoundary && staticContext.errors) {
|
|
2649
2657
|
error = staticContext.errors[match.route.id];
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
2
2
|
import * as React2 from 'react';
|
|
3
3
|
import { splitCookiesString } from 'set-cookie-parser';
|
|
4
|
-
import { UNSAFE_WithComponentProps, UNSAFE_WithErrorBoundaryProps, UNSAFE_WithHydrateFallbackProps } from 'react-router/internal/react-server-client';
|
|
4
|
+
import { UNSAFE_WithComponentProps, Outlet as Outlet$1, UNSAFE_WithErrorBoundaryProps, UNSAFE_WithHydrateFallbackProps } from 'react-router/internal/react-server-client';
|
|
5
5
|
export { Await, BrowserRouter, Form, HashRouter, Link, Links, MemoryRouter, Meta, NavLink, Navigate, Outlet, Route, Router, RouterProvider, Routes, ScrollRestoration, StaticRouter, StaticRouterProvider, unstable_HistoryRouter } from 'react-router/internal/react-server-client';
|
|
6
6
|
import { serialize, parse } from 'cookie';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* react-router v7.7.
|
|
9
|
+
* react-router v7.7.1
|
|
10
10
|
*
|
|
11
11
|
* Copyright (c) Remix Software Inc.
|
|
12
12
|
*
|
|
@@ -1676,7 +1676,10 @@ async function callDataStrategyImpl(dataStrategyImpl, request, matches, fetcherK
|
|
|
1676
1676
|
});
|
|
1677
1677
|
try {
|
|
1678
1678
|
await Promise.all(
|
|
1679
|
-
matches.flatMap((m) => [
|
|
1679
|
+
matches.flatMap((m) => [
|
|
1680
|
+
m._lazyPromises?.handler,
|
|
1681
|
+
m._lazyPromises?.route
|
|
1682
|
+
])
|
|
1680
1683
|
);
|
|
1681
1684
|
} catch (e) {
|
|
1682
1685
|
}
|
|
@@ -2109,6 +2112,7 @@ function prependCookies(parentHeaders, childHeaders) {
|
|
|
2109
2112
|
}
|
|
2110
2113
|
}
|
|
2111
2114
|
var SINGLE_FETCH_REDIRECT_STATUS = 202;
|
|
2115
|
+
var Outlet = Outlet$1;
|
|
2112
2116
|
var WithComponentProps = UNSAFE_WithComponentProps;
|
|
2113
2117
|
var WithErrorBoundaryProps = UNSAFE_WithErrorBoundaryProps;
|
|
2114
2118
|
var WithHydrateFallbackProps = UNSAFE_WithHydrateFallbackProps;
|
|
@@ -2511,7 +2515,11 @@ async function generateStaticContextResponse(routes, basename, generateResponse,
|
|
|
2511
2515
|
);
|
|
2512
2516
|
}
|
|
2513
2517
|
staticContext.matches.forEach((m) => {
|
|
2514
|
-
|
|
2518
|
+
const routeHasNoLoaderData = staticContext.loaderData[m.route.id] === void 0;
|
|
2519
|
+
const routeHasError = Boolean(
|
|
2520
|
+
staticContext.errors && m.route.id in staticContext.errors
|
|
2521
|
+
);
|
|
2522
|
+
if (routeHasNoLoaderData && !routeHasError) {
|
|
2515
2523
|
staticContext.loaderData[m.route.id] = null;
|
|
2516
2524
|
}
|
|
2517
2525
|
});
|
|
@@ -2606,23 +2614,23 @@ async function getRSCRouteMatch(staticContext, match, shouldRenderComponent, par
|
|
|
2606
2614
|
const loaderData = staticContext.loaderData[match.route.id];
|
|
2607
2615
|
const actionData = staticContext.actionData?.[match.route.id];
|
|
2608
2616
|
const params = match.params;
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2617
|
+
let element = void 0;
|
|
2618
|
+
if (Component) {
|
|
2619
|
+
element = shouldRenderComponent ? React2.createElement(
|
|
2620
|
+
Layout,
|
|
2621
|
+
null,
|
|
2622
|
+
isClientReference(Component) ? React2.createElement(WithComponentProps, {
|
|
2623
|
+
children: React2.createElement(Component)
|
|
2624
|
+
}) : React2.createElement(Component, {
|
|
2625
|
+
loaderData,
|
|
2626
|
+
actionData,
|
|
2627
|
+
params,
|
|
2628
|
+
matches: staticContext.matches.map(
|
|
2629
|
+
(match2) => convertRouteMatchToUiMatch(match2, staticContext.loaderData)
|
|
2630
|
+
)
|
|
2631
|
+
})
|
|
2632
|
+
) : React2.createElement(Outlet);
|
|
2633
|
+
}
|
|
2626
2634
|
let error = void 0;
|
|
2627
2635
|
if (ErrorBoundary && staticContext.errors) {
|
|
2628
2636
|
error = staticContext.errors[match.route.id];
|