UNPKG

2.39 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 ssr: boolean;
23 unstable_getCriticalCss?: (args: {
24 pathname: string;
25 }) => OptionalCriticalCss | Promise<OptionalCriticalCss>;
26 /**
27 * @deprecated This is now done via a custom header during prerendering
28 */
29 isSpaMode: boolean;
30 prerender: string[];
31 routeDiscovery: {
32 mode: "lazy" | "initial";
33 manifestPath: string;
34 };
35 allowedActionOrigins?: string[] | false;
36}
37interface HandleDocumentRequestFunction {
38 (request: Request, responseStatusCode: number, responseHeaders: Headers, context: EntryContext, loadContext: RouterContextProvider): Promise<Response> | Response;
39}
40interface HandleDataRequestFunction {
41 (response: Response, args: {
42 request: LoaderFunctionArgs["request"] | ActionFunctionArgs["request"];
43 context: LoaderFunctionArgs["context"] | ActionFunctionArgs["context"];
44 params: LoaderFunctionArgs["params"] | ActionFunctionArgs["params"];
45 }): Promise<Response> | Response;
46}
47interface HandleErrorFunction {
48 (error: unknown, args: {
49 request: LoaderFunctionArgs["request"] | ActionFunctionArgs["request"];
50 context: LoaderFunctionArgs["context"] | ActionFunctionArgs["context"];
51 params: LoaderFunctionArgs["params"] | ActionFunctionArgs["params"];
52 }): void;
53}
54/**
55 * A module that serves as the entry point for a Remix app during server
56 * rendering.
57 */
58interface ServerEntryModule {
59 default: HandleDocumentRequestFunction;
60 handleDataRequest?: HandleDataRequestFunction;
61 handleError?: HandleErrorFunction;
62 instrumentations?: ServerInstrumentation[];
63 streamTimeout?: number;
64}
65//#endregion
66export { HandleDataRequestFunction, HandleDocumentRequestFunction, HandleErrorFunction, ServerBuild, ServerEntryModule };
\No newline at end of file