webpack-dev-server 4.2.0 → 4.2.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/client/index.js CHANGED
@@ -77,6 +77,7 @@ var onSocketMessage = {
77
77
  sendMessage("Invalid");
78
78
  },
79
79
  hash: function hash(_hash) {
80
+ status.previousHash = status.currentHash;
80
81
  status.currentHash = _hash;
81
82
  },
82
83
  logging: setAllLogLevel,
@@ -39,7 +39,7 @@ function ansiRegex() {
39
39
  _ref$onlyFirst = _ref.onlyFirst,
40
40
  onlyFirst = _ref$onlyFirst === void 0 ? false : _ref$onlyFirst;
41
41
 
42
- var pattern = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)", '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))'].join('|');
42
+ var pattern = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)", '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))'].join('|');
43
43
  return new RegExp(pattern, onlyFirst ? undefined : 'g');
44
44
  }
45
45
 
@@ -8,21 +8,13 @@ function reloadApp(_ref, status) {
8
8
 
9
9
  if (status.isUnloading) {
10
10
  return;
11
- } // TODO Workaround for webpack v4, `__webpack_hash__` is not replaced without HotModuleReplacement plugin
12
-
11
+ }
13
12
 
14
- var webpackHash = // eslint-disable-next-line camelcase
15
- typeof __webpack_hash__ !== "undefined" ? // eslint-disable-next-line camelcase
16
- __webpack_hash__ : status.previousHash || "";
17
- var isInitial = status.currentHash.indexOf(webpackHash) === 0;
13
+ var currentHash = status.currentHash,
14
+ previousHash = status.previousHash;
15
+ var isInitial = currentHash.indexOf(previousHash) >= 0;
18
16
 
19
17
  if (isInitial) {
20
- var isLegacyInitial = webpackHash === "" && hot === false && liveReload === true;
21
-
22
- if (isLegacyInitial) {
23
- status.previousHash = status.currentHash;
24
- }
25
-
26
18
  return;
27
19
  }
28
20
 
package/lib/Server.js CHANGED
@@ -1150,26 +1150,18 @@ class Server {
1150
1150
  }
1151
1151
 
1152
1152
  setupHooks() {
1153
- const addHooks = (compiler) => {
1154
- compiler.hooks.invalid.tap("webpack-dev-server", () => {
1155
- if (this.webSocketServer) {
1156
- this.sendMessage(this.webSocketServer.clients, "invalid");
1157
- }
1158
- });
1159
- compiler.hooks.done.tap("webpack-dev-server", (stats) => {
1160
- if (this.webSocketServer) {
1161
- this.sendStats(this.webSocketServer.clients, this.getStats(stats));
1162
- }
1163
-
1164
- this.stats = stats;
1165
- });
1166
- };
1153
+ this.compiler.hooks.invalid.tap("webpack-dev-server", () => {
1154
+ if (this.webSocketServer) {
1155
+ this.sendMessage(this.webSocketServer.clients, "invalid");
1156
+ }
1157
+ });
1158
+ this.compiler.hooks.done.tap("webpack-dev-server", (stats) => {
1159
+ if (this.webSocketServer) {
1160
+ this.sendStats(this.webSocketServer.clients, this.getStats(stats));
1161
+ }
1167
1162
 
1168
- if (this.compiler.compilers) {
1169
- this.compiler.compilers.forEach(addHooks);
1170
- } else {
1171
- addHooks(this.compiler);
1172
- }
1163
+ this.stats = stats;
1164
+ });
1173
1165
  }
1174
1166
 
1175
1167
  setupHostHeaderCheck() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webpack-dev-server",
3
- "version": "4.2.0",
3
+ "version": "4.2.1",
4
4
  "description": "Serves a webpack app. Updates the browser on changes.",
5
5
  "bin": "bin/webpack-dev-server.js",
6
6
  "main": "lib/Server.js",