delete node modules
This commit is contained in:
1
node_modules/.bin/mkdirp
generated
vendored
1
node_modules/.bin/mkdirp
generated
vendored
@@ -1 +0,0 @@
|
||||
../mkdirp/bin/cmd.js
|
||||
1
node_modules/.bin/prebuild-install
generated
vendored
1
node_modules/.bin/prebuild-install
generated
vendored
@@ -1 +0,0 @@
|
||||
../prebuild-install/bin.js
|
||||
1
node_modules/.bin/rc
generated
vendored
1
node_modules/.bin/rc
generated
vendored
@@ -1 +0,0 @@
|
||||
../rc/index.js
|
||||
1
node_modules/.bin/semver
generated
vendored
1
node_modules/.bin/semver
generated
vendored
@@ -1 +0,0 @@
|
||||
../semver/bin/semver
|
||||
1
node_modules/.bin/sslocal
generated
vendored
1
node_modules/.bin/sslocal
generated
vendored
@@ -1 +0,0 @@
|
||||
../shadowsocks/bin/sslocal
|
||||
1
node_modules/.bin/ssserver
generated
vendored
1
node_modules/.bin/ssserver
generated
vendored
@@ -1 +0,0 @@
|
||||
../shadowsocks/bin/ssserver
|
||||
4
node_modules/ansi-regex/index.js
generated
vendored
4
node_modules/ansi-regex/index.js
generated
vendored
@@ -1,4 +0,0 @@
|
||||
'use strict';
|
||||
module.exports = function () {
|
||||
return /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-PRZcf-nqry=><]/g;
|
||||
};
|
||||
21
node_modules/ansi-regex/license
generated
vendored
21
node_modules/ansi-regex/license
generated
vendored
@@ -1,21 +0,0 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.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.
|
||||
132
node_modules/ansi-regex/package.json
generated
vendored
132
node_modules/ansi-regex/package.json
generated
vendored
@@ -1,132 +0,0 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "ansi-regex@^2.0.0",
|
||||
"scope": null,
|
||||
"escapedName": "ansi-regex",
|
||||
"name": "ansi-regex",
|
||||
"rawSpec": "^2.0.0",
|
||||
"spec": ">=2.0.0 <3.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/strip-ansi"
|
||||
]
|
||||
],
|
||||
"_from": "ansi-regex@>=2.0.0 <3.0.0",
|
||||
"_id": "ansi-regex@2.1.1",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/ansi-regex",
|
||||
"_nodeVersion": "0.10.32",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-18-east.internal.npmjs.com",
|
||||
"tmp": "tmp/ansi-regex-2.1.1.tgz_1484363378013_0.4482989883981645"
|
||||
},
|
||||
"_npmUser": {
|
||||
"name": "qix",
|
||||
"email": "i.am.qix@gmail.com"
|
||||
},
|
||||
"_npmVersion": "2.14.2",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "ansi-regex@^2.0.0",
|
||||
"scope": null,
|
||||
"escapedName": "ansi-regex",
|
||||
"name": "ansi-regex",
|
||||
"rawSpec": "^2.0.0",
|
||||
"spec": ">=2.0.0 <3.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/strip-ansi"
|
||||
],
|
||||
"_resolved": "http://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
|
||||
"_shasum": "c3b33ab5ee360d86e0e628f0468ae7ef27d654df",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "ansi-regex@^2.0.0",
|
||||
"_where": "/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/strip-ansi",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/chalk/ansi-regex/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "Regular expression for matching ANSI escape codes",
|
||||
"devDependencies": {
|
||||
"ava": "0.17.0",
|
||||
"xo": "0.16.0"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "c3b33ab5ee360d86e0e628f0468ae7ef27d654df",
|
||||
"tarball": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"gitHead": "7c908e7b4eb6cd82bfe1295e33fdf6d166c7ed85",
|
||||
"homepage": "https://github.com/chalk/ansi-regex#readme",
|
||||
"keywords": [
|
||||
"ansi",
|
||||
"styles",
|
||||
"color",
|
||||
"colour",
|
||||
"colors",
|
||||
"terminal",
|
||||
"console",
|
||||
"cli",
|
||||
"string",
|
||||
"tty",
|
||||
"escape",
|
||||
"formatting",
|
||||
"rgb",
|
||||
"256",
|
||||
"shell",
|
||||
"xterm",
|
||||
"command-line",
|
||||
"text",
|
||||
"regex",
|
||||
"regexp",
|
||||
"re",
|
||||
"match",
|
||||
"test",
|
||||
"find",
|
||||
"pattern"
|
||||
],
|
||||
"license": "MIT",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "qix",
|
||||
"email": "i.am.qix@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "sindresorhus",
|
||||
"email": "sindresorhus@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "ansi-regex",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/chalk/ansi-regex.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava --verbose",
|
||||
"view-supported": "node fixtures/view-codes.js"
|
||||
},
|
||||
"version": "2.1.1",
|
||||
"xo": {
|
||||
"rules": {
|
||||
"guard-for-in": 0,
|
||||
"no-loop-func": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
39
node_modules/ansi-regex/readme.md
generated
vendored
39
node_modules/ansi-regex/readme.md
generated
vendored
@@ -1,39 +0,0 @@
|
||||
# ansi-regex [](https://travis-ci.org/chalk/ansi-regex)
|
||||
|
||||
> Regular expression for matching [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code)
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save ansi-regex
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const ansiRegex = require('ansi-regex');
|
||||
|
||||
ansiRegex().test('\u001b[4mcake\u001b[0m');
|
||||
//=> true
|
||||
|
||||
ansiRegex().test('cake');
|
||||
//=> false
|
||||
|
||||
'\u001b[4mcake\u001b[0m'.match(ansiRegex());
|
||||
//=> ['\u001b[4m', '\u001b[0m']
|
||||
```
|
||||
|
||||
## FAQ
|
||||
|
||||
### Why do you test for codes not in the ECMA 48 standard?
|
||||
|
||||
Some of the codes we run as a test are codes that we acquired finding various lists of non-standard or manufacturer specific codes. If I recall correctly, we test for both standard and non-standard codes, as most of them follow the same or similar format and can be safely matched in strings without the risk of removing actual string content. There are a few non-standard control codes that do not follow the traditional format (i.e. they end in numbers) thus forcing us to exclude them from the test because we cannot reliably match them.
|
||||
|
||||
On the historical side, those ECMA standards were established in the early 90's whereas the VT100, for example, was designed in the mid/late 70's. At that point in time, control codes were still pretty ungoverned and engineers used them for a multitude of things, namely to activate hardware ports that may have been proprietary. Somewhere else you see a similar 'anarchy' of codes is in the x86 architecture for processors; there are a ton of "interrupts" that can mean different things on certain brands of processors, most of which have been phased out.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](http://sindresorhus.com)
|
||||
14
node_modules/aproba/LICENSE
generated
vendored
14
node_modules/aproba/LICENSE
generated
vendored
@@ -1,14 +0,0 @@
|
||||
Copyright (c) 2015, Rebecca Turner <me@re-becca.org>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
89
node_modules/aproba/README.md
generated
vendored
89
node_modules/aproba/README.md
generated
vendored
@@ -1,89 +0,0 @@
|
||||
aproba
|
||||
======
|
||||
|
||||
A ridiculously light-weight function argument validator
|
||||
|
||||
```
|
||||
var validate = require("aproba")
|
||||
|
||||
function myfunc(a, b, c) {
|
||||
// `a` must be a string, `b` a number, `c` a function
|
||||
validate('SNF', arguments) // [a,b,c] is also valid
|
||||
}
|
||||
|
||||
myfunc('test', 23, function () {}) // ok
|
||||
myfunc(123, 23, function () {}) // type error
|
||||
myfunc('test', 23) // missing arg error
|
||||
myfunc('test', 23, function () {}, true) // too many args error
|
||||
|
||||
```
|
||||
|
||||
Valid types are:
|
||||
|
||||
type | description
|
||||
---- | -----------
|
||||
* | matches any type
|
||||
A | Array.isArray OR an arguments object
|
||||
S | typeof == string
|
||||
N | typeof == number
|
||||
F | typeof == function
|
||||
O | typeof == object and not type A and not type E
|
||||
B | typeof == boolean
|
||||
E | instanceof Error OR null **(special: see below)**
|
||||
Z | == null
|
||||
|
||||
Validation failures throw one of three exception types, distinguished by a
|
||||
`code` property of `EMISSINGARG`, `EINVALIDTYPE` or `ETOOMANYARGS`.
|
||||
|
||||
If you pass in an invalid type then it will throw with a code of
|
||||
`EUNKNOWNTYPE`.
|
||||
|
||||
If an **error** argument is found and is not null then the remaining
|
||||
arguments are optional. That is, if you say `ESO` then that's like using a
|
||||
non-magical `E` in: `E|ESO|ZSO`.
|
||||
|
||||
### But I have optional arguments?!
|
||||
|
||||
You can provide more than one signature by separating them with pipes `|`.
|
||||
If any signature matches the arguments then they'll be considered valid.
|
||||
|
||||
So for example, say you wanted to write a signature for
|
||||
`fs.createWriteStream`. The docs for it describe it thusly:
|
||||
|
||||
```
|
||||
fs.createWriteStream(path[, options])
|
||||
```
|
||||
|
||||
This would be a signature of `SO|S`. That is, a string and and object, or
|
||||
just a string.
|
||||
|
||||
Now, if you read the full `fs` docs, you'll see that actually path can ALSO
|
||||
be a buffer. And options can be a string, that is:
|
||||
```
|
||||
path <String> | <Buffer>
|
||||
options <String> | <Object>
|
||||
```
|
||||
|
||||
To reproduce this you have to fully enumerate all of the possible
|
||||
combinations and that implies a signature of `SO|SS|OO|OS|S|O`. The
|
||||
awkwardness is a feature: It reminds you of the complexity you're adding to
|
||||
your API when you do this sort of thing.
|
||||
|
||||
|
||||
### Why this exists
|
||||
|
||||
I wanted a very simple argument validator. It needed to do two things:
|
||||
|
||||
1. Be more concise and easier to use than assertions
|
||||
|
||||
2. Not encourage an infinite bikeshed of DSLs
|
||||
|
||||
This is why types are specified by a single character and there's no such
|
||||
thing as an optional argument.
|
||||
|
||||
This is not intended to validate user data. This is specifically about
|
||||
asserting the interface of your functions.
|
||||
|
||||
If you need greater validation, I encourage you to write them by hand or
|
||||
look elsewhere.
|
||||
|
||||
103
node_modules/aproba/index.js
generated
vendored
103
node_modules/aproba/index.js
generated
vendored
@@ -1,103 +0,0 @@
|
||||
'use strict'
|
||||
|
||||
function isArguments (thingy) {
|
||||
return thingy != null && typeof thingy === 'object' && thingy.hasOwnProperty('callee')
|
||||
}
|
||||
|
||||
var types = {
|
||||
'*': {label: 'any', check: function () { return true }},
|
||||
A: {label: 'array', check: function (thingy) { return Array.isArray(thingy) || isArguments(thingy) }},
|
||||
S: {label: 'string', check: function (thingy) { return typeof thingy === 'string' }},
|
||||
N: {label: 'number', check: function (thingy) { return typeof thingy === 'number' }},
|
||||
F: {label: 'function', check: function (thingy) { return typeof thingy === 'function' }},
|
||||
O: {label: 'object', check: function (thingy) { return typeof thingy === 'object' && thingy != null && !types.A.check(thingy) && !types.E.check(thingy) }},
|
||||
B: {label: 'boolean', check: function (thingy) { return typeof thingy === 'boolean' }},
|
||||
E: {label: 'error', check: function (thingy) { return thingy instanceof Error }},
|
||||
Z: {label: 'null', check: function (thingy) { return thingy == null }}
|
||||
}
|
||||
|
||||
var validate = module.exports = function (rawSchemas, args) {
|
||||
if (arguments.length !== 2) throw wrongNumberOfArgs(['SA'], arguments.length)
|
||||
if (!rawSchemas) throw missingRequiredArg(0, 'rawSchemas')
|
||||
if (!args) throw missingRequiredArg(1, 'args')
|
||||
if (!types.S.check(rawSchemas)) throw invalidType(0, ['string'], rawSchemas)
|
||||
if (!types.A.check(args)) throw invalidType(1, ['array'], args)
|
||||
var schemas = rawSchemas.split('|')
|
||||
var arity = {}
|
||||
function addSchema (schema) {
|
||||
var group = arity[schema.length] = arity[schema.length] || []
|
||||
if (group.indexOf(schema) === -1) group.push(schema)
|
||||
}
|
||||
schemas.forEach(function (schema) {
|
||||
for (var ii = 0; ii < schema.length; ++ii) {
|
||||
var type = schema[ii]
|
||||
if (!types[type]) throw unknownType(ii, type)
|
||||
}
|
||||
if (/E.*E/.test(schema)) throw moreThanOneError(schema)
|
||||
addSchema(schema)
|
||||
if (/E/.test(schema)) {
|
||||
addSchema(schema.replace(/E.*$/, 'E'))
|
||||
addSchema(schema.replace(/E/, 'Z'))
|
||||
if (schema.length === 1) addSchema('')
|
||||
}
|
||||
})
|
||||
var matching = arity[args.length]
|
||||
if (!matching) {
|
||||
throw wrongNumberOfArgs(Object.keys(arity), args.length)
|
||||
}
|
||||
for (var ii = 0; ii < args.length; ++ii) {
|
||||
var newMatching = matching.filter(function (schema) {
|
||||
var type = schema[ii]
|
||||
var typeCheck = types[type].check
|
||||
return typeCheck(args[ii])
|
||||
})
|
||||
if (!newMatching.length) {
|
||||
var labels = matching.map(function (schema) {
|
||||
return types[schema[ii]].label
|
||||
}).filter(function (schema) { return schema != null })
|
||||
throw invalidType(ii, labels, args[ii])
|
||||
}
|
||||
matching = newMatching
|
||||
}
|
||||
}
|
||||
|
||||
function missingRequiredArg (num) {
|
||||
return newException('EMISSINGARG', 'Missing required argument #' + (num + 1))
|
||||
}
|
||||
|
||||
function unknownType (num, type) {
|
||||
return newException('EUNKNOWNTYPE', 'Unknown type ' + type + ' in argument #' + (num + 1))
|
||||
}
|
||||
|
||||
function invalidType (num, expectedTypes, value) {
|
||||
var valueType
|
||||
Object.keys(types).forEach(function (typeCode) {
|
||||
if (types[typeCode].check(value)) valueType = types[typeCode].label
|
||||
})
|
||||
return newException('EINVALIDTYPE', 'Argument #' + (num + 1) + ': Expected ' +
|
||||
englishList(expectedTypes) + ' but got ' + valueType)
|
||||
}
|
||||
|
||||
function englishList (list) {
|
||||
return list.join(', ').replace(/, ([^,]+)$/, ' or $1')
|
||||
}
|
||||
|
||||
function wrongNumberOfArgs (expected, got) {
|
||||
var english = englishList(expected)
|
||||
var args = expected.every(function (ex) { return ex.length === 1 })
|
||||
? 'argument'
|
||||
: 'arguments'
|
||||
return newException('EWRONGARGCOUNT', 'Expected ' + english + ' ' + args + ' but got ' + got)
|
||||
}
|
||||
|
||||
function moreThanOneError (schema) {
|
||||
return newException('ETOOMANYERRORTYPES',
|
||||
'Only one error type per argument signature is allowed, more than one found in "' + schema + '"')
|
||||
}
|
||||
|
||||
function newException (code, msg) {
|
||||
var e = new Error(msg)
|
||||
e.code = code
|
||||
Error.captureStackTrace(e, validate)
|
||||
return e
|
||||
}
|
||||
98
node_modules/aproba/package.json
generated
vendored
98
node_modules/aproba/package.json
generated
vendored
@@ -1,98 +0,0 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "aproba@^1.0.3",
|
||||
"scope": null,
|
||||
"escapedName": "aproba",
|
||||
"name": "aproba",
|
||||
"rawSpec": "^1.0.3",
|
||||
"spec": ">=1.0.3 <2.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/gauge"
|
||||
]
|
||||
],
|
||||
"_cnpm_publish_time": 1486593131372,
|
||||
"_from": "aproba@>=1.0.3 <2.0.0",
|
||||
"_id": "aproba@1.1.1",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/aproba",
|
||||
"_nodeVersion": "7.5.0",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-18-east.internal.npmjs.com",
|
||||
"tmp": "tmp/aproba-1.1.1.tgz_1486593129508_0.5718816472217441"
|
||||
},
|
||||
"_npmUser": {
|
||||
"name": "iarna",
|
||||
"email": "me@re-becca.org"
|
||||
},
|
||||
"_npmVersion": "4.2.0",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "aproba@^1.0.3",
|
||||
"scope": null,
|
||||
"escapedName": "aproba",
|
||||
"name": "aproba",
|
||||
"rawSpec": "^1.0.3",
|
||||
"spec": ">=1.0.3 <2.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/gauge"
|
||||
],
|
||||
"_resolved": "https://registry.npm.taobao.org/aproba/download/aproba-1.1.1.tgz",
|
||||
"_shasum": "95d3600f07710aa0e9298c726ad5ecf2eacbabab",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "aproba@^1.0.3",
|
||||
"_where": "/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/gauge",
|
||||
"author": {
|
||||
"name": "Rebecca Turner",
|
||||
"email": "me@re-becca.org"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/iarna/aproba/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "A rediculously light-weight argument validator",
|
||||
"devDependencies": {
|
||||
"standard": "^8.6.0",
|
||||
"tap": "^10.0.2"
|
||||
},
|
||||
"directories": {
|
||||
"test": "test"
|
||||
},
|
||||
"dist": {
|
||||
"shasum": "95d3600f07710aa0e9298c726ad5ecf2eacbabab",
|
||||
"tarball": "https://registry.npmjs.org/aproba/-/aproba-1.1.1.tgz"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"gitHead": "e7c76b4b42356092db3cd9e2d9388a0134845eb2",
|
||||
"homepage": "https://github.com/iarna/aproba",
|
||||
"keywords": [
|
||||
"argument",
|
||||
"validate"
|
||||
],
|
||||
"license": "ISC",
|
||||
"main": "index.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "iarna",
|
||||
"email": "me@re-becca.org"
|
||||
}
|
||||
],
|
||||
"name": "aproba",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/iarna/aproba.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "standard && tap -j3 test/*.js"
|
||||
},
|
||||
"version": "1.1.1"
|
||||
}
|
||||
5
node_modules/are-we-there-yet/.npmignore
generated
vendored
5
node_modules/are-we-there-yet/.npmignore
generated
vendored
@@ -1,5 +0,0 @@
|
||||
*~
|
||||
.#*
|
||||
node_modules
|
||||
coverage
|
||||
.nyc_output
|
||||
19
node_modules/are-we-there-yet/CHANGES.md
generated
vendored
19
node_modules/are-we-there-yet/CHANGES.md
generated
vendored
@@ -1,19 +0,0 @@
|
||||
Hi, figured we could actually use a changelog now:
|
||||
|
||||
## 1.1.1 2016-01-29
|
||||
|
||||
* Fix a typo in stream completion tracker
|
||||
|
||||
## 1.1.0 2016-01-29
|
||||
|
||||
* Rewrote completion percent computation to be low impact– no more walking a
|
||||
tree of completion groups every time we need this info. Previously, with
|
||||
medium sized tree of completion groups, even a relatively modest number of
|
||||
calls to the top level `completed()` method would result in absurd numbers
|
||||
of calls overall as it walked down the tree. We now, instead, keep track as
|
||||
we bubble up changes, so the computation is limited to when data changes and
|
||||
to the depth of that one branch, instead of _every_ node. (Plus, we were already
|
||||
incurring _this_ cost, since we already bubbled out changes.)
|
||||
* Moved different tracker types out to their own files.
|
||||
* Made tests test for TOO MANY events too.
|
||||
* Standarized the source code formatting
|
||||
5
node_modules/are-we-there-yet/LICENSE
generated
vendored
5
node_modules/are-we-there-yet/LICENSE
generated
vendored
@@ -1,5 +0,0 @@
|
||||
Copyright (c) 2015, Rebecca Turner
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
194
node_modules/are-we-there-yet/README.md
generated
vendored
194
node_modules/are-we-there-yet/README.md
generated
vendored
@@ -1,194 +0,0 @@
|
||||
are-we-there-yet
|
||||
----------------
|
||||
|
||||
Track complex hiearchies of asynchronous task completion statuses. This is
|
||||
intended to give you a way of recording and reporting the progress of the big
|
||||
recursive fan-out and gather type workflows that are so common in async.
|
||||
|
||||
What you do with this completion data is up to you, but the most common use case is to
|
||||
feed it to one of the many progress bar modules.
|
||||
|
||||
Most progress bar modules include a rudamentary version of this, but my
|
||||
needs were more complex.
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
```javascript
|
||||
var TrackerGroup = require("are-we-there-yet").TrackerGroup
|
||||
|
||||
var top = new TrackerGroup("program")
|
||||
|
||||
var single = top.newItem("one thing", 100)
|
||||
single.completeWork(20)
|
||||
|
||||
console.log(top.completed()) // 0.2
|
||||
|
||||
fs.stat("file", function(er, stat) {
|
||||
if (er) throw er
|
||||
var stream = top.newStream("file", stat.size)
|
||||
console.log(top.completed()) // now 0.1 as single is 50% of the job and is 20% complete
|
||||
// and 50% * 20% == 10%
|
||||
fs.createReadStream("file").pipe(stream).on("data", function (chunk) {
|
||||
// do stuff with chunk
|
||||
})
|
||||
top.on("change", function (name) {
|
||||
// called each time a chunk is read from "file"
|
||||
// top.completed() will start at 0.1 and fill up to 0.6 as the file is read
|
||||
})
|
||||
})
|
||||
```
|
||||
|
||||
Shared Methods
|
||||
==============
|
||||
|
||||
All tracker objects described below have the following methods, they, along
|
||||
with the event comprise the interface for consumers of tracker objects.
|
||||
|
||||
* var completed = tracker.completed()
|
||||
|
||||
Returns the ratio of completed work to work to be done. Range of 0 to 1.
|
||||
|
||||
* tracker.finish()
|
||||
|
||||
Marks the tracker as completed. With a TrackerGroup this marks all of its
|
||||
components as completed.
|
||||
|
||||
Marks all of the components of this tracker as finished, which in turn means
|
||||
that `tracker.completed()` for this will now be 1.
|
||||
|
||||
This will result in one or more `change` events being emitted.
|
||||
|
||||
Events
|
||||
======
|
||||
|
||||
All tracker objects emit `change` events with the following arguments:
|
||||
|
||||
```
|
||||
function (name, completed, tracker)
|
||||
```
|
||||
|
||||
`name` is the name of the tracker that originally emitted the event,
|
||||
or if it didn't have one, the first containing tracker group that had one.
|
||||
|
||||
`completed` is the percent complete (as returned by `tracker.completed()` method).
|
||||
|
||||
`tracker` is the tracker object that you are listening for events on.
|
||||
|
||||
TrackerGroup
|
||||
============
|
||||
|
||||
* var tracker = new TrackerGroup(**name**)
|
||||
|
||||
* **name** *(optional)* - The name of this tracker group, used in change
|
||||
notifications if the component updating didn't have a name. Defaults to undefined.
|
||||
|
||||
Creates a new empty tracker aggregation group. These are trackers whose
|
||||
completion status is determined by the completion status of other trackers.
|
||||
|
||||
* tracker.addUnit(**otherTracker**, **weight**)
|
||||
|
||||
* **otherTracker** - Any of the other are-we-there-yet tracker objects
|
||||
* **weight** *(optional)* - The weight to give the tracker, defaults to 1.
|
||||
|
||||
Adds the **otherTracker** to this aggregation group. The weight determines
|
||||
how long you expect this tracker to take to complete in proportion to other
|
||||
units. So for instance, if you add one tracker with a weight of 1 and
|
||||
another with a weight of 2, you're saying the second will take twice as long
|
||||
to complete as the first. As such, the first will account for 33% of the
|
||||
completion of this tracker and the second will account for the other 67%.
|
||||
|
||||
Returns **otherTracker**.
|
||||
|
||||
* var subGroup = tracker.newGroup(**name**, **weight**)
|
||||
|
||||
The above is exactly equivalent to:
|
||||
|
||||
```javascript
|
||||
var subGroup = tracker.addUnit(new TrackerGroup(name), weight)
|
||||
```
|
||||
|
||||
* var subItem = tracker.newItem(**name**, **todo**, **weight**)
|
||||
|
||||
The above is exactly equivalent to:
|
||||
|
||||
```javascript
|
||||
var subItem = tracker.addUnit(new Tracker(name, todo), weight)
|
||||
```
|
||||
|
||||
* var subStream = tracker.newStream(**name**, **todo**, **weight**)
|
||||
|
||||
The above is exactly equivalent to:
|
||||
|
||||
```javascript
|
||||
var subStream = tracker.addUnit(new TrackerStream(name, todo), weight)
|
||||
```
|
||||
|
||||
* console.log( tracker.debug() )
|
||||
|
||||
Returns a tree showing the completion of this tracker group and all of its
|
||||
children, including recursively entering all of the children.
|
||||
|
||||
Tracker
|
||||
=======
|
||||
|
||||
* var tracker = new Tracker(**name**, **todo**)
|
||||
|
||||
* **name** *(optional)* The name of this counter to report in change
|
||||
events. Defaults to undefined.
|
||||
* **todo** *(optional)* The amount of work todo (a number). Defaults to 0.
|
||||
|
||||
Ordinarily these are constructed as a part of a tracker group (via
|
||||
`newItem`).
|
||||
|
||||
* var completed = tracker.completed()
|
||||
|
||||
Returns the ratio of completed work to work to be done. Range of 0 to 1. If
|
||||
total work to be done is 0 then it will return 0.
|
||||
|
||||
* tracker.addWork(**todo**)
|
||||
|
||||
* **todo** A number to add to the amount of work to be done.
|
||||
|
||||
Increases the amount of work to be done, thus decreasing the completion
|
||||
percentage. Triggers a `change` event.
|
||||
|
||||
* tracker.completeWork(**completed**)
|
||||
|
||||
* **completed** A number to add to the work complete
|
||||
|
||||
Increase the amount of work complete, thus increasing the completion percentage.
|
||||
Will never increase the work completed past the amount of work todo. That is,
|
||||
percentages > 100% are not allowed. Triggers a `change` event.
|
||||
|
||||
* tracker.finish()
|
||||
|
||||
Marks this tracker as finished, tracker.completed() will now be 1. Triggers
|
||||
a `change` event.
|
||||
|
||||
TrackerStream
|
||||
=============
|
||||
|
||||
* var tracker = new TrackerStream(**name**, **size**, **options**)
|
||||
|
||||
* **name** *(optional)* The name of this counter to report in change
|
||||
events. Defaults to undefined.
|
||||
* **size** *(optional)* The number of bytes being sent through this stream.
|
||||
* **options** *(optional)* A hash of stream options
|
||||
|
||||
The tracker stream object is a pass through stream that updates an internal
|
||||
tracker object each time a block passes through. It's intended to track
|
||||
downloads, file extraction and other related activities. You use it by piping
|
||||
your data source into it and then using it as your data source.
|
||||
|
||||
If your data has a length attribute then that's used as the amount of work
|
||||
completed when the chunk is passed through. If it does not (eg, object
|
||||
streams) then each chunk counts as completing 1 unit of work, so your size
|
||||
should be the total number of objects being streamed.
|
||||
|
||||
* tracker.addWork(**todo**)
|
||||
|
||||
* **todo** Increase the expected overall size by **todo** bytes.
|
||||
|
||||
Increases the amount of work to be done, thus decreasing the completion
|
||||
percentage. Triggers a `change` event.
|
||||
4
node_modules/are-we-there-yet/index.js
generated
vendored
4
node_modules/are-we-there-yet/index.js
generated
vendored
@@ -1,4 +0,0 @@
|
||||
'use strict'
|
||||
exports.TrackerGroup = require('./tracker-group.js')
|
||||
exports.Tracker = require('./tracker.js')
|
||||
exports.TrackerStream = require('./tracker-stream.js')
|
||||
91
node_modules/are-we-there-yet/package.json
generated
vendored
91
node_modules/are-we-there-yet/package.json
generated
vendored
@@ -1,91 +0,0 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "are-we-there-yet@~1.1.2",
|
||||
"scope": null,
|
||||
"escapedName": "are-we-there-yet",
|
||||
"name": "are-we-there-yet",
|
||||
"rawSpec": "~1.1.2",
|
||||
"spec": ">=1.1.2 <1.2.0",
|
||||
"type": "range"
|
||||
},
|
||||
"/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/npmlog"
|
||||
]
|
||||
],
|
||||
"_from": "are-we-there-yet@>=1.1.2 <1.2.0",
|
||||
"_id": "are-we-there-yet@1.1.2",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/are-we-there-yet",
|
||||
"_nodeVersion": "4.2.2",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-13-west.internal.npmjs.com",
|
||||
"tmp": "tmp/are-we-there-yet-1.1.2.tgz_1458084397358_0.15847722673788667"
|
||||
},
|
||||
"_npmUser": {
|
||||
"name": "iarna",
|
||||
"email": "me@re-becca.org"
|
||||
},
|
||||
"_npmVersion": "3.8.1",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "are-we-there-yet@~1.1.2",
|
||||
"scope": null,
|
||||
"escapedName": "are-we-there-yet",
|
||||
"name": "are-we-there-yet",
|
||||
"rawSpec": "~1.1.2",
|
||||
"spec": ">=1.1.2 <1.2.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/npmlog"
|
||||
],
|
||||
"_resolved": "http://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.2.tgz",
|
||||
"_shasum": "80e470e95a084794fe1899262c5667c6e88de1b3",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "are-we-there-yet@~1.1.2",
|
||||
"_where": "/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/npmlog",
|
||||
"author": {
|
||||
"name": "Rebecca Turner",
|
||||
"url": "http://re-becca.org"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/iarna/are-we-there-yet/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"delegates": "^1.0.0",
|
||||
"readable-stream": "^2.0.0 || ^1.1.13"
|
||||
},
|
||||
"description": "Keep track of the overall completion of many dispirate processes",
|
||||
"devDependencies": {
|
||||
"standard": "^6.0.8",
|
||||
"tap": "^5.7.0"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "80e470e95a084794fe1899262c5667c6e88de1b3",
|
||||
"tarball": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.2.tgz"
|
||||
},
|
||||
"gitHead": "dd5706e2204cb681e78031d0ffe156ed4cc75823",
|
||||
"homepage": "https://github.com/iarna/are-we-there-yet",
|
||||
"license": "ISC",
|
||||
"main": "index.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "iarna",
|
||||
"email": "me@re-becca.org"
|
||||
}
|
||||
],
|
||||
"name": "are-we-there-yet",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/iarna/are-we-there-yet.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "standard && tap test/*.js"
|
||||
},
|
||||
"version": "1.1.2"
|
||||
}
|
||||
29
node_modules/are-we-there-yet/test/lib/test-event.js
generated
vendored
29
node_modules/are-we-there-yet/test/lib/test-event.js
generated
vendored
@@ -1,29 +0,0 @@
|
||||
'use strict'
|
||||
var util = require('util')
|
||||
|
||||
module.exports = function (obj, event, next) {
|
||||
var timeout = setTimeout(gotTimeout, 10)
|
||||
obj.once(event, gotResult)
|
||||
|
||||
function gotTimeout () {
|
||||
obj.removeListener(event, gotResult)
|
||||
next(new Error('Timeout listening for ' + event))
|
||||
}
|
||||
var result = []
|
||||
function gotResult () {
|
||||
result = Array.prototype.slice.call(arguments)
|
||||
clearTimeout(timeout)
|
||||
timeout = setTimeout(gotNoMoreResults, 10)
|
||||
obj.once(event, gotTooManyResults)
|
||||
}
|
||||
function gotNoMoreResults () {
|
||||
obj.removeListener(event, gotTooManyResults)
|
||||
var args = [null].concat(result)
|
||||
next.apply(null, args)
|
||||
}
|
||||
function gotTooManyResults () {
|
||||
var secondResult = Array.prototype.slice.call(arguments)
|
||||
clearTimeout(timeout)
|
||||
next(new Error('Got too many results, first ' + util.inspect(result) + ' and then ' + util.inspect(secondResult)))
|
||||
}
|
||||
}
|
||||
57
node_modules/are-we-there-yet/test/tracker.js
generated
vendored
57
node_modules/are-we-there-yet/test/tracker.js
generated
vendored
@@ -1,57 +0,0 @@
|
||||
'use strict'
|
||||
var test = require('tap').test
|
||||
var Tracker = require('../index.js').Tracker
|
||||
|
||||
var testEvent = require('./lib/test-event.js')
|
||||
|
||||
var name = 'test'
|
||||
|
||||
test('initialization', function (t) {
|
||||
var simple = new Tracker(name)
|
||||
|
||||
t.is(simple.completed(), 0, 'Nothing todo is 0 completion')
|
||||
t.done()
|
||||
})
|
||||
|
||||
var track
|
||||
var todo = 100
|
||||
test('completion', function (t) {
|
||||
track = new Tracker(name, todo)
|
||||
t.is(track.completed(), 0, 'Nothing done is 0 completion')
|
||||
|
||||
testEvent(track, 'change', afterCompleteWork)
|
||||
|
||||
track.completeWork(todo)
|
||||
t.is(track.completed(), 1, 'completeWork: 100% completed')
|
||||
|
||||
function afterCompleteWork (er, onChangeName) {
|
||||
t.is(er, null, 'completeWork: on change event fired')
|
||||
t.is(onChangeName, name, 'completeWork: on change emits the correct name')
|
||||
t.done()
|
||||
}
|
||||
})
|
||||
|
||||
test('add more work', function (t) {
|
||||
testEvent(track, 'change', afterAddWork)
|
||||
track.addWork(todo)
|
||||
t.is(track.completed(), 0.5, 'addWork: 50% completed')
|
||||
function afterAddWork (er, onChangeName) {
|
||||
t.is(er, null, 'addWork: on change event fired')
|
||||
t.is(onChangeName, name, 'addWork: on change emits the correct name')
|
||||
t.done()
|
||||
}
|
||||
})
|
||||
|
||||
test('complete more work', function (t) {
|
||||
track.completeWork(200)
|
||||
t.is(track.completed(), 1, 'completeWork: Over completion is still only 100% complete')
|
||||
t.done()
|
||||
})
|
||||
|
||||
test('finish is always 100%', function (t) {
|
||||
var finishtest = new Tracker(name, todo)
|
||||
finishtest.completeWork(50)
|
||||
finishtest.finish()
|
||||
t.is(finishtest.completed(), 1, 'finish: Explicitly finishing moves to 100%')
|
||||
t.done()
|
||||
})
|
||||
96
node_modules/are-we-there-yet/test/trackergroup.js
generated
vendored
96
node_modules/are-we-there-yet/test/trackergroup.js
generated
vendored
@@ -1,96 +0,0 @@
|
||||
'use strict'
|
||||
var test = require('tap').test
|
||||
var TrackerGroup = require('../index.js').TrackerGroup
|
||||
var testEvent = require('./lib/test-event.js')
|
||||
|
||||
test('TrackerGroup', function (t) {
|
||||
var name = 'test'
|
||||
|
||||
var track = new TrackerGroup(name)
|
||||
t.is(track.completed(), 0, 'Nothing todo is 0 completion')
|
||||
testEvent(track, 'change', afterFinishEmpty)
|
||||
track.finish()
|
||||
var a, b
|
||||
function afterFinishEmpty (er, onChangeName, completion) {
|
||||
t.is(er, null, 'finishEmpty: on change event fired')
|
||||
t.is(onChangeName, name, 'finishEmpty: on change emits the correct name')
|
||||
t.is(completion, 1, 'finishEmpty: passed through completion was correct')
|
||||
t.is(track.completed(), 1, 'finishEmpty: Finishing an empty group actually finishes it')
|
||||
|
||||
track = new TrackerGroup(name)
|
||||
a = track.newItem('a', 10, 1)
|
||||
b = track.newItem('b', 10, 1)
|
||||
t.is(track.completed(), 0, 'Initially empty')
|
||||
testEvent(track, 'change', afterCompleteWork)
|
||||
a.completeWork(5)
|
||||
}
|
||||
function afterCompleteWork (er, onChangeName, completion) {
|
||||
t.is(er, null, 'on change event fired')
|
||||
t.is(onChangeName, 'a', 'on change emits the correct name')
|
||||
t.is(completion, 0.25, 'Complete half of one is a quarter overall')
|
||||
t.is(track.completed(), 0.25, 'Complete half of one is a quarter overall')
|
||||
testEvent(track, 'change', afterFinishAll)
|
||||
track.finish()
|
||||
}
|
||||
function afterFinishAll (er, onChangeName, completion) {
|
||||
t.is(er, null, 'finishAll: on change event fired')
|
||||
t.is(onChangeName, name, 'finishAll: on change emits the correct name')
|
||||
t.is(completion, 1, 'Finishing everything ')
|
||||
t.is(track.completed(), 1, 'Finishing everything ')
|
||||
|
||||
track = new TrackerGroup(name)
|
||||
a = track.newItem('a', 10, 2)
|
||||
b = track.newItem('b', 10, 1)
|
||||
t.is(track.completed(), 0, 'weighted: Initially empty')
|
||||
testEvent(track, 'change', afterWeightedCompleteWork)
|
||||
a.completeWork(5)
|
||||
}
|
||||
function afterWeightedCompleteWork (er, onChangeName, completion) {
|
||||
t.is(er, null, 'weighted: on change event fired')
|
||||
t.is(onChangeName, 'a', 'weighted: on change emits the correct name')
|
||||
t.is(Math.floor(completion * 100), 33, 'weighted: Complete half of double weighted')
|
||||
t.is(Math.floor(track.completed() * 100), 33, 'weighted: Complete half of double weighted')
|
||||
testEvent(track, 'change', afterWeightedFinishAll)
|
||||
track.finish()
|
||||
}
|
||||
function afterWeightedFinishAll (er, onChangeName, completion) {
|
||||
t.is(er, null, 'weightedFinishAll: on change event fired')
|
||||
t.is(onChangeName, name, 'weightedFinishAll: on change emits the correct name')
|
||||
t.is(completion, 1, 'weightedFinishaAll: Finishing everything ')
|
||||
t.is(track.completed(), 1, 'weightedFinishaAll: Finishing everything ')
|
||||
|
||||
track = new TrackerGroup(name)
|
||||
a = track.newGroup('a', 10)
|
||||
b = track.newGroup('b', 10)
|
||||
var a1 = a.newItem('a.1', 10)
|
||||
a1.completeWork(5)
|
||||
t.is(track.completed(), 0.25, 'nested: Initially quarter done')
|
||||
testEvent(track, 'change', afterNestedComplete)
|
||||
b.finish()
|
||||
}
|
||||
function afterNestedComplete (er, onChangeName, completion) {
|
||||
t.is(er, null, 'nestedComplete: on change event fired')
|
||||
t.is(onChangeName, 'b', 'nestedComplete: on change emits the correct name')
|
||||
t.is(completion, 0.75, 'nestedComplete: Finishing everything ')
|
||||
t.is(track.completed(), 0.75, 'nestedComplete: Finishing everything ')
|
||||
t.end()
|
||||
}
|
||||
})
|
||||
|
||||
test('cycles', function (t) {
|
||||
var track = new TrackerGroup('top')
|
||||
testCycle(track, track)
|
||||
var layer1 = track.newGroup('layer1')
|
||||
testCycle(layer1, track)
|
||||
t.end()
|
||||
|
||||
function testCycle (addTo, toAdd) {
|
||||
try {
|
||||
addTo.addUnit(toAdd)
|
||||
t.fail(toAdd.name)
|
||||
} catch (ex) {
|
||||
console.log(ex)
|
||||
t.pass(toAdd.name)
|
||||
}
|
||||
}
|
||||
})
|
||||
51
node_modules/are-we-there-yet/test/trackerstream.js
generated
vendored
51
node_modules/are-we-there-yet/test/trackerstream.js
generated
vendored
@@ -1,51 +0,0 @@
|
||||
'use strict'
|
||||
var test = require('tap').test
|
||||
var util = require('util')
|
||||
var stream = require('readable-stream')
|
||||
var TrackerStream = require('../index.js').TrackerStream
|
||||
var testEvent = require('./lib/test-event.js')
|
||||
|
||||
var Sink = function () {
|
||||
stream.Writable.apply(this, arguments)
|
||||
}
|
||||
util.inherits(Sink, stream.Writable)
|
||||
Sink.prototype._write = function (data, encoding, cb) {
|
||||
cb()
|
||||
}
|
||||
|
||||
test('TrackerStream', function (t) {
|
||||
t.plan(9)
|
||||
|
||||
var name = 'test'
|
||||
var track = new TrackerStream(name)
|
||||
|
||||
t.is(track.completed(), 0, 'Nothing todo is 0 completion')
|
||||
|
||||
var todo = 10
|
||||
track = new TrackerStream(name, todo)
|
||||
t.is(track.completed(), 0, 'Nothing done is 0 completion')
|
||||
|
||||
track.pipe(new Sink())
|
||||
|
||||
testEvent(track, 'change', afterCompleteWork)
|
||||
track.write('0123456789')
|
||||
function afterCompleteWork (er, onChangeName) {
|
||||
t.is(er, null, 'write: on change event fired')
|
||||
t.is(onChangeName, name, 'write: on change emits the correct name')
|
||||
t.is(track.completed(), 1, 'write: 100% completed')
|
||||
|
||||
testEvent(track, 'change', afterAddWork)
|
||||
track.addWork(10)
|
||||
}
|
||||
function afterAddWork (er, onChangeName) {
|
||||
t.is(er, null, 'addWork: on change event fired')
|
||||
t.is(track.completed(), 0.5, 'addWork: 50% completed')
|
||||
|
||||
testEvent(track, 'change', afterAllWork)
|
||||
track.write('ABCDEFGHIJKLMNOPQRST')
|
||||
}
|
||||
function afterAllWork (er) {
|
||||
t.is(er, null, 'allWork: on change event fired')
|
||||
t.is(track.completed(), 1, 'allWork: 100% completed')
|
||||
}
|
||||
})
|
||||
11
node_modules/are-we-there-yet/tracker-base.js
generated
vendored
11
node_modules/are-we-there-yet/tracker-base.js
generated
vendored
@@ -1,11 +0,0 @@
|
||||
'use strict'
|
||||
var EventEmitter = require('events').EventEmitter
|
||||
var util = require('util')
|
||||
|
||||
var trackerId = 0
|
||||
var TrackerBase = module.exports = function (name) {
|
||||
EventEmitter.call(this)
|
||||
this.id = ++trackerId
|
||||
this.name = name
|
||||
}
|
||||
util.inherits(TrackerBase, EventEmitter)
|
||||
107
node_modules/are-we-there-yet/tracker-group.js
generated
vendored
107
node_modules/are-we-there-yet/tracker-group.js
generated
vendored
@@ -1,107 +0,0 @@
|
||||
'use strict'
|
||||
var util = require('util')
|
||||
var TrackerBase = require('./tracker-base.js')
|
||||
var Tracker = require('./tracker.js')
|
||||
var TrackerStream = require('./tracker-stream.js')
|
||||
|
||||
var TrackerGroup = module.exports = function (name) {
|
||||
TrackerBase.call(this, name)
|
||||
this.parentGroup = null
|
||||
this.trackers = []
|
||||
this.completion = {}
|
||||
this.weight = {}
|
||||
this.totalWeight = 0
|
||||
this.finished = false
|
||||
this.bubbleChange = bubbleChange(this)
|
||||
}
|
||||
util.inherits(TrackerGroup, TrackerBase)
|
||||
|
||||
function bubbleChange (trackerGroup) {
|
||||
return function (name, completed, tracker) {
|
||||
trackerGroup.completion[tracker.id] = completed
|
||||
if (trackerGroup.finished) return
|
||||
trackerGroup.emit('change', name || trackerGroup.name, trackerGroup.completed(), trackerGroup)
|
||||
}
|
||||
}
|
||||
|
||||
TrackerGroup.prototype.nameInTree = function () {
|
||||
var names = []
|
||||
var from = this
|
||||
while (from) {
|
||||
names.unshift(from.name)
|
||||
from = from.parentGroup
|
||||
}
|
||||
return names.join('/')
|
||||
}
|
||||
|
||||
TrackerGroup.prototype.addUnit = function (unit, weight) {
|
||||
if (unit.addUnit) {
|
||||
var toTest = this
|
||||
while (toTest) {
|
||||
if (unit === toTest) {
|
||||
throw new Error(
|
||||
'Attempted to add tracker group ' +
|
||||
unit.name + ' to tree that already includes it ' +
|
||||
this.nameInTree(this))
|
||||
}
|
||||
toTest = toTest.parentGroup
|
||||
}
|
||||
unit.parentGroup = this
|
||||
}
|
||||
this.weight[unit.id] = weight || 1
|
||||
this.totalWeight += this.weight[unit.id]
|
||||
this.trackers.push(unit)
|
||||
this.completion[unit.id] = unit.completed()
|
||||
unit.on('change', this.bubbleChange)
|
||||
if (!this.finished) this.emit('change', unit.name, this.completion[unit.id], unit)
|
||||
return unit
|
||||
}
|
||||
|
||||
TrackerGroup.prototype.completed = function () {
|
||||
if (this.trackers.length === 0) return 0
|
||||
var valPerWeight = 1 / this.totalWeight
|
||||
var completed = 0
|
||||
for (var ii = 0; ii < this.trackers.length; ii++) {
|
||||
var trackerId = this.trackers[ii].id
|
||||
completed += valPerWeight * this.weight[trackerId] * this.completion[trackerId]
|
||||
}
|
||||
return completed
|
||||
}
|
||||
|
||||
TrackerGroup.prototype.newGroup = function (name, weight) {
|
||||
return this.addUnit(new TrackerGroup(name), weight)
|
||||
}
|
||||
|
||||
TrackerGroup.prototype.newItem = function (name, todo, weight) {
|
||||
return this.addUnit(new Tracker(name, todo), weight)
|
||||
}
|
||||
|
||||
TrackerGroup.prototype.newStream = function (name, todo, weight) {
|
||||
return this.addUnit(new TrackerStream(name, todo), weight)
|
||||
}
|
||||
|
||||
TrackerGroup.prototype.finish = function () {
|
||||
this.finished = true
|
||||
if (!this.trackers.length) this.addUnit(new Tracker(), 1, true)
|
||||
for (var ii = 0; ii < this.trackers.length; ii++) {
|
||||
var tracker = this.trackers[ii]
|
||||
tracker.finish()
|
||||
tracker.removeListener('change', this.bubbleChange)
|
||||
}
|
||||
this.emit('change', this.name, 1, this)
|
||||
}
|
||||
|
||||
var buffer = ' '
|
||||
TrackerGroup.prototype.debug = function (depth) {
|
||||
depth = depth || 0
|
||||
var indent = depth ? buffer.substr(0, depth) : ''
|
||||
var output = indent + (this.name || 'top') + ': ' + this.completed() + '\n'
|
||||
this.trackers.forEach(function (tracker) {
|
||||
if (tracker instanceof TrackerGroup) {
|
||||
output += tracker.debug(depth + 1)
|
||||
} else {
|
||||
output += indent + ' ' + tracker.name + ': ' + tracker.completed() + '\n'
|
||||
}
|
||||
})
|
||||
return output
|
||||
}
|
||||
35
node_modules/are-we-there-yet/tracker-stream.js
generated
vendored
35
node_modules/are-we-there-yet/tracker-stream.js
generated
vendored
@@ -1,35 +0,0 @@
|
||||
'use strict'
|
||||
var util = require('util')
|
||||
var stream = require('readable-stream')
|
||||
var delegate = require('delegates')
|
||||
var Tracker = require('./tracker.js')
|
||||
|
||||
var TrackerStream = module.exports = function (name, size, options) {
|
||||
stream.Transform.call(this, options)
|
||||
this.tracker = new Tracker(name, size)
|
||||
this.name = name
|
||||
this.id = this.tracker.id
|
||||
this.tracker.on('change', delegateChange(this))
|
||||
}
|
||||
util.inherits(TrackerStream, stream.Transform)
|
||||
|
||||
function delegateChange (trackerStream) {
|
||||
return function (name, completion, tracker) {
|
||||
trackerStream.emit('change', name, completion, trackerStream)
|
||||
}
|
||||
}
|
||||
|
||||
TrackerStream.prototype._transform = function (data, encoding, cb) {
|
||||
this.tracker.completeWork(data.length ? data.length : 1)
|
||||
this.push(data)
|
||||
cb()
|
||||
}
|
||||
|
||||
TrackerStream.prototype._flush = function (cb) {
|
||||
this.tracker.finish()
|
||||
cb()
|
||||
}
|
||||
|
||||
delegate(TrackerStream.prototype, 'tracker')
|
||||
.method('completed')
|
||||
.method('addWork')
|
||||
30
node_modules/are-we-there-yet/tracker.js
generated
vendored
30
node_modules/are-we-there-yet/tracker.js
generated
vendored
@@ -1,30 +0,0 @@
|
||||
'use strict'
|
||||
var util = require('util')
|
||||
var TrackerBase = require('./tracker-base.js')
|
||||
|
||||
var Tracker = module.exports = function (name, todo) {
|
||||
TrackerBase.call(this, name)
|
||||
this.workDone = 0
|
||||
this.workTodo = todo || 0
|
||||
}
|
||||
util.inherits(Tracker, TrackerBase)
|
||||
|
||||
Tracker.prototype.completed = function () {
|
||||
return this.workTodo === 0 ? 0 : this.workDone / this.workTodo
|
||||
}
|
||||
|
||||
Tracker.prototype.addWork = function (work) {
|
||||
this.workTodo += work
|
||||
this.emit('change', this.name, this.completed(), this)
|
||||
}
|
||||
|
||||
Tracker.prototype.completeWork = function (work) {
|
||||
this.workDone += work
|
||||
if (this.workDone > this.workTodo) this.workDone = this.workTodo
|
||||
this.emit('change', this.name, this.completed(), this)
|
||||
}
|
||||
|
||||
Tracker.prototype.finish = function () {
|
||||
this.workTodo = this.workDone = 1
|
||||
this.emit('change', this.name, 1, this)
|
||||
}
|
||||
97
node_modules/bindings/README.md
generated
vendored
97
node_modules/bindings/README.md
generated
vendored
@@ -1,97 +0,0 @@
|
||||
node-bindings
|
||||
=============
|
||||
### Helper module for loading your native module's .node file
|
||||
|
||||
This is a helper module for authors of Node.js native addon modules.
|
||||
It is basically the "swiss army knife" of `require()`ing your native module's
|
||||
`.node` file.
|
||||
|
||||
Throughout the course of Node's native addon history, addons have ended up being
|
||||
compiled in a variety of different places, depending on which build tool and which
|
||||
version of node was used. To make matters worse, now the _gyp_ build tool can
|
||||
produce either a _Release_ or _Debug_ build, each being built into different
|
||||
locations.
|
||||
|
||||
This module checks _all_ the possible locations that a native addon would be built
|
||||
at, and returns the first one that loads successfully.
|
||||
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
Install with `npm`:
|
||||
|
||||
``` bash
|
||||
$ npm install bindings
|
||||
```
|
||||
|
||||
Or add it to the `"dependencies"` section of your _package.json_ file.
|
||||
|
||||
|
||||
Example
|
||||
-------
|
||||
|
||||
`require()`ing the proper bindings file for the current node version, platform
|
||||
and architecture is as simple as:
|
||||
|
||||
``` js
|
||||
var bindings = require('bindings')('binding.node')
|
||||
|
||||
// Use your bindings defined in your C files
|
||||
bindings.your_c_function()
|
||||
```
|
||||
|
||||
|
||||
Nice Error Output
|
||||
-----------------
|
||||
|
||||
When the `.node` file could not be loaded, `node-bindings` throws an Error with
|
||||
a nice error message telling you exactly what was tried. You can also check the
|
||||
`err.tries` Array property.
|
||||
|
||||
```
|
||||
Error: Could not load the bindings file. Tried:
|
||||
→ /Users/nrajlich/ref/build/binding.node
|
||||
→ /Users/nrajlich/ref/build/Debug/binding.node
|
||||
→ /Users/nrajlich/ref/build/Release/binding.node
|
||||
→ /Users/nrajlich/ref/out/Debug/binding.node
|
||||
→ /Users/nrajlich/ref/Debug/binding.node
|
||||
→ /Users/nrajlich/ref/out/Release/binding.node
|
||||
→ /Users/nrajlich/ref/Release/binding.node
|
||||
→ /Users/nrajlich/ref/build/default/binding.node
|
||||
→ /Users/nrajlich/ref/compiled/0.8.2/darwin/x64/binding.node
|
||||
at bindings (/Users/nrajlich/ref/node_modules/bindings/bindings.js:84:13)
|
||||
at Object.<anonymous> (/Users/nrajlich/ref/lib/ref.js:5:47)
|
||||
at Module._compile (module.js:449:26)
|
||||
at Object.Module._extensions..js (module.js:467:10)
|
||||
at Module.load (module.js:356:32)
|
||||
at Function.Module._load (module.js:312:12)
|
||||
...
|
||||
```
|
||||
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2012 Nathan Rajlich <nathan@tootallnate.net>
|
||||
|
||||
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.
|
||||
166
node_modules/bindings/bindings.js
generated
vendored
166
node_modules/bindings/bindings.js
generated
vendored
@@ -1,166 +0,0 @@
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var fs = require('fs')
|
||||
, path = require('path')
|
||||
, join = path.join
|
||||
, dirname = path.dirname
|
||||
, exists = fs.existsSync || path.existsSync
|
||||
, defaults = {
|
||||
arrow: process.env.NODE_BINDINGS_ARROW || ' → '
|
||||
, compiled: process.env.NODE_BINDINGS_COMPILED_DIR || 'compiled'
|
||||
, platform: process.platform
|
||||
, arch: process.arch
|
||||
, version: process.versions.node
|
||||
, bindings: 'bindings.node'
|
||||
, try: [
|
||||
// node-gyp's linked version in the "build" dir
|
||||
[ 'module_root', 'build', 'bindings' ]
|
||||
// node-waf and gyp_addon (a.k.a node-gyp)
|
||||
, [ 'module_root', 'build', 'Debug', 'bindings' ]
|
||||
, [ 'module_root', 'build', 'Release', 'bindings' ]
|
||||
// Debug files, for development (legacy behavior, remove for node v0.9)
|
||||
, [ 'module_root', 'out', 'Debug', 'bindings' ]
|
||||
, [ 'module_root', 'Debug', 'bindings' ]
|
||||
// Release files, but manually compiled (legacy behavior, remove for node v0.9)
|
||||
, [ 'module_root', 'out', 'Release', 'bindings' ]
|
||||
, [ 'module_root', 'Release', 'bindings' ]
|
||||
// Legacy from node-waf, node <= 0.4.x
|
||||
, [ 'module_root', 'build', 'default', 'bindings' ]
|
||||
// Production "Release" buildtype binary (meh...)
|
||||
, [ 'module_root', 'compiled', 'version', 'platform', 'arch', 'bindings' ]
|
||||
]
|
||||
}
|
||||
|
||||
/**
|
||||
* The main `bindings()` function loads the compiled bindings for a given module.
|
||||
* It uses V8's Error API to determine the parent filename that this function is
|
||||
* being invoked from, which is then used to find the root directory.
|
||||
*/
|
||||
|
||||
function bindings (opts) {
|
||||
|
||||
// Argument surgery
|
||||
if (typeof opts == 'string') {
|
||||
opts = { bindings: opts }
|
||||
} else if (!opts) {
|
||||
opts = {}
|
||||
}
|
||||
opts.__proto__ = defaults
|
||||
|
||||
// Get the module root
|
||||
if (!opts.module_root) {
|
||||
opts.module_root = exports.getRoot(exports.getFileName())
|
||||
}
|
||||
|
||||
// Ensure the given bindings name ends with .node
|
||||
if (path.extname(opts.bindings) != '.node') {
|
||||
opts.bindings += '.node'
|
||||
}
|
||||
|
||||
var tries = []
|
||||
, i = 0
|
||||
, l = opts.try.length
|
||||
, n
|
||||
, b
|
||||
, err
|
||||
|
||||
for (; i<l; i++) {
|
||||
n = join.apply(null, opts.try[i].map(function (p) {
|
||||
return opts[p] || p
|
||||
}))
|
||||
tries.push(n)
|
||||
try {
|
||||
b = opts.path ? require.resolve(n) : require(n)
|
||||
if (!opts.path) {
|
||||
b.path = n
|
||||
}
|
||||
return b
|
||||
} catch (e) {
|
||||
if (!/not find/i.test(e.message)) {
|
||||
throw e
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
err = new Error('Could not locate the bindings file. Tried:\n'
|
||||
+ tries.map(function (a) { return opts.arrow + a }).join('\n'))
|
||||
err.tries = tries
|
||||
throw err
|
||||
}
|
||||
module.exports = exports = bindings
|
||||
|
||||
|
||||
/**
|
||||
* Gets the filename of the JavaScript file that invokes this function.
|
||||
* Used to help find the root directory of a module.
|
||||
* Optionally accepts an filename argument to skip when searching for the invoking filename
|
||||
*/
|
||||
|
||||
exports.getFileName = function getFileName (calling_file) {
|
||||
var origPST = Error.prepareStackTrace
|
||||
, origSTL = Error.stackTraceLimit
|
||||
, dummy = {}
|
||||
, fileName
|
||||
|
||||
Error.stackTraceLimit = 10
|
||||
|
||||
Error.prepareStackTrace = function (e, st) {
|
||||
for (var i=0, l=st.length; i<l; i++) {
|
||||
fileName = st[i].getFileName()
|
||||
if (fileName !== __filename) {
|
||||
if (calling_file) {
|
||||
if (fileName !== calling_file) {
|
||||
return
|
||||
}
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// run the 'prepareStackTrace' function above
|
||||
Error.captureStackTrace(dummy)
|
||||
dummy.stack
|
||||
|
||||
// cleanup
|
||||
Error.prepareStackTrace = origPST
|
||||
Error.stackTraceLimit = origSTL
|
||||
|
||||
return fileName
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the root directory of a module, given an arbitrary filename
|
||||
* somewhere in the module tree. The "root directory" is the directory
|
||||
* containing the `package.json` file.
|
||||
*
|
||||
* In: /home/nate/node-native-module/lib/index.js
|
||||
* Out: /home/nate/node-native-module
|
||||
*/
|
||||
|
||||
exports.getRoot = function getRoot (file) {
|
||||
var dir = dirname(file)
|
||||
, prev
|
||||
while (true) {
|
||||
if (dir === '.') {
|
||||
// Avoids an infinite loop in rare cases, like the REPL
|
||||
dir = process.cwd()
|
||||
}
|
||||
if (exists(join(dir, 'package.json')) || exists(join(dir, 'node_modules'))) {
|
||||
// Found the 'package.json' file or 'node_modules' dir; we're done
|
||||
return dir
|
||||
}
|
||||
if (prev === dir) {
|
||||
// Got to the top
|
||||
throw new Error('Could not find module root given file: "' + file
|
||||
+ '". Do you have a `package.json` file? ')
|
||||
}
|
||||
// Try the parent dir next
|
||||
prev = dir
|
||||
dir = join(dir, '..')
|
||||
}
|
||||
}
|
||||
92
node_modules/bindings/package.json
generated
vendored
92
node_modules/bindings/package.json
generated
vendored
@@ -1,92 +0,0 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "bindings@~1.2.1",
|
||||
"scope": null,
|
||||
"escapedName": "bindings",
|
||||
"name": "bindings",
|
||||
"rawSpec": "~1.2.1",
|
||||
"spec": ">=1.2.1 <1.3.0",
|
||||
"type": "range"
|
||||
},
|
||||
"/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/bufferutil"
|
||||
]
|
||||
],
|
||||
"_from": "bindings@>=1.2.1 <1.3.0",
|
||||
"_id": "bindings@1.2.1",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/bindings",
|
||||
"_npmUser": {
|
||||
"name": "tootallnate",
|
||||
"email": "nathan@tootallnate.net"
|
||||
},
|
||||
"_npmVersion": "1.4.14",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "bindings@~1.2.1",
|
||||
"scope": null,
|
||||
"escapedName": "bindings",
|
||||
"name": "bindings",
|
||||
"rawSpec": "~1.2.1",
|
||||
"spec": ">=1.2.1 <1.3.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/bufferutil"
|
||||
],
|
||||
"_resolved": "http://registry.npmjs.org/bindings/-/bindings-1.2.1.tgz",
|
||||
"_shasum": "14ad6113812d2d37d72e67b4cacb4bb726505f11",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "bindings@~1.2.1",
|
||||
"_where": "/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/bufferutil",
|
||||
"author": {
|
||||
"name": "Nathan Rajlich",
|
||||
"email": "nathan@tootallnate.net",
|
||||
"url": "http://tootallnate.net"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/TooTallNate/node-bindings/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "Helper module for loading your native module's .node file",
|
||||
"devDependencies": {},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "14ad6113812d2d37d72e67b4cacb4bb726505f11",
|
||||
"tarball": "https://registry.npmjs.org/bindings/-/bindings-1.2.1.tgz"
|
||||
},
|
||||
"gitHead": "e404152ee27f8478ccbc7122ee051246e8e5ec02",
|
||||
"homepage": "https://github.com/TooTallNate/node-bindings",
|
||||
"keywords": [
|
||||
"native",
|
||||
"addon",
|
||||
"bindings",
|
||||
"gyp",
|
||||
"waf",
|
||||
"c",
|
||||
"c++"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "./bindings.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "TooTallNate",
|
||||
"email": "nathan@tootallnate.net"
|
||||
},
|
||||
{
|
||||
"name": "tootallnate",
|
||||
"email": "nathan@tootallnate.net"
|
||||
}
|
||||
],
|
||||
"name": "bindings",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/TooTallNate/node-bindings.git"
|
||||
},
|
||||
"scripts": {},
|
||||
"version": "1.2.1"
|
||||
}
|
||||
59
node_modules/bl/.jshintrc
generated
vendored
59
node_modules/bl/.jshintrc
generated
vendored
@@ -1,59 +0,0 @@
|
||||
{
|
||||
"predef": [ ]
|
||||
, "bitwise": false
|
||||
, "camelcase": false
|
||||
, "curly": false
|
||||
, "eqeqeq": false
|
||||
, "forin": false
|
||||
, "immed": false
|
||||
, "latedef": false
|
||||
, "noarg": true
|
||||
, "noempty": true
|
||||
, "nonew": true
|
||||
, "plusplus": false
|
||||
, "quotmark": true
|
||||
, "regexp": false
|
||||
, "undef": true
|
||||
, "unused": true
|
||||
, "strict": false
|
||||
, "trailing": true
|
||||
, "maxlen": 120
|
||||
, "asi": true
|
||||
, "boss": true
|
||||
, "debug": true
|
||||
, "eqnull": true
|
||||
, "esnext": true
|
||||
, "evil": true
|
||||
, "expr": true
|
||||
, "funcscope": false
|
||||
, "globalstrict": false
|
||||
, "iterator": false
|
||||
, "lastsemic": true
|
||||
, "laxbreak": true
|
||||
, "laxcomma": true
|
||||
, "loopfunc": true
|
||||
, "multistr": false
|
||||
, "onecase": false
|
||||
, "proto": false
|
||||
, "regexdash": false
|
||||
, "scripturl": true
|
||||
, "smarttabs": false
|
||||
, "shadow": false
|
||||
, "sub": true
|
||||
, "supernew": false
|
||||
, "validthis": true
|
||||
, "browser": true
|
||||
, "couch": false
|
||||
, "devel": false
|
||||
, "dojo": false
|
||||
, "mootools": false
|
||||
, "node": true
|
||||
, "nonstandard": true
|
||||
, "prototypejs": false
|
||||
, "rhino": false
|
||||
, "worker": true
|
||||
, "wsh": false
|
||||
, "nomen": false
|
||||
, "onevar": false
|
||||
, "passfail": false
|
||||
}
|
||||
1
node_modules/bl/.npmignore
generated
vendored
1
node_modules/bl/.npmignore
generated
vendored
@@ -1 +0,0 @@
|
||||
node_modules/
|
||||
15
node_modules/bl/.travis.yml
generated
vendored
15
node_modules/bl/.travis.yml
generated
vendored
@@ -1,15 +0,0 @@
|
||||
sudo: false
|
||||
language: node_js
|
||||
node_js:
|
||||
- '0.10'
|
||||
- '0.12'
|
||||
- '4'
|
||||
- '6'
|
||||
- '7'
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
notifications:
|
||||
email:
|
||||
- rod@vagg.org
|
||||
- matteo.collina@gmail.com
|
||||
13
node_modules/bl/LICENSE.md
generated
vendored
13
node_modules/bl/LICENSE.md
generated
vendored
@@ -1,13 +0,0 @@
|
||||
The MIT License (MIT)
|
||||
=====================
|
||||
|
||||
Copyright (c) 2013-2016 bl contributors
|
||||
----------------------------------
|
||||
|
||||
*bl contributors listed at <https://github.com/rvagg/bl#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.
|
||||
208
node_modules/bl/README.md
generated
vendored
208
node_modules/bl/README.md
generated
vendored
@@ -1,208 +0,0 @@
|
||||
# bl *(BufferList)*
|
||||
|
||||
[](https://travis-ci.org/rvagg/bl)
|
||||
|
||||
**A Node.js Buffer list collector, reader and streamer thingy.**
|
||||
|
||||
[](https://nodei.co/npm/bl/)
|
||||
[](https://nodei.co/npm/bl/)
|
||||
|
||||
**bl** is a storage object for collections of Node Buffers, exposing them with the main Buffer readable API. Also works as a duplex stream so you can collect buffers from a stream that emits them and emit buffers to a stream that consumes them!
|
||||
|
||||
The original buffers are kept intact and copies are only done as necessary. Any reads that require the use of a single original buffer will return a slice of that buffer only (which references the same memory as the original buffer). Reads that span buffers perform concatenation as required and return the results transparently.
|
||||
|
||||
```js
|
||||
const BufferList = require('bl')
|
||||
|
||||
var bl = new BufferList()
|
||||
bl.append(new Buffer('abcd'))
|
||||
bl.append(new Buffer('efg'))
|
||||
bl.append('hi') // bl will also accept & convert Strings
|
||||
bl.append(new Buffer('j'))
|
||||
bl.append(new Buffer([ 0x3, 0x4 ]))
|
||||
|
||||
console.log(bl.length) // 12
|
||||
|
||||
console.log(bl.slice(0, 10).toString('ascii')) // 'abcdefghij'
|
||||
console.log(bl.slice(3, 10).toString('ascii')) // 'defghij'
|
||||
console.log(bl.slice(3, 6).toString('ascii')) // 'def'
|
||||
console.log(bl.slice(3, 8).toString('ascii')) // 'defgh'
|
||||
console.log(bl.slice(5, 10).toString('ascii')) // 'fghij'
|
||||
|
||||
// or just use toString!
|
||||
console.log(bl.toString()) // 'abcdefghij\u0003\u0004'
|
||||
console.log(bl.toString('ascii', 3, 8)) // 'defgh'
|
||||
console.log(bl.toString('ascii', 5, 10)) // 'fghij'
|
||||
|
||||
// other standard Buffer readables
|
||||
console.log(bl.readUInt16BE(10)) // 0x0304
|
||||
console.log(bl.readUInt16LE(10)) // 0x0403
|
||||
```
|
||||
|
||||
Give it a callback in the constructor and use it just like **[concat-stream](https://github.com/maxogden/node-concat-stream)**:
|
||||
|
||||
```js
|
||||
const bl = require('bl')
|
||||
, fs = require('fs')
|
||||
|
||||
fs.createReadStream('README.md')
|
||||
.pipe(bl(function (err, data) { // note 'new' isn't strictly required
|
||||
// `data` is a complete Buffer object containing the full data
|
||||
console.log(data.toString())
|
||||
}))
|
||||
```
|
||||
|
||||
Note that when you use the *callback* method like this, the resulting `data` parameter is a concatenation of all `Buffer` objects in the list. If you want to avoid the overhead of this concatenation (in cases of extreme performance consciousness), then avoid the *callback* method and just listen to `'end'` instead, like a standard Stream.
|
||||
|
||||
Or to fetch a URL using [hyperquest](https://github.com/substack/hyperquest) (should work with [request](http://github.com/mikeal/request) and even plain Node http too!):
|
||||
```js
|
||||
const hyperquest = require('hyperquest')
|
||||
, bl = require('bl')
|
||||
, url = 'https://raw.github.com/rvagg/bl/master/README.md'
|
||||
|
||||
hyperquest(url).pipe(bl(function (err, data) {
|
||||
console.log(data.toString())
|
||||
}))
|
||||
```
|
||||
|
||||
Or, use it as a readable stream to recompose a list of Buffers to an output source:
|
||||
|
||||
```js
|
||||
const BufferList = require('bl')
|
||||
, fs = require('fs')
|
||||
|
||||
var bl = new BufferList()
|
||||
bl.append(new Buffer('abcd'))
|
||||
bl.append(new Buffer('efg'))
|
||||
bl.append(new Buffer('hi'))
|
||||
bl.append(new Buffer('j'))
|
||||
|
||||
bl.pipe(fs.createWriteStream('gibberish.txt'))
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
* <a href="#ctor"><code><b>new BufferList([ callback ])</b></code></a>
|
||||
* <a href="#length"><code>bl.<b>length</b></code></a>
|
||||
* <a href="#append"><code>bl.<b>append(buffer)</b></code></a>
|
||||
* <a href="#get"><code>bl.<b>get(index)</b></code></a>
|
||||
* <a href="#slice"><code>bl.<b>slice([ start[, end ] ])</b></code></a>
|
||||
* <a href="#shallowSlice"><code>bl.<b>shallowSlice([ start[, end ] ])</b></code></a>
|
||||
* <a href="#copy"><code>bl.<b>copy(dest, [ destStart, [ srcStart [, srcEnd ] ] ])</b></code></a>
|
||||
* <a href="#duplicate"><code>bl.<b>duplicate()</b></code></a>
|
||||
* <a href="#consume"><code>bl.<b>consume(bytes)</b></code></a>
|
||||
* <a href="#toString"><code>bl.<b>toString([encoding, [ start, [ end ]]])</b></code></a>
|
||||
* <a href="#readXX"><code>bl.<b>readDoubleBE()</b></code>, <code>bl.<b>readDoubleLE()</b></code>, <code>bl.<b>readFloatBE()</b></code>, <code>bl.<b>readFloatLE()</b></code>, <code>bl.<b>readInt32BE()</b></code>, <code>bl.<b>readInt32LE()</b></code>, <code>bl.<b>readUInt32BE()</b></code>, <code>bl.<b>readUInt32LE()</b></code>, <code>bl.<b>readInt16BE()</b></code>, <code>bl.<b>readInt16LE()</b></code>, <code>bl.<b>readUInt16BE()</b></code>, <code>bl.<b>readUInt16LE()</b></code>, <code>bl.<b>readInt8()</b></code>, <code>bl.<b>readUInt8()</b></code></a>
|
||||
* <a href="#streams">Streams</a>
|
||||
|
||||
--------------------------------------------------------
|
||||
<a name="ctor"></a>
|
||||
### new BufferList([ callback | Buffer | Buffer array | BufferList | BufferList array | String ])
|
||||
The constructor takes an optional callback, if supplied, the callback will be called with an error argument followed by a reference to the **bl** instance, when `bl.end()` is called (i.e. from a piped stream). This is a convenient method of collecting the entire contents of a stream, particularly when the stream is *chunky*, such as a network stream.
|
||||
|
||||
Normally, no arguments are required for the constructor, but you can initialise the list by passing in a single `Buffer` object or an array of `Buffer` object.
|
||||
|
||||
`new` is not strictly required, if you don't instantiate a new object, it will be done automatically for you so you can create a new instance simply with:
|
||||
|
||||
```js
|
||||
var bl = require('bl')
|
||||
var myinstance = bl()
|
||||
|
||||
// equivilant to:
|
||||
|
||||
var BufferList = require('bl')
|
||||
var myinstance = new BufferList()
|
||||
```
|
||||
|
||||
--------------------------------------------------------
|
||||
<a name="length"></a>
|
||||
### bl.length
|
||||
Get the length of the list in bytes. This is the sum of the lengths of all of the buffers contained in the list, minus any initial offset for a semi-consumed buffer at the beginning. Should accurately represent the total number of bytes that can be read from the list.
|
||||
|
||||
--------------------------------------------------------
|
||||
<a name="append"></a>
|
||||
### bl.append(Buffer | Buffer array | BufferList | BufferList array | String)
|
||||
`append(buffer)` adds an additional buffer or BufferList to the internal list. `this` is returned so it can be chained.
|
||||
|
||||
--------------------------------------------------------
|
||||
<a name="get"></a>
|
||||
### bl.get(index)
|
||||
`get()` will return the byte at the specified index.
|
||||
|
||||
--------------------------------------------------------
|
||||
<a name="slice"></a>
|
||||
### bl.slice([ start, [ end ] ])
|
||||
`slice()` returns a new `Buffer` object containing the bytes within the range specified. Both `start` and `end` are optional and will default to the beginning and end of the list respectively.
|
||||
|
||||
If the requested range spans a single internal buffer then a slice of that buffer will be returned which shares the original memory range of that Buffer. If the range spans multiple buffers then copy operations will likely occur to give you a uniform Buffer.
|
||||
|
||||
--------------------------------------------------------
|
||||
<a name="shallowSlice"></a>
|
||||
### bl.shallowSlice([ start, [ end ] ])
|
||||
`shallowSlice()` returns a new `BufferList` object containing the bytes within the range specified. Both `start` and `end` are optional and will default to the beginning and end of the list respectively.
|
||||
|
||||
No copies will be performed. All buffers in the result share memory with the original list.
|
||||
|
||||
--------------------------------------------------------
|
||||
<a name="copy"></a>
|
||||
### bl.copy(dest, [ destStart, [ srcStart [, srcEnd ] ] ])
|
||||
`copy()` copies the content of the list in the `dest` buffer, starting from `destStart` and containing the bytes within the range specified with `srcStart` to `srcEnd`. `destStart`, `start` and `end` are optional and will default to the beginning of the `dest` buffer, and the beginning and end of the list respectively.
|
||||
|
||||
--------------------------------------------------------
|
||||
<a name="duplicate"></a>
|
||||
### bl.duplicate()
|
||||
`duplicate()` performs a **shallow-copy** of the list. The internal Buffers remains the same, so if you change the underlying Buffers, the change will be reflected in both the original and the duplicate. This method is needed if you want to call `consume()` or `pipe()` and still keep the original list.Example:
|
||||
|
||||
```js
|
||||
var bl = new BufferList()
|
||||
|
||||
bl.append('hello')
|
||||
bl.append(' world')
|
||||
bl.append('\n')
|
||||
|
||||
bl.duplicate().pipe(process.stdout, { end: false })
|
||||
|
||||
console.log(bl.toString())
|
||||
```
|
||||
|
||||
--------------------------------------------------------
|
||||
<a name="consume"></a>
|
||||
### bl.consume(bytes)
|
||||
`consume()` will shift bytes *off the start of the list*. The number of bytes consumed don't need to line up with the sizes of the internal Buffers—initial offsets will be calculated accordingly in order to give you a consistent view of the data.
|
||||
|
||||
--------------------------------------------------------
|
||||
<a name="toString"></a>
|
||||
### bl.toString([encoding, [ start, [ end ]]])
|
||||
`toString()` will return a string representation of the buffer. The optional `start` and `end` arguments are passed on to `slice()`, while the `encoding` is passed on to `toString()` of the resulting Buffer. See the [Buffer#toString()](http://nodejs.org/docs/latest/api/buffer.html#buffer_buf_tostring_encoding_start_end) documentation for more information.
|
||||
|
||||
--------------------------------------------------------
|
||||
<a name="readXX"></a>
|
||||
### bl.readDoubleBE(), bl.readDoubleLE(), bl.readFloatBE(), bl.readFloatLE(), bl.readInt32BE(), bl.readInt32LE(), bl.readUInt32BE(), bl.readUInt32LE(), bl.readInt16BE(), bl.readInt16LE(), bl.readUInt16BE(), bl.readUInt16LE(), bl.readInt8(), bl.readUInt8()
|
||||
|
||||
All of the standard byte-reading methods of the `Buffer` interface are implemented and will operate across internal Buffer boundaries transparently.
|
||||
|
||||
See the <b><code>[Buffer](http://nodejs.org/docs/latest/api/buffer.html)</code></b> documentation for how these work.
|
||||
|
||||
--------------------------------------------------------
|
||||
<a name="streams"></a>
|
||||
### Streams
|
||||
**bl** is a Node **[Duplex Stream](http://nodejs.org/docs/latest/api/stream.html#stream_class_stream_duplex)**, so it can be read from and written to like a standard Node stream. You can also `pipe()` to and from a **bl** instance.
|
||||
|
||||
--------------------------------------------------------
|
||||
|
||||
## Contributors
|
||||
|
||||
**bl** is brought to you by the following hackers:
|
||||
|
||||
* [Rod Vagg](https://github.com/rvagg)
|
||||
* [Matteo Collina](https://github.com/mcollina)
|
||||
* [Jarett Cruger](https://github.com/jcrugzz)
|
||||
|
||||
=======
|
||||
|
||||
<a name="license"></a>
|
||||
## License & copyright
|
||||
|
||||
Copyright (c) 2013-2016 bl contributors (listed above).
|
||||
|
||||
bl is licensed under the MIT license. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE.md file for more details.
|
||||
280
node_modules/bl/bl.js
generated
vendored
280
node_modules/bl/bl.js
generated
vendored
@@ -1,280 +0,0 @@
|
||||
var DuplexStream = require('readable-stream/duplex')
|
||||
, util = require('util')
|
||||
|
||||
|
||||
function BufferList (callback) {
|
||||
if (!(this instanceof BufferList))
|
||||
return new BufferList(callback)
|
||||
|
||||
this._bufs = []
|
||||
this.length = 0
|
||||
|
||||
if (typeof callback == 'function') {
|
||||
this._callback = callback
|
||||
|
||||
var piper = function piper (err) {
|
||||
if (this._callback) {
|
||||
this._callback(err)
|
||||
this._callback = null
|
||||
}
|
||||
}.bind(this)
|
||||
|
||||
this.on('pipe', function onPipe (src) {
|
||||
src.on('error', piper)
|
||||
})
|
||||
this.on('unpipe', function onUnpipe (src) {
|
||||
src.removeListener('error', piper)
|
||||
})
|
||||
} else {
|
||||
this.append(callback)
|
||||
}
|
||||
|
||||
DuplexStream.call(this)
|
||||
}
|
||||
|
||||
|
||||
util.inherits(BufferList, DuplexStream)
|
||||
|
||||
|
||||
BufferList.prototype._offset = function _offset (offset) {
|
||||
var tot = 0, i = 0, _t
|
||||
if (offset === 0) return [ 0, 0 ]
|
||||
for (; i < this._bufs.length; i++) {
|
||||
_t = tot + this._bufs[i].length
|
||||
if (offset < _t || i == this._bufs.length - 1)
|
||||
return [ i, offset - tot ]
|
||||
tot = _t
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BufferList.prototype.append = function append (buf) {
|
||||
var i = 0
|
||||
|
||||
if (Buffer.isBuffer(buf)) {
|
||||
this._appendBuffer(buf);
|
||||
} else if (Array.isArray(buf)) {
|
||||
for (; i < buf.length; i++)
|
||||
this.append(buf[i])
|
||||
} else if (buf instanceof BufferList) {
|
||||
// unwrap argument into individual BufferLists
|
||||
for (; i < buf._bufs.length; i++)
|
||||
this.append(buf._bufs[i])
|
||||
} else if (buf != null) {
|
||||
// coerce number arguments to strings, since Buffer(number) does
|
||||
// uninitialized memory allocation
|
||||
if (typeof buf == 'number')
|
||||
buf = buf.toString()
|
||||
|
||||
this._appendBuffer(new Buffer(buf));
|
||||
}
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
|
||||
BufferList.prototype._appendBuffer = function appendBuffer (buf) {
|
||||
this._bufs.push(buf)
|
||||
this.length += buf.length
|
||||
}
|
||||
|
||||
|
||||
BufferList.prototype._write = function _write (buf, encoding, callback) {
|
||||
this._appendBuffer(buf)
|
||||
|
||||
if (typeof callback == 'function')
|
||||
callback()
|
||||
}
|
||||
|
||||
|
||||
BufferList.prototype._read = function _read (size) {
|
||||
if (!this.length)
|
||||
return this.push(null)
|
||||
|
||||
size = Math.min(size, this.length)
|
||||
this.push(this.slice(0, size))
|
||||
this.consume(size)
|
||||
}
|
||||
|
||||
|
||||
BufferList.prototype.end = function end (chunk) {
|
||||
DuplexStream.prototype.end.call(this, chunk)
|
||||
|
||||
if (this._callback) {
|
||||
this._callback(null, this.slice())
|
||||
this._callback = null
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BufferList.prototype.get = function get (index) {
|
||||
return this.slice(index, index + 1)[0]
|
||||
}
|
||||
|
||||
|
||||
BufferList.prototype.slice = function slice (start, end) {
|
||||
if (typeof start == 'number' && start < 0)
|
||||
start += this.length
|
||||
if (typeof end == 'number' && end < 0)
|
||||
end += this.length
|
||||
return this.copy(null, 0, start, end)
|
||||
}
|
||||
|
||||
|
||||
BufferList.prototype.copy = function copy (dst, dstStart, srcStart, srcEnd) {
|
||||
if (typeof srcStart != 'number' || srcStart < 0)
|
||||
srcStart = 0
|
||||
if (typeof srcEnd != 'number' || srcEnd > this.length)
|
||||
srcEnd = this.length
|
||||
if (srcStart >= this.length)
|
||||
return dst || new Buffer(0)
|
||||
if (srcEnd <= 0)
|
||||
return dst || new Buffer(0)
|
||||
|
||||
var copy = !!dst
|
||||
, off = this._offset(srcStart)
|
||||
, len = srcEnd - srcStart
|
||||
, bytes = len
|
||||
, bufoff = (copy && dstStart) || 0
|
||||
, start = off[1]
|
||||
, l
|
||||
, i
|
||||
|
||||
// copy/slice everything
|
||||
if (srcStart === 0 && srcEnd == this.length) {
|
||||
if (!copy) { // slice, but full concat if multiple buffers
|
||||
return this._bufs.length === 1
|
||||
? this._bufs[0]
|
||||
: Buffer.concat(this._bufs, this.length)
|
||||
}
|
||||
|
||||
// copy, need to copy individual buffers
|
||||
for (i = 0; i < this._bufs.length; i++) {
|
||||
this._bufs[i].copy(dst, bufoff)
|
||||
bufoff += this._bufs[i].length
|
||||
}
|
||||
|
||||
return dst
|
||||
}
|
||||
|
||||
// easy, cheap case where it's a subset of one of the buffers
|
||||
if (bytes <= this._bufs[off[0]].length - start) {
|
||||
return copy
|
||||
? this._bufs[off[0]].copy(dst, dstStart, start, start + bytes)
|
||||
: this._bufs[off[0]].slice(start, start + bytes)
|
||||
}
|
||||
|
||||
if (!copy) // a slice, we need something to copy in to
|
||||
dst = new Buffer(len)
|
||||
|
||||
for (i = off[0]; i < this._bufs.length; i++) {
|
||||
l = this._bufs[i].length - start
|
||||
|
||||
if (bytes > l) {
|
||||
this._bufs[i].copy(dst, bufoff, start)
|
||||
} else {
|
||||
this._bufs[i].copy(dst, bufoff, start, start + bytes)
|
||||
break
|
||||
}
|
||||
|
||||
bufoff += l
|
||||
bytes -= l
|
||||
|
||||
if (start)
|
||||
start = 0
|
||||
}
|
||||
|
||||
return dst
|
||||
}
|
||||
|
||||
BufferList.prototype.shallowSlice = function shallowSlice (start, end) {
|
||||
start = start || 0
|
||||
end = end || this.length
|
||||
|
||||
if (start < 0)
|
||||
start += this.length
|
||||
if (end < 0)
|
||||
end += this.length
|
||||
|
||||
var startOffset = this._offset(start)
|
||||
, endOffset = this._offset(end)
|
||||
, buffers = this._bufs.slice(startOffset[0], endOffset[0] + 1)
|
||||
|
||||
if (startOffset[1] != 0)
|
||||
buffers[0] = buffers[0].slice(startOffset[1])
|
||||
|
||||
if (endOffset[1] == 0)
|
||||
buffers.pop()
|
||||
else
|
||||
buffers[buffers.length-1] = buffers[buffers.length-1].slice(0, endOffset[1])
|
||||
|
||||
return new BufferList(buffers)
|
||||
}
|
||||
|
||||
BufferList.prototype.toString = function toString (encoding, start, end) {
|
||||
return this.slice(start, end).toString(encoding)
|
||||
}
|
||||
|
||||
BufferList.prototype.consume = function consume (bytes) {
|
||||
while (this._bufs.length) {
|
||||
if (bytes >= this._bufs[0].length) {
|
||||
bytes -= this._bufs[0].length
|
||||
this.length -= this._bufs[0].length
|
||||
this._bufs.shift()
|
||||
} else {
|
||||
this._bufs[0] = this._bufs[0].slice(bytes)
|
||||
this.length -= bytes
|
||||
break
|
||||
}
|
||||
}
|
||||
return this
|
||||
}
|
||||
|
||||
|
||||
BufferList.prototype.duplicate = function duplicate () {
|
||||
var i = 0
|
||||
, copy = new BufferList()
|
||||
|
||||
for (; i < this._bufs.length; i++)
|
||||
copy.append(this._bufs[i])
|
||||
|
||||
return copy
|
||||
}
|
||||
|
||||
|
||||
BufferList.prototype.destroy = function destroy () {
|
||||
this._bufs.length = 0
|
||||
this.length = 0
|
||||
this.push(null)
|
||||
}
|
||||
|
||||
|
||||
;(function () {
|
||||
var methods = {
|
||||
'readDoubleBE' : 8
|
||||
, 'readDoubleLE' : 8
|
||||
, 'readFloatBE' : 4
|
||||
, 'readFloatLE' : 4
|
||||
, 'readInt32BE' : 4
|
||||
, 'readInt32LE' : 4
|
||||
, 'readUInt32BE' : 4
|
||||
, 'readUInt32LE' : 4
|
||||
, 'readInt16BE' : 2
|
||||
, 'readInt16LE' : 2
|
||||
, 'readUInt16BE' : 2
|
||||
, 'readUInt16LE' : 2
|
||||
, 'readInt8' : 1
|
||||
, 'readUInt8' : 1
|
||||
}
|
||||
|
||||
for (var m in methods) {
|
||||
(function (m) {
|
||||
BufferList.prototype[m] = function (offset) {
|
||||
return this.slice(offset, offset + methods[m])[m](0)
|
||||
}
|
||||
}(m))
|
||||
}
|
||||
}())
|
||||
|
||||
|
||||
module.exports = BufferList
|
||||
102
node_modules/bl/package.json
generated
vendored
102
node_modules/bl/package.json
generated
vendored
@@ -1,102 +0,0 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "bl@^1.0.0",
|
||||
"scope": null,
|
||||
"escapedName": "bl",
|
||||
"name": "bl",
|
||||
"rawSpec": "^1.0.0",
|
||||
"spec": ">=1.0.0 <2.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/tar-stream"
|
||||
]
|
||||
],
|
||||
"_from": "bl@>=1.0.0 <2.0.0",
|
||||
"_id": "bl@1.2.0",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/bl",
|
||||
"_nodeVersion": "6.9.1",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-12-west.internal.npmjs.com",
|
||||
"tmp": "tmp/bl-1.2.0.tgz_1482392005359_0.8425999039318413"
|
||||
},
|
||||
"_npmUser": {
|
||||
"name": "matteo.collina",
|
||||
"email": "hello@matteocollina.com"
|
||||
},
|
||||
"_npmVersion": "3.10.8",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "bl@^1.0.0",
|
||||
"scope": null,
|
||||
"escapedName": "bl",
|
||||
"name": "bl",
|
||||
"rawSpec": "^1.0.0",
|
||||
"spec": ">=1.0.0 <2.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/tar-stream"
|
||||
],
|
||||
"_resolved": "http://registry.npmjs.org/bl/-/bl-1.2.0.tgz",
|
||||
"_shasum": "1397e7ec42c5f5dc387470c500e34a9f6be9ea98",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "bl@^1.0.0",
|
||||
"_where": "/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/tar-stream",
|
||||
"authors": [
|
||||
"Rod Vagg <rod@vagg.org> (https://github.com/rvagg)",
|
||||
"Matteo Collina <matteo.collina@gmail.com> (https://github.com/mcollina)",
|
||||
"Jarett Cruger <jcrugzz@gmail.com> (https://github.com/jcrugzz)"
|
||||
],
|
||||
"bugs": {
|
||||
"url": "https://github.com/rvagg/bl/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"readable-stream": "^2.0.5"
|
||||
},
|
||||
"description": "Buffer List: collect buffers and access with a standard readable Buffer interface, streamable too!",
|
||||
"devDependencies": {
|
||||
"faucet": "0.0.1",
|
||||
"hash_file": "~0.1.1",
|
||||
"tape": "~4.6.0"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "1397e7ec42c5f5dc387470c500e34a9f6be9ea98",
|
||||
"tarball": "https://registry.npmjs.org/bl/-/bl-1.2.0.tgz"
|
||||
},
|
||||
"gitHead": "199e5c1807c378c8af5d81be0bb3c30921ce530a",
|
||||
"homepage": "https://github.com/rvagg/bl",
|
||||
"keywords": [
|
||||
"buffer",
|
||||
"buffers",
|
||||
"stream",
|
||||
"awesomesauce"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "bl.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "matteo.collina",
|
||||
"email": "hello@matteocollina.com"
|
||||
},
|
||||
{
|
||||
"name": "rvagg",
|
||||
"email": "rod@vagg.org"
|
||||
}
|
||||
],
|
||||
"name": "bl",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/rvagg/bl.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "node test/test.js | faucet"
|
||||
},
|
||||
"version": "1.2.0"
|
||||
}
|
||||
699
node_modules/bl/test/test.js
generated
vendored
699
node_modules/bl/test/test.js
generated
vendored
@@ -1,699 +0,0 @@
|
||||
var tape = require('tape')
|
||||
, crypto = require('crypto')
|
||||
, fs = require('fs')
|
||||
, hash = require('hash_file')
|
||||
, BufferList = require('../')
|
||||
|
||||
, encodings =
|
||||
('hex utf8 utf-8 ascii binary base64'
|
||||
+ (process.browser ? '' : ' ucs2 ucs-2 utf16le utf-16le')).split(' ')
|
||||
|
||||
tape('single bytes from single buffer', function (t) {
|
||||
var bl = new BufferList()
|
||||
bl.append(new Buffer('abcd'))
|
||||
|
||||
t.equal(bl.length, 4)
|
||||
|
||||
t.equal(bl.get(0), 97)
|
||||
t.equal(bl.get(1), 98)
|
||||
t.equal(bl.get(2), 99)
|
||||
t.equal(bl.get(3), 100)
|
||||
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('single bytes from multiple buffers', function (t) {
|
||||
var bl = new BufferList()
|
||||
bl.append(new Buffer('abcd'))
|
||||
bl.append(new Buffer('efg'))
|
||||
bl.append(new Buffer('hi'))
|
||||
bl.append(new Buffer('j'))
|
||||
|
||||
t.equal(bl.length, 10)
|
||||
|
||||
t.equal(bl.get(0), 97)
|
||||
t.equal(bl.get(1), 98)
|
||||
t.equal(bl.get(2), 99)
|
||||
t.equal(bl.get(3), 100)
|
||||
t.equal(bl.get(4), 101)
|
||||
t.equal(bl.get(5), 102)
|
||||
t.equal(bl.get(6), 103)
|
||||
t.equal(bl.get(7), 104)
|
||||
t.equal(bl.get(8), 105)
|
||||
t.equal(bl.get(9), 106)
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('multi bytes from single buffer', function (t) {
|
||||
var bl = new BufferList()
|
||||
bl.append(new Buffer('abcd'))
|
||||
|
||||
t.equal(bl.length, 4)
|
||||
|
||||
t.equal(bl.slice(0, 4).toString('ascii'), 'abcd')
|
||||
t.equal(bl.slice(0, 3).toString('ascii'), 'abc')
|
||||
t.equal(bl.slice(1, 4).toString('ascii'), 'bcd')
|
||||
t.equal(bl.slice(-4, -1).toString('ascii'), 'abc')
|
||||
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('multi bytes from single buffer (negative indexes)', function (t) {
|
||||
var bl = new BufferList()
|
||||
bl.append(new Buffer('buffer'))
|
||||
|
||||
t.equal(bl.length, 6)
|
||||
|
||||
t.equal(bl.slice(-6, -1).toString('ascii'), 'buffe')
|
||||
t.equal(bl.slice(-6, -2).toString('ascii'), 'buff')
|
||||
t.equal(bl.slice(-5, -2).toString('ascii'), 'uff')
|
||||
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('multiple bytes from multiple buffers', function (t) {
|
||||
var bl = new BufferList()
|
||||
|
||||
bl.append(new Buffer('abcd'))
|
||||
bl.append(new Buffer('efg'))
|
||||
bl.append(new Buffer('hi'))
|
||||
bl.append(new Buffer('j'))
|
||||
|
||||
t.equal(bl.length, 10)
|
||||
|
||||
t.equal(bl.slice(0, 10).toString('ascii'), 'abcdefghij')
|
||||
t.equal(bl.slice(3, 10).toString('ascii'), 'defghij')
|
||||
t.equal(bl.slice(3, 6).toString('ascii'), 'def')
|
||||
t.equal(bl.slice(3, 8).toString('ascii'), 'defgh')
|
||||
t.equal(bl.slice(5, 10).toString('ascii'), 'fghij')
|
||||
t.equal(bl.slice(-7, -4).toString('ascii'), 'def')
|
||||
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('multiple bytes from multiple buffer lists', function (t) {
|
||||
var bl = new BufferList()
|
||||
|
||||
bl.append(new BufferList([ new Buffer('abcd'), new Buffer('efg') ]))
|
||||
bl.append(new BufferList([ new Buffer('hi'), new Buffer('j') ]))
|
||||
|
||||
t.equal(bl.length, 10)
|
||||
|
||||
t.equal(bl.slice(0, 10).toString('ascii'), 'abcdefghij')
|
||||
|
||||
t.equal(bl.slice(3, 10).toString('ascii'), 'defghij')
|
||||
t.equal(bl.slice(3, 6).toString('ascii'), 'def')
|
||||
t.equal(bl.slice(3, 8).toString('ascii'), 'defgh')
|
||||
t.equal(bl.slice(5, 10).toString('ascii'), 'fghij')
|
||||
|
||||
t.end()
|
||||
})
|
||||
|
||||
// same data as previous test, just using nested constructors
|
||||
tape('multiple bytes from crazy nested buffer lists', function (t) {
|
||||
var bl = new BufferList()
|
||||
|
||||
bl.append(new BufferList([
|
||||
new BufferList([
|
||||
new BufferList(new Buffer('abc'))
|
||||
, new Buffer('d')
|
||||
, new BufferList(new Buffer('efg'))
|
||||
])
|
||||
, new BufferList([ new Buffer('hi') ])
|
||||
, new BufferList(new Buffer('j'))
|
||||
]))
|
||||
|
||||
t.equal(bl.length, 10)
|
||||
|
||||
t.equal(bl.slice(0, 10).toString('ascii'), 'abcdefghij')
|
||||
|
||||
t.equal(bl.slice(3, 10).toString('ascii'), 'defghij')
|
||||
t.equal(bl.slice(3, 6).toString('ascii'), 'def')
|
||||
t.equal(bl.slice(3, 8).toString('ascii'), 'defgh')
|
||||
t.equal(bl.slice(5, 10).toString('ascii'), 'fghij')
|
||||
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('append accepts arrays of Buffers', function (t) {
|
||||
var bl = new BufferList()
|
||||
bl.append(new Buffer('abc'))
|
||||
bl.append([ new Buffer('def') ])
|
||||
bl.append([ new Buffer('ghi'), new Buffer('jkl') ])
|
||||
bl.append([ new Buffer('mnop'), new Buffer('qrstu'), new Buffer('vwxyz') ])
|
||||
t.equal(bl.length, 26)
|
||||
t.equal(bl.slice().toString('ascii'), 'abcdefghijklmnopqrstuvwxyz')
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('append accepts arrays of BufferLists', function (t) {
|
||||
var bl = new BufferList()
|
||||
bl.append(new Buffer('abc'))
|
||||
bl.append([ new BufferList('def') ])
|
||||
bl.append(new BufferList([ new Buffer('ghi'), new BufferList('jkl') ]))
|
||||
bl.append([ new Buffer('mnop'), new BufferList([ new Buffer('qrstu'), new Buffer('vwxyz') ]) ])
|
||||
t.equal(bl.length, 26)
|
||||
t.equal(bl.slice().toString('ascii'), 'abcdefghijklmnopqrstuvwxyz')
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('append chainable', function (t) {
|
||||
var bl = new BufferList()
|
||||
t.ok(bl.append(new Buffer('abcd')) === bl)
|
||||
t.ok(bl.append([ new Buffer('abcd') ]) === bl)
|
||||
t.ok(bl.append(new BufferList(new Buffer('abcd'))) === bl)
|
||||
t.ok(bl.append([ new BufferList(new Buffer('abcd')) ]) === bl)
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('append chainable (test results)', function (t) {
|
||||
var bl = new BufferList('abc')
|
||||
.append([ new BufferList('def') ])
|
||||
.append(new BufferList([ new Buffer('ghi'), new BufferList('jkl') ]))
|
||||
.append([ new Buffer('mnop'), new BufferList([ new Buffer('qrstu'), new Buffer('vwxyz') ]) ])
|
||||
|
||||
t.equal(bl.length, 26)
|
||||
t.equal(bl.slice().toString('ascii'), 'abcdefghijklmnopqrstuvwxyz')
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('consuming from multiple buffers', function (t) {
|
||||
var bl = new BufferList()
|
||||
|
||||
bl.append(new Buffer('abcd'))
|
||||
bl.append(new Buffer('efg'))
|
||||
bl.append(new Buffer('hi'))
|
||||
bl.append(new Buffer('j'))
|
||||
|
||||
t.equal(bl.length, 10)
|
||||
|
||||
t.equal(bl.slice(0, 10).toString('ascii'), 'abcdefghij')
|
||||
|
||||
bl.consume(3)
|
||||
t.equal(bl.length, 7)
|
||||
t.equal(bl.slice(0, 7).toString('ascii'), 'defghij')
|
||||
|
||||
bl.consume(2)
|
||||
t.equal(bl.length, 5)
|
||||
t.equal(bl.slice(0, 5).toString('ascii'), 'fghij')
|
||||
|
||||
bl.consume(1)
|
||||
t.equal(bl.length, 4)
|
||||
t.equal(bl.slice(0, 4).toString('ascii'), 'ghij')
|
||||
|
||||
bl.consume(1)
|
||||
t.equal(bl.length, 3)
|
||||
t.equal(bl.slice(0, 3).toString('ascii'), 'hij')
|
||||
|
||||
bl.consume(2)
|
||||
t.equal(bl.length, 1)
|
||||
t.equal(bl.slice(0, 1).toString('ascii'), 'j')
|
||||
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('complete consumption', function (t) {
|
||||
var bl = new BufferList()
|
||||
|
||||
bl.append(new Buffer('a'))
|
||||
bl.append(new Buffer('b'))
|
||||
|
||||
bl.consume(2)
|
||||
|
||||
t.equal(bl.length, 0)
|
||||
t.equal(bl._bufs.length, 0)
|
||||
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('test readUInt8 / readInt8', function (t) {
|
||||
var buf1 = new Buffer(1)
|
||||
, buf2 = new Buffer(3)
|
||||
, buf3 = new Buffer(3)
|
||||
, bl = new BufferList()
|
||||
|
||||
buf2[1] = 0x3
|
||||
buf2[2] = 0x4
|
||||
buf3[0] = 0x23
|
||||
buf3[1] = 0x42
|
||||
|
||||
bl.append(buf1)
|
||||
bl.append(buf2)
|
||||
bl.append(buf3)
|
||||
|
||||
t.equal(bl.readUInt8(2), 0x3)
|
||||
t.equal(bl.readInt8(2), 0x3)
|
||||
t.equal(bl.readUInt8(3), 0x4)
|
||||
t.equal(bl.readInt8(3), 0x4)
|
||||
t.equal(bl.readUInt8(4), 0x23)
|
||||
t.equal(bl.readInt8(4), 0x23)
|
||||
t.equal(bl.readUInt8(5), 0x42)
|
||||
t.equal(bl.readInt8(5), 0x42)
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('test readUInt16LE / readUInt16BE / readInt16LE / readInt16BE', function (t) {
|
||||
var buf1 = new Buffer(1)
|
||||
, buf2 = new Buffer(3)
|
||||
, buf3 = new Buffer(3)
|
||||
, bl = new BufferList()
|
||||
|
||||
buf2[1] = 0x3
|
||||
buf2[2] = 0x4
|
||||
buf3[0] = 0x23
|
||||
buf3[1] = 0x42
|
||||
|
||||
bl.append(buf1)
|
||||
bl.append(buf2)
|
||||
bl.append(buf3)
|
||||
|
||||
t.equal(bl.readUInt16BE(2), 0x0304)
|
||||
t.equal(bl.readUInt16LE(2), 0x0403)
|
||||
t.equal(bl.readInt16BE(2), 0x0304)
|
||||
t.equal(bl.readInt16LE(2), 0x0403)
|
||||
t.equal(bl.readUInt16BE(3), 0x0423)
|
||||
t.equal(bl.readUInt16LE(3), 0x2304)
|
||||
t.equal(bl.readInt16BE(3), 0x0423)
|
||||
t.equal(bl.readInt16LE(3), 0x2304)
|
||||
t.equal(bl.readUInt16BE(4), 0x2342)
|
||||
t.equal(bl.readUInt16LE(4), 0x4223)
|
||||
t.equal(bl.readInt16BE(4), 0x2342)
|
||||
t.equal(bl.readInt16LE(4), 0x4223)
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('test readUInt32LE / readUInt32BE / readInt32LE / readInt32BE', function (t) {
|
||||
var buf1 = new Buffer(1)
|
||||
, buf2 = new Buffer(3)
|
||||
, buf3 = new Buffer(3)
|
||||
, bl = new BufferList()
|
||||
|
||||
buf2[1] = 0x3
|
||||
buf2[2] = 0x4
|
||||
buf3[0] = 0x23
|
||||
buf3[1] = 0x42
|
||||
|
||||
bl.append(buf1)
|
||||
bl.append(buf2)
|
||||
bl.append(buf3)
|
||||
|
||||
t.equal(bl.readUInt32BE(2), 0x03042342)
|
||||
t.equal(bl.readUInt32LE(2), 0x42230403)
|
||||
t.equal(bl.readInt32BE(2), 0x03042342)
|
||||
t.equal(bl.readInt32LE(2), 0x42230403)
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('test readFloatLE / readFloatBE', function (t) {
|
||||
var buf1 = new Buffer(1)
|
||||
, buf2 = new Buffer(3)
|
||||
, buf3 = new Buffer(3)
|
||||
, bl = new BufferList()
|
||||
|
||||
buf2[1] = 0x00
|
||||
buf2[2] = 0x00
|
||||
buf3[0] = 0x80
|
||||
buf3[1] = 0x3f
|
||||
|
||||
bl.append(buf1)
|
||||
bl.append(buf2)
|
||||
bl.append(buf3)
|
||||
|
||||
t.equal(bl.readFloatLE(2), 0x01)
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('test readDoubleLE / readDoubleBE', function (t) {
|
||||
var buf1 = new Buffer(1)
|
||||
, buf2 = new Buffer(3)
|
||||
, buf3 = new Buffer(10)
|
||||
, bl = new BufferList()
|
||||
|
||||
buf2[1] = 0x55
|
||||
buf2[2] = 0x55
|
||||
buf3[0] = 0x55
|
||||
buf3[1] = 0x55
|
||||
buf3[2] = 0x55
|
||||
buf3[3] = 0x55
|
||||
buf3[4] = 0xd5
|
||||
buf3[5] = 0x3f
|
||||
|
||||
bl.append(buf1)
|
||||
bl.append(buf2)
|
||||
bl.append(buf3)
|
||||
|
||||
t.equal(bl.readDoubleLE(2), 0.3333333333333333)
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('test toString', function (t) {
|
||||
var bl = new BufferList()
|
||||
|
||||
bl.append(new Buffer('abcd'))
|
||||
bl.append(new Buffer('efg'))
|
||||
bl.append(new Buffer('hi'))
|
||||
bl.append(new Buffer('j'))
|
||||
|
||||
t.equal(bl.toString('ascii', 0, 10), 'abcdefghij')
|
||||
t.equal(bl.toString('ascii', 3, 10), 'defghij')
|
||||
t.equal(bl.toString('ascii', 3, 6), 'def')
|
||||
t.equal(bl.toString('ascii', 3, 8), 'defgh')
|
||||
t.equal(bl.toString('ascii', 5, 10), 'fghij')
|
||||
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('test toString encoding', function (t) {
|
||||
var bl = new BufferList()
|
||||
, b = new Buffer('abcdefghij\xff\x00')
|
||||
|
||||
bl.append(new Buffer('abcd'))
|
||||
bl.append(new Buffer('efg'))
|
||||
bl.append(new Buffer('hi'))
|
||||
bl.append(new Buffer('j'))
|
||||
bl.append(new Buffer('\xff\x00'))
|
||||
|
||||
encodings.forEach(function (enc) {
|
||||
t.equal(bl.toString(enc), b.toString(enc), enc)
|
||||
})
|
||||
|
||||
t.end()
|
||||
})
|
||||
|
||||
!process.browser && tape('test stream', function (t) {
|
||||
var random = crypto.randomBytes(65534)
|
||||
, rndhash = hash(random, 'md5')
|
||||
, md5sum = crypto.createHash('md5')
|
||||
, bl = new BufferList(function (err, buf) {
|
||||
t.ok(Buffer.isBuffer(buf))
|
||||
t.ok(err === null)
|
||||
t.equal(rndhash, hash(bl.slice(), 'md5'))
|
||||
t.equal(rndhash, hash(buf, 'md5'))
|
||||
|
||||
bl.pipe(fs.createWriteStream('/tmp/bl_test_rnd_out.dat'))
|
||||
.on('close', function () {
|
||||
var s = fs.createReadStream('/tmp/bl_test_rnd_out.dat')
|
||||
s.on('data', md5sum.update.bind(md5sum))
|
||||
s.on('end', function() {
|
||||
t.equal(rndhash, md5sum.digest('hex'), 'woohoo! correct hash!')
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
fs.writeFileSync('/tmp/bl_test_rnd.dat', random)
|
||||
fs.createReadStream('/tmp/bl_test_rnd.dat').pipe(bl)
|
||||
})
|
||||
|
||||
tape('instantiation with Buffer', function (t) {
|
||||
var buf = crypto.randomBytes(1024)
|
||||
, buf2 = crypto.randomBytes(1024)
|
||||
, b = BufferList(buf)
|
||||
|
||||
t.equal(buf.toString('hex'), b.slice().toString('hex'), 'same buffer')
|
||||
b = BufferList([ buf, buf2 ])
|
||||
t.equal(b.slice().toString('hex'), Buffer.concat([ buf, buf2 ]).toString('hex'), 'same buffer')
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('test String appendage', function (t) {
|
||||
var bl = new BufferList()
|
||||
, b = new Buffer('abcdefghij\xff\x00')
|
||||
|
||||
bl.append('abcd')
|
||||
bl.append('efg')
|
||||
bl.append('hi')
|
||||
bl.append('j')
|
||||
bl.append('\xff\x00')
|
||||
|
||||
encodings.forEach(function (enc) {
|
||||
t.equal(bl.toString(enc), b.toString(enc))
|
||||
})
|
||||
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('test Number appendage', function (t) {
|
||||
var bl = new BufferList()
|
||||
, b = new Buffer('1234567890')
|
||||
|
||||
bl.append(1234)
|
||||
bl.append(567)
|
||||
bl.append(89)
|
||||
bl.append(0)
|
||||
|
||||
encodings.forEach(function (enc) {
|
||||
t.equal(bl.toString(enc), b.toString(enc))
|
||||
})
|
||||
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('write nothing, should get empty buffer', function (t) {
|
||||
t.plan(3)
|
||||
BufferList(function (err, data) {
|
||||
t.notOk(err, 'no error')
|
||||
t.ok(Buffer.isBuffer(data), 'got a buffer')
|
||||
t.equal(0, data.length, 'got a zero-length buffer')
|
||||
t.end()
|
||||
}).end()
|
||||
})
|
||||
|
||||
tape('unicode string', function (t) {
|
||||
t.plan(2)
|
||||
var inp1 = '\u2600'
|
||||
, inp2 = '\u2603'
|
||||
, exp = inp1 + ' and ' + inp2
|
||||
, bl = BufferList()
|
||||
bl.write(inp1)
|
||||
bl.write(' and ')
|
||||
bl.write(inp2)
|
||||
t.equal(exp, bl.toString())
|
||||
t.equal(new Buffer(exp).toString('hex'), bl.toString('hex'))
|
||||
})
|
||||
|
||||
tape('should emit finish', function (t) {
|
||||
var source = BufferList()
|
||||
, dest = BufferList()
|
||||
|
||||
source.write('hello')
|
||||
source.pipe(dest)
|
||||
|
||||
dest.on('finish', function () {
|
||||
t.equal(dest.toString('utf8'), 'hello')
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
tape('basic copy', function (t) {
|
||||
var buf = crypto.randomBytes(1024)
|
||||
, buf2 = new Buffer(1024)
|
||||
, b = BufferList(buf)
|
||||
|
||||
b.copy(buf2)
|
||||
t.equal(b.slice().toString('hex'), buf2.toString('hex'), 'same buffer')
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('copy after many appends', function (t) {
|
||||
var buf = crypto.randomBytes(512)
|
||||
, buf2 = new Buffer(1024)
|
||||
, b = BufferList(buf)
|
||||
|
||||
b.append(buf)
|
||||
b.copy(buf2)
|
||||
t.equal(b.slice().toString('hex'), buf2.toString('hex'), 'same buffer')
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('copy at a precise position', function (t) {
|
||||
var buf = crypto.randomBytes(1004)
|
||||
, buf2 = new Buffer(1024)
|
||||
, b = BufferList(buf)
|
||||
|
||||
b.copy(buf2, 20)
|
||||
t.equal(b.slice().toString('hex'), buf2.slice(20).toString('hex'), 'same buffer')
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('copy starting from a precise location', function (t) {
|
||||
var buf = crypto.randomBytes(10)
|
||||
, buf2 = new Buffer(5)
|
||||
, b = BufferList(buf)
|
||||
|
||||
b.copy(buf2, 0, 5)
|
||||
t.equal(b.slice(5).toString('hex'), buf2.toString('hex'), 'same buffer')
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('copy in an interval', function (t) {
|
||||
var rnd = crypto.randomBytes(10)
|
||||
, b = BufferList(rnd) // put the random bytes there
|
||||
, actual = new Buffer(3)
|
||||
, expected = new Buffer(3)
|
||||
|
||||
rnd.copy(expected, 0, 5, 8)
|
||||
b.copy(actual, 0, 5, 8)
|
||||
|
||||
t.equal(actual.toString('hex'), expected.toString('hex'), 'same buffer')
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('copy an interval between two buffers', function (t) {
|
||||
var buf = crypto.randomBytes(10)
|
||||
, buf2 = new Buffer(10)
|
||||
, b = BufferList(buf)
|
||||
|
||||
b.append(buf)
|
||||
b.copy(buf2, 0, 5, 15)
|
||||
|
||||
t.equal(b.slice(5, 15).toString('hex'), buf2.toString('hex'), 'same buffer')
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('shallow slice across buffer boundaries', function (t) {
|
||||
var bl = new BufferList(['First', 'Second', 'Third'])
|
||||
|
||||
t.equal(bl.shallowSlice(3, 13).toString(), 'stSecondTh')
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('shallow slice within single buffer', function (t) {
|
||||
var bl = new BufferList(['First', 'Second', 'Third'])
|
||||
|
||||
t.equal(bl.shallowSlice(5, 10).toString(), 'Secon')
|
||||
t.end()
|
||||
})
|
||||
|
||||
tape('shallow slice single buffer', function (t) {
|
||||
t.plan(3)
|
||||
var bl = new BufferList(['First', 'Second', 'Third'])
|
||||
|
||||
t.equal(bl.shallowSlice(0, 5).toString(), 'First')
|
||||
t.equal(bl.shallowSlice(5, 11).toString(), 'Second')
|
||||
t.equal(bl.shallowSlice(11, 16).toString(), 'Third')
|
||||
})
|
||||
|
||||
tape('shallow slice with negative or omitted indices', function (t) {
|
||||
t.plan(4)
|
||||
var bl = new BufferList(['First', 'Second', 'Third'])
|
||||
|
||||
t.equal(bl.shallowSlice().toString(), 'FirstSecondThird')
|
||||
t.equal(bl.shallowSlice(5).toString(), 'SecondThird')
|
||||
t.equal(bl.shallowSlice(5, -3).toString(), 'SecondTh')
|
||||
t.equal(bl.shallowSlice(-8).toString(), 'ondThird')
|
||||
})
|
||||
|
||||
tape('shallow slice does not make a copy', function (t) {
|
||||
t.plan(1)
|
||||
var buffers = [new Buffer('First'), new Buffer('Second'), new Buffer('Third')]
|
||||
var bl = (new BufferList(buffers)).shallowSlice(5, -3)
|
||||
|
||||
buffers[1].fill('h')
|
||||
buffers[2].fill('h')
|
||||
|
||||
t.equal(bl.toString(), 'hhhhhhhh')
|
||||
})
|
||||
|
||||
tape('duplicate', function (t) {
|
||||
t.plan(2)
|
||||
|
||||
var bl = new BufferList('abcdefghij\xff\x00')
|
||||
, dup = bl.duplicate()
|
||||
|
||||
t.equal(bl.prototype, dup.prototype)
|
||||
t.equal(bl.toString('hex'), dup.toString('hex'))
|
||||
})
|
||||
|
||||
tape('destroy no pipe', function (t) {
|
||||
t.plan(2)
|
||||
|
||||
var bl = new BufferList('alsdkfja;lsdkfja;lsdk')
|
||||
bl.destroy()
|
||||
|
||||
t.equal(bl._bufs.length, 0)
|
||||
t.equal(bl.length, 0)
|
||||
})
|
||||
|
||||
!process.browser && tape('destroy with pipe before read end', function (t) {
|
||||
t.plan(2)
|
||||
|
||||
var bl = new BufferList()
|
||||
fs.createReadStream(__dirname + '/test.js')
|
||||
.pipe(bl)
|
||||
|
||||
bl.destroy()
|
||||
|
||||
t.equal(bl._bufs.length, 0)
|
||||
t.equal(bl.length, 0)
|
||||
|
||||
})
|
||||
|
||||
!process.browser && tape('destroy with pipe before read end with race', function (t) {
|
||||
t.plan(2)
|
||||
|
||||
var bl = new BufferList()
|
||||
fs.createReadStream(__dirname + '/test.js')
|
||||
.pipe(bl)
|
||||
|
||||
setTimeout(function () {
|
||||
bl.destroy()
|
||||
setTimeout(function () {
|
||||
t.equal(bl._bufs.length, 0)
|
||||
t.equal(bl.length, 0)
|
||||
}, 500)
|
||||
}, 500)
|
||||
})
|
||||
|
||||
!process.browser && tape('destroy with pipe after read end', function (t) {
|
||||
t.plan(2)
|
||||
|
||||
var bl = new BufferList()
|
||||
fs.createReadStream(__dirname + '/test.js')
|
||||
.on('end', onEnd)
|
||||
.pipe(bl)
|
||||
|
||||
function onEnd () {
|
||||
bl.destroy()
|
||||
|
||||
t.equal(bl._bufs.length, 0)
|
||||
t.equal(bl.length, 0)
|
||||
}
|
||||
})
|
||||
|
||||
!process.browser && tape('destroy with pipe while writing to a destination', function (t) {
|
||||
t.plan(4)
|
||||
|
||||
var bl = new BufferList()
|
||||
, ds = new BufferList()
|
||||
|
||||
fs.createReadStream(__dirname + '/test.js')
|
||||
.on('end', onEnd)
|
||||
.pipe(bl)
|
||||
|
||||
function onEnd () {
|
||||
bl.pipe(ds)
|
||||
|
||||
setTimeout(function () {
|
||||
bl.destroy()
|
||||
|
||||
t.equals(bl._bufs.length, 0)
|
||||
t.equals(bl.length, 0)
|
||||
|
||||
ds.destroy()
|
||||
|
||||
t.equals(bl._bufs.length, 0)
|
||||
t.equals(bl.length, 0)
|
||||
|
||||
}, 100)
|
||||
}
|
||||
})
|
||||
|
||||
!process.browser && tape('handle error', function (t) {
|
||||
t.plan(2)
|
||||
fs.createReadStream('/does/not/exist').pipe(BufferList(function (err, data) {
|
||||
t.ok(err instanceof Error, 'has error')
|
||||
t.notOk(data, 'no data')
|
||||
}))
|
||||
})
|
||||
108
node_modules/buffer-shims/index.js
generated
vendored
108
node_modules/buffer-shims/index.js
generated
vendored
@@ -1,108 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
var buffer = require('buffer');
|
||||
var Buffer = buffer.Buffer;
|
||||
var SlowBuffer = buffer.SlowBuffer;
|
||||
var MAX_LEN = buffer.kMaxLength || 2147483647;
|
||||
exports.alloc = function alloc(size, fill, encoding) {
|
||||
if (typeof Buffer.alloc === 'function') {
|
||||
return Buffer.alloc(size, fill, encoding);
|
||||
}
|
||||
if (typeof encoding === 'number') {
|
||||
throw new TypeError('encoding must not be number');
|
||||
}
|
||||
if (typeof size !== 'number') {
|
||||
throw new TypeError('size must be a number');
|
||||
}
|
||||
if (size > MAX_LEN) {
|
||||
throw new RangeError('size is too large');
|
||||
}
|
||||
var enc = encoding;
|
||||
var _fill = fill;
|
||||
if (_fill === undefined) {
|
||||
enc = undefined;
|
||||
_fill = 0;
|
||||
}
|
||||
var buf = new Buffer(size);
|
||||
if (typeof _fill === 'string') {
|
||||
var fillBuf = new Buffer(_fill, enc);
|
||||
var flen = fillBuf.length;
|
||||
var i = -1;
|
||||
while (++i < size) {
|
||||
buf[i] = fillBuf[i % flen];
|
||||
}
|
||||
} else {
|
||||
buf.fill(_fill);
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
exports.allocUnsafe = function allocUnsafe(size) {
|
||||
if (typeof Buffer.allocUnsafe === 'function') {
|
||||
return Buffer.allocUnsafe(size);
|
||||
}
|
||||
if (typeof size !== 'number') {
|
||||
throw new TypeError('size must be a number');
|
||||
}
|
||||
if (size > MAX_LEN) {
|
||||
throw new RangeError('size is too large');
|
||||
}
|
||||
return new Buffer(size);
|
||||
}
|
||||
exports.from = function from(value, encodingOrOffset, length) {
|
||||
if (typeof Buffer.from === 'function' && (!global.Uint8Array || Uint8Array.from !== Buffer.from)) {
|
||||
return Buffer.from(value, encodingOrOffset, length);
|
||||
}
|
||||
if (typeof value === 'number') {
|
||||
throw new TypeError('"value" argument must not be a number');
|
||||
}
|
||||
if (typeof value === 'string') {
|
||||
return new Buffer(value, encodingOrOffset);
|
||||
}
|
||||
if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
|
||||
var offset = encodingOrOffset;
|
||||
if (arguments.length === 1) {
|
||||
return new Buffer(value);
|
||||
}
|
||||
if (typeof offset === 'undefined') {
|
||||
offset = 0;
|
||||
}
|
||||
var len = length;
|
||||
if (typeof len === 'undefined') {
|
||||
len = value.byteLength - offset;
|
||||
}
|
||||
if (offset >= value.byteLength) {
|
||||
throw new RangeError('\'offset\' is out of bounds');
|
||||
}
|
||||
if (len > value.byteLength - offset) {
|
||||
throw new RangeError('\'length\' is out of bounds');
|
||||
}
|
||||
return new Buffer(value.slice(offset, offset + len));
|
||||
}
|
||||
if (Buffer.isBuffer(value)) {
|
||||
var out = new Buffer(value.length);
|
||||
value.copy(out, 0, 0, value.length);
|
||||
return out;
|
||||
}
|
||||
if (value) {
|
||||
if (Array.isArray(value) || (typeof ArrayBuffer !== 'undefined' && value.buffer instanceof ArrayBuffer) || 'length' in value) {
|
||||
return new Buffer(value);
|
||||
}
|
||||
if (value.type === 'Buffer' && Array.isArray(value.data)) {
|
||||
return new Buffer(value.data);
|
||||
}
|
||||
}
|
||||
|
||||
throw new TypeError('First argument must be a string, Buffer, ' + 'ArrayBuffer, Array, or array-like object.');
|
||||
}
|
||||
exports.allocUnsafeSlow = function allocUnsafeSlow(size) {
|
||||
if (typeof Buffer.allocUnsafeSlow === 'function') {
|
||||
return Buffer.allocUnsafeSlow(size);
|
||||
}
|
||||
if (typeof size !== 'number') {
|
||||
throw new TypeError('size must be a number');
|
||||
}
|
||||
if (size >= MAX_LEN) {
|
||||
throw new RangeError('size is too large');
|
||||
}
|
||||
return new SlowBuffer(size);
|
||||
}
|
||||
19
node_modules/buffer-shims/license.md
generated
vendored
19
node_modules/buffer-shims/license.md
generated
vendored
@@ -1,19 +0,0 @@
|
||||
# Copyright (c) 2016 Calvin Metcalf
|
||||
|
||||
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.**
|
||||
86
node_modules/buffer-shims/package.json
generated
vendored
86
node_modules/buffer-shims/package.json
generated
vendored
@@ -1,86 +0,0 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "buffer-shims@^1.0.0",
|
||||
"scope": null,
|
||||
"escapedName": "buffer-shims",
|
||||
"name": "buffer-shims",
|
||||
"rawSpec": "^1.0.0",
|
||||
"spec": ">=1.0.0 <2.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/readable-stream"
|
||||
]
|
||||
],
|
||||
"_from": "buffer-shims@>=1.0.0 <2.0.0",
|
||||
"_id": "buffer-shims@1.0.0",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/buffer-shims",
|
||||
"_nodeVersion": "5.11.0",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-16-east.internal.npmjs.com",
|
||||
"tmp": "tmp/buffer-shims-1.0.0.tgz_1462560889323_0.8640750856138766"
|
||||
},
|
||||
"_npmUser": {
|
||||
"name": "cwmma",
|
||||
"email": "calvin.metcalf@gmail.com"
|
||||
},
|
||||
"_npmVersion": "3.8.6",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "buffer-shims@^1.0.0",
|
||||
"scope": null,
|
||||
"escapedName": "buffer-shims",
|
||||
"name": "buffer-shims",
|
||||
"rawSpec": "^1.0.0",
|
||||
"spec": ">=1.0.0 <2.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/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/readable-stream",
|
||||
"bugs": {
|
||||
"url": "https://github.com/calvinmetcalf/buffer-shims/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "some shims for node buffers",
|
||||
"devDependencies": {
|
||||
"tape": "^4.5.1"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "9978ce317388c649ad8793028c3477ef044a8b51",
|
||||
"tarball": "https://registry.npmjs.org/buffer-shims/-/buffer-shims-1.0.0.tgz"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"gitHead": "ea89b3857ab5b8203957922a84e9a48cf4c47e0a",
|
||||
"homepage": "https://github.com/calvinmetcalf/buffer-shims#readme",
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "cwmma",
|
||||
"email": "calvin.metcalf@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "buffer-shims",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+ssh://git@github.com/calvinmetcalf/buffer-shims.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tape test/*.js"
|
||||
},
|
||||
"version": "1.0.0"
|
||||
}
|
||||
21
node_modules/buffer-shims/readme.md
generated
vendored
21
node_modules/buffer-shims/readme.md
generated
vendored
@@ -1,21 +0,0 @@
|
||||
buffer-shims
|
||||
===
|
||||
|
||||
functions to make sure the new buffer methods work in older browsers.
|
||||
|
||||
```js
|
||||
var bufferShim = require('buffer-shims');
|
||||
bufferShim.from('foo');
|
||||
bufferShim.alloc(9, 'cafeface', 'hex');
|
||||
bufferShim.allocUnsafe(15);
|
||||
bufferShim.allocUnsafeSlow(21);
|
||||
```
|
||||
|
||||
should just use the original in newer nodes and on older nodes uses fallbacks.
|
||||
|
||||
Known Issues
|
||||
===
|
||||
- this does not patch the buffer object, only the constructor stuff
|
||||
- it's actually a polyfill
|
||||
|
||||

|
||||
21
node_modules/bufferutil/LICENSE
generated
vendored
21
node_modules/bufferutil/LICENSE
generated
vendored
@@ -1,21 +0,0 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2013-2016 Einar Otto Stangvik <einaros@gmail.com> (http://2x.io)
|
||||
|
||||
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.
|
||||
78
node_modules/bufferutil/README.md
generated
vendored
78
node_modules/bufferutil/README.md
generated
vendored
@@ -1,78 +0,0 @@
|
||||
# bufferutil
|
||||
|
||||
[](https://www.npmjs.com/package/bufferutil)
|
||||
[](https://travis-ci.org/websockets/bufferutil)
|
||||
[](https://ci.appveyor.com/project/lpinca/bufferutil)
|
||||
|
||||
`bufferutil` is what makes `ws` fast. It provides some utilities to efficiently
|
||||
perform some operations such as masking and unmasking the data payload of
|
||||
WebSocket frames.
|
||||
|
||||
## Installation
|
||||
|
||||
```
|
||||
npm install bufferutil --save-optional
|
||||
```
|
||||
|
||||
The `--save-optional` flag tells npm to save the package in your package.json
|
||||
under the [`optionalDependencies`](https://docs.npmjs.com/files/package.json#optionaldependencies)
|
||||
key.
|
||||
|
||||
## API
|
||||
|
||||
The module exports two functions.
|
||||
|
||||
### `bufferUtil.mask(source, mask, output, offset, length)`
|
||||
|
||||
Masks a buffer using the given masking-key as specified by the WebSocket
|
||||
protocol.
|
||||
|
||||
#### Arguments
|
||||
|
||||
- `source` - The buffer to mask.
|
||||
- `mask` - A buffer representing the masking-key.
|
||||
- `output` - The buffer where to store the result.
|
||||
- `offset` - The offset at which to start writing.
|
||||
- `length` - The number of bytes to mask.
|
||||
|
||||
#### Example
|
||||
|
||||
```js
|
||||
'use strict';
|
||||
|
||||
const bufferUtil = require('bufferutil');
|
||||
const crypto = require('crypto');
|
||||
|
||||
const source = crypto.randomBytes(10);
|
||||
const mask = crypto.randomBytes(4);
|
||||
|
||||
bufferUtil.mask(source, mask, source, 0, source.length);
|
||||
```
|
||||
|
||||
### `bufferUtil.unmask(buffer, mask)`
|
||||
|
||||
Unmasks a buffer using the given masking-key as specified by the WebSocket
|
||||
protocol.
|
||||
|
||||
#### Arguments
|
||||
|
||||
- `buffer` - The buffer to unmask.
|
||||
- `mask` - A buffer representing the masking-key.
|
||||
|
||||
#### Example
|
||||
|
||||
```js
|
||||
'use strict';
|
||||
|
||||
const bufferUtil = require('bufferutil');
|
||||
const crypto = require('crypto');
|
||||
|
||||
const buffer = crypto.randomBytes(10);
|
||||
const mask = crypto.randomBytes(4);
|
||||
|
||||
bufferUtil.unmask(buffer, mask);
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
14
node_modules/bufferutil/binding.gyp
generated
vendored
14
node_modules/bufferutil/binding.gyp
generated
vendored
@@ -1,14 +0,0 @@
|
||||
{
|
||||
'targets': [
|
||||
{
|
||||
'target_name': 'bufferutil',
|
||||
'include_dirs': ["<!(node -e \"require('nan')\")"],
|
||||
'sources': [ 'src/bufferutil.cc' ],
|
||||
'xcode_settings': {
|
||||
'MACOSX_DEPLOYMENT_TARGET': '10.8',
|
||||
'CLANG_CXX_LANGUAGE_STANDARD': 'c++11',
|
||||
'CLANG_CXX_LIBRARY': 'libc++'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
BIN
node_modules/bufferutil/build/Release/bufferutil.node
generated
vendored
BIN
node_modules/bufferutil/build/Release/bufferutil.node
generated
vendored
Binary file not shown.
40
node_modules/bufferutil/fallback.js
generated
vendored
40
node_modules/bufferutil/fallback.js
generated
vendored
@@ -1,40 +0,0 @@
|
||||
/*!
|
||||
* bufferutil: WebSocket buffer utils
|
||||
* Copyright(c) 2015 Einar Otto Stangvik <einaros@gmail.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Masks a buffer using the given mask.
|
||||
*
|
||||
* @param {Buffer} source The buffer to mask
|
||||
* @param {Buffer} mask The mask to use
|
||||
* @param {Buffer} output The buffer where to store the result
|
||||
* @param {Number} offset The offset at which to start writing
|
||||
* @param {Number} length The number of bytes to mask.
|
||||
* @public
|
||||
*/
|
||||
const mask = (source, mask, output, offset, length) => {
|
||||
for (var i = 0; i < length; i++) {
|
||||
output[offset + i] = source[i] ^ mask[i & 3];
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Unmasks a buffer using the given mask.
|
||||
*
|
||||
* @param {Buffer} buffer The buffer to unmask
|
||||
* @param {Buffer} mask The mask to use
|
||||
* @public
|
||||
*/
|
||||
const unmask = (buffer, mask) => {
|
||||
// Required until https://github.com/nodejs/node/issues/9006 is resolved.
|
||||
const length = buffer.length;
|
||||
for (var i = 0; i < length; i++) {
|
||||
buffer[i] ^= mask[i & 3];
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = { mask, unmask };
|
||||
7
node_modules/bufferutil/index.js
generated
vendored
7
node_modules/bufferutil/index.js
generated
vendored
@@ -1,7 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
try {
|
||||
module.exports = require('bindings')('bufferutil');
|
||||
} catch (e) {
|
||||
module.exports = require('./fallback');
|
||||
}
|
||||
106
node_modules/bufferutil/package.json
generated
vendored
106
node_modules/bufferutil/package.json
generated
vendored
@@ -1,106 +0,0 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "bufferutil@^3.0.0",
|
||||
"scope": null,
|
||||
"escapedName": "bufferutil",
|
||||
"name": "bufferutil",
|
||||
"rawSpec": "^3.0.0",
|
||||
"spec": ">=3.0.0 <4.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket"
|
||||
]
|
||||
],
|
||||
"_from": "bufferutil@>=3.0.0 <4.0.0",
|
||||
"_id": "bufferutil@3.0.0",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/bufferutil",
|
||||
"_nodeVersion": "7.7.1",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-18-east.internal.npmjs.com",
|
||||
"tmp": "tmp/bufferutil-3.0.0.tgz_1488540179073_0.6978500687982887"
|
||||
},
|
||||
"_npmUser": {
|
||||
"name": "lpinca",
|
||||
"email": "luigipinca@gmail.com"
|
||||
},
|
||||
"_npmVersion": "4.1.2",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "bufferutil@^3.0.0",
|
||||
"scope": null,
|
||||
"escapedName": "bufferutil",
|
||||
"name": "bufferutil",
|
||||
"rawSpec": "^3.0.0",
|
||||
"spec": ">=3.0.0 <4.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/"
|
||||
],
|
||||
"_resolved": "http://registry.npmjs.org/bufferutil/-/bufferutil-3.0.0.tgz",
|
||||
"_shasum": "afbb831c47229accf0b1f207d4a9942841b0ab0f",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "bufferutil@^3.0.0",
|
||||
"_where": "/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket",
|
||||
"author": {
|
||||
"name": "Einar Otto Stangvik",
|
||||
"email": "einaros@gmail.com",
|
||||
"url": "http://2x.io"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/websockets/bufferutil/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"bindings": "~1.2.1",
|
||||
"nan": "~2.5.0",
|
||||
"prebuild-install": "~2.1.0"
|
||||
},
|
||||
"description": "WebSocket buffer utils",
|
||||
"devDependencies": {
|
||||
"mocha": "~3.2.0",
|
||||
"prebuild": "~6.1.0",
|
||||
"prebuild-ci": "~2.2.0"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "afbb831c47229accf0b1f207d4a9942841b0ab0f",
|
||||
"tarball": "https://registry.npmjs.org/bufferutil/-/bufferutil-3.0.0.tgz"
|
||||
},
|
||||
"gitHead": "dcd0e68f1cab3cd3c6bde278b100acc4235c99ec",
|
||||
"homepage": "https://github.com/websockets/bufferutil",
|
||||
"keywords": [
|
||||
"bufferutil"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "3rdeden",
|
||||
"email": "npm@3rd-Eden.com"
|
||||
},
|
||||
{
|
||||
"name": "einaros",
|
||||
"email": "einaros@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "lpinca",
|
||||
"email": "luigipinca@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "bufferutil",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/websockets/bufferutil.git"
|
||||
},
|
||||
"scripts": {
|
||||
"install": "prebuild-install || node-gyp rebuild",
|
||||
"test": "mocha && prebuild-ci"
|
||||
},
|
||||
"version": "3.0.0"
|
||||
}
|
||||
113
node_modules/bufferutil/src/bufferutil.cc
generated
vendored
113
node_modules/bufferutil/src/bufferutil.cc
generated
vendored
@@ -1,113 +0,0 @@
|
||||
/*!
|
||||
* bufferutil: WebSocket buffer utils
|
||||
* Copyright(c) 2015 Einar Otto Stangvik <einaros@gmail.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
#include <nan.h>
|
||||
|
||||
NAN_METHOD(mask) {
|
||||
char* from = node::Buffer::Data(info[0]);
|
||||
char* mask = node::Buffer::Data(info[1]);
|
||||
char* to = node::Buffer::Data(info[2]) + info[3]->Int32Value();
|
||||
size_t length = info[4]->Int32Value();
|
||||
size_t index = 0;
|
||||
|
||||
//
|
||||
// Alignment preamble.
|
||||
//
|
||||
while (index < length && (reinterpret_cast<size_t>(from) & 0x07)) {
|
||||
*to++ = *from++ ^ mask[index % 4];
|
||||
index++;
|
||||
}
|
||||
length -= index;
|
||||
if (!length) return;
|
||||
|
||||
//
|
||||
// Realign mask and convert to 64 bit.
|
||||
//
|
||||
char maskAlignedArray[8];
|
||||
|
||||
for (size_t i = 0; i < 8; i++, index++) {
|
||||
maskAlignedArray[i] = mask[index % 4];
|
||||
}
|
||||
|
||||
//
|
||||
// Apply 64 bit mask in 8 byte chunks.
|
||||
//
|
||||
size_t loop = length / 8;
|
||||
uint64_t* pMask8 = reinterpret_cast<uint64_t*>(maskAlignedArray);
|
||||
|
||||
while (loop--) {
|
||||
uint64_t* pFrom8 = reinterpret_cast<uint64_t*>(from);
|
||||
uint64_t* pTo8 = reinterpret_cast<uint64_t*>(to);
|
||||
*pTo8 = *pFrom8 ^ *pMask8;
|
||||
from += 8;
|
||||
to += 8;
|
||||
}
|
||||
|
||||
//
|
||||
// Apply mask to remaining data.
|
||||
//
|
||||
char* pmaskAlignedArray = maskAlignedArray;
|
||||
|
||||
length &= 0x7;
|
||||
while (length--) {
|
||||
*to++ = *from++ ^ *pmaskAlignedArray++;
|
||||
}
|
||||
}
|
||||
|
||||
NAN_METHOD(unmask) {
|
||||
char* from = node::Buffer::Data(info[0]);
|
||||
size_t length = node::Buffer::Length(info[0]);
|
||||
char* mask = node::Buffer::Data(info[1]);
|
||||
size_t index = 0;
|
||||
|
||||
//
|
||||
// Alignment preamble.
|
||||
//
|
||||
while (index < length && (reinterpret_cast<size_t>(from) & 0x07)) {
|
||||
*from++ ^= mask[index % 4];
|
||||
index++;
|
||||
}
|
||||
length -= index;
|
||||
if (!length) return;
|
||||
|
||||
//
|
||||
// Realign mask and convert to 64 bit.
|
||||
//
|
||||
char maskAlignedArray[8];
|
||||
|
||||
for (size_t i = 0; i < 8; i++, index++) {
|
||||
maskAlignedArray[i] = mask[index % 4];
|
||||
}
|
||||
|
||||
//
|
||||
// Apply 64 bit mask in 8 byte chunks.
|
||||
//
|
||||
size_t loop = length / 8;
|
||||
uint64_t* pMask8 = reinterpret_cast<uint64_t*>(maskAlignedArray);
|
||||
|
||||
while (loop--) {
|
||||
uint64_t* pSource8 = reinterpret_cast<uint64_t*>(from);
|
||||
*pSource8 ^= *pMask8;
|
||||
from += 8;
|
||||
}
|
||||
|
||||
//
|
||||
// Apply mask to remaining data.
|
||||
//
|
||||
char* pmaskAlignedArray = maskAlignedArray;
|
||||
|
||||
length &= 0x7;
|
||||
while (length--) {
|
||||
*from++ ^= *pmaskAlignedArray++;
|
||||
}
|
||||
}
|
||||
|
||||
NAN_MODULE_INIT(init) {
|
||||
NAN_EXPORT(target, mask);
|
||||
NAN_EXPORT(target, unmask);
|
||||
}
|
||||
|
||||
NODE_MODULE(bufferutil, init)
|
||||
15
node_modules/chownr/LICENSE
generated
vendored
15
node_modules/chownr/LICENSE
generated
vendored
@@ -1,15 +0,0 @@
|
||||
The ISC License
|
||||
|
||||
Copyright (c) Isaac Z. Schlueter and Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
3
node_modules/chownr/README.md
generated
vendored
3
node_modules/chownr/README.md
generated
vendored
@@ -1,3 +0,0 @@
|
||||
Like `chown -R`.
|
||||
|
||||
Takes the same arguments as `fs.chown()`
|
||||
52
node_modules/chownr/chownr.js
generated
vendored
52
node_modules/chownr/chownr.js
generated
vendored
@@ -1,52 +0,0 @@
|
||||
module.exports = chownr
|
||||
chownr.sync = chownrSync
|
||||
|
||||
var fs = require("fs")
|
||||
, path = require("path")
|
||||
|
||||
function chownr (p, uid, gid, cb) {
|
||||
fs.readdir(p, function (er, children) {
|
||||
// any error other than ENOTDIR means it's not readable, or
|
||||
// doesn't exist. give up.
|
||||
if (er && er.code !== "ENOTDIR") return cb(er)
|
||||
if (er || !children.length) return fs.chown(p, uid, gid, cb)
|
||||
|
||||
var len = children.length
|
||||
, errState = null
|
||||
children.forEach(function (child) {
|
||||
var pathChild = path.resolve(p, child);
|
||||
fs.lstat(pathChild, function(er, stats) {
|
||||
if (er)
|
||||
return cb(er)
|
||||
if (!stats.isSymbolicLink())
|
||||
chownr(pathChild, uid, gid, then)
|
||||
else
|
||||
then()
|
||||
})
|
||||
})
|
||||
function then (er) {
|
||||
if (errState) return
|
||||
if (er) return cb(errState = er)
|
||||
if (-- len === 0) return fs.chown(p, uid, gid, cb)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function chownrSync (p, uid, gid) {
|
||||
var children
|
||||
try {
|
||||
children = fs.readdirSync(p)
|
||||
} catch (er) {
|
||||
if (er && er.code === "ENOTDIR") return fs.chownSync(p, uid, gid)
|
||||
throw er
|
||||
}
|
||||
if (!children.length) return fs.chownSync(p, uid, gid)
|
||||
|
||||
children.forEach(function (child) {
|
||||
var pathChild = path.resolve(p, child)
|
||||
var stats = fs.lstatSync(pathChild)
|
||||
if (!stats.isSymbolicLink())
|
||||
chownrSync(pathChild, uid, gid)
|
||||
})
|
||||
return fs.chownSync(p, uid, gid)
|
||||
}
|
||||
89
node_modules/chownr/package.json
generated
vendored
89
node_modules/chownr/package.json
generated
vendored
@@ -1,89 +0,0 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "chownr@^1.0.1",
|
||||
"scope": null,
|
||||
"escapedName": "chownr",
|
||||
"name": "chownr",
|
||||
"rawSpec": "^1.0.1",
|
||||
"spec": ">=1.0.1 <2.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/tar-fs"
|
||||
]
|
||||
],
|
||||
"_from": "chownr@>=1.0.1 <2.0.0",
|
||||
"_id": "chownr@1.0.1",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/chownr",
|
||||
"_nodeVersion": "2.2.1",
|
||||
"_npmUser": {
|
||||
"name": "isaacs",
|
||||
"email": "isaacs@npmjs.com"
|
||||
},
|
||||
"_npmVersion": "3.2.2",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "chownr@^1.0.1",
|
||||
"scope": null,
|
||||
"escapedName": "chownr",
|
||||
"name": "chownr",
|
||||
"rawSpec": "^1.0.1",
|
||||
"spec": ">=1.0.1 <2.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/tar-fs"
|
||||
],
|
||||
"_resolved": "http://registry.npmjs.org/chownr/-/chownr-1.0.1.tgz",
|
||||
"_shasum": "e2a75042a9551908bebd25b8523d5f9769d79181",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "chownr@^1.0.1",
|
||||
"_where": "/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/tar-fs",
|
||||
"author": {
|
||||
"name": "Isaac Z. Schlueter",
|
||||
"email": "i@izs.me",
|
||||
"url": "http://blog.izs.me/"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/isaacs/chownr/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "like `chown -R`",
|
||||
"devDependencies": {
|
||||
"mkdirp": "0.3",
|
||||
"rimraf": "",
|
||||
"tap": "^1.2.0"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "e2a75042a9551908bebd25b8523d5f9769d79181",
|
||||
"tarball": "https://registry.npmjs.org/chownr/-/chownr-1.0.1.tgz"
|
||||
},
|
||||
"files": [
|
||||
"chownr.js"
|
||||
],
|
||||
"gitHead": "c6c43844e80d7c7045e737a72b9fbb1ba0579a26",
|
||||
"homepage": "https://github.com/isaacs/chownr#readme",
|
||||
"license": "ISC",
|
||||
"main": "chownr.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "isaacs",
|
||||
"email": "i@izs.me"
|
||||
}
|
||||
],
|
||||
"name": "chownr",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/isaacs/chownr.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tap test/*.js"
|
||||
},
|
||||
"version": "1.0.1"
|
||||
}
|
||||
32
node_modules/code-point-at/index.js
generated
vendored
32
node_modules/code-point-at/index.js
generated
vendored
@@ -1,32 +0,0 @@
|
||||
/* eslint-disable babel/new-cap, xo/throw-new-error */
|
||||
'use strict';
|
||||
module.exports = function (str, pos) {
|
||||
if (str === null || str === undefined) {
|
||||
throw TypeError();
|
||||
}
|
||||
|
||||
str = String(str);
|
||||
|
||||
var size = str.length;
|
||||
var i = pos ? Number(pos) : 0;
|
||||
|
||||
if (Number.isNaN(i)) {
|
||||
i = 0;
|
||||
}
|
||||
|
||||
if (i < 0 || i >= size) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
var first = str.charCodeAt(i);
|
||||
|
||||
if (first >= 0xD800 && first <= 0xDBFF && size > i + 1) {
|
||||
var second = str.charCodeAt(i + 1);
|
||||
|
||||
if (second >= 0xDC00 && second <= 0xDFFF) {
|
||||
return ((first - 0xD800) * 0x400) + second - 0xDC00 + 0x10000;
|
||||
}
|
||||
}
|
||||
|
||||
return first;
|
||||
};
|
||||
21
node_modules/code-point-at/license
generated
vendored
21
node_modules/code-point-at/license
generated
vendored
@@ -1,21 +0,0 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.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.
|
||||
107
node_modules/code-point-at/package.json
generated
vendored
107
node_modules/code-point-at/package.json
generated
vendored
@@ -1,107 +0,0 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "code-point-at@^1.0.0",
|
||||
"scope": null,
|
||||
"escapedName": "code-point-at",
|
||||
"name": "code-point-at",
|
||||
"rawSpec": "^1.0.0",
|
||||
"spec": ">=1.0.0 <2.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/string-width"
|
||||
]
|
||||
],
|
||||
"_from": "code-point-at@>=1.0.0 <2.0.0",
|
||||
"_id": "code-point-at@1.1.0",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/code-point-at",
|
||||
"_nodeVersion": "4.6.1",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-12-west.internal.npmjs.com",
|
||||
"tmp": "tmp/code-point-at-1.1.0.tgz_1478169780337_0.8445875702891499"
|
||||
},
|
||||
"_npmUser": {
|
||||
"name": "sindresorhus",
|
||||
"email": "sindresorhus@gmail.com"
|
||||
},
|
||||
"_npmVersion": "2.15.9",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "code-point-at@^1.0.0",
|
||||
"scope": null,
|
||||
"escapedName": "code-point-at",
|
||||
"name": "code-point-at",
|
||||
"rawSpec": "^1.0.0",
|
||||
"spec": ">=1.0.0 <2.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/string-width"
|
||||
],
|
||||
"_resolved": "http://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz",
|
||||
"_shasum": "0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "code-point-at@^1.0.0",
|
||||
"_where": "/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/string-width",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/code-point-at/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "ES2015 `String#codePointAt()` ponyfill",
|
||||
"devDependencies": {
|
||||
"ava": "*",
|
||||
"xo": "^0.16.0"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77",
|
||||
"tarball": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"gitHead": "f8f21c8df2d40248fef1b36ca9076e59c0c34791",
|
||||
"homepage": "https://github.com/sindresorhus/code-point-at#readme",
|
||||
"keywords": [
|
||||
"es2015",
|
||||
"ponyfill",
|
||||
"polyfill",
|
||||
"shim",
|
||||
"string",
|
||||
"str",
|
||||
"code",
|
||||
"point",
|
||||
"at",
|
||||
"codepoint",
|
||||
"unicode"
|
||||
],
|
||||
"license": "MIT",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "sindresorhus",
|
||||
"email": "sindresorhus@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "code-point-at",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sindresorhus/code-point-at.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"version": "1.1.0"
|
||||
}
|
||||
32
node_modules/code-point-at/readme.md
generated
vendored
32
node_modules/code-point-at/readme.md
generated
vendored
@@ -1,32 +0,0 @@
|
||||
# code-point-at [](https://travis-ci.org/sindresorhus/code-point-at)
|
||||
|
||||
> ES2015 [`String#codePointAt()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/codePointAt) [ponyfill](https://ponyfill.com)
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install --save code-point-at
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var codePointAt = require('code-point-at');
|
||||
|
||||
codePointAt('🐴');
|
||||
//=> 128052
|
||||
|
||||
codePointAt('abc', 2);
|
||||
//=> 99
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### codePointAt(input, [position])
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
261
node_modules/commander/History.md
generated
vendored
261
node_modules/commander/History.md
generated
vendored
@@ -1,261 +0,0 @@
|
||||
|
||||
2.9.0 / 2015-10-13
|
||||
==================
|
||||
|
||||
* Add option `isDefault` to set default subcommand #415 @Qix-
|
||||
* Add callback to allow filtering or post-processing of help text #434 @djulien
|
||||
* Fix `undefined` text in help information close #414 #416 @zhiyelee
|
||||
|
||||
2.8.1 / 2015-04-22
|
||||
==================
|
||||
|
||||
* Back out `support multiline description` Close #396 #397
|
||||
|
||||
2.8.0 / 2015-04-07
|
||||
==================
|
||||
|
||||
* Add `process.execArg` support, execution args like `--harmony` will be passed to sub-commands #387 @DigitalIO @zhiyelee
|
||||
* Fix bug in Git-style sub-commands #372 @zhiyelee
|
||||
* Allow commands to be hidden from help #383 @tonylukasavage
|
||||
* When git-style sub-commands are in use, yet none are called, display help #382 @claylo
|
||||
* Add ability to specify arguments syntax for top-level command #258 @rrthomas
|
||||
* Support multiline descriptions #208 @zxqfox
|
||||
|
||||
2.7.1 / 2015-03-11
|
||||
==================
|
||||
|
||||
* Revert #347 (fix collisions when option and first arg have same name) which causes a bug in #367.
|
||||
|
||||
2.7.0 / 2015-03-09
|
||||
==================
|
||||
|
||||
* Fix git-style bug when installed globally. Close #335 #349 @zhiyelee
|
||||
* Fix collisions when option and first arg have same name. Close #346 #347 @tonylukasavage
|
||||
* Add support for camelCase on `opts()`. Close #353 @nkzawa
|
||||
* Add node.js 0.12 and io.js to travis.yml
|
||||
* Allow RegEx options. #337 @palanik
|
||||
* Fixes exit code when sub-command failing. Close #260 #332 @pirelenito
|
||||
* git-style `bin` files in $PATH make sense. Close #196 #327 @zhiyelee
|
||||
|
||||
2.6.0 / 2014-12-30
|
||||
==================
|
||||
|
||||
* added `Command#allowUnknownOption` method. Close #138 #318 @doozr @zhiyelee
|
||||
* Add application description to the help msg. Close #112 @dalssoft
|
||||
|
||||
2.5.1 / 2014-12-15
|
||||
==================
|
||||
|
||||
* fixed two bugs incurred by variadic arguments. Close #291 @Quentin01 #302 @zhiyelee
|
||||
|
||||
2.5.0 / 2014-10-24
|
||||
==================
|
||||
|
||||
* add support for variadic arguments. Closes #277 @whitlockjc
|
||||
|
||||
2.4.0 / 2014-10-17
|
||||
==================
|
||||
|
||||
* fixed a bug on executing the coercion function of subcommands option. Closes #270
|
||||
* added `Command.prototype.name` to retrieve command name. Closes #264 #266 @tonylukasavage
|
||||
* added `Command.prototype.opts` to retrieve all the options as a simple object of key-value pairs. Closes #262 @tonylukasavage
|
||||
* fixed a bug on subcommand name. Closes #248 @jonathandelgado
|
||||
* fixed function normalize doesn’t honor option terminator. Closes #216 @abbr
|
||||
|
||||
2.3.0 / 2014-07-16
|
||||
==================
|
||||
|
||||
* add command alias'. Closes PR #210
|
||||
* fix: Typos. Closes #99
|
||||
* fix: Unused fs module. Closes #217
|
||||
|
||||
2.2.0 / 2014-03-29
|
||||
==================
|
||||
|
||||
* add passing of previous option value
|
||||
* fix: support subcommands on windows. Closes #142
|
||||
* Now the defaultValue passed as the second argument of the coercion function.
|
||||
|
||||
2.1.0 / 2013-11-21
|
||||
==================
|
||||
|
||||
* add: allow cflag style option params, unit test, fixes #174
|
||||
|
||||
2.0.0 / 2013-07-18
|
||||
==================
|
||||
|
||||
* remove input methods (.prompt, .confirm, etc)
|
||||
|
||||
1.3.2 / 2013-07-18
|
||||
==================
|
||||
|
||||
* add support for sub-commands to co-exist with the original command
|
||||
|
||||
1.3.1 / 2013-07-18
|
||||
==================
|
||||
|
||||
* add quick .runningCommand hack so you can opt-out of other logic when running a sub command
|
||||
|
||||
1.3.0 / 2013-07-09
|
||||
==================
|
||||
|
||||
* add EACCES error handling
|
||||
* fix sub-command --help
|
||||
|
||||
1.2.0 / 2013-06-13
|
||||
==================
|
||||
|
||||
* allow "-" hyphen as an option argument
|
||||
* support for RegExp coercion
|
||||
|
||||
1.1.1 / 2012-11-20
|
||||
==================
|
||||
|
||||
* add more sub-command padding
|
||||
* fix .usage() when args are present. Closes #106
|
||||
|
||||
1.1.0 / 2012-11-16
|
||||
==================
|
||||
|
||||
* add git-style executable subcommand support. Closes #94
|
||||
|
||||
1.0.5 / 2012-10-09
|
||||
==================
|
||||
|
||||
* fix `--name` clobbering. Closes #92
|
||||
* fix examples/help. Closes #89
|
||||
|
||||
1.0.4 / 2012-09-03
|
||||
==================
|
||||
|
||||
* add `outputHelp()` method.
|
||||
|
||||
1.0.3 / 2012-08-30
|
||||
==================
|
||||
|
||||
* remove invalid .version() defaulting
|
||||
|
||||
1.0.2 / 2012-08-24
|
||||
==================
|
||||
|
||||
* add `--foo=bar` support [arv]
|
||||
* fix password on node 0.8.8. Make backward compatible with 0.6 [focusaurus]
|
||||
|
||||
1.0.1 / 2012-08-03
|
||||
==================
|
||||
|
||||
* fix issue #56
|
||||
* fix tty.setRawMode(mode) was moved to tty.ReadStream#setRawMode() (i.e. process.stdin.setRawMode())
|
||||
|
||||
1.0.0 / 2012-07-05
|
||||
==================
|
||||
|
||||
* add support for optional option descriptions
|
||||
* add defaulting of `.version()` to package.json's version
|
||||
|
||||
0.6.1 / 2012-06-01
|
||||
==================
|
||||
|
||||
* Added: append (yes or no) on confirmation
|
||||
* Added: allow node.js v0.7.x
|
||||
|
||||
0.6.0 / 2012-04-10
|
||||
==================
|
||||
|
||||
* Added `.prompt(obj, callback)` support. Closes #49
|
||||
* Added default support to .choose(). Closes #41
|
||||
* Fixed the choice example
|
||||
|
||||
0.5.1 / 2011-12-20
|
||||
==================
|
||||
|
||||
* Fixed `password()` for recent nodes. Closes #36
|
||||
|
||||
0.5.0 / 2011-12-04
|
||||
==================
|
||||
|
||||
* Added sub-command option support [itay]
|
||||
|
||||
0.4.3 / 2011-12-04
|
||||
==================
|
||||
|
||||
* Fixed custom help ordering. Closes #32
|
||||
|
||||
0.4.2 / 2011-11-24
|
||||
==================
|
||||
|
||||
* Added travis support
|
||||
* Fixed: line-buffered input automatically trimmed. Closes #31
|
||||
|
||||
0.4.1 / 2011-11-18
|
||||
==================
|
||||
|
||||
* Removed listening for "close" on --help
|
||||
|
||||
0.4.0 / 2011-11-15
|
||||
==================
|
||||
|
||||
* Added support for `--`. Closes #24
|
||||
|
||||
0.3.3 / 2011-11-14
|
||||
==================
|
||||
|
||||
* Fixed: wait for close event when writing help info [Jerry Hamlet]
|
||||
|
||||
0.3.2 / 2011-11-01
|
||||
==================
|
||||
|
||||
* Fixed long flag definitions with values [felixge]
|
||||
|
||||
0.3.1 / 2011-10-31
|
||||
==================
|
||||
|
||||
* Changed `--version` short flag to `-V` from `-v`
|
||||
* Changed `.version()` so it's configurable [felixge]
|
||||
|
||||
0.3.0 / 2011-10-31
|
||||
==================
|
||||
|
||||
* Added support for long flags only. Closes #18
|
||||
|
||||
0.2.1 / 2011-10-24
|
||||
==================
|
||||
|
||||
* "node": ">= 0.4.x < 0.7.0". Closes #20
|
||||
|
||||
0.2.0 / 2011-09-26
|
||||
==================
|
||||
|
||||
* Allow for defaults that are not just boolean. Default peassignment only occurs for --no-*, optional, and required arguments. [Jim Isaacs]
|
||||
|
||||
0.1.0 / 2011-08-24
|
||||
==================
|
||||
|
||||
* Added support for custom `--help` output
|
||||
|
||||
0.0.5 / 2011-08-18
|
||||
==================
|
||||
|
||||
* Changed: when the user enters nothing prompt for password again
|
||||
* Fixed issue with passwords beginning with numbers [NuckChorris]
|
||||
|
||||
0.0.4 / 2011-08-15
|
||||
==================
|
||||
|
||||
* Fixed `Commander#args`
|
||||
|
||||
0.0.3 / 2011-08-15
|
||||
==================
|
||||
|
||||
* Added default option value support
|
||||
|
||||
0.0.2 / 2011-08-15
|
||||
==================
|
||||
|
||||
* Added mask support to `Command#password(str[, mask], fn)`
|
||||
* Added `Command#password(str, fn)`
|
||||
|
||||
0.0.1 / 2010-01-03
|
||||
==================
|
||||
|
||||
* Initial release
|
||||
22
node_modules/commander/LICENSE
generated
vendored
22
node_modules/commander/LICENSE
generated
vendored
@@ -1,22 +0,0 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2011 TJ Holowaychuk <tj@vision-media.ca>
|
||||
|
||||
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.
|
||||
351
node_modules/commander/Readme.md
generated
vendored
351
node_modules/commander/Readme.md
generated
vendored
@@ -1,351 +0,0 @@
|
||||
# Commander.js
|
||||
|
||||
|
||||
[](http://travis-ci.org/tj/commander.js)
|
||||
[](https://www.npmjs.org/package/commander)
|
||||
[](https://www.npmjs.org/package/commander)
|
||||
[](https://gitter.im/tj/commander.js?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
|
||||
The complete solution for [node.js](http://nodejs.org) command-line interfaces, inspired by Ruby's [commander](https://github.com/tj/commander).
|
||||
[API documentation](http://tj.github.com/commander.js/)
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
$ npm install commander
|
||||
|
||||
## Option parsing
|
||||
|
||||
Options with commander are defined with the `.option()` method, also serving as documentation for the options. The example below parses args and options from `process.argv`, leaving remaining args as the `program.args` array which were not consumed by options.
|
||||
|
||||
```js
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var program = require('commander');
|
||||
|
||||
program
|
||||
.version('0.0.1')
|
||||
.option('-p, --peppers', 'Add peppers')
|
||||
.option('-P, --pineapple', 'Add pineapple')
|
||||
.option('-b, --bbq-sauce', 'Add bbq sauce')
|
||||
.option('-c, --cheese [type]', 'Add the specified type of cheese [marble]', 'marble')
|
||||
.parse(process.argv);
|
||||
|
||||
console.log('you ordered a pizza with:');
|
||||
if (program.peppers) console.log(' - peppers');
|
||||
if (program.pineapple) console.log(' - pineapple');
|
||||
if (program.bbqSauce) console.log(' - bbq');
|
||||
console.log(' - %s cheese', program.cheese);
|
||||
```
|
||||
|
||||
Short flags may be passed as a single arg, for example `-abc` is equivalent to `-a -b -c`. Multi-word options such as "--template-engine" are camel-cased, becoming `program.templateEngine` etc.
|
||||
|
||||
|
||||
## Coercion
|
||||
|
||||
```js
|
||||
function range(val) {
|
||||
return val.split('..').map(Number);
|
||||
}
|
||||
|
||||
function list(val) {
|
||||
return val.split(',');
|
||||
}
|
||||
|
||||
function collect(val, memo) {
|
||||
memo.push(val);
|
||||
return memo;
|
||||
}
|
||||
|
||||
function increaseVerbosity(v, total) {
|
||||
return total + 1;
|
||||
}
|
||||
|
||||
program
|
||||
.version('0.0.1')
|
||||
.usage('[options] <file ...>')
|
||||
.option('-i, --integer <n>', 'An integer argument', parseInt)
|
||||
.option('-f, --float <n>', 'A float argument', parseFloat)
|
||||
.option('-r, --range <a>..<b>', 'A range', range)
|
||||
.option('-l, --list <items>', 'A list', list)
|
||||
.option('-o, --optional [value]', 'An optional value')
|
||||
.option('-c, --collect [value]', 'A repeatable value', collect, [])
|
||||
.option('-v, --verbose', 'A value that can be increased', increaseVerbosity, 0)
|
||||
.parse(process.argv);
|
||||
|
||||
console.log(' int: %j', program.integer);
|
||||
console.log(' float: %j', program.float);
|
||||
console.log(' optional: %j', program.optional);
|
||||
program.range = program.range || [];
|
||||
console.log(' range: %j..%j', program.range[0], program.range[1]);
|
||||
console.log(' list: %j', program.list);
|
||||
console.log(' collect: %j', program.collect);
|
||||
console.log(' verbosity: %j', program.verbose);
|
||||
console.log(' args: %j', program.args);
|
||||
```
|
||||
|
||||
## Regular Expression
|
||||
```js
|
||||
program
|
||||
.version('0.0.1')
|
||||
.option('-s --size <size>', 'Pizza size', /^(large|medium|small)$/i, 'medium')
|
||||
.option('-d --drink [drink]', 'Drink', /^(coke|pepsi|izze)$/i)
|
||||
.parse(process.argv);
|
||||
|
||||
console.log(' size: %j', program.size);
|
||||
console.log(' drink: %j', program.drink);
|
||||
```
|
||||
|
||||
## Variadic arguments
|
||||
|
||||
The last argument of a command can be variadic, and only the last argument. To make an argument variadic you have to
|
||||
append `...` to the argument name. Here is an example:
|
||||
|
||||
```js
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var program = require('commander');
|
||||
|
||||
program
|
||||
.version('0.0.1')
|
||||
.command('rmdir <dir> [otherDirs...]')
|
||||
.action(function (dir, otherDirs) {
|
||||
console.log('rmdir %s', dir);
|
||||
if (otherDirs) {
|
||||
otherDirs.forEach(function (oDir) {
|
||||
console.log('rmdir %s', oDir);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
program.parse(process.argv);
|
||||
```
|
||||
|
||||
An `Array` is used for the value of a variadic argument. This applies to `program.args` as well as the argument passed
|
||||
to your action as demonstrated above.
|
||||
|
||||
## Specify the argument syntax
|
||||
|
||||
```js
|
||||
#!/usr/bin/env node
|
||||
|
||||
var program = require('../');
|
||||
|
||||
program
|
||||
.version('0.0.1')
|
||||
.arguments('<cmd> [env]')
|
||||
.action(function (cmd, env) {
|
||||
cmdValue = cmd;
|
||||
envValue = env;
|
||||
});
|
||||
|
||||
program.parse(process.argv);
|
||||
|
||||
if (typeof cmdValue === 'undefined') {
|
||||
console.error('no command given!');
|
||||
process.exit(1);
|
||||
}
|
||||
console.log('command:', cmdValue);
|
||||
console.log('environment:', envValue || "no environment given");
|
||||
```
|
||||
|
||||
## Git-style sub-commands
|
||||
|
||||
```js
|
||||
// file: ./examples/pm
|
||||
var program = require('..');
|
||||
|
||||
program
|
||||
.version('0.0.1')
|
||||
.command('install [name]', 'install one or more packages')
|
||||
.command('search [query]', 'search with optional query')
|
||||
.command('list', 'list packages installed', {isDefault: true})
|
||||
.parse(process.argv);
|
||||
```
|
||||
|
||||
When `.command()` is invoked with a description argument, no `.action(callback)` should be called to handle sub-commands, otherwise there will be an error. This tells commander that you're going to use separate executables for sub-commands, much like `git(1)` and other popular tools.
|
||||
The commander will try to search the executables in the directory of the entry script (like `./examples/pm`) with the name `program-command`, like `pm-install`, `pm-search`.
|
||||
|
||||
Options can be passed with the call to `.command()`. Specifying `true` for `opts.noHelp` will remove the option from the generated help output. Specifying `true` for `opts.isDefault` will run the subcommand if no other subcommand is specified.
|
||||
|
||||
If the program is designed to be installed globally, make sure the executables have proper modes, like `755`.
|
||||
|
||||
### `--harmony`
|
||||
|
||||
You can enable `--harmony` option in two ways:
|
||||
* Use `#! /usr/bin/env node --harmony` in the sub-commands scripts. Note some os version don’t support this pattern.
|
||||
* Use the `--harmony` option when call the command, like `node --harmony examples/pm publish`. The `--harmony` option will be preserved when spawning sub-command process.
|
||||
|
||||
## Automated --help
|
||||
|
||||
The help information is auto-generated based on the information commander already knows about your program, so the following `--help` info is for free:
|
||||
|
||||
```
|
||||
$ ./examples/pizza --help
|
||||
|
||||
Usage: pizza [options]
|
||||
|
||||
An application for pizzas ordering
|
||||
|
||||
Options:
|
||||
|
||||
-h, --help output usage information
|
||||
-V, --version output the version number
|
||||
-p, --peppers Add peppers
|
||||
-P, --pineapple Add pineapple
|
||||
-b, --bbq Add bbq sauce
|
||||
-c, --cheese <type> Add the specified type of cheese [marble]
|
||||
-C, --no-cheese You do not want any cheese
|
||||
|
||||
```
|
||||
|
||||
## Custom help
|
||||
|
||||
You can display arbitrary `-h, --help` information
|
||||
by listening for "--help". Commander will automatically
|
||||
exit once you are done so that the remainder of your program
|
||||
does not execute causing undesired behaviours, for example
|
||||
in the following executable "stuff" will not output when
|
||||
`--help` is used.
|
||||
|
||||
```js
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var program = require('commander');
|
||||
|
||||
program
|
||||
.version('0.0.1')
|
||||
.option('-f, --foo', 'enable some foo')
|
||||
.option('-b, --bar', 'enable some bar')
|
||||
.option('-B, --baz', 'enable some baz');
|
||||
|
||||
// must be before .parse() since
|
||||
// node's emit() is immediate
|
||||
|
||||
program.on('--help', function(){
|
||||
console.log(' Examples:');
|
||||
console.log('');
|
||||
console.log(' $ custom-help --help');
|
||||
console.log(' $ custom-help -h');
|
||||
console.log('');
|
||||
});
|
||||
|
||||
program.parse(process.argv);
|
||||
|
||||
console.log('stuff');
|
||||
```
|
||||
|
||||
Yields the following help output when `node script-name.js -h` or `node script-name.js --help` are run:
|
||||
|
||||
```
|
||||
|
||||
Usage: custom-help [options]
|
||||
|
||||
Options:
|
||||
|
||||
-h, --help output usage information
|
||||
-V, --version output the version number
|
||||
-f, --foo enable some foo
|
||||
-b, --bar enable some bar
|
||||
-B, --baz enable some baz
|
||||
|
||||
Examples:
|
||||
|
||||
$ custom-help --help
|
||||
$ custom-help -h
|
||||
|
||||
```
|
||||
|
||||
## .outputHelp(cb)
|
||||
|
||||
Output help information without exiting.
|
||||
Optional callback cb allows post-processing of help text before it is displayed.
|
||||
|
||||
If you want to display help by default (e.g. if no command was provided), you can use something like:
|
||||
|
||||
```js
|
||||
var program = require('commander');
|
||||
var colors = require('colors');
|
||||
|
||||
program
|
||||
.version('0.0.1')
|
||||
.command('getstream [url]', 'get stream URL')
|
||||
.parse(process.argv);
|
||||
|
||||
if (!process.argv.slice(2).length) {
|
||||
program.outputHelp(make_red);
|
||||
}
|
||||
|
||||
function make_red(txt) {
|
||||
return colors.red(txt); //display the help text in red on the console
|
||||
}
|
||||
```
|
||||
|
||||
## .help(cb)
|
||||
|
||||
Output help information and exit immediately.
|
||||
Optional callback cb allows post-processing of help text before it is displayed.
|
||||
|
||||
## Examples
|
||||
|
||||
```js
|
||||
var program = require('commander');
|
||||
|
||||
program
|
||||
.version('0.0.1')
|
||||
.option('-C, --chdir <path>', 'change the working directory')
|
||||
.option('-c, --config <path>', 'set config path. defaults to ./deploy.conf')
|
||||
.option('-T, --no-tests', 'ignore test hook')
|
||||
|
||||
program
|
||||
.command('setup [env]')
|
||||
.description('run setup commands for all envs')
|
||||
.option("-s, --setup_mode [mode]", "Which setup mode to use")
|
||||
.action(function(env, options){
|
||||
var mode = options.setup_mode || "normal";
|
||||
env = env || 'all';
|
||||
console.log('setup for %s env(s) with %s mode', env, mode);
|
||||
});
|
||||
|
||||
program
|
||||
.command('exec <cmd>')
|
||||
.alias('ex')
|
||||
.description('execute the given remote cmd')
|
||||
.option("-e, --exec_mode <mode>", "Which exec mode to use")
|
||||
.action(function(cmd, options){
|
||||
console.log('exec "%s" using %s mode', cmd, options.exec_mode);
|
||||
}).on('--help', function() {
|
||||
console.log(' Examples:');
|
||||
console.log();
|
||||
console.log(' $ deploy exec sequential');
|
||||
console.log(' $ deploy exec async');
|
||||
console.log();
|
||||
});
|
||||
|
||||
program
|
||||
.command('*')
|
||||
.action(function(env){
|
||||
console.log('deploying "%s"', env);
|
||||
});
|
||||
|
||||
program.parse(process.argv);
|
||||
```
|
||||
|
||||
More Demos can be found in the [examples](https://github.com/tj/commander.js/tree/master/examples) directory.
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
|
||||
1110
node_modules/commander/index.js
generated
vendored
1110
node_modules/commander/index.js
generated
vendored
File diff suppressed because it is too large
Load Diff
106
node_modules/commander/package.json
generated
vendored
106
node_modules/commander/package.json
generated
vendored
@@ -1,106 +0,0 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "commander",
|
||||
"scope": null,
|
||||
"escapedName": "commander",
|
||||
"name": "commander",
|
||||
"rawSpec": "",
|
||||
"spec": "latest",
|
||||
"type": "tag"
|
||||
},
|
||||
"/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket"
|
||||
]
|
||||
],
|
||||
"_from": "commander@latest",
|
||||
"_id": "commander@2.9.0",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/commander",
|
||||
"_nodeVersion": "0.12.7",
|
||||
"_npmUser": {
|
||||
"name": "zhiyelee",
|
||||
"email": "zhiyelee@gmail.com"
|
||||
},
|
||||
"_npmVersion": "2.11.3",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "commander",
|
||||
"scope": null,
|
||||
"escapedName": "commander",
|
||||
"name": "commander",
|
||||
"rawSpec": "",
|
||||
"spec": "latest",
|
||||
"type": "tag"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#USER",
|
||||
"/"
|
||||
],
|
||||
"_resolved": "http://registry.npmjs.org/commander/-/commander-2.9.0.tgz",
|
||||
"_shasum": "9c99094176e12240cb22d6c5146098400fe0f7d4",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "commander",
|
||||
"_where": "/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket",
|
||||
"author": {
|
||||
"name": "TJ Holowaychuk",
|
||||
"email": "tj@vision-media.ca"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/tj/commander.js/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"graceful-readlink": ">= 1.0.0"
|
||||
},
|
||||
"description": "the complete solution for node.js command-line programs",
|
||||
"devDependencies": {
|
||||
"should": ">= 0.0.1",
|
||||
"sinon": ">=1.17.1"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "9c99094176e12240cb22d6c5146098400fe0f7d4",
|
||||
"tarball": "https://registry.npmjs.org/commander/-/commander-2.9.0.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6.x"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"gitHead": "b2aad7a8471d434593a85306aa73777a526e9f75",
|
||||
"homepage": "https://github.com/tj/commander.js#readme",
|
||||
"keywords": [
|
||||
"command",
|
||||
"option",
|
||||
"parser"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "tjholowaychuk",
|
||||
"email": "tj@vision-media.ca"
|
||||
},
|
||||
{
|
||||
"name": "somekittens",
|
||||
"email": "rkoutnik@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "zhiyelee",
|
||||
"email": "zhiyelee@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "commander",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/tj/commander.js.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "make test"
|
||||
},
|
||||
"version": "2.9.0"
|
||||
}
|
||||
13
node_modules/console-control-strings/LICENSE
generated
vendored
13
node_modules/console-control-strings/LICENSE
generated
vendored
@@ -1,13 +0,0 @@
|
||||
Copyright (c) 2014, Rebecca Turner <me@re-becca.org>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
145
node_modules/console-control-strings/README.md
generated
vendored
145
node_modules/console-control-strings/README.md
generated
vendored
@@ -1,145 +0,0 @@
|
||||
# Console Control Strings
|
||||
|
||||
A library of cross-platform tested terminal/console command strings for
|
||||
doing things like color and cursor positioning. This is a subset of both
|
||||
ansi and vt100. All control codes included work on both Windows & Unix-like
|
||||
OSes, except where noted.
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var consoleControl = require('console-control-strings')
|
||||
|
||||
console.log(consoleControl.color('blue','bgRed', 'bold') + 'hi there' + consoleControl.color('reset'))
|
||||
process.stdout.write(consoleControl.goto(75, 10))
|
||||
```
|
||||
|
||||
## Why Another?
|
||||
|
||||
There are tons of libraries similar to this one. I wanted one that was:
|
||||
|
||||
1. Very clear about compatibility goals.
|
||||
2. Could emit, for instance, a start color code without an end one.
|
||||
3. Returned strings w/o writing to streams.
|
||||
4. Was not weighed down with other unrelated baggage.
|
||||
|
||||
## Functions
|
||||
|
||||
### var code = consoleControl.up(_num = 1_)
|
||||
|
||||
Returns the escape sequence to move _num_ lines up.
|
||||
|
||||
### var code = consoleControl.down(_num = 1_)
|
||||
|
||||
Returns the escape sequence to move _num_ lines down.
|
||||
|
||||
### var code = consoleControl.forward(_num = 1_)
|
||||
|
||||
Returns the escape sequence to move _num_ lines righ.
|
||||
|
||||
### var code = consoleControl.back(_num = 1_)
|
||||
|
||||
Returns the escape sequence to move _num_ lines left.
|
||||
|
||||
### var code = consoleControl.nextLine(_num = 1_)
|
||||
|
||||
Returns the escape sequence to move _num_ lines down and to the beginning of
|
||||
the line.
|
||||
|
||||
### var code = consoleControl.previousLine(_num = 1_)
|
||||
|
||||
Returns the escape sequence to move _num_ lines up and to the beginning of
|
||||
the line.
|
||||
|
||||
### var code = consoleControl.eraseData()
|
||||
|
||||
Returns the escape sequence to erase everything from the current cursor
|
||||
position to the bottom right of the screen. This is line based, so it
|
||||
erases the remainder of the current line and all following lines.
|
||||
|
||||
### var code = consoleControl.eraseLine()
|
||||
|
||||
Returns the escape sequence to erase to the end of the current line.
|
||||
|
||||
### var code = consoleControl.goto(_x_, _y_)
|
||||
|
||||
Returns the escape sequence to move the cursor to the designated position.
|
||||
Note that the origin is _1, 1_ not _0, 0_.
|
||||
|
||||
### var code = consoleControl.gotoSOL()
|
||||
|
||||
Returns the escape sequence to move the cursor to the beginning of the
|
||||
current line. (That is, it returns a carriage return, `\r`.)
|
||||
|
||||
### var code = consoleControl.beep()
|
||||
|
||||
Returns the escape sequence to cause the termianl to beep. (That is, it
|
||||
returns unicode character `\x0007`, a Control-G.)
|
||||
|
||||
### var code = consoleControl.hideCursor()
|
||||
|
||||
Returns the escape sequence to hide the cursor.
|
||||
|
||||
### var code = consoleControl.showCursor()
|
||||
|
||||
Returns the escape sequence to show the cursor.
|
||||
|
||||
### var code = consoleControl.color(_colors = []_)
|
||||
|
||||
### var code = consoleControl.color(_color1_, _color2_, _…_, _colorn_)
|
||||
|
||||
Returns the escape sequence to set the current terminal display attributes
|
||||
(mostly colors). Arguments can either be a list of attributes or an array
|
||||
of attributes. The difference between passing in an array or list of colors
|
||||
and calling `.color` separately for each one, is that in the former case a
|
||||
single escape sequence will be produced where as in the latter each change
|
||||
will have its own distinct escape sequence. Each attribute can be one of:
|
||||
|
||||
* Reset:
|
||||
* **reset** – Reset all attributes to the terminal default.
|
||||
* Styles:
|
||||
* **bold** – Display text as bold. In some terminals this means using a
|
||||
bold font, in others this means changing the color. In some it means
|
||||
both.
|
||||
* **italic** – Display text as italic. This is not available in most Windows terminals.
|
||||
* **underline** – Underline text. This is not available in most Windows Terminals.
|
||||
* **inverse** – Invert the foreground and background colors.
|
||||
* **stopBold** – Do not display text as bold.
|
||||
* **stopItalic** – Do not display text as italic.
|
||||
* **stopUnderline** – Do not underline text.
|
||||
* **stopInverse** – Do not invert foreground and background.
|
||||
* Colors:
|
||||
* **white**
|
||||
* **black**
|
||||
* **blue**
|
||||
* **cyan**
|
||||
* **green**
|
||||
* **magenta**
|
||||
* **red**
|
||||
* **yellow**
|
||||
* **grey** / **brightBlack**
|
||||
* **brightRed**
|
||||
* **brightGreen**
|
||||
* **brightYellow**
|
||||
* **brightBlue**
|
||||
* **brightMagenta**
|
||||
* **brightCyan**
|
||||
* **brightWhite**
|
||||
* Background Colors:
|
||||
* **bgWhite**
|
||||
* **bgBlack**
|
||||
* **bgBlue**
|
||||
* **bgCyan**
|
||||
* **bgGreen**
|
||||
* **bgMagenta**
|
||||
* **bgRed**
|
||||
* **bgYellow**
|
||||
* **bgGrey** / **bgBrightBlack**
|
||||
* **bgBrightRed**
|
||||
* **bgBrightGreen**
|
||||
* **bgBrightYellow**
|
||||
* **bgBrightBlue**
|
||||
* **bgBrightMagenta**
|
||||
* **bgBrightCyan**
|
||||
* **bgBrightWhite**
|
||||
|
||||
140
node_modules/console-control-strings/README.md~
generated
vendored
140
node_modules/console-control-strings/README.md~
generated
vendored
@@ -1,140 +0,0 @@
|
||||
# Console Control Strings
|
||||
|
||||
A library of cross-platform tested terminal/console command strings for
|
||||
doing things like color and cursor positioning. This is a subset of both
|
||||
ansi and vt100. All control codes included work on both Windows & Unix-like
|
||||
OSes, except where noted.
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var consoleControl = require('console-control-strings')
|
||||
|
||||
console.log(consoleControl.color('blue','bgRed', 'bold') + 'hi there' + consoleControl.color('reset'))
|
||||
process.stdout.write(consoleControl.goto(75, 10))
|
||||
```
|
||||
|
||||
## Why Another?
|
||||
|
||||
There are tons of libraries similar to this one. I wanted one that was:
|
||||
|
||||
1. Very clear about compatibility goals.
|
||||
2. Could emit, for instance, a start color code without an end one.
|
||||
3. Returned strings w/o writing to streams.
|
||||
4. Was not weighed down with other unrelated baggage.
|
||||
|
||||
## Functions
|
||||
|
||||
### var code = consoleControl.up(_num = 1_)
|
||||
|
||||
Returns the escape sequence to move _num_ lines up.
|
||||
|
||||
### var code = consoleControl.down(_num = 1_)
|
||||
|
||||
Returns the escape sequence to move _num_ lines down.
|
||||
|
||||
### var code = consoleControl.forward(_num = 1_)
|
||||
|
||||
Returns the escape sequence to move _num_ lines righ.
|
||||
|
||||
### var code = consoleControl.back(_num = 1_)
|
||||
|
||||
Returns the escape sequence to move _num_ lines left.
|
||||
|
||||
### var code = consoleControl.nextLine(_num = 1_)
|
||||
|
||||
Returns the escape sequence to move _num_ lines down and to the beginning of
|
||||
the line.
|
||||
|
||||
### var code = consoleControl.previousLine(_num = 1_)
|
||||
|
||||
Returns the escape sequence to move _num_ lines up and to the beginning of
|
||||
the line.
|
||||
|
||||
### var code = consoleControl.eraseData()
|
||||
|
||||
Returns the escape sequence to erase everything from the current cursor
|
||||
position to the bottom right of the screen. This is line based, so it
|
||||
erases the remainder of the current line and all following lines.
|
||||
|
||||
### var code = consoleControl.eraseLine()
|
||||
|
||||
Returns the escape sequence to erase to the end of the current line.
|
||||
|
||||
### var code = consoleControl.goto(_x_, _y_)
|
||||
|
||||
Returns the escape sequence to move the cursor to the designated position.
|
||||
Note that the origin is _1, 1_ not _0, 0_.
|
||||
|
||||
### var code = consoleControl.gotoSOL()
|
||||
|
||||
Returns the escape sequence to move the cursor to the beginning of the
|
||||
current line. (That is, it returns a carriage return, `\r`.)
|
||||
|
||||
### var code = consoleControl.hideCursor()
|
||||
|
||||
Returns the escape sequence to hide the cursor.
|
||||
|
||||
### var code = consoleControl.showCursor()
|
||||
|
||||
Returns the escape sequence to show the cursor.
|
||||
|
||||
### var code = consoleControl.color(_colors = []_)
|
||||
|
||||
### var code = consoleControl.color(_color1_, _color2_, _…_, _colorn_)
|
||||
|
||||
Returns the escape sequence to set the current terminal display attributes
|
||||
(mostly colors). Arguments can either be a list of attributes or an array
|
||||
of attributes. The difference between passing in an array or list of colors
|
||||
and calling `.color` separately for each one, is that in the former case a
|
||||
single escape sequence will be produced where as in the latter each change
|
||||
will have its own distinct escape sequence. Each attribute can be one of:
|
||||
|
||||
* Reset:
|
||||
* **reset** – Reset all attributes to the terminal default.
|
||||
* Styles:
|
||||
* **bold** – Display text as bold. In some terminals this means using a
|
||||
bold font, in others this means changing the color. In some it means
|
||||
both.
|
||||
* **italic** – Display text as italic. This is not available in most Windows terminals.
|
||||
* **underline** – Underline text. This is not available in most Windows Terminals.
|
||||
* **inverse** – Invert the foreground and background colors.
|
||||
* **stopBold** – Do not display text as bold.
|
||||
* **stopItalic** – Do not display text as italic.
|
||||
* **stopUnderline** – Do not underline text.
|
||||
* **stopInverse** – Do not invert foreground and background.
|
||||
* Colors:
|
||||
* **white**
|
||||
* **black**
|
||||
* **blue**
|
||||
* **cyan**
|
||||
* **green**
|
||||
* **magenta**
|
||||
* **red**
|
||||
* **yellow**
|
||||
* **grey** / **brightBlack**
|
||||
* **brightRed**
|
||||
* **brightGreen**
|
||||
* **brightYellow**
|
||||
* **brightBlue**
|
||||
* **brightMagenta**
|
||||
* **brightCyan**
|
||||
* **brightWhite**
|
||||
* Background Colors:
|
||||
* **bgWhite**
|
||||
* **bgBlack**
|
||||
* **bgBlue**
|
||||
* **bgCyan**
|
||||
* **bgGreen**
|
||||
* **bgMagenta**
|
||||
* **bgRed**
|
||||
* **bgYellow**
|
||||
* **bgGrey** / **bgBrightBlack**
|
||||
* **bgBrightRed**
|
||||
* **bgBrightGreen**
|
||||
* **bgBrightYellow**
|
||||
* **bgBrightBlue**
|
||||
* **bgBrightMagenta**
|
||||
* **bgBrightCyan**
|
||||
* **bgBrightWhite**
|
||||
|
||||
125
node_modules/console-control-strings/index.js
generated
vendored
125
node_modules/console-control-strings/index.js
generated
vendored
@@ -1,125 +0,0 @@
|
||||
'use strict'
|
||||
|
||||
// These tables borrowed from `ansi`
|
||||
|
||||
var prefix = '\x1b['
|
||||
|
||||
exports.up = function up (num) {
|
||||
return prefix + (num || '') + 'A'
|
||||
}
|
||||
|
||||
exports.down = function down (num) {
|
||||
return prefix + (num || '') + 'B'
|
||||
}
|
||||
|
||||
exports.forward = function forward (num) {
|
||||
return prefix + (num || '') + 'C'
|
||||
}
|
||||
|
||||
exports.back = function back (num) {
|
||||
return prefix + (num || '') + 'D'
|
||||
}
|
||||
|
||||
exports.nextLine = function nextLine (num) {
|
||||
return prefix + (num || '') + 'E'
|
||||
}
|
||||
|
||||
exports.previousLine = function previousLine (num) {
|
||||
return prefix + (num || '') + 'F'
|
||||
}
|
||||
|
||||
exports.horizontalAbsolute = function horizontalAbsolute (num) {
|
||||
if (num == null) throw new Error('horizontalAboslute requires a column to position to')
|
||||
return prefix + num + 'G'
|
||||
}
|
||||
|
||||
exports.eraseData = function eraseData () {
|
||||
return prefix + 'J'
|
||||
}
|
||||
|
||||
exports.eraseLine = function eraseLine () {
|
||||
return prefix + 'K'
|
||||
}
|
||||
|
||||
exports.goto = function (x, y) {
|
||||
return prefix + y + ';' + x + 'H'
|
||||
}
|
||||
|
||||
exports.gotoSOL = function () {
|
||||
return '\r'
|
||||
}
|
||||
|
||||
exports.beep = function () {
|
||||
return '\x07'
|
||||
}
|
||||
|
||||
exports.hideCursor = function hideCursor () {
|
||||
return prefix + '?25l'
|
||||
}
|
||||
|
||||
exports.showCursor = function showCursor () {
|
||||
return prefix + '?25h'
|
||||
}
|
||||
|
||||
var colors = {
|
||||
reset: 0,
|
||||
// styles
|
||||
bold: 1,
|
||||
italic: 3,
|
||||
underline: 4,
|
||||
inverse: 7,
|
||||
// resets
|
||||
stopBold: 22,
|
||||
stopItalic: 23,
|
||||
stopUnderline: 24,
|
||||
stopInverse: 27,
|
||||
// colors
|
||||
white: 37,
|
||||
black: 30,
|
||||
blue: 34,
|
||||
cyan: 36,
|
||||
green: 32,
|
||||
magenta: 35,
|
||||
red: 31,
|
||||
yellow: 33,
|
||||
bgWhite: 47,
|
||||
bgBlack: 40,
|
||||
bgBlue: 44,
|
||||
bgCyan: 46,
|
||||
bgGreen: 42,
|
||||
bgMagenta: 45,
|
||||
bgRed: 41,
|
||||
bgYellow: 43,
|
||||
|
||||
grey: 90,
|
||||
brightBlack: 90,
|
||||
brightRed: 91,
|
||||
brightGreen: 92,
|
||||
brightYellow: 93,
|
||||
brightBlue: 94,
|
||||
brightMagenta: 95,
|
||||
brightCyan: 96,
|
||||
brightWhite: 97,
|
||||
|
||||
bgGrey: 100,
|
||||
bgBrightBlack: 100,
|
||||
bgBrightRed: 101,
|
||||
bgBrightGreen: 102,
|
||||
bgBrightYellow: 103,
|
||||
bgBrightBlue: 104,
|
||||
bgBrightMagenta: 105,
|
||||
bgBrightCyan: 106,
|
||||
bgBrightWhite: 107
|
||||
}
|
||||
|
||||
exports.color = function color (colorWith) {
|
||||
if (arguments.length !== 1 || !Array.isArray(colorWith)) {
|
||||
colorWith = Array.prototype.slice.call(arguments)
|
||||
}
|
||||
return prefix + colorWith.map(colorNameToCode).join(';') + 'm'
|
||||
}
|
||||
|
||||
function colorNameToCode (color) {
|
||||
if (colors[color] != null) return colors[color]
|
||||
throw new Error('Unknown color or style name: ' + color)
|
||||
}
|
||||
97
node_modules/console-control-strings/package.json
generated
vendored
97
node_modules/console-control-strings/package.json
generated
vendored
@@ -1,97 +0,0 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "console-control-strings@~1.1.0",
|
||||
"scope": null,
|
||||
"escapedName": "console-control-strings",
|
||||
"name": "console-control-strings",
|
||||
"rawSpec": "~1.1.0",
|
||||
"spec": ">=1.1.0 <1.2.0",
|
||||
"type": "range"
|
||||
},
|
||||
"/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/npmlog"
|
||||
]
|
||||
],
|
||||
"_from": "console-control-strings@>=1.1.0 <1.2.0",
|
||||
"_id": "console-control-strings@1.1.0",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/console-control-strings",
|
||||
"_nodeVersion": "4.4.0",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-16-east.internal.npmjs.com",
|
||||
"tmp": "tmp/console-control-strings-1.1.0.tgz_1466033396831_0.9470485949423164"
|
||||
},
|
||||
"_npmUser": {
|
||||
"name": "iarna",
|
||||
"email": "me@re-becca.org"
|
||||
},
|
||||
"_npmVersion": "3.9.2",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "console-control-strings@~1.1.0",
|
||||
"scope": null,
|
||||
"escapedName": "console-control-strings",
|
||||
"name": "console-control-strings",
|
||||
"rawSpec": "~1.1.0",
|
||||
"spec": ">=1.1.0 <1.2.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/gauge",
|
||||
"/npmlog"
|
||||
],
|
||||
"_resolved": "http://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz",
|
||||
"_shasum": "3d7cf4464db6446ea644bf4b39507f9851008e8e",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "console-control-strings@~1.1.0",
|
||||
"_where": "/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/npmlog",
|
||||
"author": {
|
||||
"name": "Rebecca Turner",
|
||||
"email": "me@re-becca.org",
|
||||
"url": "http://re-becca.org/"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/iarna/console-control-strings/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "A library of cross-platform tested terminal/console command strings for doing things like color and cursor positioning. This is a subset of both ansi and vt100. All control codes included work on both Windows & Unix-like OSes, except where noted.",
|
||||
"devDependencies": {
|
||||
"standard": "^7.1.2",
|
||||
"tap": "^5.7.2"
|
||||
},
|
||||
"directories": {
|
||||
"test": "test"
|
||||
},
|
||||
"dist": {
|
||||
"shasum": "3d7cf4464db6446ea644bf4b39507f9851008e8e",
|
||||
"tarball": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz"
|
||||
},
|
||||
"files": [
|
||||
"LICENSE",
|
||||
"index.js"
|
||||
],
|
||||
"gitHead": "722439b4998d2964ac3d3f9ec175c008aa9b7b4b",
|
||||
"homepage": "https://github.com/iarna/console-control-strings#readme",
|
||||
"keywords": [],
|
||||
"license": "ISC",
|
||||
"main": "index.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "iarna",
|
||||
"email": "me@re-becca.org"
|
||||
}
|
||||
],
|
||||
"name": "console-control-strings",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/iarna/console-control-strings.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "standard && tap test/*.js"
|
||||
},
|
||||
"version": "1.1.0"
|
||||
}
|
||||
19
node_modules/core-util-is/LICENSE
generated
vendored
19
node_modules/core-util-is/LICENSE
generated
vendored
@@ -1,19 +0,0 @@
|
||||
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.
|
||||
3
node_modules/core-util-is/README.md
generated
vendored
3
node_modules/core-util-is/README.md
generated
vendored
@@ -1,3 +0,0 @@
|
||||
# core-util-is
|
||||
|
||||
The `util.is*` functions introduced in Node v0.12.
|
||||
604
node_modules/core-util-is/float.patch
generated
vendored
604
node_modules/core-util-is/float.patch
generated
vendored
@@ -1,604 +0,0 @@
|
||||
diff --git a/lib/util.js b/lib/util.js
|
||||
index a03e874..9074e8e 100644
|
||||
--- a/lib/util.js
|
||||
+++ b/lib/util.js
|
||||
@@ -19,430 +19,6 @@
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
-var formatRegExp = /%[sdj%]/g;
|
||||
-exports.format = function(f) {
|
||||
- if (!isString(f)) {
|
||||
- var objects = [];
|
||||
- for (var i = 0; i < arguments.length; i++) {
|
||||
- objects.push(inspect(arguments[i]));
|
||||
- }
|
||||
- return objects.join(' ');
|
||||
- }
|
||||
-
|
||||
- var i = 1;
|
||||
- var args = arguments;
|
||||
- var len = args.length;
|
||||
- var str = String(f).replace(formatRegExp, function(x) {
|
||||
- if (x === '%%') return '%';
|
||||
- if (i >= len) return x;
|
||||
- switch (x) {
|
||||
- case '%s': return String(args[i++]);
|
||||
- case '%d': return Number(args[i++]);
|
||||
- case '%j':
|
||||
- try {
|
||||
- return JSON.stringify(args[i++]);
|
||||
- } catch (_) {
|
||||
- return '[Circular]';
|
||||
- }
|
||||
- default:
|
||||
- return x;
|
||||
- }
|
||||
- });
|
||||
- for (var x = args[i]; i < len; x = args[++i]) {
|
||||
- if (isNull(x) || !isObject(x)) {
|
||||
- str += ' ' + x;
|
||||
- } else {
|
||||
- str += ' ' + inspect(x);
|
||||
- }
|
||||
- }
|
||||
- return str;
|
||||
-};
|
||||
-
|
||||
-
|
||||
-// Mark that a method should not be used.
|
||||
-// Returns a modified function which warns once by default.
|
||||
-// If --no-deprecation is set, then it is a no-op.
|
||||
-exports.deprecate = function(fn, msg) {
|
||||
- // Allow for deprecating things in the process of starting up.
|
||||
- if (isUndefined(global.process)) {
|
||||
- return function() {
|
||||
- return exports.deprecate(fn, msg).apply(this, arguments);
|
||||
- };
|
||||
- }
|
||||
-
|
||||
- if (process.noDeprecation === true) {
|
||||
- return fn;
|
||||
- }
|
||||
-
|
||||
- var warned = false;
|
||||
- function deprecated() {
|
||||
- if (!warned) {
|
||||
- if (process.throwDeprecation) {
|
||||
- throw new Error(msg);
|
||||
- } else if (process.traceDeprecation) {
|
||||
- console.trace(msg);
|
||||
- } else {
|
||||
- console.error(msg);
|
||||
- }
|
||||
- warned = true;
|
||||
- }
|
||||
- return fn.apply(this, arguments);
|
||||
- }
|
||||
-
|
||||
- return deprecated;
|
||||
-};
|
||||
-
|
||||
-
|
||||
-var debugs = {};
|
||||
-var debugEnviron;
|
||||
-exports.debuglog = function(set) {
|
||||
- if (isUndefined(debugEnviron))
|
||||
- debugEnviron = process.env.NODE_DEBUG || '';
|
||||
- set = set.toUpperCase();
|
||||
- if (!debugs[set]) {
|
||||
- if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
|
||||
- var pid = process.pid;
|
||||
- debugs[set] = function() {
|
||||
- var msg = exports.format.apply(exports, arguments);
|
||||
- console.error('%s %d: %s', set, pid, msg);
|
||||
- };
|
||||
- } else {
|
||||
- debugs[set] = function() {};
|
||||
- }
|
||||
- }
|
||||
- return debugs[set];
|
||||
-};
|
||||
-
|
||||
-
|
||||
-/**
|
||||
- * Echos the value of a value. Trys to print the value out
|
||||
- * in the best way possible given the different types.
|
||||
- *
|
||||
- * @param {Object} obj The object to print out.
|
||||
- * @param {Object} opts Optional options object that alters the output.
|
||||
- */
|
||||
-/* legacy: obj, showHidden, depth, colors*/
|
||||
-function inspect(obj, opts) {
|
||||
- // default options
|
||||
- var ctx = {
|
||||
- seen: [],
|
||||
- stylize: stylizeNoColor
|
||||
- };
|
||||
- // legacy...
|
||||
- if (arguments.length >= 3) ctx.depth = arguments[2];
|
||||
- if (arguments.length >= 4) ctx.colors = arguments[3];
|
||||
- if (isBoolean(opts)) {
|
||||
- // legacy...
|
||||
- ctx.showHidden = opts;
|
||||
- } else if (opts) {
|
||||
- // got an "options" object
|
||||
- exports._extend(ctx, opts);
|
||||
- }
|
||||
- // set default options
|
||||
- if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
|
||||
- if (isUndefined(ctx.depth)) ctx.depth = 2;
|
||||
- if (isUndefined(ctx.colors)) ctx.colors = false;
|
||||
- if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
|
||||
- if (ctx.colors) ctx.stylize = stylizeWithColor;
|
||||
- return formatValue(ctx, obj, ctx.depth);
|
||||
-}
|
||||
-exports.inspect = inspect;
|
||||
-
|
||||
-
|
||||
-// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
|
||||
-inspect.colors = {
|
||||
- 'bold' : [1, 22],
|
||||
- 'italic' : [3, 23],
|
||||
- 'underline' : [4, 24],
|
||||
- 'inverse' : [7, 27],
|
||||
- 'white' : [37, 39],
|
||||
- 'grey' : [90, 39],
|
||||
- 'black' : [30, 39],
|
||||
- 'blue' : [34, 39],
|
||||
- 'cyan' : [36, 39],
|
||||
- 'green' : [32, 39],
|
||||
- 'magenta' : [35, 39],
|
||||
- 'red' : [31, 39],
|
||||
- 'yellow' : [33, 39]
|
||||
-};
|
||||
-
|
||||
-// Don't use 'blue' not visible on cmd.exe
|
||||
-inspect.styles = {
|
||||
- 'special': 'cyan',
|
||||
- 'number': 'yellow',
|
||||
- 'boolean': 'yellow',
|
||||
- 'undefined': 'grey',
|
||||
- 'null': 'bold',
|
||||
- 'string': 'green',
|
||||
- 'date': 'magenta',
|
||||
- // "name": intentionally not styling
|
||||
- 'regexp': 'red'
|
||||
-};
|
||||
-
|
||||
-
|
||||
-function stylizeWithColor(str, styleType) {
|
||||
- var style = inspect.styles[styleType];
|
||||
-
|
||||
- if (style) {
|
||||
- return '\u001b[' + inspect.colors[style][0] + 'm' + str +
|
||||
- '\u001b[' + inspect.colors[style][1] + 'm';
|
||||
- } else {
|
||||
- return str;
|
||||
- }
|
||||
-}
|
||||
-
|
||||
-
|
||||
-function stylizeNoColor(str, styleType) {
|
||||
- return str;
|
||||
-}
|
||||
-
|
||||
-
|
||||
-function arrayToHash(array) {
|
||||
- var hash = {};
|
||||
-
|
||||
- array.forEach(function(val, idx) {
|
||||
- hash[val] = true;
|
||||
- });
|
||||
-
|
||||
- return hash;
|
||||
-}
|
||||
-
|
||||
-
|
||||
-function formatValue(ctx, value, recurseTimes) {
|
||||
- // Provide a hook for user-specified inspect functions.
|
||||
- // Check that value is an object with an inspect function on it
|
||||
- if (ctx.customInspect &&
|
||||
- value &&
|
||||
- isFunction(value.inspect) &&
|
||||
- // Filter out the util module, it's inspect function is special
|
||||
- value.inspect !== exports.inspect &&
|
||||
- // Also filter out any prototype objects using the circular check.
|
||||
- !(value.constructor && value.constructor.prototype === value)) {
|
||||
- var ret = value.inspect(recurseTimes, ctx);
|
||||
- if (!isString(ret)) {
|
||||
- ret = formatValue(ctx, ret, recurseTimes);
|
||||
- }
|
||||
- return ret;
|
||||
- }
|
||||
-
|
||||
- // Primitive types cannot have properties
|
||||
- var primitive = formatPrimitive(ctx, value);
|
||||
- if (primitive) {
|
||||
- return primitive;
|
||||
- }
|
||||
-
|
||||
- // Look up the keys of the object.
|
||||
- var keys = Object.keys(value);
|
||||
- var visibleKeys = arrayToHash(keys);
|
||||
-
|
||||
- if (ctx.showHidden) {
|
||||
- keys = Object.getOwnPropertyNames(value);
|
||||
- }
|
||||
-
|
||||
- // Some type of object without properties can be shortcutted.
|
||||
- if (keys.length === 0) {
|
||||
- if (isFunction(value)) {
|
||||
- var name = value.name ? ': ' + value.name : '';
|
||||
- return ctx.stylize('[Function' + name + ']', 'special');
|
||||
- }
|
||||
- if (isRegExp(value)) {
|
||||
- return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
|
||||
- }
|
||||
- if (isDate(value)) {
|
||||
- return ctx.stylize(Date.prototype.toString.call(value), 'date');
|
||||
- }
|
||||
- if (isError(value)) {
|
||||
- return formatError(value);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- var base = '', array = false, braces = ['{', '}'];
|
||||
-
|
||||
- // Make Array say that they are Array
|
||||
- if (isArray(value)) {
|
||||
- array = true;
|
||||
- braces = ['[', ']'];
|
||||
- }
|
||||
-
|
||||
- // Make functions say that they are functions
|
||||
- if (isFunction(value)) {
|
||||
- var n = value.name ? ': ' + value.name : '';
|
||||
- base = ' [Function' + n + ']';
|
||||
- }
|
||||
-
|
||||
- // Make RegExps say that they are RegExps
|
||||
- if (isRegExp(value)) {
|
||||
- base = ' ' + RegExp.prototype.toString.call(value);
|
||||
- }
|
||||
-
|
||||
- // Make dates with properties first say the date
|
||||
- if (isDate(value)) {
|
||||
- base = ' ' + Date.prototype.toUTCString.call(value);
|
||||
- }
|
||||
-
|
||||
- // Make error with message first say the error
|
||||
- if (isError(value)) {
|
||||
- base = ' ' + formatError(value);
|
||||
- }
|
||||
-
|
||||
- if (keys.length === 0 && (!array || value.length == 0)) {
|
||||
- return braces[0] + base + braces[1];
|
||||
- }
|
||||
-
|
||||
- if (recurseTimes < 0) {
|
||||
- if (isRegExp(value)) {
|
||||
- return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
|
||||
- } else {
|
||||
- return ctx.stylize('[Object]', 'special');
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- ctx.seen.push(value);
|
||||
-
|
||||
- var output;
|
||||
- if (array) {
|
||||
- output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
|
||||
- } else {
|
||||
- output = keys.map(function(key) {
|
||||
- return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
|
||||
- });
|
||||
- }
|
||||
-
|
||||
- ctx.seen.pop();
|
||||
-
|
||||
- return reduceToSingleString(output, base, braces);
|
||||
-}
|
||||
-
|
||||
-
|
||||
-function formatPrimitive(ctx, value) {
|
||||
- if (isUndefined(value))
|
||||
- return ctx.stylize('undefined', 'undefined');
|
||||
- if (isString(value)) {
|
||||
- var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
|
||||
- .replace(/'/g, "\\'")
|
||||
- .replace(/\\"/g, '"') + '\'';
|
||||
- return ctx.stylize(simple, 'string');
|
||||
- }
|
||||
- if (isNumber(value)) {
|
||||
- // Format -0 as '-0'. Strict equality won't distinguish 0 from -0,
|
||||
- // so instead we use the fact that 1 / -0 < 0 whereas 1 / 0 > 0 .
|
||||
- if (value === 0 && 1 / value < 0)
|
||||
- return ctx.stylize('-0', 'number');
|
||||
- return ctx.stylize('' + value, 'number');
|
||||
- }
|
||||
- if (isBoolean(value))
|
||||
- return ctx.stylize('' + value, 'boolean');
|
||||
- // For some reason typeof null is "object", so special case here.
|
||||
- if (isNull(value))
|
||||
- return ctx.stylize('null', 'null');
|
||||
-}
|
||||
-
|
||||
-
|
||||
-function formatError(value) {
|
||||
- return '[' + Error.prototype.toString.call(value) + ']';
|
||||
-}
|
||||
-
|
||||
-
|
||||
-function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
|
||||
- var output = [];
|
||||
- for (var i = 0, l = value.length; i < l; ++i) {
|
||||
- if (hasOwnProperty(value, String(i))) {
|
||||
- output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
|
||||
- String(i), true));
|
||||
- } else {
|
||||
- output.push('');
|
||||
- }
|
||||
- }
|
||||
- keys.forEach(function(key) {
|
||||
- if (!key.match(/^\d+$/)) {
|
||||
- output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
|
||||
- key, true));
|
||||
- }
|
||||
- });
|
||||
- return output;
|
||||
-}
|
||||
-
|
||||
-
|
||||
-function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
|
||||
- var name, str, desc;
|
||||
- desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
|
||||
- if (desc.get) {
|
||||
- if (desc.set) {
|
||||
- str = ctx.stylize('[Getter/Setter]', 'special');
|
||||
- } else {
|
||||
- str = ctx.stylize('[Getter]', 'special');
|
||||
- }
|
||||
- } else {
|
||||
- if (desc.set) {
|
||||
- str = ctx.stylize('[Setter]', 'special');
|
||||
- }
|
||||
- }
|
||||
- if (!hasOwnProperty(visibleKeys, key)) {
|
||||
- name = '[' + key + ']';
|
||||
- }
|
||||
- if (!str) {
|
||||
- if (ctx.seen.indexOf(desc.value) < 0) {
|
||||
- if (isNull(recurseTimes)) {
|
||||
- str = formatValue(ctx, desc.value, null);
|
||||
- } else {
|
||||
- str = formatValue(ctx, desc.value, recurseTimes - 1);
|
||||
- }
|
||||
- if (str.indexOf('\n') > -1) {
|
||||
- if (array) {
|
||||
- str = str.split('\n').map(function(line) {
|
||||
- return ' ' + line;
|
||||
- }).join('\n').substr(2);
|
||||
- } else {
|
||||
- str = '\n' + str.split('\n').map(function(line) {
|
||||
- return ' ' + line;
|
||||
- }).join('\n');
|
||||
- }
|
||||
- }
|
||||
- } else {
|
||||
- str = ctx.stylize('[Circular]', 'special');
|
||||
- }
|
||||
- }
|
||||
- if (isUndefined(name)) {
|
||||
- if (array && key.match(/^\d+$/)) {
|
||||
- return str;
|
||||
- }
|
||||
- name = JSON.stringify('' + key);
|
||||
- if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
|
||||
- name = name.substr(1, name.length - 2);
|
||||
- name = ctx.stylize(name, 'name');
|
||||
- } else {
|
||||
- name = name.replace(/'/g, "\\'")
|
||||
- .replace(/\\"/g, '"')
|
||||
- .replace(/(^"|"$)/g, "'");
|
||||
- name = ctx.stylize(name, 'string');
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- return name + ': ' + str;
|
||||
-}
|
||||
-
|
||||
-
|
||||
-function reduceToSingleString(output, base, braces) {
|
||||
- var numLinesEst = 0;
|
||||
- var length = output.reduce(function(prev, cur) {
|
||||
- numLinesEst++;
|
||||
- if (cur.indexOf('\n') >= 0) numLinesEst++;
|
||||
- return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
|
||||
- }, 0);
|
||||
-
|
||||
- if (length > 60) {
|
||||
- return braces[0] +
|
||||
- (base === '' ? '' : base + '\n ') +
|
||||
- ' ' +
|
||||
- output.join(',\n ') +
|
||||
- ' ' +
|
||||
- braces[1];
|
||||
- }
|
||||
-
|
||||
- return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
|
||||
-}
|
||||
-
|
||||
-
|
||||
// NOTE: These type checking functions intentionally don't use `instanceof`
|
||||
// because it is fragile and can be easily faked with `Object.create()`.
|
||||
function isArray(ar) {
|
||||
@@ -522,166 +98,10 @@ function isPrimitive(arg) {
|
||||
exports.isPrimitive = isPrimitive;
|
||||
|
||||
function isBuffer(arg) {
|
||||
- return arg instanceof Buffer;
|
||||
+ return Buffer.isBuffer(arg);
|
||||
}
|
||||
exports.isBuffer = isBuffer;
|
||||
|
||||
function objectToString(o) {
|
||||
return Object.prototype.toString.call(o);
|
||||
-}
|
||||
-
|
||||
-
|
||||
-function pad(n) {
|
||||
- return n < 10 ? '0' + n.toString(10) : n.toString(10);
|
||||
-}
|
||||
-
|
||||
-
|
||||
-var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
|
||||
- 'Oct', 'Nov', 'Dec'];
|
||||
-
|
||||
-// 26 Feb 16:19:34
|
||||
-function timestamp() {
|
||||
- var d = new Date();
|
||||
- var time = [pad(d.getHours()),
|
||||
- pad(d.getMinutes()),
|
||||
- pad(d.getSeconds())].join(':');
|
||||
- return [d.getDate(), months[d.getMonth()], time].join(' ');
|
||||
-}
|
||||
-
|
||||
-
|
||||
-// log is just a thin wrapper to console.log that prepends a timestamp
|
||||
-exports.log = function() {
|
||||
- console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
|
||||
-};
|
||||
-
|
||||
-
|
||||
-/**
|
||||
- * Inherit the prototype methods from one constructor into another.
|
||||
- *
|
||||
- * The Function.prototype.inherits from lang.js rewritten as a standalone
|
||||
- * function (not on Function.prototype). NOTE: If this file is to be loaded
|
||||
- * during bootstrapping this function needs to be rewritten using some native
|
||||
- * functions as prototype setup using normal JavaScript does not work as
|
||||
- * expected during bootstrapping (see mirror.js in r114903).
|
||||
- *
|
||||
- * @param {function} ctor Constructor function which needs to inherit the
|
||||
- * prototype.
|
||||
- * @param {function} superCtor Constructor function to inherit prototype from.
|
||||
- */
|
||||
-exports.inherits = function(ctor, superCtor) {
|
||||
- ctor.super_ = superCtor;
|
||||
- ctor.prototype = Object.create(superCtor.prototype, {
|
||||
- constructor: {
|
||||
- value: ctor,
|
||||
- enumerable: false,
|
||||
- writable: true,
|
||||
- configurable: true
|
||||
- }
|
||||
- });
|
||||
-};
|
||||
-
|
||||
-exports._extend = function(origin, add) {
|
||||
- // Don't do anything if add isn't an object
|
||||
- if (!add || !isObject(add)) return origin;
|
||||
-
|
||||
- var keys = Object.keys(add);
|
||||
- var i = keys.length;
|
||||
- while (i--) {
|
||||
- origin[keys[i]] = add[keys[i]];
|
||||
- }
|
||||
- return origin;
|
||||
-};
|
||||
-
|
||||
-function hasOwnProperty(obj, prop) {
|
||||
- return Object.prototype.hasOwnProperty.call(obj, prop);
|
||||
-}
|
||||
-
|
||||
-
|
||||
-// Deprecated old stuff.
|
||||
-
|
||||
-exports.p = exports.deprecate(function() {
|
||||
- for (var i = 0, len = arguments.length; i < len; ++i) {
|
||||
- console.error(exports.inspect(arguments[i]));
|
||||
- }
|
||||
-}, 'util.p: Use console.error() instead');
|
||||
-
|
||||
-
|
||||
-exports.exec = exports.deprecate(function() {
|
||||
- return require('child_process').exec.apply(this, arguments);
|
||||
-}, 'util.exec is now called `child_process.exec`.');
|
||||
-
|
||||
-
|
||||
-exports.print = exports.deprecate(function() {
|
||||
- for (var i = 0, len = arguments.length; i < len; ++i) {
|
||||
- process.stdout.write(String(arguments[i]));
|
||||
- }
|
||||
-}, 'util.print: Use console.log instead');
|
||||
-
|
||||
-
|
||||
-exports.puts = exports.deprecate(function() {
|
||||
- for (var i = 0, len = arguments.length; i < len; ++i) {
|
||||
- process.stdout.write(arguments[i] + '\n');
|
||||
- }
|
||||
-}, 'util.puts: Use console.log instead');
|
||||
-
|
||||
-
|
||||
-exports.debug = exports.deprecate(function(x) {
|
||||
- process.stderr.write('DEBUG: ' + x + '\n');
|
||||
-}, 'util.debug: Use console.error instead');
|
||||
-
|
||||
-
|
||||
-exports.error = exports.deprecate(function(x) {
|
||||
- for (var i = 0, len = arguments.length; i < len; ++i) {
|
||||
- process.stderr.write(arguments[i] + '\n');
|
||||
- }
|
||||
-}, 'util.error: Use console.error instead');
|
||||
-
|
||||
-
|
||||
-exports.pump = exports.deprecate(function(readStream, writeStream, callback) {
|
||||
- var callbackCalled = false;
|
||||
-
|
||||
- function call(a, b, c) {
|
||||
- if (callback && !callbackCalled) {
|
||||
- callback(a, b, c);
|
||||
- callbackCalled = true;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- readStream.addListener('data', function(chunk) {
|
||||
- if (writeStream.write(chunk) === false) readStream.pause();
|
||||
- });
|
||||
-
|
||||
- writeStream.addListener('drain', function() {
|
||||
- readStream.resume();
|
||||
- });
|
||||
-
|
||||
- readStream.addListener('end', function() {
|
||||
- writeStream.end();
|
||||
- });
|
||||
-
|
||||
- readStream.addListener('close', function() {
|
||||
- call();
|
||||
- });
|
||||
-
|
||||
- readStream.addListener('error', function(err) {
|
||||
- writeStream.end();
|
||||
- call(err);
|
||||
- });
|
||||
-
|
||||
- writeStream.addListener('error', function(err) {
|
||||
- readStream.destroy();
|
||||
- call(err);
|
||||
- });
|
||||
-}, 'util.pump(): Use readableStream.pipe() instead');
|
||||
-
|
||||
-
|
||||
-var uv;
|
||||
-exports._errnoException = function(err, syscall) {
|
||||
- if (isUndefined(uv)) uv = process.binding('uv');
|
||||
- var errname = uv.errname(err);
|
||||
- var e = new Error(syscall + ' ' + errname);
|
||||
- e.code = errname;
|
||||
- e.errno = errname;
|
||||
- e.syscall = syscall;
|
||||
- return e;
|
||||
-};
|
||||
+}
|
||||
107
node_modules/core-util-is/lib/util.js
generated
vendored
107
node_modules/core-util-is/lib/util.js
generated
vendored
@@ -1,107 +0,0 @@
|
||||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
// persons to whom the Software is furnished to do so, subject to the
|
||||
// following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
// NOTE: These type checking functions intentionally don't use `instanceof`
|
||||
// because it is fragile and can be easily faked with `Object.create()`.
|
||||
|
||||
function isArray(arg) {
|
||||
if (Array.isArray) {
|
||||
return Array.isArray(arg);
|
||||
}
|
||||
return objectToString(arg) === '[object Array]';
|
||||
}
|
||||
exports.isArray = isArray;
|
||||
|
||||
function isBoolean(arg) {
|
||||
return typeof arg === 'boolean';
|
||||
}
|
||||
exports.isBoolean = isBoolean;
|
||||
|
||||
function isNull(arg) {
|
||||
return arg === null;
|
||||
}
|
||||
exports.isNull = isNull;
|
||||
|
||||
function isNullOrUndefined(arg) {
|
||||
return arg == null;
|
||||
}
|
||||
exports.isNullOrUndefined = isNullOrUndefined;
|
||||
|
||||
function isNumber(arg) {
|
||||
return typeof arg === 'number';
|
||||
}
|
||||
exports.isNumber = isNumber;
|
||||
|
||||
function isString(arg) {
|
||||
return typeof arg === 'string';
|
||||
}
|
||||
exports.isString = isString;
|
||||
|
||||
function isSymbol(arg) {
|
||||
return typeof arg === 'symbol';
|
||||
}
|
||||
exports.isSymbol = isSymbol;
|
||||
|
||||
function isUndefined(arg) {
|
||||
return arg === void 0;
|
||||
}
|
||||
exports.isUndefined = isUndefined;
|
||||
|
||||
function isRegExp(re) {
|
||||
return objectToString(re) === '[object RegExp]';
|
||||
}
|
||||
exports.isRegExp = isRegExp;
|
||||
|
||||
function isObject(arg) {
|
||||
return typeof arg === 'object' && arg !== null;
|
||||
}
|
||||
exports.isObject = isObject;
|
||||
|
||||
function isDate(d) {
|
||||
return objectToString(d) === '[object Date]';
|
||||
}
|
||||
exports.isDate = isDate;
|
||||
|
||||
function isError(e) {
|
||||
return (objectToString(e) === '[object Error]' || e instanceof Error);
|
||||
}
|
||||
exports.isError = isError;
|
||||
|
||||
function isFunction(arg) {
|
||||
return typeof arg === 'function';
|
||||
}
|
||||
exports.isFunction = isFunction;
|
||||
|
||||
function isPrimitive(arg) {
|
||||
return arg === null ||
|
||||
typeof arg === 'boolean' ||
|
||||
typeof arg === 'number' ||
|
||||
typeof arg === 'string' ||
|
||||
typeof arg === 'symbol' || // ES6 symbol
|
||||
typeof arg === 'undefined';
|
||||
}
|
||||
exports.isPrimitive = isPrimitive;
|
||||
|
||||
exports.isBuffer = Buffer.isBuffer;
|
||||
|
||||
function objectToString(o) {
|
||||
return Object.prototype.toString.call(o);
|
||||
}
|
||||
96
node_modules/core-util-is/package.json
generated
vendored
96
node_modules/core-util-is/package.json
generated
vendored
@@ -1,96 +0,0 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "core-util-is@~1.0.0",
|
||||
"scope": null,
|
||||
"escapedName": "core-util-is",
|
||||
"name": "core-util-is",
|
||||
"rawSpec": "~1.0.0",
|
||||
"spec": ">=1.0.0 <1.1.0",
|
||||
"type": "range"
|
||||
},
|
||||
"/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/readable-stream"
|
||||
]
|
||||
],
|
||||
"_from": "core-util-is@>=1.0.0 <1.1.0",
|
||||
"_id": "core-util-is@1.0.2",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/core-util-is",
|
||||
"_nodeVersion": "4.0.0",
|
||||
"_npmUser": {
|
||||
"name": "isaacs",
|
||||
"email": "i@izs.me"
|
||||
},
|
||||
"_npmVersion": "3.3.2",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "core-util-is@~1.0.0",
|
||||
"scope": null,
|
||||
"escapedName": "core-util-is",
|
||||
"name": "core-util-is",
|
||||
"rawSpec": "~1.0.0",
|
||||
"spec": ">=1.0.0 <1.1.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/readable-stream",
|
||||
"/streamroller/readable-stream"
|
||||
],
|
||||
"_resolved": "http://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
|
||||
"_shasum": "b5fd54220aa2bc5ab57aab7140c940754503c1a7",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "core-util-is@~1.0.0",
|
||||
"_where": "/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/readable-stream",
|
||||
"author": {
|
||||
"name": "Isaac Z. Schlueter",
|
||||
"email": "i@izs.me",
|
||||
"url": "http://blog.izs.me/"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/isaacs/core-util-is/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "The `util.is*` functions introduced in Node v0.12.",
|
||||
"devDependencies": {
|
||||
"tap": "^2.3.0"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "b5fd54220aa2bc5ab57aab7140c940754503c1a7",
|
||||
"tarball": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz"
|
||||
},
|
||||
"gitHead": "a177da234df5638b363ddc15fa324619a38577c8",
|
||||
"homepage": "https://github.com/isaacs/core-util-is#readme",
|
||||
"keywords": [
|
||||
"util",
|
||||
"isBuffer",
|
||||
"isArray",
|
||||
"isNumber",
|
||||
"isString",
|
||||
"isRegExp",
|
||||
"isThis",
|
||||
"isThat",
|
||||
"polyfill"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "lib/util.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "isaacs",
|
||||
"email": "i@izs.me"
|
||||
}
|
||||
],
|
||||
"name": "core-util-is",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/isaacs/core-util-is.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tap test.js"
|
||||
},
|
||||
"version": "1.0.2"
|
||||
}
|
||||
68
node_modules/core-util-is/test.js
generated
vendored
68
node_modules/core-util-is/test.js
generated
vendored
@@ -1,68 +0,0 @@
|
||||
var assert = require('tap');
|
||||
|
||||
var t = require('./lib/util');
|
||||
|
||||
assert.equal(t.isArray([]), true);
|
||||
assert.equal(t.isArray({}), false);
|
||||
|
||||
assert.equal(t.isBoolean(null), false);
|
||||
assert.equal(t.isBoolean(true), true);
|
||||
assert.equal(t.isBoolean(false), true);
|
||||
|
||||
assert.equal(t.isNull(null), true);
|
||||
assert.equal(t.isNull(undefined), false);
|
||||
assert.equal(t.isNull(false), false);
|
||||
assert.equal(t.isNull(), false);
|
||||
|
||||
assert.equal(t.isNullOrUndefined(null), true);
|
||||
assert.equal(t.isNullOrUndefined(undefined), true);
|
||||
assert.equal(t.isNullOrUndefined(false), false);
|
||||
assert.equal(t.isNullOrUndefined(), true);
|
||||
|
||||
assert.equal(t.isNumber(null), false);
|
||||
assert.equal(t.isNumber('1'), false);
|
||||
assert.equal(t.isNumber(1), true);
|
||||
|
||||
assert.equal(t.isString(null), false);
|
||||
assert.equal(t.isString('1'), true);
|
||||
assert.equal(t.isString(1), false);
|
||||
|
||||
assert.equal(t.isSymbol(null), false);
|
||||
assert.equal(t.isSymbol('1'), false);
|
||||
assert.equal(t.isSymbol(1), false);
|
||||
assert.equal(t.isSymbol(Symbol()), true);
|
||||
|
||||
assert.equal(t.isUndefined(null), false);
|
||||
assert.equal(t.isUndefined(undefined), true);
|
||||
assert.equal(t.isUndefined(false), false);
|
||||
assert.equal(t.isUndefined(), true);
|
||||
|
||||
assert.equal(t.isRegExp(null), false);
|
||||
assert.equal(t.isRegExp('1'), false);
|
||||
assert.equal(t.isRegExp(new RegExp()), true);
|
||||
|
||||
assert.equal(t.isObject({}), true);
|
||||
assert.equal(t.isObject([]), true);
|
||||
assert.equal(t.isObject(new RegExp()), true);
|
||||
assert.equal(t.isObject(new Date()), true);
|
||||
|
||||
assert.equal(t.isDate(null), false);
|
||||
assert.equal(t.isDate('1'), false);
|
||||
assert.equal(t.isDate(new Date()), true);
|
||||
|
||||
assert.equal(t.isError(null), false);
|
||||
assert.equal(t.isError({ err: true }), false);
|
||||
assert.equal(t.isError(new Error()), true);
|
||||
|
||||
assert.equal(t.isFunction(null), false);
|
||||
assert.equal(t.isFunction({ }), false);
|
||||
assert.equal(t.isFunction(function() {}), true);
|
||||
|
||||
assert.equal(t.isPrimitive(null), true);
|
||||
assert.equal(t.isPrimitive(''), true);
|
||||
assert.equal(t.isPrimitive(0), true);
|
||||
assert.equal(t.isPrimitive(new Date()), false);
|
||||
|
||||
assert.equal(t.isBuffer(null), false);
|
||||
assert.equal(t.isBuffer({}), false);
|
||||
assert.equal(t.isBuffer(new Buffer(0)), true);
|
||||
15
node_modules/date-format/.npmignore
generated
vendored
15
node_modules/date-format/.npmignore
generated
vendored
@@ -1,15 +0,0 @@
|
||||
lib-cov
|
||||
*.seed
|
||||
*.log
|
||||
*.csv
|
||||
*.dat
|
||||
*.out
|
||||
*.pid
|
||||
*.gz
|
||||
|
||||
pids
|
||||
logs
|
||||
results
|
||||
|
||||
npm-debug.log
|
||||
node_modules
|
||||
20
node_modules/date-format/LICENSE
generated
vendored
20
node_modules/date-format/LICENSE
generated
vendored
@@ -1,20 +0,0 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2013 Gareth Jones
|
||||
|
||||
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.
|
||||
26
node_modules/date-format/README.md
generated
vendored
26
node_modules/date-format/README.md
generated
vendored
@@ -1,26 +0,0 @@
|
||||
date-format
|
||||
===========
|
||||
|
||||
node.js formatting of Date objects as strings. Probably exactly the same as some other library out there.
|
||||
|
||||
npm install date-format
|
||||
|
||||
usage
|
||||
=====
|
||||
|
||||
var format = require('date-format');
|
||||
format.asString(new Date()); //defaults to ISO8601 format
|
||||
format.asString('hh:mm:ss.SSS', new Date()); //just the time
|
||||
|
||||
Format string can be anything, but the following letters will be replaced (and leading zeroes added if necessary):
|
||||
* dd - date.getDate()
|
||||
* MM - date.getMonth() + 1
|
||||
* yy - date.getFullYear().toString().substring(2, 4)
|
||||
* yyyy - date.getFullYear()
|
||||
* hh - date.getHours()
|
||||
* mm - date.getMinutes()
|
||||
* ss - date.getSeconds()
|
||||
* SSS - date.getMilliseconds()
|
||||
* O - timezone offset in +hm format
|
||||
|
||||
That's it.
|
||||
66
node_modules/date-format/lib/index.js
generated
vendored
66
node_modules/date-format/lib/index.js
generated
vendored
@@ -1,66 +0,0 @@
|
||||
"use strict";
|
||||
exports.ISO8601_FORMAT = "yyyy-MM-dd hh:mm:ss.SSS";
|
||||
exports.ISO8601_WITH_TZ_OFFSET_FORMAT = "yyyy-MM-ddThh:mm:ssO";
|
||||
exports.DATETIME_FORMAT = "dd MM yyyy hh:mm:ss.SSS";
|
||||
exports.ABSOLUTETIME_FORMAT = "hh:mm:ss.SSS";
|
||||
|
||||
function padWithZeros(vNumber, width) {
|
||||
var numAsString = vNumber + "";
|
||||
while (numAsString.length < width) {
|
||||
numAsString = "0" + numAsString;
|
||||
}
|
||||
return numAsString;
|
||||
}
|
||||
|
||||
function addZero(vNumber) {
|
||||
return padWithZeros(vNumber, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats the TimeOffest
|
||||
* Thanks to http://www.svendtofte.com/code/date_format/
|
||||
* @private
|
||||
*/
|
||||
function offset(date) {
|
||||
// Difference to Greenwich time (GMT) in hours
|
||||
var os = Math.abs(date.getTimezoneOffset());
|
||||
var h = String(Math.floor(os/60));
|
||||
var m = String(os%60);
|
||||
if (h.length == 1) {
|
||||
h = "0" + h;
|
||||
}
|
||||
if (m.length == 1) {
|
||||
m = "0" + m;
|
||||
}
|
||||
return date.getTimezoneOffset() < 0 ? "+"+h+m : "-"+h+m;
|
||||
}
|
||||
|
||||
exports.asString = function(/*format,*/ date) {
|
||||
var format = exports.ISO8601_FORMAT;
|
||||
if (typeof(date) === "string") {
|
||||
format = arguments[0];
|
||||
date = arguments[1];
|
||||
}
|
||||
|
||||
var vDay = addZero(date.getDate());
|
||||
var vMonth = addZero(date.getMonth()+1);
|
||||
var vYearLong = addZero(date.getFullYear());
|
||||
var vYearShort = addZero(date.getFullYear().toString().substring(2,4));
|
||||
var vYear = (format.indexOf("yyyy") > -1 ? vYearLong : vYearShort);
|
||||
var vHour = addZero(date.getHours());
|
||||
var vMinute = addZero(date.getMinutes());
|
||||
var vSecond = addZero(date.getSeconds());
|
||||
var vMillisecond = padWithZeros(date.getMilliseconds(), 3);
|
||||
var vTimeZone = offset(date);
|
||||
var formatted = format
|
||||
.replace(/dd/g, vDay)
|
||||
.replace(/MM/g, vMonth)
|
||||
.replace(/y{1,4}/g, vYear)
|
||||
.replace(/hh/g, vHour)
|
||||
.replace(/mm/g, vMinute)
|
||||
.replace(/ss/g, vSecond)
|
||||
.replace(/SSS/g, vMillisecond)
|
||||
.replace(/O/g, vTimeZone);
|
||||
return formatted;
|
||||
|
||||
};
|
||||
88
node_modules/date-format/package.json
generated
vendored
88
node_modules/date-format/package.json
generated
vendored
@@ -1,88 +0,0 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "date-format@^0.0.0",
|
||||
"scope": null,
|
||||
"escapedName": "date-format",
|
||||
"name": "date-format",
|
||||
"rawSpec": "^0.0.0",
|
||||
"spec": ">=0.0.0 <0.0.1",
|
||||
"type": "range"
|
||||
},
|
||||
"/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/streamroller"
|
||||
]
|
||||
],
|
||||
"_from": "date-format@>=0.0.0 <0.0.1",
|
||||
"_id": "date-format@0.0.0",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/date-format",
|
||||
"_npmUser": {
|
||||
"name": "csausdev",
|
||||
"email": "gareth.jones@sensis.com.au"
|
||||
},
|
||||
"_npmVersion": "1.2.18",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "date-format@^0.0.0",
|
||||
"scope": null,
|
||||
"escapedName": "date-format",
|
||||
"name": "date-format",
|
||||
"rawSpec": "^0.0.0",
|
||||
"spec": ">=0.0.0 <0.0.1",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/streamroller"
|
||||
],
|
||||
"_resolved": "http://registry.npmjs.org/date-format/-/date-format-0.0.0.tgz",
|
||||
"_shasum": "09206863ab070eb459acea5542cbd856b11966b3",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "date-format@^0.0.0",
|
||||
"_where": "/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/streamroller",
|
||||
"author": {
|
||||
"name": "Gareth Jones",
|
||||
"email": "gareth.jones@sensis.com.au"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/nomiddlename/date-format/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "formatting Date objects as strings since 2013",
|
||||
"devDependencies": {
|
||||
"mocha": "~1.12.0",
|
||||
"should": "~1.2.2"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "09206863ab070eb459acea5542cbd856b11966b3",
|
||||
"tarball": "https://registry.npmjs.org/date-format/-/date-format-0.0.0.tgz"
|
||||
},
|
||||
"gitHead": "bf59015ab6c9e86454b179374f29debbdb403522",
|
||||
"homepage": "https://github.com/nomiddlename/date-format#readme",
|
||||
"keywords": [
|
||||
"date",
|
||||
"format",
|
||||
"string"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "csausdev",
|
||||
"email": "gareth.jones@sensis.com.au"
|
||||
}
|
||||
],
|
||||
"name": "date-format",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/nomiddlename/date-format.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"version": "0.0.0"
|
||||
}
|
||||
42
node_modules/date-format/test/date_format-test.js
generated
vendored
42
node_modules/date-format/test/date_format-test.js
generated
vendored
@@ -1,42 +0,0 @@
|
||||
"use strict";
|
||||
var should = require('should')
|
||||
, dateFormat = require('../lib');
|
||||
|
||||
describe('date_format', function() {
|
||||
var date = new Date(2010, 0, 11, 14, 31, 30, 5);
|
||||
|
||||
it('should format a date as string using a pattern', function() {
|
||||
dateFormat.asString(dateFormat.DATETIME_FORMAT, date).should.eql("11 01 2010 14:31:30.005");
|
||||
});
|
||||
|
||||
it('should default to the ISO8601 format', function() {
|
||||
dateFormat.asString(date).should.eql('2010-01-11 14:31:30.005');
|
||||
});
|
||||
|
||||
it('should provide a ISO8601 with timezone offset format', function() {
|
||||
date.getTimezoneOffset = function() { return -660; };
|
||||
dateFormat.asString(
|
||||
dateFormat.ISO8601_WITH_TZ_OFFSET_FORMAT,
|
||||
date
|
||||
).should.eql(
|
||||
"2010-01-11T14:31:30+1100"
|
||||
);
|
||||
|
||||
date.getTimezoneOffset = function() { return 120; };
|
||||
dateFormat.asString(
|
||||
dateFormat.ISO8601_WITH_TZ_OFFSET_FORMAT,
|
||||
date
|
||||
).should.eql(
|
||||
"2010-01-11T14:31:30-0200"
|
||||
);
|
||||
});
|
||||
|
||||
it('should provide a just-the-time format', function() {
|
||||
dateFormat.asString(dateFormat.ABSOLUTETIME_FORMAT, date).should.eql('14:31:30.005');
|
||||
});
|
||||
|
||||
it('should provide a custom format', function() {
|
||||
date.getTimezoneOffset = function() { return 120; };
|
||||
dateFormat.asString("O.SSS.ss.mm.hh.dd.MM.yy", date).should.eql('-0200.005.30.31.14.11.01.10');
|
||||
});
|
||||
});
|
||||
1
node_modules/debug/.coveralls.yml
generated
vendored
1
node_modules/debug/.coveralls.yml
generated
vendored
@@ -1 +0,0 @@
|
||||
repo_token: SIAeZjKYlHK74rbcFvNHMUzjRiMpflxve
|
||||
11
node_modules/debug/.eslintrc
generated
vendored
11
node_modules/debug/.eslintrc
generated
vendored
@@ -1,11 +0,0 @@
|
||||
{
|
||||
"env": {
|
||||
"browser": true,
|
||||
"node": true
|
||||
},
|
||||
"rules": {
|
||||
"no-console": 0,
|
||||
"no-empty": [1, { "allowEmptyCatch": true }]
|
||||
},
|
||||
"extends": "eslint:recommended"
|
||||
}
|
||||
8
node_modules/debug/.npmignore
generated
vendored
8
node_modules/debug/.npmignore
generated
vendored
@@ -1,8 +0,0 @@
|
||||
support
|
||||
test
|
||||
examples
|
||||
example
|
||||
*.sock
|
||||
dist
|
||||
yarn.lock
|
||||
coverage
|
||||
14
node_modules/debug/.travis.yml
generated
vendored
14
node_modules/debug/.travis.yml
generated
vendored
@@ -1,14 +0,0 @@
|
||||
|
||||
language: node_js
|
||||
node_js:
|
||||
- "6"
|
||||
- "5"
|
||||
- "4"
|
||||
|
||||
install:
|
||||
- make node_modules
|
||||
|
||||
script:
|
||||
- make lint
|
||||
- make test
|
||||
- make coveralls
|
||||
330
node_modules/debug/CHANGELOG.md
generated
vendored
330
node_modules/debug/CHANGELOG.md
generated
vendored
@@ -1,330 +0,0 @@
|
||||
|
||||
2.6.3 / 2017-03-13
|
||||
==================
|
||||
|
||||
* Fix: Fix for electron reference to `process.env.DEBUG` (#431, @paulcbetts)
|
||||
* Docs: Changelog fix (@thebigredgeeK)
|
||||
|
||||
2.6.2 / 2017-03-10
|
||||
==================
|
||||
|
||||
* Fix: DEBUG_MAX_ARRAY_LENGTH (#420, @slavaGanzin)
|
||||
* Docs: Add backers and sponsors from Open Collective (#422, @piamancini)
|
||||
* Docs: Add Slackin invite badge (@tootallnate)
|
||||
|
||||
2.6.1 / 2017-02-10
|
||||
==================
|
||||
|
||||
* Fix: Module's `export default` syntax fix for IE8 `Expected identifier` error
|
||||
* Fix: Whitelist DEBUG_FD for values 1 and 2 only (#415, @pi0)
|
||||
* Fix: IE8 "Expected identifier" error (#414, @vgoma)
|
||||
* Fix: Namespaces would not disable once enabled (#409, @musikov)
|
||||
|
||||
2.6.0 / 2016-12-28
|
||||
==================
|
||||
|
||||
* Fix: added better null pointer checks for browser useColors (@thebigredgeek)
|
||||
* Improvement: removed explicit `window.debug` export (#404, @tootallnate)
|
||||
* Improvement: deprecated `DEBUG_FD` environment variable (#405, @tootallnate)
|
||||
|
||||
2.5.2 / 2016-12-25
|
||||
==================
|
||||
|
||||
* Fix: reference error on window within webworkers (#393, @KlausTrainer)
|
||||
* Docs: fixed README typo (#391, @lurch)
|
||||
* Docs: added notice about v3 api discussion (@thebigredgeek)
|
||||
|
||||
2.5.1 / 2016-12-20
|
||||
==================
|
||||
|
||||
* Fix: babel-core compatibility
|
||||
|
||||
2.5.0 / 2016-12-20
|
||||
==================
|
||||
|
||||
* Fix: wrong reference in bower file (@thebigredgeek)
|
||||
* Fix: webworker compatibility (@thebigredgeek)
|
||||
* Fix: output formatting issue (#388, @kribblo)
|
||||
* Fix: babel-loader compatibility (#383, @escwald)
|
||||
* Misc: removed built asset from repo and publications (@thebigredgeek)
|
||||
* Misc: moved source files to /src (#378, @yamikuronue)
|
||||
* Test: added karma integration and replaced babel with browserify for browser tests (#378, @yamikuronue)
|
||||
* Test: coveralls integration (#378, @yamikuronue)
|
||||
* Docs: simplified language in the opening paragraph (#373, @yamikuronue)
|
||||
|
||||
2.4.5 / 2016-12-17
|
||||
==================
|
||||
|
||||
* Fix: `navigator` undefined in Rhino (#376, @jochenberger)
|
||||
* Fix: custom log function (#379, @hsiliev)
|
||||
* Improvement: bit of cleanup + linting fixes (@thebigredgeek)
|
||||
* Improvement: rm non-maintainted `dist/` dir (#375, @freewil)
|
||||
* Docs: simplified language in the opening paragraph. (#373, @yamikuronue)
|
||||
|
||||
2.4.4 / 2016-12-14
|
||||
==================
|
||||
|
||||
* Fix: work around debug being loaded in preload scripts for electron (#368, @paulcbetts)
|
||||
|
||||
2.4.3 / 2016-12-14
|
||||
==================
|
||||
|
||||
* Fix: navigation.userAgent error for react native (#364, @escwald)
|
||||
|
||||
2.4.2 / 2016-12-14
|
||||
==================
|
||||
|
||||
* Fix: browser colors (#367, @tootallnate)
|
||||
* Misc: travis ci integration (@thebigredgeek)
|
||||
* Misc: added linting and testing boilerplate with sanity check (@thebigredgeek)
|
||||
|
||||
2.4.1 / 2016-12-13
|
||||
==================
|
||||
|
||||
* Fix: typo that broke the package (#356)
|
||||
|
||||
2.4.0 / 2016-12-13
|
||||
==================
|
||||
|
||||
* Fix: bower.json references unbuilt src entry point (#342, @justmatt)
|
||||
* Fix: revert "handle regex special characters" (@tootallnate)
|
||||
* Feature: configurable util.inspect()`options for NodeJS (#327, @tootallnate)
|
||||
* Feature: %O`(big O) pretty-prints objects (#322, @tootallnate)
|
||||
* Improvement: allow colors in workers (#335, @botverse)
|
||||
* Improvement: use same color for same namespace. (#338, @lchenay)
|
||||
|
||||
2.3.3 / 2016-11-09
|
||||
==================
|
||||
|
||||
* Fix: Catch `JSON.stringify()` errors (#195, Jovan Alleyne)
|
||||
* Fix: Returning `localStorage` saved values (#331, Levi Thomason)
|
||||
* Improvement: Don't create an empty object when no `process` (Nathan Rajlich)
|
||||
|
||||
2.3.2 / 2016-11-09
|
||||
==================
|
||||
|
||||
* Fix: be super-safe in index.js as well (@TooTallNate)
|
||||
* Fix: should check whether process exists (Tom Newby)
|
||||
|
||||
2.3.1 / 2016-11-09
|
||||
==================
|
||||
|
||||
* Fix: Added electron compatibility (#324, @paulcbetts)
|
||||
* Improvement: Added performance optimizations (@tootallnate)
|
||||
* Readme: Corrected PowerShell environment variable example (#252, @gimre)
|
||||
* Misc: Removed yarn lock file from source control (#321, @fengmk2)
|
||||
|
||||
2.3.0 / 2016-11-07
|
||||
==================
|
||||
|
||||
* Fix: Consistent placement of ms diff at end of output (#215, @gorangajic)
|
||||
* Fix: Escaping of regex special characters in namespace strings (#250, @zacronos)
|
||||
* Fix: Fixed bug causing crash on react-native (#282, @vkarpov15)
|
||||
* Feature: Enabled ES6+ compatible import via default export (#212 @bucaran)
|
||||
* Feature: Added %O formatter to reflect Chrome's console.log capability (#279, @oncletom)
|
||||
* Package: Update "ms" to 0.7.2 (#315, @DevSide)
|
||||
* Package: removed superfluous version property from bower.json (#207 @kkirsche)
|
||||
* Readme: fix USE_COLORS to DEBUG_COLORS
|
||||
* Readme: Doc fixes for format string sugar (#269, @mlucool)
|
||||
* Readme: Updated docs for DEBUG_FD and DEBUG_COLORS environment variables (#232, @mattlyons0)
|
||||
* Readme: doc fixes for PowerShell (#271 #243, @exoticknight @unreadable)
|
||||
* Readme: better docs for browser support (#224, @matthewmueller)
|
||||
* Tooling: Added yarn integration for development (#317, @thebigredgeek)
|
||||
* Misc: Renamed History.md to CHANGELOG.md (@thebigredgeek)
|
||||
* Misc: Added license file (#226 #274, @CantemoInternal @sdaitzman)
|
||||
* Misc: Updated contributors (@thebigredgeek)
|
||||
|
||||
2.2.0 / 2015-05-09
|
||||
==================
|
||||
|
||||
* package: update "ms" to v0.7.1 (#202, @dougwilson)
|
||||
* README: add logging to file example (#193, @DanielOchoa)
|
||||
* README: fixed a typo (#191, @amir-s)
|
||||
* browser: expose `storage` (#190, @stephenmathieson)
|
||||
* Makefile: add a `distclean` target (#189, @stephenmathieson)
|
||||
|
||||
2.1.3 / 2015-03-13
|
||||
==================
|
||||
|
||||
* Updated stdout/stderr example (#186)
|
||||
* Updated example/stdout.js to match debug current behaviour
|
||||
* Renamed example/stderr.js to stdout.js
|
||||
* Update Readme.md (#184)
|
||||
* replace high intensity foreground color for bold (#182, #183)
|
||||
|
||||
2.1.2 / 2015-03-01
|
||||
==================
|
||||
|
||||
* dist: recompile
|
||||
* update "ms" to v0.7.0
|
||||
* package: update "browserify" to v9.0.3
|
||||
* component: fix "ms.js" repo location
|
||||
* changed bower package name
|
||||
* updated documentation about using debug in a browser
|
||||
* fix: security error on safari (#167, #168, @yields)
|
||||
|
||||
2.1.1 / 2014-12-29
|
||||
==================
|
||||
|
||||
* browser: use `typeof` to check for `console` existence
|
||||
* browser: check for `console.log` truthiness (fix IE 8/9)
|
||||
* browser: add support for Chrome apps
|
||||
* Readme: added Windows usage remarks
|
||||
* Add `bower.json` to properly support bower install
|
||||
|
||||
2.1.0 / 2014-10-15
|
||||
==================
|
||||
|
||||
* node: implement `DEBUG_FD` env variable support
|
||||
* package: update "browserify" to v6.1.0
|
||||
* package: add "license" field to package.json (#135, @panuhorsmalahti)
|
||||
|
||||
2.0.0 / 2014-09-01
|
||||
==================
|
||||
|
||||
* package: update "browserify" to v5.11.0
|
||||
* node: use stderr rather than stdout for logging (#29, @stephenmathieson)
|
||||
|
||||
1.0.4 / 2014-07-15
|
||||
==================
|
||||
|
||||
* dist: recompile
|
||||
* example: remove `console.info()` log usage
|
||||
* example: add "Content-Type" UTF-8 header to browser example
|
||||
* browser: place %c marker after the space character
|
||||
* browser: reset the "content" color via `color: inherit`
|
||||
* browser: add colors support for Firefox >= v31
|
||||
* debug: prefer an instance `log()` function over the global one (#119)
|
||||
* Readme: update documentation about styled console logs for FF v31 (#116, @wryk)
|
||||
|
||||
1.0.3 / 2014-07-09
|
||||
==================
|
||||
|
||||
* Add support for multiple wildcards in namespaces (#122, @seegno)
|
||||
* browser: fix lint
|
||||
|
||||
1.0.2 / 2014-06-10
|
||||
==================
|
||||
|
||||
* browser: update color palette (#113, @gscottolson)
|
||||
* common: make console logging function configurable (#108, @timoxley)
|
||||
* node: fix %o colors on old node <= 0.8.x
|
||||
* Makefile: find node path using shell/which (#109, @timoxley)
|
||||
|
||||
1.0.1 / 2014-06-06
|
||||
==================
|
||||
|
||||
* browser: use `removeItem()` to clear localStorage
|
||||
* browser, node: don't set DEBUG if namespaces is undefined (#107, @leedm777)
|
||||
* package: add "contributors" section
|
||||
* node: fix comment typo
|
||||
* README: list authors
|
||||
|
||||
1.0.0 / 2014-06-04
|
||||
==================
|
||||
|
||||
* make ms diff be global, not be scope
|
||||
* debug: ignore empty strings in enable()
|
||||
* node: make DEBUG_COLORS able to disable coloring
|
||||
* *: export the `colors` array
|
||||
* npmignore: don't publish the `dist` dir
|
||||
* Makefile: refactor to use browserify
|
||||
* package: add "browserify" as a dev dependency
|
||||
* Readme: add Web Inspector Colors section
|
||||
* node: reset terminal color for the debug content
|
||||
* node: map "%o" to `util.inspect()`
|
||||
* browser: map "%j" to `JSON.stringify()`
|
||||
* debug: add custom "formatters"
|
||||
* debug: use "ms" module for humanizing the diff
|
||||
* Readme: add "bash" syntax highlighting
|
||||
* browser: add Firebug color support
|
||||
* browser: add colors for WebKit browsers
|
||||
* node: apply log to `console`
|
||||
* rewrite: abstract common logic for Node & browsers
|
||||
* add .jshintrc file
|
||||
|
||||
0.8.1 / 2014-04-14
|
||||
==================
|
||||
|
||||
* package: re-add the "component" section
|
||||
|
||||
0.8.0 / 2014-03-30
|
||||
==================
|
||||
|
||||
* add `enable()` method for nodejs. Closes #27
|
||||
* change from stderr to stdout
|
||||
* remove unnecessary index.js file
|
||||
|
||||
0.7.4 / 2013-11-13
|
||||
==================
|
||||
|
||||
* remove "browserify" key from package.json (fixes something in browserify)
|
||||
|
||||
0.7.3 / 2013-10-30
|
||||
==================
|
||||
|
||||
* fix: catch localStorage security error when cookies are blocked (Chrome)
|
||||
* add debug(err) support. Closes #46
|
||||
* add .browser prop to package.json. Closes #42
|
||||
|
||||
0.7.2 / 2013-02-06
|
||||
==================
|
||||
|
||||
* fix package.json
|
||||
* fix: Mobile Safari (private mode) is broken with debug
|
||||
* fix: Use unicode to send escape character to shell instead of octal to work with strict mode javascript
|
||||
|
||||
0.7.1 / 2013-02-05
|
||||
==================
|
||||
|
||||
* add repository URL to package.json
|
||||
* add DEBUG_COLORED to force colored output
|
||||
* add browserify support
|
||||
* fix component. Closes #24
|
||||
|
||||
0.7.0 / 2012-05-04
|
||||
==================
|
||||
|
||||
* Added .component to package.json
|
||||
* Added debug.component.js build
|
||||
|
||||
0.6.0 / 2012-03-16
|
||||
==================
|
||||
|
||||
* Added support for "-" prefix in DEBUG [Vinay Pulim]
|
||||
* Added `.enabled` flag to the node version [TooTallNate]
|
||||
|
||||
0.5.0 / 2012-02-02
|
||||
==================
|
||||
|
||||
* Added: humanize diffs. Closes #8
|
||||
* Added `debug.disable()` to the CS variant
|
||||
* Removed padding. Closes #10
|
||||
* Fixed: persist client-side variant again. Closes #9
|
||||
|
||||
0.4.0 / 2012-02-01
|
||||
==================
|
||||
|
||||
* Added browser variant support for older browsers [TooTallNate]
|
||||
* Added `debug.enable('project:*')` to browser variant [TooTallNate]
|
||||
* Added padding to diff (moved it to the right)
|
||||
|
||||
0.3.0 / 2012-01-26
|
||||
==================
|
||||
|
||||
* Added millisecond diff when isatty, otherwise UTC string
|
||||
|
||||
0.2.0 / 2012-01-22
|
||||
==================
|
||||
|
||||
* Added wildcard support
|
||||
|
||||
0.1.0 / 2011-12-02
|
||||
==================
|
||||
|
||||
* Added: remove colors unless stderr isatty [TooTallNate]
|
||||
|
||||
0.0.1 / 2010-01-03
|
||||
==================
|
||||
|
||||
* Initial release
|
||||
19
node_modules/debug/LICENSE
generated
vendored
19
node_modules/debug/LICENSE
generated
vendored
@@ -1,19 +0,0 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2014 TJ Holowaychuk <tj@vision-media.ca>
|
||||
|
||||
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.
|
||||
|
||||
50
node_modules/debug/Makefile
generated
vendored
50
node_modules/debug/Makefile
generated
vendored
@@ -1,50 +0,0 @@
|
||||
# get Makefile directory name: http://stackoverflow.com/a/5982798/376773
|
||||
THIS_MAKEFILE_PATH:=$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
|
||||
THIS_DIR:=$(shell cd $(dir $(THIS_MAKEFILE_PATH));pwd)
|
||||
|
||||
# BIN directory
|
||||
BIN := $(THIS_DIR)/node_modules/.bin
|
||||
|
||||
# Path
|
||||
PATH := node_modules/.bin:$(PATH)
|
||||
SHELL := /bin/bash
|
||||
|
||||
# applications
|
||||
NODE ?= $(shell which node)
|
||||
YARN ?= $(shell which yarn)
|
||||
PKG ?= $(if $(YARN),$(YARN),$(NODE) $(shell which npm))
|
||||
BROWSERIFY ?= $(NODE) $(BIN)/browserify
|
||||
|
||||
.FORCE:
|
||||
|
||||
install: node_modules
|
||||
|
||||
node_modules: package.json
|
||||
@NODE_ENV= $(PKG) install
|
||||
@touch node_modules
|
||||
|
||||
lint: .FORCE
|
||||
eslint browser.js debug.js index.js node.js
|
||||
|
||||
test-node: .FORCE
|
||||
istanbul cover node_modules/mocha/bin/_mocha -- test/**.js
|
||||
|
||||
test-browser: .FORCE
|
||||
mkdir -p dist
|
||||
|
||||
@$(BROWSERIFY) \
|
||||
--standalone debug \
|
||||
. > dist/debug.js
|
||||
|
||||
karma start --single-run
|
||||
rimraf dist
|
||||
|
||||
test: .FORCE
|
||||
concurrently \
|
||||
"make test-node" \
|
||||
"make test-browser"
|
||||
|
||||
coveralls:
|
||||
cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
|
||||
|
||||
.PHONY: all install clean distclean
|
||||
312
node_modules/debug/README.md
generated
vendored
312
node_modules/debug/README.md
generated
vendored
@@ -1,312 +0,0 @@
|
||||
# debug
|
||||
[](https://travis-ci.org/visionmedia/debug) [](https://coveralls.io/github/visionmedia/debug?branch=master) [](https://visionmedia-community-slackin.now.sh/) [](#backers)
|
||||
[](#sponsors)
|
||||
|
||||
|
||||
|
||||
A tiny node.js debugging utility modelled after node core's debugging technique.
|
||||
|
||||
**Discussion around the V3 API is under way [here](https://github.com/visionmedia/debug/issues/370)**
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
$ npm install debug
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
`debug` exposes a function; simply pass this function the name of your module, and it will return a decorated version of `console.error` for you to pass debug statements to. This will allow you to toggle the debug output for different parts of your module as well as the module as a whole.
|
||||
|
||||
Example _app.js_:
|
||||
|
||||
```js
|
||||
var debug = require('debug')('http')
|
||||
, http = require('http')
|
||||
, name = 'My App';
|
||||
|
||||
// fake app
|
||||
|
||||
debug('booting %s', name);
|
||||
|
||||
http.createServer(function(req, res){
|
||||
debug(req.method + ' ' + req.url);
|
||||
res.end('hello\n');
|
||||
}).listen(3000, function(){
|
||||
debug('listening');
|
||||
});
|
||||
|
||||
// fake worker of some kind
|
||||
|
||||
require('./worker');
|
||||
```
|
||||
|
||||
Example _worker.js_:
|
||||
|
||||
```js
|
||||
var debug = require('debug')('worker');
|
||||
|
||||
setInterval(function(){
|
||||
debug('doing some work');
|
||||
}, 1000);
|
||||
```
|
||||
|
||||
The __DEBUG__ environment variable is then used to enable these based on space or comma-delimited names. Here are some examples:
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
#### Windows note
|
||||
|
||||
On Windows the environment variable is set using the `set` command.
|
||||
|
||||
```cmd
|
||||
set DEBUG=*,-not_this
|
||||
```
|
||||
|
||||
Note that PowerShell uses different syntax to set environment variables.
|
||||
|
||||
```cmd
|
||||
$env:DEBUG = "*,-not_this"
|
||||
```
|
||||
|
||||
Then, run the program to be debugged as usual.
|
||||
|
||||
## Millisecond diff
|
||||
|
||||
When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls.
|
||||
|
||||

|
||||
|
||||
When stdout is not a TTY, `Date#toUTCString()` is used, making it more useful for logging the debug information as shown below:
|
||||
|
||||

|
||||
|
||||
## Conventions
|
||||
|
||||
If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser".
|
||||
|
||||
## Wildcards
|
||||
|
||||
The `*` character may be used as a wildcard. Suppose for example your library has debuggers named "connect:bodyParser", "connect:compress", "connect:session", instead of listing all three with `DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do `DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`.
|
||||
|
||||
You can also exclude specific debuggers by prefixing them with a "-" character. For example, `DEBUG=*,-connect:*` would include all debuggers except those starting with "connect:".
|
||||
|
||||
## Environment Variables
|
||||
|
||||
When running through Node.js, you can set a few environment variables that will
|
||||
change the behavior of the debug logging:
|
||||
|
||||
| Name | Purpose |
|
||||
|-----------|-------------------------------------------------|
|
||||
| `DEBUG` | Enables/disabled specific debugging namespaces. |
|
||||
| `DEBUG_COLORS`| Whether or not to use colors in the debug output. |
|
||||
| `DEBUG_DEPTH` | Object inspection depth. |
|
||||
| `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. |
|
||||
|
||||
|
||||
__Note:__ The environment variables beginning with `DEBUG_` end up being
|
||||
converted into an Options object that gets used with `%o`/`%O` formatters.
|
||||
See the Node.js documentation for
|
||||
[`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options)
|
||||
for the complete list.
|
||||
|
||||
## Formatters
|
||||
|
||||
|
||||
Debug uses [printf-style](https://wikipedia.org/wiki/Printf_format_string) formatting. Below are the officially supported formatters:
|
||||
|
||||
| Formatter | Representation |
|
||||
|-----------|----------------|
|
||||
| `%O` | Pretty-print an Object on multiple lines. |
|
||||
| `%o` | Pretty-print an Object all on a single line. |
|
||||
| `%s` | String. |
|
||||
| `%d` | Number (both integer and float). |
|
||||
| `%j` | JSON. Replaced with the string '[Circular]' if the argument contains circular references. |
|
||||
| `%%` | Single percent sign ('%'). This does not consume an argument. |
|
||||
|
||||
### Custom formatters
|
||||
|
||||
You can add custom formatters by extending the `debug.formatters` object. For example, if you wanted to add support for rendering a Buffer as hex with `%h`, you could do something like:
|
||||
|
||||
```js
|
||||
const createDebug = require('debug')
|
||||
createDebug.formatters.h = (v) => {
|
||||
return v.toString('hex')
|
||||
}
|
||||
|
||||
// …elsewhere
|
||||
const debug = createDebug('foo')
|
||||
debug('this is hex: %h', new Buffer('hello world'))
|
||||
// foo this is hex: 68656c6c6f20776f726c6421 +0ms
|
||||
```
|
||||
|
||||
## Browser support
|
||||
You can build a browser-ready script using [browserify](https://github.com/substack/node-browserify),
|
||||
or just use the [browserify-as-a-service](https://wzrd.in/) [build](https://wzrd.in/standalone/debug@latest),
|
||||
if you don't want to build it yourself.
|
||||
|
||||
Debug's enable state is currently persisted by `localStorage`.
|
||||
Consider the situation shown below where you have `worker:a` and `worker:b`,
|
||||
and wish to debug both. You can enable this using `localStorage.debug`:
|
||||
|
||||
```js
|
||||
localStorage.debug = 'worker:*'
|
||||
```
|
||||
|
||||
And then refresh the page.
|
||||
|
||||
```js
|
||||
a = debug('worker:a');
|
||||
b = debug('worker:b');
|
||||
|
||||
setInterval(function(){
|
||||
a('doing some work');
|
||||
}, 1000);
|
||||
|
||||
setInterval(function(){
|
||||
b('doing some work');
|
||||
}, 1200);
|
||||
```
|
||||
|
||||
#### Web Inspector Colors
|
||||
|
||||
Colors are also enabled on "Web Inspectors" that understand the `%c` formatting
|
||||
option. These are WebKit web inspectors, Firefox ([since version
|
||||
31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/))
|
||||
and the Firebug plugin for Firefox (any version).
|
||||
|
||||
Colored output looks something like:
|
||||
|
||||

|
||||
|
||||
|
||||
## Output streams
|
||||
|
||||
By default `debug` will log to stderr, however this can be configured per-namespace by overriding the `log` method:
|
||||
|
||||
Example _stdout.js_:
|
||||
|
||||
```js
|
||||
var debug = require('debug');
|
||||
var error = debug('app:error');
|
||||
|
||||
// by default stderr is used
|
||||
error('goes to stderr!');
|
||||
|
||||
var log = debug('app:log');
|
||||
// set this namespace to log via console.log
|
||||
log.log = console.log.bind(console); // don't forget to bind to console!
|
||||
log('goes to stdout');
|
||||
error('still goes to stderr!');
|
||||
|
||||
// set all output to go via console.info
|
||||
// overrides all per-namespace log settings
|
||||
debug.log = console.info.bind(console);
|
||||
error('now goes to stdout via console.info');
|
||||
log('still goes to stdout, but via console.info now');
|
||||
```
|
||||
|
||||
|
||||
## Authors
|
||||
|
||||
- TJ Holowaychuk
|
||||
- Nathan Rajlich
|
||||
- Andrew Rhyne
|
||||
|
||||
## Backers
|
||||
|
||||
Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/debug#backer)]
|
||||
|
||||
<a href="https://opencollective.com/debug/backer/0/website" target="_blank"><img src="https://opencollective.com/debug/backer/0/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/1/website" target="_blank"><img src="https://opencollective.com/debug/backer/1/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/2/website" target="_blank"><img src="https://opencollective.com/debug/backer/2/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/3/website" target="_blank"><img src="https://opencollective.com/debug/backer/3/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/4/website" target="_blank"><img src="https://opencollective.com/debug/backer/4/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/5/website" target="_blank"><img src="https://opencollective.com/debug/backer/5/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/6/website" target="_blank"><img src="https://opencollective.com/debug/backer/6/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/7/website" target="_blank"><img src="https://opencollective.com/debug/backer/7/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/8/website" target="_blank"><img src="https://opencollective.com/debug/backer/8/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/9/website" target="_blank"><img src="https://opencollective.com/debug/backer/9/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/10/website" target="_blank"><img src="https://opencollective.com/debug/backer/10/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/11/website" target="_blank"><img src="https://opencollective.com/debug/backer/11/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/12/website" target="_blank"><img src="https://opencollective.com/debug/backer/12/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/13/website" target="_blank"><img src="https://opencollective.com/debug/backer/13/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/14/website" target="_blank"><img src="https://opencollective.com/debug/backer/14/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/15/website" target="_blank"><img src="https://opencollective.com/debug/backer/15/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/16/website" target="_blank"><img src="https://opencollective.com/debug/backer/16/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/17/website" target="_blank"><img src="https://opencollective.com/debug/backer/17/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/18/website" target="_blank"><img src="https://opencollective.com/debug/backer/18/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/19/website" target="_blank"><img src="https://opencollective.com/debug/backer/19/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/20/website" target="_blank"><img src="https://opencollective.com/debug/backer/20/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/21/website" target="_blank"><img src="https://opencollective.com/debug/backer/21/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/22/website" target="_blank"><img src="https://opencollective.com/debug/backer/22/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/23/website" target="_blank"><img src="https://opencollective.com/debug/backer/23/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/24/website" target="_blank"><img src="https://opencollective.com/debug/backer/24/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/25/website" target="_blank"><img src="https://opencollective.com/debug/backer/25/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/26/website" target="_blank"><img src="https://opencollective.com/debug/backer/26/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/27/website" target="_blank"><img src="https://opencollective.com/debug/backer/27/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/28/website" target="_blank"><img src="https://opencollective.com/debug/backer/28/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/29/website" target="_blank"><img src="https://opencollective.com/debug/backer/29/avatar.svg"></a>
|
||||
|
||||
|
||||
## Sponsors
|
||||
|
||||
Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/debug#sponsor)]
|
||||
|
||||
<a href="https://opencollective.com/debug/sponsor/0/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/0/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/1/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/1/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/2/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/2/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/3/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/3/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/4/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/4/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/5/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/5/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/6/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/6/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/7/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/7/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/8/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/8/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/9/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/9/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/10/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/10/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/11/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/11/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/12/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/12/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/13/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/13/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/14/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/14/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/15/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/15/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/16/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/16/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/17/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/17/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/18/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/18/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/19/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/19/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/20/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/20/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/21/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/21/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/22/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/22/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/23/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/23/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/24/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/24/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/25/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/25/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/26/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/26/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/27/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/27/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/28/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/28/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/29/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/29/avatar.svg"></a>
|
||||
|
||||
## License
|
||||
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2014-2016 TJ Holowaychuk <tj@vision-media.ca>
|
||||
|
||||
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.
|
||||
29
node_modules/debug/bower.json
generated
vendored
29
node_modules/debug/bower.json
generated
vendored
@@ -1,29 +0,0 @@
|
||||
{
|
||||
"name": "visionmedia-debug",
|
||||
"main": "./src/browser.js",
|
||||
"homepage": "https://github.com/visionmedia/debug",
|
||||
"authors": [
|
||||
"TJ Holowaychuk <tj@vision-media.ca>",
|
||||
"Nathan Rajlich <nathan@tootallnate.net> (http://n8.io)",
|
||||
"Andrew Rhyne <rhyneandrew@gmail.com>"
|
||||
],
|
||||
"description": "visionmedia-debug",
|
||||
"moduleType": [
|
||||
"amd",
|
||||
"es6",
|
||||
"globals",
|
||||
"node"
|
||||
],
|
||||
"keywords": [
|
||||
"visionmedia",
|
||||
"debug"
|
||||
],
|
||||
"license": "MIT",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"test",
|
||||
"tests"
|
||||
]
|
||||
}
|
||||
19
node_modules/debug/component.json
generated
vendored
19
node_modules/debug/component.json
generated
vendored
@@ -1,19 +0,0 @@
|
||||
{
|
||||
"name": "debug",
|
||||
"repo": "visionmedia/debug",
|
||||
"description": "small debugging utility",
|
||||
"version": "2.6.3",
|
||||
"keywords": [
|
||||
"debug",
|
||||
"log",
|
||||
"debugger"
|
||||
],
|
||||
"main": "src/browser.js",
|
||||
"scripts": [
|
||||
"src/browser.js",
|
||||
"src/debug.js"
|
||||
],
|
||||
"dependencies": {
|
||||
"rauchg/ms.js": "0.7.1"
|
||||
}
|
||||
}
|
||||
70
node_modules/debug/karma.conf.js
generated
vendored
70
node_modules/debug/karma.conf.js
generated
vendored
@@ -1,70 +0,0 @@
|
||||
// Karma configuration
|
||||
// Generated on Fri Dec 16 2016 13:09:51 GMT+0000 (UTC)
|
||||
|
||||
module.exports = function(config) {
|
||||
config.set({
|
||||
|
||||
// base path that will be used to resolve all patterns (eg. files, exclude)
|
||||
basePath: '',
|
||||
|
||||
|
||||
// frameworks to use
|
||||
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
|
||||
frameworks: ['mocha', 'chai', 'sinon'],
|
||||
|
||||
|
||||
// list of files / patterns to load in the browser
|
||||
files: [
|
||||
'dist/debug.js',
|
||||
'test/*spec.js'
|
||||
],
|
||||
|
||||
|
||||
// list of files to exclude
|
||||
exclude: [
|
||||
'src/node.js'
|
||||
],
|
||||
|
||||
|
||||
// preprocess matching files before serving them to the browser
|
||||
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
|
||||
preprocessors: {
|
||||
},
|
||||
|
||||
// test results reporter to use
|
||||
// possible values: 'dots', 'progress'
|
||||
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
|
||||
reporters: ['progress'],
|
||||
|
||||
|
||||
// web server port
|
||||
port: 9876,
|
||||
|
||||
|
||||
// enable / disable colors in the output (reporters and logs)
|
||||
colors: true,
|
||||
|
||||
|
||||
// level of logging
|
||||
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
|
||||
logLevel: config.LOG_INFO,
|
||||
|
||||
|
||||
// enable / disable watching file and executing tests whenever any file changes
|
||||
autoWatch: true,
|
||||
|
||||
|
||||
// start these browsers
|
||||
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
|
||||
browsers: ['PhantomJS'],
|
||||
|
||||
|
||||
// Continuous Integration mode
|
||||
// if true, Karma captures browsers, runs the tests and exits
|
||||
singleRun: false,
|
||||
|
||||
// Concurrency level
|
||||
// how many browser should be started simultaneous
|
||||
concurrency: Infinity
|
||||
})
|
||||
}
|
||||
1
node_modules/debug/node.js
generated
vendored
1
node_modules/debug/node.js
generated
vendored
@@ -1 +0,0 @@
|
||||
module.exports = require('./src/node');
|
||||
126
node_modules/debug/package.json
generated
vendored
126
node_modules/debug/package.json
generated
vendored
@@ -1,126 +0,0 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "debug@^2.2.0",
|
||||
"scope": null,
|
||||
"escapedName": "debug",
|
||||
"name": "debug",
|
||||
"rawSpec": "^2.2.0",
|
||||
"spec": ">=2.2.0 <3.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/log4js"
|
||||
]
|
||||
],
|
||||
"_cnpm_publish_time": 1489463434042,
|
||||
"_from": "debug@>=2.2.0 <3.0.0",
|
||||
"_id": "debug@2.6.3",
|
||||
"_inCache": true,
|
||||
"_installable": true,
|
||||
"_location": "/debug",
|
||||
"_nodeVersion": "6.9.2",
|
||||
"_npmOperationalInternal": {
|
||||
"host": "packages-12-west.internal.npmjs.com",
|
||||
"tmp": "tmp/debug-2.6.3.tgz_1489463433800_0.9440390267409384"
|
||||
},
|
||||
"_npmUser": {
|
||||
"name": "thebigredgeek",
|
||||
"email": "rhyneandrew@gmail.com"
|
||||
},
|
||||
"_npmVersion": "3.10.9",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "debug@^2.2.0",
|
||||
"scope": null,
|
||||
"escapedName": "debug",
|
||||
"name": "debug",
|
||||
"rawSpec": "^2.2.0",
|
||||
"spec": ">=2.2.0 <3.0.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/log4js"
|
||||
],
|
||||
"_resolved": "https://registry.npm.taobao.org/debug/download/debug-2.6.3.tgz",
|
||||
"_shasum": "0f7eb8c30965ec08c72accfa0130c8b79984141d",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "debug@^2.2.0",
|
||||
"_where": "/home/vincent/Projects/SublimeTextProjects/shadowsocks-over-websocket/node_modules/log4js",
|
||||
"author": {
|
||||
"name": "TJ Holowaychuk",
|
||||
"email": "tj@vision-media.ca"
|
||||
},
|
||||
"browser": "./src/browser.js",
|
||||
"bugs": {
|
||||
"url": "https://github.com/visionmedia/debug/issues"
|
||||
},
|
||||
"component": {
|
||||
"scripts": {
|
||||
"debug/index.js": "browser.js",
|
||||
"debug/debug.js": "debug.js"
|
||||
}
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Nathan Rajlich",
|
||||
"email": "nathan@tootallnate.net",
|
||||
"url": "http://n8.io"
|
||||
},
|
||||
{
|
||||
"name": "Andrew Rhyne",
|
||||
"email": "rhyneandrew@gmail.com"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"ms": "0.7.2"
|
||||
},
|
||||
"description": "small debugging utility",
|
||||
"devDependencies": {
|
||||
"browserify": "9.0.3",
|
||||
"chai": "^3.5.0",
|
||||
"concurrently": "^3.1.0",
|
||||
"coveralls": "^2.11.15",
|
||||
"eslint": "^3.12.1",
|
||||
"istanbul": "^0.4.5",
|
||||
"karma": "^1.3.0",
|
||||
"karma-chai": "^0.1.0",
|
||||
"karma-mocha": "^1.3.0",
|
||||
"karma-phantomjs-launcher": "^1.0.2",
|
||||
"karma-sinon": "^1.0.5",
|
||||
"mocha": "^3.2.0",
|
||||
"mocha-lcov-reporter": "^1.2.0",
|
||||
"rimraf": "^2.5.4",
|
||||
"sinon": "^1.17.6",
|
||||
"sinon-chai": "^2.8.0"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "0f7eb8c30965ec08c72accfa0130c8b79984141d",
|
||||
"tarball": "https://registry.npmjs.org/debug/-/debug-2.6.3.tgz"
|
||||
},
|
||||
"gitHead": "9dc30f8378cc12192635cc6a31f0d96bb39be8bb",
|
||||
"homepage": "https://github.com/visionmedia/debug#readme",
|
||||
"keywords": [
|
||||
"debug",
|
||||
"log",
|
||||
"debugger"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "./src/index.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "thebigredgeek",
|
||||
"email": "rhyneandrew@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "debug",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/visionmedia/debug.git"
|
||||
},
|
||||
"scripts": {},
|
||||
"version": "2.6.3"
|
||||
}
|
||||
185
node_modules/debug/src/browser.js
generated
vendored
185
node_modules/debug/src/browser.js
generated
vendored
@@ -1,185 +0,0 @@
|
||||
/**
|
||||
* This is the web browser implementation of `debug()`.
|
||||
*
|
||||
* Expose `debug()` as the module.
|
||||
*/
|
||||
|
||||
exports = module.exports = require('./debug');
|
||||
exports.log = log;
|
||||
exports.formatArgs = formatArgs;
|
||||
exports.save = save;
|
||||
exports.load = load;
|
||||
exports.useColors = useColors;
|
||||
exports.storage = 'undefined' != typeof chrome
|
||||
&& 'undefined' != typeof chrome.storage
|
||||
? chrome.storage.local
|
||||
: localstorage();
|
||||
|
||||
/**
|
||||
* Colors.
|
||||
*/
|
||||
|
||||
exports.colors = [
|
||||
'lightseagreen',
|
||||
'forestgreen',
|
||||
'goldenrod',
|
||||
'dodgerblue',
|
||||
'darkorchid',
|
||||
'crimson'
|
||||
];
|
||||
|
||||
/**
|
||||
* Currently only WebKit-based Web Inspectors, Firefox >= v31,
|
||||
* and the Firebug extension (any Firefox version) are known
|
||||
* to support "%c" CSS customizations.
|
||||
*
|
||||
* TODO: add a `localStorage` variable to explicitly enable/disable colors
|
||||
*/
|
||||
|
||||
function useColors() {
|
||||
// NB: In an Electron preload script, document will be defined but not fully
|
||||
// initialized. Since we know we're in Chrome, we'll just detect this case
|
||||
// explicitly
|
||||
if (typeof window !== 'undefined' && window && typeof window.process !== 'undefined' && window.process.type === 'renderer') {
|
||||
return true;
|
||||
}
|
||||
|
||||
// is webkit? http://stackoverflow.com/a/16459606/376773
|
||||
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
|
||||
return (typeof document !== 'undefined' && document && 'WebkitAppearance' in document.documentElement.style) ||
|
||||
// is firebug? http://stackoverflow.com/a/398120/376773
|
||||
(typeof window !== 'undefined' && window && window.console && (console.firebug || (console.exception && console.table))) ||
|
||||
// is firefox >= v31?
|
||||
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
||||
(typeof navigator !== 'undefined' && navigator && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
|
||||
// double check webkit in userAgent just in case we are in a worker
|
||||
(typeof navigator !== 'undefined' && navigator && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
|
||||
}
|
||||
|
||||
/**
|
||||
* Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
|
||||
*/
|
||||
|
||||
exports.formatters.j = function(v) {
|
||||
try {
|
||||
return JSON.stringify(v);
|
||||
} catch (err) {
|
||||
return '[UnexpectedJSONParseError]: ' + err.message;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Colorize log arguments if enabled.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function formatArgs(args) {
|
||||
var useColors = this.useColors;
|
||||
|
||||
args[0] = (useColors ? '%c' : '')
|
||||
+ this.namespace
|
||||
+ (useColors ? ' %c' : ' ')
|
||||
+ args[0]
|
||||
+ (useColors ? '%c ' : ' ')
|
||||
+ '+' + exports.humanize(this.diff);
|
||||
|
||||
if (!useColors) return;
|
||||
|
||||
var c = 'color: ' + this.color;
|
||||
args.splice(1, 0, c, 'color: inherit')
|
||||
|
||||
// the final "%c" is somewhat tricky, because there could be other
|
||||
// arguments passed either before or after the %c, so we need to
|
||||
// figure out the correct index to insert the CSS into
|
||||
var index = 0;
|
||||
var lastC = 0;
|
||||
args[0].replace(/%[a-zA-Z%]/g, function(match) {
|
||||
if ('%%' === match) return;
|
||||
index++;
|
||||
if ('%c' === match) {
|
||||
// we only are interested in the *last* %c
|
||||
// (the user may have provided their own)
|
||||
lastC = index;
|
||||
}
|
||||
});
|
||||
|
||||
args.splice(lastC, 0, c);
|
||||
}
|
||||
|
||||
/**
|
||||
* Invokes `console.log()` when available.
|
||||
* No-op when `console.log` is not a "function".
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function log() {
|
||||
// this hackery is required for IE8/9, where
|
||||
// the `console.log` function doesn't have 'apply'
|
||||
return 'object' === typeof console
|
||||
&& console.log
|
||||
&& Function.prototype.apply.call(console.log, console, arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
* Save `namespaces`.
|
||||
*
|
||||
* @param {String} namespaces
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function save(namespaces) {
|
||||
try {
|
||||
if (null == namespaces) {
|
||||
exports.storage.removeItem('debug');
|
||||
} else {
|
||||
exports.storage.debug = namespaces;
|
||||
}
|
||||
} catch(e) {}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load `namespaces`.
|
||||
*
|
||||
* @return {String} returns the previously persisted debug modes
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function load() {
|
||||
var r;
|
||||
try {
|
||||
r = exports.storage.debug;
|
||||
} catch(e) {}
|
||||
|
||||
// If debug isn't set in LS, and we're in Electron, try to load $DEBUG
|
||||
if (!r && typeof process !== 'undefined' && 'env' in process) {
|
||||
r = process.env.DEBUG;
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable namespaces listed in `localStorage.debug` initially.
|
||||
*/
|
||||
|
||||
exports.enable(load());
|
||||
|
||||
/**
|
||||
* Localstorage attempts to return the localstorage.
|
||||
*
|
||||
* This is necessary because safari throws
|
||||
* when a user disables cookies/localstorage
|
||||
* and you attempt to access it.
|
||||
*
|
||||
* @return {LocalStorage}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function localstorage() {
|
||||
try {
|
||||
return window.localStorage;
|
||||
} catch (e) {}
|
||||
}
|
||||
202
node_modules/debug/src/debug.js
generated
vendored
202
node_modules/debug/src/debug.js
generated
vendored
@@ -1,202 +0,0 @@
|
||||
|
||||
/**
|
||||
* This is the common logic for both the Node.js and web browser
|
||||
* implementations of `debug()`.
|
||||
*
|
||||
* Expose `debug()` as the module.
|
||||
*/
|
||||
|
||||
exports = module.exports = createDebug.debug = createDebug['default'] = createDebug;
|
||||
exports.coerce = coerce;
|
||||
exports.disable = disable;
|
||||
exports.enable = enable;
|
||||
exports.enabled = enabled;
|
||||
exports.humanize = require('ms');
|
||||
|
||||
/**
|
||||
* The currently active debug mode names, and names to skip.
|
||||
*/
|
||||
|
||||
exports.names = [];
|
||||
exports.skips = [];
|
||||
|
||||
/**
|
||||
* Map of special "%n" handling functions, for the debug "format" argument.
|
||||
*
|
||||
* Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
|
||||
*/
|
||||
|
||||
exports.formatters = {};
|
||||
|
||||
/**
|
||||
* Previous log timestamp.
|
||||
*/
|
||||
|
||||
var prevTime;
|
||||
|
||||
/**
|
||||
* Select a color.
|
||||
* @param {String} namespace
|
||||
* @return {Number}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function selectColor(namespace) {
|
||||
var hash = 0, i;
|
||||
|
||||
for (i in namespace) {
|
||||
hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
|
||||
hash |= 0; // Convert to 32bit integer
|
||||
}
|
||||
|
||||
return exports.colors[Math.abs(hash) % exports.colors.length];
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a debugger with the given `namespace`.
|
||||
*
|
||||
* @param {String} namespace
|
||||
* @return {Function}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function createDebug(namespace) {
|
||||
|
||||
function debug() {
|
||||
// disabled?
|
||||
if (!debug.enabled) return;
|
||||
|
||||
var self = debug;
|
||||
|
||||
// set `diff` timestamp
|
||||
var curr = +new Date();
|
||||
var ms = curr - (prevTime || curr);
|
||||
self.diff = ms;
|
||||
self.prev = prevTime;
|
||||
self.curr = curr;
|
||||
prevTime = curr;
|
||||
|
||||
// turn the `arguments` into a proper Array
|
||||
var args = new Array(arguments.length);
|
||||
for (var i = 0; i < args.length; i++) {
|
||||
args[i] = arguments[i];
|
||||
}
|
||||
|
||||
args[0] = exports.coerce(args[0]);
|
||||
|
||||
if ('string' !== typeof args[0]) {
|
||||
// anything else let's inspect with %O
|
||||
args.unshift('%O');
|
||||
}
|
||||
|
||||
// apply any `formatters` transformations
|
||||
var index = 0;
|
||||
args[0] = args[0].replace(/%([a-zA-Z%])/g, function(match, format) {
|
||||
// if we encounter an escaped % then don't increase the array index
|
||||
if (match === '%%') return match;
|
||||
index++;
|
||||
var formatter = exports.formatters[format];
|
||||
if ('function' === typeof formatter) {
|
||||
var val = args[index];
|
||||
match = formatter.call(self, val);
|
||||
|
||||
// now we need to remove `args[index]` since it's inlined in the `format`
|
||||
args.splice(index, 1);
|
||||
index--;
|
||||
}
|
||||
return match;
|
||||
});
|
||||
|
||||
// apply env-specific formatting (colors, etc.)
|
||||
exports.formatArgs.call(self, args);
|
||||
|
||||
var logFn = debug.log || exports.log || console.log.bind(console);
|
||||
logFn.apply(self, args);
|
||||
}
|
||||
|
||||
debug.namespace = namespace;
|
||||
debug.enabled = exports.enabled(namespace);
|
||||
debug.useColors = exports.useColors();
|
||||
debug.color = selectColor(namespace);
|
||||
|
||||
// env-specific initialization logic for debug instances
|
||||
if ('function' === typeof exports.init) {
|
||||
exports.init(debug);
|
||||
}
|
||||
|
||||
return debug;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables a debug mode by namespaces. This can include modes
|
||||
* separated by a colon and wildcards.
|
||||
*
|
||||
* @param {String} namespaces
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function enable(namespaces) {
|
||||
exports.save(namespaces);
|
||||
|
||||
exports.names = [];
|
||||
exports.skips = [];
|
||||
|
||||
var split = (namespaces || '').split(/[\s,]+/);
|
||||
var len = split.length;
|
||||
|
||||
for (var i = 0; i < len; i++) {
|
||||
if (!split[i]) continue; // ignore empty strings
|
||||
namespaces = split[i].replace(/\*/g, '.*?');
|
||||
if (namespaces[0] === '-') {
|
||||
exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
|
||||
} else {
|
||||
exports.names.push(new RegExp('^' + namespaces + '$'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable debug output.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function disable() {
|
||||
exports.enable('');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the given mode name is enabled, false otherwise.
|
||||
*
|
||||
* @param {String} name
|
||||
* @return {Boolean}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function enabled(name) {
|
||||
var i, len;
|
||||
for (i = 0, len = exports.skips.length; i < len; i++) {
|
||||
if (exports.skips[i].test(name)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for (i = 0, len = exports.names.length; i < len; i++) {
|
||||
if (exports.names[i].test(name)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Coerce `val`.
|
||||
*
|
||||
* @param {Mixed} val
|
||||
* @return {Mixed}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function coerce(val) {
|
||||
if (val instanceof Error) return val.stack || val.message;
|
||||
return val;
|
||||
}
|
||||
10
node_modules/debug/src/index.js
generated
vendored
10
node_modules/debug/src/index.js
generated
vendored
@@ -1,10 +0,0 @@
|
||||
/**
|
||||
* Detect Electron renderer process, which is node, but we should
|
||||
* treat as a browser.
|
||||
*/
|
||||
|
||||
if (typeof process !== 'undefined' && process.type === 'renderer') {
|
||||
module.exports = require('./browser.js');
|
||||
} else {
|
||||
module.exports = require('./node.js');
|
||||
}
|
||||
241
node_modules/debug/src/node.js
generated
vendored
241
node_modules/debug/src/node.js
generated
vendored
@@ -1,241 +0,0 @@
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var tty = require('tty');
|
||||
var util = require('util');
|
||||
|
||||
/**
|
||||
* This is the Node.js implementation of `debug()`.
|
||||
*
|
||||
* Expose `debug()` as the module.
|
||||
*/
|
||||
|
||||
exports = module.exports = require('./debug');
|
||||
exports.init = init;
|
||||
exports.log = log;
|
||||
exports.formatArgs = formatArgs;
|
||||
exports.save = save;
|
||||
exports.load = load;
|
||||
exports.useColors = useColors;
|
||||
|
||||
/**
|
||||
* Colors.
|
||||
*/
|
||||
|
||||
exports.colors = [6, 2, 3, 4, 5, 1];
|
||||
|
||||
/**
|
||||
* Build up the default `inspectOpts` object from the environment variables.
|
||||
*
|
||||
* $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
|
||||
*/
|
||||
|
||||
exports.inspectOpts = Object.keys(process.env).filter(function (key) {
|
||||
return /^debug_/i.test(key);
|
||||
}).reduce(function (obj, key) {
|
||||
// camel-case
|
||||
var prop = key
|
||||
.substring(6)
|
||||
.toLowerCase()
|
||||
.replace(/_([a-z])/g, function (_, k) { return k.toUpperCase() });
|
||||
|
||||
// coerce string value into JS value
|
||||
var val = process.env[key];
|
||||
if (/^(yes|on|true|enabled)$/i.test(val)) val = true;
|
||||
else if (/^(no|off|false|disabled)$/i.test(val)) val = false;
|
||||
else if (val === 'null') val = null;
|
||||
else val = Number(val);
|
||||
|
||||
obj[prop] = val;
|
||||
return obj;
|
||||
}, {});
|
||||
|
||||
/**
|
||||
* The file descriptor to write the `debug()` calls to.
|
||||
* Set the `DEBUG_FD` env variable to override with another value. i.e.:
|
||||
*
|
||||
* $ DEBUG_FD=3 node script.js 3>debug.log
|
||||
*/
|
||||
|
||||
var fd = parseInt(process.env.DEBUG_FD, 10) || 2;
|
||||
|
||||
if (1 !== fd && 2 !== fd) {
|
||||
util.deprecate(function(){}, 'except for stderr(2) and stdout(1), any other usage of DEBUG_FD is deprecated. Override debug.log if you want to use a different log function (https://git.io/debug_fd)')()
|
||||
}
|
||||
|
||||
var stream = 1 === fd ? process.stdout :
|
||||
2 === fd ? process.stderr :
|
||||
createWritableStdioStream(fd);
|
||||
|
||||
/**
|
||||
* Is stdout a TTY? Colored output is enabled when `true`.
|
||||
*/
|
||||
|
||||
function useColors() {
|
||||
return 'colors' in exports.inspectOpts
|
||||
? Boolean(exports.inspectOpts.colors)
|
||||
: tty.isatty(fd);
|
||||
}
|
||||
|
||||
/**
|
||||
* Map %o to `util.inspect()`, all on a single line.
|
||||
*/
|
||||
|
||||
exports.formatters.o = function(v) {
|
||||
this.inspectOpts.colors = this.useColors;
|
||||
return util.inspect(v, this.inspectOpts)
|
||||
.replace(/\s*\n\s*/g, ' ');
|
||||
};
|
||||
|
||||
/**
|
||||
* Map %o to `util.inspect()`, allowing multiple lines if needed.
|
||||
*/
|
||||
|
||||
exports.formatters.O = function(v) {
|
||||
this.inspectOpts.colors = this.useColors;
|
||||
return util.inspect(v, this.inspectOpts);
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds ANSI color escape codes if enabled.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function formatArgs(args) {
|
||||
var name = this.namespace;
|
||||
var useColors = this.useColors;
|
||||
|
||||
if (useColors) {
|
||||
var c = this.color;
|
||||
var prefix = ' \u001b[3' + c + ';1m' + name + ' ' + '\u001b[0m';
|
||||
|
||||
args[0] = prefix + args[0].split('\n').join('\n' + prefix);
|
||||
args.push('\u001b[3' + c + 'm+' + exports.humanize(this.diff) + '\u001b[0m');
|
||||
} else {
|
||||
args[0] = new Date().toUTCString()
|
||||
+ ' ' + name + ' ' + args[0];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Invokes `util.format()` with the specified arguments and writes to `stream`.
|
||||
*/
|
||||
|
||||
function log() {
|
||||
return stream.write(util.format.apply(util, arguments) + '\n');
|
||||
}
|
||||
|
||||
/**
|
||||
* Save `namespaces`.
|
||||
*
|
||||
* @param {String} namespaces
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function save(namespaces) {
|
||||
if (null == namespaces) {
|
||||
// If you set a process.env field to null or undefined, it gets cast to the
|
||||
// string 'null' or 'undefined'. Just delete instead.
|
||||
delete process.env.DEBUG;
|
||||
} else {
|
||||
process.env.DEBUG = namespaces;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load `namespaces`.
|
||||
*
|
||||
* @return {String} returns the previously persisted debug modes
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function load() {
|
||||
return process.env.DEBUG;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copied from `node/src/node.js`.
|
||||
*
|
||||
* XXX: It's lame that node doesn't expose this API out-of-the-box. It also
|
||||
* relies on the undocumented `tty_wrap.guessHandleType()` which is also lame.
|
||||
*/
|
||||
|
||||
function createWritableStdioStream (fd) {
|
||||
var stream;
|
||||
var tty_wrap = process.binding('tty_wrap');
|
||||
|
||||
// Note stream._type is used for test-module-load-list.js
|
||||
|
||||
switch (tty_wrap.guessHandleType(fd)) {
|
||||
case 'TTY':
|
||||
stream = new tty.WriteStream(fd);
|
||||
stream._type = 'tty';
|
||||
|
||||
// Hack to have stream not keep the event loop alive.
|
||||
// See https://github.com/joyent/node/issues/1726
|
||||
if (stream._handle && stream._handle.unref) {
|
||||
stream._handle.unref();
|
||||
}
|
||||
break;
|
||||
|
||||
case 'FILE':
|
||||
var fs = require('fs');
|
||||
stream = new fs.SyncWriteStream(fd, { autoClose: false });
|
||||
stream._type = 'fs';
|
||||
break;
|
||||
|
||||
case 'PIPE':
|
||||
case 'TCP':
|
||||
var net = require('net');
|
||||
stream = new net.Socket({
|
||||
fd: fd,
|
||||
readable: false,
|
||||
writable: true
|
||||
});
|
||||
|
||||
// FIXME Should probably have an option in net.Socket to create a
|
||||
// stream from an existing fd which is writable only. But for now
|
||||
// we'll just add this hack and set the `readable` member to false.
|
||||
// Test: ./node test/fixtures/echo.js < /etc/passwd
|
||||
stream.readable = false;
|
||||
stream.read = null;
|
||||
stream._type = 'pipe';
|
||||
|
||||
// FIXME Hack to have stream not keep the event loop alive.
|
||||
// See https://github.com/joyent/node/issues/1726
|
||||
if (stream._handle && stream._handle.unref) {
|
||||
stream._handle.unref();
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
// Probably an error on in uv_guess_handle()
|
||||
throw new Error('Implement me. Unknown stream file type!');
|
||||
}
|
||||
|
||||
// For supporting legacy API we put the FD here.
|
||||
stream.fd = fd;
|
||||
|
||||
stream._isStdio = true;
|
||||
|
||||
return stream;
|
||||
}
|
||||
|
||||
/**
|
||||
* Init logic for `debug` instances.
|
||||
*
|
||||
* Create a new `inspectOpts` object in case `useColors` is set
|
||||
* differently for a particular `debug` instance.
|
||||
*/
|
||||
|
||||
function init (debug) {
|
||||
debug.inspectOpts = util._extend({}, exports.inspectOpts);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable namespaces listed in `process.env.DEBUG` initially.
|
||||
*/
|
||||
|
||||
exports.enable(load());
|
||||
21
node_modules/deep-extend/CHANGELOG.md
generated
vendored
21
node_modules/deep-extend/CHANGELOG.md
generated
vendored
@@ -1,21 +0,0 @@
|
||||
Changelog
|
||||
=========
|
||||
|
||||
v0.4.1
|
||||
------
|
||||
|
||||
- Removed test code from <b>npm</b> package
|
||||
([see pull request #21](https://github.com/unclechu/node-deep-extend/pull/21));
|
||||
- Increased minimal version of Node from 0.4.0 to 0.12.0
|
||||
(because can't run tests on lesser version anyway).
|
||||
|
||||
v0.4.0
|
||||
------
|
||||
|
||||
Broken backward compatibility with v0.3.x
|
||||
|
||||
- Fixed bug with extending arrays instead of cloning;
|
||||
- Deep cloning for arrays;
|
||||
- Check for own property;
|
||||
- Fixed some documentation issues;
|
||||
- Strict JS mode.
|
||||
20
node_modules/deep-extend/LICENSE
generated
vendored
20
node_modules/deep-extend/LICENSE
generated
vendored
@@ -1,20 +0,0 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2013-2015, Viacheslav Lotsmanov
|
||||
|
||||
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.
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user