Skip to content

Commit e9cde33

Browse files
committed
Built with 29 tests failing
1 parent b3cf9b1 commit e9cde33

File tree

130 files changed

+4155
-959
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

130 files changed

+4155
-959
lines changed

.travis.yml

Lines changed: 2 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,15 @@
11
sudo: false
22
language: node_js
3-
before_install:
4-
- npm install -g npm@2
5-
- test $NPM_LEGACY && npm install -g npm@latest-3 || npm install npm -g
63
notifications:
74
email: false
85
matrix:
96
fast_finish: true
107
include:
11-
- node_js: '0.8'
12-
env:
13-
- TASK=test
14-
- NPM_LEGACY=true
15-
- node_js: '0.10'
16-
env:
17-
- TASK=test
18-
- NPM_LEGACY=true
19-
- node_js: '0.11'
20-
env:
21-
- TASK=test
22-
- NPM_LEGACY=true
23-
- node_js: '0.12'
24-
env:
25-
- TASK=test
26-
- NPM_LEGACY=true
27-
- node_js: 1
28-
env:
29-
- TASK=test
30-
- NPM_LEGACY=true
31-
- node_js: 2
32-
env:
33-
- TASK=test
34-
- NPM_LEGACY=true
35-
- node_js: 3
36-
env:
37-
- TASK=test
38-
- NPM_LEGACY=true
39-
- node_js: 4
40-
env: TASK=test
41-
- node_js: 5
42-
env: TASK=test
438
- node_js: 6
44-
env: TASK=test
45-
- node_js: 7
46-
env: TASK=test
479
- node_js: 8
48-
env: TASK=test
4910
- node_js: 9
50-
env: TASK=test
51-
script: "npm run $TASK"
11+
- node_js: 10
12+
script: "npm test"
5213
env:
5314
global:
5415
- secure: rE2Vvo7vnjabYNULNyLFxOyt98BoJexDqsiOnfiD6kLYYsiQGfr/sbZkPMOFm9qfQG7pjqx+zZWZjGSswhTt+626C0t/njXqug7Yps4c3dFblzGfreQHp7wNX5TFsvrxd6dAowVasMp61sJcRnB2w8cUzoe3RAYUDHyiHktwqMc=

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# readable-stream
22

