diff --git a/README.md b/README.md index ce466e8c7d..7cadb5cd62 100644 --- a/README.md +++ b/README.md @@ -105,11 +105,11 @@ Options: --no-client Disables client script. --client-logging Allows to set log level in the browser. --client-overlay Enables a full-screen overlay in the browser when there are compiler errors or warnings. - --no-client-overlay Disables a full-screen overlay in the browser when there are compiler errors or warnings. + --no-client-overlay Disables the full-screen overlay in the browser when there are compiler errors or warnings. --client-overlay-errors Enables a full-screen overlay in the browser when there are compiler errors. - --no-client-overlay-errors Negative 'client-overlay-errors' option. + --no-client-overlay-errors Disables the full-screen overlay in the browser when there are compiler errors. --client-overlay-warnings Enables a full-screen overlay in the browser when there are compiler warnings. - --no-client-overlay-warnings Negative 'client-overlay-warnings' option. + --no-client-overlay-warnings Disables the full-screen overlay in the browser when there are compiler warnings. --client-progress Prints compilation progress in percentage in the browser. --no-client-progress Does not print compilation progress in percentage in the browser. --client-reconnect [value] Tells dev-server the number of times it should try to reconnect the client. diff --git a/bin/cli-flags.js b/bin/cli-flags.js index 7dabe089bf..1f1376ef75 100644 --- a/bin/cli-flags.js +++ b/bin/cli-flags.js @@ -95,7 +95,7 @@ module.exports = { description: "Enables a full-screen overlay in the browser when there are compiler errors or warnings.", negatedDescription: - "Disables a full-screen overlay in the browser when there are compiler errors or warnings.", + "Disables the full-screen overlay in the browser when there are compiler errors or warnings.", path: "client.overlay", }, ], @@ -111,6 +111,8 @@ module.exports = { multiple: false, description: "Enables a full-screen overlay in the browser when there are compiler errors.", + negatedDescription: + "Disables the full-screen overlay in the browser when there are compiler errors.", path: "client.overlay.errors", }, ], @@ -126,6 +128,8 @@ module.exports = { multiple: false, description: "Enables a full-screen overlay in the browser when there are compiler warnings.", + negatedDescription: + "Disables the full-screen overlay in the browser when there are compiler warnings.", path: "client.overlay.warnings", }, ], @@ -1026,6 +1030,7 @@ module.exports = { configs: [ { description: "Request for an SSL certificate.", + negatedDescription: "Does not request for an SSL certificate.", multiple: false, path: "server.options.requestCert", type: "boolean", @@ -1063,6 +1068,8 @@ module.exports = { multiple: false, description: "Allows to configure options for serving static files from directory (by default 'public' directory).", + negatedDescription: + "Disallows to configure options for serving static files from directory.", path: "static", }, ], @@ -1202,6 +1209,7 @@ module.exports = { { description: "Deprecated: please use '--web-socket-server-type' option.", + negatedDescription: "Disallows to set web socket server and options.", multiple: false, path: "webSocketServer", type: "enum", diff --git a/lib/options.json b/lib/options.json index af3ce99c66..32b1c84ca1 100644 --- a/lib/options.json +++ b/lib/options.json @@ -90,7 +90,7 @@ "link": "https://webpack.js.org/configuration/dev-server/#overlay", "type": "boolean", "cli": { - "negatedDescription": "Disables a full-screen overlay in the browser when there are compiler errors or warnings." + "negatedDescription": "Disables the full-screen overlay in the browser when there are compiler errors or warnings." } }, { @@ -99,11 +99,17 @@ "properties": { "errors": { "description": "Enables a full-screen overlay in the browser when there are compiler errors.", - "type": "boolean" + "type": "boolean", + "cli": { + "negatedDescription": "Disables the full-screen overlay in the browser when there are compiler errors." + } }, "warnings": { "description": "Enables a full-screen overlay in the browser when there are compiler warnings.", - "type": "boolean" + "type": "boolean", + "cli": { + "negatedDescription": "Disables the full-screen overlay in the browser when there are compiler warnings." + } } } } @@ -737,7 +743,10 @@ }, "requestCert": { "type": "boolean", - "description": "Request for an SSL certificate." + "description": "Request for an SSL certificate.", + "cli": { + "negatedDescription": "Does not request for an SSL certificate." + } }, "ca": { "anyOf": [ @@ -922,7 +931,10 @@ } }, { - "type": "boolean" + "type": "boolean", + "cli": { + "negatedDescription": "Disallows to configure options for serving static files from directory." + } }, { "$ref": "#/definitions/StaticString" @@ -1088,7 +1100,10 @@ "WebSocketServerEnum": { "anyOf": [ { - "enum": [false] + "enum": [false], + "cli": { + "negatedDescription": "Disallows to set web socket server and options." + } }, { "$ref": "#/definitions/WebSocketServerType" diff --git a/test/cli/__snapshots__/basic.test.js.snap.webpack4 b/test/cli/__snapshots__/basic.test.js.snap.webpack4 index be4df73a65..6b2237bbd7 100644 --- a/test/cli/__snapshots__/basic.test.js.snap.webpack4 +++ b/test/cli/__snapshots__/basic.test.js.snap.webpack4 @@ -61,11 +61,11 @@ Options: --no-client Disables client script. --client-logging Allows to set log level in the browser. --client-overlay Enables a full-screen overlay in the browser when there are compiler errors or warnings. - --no-client-overlay Disables a full-screen overlay in the browser when there are compiler errors or warnings. + --no-client-overlay Disables the full-screen overlay in the browser when there are compiler errors or warnings. --client-overlay-errors Enables a full-screen overlay in the browser when there are compiler errors. - --no-client-overlay-errors Negative 'client-overlay-errors' option. + --no-client-overlay-errors Disables the full-screen overlay in the browser when there are compiler errors. --client-overlay-warnings Enables a full-screen overlay in the browser when there are compiler warnings. - --no-client-overlay-warnings Negative 'client-overlay-warnings' option. + --no-client-overlay-warnings Disables the full-screen overlay in the browser when there are compiler warnings. --client-progress Prints compilation progress in percentage in the browser. --no-client-progress Does not print compilation progress in percentage in the browser. --client-reconnect [value] Tells dev-server the number of times it should try to reconnect the client. @@ -132,10 +132,10 @@ Options: --server-options-pfx Path to an SSL pfx file or content of an SSL pfx file. --server-options-pfx-reset Clear all items provided in 'server.options.pfx' configuration. Path to an SSL pfx file or content of an SSL pfx file. --server-options-request-cert Request for an SSL certificate. - --no-server-options-request-cert Negative 'server-options-request-cert' option. + --no-server-options-request-cert Does not request for an SSL certificate. --server-type Allows to set server and options (by default 'http'). --static [value...] Allows to configure options for serving static files from directory (by default 'public' directory). - --no-static Negative 'static' option. + --no-static Disallows to configure options for serving static files from directory. --static-directory Directory for static contents. --static-public-path The static files will be available in the browser under this public path. --static-public-path-reset Clear all items provided in 'static.publicPath' configuration. The static files will be available in the browser under this public path. @@ -147,7 +147,7 @@ Options: --watch-files Allows to configure list of globs/directories/files to watch for file changes. --watch-files-reset Clear all items provided in 'watchFiles' configuration. Allows to configure list of globs/directories/files to watch for file changes. --web-socket-server Deprecated: please use '--web-socket-server-type' option. Allows to set web socket server and options (by default 'ws'). - --no-web-socket-server Negative 'web-socket-server' option. + --no-web-socket-server Disallows to set web socket server and options. --web-socket-server-type Allows to set web socket server and options (by default 'ws'). Global options: diff --git a/test/cli/__snapshots__/basic.test.js.snap.webpack5 b/test/cli/__snapshots__/basic.test.js.snap.webpack5 index 5960150dd8..3649bb9ee5 100644 --- a/test/cli/__snapshots__/basic.test.js.snap.webpack5 +++ b/test/cli/__snapshots__/basic.test.js.snap.webpack5 @@ -62,11 +62,11 @@ Options: --no-client Disables client script. --client-logging Allows to set log level in the browser. --client-overlay Enables a full-screen overlay in the browser when there are compiler errors or warnings. - --no-client-overlay Disables a full-screen overlay in the browser when there are compiler errors or warnings. + --no-client-overlay Disables the full-screen overlay in the browser when there are compiler errors or warnings. --client-overlay-errors Enables a full-screen overlay in the browser when there are compiler errors. - --no-client-overlay-errors Negative 'client-overlay-errors' option. + --no-client-overlay-errors Disables the full-screen overlay in the browser when there are compiler errors. --client-overlay-warnings Enables a full-screen overlay in the browser when there are compiler warnings. - --no-client-overlay-warnings Negative 'client-overlay-warnings' option. + --no-client-overlay-warnings Disables the full-screen overlay in the browser when there are compiler warnings. --client-progress Prints compilation progress in percentage in the browser. --no-client-progress Does not print compilation progress in percentage in the browser. --client-reconnect [value] Tells dev-server the number of times it should try to reconnect the client. @@ -122,7 +122,7 @@ Options: --server-type Allows to set server and options (by default 'http'). --server-options-passphrase Passphrase for a pfx file. --server-options-request-cert Request for an SSL certificate. - --no-server-options-request-cert Negative 'server-options-request-cert' option. + --no-server-options-request-cert Does not request for an SSL certificate. --server-options-ca Path to an SSL CA certificate or content of an SSL CA certificate. --server-options-ca-reset Clear all items provided in 'server.options.ca' configuration. Path to an SSL CA certificate or content of an SSL CA certificate. --server-options-cacert Path to an SSL CA certificate or content of an SSL CA certificate. Deprecated, use the \`server.options.ca\` option. @@ -136,7 +136,7 @@ Options: --server-options-pfx Path to an SSL pfx file or content of an SSL pfx file. --server-options-pfx-reset Clear all items provided in 'server.options.pfx' configuration. Path to an SSL pfx file or content of an SSL pfx file. --static [value...] Allows to configure options for serving static files from directory (by default 'public' directory). - --no-static Negative 'static' option. + --no-static Disallows to configure options for serving static files from directory. --static-directory Directory for static contents. --static-public-path The static files will be available in the browser under this public path. --static-serve-index Tells dev server to use serveIndex middleware when enabled. @@ -148,7 +148,7 @@ Options: --watch-files Allows to configure list of globs/directories/files to watch for file changes. --watch-files-reset Clear all items provided in 'watchFiles' configuration. Allows to configure list of globs/directories/files to watch for file changes. --web-socket-server Deprecated: please use '--web-socket-server-type' option. Allows to set web socket server and options (by default 'ws'). - --no-web-socket-server Negative 'web-socket-server' option. + --no-web-socket-server Disallows to set web socket server and options. --web-socket-server-type Allows to set web socket server and options (by default 'ws'). Global options: diff --git a/types/bin/cli-flags.d.ts b/types/bin/cli-flags.d.ts index 876cd64b2b..fa98132496 100644 --- a/types/bin/cli-flags.d.ts +++ b/types/bin/cli-flags.d.ts @@ -84,6 +84,7 @@ declare const _exports: { type: string; multiple: boolean; description: string; + negatedDescription: string; path: string; }[]; description: string; @@ -95,6 +96,7 @@ declare const _exports: { type: string; multiple: boolean; description: string; + negatedDescription: string; path: string; }[]; description: string; @@ -779,6 +781,7 @@ declare const _exports: { "server-options-request-cert": { configs: { description: string; + negatedDescription: string; multiple: boolean; path: string; type: string; @@ -800,12 +803,21 @@ declare const _exports: { simpleType: string; }; static: { - configs: { - type: string; - multiple: boolean; - description: string; - path: string; - }[]; + configs: ( + | { + type: string; + multiple: boolean; + description: string; + path: string; + } + | { + type: string; + multiple: boolean; + description: string; + negatedDescription: string; + path: string; + } + )[]; description: string; simpleType: string; multiple: boolean; @@ -904,6 +916,7 @@ declare const _exports: { configs: ( | { description: string; + negatedDescription: string; multiple: boolean; path: string; type: string; diff --git a/types/lib/Server.d.ts b/types/lib/Server.d.ts index 29e3f65302..50294755aa 100644 --- a/types/lib/Server.d.ts +++ b/types/lib/Server.d.ts @@ -394,110 +394,8 @@ declare class Server { * @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 {Object} ClientConfiguration - * @property {"log" | "info" | "warn" | "error" | "none" | "verbose"} [logging] - * @property {boolean | { warnings?: boolean, errors?: boolean }} [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 {boolean} [magicHtml] - * @property {"auto" | "all" | string | string[]} [allowedHosts] - * @property {boolean | ConnectHistoryApiFallbackOptions} [historyApiFallback] - * @property {boolean} [setupExitSignals] - * @property {boolean | 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} [onAfterSetupMiddleware] - * @property {(devServer: Server) => void} [onBeforeSetupMiddleware] - * @property {(devServer: Server) => void} [onListening] - * @property {(middlewares: Middleware[], devServer: Server) => Middleware[]} [setupMiddlewares] - */ description: string; + negatedDescription: string; path: string; }[]; description: string; @@ -507,106 +405,9 @@ declare class Server { "client-overlay-warnings": { configs: { type: string; - /** - * @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 {Object} ClientConfiguration - * @property {"log" | "info" | "warn" | "error" | "none" | "verbose"} [logging] - * @property {boolean | { warnings?: boolean, errors?: boolean }} [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 {boolean} [magicHtml] - * @property {"auto" | "all" | string | string[]} [allowedHosts] - * @property {boolean | ConnectHistoryApiFallbackOptions} [historyApiFallback] - * @property {boolean} [setupExitSignals] - * @property {boolean | 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} [onAfterSetupMiddleware] - * @property {(devServer: Server) => void} [onBeforeSetupMiddleware] - * @property {(devServer: Server) => void} [onListening] - * @property {(middlewares: Middleware[], devServer: Server) => Middleware[]} [setupMiddlewares] - */ multiple: boolean; description: string; + negatedDescription: string; path: string; }[]; description: string; @@ -632,6 +433,65 @@ declare class Server { multiple: boolean; description: string; negatedDescription: string; + /** + * @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 {Object} ClientConfiguration + * @property {"log" | "info" | "warn" | "error" | "none" | "verbose"} [logging] + * @property {boolean | { warnings?: boolean, errors?: boolean }} [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 {boolean} [magicHtml] + * @property {"auto" | "all" | string | string[]} [allowedHosts] + * @property {boolean | ConnectHistoryApiFallbackOptions} [historyApiFallback] + * @property {boolean} [setupExitSignals] + * @property {boolean | 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} [onAfterSetupMiddleware] + * @property {(devServer: Server) => void} [onBeforeSetupMiddleware] + * @property {(devServer: Server) => void} [onListening] + * @property {(middlewares: Middleware[], devServer: Server) => Middleware[]} [setupMiddlewares] + */ path: string; } | { @@ -727,6 +587,9 @@ declare class Server { multiple: boolean; path: string; type: string; + /** + * @type {ReturnType} + * */ values: string[]; } | { @@ -830,6 +693,10 @@ declare class Server { }; https: { configs: { + /** + * @param {Port} port + * @returns {Promise} + */ type: string; multiple: boolean; description: string; @@ -880,9 +747,9 @@ declare class Server { path: string; type: string; }[]; - description: string; + /** @type {WebSocketURL} */ description: string; multiple: boolean; - simpleType: string /** @type {WebSocketURL} */; + simpleType: string; }; "https-cert": { configs: { @@ -893,7 +760,7 @@ declare class Server { }[]; description: string; simpleType: string; - multiple: boolean; + /** @type {ServerConfiguration} */ multiple: boolean; }; "https-cert-reset": { configs: { @@ -942,7 +809,7 @@ declare class Server { "https-key-reset": { configs: { description: string; - multiple: boolean; + /** @type {string} */ multiple: boolean; path: string; type: string; }[]; @@ -1006,6 +873,7 @@ declare class Server { | { type: string; values: boolean[]; + /** @type {Object} */ multiple: boolean; description: string; path: string; @@ -1050,7 +918,6 @@ declare class Server { | { type: string; multiple: boolean; - /** @type {MultiCompiler} */ description: string; negatedDescription: string; path: string; @@ -1122,10 +989,6 @@ declare class Server { description: string; path: string; }[]; - /** - * @param {string | Static | undefined} [optionsForStatic] - * @returns {NormalizedStatic} - */ description: string; simpleType: string; multiple: boolean; @@ -1296,6 +1159,7 @@ declare class Server { "server-options-request-cert": { configs: { description: string; + negatedDescription: string; multiple: boolean; path: string; type: string; @@ -1314,18 +1178,27 @@ declare class Server { }[]; description: string; multiple: boolean; - simpleType: string; + /** @type {Array} */ simpleType: string; }; static: { - configs: { - /** @type {ServerOptions} */ type: string; - multiple: boolean; - description: string; - path: string; - }[]; + configs: ( + | { + type: string; + multiple: boolean; + description: string; + path: string; + } + | { + type: string; + multiple: boolean; + description: string; + negatedDescription: string; + path: string; + } + )[]; description: string; simpleType: string; - multiple: boolean; + /** @type {ServerOptions} */ multiple: boolean; }; "static-directory": { configs: { @@ -1421,6 +1294,7 @@ declare class Server { configs: ( | { description: string; + negatedDescription: string; multiple: boolean; path: string; type: string; @@ -1457,14 +1331,13 @@ declare class Server { description: string; multiple: boolean; path: string; - type: string; + type: string /** @type {ServerOptions} */; } )[]; description: string; simpleType: string; - /** @type {ServerOptions & { cacert?: ServerOptions["ca"] }} */ - multiple: boolean; - }; + multiple: boolean /** @type {ServerOptions} */; + } /** @type {ServerOptions} */; }; readonly processArguments: ( args: Record, @@ -1745,10 +1618,16 @@ declare class Server { errors: { description: string; type: string; + cli: { + negatedDescription: string; + }; }; warnings: { description: string; type: string; + cli: { + negatedDescription: string; + }; }; }; description?: undefined; @@ -1771,6 +1650,93 @@ declare class Server { anyOf: ( | { type: string; + /** + * @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 {Object} ClientConfiguration + * @property {"log" | "info" | "warn" | "error" | "none" | "verbose"} [logging] + * @property {boolean | { warnings?: boolean, errors?: boolean }} [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 {boolean} [magicHtml] + * @property {"auto" | "all" | string | string[]} [allowedHosts] + * @property {boolean | ConnectHistoryApiFallbackOptions} [historyApiFallback] + * @property {boolean} [setupExitSignals] + * @property {boolean | 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} [onAfterSetupMiddleware] + * @property {(devServer: Server) => void} [onBeforeSetupMiddleware] + * @property {(devServer: Server) => void} [onListening] + * @property {(middlewares: Middleware[], devServer: Server) => Middleware[]} [setupMiddlewares] + */ cli: { negatedDescription: string; }; @@ -1787,6 +1753,81 @@ declare class Server { anyOf: { $ref: string; }[]; + /** + * @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 {Object} ClientConfiguration + * @property {"log" | "info" | "warn" | "error" | "none" | "verbose"} [logging] + * @property {boolean | { warnings?: boolean, errors?: boolean }} [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 {boolean} [magicHtml] + * @property {"auto" | "all" | string | string[]} [allowedHosts] + * @property {boolean | ConnectHistoryApiFallbackOptions} [historyApiFallback] + * @property {boolean} [setupExitSignals] + * @property {boolean | 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} [onAfterSetupMiddleware] + * @property {(devServer: Server) => void} [onBeforeSetupMiddleware] + * @property {(devServer: Server) => void} [onListening] + * @property {(middlewares: Middleware[], devServer: Server) => Middleware[]} [setupMiddlewares] + */ description: string; link: string; }; @@ -1923,6 +1964,10 @@ declare class Server { type?: undefined; } )[]; + /** + * @private + * @type {{ name: string | symbol, listener: (...args: any[]) => void}[] }} + */ }; instanceof?: undefined; } @@ -1937,8 +1982,16 @@ declare class Server { items?: undefined; } )[]; + /** + * @private + * @type {RequestHandler[]} + */ description: string; }; + /** + * @private + * @type {string | undefined} + */ cacert: { anyOf: ( | { @@ -1951,10 +2004,6 @@ declare class Server { } | { instanceof: string; - /** - * @private - * @type {string | undefined} - */ type?: undefined; } )[]; @@ -2111,9 +2160,6 @@ declare class Server { } )[]; description: string; - /** - * @returns {string} - */ }; }; cli?: undefined /** @typedef {import("express").Request} Request */; @@ -2179,6 +2225,7 @@ declare class Server { type: string; description: string; link: string; + /** @type {{ type: WebSocketServerConfiguration["type"], options: NonNullable }} */ cli?: undefined /** @typedef {import("express").Request} Request */; } )[]; @@ -2264,7 +2311,7 @@ declare class Server { OnListening: { instanceof: string; description: string; - link: string; + /** @type {string} */ link: string; }; Open: { anyOf: ( @@ -2383,6 +2430,7 @@ declare class Server { enum?: undefined; } | { + /** @type {any} */ enum: string[]; type?: undefined; minimum?: undefined; @@ -2390,6 +2438,7 @@ declare class Server { minLength?: undefined; } )[]; + /** @type {any} */ description: string; link: string; }; @@ -2402,7 +2451,6 @@ declare class Server { | { type: string; items: { - /** @type {any} */ anyOf: ( | { type: string; @@ -2437,7 +2485,7 @@ declare class Server { }; ServerString: { type: string; - /** @type {MultiCompiler} */ minLength: number; + minLength: number; cli: { exclude: boolean; }; @@ -2467,6 +2515,9 @@ declare class Server { requestCert: { type: string; description: string; + cli: { + negatedDescription: string; + }; }; ca: { anyOf: ( @@ -2585,6 +2636,7 @@ declare class Server { instanceof?: undefined; } | { + /** @type {NormalizedStatic} */ instanceof: string; type?: undefined; items?: undefined; @@ -2692,10 +2744,14 @@ declare class Server { $ref: string; }[]; }; + cli?: undefined /** @typedef {import("express").Request} Request */; $ref?: undefined; } | { type: string; + cli: { + negatedDescription: string; + }; items?: undefined; $ref?: undefined; } @@ -2703,6 +2759,7 @@ declare class Server { $ref: string; type?: undefined; items?: undefined; + cli?: undefined /** @typedef {import("express").Request} Request */; } )[]; description: string; @@ -2856,11 +2913,16 @@ declare class Server { anyOf: ( | { enum: boolean[]; + /** @type {ServerOptions} */ + cli: { + negatedDescription: string; + }; $ref?: undefined; } | { $ref: string; enum?: undefined; + cli?: undefined /** @typedef {import("express").Request} Request */; } )[]; cli: { @@ -2875,7 +2937,7 @@ declare class Server { properties: { type: { anyOf: { - $ref: string; + $ref: string /** @type {ServerOptions} */; }[]; }; options: { @@ -2898,14 +2960,13 @@ declare class Server { allowedHosts: { $ref: string; }; - /** @type {any} */ bonjour: { - $ref: string /** @type {ServerOptions} */; + $ref: string; }; - /** @type {ServerOptions} */ client: { $ref: string; }; + /** @type {any} */ compress: { $ref: string; }; @@ -2916,8 +2977,9 @@ declare class Server { $ref: string; }; historyApiFallback: { - $ref: string; + $ref: string /** @type {ServerOptions} */; }; + /** @type {ServerOptions} */ host: { $ref: string; }; @@ -2937,7 +2999,7 @@ declare class Server { $ref: string; }; magicHtml: { - $ref: string /** @type {any} */; + $ref: string; }; onAfterSetupMiddleware: { $ref: string;