webpack-dev-server 4.8.1 → 4.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -80,137 +80,127 @@ Usage: webpack serve|server|s [entries...] [options]
80
80
  Run the webpack dev server.
81
81
 
82
82
  Options:
83
- -c, --config <value...> Provide path to a webpack configuration file e.g. ./webpack.config.js.
84
- --config-name <value...> Name of the configuration to use.
85
- -m, --merge Merge two or more configurations using 'webpack-merge'.
86
- --env <value...> Environment passed to the configuration when it is a function.
87
- --node-env <value> Sets process.env.NODE_ENV to the specified value.
88
- --progress [value] Print compilation progress during build.
89
- -j, --json [value] Prints result as JSON or store it in a file.
90
- --entry <value...> The entry point(s) of your application e.g. ./src/main.js.
91
- -o, --output-path <value> Output location of the file generated by webpack e.g. ./dist/.
92
- -t, --target <value> Sets the build target e.g. node.
93
- -d, --devtool <value> Determine source maps to use.
94
- --no-devtool Do not generate source maps.
95
- --mode <value> Defines the mode to pass to webpack.
96
- --name <value> Name of the configuration. Used when loading multiple configurations.
97
- --stats [value] It instructs webpack on how to treat the stats e.g. verbose.
98
- --no-stats Disable stats output.
99
- --watch-options-stdin Stop watching when stdin stream has ended.
100
- --no-watch-options-stdin Do not stop watching when stdin stream has ended.
101
- --allowed-hosts <value...> 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').
102
- --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
103
- you are proxying dev server, by default is 'auto').
104
- --bonjour Allows to broadcasts dev server via ZeroConf networking on start.
105
- --no-bonjour Disallows to broadcasts dev server via ZeroConf networking on start.
106
- --no-client Disables client script.
107
- --client-logging <value> Allows to set log level in the browser.
108
- --client-overlay Enables a full-screen overlay in the browser when there are compiler errors or warnings.
109
- --no-client-overlay Disables the full-screen overlay in the browser when there are compiler errors or warnings.
110
- --client-overlay-errors Enables a full-screen overlay in the browser when there are compiler errors.
111
- --no-client-overlay-errors Disables the full-screen overlay in the browser when there are compiler errors.
112
- --client-overlay-warnings Enables a full-screen overlay in the browser when there are compiler warnings.
113
- --no-client-overlay-warnings Disables the full-screen overlay in the browser when there are compiler warnings.
114
- --client-progress Prints compilation progress in percentage in the browser.
115
- --no-client-progress Does not print compilation progress in percentage in the browser.
116
- --client-reconnect [value] Tells dev-server the number of times it should try to reconnect the client.
117
- --no-client-reconnect Tells dev-server to not to try to reconnect the client.
118
- --client-web-socket-transport <value> Allows to set custom web socket transport to communicate with dev server.
119
- --client-web-socket-url <value> 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).
120
- --client-web-socket-url-hostname <value> Tells clients connected to devServer to use the provided hostname.
121
- --client-web-socket-url-password <value> Tells clients connected to devServer to use the provided password to authenticate.
122
- --client-web-socket-url-pathname <value> Tells clients connected to devServer to use the provided path to connect.
123
- --client-web-socket-url-port <value> Tells clients connected to devServer to use the provided port.
124
- --client-web-socket-url-protocol <value> Tells clients connected to devServer to use the provided protocol.
125
- --client-web-socket-url-username <value> Tells clients connected to devServer to use the provided username to authenticate.
126
- --compress Enables gzip compression for everything served.
127
- --no-compress Disables gzip compression for everything served.
128
- --history-api-fallback Allows to proxy requests through a specified index page (by default 'index.html'), useful for Single Page Applications that utilise the HTML5
129
- History API.
130
- --no-history-api-fallback Disallows to proxy requests through a specified index page.
131
- --host <value> Allows to specify a hostname to use.
132
- --hot [value] Enables Hot Module Replacement.
133
- --no-hot Disables Hot Module Replacement.
134
- --http2 Allows to serve over HTTP/2 using SPDY. Deprecated, use the `server` option.
135
- --no-http2 Does not serve over HTTP/2 using SPDY.
136
- --https Allows to configure the server's listening socket for TLS (by default, dev server will be served over HTTP). Deprecated, use the `server` option.
137
- --no-https Disallows to configure the server's listening socket for TLS (by default, dev server will be served over HTTP).
138
- --https-ca <value...> Path to an SSL CA certificate or content of an SSL CA certificate. Deprecated, use the `server.options.ca` option.
139
- --https-ca-reset Clear all items provided in 'https.ca' configuration. Path to an SSL CA certificate or content of an SSL CA certificate. Deprecated, use the
140
- `server.options.ca` option.
141
- --https-cacert <value...> Path to an SSL CA certificate or content of an SSL CA certificate. Deprecated, use the `server.options.ca` option.
142
- --https-cacert-reset Clear all items provided in 'https.cacert' configuration. Path to an SSL CA certificate or content of an SSL CA certificate. Deprecated, use the
143
- `server.options.ca` option.
144
- --https-cert <value...> Path to an SSL certificate or content of an SSL certificate. Deprecated, use the `server.options.cert` option.
145
- --https-cert-reset Clear all items provided in 'https.cert' configuration. Path to an SSL certificate or content of an SSL certificate. Deprecated, use the
146
- `server.options.cert` option.
147
- --https-crl <value...> Path to PEM formatted CRLs (Certificate Revocation Lists) or content of PEM formatted CRLs (Certificate Revocation Lists). Deprecated, use the
148
- `server.options.crl` option.
149
- --https-crl-reset Clear all items provided in 'https.crl' configuration. Path to PEM formatted CRLs (Certificate Revocation Lists) or content of PEM formatted CRLs
150
- (Certificate Revocation Lists). Deprecated, use the `server.options.crl` option.
151
- --https-key <value...> Path to an SSL key or content of an SSL key. Deprecated, use the `server.options.key` option.
152
- --https-key-reset Clear all items provided in 'https.key' configuration. Path to an SSL key or content of an SSL key. Deprecated, use the `server.options.key` option.
153
- --https-passphrase <value> Passphrase for a pfx file. Deprecated, use the `server.options.passphrase` option.
154
- --https-pfx <value...> Path to an SSL pfx file or content of an SSL pfx file. Deprecated, use the `server.options.pfx` option.
155
- --https-pfx-reset Clear all items provided in 'https.pfx' configuration. Path to an SSL pfx file or content of an SSL pfx file. Deprecated, use the
156
- `server.options.pfx` option.
157
- --https-request-cert Request for an SSL certificate. Deprecated, use the `server.options.requestCert` option.
158
- --no-https-request-cert Does not request for an SSL certificate.
159
- --ipc [value] Listen to a unix socket.
160
- --live-reload Enables reload/refresh the page(s) when file changes are detected (enabled by default).
161
- --no-live-reload Disables reload/refresh the page(s) when file changes are detected (enabled by default)
162
- --magic-html Tells dev-server whether to enable magic HTML routes (routes corresponding to your webpack output, for example '/main' for 'main.js').
163
- --no-magic-html Disables magic HTML routes (routes corresponding to your webpack output, for example '/main' for 'main.js').
164
- --open [value...] 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).
165
- --no-open Does not open the default browser.
166
- --open-app <value...> Open specified browser. Deprecated: please use '--open-app-name'.
167
- --open-app-name <value...> Open specified browser.
168
- --open-app-name-reset Clear all items provided in 'open.app.name' configuration. Open specified browser.
169
- --open-reset Clear all items provided in 'open' configuration. Allows to configure dev server to open the browser(s) and page(s) after server had been started
170
- (set it to true to open your default browser).
171
- --open-target <value...> Opens specified page in browser.
172
- --open-target-reset Clear all items provided in 'open.target' configuration. Opens specified page in browser.
173
- --port <value> Allows to specify a port to use.
174
- --server-options-ca <value...> Path to an SSL CA certificate or content of an SSL CA certificate.
175
- --server-options-ca-reset Clear all items provided in 'server.options.ca' configuration. Path to an SSL CA certificate or content of an SSL CA certificate.
176
- --server-options-cacert <value...> Path to an SSL CA certificate or content of an SSL CA certificate. Deprecated, use the `server.options.ca` option.
177
- --server-options-cacert-reset Clear all items provided in 'server.options.cacert' configuration. Path to an SSL CA certificate or content of an SSL CA certificate. Deprecated,
178
- use the `server.options.ca` option.
179
- --server-options-cert <value...> Path to an SSL certificate or content of an SSL certificate.
180
- --server-options-cert-reset Clear all items provided in 'server.options.cert' configuration. Path to an SSL certificate or content of an SSL certificate.
181
- --server-options-crl <value...> Path to PEM formatted CRLs (Certificate Revocation Lists) or content of PEM formatted CRLs (Certificate Revocation Lists).
182
- --server-options-crl-reset Clear all items provided in 'server.options.crl' configuration. Path to PEM formatted CRLs (Certificate Revocation Lists) or content of PEM
183
- formatted CRLs (Certificate Revocation Lists).
184
- --server-options-key <value...> Path to an SSL key or content of an SSL key.
185
- --server-options-key-reset Clear all items provided in 'server.options.key' configuration. Path to an SSL key or content of an SSL key.
186
- --server-options-passphrase <value> Passphrase for a pfx file.
187
- --server-options-pfx <value...> Path to an SSL pfx file or content of an SSL pfx file.
188
- --server-options-pfx-reset Clear all items provided in 'server.options.pfx' configuration. Path to an SSL pfx file or content of an SSL pfx file.
189
- --server-options-request-cert Request for an SSL certificate.
190
- --no-server-options-request-cert Negative 'server-options-request-cert' option.
191
- --server-type <value> Allows to set server and options (by default 'http').
192
- --static [value...] Allows to configure options for serving static files from directory (by default 'public' directory).
193
- --no-static Negative 'static' option.
194
- --static-directory <value...> Directory for static contents.
195
- --static-public-path <value...> The static files will be available in the browser under this public path.
196
- --static-public-path-reset Clear all items provided in 'static.publicPath' configuration. The static files will be available in the browser under this public path.
197
- --static-reset Clear all items provided in 'static' configuration. Allows to configure options for serving static files from directory (by default 'public'
198
- directory).
199
- --static-serve-index Tells dev server to use serveIndex middleware when enabled.
200
- --no-static-serve-index Does not tell dev server to use serveIndex middleware.
201
- --static-watch Watches for files in static content directory.
202
- --no-static-watch Does not watch for files in static content directory.
203
- --watch-files <value...> Allows to configure list of globs/directories/files to watch for file changes.
204
- --watch-files-reset Clear all items provided in 'watchFiles' configuration. Allows to configure list of globs/directories/files to watch for file changes.
205
- --web-socket-server <value> Deprecated: please use '--web-socket-server-type' option. Allows to set web socket server and options (by default 'ws').
206
- --no-web-socket-server Negative 'web-socket-server' option.
207
- --web-socket-server-type <value> Allows to set web socket server and options (by default 'ws').
83
+ -c, --config <value...> Provide path to a webpack configuration file e.g. ./webpack.config.js.
84
+ --config-name <value...> Name of the configuration to use.
85
+ -m, --merge Merge two or more configurations using 'webpack-merge'.
86
+ --env <value...> Environment passed to the configuration when it is a function.
87
+ --node-env <value> Sets process.env.NODE_ENV to the specified value.
88
+ --progress [value] Print compilation progress during build.
89
+ -j, --json [value] Prints result as JSON or store it in a file.
90
+ -d, --devtool <value> Determine source maps to use.
91
+ --no-devtool Do not generate source maps.
92
+ --entry <value...> The entry point(s) of your application e.g. ./src/main.js.
93
+ --mode <value> Defines the mode to pass to webpack.
94
+ --name <value> Name of the configuration. Used when loading multiple configurations.
95
+ -o, --output-path <value> Output location of the file generated by webpack e.g. ./dist/.
96
+ --stats [value] It instructs webpack on how to treat the stats e.g. verbose.
97
+ --no-stats Disable stats output.
98
+ -t, --target <value...> Sets the build target e.g. node.
99
+ --no-target Negative 'target' option.
100
+ --watch-options-stdin Stop watching when stdin stream has ended.
101
+ --no-watch-options-stdin Do not stop watching when stdin stream has ended.
102
+ --allowed-hosts <value...> 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').
103
+ --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').
104
+ --bonjour Allows to broadcasts dev server via ZeroConf networking on start.
105
+ --no-bonjour Disallows to broadcasts dev server via ZeroConf networking on start.
106
+ --no-client Disables client script.
107
+ --client-logging <value> Allows to set log level in the browser.
108
+ --client-overlay Enables a full-screen overlay in the browser when there are compiler errors or warnings.
109
+ --no-client-overlay Disables the full-screen overlay in the browser when there are compiler errors or warnings.
110
+ --client-overlay-errors Enables a full-screen overlay in the browser when there are compiler errors.
111
+ --no-client-overlay-errors Disables the full-screen overlay in the browser when there are compiler errors.
112
+ --client-overlay-warnings Enables a full-screen overlay in the browser when there are compiler warnings.
113
+ --no-client-overlay-warnings Disables the full-screen overlay in the browser when there are compiler warnings.
114
+ --client-overlay-trusted-types-policy-name <value> The name of a Trusted Types policy for the overlay. Defaults to 'webpack-dev-server#overlay'.
115
+ --client-progress Prints compilation progress in percentage in the browser.
116
+ --no-client-progress Does not print compilation progress in percentage in the browser.
117
+ --client-reconnect [value] Tells dev-server the number of times it should try to reconnect the client.
118
+ --no-client-reconnect Tells dev-server to not to try to reconnect the client.
119
+ --client-web-socket-transport <value> Allows to set custom web socket transport to communicate with dev server.
120
+ --client-web-socket-url <value> 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).
121
+ --client-web-socket-url-hostname <value> Tells clients connected to devServer to use the provided hostname.
122
+ --client-web-socket-url-pathname <value> Tells clients connected to devServer to use the provided path to connect.
123
+ --client-web-socket-url-password <value> Tells clients connected to devServer to use the provided password to authenticate.
124
+ --client-web-socket-url-port <value> Tells clients connected to devServer to use the provided port.
125
+ --client-web-socket-url-protocol <value> Tells clients connected to devServer to use the provided protocol.
126
+ --client-web-socket-url-username <value> Tells clients connected to devServer to use the provided username to authenticate.
127
+ --compress Enables gzip compression for everything served.
128
+ --no-compress Disables gzip compression for everything served.
129
+ --history-api-fallback Allows to proxy requests through a specified index page (by default 'index.html'), useful for Single Page Applications that utilise the HTML5 History API.
130
+ --no-history-api-fallback Disallows to proxy requests through a specified index page.
131
+ --host <value> Allows to specify a hostname to use.
132
+ --hot [value] Enables Hot Module Replacement.
133
+ --no-hot Disables Hot Module Replacement.
134
+ --http2 Allows to serve over HTTP/2 using SPDY. Deprecated, use the `server` option.
135
+ --no-http2 Does not serve over HTTP/2 using SPDY.
136
+ --https Allows to configure the server's listening socket for TLS (by default, dev server will be served over HTTP). Deprecated, use the `server` option.
137
+ --no-https Disallows to configure the server's listening socket for TLS (by default, dev server will be served over HTTP).
138
+ --https-passphrase <value> Passphrase for a pfx file. Deprecated, use the `server.options.passphrase` option.
139
+ --https-request-cert Request for an SSL certificate. Deprecated, use the `server.options.requestCert` option.
140
+ --no-https-request-cert Does not request for an SSL certificate.
141
+ --https-ca <value...> Path to an SSL CA certificate or content of an SSL CA certificate. Deprecated, use the `server.options.ca` option.
142
+ --https-ca-reset Clear all items provided in 'https.ca' configuration. Path to an SSL CA certificate or content of an SSL CA certificate. Deprecated, use the `server.options.ca` option.
143
+ --https-cacert <value...> Path to an SSL CA certificate or content of an SSL CA certificate. Deprecated, use the `server.options.ca` option.
144
+ --https-cacert-reset Clear all items provided in 'https.cacert' configuration. Path to an SSL CA certificate or content of an SSL CA certificate. Deprecated, use the `server.options.ca` option.
145
+ --https-cert <value...> Path to an SSL certificate or content of an SSL certificate. Deprecated, use the `server.options.cert` option.
146
+ --https-cert-reset Clear all items provided in 'https.cert' configuration. Path to an SSL certificate or content of an SSL certificate. Deprecated, use the `server.options.cert` option.
147
+ --https-crl <value...> Path to PEM formatted CRLs (Certificate Revocation Lists) or content of PEM formatted CRLs (Certificate Revocation Lists). Deprecated, use the `server.options.crl` option.
148
+ --https-crl-reset Clear all items provided in 'https.crl' configuration. Path to PEM formatted CRLs (Certificate Revocation Lists) or content of PEM formatted CRLs (Certificate Revocation Lists). Deprecated, use the `server.options.crl` option.
149
+ --https-key <value...> Path to an SSL key or content of an SSL key. Deprecated, use the `server.options.key` option.
150
+ --https-key-reset Clear all items provided in 'https.key' configuration. Path to an SSL key or content of an SSL key. Deprecated, use the `server.options.key` option.
151
+ --https-pfx <value...> Path to an SSL pfx file or content of an SSL pfx file. Deprecated, use the `server.options.pfx` option.
152
+ --https-pfx-reset Clear all items provided in 'https.pfx' configuration. Path to an SSL pfx file or content of an SSL pfx file. Deprecated, use the `server.options.pfx` option.
153
+ --ipc [value] Listen to a unix socket.
154
+ --live-reload Enables reload/refresh the page(s) when file changes are detected (enabled by default).
155
+ --no-live-reload Disables reload/refresh the page(s) when file changes are detected (enabled by default).
156
+ --magic-html Tells dev-server whether to enable magic HTML routes (routes corresponding to your webpack output, for example '/main' for 'main.js').
157
+ --no-magic-html Disables magic HTML routes (routes corresponding to your webpack output, for example '/main' for 'main.js').
158
+ --open [value...] 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).
159
+ --no-open Does not open the default browser.
160
+ --open-target <value...> Opens specified page in browser.
161
+ --open-app-name <value...> Open specified browser.
162
+ --open-app <value...> Open specified browser. Deprecated: please use '--open-app-name'.
163
+ --open-reset Clear all items provided in 'open' configuration. 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).
164
+ --open-target-reset Clear all items provided in 'open.target' configuration. Opens specified page in browser.
165
+ --open-app-name-reset Clear all items provided in 'open.app.name' configuration. Open specified browser.
166
+ --port <value> Allows to specify a port to use.
167
+ --server-type <value> Allows to set server and options (by default 'http').
168
+ --server-options-passphrase <value> Passphrase for a pfx file.
169
+ --server-options-request-cert Request for an SSL certificate.
170
+ --no-server-options-request-cert Does not request for an SSL certificate.
171
+ --server-options-ca <value...> Path to an SSL CA certificate or content of an SSL CA certificate.
172
+ --server-options-ca-reset Clear all items provided in 'server.options.ca' configuration. Path to an SSL CA certificate or content of an SSL CA certificate.
173
+ --server-options-cacert <value...> Path to an SSL CA certificate or content of an SSL CA certificate. Deprecated, use the `server.options.ca` option.
174
+ --server-options-cacert-reset Clear all items provided in 'server.options.cacert' configuration. Path to an SSL CA certificate or content of an SSL CA certificate. Deprecated, use the `server.options.ca` option.
175
+ --server-options-cert <value...> Path to an SSL certificate or content of an SSL certificate.
176
+ --server-options-cert-reset Clear all items provided in 'server.options.cert' configuration. Path to an SSL certificate or content of an SSL certificate.
177
+ --server-options-crl <value...> Path to PEM formatted CRLs (Certificate Revocation Lists) or content of PEM formatted CRLs (Certificate Revocation Lists).
178
+ --server-options-crl-reset Clear all items provided in 'server.options.crl' configuration. Path to PEM formatted CRLs (Certificate Revocation Lists) or content of PEM formatted CRLs (Certificate Revocation Lists).
179
+ --server-options-key <value...> Path to an SSL key or content of an SSL key.
180
+ --server-options-key-reset Clear all items provided in 'server.options.key' configuration. Path to an SSL key or content of an SSL key.
181
+ --server-options-pfx <value...> Path to an SSL pfx file or content of an SSL pfx file.
182
+ --server-options-pfx-reset Clear all items provided in 'server.options.pfx' configuration. Path to an SSL pfx file or content of an SSL pfx file.
183
+ --static [value...] Allows to configure options for serving static files from directory (by default 'public' directory).
184
+ --no-static Disallows to configure options for serving static files from directory.
185
+ --static-directory <value...> Directory for static contents.
186
+ --static-public-path <value...> The static files will be available in the browser under this public path.
187
+ --static-serve-index Tells dev server to use serveIndex middleware when enabled.
188
+ --no-static-serve-index Does not tell dev server to use serveIndex middleware.
189
+ --static-watch Watches for files in static content directory.
190
+ --no-static-watch Does not watch for files in static content directory.
191
+ --static-reset Clear all items provided in 'static' configuration. Allows to configure options for serving static files from directory (by default 'public' directory).
192
+ --static-public-path-reset Clear all items provided in 'static.publicPath' configuration. The static files will be available in the browser under this public path.
193
+ --watch-files <value...> Allows to configure list of globs/directories/files to watch for file changes.
194
+ --watch-files-reset Clear all items provided in 'watchFiles' configuration. Allows to configure list of globs/directories/files to watch for file changes.
195
+ --web-socket-server <value> Deprecated: please use '--web-socket-server-type' option. Allows to set web socket server and options (by default 'ws').
196
+ --no-web-socket-server Disallows to set web socket server and options.
197
+ --web-socket-server-type <value> Allows to set web socket server and options (by default 'ws').
208
198
 
