webpack-dev-server 3.1.5 → 3.1.9
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 +39 -0
- package/README.md +2 -13
- package/bin/options.js +164 -0
- package/bin/utils.js +114 -0
- package/bin/webpack-dev-server.js +254 -334
- package/client/live.bundle.js +1 -1
- package/client/sockjs.bundle.js +1 -1
- package/lib/Server.js +381 -209
- package/lib/options.json +354 -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 +43 -52
- package/lib/OptionsValidationError.js +0 -152
- package/lib/createLog.js +0 -19
- package/lib/optionsSchema.json +0 -347
- package/lib/polyfills.js +0 -8
- package/lib/util/addDevServerEntrypoints.js +0 -44
- package/lib/util/createDomain.js +0 -23
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
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
|
+
|
|
5
|
+
<a name="3.1.9"></a>
|
|
6
|
+
## [3.1.9](https://github.com/webpack/webpack-dev-server/compare/v3.1.8...v3.1.9) (2018-09-24)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
<a name="3.1.8"></a>
|
|
11
|
+
## [3.1.8](https://github.com/webpack/webpack-dev-server/compare/v3.1.7...v3.1.8) (2018-09-06)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* **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))
|
|
17
|
+
* **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))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
<a name="3.1.7"></a>
|
|
22
|
+
## [3.1.7](https://github.com/webpack/webpack-dev-server/compare/v3.1.6...v3.1.7) (2018-08-29)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
* **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))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
<a name="3.1.6"></a>
|
|
32
|
+
## [3.1.6](https://github.com/webpack/webpack-dev-server/compare/v3.1.5...v3.1.6) (2018-08-26)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
### Bug Fixes
|
|
36
|
+
|
|
37
|
+
* **bin:** handle `process` signals correctly when the server isn't ready yet ([#1432](https://github.com/webpack/webpack-dev-server/issues/1432)) ([334c3a5](https://github.com/webpack/webpack-dev-server/commit/334c3a5))
|
|
38
|
+
* **examples/cli:** correct template path in `open-page` example ([#1401](https://github.com/webpack/webpack-dev-server/issues/1401)) ([df30727](https://github.com/webpack/webpack-dev-server/commit/df30727))
|
|
39
|
+
* **schema:** allow the `output` filename to be a `{Function}` ([#1409](https://github.com/webpack/webpack-dev-server/issues/1409)) ([e2220c4](https://github.com/webpack/webpack-dev-server/commit/e2220c4))
|
package/README.md
CHANGED
|
@@ -19,20 +19,9 @@ live reloading. This should be used for **development only**.
|
|
|
19
19
|
It uses [webpack-dev-middleware][middleware-url] under the hood, which provides
|
|
20
20
|
fast in-memory access to the webpack assets.
|
|
21
21
|
|
|
22
|
-
## Project in Maintenance
|
|
23
|
-
|
|
24
|
-
**Please note that `webpack-dev-server` is presently in a maintenance-only mode**
|
|
25
|
-
and will not be accepting any additional features in the near term. Most new feature
|
|
26
|
-
requests can be accomplished with Express middleware; please look into using
|
|
27
|
-
the [`before`](https://webpack.js.org/configuration/dev-server/#devserver-before)
|
|
28
|
-
and [`after`](https://webpack.js.org/configuration/dev-server/#devserver-after)
|
|
29
|
-
hooks in the documentation.
|
|
30
|
-
|
|
31
|
-
Use [webpack-serve](https://github.com/webpack-contrib/webpack-serve) for a fast alternative. Use webpack-dev-server if you need to test on old browsers.
|
|
32
|
-
|
|
33
22
|
## Getting Started
|
|
34
23
|
|
|
35
|
-
First
|
|
24
|
+
First things first, install the module:
|
|
36
25
|
|
|
37
26
|
```console
|
|
38
27
|
npm install webpack-dev-server --save-dev
|
|
@@ -117,7 +106,7 @@ question. Remember; It's always much easier to answer questions that include you
|
|
|
117
106
|
If you're twitter-savvy you can tweet [#webpack][hash-url] with your question
|
|
118
107
|
and someone should be able to reach out and lend a hand.
|
|
119
108
|
|
|
120
|
-
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
|
|
121
110
|
a modification, please feel free to create an issue on Github. _Note: The issue
|
|
122
111
|
template isn't optional, so please be sure not to remove it, and please fill it
|
|
123
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
|
+
};
|