INDIE UNPKG

2.78 kBTypeScriptView Raw
1
2import { ActionFunctionArgs, LoaderFunctionArgs, RouterContextProvider } from "../router/utils.js";
3import { AssetsManifest, CriticalCss, EntryContext, FutureConfig } from "../dom/ssr/entry.js";
4import { ServerRouteManifest } from "./routes.js";
5import { ServerInstrumentation } from "../router/instrumentation.js";
6
7//#region lib/server-runtime/build.d.ts
8type OptionalCriticalCss = CriticalCss | undefined;
9/**
10 * The output of the compiler for the server build.
11 */
12interface 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 * @deprecated This is now done via a custom header during prerendering
42 */
43 isSpaMode: boolean;
44 prerender: string[];
45 routeDiscovery: {
46 mode: "lazy" | "initial";
47 manifestPath: string;
48 };
49 allowedActionOrigins?: string[] | false;
50}
51interface HandleDocumentRequestFunction {
52 (request: Request, responseStatusCode: number, responseHeaders: Headers, context: EntryContext, loadContext: RouterContextProvider): Promise<Response> | Response;
53}
54interface 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}
61interface 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 * A module that serves as the entry point for a Remix app during server
70 * rendering.
71 */
72interface ServerEntryModule {
73 default: HandleDocumentRequestFunction;
74 handleDataRequest?: HandleDataRequestFunction;
75 handleError?: HandleErrorFunction;
76 instrumentations?: ServerInstrumentation[];
77 streamTimeout?: number;
78}
79//#endregion
80export { HandleDataRequestFunction, HandleDocumentRequestFunction, HandleErrorFunction, ServerBuild, ServerEntryModule };
\No newline at end of file