webpack-dev-server 5.0.4 → 5.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/client/clients/SockJSClient.js +3 -3
- package/client/clients/WebSocketClient.js +3 -3
- package/client/index.js +296 -17
- package/client/modules/logger/index.js +213 -122
- package/client/modules/sockjs-client/index.js +2 -2
- package/client/overlay.js +357 -16
- package/client/progress.js +124 -0
- package/client/utils/log.js +1 -17
- package/lib/Server.js +624 -376
- package/lib/options.json +23 -5
- package/package.json +36 -36
- package/types/bin/cli-flags.d.ts +15 -0
- package/types/lib/Server.d.ts +199 -291
- package/types/lib/servers/WebsocketServer.d.ts +0 -1
- package/client/overlay/fsm.js +0 -64
- package/client/overlay/runtime-error.js +0 -47
- package/client/overlay/state-machine.js +0 -100
- package/client/overlay/styles.js +0 -74
- package/client/utils/createSocketURL.js +0 -121
- package/client/utils/getCurrentScriptSource.js +0 -24
- package/client/utils/parseURL.js +0 -36
- package/client/utils/reloadApp.js +0 -63
- package/client/utils/stripAnsi.js +0 -18
package/types/lib/Server.d.ts
CHANGED
|
@@ -1,10 +1,28 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
export = Server;
|
|
3
|
-
|
|
2
|
+
/**
|
|
3
|
+
* @typedef {Object} BasicApplication
|
|
4
|
+
* @property {typeof useFn} use
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* @template {BasicApplication} [A=ExpressApplication]
|
|
8
|
+
* @template {BasicServer} [S=HTTPServer]
|
|
9
|
+
*/
|
|
10
|
+
declare class Server<
|
|
11
|
+
A extends BasicApplication = import("express").Application,
|
|
12
|
+
S extends BasicServer = import("http").Server<
|
|
13
|
+
typeof import("http").IncomingMessage,
|
|
14
|
+
typeof import("http").ServerResponse
|
|
15
|
+
>,
|
|
16
|
+
> {
|
|
4
17
|
static get schema(): {
|
|
5
18
|
title: string;
|
|
6
19
|
type: string;
|
|
7
20
|
definitions: {
|
|
21
|
+
App: {
|
|
22
|
+
instanceof: string;
|
|
23
|
+
description: string;
|
|
24
|
+
link: string;
|
|
25
|
+
};
|
|
8
26
|
AllowedHosts: {
|
|
9
27
|
anyOf: (
|
|
10
28
|
| {
|
|
@@ -49,7 +67,7 @@ declare class Server {
|
|
|
49
67
|
link?: undefined;
|
|
50
68
|
}
|
|
51
69
|
| {
|
|
52
|
-
type: string
|
|
70
|
+
type: string;
|
|
53
71
|
description: string;
|
|
54
72
|
link: string;
|
|
55
73
|
cli?: undefined;
|
|
@@ -78,149 +96,6 @@ declare class Server {
|
|
|
78
96
|
logging: {
|
|
79
97
|
$ref: string;
|
|
80
98
|
};
|
|
81
|
-
/** @typedef {import("net").Socket} Socket */
|
|
82
|
-
/** @typedef {import("http").IncomingMessage} IncomingMessage */
|
|
83
|
-
/** @typedef {import("http").ServerResponse} ServerResponse */
|
|
84
|
-
/** @typedef {import("open").Options} OpenOptions */
|
|
85
|
-
/** @typedef {import("https").ServerOptions & { spdy?: { plain?: boolean | undefined, ssl?: boolean | undefined, 'x-forwarded-for'?: string | undefined, protocol?: string | undefined, protocols?: string[] | undefined }}} ServerOptions */
|
|
86
|
-
/** @typedef {import("express").Request} Request */
|
|
87
|
-
/** @typedef {import("express").Response} Response */
|
|
88
|
-
/**
|
|
89
|
-
* @template {Request} T
|
|
90
|
-
* @template {Response} U
|
|
91
|
-
* @typedef {import("webpack-dev-middleware").Options<T, U>} DevMiddlewareOptions
|
|
92
|
-
*/
|
|
93
|
-
/**
|
|
94
|
-
* @template {Request} T
|
|
95
|
-
* @template {Response} U
|
|
96
|
-
* @typedef {import("webpack-dev-middleware").Context<T, U>} DevMiddlewareContext
|
|
97
|
-
*/
|
|
98
|
-
/**
|
|
99
|
-
* @typedef {"local-ip" | "local-ipv4" | "local-ipv6" | string} Host
|
|
100
|
-
*/
|
|
101
|
-
/**
|
|
102
|
-
* @typedef {number | string | "auto"} Port
|
|
103
|
-
*/
|
|
104
|
-
/**
|
|
105
|
-
* @typedef {Object} WatchFiles
|
|
106
|
-
* @property {string | string[]} paths
|
|
107
|
-
* @property {WatchOptions & { aggregateTimeout?: number, ignored?: WatchOptions["ignored"], poll?: number | boolean }} [options]
|
|
108
|
-
*/
|
|
109
|
-
/**
|
|
110
|
-
* @typedef {Object} Static
|
|
111
|
-
* @property {string} [directory]
|
|
112
|
-
* @property {string | string[]} [publicPath]
|
|
113
|
-
* @property {boolean | ServeIndexOptions} [serveIndex]
|
|
114
|
-
* @property {ServeStaticOptions} [staticOptions]
|
|
115
|
-
* @property {boolean | WatchOptions & { aggregateTimeout?: number, ignored?: WatchOptions["ignored"], poll?: number | boolean }} [watch]
|
|
116
|
-
*/
|
|
117
|
-
/**
|
|
118
|
-
* @typedef {Object} NormalizedStatic
|
|
119
|
-
* @property {string} directory
|
|
120
|
-
* @property {string[]} publicPath
|
|
121
|
-
* @property {false | ServeIndexOptions} serveIndex
|
|
122
|
-
* @property {ServeStaticOptions} staticOptions
|
|
123
|
-
* @property {false | WatchOptions} watch
|
|
124
|
-
*/
|
|
125
|
-
/**
|
|
126
|
-
* @typedef {Object} ServerConfiguration
|
|
127
|
-
* @property {"http" | "https" | "spdy" | string} [type]
|
|
128
|
-
* @property {ServerOptions} [options]
|
|
129
|
-
*/
|
|
130
|
-
/**
|
|
131
|
-
* @typedef {Object} WebSocketServerConfiguration
|
|
132
|
-
* @property {"sockjs" | "ws" | string | Function} [type]
|
|
133
|
-
* @property {Record<string, any>} [options]
|
|
134
|
-
*/
|
|
135
|
-
/**
|
|
136
|
-
* @typedef {(import("ws").WebSocket | import("sockjs").Connection & { send: import("ws").WebSocket["send"], terminate: import("ws").WebSocket["terminate"], ping: import("ws").WebSocket["ping"] }) & { isAlive?: boolean }} ClientConnection
|
|
137
|
-
*/
|
|
138
|
-
/**
|
|
139
|
-
* @typedef {import("ws").WebSocketServer | import("sockjs").Server & { close: import("ws").WebSocketServer["close"] }} WebSocketServer
|
|
140
|
-
*/
|
|
141
|
-
/**
|
|
142
|
-
* @typedef {{ implementation: WebSocketServer, clients: ClientConnection[] }} WebSocketServerImplementation
|
|
143
|
-
*/
|
|
144
|
-
/**
|
|
145
|
-
* @callback ByPass
|
|
146
|
-
* @param {Request} req
|
|
147
|
-
* @param {Response} res
|
|
148
|
-
* @param {ProxyConfigArrayItem} proxyConfig
|
|
149
|
-
*/
|
|
150
|
-
/**
|
|
151
|
-
* @typedef {{ path?: HttpProxyMiddlewareOptionsFilter | undefined, context?: HttpProxyMiddlewareOptionsFilter | undefined } & { bypass?: ByPass } & HttpProxyMiddlewareOptions } ProxyConfigArrayItem
|
|
152
|
-
*/
|
|
153
|
-
/**
|
|
154
|
-
* @typedef {(ProxyConfigArrayItem | ((req?: Request | undefined, res?: Response | undefined, next?: NextFunction | undefined) => ProxyConfigArrayItem))[]} ProxyConfigArray
|
|
155
|
-
*/
|
|
156
|
-
/**
|
|
157
|
-
* @typedef {Object} OpenApp
|
|
158
|
-
* @property {string} [name]
|
|
159
|
-
* @property {string[]} [arguments]
|
|
160
|
-
*/
|
|
161
|
-
/**
|
|
162
|
-
* @typedef {Object} Open
|
|
163
|
-
* @property {string | string[] | OpenApp} [app]
|
|
164
|
-
* @property {string | string[]} [target]
|
|
165
|
-
*/
|
|
166
|
-
/**
|
|
167
|
-
* @typedef {Object} NormalizedOpen
|
|
168
|
-
* @property {string} target
|
|
169
|
-
* @property {import("open").Options} options
|
|
170
|
-
*/
|
|
171
|
-
/**
|
|
172
|
-
* @typedef {Object} WebSocketURL
|
|
173
|
-
* @property {string} [hostname]
|
|
174
|
-
* @property {string} [password]
|
|
175
|
-
* @property {string} [pathname]
|
|
176
|
-
* @property {number | string} [port]
|
|
177
|
-
* @property {string} [protocol]
|
|
178
|
-
* @property {string} [username]
|
|
179
|
-
*/
|
|
180
|
-
/**
|
|
181
|
-
* @typedef {boolean | ((error: Error) => void)} OverlayMessageOptions
|
|
182
|
-
*/
|
|
183
|
-
/**
|
|
184
|
-
* @typedef {Object} ClientConfiguration
|
|
185
|
-
* @property {"log" | "info" | "warn" | "error" | "none" | "verbose"} [logging]
|
|
186
|
-
* @property {boolean | { warnings?: OverlayMessageOptions, errors?: OverlayMessageOptions, runtimeErrors?: OverlayMessageOptions }} [overlay]
|
|
187
|
-
* @property {boolean} [progress]
|
|
188
|
-
* @property {boolean | number} [reconnect]
|
|
189
|
-
* @property {"ws" | "sockjs" | string} [webSocketTransport]
|
|
190
|
-
* @property {string | WebSocketURL} [webSocketURL]
|
|
191
|
-
*/
|
|
192
|
-
/**
|
|
193
|
-
* @typedef {Array<{ key: string; value: string }> | Record<string, string | string[]>} Headers
|
|
194
|
-
*/
|
|
195
|
-
/**
|
|
196
|
-
* @typedef {{ name?: string, path?: string, middleware: ExpressRequestHandler | ExpressErrorRequestHandler } | ExpressRequestHandler | ExpressErrorRequestHandler} Middleware
|
|
197
|
-
*/
|
|
198
|
-
/**
|
|
199
|
-
* @typedef {Object} Configuration
|
|
200
|
-
* @property {boolean | string} [ipc]
|
|
201
|
-
* @property {Host} [host]
|
|
202
|
-
* @property {Port} [port]
|
|
203
|
-
* @property {boolean | "only"} [hot]
|
|
204
|
-
* @property {boolean} [liveReload]
|
|
205
|
-
* @property {DevMiddlewareOptions<Request, Response>} [devMiddleware]
|
|
206
|
-
* @property {boolean} [compress]
|
|
207
|
-
* @property {"auto" | "all" | string | string[]} [allowedHosts]
|
|
208
|
-
* @property {boolean | ConnectHistoryApiFallbackOptions} [historyApiFallback]
|
|
209
|
-
* @property {boolean | Record<string, never> | BonjourOptions} [bonjour]
|
|
210
|
-
* @property {string | string[] | WatchFiles | Array<string | WatchFiles>} [watchFiles]
|
|
211
|
-
* @property {boolean | string | Static | Array<string | Static>} [static]
|
|
212
|
-
* @property {boolean | ServerOptions} [https]
|
|
213
|
-
* @property {boolean} [http2]
|
|
214
|
-
* @property {"http" | "https" | "spdy" | string | ServerConfiguration} [server]
|
|
215
|
-
* @property {boolean | "sockjs" | "ws" | string | WebSocketServerConfiguration} [webSocketServer]
|
|
216
|
-
* @property {ProxyConfigArray} [proxy]
|
|
217
|
-
* @property {boolean | string | Open | Array<string | Open>} [open]
|
|
218
|
-
* @property {boolean} [setupExitSignals]
|
|
219
|
-
* @property {boolean | ClientConfiguration} [client]
|
|
220
|
-
* @property {Headers | ((req: Request, res: Response, context: DevMiddlewareContext<Request, Response>) => Headers)} [headers]
|
|
221
|
-
* @property {(devServer: Server) => void} [onListening]
|
|
222
|
-
* @property {(middlewares: Middleware[], devServer: Server) => Middleware[]} [setupMiddlewares]
|
|
223
|
-
*/
|
|
224
99
|
overlay: {
|
|
225
100
|
$ref: string;
|
|
226
101
|
};
|
|
@@ -292,9 +167,7 @@ declare class Server {
|
|
|
292
167
|
instanceof?: undefined;
|
|
293
168
|
}
|
|
294
169
|
| {
|
|
295
|
-
instanceof: string
|
|
296
|
-
* @typedef {import("ws").WebSocketServer | import("sockjs").Server & { close: import("ws").WebSocketServer["close"] }} WebSocketServer
|
|
297
|
-
*/;
|
|
170
|
+
instanceof: string;
|
|
298
171
|
description: string;
|
|
299
172
|
type?: undefined;
|
|
300
173
|
cli?: undefined;
|
|
@@ -333,7 +206,8 @@ declare class Server {
|
|
|
333
206
|
ClientProgress: {
|
|
334
207
|
description: string;
|
|
335
208
|
link: string;
|
|
336
|
-
type: string;
|
|
209
|
+
type: string[];
|
|
210
|
+
enum: (string | boolean)[];
|
|
337
211
|
cli: {
|
|
338
212
|
negatedDescription: string;
|
|
339
213
|
};
|
|
@@ -357,35 +231,6 @@ declare class Server {
|
|
|
357
231
|
)[];
|
|
358
232
|
};
|
|
359
233
|
ClientWebSocketTransport: {
|
|
360
|
-
/**
|
|
361
|
-
* @typedef {{ name?: string, path?: string, middleware: ExpressRequestHandler | ExpressErrorRequestHandler } | ExpressRequestHandler | ExpressErrorRequestHandler} Middleware
|
|
362
|
-
*/
|
|
363
|
-
/**
|
|
364
|
-
* @typedef {Object} Configuration
|
|
365
|
-
* @property {boolean | string} [ipc]
|
|
366
|
-
* @property {Host} [host]
|
|
367
|
-
* @property {Port} [port]
|
|
368
|
-
* @property {boolean | "only"} [hot]
|
|
369
|
-
* @property {boolean} [liveReload]
|
|
370
|
-
* @property {DevMiddlewareOptions<Request, Response>} [devMiddleware]
|
|
371
|
-
* @property {boolean} [compress]
|
|
372
|
-
* @property {"auto" | "all" | string | string[]} [allowedHosts]
|
|
373
|
-
* @property {boolean | ConnectHistoryApiFallbackOptions} [historyApiFallback]
|
|
374
|
-
* @property {boolean | Record<string, never> | BonjourOptions} [bonjour]
|
|
375
|
-
* @property {string | string[] | WatchFiles | Array<string | WatchFiles>} [watchFiles]
|
|
376
|
-
* @property {boolean | string | Static | Array<string | Static>} [static]
|
|
377
|
-
* @property {boolean | ServerOptions} [https]
|
|
378
|
-
* @property {boolean} [http2]
|
|
379
|
-
* @property {"http" | "https" | "spdy" | string | ServerConfiguration} [server]
|
|
380
|
-
* @property {boolean | "sockjs" | "ws" | string | WebSocketServerConfiguration} [webSocketServer]
|
|
381
|
-
* @property {ProxyConfigArray} [proxy]
|
|
382
|
-
* @property {boolean | string | Open | Array<string | Open>} [open]
|
|
383
|
-
* @property {boolean} [setupExitSignals]
|
|
384
|
-
* @property {boolean | ClientConfiguration} [client]
|
|
385
|
-
* @property {Headers | ((req: Request, res: Response, context: DevMiddlewareContext<Request, Response>) => Headers)} [headers]
|
|
386
|
-
* @property {(devServer: Server) => void} [onListening]
|
|
387
|
-
* @property {(middlewares: Middleware[], devServer: Server) => Middleware[]} [setupMiddlewares]
|
|
388
|
-
*/
|
|
389
234
|
anyOf: {
|
|
390
235
|
$ref: string;
|
|
391
236
|
}[];
|
|
@@ -479,9 +324,6 @@ declare class Server {
|
|
|
479
324
|
};
|
|
480
325
|
HeaderObject: {
|
|
481
326
|
type: string;
|
|
482
|
-
/**
|
|
483
|
-
* @type {FSWatcher[]}
|
|
484
|
-
*/
|
|
485
327
|
additionalProperties: boolean;
|
|
486
328
|
properties: {
|
|
487
329
|
key: {
|
|
@@ -731,7 +573,7 @@ declare class Server {
|
|
|
731
573
|
}
|
|
732
574
|
)[];
|
|
733
575
|
description: string;
|
|
734
|
-
link: string
|
|
576
|
+
link: string;
|
|
735
577
|
};
|
|
736
578
|
Proxy: {
|
|
737
579
|
type: string;
|
|
@@ -743,7 +585,6 @@ declare class Server {
|
|
|
743
585
|
}
|
|
744
586
|
| {
|
|
745
587
|
instanceof: string;
|
|
746
|
-
/** @type {{ type: WebSocketServerConfiguration["type"], options: NonNullable<WebSocketServerConfiguration["options"]> }} */
|
|
747
588
|
type?: undefined;
|
|
748
589
|
}
|
|
749
590
|
)[];
|
|
@@ -761,6 +602,9 @@ declare class Server {
|
|
|
761
602
|
ServerType: {
|
|
762
603
|
enum: string[];
|
|
763
604
|
};
|
|
605
|
+
ServerFn: {
|
|
606
|
+
instanceof: string;
|
|
607
|
+
};
|
|
764
608
|
ServerEnum: {
|
|
765
609
|
enum: string[];
|
|
766
610
|
cli: {
|
|
@@ -770,7 +614,6 @@ declare class Server {
|
|
|
770
614
|
ServerString: {
|
|
771
615
|
type: string;
|
|
772
616
|
minLength: number;
|
|
773
|
-
/** @type {string} */
|
|
774
617
|
cli: {
|
|
775
618
|
exclude: boolean;
|
|
776
619
|
};
|
|
@@ -1259,6 +1102,9 @@ declare class Server {
|
|
|
1259
1102
|
server: {
|
|
1260
1103
|
$ref: string;
|
|
1261
1104
|
};
|
|
1105
|
+
app: {
|
|
1106
|
+
$ref: string;
|
|
1107
|
+
};
|
|
1262
1108
|
setupExitSignals: {
|
|
1263
1109
|
$ref: string;
|
|
1264
1110
|
};
|
|
@@ -1282,10 +1128,14 @@ declare class Server {
|
|
|
1282
1128
|
*/
|
|
1283
1129
|
static isAbsoluteURL(URL: string): boolean;
|
|
1284
1130
|
/**
|
|
1285
|
-
* @param {string}
|
|
1131
|
+
* @param {string} gatewayOrFamily or family
|
|
1132
|
+
* @param {boolean} [isInternal] ip should be internal
|
|
1286
1133
|
* @returns {string | undefined}
|
|
1287
1134
|
*/
|
|
1288
|
-
static findIp(
|
|
1135
|
+
static findIp(
|
|
1136
|
+
gatewayOrFamily: string,
|
|
1137
|
+
isInternal?: boolean,
|
|
1138
|
+
): string | undefined;
|
|
1289
1139
|
/**
|
|
1290
1140
|
* @param {"v4" | "v6"} family
|
|
1291
1141
|
* @returns {Promise<string | undefined>}
|
|
@@ -1318,23 +1168,19 @@ declare class Server {
|
|
|
1318
1168
|
*/
|
|
1319
1169
|
private static isWebTarget;
|
|
1320
1170
|
/**
|
|
1321
|
-
* @param {Configuration
|
|
1322
|
-
* @param {Compiler | MultiCompiler
|
|
1171
|
+
* @param {Configuration<A, S>} options
|
|
1172
|
+
* @param {Compiler | MultiCompiler} compiler
|
|
1323
1173
|
*/
|
|
1324
1174
|
constructor(
|
|
1325
|
-
options:
|
|
1326
|
-
|
|
1327
|
-
| import("webpack").MultiCompiler
|
|
1328
|
-
| Configuration
|
|
1329
|
-
| undefined,
|
|
1330
|
-
compiler: Compiler | MultiCompiler | Configuration,
|
|
1175
|
+
options: Configuration<A, S> | undefined,
|
|
1176
|
+
compiler: Compiler | MultiCompiler,
|
|
1331
1177
|
);
|
|
1332
1178
|
compiler: import("webpack").Compiler | import("webpack").MultiCompiler;
|
|
1333
1179
|
/**
|
|
1334
1180
|
* @type {ReturnType<Compiler["getInfrastructureLogger"]>}
|
|
1335
1181
|
* */
|
|
1336
1182
|
logger: ReturnType<Compiler["getInfrastructureLogger"]>;
|
|
1337
|
-
options: Configuration
|
|
1183
|
+
options: Configuration<A, S>;
|
|
1338
1184
|
/**
|
|
1339
1185
|
* @type {FSWatcher[]}
|
|
1340
1186
|
*/
|
|
@@ -1379,10 +1225,19 @@ declare class Server {
|
|
|
1379
1225
|
*/
|
|
1380
1226
|
private getClientTransport;
|
|
1381
1227
|
/**
|
|
1228
|
+
* @template T
|
|
1382
1229
|
* @private
|
|
1383
|
-
* @returns {
|
|
1230
|
+
* @returns {T}
|
|
1384
1231
|
*/
|
|
1385
1232
|
private getServerTransport;
|
|
1233
|
+
/**
|
|
1234
|
+
* @returns {string}
|
|
1235
|
+
*/
|
|
1236
|
+
getClientEntry(): string;
|
|
1237
|
+
/**
|
|
1238
|
+
* @returns {string | void}
|
|
1239
|
+
*/
|
|
1240
|
+
getClientHotEntry(): string | void;
|
|
1386
1241
|
/**
|
|
1387
1242
|
* @private
|
|
1388
1243
|
* @returns {void}
|
|
@@ -1395,11 +1250,11 @@ declare class Server {
|
|
|
1395
1250
|
private initialize;
|
|
1396
1251
|
/**
|
|
1397
1252
|
* @private
|
|
1398
|
-
* @returns {void}
|
|
1253
|
+
* @returns {Promise<void>}
|
|
1399
1254
|
*/
|
|
1400
1255
|
private setupApp;
|
|
1401
|
-
/** @type {
|
|
1402
|
-
app:
|
|
1256
|
+
/** @type {A | undefined}*/
|
|
1257
|
+
app: A | undefined;
|
|
1403
1258
|
/**
|
|
1404
1259
|
* @private
|
|
1405
1260
|
* @param {Stats | MultiStats} statsObj
|
|
@@ -1420,12 +1275,18 @@ declare class Server {
|
|
|
1420
1275
|
* @private
|
|
1421
1276
|
* @returns {void}
|
|
1422
1277
|
*/
|
|
1423
|
-
private
|
|
1278
|
+
private setupWatchStaticFiles;
|
|
1279
|
+
/**
|
|
1280
|
+
* @private
|
|
1281
|
+
* @returns {void}
|
|
1282
|
+
*/
|
|
1283
|
+
private setupWatchFiles;
|
|
1424
1284
|
/**
|
|
1425
1285
|
* @private
|
|
1426
1286
|
* @returns {void}
|
|
1427
1287
|
*/
|
|
1428
|
-
private
|
|
1288
|
+
private setupMiddlewares;
|
|
1289
|
+
/** @type {import("webpack-dev-middleware").API<Request, Response>} */
|
|
1429
1290
|
middleware:
|
|
1430
1291
|
| import("webpack-dev-middleware").API<
|
|
1431
1292
|
import("express").Request<
|
|
@@ -1437,35 +1298,15 @@ declare class Server {
|
|
|
1437
1298
|
>,
|
|
1438
1299
|
import("express").Response<any, Record<string, any>>
|
|
1439
1300
|
>
|
|
1440
|
-
| null
|
|
1441
1301
|
| undefined;
|
|
1442
1302
|
/**
|
|
1443
1303
|
* @private
|
|
1444
|
-
* @returns {void}
|
|
1445
|
-
*/
|
|
1446
|
-
private setupBuiltInRoutes;
|
|
1447
|
-
/**
|
|
1448
|
-
* @private
|
|
1449
|
-
* @returns {void}
|
|
1450
|
-
*/
|
|
1451
|
-
private setupWatchStaticFiles;
|
|
1452
|
-
/**
|
|
1453
|
-
* @private
|
|
1454
|
-
* @returns {void}
|
|
1455
|
-
*/
|
|
1456
|
-
private setupWatchFiles;
|
|
1457
|
-
/**
|
|
1458
|
-
* @private
|
|
1459
|
-
* @returns {void}
|
|
1460
|
-
*/
|
|
1461
|
-
private setupMiddlewares;
|
|
1462
|
-
/**
|
|
1463
|
-
* @private
|
|
1464
|
-
* @returns {void}
|
|
1304
|
+
* @returns {Promise<void>}
|
|
1465
1305
|
*/
|
|
1466
1306
|
private createServer;
|
|
1467
|
-
/** @type {
|
|
1468
|
-
server:
|
|
1307
|
+
/** @type {S | undefined}*/
|
|
1308
|
+
server: S | undefined;
|
|
1309
|
+
isTlsServer: boolean | undefined;
|
|
1469
1310
|
/**
|
|
1470
1311
|
* @private
|
|
1471
1312
|
* @returns {void}
|
|
@@ -1536,16 +1377,11 @@ declare class Server {
|
|
|
1536
1377
|
* @param {string | string[]} watchPath
|
|
1537
1378
|
* @param {WatchOptions} [watchOptions]
|
|
1538
1379
|
*/
|
|
1539
|
-
watchFiles(
|
|
1540
|
-
watchPath: string | string[],
|
|
1541
|
-
watchOptions?: import("chokidar").WatchOptions | undefined,
|
|
1542
|
-
): void;
|
|
1380
|
+
watchFiles(watchPath: string | string[], watchOptions?: WatchOptions): void;
|
|
1543
1381
|
/**
|
|
1544
1382
|
* @param {import("webpack-dev-middleware").Callback} [callback]
|
|
1545
1383
|
*/
|
|
1546
|
-
invalidate(
|
|
1547
|
-
callback?: import("webpack-dev-middleware").Callback | undefined,
|
|
1548
|
-
): void;
|
|
1384
|
+
invalidate(callback?: import("webpack-dev-middleware").Callback): void;
|
|
1549
1385
|
/**
|
|
1550
1386
|
* @returns {Promise<void>}
|
|
1551
1387
|
*/
|
|
@@ -1553,7 +1389,7 @@ declare class Server {
|
|
|
1553
1389
|
/**
|
|
1554
1390
|
* @param {(err?: Error) => void} [callback]
|
|
1555
1391
|
*/
|
|
1556
|
-
startCallback(callback?: (
|
|
1392
|
+
startCallback(callback?: (err?: Error) => void): void;
|
|
1557
1393
|
/**
|
|
1558
1394
|
* @returns {Promise<void>}
|
|
1559
1395
|
*/
|
|
@@ -1561,7 +1397,7 @@ declare class Server {
|
|
|
1561
1397
|
/**
|
|
1562
1398
|
* @param {(err?: Error) => void} [callback]
|
|
1563
1399
|
*/
|
|
1564
|
-
stopCallback(callback?: (
|
|
1400
|
+
stopCallback(callback?: (err?: Error) => void): void;
|
|
1565
1401
|
}
|
|
1566
1402
|
declare namespace Server {
|
|
1567
1403
|
export {
|
|
@@ -1575,9 +1411,6 @@ declare namespace Server {
|
|
|
1575
1411
|
Stats,
|
|
1576
1412
|
MultiStats,
|
|
1577
1413
|
NetworkInterfaceInfo,
|
|
1578
|
-
NextFunction,
|
|
1579
|
-
ExpressRequestHandler,
|
|
1580
|
-
ExpressErrorRequestHandler,
|
|
1581
1414
|
WatchOptions,
|
|
1582
1415
|
FSWatcher,
|
|
1583
1416
|
ConnectHistoryApiFallbackOptions,
|
|
@@ -1591,9 +1424,20 @@ declare namespace Server {
|
|
|
1591
1424
|
IPv4,
|
|
1592
1425
|
IPv6,
|
|
1593
1426
|
Socket,
|
|
1427
|
+
HTTPServer,
|
|
1594
1428
|
IncomingMessage,
|
|
1595
1429
|
ServerResponse,
|
|
1596
1430
|
OpenOptions,
|
|
1431
|
+
ExpressApplication,
|
|
1432
|
+
ExpressRequestHandler,
|
|
1433
|
+
ExpressErrorRequestHandler,
|
|
1434
|
+
ExpressRequest,
|
|
1435
|
+
ExpressResponse,
|
|
1436
|
+
NextFunction,
|
|
1437
|
+
SimpleHandleFunction,
|
|
1438
|
+
NextHandleFunction,
|
|
1439
|
+
ErrorHandleFunction,
|
|
1440
|
+
HandleFunction,
|
|
1597
1441
|
ServerOptions,
|
|
1598
1442
|
Request,
|
|
1599
1443
|
Response,
|
|
@@ -1604,6 +1448,7 @@ declare namespace Server {
|
|
|
1604
1448
|
WatchFiles,
|
|
1605
1449
|
Static,
|
|
1606
1450
|
NormalizedStatic,
|
|
1451
|
+
ServerType,
|
|
1607
1452
|
ServerConfiguration,
|
|
1608
1453
|
WebSocketServerConfiguration,
|
|
1609
1454
|
ClientConnection,
|
|
@@ -1619,21 +1464,19 @@ declare namespace Server {
|
|
|
1619
1464
|
OverlayMessageOptions,
|
|
1620
1465
|
ClientConfiguration,
|
|
1621
1466
|
Headers,
|
|
1467
|
+
MiddlewareHandler,
|
|
1468
|
+
MiddlewareObject,
|
|
1622
1469
|
Middleware,
|
|
1470
|
+
BasicServer,
|
|
1623
1471
|
Configuration,
|
|
1472
|
+
BasicApplication,
|
|
1624
1473
|
};
|
|
1625
1474
|
}
|
|
1626
|
-
type Compiler = import("webpack").Compiler;
|
|
1627
|
-
type FSWatcher = import("chokidar").FSWatcher;
|
|
1628
|
-
type Socket = import("net").Socket;
|
|
1629
|
-
type WebSocketServerImplementation = {
|
|
1630
|
-
implementation: WebSocketServer;
|
|
1631
|
-
clients: ClientConnection[];
|
|
1632
|
-
};
|
|
1633
1475
|
declare class DEFAULT_STATS {
|
|
1634
1476
|
private constructor();
|
|
1635
1477
|
}
|
|
1636
1478
|
type Schema = import("schema-utils/declarations/validate").Schema;
|
|
1479
|
+
type Compiler = import("webpack").Compiler;
|
|
1637
1480
|
type MultiCompiler = import("webpack").MultiCompiler;
|
|
1638
1481
|
type WebpackConfiguration = import("webpack").Configuration;
|
|
1639
1482
|
type StatsOptions = import("webpack").StatsOptions;
|
|
@@ -1641,10 +1484,8 @@ type StatsCompilation = import("webpack").StatsCompilation;
|
|
|
1641
1484
|
type Stats = import("webpack").Stats;
|
|
1642
1485
|
type MultiStats = import("webpack").MultiStats;
|
|
1643
1486
|
type NetworkInterfaceInfo = import("os").NetworkInterfaceInfo;
|
|
1644
|
-
type NextFunction = import("express").NextFunction;
|
|
1645
|
-
type ExpressRequestHandler = import("express").RequestHandler;
|
|
1646
|
-
type ExpressErrorRequestHandler = import("express").ErrorRequestHandler;
|
|
1647
1487
|
type WatchOptions = import("chokidar").WatchOptions;
|
|
1488
|
+
type FSWatcher = import("chokidar").FSWatcher;
|
|
1648
1489
|
type ConnectHistoryApiFallbackOptions =
|
|
1649
1490
|
import("connect-history-api-fallback").Options;
|
|
1650
1491
|
type Bonjour = import("bonjour-service").Bonjour;
|
|
@@ -1656,9 +1497,33 @@ type ServeIndexOptions = import("serve-index").Options;
|
|
|
1656
1497
|
type ServeStaticOptions = import("serve-static").ServeStaticOptions;
|
|
1657
1498
|
type IPv4 = import("ipaddr.js").IPv4;
|
|
1658
1499
|
type IPv6 = import("ipaddr.js").IPv6;
|
|
1500
|
+
type Socket = import("net").Socket;
|
|
1501
|
+
type HTTPServer = import("http").Server;
|
|
1659
1502
|
type IncomingMessage = import("http").IncomingMessage;
|
|
1660
1503
|
type ServerResponse = import("http").ServerResponse;
|
|
1661
1504
|
type OpenOptions = import("open").Options;
|
|
1505
|
+
type ExpressApplication = import("express").Application;
|
|
1506
|
+
type ExpressRequestHandler = import("express").RequestHandler;
|
|
1507
|
+
type ExpressErrorRequestHandler = import("express").ErrorRequestHandler;
|
|
1508
|
+
type ExpressRequest = import("express").Request;
|
|
1509
|
+
type ExpressResponse = import("express").Response;
|
|
1510
|
+
type NextFunction = (err?: any) => void;
|
|
1511
|
+
type SimpleHandleFunction = (req: IncomingMessage, res: ServerResponse) => void;
|
|
1512
|
+
type NextHandleFunction = (
|
|
1513
|
+
req: IncomingMessage,
|
|
1514
|
+
res: ServerResponse,
|
|
1515
|
+
next: NextFunction,
|
|
1516
|
+
) => void;
|
|
1517
|
+
type ErrorHandleFunction = (
|
|
1518
|
+
err: any,
|
|
1519
|
+
req: IncomingMessage,
|
|
1520
|
+
res: ServerResponse,
|
|
1521
|
+
next: NextFunction,
|
|
1522
|
+
) => void;
|
|
1523
|
+
type HandleFunction =
|
|
1524
|
+
| SimpleHandleFunction
|
|
1525
|
+
| NextHandleFunction
|
|
1526
|
+
| ErrorHandleFunction;
|
|
1662
1527
|
type ServerOptions = import("https").ServerOptions & {
|
|
1663
1528
|
spdy?: {
|
|
1664
1529
|
plain?: boolean | undefined;
|
|
@@ -1668,27 +1533,17 @@ type ServerOptions = import("https").ServerOptions & {
|
|
|
1668
1533
|
protocols?: string[] | undefined;
|
|
1669
1534
|
};
|
|
1670
1535
|
};
|
|
1671
|
-
type Request = import("express").
|
|
1672
|
-
|
|
1536
|
+
type Request<T extends BasicApplication = import("express").Application> =
|
|
1537
|
+
T extends ExpressApplication ? ExpressRequest : IncomingMessage;
|
|
1538
|
+
type Response<T extends BasicApplication = import("express").Application> =
|
|
1539
|
+
T extends ExpressApplication ? ExpressResponse : ServerResponse;
|
|
1673
1540
|
type DevMiddlewareOptions<
|
|
1674
|
-
T extends
|
|
1675
|
-
|
|
1676
|
-
any,
|
|
1677
|
-
any,
|
|
1678
|
-
qs.ParsedQs,
|
|
1679
|
-
Record<string, any>
|
|
1680
|
-
>,
|
|
1681
|
-
U extends import("express").Response<any, Record<string, any>>,
|
|
1541
|
+
T extends Request,
|
|
1542
|
+
U extends Response,
|
|
1682
1543
|
> = import("webpack-dev-middleware").Options<T, U>;
|
|
1683
1544
|
type DevMiddlewareContext<
|
|
1684
|
-
T extends
|
|
1685
|
-
|
|
1686
|
-
any,
|
|
1687
|
-
any,
|
|
1688
|
-
qs.ParsedQs,
|
|
1689
|
-
Record<string, any>
|
|
1690
|
-
>,
|
|
1691
|
-
U extends import("express").Response<any, Record<string, any>>,
|
|
1545
|
+
T extends Request,
|
|
1546
|
+
U extends Response,
|
|
1692
1547
|
> = import("webpack-dev-middleware").Context<T, U>;
|
|
1693
1548
|
type Host = "local-ip" | "local-ipv4" | "local-ipv6" | string;
|
|
1694
1549
|
type Port = number | string | "auto";
|
|
@@ -1696,9 +1551,9 @@ type WatchFiles = {
|
|
|
1696
1551
|
paths: string | string[];
|
|
1697
1552
|
options?:
|
|
1698
1553
|
| (import("chokidar").WatchOptions & {
|
|
1699
|
-
aggregateTimeout?: number
|
|
1554
|
+
aggregateTimeout?: number;
|
|
1700
1555
|
ignored?: WatchOptions["ignored"];
|
|
1701
|
-
poll?: number | boolean
|
|
1556
|
+
poll?: number | boolean;
|
|
1702
1557
|
})
|
|
1703
1558
|
| undefined;
|
|
1704
1559
|
};
|
|
@@ -1714,9 +1569,9 @@ type Static = {
|
|
|
1714
1569
|
watch?:
|
|
1715
1570
|
| boolean
|
|
1716
1571
|
| (import("chokidar").WatchOptions & {
|
|
1717
|
-
aggregateTimeout?: number
|
|
1572
|
+
aggregateTimeout?: number;
|
|
1718
1573
|
ignored?: WatchOptions["ignored"];
|
|
1719
|
-
poll?: number | boolean
|
|
1574
|
+
poll?: number | boolean;
|
|
1720
1575
|
})
|
|
1721
1576
|
| undefined;
|
|
1722
1577
|
};
|
|
@@ -1727,8 +1582,27 @@ type NormalizedStatic = {
|
|
|
1727
1582
|
staticOptions: ServeStaticOptions;
|
|
1728
1583
|
watch: false | WatchOptions;
|
|
1729
1584
|
};
|
|
1730
|
-
type
|
|
1731
|
-
|
|
1585
|
+
type ServerType<
|
|
1586
|
+
A extends BasicApplication = import("express").Application,
|
|
1587
|
+
S extends BasicServer = import("http").Server<
|
|
1588
|
+
typeof import("http").IncomingMessage,
|
|
1589
|
+
typeof import("http").ServerResponse
|
|
1590
|
+
>,
|
|
1591
|
+
> =
|
|
1592
|
+
| "http"
|
|
1593
|
+
| "https"
|
|
1594
|
+
| "spdy"
|
|
1595
|
+
| "http2"
|
|
1596
|
+
| string
|
|
1597
|
+
| ((arg0: ServerOptions, arg1: A) => S);
|
|
1598
|
+
type ServerConfiguration<
|
|
1599
|
+
A extends BasicApplication = import("express").Application,
|
|
1600
|
+
S extends BasicServer = import("http").Server<
|
|
1601
|
+
typeof import("http").IncomingMessage,
|
|
1602
|
+
typeof import("http").ServerResponse
|
|
1603
|
+
>,
|
|
1604
|
+
> = {
|
|
1605
|
+
type?: ServerType<A, S> | undefined;
|
|
1732
1606
|
options?: ServerOptions | undefined;
|
|
1733
1607
|
};
|
|
1734
1608
|
type WebSocketServerConfiguration = {
|
|
@@ -1750,6 +1624,10 @@ type WebSocketServer =
|
|
|
1750
1624
|
| (import("sockjs").Server & {
|
|
1751
1625
|
close: import("ws").WebSocketServer["close"];
|
|
1752
1626
|
});
|
|
1627
|
+
type WebSocketServerImplementation = {
|
|
1628
|
+
implementation: WebSocketServer;
|
|
1629
|
+
clients: ClientConnection[];
|
|
1630
|
+
};
|
|
1753
1631
|
type ByPass = (
|
|
1754
1632
|
req: Request,
|
|
1755
1633
|
res: Response,
|
|
@@ -1795,9 +1673,9 @@ type ClientConfiguration = {
|
|
|
1795
1673
|
overlay?:
|
|
1796
1674
|
| boolean
|
|
1797
1675
|
| {
|
|
1798
|
-
warnings?: OverlayMessageOptions
|
|
1799
|
-
errors?: OverlayMessageOptions
|
|
1800
|
-
runtimeErrors?: OverlayMessageOptions
|
|
1676
|
+
warnings?: OverlayMessageOptions;
|
|
1677
|
+
errors?: OverlayMessageOptions;
|
|
1678
|
+
runtimeErrors?: OverlayMessageOptions;
|
|
1801
1679
|
}
|
|
1802
1680
|
| undefined;
|
|
1803
1681
|
progress?: boolean | undefined;
|
|
@@ -1811,15 +1689,25 @@ type Headers =
|
|
|
1811
1689
|
value: string;
|
|
1812
1690
|
}>
|
|
1813
1691
|
| Record<string, string | string[]>;
|
|
1814
|
-
type
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1692
|
+
type MiddlewareHandler<
|
|
1693
|
+
T extends BasicApplication = import("express").Application,
|
|
1694
|
+
> = T extends ExpressApplication
|
|
1695
|
+
? ExpressRequestHandler | ExpressErrorRequestHandler
|
|
1696
|
+
: HandleFunction;
|
|
1697
|
+
type MiddlewareObject = {
|
|
1698
|
+
name?: string;
|
|
1699
|
+
path?: string;
|
|
1700
|
+
middleware: MiddlewareHandler;
|
|
1701
|
+
};
|
|
1702
|
+
type Middleware = MiddlewareObject | MiddlewareHandler;
|
|
1703
|
+
type BasicServer = import("net").Server | import("tls").Server;
|
|
1704
|
+
type Configuration<
|
|
1705
|
+
A extends BasicApplication = import("express").Application,
|
|
1706
|
+
S extends BasicServer = import("http").Server<
|
|
1707
|
+
typeof import("http").IncomingMessage,
|
|
1708
|
+
typeof import("http").ServerResponse
|
|
1709
|
+
>,
|
|
1710
|
+
> = {
|
|
1823
1711
|
ipc?: string | boolean | undefined;
|
|
1824
1712
|
host?: string | undefined;
|
|
1825
1713
|
port?: Port | undefined;
|
|
@@ -1855,9 +1743,8 @@ type Configuration = {
|
|
|
1855
1743
|
| (string | WatchFiles)[]
|
|
1856
1744
|
| undefined;
|
|
1857
1745
|
static?: string | boolean | Static | (string | Static)[] | undefined;
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
server?: string | ServerConfiguration | undefined;
|
|
1746
|
+
server?: ServerType<A, S> | ServerConfiguration<A, S> | undefined;
|
|
1747
|
+
app?: (() => Promise<A>) | undefined;
|
|
1861
1748
|
webSocketServer?: string | boolean | WebSocketServerConfiguration | undefined;
|
|
1862
1749
|
proxy?: ProxyConfigArray | undefined;
|
|
1863
1750
|
open?: string | boolean | Open | (string | Open)[] | undefined;
|
|
@@ -1868,15 +1755,36 @@ type Configuration = {
|
|
|
1868
1755
|
| ((
|
|
1869
1756
|
req: Request,
|
|
1870
1757
|
res: Response,
|
|
1871
|
-
context: DevMiddlewareContext<Request, Response
|
|
1758
|
+
context: DevMiddlewareContext<Request, Response> | undefined,
|
|
1872
1759
|
) => Headers)
|
|
1873
1760
|
| undefined;
|
|
1874
|
-
onListening?: ((devServer: Server) => void) | undefined;
|
|
1761
|
+
onListening?: ((devServer: Server<A, S>) => void) | undefined;
|
|
1875
1762
|
setupMiddlewares?:
|
|
1876
|
-
| ((middlewares: Middleware[], devServer: Server) => Middleware[])
|
|
1763
|
+
| ((middlewares: Middleware[], devServer: Server<A, S>) => Middleware[])
|
|
1877
1764
|
| undefined;
|
|
1878
1765
|
};
|
|
1879
|
-
|
|
1766
|
+
type BasicApplication = {
|
|
1767
|
+
use: typeof useFn;
|
|
1768
|
+
};
|
|
1769
|
+
/**
|
|
1770
|
+
* @overload
|
|
1771
|
+
* @param {NextHandleFunction} fn
|
|
1772
|
+
* @returns {BasicApplication}
|
|
1773
|
+
*/
|
|
1774
|
+
declare function useFn(fn: NextHandleFunction): BasicApplication;
|
|
1775
|
+
/**
|
|
1776
|
+
* @overload
|
|
1777
|
+
* @param {HandleFunction} fn
|
|
1778
|
+
* @returns {BasicApplication}
|
|
1779
|
+
*/
|
|
1780
|
+
declare function useFn(fn: HandleFunction): BasicApplication;
|
|
1781
|
+
/**
|
|
1782
|
+
* @overload
|
|
1783
|
+
* @param {string} route
|
|
1784
|
+
* @param {NextHandleFunction} fn
|
|
1785
|
+
* @returns {BasicApplication}
|
|
1786
|
+
*/
|
|
1787
|
+
declare function useFn(route: string, fn: NextHandleFunction): BasicApplication;
|
|
1880
1788
|
|
|
1881
1789
|
// DO NOT REMOVE THIS!
|
|
1882
1790
|
type DevServerConfiguration = Configuration;
|