webpack-dev-server 2.9.0 → 2.9.4

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/client/socket.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const SockJS = require('sockjs-client');
3
+ const SockJS = require('sockjs-client/dist/sockjs');
4
4
 
5
5
  let retries = 0;
6
6
  let sock = null;
package/lib/Server.js CHANGED
@@ -13,6 +13,7 @@ const del = require('del');
13
13
  const express = require('express');
14
14
  const httpProxyMiddleware = require('http-proxy-middleware');
15
15
  const ip = require('ip');
16
+ const killable = require('killable');
16
17
  const serveIndex = require('serve-index');
17
18
  const historyApiFallback = require('connect-history-api-fallback');
18
19
  const selfsigned = require('selfsigned');
@@ -343,9 +344,10 @@ function Server(compiler, options) {
343
344
  },
344
345
 
345
346
  setup: () => {
346
- log('Using "setup" is deprecated and will be removed in the next major version. Please use the "before" and "after" hooks instead.');
347
- log('If "setup" was working fine for you until now, simply replace it with "before"');
348
- if (typeof options.setup === 'function') { options.setup(app, this); }
347
+ if (typeof options.setup === 'function') {
348
+ log('The `setup` option is deprecated and will be removed in v3. Please update your config to use `before`');
349
+ options.setup(app, this);
350
+ }
349
351
  }
350
352
  };
351
353
 
@@ -473,6 +475,8 @@ function Server(compiler, options) {
473
475
  this.listeningApp = http.createServer(app);
474
476
  }
475
477
 
478
+ killable(this.listeningApp);
479
+
476
480
  // Proxy websockets without the initial http request
477
481
  // https://github.com/chimurai/http-proxy-middleware#external-websocket-upgrade
478
482
  websocketProxies.forEach(function (wsProxy) {
@@ -609,14 +613,15 @@ Server.prototype.close = function (callback) {
609
613
  sock.close();
610
614
  });
611
615
  this.sockets = [];
612
- this.listeningApp.close(() => {
613
- this.middleware.close(callback);
614
- });
615
616
 
616
617
  this.contentBaseWatchers.forEach((watcher) => {
617
618
  watcher.close();
618
619
  });
619
620
  this.contentBaseWatchers = [];
621
+
622
+ this.listeningApp.kill(() => {
623
+ this.middleware.close(callback);
624
+ });
620
625
  };
621
626
 
622
627
  Server.prototype.sockWrite = function (sockets, type, data) {
@@ -64,9 +64,6 @@
64
64
  },
65
65
  "headers": {
66
66
  "description": "Response headers that are added to each response.",
67
- "additionalProperties": {
68
- "type": "string"
69
- },
70
67
  "type": "object"
71
68
  },
72
69
  "clientLogLevel": {
package/lib/polyfills.js CHANGED
@@ -1,9 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  /* polyfills for Node 4.8.x users */
4
- /* eslint no-extend-native: off, global-require: off */
5
4
 
6
5
  // internal-ip@2.x uses [].includes
7
- if (!Array.prototype.includes) {
8
- Array.prototype.includes = require('array-includes');
9
- }
6
+ const includes = require('array-includes');
7
+
8
+ includes.shim();
@@ -10,8 +10,12 @@ module.exports = function createDomain(options, listeningApp) {
10
10
  const port = options.socket ? 0 : appPort;
11
11
  const hostname = options.useLocalIp ? internalIp.v4() : options.host;
12
12
 
13
+ // use explicitly defined public url (prefix with protocol if not explicitly given)
14
+ if (options.public) {
15
+ return /^[a-zA-Z]+:\/\//.test(options.public) ? `${options.public}` : `${protocol}://${options.public}`;
16
+ }
13
17
  // the formatted domain (url without path) of the webpack server
14
- return options.public ? `${protocol}://${options.public}` : url.format({
18
+ return url.format({
15
19
  protocol,
16
20
  hostname,
17
21
  port
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "webpack-dev-server",
3
- "version": "2.9.0",
3
+ "version": "2.9.4",
4
4
  "description": "Serves a webpack app. Updates the browser on changes.",
5
5
  "license": "MIT",
6
6
  "repository": "webpack/webpack-dev-server",
7
7
  "author": "Tobias Koppers @sokra",
8
- "homepage": "http://github.com/webpack/webpack-dev-server",
8
+ "homepage": "https://github.com/webpack/webpack-dev-server",
9
9
  "maintainers": [
10
10
  {
11
11
  "name": "Andrew Powell",
@@ -24,7 +24,7 @@
24
24
  "cover": "istanbul cover node_modules/mocha/bin/_mocha",
25
25
  "lint": "eslint bin lib test examples client/{index,live,socket,sockjs,overlay,webpack.config}.js",
26
26
  "mocha": "mocha --full-trace --check-leaks",
27
- "prepublish": "npm run -s build:live && npm run -s build:index && npm run -s build:sockjs",
27
+ "prepublish": "(rm ssl/*.pem || true) && npm run -s build:live && npm run -s build:index && npm run -s build:sockjs",
28
28
  "test": "npm run lint && npm run mocha",
29
29
  "build:live": "webpack ./client/live.js client/live.bundle.js --color --config client/webpack.config.js",
30
30
  "build:index": "webpack ./client/index.js client/index.bundle.js --color --config client/webpack.config.js",
@@ -46,12 +46,15 @@
46
46
  "chokidar": "^1.6.0",
47
47
  "compression": "^1.5.2",
48
48
  "connect-history-api-fallback": "^1.3.0",
49
+ "debug": "^3.1.0",
49
50
  "del": "^3.0.0",
50
51
  "express": "^4.13.3",
51
52
  "html-entities": "^1.2.0",
52
53
  "http-proxy-middleware": "~0.17.4",
54
+ "import-local": "^0.1.1",
53
55
  "internal-ip": "1.2.0",
54
56
  "ip": "^1.1.5",
57
+ "killable": "^1.0.0",
55
58
  "loglevel": "^1.4.1",
56
59
  "opn": "^5.1.0",
57
60
  "portfinder": "^1.0.9",
@@ -71,6 +74,7 @@
71
74
  "eslint": "^4.5.0",
72
75
  "eslint-config-webpack": "^1.2.5",
73
76
  "eslint-plugin-import": "^2.7.0",
77
+ "execa": "^0.8.0",
74
78
  "file-loader": "^0.11.2",
75
79
  "istanbul": "^0.4.5",
76
80
  "jquery": "^3.2.1",