fsevents 1.2.3 → 1.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of fsevents might be problematic. Click here for more details.
- package/.travis.yml +1 -3
- package/fsevents.cc +6 -15
- package/node_modules/abbrev/package.json +13 -14
- package/node_modules/ansi-regex/package.json +13 -14
- package/node_modules/aproba/package.json +13 -14
- package/node_modules/are-we-there-yet/CHANGES.md +6 -0
- package/node_modules/are-we-there-yet/package.json +19 -20
- package/node_modules/are-we-there-yet/tracker-stream.js +1 -0
- package/node_modules/balanced-match/package.json +13 -14
- package/node_modules/brace-expansion/package.json +13 -14
- package/node_modules/chownr/chownr.js +74 -38
- package/node_modules/chownr/package.json +22 -20
- package/node_modules/code-point-at/package.json +13 -14
- package/node_modules/concat-map/package.json +8 -9
- package/node_modules/console-control-strings/package.json +14 -14
- package/node_modules/core-util-is/package.json +13 -14
- package/node_modules/debug/CHANGELOG.md +34 -1
- package/node_modules/debug/README.md +206 -63
- package/node_modules/debug/dist/debug.js +912 -0
- package/node_modules/debug/package.json +46 -33
- package/node_modules/debug/src/browser.js +185 -106
- package/node_modules/debug/src/common.js +266 -0
- package/node_modules/debug/src/index.js +4 -4
- package/node_modules/debug/src/node.js +174 -165
- package/node_modules/deep-extend/CHANGELOG.md +28 -3
- package/node_modules/deep-extend/LICENSE +1 -1
- package/node_modules/deep-extend/README.md +2 -1
- package/node_modules/deep-extend/lib/deep-extend.js +11 -5
- package/node_modules/deep-extend/package.json +26 -28
- package/node_modules/delegates/package.json +13 -14
- package/node_modules/detect-libc/package.json +13 -14
- package/node_modules/fs-minipass/package.json +13 -14
- package/node_modules/fs.realpath/package.json +13 -14
- package/node_modules/gauge/package.json +13 -14
- package/node_modules/glob/package.json +18 -19
- package/node_modules/has-unicode/package.json +13 -14
- package/node_modules/iconv-lite/Changelog.md +16 -0
- package/node_modules/iconv-lite/encodings/sbcs-codec.js +2 -2
- package/node_modules/iconv-lite/encodings/sbcs-data.js +5 -0
- package/node_modules/iconv-lite/lib/extend-node.js +1 -1
- package/node_modules/iconv-lite/lib/index.d.ts +2 -2
- package/node_modules/iconv-lite/package.json +19 -20
- package/node_modules/ignore-walk/package.json +13 -14
- package/node_modules/inflight/package.json +13 -14
- package/node_modules/inherits/package.json +14 -14
- package/node_modules/ini/package.json +13 -14
- package/node_modules/is-fullwidth-code-point/package.json +13 -14
- package/node_modules/isarray/package.json +13 -14
- package/node_modules/minimatch/package.json +14 -14
- package/node_modules/minimist/package.json +8 -9
- package/node_modules/minipass/LICENSE +15 -0
- package/node_modules/minipass/README.md +81 -3
- package/node_modules/minipass/index.js +77 -6
- package/node_modules/minipass/package.json +21 -20
- package/node_modules/minizlib/index.js +66 -95
- package/node_modules/minizlib/package.json +18 -19
- package/node_modules/mkdirp/package.json +14 -14
- package/node_modules/ms/index.js +28 -18
- package/node_modules/ms/package.json +22 -23
- package/node_modules/ms/readme.md +17 -8
- package/node_modules/needle/.npmignore +6 -0
- package/node_modules/needle/README.md +3 -3
- package/node_modules/needle/examples/multipart-stream.js +1 -1
- package/node_modules/needle/lib/auth.js +1 -1
- package/node_modules/needle/lib/cookies.js +12 -10
- package/node_modules/needle/lib/multipart.js +1 -1
- package/node_modules/needle/lib/needle.js +18 -6
- package/node_modules/needle/package-lock.json +395 -0
- package/node_modules/needle/package.json +26 -27
- package/node_modules/needle/test/basic_auth_spec.js +1 -1
- package/node_modules/needle/test/cookies_spec.js +2 -2
- package/node_modules/needle/test/errors_spec.js +4 -4
- package/node_modules/needle/test/keys/ssl.cert +21 -0
- package/node_modules/needle/test/keys/ssl.key +27 -0
- package/node_modules/needle/test/long_string_spec.js +1 -1
- package/node_modules/needle/test/output_spec.js +1 -1
- package/node_modules/needle/test/post_data_spec.js +20 -20
- package/node_modules/needle/test/proxy_spec.js +1 -1
- package/node_modules/needle/test/url_spec.js +11 -3
- package/node_modules/needle/test/utils/test.js +1 -1
- package/node_modules/node-pre-gyp/CHANGELOG.md +34 -3
- package/node_modules/node-pre-gyp/README.md +53 -21
- package/node_modules/node-pre-gyp/appveyor.yml +2 -9
- package/node_modules/node-pre-gyp/contributing.md +2 -2
- package/node_modules/node-pre-gyp/lib/build.js +1 -1
- package/node_modules/node-pre-gyp/lib/install.js +46 -12
- package/node_modules/node-pre-gyp/lib/node-pre-gyp.js +1 -1
- package/node_modules/node-pre-gyp/lib/package.js +5 -2
- package/node_modules/node-pre-gyp/lib/pre-binding.js +5 -5
- package/node_modules/node-pre-gyp/lib/rebuild.js +1 -1
- package/node_modules/node-pre-gyp/lib/reinstall.js +1 -1
- package/node_modules/node-pre-gyp/lib/util/abi_crosswalk.json +148 -0
- package/node_modules/node-pre-gyp/lib/util/handle_gyp_opts.js +5 -2
- package/node_modules/node-pre-gyp/lib/util/napi.js +70 -22
- package/node_modules/node-pre-gyp/lib/util/versioning.js +7 -6
- package/node_modules/node-pre-gyp/package.json +16 -19
- package/node_modules/nopt/package.json +13 -14
- package/node_modules/npm-bundled/LICENSE +15 -0
- package/node_modules/npm-bundled/README.md +2 -0
- package/node_modules/npm-bundled/index.js +16 -2
- package/node_modules/npm-bundled/package.json +18 -19
- package/node_modules/npm-packlist/index.js +43 -13
- package/node_modules/npm-packlist/package.json +18 -19
- package/node_modules/npmlog/package.json +13 -14
- package/node_modules/number-is-nan/package.json +13 -14
- package/node_modules/object-assign/package.json +13 -14
- package/node_modules/once/package.json +14 -14
- package/node_modules/os-homedir/package.json +13 -14
- package/node_modules/os-tmpdir/package.json +13 -14
- package/node_modules/osenv/package.json +13 -14
- package/node_modules/path-is-absolute/package.json +13 -14
- package/node_modules/process-nextick-args/package.json +13 -14
- package/node_modules/rc/node_modules/minimist/package.json +13 -14
- package/node_modules/rc/package.json +18 -19
- package/node_modules/readable-stream/package.json +13 -14
- package/node_modules/rimraf/package.json +22 -20
- package/node_modules/safe-buffer/index.d.ts +187 -0
- package/node_modules/safe-buffer/package.json +23 -21
- package/node_modules/safer-buffer/package.json +13 -14
- package/node_modules/sax/package.json +13 -14
- package/node_modules/semver/CHANGELOG.md +39 -0
- package/node_modules/semver/README.md +31 -8
- package/node_modules/semver/bin/semver +92 -75
- package/node_modules/semver/package.json +25 -20
- package/node_modules/semver/semver.js +922 -763
- package/node_modules/set-blocking/package.json +13 -14
- package/node_modules/signal-exit/package.json +13 -14
- package/node_modules/string-width/package.json +14 -14
- package/node_modules/string_decoder/package.json +13 -14
- package/node_modules/strip-ansi/package.json +14 -14
- package/node_modules/strip-json-comments/package.json +13 -14
- package/node_modules/tar/README.md +7 -2
- package/node_modules/tar/lib/header.js +20 -4
- package/node_modules/tar/lib/mode-fix.js +14 -0
- package/node_modules/tar/lib/pack.js +1 -0
- package/node_modules/tar/lib/parse.js +2 -1
- package/node_modules/tar/lib/unpack.js +67 -6
- package/node_modules/tar/lib/write-entry.js +25 -6
- package/node_modules/tar/package.json +25 -26
- package/node_modules/util-deprecate/package.json +13 -14
- package/node_modules/wide-align/package.json +19 -20
- package/node_modules/wrappy/package.json +14 -14
- package/node_modules/yallist/iterator.js +5 -5
- package/node_modules/yallist/package.json +19 -19
- package/node_modules/yallist/yallist.js +2 -2
- package/package.json +6 -9
- package/src/async.cc +2 -2
- package/src/thread.cc +5 -6
- package/.npmignore +0 -1
- package/build/.target.mk +0 -53
- package/build/Makefile +0 -352
- package/build/Release/.deps/Release/.node.d +0 -1
- package/build/Release/.deps/Release/fse.node.d +0 -1
- package/build/Release/.deps/Release/obj.target/action_after_build.stamp.d +0 -1
- package/build/Release/.deps/Release/obj.target/fse/fsevents.o.d +0 -65
- package/build/Release/.deps/Users/eshanker/Code/fsevents/lib/binding/Release/node-v48-darwin-x64/fse.node.d +0 -1
- package/build/Release/.node +0 -0
- package/build/Release/fse.node +0 -0
- package/build/Release/obj.target/action_after_build.stamp +0 -0
- package/build/Release/obj.target/fse/fsevents.o +0 -0
- package/build/action_after_build.target.mk +0 -32
- package/build/binding.Makefile +0 -6
- package/build/fse.target.mk +0 -179
- package/build/gyp-mac-tool +0 -611
- package/build/stage/v1.1.2/fse-v1.1.2-node-v48-darwin-x64.tar.gz +0 -0
- package/lib/binding/Release/node-v11-darwin-x64/fse.node +0 -0
- package/lib/binding/Release/node-v46-darwin-x64/fse.node +0 -0
- package/lib/binding/Release/node-v47-darwin-x64/fse.node +0 -0
- package/lib/binding/Release/node-v48-darwin-x64/fse.node +0 -0
- package/lib/binding/Release/node-v57-darwin-x64/fse.node +0 -0
- package/node_modules/are-we-there-yet/CHANGES.md~ +0 -27
- package/node_modules/debug/.coveralls.yml +0 -1
- package/node_modules/debug/.eslintrc +0 -11
- package/node_modules/debug/.npmignore +0 -9
- package/node_modules/debug/.travis.yml +0 -14
- package/node_modules/debug/Makefile +0 -50
- package/node_modules/debug/component.json +0 -19
- package/node_modules/debug/karma.conf.js +0 -70
- package/node_modules/debug/node.js +0 -1
- package/node_modules/debug/src/debug.js +0 -202
- package/node_modules/debug/src/inspector-log.js +0 -15
- package/node_modules/iconv-lite/.travis.yml +0 -23
- package/node_modules/rc/.npmignore +0 -3
- package/node_modules/safe-buffer/.travis.yml +0 -7
- package/node_modules/safe-buffer/test.js +0 -101
- package/src/locking.cc +0 -27
@@ -0,0 +1,266 @@
|
|
1
|
+
|
2
|
+
/**
|
3
|
+
* This is the common logic for both the Node.js and web browser
|
4
|
+
* implementations of `debug()`.
|
5
|
+
*/
|
6
|
+
|
7
|
+
function setup(env) {
|
8
|
+
createDebug.debug = createDebug;
|
9
|
+
createDebug.default = createDebug;
|
10
|
+
createDebug.coerce = coerce;
|
11
|
+
createDebug.disable = disable;
|
12
|
+
createDebug.enable = enable;
|
13
|
+
createDebug.enabled = enabled;
|
14
|
+
createDebug.humanize = require('ms');
|
15
|
+
|
16
|
+
Object.keys(env).forEach(key => {
|
17
|
+
createDebug[key] = env[key];
|
18
|
+
});
|
19
|
+
|
20
|
+
/**
|
21
|
+
* Active `debug` instances.
|
22
|
+
*/
|
23
|
+
createDebug.instances = [];
|
24
|
+
|
25
|
+
/**
|
26
|
+
* The currently active debug mode names, and names to skip.
|
27
|
+
*/
|
28
|
+
|
29
|
+
createDebug.names = [];
|
30
|
+
createDebug.skips = [];
|
31
|
+
|
32
|
+
/**
|
33
|
+
* Map of special "%n" handling functions, for the debug "format" argument.
|
34
|
+
*
|
35
|
+
* Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
|
36
|
+
*/
|
37
|
+
createDebug.formatters = {};
|
38
|
+
|
39
|
+
/**
|
40
|
+
* Selects a color for a debug namespace
|
41
|
+
* @param {String} namespace The namespace string for the for the debug instance to be colored
|
42
|
+
* @return {Number|String} An ANSI color code for the given namespace
|
43
|
+
* @api private
|
44
|
+
*/
|
45
|
+
function selectColor(namespace) {
|
46
|
+
let hash = 0;
|
47
|
+
|
48
|
+
for (let i = 0; i < namespace.length; i++) {
|
49
|
+
hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
|
50
|
+
hash |= 0; // Convert to 32bit integer
|
51
|
+
}
|
52
|
+
|
53
|
+
return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
|
54
|
+
}
|
55
|
+
createDebug.selectColor = selectColor;
|
56
|
+
|
57
|
+
/**
|
58
|
+
* Create a debugger with the given `namespace`.
|
59
|
+
*
|
60
|
+
* @param {String} namespace
|
61
|
+
* @return {Function}
|
62
|
+
* @api public
|
63
|
+
*/
|
64
|
+
function createDebug(namespace) {
|
65
|
+
let prevTime;
|
66
|
+
|
67
|
+
function debug(...args) {
|
68
|
+
// Disabled?
|
69
|
+
if (!debug.enabled) {
|
70
|
+
return;
|
71
|
+
}
|
72
|
+
|
73
|
+
const self = debug;
|
74
|
+
|
75
|
+
// Set `diff` timestamp
|
76
|
+
const curr = Number(new Date());
|
77
|
+
const ms = curr - (prevTime || curr);
|
78
|
+
self.diff = ms;
|
79
|
+
self.prev = prevTime;
|
80
|
+
self.curr = curr;
|
81
|
+
prevTime = curr;
|
82
|
+
|
83
|
+
args[0] = createDebug.coerce(args[0]);
|
84
|
+
|
85
|
+
if (typeof args[0] !== 'string') {
|
86
|
+
// Anything else let's inspect with %O
|
87
|
+
args.unshift('%O');
|
88
|
+
}
|
89
|
+
|
90
|
+
// Apply any `formatters` transformations
|
91
|
+
let index = 0;
|
92
|
+
args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
|
93
|
+
// If we encounter an escaped % then don't increase the array index
|
94
|
+
if (match === '%%') {
|
95
|
+
return match;
|
96
|
+
}
|
97
|
+
index++;
|
98
|
+
const formatter = createDebug.formatters[format];
|
99
|
+
if (typeof formatter === 'function') {
|
100
|
+
const val = args[index];
|
101
|
+
match = formatter.call(self, val);
|
102
|
+
|
103
|
+
// Now we need to remove `args[index]` since it's inlined in the `format`
|
104
|
+
args.splice(index, 1);
|
105
|
+
index--;
|
106
|
+
}
|
107
|
+
return match;
|
108
|
+
});
|
109
|
+
|
110
|
+
// Apply env-specific formatting (colors, etc.)
|
111
|
+
createDebug.formatArgs.call(self, args);
|
112
|
+
|
113
|
+
const logFn = self.log || createDebug.log;
|
114
|
+
logFn.apply(self, args);
|
115
|
+
}
|
116
|
+
|
117
|
+
debug.namespace = namespace;
|
118
|
+
debug.enabled = createDebug.enabled(namespace);
|
119
|
+
debug.useColors = createDebug.useColors();
|
120
|
+
debug.color = selectColor(namespace);
|
121
|
+
debug.destroy = destroy;
|
122
|
+
debug.extend = extend;
|
123
|
+
// Debug.formatArgs = formatArgs;
|
124
|
+
// debug.rawLog = rawLog;
|
125
|
+
|
126
|
+
// env-specific initialization logic for debug instances
|
127
|
+
if (typeof createDebug.init === 'function') {
|
128
|
+
createDebug.init(debug);
|
129
|
+
}
|
130
|
+
|
131
|
+
createDebug.instances.push(debug);
|
132
|
+
|
133
|
+
return debug;
|
134
|
+
}
|
135
|
+
|
136
|
+
function destroy() {
|
137
|
+
const index = createDebug.instances.indexOf(this);
|
138
|
+
if (index !== -1) {
|
139
|
+
createDebug.instances.splice(index, 1);
|
140
|
+
return true;
|
141
|
+
}
|
142
|
+
return false;
|
143
|
+
}
|
144
|
+
|
145
|
+
function extend(namespace, delimiter) {
|
146
|
+
const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
|
147
|
+
newDebug.log = this.log;
|
148
|
+
return newDebug;
|
149
|
+
}
|
150
|
+
|
151
|
+
/**
|
152
|
+
* Enables a debug mode by namespaces. This can include modes
|
153
|
+
* separated by a colon and wildcards.
|
154
|
+
*
|
155
|
+
* @param {String} namespaces
|
156
|
+
* @api public
|
157
|
+
*/
|
158
|
+
function enable(namespaces) {
|
159
|
+
createDebug.save(namespaces);
|
160
|
+
|
161
|
+
createDebug.names = [];
|
162
|
+
createDebug.skips = [];
|
163
|
+
|
164
|
+
let i;
|
165
|
+
const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
|
166
|
+
const len = split.length;
|
167
|
+
|
168
|
+
for (i = 0; i < len; i++) {
|
169
|
+
if (!split[i]) {
|
170
|
+
// ignore empty strings
|
171
|
+
continue;
|
172
|
+
}
|
173
|
+
|
174
|
+
namespaces = split[i].replace(/\*/g, '.*?');
|
175
|
+
|
176
|
+
if (namespaces[0] === '-') {
|
177
|
+
createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
|
178
|
+
} else {
|
179
|
+
createDebug.names.push(new RegExp('^' + namespaces + '$'));
|
180
|
+
}
|
181
|
+
}
|
182
|
+
|
183
|
+
for (i = 0; i < createDebug.instances.length; i++) {
|
184
|
+
const instance = createDebug.instances[i];
|
185
|
+
instance.enabled = createDebug.enabled(instance.namespace);
|
186
|
+
}
|
187
|
+
}
|
188
|
+
|
189
|
+
/**
|
190
|
+
* Disable debug output.
|
191
|
+
*
|
192
|
+
* @return {String} namespaces
|
193
|
+
* @api public
|
194
|
+
*/
|
195
|
+
function disable() {
|
196
|
+
const namespaces = [
|
197
|
+
...createDebug.names.map(toNamespace),
|
198
|
+
...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)
|
199
|
+
].join(',');
|
200
|
+
createDebug.enable('');
|
201
|
+
return namespaces;
|
202
|
+
}
|
203
|
+
|
204
|
+
/**
|
205
|
+
* Returns true if the given mode name is enabled, false otherwise.
|
206
|
+
*
|
207
|
+
* @param {String} name
|
208
|
+
* @return {Boolean}
|
209
|
+
* @api public
|
210
|
+
*/
|
211
|
+
function enabled(name) {
|
212
|
+
if (name[name.length - 1] === '*') {
|
213
|
+
return true;
|
214
|
+
}
|
215
|
+
|
216
|
+
let i;
|
217
|
+
let len;
|
218
|
+
|
219
|
+
for (i = 0, len = createDebug.skips.length; i < len; i++) {
|
220
|
+
if (createDebug.skips[i].test(name)) {
|
221
|
+
return false;
|
222
|
+
}
|
223
|
+
}
|
224
|
+
|
225
|
+
for (i = 0, len = createDebug.names.length; i < len; i++) {
|
226
|
+
if (createDebug.names[i].test(name)) {
|
227
|
+
return true;
|
228
|
+
}
|
229
|
+
}
|
230
|
+
|
231
|
+
return false;
|
232
|
+
}
|
233
|
+
|
234
|
+
/**
|
235
|
+
* Convert regexp to namespace
|
236
|
+
*
|
237
|
+
* @param {RegExp} regxep
|
238
|
+
* @return {String} namespace
|
239
|
+
* @api private
|
240
|
+
*/
|
241
|
+
function toNamespace(regexp) {
|
242
|
+
return regexp.toString()
|
243
|
+
.substring(2, regexp.toString().length - 2)
|
244
|
+
.replace(/\.\*\?$/, '*');
|
245
|
+
}
|
246
|
+
|
247
|
+
/**
|
248
|
+
* Coerce `val`.
|
249
|
+
*
|
250
|
+
* @param {Mixed} val
|
251
|
+
* @return {Mixed}
|
252
|
+
* @api private
|
253
|
+
*/
|
254
|
+
function coerce(val) {
|
255
|
+
if (val instanceof Error) {
|
256
|
+
return val.stack || val.message;
|
257
|
+
}
|
258
|
+
return val;
|
259
|
+
}
|
260
|
+
|
261
|
+
createDebug.enable(createDebug.load());
|
262
|
+
|
263
|
+
return createDebug;
|
264
|
+
}
|
265
|
+
|
266
|
+
module.exports = setup;
|
@@ -1,10 +1,10 @@
|
|
1
1
|
/**
|
2
|
-
* Detect Electron renderer process, which is node, but we should
|
2
|
+
* Detect Electron renderer / nwjs process, which is node, but we should
|
3
3
|
* treat as a browser.
|
4
4
|
*/
|
5
5
|
|
6
|
-
if (typeof process
|
7
|
-
|
6
|
+
if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
|
7
|
+
module.exports = require('./browser.js');
|
8
8
|
} else {
|
9
|
-
|
9
|
+
module.exports = require('./node.js');
|
10
10
|
}
|
@@ -2,16 +2,13 @@
|
|
2
2
|
* Module dependencies.
|
3
3
|
*/
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
const tty = require('tty');
|
6
|
+
const util = require('util');
|
7
7
|
|
8
8
|
/**
|
9
9
|
* This is the Node.js implementation of `debug()`.
|
10
|
-
*
|
11
|
-
* Expose `debug()` as the module.
|
12
10
|
*/
|
13
11
|
|
14
|
-
exports = module.exports = require('./debug');
|
15
12
|
exports.init = init;
|
16
13
|
exports.log = log;
|
17
14
|
exports.formatArgs = formatArgs;
|
@@ -25,80 +22,138 @@ exports.useColors = useColors;
|
|
25
22
|
|
26
23
|
exports.colors = [6, 2, 3, 4, 5, 1];
|
27
24
|
|
25
|
+
try {
|
26
|
+
// Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json)
|
27
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
28
|
+
const supportsColor = require('supports-color');
|
29
|
+
|
30
|
+
if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
|
31
|
+
exports.colors = [
|
32
|
+
20,
|
33
|
+
21,
|
34
|
+
26,
|
35
|
+
27,
|
36
|
+
32,
|
37
|
+
33,
|
38
|
+
38,
|
39
|
+
39,
|
40
|
+
40,
|
41
|
+
41,
|
42
|
+
42,
|
43
|
+
43,
|
44
|
+
44,
|
45
|
+
45,
|
46
|
+
56,
|
47
|
+
57,
|
48
|
+
62,
|
49
|
+
63,
|
50
|
+
68,
|
51
|
+
69,
|
52
|
+
74,
|
53
|
+
75,
|
54
|
+
76,
|
55
|
+
77,
|
56
|
+
78,
|
57
|
+
79,
|
58
|
+
80,
|
59
|
+
81,
|
60
|
+
92,
|
61
|
+
93,
|
62
|
+
98,
|
63
|
+
99,
|
64
|
+
112,
|
65
|
+
113,
|
66
|
+
128,
|
67
|
+
129,
|
68
|
+
134,
|
69
|
+
135,
|
70
|
+
148,
|
71
|
+
149,
|
72
|
+
160,
|
73
|
+
161,
|
74
|
+
162,
|
75
|
+
163,
|
76
|
+
164,
|
77
|
+
165,
|
78
|
+
166,
|
79
|
+
167,
|
80
|
+
168,
|
81
|
+
169,
|
82
|
+
170,
|
83
|
+
171,
|
84
|
+
172,
|
85
|
+
173,
|
86
|
+
178,
|
87
|
+
179,
|
88
|
+
184,
|
89
|
+
185,
|
90
|
+
196,
|
91
|
+
197,
|
92
|
+
198,
|
93
|
+
199,
|
94
|
+
200,
|
95
|
+
201,
|
96
|
+
202,
|
97
|
+
203,
|
98
|
+
204,
|
99
|
+
205,
|
100
|
+
206,
|
101
|
+
207,
|
102
|
+
208,
|
103
|
+
209,
|
104
|
+
214,
|
105
|
+
215,
|
106
|
+
220,
|
107
|
+
221
|
108
|
+
];
|
109
|
+
}
|
110
|
+
} catch (error) {
|
111
|
+
// Swallow - we only care if `supports-color` is available; it doesn't have to be.
|
112
|
+
}
|
113
|
+
|
28
114
|
/**
|
29
115
|
* Build up the default `inspectOpts` object from the environment variables.
|
30
116
|
*
|
31
117
|
* $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
|
32
118
|
*/
|
33
119
|
|
34
|
-
exports.inspectOpts = Object.keys(process.env).filter(
|
35
|
-
|
36
|
-
}).reduce(
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
120
|
+
exports.inspectOpts = Object.keys(process.env).filter(key => {
|
121
|
+
return /^debug_/i.test(key);
|
122
|
+
}).reduce((obj, key) => {
|
123
|
+
// Camel-case
|
124
|
+
const prop = key
|
125
|
+
.substring(6)
|
126
|
+
.toLowerCase()
|
127
|
+
.replace(/_([a-z])/g, (_, k) => {
|
128
|
+
return k.toUpperCase();
|
129
|
+
});
|
130
|
+
|
131
|
+
// Coerce string value into JS value
|
132
|
+
let val = process.env[key];
|
133
|
+
if (/^(yes|on|true|enabled)$/i.test(val)) {
|
134
|
+
val = true;
|
135
|
+
} else if (/^(no|off|false|disabled)$/i.test(val)) {
|
136
|
+
val = false;
|
137
|
+
} else if (val === 'null') {
|
138
|
+
val = null;
|
139
|
+
} else {
|
140
|
+
val = Number(val);
|
141
|
+
}
|
142
|
+
|
143
|
+
obj[prop] = val;
|
144
|
+
return obj;
|
52
145
|
}, {});
|
53
146
|
|
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
147
|
/**
|
72
148
|
* Is stdout a TTY? Colored output is enabled when `true`.
|
73
149
|
*/
|
74
150
|
|
75
151
|
function useColors() {
|
76
|
-
|
77
|
-
|
78
|
-
|
152
|
+
return 'colors' in exports.inspectOpts ?
|
153
|
+
Boolean(exports.inspectOpts.colors) :
|
154
|
+
tty.isatty(process.stderr.fd);
|
79
155
|
}
|
80
156
|
|
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
157
|
/**
|
103
158
|
* Adds ANSI color escape codes if enabled.
|
104
159
|
*
|
@@ -106,27 +161,33 @@ exports.formatters.O = function(v) {
|
|
106
161
|
*/
|
107
162
|
|
108
163
|
function formatArgs(args) {
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
164
|
+
const {namespace: name, useColors} = this;
|
165
|
+
|
166
|
+
if (useColors) {
|
167
|
+
const c = this.color;
|
168
|
+
const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c);
|
169
|
+
const prefix = ` ${colorCode};1m${name} \u001B[0m`;
|
170
|
+
|
171
|
+
args[0] = prefix + args[0].split('\n').join('\n' + prefix);
|
172
|
+
args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m');
|
173
|
+
} else {
|
174
|
+
args[0] = getDate() + name + ' ' + args[0];
|
175
|
+
}
|
176
|
+
}
|
177
|
+
|
178
|
+
function getDate() {
|
179
|
+
if (exports.inspectOpts.hideDate) {
|
180
|
+
return '';
|
181
|
+
}
|
182
|
+
return new Date().toISOString() + ' ';
|
122
183
|
}
|
123
184
|
|
124
185
|
/**
|
125
|
-
* Invokes `util.format()` with the specified arguments and writes to
|
186
|
+
* Invokes `util.format()` with the specified arguments and writes to stderr.
|
126
187
|
*/
|
127
188
|
|
128
|
-
function log() {
|
129
|
-
|
189
|
+
function log(...args) {
|
190
|
+
return process.stderr.write(util.format(...args) + '\n');
|
130
191
|
}
|
131
192
|
|
132
193
|
/**
|
@@ -135,15 +196,14 @@ function log() {
|
|
135
196
|
* @param {String} namespaces
|
136
197
|
* @api private
|
137
198
|
*/
|
138
|
-
|
139
199
|
function save(namespaces) {
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
200
|
+
if (namespaces) {
|
201
|
+
process.env.DEBUG = namespaces;
|
202
|
+
} else {
|
203
|
+
// If you set a process.env field to null or undefined, it gets cast to the
|
204
|
+
// string 'null' or 'undefined'. Just delete instead.
|
205
|
+
delete process.env.DEBUG;
|
206
|
+
}
|
147
207
|
}
|
148
208
|
|
149
209
|
/**
|
@@ -154,75 +214,7 @@ function save(namespaces) {
|
|
154
214
|
*/
|
155
215
|
|
156
216
|
function load() {
|
157
|
-
|
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;
|
217
|
+
return process.env.DEBUG;
|
226
218
|
}
|
227
219
|
|
228
220
|
/**
|
@@ -232,17 +224,34 @@ function createWritableStdioStream (fd) {
|
|
232
224
|
* differently for a particular `debug` instance.
|
233
225
|
*/
|
234
226
|
|
235
|
-
function init
|
236
|
-
|
227
|
+
function init(debug) {
|
228
|
+
debug.inspectOpts = {};
|
237
229
|
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
230
|
+
const keys = Object.keys(exports.inspectOpts);
|
231
|
+
for (let i = 0; i < keys.length; i++) {
|
232
|
+
debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
|
233
|
+
}
|
242
234
|
}
|
243
235
|
|
236
|
+
module.exports = require('./common')(exports);
|
237
|
+
|
238
|
+
const {formatters} = module.exports;
|
239
|
+
|
240
|
+
/**
|
241
|
+
* Map %o to `util.inspect()`, all on a single line.
|
242
|
+
*/
|
243
|
+
|
244
|
+
formatters.o = function (v) {
|
245
|
+
this.inspectOpts.colors = this.useColors;
|
246
|
+
return util.inspect(v, this.inspectOpts)
|
247
|
+
.replace(/\s*\n\s*/g, ' ');
|
248
|
+
};
|
249
|
+
|
244
250
|
/**
|
245
|
-
*
|
251
|
+
* Map %O to `util.inspect()`, allowing multiple lines if needed.
|
246
252
|
*/
|
247
253
|
|
248
|
-
|
254
|
+
formatters.O = function (v) {
|
255
|
+
this.inspectOpts.colors = this.useColors;
|
256
|
+
return util.inspect(v, this.inspectOpts);
|
257
|
+
};
|