webpack-dev-server 5.0.1 → 5.0.2

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/lib/Server.js CHANGED
@@ -18,8 +18,6 @@ const schema = require("./options.json");
18
18
  /** @typedef {import("webpack").Stats} Stats */
19
19
  /** @typedef {import("webpack").MultiStats} MultiStats */
20
20
  /** @typedef {import("os").NetworkInterfaceInfo} NetworkInterfaceInfo */
21
- /** @typedef {import("express").Request} Request */
22
- /** @typedef {import("express").Response} Response */
23
21
  /** @typedef {import("express").NextFunction} NextFunction */
24
22
  /** @typedef {import("express").RequestHandler} ExpressRequestHandler */
25
23
  /** @typedef {import("express").ErrorRequestHandler} ExpressErrorRequestHandler */
@@ -42,14 +40,19 @@ const schema = require("./options.json");
42
40
 
43
41
  /** @typedef {import("https").ServerOptions & { spdy?: { plain?: boolean | undefined, ssl?: boolean | undefined, 'x-forwarded-for'?: string | undefined, protocol?: string | undefined, protocols?: string[] | undefined }}} ServerOptions */
44
42
 
43
+ /** @typedef {import("express").Request} Request */
44
+ /** @typedef {import("express").Response} Response */
45
+
45
46
  /**
46
- * @template Request, Response
47
- * @typedef {import("webpack-dev-middleware").Options<IncomingMessage, ServerResponse>} DevMiddlewareOptions
47
+ * @template {Request} T
48
+ * @template {Response} U
49
+ * @typedef {import("webpack-dev-middleware").Options<T, U>} DevMiddlewareOptions
48
50
  */
49
51
 
50
52
  /**
51
- * @template Request, Response
52
- * @typedef {import("webpack-dev-middleware").Context<IncomingMessage, ServerResponse>} DevMiddlewareContext
53
+ * @template {Request} T
54
+ * @template {Response} U
55
+ * @typedef {import("webpack-dev-middleware").Context<T, U>} DevMiddlewareContext
53
56
  */
54
57
 
55
58
  /**
@@ -1841,36 +1844,20 @@ class Server {
1841
1844
  const { app, middleware } = this;
1842
1845
 
1843
1846
  /** @type {import("express").Application} */
1844
- (app).get(
1845
- "/__webpack_dev_server__/sockjs.bundle.js",
1846
- /**
1847
- * @param {Request} req
1848
- * @param {Response} res
1849
- * @returns {void}
1850
- */
1851
- (req, res) => {
1852
- res.setHeader("Content-Type", "application/javascript");
1847
+ (app).get("/__webpack_dev_server__/sockjs.bundle.js", (req, res) => {
1848
+ res.setHeader("Content-Type", "application/javascript");
1853
1849
 
1854
- const clientPath = path.join(__dirname, "..", "client");
1850
+ const clientPath = path.join(__dirname, "..", "client");
1855
1851
 
1856
- res.sendFile(path.join(clientPath, "modules/sockjs-client/index.js"));
1857
- },
1858
- );
1852
+ res.sendFile(path.join(clientPath, "modules/sockjs-client/index.js"));
1853
+ });
1859
1854
 
1860
1855
  /** @type {import("express").Application} */
1861
- (app).get(
1862
- "/webpack-dev-server/invalidate",
1863
- /**
1864
- * @param {Request} _req
1865
- * @param {Response} res
1866
- * @returns {void}
1867
- */
1868
- (_req, res) => {
1869
- this.invalidate();
1856
+ (app).get("/webpack-dev-server/invalidate", (_req, res) => {
1857
+ this.invalidate();
1870
1858
 
1871
- res.end();
1872
- },
1873
- );
1859
+ res.end();
1860
+ });
1874
1861
 
1875
1862
  /** @type {import("express").Application} */
