diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 158a50e32..29e75259f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,6 @@ jobs: strategy: matrix: node: - - 8 - 10 - 12 - 14 diff --git a/appveyor.yml b/appveyor.yml index f4c05fbf4..ff8520944 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -4,7 +4,6 @@ environment: - nodejs_version: '14' - nodejs_version: '12' - nodejs_version: '10' - - nodejs_version: '8' platform: - x86 matrix: diff --git a/lib/buffer-util.js b/lib/buffer-util.js index 6fd84c311..1ba1d1beb 100644 --- a/lib/buffer-util.js +++ b/lib/buffer-util.js @@ -52,9 +52,7 @@ function _mask(source, mask, output, offset, length) { * @public */ function _unmask(buffer, mask) { - // Required until https://github.com/nodejs/node/issues/9006 is resolved. - const length = buffer.length; - for (let i = 0; i < length; i++) { + for (let i = 0; i < buffer.length; i++) { buffer[i] ^= mask[i & 3]; } } @@ -103,19 +101,18 @@ function toBuffer(data) { try { const bufferUtil = require('bufferutil'); - const bu = bufferUtil.BufferUtil || bufferUtil; module.exports = { concat, mask(source, mask, output, offset, length) { if (length < 48) _mask(source, mask, output, offset, length); - else bu.mask(source, mask, output, offset, length); + else bufferUtil.mask(source, mask, output, offset, length); }, toArrayBuffer, toBuffer, unmask(buffer, mask) { if (buffer.length < 32) _unmask(buffer, mask); - else bu.unmask(buffer, mask); + else bufferUtil.unmask(buffer, mask); } }; } catch (e) /* istanbul ignore next */ { diff --git a/lib/permessage-deflate.js b/lib/permessage-deflate.js index ce9178429..7fe9459ff 100644 --- a/lib/permessage-deflate.js +++ b/lib/permessage-deflate.js @@ -4,7 +4,7 @@ const zlib = require('zlib'); const bufferUtil = require('./buffer-util'); const Limiter = require('./limiter'); -const { kStatusCode, NOOP } = require('./constants'); +const { kStatusCode } = require('./constants'); const TRAILER = Buffer.from([0x00, 0x00, 0xff, 0xff]); const kPerMessageDeflate = Symbol('permessage-deflate'); @@ -418,13 +418,6 @@ class PerMessageDeflate { this._deflate[kTotalLength] = 0; this._deflate[kBuffers] = []; - // - // An `'error'` event is emitted, only on Node.js < 10.0.0, if the - // `zlib.DeflateRaw` instance is closed while data is being processed. - // This can happen if `PerMessageDeflate#cleanup()` is called at the wrong - // time due to an abnormal WebSocket closure. - // - this._deflate.on('error', NOOP); this._deflate.on('data', deflateOnData); } diff --git a/lib/validation.js b/lib/validation.js index d09b1d39b..ed98c7591 100644 --- a/lib/validation.js +++ b/lib/validation.js @@ -106,12 +106,7 @@ function _isValidUTF8(buf) { } try { - let isValidUTF8 = require('utf-8-validate'); - - /* istanbul ignore if */ - if (typeof isValidUTF8 === 'object') { - isValidUTF8 = isValidUTF8.Validation.isValidUTF8; // utf-8-validate@<3.0.0 - } + const isValidUTF8 = require('utf-8-validate'); module.exports = { isValidStatusCode, diff --git a/package.json b/package.json index d6dff1396..5318ff9e4 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "main": "index.js", "browser": "browser.js", "engines": { - "node": ">=8.3.0" + "node": ">=10.0.0" }, "files": [ "browser.js",