UNPKG

1.67 kBTypeScriptView Raw
1/// <reference types="node" />
2import { IncomingMessage, ServerResponse } from 'http';
3import { ParsedUrlQuery } from 'querystring';
4import React from 'react';
5import { __ApiPreviewProps } from './api-utils';
6import { FontManifest } from './font-utils';
7import { LoadComponentsReturnType } from './load-components';
8import { DomainLocales } from './config';
9export declare type RenderOptsPartial = {
10 buildId: string;
11 canonicalBase: string;
12 runtimeConfig?: {
13 [key: string]: any;
14 };
15 assetPrefix?: string;
16 err?: Error | null;
17 nextExport?: boolean;
18 dev?: boolean;
19 ampPath?: string;
20 ErrorDebug?: React.ComponentType<{
21 error: Error;
22 }>;
23 ampValidator?: (html: string, pathname: string) => Promise<void>;
24 ampSkipValidation?: boolean;
25 ampOptimizerConfig?: {
26 [key: string]: any;
27 };
28 isDataReq?: boolean;
29 params?: ParsedUrlQuery;
30 previewProps: __ApiPreviewProps;
31 basePath: string;
32 unstable_runtimeJS?: false;
33 unstable_JsPreload?: false;
34 optimizeFonts: boolean;
35 fontManifest?: FontManifest;
36 optimizeImages: boolean;
37 optimizeCss: any;
38 devOnlyCacheBusterQueryString?: string;
39 resolvedUrl?: string;
40 resolvedAsPath?: string;
41 distDir?: string;
42 locale?: string;
43 locales?: string[];
44 defaultLocale?: string;
45 domainLocales?: DomainLocales;
46 disableOptimizedLoading?: boolean;
47};
48export declare type RenderOpts = LoadComponentsReturnType & RenderOptsPartial;
49export declare function renderToHTML(req: IncomingMessage, res: ServerResponse, pathname: string, query: ParsedUrlQuery, renderOpts: RenderOpts): Promise<string | null>;