UNPKG

1.78 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 | undefined;
24 reload?: boolean | undefined;
25 name?: string | undefined;
26 timeout?: number | undefined;
27 overlay?: boolean | undefined;
28 noInfo?: boolean | undefined;
29 quiet?: boolean | undefined;
30 dynamicPublicPath?: boolean | undefined;
31 autoConnect?: boolean | undefined;
32 ansiColors?: {
33 [key: string]: any
34 } | undefined;
35 overlayStyles?: {
36 [key: string]: any
37 } | undefined;
38 overlayWarnings?: boolean | undefined;
39 }
40 interface MiddlewareOptions {
41 log?: false | Logger | undefined;
42 path?: string | undefined;
43 heartbeat?: number | undefined;
44 }
45
46 type Logger = (message?: any, ...optionalParams: any[]) => void;
47
48 interface EventStream {
49 publish(payload: any): void;
50 close(): void;
51 }
52}