209
199
  Global options:
210
- --color Enable colors on console.
211
- --no-color Disable colors on console.
212
- -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands.
213
- -h, --help [verbose] Display help for commands and options.
200
+ --color Enable colors on console.
201
+ --no-color Disable colors on console.
202
+ -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands.
203
+ -h, --help [verbose] Display help for commands and options.
214
204
 
215
205
  To see list of all supported commands and options run 'webpack --help=verbose'.
216
206
 
@@ -241,7 +231,7 @@ And run the following in your terminal/console:
241
231
  npm run serve
242
232
  ```
243
233
 
244
- NPM will automagically reference the binary in `node_modules` for you, and
234
+ NPM will automatically refer to the the binary in `node_modules` for you, and
245
235
  execute the file or command.
246
236
 
247
237
  ### With the API
package/bin/cli-flags.js CHANGED
@@ -121,6 +121,21 @@ module.exports = {
121
121
  simpleType: "boolean",
122
122
  multiple: false,
123
123
  },
124
+ "client-overlay-trusted-types-policy-name": {
125
+ configs: [
126
+ {
127
+ description:
128
+ "The name of a Trusted Types policy for the overlay. Defaults to 'webpack-dev-server#overlay'.",
129
+ multiple: false,
130
+ path: "client.overlay.trustedTypesPolicyName",
131
+ type: "string",
132
+ },
133
+ ],
134
+ description:
135
+ "The name of a Trusted Types policy for the overlay. Defaults to 'webpack-dev-server#overlay'.",
136
+ multiple: false,
137
+ simpleType: "string",
138
+ },
124
139
  "client-overlay-warnings": {
125
140
  configs: [
126
141
  {
package/client/index.js CHANGED
@@ -14,7 +14,7 @@ import createSocketURL from "./utils/createSocketURL.js";
14
14
  * @property {boolean} hot
15
15
  * @property {boolean} liveReload
16
16
  * @property {boolean} progress
17
- * @property {boolean | { warnings?: boolean, errors?: boolean }} overlay
17
+ * @property {boolean | { warnings?: boolean, errors?: boolean, trustedTypesPolicyName?: string }} overlay
18
18
  * @property {string} [logging]
19
19
  * @property {number} [reconnect]
20
20
  */
@@ -216,7 +216,8 @@ var onSocketMessage = {
216
216
  var needShowOverlayForWarnings = typeof options.overlay === "boolean" ? options.overlay : options.overlay && options.overlay.warnings;
217
217
 
218
218
  if (needShowOverlayForWarnings) {
219
- show("warning", _warnings);
219
+ var trustedTypesPolicyName = typeof options.overlay === "object" && options.overlay.trustedTypesPolicyName;
220
+ show("warning", _warnings, trustedTypesPolicyName || null);
220
221
  }
221
222
 
222
223
  if (params && params.preventReloading) {
@@ -249,7 +250,8 @@ var onSocketMessage = {
249
250
  var needShowOverlayForErrors = typeof options.overlay === "boolean" ? options.overlay : options.overlay && options.overlay.errors;
250
251
 
251
252
  if (needShowOverlayForErrors) {
252
- show("error", _errors);
253
+ var trustedTypesPolicyName = typeof options.overlay === "object" && options.overlay.trustedTypesPolicyName;
254
+ show("error", _errors, trustedTypesPolicyName || null);
253
255
  }
254
256
  },
255
257
 
@@ -688,7 +688,7 @@ module.exports = function (_ref) {
688
688
 
689
689
 
690
690
  function _extends() {
691
- _extends = Object.assign || function (target) {
691
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
692
692
  for (var i = 1; i < arguments.length; i++) {
693
693
  var source = arguments[i];
694
694
 
@@ -701,7 +701,6 @@ function _extends() {
701
701
 
702
702
  return target;
703
703
  };
704
-
705
704
  return _extends.apply(this, arguments);
706
705
  }
707
706
 
@@ -4566,7 +4566,7 @@ module.exports = {
4566
4566
  \***************************************************/
4567
4567
  /***/ (function(module) {
4568
4568
 
4569
- module.exports = '1.6.0';
4569
+ module.exports = '1.6.1';
4570
4570
 
4571
4571
  /***/ }),
4572
4572
 
package/client/overlay.js CHANGED
@@ -23,9 +23,24 @@ var containerElement;
23
23
  /** @type {Array<(element: HTMLDivElement) => void>} */
24
24
 
25
25
  var onLoadQueue = [];
26
+ /** @type {TrustedTypePolicy | undefined} */
27
+
28
+ var overlayTrustedTypesPolicy;
26
29
  ansiHTML.setColors(colors);
30
+ /**
31
+ * @param {string | null} trustedTypesPolicyName
32
+ */
33
+
34
+ function createContainer(trustedTypesPolicyName) {
35
+ // Enable Trusted Types if they are available in the current browser.
36
+ if (window.trustedTypes) {
37
+ overlayTrustedTypesPolicy = window.trustedTypes.createPolicy(trustedTypesPolicyName || "webpack-dev-server#overlay", {
38
+ createHTML: function createHTML(value) {
39
+ return value;
40
+ }
41
+ });
42
+ }
27
43
 
28
- function createContainer() {
29
44
  iframeContainerElement = document.createElement("iframe");
30
45
  iframeContainerElement.id = "webpack-dev-server-client-overlay";
31
46
  iframeContainerElement.src = "about:blank";
@@ -101,10 +116,11 @@ function createContainer() {
101
116
  }
102
117
  /**
103
118
  * @param {(element: HTMLDivElement) => void} callback
119
+ * @param {string | null} trustedTypesPolicyName
104
120
  */
105
121
 
106
122
 
107
- function ensureOverlayExists(callback) {
123
+ function ensureOverlayExists(callback, trustedTypesPolicyName) {
108
124
  if (containerElement) {
109
125
  // Everything is ready, call the callback right away.
110
126
  callback(containerElement);
@@ -117,7 +133,7 @@ function ensureOverlayExists(callback) {
117
133
  return;
118
134
  }
119
135
 
120
- createContainer();
136
+ createContainer(trustedTypesPolicyName);
121
137
  } // Successful compilation.
122
138
 
123
139
 
@@ -162,10 +178,11 @@ function formatProblem(type, item) {
162
178
  /**
163
179
  * @param {string} type
164
180
  * @param {Array<string | { file?: string, moduleName?: string, loc?: string, message?: string }>} messages
181
+ * @param {string | null} trustedTypesPolicyName
165
182
  */
166
183
 
167
184
 
168
- function show(type, messages) {
185
+ function show(type, messages, trustedTypesPolicyName) {
169
186
  ensureOverlayExists(function () {
170
187
  messages.forEach(function (message) {
171
188
  var entryElement = document.createElement("div");
@@ -180,7 +197,7 @@ function show(type, messages) {
180
197
 
181
198
  var text = ansiHTML(encode(body));
182
199
  var messageTextNode = document.createElement("div");
183
- messageTextNode.innerHTML = text;
200
+ messageTextNode.innerHTML = overlayTrustedTypesPolicy ? overlayTrustedTypesPolicy.createHTML(text) : text;
184
201
  entryElement.appendChild(typeElement);
185
202
  entryElement.appendChild(document.createElement("br"));
186
203
  entryElement.appendChild(document.createElement("br"));
@@ -191,7 +208,7 @@ function show(type, messages) {
191
208
 
192
209
  containerElement.appendChild(entryElement);
193
210
  });
194
- });
211
+ }, trustedTypesPolicyName);
195
212
  }
196
213
 
197
214
  export { formatProblem, show, hide };
@@ -5,7 +5,7 @@
5
5
  function format(objURL) {
6
6
  var protocol = objURL.protocol || "";
7
7
 
8
- if (protocol && !protocol.endsWith(":")) {
8
+ if (protocol && protocol.substr(-1) !== ":") {
9
9
  protocol += ":";
10
10
  }
11
11
 
package/lib/Server.js CHANGED
@@ -385,17 +385,17 @@ class Server {
385
385
 
386
386
  /**
387
387
  * @param {Port} port
388
+ * @param {string} host
388
389
  * @returns {Promise<number | string>}
389
390
  */
390
- static async getFreePort(port) {
391
+ static async getFreePort(port, host) {
391
392
  if (typeof port !== "undefined" && port !== null && port !== "auto") {
392
393
  return port;
393
394
  }
394
395
 
395
396
  const pRetry = require("p-retry");
396
- const portfinder = require("portfinder");
397
-
398
- portfinder.basePort =
397
+ const getPort = require("./getPort");
398
+ const basePort =
399
399
  typeof process.env.WEBPACK_DEV_SERVER_BASE_PORT !== "undefined"
400
400
  ? parseInt(process.env.WEBPACK_DEV_SERVER_BASE_PORT, 10)
401
401
  : 8080;
@@ -407,7 +407,7 @@ class Server {
407
407
  ? parseInt(process.env.WEBPACK_DEV_SERVER_PORT_RETRY, 10)
408
408
  : 3;
409
409
 
410
- return pRetry(() => portfinder.getPortPromise(), {
410
+ return pRetry(() => getPort(basePort, host), {
411
411
  retries: defaultPortRetry,
412
412
  });
413
413
  }
@@ -3201,7 +3201,8 @@ class Server {
3201
3201
  /** @type {Host} */ (this.options.host)
3202
3202
  );
3203
3203
  this.options.port = await Server.getFreePort(
3204
- /** @type {Port} */ (this.options.port)
3204
+ /** @type {Port} */ (this.options.port),
3205
+ this.options.host
3205
3206
  );
3206
3207
  }
3207
3208