Skip to content

Commit 80c1f59

Browse files
committed
Updated to node v7.10.0.
1 parent a449bc8 commit 80c1f59

File tree

9 files changed

+195
-18
lines changed

9 files changed

+195
-18
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ node_modules/
22
.zuul.yml
33
.nyc_output
44
coverage
5+
package-lock.json

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ sudo: false
22
language: node_js
33
before_install:
44
- npm install -g npm@2
5-
- npm install -g npm
5+
- npm install -g npm@4
66
notifications:
77
email: false
88
matrix:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ npm install --save readable-stream
1818
This package is a mirror of the Streams2 and Streams3 implementations in
1919
Node-core.
2020

21-
Full documentation may be found on the [Node.js website](https://nodejs.org/dist/v7.8.0/docs/api/stream.html).
21+
Full documentation may be found on the [Node.js website](https://nodejs.org/dist/v7.10.0/docs/api/stream.html).
2222

2323
If you want to guarantee a stable streams base, regardless of what version of
2424
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).

build/build.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ function processFile (inputLoc, out, replacements) {
6060
'transform-es2015-template-literals',
6161
'transform-es2015-shorthand-properties',
6262
'transform-es2015-for-of',
63+
'transform-es2015-classes',
6364
'transform-es2015-destructuring'
6465
]
6566
})

build/package.json

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,21 @@
44
"description": "",
55
"main": "build.js",
66
"dependencies": {
7-
"babel-core": "^6.5.2",
7+
"babel-core": "^6.24.1",
88
"babel-plugin-transform-es2015-arrow-functions": "^6.5.2",
9-
"babel-plugin-transform-es2015-block-scoping": "^6.5.0",
9+
"babel-plugin-transform-es2015-block-scoping": "^6.24.1",
10+
"babel-plugin-transform-es2015-classes": "^6.24.1",
1011
"babel-plugin-transform-es2015-destructuring": "^6.18.0",
1112
"babel-plugin-transform-es2015-for-of": "^6.8.0",
12-
"babel-plugin-transform-es2015-parameters": "^6.11.4",
13-
"babel-plugin-transform-es2015-shorthand-properties": "^6.8.0",
13+
"babel-plugin-transform-es2015-parameters": "^6.24.1",
14+
"babel-plugin-transform-es2015-shorthand-properties": "^6.24.1",
1415
"babel-plugin-transform-es2015-template-literals": "^6.8.0",
15-
"bl": "^1.2.0",
16-
"glob": "^7.1.1",
16+
"bl": "^1.2.1",
17+
"glob": "^7.1.2",
1718
"gunzip-maybe": "^1.4.0",
1819
"hyperquest": "^2.1.2",
1920
"pump": "^1.0.2",
2021
"rimraf": "^2.6.1",
21-
"tar-fs": "^1.15.1"
22+
"tar-fs": "^1.15.2"
2223
}
2324
}

