From 8360d4d9f328e115793a06026ae6068b24e879e6 Mon Sep 17 00:00:00 2001
From: VincentChanX <710852740@qq.com>
Date: Thu, 6 Apr 2017 10:44:45 +0800
Subject: [PATCH] update default config
---
config.json | 6 +-
local.js | 8 +-
node_modules/bl/node_modules/isarray/index.js | 5 -
.../node_modules/readable-stream/.npmignore | 9 -
.../bl/node_modules/readable-stream/LICENSE | 47 -
.../bl/node_modules/readable-stream/README.md | 57 --
.../readable-stream/lib/_stream_duplex.js | 75 --
.../lib/_stream_passthrough.js | 26 -
.../readable-stream/lib/_stream_writable.js | 551 ----------
.../node_modules/readable-stream/package.json | 147 ---
node_modules/bl/package.json | 9 +-
node_modules/buffer-shims/package.json | 7 +-
node_modules/bufferutil/package.json | 21 +-
node_modules/core-util-is/package.json | 3 +-
node_modules/inherits/package.json | 3 +-
.../{bl/node_modules => }/isarray/.npmignore | 0
.../{bl/node_modules => }/isarray/.travis.yml | 0
.../{bl/node_modules => }/isarray/Makefile | 0
node_modules/isarray/README.md | 6 +
node_modules/isarray/index.js | 4 +-
node_modules/isarray/package.json | 56 +-
.../{bl/node_modules => }/isarray/test.js | 0
node_modules/log4js/package.json | 21 +-
node_modules/minimist/.travis.yml | 4 +
node_modules/minimist/index.js | 155 ++-
node_modules/minimist/package.json | 49 +-
node_modules/minimist/readme.markdown | 20 +-
.../minimist/test/all_bool.js | 0
.../node_modules => }/minimist/test/bool.js | 0
node_modules/minimist/test/dash.js | 7 +
node_modules/minimist/test/default_bool.js | 15 +
node_modules/minimist/test/dotted.js | 6 +
.../minimist/test/kv_short.js | 0
.../node_modules => }/minimist/test/num.js | 0
node_modules/minimist/test/parse.js | 167 +---
node_modules/minimist/test/parse_modified.js | 2 +-
.../minimist/test/stop_early.js | 0
.../minimist/test/unknown.js | 0
.../node_modules/minimist}/.travis.yml | 0
.../node_modules/minimist/LICENSE | 0
.../node_modules/minimist/example/parse.js | 0
.../node_modules/minimist/index.js | 155 +--
.../node_modules/minimist/package.json | 50 +-
.../node_modules/minimist/readme.markdown | 20 +-
.../node_modules/minimist/test/dash.js | 7 -
.../minimist/test/default_bool.js | 15 -
.../node_modules/minimist/test/dotted.js | 6 -
.../node_modules/minimist/test/long.js | 0
.../node_modules/minimist/test/parse.js | 167 +++-
.../minimist/test/parse_modified.js | 2 +-
.../node_modules/minimist/test/short.js | 0
.../node_modules/minimist/test/whitespace.js | 0
node_modules/mkdirp/package.json | 7 +-
.../node_modules/minimist/.travis.yml | 8 -
.../node_modules/minimist/index.js | 236 -----
.../minimist/test/default_bool.js | 35 -
.../node_modules/minimist/test/dotted.js | 22 -
.../node_modules/minimist/test/parse.js | 197 ----
.../process-nextick-args/package.json | 7 +-
.../rc/node_modules/minimist/.travis.yml | 8 -
node_modules/rc/node_modules/minimist/LICENSE | 18 -
.../rc/node_modules/minimist/example/parse.js | 2 -
.../rc/node_modules/minimist/package.json | 118 ---
.../rc/node_modules/minimist/readme.markdown | 91 --
.../rc/node_modules/minimist/test/all_bool.js | 32 -
.../rc/node_modules/minimist/test/bool.js | 166 ---
.../rc/node_modules/minimist/test/dash.js | 31 -
.../rc/node_modules/minimist/test/kv_short.js | 16 -
.../rc/node_modules/minimist/test/long.js | 31 -
.../rc/node_modules/minimist/test/num.js | 36 -
.../minimist/test/parse_modified.js | 9 -
.../rc/node_modules/minimist/test/short.js | 67 --
.../node_modules/minimist/test/stop_early.js | 15 -
.../rc/node_modules/minimist/test/unknown.js | 102 --
.../node_modules/minimist/test/whitespace.js | 8 -
node_modules/readable-stream/.npmignore | 6 +-
.../readable-stream/.travis.yml | 0
.../readable-stream/CONTRIBUTING.md | 0
.../readable-stream/GOVERNANCE.md | 0
node_modules/readable-stream/LICENSE | 29 +
node_modules/readable-stream/README.md | 54 +-
.../doc/wg-meetings/2015-01-30.md | 0
.../readable-stream/lib/_stream_duplex.js | 74 +-
.../lib/_stream_passthrough.js | 30 +-
.../readable-stream/lib/_stream_readable.js | 678 +++++++------
.../readable-stream/lib/_stream_transform.js | 95 +-
.../readable-stream/lib/_stream_writable.js | 406 +++++---
.../lib/internal/streams/BufferList.js | 0
node_modules/readable-stream/package.json | 110 +-
node_modules/readable-stream/readable.js | 12 +-
node_modules/shadowsocks/package.json | 3 +-
.../node_modules/isarray/README.md | 6 -
.../node_modules}/isarray/build/build.js | 0
.../node_modules/isarray/component.json | 0
.../node_modules/isarray/index.js | 3 +
.../node_modules/isarray/package.json | 64 +-
.../node_modules/readable-stream/.npmignore | 5 +
.../node_modules/readable-stream/LICENSE | 18 +
.../node_modules/readable-stream/README.md | 15 +
.../node_modules/readable-stream/duplex.js | 0
.../node_modules}/readable-stream/float.patch | 0
.../readable-stream/lib/_stream_duplex.js | 89 ++
.../lib/_stream_passthrough.js | 46 +
.../readable-stream/lib/_stream_readable.js | 668 +++++++------
.../readable-stream/lib/_stream_transform.js | 95 +-
.../readable-stream/lib/_stream_writable.js | 477 +++++++++
.../node_modules/readable-stream/package.json | 113 +++
.../readable-stream/passthrough.js | 0
.../node_modules/readable-stream/readable.js | 12 +-
.../node_modules/readable-stream/transform.js | 0
.../node_modules/readable-stream/writable.js | 0
node_modules/streamroller/package.json | 6 +-
node_modules/string_decoder/package.json | 3 +-
.../node_modules/isarray/.npmignore | 1 -
.../tar-stream/node_modules/isarray/Makefile | 6 -
.../tar-stream/node_modules/isarray/README.md | 60 --
.../node_modules/isarray/component.json | 19 -
.../tar-stream/node_modules/isarray/index.js | 5 -
.../node_modules/isarray/package.json | 117 ---
.../tar-stream/node_modules/isarray/test.js | 20 -
.../node_modules/readable-stream/.npmignore | 9 -
.../node_modules/readable-stream/.travis.yml | 49 -
.../readable-stream/CONTRIBUTING.md | 38 -
.../readable-stream/GOVERNANCE.md | 136 ---
.../node_modules/readable-stream/LICENSE | 47 -
.../node_modules/readable-stream/README.md | 57 --
.../doc/wg-meetings/2015-01-30.md | 60 --
.../node_modules/readable-stream/duplex.js | 1 -
.../readable-stream/lib/_stream_duplex.js | 75 --
.../lib/_stream_passthrough.js | 26 -
.../readable-stream/lib/_stream_readable.js | 941 ------------------
.../readable-stream/lib/_stream_transform.js | 182 ----
.../readable-stream/lib/_stream_writable.js | 551 ----------
.../lib/internal/streams/BufferList.js | 64 --
.../node_modules/readable-stream/package.json | 135 ---
.../readable-stream/passthrough.js | 1 -
.../node_modules/readable-stream/readable.js | 16 -
.../node_modules/readable-stream/transform.js | 1 -
.../node_modules/readable-stream/writable.js | 1 -
node_modules/tar-stream/package.json | 9 +-
node_modules/util-deprecate/package.json | 7 +-
node_modules/ws/package.json | 21 +-
package.json | 1 +
server.js | 10 +-
tcprelay.js | 6 +
145 files changed, 2542 insertions(+), 6417 deletions(-)
delete mode 100644 node_modules/bl/node_modules/isarray/index.js
delete mode 100644 node_modules/bl/node_modules/readable-stream/.npmignore
delete mode 100644 node_modules/bl/node_modules/readable-stream/LICENSE
delete mode 100644 node_modules/bl/node_modules/readable-stream/README.md
delete mode 100644 node_modules/bl/node_modules/readable-stream/lib/_stream_duplex.js
delete mode 100644 node_modules/bl/node_modules/readable-stream/lib/_stream_passthrough.js
delete mode 100644 node_modules/bl/node_modules/readable-stream/lib/_stream_writable.js
delete mode 100644 node_modules/bl/node_modules/readable-stream/package.json
rename node_modules/{bl/node_modules => }/isarray/.npmignore (100%)
rename node_modules/{bl/node_modules => }/isarray/.travis.yml (100%)
rename node_modules/{bl/node_modules => }/isarray/Makefile (100%)
rename node_modules/{bl/node_modules => }/isarray/test.js (100%)
rename node_modules/{prebuild-install/node_modules => }/minimist/test/all_bool.js (100%)
rename node_modules/{prebuild-install/node_modules => }/minimist/test/bool.js (100%)
rename node_modules/{prebuild-install/node_modules => }/minimist/test/kv_short.js (100%)
rename node_modules/{prebuild-install/node_modules => }/minimist/test/num.js (100%)
rename node_modules/{prebuild-install/node_modules => }/minimist/test/stop_early.js (100%)
rename node_modules/{prebuild-install/node_modules => }/minimist/test/unknown.js (100%)
rename node_modules/{tar-stream/node_modules/isarray => mkdirp/node_modules/minimist}/.travis.yml (100%)
rename node_modules/{prebuild-install => mkdirp}/node_modules/minimist/LICENSE (100%)
rename node_modules/{prebuild-install => mkdirp}/node_modules/minimist/example/parse.js (100%)
rename node_modules/{rc => mkdirp}/node_modules/minimist/index.js (55%)
rename node_modules/{prebuild-install => mkdirp}/node_modules/minimist/package.json (61%)
rename node_modules/{prebuild-install => mkdirp}/node_modules/minimist/readme.markdown (63%)
rename node_modules/{prebuild-install => mkdirp}/node_modules/minimist/test/dash.js (74%)
rename node_modules/{rc => mkdirp}/node_modules/minimist/test/default_bool.js (58%)
rename node_modules/{rc => mkdirp}/node_modules/minimist/test/dotted.js (75%)
rename node_modules/{prebuild-install => mkdirp}/node_modules/minimist/test/long.js (100%)
rename node_modules/{rc => mkdirp}/node_modules/minimist/test/parse.js (54%)
rename node_modules/{prebuild-install => mkdirp}/node_modules/minimist/test/parse_modified.js (80%)
rename node_modules/{prebuild-install => mkdirp}/node_modules/minimist/test/short.js (100%)
rename node_modules/{prebuild-install => mkdirp}/node_modules/minimist/test/whitespace.js (100%)
delete mode 100644 node_modules/prebuild-install/node_modules/minimist/.travis.yml
delete mode 100644 node_modules/prebuild-install/node_modules/minimist/index.js
delete mode 100644 node_modules/prebuild-install/node_modules/minimist/test/default_bool.js
delete mode 100644 node_modules/prebuild-install/node_modules/minimist/test/dotted.js
delete mode 100644 node_modules/prebuild-install/node_modules/minimist/test/parse.js
delete mode 100644 node_modules/rc/node_modules/minimist/.travis.yml
delete mode 100644 node_modules/rc/node_modules/minimist/LICENSE
delete mode 100644 node_modules/rc/node_modules/minimist/example/parse.js
delete mode 100644 node_modules/rc/node_modules/minimist/package.json
delete mode 100644 node_modules/rc/node_modules/minimist/readme.markdown
delete mode 100644 node_modules/rc/node_modules/minimist/test/all_bool.js
delete mode 100644 node_modules/rc/node_modules/minimist/test/bool.js
delete mode 100644 node_modules/rc/node_modules/minimist/test/dash.js
delete mode 100644 node_modules/rc/node_modules/minimist/test/kv_short.js
delete mode 100644 node_modules/rc/node_modules/minimist/test/long.js
delete mode 100644 node_modules/rc/node_modules/minimist/test/num.js
delete mode 100644 node_modules/rc/node_modules/minimist/test/parse_modified.js
delete mode 100644 node_modules/rc/node_modules/minimist/test/short.js
delete mode 100644 node_modules/rc/node_modules/minimist/test/stop_early.js
delete mode 100644 node_modules/rc/node_modules/minimist/test/unknown.js
delete mode 100644 node_modules/rc/node_modules/minimist/test/whitespace.js
rename node_modules/{bl/node_modules => }/readable-stream/.travis.yml (100%)
rename node_modules/{bl/node_modules => }/readable-stream/CONTRIBUTING.md (100%)
rename node_modules/{bl/node_modules => }/readable-stream/GOVERNANCE.md (100%)
rename node_modules/{bl/node_modules => }/readable-stream/doc/wg-meetings/2015-01-30.md (100%)
rename node_modules/{bl/node_modules => }/readable-stream/lib/internal/streams/BufferList.js (100%)
rename node_modules/{bl => streamroller}/node_modules/isarray/README.md (82%)
rename node_modules/{ => streamroller/node_modules}/isarray/build/build.js (100%)
rename node_modules/{bl => streamroller}/node_modules/isarray/component.json (100%)
create mode 100644 node_modules/streamroller/node_modules/isarray/index.js
rename node_modules/{bl => streamroller}/node_modules/isarray/package.json (51%)
create mode 100644 node_modules/streamroller/node_modules/readable-stream/.npmignore
create mode 100644 node_modules/streamroller/node_modules/readable-stream/LICENSE
create mode 100644 node_modules/streamroller/node_modules/readable-stream/README.md
rename node_modules/{bl => streamroller}/node_modules/readable-stream/duplex.js (100%)
rename node_modules/{ => streamroller/node_modules}/readable-stream/float.patch (100%)
create mode 100644 node_modules/streamroller/node_modules/readable-stream/lib/_stream_duplex.js
create mode 100644 node_modules/streamroller/node_modules/readable-stream/lib/_stream_passthrough.js
rename node_modules/{bl => streamroller}/node_modules/readable-stream/lib/_stream_readable.js (54%)
rename node_modules/{bl => streamroller}/node_modules/readable-stream/lib/_stream_transform.js (66%)
create mode 100644 node_modules/streamroller/node_modules/readable-stream/lib/_stream_writable.js
create mode 100644 node_modules/streamroller/node_modules/readable-stream/package.json
rename node_modules/{bl => streamroller}/node_modules/readable-stream/passthrough.js (100%)
rename node_modules/{bl => streamroller}/node_modules/readable-stream/readable.js (62%)
rename node_modules/{bl => streamroller}/node_modules/readable-stream/transform.js (100%)
rename node_modules/{bl => streamroller}/node_modules/readable-stream/writable.js (100%)
delete mode 100644 node_modules/tar-stream/node_modules/isarray/.npmignore
delete mode 100644 node_modules/tar-stream/node_modules/isarray/Makefile
delete mode 100644 node_modules/tar-stream/node_modules/isarray/README.md
delete mode 100644 node_modules/tar-stream/node_modules/isarray/component.json
delete mode 100644 node_modules/tar-stream/node_modules/isarray/index.js
delete mode 100644 node_modules/tar-stream/node_modules/isarray/package.json
delete mode 100644 node_modules/tar-stream/node_modules/isarray/test.js
delete mode 100644 node_modules/tar-stream/node_modules/readable-stream/.npmignore
delete mode 100644 node_modules/tar-stream/node_modules/readable-stream/.travis.yml
delete mode 100644 node_modules/tar-stream/node_modules/readable-stream/CONTRIBUTING.md
delete mode 100644 node_modules/tar-stream/node_modules/readable-stream/GOVERNANCE.md
delete mode 100644 node_modules/tar-stream/node_modules/readable-stream/LICENSE
delete mode 100644 node_modules/tar-stream/node_modules/readable-stream/README.md
delete mode 100644 node_modules/tar-stream/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md
delete mode 100644 node_modules/tar-stream/node_modules/readable-stream/duplex.js
delete mode 100644 node_modules/tar-stream/node_modules/readable-stream/lib/_stream_duplex.js
delete mode 100644 node_modules/tar-stream/node_modules/readable-stream/lib/_stream_passthrough.js
delete mode 100644 node_modules/tar-stream/node_modules/readable-stream/lib/_stream_readable.js
delete mode 100644 node_modules/tar-stream/node_modules/readable-stream/lib/_stream_transform.js
delete mode 100644 node_modules/tar-stream/node_modules/readable-stream/lib/_stream_writable.js
delete mode 100644 node_modules/tar-stream/node_modules/readable-stream/lib/internal/streams/BufferList.js
delete mode 100644 node_modules/tar-stream/node_modules/readable-stream/package.json
delete mode 100644 node_modules/tar-stream/node_modules/readable-stream/passthrough.js
delete mode 100644 node_modules/tar-stream/node_modules/readable-stream/readable.js
delete mode 100644 node_modules/tar-stream/node_modules/readable-stream/transform.js
delete mode 100644 node_modules/tar-stream/node_modules/readable-stream/writable.js
diff --git a/config.json b/config.json
index 6f45e03..0ae3a8b 100644
--- a/config.json
+++ b/config.json
@@ -1,8 +1,8 @@
{
"localAddress":"127.0.0.1",
"localPort": 1080,
- "serverAddress": "52.221.230.93",
- "serverPort": 21001,
- "password": "ourvpn01010101",
+ "serverAddress": "127.0.0.1",
+ "serverPort": 1081,
+ "password": "shadowsocks-over-websocket",
"method": "aes-256-cfb"
}
\ No newline at end of file
diff --git a/local.js b/local.js
index 3c33b97..60c1fbc 100644
--- a/local.js
+++ b/local.js
@@ -5,7 +5,7 @@ new TCPRelay({
localAddress: '127.0.0.1',
localPort: 1080,
serverAddress: '127.0.0.1',
- serverPort: 21001,
- password: 'ourvpn01010101',
- method: "aes-256-cfb"
-}, true, 'error').bootstrap();
\ No newline at end of file
+ serverPort: 1081,
+ password: 'shadowsocks-over-websocket',
+ method: 'aes-256-cfb'
+}, true, 'info').bootstrap();
\ No newline at end of file
diff --git a/node_modules/bl/node_modules/isarray/index.js b/node_modules/bl/node_modules/isarray/index.js
deleted file mode 100644
index a57f634..0000000
--- a/node_modules/bl/node_modules/isarray/index.js
+++ /dev/null
@@ -1,5 +0,0 @@
-var toString = {}.toString;
-
-module.exports = Array.isArray || function (arr) {
- return toString.call(arr) == '[object Array]';
-};
diff --git a/node_modules/bl/node_modules/readable-stream/.npmignore b/node_modules/bl/node_modules/readable-stream/.npmignore
deleted file mode 100644
index 6d270c6..0000000
--- a/node_modules/bl/node_modules/readable-stream/.npmignore
+++ /dev/null
@@ -1,9 +0,0 @@
-build/
-test/
-examples/
-fs.js
-zlib.js
-.zuul.yml
-.nyc_output
-coverage
-docs/
diff --git a/node_modules/bl/node_modules/readable-stream/LICENSE b/node_modules/bl/node_modules/readable-stream/LICENSE
deleted file mode 100644
index 2873b3b..0000000
--- a/node_modules/bl/node_modules/readable-stream/LICENSE
+++ /dev/null
@@ -1,47 +0,0 @@
-Node.js is licensed for use as follows:
-
-"""
-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.
-"""
-
-This license applies to parts of Node.js originating from the
-https://github.com/joyent/node repository:
-
-"""
-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/node_modules/bl/node_modules/readable-stream/README.md b/node_modules/bl/node_modules/readable-stream/README.md
deleted file mode 100644
index ff75b0d..0000000
--- a/node_modules/bl/node_modules/readable-stream/README.md
+++ /dev/null
@@ -1,57 +0,0 @@
-# readable-stream
-
-***Node-core v7.0.0 streams for userland*** [](https://travis-ci.org/nodejs/readable-stream)
-
-
-[](https://nodei.co/npm/readable-stream/)
-[](https://nodei.co/npm/readable-stream/)
-
-
-[](https://saucelabs.com/u/readable-stream)
-
-```bash
-npm install --save readable-stream
-```
-
-***Node-core streams for userland***
-
-This package is a mirror of the Streams2 and Streams3 implementations in
-Node-core.
-
-Full documentation may be found on the [Node.js website](https://nodejs.org/dist/v7.7.3/docs/api/).
-
-If you want to guarantee a stable streams base, regardless of what version of
-Node you, or the users of your libraries are using, use **readable-stream** *only* and avoid the *"stream"* module in Node-core, for background see [this blogpost](http://r.va.gg/2014/06/why-i-dont-use-nodes-core-stream-module.html).
-
-As of version 2.0.0 **readable-stream** uses semantic versioning.
-
-# Streams Working Group
-
-`readable-stream` is maintained by the Streams Working Group, which
-oversees the development and maintenance of the Streams API within
-Node.js. The responsibilities of the Streams Working Group include:
-
-* Addressing stream issues on the Node.js issue tracker.
-* Authoring and editing stream documentation within the Node.js project.
-* Reviewing changes to stream subclasses within the Node.js project.
-* Redirecting changes to streams from the Node.js project to this
- project.
-* Assisting in the implementation of stream providers within Node.js.
-* Recommending versions of `readable-stream` to be included in Node.js.
-* Messaging about the future of streams to give the community advance
- notice of changes.
-
-
-## Team Members
-
-* **Chris Dickinson** ([@chrisdickinson](https://github.com/chrisdickinson)) <christopher.s.dickinson@gmail.com>
- - Release GPG key: 9554F04D7259F04124DE6B476D5A82AC7E37093B
-* **Calvin Metcalf** ([@calvinmetcalf](https://github.com/calvinmetcalf)) <calvin.metcalf@gmail.com>
- - Release GPG key: F3EF5F62A87FC27A22E643F714CE4FF5015AA242
-* **Rod Vagg** ([@rvagg](https://github.com/rvagg)) <rod@vagg.org>
- - Release GPG key: DD8F2338BAE7501E3DD5AC78C273792F7D83545D
-* **Sam Newman** ([@sonewman](https://github.com/sonewman)) <newmansam@outlook.com>
-* **Mathias Buus** ([@mafintosh](https://github.com/mafintosh)) <mathiasbuus@gmail.com>
-* **Domenic Denicola** ([@domenic](https://github.com/domenic)) <d@domenic.me>
-* **Matteo Collina** ([@mcollina](https://github.com/mcollina)) <matteo.collina@gmail.com>
- - Release GPG key: 3ABC01543F22DD2239285CDD818674489FBC127E
diff --git a/node_modules/bl/node_modules/readable-stream/lib/_stream_duplex.js b/node_modules/bl/node_modules/readable-stream/lib/_stream_duplex.js
deleted file mode 100644
index 736693b..0000000
--- a/node_modules/bl/node_modules/readable-stream/lib/_stream_duplex.js
+++ /dev/null
@@ -1,75 +0,0 @@
-// a duplex stream is just a stream that is both readable and writable.
-// Since JS doesn't have multiple prototypal inheritance, this class
-// prototypally inherits from Readable, and then parasitically from
-// Writable.
-
-'use strict';
-
-/**/
-
-var objectKeys = Object.keys || function (obj) {
- var keys = [];
- for (var key in obj) {
- keys.push(key);
- }return keys;
-};
-/**/
-
-module.exports = Duplex;
-
-/**/
-var processNextTick = require('process-nextick-args');
-/**/
-
-/**/
-var util = require('core-util-is');
-util.inherits = require('inherits');
-/**/
-
-var Readable = require('./_stream_readable');
-var Writable = require('./_stream_writable');
-
-util.inherits(Duplex, Readable);
-
-var keys = objectKeys(Writable.prototype);
-for (var v = 0; v < keys.length; v++) {
- var method = keys[v];
- if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
-}
-
-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.
- processNextTick(onEndNT, this);
-}
-
-function onEndNT(self) {
- self.end();
-}
-
-function forEach(xs, f) {
- for (var i = 0, l = xs.length; i < l; i++) {
- f(xs[i], i);
- }
-}
\ No newline at end of file
diff --git a/node_modules/bl/node_modules/readable-stream/lib/_stream_passthrough.js b/node_modules/bl/node_modules/readable-stream/lib/_stream_passthrough.js
deleted file mode 100644
index d06f71f..0000000
--- a/node_modules/bl/node_modules/readable-stream/lib/_stream_passthrough.js
+++ /dev/null
@@ -1,26 +0,0 @@
-// a passthrough stream.
-// basically just the most minimal sort of Transform stream.
-// Every written chunk gets output as-is.
-
-'use strict';
-
-module.exports = PassThrough;
-
-var Transform = require('./_stream_transform');
-
-/**/
-var util = require('core-util-is');
-util.inherits = require('inherits');
-/**/
-
-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);
-};
\ No newline at end of file
diff --git a/node_modules/bl/node_modules/readable-stream/lib/_stream_writable.js b/node_modules/bl/node_modules/readable-stream/lib/_stream_writable.js
deleted file mode 100644
index 575beb3..0000000
--- a/node_modules/bl/node_modules/readable-stream/lib/_stream_writable.js
+++ /dev/null
@@ -1,551 +0,0 @@
-// A bit simpler than readable streams.
-// Implement an async ._write(chunk, encoding, cb), and it'll handle all
-// the drain event emission and buffering.
-
-'use strict';
-
-module.exports = Writable;
-
-/**/
-var processNextTick = require('process-nextick-args');
-/**/
-
-/**/
-var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : processNextTick;
-/**/
-
-/**/
-var Duplex;
-/**/
-
-Writable.WritableState = WritableState;
-
-/**/
-var util = require('core-util-is');
-util.inherits = require('inherits');
-/**/
-
-/**/
-var internalUtil = {
- deprecate: require('util-deprecate')
-};
-/**/
-
-/**/
-var Stream;
-(function () {
- try {
- Stream = require('st' + 'ream');
- } catch (_) {} finally {
- if (!Stream) Stream = require('events').EventEmitter;
- }
-})();
-/**/
-
-var Buffer = require('buffer').Buffer;
-/**/
-var bufferShim = require('buffer-shims');
-/**/
-
-util.inherits(Writable, Stream);
-
-function nop() {}
-
-function WriteReq(chunk, encoding, cb) {
- this.chunk = chunk;
- this.encoding = encoding;
- this.callback = cb;
- this.next = null;
-}
-
-function WritableState(options, stream) {
- Duplex = Duplex || require('./_stream_duplex');
-
- options = options || {};
-
- // 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;
-
- // 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 = this.objectMode ? 16 : 16 * 1024;
- this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm;
-
- // cast to ints.
- this.highWaterMark = ~~this.highWaterMark;
-
- // drain event flag.
- this.needDrain = false;
- // at the start of calling end()
- this.ending = false;
- // when end() has been called, and returned
- this.ended = false;
- // when 'finish' is emitted
- this.finished = false;
-
- // 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.bufferedRequest = null;
- this.lastBufferedRequest = null;
-
- // 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;
-
- // count buffered requests
- this.bufferedRequestCount = 0;
-
- // allocate the first CorkedRequest, there is always
- // one allocated and free to use, and we maintain at most two
- this.corkedRequestsFree = new CorkedRequest(this);
-}
-
-WritableState.prototype.getBuffer = function getBuffer() {
- var current = this.bufferedRequest;
- var out = [];
- while (current) {
- out.push(current);
- current = current.next;
- }
- return out;
-};
-
-(function () {
- try {
- Object.defineProperty(WritableState.prototype, 'buffer', {
- get: internalUtil.deprecate(function () {
- return this.getBuffer();
- }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.')
- });
- } catch (_) {}
-})();
-
-// Test _writableState for inheritance to account for Duplex streams,
-// whose prototype chain only points to Readable.
-var realHasInstance;
-if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {
- realHasInstance = Function.prototype[Symbol.hasInstance];
- Object.defineProperty(Writable, Symbol.hasInstance, {
- value: function (object) {
- if (realHasInstance.call(this, object)) return true;
-
- return object && object._writableState instanceof WritableState;
- }
- });
-} else {
- realHasInstance = function (object) {
- return object instanceof this;
- };
-}
-
-function Writable(options) {
- Duplex = Duplex || require('./_stream_duplex');
-
- // Writable ctor is applied to Duplexes, too.
- // `realHasInstance` is necessary because using plain `instanceof`
- // would return false, as no `_writableState` property is attached.
-
- // Trying to use the custom `instanceof` for Writable here will also break the
- // Node.js LazyTransform implementation, which has a non-trivial getter for
- // `_writableState` that would lead to infinite recursion.
- if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) {
- return new Writable(options);
- }
-
- this._writableState = new WritableState(options, this);
-
- // legacy.
- this.writable = true;
-
- if (options) {
- if (typeof options.write === 'function') this._write = options.write;
-
- if (typeof options.writev === 'function') this._writev = options.writev;
- }
-
- 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, cb) {
- var er = new Error('write after end');
- // TODO: defer error events consistently everywhere, not just the cb
- stream.emit('error', er);
- processNextTick(cb, er);
-}
-
-// Checks that a user-supplied chunk is valid, especially for the particular
-// mode the stream is in. Currently this means that `null` is never accepted
-// and undefined/non-string values are only allowed in object mode.
-function validChunk(stream, state, chunk, cb) {
- var valid = true;
- var er = false;
-
- if (chunk === null) {
- er = new TypeError('May not write null values to stream');
- } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
- er = new TypeError('Invalid non-string/buffer chunk');
- }
- if (er) {
- stream.emit('error', er);
- processNextTick(cb, er);
- valid = false;
- }
- return valid;
-}
-
-Writable.prototype.write = function (chunk, encoding, cb) {
- var state = this._writableState;
- var ret = false;
- var isBuf = Buffer.isBuffer(chunk);
-
- if (typeof encoding === 'function') {
- cb = encoding;
- encoding = null;
- }
-
- if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;
-
- if (typeof cb !== 'function') cb = nop;
-
- if (state.ended) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {
- state.pendingcb++;
- ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);
- }
-
- return ret;
-};
-
-Writable.prototype.cork = function () {
- 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.bufferedRequest) clearBuffer(this, state);
- }
-};
-
-Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
- // node::ParseEncoding() requires lower case.
- if (typeof encoding === 'string') encoding = encoding.toLowerCase();
- if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding);
- this._writableState.defaultEncoding = encoding;
- return this;
-};
-
-function decodeChunk(state, chunk, encoding) {
- if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {
- chunk = bufferShim.from(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, isBuf, chunk, encoding, cb) {
- if (!isBuf) {
- chunk = decodeChunk(state, chunk, encoding);
- if (Buffer.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) {
- var last = state.lastBufferedRequest;
- state.lastBufferedRequest = new WriteReq(chunk, encoding, cb);
- if (last) {
- last.next = state.lastBufferedRequest;
- } else {
- state.bufferedRequest = state.lastBufferedRequest;
- }
- state.bufferedRequestCount += 1;
- } 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) {
- --state.pendingcb;
- if (sync) processNextTick(cb, er);else 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(state);
-
- if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
- clearBuffer(stream, state);
- }
-
- if (sync) {
- /**/
- asyncWrite(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;
- var entry = state.bufferedRequest;
-
- if (stream._writev && entry && entry.next) {
- // Fast case, write everything using _writev()
- var l = state.bufferedRequestCount;
- var buffer = new Array(l);
- var holder = state.corkedRequestsFree;
- holder.entry = entry;
-
- var count = 0;
- while (entry) {
- buffer[count] = entry;
- entry = entry.next;
- count += 1;
- }
-
- doWrite(stream, state, true, state.length, buffer, '', holder.finish);
-
- // doWrite is almost always async, defer these to save a bit of time
- // as the hot path ends with doWrite
- state.pendingcb++;
- state.lastBufferedRequest = null;
- if (holder.next) {
- state.corkedRequestsFree = holder.next;
- holder.next = null;
- } else {
- state.corkedRequestsFree = new CorkedRequest(state);
- }
- } else {
- // Slow case, write chunks one-by-one
- while (entry) {
- 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);
- entry = entry.next;
- // if we didn't call the onwrite immediately, then
- // it means that we need to wait until it does.
- // also, that means that the chunk and cb are currently
- // being processed, so move the buffer counter past them.
- if (state.writing) {
- break;
- }
- }
-
- if (entry === null) state.lastBufferedRequest = null;
- }
-
- state.bufferedRequestCount = 0;
- state.bufferedRequest = entry;
- state.bufferProcessing = false;
-}
-
-Writable.prototype._write = function (chunk, encoding, cb) {
- cb(new Error('_write() is not implemented'));
-};
-
-Writable.prototype._writev = null;
-
-Writable.prototype.end = function (chunk, encoding, cb) {
- var state = this._writableState;
-
- if (typeof chunk === 'function') {
- cb = chunk;
- chunk = null;
- encoding = null;
- } else if (typeof encoding === 'function') {
- cb = encoding;
- encoding = null;
- }
-
- if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);
-
- // .end() fully uncorks
- if (state.corked) {
- state.corked = 1;
- this.uncork();
- }
-
- // ignore unnecessary end() calls.
- if (!state.ending && !state.finished) endWritable(this, state, cb);
-};
-
-function needFinish(state) {
- return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
-}
-
-function prefinish(stream, state) {
- if (!state.prefinished) {
- state.prefinished = true;
- stream.emit('prefinish');
- }
-}
-
-function finishMaybe(stream, state) {
- var need = needFinish(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) processNextTick(cb);else stream.once('finish', cb);
- }
- state.ended = true;
- stream.writable = false;
-}
-
-// It seems a linked list but it is not
-// there will be only 2 of these for each stream
-function CorkedRequest(state) {
- var _this = this;
-
- this.next = null;
- this.entry = null;
- this.finish = function (err) {
- var entry = _this.entry;
- _this.entry = null;
- while (entry) {
- var cb = entry.callback;
- state.pendingcb--;
- cb(err);
- entry = entry.next;
- }
- if (state.corkedRequestsFree) {
- state.corkedRequestsFree.next = _this;
- } else {
- state.corkedRequestsFree = _this;
- }
- };
-}
\ No newline at end of file
diff --git a/node_modules/bl/node_modules/readable-stream/package.json b/node_modules/bl/node_modules/readable-stream/package.json
deleted file mode 100644
index f581486..0000000
--- a/node_modules/bl/node_modules/readable-stream/package.json
+++ /dev/null
@@ -1,147 +0,0 @@
-{
- "_args": [
- [
- {
- "raw": "readable-stream@^2.0.0",
- "scope": null,
- "escapedName": "readable-stream",
- "name": "readable-stream",
- "rawSpec": "^2.0.0",
- "spec": ">=2.0.0 <3.0.0",
- "type": "range"
- },
- "/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/tar-stream"
- ],
- [
- {
- "raw": "readable-stream@^2.0.5",
- "scope": null,
- "escapedName": "readable-stream",
- "name": "readable-stream",
- "rawSpec": "^2.0.5",
- "spec": ">=2.0.5 <3.0.0",
- "type": "range"
- },
- "/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/bl"
- ]
- ],
- "_cnpm_publish_time": 1489651347637,
- "_from": "readable-stream@^2.0.5",
- "_id": "readable-stream@2.2.6",
- "_inCache": true,
- "_installable": true,
- "_location": "/bl/readable-stream",
- "_nodeVersion": "6.9.4",
- "_npmOperationalInternal": {
- "host": "packages-12-west.internal.npmjs.com",
- "tmp": "tmp/readable-stream-2.2.6.tgz_1489651345676_0.6984770004637539"
- },
- "_npmUser": {
- "name": "matteo.collina",
- "email": "hello@matteocollina.com"
- },
- "_npmVersion": "3.10.10",
- "_phantomChildren": {},
- "_requested": {
- "raw": "readable-stream@^2.0.5",
- "scope": null,
- "escapedName": "readable-stream",
- "name": "readable-stream",
- "rawSpec": "^2.0.5",
- "spec": ">=2.0.5 <3.0.0",
- "type": "range"
- },
- "_requiredBy": [
- "/bl"
- ],
- "_resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.2.6.tgz",
- "_shasum": "8b43aed76e71483938d12a8d46c6cf1a00b1f816",
- "_shrinkwrap": null,
- "_spec": "readable-stream@^2.0.5",
- "_where": "/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/bl",
- "browser": {
- "util": false
- },
- "bugs": {
- "url": "https://github.com/nodejs/readable-stream/issues"
- },
- "dependencies": {
- "buffer-shims": "^1.0.0",
- "core-util-is": "~1.0.0",
- "inherits": "~2.0.1",
- "isarray": "~1.0.0",
- "process-nextick-args": "~1.0.6",
- "string_decoder": "~0.10.x",
- "util-deprecate": "~1.0.1"
- },
- "description": "Streams3, a user-land copy of the stream library from Node.js",
- "devDependencies": {
- "assert": "~1.4.0",
- "babel-polyfill": "^6.9.1",
- "buffer": "^4.9.0",
- "nyc": "^6.4.0",
- "tap": "~0.7.1",
- "tape": "~4.5.1",
- "zuul": "~3.10.0"
- },
- "directories": {},
- "dist": {
- "shasum": "8b43aed76e71483938d12a8d46c6cf1a00b1f816",
- "tarball": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.2.6.tgz"
- },
- "gitHead": "f94eebc1c5b637e6575735e6923ec79ee3139284",
- "homepage": "https://github.com/nodejs/readable-stream#readme",
- "keywords": [
- "readable",
- "stream",
- "pipe"
- ],
- "license": "MIT",
- "main": "readable.js",
- "maintainers": [
- {
- "name": "cwmma",
- "email": "calvin.metcalf@gmail.com"
- },
- {
- "name": "isaacs",
- "email": "i@izs.me"
- },
- {
- "name": "matteo.collina",
- "email": "hello@matteocollina.com"
- },
- {
- "name": "rvagg",
- "email": "rod@vagg.org"
- },
- {
- "name": "tootallnate",
- "email": "nathan@tootallnate.net"
- }
- ],
- "name": "readable-stream",
- "nyc": {
- "include": [
- "lib/**.js"
- ]
- },
- "optionalDependencies": {},
- "react-native": {
- "stream": false
- },
- "readme": "ERROR: No README data found!",
- "repository": {
- "type": "git",
- "url": "git://github.com/nodejs/readable-stream.git"
- },
- "scripts": {
- "browser": "npm run write-zuul && zuul --browser-retries 2 -- test/browser.js",
- "cover": "nyc npm test",
- "local": "zuul --local 3000 --no-coverage -- test/browser.js",
- "report": "nyc report --reporter=lcov",
- "test": "tap test/parallel/*.js test/ours/*.js",
- "write-zuul": "printf \"ui: tape\nbrowsers:\n - name: $BROWSER_NAME\n version: $BROWSER_VERSION\n\">.zuul.yml"
- },
- "version": "2.2.6"
-}
diff --git a/node_modules/bl/package.json b/node_modules/bl/package.json
index e84f882..e6950f0 100644
--- a/node_modules/bl/package.json
+++ b/node_modules/bl/package.json
@@ -28,14 +28,7 @@
"email": "hello@matteocollina.com"
},
"_npmVersion": "3.10.8",
- "_phantomChildren": {
- "buffer-shims": "1.0.0",
- "core-util-is": "1.0.2",
- "inherits": "2.0.3",
- "process-nextick-args": "1.0.7",
- "string_decoder": "0.10.31",
- "util-deprecate": "1.0.2"
- },
+ "_phantomChildren": {},
"_requested": {
"raw": "bl@^1.0.0",
"scope": null,
diff --git a/node_modules/buffer-shims/package.json b/node_modules/buffer-shims/package.json
index 0ca2839..8a984cd 100644
--- a/node_modules/buffer-shims/package.json
+++ b/node_modules/buffer-shims/package.json
@@ -10,7 +10,7 @@
"spec": ">=1.0.0 <2.0.0",
"type": "range"
},
- "/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/bl/node_modules/readable-stream"
+ "/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/readable-stream"
]
],
"_from": "buffer-shims@>=1.0.0 <2.0.0",
@@ -39,14 +39,13 @@
"type": "range"
},
"_requiredBy": [
- "/bl/readable-stream",
- "/tar-stream/readable-stream"
+ "/readable-stream"
],
"_resolved": "http://registry.npmjs.org/buffer-shims/-/buffer-shims-1.0.0.tgz",
"_shasum": "9978ce317388c649ad8793028c3477ef044a8b51",
"_shrinkwrap": null,
"_spec": "buffer-shims@^1.0.0",
- "_where": "/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/bl/node_modules/readable-stream",
+ "_where": "/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/readable-stream",
"bugs": {
"url": "https://github.com/calvinmetcalf/buffer-shims/issues"
},
diff --git a/node_modules/bufferutil/package.json b/node_modules/bufferutil/package.json
index 7c7e88d..5e19c19 100644
--- a/node_modules/bufferutil/package.json
+++ b/node_modules/bufferutil/package.json
@@ -2,18 +2,18 @@
"_args": [
[
{
- "raw": "bufferutil",
+ "raw": "bufferutil@^3.0.0",
"scope": null,
"escapedName": "bufferutil",
"name": "bufferutil",
- "rawSpec": "",
- "spec": "latest",
- "type": "tag"
+ "rawSpec": "^3.0.0",
+ "spec": ">=3.0.0 <4.0.0",
+ "type": "range"
},
"/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket"
]
],
- "_from": "bufferutil@latest",
+ "_from": "bufferutil@>=3.0.0 <4.0.0",
"_id": "bufferutil@3.0.0",
"_inCache": true,
"_installable": true,
@@ -30,22 +30,21 @@
"_npmVersion": "4.1.2",
"_phantomChildren": {},
"_requested": {
- "raw": "bufferutil",
+ "raw": "bufferutil@^3.0.0",
"scope": null,
"escapedName": "bufferutil",
"name": "bufferutil",
- "rawSpec": "",
- "spec": "latest",
- "type": "tag"
+ "rawSpec": "^3.0.0",
+ "spec": ">=3.0.0 <4.0.0",
+ "type": "range"
},
"_requiredBy": [
- "#USER",
"/"
],
"_resolved": "http://registry.npmjs.org/bufferutil/-/bufferutil-3.0.0.tgz",
"_shasum": "afbb831c47229accf0b1f207d4a9942841b0ab0f",
"_shrinkwrap": null,
- "_spec": "bufferutil",
+ "_spec": "bufferutil@^3.0.0",
"_where": "/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket",
"author": {
"name": "Einar Otto Stangvik",
diff --git a/node_modules/core-util-is/package.json b/node_modules/core-util-is/package.json
index 7357055..13c4d64 100644
--- a/node_modules/core-util-is/package.json
+++ b/node_modules/core-util-is/package.json
@@ -35,7 +35,8 @@
"type": "range"
},
"_requiredBy": [
- "/readable-stream"
+ "/readable-stream",
+ "/streamroller/readable-stream"
],
"_resolved": "http://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
"_shasum": "b5fd54220aa2bc5ab57aab7140c940754503c1a7",
diff --git a/node_modules/inherits/package.json b/node_modules/inherits/package.json
index d01511f..cfcdc42 100644
--- a/node_modules/inherits/package.json
+++ b/node_modules/inherits/package.json
@@ -39,7 +39,8 @@
"type": "range"
},
"_requiredBy": [
- "/readable-stream"
+ "/readable-stream",
+ "/streamroller/readable-stream"
],
"_resolved": "http://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
"_shasum": "633c2c83e3da42a502f52466022480f4208261de",
diff --git a/node_modules/bl/node_modules/isarray/.npmignore b/node_modules/isarray/.npmignore
similarity index 100%
rename from node_modules/bl/node_modules/isarray/.npmignore
rename to node_modules/isarray/.npmignore
diff --git a/node_modules/bl/node_modules/isarray/.travis.yml b/node_modules/isarray/.travis.yml
similarity index 100%
rename from node_modules/bl/node_modules/isarray/.travis.yml
rename to node_modules/isarray/.travis.yml
diff --git a/node_modules/bl/node_modules/isarray/Makefile b/node_modules/isarray/Makefile
similarity index 100%
rename from node_modules/bl/node_modules/isarray/Makefile
rename to node_modules/isarray/Makefile
diff --git a/node_modules/isarray/README.md b/node_modules/isarray/README.md
index 052a62b..16d2c59 100644
--- a/node_modules/isarray/README.md
+++ b/node_modules/isarray/README.md
@@ -3,6 +3,12 @@
`Array#isArray` for older browsers.
+[](http://travis-ci.org/juliangruber/isarray)
+[](https://www.npmjs.org/package/isarray)
+
+[
+](https://ci.testling.com/juliangruber/isarray)
+
## Usage
```js
diff --git a/node_modules/isarray/index.js b/node_modules/isarray/index.js
index 5f5ad45..a57f634 100644
--- a/node_modules/isarray/index.js
+++ b/node_modules/isarray/index.js
@@ -1,3 +1,5 @@
+var toString = {}.toString;
+
module.exports = Array.isArray || function (arr) {
- return Object.prototype.toString.call(arr) == '[object Array]';
+ return toString.call(arr) == '[object Array]';
};
diff --git a/node_modules/isarray/package.json b/node_modules/isarray/package.json
index 577ea03..2d523a2 100644
--- a/node_modules/isarray/package.json
+++ b/node_modules/isarray/package.json
@@ -2,44 +2,45 @@
"_args": [
[
{
- "raw": "isarray@0.0.1",
+ "raw": "isarray@~1.0.0",
"scope": null,
"escapedName": "isarray",
"name": "isarray",
- "rawSpec": "0.0.1",
- "spec": "0.0.1",
- "type": "version"
+ "rawSpec": "~1.0.0",
+ "spec": ">=1.0.0 <1.1.0",
+ "type": "range"
},
"/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/readable-stream"
]
],
- "_from": "isarray@0.0.1",
- "_id": "isarray@0.0.1",
+ "_from": "isarray@>=1.0.0 <1.1.0",
+ "_id": "isarray@1.0.0",
"_inCache": true,
"_installable": true,
"_location": "/isarray",
+ "_nodeVersion": "5.1.0",
"_npmUser": {
"name": "juliangruber",
"email": "julian@juliangruber.com"
},
- "_npmVersion": "1.2.18",
+ "_npmVersion": "3.3.12",
"_phantomChildren": {},
"_requested": {
- "raw": "isarray@0.0.1",
+ "raw": "isarray@~1.0.0",
"scope": null,
"escapedName": "isarray",
"name": "isarray",
- "rawSpec": "0.0.1",
- "spec": "0.0.1",
- "type": "version"
+ "rawSpec": "~1.0.0",
+ "spec": ">=1.0.0 <1.1.0",
+ "type": "range"
},
"_requiredBy": [
"/readable-stream"
],
- "_resolved": "http://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
- "_shasum": "8a18acfca9a8f4177e09abfc6038939b05d1eedf",
+ "_resolved": "http://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
+ "_shasum": "bb935d48582cba168c06834957a54a3e07124f11",
"_shrinkwrap": null,
- "_spec": "isarray@0.0.1",
+ "_spec": "isarray@~1.0.0",
"_where": "/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/readable-stream",
"author": {
"name": "Julian Gruber",
@@ -52,13 +53,14 @@
"dependencies": {},
"description": "Array#isArray for older browsers",
"devDependencies": {
- "tap": "*"
+ "tape": "~2.13.4"
},
"directories": {},
"dist": {
- "shasum": "8a18acfca9a8f4177e09abfc6038939b05d1eedf",
- "tarball": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz"
+ "shasum": "bb935d48582cba168c06834957a54a3e07124f11",
+ "tarball": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz"
},
+ "gitHead": "2a23a281f369e9ae06394c0fb4d2381355a6ba33",
"homepage": "https://github.com/juliangruber/isarray",
"keywords": [
"browser",
@@ -81,7 +83,23 @@
"url": "git://github.com/juliangruber/isarray.git"
},
"scripts": {
- "test": "tap test/*.js"
+ "test": "tape test.js"
},
- "version": "0.0.1"
+ "testling": {
+ "files": "test.js",
+ "browsers": [
+ "ie/8..latest",
+ "firefox/17..latest",
+ "firefox/nightly",
+ "chrome/22..latest",
+ "chrome/canary",
+ "opera/12..latest",
+ "opera/next",
+ "safari/5.1..latest",
+ "ipad/6.0..latest",
+ "iphone/6.0..latest",
+ "android-browser/4.2..latest"
+ ]
+ },
+ "version": "1.0.0"
}
diff --git a/node_modules/bl/node_modules/isarray/test.js b/node_modules/isarray/test.js
similarity index 100%
rename from node_modules/bl/node_modules/isarray/test.js
rename to node_modules/isarray/test.js
diff --git a/node_modules/log4js/package.json b/node_modules/log4js/package.json
index 5e161b6..27577ec 100644
--- a/node_modules/log4js/package.json
+++ b/node_modules/log4js/package.json
@@ -2,18 +2,18 @@
"_args": [
[
{
- "raw": "log4js",
+ "raw": "log4js@^1.1.1",
"scope": null,
"escapedName": "log4js",
"name": "log4js",
- "rawSpec": "",
- "spec": "latest",
- "type": "tag"
+ "rawSpec": "^1.1.1",
+ "spec": ">=1.1.1 <2.0.0",
+ "type": "range"
},
"/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket"
]
],
- "_from": "log4js@latest",
+ "_from": "log4js@>=1.1.1 <2.0.0",
"_id": "log4js@1.1.1",
"_inCache": true,
"_installable": true,
@@ -30,22 +30,21 @@
"_npmVersion": "3.10.10",
"_phantomChildren": {},
"_requested": {
- "raw": "log4js",
+ "raw": "log4js@^1.1.1",
"scope": null,
"escapedName": "log4js",
"name": "log4js",
- "rawSpec": "",
- "spec": "latest",
- "type": "tag"
+ "rawSpec": "^1.1.1",
+ "spec": ">=1.1.1 <2.0.0",
+ "type": "range"
},
"_requiredBy": [
- "#USER",
"/"
],
"_resolved": "http://registry.npmjs.org/log4js/-/log4js-1.1.1.tgz",
"_shasum": "c21d29c7604089e4f255833e7f94b3461de1ff43",
"_shrinkwrap": null,
- "_spec": "log4js",
+ "_spec": "log4js@^1.1.1",
"_where": "/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket",
"author": {
"name": "Gareth Jones",
diff --git a/node_modules/minimist/.travis.yml b/node_modules/minimist/.travis.yml
index cc4dba2..74c57bf 100644
--- a/node_modules/minimist/.travis.yml
+++ b/node_modules/minimist/.travis.yml
@@ -2,3 +2,7 @@ language: node_js
node_js:
- "0.8"
- "0.10"
+ - "0.12"
+ - "iojs"
+before_install:
+ - npm install -g npm@~1.4.6
diff --git a/node_modules/minimist/index.js b/node_modules/minimist/index.js
index 584f551..6a0559d 100644
--- a/node_modules/minimist/index.js
+++ b/node_modules/minimist/index.js
@@ -1,15 +1,19 @@
module.exports = function (args, opts) {
if (!opts) opts = {};
- var flags = { bools : {}, strings : {} };
-
- [].concat(opts['boolean']).filter(Boolean).forEach(function (key) {
- flags.bools[key] = true;
- });
-
- [].concat(opts.string).filter(Boolean).forEach(function (key) {
- flags.strings[key] = true;
- });
+ var flags = { bools : {}, strings : {}, unknownFn: null };
+
+ if (typeof opts['unknown'] === 'function') {
+ flags.unknownFn = opts['unknown'];
+ }
+
+ if (typeof opts['boolean'] === 'boolean' && opts['boolean']) {
+ flags.allBools = true;
+ } else {
+ [].concat(opts['boolean']).filter(Boolean).forEach(function (key) {
+ flags.bools[key] = true;
+ });
+ }
var aliases = {};
Object.keys(opts.alias || {}).forEach(function (key) {
@@ -20,7 +24,14 @@ module.exports = function (args, opts) {
}));
});
});
-
+
+ [].concat(opts.string).filter(Boolean).forEach(function (key) {
+ flags.strings[key] = true;
+ if (aliases[key]) {
+ flags.strings[aliases[key]] = true;
+ }
+ });
+
var defaults = opts['default'] || {};
var argv = { _ : [] };
@@ -35,7 +46,16 @@ module.exports = function (args, opts) {
args = args.slice(0, args.indexOf('--'));
}
- function setArg (key, val) {
+ function argDefined(key, arg) {
+ return (flags.allBools && /^--[^=]+$/.test(arg)) ||
+ flags.strings[key] || flags.bools[key] || aliases[key];
+ }
+
+ function setArg (key, val, arg) {
+ if (arg && flags.unknownFn && !argDefined(key, arg)) {
+ if (flags.unknownFn(arg) === false) return;
+ }
+
var value = !flags.strings[key] && isNumber(val)
? Number(val) : val
;
@@ -45,7 +65,32 @@ module.exports = function (args, opts) {
setKey(argv, x.split('.'), value);
});
}
+
+ function setKey (obj, keys, value) {
+ var o = obj;
+ keys.slice(0,-1).forEach(function (key) {
+ if (o[key] === undefined) o[key] = {};
+ o = o[key];
+ });
+
+ var key = keys[keys.length - 1];
+ if (o[key] === undefined || flags.bools[key] || typeof o[key] === 'boolean') {
+ o[key] = value;
+ }
+ else if (Array.isArray(o[key])) {
+ o[key].push(value);
+ }
+ else {
+ o[key] = [ o[key], value ];
+ }
+ }
+ function aliasIsBoolean(key) {
+ return aliases[key].some(function (x) {
+ return flags.bools[x];
+ });
+ }
+
for (var i = 0; i < args.length; i++) {
var arg = args[i];
@@ -54,27 +99,33 @@ module.exports = function (args, opts) {
// 'dotall' regex modifier. See:
// http://stackoverflow.com/a/1068308/13216
var m = arg.match(/^--([^=]+)=([\s\S]*)$/);
- setArg(m[1], m[2]);
+ var key = m[1];
+ var value = m[2];
+ if (flags.bools[key]) {
+ value = value !== 'false';
+ }
+ setArg(key, value, arg);
}
else if (/^--no-.+/.test(arg)) {
var key = arg.match(/^--no-(.+)/)[1];
- setArg(key, false);
+ setArg(key, false, arg);
}
else if (/^--.+/.test(arg)) {
var key = arg.match(/^--(.+)/)[1];
var next = args[i + 1];
if (next !== undefined && !/^-/.test(next)
&& !flags.bools[key]
- && (aliases[key] ? !flags.bools[aliases[key]] : true)) {
- setArg(key, next);
+ && !flags.allBools
+ && (aliases[key] ? !aliasIsBoolean(key) : true)) {
+ setArg(key, next, arg);
i++;
}
else if (/^(true|false)$/.test(next)) {
- setArg(key, next === 'true');
+ setArg(key, next === 'true', arg);
i++;
}
else {
- setArg(key, flags.strings[key] ? '' : true);
+ setArg(key, flags.strings[key] ? '' : true, arg);
}
}
else if (/^-[^-]+/.test(arg)) {
@@ -85,24 +136,30 @@ module.exports = function (args, opts) {
var next = arg.slice(j+2);
if (next === '-') {
- setArg(letters[j], next)
+ setArg(letters[j], next, arg)
continue;
}
+ if (/[A-Za-z]/.test(letters[j]) && /=/.test(next)) {
+ setArg(letters[j], next.split('=')[1], arg);
+ broken = true;
+ break;
+ }
+
if (/[A-Za-z]/.test(letters[j])
&& /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) {
- setArg(letters[j], next);
+ setArg(letters[j], next, arg);
broken = true;
break;
}
if (letters[j+1] && letters[j+1].match(/\W/)) {
- setArg(letters[j], arg.slice(j+2));
+ setArg(letters[j], arg.slice(j+2), arg);
broken = true;
break;
}
else {
- setArg(letters[j], flags.strings[letters[j]] ? '' : true);
+ setArg(letters[j], flags.strings[letters[j]] ? '' : true, arg);
}
}
@@ -110,23 +167,29 @@ module.exports = function (args, opts) {
if (!broken && key !== '-') {
if (args[i+1] && !/^(-|--)[^-]/.test(args[i+1])
&& !flags.bools[key]
- && (aliases[key] ? !flags.bools[aliases[key]] : true)) {
- setArg(key, args[i+1]);
+ && (aliases[key] ? !aliasIsBoolean(key) : true)) {
+ setArg(key, args[i+1], arg);
i++;
}
else if (args[i+1] && /true|false/.test(args[i+1])) {
- setArg(key, args[i+1] === 'true');
+ setArg(key, args[i+1] === 'true', arg);
i++;
}
else {
- setArg(key, flags.strings[key] ? '' : true);
+ setArg(key, flags.strings[key] ? '' : true, arg);
}
}
}
else {
- argv._.push(
- flags.strings['_'] || !isNumber(arg) ? arg : Number(arg)
- );
+ if (!flags.unknownFn || flags.unknownFn(arg) !== false) {
+ argv._.push(
+ flags.strings['_'] || !isNumber(arg) ? arg : Number(arg)
+ );
+ }
+ if (opts.stopEarly) {
+ argv._.push.apply(argv._, args.slice(i + 1));
+ break;
+ }
}
}
@@ -140,9 +203,17 @@ module.exports = function (args, opts) {
}
});
- notFlags.forEach(function(key) {
- argv._.push(key);
- });
+ if (opts['--']) {
+ argv['--'] = new Array();
+ notFlags.forEach(function(key) {
+ argv['--'].push(key);
+ });
+ }
+ else {
+ notFlags.forEach(function(key) {
+ argv._.push(key);
+ });
+ }
return argv;
};
@@ -157,31 +228,9 @@ function hasKey (obj, keys) {
return key in o;
}
-function setKey (obj, keys, value) {
- var o = obj;
- keys.slice(0,-1).forEach(function (key) {
- if (o[key] === undefined) o[key] = {};
- o = o[key];
- });
-
- var key = keys[keys.length - 1];
- if (o[key] === undefined || typeof o[key] === 'boolean') {
- o[key] = value;
- }
- else if (Array.isArray(o[key])) {
- o[key].push(value);
- }
- else {
- o[key] = [ o[key], value ];
- }
-}
-
function isNumber (x) {
if (typeof x === 'number') return true;
if (/^0x[0-9a-f]+$/i.test(x)) return true;
return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x);
}
-function longest (xs) {
- return Math.max.apply(null, xs.map(function (x) { return x.length }));
-}
diff --git a/node_modules/minimist/package.json b/node_modules/minimist/package.json
index 903bb72..060eacd 100644
--- a/node_modules/minimist/package.json
+++ b/node_modules/minimist/package.json
@@ -2,45 +2,47 @@
"_args": [
[
{
- "raw": "minimist@0.0.8",
+ "raw": "minimist@^1.2.0",
"scope": null,
"escapedName": "minimist",
"name": "minimist",
- "rawSpec": "0.0.8",
- "spec": "0.0.8",
- "type": "version"
+ "rawSpec": "^1.2.0",
+ "spec": ">=1.2.0 <2.0.0",
+ "type": "range"
},
- "/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/mkdirp"
+ "/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/prebuild-install"
]
],
- "_from": "minimist@0.0.8",
- "_id": "minimist@0.0.8",
+ "_from": "minimist@>=1.2.0 <2.0.0",
+ "_id": "minimist@1.2.0",
"_inCache": true,
"_installable": true,
"_location": "/minimist",
+ "_nodeVersion": "2.4.0",
"_npmUser": {
"name": "substack",
- "email": "mail@substack.net"
+ "email": "substack@gmail.com"
},
- "_npmVersion": "1.4.3",
+ "_npmVersion": "3.2.2",
"_phantomChildren": {},
"_requested": {
- "raw": "minimist@0.0.8",
+ "raw": "minimist@^1.2.0",
"scope": null,
"escapedName": "minimist",
"name": "minimist",
- "rawSpec": "0.0.8",
- "spec": "0.0.8",
- "type": "version"
+ "rawSpec": "^1.2.0",
+ "spec": ">=1.2.0 <2.0.0",
+ "type": "range"
},
"_requiredBy": [
- "/mkdirp"
+ "/prebuild-install",
+ "/rc"
],
- "_resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
- "_shasum": "857fcabfc3397d2625b8228262e86aa7a011b05d",
+ "_resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
+ "_shasum": "a35008b20f41383eec1fb914f4cd5df79a264284",
"_shrinkwrap": null,
- "_spec": "minimist@0.0.8",
- "_where": "/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/mkdirp",
+ "_spec": "minimist@^1.2.0",
+ "_where": "/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/prebuild-install",
"author": {
"name": "James Halliday",
"email": "mail@substack.net",
@@ -52,14 +54,16 @@
"dependencies": {},
"description": "parse argument options",
"devDependencies": {
+ "covert": "^1.0.0",
"tap": "~0.4.0",
- "tape": "~1.0.4"
+ "tape": "^3.5.0"
},
"directories": {},
"dist": {
- "shasum": "857fcabfc3397d2625b8228262e86aa7a011b05d",
- "tarball": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz"
+ "shasum": "a35008b20f41383eec1fb914f4cd5df79a264284",
+ "tarball": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz"
},
+ "gitHead": "dc624482fcfec5bc669c68cdb861f00573ed4e64",
"homepage": "https://github.com/substack/minimist",
"keywords": [
"argv",
@@ -83,6 +87,7 @@
"url": "git://github.com/substack/minimist.git"
},
"scripts": {
+ "coverage": "covert test/*.js",
"test": "tap test/*.js"
},
"testling": {
@@ -98,5 +103,5 @@
"opera/12"
]
},
- "version": "0.0.8"
+ "version": "1.2.0"
}
diff --git a/node_modules/minimist/readme.markdown b/node_modules/minimist/readme.markdown
index c256353..30a74cf 100644
--- a/node_modules/minimist/readme.markdown
+++ b/node_modules/minimist/readme.markdown
@@ -55,10 +55,28 @@ options can be:
* `opts.string` - a string or array of strings argument names to always treat as
strings
-* `opts.boolean` - a string or array of strings to always treat as booleans
+* `opts.boolean` - a boolean, string or array of strings to always treat as
+booleans. if `true` will treat all double hyphenated arguments without equal signs
+as boolean (e.g. affects `--foo`, not `-f` or `--foo=bar`)
* `opts.alias` - an object mapping string names to strings or arrays of string
argument names to use as aliases
* `opts.default` - an object mapping string argument names to default values
+* `opts.stopEarly` - when true, populate `argv._` with everything after the
+first non-option
+* `opts['--']` - when true, populate `argv._` with everything before the `--`
+and `argv['--']` with everything after the `--`. Here's an example:
+* `opts.unknown` - a function which is invoked with a command line parameter not
+defined in the `opts` configuration object. If the function returns `false`, the
+unknown option is not added to `argv`.
+
+```
+> require('./')('one two three -- four five --six'.split(' '), { '--': true })
+{ _: [ 'one', 'two', 'three' ],
+ '--': [ 'four', 'five', '--six' ] }
+```
+
+Note that with `opts['--']` set, parsing for arguments still stops after the
+`--`.
# install
diff --git a/node_modules/prebuild-install/node_modules/minimist/test/all_bool.js b/node_modules/minimist/test/all_bool.js
similarity index 100%
rename from node_modules/prebuild-install/node_modules/minimist/test/all_bool.js
rename to node_modules/minimist/test/all_bool.js
diff --git a/node_modules/prebuild-install/node_modules/minimist/test/bool.js b/node_modules/minimist/test/bool.js
similarity index 100%
rename from node_modules/prebuild-install/node_modules/minimist/test/bool.js
rename to node_modules/minimist/test/bool.js
diff --git a/node_modules/minimist/test/dash.js b/node_modules/minimist/test/dash.js
index 8b034b9..5a4fa5b 100644
--- a/node_modules/minimist/test/dash.js
+++ b/node_modules/minimist/test/dash.js
@@ -22,3 +22,10 @@ test('-a -- b', function (t) {
t.deepEqual(parse([ '--a', '--', 'b' ]), { a: true, _: [ 'b' ] });
t.deepEqual(parse([ '--a', '--', 'b' ]), { a: true, _: [ 'b' ] });
});
+
+test('move arguments after the -- into their own `--` array', function(t) {
+ t.plan(1);
+ t.deepEqual(
+ parse([ '--name', 'John', 'before', '--', 'after' ], { '--': true }),
+ { name: 'John', _: [ 'before' ], '--': [ 'after' ] });
+});
diff --git a/node_modules/minimist/test/default_bool.js b/node_modules/minimist/test/default_bool.js
index f0041ee..780a311 100644
--- a/node_modules/minimist/test/default_bool.js
+++ b/node_modules/minimist/test/default_bool.js
@@ -18,3 +18,18 @@ test('boolean default false', function (t) {
t.equal(argv.somefalse, false);
t.end();
});
+
+test('boolean default to null', function (t) {
+ var argv = parse([], {
+ boolean: 'maybe',
+ default: { maybe: null }
+ });
+ t.equal(argv.maybe, null);
+ var argv = parse(['--maybe'], {
+ boolean: 'maybe',
+ default: { maybe: null }
+ });
+ t.equal(argv.maybe, true);
+ t.end();
+
+})
diff --git a/node_modules/minimist/test/dotted.js b/node_modules/minimist/test/dotted.js
index ef0ae34..d8b3e85 100644
--- a/node_modules/minimist/test/dotted.js
+++ b/node_modules/minimist/test/dotted.js
@@ -14,3 +14,9 @@ test('dotted default', function (t) {
t.equal(argv.aa.bb, 11);
t.end();
});
+
+test('dotted default with no alias', function (t) {
+ var argv = parse('', {default: {'a.b': 11}});
+ t.equal(argv.a.b, 11);
+ t.end();
+});
diff --git a/node_modules/prebuild-install/node_modules/minimist/test/kv_short.js b/node_modules/minimist/test/kv_short.js
similarity index 100%
rename from node_modules/prebuild-install/node_modules/minimist/test/kv_short.js
rename to node_modules/minimist/test/kv_short.js
diff --git a/node_modules/prebuild-install/node_modules/minimist/test/num.js b/node_modules/minimist/test/num.js
similarity index 100%
rename from node_modules/prebuild-install/node_modules/minimist/test/num.js
rename to node_modules/minimist/test/num.js
diff --git a/node_modules/minimist/test/parse.js b/node_modules/minimist/test/parse.js
index 8a90646..7b4a2a1 100644
--- a/node_modules/minimist/test/parse.js
+++ b/node_modules/minimist/test/parse.js
@@ -42,32 +42,6 @@ test('comprehensive', function (t) {
t.end();
});
-test('nums', function (t) {
- var argv = parse([
- '-x', '1234',
- '-y', '5.67',
- '-z', '1e7',
- '-w', '10f',
- '--hex', '0xdeadbeef',
- '789'
- ]);
- t.deepEqual(argv, {
- x : 1234,
- y : 5.67,
- z : 1e7,
- w : '10f',
- hex : 0xdeadbeef,
- _ : [ 789 ]
- });
- t.deepEqual(typeof argv.x, 'number');
- t.deepEqual(typeof argv.y, 'number');
- t.deepEqual(typeof argv.z, 'number');
- t.deepEqual(typeof argv.w, 'string');
- t.deepEqual(typeof argv.hex, 'number');
- t.deepEqual(typeof argv._[0], 'number');
- t.end();
-});
-
test('flag boolean', function (t) {
var argv = parse([ '-t', 'moo' ], { boolean: 't' });
t.deepEqual(argv, { t : true, _ : [ 'moo' ] });
@@ -92,42 +66,6 @@ test('flag boolean value', function (t) {
t.end();
});
-test('flag boolean default false', function (t) {
- var argv = parse(['moo'], {
- boolean: ['t', 'verbose'],
- default: { verbose: false, t: false }
- });
-
- t.deepEqual(argv, {
- verbose: false,
- t: false,
- _: ['moo']
- });
-
- t.deepEqual(typeof argv.verbose, 'boolean');
- t.deepEqual(typeof argv.t, 'boolean');
- t.end();
-
-});
-
-test('boolean groups', function (t) {
- var argv = parse([ '-x', '-z', 'one', 'two', 'three' ], {
- boolean: ['x','y','z']
- });
-
- t.deepEqual(argv, {
- x : true,
- y : false,
- z : true,
- _ : [ 'one', 'two', 'three' ]
- });
-
- t.deepEqual(typeof argv.x, 'boolean');
- t.deepEqual(typeof argv.y, 'boolean');
- t.deepEqual(typeof argv.z, 'boolean');
- t.end();
-});
-
test('newlines in params' , function (t) {
var args = parse([ '-s', "X\nX" ])
t.deepEqual(args, { _ : [], s : "X\nX" });
@@ -183,6 +121,29 @@ test('empty strings', function(t) {
});
+test('string and alias', function(t) {
+ var x = parse([ '--str', '000123' ], {
+ string: 's',
+ alias: { s: 'str' }
+ });
+
+ t.equal(x.str, '000123');
+ t.equal(typeof x.str, 'string');
+ t.equal(x.s, '000123');
+ t.equal(typeof x.s, 'string');
+
+ var y = parse([ '-s', '000123' ], {
+ string: 'str',
+ alias: { str: 's' }
+ });
+
+ t.equal(y.str, '000123');
+ t.equal(typeof y.str, 'string');
+ t.equal(y.s, '000123');
+ t.equal(typeof y.s, 'string');
+ t.end();
+});
+
test('slashBreak', function (t) {
t.same(
parse([ '-I/foo/bar/baz' ]),
@@ -234,85 +195,3 @@ test('nested dotted objects', function (t) {
t.same(argv.beep, { boop : true });
t.end();
});
-
-test('boolean and alias with chainable api', function (t) {
- var aliased = [ '-h', 'derp' ];
- var regular = [ '--herp', 'derp' ];
- var opts = {
- herp: { alias: 'h', boolean: true }
- };
- var aliasedArgv = parse(aliased, {
- boolean: 'herp',
- alias: { h: 'herp' }
- });
- var propertyArgv = parse(regular, {
- boolean: 'herp',
- alias: { h: 'herp' }
- });
- var expected = {
- herp: true,
- h: true,
- '_': [ 'derp' ]
- };
-
- t.same(aliasedArgv, expected);
- t.same(propertyArgv, expected);
- t.end();
-});
-
-test('boolean and alias with options hash', function (t) {
- var aliased = [ '-h', 'derp' ];
- var regular = [ '--herp', 'derp' ];
- var opts = {
- alias: { 'h': 'herp' },
- boolean: 'herp'
- };
- var aliasedArgv = parse(aliased, opts);
- var propertyArgv = parse(regular, opts);
- var expected = {
- herp: true,
- h: true,
- '_': [ 'derp' ]
- };
- t.same(aliasedArgv, expected);
- t.same(propertyArgv, expected);
- t.end();
-});
-
-test('boolean and alias using explicit true', function (t) {
- var aliased = [ '-h', 'true' ];
- var regular = [ '--herp', 'true' ];
- var opts = {
- alias: { h: 'herp' },
- boolean: 'h'
- };
- var aliasedArgv = parse(aliased, opts);
- var propertyArgv = parse(regular, opts);
- var expected = {
- herp: true,
- h: true,
- '_': [ ]
- };
-
- t.same(aliasedArgv, expected);
- t.same(propertyArgv, expected);
- t.end();
-});
-
-// regression, see https://github.com/substack/node-optimist/issues/71
-test('boolean and --x=true', function(t) {
- var parsed = parse(['--boool', '--other=true'], {
- boolean: 'boool'
- });
-
- t.same(parsed.boool, true);
- t.same(parsed.other, 'true');
-
- parsed = parse(['--boool', '--other=false'], {
- boolean: 'boool'
- });
-
- t.same(parsed.boool, true);
- t.same(parsed.other, 'false');
- t.end();
-});
diff --git a/node_modules/minimist/test/parse_modified.js b/node_modules/minimist/test/parse_modified.js
index 21851b0..ab620dc 100644
--- a/node_modules/minimist/test/parse_modified.js
+++ b/node_modules/minimist/test/parse_modified.js
@@ -5,5 +5,5 @@ test('parse with modifier functions' , function (t) {
t.plan(1);
var argv = parse([ '-b', '123' ], { boolean: 'b' });
- t.deepEqual(argv, { b: true, _: ['123'] });
+ t.deepEqual(argv, { b: true, _: [123] });
});
diff --git a/node_modules/prebuild-install/node_modules/minimist/test/stop_early.js b/node_modules/minimist/test/stop_early.js
similarity index 100%
rename from node_modules/prebuild-install/node_modules/minimist/test/stop_early.js
rename to node_modules/minimist/test/stop_early.js
diff --git a/node_modules/prebuild-install/node_modules/minimist/test/unknown.js b/node_modules/minimist/test/unknown.js
similarity index 100%
rename from node_modules/prebuild-install/node_modules/minimist/test/unknown.js
rename to node_modules/minimist/test/unknown.js
diff --git a/node_modules/tar-stream/node_modules/isarray/.travis.yml b/node_modules/mkdirp/node_modules/minimist/.travis.yml
similarity index 100%
rename from node_modules/tar-stream/node_modules/isarray/.travis.yml
rename to node_modules/mkdirp/node_modules/minimist/.travis.yml
diff --git a/node_modules/prebuild-install/node_modules/minimist/LICENSE b/node_modules/mkdirp/node_modules/minimist/LICENSE
similarity index 100%
rename from node_modules/prebuild-install/node_modules/minimist/LICENSE
rename to node_modules/mkdirp/node_modules/minimist/LICENSE
diff --git a/node_modules/prebuild-install/node_modules/minimist/example/parse.js b/node_modules/mkdirp/node_modules/minimist/example/parse.js
similarity index 100%
rename from node_modules/prebuild-install/node_modules/minimist/example/parse.js
rename to node_modules/mkdirp/node_modules/minimist/example/parse.js
diff --git a/node_modules/rc/node_modules/minimist/index.js b/node_modules/mkdirp/node_modules/minimist/index.js
similarity index 55%
rename from node_modules/rc/node_modules/minimist/index.js
rename to node_modules/mkdirp/node_modules/minimist/index.js
index 6a0559d..584f551 100644
--- a/node_modules/rc/node_modules/minimist/index.js
+++ b/node_modules/mkdirp/node_modules/minimist/index.js
@@ -1,19 +1,15 @@
module.exports = function (args, opts) {
if (!opts) opts = {};
- var flags = { bools : {}, strings : {}, unknownFn: null };
-
- if (typeof opts['unknown'] === 'function') {
- flags.unknownFn = opts['unknown'];
- }
-
- if (typeof opts['boolean'] === 'boolean' && opts['boolean']) {
- flags.allBools = true;
- } else {
- [].concat(opts['boolean']).filter(Boolean).forEach(function (key) {
- flags.bools[key] = true;
- });
- }
+ var flags = { bools : {}, strings : {} };
+
+ [].concat(opts['boolean']).filter(Boolean).forEach(function (key) {
+ flags.bools[key] = true;
+ });
+
+ [].concat(opts.string).filter(Boolean).forEach(function (key) {
+ flags.strings[key] = true;
+ });
var aliases = {};
Object.keys(opts.alias || {}).forEach(function (key) {
@@ -24,14 +20,7 @@ module.exports = function (args, opts) {
}));
});
});
-
- [].concat(opts.string).filter(Boolean).forEach(function (key) {
- flags.strings[key] = true;
- if (aliases[key]) {
- flags.strings[aliases[key]] = true;
- }
- });
-
+
var defaults = opts['default'] || {};
var argv = { _ : [] };
@@ -46,16 +35,7 @@ module.exports = function (args, opts) {
args = args.slice(0, args.indexOf('--'));
}
- function argDefined(key, arg) {
- return (flags.allBools && /^--[^=]+$/.test(arg)) ||
- flags.strings[key] || flags.bools[key] || aliases[key];
- }
-
- function setArg (key, val, arg) {
- if (arg && flags.unknownFn && !argDefined(key, arg)) {
- if (flags.unknownFn(arg) === false) return;
- }
-
+ function setArg (key, val) {
var value = !flags.strings[key] && isNumber(val)
? Number(val) : val
;
@@ -65,32 +45,7 @@ module.exports = function (args, opts) {
setKey(argv, x.split('.'), value);
});
}
-
- function setKey (obj, keys, value) {
- var o = obj;
- keys.slice(0,-1).forEach(function (key) {
- if (o[key] === undefined) o[key] = {};
- o = o[key];
- });
-
- var key = keys[keys.length - 1];
- if (o[key] === undefined || flags.bools[key] || typeof o[key] === 'boolean') {
- o[key] = value;
- }
- else if (Array.isArray(o[key])) {
- o[key].push(value);
- }
- else {
- o[key] = [ o[key], value ];
- }
- }
- function aliasIsBoolean(key) {
- return aliases[key].some(function (x) {
- return flags.bools[x];
- });
- }
-
for (var i = 0; i < args.length; i++) {
var arg = args[i];
@@ -99,33 +54,27 @@ module.exports = function (args, opts) {
// 'dotall' regex modifier. See:
// http://stackoverflow.com/a/1068308/13216
var m = arg.match(/^--([^=]+)=([\s\S]*)$/);
- var key = m[1];
- var value = m[2];
- if (flags.bools[key]) {
- value = value !== 'false';
- }
- setArg(key, value, arg);
+ setArg(m[1], m[2]);
}
else if (/^--no-.+/.test(arg)) {
var key = arg.match(/^--no-(.+)/)[1];
- setArg(key, false, arg);
+ setArg(key, false);
}
else if (/^--.+/.test(arg)) {
var key = arg.match(/^--(.+)/)[1];
var next = args[i + 1];
if (next !== undefined && !/^-/.test(next)
&& !flags.bools[key]
- && !flags.allBools
- && (aliases[key] ? !aliasIsBoolean(key) : true)) {
- setArg(key, next, arg);
+ && (aliases[key] ? !flags.bools[aliases[key]] : true)) {
+ setArg(key, next);
i++;
}
else if (/^(true|false)$/.test(next)) {
- setArg(key, next === 'true', arg);
+ setArg(key, next === 'true');
i++;
}
else {
- setArg(key, flags.strings[key] ? '' : true, arg);
+ setArg(key, flags.strings[key] ? '' : true);
}
}
else if (/^-[^-]+/.test(arg)) {
@@ -136,30 +85,24 @@ module.exports = function (args, opts) {
var next = arg.slice(j+2);
if (next === '-') {
- setArg(letters[j], next, arg)
+ setArg(letters[j], next)
continue;
}
- if (/[A-Za-z]/.test(letters[j]) && /=/.test(next)) {
- setArg(letters[j], next.split('=')[1], arg);
- broken = true;
- break;
- }
-
if (/[A-Za-z]/.test(letters[j])
&& /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) {
- setArg(letters[j], next, arg);
+ setArg(letters[j], next);
broken = true;
break;
}
if (letters[j+1] && letters[j+1].match(/\W/)) {
- setArg(letters[j], arg.slice(j+2), arg);
+ setArg(letters[j], arg.slice(j+2));
broken = true;
break;
}
else {
- setArg(letters[j], flags.strings[letters[j]] ? '' : true, arg);
+ setArg(letters[j], flags.strings[letters[j]] ? '' : true);
}
}
@@ -167,29 +110,23 @@ module.exports = function (args, opts) {
if (!broken && key !== '-') {
if (args[i+1] && !/^(-|--)[^-]/.test(args[i+1])
&& !flags.bools[key]
- && (aliases[key] ? !aliasIsBoolean(key) : true)) {
- setArg(key, args[i+1], arg);
+ && (aliases[key] ? !flags.bools[aliases[key]] : true)) {
+ setArg(key, args[i+1]);
i++;
}
else if (args[i+1] && /true|false/.test(args[i+1])) {
- setArg(key, args[i+1] === 'true', arg);
+ setArg(key, args[i+1] === 'true');
i++;
}
else {
- setArg(key, flags.strings[key] ? '' : true, arg);
+ setArg(key, flags.strings[key] ? '' : true);
}
}
}
else {
- if (!flags.unknownFn || flags.unknownFn(arg) !== false) {
- argv._.push(
- flags.strings['_'] || !isNumber(arg) ? arg : Number(arg)
- );
- }
- if (opts.stopEarly) {
- argv._.push.apply(argv._, args.slice(i + 1));
- break;
- }
+ argv._.push(
+ flags.strings['_'] || !isNumber(arg) ? arg : Number(arg)
+ );
}
}
@@ -203,17 +140,9 @@ module.exports = function (args, opts) {
}
});
- if (opts['--']) {
- argv['--'] = new Array();
- notFlags.forEach(function(key) {
- argv['--'].push(key);
- });
- }
- else {
- notFlags.forEach(function(key) {
- argv._.push(key);
- });
- }
+ notFlags.forEach(function(key) {
+ argv._.push(key);
+ });
return argv;
};
@@ -228,9 +157,31 @@ function hasKey (obj, keys) {
return key in o;
}
+function setKey (obj, keys, value) {
+ var o = obj;
+ keys.slice(0,-1).forEach(function (key) {
+ if (o[key] === undefined) o[key] = {};
+ o = o[key];
+ });
+
+ var key = keys[keys.length - 1];
+ if (o[key] === undefined || typeof o[key] === 'boolean') {
+ o[key] = value;
+ }
+ else if (Array.isArray(o[key])) {
+ o[key].push(value);
+ }
+ else {
+ o[key] = [ o[key], value ];
+ }
+}
+
function isNumber (x) {
if (typeof x === 'number') return true;
if (/^0x[0-9a-f]+$/i.test(x)) return true;
return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x);
}
+function longest (xs) {
+ return Math.max.apply(null, xs.map(function (x) { return x.length }));
+}
diff --git a/node_modules/prebuild-install/node_modules/minimist/package.json b/node_modules/mkdirp/node_modules/minimist/package.json
similarity index 61%
rename from node_modules/prebuild-install/node_modules/minimist/package.json
rename to node_modules/mkdirp/node_modules/minimist/package.json
index f9d88d8..753ee85 100644
--- a/node_modules/prebuild-install/node_modules/minimist/package.json
+++ b/node_modules/mkdirp/node_modules/minimist/package.json
@@ -2,46 +2,45 @@
"_args": [
[
{
- "raw": "minimist@^1.2.0",
+ "raw": "minimist@0.0.8",
"scope": null,
"escapedName": "minimist",
"name": "minimist",
- "rawSpec": "^1.2.0",
- "spec": ">=1.2.0 <2.0.0",
- "type": "range"
+ "rawSpec": "0.0.8",
+ "spec": "0.0.8",
+ "type": "version"
},
- "/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/prebuild-install"
+ "/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/mkdirp"
]
],
- "_from": "minimist@>=1.2.0 <2.0.0",
- "_id": "minimist@1.2.0",
+ "_from": "minimist@0.0.8",
+ "_id": "minimist@0.0.8",
"_inCache": true,
"_installable": true,
- "_location": "/prebuild-install/minimist",
- "_nodeVersion": "2.4.0",
+ "_location": "/mkdirp/minimist",
"_npmUser": {
"name": "substack",
- "email": "substack@gmail.com"
+ "email": "mail@substack.net"
},
- "_npmVersion": "3.2.2",
+ "_npmVersion": "1.4.3",
"_phantomChildren": {},
"_requested": {
- "raw": "minimist@^1.2.0",
+ "raw": "minimist@0.0.8",
"scope": null,
"escapedName": "minimist",
"name": "minimist",
- "rawSpec": "^1.2.0",
- "spec": ">=1.2.0 <2.0.0",
- "type": "range"
+ "rawSpec": "0.0.8",
+ "spec": "0.0.8",
+ "type": "version"
},
"_requiredBy": [
- "/prebuild-install"
+ "/mkdirp"
],
- "_resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
- "_shasum": "a35008b20f41383eec1fb914f4cd5df79a264284",
+ "_resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
+ "_shasum": "857fcabfc3397d2625b8228262e86aa7a011b05d",
"_shrinkwrap": null,
- "_spec": "minimist@^1.2.0",
- "_where": "/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/prebuild-install",
+ "_spec": "minimist@0.0.8",
+ "_where": "/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/mkdirp",
"author": {
"name": "James Halliday",
"email": "mail@substack.net",
@@ -53,16 +52,14 @@
"dependencies": {},
"description": "parse argument options",
"devDependencies": {
- "covert": "^1.0.0",
"tap": "~0.4.0",
- "tape": "^3.5.0"
+ "tape": "~1.0.4"
},
"directories": {},
"dist": {
- "shasum": "a35008b20f41383eec1fb914f4cd5df79a264284",
- "tarball": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz"
+ "shasum": "857fcabfc3397d2625b8228262e86aa7a011b05d",
+ "tarball": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz"
},
- "gitHead": "dc624482fcfec5bc669c68cdb861f00573ed4e64",
"homepage": "https://github.com/substack/minimist",
"keywords": [
"argv",
@@ -86,7 +83,6 @@
"url": "git://github.com/substack/minimist.git"
},
"scripts": {
- "coverage": "covert test/*.js",
"test": "tap test/*.js"
},
"testling": {
@@ -102,5 +98,5 @@
"opera/12"
]
},
- "version": "1.2.0"
+ "version": "0.0.8"
}
diff --git a/node_modules/prebuild-install/node_modules/minimist/readme.markdown b/node_modules/mkdirp/node_modules/minimist/readme.markdown
similarity index 63%
rename from node_modules/prebuild-install/node_modules/minimist/readme.markdown
rename to node_modules/mkdirp/node_modules/minimist/readme.markdown
index 30a74cf..c256353 100644
--- a/node_modules/prebuild-install/node_modules/minimist/readme.markdown
+++ b/node_modules/mkdirp/node_modules/minimist/readme.markdown
@@ -55,28 +55,10 @@ options can be:
* `opts.string` - a string or array of strings argument names to always treat as
strings
-* `opts.boolean` - a boolean, string or array of strings to always treat as
-booleans. if `true` will treat all double hyphenated arguments without equal signs
-as boolean (e.g. affects `--foo`, not `-f` or `--foo=bar`)
+* `opts.boolean` - a string or array of strings to always treat as booleans
* `opts.alias` - an object mapping string names to strings or arrays of string
argument names to use as aliases
* `opts.default` - an object mapping string argument names to default values
-* `opts.stopEarly` - when true, populate `argv._` with everything after the
-first non-option
-* `opts['--']` - when true, populate `argv._` with everything before the `--`
-and `argv['--']` with everything after the `--`. Here's an example:
-* `opts.unknown` - a function which is invoked with a command line parameter not
-defined in the `opts` configuration object. If the function returns `false`, the
-unknown option is not added to `argv`.
-
-```
-> require('./')('one two three -- four five --six'.split(' '), { '--': true })
-{ _: [ 'one', 'two', 'three' ],
- '--': [ 'four', 'five', '--six' ] }
-```
-
-Note that with `opts['--']` set, parsing for arguments still stops after the
-`--`.
# install
diff --git a/node_modules/prebuild-install/node_modules/minimist/test/dash.js b/node_modules/mkdirp/node_modules/minimist/test/dash.js
similarity index 74%
rename from node_modules/prebuild-install/node_modules/minimist/test/dash.js
rename to node_modules/mkdirp/node_modules/minimist/test/dash.js
index 5a4fa5b..8b034b9 100644
--- a/node_modules/prebuild-install/node_modules/minimist/test/dash.js
+++ b/node_modules/mkdirp/node_modules/minimist/test/dash.js
@@ -22,10 +22,3 @@ test('-a -- b', function (t) {
t.deepEqual(parse([ '--a', '--', 'b' ]), { a: true, _: [ 'b' ] });
t.deepEqual(parse([ '--a', '--', 'b' ]), { a: true, _: [ 'b' ] });
});
-
-test('move arguments after the -- into their own `--` array', function(t) {
- t.plan(1);
- t.deepEqual(
- parse([ '--name', 'John', 'before', '--', 'after' ], { '--': true }),
- { name: 'John', _: [ 'before' ], '--': [ 'after' ] });
-});
diff --git a/node_modules/rc/node_modules/minimist/test/default_bool.js b/node_modules/mkdirp/node_modules/minimist/test/default_bool.js
similarity index 58%
rename from node_modules/rc/node_modules/minimist/test/default_bool.js
rename to node_modules/mkdirp/node_modules/minimist/test/default_bool.js
index 780a311..f0041ee 100644
--- a/node_modules/rc/node_modules/minimist/test/default_bool.js
+++ b/node_modules/mkdirp/node_modules/minimist/test/default_bool.js
@@ -18,18 +18,3 @@ test('boolean default false', function (t) {
t.equal(argv.somefalse, false);
t.end();
});
-
-test('boolean default to null', function (t) {
- var argv = parse([], {
- boolean: 'maybe',
- default: { maybe: null }
- });
- t.equal(argv.maybe, null);
- var argv = parse(['--maybe'], {
- boolean: 'maybe',
- default: { maybe: null }
- });
- t.equal(argv.maybe, true);
- t.end();
-
-})
diff --git a/node_modules/rc/node_modules/minimist/test/dotted.js b/node_modules/mkdirp/node_modules/minimist/test/dotted.js
similarity index 75%
rename from node_modules/rc/node_modules/minimist/test/dotted.js
rename to node_modules/mkdirp/node_modules/minimist/test/dotted.js
index d8b3e85..ef0ae34 100644
--- a/node_modules/rc/node_modules/minimist/test/dotted.js
+++ b/node_modules/mkdirp/node_modules/minimist/test/dotted.js
@@ -14,9 +14,3 @@ test('dotted default', function (t) {
t.equal(argv.aa.bb, 11);
t.end();
});
-
-test('dotted default with no alias', function (t) {
- var argv = parse('', {default: {'a.b': 11}});
- t.equal(argv.a.b, 11);
- t.end();
-});
diff --git a/node_modules/prebuild-install/node_modules/minimist/test/long.js b/node_modules/mkdirp/node_modules/minimist/test/long.js
similarity index 100%
rename from node_modules/prebuild-install/node_modules/minimist/test/long.js
rename to node_modules/mkdirp/node_modules/minimist/test/long.js
diff --git a/node_modules/rc/node_modules/minimist/test/parse.js b/node_modules/mkdirp/node_modules/minimist/test/parse.js
similarity index 54%
rename from node_modules/rc/node_modules/minimist/test/parse.js
rename to node_modules/mkdirp/node_modules/minimist/test/parse.js
index 7b4a2a1..8a90646 100644
--- a/node_modules/rc/node_modules/minimist/test/parse.js
+++ b/node_modules/mkdirp/node_modules/minimist/test/parse.js
@@ -42,6 +42,32 @@ test('comprehensive', function (t) {
t.end();
});
+test('nums', function (t) {
+ var argv = parse([
+ '-x', '1234',
+ '-y', '5.67',
+ '-z', '1e7',
+ '-w', '10f',
+ '--hex', '0xdeadbeef',
+ '789'
+ ]);
+ t.deepEqual(argv, {
+ x : 1234,
+ y : 5.67,
+ z : 1e7,
+ w : '10f',
+ hex : 0xdeadbeef,
+ _ : [ 789 ]
+ });
+ t.deepEqual(typeof argv.x, 'number');
+ t.deepEqual(typeof argv.y, 'number');
+ t.deepEqual(typeof argv.z, 'number');
+ t.deepEqual(typeof argv.w, 'string');
+ t.deepEqual(typeof argv.hex, 'number');
+ t.deepEqual(typeof argv._[0], 'number');
+ t.end();
+});
+
test('flag boolean', function (t) {
var argv = parse([ '-t', 'moo' ], { boolean: 't' });
t.deepEqual(argv, { t : true, _ : [ 'moo' ] });
@@ -66,6 +92,42 @@ test('flag boolean value', function (t) {
t.end();
});
+test('flag boolean default false', function (t) {
+ var argv = parse(['moo'], {
+ boolean: ['t', 'verbose'],
+ default: { verbose: false, t: false }
+ });
+
+ t.deepEqual(argv, {
+ verbose: false,
+ t: false,
+ _: ['moo']
+ });
+
+ t.deepEqual(typeof argv.verbose, 'boolean');
+ t.deepEqual(typeof argv.t, 'boolean');
+ t.end();
+
+});
+
+test('boolean groups', function (t) {
+ var argv = parse([ '-x', '-z', 'one', 'two', 'three' ], {
+ boolean: ['x','y','z']
+ });
+
+ t.deepEqual(argv, {
+ x : true,
+ y : false,
+ z : true,
+ _ : [ 'one', 'two', 'three' ]
+ });
+
+ t.deepEqual(typeof argv.x, 'boolean');
+ t.deepEqual(typeof argv.y, 'boolean');
+ t.deepEqual(typeof argv.z, 'boolean');
+ t.end();
+});
+
test('newlines in params' , function (t) {
var args = parse([ '-s', "X\nX" ])
t.deepEqual(args, { _ : [], s : "X\nX" });
@@ -121,29 +183,6 @@ test('empty strings', function(t) {
});
-test('string and alias', function(t) {
- var x = parse([ '--str', '000123' ], {
- string: 's',
- alias: { s: 'str' }
- });
-
- t.equal(x.str, '000123');
- t.equal(typeof x.str, 'string');
- t.equal(x.s, '000123');
- t.equal(typeof x.s, 'string');
-
- var y = parse([ '-s', '000123' ], {
- string: 'str',
- alias: { str: 's' }
- });
-
- t.equal(y.str, '000123');
- t.equal(typeof y.str, 'string');
- t.equal(y.s, '000123');
- t.equal(typeof y.s, 'string');
- t.end();
-});
-
test('slashBreak', function (t) {
t.same(
parse([ '-I/foo/bar/baz' ]),
@@ -195,3 +234,85 @@ test('nested dotted objects', function (t) {
t.same(argv.beep, { boop : true });
t.end();
});
+
+test('boolean and alias with chainable api', function (t) {
+ var aliased = [ '-h', 'derp' ];
+ var regular = [ '--herp', 'derp' ];
+ var opts = {
+ herp: { alias: 'h', boolean: true }
+ };
+ var aliasedArgv = parse(aliased, {
+ boolean: 'herp',
+ alias: { h: 'herp' }
+ });
+ var propertyArgv = parse(regular, {
+ boolean: 'herp',
+ alias: { h: 'herp' }
+ });
+ var expected = {
+ herp: true,
+ h: true,
+ '_': [ 'derp' ]
+ };
+
+ t.same(aliasedArgv, expected);
+ t.same(propertyArgv, expected);
+ t.end();
+});
+
+test('boolean and alias with options hash', function (t) {
+ var aliased = [ '-h', 'derp' ];
+ var regular = [ '--herp', 'derp' ];
+ var opts = {
+ alias: { 'h': 'herp' },
+ boolean: 'herp'
+ };
+ var aliasedArgv = parse(aliased, opts);
+ var propertyArgv = parse(regular, opts);
+ var expected = {
+ herp: true,
+ h: true,
+ '_': [ 'derp' ]
+ };
+ t.same(aliasedArgv, expected);
+ t.same(propertyArgv, expected);
+ t.end();
+});
+
+test('boolean and alias using explicit true', function (t) {
+ var aliased = [ '-h', 'true' ];
+ var regular = [ '--herp', 'true' ];
+ var opts = {
+ alias: { h: 'herp' },
+ boolean: 'h'
+ };
+ var aliasedArgv = parse(aliased, opts);
+ var propertyArgv = parse(regular, opts);
+ var expected = {
+ herp: true,
+ h: true,
+ '_': [ ]
+ };
+
+ t.same(aliasedArgv, expected);
+ t.same(propertyArgv, expected);
+ t.end();
+});
+
+// regression, see https://github.com/substack/node-optimist/issues/71
+test('boolean and --x=true', function(t) {
+ var parsed = parse(['--boool', '--other=true'], {
+ boolean: 'boool'
+ });
+
+ t.same(parsed.boool, true);
+ t.same(parsed.other, 'true');
+
+ parsed = parse(['--boool', '--other=false'], {
+ boolean: 'boool'
+ });
+
+ t.same(parsed.boool, true);
+ t.same(parsed.other, 'false');
+ t.end();
+});
diff --git a/node_modules/prebuild-install/node_modules/minimist/test/parse_modified.js b/node_modules/mkdirp/node_modules/minimist/test/parse_modified.js
similarity index 80%
rename from node_modules/prebuild-install/node_modules/minimist/test/parse_modified.js
rename to node_modules/mkdirp/node_modules/minimist/test/parse_modified.js
index ab620dc..21851b0 100644
--- a/node_modules/prebuild-install/node_modules/minimist/test/parse_modified.js
+++ b/node_modules/mkdirp/node_modules/minimist/test/parse_modified.js
@@ -5,5 +5,5 @@ test('parse with modifier functions' , function (t) {
t.plan(1);
var argv = parse([ '-b', '123' ], { boolean: 'b' });
- t.deepEqual(argv, { b: true, _: [123] });
+ t.deepEqual(argv, { b: true, _: ['123'] });
});
diff --git a/node_modules/prebuild-install/node_modules/minimist/test/short.js b/node_modules/mkdirp/node_modules/minimist/test/short.js
similarity index 100%
rename from node_modules/prebuild-install/node_modules/minimist/test/short.js
rename to node_modules/mkdirp/node_modules/minimist/test/short.js
diff --git a/node_modules/prebuild-install/node_modules/minimist/test/whitespace.js b/node_modules/mkdirp/node_modules/minimist/test/whitespace.js
similarity index 100%
rename from node_modules/prebuild-install/node_modules/minimist/test/whitespace.js
rename to node_modules/mkdirp/node_modules/minimist/test/whitespace.js
diff --git a/node_modules/mkdirp/package.json b/node_modules/mkdirp/package.json
index 9c1a2eb..d581093 100644
--- a/node_modules/mkdirp/package.json
+++ b/node_modules/mkdirp/package.json
@@ -10,7 +10,7 @@
"spec": ">=0.5.1 <0.6.0",
"type": "range"
},
- "/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/streamroller"
+ "/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/tar-fs"
]
],
"_from": "mkdirp@>=0.5.1 <0.6.0",
@@ -35,13 +35,14 @@
"type": "range"
},
"_requiredBy": [
- "/streamroller"
+ "/streamroller",
+ "/tar-fs"
],
"_resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
"_shasum": "30057438eac6cf7f8c4767f38648d6697d75c903",
"_shrinkwrap": null,
"_spec": "mkdirp@^0.5.1",
- "_where": "/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/streamroller",
+ "_where": "/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/tar-fs",
"author": {
"name": "James Halliday",
"email": "mail@substack.net",
diff --git a/node_modules/prebuild-install/node_modules/minimist/.travis.yml b/node_modules/prebuild-install/node_modules/minimist/.travis.yml
deleted file mode 100644
index 74c57bf..0000000
--- a/node_modules/prebuild-install/node_modules/minimist/.travis.yml
+++ /dev/null
@@ -1,8 +0,0 @@
-language: node_js
-node_js:
- - "0.8"
- - "0.10"
- - "0.12"
- - "iojs"
-before_install:
- - npm install -g npm@~1.4.6
diff --git a/node_modules/prebuild-install/node_modules/minimist/index.js b/node_modules/prebuild-install/node_modules/minimist/index.js
deleted file mode 100644
index 6a0559d..0000000
--- a/node_modules/prebuild-install/node_modules/minimist/index.js
+++ /dev/null
@@ -1,236 +0,0 @@
-module.exports = function (args, opts) {
- if (!opts) opts = {};
-
- var flags = { bools : {}, strings : {}, unknownFn: null };
-
- if (typeof opts['unknown'] === 'function') {
- flags.unknownFn = opts['unknown'];
- }
-
- if (typeof opts['boolean'] === 'boolean' && opts['boolean']) {
- flags.allBools = true;
- } else {
- [].concat(opts['boolean']).filter(Boolean).forEach(function (key) {
- flags.bools[key] = true;
- });
- }
-
- var aliases = {};
- Object.keys(opts.alias || {}).forEach(function (key) {
- aliases[key] = [].concat(opts.alias[key]);
- aliases[key].forEach(function (x) {
- aliases[x] = [key].concat(aliases[key].filter(function (y) {
- return x !== y;
- }));
- });
- });
-
- [].concat(opts.string).filter(Boolean).forEach(function (key) {
- flags.strings[key] = true;
- if (aliases[key]) {
- flags.strings[aliases[key]] = true;
- }
- });
-
- var defaults = opts['default'] || {};
-
- var argv = { _ : [] };
- Object.keys(flags.bools).forEach(function (key) {
- setArg(key, defaults[key] === undefined ? false : defaults[key]);
- });
-
- var notFlags = [];
-
- if (args.indexOf('--') !== -1) {
- notFlags = args.slice(args.indexOf('--')+1);
- args = args.slice(0, args.indexOf('--'));
- }
-
- function argDefined(key, arg) {
- return (flags.allBools && /^--[^=]+$/.test(arg)) ||
- flags.strings[key] || flags.bools[key] || aliases[key];
- }
-
- function setArg (key, val, arg) {
- if (arg && flags.unknownFn && !argDefined(key, arg)) {
- if (flags.unknownFn(arg) === false) return;
- }
-
- var value = !flags.strings[key] && isNumber(val)
- ? Number(val) : val
- ;
- setKey(argv, key.split('.'), value);
-
- (aliases[key] || []).forEach(function (x) {
- setKey(argv, x.split('.'), value);
- });
- }
-
- function setKey (obj, keys, value) {
- var o = obj;
- keys.slice(0,-1).forEach(function (key) {
- if (o[key] === undefined) o[key] = {};
- o = o[key];
- });
-
- var key = keys[keys.length - 1];
- if (o[key] === undefined || flags.bools[key] || typeof o[key] === 'boolean') {
- o[key] = value;
- }
- else if (Array.isArray(o[key])) {
- o[key].push(value);
- }
- else {
- o[key] = [ o[key], value ];
- }
- }
-
- function aliasIsBoolean(key) {
- return aliases[key].some(function (x) {
- return flags.bools[x];
- });
- }
-
- for (var i = 0; i < args.length; i++) {
- var arg = args[i];
-
- if (/^--.+=/.test(arg)) {
- // Using [\s\S] instead of . because js doesn't support the
- // 'dotall' regex modifier. See:
- // http://stackoverflow.com/a/1068308/13216
- var m = arg.match(/^--([^=]+)=([\s\S]*)$/);
- var key = m[1];
- var value = m[2];
- if (flags.bools[key]) {
- value = value !== 'false';
- }
- setArg(key, value, arg);
- }
- else if (/^--no-.+/.test(arg)) {
- var key = arg.match(/^--no-(.+)/)[1];
- setArg(key, false, arg);
- }
- else if (/^--.+/.test(arg)) {
- var key = arg.match(/^--(.+)/)[1];
- var next = args[i + 1];
- if (next !== undefined && !/^-/.test(next)
- && !flags.bools[key]
- && !flags.allBools
- && (aliases[key] ? !aliasIsBoolean(key) : true)) {
- setArg(key, next, arg);
- i++;
- }
- else if (/^(true|false)$/.test(next)) {
- setArg(key, next === 'true', arg);
- i++;
- }
- else {
- setArg(key, flags.strings[key] ? '' : true, arg);
- }
- }
- else if (/^-[^-]+/.test(arg)) {
- var letters = arg.slice(1,-1).split('');
-
- var broken = false;
- for (var j = 0; j < letters.length; j++) {
- var next = arg.slice(j+2);
-
- if (next === '-') {
- setArg(letters[j], next, arg)
- continue;
- }
-
- if (/[A-Za-z]/.test(letters[j]) && /=/.test(next)) {
- setArg(letters[j], next.split('=')[1], arg);
- broken = true;
- break;
- }
-
- if (/[A-Za-z]/.test(letters[j])
- && /-?\d+(\.\d*)?(e-?\d+)?$/.test(next)) {
- setArg(letters[j], next, arg);
- broken = true;
- break;
- }
-
- if (letters[j+1] && letters[j+1].match(/\W/)) {
- setArg(letters[j], arg.slice(j+2), arg);
- broken = true;
- break;
- }
- else {
- setArg(letters[j], flags.strings[letters[j]] ? '' : true, arg);
- }
- }
-
- var key = arg.slice(-1)[0];
- if (!broken && key !== '-') {
- if (args[i+1] && !/^(-|--)[^-]/.test(args[i+1])
- && !flags.bools[key]
- && (aliases[key] ? !aliasIsBoolean(key) : true)) {
- setArg(key, args[i+1], arg);
- i++;
- }
- else if (args[i+1] && /true|false/.test(args[i+1])) {
- setArg(key, args[i+1] === 'true', arg);
- i++;
- }
- else {
- setArg(key, flags.strings[key] ? '' : true, arg);
- }
- }
- }
- else {
- if (!flags.unknownFn || flags.unknownFn(arg) !== false) {
- argv._.push(
- flags.strings['_'] || !isNumber(arg) ? arg : Number(arg)
- );
- }
- if (opts.stopEarly) {
- argv._.push.apply(argv._, args.slice(i + 1));
- break;
- }
- }
- }
-
- Object.keys(defaults).forEach(function (key) {
- if (!hasKey(argv, key.split('.'))) {
- setKey(argv, key.split('.'), defaults[key]);
-
- (aliases[key] || []).forEach(function (x) {
- setKey(argv, x.split('.'), defaults[key]);
- });
- }
- });
-
- if (opts['--']) {
- argv['--'] = new Array();
- notFlags.forEach(function(key) {
- argv['--'].push(key);
- });
- }
- else {
- notFlags.forEach(function(key) {
- argv._.push(key);
- });
- }
-
- return argv;
-};
-
-function hasKey (obj, keys) {
- var o = obj;
- keys.slice(0,-1).forEach(function (key) {
- o = (o[key] || {});
- });
-
- var key = keys[keys.length - 1];
- return key in o;
-}
-
-function isNumber (x) {
- if (typeof x === 'number') return true;
- if (/^0x[0-9a-f]+$/i.test(x)) return true;
- return /^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x);
-}
-
diff --git a/node_modules/prebuild-install/node_modules/minimist/test/default_bool.js b/node_modules/prebuild-install/node_modules/minimist/test/default_bool.js
deleted file mode 100644
index 780a311..0000000
--- a/node_modules/prebuild-install/node_modules/minimist/test/default_bool.js
+++ /dev/null
@@ -1,35 +0,0 @@
-var test = require('tape');
-var parse = require('../');
-
-test('boolean default true', function (t) {
- var argv = parse([], {
- boolean: 'sometrue',
- default: { sometrue: true }
- });
- t.equal(argv.sometrue, true);
- t.end();
-});
-
-test('boolean default false', function (t) {
- var argv = parse([], {
- boolean: 'somefalse',
- default: { somefalse: false }
- });
- t.equal(argv.somefalse, false);
- t.end();
-});
-
-test('boolean default to null', function (t) {
- var argv = parse([], {
- boolean: 'maybe',
- default: { maybe: null }
- });
- t.equal(argv.maybe, null);
- var argv = parse(['--maybe'], {
- boolean: 'maybe',
- default: { maybe: null }
- });
- t.equal(argv.maybe, true);
- t.end();
-
-})
diff --git a/node_modules/prebuild-install/node_modules/minimist/test/dotted.js b/node_modules/prebuild-install/node_modules/minimist/test/dotted.js
deleted file mode 100644
index d8b3e85..0000000
--- a/node_modules/prebuild-install/node_modules/minimist/test/dotted.js
+++ /dev/null
@@ -1,22 +0,0 @@
-var parse = require('../');
-var test = require('tape');
-
-test('dotted alias', function (t) {
- var argv = parse(['--a.b', '22'], {default: {'a.b': 11}, alias: {'a.b': 'aa.bb'}});
- t.equal(argv.a.b, 22);
- t.equal(argv.aa.bb, 22);
- t.end();
-});
-
-test('dotted default', function (t) {
- var argv = parse('', {default: {'a.b': 11}, alias: {'a.b': 'aa.bb'}});
- t.equal(argv.a.b, 11);
- t.equal(argv.aa.bb, 11);
- t.end();
-});
-
-test('dotted default with no alias', function (t) {
- var argv = parse('', {default: {'a.b': 11}});
- t.equal(argv.a.b, 11);
- t.end();
-});
diff --git a/node_modules/prebuild-install/node_modules/minimist/test/parse.js b/node_modules/prebuild-install/node_modules/minimist/test/parse.js
deleted file mode 100644
index 7b4a2a1..0000000
--- a/node_modules/prebuild-install/node_modules/minimist/test/parse.js
+++ /dev/null
@@ -1,197 +0,0 @@
-var parse = require('../');
-var test = require('tape');
-
-test('parse args', function (t) {
- t.deepEqual(
- parse([ '--no-moo' ]),
- { moo : false, _ : [] },
- 'no'
- );
- t.deepEqual(
- parse([ '-v', 'a', '-v', 'b', '-v', 'c' ]),
- { v : ['a','b','c'], _ : [] },
- 'multi'
- );
- t.end();
-});
-
-test('comprehensive', function (t) {
- t.deepEqual(
- parse([
- '--name=meowmers', 'bare', '-cats', 'woo',
- '-h', 'awesome', '--multi=quux',
- '--key', 'value',
- '-b', '--bool', '--no-meep', '--multi=baz',
- '--', '--not-a-flag', 'eek'
- ]),
- {
- c : true,
- a : true,
- t : true,
- s : 'woo',
- h : 'awesome',
- b : true,
- bool : true,
- key : 'value',
- multi : [ 'quux', 'baz' ],
- meep : false,
- name : 'meowmers',
- _ : [ 'bare', '--not-a-flag', 'eek' ]
- }
- );
- t.end();
-});
-
-test('flag boolean', function (t) {
- var argv = parse([ '-t', 'moo' ], { boolean: 't' });
- t.deepEqual(argv, { t : true, _ : [ 'moo' ] });
- t.deepEqual(typeof argv.t, 'boolean');
- t.end();
-});
-
-test('flag boolean value', function (t) {
- var argv = parse(['--verbose', 'false', 'moo', '-t', 'true'], {
- boolean: [ 't', 'verbose' ],
- default: { verbose: true }
- });
-
- t.deepEqual(argv, {
- verbose: false,
- t: true,
- _: ['moo']
- });
-
- t.deepEqual(typeof argv.verbose, 'boolean');
- t.deepEqual(typeof argv.t, 'boolean');
- t.end();
-});
-
-test('newlines in params' , function (t) {
- var args = parse([ '-s', "X\nX" ])
- t.deepEqual(args, { _ : [], s : "X\nX" });
-
- // reproduce in bash:
- // VALUE="new
- // line"
- // node program.js --s="$VALUE"
- args = parse([ "--s=X\nX" ])
- t.deepEqual(args, { _ : [], s : "X\nX" });
- t.end();
-});
-
-test('strings' , function (t) {
- var s = parse([ '-s', '0001234' ], { string: 's' }).s;
- t.equal(s, '0001234');
- t.equal(typeof s, 'string');
-
- var x = parse([ '-x', '56' ], { string: 'x' }).x;
- t.equal(x, '56');
- t.equal(typeof x, 'string');
- t.end();
-});
-
-test('stringArgs', function (t) {
- var s = parse([ ' ', ' ' ], { string: '_' })._;
- t.same(s.length, 2);
- t.same(typeof s[0], 'string');
- t.same(s[0], ' ');
- t.same(typeof s[1], 'string');
- t.same(s[1], ' ');
- t.end();
-});
-
-test('empty strings', function(t) {
- var s = parse([ '-s' ], { string: 's' }).s;
- t.equal(s, '');
- t.equal(typeof s, 'string');
-
- var str = parse([ '--str' ], { string: 'str' }).str;
- t.equal(str, '');
- t.equal(typeof str, 'string');
-
- var letters = parse([ '-art' ], {
- string: [ 'a', 't' ]
- });
-
- t.equal(letters.a, '');
- t.equal(letters.r, true);
- t.equal(letters.t, '');
-
- t.end();
-});
-
-
-test('string and alias', function(t) {
- var x = parse([ '--str', '000123' ], {
- string: 's',
- alias: { s: 'str' }
- });
-
- t.equal(x.str, '000123');
- t.equal(typeof x.str, 'string');
- t.equal(x.s, '000123');
- t.equal(typeof x.s, 'string');
-
- var y = parse([ '-s', '000123' ], {
- string: 'str',
- alias: { str: 's' }
- });
-
- t.equal(y.str, '000123');
- t.equal(typeof y.str, 'string');
- t.equal(y.s, '000123');
- t.equal(typeof y.s, 'string');
- t.end();
-});
-
-test('slashBreak', function (t) {
- t.same(
- parse([ '-I/foo/bar/baz' ]),
- { I : '/foo/bar/baz', _ : [] }
- );
- t.same(
- parse([ '-xyz/foo/bar/baz' ]),
- { x : true, y : true, z : '/foo/bar/baz', _ : [] }
- );
- t.end();
-});
-
-test('alias', function (t) {
- var argv = parse([ '-f', '11', '--zoom', '55' ], {
- alias: { z: 'zoom' }
- });
- t.equal(argv.zoom, 55);
- t.equal(argv.z, argv.zoom);
- t.equal(argv.f, 11);
- t.end();
-});
-
-test('multiAlias', function (t) {
- var argv = parse([ '-f', '11', '--zoom', '55' ], {
- alias: { z: [ 'zm', 'zoom' ] }
- });
- t.equal(argv.zoom, 55);
- t.equal(argv.z, argv.zoom);
- t.equal(argv.z, argv.zm);
- t.equal(argv.f, 11);
- t.end();
-});
-
-test('nested dotted objects', function (t) {
- var argv = parse([
- '--foo.bar', '3', '--foo.baz', '4',
- '--foo.quux.quibble', '5', '--foo.quux.o_O',
- '--beep.boop'
- ]);
-
- t.same(argv.foo, {
- bar : 3,
- baz : 4,
- quux : {
- quibble : 5,
- o_O : true
- }
- });
- t.same(argv.beep, { boop : true });
- t.end();
-});
diff --git a/node_modules/process-nextick-args/package.json b/node_modules/process-nextick-args/package.json
index 607b8a6..e6d129c 100644
--- a/node_modules/process-nextick-args/package.json
+++ b/node_modules/process-nextick-args/package.json
@@ -10,7 +10,7 @@
"spec": ">=1.0.6 <1.1.0",
"type": "range"
},
- "/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/bl/node_modules/readable-stream"
+ "/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/readable-stream"
]
],
"_from": "process-nextick-args@>=1.0.6 <1.1.0",
@@ -39,14 +39,13 @@
"type": "range"
},
"_requiredBy": [
- "/bl/readable-stream",
- "/tar-stream/readable-stream"
+ "/readable-stream"
],
"_resolved": "http://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz",
"_shasum": "150e20b756590ad3f91093f25a4f2ad8bff30ba3",
"_shrinkwrap": null,
"_spec": "process-nextick-args@~1.0.6",
- "_where": "/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/bl/node_modules/readable-stream",
+ "_where": "/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/readable-stream",
"author": "",
"bugs": {
"url": "https://github.com/calvinmetcalf/process-nextick-args/issues"
diff --git a/node_modules/rc/node_modules/minimist/.travis.yml b/node_modules/rc/node_modules/minimist/.travis.yml
deleted file mode 100644
index 74c57bf..0000000
--- a/node_modules/rc/node_modules/minimist/.travis.yml
+++ /dev/null
@@ -1,8 +0,0 @@
-language: node_js
-node_js:
- - "0.8"
- - "0.10"
- - "0.12"
- - "iojs"
-before_install:
- - npm install -g npm@~1.4.6
diff --git a/node_modules/rc/node_modules/minimist/LICENSE b/node_modules/rc/node_modules/minimist/LICENSE
deleted file mode 100644
index ee27ba4..0000000
--- a/node_modules/rc/node_modules/minimist/LICENSE
+++ /dev/null
@@ -1,18 +0,0 @@
-This software is released under the MIT license:
-
-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/node_modules/rc/node_modules/minimist/example/parse.js b/node_modules/rc/node_modules/minimist/example/parse.js
deleted file mode 100644
index abff3e8..0000000
--- a/node_modules/rc/node_modules/minimist/example/parse.js
+++ /dev/null
@@ -1,2 +0,0 @@
-var argv = require('../')(process.argv.slice(2));
-console.dir(argv);
diff --git a/node_modules/rc/node_modules/minimist/package.json b/node_modules/rc/node_modules/minimist/package.json
deleted file mode 100644
index 46dd8af..0000000
--- a/node_modules/rc/node_modules/minimist/package.json
+++ /dev/null
@@ -1,118 +0,0 @@
-{
- "_args": [
- [
- {
- "raw": "minimist@^1.2.0",
- "scope": null,
- "escapedName": "minimist",
- "name": "minimist",
- "rawSpec": "^1.2.0",
- "spec": ">=1.2.0 <2.0.0",
- "type": "range"
- },
- "/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/prebuild-install"
- ],
- [
- {
- "raw": "minimist@^1.2.0",
- "scope": null,
- "escapedName": "minimist",
- "name": "minimist",
- "rawSpec": "^1.2.0",
- "spec": ">=1.2.0 <2.0.0",
- "type": "range"
- },
- "/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/rc"
- ]
- ],
- "_from": "minimist@^1.2.0",
- "_id": "minimist@1.2.0",
- "_inCache": true,
- "_installable": true,
- "_location": "/rc/minimist",
- "_nodeVersion": "2.4.0",
- "_npmUser": {
- "name": "substack",
- "email": "substack@gmail.com"
- },
- "_npmVersion": "3.2.2",
- "_phantomChildren": {},
- "_requested": {
- "raw": "minimist@^1.2.0",
- "scope": null,
- "escapedName": "minimist",
- "name": "minimist",
- "rawSpec": "^1.2.0",
- "spec": ">=1.2.0 <2.0.0",
- "type": "range"
- },
- "_requiredBy": [
- "/rc"
- ],
- "_resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
- "_shasum": "a35008b20f41383eec1fb914f4cd5df79a264284",
- "_shrinkwrap": null,
- "_spec": "minimist@^1.2.0",
- "_where": "/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/rc",
- "author": {
- "name": "James Halliday",
- "email": "mail@substack.net",
- "url": "http://substack.net"
- },
- "bugs": {
- "url": "https://github.com/substack/minimist/issues"
- },
- "dependencies": {},
- "description": "parse argument options",
- "devDependencies": {
- "covert": "^1.0.0",
- "tap": "~0.4.0",
- "tape": "^3.5.0"
- },
- "directories": {},
- "dist": {
- "shasum": "a35008b20f41383eec1fb914f4cd5df79a264284",
- "tarball": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz"
- },
- "gitHead": "dc624482fcfec5bc669c68cdb861f00573ed4e64",
- "homepage": "https://github.com/substack/minimist",
- "keywords": [
- "argv",
- "getopt",
- "parser",
- "optimist"
- ],
- "license": "MIT",
- "main": "index.js",
- "maintainers": [
- {
- "name": "substack",
- "email": "mail@substack.net"
- }
- ],
- "name": "minimist",
- "optionalDependencies": {},
- "readme": "ERROR: No README data found!",
- "repository": {
- "type": "git",
- "url": "git://github.com/substack/minimist.git"
- },
- "scripts": {
- "coverage": "covert test/*.js",
- "test": "tap test/*.js"
- },
- "testling": {
- "files": "test/*.js",
- "browsers": [
- "ie/6..latest",
- "ff/5",
- "firefox/latest",
- "chrome/10",
- "chrome/latest",
- "safari/5.1",
- "safari/latest",
- "opera/12"
- ]
- },
- "version": "1.2.0"
-}
diff --git a/node_modules/rc/node_modules/minimist/readme.markdown b/node_modules/rc/node_modules/minimist/readme.markdown
deleted file mode 100644
index 30a74cf..0000000
--- a/node_modules/rc/node_modules/minimist/readme.markdown
+++ /dev/null
@@ -1,91 +0,0 @@
-# minimist
-
-parse argument options
-
-This module is the guts of optimist's argument parser without all the
-fanciful decoration.
-
-[](http://ci.testling.com/substack/minimist)
-
-[](http://travis-ci.org/substack/minimist)
-
-# example
-
-``` js
-var argv = require('minimist')(process.argv.slice(2));
-console.dir(argv);
-```
-
-```
-$ node example/parse.js -a beep -b boop
-{ _: [], a: 'beep', b: 'boop' }
-```
-
-```
-$ node example/parse.js -x 3 -y 4 -n5 -abc --beep=boop foo bar baz
-{ _: [ 'foo', 'bar', 'baz' ],
- x: 3,
- y: 4,
- n: 5,
- a: true,
- b: true,
- c: true,
- beep: 'boop' }
-```
-
-# methods
-
-``` js
-var parseArgs = require('minimist')
-```
-
-## var argv = parseArgs(args, opts={})
-
-Return an argument object `argv` populated with the array arguments from `args`.
-
-`argv._` contains all the arguments that didn't have an option associated with
-them.
-
-Numeric-looking arguments will be returned as numbers unless `opts.string` or
-`opts.boolean` is set for that argument name.
-
-Any arguments after `'--'` will not be parsed and will end up in `argv._`.
-
-options can be:
-
-* `opts.string` - a string or array of strings argument names to always treat as
-strings
-* `opts.boolean` - a boolean, string or array of strings to always treat as
-booleans. if `true` will treat all double hyphenated arguments without equal signs
-as boolean (e.g. affects `--foo`, not `-f` or `--foo=bar`)
-* `opts.alias` - an object mapping string names to strings or arrays of string
-argument names to use as aliases
-* `opts.default` - an object mapping string argument names to default values
-* `opts.stopEarly` - when true, populate `argv._` with everything after the
-first non-option
-* `opts['--']` - when true, populate `argv._` with everything before the `--`
-and `argv['--']` with everything after the `--`. Here's an example:
-* `opts.unknown` - a function which is invoked with a command line parameter not
-defined in the `opts` configuration object. If the function returns `false`, the
-unknown option is not added to `argv`.
-
-```
-> require('./')('one two three -- four five --six'.split(' '), { '--': true })
-{ _: [ 'one', 'two', 'three' ],
- '--': [ 'four', 'five', '--six' ] }
-```
-
-Note that with `opts['--']` set, parsing for arguments still stops after the
-`--`.
-
-# install
-
-With [npm](https://npmjs.org) do:
-
-```
-npm install minimist
-```
-
-# license
-
-MIT
diff --git a/node_modules/rc/node_modules/minimist/test/all_bool.js b/node_modules/rc/node_modules/minimist/test/all_bool.js
deleted file mode 100644
index ac83548..0000000
--- a/node_modules/rc/node_modules/minimist/test/all_bool.js
+++ /dev/null
@@ -1,32 +0,0 @@
-var parse = require('../');
-var test = require('tape');
-
-test('flag boolean true (default all --args to boolean)', function (t) {
- var argv = parse(['moo', '--honk', 'cow'], {
- boolean: true
- });
-
- t.deepEqual(argv, {
- honk: true,
- _: ['moo', 'cow']
- });
-
- t.deepEqual(typeof argv.honk, 'boolean');
- t.end();
-});
-
-test('flag boolean true only affects double hyphen arguments without equals signs', function (t) {
- var argv = parse(['moo', '--honk', 'cow', '-p', '55', '--tacos=good'], {
- boolean: true
- });
-
- t.deepEqual(argv, {
- honk: true,
- tacos: 'good',
- p: 55,
- _: ['moo', 'cow']
- });
-
- t.deepEqual(typeof argv.honk, 'boolean');
- t.end();
-});
diff --git a/node_modules/rc/node_modules/minimist/test/bool.js b/node_modules/rc/node_modules/minimist/test/bool.js
deleted file mode 100644
index 14b0717..0000000
--- a/node_modules/rc/node_modules/minimist/test/bool.js
+++ /dev/null
@@ -1,166 +0,0 @@
-var parse = require('../');
-var test = require('tape');
-
-test('flag boolean default false', function (t) {
- var argv = parse(['moo'], {
- boolean: ['t', 'verbose'],
- default: { verbose: false, t: false }
- });
-
- t.deepEqual(argv, {
- verbose: false,
- t: false,
- _: ['moo']
- });
-
- t.deepEqual(typeof argv.verbose, 'boolean');
- t.deepEqual(typeof argv.t, 'boolean');
- t.end();
-
-});
-
-test('boolean groups', function (t) {
- var argv = parse([ '-x', '-z', 'one', 'two', 'three' ], {
- boolean: ['x','y','z']
- });
-
- t.deepEqual(argv, {
- x : true,
- y : false,
- z : true,
- _ : [ 'one', 'two', 'three' ]
- });
-
- t.deepEqual(typeof argv.x, 'boolean');
- t.deepEqual(typeof argv.y, 'boolean');
- t.deepEqual(typeof argv.z, 'boolean');
- t.end();
-});
-test('boolean and alias with chainable api', function (t) {
- var aliased = [ '-h', 'derp' ];
- var regular = [ '--herp', 'derp' ];
- var opts = {
- herp: { alias: 'h', boolean: true }
- };
- var aliasedArgv = parse(aliased, {
- boolean: 'herp',
- alias: { h: 'herp' }
- });
- var propertyArgv = parse(regular, {
- boolean: 'herp',
- alias: { h: 'herp' }
- });
- var expected = {
- herp: true,
- h: true,
- '_': [ 'derp' ]
- };
-
- t.same(aliasedArgv, expected);
- t.same(propertyArgv, expected);
- t.end();
-});
-
-test('boolean and alias with options hash', function (t) {
- var aliased = [ '-h', 'derp' ];
- var regular = [ '--herp', 'derp' ];
- var opts = {
- alias: { 'h': 'herp' },
- boolean: 'herp'
- };
- var aliasedArgv = parse(aliased, opts);
- var propertyArgv = parse(regular, opts);
- var expected = {
- herp: true,
- h: true,
- '_': [ 'derp' ]
- };
- t.same(aliasedArgv, expected);
- t.same(propertyArgv, expected);
- t.end();
-});
-
-test('boolean and alias array with options hash', function (t) {
- var aliased = [ '-h', 'derp' ];
- var regular = [ '--herp', 'derp' ];
- var alt = [ '--harp', 'derp' ];
- var opts = {
- alias: { 'h': ['herp', 'harp'] },
- boolean: 'h'
- };
- var aliasedArgv = parse(aliased, opts);
- var propertyArgv = parse(regular, opts);
- var altPropertyArgv = parse(alt, opts);
- var expected = {
- harp: true,
- herp: true,
- h: true,
- '_': [ 'derp' ]
- };
- t.same(aliasedArgv, expected);
- t.same(propertyArgv, expected);
- t.same(altPropertyArgv, expected);
- t.end();
-});
-
-test('boolean and alias using explicit true', function (t) {
- var aliased = [ '-h', 'true' ];
- var regular = [ '--herp', 'true' ];
- var opts = {
- alias: { h: 'herp' },
- boolean: 'h'
- };
- var aliasedArgv = parse(aliased, opts);
- var propertyArgv = parse(regular, opts);
- var expected = {
- herp: true,
- h: true,
- '_': [ ]
- };
-
- t.same(aliasedArgv, expected);
- t.same(propertyArgv, expected);
- t.end();
-});
-
-// regression, see https://github.com/substack/node-optimist/issues/71
-test('boolean and --x=true', function(t) {
- var parsed = parse(['--boool', '--other=true'], {
- boolean: 'boool'
- });
-
- t.same(parsed.boool, true);
- t.same(parsed.other, 'true');
-
- parsed = parse(['--boool', '--other=false'], {
- boolean: 'boool'
- });
-
- t.same(parsed.boool, true);
- t.same(parsed.other, 'false');
- t.end();
-});
-
-test('boolean --boool=true', function (t) {
- var parsed = parse(['--boool=true'], {
- default: {
- boool: false
- },
- boolean: ['boool']
- });
-
- t.same(parsed.boool, true);
- t.end();
-});
-
-test('boolean --boool=false', function (t) {
- var parsed = parse(['--boool=false'], {
- default: {
- boool: true
- },
- boolean: ['boool']
- });
-
- t.same(parsed.boool, false);
- t.end();
-});
diff --git a/node_modules/rc/node_modules/minimist/test/dash.js b/node_modules/rc/node_modules/minimist/test/dash.js
deleted file mode 100644
index 5a4fa5b..0000000
--- a/node_modules/rc/node_modules/minimist/test/dash.js
+++ /dev/null
@@ -1,31 +0,0 @@
-var parse = require('../');
-var test = require('tape');
-
-test('-', function (t) {
- t.plan(5);
- t.deepEqual(parse([ '-n', '-' ]), { n: '-', _: [] });
- t.deepEqual(parse([ '-' ]), { _: [ '-' ] });
- t.deepEqual(parse([ '-f-' ]), { f: '-', _: [] });
- t.deepEqual(
- parse([ '-b', '-' ], { boolean: 'b' }),
- { b: true, _: [ '-' ] }
- );
- t.deepEqual(
- parse([ '-s', '-' ], { string: 's' }),
- { s: '-', _: [] }
- );
-});
-
-test('-a -- b', function (t) {
- t.plan(3);
- t.deepEqual(parse([ '-a', '--', 'b' ]), { a: true, _: [ 'b' ] });
- t.deepEqual(parse([ '--a', '--', 'b' ]), { a: true, _: [ 'b' ] });
- t.deepEqual(parse([ '--a', '--', 'b' ]), { a: true, _: [ 'b' ] });
-});
-
-test('move arguments after the -- into their own `--` array', function(t) {
- t.plan(1);
- t.deepEqual(
- parse([ '--name', 'John', 'before', '--', 'after' ], { '--': true }),
- { name: 'John', _: [ 'before' ], '--': [ 'after' ] });
-});
diff --git a/node_modules/rc/node_modules/minimist/test/kv_short.js b/node_modules/rc/node_modules/minimist/test/kv_short.js
deleted file mode 100644
index f813b30..0000000
--- a/node_modules/rc/node_modules/minimist/test/kv_short.js
+++ /dev/null
@@ -1,16 +0,0 @@
-var parse = require('../');
-var test = require('tape');
-
-test('short -k=v' , function (t) {
- t.plan(1);
-
- var argv = parse([ '-b=123' ]);
- t.deepEqual(argv, { b: 123, _: [] });
-});
-
-test('multi short -k=v' , function (t) {
- t.plan(1);
-
- var argv = parse([ '-a=whatever', '-b=robots' ]);
- t.deepEqual(argv, { a: 'whatever', b: 'robots', _: [] });
-});
diff --git a/node_modules/rc/node_modules/minimist/test/long.js b/node_modules/rc/node_modules/minimist/test/long.js
deleted file mode 100644
index 5d3a1e0..0000000
--- a/node_modules/rc/node_modules/minimist/test/long.js
+++ /dev/null
@@ -1,31 +0,0 @@
-var test = require('tape');
-var parse = require('../');
-
-test('long opts', function (t) {
- t.deepEqual(
- parse([ '--bool' ]),
- { bool : true, _ : [] },
- 'long boolean'
- );
- t.deepEqual(
- parse([ '--pow', 'xixxle' ]),
- { pow : 'xixxle', _ : [] },
- 'long capture sp'
- );
- t.deepEqual(
- parse([ '--pow=xixxle' ]),
- { pow : 'xixxle', _ : [] },
- 'long capture eq'
- );
- t.deepEqual(
- parse([ '--host', 'localhost', '--port', '555' ]),
- { host : 'localhost', port : 555, _ : [] },
- 'long captures sp'
- );
- t.deepEqual(
- parse([ '--host=localhost', '--port=555' ]),
- { host : 'localhost', port : 555, _ : [] },
- 'long captures eq'
- );
- t.end();
-});
diff --git a/node_modules/rc/node_modules/minimist/test/num.js b/node_modules/rc/node_modules/minimist/test/num.js
deleted file mode 100644
index 2cc77f4..0000000
--- a/node_modules/rc/node_modules/minimist/test/num.js
+++ /dev/null
@@ -1,36 +0,0 @@
-var parse = require('../');
-var test = require('tape');
-
-test('nums', function (t) {
- var argv = parse([
- '-x', '1234',
- '-y', '5.67',
- '-z', '1e7',
- '-w', '10f',
- '--hex', '0xdeadbeef',
- '789'
- ]);
- t.deepEqual(argv, {
- x : 1234,
- y : 5.67,
- z : 1e7,
- w : '10f',
- hex : 0xdeadbeef,
- _ : [ 789 ]
- });
- t.deepEqual(typeof argv.x, 'number');
- t.deepEqual(typeof argv.y, 'number');
- t.deepEqual(typeof argv.z, 'number');
- t.deepEqual(typeof argv.w, 'string');
- t.deepEqual(typeof argv.hex, 'number');
- t.deepEqual(typeof argv._[0], 'number');
- t.end();
-});
-
-test('already a number', function (t) {
- var argv = parse([ '-x', 1234, 789 ]);
- t.deepEqual(argv, { x : 1234, _ : [ 789 ] });
- t.deepEqual(typeof argv.x, 'number');
- t.deepEqual(typeof argv._[0], 'number');
- t.end();
-});
diff --git a/node_modules/rc/node_modules/minimist/test/parse_modified.js b/node_modules/rc/node_modules/minimist/test/parse_modified.js
deleted file mode 100644
index ab620dc..0000000
--- a/node_modules/rc/node_modules/minimist/test/parse_modified.js
+++ /dev/null
@@ -1,9 +0,0 @@
-var parse = require('../');
-var test = require('tape');
-
-test('parse with modifier functions' , function (t) {
- t.plan(1);
-
- var argv = parse([ '-b', '123' ], { boolean: 'b' });
- t.deepEqual(argv, { b: true, _: [123] });
-});
diff --git a/node_modules/rc/node_modules/minimist/test/short.js b/node_modules/rc/node_modules/minimist/test/short.js
deleted file mode 100644
index d513a1c..0000000
--- a/node_modules/rc/node_modules/minimist/test/short.js
+++ /dev/null
@@ -1,67 +0,0 @@
-var parse = require('../');
-var test = require('tape');
-
-test('numeric short args', function (t) {
- t.plan(2);
- t.deepEqual(parse([ '-n123' ]), { n: 123, _: [] });
- t.deepEqual(
- parse([ '-123', '456' ]),
- { 1: true, 2: true, 3: 456, _: [] }
- );
-});
-
-test('short', function (t) {
- t.deepEqual(
- parse([ '-b' ]),
- { b : true, _ : [] },
- 'short boolean'
- );
- t.deepEqual(
- parse([ 'foo', 'bar', 'baz' ]),
- { _ : [ 'foo', 'bar', 'baz' ] },
- 'bare'
- );
- t.deepEqual(
- parse([ '-cats' ]),
- { c : true, a : true, t : true, s : true, _ : [] },
- 'group'
- );
- t.deepEqual(
- parse([ '-cats', 'meow' ]),
- { c : true, a : true, t : true, s : 'meow', _ : [] },
- 'short group next'
- );
- t.deepEqual(
- parse([ '-h', 'localhost' ]),
- { h : 'localhost', _ : [] },
- 'short capture'
- );
- t.deepEqual(
- parse([ '-h', 'localhost', '-p', '555' ]),
- { h : 'localhost', p : 555, _ : [] },
- 'short captures'
- );
- t.end();
-});
-
-test('mixed short bool and capture', function (t) {
- t.same(
- parse([ '-h', 'localhost', '-fp', '555', 'script.js' ]),
- {
- f : true, p : 555, h : 'localhost',
- _ : [ 'script.js' ]
- }
- );
- t.end();
-});
-
-test('short and long', function (t) {
- t.deepEqual(
- parse([ '-h', 'localhost', '-fp', '555', 'script.js' ]),
- {
- f : true, p : 555, h : 'localhost',
- _ : [ 'script.js' ]
- }
- );
- t.end();
-});
diff --git a/node_modules/rc/node_modules/minimist/test/stop_early.js b/node_modules/rc/node_modules/minimist/test/stop_early.js
deleted file mode 100644
index bdf9fbc..0000000
--- a/node_modules/rc/node_modules/minimist/test/stop_early.js
+++ /dev/null
@@ -1,15 +0,0 @@
-var parse = require('../');
-var test = require('tape');
-
-test('stops parsing on the first non-option when stopEarly is set', function (t) {
- var argv = parse(['--aaa', 'bbb', 'ccc', '--ddd'], {
- stopEarly: true
- });
-
- t.deepEqual(argv, {
- aaa: 'bbb',
- _: ['ccc', '--ddd']
- });
-
- t.end();
-});
diff --git a/node_modules/rc/node_modules/minimist/test/unknown.js b/node_modules/rc/node_modules/minimist/test/unknown.js
deleted file mode 100644
index 462a36b..0000000
--- a/node_modules/rc/node_modules/minimist/test/unknown.js
+++ /dev/null
@@ -1,102 +0,0 @@
-var parse = require('../');
-var test = require('tape');
-
-test('boolean and alias is not unknown', function (t) {
- var unknown = [];
- function unknownFn(arg) {
- unknown.push(arg);
- return false;
- }
- var aliased = [ '-h', 'true', '--derp', 'true' ];
- var regular = [ '--herp', 'true', '-d', 'true' ];
- var opts = {
- alias: { h: 'herp' },
- boolean: 'h',
- unknown: unknownFn
- };
- var aliasedArgv = parse(aliased, opts);
- var propertyArgv = parse(regular, opts);
-
- t.same(unknown, ['--derp', '-d']);
- t.end();
-});
-
-test('flag boolean true any double hyphen argument is not unknown', function (t) {
- var unknown = [];
- function unknownFn(arg) {
- unknown.push(arg);
- return false;
- }
- var argv = parse(['--honk', '--tacos=good', 'cow', '-p', '55'], {
- boolean: true,
- unknown: unknownFn
- });
- t.same(unknown, ['--tacos=good', 'cow', '-p']);
- t.same(argv, {
- honk: true,
- _: []
- });
- t.end();
-});
-
-test('string and alias is not unknown', function (t) {
- var unknown = [];
- function unknownFn(arg) {
- unknown.push(arg);
- return false;
- }
- var aliased = [ '-h', 'hello', '--derp', 'goodbye' ];
- var regular = [ '--herp', 'hello', '-d', 'moon' ];
- var opts = {
- alias: { h: 'herp' },
- string: 'h',
- unknown: unknownFn
- };
- var aliasedArgv = parse(aliased, opts);
- var propertyArgv = parse(regular, opts);
-
- t.same(unknown, ['--derp', '-d']);
- t.end();
-});
-
-test('default and alias is not unknown', function (t) {
- var unknown = [];
- function unknownFn(arg) {
- unknown.push(arg);
- return false;
- }
- var aliased = [ '-h', 'hello' ];
- var regular = [ '--herp', 'hello' ];
- var opts = {
- default: { 'h': 'bar' },
- alias: { 'h': 'herp' },
- unknown: unknownFn
- };
- var aliasedArgv = parse(aliased, opts);
- var propertyArgv = parse(regular, opts);
-
- t.same(unknown, []);
- t.end();
- unknownFn(); // exercise fn for 100% coverage
-});
-
-test('value following -- is not unknown', function (t) {
- var unknown = [];
- function unknownFn(arg) {
- unknown.push(arg);
- return false;
- }
- var aliased = [ '--bad', '--', 'good', 'arg' ];
- var opts = {
- '--': true,
- unknown: unknownFn
- };
- var argv = parse(aliased, opts);
-
- t.same(unknown, ['--bad']);
- t.same(argv, {
- '--': ['good', 'arg'],
- '_': []
- })
- t.end();
-});
diff --git a/node_modules/rc/node_modules/minimist/test/whitespace.js b/node_modules/rc/node_modules/minimist/test/whitespace.js
deleted file mode 100644
index 8a52a58..0000000
--- a/node_modules/rc/node_modules/minimist/test/whitespace.js
+++ /dev/null
@@ -1,8 +0,0 @@
-var parse = require('../');
-var test = require('tape');
-
-test('whitespace should be whitespace' , function (t) {
- t.plan(1);
- var x = parse([ '-x', '\t' ]).x;
- t.equal(x, '\t');
-});
diff --git a/node_modules/readable-stream/.npmignore b/node_modules/readable-stream/.npmignore
index 38344f8..6d270c6 100644
--- a/node_modules/readable-stream/.npmignore
+++ b/node_modules/readable-stream/.npmignore
@@ -2,4 +2,8 @@ build/
test/
examples/
fs.js
-zlib.js
\ No newline at end of file
+zlib.js
+.zuul.yml
+.nyc_output
+coverage
+docs/
diff --git a/node_modules/bl/node_modules/readable-stream/.travis.yml b/node_modules/readable-stream/.travis.yml
similarity index 100%
rename from node_modules/bl/node_modules/readable-stream/.travis.yml
rename to node_modules/readable-stream/.travis.yml
diff --git a/node_modules/bl/node_modules/readable-stream/CONTRIBUTING.md b/node_modules/readable-stream/CONTRIBUTING.md
similarity index 100%
rename from node_modules/bl/node_modules/readable-stream/CONTRIBUTING.md
rename to node_modules/readable-stream/CONTRIBUTING.md
diff --git a/node_modules/bl/node_modules/readable-stream/GOVERNANCE.md b/node_modules/readable-stream/GOVERNANCE.md
similarity index 100%
rename from node_modules/bl/node_modules/readable-stream/GOVERNANCE.md
rename to node_modules/readable-stream/GOVERNANCE.md
diff --git a/node_modules/readable-stream/LICENSE b/node_modules/readable-stream/LICENSE
index e3d4e69..2873b3b 100644
--- a/node_modules/readable-stream/LICENSE
+++ b/node_modules/readable-stream/LICENSE
@@ -1,3 +1,31 @@
+Node.js is licensed for use as follows:
+
+"""
+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.
+"""
+
+This license applies to parts of Node.js originating from the
+https://github.com/joyent/node repository:
+
+"""
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
@@ -16,3 +44,4 @@ 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/node_modules/readable-stream/README.md b/node_modules/readable-stream/README.md
index e46b823..ff75b0d 100644
--- a/node_modules/readable-stream/README.md
+++ b/node_modules/readable-stream/README.md
@@ -1,15 +1,57 @@
# readable-stream
+***Node-core v7.0.0 streams for userland*** [](https://travis-ci.org/nodejs/readable-stream)
+
+
+[](https://nodei.co/npm/readable-stream/)
+[](https://nodei.co/npm/readable-stream/)
+
+
+[](https://saucelabs.com/u/readable-stream)
+
+```bash
+npm install --save readable-stream
+```
+
***Node-core streams for userland***
-[](https://nodei.co/npm/readable-stream/)
-[](https://nodei.co/npm/readable-stream/)
+This package is a mirror of the Streams2 and Streams3 implementations in
+Node-core.
-This package is a mirror of the Streams2 and Streams3 implementations in Node-core.
+Full documentation may be found on the [Node.js website](https://nodejs.org/dist/v7.7.3/docs/api/).
-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.
+If you want to guarantee a stable streams base, regardless of what version of
+Node you, or the users of your libraries are using, use **readable-stream** *only* and avoid the *"stream"* module in Node-core, for background see [this blogpost](http://r.va.gg/2014/06/why-i-dont-use-nodes-core-stream-module.html).
-**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.
+As of version 2.0.0 **readable-stream** uses semantic versioning.
-**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"`
+# Streams Working Group
+`readable-stream` is maintained by the Streams Working Group, which
+oversees the development and maintenance of the Streams API within
+Node.js. The responsibilities of the Streams Working Group include:
+
+* Addressing stream issues on the Node.js issue tracker.
+* Authoring and editing stream documentation within the Node.js project.
+* Reviewing changes to stream subclasses within the Node.js project.
+* Redirecting changes to streams from the Node.js project to this
+ project.
+* Assisting in the implementation of stream providers within Node.js.
+* Recommending versions of `readable-stream` to be included in Node.js.
+* Messaging about the future of streams to give the community advance
+ notice of changes.
+
+
+## Team Members
+
+* **Chris Dickinson** ([@chrisdickinson](https://github.com/chrisdickinson)) <christopher.s.dickinson@gmail.com>
+ - Release GPG key: 9554F04D7259F04124DE6B476D5A82AC7E37093B
+* **Calvin Metcalf** ([@calvinmetcalf](https://github.com/calvinmetcalf)) <calvin.metcalf@gmail.com>
+ - Release GPG key: F3EF5F62A87FC27A22E643F714CE4FF5015AA242
+* **Rod Vagg** ([@rvagg](https://github.com/rvagg)) <rod@vagg.org>
+ - Release GPG key: DD8F2338BAE7501E3DD5AC78C273792F7D83545D
+* **Sam Newman** ([@sonewman](https://github.com/sonewman)) <newmansam@outlook.com>
+* **Mathias Buus** ([@mafintosh](https://github.com/mafintosh)) <mathiasbuus@gmail.com>
+* **Domenic Denicola** ([@domenic](https://github.com/domenic)) <d@domenic.me>
+* **Matteo Collina** ([@mcollina](https://github.com/mcollina)) <matteo.collina@gmail.com>
+ - Release GPG key: 3ABC01543F22DD2239285CDD818674489FBC127E
diff --git a/node_modules/bl/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md b/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md
similarity index 100%
rename from node_modules/bl/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md
rename to node_modules/readable-stream/doc/wg-meetings/2015-01-30.md
diff --git a/node_modules/readable-stream/lib/_stream_duplex.js b/node_modules/readable-stream/lib/_stream_duplex.js
index b513d61..736693b 100644
--- a/node_modules/readable-stream/lib/_stream_duplex.js
+++ b/node_modules/readable-stream/lib/_stream_duplex.js
@@ -1,40 +1,26 @@
-// 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.
+'use strict';
+
+/**/
+
+var objectKeys = Object.keys || function (obj) {
+ var keys = [];
+ for (var key in obj) {
+ keys.push(key);
+ }return keys;
+};
+/**/
+
module.exports = Duplex;
/**/
-var objectKeys = Object.keys || function (obj) {
- var keys = [];
- for (var key in obj) keys.push(key);
- return keys;
-}
+var processNextTick = require('process-nextick-args');
/**/
-
/**/
var util = require('core-util-is');
util.inherits = require('inherits');
@@ -45,27 +31,24 @@ 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];
-});
+var keys = objectKeys(Writable.prototype);
+for (var v = 0; v < keys.length; v++) {
+ var method = keys[v];
+ if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
+}
function Duplex(options) {
- if (!(this instanceof Duplex))
- return new 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.readable === false) this.readable = false;
- if (options && options.writable === false)
- this.writable = false;
+ if (options && options.writable === false) this.writable = false;
this.allowHalfOpen = true;
- if (options && options.allowHalfOpen === false)
- this.allowHalfOpen = false;
+ if (options && options.allowHalfOpen === false) this.allowHalfOpen = false;
this.once('end', onend);
}
@@ -74,16 +57,19 @@ function Duplex(options) {
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;
+ 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));
+ processNextTick(onEndNT, this);
}
-function forEach (xs, f) {
+function onEndNT(self) {
+ self.end();
+}
+
+function forEach(xs, f) {
for (var i = 0, l = xs.length; i < l; i++) {
f(xs[i], i);
}
-}
+}
\ No newline at end of file
diff --git a/node_modules/readable-stream/lib/_stream_passthrough.js b/node_modules/readable-stream/lib/_stream_passthrough.js
index 895ca50..d06f71f 100644
--- a/node_modules/readable-stream/lib/_stream_passthrough.js
+++ b/node_modules/readable-stream/lib/_stream_passthrough.js
@@ -1,28 +1,9 @@
-// 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.
+'use strict';
+
module.exports = PassThrough;
var Transform = require('./_stream_transform');
@@ -35,12 +16,11 @@ util.inherits = require('inherits');
util.inherits(PassThrough, Transform);
function PassThrough(options) {
- if (!(this instanceof PassThrough))
- return new PassThrough(options);
+ if (!(this instanceof PassThrough)) return new PassThrough(options);
Transform.call(this, options);
}
-PassThrough.prototype._transform = function(chunk, encoding, cb) {
+PassThrough.prototype._transform = function (chunk, encoding, cb) {
cb(null, chunk);
-};
+};
\ No newline at end of file
diff --git a/node_modules/readable-stream/lib/_stream_readable.js b/node_modules/readable-stream/lib/_stream_readable.js
index 19ab358..13b5a74 100644
--- a/node_modules/readable-stream/lib/_stream_readable.js
+++ b/node_modules/readable-stream/lib/_stream_readable.js
@@ -1,82 +1,103 @@
-// 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.
+'use strict';
module.exports = Readable;
+/**/
+var processNextTick = require('process-nextick-args');
+/**/
+
/**/
var isArray = require('isarray');
/**/
-
/**/
-var Buffer = require('buffer').Buffer;
+var Duplex;
/**/
Readable.ReadableState = ReadableState;
+/**/
var EE = require('events').EventEmitter;
-/**/
-if (!EE.listenerCount) EE.listenerCount = function(emitter, type) {
+var EElistenerCount = function (emitter, type) {
return emitter.listeners(type).length;
};
/**/
-var Stream = require('stream');
+/**/
+var Stream;
+(function () {
+ try {
+ Stream = require('st' + 'ream');
+ } catch (_) {} finally {
+ if (!Stream) Stream = require('events').EventEmitter;
+ }
+})();
+/**/
+
+var Buffer = require('buffer').Buffer;
+/**/
+var bufferShim = require('buffer-shims');
+/**/
/**/
var util = require('core-util-is');
util.inherits = require('inherits');
/**/
-var StringDecoder;
-
-
/**/
-var debug = require('util');
-if (debug && debug.debuglog) {
- debug = debug.debuglog('stream');
+var debugUtil = require('util');
+var debug = void 0;
+if (debugUtil && debugUtil.debuglog) {
+ debug = debugUtil.debuglog('stream');
} else {
debug = function () {};
}
/**/
+var BufferList = require('./internal/streams/BufferList');
+var StringDecoder;
util.inherits(Readable, Stream);
+function prependListener(emitter, event, fn) {
+ // Sadly this is not cacheable as some libraries bundle their own
+ // event emitter implementation with them.
+ if (typeof emitter.prependListener === 'function') {
+ return emitter.prependListener(event, fn);
+ } else {
+ // This is a hack to make sure that our error handler is attached before any
+ // userland ones. NEVER DO THIS. This is here only because this code needs
+ // to continue to work with older versions of Node.js that do not include
+ // the prependListener() method. The goal is to eventually remove this hack.
+ if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]];
+ }
+}
+
function ReadableState(options, stream) {
- var Duplex = require('./_stream_duplex');
+ Duplex = Duplex || require('./_stream_duplex');
options = options || {};
+ // 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;
+
// 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;
+ var defaultHwm = this.objectMode ? 16 : 16 * 1024;
+ this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm;
// cast to ints.
this.highWaterMark = ~~this.highWaterMark;
- this.buffer = [];
+ // A linked list is used to store data chunks instead of an array because the
+ // linked list can remove elements from the beginning faster than
+ // array.shift()
+ this.buffer = new BufferList();
this.length = 0;
this.pipes = null;
this.pipesCount = 0;
@@ -96,14 +117,7 @@ function ReadableState(options, stream) {
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;
+ this.resumeScheduled = false;
// Crypto is kind of old and crusty. Historically, its default string
// encoding is 'binary' so we have to make this configurable.
@@ -123,24 +137,24 @@ function ReadableState(options, stream) {
this.decoder = null;
this.encoding = null;
if (options.encoding) {
- if (!StringDecoder)
- StringDecoder = require('string_decoder/').StringDecoder;
+ 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');
+ Duplex = Duplex || require('./_stream_duplex');
- if (!(this instanceof Readable))
- return new Readable(options);
+ if (!(this instanceof Readable)) return new Readable(options);
this._readableState = new ReadableState(options, this);
// legacy
this.readable = true;
+ if (options && typeof options.read === 'function') this._read = options.read;
+
Stream.call(this);
}
@@ -148,13 +162,13 @@ function Readable(options) {
// 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) {
+Readable.prototype.push = function (chunk, encoding) {
var state = this._readableState;
- if (util.isString(chunk) && !state.objectMode) {
+ if (!state.objectMode && typeof chunk === 'string') {
encoding = encoding || state.defaultEncoding;
if (encoding !== state.encoding) {
- chunk = new Buffer(chunk, encoding);
+ chunk = bufferShim.from(chunk, encoding);
encoding = '';
}
}
@@ -163,47 +177,52 @@ Readable.prototype.push = function(chunk, encoding) {
};
// Unshift should *always* be something directly out of read()
-Readable.prototype.unshift = function(chunk) {
+Readable.prototype.unshift = function (chunk) {
var state = this._readableState;
return readableAddChunk(this, state, chunk, '', true);
};
+Readable.prototype.isPaused = function () {
+ return this._readableState.flowing === false;
+};
+
function readableAddChunk(stream, state, chunk, encoding, addToFront) {
var er = chunkInvalid(state, chunk);
if (er) {
stream.emit('error', er);
- } else if (util.isNullOrUndefined(chunk)) {
+ } else if (chunk === null) {
state.reading = false;
- if (!state.ended)
- onEofChunk(stream, state);
+ 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);
+ var _e = new Error('stream.unshift() after end event');
+ stream.emit('error', _e);
} else {
- if (state.decoder && !addToFront && !encoding)
+ var skipAdd;
+ if (state.decoder && !addToFront && !encoding) {
chunk = state.decoder.write(chunk);
+ skipAdd = !state.objectMode && chunk.length === 0;
+ }
- if (!addToFront)
- state.reading = false;
+ 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);
+ // Don't add to the buffer if we've decoded to an empty string chunk and
+ // we're not in object mode
+ if (!skipAdd) {
+ // 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);
+ if (state.needReadable) emitReadable(stream);
+ }
}
maybeReadMore(stream, state);
@@ -215,8 +234,6 @@ function readableAddChunk(stream, state, chunk, encoding, addToFront) {
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,
@@ -225,92 +242,71 @@ function readableAddChunk(stream, state, chunk, encoding, addToFront) {
// 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);
+ 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;
+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
+// Don't raise the hwm > 8MB
var MAX_HWM = 0x800000;
-function roundUpToNextPowerOf2(n) {
+function computeNewHighWaterMark(n) {
if (n >= MAX_HWM) {
n = MAX_HWM;
} else {
- // Get the next highest power of 2
+ // Get the next highest power of 2 to prevent increasing hwm excessively in
+ // tiny amounts
n--;
- for (var p = 1; p < 32; p <<= 1) n |= n >> p;
+ n |= n >>> 1;
+ n |= n >>> 2;
+ n |= n >>> 4;
+ n |= n >>> 8;
+ n |= n >>> 16;
n++;
}
return n;
}
+// This function is designed to be inlinable, so please take care when making
+// changes to the function body.
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 || state.length === 0 && state.ended) return 0;
+ if (state.objectMode) return 1;
+ if (n !== n) {
+ // Only flow one buffer at a time
+ if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;
}
-
- if (n <= 0)
+ // If we're asking for more than the current hwm, then raise the hwm.
+ if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);
+ if (n <= state.length) return n;
+ // Don't have enough
+ if (!state.ended) {
+ state.needReadable = true;
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;
+ return state.length;
}
// you can override either this method, or the async _read(n) below.
-Readable.prototype.read = function(n) {
+Readable.prototype.read = function (n) {
debug('read', n);
+ n = parseInt(n, 10);
var state = this._readableState;
var nOrig = n;
- if (!util.isNumber(n) || n > 0)
- state.emittedReadable = false;
+ if (n !== 0) state.emittedReadable = false;
// if we're doing read(0) to trigger a readable event, but we
// already have a bunch of data in the buffer, then just trigger
// the 'readable' event and move on.
- if (n === 0 &&
- state.needReadable &&
- (state.length >= state.highWaterMark || state.ended)) {
+ if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) {
debug('read: emitReadable', state.length, state.ended);
- if (state.length === 0 && state.ended)
- endReadable(this);
- else
- emitReadable(this);
+ if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);
return null;
}
@@ -318,8 +314,7 @@ Readable.prototype.read = function(n) {
// if we've ended, and we're now clear, then finish it up.
if (n === 0 && state.ended) {
- if (state.length === 0)
- endReadable(this);
+ if (state.length === 0) endReadable(this);
return null;
}
@@ -360,67 +355,55 @@ Readable.prototype.read = function(n) {
if (state.ended || state.reading) {
doRead = false;
debug('reading or ended', doRead);
- }
-
- if (doRead) {
+ } else if (doRead) {
debug('do read');
state.reading = true;
state.sync = true;
// if the length is currently zero, then we *need* a readable event.
- if (state.length === 0)
- state.needReadable = true;
+ 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 (!state.reading) n = howMuchToRead(nOrig, state);
}
- // 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 (n > 0) ret = fromList(n, state);else ret = null;
- if (util.isNull(ret)) {
+ if (ret === null) {
state.needReadable = true;
n = 0;
+ } else {
+ state.length -= n;
}
- state.length -= n;
+ if (state.length === 0) {
+ // If we have nothing in the buffer, then we want to know
+ // as soon as we *do* get something into the buffer.
+ if (!state.ended) state.needReadable = true;
- // If we 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) endReadable(this);
+ }
- // 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);
+ if (ret !== null) 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) {
+ if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== null && chunk !== undefined && !state.objectMode) {
er = new TypeError('Invalid non-string/buffer chunk');
}
return er;
}
-
function onEofChunk(stream, state) {
- if (state.decoder && !state.ended) {
+ if (state.ended) return;
+ if (state.decoder) {
var chunk = state.decoder.end();
if (chunk && chunk.length) {
state.buffer.push(chunk);
@@ -442,12 +425,7 @@ function emitReadable(stream) {
if (!state.emittedReadable) {
debug('emitReadable', state.flowing);
state.emittedReadable = true;
- if (state.sync)
- process.nextTick(function() {
- emitReadable_(stream);
- });
- else
- emitReadable_(stream);
+ if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream);
}
}
@@ -457,7 +435,6 @@ function emitReadable_(stream) {
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
@@ -467,23 +444,18 @@ function emitReadable_(stream) {
function maybeReadMore(stream, state) {
if (!state.readingMore) {
state.readingMore = true;
- process.nextTick(function() {
- maybeReadMore_(stream, state);
- });
+ processNextTick(maybeReadMore_, stream, state);
}
}
function maybeReadMore_(stream, state) {
var len = state.length;
- while (!state.reading && !state.flowing && !state.ended &&
- state.length < state.highWaterMark) {
+ 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;
+ break;else len = state.length;
}
state.readingMore = false;
}
@@ -492,11 +464,11 @@ function maybeReadMore_(stream, state) {
// 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._read = function (n) {
+ this.emit('error', new Error('_read() is not implemented'));
};
-Readable.prototype.pipe = function(dest, pipeOpts) {
+Readable.prototype.pipe = function (dest, pipeOpts) {
var src = this;
var state = this._readableState;
@@ -514,15 +486,10 @@ Readable.prototype.pipe = function(dest, pipeOpts) {
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 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);
+ if (state.endEmitted) processNextTick(endFn);else src.once('end', endFn);
dest.on('unpipe', onunpipe);
function onunpipe(readable) {
@@ -544,6 +511,7 @@ Readable.prototype.pipe = function(dest, pipeOpts) {
var ondrain = pipeOnDrain(src);
dest.on('drain', ondrain);
+ var cleanedUp = false;
function cleanup() {
debug('cleanup');
// cleanup event handlers once the pipe is broken
@@ -556,24 +524,36 @@ Readable.prototype.pipe = function(dest, pipeOpts) {
src.removeListener('end', cleanup);
src.removeListener('data', ondata);
+ cleanedUp = true;
+
// if the reader is waiting for a drain event from this
// specific writer, then it would cause it to never start
// flowing again.
// So, if this is awaiting a drain, then we just call it now.
// If we don't know, then assume that we are waiting for one.
- if (state.awaitDrain &&
- (!dest._writableState || dest._writableState.needDrain))
- ondrain();
+ if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
}
+ // If the user pushes more data while we're writing to dest then we'll end up
+ // in ondata again. However, we only want to increase awaitDrain once because
+ // dest will only emit one 'drain' event for the multiple writes.
+ // => Introduce a guard on increasing awaitDrain.
+ var increasedAwaitDrain = false;
src.on('data', ondata);
function ondata(chunk) {
debug('ondata');
+ increasedAwaitDrain = false;
var ret = dest.write(chunk);
- if (false === ret) {
- debug('false write response, pause',
- src._readableState.awaitDrain);
- src._readableState.awaitDrain++;
+ if (false === ret && !increasedAwaitDrain) {
+ // If the user unpiped during `dest.write()`, it is possible
+ // to get stuck in a permanently paused state if that write
+ // also returned false.
+ // => Check whether `dest` is still a piping destination.
+ if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
+ debug('false write response, pause', src._readableState.awaitDrain);
+ src._readableState.awaitDrain++;
+ increasedAwaitDrain = true;
+ }
src.pause();
}
}
@@ -584,19 +564,11 @@ Readable.prototype.pipe = function(dest, pipeOpts) {
debug('onerror', er);
unpipe();
dest.removeListener('error', onerror);
- if (EE.listenerCount(dest, 'error') === 0)
- dest.emit('error', er);
+ if (EElistenerCount(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];
-
+ // Make sure our error handler is attached before userland ones.
+ prependListener(dest, 'error', onerror);
// Both close and finish should trigger unpipe, but only once.
function onclose() {
@@ -629,41 +601,35 @@ Readable.prototype.pipe = function(dest, pipeOpts) {
};
function pipeOnDrain(src) {
- return function() {
+ return function () {
var state = src._readableState;
debug('pipeOnDrain', state.awaitDrain);
- if (state.awaitDrain)
- state.awaitDrain--;
- if (state.awaitDrain === 0 && EE.listenerCount(src, 'data')) {
+ if (state.awaitDrain) state.awaitDrain--;
+ if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {
state.flowing = true;
flow(src);
}
};
}
-
-Readable.prototype.unpipe = function(dest) {
+Readable.prototype.unpipe = function (dest) {
var state = this._readableState;
// if we're not piping anywhere, then do nothing.
- if (state.pipesCount === 0)
- return this;
+ 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) return this;
- if (!dest)
- dest = state.pipes;
+ if (!dest) dest = state.pipes;
// got a match.
state.pipes = null;
state.pipesCount = 0;
state.flowing = false;
- if (dest)
- dest.emit('unpipe', this);
+ if (dest) dest.emit('unpipe', this);
return this;
}
@@ -677,20 +643,18 @@ Readable.prototype.unpipe = function(dest) {
state.pipesCount = 0;
state.flowing = false;
- for (var i = 0; i < len; i++)
+ for (var i = 0; i < len; i++) {
dests[i].emit('unpipe', this);
- return this;
+ }return this;
}
// try to find the right one.
- var i = indexOf(state.pipes, dest);
- if (i === -1)
- return this;
+ var index = indexOf(state.pipes, dest);
+ if (index === -1) return this;
- state.pipes.splice(i, 1);
+ state.pipes.splice(index, 1);
state.pipesCount -= 1;
- if (state.pipesCount === 1)
- state.pipes = state.pipes[0];
+ if (state.pipesCount === 1) state.pipes = state.pipes[0];
dest.emit('unpipe', this);
@@ -699,27 +663,19 @@ Readable.prototype.unpipe = function(dest) {
// set up data events if they are asked for
// Ensure readable listeners eventually get something
-Readable.prototype.on = function(ev, fn) {
+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) {
+ if (ev === 'data') {
+ // Start flowing on next tick if stream isn't explicitly paused
+ if (this._readableState.flowing !== false) this.resume();
+ } else if (ev === 'readable') {
var state = this._readableState;
- if (!state.readableListening) {
- state.readableListening = true;
+ if (!state.endEmitted && !state.readableListening) {
+ state.readableListening = state.needReadable = true;
state.emittedReadable = false;
- state.needReadable = true;
if (!state.reading) {
- var self = this;
- process.nextTick(function() {
- debug('readable nexttick read 0');
- self.read(0);
- });
+ processNextTick(nReadingNextTick, this);
} else if (state.length) {
emitReadable(this, state);
}
@@ -730,17 +686,18 @@ Readable.prototype.on = function(ev, fn) {
};
Readable.prototype.addListener = Readable.prototype.on;
+function nReadingNextTick(self) {
+ debug('readable nexttick read 0');
+ self.read(0);
+}
+
// pause() and resume() are remnants of the legacy readable stream API
// If the user uses them, then switch into old mode.
-Readable.prototype.resume = function() {
+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;
@@ -749,21 +706,24 @@ Readable.prototype.resume = function() {
function resume(stream, state) {
if (!state.resumeScheduled) {
state.resumeScheduled = true;
- process.nextTick(function() {
- resume_(stream, state);
- });
+ processNextTick(resume_, stream, state);
}
}
function resume_(stream, state) {
+ if (!state.reading) {
+ debug('resume read 0');
+ stream.read(0);
+ }
+
state.resumeScheduled = false;
+ state.awaitDrain = 0;
stream.emit('resume');
flow(stream);
- if (state.flowing && !state.reading)
- stream.read(0);
+ if (state.flowing && !state.reading) stream.read(0);
}
-Readable.prototype.pause = function() {
+Readable.prototype.pause = function () {
debug('call pause flowing=%j', this._readableState.flowing);
if (false !== this._readableState.flowing) {
debug('pause');
@@ -776,38 +736,33 @@ Readable.prototype.pause = function() {
function flow(stream) {
var state = stream._readableState;
debug('flow', state.flowing);
- if (state.flowing) {
- do {
- var chunk = stream.read();
- } while (null !== chunk && state.flowing);
- }
+ while (state.flowing && stream.read() !== null) {}
}
// 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) {
+Readable.prototype.wrap = function (stream) {
var state = this._readableState;
var paused = false;
var self = this;
- stream.on('end', function() {
+ stream.on('end', function () {
debug('wrapped end');
if (state.decoder && !state.ended) {
var chunk = state.decoder.end();
- if (chunk && chunk.length)
- self.push(chunk);
+ if (chunk && chunk.length) self.push(chunk);
}
self.push(null);
});
- stream.on('data', function(chunk) {
+ stream.on('data', function (chunk) {
debug('wrapped data');
- if (state.decoder)
- chunk = state.decoder.write(chunk);
- if (!chunk || !state.objectMode && !chunk.length)
- return;
+ if (state.decoder) chunk = state.decoder.write(chunk);
+
+ // don't skip over falsy values in objectMode
+ if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;
var ret = self.push(chunk);
if (!ret) {
@@ -819,22 +774,24 @@ Readable.prototype.wrap = function(stream) {
// 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);
+ if (this[i] === undefined && typeof stream[i] === 'function') {
+ 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) {
+ 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) {
+ self._read = function (n) {
debug('wrapped _read', n);
if (paused) {
paused = false;
@@ -845,107 +802,140 @@ Readable.prototype.wrap = function(stream) {
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.
+// This function is designed to be inlinable, so please take care when making
+// changes to the function body.
function fromList(n, state) {
- var list = state.buffer;
- var length = state.length;
- var stringMode = !!state.decoder;
- var objectMode = !!state.objectMode;
+ // nothing buffered
+ if (state.length === 0) return null;
+
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;
+ if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {
+ // read it all, truncate the list
+ if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = state.buffer.concat(state.length);
+ state.buffer.clear();
} 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;
- }
- }
+ // read part of list
+ ret = fromListPartial(n, state.buffer, state.decoder);
}
return ret;
}
+// Extracts only enough buffered data to satisfy the amount requested.
+// This function is designed to be inlinable, so please take care when making
+// changes to the function body.
+function fromListPartial(n, list, hasStrings) {
+ var ret;
+ if (n < list.head.data.length) {
+ // slice is the same for buffers and strings
+ ret = list.head.data.slice(0, n);
+ list.head.data = list.head.data.slice(n);
+ } else if (n === list.head.data.length) {
+ // first chunk is a perfect match
+ ret = list.shift();
+ } else {
+ // result spans more than one buffer
+ ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);
+ }
+ return ret;
+}
+
+// Copies a specified amount of characters from the list of buffered data
+// chunks.
+// This function is designed to be inlinable, so please take care when making
+// changes to the function body.
+function copyFromBufferString(n, list) {
+ var p = list.head;
+ var c = 1;
+ var ret = p.data;
+ n -= ret.length;
+ while (p = p.next) {
+ var str = p.data;
+ var nb = n > str.length ? str.length : n;
+ if (nb === str.length) ret += str;else ret += str.slice(0, n);
+ n -= nb;
+ if (n === 0) {
+ if (nb === str.length) {
+ ++c;
+ if (p.next) list.head = p.next;else list.head = list.tail = null;
+ } else {
+ list.head = p;
+ p.data = str.slice(nb);
+ }
+ break;
+ }
+ ++c;
+ }
+ list.length -= c;
+ return ret;
+}
+
+// Copies a specified amount of bytes from the list of buffered data chunks.
+// This function is designed to be inlinable, so please take care when making
+// changes to the function body.
+function copyFromBuffer(n, list) {
+ var ret = bufferShim.allocUnsafe(n);
+ var p = list.head;
+ var c = 1;
+ p.data.copy(ret);
+ n -= p.data.length;
+ while (p = p.next) {
+ var buf = p.data;
+ var nb = n > buf.length ? buf.length : n;
+ buf.copy(ret, ret.length - n, 0, nb);
+ n -= nb;
+ if (n === 0) {
+ if (nb === buf.length) {
+ ++c;
+ if (p.next) list.head = p.next;else list.head = list.tail = null;
+ } else {
+ list.head = p;
+ p.data = buf.slice(nb);
+ }
+ break;
+ }
+ ++c;
+ }
+ list.length -= c;
+ return ret;
+}
+
function endReadable(stream) {
var state = stream._readableState;
// 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.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');
- }
- });
+ processNextTick(endReadableNT, state, stream);
}
}
-function forEach (xs, f) {
+function endReadableNT(state, stream) {
+ // 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) {
+function indexOf(xs, x) {
for (var i = 0, l = xs.length; i < l; i++) {
if (xs[i] === x) return i;
}
return -1;
-}
+}
\ No newline at end of file
diff --git a/node_modules/readable-stream/lib/_stream_transform.js b/node_modules/readable-stream/lib/_stream_transform.js
index 905c5e4..cd25832 100644
--- a/node_modules/readable-stream/lib/_stream_transform.js
+++ b/node_modules/readable-stream/lib/_stream_transform.js
@@ -1,25 +1,3 @@
-// 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
@@ -62,6 +40,8 @@
// would be consumed, and then the rest would wait (un-transformed) until
// the results of the previous transformed chunk were consumed.
+'use strict';
+
module.exports = Transform;
var Duplex = require('./_stream_duplex');
@@ -73,9 +53,8 @@ util.inherits = require('inherits');
util.inherits(Transform, Duplex);
-
-function TransformState(options, stream) {
- this.afterTransform = function(er, data) {
+function TransformState(stream) {
+ this.afterTransform = function (er, data) {
return afterTransform(stream, er, data);
};
@@ -83,6 +62,7 @@ function TransformState(options, stream) {
this.transforming = false;
this.writecb = null;
this.writechunk = null;
+ this.writeencoding = null;
}
function afterTransform(stream, er, data) {
@@ -91,17 +71,14 @@ function afterTransform(stream, er, data) {
var cb = ts.writecb;
- if (!cb)
- return stream.emit('error', new Error('no writecb in Transform class'));
+ 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 (data !== null && data !== undefined) stream.push(data);
- if (cb)
- cb(er);
+ cb(er);
var rs = stream._readableState;
rs.reading = false;
@@ -110,16 +87,13 @@ function afterTransform(stream, er, data) {
}
}
-
function Transform(options) {
- if (!(this instanceof Transform))
- return new Transform(options);
+ if (!(this instanceof Transform)) return new Transform(options);
Duplex.call(this, options);
- this._transformState = new TransformState(options, this);
+ this._transformState = new TransformState(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.
@@ -130,17 +104,21 @@ function Transform(options) {
// 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);
+ if (options) {
+ if (typeof options.transform === 'function') this._transform = options.transform;
+
+ if (typeof options.flush === 'function') this._flush = options.flush;
+ }
+
+ // When the writable side finishes, then flush out anything remaining.
+ this.once('prefinish', function () {
+ if (typeof this._flush === 'function') this._flush(function (er, data) {
+ done(stream, er, data);
+ });else done(stream);
});
}
-Transform.prototype.push = function(chunk, encoding) {
+Transform.prototype.push = function (chunk, encoding) {
this._transformState.needTransform = false;
return Duplex.prototype.push.call(this, chunk, encoding);
};
@@ -155,31 +133,28 @@ Transform.prototype.push = function(chunk, encoding) {
// Call `cb(err)` when you are done with this chunk. If you pass
// an error, then that'll put the hurt on the whole operation. If you
// never call cb(), then you'll never get another chunk.
-Transform.prototype._transform = function(chunk, encoding, cb) {
- throw new Error('not implemented');
+Transform.prototype._transform = function (chunk, encoding, cb) {
+ throw new Error('_transform() is not implemented');
};
-Transform.prototype._write = function(chunk, encoding, cb) {
+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);
+ 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) {
+Transform.prototype._read = function (n) {
var ts = this._transformState;
- if (!util.isNull(ts.writechunk) && ts.writecb && !ts.transforming) {
+ if (ts.writechunk !== null && ts.writecb && !ts.transforming) {
ts.transforming = true;
this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
} else {
@@ -189,21 +164,19 @@ Transform.prototype._read = function(n) {
}
};
+function done(stream, er, data) {
+ if (er) return stream.emit('error', er);
-function done(stream, er) {
- if (er)
- return stream.emit('error', er);
+ if (data !== null && data !== undefined) stream.push(data);
// 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 (ws.length) throw new Error('Calling transform done when ws.length != 0');
- if (ts.transforming)
- throw new Error('calling transform done when still transforming');
+ if (ts.transforming) throw new Error('Calling transform done when still transforming');
return stream.push(null);
-}
+}
\ No newline at end of file
diff --git a/node_modules/readable-stream/lib/_stream_writable.js b/node_modules/readable-stream/lib/_stream_writable.js
index db8539c..575beb3 100644
--- a/node_modules/readable-stream/lib/_stream_writable.js
+++ b/node_modules/readable-stream/lib/_stream_writable.js
@@ -1,74 +1,85 @@
-// 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
+// Implement an async ._write(chunk, encoding, cb), and it'll handle all
// the drain event emission and buffering.
+'use strict';
+
module.exports = Writable;
/**/
-var Buffer = require('buffer').Buffer;
+var processNextTick = require('process-nextick-args');
+/**/
+
+/**/
+var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : processNextTick;
+/**/
+
+/**/
+var Duplex;
/**/
Writable.WritableState = WritableState;
-
/**/
var util = require('core-util-is');
util.inherits = require('inherits');
/**/
-var Stream = require('stream');
+/**/
+var internalUtil = {
+ deprecate: require('util-deprecate')
+};
+/**/
+
+/**/
+var Stream;
+(function () {
+ try {
+ Stream = require('st' + 'ream');
+ } catch (_) {} finally {
+ if (!Stream) Stream = require('events').EventEmitter;
+ }
+})();
+/**/
+
+var Buffer = require('buffer').Buffer;
+/**/
+var bufferShim = require('buffer-shims');
+/**/
util.inherits(Writable, Stream);
+function nop() {}
+
function WriteReq(chunk, encoding, cb) {
this.chunk = chunk;
this.encoding = encoding;
this.callback = cb;
+ this.next = null;
}
function WritableState(options, stream) {
- var Duplex = require('./_stream_duplex');
+ Duplex = 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;
+ if (stream instanceof Duplex) this.objectMode = this.objectMode || !!options.writableObjectMode;
+
+ // the point at which write() starts returning false
+ // Note: 0 is a valid value, means that we always return false if
+ // the entire buffer is not flushed immediately on write()
+ var hwm = options.highWaterMark;
+ var defaultHwm = this.objectMode ? 16 : 16 * 1024;
+ this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm;
// cast to ints.
this.highWaterMark = ~~this.highWaterMark;
+ // drain event flag.
this.needDrain = false;
// at the start of calling end()
this.ending = false;
@@ -111,7 +122,7 @@ function WritableState(options, stream) {
this.bufferProcessing = false;
// the callback that's passed to _write(chunk,cb)
- this.onwrite = function(er) {
+ this.onwrite = function (er) {
onwrite(stream, er);
};
@@ -121,7 +132,8 @@ function WritableState(options, stream) {
// the amount that is being written when _write is called.
this.writelen = 0;
- this.buffer = [];
+ this.bufferedRequest = null;
+ this.lastBufferedRequest = null;
// number of pending user-supplied write callbacks
// this must be 0 before 'finish' can be emitted
@@ -133,113 +145,162 @@ function WritableState(options, stream) {
// True if the error was already emitted and should not be thrown again
this.errorEmitted = false;
+
+ // count buffered requests
+ this.bufferedRequestCount = 0;
+
+ // allocate the first CorkedRequest, there is always
+ // one allocated and free to use, and we maintain at most two
+ this.corkedRequestsFree = new CorkedRequest(this);
+}
+
+WritableState.prototype.getBuffer = function getBuffer() {
+ var current = this.bufferedRequest;
+ var out = [];
+ while (current) {
+ out.push(current);
+ current = current.next;
+ }
+ return out;
+};
+
+(function () {
+ try {
+ Object.defineProperty(WritableState.prototype, 'buffer', {
+ get: internalUtil.deprecate(function () {
+ return this.getBuffer();
+ }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.')
+ });
+ } catch (_) {}
+})();
+
+// Test _writableState for inheritance to account for Duplex streams,
+// whose prototype chain only points to Readable.
+var realHasInstance;
+if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {
+ realHasInstance = Function.prototype[Symbol.hasInstance];
+ Object.defineProperty(Writable, Symbol.hasInstance, {
+ value: function (object) {
+ if (realHasInstance.call(this, object)) return true;
+
+ return object && object._writableState instanceof WritableState;
+ }
+ });
+} else {
+ realHasInstance = function (object) {
+ return object instanceof this;
+ };
}
function Writable(options) {
- var Duplex = require('./_stream_duplex');
+ Duplex = 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))
+ // Writable ctor is applied to Duplexes, too.
+ // `realHasInstance` is necessary because using plain `instanceof`
+ // would return false, as no `_writableState` property is attached.
+
+ // Trying to use the custom `instanceof` for Writable here will also break the
+ // Node.js LazyTransform implementation, which has a non-trivial getter for
+ // `_writableState` that would lead to infinite recursion.
+ if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) {
return new Writable(options);
+ }
this._writableState = new WritableState(options, this);
// legacy.
this.writable = true;
+ if (options) {
+ if (typeof options.write === 'function') this._write = options.write;
+
+ if (typeof options.writev === 'function') this._writev = options.writev;
+ }
+
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.'));
+Writable.prototype.pipe = function () {
+ this.emit('error', new Error('Cannot pipe, not readable'));
};
-
-function writeAfterEnd(stream, state, cb) {
+function writeAfterEnd(stream, 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);
- });
+ processNextTick(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.
+// Checks that a user-supplied chunk is valid, especially for the particular
+// mode the stream is in. Currently this means that `null` is never accepted
+// and undefined/non-string values are only allowed in object mode.
function validChunk(stream, state, chunk, cb) {
var valid = true;
- if (!util.isBuffer(chunk) &&
- !util.isString(chunk) &&
- !util.isNullOrUndefined(chunk) &&
- !state.objectMode) {
- var er = new TypeError('Invalid non-string/buffer chunk');
+ var er = false;
+
+ if (chunk === null) {
+ er = new TypeError('May not write null values to stream');
+ } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
+ er = new TypeError('Invalid non-string/buffer chunk');
+ }
+ if (er) {
stream.emit('error', er);
- process.nextTick(function() {
- cb(er);
- });
+ processNextTick(cb, er);
valid = false;
}
return valid;
}
-Writable.prototype.write = function(chunk, encoding, cb) {
+Writable.prototype.write = function (chunk, encoding, cb) {
var state = this._writableState;
var ret = false;
+ var isBuf = Buffer.isBuffer(chunk);
- if (util.isFunction(encoding)) {
+ if (typeof encoding === 'function') {
cb = encoding;
encoding = null;
}
- if (util.isBuffer(chunk))
- encoding = 'buffer';
- else if (!encoding)
- encoding = state.defaultEncoding;
+ if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;
- if (!util.isFunction(cb))
- cb = function() {};
+ if (typeof cb !== 'function') cb = nop;
- if (state.ended)
- writeAfterEnd(this, state, cb);
- else if (validChunk(this, state, chunk, cb)) {
+ if (state.ended) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {
state.pendingcb++;
- ret = writeOrBuffer(this, state, chunk, encoding, cb);
+ ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);
}
return ret;
};
-Writable.prototype.cork = function() {
+Writable.prototype.cork = function () {
var state = this._writableState;
state.corked++;
};
-Writable.prototype.uncork = function() {
+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);
+ if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
}
};
+Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
+ // node::ParseEncoding() requires lower case.
+ if (typeof encoding === 'string') encoding = encoding.toLowerCase();
+ if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding);
+ this._writableState.defaultEncoding = encoding;
+ return this;
+};
+
function decodeChunk(state, chunk, encoding) {
- if (!state.objectMode &&
- state.decodeStrings !== false &&
- util.isString(chunk)) {
- chunk = new Buffer(chunk, encoding);
+ if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {
+ chunk = bufferShim.from(chunk, encoding);
}
return chunk;
}
@@ -247,23 +308,31 @@ function decodeChunk(state, chunk, encoding) {
// 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';
+function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {
+ if (!isBuf) {
+ chunk = decodeChunk(state, chunk, encoding);
+ if (Buffer.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 (!ret) state.needDrain = true;
- if (state.writing || state.corked)
- state.buffer.push(new WriteReq(chunk, encoding, cb));
- else
+ if (state.writing || state.corked) {
+ var last = state.lastBufferedRequest;
+ state.lastBufferedRequest = new WriteReq(chunk, encoding, cb);
+ if (last) {
+ last.next = state.lastBufferedRequest;
+ } else {
+ state.bufferedRequest = state.lastBufferedRequest;
+ }
+ state.bufferedRequestCount += 1;
+ } else {
doWrite(stream, state, false, len, chunk, encoding, cb);
+ }
return ret;
}
@@ -273,23 +342,13 @@ function doWrite(stream, state, writev, len, chunk, encoding, cb) {
state.writecb = cb;
state.writing = true;
state.sync = true;
- if (writev)
- stream._writev(chunk, state.onwrite);
- else
- stream._write(chunk, encoding, state.onwrite);
+ if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);
state.sync = false;
}
function onwriteError(stream, state, sync, er, cb) {
- if (sync)
- process.nextTick(function() {
- state.pendingcb--;
- cb(er);
- });
- else {
- state.pendingcb--;
- cb(er);
- }
+ --state.pendingcb;
+ if (sync) processNextTick(cb, er);else cb(er);
stream._writableState.errorEmitted = true;
stream.emit('error', er);
@@ -309,23 +368,18 @@ function onwrite(stream, er) {
onwriteStateUpdate(state);
- if (er)
- onwriteError(stream, state, sync, er, cb);
- else {
+ 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);
+ var finished = needFinish(state);
- if (!finished &&
- !state.corked &&
- !state.bufferProcessing &&
- state.buffer.length) {
+ if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
clearBuffer(stream, state);
}
if (sync) {
- process.nextTick(function() {
- afterWrite(stream, state, finished, cb);
- });
+ /**/
+ asyncWrite(afterWrite, stream, state, finished, cb);
+ /**/
} else {
afterWrite(stream, state, finished, cb);
}
@@ -333,8 +387,7 @@ function onwrite(stream, er) {
}
function afterWrite(stream, state, finished, cb) {
- if (!finished)
- onwriteDrain(stream, state);
+ if (!finished) onwriteDrain(stream, state);
state.pendingcb--;
cb();
finishMaybe(stream, state);
@@ -350,80 +403,83 @@ function onwriteDrain(stream, state) {
}
}
-
// if there's something in the buffer waiting, then process it
function clearBuffer(stream, state) {
state.bufferProcessing = true;
+ var entry = state.bufferedRequest;
- if (stream._writev && state.buffer.length > 1) {
+ if (stream._writev && entry && entry.next) {
// Fast case, write everything using _writev()
- var cbs = [];
- for (var c = 0; c < state.buffer.length; c++)
- cbs.push(state.buffer[c].callback);
+ var l = state.bufferedRequestCount;
+ var buffer = new Array(l);
+ var holder = state.corkedRequestsFree;
+ holder.entry = entry;
- // count the one we are adding, as well.
- // TODO(isaacs) clean this up
+ var count = 0;
+ while (entry) {
+ buffer[count] = entry;
+ entry = entry.next;
+ count += 1;
+ }
+
+ doWrite(stream, state, true, state.length, buffer, '', holder.finish);
+
+ // doWrite is almost always async, defer these to save a bit of time
+ // as the hot path ends with doWrite
state.pendingcb++;
- 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 = [];
+ state.lastBufferedRequest = null;
+ if (holder.next) {
+ state.corkedRequestsFree = holder.next;
+ holder.next = null;
+ } else {
+ state.corkedRequestsFree = new CorkedRequest(state);
+ }
} else {
// Slow case, write chunks one-by-one
- for (var c = 0; c < state.buffer.length; c++) {
- var entry = state.buffer[c];
+ while (entry) {
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);
-
+ entry = entry.next;
// 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;
+ if (entry === null) state.lastBufferedRequest = null;
}
+ state.bufferedRequestCount = 0;
+ state.bufferedRequest = entry;
state.bufferProcessing = false;
}
-Writable.prototype._write = function(chunk, encoding, cb) {
- cb(new Error('not implemented'));
-
+Writable.prototype._write = function (chunk, encoding, cb) {
+ cb(new Error('_write() is not implemented'));
};
Writable.prototype._writev = null;
-Writable.prototype.end = function(chunk, encoding, cb) {
+Writable.prototype.end = function (chunk, encoding, cb) {
var state = this._writableState;
- if (util.isFunction(chunk)) {
+ if (typeof chunk === 'function') {
cb = chunk;
chunk = null;
encoding = null;
- } else if (util.isFunction(encoding)) {
+ } else if (typeof encoding === 'function') {
cb = encoding;
encoding = null;
}
- if (!util.isNullOrUndefined(chunk))
- this.write(chunk, encoding);
+ if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);
// .end() fully uncorks
if (state.corked) {
@@ -432,16 +488,11 @@ Writable.prototype.end = function(chunk, encoding, cb) {
}
// ignore unnecessary end() calls.
- if (!state.ending && !state.finished)
- endWritable(this, state, cb);
+ if (!state.ending && !state.finished) endWritable(this, state, cb);
};
-
-function needFinish(stream, state) {
- return (state.ending &&
- state.length === 0 &&
- !state.finished &&
- !state.writing);
+function needFinish(state) {
+ return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
}
function prefinish(stream, state) {
@@ -452,14 +503,15 @@ function prefinish(stream, state) {
}
function finishMaybe(stream, state) {
- var need = needFinish(stream, state);
+ var need = needFinish(state);
if (need) {
if (state.pendingcb === 0) {
prefinish(stream, state);
state.finished = true;
stream.emit('finish');
- } else
+ } else {
prefinish(stream, state);
+ }
}
return need;
}
@@ -468,10 +520,32 @@ function endWritable(stream, state, cb) {
state.ending = true;
finishMaybe(stream, state);
if (cb) {
- if (state.finished)
- process.nextTick(cb);
- else
- stream.once('finish', cb);
+ if (state.finished) processNextTick(cb);else stream.once('finish', cb);
}
state.ended = true;
+ stream.writable = false;
}
+
+// It seems a linked list but it is not
+// there will be only 2 of these for each stream
+function CorkedRequest(state) {
+ var _this = this;
+
+ this.next = null;
+ this.entry = null;
+ this.finish = function (err) {
+ var entry = _this.entry;
+ _this.entry = null;
+ while (entry) {
+ var cb = entry.callback;
+ state.pendingcb--;
+ cb(err);
+ entry = entry.next;
+ }
+ if (state.corkedRequestsFree) {
+ state.corkedRequestsFree.next = _this;
+ } else {
+ state.corkedRequestsFree = _this;
+ }
+ };
+}
\ No newline at end of file
diff --git a/node_modules/bl/node_modules/readable-stream/lib/internal/streams/BufferList.js b/node_modules/readable-stream/lib/internal/streams/BufferList.js
similarity index 100%
rename from node_modules/bl/node_modules/readable-stream/lib/internal/streams/BufferList.js
rename to node_modules/readable-stream/lib/internal/streams/BufferList.js
diff --git a/node_modules/readable-stream/package.json b/node_modules/readable-stream/package.json
index 77f1d99..c3b89ed 100644
--- a/node_modules/readable-stream/package.json
+++ b/node_modules/readable-stream/package.json
@@ -2,78 +2,85 @@
"_args": [
[
{
- "raw": "readable-stream@^1.1.7",
+ "raw": "readable-stream@^2.0.0 || ^1.1.13",
"scope": null,
"escapedName": "readable-stream",
"name": "readable-stream",
- "rawSpec": "^1.1.7",
- "spec": ">=1.1.7 <2.0.0",
+ "rawSpec": "^2.0.0 || ^1.1.13",
+ "spec": ">=2.0.0 <3.0.0||>=1.1.13 <2.0.0",
"type": "range"
},
- "/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/streamroller"
+ "/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/are-we-there-yet"
]
],
- "_from": "readable-stream@>=1.1.7 <2.0.0",
- "_id": "readable-stream@1.1.14",
+ "_cnpm_publish_time": 1489651347637,
+ "_from": "readable-stream@>=2.0.0 <3.0.0||>=1.1.13 <2.0.0",
+ "_id": "readable-stream@2.2.6",
"_inCache": true,
"_installable": true,
"_location": "/readable-stream",
- "_nodeVersion": "5.10.1",
+ "_nodeVersion": "6.9.4",
"_npmOperationalInternal": {
- "host": "packages-16-east.internal.npmjs.com",
- "tmp": "tmp/readable-stream-1.1.14.tgz_1460563293219_0.5682175166439265"
+ "host": "packages-12-west.internal.npmjs.com",
+ "tmp": "tmp/readable-stream-2.2.6.tgz_1489651345676_0.6984770004637539"
},
"_npmUser": {
- "name": "cwmma",
- "email": "calvin.metcalf@gmail.com"
+ "name": "matteo.collina",
+ "email": "hello@matteocollina.com"
},
- "_npmVersion": "3.8.3",
+ "_npmVersion": "3.10.10",
"_phantomChildren": {},
"_requested": {
- "raw": "readable-stream@^1.1.7",
+ "raw": "readable-stream@^2.0.0 || ^1.1.13",
"scope": null,
"escapedName": "readable-stream",
"name": "readable-stream",
- "rawSpec": "^1.1.7",
- "spec": ">=1.1.7 <2.0.0",
+ "rawSpec": "^2.0.0 || ^1.1.13",
+ "spec": ">=2.0.0 <3.0.0||>=1.1.13 <2.0.0",
"type": "range"
},
"_requiredBy": [
- "/streamroller"
+ "/are-we-there-yet",
+ "/bl",
+ "/tar-stream"
],
- "_resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz",
- "_shasum": "7cf4c54ef648e3813084c636dd2079e166c081d9",
+ "_resolved": "https://registry.npm.taobao.org/readable-stream/download/readable-stream-2.2.6.tgz",
+ "_shasum": "8b43aed76e71483938d12a8d46c6cf1a00b1f816",
"_shrinkwrap": null,
- "_spec": "readable-stream@^1.1.7",
- "_where": "/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/streamroller",
- "author": {
- "name": "Isaac Z. Schlueter",
- "email": "i@izs.me",
- "url": "http://blog.izs.me/"
- },
+ "_spec": "readable-stream@^2.0.0 || ^1.1.13",
+ "_where": "/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/are-we-there-yet",
"browser": {
"util": false
},
"bugs": {
- "url": "https://github.com/isaacs/readable-stream/issues"
+ "url": "https://github.com/nodejs/readable-stream/issues"
},
"dependencies": {
+ "buffer-shims": "^1.0.0",
"core-util-is": "~1.0.0",
"inherits": "~2.0.1",
- "isarray": "0.0.1",
- "string_decoder": "~0.10.x"
+ "isarray": "~1.0.0",
+ "process-nextick-args": "~1.0.6",
+ "string_decoder": "~0.10.x",
+ "util-deprecate": "~1.0.1"
},
- "description": "Streams3, a user-land copy of the stream library from Node.js v0.11.x",
+ "description": "Streams3, a user-land copy of the stream library from Node.js",
"devDependencies": {
- "tap": "~0.2.6"
+ "assert": "~1.4.0",
+ "babel-polyfill": "^6.9.1",
+ "buffer": "^4.9.0",
+ "nyc": "^6.4.0",
+ "tap": "~0.7.1",
+ "tape": "~4.5.1",
+ "zuul": "~3.10.0"
},
"directories": {},
"dist": {
- "shasum": "7cf4c54ef648e3813084c636dd2079e166c081d9",
- "tarball": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz"
+ "shasum": "8b43aed76e71483938d12a8d46c6cf1a00b1f816",
+ "tarball": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.2.6.tgz"
},
- "gitHead": "52550840cb1d6e8a98ef9a909a4bea360bc6f7da",
- "homepage": "https://github.com/isaacs/readable-stream#readme",
+ "gitHead": "f94eebc1c5b637e6575735e6923ec79ee3139284",
+ "homepage": "https://github.com/nodejs/readable-stream#readme",
"keywords": [
"readable",
"stream",
@@ -83,31 +90,48 @@
"main": "readable.js",
"maintainers": [
{
- "name": "isaacs",
- "email": "isaacs@npmjs.com"
+ "name": "cwmma",
+ "email": "calvin.metcalf@gmail.com"
},
{
- "name": "tootallnate",
- "email": "nathan@tootallnate.net"
+ "name": "isaacs",
+ "email": "i@izs.me"
+ },
+ {
+ "name": "matteo.collina",
+ "email": "hello@matteocollina.com"
},
{
"name": "rvagg",
"email": "rod@vagg.org"
},
{
- "name": "cwmma",
- "email": "calvin.metcalf@gmail.com"
+ "name": "tootallnate",
+ "email": "nathan@tootallnate.net"
}
],
"name": "readable-stream",
+ "nyc": {
+ "include": [
+ "lib/**.js"
+ ]
+ },
"optionalDependencies": {},
+ "react-native": {
+ "stream": false
+ },
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
- "url": "git://github.com/isaacs/readable-stream.git"
+ "url": "git://github.com/nodejs/readable-stream.git"
},
"scripts": {
- "test": "tap test/simple/*.js"
+ "browser": "npm run write-zuul && zuul --browser-retries 2 -- test/browser.js",
+ "cover": "nyc npm test",
+ "local": "zuul --local 3000 --no-coverage -- test/browser.js",
+ "report": "nyc report --reporter=lcov",
+ "test": "tap test/parallel/*.js test/ours/*.js",
+ "write-zuul": "printf \"ui: tape\nbrowsers:\n - name: $BROWSER_NAME\n version: $BROWSER_VERSION\n\">.zuul.yml"
},
- "version": "1.1.14"
+ "version": "2.2.6"
}
diff --git a/node_modules/readable-stream/readable.js b/node_modules/readable-stream/readable.js
index 2a8b5c6..be2688a 100644
--- a/node_modules/readable-stream/readable.js
+++ b/node_modules/readable-stream/readable.js
@@ -1,10 +1,16 @@
+var Stream = (function (){
+ try {
+ return require('st' + 'ream'); // hack to fix a circular dependency issue when used with browserify
+ } catch(_){}
+}());
exports = module.exports = require('./lib/_stream_readable.js');
-exports.Stream = require('stream');
+exports.Stream = Stream || exports;
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');
+
+if (!process.browser && process.env.READABLE_STREAM === 'disable' && Stream) {
+ module.exports = Stream;
}
diff --git a/node_modules/shadowsocks/package.json b/node_modules/shadowsocks/package.json
index 2bfd02e..99a760b 100644
--- a/node_modules/shadowsocks/package.json
+++ b/node_modules/shadowsocks/package.json
@@ -34,7 +34,8 @@
"type": "tag"
},
"_requiredBy": [
- "#USER"
+ "#USER",
+ "/"
],
"_resolved": "http://registry.npmjs.org/shadowsocks/-/shadowsocks-1.5.3.tgz",
"_shasum": "9a45614ad4395486c1d4a31443c5c65ad379a1ef",
diff --git a/node_modules/bl/node_modules/isarray/README.md b/node_modules/streamroller/node_modules/isarray/README.md
similarity index 82%
rename from node_modules/bl/node_modules/isarray/README.md
rename to node_modules/streamroller/node_modules/isarray/README.md
index 16d2c59..052a62b 100644
--- a/node_modules/bl/node_modules/isarray/README.md
+++ b/node_modules/streamroller/node_modules/isarray/README.md
@@ -3,12 +3,6 @@
`Array#isArray` for older browsers.
-[](http://travis-ci.org/juliangruber/isarray)
-[](https://www.npmjs.org/package/isarray)
-
-[
-](https://ci.testling.com/juliangruber/isarray)
-
## Usage
```js
diff --git a/node_modules/isarray/build/build.js b/node_modules/streamroller/node_modules/isarray/build/build.js
similarity index 100%
rename from node_modules/isarray/build/build.js
rename to node_modules/streamroller/node_modules/isarray/build/build.js
diff --git a/node_modules/bl/node_modules/isarray/component.json b/node_modules/streamroller/node_modules/isarray/component.json
similarity index 100%
rename from node_modules/bl/node_modules/isarray/component.json
rename to node_modules/streamroller/node_modules/isarray/component.json
diff --git a/node_modules/streamroller/node_modules/isarray/index.js b/node_modules/streamroller/node_modules/isarray/index.js
new file mode 100644
index 0000000..5f5ad45
--- /dev/null
+++ b/node_modules/streamroller/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/node_modules/bl/node_modules/isarray/package.json b/node_modules/streamroller/node_modules/isarray/package.json
similarity index 51%
rename from node_modules/bl/node_modules/isarray/package.json
rename to node_modules/streamroller/node_modules/isarray/package.json
index 2360c32..f4c7ce0 100644
--- a/node_modules/bl/node_modules/isarray/package.json
+++ b/node_modules/streamroller/node_modules/isarray/package.json
@@ -2,46 +2,45 @@
"_args": [
[
{
- "raw": "isarray@~1.0.0",
+ "raw": "isarray@0.0.1",
"scope": null,
"escapedName": "isarray",
"name": "isarray",
- "rawSpec": "~1.0.0",
- "spec": ">=1.0.0 <1.1.0",
- "type": "range"
+ "rawSpec": "0.0.1",
+ "spec": "0.0.1",
+ "type": "version"
},
- "/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/bl/node_modules/readable-stream"
+ "/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/streamroller/node_modules/readable-stream"
]
],
- "_from": "isarray@>=1.0.0 <1.1.0",
- "_id": "isarray@1.0.0",
+ "_from": "isarray@0.0.1",
+ "_id": "isarray@0.0.1",
"_inCache": true,
"_installable": true,
- "_location": "/bl/isarray",
- "_nodeVersion": "5.1.0",
+ "_location": "/streamroller/isarray",
"_npmUser": {
"name": "juliangruber",
"email": "julian@juliangruber.com"
},
- "_npmVersion": "3.3.12",
+ "_npmVersion": "1.2.18",
"_phantomChildren": {},
"_requested": {
- "raw": "isarray@~1.0.0",
+ "raw": "isarray@0.0.1",
"scope": null,
"escapedName": "isarray",
"name": "isarray",
- "rawSpec": "~1.0.0",
- "spec": ">=1.0.0 <1.1.0",
- "type": "range"
+ "rawSpec": "0.0.1",
+ "spec": "0.0.1",
+ "type": "version"
},
"_requiredBy": [
- "/bl/readable-stream"
+ "/streamroller/readable-stream"
],
- "_resolved": "http://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
- "_shasum": "bb935d48582cba168c06834957a54a3e07124f11",
+ "_resolved": "http://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
+ "_shasum": "8a18acfca9a8f4177e09abfc6038939b05d1eedf",
"_shrinkwrap": null,
- "_spec": "isarray@~1.0.0",
- "_where": "/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/bl/node_modules/readable-stream",
+ "_spec": "isarray@0.0.1",
+ "_where": "/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/streamroller/node_modules/readable-stream",
"author": {
"name": "Julian Gruber",
"email": "mail@juliangruber.com",
@@ -53,14 +52,13 @@
"dependencies": {},
"description": "Array#isArray for older browsers",
"devDependencies": {
- "tape": "~2.13.4"
+ "tap": "*"
},
"directories": {},
"dist": {
- "shasum": "bb935d48582cba168c06834957a54a3e07124f11",
- "tarball": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz"
+ "shasum": "8a18acfca9a8f4177e09abfc6038939b05d1eedf",
+ "tarball": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz"
},
- "gitHead": "2a23a281f369e9ae06394c0fb4d2381355a6ba33",
"homepage": "https://github.com/juliangruber/isarray",
"keywords": [
"browser",
@@ -83,23 +81,7 @@
"url": "git://github.com/juliangruber/isarray.git"
},
"scripts": {
- "test": "tape test.js"
+ "test": "tap test/*.js"
},
- "testling": {
- "files": "test.js",
- "browsers": [
- "ie/8..latest",
- "firefox/17..latest",
- "firefox/nightly",
- "chrome/22..latest",
- "chrome/canary",
- "opera/12..latest",
- "opera/next",
- "safari/5.1..latest",
- "ipad/6.0..latest",
- "iphone/6.0..latest",
- "android-browser/4.2..latest"
- ]
- },
- "version": "1.0.0"
+ "version": "0.0.1"
}
diff --git a/node_modules/streamroller/node_modules/readable-stream/.npmignore b/node_modules/streamroller/node_modules/readable-stream/.npmignore
new file mode 100644
index 0000000..38344f8
--- /dev/null
+++ b/node_modules/streamroller/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/node_modules/streamroller/node_modules/readable-stream/LICENSE b/node_modules/streamroller/node_modules/readable-stream/LICENSE
new file mode 100644
index 0000000..e3d4e69
--- /dev/null
+++ b/node_modules/streamroller/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/node_modules/streamroller/node_modules/readable-stream/README.md b/node_modules/streamroller/node_modules/readable-stream/README.md
new file mode 100644
index 0000000..e46b823
--- /dev/null
+++ b/node_modules/streamroller/node_modules/readable-stream/README.md
@@ -0,0 +1,15 @@
+# readable-stream
+
+***Node-core streams for userland***
+
+[](https://nodei.co/npm/readable-stream/)
+[](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/node_modules/bl/node_modules/readable-stream/duplex.js b/node_modules/streamroller/node_modules/readable-stream/duplex.js
similarity index 100%
rename from node_modules/bl/node_modules/readable-stream/duplex.js
rename to node_modules/streamroller/node_modules/readable-stream/duplex.js
diff --git a/node_modules/readable-stream/float.patch b/node_modules/streamroller/node_modules/readable-stream/float.patch
similarity index 100%
rename from node_modules/readable-stream/float.patch
rename to node_modules/streamroller/node_modules/readable-stream/float.patch
diff --git a/node_modules/streamroller/node_modules/readable-stream/lib/_stream_duplex.js b/node_modules/streamroller/node_modules/readable-stream/lib/_stream_duplex.js
new file mode 100644
index 0000000..b513d61
--- /dev/null
+++ b/node_modules/streamroller/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;
+
+/**/
+var objectKeys = Object.keys || function (obj) {
+ var keys = [];
+ for (var key in obj) keys.push(key);
+ return keys;
+}
+/**/
+
+
+/**/
+var util = require('core-util-is');
+util.inherits = require('inherits');
+/**/
+
+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/node_modules/streamroller/node_modules/readable-stream/lib/_stream_passthrough.js b/node_modules/streamroller/node_modules/readable-stream/lib/_stream_passthrough.js
new file mode 100644
index 0000000..895ca50
--- /dev/null
+++ b/node_modules/streamroller/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');
+
+/**/
+var util = require('core-util-is');
+util.inherits = require('inherits');
+/**/
+
+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/node_modules/bl/node_modules/readable-stream/lib/_stream_readable.js b/node_modules/streamroller/node_modules/readable-stream/lib/_stream_readable.js
similarity index 54%
rename from node_modules/bl/node_modules/readable-stream/lib/_stream_readable.js
rename to node_modules/streamroller/node_modules/readable-stream/lib/_stream_readable.js
index 13b5a74..19ab358 100644
--- a/node_modules/bl/node_modules/readable-stream/lib/_stream_readable.js
+++ b/node_modules/streamroller/node_modules/readable-stream/lib/_stream_readable.js
@@ -1,103 +1,82 @@
-'use strict';
+// 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;
-/**/
-var processNextTick = require('process-nextick-args');
-/**/
-
/**/
var isArray = require('isarray');
/**/
+
/**/
-var Duplex;
+var Buffer = require('buffer').Buffer;
/**/
Readable.ReadableState = ReadableState;
-/**/
var EE = require('events').EventEmitter;
-var EElistenerCount = function (emitter, type) {
+/**/
+if (!EE.listenerCount) EE.listenerCount = function(emitter, type) {
return emitter.listeners(type).length;
};
/**/
-/**/
-var Stream;
-(function () {
- try {
- Stream = require('st' + 'ream');
- } catch (_) {} finally {
- if (!Stream) Stream = require('events').EventEmitter;
- }
-})();
-/**/
-
-var Buffer = require('buffer').Buffer;
-/**/
-var bufferShim = require('buffer-shims');
-/**/
+var Stream = require('stream');
/**/
var util = require('core-util-is');
util.inherits = require('inherits');
/**/
+var StringDecoder;
+
+
/**/
-var debugUtil = require('util');
-var debug = void 0;
-if (debugUtil && debugUtil.debuglog) {
- debug = debugUtil.debuglog('stream');
+var debug = require('util');
+if (debug && debug.debuglog) {
+ debug = debug.debuglog('stream');
} else {
debug = function () {};
}
/**/
-var BufferList = require('./internal/streams/BufferList');
-var StringDecoder;
util.inherits(Readable, Stream);
-function prependListener(emitter, event, fn) {
- // Sadly this is not cacheable as some libraries bundle their own
- // event emitter implementation with them.
- if (typeof emitter.prependListener === 'function') {
- return emitter.prependListener(event, fn);
- } else {
- // This is a hack to make sure that our error handler is attached before any
- // userland ones. NEVER DO THIS. This is here only because this code needs
- // to continue to work with older versions of Node.js that do not include
- // the prependListener() method. The goal is to eventually remove this hack.
- if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]];
- }
-}
-
function ReadableState(options, stream) {
- Duplex = Duplex || require('./_stream_duplex');
+ var Duplex = require('./_stream_duplex');
options = options || {};
- // 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;
-
// 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 = this.objectMode ? 16 : 16 * 1024;
- this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm;
+ var defaultHwm = options.objectMode ? 16 : 16 * 1024;
+ this.highWaterMark = (hwm || hwm === 0) ? hwm : defaultHwm;
// cast to ints.
this.highWaterMark = ~~this.highWaterMark;
- // A linked list is used to store data chunks instead of an array because the
- // linked list can remove elements from the beginning faster than
- // array.shift()
- this.buffer = new BufferList();
+ this.buffer = [];
this.length = 0;
this.pipes = null;
this.pipesCount = 0;
@@ -117,7 +96,14 @@ function ReadableState(options, stream) {
this.needReadable = false;
this.emittedReadable = false;
this.readableListening = false;
- this.resumeScheduled = 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.
@@ -137,24 +123,24 @@ function ReadableState(options, stream) {
this.decoder = null;
this.encoding = null;
if (options.encoding) {
- if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;
+ if (!StringDecoder)
+ StringDecoder = require('string_decoder/').StringDecoder;
this.decoder = new StringDecoder(options.encoding);
this.encoding = options.encoding;
}
}
function Readable(options) {
- Duplex = Duplex || require('./_stream_duplex');
+ var Duplex = require('./_stream_duplex');
- if (!(this instanceof Readable)) return new Readable(options);
+ if (!(this instanceof Readable))
+ return new Readable(options);
this._readableState = new ReadableState(options, this);
// legacy
this.readable = true;
- if (options && typeof options.read === 'function') this._read = options.read;
-
Stream.call(this);
}
@@ -162,13 +148,13 @@ function Readable(options) {
// 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) {
+Readable.prototype.push = function(chunk, encoding) {
var state = this._readableState;
- if (!state.objectMode && typeof chunk === 'string') {
+ if (util.isString(chunk) && !state.objectMode) {
encoding = encoding || state.defaultEncoding;
if (encoding !== state.encoding) {
- chunk = bufferShim.from(chunk, encoding);
+ chunk = new Buffer(chunk, encoding);
encoding = '';
}
}
@@ -177,52 +163,47 @@ Readable.prototype.push = function (chunk, encoding) {
};
// Unshift should *always* be something directly out of read()
-Readable.prototype.unshift = function (chunk) {
+Readable.prototype.unshift = function(chunk) {
var state = this._readableState;
return readableAddChunk(this, state, chunk, '', true);
};
-Readable.prototype.isPaused = function () {
- return this._readableState.flowing === false;
-};
-
function readableAddChunk(stream, state, chunk, encoding, addToFront) {
var er = chunkInvalid(state, chunk);
if (er) {
stream.emit('error', er);
- } else if (chunk === null) {
+ } else if (util.isNullOrUndefined(chunk)) {
state.reading = false;
- onEofChunk(stream, state);
+ 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);
+ var e = new Error('stream.unshift() after end event');
+ stream.emit('error', e);
} else {
- var skipAdd;
- if (state.decoder && !addToFront && !encoding) {
+ if (state.decoder && !addToFront && !encoding)
chunk = state.decoder.write(chunk);
- skipAdd = !state.objectMode && chunk.length === 0;
- }
- if (!addToFront) state.reading = false;
+ if (!addToFront)
+ state.reading = false;
- // Don't add to the buffer if we've decoded to an empty string chunk and
- // we're not in object mode
- if (!skipAdd) {
- // 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 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);
- }
+ if (state.needReadable)
+ emitReadable(stream);
}
maybeReadMore(stream, state);
@@ -234,6 +215,8 @@ function readableAddChunk(stream, state, chunk, encoding, addToFront) {
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,
@@ -242,71 +225,92 @@ function readableAddChunk(stream, state, chunk, encoding, addToFront) {
// 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);
+ 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;
+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 > 8MB
+// Don't raise the hwm > 128MB
var MAX_HWM = 0x800000;
-function computeNewHighWaterMark(n) {
+function roundUpToNextPowerOf2(n) {
if (n >= MAX_HWM) {
n = MAX_HWM;
} else {
- // Get the next highest power of 2 to prevent increasing hwm excessively in
- // tiny amounts
+ // Get the next highest power of 2
n--;
- n |= n >>> 1;
- n |= n >>> 2;
- n |= n >>> 4;
- n |= n >>> 8;
- n |= n >>> 16;
+ for (var p = 1; p < 32; p <<= 1) n |= n >> p;
n++;
}
return n;
}
-// This function is designed to be inlinable, so please take care when making
-// changes to the function body.
function howMuchToRead(n, state) {
- if (n <= 0 || state.length === 0 && state.ended) return 0;
- if (state.objectMode) return 1;
- if (n !== n) {
- // Only flow one buffer at a time
- if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;
- }
- // If we're asking for more than the current hwm, then raise the hwm.
- if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);
- if (n <= state.length) return n;
- // Don't have enough
- if (!state.ended) {
- state.needReadable = true;
+ 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;
}
- 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) {
+Readable.prototype.read = function(n) {
debug('read', n);
- n = parseInt(n, 10);
var state = this._readableState;
var nOrig = n;
- if (n !== 0) state.emittedReadable = false;
+ if (!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)) {
+ 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);
+ if (state.length === 0 && state.ended)
+ endReadable(this);
+ else
+ emitReadable(this);
return null;
}
@@ -314,7 +318,8 @@ Readable.prototype.read = function (n) {
// if we've ended, and we're now clear, then finish it up.
if (n === 0 && state.ended) {
- if (state.length === 0) endReadable(this);
+ if (state.length === 0)
+ endReadable(this);
return null;
}
@@ -355,55 +360,67 @@ Readable.prototype.read = function (n) {
if (state.ended || state.reading) {
doRead = false;
debug('reading or ended', doRead);
- } else if (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;
+ 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 (!state.reading) n = howMuchToRead(nOrig, state);
}
+ // 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 (n > 0)
+ ret = fromList(n, state);
+ else
+ ret = null;
- if (ret === null) {
+ if (util.isNull(ret)) {
state.needReadable = true;
n = 0;
- } else {
- state.length -= n;
}
- if (state.length === 0) {
- // If we have nothing in the buffer, then we want to know
- // as soon as we *do* get something into the buffer.
- if (!state.ended) state.needReadable = true;
+ state.length -= n;
- // If we tried to read() past the EOF, then emit end on the next tick.
- if (nOrig !== n && state.ended) endReadable(this);
- }
+ // 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 (ret !== null) this.emit('data', ret);
+ // 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 (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== null && chunk !== undefined && !state.objectMode) {
+ 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.ended) return;
- if (state.decoder) {
+ if (state.decoder && !state.ended) {
var chunk = state.decoder.end();
if (chunk && chunk.length) {
state.buffer.push(chunk);
@@ -425,7 +442,12 @@ function emitReadable(stream) {
if (!state.emittedReadable) {
debug('emitReadable', state.flowing);
state.emittedReadable = true;
- if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream);
+ if (state.sync)
+ process.nextTick(function() {
+ emitReadable_(stream);
+ });
+ else
+ emitReadable_(stream);
}
}
@@ -435,6 +457,7 @@ function emitReadable_(stream) {
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
@@ -444,18 +467,23 @@ function emitReadable_(stream) {
function maybeReadMore(stream, state) {
if (!state.readingMore) {
state.readingMore = true;
- processNextTick(maybeReadMore_, stream, state);
+ 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) {
+ 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;
+ break;
+ else
+ len = state.length;
}
state.readingMore = false;
}
@@ -464,11 +492,11 @@ function maybeReadMore_(stream, state) {
// 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('_read() is not implemented'));
+Readable.prototype._read = function(n) {
+ this.emit('error', new Error('not implemented'));
};
-Readable.prototype.pipe = function (dest, pipeOpts) {
+Readable.prototype.pipe = function(dest, pipeOpts) {
var src = this;
var state = this._readableState;
@@ -486,10 +514,15 @@ Readable.prototype.pipe = function (dest, pipeOpts) {
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 doEnd = (!pipeOpts || pipeOpts.end !== false) &&
+ dest !== process.stdout &&
+ dest !== process.stderr;
var endFn = doEnd ? onend : cleanup;
- if (state.endEmitted) processNextTick(endFn);else src.once('end', endFn);
+ if (state.endEmitted)
+ process.nextTick(endFn);
+ else
+ src.once('end', endFn);
dest.on('unpipe', onunpipe);
function onunpipe(readable) {
@@ -511,7 +544,6 @@ Readable.prototype.pipe = function (dest, pipeOpts) {
var ondrain = pipeOnDrain(src);
dest.on('drain', ondrain);
- var cleanedUp = false;
function cleanup() {
debug('cleanup');
// cleanup event handlers once the pipe is broken
@@ -524,36 +556,24 @@ Readable.prototype.pipe = function (dest, pipeOpts) {
src.removeListener('end', cleanup);
src.removeListener('data', ondata);
- cleanedUp = true;
-
// if the reader is waiting for a drain event from this
// specific writer, then it would cause it to never start
// flowing again.
// So, if this is awaiting a drain, then we just call it now.
// If we don't know, then assume that we are waiting for one.
- if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
+ if (state.awaitDrain &&
+ (!dest._writableState || dest._writableState.needDrain))
+ ondrain();
}
- // If the user pushes more data while we're writing to dest then we'll end up
- // in ondata again. However, we only want to increase awaitDrain once because
- // dest will only emit one 'drain' event for the multiple writes.
- // => Introduce a guard on increasing awaitDrain.
- var increasedAwaitDrain = false;
src.on('data', ondata);
function ondata(chunk) {
debug('ondata');
- increasedAwaitDrain = false;
var ret = dest.write(chunk);
- if (false === ret && !increasedAwaitDrain) {
- // If the user unpiped during `dest.write()`, it is possible
- // to get stuck in a permanently paused state if that write
- // also returned false.
- // => Check whether `dest` is still a piping destination.
- if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
- debug('false write response, pause', src._readableState.awaitDrain);
- src._readableState.awaitDrain++;
- increasedAwaitDrain = true;
- }
+ if (false === ret) {
+ debug('false write response, pause',
+ src._readableState.awaitDrain);
+ src._readableState.awaitDrain++;
src.pause();
}
}
@@ -564,11 +584,19 @@ Readable.prototype.pipe = function (dest, pipeOpts) {
debug('onerror', er);
unpipe();
dest.removeListener('error', onerror);
- if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er);
+ 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];
+
- // Make sure our error handler is attached before userland ones.
- prependListener(dest, 'error', onerror);
// Both close and finish should trigger unpipe, but only once.
function onclose() {
@@ -601,35 +629,41 @@ Readable.prototype.pipe = function (dest, pipeOpts) {
};
function pipeOnDrain(src) {
- return function () {
+ return function() {
var state = src._readableState;
debug('pipeOnDrain', state.awaitDrain);
- if (state.awaitDrain) state.awaitDrain--;
- if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {
+ if (state.awaitDrain)
+ state.awaitDrain--;
+ if (state.awaitDrain === 0 && EE.listenerCount(src, 'data')) {
state.flowing = true;
flow(src);
}
};
}
-Readable.prototype.unpipe = function (dest) {
+
+Readable.prototype.unpipe = function(dest) {
var state = this._readableState;
// if we're not piping anywhere, then do nothing.
- if (state.pipesCount === 0) return this;
+ 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)
+ return this;
- if (!dest) dest = state.pipes;
+ if (!dest)
+ dest = state.pipes;
// got a match.
state.pipes = null;
state.pipesCount = 0;
state.flowing = false;
- if (dest) dest.emit('unpipe', this);
+ if (dest)
+ dest.emit('unpipe', this);
return this;
}
@@ -643,18 +677,20 @@ Readable.prototype.unpipe = function (dest) {
state.pipesCount = 0;
state.flowing = false;
- for (var i = 0; i < len; i++) {
+ for (var i = 0; i < len; i++)
dests[i].emit('unpipe', this);
- }return this;
+ return this;
}
// try to find the right one.
- var index = indexOf(state.pipes, dest);
- if (index === -1) return this;
+ var i = indexOf(state.pipes, dest);
+ if (i === -1)
+ return this;
- state.pipes.splice(index, 1);
+ state.pipes.splice(i, 1);
state.pipesCount -= 1;
- if (state.pipesCount === 1) state.pipes = state.pipes[0];
+ if (state.pipesCount === 1)
+ state.pipes = state.pipes[0];
dest.emit('unpipe', this);
@@ -663,19 +699,27 @@ Readable.prototype.unpipe = function (dest) {
// set up data events if they are asked for
// Ensure readable listeners eventually get something
-Readable.prototype.on = function (ev, fn) {
+Readable.prototype.on = function(ev, fn) {
var res = Stream.prototype.on.call(this, ev, fn);
- if (ev === 'data') {
- // Start flowing on next tick if stream isn't explicitly paused
- if (this._readableState.flowing !== false) this.resume();
- } else if (ev === 'readable') {
+ // 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.endEmitted && !state.readableListening) {
- state.readableListening = state.needReadable = true;
+ if (!state.readableListening) {
+ state.readableListening = true;
state.emittedReadable = false;
+ state.needReadable = true;
if (!state.reading) {
- processNextTick(nReadingNextTick, this);
+ var self = this;
+ process.nextTick(function() {
+ debug('readable nexttick read 0');
+ self.read(0);
+ });
} else if (state.length) {
emitReadable(this, state);
}
@@ -686,18 +730,17 @@ Readable.prototype.on = function (ev, fn) {
};
Readable.prototype.addListener = Readable.prototype.on;
-function nReadingNextTick(self) {
- debug('readable nexttick read 0');
- self.read(0);
-}
-
// pause() and resume() are remnants of the legacy readable stream API
// If the user uses them, then switch into old mode.
-Readable.prototype.resume = function () {
+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;
@@ -706,24 +749,21 @@ Readable.prototype.resume = function () {
function resume(stream, state) {
if (!state.resumeScheduled) {
state.resumeScheduled = true;
- processNextTick(resume_, stream, state);
+ process.nextTick(function() {
+ resume_(stream, state);
+ });
}
}
function resume_(stream, state) {
- if (!state.reading) {
- debug('resume read 0');
- stream.read(0);
- }
-
state.resumeScheduled = false;
- state.awaitDrain = 0;
stream.emit('resume');
flow(stream);
- if (state.flowing && !state.reading) stream.read(0);
+ if (state.flowing && !state.reading)
+ stream.read(0);
}
-Readable.prototype.pause = function () {
+Readable.prototype.pause = function() {
debug('call pause flowing=%j', this._readableState.flowing);
if (false !== this._readableState.flowing) {
debug('pause');
@@ -736,33 +776,38 @@ Readable.prototype.pause = function () {
function flow(stream) {
var state = stream._readableState;
debug('flow', state.flowing);
- while (state.flowing && stream.read() !== null) {}
+ 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) {
+Readable.prototype.wrap = function(stream) {
var state = this._readableState;
var paused = false;
var self = this;
- stream.on('end', function () {
+ stream.on('end', function() {
debug('wrapped end');
if (state.decoder && !state.ended) {
var chunk = state.decoder.end();
- if (chunk && chunk.length) self.push(chunk);
+ if (chunk && chunk.length)
+ self.push(chunk);
}
self.push(null);
});
- stream.on('data', function (chunk) {
+ stream.on('data', function(chunk) {
debug('wrapped data');
- if (state.decoder) chunk = state.decoder.write(chunk);
-
- // don't skip over falsy values in objectMode
- if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;
+ if (state.decoder)
+ chunk = state.decoder.write(chunk);
+ if (!chunk || !state.objectMode && !chunk.length)
+ return;
var ret = self.push(chunk);
if (!ret) {
@@ -774,24 +819,22 @@ Readable.prototype.wrap = function (stream) {
// proxy all the other methods.
// important when wrapping filters and duplexes.
for (var i in stream) {
- if (this[i] === undefined && typeof stream[i] === 'function') {
- this[i] = function (method) {
- return function () {
- return stream[method].apply(stream, arguments);
- };
- }(i);
+ 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) {
+ 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) {
+ self._read = function(n) {
debug('wrapped _read', n);
if (paused) {
paused = false;
@@ -802,106 +845,74 @@ Readable.prototype.wrap = function (stream) {
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.
-// This function is designed to be inlinable, so please take care when making
-// changes to the function body.
function fromList(n, state) {
- // nothing buffered
- if (state.length === 0) return null;
-
+ var list = state.buffer;
+ var length = state.length;
+ var stringMode = !!state.decoder;
+ var objectMode = !!state.objectMode;
var ret;
- if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {
- // read it all, truncate the list
- if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = state.buffer.concat(state.length);
- state.buffer.clear();
- } else {
- // read part of list
- ret = fromListPartial(n, state.buffer, state.decoder);
- }
- return ret;
-}
+ // nothing in the list, definitely empty.
+ if (list.length === 0)
+ return null;
-// Extracts only enough buffered data to satisfy the amount requested.
-// This function is designed to be inlinable, so please take care when making
-// changes to the function body.
-function fromListPartial(n, list, hasStrings) {
- var ret;
- if (n < list.head.data.length) {
- // slice is the same for buffers and strings
- ret = list.head.data.slice(0, n);
- list.head.data = list.head.data.slice(n);
- } else if (n === list.head.data.length) {
- // first chunk is a perfect match
+ 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 {
- // result spans more than one buffer
- ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);
- }
- return ret;
-}
+ // 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);
-// Copies a specified amount of characters from the list of buffered data
-// chunks.
-// This function is designed to be inlinable, so please take care when making
-// changes to the function body.
-function copyFromBufferString(n, list) {
- var p = list.head;
- var c = 1;
- var ret = p.data;
- n -= ret.length;
- while (p = p.next) {
- var str = p.data;
- var nb = n > str.length ? str.length : n;
- if (nb === str.length) ret += str;else ret += str.slice(0, n);
- n -= nb;
- if (n === 0) {
- if (nb === str.length) {
- ++c;
- if (p.next) list.head = p.next;else list.head = list.tail = null;
- } else {
- list.head = p;
- p.data = str.slice(nb);
- }
- break;
- }
- ++c;
- }
- list.length -= c;
- return ret;
-}
+ 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);
-// Copies a specified amount of bytes from the list of buffered data chunks.
-// This function is designed to be inlinable, so please take care when making
-// changes to the function body.
-function copyFromBuffer(n, list) {
- var ret = bufferShim.allocUnsafe(n);
- var p = list.head;
- var c = 1;
- p.data.copy(ret);
- n -= p.data.length;
- while (p = p.next) {
- var buf = p.data;
- var nb = n > buf.length ? buf.length : n;
- buf.copy(ret, ret.length - n, 0, nb);
- n -= nb;
- if (n === 0) {
- if (nb === buf.length) {
- ++c;
- if (p.next) list.head = p.next;else list.head = list.tail = null;
- } else {
- list.head = p;
- p.data = buf.slice(nb);
+ 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;
}
- break;
}
- ++c;
}
- list.length -= c;
+
return ret;
}
@@ -910,32 +921,31 @@ function endReadable(stream) {
// 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.length > 0)
+ throw new Error('endReadable called on non-empty stream');
if (!state.endEmitted) {
state.ended = true;
- processNextTick(endReadableNT, state, stream);
+ 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 endReadableNT(state, stream) {
- // 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) {
+function forEach (xs, f) {
for (var i = 0, l = xs.length; i < l; i++) {
f(xs[i], i);
}
}
-function indexOf(xs, x) {
+function indexOf (xs, x) {
for (var i = 0, l = xs.length; i < l; i++) {
if (xs[i] === x) return i;
}
return -1;
-}
\ No newline at end of file
+}
diff --git a/node_modules/bl/node_modules/readable-stream/lib/_stream_transform.js b/node_modules/streamroller/node_modules/readable-stream/lib/_stream_transform.js
similarity index 66%
rename from node_modules/bl/node_modules/readable-stream/lib/_stream_transform.js
rename to node_modules/streamroller/node_modules/readable-stream/lib/_stream_transform.js
index cd25832..905c5e4 100644
--- a/node_modules/bl/node_modules/readable-stream/lib/_stream_transform.js
+++ b/node_modules/streamroller/node_modules/readable-stream/lib/_stream_transform.js
@@ -1,3 +1,25 @@
+// 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
@@ -40,8 +62,6 @@
// would be consumed, and then the rest would wait (un-transformed) until
// the results of the previous transformed chunk were consumed.
-'use strict';
-
module.exports = Transform;
var Duplex = require('./_stream_duplex');
@@ -53,8 +73,9 @@ util.inherits = require('inherits');
util.inherits(Transform, Duplex);
-function TransformState(stream) {
- this.afterTransform = function (er, data) {
+
+function TransformState(options, stream) {
+ this.afterTransform = function(er, data) {
return afterTransform(stream, er, data);
};
@@ -62,7 +83,6 @@ function TransformState(stream) {
this.transforming = false;
this.writecb = null;
this.writechunk = null;
- this.writeencoding = null;
}
function afterTransform(stream, er, data) {
@@ -71,14 +91,17 @@ function afterTransform(stream, er, data) {
var cb = ts.writecb;
- if (!cb) return stream.emit('error', new Error('no writecb in Transform class'));
+ if (!cb)
+ return stream.emit('error', new Error('no writecb in Transform class'));
ts.writechunk = null;
ts.writecb = null;
- if (data !== null && data !== undefined) stream.push(data);
+ if (!util.isNullOrUndefined(data))
+ stream.push(data);
- cb(er);
+ if (cb)
+ cb(er);
var rs = stream._readableState;
rs.reading = false;
@@ -87,13 +110,16 @@ function afterTransform(stream, er, data) {
}
}
+
function Transform(options) {
- if (!(this instanceof Transform)) return new Transform(options);
+ if (!(this instanceof Transform))
+ return new Transform(options);
Duplex.call(this, options);
- this._transformState = new TransformState(this);
+ 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.
@@ -104,21 +130,17 @@ function Transform(options) {
// sync guard flag.
this._readableState.sync = false;
- if (options) {
- if (typeof options.transform === 'function') this._transform = options.transform;
-
- if (typeof options.flush === 'function') this._flush = options.flush;
- }
-
- // When the writable side finishes, then flush out anything remaining.
- this.once('prefinish', function () {
- if (typeof this._flush === 'function') this._flush(function (er, data) {
- done(stream, er, data);
- });else done(stream);
+ 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) {
+Transform.prototype.push = function(chunk, encoding) {
this._transformState.needTransform = false;
return Duplex.prototype.push.call(this, chunk, encoding);
};
@@ -133,28 +155,31 @@ Transform.prototype.push = function (chunk, encoding) {
// Call `cb(err)` when you are done with this chunk. If you pass
// an error, then that'll put the hurt on the whole operation. If you
// never call cb(), then you'll never get another chunk.
-Transform.prototype._transform = function (chunk, encoding, cb) {
- throw new Error('_transform() is not implemented');
+Transform.prototype._transform = function(chunk, encoding, cb) {
+ throw new Error('not implemented');
};
-Transform.prototype._write = function (chunk, encoding, cb) {
+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);
+ 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) {
+Transform.prototype._read = function(n) {
var ts = this._transformState;
- if (ts.writechunk !== null && ts.writecb && !ts.transforming) {
+ if (!util.isNull(ts.writechunk) && ts.writecb && !ts.transforming) {
ts.transforming = true;
this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
} else {
@@ -164,19 +189,21 @@ Transform.prototype._read = function (n) {
}
};
-function done(stream, er, data) {
- if (er) return stream.emit('error', er);
- if (data !== null && data !== undefined) stream.push(data);
+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 (ws.length)
+ throw new Error('calling transform done when ws.length != 0');
- if (ts.transforming) throw new Error('Calling transform done when still transforming');
+ if (ts.transforming)
+ throw new Error('calling transform done when still transforming');
return stream.push(null);
-}
\ No newline at end of file
+}
diff --git a/node_modules/streamroller/node_modules/readable-stream/lib/_stream_writable.js b/node_modules/streamroller/node_modules/readable-stream/lib/_stream_writable.js
new file mode 100644
index 0000000..db8539c
--- /dev/null
+++ b/node_modules/streamroller/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;
+
+/**/
+var Buffer = require('buffer').Buffer;
+/**/
+
+Writable.WritableState = WritableState;
+
+
+/**/
+var util = require('core-util-is');
+util.inherits = require('inherits');
+/**/
+
+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/node_modules/streamroller/node_modules/readable-stream/package.json b/node_modules/streamroller/node_modules/readable-stream/package.json
new file mode 100644
index 0000000..e56b813
--- /dev/null
+++ b/node_modules/streamroller/node_modules/readable-stream/package.json
@@ -0,0 +1,113 @@
+{
+ "_args": [
+ [
+ {
+ "raw": "readable-stream@^1.1.7",
+ "scope": null,
+ "escapedName": "readable-stream",
+ "name": "readable-stream",
+ "rawSpec": "^1.1.7",
+ "spec": ">=1.1.7 <2.0.0",
+ "type": "range"
+ },
+ "/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/streamroller"
+ ]
+ ],
+ "_from": "readable-stream@>=1.1.7 <2.0.0",
+ "_id": "readable-stream@1.1.14",
+ "_inCache": true,
+ "_installable": true,
+ "_location": "/streamroller/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.7",
+ "scope": null,
+ "escapedName": "readable-stream",
+ "name": "readable-stream",
+ "rawSpec": "^1.1.7",
+ "spec": ">=1.1.7 <2.0.0",
+ "type": "range"
+ },
+ "_requiredBy": [
+ "/streamroller"
+ ],
+ "_resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz",
+ "_shasum": "7cf4c54ef648e3813084c636dd2079e166c081d9",
+ "_shrinkwrap": null,
+ "_spec": "readable-stream@^1.1.7",
+ "_where": "/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/streamroller",
+ "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/node_modules/bl/node_modules/readable-stream/passthrough.js b/node_modules/streamroller/node_modules/readable-stream/passthrough.js
similarity index 100%
rename from node_modules/bl/node_modules/readable-stream/passthrough.js
rename to node_modules/streamroller/node_modules/readable-stream/passthrough.js
diff --git a/node_modules/bl/node_modules/readable-stream/readable.js b/node_modules/streamroller/node_modules/readable-stream/readable.js
similarity index 62%
rename from node_modules/bl/node_modules/readable-stream/readable.js
rename to node_modules/streamroller/node_modules/readable-stream/readable.js
index be2688a..2a8b5c6 100644
--- a/node_modules/bl/node_modules/readable-stream/readable.js
+++ b/node_modules/streamroller/node_modules/readable-stream/readable.js
@@ -1,16 +1,10 @@
-var Stream = (function (){
- try {
- return require('st' + 'ream'); // hack to fix a circular dependency issue when used with browserify
- } catch(_){}
-}());
exports = module.exports = require('./lib/_stream_readable.js');
-exports.Stream = Stream || exports;
+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' && Stream) {
- module.exports = Stream;
+if (!process.browser && process.env.READABLE_STREAM === 'disable') {
+ module.exports = require('stream');
}
diff --git a/node_modules/bl/node_modules/readable-stream/transform.js b/node_modules/streamroller/node_modules/readable-stream/transform.js
similarity index 100%
rename from node_modules/bl/node_modules/readable-stream/transform.js
rename to node_modules/streamroller/node_modules/readable-stream/transform.js
diff --git a/node_modules/bl/node_modules/readable-stream/writable.js b/node_modules/streamroller/node_modules/readable-stream/writable.js
similarity index 100%
rename from node_modules/bl/node_modules/readable-stream/writable.js
rename to node_modules/streamroller/node_modules/readable-stream/writable.js
diff --git a/node_modules/streamroller/package.json b/node_modules/streamroller/package.json
index 013566c..71141a5 100644
--- a/node_modules/streamroller/package.json
+++ b/node_modules/streamroller/package.json
@@ -28,7 +28,11 @@
"email": "gareth.nomiddlename@gmail.com"
},
"_npmVersion": "3.10.10",
- "_phantomChildren": {},
+ "_phantomChildren": {
+ "core-util-is": "1.0.2",
+ "inherits": "2.0.3",
+ "string_decoder": "0.10.31"
+ },
"_requested": {
"raw": "streamroller@^0.4.0",
"scope": null,
diff --git a/node_modules/string_decoder/package.json b/node_modules/string_decoder/package.json
index de946ed..4c3414a 100644
--- a/node_modules/string_decoder/package.json
+++ b/node_modules/string_decoder/package.json
@@ -34,7 +34,8 @@
"type": "range"
},
"_requiredBy": [
- "/readable-stream"
+ "/readable-stream",
+ "/streamroller/readable-stream"
],
"_resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
"_shasum": "62e203bc41766c6c28c9fc84301dab1c5310fa94",
diff --git a/node_modules/tar-stream/node_modules/isarray/.npmignore b/node_modules/tar-stream/node_modules/isarray/.npmignore
deleted file mode 100644
index 3c3629e..0000000
--- a/node_modules/tar-stream/node_modules/isarray/.npmignore
+++ /dev/null
@@ -1 +0,0 @@
-node_modules
diff --git a/node_modules/tar-stream/node_modules/isarray/Makefile b/node_modules/tar-stream/node_modules/isarray/Makefile
deleted file mode 100644
index 787d56e..0000000
--- a/node_modules/tar-stream/node_modules/isarray/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-
-test:
- @node_modules/.bin/tape test.js
-
-.PHONY: test
-
diff --git a/node_modules/tar-stream/node_modules/isarray/README.md b/node_modules/tar-stream/node_modules/isarray/README.md
deleted file mode 100644
index 16d2c59..0000000
--- a/node_modules/tar-stream/node_modules/isarray/README.md
+++ /dev/null
@@ -1,60 +0,0 @@
-
-# isarray
-
-`Array#isArray` for older browsers.
-
-[](http://travis-ci.org/juliangruber/isarray)
-[](https://www.npmjs.org/package/isarray)
-
-[
-](https://ci.testling.com/juliangruber/isarray)
-
-## 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 <julian@juliangruber.com>
-
-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/node_modules/tar-stream/node_modules/isarray/component.json b/node_modules/tar-stream/node_modules/isarray/component.json
deleted file mode 100644
index 9e31b68..0000000
--- a/node_modules/tar-stream/node_modules/isarray/component.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "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/node_modules/tar-stream/node_modules/isarray/index.js b/node_modules/tar-stream/node_modules/isarray/index.js
deleted file mode 100644
index a57f634..0000000
--- a/node_modules/tar-stream/node_modules/isarray/index.js
+++ /dev/null
@@ -1,5 +0,0 @@
-var toString = {}.toString;
-
-module.exports = Array.isArray || function (arr) {
- return toString.call(arr) == '[object Array]';
-};
diff --git a/node_modules/tar-stream/node_modules/isarray/package.json b/node_modules/tar-stream/node_modules/isarray/package.json
deleted file mode 100644
index 5e14fda..0000000
--- a/node_modules/tar-stream/node_modules/isarray/package.json
+++ /dev/null
@@ -1,117 +0,0 @@
-{
- "_args": [
- [
- {
- "raw": "isarray@~1.0.0",
- "scope": null,
- "escapedName": "isarray",
- "name": "isarray",
- "rawSpec": "~1.0.0",
- "spec": ">=1.0.0 <1.1.0",
- "type": "range"
- },
- "/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/bl/node_modules/readable-stream"
- ],
- [
- {
- "raw": "isarray@~1.0.0",
- "scope": null,
- "escapedName": "isarray",
- "name": "isarray",
- "rawSpec": "~1.0.0",
- "spec": ">=1.0.0 <1.1.0",
- "type": "range"
- },
- "/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/tar-stream/node_modules/readable-stream"
- ]
- ],
- "_from": "isarray@~1.0.0",
- "_id": "isarray@1.0.0",
- "_inCache": true,
- "_installable": true,
- "_location": "/tar-stream/isarray",
- "_nodeVersion": "5.1.0",
- "_npmUser": {
- "name": "juliangruber",
- "email": "julian@juliangruber.com"
- },
- "_npmVersion": "3.3.12",
- "_phantomChildren": {},
- "_requested": {
- "raw": "isarray@~1.0.0",
- "scope": null,
- "escapedName": "isarray",
- "name": "isarray",
- "rawSpec": "~1.0.0",
- "spec": ">=1.0.0 <1.1.0",
- "type": "range"
- },
- "_requiredBy": [
- "/tar-stream/readable-stream"
- ],
- "_resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
- "_shasum": "bb935d48582cba168c06834957a54a3e07124f11",
- "_shrinkwrap": null,
- "_spec": "isarray@~1.0.0",
- "_where": "/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/tar-stream/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": {
- "tape": "~2.13.4"
- },
- "directories": {},
- "dist": {
- "shasum": "bb935d48582cba168c06834957a54a3e07124f11",
- "tarball": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz"
- },
- "gitHead": "2a23a281f369e9ae06394c0fb4d2381355a6ba33",
- "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": "tape test.js"
- },
- "testling": {
- "files": "test.js",
- "browsers": [
- "ie/8..latest",
- "firefox/17..latest",
- "firefox/nightly",
- "chrome/22..latest",
- "chrome/canary",
- "opera/12..latest",
- "opera/next",
- "safari/5.1..latest",
- "ipad/6.0..latest",
- "iphone/6.0..latest",
- "android-browser/4.2..latest"
- ]
- },
- "version": "1.0.0"
-}
diff --git a/node_modules/tar-stream/node_modules/isarray/test.js b/node_modules/tar-stream/node_modules/isarray/test.js
deleted file mode 100644
index e0c3444..0000000
--- a/node_modules/tar-stream/node_modules/isarray/test.js
+++ /dev/null
@@ -1,20 +0,0 @@
-var isArray = require('./');
-var test = require('tape');
-
-test('is array', function(t){
- t.ok(isArray([]));
- t.notOk(isArray({}));
- t.notOk(isArray(null));
- t.notOk(isArray(false));
-
- var obj = {};
- obj[0] = true;
- t.notOk(isArray(obj));
-
- var arr = [];
- arr.foo = 'bar';
- t.ok(isArray(arr));
-
- t.end();
-});
-
diff --git a/node_modules/tar-stream/node_modules/readable-stream/.npmignore b/node_modules/tar-stream/node_modules/readable-stream/.npmignore
deleted file mode 100644
index 6d270c6..0000000
--- a/node_modules/tar-stream/node_modules/readable-stream/.npmignore
+++ /dev/null
@@ -1,9 +0,0 @@
-build/
-test/
-examples/
-fs.js
-zlib.js
-.zuul.yml
-.nyc_output
-coverage
-docs/
diff --git a/node_modules/tar-stream/node_modules/readable-stream/.travis.yml b/node_modules/tar-stream/node_modules/readable-stream/.travis.yml
deleted file mode 100644
index 76b4b0c..0000000
--- a/node_modules/tar-stream/node_modules/readable-stream/.travis.yml
+++ /dev/null
@@ -1,49 +0,0 @@
-sudo: false
-language: node_js
-before_install:
- - npm install -g npm@2
- - npm install -g npm
-notifications:
- email: false
-matrix:
- fast_finish: true
- include:
- - node_js: '0.8'
- env: TASK=test
- - node_js: '0.10'
- env: TASK=test
- - node_js: '0.11'
- env: TASK=test
- - node_js: '0.12'
- env: TASK=test
- - node_js: 1
- env: TASK=test
- - node_js: 2
- env: TASK=test
- - node_js: 3
- env: TASK=test
- - node_js: 4
- env: TASK=test
- - node_js: 5
- env: TASK=test
- - node_js: 6
- env: TASK=test
- - node_js: 7
- env: TASK=test
- - node_js: 5
- env: TASK=browser BROWSER_NAME=ie BROWSER_VERSION="9..latest"
- - node_js: 5
- env: TASK=browser BROWSER_NAME=opera BROWSER_VERSION="11..latest"
- - node_js: 5
- env: TASK=browser BROWSER_NAME=chrome BROWSER_VERSION="-3..latest"
- - node_js: 5
- env: TASK=browser BROWSER_NAME=firefox BROWSER_VERSION="-3..latest"
- - node_js: 5
- env: TASK=browser BROWSER_NAME=safari BROWSER_VERSION="5..latest"
- - node_js: 5
- env: TASK=browser BROWSER_NAME=microsoftedge BROWSER_VERSION=latest
-script: "npm run $TASK"
-env:
- global:
- - secure: rE2Vvo7vnjabYNULNyLFxOyt98BoJexDqsiOnfiD6kLYYsiQGfr/sbZkPMOFm9qfQG7pjqx+zZWZjGSswhTt+626C0t/njXqug7Yps4c3dFblzGfreQHp7wNX5TFsvrxd6dAowVasMp61sJcRnB2w8cUzoe3RAYUDHyiHktwqMc=
- - secure: g9YINaKAdMatsJ28G9jCGbSaguXCyxSTy+pBO6Ch0Cf57ZLOTka3HqDj8p3nV28LUIHZ3ut5WO43CeYKwt4AUtLpBS3a0dndHdY6D83uY6b2qh5hXlrcbeQTq2cvw2y95F7hm4D1kwrgZ7ViqaKggRcEupAL69YbJnxeUDKWEdI=
diff --git a/node_modules/tar-stream/node_modules/readable-stream/CONTRIBUTING.md b/node_modules/tar-stream/node_modules/readable-stream/CONTRIBUTING.md
deleted file mode 100644
index f478d58..0000000
--- a/node_modules/tar-stream/node_modules/readable-stream/CONTRIBUTING.md
+++ /dev/null
@@ -1,38 +0,0 @@
-# Developer's Certificate of Origin 1.1
-
-By making a contribution to this project, I certify that:
-
-* (a) The contribution was created in whole or in part by me and I
- have the right to submit it under the open source license
- indicated in the file; or
-
-* (b) The contribution is based upon previous work that, to the best
- of my knowledge, is covered under an appropriate open source
- license and I have the right under that license to submit that
- work with modifications, whether created in whole or in part
- by me, under the same open source license (unless I am
- permitted to submit under a different license), as indicated
- in the file; or
-
-* (c) The contribution was provided directly to me by some other
- person who certified (a), (b) or (c) and I have not modified
- it.
-
-* (d) I understand and agree that this project and the contribution
- are public and that a record of the contribution (including all
- personal information I submit with it, including my sign-off) is
- maintained indefinitely and may be redistributed consistent with
- this project or the open source license(s) involved.
-
-## Moderation Policy
-
-The [Node.js Moderation Policy] applies to this WG.
-
-## Code of Conduct
-
-The [Node.js Code of Conduct][] applies to this WG.
-
-[Node.js Code of Conduct]:
-https://github.com/nodejs/node/blob/master/CODE_OF_CONDUCT.md
-[Node.js Moderation Policy]:
-https://github.com/nodejs/TSC/blob/master/Moderation-Policy.md
diff --git a/node_modules/tar-stream/node_modules/readable-stream/GOVERNANCE.md b/node_modules/tar-stream/node_modules/readable-stream/GOVERNANCE.md
deleted file mode 100644
index 16ffb93..0000000
--- a/node_modules/tar-stream/node_modules/readable-stream/GOVERNANCE.md
+++ /dev/null
@@ -1,136 +0,0 @@
-### Streams Working Group
-
-The Node.js Streams is jointly governed by a Working Group
-(WG)
-that is responsible for high-level guidance of the project.
-
-The WG has final authority over this project including:
-
-* Technical direction
-* Project governance and process (including this policy)
-* Contribution policy
-* GitHub repository hosting
-* Conduct guidelines
-* Maintaining the list of additional Collaborators
-
-For the current list of WG members, see the project
-[README.md](./README.md#current-project-team-members).
-
-### Collaborators
-
-The readable-stream GitHub repository is
-maintained by the WG and additional Collaborators who are added by the
-WG on an ongoing basis.
-
-Individuals making significant and valuable contributions are made
-Collaborators and given commit-access to the project. These
-individuals are identified by the WG and their addition as
-Collaborators is discussed during the WG meeting.
-
-_Note:_ If you make a significant contribution and are not considered
-for commit-access log an issue or contact a WG member directly and it
-will be brought up in the next WG meeting.
-
-Modifications of the contents of the readable-stream repository are
-made on
-a collaborative basis. Anybody with a GitHub account may propose a
-modification via pull request and it will be considered by the project
-Collaborators. All pull requests must be reviewed and accepted by a
-Collaborator with sufficient expertise who is able to take full
-responsibility for the change. In the case of pull requests proposed
-by an existing Collaborator, an additional Collaborator is required
-for sign-off. Consensus should be sought if additional Collaborators
-participate and there is disagreement around a particular
-modification. See _Consensus Seeking Process_ below for further detail
-on the consensus model used for governance.
-
-Collaborators may opt to elevate significant or controversial
-modifications, or modifications that have not found consensus to the
-WG for discussion by assigning the ***WG-agenda*** tag to a pull
-request or issue. The WG should serve as the final arbiter where
-required.
-
-For the current list of Collaborators, see the project
-[README.md](./README.md#members).
-
-### WG Membership
-
-WG seats are not time-limited. There is no fixed size of the WG.
-However, the expected target is between 6 and 12, to ensure adequate
-coverage of important areas of expertise, balanced with the ability to
-make decisions efficiently.
-
-There is no specific set of requirements or qualifications for WG
-membership beyond these rules.
-
-The WG may add additional members to the WG by unanimous consensus.
-
-A WG member may be removed from the WG by voluntary resignation, or by
-unanimous consensus of all other WG members.
-
-Changes to WG membership should be posted in the agenda, and may be
-suggested as any other agenda item (see "WG Meetings" below).
-
-If an addition or removal is proposed during a meeting, and the full
-WG is not in attendance to participate, then the addition or removal
-is added to the agenda for the subsequent meeting. This is to ensure
-that all members are given the opportunity to participate in all
-membership decisions. If a WG member is unable to attend a meeting
-where a planned membership decision is being made, then their consent
-is assumed.
-
-No more than 1/3 of the WG members may be affiliated with the same
-employer. If removal or resignation of a WG member, or a change of
-employment by a WG member, creates a situation where more than 1/3 of
-the WG membership shares an employer, then the situation must be
-immediately remedied by the resignation or removal of one or more WG
-members affiliated with the over-represented employer(s).
-
-### WG Meetings
-
-The WG meets occasionally on a Google Hangout On Air. A designated moderator
-approved by the WG runs the meeting. Each meeting should be
-published to YouTube.
-
-Items are added to the WG agenda that are considered contentious or
-are modifications of governance, contribution policy, WG membership,
-or release process.
-
-The intention of the agenda is not to approve or review all patches;
-that should happen continuously on GitHub and be handled by the larger
-group of Collaborators.
-
-Any community member or contributor can ask that something be added to
-the next meeting's agenda by logging a GitHub Issue. Any Collaborator,
-WG member or the moderator can add the item to the agenda by adding
-the ***WG-agenda*** tag to the issue.
-
-Prior to each WG meeting the moderator will share the Agenda with
-members of the WG. WG members can add any items they like to the
-agenda at the beginning of each meeting. The moderator and the WG
-cannot veto or remove items.
-
-The WG may invite persons or representatives from certain projects to
-participate in a non-voting capacity.
-
-The moderator is responsible for summarizing the discussion of each
-agenda item and sends it as a pull request after the meeting.
-
-### Consensus Seeking Process
-
-The WG follows a
-[Consensus
-Seeking](http://en.wikipedia.org/wiki/Consensus-seeking_decision-making)
-decision-making model.
-
-When an agenda item has appeared to reach a consensus the moderator
-will ask "Does anyone object?" as a final call for dissent from the
-consensus.
-
-If an agenda item cannot reach a consensus a WG member can call for
-either a closing vote or a vote to table the issue to the next
-meeting. The call for a vote must be seconded by a majority of the WG
-or else the discussion will continue. Simple majority wins.
-
-Note that changes to WG membership require a majority consensus. See
-"WG Membership" above.
diff --git a/node_modules/tar-stream/node_modules/readable-stream/LICENSE b/node_modules/tar-stream/node_modules/readable-stream/LICENSE
deleted file mode 100644
index 2873b3b..0000000
--- a/node_modules/tar-stream/node_modules/readable-stream/LICENSE
+++ /dev/null
@@ -1,47 +0,0 @@
-Node.js is licensed for use as follows:
-
-"""
-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.
-"""
-
-This license applies to parts of Node.js originating from the
-https://github.com/joyent/node repository:
-
-"""
-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/node_modules/tar-stream/node_modules/readable-stream/README.md b/node_modules/tar-stream/node_modules/readable-stream/README.md
deleted file mode 100644
index ff75b0d..0000000
--- a/node_modules/tar-stream/node_modules/readable-stream/README.md
+++ /dev/null
@@ -1,57 +0,0 @@
-# readable-stream
-
-***Node-core v7.0.0 streams for userland*** [](https://travis-ci.org/nodejs/readable-stream)
-
-
-[](https://nodei.co/npm/readable-stream/)
-[](https://nodei.co/npm/readable-stream/)
-
-
-[](https://saucelabs.com/u/readable-stream)
-
-```bash
-npm install --save readable-stream
-```
-
-***Node-core streams for userland***
-
-This package is a mirror of the Streams2 and Streams3 implementations in
-Node-core.
-
-Full documentation may be found on the [Node.js website](https://nodejs.org/dist/v7.7.3/docs/api/).
-
-If you want to guarantee a stable streams base, regardless of what version of
-Node you, or the users of your libraries are using, use **readable-stream** *only* and avoid the *"stream"* module in Node-core, for background see [this blogpost](http://r.va.gg/2014/06/why-i-dont-use-nodes-core-stream-module.html).
-
-As of version 2.0.0 **readable-stream** uses semantic versioning.
-
-# Streams Working Group
-
-`readable-stream` is maintained by the Streams Working Group, which
-oversees the development and maintenance of the Streams API within
-Node.js. The responsibilities of the Streams Working Group include:
-
-* Addressing stream issues on the Node.js issue tracker.
-* Authoring and editing stream documentation within the Node.js project.
-* Reviewing changes to stream subclasses within the Node.js project.
-* Redirecting changes to streams from the Node.js project to this
- project.
-* Assisting in the implementation of stream providers within Node.js.
-* Recommending versions of `readable-stream` to be included in Node.js.
-* Messaging about the future of streams to give the community advance
- notice of changes.
-
-
-## Team Members
-
-* **Chris Dickinson** ([@chrisdickinson](https://github.com/chrisdickinson)) <christopher.s.dickinson@gmail.com>
- - Release GPG key: 9554F04D7259F04124DE6B476D5A82AC7E37093B
-* **Calvin Metcalf** ([@calvinmetcalf](https://github.com/calvinmetcalf)) <calvin.metcalf@gmail.com>
- - Release GPG key: F3EF5F62A87FC27A22E643F714CE4FF5015AA242
-* **Rod Vagg** ([@rvagg](https://github.com/rvagg)) <rod@vagg.org>
- - Release GPG key: DD8F2338BAE7501E3DD5AC78C273792F7D83545D
-* **Sam Newman** ([@sonewman](https://github.com/sonewman)) <newmansam@outlook.com>
-* **Mathias Buus** ([@mafintosh](https://github.com/mafintosh)) <mathiasbuus@gmail.com>
-* **Domenic Denicola** ([@domenic](https://github.com/domenic)) <d@domenic.me>
-* **Matteo Collina** ([@mcollina](https://github.com/mcollina)) <matteo.collina@gmail.com>
- - Release GPG key: 3ABC01543F22DD2239285CDD818674489FBC127E
diff --git a/node_modules/tar-stream/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md b/node_modules/tar-stream/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md
deleted file mode 100644
index 83275f1..0000000
--- a/node_modules/tar-stream/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md
+++ /dev/null
@@ -1,60 +0,0 @@
-# streams WG Meeting 2015-01-30
-
-## Links
-
-* **Google Hangouts Video**: http://www.youtube.com/watch?v=I9nDOSGfwZg
-* **GitHub Issue**: https://github.com/iojs/readable-stream/issues/106
-* **Original Minutes Google Doc**: https://docs.google.com/document/d/17aTgLnjMXIrfjgNaTUnHQO7m3xgzHR2VXBTmi03Qii4/
-
-## Agenda
-
-Extracted from https://github.com/iojs/readable-stream/labels/wg-agenda prior to meeting.
-
-* adopt a charter [#105](https://github.com/iojs/readable-stream/issues/105)
-* release and versioning strategy [#101](https://github.com/iojs/readable-stream/issues/101)
-* simpler stream creation [#102](https://github.com/iojs/readable-stream/issues/102)
-* proposal: deprecate implicit flowing of streams [#99](https://github.com/iojs/readable-stream/issues/99)
-
-## Minutes
-
-### adopt a charter
-
-* group: +1's all around
-
-### What versioning scheme should be adopted?
-* group: +1’s 3.0.0
-* domenic+group: pulling in patches from other sources where appropriate
-* mikeal: version independently, suggesting versions for io.js
-* mikeal+domenic: work with TC to notify in advance of changes
-simpler stream creation
-
-### streamline creation of streams
-* sam: streamline creation of streams
-* domenic: nice simple solution posted
- but, we lose the opportunity to change the model
- may not be backwards incompatible (double check keys)
-
- **action item:** domenic will check
-
-### remove implicit flowing of streams on(‘data’)
-* add isFlowing / isPaused
-* mikeal: worrying that we’re documenting polyfill methods – confuses users
-* domenic: more reflective API is probably good, with warning labels for users
-* new section for mad scientists (reflective stream access)
-* calvin: name the “third state”
-* mikeal: maybe borrow the name from whatwg?
-* domenic: we’re missing the “third state”
-* consensus: kind of difficult to name the third state
-* mikeal: figure out differences in states / compat
-* mathias: always flow on data – eliminates third state
- * explore what it breaks
-
-**action items:**
-* ask isaac for ability to list packages by what public io.js APIs they use (esp. Stream)
-* ask rod/build for infrastructure
-* **chris**: explore the “flow on data” approach
-* add isPaused/isFlowing
-* add new docs section
-* move isPaused to that section
-
-
diff --git a/node_modules/tar-stream/node_modules/readable-stream/duplex.js b/node_modules/tar-stream/node_modules/readable-stream/duplex.js
deleted file mode 100644
index ca807af..0000000
--- a/node_modules/tar-stream/node_modules/readable-stream/duplex.js
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = require("./lib/_stream_duplex.js")
diff --git a/node_modules/tar-stream/node_modules/readable-stream/lib/_stream_duplex.js b/node_modules/tar-stream/node_modules/readable-stream/lib/_stream_duplex.js
deleted file mode 100644
index 736693b..0000000
--- a/node_modules/tar-stream/node_modules/readable-stream/lib/_stream_duplex.js
+++ /dev/null
@@ -1,75 +0,0 @@
-// a duplex stream is just a stream that is both readable and writable.
-// Since JS doesn't have multiple prototypal inheritance, this class
-// prototypally inherits from Readable, and then parasitically from
-// Writable.
-
-'use strict';
-
-/**/
-
-var objectKeys = Object.keys || function (obj) {
- var keys = [];
- for (var key in obj) {
- keys.push(key);
- }return keys;
-};
-/**/
-
-module.exports = Duplex;
-
-/**/
-var processNextTick = require('process-nextick-args');
-/**/
-
-/**/
-var util = require('core-util-is');
-util.inherits = require('inherits');
-/**/
-
-var Readable = require('./_stream_readable');
-var Writable = require('./_stream_writable');
-
-util.inherits(Duplex, Readable);
-
-var keys = objectKeys(Writable.prototype);
-for (var v = 0; v < keys.length; v++) {
- var method = keys[v];
- if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
-}
-
-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.
- processNextTick(onEndNT, this);
-}
-
-function onEndNT(self) {
- self.end();
-}
-
-function forEach(xs, f) {
- for (var i = 0, l = xs.length; i < l; i++) {
- f(xs[i], i);
- }
-}
\ No newline at end of file
diff --git a/node_modules/tar-stream/node_modules/readable-stream/lib/_stream_passthrough.js b/node_modules/tar-stream/node_modules/readable-stream/lib/_stream_passthrough.js
deleted file mode 100644
index d06f71f..0000000
--- a/node_modules/tar-stream/node_modules/readable-stream/lib/_stream_passthrough.js
+++ /dev/null
@@ -1,26 +0,0 @@
-// a passthrough stream.
-// basically just the most minimal sort of Transform stream.
-// Every written chunk gets output as-is.
-
-'use strict';
-
-module.exports = PassThrough;
-
-var Transform = require('./_stream_transform');
-
-/**/
-var util = require('core-util-is');
-util.inherits = require('inherits');
-/**/
-
-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);
-};
\ No newline at end of file
diff --git a/node_modules/tar-stream/node_modules/readable-stream/lib/_stream_readable.js b/node_modules/tar-stream/node_modules/readable-stream/lib/_stream_readable.js
deleted file mode 100644
index 13b5a74..0000000
--- a/node_modules/tar-stream/node_modules/readable-stream/lib/_stream_readable.js
+++ /dev/null
@@ -1,941 +0,0 @@
-'use strict';
-
-module.exports = Readable;
-
-/**/
-var processNextTick = require('process-nextick-args');
-/**/
-
-/**/
-var isArray = require('isarray');
-/**/
-
-/**/
-var Duplex;
-/**/
-
-Readable.ReadableState = ReadableState;
-
-/**/
-var EE = require('events').EventEmitter;
-
-var EElistenerCount = function (emitter, type) {
- return emitter.listeners(type).length;
-};
-/**/
-
-/**/
-var Stream;
-(function () {
- try {
- Stream = require('st' + 'ream');
- } catch (_) {} finally {
- if (!Stream) Stream = require('events').EventEmitter;
- }
-})();
-/**/
-
-var Buffer = require('buffer').Buffer;
-/**/
-var bufferShim = require('buffer-shims');
-/**/
-
-/**/
-var util = require('core-util-is');
-util.inherits = require('inherits');
-/**/
-
-/**/
-var debugUtil = require('util');
-var debug = void 0;
-if (debugUtil && debugUtil.debuglog) {
- debug = debugUtil.debuglog('stream');
-} else {
- debug = function () {};
-}
-/**/
-
-var BufferList = require('./internal/streams/BufferList');
-var StringDecoder;
-
-util.inherits(Readable, Stream);
-
-function prependListener(emitter, event, fn) {
- // Sadly this is not cacheable as some libraries bundle their own
- // event emitter implementation with them.
- if (typeof emitter.prependListener === 'function') {
- return emitter.prependListener(event, fn);
- } else {
- // This is a hack to make sure that our error handler is attached before any
- // userland ones. NEVER DO THIS. This is here only because this code needs
- // to continue to work with older versions of Node.js that do not include
- // the prependListener() method. The goal is to eventually remove this hack.
- if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]];
- }
-}
-
-function ReadableState(options, stream) {
- Duplex = Duplex || require('./_stream_duplex');
-
- options = options || {};
-
- // 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;
-
- // 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 = this.objectMode ? 16 : 16 * 1024;
- this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm;
-
- // cast to ints.
- this.highWaterMark = ~~this.highWaterMark;
-
- // A linked list is used to store data chunks instead of an array because the
- // linked list can remove elements from the beginning faster than
- // array.shift()
- this.buffer = new BufferList();
- this.length = 0;
- this.pipes = null;
- 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;
- this.resumeScheduled = false;
-
- // 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) {
- Duplex = Duplex || require('./_stream_duplex');
-
- if (!(this instanceof Readable)) return new Readable(options);
-
- this._readableState = new ReadableState(options, this);
-
- // legacy
- this.readable = true;
-
- if (options && typeof options.read === 'function') this._read = options.read;
-
- 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 (!state.objectMode && typeof chunk === 'string') {
- encoding = encoding || state.defaultEncoding;
- if (encoding !== state.encoding) {
- chunk = bufferShim.from(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);
-};
-
-Readable.prototype.isPaused = function () {
- return this._readableState.flowing === false;
-};
-
-function readableAddChunk(stream, state, chunk, encoding, addToFront) {
- var er = chunkInvalid(state, chunk);
- if (er) {
- stream.emit('error', er);
- } else if (chunk === null) {
- state.reading = false;
- 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 {
- var skipAdd;
- if (state.decoder && !addToFront && !encoding) {
- chunk = state.decoder.write(chunk);
- skipAdd = !state.objectMode && chunk.length === 0;
- }
-
- if (!addToFront) state.reading = false;
-
- // Don't add to the buffer if we've decoded to an empty string chunk and
- // we're not in object mode
- if (!skipAdd) {
- // 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 > 8MB
-var MAX_HWM = 0x800000;
-function computeNewHighWaterMark(n) {
- if (n >= MAX_HWM) {
- n = MAX_HWM;
- } else {
- // Get the next highest power of 2 to prevent increasing hwm excessively in
- // tiny amounts
- n--;
- n |= n >>> 1;
- n |= n >>> 2;
- n |= n >>> 4;
- n |= n >>> 8;
- n |= n >>> 16;
- n++;
- }
- return n;
-}
-
-// This function is designed to be inlinable, so please take care when making
-// changes to the function body.
-function howMuchToRead(n, state) {
- if (n <= 0 || state.length === 0 && state.ended) return 0;
- if (state.objectMode) return 1;
- if (n !== n) {
- // Only flow one buffer at a time
- if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;
- }
- // If we're asking for more than the current hwm, then raise the hwm.
- if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);
- if (n <= state.length) return n;
- // Don't have enough
- if (!state.ended) {
- state.needReadable = true;
- return 0;
- }
- return state.length;
-}
-
-// you can override either this method, or the async _read(n) below.
-Readable.prototype.read = function (n) {
- debug('read', n);
- n = parseInt(n, 10);
- var state = this._readableState;
- var nOrig = n;
-
- if (n !== 0) state.emittedReadable = false;
-
- // if we're doing read(0) to trigger a readable event, but we
- // 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);
- } else if (doRead) {
- debug('do read');
- state.reading = true;
- state.sync = true;
- // if the length is currently zero, then we *need* a readable event.
- if (state.length === 0) state.needReadable = true;
- // call internal read method
- 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 (!state.reading) n = howMuchToRead(nOrig, state);
- }
-
- var ret;
- if (n > 0) ret = fromList(n, state);else ret = null;
-
- if (ret === null) {
- state.needReadable = true;
- n = 0;
- } else {
- state.length -= n;
- }
-
- if (state.length === 0) {
- // If we have nothing in the buffer, then we want to know
- // as soon as we *do* get something into the buffer.
- if (!state.ended) state.needReadable = true;
-
- // If we tried to read() past the EOF, then emit end on the next tick.
- if (nOrig !== n && state.ended) endReadable(this);
- }
-
- if (ret !== null) this.emit('data', ret);
-
- return ret;
-};
-
-function chunkInvalid(state, chunk) {
- var er = null;
- if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== null && chunk !== undefined && !state.objectMode) {
- er = new TypeError('Invalid non-string/buffer chunk');
- }
- return er;
-}
-
-function onEofChunk(stream, state) {
- if (state.ended) return;
- if (state.decoder) {
- var chunk = state.decoder.end();
- if (chunk && chunk.length) {
- state.buffer.push(chunk);
- state.length += state.objectMode ? 1 : chunk.length;
- }
- }
- state.ended = true;
-
- // 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) processNextTick(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;
- processNextTick(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('_read() is 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) processNextTick(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);
-
- var cleanedUp = false;
- 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);
-
- cleanedUp = true;
-
- // if the reader is waiting for a drain event from this
- // specific writer, then it would cause it to never start
- // flowing again.
- // So, if this is awaiting a drain, then we just call it now.
- // If we don't know, then assume that we are waiting for one.
- if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
- }
-
- // If the user pushes more data while we're writing to dest then we'll end up
- // in ondata again. However, we only want to increase awaitDrain once because
- // dest will only emit one 'drain' event for the multiple writes.
- // => Introduce a guard on increasing awaitDrain.
- var increasedAwaitDrain = false;
- src.on('data', ondata);
- function ondata(chunk) {
- debug('ondata');
- increasedAwaitDrain = false;
- var ret = dest.write(chunk);
- if (false === ret && !increasedAwaitDrain) {
- // If the user unpiped during `dest.write()`, it is possible
- // to get stuck in a permanently paused state if that write
- // also returned false.
- // => Check whether `dest` is still a piping destination.
- if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
- debug('false write response, pause', src._readableState.awaitDrain);
- src._readableState.awaitDrain++;
- increasedAwaitDrain = true;
- }
- src.pause();
- }
- }
-
- // if the dest has an error, then stop piping into it.
- // however, don't suppress the throwing behavior for this.
- function onerror(er) {
- debug('onerror', er);
- unpipe();
- dest.removeListener('error', onerror);
- if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er);
- }
-
- // Make sure our error handler is attached before userland ones.
- prependListener(dest, 'error', onerror);
-
- // Both close and finish should trigger unpipe, but only once.
- function onclose() {
- dest.removeListener('finish', onfinish);
- unpipe();
- }
- dest.once('close', onclose);
- function onfinish() {
- debug('onfinish');
- dest.removeListener('close', onclose);
- unpipe();
- }
- dest.once('finish', onfinish);
-
- function unpipe() {
- debug('unpipe');
- src.unpipe(dest);
- }
-
- // tell the dest that it's being piped to
- dest.emit('pipe', src);
-
- // start the flow if it hasn't been started already.
- 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 && EElistenerCount(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 index = indexOf(state.pipes, dest);
- if (index === -1) return this;
-
- state.pipes.splice(index, 1);
- state.pipesCount -= 1;
- if (state.pipesCount === 1) state.pipes = state.pipes[0];
-
- dest.emit('unpipe', this);
-
- 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 (ev === 'data') {
- // Start flowing on next tick if stream isn't explicitly paused
- if (this._readableState.flowing !== false) this.resume();
- } else if (ev === 'readable') {
- var state = this._readableState;
- if (!state.endEmitted && !state.readableListening) {
- state.readableListening = state.needReadable = true;
- state.emittedReadable = false;
- if (!state.reading) {
- processNextTick(nReadingNextTick, this);
- } else if (state.length) {
- emitReadable(this, state);
- }
- }
- }
-
- return res;
-};
-Readable.prototype.addListener = Readable.prototype.on;
-
-function nReadingNextTick(self) {
- debug('readable nexttick read 0');
- self.read(0);
-}
-
-// pause() and resume() are remnants of the legacy readable stream API
-// If the user uses them, then switch into old mode.
-Readable.prototype.resume = function () {
- var state = this._readableState;
- if (!state.flowing) {
- debug('resume');
- state.flowing = true;
- resume(this, state);
- }
- return this;
-};
-
-function resume(stream, state) {
- if (!state.resumeScheduled) {
- state.resumeScheduled = true;
- processNextTick(resume_, stream, state);
- }
-}
-
-function resume_(stream, state) {
- if (!state.reading) {
- debug('resume read 0');
- stream.read(0);
- }
-
- state.resumeScheduled = false;
- state.awaitDrain = 0;
- stream.emit('resume');
- flow(stream);
- if (state.flowing && !state.reading) stream.read(0);
-}
-
-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);
- while (state.flowing && stream.read() !== null) {}
-}
-
-// 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);
-
- // don't skip over falsy values in objectMode
- if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;
-
- var ret = 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 (this[i] === undefined && typeof stream[i] === 'function') {
- 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.
-// This function is designed to be inlinable, so please take care when making
-// changes to the function body.
-function fromList(n, state) {
- // nothing buffered
- if (state.length === 0) return null;
-
- var ret;
- if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {
- // read it all, truncate the list
- if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = state.buffer.concat(state.length);
- state.buffer.clear();
- } else {
- // read part of list
- ret = fromListPartial(n, state.buffer, state.decoder);
- }
-
- return ret;
-}
-
-// Extracts only enough buffered data to satisfy the amount requested.
-// This function is designed to be inlinable, so please take care when making
-// changes to the function body.
-function fromListPartial(n, list, hasStrings) {
- var ret;
- if (n < list.head.data.length) {
- // slice is the same for buffers and strings
- ret = list.head.data.slice(0, n);
- list.head.data = list.head.data.slice(n);
- } else if (n === list.head.data.length) {
- // first chunk is a perfect match
- ret = list.shift();
- } else {
- // result spans more than one buffer
- ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);
- }
- return ret;
-}
-
-// Copies a specified amount of characters from the list of buffered data
-// chunks.
-// This function is designed to be inlinable, so please take care when making
-// changes to the function body.
-function copyFromBufferString(n, list) {
- var p = list.head;
- var c = 1;
- var ret = p.data;
- n -= ret.length;
- while (p = p.next) {
- var str = p.data;
- var nb = n > str.length ? str.length : n;
- if (nb === str.length) ret += str;else ret += str.slice(0, n);
- n -= nb;
- if (n === 0) {
- if (nb === str.length) {
- ++c;
- if (p.next) list.head = p.next;else list.head = list.tail = null;
- } else {
- list.head = p;
- p.data = str.slice(nb);
- }
- break;
- }
- ++c;
- }
- list.length -= c;
- return ret;
-}
-
-// Copies a specified amount of bytes from the list of buffered data chunks.
-// This function is designed to be inlinable, so please take care when making
-// changes to the function body.
-function copyFromBuffer(n, list) {
- var ret = bufferShim.allocUnsafe(n);
- var p = list.head;
- var c = 1;
- p.data.copy(ret);
- n -= p.data.length;
- while (p = p.next) {
- var buf = p.data;
- var nb = n > buf.length ? buf.length : n;
- buf.copy(ret, ret.length - n, 0, nb);
- n -= nb;
- if (n === 0) {
- if (nb === buf.length) {
- ++c;
- if (p.next) list.head = p.next;else list.head = list.tail = null;
- } else {
- list.head = p;
- p.data = buf.slice(nb);
- }
- break;
- }
- ++c;
- }
- list.length -= c;
- return ret;
-}
-
-function endReadable(stream) {
- var state = stream._readableState;
-
- // 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;
- processNextTick(endReadableNT, state, stream);
- }
-}
-
-function endReadableNT(state, stream) {
- // 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;
-}
\ No newline at end of file
diff --git a/node_modules/tar-stream/node_modules/readable-stream/lib/_stream_transform.js b/node_modules/tar-stream/node_modules/readable-stream/lib/_stream_transform.js
deleted file mode 100644
index cd25832..0000000
--- a/node_modules/tar-stream/node_modules/readable-stream/lib/_stream_transform.js
+++ /dev/null
@@ -1,182 +0,0 @@
-// 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.
-
-'use strict';
-
-module.exports = Transform;
-
-var Duplex = require('./_stream_duplex');
-
-/**/
-var util = require('core-util-is');
-util.inherits = require('inherits');
-/**/
-
-util.inherits(Transform, Duplex);
-
-function TransformState(stream) {
- this.afterTransform = function (er, data) {
- return afterTransform(stream, er, data);
- };
-
- this.needTransform = false;
- this.transforming = false;
- this.writecb = null;
- this.writechunk = null;
- this.writeencoding = 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 (data !== null && data !== undefined) stream.push(data);
-
- 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(this);
-
- 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;
-
- if (options) {
- if (typeof options.transform === 'function') this._transform = options.transform;
-
- if (typeof options.flush === 'function') this._flush = options.flush;
- }
-
- // When the writable side finishes, then flush out anything remaining.
- this.once('prefinish', function () {
- if (typeof this._flush === 'function') this._flush(function (er, data) {
- done(stream, er, data);
- });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('_transform() is 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 (ts.writechunk !== null && ts.writecb && !ts.transforming) {
- ts.transforming = true;
- this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
- } else {
- // mark that we need a transform, so that any data that comes in
- // will get processed, now that we've asked for it.
- ts.needTransform = true;
- }
-};
-
-function done(stream, er, data) {
- if (er) return stream.emit('error', er);
-
- if (data !== null && data !== undefined) stream.push(data);
-
- // 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);
-}
\ No newline at end of file
diff --git a/node_modules/tar-stream/node_modules/readable-stream/lib/_stream_writable.js b/node_modules/tar-stream/node_modules/readable-stream/lib/_stream_writable.js
deleted file mode 100644
index 575beb3..0000000
--- a/node_modules/tar-stream/node_modules/readable-stream/lib/_stream_writable.js
+++ /dev/null
@@ -1,551 +0,0 @@
-// A bit simpler than readable streams.
-// Implement an async ._write(chunk, encoding, cb), and it'll handle all
-// the drain event emission and buffering.
-
-'use strict';
-
-module.exports = Writable;
-
-/**/
-var processNextTick = require('process-nextick-args');
-/**/
-
-/**/
-var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : processNextTick;
-/**/
-
-/**/
-var Duplex;
-/**/
-
-Writable.WritableState = WritableState;
-
-/**/
-var util = require('core-util-is');
-util.inherits = require('inherits');
-/**/
-
-/**/
-var internalUtil = {
- deprecate: require('util-deprecate')
-};
-/**/
-
-/**/
-var Stream;
-(function () {
- try {
- Stream = require('st' + 'ream');
- } catch (_) {} finally {
- if (!Stream) Stream = require('events').EventEmitter;
- }
-})();
-/**/
-
-var Buffer = require('buffer').Buffer;
-/**/
-var bufferShim = require('buffer-shims');
-/**/
-
-util.inherits(Writable, Stream);
-
-function nop() {}
-
-function WriteReq(chunk, encoding, cb) {
- this.chunk = chunk;
- this.encoding = encoding;
- this.callback = cb;
- this.next = null;
-}
-
-function WritableState(options, stream) {
- Duplex = Duplex || require('./_stream_duplex');
-
- options = options || {};
-
- // 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;
-
- // 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 = this.objectMode ? 16 : 16 * 1024;
- this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm;
-
- // cast to ints.
- this.highWaterMark = ~~this.highWaterMark;
-
- // drain event flag.
- this.needDrain = false;
- // at the start of calling end()
- this.ending = false;
- // when end() has been called, and returned
- this.ended = false;
- // when 'finish' is emitted
- this.finished = false;
-
- // 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.bufferedRequest = null;
- this.lastBufferedRequest = null;
-
- // 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;
-
- // count buffered requests
- this.bufferedRequestCount = 0;
-
- // allocate the first CorkedRequest, there is always
- // one allocated and free to use, and we maintain at most two
- this.corkedRequestsFree = new CorkedRequest(this);
-}
-
-WritableState.prototype.getBuffer = function getBuffer() {
- var current = this.bufferedRequest;
- var out = [];
- while (current) {
- out.push(current);
- current = current.next;
- }
- return out;
-};
-
-(function () {
- try {
- Object.defineProperty(WritableState.prototype, 'buffer', {
- get: internalUtil.deprecate(function () {
- return this.getBuffer();
- }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.')
- });
- } catch (_) {}
-})();
-
-// Test _writableState for inheritance to account for Duplex streams,
-// whose prototype chain only points to Readable.
-var realHasInstance;
-if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {
- realHasInstance = Function.prototype[Symbol.hasInstance];
- Object.defineProperty(Writable, Symbol.hasInstance, {
- value: function (object) {
- if (realHasInstance.call(this, object)) return true;
-
- return object && object._writableState instanceof WritableState;
- }
- });
-} else {
- realHasInstance = function (object) {
- return object instanceof this;
- };
-}
-
-function Writable(options) {
- Duplex = Duplex || require('./_stream_duplex');
-
- // Writable ctor is applied to Duplexes, too.
- // `realHasInstance` is necessary because using plain `instanceof`
- // would return false, as no `_writableState` property is attached.
-
- // Trying to use the custom `instanceof` for Writable here will also break the
- // Node.js LazyTransform implementation, which has a non-trivial getter for
- // `_writableState` that would lead to infinite recursion.
- if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) {
- return new Writable(options);
- }
-
- this._writableState = new WritableState(options, this);
-
- // legacy.
- this.writable = true;
-
- if (options) {
- if (typeof options.write === 'function') this._write = options.write;
-
- if (typeof options.writev === 'function') this._writev = options.writev;
- }
-
- 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, cb) {
- var er = new Error('write after end');
- // TODO: defer error events consistently everywhere, not just the cb
- stream.emit('error', er);
- processNextTick(cb, er);
-}
-
-// Checks that a user-supplied chunk is valid, especially for the particular
-// mode the stream is in. Currently this means that `null` is never accepted
-// and undefined/non-string values are only allowed in object mode.
-function validChunk(stream, state, chunk, cb) {
- var valid = true;
- var er = false;
-
- if (chunk === null) {
- er = new TypeError('May not write null values to stream');
- } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
- er = new TypeError('Invalid non-string/buffer chunk');
- }
- if (er) {
- stream.emit('error', er);
- processNextTick(cb, er);
- valid = false;
- }
- return valid;
-}
-
-Writable.prototype.write = function (chunk, encoding, cb) {
- var state = this._writableState;
- var ret = false;
- var isBuf = Buffer.isBuffer(chunk);
-
- if (typeof encoding === 'function') {
- cb = encoding;
- encoding = null;
- }
-
- if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;
-
- if (typeof cb !== 'function') cb = nop;
-
- if (state.ended) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {
- state.pendingcb++;
- ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);
- }
-
- return ret;
-};
-
-Writable.prototype.cork = function () {
- 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.bufferedRequest) clearBuffer(this, state);
- }
-};
-
-Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
- // node::ParseEncoding() requires lower case.
- if (typeof encoding === 'string') encoding = encoding.toLowerCase();
- if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding);
- this._writableState.defaultEncoding = encoding;
- return this;
-};
-
-function decodeChunk(state, chunk, encoding) {
- if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {
- chunk = bufferShim.from(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, isBuf, chunk, encoding, cb) {
- if (!isBuf) {
- chunk = decodeChunk(state, chunk, encoding);
- if (Buffer.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) {
- var last = state.lastBufferedRequest;
- state.lastBufferedRequest = new WriteReq(chunk, encoding, cb);
- if (last) {
- last.next = state.lastBufferedRequest;
- } else {
- state.bufferedRequest = state.lastBufferedRequest;
- }
- state.bufferedRequestCount += 1;
- } 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) {
- --state.pendingcb;
- if (sync) processNextTick(cb, er);else 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(state);
-
- if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
- clearBuffer(stream, state);
- }
-
- if (sync) {
- /**/
- asyncWrite(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;
- var entry = state.bufferedRequest;
-
- if (stream._writev && entry && entry.next) {
- // Fast case, write everything using _writev()
- var l = state.bufferedRequestCount;
- var buffer = new Array(l);
- var holder = state.corkedRequestsFree;
- holder.entry = entry;
-
- var count = 0;
- while (entry) {
- buffer[count] = entry;
- entry = entry.next;
- count += 1;
- }
-
- doWrite(stream, state, true, state.length, buffer, '', holder.finish);
-
- // doWrite is almost always async, defer these to save a bit of time
- // as the hot path ends with doWrite
- state.pendingcb++;
- state.lastBufferedRequest = null;
- if (holder.next) {
- state.corkedRequestsFree = holder.next;
- holder.next = null;
- } else {
- state.corkedRequestsFree = new CorkedRequest(state);
- }
- } else {
- // Slow case, write chunks one-by-one
- while (entry) {
- 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);
- entry = entry.next;
- // if we didn't call the onwrite immediately, then
- // it means that we need to wait until it does.
- // also, that means that the chunk and cb are currently
- // being processed, so move the buffer counter past them.
- if (state.writing) {
- break;
- }
- }
-
- if (entry === null) state.lastBufferedRequest = null;
- }
-
- state.bufferedRequestCount = 0;
- state.bufferedRequest = entry;
- state.bufferProcessing = false;
-}
-
-Writable.prototype._write = function (chunk, encoding, cb) {
- cb(new Error('_write() is not implemented'));
-};
-
-Writable.prototype._writev = null;
-
-Writable.prototype.end = function (chunk, encoding, cb) {
- var state = this._writableState;
-
- if (typeof chunk === 'function') {
- cb = chunk;
- chunk = null;
- encoding = null;
- } else if (typeof encoding === 'function') {
- cb = encoding;
- encoding = null;
- }
-
- if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);
-
- // .end() fully uncorks
- if (state.corked) {
- state.corked = 1;
- this.uncork();
- }
-
- // ignore unnecessary end() calls.
- if (!state.ending && !state.finished) endWritable(this, state, cb);
-};
-
-function needFinish(state) {
- return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
-}
-
-function prefinish(stream, state) {
- if (!state.prefinished) {
- state.prefinished = true;
- stream.emit('prefinish');
- }
-}
-
-function finishMaybe(stream, state) {
- var need = needFinish(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) processNextTick(cb);else stream.once('finish', cb);
- }
- state.ended = true;
- stream.writable = false;
-}
-
-// It seems a linked list but it is not
-// there will be only 2 of these for each stream
-function CorkedRequest(state) {
- var _this = this;
-
- this.next = null;
- this.entry = null;
- this.finish = function (err) {
- var entry = _this.entry;
- _this.entry = null;
- while (entry) {
- var cb = entry.callback;
- state.pendingcb--;
- cb(err);
- entry = entry.next;
- }
- if (state.corkedRequestsFree) {
- state.corkedRequestsFree.next = _this;
- } else {
- state.corkedRequestsFree = _this;
- }
- };
-}
\ No newline at end of file
diff --git a/node_modules/tar-stream/node_modules/readable-stream/lib/internal/streams/BufferList.js b/node_modules/tar-stream/node_modules/readable-stream/lib/internal/streams/BufferList.js
deleted file mode 100644
index e4bfcf0..0000000
--- a/node_modules/tar-stream/node_modules/readable-stream/lib/internal/streams/BufferList.js
+++ /dev/null
@@ -1,64 +0,0 @@
-'use strict';
-
-var Buffer = require('buffer').Buffer;
-/**/
-var bufferShim = require('buffer-shims');
-/**/
-
-module.exports = BufferList;
-
-function BufferList() {
- this.head = null;
- this.tail = null;
- this.length = 0;
-}
-
-BufferList.prototype.push = function (v) {
- var entry = { data: v, next: null };
- if (this.length > 0) this.tail.next = entry;else this.head = entry;
- this.tail = entry;
- ++this.length;
-};
-
-BufferList.prototype.unshift = function (v) {
- var entry = { data: v, next: this.head };
- if (this.length === 0) this.tail = entry;
- this.head = entry;
- ++this.length;
-};
-
-BufferList.prototype.shift = function () {
- if (this.length === 0) return;
- var ret = this.head.data;
- if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;
- --this.length;
- return ret;
-};
-
-BufferList.prototype.clear = function () {
- this.head = this.tail = null;
- this.length = 0;
-};
-
-BufferList.prototype.join = function (s) {
- if (this.length === 0) return '';
- var p = this.head;
- var ret = '' + p.data;
- while (p = p.next) {
- ret += s + p.data;
- }return ret;
-};
-
-BufferList.prototype.concat = function (n) {
- if (this.length === 0) return bufferShim.alloc(0);
- if (this.length === 1) return this.head.data;
- var ret = bufferShim.allocUnsafe(n >>> 0);
- var p = this.head;
- var i = 0;
- while (p) {
- p.data.copy(ret, i);
- i += p.data.length;
- p = p.next;
- }
- return ret;
-};
\ No newline at end of file
diff --git a/node_modules/tar-stream/node_modules/readable-stream/package.json b/node_modules/tar-stream/node_modules/readable-stream/package.json
deleted file mode 100644
index 662be87..0000000
--- a/node_modules/tar-stream/node_modules/readable-stream/package.json
+++ /dev/null
@@ -1,135 +0,0 @@
-{
- "_args": [
- [
- {
- "raw": "readable-stream@^2.0.0",
- "scope": null,
- "escapedName": "readable-stream",
- "name": "readable-stream",
- "rawSpec": "^2.0.0",
- "spec": ">=2.0.0 <3.0.0",
- "type": "range"
- },
- "/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/tar-stream"
- ]
- ],
- "_cnpm_publish_time": 1489651347637,
- "_from": "readable-stream@>=2.0.0 <3.0.0",
- "_id": "readable-stream@2.2.6",
- "_inCache": true,
- "_installable": true,
- "_location": "/tar-stream/readable-stream",
- "_nodeVersion": "6.9.4",
- "_npmOperationalInternal": {
- "host": "packages-12-west.internal.npmjs.com",
- "tmp": "tmp/readable-stream-2.2.6.tgz_1489651345676_0.6984770004637539"
- },
- "_npmUser": {
- "name": "matteo.collina",
- "email": "hello@matteocollina.com"
- },
- "_npmVersion": "3.10.10",
- "_phantomChildren": {},
- "_requested": {
- "raw": "readable-stream@^2.0.0",
- "scope": null,
- "escapedName": "readable-stream",
- "name": "readable-stream",
- "rawSpec": "^2.0.0",
- "spec": ">=2.0.0 <3.0.0",
- "type": "range"
- },
- "_requiredBy": [
- "/tar-stream"
- ],
- "_resolved": "https://registry.npm.taobao.org/readable-stream/download/readable-stream-2.2.6.tgz",
- "_shasum": "8b43aed76e71483938d12a8d46c6cf1a00b1f816",
- "_shrinkwrap": null,
- "_spec": "readable-stream@^2.0.0",
- "_where": "/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/tar-stream",
- "browser": {
- "util": false
- },
- "bugs": {
- "url": "https://github.com/nodejs/readable-stream/issues"
- },
- "dependencies": {
- "buffer-shims": "^1.0.0",
- "core-util-is": "~1.0.0",
- "inherits": "~2.0.1",
- "isarray": "~1.0.0",
- "process-nextick-args": "~1.0.6",
- "string_decoder": "~0.10.x",
- "util-deprecate": "~1.0.1"
- },
- "description": "Streams3, a user-land copy of the stream library from Node.js",
- "devDependencies": {
- "assert": "~1.4.0",
- "babel-polyfill": "^6.9.1",
- "buffer": "^4.9.0",
- "nyc": "^6.4.0",
- "tap": "~0.7.1",
- "tape": "~4.5.1",
- "zuul": "~3.10.0"
- },
- "directories": {},
- "dist": {
- "shasum": "8b43aed76e71483938d12a8d46c6cf1a00b1f816",
- "tarball": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.2.6.tgz"
- },
- "gitHead": "f94eebc1c5b637e6575735e6923ec79ee3139284",
- "homepage": "https://github.com/nodejs/readable-stream#readme",
- "keywords": [
- "readable",
- "stream",
- "pipe"
- ],
- "license": "MIT",
- "main": "readable.js",
- "maintainers": [
- {
- "name": "cwmma",
- "email": "calvin.metcalf@gmail.com"
- },
- {
- "name": "isaacs",
- "email": "i@izs.me"
- },
- {
- "name": "matteo.collina",
- "email": "hello@matteocollina.com"
- },
- {
- "name": "rvagg",
- "email": "rod@vagg.org"
- },
- {
- "name": "tootallnate",
- "email": "nathan@tootallnate.net"
- }
- ],
- "name": "readable-stream",
- "nyc": {
- "include": [
- "lib/**.js"
- ]
- },
- "optionalDependencies": {},
- "react-native": {
- "stream": false
- },
- "readme": "ERROR: No README data found!",
- "repository": {
- "type": "git",
- "url": "git://github.com/nodejs/readable-stream.git"
- },
- "scripts": {
- "browser": "npm run write-zuul && zuul --browser-retries 2 -- test/browser.js",
- "cover": "nyc npm test",
- "local": "zuul --local 3000 --no-coverage -- test/browser.js",
- "report": "nyc report --reporter=lcov",
- "test": "tap test/parallel/*.js test/ours/*.js",
- "write-zuul": "printf \"ui: tape\nbrowsers:\n - name: $BROWSER_NAME\n version: $BROWSER_VERSION\n\">.zuul.yml"
- },
- "version": "2.2.6"
-}
diff --git a/node_modules/tar-stream/node_modules/readable-stream/passthrough.js b/node_modules/tar-stream/node_modules/readable-stream/passthrough.js
deleted file mode 100644
index 27e8d8a..0000000
--- a/node_modules/tar-stream/node_modules/readable-stream/passthrough.js
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = require("./lib/_stream_passthrough.js")
diff --git a/node_modules/tar-stream/node_modules/readable-stream/readable.js b/node_modules/tar-stream/node_modules/readable-stream/readable.js
deleted file mode 100644
index be2688a..0000000
--- a/node_modules/tar-stream/node_modules/readable-stream/readable.js
+++ /dev/null
@@ -1,16 +0,0 @@
-var Stream = (function (){
- try {
- return require('st' + 'ream'); // hack to fix a circular dependency issue when used with browserify
- } catch(_){}
-}());
-exports = module.exports = require('./lib/_stream_readable.js');
-exports.Stream = Stream || exports;
-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' && Stream) {
- module.exports = Stream;
-}
diff --git a/node_modules/tar-stream/node_modules/readable-stream/transform.js b/node_modules/tar-stream/node_modules/readable-stream/transform.js
deleted file mode 100644
index 5d482f0..0000000
--- a/node_modules/tar-stream/node_modules/readable-stream/transform.js
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = require("./lib/_stream_transform.js")
diff --git a/node_modules/tar-stream/node_modules/readable-stream/writable.js b/node_modules/tar-stream/node_modules/readable-stream/writable.js
deleted file mode 100644
index e1e9efd..0000000
--- a/node_modules/tar-stream/node_modules/readable-stream/writable.js
+++ /dev/null
@@ -1 +0,0 @@
-module.exports = require("./lib/_stream_writable.js")
diff --git a/node_modules/tar-stream/package.json b/node_modules/tar-stream/package.json
index 26db3ca..92d59ef 100644
--- a/node_modules/tar-stream/package.json
+++ b/node_modules/tar-stream/package.json
@@ -28,14 +28,7 @@
"email": "mathiasbuus@gmail.com"
},
"_npmVersion": "2.15.1",
- "_phantomChildren": {
- "buffer-shims": "1.0.0",
- "core-util-is": "1.0.2",
- "inherits": "2.0.3",
- "process-nextick-args": "1.0.7",
- "string_decoder": "0.10.31",
- "util-deprecate": "1.0.2"
- },
+ "_phantomChildren": {},
"_requested": {
"raw": "tar-stream@^1.1.2",
"scope": null,
diff --git a/node_modules/util-deprecate/package.json b/node_modules/util-deprecate/package.json
index 4b13c08..fbdcf0c 100644
--- a/node_modules/util-deprecate/package.json
+++ b/node_modules/util-deprecate/package.json
@@ -10,7 +10,7 @@
"spec": ">=1.0.1 <1.1.0",
"type": "range"
},
- "/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/bl/node_modules/readable-stream"
+ "/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/readable-stream"
]
],
"_from": "util-deprecate@>=1.0.1 <1.1.0",
@@ -35,14 +35,13 @@
"type": "range"
},
"_requiredBy": [
- "/bl/readable-stream",
- "/tar-stream/readable-stream"
+ "/readable-stream"
],
"_resolved": "http://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
"_shasum": "450d4dc9fa70de732762fbd2d4a28981419a0ccf",
"_shrinkwrap": null,
"_spec": "util-deprecate@~1.0.1",
- "_where": "/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/bl/node_modules/readable-stream",
+ "_where": "/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/readable-stream",
"author": {
"name": "Nathan Rajlich",
"email": "nathan@tootallnate.net",
diff --git a/node_modules/ws/package.json b/node_modules/ws/package.json
index 3e48b84..2c1f7cf 100644
--- a/node_modules/ws/package.json
+++ b/node_modules/ws/package.json
@@ -2,18 +2,18 @@
"_args": [
[
{
- "raw": "ws",
+ "raw": "ws@^2.2.3",
"scope": null,
"escapedName": "ws",
"name": "ws",
- "rawSpec": "",
- "spec": "latest",
- "type": "tag"
+ "rawSpec": "^2.2.3",
+ "spec": ">=2.2.3 <3.0.0",
+ "type": "range"
},
"/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket"
]
],
- "_from": "ws@latest",
+ "_from": "ws@>=2.2.3 <3.0.0",
"_id": "ws@2.2.3",
"_inCache": true,
"_installable": true,
@@ -30,22 +30,21 @@
"_npmVersion": "4.2.0",
"_phantomChildren": {},
"_requested": {
- "raw": "ws",
+ "raw": "ws@^2.2.3",
"scope": null,
"escapedName": "ws",
"name": "ws",
- "rawSpec": "",
- "spec": "latest",
- "type": "tag"
+ "rawSpec": "^2.2.3",
+ "spec": ">=2.2.3 <3.0.0",
+ "type": "range"
},
"_requiredBy": [
- "#USER",
"/"
],
"_resolved": "http://registry.npmjs.org/ws/-/ws-2.2.3.tgz",
"_shasum": "f36c9719a56dff813f455af912a2078145bbd940",
"_shrinkwrap": null,
- "_spec": "ws",
+ "_spec": "ws@^2.2.3",
"_where": "/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket",
"author": {
"name": "Einar Otto Stangvik",
diff --git a/package.json b/package.json
index 43fff5a..0e33da6 100644
--- a/package.json
+++ b/package.json
@@ -25,6 +25,7 @@
"dependencies": {
"bufferutil": "^3.0.0",
"log4js": "^1.1.1",
+ "shadowsocks": "^1.5.3",
"ws": "^2.2.3"
}
}
diff --git a/server.js b/server.js
index 2aa45e2..069c079 100644
--- a/server.js
+++ b/server.js
@@ -2,8 +2,8 @@ const {
TCPRelay
} = require('./tcprelay');
new TCPRelay({
- serverAddress: '0.0.0.0',
- serverPort: process.env.PORT || 21001,
- password: 'ourvpn01010101',
- method: "aes-256-cfb"
-}, false, 'error').bootstrap();
\ No newline at end of file
+ serverAddress: process.env['SERVER_ADDRESS'] || '127.0.0.1',
+ serverPort: process.env['PORT'] || 1081,
+ password: process.env['password'] || 'shadowsocks-over-websocket',
+ method: process.env['method'] || 'aes-256-cfb'
+}, false, 'info').bootstrap();
\ No newline at end of file
diff --git a/tcprelay.js b/tcprelay.js
index 455c756..3db88b8 100644
--- a/tcprelay.js
+++ b/tcprelay.js
@@ -110,6 +110,12 @@ TCPRelay.prototype.bootstrap = function() {
this.init();
};
+TCPRelay.prototype.stop = function() {
+ if (this.server) {
+ this.server.close();
+ }
+};
+
TCPRelay.prototype.init = function() {
var self = this;
var config = self.config;