From c3b669077089802412774079f38a13bce054eee7 Mon Sep 17 00:00:00 2001 From: Nitin Kumar Date: Sun, 6 Feb 2022 07:37:59 +0530 Subject: [PATCH] fix: update description for `--no-client` (#4250) --- README.md | 2 +- bin/cli-flags.js | 1 + lib/options.json | 5 +- .../__snapshots__/basic.test.js.snap.webpack4 | 2 +- .../__snapshots__/basic.test.js.snap.webpack5 | 2 +- types/bin/cli-flags.d.ts | 1 + types/lib/Server.d.ts | 758 +++++++++--------- 7 files changed, 379 insertions(+), 392 deletions(-) diff --git a/README.md b/README.md index b1021ec4ce..591fd432d6 100644 --- a/README.md +++ b/README.md @@ -90,7 +90,7 @@ Options: you are proxying dev server, by default is 'auto'). --bonjour Allows to broadcasts dev server via ZeroConf networking on start. --no-bonjour Disallows to broadcasts dev server via ZeroConf networking on start. - --no-client Negative 'client' option. + --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. diff --git a/bin/cli-flags.js b/bin/cli-flags.js index c9fa6b7815..e837de4b27 100644 --- a/bin/cli-flags.js +++ b/bin/cli-flags.js @@ -61,6 +61,7 @@ module.exports = { { description: "Allows to specify options for client script in the browser or disable client script.", + negatedDescription: "Disables client script.", multiple: false, path: "client", type: "enum", diff --git a/lib/options.json b/lib/options.json index bd7a5a2f90..63fa3c7784 100644 --- a/lib/options.json +++ b/lib/options.json @@ -47,7 +47,10 @@ "link": "https://webpack.js.org/configuration/dev-server/#devserverclient", "anyOf": [ { - "enum": [false] + "enum": [false], + "cli": { + "negatedDescription": "Disables client script." + } }, { "type": "object", diff --git a/test/cli/__snapshots__/basic.test.js.snap.webpack4 b/test/cli/__snapshots__/basic.test.js.snap.webpack4 index 7ca7efdea9..4eb1d97198 100644 --- a/test/cli/__snapshots__/basic.test.js.snap.webpack4 +++ b/test/cli/__snapshots__/basic.test.js.snap.webpack4 @@ -58,7 +58,7 @@ Options: --allowed-hosts-reset Clear all items provided in 'allowedHosts' configuration. Allows to enumerate the hosts from which access to the dev server are allowed (useful when you are proxying dev server, by default is 'auto'). --bonjour Allows to broadcasts dev server via ZeroConf networking on start. --no-bonjour Disallows to broadcasts dev server via ZeroConf networking on start. - --no-client Negative 'client' option. + --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. diff --git a/test/cli/__snapshots__/basic.test.js.snap.webpack5 b/test/cli/__snapshots__/basic.test.js.snap.webpack5 index 8a2f41912a..96dc6aa080 100644 --- a/test/cli/__snapshots__/basic.test.js.snap.webpack5 +++ b/test/cli/__snapshots__/basic.test.js.snap.webpack5 @@ -59,7 +59,7 @@ Options: --allowed-hosts-reset Clear all items provided in 'allowedHosts' configuration. Allows to enumerate the hosts from which access to the dev server are allowed (useful when you are proxying dev server, by default is 'auto'). --bonjour Allows to broadcasts dev server via ZeroConf networking on start. --no-bonjour Disallows to broadcasts dev server via ZeroConf networking on start. - --no-client Negative 'client' option. + --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. diff --git a/types/bin/cli-flags.d.ts b/types/bin/cli-flags.d.ts index fe6566cffc..d4607b8f94 100644 --- a/types/bin/cli-flags.d.ts +++ b/types/bin/cli-flags.d.ts @@ -45,6 +45,7 @@ declare const _exports: { client: { 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 e8943e2e14..1e91523c76 100644 --- a/types/lib/Server.d.ts +++ b/types/lib/Server.d.ts @@ -210,13 +210,12 @@ declare class Server { client: { configs: { description: string; + negatedDescription: string; multiple: boolean; - path: string /** @typedef {import("http").IncomingMessage} IncomingMessage */; + path: string; type: string; values: boolean[]; }[]; - /** @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 */ /** * @template Request, Response * @typedef {import("webpack-dev-middleware").Options} DevMiddlewareOptions @@ -387,6 +386,117 @@ declare class Server { configs: { type: string; multiple: boolean; + /** + * @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 {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; path: string; }[]; @@ -397,6 +507,104 @@ 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; path: string; @@ -418,48 +626,34 @@ declare class Server { multiple: boolean; }; "client-reconnect": { - /** - * @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] - */ + configs: { + type: string; + multiple: boolean; + description: string; + negatedDescription: string; + path: string; + }[]; + description: string; + simpleType: string; + multiple: boolean; + }; + "client-web-socket-transport": { + configs: ( + | { + type: string; + values: string[]; + multiple: boolean; + description: string; + path: string; + } + | { + type: string; + multiple: boolean; + description: string; + path: string; + } + )[]; + description: string; /** * @typedef {Array<{ key: string; value: string }> | Record} Headers */ @@ -496,34 +690,6 @@ declare class Server { * @property {(devServer: Server) => void} [onListening] * @property {(middlewares: Middleware[], devServer: Server) => Middleware[]} [setupMiddlewares] */ - configs: { - type: string; - multiple: boolean; - description: string; - negatedDescription: string; - path: string; - }[]; - description: string; - simpleType: string; - multiple: boolean; - }; - "client-web-socket-transport": { - configs: ( - | { - type: string; - values: string[]; - multiple: boolean; - description: string; - path: string; - } - | { - type: string; - multiple: boolean; - description: string; - path: string; - } - )[]; - description: string; simpleType: string; multiple: boolean; }; @@ -593,6 +759,9 @@ declare class Server { } | { description: string; + /** + * @type {ReturnType} + * */ multiple: boolean; path: string; type: string; @@ -600,6 +769,9 @@ declare class Server { )[]; description: string; multiple: boolean; + /** + * @type {FSWatcher[]} + */ simpleType: string; }; "client-web-socket-url-username": { @@ -652,7 +824,7 @@ declare class Server { type: string; } )[]; - description: string; + /** @type {NetworkInterfaceInfo[]} */ description: string; simpleType: string; multiple: boolean; }; @@ -676,10 +848,6 @@ declare class Server { )[]; description: string; simpleType: string; - /** - * @param {"v4" | "v6"} family - * @returns {string | undefined} - */ multiple: boolean; }; http2: { @@ -718,6 +886,9 @@ declare class Server { multiple: boolean; }; "https-ca-reset": { + /** + * @type {string | undefined} + */ configs: { description: string; multiple: boolean; @@ -748,7 +919,7 @@ declare class Server { }[]; description: string; multiple: boolean; - simpleType: string /** @type {WebSocketURL} */; + simpleType: string; }; "https-cert": { configs: { @@ -950,10 +1121,6 @@ declare class Server { "open-app-name-reset": { configs: { type: string; - /** - * @param {WatchOptions & { aggregateTimeout?: number, ignored?: AnymatchMatcher | string[], poll?: number | boolean }} watchOptions - * @returns {WatchOptions} - */ multiple: boolean; description: string; path: string; @@ -991,10 +1158,6 @@ declare class Server { description: string; path: string; }[]; - /** - * @param {string | Static | undefined} [optionsForStatic] - * @returns {NormalizedStatic} - */ description: string; simpleType: string; multiple: boolean; @@ -1317,7 +1480,7 @@ declare class Server { configs: ( | { description: string; - /** @type {ServerOptions & { cacert?: ServerOptions["ca"] }} */ multiple: boolean; + multiple: boolean; path: string; type: string; values: string[]; @@ -1331,7 +1494,6 @@ declare class Server { )[]; description: string; simpleType: string; - /** @type {ServerOptions & { cacert?: ServerOptions["ca"] }} */ multiple: boolean; }; }; @@ -1410,6 +1572,9 @@ declare class Server { anyOf: ( | { enum: boolean[]; + cli: { + negatedDescription: string; + }; type?: undefined; additionalProperties?: undefined; properties?: undefined; @@ -1433,153 +1598,12 @@ declare class Server { webSocketTransport: { $ref: string; }; - /** @typedef {import("net").Socket} Socket */ - /** @typedef {import("http").IncomingMessage} IncomingMessage */ - /** @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 */ - /** - * @template Request, Response - * @typedef {import("webpack-dev-middleware").Options} DevMiddlewareOptions - */ - /** - * @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?: AnymatchMatcher | string[], 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?: AnymatchMatcher | string[], 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 {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] - */ webSocketURL: { $ref: string; }; }; enum?: undefined; + cli?: undefined; } )[]; }; @@ -1592,140 +1616,6 @@ declare class Server { anyOf: ( | { description: 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?: AnymatchMatcher | string[], 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?: AnymatchMatcher | string[], 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 {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] - */ link: string; type: string; cli: { @@ -1764,6 +1654,99 @@ declare class Server { ClientReconnect: { description: string; link: string; + /** + * @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] + */ anyOf: ( | { type: string; @@ -1776,6 +1759,9 @@ declare class Server { )[]; cli: { negatedDescription: string; + /** + * @typedef {import("ws").WebSocketServer | import("sockjs").Server & { close: import("ws").WebSocketServer["close"] }} WebSocketServer + */ }; }; ClientWebSocketTransport: { @@ -1791,6 +1777,9 @@ declare class Server { ClientWebSocketTransportString: { type: string; minLength: number; + /** + * @typedef {(ProxyConfigArrayItem | ((req?: Request | undefined, res?: Response | undefined, next?: NextFunction | undefined) => ProxyConfigArrayItem))[]} ProxyConfigArray + */ }; ClientWebSocketURL: { description: string; @@ -1917,7 +1906,7 @@ declare class Server { instanceof: string; type?: undefined; } - )[]; + )[] /** @type {Compiler | MultiCompiler} */; }; instanceof?: undefined; } @@ -1934,9 +1923,6 @@ declare class Server { )[]; description: string; }; - /** - * @type {FSWatcher[]} - */ cacert: { anyOf: ( | { @@ -2107,13 +2093,13 @@ declare class Server { description: string; }; }; + /** + * @returns {string} + */ cli?: undefined; } )[]; description: string; - /** - * @type {string | undefined} - */ link: string; }; HeaderObject: { @@ -2159,9 +2145,6 @@ declare class Server { description: string; link: string; }; - /** - * @type {string[]} - */ HistoryApiFallback: { anyOf: ( | { @@ -2176,7 +2159,7 @@ declare class Server { } )[]; description: string; - link: string; + link: string /** @type {WebSocketURL} */; }; Host: { description: string; @@ -2198,7 +2181,7 @@ declare class Server { anyOf: ( | { type: string; - enum?: undefined; + /** @type {string} */ enum?: undefined; } | { enum: string[]; @@ -2215,7 +2198,7 @@ declare class Server { anyOf: ( | { type: string; - /** @type {ServerConfiguration} */ minLength: number; + minLength: number; enum?: undefined; } | { @@ -2400,6 +2383,7 @@ declare class Server { instanceof?: undefined; } | { + /** @type {any} */ instanceof: string; type?: undefined; } @@ -2407,6 +2391,7 @@ declare class Server { }; } )[]; + /** @type {any} */ description: string; link: string; }; @@ -2416,10 +2401,6 @@ declare class Server { }[]; link: string; description: string; - /** - * @private - * @returns {Compiler["options"]} - */ }; ServerType: { enum: string[]; @@ -2434,8 +2415,8 @@ declare class Server { type: string; minLength: number; cli: { - exclude: boolean /** @type {MultiCompiler} */; - } /** @type {MultiCompiler} */; + exclude: boolean; + }; }; ServerObject: { type: string; @@ -2447,13 +2428,13 @@ declare class Server { }; options: { $ref: string; - }; + } /** @type {MultiCompiler} */; }; - additionalProperties: boolean; + /** @type {MultiCompiler} */ additionalProperties: boolean; }; ServerOptions: { type: string; - /** @type {MultiCompiler} */ additionalProperties: boolean; + additionalProperties: boolean; properties: { passphrase: { type: string; @@ -2866,6 +2847,7 @@ declare class Server { }; WebSocketServerObject: { type: string; + /** @type {ServerOptions} */ properties: { type: { anyOf: { @@ -2935,7 +2917,7 @@ declare class Server { $ref: string; }; onBeforeSetupMiddleware: { - $ref: string; + $ref: string /** @type {any} */; }; onListening: { $ref: string;