| 1 |
|
| 2 | import { Location } from "../router/history.js";
|
| 3 | import { ActionFunction, LoaderFunction, Params, RouterContextProvider, ShouldRevalidateFunction } from "../router/utils.js";
|
| 4 | import { ClientActionFunction, ClientLoaderFunction, HeadersFunction, LinksFunction, MetaFunction } from "../dom/ssr/routeModules.js";
|
| 5 | import * as React$1 from "react";
|
| 6 |
|
| 7 |
|
| 8 | declare function getRequest(): Request;
|
| 9 | type RSCRouteConfigEntryBase = {
|
| 10 | action?: ActionFunction;
|
| 11 | clientAction?: ClientActionFunction;
|
| 12 | clientLoader?: ClientLoaderFunction;
|
| 13 | ErrorBoundary?: React$1.ComponentType<any>;
|
| 14 | handle?: any;
|
| 15 | headers?: HeadersFunction;
|
| 16 | HydrateFallback?: React$1.ComponentType<any>;
|
| 17 | Layout?: React$1.ComponentType<any>;
|
| 18 | links?: LinksFunction;
|
| 19 | loader?: LoaderFunction;
|
| 20 | meta?: MetaFunction;
|
| 21 | shouldRevalidate?: ShouldRevalidateFunction;
|
| 22 | };
|
| 23 | type RSCRouteConfigEntry = RSCRouteConfigEntryBase & {
|
| 24 | id: string;
|
| 25 | path?: string;
|
| 26 | Component?: React$1.ComponentType<any>;
|
| 27 | lazy?: () => Promise<RSCRouteConfigEntryBase & ({
|
| 28 | default?: React$1.ComponentType<any>;
|
| 29 | Component?: never;
|
| 30 | } | {
|
| 31 | default?: never;
|
| 32 | Component?: React$1.ComponentType<any>;
|
| 33 | })>;
|
| 34 | } & ({
|
| 35 | index: true;
|
| 36 | } | {
|
| 37 | children?: RSCRouteConfigEntry[];
|
| 38 | });
|
| 39 | type RSCRouteConfig = Array<RSCRouteConfigEntry>;
|
| 40 | type RSCRouteManifest = {
|
| 41 | clientAction?: ClientActionFunction;
|
| 42 | clientLoader?: ClientLoaderFunction;
|
| 43 | element?: React$1.ReactElement | false;
|
| 44 | errorElement?: React$1.ReactElement;
|
| 45 | handle?: any;
|
| 46 | hasAction: boolean;
|
| 47 | hasComponent: boolean;
|
| 48 | hasLoader: boolean;
|
| 49 | hydrateFallbackElement?: React$1.ReactElement;
|
| 50 | id: string;
|
| 51 | index?: boolean;
|
| 52 | links?: LinksFunction;
|
| 53 | meta?: MetaFunction;
|
| 54 | parentId?: string;
|
| 55 | path?: string;
|
| 56 | shouldRevalidate?: ShouldRevalidateFunction;
|
| 57 | };
|
| 58 | type RSCRouteMatch = RSCRouteManifest & {
|
| 59 | params: Params;
|
| 60 | pathname: string;
|
| 61 | pathnameBase: string;
|
| 62 | };
|
| 63 | type RSCRenderPayload = {
|
| 64 | type: "render";
|
| 65 | actionData: Record<string, any> | null;
|
| 66 | basename: string | undefined;
|
| 67 | errors: Record<string, any> | null;
|
| 68 | loaderData: Record<string, any>;
|
| 69 | location: Location;
|
| 70 | routeDiscovery: RouteDiscovery;
|
| 71 | matches: RSCRouteMatch[];
|
| 72 | patches?: Promise<RSCRouteManifest[]>;
|
| 73 | nonce?: string;
|
| 74 | formState?: unknown;
|
| 75 | };
|
| 76 | type RSCManifestPayload = {
|
| 77 | type: "manifest";
|
| 78 | patches: Promise<RSCRouteManifest[]>;
|
| 79 | };
|
| 80 | type RSCActionPayload = {
|
| 81 | type: "action";
|
| 82 | actionResult: Promise<unknown>;
|
| 83 | rerender?: Promise<RSCRenderPayload | RSCRedirectPayload>;
|
| 84 | };
|
| 85 | type RSCRedirectPayload = {
|
| 86 | type: "redirect";
|
| 87 | status: number;
|
| 88 | location: string;
|
| 89 | replace: boolean;
|
| 90 | reload: boolean;
|
| 91 | actionResult?: Promise<unknown>;
|
| 92 | };
|
| 93 | type RSCPayload = RSCRenderPayload | RSCManifestPayload | RSCActionPayload | RSCRedirectPayload;
|
| 94 | type RSCMatch = {
|
| 95 | statusCode: number;
|
| 96 | headers: Headers;
|
| 97 | payload: RSCPayload;
|
| 98 | };
|
| 99 | type DecodeActionFunction = (formData: FormData) => Promise<() => Promise<unknown>>;
|
| 100 | type DecodeFormStateFunction = (result: unknown, formData: FormData) => unknown;
|
| 101 | type DecodeReplyFunction = (reply: FormData | string, options: {
|
| 102 | temporaryReferences: unknown;
|
| 103 | }) => Promise<unknown[]>;
|
| 104 | type LoadServerActionFunction = (id: string) => Promise<Function>;
|
| 105 | type RouteDiscovery = {
|
| 106 | mode: "lazy";
|
| 107 | manifestPath?: string | undefined;
|
| 108 | } | {
|
| 109 | mode: "initial";
|
| 110 | };
|
| 111 | |
| 112 | |
| 113 | |
| 114 | |
| 115 | |
| 116 | |
| 117 | |
| 118 | |
| 119 | |
| 120 | |
| 121 | |
| 122 | |
| 123 | |
| 124 | |
| 125 | |
| 126 | |
| 127 | |
| 128 | |
| 129 | |
| 130 | |
| 131 | |
| 132 | |
| 133 | |
| 134 | |
| 135 | |
| 136 | |
| 137 | |
| 138 | |
| 139 | |
| 140 | |
| 141 | |
| 142 | |
| 143 | |
| 144 | |
| 145 | |
| 146 | |
| 147 | |
| 148 | |
| 149 | |
| 150 | |
| 151 | |
| 152 | |
| 153 | |
| 154 | |
| 155 | |
| 156 | |
| 157 | |
| 158 | |
| 159 | |
| 160 | |
| 161 | |
| 162 | |
| 163 | |
| 164 | |
| 165 | |
| 166 | |
| 167 | |
| 168 | |
| 169 | |
| 170 | |
| 171 | |
| 172 | |
| 173 | |
| 174 | |
| 175 | |
| 176 | |
| 177 | |
| 178 | |
| 179 | |
| 180 | |
| 181 | |
| 182 |
|
| 183 | declare function matchRSCServerRequest({
|
| 184 | allowedActionOrigins,
|
| 185 | createTemporaryReferenceSet,
|
| 186 | basename,
|
| 187 | decodeReply,
|
| 188 | requestContext,
|
| 189 | routeDiscovery,
|
| 190 | loadServerAction,
|
| 191 | decodeAction,
|
| 192 | decodeFormState,
|
| 193 | onError,
|
| 194 | request,
|
| 195 | routes,
|
| 196 | generateResponse
|
| 197 | }: {
|
| 198 | allowedActionOrigins?: string[];
|
| 199 | createTemporaryReferenceSet: () => unknown;
|
| 200 | basename?: string;
|
| 201 | decodeReply?: DecodeReplyFunction;
|
| 202 | decodeAction?: DecodeActionFunction;
|
| 203 | decodeFormState?: DecodeFormStateFunction;
|
| 204 | requestContext?: RouterContextProvider;
|
| 205 | loadServerAction?: LoadServerActionFunction;
|
| 206 | onError?: (error: unknown) => void;
|
| 207 | request: Request;
|
| 208 | routes: RSCRouteConfigEntry[];
|
| 209 | routeDiscovery?: RouteDiscovery;
|
| 210 | generateResponse: (match: RSCMatch, {
|
| 211 | onError,
|
| 212 | temporaryReferences
|
| 213 | }: {
|
| 214 | onError(error: unknown): string | undefined;
|
| 215 | temporaryReferences: unknown;
|
| 216 | }) => Response;
|
| 217 | }): Promise<Response>;
|
| 218 |
|
| 219 | export { DecodeActionFunction, DecodeFormStateFunction, DecodeReplyFunction, LoadServerActionFunction, RSCManifestPayload, RSCMatch, RSCPayload, RSCRenderPayload, RSCRouteConfig, RSCRouteConfigEntry, RSCRouteManifest, RSCRouteMatch, getRequest, matchRSCServerRequest }; |
| \ | No newline at end of file |