webpack-dev-server 3.1.6 → 3.1.10
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/CHANGELOG.md +38 -0
- package/README.md +2 -2
- package/bin/options.js +164 -0
- package/bin/utils.js +114 -0
- package/bin/webpack-dev-server.js +244 -328
- package/client/index.bundle.js +1 -1
- package/client/live.bundle.js +3 -3
- package/client/sockjs.bundle.js +1 -1
- package/lib/Server.js +392 -208
- package/lib/options.json +365 -0
- package/lib/utils/addEntries.js +55 -0
- package/lib/utils/createCertificate.js +65 -0
- package/lib/utils/createDomain.js +35 -0
- package/lib/utils/createLogger.js +26 -0
- package/package.json +9 -7
- package/lib/OptionsValidationError.js +0 -152
- package/lib/createLog.js +0 -19
- package/lib/optionsSchema.json +0 -350
- package/lib/util/addDevServerEntrypoints.js +0 -44
- package/lib/util/createDomain.js +0 -23
- package/ssl/server.pem +0 -46
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,44 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
<a name="3.1.10"></a>
|
|
6
|
+
## [3.1.10](https://github.com/webpack/webpack-dev-server/compare/v3.1.9...v3.1.10) (2018-10-23)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **options:** add `writeToDisk` option to schema ([#1520](https://github.com/webpack/webpack-dev-server/issues/1520)) ([d2f4902](https://github.com/webpack/webpack-dev-server/commit/d2f4902))
|
|
12
|
+
* **package:** update `sockjs-client` v1.1.5...1.3.0 (`url-parse` vulnerability) ([#1537](https://github.com/webpack/webpack-dev-server/issues/1537)) ([e719959](https://github.com/webpack/webpack-dev-server/commit/e719959))
|
|
13
|
+
* **Server:** set `tls.DEFAULT_ECDH_CURVE` to `'auto'` ([#1531](https://github.com/webpack/webpack-dev-server/issues/1531)) ([c12def3](https://github.com/webpack/webpack-dev-server/commit/c12def3))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
<a name="3.1.9"></a>
|
|
18
|
+
## [3.1.9](https://github.com/webpack/webpack-dev-server/compare/v3.1.8...v3.1.9) (2018-09-24)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
<a name="3.1.8"></a>
|
|
23
|
+
## [3.1.8](https://github.com/webpack/webpack-dev-server/compare/v3.1.7...v3.1.8) (2018-09-06)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### Bug Fixes
|
|
27
|
+
|
|
28
|
+
* **package:** `yargs` security vulnerability (`dependencies`) ([#1492](https://github.com/webpack/webpack-dev-server/issues/1492)) ([8fb67c9](https://github.com/webpack/webpack-dev-server/commit/8fb67c9))
|
|
29
|
+
* **utils/createLogger:** ensure `quiet` always takes precedence (`options.quiet`) ([#1486](https://github.com/webpack/webpack-dev-server/issues/1486)) ([7a6ca47](https://github.com/webpack/webpack-dev-server/commit/7a6ca47))
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
<a name="3.1.7"></a>
|
|
34
|
+
## [3.1.7](https://github.com/webpack/webpack-dev-server/compare/v3.1.6...v3.1.7) (2018-08-29)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
### Bug Fixes
|
|
38
|
+
|
|
39
|
+
* **Server:** don't use `spdy` on `node >= v10.0.0` ([#1451](https://github.com/webpack/webpack-dev-server/issues/1451)) ([8ab9eb6](https://github.com/webpack/webpack-dev-server/commit/8ab9eb6))
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
5
43
|
<a name="3.1.6"></a>
|
|
6
44
|
## [3.1.6](https://github.com/webpack/webpack-dev-server/compare/v3.1.5...v3.1.6) (2018-08-26)
|
|
7
45
|
|
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ fast in-memory access to the webpack assets.
|
|
|
21
21
|
|
|
22
22
|
## Getting Started
|
|
23
23
|
|
|
24
|
-
First
|
|
24
|
+
First things first, install the module:
|
|
25
25
|
|
|
26
26
|
```console
|
|
27
27
|
npm install webpack-dev-server --save-dev
|
|
@@ -106,7 +106,7 @@ question. Remember; It's always much easier to answer questions that include you
|
|
|
106
106
|
If you're twitter-savvy you can tweet [#webpack][hash-url] with your question
|
|
107
107
|
and someone should be able to reach out and lend a hand.
|
|
108
108
|
|
|
109
|
-
If you have discovered a :bug:, have a feature suggestion,
|
|
109
|
+
If you have discovered a :bug:, have a feature suggestion, or would like to see
|
|
110
110
|
a modification, please feel free to create an issue on Github. _Note: The issue
|
|
111
111
|
template isn't optional, so please be sure not to remove it, and please fill it
|
|
112
112
|
out completely._
|
package/bin/options.js
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/* eslint-disable
|
|
4
|
+
global-require,
|
|
5
|
+
multiline-ternary,
|
|
6
|
+
space-before-function-paren
|
|
7
|
+
*/
|
|
8
|
+
const ADVANCED_GROUP = 'Advanced options:';
|
|
9
|
+
const DISPLAY_GROUP = 'Stats options:';
|
|
10
|
+
const SSL_GROUP = 'SSL options:';
|
|
11
|
+
const CONNECTION_GROUP = 'Connection options:';
|
|
12
|
+
const RESPONSE_GROUP = 'Response options:';
|
|
13
|
+
const BASIC_GROUP = 'Basic options:';
|
|
14
|
+
|
|
15
|
+
const options = {
|
|
16
|
+
bonjour: {
|
|
17
|
+
type: 'boolean',
|
|
18
|
+
describe: 'Broadcasts the server via ZeroConf networking on start'
|
|
19
|
+
},
|
|
20
|
+
lazy: {
|
|
21
|
+
type: 'boolean',
|
|
22
|
+
describe: 'Lazy'
|
|
23
|
+
},
|
|
24
|
+
inline: {
|
|
25
|
+
type: 'boolean',
|
|
26
|
+
default: true,
|
|
27
|
+
describe: 'Inline mode (set to false to disable including client scripts like livereload)'
|
|
28
|
+
},
|
|
29
|
+
progress: {
|
|
30
|
+
type: 'boolean',
|
|
31
|
+
describe: 'Print compilation progress in percentage',
|
|
32
|
+
group: BASIC_GROUP
|
|
33
|
+
},
|
|
34
|
+
'hot-only': {
|
|
35
|
+
type: 'boolean',
|
|
36
|
+
describe: 'Do not refresh page if HMR fails',
|
|
37
|
+
group: ADVANCED_GROUP
|
|
38
|
+
},
|
|
39
|
+
stdin: {
|
|
40
|
+
type: 'boolean',
|
|
41
|
+
describe: 'close when stdin ends'
|
|
42
|
+
},
|
|
43
|
+
open: {
|
|
44
|
+
type: 'string',
|
|
45
|
+
describe: 'Open the default browser, or optionally specify a browser name'
|
|
46
|
+
},
|
|
47
|
+
useLocalIp: {
|
|
48
|
+
type: 'boolean',
|
|
49
|
+
describe: 'Open default browser with local IP'
|
|
50
|
+
},
|
|
51
|
+
'open-page': {
|
|
52
|
+
type: 'string',
|
|
53
|
+
describe: 'Open default browser with the specified page',
|
|
54
|
+
requiresArg: true
|
|
55
|
+
},
|
|
56
|
+
color: {
|
|
57
|
+
type: 'boolean',
|
|
58
|
+
alias: 'colors',
|
|
59
|
+
default: function supportsColor() {
|
|
60
|
+
return require('supports-color');
|
|
61
|
+
},
|
|
62
|
+
group: DISPLAY_GROUP,
|
|
63
|
+
describe: 'Enables/Disables colors on the console'
|
|
64
|
+
},
|
|
65
|
+
info: {
|
|
66
|
+
type: 'boolean',
|
|
67
|
+
group: DISPLAY_GROUP,
|
|
68
|
+
default: true,
|
|
69
|
+
describe: 'Info'
|
|
70
|
+
},
|
|
71
|
+
quiet: {
|
|
72
|
+
type: 'boolean',
|
|
73
|
+
group: DISPLAY_GROUP,
|
|
74
|
+
describe: 'Quiet'
|
|
75
|
+
},
|
|
76
|
+
'client-log-level': {
|
|
77
|
+
type: 'string',
|
|
78
|
+
group: DISPLAY_GROUP,
|
|
79
|
+
default: 'info',
|
|
80
|
+
describe: 'Log level in the browser (info, warning, error or none)'
|
|
81
|
+
},
|
|
82
|
+
https: {
|
|
83
|
+
type: 'boolean',
|
|
84
|
+
group: SSL_GROUP,
|
|
85
|
+
describe: 'HTTPS'
|
|
86
|
+
},
|
|
87
|
+
key: {
|
|
88
|
+
type: 'string',
|
|
89
|
+
describe: 'Path to a SSL key.',
|
|
90
|
+
group: SSL_GROUP
|
|
91
|
+
},
|
|
92
|
+
cert: {
|
|
93
|
+
type: 'string',
|
|
94
|
+
describe: 'Path to a SSL certificate.',
|
|
95
|
+
group: SSL_GROUP
|
|
96
|
+
},
|
|
97
|
+
cacert: {
|
|
98
|
+
type: 'string',
|
|
99
|
+
describe: 'Path to a SSL CA certificate.',
|
|
100
|
+
group: SSL_GROUP
|
|
101
|
+
},
|
|
102
|
+
pfx: {
|
|
103
|
+
type: 'string',
|
|
104
|
+
describe: 'Path to a SSL pfx file.',
|
|
105
|
+
group: SSL_GROUP
|
|
106
|
+
},
|
|
107
|
+
'pfx-passphrase': {
|
|
108
|
+
type: 'string',
|
|
109
|
+
describe: 'Passphrase for pfx file.',
|
|
110
|
+
group: SSL_GROUP
|
|
111
|
+
},
|
|
112
|
+
'content-base': {
|
|
113
|
+
type: 'string',
|
|
114
|
+
describe: 'A directory or URL to serve HTML content from.',
|
|
115
|
+
group: RESPONSE_GROUP
|
|
116
|
+
},
|
|
117
|
+
'watch-content-base': {
|
|
118
|
+
type: 'boolean',
|
|
119
|
+
describe: 'Enable live-reloading of the content-base.',
|
|
120
|
+
group: RESPONSE_GROUP
|
|
121
|
+
},
|
|
122
|
+
'history-api-fallback': {
|
|
123
|
+
type: 'boolean',
|
|
124
|
+
describe: 'Fallback to /index.html for Single Page Applications.',
|
|
125
|
+
group: RESPONSE_GROUP
|
|
126
|
+
},
|
|
127
|
+
compress: {
|
|
128
|
+
type: 'boolean',
|
|
129
|
+
describe: 'Enable gzip compression',
|
|
130
|
+
group: RESPONSE_GROUP
|
|
131
|
+
},
|
|
132
|
+
port: {
|
|
133
|
+
describe: 'The port',
|
|
134
|
+
group: CONNECTION_GROUP
|
|
135
|
+
},
|
|
136
|
+
'disable-host-check': {
|
|
137
|
+
type: 'boolean',
|
|
138
|
+
describe: 'Will not check the host',
|
|
139
|
+
group: CONNECTION_GROUP
|
|
140
|
+
},
|
|
141
|
+
socket: {
|
|
142
|
+
type: 'String',
|
|
143
|
+
describe: 'Socket to listen',
|
|
144
|
+
group: CONNECTION_GROUP
|
|
145
|
+
},
|
|
146
|
+
public: {
|
|
147
|
+
type: 'string',
|
|
148
|
+
describe: 'The public hostname/ip address of the server',
|
|
149
|
+
group: CONNECTION_GROUP
|
|
150
|
+
},
|
|
151
|
+
host: {
|
|
152
|
+
type: 'string',
|
|
153
|
+
default: 'localhost',
|
|
154
|
+
describe: 'The hostname/ip address the server will bind to',
|
|
155
|
+
group: CONNECTION_GROUP
|
|
156
|
+
},
|
|
157
|
+
'allowed-hosts': {
|
|
158
|
+
type: 'string',
|
|
159
|
+
describe: 'A comma-delimited string of hosts that are allowed to access the dev server',
|
|
160
|
+
group: CONNECTION_GROUP
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
module.exports = options;
|
package/bin/utils.js
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/* eslint-disable
|
|
4
|
+
no-shadow,
|
|
5
|
+
global-require,
|
|
6
|
+
multiline-ternary,
|
|
7
|
+
array-bracket-spacing,
|
|
8
|
+
space-before-function-paren
|
|
9
|
+
*/
|
|
10
|
+
const open = require('opn');
|
|
11
|
+
|
|
12
|
+
const colors = {
|
|
13
|
+
info (useColor, msg) {
|
|
14
|
+
if (useColor) {
|
|
15
|
+
// Make text blue and bold, so it *pops*
|
|
16
|
+
return `\u001b[1m\u001b[34m${msg}\u001b[39m\u001b[22m`;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return msg;
|
|
20
|
+
},
|
|
21
|
+
error (useColor, msg) {
|
|
22
|
+
if (useColor) {
|
|
23
|
+
// Make text red and bold, so it *pops*
|
|
24
|
+
return `\u001b[1m\u001b[31m${msg}\u001b[39m\u001b[22m`;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return msg;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
// eslint-disable-next-line
|
|
32
|
+
const defaultTo = (value, def) => {
|
|
33
|
+
return value == null ? def : value;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
function version () {
|
|
37
|
+
return `webpack-dev-server ${require('../package.json').version}\n` +
|
|
38
|
+
`webpack ${require('webpack/package.json').version}`;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function status (uri, options, log, useColor) {
|
|
42
|
+
const contentBase = Array.isArray(options.contentBase)
|
|
43
|
+
? options.contentBase.join(', ')
|
|
44
|
+
: options.contentBase;
|
|
45
|
+
|
|
46
|
+
if (options.socket) {
|
|
47
|
+
log.info(`Listening to socket at ${colors.info(useColor, options.socket)}`);
|
|
48
|
+
} else {
|
|
49
|
+
log.info(`Project is running at ${colors.info(useColor, uri)}`);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
log.info(
|
|
53
|
+
`webpack output is served from ${colors.info(useColor, options.publicPath)}`
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
if (contentBase) {
|
|
57
|
+
log.info(
|
|
58
|
+
`Content not from webpack is served from ${colors.info(useColor, contentBase)}`
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (options.historyApiFallback) {
|
|
63
|
+
log.info(
|
|
64
|
+
`404s will fallback to ${colors.info(useColor, options.historyApiFallback.index || '/index.html')}`
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (options.bonjour) {
|
|
69
|
+
log.info(
|
|
70
|
+
'Broadcasting "http" with subtype of "webpack" via ZeroConf DNS (Bonjour)'
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (options.open) {
|
|
75
|
+
let openOptions = {};
|
|
76
|
+
let openMessage = 'Unable to open browser';
|
|
77
|
+
|
|
78
|
+
if (typeof options.open === 'string') {
|
|
79
|
+
openOptions = { app: options.open };
|
|
80
|
+
openMessage += `: ${options.open}`;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
open(uri + (options.openPage || ''), openOptions).catch(() => {
|
|
84
|
+
log.warn(
|
|
85
|
+
`${openMessage}. If you are running in a headless environment, please do not use the --open flag`
|
|
86
|
+
);
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function bonjour (options) {
|
|
92
|
+
const bonjour = require('bonjour')();
|
|
93
|
+
|
|
94
|
+
bonjour.publish({
|
|
95
|
+
name: 'Webpack Dev Server',
|
|
96
|
+
port: options.port,
|
|
97
|
+
type: 'http',
|
|
98
|
+
subtypes: [ 'webpack' ]
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
process.on('exit', () => {
|
|
102
|
+
bonjour.unpublishAll(() => {
|
|
103
|
+
bonjour.destroy();
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
module.exports = {
|
|
109
|
+
status,
|
|
110
|
+
colors,
|
|
111
|
+
version,
|
|
112
|
+
bonjour,
|
|
113
|
+
defaultTo
|
|
114
|
+
};
|