Skip to content

Commit c41fa76

Browse files
committed
build based on 5.7.0 now with babel
new build uses babel for arrow functions and const/let stuff also makes iThings allowed failures
1 parent 7e9bf6f commit c41fa76

File tree

60 files changed

+2934
-2942
lines changed

Some content is hidden

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

60 files changed

+2934
-2942
lines changed

.travis.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ before_install:
66
notifications:
77
email: false
88
matrix:
9+
fast_finish: true
10+
allow_failures:
11+
- env: TASK=browser BROWSER_NAME=ipad BROWSER_VERSION="6.0..latest"
12+
- env: TASK=browser BROWSER_NAME=iphone BROWSER_VERSION="6.0..latest"
913
include:
1014
- node_js: '0.8'
1115
env: TASK=test
@@ -36,9 +40,9 @@ matrix:
3640
- node_js: 5
3741
env: TASK=browser BROWSER_NAME=firefox BROWSER_VERSION="-3..latest"
3842
- node_js: 5
39-
env: TASK=browser BROWSER_NAME=ipad BROWSER_VERSION="6.0..7.1"
43+
env: TASK=browser BROWSER_NAME=ipad BROWSER_VERSION="6.0..latest"
4044
- node_js: 5
41-
env: TASK=browser BROWSER_NAME=iphone BROWSER_VERSION="6.0..7.1"
45+
env: TASK=browser BROWSER_NAME=iphone BROWSER_VERSION="6.0..latest"
4246
- node_js: 5
4347
env: TASK=browser BROWSER_NAME=safari BROWSER_VERSION="5..latest"
4448
script: "npm run $TASK"

README.md

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

3-
***Node-core v5.6.0 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 v5.7.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/)

