Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to node 10 11 #366

Merged
merged 3 commits into from
Oct 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ npm install --save readable-stream

This package is a mirror of the streams implementations in Node.js.

Full documentation may be found on the [Node.js website](https://nodejs.org/dist/v10.10.0/docs/api/stream.html).
Full documentation may be found on the [Node.js website](https://nodejs.org/dist/v10.11.0/docs/api/stream.html).

If you want to guarantee a stable streams base, regardless of what version of
Node you, or the users of your libraries are using, use **readable-stream** *only* and avoid the *"stream"* module in Node-core, for background see [this blogpost](http://r.va.gg/2014/06/why-i-dont-use-nodes-core-stream-module.html).
Expand Down
20 changes: 20 additions & 0 deletions build/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,22 @@ function CorkedRequest(state) {
/^const { emitExperimentalWarning } = require\('internal\/util'\);/m,
'const { emitExperimentalWarning } = require(\'../experimentalWarning\');'
]
, numberIE11 = [
/Number.isNaN(n)/g
, 'n !== n'
]
, noAsyncIterators1 = [
/Readable\.prototype\[Symbol\.asyncIterator\] = function\(\) \{/g
, 'if (typeof Symbol === \'function\' ) {\nReadable.prototype[Symbol.asyncIterator] = function () {'
]
, noAsyncIterators2 = [
/return new ReadableAsyncIterator\(this\);\n};/m
, 'return new ReadableAsyncIterator(this);\n};\n}'
]
, once = [
/const \{ once \} = require\('internal\/util'\);/
, 'function once(callback) { let called = false; return function(...args) { if (called) return; called = true; callback(...args); }; }'
]

module.exports['_stream_duplex.js'] = [
requireReplacement
Expand Down Expand Up @@ -234,6 +250,9 @@ module.exports['_stream_readable.js'] = [
, addUintStuff
, errorsOneLevel
, warnings
, numberIE11
, noAsyncIterators1
, noAsyncIterators2
]

module.exports['_stream_transform.js'] = [
Expand Down Expand Up @@ -305,6 +324,7 @@ module.exports['internal/streams/end-of-stream.js'] = [
]

module.exports['internal/streams/pipeline.js'] = [
once
, errorsTwoLevel
, [
/require\('internal\/streams\/end-of-stream'\)/,
Expand Down
12 changes: 12 additions & 0 deletions build/test-replacements.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,18 @@ module.exports['common.js'] = [
[
/async_wrap\.async_hook_fields\[kCheck\] \+= 1;/,
'// async_wrap.async_hook_fields[kCheck] += 1;'
],
[
/os\.cpus\(\)/,
'os.cpus().length === 0 ? [{ speed: 1000 }] : os.cpus()'
],
[
/const buildType = process.config.target_defaults.default_configuration;/,
'const buildType = \'readable-stream\';'
],
[
/const hasCrypto = Boolean\(process.versions.openssl\);/,
'const hasCrypto = !!process.browser;'
]
]

Expand Down
12 changes: 7 additions & 5 deletions lib/_stream_readable.js
Original file line number Diff line number Diff line change
Expand Up @@ -941,11 +941,13 @@ Readable.prototype.wrap = function (stream) {
return this;
};

Readable.prototype[Symbol.asyncIterator] = function () {
emitExperimentalWarning('Readable[Symbol.asyncIterator]');
if (ReadableAsyncIterator === undefined) ReadableAsyncIterator = require('./internal/streams/async_iterator');
return new ReadableAsyncIterator(this);
};
if (typeof Symbol === 'function') {
Readable.prototype[Symbol.asyncIterator] = function () {
emitExperimentalWarning('Readable[Symbol.asyncIterator]');
if (ReadableAsyncIterator === undefined) ReadableAsyncIterator = require('./internal/streams/async_iterator');
return new ReadableAsyncIterator(this);
};
}

Object.defineProperty(Readable.prototype, 'readableHighWaterMark', {
// making it explicit this property is not enumerable
Expand Down
15 changes: 6 additions & 9 deletions lib/internal/streams/pipeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,16 @@

var eos = void 0;

var _require$codes = require('../../../errors').codes,
ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS,
ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED;

function once(callback) {
var called = false;
return function (err) {
if (called) return;
called = true;
callback(err);
var called = false;return function () {
if (called) return;called = true;callback.apply(undefined, arguments);
};
}

var _require$codes = require('../../../errors').codes,
ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS,
ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED;

function noop(err) {
// Rethrow the error if it exists to avoid swallowing it
if (err) throw err;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"test": "tap -j 4 test/parallel/*.js test/ours/*.js",
"ci": "TAP=1 tap test/parallel/*.js test/ours/*.js | tee test.tap",
"test-browsers": "airtap --sauce-connect --loopback airtap.local -- test/browser.js",
"test-browser-local": "airtap --local -- test/browser.js",
"test-browser-local": "airtap --open --local -- test/browser.js",
"cover": "nyc npm test",
"report": "nyc report --reporter=lcov",
"update-browser-errors": "babel --presets env -o errors-browser.js errors.js"
Expand Down
20 changes: 16 additions & 4 deletions test/common/heap.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,17 @@ var State = function () {
return [expectedChild.name, 'Node / ' + expectedChild.name].includes(node.name);
};

assert(snapshot.some(function (node) {
var hasChild = snapshot.some(function (node) {
return node.outgoingEdges.map(function (edge) {
return edge.toNode;
}).some(check);
}), 'expected to find child ' + util.inspect(expectedChild) + ' ' + ('in ' + util.inspect(snapshot)));
});
// Don't use assert with a custom message here. Otherwise the
// inspection in the message is done eagerly and wastes a lot of CPU
// time.
if (!hasChild) {
throw new Error('expected to find child ' + (util.inspect(expectedChild) + ' in ' + util.inspect(snapshot)));
}
};

var _iteratorNormalCompletion3 = true;
Expand Down Expand Up @@ -134,9 +140,15 @@ var State = function () {
return node.name === _expectedChild.name || node.value && node.value.constructor && node.value.constructor.name === _expectedChild.name;
};

assert(graph.some(function (node) {
// Don't use assert with a custom message here. Otherwise the
// inspection in the message is done eagerly and wastes a lot of CPU
// time.
var hasChild = graph.some(function (node) {
return node.edges.some(check);
}), 'expected to find child ' + util.inspect(_expectedChild) + ' ' + ('in ' + util.inspect(snapshot)));
});
if (!hasChild) {
throw new Error('expected to find child ' + (util.inspect(_expectedChild) + ' in ' + util.inspect(snapshot)));
}
};

var _iteratorNormalCompletion4 = true;
Expand Down
Loading