///
import { EventEmitter } from 'events';
import * as express from 'express';
import * as webpack from 'webpack';
import { IFs } from 'memfs';
export interface ServerOptions {
before?(app: express.Application): void;
webpackConfig?: Omit;
}
export interface CompilationOptions {
markup?: string;
}
export interface CompilationRecord {
entries: Array;
compilation: Compilation;
options: CompilationOptions;
}
export declare class WebpackHttpServer {
private readonly options;
private app;
private server;
private compilations;
private fs;
constructor(options?: ServerOptions);
get serverUrl(): string;
listen(port?: number, hostname?: string): Promise;
close(): Promise;
compile(entries: Array, options?: CompilationOptions): Promise;
private handleIncrementalBuild;
private renderPreview;
}
export interface CompilationConstructOptions {
app: express.Application;
serverUrl: string;
fs?: IFs;
}
export declare type CompilationState = 'active' | 'disposed';
export declare class Compilation extends EventEmitter {
private options;
id: string;
state: CompilationState;
previewUrl: string;
previewRoute: string;
stats?: webpack.Stats;
private compilers;
static createPreviewRoute(compilationId: string): string;
static createPreviewUrl(compilationId: string, serverUrl: string | URL): URL;
constructor(options: CompilationConstructOptions);
compile(webpackConfig: webpack.Configuration): Promise;
use(routes: (router: express.Router) => void): void;
/**
* Disposes of this compilation, freeing memory occupied
* by the webpack compilers.
*/
dispose(): Promise;
}