fsevents 1.0.8 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of fsevents might be problematic. Click here for more details.
- package/node_modules/ansi-styles/index.js +72 -6
- package/node_modules/ansi-styles/package.json +19 -12
- package/node_modules/ansi-styles/readme.md +36 -8
- package/node_modules/are-we-there-yet/CHANGES.md +19 -0
- package/node_modules/are-we-there-yet/README.md +12 -2
- package/node_modules/are-we-there-yet/index.js +4 -132
- package/node_modules/are-we-there-yet/package.json +18 -13
- package/node_modules/are-we-there-yet/test/lib/test-event.js +29 -0
- package/node_modules/are-we-there-yet/test/tracker.js +44 -43
- package/node_modules/are-we-there-yet/test/trackergroup.js +73 -64
- package/node_modules/are-we-there-yet/test/trackerstream.js +26 -40
- package/node_modules/are-we-there-yet/tracker-base.js +11 -0
- package/node_modules/are-we-there-yet/tracker-group.js +107 -0
- package/node_modules/are-we-there-yet/tracker-stream.js +35 -0
- package/node_modules/are-we-there-yet/tracker.js +30 -0
- package/node_modules/asn1/package.json +1 -2
- package/node_modules/assert-plus/package.json +1 -3
- package/node_modules/async/package.json +1 -1
- package/node_modules/aws4/.npmignore +2 -1
- package/node_modules/aws4/README.md +4 -0
- package/node_modules/aws4/aws4.js +8 -3
- package/node_modules/aws4/node_modules/lru-cache/.npmignore +3 -0
- package/node_modules/aws4/node_modules/lru-cache/.travis.yml +3 -4
- package/node_modules/aws4/node_modules/lru-cache/README.md +29 -24
- package/node_modules/aws4/node_modules/lru-cache/benchmarks/insertion-time.js +32 -0
- package/node_modules/aws4/node_modules/lru-cache/lib/lru-cache.js +333 -199
- package/node_modules/aws4/node_modules/lru-cache/node_modules/pseudomap/LICENSE +15 -0
- package/node_modules/aws4/node_modules/lru-cache/node_modules/pseudomap/README.md +60 -0
- package/node_modules/aws4/node_modules/lru-cache/node_modules/pseudomap/map.js +9 -0
- package/node_modules/aws4/node_modules/lru-cache/node_modules/pseudomap/package.json +59 -0
- package/node_modules/aws4/node_modules/lru-cache/node_modules/pseudomap/pseudomap.js +113 -0
- package/node_modules/aws4/node_modules/lru-cache/node_modules/pseudomap/test/basic.js +86 -0
- package/node_modules/aws4/node_modules/lru-cache/node_modules/yallist/.npmignore +4 -0
- package/node_modules/aws4/node_modules/lru-cache/node_modules/yallist/.travis.yml +7 -0
- package/node_modules/aws4/node_modules/lru-cache/node_modules/yallist/CONTRIBUTING.md +4 -0
- package/node_modules/aws4/node_modules/lru-cache/node_modules/yallist/LICENSE +15 -0
- package/node_modules/aws4/node_modules/lru-cache/node_modules/yallist/README.md +204 -0
- package/node_modules/aws4/node_modules/lru-cache/node_modules/yallist/package.json +59 -0
- package/node_modules/aws4/node_modules/lru-cache/node_modules/yallist/test/basic.js +188 -0
- package/node_modules/aws4/node_modules/lru-cache/node_modules/yallist/yallist.js +360 -0
- package/node_modules/aws4/node_modules/lru-cache/package.json +16 -12
- package/node_modules/aws4/node_modules/lru-cache/test/basic.js +270 -146
- package/node_modules/aws4/node_modules/lru-cache/test/foreach.js +39 -25
- package/node_modules/aws4/node_modules/lru-cache/test/inspect.js +54 -0
- package/node_modules/aws4/node_modules/lru-cache/test/no-symbol.js +3 -0
- package/node_modules/aws4/node_modules/lru-cache/test/serialize.js +115 -104
- package/node_modules/aws4/package.json +17 -14
- package/node_modules/bl/bl.js +9 -3
- package/node_modules/bl/package.json +12 -12
- package/node_modules/bl/test/test.js +14 -0
- package/node_modules/color-convert/README.md +62 -0
- package/node_modules/color-convert/conversions.js +594 -0
- package/node_modules/color-convert/css-keywords.js +151 -0
- package/node_modules/color-convert/index.js +75 -0
- package/node_modules/color-convert/package.json +92 -0
- package/node_modules/color-convert/route.js +98 -0
- package/node_modules/dashdash/lib/dashdash.js +1 -1
- package/node_modules/dashdash/node_modules/assert-plus/AUTHORS +6 -0
- package/node_modules/dashdash/node_modules/assert-plus/CHANGES.md +14 -0
- package/node_modules/dashdash/node_modules/assert-plus/README.md +162 -0
- package/node_modules/dashdash/node_modules/assert-plus/assert.js +211 -0
- package/node_modules/dashdash/node_modules/assert-plus/package.json +89 -0
- package/node_modules/dashdash/package.json +19 -12
- package/node_modules/ecc-jsbn/package.json +1 -2
- package/node_modules/escape-string-regexp/package.json +15 -11
- package/node_modules/extsprintf/package.json +2 -3
- package/node_modules/form-data/.dockerignore +7 -0
- package/node_modules/form-data/.editorconfig +10 -0
- package/node_modules/form-data/.eslintignore +1 -0
- package/node_modules/form-data/.eslintrc +64 -0
- package/node_modules/form-data/{Readme.md → README.md} +9 -1
- package/node_modules/form-data/lib/browser.js +2 -1
- package/node_modules/form-data/lib/form_data.js +172 -135
- package/node_modules/form-data/lib/populate.js +9 -0
- package/node_modules/form-data/package.json +35 -16
- package/node_modules/form-data/wercker.yml +36 -0
- package/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/index.js +1 -1
- package/node_modules/fstream-ignore/node_modules/minimatch/node_modules/brace-expansion/package.json +14 -10
- package/node_modules/gauge/README.md +1 -1
- package/node_modules/gauge/package.json +18 -14
- package/node_modules/gauge/progress-bar.js +2 -2
- package/node_modules/http-signature/package.json +1 -2
- package/node_modules/is-my-json-valid/README.md +2 -2
- package/node_modules/is-my-json-valid/index.js +15 -6
- package/node_modules/is-my-json-valid/package.json +11 -7
- package/node_modules/is-my-json-valid/test/json-schema-draft4/multipleOf.json +36 -0
- package/node_modules/is-my-json-valid/test/misc.js +18 -0
- package/node_modules/is-typedarray/package.json +1 -2
- package/node_modules/isarray/.npmignore +1 -0
- package/node_modules/isarray/.travis.yml +4 -0
- package/node_modules/isarray/Makefile +6 -0
- package/node_modules/isarray/README.md +6 -0
- package/node_modules/isarray/index.js +3 -1
- package/node_modules/isarray/package.json +28 -10
- package/node_modules/isarray/test.js +20 -0
- package/node_modules/jodid25519/package.json +1 -2
- package/node_modules/jsbn/package.json +1 -2
- package/node_modules/json-schema/package.json +1 -1
- package/node_modules/jsprim/package.json +1 -2
- package/node_modules/lodash.pad/LICENSE +17 -16
- package/node_modules/lodash.pad/README.md +2 -2
- package/node_modules/lodash.pad/index.js +3 -94
- package/node_modules/lodash.pad/package.json +12 -12
- package/node_modules/lodash.padend/LICENSE +23 -0
- package/node_modules/lodash.padend/README.md +18 -0
- package/node_modules/lodash.padend/index.js +285 -0
- package/node_modules/lodash.padend/package.json +91 -0
- package/node_modules/lodash.padstart/LICENSE +23 -0
- package/node_modules/lodash.padstart/README.md +18 -0
- package/node_modules/lodash.padstart/index.js +285 -0
- package/node_modules/lodash.padstart/package.json +91 -0
- package/node_modules/lodash.repeat/LICENSE +17 -16
- package/node_modules/lodash.repeat/README.md +2 -2
- package/node_modules/lodash.repeat/index.js +3 -94
- package/node_modules/lodash.repeat/package.json +14 -13
- package/node_modules/lodash.tostring/LICENSE +23 -0
- package/node_modules/lodash.tostring/README.md +18 -0
- package/node_modules/lodash.tostring/index.js +164 -0
- package/node_modules/lodash.tostring/package.json +91 -0
- package/node_modules/mime-db/HISTORY.md +14 -0
- package/node_modules/mime-db/db.json +26 -3
- package/node_modules/mime-db/package.json +23 -18
- package/node_modules/mime-types/HISTORY.md +8 -0
- package/node_modules/mime-types/README.md +1 -1
- package/node_modules/mime-types/package.json +21 -16
- package/node_modules/node-pre-gyp/CHANGELOG.md +11 -0
- package/node_modules/node-pre-gyp/lib/util/abi_crosswalk.json +44 -4
- package/node_modules/node-pre-gyp/package.json +16 -16
- package/node_modules/npmlog/.nyc_output/64996.json +1 -0
- package/node_modules/npmlog/.nyc_output/64998.json +1 -0
- package/node_modules/npmlog/.nyc_output/65000.json +1 -0
- package/node_modules/npmlog/log.js +3 -2
- package/node_modules/npmlog/package.json +15 -11
- package/node_modules/npmlog/test/progress.js +25 -8
- package/node_modules/once/package.json +1 -1
- package/node_modules/qs/package.json +1 -2
- package/node_modules/readable-stream/.travis.yml +18 -16
- package/node_modules/readable-stream/README.md +1 -1
- package/node_modules/readable-stream/doc/stream.markdown +435 -405
- package/node_modules/readable-stream/lib/_stream_duplex.js +13 -20
- package/node_modules/readable-stream/lib/_stream_passthrough.js +3 -4
- package/node_modules/readable-stream/lib/_stream_readable.js +110 -205
- package/node_modules/readable-stream/lib/_stream_transform.js +21 -38
- package/node_modules/readable-stream/lib/_stream_writable.js +108 -121
- package/node_modules/readable-stream/package.json +19 -15
- package/node_modules/request/package.json +1 -2
- package/node_modules/rimraf/node_modules/glob/README.md +6 -0
- package/node_modules/rimraf/node_modules/glob/common.js +12 -3
- package/node_modules/rimraf/node_modules/glob/glob.js +20 -3
- package/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/index.js +1 -1
- package/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/package.json +14 -10
- package/node_modules/rimraf/node_modules/glob/package.json +15 -11
- package/node_modules/rimraf/node_modules/glob/sync.js +8 -1
- package/node_modules/rimraf/package.json +14 -10
- package/node_modules/semver/package.json +1 -2
- package/node_modules/sshpk/lib/formats/rfc4253.js +2 -1
- package/node_modules/sshpk/package.json +13 -10
- package/node_modules/strip-ansi/package.json +21 -16
- package/node_modules/strip-ansi/readme.md +5 -5
- package/node_modules/tough-cookie/lib/cookie.js +2 -2
- package/node_modules/tough-cookie/package.json +13 -9
- package/node_modules/tweetnacl/CHANGELOG.md +53 -0
- package/node_modules/tweetnacl/COPYING.txt +9 -0
- package/node_modules/tweetnacl/README.md +14 -40
- package/node_modules/tweetnacl/nacl-fast.js +21 -51
- package/node_modules/tweetnacl/nacl-fast.min.js +2 -2
- package/node_modules/tweetnacl/nacl.js +21 -51
- package/node_modules/tweetnacl/nacl.min.js +1 -1
- package/node_modules/tweetnacl/package.json +28 -38
- package/node_modules/verror/package.json +2 -3
- package/package.json +2 -2
- package/node_modules/aws4/example.js +0 -372
- package/node_modules/aws4/node_modules/lru-cache/test/memory-leak.js +0 -51
- package/node_modules/isarray/build/build.js +0 -209
- package/node_modules/lodash._basetostring/LICENSE +0 -22
- package/node_modules/lodash._basetostring/README.md +0 -20
- package/node_modules/lodash._basetostring/index.js +0 -22
- package/node_modules/lodash._basetostring/package.json +0 -99
- package/node_modules/lodash._createpadding/LICENSE +0 -22
- package/node_modules/lodash._createpadding/README.md +0 -20
- package/node_modules/lodash._createpadding/index.js +0 -37
- package/node_modules/lodash._createpadding/package.json +0 -101
- package/node_modules/lodash._root/LICENSE +0 -22
- package/node_modules/lodash._root/README.md +0 -18
- package/node_modules/lodash._root/index.js +0 -53
- package/node_modules/lodash._root/package.json +0 -77
- package/node_modules/lodash.padleft/LICENSE.txt +0 -22
- package/node_modules/lodash.padleft/README.md +0 -20
- package/node_modules/lodash.padleft/index.js +0 -50
- package/node_modules/lodash.padleft/package.json +0 -107
- package/node_modules/lodash.padright/LICENSE.txt +0 -22
- package/node_modules/lodash.padright/README.md +0 -20
- package/node_modules/lodash.padright/index.js +0 -50
- package/node_modules/lodash.padright/package.json +0 -107
@@ -53,9 +53,8 @@ util.inherits = require('inherits');
|
|
53
53
|
|
54
54
|
util.inherits(Transform, Duplex);
|
55
55
|
|
56
|
-
|
57
56
|
function TransformState(stream) {
|
58
|
-
this.afterTransform = function(er, data) {
|
57
|
+
this.afterTransform = function (er, data) {
|
59
58
|
return afterTransform(stream, er, data);
|
60
59
|
};
|
61
60
|
|
@@ -63,6 +62,7 @@ function TransformState(stream) {
|
|
63
62
|
this.transforming = false;
|
64
63
|
this.writecb = null;
|
65
64
|
this.writechunk = null;
|
65
|
+
this.writeencoding = null;
|
66
66
|
}
|
67
67
|
|
68
68
|
function afterTransform(stream, er, data) {
|
@@ -71,17 +71,14 @@ function afterTransform(stream, er, data) {
|
|
71
71
|
|
72
72
|
var cb = ts.writecb;
|
73
73
|
|
74
|
-
if (!cb)
|
75
|
-
return stream.emit('error', new Error('no writecb in Transform class'));
|
74
|
+
if (!cb) return stream.emit('error', new Error('no writecb in Transform class'));
|
76
75
|
|
77
76
|
ts.writechunk = null;
|
78
77
|
ts.writecb = null;
|
79
78
|
|
80
|
-
if (data !== null && data !== undefined)
|
81
|
-
stream.push(data);
|
79
|
+
if (data !== null && data !== undefined) stream.push(data);
|
82
80
|
|
83
|
-
|
84
|
-
cb(er);
|
81
|
+
cb(er);
|
85
82
|
|
86
83
|
var rs = stream._readableState;
|
87
84
|
rs.reading = false;
|
@@ -90,10 +87,8 @@ function afterTransform(stream, er, data) {
|
|
90
87
|
}
|
91
88
|
}
|
92
89
|
|
93
|
-
|
94
90
|
function Transform(options) {
|
95
|
-
if (!(this instanceof Transform))
|
96
|
-
return new Transform(options);
|
91
|
+
if (!(this instanceof Transform)) return new Transform(options);
|
97
92
|
|
98
93
|
Duplex.call(this, options);
|
99
94
|
|
@@ -111,24 +106,19 @@ function Transform(options) {
|
|
111
106
|
this._readableState.sync = false;
|
112
107
|
|
113
108
|
if (options) {
|
114
|
-
if (typeof options.transform === 'function')
|
115
|
-
this._transform = options.transform;
|
109
|
+
if (typeof options.transform === 'function') this._transform = options.transform;
|
116
110
|
|
117
|
-
if (typeof options.flush === 'function')
|
118
|
-
this._flush = options.flush;
|
111
|
+
if (typeof options.flush === 'function') this._flush = options.flush;
|
119
112
|
}
|
120
113
|
|
121
|
-
this.once('prefinish', function() {
|
122
|
-
if (typeof this._flush === 'function')
|
123
|
-
|
124
|
-
|
125
|
-
});
|
126
|
-
else
|
127
|
-
done(stream);
|
114
|
+
this.once('prefinish', function () {
|
115
|
+
if (typeof this._flush === 'function') this._flush(function (er) {
|
116
|
+
done(stream, er);
|
117
|
+
});else done(stream);
|
128
118
|
});
|
129
119
|
}
|
130
120
|
|
131
|
-
Transform.prototype.push = function(chunk, encoding) {
|
121
|
+
Transform.prototype.push = function (chunk, encoding) {
|
132
122
|
this._transformState.needTransform = false;
|
133
123
|
return Duplex.prototype.push.call(this, chunk, encoding);
|
134
124
|
};
|
@@ -143,28 +133,25 @@ Transform.prototype.push = function(chunk, encoding) {
|
|
143
133
|
// Call `cb(err)` when you are done with this chunk. If you pass
|
144
134
|
// an error, then that'll put the hurt on the whole operation. If you
|
145
135
|
// never call cb(), then you'll never get another chunk.
|
146
|
-
Transform.prototype._transform = function(chunk, encoding, cb) {
|
136
|
+
Transform.prototype._transform = function (chunk, encoding, cb) {
|
147
137
|
throw new Error('not implemented');
|
148
138
|
};
|
149
139
|
|
150
|
-
Transform.prototype._write = function(chunk, encoding, cb) {
|
140
|
+
Transform.prototype._write = function (chunk, encoding, cb) {
|
151
141
|
var ts = this._transformState;
|
152
142
|
ts.writecb = cb;
|
153
143
|
ts.writechunk = chunk;
|
154
144
|
ts.writeencoding = encoding;
|
155
145
|
if (!ts.transforming) {
|
156
146
|
var rs = this._readableState;
|
157
|
-
if (ts.needTransform ||
|
158
|
-
rs.needReadable ||
|
159
|
-
rs.length < rs.highWaterMark)
|
160
|
-
this._read(rs.highWaterMark);
|
147
|
+
if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
|
161
148
|
}
|
162
149
|
};
|
163
150
|
|
164
151
|
// Doesn't matter what the args are here.
|
165
152
|
// _transform does all the work.
|
166
153
|
// That we got here means that the readable side wants more data.
|
167
|
-
Transform.prototype._read = function(n) {
|
154
|
+
Transform.prototype._read = function (n) {
|
168
155
|
var ts = this._transformState;
|
169
156
|
|
170
157
|
if (ts.writechunk !== null && ts.writecb && !ts.transforming) {
|
@@ -177,21 +164,17 @@ Transform.prototype._read = function(n) {
|
|
177
164
|
}
|
178
165
|
};
|
179
166
|
|
180
|
-
|
181
167
|
function done(stream, er) {
|
182
|
-
if (er)
|
183
|
-
return stream.emit('error', er);
|
168
|
+
if (er) return stream.emit('error', er);
|
184
169
|
|
185
170
|
// if there's nothing in the write buffer, then that means
|
186
171
|
// that nothing more will ever be provided
|
187
172
|
var ws = stream._writableState;
|
188
173
|
var ts = stream._transformState;
|
189
174
|
|
190
|
-
if (ws.length)
|
191
|
-
throw new Error('calling transform done when ws.length != 0');
|
175
|
+
if (ws.length) throw new Error('calling transform done when ws.length != 0');
|
192
176
|
|
193
|
-
if (ts.transforming)
|
194
|
-
throw new Error('calling transform done when still transforming');
|
177
|
+
if (ts.transforming) throw new Error('calling transform done when still transforming');
|
195
178
|
|
196
179
|
return stream.push(null);
|
197
|
-
}
|
180
|
+
}
|
@@ -10,6 +10,9 @@ module.exports = Writable;
|
|
10
10
|
var processNextTick = require('process-nextick-args');
|
11
11
|
/*</replacement>*/
|
12
12
|
|
13
|
+
/*<replacement>*/
|
14
|
+
var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : processNextTick;
|
15
|
+
/*</replacement>*/
|
13
16
|
|
14
17
|
/*<replacement>*/
|
15
18
|
var Buffer = require('buffer').Buffer;
|
@@ -17,29 +20,26 @@ var Buffer = require('buffer').Buffer;
|
|
17
20
|
|
18
21
|
Writable.WritableState = WritableState;
|
19
22
|
|
20
|
-
|
21
23
|
/*<replacement>*/
|
22
24
|
var util = require('core-util-is');
|
23
25
|
util.inherits = require('inherits');
|
24
26
|
/*</replacement>*/
|
25
27
|
|
26
|
-
|
27
28
|
/*<replacement>*/
|
28
29
|
var internalUtil = {
|
29
30
|
deprecate: require('util-deprecate')
|
30
31
|
};
|
31
32
|
/*</replacement>*/
|
32
33
|
|
33
|
-
|
34
|
-
|
35
34
|
/*<replacement>*/
|
36
35
|
var Stream;
|
37
|
-
(function (){
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
Stream = require('events').EventEmitter;
|
42
|
-
}
|
36
|
+
(function () {
|
37
|
+
try {
|
38
|
+
Stream = require('st' + 'ream');
|
39
|
+
} catch (_) {} finally {
|
40
|
+
if (!Stream) Stream = require('events').EventEmitter;
|
41
|
+
}
|
42
|
+
})();
|
43
43
|
/*</replacement>*/
|
44
44
|
|
45
45
|
var Buffer = require('buffer').Buffer;
|
@@ -65,18 +65,17 @@ function WritableState(options, stream) {
|
|
65
65
|
// contains buffers or objects.
|
66
66
|
this.objectMode = !!options.objectMode;
|
67
67
|
|
68
|
-
if (stream instanceof Duplex)
|
69
|
-
this.objectMode = this.objectMode || !!options.writableObjectMode;
|
68
|
+
if (stream instanceof Duplex) this.objectMode = this.objectMode || !!options.writableObjectMode;
|
70
69
|
|
71
70
|
// the point at which write() starts returning false
|
72
71
|
// Note: 0 is a valid value, means that we always return false if
|
73
72
|
// the entire buffer is not flushed immediately on write()
|
74
73
|
var hwm = options.highWaterMark;
|
75
74
|
var defaultHwm = this.objectMode ? 16 : 16 * 1024;
|
76
|
-
this.highWaterMark =
|
75
|
+
this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm;
|
77
76
|
|
78
77
|
// cast to ints.
|
79
|
-
this.highWaterMark =
|
78
|
+
this.highWaterMark = ~ ~this.highWaterMark;
|
80
79
|
|
81
80
|
this.needDrain = false;
|
82
81
|
// at the start of calling end()
|
@@ -120,7 +119,7 @@ function WritableState(options, stream) {
|
|
120
119
|
this.bufferProcessing = false;
|
121
120
|
|
122
121
|
// the callback that's passed to _write(chunk,cb)
|
123
|
-
this.onwrite = function(er) {
|
122
|
+
this.onwrite = function (er) {
|
124
123
|
onwrite(stream, er);
|
125
124
|
};
|
126
125
|
|
@@ -143,6 +142,14 @@ function WritableState(options, stream) {
|
|
143
142
|
|
144
143
|
// True if the error was already emitted and should not be thrown again
|
145
144
|
this.errorEmitted = false;
|
145
|
+
|
146
|
+
// count buffered requests
|
147
|
+
this.bufferedRequestCount = 0;
|
148
|
+
|
149
|
+
// create the two objects needed to store the corked requests
|
150
|
+
// they are not a linked list, as no new elements are inserted in there
|
151
|
+
this.corkedRequestsFree = new CorkedRequest(this);
|
152
|
+
this.corkedRequestsFree.next = new CorkedRequest(this);
|
146
153
|
}
|
147
154
|
|
148
155
|
WritableState.prototype.getBuffer = function writableStateGetBuffer() {
|
@@ -155,15 +162,15 @@ WritableState.prototype.getBuffer = function writableStateGetBuffer() {
|
|
155
162
|
return out;
|
156
163
|
};
|
157
164
|
|
158
|
-
(function ()
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
});
|
165
|
-
}catch(_){}
|
166
|
-
|
165
|
+
(function () {
|
166
|
+
try {
|
167
|
+
Object.defineProperty(WritableState.prototype, 'buffer', {
|
168
|
+
get: internalUtil.deprecate(function () {
|
169
|
+
return this.getBuffer();
|
170
|
+
}, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.')
|
171
|
+
});
|
172
|
+
} catch (_) {}
|
173
|
+
})();
|
167
174
|
|
168
175
|
var Duplex;
|
169
176
|
function Writable(options) {
|
@@ -171,8 +178,7 @@ function Writable(options) {
|
|
171
178
|
|
172
179
|
// Writable ctor is applied to Duplexes, though they're not
|
173
180
|
// instanceof Writable, they're instanceof Readable.
|
174
|
-
if (!(this instanceof Writable) && !(this instanceof Duplex))
|
175
|
-
return new Writable(options);
|
181
|
+
if (!(this instanceof Writable) && !(this instanceof Duplex)) return new Writable(options);
|
176
182
|
|
177
183
|
this._writableState = new WritableState(options, this);
|
178
184
|
|
@@ -180,22 +186,19 @@ function Writable(options) {
|
|
180
186
|
this.writable = true;
|
181
187
|
|
182
188
|
if (options) {
|
183
|
-
if (typeof options.write === 'function')
|
184
|
-
this._write = options.write;
|
189
|
+
if (typeof options.write === 'function') this._write = options.write;
|
185
190
|
|
186
|
-
if (typeof options.writev === 'function')
|
187
|
-
this._writev = options.writev;
|
191
|
+
if (typeof options.writev === 'function') this._writev = options.writev;
|
188
192
|
}
|
189
193
|
|
190
194
|
Stream.call(this);
|
191
195
|
}
|
192
196
|
|
193
197
|
// Otherwise people can pipe Writable streams, which is just wrong.
|
194
|
-
Writable.prototype.pipe = function() {
|
198
|
+
Writable.prototype.pipe = function () {
|
195
199
|
this.emit('error', new Error('Cannot pipe. Not readable.'));
|
196
200
|
};
|
197
201
|
|
198
|
-
|
199
202
|
function writeAfterEnd(stream, cb) {
|
200
203
|
var er = new Error('write after end');
|
201
204
|
// TODO: defer error events consistently everywhere, not just the cb
|
@@ -211,11 +214,7 @@ function writeAfterEnd(stream, cb) {
|
|
211
214
|
function validChunk(stream, state, chunk, cb) {
|
212
215
|
var valid = true;
|
213
216
|
|
214
|
-
if (!
|
215
|
-
typeof chunk !== 'string' &&
|
216
|
-
chunk !== null &&
|
217
|
-
chunk !== undefined &&
|
218
|
-
!state.objectMode) {
|
217
|
+
if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== null && chunk !== undefined && !state.objectMode) {
|
219
218
|
var er = new TypeError('Invalid non-string/buffer chunk');
|
220
219
|
stream.emit('error', er);
|
221
220
|
processNextTick(cb, er);
|
@@ -224,7 +223,7 @@ function validChunk(stream, state, chunk, cb) {
|
|
224
223
|
return valid;
|
225
224
|
}
|
226
225
|
|
227
|
-
Writable.prototype.write = function(chunk, encoding, cb) {
|
226
|
+
Writable.prototype.write = function (chunk, encoding, cb) {
|
228
227
|
var state = this._writableState;
|
229
228
|
var ret = false;
|
230
229
|
|
@@ -233,17 +232,11 @@ Writable.prototype.write = function(chunk, encoding, cb) {
|
|
233
232
|
encoding = null;
|
234
233
|
}
|
235
234
|
|
236
|
-
if (Buffer.isBuffer(chunk))
|
237
|
-
encoding = 'buffer';
|
238
|
-
else if (!encoding)
|
239
|
-
encoding = state.defaultEncoding;
|
235
|
+
if (Buffer.isBuffer(chunk)) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;
|
240
236
|
|
241
|
-
if (typeof cb !== 'function')
|
242
|
-
cb = nop;
|
237
|
+
if (typeof cb !== 'function') cb = nop;
|
243
238
|
|
244
|
-
if (state.ended)
|
245
|
-
writeAfterEnd(this, cb);
|
246
|
-
else if (validChunk(this, state, chunk, cb)) {
|
239
|
+
if (state.ended) writeAfterEnd(this, cb);else if (validChunk(this, state, chunk, cb)) {
|
247
240
|
state.pendingcb++;
|
248
241
|
ret = writeOrBuffer(this, state, chunk, encoding, cb);
|
249
242
|
}
|
@@ -251,42 +244,31 @@ Writable.prototype.write = function(chunk, encoding, cb) {
|
|
251
244
|
return ret;
|
252
245
|
};
|
253
246
|
|
254
|
-
Writable.prototype.cork = function() {
|
247
|
+
Writable.prototype.cork = function () {
|
255
248
|
var state = this._writableState;
|
256
249
|
|
257
250
|
state.corked++;
|
258
251
|
};
|
259
252
|
|
260
|
-
Writable.prototype.uncork = function() {
|
253
|
+
Writable.prototype.uncork = function () {
|
261
254
|
var state = this._writableState;
|
262
255
|
|
263
256
|
if (state.corked) {
|
264
257
|
state.corked--;
|
265
258
|
|
266
|
-
if (!state.writing &&
|
267
|
-
!state.corked &&
|
268
|
-
!state.finished &&
|
269
|
-
!state.bufferProcessing &&
|
270
|
-
state.bufferedRequest)
|
271
|
-
clearBuffer(this, state);
|
259
|
+
if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
|
272
260
|
}
|
273
261
|
};
|
274
262
|
|
275
263
|
Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
|
276
264
|
// node::ParseEncoding() requires lower case.
|
277
|
-
if (typeof encoding === 'string')
|
278
|
-
|
279
|
-
if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64',
|
280
|
-
'ucs2', 'ucs-2','utf16le', 'utf-16le', 'raw']
|
281
|
-
.indexOf((encoding + '').toLowerCase()) > -1))
|
282
|
-
throw new TypeError('Unknown encoding: ' + encoding);
|
265
|
+
if (typeof encoding === 'string') encoding = encoding.toLowerCase();
|
266
|
+
if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding);
|
283
267
|
this._writableState.defaultEncoding = encoding;
|
284
268
|
};
|
285
269
|
|
286
270
|
function decodeChunk(state, chunk, encoding) {
|
287
|
-
if (!state.objectMode &&
|
288
|
-
state.decodeStrings !== false &&
|
289
|
-
typeof chunk === 'string') {
|
271
|
+
if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {
|
290
272
|
chunk = new Buffer(chunk, encoding);
|
291
273
|
}
|
292
274
|
return chunk;
|
@@ -298,16 +280,14 @@ function decodeChunk(state, chunk, encoding) {
|
|
298
280
|
function writeOrBuffer(stream, state, chunk, encoding, cb) {
|
299
281
|
chunk = decodeChunk(state, chunk, encoding);
|
300
282
|
|
301
|
-
if (Buffer.isBuffer(chunk))
|
302
|
-
encoding = 'buffer';
|
283
|
+
if (Buffer.isBuffer(chunk)) encoding = 'buffer';
|
303
284
|
var len = state.objectMode ? 1 : chunk.length;
|
304
285
|
|
305
286
|
state.length += len;
|
306
287
|
|
307
288
|
var ret = state.length < state.highWaterMark;
|
308
289
|
// we must ensure that previous needDrain will not be reset to false.
|
309
|
-
if (!ret)
|
310
|
-
state.needDrain = true;
|
290
|
+
if (!ret) state.needDrain = true;
|
311
291
|
|
312
292
|
if (state.writing || state.corked) {
|
313
293
|
var last = state.lastBufferedRequest;
|
@@ -317,6 +297,7 @@ function writeOrBuffer(stream, state, chunk, encoding, cb) {
|
|
317
297
|
} else {
|
318
298
|
state.bufferedRequest = state.lastBufferedRequest;
|
319
299
|
}
|
300
|
+
state.bufferedRequestCount += 1;
|
320
301
|
} else {
|
321
302
|
doWrite(stream, state, false, len, chunk, encoding, cb);
|
322
303
|
}
|
@@ -329,19 +310,13 @@ function doWrite(stream, state, writev, len, chunk, encoding, cb) {
|
|
329
310
|
state.writecb = cb;
|
330
311
|
state.writing = true;
|
331
312
|
state.sync = true;
|
332
|
-
if (writev)
|
333
|
-
stream._writev(chunk, state.onwrite);
|
334
|
-
else
|
335
|
-
stream._write(chunk, encoding, state.onwrite);
|
313
|
+
if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);
|
336
314
|
state.sync = false;
|
337
315
|
}
|
338
316
|
|
339
317
|
function onwriteError(stream, state, sync, er, cb) {
|
340
318
|
--state.pendingcb;
|
341
|
-
if (sync)
|
342
|
-
processNextTick(cb, er);
|
343
|
-
else
|
344
|
-
cb(er);
|
319
|
+
if (sync) processNextTick(cb, er);else cb(er);
|
345
320
|
|
346
321
|
stream._writableState.errorEmitted = true;
|
347
322
|
stream.emit('error', er);
|
@@ -361,30 +336,26 @@ function onwrite(stream, er) {
|
|
361
336
|
|
362
337
|
onwriteStateUpdate(state);
|
363
338
|
|
364
|
-
if (er)
|
365
|
-
onwriteError(stream, state, sync, er, cb);
|
366
|
-
else {
|
339
|
+
if (er) onwriteError(stream, state, sync, er, cb);else {
|
367
340
|
// Check if we're actually ready to finish, but don't emit yet
|
368
341
|
var finished = needFinish(state);
|
369
342
|
|
370
|
-
if (!finished &&
|
371
|
-
!state.corked &&
|
372
|
-
!state.bufferProcessing &&
|
373
|
-
state.bufferedRequest) {
|
343
|
+
if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
|
374
344
|
clearBuffer(stream, state);
|
375
345
|
}
|
376
346
|
|
377
347
|
if (sync) {
|
378
|
-
|
348
|
+
/*<replacement>*/
|
349
|
+
asyncWrite(afterWrite, stream, state, finished, cb);
|
350
|
+
/*</replacement>*/
|
379
351
|
} else {
|
380
|
-
|
381
|
-
|
352
|
+
afterWrite(stream, state, finished, cb);
|
353
|
+
}
|
382
354
|
}
|
383
355
|
}
|
384
356
|
|
385
357
|
function afterWrite(stream, state, finished, cb) {
|
386
|
-
if (!finished)
|
387
|
-
onwriteDrain(stream, state);
|
358
|
+
if (!finished) onwriteDrain(stream, state);
|
388
359
|
state.pendingcb--;
|
389
360
|
cb();
|
390
361
|
finishMaybe(stream, state);
|
@@ -400,7 +371,6 @@ function onwriteDrain(stream, state) {
|
|
400
371
|
}
|
401
372
|
}
|
402
373
|
|
403
|
-
|
404
374
|
// if there's something in the buffer waiting, then process it
|
405
375
|
function clearBuffer(stream, state) {
|
406
376
|
state.bufferProcessing = true;
|
@@ -408,26 +378,26 @@ function clearBuffer(stream, state) {
|
|
408
378
|
|
409
379
|
if (stream._writev && entry && entry.next) {
|
410
380
|
// Fast case, write everything using _writev()
|
411
|
-
var
|
412
|
-
var
|
381
|
+
var l = state.bufferedRequestCount;
|
382
|
+
var buffer = new Array(l);
|
383
|
+
var holder = state.corkedRequestsFree;
|
384
|
+
holder.entry = entry;
|
385
|
+
|
386
|
+
var count = 0;
|
413
387
|
while (entry) {
|
414
|
-
|
415
|
-
buffer.push(entry);
|
388
|
+
buffer[count] = entry;
|
416
389
|
entry = entry.next;
|
390
|
+
count += 1;
|
417
391
|
}
|
418
392
|
|
419
|
-
|
420
|
-
|
393
|
+
doWrite(stream, state, true, state.length, buffer, '', holder.finish);
|
394
|
+
|
395
|
+
// doWrite is always async, defer these to save a bit of time
|
396
|
+
// as the hot path ends with doWrite
|
421
397
|
state.pendingcb++;
|
422
398
|
state.lastBufferedRequest = null;
|
423
|
-
|
424
|
-
|
425
|
-
state.pendingcb--;
|
426
|
-
cbs[i](err);
|
427
|
-
}
|
428
|
-
});
|
429
|
-
|
430
|
-
// Clear buffer
|
399
|
+
state.corkedRequestsFree = holder.next;
|
400
|
+
holder.next = null;
|
431
401
|
} else {
|
432
402
|
// Slow case, write chunks one-by-one
|
433
403
|
while (entry) {
|
@@ -447,20 +417,21 @@ function clearBuffer(stream, state) {
|
|
447
417
|
}
|
448
418
|
}
|
449
419
|
|
450
|
-
if (entry === null)
|
451
|
-
state.lastBufferedRequest = null;
|
420
|
+
if (entry === null) state.lastBufferedRequest = null;
|
452
421
|
}
|
422
|
+
|
423
|
+
state.bufferedRequestCount = 0;
|
453
424
|
state.bufferedRequest = entry;
|
454
425
|
state.bufferProcessing = false;
|
455
426
|
}
|
456
427
|
|
457
|
-
Writable.prototype._write = function(chunk, encoding, cb) {
|
428
|
+
Writable.prototype._write = function (chunk, encoding, cb) {
|
458
429
|
cb(new Error('not implemented'));
|
459
430
|
};
|
460
431
|
|
461
432
|
Writable.prototype._writev = null;
|
462
433
|
|
463
|
-
Writable.prototype.end = function(chunk, encoding, cb) {
|
434
|
+
Writable.prototype.end = function (chunk, encoding, cb) {
|
464
435
|
var state = this._writableState;
|
465
436
|
|
466
437
|
if (typeof chunk === 'function') {
|
@@ -472,8 +443,7 @@ Writable.prototype.end = function(chunk, encoding, cb) {
|
|
472
443
|
encoding = null;
|
473
444
|
}
|
474
445
|
|
475
|
-
if (chunk !== null && chunk !== undefined)
|
476
|
-
this.write(chunk, encoding);
|
446
|
+
if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);
|
477
447
|
|
478
448
|
// .end() fully uncorks
|
479
449
|
if (state.corked) {
|
@@ -482,17 +452,11 @@ Writable.prototype.end = function(chunk, encoding, cb) {
|
|
482
452
|
}
|
483
453
|
|
484
454
|
// ignore unnecessary end() calls.
|
485
|
-
if (!state.ending && !state.finished)
|
486
|
-
endWritable(this, state, cb);
|
455
|
+
if (!state.ending && !state.finished) endWritable(this, state, cb);
|
487
456
|
};
|
488
457
|
|
489
|
-
|
490
458
|
function needFinish(state) {
|
491
|
-
return
|
492
|
-
state.length === 0 &&
|
493
|
-
state.bufferedRequest === null &&
|
494
|
-
!state.finished &&
|
495
|
-
!state.writing);
|
459
|
+
return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
|
496
460
|
}
|
497
461
|
|
498
462
|
function prefinish(stream, state) {
|
@@ -520,10 +484,33 @@ function endWritable(stream, state, cb) {
|
|
520
484
|
state.ending = true;
|
521
485
|
finishMaybe(stream, state);
|
522
486
|
if (cb) {
|
523
|
-
if (state.finished)
|
524
|
-
processNextTick(cb);
|
525
|
-
else
|
526
|
-
stream.once('finish', cb);
|
487
|
+
if (state.finished) processNextTick(cb);else stream.once('finish', cb);
|
527
488
|
}
|
528
489
|
state.ended = true;
|
490
|
+
stream.writable = false;
|
529
491
|
}
|
492
|
+
|
493
|
+
// It seems a linked list but it is not
|
494
|
+
// there will be only 2 of these for each stream
|
495
|
+
function CorkedRequest(state) {
|
496
|
+
var _this = this;
|
497
|
+
|
498
|
+
this.next = null;
|
499
|
+
this.entry = null;
|
500
|
+
|
501
|
+
this.finish = function (err) {
|
502
|
+
var entry = _this.entry;
|
503
|
+
_this.entry = null;
|
504
|
+
while (entry) {
|
505
|
+
var cb = entry.callback;
|
506
|
+
state.pendingcb--;
|
507
|
+
cb(err);
|
508
|
+
entry = entry.next;
|
509
|
+
}
|
510
|
+
if (state.corkedRequestsFree) {
|
511
|
+
state.corkedRequestsFree.next = _this;
|
512
|
+
} else {
|
513
|
+
state.corkedRequestsFree = _this;
|
514
|
+
}
|
515
|
+
};
|
516
|
+
}
|
@@ -1,21 +1,25 @@
|
|
1
1
|
{
|
2
|
-
"_from": "readable-stream
|
3
|
-
"_id": "readable-stream@2.0.
|
2
|
+
"_from": "readable-stream@~2.0.5",
|
3
|
+
"_id": "readable-stream@2.0.6",
|
4
4
|
"_location": "/readable-stream",
|
5
|
-
"_nodeVersion": "5.
|
5
|
+
"_nodeVersion": "5.7.0",
|
6
|
+
"_npmOperationalInternal": {
|
7
|
+
"host": "packages-12-west.internal.npmjs.com",
|
8
|
+
"tmp": "tmp/readable-stream-2.0.6.tgz_1457893507709_0.369257491780445"
|
9
|
+
},
|
6
10
|
"_npmUser": {
|
7
11
|
"email": "calvin.metcalf@gmail.com",
|
8
12
|
"name": "cwmma"
|
9
13
|
},
|
10
|
-
"_npmVersion": "3.
|
14
|
+
"_npmVersion": "3.6.0",
|
11
15
|
"_phantomChildren": {},
|
12
16
|
"_requiredBy": [
|
13
17
|
"/are-we-there-yet",
|
14
18
|
"/bl",
|
15
19
|
"/tar-pack"
|
16
20
|
],
|
17
|
-
"_resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.0.
|
18
|
-
"_shasum": "
|
21
|
+
"_resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.0.6.tgz",
|
22
|
+
"_shasum": "8f90341e68a53ccc928788dacfcd11b36eb9b78e",
|
19
23
|
"_shrinkwrap": null,
|
20
24
|
"browser": {
|
21
25
|
"util": false
|
@@ -26,23 +30,23 @@
|
|
26
30
|
"dependencies": {
|
27
31
|
"core-util-is": "~1.0.0",
|
28
32
|
"inherits": "~2.0.1",
|
29
|
-
"isarray": "0.0
|
33
|
+
"isarray": "~1.0.0",
|
30
34
|
"process-nextick-args": "~1.0.6",
|
31
35
|
"string_decoder": "~0.10.x",
|
32
36
|
"util-deprecate": "~1.0.1"
|
33
37
|
},
|
34
|
-
"description": "Streams3, a user-land copy of the stream library from
|
38
|
+
"description": "Streams3, a user-land copy of the stream library from Node.js",
|
35
39
|
"devDependencies": {
|
36
40
|
"tap": "~0.2.6",
|
37
|
-
"tape": "~4.
|
38
|
-
"zuul": "~3.
|
41
|
+
"tape": "~4.5.1",
|
42
|
+
"zuul": "~3.9.0"
|
39
43
|
},
|
40
44
|
"directories": {},
|
41
45
|
"dist": {
|
42
|
-
"shasum": "
|
43
|
-
"tarball": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.0.
|
46
|
+
"shasum": "8f90341e68a53ccc928788dacfcd11b36eb9b78e",
|
47
|
+
"tarball": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.0.6.tgz"
|
44
48
|
},
|
45
|
-
"gitHead": "
|
49
|
+
"gitHead": "01fb5608a970b42c900b96746cadc13d27dd9d7e",
|
46
50
|
"homepage": "https://github.com/nodejs/readable-stream#readme",
|
47
51
|
"keywords": [
|
48
52
|
"pipe",
|
@@ -78,8 +82,8 @@
|
|
78
82
|
},
|
79
83
|
"scripts": {
|
80
84
|
"browser": "npm run write-zuul && zuul -- test/browser.js",
|
81
|
-
"test": "tap test/parallel/*.js",
|
85
|
+
"test": "tap test/parallel/*.js test/ours/*.js",
|
82
86
|
"write-zuul": "printf \"ui: tape\nbrowsers:\n - name: $BROWSER_NAME\n version: $BROWSER_VERSION\n\">.zuul.yml"
|
83
87
|
},
|
84
|
-
"version": "2.0.
|
88
|
+
"version": "2.0.6"
|
85
89
|
}
|