3-
***Node-core v8.11.1 streams for userland*** [![Build Status](https://travis-ci.org/nodejs/readable-stream.svg?branch=master)](https://travis-ci.org/nodejs/readable-stream)
3+
***Node-core v10.1.0 streams for userland*** [![Build Status](https://travis-ci.org/nodejs/readable-stream.svg?branch=master)](https://travis-ci.org/nodejs/readable-stream)
44

55

66
[![NPM](https://nodei.co/npm/readable-stream.png?downloads=true&downloadRank=true)](https://nodei.co/npm/readable-stream/)
@@ -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/v8.11.1/docs/api/stream.html).
21+
Full documentation may be found on the [Node.js website](https://nodejs.org/dist/v10.1.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: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ if (!usageVersionRegex.test(nodeVersion)) {
3636
}
3737

3838
// `inputLoc`: URL or local path.
39-
function processFile (inputLoc, out, replacements) {
39+
function processFile (inputLoc, out, replacements, addAtEnd) {
4040
var file = fs.createReadStream(inputLoc, encoding)
4141

4242
file.pipe(bl(function (err, data) {
@@ -55,6 +55,10 @@ function processFile (inputLoc, out, replacements) {
5555
}
5656
data = data.replace(regexp, arg2)
5757
})
58+
59+
if (addAtEnd) {
60+
data += addAtEnd
61+
}
5862
if (inputLoc.slice(-3) === '.js') {
5963
try {
6064
const transformed = babel.transform(data, {
@@ -65,6 +69,7 @@ function processFile (inputLoc, out, replacements) {
6569
'transform-es2015-template-literals',
6670
'transform-es2015-shorthand-properties',
6771
'transform-es2015-for-of',
72+
'transform-async-generator-functions',
6873
['transform-es2015-classes', { loose: true }],
6974
'transform-es2015-destructuring',
7075
'transform-es2015-computed-properties',
@@ -113,7 +118,7 @@ function processTestFile (file) {
113118
if (testReplace[file])
114119
replacements = replacements.concat(testReplace[file])
115120

116-
processFile(url, out, replacements)
121+
processFile(url, out, replacements, ';require(\'tap\').pass(\'sync run\');')
117122
}
118123

119124
//--------------------------------------------------------------------

build/files.js

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,6 @@ const headRegexp = /(^module.exports = \w+;?)/m
7272
+ '}catch(_){}}());\n'
7373
]
7474

75-
, isArrayDefine = [
76-
headRegexp
77-
, '$1\n\n/*<replacement>*/\nvar isArray = require(\'isarray\');\n/*</replacement>*/\n'
78-
]
79-
80-
, isArrayReplacement = [
81-
/Array\.isArray/g
82-
, 'isArray'
83-
]
84-
8575
, objectKeysDefine = require('./common-replacements').objectKeysDefine
8676

8777
, objectKeysReplacement = require('./common-replacements').objectKeysReplacement
@@ -230,6 +220,18 @@ function CorkedRequest(state) {
230220
/Buffer\.prototype\.copy\.call\(src, target, offset\);/
231221
, 'src.copy(target, offset);'
232222
]
223+
, errorsOneLevel = [
224+
/internal\/errors/
225+
, '../errors'
226+
]
227+
, errorsTwoLevel = [
228+
/internal\/errors/
229+
, '../../../errors'
230+
]
231+
, warnings = [
232+
/^const { emitExperimentalWarning } = require\('internal\/util'\);/m,
233+
'const { emitExperimentalWarning } = require(\'../experimentalWarning\');'
234+
]
233235

234236
module.exports['_stream_duplex.js'] = [
235237
requireReplacement
@@ -240,13 +242,15 @@ module.exports['_stream_duplex.js'] = [
240242
, objectKeysDefine
241243
, processNextTickImport
242244
, processNextTickReplacement
245+
, errorsOneLevel
243246
]
244247

245248
module.exports['_stream_passthrough.js'] = [
246249
requireReplacement
247250
, instanceofReplacement
248251
, utilReplacement
249252
, stringDecoderReplacement
253+
, errorsOneLevel
250254
]
251255

252256
module.exports['_stream_readable.js'] = [
@@ -257,8 +261,6 @@ module.exports['_stream_readable.js'] = [
257261
, altIndexOfImplReplacement
258262
, altIndexOfUseReplacement
259263
, stringDecoderReplacement
260-
, isArrayReplacement
261-
, isArrayDefine
262264
, debugLogReplacement
263265
, utilReplacement
264266
, stringDecoderReplacement
@@ -272,13 +274,16 @@ module.exports['_stream_readable.js'] = [
272274
, safeBufferFix
273275
, fixUintStuff
274276
, addUintStuff
277+
, errorsOneLevel
278+
, warnings
275279
]
276280

277281
module.exports['_stream_transform.js'] = [
278282
requireReplacement
279283
, instanceofReplacement
280284
, utilReplacement
281285
, stringDecoderReplacement
286+
, errorsOneLevel
282287
]
283288

284289
module.exports['_stream_writable.js'] = [
@@ -311,9 +316,10 @@ module.exports['_stream_writable.js'] = [
311316
, useWriteReq
312317
, useCorkedRequest
313318
, addConstructors
319+
, errorsOneLevel
314320
]
315321

316-
module.exports['internal/streams/BufferList.js'] = [
322+
module.exports['internal/streams/buffer_list.js'] = [
317323
[
318324
/(?:var|const) (?:{ )Buffer(?: }) = require\('buffer'\)(?:\.Buffer)?;/,
319325
`
@@ -339,4 +345,17 @@ if (util && util.inspect && util.inspect.custom) {
339345
module.exports['internal/streams/destroy.js'] = [
340346
processNextTickImport
341347
, processNextTickReplacement
348+
, errorsTwoLevel
349+
]
350+
351+
module.exports['internal/streams/state.js'] = [
352+
processNextTickImport
353+
, processNextTickReplacement
354+
, errorsTwoLevel
355+
]
356+
357+
module.exports['internal/streams/async_iterator.js'] = [
358+
processNextTickImport
359+
, processNextTickReplacement
360+
, errorsTwoLevel
342361
]

build/package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "",
55
"main": "build.js",
66
"dependencies": {
7-
"babel-core": "^6.26.0",
7+
"babel-core": "^6.26.3",
88
"babel-plugin-transform-es2015-arrow-functions": "^6.5.2",
99
"babel-plugin-transform-es2015-block-scoping": "^6.26.0",
1010
"babel-plugin-transform-es2015-classes": "^6.24.1",
@@ -15,12 +15,15 @@
1515
"babel-plugin-transform-es2015-shorthand-properties": "^6.24.1",
1616
"babel-plugin-transform-es2015-spread": "^6.22.0",
1717
"babel-plugin-transform-es2015-template-literals": "^6.8.0",
18-
"bl": "^1.2.1",
18+
"bl": "^2.0.0",
1919
"glob": "^7.1.2",
2020
"gunzip-maybe": "^1.4.1",
2121
"hyperquest": "^2.1.3",
2222
"pump": "^3.0.0",
2323
"rimraf": "^2.6.2",
24-
"tar-fs": "^1.16.0"
24+
"tar-fs": "^1.16.2"
25+
},
26+
"devDependencies": {
27+
"babel-plugin-transform-async-generator-functions": "^6.24.1"
2528
}
2629
}

build/test-replacements.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,8 +301,8 @@ module.exports['test-stream3-cork-uncork.js'] = module.exports['test-stream3-cor
301301
]
302302
module.exports['test-stream2-readable-from-list.js'] = [
303303
[
304-
/require\('internal\/streams\/BufferList'\)/,
305-
'require(\'../../lib/internal/streams/BufferList\')'
304+
/require\('internal\/streams\/buffer_list'\)/,
305+
'require(\'../../lib/internal/streams/buffer_list\')'
306306
]
307307
]
308308
module.exports['test-stream-writev.js'] = [

errors.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
'use strict';
2+
3+
const codes = {};
4+
5+
function createErrorType(name) {
6+
function E(message) {
7+
if (!Error.captureStackTrace)
8+
this.stack = (new Error()).stack;
9+
else
10+
Error.captureStackTrace(this, this.constructor);
11+
this.message = message;
12+
}
13+
E.prototype = new Error();
14+
E.prototype.name = name;
15+
E.prototype.constructor = E;
16+
17+
codes[name] = E;
18+
}
19+
20+
createErrorType('ERR_INVALID_OPT_VALUE');
21+
createErrorType('ERR_INVALID_ARG_TYPE');
22+
createErrorType('ERR_STREAM_PUSH_AFTER_EOF');
23+
createErrorType('ERR_METHOD_NOT_IMPLEMENTED');
24+
createErrorType('ERR_STREAM_PUSH_AFTER_EOF');
25+
26+
module.exports.codes = codes;

experimentalWarning.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
'use strict'
2+
3+
const experimentalWarnings = new Set();
4+
5+
function emitExperimentalWarning(feature) {
6+
if (experimentalWarnings.has(feature)) return;
7+
const msg = `${feature} is an experimental feature. This feature could ` +
8+
'change at any time';
9+
experimentalWarnings.add(feature);
10+
process.emitWarning(msg, 'ExperimentalWarning');
11+
}
12+
13+
module.exports.emitExperimentalWarning = emitExperimentalWarning;

lib/_stream_duplex.js

Lines changed: 37 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ var Writable = require('./_stream_writable');
5353
util.inherits(Duplex, Readable);
5454

5555
{
56-
// avoid scope creep, the keys array can then be collected
56+
// Allow the keys array to be GC'ed.
5757
var keys = objectKeys(Writable.prototype);
5858
for (var v = 0; v < keys.length; v++) {
5959
var method = keys[v];
@@ -66,15 +66,18 @@ function Duplex(options) {
6666

6767
Readable.call(this, options);
6868
Writable.call(this, options);
69+
this.allowHalfOpen = true;
6970

70-
if (options && options.readable === false) this.readable = false;
71-
72-
if (options && options.writable === false) this.writable = false;
71+
if (options) {
72+
if (options.readable === false) this.readable = false;
7373

74-
this.allowHalfOpen = true;
75-
if (options && options.allowHalfOpen === false) this.allowHalfOpen = false;
74+
if (options.writable === false) this.writable = false;
7675

77-
this.once('end', onend);
76+
if (options.allowHalfOpen === false) {
77+
this.allowHalfOpen = false;
78+
this.once('end', onend);
79+
}
80+
}
7881
}
7982

8083
Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', {
@@ -87,11 +90,30 @@ Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', {
8790
}
8891
});
8992

93+
Object.defineProperty(Duplex.prototype, 'writableBuffer', {
94+
// making it explicit this property is not enumerable
95+
// because otherwise some prototype manipulation in
96+
// userland will fail
97+
enumerable: false,
98+
get: function () {
99+
return this._writableState && this._writableState.getBuffer();
100+
}
101+
});
102+
103+
Object.defineProperty(Duplex.prototype, 'writableLength', {
104+
// making it explicit this property is not enumerable
105+
// because otherwise some prototype manipulation in
106+
// userland will fail
107+
enumerable: false,
108+
get: function () {
109+
return this._writableState.length;
110+
}
111+
});
112+
90113
// the no-half-open enforcer
91114
function onend() {
92-
// if we allow half-open state, or if the writable side ended,
93-
// then we're ok.
94-
if (this.allowHalfOpen || this._writableState.ended) return;
115+
// If the writable side ended, then we're ok.
116+
if (this._writableState.ended) return;
95117

96118
// no more data can be written.
97119
// But allow more writes to happen in this tick.
@@ -103,6 +125,10 @@ function onEndNT(self) {
103125
}
104126

105127
Object.defineProperty(Duplex.prototype, 'destroyed', {
128+
// making it explicit this property is not enumerable
129+
// because otherwise some prototype manipulation in
130+
// userland will fail
131+
enumerable: false,
106132
get: function () {
107133
if (this._readableState === undefined || this._writableState === undefined) {
108134
return false;
@@ -121,11 +147,4 @@ Object.defineProperty(Duplex.prototype, 'destroyed', {
121147
this._readableState.destroyed = value;
122148
this._writableState.destroyed = value;
123149
}
124-
});
125-
126-
Duplex.prototype._destroy = function (err, cb) {
127-
this.push(null);
128-
this.end();
129-
130-
pna.nextTick(cb, err);
131-
};
150+
});

0 commit comments

Comments
 (0)