Skip to content

Commit 552b506

Browse files
committedJul 14, 2021
[major] Drop support for Node.js < 10
1 parent e814110 commit 552b506

File tree

6 files changed

+6
-23
lines changed

6 files changed

+6
-23
lines changed
 

‎.github/workflows/ci.yml

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ jobs:
1010
strategy:
1111
matrix:
1212
node:
13-
- 8
1413
- 10
1514
- 12
1615
- 14

‎appveyor.yml

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ environment:
44
- nodejs_version: '14'
55
- nodejs_version: '12'
66
- nodejs_version: '10'
7-
- nodejs_version: '8'
87
platform:
98
- x86
109
matrix:

‎lib/buffer-util.js

+3-6
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,7 @@ function _mask(source, mask, output, offset, length) {
5252
* @public
5353
*/
5454
function _unmask(buffer, mask) {
55-
// Required until https://github.com/nodejs/node/issues/9006 is resolved.
56-
const length = buffer.length;
57-
for (let i = 0; i < length; i++) {
55+
for (let i = 0; i < buffer.length; i++) {
5856
buffer[i] ^= mask[i & 3];
5957
}
6058
}
@@ -103,19 +101,18 @@ function toBuffer(data) {
103101

104102
try {
105103
const bufferUtil = require('bufferutil');
106-
const bu = bufferUtil.BufferUtil || bufferUtil;
107104

108105
module.exports = {
109106
concat,
110107
mask(source, mask, output, offset, length) {
111108
if (length < 48) _mask(source, mask, output, offset, length);
112-
else bu.mask(source, mask, output, offset, length);
109+
else bufferUtil.mask(source, mask, output, offset, length);
113110
},
114111
toArrayBuffer,
115112
toBuffer,
116113
unmask(buffer, mask) {
117114
if (buffer.length < 32) _unmask(buffer, mask);
118-
else bu.unmask(buffer, mask);
115+
else bufferUtil.unmask(buffer, mask);
119116
}
120117
};
121118
} catch (e) /* istanbul ignore next */ {

‎lib/permessage-deflate.js

+1-8
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const zlib = require('zlib');
44

55
const bufferUtil = require('./buffer-util');
66
const Limiter = require('./limiter');
7-
const { kStatusCode, NOOP } = require('./constants');
7+
const { kStatusCode } = require('./constants');
88

99
const TRAILER = Buffer.from([0x00, 0x00, 0xff, 0xff]);
1010
const kPerMessageDeflate = Symbol('permessage-deflate');
@@ -418,13 +418,6 @@ class PerMessageDeflate {
418418
this._deflate[kTotalLength] = 0;
419419
this._deflate[kBuffers] = [];
420420

421-
//
422-
// An `'error'` event is emitted, only on Node.js < 10.0.0, if the
423-
// `zlib.DeflateRaw` instance is closed while data is being processed.
424-
// This can happen if `PerMessageDeflate#cleanup()` is called at the wrong
425-
// time due to an abnormal WebSocket closure.
426-
//
427-
this._deflate.on('error', NOOP);
428421
this._deflate.on('data', deflateOnData);
429422
}
430423

‎lib/validation.js

+1-6
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,7 @@ function _isValidUTF8(buf) {
106106
}
107107

108108
try {
109-
let isValidUTF8 = require('utf-8-validate');
110-
111-
/* istanbul ignore if */
112-
if (typeof isValidUTF8 === 'object') {
113-
isValidUTF8 = isValidUTF8.Validation.isValidUTF8; // utf-8-validate@<3.0.0
114-
}
109+
const isValidUTF8 = require('utf-8-validate');
115110

116111
module.exports = {
117112
isValidStatusCode,

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"main": "index.js",
1919
"browser": "browser.js",
2020
"engines": {
21-
"node": ">=8.3.0"
21+
"node": ">=10.0.0"
2222
},
2323
"files": [
2424
"browser.js",

0 commit comments

Comments
 (0)
Please sign in to comment.