diff --git a/lib/Server.js b/lib/Server.js index 1840b33e7c..032ef9a953 100644 --- a/lib/Server.js +++ b/lib/Server.js @@ -18,8 +18,6 @@ const schema = require("./options.json"); /** @typedef {import("webpack").Stats} Stats */ /** @typedef {import("webpack").MultiStats} MultiStats */ /** @typedef {import("os").NetworkInterfaceInfo} NetworkInterfaceInfo */ -/** @typedef {import("express").Request} Request */ -/** @typedef {import("express").Response} Response */ /** @typedef {import("express").NextFunction} NextFunction */ /** @typedef {import("express").RequestHandler} ExpressRequestHandler */ /** @typedef {import("express").ErrorRequestHandler} ExpressErrorRequestHandler */ @@ -42,14 +40,19 @@ const schema = require("./options.json"); /** @typedef {import("https").ServerOptions & { spdy?: { plain?: boolean | undefined, ssl?: boolean | undefined, 'x-forwarded-for'?: string | undefined, protocol?: string | undefined, protocols?: string[] | undefined }}} ServerOptions */ +/** @typedef {import("express").Request} Request */ +/** @typedef {import("express").Response} Response */ + /** - * @template Request, Response - * @typedef {import("webpack-dev-middleware").Options} DevMiddlewareOptions + * @template {Request} T + * @template {Response} U + * @typedef {import("webpack-dev-middleware").Options} DevMiddlewareOptions */ /** - * @template Request, Response - * @typedef {import("webpack-dev-middleware").Context} DevMiddlewareContext + * @template {Request} T + * @template {Response} U + * @typedef {import("webpack-dev-middleware").Context} DevMiddlewareContext */ /** @@ -1841,36 +1844,20 @@ class Server { const { app, middleware } = this; /** @type {import("express").Application} */ - (app).get( - "/__webpack_dev_server__/sockjs.bundle.js", - /** - * @param {Request} req - * @param {Response} res - * @returns {void} - */ - (req, res) => { - res.setHeader("Content-Type", "application/javascript"); + (app).get("/__webpack_dev_server__/sockjs.bundle.js", (req, res) => { + res.setHeader("Content-Type", "application/javascript"); - const clientPath = path.join(__dirname, "..", "client"); + const clientPath = path.join(__dirname, "..", "client"); - res.sendFile(path.join(clientPath, "modules/sockjs-client/index.js")); - }, - ); + res.sendFile(path.join(clientPath, "modules/sockjs-client/index.js")); + }); /** @type {import("express").Application} */ - (app).get( - "/webpack-dev-server/invalidate", - /** - * @param {Request} _req - * @param {Response} res - * @returns {void} - */ - (_req, res) => { - this.invalidate(); + (app).get("/webpack-dev-server/invalidate", (_req, res) => { + this.invalidate(); - res.end(); - }, - ); + res.end(); + }); /** @type {import("express").Application} */ (app).get("/webpack-dev-server/open-editor", (req, res) => { @@ -1886,74 +1873,65 @@ class Server { }); /** @type {import("express").Application} */ - (app).get( - "/webpack-dev-server", - /** - * @param {Request} req - * @param {Response} res - * @returns {void} - */ - (req, res) => { - /** @type {import("webpack-dev-middleware").API}*/ - (middleware).waitUntilValid((stats) => { - res.setHeader("Content-Type", "text/html"); - // HEAD requests should not return body content - if (req.method === "HEAD") { - res.end(); - return; - } - res.write( - ' ', - ); + (app).get("/webpack-dev-server", (req, res) => { + /** @type {import("webpack-dev-middleware").API}*/ + (middleware).waitUntilValid((stats) => { + res.setHeader("Content-Type", "text/html"); + // HEAD requests should not return body content + if (req.method === "HEAD") { + res.end(); + return; + } + res.write( + ' ', + ); - const statsForPrint = - typeof (/** @type {MultiStats} */ (stats).stats) !== "undefined" - ? /** @type {MultiStats} */ (stats).toJson().children - : [/** @type {Stats} */ (stats).toJson()]; + const statsForPrint = + typeof (/** @type {MultiStats} */ (stats).stats) !== "undefined" + ? /** @type {MultiStats} */ (stats).toJson().children + : [/** @type {Stats} */ (stats).toJson()]; - res.write(`

Assets Report:

`); + res.write(`

Assets Report:

`); - /** - * @type {StatsCompilation[]} - */ - (statsForPrint).forEach((item, index) => { - res.write("
"); - - const name = - // eslint-disable-next-line no-nested-ternary - typeof item.name !== "undefined" - ? item.name - : /** @type {MultiStats} */ (stats).stats - ? `unnamed[${index}]` - : "unnamed"; - - res.write(`

Compilation: ${name}

`); - res.write("
    "); - - const publicPath = - item.publicPath === "auto" ? "" : item.publicPath; - - for (const asset of /** @type {NonNullable} */ ( - item.assets - )) { - const assetName = asset.name; - const assetURL = `${publicPath}${assetName}`; - - res.write( - `
  • + /** + * @type {StatsCompilation[]} + */ + (statsForPrint).forEach((item, index) => { + res.write("
    "); + + const name = + // eslint-disable-next-line no-nested-ternary + typeof item.name !== "undefined" + ? item.name + : /** @type {MultiStats} */ (stats).stats + ? `unnamed[${index}]` + : "unnamed"; + + res.write(`

    Compilation: ${name}

    `); + res.write("
      "); + + const publicPath = item.publicPath === "auto" ? "" : item.publicPath; + + for (const asset of /** @type {NonNullable} */ ( + item.assets + )) { + const assetName = asset.name; + const assetURL = `${publicPath}${assetName}`; + + res.write( + `
    • ${assetName}
    • `, - ); - } - - res.write("
    "); - res.write("
    "); - }); + ); + } - res.end(""); + res.write("
"); + res.write("
"); }); - }, - ); + + res.end(""); + }); + }); } /** diff --git a/types/lib/Server.d.ts b/types/lib/Server.d.ts index b638ce9e99..4351ba4041 100644 --- a/types/lib/Server.d.ts +++ b/types/lib/Server.d.ts @@ -49,14 +49,14 @@ declare class Server { link?: undefined; } | { - type: string; + type: string /** @typedef {import("express").ErrorRequestHandler} ExpressErrorRequestHandler */; description: string; link: string; cli?: undefined; } )[]; description: string; - link: string /** @typedef {import("connect-history-api-fallback").Options} ConnectHistoryApiFallbackOptions */; + link: string; }; Client: { description: string; @@ -78,6 +78,152 @@ declare class Server { logging: { $ref: string; }; + /** @typedef {import("net").Socket} Socket */ + /** @typedef {import("http").IncomingMessage} IncomingMessage */ + /** @typedef {import("http").ServerResponse} ServerResponse */ + /** @typedef {import("open").Options} OpenOptions */ + /** @typedef {import("https").ServerOptions & { spdy?: { plain?: boolean | undefined, ssl?: boolean | undefined, 'x-forwarded-for'?: string | undefined, protocol?: string | undefined, protocols?: string[] | undefined }}} ServerOptions */ + /** @typedef {import("express").Request} Request */ + /** @typedef {import("express").Response} Response */ + /** + * @template {Request} T + * @template {Response} U + * @typedef {import("webpack-dev-middleware").Options} DevMiddlewareOptions + */ + /** + * @template {Request} T + * @template {Response} U + * @typedef {import("webpack-dev-middleware").Context} DevMiddlewareContext + */ + /** + * @typedef {"local-ip" | "local-ipv4" | "local-ipv6" | string} Host + */ + /** + * @typedef {number | string | "auto"} Port + */ + /** + * @typedef {Object} WatchFiles + * @property {string | string[]} paths + * @property {WatchOptions & { aggregateTimeout?: number, ignored?: WatchOptions["ignored"], poll?: number | boolean }} [options] + */ + /** + * @typedef {Object} Static + * @property {string} [directory] + * @property {string | string[]} [publicPath] + * @property {boolean | ServeIndexOptions} [serveIndex] + * @property {ServeStaticOptions} [staticOptions] + * @property {boolean | WatchOptions & { aggregateTimeout?: number, ignored?: WatchOptions["ignored"], poll?: number | boolean }} [watch] + */ + /** + * @typedef {Object} NormalizedStatic + * @property {string} directory + * @property {string[]} publicPath + * @property {false | ServeIndexOptions} serveIndex + * @property {ServeStaticOptions} staticOptions + * @property {false | WatchOptions} watch + */ + /** + * @typedef {Object} ServerConfiguration + * @property {"http" | "https" | "spdy" | string} [type] + * @property {ServerOptions} [options] + */ + /** + * @typedef {Object} WebSocketServerConfiguration + * @property {"sockjs" | "ws" | string | Function} [type] + * @property {Record} [options] + */ + /** + * @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 + */ + /** + * @typedef {import("ws").WebSocketServer | import("sockjs").Server & { close: import("ws").WebSocketServer["close"] }} WebSocketServer + */ + /** + * @typedef {{ implementation: WebSocketServer, clients: ClientConnection[] }} WebSocketServerImplementation + */ + /** + * @callback ByPass + * @param {Request} req + * @param {Response} res + * @param {ProxyConfigArrayItem} proxyConfig + */ + /** + * @typedef {{ path?: HttpProxyMiddlewareOptionsFilter | undefined, context?: HttpProxyMiddlewareOptionsFilter | undefined } & { bypass?: ByPass } & HttpProxyMiddlewareOptions } ProxyConfigArrayItem + */ + /** + * @typedef {(ProxyConfigArrayItem | ((req?: Request | undefined, res?: Response | undefined, next?: NextFunction | undefined) => ProxyConfigArrayItem))[]} ProxyConfigArray + */ + /** + * @typedef {{ [url: string]: string | ProxyConfigArrayItem }} ProxyConfigMap + */ + /** + * @typedef {Object} OpenApp + * @property {string} [name] + * @property {string[]} [arguments] + */ + /** + * @typedef {Object} Open + * @property {string | string[] | OpenApp} [app] + * @property {string | string[]} [target] + */ + /** + * @typedef {Object} NormalizedOpen + * @property {string} target + * @property {import("open").Options} options + */ + /** + * @typedef {Object} WebSocketURL + * @property {string} [hostname] + * @property {string} [password] + * @property {string} [pathname] + * @property {number | string} [port] + * @property {string} [protocol] + * @property {string} [username] + */ + /** + * @typedef {boolean | ((error: Error) => void)} OverlayMessageOptions + */ + /** + * @typedef {Object} ClientConfiguration + * @property {"log" | "info" | "warn" | "error" | "none" | "verbose"} [logging] + * @property {boolean | { warnings?: OverlayMessageOptions, errors?: OverlayMessageOptions, runtimeErrors?: OverlayMessageOptions }} [overlay] + * @property {boolean} [progress] + * @property {boolean | number} [reconnect] + * @property {"ws" | "sockjs" | string} [webSocketTransport] + * @property {string | WebSocketURL} [webSocketURL] + */ + /** + * @typedef {Array<{ key: string; value: string }> | Record} Headers + */ + /** + * @typedef {{ name?: string, path?: string, middleware: ExpressRequestHandler | ExpressErrorRequestHandler } | ExpressRequestHandler | ExpressErrorRequestHandler} Middleware + */ + /** + * @typedef {Object} Configuration + * @property {boolean | string} [ipc] + * @property {Host} [host] + * @property {Port} [port] + * @property {boolean | "only"} [hot] + * @property {boolean} [liveReload] + * @property {DevMiddlewareOptions} [devMiddleware] + * @property {boolean} [compress] + * @property {"auto" | "all" | string | string[]} [allowedHosts] + * @property {boolean | ConnectHistoryApiFallbackOptions} [historyApiFallback] + * @property {boolean | Record | BonjourOptions} [bonjour] + * @property {string | string[] | WatchFiles | Array} [watchFiles] + * @property {boolean | string | Static | Array} [static] + * @property {boolean | ServerOptions} [https] + * @property {boolean} [http2] + * @property {"http" | "https" | "spdy" | string | ServerConfiguration} [server] + * @property {boolean | "sockjs" | "ws" | string | WebSocketServerConfiguration} [webSocketServer] + * @property {ProxyConfigMap | ProxyConfigArrayItem | ProxyConfigArray} [proxy] + * @property {boolean | string | Open | Array} [open] + * @property {boolean} [setupExitSignals] + * @property {boolean | ClientConfiguration} [client] + * @property {Headers | ((req: Request, res: Response, context: DevMiddlewareContext) => Headers)} [headers] + * @property {(devServer: Server) => void} [onListening] + * @property {(middlewares: Middleware[], devServer: Server) => Middleware[]} [setupMiddlewares] + */ overlay: { $ref: string; }; @@ -104,139 +250,6 @@ declare class Server { description: string; link: string; }; - /** - * @template Request, Response - * @typedef {import("webpack-dev-middleware").Context} DevMiddlewareContext - */ - /** - * @typedef {"local-ip" | "local-ipv4" | "local-ipv6" | string} Host - */ - /** - * @typedef {number | string | "auto"} Port - */ - /** - * @typedef {Object} WatchFiles - * @property {string | string[]} paths - * @property {WatchOptions & { aggregateTimeout?: number, ignored?: WatchOptions["ignored"], poll?: number | boolean }} [options] - */ - /** - * @typedef {Object} Static - * @property {string} [directory] - * @property {string | string[]} [publicPath] - * @property {boolean | ServeIndexOptions} [serveIndex] - * @property {ServeStaticOptions} [staticOptions] - * @property {boolean | WatchOptions & { aggregateTimeout?: number, ignored?: WatchOptions["ignored"], poll?: number | boolean }} [watch] - */ - /** - * @typedef {Object} NormalizedStatic - * @property {string} directory - * @property {string[]} publicPath - * @property {false | ServeIndexOptions} serveIndex - * @property {ServeStaticOptions} staticOptions - * @property {false | WatchOptions} watch - */ - /** - * @typedef {Object} ServerConfiguration - * @property {"http" | "https" | "spdy" | string} [type] - * @property {ServerOptions} [options] - */ - /** - * @typedef {Object} WebSocketServerConfiguration - * @property {"sockjs" | "ws" | string | Function} [type] - * @property {Record} [options] - */ - /** - * @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 - */ - /** - * @typedef {import("ws").WebSocketServer | import("sockjs").Server & { close: import("ws").WebSocketServer["close"] }} WebSocketServer - */ - /** - * @typedef {{ implementation: WebSocketServer, clients: ClientConnection[] }} WebSocketServerImplementation - */ - /** - * @callback ByPass - * @param {Request} req - * @param {Response} res - * @param {ProxyConfigArrayItem} proxyConfig - */ - /** - * @typedef {{ path?: HttpProxyMiddlewareOptionsFilter | undefined, context?: HttpProxyMiddlewareOptionsFilter | undefined } & { bypass?: ByPass } & HttpProxyMiddlewareOptions } ProxyConfigArrayItem - */ - /** - * @typedef {(ProxyConfigArrayItem | ((req?: Request | undefined, res?: Response | undefined, next?: NextFunction | undefined) => ProxyConfigArrayItem))[]} ProxyConfigArray - */ - /** - * @typedef {{ [url: string]: string | ProxyConfigArrayItem }} ProxyConfigMap - */ - /** - * @typedef {Object} OpenApp - * @property {string} [name] - * @property {string[]} [arguments] - */ - /** - * @typedef {Object} Open - * @property {string | string[] | OpenApp} [app] - * @property {string | string[]} [target] - */ - /** - * @typedef {Object} NormalizedOpen - * @property {string} target - * @property {import("open").Options} options - */ - /** - * @typedef {Object} WebSocketURL - * @property {string} [hostname] - * @property {string} [password] - * @property {string} [pathname] - * @property {number | string} [port] - * @property {string} [protocol] - * @property {string} [username] - */ - /** - * @typedef {boolean | ((error: Error) => void)} OverlayMessageOptions - */ - /** - * @typedef {Object} ClientConfiguration - * @property {"log" | "info" | "warn" | "error" | "none" | "verbose"} [logging] - * @property {boolean | { warnings?: OverlayMessageOptions, errors?: OverlayMessageOptions, runtimeErrors?: OverlayMessageOptions }} [overlay] - * @property {boolean} [progress] - * @property {boolean | number} [reconnect] - * @property {"ws" | "sockjs" | string} [webSocketTransport] - * @property {string | WebSocketURL} [webSocketURL] - */ - /** - * @typedef {Array<{ key: string; value: string }> | Record} Headers - */ - /** - * @typedef {{ name?: string, path?: string, middleware: ExpressRequestHandler | ExpressErrorRequestHandler } | ExpressRequestHandler | ExpressErrorRequestHandler} Middleware - */ - /** - * @typedef {Object} Configuration - * @property {boolean | string} [ipc] - * @property {Host} [host] - * @property {Port} [port] - * @property {boolean | "only"} [hot] - * @property {boolean} [liveReload] - * @property {DevMiddlewareOptions} [devMiddleware] - * @property {boolean} [compress] - * @property {"auto" | "all" | string | string[]} [allowedHosts] - * @property {boolean | ConnectHistoryApiFallbackOptions} [historyApiFallback] - * @property {boolean | Record | BonjourOptions} [bonjour] - * @property {string | string[] | WatchFiles | Array} [watchFiles] - * @property {boolean | string | Static | Array} [static] - * @property {boolean | ServerOptions} [https] - * @property {boolean} [http2] - * @property {"http" | "https" | "spdy" | string | ServerConfiguration} [server] - * @property {boolean | "sockjs" | "ws" | string | WebSocketServerConfiguration} [webSocketServer] - * @property {ProxyConfigMap | ProxyConfigArrayItem | ProxyConfigArray} [proxy] - * @property {boolean | string | Open | Array} [open] - * @property {boolean} [setupExitSignals] - * @property {boolean | ClientConfiguration} [client] - * @property {Headers | ((req: Request, res: Response, context: DevMiddlewareContext) => Headers)} [headers] - * @property {(devServer: Server) => void} [onListening] - * @property {(middlewares: Middleware[], devServer: Server) => Middleware[]} [setupMiddlewares] - */ ClientOverlay: { anyOf: ( | { @@ -282,7 +295,9 @@ declare class Server { instanceof?: undefined; } | { - instanceof: string; + instanceof: string /** + * @typedef {import("ws").WebSocketServer | import("sockjs").Server & { close: import("ws").WebSocketServer["close"] }} WebSocketServer + */; description: string; type?: undefined; cli?: undefined; @@ -308,6 +323,69 @@ declare class Server { )[]; }; trustedTypesPolicyName: { + /** + * @typedef {Object} Open + * @property {string | string[] | OpenApp} [app] + * @property {string | string[]} [target] + */ + /** + * @typedef {Object} NormalizedOpen + * @property {string} target + * @property {import("open").Options} options + */ + /** + * @typedef {Object} WebSocketURL + * @property {string} [hostname] + * @property {string} [password] + * @property {string} [pathname] + * @property {number | string} [port] + * @property {string} [protocol] + * @property {string} [username] + */ + /** + * @typedef {boolean | ((error: Error) => void)} OverlayMessageOptions + */ + /** + * @typedef {Object} ClientConfiguration + * @property {"log" | "info" | "warn" | "error" | "none" | "verbose"} [logging] + * @property {boolean | { warnings?: OverlayMessageOptions, errors?: OverlayMessageOptions, runtimeErrors?: OverlayMessageOptions }} [overlay] + * @property {boolean} [progress] + * @property {boolean | number} [reconnect] + * @property {"ws" | "sockjs" | string} [webSocketTransport] + * @property {string | WebSocketURL} [webSocketURL] + */ + /** + * @typedef {Array<{ key: string; value: string }> | Record} Headers + */ + /** + * @typedef {{ name?: string, path?: string, middleware: ExpressRequestHandler | ExpressErrorRequestHandler } | ExpressRequestHandler | ExpressErrorRequestHandler} Middleware + */ + /** + * @typedef {Object} Configuration + * @property {boolean | string} [ipc] + * @property {Host} [host] + * @property {Port} [port] + * @property {boolean | "only"} [hot] + * @property {boolean} [liveReload] + * @property {DevMiddlewareOptions} [devMiddleware] + * @property {boolean} [compress] + * @property {"auto" | "all" | string | string[]} [allowedHosts] + * @property {boolean | ConnectHistoryApiFallbackOptions} [historyApiFallback] + * @property {boolean | Record | BonjourOptions} [bonjour] + * @property {string | string[] | WatchFiles | Array} [watchFiles] + * @property {boolean | string | Static | Array} [static] + * @property {boolean | ServerOptions} [https] + * @property {boolean} [http2] + * @property {"http" | "https" | "spdy" | string | ServerConfiguration} [server] + * @property {boolean | "sockjs" | "ws" | string | WebSocketServerConfiguration} [webSocketServer] + * @property {ProxyConfigMap | ProxyConfigArrayItem | ProxyConfigArray} [proxy] + * @property {boolean | string | Open | Array} [open] + * @property {boolean} [setupExitSignals] + * @property {boolean | ClientConfiguration} [client] + * @property {Headers | ((req: Request, res: Response, context: DevMiddlewareContext) => Headers)} [headers] + * @property {(devServer: Server) => void} [onListening] + * @property {(middlewares: Middleware[], devServer: Server) => Middleware[]} [setupMiddlewares] + */ description: string; type: string; }; @@ -461,6 +539,9 @@ declare class Server { $ref: string; }; minItems: number; + /** + * @type {Socket[]} + */ instanceof?: undefined; } | { @@ -560,6 +641,11 @@ declare class Server { OnListening: { instanceof: string; description: string; + /** + * @param {Port} port + * @param {string} host + * @returns {Promise} + */ link: string; }; Open: { @@ -586,9 +672,7 @@ declare class Server { type: string; cli: { negatedDescription: string; - } /** - * @type {string | undefined} - */; + }; }; OpenObject: { type: string; @@ -621,11 +705,7 @@ declare class Server { type: string; items: { type: string; - minLength: number /** - * @private - * @param {Compiler} compiler - * @returns bool - */; + minLength: number; }; minItems: number; minLength?: undefined; @@ -701,11 +781,11 @@ declare class Server { anyOf: ( | { type: string; - instanceof?: undefined; + /** @type {WebSocketURL} */ instanceof?: undefined; } | { instanceof: string; - type?: undefined; + /** @type {ClientConfiguration} */ type?: undefined; } )[]; }; @@ -985,7 +1065,7 @@ declare class Server { directory: { type: string; minLength: number; - /** @type {MultiCompiler} */ description: string; + description: string; link: string; }; staticOptions: { @@ -1110,7 +1190,7 @@ declare class Server { }; WatchFilesString: { type: string; - minLength: number; + /** @type {NormalizedStatic} */ minLength: number; }; WebSocketServer: { anyOf: { @@ -1388,8 +1468,14 @@ declare class Server { private setupDevMiddleware; middleware: | import("webpack-dev-middleware").API< - import("http").IncomingMessage, - import("http").ServerResponse + import("express").Request< + import("express-serve-static-core").ParamsDictionary, + any, + any, + qs.ParsedQs, + Record + >, + import("express").Response> > | null | undefined; @@ -1529,8 +1615,6 @@ declare namespace Server { Stats, MultiStats, NetworkInterfaceInfo, - Request, - Response, NextFunction, ExpressRequestHandler, ExpressErrorRequestHandler, @@ -1551,6 +1635,8 @@ declare namespace Server { ServerResponse, OpenOptions, ServerOptions, + Request, + Response, DevMiddlewareOptions, DevMiddlewareContext, Host, @@ -1596,8 +1682,6 @@ type StatsCompilation = import("webpack").StatsCompilation; type Stats = import("webpack").Stats; type MultiStats = import("webpack").MultiStats; type NetworkInterfaceInfo = import("os").NetworkInterfaceInfo; -type Request = import("express").Request; -type Response = import("express").Response; type NextFunction = import("express").NextFunction; type ExpressRequestHandler = import("express").RequestHandler; type ExpressErrorRequestHandler = import("express").ErrorRequestHandler; @@ -1625,10 +1709,28 @@ type ServerOptions = import("https").ServerOptions & { protocols?: string[] | undefined; }; }; -type DevMiddlewareOptions = - import("webpack-dev-middleware").Options; -type DevMiddlewareContext = - import("webpack-dev-middleware").Context; +type Request = import("express").Request; +type Response = import("express").Response; +type DevMiddlewareOptions< + T extends import("express").Request< + import("express-serve-static-core").ParamsDictionary, + any, + any, + qs.ParsedQs, + Record + >, + U extends import("express").Response>, +> = import("webpack-dev-middleware").Options; +type DevMiddlewareContext< + T extends import("express").Request< + import("express-serve-static-core").ParamsDictionary, + any, + any, + qs.ParsedQs, + Record + >, + U extends import("express").Response>, +> = import("webpack-dev-middleware").Context; type Host = "local-ip" | "local-ipv4" | "local-ipv6" | string; type Port = number | string | "auto"; type WatchFiles = { @@ -1767,7 +1869,18 @@ type Configuration = { port?: Port | undefined; hot?: boolean | "only" | undefined; liveReload?: boolean | undefined; - devMiddleware?: DevMiddlewareOptions | undefined; + devMiddleware?: + | DevMiddlewareOptions< + import("express").Request< + import("express-serve-static-core").ParamsDictionary, + any, + any, + qs.ParsedQs, + Record + >, + import("express").Response> + > + | undefined; compress?: boolean | undefined; allowedHosts?: string | string[] | undefined; historyApiFallback?: