webpack-dev-server 2.4.2 → 2.5.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/LICENSE +20 -20
- package/README.md +86 -86
- package/bin/webpack-dev-server.js +45 -4
- package/client/index.bundle.js +1 -1
- package/client/index.js +188 -181
- package/client/live.bundle.js +3 -3
- 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 +599 -509
- package/lib/optionsSchema.json +312 -289
- package/lib/util/addDevServerEntrypoints.js +26 -26
- package/lib/util/createDomain.js +14 -13
- package/package.json +6 -2
- package/ssl/.gitkeep +0 -0
- package/ssl/server.pem +0 -46
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/">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,6 +8,7 @@ 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")();
|
|
11
12
|
|
|
12
13
|
// Local version replaces global one
|
|
13
14
|
try {
|
|
@@ -39,6 +40,8 @@ function colorError(useColor, msg) {
|
|
|
39
40
|
return msg;
|
|
40
41
|
}
|
|
41
42
|
|
|
43
|
+
const defaultTo = (value, def) => value == null ? def : value;
|
|
44
|
+
|
|
42
45
|
const yargs = require("yargs")
|
|
43
46
|
.usage(`${versionInfo()
|
|
44
47
|
}\nUsage: https://webpack.js.org/configuration/dev-server/`);
|
|
@@ -62,6 +65,10 @@ const BASIC_GROUP = "Basic options:";
|
|
|
62
65
|
const DEFAULT_PORT = 8080;
|
|
63
66
|
|
|
64
67
|
yargs.options({
|
|
68
|
+
"bonjour": {
|
|
69
|
+
type: "boolean",
|
|
70
|
+
describe: "Broadcasts the server via ZeroConf networking on start"
|
|
71
|
+
},
|
|
65
72
|
"lazy": {
|
|
66
73
|
type: "boolean",
|
|
67
74
|
describe: "Lazy"
|
|
@@ -89,6 +96,15 @@ yargs.options({
|
|
|
89
96
|
type: "boolean",
|
|
90
97
|
describe: "Open default browser"
|
|
91
98
|
},
|
|
99
|
+
"useLocalIp": {
|
|
100
|
+
type: "boolean",
|
|
101
|
+
describe: "Open default browser with local IP"
|
|
102
|
+
},
|
|
103
|
+
"open-page": {
|
|
104
|
+
type: "string",
|
|
105
|
+
describe: "Open default browser with the specified page",
|
|
106
|
+
requiresArg: true,
|
|
107
|
+
},
|
|
92
108
|
"color": {
|
|
93
109
|
type: "boolean",
|
|
94
110
|
alias: "colors",
|
|
@@ -207,6 +223,9 @@ function processOptions(wpOpt) {
|
|
|
207
223
|
|
|
208
224
|
const options = wpOpt.devServer || firstWpOpt.devServer || {};
|
|
209
225
|
|
|
226
|
+
if(argv.bonjour)
|
|
227
|
+
options.bonjour = true;
|
|
228
|
+
|
|
210
229
|
if(argv.host !== "localhost" || !options.host)
|
|
211
230
|
options.host = argv.host;
|
|
212
231
|
|
|
@@ -310,15 +329,20 @@ function processOptions(wpOpt) {
|
|
|
310
329
|
if(argv["compress"])
|
|
311
330
|
options.compress = true;
|
|
312
331
|
|
|
313
|
-
if(argv["open"])
|
|
332
|
+
if(argv["open"] || argv["open-page"]) {
|
|
314
333
|
options.open = true;
|
|
334
|
+
options.openPage = argv["open-page"] || "";
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
if(argv["useLocalIp"])
|
|
338
|
+
options.useLocalIp = true;
|
|
315
339
|
|
|
316
340
|
// Kind of weird, but ensures prior behavior isn't broken in cases
|
|
317
341
|
// that wouldn't throw errors. E.g. both argv.port and options.port
|
|
318
342
|
// were specified, but since argv.port is 8080, options.port will be
|
|
319
343
|
// tried first instead.
|
|
320
|
-
options.port = argv.port === DEFAULT_PORT ? (options.port
|
|
321
|
-
if(options.port) {
|
|
344
|
+
options.port = argv.port === DEFAULT_PORT ? defaultTo(options.port, argv.port) : defaultTo(argv.port, options.port);
|
|
345
|
+
if(options.port != null) {
|
|
322
346
|
startDevServer(wpOpt, options);
|
|
323
347
|
return;
|
|
324
348
|
}
|
|
@@ -401,6 +425,7 @@ function startDevServer(wpOpt, options) {
|
|
|
401
425
|
} else {
|
|
402
426
|
server.listen(options.port, options.host, function(err) {
|
|
403
427
|
if(err) throw err;
|
|
428
|
+
if(options.bonjour) broadcastZeroconf(options);
|
|
404
429
|
reportReadiness(uri, options);
|
|
405
430
|
});
|
|
406
431
|
}
|
|
@@ -421,10 +446,26 @@ function reportReadiness(uri, options) {
|
|
|
421
446
|
if(options.historyApiFallback)
|
|
422
447
|
console.log(`404s will fallback to ${colorInfo(useColor, options.historyApiFallback.index || "/index.html")}`);
|
|
423
448
|
if(options.open) {
|
|
424
|
-
open(uri).catch(function() {
|
|
449
|
+
open(uri + options.openPage).catch(function() {
|
|
425
450
|
console.log("Unable to open browser. If you are running in a headless environment, please do not use the open flag.");
|
|
426
451
|
});
|
|
427
452
|
}
|
|
453
|
+
if(options.bonjour)
|
|
454
|
+
console.log("Broadcasting \"http\" with subtype of \"webpack\" via ZeroConf DNS (Bonjour)");
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
function broadcastZeroconf(options) {
|
|
458
|
+
bonjour.publish({
|
|
459
|
+
name: "Webpack Dev Server",
|
|
460
|
+
port: options.port,
|
|
461
|
+
type: "http",
|
|
462
|
+
subtypes: ["webpack"]
|
|
463
|
+
});
|
|
464
|
+
process.on("exit", function() {
|
|
465
|
+
bonjour.unpublishAll(function() {
|
|
466
|
+
bonjour.destroy();
|
|
467
|
+
});
|
|
468
|
+
});
|
|
428
469
|
}
|
|
429
470
|
|
|
430
471
|
processOptions(wpOpt);
|