summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/sorted-union-stream/node_modules
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/node_modules/sorted-union-stream/node_modules')
-rw-r--r--deps/npm/node_modules/sorted-union-stream/node_modules/from2/LICENSE.md21
-rw-r--r--deps/npm/node_modules/sorted-union-stream/node_modules/from2/README.md67
-rw-r--r--deps/npm/node_modules/sorted-union-stream/node_modules/from2/index.js93
-rw-r--r--deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/.npmignore5
-rw-r--r--deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/LICENSE18
-rw-r--r--deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/README.md14
-rw-r--r--deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/duplex.js1
-rw-r--r--deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/float.patch922
-rw-r--r--deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/lib/_stream_duplex.js89
-rw-r--r--deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/lib/_stream_passthrough.js46
-rw-r--r--deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/lib/_stream_readable.js951
-rw-r--r--deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/lib/_stream_transform.js209
-rw-r--r--deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/lib/_stream_writable.js477
-rw-r--r--deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/core-util-is/LICENSE19
-rw-r--r--deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/core-util-is/README.md3
-rw-r--r--deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/core-util-is/float.patch604
-rw-r--r--deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/core-util-is/lib/util.js107
-rw-r--r--deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/core-util-is/package.json95
-rw-r--r--deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/core-util-is/test.js68
-rw-r--r--deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/isarray/README.md54
-rw-r--r--deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/isarray/build/build.js208
-rw-r--r--deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/isarray/component.json19
-rw-r--r--deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/isarray/index.js3
-rw-r--r--deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/isarray/package.json87
-rw-r--r--deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/string_decoder/.npmignore2
-rw-r--r--deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/string_decoder/LICENSE20
-rw-r--r--deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/string_decoder/README.md7
-rw-r--r--deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/string_decoder/index.js221
-rw-r--r--deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/string_decoder/package.json88
-rw-r--r--deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/package.json113
-rw-r--r--deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/passthrough.js1
-rw-r--r--deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/readable.js10
-rw-r--r--deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/transform.js1
-rw-r--r--deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/writable.js1
-rw-r--r--deps/npm/node_modules/sorted-union-stream/node_modules/from2/package.json107
-rw-r--r--deps/npm/node_modules/sorted-union-stream/node_modules/from2/test.js86
-rw-r--r--deps/npm/node_modules/sorted-union-stream/node_modules/stream-iterate/.npmignore1
-rw-r--r--deps/npm/node_modules/sorted-union-stream/node_modules/stream-iterate/.travis.yml5
-rw-r--r--deps/npm/node_modules/sorted-union-stream/node_modules/stream-iterate/LICENSE21
-rw-r--r--deps/npm/node_modules/sorted-union-stream/node_modules/stream-iterate/README.md33
-rw-r--r--deps/npm/node_modules/sorted-union-stream/node_modules/stream-iterate/index.js69
-rw-r--r--deps/npm/node_modules/sorted-union-stream/node_modules/stream-iterate/package.json85
-rw-r--r--deps/npm/node_modules/sorted-union-stream/node_modules/stream-iterate/test.js60
43 files changed, 5111 insertions, 0 deletions
diff --git a/deps/npm/node_modules/sorted-union-stream/node_modules/from2/LICENSE.md b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/LICENSE.md
new file mode 100644
index 0000000000..146cb32a7d
--- /dev/null
+++ b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/LICENSE.md
@@ -0,0 +1,21 @@
+## The MIT License (MIT) ##
+
+Copyright (c) 2014 Hugh Kennedy
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 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.
diff --git a/deps/npm/node_modules/sorted-union-stream/node_modules/from2/README.md b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/README.md
new file mode 100644
index 0000000000..a890140bb1
--- /dev/null
+++ b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/README.md
@@ -0,0 +1,67 @@
+# from2 [![Flattr this!](https://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=hughskennedy&url=http://github.com/hughsk/from2&title=from2&description=hughsk/from2%20on%20GitHub&language=en_GB&tags=flattr,github,javascript&category=software)[![experimental](http://hughsk.github.io/stability-badges/dist/experimental.svg)](http://github.com/hughsk/stability-badges) #
+
+`from2` is a high-level module for creating readable streams that properly handle backpressure.
+
+Convience wrapper for
+[readable-stream](http://github.com/isaacs/readable-stream)'s `ReadableStream`
+base class, with an API lifted from
+[from](http://github.com/dominictarr/from) and
+[through2](http://github.com/rvagg/through2).
+
+## Usage ##
+
+[![from2](https://nodei.co/npm/from2.png?mini=true)](https://nodei.co/npm/from2)
+
+### `stream = from2([opts], read)` ###
+
+Where `opts` are the options to pass on to the `ReadableStream` constructor,
+and `read(size, next)` is called when data is requested from the stream.
+
+* `size` is the recommended amount of data (in bytes) to retrieve.
+* `next(err)` should be called when you're ready to emit more data.
+
+For example, here's a readable stream that emits the contents of a given
+string:
+
+``` javascript
+var from = require('from2')
+
+module.exports = fromString
+
+function fromString(string) {
+ return from(function(size, next) {
+ // if there's no more content
+ // left in the string, close the stream.
+ if (string.length <= 0) return this.push(null)
+
+ // Pull in a new chunk of text,
+ // removing it from the string.
+ var chunk = string.slice(0, size)
+ string = string.slice(size)
+
+ // Emit "chunk" from the stream.
+ next(null, chunk)
+ })
+}
+
+// pipe "hello world" out
+// to stdout.
+fromString('hello world').pipe(process.stdout)
+```
+
+### `stream = from2.obj([opts], read)` ###
+
+Shorthand for `from2({ objectMode: true }, read)`.
+
+### `createStream = from2.ctor([opts], read)` ###
+
+If you're creating similar streams in quick succession you can improve
+performance by generating a stream **constructor** that you can reuse instead
+of creating one-off streams on each call.
+
+Takes the same options as `from2`, instead returning a constructor which you
+can use to create new streams.
+
+## License ##
+
+MIT. See [LICENSE.md](http://github.com/hughsk/from2/blob/master/LICENSE.md) for details.
diff --git a/deps/npm/node_modules/sorted-union-stream/node_modules/from2/index.js b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/index.js
new file mode 100644
index 0000000000..d83be0b554
--- /dev/null
+++ b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/index.js
@@ -0,0 +1,93 @@
+var Readable = require('readable-stream').Readable
+var inherits = require('inherits')
+
+module.exports = from2
+
+from2.ctor = ctor
+from2.obj = obj
+
+var Proto = ctor()
+
+function toFunction(list) {
+ list = list.slice()
+ return function (_, cb) {
+ cb(null, list.length ? list.shift() : null)
+ }
+}
+
+function from2(opts, read) {
+ if (typeof opts !== 'object' || Array.isArray(opts)) {
+ read = opts
+ opts = {}
+ }
+
+ if (Array.isArray(read)) read = toFunction(read)
+
+ var rs = new Proto(opts)
+ rs._from = read
+ return rs
+}
+
+function ctor(opts, read) {
+ if (typeof opts === 'function') {
+ read = opts
+ opts = {}
+ }
+
+ opts = defaults(opts)
+
+ inherits(Class, Readable)
+ function Class(override) {
+ if (!(this instanceof Class)) return new Class(override)
+ this._reading = false
+ this.destroyed = false
+ Readable.call(this, override || opts)
+ }
+
+ Class.prototype._from = read
+ Class.prototype._read = function(size) {
+ var self = this
+
+ if (this._reading || this.destroyed) return
+ this._reading = true
+ this._from(size, check)
+ function check(err, data) {
+ if (self.destroyed) return
+ if (err) return self.destroy(err)
+ if (data === null) return self.push(null)
+ self._reading = false
+ if (self.push(data)) self._read()
+ }
+ }
+
+ Class.prototype.destroy = function(err) {
+ if (this.destroyed) return
+ this.destroyed = true
+
+ var self = this
+ process.nextTick(function() {
+ if (err) self.emit('error', err)
+ self.emit('close')
+ })
+ }
+
+ return Class
+}
+
+function obj(opts, read) {
+ if (typeof opts === 'function' || Array.isArray(opts)) {
+ read = opts
+ opts = {}
+ }
+
+ opts = defaults(opts)
+ opts.objectMode = true
+ opts.highWaterMark = 16
+
+ return from2(opts, read)
+}
+
+function defaults(opts) {
+ opts = opts || {}
+ return opts
+}
diff --git a/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/.npmignore b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/.npmignore
new file mode 100644
index 0000000000..38344f87a6
--- /dev/null
+++ b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/.npmignore
@@ -0,0 +1,5 @@
+build/
+test/
+examples/
+fs.js
+zlib.js \ No newline at end of file
diff --git a/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/LICENSE b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/LICENSE
new file mode 100644
index 0000000000..e3d4e695a4
--- /dev/null
+++ b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/LICENSE
@@ -0,0 +1,18 @@
+Copyright Joyent, Inc. and other Node contributors. All rights reserved.
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to
+deal in the Software without restriction, including without limitation the
+rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+sell copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 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.
diff --git a/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/README.md b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/README.md
new file mode 100644
index 0000000000..9e9b6eee9f
--- /dev/null
+++ b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/README.md
@@ -0,0 +1,14 @@
+# readable-stream
+
+***Node-core streams for userland***
+
+[![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/)
+
+This package is a mirror of the Streams2 and Streams3 implementations in Node-core.
+
+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.
+
+**readable-stream** comes in two major versions, v1.0.x and v1.1.x. The former tracks the Streams2 implementation in Node 0.10, including bug-fixes and minor improvements as they are added. The latter tracks Streams3 as it develops in Node 0.11; we will likely see a v1.2.x branch for Node 0.12.
+
+**readable-stream** uses proper patch-level versioning so if you pin to `"~1.0.0"` you’ll get the latest Node 0.10 Streams2 implementation, including any fixes and minor non-breaking improvements. The patch-level versions of 1.0.x and 1.1.x should mirror the patch-level versions of Node-core releases. You should prefer the **1.0.x** releases for now and when you’re ready to start using Streams3, pin to `"~1.1.0"`
diff --git a/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/duplex.js b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/duplex.js
new file mode 100644
index 0000000000..ca807af876
--- /dev/null
+++ b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/duplex.js
@@ -0,0 +1 @@
+module.exports = require("./lib/_stream_duplex.js")
diff --git a/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/float.patch b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/float.patch
new file mode 100644
index 0000000000..7abb6dc30b
--- /dev/null
+++ b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/float.patch
@@ -0,0 +1,922 @@
+diff --git a/lib/_stream_duplex.js b/lib/_stream_duplex.js
+index c5a741c..a2e0d8e 100644
+--- a/lib/_stream_duplex.js
++++ b/lib/_stream_duplex.js
+@@ -26,8 +26,8 @@
+
+ module.exports = Duplex;
+ var util = require('util');
+-var Readable = require('_stream_readable');
+-var Writable = require('_stream_writable');
++var Readable = require('./_stream_readable');
++var Writable = require('./_stream_writable');
+
+ util.inherits(Duplex, Readable);
+
+diff --git a/lib/_stream_passthrough.js b/lib/_stream_passthrough.js
+index a5e9864..330c247 100644
+--- a/lib/_stream_passthrough.js
++++ b/lib/_stream_passthrough.js
+@@ -25,7 +25,7 @@
+
+ module.exports = PassThrough;
+
+-var Transform = require('_stream_transform');
++var Transform = require('./_stream_transform');
+ var util = require('util');
+ util.inherits(PassThrough, Transform);
+
+diff --git a/lib/_stream_readable.js b/lib/_stream_readable.js
+index 0c3fe3e..90a8298 100644
+--- a/lib/_stream_readable.js
++++ b/lib/_stream_readable.js
+@@ -23,10 +23,34 @@ module.exports = Readable;
+ Readable.ReadableState = ReadableState;
+
+ var EE = require('events').EventEmitter;
++if (!EE.listenerCount) EE.listenerCount = function(emitter, type) {
++ return emitter.listeners(type).length;
++};
++
++if (!global.setImmediate) global.setImmediate = function setImmediate(fn) {
++ return setTimeout(fn, 0);
++};
++if (!global.clearImmediate) global.clearImmediate = function clearImmediate(i) {
++ return clearTimeout(i);
++};
++
+ var Stream = require('stream');
+ var util = require('util');
++if (!util.isUndefined) {
++ var utilIs = require('core-util-is');
++ for (var f in utilIs) {
++ util[f] = utilIs[f];
++ }
++}
+ var StringDecoder;
+-var debug = util.debuglog('stream');
++var debug;
++if (util.debuglog)
++ debug = util.debuglog('stream');
++else try {
++ debug = require('debuglog')('stream');
++} catch (er) {
++ debug = function() {};
++}
+
+ util.inherits(Readable, Stream);
+
+@@ -380,7 +404,7 @@ function chunkInvalid(state, chunk) {
+
+
+ function onEofChunk(stream, state) {
+- if (state.decoder && !state.ended) {
++ if (state.decoder && !state.ended && state.decoder.end) {
+ var chunk = state.decoder.end();
+ if (chunk && chunk.length) {
+ state.buffer.push(chunk);
+diff --git a/lib/_stream_transform.js b/lib/_stream_transform.js
+index b1f9fcc..b0caf57 100644
+--- a/lib/_stream_transform.js
++++ b/lib/_stream_transform.js
+@@ -64,8 +64,14 @@
+
+ module.exports = Transform;
+
+-var Duplex = require('_stream_duplex');
++var Duplex = require('./_stream_duplex');
+ var util = require('util');
++if (!util.isUndefined) {
++ var utilIs = require('core-util-is');
++ for (var f in utilIs) {
++ util[f] = utilIs[f];
++ }
++}
+ util.inherits(Transform, Duplex);
+
+
+diff --git a/lib/_stream_writable.js b/lib/_stream_writable.js
+index ba2e920..f49288b 100644
+--- a/lib/_stream_writable.js
++++ b/lib/_stream_writable.js
+@@ -27,6 +27,12 @@ module.exports = Writable;
+ Writable.WritableState = WritableState;
+
+ var util = require('util');
++if (!util.isUndefined) {
++ var utilIs = require('core-util-is');
++ for (var f in utilIs) {
++ util[f] = utilIs[f];
++ }
++}
+ var Stream = require('stream');
+
+ util.inherits(Writable, Stream);
+@@ -119,7 +125,7 @@ function WritableState(options, stream) {
+ function Writable(options) {
+ // Writable ctor is applied to Duplexes, though they're not
+ // instanceof Writable, they're instanceof Readable.
+- if (!(this instanceof Writable) && !(this instanceof Stream.Duplex))
++ if (!(this instanceof Writable) && !(this instanceof require('./_stream_duplex')))
+ return new Writable(options);
+
+ this._writableState = new WritableState(options, this);
+diff --git a/test/simple/test-stream-big-push.js b/test/simple/test-stream-big-push.js
+index e3787e4..8cd2127 100644
+--- a/test/simple/test-stream-big-push.js
++++ b/test/simple/test-stream-big-push.js
+@@ -21,7 +21,7 @@
+
+ var common = require('../common');
+ var assert = require('assert');
+-var stream = require('stream');
++var stream = require('../../');
+ var str = 'asdfasdfasdfasdfasdf';
+
+ var r = new stream.Readable({
+diff --git a/test/simple/test-stream-end-paused.js b/test/simple/test-stream-end-paused.js
+index bb73777..d40efc7 100644
+--- a/test/simple/test-stream-end-paused.js
++++ b/test/simple/test-stream-end-paused.js
+@@ -25,7 +25,7 @@ var gotEnd = false;
+
+ // Make sure we don't miss the end event for paused 0-length streams
+
+-var Readable = require('stream').Readable;
++var Readable = require('../../').Readable;
+ var stream = new Readable();
+ var calledRead = false;
+ stream._read = function() {
+diff --git a/test/simple/test-stream-pipe-after-end.js b/test/simple/test-stream-pipe-after-end.js
+index b46ee90..0be8366 100644
+--- a/test/simple/test-stream-pipe-after-end.js
++++ b/test/simple/test-stream-pipe-after-end.js
+@@ -22,8 +22,8 @@
+ var common = require('../common');
+ var assert = require('assert');
+
+-var Readable = require('_stream_readable');
+-var Writable = require('_stream_writable');
++var Readable = require('../../lib/_stream_readable');
++var Writable = require('../../lib/_stream_writable');
+ var util = require('util');
+
+ util.inherits(TestReadable, Readable);
+diff --git a/test/simple/test-stream-pipe-cleanup.js b/test/simple/test-stream-pipe-cleanup.js
+deleted file mode 100644
+index f689358..0000000
+--- a/test/simple/test-stream-pipe-cleanup.js
++++ /dev/null
+@@ -1,122 +0,0 @@
+-// Copyright Joyent, Inc. and other Node contributors.
+-//
+-// Permission is hereby granted, free of charge, to any person obtaining a
+-// copy of this software and associated documentation files (the
+-// "Software"), to deal in the Software without restriction, including
+-// without limitation the rights to use, copy, modify, merge, publish,
+-// distribute, sublicense, and/or sell copies of the Software, and to permit
+-// persons to whom the Software is furnished to do so, subject to the
+-// following conditions:
+-//
+-// The above copyright notice and this permission notice shall be included
+-// in all copies or substantial portions of the Software.
+-//
+-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+-// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+-// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+-// 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.
+-
+-// This test asserts that Stream.prototype.pipe does not leave listeners
+-// hanging on the source or dest.
+-
+-var common = require('../common');
+-var stream = require('stream');
+-var assert = require('assert');
+-var util = require('util');
+-
+-function Writable() {
+- this.writable = true;
+- this.endCalls = 0;
+- stream.Stream.call(this);
+-}
+-util.inherits(Writable, stream.Stream);
+-Writable.prototype.end = function() {
+- this.endCalls++;
+-};
+-
+-Writable.prototype.destroy = function() {
+- this.endCalls++;
+-};
+-
+-function Readable() {
+- this.readable = true;
+- stream.Stream.call(this);
+-}
+-util.inherits(Readable, stream.Stream);
+-
+-function Duplex() {
+- this.readable = true;
+- Writable.call(this);
+-}
+-util.inherits(Duplex, Writable);
+-
+-var i = 0;
+-var limit = 100;
+-
+-var w = new Writable();
+-
+-var r;
+-
+-for (i = 0; i < limit; i++) {
+- r = new Readable();
+- r.pipe(w);
+- r.emit('end');
+-}
+-assert.equal(0, r.listeners('end').length);
+-assert.equal(limit, w.endCalls);
+-
+-w.endCalls = 0;
+-
+-for (i = 0; i < limit; i++) {
+- r = new Readable();
+- r.pipe(w);
+- r.emit('close');
+-}
+-assert.equal(0, r.listeners('close').length);
+-assert.equal(limit, w.endCalls);
+-
+-w.endCalls = 0;
+-
+-r = new Readable();
+-
+-for (i = 0; i < limit; i++) {
+- w = new Writable();
+- r.pipe(w);
+- w.emit('close');
+-}
+-assert.equal(0, w.listeners('close').length);
+-
+-r = new Readable();
+-w = new Writable();
+-var d = new Duplex();
+-r.pipe(d); // pipeline A
+-d.pipe(w); // pipeline B
+-assert.equal(r.listeners('end').length, 2); // A.onend, A.cleanup
+-assert.equal(r.listeners('close').length, 2); // A.onclose, A.cleanup
+-assert.equal(d.listeners('end').length, 2); // B.onend, B.cleanup
+-assert.equal(d.listeners('close').length, 3); // A.cleanup, B.onclose, B.cleanup
+-assert.equal(w.listeners('end').length, 0);
+-assert.equal(w.listeners('close').length, 1); // B.cleanup
+-
+-r.emit('end');
+-assert.equal(d.endCalls, 1);
+-assert.equal(w.endCalls, 0);
+-assert.equal(r.listeners('end').length, 0);
+-assert.equal(r.listeners('close').length, 0);
+-assert.equal(d.listeners('end').length, 2); // B.onend, B.cleanup
+-assert.equal(d.listeners('close').length, 2); // B.onclose, B.cleanup
+-assert.equal(w.listeners('end').length, 0);
+-assert.equal(w.listeners('close').length, 1); // B.cleanup
+-
+-d.emit('end');
+-assert.equal(d.endCalls, 1);
+-assert.equal(w.endCalls, 1);
+-assert.equal(r.listeners('end').length, 0);
+-assert.equal(r.listeners('close').length, 0);
+-assert.equal(d.listeners('end').length, 0);
+-assert.equal(d.listeners('close').length, 0);
+-assert.equal(w.listeners('end').length, 0);
+-assert.equal(w.listeners('close').length, 0);
+diff --git a/test/simple/test-stream-pipe-error-handling.js b/test/simple/test-stream-pipe-error-handling.js
+index c5d724b..c7d6b7d 100644
+--- a/test/simple/test-stream-pipe-error-handling.js
++++ b/test/simple/test-stream-pipe-error-handling.js
+@@ -21,7 +21,7 @@
+
+ var common = require('../common');
+ var assert = require('assert');
+-var Stream = require('stream').Stream;
++var Stream = require('../../').Stream;
+
+ (function testErrorListenerCatches() {
+ var source = new Stream();
+diff --git a/test/simple/test-stream-pipe-event.js b/test/simple/test-stream-pipe-event.js
+index cb9d5fe..56f8d61 100644
+--- a/test/simple/test-stream-pipe-event.js
++++ b/test/simple/test-stream-pipe-event.js
+@@ -20,7 +20,7 @@
+ // USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ var common = require('../common');
+-var stream = require('stream');
++var stream = require('../../');
+ var assert = require('assert');
+ var util = require('util');
+
+diff --git a/test/simple/test-stream-push-order.js b/test/simple/test-stream-push-order.js
+index f2e6ec2..a5c9bf9 100644
+--- a/test/simple/test-stream-push-order.js
++++ b/test/simple/test-stream-push-order.js
+@@ -20,7 +20,7 @@
+ // USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ var common = require('../common.js');
+-var Readable = require('stream').Readable;
++var Readable = require('../../').Readable;
+ var assert = require('assert');
+
+ var s = new Readable({
+diff --git a/test/simple/test-stream-push-strings.js b/test/simple/test-stream-push-strings.js
+index 06f43dc..1701a9a 100644
+--- a/test/simple/test-stream-push-strings.js
++++ b/test/simple/test-stream-push-strings.js
+@@ -22,7 +22,7 @@
+ var common = require('../common');
+ var assert = require('assert');
+
+-var Readable = require('stream').Readable;
++var Readable = require('../../').Readable;
+ var util = require('util');
+
+ util.inherits(MyStream, Readable);
+diff --git a/test/simple/test-stream-readable-event.js b/test/simple/test-stream-readable-event.js
+index ba6a577..a8e6f7b 100644
+--- a/test/simple/test-stream-readable-event.js
++++ b/test/simple/test-stream-readable-event.js
+@@ -22,7 +22,7 @@
+ var common = require('../common');
+ var assert = require('assert');
+
+-var Readable = require('stream').Readable;
++var Readable = require('../../').Readable;
+
+ (function first() {
+ // First test, not reading when the readable is added.
+diff --git a/test/simple/test-stream-readable-flow-recursion.js b/test/simple/test-stream-readable-flow-recursion.js
+index 2891ad6..11689ba 100644
+--- a/test/simple/test-stream-readable-flow-recursion.js
++++ b/test/simple/test-stream-readable-flow-recursion.js
+@@ -27,7 +27,7 @@ var assert = require('assert');
+ // more data continuously, but without triggering a nextTick
+ // warning or RangeError.
+
+-var Readable = require('stream').Readable;
++var Readable = require('../../').Readable;
+
+ // throw an error if we trigger a nextTick warning.
+ process.throwDeprecation = true;
+diff --git a/test/simple/test-stream-unshift-empty-chunk.js b/test/simple/test-stream-unshift-empty-chunk.js
+index 0c96476..7827538 100644
+--- a/test/simple/test-stream-unshift-empty-chunk.js
++++ b/test/simple/test-stream-unshift-empty-chunk.js
+@@ -24,7 +24,7 @@ var assert = require('assert');
+
+ // This test verifies that stream.unshift(Buffer(0)) or
+ // stream.unshift('') does not set state.reading=false.
+-var Readable = require('stream').Readable;
++var Readable = require('../../').Readable;
+
+ var r = new Readable();
+ var nChunks = 10;
+diff --git a/test/simple/test-stream-unshift-read-race.js b/test/simple/test-stream-unshift-read-race.js
+index 83fd9fa..17c18aa 100644
+--- a/test/simple/test-stream-unshift-read-race.js
++++ b/test/simple/test-stream-unshift-read-race.js
+@@ -29,7 +29,7 @@ var assert = require('assert');
+ // 3. push() after the EOF signaling null is an error.
+ // 4. _read() is not called after pushing the EOF null chunk.
+
+-var stream = require('stream');
++var stream = require('../../');
+ var hwm = 10;
+ var r = stream.Readable({ highWaterMark: hwm });
+ var chunks = 10;
+@@ -51,7 +51,14 @@ r._read = function(n) {
+
+ function push(fast) {
+ assert(!pushedNull, 'push() after null push');
+- var c = pos >= data.length ? null : data.slice(pos, pos + n);
++ var c;
++ if (pos >= data.length)
++ c = null;
++ else {
++ if (n + pos > data.length)
++ n = data.length - pos;
++ c = data.slice(pos, pos + n);
++ }
+ pushedNull = c === null;
+ if (fast) {
+ pos += n;
+diff --git a/test/simple/test-stream-writev.js b/test/simple/test-stream-writev.js
+index 5b49e6e..b5321f3 100644
+--- a/test/simple/test-stream-writev.js
++++ b/test/simple/test-stream-writev.js
+@@ -22,7 +22,7 @@
+ var common = require('../common');
+ var assert = require('assert');
+
+-var stream = require('stream');
++var stream = require('../../');
+
+ var queue = [];
+ for (var decode = 0; decode < 2; decode++) {
+diff --git a/test/simple/test-stream2-basic.js b/test/simple/test-stream2-basic.js
+index 3814bf0..248c1be 100644
+--- a/test/simple/test-stream2-basic.js
++++ b/test/simple/test-stream2-basic.js
+@@ -21,7 +21,7 @@
+
+
+ var common = require('../common.js');
+-var R = require('_stream_readable');
++var R = require('../../lib/_stream_readable');
+ var assert = require('assert');
+
+ var util = require('util');
+diff --git a/test/simple/test-stream2-compatibility.js b/test/simple/test-stream2-compatibility.js
+index 6cdd4e9..f0fa84b 100644
+--- a/test/simple/test-stream2-compatibility.js
++++ b/test/simple/test-stream2-compatibility.js
+@@ -21,7 +21,7 @@
+
+
+ var common = require('../common.js');
+-var R = require('_stream_readable');
++var R = require('../../lib/_stream_readable');
+ var assert = require('assert');
+
+ var util = require('util');
+diff --git a/test/simple/test-stream2-finish-pipe.js b/test/simple/test-stream2-finish-pipe.js
+index 39b274f..006a19b 100644
+--- a/test/simple/test-stream2-finish-pipe.js
++++ b/test/simple/test-stream2-finish-pipe.js
+@@ -20,7 +20,7 @@
+ // USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ var common = require('../common.js');
+-var stream = require('stream');
++var stream = require('../../');
+ var Buffer = require('buffer').Buffer;
+
+ var r = new stream.Readable();
+diff --git a/test/simple/test-stream2-fs.js b/test/simple/test-stream2-fs.js
+deleted file mode 100644
+index e162406..0000000
+--- a/test/simple/test-stream2-fs.js
++++ /dev/null
+@@ -1,72 +0,0 @@
+-// Copyright Joyent, Inc. and other Node contributors.
+-//
+-// Permission is hereby granted, free of charge, to any person obtaining a
+-// copy of this software and associated documentation files (the
+-// "Software"), to deal in the Software without restriction, including
+-// without limitation the rights to use, copy, modify, merge, publish,
+-// distribute, sublicense, and/or sell copies of the Software, and to permit
+-// persons to whom the Software is furnished to do so, subject to the
+-// following conditions:
+-//
+-// The above copyright notice and this permission notice shall be included
+-// in all copies or substantial portions of the Software.
+-//
+-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+-// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+-// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+-// 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.
+-
+-
+-var common = require('../common.js');
+-var R = require('_stream_readable');
+-var assert = require('assert');
+-
+-var fs = require('fs');
+-var FSReadable = fs.ReadStream;
+-
+-var path = require('path');
+-var file = path.resolve(common.fixturesDir, 'x1024.txt');
+-
+-var size = fs.statSync(file).size;
+-
+-var expectLengths = [1024];
+-
+-var util = require('util');
+-var Stream = require('stream');
+-
+-util.inherits(TestWriter, Stream);
+-
+-function TestWriter() {
+- Stream.apply(this);
+- this.buffer = [];
+- this.length = 0;
+-}
+-
+-TestWriter.prototype.write = function(c) {
+- this.buffer.push(c.toString());
+- this.length += c.length;
+- return true;
+-};
+-
+-TestWriter.prototype.end = function(c) {
+- if (c) this.buffer.push(c.toString());
+- this.emit('results', this.buffer);
+-}
+-
+-var r = new FSReadable(file);
+-var w = new TestWriter();
+-
+-w.on('results', function(res) {
+- console.error(res, w.length);
+- assert.equal(w.length, size);
+- var l = 0;
+- assert.deepEqual(res.map(function (c) {
+- return c.length;
+- }), expectLengths);
+- console.log('ok');
+-});
+-
+-r.pipe(w);
+diff --git a/test/simple/test-stream2-httpclient-response-end.js b/test/simple/test-stream2-httpclient-response-end.js
+deleted file mode 100644
+index 15cffc2..0000000
+--- a/test/simple/test-stream2-httpclient-response-end.js
++++ /dev/null
+@@ -1,52 +0,0 @@
+-// Copyright Joyent, Inc. and other Node contributors.
+-//
+-// Permission is hereby granted, free of charge, to any person obtaining a
+-// copy of this software and associated documentation files (the
+-// "Software"), to deal in the Software without restriction, including
+-// without limitation the rights to use, copy, modify, merge, publish,
+-// distribute, sublicense, and/or sell copies of the Software, and to permit
+-// persons to whom the Software is furnished to do so, subject to the
+-// following conditions:
+-//
+-// The above copyright notice and this permission notice shall be included
+-// in all copies or substantial portions of the Software.
+-//
+-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+-// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+-// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+-// 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.
+-
+-var common = require('../common.js');
+-var assert = require('assert');
+-var http = require('http');
+-var msg = 'Hello';
+-var readable_event = false;
+-var end_event = false;
+-var server = http.createServer(function(req, res) {
+- res.writeHead(200, {'Content-Type': 'text/plain'});
+- res.end(msg);
+-}).listen(common.PORT, function() {
+- http.get({port: common.PORT}, function(res) {
+- var data = '';
+- res.on('readable', function() {
+- console.log('readable event');
+- readable_event = true;
+- data += res.read();
+- });
+- res.on('end', function() {
+- console.log('end event');
+- end_event = true;
+- assert.strictEqual(msg, data);
+- server.close();
+- });
+- });
+-});
+-
+-process.on('exit', function() {
+- assert(readable_event);
+- assert(end_event);
+-});
+-
+diff --git a/test/simple/test-stream2-large-read-stall.js b/test/simple/test-stream2-large-read-stall.js
+index 2fbfbca..667985b 100644
+--- a/test/simple/test-stream2-large-read-stall.js
++++ b/test/simple/test-stream2-large-read-stall.js
+@@ -30,7 +30,7 @@ var PUSHSIZE = 20;
+ var PUSHCOUNT = 1000;
+ var HWM = 50;
+
+-var Readable = require('stream').Readable;
++var Readable = require('../../').Readable;
+ var r = new Readable({
+ highWaterMark: HWM
+ });
+@@ -39,23 +39,23 @@ var rs = r._readableState;
+ r._read = push;
+
+ r.on('readable', function() {
+- console.error('>> readable');
++ //console.error('>> readable');
+ do {
+- console.error(' > read(%d)', READSIZE);
++ //console.error(' > read(%d)', READSIZE);
+ var ret = r.read(READSIZE);
+- console.error(' < %j (%d remain)', ret && ret.length, rs.length);
++ //console.error(' < %j (%d remain)', ret && ret.length, rs.length);
+ } while (ret && ret.length === READSIZE);
+
+- console.error('<< after read()',
+- ret && ret.length,
+- rs.needReadable,
+- rs.length);
++ //console.error('<< after read()',
++ // ret && ret.length,
++ // rs.needReadable,
++ // rs.length);
+ });
+
+ var endEmitted = false;
+ r.on('end', function() {
+ endEmitted = true;
+- console.error('end');
++ //console.error('end');
+ });
+
+ var pushes = 0;
+@@ -64,11 +64,11 @@ function push() {
+ return;
+
+ if (pushes++ === PUSHCOUNT) {
+- console.error(' push(EOF)');
++ //console.error(' push(EOF)');
+ return r.push(null);
+ }
+
+- console.error(' push #%d', pushes);
++ //console.error(' push #%d', pushes);
+ if (r.push(new Buffer(PUSHSIZE)))
+ setTimeout(push);
+ }
+diff --git a/test/simple/test-stream2-objects.js b/test/simple/test-stream2-objects.js
+index 3e6931d..ff47d89 100644
+--- a/test/simple/test-stream2-objects.js
++++ b/test/simple/test-stream2-objects.js
+@@ -21,8 +21,8 @@
+
+
+ var common = require('../common.js');
+-var Readable = require('_stream_readable');
+-var Writable = require('_stream_writable');
++var Readable = require('../../lib/_stream_readable');
++var Writable = require('../../lib/_stream_writable');
+ var assert = require('assert');
+
+ // tiny node-tap lookalike.
+diff --git a/test/simple/test-stream2-pipe-error-handling.js b/test/simple/test-stream2-pipe-error-handling.js
+index cf7531c..e3f3e4e 100644
+--- a/test/simple/test-stream2-pipe-error-handling.js
++++ b/test/simple/test-stream2-pipe-error-handling.js
+@@ -21,7 +21,7 @@
+
+ var common = require('../common');
+ var assert = require('assert');
+-var stream = require('stream');
++var stream = require('../../');
+
+ (function testErrorListenerCatches() {
+ var count = 1000;
+diff --git a/test/simple/test-stream2-pipe-error-once-listener.js b/test/simple/test-stream2-pipe-error-once-listener.js
+index 5e8e3cb..53b2616 100755
+--- a/test/simple/test-stream2-pipe-error-once-listener.js
++++ b/test/simple/test-stream2-pipe-error-once-listener.js
+@@ -24,7 +24,7 @@ var common = require('../common.js');
+ var assert = require('assert');
+
+ var util = require('util');
+-var stream = require('stream');
++var stream = require('../../');
+
+
+ var Read = function() {
+diff --git a/test/simple/test-stream2-push.js b/test/simple/test-stream2-push.js
+index b63edc3..eb2b0e9 100644
+--- a/test/simple/test-stream2-push.js
++++ b/test/simple/test-stream2-push.js
+@@ -20,7 +20,7 @@
+ // USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ var common = require('../common.js');
+-var stream = require('stream');
++var stream = require('../../');
+ var Readable = stream.Readable;
+ var Writable = stream.Writable;
+ var assert = require('assert');
+diff --git a/test/simple/test-stream2-read-sync-stack.js b/test/simple/test-stream2-read-sync-stack.js
+index e8a7305..9740a47 100644
+--- a/test/simple/test-stream2-read-sync-stack.js
++++ b/test/simple/test-stream2-read-sync-stack.js
+@@ -21,7 +21,7 @@
+
+ var common = require('../common');
+ var assert = require('assert');
+-var Readable = require('stream').Readable;
++var Readable = require('../../').Readable;
+ var r = new Readable();
+ var N = 256 * 1024;
+
+diff --git a/test/simple/test-stream2-readable-empty-buffer-no-eof.js b/test/simple/test-stream2-readable-empty-buffer-no-eof.js
+index cd30178..4b1659d 100644
+--- a/test/simple/test-stream2-readable-empty-buffer-no-eof.js
++++ b/test/simple/test-stream2-readable-empty-buffer-no-eof.js
+@@ -22,10 +22,9 @@
+ var common = require('../common');
+ var assert = require('assert');
+
+-var Readable = require('stream').Readable;
++var Readable = require('../../').Readable;
+
+ test1();
+-test2();
+
+ function test1() {
+ var r = new Readable();
+@@ -88,31 +87,3 @@ function test1() {
+ console.log('ok');
+ });
+ }
+-
+-function test2() {
+- var r = new Readable({ encoding: 'base64' });
+- var reads = 5;
+- r._read = function(n) {
+- if (!reads--)
+- return r.push(null); // EOF
+- else
+- return r.push(new Buffer('x'));
+- };
+-
+- var results = [];
+- function flow() {
+- var chunk;
+- while (null !== (chunk = r.read()))
+- results.push(chunk + '');
+- }
+- r.on('readable', flow);
+- r.on('end', function() {
+- results.push('EOF');
+- });
+- flow();
+-
+- process.on('exit', function() {
+- assert.deepEqual(results, [ 'eHh4', 'eHg=', 'EOF' ]);
+- console.log('ok');
+- });
+-}
+diff --git a/test/simple/test-stream2-readable-from-list.js b/test/simple/test-stream2-readable-from-list.js
+index 7c96ffe..04a96f5 100644
+--- a/test/simple/test-stream2-readable-from-list.js
++++ b/test/simple/test-stream2-readable-from-list.js
+@@ -21,7 +21,7 @@
+
+ var assert = require('assert');
+ var common = require('../common.js');
+-var fromList = require('_stream_readable')._fromList;
++var fromList = require('../../lib/_stream_readable')._fromList;
+
+ // tiny node-tap lookalike.
+ var tests = [];
+diff --git a/test/simple/test-stream2-readable-legacy-drain.js b/test/simple/test-stream2-readable-legacy-drain.js
+index 675da8e..51fd3d5 100644
+--- a/test/simple/test-stream2-readable-legacy-drain.js
++++ b/test/simple/test-stream2-readable-legacy-drain.js
+@@ -22,7 +22,7 @@
+ var common = require('../common');
+ var assert = require('assert');
+
+-var Stream = require('stream');
++var Stream = require('../../');
+ var Readable = Stream.Readable;
+
+ var r = new Readable();
+diff --git a/test/simple/test-stream2-readable-non-empty-end.js b/test/simple/test-stream2-readable-non-empty-end.js
+index 7314ae7..c971898 100644
+--- a/test/simple/test-stream2-readable-non-empty-end.js
++++ b/test/simple/test-stream2-readable-non-empty-end.js
+@@ -21,7 +21,7 @@
+
+ var assert = require('assert');
+ var common = require('../common.js');
+-var Readable = require('_stream_readable');
++var Readable = require('../../lib/_stream_readable');
+
+ var len = 0;
+ var chunks = new Array(10);
+diff --git a/test/simple/test-stream2-readable-wrap-empty.js b/test/simple/test-stream2-readable-wrap-empty.js
+index 2e5cf25..fd8a3dc 100644
+--- a/test/simple/test-stream2-readable-wrap-empty.js
++++ b/test/simple/test-stream2-readable-wrap-empty.js
+@@ -22,7 +22,7 @@
+ var common = require('../common');
+ var assert = require('assert');
+
+-var Readable = require('_stream_readable');
++var Readable = require('../../lib/_stream_readable');
+ var EE = require('events').EventEmitter;
+
+ var oldStream = new EE();
+diff --git a/test/simple/test-stream2-readable-wrap.js b/test/simple/test-stream2-readable-wrap.js
+index 90eea01..6b177f7 100644
+--- a/test/simple/test-stream2-readable-wrap.js
++++ b/test/simple/test-stream2-readable-wrap.js
+@@ -22,8 +22,8 @@
+ var common = require('../common');
+ var assert = require('assert');
+
+-var Readable = require('_stream_readable');
+-var Writable = require('_stream_writable');
++var Readable = require('../../lib/_stream_readable');
++var Writable = require('../../lib/_stream_writable');
+ var EE = require('events').EventEmitter;
+
+ var testRuns = 0, completedRuns = 0;
+diff --git a/test/simple/test-stream2-set-encoding.js b/test/simple/test-stream2-set-encoding.js
+index 5d2c32a..685531b 100644
+--- a/test/simple/test-stream2-set-encoding.js
++++ b/test/simple/test-stream2-set-encoding.js
+@@ -22,7 +22,7 @@
+
+ var common = require('../common.js');
+ var assert = require('assert');
+-var R = require('_stream_readable');
++var R = require('../../lib/_stream_readable');
+ var util = require('util');
+
+ // tiny node-tap lookalike.
+diff --git a/test/simple/test-stream2-transform.js b/test/simple/test-stream2-transform.js
+index 9c9ddd8..a0cacc6 100644
+--- a/test/simple/test-stream2-transform.js
++++ b/test/simple/test-stream2-transform.js
+@@ -21,8 +21,8 @@
+
+ var assert = require('assert');
+ var common = require('../common.js');
+-var PassThrough = require('_stream_passthrough');
+-var Transform = require('_stream_transform');
++var PassThrough = require('../../').PassThrough;
++var Transform = require('../../').Transform;
+
+ // tiny node-tap lookalike.
+ var tests = [];
+diff --git a/test/simple/test-stream2-unpipe-drain.js b/test/simple/test-stream2-unpipe-drain.js
+index d66dc3c..365b327 100644
+--- a/test/simple/test-stream2-unpipe-drain.js
++++ b/test/simple/test-stream2-unpipe-drain.js
+@@ -22,7 +22,7 @@
+
+ var common = require('../common.js');
+ var assert = require('assert');
+-var stream = require('stream');
++var stream = require('../../');
+ var crypto = require('crypto');
+
+ var util = require('util');
+diff --git a/test/simple/test-stream2-unpipe-leak.js b/test/simple/test-stream2-unpipe-leak.js
+index 99f8746..17c92ae 100644
+--- a/test/simple/test-stream2-unpipe-leak.js
++++ b/test/simple/test-stream2-unpipe-leak.js
+@@ -22,7 +22,7 @@
+
+ var common = require('../common.js');
+ var assert = require('assert');
+-var stream = require('stream');
++var stream = require('../../');
+
+ var chunk = new Buffer('hallo');
+
+diff --git a/test/simple/test-stream2-writable.js b/test/simple/test-stream2-writable.js
+index 704100c..209c3a6 100644
+--- a/test/simple/test-stream2-writable.js
++++ b/test/simple/test-stream2-writable.js
+@@ -20,8 +20,8 @@
+ // USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ var common = require('../common.js');
+-var W = require('_stream_writable');
+-var D = require('_stream_duplex');
++var W = require('../../').Writable;
++var D = require('../../').Duplex;
+ var assert = require('assert');
+
+ var util = require('util');
+diff --git a/test/simple/test-stream3-pause-then-read.js b/test/simple/test-stream3-pause-then-read.js
+index b91bde3..2f72c15 100644
+--- a/test/simple/test-stream3-pause-then-read.js
++++ b/test/simple/test-stream3-pause-then-read.js
+@@ -22,7 +22,7 @@
+ var common = require('../common');
+ var assert = require('assert');
+
+-var stream = require('stream');
++var stream = require('../../');
+ var Readable = stream.Readable;
+ var Writable = stream.Writable;
diff --git a/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/lib/_stream_duplex.js b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/lib/_stream_duplex.js
new file mode 100644
index 0000000000..b513d61a96
--- /dev/null
+++ b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/lib/_stream_duplex.js
@@ -0,0 +1,89 @@
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// 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.
+
+module.exports = Duplex;
+
+/*<replacement>*/
+var objectKeys = Object.keys || function (obj) {
+ var keys = [];
+ for (var key in obj) keys.push(key);
+ return keys;
+}
+/*</replacement>*/
+
+
+/*<replacement>*/
+var util = require('core-util-is');
+util.inherits = require('inherits');
+/*</replacement>*/
+
+var Readable = require('./_stream_readable');
+var Writable = require('./_stream_writable');
+
+util.inherits(Duplex, Readable);
+
+forEach(objectKeys(Writable.prototype), function(method) {
+ if (!Duplex.prototype[method])
+ Duplex.prototype[method] = Writable.prototype[method];
+});
+
+function Duplex(options) {
+ if (!(this instanceof Duplex))
+ return new Duplex(options);
+
+ Readable.call(this, options);
+ Writable.call(this, options);
+
+ if (options && options.readable === false)
+ this.readable = false;
+
+ if (options && options.writable === false)
+ this.writable = false;
+
+ this.allowHalfOpen = true;
+ if (options && options.allowHalfOpen === false)
+ this.allowHalfOpen = false;
+
+ this.once('end', onend);
+}
+
+// the no-half-open enforcer
+function onend() {
+ // if we allow half-open state, or if the writable side ended,
+ // then we're ok.
+ if (this.allowHalfOpen || this._writableState.ended)
+ return;
+
+ // no more data can be written.
+ // But allow more writes to happen in this tick.
+ process.nextTick(this.end.bind(this));
+}
+
+function forEach (xs, f) {
+ for (var i = 0, l = xs.length; i < l; i++) {
+ f(xs[i], i);
+ }
+}
diff --git a/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/lib/_stream_passthrough.js b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/lib/_stream_passthrough.js
new file mode 100644
index 0000000000..895ca50a1d
--- /dev/null
+++ b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/lib/_stream_passthrough.js
@@ -0,0 +1,46 @@
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// 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.
+
+module.exports = PassThrough;
+
+var Transform = require('./_stream_transform');
+
+/*<replacement>*/
+var util = 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);
+}
+
+PassThrough.prototype._transform = function(chunk, encoding, cb) {
+ cb(null, chunk);
+};
diff --git a/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/lib/_stream_readable.js b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/lib/_stream_readable.js
new file mode 100644
index 0000000000..19ab358898
--- /dev/null
+++ b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/lib/_stream_readable.js
@@ -0,0 +1,951 @@
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// 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.
+
+module.exports = Readable;
+
+/*<replacement>*/
+var isArray = require('isarray');
+/*</replacement>*/
+
+
+/*<replacement>*/
+var Buffer = require('buffer').Buffer;
+/*</replacement>*/
+
+Readable.ReadableState = ReadableState;
+
+var EE = require('events').EventEmitter;
+
+/*<replacement>*/
+if (!EE.listenerCount) EE.listenerCount = function(emitter, type) {
+ return emitter.listeners(type).length;
+};
+/*</replacement>*/
+
+var Stream = require('stream');
+
+/*<replacement>*/
+var util = require('core-util-is');
+util.inherits = require('inherits');
+/*</replacement>*/
+
+var StringDecoder;
+
+
+/*<replacement>*/
+var debug = require('util');
+if (debug && debug.debuglog) {
+ debug = debug.debuglog('stream');
+} else {
+ debug = function () {};
+}
+/*</replacement>*/
+
+
+util.inherits(Readable, Stream);
+
+function ReadableState(options, stream) {
+ var Duplex = require('./_stream_duplex');
+
+ options = options || {};
+
+ // 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 defaultHwm = options.objectMode ? 16 : 16 * 1024;
+ this.highWaterMark = (hwm || hwm === 0) ? hwm : defaultHwm;
+
+ // cast to ints.
+ this.highWaterMark = ~~this.highWaterMark;
+
+ this.buffer = [];
+ this.length = 0;
+ this.pipes = null;
+ this.pipesCount = 0;
+ this.flowing = null;
+ this.ended = false;
+ this.endEmitted = false;
+ this.reading = false;
+
+ // 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;
+
+ // 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;
+
+
+ // 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 (stream instanceof Duplex)
+ this.objectMode = this.objectMode || !!options.readableObjectMode;
+
+ // 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';
+
+ // when piping, we only care about 'readable' events that happen
+ // after read()ing all the bytes and not getting any pushback.
+ this.ranOut = false;
+
+ // 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);
+ this.encoding = options.encoding;
+ }
+}
+
+function Readable(options) {
+ var Duplex = require('./_stream_duplex');
+
+ if (!(this instanceof Readable))
+ return new Readable(options);
+
+ this._readableState = new ReadableState(options, this);
+
+ // legacy
+ this.readable = true;
+
+ Stream.call(this);
+}
+
+// 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;
+
+ if (util.isString(chunk) && !state.objectMode) {
+ encoding = encoding || state.defaultEncoding;
+ if (encoding !== state.encoding) {
+ chunk = new Buffer(chunk, encoding);
+ encoding = '';
+ }
+ }
+
+ return readableAddChunk(this, state, chunk, encoding, false);
+};
+
+// Unshift should *always* be something directly out of read()
+Readable.prototype.unshift = function(chunk) {
+ var state = this._readableState;
+ return readableAddChunk(this, state, chunk, '', true);
+};
+
+function readableAddChunk(stream, state, chunk, encoding, addToFront) {
+ var er = chunkInvalid(state, chunk);
+ if (er) {
+ stream.emit('error', er);
+ } else if (util.isNullOrUndefined(chunk)) {
+ state.reading = false;
+ if (!state.ended)
+ onEofChunk(stream, state);
+ } else if (state.objectMode || chunk && chunk.length > 0) {
+ if (state.ended && !addToFront) {
+ var e = new Error('stream.push() after EOF');
+ stream.emit('error', e);
+ } else if (state.endEmitted && addToFront) {
+ var e = new Error('stream.unshift() after end event');
+ stream.emit('error', e);
+ } else {
+ if (state.decoder && !addToFront && !encoding)
+ chunk = state.decoder.write(chunk);
+
+ if (!addToFront)
+ state.reading = false;
+
+ // if we want the data now, just emit it.
+ if (state.flowing && state.length === 0 && !state.sync) {
+ 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);
+ }
+ } else if (!addToFront) {
+ state.reading = false;
+ }
+
+ return needMoreData(state);
+}
+
+
+
+// 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);
+}
+
+// backwards compatibility.
+Readable.prototype.setEncoding = function(enc) {
+ if (!StringDecoder)
+ StringDecoder = require('string_decoder/').StringDecoder;
+ this._readableState.decoder = new StringDecoder(enc);
+ this._readableState.encoding = enc;
+ return this;
+};
+
+// Don't raise the hwm > 128MB
+var MAX_HWM = 0x800000;
+function roundUpToNextPowerOf2(n) {
+ if (n >= MAX_HWM) {
+ n = MAX_HWM;
+ } else {
+ // Get the next highest power of 2
+ n--;
+ for (var p = 1; p < 32; p <<= 1) n |= n >> p;
+ n++;
+ }
+ return n;
+}
+
+function howMuchToRead(n, state) {
+ if (state.length === 0 && state.ended)
+ return 0;
+
+ if (state.objectMode)
+ return n === 0 ? 0 : 1;
+
+ if (isNaN(n) || util.isNull(n)) {
+ // only flow one buffer at a time
+ if (state.flowing && state.buffer.length)
+ return state.buffer[0].length;
+ else
+ return state.length;
+ }
+
+ if (n <= 0)
+ return 0;
+
+ // If we're asking for more than the target buffer level,
+ // then raise the water mark. Bump up to the next highest
+ // power of 2, to prevent increasing it excessively in tiny
+ // amounts.
+ if (n > state.highWaterMark)
+ state.highWaterMark = roundUpToNextPowerOf2(n);
+
+ // don't have that much. return null, unless we've ended.
+ if (n > state.length) {
+ if (!state.ended) {
+ state.needReadable = true;
+ return 0;
+ } else
+ return state.length;
+ }
+
+ return n;
+}
+
+// you can override either this method, or the async _read(n) below.
+Readable.prototype.read = function(n) {
+ debug('read', n);
+ var state = this._readableState;
+ var nOrig = n;
+
+ if (!util.isNumber(n) || 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.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.
+ if (n === 0 && state.ended) {
+ if (state.length === 0)
+ endReadable(this);
+ return null;
+ }
+
+ // 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
+ // the state of the read buffer, providing enough data when
+ // before there was *not* enough.
+ //
+ // So, the steps are:
+ // 1. Figure out what the state of things will be after we do
+ // a read from the buffer.
+ //
+ // 2. If that resulting state will trigger a _read, then call _read.
+ // Note that this may be asynchronous, or synchronous. Yes, it is
+ // deeply ugly to write APIs this way, but that still doesn't mean
+ // that the Readable class should behave improperly, as streams are
+ // designed to be sync/async agnostic.
+ // Take note if the _read call is sync or async (ie, if the read call
+ // has returned yet), so that we know whether or not it's safe to emit
+ // '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.
+ var doRead = state.needReadable;
+ 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.
+ if (state.ended || state.reading) {
+ doRead = false;
+ debug('reading or ended', doRead);
+ }
+
+ 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
+ this._read(state.highWaterMark);
+ 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 (doRead && !state.reading)
+ n = howMuchToRead(nOrig, state);
+
+ var ret;
+ if (n > 0)
+ ret = fromList(n, state);
+ else
+ ret = null;
+
+ if (util.isNull(ret)) {
+ state.needReadable = true;
+ n = 0;
+ }
+
+ state.length -= n;
+
+ // If we have nothing in the buffer, then we want to know
+ // as soon as we *do* get something into the buffer.
+ if (state.length === 0 && !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 && state.length === 0)
+ endReadable(this);
+
+ if (!util.isNull(ret))
+ this.emit('data', ret);
+
+ return ret;
+};
+
+function chunkInvalid(state, chunk) {
+ var er = null;
+ if (!util.isBuffer(chunk) &&
+ !util.isString(chunk) &&
+ !util.isNullOrUndefined(chunk) &&
+ !state.objectMode) {
+ er = new TypeError('Invalid non-string/buffer chunk');
+ }
+ return er;
+}
+
+
+function onEofChunk(stream, state) {
+ if (state.decoder && !state.ended) {
+ var chunk = state.decoder.end();
+ if (chunk && chunk.length) {
+ state.buffer.push(chunk);
+ state.length += state.objectMode ? 1 : chunk.length;
+ }
+ }
+ state.ended = true;
+
+ // emit 'readable' now to make sure it gets picked up.
+ emitReadable(stream);
+}
+
+// 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;
+ state.needReadable = false;
+ if (!state.emittedReadable) {
+ debug('emitReadable', state.flowing);
+ state.emittedReadable = true;
+ if (state.sync)
+ process.nextTick(function() {
+ emitReadable_(stream);
+ });
+ else
+ emitReadable_(stream);
+ }
+}
+
+function emitReadable_(stream) {
+ debug('emit readable');
+ stream.emit('readable');
+ flow(stream);
+}
+
+
+// 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(function() {
+ maybeReadMore_(stream, state);
+ });
+ }
+}
+
+function maybeReadMore_(stream, state) {
+ 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;
+ else
+ len = state.length;
+ }
+ state.readingMore = false;
+}
+
+// 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) {
+ this.emit('error', new Error('not implemented'));
+};
+
+Readable.prototype.pipe = function(dest, pipeOpts) {
+ var src = this;
+ var state = this._readableState;
+
+ switch (state.pipesCount) {
+ 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 : cleanup;
+ if (state.endEmitted)
+ process.nextTick(endFn);
+ else
+ src.once('end', endFn);
+
+ dest.on('unpipe', onunpipe);
+ function onunpipe(readable) {
+ debug('onunpipe');
+ if (readable === src) {
+ cleanup();
+ }
+ }
+
+ function onend() {
+ debug('onend');
+ dest.end();
+ }
+
+ // 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);
+
+ function cleanup() {
+ debug('cleanup');
+ // cleanup event handlers once the pipe is broken
+ dest.removeListener('close', onclose);
+ dest.removeListener('finish', onfinish);
+ dest.removeListener('drain', ondrain);
+ dest.removeListener('error', onerror);
+ dest.removeListener('unpipe', onunpipe);
+ src.removeListener('end', onend);
+ src.removeListener('end', cleanup);
+ src.removeListener('data', ondata);
+
+ // 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();
+ }
+
+ src.on('data', ondata);
+ function ondata(chunk) {
+ debug('ondata');
+ var ret = dest.write(chunk);
+ if (false === ret) {
+ debug('false write response, pause',
+ src._readableState.awaitDrain);
+ src._readableState.awaitDrain++;
+ src.pause();
+ }
+ }
+
+ // 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 (EE.listenerCount(dest, 'error') === 0)
+ dest.emit('error', er);
+ }
+ // This is a brutally ugly hack to make sure that our error handler
+ // is attached before any userland ones. NEVER DO THIS.
+ if (!dest._events || !dest._events.error)
+ dest.on('error', onerror);
+ else if (isArray(dest._events.error))
+ dest._events.error.unshift(onerror);
+ else
+ dest._events.error = [onerror, dest._events.error];
+
+
+
+ // 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.
+ if (!state.flowing) {
+ debug('pipe resume');
+ src.resume();
+ }
+
+ return dest;
+};
+
+function pipeOnDrain(src) {
+ return function() {
+ var state = src._readableState;
+ debug('pipeOnDrain', state.awaitDrain);
+ if (state.awaitDrain)
+ state.awaitDrain--;
+ if (state.awaitDrain === 0 && EE.listenerCount(src, 'data')) {
+ state.flowing = true;
+ flow(src);
+ }
+ };
+}
+
+
+Readable.prototype.unpipe = function(dest) {
+ var state = this._readableState;
+
+ // 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.
+ state.pipes = null;
+ state.pipesCount = 0;
+ state.flowing = false;
+ if (dest)
+ dest.emit('unpipe', this);
+ return this;
+ }
+
+ // slow case. multiple pipe destinations.
+
+ if (!dest) {
+ // remove all.
+ var dests = state.pipes;
+ var len = state.pipesCount;
+ state.pipes = null;
+ state.pipesCount = 0;
+ state.flowing = false;
+
+ for (var i = 0; i < len; i++)
+ dests[i].emit('unpipe', this);
+ return this;
+ }
+
+ // try to find the right one.
+ var i = indexOf(state.pipes, dest);
+ if (i === -1)
+ return this;
+
+ state.pipes.splice(i, 1);
+ state.pipesCount -= 1;
+ if (state.pipesCount === 1)
+ state.pipes = state.pipes[0];
+
+ dest.emit('unpipe', this);
+
+ 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);
+
+ // If listening to data, and it has not explicitly been paused,
+ // then call resume to start the flow of data on the next tick.
+ if (ev === 'data' && false !== this._readableState.flowing) {
+ this.resume();
+ }
+
+ if (ev === 'readable' && this.readable) {
+ var state = this._readableState;
+ if (!state.readableListening) {
+ state.readableListening = true;
+ state.emittedReadable = false;
+ state.needReadable = true;
+ if (!state.reading) {
+ var self = this;
+ process.nextTick(function() {
+ debug('readable nexttick read 0');
+ self.read(0);
+ });
+ } else if (state.length) {
+ emitReadable(this, state);
+ }
+ }
+ }
+
+ return res;
+};
+Readable.prototype.addListener = Readable.prototype.on;
+
+// 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');
+ state.flowing = true;
+ if (!state.reading) {
+ debug('resume read 0');
+ this.read(0);
+ }
+ resume(this, state);
+ }
+ return this;
+};
+
+function resume(stream, state) {
+ if (!state.resumeScheduled) {
+ state.resumeScheduled = true;
+ process.nextTick(function() {
+ resume_(stream, state);
+ });
+ }
+}
+
+function resume_(stream, state) {
+ state.resumeScheduled = false;
+ stream.emit('resume');
+ flow(stream);
+ if (state.flowing && !state.reading)
+ stream.read(0);
+}
+
+Readable.prototype.pause = function() {
+ debug('call pause flowing=%j', this._readableState.flowing);
+ if (false !== this._readableState.flowing) {
+ debug('pause');
+ this._readableState.flowing = false;
+ this.emit('pause');
+ }
+ return this;
+};
+
+function flow(stream) {
+ var state = stream._readableState;
+ debug('flow', state.flowing);
+ if (state.flowing) {
+ do {
+ var chunk = stream.read();
+ } while (null !== chunk && state.flowing);
+ }
+}
+
+// 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 state = this._readableState;
+ var paused = false;
+
+ var self = this;
+ stream.on('end', function() {
+ debug('wrapped end');
+ if (state.decoder && !state.ended) {
+ var chunk = state.decoder.end();
+ if (chunk && chunk.length)
+ self.push(chunk);
+ }
+
+ self.push(null);
+ });
+
+ stream.on('data', function(chunk) {
+ debug('wrapped data');
+ if (state.decoder)
+ chunk = state.decoder.write(chunk);
+ if (!chunk || !state.objectMode && !chunk.length)
+ return;
+
+ var ret = self.push(chunk);
+ if (!ret) {
+ paused = true;
+ stream.pause();
+ }
+ });
+
+ // proxy all the other methods.
+ // important when wrapping filters and duplexes.
+ for (var i in stream) {
+ if (util.isFunction(stream[i]) && util.isUndefined(this[i])) {
+ this[i] = function(method) { return function() {
+ return stream[method].apply(stream, arguments);
+ }}(i);
+ }
+ }
+
+ // proxy certain important events.
+ var events = ['error', 'close', 'destroy', 'pause', 'resume'];
+ forEach(events, function(ev) {
+ stream.on(ev, self.emit.bind(self, ev));
+ });
+
+ // when we try to consume some more bytes, simply unpause the
+ // underlying stream.
+ self._read = function(n) {
+ debug('wrapped _read', n);
+ if (paused) {
+ paused = false;
+ stream.resume();
+ }
+ };
+
+ return self;
+};
+
+
+
+// exposed for testing purposes only.
+Readable._fromList = fromList;
+
+// Pluck off n bytes from an array of buffers.
+// Length is the combined lengths of all the buffers in the list.
+function fromList(n, state) {
+ var list = state.buffer;
+ var length = state.length;
+ var stringMode = !!state.decoder;
+ var objectMode = !!state.objectMode;
+ var ret;
+
+ // nothing in the list, definitely empty.
+ if (list.length === 0)
+ return null;
+
+ if (length === 0)
+ ret = null;
+ else if (objectMode)
+ ret = list.shift();
+ else if (!n || n >= length) {
+ // read it all, truncate the array.
+ if (stringMode)
+ ret = list.join('');
+ else
+ ret = Buffer.concat(list, length);
+ list.length = 0;
+ } else {
+ // read just some of it.
+ if (n < list[0].length) {
+ // just take a part of the first list item.
+ // slice is the same for buffers and strings.
+ var buf = list[0];
+ ret = buf.slice(0, n);
+ list[0] = buf.slice(n);
+ } else if (n === list[0].length) {
+ // first list is a perfect match
+ ret = list.shift();
+ } else {
+ // complex case.
+ // we have enough to cover it, but it spans past the first buffer.
+ if (stringMode)
+ ret = '';
+ else
+ ret = new Buffer(n);
+
+ var c = 0;
+ for (var i = 0, l = list.length; i < l && c < n; i++) {
+ var buf = list[0];
+ var cpy = Math.min(n - c, buf.length);
+
+ if (stringMode)
+ ret += buf.slice(0, cpy);
+ else
+ buf.copy(ret, c, 0, cpy);
+
+ if (cpy < buf.length)
+ list[0] = buf.slice(cpy);
+ else
+ list.shift();
+
+ c += cpy;
+ }
+ }
+ }
+
+ return ret;
+}
+
+function endReadable(stream) {
+ var state = stream._readableState;
+
+ // 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(function() {
+ // Check that we didn't get one last unshift.
+ if (!state.endEmitted && state.length === 0) {
+ state.endEmitted = true;
+ stream.readable = false;
+ stream.emit('end');
+ }
+ });
+ }
+}
+
+function forEach (xs, f) {
+ for (var i = 0, l = xs.length; i < l; i++) {
+ f(xs[i], i);
+ }
+}
+
+function indexOf (xs, x) {
+ for (var i = 0, l = xs.length; i < l; i++) {
+ if (xs[i] === x) return i;
+ }
+ return -1;
+}
diff --git a/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/lib/_stream_transform.js b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/lib/_stream_transform.js
new file mode 100644
index 0000000000..905c5e4507
--- /dev/null
+++ b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/lib/_stream_transform.js
@@ -0,0 +1,209 @@
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// 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
+// some bits pass through, and others are simply ignored. (That would
+// be a valid example of a transform, of course.)
+//
+// While the output is causally related to the input, it's not a
+// necessarily symmetric or synchronous transformation. For example,
+// a zlib stream might take multiple plain-text writes(), and then
+// emit a single compressed chunk some time in the future.
+//
+// Here's how this works:
+//
+// The Transform stream has all the aspects of the readable and writable
+// stream classes. When you write(chunk), that calls _write(chunk,cb)
+// internally, and returns false if there's a lot of pending writes
+// buffered up. When you call read(), that calls _read(n) until
+// there's enough pending readable data buffered up.
+//
+// In a transform stream, the written data is placed in a buffer. When
+// _read(n) is called, it transforms the queued up data, calling the
+// buffered _write cb's as it consumes chunks. If consuming a single
+// written chunk would result in multiple output chunks, then the first
+// outputted bit calls the readcb, and subsequent chunks just go into
+// the read buffer, and will cause it to emit 'readable' if necessary.
+//
+// This way, back-pressure is actually determined by the reading side,
+// since _read has to be called to start processing a new chunk. However,
+// a pathological inflate type of transform can cause excessive buffering
+// here. For example, imagine a stream where every byte of input is
+// interpreted as an integer from 0-255, and then results in that many
+// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in
+// 1kb of data being output. In this case, you could write a very small
+// amount of input, and end up with a very large amount of output. In
+// such a pathological inflating mechanism, there'd be no way to tell
+// the system to stop doing the transform. A single 4MB write could
+// cause the system to run out of memory.
+//
+// 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.
+
+module.exports = Transform;
+
+var Duplex = require('./_stream_duplex');
+
+/*<replacement>*/
+var util = require('core-util-is');
+util.inherits = require('inherits');
+/*</replacement>*/
+
+util.inherits(Transform, Duplex);
+
+
+function TransformState(options, stream) {
+ this.afterTransform = function(er, data) {
+ return afterTransform(stream, er, data);
+ };
+
+ this.needTransform = false;
+ this.transforming = false;
+ this.writecb = null;
+ this.writechunk = null;
+}
+
+function afterTransform(stream, er, data) {
+ var ts = stream._transformState;
+ ts.transforming = false;
+
+ var cb = ts.writecb;
+
+ if (!cb)
+ return stream.emit('error', new Error('no writecb in Transform class'));
+
+ ts.writechunk = null;
+ ts.writecb = null;
+
+ if (!util.isNullOrUndefined(data))
+ stream.push(data);
+
+ if (cb)
+ cb(er);
+
+ var rs = stream._readableState;
+ rs.reading = false;
+ if (rs.needReadable || rs.length < rs.highWaterMark) {
+ stream._read(rs.highWaterMark);
+ }
+}
+
+
+function Transform(options) {
+ if (!(this instanceof Transform))
+ return new Transform(options);
+
+ Duplex.call(this, options);
+
+ this._transformState = new TransformState(options, this);
+
+ // when the writable side finishes, then flush out anything remaining.
+ var stream = this;
+
+ // start out asking for a readable event once data is transformed.
+ this._readableState.needReadable = true;
+
+ // 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;
+
+ this.once('prefinish', function() {
+ if (util.isFunction(this._flush))
+ this._flush(function(er) {
+ done(stream, er);
+ });
+ else
+ done(stream);
+ });
+}
+
+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!
+// override this function in implementation classes.
+// 'chunk' is an input chunk.
+//
+// Call `push(newChunk)` to pass along transformed output
+// to the readable side. You may call 'push' zero or more times.
+//
+// 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) {
+ throw new Error('not implemented');
+};
+
+Transform.prototype._write = function(chunk, encoding, cb) {
+ var ts = this._transformState;
+ 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.
+// _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 (!util.isNull(ts.writechunk) && 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
+ // will get processed, now that we've asked for it.
+ ts.needTransform = true;
+ }
+};
+
+
+function done(stream, er) {
+ if (er)
+ return stream.emit('error', er);
+
+ // if there's nothing in the write buffer, then that means
+ // that nothing more will ever be provided
+ var ws = stream._writableState;
+ var ts = stream._transformState;
+
+ if (ws.length)
+ throw new Error('calling transform done when ws.length != 0');
+
+ if (ts.transforming)
+ throw new Error('calling transform done when still transforming');
+
+ return stream.push(null);
+}
diff --git a/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/lib/_stream_writable.js b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/lib/_stream_writable.js
new file mode 100644
index 0000000000..db8539cd5b
--- /dev/null
+++ b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/lib/_stream_writable.js
@@ -0,0 +1,477 @@
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// 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, cb), and it'll handle all
+// the drain event emission and buffering.
+
+module.exports = Writable;
+
+/*<replacement>*/
+var Buffer = require('buffer').Buffer;
+/*</replacement>*/
+
+Writable.WritableState = WritableState;
+
+
+/*<replacement>*/
+var util = require('core-util-is');
+util.inherits = require('inherits');
+/*</replacement>*/
+
+var Stream = require('stream');
+
+util.inherits(Writable, Stream);
+
+function WriteReq(chunk, encoding, cb) {
+ this.chunk = chunk;
+ this.encoding = encoding;
+ this.callback = cb;
+}
+
+function WritableState(options, stream) {
+ var Duplex = require('./_stream_duplex');
+
+ options = options || {};
+
+ // 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 defaultHwm = options.objectMode ? 16 : 16 * 1024;
+ this.highWaterMark = (hwm || hwm === 0) ? hwm : defaultHwm;
+
+ // object stream flag to indicate whether or not this stream
+ // contains buffers or objects.
+ this.objectMode = !!options.objectMode;
+
+ if (stream instanceof Duplex)
+ this.objectMode = this.objectMode || !!options.writableObjectMode;
+
+ // cast to ints.
+ this.highWaterMark = ~~this.highWaterMark;
+
+ 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;
+
+ // 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
+ // encoding is 'binary' so we have to make this configurable.
+ // Everything else in the universe uses 'utf8', though.
+ this.defaultEncoding = options.defaultEncoding || 'utf8';
+
+ // 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;
+
+ // a flag to see when we're in the middle of a write.
+ this.writing = false;
+
+ // when true all writes will be buffered until .uncork() call
+ this.corked = 0;
+
+ // 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;
+
+ // 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;
+
+ // 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.
+ this.writelen = 0;
+
+ this.buffer = [];
+
+ // number of pending user-supplied write callbacks
+ // this must be 0 before 'finish' can be emitted
+ this.pendingcb = 0;
+
+ // emit prefinish if the only thing we're waiting for is _write cbs
+ // This is relevant for synchronous Transform streams
+ this.prefinished = false;
+
+ // True if the error was already emitted and should not be thrown again
+ this.errorEmitted = false;
+}
+
+function Writable(options) {
+ var Duplex = require('./_stream_duplex');
+
+ // Writable ctor is applied to Duplexes, though they're not
+ // instanceof Writable, they're instanceof Readable.
+ if (!(this instanceof Writable) && !(this instanceof Duplex))
+ return new Writable(options);
+
+ this._writableState = new WritableState(options, this);
+
+ // legacy.
+ this.writable = true;
+
+ Stream.call(this);
+}
+
+// Otherwise people can pipe Writable streams, which is just wrong.
+Writable.prototype.pipe = function() {
+ this.emit('error', new Error('Cannot pipe. Not readable.'));
+};
+
+
+function writeAfterEnd(stream, state, cb) {
+ var er = new Error('write after end');
+ // TODO: defer error events consistently everywhere, not just the cb
+ stream.emit('error', er);
+ process.nextTick(function() {
+ cb(er);
+ });
+}
+
+// If we get something that is not a buffer, string, null, or undefined,
+// and we're not in objectMode, then that's an error.
+// Otherwise stream chunks are all considered to be of length=1, and the
+// watermarks determine how many objects to keep in the buffer, rather than
+// how many bytes or characters.
+function validChunk(stream, state, chunk, cb) {
+ var valid = true;
+ if (!util.isBuffer(chunk) &&
+ !util.isString(chunk) &&
+ !util.isNullOrUndefined(chunk) &&
+ !state.objectMode) {
+ var er = new TypeError('Invalid non-string/buffer chunk');
+ stream.emit('error', er);
+ process.nextTick(function() {
+ cb(er);
+ });
+ valid = false;
+ }
+ return valid;
+}
+
+Writable.prototype.write = function(chunk, encoding, cb) {
+ var state = this._writableState;
+ var ret = false;
+
+ if (util.isFunction(encoding)) {
+ cb = encoding;
+ encoding = null;
+ }
+
+ if (util.isBuffer(chunk))
+ encoding = 'buffer';
+ else if (!encoding)
+ encoding = state.defaultEncoding;
+
+ if (!util.isFunction(cb))
+ cb = function() {};
+
+ if (state.ended)
+ writeAfterEnd(this, state, cb);
+ else if (validChunk(this, state, chunk, cb)) {
+ state.pendingcb++;
+ ret = writeOrBuffer(this, state, chunk, encoding, cb);
+ }
+
+ return ret;
+};
+
+Writable.prototype.cork = function() {
+ var state = this._writableState;
+
+ state.corked++;
+};
+
+Writable.prototype.uncork = function() {
+ var state = this._writableState;
+
+ if (state.corked) {
+ state.corked--;
+
+ if (!state.writing &&
+ !state.corked &&
+ !state.finished &&
+ !state.bufferProcessing &&
+ state.buffer.length)
+ clearBuffer(this, state);
+ }
+};
+
+function decodeChunk(state, chunk, encoding) {
+ if (!state.objectMode &&
+ state.decodeStrings !== false &&
+ util.isString(chunk)) {
+ chunk = new Buffer(chunk, encoding);
+ }
+ return chunk;
+}
+
+// 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, chunk, encoding, cb) {
+ chunk = decodeChunk(state, chunk, encoding);
+ if (util.isBuffer(chunk))
+ encoding = 'buffer';
+ 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.
+ if (!ret)
+ state.needDrain = true;
+
+ if (state.writing || state.corked)
+ state.buffer.push(new WriteReq(chunk, encoding, cb));
+ else
+ doWrite(stream, state, false, len, chunk, encoding, cb);
+
+ return ret;
+}
+
+function doWrite(stream, state, writev, len, chunk, encoding, cb) {
+ state.writelen = len;
+ state.writecb = cb;
+ state.writing = true;
+ state.sync = true;
+ if (writev)
+ stream._writev(chunk, state.onwrite);
+ else
+ stream._write(chunk, encoding, state.onwrite);
+ state.sync = false;
+}
+
+function onwriteError(stream, state, sync, er, cb) {
+ if (sync)
+ process.nextTick(function() {
+ state.pendingcb--;
+ cb(er);
+ });
+ else {
+ state.pendingcb--;
+ cb(er);
+ }
+
+ stream._writableState.errorEmitted = true;
+ stream.emit('error', er);
+}
+
+function onwriteStateUpdate(state) {
+ state.writing = false;
+ state.writecb = null;
+ state.length -= state.writelen;
+ state.writelen = 0;
+}
+
+function onwrite(stream, er) {
+ var state = stream._writableState;
+ var sync = state.sync;
+ var cb = state.writecb;
+
+ 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(stream, state);
+
+ if (!finished &&
+ !state.corked &&
+ !state.bufferProcessing &&
+ state.buffer.length) {
+ clearBuffer(stream, state);
+ }
+
+ if (sync) {
+ process.nextTick(function() {
+ afterWrite(stream, state, finished, cb);
+ });
+ } else {
+ afterWrite(stream, state, finished, cb);
+ }
+ }
+}
+
+function afterWrite(stream, state, finished, cb) {
+ if (!finished)
+ onwriteDrain(stream, state);
+ state.pendingcb--;
+ cb();
+ finishMaybe(stream, state);
+}
+
+// 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
+function clearBuffer(stream, state) {
+ state.bufferProcessing = true;
+
+ if (stream._writev && state.buffer.length > 1) {
+ // Fast case, write everything using _writev()
+ var cbs = [];
+ for (var c = 0; c < state.buffer.length; c++)
+ cbs.push(state.buffer[c].callback);
+
+ // count the one we are adding, as well.
+ // TODO(isaacs) clean this up
+ state.pendingcb++;
+ doWrite(stream, state, true, state.length, state.buffer, '', function(err) {
+ for (var i = 0; i < cbs.length; i++) {
+ state.pendingcb--;
+ cbs[i](err);
+ }
+ });
+
+ // Clear buffer
+ state.buffer = [];
+ } else {
+ // Slow case, write chunks one-by-one
+ for (var c = 0; c < state.buffer.length; c++) {
+ var entry = state.buffer[c];
+ var chunk = entry.chunk;
+ var encoding = entry.encoding;
+ var cb = entry.callback;
+ var len = state.objectMode ? 1 : chunk.length;
+
+ doWrite(stream, state, false, len, chunk, encoding, cb);
+
+ // 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) {
+ c++;
+ break;
+ }
+ }
+
+ if (c < state.buffer.length)
+ state.buffer = state.buffer.slice(c);
+ else
+ state.buffer.length = 0;
+ }
+
+ state.bufferProcessing = false;
+}
+
+Writable.prototype._write = function(chunk, encoding, cb) {
+ cb(new Error('not implemented'));
+
+};
+
+Writable.prototype._writev = null;
+
+Writable.prototype.end = function(chunk, encoding, cb) {
+ var state = this._writableState;
+
+ if (util.isFunction(chunk)) {
+ cb = chunk;
+ chunk = null;
+ encoding = null;
+ } else if (util.isFunction(encoding)) {
+ cb = encoding;
+ encoding = null;
+ }
+
+ if (!util.isNullOrUndefined(chunk))
+ this.write(chunk, encoding);
+
+ // .end() fully uncorks
+ if (state.corked) {
+ state.corked = 1;
+ this.uncork();
+ }
+
+ // ignore unnecessary end() calls.
+ if (!state.ending && !state.finished)
+ endWritable(this, state, cb);
+};
+
+
+function needFinish(stream, state) {
+ return (state.ending &&
+ state.length === 0 &&
+ !state.finished &&
+ !state.writing);
+}
+
+function prefinish(stream, state) {
+ if (!state.prefinished) {
+ state.prefinished = true;
+ stream.emit('prefinish');
+ }
+}
+
+function finishMaybe(stream, state) {
+ var need = needFinish(stream, state);
+ if (need) {
+ if (state.pendingcb === 0) {
+ prefinish(stream, state);
+ state.finished = true;
+ stream.emit('finish');
+ } else
+ prefinish(stream, state);
+ }
+ 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);
+ }
+ state.ended = true;
+}
diff --git a/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/core-util-is/LICENSE b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/core-util-is/LICENSE
new file mode 100644
index 0000000000..d8d7f9437d
--- /dev/null
+++ b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/core-util-is/LICENSE
@@ -0,0 +1,19 @@
+Copyright Node.js contributors. All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to
+deal in the Software without restriction, including without limitation the
+rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+sell copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 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.
diff --git a/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/core-util-is/README.md b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/core-util-is/README.md
new file mode 100644
index 0000000000..5a76b4149c
--- /dev/null
+++ b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/core-util-is/README.md
@@ -0,0 +1,3 @@
+# core-util-is
+
+The `util.is*` functions introduced in Node v0.12.
diff --git a/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/core-util-is/float.patch b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/core-util-is/float.patch
new file mode 100644
index 0000000000..a06d5c05f7
--- /dev/null
+++ b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/core-util-is/float.patch
@@ -0,0 +1,604 @@
+diff --git a/lib/util.js b/lib/util.js
+index a03e874..9074e8e 100644
+--- a/lib/util.js
++++ b/lib/util.js
+@@ -19,430 +19,6 @@
+ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ // USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+-var formatRegExp = /%[sdj%]/g;
+-exports.format = function(f) {
+- if (!isString(f)) {
+- var objects = [];
+- for (var i = 0; i < arguments.length; i++) {
+- objects.push(inspect(arguments[i]));
+- }
+- return objects.join(' ');
+- }
+-
+- var i = 1;
+- var args = arguments;
+- var len = args.length;
+- var str = String(f).replace(formatRegExp, function(x) {
+- if (x === '%%') return '%';
+- if (i >= len) return x;
+- switch (x) {
+- case '%s': return String(args[i++]);
+- case '%d': return Number(args[i++]);
+- case '%j':
+- try {
+- return JSON.stringify(args[i++]);
+- } catch (_) {
+- return '[Circular]';
+- }
+- default:
+- return x;
+- }
+- });
+- for (var x = args[i]; i < len; x = args[++i]) {
+- if (isNull(x) || !isObject(x)) {
+- str += ' ' + x;
+- } else {
+- str += ' ' + inspect(x);
+- }
+- }
+- return str;
+-};
+-
+-
+-// Mark that a method should not be used.
+-// Returns a modified function which warns once by default.
+-// If --no-deprecation is set, then it is a no-op.
+-exports.deprecate = function(fn, msg) {
+- // Allow for deprecating things in the process of starting up.
+- if (isUndefined(global.process)) {
+- return function() {
+- return exports.deprecate(fn, msg).apply(this, arguments);
+- };
+- }
+-
+- if (process.noDeprecation === true) {
+- return fn;
+- }
+-
+- var warned = false;
+- function deprecated() {
+- if (!warned) {
+- if (process.throwDeprecation) {
+- throw new Error(msg);
+- } else if (process.traceDeprecation) {
+- console.trace(msg);
+- } else {
+- console.error(msg);
+- }
+- warned = true;
+- }
+- return fn.apply(this, arguments);
+- }
+-
+- return deprecated;
+-};
+-
+-
+-var debugs = {};
+-var debugEnviron;
+-exports.debuglog = function(set) {
+- if (isUndefined(debugEnviron))
+- debugEnviron = process.env.NODE_DEBUG || '';
+- set = set.toUpperCase();
+- if (!debugs[set]) {
+- if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
+- var pid = process.pid;
+- debugs[set] = function() {
+- var msg = exports.format.apply(exports, arguments);
+- console.error('%s %d: %s', set, pid, msg);
+- };
+- } else {
+- debugs[set] = function() {};
+- }
+- }
+- return debugs[set];
+-};
+-
+-
+-/**
+- * Echos the value of a value. Trys to print the value out
+- * in the best way possible given the different types.
+- *
+- * @param {Object} obj The object to print out.
+- * @param {Object} opts Optional options object that alters the output.
+- */
+-/* legacy: obj, showHidden, depth, colors*/
+-function inspect(obj, opts) {
+- // default options
+- var ctx = {
+- seen: [],
+- stylize: stylizeNoColor
+- };
+- // legacy...
+- if (arguments.length >= 3) ctx.depth = arguments[2];
+- if (arguments.length >= 4) ctx.colors = arguments[3];
+- if (isBoolean(opts)) {
+- // legacy...
+- ctx.showHidden = opts;
+- } else if (opts) {
+- // got an "options" object
+- exports._extend(ctx, opts);
+- }
+- // set default options
+- if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
+- if (isUndefined(ctx.depth)) ctx.depth = 2;
+- if (isUndefined(ctx.colors)) ctx.colors = false;
+- if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
+- if (ctx.colors) ctx.stylize = stylizeWithColor;
+- return formatValue(ctx, obj, ctx.depth);
+-}
+-exports.inspect = inspect;
+-
+-
+-// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
+-inspect.colors = {
+- 'bold' : [1, 22],
+- 'italic' : [3, 23],
+- 'underline' : [4, 24],
+- 'inverse' : [7, 27],
+- 'white' : [37, 39],
+- 'grey' : [90, 39],
+- 'black' : [30, 39],
+- 'blue' : [34, 39],
+- 'cyan' : [36, 39],
+- 'green' : [32, 39],
+- 'magenta' : [35, 39],
+- 'red' : [31, 39],
+- 'yellow' : [33, 39]
+-};
+-
+-// Don't use 'blue' not visible on cmd.exe
+-inspect.styles = {
+- 'special': 'cyan',
+- 'number': 'yellow',
+- 'boolean': 'yellow',
+- 'undefined': 'grey',
+- 'null': 'bold',
+- 'string': 'green',
+- 'date': 'magenta',
+- // "name": intentionally not styling
+- 'regexp': 'red'
+-};
+-
+-
+-function stylizeWithColor(str, styleType) {
+- var style = inspect.styles[styleType];
+-
+- if (style) {
+- return '\u001b[' + inspect.colors[style][0] + 'm' + str +
+- '\u001b[' + inspect.colors[style][1] + 'm';
+- } else {
+- return str;
+- }
+-}
+-
+-
+-function stylizeNoColor(str, styleType) {
+- return str;
+-}
+-
+-
+-function arrayToHash(array) {
+- var hash = {};
+-
+- array.forEach(function(val, idx) {
+- hash[val] = true;
+- });
+-
+- return hash;
+-}
+-
+-
+-function formatValue(ctx, value, recurseTimes) {
+- // Provide a hook for user-specified inspect functions.
+- // Check that value is an object with an inspect function on it
+- if (ctx.customInspect &&
+- value &&
+- isFunction(value.inspect) &&
+- // Filter out the util module, it's inspect function is special
+- value.inspect !== exports.inspect &&
+- // Also filter out any prototype objects using the circular check.
+- !(value.constructor && value.constructor.prototype === value)) {
+- var ret = value.inspect(recurseTimes, ctx);
+- if (!isString(ret)) {
+- ret = formatValue(ctx, ret, recurseTimes);
+- }
+- return ret;
+- }
+-
+- // Primitive types cannot have properties
+- var primitive = formatPrimitive(ctx, value);
+- if (primitive) {
+- return primitive;
+- }
+-
+- // Look up the keys of the object.
+- var keys = Object.keys(value);
+- var visibleKeys = arrayToHash(keys);
+-
+- if (ctx.showHidden) {
+- keys = Object.getOwnPropertyNames(value);
+- }
+-
+- // Some type of object without properties can be shortcutted.
+- if (keys.length === 0) {
+- if (isFunction(value)) {
+- var name = value.name ? ': ' + value.name : '';
+- return ctx.stylize('[Function' + name + ']', 'special');
+- }
+- if (isRegExp(value)) {
+- return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
+- }
+- if (isDate(value)) {
+- return ctx.stylize(Date.prototype.toString.call(value), 'date');
+- }
+- if (isError(value)) {
+- return formatError(value);
+- }
+- }
+-
+- var base = '', array = false, braces = ['{', '}'];
+-
+- // Make Array say that they are Array
+- if (isArray(value)) {
+- array = true;
+- braces = ['[', ']'];
+- }
+-
+- // Make functions say that they are functions
+- if (isFunction(value)) {
+- var n = value.name ? ': ' + value.name : '';
+- base = ' [Function' + n + ']';
+- }
+-
+- // Make RegExps say that they are RegExps
+- if (isRegExp(value)) {
+- base = ' ' + RegExp.prototype.toString.call(value);
+- }
+-
+- // Make dates with properties first say the date
+- if (isDate(value)) {
+- base = ' ' + Date.prototype.toUTCString.call(value);
+- }
+-
+- // Make error with message first say the error
+- if (isError(value)) {
+- base = ' ' + formatError(value);
+- }
+-
+- if (keys.length === 0 && (!array || value.length == 0)) {
+- return braces[0] + base + braces[1];
+- }
+-
+- if (recurseTimes < 0) {
+- if (isRegExp(value)) {
+- return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
+- } else {
+- return ctx.stylize('[Object]', 'special');
+- }
+- }
+-
+- ctx.seen.push(value);
+-
+- var output;
+- if (array) {
+- output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
+- } else {
+- output = keys.map(function(key) {
+- return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
+- });
+- }
+-
+- ctx.seen.pop();
+-
+- return reduceToSingleString(output, base, braces);
+-}
+-
+-
+-function formatPrimitive(ctx, value) {
+- if (isUndefined(value))
+- return ctx.stylize('undefined', 'undefined');
+- if (isString(value)) {
+- var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
+- .replace(/'/g, "\\'")
+- .replace(/\\"/g, '"') + '\'';
+- return ctx.stylize(simple, 'string');
+- }
+- if (isNumber(value)) {
+- // Format -0 as '-0'. Strict equality won't distinguish 0 from -0,
+- // so instead we use the fact that 1 / -0 < 0 whereas 1 / 0 > 0 .
+- if (value === 0 && 1 / value < 0)
+- return ctx.stylize('-0', 'number');
+- return ctx.stylize('' + value, 'number');
+- }
+- if (isBoolean(value))
+- return ctx.stylize('' + value, 'boolean');
+- // For some reason typeof null is "object", so special case here.
+- if (isNull(value))
+- return ctx.stylize('null', 'null');
+-}
+-
+-
+-function formatError(value) {
+- return '[' + Error.prototype.toString.call(value) + ']';
+-}
+-
+-
+-function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
+- var output = [];
+- for (var i = 0, l = value.length; i < l; ++i) {
+- if (hasOwnProperty(value, String(i))) {
+- output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
+- String(i), true));
+- } else {
+- output.push('');
+- }
+- }
+- keys.forEach(function(key) {
+- if (!key.match(/^\d+$/)) {
+- output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
+- key, true));
+- }
+- });
+- return output;
+-}
+-
+-
+-function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
+- var name, str, desc;
+- desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
+- if (desc.get) {
+- if (desc.set) {
+- str = ctx.stylize('[Getter/Setter]', 'special');
+- } else {
+- str = ctx.stylize('[Getter]', 'special');
+- }
+- } else {
+- if (desc.set) {
+- str = ctx.stylize('[Setter]', 'special');
+- }
+- }
+- if (!hasOwnProperty(visibleKeys, key)) {
+- name = '[' + key + ']';
+- }
+- if (!str) {
+- if (ctx.seen.indexOf(desc.value) < 0) {
+- if (isNull(recurseTimes)) {
+- str = formatValue(ctx, desc.value, null);
+- } else {
+- str = formatValue(ctx, desc.value, recurseTimes - 1);
+- }
+- if (str.indexOf('\n') > -1) {
+- if (array) {
+- str = str.split('\n').map(function(line) {
+- return ' ' + line;
+- }).join('\n').substr(2);
+- } else {
+- str = '\n' + str.split('\n').map(function(line) {
+- return ' ' + line;
+- }).join('\n');
+- }
+- }
+- } else {
+- str = ctx.stylize('[Circular]', 'special');
+- }
+- }
+- if (isUndefined(name)) {
+- if (array && key.match(/^\d+$/)) {
+- return str;
+- }
+- name = JSON.stringify('' + key);
+- if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
+- name = name.substr(1, name.length - 2);
+- name = ctx.stylize(name, 'name');
+- } else {
+- name = name.replace(/'/g, "\\'")
+- .replace(/\\"/g, '"')
+- .replace(/(^"|"$)/g, "'");
+- name = ctx.stylize(name, 'string');
+- }
+- }
+-
+- return name + ': ' + str;
+-}
+-
+-
+-function reduceToSingleString(output, base, braces) {
+- var numLinesEst = 0;
+- var length = output.reduce(function(prev, cur) {
+- numLinesEst++;
+- if (cur.indexOf('\n') >= 0) numLinesEst++;
+- return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
+- }, 0);
+-
+- if (length > 60) {
+- return braces[0] +
+- (base === '' ? '' : base + '\n ') +
+- ' ' +
+- output.join(',\n ') +
+- ' ' +
+- braces[1];
+- }
+-
+- return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
+-}
+-
+-
+ // NOTE: These type checking functions intentionally don't use `instanceof`
+ // because it is fragile and can be easily faked with `Object.create()`.
+ function isArray(ar) {
+@@ -522,166 +98,10 @@ function isPrimitive(arg) {
+ exports.isPrimitive = isPrimitive;
+
+ function isBuffer(arg) {
+- return arg instanceof Buffer;
++ return Buffer.isBuffer(arg);
+ }
+ exports.isBuffer = isBuffer;
+
+ function objectToString(o) {
+ return Object.prototype.toString.call(o);
+-}
+-
+-
+-function pad(n) {
+- return n < 10 ? '0' + n.toString(10) : n.toString(10);
+-}
+-
+-
+-var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
+- 'Oct', 'Nov', 'Dec'];
+-
+-// 26 Feb 16:19:34
+-function timestamp() {
+- var d = new Date();
+- var time = [pad(d.getHours()),
+- pad(d.getMinutes()),
+- pad(d.getSeconds())].join(':');
+- return [d.getDate(), months[d.getMonth()], time].join(' ');
+-}
+-
+-
+-// log is just a thin wrapper to console.log that prepends a timestamp
+-exports.log = function() {
+- console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
+-};
+-
+-
+-/**
+- * Inherit the prototype methods from one constructor into another.
+- *
+- * The Function.prototype.inherits from lang.js rewritten as a standalone
+- * function (not on Function.prototype). NOTE: If this file is to be loaded
+- * during bootstrapping this function needs to be rewritten using some native
+- * functions as prototype setup using normal JavaScript does not work as
+- * expected during bootstrapping (see mirror.js in r114903).
+- *
+- * @param {function} ctor Constructor function which needs to inherit the
+- * prototype.
+- * @param {function} superCtor Constructor function to inherit prototype from.
+- */
+-exports.inherits = function(ctor, superCtor) {
+- ctor.super_ = superCtor;
+- ctor.prototype = Object.create(superCtor.prototype, {
+- constructor: {
+- value: ctor,
+- enumerable: false,
+- writable: true,
+- configurable: true
+- }
+- });
+-};
+-
+-exports._extend = function(origin, add) {
+- // Don't do anything if add isn't an object
+- if (!add || !isObject(add)) return origin;
+-
+- var keys = Object.keys(add);
+- var i = keys.length;
+- while (i--) {
+- origin[keys[i]] = add[keys[i]];
+- }
+- return origin;
+-};
+-
+-function hasOwnProperty(obj, prop) {
+- return Object.prototype.hasOwnProperty.call(obj, prop);
+-}
+-
+-
+-// Deprecated old stuff.
+-
+-exports.p = exports.deprecate(function() {
+- for (var i = 0, len = arguments.length; i < len; ++i) {
+- console.error(exports.inspect(arguments[i]));
+- }
+-}, 'util.p: Use console.error() instead');
+-
+-
+-exports.exec = exports.deprecate(function() {
+- return require('child_process').exec.apply(this, arguments);
+-}, 'util.exec is now called `child_process.exec`.');
+-
+-
+-exports.print = exports.deprecate(function() {
+- for (var i = 0, len = arguments.length; i < len; ++i) {
+- process.stdout.write(String(arguments[i]));
+- }
+-}, 'util.print: Use console.log instead');
+-
+-
+-exports.puts = exports.deprecate(function() {
+- for (var i = 0, len = arguments.length; i < len; ++i) {
+- process.stdout.write(arguments[i] + '\n');
+- }
+-}, 'util.puts: Use console.log instead');
+-
+-
+-exports.debug = exports.deprecate(function(x) {
+- process.stderr.write('DEBUG: ' + x + '\n');
+-}, 'util.debug: Use console.error instead');
+-
+-
+-exports.error = exports.deprecate(function(x) {
+- for (var i = 0, len = arguments.length; i < len; ++i) {
+- process.stderr.write(arguments[i] + '\n');
+- }
+-}, 'util.error: Use console.error instead');
+-
+-
+-exports.pump = exports.deprecate(function(readStream, writeStream, callback) {
+- var callbackCalled = false;
+-
+- function call(a, b, c) {
+- if (callback && !callbackCalled) {
+- callback(a, b, c);
+- callbackCalled = true;
+- }
+- }
+-
+- readStream.addListener('data', function(chunk) {
+- if (writeStream.write(chunk) === false) readStream.pause();
+- });
+-
+- writeStream.addListener('drain', function() {
+- readStream.resume();
+- });
+-
+- readStream.addListener('end', function() {
+- writeStream.end();
+- });
+-
+- readStream.addListener('close', function() {
+- call();
+- });
+-
+- readStream.addListener('error', function(err) {
+- writeStream.end();
+- call(err);
+- });
+-
+- writeStream.addListener('error', function(err) {
+- readStream.destroy();
+- call(err);
+- });
+-}, 'util.pump(): Use readableStream.pipe() instead');
+-
+-
+-var uv;
+-exports._errnoException = function(err, syscall) {
+- if (isUndefined(uv)) uv = process.binding('uv');
+- var errname = uv.errname(err);
+- var e = new Error(syscall + ' ' + errname);
+- e.code = errname;
+- e.errno = errname;
+- e.syscall = syscall;
+- return e;
+-};
++} \ No newline at end of file
diff --git a/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/core-util-is/lib/util.js b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/core-util-is/lib/util.js
new file mode 100644
index 0000000000..ff4c851c07
--- /dev/null
+++ b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/core-util-is/lib/util.js
@@ -0,0 +1,107 @@
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// 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.
+
+// NOTE: These type checking functions intentionally don't use `instanceof`
+// because it is fragile and can be easily faked with `Object.create()`.
+
+function isArray(arg) {
+ if (Array.isArray) {
+ return Array.isArray(arg);
+ }
+ return objectToString(arg) === '[object Array]';
+}
+exports.isArray = isArray;
+
+function isBoolean(arg) {
+ return typeof arg === 'boolean';
+}
+exports.isBoolean = isBoolean;
+
+function isNull(arg) {
+ return arg === null;
+}
+exports.isNull = isNull;
+
+function isNullOrUndefined(arg) {
+ return arg == null;
+}
+exports.isNullOrUndefined = isNullOrUndefined;
+
+function isNumber(arg) {
+ return typeof arg === 'number';
+}
+exports.isNumber = isNumber;
+
+function isString(arg) {
+ return typeof arg === 'string';
+}
+exports.isString = isString;
+
+function isSymbol(arg) {
+ return typeof arg === 'symbol';
+}
+exports.isSymbol = isSymbol;
+
+function isUndefined(arg) {
+ return arg === void 0;
+}
+exports.isUndefined = isUndefined;
+
+function isRegExp(re) {
+ return objectToString(re) === '[object RegExp]';
+}
+exports.isRegExp = isRegExp;
+
+function isObject(arg) {
+ return typeof arg === 'object' && arg !== null;
+}
+exports.isObject = isObject;
+
+function isDate(d) {
+ return objectToString(d) === '[object Date]';
+}
+exports.isDate = isDate;
+
+function isError(e) {
+ return (objectToString(e) === '[object Error]' || e instanceof Error);
+}
+exports.isError = isError;
+
+function isFunction(arg) {
+ return typeof arg === 'function';
+}
+exports.isFunction = isFunction;
+
+function isPrimitive(arg) {
+ return arg === null ||
+ typeof arg === 'boolean' ||
+ typeof arg === 'number' ||
+ typeof arg === 'string' ||
+ typeof arg === 'symbol' || // ES6 symbol
+ typeof arg === 'undefined';
+}
+exports.isPrimitive = isPrimitive;
+
+exports.isBuffer = Buffer.isBuffer;
+
+function objectToString(o) {
+ return Object.prototype.toString.call(o);
+}
diff --git a/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/core-util-is/package.json b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/core-util-is/package.json
new file mode 100644
index 0000000000..38f236aeb0
--- /dev/null
+++ b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/core-util-is/package.json
@@ -0,0 +1,95 @@
+{
+ "_args": [
+ [
+ {
+ "raw": "core-util-is@~1.0.0",
+ "scope": null,
+ "escapedName": "core-util-is",
+ "name": "core-util-is",
+ "rawSpec": "~1.0.0",
+ "spec": ">=1.0.0 <1.1.0",
+ "type": "range"
+ },
+ "/Users/zkat/code/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream"
+ ]
+ ],
+ "_from": "core-util-is@>=1.0.0 <1.1.0",
+ "_id": "core-util-is@1.0.2",
+ "_inCache": true,
+ "_installable": true,
+ "_location": "/sorted-union-stream/from2/readable-stream/core-util-is",
+ "_nodeVersion": "4.0.0",
+ "_npmUser": {
+ "name": "isaacs",
+ "email": "i@izs.me"
+ },
+ "_npmVersion": "3.3.2",
+ "_phantomChildren": {},
+ "_requested": {
+ "raw": "core-util-is@~1.0.0",
+ "scope": null,
+ "escapedName": "core-util-is",
+ "name": "core-util-is",
+ "rawSpec": "~1.0.0",
+ "spec": ">=1.0.0 <1.1.0",
+ "type": "range"
+ },
+ "_requiredBy": [
+ "/sorted-union-stream/from2/readable-stream"
+ ],
+ "_resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
+ "_shasum": "b5fd54220aa2bc5ab57aab7140c940754503c1a7",
+ "_shrinkwrap": null,
+ "_spec": "core-util-is@~1.0.0",
+ "_where": "/Users/zkat/code/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream",
+ "author": {
+ "name": "Isaac Z. Schlueter",
+ "email": "i@izs.me",
+ "url": "http://blog.izs.me/"
+ },
+ "bugs": {
+ "url": "https://github.com/isaacs/core-util-is/issues"
+ },
+ "dependencies": {},
+ "description": "The `util.is*` functions introduced in Node v0.12.",
+ "devDependencies": {
+ "tap": "^2.3.0"
+ },
+ "directories": {},
+ "dist": {
+ "shasum": "b5fd54220aa2bc5ab57aab7140c940754503c1a7",
+ "tarball": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz"
+ },
+ "gitHead": "a177da234df5638b363ddc15fa324619a38577c8",
+ "homepage": "https://github.com/isaacs/core-util-is#readme",
+ "keywords": [
+ "util",
+ "isBuffer",
+ "isArray",
+ "isNumber",
+ "isString",
+ "isRegExp",
+ "isThis",
+ "isThat",
+ "polyfill"
+ ],
+ "license": "MIT",
+ "main": "lib/util.js",
+ "maintainers": [
+ {
+ "name": "isaacs",
+ "email": "i@izs.me"
+ }
+ ],
+ "name": "core-util-is",
+ "optionalDependencies": {},
+ "readme": "ERROR: No README data found!",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/isaacs/core-util-is.git"
+ },
+ "scripts": {
+ "test": "tap test.js"
+ },
+ "version": "1.0.2"
+}
diff --git a/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/core-util-is/test.js b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/core-util-is/test.js
new file mode 100644
index 0000000000..1a490c65ac
--- /dev/null
+++ b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/core-util-is/test.js
@@ -0,0 +1,68 @@
+var assert = require('tap');
+
+var t = require('./lib/util');
+
+assert.equal(t.isArray([]), true);
+assert.equal(t.isArray({}), false);
+
+assert.equal(t.isBoolean(null), false);
+assert.equal(t.isBoolean(true), true);
+assert.equal(t.isBoolean(false), true);
+
+assert.equal(t.isNull(null), true);
+assert.equal(t.isNull(undefined), false);
+assert.equal(t.isNull(false), false);
+assert.equal(t.isNull(), false);
+
+assert.equal(t.isNullOrUndefined(null), true);
+assert.equal(t.isNullOrUndefined(undefined), true);
+assert.equal(t.isNullOrUndefined(false), false);
+assert.equal(t.isNullOrUndefined(), true);
+
+assert.equal(t.isNumber(null), false);
+assert.equal(t.isNumber('1'), false);
+assert.equal(t.isNumber(1), true);
+
+assert.equal(t.isString(null), false);
+assert.equal(t.isString('1'), true);
+assert.equal(t.isString(1), false);
+
+assert.equal(t.isSymbol(null), false);
+assert.equal(t.isSymbol('1'), false);
+assert.equal(t.isSymbol(1), false);
+assert.equal(t.isSymbol(Symbol()), true);
+
+assert.equal(t.isUndefined(null), false);
+assert.equal(t.isUndefined(undefined), true);
+assert.equal(t.isUndefined(false), false);
+assert.equal(t.isUndefined(), true);
+
+assert.equal(t.isRegExp(null), false);
+assert.equal(t.isRegExp('1'), false);
+assert.equal(t.isRegExp(new RegExp()), true);
+
+assert.equal(t.isObject({}), true);
+assert.equal(t.isObject([]), true);
+assert.equal(t.isObject(new RegExp()), true);
+assert.equal(t.isObject(new Date()), true);
+
+assert.equal(t.isDate(null), false);
+assert.equal(t.isDate('1'), false);
+assert.equal(t.isDate(new Date()), true);
+
+assert.equal(t.isError(null), false);
+assert.equal(t.isError({ err: true }), false);
+assert.equal(t.isError(new Error()), true);
+
+assert.equal(t.isFunction(null), false);
+assert.equal(t.isFunction({ }), false);
+assert.equal(t.isFunction(function() {}), true);
+
+assert.equal(t.isPrimitive(null), true);
+assert.equal(t.isPrimitive(''), true);
+assert.equal(t.isPrimitive(0), true);
+assert.equal(t.isPrimitive(new Date()), false);
+
+assert.equal(t.isBuffer(null), false);
+assert.equal(t.isBuffer({}), false);
+assert.equal(t.isBuffer(new Buffer(0)), true);
diff --git a/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/isarray/README.md b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/isarray/README.md
new file mode 100644
index 0000000000..052a62b8d7
--- /dev/null
+++ b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/isarray/README.md
@@ -0,0 +1,54 @@
+
+# isarray
+
+`Array#isArray` for older browsers.
+
+## Usage
+
+```js
+var isArray = require('isarray');
+
+console.log(isArray([])); // => true
+console.log(isArray({})); // => false
+```
+
+## Installation
+
+With [npm](http://npmjs.org) do
+
+```bash
+$ npm install isarray
+```
+
+Then bundle for the browser with
+[browserify](https://github.com/substack/browserify).
+
+With [component](http://component.io) do
+
+```bash
+$ component install juliangruber/isarray
+```
+
+## License
+
+(MIT)
+
+Copyright (c) 2013 Julian Gruber &lt;julian@juliangruber.com&gt;
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 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.
diff --git a/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/isarray/build/build.js b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/isarray/build/build.js
new file mode 100644
index 0000000000..e1856ef094
--- /dev/null
+++ b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/isarray/build/build.js
@@ -0,0 +1,208 @@
+
+/**
+ * Require the given path.
+ *
+ * @param {String} path
+ * @return {Object} exports
+ * @api public
+ */
+
+function require(path, parent, orig) {
+ var resolved = require.resolve(path);
+
+ // lookup failed
+ if (null == resolved) {
+ orig = orig || path;
+ parent = parent || 'root';
+ var err = new Error('Failed to require "' + orig + '" from "' + parent + '"');
+ err.path = orig;
+ err.parent = parent;
+ err.require = true;
+ throw err;
+ }
+
+ var module = require.modules[resolved];
+
+ // perform real require()
+ // by invoking the module's
+ // registered function
+ if (!module.exports) {
+ module.exports = {};
+ module.client = module.component = true;
+ module.call(this, module.exports, require.relative(resolved), module);
+ }
+
+ return module.exports;
+}
+
+/**
+ * Registered modules.
+ */
+
+require.modules = {};
+
+/**
+ * Registered aliases.
+ */
+
+require.aliases = {};
+
+/**
+ * Resolve `path`.
+ *
+ * Lookup:
+ *
+ * - PATH/index.js
+ * - PATH.js
+ * - PATH
+ *
+ * @param {String} path
+ * @return {String} path or null
+ * @api private
+ */
+
+require.resolve = function(path) {
+ if (path.charAt(0) === '/') path = path.slice(1);
+ var index = path + '/index.js';
+
+ var paths = [
+ path,
+ path + '.js',
+ path + '.json',
+ path + '/index.js',
+ path + '/index.json'
+ ];
+
+ for (var i = 0; i < paths.length; i++) {
+ var path = paths[i];
+ if (require.modules.hasOwnProperty(path)) return path;
+ }
+
+ if (require.aliases.hasOwnProperty(index)) {
+ return require.aliases[index];
+ }
+};
+
+/**
+ * Normalize `path` relative to the current path.
+ *
+ * @param {String} curr
+ * @param {String} path
+ * @return {String}
+ * @api private
+ */
+
+require.normalize = function(curr, path) {
+ var segs = [];
+
+ if ('.' != path.charAt(0)) return path;
+
+ curr = curr.split('/');
+ path = path.split('/');
+
+ for (var i = 0; i < path.length; ++i) {
+ if ('..' == path[i]) {
+ curr.pop();
+ } else if ('.' != path[i] && '' != path[i]) {
+ segs.push(path[i]);
+ }
+ }
+
+ return curr.concat(segs).join('/');
+};
+
+/**
+ * Register module at `path` with callback `definition`.
+ *
+ * @param {String} path
+ * @param {Function} definition
+ * @api private
+ */
+
+require.register = function(path, definition) {
+ require.modules[path] = definition;
+};
+
+/**
+ * Alias a module definition.
+ *
+ * @param {String} from
+ * @param {String} to
+ * @api private
+ */
+
+require.alias = function(from, to) {
+ if (!require.modules.hasOwnProperty(from)) {
+ throw new Error('Failed to alias "' + from + '", it does not exist');
+ }
+ require.aliases[to] = from;
+};
+
+/**
+ * Return a require function relative to the `parent` path.
+ *
+ * @param {String} parent
+ * @return {Function}
+ * @api private
+ */
+
+require.relative = function(parent) {
+ var p = require.normalize(parent, '..');
+
+ /**
+ * lastIndexOf helper.
+ */
+
+ function lastIndexOf(arr, obj) {
+ var i = arr.length;
+ while (i--) {
+ if (arr[i] === obj) return i;
+ }
+ return -1;
+ }
+
+ /**
+ * The relative require() itself.
+ */
+
+ function localRequire(path) {
+ var resolved = localRequire.resolve(path);
+ return require(resolved, parent, path);
+ }
+
+ /**
+ * Resolve relative to the parent.
+ */
+
+ localRequire.resolve = function(path) {
+ var c = path.charAt(0);
+ if ('/' == c) return path.slice(1);
+ if ('.' == c) return require.normalize(p, path);
+
+ // resolve deps by returning
+ // the dep in the nearest "deps"
+ // directory
+ var segs = parent.split('/');
+ var i = lastIndexOf(segs, 'deps') + 1;
+ if (!i) i = 0;
+ path = segs.slice(0, i + 1).join('/') + '/deps/' + path;
+ return path;
+ };
+
+ /**
+ * Check if module is defined at `path`.
+ */
+
+ localRequire.exists = function(path) {
+ return require.modules.hasOwnProperty(localRequire.resolve(path));
+ };
+
+ return localRequire;
+};
+require.register("isarray/index.js", function(exports, require, module){
+module.exports = Array.isArray || function (arr) {
+ return Object.prototype.toString.call(arr) == '[object Array]';
+};
+
+});
+require.alias("isarray/index.js", "isarray/index.js");
diff --git a/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/isarray/component.json b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/isarray/component.json
new file mode 100644
index 0000000000..9e31b68388
--- /dev/null
+++ b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/isarray/component.json
@@ -0,0 +1,19 @@
+{
+ "name" : "isarray",
+ "description" : "Array#isArray for older browsers",
+ "version" : "0.0.1",
+ "repository" : "juliangruber/isarray",
+ "homepage": "https://github.com/juliangruber/isarray",
+ "main" : "index.js",
+ "scripts" : [
+ "index.js"
+ ],
+ "dependencies" : {},
+ "keywords": ["browser","isarray","array"],
+ "author": {
+ "name": "Julian Gruber",
+ "email": "mail@juliangruber.com",
+ "url": "http://juliangruber.com"
+ },
+ "license": "MIT"
+}
diff --git a/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/isarray/index.js b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/isarray/index.js
new file mode 100644
index 0000000000..5f5ad45d46
--- /dev/null
+++ b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/isarray/index.js
@@ -0,0 +1,3 @@
+module.exports = Array.isArray || function (arr) {
+ return Object.prototype.toString.call(arr) == '[object Array]';
+};
diff --git a/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/isarray/package.json b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/isarray/package.json
new file mode 100644
index 0000000000..8c7f7a2815
--- /dev/null
+++ b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/isarray/package.json
@@ -0,0 +1,87 @@
+{
+ "_args": [
+ [
+ {
+ "raw": "isarray@0.0.1",
+ "scope": null,
+ "escapedName": "isarray",
+ "name": "isarray",
+ "rawSpec": "0.0.1",
+ "spec": "0.0.1",
+ "type": "version"
+ },
+ "/Users/zkat/code/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream"
+ ]
+ ],
+ "_from": "isarray@0.0.1",
+ "_id": "isarray@0.0.1",
+ "_inCache": true,
+ "_installable": true,
+ "_location": "/sorted-union-stream/from2/readable-stream/isarray",
+ "_npmUser": {
+ "name": "juliangruber",
+ "email": "julian@juliangruber.com"
+ },
+ "_npmVersion": "1.2.18",
+ "_phantomChildren": {},
+ "_requested": {
+ "raw": "isarray@0.0.1",
+ "scope": null,
+ "escapedName": "isarray",
+ "name": "isarray",
+ "rawSpec": "0.0.1",
+ "spec": "0.0.1",
+ "type": "version"
+ },
+ "_requiredBy": [
+ "/sorted-union-stream/from2/readable-stream"
+ ],
+ "_resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
+ "_shasum": "8a18acfca9a8f4177e09abfc6038939b05d1eedf",
+ "_shrinkwrap": null,
+ "_spec": "isarray@0.0.1",
+ "_where": "/Users/zkat/code/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream",
+ "author": {
+ "name": "Julian Gruber",
+ "email": "mail@juliangruber.com",
+ "url": "http://juliangruber.com"
+ },
+ "bugs": {
+ "url": "https://github.com/juliangruber/isarray/issues"
+ },
+ "dependencies": {},
+ "description": "Array#isArray for older browsers",
+ "devDependencies": {
+ "tap": "*"
+ },
+ "directories": {},
+ "dist": {
+ "shasum": "8a18acfca9a8f4177e09abfc6038939b05d1eedf",
+ "tarball": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz"
+ },
+ "homepage": "https://github.com/juliangruber/isarray",
+ "keywords": [
+ "browser",
+ "isarray",
+ "array"
+ ],
+ "license": "MIT",
+ "main": "index.js",
+ "maintainers": [
+ {
+ "name": "juliangruber",
+ "email": "julian@juliangruber.com"
+ }
+ ],
+ "name": "isarray",
+ "optionalDependencies": {},
+ "readme": "ERROR: No README data found!",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/juliangruber/isarray.git"
+ },
+ "scripts": {
+ "test": "tap test/*.js"
+ },
+ "version": "0.0.1"
+}
diff --git a/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/string_decoder/.npmignore b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/string_decoder/.npmignore
new file mode 100644
index 0000000000..206320cc1d
--- /dev/null
+++ b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/string_decoder/.npmignore
@@ -0,0 +1,2 @@
+build
+test
diff --git a/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/string_decoder/LICENSE b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/string_decoder/LICENSE
new file mode 100644
index 0000000000..6de584a48f
--- /dev/null
+++ b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/string_decoder/LICENSE
@@ -0,0 +1,20 @@
+Copyright Joyent, Inc. and other Node contributors.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to permit
+persons to whom the Software is furnished to do so, subject to the
+following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+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.
diff --git a/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/string_decoder/README.md b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/string_decoder/README.md
new file mode 100644
index 0000000000..4d2aa00150
--- /dev/null
+++ b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/string_decoder/README.md
@@ -0,0 +1,7 @@
+**string_decoder.js** (`require('string_decoder')`) from Node.js core
+
+Copyright Joyent, Inc. and other Node contributors. See LICENCE file for details.
+
+Version numbers match the versions found in Node core, e.g. 0.10.24 matches Node 0.10.24, likewise 0.11.10 matches Node 0.11.10. **Prefer the stable version over the unstable.**
+
+The *build/* directory contains a build script that will scrape the source from the [joyent/node](https://github.com/joyent/node) repo given a specific Node version. \ No newline at end of file
diff --git a/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/string_decoder/index.js b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/string_decoder/index.js
new file mode 100644
index 0000000000..b00e54fb79
--- /dev/null
+++ b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/string_decoder/index.js
@@ -0,0 +1,221 @@
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// 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.
+
+var Buffer = require('buffer').Buffer;
+
+var isBufferEncoding = Buffer.isEncoding
+ || function(encoding) {
+ switch (encoding && encoding.toLowerCase()) {
+ case 'hex': case 'utf8': case 'utf-8': case 'ascii': case 'binary': case 'base64': case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': case 'raw': return true;
+ default: return false;
+ }
+ }
+
+
+function assertEncoding(encoding) {
+ if (encoding && !isBufferEncoding(encoding)) {
+ throw new Error('Unknown encoding: ' + encoding);
+ }
+}
+
+// StringDecoder provides an interface for efficiently splitting a series of
+// buffers into a series of JS strings without breaking apart multi-byte
+// characters. CESU-8 is handled as part of the UTF-8 encoding.
+//
+// @TODO Handling all encodings inside a single object makes it very difficult
+// to reason about this code, so it should be split up in the future.
+// @TODO There should be a utf8-strict encoding that rejects invalid UTF-8 code
+// points as used by CESU-8.
+var StringDecoder = exports.StringDecoder = function(encoding) {
+ this.encoding = (encoding || 'utf8').toLowerCase().replace(/[-_]/, '');
+ assertEncoding(encoding);
+ switch (this.encoding) {
+ case 'utf8':
+ // CESU-8 represents each of Surrogate Pair by 3-bytes
+ this.surrogateSize = 3;
+ break;
+ case 'ucs2':
+ case 'utf16le':
+ // UTF-16 represents each of Surrogate Pair by 2-bytes
+ this.surrogateSize = 2;
+ this.detectIncompleteChar = utf16DetectIncompleteChar;
+ break;
+ case 'base64':
+ // Base-64 stores 3 bytes in 4 chars, and pads the remainder.
+ this.surrogateSize = 3;
+ this.detectIncompleteChar = base64DetectIncompleteChar;
+ break;
+ default:
+ this.write = passThroughWrite;
+ return;
+ }
+
+ // Enough space to store all bytes of a single character. UTF-8 needs 4
+ // bytes, but CESU-8 may require up to 6 (3 bytes per surrogate).
+ this.charBuffer = new Buffer(6);
+ // Number of bytes received for the current incomplete multi-byte character.
+ this.charReceived = 0;
+ // Number of bytes expected for the current incomplete multi-byte character.
+ this.charLength = 0;
+};
+
+
+// write decodes the given buffer and returns it as JS string that is
+// guaranteed to not contain any partial multi-byte characters. Any partial
+// character found at the end of the buffer is buffered up, and will be
+// returned when calling write again with the remaining bytes.
+//
+// Note: Converting a Buffer containing an orphan surrogate to a String
+// currently works, but converting a String to a Buffer (via `new Buffer`, or
+// Buffer#write) will replace incomplete surrogates with the unicode
+// replacement character. See https://codereview.chromium.org/121173009/ .
+StringDecoder.prototype.write = function(buffer) {
+ var charStr = '';
+ // if our last write ended with an incomplete multibyte character
+ while (this.charLength) {
+ // determine how many remaining bytes this buffer has to offer for this char
+ var available = (buffer.length >= this.charLength - this.charReceived) ?
+ this.charLength - this.charReceived :
+ buffer.length;
+
+ // add the new bytes to the char buffer
+ buffer.copy(this.charBuffer, this.charReceived, 0, available);
+ this.charReceived += available;
+
+ if (this.charReceived < this.charLength) {
+ // still not enough chars in this buffer? wait for more ...
+ return '';
+ }
+
+ // remove bytes belonging to the current character from the buffer
+ buffer = buffer.slice(available, buffer.length);
+
+ // get the character that was split
+ charStr = this.charBuffer.slice(0, this.charLength).toString(this.encoding);
+
+ // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character
+ var charCode = charStr.charCodeAt(charStr.length - 1);
+ if (charCode >= 0xD800 && charCode <= 0xDBFF) {
+ this.charLength += this.surrogateSize;
+ charStr = '';
+ continue;
+ }
+ this.charReceived = this.charLength = 0;
+
+ // if there are no more bytes in this buffer, just emit our char
+ if (buffer.length === 0) {
+ return charStr;
+ }
+ break;
+ }
+
+ // determine and set charLength / charReceived
+ this.detectIncompleteChar(buffer);
+
+ var end = buffer.length;
+ if (this.charLength) {
+ // buffer the incomplete character bytes we got
+ buffer.copy(this.charBuffer, 0, buffer.length - this.charReceived, end);
+ end -= this.charReceived;
+ }
+
+ charStr += buffer.toString(this.encoding, 0, end);
+
+ var end = charStr.length - 1;
+ var charCode = charStr.charCodeAt(end);
+ // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character
+ if (charCode >= 0xD800 && charCode <= 0xDBFF) {
+ var size = this.surrogateSize;
+ this.charLength += size;
+ this.charReceived += size;
+ this.charBuffer.copy(this.charBuffer, size, 0, size);
+ buffer.copy(this.charBuffer, 0, 0, size);
+ return charStr.substring(0, end);
+ }
+
+ // or just emit the charStr
+ return charStr;
+};
+
+// detectIncompleteChar determines if there is an incomplete UTF-8 character at
+// the end of the given buffer. If so, it sets this.charLength to the byte
+// length that character, and sets this.charReceived to the number of bytes
+// that are available for this character.
+StringDecoder.prototype.detectIncompleteChar = function(buffer) {
+ // determine how many bytes we have to check at the end of this buffer
+ var i = (buffer.length >= 3) ? 3 : buffer.length;
+
+ // Figure out if one of the last i bytes of our buffer announces an
+ // incomplete char.
+ for (; i > 0; i--) {
+ var c = buffer[buffer.length - i];
+
+ // See http://en.wikipedia.org/wiki/UTF-8#Description
+
+ // 110XXXXX
+ if (i == 1 && c >> 5 == 0x06) {
+ this.charLength = 2;
+ break;
+ }
+
+ // 1110XXXX
+ if (i <= 2 && c >> 4 == 0x0E) {
+ this.charLength = 3;
+ break;
+ }
+
+ // 11110XXX
+ if (i <= 3 && c >> 3 == 0x1E) {
+ this.charLength = 4;
+ break;
+ }
+ }
+ this.charReceived = i;
+};
+
+StringDecoder.prototype.end = function(buffer) {
+ var res = '';
+ if (buffer && buffer.length)
+ res = this.write(buffer);
+
+ if (this.charReceived) {
+ var cr = this.charReceived;
+ var buf = this.charBuffer;
+ var enc = this.encoding;
+ res += buf.slice(0, cr).toString(enc);
+ }
+
+ return res;
+};
+
+function passThroughWrite(buffer) {
+ return buffer.toString(this.encoding);
+}
+
+function utf16DetectIncompleteChar(buffer) {
+ this.charReceived = buffer.length % 2;
+ this.charLength = this.charReceived ? 2 : 0;
+}
+
+function base64DetectIncompleteChar(buffer) {
+ this.charReceived = buffer.length % 3;
+ this.charLength = this.charReceived ? 3 : 0;
+}
diff --git a/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/string_decoder/package.json b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/string_decoder/package.json
new file mode 100644
index 0000000000..e5c74b4d51
--- /dev/null
+++ b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/node_modules/string_decoder/package.json
@@ -0,0 +1,88 @@
+{
+ "_args": [
+ [
+ {
+ "raw": "string_decoder@~0.10.x",
+ "scope": null,
+ "escapedName": "string_decoder",
+ "name": "string_decoder",
+ "rawSpec": "~0.10.x",
+ "spec": ">=0.10.0 <0.11.0",
+ "type": "range"
+ },
+ "/Users/zkat/code/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream"
+ ]
+ ],
+ "_from": "string_decoder@>=0.10.0 <0.11.0",
+ "_id": "string_decoder@0.10.31",
+ "_inCache": true,
+ "_installable": true,
+ "_location": "/sorted-union-stream/from2/readable-stream/string_decoder",
+ "_npmUser": {
+ "name": "rvagg",
+ "email": "rod@vagg.org"
+ },
+ "_npmVersion": "1.4.23",
+ "_phantomChildren": {},
+ "_requested": {
+ "raw": "string_decoder@~0.10.x",
+ "scope": null,
+ "escapedName": "string_decoder",
+ "name": "string_decoder",
+ "rawSpec": "~0.10.x",
+ "spec": ">=0.10.0 <0.11.0",
+ "type": "range"
+ },
+ "_requiredBy": [
+ "/sorted-union-stream/from2/readable-stream"
+ ],
+ "_resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
+ "_shasum": "62e203bc41766c6c28c9fc84301dab1c5310fa94",
+ "_shrinkwrap": null,
+ "_spec": "string_decoder@~0.10.x",
+ "_where": "/Users/zkat/code/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream",
+ "bugs": {
+ "url": "https://github.com/rvagg/string_decoder/issues"
+ },
+ "dependencies": {},
+ "description": "The string_decoder module from Node core",
+ "devDependencies": {
+ "tap": "~0.4.8"
+ },
+ "directories": {},
+ "dist": {
+ "shasum": "62e203bc41766c6c28c9fc84301dab1c5310fa94",
+ "tarball": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz"
+ },
+ "gitHead": "d46d4fd87cf1d06e031c23f1ba170ca7d4ade9a0",
+ "homepage": "https://github.com/rvagg/string_decoder",
+ "keywords": [
+ "string",
+ "decoder",
+ "browser",
+ "browserify"
+ ],
+ "license": "MIT",
+ "main": "index.js",
+ "maintainers": [
+ {
+ "name": "substack",
+ "email": "mail@substack.net"
+ },
+ {
+ "name": "rvagg",
+ "email": "rod@vagg.org"
+ }
+ ],
+ "name": "string_decoder",
+ "optionalDependencies": {},
+ "readme": "ERROR: No README data found!",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/rvagg/string_decoder.git"
+ },
+ "scripts": {
+ "test": "tap test/simple/*.js"
+ },
+ "version": "0.10.31"
+}
diff --git a/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/package.json b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/package.json
new file mode 100644
index 0000000000..f506ea3325
--- /dev/null
+++ b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/package.json
@@ -0,0 +1,113 @@
+{
+ "_args": [
+ [
+ {
+ "raw": "readable-stream@~1.1.10",
+ "scope": null,
+ "escapedName": "readable-stream",
+ "name": "readable-stream",
+ "rawSpec": "~1.1.10",
+ "spec": ">=1.1.10 <1.2.0",
+ "type": "range"
+ },
+ "/Users/zkat/code/npm/node_modules/sorted-union-stream/node_modules/from2"
+ ]
+ ],
+ "_from": "readable-stream@>=1.1.10 <1.2.0",
+ "_id": "readable-stream@1.1.14",
+ "_inCache": true,
+ "_installable": true,
+ "_location": "/sorted-union-stream/from2/readable-stream",
+ "_nodeVersion": "5.10.1",
+ "_npmOperationalInternal": {
+ "host": "packages-16-east.internal.npmjs.com",
+ "tmp": "tmp/readable-stream-1.1.14.tgz_1460563293219_0.5682175166439265"
+ },
+ "_npmUser": {
+ "name": "cwmma",
+ "email": "calvin.metcalf@gmail.com"
+ },
+ "_npmVersion": "3.8.3",
+ "_phantomChildren": {},
+ "_requested": {
+ "raw": "readable-stream@~1.1.10",
+ "scope": null,
+ "escapedName": "readable-stream",
+ "name": "readable-stream",
+ "rawSpec": "~1.1.10",
+ "spec": ">=1.1.10 <1.2.0",
+ "type": "range"
+ },
+ "_requiredBy": [
+ "/sorted-union-stream/from2"
+ ],
+ "_resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz",
+ "_shasum": "7cf4c54ef648e3813084c636dd2079e166c081d9",
+ "_shrinkwrap": null,
+ "_spec": "readable-stream@~1.1.10",
+ "_where": "/Users/zkat/code/npm/node_modules/sorted-union-stream/node_modules/from2",
+ "author": {
+ "name": "Isaac Z. Schlueter",
+ "email": "i@izs.me",
+ "url": "http://blog.izs.me/"
+ },
+ "browser": {
+ "util": false
+ },
+ "bugs": {
+ "url": "https://github.com/isaacs/readable-stream/issues"
+ },
+ "dependencies": {
+ "core-util-is": "~1.0.0",
+ "inherits": "~2.0.1",
+ "isarray": "0.0.1",
+ "string_decoder": "~0.10.x"
+ },
+ "description": "Streams3, a user-land copy of the stream library from Node.js v0.11.x",
+ "devDependencies": {
+ "tap": "~0.2.6"
+ },
+ "directories": {},
+ "dist": {
+ "shasum": "7cf4c54ef648e3813084c636dd2079e166c081d9",
+ "tarball": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz"
+ },
+ "gitHead": "52550840cb1d6e8a98ef9a909a4bea360bc6f7da",
+ "homepage": "https://github.com/isaacs/readable-stream#readme",
+ "keywords": [
+ "readable",
+ "stream",
+ "pipe"
+ ],
+ "license": "MIT",
+ "main": "readable.js",
+ "maintainers": [
+ {
+ "name": "isaacs",
+ "email": "isaacs@npmjs.com"
+ },
+ {
+ "name": "tootallnate",
+ "email": "nathan@tootallnate.net"
+ },
+ {
+ "name": "rvagg",
+ "email": "rod@vagg.org"
+ },
+ {
+ "name": "cwmma",
+ "email": "calvin.metcalf@gmail.com"
+ }
+ ],
+ "name": "readable-stream",
+ "optionalDependencies": {},
+ "readme": "ERROR: No README data found!",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/isaacs/readable-stream.git"
+ },
+ "scripts": {
+ "test": "tap test/simple/*.js"
+ },
+ "version": "1.1.14"
+}
diff --git a/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/passthrough.js b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/passthrough.js
new file mode 100644
index 0000000000..27e8d8a551
--- /dev/null
+++ b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/passthrough.js
@@ -0,0 +1 @@
+module.exports = require("./lib/_stream_passthrough.js")
diff --git a/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/readable.js b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/readable.js
new file mode 100644
index 0000000000..2a8b5c6b56
--- /dev/null
+++ b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/readable.js
@@ -0,0 +1,10 @@
+exports = module.exports = require('./lib/_stream_readable.js');
+exports.Stream = require('stream');
+exports.Readable = exports;
+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');
+if (!process.browser && process.env.READABLE_STREAM === 'disable') {
+ module.exports = require('stream');
+}
diff --git a/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/transform.js b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/transform.js
new file mode 100644
index 0000000000..5d482f0780
--- /dev/null
+++ b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/transform.js
@@ -0,0 +1 @@
+module.exports = require("./lib/_stream_transform.js")
diff --git a/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/writable.js b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/writable.js
new file mode 100644
index 0000000000..e1e9efdf3c
--- /dev/null
+++ b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/node_modules/readable-stream/writable.js
@@ -0,0 +1 @@
+module.exports = require("./lib/_stream_writable.js")
diff --git a/deps/npm/node_modules/sorted-union-stream/node_modules/from2/package.json b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/package.json
new file mode 100644
index 0000000000..a5ec25b657
--- /dev/null
+++ b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/package.json
@@ -0,0 +1,107 @@
+{
+ "_args": [
+ [
+ {
+ "raw": "from2@^1.3.0",
+ "scope": null,
+ "escapedName": "from2",
+ "name": "from2",
+ "rawSpec": "^1.3.0",
+ "spec": ">=1.3.0 <2.0.0",
+ "type": "range"
+ },
+ "/Users/zkat/code/npm/node_modules/sorted-union-stream"
+ ]
+ ],
+ "_from": "from2@>=1.3.0 <2.0.0",
+ "_id": "from2@1.3.0",
+ "_inCache": true,
+ "_installable": true,
+ "_location": "/sorted-union-stream/from2",
+ "_nodeVersion": "0.10.35",
+ "_npmUser": {
+ "name": "mafintosh",
+ "email": "mathiasbuus@gmail.com"
+ },
+ "_npmVersion": "2.1.17",
+ "_phantomChildren": {
+ "inherits": "2.0.1"
+ },
+ "_requested": {
+ "raw": "from2@^1.3.0",
+ "scope": null,
+ "escapedName": "from2",
+ "name": "from2",
+ "rawSpec": "^1.3.0",
+ "spec": ">=1.3.0 <2.0.0",
+ "type": "range"
+ },
+ "_requiredBy": [
+ "/sorted-union-stream"
+ ],
+ "_resolved": "https://registry.npmjs.org/from2/-/from2-1.3.0.tgz",
+ "_shasum": "88413baaa5f9a597cfde9221d86986cd3c061dfd",
+ "_shrinkwrap": null,
+ "_spec": "from2@^1.3.0",
+ "_where": "/Users/zkat/code/npm/node_modules/sorted-union-stream",
+ "author": {
+ "name": "Hugh Kennedy",
+ "email": "hughskennedy@gmail.com",
+ "url": "http://hughsk.io/"
+ },
+ "bugs": {
+ "url": "https://github.com/hughsk/from2/issues"
+ },
+ "contributors": [
+ {
+ "name": "Mathias Buus",
+ "email": "mathiasbuus@gmail.com"
+ }
+ ],
+ "dependencies": {
+ "inherits": "~2.0.1",
+ "readable-stream": "~1.1.10"
+ },
+ "description": "Convenience wrapper for ReadableStream, with an API lifted from \"from\" and \"through2\"",
+ "devDependencies": {
+ "tape": "~2.4.2"
+ },
+ "directories": {},
+ "dist": {
+ "shasum": "88413baaa5f9a597cfde9221d86986cd3c061dfd",
+ "tarball": "https://registry.npmjs.org/from2/-/from2-1.3.0.tgz"
+ },
+ "gitHead": "96118ea0d8aff6fb28cb8b7d8bc63ab1adb946a9",
+ "homepage": "https://github.com/hughsk/from2",
+ "keywords": [
+ "from",
+ "stream",
+ "readable",
+ "pull",
+ "convenience",
+ "wrapper"
+ ],
+ "license": "MIT",
+ "main": "index.js",
+ "maintainers": [
+ {
+ "name": "hughsk",
+ "email": "hughskennedy@gmail.com"
+ },
+ {
+ "name": "mafintosh",
+ "email": "mathiasbuus@gmail.com"
+ }
+ ],
+ "name": "from2",
+ "optionalDependencies": {},
+ "readme": "ERROR: No README data found!",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/hughsk/from2.git"
+ },
+ "scripts": {
+ "test": "node test"
+ },
+ "version": "1.3.0"
+}
diff --git a/deps/npm/node_modules/sorted-union-stream/node_modules/from2/test.js b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/test.js
new file mode 100644
index 0000000000..aee046352a
--- /dev/null
+++ b/deps/npm/node_modules/sorted-union-stream/node_modules/from2/test.js
@@ -0,0 +1,86 @@
+var test = require('tape')
+var path = require('path')
+var from = require('./')
+var fs = require('fs')
+
+var tmp = path.resolve(
+ __dirname, 'tmp.txt'
+)
+
+function fromString(string) {
+ return from(function(size, next) {
+ if (string.length <= 0) return next()
+ var chunk = string.slice(0, size)
+ string = string.slice(size)
+ next(null, chunk)
+ })
+}
+
+test('from2', function(t) {
+ var contents = fs.readFileSync(__filename, 'utf8')
+ var stream = fromString(contents)
+
+ stream
+ .pipe(fs.createWriteStream(tmp))
+ .on('close', function() {
+ t.equal(fs.readFileSync(tmp, 'utf8'), contents)
+ fs.unlinkSync(tmp)
+ t.end()
+ })
+})
+
+test('old mode', function(t) {
+ var contents = fs.readFileSync(__filename, 'utf8')
+ var stream = fromString(contents)
+ var buffer = ''
+
+ stream.on('data', function(data) {
+ buffer += data
+ }).on('end', function() {
+ t.equal(buffer, contents)
+ t.end()
+ })
+})
+
+test('destroy', function(t) {
+ var stream = from(function(size, next) {
+ process.nextTick(function() {
+ next(null, 'no')
+ })
+ })
+
+ stream.on('data', function(data) {
+ t.ok(false)
+ }).on('close', function() {
+ t.ok(true)
+ t.end()
+ })
+
+ stream.destroy()
+})
+
+test('arrays', function (t) {
+ var input = ['a', 'b', 'c']
+ var stream = from(input)
+ var output = []
+ stream.on('data', function (letter) {
+ output.push(letter.toString())
+ })
+ stream.on('end', function () {
+ t.deepEqual(input, output)
+ t.end()
+ })
+})
+
+test('obj arrays', function (t) {
+ var input = [{foo:'a'}, {foo:'b'}, {foo:'c'}]
+ var stream = from.obj(input)
+ var output = []
+ stream.on('data', function (letter) {
+ output.push(letter)
+ })
+ stream.on('end', function () {
+ t.deepEqual(input, output)
+ t.end()
+ })
+})
diff --git a/deps/npm/node_modules/sorted-union-stream/node_modules/stream-iterate/.npmignore b/deps/npm/node_modules/sorted-union-stream/node_modules/stream-iterate/.npmignore
new file mode 100644
index 0000000000..3c3629e647
--- /dev/null
+++ b/deps/npm/node_modules/sorted-union-stream/node_modules/stream-iterate/.npmignore
@@ -0,0 +1 @@
+node_modules
diff --git a/deps/npm/node_modules/sorted-union-stream/node_modules/stream-iterate/.travis.yml b/deps/npm/node_modules/sorted-union-stream/node_modules/stream-iterate/.travis.yml
new file mode 100644
index 0000000000..89d7548954
--- /dev/null
+++ b/deps/npm/node_modules/sorted-union-stream/node_modules/stream-iterate/.travis.yml
@@ -0,0 +1,5 @@
+language: node_js
+node_js:
+ - "0.10"
+ - '0.12'
+ - 'iojs'
diff --git a/deps/npm/node_modules/sorted-union-stream/node_modules/stream-iterate/LICENSE b/deps/npm/node_modules/sorted-union-stream/node_modules/stream-iterate/LICENSE
new file mode 100644
index 0000000000..66a4d2a149
--- /dev/null
+++ b/deps/npm/node_modules/sorted-union-stream/node_modules/stream-iterate/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2015 Mathias Buus
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 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.
diff --git a/deps/npm/node_modules/sorted-union-stream/node_modules/stream-iterate/README.md b/deps/npm/node_modules/sorted-union-stream/node_modules/stream-iterate/README.md
new file mode 100644
index 0000000000..37d68d4bc7
--- /dev/null
+++ b/deps/npm/node_modules/sorted-union-stream/node_modules/stream-iterate/README.md
@@ -0,0 +1,33 @@
+# stream-iterate
+
+Iterate through the values in a stream.
+
+```
+npm install stream-iterate
+```
+
+[![build status](http://img.shields.io/travis/mafintosh/stream-iterate.svg?style=flat)](http://travis-ci.org/mafintosh/stream-iterate)
+
+## Usage
+
+``` js
+var iterate = require('stream-iterate')
+var from = require('from2')
+
+var stream = from.obj(['a', 'b', 'c'])
+
+var read = iterate(stream)
+
+read(function (err, data, next) {
+ console.log(err, data)
+ next()
+})
+```
+
+If you don't call `next` and call `read` again the same `(err, value)` pair will be returned.
+
+You can use this module to implement stuff like [a streaming merge sort](https://github.com/mafintosh/stream-iterate/blob/master/test.js#L5-L47).
+
+## License
+
+[MIT](LICENSE)
diff --git a/deps/npm/node_modules/sorted-union-stream/node_modules/stream-iterate/index.js b/deps/npm/node_modules/sorted-union-stream/node_modules/stream-iterate/index.js
new file mode 100644
index 0000000000..2dac155cbf
--- /dev/null
+++ b/deps/npm/node_modules/sorted-union-stream/node_modules/stream-iterate/index.js
@@ -0,0 +1,69 @@
+var Readable = require('stream').Readable
+
+var stream2 = function (stream) {
+ if (stream._readableState) return stream
+ return new Readable({objectMode: true, highWaterMark: 16}).wrap(stream)
+}
+
+module.exports = function (stream) {
+ stream = stream2(stream)
+
+ var ended = false
+ var data = null
+ var err = null
+ var destroyed = false
+ var fn = null
+
+ var consume = function (e) {
+ if (e) {
+ destroyed = true
+ if (stream.destroy) stream.destroy(e)
+ return
+ }
+
+ data = null
+ err = null
+ }
+
+ var onresult = function () {
+ if (!fn) return
+ var tmp = fn
+ fn = undefined
+ tmp(err, data, consume)
+ }
+
+ var update = function () {
+ if (!fn) return
+ data = stream.read()
+ if (data === null && !ended) return
+ onresult()
+ }
+
+ var onend = function () {
+ ended = true
+ onresult()
+ }
+
+ stream.on('readable', update)
+
+ stream.on('error', function (e) {
+ err = e
+ onresult()
+ })
+
+ stream.on('close', function () {
+ if (stream._readableState.ended) return
+ onend()
+ })
+
+ stream.on('end', onend)
+
+ return function (callback) {
+ if (destroyed) return
+ if (err) return callback(err, null, consume)
+ if (data) return callback(null, data, consume)
+ if (ended) return callback(null, null, consume)
+ fn = callback
+ update()
+ }
+}
diff --git a/deps/npm/node_modules/sorted-union-stream/node_modules/stream-iterate/package.json b/deps/npm/node_modules/sorted-union-stream/node_modules/stream-iterate/package.json
new file mode 100644
index 0000000000..74030fe493
--- /dev/null
+++ b/deps/npm/node_modules/sorted-union-stream/node_modules/stream-iterate/package.json
@@ -0,0 +1,85 @@
+{
+ "_args": [
+ [
+ {
+ "raw": "stream-iterate@^1.1.0",
+ "scope": null,
+ "escapedName": "stream-iterate",
+ "name": "stream-iterate",
+ "rawSpec": "^1.1.0",
+ "spec": ">=1.1.0 <2.0.0",
+ "type": "range"
+ },
+ "/Users/zkat/code/npm/node_modules/sorted-union-stream"
+ ]
+ ],
+ "_from": "stream-iterate@>=1.1.0 <2.0.0",
+ "_id": "stream-iterate@1.1.1",
+ "_inCache": true,
+ "_installable": true,
+ "_location": "/sorted-union-stream/stream-iterate",
+ "_nodeVersion": "1.6.4",
+ "_npmUser": {
+ "name": "mafintosh",
+ "email": "mathiasbuus@gmail.com"
+ },
+ "_npmVersion": "2.7.5",
+ "_phantomChildren": {},
+ "_requested": {
+ "raw": "stream-iterate@^1.1.0",
+ "scope": null,
+ "escapedName": "stream-iterate",
+ "name": "stream-iterate",
+ "rawSpec": "^1.1.0",
+ "spec": ">=1.1.0 <2.0.0",
+ "type": "range"
+ },
+ "_requiredBy": [
+ "/sorted-union-stream"
+ ],
+ "_resolved": "https://registry.npmjs.org/stream-iterate/-/stream-iterate-1.1.1.tgz",
+ "_shasum": "5d7d197aa52bc9e271b44547c9e388b2b1b33836",
+ "_shrinkwrap": null,
+ "_spec": "stream-iterate@^1.1.0",
+ "_where": "/Users/zkat/code/npm/node_modules/sorted-union-stream",
+ "author": {
+ "name": "Mathias Buus",
+ "url": "@mafintosh"
+ },
+ "bugs": {
+ "url": "https://github.com/mafintosh/stream-iterate/issues"
+ },
+ "dependencies": {},
+ "description": "Iterate through the values of a stream",
+ "devDependencies": {
+ "from2": "^1.3.0",
+ "standard": "^3.3.2",
+ "tape": "^4.0.0"
+ },
+ "directories": {},
+ "dist": {
+ "shasum": "5d7d197aa52bc9e271b44547c9e388b2b1b33836",
+ "tarball": "https://registry.npmjs.org/stream-iterate/-/stream-iterate-1.1.1.tgz"
+ },
+ "gitHead": "7a6e5e07b213fccd3efffda5f14b0442b1d360c9",
+ "homepage": "https://github.com/mafintosh/stream-iterate",
+ "license": "MIT",
+ "main": "index.js",
+ "maintainers": [
+ {
+ "name": "mafintosh",
+ "email": "mathiasbuus@gmail.com"
+ }
+ ],
+ "name": "stream-iterate",
+ "optionalDependencies": {},
+ "readme": "ERROR: No README data found!",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/mafintosh/stream-iterate.git"
+ },
+ "scripts": {
+ "test": "standard && tape test.js"
+ },
+ "version": "1.1.1"
+}
diff --git a/deps/npm/node_modules/sorted-union-stream/node_modules/stream-iterate/test.js b/deps/npm/node_modules/sorted-union-stream/node_modules/stream-iterate/test.js
new file mode 100644
index 0000000000..5beb23a5d9
--- /dev/null
+++ b/deps/npm/node_modules/sorted-union-stream/node_modules/stream-iterate/test.js
@@ -0,0 +1,60 @@
+var tape = require('tape')
+var from = require('from2')
+var iterate = require('./')
+
+tape('merge sort', function (t) {
+ var a = from.obj(['a', 'b', 'd', 'e', 'g', 'h'])
+ var b = from.obj(['b', 'c', 'f'])
+ var output = []
+
+ var readA = iterate(a)
+ var readB = iterate(b)
+
+ var loop = function () {
+ readA(function (err, dataA, nextA) {
+ if (err) throw err
+ readB(function (err, dataB, nextB) {
+ if (err) throw err
+
+ if (!dataA && !dataB) {
+ t.same(output, ['a', 'b', 'b', 'c', 'd', 'e', 'f', 'g', 'h'], 'sorts list')
+ t.end()
+ return
+ }
+
+ if (!dataB || dataA < dataB) {
+ output.push(dataA)
+ nextA()
+ return loop()
+ }
+
+ if (!dataA || dataA > dataB) {
+ output.push(dataB)
+ nextB()
+ return loop()
+ }
+
+ output.push(dataA)
+ output.push(dataB)
+ nextA()
+ nextB()
+ loop()
+ })
+ })
+ }
+
+ loop()
+})
+
+tape('error handling', function (t) {
+ var a = from.obj(['a', 'b', 'd', 'e', 'g', 'h'])
+ var read = iterate(a)
+
+ a.destroy(new Error('oh no'))
+
+ read(function (err) {
+ t.ok(err, 'had error')
+ t.same(err.message, 'oh no')
+ t.end()
+ })
+})