lib/_stream_readable.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ Readable.prototype.pipe = function (dest, pipeOpts) {
482482

483483
var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
484484

485-
var endFn = doEnd ? onend : cleanup;
485+
var endFn = doEnd ? onend : unpipe;
486486
if (state.endEmitted) processNextTick(endFn);else src.once('end', endFn);
487487

488488
dest.on('unpipe', onunpipe);
@@ -515,7 +515,7 @@ Readable.prototype.pipe = function (dest, pipeOpts) {
515515
dest.removeListener('error', onerror);
516516
dest.removeListener('unpipe', onunpipe);
517517
src.removeListener('end', onend);
518-
src.removeListener('end', cleanup);
518+
src.removeListener('end', unpipe);
519519
src.removeListener('data', ondata);
520520

521521
cleanedUp = true;

test/common.js

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,7 @@ if (global.__coverage__) knownGlobals.push(__coverage__);
377377
function leakedGlobals() {
378378
var leaked = [];
379379

380+
// eslint-disable-next-line no-var
380381
for (var val in global) {
381382
if (!knownGlobals.includes(global[val])) leaked.push(val);
382383
}if (global.__coverage__) {
@@ -564,15 +565,46 @@ exports.isAlive = function isAlive(pid) {
564565
}
565566
};
566567

567-
exports.expectWarning = function (name, expected) {
568-
if (typeof expected === 'string') expected = [expected];
569-
process.on('warning', exports.mustCall(function (warning) {
568+
function expectWarning(name, expectedMessages) {
569+
return exports.mustCall(function (warning) {
570570
assert.strictEqual(warning.name, name);
571-
assert.ok(expected.includes(warning.message), 'unexpected error message: "' + warning.message + '"');
571+
assert.ok(expectedMessages.includes(warning.message), 'unexpected error message: "' + warning.message + '"');
572572
// Remove a warning message after it is seen so that we guarantee that we
573573
// get each message only once.
574-
expected.splice(expected.indexOf(warning.message), 1);
575-
}, expected.length));
574+
expectedMessages.splice(expectedMessages.indexOf(warning.message), 1);
575+
}, expectedMessages.length);
576+
}
577+
578+
function expectWarningByName(name, expected) {
579+
if (typeof expected === 'string') {
580+
expected = [expected];
581+
}
582+
process.on('warning', expectWarning(name, expected));
583+
}
584+
585+
function expectWarningByMap(warningMap) {
586+
var catchWarning = {};
587+
forEach(objectKeys(warningMap), function (name) {
588+
var expected = warningMap[name];
589+
if (typeof expected === 'string') {
590+
expected = [expected];
591+
}
592+
catchWarning[name] = expectWarning(name, expected);
593+
});
594+
process.on('warning', function (warning) {
595+
return catchWarning[warning.name](warning);
596+
});
597+
}
598+
599+
// accepts a warning name and description or array of descriptions or a map
600+
// of warning names to description(s)
601+
// ensures a warning is generated for each name/description pair
602+
exports.expectWarning = function (nameOrMap, expected) {
603+
if (typeof nameOrMap === 'string') {
604+
expectWarningByName(nameOrMap, expected);
605+
} else {
606+
expectWarningByMap(nameOrMap);
607+
}
576608
};
577609

578610
/*<replacement>*/if (!process.browser) {

test/parallel/test-stream-duplex.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ var bufferShim = require('safe-buffer').Buffer;
33
/*</replacement>*/
44
require('../common');
55
var assert = require('assert/');
6-
var Duplex = require('../../').Transform;
6+
var Duplex = require('../../').Duplex;
77

88
var stream = new Duplex({ objectMode: true });
99

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
2+
3+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4+
5+
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
6+
7+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
8+
9+
/*<replacement>*/
10+
var bufferShim = require('safe-buffer').Buffer;
11+
/*</replacement>*/
12+
var common = require('../common');
13+
var assert = require('assert/');
14+
15+
var _require = require('../../'),
16+
Writable = _require.Writable,
17+
Readable = _require.Readable;
18+
19+
var NullWriteable = function (_Writable) {
20+
_inherits(NullWriteable, _Writable);
21+
22+
function NullWriteable() {
23+
_classCallCheck(this, NullWriteable);
24+
25+
return _possibleConstructorReturn(this, (NullWriteable.__proto__ || Object.getPrototypeOf(NullWriteable)).apply(this, arguments));
26+
}
27+
28+
_createClass(NullWriteable, [{
29+
key: '_write',
30+
value: function _write(chunk, encoding, callback) {
31+
return callback();
32+
}
33+
}]);
34+
35+
return NullWriteable;
36+
}(Writable);
37+
38+
var QuickEndReadable = function (_Readable) {
39+
_inherits(QuickEndReadable, _Readable);
40+
41+
function QuickEndReadable() {
42+
_classCallCheck(this, QuickEndReadable);
43+
44+
return _possibleConstructorReturn(this, (QuickEndReadable.__proto__ || Object.getPrototypeOf(QuickEndReadable)).apply(this, arguments));
45+
}
46+
47+
_createClass(QuickEndReadable, [{
48+
key: '_read',
49+
value: function _read() {
50+
this.push(null);
51+
}
52+
}]);
53+
54+
return QuickEndReadable;
55+
}(Readable);
56+
57+
var NeverEndReadable = function (_Readable2) {
58+
_inherits(NeverEndReadable, _Readable2);
59+
60+
function NeverEndReadable() {
61+
_classCallCheck(this, NeverEndReadable);
62+
63+
return _possibleConstructorReturn(this, (NeverEndReadable.__proto__ || Object.getPrototypeOf(NeverEndReadable)).apply(this, arguments));
64+
}
65+
66+
_createClass(NeverEndReadable, [{
67+
key: '_read',
68+
value: function _read() {}
69+
}]);
70+
71+
return NeverEndReadable;
72+
}(Readable);
73+
74+
function noop() {}
75+
76+
{
77+
var dest = new NullWriteable();
78+
var src = new QuickEndReadable();
79+
dest.on('pipe', common.mustCall(noop));
80+
dest.on('unpipe', common.mustCall(noop));
81+
src.pipe(dest);
82+
setImmediate(function () {
83+
assert.strictEqual(src._readableState.pipesCount, 0);
84+
});
85+
}
86+
87+
{
88+
var _dest = new NullWriteable();
89+
var _src = new NeverEndReadable();
90+
_dest.on('pipe', common.mustCall(noop));
91+
_dest.on('unpipe', common.mustNotCall('unpipe should not have been emitted'));
92+
_src.pipe(_dest);
93+
setImmediate(function () {
94+
assert.strictEqual(_src._readableState.pipesCount, 1);
95+
});
96+
}
97+
98+
{
99+
var _dest2 = new NullWriteable();
100+
var _src2 = new NeverEndReadable();
101+
_dest2.on('pipe', common.mustCall(noop));
102+
_dest2.on('unpipe', common.mustCall(noop));
103+
_src2.pipe(_dest2);
104+
_src2.unpipe(_dest2);
105+
setImmediate(function () {
106+
assert.strictEqual(_src2._readableState.pipesCount, 0);
107+
});
108+
}
109+
110+
{
111+
var _dest3 = new NullWriteable();
112+
var _src3 = new QuickEndReadable();
113+
_dest3.on('pipe', common.mustCall(noop));
114+
_dest3.on('unpipe', common.mustCall(noop));
115+
_src3.pipe(_dest3, { end: false });
116+
setImmediate(function () {
117+
assert.strictEqual(_src3._readableState.pipesCount, 0);
118+
});
119+
}
120+
121+
{
122+
var _dest4 = new NullWriteable();
123+
var _src4 = new NeverEndReadable();
124+
_dest4.on('pipe', common.mustCall(noop));
125+
_dest4.on('unpipe', common.mustNotCall('unpipe should not have been emitted'));
126+
_src4.pipe(_dest4, { end: false });
127+
setImmediate(function () {
128+
assert.strictEqual(_src4._readableState.pipesCount, 1);
129+
});
130+
}
131+
132+
{
133+
var _dest5 = new NullWriteable();
134+
var _src5 = new NeverEndReadable();
135+
_dest5.on('pipe', common.mustCall(noop));
136+
_dest5.on('unpipe', common.mustCall(noop));
137+
_src5.pipe(_dest5, { end: false });
138+
_src5.unpipe(_dest5);
139+
setImmediate(function () {
140+
assert.strictEqual(_src5._readableState.pipesCount, 0);
141+
});
142+
}

0 commit comments

Comments
 (0)