webpack-dev-server 3.1.10 → 3.1.11

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 CHANGED
@@ -2,6 +2,21 @@
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
+ <a name="3.1.11"></a>
6
+ ## [3.1.11](https://github.com/webpack/webpack-dev-server/compare/v3.1.10...v3.1.11) (2018-12-21)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **bin/options:** correct check for color support (`options.color`) ([#1555](https://github.com/webpack/webpack-dev-server/issues/1555)) ([55398b5](https://github.com/webpack/webpack-dev-server/commit/55398b5))
12
+ * **package:** update `spdy` v3.4.1...4.0.0 (assertion error) ([#1491](https://github.com/webpack/webpack-dev-server/issues/1491)) ([#1563](https://github.com/webpack/webpack-dev-server/issues/1563)) ([7a3a257](https://github.com/webpack/webpack-dev-server/commit/7a3a257))
13
+ * **Server:** correct `node` version checks ([#1543](https://github.com/webpack/webpack-dev-server/issues/1543)) ([927a2b3](https://github.com/webpack/webpack-dev-server/commit/927a2b3))
14
+ * **Server:** mime type for wasm in contentBase directory ([#1575](https://github.com/webpack/webpack-dev-server/issues/1575)) ([#1580](https://github.com/webpack/webpack-dev-server/issues/1580)) ([fadae5d](https://github.com/webpack/webpack-dev-server/commit/fadae5d))
15
+ * add url for compatibility with webpack@5 ([#1598](https://github.com/webpack/webpack-dev-server/issues/1598)) ([#1599](https://github.com/webpack/webpack-dev-server/issues/1599)) ([68dd49a](https://github.com/webpack/webpack-dev-server/commit/68dd49a))
16
+ * check origin header for websocket connection ([#1603](https://github.com/webpack/webpack-dev-server/issues/1603)) ([b3217ca](https://github.com/webpack/webpack-dev-server/commit/b3217ca))
17
+
18
+
19
+
5
20
  <a name="3.1.10"></a>
6
21
  ## [3.1.10](https://github.com/webpack/webpack-dev-server/compare/v3.1.9...v3.1.10) (2018-10-23)
7
22
 
package/bin/options.js CHANGED
@@ -57,7 +57,9 @@ const options = {
57
57
  type: 'boolean',
58
58
  alias: 'colors',
59
59
  default: function supportsColor() {
60
- return require('supports-color');
60
+ // Use `require('supports-color').stdout` for supports-color >= 5.0.0.
61
+ // See https://github.com/webpack/webpack-dev-server/pull/1555.
62
+ return require('supports-color').stdout;
61
63
  },
62
64
  group: DISPLAY_GROUP,
63
65
  describe: 'Enables/Disables colors on the console'
package/lib/Server.js CHANGED
@@ -20,6 +20,8 @@ const https = require('https');
20
20
  const spdy = require('spdy');
21
21
  const sockjs = require('sockjs');
22
22
 
23
+ const semver = require('semver');
24
+
23
25
  const killable = require('killable');
24
26
 
25
27
  const del = require('del');
@@ -46,8 +48,7 @@ const schema = require('./options.json');
46
48
  // breaking connection when certificate is not signed with prime256v1
47
49
  // change it to auto allows OpenSSL to select the curve automatically
48
50
  // See https://github.com/nodejs/node/issues/16196 for more infomation
49
- const version = parseFloat(process.version.slice(1));
50
- if (version >= 8.6 && version < 10) {
51
+ if (semver.satisfies(process.version, '8.6.0 - 9')) {
51
52
  tls.DEFAULT_ECDH_CURVE = 'auto';
52
53
  }
53
54
 
@@ -131,6 +132,10 @@ function Server (compiler, options = {}, _log) {
131
132
  // eslint-disable-next-line
132
133
  const app = this.app = new express();
133
134
 
135
+ // ref: https://github.com/webpack/webpack-dev-server/issues/1575
136
+ // remove this when send@^0.16.3
137
+ express.static.mime.types.wasm = 'application/wasm';
138
+
134
139
  app.all('*', (req, res, next) => {
135
140
  if (this.checkHost(req.headers)) {
136
141
  return next();
@@ -592,7 +597,7 @@ function Server (compiler, options = {}, _log) {
592
597
  // - https://github.com/nodejs/node/issues/21665
593
598
  // - https://github.com/webpack/webpack-dev-server/issues/1449
594
599
  // - https://github.com/expressjs/express/issues/3388
595
- if (version >= 10) {
600
+ if (semver.gte(process.version, '10.0.0')) {
596
601
  this.listeningApp = https.createServer(options.https, app);
597
602
  } else {
598
603
  this.listeningApp = spdy.createServer(options.https, app);
@@ -625,14 +630,16 @@ Server.prototype.setContentHeaders = function (req, res, next) {
625
630
  next();
626
631
  };
627
632
 
628
- Server.prototype.checkHost = function (headers) {
633
+ Server.prototype.checkHost = function (headers, headerToCheck) {
629
634
  // allow user to opt-out this security check, at own risk
630
635
  if (this.disableHostCheck) {
631
636
  return true;
632
637
  }
638
+
639
+ if (!headerToCheck) headerToCheck = 'host';
633
640
  // get the Host header and extract hostname
634
641
  // we don't care about port not matching
635
- const hostHeader = headers.host;
642
+ const hostHeader = headers[headerToCheck];
636
643
 
637
644
  if (!hostHeader) {
638
645
  return false;
@@ -720,8 +727,8 @@ Server.prototype.listen = function (port, hostname, fn) {
720
727
  return;
721
728
  }
722
729
 
723
- if (!this.checkHost(connection.headers)) {
724
- this.sockWrite([ connection ], 'error', 'Invalid Host header');
730
+ if (!this.checkHost(connection.headers) || !this.checkHost(connection.headers, 'origin')) {
731
+ this.sockWrite([ connection ], 'error', 'Invalid Host/Origin header');
725
732
 
726
733
  connection.close();
727
734
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webpack-dev-server",
3
- "version": "3.1.10",
3
+ "version": "3.1.11",
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",
@@ -44,12 +44,14 @@
44
44
  "portfinder": "^1.0.9",
45
45
  "schema-utils": "^1.0.0",
46
46
  "selfsigned": "^1.9.1",
47
+ "semver": "^5.6.0",
47
48
  "serve-index": "^1.7.2",
48
49
  "sockjs": "0.3.19",
49
50
  "sockjs-client": "1.3.0",
50
- "spdy": "^3.4.1",
51
+ "spdy": "^4.0.0",
51
52
  "strip-ansi": "^3.0.0",
52
53
  "supports-color": "^5.1.0",
54
+ "url": "^0.11.0",
53
55
  "webpack-dev-middleware": "3.4.0",
54
56
  "webpack-log": "^2.0.0",
55
57
  "yargs": "12.0.2"