jiek 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- package/{tests/fixtures/node_modules/.pnpm/@jiek+loader-esbuild@1.0.0_esbuild@0.20.2/node_modules/@jiek/loader-esbuild/LICENSE → LICENSE} +1 -1
- package/package.json +4 -1
- package/src/commands/build.ts +0 -91
- package/src/commands/publish.ts +0 -79
- package/src/index.ts +0 -6
- package/src/inner.ts +0 -11
- package/src/merge-package-json.ts +0 -19
- package/src/rollup/index.ts +0 -162
- package/src/rollup/plugins/globals.ts +0 -34
- package/src/rollup/plugins/skip.ts +0 -23
- package/src/rollup/utils/commonOptions.ts +0 -9
- package/src/rollup/utils/externalResolver.ts +0 -11
- package/src/rollup/utils/globalResolver.ts +0 -24
- package/src/rollup/utils/withMinify.ts +0 -16
- package/tests/build.spec.ts +0 -28
- package/tests/fixtures/node_modules/.bin/jiek +0 -17
- package/tests/fixtures/node_modules/.jiek/jiek+test-foo.rollup.config.js +0 -31
- package/tests/fixtures/node_modules/.modules.yaml +0 -95
- package/tests/fixtures/node_modules/.pnpm/@esbuild+darwin-arm64@0.20.2/node_modules/@esbuild/darwin-arm64/README.md +0 -3
- package/tests/fixtures/node_modules/.pnpm/@esbuild+darwin-arm64@0.20.2/node_modules/@esbuild/darwin-arm64/bin/esbuild +0 -0
- package/tests/fixtures/node_modules/.pnpm/@esbuild+darwin-arm64@0.20.2/node_modules/@esbuild/darwin-arm64/package.json +0 -20
- package/tests/fixtures/node_modules/.pnpm/@jiek+loader-esbuild@1.0.0_esbuild@0.20.2/node_modules/@jiek/loader-esbuild/loader.js +0 -3
- package/tests/fixtures/node_modules/.pnpm/@jiek+loader-esbuild@1.0.0_esbuild@0.20.2/node_modules/@jiek/loader-esbuild/package.json +0 -8
- package/tests/fixtures/node_modules/.pnpm/debug@4.3.4/node_modules/debug/LICENSE +0 -20
- package/tests/fixtures/node_modules/.pnpm/debug@4.3.4/node_modules/debug/README.md +0 -481
- package/tests/fixtures/node_modules/.pnpm/debug@4.3.4/node_modules/debug/package.json +0 -59
- package/tests/fixtures/node_modules/.pnpm/debug@4.3.4/node_modules/debug/src/browser.js +0 -269
- package/tests/fixtures/node_modules/.pnpm/debug@4.3.4/node_modules/debug/src/common.js +0 -274
- package/tests/fixtures/node_modules/.pnpm/debug@4.3.4/node_modules/debug/src/index.js +0 -10
- package/tests/fixtures/node_modules/.pnpm/debug@4.3.4/node_modules/debug/src/node.js +0 -263
- package/tests/fixtures/node_modules/.pnpm/esbuild-register@3.5.0_esbuild@0.20.2/node_modules/esbuild-register/LICENSE +0 -21
- package/tests/fixtures/node_modules/.pnpm/esbuild-register@3.5.0_esbuild@0.20.2/node_modules/esbuild-register/README.md +0 -50
- package/tests/fixtures/node_modules/.pnpm/esbuild-register@3.5.0_esbuild@0.20.2/node_modules/esbuild-register/dist/loader.d.ts +0 -3
- package/tests/fixtures/node_modules/.pnpm/esbuild-register@3.5.0_esbuild@0.20.2/node_modules/esbuild-register/dist/loader.js +0 -15
- package/tests/fixtures/node_modules/.pnpm/esbuild-register@3.5.0_esbuild@0.20.2/node_modules/esbuild-register/dist/node.d.ts +0 -23
- package/tests/fixtures/node_modules/.pnpm/esbuild-register@3.5.0_esbuild@0.20.2/node_modules/esbuild-register/dist/node.js +0 -4926
- package/tests/fixtures/node_modules/.pnpm/esbuild-register@3.5.0_esbuild@0.20.2/node_modules/esbuild-register/loader.js +0 -1
- package/tests/fixtures/node_modules/.pnpm/esbuild-register@3.5.0_esbuild@0.20.2/node_modules/esbuild-register/node_modules/.bin/esbuild +0 -14
- package/tests/fixtures/node_modules/.pnpm/esbuild-register@3.5.0_esbuild@0.20.2/node_modules/esbuild-register/package.json +0 -46
- package/tests/fixtures/node_modules/.pnpm/esbuild-register@3.5.0_esbuild@0.20.2/node_modules/esbuild-register/register.js +0 -3
- package/tests/fixtures/node_modules/.pnpm/esbuild@0.20.2/node_modules/esbuild/LICENSE.md +0 -21
- package/tests/fixtures/node_modules/.pnpm/esbuild@0.20.2/node_modules/esbuild/README.md +0 -3
- package/tests/fixtures/node_modules/.pnpm/esbuild@0.20.2/node_modules/esbuild/bin/esbuild +0 -0
- package/tests/fixtures/node_modules/.pnpm/esbuild@0.20.2/node_modules/esbuild/install.js +0 -288
- package/tests/fixtures/node_modules/.pnpm/esbuild@0.20.2/node_modules/esbuild/lib/main.d.ts +0 -703
- package/tests/fixtures/node_modules/.pnpm/esbuild@0.20.2/node_modules/esbuild/lib/main.js +0 -2436
- package/tests/fixtures/node_modules/.pnpm/esbuild@0.20.2/node_modules/esbuild/node_modules/.bin/esbuild +0 -14
- package/tests/fixtures/node_modules/.pnpm/esbuild@0.20.2/node_modules/esbuild/package.json +0 -46
- package/tests/fixtures/node_modules/.pnpm/lock.yaml +0 -291
- package/tests/fixtures/node_modules/.pnpm/ms@2.1.2/node_modules/ms/index.js +0 -162
- package/tests/fixtures/node_modules/.pnpm/ms@2.1.2/node_modules/ms/license.md +0 -21
- package/tests/fixtures/node_modules/.pnpm/ms@2.1.2/node_modules/ms/package.json +0 -37
- package/tests/fixtures/node_modules/.pnpm/ms@2.1.2/node_modules/ms/readme.md +0 -60
- package/tests/fixtures/node_modules/.pnpm/node_modules/.bin/esbuild +0 -14
- package/tests/fixtures/package.json +0 -8
- package/tests/fixtures/packages/bar/package.json +0 -4
- package/tests/fixtures/packages/foo/dist/index.d.ts +0 -3
- package/tests/fixtures/packages/foo/dist/index.esm.d.ts +0 -3
- package/tests/fixtures/packages/foo/dist/index.esm.js +0 -6
- package/tests/fixtures/packages/foo/dist/index.esm.js.map +0 -1
- package/tests/fixtures/packages/foo/dist/index.esm.min.js +0 -2
- package/tests/fixtures/packages/foo/dist/index.esm.min.js.map +0 -1
- package/tests/fixtures/packages/foo/dist/index.iife.js +0 -15
- package/tests/fixtures/packages/foo/dist/index.iife.js.map +0 -1
- package/tests/fixtures/packages/foo/dist/index.iife.min.js +0 -2
- package/tests/fixtures/packages/foo/dist/index.iife.min.js.map +0 -1
- package/tests/fixtures/packages/foo/dist/index.umd.js +0 -16
- package/tests/fixtures/packages/foo/dist/index.umd.js.map +0 -1
- package/tests/fixtures/packages/foo/dist/index.umd.min.js +0 -2
- package/tests/fixtures/packages/foo/dist/index.umd.min.js.map +0 -1
- package/tests/fixtures/packages/foo/package.json +0 -7
- package/tests/fixtures/packages/foo/src/index.ts +0 -3
- package/tests/fixtures/pnpm-workspace.yaml +0 -2
- package/tests/publish.spec.ts +0 -31
@@ -1,59 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"name": "debug",
|
3
|
-
"version": "4.3.4",
|
4
|
-
"repository": {
|
5
|
-
"type": "git",
|
6
|
-
"url": "git://github.com/debug-js/debug.git"
|
7
|
-
},
|
8
|
-
"description": "Lightweight debugging utility for Node.js and the browser",
|
9
|
-
"keywords": [
|
10
|
-
"debug",
|
11
|
-
"log",
|
12
|
-
"debugger"
|
13
|
-
],
|
14
|
-
"files": [
|
15
|
-
"src",
|
16
|
-
"LICENSE",
|
17
|
-
"README.md"
|
18
|
-
],
|
19
|
-
"author": "Josh Junon <josh.junon@protonmail.com>",
|
20
|
-
"contributors": [
|
21
|
-
"TJ Holowaychuk <tj@vision-media.ca>",
|
22
|
-
"Nathan Rajlich <nathan@tootallnate.net> (http://n8.io)",
|
23
|
-
"Andrew Rhyne <rhyneandrew@gmail.com>"
|
24
|
-
],
|
25
|
-
"license": "MIT",
|
26
|
-
"scripts": {
|
27
|
-
"lint": "xo",
|
28
|
-
"test": "npm run test:node && npm run test:browser && npm run lint",
|
29
|
-
"test:node": "istanbul cover _mocha -- test.js",
|
30
|
-
"test:browser": "karma start --single-run",
|
31
|
-
"test:coverage": "cat ./coverage/lcov.info | coveralls"
|
32
|
-
},
|
33
|
-
"dependencies": {
|
34
|
-
"ms": "2.1.2"
|
35
|
-
},
|
36
|
-
"devDependencies": {
|
37
|
-
"brfs": "^2.0.1",
|
38
|
-
"browserify": "^16.2.3",
|
39
|
-
"coveralls": "^3.0.2",
|
40
|
-
"istanbul": "^0.4.5",
|
41
|
-
"karma": "^3.1.4",
|
42
|
-
"karma-browserify": "^6.0.0",
|
43
|
-
"karma-chrome-launcher": "^2.2.0",
|
44
|
-
"karma-mocha": "^1.3.0",
|
45
|
-
"mocha": "^5.2.0",
|
46
|
-
"mocha-lcov-reporter": "^1.2.0",
|
47
|
-
"xo": "^0.23.0"
|
48
|
-
},
|
49
|
-
"peerDependenciesMeta": {
|
50
|
-
"supports-color": {
|
51
|
-
"optional": true
|
52
|
-
}
|
53
|
-
},
|
54
|
-
"main": "./src/index.js",
|
55
|
-
"browser": "./src/browser.js",
|
56
|
-
"engines": {
|
57
|
-
"node": ">=6.0"
|
58
|
-
}
|
59
|
-
}
|
@@ -1,269 +0,0 @@
|
|
1
|
-
/* eslint-env browser */
|
2
|
-
|
3
|
-
/**
|
4
|
-
* This is the web browser implementation of `debug()`.
|
5
|
-
*/
|
6
|
-
|
7
|
-
exports.formatArgs = formatArgs;
|
8
|
-
exports.save = save;
|
9
|
-
exports.load = load;
|
10
|
-
exports.useColors = useColors;
|
11
|
-
exports.storage = localstorage();
|
12
|
-
exports.destroy = (() => {
|
13
|
-
let warned = false;
|
14
|
-
|
15
|
-
return () => {
|
16
|
-
if (!warned) {
|
17
|
-
warned = true;
|
18
|
-
console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
|
19
|
-
}
|
20
|
-
};
|
21
|
-
})();
|
22
|
-
|
23
|
-
/**
|
24
|
-
* Colors.
|
25
|
-
*/
|
26
|
-
|
27
|
-
exports.colors = [
|
28
|
-
'#0000CC',
|
29
|
-
'#0000FF',
|
30
|
-
'#0033CC',
|
31
|
-
'#0033FF',
|
32
|
-
'#0066CC',
|
33
|
-
'#0066FF',
|
34
|
-
'#0099CC',
|
35
|
-
'#0099FF',
|
36
|
-
'#00CC00',
|
37
|
-
'#00CC33',
|
38
|
-
'#00CC66',
|
39
|
-
'#00CC99',
|
40
|
-
'#00CCCC',
|
41
|
-
'#00CCFF',
|
42
|
-
'#3300CC',
|
43
|
-
'#3300FF',
|
44
|
-
'#3333CC',
|
45
|
-
'#3333FF',
|
46
|
-
'#3366CC',
|
47
|
-
'#3366FF',
|
48
|
-
'#3399CC',
|
49
|
-
'#3399FF',
|
50
|
-
'#33CC00',
|
51
|
-
'#33CC33',
|
52
|
-
'#33CC66',
|
53
|
-
'#33CC99',
|
54
|
-
'#33CCCC',
|
55
|
-
'#33CCFF',
|
56
|
-
'#6600CC',
|
57
|
-
'#6600FF',
|
58
|
-
'#6633CC',
|
59
|
-
'#6633FF',
|
60
|
-
'#66CC00',
|
61
|
-
'#66CC33',
|
62
|
-
'#9900CC',
|
63
|
-
'#9900FF',
|
64
|
-
'#9933CC',
|
65
|
-
'#9933FF',
|
66
|
-
'#99CC00',
|
67
|
-
'#99CC33',
|
68
|
-
'#CC0000',
|
69
|
-
'#CC0033',
|
70
|
-
'#CC0066',
|
71
|
-
'#CC0099',
|
72
|
-
'#CC00CC',
|
73
|
-
'#CC00FF',
|
74
|
-
'#CC3300',
|
75
|
-
'#CC3333',
|
76
|
-
'#CC3366',
|
77
|
-
'#CC3399',
|
78
|
-
'#CC33CC',
|
79
|
-
'#CC33FF',
|
80
|
-
'#CC6600',
|
81
|
-
'#CC6633',
|
82
|
-
'#CC9900',
|
83
|
-
'#CC9933',
|
84
|
-
'#CCCC00',
|
85
|
-
'#CCCC33',
|
86
|
-
'#FF0000',
|
87
|
-
'#FF0033',
|
88
|
-
'#FF0066',
|
89
|
-
'#FF0099',
|
90
|
-
'#FF00CC',
|
91
|
-
'#FF00FF',
|
92
|
-
'#FF3300',
|
93
|
-
'#FF3333',
|
94
|
-
'#FF3366',
|
95
|
-
'#FF3399',
|
96
|
-
'#FF33CC',
|
97
|
-
'#FF33FF',
|
98
|
-
'#FF6600',
|
99
|
-
'#FF6633',
|
100
|
-
'#FF9900',
|
101
|
-
'#FF9933',
|
102
|
-
'#FFCC00',
|
103
|
-
'#FFCC33'
|
104
|
-
];
|
105
|
-
|
106
|
-
/**
|
107
|
-
* Currently only WebKit-based Web Inspectors, Firefox >= v31,
|
108
|
-
* and the Firebug extension (any Firefox version) are known
|
109
|
-
* to support "%c" CSS customizations.
|
110
|
-
*
|
111
|
-
* TODO: add a `localStorage` variable to explicitly enable/disable colors
|
112
|
-
*/
|
113
|
-
|
114
|
-
// eslint-disable-next-line complexity
|
115
|
-
function useColors() {
|
116
|
-
// NB: In an Electron preload script, document will be defined but not fully
|
117
|
-
// initialized. Since we know we're in Chrome, we'll just detect this case
|
118
|
-
// explicitly
|
119
|
-
if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
|
120
|
-
return true;
|
121
|
-
}
|
122
|
-
|
123
|
-
// Internet Explorer and Edge do not support colors.
|
124
|
-
if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
|
125
|
-
return false;
|
126
|
-
}
|
127
|
-
|
128
|
-
// Is webkit? http://stackoverflow.com/a/16459606/376773
|
129
|
-
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
|
130
|
-
return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
|
131
|
-
// Is firebug? http://stackoverflow.com/a/398120/376773
|
132
|
-
(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
|
133
|
-
// Is firefox >= v31?
|
134
|
-
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
135
|
-
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
|
136
|
-
// Double check webkit in userAgent just in case we are in a worker
|
137
|
-
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
|
138
|
-
}
|
139
|
-
|
140
|
-
/**
|
141
|
-
* Colorize log arguments if enabled.
|
142
|
-
*
|
143
|
-
* @api public
|
144
|
-
*/
|
145
|
-
|
146
|
-
function formatArgs(args) {
|
147
|
-
args[0] = (this.useColors ? '%c' : '') +
|
148
|
-
this.namespace +
|
149
|
-
(this.useColors ? ' %c' : ' ') +
|
150
|
-
args[0] +
|
151
|
-
(this.useColors ? '%c ' : ' ') +
|
152
|
-
'+' + module.exports.humanize(this.diff);
|
153
|
-
|
154
|
-
if (!this.useColors) {
|
155
|
-
return;
|
156
|
-
}
|
157
|
-
|
158
|
-
const c = 'color: ' + this.color;
|
159
|
-
args.splice(1, 0, c, 'color: inherit');
|
160
|
-
|
161
|
-
// The final "%c" is somewhat tricky, because there could be other
|
162
|
-
// arguments passed either before or after the %c, so we need to
|
163
|
-
// figure out the correct index to insert the CSS into
|
164
|
-
let index = 0;
|
165
|
-
let lastC = 0;
|
166
|
-
args[0].replace(/%[a-zA-Z%]/g, match => {
|
167
|
-
if (match === '%%') {
|
168
|
-
return;
|
169
|
-
}
|
170
|
-
index++;
|
171
|
-
if (match === '%c') {
|
172
|
-
// We only are interested in the *last* %c
|
173
|
-
// (the user may have provided their own)
|
174
|
-
lastC = index;
|
175
|
-
}
|
176
|
-
});
|
177
|
-
|
178
|
-
args.splice(lastC, 0, c);
|
179
|
-
}
|
180
|
-
|
181
|
-
/**
|
182
|
-
* Invokes `console.debug()` when available.
|
183
|
-
* No-op when `console.debug` is not a "function".
|
184
|
-
* If `console.debug` is not available, falls back
|
185
|
-
* to `console.log`.
|
186
|
-
*
|
187
|
-
* @api public
|
188
|
-
*/
|
189
|
-
exports.log = console.debug || console.log || (() => {});
|
190
|
-
|
191
|
-
/**
|
192
|
-
* Save `namespaces`.
|
193
|
-
*
|
194
|
-
* @param {String} namespaces
|
195
|
-
* @api private
|
196
|
-
*/
|
197
|
-
function save(namespaces) {
|
198
|
-
try {
|
199
|
-
if (namespaces) {
|
200
|
-
exports.storage.setItem('debug', namespaces);
|
201
|
-
} else {
|
202
|
-
exports.storage.removeItem('debug');
|
203
|
-
}
|
204
|
-
} catch (error) {
|
205
|
-
// Swallow
|
206
|
-
// XXX (@Qix-) should we be logging these?
|
207
|
-
}
|
208
|
-
}
|
209
|
-
|
210
|
-
/**
|
211
|
-
* Load `namespaces`.
|
212
|
-
*
|
213
|
-
* @return {String} returns the previously persisted debug modes
|
214
|
-
* @api private
|
215
|
-
*/
|
216
|
-
function load() {
|
217
|
-
let r;
|
218
|
-
try {
|
219
|
-
r = exports.storage.getItem('debug');
|
220
|
-
} catch (error) {
|
221
|
-
// Swallow
|
222
|
-
// XXX (@Qix-) should we be logging these?
|
223
|
-
}
|
224
|
-
|
225
|
-
// If debug isn't set in LS, and we're in Electron, try to load $DEBUG
|
226
|
-
if (!r && typeof process !== 'undefined' && 'env' in process) {
|
227
|
-
r = process.env.DEBUG;
|
228
|
-
}
|
229
|
-
|
230
|
-
return r;
|
231
|
-
}
|
232
|
-
|
233
|
-
/**
|
234
|
-
* Localstorage attempts to return the localstorage.
|
235
|
-
*
|
236
|
-
* This is necessary because safari throws
|
237
|
-
* when a user disables cookies/localstorage
|
238
|
-
* and you attempt to access it.
|
239
|
-
*
|
240
|
-
* @return {LocalStorage}
|
241
|
-
* @api private
|
242
|
-
*/
|
243
|
-
|
244
|
-
function localstorage() {
|
245
|
-
try {
|
246
|
-
// TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
|
247
|
-
// The Browser also has localStorage in the global context.
|
248
|
-
return localStorage;
|
249
|
-
} catch (error) {
|
250
|
-
// Swallow
|
251
|
-
// XXX (@Qix-) should we be logging these?
|
252
|
-
}
|
253
|
-
}
|
254
|
-
|
255
|
-
module.exports = require('./common')(exports);
|
256
|
-
|
257
|
-
const {formatters} = module.exports;
|
258
|
-
|
259
|
-
/**
|
260
|
-
* Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
|
261
|
-
*/
|
262
|
-
|
263
|
-
formatters.j = function (v) {
|
264
|
-
try {
|
265
|
-
return JSON.stringify(v);
|
266
|
-
} catch (error) {
|
267
|
-
return '[UnexpectedJSONParseError]: ' + error.message;
|
268
|
-
}
|
269
|
-
};
|
@@ -1,274 +0,0 @@
|
|
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
|
-
createDebug.destroy = destroy;
|
16
|
-
|
17
|
-
Object.keys(env).forEach(key => {
|
18
|
-
createDebug[key] = env[key];
|
19
|
-
});
|
20
|
-
|
21
|
-
/**
|
22
|
-
* The currently active debug mode names, and names to skip.
|
23
|
-
*/
|
24
|
-
|
25
|
-
createDebug.names = [];
|
26
|
-
createDebug.skips = [];
|
27
|
-
|
28
|
-
/**
|
29
|
-
* Map of special "%n" handling functions, for the debug "format" argument.
|
30
|
-
*
|
31
|
-
* Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
|
32
|
-
*/
|
33
|
-
createDebug.formatters = {};
|
34
|
-
|
35
|
-
/**
|
36
|
-
* Selects a color for a debug namespace
|
37
|
-
* @param {String} namespace The namespace string for the debug instance to be colored
|
38
|
-
* @return {Number|String} An ANSI color code for the given namespace
|
39
|
-
* @api private
|
40
|
-
*/
|
41
|
-
function selectColor(namespace) {
|
42
|
-
let hash = 0;
|
43
|
-
|
44
|
-
for (let i = 0; i < namespace.length; i++) {
|
45
|
-
hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
|
46
|
-
hash |= 0; // Convert to 32bit integer
|
47
|
-
}
|
48
|
-
|
49
|
-
return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
|
50
|
-
}
|
51
|
-
createDebug.selectColor = selectColor;
|
52
|
-
|
53
|
-
/**
|
54
|
-
* Create a debugger with the given `namespace`.
|
55
|
-
*
|
56
|
-
* @param {String} namespace
|
57
|
-
* @return {Function}
|
58
|
-
* @api public
|
59
|
-
*/
|
60
|
-
function createDebug(namespace) {
|
61
|
-
let prevTime;
|
62
|
-
let enableOverride = null;
|
63
|
-
let namespacesCache;
|
64
|
-
let enabledCache;
|
65
|
-
|
66
|
-
function debug(...args) {
|
67
|
-
// Disabled?
|
68
|
-
if (!debug.enabled) {
|
69
|
-
return;
|
70
|
-
}
|
71
|
-
|
72
|
-
const self = debug;
|
73
|
-
|
74
|
-
// Set `diff` timestamp
|
75
|
-
const curr = Number(new Date());
|
76
|
-
const ms = curr - (prevTime || curr);
|
77
|
-
self.diff = ms;
|
78
|
-
self.prev = prevTime;
|
79
|
-
self.curr = curr;
|
80
|
-
prevTime = curr;
|
81
|
-
|
82
|
-
args[0] = createDebug.coerce(args[0]);
|
83
|
-
|
84
|
-
if (typeof args[0] !== 'string') {
|
85
|
-
// Anything else let's inspect with %O
|
86
|
-
args.unshift('%O');
|
87
|
-
}
|
88
|
-
|
89
|
-
// Apply any `formatters` transformations
|
90
|
-
let index = 0;
|
91
|
-
args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
|
92
|
-
// If we encounter an escaped % then don't increase the array index
|
93
|
-
if (match === '%%') {
|
94
|
-
return '%';
|
95
|
-
}
|
96
|
-
index++;
|
97
|
-
const formatter = createDebug.formatters[format];
|
98
|
-
if (typeof formatter === 'function') {
|
99
|
-
const val = args[index];
|
100
|
-
match = formatter.call(self, val);
|
101
|
-
|
102
|
-
// Now we need to remove `args[index]` since it's inlined in the `format`
|
103
|
-
args.splice(index, 1);
|
104
|
-
index--;
|
105
|
-
}
|
106
|
-
return match;
|
107
|
-
});
|
108
|
-
|
109
|
-
// Apply env-specific formatting (colors, etc.)
|
110
|
-
createDebug.formatArgs.call(self, args);
|
111
|
-
|
112
|
-
const logFn = self.log || createDebug.log;
|
113
|
-
logFn.apply(self, args);
|
114
|
-
}
|
115
|
-
|
116
|
-
debug.namespace = namespace;
|
117
|
-
debug.useColors = createDebug.useColors();
|
118
|
-
debug.color = createDebug.selectColor(namespace);
|
119
|
-
debug.extend = extend;
|
120
|
-
debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.
|
121
|
-
|
122
|
-
Object.defineProperty(debug, 'enabled', {
|
123
|
-
enumerable: true,
|
124
|
-
configurable: false,
|
125
|
-
get: () => {
|
126
|
-
if (enableOverride !== null) {
|
127
|
-
return enableOverride;
|
128
|
-
}
|
129
|
-
if (namespacesCache !== createDebug.namespaces) {
|
130
|
-
namespacesCache = createDebug.namespaces;
|
131
|
-
enabledCache = createDebug.enabled(namespace);
|
132
|
-
}
|
133
|
-
|
134
|
-
return enabledCache;
|
135
|
-
},
|
136
|
-
set: v => {
|
137
|
-
enableOverride = v;
|
138
|
-
}
|
139
|
-
});
|
140
|
-
|
141
|
-
// Env-specific initialization logic for debug instances
|
142
|
-
if (typeof createDebug.init === 'function') {
|
143
|
-
createDebug.init(debug);
|
144
|
-
}
|
145
|
-
|
146
|
-
return debug;
|
147
|
-
}
|
148
|
-
|
149
|
-
function extend(namespace, delimiter) {
|
150
|
-
const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
|
151
|
-
newDebug.log = this.log;
|
152
|
-
return newDebug;
|
153
|
-
}
|
154
|
-
|
155
|
-
/**
|
156
|
-
* Enables a debug mode by namespaces. This can include modes
|
157
|
-
* separated by a colon and wildcards.
|
158
|
-
*
|
159
|
-
* @param {String} namespaces
|
160
|
-
* @api public
|
161
|
-
*/
|
162
|
-
function enable(namespaces) {
|
163
|
-
createDebug.save(namespaces);
|
164
|
-
createDebug.namespaces = namespaces;
|
165
|
-
|
166
|
-
createDebug.names = [];
|
167
|
-
createDebug.skips = [];
|
168
|
-
|
169
|
-
let i;
|
170
|
-
const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
|
171
|
-
const len = split.length;
|
172
|
-
|
173
|
-
for (i = 0; i < len; i++) {
|
174
|
-
if (!split[i]) {
|
175
|
-
// ignore empty strings
|
176
|
-
continue;
|
177
|
-
}
|
178
|
-
|
179
|
-
namespaces = split[i].replace(/\*/g, '.*?');
|
180
|
-
|
181
|
-
if (namespaces[0] === '-') {
|
182
|
-
createDebug.skips.push(new RegExp('^' + namespaces.slice(1) + '$'));
|
183
|
-
} else {
|
184
|
-
createDebug.names.push(new RegExp('^' + namespaces + '$'));
|
185
|
-
}
|
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
|
-
/**
|
262
|
-
* XXX DO NOT USE. This is a temporary stub function.
|
263
|
-
* XXX It WILL be removed in the next major release.
|
264
|
-
*/
|
265
|
-
function destroy() {
|
266
|
-
console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
|
267
|
-
}
|
268
|
-
|
269
|
-
createDebug.enable(createDebug.load());
|
270
|
-
|
271
|
-
return createDebug;
|
272
|
-
}
|
273
|
-
|
274
|
-
module.exports = setup;
|
@@ -1,10 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Detect Electron renderer / nwjs process, which is node, but we should
|
3
|
-
* treat as a browser.
|
4
|
-
*/
|
5
|
-
|
6
|
-
if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
|
7
|
-
module.exports = require('./browser.js');
|
8
|
-
} else {
|
9
|
-
module.exports = require('./node.js');
|
10
|
-
}
|