webpack-dev-server 3.7.0 → 3.8.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/CHANGELOG.md +55 -4
- package/bin/options.js +4 -1
- package/bin/webpack-dev-server.js +13 -20
- package/client/clients/SockJSClient.js +5 -0
- package/client/clients/WebsocketClient.js +45 -2
- package/client/index.bundle.js +1 -1
- package/client/live.bundle.js +3 -17
- package/client/overlay.js +19 -22
- package/client/socket.js +9 -2
- package/client/sockjs.bundle.js +1 -1
- package/client/utils/createSocketUrl.js +13 -5
- package/client/utils/reloadApp.js +1 -1
- package/lib/Server.js +67 -76
- package/lib/options.json +32 -12
- package/lib/servers/SockJSServer.js +13 -3
- package/lib/servers/WebsocketServer.js +41 -4
- package/lib/utils/addEntries.js +57 -11
- package/lib/utils/createConfig.js +7 -2
- package/lib/utils/createLogger.js +1 -1
- package/lib/utils/findPort.js +17 -6
- package/lib/utils/getSocketClientPath.js +37 -0
- package/lib/utils/getSocketServerImplementation.js +8 -7
- package/lib/utils/getVersions.js +0 -2
- package/lib/utils/normalizeOptions.js +38 -0
- package/lib/utils/processOptions.js +16 -1
- package/lib/utils/routes.js +16 -30
- package/lib/utils/runBonjour.js +2 -3
- package/lib/utils/runOpen.js +10 -3
- package/lib/utils/setupExitSignals.js +3 -3
- package/lib/utils/status.js +10 -0
- package/lib/utils/tryParseInt.js +2 -0
- package/lib/utils/updateCompiler.js +2 -4
- package/package.json +49 -41
package/CHANGELOG.md
CHANGED
|
@@ -2,18 +2,69 @@
|
|
|
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
|
-
|
|
5
|
+
### [3.8.1](https://github.com/webpack/webpack-dev-server/compare/v3.8.0...v3.8.1) (2019-09-16)
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
### Bug Fixes
|
|
9
9
|
|
|
10
|
-
*
|
|
11
|
-
*
|
|
10
|
+
* add null check for connection.headers ([#2200](https://github.com/webpack/webpack-dev-server/issues/2200)) ([7964997](https://github.com/webpack/webpack-dev-server/commit/7964997))
|
|
11
|
+
* false positive for an absolute path in the `ContentBase` option on windows ([#2202](https://github.com/webpack/webpack-dev-server/issues/2202)) ([68ecf78](https://github.com/webpack/webpack-dev-server/commit/68ecf78))
|
|
12
|
+
* add status in quiet log level ([#2235](https://github.com/webpack/webpack-dev-server/issues/2235)) ([7e2224e](https://github.com/webpack/webpack-dev-server/commit/7e2224e))
|
|
13
|
+
* scriptHost in client ([#2246](https://github.com/webpack/webpack-dev-server/issues/2246)) ([00903f6](https://github.com/webpack/webpack-dev-server/commit/00903f6))
|
|
14
|
+
|
|
15
|
+
## [3.8.0](https://github.com/webpack/webpack-dev-server/compare/v3.7.2...v3.8.0) (2019-08-09)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* **server:** fix setupExitSignals usage ([#2181](https://github.com/webpack/webpack-dev-server/issues/2181)) ([bbe410e](https://github.com/webpack/webpack-dev-server/commit/bbe410e))
|
|
21
|
+
* **server:** set port before instantiating server ([#2143](https://github.com/webpack/webpack-dev-server/issues/2143)) ([cfbf229](https://github.com/webpack/webpack-dev-server/commit/cfbf229))
|
|
22
|
+
* check for name of HotModuleReplacementPlugin to avoid RangeError ([#2146](https://github.com/webpack/webpack-dev-server/issues/2146)) ([4579775](https://github.com/webpack/webpack-dev-server/commit/4579775))
|
|
23
|
+
* **server:** check for external urls in array ([#1980](https://github.com/webpack/webpack-dev-server/issues/1980)) ([fa78347](https://github.com/webpack/webpack-dev-server/commit/fa78347))
|
|
24
|
+
* **server:** fix header check for socket server ([#2077](https://github.com/webpack/webpack-dev-server/issues/2077)) ([7f51859](https://github.com/webpack/webpack-dev-server/commit/7f51859))
|
|
25
|
+
* **server:** stricter headers security check ([#2092](https://github.com/webpack/webpack-dev-server/issues/2092)) ([078ddca](https://github.com/webpack/webpack-dev-server/commit/078ddca))
|
|
12
26
|
|
|
13
27
|
|
|
14
28
|
### Features
|
|
15
29
|
|
|
16
|
-
* **server:** add
|
|
30
|
+
* **server:** add transportMode ([#2116](https://github.com/webpack/webpack-dev-server/issues/2116)) ([b5b9cb4](https://github.com/webpack/webpack-dev-server/commit/b5b9cb4))
|
|
31
|
+
* **server:** serverMode 'ws' option ([#2082](https://github.com/webpack/webpack-dev-server/issues/2082)) ([04483f4](https://github.com/webpack/webpack-dev-server/commit/04483f4))
|
|
32
|
+
* **server/client:** made progress option available to API ([#1961](https://github.com/webpack/webpack-dev-server/issues/1961)) ([56274e4](https://github.com/webpack/webpack-dev-server/commit/56274e4))
|
|
33
|
+
|
|
34
|
+
### Potential Breaking changes
|
|
35
|
+
|
|
36
|
+
We have migrated `serverMode` and `clientMode` to `transportMode` as an experimental option. If you want to use this feature, you have to change your settings.
|
|
37
|
+
|
|
38
|
+
Related PR: https://github.com/webpack/webpack-dev-server/pull/2116
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
### [3.7.2](https://github.com/webpack/webpack-dev-server/compare/v3.7.1...v3.7.2) (2019-06-17)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
### Bug Fixes
|
|
45
|
+
|
|
46
|
+
* **client:** add default fallback for client ([#2015](https://github.com/webpack/webpack-dev-server/issues/2015)) ([d26b444](https://github.com/webpack/webpack-dev-server/commit/d26b444))
|
|
47
|
+
* **open:** set `wait: false` to run server.close successfully ([#2001](https://github.com/webpack/webpack-dev-server/issues/2001)) ([2b4cb52](https://github.com/webpack/webpack-dev-server/commit/2b4cb52))
|
|
48
|
+
* **test:** fixed ProvidePlugin.test.js ([#2002](https://github.com/webpack/webpack-dev-server/issues/2002)) ([47453cb](https://github.com/webpack/webpack-dev-server/commit/47453cb))
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
### [3.7.1](https://github.com/webpack/webpack-dev-server/compare/v3.7.0...v3.7.1) (2019-06-07)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
### Bug Fixes
|
|
56
|
+
|
|
57
|
+
* retry finding port when port is null and get ports in sequence ([#1993](https://github.com/webpack/webpack-dev-server/issues/1993)) ([bc57514](https://github.com/webpack/webpack-dev-server/commit/bc57514))
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
## [3.7.0](https://github.com/webpack/webpack-dev-server/compare/v3.6.0...v3.7.0) (2019-06-06)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
### Bug Fixes
|
|
65
|
+
|
|
66
|
+
* change clientLogLevel order to be called first ([#1973](https://github.com/webpack/webpack-dev-server/issues/1973)) ([57c8c92](https://github.com/webpack/webpack-dev-server/commit/57c8c92))
|
|
67
|
+
* es6 syntax in client ([#1982](https://github.com/webpack/webpack-dev-server/issues/1982)) ([802aa30](https://github.com/webpack/webpack-dev-server/commit/802aa30))
|
|
17
68
|
|
|
18
69
|
|
|
19
70
|
|
package/bin/options.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
/* eslint-disable
|
|
4
|
-
global-require,
|
|
5
4
|
multiline-ternary,
|
|
6
5
|
space-before-function-paren
|
|
7
6
|
*/
|
|
@@ -37,6 +36,10 @@ const options = {
|
|
|
37
36
|
describe:
|
|
38
37
|
'Inline mode (set to false to disable including client scripts like livereload)',
|
|
39
38
|
},
|
|
39
|
+
profile: {
|
|
40
|
+
type: 'boolean',
|
|
41
|
+
describe: 'Print compilation profile data for progress steps',
|
|
42
|
+
},
|
|
40
43
|
progress: {
|
|
41
44
|
type: 'boolean',
|
|
42
45
|
describe: 'Print compilation progress in percentage',
|
|
@@ -15,13 +15,18 @@ const setupExitSignals = require('../lib/utils/setupExitSignals');
|
|
|
15
15
|
const colors = require('../lib/utils/colors');
|
|
16
16
|
const processOptions = require('../lib/utils/processOptions');
|
|
17
17
|
const createLogger = require('../lib/utils/createLogger');
|
|
18
|
-
const findPort = require('../lib/utils/findPort');
|
|
19
18
|
const getVersions = require('../lib/utils/getVersions');
|
|
20
19
|
const options = require('./options');
|
|
21
20
|
|
|
22
21
|
let server;
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
const serverData = {
|
|
23
|
+
server: null,
|
|
24
|
+
};
|
|
25
|
+
// we must pass an object that contains the server object as a property so that
|
|
26
|
+
// we can update this server property later, and setupExitSignals will be able to
|
|
27
|
+
// recognize that the server has been instantiated, because we will set
|
|
28
|
+
// serverData.server to the new server object.
|
|
29
|
+
setupExitSignals(serverData);
|
|
25
30
|
|
|
26
31
|
// Prefer the local installation of webpack-dev-server
|
|
27
32
|
if (importLocal(__filename)) {
|
|
@@ -97,14 +102,9 @@ function startDevServer(config, options) {
|
|
|
97
102
|
throw err;
|
|
98
103
|
}
|
|
99
104
|
|
|
100
|
-
if (options.progress) {
|
|
101
|
-
new webpack.ProgressPlugin({
|
|
102
|
-
profile: argv.profile,
|
|
103
|
-
}).apply(compiler);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
105
|
try {
|
|
107
106
|
server = new Server(compiler, options, log);
|
|
107
|
+
serverData.server = server;
|
|
108
108
|
} catch (err) {
|
|
109
109
|
if (err.name === 'ValidationError') {
|
|
110
110
|
log.error(colors.error(options.stats.colors, err.message));
|
|
@@ -154,18 +154,11 @@ function startDevServer(config, options) {
|
|
|
154
154
|
});
|
|
155
155
|
});
|
|
156
156
|
} else {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
options.port = port;
|
|
160
|
-
server.listen(options.port, options.host, (err) => {
|
|
161
|
-
if (err) {
|
|
162
|
-
throw err;
|
|
163
|
-
}
|
|
164
|
-
});
|
|
165
|
-
})
|
|
166
|
-
.catch((err) => {
|
|
157
|
+
server.listen(options.port, options.host, (err) => {
|
|
158
|
+
if (err) {
|
|
167
159
|
throw err;
|
|
168
|
-
}
|
|
160
|
+
}
|
|
161
|
+
});
|
|
169
162
|
}
|
|
170
163
|
}
|
|
171
164
|
|
|
@@ -37,6 +37,11 @@ function (_BaseClient) {
|
|
|
37
37
|
|
|
38
38
|
_this = _possibleConstructorReturn(this, _getPrototypeOf(SockJSClient).call(this));
|
|
39
39
|
_this.sock = new SockJS(url);
|
|
40
|
+
|
|
41
|
+
_this.sock.onerror = function (err) {// TODO: use logger to log the error event once client and client-src
|
|
42
|
+
// are reorganized to have the same directory structure
|
|
43
|
+
};
|
|
44
|
+
|
|
40
45
|
return _this;
|
|
41
46
|
}
|
|
42
47
|
|
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
+
/* global WebSocket */
|
|
3
|
+
|
|
4
|
+
/* eslint-disable
|
|
5
|
+
no-unused-vars
|
|
6
|
+
*/
|
|
2
7
|
|
|
3
8
|
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
9
|
|
|
5
10
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
6
11
|
|
|
12
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
13
|
+
|
|
14
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
15
|
+
|
|
7
16
|
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
8
17
|
|
|
9
18
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
@@ -21,11 +30,45 @@ module.exports =
|
|
|
21
30
|
function (_BaseClient) {
|
|
22
31
|
_inherits(WebsocketClient, _BaseClient);
|
|
23
32
|
|
|
24
|
-
function WebsocketClient() {
|
|
33
|
+
function WebsocketClient(url) {
|
|
34
|
+
var _this;
|
|
35
|
+
|
|
25
36
|
_classCallCheck(this, WebsocketClient);
|
|
26
37
|
|
|
27
|
-
|
|
38
|
+
_this = _possibleConstructorReturn(this, _getPrototypeOf(WebsocketClient).call(this));
|
|
39
|
+
_this.client = new WebSocket(url.replace(/^http/, 'ws'));
|
|
40
|
+
|
|
41
|
+
_this.client.onerror = function (err) {// TODO: use logger to log the error event once client and client-src
|
|
42
|
+
// are reorganized to have the same directory structure
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
return _this;
|
|
28
46
|
}
|
|
29
47
|
|
|
48
|
+
_createClass(WebsocketClient, [{
|
|
49
|
+
key: "onOpen",
|
|
50
|
+
value: function onOpen(f) {
|
|
51
|
+
this.client.onopen = f;
|
|
52
|
+
}
|
|
53
|
+
}, {
|
|
54
|
+
key: "onClose",
|
|
55
|
+
value: function onClose(f) {
|
|
56
|
+
this.client.onclose = f;
|
|
57
|
+
} // call f with the message string as the first argument
|
|
58
|
+
|
|
59
|
+
}, {
|
|
60
|
+
key: "onMessage",
|
|
61
|
+
value: function onMessage(f) {
|
|
62
|
+
this.client.onmessage = function (e) {
|
|
63
|
+
f(e.data);
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
}], [{
|
|
67
|
+
key: "getClientPath",
|
|
68
|
+
value: function getClientPath(options) {
|
|
69
|
+
return require.resolve('./WebsocketClient');
|
|
70
|
+
}
|
|
71
|
+
}]);
|
|
72
|
+
|
|
30
73
|
return WebsocketClient;
|
|
31
74
|
}(BaseClient);
|