1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | import * as webpack from 'webpack';
|
11 | import * as core from 'express-serve-static-core';
|
12 | import * as serveStatic from 'serve-static';
|
13 | import * as http from 'http';
|
14 | import * as spdy from 'spdy';
|
15 | import * as httpProxyMiddleware from 'http-proxy-middleware';
|
16 |
|
17 | declare namespace WebpackDevServer {
|
18 | interface ListeningApp {
|
19 | address(): { port?: number };
|
20 | }
|
21 |
|
22 | interface proxyConfigMap {
|
23 | [url: string]: string | httpProxyMiddleware.Config;
|
24 | }
|
25 |
|
26 | type proxyConfigArrayItem = {
|
27 | path?: string | string[];
|
28 | context?: string | string[]
|
29 | } & httpProxyMiddleware.Config;
|
30 |
|
31 | type proxyConfigArray = proxyConfigArrayItem[];
|
32 |
|
33 | type expressAppHook = (app: core.Express) => void;
|
34 |
|
35 | interface Configuration {
|
36 | after?: expressAppHook;
|
37 | allowedHosts?: string[];
|
38 | before?: expressAppHook;
|
39 | bonjour?: boolean;
|
40 | clientLogLevel?: string;
|
41 | compress?: boolean;
|
42 | contentBase?: string;
|
43 | disableHostCheck?: boolean;
|
44 | filename?: string;
|
45 | headers?: {};
|
46 | historyApiFallback?: boolean | {};
|
47 | host?: string;
|
48 | hot?: boolean;
|
49 | hotOnly?: boolean;
|
50 | https?: boolean | spdy.ServerOptions;
|
51 | inline?: boolean;
|
52 | lazy?: boolean;
|
53 | noInfo?: boolean;
|
54 | open?: boolean;
|
55 | openPage?: string;
|
56 | overlay?: boolean | {
|
57 | warnings: boolean;
|
58 | errors: boolean;
|
59 | };
|
60 | pfx?: string;
|
61 | pfxPassphrase?: string;
|
62 | port?: number;
|
63 | proxy?: proxyConfigMap | proxyConfigArray;
|
64 | public?: string;
|
65 | publicPath?: string;
|
66 | quiet?: boolean;
|
67 | setup?: expressAppHook;
|
68 | socket?: string;
|
69 | staticOptions?: serveStatic.ServeStaticOptions;
|
70 | stats?: webpack.compiler.StatsOptions | webpack.compiler.StatsToStringOptions;
|
71 | useLocalIp?: boolean;
|
72 | watchContentBase?: boolean;
|
73 | watchOptions?: webpack.WatchOptions;
|
74 | }
|
75 | }
|
76 |
|
77 | declare class WebpackDevServer {
|
78 | constructor(
|
79 | webpack: webpack.Compiler | webpack.MultiCompiler,
|
80 | config: WebpackDevServer.Configuration
|
81 | );
|
82 |
|
83 | static addDevServerEntrypoints(
|
84 | webpackOptions: webpack.Configuration | webpack.Configuration[],
|
85 | config: WebpackDevServer.Configuration,
|
86 | listeningApp?: WebpackDevServer.ListeningApp
|
87 | ): void;
|
88 |
|
89 | listen(port: number, hostname: string, callback?: (error?: Error) => void): http.Server;
|
90 |
|
91 | listen(port: number, callback?: (error?: Error) => void): http.Server;
|
92 |
|
93 | close(callback?: () => void): void;
|
94 | }
|
95 |
|
96 | export = WebpackDevServer;
|