Skip to content

Commit bd1ae3b

Browse files
committed
refactor!: remove the https and the http2 option (#4661)
1 parent c904acd commit bd1ae3b

23 files changed

+137
-3644
lines changed

lib/Server.js

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -988,40 +988,13 @@ class Server {
988988
? options.hot
989989
: true;
990990

991-
const isHTTPs = Boolean(options.https);
992-
const isSPDY = Boolean(options.http2);
993-
994-
if (isHTTPs) {
995-
// TODO: remove in the next major release
996-
util.deprecate(
997-
() => {},
998-
"'https' option is deprecated. Please use the 'server' option.",
999-
"DEP_WEBPACK_DEV_SERVER_HTTPS"
1000-
)();
1001-
}
1002-
1003-
if (isSPDY) {
1004-
// TODO: remove in the next major release
1005-
util.deprecate(
1006-
() => {},
1007-
"'http2' option is deprecated. Please use the 'server' option.",
1008-
"DEP_WEBPACK_DEV_SERVER_HTTP2"
1009-
)();
1010-
}
1011-
1012991
options.server = {
1013992
type:
1014993
// eslint-disable-next-line no-nested-ternary
1015994
typeof options.server === "string"
1016995
? options.server
1017-
: // eslint-disable-next-line no-nested-ternary
1018-
typeof (options.server || {}).type === "string"
996+
: typeof (options.server || {}).type === "string"
1019997
? /** @type {ServerConfiguration} */ (options.server).type || "http"
1020-
: // eslint-disable-next-line no-nested-ternary
1021-
isSPDY
1022-
? "spdy"
1023-
: isHTTPs
1024-
? "https"
1025998
: "http",
1026999
options: {
10271000
.../** @type {ServerOptions} */ (options.https),

lib/options.json

Lines changed: 0 additions & 195 deletions
Original file line numberDiff line numberDiff line change
@@ -240,195 +240,6 @@
240240
"type": "object",
241241
"additionalProperties": true
242242
},
243-
"HTTP2": {
244-
"type": "boolean",
245-
"description": "Allows to serve over HTTP/2 using SPDY. Deprecated, use the `server` option.",
246-
"link": "https://webpack.js.org/configuration/dev-server/#devserverhttp2",
247-
"cli": {
248-
"negatedDescription": "Does not serve over HTTP/2 using SPDY."
249-
}
250-
},
251-
"HTTPS": {
252-
"anyOf": [
253-
{
254-
"type": "boolean",
255-
"cli": {
256-
"negatedDescription": "Disallows to configure the server's listening socket for TLS (by default, dev server will be served over HTTP)."
257-
}
258-
},
259-
{
260-
"type": "object",
261-
"additionalProperties": true,
262-
"properties": {
263-
"passphrase": {
264-
"type": "string",
265-
"description": "Passphrase for a pfx file. Deprecated, use the `server.options.passphrase` option."
266-
},
267-
"requestCert": {
268-
"type": "boolean",
269-
"description": "Request for an SSL certificate. Deprecated, use the `server.options.requestCert` option.",
270-
"cli": {
271-
"negatedDescription": "Does not request for an SSL certificate."
272-
}
273-
},
274-
"ca": {
275-
"anyOf": [
276-
{
277-
"type": "array",
278-
"items": {
279-
"anyOf": [
280-
{
281-
"type": "string"
282-
},
283-
{
284-
"instanceof": "Buffer"
285-
}
286-
]
287-
}
288-
},
289-
{
290-
"type": "string"
291-
},
292-
{
293-
"instanceof": "Buffer"
294-
}
295-
],
296-
"description": "Path to an SSL CA certificate or content of an SSL CA certificate. Deprecated, use the `server.options.ca` option."
297-
},
298-
"cacert": {
299-
"anyOf": [
300-
{
301-
"type": "array",
302-
"items": {
303-
"anyOf": [
304-
{
305-
"type": "string"
306-
},
307-
{
308-
"instanceof": "Buffer"
309-
}
310-
]
311-
}
312-
},
313-
{
314-
"type": "string"
315-
},
316-
{
317-
"instanceof": "Buffer"
318-
}
319-
],
320-
"description": "Path to an SSL CA certificate or content of an SSL CA certificate. Deprecated, use the `server.options.ca` option."
321-
},
322-
"cert": {
323-
"anyOf": [
324-
{
325-
"type": "array",
326-
"items": {
327-
"anyOf": [
328-
{
329-
"type": "string"
330-
},
331-
{
332-
"instanceof": "Buffer"
333-
}
334-
]
335-
}
336-
},
337-
{
338-
"type": "string"
339-
},
340-
{
341-
"instanceof": "Buffer"
342-
}
343-
],
344-
"description": "Path to an SSL certificate or content of an SSL certificate. Deprecated, use the `server.options.cert` option."
345-
},
346-
"crl": {
347-
"anyOf": [
348-
{
349-
"type": "array",
350-
"items": {
351-
"anyOf": [
352-
{
353-
"type": "string"
354-
},
355-
{
356-
"instanceof": "Buffer"
357-
}
358-
]
359-
}
360-
},
361-
{
362-
"type": "string"
363-
},
364-
{
365-
"instanceof": "Buffer"
366-
}
367-
],
368-
"description": "Path to PEM formatted CRLs (Certificate Revocation Lists) or content of PEM formatted CRLs (Certificate Revocation Lists). Deprecated, use the `server.options.crl` option."
369-
},
370-
"key": {
371-
"anyOf": [
372-
{
373-
"type": "array",
374-
"items": {
375-
"anyOf": [
376-
{
377-
"type": "string"
378-
},
379-
{
380-
"instanceof": "Buffer"
381-
},
382-
{
383-
"type": "object",
384-
"additionalProperties": true
385-
}
386-
]
387-
}
388-
},
389-
{
390-
"type": "string"
391-
},
392-
{
393-
"instanceof": "Buffer"
394-
}
395-
],
396-
"description": "Path to an SSL key or content of an SSL key. Deprecated, use the `server.options.key` option."
397-
},
398-
"pfx": {
399-
"anyOf": [
400-
{
401-
"type": "array",
402-
"items": {
403-
"anyOf": [
404-
{
405-
"type": "string"
406-
},
407-
{
408-
"instanceof": "Buffer"
409-
},
410-
{
411-
"type": "object",
412-
"additionalProperties": true
413-
}
414-
]
415-
}
416-
},
417-
{
418-
"type": "string"
419-
},
420-
{
421-
"instanceof": "Buffer"
422-
}
423-
],
424-
"description": "Path to an SSL pfx file or content of an SSL pfx file. Deprecated, use the `server.options.pfx` option."
425-
}
426-
}
427-
}
428-
],
429-
"description": "Allows to configure the server's listening socket for TLS (by default, dev server will be served over HTTP). Deprecated, use the `server` option.",
430-
"link": "https://webpack.js.org/configuration/dev-server/#devserverhttps"
431-
},
432243
"HeaderObject": {
433244
"type": "object",
434245
"additionalProperties": false,
@@ -1187,12 +998,6 @@
1187998
"hot": {
1188999
"$ref": "#/definitions/Hot"
11891000
},
1190-
"http2": {
1191-
"$ref": "#/definitions/HTTP2"
1192-
},
1193-
"https": {
1194-
"$ref": "#/definitions/HTTPS"
1195-
},
11961001
"ipc": {
11971002
"$ref": "#/definitions/IPC"
11981003
},

test/__snapshots__/validate-options.test.js.snap.webpack5

Lines changed: 0 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -345,105 +345,6 @@ exports[`options validate should throw an error on the "hot" option with 'foo' v
345345
* options.hot should be \\"only\\"."
346346
`;
347347

348-
exports[`options validate should throw an error on the "http2" option with '' value 1`] = `
349-
"ValidationError: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.
350-
- options.http2 should be a boolean.
351-
-> Allows to serve over HTTP/2 using SPDY. Deprecated, use the \`server\` option.
352-
-> Read more at https://webpack.js.org/configuration/dev-server/#devserverhttp2"
353-
`;
354-
355-
exports[`options validate should throw an error on the "https" option with '' value 1`] = `
356-
"ValidationError: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.
357-
- options.https should be one of these:
358-
boolean | object { passphrase?, requestCert?, ca?, cacert?, cert?, crl?, key?, pfx?, … }
359-
-> Allows to configure the server's listening socket for TLS (by default, dev server will be served over HTTP). Deprecated, use the \`server\` option.
360-
-> Read more at https://webpack.js.org/configuration/dev-server/#devserverhttps
361-
Details:
362-
* options.https should be a boolean.
363-
* options.https should be an object:
364-
object { passphrase?, requestCert?, ca?, cacert?, cert?, crl?, key?, pfx?, … }"
365-
`;
366-
367-
exports[`options validate should throw an error on the "https" option with '{"cacert":true}' value 1`] = `
368-
"ValidationError: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.
369-
- options.https should be one of these:
370-
boolean | object { passphrase?, requestCert?, ca?, cacert?, cert?, crl?, key?, pfx?, … }
371-
-> Allows to configure the server's listening socket for TLS (by default, dev server will be served over HTTP). Deprecated, use the \`server\` option.
372-
-> Read more at https://webpack.js.org/configuration/dev-server/#devserverhttps
373-
Details:
374-
* options.https.cacert should be one of these:
375-
[string | Buffer, ...] | string | Buffer
376-
-> Path to an SSL CA certificate or content of an SSL CA certificate. Deprecated, use the \`server.options.ca\` option.
377-
Details:
378-
* options.https.cacert should be an array:
379-
[string | Buffer, ...]
380-
* options.https.cacert should be a string.
381-
* options.https.cacert should be an instance of Buffer."
382-
`;
383-
384-
exports[`options validate should throw an error on the "https" option with '{"cert":true}' value 1`] = `
385-
"ValidationError: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.
386-
- options.https should be one of these:
387-
boolean | object { passphrase?, requestCert?, ca?, cacert?, cert?, crl?, key?, pfx?, … }
388-
-> Allows to configure the server's listening socket for TLS (by default, dev server will be served over HTTP). Deprecated, use the \`server\` option.
389-
-> Read more at https://webpack.js.org/configuration/dev-server/#devserverhttps
390-
Details:
391-
* options.https.cert should be one of these:
392-
[string | Buffer, ...] | string | Buffer
393-
-> Path to an SSL certificate or content of an SSL certificate. Deprecated, use the \`server.options.cert\` option.
394-
Details:
395-
* options.https.cert should be an array:
396-
[string | Buffer, ...]
397-
* options.https.cert should be a string.
398-
* options.https.cert should be an instance of Buffer."
399-
`;
400-
401-
exports[`options validate should throw an error on the "https" option with '{"key":10}' value 1`] = `
402-
"ValidationError: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.
403-
- options.https should be one of these:
404-
boolean | object { passphrase?, requestCert?, ca?, cacert?, cert?, crl?, key?, pfx?, … }
405-
-> Allows to configure the server's listening socket for TLS (by default, dev server will be served over HTTP). Deprecated, use the \`server\` option.
406-
-> Read more at https://webpack.js.org/configuration/dev-server/#devserverhttps
407-
Details:
408-
* options.https.key should be one of these:
409-
[string | Buffer | object { … }, ...] | string | Buffer
410-
-> Path to an SSL key or content of an SSL key. Deprecated, use the \`server.options.key\` option.
411-
Details:
412-
* options.https.key should be an array:
413-
[string | Buffer | object { … }, ...]
414-
* options.https.key should be a string.
415-
* options.https.key should be an instance of Buffer."
416-
`;
417-
418-
exports[`options validate should throw an error on the "https" option with '{"passphrase":false}' value 1`] = `
419-
"ValidationError: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.
420-
- options.https.passphrase should be a string.
421-
-> Passphrase for a pfx file. Deprecated, use the \`server.options.passphrase\` option."
422-
`;
423-
424-
exports[`options validate should throw an error on the "https" option with '{"pfx":10}' value 1`] = `
425-
"ValidationError: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.
426-
- options.https should be one of these:
427-
boolean | object { passphrase?, requestCert?, ca?, cacert?, cert?, crl?, key?, pfx?, … }
428-
-> Allows to configure the server's listening socket for TLS (by default, dev server will be served over HTTP). Deprecated, use the \`server\` option.
429-
-> Read more at https://webpack.js.org/configuration/dev-server/#devserverhttps
430-
Details:
431-
* options.https.pfx should be one of these:
432-
[string | Buffer | object { … }, ...] | string | Buffer
433-
-> Path to an SSL pfx file or content of an SSL pfx file. Deprecated, use the \`server.options.pfx\` option.
434-
Details:
435-
* options.https.pfx should be an array:
436-
[string | Buffer | object { … }, ...]
437-
* options.https.pfx should be a string.
438-
* options.https.pfx should be an instance of Buffer."
439-
`;
440-
441-
exports[`options validate should throw an error on the "https" option with '{"requestCert":"test"}' value 1`] = `
442-
"ValidationError: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.
443-
- options.https.requestCert should be a boolean.
444-
-> Request for an SSL certificate. Deprecated, use the \`server.options.requestCert\` option."
445-
`;
446-
447348
exports[`options validate should throw an error on the "ipc" option with '{}' value 1`] = `
448349
"ValidationError: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.
449350
- options.ipc should be one of these:

test/cli/__snapshots__/basic.test.js.snap.webpack5

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -89,25 +89,6 @@ Options:
8989
--host <value> Allows to specify a hostname to use.
9090
--hot [value] Enables Hot Module Replacement.
9191
--no-hot Disables Hot Module Replacement.
92-
--http2 Allows to serve over HTTP/2 using SPDY. Deprecated, use the \`server\` option.
93-
--no-http2 Does not serve over HTTP/2 using SPDY.
94-
--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.
95-
--no-https Disallows to configure the server's listening socket for TLS (by default, dev server will be served over HTTP).
96-
--https-passphrase <value> Passphrase for a pfx file. Deprecated, use the \`server.options.passphrase\` option.
97-
--https-request-cert Request for an SSL certificate. Deprecated, use the \`server.options.requestCert\` option.
98-
--no-https-request-cert Does not request for an SSL certificate.
99-
--https-ca <value...> Path to an SSL CA certificate or content of an SSL CA certificate. Deprecated, use the \`server.options.ca\` option.
100-
--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.
101-
--https-cacert <value...> Path to an SSL CA certificate or content of an SSL CA certificate. Deprecated, use the \`server.options.ca\` option.
102-
--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.
103-
--https-cert <value...> Path to an SSL certificate or content of an SSL certificate. Deprecated, use the \`server.options.cert\` option.
104-
--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.
105-
--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.
106-
--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.
107-
--https-key <value...> Path to an SSL key or content of an SSL key. Deprecated, use the \`server.options.key\` option.
108-
--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.
109-
--https-pfx <value...> Path to an SSL pfx file or content of an SSL pfx file. Deprecated, use the \`server.options.pfx\` option.
110-
--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.
11192
--ipc [value] Listen to a unix socket.
11293
--live-reload Enables reload/refresh the page(s) when file changes are detected (enabled by default).
11394
--no-live-reload Disables reload/refresh the page(s) when file changes are detected (enabled by default).

test/cli/__snapshots__/bonjour-option.test.js.snap.webpack5

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`"bonjour" CLI option should work using "--bonjour and --https" 1`] = `
3+
exports[`"bonjour" CLI option should work using "--bonjour and --server-type=https" 1`] = `
44
"<i> [webpack-dev-server] Generating SSL certificate...
55
<i> [webpack-dev-server] SSL certificate: <cwd>/node_modules/.cache/webpack-dev-server/server.pem
66
<i> [webpack-dev-server] Project is running at:

0 commit comments

Comments
 (0)