UNPKG

page-with

Version:

A library for usage example-driven in-browser testing of your own libraries.

49 lines (48 loc) 1.44 kB
/// <reference types="node" /> import { AddressInfo } from 'net'; import * as express from 'express'; import { Chunk, Configuration } from 'webpack'; export interface ServerOptions { router?(app: express.Express): void; webpackConfig?: Configuration; compileInMemory?: boolean; } interface ServerConnectionInfo { port: number; host: string; url: string; family: AddressInfo['family']; } interface PageOptions { title?: string; markup?: string; } interface PageContext { previewUrl: string; } export declare class PreviewServer { private options; private baseWebpackConfig; private memoryFs; private app; private connection; private cache; private pages; private log; connectionInfo: ServerConnectionInfo | null; setOption<Name extends keyof ServerOptions>(name: Name, value: ServerOptions[Name]): void; constructor(options?: ServerOptions); private initSettings; listen(port?: number, host?: string): Promise<ServerConnectionInfo>; compile(entryPath?: string): Promise<Set<Chunk>>; private createPreviewUrl; createContext(entryPath: string, options: PageOptions): PageContext; use(middleware: (app: express.Express) => void): () => void; close(): Promise<void>; private applyMiddleware; private applyContentBaseMiddleware; private applyMemoryFsMiddleware; private applyRoutes; private renderHtml; } export {};