build/build.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const hyperquest = require('hyperzip')(require('hyperdirect'))
55
, fs = require('fs')
66
, path = require('path')
77
, cheerio = require('cheerio')
8+
, babel = require('babel-core')
89
, encoding = 'utf8'
910
, urlRegex = /^https?:\/\//
1011
, nodeVersion = process.argv[2]
@@ -46,7 +47,13 @@ function processFile (inputLoc, out, replacements) {
4647
replacements.forEach(function (replacement) {
4748
data = data.replace.apply(data, replacement)
4849
})
49-
50+
if (inputLoc.slice(-3) === '.js') {
51+
const transformed = babel.transform(data, {
52+
retainLines: true,
53+
plugins: ['transform-es2015-arrow-functions', 'transform-es2015-block-scoping']
54+
})
55+
data = transformed.code
56+
}
5057
fs.writeFile(out, data, encoding, function (err) {
5158
if (err) throw err
5259

build/common-replacements.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,3 @@ module.exports.objectKeysReplacement = [
3939
/Object\.keys/g
4040
, 'objectKeys'
4141
]
42-
43-
module.exports.constReplacement = [
44-
/\bconst\b/g
45-
, 'var'
46-
]

build/files.js

Lines changed: 15 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ const headRegexp = /(^module.exports = \w+;?)/m
1212
/(require\(['"])(_stream_)/g
1313
, '$1./$2'
1414
]
15-
1615
, instanceofReplacement = [
1716
/instanceof Stream\.(\w+)/g
1817
, function (match, streamType) {
@@ -44,15 +43,15 @@ const headRegexp = /(^module.exports = \w+;?)/m
4443
, altIndexOfUseReplacement = require('./common-replacements').altIndexOfUseReplacement
4544

4645
, utilReplacement = [
47-
/^var util = require\('util'\);/m
48-
, '\n/*<replacement>*/\nvar util = require(\'core-util-is\');\n'
46+
/^const util = require\('util'\);/m
47+
, '\n/*<replacement>*/\nconst util = require(\'core-util-is\');\n'
4948
+ 'util.inherits = require(\'inherits\');\n/*</replacement>*/\n'
5049
]
5150

5251
, debugLogReplacement = [
53-
/var debug = util.debuglog\('stream'\);/
54-
, '\n\n/*<replacement>*/\nvar debugUtil = require(\'util\');\n'
55-
+ 'var debug;\n'
52+
/const debug = util.debuglog\('stream'\);/
53+
, '\n\n/*<replacement>*/\nconst debugUtil = require(\'util\');\n'
54+
+ 'let debug;\n'
5655
+ 'if (debugUtil && debugUtil.debuglog) {\n'
5756
+ ' debug = debugUtil.debuglog(\'stream\');\n'
5857
+ '} else {\n'
@@ -103,8 +102,6 @@ const headRegexp = /(^module.exports = \w+;?)/m
103102
, 'EElistenerCount'
104103
]
105104

106-
, constReplacement = require('./common-replacements').constReplacement
107-
108105
, bufferIsEncodingReplacement = [
109106
/Buffer.isEncoding\((\w+)\)/
110107
, '([\'hex\', \'utf8\', \'utf-8\', \'ascii\', \'binary\', \'base64\',\n'
@@ -113,7 +110,7 @@ const headRegexp = /(^module.exports = \w+;?)/m
113110
]
114111

115112
, requireStreamReplacement = [
116-
/var Stream = require\('stream'\);/
113+
/const Stream = require\('stream'\);/
117114
, '\n\n/*<replacement>*/\n'
118115
+ 'var Stream;\n(function (){try{\n'
119116
+ ' Stream = require(\'st\' + \'ream\');\n'
@@ -140,18 +137,13 @@ const headRegexp = /(^module.exports = \w+;?)/m
140137
]
141138

142139
, internalUtilReplacement = [
143-
/^var internalUtil = require\('internal\/util'\);/m
144-
, '\n/*<replacement>*/\nvar internalUtil = {\n deprecate: require(\'util-deprecate\')\n};\n'
140+
/^const internalUtil = require\('internal\/util'\);/m
141+
, '\n/*<replacement>*/\nconst internalUtil = {\n deprecate: require(\'util-deprecate\')\n};\n'
145142
+ '/*</replacement>*/\n'
146143
]
147-
,
148-
letReplacements = [
149-
/\blet\b/g
150-
, 'var'
151-
]
144+
152145
module.exports['_stream_duplex.js'] = [
153-
constReplacement
154-
, requireReplacement
146+
requireReplacement
155147
, instanceofReplacement
156148
, utilReplacement
157149
, stringDecoderReplacement
@@ -164,16 +156,14 @@ module.exports['_stream_duplex.js'] = [
164156
]
165157

166158
module.exports['_stream_passthrough.js'] = [
167-
constReplacement
168-
, requireReplacement
159+
requireReplacement
169160
, instanceofReplacement
170161
, utilReplacement
171162
, stringDecoderReplacement
172163
]
173164

174165
module.exports['_stream_readable.js'] = [
175-
constReplacement
176-
, addDuplexRequire
166+
addDuplexRequire
177167
, requireReplacement
178168
, instanceofReplacement
179169
, bufferReplacement
@@ -194,20 +184,17 @@ module.exports['_stream_readable.js'] = [
194184
, processNextTickImport
195185
, processNextTickReplacement
196186
, eventEmittterListenerCountReplacement
197-
, letReplacements
198187
]
199188

200189
module.exports['_stream_transform.js'] = [
201-
constReplacement
202-
, requireReplacement
190+
requireReplacement
203191
, instanceofReplacement
204192
, utilReplacement
205193
, stringDecoderReplacement
206194
]
207195

208196
module.exports['_stream_writable.js'] = [
209-
constReplacement
210-
, addDuplexRequire
197+
addDuplexRequire
211198
, requireReplacement
212199
, instanceofReplacement
213200
, bufferReplacement
@@ -224,4 +211,5 @@ module.exports['_stream_writable.js'] = [
224211
, processNextTickImport
225212
, processNextTickReplacement
226213
, internalUtilReplacement
214+
227215
]

build/package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@
44
"description": "",
55
"main": "build.js",
66
"dependencies": {
7+
"babel-core": "^6.5.2",
8+
"babel-plugin-transform-es2015-arrow-functions": "^6.5.2",
9+
"babel-plugin-transform-es2015-block-scoping": "^6.5.0",
710
"bl": "~0.6.0",
8-
"hyperzip": "0.0.0",
11+
"cheerio": "~0.13.1",
912
"hyperdirect": "0.0.0",
10-
"cheerio": "~0.13.1"
13+
"hyperzip": "0.0.0"
1114
}
1215
}

build/test-replacements.js

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ const altForEachImplReplacement = require('./common-replacements').altForEachImp
66
require('./common-replacements').objectKeysDefine
77
, objectKeysReplacement =
88
require('./common-replacements').objectKeysReplacement
9-
, constReplacement =
10-
require('./common-replacements').constReplacement
119

1210
module.exports.all = [
1311
[
@@ -32,7 +30,6 @@ module.exports.all = [
3230
/Stream.(Readable|Writable|Duplex|Transform|PassThrough)/g
3331
, 'require(\'../../\').$1'
3432
]
35-
, constReplacement
3633

3734
]
3835

@@ -66,7 +63,6 @@ module.exports['common.js'] = [
6663
, objectKeysReplacement
6764
, altForEachImplReplacement
6865
, altForEachUseReplacement
69-
, constReplacement
7066

7167
, [
7268
/(exports.mustCall[\s\S]*)/m
@@ -147,21 +143,16 @@ module.exports['common.js'] = [
147143
/require\(['"]stream['"]\)/g
148144
, 'require(\'../\')'
149145
],
150-
[/forEach\(data, line => \{\n\s+this\.emit\('data', line \+ '\\n'\);\n\s+\}\);/m,
151-
`var self = this;
152-
forEach(data, function(line) {
153-
self.emit('data', line + '\\n');
154-
});`
155-
],
156-
[
157-
/(varructor,)/,
158-
'// $1'
159-
],
160146
[
161147
/^var util = require\('util'\);/m
162148
, '\n/*<replacement>*/\nvar util = require(\'core-util-is\');\n'
163149
+ 'util.inherits = require(\'inherits\');\n/*</replacement>*/\n'
164-
]
150+
],
151+
[
152+
/^const util = require\('util'\);/m
153+
, '\n/*<replacement>*/\nvar util = require(\'core-util-is\');\n'
154+
+ 'util.inherits = require(\'inherits\');\n/*</replacement>*/\n'
155+
]
165156
]
166157

167158
// this test has some trouble with the nextTick depth when run
@@ -191,7 +182,12 @@ module.exports['test-stream2-large-read-stall.js'] = [
191182
module.exports['test-stream-pipe-cleanup.js'] = [
192183
[
193184
/(function Writable\(\) \{)/
194-
, 'if (/^v0\\.8\\./.test(process.version))\n return\n\n$1'
185+
, '(function (){\nif (/^v0\\.8\\./.test(process.version))\n return\n\n$1'
186+
]
187+
,
188+
[
189+
/$/
190+
,'}())'
195191
]
196192
]
197193

@@ -218,25 +214,31 @@ module.exports['test-stream-pipe-without-listenerCount.js'] = [
218214
[
219215
/require\(\'stream\'\)/g,
220216
'stream'
221-
],
222-
[
223-
/const /g,
224-
'var '
225217
]
226218
]
227219

228-
module.exports['test-stream-pipe-cleanup-pause.js'] = [
220+
module.exports['test-stream2-readable-empty-buffer-no-eof.js'] = [
229221
[
230-
/const /g,
231-
'var '
222+
`const buf = Buffer(5).fill('x');`,
223+
`const buf = new Buffer(5);
224+
buf.fill('x');`
232225
]
233226
]
234-
module.exports['test-stream2-readable-empty-buffer-no-eof.js'] = [[
235-
/let /g,
236-
'var '],
227+
228+
module.exports['test-stream2-unpipe-drain.js'] = [
237229
[
238-
`var buf = Buffer(5).fill('x');`,
239-
`var buf = new Buffer(5);
240-
buf.fill('x');`
230+
/^/,
231+
`(function () {\n`
232+
],
233+
[
234+
/$/
235+
,'}())'
241236
]
242237
]
238+
239+
module.exports['test-stream2-decode-partial.js'] = [
240+
[
241+
/readable\.push\(source\.slice\(4, 6\)\)/
242+
,`readable.push(source.slice(4, source.length));`
243+
]
244+
]

0 commit comments

Comments
 (0)