From cc316920b93997a8d1de47abcea64468660f9841 Mon Sep 17 00:00:00 2001 From: sheo13666q <4567934+alexander-akait@users.noreply.github.com> Date: Fri, 20 Nov 2026 10:01:13 +0000 Subject: [PATCH] refactor: generate the options check with `schema-utils precompile` Replace the custom `scripts/generate-schema-check.mjs` with `schema-utils precompile --minify`, which handles the `instanceof` keyword and the documentation-only keywords itself, and minifies the check from 174 KB to 54 KB. --- .changeset/schema-utils-precompile.md | 5 + lib/options.check.js | 8 +- package-lock.json | 68 +++++------ package.json | 11 +- scripts/generate-schema-check.mjs | 170 -------------------------- types/lib/options.check.d.ts | 16 +-- 6 files changed, 54 insertions(+), 224 deletions(-) create mode 100644 .changeset/schema-utils-precompile.md delete mode 100644 scripts/generate-schema-check.mjs diff --git a/.changeset/schema-utils-precompile.md b/.changeset/schema-utils-precompile.md new file mode 100644 index 0000000000..d1570eb4fb --- /dev/null +++ b/.changeset/schema-utils-precompile.md @@ -0,0 +1,5 @@ +--- +"webpack-dev-server": patch +--- + +Generate the precompiled options check with `schema-utils precompile --minify`, which makes it about a third of the size, so it loads faster. diff --git a/lib/options.check.js b/lib/options.check.js index 7fe558d517..d26dc6d613 100644 --- a/lib/options.check.js +++ b/lib/options.check.js @@ -1,5 +1,7 @@ -// This file was automatically generated. -// DO NOT MODIFY BY HAND. Run `npm run fix:schema-check` to update. /* eslint-disable */ // @ts-nocheck -"use strict";export const validate = validate10;export default validate10;const schema11 = {"title":"Dev Server options","type":"object","definitions":{"App":{"instanceof":"Function","description":"Allows to use custom applications, such as 'connect', 'fastify', etc.","link":"https://webpack.js.org/configuration/dev-server/#devserverapp"},"AllowedHosts":{"anyOf":[{"type":"array","minItems":1,"items":{"$ref":"#/definitions/AllowedHostsItem"}},{"enum":["auto","all"]},{"$ref":"#/definitions/AllowedHostsItem"}],"description":"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').","link":"https://webpack.js.org/configuration/dev-server/#devserverallowedhosts"},"AllowedHostsItem":{"type":"string","minLength":1},"AllowedOrigins":{"anyOf":[{"type":"array","items":{"$ref":"#/definitions/AllowedOriginsItem"}},{"$ref":"#/definitions/AllowedOriginsItem"}],"description":"Which origins may use the dev server: its HTTP endpoints, the hot module replacement connection and proxied WebSockets. 'auto' (the default) keeps the rules derived from 'allowedHosts'. A list of HTTP(S) origins allows those plus the page's own hostname, on any port, independently of 'allowedHosts'. 'all' allows every origin without turning off the 'Host' check.","link":"https://github.com/webpack/webpack-dev-server#allowedorigins"},"AllowedOriginsItem":{"anyOf":[{"enum":["auto","all"]},{"type":"string","pattern":"^https?://[^/?#\\s@]+/?$"}]},"Bonjour":{"anyOf":[{"type":"boolean","cli":{"negatedDescription":"Disallows to broadcasts dev server via ZeroConf networking on start."}},{"type":"object","description":"Options for bonjour.","link":"https://github.com/watson/bonjour#initializing"}],"description":"Allows to broadcasts dev server via ZeroConf networking on start.","link":" https://webpack.js.org/configuration/dev-server/#devserverbonjour"},"Client":{"description":"Allows to specify options for client script in the browser or disable client script.","link":"https://webpack.js.org/configuration/dev-server/#devserverclient","anyOf":[{"enum":[false],"cli":{"negatedDescription":"Disables client script."}},{"type":"object","additionalProperties":false,"properties":{"logging":{"$ref":"#/definitions/ClientLogging"},"overlay":{"$ref":"#/definitions/ClientOverlay"},"progress":{"$ref":"#/definitions/ClientProgress"},"reconnect":{"$ref":"#/definitions/ClientReconnect"},"webSocketTransport":{"$ref":"#/definitions/ClientWebSocketTransport"},"webSocketURL":{"$ref":"#/definitions/ClientWebSocketURL"}}}]},"ClientLogging":{"enum":["none","error","warn","info","log","verbose"],"description":"Allows to set log level in the browser.","link":"https://webpack.js.org/configuration/dev-server/#logging"},"ClientOverlay":{"anyOf":[{"description":"Enables a full-screen overlay in the browser when there are compiler errors or warnings.","link":"https://webpack.js.org/configuration/dev-server/#overlay","type":"boolean","cli":{"negatedDescription":"Disables the full-screen overlay in the browser when there are compiler errors or warnings."}},{"type":"object","additionalProperties":false,"properties":{"errors":{"anyOf":[{"description":"Enables a full-screen overlay in the browser when there are compiler errors.","type":"boolean","cli":{"negatedDescription":"Disables the full-screen overlay in the browser when there are compiler errors."}},{"instanceof":"Function","description":"Filter compiler errors. Return true to include and return false to exclude."}]},"warnings":{"anyOf":[{"description":"Enables a full-screen overlay in the browser when there are compiler warnings.","type":"boolean","cli":{"negatedDescription":"Disables the full-screen overlay in the browser when there are compiler warnings."}},{"instanceof":"Function","description":"Filter compiler warnings. Return true to include and return false to exclude."}]},"runtimeErrors":{"anyOf":[{"description":"Enables a full-screen overlay in the browser when there are uncaught runtime errors.","type":"boolean","cli":{"negatedDescription":"Disables the full-screen overlay in the browser when there are uncaught runtime errors."}},{"instanceof":"Function","description":"Filter uncaught runtime errors. Return true to include and return false to exclude."}]},"trustedTypesPolicyName":{"description":"The name of a Trusted Types policy for the overlay. Defaults to 'webpack-dev-server#overlay'.","type":"string"}}}]},"ClientProgress":{"description":"Displays compilation progress in the browser. Options include 'linear' and 'circular' for visual indicators.","link":"https://webpack.js.org/configuration/dev-server/#progress","type":["boolean","string"],"enum":[true,false,"linear","circular"],"cli":{"negatedDescription":"Does not display compilation progress in the browser."}},"ClientReconnect":{"description":"Tells dev-server the number of times it should try to reconnect the client.","link":"https://webpack.js.org/configuration/dev-server/#reconnect","anyOf":[{"type":"boolean","cli":{"negatedDescription":"Tells dev-server to not to try to reconnect the client."}},{"type":"number","minimum":0}]},"ClientWebSocketTransport":{"anyOf":[{"$ref":"#/definitions/ClientWebSocketTransportEnum"},{"$ref":"#/definitions/ClientWebSocketTransportString"}],"description":"Allows to set custom web socket transport to communicate with dev server.","link":"https://webpack.js.org/configuration/dev-server/#websockettransport"},"ClientWebSocketTransportEnum":{"enum":["ws","sse"]},"ClientWebSocketTransportString":{"type":"string","minLength":1},"ClientWebSocketURL":{"description":"Allows to specify URL to web socket server (useful when you're proxying dev server and client script does not always know where to connect to).","link":"https://webpack.js.org/configuration/dev-server/#websocketurl","anyOf":[{"type":"string","minLength":1},{"type":"object","additionalProperties":false,"properties":{"hostname":{"description":"Tells clients connected to devServer to use the provided hostname.","type":"string","minLength":1},"pathname":{"description":"Tells clients connected to devServer to use the provided path to connect.","type":"string"},"password":{"description":"Tells clients connected to devServer to use the provided password to authenticate.","type":"string"},"port":{"description":"Tells clients connected to devServer to use the provided port.","anyOf":[{"type":"number"},{"type":"string","minLength":1}]},"protocol":{"description":"Tells clients connected to devServer to use the provided protocol.","anyOf":[{"enum":["auto"]},{"type":"string","minLength":1}]},"username":{"description":"Tells clients connected to devServer to use the provided username to authenticate.","type":"string"}}}]},"Compress":{"type":"boolean","description":"Enables gzip compression for everything served.","link":"https://webpack.js.org/configuration/dev-server/#devservercompress","cli":{"negatedDescription":"Disables gzip compression for everything served."}},"DevMiddleware":{"description":"Provide options to 'webpack-dev-middleware' which handles webpack assets.","link":"https://webpack.js.org/configuration/dev-server/#devserverdevmiddleware","type":"object","additionalProperties":true},"HeaderObject":{"type":"object","additionalProperties":false,"properties":{"key":{"description":"key of header.","type":"string"},"value":{"description":"value of header.","type":"string"}},"cli":{"exclude":true}},"Headers":{"anyOf":[{"type":"array","items":{"$ref":"#/definitions/HeaderObject"},"minItems":1},{"type":"object"},{"instanceof":"Function"}],"description":"Allows to set custom headers on response.","link":"https://webpack.js.org/configuration/dev-server/#devserverheaders"},"HistoryApiFallback":{"anyOf":[{"type":"boolean","cli":{"negatedDescription":"Disallows to proxy requests through a specified index page."}},{"type":"object","description":"Options for `historyApiFallback`.","link":"https://github.com/bripkens/connect-history-api-fallback#options"}],"description":"Allows to proxy requests through a specified index page (by default 'index.html'), useful for Single Page Applications that utilise the HTML5 History API.","link":"https://webpack.js.org/configuration/dev-server/#devserverhistoryapifallback"},"Host":{"description":"Allows to specify a hostname to use.","link":"https://webpack.js.org/configuration/dev-server/#devserverhost","anyOf":[{"enum":["local-ip","local-ipv4","local-ipv6"]},{"type":"string","minLength":1}]},"Hot":{"anyOf":[{"type":"boolean","cli":{"negatedDescription":"Disables Hot Module Replacement."}},{"enum":["only"]}],"description":"Enables Hot Module Replacement.","link":"https://webpack.js.org/configuration/dev-server/#devserverhot"},"IPC":{"anyOf":[{"type":"string","minLength":1},{"type":"boolean","enum":[true]}],"description":"Listen to a unix socket.","link":"https://webpack.js.org/configuration/dev-server/#devserveripc"},"LiveReload":{"type":"boolean","description":"Enables reload/refresh the page(s) when file changes are detected (enabled by default).","cli":{"negatedDescription":"Disables reload/refresh the page(s) when file changes are detected (enabled by default)."},"link":"https://webpack.js.org/configuration/dev-server/#devserverlivereload"},"OnListening":{"instanceof":"Function","description":"Provides the ability to execute a custom function when dev server starts listening.","link":"https://webpack.js.org/configuration/dev-server/#devserveronlistening"},"Open":{"anyOf":[{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/OpenString"},{"$ref":"#/definitions/OpenObject"}]}},{"$ref":"#/definitions/OpenBoolean"},{"$ref":"#/definitions/OpenString"},{"$ref":"#/definitions/OpenObject"}],"description":"Allows to configure dev server to open the browser(s) and page(s) after server had been started (set it to true to open your default browser).","link":"https://webpack.js.org/configuration/dev-server/#devserveropen"},"OpenBoolean":{"type":"boolean","cli":{"negatedDescription":"Does not open the default browser."}},"OpenObject":{"type":"object","additionalProperties":false,"properties":{"target":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"string"}],"description":"Opens specified page in browser."},"app":{"anyOf":[{"type":"object","additionalProperties":false,"properties":{"name":{"anyOf":[{"type":"array","items":{"type":"string","minLength":1},"minItems":1},{"type":"string","minLength":1}]},"arguments":{"items":{"type":"string","minLength":1}}}},{"type":"string","minLength":1,"description":"Open specified browser.","cli":{"exclude":true}}],"description":"Open specified browser."}}},"OpenString":{"type":"string","minLength":1},"Port":{"anyOf":[{"type":"number","minimum":0,"maximum":65535},{"type":"string","minLength":1},{"enum":["auto"]}],"description":"Allows to specify a port to use.","link":"https://webpack.js.org/configuration/dev-server/#devserverport"},"Proxy":{"type":"array","items":{"anyOf":[{"type":"object"},{"instanceof":"Function"}]},"description":"Allows to proxy requests, can be useful when you have a separate API backend development server and you want to send API requests on the same domain.","link":"https://webpack.js.org/configuration/dev-server/#devserverproxy"},"Server":{"anyOf":[{"$ref":"#/definitions/ServerEnum"},{"$ref":"#/definitions/ServerFn"},{"$ref":"#/definitions/ServerString"},{"$ref":"#/definitions/ServerObject"}],"link":"https://webpack.js.org/configuration/dev-server/#devserverserver","description":"Allows to set server and options (by default 'http')."},"ServerType":{"enum":["http","https","http2"]},"ServerFn":{"instanceof":"Function"},"ServerEnum":{"enum":["http","https","http2"],"cli":{"exclude":true}},"ServerString":{"type":"string","minLength":1,"cli":{"exclude":true}},"ServerObject":{"type":"object","properties":{"type":{"anyOf":[{"$ref":"#/definitions/ServerType"},{"$ref":"#/definitions/ServerString"},{"$ref":"#/definitions/ServerFn"}]},"options":{"$ref":"#/definitions/ServerOptions"}},"additionalProperties":false},"ServerOptions":{"type":"object","additionalProperties":true,"properties":{"passphrase":{"type":"string","description":"Passphrase for a pfx file."},"requestCert":{"type":"boolean","description":"Request for an SSL certificate.","cli":{"negatedDescription":"Does not request for an SSL certificate."}},"ca":{"anyOf":[{"type":"array","items":{"anyOf":[{"type":"string"},{"instanceof":"Buffer"}]}},{"type":"string"},{"instanceof":"Buffer"}],"description":"Path to an SSL CA certificate or content of an SSL CA certificate."},"cert":{"anyOf":[{"type":"array","items":{"anyOf":[{"type":"string"},{"instanceof":"Buffer"}]}},{"type":"string"},{"instanceof":"Buffer"}],"description":"Path to an SSL certificate or content of an SSL certificate."},"crl":{"anyOf":[{"type":"array","items":{"anyOf":[{"type":"string"},{"instanceof":"Buffer"}]}},{"type":"string"},{"instanceof":"Buffer"}],"description":"Path to PEM formatted CRLs (Certificate Revocation Lists) or content of PEM formatted CRLs (Certificate Revocation Lists)."},"key":{"anyOf":[{"type":"array","items":{"anyOf":[{"type":"string"},{"instanceof":"Buffer"},{"type":"object","additionalProperties":true}]}},{"type":"string"},{"instanceof":"Buffer"}],"description":"Path to an SSL key or content of an SSL key."},"pfx":{"anyOf":[{"type":"array","items":{"anyOf":[{"type":"string"},{"instanceof":"Buffer"},{"type":"object","additionalProperties":true}]}},{"type":"string"},{"instanceof":"Buffer"}],"description":"Path to an SSL pfx file or content of an SSL pfx file."}}},"SetupExitSignals":{"type":"boolean","description":"Allows to close dev server and exit the process on SIGINT and SIGTERM signals (enabled by default for CLI).","link":"https://webpack.js.org/configuration/dev-server/#devserversetupexitsignals","cli":{"exclude":true}},"SetupMiddlewares":{"instanceof":"Function","description":"Provides the ability to execute a custom function and apply custom middleware(s).","link":"https://webpack.js.org/configuration/dev-server/#devserversetupmiddlewares"},"Static":{"anyOf":[{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/StaticString"},{"$ref":"#/definitions/StaticObject"}]}},{"type":"boolean","cli":{"negatedDescription":"Disallows to configure options for serving static files from directory."}},{"$ref":"#/definitions/StaticString"},{"$ref":"#/definitions/StaticObject"}],"description":"Allows to configure options for serving static files from directory (by default 'public' directory).","link":"https://webpack.js.org/configuration/dev-server/#devserverstatic"},"StaticObject":{"type":"object","additionalProperties":false,"properties":{"directory":{"type":"string","minLength":1,"description":"Directory for static contents.","link":"https://webpack.js.org/configuration/dev-server/#directory"},"staticOptions":{"type":"object","link":"https://webpack.js.org/configuration/dev-server/#staticoptions","additionalProperties":true},"publicPath":{"anyOf":[{"type":"array","items":{"type":"string"},"minItems":1},{"type":"string"}],"description":"The static files will be available in the browser under this public path.","link":"https://webpack.js.org/configuration/dev-server/#publicpath"},"serveIndex":{"anyOf":[{"type":"boolean","cli":{"negatedDescription":"Does not tell dev server to use serveIndex middleware."}},{"type":"object","additionalProperties":true}],"description":"Tells dev server to use serveIndex middleware when enabled.","link":"https://webpack.js.org/configuration/dev-server/#serveindex"},"watch":{"anyOf":[{"type":"boolean","cli":{"negatedDescription":"Does not watch for files in static content directory."}},{"type":"object","description":"Options for watch.","link":"https://github.com/paulmillr/chokidar#api"}],"description":"Watches for files in static content directory.","link":"https://webpack.js.org/configuration/dev-server/#watch"},"deny":{"anyOf":[{"type":"boolean","cli":{"negatedDescription":"Serves every file in the static content directory."}},{"type":"array","items":{"type":"string","minLength":1,"pattern":"^[^/\\\\]+$"}}],"description":"Files never to serve from the static content directory, matched against each segment of the path: 'true' for the default list of secrets ('.env', '.env.*', keys and certificates, '.npmrc', '.yarnrc.yml', '.git'), or patterns of your own, with '*', '?' and '{a,b}'.","link":"https://github.com/webpack/webpack-dev-server#staticdeny"}}},"StaticString":{"type":"string","minLength":1},"WatchFiles":{"anyOf":[{"type":"array","items":{"anyOf":[{"$ref":"#/definitions/WatchFilesString"},{"$ref":"#/definitions/WatchFilesObject"}]}},{"$ref":"#/definitions/WatchFilesString"},{"$ref":"#/definitions/WatchFilesObject"}],"description":"Allows to configure list of globs/directories/files to watch for file changes.","link":"https://webpack.js.org/configuration/dev-server/#devserverwatchfiles"},"WatchFilesObject":{"cli":{"exclude":true},"type":"object","properties":{"paths":{"anyOf":[{"type":"array","items":{"type":"string","minLength":1}},{"type":"string","minLength":1}],"description":"Path(s) of globs/directories/files to watch for file changes."},"options":{"type":"object","description":"Configure advanced options for watching. See the chokidar documentation for the possible options.","link":"https://github.com/paulmillr/chokidar#api","additionalProperties":true}},"additionalProperties":false},"WatchFilesString":{"type":"string","minLength":1},"WebSocketServer":{"anyOf":[{"$ref":"#/definitions/WebSocketServerEnum"},{"$ref":"#/definitions/WebSocketServerString"},{"$ref":"#/definitions/WebSocketServerFunction"},{"$ref":"#/definitions/WebSocketServerObject"}],"description":"Allows to set web socket server and options (by default 'ws').","link":"https://webpack.js.org/configuration/dev-server/#devserverwebsocketserver"},"WebSocketServerType":{"enum":["ws"]},"WebSocketServerEnum":{"anyOf":[{"enum":[false],"cli":{"negatedDescription":"Disallows to set web socket server and options."}},{"enum":["ws","sse"],"cli":{"exclude":true}}]},"WebSocketServerFunction":{"instanceof":"Function"},"WebSocketServerObject":{"type":"object","properties":{"type":{"anyOf":[{"$ref":"#/definitions/WebSocketServerType"},{"$ref":"#/definitions/WebSocketServerString"},{"$ref":"#/definitions/WebSocketServerFunction"}]},"options":{"type":"object","additionalProperties":true,"cli":{"exclude":true}}},"additionalProperties":false},"WebSocketServerString":{"type":"string","minLength":1,"cli":{"exclude":true}}},"additionalProperties":false,"properties":{"allowedHosts":{"$ref":"#/definitions/AllowedHosts"},"allowedOrigins":{"$ref":"#/definitions/AllowedOrigins"},"bonjour":{"$ref":"#/definitions/Bonjour"},"client":{"$ref":"#/definitions/Client"},"compress":{"$ref":"#/definitions/Compress"},"devMiddleware":{"$ref":"#/definitions/DevMiddleware"},"headers":{"$ref":"#/definitions/Headers"},"historyApiFallback":{"$ref":"#/definitions/HistoryApiFallback"},"host":{"$ref":"#/definitions/Host"},"hot":{"$ref":"#/definitions/Hot"},"ipc":{"$ref":"#/definitions/IPC"},"liveReload":{"$ref":"#/definitions/LiveReload"},"onListening":{"$ref":"#/definitions/OnListening"},"open":{"$ref":"#/definitions/Open"},"port":{"$ref":"#/definitions/Port"},"proxy":{"$ref":"#/definitions/Proxy"},"server":{"$ref":"#/definitions/Server"},"app":{"$ref":"#/definitions/App"},"setupExitSignals":{"$ref":"#/definitions/SetupExitSignals"},"setupMiddlewares":{"$ref":"#/definitions/SetupMiddlewares"},"static":{"$ref":"#/definitions/Static"},"watchFiles":{"$ref":"#/definitions/WatchFiles"},"webSocketServer":{"$ref":"#/definitions/WebSocketServer"}}};const schema18 = {"anyOf":[{"type":"boolean","cli":{"negatedDescription":"Disallows to broadcasts dev server via ZeroConf networking on start."}},{"type":"object","description":"Options for bonjour.","link":"https://github.com/watson/bonjour#initializing"}],"description":"Allows to broadcasts dev server via ZeroConf networking on start.","link":" https://webpack.js.org/configuration/dev-server/#devserverbonjour"};const schema28 = {"type":"boolean","description":"Enables gzip compression for everything served.","link":"https://webpack.js.org/configuration/dev-server/#devservercompress","cli":{"negatedDescription":"Disables gzip compression for everything served."}};const schema29 = {"description":"Provide options to 'webpack-dev-middleware' which handles webpack assets.","link":"https://webpack.js.org/configuration/dev-server/#devserverdevmiddleware","type":"object","additionalProperties":true};const schema32 = {"anyOf":[{"type":"boolean","cli":{"negatedDescription":"Disallows to proxy requests through a specified index page."}},{"type":"object","description":"Options for `historyApiFallback`.","link":"https://github.com/bripkens/connect-history-api-fallback#options"}],"description":"Allows to proxy requests through a specified index page (by default 'index.html'), useful for Single Page Applications that utilise the HTML5 History API.","link":"https://webpack.js.org/configuration/dev-server/#devserverhistoryapifallback"};const schema33 = {"description":"Allows to specify a hostname to use.","link":"https://webpack.js.org/configuration/dev-server/#devserverhost","anyOf":[{"enum":["local-ip","local-ipv4","local-ipv6"]},{"type":"string","minLength":1}]};const schema34 = {"anyOf":[{"type":"boolean","cli":{"negatedDescription":"Disables Hot Module Replacement."}},{"enum":["only"]}],"description":"Enables Hot Module Replacement.","link":"https://webpack.js.org/configuration/dev-server/#devserverhot"};const schema35 = {"anyOf":[{"type":"string","minLength":1},{"type":"boolean","enum":[true]}],"description":"Listen to a unix socket.","link":"https://webpack.js.org/configuration/dev-server/#devserveripc"};const schema36 = {"type":"boolean","description":"Enables reload/refresh the page(s) when file changes are detected (enabled by default).","cli":{"negatedDescription":"Disables reload/refresh the page(s) when file changes are detected (enabled by default)."},"link":"https://webpack.js.org/configuration/dev-server/#devserverlivereload"};const schema37 = {"instanceof":"Function","description":"Provides the ability to execute a custom function when dev server starts listening.","link":"https://webpack.js.org/configuration/dev-server/#devserveronlistening"};const schema44 = {"anyOf":[{"type":"number","minimum":0,"maximum":65535},{"type":"string","minLength":1},{"enum":["auto"]}],"description":"Allows to specify a port to use.","link":"https://webpack.js.org/configuration/dev-server/#devserverport"};const schema45 = {"type":"array","items":{"anyOf":[{"type":"object"},{"instanceof":"Function"}]},"description":"Allows to proxy requests, can be useful when you have a separate API backend development server and you want to send API requests on the same domain.","link":"https://webpack.js.org/configuration/dev-server/#devserverproxy"};const schema55 = {"instanceof":"Function","description":"Allows to use custom applications, such as 'connect', 'fastify', etc.","link":"https://webpack.js.org/configuration/dev-server/#devserverapp"};const schema56 = {"type":"boolean","description":"Allows to close dev server and exit the process on SIGINT and SIGTERM signals (enabled by default for CLI).","link":"https://webpack.js.org/configuration/dev-server/#devserversetupexitsignals","cli":{"exclude":true}};const schema57 = {"instanceof":"Function","description":"Provides the ability to execute a custom function and apply custom middleware(s).","link":"https://webpack.js.org/configuration/dev-server/#devserversetupmiddlewares"};const func2 = Object.prototype.hasOwnProperty;const schema12 = {"anyOf":[{"type":"array","minItems":1,"items":{"$ref":"#/definitions/AllowedHostsItem"}},{"enum":["auto","all"]},{"$ref":"#/definitions/AllowedHostsItem"}],"description":"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').","link":"https://webpack.js.org/configuration/dev-server/#devserverallowedhosts"};const schema13 = {"type":"string","minLength":1};function validate11(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;const _errs0 = errors;let valid0 = false;const _errs1 = errors;if(errors === _errs1){if(Array.isArray(data)){if(data.length < 1){const err0 = {instancePath,schemaPath:"#/anyOf/0/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}else {var valid1 = true;const len0 = data.length;for(let i0=0; i0=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}}else {const err21 = {instancePath:instancePath+"/reconnect",schemaPath:"#/definitions/ClientReconnect/anyOf/1/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}}var _valid5 = _errs50 === errors;valid11 = valid11 || _valid5;}if(!valid11){const err22 = {instancePath:instancePath+"/reconnect",schemaPath:"#/definitions/ClientReconnect/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}else {errors = _errs46;if(vErrors !== null){if(_errs46){vErrors.length = _errs46;}else {vErrors = null;}}}var valid1 = _errs44 === errors;}else {var valid1 = true;}if(valid1){if(data.webSocketTransport !== undefined){const _errs53 = errors;if(!(validate16(data.webSocketTransport, {instancePath:instancePath+"/webSocketTransport",parentData:data,parentDataProperty:"webSocketTransport",rootData}))){vErrors = vErrors === null ? validate16.errors : vErrors.concat(validate16.errors);errors = vErrors.length;}var valid1 = _errs53 === errors;}else {var valid1 = true;}if(valid1){if(data.webSocketURL !== undefined){let data9 = data.webSocketURL;const _errs54 = errors;const _errs56 = errors;let valid13 = false;const _errs57 = errors;if(errors === _errs57){if(typeof data9 === "string"){if(data9.length < 1){const err23 = {instancePath:instancePath+"/webSocketURL",schemaPath:"#/definitions/ClientWebSocketURL/anyOf/0/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}}else {const err24 = {instancePath:instancePath+"/webSocketURL",schemaPath:"#/definitions/ClientWebSocketURL/anyOf/0/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err24];}else {vErrors.push(err24);}errors++;}}var _valid6 = _errs57 === errors;valid13 = valid13 || _valid6;if(!valid13){const _errs59 = errors;if(errors === _errs59){if(data9 && typeof data9 == "object" && !Array.isArray(data9)){const _errs61 = errors;for(const key2 in data9){if(!((((((key2 === "hostname") || (key2 === "pathname")) || (key2 === "password")) || (key2 === "port")) || (key2 === "protocol")) || (key2 === "username"))){const err25 = {instancePath:instancePath+"/webSocketURL",schemaPath:"#/definitions/ClientWebSocketURL/anyOf/1/additionalProperties",keyword:"additionalProperties",params:{additionalProperty: key2},message:"must NOT have additional properties"};if(vErrors === null){vErrors = [err25];}else {vErrors.push(err25);}errors++;break;}}if(_errs61 === errors){if(data9.hostname !== undefined){let data10 = data9.hostname;const _errs62 = errors;if(errors === _errs62){if(typeof data10 === "string"){if(data10.length < 1){const err26 = {instancePath:instancePath+"/webSocketURL/hostname",schemaPath:"#/definitions/ClientWebSocketURL/anyOf/1/properties/hostname/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err26];}else {vErrors.push(err26);}errors++;}}else {const err27 = {instancePath:instancePath+"/webSocketURL/hostname",schemaPath:"#/definitions/ClientWebSocketURL/anyOf/1/properties/hostname/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err27];}else {vErrors.push(err27);}errors++;}}var valid14 = _errs62 === errors;}else {var valid14 = true;}if(valid14){if(data9.pathname !== undefined){const _errs64 = errors;if(typeof data9.pathname !== "string"){const err28 = {instancePath:instancePath+"/webSocketURL/pathname",schemaPath:"#/definitions/ClientWebSocketURL/anyOf/1/properties/pathname/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err28];}else {vErrors.push(err28);}errors++;}var valid14 = _errs64 === errors;}else {var valid14 = true;}if(valid14){if(data9.password !== undefined){const _errs66 = errors;if(typeof data9.password !== "string"){const err29 = {instancePath:instancePath+"/webSocketURL/password",schemaPath:"#/definitions/ClientWebSocketURL/anyOf/1/properties/password/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err29];}else {vErrors.push(err29);}errors++;}var valid14 = _errs66 === errors;}else {var valid14 = true;}if(valid14){if(data9.port !== undefined){let data13 = data9.port;const _errs68 = errors;const _errs69 = errors;let valid15 = false;const _errs70 = errors;if(!(typeof data13 == "number")){const err30 = {instancePath:instancePath+"/webSocketURL/port",schemaPath:"#/definitions/ClientWebSocketURL/anyOf/1/properties/port/anyOf/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err30];}else {vErrors.push(err30);}errors++;}var _valid7 = _errs70 === errors;valid15 = valid15 || _valid7;if(!valid15){const _errs72 = errors;if(errors === _errs72){if(typeof data13 === "string"){if(data13.length < 1){const err31 = {instancePath:instancePath+"/webSocketURL/port",schemaPath:"#/definitions/ClientWebSocketURL/anyOf/1/properties/port/anyOf/1/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err31];}else {vErrors.push(err31);}errors++;}}else {const err32 = {instancePath:instancePath+"/webSocketURL/port",schemaPath:"#/definitions/ClientWebSocketURL/anyOf/1/properties/port/anyOf/1/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err32];}else {vErrors.push(err32);}errors++;}}var _valid7 = _errs72 === errors;valid15 = valid15 || _valid7;}if(!valid15){const err33 = {instancePath:instancePath+"/webSocketURL/port",schemaPath:"#/definitions/ClientWebSocketURL/anyOf/1/properties/port/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};if(vErrors === null){vErrors = [err33];}else {vErrors.push(err33);}errors++;}else {errors = _errs69;if(vErrors !== null){if(_errs69){vErrors.length = _errs69;}else {vErrors = null;}}}var valid14 = _errs68 === errors;}else {var valid14 = true;}if(valid14){if(data9.protocol !== undefined){let data14 = data9.protocol;const _errs74 = errors;const _errs75 = errors;let valid16 = false;const _errs76 = errors;if(!(data14 === "auto")){const err34 = {instancePath:instancePath+"/webSocketURL/protocol",schemaPath:"#/definitions/ClientWebSocketURL/anyOf/1/properties/protocol/anyOf/0/enum",keyword:"enum",params:{allowedValues: schema27.anyOf[1].properties.protocol.anyOf[0].enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err34];}else {vErrors.push(err34);}errors++;}var _valid8 = _errs76 === errors;valid16 = valid16 || _valid8;if(!valid16){const _errs77 = errors;if(errors === _errs77){if(typeof data14 === "string"){if(data14.length < 1){const err35 = {instancePath:instancePath+"/webSocketURL/protocol",schemaPath:"#/definitions/ClientWebSocketURL/anyOf/1/properties/protocol/anyOf/1/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err35];}else {vErrors.push(err35);}errors++;}}else {const err36 = {instancePath:instancePath+"/webSocketURL/protocol",schemaPath:"#/definitions/ClientWebSocketURL/anyOf/1/properties/protocol/anyOf/1/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err36];}else {vErrors.push(err36);}errors++;}}var _valid8 = _errs77 === errors;valid16 = valid16 || _valid8;}if(!valid16){const err37 = {instancePath:instancePath+"/webSocketURL/protocol",schemaPath:"#/definitions/ClientWebSocketURL/anyOf/1/properties/protocol/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};if(vErrors === null){vErrors = [err37];}else {vErrors.push(err37);}errors++;}else {errors = _errs75;if(vErrors !== null){if(_errs75){vErrors.length = _errs75;}else {vErrors = null;}}}var valid14 = _errs74 === errors;}else {var valid14 = true;}if(valid14){if(data9.username !== undefined){const _errs79 = errors;if(typeof data9.username !== "string"){const err38 = {instancePath:instancePath+"/webSocketURL/username",schemaPath:"#/definitions/ClientWebSocketURL/anyOf/1/properties/username/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err38];}else {vErrors.push(err38);}errors++;}var valid14 = _errs79 === errors;}else {var valid14 = true;}}}}}}}}else {const err39 = {instancePath:instancePath+"/webSocketURL",schemaPath:"#/definitions/ClientWebSocketURL/anyOf/1/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err39];}else {vErrors.push(err39);}errors++;}}var _valid6 = _errs59 === errors;valid13 = valid13 || _valid6;}if(!valid13){const err40 = {instancePath:instancePath+"/webSocketURL",schemaPath:"#/definitions/ClientWebSocketURL/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};if(vErrors === null){vErrors = [err40];}else {vErrors.push(err40);}errors++;}else {errors = _errs56;if(vErrors !== null){if(_errs56){vErrors.length = _errs56;}else {vErrors = null;}}}var valid1 = _errs54 === errors;}else {var valid1 = true;}}}}}}}}else {const err41 = {instancePath,schemaPath:"#/anyOf/1/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err41];}else {vErrors.push(err41);}errors++;}}var _valid0 = _errs3 === errors;valid0 = valid0 || _valid0;}if(!valid0){const err42 = {instancePath,schemaPath:"#/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};if(vErrors === null){vErrors = [err42];}else {vErrors.push(err42);}errors++;validate15.errors = vErrors;return false;}else {errors = _errs0;if(vErrors !== null){if(_errs0){vErrors.length = _errs0;}else {vErrors = null;}}}validate15.errors = vErrors;return errors === 0;}const schema30 = {"anyOf":[{"type":"array","items":{"$ref":"#/definitions/HeaderObject"},"minItems":1},{"type":"object"},{"instanceof":"Function"}],"description":"Allows to set custom headers on response.","link":"https://webpack.js.org/configuration/dev-server/#devserverheaders"};const schema31 = {"type":"object","additionalProperties":false,"properties":{"key":{"description":"key of header.","type":"string"},"value":{"description":"value of header.","type":"string"}},"cli":{"exclude":true}};function validate19(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;const _errs0 = errors;let valid0 = false;const _errs1 = errors;if(errors === _errs1){if(Array.isArray(data)){if(data.length < 1){const err0 = {instancePath,schemaPath:"#/anyOf/0/minItems",keyword:"minItems",params:{limit: 1},message:"must NOT have fewer than 1 items"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}else {var valid1 = true;const len0 = data.length;for(let i0=0; i0 65535 || isNaN(data14)){const err18 = {instancePath:instancePath+"/port",schemaPath:"#/definitions/Port/anyOf/0/maximum",keyword:"maximum",params:{comparison: "<=", limit: 65535},message:"must be <= 65535"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}else {if(data14 < 0 || isNaN(data14)){const err19 = {instancePath:instancePath+"/port",schemaPath:"#/definitions/Port/anyOf/0/minimum",keyword:"minimum",params:{comparison: ">=", limit: 0},message:"must be >= 0"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}}}else {const err20 = {instancePath:instancePath+"/port",schemaPath:"#/definitions/Port/anyOf/0/type",keyword:"type",params:{type: "number"},message:"must be number"};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}}var _valid5 = _errs71 === errors;valid16 = valid16 || _valid5;if(!valid16){const _errs73 = errors;if(errors === _errs73){if(typeof data14 === "string"){if(data14.length < 1){const err21 = {instancePath:instancePath+"/port",schemaPath:"#/definitions/Port/anyOf/1/minLength",keyword:"minLength",params:{limit: 1},message:"must NOT have fewer than 1 characters"};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}}else {const err22 = {instancePath:instancePath+"/port",schemaPath:"#/definitions/Port/anyOf/1/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}}var _valid5 = _errs73 === errors;valid16 = valid16 || _valid5;if(!valid16){const _errs75 = errors;if(!(data14 === "auto")){const err23 = {instancePath:instancePath+"/port",schemaPath:"#/definitions/Port/anyOf/2/enum",keyword:"enum",params:{allowedValues: schema44.anyOf[2].enum},message:"must be equal to one of the allowed values"};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}var _valid5 = _errs75 === errors;valid16 = valid16 || _valid5;}}if(!valid16){const err24 = {instancePath:instancePath+"/port",schemaPath:"#/definitions/Port/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};if(vErrors === null){vErrors = [err24];}else {vErrors.push(err24);}errors++;validate10.errors = vErrors;return false;}else {errors = _errs70;if(vErrors !== null){if(_errs70){vErrors.length = _errs70;}else {vErrors = null;}}}var valid0 = _errs68 === errors;}else {var valid0 = true;}if(valid0){if(data.proxy !== undefined){let data15 = data.proxy;const _errs77 = errors;const _errs78 = errors;if(errors === _errs78){if(Array.isArray(data15)){var valid18 = true;const len0 = data15.length;for(let i0=0; i0=55296&&o<=56319&&a=",limit:0}};s===null?s=[r]:s.push(r),a++}}else{let r={params:{type:"number"}};s===null?s=[r]:s.push(r),a++}var b=r===a;i=i||b}if(!i){let r={params:{}};s===null?s=[r]:s.push(r),a++}else{a=t;if(s!==null)t?s.length=t:s=null}var v=o===a}else var v=!0;if(v){if(r.webSocketTransport!==void 0){let o=a;if(!y(r.webSocketTransport,{instancePath:e+"/webSocketTransport",parentData:r,parentDataProperty:"webSocketTransport",rootData}))a=(s=s===null?y.errors:s.concat(y.errors)).length;var v=o===a}else var v=!0;if(v)if(r.webSocketURL!==void 0){let e=r.webSocketURL,o=a,t=a,l=!1,n=a;if(a===n)if("string"==typeof e){if(i(e)<1){let r={params:{limit:1}};s===null?s=[r]:s.push(r),a++}}else{let r={params:{type:"string"}};s===null?s=[r]:s.push(r),a++}var O=n===a;if(!(l=l||O)){let r=a;if(a===r)if(e&&"object"==typeof e&&!Array.isArray(e)){let r=a;for(let r in e)if(!(r==="hostname"||r==="pathname"||r==="password"||r==="port"||r==="protocol"||r==="username")){let e={params:{additionalProperty:r}};s===null?s=[e]:s.push(e),a++;break}if(r===a){if(e.hostname!==void 0){let r=e.hostname,o=a;if(a===o)if("string"==typeof r){if(i(r)<1){let r={params:{limit:1}};s===null?s=[r]:s.push(r),a++}}else{let r={params:{type:"string"}};s===null?s=[r]:s.push(r),a++}var k=o===a}else var k=!0;if(k){if(e.pathname!==void 0){let r=a;if("string"!=typeof e.pathname){let r={params:{type:"string"}};s===null?s=[r]:s.push(r),a++}var k=r===a}else var k=!0;if(k){if(e.password!==void 0){let r=a;if("string"!=typeof e.password){let r={params:{type:"string"}};s===null?s=[r]:s.push(r),a++}var k=r===a}else var k=!0;if(k){if(e.port!==void 0){let r=e.port,o=a,t=a,l=!1,n=a;if(!("number"==typeof r)){let r={params:{type:"number"}};s===null?s=[r]:s.push(r),a++}var S=n===a;if(!(l=l||S)){let e=a;if(a===e)if("string"==typeof r){if(i(r)<1){let r={params:{limit:1}};s===null?s=[r]:s.push(r),a++}}else{let r={params:{type:"string"}};s===null?s=[r]:s.push(r),a++}var S=e===a;l=l||S}if(!l){let r={params:{}};s===null?s=[r]:s.push(r),a++}else{a=t;if(s!==null)t?s.length=t:s=null}var k=o===a}else var k=!0;if(k){if(e.protocol!==void 0){let r=e.protocol,o=a,t=a,l=!1,n=a;if(r!=="auto"){let r={params:{allowedValues:E.anyOf[1].properties.protocol.anyOf[0].enum}};s===null?s=[r]:s.push(r),a++}var j=n===a;if(!(l=l||j)){let e=a;if(a===e)if("string"==typeof r){if(i(r)<1){let r={params:{limit:1}};s===null?s=[r]:s.push(r),a++}}else{let r={params:{type:"string"}};s===null?s=[r]:s.push(r),a++}var j=e===a;l=l||j}if(!l){let r={params:{}};s===null?s=[r]:s.push(r),a++}else{a=t;if(s!==null)t?s.length=t:s=null}var k=o===a}else var k=!0;if(k)if(e.username!==void 0){let r=a;if("string"!=typeof e.username){let r={params:{type:"string"}};s===null?s=[r]:s.push(r),a++}var k=r===a}else var k=!0}}}}}}else{let r={params:{type:"object"}};s===null?s=[r]:s.push(r),a++}var O=r===a;l=l||O}if(!l){let r={params:{}};s===null?s=[r]:s.push(r),a++}else{a=t;if(s!==null)t?s.length=t:s=null}var v=o===a}else var v=!0}}}}}}else{let r={params:{type:"object"}};s===null?s=[r]:s.push(r),a++}var n=o===a;t=t||n}if(!t){let r={params:{}};s===null?s=[r]:s.push(r),a++,m.errors=s;return!1}a=o;if(s!==null)o?s.length=o:s=null;return m.errors=s,a===0}function h(r,{instancePath="",parentData,parentDataProperty,rootData=r}={}){let e=null,s=0,a=s,o=!1,t=s;if(s===t)if(Array.isArray(r))if(r.length<1){let r={params:{limit:1}};e===null?e=[r]:e.push(r),s++}else{var i=!0;let a=r.length;for(let o=0;o65535||isNaN(r)){let r={params:{comparison:"<=",limit:65535}};d===null?d=[r]:d.push(r),p++}else if(r<0||isNaN(r)){let r={params:{comparison:">=",limit:0}};d===null?d=[r]:d.push(r),p++}}else{let r={params:{type:"number"}};d===null?d=[r]:d.push(r),p++}var O=t===p;if(!(a=a||O)){let e=p;if(p===e)if("string"==typeof r){if(i(r)<1){let r={params:{limit:1}};d===null?d=[r]:d.push(r),p++}}else{let r={params:{type:"string"}};d===null?d=[r]:d.push(r),p++}var O=e===p;if(!(a=a||O)){let e=p;if(r!=="auto"){let r={params:{allowedValues:o.anyOf[2].enum}};d===null?d=[r]:d.push(r),p++}var O=e===p;a=a||O}}if(!a){let r={params:{}};d===null?d=[r]:d.push(r),p++,L.errors=d;return!1}p=s;if(d!==null)s?d.length=s:d=null;var c=e===p}else var c=!0;if(c){if(l.proxy!==void 0){let r=l.proxy,e=p,s=p;if(p===s)if(Array.isArray(r)){var k=!0;let e=r.length;for(let s=0;s= 0.4" } }, - "node_modules/es-module-lexer": { - "version": "2.3.2", - "devOptional": true, - "license": "MIT" - }, "node_modules/es-object-atoms": { "version": "1.1.2", "license": "MIT", @@ -11652,15 +11646,14 @@ } }, "node_modules/minimizer-webpack-plugin": { - "version": "5.13.0", - "resolved": "https://registry.npmjs.org/minimizer-webpack-plugin/-/minimizer-webpack-plugin-5.13.0.tgz", - "integrity": "sha512-OO1NF2zHj6sf4CNv2AsUWYcS8WEwkVKQDXxxKzlOxx1Xl+WlqYtVC+oNlGNwGkLAOnpj277BSHypWwRtd9w4JQ==", + "version": "5.14.0", + "resolved": "https://registry.npmjs.org/minimizer-webpack-plugin/-/minimizer-webpack-plugin-5.14.0.tgz", + "integrity": "sha512-PnvQXCJxhgH2ZVVO7Lj0sM6q8L1XGxnUvd8wVQIRwi8khMCLq5wg0Ngxe44bcuZL2FSN81RdVE7YHEVzTKsQDQ==", "devOptional": true, "license": "MIT", "dependencies": { - "@jridgewell/trace-mapping": "^0.3.31", "jest-worker": "^27.4.5", - "schema-utils": "^4.3.3", + "schema-utils": "^4.6.0", "terser": "^5.51.0" }, "engines": { @@ -13349,9 +13342,9 @@ "license": "MIT" }, "node_modules/schema-utils": { - "version": "4.8.1", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.8.1.tgz", - "integrity": "sha512-x39pYlJPyH7Uge5QO64B9XGP9zLDc9WNmiQZc+CE3IzZPvMu3lHOuAMGpYNoPixEL7MSWlGhYTg5UlLSL8G6iw==", + "version": "4.8.5", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.8.5.tgz", + "integrity": "sha512-K1RRP7aTUAY2lGXNzPwjMK6AMMzbETdpF3pTPMEnH/RrpmPx6K1X47/gSebrV+1I9pRcgpwZwqpYBlyZAsliiw==", "license": "MIT", "dependencies": { "@types/json-schema": "^7.0.15", @@ -13370,7 +13363,7 @@ "url": "https://opencollective.com/webpack" }, "peerDependencies": { - "webpack": "^5.112.0" + "webpack": "^5.0.0" }, "peerDependenciesMeta": { "webpack": { @@ -14241,7 +14234,9 @@ } }, "node_modules/tapable": { - "version": "2.3.3", + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.3.4.tgz", + "integrity": "sha512-NHFiWnAbMJxNNpBwiO7jJVGDuqMxT9/oV8v57RR+fgBQShkJil5inGD8/xWy0hjLyHQyX1tu27QANhlz3KBqCg==", "devOptional": true, "license": "MIT", "engines": { @@ -14891,9 +14886,9 @@ "license": "MIT" }, "node_modules/watchpack": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.6.3.tgz", - "integrity": "sha512-s3NZy0QpTY9qGqzc0wtz4qI28z3+5qKbbAec4MV4G9N3CfgZ9wgvQRr0cl2jh/tqkWG1NWHkmVMHZpCamev5Wg==", + "version": "2.6.4", + "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.6.4.tgz", + "integrity": "sha512-5H3Tce2GfzWbcr9VnSqyak2whFaONw4BdmI5BDnMXold4qSlCFd64XaMQESRh2vkDKmdUkv6rUo17UvZ9f9nXw==", "devOptional": true, "license": "MIT", "dependencies": { @@ -14921,9 +14916,9 @@ } }, "node_modules/webpack": { - "version": "5.112.2", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.112.2.tgz", - "integrity": "sha512-B2tp1LI9D8GVpPDqprdt12ukTkXXahj9MzqSWJq4faSPgOUM7CdZaGAB6HrL/8E6UwbBpdj4vzWDbKoFnVoU6g==", + "version": "5.113.0", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.113.0.tgz", + "integrity": "sha512-q54iF0LNaAAdLEt3al9qMXC2zARvcx7LVKjHp+ExjCRkGx0M8TmawGHAXykXwofWzxhNzPTAh3kLVXvNg0El4A==", "devOptional": true, "license": "MIT", "dependencies": { @@ -14934,16 +14929,15 @@ "@webassemblyjs/wasm-parser": "^1.14.1", "browserslist": "^4.28.1", "chrome-trace-event": "^1.0.2", - "enhanced-resolve": "^5.26.0", - "es-module-lexer": "^2.1.0", + "enhanced-resolve": "^5.27.0", "events": "^3.2.0", "graceful-fs": "^4.2.11", "mime-db": "^1.54.0", - "minimizer-webpack-plugin": "^5.13.0", - "schema-utils": "^4.8.1", - "tapable": "^2.3.0", - "watchpack": "^2.6.3", - "webpack-sources": "^3.6.0" + "minimizer-webpack-plugin": "^5.14.0", + "schema-utils": "^4.8.2", + "tapable": "^2.3.4", + "watchpack": "^2.6.4", + "webpack-sources": "^3.7.1" }, "bin": { "webpack": "bin/webpack.js" @@ -15055,9 +15049,9 @@ } }, "node_modules/webpack-sources": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.6.0.tgz", - "integrity": "sha512-EIMmPVvNI0CYXyRPp34F2Qk7W37/BZVZIofS6LAUnrNjCVahS+hO4mxwFJDjQjODTGZDtVzLYoN2+1dYkhk9qA==", + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.7.1.tgz", + "integrity": "sha512-mcxs7A2LsEdwsNqQburqS4QHPR2Ca3NGplUakn6J5GPQvnVZ4oD4IM4FJcT3f8AVN2e2EsjuIVxKj4rorHvyuQ==", "devOptional": true, "license": "MIT", "engines": { diff --git a/package.json b/package.json index 05629db7ea..c078506610 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "lint": "npm-run-all -l -p \"lint:**\"", "fix:code": "npm run lint:code -- --fix", "fix:prettier": "npm run lint:prettier -- --write", - "fix": "npm-run-all -l fix:code fix:schema-check fix:prettier", + "fix": "npm-run-all -l fix:schema fix:code fix:prettier", "validate:changeset": "node .changeset/changeset-validate.mjs", "build:cjs": "rimraf -g ./dist/* && babel lib --out-dir dist --env-name cjs --copy-files --no-copy-ignored && node ./scripts/finalize-cjs-build.mjs", "build:client": "node ./scripts/build-client.mjs", @@ -60,8 +60,8 @@ "test": "npm run test:coverage", "pretest": "npm run lint", "prepare": "husky && npm run build", - "lint:schema-check": "node ./scripts/generate-schema-check.mjs --check", - "fix:schema-check": "node ./scripts/generate-schema-check.mjs" + "lint:schema": "schema-utils precompile --check --minify lib/options.json", + "fix:schema": "schema-utils precompile --minify lib/options.json" }, "dependencies": { "@types/bonjour": "^3.5.13", @@ -82,7 +82,7 @@ "launch-editor": "^2.14.1", "open": "^11.0.0", "p-retry": "^8.0.0", - "schema-utils": "^4.3.3", + "schema-utils": "^4.8.5", "selfsigned": "^5.5.0", "serve-index": "^1.9.2", "tinyglobby": "^0.2.15", @@ -103,7 +103,6 @@ "@types/picomatch": "^4.0.2", "@types/trusted-types": "^2.0.7", "acorn": "^8.14.0", - "ajv": "^8.20.0", "babel-loader": "^10.0.0", "babel-plugin-transform-import-meta": "^3.0.0", "connect": "^3.7.0", @@ -142,7 +141,7 @@ "tcp-port-used": "^1.0.2", "typescript": "^5.7.2", "wait-for-expect": "^4.0.0", - "webpack": "^5.108.0", + "webpack": "^5.113.0", "webpack-cli": "^7.2.1", "webpack-merge": "^6.0.1" }, diff --git a/scripts/generate-schema-check.mjs b/scripts/generate-schema-check.mjs deleted file mode 100644 index 9c91167726..0000000000 --- a/scripts/generate-schema-check.mjs +++ /dev/null @@ -1,170 +0,0 @@ -import { readFile, writeFile } from "node:fs/promises"; -import path from "node:path"; -import { fileURLToPath } from "node:url"; -import Ajv, { _ } from "ajv"; -import standaloneCode from "ajv/dist/standalone/index.js"; - -// Precompile `lib/options.json` into a standalone validator, `lib/options.check.js`. -// -// `schema-utils`'s `validate()` compiles the schema with ajv on its first call, -// which cost ~120ms of every `new Server()` — a one-time startup price paid by -// every user on every run. The generated validator answers the same question -// with no compile step, so the happy path never loads ajv at all; `Server` only -// falls back to `schema-utils` when this validator rejects, to build the -// readable error message (the same trick webpack uses for its own schema). -// -// Run `npm run fix:schema-check` to regenerate, `npm run lint:schema-check` to -// verify the committed output is current. - -const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), ".."); -const SCHEMA_PATH = path.join(ROOT, "lib", "options.json"); -const OUTPUT_PATH = path.join(ROOT, "lib", "options.check.js"); - -const BANNER = `// This file was automatically generated. -// DO NOT MODIFY BY HAND. Run \`npm run fix:schema-check\` to update. -/* eslint-disable */ -// @ts-nocheck -`; - -/** - * The constructors `"instanceof"` may name. ajv-keywords implements the keyword - * with a closure, which cannot be serialized into standalone code, so the - * keyword is re-implemented here as something ajv can emit inline. - */ -const CONSTRUCTORS = { - Buffer: _`Buffer`, - Function: _`Function`, -}; - -/** @typedef {Record} SchemaNode */ - -/** - * Walk every schema node, depth first. - * @param {unknown} node current node - * @param {(node: SchemaNode, pointer: string) => void} visit called for each object node - * @param {string} pointer JSON pointer to `node` - * @returns {void} - */ -function walkSchema(node, visit, pointer = "#") { - if (!node || typeof node !== "object") { - return; - } - - if (!Array.isArray(node)) { - visit(/** @type {SchemaNode} */ (node), pointer); - } - - for (const [key, value] of Object.entries(node)) { - walkSchema(value, visit, `${pointer}/${key}`); - } -} - -/** - * Reject schema constructs the generated validator would silently mistranslate. - * @param {SchemaNode} schema the options schema - * @returns {void} - */ -function assertSupportedSchema(schema) { - /** - * @param {SchemaNode} node the schema node to check - * @param {string} pointer JSON pointer to `node` - * @returns {void} - */ - const assertNode = (node, pointer) => { - // `unicode: false` below makes ajv measure string length in UTF-16 code - // units rather than code points. The two agree only at a bound of 1, where - // both mean "not empty". - if (node.minLength !== undefined && node.minLength !== 1) { - throw new Error( - `"minLength" must be 1, but is ${node.minLength} at ${pointer}.`, - ); - } - - if (node.maxLength !== undefined) { - throw new Error(`"maxLength" is not supported, found at ${pointer}.`); - } - - if ( - typeof node.instanceof === "string" && - !Object.hasOwn(CONSTRUCTORS, node.instanceof) - ) { - throw new Error( - `"instanceof": ${JSON.stringify(node.instanceof)} at ${pointer} is not supported. Add it to CONSTRUCTORS.`, - ); - } - }; - - walkSchema(schema, assertNode); -} - -/** - * @param {SchemaNode} schema the options schema - * @returns {string} source of the standalone validator - */ -function generate(schema) { - assertSupportedSchema(schema); - - const ajv = new Ajv({ - /* eslint-disable no-console -- a generator reports to the terminal */ - logger: { - log: console.log, - /** - * `unicode` is deprecated but still honoured, and `assertSupportedSchema` - * has already established that dropping it changes nothing here. - * @param {...unknown} args ajv's warning arguments - * @returns {void} - */ - warn: (...args) => { - if (!String(args[0]).includes("option unicode")) { - console.warn(...args); - } - }, - error: console.error, - }, - /* eslint-enable no-console */ - strict: false, - // The validator only reports whether the options are valid; `schema-utils` - // produces the messages, so collecting every error here would be wasted work. - allErrors: false, - verbose: false, - unicode: false, - code: { source: true, esm: true }, - }); - - ajv.addKeyword({ - keyword: "instanceof", - schemaType: "string", - /** - * @param {import("ajv").KeywordCxt} cxt keyword context - * @returns {void} - */ - code(cxt) { - cxt.fail( - _`!(${cxt.data} instanceof ${CONSTRUCTORS[/** @type {keyof typeof CONSTRUCTORS} */ (cxt.schema)]})`, - ); - }, - }); - - // Documentation-only keywords carried by the schema for the CLI and the docs. - for (const keyword of ["cli", "link"]) { - ajv.addKeyword({ keyword, schemaType: ["string", "object", "boolean"] }); - } - - return BANNER + standaloneCode.default(ajv, ajv.compile(schema)); -} - -const source = generate(JSON.parse(await readFile(SCHEMA_PATH, "utf8"))); - -if (process.argv.includes("--check")) { - const current = await readFile(OUTPUT_PATH, "utf8").catch(() => undefined); - - if (current !== source) { - // eslint-disable-next-line no-console - console.error( - `${path.relative(ROOT, OUTPUT_PATH)} is out of date — run \`npm run fix:schema-check\`.`, - ); - process.exitCode = 1; - } -} else { - await writeFile(OUTPUT_PATH, source); -} diff --git a/types/lib/options.check.d.ts b/types/lib/options.check.d.ts index 8e576f971f..9c75748ad5 100644 --- a/types/lib/options.check.d.ts +++ b/types/lib/options.check.d.ts @@ -1,7 +1,7 @@ export function validate( - data: any, + l: any, { - instancePath, + instancePath: v, parentData, parentDataProperty, rootData, @@ -9,12 +9,12 @@ export function validate( instancePath?: string | undefined; rootData?: any; }, -): boolean; -export default validate10; -declare function validate10( - data: any, +): any; +export default L; +declare function L( + l: any, { - instancePath, + instancePath: v, parentData, parentDataProperty, rootData, @@ -22,4 +22,4 @@ declare function validate10( instancePath?: string | undefined; rootData?: any; }, -): boolean; +): any;