vite 3.0.0-alpha.9 → 3.0.0-beta.10
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.
- package/LICENSE.md +84 -343
- package/bin/vite.js +1 -1
- package/client.d.ts +12 -0
- package/dist/client/client.mjs +61 -9
- package/dist/client/client.mjs.map +1 -1
- package/dist/node/chunks/{dep-e8ca8d40.js → dep-07a79996.js} +124 -116
- package/dist/node/chunks/{dep-17430d09.js → dep-41eb528c.js} +12 -12
- package/dist/node/chunks/{dep-8df7bfd6.js → dep-7c75cb17.js} +33378 -30892
- package/dist/node/chunks/{dep-523c8a1b.js → dep-af860ceb.js} +3122 -3122
- package/dist/node/chunks/dep-bc80f1d6.js +7545 -0
- package/dist/node/cli.js +32 -19
- package/dist/node/constants.js +43 -7
- package/dist/node/index.d.ts +235 -96
- package/dist/node/index.js +23 -10
- package/dist/node-cjs/publicUtils.cjs +3058 -868
- package/package.json +32 -32
- package/src/client/client.ts +109 -22
- package/src/client/tsconfig.json +0 -2
- package/types/chokidar.d.ts +2 -2
- package/types/connect.d.ts +1 -1
- package/types/hot.d.ts +17 -3
- package/types/http-proxy.d.ts +5 -5
- package/types/ws.d.ts +6 -6
- package/dist/node/chunks/dep-08f2a2be.js +0 -19603
- package/dist/node/chunks/dep-3165073f.js +0 -7505
- package/dist/node-cjs/terser.cjs +0 -31023
|
@@ -2,25 +2,44 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
5
|
+
var path$3 = require('node:path');
|
|
6
|
+
var node_url = require('node:url');
|
|
7
|
+
var esbuild = require('esbuild');
|
|
8
|
+
var rollup = require('rollup');
|
|
9
|
+
var fs$1 = require('node:fs');
|
|
10
|
+
var os$1 = require('node:os');
|
|
11
|
+
var node_util = require('node:util');
|
|
12
|
+
var node_module = require('node:module');
|
|
10
13
|
var require$$0 = require('tty');
|
|
11
|
-
var
|
|
12
|
-
var require$$0$1 = require('
|
|
14
|
+
var require$$1 = require('util');
|
|
15
|
+
var require$$0$1 = require('path');
|
|
16
|
+
var require$$0$2 = require('crypto');
|
|
17
|
+
var require$$1$1 = require('fs');
|
|
13
18
|
var readline = require('readline');
|
|
19
|
+
var require$$2 = require('os');
|
|
14
20
|
|
|
15
21
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e["default"] : e; }
|
|
16
22
|
|
|
23
|
+
var path__default = /*#__PURE__*/_interopDefaultLegacy(path$3);
|
|
17
24
|
var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs$1);
|
|
18
25
|
var os__default = /*#__PURE__*/_interopDefaultLegacy(os$1);
|
|
19
|
-
var path__default = /*#__PURE__*/_interopDefaultLegacy(path$1);
|
|
20
|
-
var require$$1__default = /*#__PURE__*/_interopDefaultLegacy(require$$1);
|
|
21
26
|
var require$$0__default = /*#__PURE__*/_interopDefaultLegacy(require$$0);
|
|
27
|
+
var require$$1__default = /*#__PURE__*/_interopDefaultLegacy(require$$1);
|
|
22
28
|
var require$$0__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$0$1);
|
|
29
|
+
var require$$0__default$2 = /*#__PURE__*/_interopDefaultLegacy(require$$0$2);
|
|
30
|
+
var require$$1__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$1$1);
|
|
23
31
|
var readline__default = /*#__PURE__*/_interopDefaultLegacy(readline);
|
|
32
|
+
var require$$2__default = /*#__PURE__*/_interopDefaultLegacy(require$$2);
|
|
33
|
+
|
|
34
|
+
var version = "3.0.0-beta.10";
|
|
35
|
+
|
|
36
|
+
const VERSION = version;
|
|
37
|
+
const VITE_PACKAGE_DIR = path$3.resolve(
|
|
38
|
+
// import.meta.url is `dist/node/constants.js` after bundle
|
|
39
|
+
node_url.fileURLToPath((typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('node-cjs/publicUtils.cjs', document.baseURI).href))), '../../..');
|
|
40
|
+
const CLIENT_ENTRY = path$3.resolve(VITE_PACKAGE_DIR, 'dist/client/client.mjs');
|
|
41
|
+
path$3.resolve(VITE_PACKAGE_DIR, 'dist/client/env.mjs');
|
|
42
|
+
path__default.dirname(CLIENT_ENTRY);
|
|
24
43
|
|
|
25
44
|
// This file will be built for both ESM and CJS. Avoid relying on other modules as possible.
|
|
26
45
|
const cssLangs = `\\.(css|less|sass|scss|styl|stylus|pcss|postcss)($|\\?)`;
|
|
@@ -136,6 +155,10 @@ for (let i = 0; i < chars.length; i++) {
|
|
|
136
155
|
charToInt[c] = i;
|
|
137
156
|
}
|
|
138
157
|
|
|
158
|
+
function getDefaultExportFromCjs (x) {
|
|
159
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
160
|
+
}
|
|
161
|
+
|
|
139
162
|
var picocolors = {exports: {}};
|
|
140
163
|
|
|
141
164
|
let tty = require$$0__default;
|
|
@@ -197,8 +220,6 @@ let createColors = (enabled = isColorSupported) => ({
|
|
|
197
220
|
picocolors.exports = createColors();
|
|
198
221
|
picocolors.exports.createColors = createColors;
|
|
199
222
|
|
|
200
|
-
var colors = picocolors.exports;
|
|
201
|
-
|
|
202
223
|
var src = {exports: {}};
|
|
203
224
|
|
|
204
225
|
var browser = {exports: {}};
|
|
@@ -207,1002 +228,3169 @@ var browser = {exports: {}};
|
|
|
207
228
|
* Helpers.
|
|
208
229
|
*/
|
|
209
230
|
|
|
210
|
-
var
|
|
211
|
-
var
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
231
|
+
var ms;
|
|
232
|
+
var hasRequiredMs;
|
|
233
|
+
|
|
234
|
+
function requireMs () {
|
|
235
|
+
if (hasRequiredMs) return ms;
|
|
236
|
+
hasRequiredMs = 1;
|
|
237
|
+
var s = 1000;
|
|
238
|
+
var m = s * 60;
|
|
239
|
+
var h = m * 60;
|
|
240
|
+
var d = h * 24;
|
|
241
|
+
var w = d * 7;
|
|
242
|
+
var y = d * 365.25;
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Parse or format the given `val`.
|
|
246
|
+
*
|
|
247
|
+
* Options:
|
|
248
|
+
*
|
|
249
|
+
* - `long` verbose formatting [false]
|
|
250
|
+
*
|
|
251
|
+
* @param {String|Number} val
|
|
252
|
+
* @param {Object} [options]
|
|
253
|
+
* @throws {Error} throw an error if val is not a non-empty string or a number
|
|
254
|
+
* @return {String|Number}
|
|
255
|
+
* @api public
|
|
256
|
+
*/
|
|
257
|
+
|
|
258
|
+
ms = function(val, options) {
|
|
259
|
+
options = options || {};
|
|
260
|
+
var type = typeof val;
|
|
261
|
+
if (type === 'string' && val.length > 0) {
|
|
262
|
+
return parse(val);
|
|
263
|
+
} else if (type === 'number' && isFinite(val)) {
|
|
264
|
+
return options.long ? fmtLong(val) : fmtShort(val);
|
|
265
|
+
}
|
|
266
|
+
throw new Error(
|
|
267
|
+
'val is not a non-empty string or a valid number. val=' +
|
|
268
|
+
JSON.stringify(val)
|
|
269
|
+
);
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Parse the given `str` and return milliseconds.
|
|
274
|
+
*
|
|
275
|
+
* @param {String} str
|
|
276
|
+
* @return {Number}
|
|
277
|
+
* @api private
|
|
278
|
+
*/
|
|
279
|
+
|
|
280
|
+
function parse(str) {
|
|
281
|
+
str = String(str);
|
|
282
|
+
if (str.length > 100) {
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
|
|
286
|
+
str
|
|
287
|
+
);
|
|
288
|
+
if (!match) {
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
var n = parseFloat(match[1]);
|
|
292
|
+
var type = (match[2] || 'ms').toLowerCase();
|
|
293
|
+
switch (type) {
|
|
294
|
+
case 'years':
|
|
295
|
+
case 'year':
|
|
296
|
+
case 'yrs':
|
|
297
|
+
case 'yr':
|
|
298
|
+
case 'y':
|
|
299
|
+
return n * y;
|
|
300
|
+
case 'weeks':
|
|
301
|
+
case 'week':
|
|
302
|
+
case 'w':
|
|
303
|
+
return n * w;
|
|
304
|
+
case 'days':
|
|
305
|
+
case 'day':
|
|
306
|
+
case 'd':
|
|
307
|
+
return n * d;
|
|
308
|
+
case 'hours':
|
|
309
|
+
case 'hour':
|
|
310
|
+
case 'hrs':
|
|
311
|
+
case 'hr':
|
|
312
|
+
case 'h':
|
|
313
|
+
return n * h;
|
|
314
|
+
case 'minutes':
|
|
315
|
+
case 'minute':
|
|
316
|
+
case 'mins':
|
|
317
|
+
case 'min':
|
|
318
|
+
case 'm':
|
|
319
|
+
return n * m;
|
|
320
|
+
case 'seconds':
|
|
321
|
+
case 'second':
|
|
322
|
+
case 'secs':
|
|
323
|
+
case 'sec':
|
|
324
|
+
case 's':
|
|
325
|
+
return n * s;
|
|
326
|
+
case 'milliseconds':
|
|
327
|
+
case 'millisecond':
|
|
328
|
+
case 'msecs':
|
|
329
|
+
case 'msec':
|
|
330
|
+
case 'ms':
|
|
331
|
+
return n;
|
|
332
|
+
default:
|
|
333
|
+
return undefined;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* Short format for `ms`.
|
|
339
|
+
*
|
|
340
|
+
* @param {Number} ms
|
|
341
|
+
* @return {String}
|
|
342
|
+
* @api private
|
|
343
|
+
*/
|
|
344
|
+
|
|
345
|
+
function fmtShort(ms) {
|
|
346
|
+
var msAbs = Math.abs(ms);
|
|
347
|
+
if (msAbs >= d) {
|
|
348
|
+
return Math.round(ms / d) + 'd';
|
|
349
|
+
}
|
|
350
|
+
if (msAbs >= h) {
|
|
351
|
+
return Math.round(ms / h) + 'h';
|
|
352
|
+
}
|
|
353
|
+
if (msAbs >= m) {
|
|
354
|
+
return Math.round(ms / m) + 'm';
|
|
355
|
+
}
|
|
356
|
+
if (msAbs >= s) {
|
|
357
|
+
return Math.round(ms / s) + 's';
|
|
358
|
+
}
|
|
359
|
+
return ms + 'ms';
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* Long format for `ms`.
|
|
364
|
+
*
|
|
365
|
+
* @param {Number} ms
|
|
366
|
+
* @return {String}
|
|
367
|
+
* @api private
|
|
368
|
+
*/
|
|
369
|
+
|
|
370
|
+
function fmtLong(ms) {
|
|
371
|
+
var msAbs = Math.abs(ms);
|
|
372
|
+
if (msAbs >= d) {
|
|
373
|
+
return plural(ms, msAbs, d, 'day');
|
|
374
|
+
}
|
|
375
|
+
if (msAbs >= h) {
|
|
376
|
+
return plural(ms, msAbs, h, 'hour');
|
|
377
|
+
}
|
|
378
|
+
if (msAbs >= m) {
|
|
379
|
+
return plural(ms, msAbs, m, 'minute');
|
|
380
|
+
}
|
|
381
|
+
if (msAbs >= s) {
|
|
382
|
+
return plural(ms, msAbs, s, 'second');
|
|
383
|
+
}
|
|
384
|
+
return ms + ' ms';
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* Pluralization helper.
|
|
389
|
+
*/
|
|
390
|
+
|
|
391
|
+
function plural(ms, msAbs, n, name) {
|
|
392
|
+
var isPlural = msAbs >= n * 1.5;
|
|
393
|
+
return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
|
|
394
|
+
}
|
|
395
|
+
return ms;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
var common;
|
|
399
|
+
var hasRequiredCommon;
|
|
400
|
+
|
|
401
|
+
function requireCommon () {
|
|
402
|
+
if (hasRequiredCommon) return common;
|
|
403
|
+
hasRequiredCommon = 1;
|
|
404
|
+
/**
|
|
405
|
+
* This is the common logic for both the Node.js and web browser
|
|
406
|
+
* implementations of `debug()`.
|
|
407
|
+
*/
|
|
408
|
+
|
|
409
|
+
function setup(env) {
|
|
410
|
+
createDebug.debug = createDebug;
|
|
411
|
+
createDebug.default = createDebug;
|
|
412
|
+
createDebug.coerce = coerce;
|
|
413
|
+
createDebug.disable = disable;
|
|
414
|
+
createDebug.enable = enable;
|
|
415
|
+
createDebug.enabled = enabled;
|
|
416
|
+
createDebug.humanize = requireMs();
|
|
417
|
+
createDebug.destroy = destroy;
|
|
418
|
+
|
|
419
|
+
Object.keys(env).forEach(key => {
|
|
420
|
+
createDebug[key] = env[key];
|
|
421
|
+
});
|
|
422
|
+
|
|
423
|
+
/**
|
|
424
|
+
* The currently active debug mode names, and names to skip.
|
|
425
|
+
*/
|
|
426
|
+
|
|
427
|
+
createDebug.names = [];
|
|
428
|
+
createDebug.skips = [];
|
|
429
|
+
|
|
430
|
+
/**
|
|
431
|
+
* Map of special "%n" handling functions, for the debug "format" argument.
|
|
432
|
+
*
|
|
433
|
+
* Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
|
|
434
|
+
*/
|
|
435
|
+
createDebug.formatters = {};
|
|
436
|
+
|
|
437
|
+
/**
|
|
438
|
+
* Selects a color for a debug namespace
|
|
439
|
+
* @param {String} namespace The namespace string for the debug instance to be colored
|
|
440
|
+
* @return {Number|String} An ANSI color code for the given namespace
|
|
441
|
+
* @api private
|
|
442
|
+
*/
|
|
443
|
+
function selectColor(namespace) {
|
|
444
|
+
let hash = 0;
|
|
445
|
+
|
|
446
|
+
for (let i = 0; i < namespace.length; i++) {
|
|
447
|
+
hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
|
|
448
|
+
hash |= 0; // Convert to 32bit integer
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
|
|
452
|
+
}
|
|
453
|
+
createDebug.selectColor = selectColor;
|
|
454
|
+
|
|
455
|
+
/**
|
|
456
|
+
* Create a debugger with the given `namespace`.
|
|
457
|
+
*
|
|
458
|
+
* @param {String} namespace
|
|
459
|
+
* @return {Function}
|
|
460
|
+
* @api public
|
|
461
|
+
*/
|
|
462
|
+
function createDebug(namespace) {
|
|
463
|
+
let prevTime;
|
|
464
|
+
let enableOverride = null;
|
|
465
|
+
let namespacesCache;
|
|
466
|
+
let enabledCache;
|
|
467
|
+
|
|
468
|
+
function debug(...args) {
|
|
469
|
+
// Disabled?
|
|
470
|
+
if (!debug.enabled) {
|
|
471
|
+
return;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
const self = debug;
|
|
475
|
+
|
|
476
|
+
// Set `diff` timestamp
|
|
477
|
+
const curr = Number(new Date());
|
|
478
|
+
const ms = curr - (prevTime || curr);
|
|
479
|
+
self.diff = ms;
|
|
480
|
+
self.prev = prevTime;
|
|
481
|
+
self.curr = curr;
|
|
482
|
+
prevTime = curr;
|
|
483
|
+
|
|
484
|
+
args[0] = createDebug.coerce(args[0]);
|
|
485
|
+
|
|
486
|
+
if (typeof args[0] !== 'string') {
|
|
487
|
+
// Anything else let's inspect with %O
|
|
488
|
+
args.unshift('%O');
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
// Apply any `formatters` transformations
|
|
492
|
+
let index = 0;
|
|
493
|
+
args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
|
|
494
|
+
// If we encounter an escaped % then don't increase the array index
|
|
495
|
+
if (match === '%%') {
|
|
496
|
+
return '%';
|
|
497
|
+
}
|
|
498
|
+
index++;
|
|
499
|
+
const formatter = createDebug.formatters[format];
|
|
500
|
+
if (typeof formatter === 'function') {
|
|
501
|
+
const val = args[index];
|
|
502
|
+
match = formatter.call(self, val);
|
|
503
|
+
|
|
504
|
+
// Now we need to remove `args[index]` since it's inlined in the `format`
|
|
505
|
+
args.splice(index, 1);
|
|
506
|
+
index--;
|
|
507
|
+
}
|
|
508
|
+
return match;
|
|
509
|
+
});
|
|
510
|
+
|
|
511
|
+
// Apply env-specific formatting (colors, etc.)
|
|
512
|
+
createDebug.formatArgs.call(self, args);
|
|
513
|
+
|
|
514
|
+
const logFn = self.log || createDebug.log;
|
|
515
|
+
logFn.apply(self, args);
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
debug.namespace = namespace;
|
|
519
|
+
debug.useColors = createDebug.useColors();
|
|
520
|
+
debug.color = createDebug.selectColor(namespace);
|
|
521
|
+
debug.extend = extend;
|
|
522
|
+
debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.
|
|
523
|
+
|
|
524
|
+
Object.defineProperty(debug, 'enabled', {
|
|
525
|
+
enumerable: true,
|
|
526
|
+
configurable: false,
|
|
527
|
+
get: () => {
|
|
528
|
+
if (enableOverride !== null) {
|
|
529
|
+
return enableOverride;
|
|
530
|
+
}
|
|
531
|
+
if (namespacesCache !== createDebug.namespaces) {
|
|
532
|
+
namespacesCache = createDebug.namespaces;
|
|
533
|
+
enabledCache = createDebug.enabled(namespace);
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
return enabledCache;
|
|
537
|
+
},
|
|
538
|
+
set: v => {
|
|
539
|
+
enableOverride = v;
|
|
540
|
+
}
|
|
541
|
+
});
|
|
542
|
+
|
|
543
|
+
// Env-specific initialization logic for debug instances
|
|
544
|
+
if (typeof createDebug.init === 'function') {
|
|
545
|
+
createDebug.init(debug);
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
return debug;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
function extend(namespace, delimiter) {
|
|
552
|
+
const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
|
|
553
|
+
newDebug.log = this.log;
|
|
554
|
+
return newDebug;
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
/**
|
|
558
|
+
* Enables a debug mode by namespaces. This can include modes
|
|
559
|
+
* separated by a colon and wildcards.
|
|
560
|
+
*
|
|
561
|
+
* @param {String} namespaces
|
|
562
|
+
* @api public
|
|
563
|
+
*/
|
|
564
|
+
function enable(namespaces) {
|
|
565
|
+
createDebug.save(namespaces);
|
|
566
|
+
createDebug.namespaces = namespaces;
|
|
567
|
+
|
|
568
|
+
createDebug.names = [];
|
|
569
|
+
createDebug.skips = [];
|
|
570
|
+
|
|
571
|
+
let i;
|
|
572
|
+
const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
|
|
573
|
+
const len = split.length;
|
|
574
|
+
|
|
575
|
+
for (i = 0; i < len; i++) {
|
|
576
|
+
if (!split[i]) {
|
|
577
|
+
// ignore empty strings
|
|
578
|
+
continue;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
namespaces = split[i].replace(/\*/g, '.*?');
|
|
582
|
+
|
|
583
|
+
if (namespaces[0] === '-') {
|
|
584
|
+
createDebug.skips.push(new RegExp('^' + namespaces.slice(1) + '$'));
|
|
585
|
+
} else {
|
|
586
|
+
createDebug.names.push(new RegExp('^' + namespaces + '$'));
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
/**
|
|
592
|
+
* Disable debug output.
|
|
593
|
+
*
|
|
594
|
+
* @return {String} namespaces
|
|
595
|
+
* @api public
|
|
596
|
+
*/
|
|
597
|
+
function disable() {
|
|
598
|
+
const namespaces = [
|
|
599
|
+
...createDebug.names.map(toNamespace),
|
|
600
|
+
...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)
|
|
601
|
+
].join(',');
|
|
602
|
+
createDebug.enable('');
|
|
603
|
+
return namespaces;
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
/**
|
|
607
|
+
* Returns true if the given mode name is enabled, false otherwise.
|
|
608
|
+
*
|
|
609
|
+
* @param {String} name
|
|
610
|
+
* @return {Boolean}
|
|
611
|
+
* @api public
|
|
612
|
+
*/
|
|
613
|
+
function enabled(name) {
|
|
614
|
+
if (name[name.length - 1] === '*') {
|
|
615
|
+
return true;
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
let i;
|
|
619
|
+
let len;
|
|
620
|
+
|
|
621
|
+
for (i = 0, len = createDebug.skips.length; i < len; i++) {
|
|
622
|
+
if (createDebug.skips[i].test(name)) {
|
|
623
|
+
return false;
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
for (i = 0, len = createDebug.names.length; i < len; i++) {
|
|
628
|
+
if (createDebug.names[i].test(name)) {
|
|
629
|
+
return true;
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
return false;
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
/**
|
|
637
|
+
* Convert regexp to namespace
|
|
638
|
+
*
|
|
639
|
+
* @param {RegExp} regxep
|
|
640
|
+
* @return {String} namespace
|
|
641
|
+
* @api private
|
|
642
|
+
*/
|
|
643
|
+
function toNamespace(regexp) {
|
|
644
|
+
return regexp.toString()
|
|
645
|
+
.substring(2, regexp.toString().length - 2)
|
|
646
|
+
.replace(/\.\*\?$/, '*');
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
/**
|
|
650
|
+
* Coerce `val`.
|
|
651
|
+
*
|
|
652
|
+
* @param {Mixed} val
|
|
653
|
+
* @return {Mixed}
|
|
654
|
+
* @api private
|
|
655
|
+
*/
|
|
656
|
+
function coerce(val) {
|
|
657
|
+
if (val instanceof Error) {
|
|
658
|
+
return val.stack || val.message;
|
|
659
|
+
}
|
|
660
|
+
return val;
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
/**
|
|
664
|
+
* XXX DO NOT USE. This is a temporary stub function.
|
|
665
|
+
* XXX It WILL be removed in the next major release.
|
|
666
|
+
*/
|
|
667
|
+
function destroy() {
|
|
668
|
+
console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
createDebug.enable(createDebug.load());
|
|
672
|
+
|
|
673
|
+
return createDebug;
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
common = setup;
|
|
677
|
+
return common;
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
/* eslint-env browser */
|
|
681
|
+
|
|
682
|
+
var hasRequiredBrowser;
|
|
683
|
+
|
|
684
|
+
function requireBrowser () {
|
|
685
|
+
if (hasRequiredBrowser) return browser.exports;
|
|
686
|
+
hasRequiredBrowser = 1;
|
|
687
|
+
(function (module, exports) {
|
|
688
|
+
/**
|
|
689
|
+
* This is the web browser implementation of `debug()`.
|
|
690
|
+
*/
|
|
691
|
+
|
|
692
|
+
exports.formatArgs = formatArgs;
|
|
693
|
+
exports.save = save;
|
|
694
|
+
exports.load = load;
|
|
695
|
+
exports.useColors = useColors;
|
|
696
|
+
exports.storage = localstorage();
|
|
697
|
+
exports.destroy = (() => {
|
|
698
|
+
let warned = false;
|
|
699
|
+
|
|
700
|
+
return () => {
|
|
701
|
+
if (!warned) {
|
|
702
|
+
warned = true;
|
|
703
|
+
console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
|
|
704
|
+
}
|
|
705
|
+
};
|
|
706
|
+
})();
|
|
707
|
+
|
|
708
|
+
/**
|
|
709
|
+
* Colors.
|
|
710
|
+
*/
|
|
711
|
+
|
|
712
|
+
exports.colors = [
|
|
713
|
+
'#0000CC',
|
|
714
|
+
'#0000FF',
|
|
715
|
+
'#0033CC',
|
|
716
|
+
'#0033FF',
|
|
717
|
+
'#0066CC',
|
|
718
|
+
'#0066FF',
|
|
719
|
+
'#0099CC',
|
|
720
|
+
'#0099FF',
|
|
721
|
+
'#00CC00',
|
|
722
|
+
'#00CC33',
|
|
723
|
+
'#00CC66',
|
|
724
|
+
'#00CC99',
|
|
725
|
+
'#00CCCC',
|
|
726
|
+
'#00CCFF',
|
|
727
|
+
'#3300CC',
|
|
728
|
+
'#3300FF',
|
|
729
|
+
'#3333CC',
|
|
730
|
+
'#3333FF',
|
|
731
|
+
'#3366CC',
|
|
732
|
+
'#3366FF',
|
|
733
|
+
'#3399CC',
|
|
734
|
+
'#3399FF',
|
|
735
|
+
'#33CC00',
|
|
736
|
+
'#33CC33',
|
|
737
|
+
'#33CC66',
|
|
738
|
+
'#33CC99',
|
|
739
|
+
'#33CCCC',
|
|
740
|
+
'#33CCFF',
|
|
741
|
+
'#6600CC',
|
|
742
|
+
'#6600FF',
|
|
743
|
+
'#6633CC',
|
|
744
|
+
'#6633FF',
|
|
745
|
+
'#66CC00',
|
|
746
|
+
'#66CC33',
|
|
747
|
+
'#9900CC',
|
|
748
|
+
'#9900FF',
|
|
749
|
+
'#9933CC',
|
|
750
|
+
'#9933FF',
|
|
751
|
+
'#99CC00',
|
|
752
|
+
'#99CC33',
|
|
753
|
+
'#CC0000',
|
|
754
|
+
'#CC0033',
|
|
755
|
+
'#CC0066',
|
|
756
|
+
'#CC0099',
|
|
757
|
+
'#CC00CC',
|
|
758
|
+
'#CC00FF',
|
|
759
|
+
'#CC3300',
|
|
760
|
+
'#CC3333',
|
|
761
|
+
'#CC3366',
|
|
762
|
+
'#CC3399',
|
|
763
|
+
'#CC33CC',
|
|
764
|
+
'#CC33FF',
|
|
765
|
+
'#CC6600',
|
|
766
|
+
'#CC6633',
|
|
767
|
+
'#CC9900',
|
|
768
|
+
'#CC9933',
|
|
769
|
+
'#CCCC00',
|
|
770
|
+
'#CCCC33',
|
|
771
|
+
'#FF0000',
|
|
772
|
+
'#FF0033',
|
|
773
|
+
'#FF0066',
|
|
774
|
+
'#FF0099',
|
|
775
|
+
'#FF00CC',
|
|
776
|
+
'#FF00FF',
|
|
777
|
+
'#FF3300',
|
|
778
|
+
'#FF3333',
|
|
779
|
+
'#FF3366',
|
|
780
|
+
'#FF3399',
|
|
781
|
+
'#FF33CC',
|
|
782
|
+
'#FF33FF',
|
|
783
|
+
'#FF6600',
|
|
784
|
+
'#FF6633',
|
|
785
|
+
'#FF9900',
|
|
786
|
+
'#FF9933',
|
|
787
|
+
'#FFCC00',
|
|
788
|
+
'#FFCC33'
|
|
789
|
+
];
|
|
790
|
+
|
|
791
|
+
/**
|
|
792
|
+
* Currently only WebKit-based Web Inspectors, Firefox >= v31,
|
|
793
|
+
* and the Firebug extension (any Firefox version) are known
|
|
794
|
+
* to support "%c" CSS customizations.
|
|
795
|
+
*
|
|
796
|
+
* TODO: add a `localStorage` variable to explicitly enable/disable colors
|
|
797
|
+
*/
|
|
798
|
+
|
|
799
|
+
// eslint-disable-next-line complexity
|
|
800
|
+
function useColors() {
|
|
801
|
+
// NB: In an Electron preload script, document will be defined but not fully
|
|
802
|
+
// initialized. Since we know we're in Chrome, we'll just detect this case
|
|
803
|
+
// explicitly
|
|
804
|
+
if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
|
|
805
|
+
return true;
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
// Internet Explorer and Edge do not support colors.
|
|
809
|
+
if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
|
|
810
|
+
return false;
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
// Is webkit? http://stackoverflow.com/a/16459606/376773
|
|
814
|
+
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
|
|
815
|
+
return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
|
|
816
|
+
// Is firebug? http://stackoverflow.com/a/398120/376773
|
|
817
|
+
(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
|
|
818
|
+
// Is firefox >= v31?
|
|
819
|
+
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
|
820
|
+
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
|
|
821
|
+
// Double check webkit in userAgent just in case we are in a worker
|
|
822
|
+
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
/**
|
|
826
|
+
* Colorize log arguments if enabled.
|
|
827
|
+
*
|
|
828
|
+
* @api public
|
|
829
|
+
*/
|
|
830
|
+
|
|
831
|
+
function formatArgs(args) {
|
|
832
|
+
args[0] = (this.useColors ? '%c' : '') +
|
|
833
|
+
this.namespace +
|
|
834
|
+
(this.useColors ? ' %c' : ' ') +
|
|
835
|
+
args[0] +
|
|
836
|
+
(this.useColors ? '%c ' : ' ') +
|
|
837
|
+
'+' + module.exports.humanize(this.diff);
|
|
838
|
+
|
|
839
|
+
if (!this.useColors) {
|
|
840
|
+
return;
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
const c = 'color: ' + this.color;
|
|
844
|
+
args.splice(1, 0, c, 'color: inherit');
|
|
845
|
+
|
|
846
|
+
// The final "%c" is somewhat tricky, because there could be other
|
|
847
|
+
// arguments passed either before or after the %c, so we need to
|
|
848
|
+
// figure out the correct index to insert the CSS into
|
|
849
|
+
let index = 0;
|
|
850
|
+
let lastC = 0;
|
|
851
|
+
args[0].replace(/%[a-zA-Z%]/g, match => {
|
|
852
|
+
if (match === '%%') {
|
|
853
|
+
return;
|
|
854
|
+
}
|
|
855
|
+
index++;
|
|
856
|
+
if (match === '%c') {
|
|
857
|
+
// We only are interested in the *last* %c
|
|
858
|
+
// (the user may have provided their own)
|
|
859
|
+
lastC = index;
|
|
860
|
+
}
|
|
861
|
+
});
|
|
862
|
+
|
|
863
|
+
args.splice(lastC, 0, c);
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
/**
|
|
867
|
+
* Invokes `console.debug()` when available.
|
|
868
|
+
* No-op when `console.debug` is not a "function".
|
|
869
|
+
* If `console.debug` is not available, falls back
|
|
870
|
+
* to `console.log`.
|
|
871
|
+
*
|
|
872
|
+
* @api public
|
|
873
|
+
*/
|
|
874
|
+
exports.log = console.debug || console.log || (() => {});
|
|
875
|
+
|
|
876
|
+
/**
|
|
877
|
+
* Save `namespaces`.
|
|
878
|
+
*
|
|
879
|
+
* @param {String} namespaces
|
|
880
|
+
* @api private
|
|
881
|
+
*/
|
|
882
|
+
function save(namespaces) {
|
|
883
|
+
try {
|
|
884
|
+
if (namespaces) {
|
|
885
|
+
exports.storage.setItem('debug', namespaces);
|
|
886
|
+
} else {
|
|
887
|
+
exports.storage.removeItem('debug');
|
|
888
|
+
}
|
|
889
|
+
} catch (error) {
|
|
890
|
+
// Swallow
|
|
891
|
+
// XXX (@Qix-) should we be logging these?
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
/**
|
|
896
|
+
* Load `namespaces`.
|
|
897
|
+
*
|
|
898
|
+
* @return {String} returns the previously persisted debug modes
|
|
899
|
+
* @api private
|
|
900
|
+
*/
|
|
901
|
+
function load() {
|
|
902
|
+
let r;
|
|
903
|
+
try {
|
|
904
|
+
r = exports.storage.getItem('debug');
|
|
905
|
+
} catch (error) {
|
|
906
|
+
// Swallow
|
|
907
|
+
// XXX (@Qix-) should we be logging these?
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
// If debug isn't set in LS, and we're in Electron, try to load $DEBUG
|
|
911
|
+
if (!r && typeof process !== 'undefined' && 'env' in process) {
|
|
912
|
+
r = process.env.DEBUG;
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
return r;
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
/**
|
|
919
|
+
* Localstorage attempts to return the localstorage.
|
|
920
|
+
*
|
|
921
|
+
* This is necessary because safari throws
|
|
922
|
+
* when a user disables cookies/localstorage
|
|
923
|
+
* and you attempt to access it.
|
|
924
|
+
*
|
|
925
|
+
* @return {LocalStorage}
|
|
926
|
+
* @api private
|
|
927
|
+
*/
|
|
928
|
+
|
|
929
|
+
function localstorage() {
|
|
930
|
+
try {
|
|
931
|
+
// TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
|
|
932
|
+
// The Browser also has localStorage in the global context.
|
|
933
|
+
return localStorage;
|
|
934
|
+
} catch (error) {
|
|
935
|
+
// Swallow
|
|
936
|
+
// XXX (@Qix-) should we be logging these?
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
module.exports = requireCommon()(exports);
|
|
941
|
+
|
|
942
|
+
const {formatters} = module.exports;
|
|
943
|
+
|
|
944
|
+
/**
|
|
945
|
+
* Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
|
|
946
|
+
*/
|
|
947
|
+
|
|
948
|
+
formatters.j = function (v) {
|
|
949
|
+
try {
|
|
950
|
+
return JSON.stringify(v);
|
|
951
|
+
} catch (error) {
|
|
952
|
+
return '[UnexpectedJSONParseError]: ' + error.message;
|
|
953
|
+
}
|
|
954
|
+
};
|
|
955
|
+
} (browser, browser.exports));
|
|
956
|
+
return browser.exports;
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
var node = {exports: {}};
|
|
960
|
+
|
|
961
|
+
/**
|
|
962
|
+
* Module dependencies.
|
|
963
|
+
*/
|
|
964
|
+
|
|
965
|
+
var hasRequiredNode;
|
|
966
|
+
|
|
967
|
+
function requireNode () {
|
|
968
|
+
if (hasRequiredNode) return node.exports;
|
|
969
|
+
hasRequiredNode = 1;
|
|
970
|
+
(function (module, exports) {
|
|
971
|
+
const tty = require$$0__default;
|
|
972
|
+
const util = require$$1__default;
|
|
973
|
+
|
|
974
|
+
/**
|
|
975
|
+
* This is the Node.js implementation of `debug()`.
|
|
976
|
+
*/
|
|
977
|
+
|
|
978
|
+
exports.init = init;
|
|
979
|
+
exports.log = log;
|
|
980
|
+
exports.formatArgs = formatArgs;
|
|
981
|
+
exports.save = save;
|
|
982
|
+
exports.load = load;
|
|
983
|
+
exports.useColors = useColors;
|
|
984
|
+
exports.destroy = util.deprecate(
|
|
985
|
+
() => {},
|
|
986
|
+
'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'
|
|
987
|
+
);
|
|
988
|
+
|
|
989
|
+
/**
|
|
990
|
+
* Colors.
|
|
991
|
+
*/
|
|
992
|
+
|
|
993
|
+
exports.colors = [6, 2, 3, 4, 5, 1];
|
|
994
|
+
|
|
995
|
+
try {
|
|
996
|
+
// Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json)
|
|
997
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
998
|
+
const supportsColor = require('supports-color');
|
|
999
|
+
|
|
1000
|
+
if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
|
|
1001
|
+
exports.colors = [
|
|
1002
|
+
20,
|
|
1003
|
+
21,
|
|
1004
|
+
26,
|
|
1005
|
+
27,
|
|
1006
|
+
32,
|
|
1007
|
+
33,
|
|
1008
|
+
38,
|
|
1009
|
+
39,
|
|
1010
|
+
40,
|
|
1011
|
+
41,
|
|
1012
|
+
42,
|
|
1013
|
+
43,
|
|
1014
|
+
44,
|
|
1015
|
+
45,
|
|
1016
|
+
56,
|
|
1017
|
+
57,
|
|
1018
|
+
62,
|
|
1019
|
+
63,
|
|
1020
|
+
68,
|
|
1021
|
+
69,
|
|
1022
|
+
74,
|
|
1023
|
+
75,
|
|
1024
|
+
76,
|
|
1025
|
+
77,
|
|
1026
|
+
78,
|
|
1027
|
+
79,
|
|
1028
|
+
80,
|
|
1029
|
+
81,
|
|
1030
|
+
92,
|
|
1031
|
+
93,
|
|
1032
|
+
98,
|
|
1033
|
+
99,
|
|
1034
|
+
112,
|
|
1035
|
+
113,
|
|
1036
|
+
128,
|
|
1037
|
+
129,
|
|
1038
|
+
134,
|
|
1039
|
+
135,
|
|
1040
|
+
148,
|
|
1041
|
+
149,
|
|
1042
|
+
160,
|
|
1043
|
+
161,
|
|
1044
|
+
162,
|
|
1045
|
+
163,
|
|
1046
|
+
164,
|
|
1047
|
+
165,
|
|
1048
|
+
166,
|
|
1049
|
+
167,
|
|
1050
|
+
168,
|
|
1051
|
+
169,
|
|
1052
|
+
170,
|
|
1053
|
+
171,
|
|
1054
|
+
172,
|
|
1055
|
+
173,
|
|
1056
|
+
178,
|
|
1057
|
+
179,
|
|
1058
|
+
184,
|
|
1059
|
+
185,
|
|
1060
|
+
196,
|
|
1061
|
+
197,
|
|
1062
|
+
198,
|
|
1063
|
+
199,
|
|
1064
|
+
200,
|
|
1065
|
+
201,
|
|
1066
|
+
202,
|
|
1067
|
+
203,
|
|
1068
|
+
204,
|
|
1069
|
+
205,
|
|
1070
|
+
206,
|
|
1071
|
+
207,
|
|
1072
|
+
208,
|
|
1073
|
+
209,
|
|
1074
|
+
214,
|
|
1075
|
+
215,
|
|
1076
|
+
220,
|
|
1077
|
+
221
|
|
1078
|
+
];
|
|
1079
|
+
}
|
|
1080
|
+
} catch (error) {
|
|
1081
|
+
// Swallow - we only care if `supports-color` is available; it doesn't have to be.
|
|
1082
|
+
}
|
|
1083
|
+
|
|
1084
|
+
/**
|
|
1085
|
+
* Build up the default `inspectOpts` object from the environment variables.
|
|
1086
|
+
*
|
|
1087
|
+
* $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
|
|
1088
|
+
*/
|
|
1089
|
+
|
|
1090
|
+
exports.inspectOpts = Object.keys(process.env).filter(key => {
|
|
1091
|
+
return /^debug_/i.test(key);
|
|
1092
|
+
}).reduce((obj, key) => {
|
|
1093
|
+
// Camel-case
|
|
1094
|
+
const prop = key
|
|
1095
|
+
.substring(6)
|
|
1096
|
+
.toLowerCase()
|
|
1097
|
+
.replace(/_([a-z])/g, (_, k) => {
|
|
1098
|
+
return k.toUpperCase();
|
|
1099
|
+
});
|
|
1100
|
+
|
|
1101
|
+
// Coerce string value into JS value
|
|
1102
|
+
let val = process.env[key];
|
|
1103
|
+
if (/^(yes|on|true|enabled)$/i.test(val)) {
|
|
1104
|
+
val = true;
|
|
1105
|
+
} else if (/^(no|off|false|disabled)$/i.test(val)) {
|
|
1106
|
+
val = false;
|
|
1107
|
+
} else if (val === 'null') {
|
|
1108
|
+
val = null;
|
|
1109
|
+
} else {
|
|
1110
|
+
val = Number(val);
|
|
1111
|
+
}
|
|
1112
|
+
|
|
1113
|
+
obj[prop] = val;
|
|
1114
|
+
return obj;
|
|
1115
|
+
}, {});
|
|
1116
|
+
|
|
1117
|
+
/**
|
|
1118
|
+
* Is stdout a TTY? Colored output is enabled when `true`.
|
|
1119
|
+
*/
|
|
1120
|
+
|
|
1121
|
+
function useColors() {
|
|
1122
|
+
return 'colors' in exports.inspectOpts ?
|
|
1123
|
+
Boolean(exports.inspectOpts.colors) :
|
|
1124
|
+
tty.isatty(process.stderr.fd);
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1127
|
+
/**
|
|
1128
|
+
* Adds ANSI color escape codes if enabled.
|
|
1129
|
+
*
|
|
1130
|
+
* @api public
|
|
1131
|
+
*/
|
|
1132
|
+
|
|
1133
|
+
function formatArgs(args) {
|
|
1134
|
+
const {namespace: name, useColors} = this;
|
|
1135
|
+
|
|
1136
|
+
if (useColors) {
|
|
1137
|
+
const c = this.color;
|
|
1138
|
+
const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c);
|
|
1139
|
+
const prefix = ` ${colorCode};1m${name} \u001B[0m`;
|
|
1140
|
+
|
|
1141
|
+
args[0] = prefix + args[0].split('\n').join('\n' + prefix);
|
|
1142
|
+
args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m');
|
|
1143
|
+
} else {
|
|
1144
|
+
args[0] = getDate() + name + ' ' + args[0];
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1147
|
+
|
|
1148
|
+
function getDate() {
|
|
1149
|
+
if (exports.inspectOpts.hideDate) {
|
|
1150
|
+
return '';
|
|
1151
|
+
}
|
|
1152
|
+
return new Date().toISOString() + ' ';
|
|
1153
|
+
}
|
|
1154
|
+
|
|
1155
|
+
/**
|
|
1156
|
+
* Invokes `util.format()` with the specified arguments and writes to stderr.
|
|
1157
|
+
*/
|
|
1158
|
+
|
|
1159
|
+
function log(...args) {
|
|
1160
|
+
return process.stderr.write(util.format(...args) + '\n');
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
/**
|
|
1164
|
+
* Save `namespaces`.
|
|
1165
|
+
*
|
|
1166
|
+
* @param {String} namespaces
|
|
1167
|
+
* @api private
|
|
1168
|
+
*/
|
|
1169
|
+
function save(namespaces) {
|
|
1170
|
+
if (namespaces) {
|
|
1171
|
+
process.env.DEBUG = namespaces;
|
|
1172
|
+
} else {
|
|
1173
|
+
// If you set a process.env field to null or undefined, it gets cast to the
|
|
1174
|
+
// string 'null' or 'undefined'. Just delete instead.
|
|
1175
|
+
delete process.env.DEBUG;
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1179
|
+
/**
|
|
1180
|
+
* Load `namespaces`.
|
|
1181
|
+
*
|
|
1182
|
+
* @return {String} returns the previously persisted debug modes
|
|
1183
|
+
* @api private
|
|
1184
|
+
*/
|
|
1185
|
+
|
|
1186
|
+
function load() {
|
|
1187
|
+
return process.env.DEBUG;
|
|
1188
|
+
}
|
|
1189
|
+
|
|
1190
|
+
/**
|
|
1191
|
+
* Init logic for `debug` instances.
|
|
1192
|
+
*
|
|
1193
|
+
* Create a new `inspectOpts` object in case `useColors` is set
|
|
1194
|
+
* differently for a particular `debug` instance.
|
|
1195
|
+
*/
|
|
1196
|
+
|
|
1197
|
+
function init(debug) {
|
|
1198
|
+
debug.inspectOpts = {};
|
|
1199
|
+
|
|
1200
|
+
const keys = Object.keys(exports.inspectOpts);
|
|
1201
|
+
for (let i = 0; i < keys.length; i++) {
|
|
1202
|
+
debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
|
|
1206
|
+
module.exports = requireCommon()(exports);
|
|
1207
|
+
|
|
1208
|
+
const {formatters} = module.exports;
|
|
1209
|
+
|
|
1210
|
+
/**
|
|
1211
|
+
* Map %o to `util.inspect()`, all on a single line.
|
|
1212
|
+
*/
|
|
1213
|
+
|
|
1214
|
+
formatters.o = function (v) {
|
|
1215
|
+
this.inspectOpts.colors = this.useColors;
|
|
1216
|
+
return util.inspect(v, this.inspectOpts)
|
|
1217
|
+
.split('\n')
|
|
1218
|
+
.map(str => str.trim())
|
|
1219
|
+
.join(' ');
|
|
1220
|
+
};
|
|
1221
|
+
|
|
1222
|
+
/**
|
|
1223
|
+
* Map %O to `util.inspect()`, allowing multiple lines if needed.
|
|
1224
|
+
*/
|
|
1225
|
+
|
|
1226
|
+
formatters.O = function (v) {
|
|
1227
|
+
this.inspectOpts.colors = this.useColors;
|
|
1228
|
+
return util.inspect(v, this.inspectOpts);
|
|
1229
|
+
};
|
|
1230
|
+
} (node, node.exports));
|
|
1231
|
+
return node.exports;
|
|
1232
|
+
}
|
|
216
1233
|
|
|
217
1234
|
/**
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
* Options:
|
|
221
|
-
*
|
|
222
|
-
* - `long` verbose formatting [false]
|
|
223
|
-
*
|
|
224
|
-
* @param {String|Number} val
|
|
225
|
-
* @param {Object} [options]
|
|
226
|
-
* @throws {Error} throw an error if val is not a non-empty string or a number
|
|
227
|
-
* @return {String|Number}
|
|
228
|
-
* @api public
|
|
1235
|
+
* Detect Electron renderer / nwjs process, which is node, but we should
|
|
1236
|
+
* treat as a browser.
|
|
229
1237
|
*/
|
|
230
1238
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
1239
|
+
(function (module) {
|
|
1240
|
+
if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
|
|
1241
|
+
module.exports = requireBrowser();
|
|
1242
|
+
} else {
|
|
1243
|
+
module.exports = requireNode();
|
|
1244
|
+
}
|
|
1245
|
+
} (src));
|
|
1246
|
+
|
|
1247
|
+
var debug = /*@__PURE__*/getDefaultExportFromCjs(src.exports);
|
|
1248
|
+
|
|
1249
|
+
var picomatch$1 = {exports: {}};
|
|
1250
|
+
|
|
1251
|
+
var utils$3 = {};
|
|
1252
|
+
|
|
1253
|
+
const path$2 = require$$0__default$1;
|
|
1254
|
+
const WIN_SLASH = '\\\\/';
|
|
1255
|
+
const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
|
1256
|
+
|
|
1257
|
+
/**
|
|
1258
|
+
* Posix glob regex
|
|
1259
|
+
*/
|
|
1260
|
+
|
|
1261
|
+
const DOT_LITERAL = '\\.';
|
|
1262
|
+
const PLUS_LITERAL = '\\+';
|
|
1263
|
+
const QMARK_LITERAL = '\\?';
|
|
1264
|
+
const SLASH_LITERAL = '\\/';
|
|
1265
|
+
const ONE_CHAR = '(?=.)';
|
|
1266
|
+
const QMARK = '[^/]';
|
|
1267
|
+
const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
|
|
1268
|
+
const START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
|
|
1269
|
+
const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
|
|
1270
|
+
const NO_DOT = `(?!${DOT_LITERAL})`;
|
|
1271
|
+
const NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
|
|
1272
|
+
const NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
|
|
1273
|
+
const NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
|
|
1274
|
+
const QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
|
|
1275
|
+
const STAR = `${QMARK}*?`;
|
|
1276
|
+
|
|
1277
|
+
const POSIX_CHARS = {
|
|
1278
|
+
DOT_LITERAL,
|
|
1279
|
+
PLUS_LITERAL,
|
|
1280
|
+
QMARK_LITERAL,
|
|
1281
|
+
SLASH_LITERAL,
|
|
1282
|
+
ONE_CHAR,
|
|
1283
|
+
QMARK,
|
|
1284
|
+
END_ANCHOR,
|
|
1285
|
+
DOTS_SLASH,
|
|
1286
|
+
NO_DOT,
|
|
1287
|
+
NO_DOTS,
|
|
1288
|
+
NO_DOT_SLASH,
|
|
1289
|
+
NO_DOTS_SLASH,
|
|
1290
|
+
QMARK_NO_DOT,
|
|
1291
|
+
STAR,
|
|
1292
|
+
START_ANCHOR
|
|
243
1293
|
};
|
|
244
1294
|
|
|
245
1295
|
/**
|
|
246
|
-
*
|
|
247
|
-
*
|
|
248
|
-
* @param {String} str
|
|
249
|
-
* @return {Number}
|
|
250
|
-
* @api private
|
|
1296
|
+
* Windows glob regex
|
|
251
1297
|
*/
|
|
252
1298
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
)
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
case 'year':
|
|
269
|
-
case 'yrs':
|
|
270
|
-
case 'yr':
|
|
271
|
-
case 'y':
|
|
272
|
-
return n * y;
|
|
273
|
-
case 'weeks':
|
|
274
|
-
case 'week':
|
|
275
|
-
case 'w':
|
|
276
|
-
return n * w;
|
|
277
|
-
case 'days':
|
|
278
|
-
case 'day':
|
|
279
|
-
case 'd':
|
|
280
|
-
return n * d;
|
|
281
|
-
case 'hours':
|
|
282
|
-
case 'hour':
|
|
283
|
-
case 'hrs':
|
|
284
|
-
case 'hr':
|
|
285
|
-
case 'h':
|
|
286
|
-
return n * h;
|
|
287
|
-
case 'minutes':
|
|
288
|
-
case 'minute':
|
|
289
|
-
case 'mins':
|
|
290
|
-
case 'min':
|
|
291
|
-
case 'm':
|
|
292
|
-
return n * m;
|
|
293
|
-
case 'seconds':
|
|
294
|
-
case 'second':
|
|
295
|
-
case 'secs':
|
|
296
|
-
case 'sec':
|
|
297
|
-
case 's':
|
|
298
|
-
return n * s;
|
|
299
|
-
case 'milliseconds':
|
|
300
|
-
case 'millisecond':
|
|
301
|
-
case 'msecs':
|
|
302
|
-
case 'msec':
|
|
303
|
-
case 'ms':
|
|
304
|
-
return n;
|
|
305
|
-
default:
|
|
306
|
-
return undefined;
|
|
307
|
-
}
|
|
308
|
-
}
|
|
1299
|
+
const WINDOWS_CHARS = {
|
|
1300
|
+
...POSIX_CHARS,
|
|
1301
|
+
|
|
1302
|
+
SLASH_LITERAL: `[${WIN_SLASH}]`,
|
|
1303
|
+
QMARK: WIN_NO_SLASH,
|
|
1304
|
+
STAR: `${WIN_NO_SLASH}*?`,
|
|
1305
|
+
DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
|
|
1306
|
+
NO_DOT: `(?!${DOT_LITERAL})`,
|
|
1307
|
+
NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
|
1308
|
+
NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
|
|
1309
|
+
NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
|
1310
|
+
QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
|
|
1311
|
+
START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
|
|
1312
|
+
END_ANCHOR: `(?:[${WIN_SLASH}]|$)`
|
|
1313
|
+
};
|
|
309
1314
|
|
|
310
1315
|
/**
|
|
311
|
-
*
|
|
312
|
-
*
|
|
313
|
-
* @param {Number} ms
|
|
314
|
-
* @return {String}
|
|
315
|
-
* @api private
|
|
1316
|
+
* POSIX Bracket Regex
|
|
316
1317
|
*/
|
|
317
1318
|
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
1319
|
+
const POSIX_REGEX_SOURCE$1 = {
|
|
1320
|
+
alnum: 'a-zA-Z0-9',
|
|
1321
|
+
alpha: 'a-zA-Z',
|
|
1322
|
+
ascii: '\\x00-\\x7F',
|
|
1323
|
+
blank: ' \\t',
|
|
1324
|
+
cntrl: '\\x00-\\x1F\\x7F',
|
|
1325
|
+
digit: '0-9',
|
|
1326
|
+
graph: '\\x21-\\x7E',
|
|
1327
|
+
lower: 'a-z',
|
|
1328
|
+
print: '\\x20-\\x7E ',
|
|
1329
|
+
punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~',
|
|
1330
|
+
space: ' \\t\\r\\n\\v\\f',
|
|
1331
|
+
upper: 'A-Z',
|
|
1332
|
+
word: 'A-Za-z0-9_',
|
|
1333
|
+
xdigit: 'A-Fa-f0-9'
|
|
1334
|
+
};
|
|
1335
|
+
|
|
1336
|
+
var constants$2 = {
|
|
1337
|
+
MAX_LENGTH: 1024 * 64,
|
|
1338
|
+
POSIX_REGEX_SOURCE: POSIX_REGEX_SOURCE$1,
|
|
1339
|
+
|
|
1340
|
+
// regular expressions
|
|
1341
|
+
REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
|
|
1342
|
+
REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
|
|
1343
|
+
REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
|
|
1344
|
+
REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
|
|
1345
|
+
REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
|
|
1346
|
+
REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
|
|
1347
|
+
|
|
1348
|
+
// Replace globs with equivalent patterns to reduce parsing time.
|
|
1349
|
+
REPLACEMENTS: {
|
|
1350
|
+
'***': '*',
|
|
1351
|
+
'**/**': '**',
|
|
1352
|
+
'**/**/**': '**'
|
|
1353
|
+
},
|
|
1354
|
+
|
|
1355
|
+
// Digits
|
|
1356
|
+
CHAR_0: 48, /* 0 */
|
|
1357
|
+
CHAR_9: 57, /* 9 */
|
|
1358
|
+
|
|
1359
|
+
// Alphabet chars.
|
|
1360
|
+
CHAR_UPPERCASE_A: 65, /* A */
|
|
1361
|
+
CHAR_LOWERCASE_A: 97, /* a */
|
|
1362
|
+
CHAR_UPPERCASE_Z: 90, /* Z */
|
|
1363
|
+
CHAR_LOWERCASE_Z: 122, /* z */
|
|
1364
|
+
|
|
1365
|
+
CHAR_LEFT_PARENTHESES: 40, /* ( */
|
|
1366
|
+
CHAR_RIGHT_PARENTHESES: 41, /* ) */
|
|
1367
|
+
|
|
1368
|
+
CHAR_ASTERISK: 42, /* * */
|
|
1369
|
+
|
|
1370
|
+
// Non-alphabetic chars.
|
|
1371
|
+
CHAR_AMPERSAND: 38, /* & */
|
|
1372
|
+
CHAR_AT: 64, /* @ */
|
|
1373
|
+
CHAR_BACKWARD_SLASH: 92, /* \ */
|
|
1374
|
+
CHAR_CARRIAGE_RETURN: 13, /* \r */
|
|
1375
|
+
CHAR_CIRCUMFLEX_ACCENT: 94, /* ^ */
|
|
1376
|
+
CHAR_COLON: 58, /* : */
|
|
1377
|
+
CHAR_COMMA: 44, /* , */
|
|
1378
|
+
CHAR_DOT: 46, /* . */
|
|
1379
|
+
CHAR_DOUBLE_QUOTE: 34, /* " */
|
|
1380
|
+
CHAR_EQUAL: 61, /* = */
|
|
1381
|
+
CHAR_EXCLAMATION_MARK: 33, /* ! */
|
|
1382
|
+
CHAR_FORM_FEED: 12, /* \f */
|
|
1383
|
+
CHAR_FORWARD_SLASH: 47, /* / */
|
|
1384
|
+
CHAR_GRAVE_ACCENT: 96, /* ` */
|
|
1385
|
+
CHAR_HASH: 35, /* # */
|
|
1386
|
+
CHAR_HYPHEN_MINUS: 45, /* - */
|
|
1387
|
+
CHAR_LEFT_ANGLE_BRACKET: 60, /* < */
|
|
1388
|
+
CHAR_LEFT_CURLY_BRACE: 123, /* { */
|
|
1389
|
+
CHAR_LEFT_SQUARE_BRACKET: 91, /* [ */
|
|
1390
|
+
CHAR_LINE_FEED: 10, /* \n */
|
|
1391
|
+
CHAR_NO_BREAK_SPACE: 160, /* \u00A0 */
|
|
1392
|
+
CHAR_PERCENT: 37, /* % */
|
|
1393
|
+
CHAR_PLUS: 43, /* + */
|
|
1394
|
+
CHAR_QUESTION_MARK: 63, /* ? */
|
|
1395
|
+
CHAR_RIGHT_ANGLE_BRACKET: 62, /* > */
|
|
1396
|
+
CHAR_RIGHT_CURLY_BRACE: 125, /* } */
|
|
1397
|
+
CHAR_RIGHT_SQUARE_BRACKET: 93, /* ] */
|
|
1398
|
+
CHAR_SEMICOLON: 59, /* ; */
|
|
1399
|
+
CHAR_SINGLE_QUOTE: 39, /* ' */
|
|
1400
|
+
CHAR_SPACE: 32, /* */
|
|
1401
|
+
CHAR_TAB: 9, /* \t */
|
|
1402
|
+
CHAR_UNDERSCORE: 95, /* _ */
|
|
1403
|
+
CHAR_VERTICAL_LINE: 124, /* | */
|
|
1404
|
+
CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, /* \uFEFF */
|
|
1405
|
+
|
|
1406
|
+
SEP: path$2.sep,
|
|
1407
|
+
|
|
1408
|
+
/**
|
|
1409
|
+
* Create EXTGLOB_CHARS
|
|
1410
|
+
*/
|
|
1411
|
+
|
|
1412
|
+
extglobChars(chars) {
|
|
1413
|
+
return {
|
|
1414
|
+
'!': { type: 'negate', open: '(?:(?!(?:', close: `))${chars.STAR})` },
|
|
1415
|
+
'?': { type: 'qmark', open: '(?:', close: ')?' },
|
|
1416
|
+
'+': { type: 'plus', open: '(?:', close: ')+' },
|
|
1417
|
+
'*': { type: 'star', open: '(?:', close: ')*' },
|
|
1418
|
+
'@': { type: 'at', open: '(?:', close: ')' }
|
|
1419
|
+
};
|
|
1420
|
+
},
|
|
1421
|
+
|
|
1422
|
+
/**
|
|
1423
|
+
* Create GLOB_CHARS
|
|
1424
|
+
*/
|
|
1425
|
+
|
|
1426
|
+
globChars(win32) {
|
|
1427
|
+
return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
|
|
328
1428
|
}
|
|
329
|
-
|
|
330
|
-
|
|
1429
|
+
};
|
|
1430
|
+
|
|
1431
|
+
(function (exports) {
|
|
1432
|
+
|
|
1433
|
+
const path = require$$0__default$1;
|
|
1434
|
+
const win32 = process.platform === 'win32';
|
|
1435
|
+
const {
|
|
1436
|
+
REGEX_BACKSLASH,
|
|
1437
|
+
REGEX_REMOVE_BACKSLASH,
|
|
1438
|
+
REGEX_SPECIAL_CHARS,
|
|
1439
|
+
REGEX_SPECIAL_CHARS_GLOBAL
|
|
1440
|
+
} = constants$2;
|
|
1441
|
+
|
|
1442
|
+
exports.isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val);
|
|
1443
|
+
exports.hasRegexChars = str => REGEX_SPECIAL_CHARS.test(str);
|
|
1444
|
+
exports.isRegexChar = str => str.length === 1 && exports.hasRegexChars(str);
|
|
1445
|
+
exports.escapeRegex = str => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\$1');
|
|
1446
|
+
exports.toPosixSlashes = str => str.replace(REGEX_BACKSLASH, '/');
|
|
1447
|
+
|
|
1448
|
+
exports.removeBackslashes = str => {
|
|
1449
|
+
return str.replace(REGEX_REMOVE_BACKSLASH, match => {
|
|
1450
|
+
return match === '\\' ? '' : match;
|
|
1451
|
+
});
|
|
1452
|
+
};
|
|
1453
|
+
|
|
1454
|
+
exports.supportsLookbehinds = () => {
|
|
1455
|
+
const segs = process.version.slice(1).split('.').map(Number);
|
|
1456
|
+
if (segs.length === 3 && segs[0] >= 9 || (segs[0] === 8 && segs[1] >= 10)) {
|
|
1457
|
+
return true;
|
|
1458
|
+
}
|
|
1459
|
+
return false;
|
|
1460
|
+
};
|
|
1461
|
+
|
|
1462
|
+
exports.isWindows = options => {
|
|
1463
|
+
if (options && typeof options.windows === 'boolean') {
|
|
1464
|
+
return options.windows;
|
|
1465
|
+
}
|
|
1466
|
+
return win32 === true || path.sep === '\\';
|
|
1467
|
+
};
|
|
1468
|
+
|
|
1469
|
+
exports.escapeLast = (input, char, lastIdx) => {
|
|
1470
|
+
const idx = input.lastIndexOf(char, lastIdx);
|
|
1471
|
+
if (idx === -1) return input;
|
|
1472
|
+
if (input[idx - 1] === '\\') return exports.escapeLast(input, char, idx - 1);
|
|
1473
|
+
return `${input.slice(0, idx)}\\${input.slice(idx)}`;
|
|
1474
|
+
};
|
|
1475
|
+
|
|
1476
|
+
exports.removePrefix = (input, state = {}) => {
|
|
1477
|
+
let output = input;
|
|
1478
|
+
if (output.startsWith('./')) {
|
|
1479
|
+
output = output.slice(2);
|
|
1480
|
+
state.prefix = './';
|
|
1481
|
+
}
|
|
1482
|
+
return output;
|
|
1483
|
+
};
|
|
1484
|
+
|
|
1485
|
+
exports.wrapOutput = (input, state = {}, options = {}) => {
|
|
1486
|
+
const prepend = options.contains ? '' : '^';
|
|
1487
|
+
const append = options.contains ? '' : '$';
|
|
1488
|
+
|
|
1489
|
+
let output = `${prepend}(?:${input})${append}`;
|
|
1490
|
+
if (state.negated === true) {
|
|
1491
|
+
output = `(?:^(?!${output}).*$)`;
|
|
1492
|
+
}
|
|
1493
|
+
return output;
|
|
1494
|
+
};
|
|
1495
|
+
} (utils$3));
|
|
1496
|
+
|
|
1497
|
+
const utils$2 = utils$3;
|
|
1498
|
+
const {
|
|
1499
|
+
CHAR_ASTERISK, /* * */
|
|
1500
|
+
CHAR_AT, /* @ */
|
|
1501
|
+
CHAR_BACKWARD_SLASH, /* \ */
|
|
1502
|
+
CHAR_COMMA, /* , */
|
|
1503
|
+
CHAR_DOT, /* . */
|
|
1504
|
+
CHAR_EXCLAMATION_MARK, /* ! */
|
|
1505
|
+
CHAR_FORWARD_SLASH, /* / */
|
|
1506
|
+
CHAR_LEFT_CURLY_BRACE, /* { */
|
|
1507
|
+
CHAR_LEFT_PARENTHESES, /* ( */
|
|
1508
|
+
CHAR_LEFT_SQUARE_BRACKET, /* [ */
|
|
1509
|
+
CHAR_PLUS, /* + */
|
|
1510
|
+
CHAR_QUESTION_MARK, /* ? */
|
|
1511
|
+
CHAR_RIGHT_CURLY_BRACE, /* } */
|
|
1512
|
+
CHAR_RIGHT_PARENTHESES, /* ) */
|
|
1513
|
+
CHAR_RIGHT_SQUARE_BRACKET /* ] */
|
|
1514
|
+
} = constants$2;
|
|
1515
|
+
|
|
1516
|
+
const isPathSeparator = code => {
|
|
1517
|
+
return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
|
|
1518
|
+
};
|
|
1519
|
+
|
|
1520
|
+
const depth = token => {
|
|
1521
|
+
if (token.isPrefix !== true) {
|
|
1522
|
+
token.depth = token.isGlobstar ? Infinity : 1;
|
|
331
1523
|
}
|
|
332
|
-
|
|
333
|
-
}
|
|
1524
|
+
};
|
|
334
1525
|
|
|
335
1526
|
/**
|
|
336
|
-
*
|
|
1527
|
+
* Quickly scans a glob pattern and returns an object with a handful of
|
|
1528
|
+
* useful properties, like `isGlob`, `path` (the leading non-glob, if it exists),
|
|
1529
|
+
* `glob` (the actual pattern), `negated` (true if the path starts with `!` but not
|
|
1530
|
+
* with `!(`) and `negatedExtglob` (true if the path starts with `!(`).
|
|
337
1531
|
*
|
|
338
|
-
*
|
|
339
|
-
*
|
|
340
|
-
*
|
|
1532
|
+
* ```js
|
|
1533
|
+
* const pm = require('picomatch');
|
|
1534
|
+
* console.log(pm.scan('foo/bar/*.js'));
|
|
1535
|
+
* { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' }
|
|
1536
|
+
* ```
|
|
1537
|
+
* @param {String} `str`
|
|
1538
|
+
* @param {Object} `options`
|
|
1539
|
+
* @return {Object} Returns an object with tokens and regex source string.
|
|
1540
|
+
* @api public
|
|
341
1541
|
*/
|
|
342
1542
|
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
1543
|
+
const scan$1 = (input, options) => {
|
|
1544
|
+
const opts = options || {};
|
|
1545
|
+
|
|
1546
|
+
const length = input.length - 1;
|
|
1547
|
+
const scanToEnd = opts.parts === true || opts.scanToEnd === true;
|
|
1548
|
+
const slashes = [];
|
|
1549
|
+
const tokens = [];
|
|
1550
|
+
const parts = [];
|
|
1551
|
+
|
|
1552
|
+
let str = input;
|
|
1553
|
+
let index = -1;
|
|
1554
|
+
let start = 0;
|
|
1555
|
+
let lastIndex = 0;
|
|
1556
|
+
let isBrace = false;
|
|
1557
|
+
let isBracket = false;
|
|
1558
|
+
let isGlob = false;
|
|
1559
|
+
let isExtglob = false;
|
|
1560
|
+
let isGlobstar = false;
|
|
1561
|
+
let braceEscaped = false;
|
|
1562
|
+
let backslashes = false;
|
|
1563
|
+
let negated = false;
|
|
1564
|
+
let negatedExtglob = false;
|
|
1565
|
+
let finished = false;
|
|
1566
|
+
let braces = 0;
|
|
1567
|
+
let prev;
|
|
1568
|
+
let code;
|
|
1569
|
+
let token = { value: '', depth: 0, isGlob: false };
|
|
1570
|
+
|
|
1571
|
+
const eos = () => index >= length;
|
|
1572
|
+
const peek = () => str.charCodeAt(index + 1);
|
|
1573
|
+
const advance = () => {
|
|
1574
|
+
prev = code;
|
|
1575
|
+
return str.charCodeAt(++index);
|
|
1576
|
+
};
|
|
1577
|
+
|
|
1578
|
+
while (index < length) {
|
|
1579
|
+
code = advance();
|
|
1580
|
+
let next;
|
|
1581
|
+
|
|
1582
|
+
if (code === CHAR_BACKWARD_SLASH) {
|
|
1583
|
+
backslashes = token.backslashes = true;
|
|
1584
|
+
code = advance();
|
|
1585
|
+
|
|
1586
|
+
if (code === CHAR_LEFT_CURLY_BRACE) {
|
|
1587
|
+
braceEscaped = true;
|
|
1588
|
+
}
|
|
1589
|
+
continue;
|
|
1590
|
+
}
|
|
1591
|
+
|
|
1592
|
+
if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
|
|
1593
|
+
braces++;
|
|
1594
|
+
|
|
1595
|
+
while (eos() !== true && (code = advance())) {
|
|
1596
|
+
if (code === CHAR_BACKWARD_SLASH) {
|
|
1597
|
+
backslashes = token.backslashes = true;
|
|
1598
|
+
advance();
|
|
1599
|
+
continue;
|
|
1600
|
+
}
|
|
1601
|
+
|
|
1602
|
+
if (code === CHAR_LEFT_CURLY_BRACE) {
|
|
1603
|
+
braces++;
|
|
1604
|
+
continue;
|
|
1605
|
+
}
|
|
1606
|
+
|
|
1607
|
+
if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
|
|
1608
|
+
isBrace = token.isBrace = true;
|
|
1609
|
+
isGlob = token.isGlob = true;
|
|
1610
|
+
finished = true;
|
|
1611
|
+
|
|
1612
|
+
if (scanToEnd === true) {
|
|
1613
|
+
continue;
|
|
1614
|
+
}
|
|
1615
|
+
|
|
1616
|
+
break;
|
|
1617
|
+
}
|
|
1618
|
+
|
|
1619
|
+
if (braceEscaped !== true && code === CHAR_COMMA) {
|
|
1620
|
+
isBrace = token.isBrace = true;
|
|
1621
|
+
isGlob = token.isGlob = true;
|
|
1622
|
+
finished = true;
|
|
1623
|
+
|
|
1624
|
+
if (scanToEnd === true) {
|
|
1625
|
+
continue;
|
|
1626
|
+
}
|
|
1627
|
+
|
|
1628
|
+
break;
|
|
1629
|
+
}
|
|
1630
|
+
|
|
1631
|
+
if (code === CHAR_RIGHT_CURLY_BRACE) {
|
|
1632
|
+
braces--;
|
|
1633
|
+
|
|
1634
|
+
if (braces === 0) {
|
|
1635
|
+
braceEscaped = false;
|
|
1636
|
+
isBrace = token.isBrace = true;
|
|
1637
|
+
finished = true;
|
|
1638
|
+
break;
|
|
1639
|
+
}
|
|
1640
|
+
}
|
|
1641
|
+
}
|
|
1642
|
+
|
|
1643
|
+
if (scanToEnd === true) {
|
|
1644
|
+
continue;
|
|
1645
|
+
}
|
|
1646
|
+
|
|
1647
|
+
break;
|
|
1648
|
+
}
|
|
1649
|
+
|
|
1650
|
+
if (code === CHAR_FORWARD_SLASH) {
|
|
1651
|
+
slashes.push(index);
|
|
1652
|
+
tokens.push(token);
|
|
1653
|
+
token = { value: '', depth: 0, isGlob: false };
|
|
1654
|
+
|
|
1655
|
+
if (finished === true) continue;
|
|
1656
|
+
if (prev === CHAR_DOT && index === (start + 1)) {
|
|
1657
|
+
start += 2;
|
|
1658
|
+
continue;
|
|
1659
|
+
}
|
|
1660
|
+
|
|
1661
|
+
lastIndex = index + 1;
|
|
1662
|
+
continue;
|
|
1663
|
+
}
|
|
1664
|
+
|
|
1665
|
+
if (opts.noext !== true) {
|
|
1666
|
+
const isExtglobChar = code === CHAR_PLUS
|
|
1667
|
+
|| code === CHAR_AT
|
|
1668
|
+
|| code === CHAR_ASTERISK
|
|
1669
|
+
|| code === CHAR_QUESTION_MARK
|
|
1670
|
+
|| code === CHAR_EXCLAMATION_MARK;
|
|
1671
|
+
|
|
1672
|
+
if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) {
|
|
1673
|
+
isGlob = token.isGlob = true;
|
|
1674
|
+
isExtglob = token.isExtglob = true;
|
|
1675
|
+
finished = true;
|
|
1676
|
+
if (code === CHAR_EXCLAMATION_MARK && index === start) {
|
|
1677
|
+
negatedExtglob = true;
|
|
1678
|
+
}
|
|
1679
|
+
|
|
1680
|
+
if (scanToEnd === true) {
|
|
1681
|
+
while (eos() !== true && (code = advance())) {
|
|
1682
|
+
if (code === CHAR_BACKWARD_SLASH) {
|
|
1683
|
+
backslashes = token.backslashes = true;
|
|
1684
|
+
code = advance();
|
|
1685
|
+
continue;
|
|
1686
|
+
}
|
|
1687
|
+
|
|
1688
|
+
if (code === CHAR_RIGHT_PARENTHESES) {
|
|
1689
|
+
isGlob = token.isGlob = true;
|
|
1690
|
+
finished = true;
|
|
1691
|
+
break;
|
|
1692
|
+
}
|
|
1693
|
+
}
|
|
1694
|
+
continue;
|
|
1695
|
+
}
|
|
1696
|
+
break;
|
|
1697
|
+
}
|
|
1698
|
+
}
|
|
1699
|
+
|
|
1700
|
+
if (code === CHAR_ASTERISK) {
|
|
1701
|
+
if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
|
|
1702
|
+
isGlob = token.isGlob = true;
|
|
1703
|
+
finished = true;
|
|
1704
|
+
|
|
1705
|
+
if (scanToEnd === true) {
|
|
1706
|
+
continue;
|
|
1707
|
+
}
|
|
1708
|
+
break;
|
|
1709
|
+
}
|
|
1710
|
+
|
|
1711
|
+
if (code === CHAR_QUESTION_MARK) {
|
|
1712
|
+
isGlob = token.isGlob = true;
|
|
1713
|
+
finished = true;
|
|
1714
|
+
|
|
1715
|
+
if (scanToEnd === true) {
|
|
1716
|
+
continue;
|
|
1717
|
+
}
|
|
1718
|
+
break;
|
|
1719
|
+
}
|
|
1720
|
+
|
|
1721
|
+
if (code === CHAR_LEFT_SQUARE_BRACKET) {
|
|
1722
|
+
while (eos() !== true && (next = advance())) {
|
|
1723
|
+
if (next === CHAR_BACKWARD_SLASH) {
|
|
1724
|
+
backslashes = token.backslashes = true;
|
|
1725
|
+
advance();
|
|
1726
|
+
continue;
|
|
1727
|
+
}
|
|
1728
|
+
|
|
1729
|
+
if (next === CHAR_RIGHT_SQUARE_BRACKET) {
|
|
1730
|
+
isBracket = token.isBracket = true;
|
|
1731
|
+
isGlob = token.isGlob = true;
|
|
1732
|
+
finished = true;
|
|
1733
|
+
break;
|
|
1734
|
+
}
|
|
1735
|
+
}
|
|
1736
|
+
|
|
1737
|
+
if (scanToEnd === true) {
|
|
1738
|
+
continue;
|
|
1739
|
+
}
|
|
1740
|
+
|
|
1741
|
+
break;
|
|
1742
|
+
}
|
|
1743
|
+
|
|
1744
|
+
if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
|
|
1745
|
+
negated = token.negated = true;
|
|
1746
|
+
start++;
|
|
1747
|
+
continue;
|
|
1748
|
+
}
|
|
1749
|
+
|
|
1750
|
+
if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
|
|
1751
|
+
isGlob = token.isGlob = true;
|
|
1752
|
+
|
|
1753
|
+
if (scanToEnd === true) {
|
|
1754
|
+
while (eos() !== true && (code = advance())) {
|
|
1755
|
+
if (code === CHAR_LEFT_PARENTHESES) {
|
|
1756
|
+
backslashes = token.backslashes = true;
|
|
1757
|
+
code = advance();
|
|
1758
|
+
continue;
|
|
1759
|
+
}
|
|
1760
|
+
|
|
1761
|
+
if (code === CHAR_RIGHT_PARENTHESES) {
|
|
1762
|
+
finished = true;
|
|
1763
|
+
break;
|
|
1764
|
+
}
|
|
1765
|
+
}
|
|
1766
|
+
continue;
|
|
1767
|
+
}
|
|
1768
|
+
break;
|
|
1769
|
+
}
|
|
1770
|
+
|
|
1771
|
+
if (isGlob === true) {
|
|
1772
|
+
finished = true;
|
|
1773
|
+
|
|
1774
|
+
if (scanToEnd === true) {
|
|
1775
|
+
continue;
|
|
1776
|
+
}
|
|
1777
|
+
|
|
1778
|
+
break;
|
|
1779
|
+
}
|
|
1780
|
+
}
|
|
1781
|
+
|
|
1782
|
+
if (opts.noext === true) {
|
|
1783
|
+
isExtglob = false;
|
|
1784
|
+
isGlob = false;
|
|
1785
|
+
}
|
|
1786
|
+
|
|
1787
|
+
let base = str;
|
|
1788
|
+
let prefix = '';
|
|
1789
|
+
let glob = '';
|
|
1790
|
+
|
|
1791
|
+
if (start > 0) {
|
|
1792
|
+
prefix = str.slice(0, start);
|
|
1793
|
+
str = str.slice(start);
|
|
1794
|
+
lastIndex -= start;
|
|
1795
|
+
}
|
|
1796
|
+
|
|
1797
|
+
if (base && isGlob === true && lastIndex > 0) {
|
|
1798
|
+
base = str.slice(0, lastIndex);
|
|
1799
|
+
glob = str.slice(lastIndex);
|
|
1800
|
+
} else if (isGlob === true) {
|
|
1801
|
+
base = '';
|
|
1802
|
+
glob = str;
|
|
1803
|
+
} else {
|
|
1804
|
+
base = str;
|
|
1805
|
+
}
|
|
1806
|
+
|
|
1807
|
+
if (base && base !== '' && base !== '/' && base !== str) {
|
|
1808
|
+
if (isPathSeparator(base.charCodeAt(base.length - 1))) {
|
|
1809
|
+
base = base.slice(0, -1);
|
|
1810
|
+
}
|
|
1811
|
+
}
|
|
1812
|
+
|
|
1813
|
+
if (opts.unescape === true) {
|
|
1814
|
+
if (glob) glob = utils$2.removeBackslashes(glob);
|
|
1815
|
+
|
|
1816
|
+
if (base && backslashes === true) {
|
|
1817
|
+
base = utils$2.removeBackslashes(base);
|
|
1818
|
+
}
|
|
1819
|
+
}
|
|
1820
|
+
|
|
1821
|
+
const state = {
|
|
1822
|
+
prefix,
|
|
1823
|
+
input,
|
|
1824
|
+
start,
|
|
1825
|
+
base,
|
|
1826
|
+
glob,
|
|
1827
|
+
isBrace,
|
|
1828
|
+
isBracket,
|
|
1829
|
+
isGlob,
|
|
1830
|
+
isExtglob,
|
|
1831
|
+
isGlobstar,
|
|
1832
|
+
negated,
|
|
1833
|
+
negatedExtglob
|
|
1834
|
+
};
|
|
1835
|
+
|
|
1836
|
+
if (opts.tokens === true) {
|
|
1837
|
+
state.maxDepth = 0;
|
|
1838
|
+
if (!isPathSeparator(code)) {
|
|
1839
|
+
tokens.push(token);
|
|
1840
|
+
}
|
|
1841
|
+
state.tokens = tokens;
|
|
1842
|
+
}
|
|
1843
|
+
|
|
1844
|
+
if (opts.parts === true || opts.tokens === true) {
|
|
1845
|
+
let prevIndex;
|
|
1846
|
+
|
|
1847
|
+
for (let idx = 0; idx < slashes.length; idx++) {
|
|
1848
|
+
const n = prevIndex ? prevIndex + 1 : start;
|
|
1849
|
+
const i = slashes[idx];
|
|
1850
|
+
const value = input.slice(n, i);
|
|
1851
|
+
if (opts.tokens) {
|
|
1852
|
+
if (idx === 0 && start !== 0) {
|
|
1853
|
+
tokens[idx].isPrefix = true;
|
|
1854
|
+
tokens[idx].value = prefix;
|
|
1855
|
+
} else {
|
|
1856
|
+
tokens[idx].value = value;
|
|
1857
|
+
}
|
|
1858
|
+
depth(tokens[idx]);
|
|
1859
|
+
state.maxDepth += tokens[idx].depth;
|
|
1860
|
+
}
|
|
1861
|
+
if (idx !== 0 || value !== '') {
|
|
1862
|
+
parts.push(value);
|
|
1863
|
+
}
|
|
1864
|
+
prevIndex = i;
|
|
1865
|
+
}
|
|
1866
|
+
|
|
1867
|
+
if (prevIndex && prevIndex + 1 < input.length) {
|
|
1868
|
+
const value = input.slice(prevIndex + 1);
|
|
1869
|
+
parts.push(value);
|
|
1870
|
+
|
|
1871
|
+
if (opts.tokens) {
|
|
1872
|
+
tokens[tokens.length - 1].value = value;
|
|
1873
|
+
depth(tokens[tokens.length - 1]);
|
|
1874
|
+
state.maxDepth += tokens[tokens.length - 1].depth;
|
|
1875
|
+
}
|
|
1876
|
+
}
|
|
1877
|
+
|
|
1878
|
+
state.slashes = slashes;
|
|
1879
|
+
state.parts = parts;
|
|
1880
|
+
}
|
|
1881
|
+
|
|
1882
|
+
return state;
|
|
1883
|
+
};
|
|
1884
|
+
|
|
1885
|
+
var scan_1 = scan$1;
|
|
1886
|
+
|
|
1887
|
+
const constants$1 = constants$2;
|
|
1888
|
+
const utils$1 = utils$3;
|
|
1889
|
+
|
|
1890
|
+
/**
|
|
1891
|
+
* Constants
|
|
1892
|
+
*/
|
|
1893
|
+
|
|
1894
|
+
const {
|
|
1895
|
+
MAX_LENGTH,
|
|
1896
|
+
POSIX_REGEX_SOURCE,
|
|
1897
|
+
REGEX_NON_SPECIAL_CHARS,
|
|
1898
|
+
REGEX_SPECIAL_CHARS_BACKREF,
|
|
1899
|
+
REPLACEMENTS
|
|
1900
|
+
} = constants$1;
|
|
1901
|
+
|
|
1902
|
+
/**
|
|
1903
|
+
* Helpers
|
|
1904
|
+
*/
|
|
1905
|
+
|
|
1906
|
+
const expandRange = (args, options) => {
|
|
1907
|
+
if (typeof options.expandRange === 'function') {
|
|
1908
|
+
return options.expandRange(...args, options);
|
|
1909
|
+
}
|
|
1910
|
+
|
|
1911
|
+
args.sort();
|
|
1912
|
+
const value = `[${args.join('-')}]`;
|
|
1913
|
+
|
|
1914
|
+
return value;
|
|
1915
|
+
};
|
|
1916
|
+
|
|
1917
|
+
/**
|
|
1918
|
+
* Create the message for a syntax error
|
|
1919
|
+
*/
|
|
1920
|
+
|
|
1921
|
+
const syntaxError = (type, char) => {
|
|
1922
|
+
return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
|
|
1923
|
+
};
|
|
1924
|
+
|
|
1925
|
+
/**
|
|
1926
|
+
* Parse the given input string.
|
|
1927
|
+
* @param {String} input
|
|
1928
|
+
* @param {Object} options
|
|
1929
|
+
* @return {Object}
|
|
1930
|
+
*/
|
|
1931
|
+
|
|
1932
|
+
const parse$2 = (input, options) => {
|
|
1933
|
+
if (typeof input !== 'string') {
|
|
1934
|
+
throw new TypeError('Expected a string');
|
|
1935
|
+
}
|
|
1936
|
+
|
|
1937
|
+
input = REPLACEMENTS[input] || input;
|
|
1938
|
+
|
|
1939
|
+
const opts = { ...options };
|
|
1940
|
+
const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
|
1941
|
+
|
|
1942
|
+
let len = input.length;
|
|
1943
|
+
if (len > max) {
|
|
1944
|
+
throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
|
|
1945
|
+
}
|
|
1946
|
+
|
|
1947
|
+
const bos = { type: 'bos', value: '', output: opts.prepend || '' };
|
|
1948
|
+
const tokens = [bos];
|
|
1949
|
+
|
|
1950
|
+
const capture = opts.capture ? '' : '?:';
|
|
1951
|
+
const win32 = utils$1.isWindows(options);
|
|
1952
|
+
|
|
1953
|
+
// create constants based on platform, for windows or posix
|
|
1954
|
+
const PLATFORM_CHARS = constants$1.globChars(win32);
|
|
1955
|
+
const EXTGLOB_CHARS = constants$1.extglobChars(PLATFORM_CHARS);
|
|
1956
|
+
|
|
1957
|
+
const {
|
|
1958
|
+
DOT_LITERAL,
|
|
1959
|
+
PLUS_LITERAL,
|
|
1960
|
+
SLASH_LITERAL,
|
|
1961
|
+
ONE_CHAR,
|
|
1962
|
+
DOTS_SLASH,
|
|
1963
|
+
NO_DOT,
|
|
1964
|
+
NO_DOT_SLASH,
|
|
1965
|
+
NO_DOTS_SLASH,
|
|
1966
|
+
QMARK,
|
|
1967
|
+
QMARK_NO_DOT,
|
|
1968
|
+
STAR,
|
|
1969
|
+
START_ANCHOR
|
|
1970
|
+
} = PLATFORM_CHARS;
|
|
1971
|
+
|
|
1972
|
+
const globstar = opts => {
|
|
1973
|
+
return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
|
|
1974
|
+
};
|
|
1975
|
+
|
|
1976
|
+
const nodot = opts.dot ? '' : NO_DOT;
|
|
1977
|
+
const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
|
|
1978
|
+
let star = opts.bash === true ? globstar(opts) : STAR;
|
|
1979
|
+
|
|
1980
|
+
if (opts.capture) {
|
|
1981
|
+
star = `(${star})`;
|
|
1982
|
+
}
|
|
1983
|
+
|
|
1984
|
+
// minimatch options support
|
|
1985
|
+
if (typeof opts.noext === 'boolean') {
|
|
1986
|
+
opts.noextglob = opts.noext;
|
|
1987
|
+
}
|
|
1988
|
+
|
|
1989
|
+
const state = {
|
|
1990
|
+
input,
|
|
1991
|
+
index: -1,
|
|
1992
|
+
start: 0,
|
|
1993
|
+
dot: opts.dot === true,
|
|
1994
|
+
consumed: '',
|
|
1995
|
+
output: '',
|
|
1996
|
+
prefix: '',
|
|
1997
|
+
backtrack: false,
|
|
1998
|
+
negated: false,
|
|
1999
|
+
brackets: 0,
|
|
2000
|
+
braces: 0,
|
|
2001
|
+
parens: 0,
|
|
2002
|
+
quotes: 0,
|
|
2003
|
+
globstar: false,
|
|
2004
|
+
tokens
|
|
2005
|
+
};
|
|
2006
|
+
|
|
2007
|
+
input = utils$1.removePrefix(input, state);
|
|
2008
|
+
len = input.length;
|
|
2009
|
+
|
|
2010
|
+
const extglobs = [];
|
|
2011
|
+
const braces = [];
|
|
2012
|
+
const stack = [];
|
|
2013
|
+
let prev = bos;
|
|
2014
|
+
let value;
|
|
2015
|
+
|
|
2016
|
+
/**
|
|
2017
|
+
* Tokenizing helpers
|
|
2018
|
+
*/
|
|
2019
|
+
|
|
2020
|
+
const eos = () => state.index === len - 1;
|
|
2021
|
+
const peek = state.peek = (n = 1) => input[state.index + n];
|
|
2022
|
+
const advance = state.advance = () => input[++state.index] || '';
|
|
2023
|
+
const remaining = () => input.slice(state.index + 1);
|
|
2024
|
+
const consume = (value = '', num = 0) => {
|
|
2025
|
+
state.consumed += value;
|
|
2026
|
+
state.index += num;
|
|
2027
|
+
};
|
|
2028
|
+
|
|
2029
|
+
const append = token => {
|
|
2030
|
+
state.output += token.output != null ? token.output : token.value;
|
|
2031
|
+
consume(token.value);
|
|
2032
|
+
};
|
|
2033
|
+
|
|
2034
|
+
const negate = () => {
|
|
2035
|
+
let count = 1;
|
|
2036
|
+
|
|
2037
|
+
while (peek() === '!' && (peek(2) !== '(' || peek(3) === '?')) {
|
|
2038
|
+
advance();
|
|
2039
|
+
state.start++;
|
|
2040
|
+
count++;
|
|
2041
|
+
}
|
|
2042
|
+
|
|
2043
|
+
if (count % 2 === 0) {
|
|
2044
|
+
return false;
|
|
2045
|
+
}
|
|
2046
|
+
|
|
2047
|
+
state.negated = true;
|
|
2048
|
+
state.start++;
|
|
2049
|
+
return true;
|
|
2050
|
+
};
|
|
2051
|
+
|
|
2052
|
+
const increment = type => {
|
|
2053
|
+
state[type]++;
|
|
2054
|
+
stack.push(type);
|
|
2055
|
+
};
|
|
2056
|
+
|
|
2057
|
+
const decrement = type => {
|
|
2058
|
+
state[type]--;
|
|
2059
|
+
stack.pop();
|
|
2060
|
+
};
|
|
2061
|
+
|
|
2062
|
+
/**
|
|
2063
|
+
* Push tokens onto the tokens array. This helper speeds up
|
|
2064
|
+
* tokenizing by 1) helping us avoid backtracking as much as possible,
|
|
2065
|
+
* and 2) helping us avoid creating extra tokens when consecutive
|
|
2066
|
+
* characters are plain text. This improves performance and simplifies
|
|
2067
|
+
* lookbehinds.
|
|
2068
|
+
*/
|
|
2069
|
+
|
|
2070
|
+
const push = tok => {
|
|
2071
|
+
if (prev.type === 'globstar') {
|
|
2072
|
+
const isBrace = state.braces > 0 && (tok.type === 'comma' || tok.type === 'brace');
|
|
2073
|
+
const isExtglob = tok.extglob === true || (extglobs.length && (tok.type === 'pipe' || tok.type === 'paren'));
|
|
2074
|
+
|
|
2075
|
+
if (tok.type !== 'slash' && tok.type !== 'paren' && !isBrace && !isExtglob) {
|
|
2076
|
+
state.output = state.output.slice(0, -prev.output.length);
|
|
2077
|
+
prev.type = 'star';
|
|
2078
|
+
prev.value = '*';
|
|
2079
|
+
prev.output = star;
|
|
2080
|
+
state.output += prev.output;
|
|
2081
|
+
}
|
|
2082
|
+
}
|
|
2083
|
+
|
|
2084
|
+
if (extglobs.length && tok.type !== 'paren') {
|
|
2085
|
+
extglobs[extglobs.length - 1].inner += tok.value;
|
|
2086
|
+
}
|
|
2087
|
+
|
|
2088
|
+
if (tok.value || tok.output) append(tok);
|
|
2089
|
+
if (prev && prev.type === 'text' && tok.type === 'text') {
|
|
2090
|
+
prev.value += tok.value;
|
|
2091
|
+
prev.output = (prev.output || '') + tok.value;
|
|
2092
|
+
return;
|
|
2093
|
+
}
|
|
2094
|
+
|
|
2095
|
+
tok.prev = prev;
|
|
2096
|
+
tokens.push(tok);
|
|
2097
|
+
prev = tok;
|
|
2098
|
+
};
|
|
2099
|
+
|
|
2100
|
+
const extglobOpen = (type, value) => {
|
|
2101
|
+
const token = { ...EXTGLOB_CHARS[value], conditions: 1, inner: '' };
|
|
2102
|
+
|
|
2103
|
+
token.prev = prev;
|
|
2104
|
+
token.parens = state.parens;
|
|
2105
|
+
token.output = state.output;
|
|
2106
|
+
const output = (opts.capture ? '(' : '') + token.open;
|
|
2107
|
+
|
|
2108
|
+
increment('parens');
|
|
2109
|
+
push({ type, value, output: state.output ? '' : ONE_CHAR });
|
|
2110
|
+
push({ type: 'paren', extglob: true, value: advance(), output });
|
|
2111
|
+
extglobs.push(token);
|
|
2112
|
+
};
|
|
2113
|
+
|
|
2114
|
+
const extglobClose = token => {
|
|
2115
|
+
let output = token.close + (opts.capture ? ')' : '');
|
|
2116
|
+
let rest;
|
|
2117
|
+
|
|
2118
|
+
if (token.type === 'negate') {
|
|
2119
|
+
let extglobStar = star;
|
|
2120
|
+
|
|
2121
|
+
if (token.inner && token.inner.length > 1 && token.inner.includes('/')) {
|
|
2122
|
+
extglobStar = globstar(opts);
|
|
2123
|
+
}
|
|
2124
|
+
|
|
2125
|
+
if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) {
|
|
2126
|
+
output = token.close = `)$))${extglobStar}`;
|
|
2127
|
+
}
|
|
2128
|
+
|
|
2129
|
+
if (token.inner.includes('*') && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
|
|
2130
|
+
// Any non-magical string (`.ts`) or even nested expression (`.{ts,tsx}`) can follow after the closing parenthesis.
|
|
2131
|
+
// In this case, we need to parse the string and use it in the output of the original pattern.
|
|
2132
|
+
// Suitable patterns: `/!(*.d).ts`, `/!(*.d).{ts,tsx}`, `**/!(*-dbg).@(js)`.
|
|
2133
|
+
//
|
|
2134
|
+
// Disabling the `fastpaths` option due to a problem with parsing strings as `.ts` in the pattern like `**/!(*.d).ts`.
|
|
2135
|
+
const expression = parse$2(rest, { ...options, fastpaths: false }).output;
|
|
2136
|
+
|
|
2137
|
+
output = token.close = `)${expression})${extglobStar})`;
|
|
2138
|
+
}
|
|
2139
|
+
|
|
2140
|
+
if (token.prev.type === 'bos') {
|
|
2141
|
+
state.negatedExtglob = true;
|
|
2142
|
+
}
|
|
2143
|
+
}
|
|
2144
|
+
|
|
2145
|
+
push({ type: 'paren', extglob: true, value, output });
|
|
2146
|
+
decrement('parens');
|
|
2147
|
+
};
|
|
2148
|
+
|
|
2149
|
+
/**
|
|
2150
|
+
* Fast paths
|
|
2151
|
+
*/
|
|
2152
|
+
|
|
2153
|
+
if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
|
|
2154
|
+
let backslashes = false;
|
|
2155
|
+
|
|
2156
|
+
let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
|
|
2157
|
+
if (first === '\\') {
|
|
2158
|
+
backslashes = true;
|
|
2159
|
+
return m;
|
|
2160
|
+
}
|
|
2161
|
+
|
|
2162
|
+
if (first === '?') {
|
|
2163
|
+
if (esc) {
|
|
2164
|
+
return esc + first + (rest ? QMARK.repeat(rest.length) : '');
|
|
2165
|
+
}
|
|
2166
|
+
if (index === 0) {
|
|
2167
|
+
return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : '');
|
|
2168
|
+
}
|
|
2169
|
+
return QMARK.repeat(chars.length);
|
|
2170
|
+
}
|
|
2171
|
+
|
|
2172
|
+
if (first === '.') {
|
|
2173
|
+
return DOT_LITERAL.repeat(chars.length);
|
|
2174
|
+
}
|
|
2175
|
+
|
|
2176
|
+
if (first === '*') {
|
|
2177
|
+
if (esc) {
|
|
2178
|
+
return esc + first + (rest ? star : '');
|
|
2179
|
+
}
|
|
2180
|
+
return star;
|
|
2181
|
+
}
|
|
2182
|
+
return esc ? m : `\\${m}`;
|
|
2183
|
+
});
|
|
2184
|
+
|
|
2185
|
+
if (backslashes === true) {
|
|
2186
|
+
if (opts.unescape === true) {
|
|
2187
|
+
output = output.replace(/\\/g, '');
|
|
2188
|
+
} else {
|
|
2189
|
+
output = output.replace(/\\+/g, m => {
|
|
2190
|
+
return m.length % 2 === 0 ? '\\\\' : (m ? '\\' : '');
|
|
2191
|
+
});
|
|
2192
|
+
}
|
|
2193
|
+
}
|
|
2194
|
+
|
|
2195
|
+
if (output === input && opts.contains === true) {
|
|
2196
|
+
state.output = input;
|
|
2197
|
+
return state;
|
|
2198
|
+
}
|
|
2199
|
+
|
|
2200
|
+
state.output = utils$1.wrapOutput(output, state, options);
|
|
2201
|
+
return state;
|
|
2202
|
+
}
|
|
2203
|
+
|
|
2204
|
+
/**
|
|
2205
|
+
* Tokenize input until we reach end-of-string
|
|
2206
|
+
*/
|
|
2207
|
+
|
|
2208
|
+
while (!eos()) {
|
|
2209
|
+
value = advance();
|
|
2210
|
+
|
|
2211
|
+
if (value === '\u0000') {
|
|
2212
|
+
continue;
|
|
2213
|
+
}
|
|
2214
|
+
|
|
2215
|
+
/**
|
|
2216
|
+
* Escaped characters
|
|
2217
|
+
*/
|
|
2218
|
+
|
|
2219
|
+
if (value === '\\') {
|
|
2220
|
+
const next = peek();
|
|
2221
|
+
|
|
2222
|
+
if (next === '/' && opts.bash !== true) {
|
|
2223
|
+
continue;
|
|
2224
|
+
}
|
|
2225
|
+
|
|
2226
|
+
if (next === '.' || next === ';') {
|
|
2227
|
+
continue;
|
|
2228
|
+
}
|
|
2229
|
+
|
|
2230
|
+
if (!next) {
|
|
2231
|
+
value += '\\';
|
|
2232
|
+
push({ type: 'text', value });
|
|
2233
|
+
continue;
|
|
2234
|
+
}
|
|
2235
|
+
|
|
2236
|
+
// collapse slashes to reduce potential for exploits
|
|
2237
|
+
const match = /^\\+/.exec(remaining());
|
|
2238
|
+
let slashes = 0;
|
|
2239
|
+
|
|
2240
|
+
if (match && match[0].length > 2) {
|
|
2241
|
+
slashes = match[0].length;
|
|
2242
|
+
state.index += slashes;
|
|
2243
|
+
if (slashes % 2 !== 0) {
|
|
2244
|
+
value += '\\';
|
|
2245
|
+
}
|
|
2246
|
+
}
|
|
2247
|
+
|
|
2248
|
+
if (opts.unescape === true) {
|
|
2249
|
+
value = advance();
|
|
2250
|
+
} else {
|
|
2251
|
+
value += advance();
|
|
2252
|
+
}
|
|
2253
|
+
|
|
2254
|
+
if (state.brackets === 0) {
|
|
2255
|
+
push({ type: 'text', value });
|
|
2256
|
+
continue;
|
|
2257
|
+
}
|
|
2258
|
+
}
|
|
2259
|
+
|
|
2260
|
+
/**
|
|
2261
|
+
* If we're inside a regex character class, continue
|
|
2262
|
+
* until we reach the closing bracket.
|
|
2263
|
+
*/
|
|
2264
|
+
|
|
2265
|
+
if (state.brackets > 0 && (value !== ']' || prev.value === '[' || prev.value === '[^')) {
|
|
2266
|
+
if (opts.posix !== false && value === ':') {
|
|
2267
|
+
const inner = prev.value.slice(1);
|
|
2268
|
+
if (inner.includes('[')) {
|
|
2269
|
+
prev.posix = true;
|
|
2270
|
+
|
|
2271
|
+
if (inner.includes(':')) {
|
|
2272
|
+
const idx = prev.value.lastIndexOf('[');
|
|
2273
|
+
const pre = prev.value.slice(0, idx);
|
|
2274
|
+
const rest = prev.value.slice(idx + 2);
|
|
2275
|
+
const posix = POSIX_REGEX_SOURCE[rest];
|
|
2276
|
+
if (posix) {
|
|
2277
|
+
prev.value = pre + posix;
|
|
2278
|
+
state.backtrack = true;
|
|
2279
|
+
advance();
|
|
2280
|
+
|
|
2281
|
+
if (!bos.output && tokens.indexOf(prev) === 1) {
|
|
2282
|
+
bos.output = ONE_CHAR;
|
|
2283
|
+
}
|
|
2284
|
+
continue;
|
|
2285
|
+
}
|
|
2286
|
+
}
|
|
2287
|
+
}
|
|
2288
|
+
}
|
|
2289
|
+
|
|
2290
|
+
if ((value === '[' && peek() !== ':') || (value === '-' && peek() === ']')) {
|
|
2291
|
+
value = `\\${value}`;
|
|
2292
|
+
}
|
|
2293
|
+
|
|
2294
|
+
if (value === ']' && (prev.value === '[' || prev.value === '[^')) {
|
|
2295
|
+
value = `\\${value}`;
|
|
2296
|
+
}
|
|
2297
|
+
|
|
2298
|
+
if (opts.posix === true && value === '!' && prev.value === '[') {
|
|
2299
|
+
value = '^';
|
|
2300
|
+
}
|
|
2301
|
+
|
|
2302
|
+
prev.value += value;
|
|
2303
|
+
append({ value });
|
|
2304
|
+
continue;
|
|
2305
|
+
}
|
|
2306
|
+
|
|
2307
|
+
/**
|
|
2308
|
+
* If we're inside a quoted string, continue
|
|
2309
|
+
* until we reach the closing double quote.
|
|
2310
|
+
*/
|
|
2311
|
+
|
|
2312
|
+
if (state.quotes === 1 && value !== '"') {
|
|
2313
|
+
value = utils$1.escapeRegex(value);
|
|
2314
|
+
prev.value += value;
|
|
2315
|
+
append({ value });
|
|
2316
|
+
continue;
|
|
2317
|
+
}
|
|
2318
|
+
|
|
2319
|
+
/**
|
|
2320
|
+
* Double quotes
|
|
2321
|
+
*/
|
|
2322
|
+
|
|
2323
|
+
if (value === '"') {
|
|
2324
|
+
state.quotes = state.quotes === 1 ? 0 : 1;
|
|
2325
|
+
if (opts.keepQuotes === true) {
|
|
2326
|
+
push({ type: 'text', value });
|
|
2327
|
+
}
|
|
2328
|
+
continue;
|
|
2329
|
+
}
|
|
2330
|
+
|
|
2331
|
+
/**
|
|
2332
|
+
* Parentheses
|
|
2333
|
+
*/
|
|
2334
|
+
|
|
2335
|
+
if (value === '(') {
|
|
2336
|
+
increment('parens');
|
|
2337
|
+
push({ type: 'paren', value });
|
|
2338
|
+
continue;
|
|
2339
|
+
}
|
|
2340
|
+
|
|
2341
|
+
if (value === ')') {
|
|
2342
|
+
if (state.parens === 0 && opts.strictBrackets === true) {
|
|
2343
|
+
throw new SyntaxError(syntaxError('opening', '('));
|
|
2344
|
+
}
|
|
2345
|
+
|
|
2346
|
+
const extglob = extglobs[extglobs.length - 1];
|
|
2347
|
+
if (extglob && state.parens === extglob.parens + 1) {
|
|
2348
|
+
extglobClose(extglobs.pop());
|
|
2349
|
+
continue;
|
|
2350
|
+
}
|
|
2351
|
+
|
|
2352
|
+
push({ type: 'paren', value, output: state.parens ? ')' : '\\)' });
|
|
2353
|
+
decrement('parens');
|
|
2354
|
+
continue;
|
|
2355
|
+
}
|
|
2356
|
+
|
|
2357
|
+
/**
|
|
2358
|
+
* Square brackets
|
|
2359
|
+
*/
|
|
2360
|
+
|
|
2361
|
+
if (value === '[') {
|
|
2362
|
+
if (opts.nobracket === true || !remaining().includes(']')) {
|
|
2363
|
+
if (opts.nobracket !== true && opts.strictBrackets === true) {
|
|
2364
|
+
throw new SyntaxError(syntaxError('closing', ']'));
|
|
2365
|
+
}
|
|
2366
|
+
|
|
2367
|
+
value = `\\${value}`;
|
|
2368
|
+
} else {
|
|
2369
|
+
increment('brackets');
|
|
2370
|
+
}
|
|
2371
|
+
|
|
2372
|
+
push({ type: 'bracket', value });
|
|
2373
|
+
continue;
|
|
2374
|
+
}
|
|
2375
|
+
|
|
2376
|
+
if (value === ']') {
|
|
2377
|
+
if (opts.nobracket === true || (prev && prev.type === 'bracket' && prev.value.length === 1)) {
|
|
2378
|
+
push({ type: 'text', value, output: `\\${value}` });
|
|
2379
|
+
continue;
|
|
2380
|
+
}
|
|
2381
|
+
|
|
2382
|
+
if (state.brackets === 0) {
|
|
2383
|
+
if (opts.strictBrackets === true) {
|
|
2384
|
+
throw new SyntaxError(syntaxError('opening', '['));
|
|
2385
|
+
}
|
|
2386
|
+
|
|
2387
|
+
push({ type: 'text', value, output: `\\${value}` });
|
|
2388
|
+
continue;
|
|
2389
|
+
}
|
|
2390
|
+
|
|
2391
|
+
decrement('brackets');
|
|
2392
|
+
|
|
2393
|
+
const prevValue = prev.value.slice(1);
|
|
2394
|
+
if (prev.posix !== true && prevValue[0] === '^' && !prevValue.includes('/')) {
|
|
2395
|
+
value = `/${value}`;
|
|
2396
|
+
}
|
|
2397
|
+
|
|
2398
|
+
prev.value += value;
|
|
2399
|
+
append({ value });
|
|
2400
|
+
|
|
2401
|
+
// when literal brackets are explicitly disabled
|
|
2402
|
+
// assume we should match with a regex character class
|
|
2403
|
+
if (opts.literalBrackets === false || utils$1.hasRegexChars(prevValue)) {
|
|
2404
|
+
continue;
|
|
2405
|
+
}
|
|
2406
|
+
|
|
2407
|
+
const escaped = utils$1.escapeRegex(prev.value);
|
|
2408
|
+
state.output = state.output.slice(0, -prev.value.length);
|
|
2409
|
+
|
|
2410
|
+
// when literal brackets are explicitly enabled
|
|
2411
|
+
// assume we should escape the brackets to match literal characters
|
|
2412
|
+
if (opts.literalBrackets === true) {
|
|
2413
|
+
state.output += escaped;
|
|
2414
|
+
prev.value = escaped;
|
|
2415
|
+
continue;
|
|
2416
|
+
}
|
|
2417
|
+
|
|
2418
|
+
// when the user specifies nothing, try to match both
|
|
2419
|
+
prev.value = `(${capture}${escaped}|${prev.value})`;
|
|
2420
|
+
state.output += prev.value;
|
|
2421
|
+
continue;
|
|
2422
|
+
}
|
|
2423
|
+
|
|
2424
|
+
/**
|
|
2425
|
+
* Braces
|
|
2426
|
+
*/
|
|
2427
|
+
|
|
2428
|
+
if (value === '{' && opts.nobrace !== true) {
|
|
2429
|
+
increment('braces');
|
|
2430
|
+
|
|
2431
|
+
const open = {
|
|
2432
|
+
type: 'brace',
|
|
2433
|
+
value,
|
|
2434
|
+
output: '(',
|
|
2435
|
+
outputIndex: state.output.length,
|
|
2436
|
+
tokensIndex: state.tokens.length
|
|
2437
|
+
};
|
|
2438
|
+
|
|
2439
|
+
braces.push(open);
|
|
2440
|
+
push(open);
|
|
2441
|
+
continue;
|
|
2442
|
+
}
|
|
2443
|
+
|
|
2444
|
+
if (value === '}') {
|
|
2445
|
+
const brace = braces[braces.length - 1];
|
|
2446
|
+
|
|
2447
|
+
if (opts.nobrace === true || !brace) {
|
|
2448
|
+
push({ type: 'text', value, output: value });
|
|
2449
|
+
continue;
|
|
2450
|
+
}
|
|
2451
|
+
|
|
2452
|
+
let output = ')';
|
|
2453
|
+
|
|
2454
|
+
if (brace.dots === true) {
|
|
2455
|
+
const arr = tokens.slice();
|
|
2456
|
+
const range = [];
|
|
2457
|
+
|
|
2458
|
+
for (let i = arr.length - 1; i >= 0; i--) {
|
|
2459
|
+
tokens.pop();
|
|
2460
|
+
if (arr[i].type === 'brace') {
|
|
2461
|
+
break;
|
|
2462
|
+
}
|
|
2463
|
+
if (arr[i].type !== 'dots') {
|
|
2464
|
+
range.unshift(arr[i].value);
|
|
2465
|
+
}
|
|
2466
|
+
}
|
|
2467
|
+
|
|
2468
|
+
output = expandRange(range, opts);
|
|
2469
|
+
state.backtrack = true;
|
|
2470
|
+
}
|
|
2471
|
+
|
|
2472
|
+
if (brace.comma !== true && brace.dots !== true) {
|
|
2473
|
+
const out = state.output.slice(0, brace.outputIndex);
|
|
2474
|
+
const toks = state.tokens.slice(brace.tokensIndex);
|
|
2475
|
+
brace.value = brace.output = '\\{';
|
|
2476
|
+
value = output = '\\}';
|
|
2477
|
+
state.output = out;
|
|
2478
|
+
for (const t of toks) {
|
|
2479
|
+
state.output += (t.output || t.value);
|
|
2480
|
+
}
|
|
2481
|
+
}
|
|
2482
|
+
|
|
2483
|
+
push({ type: 'brace', value, output });
|
|
2484
|
+
decrement('braces');
|
|
2485
|
+
braces.pop();
|
|
2486
|
+
continue;
|
|
2487
|
+
}
|
|
2488
|
+
|
|
2489
|
+
/**
|
|
2490
|
+
* Pipes
|
|
2491
|
+
*/
|
|
2492
|
+
|
|
2493
|
+
if (value === '|') {
|
|
2494
|
+
if (extglobs.length > 0) {
|
|
2495
|
+
extglobs[extglobs.length - 1].conditions++;
|
|
2496
|
+
}
|
|
2497
|
+
push({ type: 'text', value });
|
|
2498
|
+
continue;
|
|
2499
|
+
}
|
|
2500
|
+
|
|
2501
|
+
/**
|
|
2502
|
+
* Commas
|
|
2503
|
+
*/
|
|
2504
|
+
|
|
2505
|
+
if (value === ',') {
|
|
2506
|
+
let output = value;
|
|
2507
|
+
|
|
2508
|
+
const brace = braces[braces.length - 1];
|
|
2509
|
+
if (brace && stack[stack.length - 1] === 'braces') {
|
|
2510
|
+
brace.comma = true;
|
|
2511
|
+
output = '|';
|
|
2512
|
+
}
|
|
2513
|
+
|
|
2514
|
+
push({ type: 'comma', value, output });
|
|
2515
|
+
continue;
|
|
2516
|
+
}
|
|
2517
|
+
|
|
2518
|
+
/**
|
|
2519
|
+
* Slashes
|
|
2520
|
+
*/
|
|
2521
|
+
|
|
2522
|
+
if (value === '/') {
|
|
2523
|
+
// if the beginning of the glob is "./", advance the start
|
|
2524
|
+
// to the current index, and don't add the "./" characters
|
|
2525
|
+
// to the state. This greatly simplifies lookbehinds when
|
|
2526
|
+
// checking for BOS characters like "!" and "." (not "./")
|
|
2527
|
+
if (prev.type === 'dot' && state.index === state.start + 1) {
|
|
2528
|
+
state.start = state.index + 1;
|
|
2529
|
+
state.consumed = '';
|
|
2530
|
+
state.output = '';
|
|
2531
|
+
tokens.pop();
|
|
2532
|
+
prev = bos; // reset "prev" to the first token
|
|
2533
|
+
continue;
|
|
2534
|
+
}
|
|
2535
|
+
|
|
2536
|
+
push({ type: 'slash', value, output: SLASH_LITERAL });
|
|
2537
|
+
continue;
|
|
2538
|
+
}
|
|
2539
|
+
|
|
2540
|
+
/**
|
|
2541
|
+
* Dots
|
|
2542
|
+
*/
|
|
2543
|
+
|
|
2544
|
+
if (value === '.') {
|
|
2545
|
+
if (state.braces > 0 && prev.type === 'dot') {
|
|
2546
|
+
if (prev.value === '.') prev.output = DOT_LITERAL;
|
|
2547
|
+
const brace = braces[braces.length - 1];
|
|
2548
|
+
prev.type = 'dots';
|
|
2549
|
+
prev.output += value;
|
|
2550
|
+
prev.value += value;
|
|
2551
|
+
brace.dots = true;
|
|
2552
|
+
continue;
|
|
2553
|
+
}
|
|
2554
|
+
|
|
2555
|
+
if ((state.braces + state.parens) === 0 && prev.type !== 'bos' && prev.type !== 'slash') {
|
|
2556
|
+
push({ type: 'text', value, output: DOT_LITERAL });
|
|
2557
|
+
continue;
|
|
2558
|
+
}
|
|
2559
|
+
|
|
2560
|
+
push({ type: 'dot', value, output: DOT_LITERAL });
|
|
2561
|
+
continue;
|
|
2562
|
+
}
|
|
2563
|
+
|
|
2564
|
+
/**
|
|
2565
|
+
* Question marks
|
|
2566
|
+
*/
|
|
2567
|
+
|
|
2568
|
+
if (value === '?') {
|
|
2569
|
+
const isGroup = prev && prev.value === '(';
|
|
2570
|
+
if (!isGroup && opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
|
|
2571
|
+
extglobOpen('qmark', value);
|
|
2572
|
+
continue;
|
|
2573
|
+
}
|
|
2574
|
+
|
|
2575
|
+
if (prev && prev.type === 'paren') {
|
|
2576
|
+
const next = peek();
|
|
2577
|
+
let output = value;
|
|
2578
|
+
|
|
2579
|
+
if (next === '<' && !utils$1.supportsLookbehinds()) {
|
|
2580
|
+
throw new Error('Node.js v10 or higher is required for regex lookbehinds');
|
|
2581
|
+
}
|
|
2582
|
+
|
|
2583
|
+
if ((prev.value === '(' && !/[!=<:]/.test(next)) || (next === '<' && !/<([!=]|\w+>)/.test(remaining()))) {
|
|
2584
|
+
output = `\\${value}`;
|
|
2585
|
+
}
|
|
2586
|
+
|
|
2587
|
+
push({ type: 'text', value, output });
|
|
2588
|
+
continue;
|
|
2589
|
+
}
|
|
2590
|
+
|
|
2591
|
+
if (opts.dot !== true && (prev.type === 'slash' || prev.type === 'bos')) {
|
|
2592
|
+
push({ type: 'qmark', value, output: QMARK_NO_DOT });
|
|
2593
|
+
continue;
|
|
2594
|
+
}
|
|
2595
|
+
|
|
2596
|
+
push({ type: 'qmark', value, output: QMARK });
|
|
2597
|
+
continue;
|
|
2598
|
+
}
|
|
2599
|
+
|
|
2600
|
+
/**
|
|
2601
|
+
* Exclamation
|
|
2602
|
+
*/
|
|
2603
|
+
|
|
2604
|
+
if (value === '!') {
|
|
2605
|
+
if (opts.noextglob !== true && peek() === '(') {
|
|
2606
|
+
if (peek(2) !== '?' || !/[!=<:]/.test(peek(3))) {
|
|
2607
|
+
extglobOpen('negate', value);
|
|
2608
|
+
continue;
|
|
2609
|
+
}
|
|
2610
|
+
}
|
|
2611
|
+
|
|
2612
|
+
if (opts.nonegate !== true && state.index === 0) {
|
|
2613
|
+
negate();
|
|
2614
|
+
continue;
|
|
2615
|
+
}
|
|
2616
|
+
}
|
|
2617
|
+
|
|
2618
|
+
/**
|
|
2619
|
+
* Plus
|
|
2620
|
+
*/
|
|
2621
|
+
|
|
2622
|
+
if (value === '+') {
|
|
2623
|
+
if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
|
|
2624
|
+
extglobOpen('plus', value);
|
|
2625
|
+
continue;
|
|
2626
|
+
}
|
|
2627
|
+
|
|
2628
|
+
if ((prev && prev.value === '(') || opts.regex === false) {
|
|
2629
|
+
push({ type: 'plus', value, output: PLUS_LITERAL });
|
|
2630
|
+
continue;
|
|
2631
|
+
}
|
|
2632
|
+
|
|
2633
|
+
if ((prev && (prev.type === 'bracket' || prev.type === 'paren' || prev.type === 'brace')) || state.parens > 0) {
|
|
2634
|
+
push({ type: 'plus', value });
|
|
2635
|
+
continue;
|
|
2636
|
+
}
|
|
359
2637
|
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
2638
|
+
push({ type: 'plus', value: PLUS_LITERAL });
|
|
2639
|
+
continue;
|
|
2640
|
+
}
|
|
363
2641
|
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
}
|
|
2642
|
+
/**
|
|
2643
|
+
* Plain text
|
|
2644
|
+
*/
|
|
368
2645
|
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
2646
|
+
if (value === '@') {
|
|
2647
|
+
if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
|
|
2648
|
+
push({ type: 'at', extglob: true, value, output: '' });
|
|
2649
|
+
continue;
|
|
2650
|
+
}
|
|
373
2651
|
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
createDebug.coerce = coerce;
|
|
378
|
-
createDebug.disable = disable;
|
|
379
|
-
createDebug.enable = enable;
|
|
380
|
-
createDebug.enabled = enabled;
|
|
381
|
-
createDebug.humanize = ms;
|
|
382
|
-
createDebug.destroy = destroy;
|
|
2652
|
+
push({ type: 'text', value });
|
|
2653
|
+
continue;
|
|
2654
|
+
}
|
|
383
2655
|
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
2656
|
+
/**
|
|
2657
|
+
* Plain text
|
|
2658
|
+
*/
|
|
387
2659
|
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
2660
|
+
if (value !== '*') {
|
|
2661
|
+
if (value === '$' || value === '^') {
|
|
2662
|
+
value = `\\${value}`;
|
|
2663
|
+
}
|
|
391
2664
|
|
|
392
|
-
|
|
393
|
-
|
|
2665
|
+
const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
|
|
2666
|
+
if (match) {
|
|
2667
|
+
value += match[0];
|
|
2668
|
+
state.index += match[0].length;
|
|
2669
|
+
}
|
|
394
2670
|
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
* Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
|
|
399
|
-
*/
|
|
400
|
-
createDebug.formatters = {};
|
|
2671
|
+
push({ type: 'text', value });
|
|
2672
|
+
continue;
|
|
2673
|
+
}
|
|
401
2674
|
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
2675
|
+
/**
|
|
2676
|
+
* Stars
|
|
2677
|
+
*/
|
|
2678
|
+
|
|
2679
|
+
if (prev && (prev.type === 'globstar' || prev.star === true)) {
|
|
2680
|
+
prev.type = 'star';
|
|
2681
|
+
prev.star = true;
|
|
2682
|
+
prev.value += value;
|
|
2683
|
+
prev.output = star;
|
|
2684
|
+
state.backtrack = true;
|
|
2685
|
+
state.globstar = true;
|
|
2686
|
+
consume(value);
|
|
2687
|
+
continue;
|
|
2688
|
+
}
|
|
415
2689
|
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
2690
|
+
let rest = remaining();
|
|
2691
|
+
if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
|
|
2692
|
+
extglobOpen('star', value);
|
|
2693
|
+
continue;
|
|
2694
|
+
}
|
|
419
2695
|
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
* @api public
|
|
426
|
-
*/
|
|
427
|
-
function createDebug(namespace) {
|
|
428
|
-
let prevTime;
|
|
429
|
-
let enableOverride = null;
|
|
430
|
-
let namespacesCache;
|
|
431
|
-
let enabledCache;
|
|
432
|
-
|
|
433
|
-
function debug(...args) {
|
|
434
|
-
// Disabled?
|
|
435
|
-
if (!debug.enabled) {
|
|
436
|
-
return;
|
|
437
|
-
}
|
|
2696
|
+
if (prev.type === 'star') {
|
|
2697
|
+
if (opts.noglobstar === true) {
|
|
2698
|
+
consume(value);
|
|
2699
|
+
continue;
|
|
2700
|
+
}
|
|
438
2701
|
|
|
439
|
-
|
|
2702
|
+
const prior = prev.prev;
|
|
2703
|
+
const before = prior.prev;
|
|
2704
|
+
const isStart = prior.type === 'slash' || prior.type === 'bos';
|
|
2705
|
+
const afterStar = before && (before.type === 'star' || before.type === 'globstar');
|
|
440
2706
|
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
self.prev = prevTime;
|
|
446
|
-
self.curr = curr;
|
|
447
|
-
prevTime = curr;
|
|
2707
|
+
if (opts.bash === true && (!isStart || (rest[0] && rest[0] !== '/'))) {
|
|
2708
|
+
push({ type: 'star', value, output: '' });
|
|
2709
|
+
continue;
|
|
2710
|
+
}
|
|
448
2711
|
|
|
449
|
-
|
|
2712
|
+
const isBrace = state.braces > 0 && (prior.type === 'comma' || prior.type === 'brace');
|
|
2713
|
+
const isExtglob = extglobs.length && (prior.type === 'pipe' || prior.type === 'paren');
|
|
2714
|
+
if (!isStart && prior.type !== 'paren' && !isBrace && !isExtglob) {
|
|
2715
|
+
push({ type: 'star', value, output: '' });
|
|
2716
|
+
continue;
|
|
2717
|
+
}
|
|
450
2718
|
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
2719
|
+
// strip consecutive `/**/`
|
|
2720
|
+
while (rest.slice(0, 3) === '/**') {
|
|
2721
|
+
const after = input[state.index + 4];
|
|
2722
|
+
if (after && after !== '/') {
|
|
2723
|
+
break;
|
|
2724
|
+
}
|
|
2725
|
+
rest = rest.slice(3);
|
|
2726
|
+
consume('/**', 3);
|
|
2727
|
+
}
|
|
455
2728
|
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
if (typeof formatter === 'function') {
|
|
466
|
-
const val = args[index];
|
|
467
|
-
match = formatter.call(self, val);
|
|
468
|
-
|
|
469
|
-
// Now we need to remove `args[index]` since it's inlined in the `format`
|
|
470
|
-
args.splice(index, 1);
|
|
471
|
-
index--;
|
|
472
|
-
}
|
|
473
|
-
return match;
|
|
474
|
-
});
|
|
2729
|
+
if (prior.type === 'bos' && eos()) {
|
|
2730
|
+
prev.type = 'globstar';
|
|
2731
|
+
prev.value += value;
|
|
2732
|
+
prev.output = globstar(opts);
|
|
2733
|
+
state.output = prev.output;
|
|
2734
|
+
state.globstar = true;
|
|
2735
|
+
consume(value);
|
|
2736
|
+
continue;
|
|
2737
|
+
}
|
|
475
2738
|
|
|
476
|
-
|
|
477
|
-
|
|
2739
|
+
if (prior.type === 'slash' && prior.prev.type !== 'bos' && !afterStar && eos()) {
|
|
2740
|
+
state.output = state.output.slice(0, -(prior.output + prev.output).length);
|
|
2741
|
+
prior.output = `(?:${prior.output}`;
|
|
2742
|
+
|
|
2743
|
+
prev.type = 'globstar';
|
|
2744
|
+
prev.output = globstar(opts) + (opts.strictSlashes ? ')' : '|$)');
|
|
2745
|
+
prev.value += value;
|
|
2746
|
+
state.globstar = true;
|
|
2747
|
+
state.output += prior.output + prev.output;
|
|
2748
|
+
consume(value);
|
|
2749
|
+
continue;
|
|
2750
|
+
}
|
|
478
2751
|
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
}
|
|
2752
|
+
if (prior.type === 'slash' && prior.prev.type !== 'bos' && rest[0] === '/') {
|
|
2753
|
+
const end = rest[1] !== void 0 ? '|$' : '';
|
|
482
2754
|
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
debug.color = createDebug.selectColor(namespace);
|
|
486
|
-
debug.extend = extend;
|
|
487
|
-
debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.
|
|
488
|
-
|
|
489
|
-
Object.defineProperty(debug, 'enabled', {
|
|
490
|
-
enumerable: true,
|
|
491
|
-
configurable: false,
|
|
492
|
-
get: () => {
|
|
493
|
-
if (enableOverride !== null) {
|
|
494
|
-
return enableOverride;
|
|
495
|
-
}
|
|
496
|
-
if (namespacesCache !== createDebug.namespaces) {
|
|
497
|
-
namespacesCache = createDebug.namespaces;
|
|
498
|
-
enabledCache = createDebug.enabled(namespace);
|
|
499
|
-
}
|
|
2755
|
+
state.output = state.output.slice(0, -(prior.output + prev.output).length);
|
|
2756
|
+
prior.output = `(?:${prior.output}`;
|
|
500
2757
|
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
enableOverride = v;
|
|
505
|
-
}
|
|
506
|
-
});
|
|
2758
|
+
prev.type = 'globstar';
|
|
2759
|
+
prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
|
|
2760
|
+
prev.value += value;
|
|
507
2761
|
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
createDebug.init(debug);
|
|
511
|
-
}
|
|
2762
|
+
state.output += prior.output + prev.output;
|
|
2763
|
+
state.globstar = true;
|
|
512
2764
|
|
|
513
|
-
|
|
514
|
-
}
|
|
2765
|
+
consume(value + advance());
|
|
515
2766
|
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
return newDebug;
|
|
520
|
-
}
|
|
2767
|
+
push({ type: 'slash', value: '/', output: '' });
|
|
2768
|
+
continue;
|
|
2769
|
+
}
|
|
521
2770
|
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
2771
|
+
if (prior.type === 'bos' && rest[0] === '/') {
|
|
2772
|
+
prev.type = 'globstar';
|
|
2773
|
+
prev.value += value;
|
|
2774
|
+
prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
|
|
2775
|
+
state.output = prev.output;
|
|
2776
|
+
state.globstar = true;
|
|
2777
|
+
consume(value + advance());
|
|
2778
|
+
push({ type: 'slash', value: '/', output: '' });
|
|
2779
|
+
continue;
|
|
2780
|
+
}
|
|
532
2781
|
|
|
533
|
-
|
|
534
|
-
|
|
2782
|
+
// remove single star from output
|
|
2783
|
+
state.output = state.output.slice(0, -prev.output.length);
|
|
535
2784
|
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
2785
|
+
// reset previous token to globstar
|
|
2786
|
+
prev.type = 'globstar';
|
|
2787
|
+
prev.output = globstar(opts);
|
|
2788
|
+
prev.value += value;
|
|
539
2789
|
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
2790
|
+
// reset output with globstar
|
|
2791
|
+
state.output += prev.output;
|
|
2792
|
+
state.globstar = true;
|
|
2793
|
+
consume(value);
|
|
2794
|
+
continue;
|
|
2795
|
+
}
|
|
545
2796
|
|
|
546
|
-
|
|
2797
|
+
const token = { type: 'star', value, output: star };
|
|
547
2798
|
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
2799
|
+
if (opts.bash === true) {
|
|
2800
|
+
token.output = '.*?';
|
|
2801
|
+
if (prev.type === 'bos' || prev.type === 'slash') {
|
|
2802
|
+
token.output = nodot + token.output;
|
|
2803
|
+
}
|
|
2804
|
+
push(token);
|
|
2805
|
+
continue;
|
|
2806
|
+
}
|
|
555
2807
|
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
*/
|
|
562
|
-
function disable() {
|
|
563
|
-
const namespaces = [
|
|
564
|
-
...createDebug.names.map(toNamespace),
|
|
565
|
-
...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)
|
|
566
|
-
].join(',');
|
|
567
|
-
createDebug.enable('');
|
|
568
|
-
return namespaces;
|
|
569
|
-
}
|
|
2808
|
+
if (prev && (prev.type === 'bracket' || prev.type === 'paren') && opts.regex === true) {
|
|
2809
|
+
token.output = value;
|
|
2810
|
+
push(token);
|
|
2811
|
+
continue;
|
|
2812
|
+
}
|
|
570
2813
|
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
* @return {Boolean}
|
|
576
|
-
* @api public
|
|
577
|
-
*/
|
|
578
|
-
function enabled(name) {
|
|
579
|
-
if (name[name.length - 1] === '*') {
|
|
580
|
-
return true;
|
|
581
|
-
}
|
|
2814
|
+
if (state.index === state.start || prev.type === 'slash' || prev.type === 'dot') {
|
|
2815
|
+
if (prev.type === 'dot') {
|
|
2816
|
+
state.output += NO_DOT_SLASH;
|
|
2817
|
+
prev.output += NO_DOT_SLASH;
|
|
582
2818
|
|
|
583
|
-
|
|
584
|
-
|
|
2819
|
+
} else if (opts.dot === true) {
|
|
2820
|
+
state.output += NO_DOTS_SLASH;
|
|
2821
|
+
prev.output += NO_DOTS_SLASH;
|
|
585
2822
|
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
}
|
|
2823
|
+
} else {
|
|
2824
|
+
state.output += nodot;
|
|
2825
|
+
prev.output += nodot;
|
|
2826
|
+
}
|
|
591
2827
|
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
2828
|
+
if (peek() !== '*') {
|
|
2829
|
+
state.output += ONE_CHAR;
|
|
2830
|
+
prev.output += ONE_CHAR;
|
|
2831
|
+
}
|
|
2832
|
+
}
|
|
597
2833
|
|
|
598
|
-
|
|
599
|
-
|
|
2834
|
+
push(token);
|
|
2835
|
+
}
|
|
600
2836
|
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
* @api private
|
|
607
|
-
*/
|
|
608
|
-
function toNamespace(regexp) {
|
|
609
|
-
return regexp.toString()
|
|
610
|
-
.substring(2, regexp.toString().length - 2)
|
|
611
|
-
.replace(/\.\*\?$/, '*');
|
|
612
|
-
}
|
|
2837
|
+
while (state.brackets > 0) {
|
|
2838
|
+
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ']'));
|
|
2839
|
+
state.output = utils$1.escapeLast(state.output, '[');
|
|
2840
|
+
decrement('brackets');
|
|
2841
|
+
}
|
|
613
2842
|
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
* @api private
|
|
620
|
-
*/
|
|
621
|
-
function coerce(val) {
|
|
622
|
-
if (val instanceof Error) {
|
|
623
|
-
return val.stack || val.message;
|
|
624
|
-
}
|
|
625
|
-
return val;
|
|
626
|
-
}
|
|
2843
|
+
while (state.parens > 0) {
|
|
2844
|
+
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ')'));
|
|
2845
|
+
state.output = utils$1.escapeLast(state.output, '(');
|
|
2846
|
+
decrement('parens');
|
|
2847
|
+
}
|
|
627
2848
|
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
|
|
634
|
-
}
|
|
2849
|
+
while (state.braces > 0) {
|
|
2850
|
+
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', '}'));
|
|
2851
|
+
state.output = utils$1.escapeLast(state.output, '{');
|
|
2852
|
+
decrement('braces');
|
|
2853
|
+
}
|
|
635
2854
|
|
|
636
|
-
|
|
2855
|
+
if (opts.strictSlashes !== true && (prev.type === 'star' || prev.type === 'bracket')) {
|
|
2856
|
+
push({ type: 'maybe_slash', value: '', output: `${SLASH_LITERAL}?` });
|
|
2857
|
+
}
|
|
637
2858
|
|
|
638
|
-
|
|
639
|
-
|
|
2859
|
+
// rebuild the output if we had to backtrack at any point
|
|
2860
|
+
if (state.backtrack === true) {
|
|
2861
|
+
state.output = '';
|
|
640
2862
|
|
|
641
|
-
|
|
2863
|
+
for (const token of state.tokens) {
|
|
2864
|
+
state.output += token.output != null ? token.output : token.value;
|
|
642
2865
|
|
|
643
|
-
|
|
2866
|
+
if (token.suffix) {
|
|
2867
|
+
state.output += token.suffix;
|
|
2868
|
+
}
|
|
2869
|
+
}
|
|
2870
|
+
}
|
|
2871
|
+
|
|
2872
|
+
return state;
|
|
2873
|
+
};
|
|
644
2874
|
|
|
645
|
-
(function (module, exports) {
|
|
646
2875
|
/**
|
|
647
|
-
*
|
|
2876
|
+
* Fast paths for creating regular expressions for common glob patterns.
|
|
2877
|
+
* This can significantly speed up processing and has very little downside
|
|
2878
|
+
* impact when none of the fast paths match.
|
|
648
2879
|
*/
|
|
649
2880
|
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
return () => {
|
|
659
|
-
if (!warned) {
|
|
660
|
-
warned = true;
|
|
661
|
-
console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
|
|
662
|
-
}
|
|
663
|
-
};
|
|
664
|
-
})();
|
|
2881
|
+
parse$2.fastpaths = (input, options) => {
|
|
2882
|
+
const opts = { ...options };
|
|
2883
|
+
const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
|
2884
|
+
const len = input.length;
|
|
2885
|
+
if (len > max) {
|
|
2886
|
+
throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
|
|
2887
|
+
}
|
|
665
2888
|
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
2889
|
+
input = REPLACEMENTS[input] || input;
|
|
2890
|
+
const win32 = utils$1.isWindows(options);
|
|
2891
|
+
|
|
2892
|
+
// create constants based on platform, for windows or posix
|
|
2893
|
+
const {
|
|
2894
|
+
DOT_LITERAL,
|
|
2895
|
+
SLASH_LITERAL,
|
|
2896
|
+
ONE_CHAR,
|
|
2897
|
+
DOTS_SLASH,
|
|
2898
|
+
NO_DOT,
|
|
2899
|
+
NO_DOTS,
|
|
2900
|
+
NO_DOTS_SLASH,
|
|
2901
|
+
STAR,
|
|
2902
|
+
START_ANCHOR
|
|
2903
|
+
} = constants$1.globChars(win32);
|
|
2904
|
+
|
|
2905
|
+
const nodot = opts.dot ? NO_DOTS : NO_DOT;
|
|
2906
|
+
const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
|
|
2907
|
+
const capture = opts.capture ? '' : '?:';
|
|
2908
|
+
const state = { negated: false, prefix: '' };
|
|
2909
|
+
let star = opts.bash === true ? '.*?' : STAR;
|
|
2910
|
+
|
|
2911
|
+
if (opts.capture) {
|
|
2912
|
+
star = `(${star})`;
|
|
2913
|
+
}
|
|
669
2914
|
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
'#0033FF',
|
|
675
|
-
'#0066CC',
|
|
676
|
-
'#0066FF',
|
|
677
|
-
'#0099CC',
|
|
678
|
-
'#0099FF',
|
|
679
|
-
'#00CC00',
|
|
680
|
-
'#00CC33',
|
|
681
|
-
'#00CC66',
|
|
682
|
-
'#00CC99',
|
|
683
|
-
'#00CCCC',
|
|
684
|
-
'#00CCFF',
|
|
685
|
-
'#3300CC',
|
|
686
|
-
'#3300FF',
|
|
687
|
-
'#3333CC',
|
|
688
|
-
'#3333FF',
|
|
689
|
-
'#3366CC',
|
|
690
|
-
'#3366FF',
|
|
691
|
-
'#3399CC',
|
|
692
|
-
'#3399FF',
|
|
693
|
-
'#33CC00',
|
|
694
|
-
'#33CC33',
|
|
695
|
-
'#33CC66',
|
|
696
|
-
'#33CC99',
|
|
697
|
-
'#33CCCC',
|
|
698
|
-
'#33CCFF',
|
|
699
|
-
'#6600CC',
|
|
700
|
-
'#6600FF',
|
|
701
|
-
'#6633CC',
|
|
702
|
-
'#6633FF',
|
|
703
|
-
'#66CC00',
|
|
704
|
-
'#66CC33',
|
|
705
|
-
'#9900CC',
|
|
706
|
-
'#9900FF',
|
|
707
|
-
'#9933CC',
|
|
708
|
-
'#9933FF',
|
|
709
|
-
'#99CC00',
|
|
710
|
-
'#99CC33',
|
|
711
|
-
'#CC0000',
|
|
712
|
-
'#CC0033',
|
|
713
|
-
'#CC0066',
|
|
714
|
-
'#CC0099',
|
|
715
|
-
'#CC00CC',
|
|
716
|
-
'#CC00FF',
|
|
717
|
-
'#CC3300',
|
|
718
|
-
'#CC3333',
|
|
719
|
-
'#CC3366',
|
|
720
|
-
'#CC3399',
|
|
721
|
-
'#CC33CC',
|
|
722
|
-
'#CC33FF',
|
|
723
|
-
'#CC6600',
|
|
724
|
-
'#CC6633',
|
|
725
|
-
'#CC9900',
|
|
726
|
-
'#CC9933',
|
|
727
|
-
'#CCCC00',
|
|
728
|
-
'#CCCC33',
|
|
729
|
-
'#FF0000',
|
|
730
|
-
'#FF0033',
|
|
731
|
-
'#FF0066',
|
|
732
|
-
'#FF0099',
|
|
733
|
-
'#FF00CC',
|
|
734
|
-
'#FF00FF',
|
|
735
|
-
'#FF3300',
|
|
736
|
-
'#FF3333',
|
|
737
|
-
'#FF3366',
|
|
738
|
-
'#FF3399',
|
|
739
|
-
'#FF33CC',
|
|
740
|
-
'#FF33FF',
|
|
741
|
-
'#FF6600',
|
|
742
|
-
'#FF6633',
|
|
743
|
-
'#FF9900',
|
|
744
|
-
'#FF9933',
|
|
745
|
-
'#FFCC00',
|
|
746
|
-
'#FFCC33'
|
|
747
|
-
];
|
|
2915
|
+
const globstar = opts => {
|
|
2916
|
+
if (opts.noglobstar === true) return star;
|
|
2917
|
+
return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
|
|
2918
|
+
};
|
|
748
2919
|
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
*
|
|
752
|
-
|
|
753
|
-
*
|
|
754
|
-
* TODO: add a `localStorage` variable to explicitly enable/disable colors
|
|
755
|
-
*/
|
|
2920
|
+
const create = str => {
|
|
2921
|
+
switch (str) {
|
|
2922
|
+
case '*':
|
|
2923
|
+
return `${nodot}${ONE_CHAR}${star}`;
|
|
756
2924
|
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
// NB: In an Electron preload script, document will be defined but not fully
|
|
760
|
-
// initialized. Since we know we're in Chrome, we'll just detect this case
|
|
761
|
-
// explicitly
|
|
762
|
-
if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
|
|
763
|
-
return true;
|
|
764
|
-
}
|
|
2925
|
+
case '.*':
|
|
2926
|
+
return `${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
765
2927
|
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
return false;
|
|
769
|
-
}
|
|
2928
|
+
case '*.*':
|
|
2929
|
+
return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
770
2930
|
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
|
|
774
|
-
// Is firebug? http://stackoverflow.com/a/398120/376773
|
|
775
|
-
(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
|
|
776
|
-
// Is firefox >= v31?
|
|
777
|
-
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
|
778
|
-
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
|
|
779
|
-
// Double check webkit in userAgent just in case we are in a worker
|
|
780
|
-
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
|
|
781
|
-
}
|
|
2931
|
+
case '*/*':
|
|
2932
|
+
return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
|
|
782
2933
|
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
*
|
|
786
|
-
* @api public
|
|
787
|
-
*/
|
|
2934
|
+
case '**':
|
|
2935
|
+
return nodot + globstar(opts);
|
|
788
2936
|
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
this.namespace +
|
|
792
|
-
(this.useColors ? ' %c' : ' ') +
|
|
793
|
-
args[0] +
|
|
794
|
-
(this.useColors ? '%c ' : ' ') +
|
|
795
|
-
'+' + module.exports.humanize(this.diff);
|
|
2937
|
+
case '**/*':
|
|
2938
|
+
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
|
|
796
2939
|
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
}
|
|
2940
|
+
case '**/*.*':
|
|
2941
|
+
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
800
2942
|
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
// The final "%c" is somewhat tricky, because there could be other
|
|
805
|
-
// arguments passed either before or after the %c, so we need to
|
|
806
|
-
// figure out the correct index to insert the CSS into
|
|
807
|
-
let index = 0;
|
|
808
|
-
let lastC = 0;
|
|
809
|
-
args[0].replace(/%[a-zA-Z%]/g, match => {
|
|
810
|
-
if (match === '%%') {
|
|
811
|
-
return;
|
|
812
|
-
}
|
|
813
|
-
index++;
|
|
814
|
-
if (match === '%c') {
|
|
815
|
-
// We only are interested in the *last* %c
|
|
816
|
-
// (the user may have provided their own)
|
|
817
|
-
lastC = index;
|
|
818
|
-
}
|
|
819
|
-
});
|
|
2943
|
+
case '**/.*':
|
|
2944
|
+
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
820
2945
|
|
|
821
|
-
|
|
822
|
-
|
|
2946
|
+
default: {
|
|
2947
|
+
const match = /^(.*?)\.(\w+)$/.exec(str);
|
|
2948
|
+
if (!match) return;
|
|
823
2949
|
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
* No-op when `console.debug` is not a "function".
|
|
827
|
-
* If `console.debug` is not available, falls back
|
|
828
|
-
* to `console.log`.
|
|
829
|
-
*
|
|
830
|
-
* @api public
|
|
831
|
-
*/
|
|
832
|
-
exports.log = console.debug || console.log || (() => {});
|
|
2950
|
+
const source = create(match[1]);
|
|
2951
|
+
if (!source) return;
|
|
833
2952
|
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
* @api private
|
|
839
|
-
*/
|
|
840
|
-
function save(namespaces) {
|
|
841
|
-
try {
|
|
842
|
-
if (namespaces) {
|
|
843
|
-
exports.storage.setItem('debug', namespaces);
|
|
844
|
-
} else {
|
|
845
|
-
exports.storage.removeItem('debug');
|
|
846
|
-
}
|
|
847
|
-
} catch (error) {
|
|
848
|
-
// Swallow
|
|
849
|
-
// XXX (@Qix-) should we be logging these?
|
|
850
|
-
}
|
|
851
|
-
}
|
|
2953
|
+
return source + DOT_LITERAL + match[2];
|
|
2954
|
+
}
|
|
2955
|
+
}
|
|
2956
|
+
};
|
|
852
2957
|
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
*
|
|
856
|
-
* @return {String} returns the previously persisted debug modes
|
|
857
|
-
* @api private
|
|
858
|
-
*/
|
|
859
|
-
function load() {
|
|
860
|
-
let r;
|
|
861
|
-
try {
|
|
862
|
-
r = exports.storage.getItem('debug');
|
|
863
|
-
} catch (error) {
|
|
864
|
-
// Swallow
|
|
865
|
-
// XXX (@Qix-) should we be logging these?
|
|
866
|
-
}
|
|
2958
|
+
const output = utils$1.removePrefix(input, state);
|
|
2959
|
+
let source = create(output);
|
|
867
2960
|
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
}
|
|
2961
|
+
if (source && opts.strictSlashes !== true) {
|
|
2962
|
+
source += `${SLASH_LITERAL}?`;
|
|
2963
|
+
}
|
|
872
2964
|
|
|
873
|
-
|
|
874
|
-
}
|
|
2965
|
+
return source;
|
|
2966
|
+
};
|
|
2967
|
+
|
|
2968
|
+
var parse_1 = parse$2;
|
|
2969
|
+
|
|
2970
|
+
const path$1 = require$$0__default$1;
|
|
2971
|
+
const scan = scan_1;
|
|
2972
|
+
const parse$1 = parse_1;
|
|
2973
|
+
const utils = utils$3;
|
|
2974
|
+
const constants = constants$2;
|
|
2975
|
+
const isObject$1 = val => val && typeof val === 'object' && !Array.isArray(val);
|
|
875
2976
|
|
|
876
2977
|
/**
|
|
877
|
-
*
|
|
2978
|
+
* Creates a matcher function from one or more glob patterns. The
|
|
2979
|
+
* returned function takes a string to match as its first argument,
|
|
2980
|
+
* and returns true if the string is a match. The returned matcher
|
|
2981
|
+
* function also takes a boolean as the second argument that, when true,
|
|
2982
|
+
* returns an object with additional information.
|
|
878
2983
|
*
|
|
879
|
-
*
|
|
880
|
-
*
|
|
881
|
-
*
|
|
2984
|
+
* ```js
|
|
2985
|
+
* const picomatch = require('picomatch');
|
|
2986
|
+
* // picomatch(glob[, options]);
|
|
882
2987
|
*
|
|
883
|
-
*
|
|
884
|
-
*
|
|
2988
|
+
* const isMatch = picomatch('*.!(*a)');
|
|
2989
|
+
* console.log(isMatch('a.a')); //=> false
|
|
2990
|
+
* console.log(isMatch('a.b')); //=> true
|
|
2991
|
+
* ```
|
|
2992
|
+
* @name picomatch
|
|
2993
|
+
* @param {String|Array} `globs` One or more glob patterns.
|
|
2994
|
+
* @param {Object=} `options`
|
|
2995
|
+
* @return {Function=} Returns a matcher function.
|
|
2996
|
+
* @api public
|
|
885
2997
|
*/
|
|
886
2998
|
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
}
|
|
897
|
-
|
|
898
|
-
|
|
2999
|
+
const picomatch = (glob, options, returnState = false) => {
|
|
3000
|
+
if (Array.isArray(glob)) {
|
|
3001
|
+
const fns = glob.map(input => picomatch(input, options, returnState));
|
|
3002
|
+
const arrayMatcher = str => {
|
|
3003
|
+
for (const isMatch of fns) {
|
|
3004
|
+
const state = isMatch(str);
|
|
3005
|
+
if (state) return state;
|
|
3006
|
+
}
|
|
3007
|
+
return false;
|
|
3008
|
+
};
|
|
3009
|
+
return arrayMatcher;
|
|
3010
|
+
}
|
|
899
3011
|
|
|
900
|
-
const
|
|
3012
|
+
const isState = isObject$1(glob) && glob.tokens && glob.input;
|
|
901
3013
|
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
3014
|
+
if (glob === '' || (typeof glob !== 'string' && !isState)) {
|
|
3015
|
+
throw new TypeError('Expected pattern to be a non-empty string');
|
|
3016
|
+
}
|
|
905
3017
|
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
}
|
|
912
|
-
};
|
|
913
|
-
}(browser, browser.exports));
|
|
3018
|
+
const opts = options || {};
|
|
3019
|
+
const posix = utils.isWindows(options);
|
|
3020
|
+
const regex = isState
|
|
3021
|
+
? picomatch.compileRe(glob, options)
|
|
3022
|
+
: picomatch.makeRe(glob, options, false, true);
|
|
914
3023
|
|
|
915
|
-
|
|
3024
|
+
const state = regex.state;
|
|
3025
|
+
delete regex.state;
|
|
916
3026
|
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
3027
|
+
let isIgnored = () => false;
|
|
3028
|
+
if (opts.ignore) {
|
|
3029
|
+
const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null };
|
|
3030
|
+
isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
|
|
3031
|
+
}
|
|
920
3032
|
|
|
921
|
-
|
|
922
|
-
const
|
|
923
|
-
const
|
|
3033
|
+
const matcher = (input, returnObject = false) => {
|
|
3034
|
+
const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix });
|
|
3035
|
+
const result = { glob, state, regex, posix, input, output, match, isMatch };
|
|
924
3036
|
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
3037
|
+
if (typeof opts.onResult === 'function') {
|
|
3038
|
+
opts.onResult(result);
|
|
3039
|
+
}
|
|
928
3040
|
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
exports.load = load;
|
|
934
|
-
exports.useColors = useColors;
|
|
935
|
-
exports.destroy = util.deprecate(
|
|
936
|
-
() => {},
|
|
937
|
-
'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'
|
|
938
|
-
);
|
|
3041
|
+
if (isMatch === false) {
|
|
3042
|
+
result.isMatch = false;
|
|
3043
|
+
return returnObject ? result : false;
|
|
3044
|
+
}
|
|
939
3045
|
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
3046
|
+
if (isIgnored(input)) {
|
|
3047
|
+
if (typeof opts.onIgnore === 'function') {
|
|
3048
|
+
opts.onIgnore(result);
|
|
3049
|
+
}
|
|
3050
|
+
result.isMatch = false;
|
|
3051
|
+
return returnObject ? result : false;
|
|
3052
|
+
}
|
|
943
3053
|
|
|
944
|
-
|
|
3054
|
+
if (typeof opts.onMatch === 'function') {
|
|
3055
|
+
opts.onMatch(result);
|
|
3056
|
+
}
|
|
3057
|
+
return returnObject ? result : true;
|
|
3058
|
+
};
|
|
945
3059
|
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
const supportsColor = require('supports-color');
|
|
3060
|
+
if (returnState) {
|
|
3061
|
+
matcher.state = state;
|
|
3062
|
+
}
|
|
950
3063
|
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
20,
|
|
954
|
-
21,
|
|
955
|
-
26,
|
|
956
|
-
27,
|
|
957
|
-
32,
|
|
958
|
-
33,
|
|
959
|
-
38,
|
|
960
|
-
39,
|
|
961
|
-
40,
|
|
962
|
-
41,
|
|
963
|
-
42,
|
|
964
|
-
43,
|
|
965
|
-
44,
|
|
966
|
-
45,
|
|
967
|
-
56,
|
|
968
|
-
57,
|
|
969
|
-
62,
|
|
970
|
-
63,
|
|
971
|
-
68,
|
|
972
|
-
69,
|
|
973
|
-
74,
|
|
974
|
-
75,
|
|
975
|
-
76,
|
|
976
|
-
77,
|
|
977
|
-
78,
|
|
978
|
-
79,
|
|
979
|
-
80,
|
|
980
|
-
81,
|
|
981
|
-
92,
|
|
982
|
-
93,
|
|
983
|
-
98,
|
|
984
|
-
99,
|
|
985
|
-
112,
|
|
986
|
-
113,
|
|
987
|
-
128,
|
|
988
|
-
129,
|
|
989
|
-
134,
|
|
990
|
-
135,
|
|
991
|
-
148,
|
|
992
|
-
149,
|
|
993
|
-
160,
|
|
994
|
-
161,
|
|
995
|
-
162,
|
|
996
|
-
163,
|
|
997
|
-
164,
|
|
998
|
-
165,
|
|
999
|
-
166,
|
|
1000
|
-
167,
|
|
1001
|
-
168,
|
|
1002
|
-
169,
|
|
1003
|
-
170,
|
|
1004
|
-
171,
|
|
1005
|
-
172,
|
|
1006
|
-
173,
|
|
1007
|
-
178,
|
|
1008
|
-
179,
|
|
1009
|
-
184,
|
|
1010
|
-
185,
|
|
1011
|
-
196,
|
|
1012
|
-
197,
|
|
1013
|
-
198,
|
|
1014
|
-
199,
|
|
1015
|
-
200,
|
|
1016
|
-
201,
|
|
1017
|
-
202,
|
|
1018
|
-
203,
|
|
1019
|
-
204,
|
|
1020
|
-
205,
|
|
1021
|
-
206,
|
|
1022
|
-
207,
|
|
1023
|
-
208,
|
|
1024
|
-
209,
|
|
1025
|
-
214,
|
|
1026
|
-
215,
|
|
1027
|
-
220,
|
|
1028
|
-
221
|
|
1029
|
-
];
|
|
1030
|
-
}
|
|
1031
|
-
} catch (error) {
|
|
1032
|
-
// Swallow - we only care if `supports-color` is available; it doesn't have to be.
|
|
1033
|
-
}
|
|
3064
|
+
return matcher;
|
|
3065
|
+
};
|
|
1034
3066
|
|
|
1035
3067
|
/**
|
|
1036
|
-
*
|
|
3068
|
+
* Test `input` with the given `regex`. This is used by the main
|
|
3069
|
+
* `picomatch()` function to test the input string.
|
|
1037
3070
|
*
|
|
1038
|
-
*
|
|
3071
|
+
* ```js
|
|
3072
|
+
* const picomatch = require('picomatch');
|
|
3073
|
+
* // picomatch.test(input, regex[, options]);
|
|
3074
|
+
*
|
|
3075
|
+
* console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/));
|
|
3076
|
+
* // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' }
|
|
3077
|
+
* ```
|
|
3078
|
+
* @param {String} `input` String to test.
|
|
3079
|
+
* @param {RegExp} `regex`
|
|
3080
|
+
* @return {Object} Returns an object with matching info.
|
|
3081
|
+
* @api public
|
|
1039
3082
|
*/
|
|
1040
3083
|
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
const prop = key
|
|
1046
|
-
.substring(6)
|
|
1047
|
-
.toLowerCase()
|
|
1048
|
-
.replace(/_([a-z])/g, (_, k) => {
|
|
1049
|
-
return k.toUpperCase();
|
|
1050
|
-
});
|
|
3084
|
+
picomatch.test = (input, regex, options, { glob, posix } = {}) => {
|
|
3085
|
+
if (typeof input !== 'string') {
|
|
3086
|
+
throw new TypeError('Expected input to be a string');
|
|
3087
|
+
}
|
|
1051
3088
|
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
val = true;
|
|
1056
|
-
} else if (/^(no|off|false|disabled)$/i.test(val)) {
|
|
1057
|
-
val = false;
|
|
1058
|
-
} else if (val === 'null') {
|
|
1059
|
-
val = null;
|
|
1060
|
-
} else {
|
|
1061
|
-
val = Number(val);
|
|
1062
|
-
}
|
|
3089
|
+
if (input === '') {
|
|
3090
|
+
return { isMatch: false, output: '' };
|
|
3091
|
+
}
|
|
1063
3092
|
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
3093
|
+
const opts = options || {};
|
|
3094
|
+
const format = opts.format || (posix ? utils.toPosixSlashes : null);
|
|
3095
|
+
let match = input === glob;
|
|
3096
|
+
let output = (match && format) ? format(input) : input;
|
|
1067
3097
|
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
3098
|
+
if (match === false) {
|
|
3099
|
+
output = format ? format(input) : input;
|
|
3100
|
+
match = output === glob;
|
|
3101
|
+
}
|
|
1071
3102
|
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
3103
|
+
if (match === false || opts.capture === true) {
|
|
3104
|
+
if (opts.matchBase === true || opts.basename === true) {
|
|
3105
|
+
match = picomatch.matchBase(input, regex, options, posix);
|
|
3106
|
+
} else {
|
|
3107
|
+
match = regex.exec(output);
|
|
3108
|
+
}
|
|
3109
|
+
}
|
|
3110
|
+
|
|
3111
|
+
return { isMatch: Boolean(match), match, output };
|
|
3112
|
+
};
|
|
1077
3113
|
|
|
1078
3114
|
/**
|
|
1079
|
-
*
|
|
3115
|
+
* Match the basename of a filepath.
|
|
1080
3116
|
*
|
|
3117
|
+
* ```js
|
|
3118
|
+
* const picomatch = require('picomatch');
|
|
3119
|
+
* // picomatch.matchBase(input, glob[, options]);
|
|
3120
|
+
* console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true
|
|
3121
|
+
* ```
|
|
3122
|
+
* @param {String} `input` String to test.
|
|
3123
|
+
* @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe).
|
|
3124
|
+
* @return {Boolean}
|
|
1081
3125
|
* @api public
|
|
1082
3126
|
*/
|
|
1083
3127
|
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
const c = this.color;
|
|
1089
|
-
const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c);
|
|
1090
|
-
const prefix = ` ${colorCode};1m${name} \u001B[0m`;
|
|
3128
|
+
picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => {
|
|
3129
|
+
const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
|
|
3130
|
+
return regex.test(path$1.basename(input));
|
|
3131
|
+
};
|
|
1091
3132
|
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
3133
|
+
/**
|
|
3134
|
+
* Returns true if **any** of the given glob `patterns` match the specified `string`.
|
|
3135
|
+
*
|
|
3136
|
+
* ```js
|
|
3137
|
+
* const picomatch = require('picomatch');
|
|
3138
|
+
* // picomatch.isMatch(string, patterns[, options]);
|
|
3139
|
+
*
|
|
3140
|
+
* console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true
|
|
3141
|
+
* console.log(picomatch.isMatch('a.a', 'b.*')); //=> false
|
|
3142
|
+
* ```
|
|
3143
|
+
* @param {String|Array} str The string to test.
|
|
3144
|
+
* @param {String|Array} patterns One or more glob patterns to use for matching.
|
|
3145
|
+
* @param {Object} [options] See available [options](#options).
|
|
3146
|
+
* @return {Boolean} Returns true if any patterns match `str`
|
|
3147
|
+
* @api public
|
|
3148
|
+
*/
|
|
1098
3149
|
|
|
1099
|
-
|
|
1100
|
-
if (exports.inspectOpts.hideDate) {
|
|
1101
|
-
return '';
|
|
1102
|
-
}
|
|
1103
|
-
return new Date().toISOString() + ' ';
|
|
1104
|
-
}
|
|
3150
|
+
picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
|
|
1105
3151
|
|
|
1106
3152
|
/**
|
|
1107
|
-
*
|
|
3153
|
+
* Parse a glob pattern to create the source string for a regular
|
|
3154
|
+
* expression.
|
|
3155
|
+
*
|
|
3156
|
+
* ```js
|
|
3157
|
+
* const picomatch = require('picomatch');
|
|
3158
|
+
* const result = picomatch.parse(pattern[, options]);
|
|
3159
|
+
* ```
|
|
3160
|
+
* @param {String} `pattern`
|
|
3161
|
+
* @param {Object} `options`
|
|
3162
|
+
* @return {Object} Returns an object with useful properties and output to be used as a regex source string.
|
|
3163
|
+
* @api public
|
|
1108
3164
|
*/
|
|
1109
3165
|
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
}
|
|
3166
|
+
picomatch.parse = (pattern, options) => {
|
|
3167
|
+
if (Array.isArray(pattern)) return pattern.map(p => picomatch.parse(p, options));
|
|
3168
|
+
return parse$1(pattern, { ...options, fastpaths: false });
|
|
3169
|
+
};
|
|
1113
3170
|
|
|
1114
3171
|
/**
|
|
1115
|
-
*
|
|
3172
|
+
* Scan a glob pattern to separate the pattern into segments.
|
|
1116
3173
|
*
|
|
1117
|
-
*
|
|
1118
|
-
*
|
|
3174
|
+
* ```js
|
|
3175
|
+
* const picomatch = require('picomatch');
|
|
3176
|
+
* // picomatch.scan(input[, options]);
|
|
3177
|
+
*
|
|
3178
|
+
* const result = picomatch.scan('!./foo/*.js');
|
|
3179
|
+
* console.log(result);
|
|
3180
|
+
* { prefix: '!./',
|
|
3181
|
+
* input: '!./foo/*.js',
|
|
3182
|
+
* start: 3,
|
|
3183
|
+
* base: 'foo',
|
|
3184
|
+
* glob: '*.js',
|
|
3185
|
+
* isBrace: false,
|
|
3186
|
+
* isBracket: false,
|
|
3187
|
+
* isGlob: true,
|
|
3188
|
+
* isExtglob: false,
|
|
3189
|
+
* isGlobstar: false,
|
|
3190
|
+
* negated: true }
|
|
3191
|
+
* ```
|
|
3192
|
+
* @param {String} `input` Glob pattern to scan.
|
|
3193
|
+
* @param {Object} `options`
|
|
3194
|
+
* @return {Object} Returns an object with
|
|
3195
|
+
* @api public
|
|
1119
3196
|
*/
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
process.env.DEBUG = namespaces;
|
|
1123
|
-
} else {
|
|
1124
|
-
// If you set a process.env field to null or undefined, it gets cast to the
|
|
1125
|
-
// string 'null' or 'undefined'. Just delete instead.
|
|
1126
|
-
delete process.env.DEBUG;
|
|
1127
|
-
}
|
|
1128
|
-
}
|
|
3197
|
+
|
|
3198
|
+
picomatch.scan = (input, options) => scan(input, options);
|
|
1129
3199
|
|
|
1130
3200
|
/**
|
|
1131
|
-
*
|
|
3201
|
+
* Compile a regular expression from the `state` object returned by the
|
|
3202
|
+
* [parse()](#parse) method.
|
|
1132
3203
|
*
|
|
1133
|
-
* @
|
|
1134
|
-
* @
|
|
3204
|
+
* @param {Object} `state`
|
|
3205
|
+
* @param {Object} `options`
|
|
3206
|
+
* @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser.
|
|
3207
|
+
* @param {Boolean} `returnState` Adds the state to a `state` property on the returned regex. Useful for implementors and debugging.
|
|
3208
|
+
* @return {RegExp}
|
|
3209
|
+
* @api public
|
|
1135
3210
|
*/
|
|
1136
3211
|
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
3212
|
+
picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => {
|
|
3213
|
+
if (returnOutput === true) {
|
|
3214
|
+
return state.output;
|
|
3215
|
+
}
|
|
3216
|
+
|
|
3217
|
+
const opts = options || {};
|
|
3218
|
+
const prepend = opts.contains ? '' : '^';
|
|
3219
|
+
const append = opts.contains ? '' : '$';
|
|
3220
|
+
|
|
3221
|
+
let source = `${prepend}(?:${state.output})${append}`;
|
|
3222
|
+
if (state && state.negated === true) {
|
|
3223
|
+
source = `^(?!${source}).*$`;
|
|
3224
|
+
}
|
|
3225
|
+
|
|
3226
|
+
const regex = picomatch.toRegex(source, options);
|
|
3227
|
+
if (returnState === true) {
|
|
3228
|
+
regex.state = state;
|
|
3229
|
+
}
|
|
3230
|
+
|
|
3231
|
+
return regex;
|
|
3232
|
+
};
|
|
1140
3233
|
|
|
1141
3234
|
/**
|
|
1142
|
-
*
|
|
3235
|
+
* Create a regular expression from a parsed glob pattern.
|
|
3236
|
+
*
|
|
3237
|
+
* ```js
|
|
3238
|
+
* const picomatch = require('picomatch');
|
|
3239
|
+
* const state = picomatch.parse('*.js');
|
|
3240
|
+
* // picomatch.compileRe(state[, options]);
|
|
1143
3241
|
*
|
|
1144
|
-
*
|
|
1145
|
-
*
|
|
3242
|
+
* console.log(picomatch.compileRe(state));
|
|
3243
|
+
* //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
|
|
3244
|
+
* ```
|
|
3245
|
+
* @param {String} `state` The object returned from the `.parse` method.
|
|
3246
|
+
* @param {Object} `options`
|
|
3247
|
+
* @param {Boolean} `returnOutput` Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result.
|
|
3248
|
+
* @param {Boolean} `returnState` Implementors may use this argument to return the state from the parsed glob with the returned regular expression.
|
|
3249
|
+
* @return {RegExp} Returns a regex created from the given pattern.
|
|
3250
|
+
* @api public
|
|
1146
3251
|
*/
|
|
1147
3252
|
|
|
1148
|
-
|
|
1149
|
-
|
|
3253
|
+
picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
|
|
3254
|
+
if (!input || typeof input !== 'string') {
|
|
3255
|
+
throw new TypeError('Expected a non-empty string');
|
|
3256
|
+
}
|
|
1150
3257
|
|
|
1151
|
-
|
|
1152
|
-
for (let i = 0; i < keys.length; i++) {
|
|
1153
|
-
debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
|
|
1154
|
-
}
|
|
1155
|
-
}
|
|
3258
|
+
let parsed = { negated: false, fastpaths: true };
|
|
1156
3259
|
|
|
1157
|
-
|
|
3260
|
+
if (options.fastpaths !== false && (input[0] === '.' || input[0] === '*')) {
|
|
3261
|
+
parsed.output = parse$1.fastpaths(input, options);
|
|
3262
|
+
}
|
|
3263
|
+
|
|
3264
|
+
if (!parsed.output) {
|
|
3265
|
+
parsed = parse$1(input, options);
|
|
3266
|
+
}
|
|
1158
3267
|
|
|
1159
|
-
|
|
3268
|
+
return picomatch.compileRe(parsed, options, returnOutput, returnState);
|
|
3269
|
+
};
|
|
1160
3270
|
|
|
1161
3271
|
/**
|
|
1162
|
-
*
|
|
3272
|
+
* Create a regular expression from the given regex source string.
|
|
3273
|
+
*
|
|
3274
|
+
* ```js
|
|
3275
|
+
* const picomatch = require('picomatch');
|
|
3276
|
+
* // picomatch.toRegex(source[, options]);
|
|
3277
|
+
*
|
|
3278
|
+
* const { output } = picomatch.parse('*.js');
|
|
3279
|
+
* console.log(picomatch.toRegex(output));
|
|
3280
|
+
* //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
|
|
3281
|
+
* ```
|
|
3282
|
+
* @param {String} `source` Regular expression source string.
|
|
3283
|
+
* @param {Object} `options`
|
|
3284
|
+
* @return {RegExp}
|
|
3285
|
+
* @api public
|
|
1163
3286
|
*/
|
|
1164
3287
|
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
3288
|
+
picomatch.toRegex = (source, options) => {
|
|
3289
|
+
try {
|
|
3290
|
+
const opts = options || {};
|
|
3291
|
+
return new RegExp(source, opts.flags || (opts.nocase ? 'i' : ''));
|
|
3292
|
+
} catch (err) {
|
|
3293
|
+
if (options && options.debug === true) throw err;
|
|
3294
|
+
return /$^/;
|
|
3295
|
+
}
|
|
1171
3296
|
};
|
|
1172
3297
|
|
|
1173
3298
|
/**
|
|
1174
|
-
*
|
|
3299
|
+
* Picomatch constants.
|
|
3300
|
+
* @return {Object}
|
|
1175
3301
|
*/
|
|
1176
3302
|
|
|
1177
|
-
|
|
1178
|
-
this.inspectOpts.colors = this.useColors;
|
|
1179
|
-
return util.inspect(v, this.inspectOpts);
|
|
1180
|
-
};
|
|
1181
|
-
}(node, node.exports));
|
|
3303
|
+
picomatch.constants = constants;
|
|
1182
3304
|
|
|
1183
3305
|
/**
|
|
1184
|
-
*
|
|
1185
|
-
* treat as a browser.
|
|
3306
|
+
* Expose "picomatch"
|
|
1186
3307
|
*/
|
|
1187
3308
|
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
3309
|
+
var picomatch_1 = picomatch;
|
|
3310
|
+
|
|
3311
|
+
(function (module) {
|
|
3312
|
+
|
|
3313
|
+
module.exports = picomatch_1;
|
|
3314
|
+
} (picomatch$1));
|
|
3315
|
+
|
|
3316
|
+
var pm = /*@__PURE__*/getDefaultExportFromCjs(picomatch$1.exports);
|
|
3317
|
+
|
|
3318
|
+
// Helper since Typescript can't detect readonly arrays with Array.isArray
|
|
3319
|
+
function isArray(arg) {
|
|
3320
|
+
return Array.isArray(arg);
|
|
3321
|
+
}
|
|
3322
|
+
function ensureArray(thing) {
|
|
3323
|
+
if (isArray(thing))
|
|
3324
|
+
return thing;
|
|
3325
|
+
if (thing == null)
|
|
3326
|
+
return [];
|
|
3327
|
+
return [thing];
|
|
1192
3328
|
}
|
|
1193
3329
|
|
|
1194
|
-
|
|
3330
|
+
const normalizePath$1 = function normalizePath(filename) {
|
|
3331
|
+
return filename.split(require$$0$1.win32.sep).join(require$$0$1.posix.sep);
|
|
3332
|
+
};
|
|
1195
3333
|
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
3334
|
+
function getMatcherString(id, resolutionBase) {
|
|
3335
|
+
if (resolutionBase === false || require$$0$1.isAbsolute(id) || id.startsWith('*')) {
|
|
3336
|
+
return normalizePath$1(id);
|
|
3337
|
+
}
|
|
3338
|
+
// resolve('') is valid and will default to process.cwd()
|
|
3339
|
+
const basePath = normalizePath$1(require$$0$1.resolve(resolutionBase || ''))
|
|
3340
|
+
// escape all possible (posix + win) path characters that might interfere with regex
|
|
3341
|
+
.replace(/[-^$*+?.()|[\]{}]/g, '\\$&');
|
|
3342
|
+
// Note that we use posix.join because:
|
|
3343
|
+
// 1. the basePath has been normalized to use /
|
|
3344
|
+
// 2. the incoming glob (id) matcher, also uses /
|
|
3345
|
+
// otherwise Node will force backslash (\) on windows
|
|
3346
|
+
return require$$0$1.posix.join(basePath, normalizePath$1(id));
|
|
3347
|
+
}
|
|
3348
|
+
const createFilter$1 = function createFilter(include, exclude, options) {
|
|
3349
|
+
const resolutionBase = options && options.resolve;
|
|
3350
|
+
const getMatcher = (id) => id instanceof RegExp
|
|
3351
|
+
? id
|
|
3352
|
+
: {
|
|
3353
|
+
test: (what) => {
|
|
3354
|
+
// this refactor is a tad overly verbose but makes for easy debugging
|
|
3355
|
+
const pattern = getMatcherString(id, resolutionBase);
|
|
3356
|
+
const fn = pm(pattern, { dot: true });
|
|
3357
|
+
const result = fn(what);
|
|
3358
|
+
return result;
|
|
3359
|
+
}
|
|
3360
|
+
};
|
|
3361
|
+
const includeMatchers = ensureArray(include).map(getMatcher);
|
|
3362
|
+
const excludeMatchers = ensureArray(exclude).map(getMatcher);
|
|
3363
|
+
return function result(id) {
|
|
3364
|
+
if (typeof id !== 'string')
|
|
3365
|
+
return false;
|
|
3366
|
+
if (/\0/.test(id))
|
|
3367
|
+
return false;
|
|
3368
|
+
const pathId = normalizePath$1(id);
|
|
3369
|
+
for (let i = 0; i < excludeMatchers.length; ++i) {
|
|
3370
|
+
const matcher = excludeMatchers[i];
|
|
3371
|
+
if (matcher.test(pathId))
|
|
3372
|
+
return false;
|
|
3373
|
+
}
|
|
3374
|
+
for (let i = 0; i < includeMatchers.length; ++i) {
|
|
3375
|
+
const matcher = includeMatchers[i];
|
|
3376
|
+
if (matcher.test(pathId))
|
|
3377
|
+
return true;
|
|
3378
|
+
}
|
|
3379
|
+
return !includeMatchers.length;
|
|
3380
|
+
};
|
|
3381
|
+
};
|
|
1200
3382
|
|
|
3383
|
+
const reservedWords = 'break case class catch const continue debugger default delete do else export extends finally for function if import in instanceof let new return super switch this throw try typeof var void while with yield enum await implements package protected static interface private public';
|
|
3384
|
+
const builtins = 'arguments Infinity NaN undefined null true false eval uneval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Symbol Error EvalError InternalError RangeError ReferenceError SyntaxError TypeError URIError Number Math Date String RegExp Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array Map Set WeakMap WeakSet SIMD ArrayBuffer DataView JSON Promise Generator GeneratorFunction Reflect Proxy Intl';
|
|
3385
|
+
const forbiddenIdentifiers = new Set(`${reservedWords} ${builtins}`.split(' '));
|
|
3386
|
+
forbiddenIdentifiers.add('');
|
|
3387
|
+
|
|
3388
|
+
const createFilter = createFilter$1;
|
|
1201
3389
|
function slash(p) {
|
|
1202
3390
|
return p.replace(/\\/g, '/');
|
|
1203
3391
|
}
|
|
1204
3392
|
// TODO: use import()
|
|
1205
|
-
const _require =
|
|
3393
|
+
const _require = node_module.createRequire((typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('node-cjs/publicUtils.cjs', document.baseURI).href)));
|
|
1206
3394
|
try {
|
|
1207
3395
|
Boolean(_require('pnpapi'));
|
|
1208
3396
|
}
|
|
@@ -1271,11 +3459,11 @@ function isFileReadable(filename) {
|
|
|
1271
3459
|
}
|
|
1272
3460
|
}
|
|
1273
3461
|
isWindows
|
|
1274
|
-
?
|
|
3462
|
+
? node_util.promisify(gracefulRemoveDir)
|
|
1275
3463
|
: function removeDirSync(dir) {
|
|
1276
3464
|
fs__default.rmSync(dir, { recursive: true, force: true });
|
|
1277
3465
|
};
|
|
1278
|
-
isWindows ?
|
|
3466
|
+
isWindows ? node_util.promisify(gracefulRename) : fs__default.renameSync;
|
|
1279
3467
|
function arraify(target) {
|
|
1280
3468
|
return Array.isArray(target) ? target : [target];
|
|
1281
3469
|
}
|
|
@@ -1449,8 +3637,8 @@ var etag_1 = etag;
|
|
|
1449
3637
|
* @private
|
|
1450
3638
|
*/
|
|
1451
3639
|
|
|
1452
|
-
var crypto = require$$0__default$
|
|
1453
|
-
var Stats =
|
|
3640
|
+
var crypto = require$$0__default$2;
|
|
3641
|
+
var Stats = require$$1__default$1.Stats;
|
|
1454
3642
|
|
|
1455
3643
|
/**
|
|
1456
3644
|
* Module variables.
|
|
@@ -1651,11 +3839,11 @@ function createLogger(level = 'info', options = {}) {
|
|
|
1651
3839
|
const format = () => {
|
|
1652
3840
|
if (options.timestamp) {
|
|
1653
3841
|
const tag = type === 'info'
|
|
1654
|
-
?
|
|
3842
|
+
? picocolors.exports.cyan(picocolors.exports.bold(prefix))
|
|
1655
3843
|
: type === 'warn'
|
|
1656
|
-
?
|
|
1657
|
-
:
|
|
1658
|
-
return `${
|
|
3844
|
+
? picocolors.exports.yellow(picocolors.exports.bold(prefix))
|
|
3845
|
+
: picocolors.exports.red(picocolors.exports.bold(prefix));
|
|
3846
|
+
return `${picocolors.exports.dim(new Date().toLocaleTimeString())} ${tag} ${msg}`;
|
|
1659
3847
|
}
|
|
1660
3848
|
else {
|
|
1661
3849
|
return msg;
|
|
@@ -1668,7 +3856,7 @@ function createLogger(level = 'info', options = {}) {
|
|
|
1668
3856
|
if (type === lastType && msg === lastMsg) {
|
|
1669
3857
|
sameCount++;
|
|
1670
3858
|
clear();
|
|
1671
|
-
console[method](format(),
|
|
3859
|
+
console[method](format(), picocolors.exports.yellow(`(x${sameCount + 1})`));
|
|
1672
3860
|
}
|
|
1673
3861
|
else {
|
|
1674
3862
|
sameCount = 0;
|
|
@@ -1734,7 +3922,7 @@ const ROOT_FILES = [
|
|
|
1734
3922
|
// npm: https://docs.npmjs.com/cli/v7/using-npm/workspaces#installing-workspaces
|
|
1735
3923
|
// yarn: https://classic.yarnpkg.com/en/docs/workspaces/#toc-how-to-use-it
|
|
1736
3924
|
function hasWorkspacePackageJSON(root) {
|
|
1737
|
-
const path = path$
|
|
3925
|
+
const path = path$3.join(root, 'package.json');
|
|
1738
3926
|
if (!isFileReadable(path)) {
|
|
1739
3927
|
return false;
|
|
1740
3928
|
}
|
|
@@ -1742,10 +3930,10 @@ function hasWorkspacePackageJSON(root) {
|
|
|
1742
3930
|
return !!content.workspaces;
|
|
1743
3931
|
}
|
|
1744
3932
|
function hasRootFile(root) {
|
|
1745
|
-
return ROOT_FILES.some((file) => fs__default.existsSync(path$
|
|
3933
|
+
return ROOT_FILES.some((file) => fs__default.existsSync(path$3.join(root, file)));
|
|
1746
3934
|
}
|
|
1747
3935
|
function hasPackageJSON(root) {
|
|
1748
|
-
const path = path$
|
|
3936
|
+
const path = path$3.join(root, 'package.json');
|
|
1749
3937
|
return fs__default.existsSync(path);
|
|
1750
3938
|
}
|
|
1751
3939
|
/**
|
|
@@ -1754,7 +3942,7 @@ function hasPackageJSON(root) {
|
|
|
1754
3942
|
function searchForPackageRoot(current, root = current) {
|
|
1755
3943
|
if (hasPackageJSON(current))
|
|
1756
3944
|
return current;
|
|
1757
|
-
const dir = path$
|
|
3945
|
+
const dir = path$3.dirname(current);
|
|
1758
3946
|
// reach the fs root
|
|
1759
3947
|
if (!dir || dir === current)
|
|
1760
3948
|
return root;
|
|
@@ -1768,7 +3956,7 @@ function searchForWorkspaceRoot(current, root = searchForPackageRoot(current)) {
|
|
|
1768
3956
|
return current;
|
|
1769
3957
|
if (hasWorkspacePackageJSON(current))
|
|
1770
3958
|
return current;
|
|
1771
|
-
const dir = path$
|
|
3959
|
+
const dir = path$3.dirname(current);
|
|
1772
3960
|
// reach the fs root
|
|
1773
3961
|
if (!dir || dir === current)
|
|
1774
3962
|
return root;
|
|
@@ -1777,9 +3965,9 @@ function searchForWorkspaceRoot(current, root = searchForPackageRoot(current)) {
|
|
|
1777
3965
|
|
|
1778
3966
|
var main$1 = {exports: {}};
|
|
1779
3967
|
|
|
1780
|
-
const fs =
|
|
1781
|
-
const path =
|
|
1782
|
-
const os =
|
|
3968
|
+
const fs = require$$1__default$1;
|
|
3969
|
+
const path = require$$0__default$1;
|
|
3970
|
+
const os = require$$2__default;
|
|
1783
3971
|
|
|
1784
3972
|
function log (message) {
|
|
1785
3973
|
console.log(`[dotenv][DEBUG] ${message}`);
|
|
@@ -1920,8 +4108,6 @@ main$1.exports.config = DotenvModule.config;
|
|
|
1920
4108
|
main$1.exports.parse = DotenvModule.parse;
|
|
1921
4109
|
main$1.exports = DotenvModule;
|
|
1922
4110
|
|
|
1923
|
-
var dotenv = main$1.exports;
|
|
1924
|
-
|
|
1925
4111
|
var dotenvExpand = function (config) {
|
|
1926
4112
|
// if ignoring process.env, use a blank object
|
|
1927
4113
|
var environment = config.ignoreProcessEnv ? {} : process.env;
|
|
@@ -1991,7 +4177,7 @@ function loadEnv(mode, envDir, prefixes = 'VITE_') {
|
|
|
1991
4177
|
for (const file of envFiles) {
|
|
1992
4178
|
const path = lookupFile(envDir, [file], { pathOnly: true, rootDir: envDir });
|
|
1993
4179
|
if (path) {
|
|
1994
|
-
const parsed =
|
|
4180
|
+
const parsed = main$1.exports.parse(fs__default.readFileSync(path), {
|
|
1995
4181
|
debug: process.env.DEBUG?.includes('vite:dotenv') || undefined
|
|
1996
4182
|
});
|
|
1997
4183
|
// let environment variables use each other
|
|
@@ -2024,6 +4210,9 @@ function resolveEnvPrefix({ envPrefix = 'VITE_' }) {
|
|
|
2024
4210
|
return envPrefix;
|
|
2025
4211
|
}
|
|
2026
4212
|
|
|
4213
|
+
exports.esbuildVersion = esbuild.version;
|
|
4214
|
+
exports.rollupVersion = rollup.VERSION;
|
|
4215
|
+
exports.createFilter = createFilter;
|
|
2027
4216
|
exports.createLogger = createLogger;
|
|
2028
4217
|
exports.loadEnv = loadEnv;
|
|
2029
4218
|
exports.mergeAlias = mergeAlias;
|
|
@@ -2034,3 +4223,4 @@ exports.searchForWorkspaceRoot = searchForWorkspaceRoot;
|
|
|
2034
4223
|
exports.send = send;
|
|
2035
4224
|
exports.splitVendorChunk = splitVendorChunk;
|
|
2036
4225
|
exports.splitVendorChunkPlugin = splitVendorChunkPlugin;
|
|
4226
|
+
exports.version = VERSION;
|