react-router 0.0.0-experimental-b588f7e → 0.0.0-experimental-23decd7bc
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/browser-CmIT056Z.d.mts +154 -0
- package/dist/development/chunk-3E3CD4NY.mjs +2669 -0
- package/dist/development/{chunk-3HOZPCHX.mjs → chunk-GJVCYY62.mjs} +1445 -3021
- package/dist/development/chunk-H2M6MMUH.js +10007 -0
- package/dist/development/chunk-I3MHZ4NU.js +21 -0
- package/dist/development/components-CwtESh53.d.mts +816 -0
- package/dist/development/dom-export.d.mts +4 -2
- package/dist/development/dom-export.js +53 -72
- package/dist/development/dom-export.mjs +7 -4
- package/dist/development/index-react-server-client-CzKQ01cq.d.mts +1360 -0
- package/dist/development/{lib-oW7CoPA6.d.mts → index-react-server-client-unV28389.d.ts} +39 -39
- package/dist/development/index-react-server-client.d.mts +4 -0
- package/dist/development/index-react-server-client.d.ts +3 -0
- package/dist/development/index-react-server-client.js +54 -0
- package/dist/development/index-react-server-client.mjs +53 -0
- package/dist/development/index-react-server.d.mts +1861 -0
- package/dist/development/index-react-server.d.ts +1861 -0
- package/dist/development/index-react-server.js +3137 -0
- package/dist/development/index-react-server.mjs +3025 -0
- package/dist/development/index.d.mts +32 -46
- package/dist/development/index.d.ts +191 -2223
- package/dist/development/index.js +2577 -11464
- package/dist/development/index.mjs +33 -22
- package/dist/development/lib/types/internal.d.mts +8 -72
- package/dist/development/lib/types/internal.d.ts +8 -71
- package/dist/development/lib/types/internal.js +2 -20
- package/dist/development/lib/types/internal.mjs +1 -1
- package/dist/{production/register-DeIo2iHO.d.mts → development/register-DiOIlEq5.d.mts} +1 -1
- package/dist/development/{register-DeIo2iHO.d.mts → register-DiOIlEq5.d.ts} +1 -1
- package/dist/development/{route-data-ByAYLHuM.d.mts → route-data-Csr8hE3v.d.mts} +80 -3
- package/dist/{production/register-DCE0tH5m.d.ts → development/route-data-x_b_BLCv.d.ts} +90 -36
- package/dist/production/browser-CmIT056Z.d.mts +154 -0
- package/dist/production/chunk-7TUGB72O.js +10007 -0
- package/dist/production/chunk-I3MHZ4NU.js +21 -0
- package/dist/production/chunk-XNTCWHOK.mjs +2669 -0
- package/dist/production/{chunk-UROK22QK.mjs → chunk-YWCG2M57.mjs} +1445 -3021
- package/dist/production/components-CwtESh53.d.mts +816 -0
- package/dist/production/dom-export.d.mts +4 -2
- package/dist/production/dom-export.js +53 -72
- package/dist/production/dom-export.mjs +7 -4
- package/dist/production/index-react-server-client-CzKQ01cq.d.mts +1360 -0
- package/dist/production/{lib-oW7CoPA6.d.mts → index-react-server-client-unV28389.d.ts} +39 -39
- package/dist/production/index-react-server-client.d.mts +4 -0
- package/dist/production/index-react-server-client.d.ts +3 -0
- package/dist/production/index-react-server-client.js +54 -0
- package/dist/production/index-react-server-client.mjs +53 -0
- package/dist/production/index-react-server.d.mts +1861 -0
- package/dist/production/index-react-server.d.ts +1861 -0
- package/dist/production/index-react-server.js +3137 -0
- package/dist/production/index-react-server.mjs +3025 -0
- package/dist/production/index.d.mts +32 -46
- package/dist/production/index.d.ts +191 -2223
- package/dist/production/index.js +2577 -11464
- package/dist/production/index.mjs +33 -22
- package/dist/production/lib/types/internal.d.mts +8 -72
- package/dist/production/lib/types/internal.d.ts +8 -71
- package/dist/production/lib/types/internal.js +2 -20
- package/dist/production/lib/types/internal.mjs +1 -1
- package/dist/production/register-DiOIlEq5.d.mts +24 -0
- package/dist/production/register-DiOIlEq5.d.ts +24 -0
- package/dist/{development/register-DCE0tH5m.d.ts → production/route-data-Csr8hE3v.d.mts} +80 -26
- package/dist/production/{route-data-ByAYLHuM.d.mts → route-data-x_b_BLCv.d.ts} +90 -13
- package/package.json +49 -10
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ComponentType, ReactElement } from 'react';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* An augmentable interface users can modify in their app-code to opt into
|
|
6
|
+
* future-flag-specific types
|
|
7
|
+
*/
|
|
8
|
+
interface Future {
|
|
9
|
+
}
|
|
10
|
+
type MiddlewareEnabled = Future extends {
|
|
11
|
+
unstable_middleware: infer T extends boolean;
|
|
12
|
+
} ? T : false;
|
|
13
|
+
|
|
4
14
|
/**
|
|
5
15
|
* Actions represent the type of change to a location value.
|
|
6
16
|
*/
|
|
@@ -206,16 +216,6 @@ type UrlHistoryOptions = {
|
|
|
206
216
|
v5Compat?: boolean;
|
|
207
217
|
};
|
|
208
218
|
|
|
209
|
-
/**
|
|
210
|
-
* An augmentable interface users can modify in their app-code to opt into
|
|
211
|
-
* future-flag-specific types
|
|
212
|
-
*/
|
|
213
|
-
interface Future {
|
|
214
|
-
}
|
|
215
|
-
type MiddlewareEnabled = Future extends {
|
|
216
|
-
unstable_middleware: infer T extends boolean;
|
|
217
|
-
} ? T : false;
|
|
218
|
-
|
|
219
219
|
type MaybePromise<T> = T | Promise<T>;
|
|
220
220
|
/**
|
|
221
221
|
* Map of routeId -> data returned from a loader/action/error
|
|
@@ -912,8 +912,11 @@ interface Router {
|
|
|
912
912
|
* @param routeId The parent route id or a callback function accepting `patch`
|
|
913
913
|
* to perform batch patching
|
|
914
914
|
* @param children The additional children routes
|
|
915
|
+
* @param unstable_allowElementMutations Allow mutation or route elements on
|
|
916
|
+
* existing routes. Intended for RSC-usage
|
|
917
|
+
* only.
|
|
915
918
|
*/
|
|
916
|
-
patchRoutes(routeId: string | null, children: AgnosticRouteObject[]): void;
|
|
919
|
+
patchRoutes(routeId: string | null, children: AgnosticRouteObject[], unstable_allowElementMutations?: boolean): void;
|
|
917
920
|
/**
|
|
918
921
|
* @private
|
|
919
922
|
* PRIVATE - DO NOT USE
|
|
@@ -922,6 +925,13 @@ interface Router {
|
|
|
922
925
|
* TODO: Replace this with granular route update APIs (addRoute, updateRoute, deleteRoute)
|
|
923
926
|
*/
|
|
924
927
|
_internalSetRoutes(routes: AgnosticRouteObject[]): void;
|
|
928
|
+
/**
|
|
929
|
+
* @private
|
|
930
|
+
* PRIVATE - DO NOT USE
|
|
931
|
+
*
|
|
932
|
+
* Cause subscribers to re-render. This is used to force a re-render.
|
|
933
|
+
*/
|
|
934
|
+
_internalSetStateDoNotUseOrYouWillBreakYourApp(state: Partial<RouterState>): void;
|
|
925
935
|
/**
|
|
926
936
|
* @private
|
|
927
937
|
* PRIVATE - DO NOT USE
|
|
@@ -1045,6 +1055,7 @@ interface StaticHandler {
|
|
|
1045
1055
|
skipRevalidation?: boolean;
|
|
1046
1056
|
dataStrategy?: DataStrategyFunction<unknown>;
|
|
1047
1057
|
unstable_respond?: (staticContext: StaticHandlerContext) => MaybePromise<Response>;
|
|
1058
|
+
unstable_stream?: (context: unstable_RouterContextProvider, query: (r: Request) => Promise<StaticHandlerContext | Response>) => MaybePromise<Response>;
|
|
1048
1059
|
}): Promise<StaticHandlerContext | Response>;
|
|
1049
1060
|
queryRoute(request: Request, opts?: {
|
|
1050
1061
|
routeId?: string;
|
|
@@ -1767,7 +1778,73 @@ type ClientData<T> = T extends Response ? never : T extends DataWithResponseInit
|
|
|
1767
1778
|
type ServerData<T> = T extends Response ? never : T extends DataWithResponseInit<infer U> ? Serialize<U> : Serialize<T>;
|
|
1768
1779
|
type ServerDataFrom<T> = ServerData<DataFrom<T>>;
|
|
1769
1780
|
type ClientDataFrom<T> = ClientData<DataFrom<T>>;
|
|
1770
|
-
type
|
|
1781
|
+
type ClientDataFunctionArgs<Params> = {
|
|
1782
|
+
/**
|
|
1783
|
+
* A {@link https://developer.mozilla.org/en-US/docs/Web/API/Request Fetch Request instance} which you can use to read the URL, the method, the "content-type" header, and the request body from the request.
|
|
1784
|
+
*
|
|
1785
|
+
* @note Because client data functions are called before a network request is made, the Request object does not include the headers which the browser automatically adds. React Router infers the "content-type" header from the enc-type of the form that performed the submission.
|
|
1786
|
+
**/
|
|
1787
|
+
request: Request;
|
|
1788
|
+
/**
|
|
1789
|
+
* {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
|
|
1790
|
+
* @example
|
|
1791
|
+
* // app/routes.ts
|
|
1792
|
+
* route("teams/:teamId", "./team.tsx"),
|
|
1793
|
+
*
|
|
1794
|
+
* // app/team.tsx
|
|
1795
|
+
* export function clientLoader({
|
|
1796
|
+
* params,
|
|
1797
|
+
* }: Route.ClientLoaderArgs) {
|
|
1798
|
+
* params.teamId;
|
|
1799
|
+
* // ^ string
|
|
1800
|
+
* }
|
|
1801
|
+
**/
|
|
1802
|
+
params: Params;
|
|
1803
|
+
/**
|
|
1804
|
+
* When `future.unstable_middleware` is not enabled, this is undefined.
|
|
1805
|
+
*
|
|
1806
|
+
* When `future.unstable_middleware` is enabled, this is an instance of
|
|
1807
|
+
* `unstable_RouterContextProvider` and can be used to access context values
|
|
1808
|
+
* from your route middlewares. You may pass in initial context values in your
|
|
1809
|
+
* `<HydratedRouter unstable_getContext>` prop
|
|
1810
|
+
*/
|
|
1811
|
+
context: unstable_RouterContextProvider;
|
|
1812
|
+
};
|
|
1813
|
+
type ServerDataFunctionArgs<Params> = {
|
|
1814
|
+
/** 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. */
|
|
1815
|
+
request: Request;
|
|
1816
|
+
/**
|
|
1817
|
+
* {@link https://reactrouter.com/start/framework/routing#dynamic-segments Dynamic route params} for the current route.
|
|
1818
|
+
* @example
|
|
1819
|
+
* // app/routes.ts
|
|
1820
|
+
* route("teams/:teamId", "./team.tsx"),
|
|
1821
|
+
*
|
|
1822
|
+
* // app/team.tsx
|
|
1823
|
+
* export function loader({
|
|
1824
|
+
* params,
|
|
1825
|
+
* }: Route.LoaderArgs) {
|
|
1826
|
+
* params.teamId;
|
|
1827
|
+
* // ^ string
|
|
1828
|
+
* }
|
|
1829
|
+
**/
|
|
1830
|
+
params: Params;
|
|
1831
|
+
/**
|
|
1832
|
+
* Without `future.unstable_middleware` enabled, this is the context passed in
|
|
1833
|
+
* to your server adapter's `getLoadContext` function. It's a way to bridge the
|
|
1834
|
+
* gap between the adapter's request/response API with your React Router app.
|
|
1835
|
+
* It is only applicable if you are using a custom server adapter.
|
|
1836
|
+
*
|
|
1837
|
+
* With `future.unstable_middleware` enabled, this is an instance of
|
|
1838
|
+
* `unstable_RouterContextProvider` and can be used for type-safe access to
|
|
1839
|
+
* context value set in your route middlewares. If you are using a custom
|
|
1840
|
+
* server adapter, you may provide an initial set of context values from your
|
|
1841
|
+
* `getLoadContext` function.
|
|
1842
|
+
*/
|
|
1843
|
+
context: MiddlewareEnabled extends true ? unstable_RouterContextProvider : AppLoadContext;
|
|
1844
|
+
};
|
|
1845
|
+
type SerializeFrom<T> = T extends (...args: infer Args) => unknown ? Args extends [
|
|
1846
|
+
ClientLoaderFunctionArgs | ClientActionFunctionArgs | ClientDataFunctionArgs<unknown>
|
|
1847
|
+
] ? ClientDataFrom<T> : ServerDataFrom<T> : T;
|
|
1771
1848
|
type IsDefined<T> = Equal<T, undefined> extends true ? false : true;
|
|
1772
1849
|
type IsHydrate<ClientLoader> = ClientLoader extends {
|
|
1773
1850
|
hydrate: true;
|
|
@@ -1790,27 +1867,4 @@ type _DataActionData<ServerActionData, ClientActionData> = Awaited<[
|
|
|
1790
1867
|
IsDefined<ClientActionData>
|
|
1791
1868
|
] extends [true, true] ? ServerActionData | ClientActionData : IsDefined<ClientActionData> extends true ? ClientActionData : IsDefined<ServerActionData> extends true ? ServerActionData : undefined>;
|
|
1792
1869
|
|
|
1793
|
-
|
|
1794
|
-
* Apps can use this interface to "register" app-wide types for React Router via interface declaration merging and module augmentation.
|
|
1795
|
-
* React Router should handle this for you via type generation.
|
|
1796
|
-
*
|
|
1797
|
-
* For more on declaration merging and module augmentation, see https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation .
|
|
1798
|
-
*/
|
|
1799
|
-
interface Register {
|
|
1800
|
-
}
|
|
1801
|
-
type AnyParams = Record<string, string | undefined>;
|
|
1802
|
-
type AnyPages = Record<string, {
|
|
1803
|
-
params: AnyParams;
|
|
1804
|
-
}>;
|
|
1805
|
-
type Pages = Register extends {
|
|
1806
|
-
pages: infer Registered extends AnyPages;
|
|
1807
|
-
} ? Registered : AnyPages;
|
|
1808
|
-
type AnyRouteFiles = Record<string, {
|
|
1809
|
-
id: string;
|
|
1810
|
-
page: string;
|
|
1811
|
-
}>;
|
|
1812
|
-
type RouteFiles = Register extends {
|
|
1813
|
-
routeFiles: infer Registered extends AnyRouteFiles;
|
|
1814
|
-
} ? Registered : AnyRouteFiles;
|
|
1815
|
-
|
|
1816
|
-
export { type Equal as $, type AppLoadContext as A, type BlockerFunction as B, type ClientLoaderFunction as C, type DataRouteObject as D, type PageLinkDescriptor as E, type FutureConfig as F, type History as G, type HydrationState as H, type InitialEntry as I, type GetScrollRestorationKeyFunction as J, type Fetcher as K, type LoaderFunctionArgs as L, type MiddlewareEnabled as M, type NavigateOptions as N, type StaticHandler as O, type ParamParseKey as P, type CreateStaticHandlerOptions as Q, type RouteManifest as R, type ServerRouteModule as S, type To as T, type UIMatch as U, type unstable_InitialContext as V, type LoaderFunction as W, type ActionFunction as X, type MetaFunction as Y, type LinksFunction as Z, type Pages as _, type ActionFunctionArgs as a, type GetLoaderData as a$, type RouterState as a0, type GetScrollPositionFunction as a1, type NavigationStates as a2, type RouterSubscriber as a3, type RouterNavigateOptions as a4, type RouterFetchOptions as a5, type RevalidationState as a6, type DataStrategyFunctionArgs as a7, type DataStrategyMatch as a8, type DataStrategyResult as a9, type ClientActionFunction as aA, type ClientActionFunctionArgs as aB, type ClientLoaderFunctionArgs as aC, type HeadersArgs as aD, type HeadersFunction as aE, type MetaArgs as aF, type MetaDescriptor as aG, type HtmlLinkDescriptor as aH, type LinkDescriptor as aI, type Future as aJ, type unstable_SerializesTo as aK, type Register as aL, createBrowserHistory as aM, invariant as aN, createRouter as aO, ErrorResponseImpl as aP, DataRouterContext as aQ, DataRouterStateContext as aR, FetchersContext as aS, LocationContext as aT, NavigationContext as aU, RouteContext as aV, ViewTransitionContext as aW, type RouteModule as aX, type unstable_MiddlewareNextFunction as aY, type ServerDataFrom as aZ, type Pretty as a_, DataWithResponseInit as aa, type ErrorResponse as ab, type FormMethod as ac, type unstable_MiddlewareFunction as ad, type PathParam as ae, type RedirectFunction as af, type unstable_RouterContext as ag, type ShouldRevalidateFunction as ah, type ShouldRevalidateFunctionArgs as ai, unstable_createContext as aj, createPath as ak, parsePath as al, IDLE_NAVIGATION as am, IDLE_FETCHER as an, IDLE_BLOCKER as ao, data as ap, generatePath as aq, isRouteErrorResponse as ar, matchPath as as, matchRoutes as at, redirect as au, redirectDocument as av, replace as aw, resolvePath as ax, type DataRouteMatch as ay, type PatchRoutesOnNavigationFunctionArgs as az, type StaticHandlerContext as b, type RouteFiles as b0, type Normalize as b1, type GetActionData as b2, type RouteModules as c, type Router as d, type DataStrategyFunction as e, type RelativeRoutingType as f, type Location as g, Action as h, type Path as i, type PathPattern as j, type PathMatch as k, type Params as l, type RouteObject as m, type Navigation as n, type SerializeFrom as o, type Blocker as p, type RouterInit as q, type PatchRoutesOnNavigationFunction as r, type NonIndexRouteObject as s, type LazyRouteFunction as t, unstable_RouterContextProvider as u, type IndexRouteObject as v, type Navigator as w, type RouteMatch as x, type HTMLFormMethod as y, type FormEncType as z };
|
|
1870
|
+
export { type DataStrategyFunctionArgs as $, type ActionFunction as A, type StaticHandlerContext as B, type ClientDataFunctionArgs as C, type DataStrategyFunction as D, type Equal as E, type Fetcher as F, type GetLoaderData as G, type HydrationState as H, type InitialEntry as I, type Navigation as J, type NavigationStates as K, type LinkDescriptor as L, type MetaDescriptor as M, type Normalize as N, type RelativeRoutingType as O, type Pretty as P, type Blocker as Q, type RouteModule as R, type ServerDataFunctionArgs as S, type To as T, type BlockerFunction as U, type RouterInit as V, type RouterSubscriber as W, type RouterNavigateOptions as X, type RouterFetchOptions as Y, type RevalidationState as Z, type ActionFunctionArgs as _, type Location as a, type FutureConfig as a$, type DataStrategyMatch as a0, type DataStrategyResult as a1, DataWithResponseInit as a2, type ErrorResponse as a3, type FormEncType as a4, type FormMethod as a5, type HTMLFormMethod as a6, type LazyRouteFunction as a7, type LoaderFunctionArgs as a8, type unstable_MiddlewareFunction as a9, type NavigateOptions as aA, type Navigator as aB, type PatchRoutesOnNavigationFunctionArgs as aC, type RouteMatch as aD, type RouteObject as aE, type ClientActionFunctionArgs as aF, type ClientLoaderFunctionArgs as aG, type HeadersArgs as aH, type MetaArgs as aI, type PageLinkDescriptor as aJ, type HtmlLinkDescriptor as aK, type Future as aL, type unstable_SerializesTo as aM, createBrowserHistory as aN, invariant as aO, createRouter as aP, ErrorResponseImpl as aQ, DataRouterContext as aR, DataRouterStateContext as aS, FetchersContext as aT, LocationContext as aU, NavigationContext as aV, RouteContext as aW, ViewTransitionContext as aX, type RouteManifest as aY, type ServerRouteModule as aZ, type SerializeFrom as a_, type ParamParseKey as aa, type PathMatch as ab, type PathParam as ac, type PathPattern as ad, type RedirectFunction as ae, type unstable_RouterContext as af, type ShouldRevalidateFunctionArgs as ag, type UIMatch as ah, unstable_createContext as ai, unstable_RouterContextProvider as aj, Action as ak, createPath as al, parsePath as am, IDLE_NAVIGATION as an, IDLE_FETCHER as ao, IDLE_BLOCKER as ap, data as aq, generatePath as ar, isRouteErrorResponse as as, matchPath as at, matchRoutes as au, redirect as av, redirectDocument as aw, replace as ax, resolvePath as ay, type DataRouteMatch as az, type ServerDataFrom as b, type History as b0, type CreateStaticHandlerOptions as b1, type GetActionData as c, type Router as d, type RouteModules as e, type IndexRouteObject as f, type LoaderFunction as g, type MetaFunction as h, type LinksFunction as i, type NonIndexRouteObject as j, type unstable_InitialContext as k, type MiddlewareEnabled as l, type AppLoadContext as m, type ClientActionFunction as n, type ClientLoaderFunction as o, type HeadersFunction as p, type ShouldRevalidateFunction as q, type Params as r, type RouterState as s, type PatchRoutesOnNavigationFunction as t, type unstable_MiddlewareNextFunction as u, type DataRouteObject as v, type Path as w, type StaticHandler as x, type GetScrollPositionFunction as y, type GetScrollRestorationKeyFunction as z };
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { p as ActionFunction, C as ClientActionFunction, q as ClientLoaderFunction, r as HeadersFunction, s as LinksFunction, t as LoaderFunction, M as MetaFunction, u as ShouldRevalidateFunction, L as Location, g as Params, h as Router } from './route-data-Csr8hE3v.mjs';
|
|
3
|
+
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
4
|
+
|
|
5
|
+
type ServerContext = {
|
|
6
|
+
redirect?: Response;
|
|
7
|
+
};
|
|
8
|
+
declare global {
|
|
9
|
+
var ___reactRouterServerStorage___: AsyncLocalStorage<ServerContext> | undefined;
|
|
10
|
+
}
|
|
11
|
+
type RSCRouteConfigEntryBase = {
|
|
12
|
+
action?: ActionFunction;
|
|
13
|
+
clientAction?: ClientActionFunction;
|
|
14
|
+
clientLoader?: ClientLoaderFunction;
|
|
15
|
+
ErrorBoundary?: React.ComponentType<any>;
|
|
16
|
+
handle?: any;
|
|
17
|
+
headers?: HeadersFunction;
|
|
18
|
+
HydrateFallback?: React.ComponentType<any>;
|
|
19
|
+
Layout?: React.ComponentType<any>;
|
|
20
|
+
links?: LinksFunction;
|
|
21
|
+
loader?: LoaderFunction;
|
|
22
|
+
meta?: MetaFunction;
|
|
23
|
+
shouldRevalidate?: ShouldRevalidateFunction;
|
|
24
|
+
};
|
|
25
|
+
type RSCRouteConfigEntry = RSCRouteConfigEntryBase & {
|
|
26
|
+
id: string;
|
|
27
|
+
path?: string;
|
|
28
|
+
Component?: React.ComponentType<any>;
|
|
29
|
+
lazy?: () => Promise<RSCRouteConfigEntryBase & ({
|
|
30
|
+
default?: React.ComponentType<any>;
|
|
31
|
+
Component?: never;
|
|
32
|
+
} | {
|
|
33
|
+
default?: never;
|
|
34
|
+
Component?: React.ComponentType<any>;
|
|
35
|
+
})>;
|
|
36
|
+
} & ({
|
|
37
|
+
index: true;
|
|
38
|
+
} | {
|
|
39
|
+
children?: RSCRouteConfigEntry[];
|
|
40
|
+
});
|
|
41
|
+
type RSCRouteConfig = Array<RSCRouteConfigEntry>;
|
|
42
|
+
type RSCRouteManifest = {
|
|
43
|
+
clientAction?: ClientActionFunction;
|
|
44
|
+
clientLoader?: ClientLoaderFunction;
|
|
45
|
+
element?: React.ReactElement | false;
|
|
46
|
+
errorElement?: React.ReactElement;
|
|
47
|
+
handle?: any;
|
|
48
|
+
hasAction: boolean;
|
|
49
|
+
hasComponent: boolean;
|
|
50
|
+
hasErrorBoundary: boolean;
|
|
51
|
+
hasLoader: boolean;
|
|
52
|
+
hydrateFallbackElement?: React.ReactElement;
|
|
53
|
+
id: string;
|
|
54
|
+
index?: boolean;
|
|
55
|
+
links?: LinksFunction;
|
|
56
|
+
meta?: MetaFunction;
|
|
57
|
+
parentId?: string;
|
|
58
|
+
path?: string;
|
|
59
|
+
shouldRevalidate?: ShouldRevalidateFunction;
|
|
60
|
+
};
|
|
61
|
+
type RSCRouteMatch = RSCRouteManifest & {
|
|
62
|
+
params: Params;
|
|
63
|
+
pathname: string;
|
|
64
|
+
pathnameBase: string;
|
|
65
|
+
};
|
|
66
|
+
type RSCRenderPayload = {
|
|
67
|
+
type: "render";
|
|
68
|
+
actionData: Record<string, any> | null;
|
|
69
|
+
basename?: string;
|
|
70
|
+
errors: Record<string, any> | null;
|
|
71
|
+
loaderData: Record<string, any>;
|
|
72
|
+
location: Location;
|
|
73
|
+
matches: RSCRouteMatch[];
|
|
74
|
+
patches?: RSCRouteManifest[];
|
|
75
|
+
nonce?: string;
|
|
76
|
+
formState?: unknown;
|
|
77
|
+
};
|
|
78
|
+
type RSCManifestPayload = {
|
|
79
|
+
type: "manifest";
|
|
80
|
+
patches: RSCRouteManifest[];
|
|
81
|
+
};
|
|
82
|
+
type RSCActionPayload = {
|
|
83
|
+
type: "action";
|
|
84
|
+
actionResult: Promise<unknown>;
|
|
85
|
+
rerender?: Promise<RSCRenderPayload | RSCRedirectPayload>;
|
|
86
|
+
};
|
|
87
|
+
type RSCRedirectPayload = {
|
|
88
|
+
type: "redirect";
|
|
89
|
+
status: number;
|
|
90
|
+
location: string;
|
|
91
|
+
replace: boolean;
|
|
92
|
+
reload: boolean;
|
|
93
|
+
actionResult?: Promise<unknown>;
|
|
94
|
+
};
|
|
95
|
+
type RSCPayload = RSCRenderPayload | RSCManifestPayload | RSCActionPayload | RSCRedirectPayload;
|
|
96
|
+
type RSCMatch = {
|
|
97
|
+
statusCode: number;
|
|
98
|
+
headers: Headers;
|
|
99
|
+
payload: RSCPayload;
|
|
100
|
+
};
|
|
101
|
+
type DecodeActionFunction = (formData: FormData) => Promise<() => Promise<void>>;
|
|
102
|
+
type DecodeFormStateFunction = (result: unknown, formData: FormData) => unknown;
|
|
103
|
+
type DecodeReplyFunction = (reply: FormData | string, { temporaryReferences }: {
|
|
104
|
+
temporaryReferences: unknown;
|
|
105
|
+
}) => Promise<unknown[]>;
|
|
106
|
+
type LoadServerActionFunction = (id: string) => Promise<Function>;
|
|
107
|
+
declare function matchRSCServerRequest({ createTemporaryReferenceSet, decodeReply, loadServerAction, decodeAction, decodeFormState, onError, request, routes, generateResponse, }: {
|
|
108
|
+
createTemporaryReferenceSet: () => unknown;
|
|
109
|
+
decodeReply?: DecodeReplyFunction;
|
|
110
|
+
decodeAction?: DecodeActionFunction;
|
|
111
|
+
decodeFormState?: DecodeFormStateFunction;
|
|
112
|
+
loadServerAction?: LoadServerActionFunction;
|
|
113
|
+
onError?: (error: unknown) => void;
|
|
114
|
+
request: Request;
|
|
115
|
+
routes: RSCRouteConfigEntry[];
|
|
116
|
+
generateResponse: (match: RSCMatch, { temporaryReferences, }: {
|
|
117
|
+
temporaryReferences: unknown;
|
|
118
|
+
}) => Response;
|
|
119
|
+
}): Promise<Response>;
|
|
120
|
+
|
|
121
|
+
type BrowserCreateFromReadableStreamFunction = (body: ReadableStream<Uint8Array>, { temporaryReferences, }: {
|
|
122
|
+
temporaryReferences: unknown;
|
|
123
|
+
}) => Promise<unknown>;
|
|
124
|
+
type EncodeReplyFunction = (args: unknown[], options: {
|
|
125
|
+
temporaryReferences: unknown;
|
|
126
|
+
}) => Promise<BodyInit>;
|
|
127
|
+
declare global {
|
|
128
|
+
interface Window {
|
|
129
|
+
__router: Router;
|
|
130
|
+
__routerInitialized: boolean;
|
|
131
|
+
__routerActionID: number;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
declare function createCallServer({ createFromReadableStream, createTemporaryReferenceSet, encodeReply, fetch: fetchImplementation, }: {
|
|
135
|
+
createFromReadableStream: BrowserCreateFromReadableStreamFunction;
|
|
136
|
+
createTemporaryReferenceSet: () => unknown;
|
|
137
|
+
encodeReply: EncodeReplyFunction;
|
|
138
|
+
fetch?: (request: Request) => Promise<Response>;
|
|
139
|
+
}): (id: string, args: unknown[]) => Promise<unknown>;
|
|
140
|
+
declare function RSCHydratedRouter({ createFromReadableStream, fetch: fetchImplementation, payload, routeDiscovery, }: {
|
|
141
|
+
createFromReadableStream: BrowserCreateFromReadableStreamFunction;
|
|
142
|
+
fetch?: (request: Request) => Promise<Response>;
|
|
143
|
+
payload: RSCPayload;
|
|
144
|
+
routeDiscovery?: "eager" | "lazy";
|
|
145
|
+
}): React.JSX.Element;
|
|
146
|
+
|
|
147
|
+
declare global {
|
|
148
|
+
interface Window {
|
|
149
|
+
__FLIGHT_DATA: any[];
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
declare function getRSCStream(): ReadableStream<any>;
|
|
153
|
+
|
|
154
|
+
export { type BrowserCreateFromReadableStreamFunction as B, type DecodeActionFunction as D, type EncodeReplyFunction as E, type LoadServerActionFunction as L, type RSCPayload as R, RSCHydratedRouter as a, type DecodeFormStateFunction as b, createCallServer as c, type DecodeReplyFunction as d, type RSCManifestPayload as e, type RSCMatch as f, getRSCStream as g, type RSCRenderPayload as h, type RSCRouteManifest as i, type RSCRouteMatch as j, type RSCRouteConfigEntry as k, type RSCRouteConfig as l, matchRSCServerRequest as m };
|