webpack-dev-server 4.1.1 → 4.2.0
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 +44 -47
- package/bin/cli-flags.js +134 -11
- package/client/index.js +9 -4
- package/lib/Server.js +44 -13
- package/lib/options.json +116 -8
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -73,76 +73,78 @@ Options:
|
|
|
73
73
|
--node-env <value> Sets process.env.NODE_ENV to the specified value.
|
|
74
74
|
--progress [value] Print compilation progress during build.
|
|
75
75
|
-j, --json [value] Prints result as JSON or store it in a file.
|
|
76
|
+
--entry <value...> The entry point(s) of your application e.g. ./src/main.js.
|
|
77
|
+
-o, --output-path <value> Output location of the file generated by webpack e.g. ./dist/.
|
|
78
|
+
-t, --target <value> Sets the build target e.g. node.
|
|
76
79
|
-d, --devtool <value> Determine source maps to use.
|
|
77
80
|
--no-devtool Do not generate source maps.
|
|
78
|
-
--entry <value...> The entry point(s) of your application e.g. ./src/main.js.
|
|
79
81
|
--mode <value> Defines the mode to pass to webpack.
|
|
80
82
|
--name <value> Name of the configuration. Used when loading multiple configurations.
|
|
81
|
-
-o, --output-path <value> Output location of the file generated by webpack e.g. ./dist/.
|
|
82
83
|
--stats [value] It instructs webpack on how to treat the stats e.g. verbose.
|
|
83
84
|
--no-stats Disable stats output.
|
|
84
|
-
-t, --target <value...> Sets the build target e.g. node.
|
|
85
|
-
--no-target Negative 'target' option.
|
|
86
85
|
--watch-options-stdin Stop watching when stdin stream has ended.
|
|
87
86
|
--no-watch-options-stdin Do not stop watching when stdin stream has ended.
|
|
88
|
-
--allowed-hosts <value...> Allows to enumerate the hosts from which access to the dev server are allowed (useful when you are proxying
|
|
89
|
-
|
|
90
|
-
--allowed-hosts-reset Clear all items provided in 'allowedHosts' configuration. Allows to enumerate the hosts from which access to
|
|
91
|
-
the dev server are allowed (useful when you are proxying dev server, by default is 'auto').
|
|
87
|
+
--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').
|
|
88
|
+
--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').
|
|
92
89
|
--bonjour Allows to broadcasts dev server via ZeroConf networking on start.
|
|
93
|
-
--no-bonjour
|
|
90
|
+
--no-bonjour Disallows to broadcasts dev server via ZeroConf networking on start.
|
|
91
|
+
--client-web-socket-transport <value> Allows to set custom web socket transport to communicate with dev server.
|
|
94
92
|
--no-client Negative 'client' option.
|
|
95
93
|
--client-logging <value> Allows to specify options for client script in the browser or disable client script.
|
|
94
|
+
--client-progress Prints compilation progress in percentage in the browser.
|
|
95
|
+
--no-client-progress Does not print compilation progress in percentage in the browser.
|
|
96
96
|
--client-overlay Enables a full-screen overlay in the browser when there are compiler errors or warnings.
|
|
97
|
-
--no-client-overlay
|
|
97
|
+
--no-client-overlay Disables a full-screen overlay in the browser when there are compiler errors or warnings.
|
|
98
98
|
--client-overlay-errors Enables a full-screen overlay in the browser when there are compiler errors.
|
|
99
99
|
--no-client-overlay-errors Negative 'client-overlay-errors' option.
|
|
100
100
|
--client-overlay-warnings Enables a full-screen overlay in the browser when there are compiler warnings.
|
|
101
101
|
--no-client-overlay-warnings Negative 'client-overlay-warnings' option.
|
|
102
|
-
--client-
|
|
103
|
-
--no-client-progress Negative 'client-progress' option.
|
|
104
|
-
--client-web-socket-transport <value> Allows to set custom web socket transport to communicate with dev server.
|
|
105
|
-
--client-web-socket-url <value> Allows to specify URL to web socket server (useful when you're proxying dev server and client script does
|
|
106
|
-
not always know where to connect to).
|
|
102
|
+
--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).
|
|
107
103
|
--client-web-socket-url-hostname <value> Tells clients connected to devServer to use the provided hostname.
|
|
108
|
-
--client-web-socket-url-pathname <value> Tells clients connected to devServer to use the provided path to connect.
|
|
109
|
-
--client-web-socket-url-password <value> Tells clients connected to devServer to use the provided password to authenticate.
|
|
110
104
|
--client-web-socket-url-port <value> Tells clients connected to devServer to use the provided port.
|
|
105
|
+
--client-web-socket-url-pathname <value> Tells clients connected to devServer to use the provided path to connect.
|
|
111
106
|
--client-web-socket-url-protocol <value> Tells clients connected to devServer to use the provided protocol.
|
|
112
107
|
--client-web-socket-url-username <value> Tells clients connected to devServer to use the provided username to authenticate.
|
|
108
|
+
--client-web-socket-url-password <value> Tells clients connected to devServer to use the provided password to authenticate.
|
|
109
|
+
--web-socket-server <value> Allows to set web socket server and options (by default 'ws').
|
|
110
|
+
--no-web-socket-server Negative 'web-socket-server' option.
|
|
113
111
|
--compress Enables gzip compression for everything served.
|
|
114
|
-
--no-compress
|
|
115
|
-
--history-api-fallback Allows to proxy requests through a specified index page (by default 'index.html'), useful for Single Page
|
|
116
|
-
Applications that utilise the HTML5 History API.
|
|
112
|
+
--no-compress Disables gzip compression for everything served.
|
|
113
|
+
--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.
|
|
117
114
|
--no-history-api-fallback Negative 'history-api-fallback' option.
|
|
118
115
|
--host <value> Allows to specify a hostname to use.
|
|
119
116
|
--hot [value] Enables Hot Module Replacement.
|
|
120
|
-
--no-hot
|
|
117
|
+
--no-hot Disables Hot Module Replacement.
|
|
121
118
|
--http2 Allows to serve over HTTP/2 using SPDY.
|
|
122
|
-
--no-http2
|
|
119
|
+
--no-http2 Does not serve over HTTP/2 using SPDY.
|
|
123
120
|
--https Allows to configure the server's listening socket for TLS (by default, dev server will be served over HTTP).
|
|
124
|
-
--no-https
|
|
121
|
+
--no-https Disallows to configure the server's listening socket for TLS (by default, dev server will be served over HTTP).
|
|
125
122
|
--https-passphrase <value> Passphrase for a pfx file.
|
|
126
123
|
--https-request-cert Request for an SSL certificate.
|
|
127
|
-
--no-https-request-cert
|
|
128
|
-
--https-
|
|
129
|
-
--https-
|
|
130
|
-
--https-
|
|
131
|
-
--https-
|
|
124
|
+
--no-https-request-cert Does not request for an SSL certificate.
|
|
125
|
+
--https-ca <value...> Path to an SSL CA certificate or content of an SSL CA certificate.
|
|
126
|
+
--https-ca-reset Clear all items provided in 'https.ca' configuration. Path to an SSL CA certificate or content of an SSL CA certificate.
|
|
127
|
+
--https-cacert <value...> Path to an SSL CA certificate or content of an SSL CA certificate.
|
|
128
|
+
--https-cacert-reset Clear all items provided in 'https.cacert' configuration. Path to an SSL CA certificate or content of an SSL CA certificate.
|
|
129
|
+
--https-key <value...> Path to an SSL key or content of an SSL key.
|
|
130
|
+
--https-key-reset Clear all items provided in 'https.key' configuration. Path to an SSL key or content of an SSL key.
|
|
131
|
+
--https-pfx <value...> Path to an SSL pfx file or content of an SSL pfx file.
|
|
132
|
+
--https-pfx-reset Clear all items provided in 'https.pfx' configuration. Path to an SSL pfx file or content of an SSL pfx file.
|
|
133
|
+
--https-cert <value...> Path to an SSL certificate or content of an SSL certificate.
|
|
134
|
+
--https-cert-reset Clear all items provided in 'https.cert' configuration. Path to an SSL certificate or content of an SSL certificate.
|
|
135
|
+
--https-crl <value...> Path to PEM formatted CRLs (Certificate Revocation Lists) or content of PEM formatted CRLs (Certificate Revocation Lists).
|
|
136
|
+
--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).
|
|
132
137
|
--ipc [value] Listen to a unix socket.
|
|
133
138
|
--live-reload Enables reload/refresh the page(s) when file changes are detected (enabled by default).
|
|
134
|
-
--no-live-reload
|
|
135
|
-
--magic-html Tells dev-server whether to enable magic HTML routes (routes corresponding to your webpack output, for
|
|
136
|
-
|
|
137
|
-
--
|
|
138
|
-
--open
|
|
139
|
-
true to open your default browser).
|
|
140
|
-
--no-open Negative 'open' option.
|
|
139
|
+
--no-live-reload Disables reload/refresh the page(s) when file changes are detected (enabled by default)
|
|
140
|
+
--magic-html Tells dev-server whether to enable magic HTML routes (routes corresponding to your webpack output, for example '/main' for 'main.js').
|
|
141
|
+
--no-magic-html Disables magic HTML routes (routes corresponding to your webpack output, for example '/main' for 'main.js').
|
|
142
|
+
--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).
|
|
143
|
+
--no-open Does not open the default browser.
|
|
141
144
|
--open-target <value...> Opens specified page in browser.
|
|
142
145
|
--open-app-name <value...> Open specified browser.
|
|
143
146
|
--open-app <value...> Open specified browser.
|
|
144
|
-
--open-reset Clear all items provided in 'open' configuration. Allows to configure dev server to open the browser(s) and
|
|
145
|
-
page(s) after server had been started (set it to true to open your default browser).
|
|
147
|
+
--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).
|
|
146
148
|
--open-target-reset Clear all items provided in 'open.target' configuration. Opens specified page in browser.
|
|
147
149
|
--open-app-name-reset Clear all items provided in 'open.app.name' configuration. Open specified browser.
|
|
148
150
|
--port <value> Allows to specify a port to use.
|
|
@@ -151,18 +153,13 @@ Options:
|
|
|
151
153
|
--static-directory <value...> Directory for static contents.
|
|
152
154
|
--static-public-path <value...> The static files will be available in the browser under this public path.
|
|
153
155
|
--static-serve-index Tells dev server to use serveIndex middleware when enabled.
|
|
154
|
-
--no-static-serve-index
|
|
156
|
+
--no-static-serve-index Does not tell dev server to use serveIndex middleware.
|
|
155
157
|
--static-watch Watches for files in static content directory.
|
|
156
|
-
--no-static-watch
|
|
157
|
-
--static-reset Clear all items provided in 'static' configuration. Allows to configure options for serving static files
|
|
158
|
-
|
|
159
|
-
--static-public-path-reset Clear all items provided in 'static.publicPath' configuration. The static files will be available in the
|
|
160
|
-
browser under this public path.
|
|
158
|
+
--no-static-watch Does not watch for files in static content directory.
|
|
159
|
+
--static-reset Clear all items provided in 'static' configuration. Allows to configure options for serving static files from directory (by default 'public' directory).
|
|
160
|
+
--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.
|
|
161
161
|
--watch-files <value...> Allows to configure list of globs/directories/files to watch for file changes.
|
|
162
|
-
--watch-files-reset Clear all items provided in 'watchFiles' configuration. Allows to configure list of globs/directories/files
|
|
163
|
-
to watch for file changes.
|
|
164
|
-
--web-socket-server <value> Allows to set web socket server and options (by default 'ws').
|
|
165
|
-
--no-web-socket-server Negative 'web-socket-server' option.
|
|
162
|
+
--watch-files-reset Clear all items provided in 'watchFiles' configuration. Allows to configure list of globs/directories/files to watch for file changes.
|
|
166
163
|
|
|
167
164
|
Global options:
|
|
168
165
|
--color Enable colors on console.
|
package/bin/cli-flags.js
CHANGED
|
@@ -445,57 +445,180 @@ module.exports = {
|
|
|
445
445
|
simpleType: "boolean",
|
|
446
446
|
multiple: false,
|
|
447
447
|
},
|
|
448
|
+
"https-ca": {
|
|
449
|
+
configs: [
|
|
450
|
+
{
|
|
451
|
+
type: "string",
|
|
452
|
+
multiple: true,
|
|
453
|
+
description:
|
|
454
|
+
"Path to an SSL CA certificate or content of an SSL CA certificate.",
|
|
455
|
+
path: "https.ca[]",
|
|
456
|
+
},
|
|
457
|
+
],
|
|
458
|
+
description:
|
|
459
|
+
"Path to an SSL CA certificate or content of an SSL CA certificate.",
|
|
460
|
+
simpleType: "string",
|
|
461
|
+
multiple: true,
|
|
462
|
+
},
|
|
463
|
+
"https-ca-reset": {
|
|
464
|
+
configs: [
|
|
465
|
+
{
|
|
466
|
+
description:
|
|
467
|
+
"Clear all items provided in 'https.ca' configuration. Path to an SSL CA certificate or content of an SSL CA certificate.",
|
|
468
|
+
multiple: false,
|
|
469
|
+
path: "https.ca",
|
|
470
|
+
type: "reset",
|
|
471
|
+
},
|
|
472
|
+
],
|
|
473
|
+
description:
|
|
474
|
+
"Clear all items provided in 'https.ca' configuration. Path to an SSL CA certificate or content of an SSL CA certificate.",
|
|
475
|
+
multiple: false,
|
|
476
|
+
simpleType: "boolean",
|
|
477
|
+
},
|
|
448
478
|
"https-cacert": {
|
|
449
479
|
configs: [
|
|
450
480
|
{
|
|
451
481
|
type: "string",
|
|
482
|
+
multiple: true,
|
|
483
|
+
description:
|
|
484
|
+
"Path to an SSL CA certificate or content of an SSL CA certificate.",
|
|
485
|
+
path: "https.cacert[]",
|
|
486
|
+
},
|
|
487
|
+
],
|
|
488
|
+
description:
|
|
489
|
+
"Path to an SSL CA certificate or content of an SSL CA certificate.",
|
|
490
|
+
simpleType: "string",
|
|
491
|
+
multiple: true,
|
|
492
|
+
},
|
|
493
|
+
"https-cacert-reset": {
|
|
494
|
+
configs: [
|
|
495
|
+
{
|
|
496
|
+
description:
|
|
497
|
+
"Clear all items provided in 'https.cacert' configuration. Path to an SSL CA certificate or content of an SSL CA certificate.",
|
|
452
498
|
multiple: false,
|
|
453
|
-
description: "Path to an SSL CA certificate.",
|
|
454
499
|
path: "https.cacert",
|
|
500
|
+
type: "reset",
|
|
455
501
|
},
|
|
456
502
|
],
|
|
457
|
-
description:
|
|
458
|
-
|
|
503
|
+
description:
|
|
504
|
+
"Clear all items provided in 'https.cacert' configuration. Path to an SSL CA certificate or content of an SSL CA certificate.",
|
|
459
505
|
multiple: false,
|
|
506
|
+
simpleType: "boolean",
|
|
460
507
|
},
|
|
461
508
|
"https-key": {
|
|
462
509
|
configs: [
|
|
463
510
|
{
|
|
464
511
|
type: "string",
|
|
512
|
+
multiple: true,
|
|
513
|
+
description: "Path to an SSL key or content of an SSL key.",
|
|
514
|
+
path: "https.key[]",
|
|
515
|
+
},
|
|
516
|
+
],
|
|
517
|
+
description: "Path to an SSL key or content of an SSL key.",
|
|
518
|
+
simpleType: "string",
|
|
519
|
+
multiple: true,
|
|
520
|
+
},
|
|
521
|
+
"https-key-reset": {
|
|
522
|
+
configs: [
|
|
523
|
+
{
|
|
524
|
+
description:
|
|
525
|
+
"Clear all items provided in 'https.key' configuration. Path to an SSL key or content of an SSL key.",
|
|
465
526
|
multiple: false,
|
|
466
|
-
description: "Path to an SSL key.",
|
|
467
527
|
path: "https.key",
|
|
528
|
+
type: "reset",
|
|
468
529
|
},
|
|
469
530
|
],
|
|
470
|
-
description:
|
|
471
|
-
|
|
531
|
+
description:
|
|
532
|
+
"Clear all items provided in 'https.key' configuration. Path to an SSL key or content of an SSL key.",
|
|
472
533
|
multiple: false,
|
|
534
|
+
simpleType: "boolean",
|
|
473
535
|
},
|
|
474
536
|
"https-pfx": {
|
|
475
537
|
configs: [
|
|
476
538
|
{
|
|
477
539
|
type: "string",
|
|
540
|
+
multiple: true,
|
|
541
|
+
description: "Path to an SSL pfx file or content of an SSL pfx file.",
|
|
542
|
+
path: "https.pfx[]",
|
|
543
|
+
},
|
|
544
|
+
],
|
|
545
|
+
description: "Path to an SSL pfx file or content of an SSL pfx file.",
|
|
546
|
+
simpleType: "string",
|
|
547
|
+
multiple: true,
|
|
548
|
+
},
|
|
549
|
+
"https-pfx-reset": {
|
|
550
|
+
configs: [
|
|
551
|
+
{
|
|
552
|
+
description:
|
|
553
|
+
"Clear all items provided in 'https.pfx' configuration. Path to an SSL pfx file or content of an SSL pfx file.",
|
|
478
554
|
multiple: false,
|
|
479
|
-
description: "Path to an SSL pfx file.",
|
|
480
555
|
path: "https.pfx",
|
|
556
|
+
type: "reset",
|
|
481
557
|
},
|
|
482
558
|
],
|
|
483
|
-
description:
|
|
484
|
-
|
|
559
|
+
description:
|
|
560
|
+
"Clear all items provided in 'https.pfx' configuration. Path to an SSL pfx file or content of an SSL pfx file.",
|
|
485
561
|
multiple: false,
|
|
562
|
+
simpleType: "boolean",
|
|
486
563
|
},
|
|
487
564
|
"https-cert": {
|
|
488
565
|
configs: [
|
|
489
566
|
{
|
|
490
567
|
type: "string",
|
|
568
|
+
multiple: true,
|
|
569
|
+
description:
|
|
570
|
+
"Path to an SSL certificate or content of an SSL certificate.",
|
|
571
|
+
path: "https.cert[]",
|
|
572
|
+
},
|
|
573
|
+
],
|
|
574
|
+
description: "Path to an SSL certificate or content of an SSL certificate.",
|
|
575
|
+
simpleType: "string",
|
|
576
|
+
multiple: true,
|
|
577
|
+
},
|
|
578
|
+
"https-cert-reset": {
|
|
579
|
+
configs: [
|
|
580
|
+
{
|
|
581
|
+
description:
|
|
582
|
+
"Clear all items provided in 'https.cert' configuration. Path to an SSL certificate or content of an SSL certificate.",
|
|
491
583
|
multiple: false,
|
|
492
|
-
description: "Path to an SSL certificate.",
|
|
493
584
|
path: "https.cert",
|
|
585
|
+
type: "reset",
|
|
586
|
+
},
|
|
587
|
+
],
|
|
588
|
+
description:
|
|
589
|
+
"Clear all items provided in 'https.cert' configuration. Path to an SSL certificate or content of an SSL certificate.",
|
|
590
|
+
multiple: false,
|
|
591
|
+
simpleType: "boolean",
|
|
592
|
+
},
|
|
593
|
+
"https-crl": {
|
|
594
|
+
configs: [
|
|
595
|
+
{
|
|
596
|
+
description:
|
|
597
|
+
"Path to PEM formatted CRLs (Certificate Revocation Lists) or content of PEM formatted CRLs (Certificate Revocation Lists).",
|
|
598
|
+
multiple: true,
|
|
599
|
+
path: "https.crl[]",
|
|
600
|
+
type: "string",
|
|
494
601
|
},
|
|
495
602
|
],
|
|
496
|
-
description:
|
|
603
|
+
description:
|
|
604
|
+
"Path to PEM formatted CRLs (Certificate Revocation Lists) or content of PEM formatted CRLs (Certificate Revocation Lists).",
|
|
605
|
+
multiple: true,
|
|
497
606
|
simpleType: "string",
|
|
607
|
+
},
|
|
608
|
+
"https-crl-reset": {
|
|
609
|
+
configs: [
|
|
610
|
+
{
|
|
611
|
+
description:
|
|
612
|
+
"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).",
|
|
613
|
+
multiple: false,
|
|
614
|
+
path: "https.crl",
|
|
615
|
+
type: "reset",
|
|
616
|
+
},
|
|
617
|
+
],
|
|
618
|
+
description:
|
|
619
|
+
"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).",
|
|
498
620
|
multiple: false,
|
|
621
|
+
simpleType: "boolean",
|
|
499
622
|
},
|
|
500
623
|
ipc: {
|
|
501
624
|
configs: [
|
package/client/index.js
CHANGED
|
@@ -137,9 +137,9 @@ var onSocketMessage = {
|
|
|
137
137
|
log.warn(strippedWarnings[i]);
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
-
var
|
|
140
|
+
var needShowOverlayForWarnings = typeof options.overlay === "boolean" ? options.overlay : options.overlay && options.overlay.warnings;
|
|
141
141
|
|
|
142
|
-
if (
|
|
142
|
+
if (needShowOverlayForWarnings) {
|
|
143
143
|
show(_warnings, "warnings");
|
|
144
144
|
}
|
|
145
145
|
|
|
@@ -158,9 +158,9 @@ var onSocketMessage = {
|
|
|
158
158
|
log.error(strippedErrors[i]);
|
|
159
159
|
}
|
|
160
160
|
|
|
161
|
-
var
|
|
161
|
+
var needShowOverlayForErrors = typeof options.overlay === "boolean" ? options.overlay : options.overlay && options.overlay.errors;
|
|
162
162
|
|
|
163
|
-
if (
|
|
163
|
+
if (needShowOverlayForErrors) {
|
|
164
164
|
show(_errors, "errors");
|
|
165
165
|
}
|
|
166
166
|
},
|
|
@@ -169,6 +169,11 @@ var onSocketMessage = {
|
|
|
169
169
|
},
|
|
170
170
|
close: function close() {
|
|
171
171
|
log.info("Disconnected!");
|
|
172
|
+
|
|
173
|
+
if (options.overlay) {
|
|
174
|
+
hide();
|
|
175
|
+
}
|
|
176
|
+
|
|
172
177
|
sendMessage("Close");
|
|
173
178
|
}
|
|
174
179
|
};
|
package/lib/Server.js
CHANGED
|
@@ -517,24 +517,39 @@ class Server {
|
|
|
517
517
|
|
|
518
518
|
// https option
|
|
519
519
|
if (options.https) {
|
|
520
|
-
|
|
520
|
+
// TODO remove the `cacert` option in favor `ca` in the next major release
|
|
521
|
+
for (const property of ["cacert", "ca", "cert", "crl", "key", "pfx"]) {
|
|
522
|
+
if (typeof options.https[property] === "undefined") {
|
|
523
|
+
// eslint-disable-next-line no-continue
|
|
524
|
+
continue;
|
|
525
|
+
}
|
|
526
|
+
|
|
521
527
|
const value = options.https[property];
|
|
522
|
-
const
|
|
528
|
+
const readFile = (item) => {
|
|
529
|
+
if (
|
|
530
|
+
Buffer.isBuffer(item) ||
|
|
531
|
+
(typeof item === "object" && item !== null && !Array.isArray(item))
|
|
532
|
+
) {
|
|
533
|
+
return item;
|
|
534
|
+
}
|
|
523
535
|
|
|
524
|
-
|
|
525
|
-
|
|
536
|
+
if (item) {
|
|
537
|
+
let stats = null;
|
|
526
538
|
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
539
|
+
try {
|
|
540
|
+
stats = fs.lstatSync(fs.realpathSync(item)).isFile();
|
|
541
|
+
} catch (error) {
|
|
542
|
+
// Ignore error
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
// It is file
|
|
546
|
+
return stats ? fs.readFileSync(item) : item;
|
|
531
547
|
}
|
|
548
|
+
};
|
|
532
549
|
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
: value;
|
|
537
|
-
}
|
|
550
|
+
options.https[property] = Array.isArray(value)
|
|
551
|
+
? value.map((item) => readFile(item))
|
|
552
|
+
: readFile(value);
|
|
538
553
|
}
|
|
539
554
|
|
|
540
555
|
let fakeCert;
|
|
@@ -654,6 +669,18 @@ class Server {
|
|
|
654
669
|
this.logger.info(`SSL certificate: ${certificatePath}`);
|
|
655
670
|
}
|
|
656
671
|
|
|
672
|
+
if (options.https.cacert) {
|
|
673
|
+
if (options.https.ca) {
|
|
674
|
+
this.logger.warn(
|
|
675
|
+
"Do not specify 'https.ca' and 'https.cacert' options together, the 'https.ca' option will be used."
|
|
676
|
+
);
|
|
677
|
+
} else {
|
|
678
|
+
options.https.ca = options.https.cacert;
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
delete options.https.cacert;
|
|
682
|
+
}
|
|
683
|
+
|
|
657
684
|
options.https.key = options.https.key || fakeCert;
|
|
658
685
|
options.https.cert = options.https.cert || fakeCert;
|
|
659
686
|
}
|
|
@@ -1850,6 +1877,10 @@ class Server {
|
|
|
1850
1877
|
return false;
|
|
1851
1878
|
}
|
|
1852
1879
|
|
|
1880
|
+
if (/^(file|.+-extension):/i.test(hostHeader)) {
|
|
1881
|
+
return true;
|
|
1882
|
+
}
|
|
1883
|
+
|
|
1853
1884
|
// use the node url-parser to retrieve the hostname from the host-header.
|
|
1854
1885
|
const hostname = url.parse(
|
|
1855
1886
|
// if hostHeader doesn't have scheme, add // for parsing.
|
package/lib/options.json
CHANGED
|
@@ -201,7 +201,7 @@
|
|
|
201
201
|
},
|
|
202
202
|
{
|
|
203
203
|
"type": "object",
|
|
204
|
-
"additionalProperties":
|
|
204
|
+
"additionalProperties": true,
|
|
205
205
|
"properties": {
|
|
206
206
|
"passphrase": {
|
|
207
207
|
"type": "string",
|
|
@@ -211,8 +211,45 @@
|
|
|
211
211
|
"type": "boolean",
|
|
212
212
|
"description": "Request for an SSL certificate."
|
|
213
213
|
},
|
|
214
|
+
"ca": {
|
|
215
|
+
"anyOf": [
|
|
216
|
+
{
|
|
217
|
+
"type": "array",
|
|
218
|
+
"items": {
|
|
219
|
+
"anyOf": [
|
|
220
|
+
{
|
|
221
|
+
"type": "string"
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
"instanceof": "Buffer"
|
|
225
|
+
}
|
|
226
|
+
]
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
"type": "string"
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
"instanceof": "Buffer"
|
|
234
|
+
}
|
|
235
|
+
],
|
|
236
|
+
"description": "Path to an SSL CA certificate or content of an SSL CA certificate."
|
|
237
|
+
},
|
|
214
238
|
"cacert": {
|
|
215
239
|
"anyOf": [
|
|
240
|
+
{
|
|
241
|
+
"type": "array",
|
|
242
|
+
"items": {
|
|
243
|
+
"anyOf": [
|
|
244
|
+
{
|
|
245
|
+
"type": "string"
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
"instanceof": "Buffer"
|
|
249
|
+
}
|
|
250
|
+
]
|
|
251
|
+
}
|
|
252
|
+
},
|
|
216
253
|
{
|
|
217
254
|
"type": "string"
|
|
218
255
|
},
|
|
@@ -220,10 +257,23 @@
|
|
|
220
257
|
"instanceof": "Buffer"
|
|
221
258
|
}
|
|
222
259
|
],
|
|
223
|
-
"description": "Path to an SSL CA certificate."
|
|
260
|
+
"description": "Path to an SSL CA certificate or content of an SSL CA certificate."
|
|
224
261
|
},
|
|
225
|
-
"
|
|
262
|
+
"cert": {
|
|
226
263
|
"anyOf": [
|
|
264
|
+
{
|
|
265
|
+
"type": "array",
|
|
266
|
+
"items": {
|
|
267
|
+
"anyOf": [
|
|
268
|
+
{
|
|
269
|
+
"type": "string"
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
"instanceof": "Buffer"
|
|
273
|
+
}
|
|
274
|
+
]
|
|
275
|
+
}
|
|
276
|
+
},
|
|
227
277
|
{
|
|
228
278
|
"type": "string"
|
|
229
279
|
},
|
|
@@ -231,10 +281,23 @@
|
|
|
231
281
|
"instanceof": "Buffer"
|
|
232
282
|
}
|
|
233
283
|
],
|
|
234
|
-
"description": "Path to an SSL
|
|
284
|
+
"description": "Path to an SSL certificate or content of an SSL certificate."
|
|
235
285
|
},
|
|
236
|
-
"
|
|
286
|
+
"crl": {
|
|
237
287
|
"anyOf": [
|
|
288
|
+
{
|
|
289
|
+
"type": "array",
|
|
290
|
+
"items": {
|
|
291
|
+
"anyOf": [
|
|
292
|
+
{
|
|
293
|
+
"type": "string"
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
"instanceof": "Buffer"
|
|
297
|
+
}
|
|
298
|
+
]
|
|
299
|
+
}
|
|
300
|
+
},
|
|
238
301
|
{
|
|
239
302
|
"type": "string"
|
|
240
303
|
},
|
|
@@ -242,10 +305,55 @@
|
|
|
242
305
|
"instanceof": "Buffer"
|
|
243
306
|
}
|
|
244
307
|
],
|
|
245
|
-
"description": "Path to
|
|
308
|
+
"description": "Path to PEM formatted CRLs (Certificate Revocation Lists) or content of PEM formatted CRLs (Certificate Revocation Lists)."
|
|
246
309
|
},
|
|
247
|
-
"
|
|
310
|
+
"key": {
|
|
311
|
+
"anyOf": [
|
|
312
|
+
{
|
|
313
|
+
"type": "array",
|
|
314
|
+
"items": {
|
|
315
|
+
"anyOf": [
|
|
316
|
+
{
|
|
317
|
+
"type": "string"
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
"instanceof": "Buffer"
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
"type": "object",
|
|
324
|
+
"additionalProperties": true
|
|
325
|
+
}
|
|
326
|
+
]
|
|
327
|
+
}
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
"type": "string"
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
"instanceof": "Buffer"
|
|
334
|
+
}
|
|
335
|
+
],
|
|
336
|
+
"description": "Path to an SSL key or content of an SSL key."
|
|
337
|
+
},
|
|
338
|
+
"pfx": {
|
|
248
339
|
"anyOf": [
|
|
340
|
+
{
|
|
341
|
+
"type": "array",
|
|
342
|
+
"items": {
|
|
343
|
+
"anyOf": [
|
|
344
|
+
{
|
|
345
|
+
"type": "string"
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
"instanceof": "Buffer"
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
"type": "object",
|
|
352
|
+
"additionalProperties": true
|
|
353
|
+
}
|
|
354
|
+
]
|
|
355
|
+
}
|
|
356
|
+
},
|
|
249
357
|
{
|
|
250
358
|
"type": "string"
|
|
251
359
|
},
|
|
@@ -253,7 +361,7 @@
|
|
|
253
361
|
"instanceof": "Buffer"
|
|
254
362
|
}
|
|
255
363
|
],
|
|
256
|
-
"description": "Path to an SSL
|
|
364
|
+
"description": "Path to an SSL pfx file or content of an SSL pfx file."
|
|
257
365
|
}
|
|
258
366
|
}
|
|
259
367
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webpack-dev-server",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.2.0",
|
|
4
4
|
"description": "Serves a webpack app. Updates the browser on changes.",
|
|
5
5
|
"bin": "bin/webpack-dev-server.js",
|
|
6
6
|
"main": "lib/Server.js",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"spdy": "^4.0.2",
|
|
56
56
|
"strip-ansi": "^7.0.0",
|
|
57
57
|
"url": "^0.11.0",
|
|
58
|
-
"webpack-dev-middleware": "^5.
|
|
58
|
+
"webpack-dev-middleware": "^5.1.0",
|
|
59
59
|
"ws": "^8.1.0"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|