1876
1863
  (app).get("/webpack-dev-server/open-editor", (req, res) => {
@@ -1886,74 +1873,65 @@ class Server {
1886
1873
  });
1887
1874
 
1888
1875
  /** @type {import("express").Application} */
1889
- (app).get(
1890
- "/webpack-dev-server",
1891
- /**
1892
- * @param {Request} req
1893
- * @param {Response} res
1894
- * @returns {void}
1895
- */
1896
- (req, res) => {
1897
- /** @type {import("webpack-dev-middleware").API<Request, Response>}*/
1898
- (middleware).waitUntilValid((stats) => {
1899
- res.setHeader("Content-Type", "text/html");
1900
- // HEAD requests should not return body content
1901
- if (req.method === "HEAD") {
1902
- res.end();
1903
- return;
1904
- }
1905
- res.write(
1906
- '<!DOCTYPE html><html><head><meta charset="utf-8"/></head><body>',
1907
- );
1876
+ (app).get("/webpack-dev-server", (req, res) => {
1877
+ /** @type {import("webpack-dev-middleware").API<Request, Response>}*/
1878
+ (middleware).waitUntilValid((stats) => {
1879
+ res.setHeader("Content-Type", "text/html");
1880
+ // HEAD requests should not return body content
1881
+ if (req.method === "HEAD") {
1882
+ res.end();
1883
+ return;
1884
+ }
1885
+ res.write(
1886
+ '<!DOCTYPE html><html><head><meta charset="utf-8"/></head><body>',
1887
+ );
1908
1888
 
1909
- const statsForPrint =
1910
- typeof (/** @type {MultiStats} */ (stats).stats) !== "undefined"
1911
- ? /** @type {MultiStats} */ (stats).toJson().children
1912
- : [/** @type {Stats} */ (stats).toJson()];
1889
+ const statsForPrint =
1890
+ typeof (/** @type {MultiStats} */ (stats).stats) !== "undefined"
1891
+ ? /** @type {MultiStats} */ (stats).toJson().children
1892
+ : [/** @type {Stats} */ (stats).toJson()];
1913
1893
 
1914
- res.write(`<h1>Assets Report:</h1>`);
1894
+ res.write(`<h1>Assets Report:</h1>`);
1915
1895
 
1916
- /**
1917
- * @type {StatsCompilation[]}
1918
- */
1919
- (statsForPrint).forEach((item, index) => {
1920
- res.write("<div>");
1921
-
1922
- const name =
1923
- // eslint-disable-next-line no-nested-ternary
1924
- typeof item.name !== "undefined"
1925
- ? item.name
1926
- : /** @type {MultiStats} */ (stats).stats
1927
- ? `unnamed[${index}]`
1928
- : "unnamed";
1929
-
1930
- res.write(`<h2>Compilation: ${name}</h2>`);
1931
- res.write("<ul>");
1932
-
1933
- const publicPath =
1934
- item.publicPath === "auto" ? "" : item.publicPath;
1935
-
1936
- for (const asset of /** @type {NonNullable<StatsCompilation["assets"]>} */ (
1937
- item.assets
1938
- )) {
1939
- const assetName = asset.name;
1940
- const assetURL = `${publicPath}${assetName}`;
1941
-
1942
- res.write(
1943
- `<li>
1896
+ /**
1897
+ * @type {StatsCompilation[]}
1898
+ */
1899
+ (statsForPrint).forEach((item, index) => {
1900
+ res.write("<div>");
1901
+
1902
+ const name =
1903
+ // eslint-disable-next-line no-nested-ternary
1904
+ typeof item.name !== "undefined"
1905
+ ? item.name
1906
+ : /** @type {MultiStats} */ (stats).stats
1907
+ ? `unnamed[${index}]`
1908
+ : "unnamed";
1909
+
1910
+ res.write(`<h2>Compilation: ${name}</h2>`);
1911
+ res.write("<ul>");
1912
+
1913
+ const publicPath = item.publicPath === "auto" ? "" : item.publicPath;
1914
+
1915
+ for (const asset of /** @type {NonNullable<StatsCompilation["assets"]>} */ (
1916
+ item.assets
1917
+ )) {
1918
+ const assetName = asset.name;
1919
+ const assetURL = `${publicPath}${assetName}`;
1920
+
1921
+ res.write(
1922
+ `<li>
1944
1923
  <strong><a href="${assetURL}" target="_blank">${assetName}</a></strong>
1945
1924
  </li>`,
1946
- );
1947
- }
1948
-
1949
- res.write("</ul>");
1950
- res.write("</div>");
1951
- });
1925
+ );
1926
+ }
1952
1927
 
1953
- res.end("</body></html>");
1928
+ res.write("</ul>");
1929
+ res.write("</div>");
1954
1930
  });
1955
- },
1956
- );
1931
+
1932
+ res.end("</body></html>");
1933
+ });
1934
+ });
1957
1935
  }
1958
1936
 
1959
1937
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webpack-dev-server",
3
- "version": "5.0.1",
3
+ "version": "5.0.2",
4
4
  "description": "Serves a webpack app. Updates the browser on changes.",
5
5
  "bin": "bin/webpack-dev-server.js",
6
6
  "main": "lib/Server.js",
@@ -49,14 +49,14 @@ declare class Server {
49
49
  link?: undefined;
50
50
  }
51
51
  | {
52
- type: string;
52
+ type: string /** @typedef {import("express").ErrorRequestHandler} ExpressErrorRequestHandler */;
53
53
  description: string;
54
54
  link: string;
55
55
  cli?: undefined;
56
56
  }
57
57
  )[];
58
58
  description: string;
59
- link: string /** @typedef {import("connect-history-api-fallback").Options} ConnectHistoryApiFallbackOptions */;
59
+ link: string;
60
60
  };
61
61
  Client: {
62
62
  description: string;
@@ -78,6 +78,152 @@ declare class Server {
78
78
  logging: {
79
79
  $ref: string;
80
80
  };
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 {{ [url: string]: string | ProxyConfigArrayItem }} ProxyConfigMap
158
+ */
159
+ /**
160
+ * @typedef {Object} OpenApp
161
+ * @property {string} [name]
162
+ * @property {string[]} [arguments]
163
+ */
164
+ /**
165
+ * @typedef {Object} Open
166
+ * @property {string | string[] | OpenApp} [app]
167
+ * @property {string | string[]} [target]
168
+ */
169
+ /**
170
+ * @typedef {Object} NormalizedOpen
171
+ * @property {string} target
172
+ * @property {import("open").Options} options
173
+ */
174
+ /**
175
+ * @typedef {Object} WebSocketURL
176
+ * @property {string} [hostname]
177
+ * @property {string} [password]
178
+ * @property {string} [pathname]
179
+ * @property {number | string} [port]
180
+ * @property {string} [protocol]
181
+ * @property {string} [username]
182
+ */
183
+ /**
184
+ * @typedef {boolean | ((error: Error) => void)} OverlayMessageOptions
185
+ */
186
+ /**
187
+ * @typedef {Object} ClientConfiguration
188
+ * @property {"log" | "info" | "warn" | "error" | "none" | "verbose"} [logging]
189
+ * @property {boolean | { warnings?: OverlayMessageOptions, errors?: OverlayMessageOptions, runtimeErrors?: OverlayMessageOptions }} [overlay]
190
+ * @property {boolean} [progress]
191
+ * @property {boolean | number} [reconnect]
192
+ * @property {"ws" | "sockjs" | string} [webSocketTransport]
193
+ * @property {string | WebSocketURL} [webSocketURL]
194
+ */
195
+ /**
196
+ * @typedef {Array<{ key: string; value: string }> | Record<string, string | string[]>} Headers
197
+ */
198
+ /**
199
+ * @typedef {{ name?: string, path?: string, middleware: ExpressRequestHandler | ExpressErrorRequestHandler } | ExpressRequestHandler | ExpressErrorRequestHandler} Middleware
200
+ */
201
+ /**
202
+ * @typedef {Object} Configuration
203
+ * @property {boolean | string} [ipc]
204
+ * @property {Host} [host]
205
+ * @property {Port} [port]
206
+ * @property {boolean | "only"} [hot]
207
+ * @property {boolean} [liveReload]
208
+ * @property {DevMiddlewareOptions<Request, Response>} [devMiddleware]
209
+ * @property {boolean} [compress]
210
+ * @property {"auto" | "all" | string | string[]} [allowedHosts]
211
+ * @property {boolean | ConnectHistoryApiFallbackOptions} [historyApiFallback]
212
+ * @property {boolean | Record<string, never> | BonjourOptions} [bonjour]
213
+ * @property {string | string[] | WatchFiles | Array<string | WatchFiles>} [watchFiles]
214
+ * @property {boolean | string | Static | Array<string | Static>} [static]
215
+ * @property {boolean | ServerOptions} [https]
216
+ * @property {boolean} [http2]
217
+ * @property {"http" | "https" | "spdy" | string | ServerConfiguration} [server]
218
+ * @property {boolean | "sockjs" | "ws" | string | WebSocketServerConfiguration} [webSocketServer]
219
+ * @property {ProxyConfigMap | ProxyConfigArrayItem | ProxyConfigArray} [proxy]
220
+ * @property {boolean | string | Open | Array<string | Open>} [open]
221
+ * @property {boolean} [setupExitSignals]
222
+ * @property {boolean | ClientConfiguration} [client]
223
+ * @property {Headers | ((req: Request, res: Response, context: DevMiddlewareContext<Request, Response>) => Headers)} [headers]
224
+ * @property {(devServer: Server) => void} [onListening]
225
+ * @property {(middlewares: Middleware[], devServer: Server) => Middleware[]} [setupMiddlewares]
226
+ */
81
227
  overlay: {
82
228
  $ref: string;
83
229
  };
@@ -104,139 +250,6 @@ declare class Server {
104
250
  description: string;
105
251
  link: string;
106
252
  };
107
- /**
108
- * @template Request, Response
109
- * @typedef {import("webpack-dev-middleware").Context<IncomingMessage, ServerResponse>} DevMiddlewareContext
110
- */
111
- /**
112
- * @typedef {"local-ip" | "local-ipv4" | "local-ipv6" | string} Host
113
- */
114
- /**
115
- * @typedef {number | string | "auto"} Port
116
- */
117
- /**
118
- * @typedef {Object} WatchFiles
119
- * @property {string | string[]} paths
120
- * @property {WatchOptions & { aggregateTimeout?: number, ignored?: WatchOptions["ignored"], poll?: number | boolean }} [options]
121
- */
122
- /**
123
- * @typedef {Object} Static
124
- * @property {string} [directory]
125
- * @property {string | string[]} [publicPath]
126
- * @property {boolean | ServeIndexOptions} [serveIndex]
127
- * @property {ServeStaticOptions} [staticOptions]
128
- * @property {boolean | WatchOptions & { aggregateTimeout?: number, ignored?: WatchOptions["ignored"], poll?: number | boolean }} [watch]
129
- */
130
- /**
131
- * @typedef {Object} NormalizedStatic
132
- * @property {string} directory
133
- * @property {string[]} publicPath
134
- * @property {false | ServeIndexOptions} serveIndex
135
- * @property {ServeStaticOptions} staticOptions
136
- * @property {false | WatchOptions} watch
137
- */
138
- /**
139
- * @typedef {Object} ServerConfiguration
140
- * @property {"http" | "https" | "spdy" | string} [type]
141
- * @property {ServerOptions} [options]
142
- */
143
- /**
144
- * @typedef {Object} WebSocketServerConfiguration
145
- * @property {"sockjs" | "ws" | string | Function} [type]
146
- * @property {Record<string, any>} [options]
147
- */
148
- /**
149
- * @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
150
- */
151
- /**
152
- * @typedef {import("ws").WebSocketServer | import("sockjs").Server & { close: import("ws").WebSocketServer["close"] }} WebSocketServer
153
- */
154
- /**
155
- * @typedef {{ implementation: WebSocketServer, clients: ClientConnection[] }} WebSocketServerImplementation
156
- */
157
- /**
158
- * @callback ByPass
159
- * @param {Request} req
160
- * @param {Response} res
161
- * @param {ProxyConfigArrayItem} proxyConfig
162
- */
163
- /**
164
- * @typedef {{ path?: HttpProxyMiddlewareOptionsFilter | undefined, context?: HttpProxyMiddlewareOptionsFilter | undefined } & { bypass?: ByPass } & HttpProxyMiddlewareOptions } ProxyConfigArrayItem
165
- */
166
- /**
167
- * @typedef {(ProxyConfigArrayItem | ((req?: Request | undefined, res?: Response | undefined, next?: NextFunction | undefined) => ProxyConfigArrayItem))[]} ProxyConfigArray
168
- */
169
- /**
170
- * @typedef {{ [url: string]: string | ProxyConfigArrayItem }} ProxyConfigMap
171
- */
172
- /**
173
- * @typedef {Object} OpenApp
174
- * @property {string} [name]
175
- * @property {string[]} [arguments]
176
- */
177
- /**
178
- * @typedef {Object} Open
179
- * @property {string | string[] | OpenApp} [app]
180
- * @property {string | string[]} [target]
181
- */
182
- /**
183
- * @typedef {Object} NormalizedOpen
184
- * @property {string} target
185
- * @property {import("open").Options} options
186
- */
187
- /**
188
- * @typedef {Object} WebSocketURL
189
- * @property {string} [hostname]
190
- * @property {string} [password]
191
- * @property {string} [pathname]
192
- * @property {number | string} [port]
193
- * @property {string} [protocol]
194
- * @property {string} [username]
195
- */
196
- /**
197
- * @typedef {boolean | ((error: Error) => void)} OverlayMessageOptions
198
- */
199
- /**
200
- * @typedef {Object} ClientConfiguration
201
- * @property {"log" | "info" | "warn" | "error" | "none" | "verbose"} [logging]
202
- * @property {boolean | { warnings?: OverlayMessageOptions, errors?: OverlayMessageOptions, runtimeErrors?: OverlayMessageOptions }} [overlay]
203
- * @property {boolean} [progress]
204
- * @property {boolean | number} [reconnect]
205
- * @property {"ws" | "sockjs" | string} [webSocketTransport]
206
- * @property {string | WebSocketURL} [webSocketURL]
207
- */
208
- /**
209
- * @typedef {Array<{ key: string; value: string }> | Record<string, string | string[]>} Headers
210
- */
211
- /**
212
- * @typedef {{ name?: string, path?: string, middleware: ExpressRequestHandler | ExpressErrorRequestHandler } | ExpressRequestHandler | ExpressErrorRequestHandler} Middleware
213
- */
214
- /**
215
- * @typedef {Object} Configuration
216
- * @property {boolean | string} [ipc]
217
- * @property {Host} [host]
218
- * @property {Port} [port]
219
- * @property {boolean | "only"} [hot]
220
- * @property {boolean} [liveReload]
221
- * @property {DevMiddlewareOptions<Request, Response>} [devMiddleware]
222
- * @property {boolean} [compress]
223
- * @property {"auto" | "all" | string | string[]} [allowedHosts]
224
- * @property {boolean | ConnectHistoryApiFallbackOptions} [historyApiFallback]
225
- * @property {boolean | Record<string, never> | BonjourOptions} [bonjour]
226
- * @property {string | string[] | WatchFiles | Array<string | WatchFiles>} [watchFiles]
227
- * @property {boolean | string | Static | Array<string | Static>} [static]
228
- * @property {boolean | ServerOptions} [https]
229
- * @property {boolean} [http2]
230
- * @property {"http" | "https" | "spdy" | string | ServerConfiguration} [server]
231
- * @property {boolean | "sockjs" | "ws" | string | WebSocketServerConfiguration} [webSocketServer]
232
- * @property {ProxyConfigMap | ProxyConfigArrayItem | ProxyConfigArray} [proxy]
233
- * @property {boolean | string | Open | Array<string | Open>} [open]
234
- * @property {boolean} [setupExitSignals]
235
- * @property {boolean | ClientConfiguration} [client]
236
- * @property {Headers | ((req: Request, res: Response, context: DevMiddlewareContext<Request, Response>) => Headers)} [headers]
237
- * @property {(devServer: Server) => void} [onListening]
238
- * @property {(middlewares: Middleware[], devServer: Server) => Middleware[]} [setupMiddlewares]
239
- */
240
253
  ClientOverlay: {
241
254
  anyOf: (
242
255
  | {
@@ -282,7 +295,9 @@ declare class Server {
282
295
  instanceof?: undefined;
283
296
  }
284
297
  | {
285
- instanceof: string;
298
+ instanceof: string /**
299
+ * @typedef {import("ws").WebSocketServer | import("sockjs").Server & { close: import("ws").WebSocketServer["close"] }} WebSocketServer
300
+ */;
286
301
  description: string;
287
302
  type?: undefined;
288
303
  cli?: undefined;
@@ -308,6 +323,69 @@ declare class Server {
308
323
  )[];
309
324
  };
310
325
  trustedTypesPolicyName: {
326
+ /**
327
+ * @typedef {Object} Open
328
+ * @property {string | string[] | OpenApp} [app]
329
+ * @property {string | string[]} [target]
330
+ */
331
+ /**
332
+ * @typedef {Object} NormalizedOpen
333
+ * @property {string} target
334
+ * @property {import("open").Options} options
335
+ */
336
+ /**
337
+ * @typedef {Object} WebSocketURL
338
+ * @property {string} [hostname]
339
+ * @property {string} [password]
340
+ * @property {string} [pathname]
341
+ * @property {number | string} [port]
342
+ * @property {string} [protocol]
343
+ * @property {string} [username]
344
+ */
345
+ /**
346
+ * @typedef {boolean | ((error: Error) => void)} OverlayMessageOptions
347
+ */
348
+ /**
349
+ * @typedef {Object} ClientConfiguration
350
+ * @property {"log" | "info" | "warn" | "error" | "none" | "verbose"} [logging]
351
+ * @property {boolean | { warnings?: OverlayMessageOptions, errors?: OverlayMessageOptions, runtimeErrors?: OverlayMessageOptions }} [overlay]
352
+ * @property {boolean} [progress]
353
+ * @property {boolean | number} [reconnect]
354
+ * @property {"ws" | "sockjs" | string} [webSocketTransport]
355
+ * @property {string | WebSocketURL} [webSocketURL]
356
+ */
357
+ /**
358
+ * @typedef {Array<{ key: string; value: string }> | Record<string, string | string[]>} Headers
359
+ */
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 {ProxyConfigMap | ProxyConfigArrayItem | 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
+ */
311
389
  description: string;
312
390
  type: string;
313
391
  };
@@ -461,6 +539,9 @@ declare class Server {
461
539
  $ref: string;
462
540
  };
463
541
  minItems: number;
542
+ /**
543
+ * @type {Socket[]}
544
+ */
464
545
  instanceof?: undefined;
465
546
  }
466
547
  | {
@@ -560,6 +641,11 @@ declare class Server {
560
641
  OnListening: {
561
642
  instanceof: string;
562
643
  description: string;
644
+ /**
645
+ * @param {Port} port
646
+ * @param {string} host
647
+ * @returns {Promise<number | string>}
648
+ */
563
649
  link: string;
564
650
  };
565
651
  Open: {
@@ -586,9 +672,7 @@ declare class Server {
586
672
  type: string;
587
673
  cli: {
588
674
  negatedDescription: string;
589
- } /**
590
- * @type {string | undefined}
591
- */;
675
+ };
592
676
  };
593
677
  OpenObject: {
594
678
  type: string;
@@ -621,11 +705,7 @@ declare class Server {
621
705
  type: string;
622
706
  items: {
623
707
  type: string;
624
- minLength: number /**
625
- * @private
626
- * @param {Compiler} compiler
627
- * @returns bool
628
- */;
708
+ minLength: number;
629
709
  };
630
710
  minItems: number;
631
711
  minLength?: undefined;
@@ -701,11 +781,11 @@ declare class Server {
701
781
  anyOf: (
702
782
  | {
703
783
  type: string;
704
- instanceof?: undefined;
784
+ /** @type {WebSocketURL} */ instanceof?: undefined;
705
785
  }
706
786
  | {
707
787
  instanceof: string;
708
- type?: undefined;
788
+ /** @type {ClientConfiguration} */ type?: undefined;
709
789
  }
710
790
  )[];
711
791
  };
@@ -985,7 +1065,7 @@ declare class Server {
985
1065
  directory: {
986
1066
  type: string;
987
1067
  minLength: number;
988
- /** @type {MultiCompiler} */ description: string;
1068
+ description: string;
989
1069
  link: string;
990
1070
  };
991
1071
  staticOptions: {
@@ -1110,7 +1190,7 @@ declare class Server {
1110
1190
  };
1111
1191
  WatchFilesString: {
1112
1192
  type: string;
1113
- minLength: number;
1193
+ /** @type {NormalizedStatic} */ minLength: number;
1114
1194
  };
1115
1195
  WebSocketServer: {
1116
1196
  anyOf: {
@@ -1388,8 +1468,14 @@ declare class Server {
1388
1468
  private setupDevMiddleware;
1389
1469
  middleware:
1390
1470
  | import("webpack-dev-middleware").API<
1391
- import("http").IncomingMessage,
1392
- import("http").ServerResponse<import("http").IncomingMessage>
1471
+ import("express").Request<
1472
+ import("express-serve-static-core").ParamsDictionary,
1473
+ any,
1474
+ any,
1475
+ qs.ParsedQs,
1476
+ Record<string, any>
1477
+ >,
1478
+ import("express").Response<any, Record<string, any>>
1393
1479
  >
1394
1480
  | null
1395
1481
  | undefined;
@@ -1529,8 +1615,6 @@ declare namespace Server {
1529
1615
  Stats,
1530
1616
  MultiStats,
1531
1617
  NetworkInterfaceInfo,
1532
- Request,
1533
- Response,
1534
1618
  NextFunction,
1535
1619
  ExpressRequestHandler,
1536
1620
  ExpressErrorRequestHandler,
@@ -1551,6 +1635,8 @@ declare namespace Server {
1551
1635
  ServerResponse,
1552
1636
  OpenOptions,
1553
1637
  ServerOptions,
1638
+ Request,
1639
+ Response,
1554
1640
  DevMiddlewareOptions,
1555
1641
  DevMiddlewareContext,
1556
1642
  Host,
@@ -1596,8 +1682,6 @@ type StatsCompilation = import("webpack").StatsCompilation;
1596
1682
  type Stats = import("webpack").Stats;
1597
1683
  type MultiStats = import("webpack").MultiStats;
1598
1684
  type NetworkInterfaceInfo = import("os").NetworkInterfaceInfo;
1599
- type Request = import("express").Request;
1600
- type Response = import("express").Response;
1601
1685
  type NextFunction = import("express").NextFunction;
1602
1686
  type ExpressRequestHandler = import("express").RequestHandler;
1603
1687
  type ExpressErrorRequestHandler = import("express").ErrorRequestHandler;
@@ -1625,10 +1709,28 @@ type ServerOptions = import("https").ServerOptions & {
1625
1709
  protocols?: string[] | undefined;
1626
1710
  };
1627
1711
  };
1628
- type DevMiddlewareOptions<Request_1, Response_1> =
1629
- import("webpack-dev-middleware").Options<IncomingMessage, ServerResponse>;
1630
- type DevMiddlewareContext<Request_1, Response_1> =
1631
- import("webpack-dev-middleware").Context<IncomingMessage, ServerResponse>;
1712
+ type Request = import("express").Request;
1713
+ type Response = import("express").Response;
1714
+ type DevMiddlewareOptions<
1715
+ T extends import("express").Request<
1716
+ import("express-serve-static-core").ParamsDictionary,
1717
+ any,
1718
+ any,
1719
+ qs.ParsedQs,
1720
+ Record<string, any>
1721
+ >,
1722
+ U extends import("express").Response<any, Record<string, any>>,
1723
+ > = import("webpack-dev-middleware").Options<T, U>;
1724
+ type DevMiddlewareContext<
1725
+ T extends import("express").Request<
1726
+ import("express-serve-static-core").ParamsDictionary,
1727
+ any,
1728
+ any,
1729
+ qs.ParsedQs,
1730
+ Record<string, any>
1731
+ >,
1732
+ U extends import("express").Response<any, Record<string, any>>,
1733
+ > = import("webpack-dev-middleware").Context<T, U>;
1632
1734
  type Host = "local-ip" | "local-ipv4" | "local-ipv6" | string;
1633
1735
  type Port = number | string | "auto";
1634
1736
  type WatchFiles = {
@@ -1767,7 +1869,18 @@ type Configuration = {
1767
1869
  port?: Port | undefined;
1768
1870
  hot?: boolean | "only" | undefined;
1769
1871
  liveReload?: boolean | undefined;
1770
- devMiddleware?: DevMiddlewareOptions<Request_1, Response_1> | undefined;
1872
+ devMiddleware?:
1873
+ | DevMiddlewareOptions<
1874
+ import("express").Request<
1875
+ import("express-serve-static-core").ParamsDictionary,
1876
+ any,
1877
+ any,
1878
+ qs.ParsedQs,
1879
+ Record<string, any>
1880
+ >,
1881
+ import("express").Response<any, Record<string, any>>
1882
+ >
1883
+ | undefined;
1771
1884
  compress?: boolean | undefined;
1772
1885
  allowedHosts?: string | string[] | undefined;
1773
1886
  historyApiFallback?: