summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/readable-stream
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/node_modules/readable-stream')
-rw-r--r--deps/npm/node_modules/readable-stream/.travis.yml34
-rw-r--r--deps/npm/node_modules/readable-stream/CONTRIBUTING.md38
-rw-r--r--deps/npm/node_modules/readable-stream/README.md74
-rw-r--r--deps/npm/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md58
-rw-r--r--deps/npm/node_modules/readable-stream/duplex-browser.js1
-rw-r--r--deps/npm/node_modules/readable-stream/duplex.js1
-rw-r--r--deps/npm/node_modules/readable-stream/errors-browser.js127
-rw-r--r--deps/npm/node_modules/readable-stream/errors.js116
-rw-r--r--deps/npm/node_modules/readable-stream/experimentalWarning.js17
-rw-r--r--deps/npm/node_modules/readable-stream/lib/_stream_duplex.js96
-rw-r--r--deps/npm/node_modules/readable-stream/lib/_stream_passthrough.js10
-rw-r--r--deps/npm/node_modules/readable-stream/lib/_stream_readable.js787
-rw-r--r--deps/npm/node_modules/readable-stream/lib/_stream_transform.js71
-rw-r--r--deps/npm/node_modules/readable-stream/lib/_stream_writable.js390
-rw-r--r--deps/npm/node_modules/readable-stream/lib/internal/streams/BufferList.js79
-rw-r--r--deps/npm/node_modules/readable-stream/lib/internal/streams/async_iterator.js207
-rw-r--r--deps/npm/node_modules/readable-stream/lib/internal/streams/buffer_list.js210
-rw-r--r--deps/npm/node_modules/readable-stream/lib/internal/streams/destroy.js65
-rw-r--r--deps/npm/node_modules/readable-stream/lib/internal/streams/end-of-stream.js104
-rw-r--r--deps/npm/node_modules/readable-stream/lib/internal/streams/from-browser.js3
-rw-r--r--deps/npm/node_modules/readable-stream/lib/internal/streams/from.js64
-rw-r--r--deps/npm/node_modules/readable-stream/lib/internal/streams/pipeline.js97
-rw-r--r--deps/npm/node_modules/readable-stream/lib/internal/streams/state.js27
-rw-r--r--deps/npm/node_modules/readable-stream/package.json116
-rw-r--r--deps/npm/node_modules/readable-stream/passthrough.js1
-rw-r--r--deps/npm/node_modules/readable-stream/readable-browser.js2
-rw-r--r--deps/npm/node_modules/readable-stream/readable.js13
-rw-r--r--deps/npm/node_modules/readable-stream/transform.js1
-rw-r--r--deps/npm/node_modules/readable-stream/writable-browser.js1
-rw-r--r--deps/npm/node_modules/readable-stream/writable.js8
30 files changed, 920 insertions, 1898 deletions
diff --git a/deps/npm/node_modules/readable-stream/.travis.yml b/deps/npm/node_modules/readable-stream/.travis.yml
new file mode 100644
index 0000000000..f62cdac068
--- /dev/null
+++ b/deps/npm/node_modules/readable-stream/.travis.yml
@@ -0,0 +1,34 @@
+sudo: false
+language: node_js
+before_install:
+ - (test $NPM_LEGACY && npm install -g npm@2 && npm install -g npm@3) || true
+notifications:
+ email: false
+matrix:
+ fast_finish: true
+ include:
+ - node_js: '0.8'
+ env: NPM_LEGACY=true
+ - node_js: '0.10'
+ env: NPM_LEGACY=true
+ - node_js: '0.11'
+ env: NPM_LEGACY=true
+ - node_js: '0.12'
+ env: NPM_LEGACY=true
+ - node_js: 1
+ env: NPM_LEGACY=true
+ - node_js: 2
+ env: NPM_LEGACY=true
+ - node_js: 3
+ env: NPM_LEGACY=true
+ - node_js: 4
+ - node_js: 5
+ - node_js: 6
+ - node_js: 7
+ - node_js: 8
+ - node_js: 9
+script: "npm run test"
+env:
+ global:
+ - secure: rE2Vvo7vnjabYNULNyLFxOyt98BoJexDqsiOnfiD6kLYYsiQGfr/sbZkPMOFm9qfQG7pjqx+zZWZjGSswhTt+626C0t/njXqug7Yps4c3dFblzGfreQHp7wNX5TFsvrxd6dAowVasMp61sJcRnB2w8cUzoe3RAYUDHyiHktwqMc=
+ - secure: g9YINaKAdMatsJ28G9jCGbSaguXCyxSTy+pBO6Ch0Cf57ZLOTka3HqDj8p3nV28LUIHZ3ut5WO43CeYKwt4AUtLpBS3a0dndHdY6D83uY6b2qh5hXlrcbeQTq2cvw2y95F7hm4D1kwrgZ7ViqaKggRcEupAL69YbJnxeUDKWEdI=
diff --git a/deps/npm/node_modules/readable-stream/CONTRIBUTING.md b/deps/npm/node_modules/readable-stream/CONTRIBUTING.md
new file mode 100644
index 0000000000..f478d58dca
--- /dev/null
+++ b/deps/npm/node_modules/readable-stream/CONTRIBUTING.md
@@ -0,0 +1,38 @@
+# Developer's Certificate of Origin 1.1
+
+By making a contribution to this project, I certify that:
+
+* (a) The contribution was created in whole or in part by me and I
+ have the right to submit it under the open source license
+ indicated in the file; or
+
+* (b) The contribution is based upon previous work that, to the best
+ of my knowledge, is covered under an appropriate open source
+ license and I have the right under that license to submit that
+ work with modifications, whether created in whole or in part
+ by me, under the same open source license (unless I am
+ permitted to submit under a different license), as indicated
+ in the file; or
+
+* (c) The contribution was provided directly to me by some other
+ person who certified (a), (b) or (c) and I have not modified
+ it.
+
+* (d) I understand and agree that this project and the contribution
+ are public and that a record of the contribution (including all
+ personal information I submit with it, including my sign-off) is
+ maintained indefinitely and may be redistributed consistent with
+ this project or the open source license(s) involved.
+
+## Moderation Policy
+
+The [Node.js Moderation Policy] applies to this WG.
+
+## Code of Conduct
+
+The [Node.js Code of Conduct][] applies to this WG.
+
+[Node.js Code of Conduct]:
+https://github.com/nodejs/node/blob/master/CODE_OF_CONDUCT.md
+[Node.js Moderation Policy]:
+https://github.com/nodejs/TSC/blob/master/Moderation-Policy.md
diff --git a/deps/npm/node_modules/readable-stream/README.md b/deps/npm/node_modules/readable-stream/README.md
index 6f035ab16f..23fe3f3e30 100644
--- a/deps/npm/node_modules/readable-stream/README.md
+++ b/deps/npm/node_modules/readable-stream/README.md
@@ -1,81 +1,30 @@
# readable-stream
-***Node.js core streams for userland*** [![Build Status](https://travis-ci.com/nodejs/readable-stream.svg?branch=master)](https://travis-ci.com/nodejs/readable-stream)
+***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)
[![NPM](https://nodei.co/npm/readable-stream.png?downloads=true&downloadRank=true)](https://nodei.co/npm/readable-stream/)
[![NPM](https://nodei.co/npm-dl/readable-stream.png?&months=6&height=3)](https://nodei.co/npm/readable-stream/)
-[![Sauce Test Status](https://saucelabs.com/browser-matrix/readabe-stream.svg)](https://saucelabs.com/u/readabe-stream)
+[![Sauce Test Status](https://saucelabs.com/browser-matrix/readable-stream.svg)](https://saucelabs.com/u/readable-stream)
```bash
npm install --save readable-stream
```
-This package is a mirror of the streams implementations in Node.js.
+***Node-core streams for userland***
-Full documentation may be found on the [Node.js website](https://nodejs.org/dist/v10.19.0/docs/api/stream.html).
+This package is a mirror of the Streams2 and Streams3 implementations in
+Node-core.
+
+Full documentation may be found on the [Node.js website](https://nodejs.org/dist/v8.11.1/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).
As of version 2.0.0 **readable-stream** uses semantic versioning.
-## Version 3.x.x
-
-v3.x.x of `readable-stream` is a cut from Node 10. This version supports Node 6, 8, and 10, as well as evergreen browsers, IE 11 and latest Safari. The breaking changes introduced by v3 are composed by the combined breaking changes in [Node v9](https://nodejs.org/en/blog/release/v9.0.0/) and [Node v10](https://nodejs.org/en/blog/release/v10.0.0/), as follows:
-
-1. Error codes: https://github.com/nodejs/node/pull/13310,
- https://github.com/nodejs/node/pull/13291,
- https://github.com/nodejs/node/pull/16589,
- https://github.com/nodejs/node/pull/15042,
- https://github.com/nodejs/node/pull/15665,
- https://github.com/nodejs/readable-stream/pull/344
-2. 'readable' have precedence over flowing
- https://github.com/nodejs/node/pull/18994
-3. make virtual methods errors consistent
- https://github.com/nodejs/node/pull/18813
-4. updated streams error handling
- https://github.com/nodejs/node/pull/18438
-5. writable.end should return this.
- https://github.com/nodejs/node/pull/18780
-6. readable continues to read when push('')
- https://github.com/nodejs/node/pull/18211
-7. add custom inspect to BufferList
- https://github.com/nodejs/node/pull/17907
-8. always defer 'readable' with nextTick
- https://github.com/nodejs/node/pull/17979
-
-## Version 2.x.x
-v2.x.x of `readable-stream` is a cut of the stream module from Node 8 (there have been no semver-major changes from Node 4 to 8). This version supports all Node.js versions from 0.8, as well as evergreen browsers and IE 10 & 11.
-
-### Big Thanks
-
-Cross-browser Testing Platform and Open Source <3 Provided by [Sauce Labs][sauce]
-
-# Usage
-
-You can swap your `require('stream')` with `require('readable-stream')`
-without any changes, if you are just using one of the main classes and
-functions.
-
-```js
-const {
- Readable,
- Writable,
- Transform,
- Duplex,
- pipeline,
- finished
-} = require('readable-stream')
-````
-
-Note that `require('stream')` will return `Stream`, while
-`require('readable-stream')` will return `Readable`. We discourage using
-whatever is exported directly, but rather use one of the properties as
-shown in the example above.
-
# Streams Working Group
`readable-stream` is maintained by the Streams Working Group, which
@@ -95,12 +44,15 @@ Node.js. The responsibilities of the Streams Working Group include:
<a name="members"></a>
## Team Members
+* **Chris Dickinson** ([@chrisdickinson](https://github.com/chrisdickinson)) &lt;christopher.s.dickinson@gmail.com&gt;
+ - Release GPG key: 9554F04D7259F04124DE6B476D5A82AC7E37093B
* **Calvin Metcalf** ([@calvinmetcalf](https://github.com/calvinmetcalf)) &lt;calvin.metcalf@gmail.com&gt;
- Release GPG key: F3EF5F62A87FC27A22E643F714CE4FF5015AA242
+* **Rod Vagg** ([@rvagg](https://github.com/rvagg)) &lt;rod@vagg.org&gt;
+ - Release GPG key: DD8F2338BAE7501E3DD5AC78C273792F7D83545D
+* **Sam Newman** ([@sonewman](https://github.com/sonewman)) &lt;newmansam@outlook.com&gt;
* **Mathias Buus** ([@mafintosh](https://github.com/mafintosh)) &lt;mathiasbuus@gmail.com&gt;
+* **Domenic Denicola** ([@domenic](https://github.com/domenic)) &lt;d@domenic.me&gt;
* **Matteo Collina** ([@mcollina](https://github.com/mcollina)) &lt;matteo.collina@gmail.com&gt;
- Release GPG key: 3ABC01543F22DD2239285CDD818674489FBC127E
* **Irina Shestak** ([@lrlna](https://github.com/lrlna)) &lt;shestak.irina@gmail.com&gt;
-* **Yoshua Wyuts** ([@yoshuawuyts](https://github.com/yoshuawuyts)) &lt;yoshuawuyts@gmail.com&gt;
-
-[sauce]: https://saucelabs.com
diff --git a/deps/npm/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md b/deps/npm/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md
new file mode 100644
index 0000000000..c141a99c26
--- /dev/null
+++ b/deps/npm/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md
@@ -0,0 +1,58 @@
+# streams WG Meeting 2015-01-30
+
+## Links
+
+* **Google Hangouts Video**: http://www.youtube.com/watch?v=I9nDOSGfwZg
+* **GitHub Issue**: https://github.com/iojs/readable-stream/issues/106
+* **Original Minutes Google Doc**: https://docs.google.com/document/d/17aTgLnjMXIrfjgNaTUnHQO7m3xgzHR2VXBTmi03Qii4/
+
+## Agenda
+
+Extracted from https://github.com/iojs/readable-stream/labels/wg-agenda prior to meeting.
+
+* adopt a charter [#105](https://github.com/iojs/readable-stream/issues/105)
+* release and versioning strategy [#101](https://github.com/iojs/readable-stream/issues/101)
+* simpler stream creation [#102](https://github.com/iojs/readable-stream/issues/102)
+* proposal: deprecate implicit flowing of streams [#99](https://github.com/iojs/readable-stream/issues/99)
+
+## Minutes
+
+### adopt a charter
+
+* group: +1's all around
+
+### What versioning scheme should be adopted?
+* group: +1’s 3.0.0
+* domenic+group: pulling in patches from other sources where appropriate
+* mikeal: version independently, suggesting versions for io.js
+* mikeal+domenic: work with TC to notify in advance of changes
+simpler stream creation
+
+### streamline creation of streams
+* sam: streamline creation of streams
+* domenic: nice simple solution posted
+ but, we lose the opportunity to change the model
+ may not be backwards incompatible (double check keys)
+
+ **action item:** domenic will check
+
+### remove implicit flowing of streams on(‘data’)
+* add isFlowing / isPaused
+* mikeal: worrying that we’re documenting polyfill methods – confuses users
+* domenic: more reflective API is probably good, with warning labels for users
+* new section for mad scientists (reflective stream access)
+* calvin: name the “third state”
+* mikeal: maybe borrow the name from whatwg?
+* domenic: we’re missing the “third state”
+* consensus: kind of difficult to name the third state
+* mikeal: figure out differences in states / compat
+* mathias: always flow on data – eliminates third state
+ * explore what it breaks
+
+**action items:**
+* ask isaac for ability to list packages by what public io.js APIs they use (esp. Stream)
+* ask rod/build for infrastructure
+* **chris**: explore the “flow on data” approach
+* add isPaused/isFlowing
+* add new docs section
+* move isPaused to that section
diff --git a/deps/npm/node_modules/readable-stream/duplex-browser.js b/deps/npm/node_modules/readable-stream/duplex-browser.js
new file mode 100644
index 0000000000..f8b2db83db
--- /dev/null
+++ b/deps/npm/node_modules/readable-stream/duplex-browser.js
@@ -0,0 +1 @@
+module.exports = require('./lib/_stream_duplex.js');
diff --git a/deps/npm/node_modules/readable-stream/duplex.js b/deps/npm/node_modules/readable-stream/duplex.js
new file mode 100644
index 0000000000..46924cbfdf
--- /dev/null
+++ b/deps/npm/node_modules/readable-stream/duplex.js
@@ -0,0 +1 @@
+module.exports = require('./readable').Duplex
diff --git a/deps/npm/node_modules/readable-stream/errors-browser.js b/deps/npm/node_modules/readable-stream/errors-browser.js
deleted file mode 100644
index fb8e73e189..0000000000
--- a/deps/npm/node_modules/readable-stream/errors-browser.js
+++ /dev/null
@@ -1,127 +0,0 @@
-'use strict';
-
-function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
-
-var codes = {};
-
-function createErrorType(code, message, Base) {
- if (!Base) {
- Base = Error;
- }
-
- function getMessage(arg1, arg2, arg3) {
- if (typeof message === 'string') {
- return message;
- } else {
- return message(arg1, arg2, arg3);
- }
- }
-
- var NodeError =
- /*#__PURE__*/
- function (_Base) {
- _inheritsLoose(NodeError, _Base);
-
- function NodeError(arg1, arg2, arg3) {
- return _Base.call(this, getMessage(arg1, arg2, arg3)) || this;
- }
-
- return NodeError;
- }(Base);
-
- NodeError.prototype.name = Base.name;
- NodeError.prototype.code = code;
- codes[code] = NodeError;
-} // https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js
-
-
-function oneOf(expected, thing) {
- if (Array.isArray(expected)) {
- var len = expected.length;
- expected = expected.map(function (i) {
- return String(i);
- });
-
- if (len > 2) {
- return "one of ".concat(thing, " ").concat(expected.slice(0, len - 1).join(', '), ", or ") + expected[len - 1];
- } else if (len === 2) {
- return "one of ".concat(thing, " ").concat(expected[0], " or ").concat(expected[1]);
- } else {
- return "of ".concat(thing, " ").concat(expected[0]);
- }
- } else {
- return "of ".concat(thing, " ").concat(String(expected));
- }
-} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith
-
-
-function startsWith(str, search, pos) {
- return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search;
-} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith
-
-
-function endsWith(str, search, this_len) {
- if (this_len === undefined || this_len > str.length) {
- this_len = str.length;
- }
-
- return str.substring(this_len - search.length, this_len) === search;
-} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes
-
-
-function includes(str, search, start) {
- if (typeof start !== 'number') {
- start = 0;
- }
-
- if (start + search.length > str.length) {
- return false;
- } else {
- return str.indexOf(search, start) !== -1;
- }
-}
-
-createErrorType('ERR_INVALID_OPT_VALUE', function (name, value) {
- return 'The value "' + value + '" is invalid for option "' + name + '"';
-}, TypeError);
-createErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) {
- // determiner: 'must be' or 'must not be'
- var determiner;
-
- if (typeof expected === 'string' && startsWith(expected, 'not ')) {
- determiner = 'must not be';
- expected = expected.replace(/^not /, '');
- } else {
- determiner = 'must be';
- }
-
- var msg;
-
- if (endsWith(name, ' argument')) {
- // For cases like 'first argument'
- msg = "The ".concat(name, " ").concat(determiner, " ").concat(oneOf(expected, 'type'));
- } else {
- var type = includes(name, '.') ? 'property' : 'argument';
- msg = "The \"".concat(name, "\" ").concat(type, " ").concat(determiner, " ").concat(oneOf(expected, 'type'));
- }
-
- msg += ". Received type ".concat(typeof actual);
- return msg;
-}, TypeError);
-createErrorType('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF');
-createErrorType('ERR_METHOD_NOT_IMPLEMENTED', function (name) {
- return 'The ' + name + ' method is not implemented';
-});
-createErrorType('ERR_STREAM_PREMATURE_CLOSE', 'Premature close');
-createErrorType('ERR_STREAM_DESTROYED', function (name) {
- return 'Cannot call ' + name + ' after a stream was destroyed';
-});
-createErrorType('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times');
-createErrorType('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable');
-createErrorType('ERR_STREAM_WRITE_AFTER_END', 'write after end');
-createErrorType('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError);
-createErrorType('ERR_UNKNOWN_ENCODING', function (arg) {
- return 'Unknown encoding: ' + arg;
-}, TypeError);
-createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event');
-module.exports.codes = codes;
diff --git a/deps/npm/node_modules/readable-stream/errors.js b/deps/npm/node_modules/readable-stream/errors.js
deleted file mode 100644
index 8471526d6e..0000000000
--- a/deps/npm/node_modules/readable-stream/errors.js
+++ /dev/null
@@ -1,116 +0,0 @@
-'use strict';
-
-const codes = {};
-
-function createErrorType(code, message, Base) {
- if (!Base) {
- Base = Error
- }
-
- function getMessage (arg1, arg2, arg3) {
- if (typeof message === 'string') {
- return message
- } else {
- return message(arg1, arg2, arg3)
- }
- }
-
- class NodeError extends Base {
- constructor (arg1, arg2, arg3) {
- super(getMessage(arg1, arg2, arg3));
- }
- }
-
- NodeError.prototype.name = Base.name;
- NodeError.prototype.code = code;
-
- codes[code] = NodeError;
-}
-
-// https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js
-function oneOf(expected, thing) {
- if (Array.isArray(expected)) {
- const len = expected.length;
- expected = expected.map((i) => String(i));
- if (len > 2) {
- return `one of ${thing} ${expected.slice(0, len - 1).join(', ')}, or ` +
- expected[len - 1];
- } else if (len === 2) {
- return `one of ${thing} ${expected[0]} or ${expected[1]}`;
- } else {
- return `of ${thing} ${expected[0]}`;
- }
- } else {
- return `of ${thing} ${String(expected)}`;
- }
-}
-
-// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith
-function startsWith(str, search, pos) {
- return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search;
-}
-
-// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith
-function endsWith(str, search, this_len) {
- if (this_len === undefined || this_len > str.length) {
- this_len = str.length;
- }
- return str.substring(this_len - search.length, this_len) === search;
-}
-
-// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes
-function includes(str, search, start) {
- if (typeof start !== 'number') {
- start = 0;
- }
-
- if (start + search.length > str.length) {
- return false;
- } else {
- return str.indexOf(search, start) !== -1;
- }
-}
-
-createErrorType('ERR_INVALID_OPT_VALUE', function (name, value) {
- return 'The value "' + value + '" is invalid for option "' + name + '"'
-}, TypeError);
-createErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) {
- // determiner: 'must be' or 'must not be'
- let determiner;
- if (typeof expected === 'string' && startsWith(expected, 'not ')) {
- determiner = 'must not be';
- expected = expected.replace(/^not /, '');
- } else {
- determiner = 'must be';
- }
-
- let msg;
- if (endsWith(name, ' argument')) {
- // For cases like 'first argument'
- msg = `The ${name} ${determiner} ${oneOf(expected, 'type')}`;
- } else {
- const type = includes(name, '.') ? 'property' : 'argument';
- msg = `The "${name}" ${type} ${determiner} ${oneOf(expected, 'type')}`;
- }
-
- msg += `. Received type ${typeof actual}`;
- return msg;
-}, TypeError);
-createErrorType('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF');
-createErrorType('ERR_METHOD_NOT_IMPLEMENTED', function (name) {
- return 'The ' + name + ' method is not implemented'
-});
-createErrorType('ERR_STREAM_PREMATURE_CLOSE', 'Premature close');
-createErrorType('ERR_STREAM_DESTROYED', function (name) {
- return 'Cannot call ' + name + ' after a stream was destroyed';
-});
-createErrorType('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times');
-createErrorType('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable');
-createErrorType('ERR_STREAM_WRITE_AFTER_END', 'write after end');
-createErrorType('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError);
-createErrorType('ERR_UNKNOWN_ENCODING', function (arg) {
- return 'Unknown encoding: ' + arg
-}, TypeError);
-createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event');
-
-module.exports.codes = codes;
diff --git a/deps/npm/node_modules/readable-stream/experimentalWarning.js b/deps/npm/node_modules/readable-stream/experimentalWarning.js
deleted file mode 100644
index 78e841495b..0000000000
--- a/deps/npm/node_modules/readable-stream/experimentalWarning.js
+++ /dev/null
@@ -1,17 +0,0 @@
-'use strict'
-
-var experimentalWarnings = new Set();
-
-function emitExperimentalWarning(feature) {
- if (experimentalWarnings.has(feature)) return;
- var msg = feature + ' is an experimental feature. This feature could ' +
- 'change at any time';
- experimentalWarnings.add(feature);
- process.emitWarning(msg, 'ExperimentalWarning');
-}
-
-function noop() {}
-
-module.exports.emitExperimentalWarning = process.emitWarning
- ? emitExperimentalWarning
- : noop;
diff --git a/deps/npm/node_modules/readable-stream/lib/_stream_duplex.js b/deps/npm/node_modules/readable-stream/lib/_stream_duplex.js
index 6752519225..57003c32d2 100644
--- a/deps/npm/node_modules/readable-stream/lib/_stream_duplex.js
+++ b/deps/npm/node_modules/readable-stream/lib/_stream_duplex.js
@@ -18,37 +18,43 @@
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
+
// a duplex stream is just a stream that is both readable and writable.
// Since JS doesn't have multiple prototypal inheritance, this class
// prototypally inherits from Readable, and then parasitically from
// Writable.
+
'use strict';
+
/*<replacement>*/
+var pna = require('process-nextick-args');
+/*</replacement>*/
+
+/*<replacement>*/
var objectKeys = Object.keys || function (obj) {
var keys = [];
-
for (var key in obj) {
keys.push(key);
- }
-
- return keys;
+ }return keys;
};
/*</replacement>*/
-
module.exports = Duplex;
-var Readable = require('./_stream_readable');
+/*<replacement>*/
+var util = Object.create(require('core-util-is'));
+util.inherits = require('inherits');
+/*</replacement>*/
+var Readable = require('./_stream_readable');
var Writable = require('./_stream_writable');
-require('inherits')(Duplex, Readable);
+util.inherits(Duplex, Readable);
{
- // Allow the keys array to be GC'ed.
+ // avoid scope creep, the keys array can then be collected
var keys = objectKeys(Writable.prototype);
-
for (var v = 0; v < keys.length; v++) {
var method = keys[v];
if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
@@ -57,19 +63,18 @@ require('inherits')(Duplex, Readable);
function Duplex(options) {
if (!(this instanceof Duplex)) return new Duplex(options);
+
Readable.call(this, options);
Writable.call(this, options);
- this.allowHalfOpen = true;
- if (options) {
- if (options.readable === false) this.readable = false;
- if (options.writable === false) this.writable = false;
+ if (options && options.readable === false) this.readable = false;
- if (options.allowHalfOpen === false) {
- this.allowHalfOpen = false;
- this.once('end', onend);
- }
- }
+ if (options && options.writable === false) this.writable = false;
+
+ this.allowHalfOpen = true;
+ if (options && options.allowHalfOpen === false) this.allowHalfOpen = false;
+
+ this.once('end', onend);
}
Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', {
@@ -77,35 +82,20 @@ Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', {
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
- get: function get() {
+ get: function () {
return this._writableState.highWaterMark;
}
});
-Object.defineProperty(Duplex.prototype, 'writableBuffer', {
- // making it explicit this property is not enumerable
- // because otherwise some prototype manipulation in
- // userland will fail
- enumerable: false,
- get: function get() {
- return this._writableState && this._writableState.getBuffer();
- }
-});
-Object.defineProperty(Duplex.prototype, 'writableLength', {
- // making it explicit this property is not enumerable
- // because otherwise some prototype manipulation in
- // userland will fail
- enumerable: false,
- get: function get() {
- return this._writableState.length;
- }
-}); // the no-half-open enforcer
+// the no-half-open enforcer
function onend() {
- // If the writable side ended, then we're ok.
- if (this._writableState.ended) return; // no more data can be written.
- // But allow more writes to happen in this tick.
+ // if we allow half-open state, or if the writable side ended,
+ // then we're ok.
+ if (this.allowHalfOpen || this._writableState.ended) return;
- process.nextTick(onEndNT, this);
+ // no more data can be written.
+ // But allow more writes to happen in this tick.
+ pna.nextTick(onEndNT, this);
}
function onEndNT(self) {
@@ -113,27 +103,29 @@ function onEndNT(self) {
}
Object.defineProperty(Duplex.prototype, 'destroyed', {
- // making it explicit this property is not enumerable
- // because otherwise some prototype manipulation in
- // userland will fail
- enumerable: false,
- get: function get() {
+ get: function () {
if (this._readableState === undefined || this._writableState === undefined) {
return false;
}
-
return this._readableState.destroyed && this._writableState.destroyed;
},
- set: function set(value) {
+ set: function (value) {
// we ignore the value if the stream
// has not been initialized yet
if (this._readableState === undefined || this._writableState === undefined) {
return;
- } // backward compatibility, the user is explicitly
- // managing destroyed
-
+ }
+ // backward compatibility, the user is explicitly
+ // managing destroyed
this._readableState.destroyed = value;
this._writableState.destroyed = value;
}
-}); \ No newline at end of file
+});
+
+Duplex.prototype._destroy = function (err, cb) {
+ this.push(null);
+ this.end();
+
+ pna.nextTick(cb, err);
+}; \ No newline at end of file
diff --git a/deps/npm/node_modules/readable-stream/lib/_stream_passthrough.js b/deps/npm/node_modules/readable-stream/lib/_stream_passthrough.js
index 32e7414c5a..612edb4d8b 100644
--- a/deps/npm/node_modules/readable-stream/lib/_stream_passthrough.js
+++ b/deps/npm/node_modules/readable-stream/lib/_stream_passthrough.js
@@ -18,19 +18,27 @@
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
+
// a passthrough stream.
// basically just the most minimal sort of Transform stream.
// Every written chunk gets output as-is.
+
'use strict';
module.exports = PassThrough;
var Transform = require('./_stream_transform');
-require('inherits')(PassThrough, Transform);
+/*<replacement>*/
+var util = Object.create(require('core-util-is'));
+util.inherits = require('inherits');
+/*</replacement>*/
+
+util.inherits(PassThrough, Transform);
function PassThrough(options) {
if (!(this instanceof PassThrough)) return new PassThrough(options);
+
Transform.call(this, options);
}
diff --git a/deps/npm/node_modules/readable-stream/lib/_stream_readable.js b/deps/npm/node_modules/readable-stream/lib/_stream_readable.js
index 192d451488..0f807646b0 100644
--- a/deps/npm/node_modules/readable-stream/lib/_stream_readable.js
+++ b/deps/npm/node_modules/readable-stream/lib/_stream_readable.js
@@ -18,110 +18,118 @@
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
+
'use strict';
+/*<replacement>*/
+
+var pna = require('process-nextick-args');
+/*</replacement>*/
+
module.exports = Readable;
+
/*<replacement>*/
+var isArray = require('isarray');
+/*</replacement>*/
+/*<replacement>*/
var Duplex;
/*</replacement>*/
Readable.ReadableState = ReadableState;
-/*<replacement>*/
+/*<replacement>*/
var EE = require('events').EventEmitter;
-var EElistenerCount = function EElistenerCount(emitter, type) {
+var EElistenerCount = function (emitter, type) {
return emitter.listeners(type).length;
};
/*</replacement>*/
/*<replacement>*/
-
-
var Stream = require('./internal/streams/stream');
/*</replacement>*/
+/*<replacement>*/
-var Buffer = require('buffer').Buffer;
-
+var Buffer = require('safe-buffer').Buffer;
var OurUint8Array = global.Uint8Array || function () {};
-
function _uint8ArrayToBuffer(chunk) {
return Buffer.from(chunk);
}
-
function _isUint8Array(obj) {
return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
}
-/*<replacement>*/
-
-var debugUtil = require('util');
+/*</replacement>*/
-var debug;
+/*<replacement>*/
+var util = Object.create(require('core-util-is'));
+util.inherits = require('inherits');
+/*</replacement>*/
+/*<replacement>*/
+var debugUtil = require('util');
+var debug = void 0;
if (debugUtil && debugUtil.debuglog) {
debug = debugUtil.debuglog('stream');
} else {
- debug = function debug() {};
+ debug = function () {};
}
/*</replacement>*/
-
-var BufferList = require('./internal/streams/buffer_list');
-
+var BufferList = require('./internal/streams/BufferList');
var destroyImpl = require('./internal/streams/destroy');
-
-var _require = require('./internal/streams/state'),
- getHighWaterMark = _require.getHighWaterMark;
-
-var _require$codes = require('../errors').codes,
- ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,
- ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF,
- ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,
- ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT; // Lazy loaded to improve the startup performance.
-
-
var StringDecoder;
-var createReadableStreamAsyncIterator;
-var from;
-require('inherits')(Readable, Stream);
+util.inherits(Readable, Stream);
-var errorOrDestroy = destroyImpl.errorOrDestroy;
var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];
function prependListener(emitter, event, fn) {
// Sadly this is not cacheable as some libraries bundle their own
// event emitter implementation with them.
- if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn); // This is a hack to make sure that our error handler is attached before any
+ if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn);
+
+ // This is a hack to make sure that our error handler is attached before any
// userland ones. NEVER DO THIS. This is here only because this code needs
// to continue to work with older versions of Node.js that do not include
// the prependListener() method. The goal is to eventually remove this hack.
-
- if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (Array.isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]];
+ if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]];
}
-function ReadableState(options, stream, isDuplex) {
+function ReadableState(options, stream) {
Duplex = Duplex || require('./_stream_duplex');
- options = options || {}; // Duplex streams are both readable and writable, but share
+
+ options = options || {};
+
+ // Duplex streams are both readable and writable, but share
// the same options object.
// However, some cases require setting options to different
// values for the readable and the writable sides of the duplex stream.
// These options can be provided separately as readableXXX and writableXXX.
+ var isDuplex = stream instanceof Duplex;
- if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; // object stream flag. Used to make read(n) ignore n and to
+ // object stream flag. Used to make read(n) ignore n and to
// make all the buffer merging and length checks go away
-
this.objectMode = !!options.objectMode;
- if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode; // the point at which it stops calling _read() to fill the buffer
+
+ if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode;
+
+ // the point at which it stops calling _read() to fill the buffer
// Note: 0 is a valid value, means "don't call _read preemptively ever"
+ var hwm = options.highWaterMark;
+ var readableHwm = options.readableHighWaterMark;
+ var defaultHwm = this.objectMode ? 16 : 16 * 1024;
+
+ if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (readableHwm || readableHwm === 0)) this.highWaterMark = readableHwm;else this.highWaterMark = defaultHwm;
+
+ // cast to ints.
+ this.highWaterMark = Math.floor(this.highWaterMark);
- this.highWaterMark = getHighWaterMark(this, options, 'readableHighWaterMark', isDuplex); // A linked list is used to store data chunks instead of an array because the
+ // A linked list is used to store data chunks instead of an array because the
// linked list can remove elements from the beginning faster than
// array.shift()
-
this.buffer = new BufferList();
this.length = 0;
this.pipes = null;
@@ -129,36 +137,37 @@ function ReadableState(options, stream, isDuplex) {
this.flowing = null;
this.ended = false;
this.endEmitted = false;
- this.reading = false; // a flag to be able to tell if the event 'readable'/'data' is emitted
+ this.reading = false;
+
+ // a flag to be able to tell if the event 'readable'/'data' is emitted
// immediately, or on a later tick. We set this to true at first, because
// any actions that shouldn't happen until "later" should generally also
// not happen before the first read call.
+ this.sync = true;
- this.sync = true; // whenever we return null, then we set a flag to say
+ // whenever we return null, then we set a flag to say
// that we're awaiting a 'readable' event emission.
-
this.needReadable = false;
this.emittedReadable = false;
this.readableListening = false;
this.resumeScheduled = false;
- this.paused = true; // Should close be emitted on destroy. Defaults to true.
- this.emitClose = options.emitClose !== false; // Should .destroy() be called after 'end' (and potentially 'finish')
+ // has it been destroyed
+ this.destroyed = false;
- this.autoDestroy = !!options.autoDestroy; // has it been destroyed
-
- this.destroyed = false; // Crypto is kind of old and crusty. Historically, its default string
+ // Crypto is kind of old and crusty. Historically, its default string
// encoding is 'binary' so we have to make this configurable.
// Everything else in the universe uses 'utf8', though.
+ this.defaultEncoding = options.defaultEncoding || 'utf8';
- this.defaultEncoding = options.defaultEncoding || 'utf8'; // the number of writers that are awaiting a drain event in .pipe()s
-
- this.awaitDrain = 0; // if true, a maybeReadMore has been scheduled
+ // the number of writers that are awaiting a drain event in .pipe()s
+ this.awaitDrain = 0;
+ // if true, a maybeReadMore has been scheduled
this.readingMore = false;
+
this.decoder = null;
this.encoding = null;
-
if (options.encoding) {
if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;
this.decoder = new StringDecoder(options.encoding);
@@ -168,16 +177,17 @@ function ReadableState(options, stream, isDuplex) {
function Readable(options) {
Duplex = Duplex || require('./_stream_duplex');
- if (!(this instanceof Readable)) return new Readable(options); // Checking for a Stream.Duplex instance is faster here instead of inside
- // the ReadableState constructor, at least with V8 6.5
- var isDuplex = this instanceof Duplex;
- this._readableState = new ReadableState(options, this, isDuplex); // legacy
+ if (!(this instanceof Readable)) return new Readable(options);
+
+ this._readableState = new ReadableState(options, this);
+ // legacy
this.readable = true;
if (options) {
if (typeof options.read === 'function') this._read = options.read;
+
if (typeof options.destroy === 'function') this._destroy = options.destroy;
}
@@ -185,40 +195,36 @@ function Readable(options) {
}
Object.defineProperty(Readable.prototype, 'destroyed', {
- // making it explicit this property is not enumerable
- // because otherwise some prototype manipulation in
- // userland will fail
- enumerable: false,
- get: function get() {
+ get: function () {
if (this._readableState === undefined) {
return false;
}
-
return this._readableState.destroyed;
},
- set: function set(value) {
+ set: function (value) {
// we ignore the value if the stream
// has not been initialized yet
if (!this._readableState) {
return;
- } // backward compatibility, the user is explicitly
- // managing destroyed
-
+ }
+ // backward compatibility, the user is explicitly
+ // managing destroyed
this._readableState.destroyed = value;
}
});
+
Readable.prototype.destroy = destroyImpl.destroy;
Readable.prototype._undestroy = destroyImpl.undestroy;
-
Readable.prototype._destroy = function (err, cb) {
+ this.push(null);
cb(err);
-}; // Manually shove something into the read() buffer.
+};
+
+// Manually shove something into the read() buffer.
// This returns true if the highWaterMark has not been hit yet,
// similar to how Writable.write() returns true if you should
// write() some more.
-
-
Readable.prototype.push = function (chunk, encoding) {
var state = this._readableState;
var skipChunkCheck;
@@ -226,12 +232,10 @@ Readable.prototype.push = function (chunk, encoding) {
if (!state.objectMode) {
if (typeof chunk === 'string') {
encoding = encoding || state.defaultEncoding;
-
if (encoding !== state.encoding) {
chunk = Buffer.from(chunk, encoding);
encoding = '';
}
-
skipChunkCheck = true;
}
} else {
@@ -239,40 +243,34 @@ Readable.prototype.push = function (chunk, encoding) {
}
return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);
-}; // Unshift should *always* be something directly out of read()
-
+};
+// Unshift should *always* be something directly out of read()
Readable.prototype.unshift = function (chunk) {
return readableAddChunk(this, chunk, null, true, false);
};
function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {
- debug('readableAddChunk', chunk);
var state = stream._readableState;
-
if (chunk === null) {
state.reading = false;
onEofChunk(stream, state);
} else {
var er;
if (!skipChunkCheck) er = chunkInvalid(state, chunk);
-
if (er) {
- errorOrDestroy(stream, er);
+ stream.emit('error', er);
} else if (state.objectMode || chunk && chunk.length > 0) {
if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) {
chunk = _uint8ArrayToBuffer(chunk);
}
if (addToFront) {
- if (state.endEmitted) errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT());else addChunk(stream, state, chunk, true);
+ if (state.endEmitted) stream.emit('error', new Error('stream.unshift() after end event'));else addChunk(stream, state, chunk, true);
} else if (state.ended) {
- errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF());
- } else if (state.destroyed) {
- return false;
+ stream.emit('error', new Error('stream.push() after EOF'));
} else {
state.reading = false;
-
if (state.decoder && !encoding) {
chunk = state.decoder.write(chunk);
if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state);
@@ -282,73 +280,61 @@ function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {
}
} else if (!addToFront) {
state.reading = false;
- maybeReadMore(stream, state);
}
- } // We can push more data if we are below the highWaterMark.
- // Also, if we have no data yet, we can stand some more bytes.
- // This is to work around cases where hwm=0, such as the repl.
-
+ }
- return !state.ended && (state.length < state.highWaterMark || state.length === 0);
+ return needMoreData(state);
}
function addChunk(stream, state, chunk, addToFront) {
if (state.flowing && state.length === 0 && !state.sync) {
- state.awaitDrain = 0;
stream.emit('data', chunk);
+ stream.read(0);
} else {
// update the buffer info.
state.length += state.objectMode ? 1 : chunk.length;
if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);
+
if (state.needReadable) emitReadable(stream);
}
-
maybeReadMore(stream, state);
}
function chunkInvalid(state, chunk) {
var er;
-
if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
- er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer', 'Uint8Array'], chunk);
+ er = new TypeError('Invalid non-string/buffer chunk');
}
-
return er;
}
+// if it's past the high water mark, we can push in some more.
+// Also, if we have no data yet, we can stand some
+// more bytes. This is to work around cases where hwm=0,
+// such as the repl. Also, if the push() triggered a
+// readable event, and the user called read(largeNumber) such that
+// needReadable was set, then we ought to push more, so that another
+// 'readable' event will be triggered.
+function needMoreData(state) {
+ return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);
+}
+
Readable.prototype.isPaused = function () {
return this._readableState.flowing === false;
-}; // backwards compatibility.
-
+};
+// backwards compatibility.
Readable.prototype.setEncoding = function (enc) {
if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;
- var decoder = new StringDecoder(enc);
- this._readableState.decoder = decoder; // If setEncoding(null), decoder.encoding equals utf8
-
- this._readableState.encoding = this._readableState.decoder.encoding; // Iterate over current buffer to convert already stored Buffers:
-
- var p = this._readableState.buffer.head;
- var content = '';
-
- while (p !== null) {
- content += decoder.write(p.data);
- p = p.next;
- }
-
- this._readableState.buffer.clear();
-
- if (content !== '') this._readableState.buffer.push(content);
- this._readableState.length = content.length;
+ this._readableState.decoder = new StringDecoder(enc);
+ this._readableState.encoding = enc;
return this;
-}; // Don't raise the hwm > 1GB
-
-
-var MAX_HWM = 0x40000000;
+};
+// Don't raise the hwm > 8MB
+var MAX_HWM = 0x800000;
function computeNewHighWaterMark(n) {
if (n >= MAX_HWM) {
- // TODO(ronag): Throw ERR_VALUE_OUT_OF_RANGE.
n = MAX_HWM;
} else {
// Get the next highest power of 2 to prevent increasing hwm excessively in
@@ -361,55 +347,56 @@ function computeNewHighWaterMark(n) {
n |= n >>> 16;
n++;
}
-
return n;
-} // This function is designed to be inlinable, so please take care when making
-// changes to the function body.
-
+}
+// This function is designed to be inlinable, so please take care when making
+// changes to the function body.
function howMuchToRead(n, state) {
if (n <= 0 || state.length === 0 && state.ended) return 0;
if (state.objectMode) return 1;
-
if (n !== n) {
// Only flow one buffer at a time
if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;
- } // If we're asking for more than the current hwm, then raise the hwm.
-
-
+ }
+ // If we're asking for more than the current hwm, then raise the hwm.
if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);
- if (n <= state.length) return n; // Don't have enough
-
+ if (n <= state.length) return n;
+ // Don't have enough
if (!state.ended) {
state.needReadable = true;
return 0;
}
-
return state.length;
-} // you can override either this method, or the async _read(n) below.
-
+}
+// you can override either this method, or the async _read(n) below.
Readable.prototype.read = function (n) {
debug('read', n);
n = parseInt(n, 10);
var state = this._readableState;
var nOrig = n;
- if (n !== 0) state.emittedReadable = false; // if we're doing read(0) to trigger a readable event, but we
+
+ if (n !== 0) state.emittedReadable = false;
+
+ // if we're doing read(0) to trigger a readable event, but we
// already have a bunch of data in the buffer, then just trigger
// the 'readable' event and move on.
-
- if (n === 0 && state.needReadable && ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended)) {
+ if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) {
debug('read: emitReadable', state.length, state.ended);
if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);
return null;
}
- n = howMuchToRead(n, state); // if we've ended, and we're now clear, then finish it up.
+ n = howMuchToRead(n, state);
+ // if we've ended, and we're now clear, then finish it up.
if (n === 0 && state.ended) {
if (state.length === 0) endReadable(this);
return null;
- } // All the actual chunk generation logic needs to be
+ }
+
+ // All the actual chunk generation logic needs to be
// *below* the call to _read. The reason is that in certain
// synthetic stream cases, such as passthrough streams, _read
// may be a completely synchronous operation which may change
@@ -430,34 +417,33 @@ Readable.prototype.read = function (n) {
// 'readable' etc.
//
// 3. Actually pull the requested chunks out of the buffer and return.
- // if we need a readable event, then we need to do some reading.
-
+ // if we need a readable event, then we need to do some reading.
var doRead = state.needReadable;
- debug('need readable', doRead); // if we currently have less than the highWaterMark, then also read some
+ debug('need readable', doRead);
+ // if we currently have less than the highWaterMark, then also read some
if (state.length === 0 || state.length - n < state.highWaterMark) {
doRead = true;
debug('length less than watermark', doRead);
- } // however, if we've ended, then there's no point, and if we're already
- // reading, then it's unnecessary.
-
+ }
+ // however, if we've ended, then there's no point, and if we're already
+ // reading, then it's unnecessary.
if (state.ended || state.reading) {
doRead = false;
debug('reading or ended', doRead);
} else if (doRead) {
debug('do read');
state.reading = true;
- state.sync = true; // if the length is currently zero, then we *need* a readable event.
-
- if (state.length === 0) state.needReadable = true; // call internal read method
-
+ state.sync = true;
+ // if the length is currently zero, then we *need* a readable event.
+ if (state.length === 0) state.needReadable = true;
+ // call internal read method
this._read(state.highWaterMark);
-
- state.sync = false; // If _read pushed data synchronously, then `reading` will be false,
+ state.sync = false;
+ // If _read pushed data synchronously, then `reading` will be false,
// and we need to re-evaluate how much data we can return to the user.
-
if (!state.reading) n = howMuchToRead(nOrig, state);
}
@@ -465,144 +451,91 @@ Readable.prototype.read = function (n) {
if (n > 0) ret = fromList(n, state);else ret = null;
if (ret === null) {
- state.needReadable = state.length <= state.highWaterMark;
+ state.needReadable = true;
n = 0;
} else {
state.length -= n;
- state.awaitDrain = 0;
}
if (state.length === 0) {
// If we have nothing in the buffer, then we want to know
// as soon as we *do* get something into the buffer.
- if (!state.ended) state.needReadable = true; // If we tried to read() past the EOF, then emit end on the next tick.
+ if (!state.ended) state.needReadable = true;
+ // If we tried to read() past the EOF, then emit end on the next tick.
if (nOrig !== n && state.ended) endReadable(this);
}
if (ret !== null) this.emit('data', ret);
+
return ret;
};
function onEofChunk(stream, state) {
- debug('onEofChunk');
if (state.ended) return;
-
if (state.decoder) {
var chunk = state.decoder.end();
-
if (chunk && chunk.length) {
state.buffer.push(chunk);
state.length += state.objectMode ? 1 : chunk.length;
}
}
-
state.ended = true;
- if (state.sync) {
- // if we are sync, wait until next tick to emit the data.
- // Otherwise we risk emitting data in the flow()
- // the readable code triggers during a read() call
- emitReadable(stream);
- } else {
- // emit 'readable' now to make sure it gets picked up.
- state.needReadable = false;
+ // emit 'readable' now to make sure it gets picked up.
+ emitReadable(stream);
+}
- if (!state.emittedReadable) {
- state.emittedReadable = true;
- emitReadable_(stream);
- }
- }
-} // Don't emit readable right away in sync mode, because this can trigger
+// Don't emit readable right away in sync mode, because this can trigger
// another read() call => stack overflow. This way, it might trigger
// a nextTick recursion warning, but that's not so bad.
-
-
function emitReadable(stream) {
var state = stream._readableState;
- debug('emitReadable', state.needReadable, state.emittedReadable);
state.needReadable = false;
-
if (!state.emittedReadable) {
debug('emitReadable', state.flowing);
state.emittedReadable = true;
- process.nextTick(emitReadable_, stream);
+ if (state.sync) pna.nextTick(emitReadable_, stream);else emitReadable_(stream);
}
}
function emitReadable_(stream) {
- var state = stream._readableState;
- debug('emitReadable_', state.destroyed, state.length, state.ended);
-
- if (!state.destroyed && (state.length || state.ended)) {
- stream.emit('readable');
- state.emittedReadable = false;
- } // The stream needs another readable event if
- // 1. It is not flowing, as the flow mechanism will take
- // care of it.
- // 2. It is not ended.
- // 3. It is below the highWaterMark, so we can schedule
- // another readable later.
-
-
- state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark;
+ debug('emit readable');
+ stream.emit('readable');
flow(stream);
-} // at this point, the user has presumably seen the 'readable' event,
+}
+
+// at this point, the user has presumably seen the 'readable' event,
// and called read() to consume some data. that may have triggered
// in turn another _read(n) call, in which case reading = true if
// it's in progress.
// However, if we're not ended, or reading, and the length < hwm,
// then go ahead and try to read some more preemptively.
-
-
function maybeReadMore(stream, state) {
if (!state.readingMore) {
state.readingMore = true;
- process.nextTick(maybeReadMore_, stream, state);
+ pna.nextTick(maybeReadMore_, stream, state);
}
}
function maybeReadMore_(stream, state) {
- // Attempt to read more data if we should.
- //
- // The conditions for reading more data are (one of):
- // - Not enough data buffered (state.length < state.highWaterMark). The loop
- // is responsible for filling the buffer with enough data if such data
- // is available. If highWaterMark is 0 and we are not in the flowing mode
- // we should _not_ attempt to buffer any extra data. We'll get more data
- // when the stream consumer calls read() instead.
- // - No data in the buffer, and the stream is in flowing mode. In this mode
- // the loop below is responsible for ensuring read() is called. Failing to
- // call read here would abort the flow and there's no other mechanism for
- // continuing the flow if the stream consumer has just subscribed to the
- // 'data' event.
- //
- // In addition to the above conditions to keep reading data, the following
- // conditions prevent the data from being read:
- // - The stream has ended (state.ended).
- // - There is already a pending 'read' operation (state.reading). This is a
- // case where the the stream has called the implementation defined _read()
- // method, but they are processing the call asynchronously and have _not_
- // called push() with new data. In this case we skip performing more
- // read()s. The execution ends in this method again after the _read() ends
- // up calling push() with more data.
- while (!state.reading && !state.ended && (state.length < state.highWaterMark || state.flowing && state.length === 0)) {
- var len = state.length;
+ var len = state.length;
+ while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) {
debug('maybeReadMore read 0');
stream.read(0);
- if (len === state.length) // didn't get any data, stop spinning.
- break;
+ if (len === state.length)
+ // didn't get any data, stop spinning.
+ break;else len = state.length;
}
-
state.readingMore = false;
-} // abstract method. to be overridden in specific implementation classes.
+}
+
+// abstract method. to be overridden in specific implementation classes.
// call cb(er, data) where data is <= n in length.
// for virtual (non-string, non-buffer) streams, "length" is somewhat
// arbitrary, and perhaps not very meaningful.
-
-
Readable.prototype._read = function (n) {
- errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED('_read()'));
+ this.emit('error', new Error('_read() is not implemented'));
};
Readable.prototype.pipe = function (dest, pipeOpts) {
@@ -613,26 +546,24 @@ Readable.prototype.pipe = function (dest, pipeOpts) {
case 0:
state.pipes = dest;
break;
-
case 1:
state.pipes = [state.pipes, dest];
break;
-
default:
state.pipes.push(dest);
break;
}
-
state.pipesCount += 1;
debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);
+
var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
+
var endFn = doEnd ? onend : unpipe;
- if (state.endEmitted) process.nextTick(endFn);else src.once('end', endFn);
- dest.on('unpipe', onunpipe);
+ if (state.endEmitted) pna.nextTick(endFn);else src.once('end', endFn);
+ dest.on('unpipe', onunpipe);
function onunpipe(readable, unpipeInfo) {
debug('onunpipe');
-
if (readable === src) {
if (unpipeInfo && unpipeInfo.hasUnpiped === false) {
unpipeInfo.hasUnpiped = true;
@@ -644,19 +575,19 @@ Readable.prototype.pipe = function (dest, pipeOpts) {
function onend() {
debug('onend');
dest.end();
- } // when the dest drains, it reduces the awaitDrain counter
+ }
+
+ // when the dest drains, it reduces the awaitDrain counter
// on the source. This would be more elegant with a .once()
// handler in flow(), but adding and removing repeatedly is
// too slow.
-
-
var ondrain = pipeOnDrain(src);
dest.on('drain', ondrain);
- var cleanedUp = false;
+ var cleanedUp = false;
function cleanup() {
- debug('cleanup'); // cleanup event handlers once the pipe is broken
-
+ debug('cleanup');
+ // cleanup event handlers once the pipe is broken
dest.removeListener('close', onclose);
dest.removeListener('finish', onfinish);
dest.removeListener('drain', ondrain);
@@ -665,71 +596,75 @@ Readable.prototype.pipe = function (dest, pipeOpts) {
src.removeListener('end', onend);
src.removeListener('end', unpipe);
src.removeListener('data', ondata);
- cleanedUp = true; // if the reader is waiting for a drain event from this
+
+ cleanedUp = true;
+
+ // if the reader is waiting for a drain event from this
// specific writer, then it would cause it to never start
// flowing again.
// So, if this is awaiting a drain, then we just call it now.
// If we don't know, then assume that we are waiting for one.
-
if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
}
+ // If the user pushes more data while we're writing to dest then we'll end up
+ // in ondata again. However, we only want to increase awaitDrain once because
+ // dest will only emit one 'drain' event for the multiple writes.
+ // => Introduce a guard on increasing awaitDrain.
+ var increasedAwaitDrain = false;
src.on('data', ondata);
-
function ondata(chunk) {
debug('ondata');
+ increasedAwaitDrain = false;
var ret = dest.write(chunk);
- debug('dest.write', ret);
-
- if (ret === false) {
+ if (false === ret && !increasedAwaitDrain) {
// If the user unpiped during `dest.write()`, it is possible
// to get stuck in a permanently paused state if that write
// also returned false.
// => Check whether `dest` is still a piping destination.
if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
- debug('false write response, pause', state.awaitDrain);
- state.awaitDrain++;
+ debug('false write response, pause', src._readableState.awaitDrain);
+ src._readableState.awaitDrain++;
+ increasedAwaitDrain = true;
}
-
src.pause();
}
- } // if the dest has an error, then stop piping into it.
- // however, don't suppress the throwing behavior for this.
-
+ }
+ // if the dest has an error, then stop piping into it.
+ // however, don't suppress the throwing behavior for this.
function onerror(er) {
debug('onerror', er);
unpipe();
dest.removeListener('error', onerror);
- if (EElistenerCount(dest, 'error') === 0) errorOrDestroy(dest, er);
- } // Make sure our error handler is attached before userland ones.
-
+ if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er);
+ }
- prependListener(dest, 'error', onerror); // Both close and finish should trigger unpipe, but only once.
+ // Make sure our error handler is attached before userland ones.
+ prependListener(dest, 'error', onerror);
+ // Both close and finish should trigger unpipe, but only once.
function onclose() {
dest.removeListener('finish', onfinish);
unpipe();
}
-
dest.once('close', onclose);
-
function onfinish() {
debug('onfinish');
dest.removeListener('close', onclose);
unpipe();
}
-
dest.once('finish', onfinish);
function unpipe() {
debug('unpipe');
src.unpipe(dest);
- } // tell the dest that it's being piped to
-
+ }
- dest.emit('pipe', src); // start the flow if it hasn't been started already.
+ // tell the dest that it's being piped to
+ dest.emit('pipe', src);
+ // start the flow if it hasn't been started already.
if (!state.flowing) {
debug('pipe resume');
src.resume();
@@ -739,11 +674,10 @@ Readable.prototype.pipe = function (dest, pipeOpts) {
};
function pipeOnDrain(src) {
- return function pipeOnDrainFunctionResult() {
+ return function () {
var state = src._readableState;
debug('pipeOnDrain', state.awaitDrain);
if (state.awaitDrain) state.awaitDrain--;
-
if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {
state.flowing = true;
flow(src);
@@ -753,24 +687,27 @@ function pipeOnDrain(src) {
Readable.prototype.unpipe = function (dest) {
var state = this._readableState;
- var unpipeInfo = {
- hasUnpiped: false
- }; // if we're not piping anywhere, then do nothing.
+ var unpipeInfo = { hasUnpiped: false };
- if (state.pipesCount === 0) return this; // just one destination. most common case.
+ // if we're not piping anywhere, then do nothing.
+ if (state.pipesCount === 0) return this;
+ // just one destination. most common case.
if (state.pipesCount === 1) {
// passed in one, but it's not the right one.
if (dest && dest !== state.pipes) return this;
- if (!dest) dest = state.pipes; // got a match.
+ if (!dest) dest = state.pipes;
+
+ // got a match.
state.pipes = null;
state.pipesCount = 0;
state.flowing = false;
if (dest) dest.emit('unpipe', this, unpipeInfo);
return this;
- } // slow case. multiple pipe destinations.
+ }
+ // slow case. multiple pipe destinations.
if (!dest) {
// remove all.
@@ -781,139 +718,80 @@ Readable.prototype.unpipe = function (dest) {
state.flowing = false;
for (var i = 0; i < len; i++) {
- dests[i].emit('unpipe', this, {
- hasUnpiped: false
- });
- }
-
- return this;
- } // try to find the right one.
-
+ dests[i].emit('unpipe', this, unpipeInfo);
+ }return this;
+ }
+ // try to find the right one.
var index = indexOf(state.pipes, dest);
if (index === -1) return this;
+
state.pipes.splice(index, 1);
state.pipesCount -= 1;
if (state.pipesCount === 1) state.pipes = state.pipes[0];
+
dest.emit('unpipe', this, unpipeInfo);
- return this;
-}; // set up data events if they are asked for
-// Ensure readable listeners eventually get something
+ return this;
+};
+// set up data events if they are asked for
+// Ensure readable listeners eventually get something
Readable.prototype.on = function (ev, fn) {
var res = Stream.prototype.on.call(this, ev, fn);
- var state = this._readableState;
if (ev === 'data') {
- // update readableListening so that resume() may be a no-op
- // a few lines down. This is needed to support once('readable').
- state.readableListening = this.listenerCount('readable') > 0; // Try start flowing on next tick if stream isn't explicitly paused
-
- if (state.flowing !== false) this.resume();
+ // Start flowing on next tick if stream isn't explicitly paused
+ if (this._readableState.flowing !== false) this.resume();
} else if (ev === 'readable') {
+ var state = this._readableState;
if (!state.endEmitted && !state.readableListening) {
state.readableListening = state.needReadable = true;
- state.flowing = false;
state.emittedReadable = false;
- debug('on readable', state.length, state.reading);
-
- if (state.length) {
+ if (!state.reading) {
+ pna.nextTick(nReadingNextTick, this);
+ } else if (state.length) {
emitReadable(this);
- } else if (!state.reading) {
- process.nextTick(nReadingNextTick, this);
}
}
}
return res;
};
-
Readable.prototype.addListener = Readable.prototype.on;
-Readable.prototype.removeListener = function (ev, fn) {
- var res = Stream.prototype.removeListener.call(this, ev, fn);
-
- if (ev === 'readable') {
- // We need to check if there is someone still listening to
- // readable and reset the state. However this needs to happen
- // after readable has been emitted but before I/O (nextTick) to
- // support once('readable', fn) cycles. This means that calling
- // resume within the same tick will have no
- // effect.
- process.nextTick(updateReadableListening, this);
- }
-
- return res;
-};
-
-Readable.prototype.removeAllListeners = function (ev) {
- var res = Stream.prototype.removeAllListeners.apply(this, arguments);
-
- if (ev === 'readable' || ev === undefined) {
- // We need to check if there is someone still listening to
- // readable and reset the state. However this needs to happen
- // after readable has been emitted but before I/O (nextTick) to
- // support once('readable', fn) cycles. This means that calling
- // resume within the same tick will have no
- // effect.
- process.nextTick(updateReadableListening, this);
- }
-
- return res;
-};
-
-function updateReadableListening(self) {
- var state = self._readableState;
- state.readableListening = self.listenerCount('readable') > 0;
-
- if (state.resumeScheduled && !state.paused) {
- // flowing needs to be set to true now, otherwise
- // the upcoming resume will not flow.
- state.flowing = true; // crude way to check if we should resume
- } else if (self.listenerCount('data') > 0) {
- self.resume();
- }
-}
-
function nReadingNextTick(self) {
debug('readable nexttick read 0');
self.read(0);
-} // pause() and resume() are remnants of the legacy readable stream API
-// If the user uses them, then switch into old mode.
-
+}
+// pause() and resume() are remnants of the legacy readable stream API
+// If the user uses them, then switch into old mode.
Readable.prototype.resume = function () {
var state = this._readableState;
-
if (!state.flowing) {
- debug('resume'); // we flow only if there is no one listening
- // for readable, but we still have to call
- // resume()
-
- state.flowing = !state.readableListening;
+ debug('resume');
+ state.flowing = true;
resume(this, state);
}
-
- state.paused = false;
return this;
};
function resume(stream, state) {
if (!state.resumeScheduled) {
state.resumeScheduled = true;
- process.nextTick(resume_, stream, state);
+ pna.nextTick(resume_, stream, state);
}
}
function resume_(stream, state) {
- debug('resume', state.reading);
-
if (!state.reading) {
+ debug('resume read 0');
stream.read(0);
}
state.resumeScheduled = false;
+ state.awaitDrain = 0;
stream.emit('resume');
flow(stream);
if (state.flowing && !state.reading) stream.read(0);
@@ -921,37 +799,31 @@ function resume_(stream, state) {
Readable.prototype.pause = function () {
debug('call pause flowing=%j', this._readableState.flowing);
-
- if (this._readableState.flowing !== false) {
+ if (false !== this._readableState.flowing) {
debug('pause');
this._readableState.flowing = false;
this.emit('pause');
}
-
- this._readableState.paused = true;
return this;
};
function flow(stream) {
var state = stream._readableState;
debug('flow', state.flowing);
+ while (state.flowing && stream.read() !== null) {}
+}
- while (state.flowing && stream.read() !== null) {
- ;
- }
-} // wrap an old-style stream as the async data source.
+// wrap an old-style stream as the async data source.
// This is *not* part of the readable stream interface.
// It is an ugly unfortunate mess of history.
-
-
Readable.prototype.wrap = function (stream) {
var _this = this;
var state = this._readableState;
var paused = false;
+
stream.on('end', function () {
debug('wrapped end');
-
if (state.decoder && !state.ended) {
var chunk = state.decoder.end();
if (chunk && chunk.length) _this.push(chunk);
@@ -959,41 +831,42 @@ Readable.prototype.wrap = function (stream) {
_this.push(null);
});
+
stream.on('data', function (chunk) {
debug('wrapped data');
- if (state.decoder) chunk = state.decoder.write(chunk); // don't skip over falsy values in objectMode
+ if (state.decoder) chunk = state.decoder.write(chunk);
+ // don't skip over falsy values in objectMode
if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;
var ret = _this.push(chunk);
-
if (!ret) {
paused = true;
stream.pause();
}
- }); // proxy all the other methods.
- // important when wrapping filters and duplexes.
+ });
+ // proxy all the other methods.
+ // important when wrapping filters and duplexes.
for (var i in stream) {
if (this[i] === undefined && typeof stream[i] === 'function') {
- this[i] = function methodWrap(method) {
- return function methodWrapReturnFunction() {
+ this[i] = function (method) {
+ return function () {
return stream[method].apply(stream, arguments);
};
}(i);
}
- } // proxy certain important events.
-
+ }
+ // proxy certain important events.
for (var n = 0; n < kProxyEvents.length; n++) {
stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));
- } // when we try to consume some more bytes, simply unpause the
- // underlying stream.
-
+ }
+ // when we try to consume some more bytes, simply unpause the
+ // underlying stream.
this._read = function (n) {
debug('wrapped _read', n);
-
if (paused) {
paused = false;
stream.resume();
@@ -1003,122 +876,144 @@ Readable.prototype.wrap = function (stream) {
return this;
};
-if (typeof Symbol === 'function') {
- Readable.prototype[Symbol.asyncIterator] = function () {
- if (createReadableStreamAsyncIterator === undefined) {
- createReadableStreamAsyncIterator = require('./internal/streams/async_iterator');
- }
-
- return createReadableStreamAsyncIterator(this);
- };
-}
-
Object.defineProperty(Readable.prototype, 'readableHighWaterMark', {
// making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
- get: function get() {
+ get: function () {
return this._readableState.highWaterMark;
}
});
-Object.defineProperty(Readable.prototype, 'readableBuffer', {
- // making it explicit this property is not enumerable
- // because otherwise some prototype manipulation in
- // userland will fail
- enumerable: false,
- get: function get() {
- return this._readableState && this._readableState.buffer;
- }
-});
-Object.defineProperty(Readable.prototype, 'readableFlowing', {
- // making it explicit this property is not enumerable
- // because otherwise some prototype manipulation in
- // userland will fail
- enumerable: false,
- get: function get() {
- return this._readableState.flowing;
- },
- set: function set(state) {
- if (this._readableState) {
- this._readableState.flowing = state;
- }
- }
-}); // exposed for testing purposes only.
+// exposed for testing purposes only.
Readable._fromList = fromList;
-Object.defineProperty(Readable.prototype, 'readableLength', {
- // making it explicit this property is not enumerable
- // because otherwise some prototype manipulation in
- // userland will fail
- enumerable: false,
- get: function get() {
- return this._readableState.length;
- }
-}); // Pluck off n bytes from an array of buffers.
+
+// Pluck off n bytes from an array of buffers.
// Length is the combined lengths of all the buffers in the list.
// This function is designed to be inlinable, so please take care when making
// changes to the function body.
-
function fromList(n, state) {
// nothing buffered
if (state.length === 0) return null;
+
var ret;
if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {
// read it all, truncate the list
- if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.first();else ret = state.buffer.concat(state.length);
+ if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = state.buffer.concat(state.length);
state.buffer.clear();
} else {
// read part of list
- ret = state.buffer.consume(n, state.decoder);
+ ret = fromListPartial(n, state.buffer, state.decoder);
}
+
+ return ret;
+}
+
+// Extracts only enough buffered data to satisfy the amount requested.
+// This function is designed to be inlinable, so please take care when making
+// changes to the function body.
+function fromListPartial(n, list, hasStrings) {
+ var ret;
+ if (n < list.head.data.length) {
+ // slice is the same for buffers and strings
+ ret = list.head.data.slice(0, n);
+ list.head.data = list.head.data.slice(n);
+ } else if (n === list.head.data.length) {
+ // first chunk is a perfect match
+ ret = list.shift();
+ } else {
+ // result spans more than one buffer
+ ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);
+ }
+ return ret;
+}
+
+// Copies a specified amount of characters from the list of buffered data
+// chunks.
+// This function is designed to be inlinable, so please take care when making
+// changes to the function body.
+function copyFromBufferString(n, list) {
+ var p = list.head;
+ var c = 1;
+ var ret = p.data;
+ n -= ret.length;
+ while (p = p.next) {
+ var str = p.data;
+ var nb = n > str.length ? str.length : n;
+ if (nb === str.length) ret += str;else ret += str.slice(0, n);
+ n -= nb;
+ if (n === 0) {
+ if (nb === str.length) {
+ ++c;
+ if (p.next) list.head = p.next;else list.head = list.tail = null;
+ } else {
+ list.head = p;
+ p.data = str.slice(nb);
+ }
+ break;
+ }
+ ++c;
+ }
+ list.length -= c;
+ return ret;
+}
+
+// Copies a specified amount of bytes from the list of buffered data chunks.
+// This function is designed to be inlinable, so please take care when making
+// changes to the function body.
+function copyFromBuffer(n, list) {
+ var ret = Buffer.allocUnsafe(n);
+ var p = list.head;
+ var c = 1;
+ p.data.copy(ret);
+ n -= p.data.length;
+ while (p = p.next) {
+ var buf = p.data;
+ var nb = n > buf.length ? buf.length : n;
+ buf.copy(ret, ret.length - n, 0, nb);
+ n -= nb;
+ if (n === 0) {
+ if (nb === buf.length) {
+ ++c;
+ if (p.next) list.head = p.next;else list.head = list.tail = null;
+ } else {
+ list.head = p;
+ p.data = buf.slice(nb);
+ }
+ break;
+ }
+ ++c;
+ }
+ list.length -= c;
return ret;
}
function endReadable(stream) {
var state = stream._readableState;
- debug('endReadable', state.endEmitted);
+
+ // If we get here before consuming all the bytes, then that is a
+ // bug in node. Should never happen.
+ if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream');
if (!state.endEmitted) {
state.ended = true;
- process.nextTick(endReadableNT, state, stream);
+ pna.nextTick(endReadableNT, state, stream);
}
}
function endReadableNT(state, stream) {
- debug('endReadableNT', state.endEmitted, state.length); // Check that we didn't get one last unshift.
-
+ // Check that we didn't get one last unshift.
if (!state.endEmitted && state.length === 0) {
state.endEmitted = true;
stream.readable = false;
stream.emit('end');
-
- if (state.autoDestroy) {
- // In case of duplex streams we need a way to detect
- // if the writable side is ready for autoDestroy as well
- var wState = stream._writableState;
-
- if (!wState || wState.autoDestroy && wState.finished) {
- stream.destroy();
- }
- }
}
}
-if (typeof Symbol === 'function') {
- Readable.from = function (iterable, opts) {
- if (from === undefined) {
- from = require('./internal/streams/from');
- }
-
- return from(Readable, iterable, opts);
- };
-}
-
function indexOf(xs, x) {
for (var i = 0, l = xs.length; i < l; i++) {
if (xs[i] === x) return i;
}
-
return -1;
} \ No newline at end of file
diff --git a/deps/npm/node_modules/readable-stream/lib/_stream_transform.js b/deps/npm/node_modules/readable-stream/lib/_stream_transform.js
index 41a738c4e9..fcfc105af8 100644
--- a/deps/npm/node_modules/readable-stream/lib/_stream_transform.js
+++ b/deps/npm/node_modules/readable-stream/lib/_stream_transform.js
@@ -18,6 +18,7 @@
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
+
// a transform stream is a readable/writable stream where you do
// something with the data. Sometimes it's called a "filter",
// but that's not a great name for it, since that implies a thing where
@@ -59,37 +60,40 @@
// However, even in such a pathological case, only a single written chunk
// would be consumed, and then the rest would wait (un-transformed) until
// the results of the previous transformed chunk were consumed.
+
'use strict';
module.exports = Transform;
-var _require$codes = require('../errors').codes,
- ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,
- ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK,
- ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING,
- ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0;
-
var Duplex = require('./_stream_duplex');
-require('inherits')(Transform, Duplex);
+/*<replacement>*/
+var util = Object.create(require('core-util-is'));
+util.inherits = require('inherits');
+/*</replacement>*/
+
+util.inherits(Transform, Duplex);
function afterTransform(er, data) {
var ts = this._transformState;
ts.transforming = false;
+
var cb = ts.writecb;
- if (cb === null) {
- return this.emit('error', new ERR_MULTIPLE_CALLBACK());
+ if (!cb) {
+ return this.emit('error', new Error('write callback called multiple times'));
}
ts.writechunk = null;
ts.writecb = null;
+
if (data != null) // single equals check for both `null` and `undefined`
this.push(data);
+
cb(er);
+
var rs = this._readableState;
rs.reading = false;
-
if (rs.needReadable || rs.length < rs.highWaterMark) {
this._read(rs.highWaterMark);
}
@@ -97,7 +101,9 @@ function afterTransform(er, data) {
function Transform(options) {
if (!(this instanceof Transform)) return new Transform(options);
+
Duplex.call(this, options);
+
this._transformState = {
afterTransform: afterTransform.bind(this),
needTransform: false,
@@ -105,27 +111,30 @@ function Transform(options) {
writecb: null,
writechunk: null,
writeencoding: null
- }; // start out asking for a readable event once data is transformed.
+ };
+
+ // start out asking for a readable event once data is transformed.
+ this._readableState.needReadable = true;
- this._readableState.needReadable = true; // we have implemented the _read method, and done the other things
+ // we have implemented the _read method, and done the other things
// that Readable wants before the first _read call, so unset the
// sync guard flag.
-
this._readableState.sync = false;
if (options) {
if (typeof options.transform === 'function') this._transform = options.transform;
- if (typeof options.flush === 'function') this._flush = options.flush;
- } // When the writable side finishes, then flush out anything remaining.
+ if (typeof options.flush === 'function') this._flush = options.flush;
+ }
+ // When the writable side finishes, then flush out anything remaining.
this.on('prefinish', prefinish);
}
function prefinish() {
var _this = this;
- if (typeof this._flush === 'function' && !this._readableState.destroyed) {
+ if (typeof this._flush === 'function') {
this._flush(function (er, data) {
done(_this, er, data);
});
@@ -137,7 +146,9 @@ function prefinish() {
Transform.prototype.push = function (chunk, encoding) {
this._transformState.needTransform = false;
return Duplex.prototype.push.call(this, chunk, encoding);
-}; // This is the part where you do stuff!
+};
+
+// This is the part where you do stuff!
// override this function in implementation classes.
// 'chunk' is an input chunk.
//
@@ -147,10 +158,8 @@ Transform.prototype.push = function (chunk, encoding) {
// Call `cb(err)` when you are done with this chunk. If you pass
// an error, then that'll put the hurt on the whole operation. If you
// never call cb(), then you'll never get another chunk.
-
-
Transform.prototype._transform = function (chunk, encoding, cb) {
- cb(new ERR_METHOD_NOT_IMPLEMENTED('_transform()'));
+ throw new Error('_transform() is not implemented');
};
Transform.prototype._write = function (chunk, encoding, cb) {
@@ -158,22 +167,20 @@ Transform.prototype._write = function (chunk, encoding, cb) {
ts.writecb = cb;
ts.writechunk = chunk;
ts.writeencoding = encoding;
-
if (!ts.transforming) {
var rs = this._readableState;
if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
}
-}; // Doesn't matter what the args are here.
+};
+
+// Doesn't matter what the args are here.
// _transform does all the work.
// That we got here means that the readable side wants more data.
-
-
Transform.prototype._read = function (n) {
var ts = this._transformState;
- if (ts.writechunk !== null && !ts.transforming) {
+ if (ts.writechunk !== null && ts.writecb && !ts.transforming) {
ts.transforming = true;
-
this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
} else {
// mark that we need a transform, so that any data that comes in
@@ -183,19 +190,25 @@ Transform.prototype._read = function (n) {
};
Transform.prototype._destroy = function (err, cb) {
+ var _this2 = this;
+
Duplex.prototype._destroy.call(this, err, function (err2) {
cb(err2);
+ _this2.emit('close');
});
};
function done(stream, er, data) {
if (er) return stream.emit('error', er);
+
if (data != null) // single equals check for both `null` and `undefined`
- stream.push(data); // TODO(BridgeAR): Write a test for these two error cases
+ stream.push(data);
+
// if there's nothing in the write buffer, then that means
// that nothing more will ever be provided
+ if (stream._writableState.length) throw new Error('Calling transform done when ws.length != 0');
+
+ if (stream._transformState.transforming) throw new Error('Calling transform done when still transforming');
- if (stream._writableState.length) throw new ERR_TRANSFORM_WITH_LENGTH_0();
- if (stream._transformState.transforming) throw new ERR_TRANSFORM_ALREADY_TRANSFORMING();
return stream.push(null);
} \ No newline at end of file
diff --git a/deps/npm/node_modules/readable-stream/lib/_stream_writable.js b/deps/npm/node_modules/readable-stream/lib/_stream_writable.js
index a2634d7c24..b0b02200cd 100644
--- a/deps/npm/node_modules/readable-stream/lib/_stream_writable.js
+++ b/deps/npm/node_modules/readable-stream/lib/_stream_writable.js
@@ -18,29 +18,35 @@
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
+
// A bit simpler than readable streams.
// Implement an async ._write(chunk, encoding, cb), and it'll handle all
// the drain event emission and buffering.
+
'use strict';
+/*<replacement>*/
+
+var pna = require('process-nextick-args');
+/*</replacement>*/
+
module.exports = Writable;
-/* <replacement> */
+/* <replacement> */
function WriteReq(chunk, encoding, cb) {
this.chunk = chunk;
this.encoding = encoding;
this.callback = cb;
this.next = null;
-} // It seems a linked list but it is not
-// there will be only 2 of these for each stream
-
+}
+// It seems a linked list but it is not
+// there will be only 2 of these for each stream
function CorkedRequest(state) {
var _this = this;
this.next = null;
this.entry = null;
-
this.finish = function () {
onCorkedFinish(_this, state);
};
@@ -48,247 +54,266 @@ function CorkedRequest(state) {
/* </replacement> */
/*<replacement>*/
+var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick;
+/*</replacement>*/
-
+/*<replacement>*/
var Duplex;
/*</replacement>*/
Writable.WritableState = WritableState;
+
/*<replacement>*/
+var util = Object.create(require('core-util-is'));
+util.inherits = require('inherits');
+/*</replacement>*/
+/*<replacement>*/
var internalUtil = {
deprecate: require('util-deprecate')
};
/*</replacement>*/
/*<replacement>*/
-
var Stream = require('./internal/streams/stream');
/*</replacement>*/
+/*<replacement>*/
-var Buffer = require('buffer').Buffer;
-
+var Buffer = require('safe-buffer').Buffer;
var OurUint8Array = global.Uint8Array || function () {};
-
function _uint8ArrayToBuffer(chunk) {
return Buffer.from(chunk);
}
-
function _isUint8Array(obj) {
return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
}
-var destroyImpl = require('./internal/streams/destroy');
-
-var _require = require('./internal/streams/state'),
- getHighWaterMark = _require.getHighWaterMark;
-
-var _require$codes = require('../errors').codes,
- ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,
- ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,
- ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK,
- ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE,
- ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED,
- ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES,
- ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END,
- ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING;
+/*</replacement>*/
-var errorOrDestroy = destroyImpl.errorOrDestroy;
+var destroyImpl = require('./internal/streams/destroy');
-require('inherits')(Writable, Stream);
+util.inherits(Writable, Stream);
function nop() {}
-function WritableState(options, stream, isDuplex) {
+function WritableState(options, stream) {
Duplex = Duplex || require('./_stream_duplex');
- options = options || {}; // Duplex streams are both readable and writable, but share
+
+ options = options || {};
+
+ // Duplex streams are both readable and writable, but share
// the same options object.
// However, some cases require setting options to different
- // values for the readable and the writable sides of the duplex stream,
- // e.g. options.readableObjectMode vs. options.writableObjectMode, etc.
+ // values for the readable and the writable sides of the duplex stream.
+ // These options can be provided separately as readableXXX and writableXXX.
+ var isDuplex = stream instanceof Duplex;
- if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; // object stream flag to indicate whether or not this stream
+ // object stream flag to indicate whether or not this stream
// contains buffers or objects.
-
this.objectMode = !!options.objectMode;
- if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode; // the point at which write() starts returning false
+
+ if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode;
+
+ // the point at which write() starts returning false
// Note: 0 is a valid value, means that we always return false if
// the entire buffer is not flushed immediately on write()
+ var hwm = options.highWaterMark;
+ var writableHwm = options.writableHighWaterMark;
+ var defaultHwm = this.objectMode ? 16 : 16 * 1024;
- this.highWaterMark = getHighWaterMark(this, options, 'writableHighWaterMark', isDuplex); // if _final has been called
-
- this.finalCalled = false; // drain event flag.
+ if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (writableHwm || writableHwm === 0)) this.highWaterMark = writableHwm;else this.highWaterMark = defaultHwm;
- this.needDrain = false; // at the start of calling end()
+ // cast to ints.
+ this.highWaterMark = Math.floor(this.highWaterMark);
- this.ending = false; // when end() has been called, and returned
+ // if _final has been called
+ this.finalCalled = false;
- this.ended = false; // when 'finish' is emitted
+ // drain event flag.
+ this.needDrain = false;
+ // at the start of calling end()
+ this.ending = false;
+ // when end() has been called, and returned
+ this.ended = false;
+ // when 'finish' is emitted
+ this.finished = false;
- this.finished = false; // has it been destroyed
+ // has it been destroyed
+ this.destroyed = false;
- this.destroyed = false; // should we decode strings into buffers before passing to _write?
+ // should we decode strings into buffers before passing to _write?
// this is here so that some node-core streams can optimize string
// handling at a lower level.
-
var noDecode = options.decodeStrings === false;
- this.decodeStrings = !noDecode; // Crypto is kind of old and crusty. Historically, its default string
+ this.decodeStrings = !noDecode;
+
+ // Crypto is kind of old and crusty. Historically, its default string
// encoding is 'binary' so we have to make this configurable.
// Everything else in the universe uses 'utf8', though.
+ this.defaultEncoding = options.defaultEncoding || 'utf8';
- this.defaultEncoding = options.defaultEncoding || 'utf8'; // not an actual buffer we keep track of, but a measurement
+ // not an actual buffer we keep track of, but a measurement
// of how much we're waiting to get pushed to some underlying
// socket or file.
+ this.length = 0;
- this.length = 0; // a flag to see when we're in the middle of a write.
+ // a flag to see when we're in the middle of a write.
+ this.writing = false;
- this.writing = false; // when true all writes will be buffered until .uncork() call
+ // when true all writes will be buffered until .uncork() call
+ this.corked = 0;
- this.corked = 0; // a flag to be able to tell if the onwrite cb is called immediately,
+ // a flag to be able to tell if the onwrite cb is called immediately,
// or on a later tick. We set this to true at first, because any
// actions that shouldn't happen until "later" should generally also
// not happen before the first write call.
+ this.sync = true;
- this.sync = true; // a flag to know if we're processing previously buffered items, which
+ // a flag to know if we're processing previously buffered items, which
// may call the _write() callback in the same tick, so that we don't
// end up in an overlapped onwrite situation.
+ this.bufferProcessing = false;
- this.bufferProcessing = false; // the callback that's passed to _write(chunk,cb)
-
+ // the callback that's passed to _write(chunk,cb)
this.onwrite = function (er) {
onwrite(stream, er);
- }; // the callback that the user supplies to write(chunk,encoding,cb)
-
+ };
- this.writecb = null; // the amount that is being written when _write is called.
+ // the callback that the user supplies to write(chunk,encoding,cb)
+ this.writecb = null;
+ // the amount that is being written when _write is called.
this.writelen = 0;
+
this.bufferedRequest = null;
- this.lastBufferedRequest = null; // number of pending user-supplied write callbacks
+ this.lastBufferedRequest = null;
+
+ // number of pending user-supplied write callbacks
// this must be 0 before 'finish' can be emitted
+ this.pendingcb = 0;
- this.pendingcb = 0; // emit prefinish if the only thing we're waiting for is _write cbs
+ // emit prefinish if the only thing we're waiting for is _write cbs
// This is relevant for synchronous Transform streams
+ this.prefinished = false;
- this.prefinished = false; // True if the error was already emitted and should not be thrown again
+ // True if the error was already emitted and should not be thrown again
+ this.errorEmitted = false;
- this.errorEmitted = false; // Should close be emitted on destroy. Defaults to true.
+ // count buffered requests
+ this.bufferedRequestCount = 0;
- this.emitClose = options.emitClose !== false; // Should .destroy() be called after 'finish' (and potentially 'end')
-
- this.autoDestroy = !!options.autoDestroy; // count buffered requests
-
- this.bufferedRequestCount = 0; // allocate the first CorkedRequest, there is always
+ // allocate the first CorkedRequest, there is always
// one allocated and free to use, and we maintain at most two
-
this.corkedRequestsFree = new CorkedRequest(this);
}
WritableState.prototype.getBuffer = function getBuffer() {
var current = this.bufferedRequest;
var out = [];
-
while (current) {
out.push(current);
current = current.next;
}
-
return out;
};
(function () {
try {
Object.defineProperty(WritableState.prototype, 'buffer', {
- get: internalUtil.deprecate(function writableStateBufferGetter() {
+ get: internalUtil.deprecate(function () {
return this.getBuffer();
}, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003')
});
} catch (_) {}
-})(); // Test _writableState for inheritance to account for Duplex streams,
-// whose prototype chain only points to Readable.
-
+})();
+// Test _writableState for inheritance to account for Duplex streams,
+// whose prototype chain only points to Readable.
var realHasInstance;
-
if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {
realHasInstance = Function.prototype[Symbol.hasInstance];
Object.defineProperty(Writable, Symbol.hasInstance, {
- value: function value(object) {
+ value: function (object) {
if (realHasInstance.call(this, object)) return true;
if (this !== Writable) return false;
+
return object && object._writableState instanceof WritableState;
}
});
} else {
- realHasInstance = function realHasInstance(object) {
+ realHasInstance = function (object) {
return object instanceof this;
};
}
function Writable(options) {
- Duplex = Duplex || require('./_stream_duplex'); // Writable ctor is applied to Duplexes, too.
+ Duplex = Duplex || require('./_stream_duplex');
+
+ // Writable ctor is applied to Duplexes, too.
// `realHasInstance` is necessary because using plain `instanceof`
// would return false, as no `_writableState` property is attached.
+
// Trying to use the custom `instanceof` for Writable here will also break the
// Node.js LazyTransform implementation, which has a non-trivial getter for
// `_writableState` that would lead to infinite recursion.
- // Checking for a Stream.Duplex instance is faster here instead of inside
- // the WritableState constructor, at least with V8 6.5
+ if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) {
+ return new Writable(options);
+ }
- var isDuplex = this instanceof Duplex;
- if (!isDuplex && !realHasInstance.call(Writable, this)) return new Writable(options);
- this._writableState = new WritableState(options, this, isDuplex); // legacy.
+ this._writableState = new WritableState(options, this);
+ // legacy.
this.writable = true;
if (options) {
if (typeof options.write === 'function') this._write = options.write;
+
if (typeof options.writev === 'function') this._writev = options.writev;
+
if (typeof options.destroy === 'function') this._destroy = options.destroy;
+
if (typeof options.final === 'function') this._final = options.final;
}
Stream.call(this);
-} // Otherwise people can pipe Writable streams, which is just wrong.
-
+}
+// Otherwise people can pipe Writable streams, which is just wrong.
Writable.prototype.pipe = function () {
- errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE());
+ this.emit('error', new Error('Cannot pipe, not readable'));
};
function writeAfterEnd(stream, cb) {
- var er = new ERR_STREAM_WRITE_AFTER_END(); // TODO: defer error events consistently everywhere, not just the cb
+ var er = new Error('write after end');
+ // TODO: defer error events consistently everywhere, not just the cb
+ stream.emit('error', er);
+ pna.nextTick(cb, er);
+}
- errorOrDestroy(stream, er);
- process.nextTick(cb, er);
-} // Checks that a user-supplied chunk is valid, especially for the particular
+// Checks that a user-supplied chunk is valid, especially for the particular
// mode the stream is in. Currently this means that `null` is never accepted
// and undefined/non-string values are only allowed in object mode.
-
-
function validChunk(stream, state, chunk, cb) {
- var er;
+ var valid = true;
+ var er = false;
if (chunk === null) {
- er = new ERR_STREAM_NULL_VALUES();
- } else if (typeof chunk !== 'string' && !state.objectMode) {
- er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer'], chunk);
+ er = new TypeError('May not write null values to stream');
+ } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
+ er = new TypeError('Invalid non-string/buffer chunk');
}
-
if (er) {
- errorOrDestroy(stream, er);
- process.nextTick(cb, er);
- return false;
+ stream.emit('error', er);
+ pna.nextTick(cb, er);
+ valid = false;
}
-
- return true;
+ return valid;
}
Writable.prototype.write = function (chunk, encoding, cb) {
var state = this._writableState;
var ret = false;
-
var isBuf = !state.objectMode && _isUint8Array(chunk);
if (isBuf && !Buffer.isBuffer(chunk)) {
@@ -301,16 +326,21 @@ Writable.prototype.write = function (chunk, encoding, cb) {
}
if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;
+
if (typeof cb !== 'function') cb = nop;
- if (state.ending) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {
+
+ if (state.ended) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {
state.pendingcb++;
ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);
}
+
return ret;
};
Writable.prototype.cork = function () {
- this._writableState.corked++;
+ var state = this._writableState;
+
+ state.corked++;
};
Writable.prototype.uncork = function () {
@@ -318,33 +348,23 @@ Writable.prototype.uncork = function () {
if (state.corked) {
state.corked--;
- if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
+
+ if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
}
};
Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
// node::ParseEncoding() requires lower case.
if (typeof encoding === 'string') encoding = encoding.toLowerCase();
- if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new ERR_UNKNOWN_ENCODING(encoding);
+ 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);
this._writableState.defaultEncoding = encoding;
return this;
};
-Object.defineProperty(Writable.prototype, 'writableBuffer', {
- // making it explicit this property is not enumerable
- // because otherwise some prototype manipulation in
- // userland will fail
- enumerable: false,
- get: function get() {
- return this._writableState && this._writableState.getBuffer();
- }
-});
-
function decodeChunk(state, chunk, encoding) {
if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {
chunk = Buffer.from(chunk, encoding);
}
-
return chunk;
}
@@ -353,28 +373,29 @@ Object.defineProperty(Writable.prototype, 'writableHighWaterMark', {
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
- get: function get() {
+ get: function () {
return this._writableState.highWaterMark;
}
-}); // if we're already writing something, then just put this
+});
+
+// if we're already writing something, then just put this
// in the queue, and wait our turn. Otherwise, call _write
// If we return false, then we need a drain event, so set that flag.
-
function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {
if (!isBuf) {
var newChunk = decodeChunk(state, chunk, encoding);
-
if (chunk !== newChunk) {
isBuf = true;
encoding = 'buffer';
chunk = newChunk;
}
}
-
var len = state.objectMode ? 1 : chunk.length;
+
state.length += len;
- var ret = state.length < state.highWaterMark; // we must ensure that previous needDrain will not be reset to false.
+ var ret = state.length < state.highWaterMark;
+ // we must ensure that previous needDrain will not be reset to false.
if (!ret) state.needDrain = true;
if (state.writing || state.corked) {
@@ -386,13 +407,11 @@ function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {
callback: cb,
next: null
};
-
if (last) {
last.next = state.lastBufferedRequest;
} else {
state.bufferedRequest = state.lastBufferedRequest;
}
-
state.bufferedRequestCount += 1;
} else {
doWrite(stream, state, false, len, chunk, encoding, cb);
@@ -406,7 +425,7 @@ function doWrite(stream, state, writev, len, chunk, encoding, cb) {
state.writecb = cb;
state.writing = true;
state.sync = true;
- if (state.destroyed) state.onwrite(new ERR_STREAM_DESTROYED('write'));else if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);
+ if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);
state.sync = false;
}
@@ -416,20 +435,20 @@ function onwriteError(stream, state, sync, er, cb) {
if (sync) {
// defer the callback if we are being called synchronously
// to avoid piling up things on the stack
- process.nextTick(cb, er); // this can emit finish, and it will always happen
+ pna.nextTick(cb, er);
+ // this can emit finish, and it will always happen
// after error
-
- process.nextTick(finishMaybe, stream, state);
+ pna.nextTick(finishMaybe, stream, state);
stream._writableState.errorEmitted = true;
- errorOrDestroy(stream, er);
+ stream.emit('error', er);
} else {
// the caller expect this to happen before if
// it is async
cb(er);
stream._writableState.errorEmitted = true;
- errorOrDestroy(stream, er); // this can emit finish, but finish must
+ stream.emit('error', er);
+ // this can emit finish, but finish must
// always follow error
-
finishMaybe(stream, state);
}
}
@@ -445,18 +464,21 @@ function onwrite(stream, er) {
var state = stream._writableState;
var sync = state.sync;
var cb = state.writecb;
- if (typeof cb !== 'function') throw new ERR_MULTIPLE_CALLBACK();
+
onwriteStateUpdate(state);
+
if (er) onwriteError(stream, state, sync, er, cb);else {
// Check if we're actually ready to finish, but don't emit yet
- var finished = needFinish(state) || stream.destroyed;
+ var finished = needFinish(state);
if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
clearBuffer(stream, state);
}
if (sync) {
- process.nextTick(afterWrite, stream, state, finished, cb);
+ /*<replacement>*/
+ asyncWrite(afterWrite, stream, state, finished, cb);
+ /*</replacement>*/
} else {
afterWrite(stream, state, finished, cb);
}
@@ -468,19 +490,19 @@ function afterWrite(stream, state, finished, cb) {
state.pendingcb--;
cb();
finishMaybe(stream, state);
-} // Must force callback to be called on nextTick, so that we don't
+}
+
+// Must force callback to be called on nextTick, so that we don't
// emit 'drain' before the write() consumer gets the 'false' return
// value, and has a chance to attach a 'drain' listener.
-
-
function onwriteDrain(stream, state) {
if (state.length === 0 && state.needDrain) {
state.needDrain = false;
stream.emit('drain');
}
-} // if there's something in the buffer waiting, then process it
-
+}
+// if there's something in the buffer waiting, then process it
function clearBuffer(stream, state) {
state.bufferProcessing = true;
var entry = state.bufferedRequest;
@@ -491,30 +513,29 @@ function clearBuffer(stream, state) {
var buffer = new Array(l);
var holder = state.corkedRequestsFree;
holder.entry = entry;
+
var count = 0;
var allBuffers = true;
-
while (entry) {
buffer[count] = entry;
if (!entry.isBuf) allBuffers = false;
entry = entry.next;
count += 1;
}
-
buffer.allBuffers = allBuffers;
- doWrite(stream, state, true, state.length, buffer, '', holder.finish); // doWrite is almost always async, defer these to save a bit of time
- // as the hot path ends with doWrite
+ doWrite(stream, state, true, state.length, buffer, '', holder.finish);
+
+ // doWrite is almost always async, defer these to save a bit of time
+ // as the hot path ends with doWrite
state.pendingcb++;
state.lastBufferedRequest = null;
-
if (holder.next) {
state.corkedRequestsFree = holder.next;
holder.next = null;
} else {
state.corkedRequestsFree = new CorkedRequest(state);
}
-
state.bufferedRequestCount = 0;
} else {
// Slow case, write chunks one-by-one
@@ -523,13 +544,14 @@ function clearBuffer(stream, state) {
var encoding = entry.encoding;
var cb = entry.callback;
var len = state.objectMode ? 1 : chunk.length;
+
doWrite(stream, state, false, len, chunk, encoding, cb);
entry = entry.next;
- state.bufferedRequestCount--; // if we didn't call the onwrite immediately, then
+ state.bufferedRequestCount--;
+ // if we didn't call the onwrite immediately, then
// it means that we need to wait until it does.
// also, that means that the chunk and cb are currently
// being processed, so move the buffer counter past them.
-
if (state.writing) {
break;
}
@@ -543,7 +565,7 @@ function clearBuffer(stream, state) {
}
Writable.prototype._write = function (chunk, encoding, cb) {
- cb(new ERR_METHOD_NOT_IMPLEMENTED('_write()'));
+ cb(new Error('_write() is not implemented'));
};
Writable.prototype._writev = null;
@@ -560,52 +582,38 @@ Writable.prototype.end = function (chunk, encoding, cb) {
encoding = null;
}
- if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); // .end() fully uncorks
+ if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);
+ // .end() fully uncorks
if (state.corked) {
state.corked = 1;
this.uncork();
- } // ignore unnecessary end() calls.
-
+ }
- if (!state.ending) endWritable(this, state, cb);
- return this;
+ // ignore unnecessary end() calls.
+ if (!state.ending && !state.finished) endWritable(this, state, cb);
};
-Object.defineProperty(Writable.prototype, 'writableLength', {
- // making it explicit this property is not enumerable
- // because otherwise some prototype manipulation in
- // userland will fail
- enumerable: false,
- get: function get() {
- return this._writableState.length;
- }
-});
-
function needFinish(state) {
return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
}
-
function callFinal(stream, state) {
stream._final(function (err) {
state.pendingcb--;
-
if (err) {
- errorOrDestroy(stream, err);
+ stream.emit('error', err);
}
-
state.prefinished = true;
stream.emit('prefinish');
finishMaybe(stream, state);
});
}
-
function prefinish(stream, state) {
if (!state.prefinished && !state.finalCalled) {
- if (typeof stream._final === 'function' && !state.destroyed) {
+ if (typeof stream._final === 'function') {
state.pendingcb++;
state.finalCalled = true;
- process.nextTick(callFinal, stream, state);
+ pna.nextTick(callFinal, stream, state);
} else {
state.prefinished = true;
stream.emit('prefinish');
@@ -615,37 +623,22 @@ function prefinish(stream, state) {
function finishMaybe(stream, state) {
var need = needFinish(state);
-
if (need) {
prefinish(stream, state);
-
if (state.pendingcb === 0) {
state.finished = true;
stream.emit('finish');
-
- if (state.autoDestroy) {
- // In case of duplex streams we need a way to detect
- // if the readable side is ready for autoDestroy as well
- var rState = stream._readableState;
-
- if (!rState || rState.autoDestroy && rState.endEmitted) {
- stream.destroy();
- }
- }
}
}
-
return need;
}
function endWritable(stream, state, cb) {
state.ending = true;
finishMaybe(stream, state);
-
if (cb) {
- if (state.finished) process.nextTick(cb);else stream.once('finish', cb);
+ if (state.finished) pna.nextTick(cb);else stream.once('finish', cb);
}
-
state.ended = true;
stream.writable = false;
}
@@ -653,45 +646,42 @@ function endWritable(stream, state, cb) {
function onCorkedFinish(corkReq, state, err) {
var entry = corkReq.entry;
corkReq.entry = null;
-
while (entry) {
var cb = entry.callback;
state.pendingcb--;
cb(err);
entry = entry.next;
- } // reuse the free corkReq.
-
-
- state.corkedRequestsFree.next = corkReq;
+ }
+ if (state.corkedRequestsFree) {
+ state.corkedRequestsFree.next = corkReq;
+ } else {
+ state.corkedRequestsFree = corkReq;
+ }
}
Object.defineProperty(Writable.prototype, 'destroyed', {
- // making it explicit this property is not enumerable
- // because otherwise some prototype manipulation in
- // userland will fail
- enumerable: false,
- get: function get() {
+ get: function () {
if (this._writableState === undefined) {
return false;
}
-
return this._writableState.destroyed;
},
- set: function set(value) {
+ set: function (value) {
// we ignore the value if the stream
// has not been initialized yet
if (!this._writableState) {
return;
- } // backward compatibility, the user is explicitly
- // managing destroyed
-
+ }
+ // backward compatibility, the user is explicitly
+ // managing destroyed
this._writableState.destroyed = value;
}
});
+
Writable.prototype.destroy = destroyImpl.destroy;
Writable.prototype._undestroy = destroyImpl.undestroy;
-
Writable.prototype._destroy = function (err, cb) {
+ this.end();
cb(err);
}; \ No newline at end of file
diff --git a/deps/npm/node_modules/readable-stream/lib/internal/streams/BufferList.js b/deps/npm/node_modules/readable-stream/lib/internal/streams/BufferList.js
new file mode 100644
index 0000000000..aefc68bd90
--- /dev/null
+++ b/deps/npm/node_modules/readable-stream/lib/internal/streams/BufferList.js
@@ -0,0 +1,79 @@
+'use strict';
+
+function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+var Buffer = require('safe-buffer').Buffer;
+var util = require('util');
+
+function copyBuffer(src, target, offset) {
+ src.copy(target, offset);
+}
+
+module.exports = function () {
+ function BufferList() {
+ _classCallCheck(this, BufferList);
+
+ this.head = null;
+ this.tail = null;
+ this.length = 0;
+ }
+
+ BufferList.prototype.push = function push(v) {
+ var entry = { data: v, next: null };
+ if (this.length > 0) this.tail.next = entry;else this.head = entry;
+ this.tail = entry;
+ ++this.length;
+ };
+
+ BufferList.prototype.unshift = function unshift(v) {
+ var entry = { data: v, next: this.head };
+ if (this.length === 0) this.tail = entry;
+ this.head = entry;
+ ++this.length;
+ };
+
+ BufferList.prototype.shift = function shift() {
+ if (this.length === 0) return;
+ var ret = this.head.data;
+ if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;
+ --this.length;
+ return ret;
+ };
+
+ BufferList.prototype.clear = function clear() {
+ this.head = this.tail = null;
+ this.length = 0;
+ };
+
+ BufferList.prototype.join = function join(s) {
+ if (this.length === 0) return '';
+ var p = this.head;
+ var ret = '' + p.data;
+ while (p = p.next) {
+ ret += s + p.data;
+ }return ret;
+ };
+
+ BufferList.prototype.concat = function concat(n) {
+ if (this.length === 0) return Buffer.alloc(0);
+ if (this.length === 1) return this.head.data;
+ var ret = Buffer.allocUnsafe(n >>> 0);
+ var p = this.head;
+ var i = 0;
+ while (p) {
+ copyBuffer(p.data, ret, i);
+ i += p.data.length;
+ p = p.next;
+ }
+ return ret;
+ };
+
+ return BufferList;
+}();
+
+if (util && util.inspect && util.inspect.custom) {
+ module.exports.prototype[util.inspect.custom] = function () {
+ var obj = util.inspect({ length: this.length });
+ return this.constructor.name + ' ' + obj;
+ };
+} \ No newline at end of file
diff --git a/deps/npm/node_modules/readable-stream/lib/internal/streams/async_iterator.js b/deps/npm/node_modules/readable-stream/lib/internal/streams/async_iterator.js
deleted file mode 100644
index 9fb615a2f3..0000000000
--- a/deps/npm/node_modules/readable-stream/lib/internal/streams/async_iterator.js
+++ /dev/null
@@ -1,207 +0,0 @@
-'use strict';
-
-var _Object$setPrototypeO;
-
-function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
-
-var finished = require('./end-of-stream');
-
-var kLastResolve = Symbol('lastResolve');
-var kLastReject = Symbol('lastReject');
-var kError = Symbol('error');
-var kEnded = Symbol('ended');
-var kLastPromise = Symbol('lastPromise');
-var kHandlePromise = Symbol('handlePromise');
-var kStream = Symbol('stream');
-
-function createIterResult(value, done) {
- return {
- value: value,
- done: done
- };
-}
-
-function readAndResolve(iter) {
- var resolve = iter[kLastResolve];
-
- if (resolve !== null) {
- var data = iter[kStream].read(); // we defer if data is null
- // we can be expecting either 'end' or
- // 'error'
-
- if (data !== null) {
- iter[kLastPromise] = null;
- iter[kLastResolve] = null;
- iter[kLastReject] = null;
- resolve(createIterResult(data, false));
- }
- }
-}
-
-function onReadable(iter) {
- // we wait for the next tick, because it might
- // emit an error with process.nextTick
- process.nextTick(readAndResolve, iter);
-}
-
-function wrapForNext(lastPromise, iter) {
- return function (resolve, reject) {
- lastPromise.then(function () {
- if (iter[kEnded]) {
- resolve(createIterResult(undefined, true));
- return;
- }
-
- iter[kHandlePromise](resolve, reject);
- }, reject);
- };
-}
-
-var AsyncIteratorPrototype = Object.getPrototypeOf(function () {});
-var ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = {
- get stream() {
- return this[kStream];
- },
-
- next: function next() {
- var _this = this;
-
- // if we have detected an error in the meanwhile
- // reject straight away
- var error = this[kError];
-
- if (error !== null) {
- return Promise.reject(error);
- }
-
- if (this[kEnded]) {
- return Promise.resolve(createIterResult(undefined, true));
- }
-
- if (this[kStream].destroyed) {
- // We need to defer via nextTick because if .destroy(err) is
- // called, the error will be emitted via nextTick, and
- // we cannot guarantee that there is no error lingering around
- // waiting to be emitted.
- return new Promise(function (resolve, reject) {
- process.nextTick(function () {
- if (_this[kError]) {
- reject(_this[kError]);
- } else {
- resolve(createIterResult(undefined, true));
- }
- });
- });
- } // if we have multiple next() calls
- // we will wait for the previous Promise to finish
- // this logic is optimized to support for await loops,
- // where next() is only called once at a time
-
-
- var lastPromise = this[kLastPromise];
- var promise;
-
- if (lastPromise) {
- promise = new Promise(wrapForNext(lastPromise, this));
- } else {
- // fast path needed to support multiple this.push()
- // without triggering the next() queue
- var data = this[kStream].read();
-
- if (data !== null) {
- return Promise.resolve(createIterResult(data, false));
- }
-
- promise = new Promise(this[kHandlePromise]);
- }
-
- this[kLastPromise] = promise;
- return promise;
- }
-}, _defineProperty(_Object$setPrototypeO, Symbol.asyncIterator, function () {
- return this;
-}), _defineProperty(_Object$setPrototypeO, "return", function _return() {
- var _this2 = this;
-
- // destroy(err, cb) is a private API
- // we can guarantee we have that here, because we control the
- // Readable class this is attached to
- return new Promise(function (resolve, reject) {
- _this2[kStream].destroy(null, function (err) {
- if (err) {
- reject(err);
- return;
- }
-
- resolve(createIterResult(undefined, true));
- });
- });
-}), _Object$setPrototypeO), AsyncIteratorPrototype);
-
-var createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator(stream) {
- var _Object$create;
-
- var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, {
- value: stream,
- writable: true
- }), _defineProperty(_Object$create, kLastResolve, {
- value: null,
- writable: true
- }), _defineProperty(_Object$create, kLastReject, {
- value: null,
- writable: true
- }), _defineProperty(_Object$create, kError, {
- value: null,
- writable: true
- }), _defineProperty(_Object$create, kEnded, {
- value: stream._readableState.endEmitted,
- writable: true
- }), _defineProperty(_Object$create, kHandlePromise, {
- value: function value(resolve, reject) {
- var data = iterator[kStream].read();
-
- if (data) {
- iterator[kLastPromise] = null;
- iterator[kLastResolve] = null;
- iterator[kLastReject] = null;
- resolve(createIterResult(data, false));
- } else {
- iterator[kLastResolve] = resolve;
- iterator[kLastReject] = reject;
- }
- },
- writable: true
- }), _Object$create));
- iterator[kLastPromise] = null;
- finished(stream, function (err) {
- if (err && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') {
- var reject = iterator[kLastReject]; // reject if we are waiting for data in the Promise
- // returned by next() and store the error
-
- if (reject !== null) {
- iterator[kLastPromise] = null;
- iterator[kLastResolve] = null;
- iterator[kLastReject] = null;
- reject(err);
- }
-
- iterator[kError] = err;
- return;
- }
-
- var resolve = iterator[kLastResolve];
-
- if (resolve !== null) {
- iterator[kLastPromise] = null;
- iterator[kLastResolve] = null;
- iterator[kLastReject] = null;
- resolve(createIterResult(undefined, true));
- }
-
- iterator[kEnded] = true;
- });
- stream.on('readable', onReadable.bind(null, iterator));
- return iterator;
-};
-
-module.exports = createReadableStreamAsyncIterator; \ No newline at end of file
diff --git a/deps/npm/node_modules/readable-stream/lib/internal/streams/buffer_list.js b/deps/npm/node_modules/readable-stream/lib/internal/streams/buffer_list.js
deleted file mode 100644
index cdea425f19..0000000000
--- a/deps/npm/node_modules/readable-stream/lib/internal/streams/buffer_list.js
+++ /dev/null
@@ -1,210 +0,0 @@
-'use strict';
-
-function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
-
-function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
-
-function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
-
-function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } }
-
-function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
-
-var _require = require('buffer'),
- Buffer = _require.Buffer;
-
-var _require2 = require('util'),
- inspect = _require2.inspect;
-
-var custom = inspect && inspect.custom || 'inspect';
-
-function copyBuffer(src, target, offset) {
- Buffer.prototype.copy.call(src, target, offset);
-}
-
-module.exports =
-/*#__PURE__*/
-function () {
- function BufferList() {
- _classCallCheck(this, BufferList);
-
- this.head = null;
- this.tail = null;
- this.length = 0;
- }
-
- _createClass(BufferList, [{
- key: "push",
- value: function push(v) {
- var entry = {
- data: v,
- next: null
- };
- if (this.length > 0) this.tail.next = entry;else this.head = entry;
- this.tail = entry;
- ++this.length;
- }
- }, {
- key: "unshift",
- value: function unshift(v) {
- var entry = {
- data: v,
- next: this.head
- };
- if (this.length === 0) this.tail = entry;
- this.head = entry;
- ++this.length;
- }
- }, {
- key: "shift",
- value: function shift() {
- if (this.length === 0) return;
- var ret = this.head.data;
- if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;
- --this.length;
- return ret;
- }
- }, {
- key: "clear",
- value: function clear() {
- this.head = this.tail = null;
- this.length = 0;
- }
- }, {
- key: "join",
- value: function join(s) {
- if (this.length === 0) return '';
- var p = this.head;
- var ret = '' + p.data;
-
- while (p = p.next) {
- ret += s + p.data;
- }
-
- return ret;
- }
- }, {
- key: "concat",
- value: function concat(n) {
- if (this.length === 0) return Buffer.alloc(0);
- var ret = Buffer.allocUnsafe(n >>> 0);
- var p = this.head;
- var i = 0;
-
- while (p) {
- copyBuffer(p.data, ret, i);
- i += p.data.length;
- p = p.next;
- }
-
- return ret;
- } // Consumes a specified amount of bytes or characters from the buffered data.
-
- }, {
- key: "consume",
- value: function consume(n, hasStrings) {
- var ret;
-
- if (n < this.head.data.length) {
- // `slice` is the same for buffers and strings.
- ret = this.head.data.slice(0, n);
- this.head.data = this.head.data.slice(n);
- } else if (n === this.head.data.length) {
- // First chunk is a perfect match.
- ret = this.shift();
- } else {
- // Result spans more than one buffer.
- ret = hasStrings ? this._getString(n) : this._getBuffer(n);
- }
-
- return ret;
- }
- }, {
- key: "first",
- value: function first() {
- return this.head.data;
- } // Consumes a specified amount of characters from the buffered data.
-
- }, {
- key: "_getString",
- value: function _getString(n) {
- var p = this.head;
- var c = 1;
- var ret = p.data;
- n -= ret.length;
-
- while (p = p.next) {
- var str = p.data;
- var nb = n > str.length ? str.length : n;
- if (nb === str.length) ret += str;else ret += str.slice(0, n);
- n -= nb;
-
- if (n === 0) {
- if (nb === str.length) {
- ++c;
- if (p.next) this.head = p.next;else this.head = this.tail = null;
- } else {
- this.head = p;
- p.data = str.slice(nb);
- }
-
- break;
- }
-
- ++c;
- }
-
- this.length -= c;
- return ret;
- } // Consumes a specified amount of bytes from the buffered data.
-
- }, {
- key: "_getBuffer",
- value: function _getBuffer(n) {
- var ret = Buffer.allocUnsafe(n);
- var p = this.head;
- var c = 1;
- p.data.copy(ret);
- n -= p.data.length;
-
- while (p = p.next) {
- var buf = p.data;
- var nb = n > buf.length ? buf.length : n;
- buf.copy(ret, ret.length - n, 0, nb);
- n -= nb;
-
- if (n === 0) {
- if (nb === buf.length) {
- ++c;
- if (p.next) this.head = p.next;else this.head = this.tail = null;
- } else {
- this.head = p;
- p.data = buf.slice(nb);
- }
-
- break;
- }
-
- ++c;
- }
-
- this.length -= c;
- return ret;
- } // Make sure the linked list only shows the minimal necessary information.
-
- }, {
- key: custom,
- value: function value(_, options) {
- return inspect(this, _objectSpread({}, options, {
- // Only inspect one level.
- depth: 0,
- // It should not recurse.
- customInspect: false
- }));
- }
- }]);
-
- return BufferList;
-}(); \ No newline at end of file
diff --git a/deps/npm/node_modules/readable-stream/lib/internal/streams/destroy.js b/deps/npm/node_modules/readable-stream/lib/internal/streams/destroy.js
index 3268a16f3b..5a0a0d88ce 100644
--- a/deps/npm/node_modules/readable-stream/lib/internal/streams/destroy.js
+++ b/deps/npm/node_modules/readable-stream/lib/internal/streams/destroy.js
@@ -1,5 +1,11 @@
-'use strict'; // undocumented cb() API, needed for core, not for public API
+'use strict';
+/*<replacement>*/
+
+var pna = require('process-nextick-args');
+/*</replacement>*/
+
+// undocumented cb() API, needed for core, not for public API
function destroy(err, cb) {
var _this = this;
@@ -9,61 +15,38 @@ function destroy(err, cb) {
if (readableDestroyed || writableDestroyed) {
if (cb) {
cb(err);
- } else if (err) {
- if (!this._writableState) {
- process.nextTick(emitErrorNT, this, err);
- } else if (!this._writableState.errorEmitted) {
- this._writableState.errorEmitted = true;
- process.nextTick(emitErrorNT, this, err);
- }
+ } else if (err && (!this._writableState || !this._writableState.errorEmitted)) {
+ pna.nextTick(emitErrorNT, this, err);
}
-
return this;
- } // we set destroyed to true before firing error callbacks in order
- // to make it re-entrance safe in case destroy() is called within callbacks
+ }
+ // we set destroyed to true before firing error callbacks in order
+ // to make it re-entrance safe in case destroy() is called within callbacks
if (this._readableState) {
this._readableState.destroyed = true;
- } // if this is a duplex stream mark the writable part as destroyed as well
-
+ }
+ // if this is a duplex stream mark the writable part as destroyed as well
if (this._writableState) {
this._writableState.destroyed = true;
}
this._destroy(err || null, function (err) {
if (!cb && err) {
- if (!_this._writableState) {
- process.nextTick(emitErrorAndCloseNT, _this, err);
- } else if (!_this._writableState.errorEmitted) {
+ pna.nextTick(emitErrorNT, _this, err);
+ if (_this._writableState) {
_this._writableState.errorEmitted = true;
- process.nextTick(emitErrorAndCloseNT, _this, err);
- } else {
- process.nextTick(emitCloseNT, _this);
}
} else if (cb) {
- process.nextTick(emitCloseNT, _this);
cb(err);
- } else {
- process.nextTick(emitCloseNT, _this);
}
});
return this;
}
-function emitErrorAndCloseNT(self, err) {
- emitErrorNT(self, err);
- emitCloseNT(self);
-}
-
-function emitCloseNT(self) {
- if (self._writableState && !self._writableState.emitClose) return;
- if (self._readableState && !self._readableState.emitClose) return;
- self.emit('close');
-}
-
function undestroy() {
if (this._readableState) {
this._readableState.destroyed = false;
@@ -76,8 +59,6 @@ function undestroy() {
this._writableState.destroyed = false;
this._writableState.ended = false;
this._writableState.ending = false;
- this._writableState.finalCalled = false;
- this._writableState.prefinished = false;
this._writableState.finished = false;
this._writableState.errorEmitted = false;
}
@@ -87,19 +68,7 @@ function emitErrorNT(self, err) {
self.emit('error', err);
}
-function errorOrDestroy(stream, err) {
- // We have tests that rely on errors being emitted
- // in the same tick, so changing this is semver major.
- // For now when you opt-in to autoDestroy we allow
- // the error to be emitted nextTick. In a future
- // semver major update we should change the default to this.
- var rState = stream._readableState;
- var wState = stream._writableState;
- if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err);
-}
-
module.exports = {
destroy: destroy,
- undestroy: undestroy,
- errorOrDestroy: errorOrDestroy
+ undestroy: undestroy
}; \ No newline at end of file
diff --git a/deps/npm/node_modules/readable-stream/lib/internal/streams/end-of-stream.js b/deps/npm/node_modules/readable-stream/lib/internal/streams/end-of-stream.js
deleted file mode 100644
index 831f286d98..0000000000
--- a/deps/npm/node_modules/readable-stream/lib/internal/streams/end-of-stream.js
+++ /dev/null
@@ -1,104 +0,0 @@
-// Ported from https://github.com/mafintosh/end-of-stream with
-// permission from the author, Mathias Buus (@mafintosh).
-'use strict';
-
-var ERR_STREAM_PREMATURE_CLOSE = require('../../../errors').codes.ERR_STREAM_PREMATURE_CLOSE;
-
-function once(callback) {
- var called = false;
- return function () {
- if (called) return;
- called = true;
-
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
- args[_key] = arguments[_key];
- }
-
- callback.apply(this, args);
- };
-}
-
-function noop() {}
-
-function isRequest(stream) {
- return stream.setHeader && typeof stream.abort === 'function';
-}
-
-function eos(stream, opts, callback) {
- if (typeof opts === 'function') return eos(stream, null, opts);
- if (!opts) opts = {};
- callback = once(callback || noop);
- var readable = opts.readable || opts.readable !== false && stream.readable;
- var writable = opts.writable || opts.writable !== false && stream.writable;
-
- var onlegacyfinish = function onlegacyfinish() {
- if (!stream.writable) onfinish();
- };
-
- var writableEnded = stream._writableState && stream._writableState.finished;
-
- var onfinish = function onfinish() {
- writable = false;
- writableEnded = true;
- if (!readable) callback.call(stream);
- };
-
- var readableEnded = stream._readableState && stream._readableState.endEmitted;
-
- var onend = function onend() {
- readable = false;
- readableEnded = true;
- if (!writable) callback.call(stream);
- };
-
- var onerror = function onerror(err) {
- callback.call(stream, err);
- };
-
- var onclose = function onclose() {
- var err;
-
- if (readable && !readableEnded) {
- if (!stream._readableState || !stream._readableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE();
- return callback.call(stream, err);
- }
-
- if (writable && !writableEnded) {
- if (!stream._writableState || !stream._writableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE();
- return callback.call(stream, err);
- }
- };
-
- var onrequest = function onrequest() {
- stream.req.on('finish', onfinish);
- };
-
- if (isRequest(stream)) {
- stream.on('complete', onfinish);
- stream.on('abort', onclose);
- if (stream.req) onrequest();else stream.on('request', onrequest);
- } else if (writable && !stream._writableState) {
- // legacy streams
- stream.on('end', onlegacyfinish);
- stream.on('close', onlegacyfinish);
- }
-
- stream.on('end', onend);
- stream.on('finish', onfinish);
- if (opts.error !== false) stream.on('error', onerror);
- stream.on('close', onclose);
- return function () {
- stream.removeListener('complete', onfinish);
- stream.removeListener('abort', onclose);
- stream.removeListener('request', onrequest);
- if (stream.req) stream.req.removeListener('finish', onfinish);
- stream.removeListener('end', onlegacyfinish);
- stream.removeListener('close', onlegacyfinish);
- stream.removeListener('finish', onfinish);
- stream.removeListener('end', onend);
- stream.removeListener('error', onerror);
- stream.removeListener('close', onclose);
- };
-}
-
-module.exports = eos; \ No newline at end of file
diff --git a/deps/npm/node_modules/readable-stream/lib/internal/streams/from-browser.js b/deps/npm/node_modules/readable-stream/lib/internal/streams/from-browser.js
deleted file mode 100644
index a4ce56f3c9..0000000000
--- a/deps/npm/node_modules/readable-stream/lib/internal/streams/from-browser.js
+++ /dev/null
@@ -1,3 +0,0 @@
-module.exports = function () {
- throw new Error('Readable.from is not available in the browser')
-};
diff --git a/deps/npm/node_modules/readable-stream/lib/internal/streams/from.js b/deps/npm/node_modules/readable-stream/lib/internal/streams/from.js
deleted file mode 100644
index 6c41284416..0000000000
--- a/deps/npm/node_modules/readable-stream/lib/internal/streams/from.js
+++ /dev/null
@@ -1,64 +0,0 @@
-'use strict';
-
-function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
-
-function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
-
-function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
-
-function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
-
-function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
-
-var ERR_INVALID_ARG_TYPE = require('../../../errors').codes.ERR_INVALID_ARG_TYPE;
-
-function from(Readable, iterable, opts) {
- var iterator;
-
- if (iterable && typeof iterable.next === 'function') {
- iterator = iterable;
- } else if (iterable && iterable[Symbol.asyncIterator]) iterator = iterable[Symbol.asyncIterator]();else if (iterable && iterable[Symbol.iterator]) iterator = iterable[Symbol.iterator]();else throw new ERR_INVALID_ARG_TYPE('iterable', ['Iterable'], iterable);
-
- var readable = new Readable(_objectSpread({
- objectMode: true
- }, opts)); // Reading boolean to protect against _read
- // being called before last iteration completion.
-
- var reading = false;
-
- readable._read = function () {
- if (!reading) {
- reading = true;
- next();
- }
- };
-
- function next() {
- return _next2.apply(this, arguments);
- }
-
- function _next2() {
- _next2 = _asyncToGenerator(function* () {
- try {
- var _ref = yield iterator.next(),
- value = _ref.value,
- done = _ref.done;
-
- if (done) {
- readable.push(null);
- } else if (readable.push((yield value))) {
- next();
- } else {
- reading = false;
- }
- } catch (err) {
- readable.destroy(err);
- }
- });
- return _next2.apply(this, arguments);
- }
-
- return readable;
-}
-
-module.exports = from; \ No newline at end of file
diff --git a/deps/npm/node_modules/readable-stream/lib/internal/streams/pipeline.js b/deps/npm/node_modules/readable-stream/lib/internal/streams/pipeline.js
deleted file mode 100644
index 6589909889..0000000000
--- a/deps/npm/node_modules/readable-stream/lib/internal/streams/pipeline.js
+++ /dev/null
@@ -1,97 +0,0 @@
-// Ported from https://github.com/mafintosh/pump with
-// permission from the author, Mathias Buus (@mafintosh).
-'use strict';
-
-var eos;
-
-function once(callback) {
- var called = false;
- return function () {
- if (called) return;
- called = true;
- callback.apply(void 0, 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;
-}
-
-function isRequest(stream) {
- return stream.setHeader && typeof stream.abort === 'function';
-}
-
-function destroyer(stream, reading, writing, callback) {
- callback = once(callback);
- var closed = false;
- stream.on('close', function () {
- closed = true;
- });
- if (eos === undefined) eos = require('./end-of-stream');
- eos(stream, {
- readable: reading,
- writable: writing
- }, function (err) {
- if (err) return callback(err);
- closed = true;
- callback();
- });
- var destroyed = false;
- return function (err) {
- if (closed) return;
- if (destroyed) return;
- destroyed = true; // request.destroy just do .end - .abort is what we want
-
- if (isRequest(stream)) return stream.abort();
- if (typeof stream.destroy === 'function') return stream.destroy();
- callback(err || new ERR_STREAM_DESTROYED('pipe'));
- };
-}
-
-function call(fn) {
- fn();
-}
-
-function pipe(from, to) {
- return from.pipe(to);
-}
-
-function popCallback(streams) {
- if (!streams.length) return noop;
- if (typeof streams[streams.length - 1] !== 'function') return noop;
- return streams.pop();
-}
-
-function pipeline() {
- for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) {
- streams[_key] = arguments[_key];
- }
-
- var callback = popCallback(streams);
- if (Array.isArray(streams[0])) streams = streams[0];
-
- if (streams.length < 2) {
- throw new ERR_MISSING_ARGS('streams');
- }
-
- var error;
- var destroys = streams.map(function (stream, i) {
- var reading = i < streams.length - 1;
- var writing = i > 0;
- return destroyer(stream, reading, writing, function (err) {
- if (!error) error = err;
- if (err) destroys.forEach(call);
- if (reading) return;
- destroys.forEach(call);
- callback(error);
- });
- });
- return streams.reduce(pipe);
-}
-
-module.exports = pipeline; \ No newline at end of file
diff --git a/deps/npm/node_modules/readable-stream/lib/internal/streams/state.js b/deps/npm/node_modules/readable-stream/lib/internal/streams/state.js
deleted file mode 100644
index 19887eb8a9..0000000000
--- a/deps/npm/node_modules/readable-stream/lib/internal/streams/state.js
+++ /dev/null
@@ -1,27 +0,0 @@
-'use strict';
-
-var ERR_INVALID_OPT_VALUE = require('../../../errors').codes.ERR_INVALID_OPT_VALUE;
-
-function highWaterMarkFrom(options, isDuplex, duplexKey) {
- return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;
-}
-
-function getHighWaterMark(state, options, duplexKey, isDuplex) {
- var hwm = highWaterMarkFrom(options, isDuplex, duplexKey);
-
- if (hwm != null) {
- if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) {
- var name = isDuplex ? duplexKey : 'highWaterMark';
- throw new ERR_INVALID_OPT_VALUE(name, hwm);
- }
-
- return Math.floor(hwm);
- } // Default value
-
-
- return state.objectMode ? 16 : 16 * 1024;
-}
-
-module.exports = {
- getHighWaterMark: getHighWaterMark
-}; \ No newline at end of file
diff --git a/deps/npm/node_modules/readable-stream/package.json b/deps/npm/node_modules/readable-stream/package.json
index 9c29e095cb..2afa6fbd81 100644
--- a/deps/npm/node_modules/readable-stream/package.json
+++ b/deps/npm/node_modules/readable-stream/package.json
@@ -1,100 +1,52 @@
{
- "_from": "readable-stream@3.6.0",
- "_id": "readable-stream@3.6.0",
- "_inBundle": false,
- "_integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
- "_location": "/readable-stream",
- "_phantomChildren": {},
- "_requested": {
- "type": "version",
- "registry": true,
- "raw": "readable-stream@3.6.0",
- "name": "readable-stream",
- "escapedName": "readable-stream",
- "rawSpec": "3.6.0",
- "saveSpec": null,
- "fetchSpec": "3.6.0"
- },
- "_requiredBy": [
- "#USER",
- "/",
- "/bl",
- "/tar-stream"
- ],
- "_resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
- "_shasum": "337bbda3adc0706bd3e024426a286d4b4b2c9198",
- "_spec": "readable-stream@3.6.0",
- "_where": "/Users/darcyclarke/Documents/Repos/npm/cli",
- "browser": {
- "util": false,
- "worker_threads": false,
- "./errors": "./errors-browser.js",
- "./readable.js": "./readable-browser.js",
- "./lib/internal/streams/from.js": "./lib/internal/streams/from-browser.js",
- "./lib/internal/streams/stream.js": "./lib/internal/streams/stream-browser.js"
- },
- "bugs": {
- "url": "https://github.com/nodejs/readable-stream/issues"
- },
- "bundleDependencies": false,
+ "name": "readable-stream",
+ "version": "2.3.7",
+ "description": "Streams3, a user-land copy of the stream library from Node.js",
+ "main": "readable.js",
"dependencies": {
- "inherits": "^2.0.3",
- "string_decoder": "^1.1.1",
- "util-deprecate": "^1.0.1"
+ "core-util-is": "~1.0.0",
+ "inherits": "~2.0.3",
+ "isarray": "~1.0.0",
+ "process-nextick-args": "~2.0.0",
+ "safe-buffer": "~5.1.1",
+ "string_decoder": "~1.1.1",
+ "util-deprecate": "~1.0.1"
},
- "deprecated": false,
- "description": "Streams3, a user-land copy of the stream library from Node.js",
"devDependencies": {
- "@babel/cli": "^7.2.0",
- "@babel/core": "^7.2.0",
- "@babel/polyfill": "^7.0.0",
- "@babel/preset-env": "^7.2.0",
- "airtap": "0.0.9",
"assert": "^1.4.0",
- "bl": "^2.0.0",
- "deep-strict-equal": "^0.2.0",
- "events.once": "^2.0.2",
- "glob": "^7.1.2",
- "gunzip-maybe": "^1.4.1",
- "hyperquest": "^2.1.3",
- "lolex": "^2.6.0",
- "nyc": "^11.0.0",
- "pump": "^3.0.0",
- "rimraf": "^2.6.2",
- "tap": "^12.0.0",
- "tape": "^4.9.0",
- "tar-fs": "^1.16.2",
- "util-promisify": "^2.1.0"
+ "babel-polyfill": "^6.9.1",
+ "buffer": "^4.9.0",
+ "lolex": "^2.3.2",
+ "nyc": "^6.4.0",
+ "tap": "^0.7.0",
+ "tape": "^4.8.0"
+ },
+ "scripts": {
+ "test": "tap test/parallel/*.js test/ours/*.js && node test/verify-dependencies.js",
+ "ci": "tap test/parallel/*.js test/ours/*.js --tap | tee test.tap && node test/verify-dependencies.js",
+ "cover": "nyc npm test",
+ "report": "nyc report --reporter=lcov"
},
- "engines": {
- "node": ">= 6"
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/nodejs/readable-stream"
},
- "homepage": "https://github.com/nodejs/readable-stream#readme",
"keywords": [
"readable",
"stream",
"pipe"
],
- "license": "MIT",
- "main": "readable.js",
- "name": "readable-stream",
+ "browser": {
+ "util": false,
+ "./readable.js": "./readable-browser.js",
+ "./writable.js": "./writable-browser.js",
+ "./duplex.js": "./duplex-browser.js",
+ "./lib/internal/streams/stream.js": "./lib/internal/streams/stream-browser.js"
+ },
"nyc": {
"include": [
"lib/**.js"
]
},
- "repository": {
- "type": "git",
- "url": "git://github.com/nodejs/readable-stream.git"
- },
- "scripts": {
- "ci": "TAP=1 tap --no-esm test/parallel/*.js test/ours/*.js | tee test.tap",
- "cover": "nyc npm test",
- "report": "nyc report --reporter=lcov",
- "test": "tap -J --no-esm test/parallel/*.js test/ours/*.js",
- "test-browser-local": "airtap --open --local -- test/browser.js",
- "test-browsers": "airtap --sauce-connect --loopback airtap.local -- test/browser.js",
- "update-browser-errors": "babel -o errors-browser.js errors.js"
- },
- "version": "3.6.0"
+ "license": "MIT"
}
diff --git a/deps/npm/node_modules/readable-stream/passthrough.js b/deps/npm/node_modules/readable-stream/passthrough.js
new file mode 100644
index 0000000000..ffd791d7ff
--- /dev/null
+++ b/deps/npm/node_modules/readable-stream/passthrough.js
@@ -0,0 +1 @@
+module.exports = require('./readable').PassThrough
diff --git a/deps/npm/node_modules/readable-stream/readable-browser.js b/deps/npm/node_modules/readable-stream/readable-browser.js
index adbf60de83..e50372592e 100644
--- a/deps/npm/node_modules/readable-stream/readable-browser.js
+++ b/deps/npm/node_modules/readable-stream/readable-browser.js
@@ -5,5 +5,3 @@ exports.Writable = require('./lib/_stream_writable.js');
exports.Duplex = require('./lib/_stream_duplex.js');
exports.Transform = require('./lib/_stream_transform.js');
exports.PassThrough = require('./lib/_stream_passthrough.js');
-exports.finished = require('./lib/internal/streams/end-of-stream.js');
-exports.pipeline = require('./lib/internal/streams/pipeline.js');
diff --git a/deps/npm/node_modules/readable-stream/readable.js b/deps/npm/node_modules/readable-stream/readable.js
index 9e0ca120de..ec89ec5330 100644
--- a/deps/npm/node_modules/readable-stream/readable.js
+++ b/deps/npm/node_modules/readable-stream/readable.js
@@ -1,8 +1,13 @@
var Stream = require('stream');
if (process.env.READABLE_STREAM === 'disable' && Stream) {
- module.exports = Stream.Readable;
- Object.assign(module.exports, Stream);
- module.exports.Stream = Stream;
+ module.exports = Stream;
+ exports = module.exports = Stream.Readable;
+ exports.Readable = Stream.Readable;
+ exports.Writable = Stream.Writable;
+ exports.Duplex = Stream.Duplex;
+ exports.Transform = Stream.Transform;
+ exports.PassThrough = Stream.PassThrough;
+ exports.Stream = Stream;
} else {
exports = module.exports = require('./lib/_stream_readable.js');
exports.Stream = Stream || exports;
@@ -11,6 +16,4 @@ if (process.env.READABLE_STREAM === 'disable' && Stream) {
exports.Duplex = require('./lib/_stream_duplex.js');
exports.Transform = require('./lib/_stream_transform.js');
exports.PassThrough = require('./lib/_stream_passthrough.js');
- exports.finished = require('./lib/internal/streams/end-of-stream.js');
- exports.pipeline = require('./lib/internal/streams/pipeline.js');
}
diff --git a/deps/npm/node_modules/readable-stream/transform.js b/deps/npm/node_modules/readable-stream/transform.js
new file mode 100644
index 0000000000..b1baba26da
--- /dev/null
+++ b/deps/npm/node_modules/readable-stream/transform.js
@@ -0,0 +1 @@
+module.exports = require('./readable').Transform
diff --git a/deps/npm/node_modules/readable-stream/writable-browser.js b/deps/npm/node_modules/readable-stream/writable-browser.js
new file mode 100644
index 0000000000..ebdde6a85d
--- /dev/null
+++ b/deps/npm/node_modules/readable-stream/writable-browser.js
@@ -0,0 +1 @@
+module.exports = require('./lib/_stream_writable.js');
diff --git a/deps/npm/node_modules/readable-stream/writable.js b/deps/npm/node_modules/readable-stream/writable.js
new file mode 100644
index 0000000000..3211a6f80d
--- /dev/null
+++ b/deps/npm/node_modules/readable-stream/writable.js
@@ -0,0 +1,8 @@
+var Stream = require("stream")
+var Writable = require("./lib/_stream_writable.js")
+
+if (process.env.READABLE_STREAM === 'disable') {
+ module.exports = Stream && Stream.Writable || Writable
+} else {
+ module.exports = Writable
+}