browsed 0.2.8 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +28 -28
- data/browsed.gemspec +3 -4
- data/lib/browsed.rb +1 -1
- data/lib/browsed/browser.rb +2 -2
- data/lib/browsed/chrome.rb +2 -2
- data/lib/browsed/client.rb +4 -3
- data/lib/browsed/firefox.rb +2 -2
- data/lib/browsed/version.rb +1 -1
- metadata +13 -166
- data/lib/browsed/proxies/proxy-chain-server/node_modules/.bin/portastic +0 -1
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/LICENSE +0 -21
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/README.md +0 -57
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/changelog.md +0 -1
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/browser/bluebird.core.js +0 -3824
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/browser/bluebird.core.min.js +0 -31
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/browser/bluebird.js +0 -5666
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/browser/bluebird.min.js +0 -31
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/any.js +0 -21
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/assert.js +0 -55
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/async.js +0 -165
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/bind.js +0 -67
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/bluebird.js +0 -11
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/call_get.js +0 -123
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/cancel.js +0 -129
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/catch_filter.js +0 -42
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/context.js +0 -69
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/debuggability.js +0 -934
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/direct_resolve.js +0 -46
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/each.js +0 -30
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/errors.js +0 -116
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/es5.js +0 -80
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/filter.js +0 -12
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/finally.js +0 -146
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/generators.js +0 -223
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/join.js +0 -168
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/map.js +0 -168
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/method.js +0 -55
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/nodeback.js +0 -51
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/nodeify.js +0 -58
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/promise.js +0 -789
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/promise_array.js +0 -185
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/promisify.js +0 -314
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/props.js +0 -118
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/queue.js +0 -73
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/race.js +0 -49
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/reduce.js +0 -172
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/schedule.js +0 -62
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/settle.js +0 -43
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/some.js +0 -148
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/synchronous_inspection.js +0 -103
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/thenables.js +0 -86
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/timers.js +0 -93
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/using.js +0 -226
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/util.js +0 -389
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/package.json +0 -102
- data/lib/browsed/proxies/proxy-chain-server/node_modules/commander/CHANGELOG.md +0 -408
- data/lib/browsed/proxies/proxy-chain-server/node_modules/commander/LICENSE +0 -22
- data/lib/browsed/proxies/proxy-chain-server/node_modules/commander/Readme.md +0 -428
- data/lib/browsed/proxies/proxy-chain-server/node_modules/commander/index.js +0 -1224
- data/lib/browsed/proxies/proxy-chain-server/node_modules/commander/package.json +0 -70
- data/lib/browsed/proxies/proxy-chain-server/node_modules/commander/typings/index.d.ts +0 -310
- data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/.coveralls.yml +0 -1
- data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/.eslintrc +0 -11
- data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/.npmignore +0 -9
- data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/.travis.yml +0 -14
- data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/CHANGELOG.md +0 -362
- data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/LICENSE +0 -19
- data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/Makefile +0 -50
- data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/README.md +0 -312
- data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/component.json +0 -19
- data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/karma.conf.js +0 -70
- data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/node.js +0 -1
- data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/package.json +0 -88
- data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/src/browser.js +0 -185
- data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/src/debug.js +0 -202
- data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/src/index.js +0 -10
- data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/src/inspector-log.js +0 -15
- data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/src/node.js +0 -248
- data/lib/browsed/proxies/proxy-chain-server/node_modules/ms/index.js +0 -152
- data/lib/browsed/proxies/proxy-chain-server/node_modules/ms/license.md +0 -21
- data/lib/browsed/proxies/proxy-chain-server/node_modules/ms/package.json +0 -69
- data/lib/browsed/proxies/proxy-chain-server/node_modules/ms/readme.md +0 -51
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/LICENSE +0 -13
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/README.md +0 -148
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/bin/portastic +0 -65
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/history.md +0 -7
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/index.js +0 -4
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/lib/monitor.js +0 -59
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/lib/portastic.js +0 -167
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/LICENSE +0 -21
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/README.md +0 -677
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/changelog.md +0 -1730
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/browser/bluebird.js +0 -4892
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/browser/bluebird.min.js +0 -31
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/any.js +0 -21
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/assert.js +0 -55
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/async.js +0 -150
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/bind.js +0 -72
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/bluebird.js +0 -11
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/call_get.js +0 -123
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/cancel.js +0 -48
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/captured_trace.js +0 -493
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/catch_filter.js +0 -66
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/context.js +0 -38
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/debuggability.js +0 -162
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/direct_resolve.js +0 -63
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/each.js +0 -12
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/errors.js +0 -111
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/es5.js +0 -80
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/filter.js +0 -12
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/finally.js +0 -98
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/generators.js +0 -136
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/join.js +0 -107
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/map.js +0 -133
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/method.js +0 -44
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/nodeify.js +0 -59
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/progress.js +0 -76
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/promise.js +0 -759
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/promise_array.js +0 -142
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/promise_resolver.js +0 -123
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/promisify.js +0 -307
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/props.js +0 -79
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/queue.js +0 -90
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/race.js +0 -47
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/reduce.js +0 -148
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/schedule.js +0 -35
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/settle.js +0 -40
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/some.js +0 -125
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/synchronous_inspection.js +0 -94
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/thenables.js +0 -84
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/timers.js +0 -64
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/using.js +0 -213
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/util.js +0 -321
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/package.json +0 -103
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/package.json +0 -69
- data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/CHANGELOG.md +0 -109
- data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/LICENSE +0 -201
- data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/README.md +0 -278
- data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/anonymize_proxy.js +0 -100
- data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/handler_base.js +0 -319
- data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/handler_custom_response.js +0 -96
- data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/handler_forward.js +0 -173
- data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/handler_tunnel_chain.js +0 -132
- data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/handler_tunnel_direct.js +0 -89
- data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/handler_tunnel_tcp_chain.js +0 -271
- data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/index.js +0 -26
- data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/run_locally.js +0 -66
- data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/server.js +0 -595
- data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/tcp_tunnel.js +0 -138
- data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/testing_tcp_service.js +0 -37
- data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/tools.js +0 -220
- data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/package.json +0 -104
- data/lib/browsed/proxies/proxy-chain-server/node_modules/underscore/LICENSE +0 -23
- data/lib/browsed/proxies/proxy-chain-server/node_modules/underscore/README.md +0 -28
- data/lib/browsed/proxies/proxy-chain-server/node_modules/underscore/package.json +0 -81
- data/lib/browsed/proxies/proxy-chain-server/node_modules/underscore/underscore-min.js +0 -5
- data/lib/browsed/proxies/proxy-chain-server/node_modules/underscore/underscore-min.js.map +0 -1
- data/lib/browsed/proxies/proxy-chain-server/node_modules/underscore/underscore.js +0 -1692
- data/lib/browsed/proxies/proxy-chain-server/package-lock.json +0 -63
- data/lib/browsed/proxies/proxy-chain-server/package.json +0 -15
- data/lib/browsed/proxies/proxy-chain-server/server.js +0 -25
- data/lib/browsed/proxies/proxy_chain.rb +0 -39
@@ -1,10 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Detect Electron renderer process, which is node, but we should
|
3
|
-
* treat as a browser.
|
4
|
-
*/
|
5
|
-
|
6
|
-
if (typeof process !== 'undefined' && process.type === 'renderer') {
|
7
|
-
module.exports = require('./browser.js');
|
8
|
-
} else {
|
9
|
-
module.exports = require('./node.js');
|
10
|
-
}
|
@@ -1,15 +0,0 @@
|
|
1
|
-
module.exports = inspectorLog;
|
2
|
-
|
3
|
-
// black hole
|
4
|
-
const nullStream = new (require('stream').Writable)();
|
5
|
-
nullStream._write = () => {};
|
6
|
-
|
7
|
-
/**
|
8
|
-
* Outputs a `console.log()` to the Node.js Inspector console *only*.
|
9
|
-
*/
|
10
|
-
function inspectorLog() {
|
11
|
-
const stdout = console._stdout;
|
12
|
-
console._stdout = nullStream;
|
13
|
-
console.log.apply(console, arguments);
|
14
|
-
console._stdout = stdout;
|
15
|
-
}
|
@@ -1,248 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Module dependencies.
|
3
|
-
*/
|
4
|
-
|
5
|
-
var tty = require('tty');
|
6
|
-
var util = require('util');
|
7
|
-
|
8
|
-
/**
|
9
|
-
* This is the Node.js implementation of `debug()`.
|
10
|
-
*
|
11
|
-
* Expose `debug()` as the module.
|
12
|
-
*/
|
13
|
-
|
14
|
-
exports = module.exports = require('./debug');
|
15
|
-
exports.init = init;
|
16
|
-
exports.log = log;
|
17
|
-
exports.formatArgs = formatArgs;
|
18
|
-
exports.save = save;
|
19
|
-
exports.load = load;
|
20
|
-
exports.useColors = useColors;
|
21
|
-
|
22
|
-
/**
|
23
|
-
* Colors.
|
24
|
-
*/
|
25
|
-
|
26
|
-
exports.colors = [6, 2, 3, 4, 5, 1];
|
27
|
-
|
28
|
-
/**
|
29
|
-
* Build up the default `inspectOpts` object from the environment variables.
|
30
|
-
*
|
31
|
-
* $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
|
32
|
-
*/
|
33
|
-
|
34
|
-
exports.inspectOpts = Object.keys(process.env).filter(function (key) {
|
35
|
-
return /^debug_/i.test(key);
|
36
|
-
}).reduce(function (obj, key) {
|
37
|
-
// camel-case
|
38
|
-
var prop = key
|
39
|
-
.substring(6)
|
40
|
-
.toLowerCase()
|
41
|
-
.replace(/_([a-z])/g, function (_, k) { return k.toUpperCase() });
|
42
|
-
|
43
|
-
// coerce string value into JS value
|
44
|
-
var val = process.env[key];
|
45
|
-
if (/^(yes|on|true|enabled)$/i.test(val)) val = true;
|
46
|
-
else if (/^(no|off|false|disabled)$/i.test(val)) val = false;
|
47
|
-
else if (val === 'null') val = null;
|
48
|
-
else val = Number(val);
|
49
|
-
|
50
|
-
obj[prop] = val;
|
51
|
-
return obj;
|
52
|
-
}, {});
|
53
|
-
|
54
|
-
/**
|
55
|
-
* The file descriptor to write the `debug()` calls to.
|
56
|
-
* Set the `DEBUG_FD` env variable to override with another value. i.e.:
|
57
|
-
*
|
58
|
-
* $ DEBUG_FD=3 node script.js 3>debug.log
|
59
|
-
*/
|
60
|
-
|
61
|
-
var fd = parseInt(process.env.DEBUG_FD, 10) || 2;
|
62
|
-
|
63
|
-
if (1 !== fd && 2 !== fd) {
|
64
|
-
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)')()
|
65
|
-
}
|
66
|
-
|
67
|
-
var stream = 1 === fd ? process.stdout :
|
68
|
-
2 === fd ? process.stderr :
|
69
|
-
createWritableStdioStream(fd);
|
70
|
-
|
71
|
-
/**
|
72
|
-
* Is stdout a TTY? Colored output is enabled when `true`.
|
73
|
-
*/
|
74
|
-
|
75
|
-
function useColors() {
|
76
|
-
return 'colors' in exports.inspectOpts
|
77
|
-
? Boolean(exports.inspectOpts.colors)
|
78
|
-
: tty.isatty(fd);
|
79
|
-
}
|
80
|
-
|
81
|
-
/**
|
82
|
-
* Map %o to `util.inspect()`, all on a single line.
|
83
|
-
*/
|
84
|
-
|
85
|
-
exports.formatters.o = function(v) {
|
86
|
-
this.inspectOpts.colors = this.useColors;
|
87
|
-
return util.inspect(v, this.inspectOpts)
|
88
|
-
.split('\n').map(function(str) {
|
89
|
-
return str.trim()
|
90
|
-
}).join(' ');
|
91
|
-
};
|
92
|
-
|
93
|
-
/**
|
94
|
-
* Map %o to `util.inspect()`, allowing multiple lines if needed.
|
95
|
-
*/
|
96
|
-
|
97
|
-
exports.formatters.O = function(v) {
|
98
|
-
this.inspectOpts.colors = this.useColors;
|
99
|
-
return util.inspect(v, this.inspectOpts);
|
100
|
-
};
|
101
|
-
|
102
|
-
/**
|
103
|
-
* Adds ANSI color escape codes if enabled.
|
104
|
-
*
|
105
|
-
* @api public
|
106
|
-
*/
|
107
|
-
|
108
|
-
function formatArgs(args) {
|
109
|
-
var name = this.namespace;
|
110
|
-
var useColors = this.useColors;
|
111
|
-
|
112
|
-
if (useColors) {
|
113
|
-
var c = this.color;
|
114
|
-
var prefix = ' \u001b[3' + c + ';1m' + name + ' ' + '\u001b[0m';
|
115
|
-
|
116
|
-
args[0] = prefix + args[0].split('\n').join('\n' + prefix);
|
117
|
-
args.push('\u001b[3' + c + 'm+' + exports.humanize(this.diff) + '\u001b[0m');
|
118
|
-
} else {
|
119
|
-
args[0] = new Date().toUTCString()
|
120
|
-
+ ' ' + name + ' ' + args[0];
|
121
|
-
}
|
122
|
-
}
|
123
|
-
|
124
|
-
/**
|
125
|
-
* Invokes `util.format()` with the specified arguments and writes to `stream`.
|
126
|
-
*/
|
127
|
-
|
128
|
-
function log() {
|
129
|
-
return stream.write(util.format.apply(util, arguments) + '\n');
|
130
|
-
}
|
131
|
-
|
132
|
-
/**
|
133
|
-
* Save `namespaces`.
|
134
|
-
*
|
135
|
-
* @param {String} namespaces
|
136
|
-
* @api private
|
137
|
-
*/
|
138
|
-
|
139
|
-
function save(namespaces) {
|
140
|
-
if (null == namespaces) {
|
141
|
-
// If you set a process.env field to null or undefined, it gets cast to the
|
142
|
-
// string 'null' or 'undefined'. Just delete instead.
|
143
|
-
delete process.env.DEBUG;
|
144
|
-
} else {
|
145
|
-
process.env.DEBUG = namespaces;
|
146
|
-
}
|
147
|
-
}
|
148
|
-
|
149
|
-
/**
|
150
|
-
* Load `namespaces`.
|
151
|
-
*
|
152
|
-
* @return {String} returns the previously persisted debug modes
|
153
|
-
* @api private
|
154
|
-
*/
|
155
|
-
|
156
|
-
function load() {
|
157
|
-
return process.env.DEBUG;
|
158
|
-
}
|
159
|
-
|
160
|
-
/**
|
161
|
-
* Copied from `node/src/node.js`.
|
162
|
-
*
|
163
|
-
* XXX: It's lame that node doesn't expose this API out-of-the-box. It also
|
164
|
-
* relies on the undocumented `tty_wrap.guessHandleType()` which is also lame.
|
165
|
-
*/
|
166
|
-
|
167
|
-
function createWritableStdioStream (fd) {
|
168
|
-
var stream;
|
169
|
-
var tty_wrap = process.binding('tty_wrap');
|
170
|
-
|
171
|
-
// Note stream._type is used for test-module-load-list.js
|
172
|
-
|
173
|
-
switch (tty_wrap.guessHandleType(fd)) {
|
174
|
-
case 'TTY':
|
175
|
-
stream = new tty.WriteStream(fd);
|
176
|
-
stream._type = 'tty';
|
177
|
-
|
178
|
-
// Hack to have stream not keep the event loop alive.
|
179
|
-
// See https://github.com/joyent/node/issues/1726
|
180
|
-
if (stream._handle && stream._handle.unref) {
|
181
|
-
stream._handle.unref();
|
182
|
-
}
|
183
|
-
break;
|
184
|
-
|
185
|
-
case 'FILE':
|
186
|
-
var fs = require('fs');
|
187
|
-
stream = new fs.SyncWriteStream(fd, { autoClose: false });
|
188
|
-
stream._type = 'fs';
|
189
|
-
break;
|
190
|
-
|
191
|
-
case 'PIPE':
|
192
|
-
case 'TCP':
|
193
|
-
var net = require('net');
|
194
|
-
stream = new net.Socket({
|
195
|
-
fd: fd,
|
196
|
-
readable: false,
|
197
|
-
writable: true
|
198
|
-
});
|
199
|
-
|
200
|
-
// FIXME Should probably have an option in net.Socket to create a
|
201
|
-
// stream from an existing fd which is writable only. But for now
|
202
|
-
// we'll just add this hack and set the `readable` member to false.
|
203
|
-
// Test: ./node test/fixtures/echo.js < /etc/passwd
|
204
|
-
stream.readable = false;
|
205
|
-
stream.read = null;
|
206
|
-
stream._type = 'pipe';
|
207
|
-
|
208
|
-
// FIXME Hack to have stream not keep the event loop alive.
|
209
|
-
// See https://github.com/joyent/node/issues/1726
|
210
|
-
if (stream._handle && stream._handle.unref) {
|
211
|
-
stream._handle.unref();
|
212
|
-
}
|
213
|
-
break;
|
214
|
-
|
215
|
-
default:
|
216
|
-
// Probably an error on in uv_guess_handle()
|
217
|
-
throw new Error('Implement me. Unknown stream file type!');
|
218
|
-
}
|
219
|
-
|
220
|
-
// For supporting legacy API we put the FD here.
|
221
|
-
stream.fd = fd;
|
222
|
-
|
223
|
-
stream._isStdio = true;
|
224
|
-
|
225
|
-
return stream;
|
226
|
-
}
|
227
|
-
|
228
|
-
/**
|
229
|
-
* Init logic for `debug` instances.
|
230
|
-
*
|
231
|
-
* Create a new `inspectOpts` object in case `useColors` is set
|
232
|
-
* differently for a particular `debug` instance.
|
233
|
-
*/
|
234
|
-
|
235
|
-
function init (debug) {
|
236
|
-
debug.inspectOpts = {};
|
237
|
-
|
238
|
-
var keys = Object.keys(exports.inspectOpts);
|
239
|
-
for (var i = 0; i < keys.length; i++) {
|
240
|
-
debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
|
241
|
-
}
|
242
|
-
}
|
243
|
-
|
244
|
-
/**
|
245
|
-
* Enable namespaces listed in `process.env.DEBUG` initially.
|
246
|
-
*/
|
247
|
-
|
248
|
-
exports.enable(load());
|
@@ -1,152 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Helpers.
|
3
|
-
*/
|
4
|
-
|
5
|
-
var s = 1000;
|
6
|
-
var m = s * 60;
|
7
|
-
var h = m * 60;
|
8
|
-
var d = h * 24;
|
9
|
-
var y = d * 365.25;
|
10
|
-
|
11
|
-
/**
|
12
|
-
* Parse or format the given `val`.
|
13
|
-
*
|
14
|
-
* Options:
|
15
|
-
*
|
16
|
-
* - `long` verbose formatting [false]
|
17
|
-
*
|
18
|
-
* @param {String|Number} val
|
19
|
-
* @param {Object} [options]
|
20
|
-
* @throws {Error} throw an error if val is not a non-empty string or a number
|
21
|
-
* @return {String|Number}
|
22
|
-
* @api public
|
23
|
-
*/
|
24
|
-
|
25
|
-
module.exports = function(val, options) {
|
26
|
-
options = options || {};
|
27
|
-
var type = typeof val;
|
28
|
-
if (type === 'string' && val.length > 0) {
|
29
|
-
return parse(val);
|
30
|
-
} else if (type === 'number' && isNaN(val) === false) {
|
31
|
-
return options.long ? fmtLong(val) : fmtShort(val);
|
32
|
-
}
|
33
|
-
throw new Error(
|
34
|
-
'val is not a non-empty string or a valid number. val=' +
|
35
|
-
JSON.stringify(val)
|
36
|
-
);
|
37
|
-
};
|
38
|
-
|
39
|
-
/**
|
40
|
-
* Parse the given `str` and return milliseconds.
|
41
|
-
*
|
42
|
-
* @param {String} str
|
43
|
-
* @return {Number}
|
44
|
-
* @api private
|
45
|
-
*/
|
46
|
-
|
47
|
-
function parse(str) {
|
48
|
-
str = String(str);
|
49
|
-
if (str.length > 100) {
|
50
|
-
return;
|
51
|
-
}
|
52
|
-
var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(
|
53
|
-
str
|
54
|
-
);
|
55
|
-
if (!match) {
|
56
|
-
return;
|
57
|
-
}
|
58
|
-
var n = parseFloat(match[1]);
|
59
|
-
var type = (match[2] || 'ms').toLowerCase();
|
60
|
-
switch (type) {
|
61
|
-
case 'years':
|
62
|
-
case 'year':
|
63
|
-
case 'yrs':
|
64
|
-
case 'yr':
|
65
|
-
case 'y':
|
66
|
-
return n * y;
|
67
|
-
case 'days':
|
68
|
-
case 'day':
|
69
|
-
case 'd':
|
70
|
-
return n * d;
|
71
|
-
case 'hours':
|
72
|
-
case 'hour':
|
73
|
-
case 'hrs':
|
74
|
-
case 'hr':
|
75
|
-
case 'h':
|
76
|
-
return n * h;
|
77
|
-
case 'minutes':
|
78
|
-
case 'minute':
|
79
|
-
case 'mins':
|
80
|
-
case 'min':
|
81
|
-
case 'm':
|
82
|
-
return n * m;
|
83
|
-
case 'seconds':
|
84
|
-
case 'second':
|
85
|
-
case 'secs':
|
86
|
-
case 'sec':
|
87
|
-
case 's':
|
88
|
-
return n * s;
|
89
|
-
case 'milliseconds':
|
90
|
-
case 'millisecond':
|
91
|
-
case 'msecs':
|
92
|
-
case 'msec':
|
93
|
-
case 'ms':
|
94
|
-
return n;
|
95
|
-
default:
|
96
|
-
return undefined;
|
97
|
-
}
|
98
|
-
}
|
99
|
-
|
100
|
-
/**
|
101
|
-
* Short format for `ms`.
|
102
|
-
*
|
103
|
-
* @param {Number} ms
|
104
|
-
* @return {String}
|
105
|
-
* @api private
|
106
|
-
*/
|
107
|
-
|
108
|
-
function fmtShort(ms) {
|
109
|
-
if (ms >= d) {
|
110
|
-
return Math.round(ms / d) + 'd';
|
111
|
-
}
|
112
|
-
if (ms >= h) {
|
113
|
-
return Math.round(ms / h) + 'h';
|
114
|
-
}
|
115
|
-
if (ms >= m) {
|
116
|
-
return Math.round(ms / m) + 'm';
|
117
|
-
}
|
118
|
-
if (ms >= s) {
|
119
|
-
return Math.round(ms / s) + 's';
|
120
|
-
}
|
121
|
-
return ms + 'ms';
|
122
|
-
}
|
123
|
-
|
124
|
-
/**
|
125
|
-
* Long format for `ms`.
|
126
|
-
*
|
127
|
-
* @param {Number} ms
|
128
|
-
* @return {String}
|
129
|
-
* @api private
|
130
|
-
*/
|
131
|
-
|
132
|
-
function fmtLong(ms) {
|
133
|
-
return plural(ms, d, 'day') ||
|
134
|
-
plural(ms, h, 'hour') ||
|
135
|
-
plural(ms, m, 'minute') ||
|
136
|
-
plural(ms, s, 'second') ||
|
137
|
-
ms + ' ms';
|
138
|
-
}
|
139
|
-
|
140
|
-
/**
|
141
|
-
* Pluralization helper.
|
142
|
-
*/
|
143
|
-
|
144
|
-
function plural(ms, n, name) {
|
145
|
-
if (ms < n) {
|
146
|
-
return;
|
147
|
-
}
|
148
|
-
if (ms < n * 1.5) {
|
149
|
-
return Math.floor(ms / n) + ' ' + name;
|
150
|
-
}
|
151
|
-
return Math.ceil(ms / n) + ' ' + name + 's';
|
152
|
-
}
|
@@ -1,21 +0,0 @@
|
|
1
|
-
The MIT License (MIT)
|
2
|
-
|
3
|
-
Copyright (c) 2016 Zeit, Inc.
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
13
|
-
copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
-
SOFTWARE.
|