import type { createReadStream, existsSync, statSync } from 'node:fs'; import { type IncomingMessage, type Server as HttpServer, type ServerResponse } from 'node:http'; import { type Server as HttpsServer } from 'node:https'; import type { OutputFileSystem } from 'webpack'; import { type CertOption } from '../dev/get-cert.mjs'; export type FileSystem = OutputFileSystem & { existsSync: typeof existsSync; createReadStream: typeof createReadStream; statSync: typeof statSync; }; type HttpServerResponse = ServerResponse & { req: IncomingMessage; }; interface ServerOption { port: number; root_dir: string; fileSystem: FileSystem; onRequest?(req: IncomingMessage, res: HttpServerResponse): boolean | void; headers?: Record; basename?: string; https?: CertOption | boolean; host: string; open?: boolean; } export type Server = HttpServer | HttpsServer; declare function server(option: ServerOption): Promise>; export default server;