From a8b39c25cfacbeef87c302b5448f94f61958f818 Mon Sep 17 00:00:00 2001 From: TrickyPi <530257315@qq.com> Date: Sun, 16 Jan 2022 16:35:47 +0800 Subject: [PATCH 1/3] fix: fix the 4180 issue, under the optionsMethod option. --- lib/Server.js | 26 ++++++++ lib/options.json | 10 +++ test/e2e/options-request-response.test.js | 81 +++++++++++++++++++++++ test/ports-map.js | 1 + 4 files changed, 118 insertions(+) create mode 100644 test/e2e/options-request-response.test.js diff --git a/lib/Server.js b/lib/Server.js index a9323ec7c7..3d76b7227b 100644 --- a/lib/Server.js +++ b/lib/Server.js @@ -200,6 +200,7 @@ const schema = require("./options.json"); * @property {boolean} [setupExitSignals] * @property {boolean | ClientConfiguration} [client] * @property {Headers | ((req: Request, res: Response, context: DevMiddlewareContext) => Headers)} [headers] + * @property {boolean} [optionsMethod] * @property {(devServer: Server) => void} [onAfterSetupMiddleware] * @property {(devServer: Server) => void} [onBeforeSetupMiddleware] * @property {(devServer: Server) => void} [onListening] @@ -2111,6 +2112,31 @@ class Server { middleware: this.setHeaders.bind(this), }); } + if (this.options.optionsMethod) { + /** + * + * @param {Request} req + * @param {Response} res + * @param {NextFunction} next + * @returns {void} + * + */ + const optionsRequestResponseMiddleware = (req, res, next) => { + if (req.method === "OPTIONS") { + res.statusCode = 204; + res.setHeader("Content-Length", "0"); + res.end(); + return; + } + next(); + }; + + middlewares.push({ + name: "options-request-response", + path: "*", + middleware: optionsRequestResponseMiddleware, + }); + } middlewares.push({ name: "webpack-dev-middleware", diff --git a/lib/options.json b/lib/options.json index bd7a5a2f90..053fb71aed 100644 --- a/lib/options.json +++ b/lib/options.json @@ -445,6 +445,13 @@ "description": "Allows to set custom headers on response.", "link": "https://webpack.js.org/configuration/dev-server/#devserverheaders" }, + "OptionsMethod": { + "type": "boolean", + "description": "Response with 204 httpCode when receive an OPTIONS request", + "cli": { + "exclude": true + } + }, "HistoryApiFallback": { "anyOf": [ { @@ -1146,6 +1153,9 @@ "headers": { "$ref": "#/definitions/Headers" }, + "optionsMethod": { + "$ref": "#/definitions/OptionsMethod" + }, "historyApiFallback": { "$ref": "#/definitions/HistoryApiFallback" }, diff --git a/test/e2e/options-request-response.test.js b/test/e2e/options-request-response.test.js new file mode 100644 index 0000000000..cf4d498bc3 --- /dev/null +++ b/test/e2e/options-request-response.test.js @@ -0,0 +1,81 @@ +"use strict"; + +const webpack = require("webpack"); +const Express = require("express"); +const Server = require("../../lib/Server"); +const config = require("../fixtures/client-config/webpack.config"); +const runBrowser = require("../helpers/run-browser"); +const port = require("../ports-map")["options-request-response"]; + +const createWaiting = () => { + let reslove; + let reject; + const waiting = new Promise((resolve$, reject$) => { + reslove = resolve$; + reject = reject$; + }); + return { + reslove, + reject, + waiting, + }; +}; + +describe("handle options-request correctly", () => { + it("should response with 200 http code", async () => { + const compiler = webpack(config); + const [portForServer, portForApp] = port; + const closeApp = await (async () => { + const { reslove, waiting } = createWaiting(); + const app = new Express(); + app.get("/", (req, res) => { + res.sendStatus(200); + }); + const server = app.listen(portForApp, () => { + reslove(); + }); + await waiting; + return async () => { + const { reslove: reslove2, waiting: waiting2 } = createWaiting(); + server.close(() => { + reslove2(); + }); + await waiting2; + }; + })(); + const server = new Server( + { + port: portForServer, + headers: { + "Access-Control-Allow-Origin": "*", + "Access-Control-Allow-Headers": "*", + }, + optionsMethod: true, + }, + compiler + ); + await server.start(); + const { page, browser } = await runBrowser(); + const prefixUrl = "http://127.0.0.1"; + const htmlUrl = `${prefixUrl}:${portForServer}/test.html`; + const appUrl = `${prefixUrl}:${portForApp}`; + await page.goto(appUrl); + const responseStatus = []; + page.on("response", (res) => { + responseStatus.push(res.status()); + }); + await page.evaluate( + (url) => + window.fetch(url, { + headers: { + "another-header": "1", + }, + }), + htmlUrl + ); + await browser.close(); + await server.stop(); + await closeApp(); + expect(responseStatus).toEqual([204, 200]); + }); +}); diff --git a/test/ports-map.js b/test/ports-map.js index 65fd7b7597..4f1a9af647 100644 --- a/test/ports-map.js +++ b/test/ports-map.js @@ -79,6 +79,7 @@ const listOfTests = { "server-option": 1, "normalize-option": 1, "setup-middlewares-option": 1, + "options-request-response": 2, }; let startPort = 8089; From c373320713e6e4d7b951c83707ad94fd9473d91b Mon Sep 17 00:00:00 2001 From: TrickyPi <530257315@qq.com> Date: Fri, 29 Jul 2022 21:50:55 +0800 Subject: [PATCH 2/3] chore: update types --- types/lib/Server.d.ts | 123 ++++++++++++++++++++++++------------------ 1 file changed, 71 insertions(+), 52 deletions(-) diff --git a/types/lib/Server.d.ts b/types/lib/Server.d.ts index fc916a1324..cc2061e3a8 100644 --- a/types/lib/Server.d.ts +++ b/types/lib/Server.d.ts @@ -175,6 +175,7 @@ declare class Server { * @property {boolean} [setupExitSignals] * @property {boolean | ClientConfiguration} [client] * @property {Headers | ((req: Request, res: Response, context: DevMiddlewareContext) => Headers)} [headers] + * @property {boolean} [optionsMethod] * @property {(devServer: Server) => void} [onAfterSetupMiddleware] * @property {(devServer: Server) => void} [onBeforeSetupMiddleware] * @property {(devServer: Server) => void} [onListening] @@ -353,6 +354,7 @@ declare class Server { * @property {boolean} [setupExitSignals] * @property {boolean | ClientConfiguration} [client] * @property {Headers | ((req: Request, res: Response, context: DevMiddlewareContext) => Headers)} [headers] + * @property {boolean} [optionsMethod] * @property {(devServer: Server) => void} [onAfterSetupMiddleware] * @property {(devServer: Server) => void} [onBeforeSetupMiddleware] * @property {(devServer: Server) => void} [onListening] @@ -477,6 +479,7 @@ declare class Server { * @property {boolean} [setupExitSignals] * @property {boolean | ClientConfiguration} [client] * @property {Headers | ((req: Request, res: Response, context: DevMiddlewareContext) => Headers)} [headers] + * @property {boolean} [optionsMethod] * @property {(devServer: Server) => void} [onAfterSetupMiddleware] * @property {(devServer: Server) => void} [onBeforeSetupMiddleware] * @property {(devServer: Server) => void} [onListening] @@ -574,9 +577,6 @@ declare class Server { path: string; }[]; description: string; - /** - * @type {FSWatcher[]} - */ simpleType: string; multiple: boolean; }; @@ -611,10 +611,6 @@ declare class Server { simpleType: string; multiple: boolean; }; - /** - * @param {string} URL - * @returns {boolean} - */ compress: { configs: { type: string; @@ -625,10 +621,6 @@ declare class Server { }[]; description: string; simpleType: string; - /** - * @param {string} gateway - * @returns {string | undefined} - */ multiple: boolean; }; "history-api-fallback": { @@ -641,6 +633,10 @@ declare class Server { }[]; description: string; simpleType: string; + /** + * @param {"v4" | "v6"} family + * @returns {Promise} + */ multiple: boolean; }; host: { @@ -661,13 +657,13 @@ declare class Server { )[]; description: string; simpleType: string; + multiple: boolean; + }; + hot: { /** * @param {Host} hostname * @returns {Promise} */ - multiple: boolean; - }; - hot: { configs: ( | { type: string; @@ -726,9 +722,6 @@ declare class Server { "https-ca-reset": { configs: { description: string; - /** - * @type {string[]} - */ multiple: boolean; path: string; type: string; @@ -757,7 +750,7 @@ declare class Server { }[]; description: string; multiple: boolean; - simpleType: string; + /** @type {ServerConfiguration} */ simpleType: string; }; "https-cert": { configs: { @@ -865,12 +858,6 @@ declare class Server { description: string; negatedDescription: string; path: string; - /** - * prependEntry Method for webpack 4 - * @param {any} originalEntry - * @param {any} newAdditionalEntries - * @returns {any} - */ }[]; description: string; simpleType: string; @@ -894,8 +881,9 @@ declare class Server { )[]; description: string; simpleType: string; - multiple: boolean; + multiple: boolean /** @type {Object} */; }; + /** @type {Object} */ "live-reload": { configs: { type: string; @@ -925,7 +913,7 @@ declare class Server { | { type: string; multiple: boolean; - /** @type {MultiCompiler} */ description: string; + description: string; path: string; } | { @@ -933,7 +921,7 @@ declare class Server { multiple: boolean; description: string; negatedDescription: string; - path: string; + /** @type {MultiCompiler} */ path: string; } )[]; description: string; @@ -961,10 +949,6 @@ declare class Server { description: string; simpleType: string; multiple: boolean; - /** - * @param {WatchOptions & { aggregateTimeout?: number, ignored?: WatchOptions["ignored"], poll?: number | boolean }} watchOptions - * @returns {WatchOptions} - */ }; "open-app-name-reset": { configs: { @@ -1004,6 +988,10 @@ declare class Server { type: string; multiple: boolean; description: string; + /** + * @param {string | Static | undefined} [optionsForStatic] + * @returns {NormalizedStatic} + */ path: string; }[]; description: string; @@ -1195,7 +1183,7 @@ declare class Server { }[]; description: string; multiple: boolean; - simpleType: string /** @type {ServerOptions} */; + simpleType: string; }; static: { configs: ( @@ -1208,7 +1196,7 @@ declare class Server { | { type: string; multiple: boolean; - /** @type {ServerOptions} */ description: string; + description: string; negatedDescription: string; path: string; } @@ -1220,14 +1208,10 @@ declare class Server { "static-directory": { configs: { type: string; - /** @type {any} */ multiple: boolean; + multiple: boolean; description: string; path: string; }[]; - /** - * @param {string | Buffer | undefined} item - * @returns {string | Buffer | undefined} - */ description: string; simpleType: string; multiple: boolean; @@ -1240,7 +1224,7 @@ declare class Server { path: string; }[]; description: string; - /** @type {any} */ simpleType: string; + simpleType: string; multiple: boolean; }; "static-public-path-reset": { @@ -1248,7 +1232,7 @@ declare class Server { type: string; multiple: boolean; description: string; - path: string; + /** @type {ServerOptions} */ path: string; }[]; description: string; simpleType: string; @@ -1352,12 +1336,12 @@ declare class Server { description: string; multiple: boolean; path: string; - type: string /** @type {ServerOptions & { cacert?: ServerOptions["ca"] }} */; + type: string; } )[]; description: string; simpleType: string; - multiple: boolean /** @type {ServerOptions} */; + multiple: boolean; }; }; readonly processArguments: ( @@ -1590,6 +1574,7 @@ declare class Server { * @property {boolean} [setupExitSignals] * @property {boolean | ClientConfiguration} [client] * @property {Headers | ((req: Request, res: Response, context: DevMiddlewareContext) => Headers)} [headers] + * @property {boolean} [optionsMethod] * @property {(devServer: Server) => void} [onAfterSetupMiddleware] * @property {(devServer: Server) => void} [onBeforeSetupMiddleware] * @property {(devServer: Server) => void} [onListening] @@ -1748,6 +1733,7 @@ declare class Server { * @property {boolean} [setupExitSignals] * @property {boolean | ClientConfiguration} [client] * @property {Headers | ((req: Request, res: Response, context: DevMiddlewareContext) => Headers)} [headers] + * @property {boolean} [optionsMethod] * @property {(devServer: Server) => void} [onAfterSetupMiddleware] * @property {(devServer: Server) => void} [onBeforeSetupMiddleware] * @property {(devServer: Server) => void} [onListening] @@ -1834,6 +1820,7 @@ declare class Server { * @property {boolean} [setupExitSignals] * @property {boolean | ClientConfiguration} [client] * @property {Headers | ((req: Request, res: Response, context: DevMiddlewareContext) => Headers)} [headers] + * @property {boolean} [optionsMethod] * @property {(devServer: Server) => void} [onAfterSetupMiddleware] * @property {(devServer: Server) => void} [onBeforeSetupMiddleware] * @property {(devServer: Server) => void} [onListening] @@ -1962,9 +1949,13 @@ declare class Server { type: string; description: string; }; + /** @type {Schema} */ requestCert: { type: string; description: string; + /** + * @type {ReturnType} + * */ cli: { negatedDescription: string; }; @@ -1984,6 +1975,10 @@ declare class Server { type?: undefined; } )[]; + /** + * @private + * @type {RequestHandler[]} + */ }; instanceof?: undefined; } @@ -2063,10 +2058,6 @@ declare class Server { description: string; }; crl: { - /** - * @param {"v4" | "v6"} family - * @returns {Promise} - */ anyOf: ( | { type: string; @@ -2187,6 +2178,9 @@ declare class Server { key: { description: string; type: string; + /** + * @type {string[]} + */ }; value: { description: string; @@ -2221,7 +2215,14 @@ declare class Server { } )[]; description: string; - link: string /** @type {WebSocketURL} */; + link: string; + }; + OptionsMethod: { + type: string; + description: string; + cli: { + exclude: boolean; + }; }; HistoryApiFallback: { anyOf: ( @@ -2235,9 +2236,9 @@ declare class Server { } | { type: string; + /** @type {string} */ description: string; link: string; - /** @type {string} */ cli?: undefined /** @typedef {import("express").Request} Request */; } )[]; @@ -2300,7 +2301,7 @@ declare class Server { cli: { negatedDescription: string; }; - link: string; + /** @type {number | string} */ link: string; }; MagicHTML: { type: string; @@ -2455,6 +2456,7 @@ declare class Server { Proxy: { anyOf: ( | { + /** @type {any} */ type: string; items?: undefined; } @@ -2484,6 +2486,7 @@ declare class Server { link: string; description: string; }; + /** @type {MultiCompiler} */ ServerType: { enum: string[]; }; @@ -2634,6 +2637,10 @@ declare class Server { } | { instanceof: string; + /** + * @param {string | Static | undefined} [optionsForStatic] + * @returns {NormalizedStatic} + */ type?: undefined; } )[]; @@ -2922,10 +2929,10 @@ declare class Server { anyOf: ( | { enum: boolean[]; - /** @type {ServerOptions} */ cli: { - negatedDescription: string; + cli: { + negatedDescription: string /** @type {Array} */; }; - /** @type {ServerOptions} */ $ref?: undefined; + $ref?: undefined; } | { $ref: string; @@ -2955,7 +2962,15 @@ declare class Server { exclude: boolean; }; }; + /** + * @param {string | Buffer | undefined} item + * @returns {string | Buffer | undefined} + */ }; + /** + * @param {string | Buffer | undefined} item + * @returns {string | Buffer | undefined} + */ additionalProperties: boolean; }; WebSocketServerString: { @@ -2983,6 +2998,9 @@ declare class Server { headers: { $ref: string; }; + optionsMethod: { + $ref: string; + }; historyApiFallback: { $ref: string; }; @@ -3459,6 +3477,7 @@ type Configuration = { context: DevMiddlewareContext ) => Headers) | undefined; + optionsMethod?: boolean | undefined; onAfterSetupMiddleware?: ((devServer: Server) => void) | undefined; onBeforeSetupMiddleware?: ((devServer: Server) => void) | undefined; onListening?: ((devServer: Server) => void) | undefined; From da16ee5a583a82cf2ed68c4101942a3c16b40c29 Mon Sep 17 00:00:00 2001 From: TrickyPi <530257315@qq.com> Date: Sat, 30 Jul 2022 09:23:25 +0800 Subject: [PATCH 3/3] feat: enable OPTIONS middleware by default --- lib/Server.js | 6 +- lib/options.json | 10 -- ...nse.test.js => options-middleware.test.js} | 1 - types/lib/Server.d.ts | 123 ++++++++---------- 4 files changed, 55 insertions(+), 85 deletions(-) rename test/e2e/{options-request-response.test.js => options-middleware.test.js} (98%) diff --git a/lib/Server.js b/lib/Server.js index 12f5af7512..1dc2e0b7a3 100644 --- a/lib/Server.js +++ b/lib/Server.js @@ -199,7 +199,6 @@ const schema = require("./options.json"); * @property {boolean} [setupExitSignals] * @property {boolean | ClientConfiguration} [client] * @property {Headers | ((req: Request, res: Response, context: DevMiddlewareContext) => Headers)} [headers] - * @property {boolean} [optionsMethod] * @property {(devServer: Server) => void} [onAfterSetupMiddleware] * @property {(devServer: Server) => void} [onBeforeSetupMiddleware] * @property {(devServer: Server) => void} [onListening] @@ -2131,7 +2130,8 @@ class Server { middleware: this.setHeaders.bind(this), }); } - if (this.options.optionsMethod) { + + { /** * * @param {Request} req @@ -2151,7 +2151,7 @@ class Server { }; middlewares.push({ - name: "options-request-response", + name: "options-middleware", path: "*", middleware: optionsRequestResponseMiddleware, }); diff --git a/lib/options.json b/lib/options.json index dfcf727a8c..ad49a930d7 100644 --- a/lib/options.json +++ b/lib/options.json @@ -458,13 +458,6 @@ "description": "Allows to set custom headers on response.", "link": "https://webpack.js.org/configuration/dev-server/#devserverheaders" }, - "OptionsMethod": { - "type": "boolean", - "description": "Response with 204 httpCode when receive an OPTIONS request", - "cli": { - "exclude": true - } - }, "HistoryApiFallback": { "anyOf": [ { @@ -1178,9 +1171,6 @@ "headers": { "$ref": "#/definitions/Headers" }, - "optionsMethod": { - "$ref": "#/definitions/OptionsMethod" - }, "historyApiFallback": { "$ref": "#/definitions/HistoryApiFallback" }, diff --git a/test/e2e/options-request-response.test.js b/test/e2e/options-middleware.test.js similarity index 98% rename from test/e2e/options-request-response.test.js rename to test/e2e/options-middleware.test.js index cf4d498bc3..dc267731e6 100644 --- a/test/e2e/options-request-response.test.js +++ b/test/e2e/options-middleware.test.js @@ -50,7 +50,6 @@ describe("handle options-request correctly", () => { "Access-Control-Allow-Origin": "*", "Access-Control-Allow-Headers": "*", }, - optionsMethod: true, }, compiler ); diff --git a/types/lib/Server.d.ts b/types/lib/Server.d.ts index cc2061e3a8..fc916a1324 100644 --- a/types/lib/Server.d.ts +++ b/types/lib/Server.d.ts @@ -175,7 +175,6 @@ declare class Server { * @property {boolean} [setupExitSignals] * @property {boolean | ClientConfiguration} [client] * @property {Headers | ((req: Request, res: Response, context: DevMiddlewareContext) => Headers)} [headers] - * @property {boolean} [optionsMethod] * @property {(devServer: Server) => void} [onAfterSetupMiddleware] * @property {(devServer: Server) => void} [onBeforeSetupMiddleware] * @property {(devServer: Server) => void} [onListening] @@ -354,7 +353,6 @@ declare class Server { * @property {boolean} [setupExitSignals] * @property {boolean | ClientConfiguration} [client] * @property {Headers | ((req: Request, res: Response, context: DevMiddlewareContext) => Headers)} [headers] - * @property {boolean} [optionsMethod] * @property {(devServer: Server) => void} [onAfterSetupMiddleware] * @property {(devServer: Server) => void} [onBeforeSetupMiddleware] * @property {(devServer: Server) => void} [onListening] @@ -479,7 +477,6 @@ declare class Server { * @property {boolean} [setupExitSignals] * @property {boolean | ClientConfiguration} [client] * @property {Headers | ((req: Request, res: Response, context: DevMiddlewareContext) => Headers)} [headers] - * @property {boolean} [optionsMethod] * @property {(devServer: Server) => void} [onAfterSetupMiddleware] * @property {(devServer: Server) => void} [onBeforeSetupMiddleware] * @property {(devServer: Server) => void} [onListening] @@ -577,6 +574,9 @@ declare class Server { path: string; }[]; description: string; + /** + * @type {FSWatcher[]} + */ simpleType: string; multiple: boolean; }; @@ -611,6 +611,10 @@ declare class Server { simpleType: string; multiple: boolean; }; + /** + * @param {string} URL + * @returns {boolean} + */ compress: { configs: { type: string; @@ -621,6 +625,10 @@ declare class Server { }[]; description: string; simpleType: string; + /** + * @param {string} gateway + * @returns {string | undefined} + */ multiple: boolean; }; "history-api-fallback": { @@ -633,10 +641,6 @@ declare class Server { }[]; description: string; simpleType: string; - /** - * @param {"v4" | "v6"} family - * @returns {Promise} - */ multiple: boolean; }; host: { @@ -657,13 +661,13 @@ declare class Server { )[]; description: string; simpleType: string; - multiple: boolean; - }; - hot: { /** * @param {Host} hostname * @returns {Promise} */ + multiple: boolean; + }; + hot: { configs: ( | { type: string; @@ -722,6 +726,9 @@ declare class Server { "https-ca-reset": { configs: { description: string; + /** + * @type {string[]} + */ multiple: boolean; path: string; type: string; @@ -750,7 +757,7 @@ declare class Server { }[]; description: string; multiple: boolean; - /** @type {ServerConfiguration} */ simpleType: string; + simpleType: string; }; "https-cert": { configs: { @@ -858,6 +865,12 @@ declare class Server { description: string; negatedDescription: string; path: string; + /** + * prependEntry Method for webpack 4 + * @param {any} originalEntry + * @param {any} newAdditionalEntries + * @returns {any} + */ }[]; description: string; simpleType: string; @@ -881,9 +894,8 @@ declare class Server { )[]; description: string; simpleType: string; - multiple: boolean /** @type {Object} */; + multiple: boolean; }; - /** @type {Object} */ "live-reload": { configs: { type: string; @@ -913,7 +925,7 @@ declare class Server { | { type: string; multiple: boolean; - description: string; + /** @type {MultiCompiler} */ description: string; path: string; } | { @@ -921,7 +933,7 @@ declare class Server { multiple: boolean; description: string; negatedDescription: string; - /** @type {MultiCompiler} */ path: string; + path: string; } )[]; description: string; @@ -949,6 +961,10 @@ declare class Server { description: string; simpleType: string; multiple: boolean; + /** + * @param {WatchOptions & { aggregateTimeout?: number, ignored?: WatchOptions["ignored"], poll?: number | boolean }} watchOptions + * @returns {WatchOptions} + */ }; "open-app-name-reset": { configs: { @@ -988,10 +1004,6 @@ declare class Server { type: string; multiple: boolean; description: string; - /** - * @param {string | Static | undefined} [optionsForStatic] - * @returns {NormalizedStatic} - */ path: string; }[]; description: string; @@ -1183,7 +1195,7 @@ declare class Server { }[]; description: string; multiple: boolean; - simpleType: string; + simpleType: string /** @type {ServerOptions} */; }; static: { configs: ( @@ -1196,7 +1208,7 @@ declare class Server { | { type: string; multiple: boolean; - description: string; + /** @type {ServerOptions} */ description: string; negatedDescription: string; path: string; } @@ -1208,10 +1220,14 @@ declare class Server { "static-directory": { configs: { type: string; - multiple: boolean; + /** @type {any} */ multiple: boolean; description: string; path: string; }[]; + /** + * @param {string | Buffer | undefined} item + * @returns {string | Buffer | undefined} + */ description: string; simpleType: string; multiple: boolean; @@ -1224,7 +1240,7 @@ declare class Server { path: string; }[]; description: string; - simpleType: string; + /** @type {any} */ simpleType: string; multiple: boolean; }; "static-public-path-reset": { @@ -1232,7 +1248,7 @@ declare class Server { type: string; multiple: boolean; description: string; - /** @type {ServerOptions} */ path: string; + path: string; }[]; description: string; simpleType: string; @@ -1336,12 +1352,12 @@ declare class Server { description: string; multiple: boolean; path: string; - type: string; + type: string /** @type {ServerOptions & { cacert?: ServerOptions["ca"] }} */; } )[]; description: string; simpleType: string; - multiple: boolean; + multiple: boolean /** @type {ServerOptions} */; }; }; readonly processArguments: ( @@ -1574,7 +1590,6 @@ declare class Server { * @property {boolean} [setupExitSignals] * @property {boolean | ClientConfiguration} [client] * @property {Headers | ((req: Request, res: Response, context: DevMiddlewareContext) => Headers)} [headers] - * @property {boolean} [optionsMethod] * @property {(devServer: Server) => void} [onAfterSetupMiddleware] * @property {(devServer: Server) => void} [onBeforeSetupMiddleware] * @property {(devServer: Server) => void} [onListening] @@ -1733,7 +1748,6 @@ declare class Server { * @property {boolean} [setupExitSignals] * @property {boolean | ClientConfiguration} [client] * @property {Headers | ((req: Request, res: Response, context: DevMiddlewareContext) => Headers)} [headers] - * @property {boolean} [optionsMethod] * @property {(devServer: Server) => void} [onAfterSetupMiddleware] * @property {(devServer: Server) => void} [onBeforeSetupMiddleware] * @property {(devServer: Server) => void} [onListening] @@ -1820,7 +1834,6 @@ declare class Server { * @property {boolean} [setupExitSignals] * @property {boolean | ClientConfiguration} [client] * @property {Headers | ((req: Request, res: Response, context: DevMiddlewareContext) => Headers)} [headers] - * @property {boolean} [optionsMethod] * @property {(devServer: Server) => void} [onAfterSetupMiddleware] * @property {(devServer: Server) => void} [onBeforeSetupMiddleware] * @property {(devServer: Server) => void} [onListening] @@ -1949,13 +1962,9 @@ declare class Server { type: string; description: string; }; - /** @type {Schema} */ requestCert: { type: string; description: string; - /** - * @type {ReturnType} - * */ cli: { negatedDescription: string; }; @@ -1975,10 +1984,6 @@ declare class Server { type?: undefined; } )[]; - /** - * @private - * @type {RequestHandler[]} - */ }; instanceof?: undefined; } @@ -2058,6 +2063,10 @@ declare class Server { description: string; }; crl: { + /** + * @param {"v4" | "v6"} family + * @returns {Promise} + */ anyOf: ( | { type: string; @@ -2178,9 +2187,6 @@ declare class Server { key: { description: string; type: string; - /** - * @type {string[]} - */ }; value: { description: string; @@ -2215,14 +2221,7 @@ declare class Server { } )[]; description: string; - link: string; - }; - OptionsMethod: { - type: string; - description: string; - cli: { - exclude: boolean; - }; + link: string /** @type {WebSocketURL} */; }; HistoryApiFallback: { anyOf: ( @@ -2236,9 +2235,9 @@ declare class Server { } | { type: string; - /** @type {string} */ description: string; link: string; + /** @type {string} */ cli?: undefined /** @typedef {import("express").Request} Request */; } )[]; @@ -2301,7 +2300,7 @@ declare class Server { cli: { negatedDescription: string; }; - /** @type {number | string} */ link: string; + link: string; }; MagicHTML: { type: string; @@ -2456,7 +2455,6 @@ declare class Server { Proxy: { anyOf: ( | { - /** @type {any} */ type: string; items?: undefined; } @@ -2486,7 +2484,6 @@ declare class Server { link: string; description: string; }; - /** @type {MultiCompiler} */ ServerType: { enum: string[]; }; @@ -2637,10 +2634,6 @@ declare class Server { } | { instanceof: string; - /** - * @param {string | Static | undefined} [optionsForStatic] - * @returns {NormalizedStatic} - */ type?: undefined; } )[]; @@ -2929,10 +2922,10 @@ declare class Server { anyOf: ( | { enum: boolean[]; - cli: { - negatedDescription: string /** @type {Array} */; + /** @type {ServerOptions} */ cli: { + negatedDescription: string; }; - $ref?: undefined; + /** @type {ServerOptions} */ $ref?: undefined; } | { $ref: string; @@ -2962,15 +2955,7 @@ declare class Server { exclude: boolean; }; }; - /** - * @param {string | Buffer | undefined} item - * @returns {string | Buffer | undefined} - */ }; - /** - * @param {string | Buffer | undefined} item - * @returns {string | Buffer | undefined} - */ additionalProperties: boolean; }; WebSocketServerString: { @@ -2998,9 +2983,6 @@ declare class Server { headers: { $ref: string; }; - optionsMethod: { - $ref: string; - }; historyApiFallback: { $ref: string; }; @@ -3477,7 +3459,6 @@ type Configuration = { context: DevMiddlewareContext ) => Headers) | undefined; - optionsMethod?: boolean | undefined; onAfterSetupMiddleware?: ((devServer: Server) => void) | undefined; onBeforeSetupMiddleware?: ((devServer: Server) => void) | undefined; onListening?: ((devServer: Server) => void) | undefined;