webpack-dev-server 2.5.0 → 2.7.1
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/LICENSE +20 -20
- package/README.md +86 -86
- package/bin/webpack-dev-server.js +40 -15
- package/client/index.bundle.js +1 -1
- package/client/index.js +204 -188
- package/client/live.bundle.js +2 -2
- package/client/live.html +1 -1
- package/client/live.js +119 -119
- package/client/overlay.js +126 -126
- package/client/page.pug +7 -7
- package/client/socket.js +41 -41
- package/client/sockjs.bundle.js +1 -1
- package/client/sockjs.js +1 -1
- package/client/style.css +58 -58
- package/client/web_modules/jquery/index.js +1 -1
- package/client/web_modules/jquery/jquery-1.8.1.js +9301 -9301
- package/client/webpack.config.js +19 -19
- package/client/webpack.sockjs.config.js +6 -6
- package/lib/OptionsValidationError.js +159 -159
- package/lib/Server.js +603 -599
- package/lib/optionsSchema.json +312 -312
- package/lib/util/addDevServerEntrypoints.js +26 -26
- package/lib/util/createDomain.js +14 -14
- package/package.json +7 -5
package/LICENSE
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
Copyright JS Foundation and other contributors
|
|
2
|
-
|
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
-
a copy of this software and associated documentation files (the
|
|
5
|
-
'Software'), to deal in the Software without restriction, including
|
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
-
the following conditions:
|
|
10
|
-
|
|
11
|
-
The above copyright notice and this permission notice shall be
|
|
12
|
-
included in all copies or substantial portions of the Software.
|
|
13
|
-
|
|
14
|
-
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
17
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
18
|
-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
19
|
-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
20
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
1
|
+
Copyright JS Foundation and other contributors
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
+
a copy of this software and associated documentation files (the
|
|
5
|
+
'Software'), to deal in the Software without restriction, including
|
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
+
the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be
|
|
12
|
+
included in all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
17
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
18
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
19
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
20
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,86 +1,86 @@
|
|
|
1
|
-
# webpack-dev-server
|
|
2
|
-
|
|
3
|
-
[![npm][npm]][npm-url]
|
|
4
|
-
[![node][node]][node-url]
|
|
5
|
-
[![deps][deps]][deps-url]
|
|
6
|
-
[![tests][tests]][tests-url]
|
|
7
|
-
[![coverage][cover]][cover-url]
|
|
8
|
-
[![chat][chat]][chat-url]
|
|
9
|
-
|
|
10
|
-
<div align="center">
|
|
11
|
-
<a href="https://github.com/webpack/webpack">
|
|
12
|
-
<img width="200" height="200"
|
|
13
|
-
src="https://webpack.js.org/assets/icon-square-big.svg">
|
|
14
|
-
</a>
|
|
15
|
-
<h1>webpack Dev Server</h1>
|
|
16
|
-
</div>
|
|
17
|
-
|
|
18
|
-
Use [webpack](https://webpack.js.org) with a development server that provides live reloading. This should be used for **development only**.
|
|
19
|
-
|
|
20
|
-
It uses [webpack-dev-middleware](https://github.com/webpack/webpack-dev-middleware) under the hood, which provides fast in-memory access to the webpack assets.
|
|
21
|
-
|
|
22
|
-
<h2 align="center">Install</h2>
|
|
23
|
-
|
|
24
|
-
```
|
|
25
|
-
npm install webpack-dev-server --save-dev
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
<h2 align="center">Usage</h2>
|
|
29
|
-
|
|
30
|
-
The easiest way to use it is with the CLI. In the directory where your `webpack.config.js` is, run:
|
|
31
|
-
|
|
32
|
-
```
|
|
33
|
-
node_modules/.bin/webpack-dev-server
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
This will start a server, listening on connections from `localhost` on port `8080`.
|
|
37
|
-
|
|
38
|
-
Now, when you change something in your assets, it should live-reload the files.
|
|
39
|
-
|
|
40
|
-
See [**the documentation**](https://webpack.js.org/configuration/dev-server/#devserver) for more use cases and options.
|
|
41
|
-
|
|
42
|
-
<h2 align="center">Contributing</h2>
|
|
43
|
-
|
|
44
|
-
We appreciate all help! Check out [CONTRIBUTING.md](CONTRIBUTING.md) for more information on how to help.
|
|
45
|
-
|
|
46
|
-
<h2 align="center">Maintainers</h2>
|
|
47
|
-
|
|
48
|
-
<table>
|
|
49
|
-
<tbody>
|
|
50
|
-
<tr>
|
|
51
|
-
<td align="center">
|
|
52
|
-
<img width="150" height="150"
|
|
53
|
-
src="https://avatars.githubusercontent.com/SpaceK33z?v=3">
|
|
54
|
-
<br />
|
|
55
|
-
<a href="https://github.com/">Kees Kluskens</a>
|
|
56
|
-
</td>
|
|
57
|
-
</tr>
|
|
58
|
-
</tbody>
|
|
59
|
-
</table>
|
|
60
|
-
|
|
61
|
-
<h2 align="center">Inspiration</h2>
|
|
62
|
-
|
|
63
|
-
This project is heavily inspired by [peerigon/nof5](https://github.com/peerigon/nof5).
|
|
64
|
-
|
|
65
|
-
<h2 align="center">LICENSE</h2>
|
|
66
|
-
|
|
67
|
-
#### [MIT](./LICENSE)
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
[npm]: https://img.shields.io/npm/v/webpack-dev-server.svg
|
|
71
|
-
[npm-url]: https://npmjs.com/package/webpack-dev-server
|
|
72
|
-
|
|
73
|
-
[node]: https://img.shields.io/node/v/webpack-dev-server.svg
|
|
74
|
-
[node-url]: https://nodejs.org
|
|
75
|
-
|
|
76
|
-
[deps]: https://david-dm.org/webpack/webpack-dev-server.svg
|
|
77
|
-
[deps-url]: https://david-dm.org/webpack/webpack-dev-server
|
|
78
|
-
|
|
79
|
-
[tests]: http://img.shields.io/travis/webpack/webpack-dev-server.svg
|
|
80
|
-
[tests-url]: https://travis-ci.org/webpack/webpack-dev-server
|
|
81
|
-
|
|
82
|
-
[cover]: https://codecov.io/gh/webpack/webpack-dev-server/branch/master/graph/badge.svg
|
|
83
|
-
[cover-url]: https://codecov.io/gh/webpack/webpack-dev-server
|
|
84
|
-
|
|
85
|
-
[chat]: https://badges.gitter.im/webpack/webpack.svg
|
|
86
|
-
[chat-url]: https://gitter.im/webpack/webpack
|
|
1
|
+
# webpack-dev-server
|
|
2
|
+
|
|
3
|
+
[![npm][npm]][npm-url]
|
|
4
|
+
[![node][node]][node-url]
|
|
5
|
+
[![deps][deps]][deps-url]
|
|
6
|
+
[![tests][tests]][tests-url]
|
|
7
|
+
[![coverage][cover]][cover-url]
|
|
8
|
+
[![chat][chat]][chat-url]
|
|
9
|
+
|
|
10
|
+
<div align="center">
|
|
11
|
+
<a href="https://github.com/webpack/webpack">
|
|
12
|
+
<img width="200" height="200"
|
|
13
|
+
src="https://webpack.js.org/assets/icon-square-big.svg">
|
|
14
|
+
</a>
|
|
15
|
+
<h1>webpack Dev Server</h1>
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
Use [webpack](https://webpack.js.org) with a development server that provides live reloading. This should be used for **development only**.
|
|
19
|
+
|
|
20
|
+
It uses [webpack-dev-middleware](https://github.com/webpack/webpack-dev-middleware) under the hood, which provides fast in-memory access to the webpack assets.
|
|
21
|
+
|
|
22
|
+
<h2 align="center">Install</h2>
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
npm install webpack-dev-server --save-dev
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
<h2 align="center">Usage</h2>
|
|
29
|
+
|
|
30
|
+
The easiest way to use it is with the CLI. In the directory where your `webpack.config.js` is, run:
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
node_modules/.bin/webpack-dev-server
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
This will start a server, listening on connections from `localhost` on port `8080`.
|
|
37
|
+
|
|
38
|
+
Now, when you change something in your assets, it should live-reload the files.
|
|
39
|
+
|
|
40
|
+
See [**the documentation**](https://webpack.js.org/configuration/dev-server/#devserver) for more use cases and options.
|
|
41
|
+
|
|
42
|
+
<h2 align="center">Contributing</h2>
|
|
43
|
+
|
|
44
|
+
We appreciate all help! Check out [CONTRIBUTING.md](CONTRIBUTING.md) for more information on how to help.
|
|
45
|
+
|
|
46
|
+
<h2 align="center">Maintainers</h2>
|
|
47
|
+
|
|
48
|
+
<table>
|
|
49
|
+
<tbody>
|
|
50
|
+
<tr>
|
|
51
|
+
<td align="center">
|
|
52
|
+
<img width="150" height="150"
|
|
53
|
+
src="https://avatars.githubusercontent.com/SpaceK33z?v=3">
|
|
54
|
+
<br />
|
|
55
|
+
<a href="https://github.com/SpaceK33z">Kees Kluskens</a>
|
|
56
|
+
</td>
|
|
57
|
+
</tr>
|
|
58
|
+
</tbody>
|
|
59
|
+
</table>
|
|
60
|
+
|
|
61
|
+
<h2 align="center">Inspiration</h2>
|
|
62
|
+
|
|
63
|
+
This project is heavily inspired by [peerigon/nof5](https://github.com/peerigon/nof5).
|
|
64
|
+
|
|
65
|
+
<h2 align="center">LICENSE</h2>
|
|
66
|
+
|
|
67
|
+
#### [MIT](./LICENSE)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
[npm]: https://img.shields.io/npm/v/webpack-dev-server.svg
|
|
71
|
+
[npm-url]: https://npmjs.com/package/webpack-dev-server
|
|
72
|
+
|
|
73
|
+
[node]: https://img.shields.io/node/v/webpack-dev-server.svg
|
|
74
|
+
[node-url]: https://nodejs.org
|
|
75
|
+
|
|
76
|
+
[deps]: https://david-dm.org/webpack/webpack-dev-server.svg
|
|
77
|
+
[deps-url]: https://david-dm.org/webpack/webpack-dev-server
|
|
78
|
+
|
|
79
|
+
[tests]: http://img.shields.io/travis/webpack/webpack-dev-server.svg
|
|
80
|
+
[tests-url]: https://travis-ci.org/webpack/webpack-dev-server
|
|
81
|
+
|
|
82
|
+
[cover]: https://codecov.io/gh/webpack/webpack-dev-server/branch/master/graph/badge.svg
|
|
83
|
+
[cover-url]: https://codecov.io/gh/webpack/webpack-dev-server
|
|
84
|
+
|
|
85
|
+
[chat]: https://badges.gitter.im/webpack/webpack.svg
|
|
86
|
+
[chat-url]: https://gitter.im/webpack/webpack
|
|
@@ -8,7 +8,6 @@ const net = require("net");
|
|
|
8
8
|
const portfinder = require("portfinder");
|
|
9
9
|
const addDevServerEntrypoints = require("../lib/util/addDevServerEntrypoints");
|
|
10
10
|
const createDomain = require("../lib/util/createDomain");
|
|
11
|
-
const bonjour = require("bonjour")();
|
|
12
11
|
|
|
13
12
|
// Local version replaces global one
|
|
14
13
|
try {
|
|
@@ -185,6 +184,11 @@ yargs.options({
|
|
|
185
184
|
describe: "The port",
|
|
186
185
|
group: CONNECTION_GROUP
|
|
187
186
|
},
|
|
187
|
+
"disable-host-check": {
|
|
188
|
+
type: "boolean",
|
|
189
|
+
describe: "Will not check the host",
|
|
190
|
+
group: CONNECTION_GROUP
|
|
191
|
+
},
|
|
188
192
|
"socket": {
|
|
189
193
|
type: "String",
|
|
190
194
|
describe: "Socket to listen",
|
|
@@ -200,6 +204,11 @@ yargs.options({
|
|
|
200
204
|
default: "localhost",
|
|
201
205
|
describe: "The hostname/ip address the server will bind to",
|
|
202
206
|
group: CONNECTION_GROUP
|
|
207
|
+
},
|
|
208
|
+
"allowed-hosts": {
|
|
209
|
+
type: "string",
|
|
210
|
+
describe: "A comma-delimited string of hosts that are allowed to access the dev server",
|
|
211
|
+
group: CONNECTION_GROUP
|
|
203
212
|
}
|
|
204
213
|
});
|
|
205
214
|
|
|
@@ -229,6 +238,9 @@ function processOptions(wpOpt) {
|
|
|
229
238
|
if(argv.host !== "localhost" || !options.host)
|
|
230
239
|
options.host = argv.host;
|
|
231
240
|
|
|
241
|
+
if(argv["allowed-hosts"])
|
|
242
|
+
options.allowedHosts = argv["allowed-hosts"].split(",");
|
|
243
|
+
|
|
232
244
|
if(argv.public)
|
|
233
245
|
options.public = argv.public;
|
|
234
246
|
|
|
@@ -329,11 +341,17 @@ function processOptions(wpOpt) {
|
|
|
329
341
|
if(argv["compress"])
|
|
330
342
|
options.compress = true;
|
|
331
343
|
|
|
344
|
+
if(argv["disable-host-check"])
|
|
345
|
+
options.disableHostCheck = true;
|
|
346
|
+
|
|
332
347
|
if(argv["open"] || argv["open-page"]) {
|
|
333
348
|
options.open = true;
|
|
334
|
-
options.openPage = argv["open-page"]
|
|
349
|
+
options.openPage = argv["open-page"];
|
|
335
350
|
}
|
|
336
351
|
|
|
352
|
+
if(options.open && !options.openPage)
|
|
353
|
+
options.openPage = "";
|
|
354
|
+
|
|
337
355
|
if(argv["useLocalIp"])
|
|
338
356
|
options.useLocalIp = true;
|
|
339
357
|
|
|
@@ -433,28 +451,35 @@ function startDevServer(wpOpt, options) {
|
|
|
433
451
|
|
|
434
452
|
function reportReadiness(uri, options) {
|
|
435
453
|
const useColor = argv.color;
|
|
436
|
-
let startSentence = `Project is running at ${colorInfo(useColor, uri)}`
|
|
437
|
-
if(options.socket) {
|
|
438
|
-
startSentence = `Listening to socket at ${colorInfo(useColor, options.socket)}`;
|
|
439
|
-
}
|
|
440
|
-
console.log((argv["progress"] ? "\n" : "") + startSentence);
|
|
441
|
-
|
|
442
|
-
console.log(`webpack output is served from ${colorInfo(useColor, options.publicPath)}`);
|
|
443
454
|
const contentBase = Array.isArray(options.contentBase) ? options.contentBase.join(", ") : options.contentBase;
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
455
|
+
|
|
456
|
+
if(!options.quiet) {
|
|
457
|
+
let startSentence = `Project is running at ${colorInfo(useColor, uri)}`
|
|
458
|
+
if(options.socket) {
|
|
459
|
+
startSentence = `Listening to socket at ${colorInfo(useColor, options.socket)}`;
|
|
460
|
+
}
|
|
461
|
+
console.log((argv["progress"] ? "\n" : "") + startSentence);
|
|
462
|
+
|
|
463
|
+
console.log(`webpack output is served from ${colorInfo(useColor, options.publicPath)}`);
|
|
464
|
+
|
|
465
|
+
if(contentBase)
|
|
466
|
+
console.log(`Content not from webpack is served from ${colorInfo(useColor, contentBase)}`);
|
|
467
|
+
|
|
468
|
+
if(options.historyApiFallback)
|
|
469
|
+
console.log(`404s will fallback to ${colorInfo(useColor, options.historyApiFallback.index || "/index.html")}`);
|
|
470
|
+
|
|
471
|
+
if(options.bonjour)
|
|
472
|
+
console.log("Broadcasting \"http\" with subtype of \"webpack\" via ZeroConf DNS (Bonjour)");
|
|
473
|
+
}
|
|
448
474
|
if(options.open) {
|
|
449
475
|
open(uri + options.openPage).catch(function() {
|
|
450
476
|
console.log("Unable to open browser. If you are running in a headless environment, please do not use the open flag.");
|
|
451
477
|
});
|
|
452
478
|
}
|
|
453
|
-
if(options.bonjour)
|
|
454
|
-
console.log("Broadcasting \"http\" with subtype of \"webpack\" via ZeroConf DNS (Bonjour)");
|
|
455
479
|
}
|
|
456
480
|
|
|
457
481
|
function broadcastZeroconf(options) {
|
|
482
|
+
const bonjour = require("bonjour")();
|
|
458
483
|
bonjour.publish({
|
|
459
484
|
name: "Webpack Dev Server",
|
|
460
485
|
port: options.port,
|