UNPKG

1.6 kBTypeScriptView Raw
1// Type definitions for webpack-hot-middleware 2.25
2// Project: https://github.com/webpack-contrib/webpack-hot-middleware
3// Definitions by: Benjamin Lim <https://github.com/bumbleblym>
4// Ron Martinez <https://github.com/icylace>
5// Chris Abrams <https://github.com/chrisabrams>
6// Ilya Zelenko <https://github.com/iliyaZelenko>
7// Rodrigo Saboya <https://github.com/saboya>
8// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
9// TypeScript Version: 3.7
10
11import { NextHandleFunction } from 'connect';
12import * as webpack from 'webpack';
13
14export = WebpackHotMiddleware;
15
16declare function WebpackHotMiddleware(
17 compiler: webpack.ICompiler,
18 options?: WebpackHotMiddleware.MiddlewareOptions
19): NextHandleFunction & WebpackHotMiddleware.EventStream;
20
21declare namespace WebpackHotMiddleware {
22 interface ClientOptions {
23 path?: string;
24 reload?: boolean;
25 name?: string;
26 timeout?: number;
27 overlay?: boolean;
28 noInfo?: boolean;
29 quiet?: boolean;
30 dynamicPublicPath?: boolean;
31 autoConnect?: boolean;
32 ansiColors?: {
33 [key: string]: any
34 };
35 overlayStyles?: {
36 [key: string]: any
37 };
38 overlayWarnings?: boolean;
39 }
40 interface MiddlewareOptions {
41 log?: false | Logger;
42 path?: string;
43 heartbeat?: number;
44 }
45
46 type Logger = (message?: any, ...optionalParams: any[]) => void;
47
48 interface EventStream {
49 publish(payload: any): void;
50 close(): void;
51 }
52}