Skip to content

Commit a5766b6

Browse files
snitin315alexander-akait
authored andcommitted
refactor!: remove the https and the http2 option (#4661)
1 parent eca342d commit a5766b6

23 files changed

+137
-3648
lines changed

lib/Server.js

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,40 +1009,13 @@ class Server {
10091009
? options.hot
10101010
: true;
10111011

1012-
const isHTTPs = Boolean(options.https);
1013-
const isSPDY = Boolean(options.http2);
1014-
1015-
if (isHTTPs) {
1016-
// TODO: remove in the next major release
1017-
util.deprecate(
1018-
() => {},
1019-
"'https' option is deprecated. Please use the 'server' option.",
1020-
"DEP_WEBPACK_DEV_SERVER_HTTPS"
1021-
)();
1022-
}
1023-
1024-
if (isSPDY) {
1025-
// TODO: remove in the next major release
1026-
util.deprecate(
1027-
() => {},
1028-
"'http2' option is deprecated. Please use the 'server' option.",
1029-
"DEP_WEBPACK_DEV_SERVER_HTTP2"
1030-
)();
1031-
}
1032-
10331012
options.server = {
10341013
type:
10351014
// eslint-disable-next-line no-nested-ternary
10361015
typeof options.server === "string"
10371016
? options.server
1038-
: // eslint-disable-next-line no-nested-ternary
1039-
typeof (options.server || {}).type === "string"
1017+
: typeof (options.server || {}).type === "string"
10401018
? /** @type {ServerConfiguration} */ (options.server).type || "http"
1041-
: // eslint-disable-next-line no-nested-ternary
1042-
isSPDY
1043-
? "spdy"
1044-
: isHTTPs
1045-
? "https"
10461019
: "http",
10471020
options: {
10481021
.../** @type {ServerOptions} */ (options.https),

lib/options.json

Lines changed: 0 additions & 195 deletions
Original file line numberDiff line numberDiff line change
@@ -264,195 +264,6 @@
264264
"type": "object",
265265
"additionalProperties": true
266266
},
267-
"HTTP2": {
268-
"type": "boolean",
269-
"description": "Allows to serve over HTTP/2 using SPDY. Deprecated, use the `server` option.",
270-
"link": "https://webpack.js.org/configuration/dev-server/#devserverhttp2",
271-
"cli": {
272-
"negatedDescription": "Does not serve over HTTP/2 using SPDY."
273-
}
274-
},
275-
"HTTPS": {
276-
"anyOf": [
277-
{
278-
"type": "boolean",
279-
"cli": {
280-
"negatedDescription": "Disallows to configure the server's listening socket for TLS (by default, dev server will be served over HTTP)."
281-
}
282-
},
283-
{
284-
"type": "object",
285-
"additionalProperties": true,
286-
"properties": {
287-
"passphrase": {
288-
"type": "string",
289-
"description": "Passphrase for a pfx file. Deprecated, use the `server.options.passphrase` option."
290-
},
291-
"requestCert": {
292-
"type": "boolean",
293-
"description": "Request for an SSL certificate. Deprecated, use the `server.options.requestCert` option.",
294-
"cli": {
295-
"negatedDescription": "Does not request for an SSL certificate."
296-
}
297-
},
298-
"ca": {
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-
"cacert": {
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 CA certificate or content of an SSL CA certificate. Deprecated, use the `server.options.ca` option."
345-
},
346-
"cert": {
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 an SSL certificate or content of an SSL certificate. Deprecated, use the `server.options.cert` option."
369-
},
370-
"crl": {
371-
"anyOf": [
372-
{
373-
"type": "array",
374-
"items": {
375-
"anyOf": [
376-
{
377-
"type": "string"
378-
},
379-
{
380-
"instanceof": "Buffer"
381-
}
382-
]
383-
}
384-
},
385-
{
386-
"type": "string"
387-
},
388-
{
389-
"instanceof": "Buffer"
390-
}
391-
],
392-
"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."
393-
},
394-
"key": {
395-
"anyOf": [
396-
{
397-
"type": "array",
398-
"items": {
399-
"anyOf": [
400-
{
401-
"type": "string"
402-
},
403-
{
404-
"instanceof": "Buffer"
405-
},
406-
{
407-
"type": "object",
408-
"additionalProperties": true
409-
}
410-
]
411-
}
412-
},
413-
{
414-
"type": "string"
415-
},
416-
{
417-
"instanceof": "Buffer"
418-
}
419-
],
420-
"description": "Path to an SSL key or content of an SSL key. Deprecated, use the `server.options.key` option."
421-
},
422-
"pfx": {
423-
"anyOf": [
424-
{
425-
"type": "array",
426-
"items": {
427-
"anyOf": [
428-
{
429-
"type": "string"
430-
},
431-
{
432-
"instanceof": "Buffer"
433-
},
434-
{
435-
"type": "object",
436-
"additionalProperties": true
437-
}
438-
]
439-
}
440-
},
441-
{
442-
"type": "string"
443-
},
444-
{
445-
"instanceof": "Buffer"
446-
}
447-
],
448-
"description": "Path to an SSL pfx file or content of an SSL pfx file. Deprecated, use the `server.options.pfx` option."
449-
}
450-
}
451-
}
452-
],
453-
"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.",
454-
"link": "https://webpack.js.org/configuration/dev-server/#devserverhttps"
455-
},
456267
"HeaderObject": {
457268
"type": "object",
458269
"additionalProperties": false,
@@ -1211,12 +1022,6 @@
12111022
"hot": {
12121023
"$ref": "#/definitions/Hot"
12131024
},
1214-
"http2": {
1215-
"$ref": "#/definitions/HTTP2"
1216-
},
1217-
"https": {
1218-
"$ref": "#/definitions/HTTPS"
1219-
},
12201025
"ipc": {
12211026
"$ref": "#/definitions/IPC"
12221027
},

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

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

368-
exports[`options validate should throw an error on the "http2" option with '' value 1`] = `
369-
"ValidationError: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.
370-
- options.http2 should be a boolean.
371-
-> Allows to serve over HTTP/2 using SPDY. Deprecated, use the \`server\` option.
372-
-> Read more at https://webpack.js.org/configuration/dev-server/#devserverhttp2"
373-
`;
374-
375-
exports[`options validate should throw an error on the "https" option with '' value 1`] = `
376-
"ValidationError: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.
377-
- options.https should be one of these:
378-
boolean | object { passphrase?, requestCert?, ca?, cacert?, cert?, crl?, key?, pfx?, … }
379-
-> Allows to configure the server's listening socket for TLS (by default, dev server will be served over HTTP). Deprecated, use the \`server\` option.
380-
-> Read more at https://webpack.js.org/configuration/dev-server/#devserverhttps
381-
Details:
382-
* options.https should be a boolean.
383-
* options.https should be an object:
384-
object { passphrase?, requestCert?, ca?, cacert?, cert?, crl?, key?, pfx?, … }"
385-
`;
386-
387-
exports[`options validate should throw an error on the "https" option with '{"cacert":true}' value 1`] = `
388-
"ValidationError: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.
389-
- options.https should be one of these:
390-
boolean | object { passphrase?, requestCert?, ca?, cacert?, cert?, crl?, key?, pfx?, … }
391-
-> Allows to configure the server's listening socket for TLS (by default, dev server will be served over HTTP). Deprecated, use the \`server\` option.
392-
-> Read more at https://webpack.js.org/configuration/dev-server/#devserverhttps
393-
Details:
394-
* options.https.cacert should be one of these:
395-
[string | Buffer, ...] | string | Buffer
396-
-> Path to an SSL CA certificate or content of an SSL CA certificate. Deprecated, use the \`server.options.ca\` option.
397-
Details:
398-
* options.https.cacert should be an array:
399-
[string | Buffer, ...]
400-
* options.https.cacert should be a string.
401-
* options.https.cacert should be an instance of Buffer."
402-
`;
403-
404-
exports[`options validate should throw an error on the "https" option with '{"cert":true}' value 1`] = `
405-
"ValidationError: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.
406-
- options.https should be one of these:
407-
boolean | object { passphrase?, requestCert?, ca?, cacert?, cert?, crl?, key?, pfx?, … }
408-
-> Allows to configure the server's listening socket for TLS (by default, dev server will be served over HTTP). Deprecated, use the \`server\` option.
409-
-> Read more at https://webpack.js.org/configuration/dev-server/#devserverhttps
410-
Details:
411-
* options.https.cert should be one of these:
412-
[string | Buffer, ...] | string | Buffer
413-
-> Path to an SSL certificate or content of an SSL certificate. Deprecated, use the \`server.options.cert\` option.
414-
Details:
415-
* options.https.cert should be an array:
416-
[string | Buffer, ...]
417-
* options.https.cert should be a string.
418-
* options.https.cert should be an instance of Buffer."
419-
`;
420-
421-
exports[`options validate should throw an error on the "https" option with '{"key":10}' value 1`] = `
422-
"ValidationError: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.
423-
- options.https should be one of these:
424-
boolean | object { passphrase?, requestCert?, ca?, cacert?, cert?, crl?, key?, pfx?, … }
425-
-> Allows to configure the server's listening socket for TLS (by default, dev server will be served over HTTP). Deprecated, use the \`server\` option.
426-
-> Read more at https://webpack.js.org/configuration/dev-server/#devserverhttps
427-
Details:
428-
* options.https.key should be one of these:
429-
[string | Buffer | object { … }, ...] | string | Buffer
430-
-> Path to an SSL key or content of an SSL key. Deprecated, use the \`server.options.key\` option.
431-
Details:
432-
* options.https.key should be an array:
433-
[string | Buffer | object { … }, ...]
434-
* options.https.key should be a string.
435-
* options.https.key should be an instance of Buffer."
436-
`;
437-
438-
exports[`options validate should throw an error on the "https" option with '{"passphrase":false}' value 1`] = `
439-
"ValidationError: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.
440-
- options.https.passphrase should be a string.
441-
-> Passphrase for a pfx file. Deprecated, use the \`server.options.passphrase\` option."
442-
`;
443-
444-
exports[`options validate should throw an error on the "https" option with '{"pfx":10}' value 1`] = `
445-
"ValidationError: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.
446-
- options.https should be one of these:
447-
boolean | object { passphrase?, requestCert?, ca?, cacert?, cert?, crl?, key?, pfx?, … }
448-
-> Allows to configure the server's listening socket for TLS (by default, dev server will be served over HTTP). Deprecated, use the \`server\` option.
449-
-> Read more at https://webpack.js.org/configuration/dev-server/#devserverhttps
450-
Details:
451-
* options.https.pfx should be one of these:
452-
[string | Buffer | object { … }, ...] | string | Buffer
453-
-> Path to an SSL pfx file or content of an SSL pfx file. Deprecated, use the \`server.options.pfx\` option.
454-
Details:
455-
* options.https.pfx should be an array:
456-
[string | Buffer | object { … }, ...]
457-
* options.https.pfx should be a string.
458-
* options.https.pfx should be an instance of Buffer."
459-
`;
460-
461-
exports[`options validate should throw an error on the "https" option with '{"requestCert":"test"}' value 1`] = `
462-
"ValidationError: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.
463-
- options.https.requestCert should be a boolean.
464-
-> Request for an SSL certificate. Deprecated, use the \`server.options.requestCert\` option."
465-
`;
466-
467368
exports[`options validate should throw an error on the "ipc" option with '{}' value 1`] = `
468369
"ValidationError: Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.
469370
- 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)