| 1 |
|
| 2 | import { ActionFunctionArgs, LoaderFunctionArgs, RouterContextProvider } from "../router/utils.js";
|
| 3 | import { AssetsManifest, CriticalCss, EntryContext, FutureConfig } from "../dom/ssr/entry.js";
|
| 4 | import { ServerRouteManifest } from "./routes.js";
|
| 5 | import { ServerInstrumentation } from "../router/instrumentation.js";
|
| 6 |
|
| 7 |
|
| 8 | type OptionalCriticalCss = CriticalCss | undefined;
|
| 9 | |
| 10 | |
| 11 |
|
| 12 | interface ServerBuild {
|
| 13 | entry: {
|
| 14 | module: ServerEntryModule;
|
| 15 | };
|
| 16 | routes: ServerRouteManifest;
|
| 17 | assets: AssetsManifest;
|
| 18 | basename?: string;
|
| 19 | publicPath: string;
|
| 20 | assetsBuildDirectory: string;
|
| 21 | future: FutureConfig;
|
| 22 | /**
|
| 23 | * Whether runtime server requests are supported, including API-only builds.
|
| 24 | */
|
| 25 | ssr: boolean;
|
| 26 | /**
|
| 27 | * The origin to use for server requests in API-only mode.
|
| 28 | * @internal
|
| 29 | */
|
| 30 | unstable_apiServerOrigin?: string;
|
| 31 | /**
|
| 32 | * Whether production document rendering is disabled while data and route
|
| 33 | * discovery requests remain supported.
|
| 34 | * @internal
|
| 35 | */
|
| 36 | unstable_apiOnly?: boolean;
|
| 37 | unstable_getCriticalCss?: (args: {
|
| 38 | pathname: string;
|
| 39 | }) => OptionalCriticalCss | Promise<OptionalCriticalCss>;
|
| 40 | |
| 41 | |
| 42 |
|
| 43 | isSpaMode: boolean;
|
| 44 | prerender: string[];
|
| 45 | routeDiscovery: {
|
| 46 | mode: "lazy" | "initial";
|
| 47 | manifestPath: string;
|
| 48 | };
|
| 49 | allowedActionOrigins?: string[] | false;
|
| 50 | }
|
| 51 | interface HandleDocumentRequestFunction {
|
| 52 | (request: Request, responseStatusCode: number, responseHeaders: Headers, context: EntryContext, loadContext: RouterContextProvider): Promise<Response> | Response;
|
| 53 | }
|
| 54 | interface HandleDataRequestFunction {
|
| 55 | (response: Response, args: {
|
| 56 | request: LoaderFunctionArgs["request"] | ActionFunctionArgs["request"];
|
| 57 | context: LoaderFunctionArgs["context"] | ActionFunctionArgs["context"];
|
| 58 | params: LoaderFunctionArgs["params"] | ActionFunctionArgs["params"];
|
| 59 | }): Promise<Response> | Response;
|
| 60 | }
|
| 61 | interface HandleErrorFunction {
|
| 62 | (error: unknown, args: {
|
| 63 | request: LoaderFunctionArgs["request"] | ActionFunctionArgs["request"];
|
| 64 | context: LoaderFunctionArgs["context"] | ActionFunctionArgs["context"];
|
| 65 | params: LoaderFunctionArgs["params"] | ActionFunctionArgs["params"];
|
| 66 | }): void;
|
| 67 | }
|
| 68 | |
| 69 | |
| 70 | |
| 71 |
|
| 72 | interface ServerEntryModule {
|
| 73 | default: HandleDocumentRequestFunction;
|
| 74 | handleDataRequest?: HandleDataRequestFunction;
|
| 75 | handleError?: HandleErrorFunction;
|
| 76 | instrumentations?: ServerInstrumentation[];
|
| 77 | streamTimeout?: number;
|
| 78 | }
|
| 79 |
|
| 80 | export { HandleDataRequestFunction, HandleDocumentRequestFunction, HandleErrorFunction, ServerBuild, ServerEntryModule }; |
| \ | No newline at end of file |