UNPKG

3.52 kBTypeScriptView Raw
1/// <reference types="node" />
2import { IncomingMessage, ServerResponse } from 'http';
3import { UrlWithParsedQuery } from 'url';
4import { CustomRoutes } from '../lib/load-custom-routes';
5import { __ApiPreviewProps } from '../next-server/server/api-utils';
6import Server, { ServerConstructor } from '../next-server/server/next-server';
7import { Params } from '../next-server/server/router';
8import { NextConfig } from '../next-server/server/config';
9export default class DevServer extends Server {
10 private devReady;
11 private setDevReady?;
12 private webpackWatcher?;
13 private hotReloader?;
14 private isCustomServer;
15 protected sortedRoutes?: string[];
16 protected staticPathsWorker: import('jest-worker').Worker & {
17 loadStaticPaths: typeof import('./static-paths-worker').loadStaticPaths;
18 };
19 constructor(options: ServerConstructor & {
20 conf: NextConfig;
21 isNextDevCommand?: boolean;
22 });
23 protected readBuildId(): string;
24 addExportPathMapRoutes(): Promise<void>;
25 startWatcher(): Promise<void>;
26 stopWatcher(): Promise<void>;
27 prepare(): Promise<void>;
28 protected close(): Promise<void>;
29 protected hasPage(pathname: string): Promise<boolean>;
30 protected _beforeCatchAllRender(req: IncomingMessage, res: ServerResponse, params: Params, parsedUrl: UrlWithParsedQuery): Promise<boolean>;
31 run(req: IncomingMessage, res: ServerResponse, parsedUrl: UrlWithParsedQuery): Promise<void>;
32 protected getCustomRoutes(): CustomRoutes;
33 private _devCachedPreviewProps;
34 protected getPreviewProps(): __ApiPreviewProps;
35 generateRoutes(): {
36 basePath: string;
37 headers: import("../next-server/server/router").Route[];
38 rewrites: {
39 beforeFiles: import("../next-server/server/router").Route[];
40 afterFiles: import("../next-server/server/router").Route[];
41 fallback: import("../next-server/server/router").Route[];
42 };
43 redirects: import("../next-server/server/router").Route[];
44 catchAllRoute: import("../next-server/server/router").Route;
45 pageChecker: import("../next-server/server/router").PageChecker;
46 useFileSystemPublicRoutes: boolean;
47 dynamicRoutes: import("../next-server/server/router").DynamicRoutes | undefined;
48 locales: string[];
49 fsRoutes: import("../next-server/server/router").Route[];
50 };
51 protected generatePublicRoutes(): never[];
52 protected getDynamicRoutes(): never[];
53 _filterAmpDevelopmentScript(html: string, event: {
54 line: number;
55 col: number;
56 code: string;
57 }): boolean;
58 protected getStaticPaths(pathname: string): Promise<{
59 staticPaths: string[] | undefined;
60 fallbackMode: false | 'static' | 'blocking';
61 }>;
62 protected ensureApiPage(pathname: string): Promise<any>;
63 renderToHTML(req: IncomingMessage, res: ServerResponse, pathname: string, query: {
64 [key: string]: string;
65 }): Promise<string | null>;
66 renderErrorToHTML(err: Error | null, req: IncomingMessage, res: ServerResponse, pathname: string, query: {
67 [key: string]: string;
68 }): Promise<string | null>;
69 sendHTML(req: IncomingMessage, res: ServerResponse, html: string): Promise<void>;
70 protected setImmutableAssetCacheControl(res: ServerResponse): void;
71 private servePublic;
72 hasPublicFile(path: string): Promise<boolean>;
73 getCompilationError(page: string): Promise<any>;
74 protected isServeableUrl(untrustedFileUrl: string): boolean;
75}