prettier 4.0.0-alpha.8 → 4.0.0-alpha.9
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 +63 -541
- package/bin/prettier.cjs +4 -8
- package/doc.js +30 -39
- package/doc.mjs +30 -39
- package/index.cjs +2 -2
- package/index.d.ts +32 -13
- package/index.mjs +3097 -4468
- package/internal/cli.mjs +468 -3739
- package/package.json +2 -2
- package/plugins/acorn.js +14 -12
- package/plugins/acorn.mjs +14 -12
- package/plugins/angular.js +1 -1
- package/plugins/angular.mjs +1 -1
- package/plugins/babel.d.ts +1 -0
- package/plugins/babel.js +10 -11
- package/plugins/babel.mjs +10 -11
- package/plugins/estree.js +28 -28
- package/plugins/estree.mjs +28 -28
- package/plugins/flow.js +15 -17
- package/plugins/flow.mjs +15 -17
- package/plugins/glimmer.js +23 -23
- package/plugins/glimmer.mjs +23 -23
- package/plugins/graphql.js +9 -9
- package/plugins/graphql.mjs +9 -9
- package/plugins/html.js +18 -15
- package/plugins/html.mjs +18 -15
- package/plugins/markdown.js +45 -42
- package/plugins/markdown.mjs +45 -42
- package/plugins/meriyah.js +4 -5
- package/plugins/meriyah.mjs +4 -5
- package/plugins/postcss.js +29 -26
- package/plugins/postcss.mjs +29 -26
- package/plugins/typescript.js +15 -20
- package/plugins/typescript.mjs +15 -20
- package/plugins/yaml.js +32 -32
- package/plugins/yaml.mjs +32 -32
- package/standalone.js +27 -27
- package/standalone.mjs +27 -27
package/internal/cli.mjs
CHANGED
|
@@ -11,11 +11,13 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
11
11
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
12
12
|
var __getProtoOf = Object.getPrototypeOf;
|
|
13
13
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __typeError = (msg) => {
|
|
15
|
+
throw TypeError(msg);
|
|
16
|
+
};
|
|
14
17
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
15
18
|
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
16
19
|
}) : x)(function(x) {
|
|
17
|
-
if (typeof require !== "undefined")
|
|
18
|
-
return require.apply(this, arguments);
|
|
20
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
19
21
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
20
22
|
});
|
|
21
23
|
var __commonJS = (cb, mod) => function __require2() {
|
|
@@ -37,40 +39,17 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
37
39
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
38
40
|
mod
|
|
39
41
|
));
|
|
40
|
-
var __accessCheck = (obj, member, msg) =>
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
var __privateGet = (obj, member, getter) => {
|
|
45
|
-
__accessCheck(obj, member, "read from private field");
|
|
46
|
-
return getter ? getter.call(obj) : member.get(obj);
|
|
47
|
-
};
|
|
48
|
-
var __privateAdd = (obj, member, value) => {
|
|
49
|
-
if (member.has(obj))
|
|
50
|
-
throw TypeError("Cannot add the same private member more than once");
|
|
51
|
-
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
52
|
-
};
|
|
53
|
-
var __privateSet = (obj, member, value, setter) => {
|
|
54
|
-
__accessCheck(obj, member, "write to private field");
|
|
55
|
-
setter ? setter.call(obj, value) : member.set(obj, value);
|
|
56
|
-
return value;
|
|
57
|
-
};
|
|
58
|
-
var __privateWrapper = (obj, member, setter, getter) => ({
|
|
59
|
-
set _(value) {
|
|
60
|
-
__privateSet(obj, member, value, setter);
|
|
61
|
-
},
|
|
62
|
-
get _() {
|
|
63
|
-
return __privateGet(obj, member, getter);
|
|
64
|
-
}
|
|
65
|
-
});
|
|
42
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
43
|
+
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
44
|
+
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
45
|
+
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
66
46
|
|
|
67
47
|
// node_modules/dashify/index.js
|
|
68
48
|
var require_dashify = __commonJS({
|
|
69
49
|
"node_modules/dashify/index.js"(exports, module) {
|
|
70
50
|
"use strict";
|
|
71
51
|
module.exports = (str, options) => {
|
|
72
|
-
if (typeof str !== "string")
|
|
73
|
-
throw new TypeError("expected a string");
|
|
52
|
+
if (typeof str !== "string") throw new TypeError("expected a string");
|
|
74
53
|
return str.trim().replace(/([a-z])([A-Z])/g, "$1-$2").replace(/\W/g, (m) => /[À-ž]/.test(m) ? m : "-").replace(/^-+|-+$/g, "").replace(/-{2,}/g, (m) => options && options.condense ? "-" : m).toLowerCase();
|
|
75
54
|
};
|
|
76
55
|
}
|
|
@@ -303,10 +282,8 @@ var require_fast_json_stable_stringify = __commonJS({
|
|
|
303
282
|
"node_modules/fast-json-stable-stringify/index.js"(exports, module) {
|
|
304
283
|
"use strict";
|
|
305
284
|
module.exports = function(data, opts) {
|
|
306
|
-
if (!opts)
|
|
307
|
-
|
|
308
|
-
if (typeof opts === "function")
|
|
309
|
-
opts = { cmp: opts };
|
|
285
|
+
if (!opts) opts = {};
|
|
286
|
+
if (typeof opts === "function") opts = { cmp: opts };
|
|
310
287
|
var cycles = typeof opts.cycles === "boolean" ? opts.cycles : false;
|
|
311
288
|
var cmp = opts.cmp && /* @__PURE__ */ function(f) {
|
|
312
289
|
return function(node) {
|
|
@@ -322,27 +299,21 @@ var require_fast_json_stable_stringify = __commonJS({
|
|
|
322
299
|
if (node && node.toJSON && typeof node.toJSON === "function") {
|
|
323
300
|
node = node.toJSON();
|
|
324
301
|
}
|
|
325
|
-
if (node === void 0)
|
|
326
|
-
|
|
327
|
-
if (typeof node
|
|
328
|
-
return isFinite(node) ? "" + node : "null";
|
|
329
|
-
if (typeof node !== "object")
|
|
330
|
-
return JSON.stringify(node);
|
|
302
|
+
if (node === void 0) return;
|
|
303
|
+
if (typeof node == "number") return isFinite(node) ? "" + node : "null";
|
|
304
|
+
if (typeof node !== "object") return JSON.stringify(node);
|
|
331
305
|
var i, out;
|
|
332
306
|
if (Array.isArray(node)) {
|
|
333
307
|
out = "[";
|
|
334
308
|
for (i = 0; i < node.length; i++) {
|
|
335
|
-
if (i)
|
|
336
|
-
out += ",";
|
|
309
|
+
if (i) out += ",";
|
|
337
310
|
out += stringify4(node[i]) || "null";
|
|
338
311
|
}
|
|
339
312
|
return out + "]";
|
|
340
313
|
}
|
|
341
|
-
if (node === null)
|
|
342
|
-
return "null";
|
|
314
|
+
if (node === null) return "null";
|
|
343
315
|
if (seen.indexOf(node) !== -1) {
|
|
344
|
-
if (cycles)
|
|
345
|
-
return JSON.stringify("__cycle__");
|
|
316
|
+
if (cycles) return JSON.stringify("__cycle__");
|
|
346
317
|
throw new TypeError("Converting circular structure to JSON");
|
|
347
318
|
}
|
|
348
319
|
var seenIndex = seen.push(node) - 1;
|
|
@@ -351,10 +322,8 @@ var require_fast_json_stable_stringify = __commonJS({
|
|
|
351
322
|
for (i = 0; i < keys.length; i++) {
|
|
352
323
|
var key = keys[i];
|
|
353
324
|
var value = stringify4(node[key]);
|
|
354
|
-
if (!value)
|
|
355
|
-
|
|
356
|
-
if (out)
|
|
357
|
-
out += ",";
|
|
325
|
+
if (!value) continue;
|
|
326
|
+
if (out) out += ",";
|
|
358
327
|
out += JSON.stringify(key) + ":" + value;
|
|
359
328
|
}
|
|
360
329
|
seen.splice(seenIndex, 1);
|
|
@@ -364,512 +333,6 @@ var require_fast_json_stable_stringify = __commonJS({
|
|
|
364
333
|
}
|
|
365
334
|
});
|
|
366
335
|
|
|
367
|
-
// node_modules/diff/lib/diff/base.js
|
|
368
|
-
var require_base = __commonJS({
|
|
369
|
-
"node_modules/diff/lib/diff/base.js"(exports) {
|
|
370
|
-
"use strict";
|
|
371
|
-
Object.defineProperty(exports, "__esModule", {
|
|
372
|
-
value: true
|
|
373
|
-
});
|
|
374
|
-
exports["default"] = Diff;
|
|
375
|
-
function Diff() {
|
|
376
|
-
}
|
|
377
|
-
Diff.prototype = {
|
|
378
|
-
/*istanbul ignore start*/
|
|
379
|
-
/*istanbul ignore end*/
|
|
380
|
-
diff: function diff2(oldString, newString) {
|
|
381
|
-
var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
382
|
-
var callback = options.callback;
|
|
383
|
-
if (typeof options === "function") {
|
|
384
|
-
callback = options;
|
|
385
|
-
options = {};
|
|
386
|
-
}
|
|
387
|
-
this.options = options;
|
|
388
|
-
var self = this;
|
|
389
|
-
function done(value) {
|
|
390
|
-
if (callback) {
|
|
391
|
-
setTimeout(function() {
|
|
392
|
-
callback(void 0, value);
|
|
393
|
-
}, 0);
|
|
394
|
-
return true;
|
|
395
|
-
} else {
|
|
396
|
-
return value;
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
oldString = this.castInput(oldString);
|
|
400
|
-
newString = this.castInput(newString);
|
|
401
|
-
oldString = this.removeEmpty(this.tokenize(oldString));
|
|
402
|
-
newString = this.removeEmpty(this.tokenize(newString));
|
|
403
|
-
var newLen = newString.length, oldLen = oldString.length;
|
|
404
|
-
var editLength = 1;
|
|
405
|
-
var maxEditLength = newLen + oldLen;
|
|
406
|
-
if (options.maxEditLength) {
|
|
407
|
-
maxEditLength = Math.min(maxEditLength, options.maxEditLength);
|
|
408
|
-
}
|
|
409
|
-
var bestPath = [{
|
|
410
|
-
newPos: -1,
|
|
411
|
-
components: []
|
|
412
|
-
}];
|
|
413
|
-
var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0);
|
|
414
|
-
if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) {
|
|
415
|
-
return done([{
|
|
416
|
-
value: this.join(newString),
|
|
417
|
-
count: newString.length
|
|
418
|
-
}]);
|
|
419
|
-
}
|
|
420
|
-
function execEditLength() {
|
|
421
|
-
for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) {
|
|
422
|
-
var basePath = (
|
|
423
|
-
/*istanbul ignore start*/
|
|
424
|
-
void 0
|
|
425
|
-
);
|
|
426
|
-
var addPath = bestPath[diagonalPath - 1], removePath = bestPath[diagonalPath + 1], _oldPos = (removePath ? removePath.newPos : 0) - diagonalPath;
|
|
427
|
-
if (addPath) {
|
|
428
|
-
bestPath[diagonalPath - 1] = void 0;
|
|
429
|
-
}
|
|
430
|
-
var canAdd = addPath && addPath.newPos + 1 < newLen, canRemove = removePath && 0 <= _oldPos && _oldPos < oldLen;
|
|
431
|
-
if (!canAdd && !canRemove) {
|
|
432
|
-
bestPath[diagonalPath] = void 0;
|
|
433
|
-
continue;
|
|
434
|
-
}
|
|
435
|
-
if (!canAdd || canRemove && addPath.newPos < removePath.newPos) {
|
|
436
|
-
basePath = clonePath(removePath);
|
|
437
|
-
self.pushComponent(basePath.components, void 0, true);
|
|
438
|
-
} else {
|
|
439
|
-
basePath = addPath;
|
|
440
|
-
basePath.newPos++;
|
|
441
|
-
self.pushComponent(basePath.components, true, void 0);
|
|
442
|
-
}
|
|
443
|
-
_oldPos = self.extractCommon(basePath, newString, oldString, diagonalPath);
|
|
444
|
-
if (basePath.newPos + 1 >= newLen && _oldPos + 1 >= oldLen) {
|
|
445
|
-
return done(buildValues(self, basePath.components, newString, oldString, self.useLongestToken));
|
|
446
|
-
} else {
|
|
447
|
-
bestPath[diagonalPath] = basePath;
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
editLength++;
|
|
451
|
-
}
|
|
452
|
-
if (callback) {
|
|
453
|
-
(function exec() {
|
|
454
|
-
setTimeout(function() {
|
|
455
|
-
if (editLength > maxEditLength) {
|
|
456
|
-
return callback();
|
|
457
|
-
}
|
|
458
|
-
if (!execEditLength()) {
|
|
459
|
-
exec();
|
|
460
|
-
}
|
|
461
|
-
}, 0);
|
|
462
|
-
})();
|
|
463
|
-
} else {
|
|
464
|
-
while (editLength <= maxEditLength) {
|
|
465
|
-
var ret = execEditLength();
|
|
466
|
-
if (ret) {
|
|
467
|
-
return ret;
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
},
|
|
472
|
-
/*istanbul ignore start*/
|
|
473
|
-
/*istanbul ignore end*/
|
|
474
|
-
pushComponent: function pushComponent(components, added, removed) {
|
|
475
|
-
var last = components[components.length - 1];
|
|
476
|
-
if (last && last.added === added && last.removed === removed) {
|
|
477
|
-
components[components.length - 1] = {
|
|
478
|
-
count: last.count + 1,
|
|
479
|
-
added,
|
|
480
|
-
removed
|
|
481
|
-
};
|
|
482
|
-
} else {
|
|
483
|
-
components.push({
|
|
484
|
-
count: 1,
|
|
485
|
-
added,
|
|
486
|
-
removed
|
|
487
|
-
});
|
|
488
|
-
}
|
|
489
|
-
},
|
|
490
|
-
/*istanbul ignore start*/
|
|
491
|
-
/*istanbul ignore end*/
|
|
492
|
-
extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) {
|
|
493
|
-
var newLen = newString.length, oldLen = oldString.length, newPos = basePath.newPos, oldPos = newPos - diagonalPath, commonCount = 0;
|
|
494
|
-
while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) {
|
|
495
|
-
newPos++;
|
|
496
|
-
oldPos++;
|
|
497
|
-
commonCount++;
|
|
498
|
-
}
|
|
499
|
-
if (commonCount) {
|
|
500
|
-
basePath.components.push({
|
|
501
|
-
count: commonCount
|
|
502
|
-
});
|
|
503
|
-
}
|
|
504
|
-
basePath.newPos = newPos;
|
|
505
|
-
return oldPos;
|
|
506
|
-
},
|
|
507
|
-
/*istanbul ignore start*/
|
|
508
|
-
/*istanbul ignore end*/
|
|
509
|
-
equals: function equals(left, right) {
|
|
510
|
-
if (this.options.comparator) {
|
|
511
|
-
return this.options.comparator(left, right);
|
|
512
|
-
} else {
|
|
513
|
-
return left === right || this.options.ignoreCase && left.toLowerCase() === right.toLowerCase();
|
|
514
|
-
}
|
|
515
|
-
},
|
|
516
|
-
/*istanbul ignore start*/
|
|
517
|
-
/*istanbul ignore end*/
|
|
518
|
-
removeEmpty: function removeEmpty(array2) {
|
|
519
|
-
var ret = [];
|
|
520
|
-
for (var i = 0; i < array2.length; i++) {
|
|
521
|
-
if (array2[i]) {
|
|
522
|
-
ret.push(array2[i]);
|
|
523
|
-
}
|
|
524
|
-
}
|
|
525
|
-
return ret;
|
|
526
|
-
},
|
|
527
|
-
/*istanbul ignore start*/
|
|
528
|
-
/*istanbul ignore end*/
|
|
529
|
-
castInput: function castInput(value) {
|
|
530
|
-
return value;
|
|
531
|
-
},
|
|
532
|
-
/*istanbul ignore start*/
|
|
533
|
-
/*istanbul ignore end*/
|
|
534
|
-
tokenize: function tokenize(value) {
|
|
535
|
-
return value.split("");
|
|
536
|
-
},
|
|
537
|
-
/*istanbul ignore start*/
|
|
538
|
-
/*istanbul ignore end*/
|
|
539
|
-
join: function join(chars) {
|
|
540
|
-
return chars.join("");
|
|
541
|
-
}
|
|
542
|
-
};
|
|
543
|
-
function buildValues(diff2, components, newString, oldString, useLongestToken) {
|
|
544
|
-
var componentPos = 0, componentLen = components.length, newPos = 0, oldPos = 0;
|
|
545
|
-
for (; componentPos < componentLen; componentPos++) {
|
|
546
|
-
var component = components[componentPos];
|
|
547
|
-
if (!component.removed) {
|
|
548
|
-
if (!component.added && useLongestToken) {
|
|
549
|
-
var value = newString.slice(newPos, newPos + component.count);
|
|
550
|
-
value = value.map(function(value2, i) {
|
|
551
|
-
var oldValue = oldString[oldPos + i];
|
|
552
|
-
return oldValue.length > value2.length ? oldValue : value2;
|
|
553
|
-
});
|
|
554
|
-
component.value = diff2.join(value);
|
|
555
|
-
} else {
|
|
556
|
-
component.value = diff2.join(newString.slice(newPos, newPos + component.count));
|
|
557
|
-
}
|
|
558
|
-
newPos += component.count;
|
|
559
|
-
if (!component.added) {
|
|
560
|
-
oldPos += component.count;
|
|
561
|
-
}
|
|
562
|
-
} else {
|
|
563
|
-
component.value = diff2.join(oldString.slice(oldPos, oldPos + component.count));
|
|
564
|
-
oldPos += component.count;
|
|
565
|
-
if (componentPos && components[componentPos - 1].added) {
|
|
566
|
-
var tmp = components[componentPos - 1];
|
|
567
|
-
components[componentPos - 1] = components[componentPos];
|
|
568
|
-
components[componentPos] = tmp;
|
|
569
|
-
}
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
var lastComponent = components[componentLen - 1];
|
|
573
|
-
if (componentLen > 1 && typeof lastComponent.value === "string" && (lastComponent.added || lastComponent.removed) && diff2.equals("", lastComponent.value)) {
|
|
574
|
-
components[componentLen - 2].value += lastComponent.value;
|
|
575
|
-
components.pop();
|
|
576
|
-
}
|
|
577
|
-
return components;
|
|
578
|
-
}
|
|
579
|
-
function clonePath(path10) {
|
|
580
|
-
return {
|
|
581
|
-
newPos: path10.newPos,
|
|
582
|
-
components: path10.components.slice(0)
|
|
583
|
-
};
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
|
-
});
|
|
587
|
-
|
|
588
|
-
// node_modules/diff/lib/util/params.js
|
|
589
|
-
var require_params = __commonJS({
|
|
590
|
-
"node_modules/diff/lib/util/params.js"(exports) {
|
|
591
|
-
"use strict";
|
|
592
|
-
Object.defineProperty(exports, "__esModule", {
|
|
593
|
-
value: true
|
|
594
|
-
});
|
|
595
|
-
exports.generateOptions = generateOptions;
|
|
596
|
-
function generateOptions(options, defaults) {
|
|
597
|
-
if (typeof options === "function") {
|
|
598
|
-
defaults.callback = options;
|
|
599
|
-
} else if (options) {
|
|
600
|
-
for (var name in options) {
|
|
601
|
-
if (options.hasOwnProperty(name)) {
|
|
602
|
-
defaults[name] = options[name];
|
|
603
|
-
}
|
|
604
|
-
}
|
|
605
|
-
}
|
|
606
|
-
return defaults;
|
|
607
|
-
}
|
|
608
|
-
}
|
|
609
|
-
});
|
|
610
|
-
|
|
611
|
-
// node_modules/diff/lib/diff/line.js
|
|
612
|
-
var require_line = __commonJS({
|
|
613
|
-
"node_modules/diff/lib/diff/line.js"(exports) {
|
|
614
|
-
"use strict";
|
|
615
|
-
Object.defineProperty(exports, "__esModule", {
|
|
616
|
-
value: true
|
|
617
|
-
});
|
|
618
|
-
exports.diffLines = diffLines;
|
|
619
|
-
exports.diffTrimmedLines = diffTrimmedLines;
|
|
620
|
-
exports.lineDiff = void 0;
|
|
621
|
-
var _base = _interopRequireDefault(require_base());
|
|
622
|
-
var _params = require_params();
|
|
623
|
-
function _interopRequireDefault(obj) {
|
|
624
|
-
return obj && obj.__esModule ? obj : { "default": obj };
|
|
625
|
-
}
|
|
626
|
-
var lineDiff = new /*istanbul ignore start*/
|
|
627
|
-
_base[
|
|
628
|
-
/*istanbul ignore start*/
|
|
629
|
-
"default"
|
|
630
|
-
/*istanbul ignore end*/
|
|
631
|
-
]();
|
|
632
|
-
exports.lineDiff = lineDiff;
|
|
633
|
-
lineDiff.tokenize = function(value) {
|
|
634
|
-
var retLines = [], linesAndNewlines = value.split(/(\n|\r\n)/);
|
|
635
|
-
if (!linesAndNewlines[linesAndNewlines.length - 1]) {
|
|
636
|
-
linesAndNewlines.pop();
|
|
637
|
-
}
|
|
638
|
-
for (var i = 0; i < linesAndNewlines.length; i++) {
|
|
639
|
-
var line = linesAndNewlines[i];
|
|
640
|
-
if (i % 2 && !this.options.newlineIsToken) {
|
|
641
|
-
retLines[retLines.length - 1] += line;
|
|
642
|
-
} else {
|
|
643
|
-
if (this.options.ignoreWhitespace) {
|
|
644
|
-
line = line.trim();
|
|
645
|
-
}
|
|
646
|
-
retLines.push(line);
|
|
647
|
-
}
|
|
648
|
-
}
|
|
649
|
-
return retLines;
|
|
650
|
-
};
|
|
651
|
-
function diffLines(oldStr, newStr, callback) {
|
|
652
|
-
return lineDiff.diff(oldStr, newStr, callback);
|
|
653
|
-
}
|
|
654
|
-
function diffTrimmedLines(oldStr, newStr, callback) {
|
|
655
|
-
var options = (
|
|
656
|
-
/*istanbul ignore start*/
|
|
657
|
-
(0, /*istanbul ignore end*/
|
|
658
|
-
/*istanbul ignore start*/
|
|
659
|
-
_params.generateOptions)(callback, {
|
|
660
|
-
ignoreWhitespace: true
|
|
661
|
-
})
|
|
662
|
-
);
|
|
663
|
-
return lineDiff.diff(oldStr, newStr, options);
|
|
664
|
-
}
|
|
665
|
-
}
|
|
666
|
-
});
|
|
667
|
-
|
|
668
|
-
// node_modules/diff/lib/patch/create.js
|
|
669
|
-
var require_create = __commonJS({
|
|
670
|
-
"node_modules/diff/lib/patch/create.js"(exports) {
|
|
671
|
-
"use strict";
|
|
672
|
-
Object.defineProperty(exports, "__esModule", {
|
|
673
|
-
value: true
|
|
674
|
-
});
|
|
675
|
-
exports.structuredPatch = structuredPatch;
|
|
676
|
-
exports.formatPatch = formatPatch;
|
|
677
|
-
exports.createTwoFilesPatch = createTwoFilesPatch2;
|
|
678
|
-
exports.createPatch = createPatch;
|
|
679
|
-
var _line = require_line();
|
|
680
|
-
function _toConsumableArray(arr) {
|
|
681
|
-
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
682
|
-
}
|
|
683
|
-
function _nonIterableSpread() {
|
|
684
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
685
|
-
}
|
|
686
|
-
function _unsupportedIterableToArray(o, minLen) {
|
|
687
|
-
if (!o)
|
|
688
|
-
return;
|
|
689
|
-
if (typeof o === "string")
|
|
690
|
-
return _arrayLikeToArray(o, minLen);
|
|
691
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
692
|
-
if (n === "Object" && o.constructor)
|
|
693
|
-
n = o.constructor.name;
|
|
694
|
-
if (n === "Map" || n === "Set")
|
|
695
|
-
return Array.from(o);
|
|
696
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
|
|
697
|
-
return _arrayLikeToArray(o, minLen);
|
|
698
|
-
}
|
|
699
|
-
function _iterableToArray(iter) {
|
|
700
|
-
if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter))
|
|
701
|
-
return Array.from(iter);
|
|
702
|
-
}
|
|
703
|
-
function _arrayWithoutHoles(arr) {
|
|
704
|
-
if (Array.isArray(arr))
|
|
705
|
-
return _arrayLikeToArray(arr);
|
|
706
|
-
}
|
|
707
|
-
function _arrayLikeToArray(arr, len) {
|
|
708
|
-
if (len == null || len > arr.length)
|
|
709
|
-
len = arr.length;
|
|
710
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) {
|
|
711
|
-
arr2[i] = arr[i];
|
|
712
|
-
}
|
|
713
|
-
return arr2;
|
|
714
|
-
}
|
|
715
|
-
function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
|
|
716
|
-
if (!options) {
|
|
717
|
-
options = {};
|
|
718
|
-
}
|
|
719
|
-
if (typeof options.context === "undefined") {
|
|
720
|
-
options.context = 4;
|
|
721
|
-
}
|
|
722
|
-
var diff2 = (
|
|
723
|
-
/*istanbul ignore start*/
|
|
724
|
-
(0, /*istanbul ignore end*/
|
|
725
|
-
/*istanbul ignore start*/
|
|
726
|
-
_line.diffLines)(oldStr, newStr, options)
|
|
727
|
-
);
|
|
728
|
-
if (!diff2) {
|
|
729
|
-
return;
|
|
730
|
-
}
|
|
731
|
-
diff2.push({
|
|
732
|
-
value: "",
|
|
733
|
-
lines: []
|
|
734
|
-
});
|
|
735
|
-
function contextLines(lines) {
|
|
736
|
-
return lines.map(function(entry) {
|
|
737
|
-
return " " + entry;
|
|
738
|
-
});
|
|
739
|
-
}
|
|
740
|
-
var hunks = [];
|
|
741
|
-
var oldRangeStart = 0, newRangeStart = 0, curRange = [], oldLine = 1, newLine = 1;
|
|
742
|
-
var _loop = function _loop2(i2) {
|
|
743
|
-
var current = diff2[i2], lines = current.lines || current.value.replace(/\n$/, "").split("\n");
|
|
744
|
-
current.lines = lines;
|
|
745
|
-
if (current.added || current.removed) {
|
|
746
|
-
var _curRange;
|
|
747
|
-
if (!oldRangeStart) {
|
|
748
|
-
var prev = diff2[i2 - 1];
|
|
749
|
-
oldRangeStart = oldLine;
|
|
750
|
-
newRangeStart = newLine;
|
|
751
|
-
if (prev) {
|
|
752
|
-
curRange = options.context > 0 ? contextLines(prev.lines.slice(-options.context)) : [];
|
|
753
|
-
oldRangeStart -= curRange.length;
|
|
754
|
-
newRangeStart -= curRange.length;
|
|
755
|
-
}
|
|
756
|
-
}
|
|
757
|
-
(_curRange = /*istanbul ignore end*/
|
|
758
|
-
curRange).push.apply(
|
|
759
|
-
/*istanbul ignore start*/
|
|
760
|
-
_curRange,
|
|
761
|
-
/*istanbul ignore start*/
|
|
762
|
-
_toConsumableArray(
|
|
763
|
-
/*istanbul ignore end*/
|
|
764
|
-
lines.map(function(entry) {
|
|
765
|
-
return (current.added ? "+" : "-") + entry;
|
|
766
|
-
})
|
|
767
|
-
)
|
|
768
|
-
);
|
|
769
|
-
if (current.added) {
|
|
770
|
-
newLine += lines.length;
|
|
771
|
-
} else {
|
|
772
|
-
oldLine += lines.length;
|
|
773
|
-
}
|
|
774
|
-
} else {
|
|
775
|
-
if (oldRangeStart) {
|
|
776
|
-
if (lines.length <= options.context * 2 && i2 < diff2.length - 2) {
|
|
777
|
-
var _curRange2;
|
|
778
|
-
(_curRange2 = /*istanbul ignore end*/
|
|
779
|
-
curRange).push.apply(
|
|
780
|
-
/*istanbul ignore start*/
|
|
781
|
-
_curRange2,
|
|
782
|
-
/*istanbul ignore start*/
|
|
783
|
-
_toConsumableArray(
|
|
784
|
-
/*istanbul ignore end*/
|
|
785
|
-
contextLines(lines)
|
|
786
|
-
)
|
|
787
|
-
);
|
|
788
|
-
} else {
|
|
789
|
-
var _curRange3;
|
|
790
|
-
var contextSize = Math.min(lines.length, options.context);
|
|
791
|
-
(_curRange3 = /*istanbul ignore end*/
|
|
792
|
-
curRange).push.apply(
|
|
793
|
-
/*istanbul ignore start*/
|
|
794
|
-
_curRange3,
|
|
795
|
-
/*istanbul ignore start*/
|
|
796
|
-
_toConsumableArray(
|
|
797
|
-
/*istanbul ignore end*/
|
|
798
|
-
contextLines(lines.slice(0, contextSize))
|
|
799
|
-
)
|
|
800
|
-
);
|
|
801
|
-
var hunk = {
|
|
802
|
-
oldStart: oldRangeStart,
|
|
803
|
-
oldLines: oldLine - oldRangeStart + contextSize,
|
|
804
|
-
newStart: newRangeStart,
|
|
805
|
-
newLines: newLine - newRangeStart + contextSize,
|
|
806
|
-
lines: curRange
|
|
807
|
-
};
|
|
808
|
-
if (i2 >= diff2.length - 2 && lines.length <= options.context) {
|
|
809
|
-
var oldEOFNewline = /\n$/.test(oldStr);
|
|
810
|
-
var newEOFNewline = /\n$/.test(newStr);
|
|
811
|
-
var noNlBeforeAdds = lines.length == 0 && curRange.length > hunk.oldLines;
|
|
812
|
-
if (!oldEOFNewline && noNlBeforeAdds && oldStr.length > 0) {
|
|
813
|
-
curRange.splice(hunk.oldLines, 0, "\");
|
|
814
|
-
}
|
|
815
|
-
if (!oldEOFNewline && !noNlBeforeAdds || !newEOFNewline) {
|
|
816
|
-
curRange.push("\");
|
|
817
|
-
}
|
|
818
|
-
}
|
|
819
|
-
hunks.push(hunk);
|
|
820
|
-
oldRangeStart = 0;
|
|
821
|
-
newRangeStart = 0;
|
|
822
|
-
curRange = [];
|
|
823
|
-
}
|
|
824
|
-
}
|
|
825
|
-
oldLine += lines.length;
|
|
826
|
-
newLine += lines.length;
|
|
827
|
-
}
|
|
828
|
-
};
|
|
829
|
-
for (var i = 0; i < diff2.length; i++) {
|
|
830
|
-
_loop(
|
|
831
|
-
/*istanbul ignore end*/
|
|
832
|
-
i
|
|
833
|
-
);
|
|
834
|
-
}
|
|
835
|
-
return {
|
|
836
|
-
oldFileName,
|
|
837
|
-
newFileName,
|
|
838
|
-
oldHeader,
|
|
839
|
-
newHeader,
|
|
840
|
-
hunks
|
|
841
|
-
};
|
|
842
|
-
}
|
|
843
|
-
function formatPatch(diff2) {
|
|
844
|
-
var ret = [];
|
|
845
|
-
if (diff2.oldFileName == diff2.newFileName) {
|
|
846
|
-
ret.push("Index: " + diff2.oldFileName);
|
|
847
|
-
}
|
|
848
|
-
ret.push("===================================================================");
|
|
849
|
-
ret.push("--- " + diff2.oldFileName + (typeof diff2.oldHeader === "undefined" ? "" : " " + diff2.oldHeader));
|
|
850
|
-
ret.push("+++ " + diff2.newFileName + (typeof diff2.newHeader === "undefined" ? "" : " " + diff2.newHeader));
|
|
851
|
-
for (var i = 0; i < diff2.hunks.length; i++) {
|
|
852
|
-
var hunk = diff2.hunks[i];
|
|
853
|
-
if (hunk.oldLines === 0) {
|
|
854
|
-
hunk.oldStart -= 1;
|
|
855
|
-
}
|
|
856
|
-
if (hunk.newLines === 0) {
|
|
857
|
-
hunk.newStart -= 1;
|
|
858
|
-
}
|
|
859
|
-
ret.push("@@ -" + hunk.oldStart + "," + hunk.oldLines + " +" + hunk.newStart + "," + hunk.newLines + " @@");
|
|
860
|
-
ret.push.apply(ret, hunk.lines);
|
|
861
|
-
}
|
|
862
|
-
return ret.join("\n") + "\n";
|
|
863
|
-
}
|
|
864
|
-
function createTwoFilesPatch2(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
|
|
865
|
-
return formatPatch(structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options));
|
|
866
|
-
}
|
|
867
|
-
function createPatch(fileName, oldStr, newStr, oldHeader, newHeader, options) {
|
|
868
|
-
return createTwoFilesPatch2(fileName, fileName, oldStr, newStr, oldHeader, newHeader, options);
|
|
869
|
-
}
|
|
870
|
-
}
|
|
871
|
-
});
|
|
872
|
-
|
|
873
336
|
// node_modules/common-path-prefix/index.js
|
|
874
337
|
var require_common_path_prefix = __commonJS({
|
|
875
338
|
"node_modules/common-path-prefix/index.js"(exports, module) {
|
|
@@ -878,15 +341,13 @@ var require_common_path_prefix = __commonJS({
|
|
|
878
341
|
var determineSeparator = (paths) => {
|
|
879
342
|
for (const path10 of paths) {
|
|
880
343
|
const match = /(\/|\\)/.exec(path10);
|
|
881
|
-
if (match !== null)
|
|
882
|
-
return match[0];
|
|
344
|
+
if (match !== null) return match[0];
|
|
883
345
|
}
|
|
884
346
|
return DEFAULT_SEPARATOR;
|
|
885
347
|
};
|
|
886
348
|
module.exports = function commonPathPrefix2(paths, sep = determineSeparator(paths)) {
|
|
887
349
|
const [first = "", ...remaining] = paths;
|
|
888
|
-
if (first === "" || remaining.length === 0)
|
|
889
|
-
return "";
|
|
350
|
+
if (first === "" || remaining.length === 0) return "";
|
|
890
351
|
const parts = first.split(sep);
|
|
891
352
|
let endOfPrefix = parts.length;
|
|
892
353
|
for (const path10 of remaining) {
|
|
@@ -896,8 +357,7 @@ var require_common_path_prefix = __commonJS({
|
|
|
896
357
|
endOfPrefix = i;
|
|
897
358
|
}
|
|
898
359
|
}
|
|
899
|
-
if (endOfPrefix === 0)
|
|
900
|
-
return "";
|
|
360
|
+
if (endOfPrefix === 0) return "";
|
|
901
361
|
}
|
|
902
362
|
const prefix = parts.slice(0, endOfPrefix).join(sep);
|
|
903
363
|
return prefix.endsWith(sep) ? prefix : prefix + sep;
|
|
@@ -909,8 +369,7 @@ var require_common_path_prefix = __commonJS({
|
|
|
909
369
|
var require_json_buffer = __commonJS({
|
|
910
370
|
"node_modules/json-buffer/index.js"(exports) {
|
|
911
371
|
exports.stringify = function stringify4(o) {
|
|
912
|
-
if ("undefined" == typeof o)
|
|
913
|
-
return o;
|
|
372
|
+
if ("undefined" == typeof o) return o;
|
|
914
373
|
if (o && Buffer.isBuffer(o))
|
|
915
374
|
return JSON.stringify(":base64:" + o.toString("base64"));
|
|
916
375
|
if (o && o.toJSON)
|
|
@@ -1099,2899 +558,237 @@ var require_src = __commonJS({
|
|
|
1099
558
|
return options && options.raw ? data : data.value;
|
|
1100
559
|
});
|
|
1101
560
|
}
|
|
1102
|
-
set(key, value, ttl) {
|
|
1103
|
-
const keyPrefixed = this._getKeyPrefix(key);
|
|
1104
|
-
if (typeof ttl === "undefined") {
|
|
1105
|
-
ttl = this.opts.ttl;
|
|
1106
|
-
}
|
|
1107
|
-
if (ttl === 0) {
|
|
1108
|
-
ttl = void 0;
|
|
1109
|
-
}
|
|
1110
|
-
const { store } = this.opts;
|
|
1111
|
-
return Promise.resolve().then(() => {
|
|
1112
|
-
const expires = typeof ttl === "number" ? Date.now() + ttl : null;
|
|
1113
|
-
if (typeof value === "symbol") {
|
|
1114
|
-
this.emit("error", "symbol cannot be serialized");
|
|
1115
|
-
}
|
|
1116
|
-
value = { value, expires };
|
|
1117
|
-
return this.opts.serialize(value);
|
|
1118
|
-
}).then((value2) => store.set(keyPrefixed, value2, ttl)).then(() => true);
|
|
1119
|
-
}
|
|
1120
|
-
delete(key) {
|
|
1121
|
-
const { store } = this.opts;
|
|
1122
|
-
if (Array.isArray(key)) {
|
|
1123
|
-
const keyPrefixed2 = this._getKeyPrefixArray(key);
|
|
1124
|
-
if (store.deleteMany === void 0) {
|
|
1125
|
-
const promises = [];
|
|
1126
|
-
for (const key2 of keyPrefixed2) {
|
|
1127
|
-
promises.push(store.delete(key2));
|
|
1128
|
-
}
|
|
1129
|
-
return Promise.allSettled(promises).then((values) => values.every((x) => x.value === true));
|
|
1130
|
-
}
|
|
1131
|
-
return Promise.resolve().then(() => store.deleteMany(keyPrefixed2));
|
|
1132
|
-
}
|
|
1133
|
-
const keyPrefixed = this._getKeyPrefix(key);
|
|
1134
|
-
return Promise.resolve().then(() => store.delete(keyPrefixed));
|
|
1135
|
-
}
|
|
1136
|
-
clear() {
|
|
1137
|
-
const { store } = this.opts;
|
|
1138
|
-
return Promise.resolve().then(() => store.clear());
|
|
1139
|
-
}
|
|
1140
|
-
has(key) {
|
|
1141
|
-
const keyPrefixed = this._getKeyPrefix(key);
|
|
1142
|
-
const { store } = this.opts;
|
|
1143
|
-
return Promise.resolve().then(async () => {
|
|
1144
|
-
if (typeof store.has === "function") {
|
|
1145
|
-
return store.has(keyPrefixed);
|
|
1146
|
-
}
|
|
1147
|
-
const value = await store.get(keyPrefixed);
|
|
1148
|
-
return value !== void 0;
|
|
1149
|
-
});
|
|
1150
|
-
}
|
|
1151
|
-
disconnect() {
|
|
1152
|
-
const { store } = this.opts;
|
|
1153
|
-
if (typeof store.disconnect === "function") {
|
|
1154
|
-
return store.disconnect();
|
|
1155
|
-
}
|
|
1156
|
-
}
|
|
1157
|
-
};
|
|
1158
|
-
module.exports = Keyv;
|
|
1159
|
-
}
|
|
1160
|
-
});
|
|
1161
|
-
|
|
1162
|
-
// node_modules/flatted/cjs/index.js
|
|
1163
|
-
var require_cjs = __commonJS({
|
|
1164
|
-
"node_modules/flatted/cjs/index.js"(exports) {
|
|
1165
|
-
"use strict";
|
|
1166
|
-
var { parse: $parse, stringify: $stringify } = JSON;
|
|
1167
|
-
var { keys } = Object;
|
|
1168
|
-
var Primitive = String;
|
|
1169
|
-
var primitive = "string";
|
|
1170
|
-
var ignore = {};
|
|
1171
|
-
var object = "object";
|
|
1172
|
-
var noop = (_, value) => value;
|
|
1173
|
-
var primitives = (value) => value instanceof Primitive ? Primitive(value) : value;
|
|
1174
|
-
var Primitives = (_, value) => typeof value === primitive ? new Primitive(value) : value;
|
|
1175
|
-
var revive = (input, parsed, output, $) => {
|
|
1176
|
-
const lazy = [];
|
|
1177
|
-
for (let ke = keys(output), { length } = ke, y = 0; y < length; y++) {
|
|
1178
|
-
const k = ke[y];
|
|
1179
|
-
const value = output[k];
|
|
1180
|
-
if (value instanceof Primitive) {
|
|
1181
|
-
const tmp = input[value];
|
|
1182
|
-
if (typeof tmp === object && !parsed.has(tmp)) {
|
|
1183
|
-
parsed.add(tmp);
|
|
1184
|
-
output[k] = ignore;
|
|
1185
|
-
lazy.push({ k, a: [input, parsed, tmp, $] });
|
|
1186
|
-
} else
|
|
1187
|
-
output[k] = $.call(output, k, tmp);
|
|
1188
|
-
} else if (output[k] !== ignore)
|
|
1189
|
-
output[k] = $.call(output, k, value);
|
|
1190
|
-
}
|
|
1191
|
-
for (let { length } = lazy, i = 0; i < length; i++) {
|
|
1192
|
-
const { k, a } = lazy[i];
|
|
1193
|
-
output[k] = $.call(output, k, revive.apply(null, a));
|
|
1194
|
-
}
|
|
1195
|
-
return output;
|
|
1196
|
-
};
|
|
1197
|
-
var set = (known, input, value) => {
|
|
1198
|
-
const index = Primitive(input.push(value) - 1);
|
|
1199
|
-
known.set(value, index);
|
|
1200
|
-
return index;
|
|
1201
|
-
};
|
|
1202
|
-
var parse = (text, reviver) => {
|
|
1203
|
-
const input = $parse(text, Primitives).map(primitives);
|
|
1204
|
-
const value = input[0];
|
|
1205
|
-
const $ = reviver || noop;
|
|
1206
|
-
const tmp = typeof value === object && value ? revive(input, /* @__PURE__ */ new Set(), value, $) : value;
|
|
1207
|
-
return $.call({ "": tmp }, "", tmp);
|
|
1208
|
-
};
|
|
1209
|
-
exports.parse = parse;
|
|
1210
|
-
var stringify4 = (value, replacer, space) => {
|
|
1211
|
-
const $ = replacer && typeof replacer === object ? (k, v) => k === "" || -1 < replacer.indexOf(k) ? v : void 0 : replacer || noop;
|
|
1212
|
-
const known = /* @__PURE__ */ new Map();
|
|
1213
|
-
const input = [];
|
|
1214
|
-
const output = [];
|
|
1215
|
-
let i = +set(known, input, $.call({ "": value }, "", value));
|
|
1216
|
-
let firstRun = !i;
|
|
1217
|
-
while (i < input.length) {
|
|
1218
|
-
firstRun = true;
|
|
1219
|
-
output[i] = $stringify(input[i++], replace, space);
|
|
1220
|
-
}
|
|
1221
|
-
return "[" + output.join(",") + "]";
|
|
1222
|
-
function replace(key, value2) {
|
|
1223
|
-
if (firstRun) {
|
|
1224
|
-
firstRun = !firstRun;
|
|
1225
|
-
return value2;
|
|
1226
|
-
}
|
|
1227
|
-
const after = $.call(this, key, value2);
|
|
1228
|
-
switch (typeof after) {
|
|
1229
|
-
case object:
|
|
1230
|
-
if (after === null)
|
|
1231
|
-
return after;
|
|
1232
|
-
case primitive:
|
|
1233
|
-
return known.get(after) || set(known, input, after);
|
|
1234
|
-
}
|
|
1235
|
-
return after;
|
|
1236
|
-
}
|
|
1237
|
-
};
|
|
1238
|
-
exports.stringify = stringify4;
|
|
1239
|
-
var toJSON = (any) => $parse(stringify4(any));
|
|
1240
|
-
exports.toJSON = toJSON;
|
|
1241
|
-
var fromJSON = (any) => parse($stringify(any));
|
|
1242
|
-
exports.fromJSON = fromJSON;
|
|
1243
|
-
}
|
|
1244
|
-
});
|
|
1245
|
-
|
|
1246
|
-
// node_modules/flat-cache/src/utils.js
|
|
1247
|
-
var require_utils = __commonJS({
|
|
1248
|
-
"node_modules/flat-cache/src/utils.js"(exports, module) {
|
|
1249
|
-
var fs6 = __require("fs");
|
|
1250
|
-
var path10 = __require("path");
|
|
1251
|
-
var flatted = require_cjs();
|
|
1252
|
-
module.exports = {
|
|
1253
|
-
tryParse: function(filePath, defaultValue) {
|
|
1254
|
-
var result;
|
|
1255
|
-
try {
|
|
1256
|
-
result = this.readJSON(filePath);
|
|
1257
|
-
} catch (ex) {
|
|
1258
|
-
result = defaultValue;
|
|
1259
|
-
}
|
|
1260
|
-
return result;
|
|
1261
|
-
},
|
|
1262
|
-
/**
|
|
1263
|
-
* Read json file synchronously using flatted
|
|
1264
|
-
*
|
|
1265
|
-
* @method readJSON
|
|
1266
|
-
* @param {String} filePath Json filepath
|
|
1267
|
-
* @returns {*} parse result
|
|
1268
|
-
*/
|
|
1269
|
-
readJSON: function(filePath) {
|
|
1270
|
-
return flatted.parse(
|
|
1271
|
-
fs6.readFileSync(filePath, {
|
|
1272
|
-
encoding: "utf8"
|
|
1273
|
-
})
|
|
1274
|
-
);
|
|
1275
|
-
},
|
|
1276
|
-
/**
|
|
1277
|
-
* Write json file synchronously using circular-json
|
|
1278
|
-
*
|
|
1279
|
-
* @method writeJSON
|
|
1280
|
-
* @param {String} filePath Json filepath
|
|
1281
|
-
* @param {*} data Object to serialize
|
|
1282
|
-
*/
|
|
1283
|
-
writeJSON: function(filePath, data) {
|
|
1284
|
-
fs6.mkdirSync(path10.dirname(filePath), {
|
|
1285
|
-
recursive: true
|
|
1286
|
-
});
|
|
1287
|
-
fs6.writeFileSync(filePath, flatted.stringify(data));
|
|
1288
|
-
}
|
|
1289
|
-
};
|
|
1290
|
-
}
|
|
1291
|
-
});
|
|
1292
|
-
|
|
1293
|
-
// node_modules/fs.realpath/old.js
|
|
1294
|
-
var require_old = __commonJS({
|
|
1295
|
-
"node_modules/fs.realpath/old.js"(exports) {
|
|
1296
|
-
var pathModule = __require("path");
|
|
1297
|
-
var isWindows = process.platform === "win32";
|
|
1298
|
-
var fs6 = __require("fs");
|
|
1299
|
-
var DEBUG = process.env.NODE_DEBUG && /fs/.test(process.env.NODE_DEBUG);
|
|
1300
|
-
function rethrow() {
|
|
1301
|
-
var callback;
|
|
1302
|
-
if (DEBUG) {
|
|
1303
|
-
var backtrace = new Error();
|
|
1304
|
-
callback = debugCallback;
|
|
1305
|
-
} else
|
|
1306
|
-
callback = missingCallback;
|
|
1307
|
-
return callback;
|
|
1308
|
-
function debugCallback(err) {
|
|
1309
|
-
if (err) {
|
|
1310
|
-
backtrace.message = err.message;
|
|
1311
|
-
err = backtrace;
|
|
1312
|
-
missingCallback(err);
|
|
1313
|
-
}
|
|
1314
|
-
}
|
|
1315
|
-
function missingCallback(err) {
|
|
1316
|
-
if (err) {
|
|
1317
|
-
if (process.throwDeprecation)
|
|
1318
|
-
throw err;
|
|
1319
|
-
else if (!process.noDeprecation) {
|
|
1320
|
-
var msg = "fs: missing callback " + (err.stack || err.message);
|
|
1321
|
-
if (process.traceDeprecation)
|
|
1322
|
-
console.trace(msg);
|
|
1323
|
-
else
|
|
1324
|
-
console.error(msg);
|
|
1325
|
-
}
|
|
1326
|
-
}
|
|
1327
|
-
}
|
|
1328
|
-
}
|
|
1329
|
-
function maybeCallback(cb) {
|
|
1330
|
-
return typeof cb === "function" ? cb : rethrow();
|
|
1331
|
-
}
|
|
1332
|
-
var normalize = pathModule.normalize;
|
|
1333
|
-
if (isWindows) {
|
|
1334
|
-
nextPartRe = /(.*?)(?:[\/\\]+|$)/g;
|
|
1335
|
-
} else {
|
|
1336
|
-
nextPartRe = /(.*?)(?:[\/]+|$)/g;
|
|
1337
|
-
}
|
|
1338
|
-
var nextPartRe;
|
|
1339
|
-
if (isWindows) {
|
|
1340
|
-
splitRootRe = /^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/;
|
|
1341
|
-
} else {
|
|
1342
|
-
splitRootRe = /^[\/]*/;
|
|
1343
|
-
}
|
|
1344
|
-
var splitRootRe;
|
|
1345
|
-
exports.realpathSync = function realpathSync(p, cache) {
|
|
1346
|
-
p = pathModule.resolve(p);
|
|
1347
|
-
if (cache && Object.prototype.hasOwnProperty.call(cache, p)) {
|
|
1348
|
-
return cache[p];
|
|
1349
|
-
}
|
|
1350
|
-
var original = p, seenLinks = {}, knownHard = {};
|
|
1351
|
-
var pos;
|
|
1352
|
-
var current;
|
|
1353
|
-
var base;
|
|
1354
|
-
var previous;
|
|
1355
|
-
start();
|
|
1356
|
-
function start() {
|
|
1357
|
-
var m = splitRootRe.exec(p);
|
|
1358
|
-
pos = m[0].length;
|
|
1359
|
-
current = m[0];
|
|
1360
|
-
base = m[0];
|
|
1361
|
-
previous = "";
|
|
1362
|
-
if (isWindows && !knownHard[base]) {
|
|
1363
|
-
fs6.lstatSync(base);
|
|
1364
|
-
knownHard[base] = true;
|
|
1365
|
-
}
|
|
1366
|
-
}
|
|
1367
|
-
while (pos < p.length) {
|
|
1368
|
-
nextPartRe.lastIndex = pos;
|
|
1369
|
-
var result = nextPartRe.exec(p);
|
|
1370
|
-
previous = current;
|
|
1371
|
-
current += result[0];
|
|
1372
|
-
base = previous + result[1];
|
|
1373
|
-
pos = nextPartRe.lastIndex;
|
|
1374
|
-
if (knownHard[base] || cache && cache[base] === base) {
|
|
1375
|
-
continue;
|
|
1376
|
-
}
|
|
1377
|
-
var resolvedLink;
|
|
1378
|
-
if (cache && Object.prototype.hasOwnProperty.call(cache, base)) {
|
|
1379
|
-
resolvedLink = cache[base];
|
|
1380
|
-
} else {
|
|
1381
|
-
var stat = fs6.lstatSync(base);
|
|
1382
|
-
if (!stat.isSymbolicLink()) {
|
|
1383
|
-
knownHard[base] = true;
|
|
1384
|
-
if (cache)
|
|
1385
|
-
cache[base] = base;
|
|
1386
|
-
continue;
|
|
1387
|
-
}
|
|
1388
|
-
var linkTarget = null;
|
|
1389
|
-
if (!isWindows) {
|
|
1390
|
-
var id = stat.dev.toString(32) + ":" + stat.ino.toString(32);
|
|
1391
|
-
if (seenLinks.hasOwnProperty(id)) {
|
|
1392
|
-
linkTarget = seenLinks[id];
|
|
1393
|
-
}
|
|
1394
|
-
}
|
|
1395
|
-
if (linkTarget === null) {
|
|
1396
|
-
fs6.statSync(base);
|
|
1397
|
-
linkTarget = fs6.readlinkSync(base);
|
|
1398
|
-
}
|
|
1399
|
-
resolvedLink = pathModule.resolve(previous, linkTarget);
|
|
1400
|
-
if (cache)
|
|
1401
|
-
cache[base] = resolvedLink;
|
|
1402
|
-
if (!isWindows)
|
|
1403
|
-
seenLinks[id] = linkTarget;
|
|
1404
|
-
}
|
|
1405
|
-
p = pathModule.resolve(resolvedLink, p.slice(pos));
|
|
1406
|
-
start();
|
|
1407
|
-
}
|
|
1408
|
-
if (cache)
|
|
1409
|
-
cache[original] = p;
|
|
1410
|
-
return p;
|
|
1411
|
-
};
|
|
1412
|
-
exports.realpath = function realpath(p, cache, cb) {
|
|
1413
|
-
if (typeof cb !== "function") {
|
|
1414
|
-
cb = maybeCallback(cache);
|
|
1415
|
-
cache = null;
|
|
1416
|
-
}
|
|
1417
|
-
p = pathModule.resolve(p);
|
|
1418
|
-
if (cache && Object.prototype.hasOwnProperty.call(cache, p)) {
|
|
1419
|
-
return process.nextTick(cb.bind(null, null, cache[p]));
|
|
1420
|
-
}
|
|
1421
|
-
var original = p, seenLinks = {}, knownHard = {};
|
|
1422
|
-
var pos;
|
|
1423
|
-
var current;
|
|
1424
|
-
var base;
|
|
1425
|
-
var previous;
|
|
1426
|
-
start();
|
|
1427
|
-
function start() {
|
|
1428
|
-
var m = splitRootRe.exec(p);
|
|
1429
|
-
pos = m[0].length;
|
|
1430
|
-
current = m[0];
|
|
1431
|
-
base = m[0];
|
|
1432
|
-
previous = "";
|
|
1433
|
-
if (isWindows && !knownHard[base]) {
|
|
1434
|
-
fs6.lstat(base, function(err) {
|
|
1435
|
-
if (err)
|
|
1436
|
-
return cb(err);
|
|
1437
|
-
knownHard[base] = true;
|
|
1438
|
-
LOOP();
|
|
1439
|
-
});
|
|
1440
|
-
} else {
|
|
1441
|
-
process.nextTick(LOOP);
|
|
1442
|
-
}
|
|
1443
|
-
}
|
|
1444
|
-
function LOOP() {
|
|
1445
|
-
if (pos >= p.length) {
|
|
1446
|
-
if (cache)
|
|
1447
|
-
cache[original] = p;
|
|
1448
|
-
return cb(null, p);
|
|
1449
|
-
}
|
|
1450
|
-
nextPartRe.lastIndex = pos;
|
|
1451
|
-
var result = nextPartRe.exec(p);
|
|
1452
|
-
previous = current;
|
|
1453
|
-
current += result[0];
|
|
1454
|
-
base = previous + result[1];
|
|
1455
|
-
pos = nextPartRe.lastIndex;
|
|
1456
|
-
if (knownHard[base] || cache && cache[base] === base) {
|
|
1457
|
-
return process.nextTick(LOOP);
|
|
1458
|
-
}
|
|
1459
|
-
if (cache && Object.prototype.hasOwnProperty.call(cache, base)) {
|
|
1460
|
-
return gotResolvedLink(cache[base]);
|
|
1461
|
-
}
|
|
1462
|
-
return fs6.lstat(base, gotStat);
|
|
1463
|
-
}
|
|
1464
|
-
function gotStat(err, stat) {
|
|
1465
|
-
if (err)
|
|
1466
|
-
return cb(err);
|
|
1467
|
-
if (!stat.isSymbolicLink()) {
|
|
1468
|
-
knownHard[base] = true;
|
|
1469
|
-
if (cache)
|
|
1470
|
-
cache[base] = base;
|
|
1471
|
-
return process.nextTick(LOOP);
|
|
1472
|
-
}
|
|
1473
|
-
if (!isWindows) {
|
|
1474
|
-
var id = stat.dev.toString(32) + ":" + stat.ino.toString(32);
|
|
1475
|
-
if (seenLinks.hasOwnProperty(id)) {
|
|
1476
|
-
return gotTarget(null, seenLinks[id], base);
|
|
1477
|
-
}
|
|
1478
|
-
}
|
|
1479
|
-
fs6.stat(base, function(err2) {
|
|
1480
|
-
if (err2)
|
|
1481
|
-
return cb(err2);
|
|
1482
|
-
fs6.readlink(base, function(err3, target) {
|
|
1483
|
-
if (!isWindows)
|
|
1484
|
-
seenLinks[id] = target;
|
|
1485
|
-
gotTarget(err3, target);
|
|
1486
|
-
});
|
|
1487
|
-
});
|
|
1488
|
-
}
|
|
1489
|
-
function gotTarget(err, target, base2) {
|
|
1490
|
-
if (err)
|
|
1491
|
-
return cb(err);
|
|
1492
|
-
var resolvedLink = pathModule.resolve(previous, target);
|
|
1493
|
-
if (cache)
|
|
1494
|
-
cache[base2] = resolvedLink;
|
|
1495
|
-
gotResolvedLink(resolvedLink);
|
|
1496
|
-
}
|
|
1497
|
-
function gotResolvedLink(resolvedLink) {
|
|
1498
|
-
p = pathModule.resolve(resolvedLink, p.slice(pos));
|
|
1499
|
-
start();
|
|
1500
|
-
}
|
|
1501
|
-
};
|
|
1502
|
-
}
|
|
1503
|
-
});
|
|
1504
|
-
|
|
1505
|
-
// node_modules/fs.realpath/index.js
|
|
1506
|
-
var require_fs = __commonJS({
|
|
1507
|
-
"node_modules/fs.realpath/index.js"(exports, module) {
|
|
1508
|
-
module.exports = realpath;
|
|
1509
|
-
realpath.realpath = realpath;
|
|
1510
|
-
realpath.sync = realpathSync;
|
|
1511
|
-
realpath.realpathSync = realpathSync;
|
|
1512
|
-
realpath.monkeypatch = monkeypatch;
|
|
1513
|
-
realpath.unmonkeypatch = unmonkeypatch;
|
|
1514
|
-
var fs6 = __require("fs");
|
|
1515
|
-
var origRealpath = fs6.realpath;
|
|
1516
|
-
var origRealpathSync = fs6.realpathSync;
|
|
1517
|
-
var version2 = process.version;
|
|
1518
|
-
var ok = /^v[0-5]\./.test(version2);
|
|
1519
|
-
var old = require_old();
|
|
1520
|
-
function newError(er) {
|
|
1521
|
-
return er && er.syscall === "realpath" && (er.code === "ELOOP" || er.code === "ENOMEM" || er.code === "ENAMETOOLONG");
|
|
1522
|
-
}
|
|
1523
|
-
function realpath(p, cache, cb) {
|
|
1524
|
-
if (ok) {
|
|
1525
|
-
return origRealpath(p, cache, cb);
|
|
1526
|
-
}
|
|
1527
|
-
if (typeof cache === "function") {
|
|
1528
|
-
cb = cache;
|
|
1529
|
-
cache = null;
|
|
1530
|
-
}
|
|
1531
|
-
origRealpath(p, cache, function(er, result) {
|
|
1532
|
-
if (newError(er)) {
|
|
1533
|
-
old.realpath(p, cache, cb);
|
|
1534
|
-
} else {
|
|
1535
|
-
cb(er, result);
|
|
1536
|
-
}
|
|
1537
|
-
});
|
|
1538
|
-
}
|
|
1539
|
-
function realpathSync(p, cache) {
|
|
1540
|
-
if (ok) {
|
|
1541
|
-
return origRealpathSync(p, cache);
|
|
1542
|
-
}
|
|
1543
|
-
try {
|
|
1544
|
-
return origRealpathSync(p, cache);
|
|
1545
|
-
} catch (er) {
|
|
1546
|
-
if (newError(er)) {
|
|
1547
|
-
return old.realpathSync(p, cache);
|
|
1548
|
-
} else {
|
|
1549
|
-
throw er;
|
|
1550
|
-
}
|
|
1551
|
-
}
|
|
1552
|
-
}
|
|
1553
|
-
function monkeypatch() {
|
|
1554
|
-
fs6.realpath = realpath;
|
|
1555
|
-
fs6.realpathSync = realpathSync;
|
|
1556
|
-
}
|
|
1557
|
-
function unmonkeypatch() {
|
|
1558
|
-
fs6.realpath = origRealpath;
|
|
1559
|
-
fs6.realpathSync = origRealpathSync;
|
|
1560
|
-
}
|
|
1561
|
-
}
|
|
1562
|
-
});
|
|
1563
|
-
|
|
1564
|
-
// node_modules/concat-map/index.js
|
|
1565
|
-
var require_concat_map = __commonJS({
|
|
1566
|
-
"node_modules/concat-map/index.js"(exports, module) {
|
|
1567
|
-
module.exports = function(xs, fn) {
|
|
1568
|
-
var res = [];
|
|
1569
|
-
for (var i = 0; i < xs.length; i++) {
|
|
1570
|
-
var x = fn(xs[i], i);
|
|
1571
|
-
if (isArray(x))
|
|
1572
|
-
res.push.apply(res, x);
|
|
1573
|
-
else
|
|
1574
|
-
res.push(x);
|
|
1575
|
-
}
|
|
1576
|
-
return res;
|
|
1577
|
-
};
|
|
1578
|
-
var isArray = Array.isArray || function(xs) {
|
|
1579
|
-
return Object.prototype.toString.call(xs) === "[object Array]";
|
|
1580
|
-
};
|
|
1581
|
-
}
|
|
1582
|
-
});
|
|
1583
|
-
|
|
1584
|
-
// node_modules/balanced-match/index.js
|
|
1585
|
-
var require_balanced_match = __commonJS({
|
|
1586
|
-
"node_modules/balanced-match/index.js"(exports, module) {
|
|
1587
|
-
"use strict";
|
|
1588
|
-
module.exports = balanced;
|
|
1589
|
-
function balanced(a, b, str) {
|
|
1590
|
-
if (a instanceof RegExp)
|
|
1591
|
-
a = maybeMatch(a, str);
|
|
1592
|
-
if (b instanceof RegExp)
|
|
1593
|
-
b = maybeMatch(b, str);
|
|
1594
|
-
var r = range(a, b, str);
|
|
1595
|
-
return r && {
|
|
1596
|
-
start: r[0],
|
|
1597
|
-
end: r[1],
|
|
1598
|
-
pre: str.slice(0, r[0]),
|
|
1599
|
-
body: str.slice(r[0] + a.length, r[1]),
|
|
1600
|
-
post: str.slice(r[1] + b.length)
|
|
1601
|
-
};
|
|
1602
|
-
}
|
|
1603
|
-
function maybeMatch(reg, str) {
|
|
1604
|
-
var m = str.match(reg);
|
|
1605
|
-
return m ? m[0] : null;
|
|
1606
|
-
}
|
|
1607
|
-
balanced.range = range;
|
|
1608
|
-
function range(a, b, str) {
|
|
1609
|
-
var begs, beg, left, right, result;
|
|
1610
|
-
var ai = str.indexOf(a);
|
|
1611
|
-
var bi = str.indexOf(b, ai + 1);
|
|
1612
|
-
var i = ai;
|
|
1613
|
-
if (ai >= 0 && bi > 0) {
|
|
1614
|
-
if (a === b) {
|
|
1615
|
-
return [ai, bi];
|
|
1616
|
-
}
|
|
1617
|
-
begs = [];
|
|
1618
|
-
left = str.length;
|
|
1619
|
-
while (i >= 0 && !result) {
|
|
1620
|
-
if (i == ai) {
|
|
1621
|
-
begs.push(i);
|
|
1622
|
-
ai = str.indexOf(a, i + 1);
|
|
1623
|
-
} else if (begs.length == 1) {
|
|
1624
|
-
result = [begs.pop(), bi];
|
|
1625
|
-
} else {
|
|
1626
|
-
beg = begs.pop();
|
|
1627
|
-
if (beg < left) {
|
|
1628
|
-
left = beg;
|
|
1629
|
-
right = bi;
|
|
1630
|
-
}
|
|
1631
|
-
bi = str.indexOf(b, i + 1);
|
|
1632
|
-
}
|
|
1633
|
-
i = ai < bi && ai >= 0 ? ai : bi;
|
|
1634
|
-
}
|
|
1635
|
-
if (begs.length) {
|
|
1636
|
-
result = [left, right];
|
|
1637
|
-
}
|
|
1638
|
-
}
|
|
1639
|
-
return result;
|
|
1640
|
-
}
|
|
1641
|
-
}
|
|
1642
|
-
});
|
|
1643
|
-
|
|
1644
|
-
// node_modules/brace-expansion/index.js
|
|
1645
|
-
var require_brace_expansion = __commonJS({
|
|
1646
|
-
"node_modules/brace-expansion/index.js"(exports, module) {
|
|
1647
|
-
var concatMap = require_concat_map();
|
|
1648
|
-
var balanced = require_balanced_match();
|
|
1649
|
-
module.exports = expandTop;
|
|
1650
|
-
var escSlash = "\0SLASH" + Math.random() + "\0";
|
|
1651
|
-
var escOpen = "\0OPEN" + Math.random() + "\0";
|
|
1652
|
-
var escClose = "\0CLOSE" + Math.random() + "\0";
|
|
1653
|
-
var escComma = "\0COMMA" + Math.random() + "\0";
|
|
1654
|
-
var escPeriod = "\0PERIOD" + Math.random() + "\0";
|
|
1655
|
-
function numeric(str) {
|
|
1656
|
-
return parseInt(str, 10) == str ? parseInt(str, 10) : str.charCodeAt(0);
|
|
1657
|
-
}
|
|
1658
|
-
function escapeBraces(str) {
|
|
1659
|
-
return str.split("\\\\").join(escSlash).split("\\{").join(escOpen).split("\\}").join(escClose).split("\\,").join(escComma).split("\\.").join(escPeriod);
|
|
1660
|
-
}
|
|
1661
|
-
function unescapeBraces(str) {
|
|
1662
|
-
return str.split(escSlash).join("\\").split(escOpen).join("{").split(escClose).join("}").split(escComma).join(",").split(escPeriod).join(".");
|
|
1663
|
-
}
|
|
1664
|
-
function parseCommaParts(str) {
|
|
1665
|
-
if (!str)
|
|
1666
|
-
return [""];
|
|
1667
|
-
var parts = [];
|
|
1668
|
-
var m = balanced("{", "}", str);
|
|
1669
|
-
if (!m)
|
|
1670
|
-
return str.split(",");
|
|
1671
|
-
var pre = m.pre;
|
|
1672
|
-
var body = m.body;
|
|
1673
|
-
var post = m.post;
|
|
1674
|
-
var p = pre.split(",");
|
|
1675
|
-
p[p.length - 1] += "{" + body + "}";
|
|
1676
|
-
var postParts = parseCommaParts(post);
|
|
1677
|
-
if (post.length) {
|
|
1678
|
-
p[p.length - 1] += postParts.shift();
|
|
1679
|
-
p.push.apply(p, postParts);
|
|
1680
|
-
}
|
|
1681
|
-
parts.push.apply(parts, p);
|
|
1682
|
-
return parts;
|
|
1683
|
-
}
|
|
1684
|
-
function expandTop(str) {
|
|
1685
|
-
if (!str)
|
|
1686
|
-
return [];
|
|
1687
|
-
if (str.substr(0, 2) === "{}") {
|
|
1688
|
-
str = "\\{\\}" + str.substr(2);
|
|
1689
|
-
}
|
|
1690
|
-
return expand(escapeBraces(str), true).map(unescapeBraces);
|
|
1691
|
-
}
|
|
1692
|
-
function embrace(str) {
|
|
1693
|
-
return "{" + str + "}";
|
|
1694
|
-
}
|
|
1695
|
-
function isPadded(el) {
|
|
1696
|
-
return /^-?0\d/.test(el);
|
|
1697
|
-
}
|
|
1698
|
-
function lte(i, y) {
|
|
1699
|
-
return i <= y;
|
|
1700
|
-
}
|
|
1701
|
-
function gte(i, y) {
|
|
1702
|
-
return i >= y;
|
|
1703
|
-
}
|
|
1704
|
-
function expand(str, isTop) {
|
|
1705
|
-
var expansions = [];
|
|
1706
|
-
var m = balanced("{", "}", str);
|
|
1707
|
-
if (!m || /\$$/.test(m.pre))
|
|
1708
|
-
return [str];
|
|
1709
|
-
var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
|
|
1710
|
-
var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
|
|
1711
|
-
var isSequence = isNumericSequence || isAlphaSequence;
|
|
1712
|
-
var isOptions = m.body.indexOf(",") >= 0;
|
|
1713
|
-
if (!isSequence && !isOptions) {
|
|
1714
|
-
if (m.post.match(/,.*\}/)) {
|
|
1715
|
-
str = m.pre + "{" + m.body + escClose + m.post;
|
|
1716
|
-
return expand(str);
|
|
1717
|
-
}
|
|
1718
|
-
return [str];
|
|
1719
|
-
}
|
|
1720
|
-
var n;
|
|
1721
|
-
if (isSequence) {
|
|
1722
|
-
n = m.body.split(/\.\./);
|
|
1723
|
-
} else {
|
|
1724
|
-
n = parseCommaParts(m.body);
|
|
1725
|
-
if (n.length === 1) {
|
|
1726
|
-
n = expand(n[0], false).map(embrace);
|
|
1727
|
-
if (n.length === 1) {
|
|
1728
|
-
var post = m.post.length ? expand(m.post, false) : [""];
|
|
1729
|
-
return post.map(function(p) {
|
|
1730
|
-
return m.pre + n[0] + p;
|
|
1731
|
-
});
|
|
1732
|
-
}
|
|
1733
|
-
}
|
|
1734
|
-
}
|
|
1735
|
-
var pre = m.pre;
|
|
1736
|
-
var post = m.post.length ? expand(m.post, false) : [""];
|
|
1737
|
-
var N;
|
|
1738
|
-
if (isSequence) {
|
|
1739
|
-
var x = numeric(n[0]);
|
|
1740
|
-
var y = numeric(n[1]);
|
|
1741
|
-
var width = Math.max(n[0].length, n[1].length);
|
|
1742
|
-
var incr = n.length == 3 ? Math.abs(numeric(n[2])) : 1;
|
|
1743
|
-
var test = lte;
|
|
1744
|
-
var reverse = y < x;
|
|
1745
|
-
if (reverse) {
|
|
1746
|
-
incr *= -1;
|
|
1747
|
-
test = gte;
|
|
1748
|
-
}
|
|
1749
|
-
var pad = n.some(isPadded);
|
|
1750
|
-
N = [];
|
|
1751
|
-
for (var i = x; test(i, y); i += incr) {
|
|
1752
|
-
var c;
|
|
1753
|
-
if (isAlphaSequence) {
|
|
1754
|
-
c = String.fromCharCode(i);
|
|
1755
|
-
if (c === "\\")
|
|
1756
|
-
c = "";
|
|
1757
|
-
} else {
|
|
1758
|
-
c = String(i);
|
|
1759
|
-
if (pad) {
|
|
1760
|
-
var need = width - c.length;
|
|
1761
|
-
if (need > 0) {
|
|
1762
|
-
var z = new Array(need + 1).join("0");
|
|
1763
|
-
if (i < 0)
|
|
1764
|
-
c = "-" + z + c.slice(1);
|
|
1765
|
-
else
|
|
1766
|
-
c = z + c;
|
|
1767
|
-
}
|
|
1768
|
-
}
|
|
1769
|
-
}
|
|
1770
|
-
N.push(c);
|
|
1771
|
-
}
|
|
1772
|
-
} else {
|
|
1773
|
-
N = concatMap(n, function(el) {
|
|
1774
|
-
return expand(el, false);
|
|
1775
|
-
});
|
|
1776
|
-
}
|
|
1777
|
-
for (var j = 0; j < N.length; j++) {
|
|
1778
|
-
for (var k = 0; k < post.length; k++) {
|
|
1779
|
-
var expansion = pre + N[j] + post[k];
|
|
1780
|
-
if (!isTop || isSequence || expansion)
|
|
1781
|
-
expansions.push(expansion);
|
|
1782
|
-
}
|
|
1783
|
-
}
|
|
1784
|
-
return expansions;
|
|
1785
|
-
}
|
|
1786
|
-
}
|
|
1787
|
-
});
|
|
1788
|
-
|
|
1789
|
-
// node_modules/minimatch/minimatch.js
|
|
1790
|
-
var require_minimatch = __commonJS({
|
|
1791
|
-
"node_modules/minimatch/minimatch.js"(exports, module) {
|
|
1792
|
-
module.exports = minimatch;
|
|
1793
|
-
minimatch.Minimatch = Minimatch;
|
|
1794
|
-
var path10 = function() {
|
|
1795
|
-
try {
|
|
1796
|
-
return __require("path");
|
|
1797
|
-
} catch (e) {
|
|
1798
|
-
}
|
|
1799
|
-
}() || {
|
|
1800
|
-
sep: "/"
|
|
1801
|
-
};
|
|
1802
|
-
minimatch.sep = path10.sep;
|
|
1803
|
-
var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {};
|
|
1804
|
-
var expand = require_brace_expansion();
|
|
1805
|
-
var plTypes = {
|
|
1806
|
-
"!": { open: "(?:(?!(?:", close: "))[^/]*?)" },
|
|
1807
|
-
"?": { open: "(?:", close: ")?" },
|
|
1808
|
-
"+": { open: "(?:", close: ")+" },
|
|
1809
|
-
"*": { open: "(?:", close: ")*" },
|
|
1810
|
-
"@": { open: "(?:", close: ")" }
|
|
1811
|
-
};
|
|
1812
|
-
var qmark = "[^/]";
|
|
1813
|
-
var star = qmark + "*?";
|
|
1814
|
-
var twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
|
|
1815
|
-
var twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
|
|
1816
|
-
var reSpecials = charSet("().*{}+?[]^$\\!");
|
|
1817
|
-
function charSet(s) {
|
|
1818
|
-
return s.split("").reduce(function(set, c) {
|
|
1819
|
-
set[c] = true;
|
|
1820
|
-
return set;
|
|
1821
|
-
}, {});
|
|
1822
|
-
}
|
|
1823
|
-
var slashSplit = /\/+/;
|
|
1824
|
-
minimatch.filter = filter;
|
|
1825
|
-
function filter(pattern, options) {
|
|
1826
|
-
options = options || {};
|
|
1827
|
-
return function(p, i, list) {
|
|
1828
|
-
return minimatch(p, pattern, options);
|
|
1829
|
-
};
|
|
1830
|
-
}
|
|
1831
|
-
function ext(a, b) {
|
|
1832
|
-
b = b || {};
|
|
1833
|
-
var t = {};
|
|
1834
|
-
Object.keys(a).forEach(function(k) {
|
|
1835
|
-
t[k] = a[k];
|
|
1836
|
-
});
|
|
1837
|
-
Object.keys(b).forEach(function(k) {
|
|
1838
|
-
t[k] = b[k];
|
|
1839
|
-
});
|
|
1840
|
-
return t;
|
|
1841
|
-
}
|
|
1842
|
-
minimatch.defaults = function(def) {
|
|
1843
|
-
if (!def || typeof def !== "object" || !Object.keys(def).length) {
|
|
1844
|
-
return minimatch;
|
|
1845
|
-
}
|
|
1846
|
-
var orig = minimatch;
|
|
1847
|
-
var m = function minimatch2(p, pattern, options) {
|
|
1848
|
-
return orig(p, pattern, ext(def, options));
|
|
1849
|
-
};
|
|
1850
|
-
m.Minimatch = function Minimatch2(pattern, options) {
|
|
1851
|
-
return new orig.Minimatch(pattern, ext(def, options));
|
|
1852
|
-
};
|
|
1853
|
-
m.Minimatch.defaults = function defaults(options) {
|
|
1854
|
-
return orig.defaults(ext(def, options)).Minimatch;
|
|
1855
|
-
};
|
|
1856
|
-
m.filter = function filter2(pattern, options) {
|
|
1857
|
-
return orig.filter(pattern, ext(def, options));
|
|
1858
|
-
};
|
|
1859
|
-
m.defaults = function defaults(options) {
|
|
1860
|
-
return orig.defaults(ext(def, options));
|
|
1861
|
-
};
|
|
1862
|
-
m.makeRe = function makeRe2(pattern, options) {
|
|
1863
|
-
return orig.makeRe(pattern, ext(def, options));
|
|
1864
|
-
};
|
|
1865
|
-
m.braceExpand = function braceExpand2(pattern, options) {
|
|
1866
|
-
return orig.braceExpand(pattern, ext(def, options));
|
|
1867
|
-
};
|
|
1868
|
-
m.match = function(list, pattern, options) {
|
|
1869
|
-
return orig.match(list, pattern, ext(def, options));
|
|
1870
|
-
};
|
|
1871
|
-
return m;
|
|
1872
|
-
};
|
|
1873
|
-
Minimatch.defaults = function(def) {
|
|
1874
|
-
return minimatch.defaults(def).Minimatch;
|
|
1875
|
-
};
|
|
1876
|
-
function minimatch(p, pattern, options) {
|
|
1877
|
-
assertValidPattern(pattern);
|
|
1878
|
-
if (!options)
|
|
1879
|
-
options = {};
|
|
1880
|
-
if (!options.nocomment && pattern.charAt(0) === "#") {
|
|
1881
|
-
return false;
|
|
1882
|
-
}
|
|
1883
|
-
return new Minimatch(pattern, options).match(p);
|
|
1884
|
-
}
|
|
1885
|
-
function Minimatch(pattern, options) {
|
|
1886
|
-
if (!(this instanceof Minimatch)) {
|
|
1887
|
-
return new Minimatch(pattern, options);
|
|
1888
|
-
}
|
|
1889
|
-
assertValidPattern(pattern);
|
|
1890
|
-
if (!options)
|
|
1891
|
-
options = {};
|
|
1892
|
-
pattern = pattern.trim();
|
|
1893
|
-
if (!options.allowWindowsEscape && path10.sep !== "/") {
|
|
1894
|
-
pattern = pattern.split(path10.sep).join("/");
|
|
1895
|
-
}
|
|
1896
|
-
this.options = options;
|
|
1897
|
-
this.set = [];
|
|
1898
|
-
this.pattern = pattern;
|
|
1899
|
-
this.regexp = null;
|
|
1900
|
-
this.negate = false;
|
|
1901
|
-
this.comment = false;
|
|
1902
|
-
this.empty = false;
|
|
1903
|
-
this.partial = !!options.partial;
|
|
1904
|
-
this.make();
|
|
1905
|
-
}
|
|
1906
|
-
Minimatch.prototype.debug = function() {
|
|
1907
|
-
};
|
|
1908
|
-
Minimatch.prototype.make = make;
|
|
1909
|
-
function make() {
|
|
1910
|
-
var pattern = this.pattern;
|
|
1911
|
-
var options = this.options;
|
|
1912
|
-
if (!options.nocomment && pattern.charAt(0) === "#") {
|
|
1913
|
-
this.comment = true;
|
|
1914
|
-
return;
|
|
1915
|
-
}
|
|
1916
|
-
if (!pattern) {
|
|
1917
|
-
this.empty = true;
|
|
1918
|
-
return;
|
|
1919
|
-
}
|
|
1920
|
-
this.parseNegate();
|
|
1921
|
-
var set = this.globSet = this.braceExpand();
|
|
1922
|
-
if (options.debug)
|
|
1923
|
-
this.debug = function debug() {
|
|
1924
|
-
console.error.apply(console, arguments);
|
|
1925
|
-
};
|
|
1926
|
-
this.debug(this.pattern, set);
|
|
1927
|
-
set = this.globParts = set.map(function(s) {
|
|
1928
|
-
return s.split(slashSplit);
|
|
1929
|
-
});
|
|
1930
|
-
this.debug(this.pattern, set);
|
|
1931
|
-
set = set.map(function(s, si, set2) {
|
|
1932
|
-
return s.map(this.parse, this);
|
|
1933
|
-
}, this);
|
|
1934
|
-
this.debug(this.pattern, set);
|
|
1935
|
-
set = set.filter(function(s) {
|
|
1936
|
-
return s.indexOf(false) === -1;
|
|
1937
|
-
});
|
|
1938
|
-
this.debug(this.pattern, set);
|
|
1939
|
-
this.set = set;
|
|
1940
|
-
}
|
|
1941
|
-
Minimatch.prototype.parseNegate = parseNegate;
|
|
1942
|
-
function parseNegate() {
|
|
1943
|
-
var pattern = this.pattern;
|
|
1944
|
-
var negate = false;
|
|
1945
|
-
var options = this.options;
|
|
1946
|
-
var negateOffset = 0;
|
|
1947
|
-
if (options.nonegate)
|
|
1948
|
-
return;
|
|
1949
|
-
for (var i = 0, l = pattern.length; i < l && pattern.charAt(i) === "!"; i++) {
|
|
1950
|
-
negate = !negate;
|
|
1951
|
-
negateOffset++;
|
|
1952
|
-
}
|
|
1953
|
-
if (negateOffset)
|
|
1954
|
-
this.pattern = pattern.substr(negateOffset);
|
|
1955
|
-
this.negate = negate;
|
|
1956
|
-
}
|
|
1957
|
-
minimatch.braceExpand = function(pattern, options) {
|
|
1958
|
-
return braceExpand(pattern, options);
|
|
1959
|
-
};
|
|
1960
|
-
Minimatch.prototype.braceExpand = braceExpand;
|
|
1961
|
-
function braceExpand(pattern, options) {
|
|
1962
|
-
if (!options) {
|
|
1963
|
-
if (this instanceof Minimatch) {
|
|
1964
|
-
options = this.options;
|
|
1965
|
-
} else {
|
|
1966
|
-
options = {};
|
|
1967
|
-
}
|
|
1968
|
-
}
|
|
1969
|
-
pattern = typeof pattern === "undefined" ? this.pattern : pattern;
|
|
1970
|
-
assertValidPattern(pattern);
|
|
1971
|
-
if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
|
|
1972
|
-
return [pattern];
|
|
1973
|
-
}
|
|
1974
|
-
return expand(pattern);
|
|
1975
|
-
}
|
|
1976
|
-
var MAX_PATTERN_LENGTH = 1024 * 64;
|
|
1977
|
-
var assertValidPattern = function(pattern) {
|
|
1978
|
-
if (typeof pattern !== "string") {
|
|
1979
|
-
throw new TypeError("invalid pattern");
|
|
1980
|
-
}
|
|
1981
|
-
if (pattern.length > MAX_PATTERN_LENGTH) {
|
|
1982
|
-
throw new TypeError("pattern is too long");
|
|
1983
|
-
}
|
|
1984
|
-
};
|
|
1985
|
-
Minimatch.prototype.parse = parse;
|
|
1986
|
-
var SUBPARSE = {};
|
|
1987
|
-
function parse(pattern, isSub) {
|
|
1988
|
-
assertValidPattern(pattern);
|
|
1989
|
-
var options = this.options;
|
|
1990
|
-
if (pattern === "**") {
|
|
1991
|
-
if (!options.noglobstar)
|
|
1992
|
-
return GLOBSTAR;
|
|
1993
|
-
else
|
|
1994
|
-
pattern = "*";
|
|
1995
|
-
}
|
|
1996
|
-
if (pattern === "")
|
|
1997
|
-
return "";
|
|
1998
|
-
var re = "";
|
|
1999
|
-
var hasMagic = !!options.nocase;
|
|
2000
|
-
var escaping = false;
|
|
2001
|
-
var patternListStack = [];
|
|
2002
|
-
var negativeLists = [];
|
|
2003
|
-
var stateChar;
|
|
2004
|
-
var inClass = false;
|
|
2005
|
-
var reClassStart = -1;
|
|
2006
|
-
var classStart = -1;
|
|
2007
|
-
var patternStart = pattern.charAt(0) === "." ? "" : options.dot ? "(?!(?:^|\\/)\\.{1,2}(?:$|\\/))" : "(?!\\.)";
|
|
2008
|
-
var self = this;
|
|
2009
|
-
function clearStateChar() {
|
|
2010
|
-
if (stateChar) {
|
|
2011
|
-
switch (stateChar) {
|
|
2012
|
-
case "*":
|
|
2013
|
-
re += star;
|
|
2014
|
-
hasMagic = true;
|
|
2015
|
-
break;
|
|
2016
|
-
case "?":
|
|
2017
|
-
re += qmark;
|
|
2018
|
-
hasMagic = true;
|
|
2019
|
-
break;
|
|
2020
|
-
default:
|
|
2021
|
-
re += "\\" + stateChar;
|
|
2022
|
-
break;
|
|
2023
|
-
}
|
|
2024
|
-
self.debug("clearStateChar %j %j", stateChar, re);
|
|
2025
|
-
stateChar = false;
|
|
2026
|
-
}
|
|
2027
|
-
}
|
|
2028
|
-
for (var i = 0, len = pattern.length, c; i < len && (c = pattern.charAt(i)); i++) {
|
|
2029
|
-
this.debug("%s %s %s %j", pattern, i, re, c);
|
|
2030
|
-
if (escaping && reSpecials[c]) {
|
|
2031
|
-
re += "\\" + c;
|
|
2032
|
-
escaping = false;
|
|
2033
|
-
continue;
|
|
2034
|
-
}
|
|
2035
|
-
switch (c) {
|
|
2036
|
-
case "/": {
|
|
2037
|
-
return false;
|
|
2038
|
-
}
|
|
2039
|
-
case "\\":
|
|
2040
|
-
clearStateChar();
|
|
2041
|
-
escaping = true;
|
|
2042
|
-
continue;
|
|
2043
|
-
case "?":
|
|
2044
|
-
case "*":
|
|
2045
|
-
case "+":
|
|
2046
|
-
case "@":
|
|
2047
|
-
case "!":
|
|
2048
|
-
this.debug("%s %s %s %j <-- stateChar", pattern, i, re, c);
|
|
2049
|
-
if (inClass) {
|
|
2050
|
-
this.debug(" in class");
|
|
2051
|
-
if (c === "!" && i === classStart + 1)
|
|
2052
|
-
c = "^";
|
|
2053
|
-
re += c;
|
|
2054
|
-
continue;
|
|
2055
|
-
}
|
|
2056
|
-
self.debug("call clearStateChar %j", stateChar);
|
|
2057
|
-
clearStateChar();
|
|
2058
|
-
stateChar = c;
|
|
2059
|
-
if (options.noext)
|
|
2060
|
-
clearStateChar();
|
|
2061
|
-
continue;
|
|
2062
|
-
case "(":
|
|
2063
|
-
if (inClass) {
|
|
2064
|
-
re += "(";
|
|
2065
|
-
continue;
|
|
2066
|
-
}
|
|
2067
|
-
if (!stateChar) {
|
|
2068
|
-
re += "\\(";
|
|
2069
|
-
continue;
|
|
2070
|
-
}
|
|
2071
|
-
patternListStack.push({
|
|
2072
|
-
type: stateChar,
|
|
2073
|
-
start: i - 1,
|
|
2074
|
-
reStart: re.length,
|
|
2075
|
-
open: plTypes[stateChar].open,
|
|
2076
|
-
close: plTypes[stateChar].close
|
|
2077
|
-
});
|
|
2078
|
-
re += stateChar === "!" ? "(?:(?!(?:" : "(?:";
|
|
2079
|
-
this.debug("plType %j %j", stateChar, re);
|
|
2080
|
-
stateChar = false;
|
|
2081
|
-
continue;
|
|
2082
|
-
case ")":
|
|
2083
|
-
if (inClass || !patternListStack.length) {
|
|
2084
|
-
re += "\\)";
|
|
2085
|
-
continue;
|
|
2086
|
-
}
|
|
2087
|
-
clearStateChar();
|
|
2088
|
-
hasMagic = true;
|
|
2089
|
-
var pl = patternListStack.pop();
|
|
2090
|
-
re += pl.close;
|
|
2091
|
-
if (pl.type === "!") {
|
|
2092
|
-
negativeLists.push(pl);
|
|
2093
|
-
}
|
|
2094
|
-
pl.reEnd = re.length;
|
|
2095
|
-
continue;
|
|
2096
|
-
case "|":
|
|
2097
|
-
if (inClass || !patternListStack.length || escaping) {
|
|
2098
|
-
re += "\\|";
|
|
2099
|
-
escaping = false;
|
|
2100
|
-
continue;
|
|
2101
|
-
}
|
|
2102
|
-
clearStateChar();
|
|
2103
|
-
re += "|";
|
|
2104
|
-
continue;
|
|
2105
|
-
case "[":
|
|
2106
|
-
clearStateChar();
|
|
2107
|
-
if (inClass) {
|
|
2108
|
-
re += "\\" + c;
|
|
2109
|
-
continue;
|
|
2110
|
-
}
|
|
2111
|
-
inClass = true;
|
|
2112
|
-
classStart = i;
|
|
2113
|
-
reClassStart = re.length;
|
|
2114
|
-
re += c;
|
|
2115
|
-
continue;
|
|
2116
|
-
case "]":
|
|
2117
|
-
if (i === classStart + 1 || !inClass) {
|
|
2118
|
-
re += "\\" + c;
|
|
2119
|
-
escaping = false;
|
|
2120
|
-
continue;
|
|
2121
|
-
}
|
|
2122
|
-
var cs = pattern.substring(classStart + 1, i);
|
|
2123
|
-
try {
|
|
2124
|
-
RegExp("[" + cs + "]");
|
|
2125
|
-
} catch (er) {
|
|
2126
|
-
var sp = this.parse(cs, SUBPARSE);
|
|
2127
|
-
re = re.substr(0, reClassStart) + "\\[" + sp[0] + "\\]";
|
|
2128
|
-
hasMagic = hasMagic || sp[1];
|
|
2129
|
-
inClass = false;
|
|
2130
|
-
continue;
|
|
2131
|
-
}
|
|
2132
|
-
hasMagic = true;
|
|
2133
|
-
inClass = false;
|
|
2134
|
-
re += c;
|
|
2135
|
-
continue;
|
|
2136
|
-
default:
|
|
2137
|
-
clearStateChar();
|
|
2138
|
-
if (escaping) {
|
|
2139
|
-
escaping = false;
|
|
2140
|
-
} else if (reSpecials[c] && !(c === "^" && inClass)) {
|
|
2141
|
-
re += "\\";
|
|
2142
|
-
}
|
|
2143
|
-
re += c;
|
|
2144
|
-
}
|
|
2145
|
-
}
|
|
2146
|
-
if (inClass) {
|
|
2147
|
-
cs = pattern.substr(classStart + 1);
|
|
2148
|
-
sp = this.parse(cs, SUBPARSE);
|
|
2149
|
-
re = re.substr(0, reClassStart) + "\\[" + sp[0];
|
|
2150
|
-
hasMagic = hasMagic || sp[1];
|
|
2151
|
-
}
|
|
2152
|
-
for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) {
|
|
2153
|
-
var tail = re.slice(pl.reStart + pl.open.length);
|
|
2154
|
-
this.debug("setting tail", re, pl);
|
|
2155
|
-
tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function(_, $1, $2) {
|
|
2156
|
-
if (!$2) {
|
|
2157
|
-
$2 = "\\";
|
|
2158
|
-
}
|
|
2159
|
-
return $1 + $1 + $2 + "|";
|
|
2160
|
-
});
|
|
2161
|
-
this.debug("tail=%j\n %s", tail, tail, pl, re);
|
|
2162
|
-
var t = pl.type === "*" ? star : pl.type === "?" ? qmark : "\\" + pl.type;
|
|
2163
|
-
hasMagic = true;
|
|
2164
|
-
re = re.slice(0, pl.reStart) + t + "\\(" + tail;
|
|
2165
|
-
}
|
|
2166
|
-
clearStateChar();
|
|
2167
|
-
if (escaping) {
|
|
2168
|
-
re += "\\\\";
|
|
2169
|
-
}
|
|
2170
|
-
var addPatternStart = false;
|
|
2171
|
-
switch (re.charAt(0)) {
|
|
2172
|
-
case "[":
|
|
2173
|
-
case ".":
|
|
2174
|
-
case "(":
|
|
2175
|
-
addPatternStart = true;
|
|
2176
|
-
}
|
|
2177
|
-
for (var n = negativeLists.length - 1; n > -1; n--) {
|
|
2178
|
-
var nl = negativeLists[n];
|
|
2179
|
-
var nlBefore = re.slice(0, nl.reStart);
|
|
2180
|
-
var nlFirst = re.slice(nl.reStart, nl.reEnd - 8);
|
|
2181
|
-
var nlLast = re.slice(nl.reEnd - 8, nl.reEnd);
|
|
2182
|
-
var nlAfter = re.slice(nl.reEnd);
|
|
2183
|
-
nlLast += nlAfter;
|
|
2184
|
-
var openParensBefore = nlBefore.split("(").length - 1;
|
|
2185
|
-
var cleanAfter = nlAfter;
|
|
2186
|
-
for (i = 0; i < openParensBefore; i++) {
|
|
2187
|
-
cleanAfter = cleanAfter.replace(/\)[+*?]?/, "");
|
|
2188
|
-
}
|
|
2189
|
-
nlAfter = cleanAfter;
|
|
2190
|
-
var dollar = "";
|
|
2191
|
-
if (nlAfter === "" && isSub !== SUBPARSE) {
|
|
2192
|
-
dollar = "$";
|
|
2193
|
-
}
|
|
2194
|
-
var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast;
|
|
2195
|
-
re = newRe;
|
|
2196
|
-
}
|
|
2197
|
-
if (re !== "" && hasMagic) {
|
|
2198
|
-
re = "(?=.)" + re;
|
|
2199
|
-
}
|
|
2200
|
-
if (addPatternStart) {
|
|
2201
|
-
re = patternStart + re;
|
|
2202
|
-
}
|
|
2203
|
-
if (isSub === SUBPARSE) {
|
|
2204
|
-
return [re, hasMagic];
|
|
2205
|
-
}
|
|
2206
|
-
if (!hasMagic) {
|
|
2207
|
-
return globUnescape(pattern);
|
|
2208
|
-
}
|
|
2209
|
-
var flags = options.nocase ? "i" : "";
|
|
2210
|
-
try {
|
|
2211
|
-
var regExp = new RegExp("^" + re + "$", flags);
|
|
2212
|
-
} catch (er) {
|
|
2213
|
-
return new RegExp("$.");
|
|
2214
|
-
}
|
|
2215
|
-
regExp._glob = pattern;
|
|
2216
|
-
regExp._src = re;
|
|
2217
|
-
return regExp;
|
|
2218
|
-
}
|
|
2219
|
-
minimatch.makeRe = function(pattern, options) {
|
|
2220
|
-
return new Minimatch(pattern, options || {}).makeRe();
|
|
2221
|
-
};
|
|
2222
|
-
Minimatch.prototype.makeRe = makeRe;
|
|
2223
|
-
function makeRe() {
|
|
2224
|
-
if (this.regexp || this.regexp === false)
|
|
2225
|
-
return this.regexp;
|
|
2226
|
-
var set = this.set;
|
|
2227
|
-
if (!set.length) {
|
|
2228
|
-
this.regexp = false;
|
|
2229
|
-
return this.regexp;
|
|
2230
|
-
}
|
|
2231
|
-
var options = this.options;
|
|
2232
|
-
var twoStar = options.noglobstar ? star : options.dot ? twoStarDot : twoStarNoDot;
|
|
2233
|
-
var flags = options.nocase ? "i" : "";
|
|
2234
|
-
var re = set.map(function(pattern) {
|
|
2235
|
-
return pattern.map(function(p) {
|
|
2236
|
-
return p === GLOBSTAR ? twoStar : typeof p === "string" ? regExpEscape(p) : p._src;
|
|
2237
|
-
}).join("\\/");
|
|
2238
|
-
}).join("|");
|
|
2239
|
-
re = "^(?:" + re + ")$";
|
|
2240
|
-
if (this.negate)
|
|
2241
|
-
re = "^(?!" + re + ").*$";
|
|
2242
|
-
try {
|
|
2243
|
-
this.regexp = new RegExp(re, flags);
|
|
2244
|
-
} catch (ex) {
|
|
2245
|
-
this.regexp = false;
|
|
2246
|
-
}
|
|
2247
|
-
return this.regexp;
|
|
2248
|
-
}
|
|
2249
|
-
minimatch.match = function(list, pattern, options) {
|
|
2250
|
-
options = options || {};
|
|
2251
|
-
var mm = new Minimatch(pattern, options);
|
|
2252
|
-
list = list.filter(function(f) {
|
|
2253
|
-
return mm.match(f);
|
|
2254
|
-
});
|
|
2255
|
-
if (mm.options.nonull && !list.length) {
|
|
2256
|
-
list.push(pattern);
|
|
2257
|
-
}
|
|
2258
|
-
return list;
|
|
2259
|
-
};
|
|
2260
|
-
Minimatch.prototype.match = function match(f, partial) {
|
|
2261
|
-
if (typeof partial === "undefined")
|
|
2262
|
-
partial = this.partial;
|
|
2263
|
-
this.debug("match", f, this.pattern);
|
|
2264
|
-
if (this.comment)
|
|
2265
|
-
return false;
|
|
2266
|
-
if (this.empty)
|
|
2267
|
-
return f === "";
|
|
2268
|
-
if (f === "/" && partial)
|
|
2269
|
-
return true;
|
|
2270
|
-
var options = this.options;
|
|
2271
|
-
if (path10.sep !== "/") {
|
|
2272
|
-
f = f.split(path10.sep).join("/");
|
|
2273
|
-
}
|
|
2274
|
-
f = f.split(slashSplit);
|
|
2275
|
-
this.debug(this.pattern, "split", f);
|
|
2276
|
-
var set = this.set;
|
|
2277
|
-
this.debug(this.pattern, "set", set);
|
|
2278
|
-
var filename;
|
|
2279
|
-
var i;
|
|
2280
|
-
for (i = f.length - 1; i >= 0; i--) {
|
|
2281
|
-
filename = f[i];
|
|
2282
|
-
if (filename)
|
|
2283
|
-
break;
|
|
2284
|
-
}
|
|
2285
|
-
for (i = 0; i < set.length; i++) {
|
|
2286
|
-
var pattern = set[i];
|
|
2287
|
-
var file = f;
|
|
2288
|
-
if (options.matchBase && pattern.length === 1) {
|
|
2289
|
-
file = [filename];
|
|
2290
|
-
}
|
|
2291
|
-
var hit = this.matchOne(file, pattern, partial);
|
|
2292
|
-
if (hit) {
|
|
2293
|
-
if (options.flipNegate)
|
|
2294
|
-
return true;
|
|
2295
|
-
return !this.negate;
|
|
2296
|
-
}
|
|
2297
|
-
}
|
|
2298
|
-
if (options.flipNegate)
|
|
2299
|
-
return false;
|
|
2300
|
-
return this.negate;
|
|
2301
|
-
};
|
|
2302
|
-
Minimatch.prototype.matchOne = function(file, pattern, partial) {
|
|
2303
|
-
var options = this.options;
|
|
2304
|
-
this.debug(
|
|
2305
|
-
"matchOne",
|
|
2306
|
-
{ "this": this, file, pattern }
|
|
2307
|
-
);
|
|
2308
|
-
this.debug("matchOne", file.length, pattern.length);
|
|
2309
|
-
for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
|
|
2310
|
-
this.debug("matchOne loop");
|
|
2311
|
-
var p = pattern[pi];
|
|
2312
|
-
var f = file[fi];
|
|
2313
|
-
this.debug(pattern, p, f);
|
|
2314
|
-
if (p === false)
|
|
2315
|
-
return false;
|
|
2316
|
-
if (p === GLOBSTAR) {
|
|
2317
|
-
this.debug("GLOBSTAR", [pattern, p, f]);
|
|
2318
|
-
var fr = fi;
|
|
2319
|
-
var pr = pi + 1;
|
|
2320
|
-
if (pr === pl) {
|
|
2321
|
-
this.debug("** at the end");
|
|
2322
|
-
for (; fi < fl; fi++) {
|
|
2323
|
-
if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".")
|
|
2324
|
-
return false;
|
|
2325
|
-
}
|
|
2326
|
-
return true;
|
|
2327
|
-
}
|
|
2328
|
-
while (fr < fl) {
|
|
2329
|
-
var swallowee = file[fr];
|
|
2330
|
-
this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
|
|
2331
|
-
if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
|
|
2332
|
-
this.debug("globstar found match!", fr, fl, swallowee);
|
|
2333
|
-
return true;
|
|
2334
|
-
} else {
|
|
2335
|
-
if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
|
|
2336
|
-
this.debug("dot detected!", file, fr, pattern, pr);
|
|
2337
|
-
break;
|
|
2338
|
-
}
|
|
2339
|
-
this.debug("globstar swallow a segment, and continue");
|
|
2340
|
-
fr++;
|
|
2341
|
-
}
|
|
2342
|
-
}
|
|
2343
|
-
if (partial) {
|
|
2344
|
-
this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
|
|
2345
|
-
if (fr === fl)
|
|
2346
|
-
return true;
|
|
2347
|
-
}
|
|
2348
|
-
return false;
|
|
2349
|
-
}
|
|
2350
|
-
var hit;
|
|
2351
|
-
if (typeof p === "string") {
|
|
2352
|
-
hit = f === p;
|
|
2353
|
-
this.debug("string match", p, f, hit);
|
|
2354
|
-
} else {
|
|
2355
|
-
hit = f.match(p);
|
|
2356
|
-
this.debug("pattern match", p, f, hit);
|
|
2357
|
-
}
|
|
2358
|
-
if (!hit)
|
|
2359
|
-
return false;
|
|
2360
|
-
}
|
|
2361
|
-
if (fi === fl && pi === pl) {
|
|
2362
|
-
return true;
|
|
2363
|
-
} else if (fi === fl) {
|
|
2364
|
-
return partial;
|
|
2365
|
-
} else if (pi === pl) {
|
|
2366
|
-
return fi === fl - 1 && file[fi] === "";
|
|
2367
|
-
}
|
|
2368
|
-
throw new Error("wtf?");
|
|
2369
|
-
};
|
|
2370
|
-
function globUnescape(s) {
|
|
2371
|
-
return s.replace(/\\(.)/g, "$1");
|
|
2372
|
-
}
|
|
2373
|
-
function regExpEscape(s) {
|
|
2374
|
-
return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
2375
|
-
}
|
|
2376
|
-
}
|
|
2377
|
-
});
|
|
2378
|
-
|
|
2379
|
-
// node_modules/inherits/inherits_browser.js
|
|
2380
|
-
var require_inherits_browser = __commonJS({
|
|
2381
|
-
"node_modules/inherits/inherits_browser.js"(exports, module) {
|
|
2382
|
-
if (typeof Object.create === "function") {
|
|
2383
|
-
module.exports = function inherits(ctor, superCtor) {
|
|
2384
|
-
if (superCtor) {
|
|
2385
|
-
ctor.super_ = superCtor;
|
|
2386
|
-
ctor.prototype = Object.create(superCtor.prototype, {
|
|
2387
|
-
constructor: {
|
|
2388
|
-
value: ctor,
|
|
2389
|
-
enumerable: false,
|
|
2390
|
-
writable: true,
|
|
2391
|
-
configurable: true
|
|
2392
|
-
}
|
|
2393
|
-
});
|
|
2394
|
-
}
|
|
2395
|
-
};
|
|
2396
|
-
} else {
|
|
2397
|
-
module.exports = function inherits(ctor, superCtor) {
|
|
2398
|
-
if (superCtor) {
|
|
2399
|
-
ctor.super_ = superCtor;
|
|
2400
|
-
var TempCtor = function() {
|
|
2401
|
-
};
|
|
2402
|
-
TempCtor.prototype = superCtor.prototype;
|
|
2403
|
-
ctor.prototype = new TempCtor();
|
|
2404
|
-
ctor.prototype.constructor = ctor;
|
|
2405
|
-
}
|
|
2406
|
-
};
|
|
2407
|
-
}
|
|
2408
|
-
}
|
|
2409
|
-
});
|
|
2410
|
-
|
|
2411
|
-
// node_modules/inherits/inherits.js
|
|
2412
|
-
var require_inherits = __commonJS({
|
|
2413
|
-
"node_modules/inherits/inherits.js"(exports, module) {
|
|
2414
|
-
try {
|
|
2415
|
-
util = __require("util");
|
|
2416
|
-
if (typeof util.inherits !== "function")
|
|
2417
|
-
throw "";
|
|
2418
|
-
module.exports = util.inherits;
|
|
2419
|
-
} catch (e) {
|
|
2420
|
-
module.exports = require_inherits_browser();
|
|
2421
|
-
}
|
|
2422
|
-
var util;
|
|
2423
|
-
}
|
|
2424
|
-
});
|
|
2425
|
-
|
|
2426
|
-
// node_modules/path-is-absolute/index.js
|
|
2427
|
-
var require_path_is_absolute = __commonJS({
|
|
2428
|
-
"node_modules/path-is-absolute/index.js"(exports, module) {
|
|
2429
|
-
"use strict";
|
|
2430
|
-
function posix(path10) {
|
|
2431
|
-
return path10.charAt(0) === "/";
|
|
2432
|
-
}
|
|
2433
|
-
function win32(path10) {
|
|
2434
|
-
var splitDeviceRe = /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/;
|
|
2435
|
-
var result = splitDeviceRe.exec(path10);
|
|
2436
|
-
var device = result[1] || "";
|
|
2437
|
-
var isUnc = Boolean(device && device.charAt(1) !== ":");
|
|
2438
|
-
return Boolean(result[2] || isUnc);
|
|
2439
|
-
}
|
|
2440
|
-
module.exports = process.platform === "win32" ? win32 : posix;
|
|
2441
|
-
module.exports.posix = posix;
|
|
2442
|
-
module.exports.win32 = win32;
|
|
2443
|
-
}
|
|
2444
|
-
});
|
|
2445
|
-
|
|
2446
|
-
// node_modules/glob/common.js
|
|
2447
|
-
var require_common = __commonJS({
|
|
2448
|
-
"node_modules/glob/common.js"(exports) {
|
|
2449
|
-
exports.setopts = setopts;
|
|
2450
|
-
exports.ownProp = ownProp;
|
|
2451
|
-
exports.makeAbs = makeAbs;
|
|
2452
|
-
exports.finish = finish;
|
|
2453
|
-
exports.mark = mark;
|
|
2454
|
-
exports.isIgnored = isIgnored;
|
|
2455
|
-
exports.childrenIgnored = childrenIgnored;
|
|
2456
|
-
function ownProp(obj, field) {
|
|
2457
|
-
return Object.prototype.hasOwnProperty.call(obj, field);
|
|
2458
|
-
}
|
|
2459
|
-
var fs6 = __require("fs");
|
|
2460
|
-
var path10 = __require("path");
|
|
2461
|
-
var minimatch = require_minimatch();
|
|
2462
|
-
var isAbsolute = require_path_is_absolute();
|
|
2463
|
-
var Minimatch = minimatch.Minimatch;
|
|
2464
|
-
function alphasort(a, b) {
|
|
2465
|
-
return a.localeCompare(b, "en");
|
|
2466
|
-
}
|
|
2467
|
-
function setupIgnores(self, options) {
|
|
2468
|
-
self.ignore = options.ignore || [];
|
|
2469
|
-
if (!Array.isArray(self.ignore))
|
|
2470
|
-
self.ignore = [self.ignore];
|
|
2471
|
-
if (self.ignore.length) {
|
|
2472
|
-
self.ignore = self.ignore.map(ignoreMap);
|
|
2473
|
-
}
|
|
2474
|
-
}
|
|
2475
|
-
function ignoreMap(pattern) {
|
|
2476
|
-
var gmatcher = null;
|
|
2477
|
-
if (pattern.slice(-3) === "/**") {
|
|
2478
|
-
var gpattern = pattern.replace(/(\/\*\*)+$/, "");
|
|
2479
|
-
gmatcher = new Minimatch(gpattern, { dot: true });
|
|
2480
|
-
}
|
|
2481
|
-
return {
|
|
2482
|
-
matcher: new Minimatch(pattern, { dot: true }),
|
|
2483
|
-
gmatcher
|
|
2484
|
-
};
|
|
2485
|
-
}
|
|
2486
|
-
function setopts(self, pattern, options) {
|
|
2487
|
-
if (!options)
|
|
2488
|
-
options = {};
|
|
2489
|
-
if (options.matchBase && -1 === pattern.indexOf("/")) {
|
|
2490
|
-
if (options.noglobstar) {
|
|
2491
|
-
throw new Error("base matching requires globstar");
|
|
2492
|
-
}
|
|
2493
|
-
pattern = "**/" + pattern;
|
|
2494
|
-
}
|
|
2495
|
-
self.silent = !!options.silent;
|
|
2496
|
-
self.pattern = pattern;
|
|
2497
|
-
self.strict = options.strict !== false;
|
|
2498
|
-
self.realpath = !!options.realpath;
|
|
2499
|
-
self.realpathCache = options.realpathCache || /* @__PURE__ */ Object.create(null);
|
|
2500
|
-
self.follow = !!options.follow;
|
|
2501
|
-
self.dot = !!options.dot;
|
|
2502
|
-
self.mark = !!options.mark;
|
|
2503
|
-
self.nodir = !!options.nodir;
|
|
2504
|
-
if (self.nodir)
|
|
2505
|
-
self.mark = true;
|
|
2506
|
-
self.sync = !!options.sync;
|
|
2507
|
-
self.nounique = !!options.nounique;
|
|
2508
|
-
self.nonull = !!options.nonull;
|
|
2509
|
-
self.nosort = !!options.nosort;
|
|
2510
|
-
self.nocase = !!options.nocase;
|
|
2511
|
-
self.stat = !!options.stat;
|
|
2512
|
-
self.noprocess = !!options.noprocess;
|
|
2513
|
-
self.absolute = !!options.absolute;
|
|
2514
|
-
self.fs = options.fs || fs6;
|
|
2515
|
-
self.maxLength = options.maxLength || Infinity;
|
|
2516
|
-
self.cache = options.cache || /* @__PURE__ */ Object.create(null);
|
|
2517
|
-
self.statCache = options.statCache || /* @__PURE__ */ Object.create(null);
|
|
2518
|
-
self.symlinks = options.symlinks || /* @__PURE__ */ Object.create(null);
|
|
2519
|
-
setupIgnores(self, options);
|
|
2520
|
-
self.changedCwd = false;
|
|
2521
|
-
var cwd2 = process.cwd();
|
|
2522
|
-
if (!ownProp(options, "cwd"))
|
|
2523
|
-
self.cwd = cwd2;
|
|
2524
|
-
else {
|
|
2525
|
-
self.cwd = path10.resolve(options.cwd);
|
|
2526
|
-
self.changedCwd = self.cwd !== cwd2;
|
|
2527
|
-
}
|
|
2528
|
-
self.root = options.root || path10.resolve(self.cwd, "/");
|
|
2529
|
-
self.root = path10.resolve(self.root);
|
|
2530
|
-
if (process.platform === "win32")
|
|
2531
|
-
self.root = self.root.replace(/\\/g, "/");
|
|
2532
|
-
self.cwdAbs = isAbsolute(self.cwd) ? self.cwd : makeAbs(self, self.cwd);
|
|
2533
|
-
if (process.platform === "win32")
|
|
2534
|
-
self.cwdAbs = self.cwdAbs.replace(/\\/g, "/");
|
|
2535
|
-
self.nomount = !!options.nomount;
|
|
2536
|
-
options.nonegate = true;
|
|
2537
|
-
options.nocomment = true;
|
|
2538
|
-
options.allowWindowsEscape = false;
|
|
2539
|
-
self.minimatch = new Minimatch(pattern, options);
|
|
2540
|
-
self.options = self.minimatch.options;
|
|
2541
|
-
}
|
|
2542
|
-
function finish(self) {
|
|
2543
|
-
var nou = self.nounique;
|
|
2544
|
-
var all = nou ? [] : /* @__PURE__ */ Object.create(null);
|
|
2545
|
-
for (var i = 0, l = self.matches.length; i < l; i++) {
|
|
2546
|
-
var matches = self.matches[i];
|
|
2547
|
-
if (!matches || Object.keys(matches).length === 0) {
|
|
2548
|
-
if (self.nonull) {
|
|
2549
|
-
var literal = self.minimatch.globSet[i];
|
|
2550
|
-
if (nou)
|
|
2551
|
-
all.push(literal);
|
|
2552
|
-
else
|
|
2553
|
-
all[literal] = true;
|
|
2554
|
-
}
|
|
2555
|
-
} else {
|
|
2556
|
-
var m = Object.keys(matches);
|
|
2557
|
-
if (nou)
|
|
2558
|
-
all.push.apply(all, m);
|
|
2559
|
-
else
|
|
2560
|
-
m.forEach(function(m2) {
|
|
2561
|
-
all[m2] = true;
|
|
2562
|
-
});
|
|
2563
|
-
}
|
|
2564
|
-
}
|
|
2565
|
-
if (!nou)
|
|
2566
|
-
all = Object.keys(all);
|
|
2567
|
-
if (!self.nosort)
|
|
2568
|
-
all = all.sort(alphasort);
|
|
2569
|
-
if (self.mark) {
|
|
2570
|
-
for (var i = 0; i < all.length; i++) {
|
|
2571
|
-
all[i] = self._mark(all[i]);
|
|
2572
|
-
}
|
|
2573
|
-
if (self.nodir) {
|
|
2574
|
-
all = all.filter(function(e) {
|
|
2575
|
-
var notDir = !/\/$/.test(e);
|
|
2576
|
-
var c = self.cache[e] || self.cache[makeAbs(self, e)];
|
|
2577
|
-
if (notDir && c)
|
|
2578
|
-
notDir = c !== "DIR" && !Array.isArray(c);
|
|
2579
|
-
return notDir;
|
|
2580
|
-
});
|
|
2581
|
-
}
|
|
2582
|
-
}
|
|
2583
|
-
if (self.ignore.length)
|
|
2584
|
-
all = all.filter(function(m2) {
|
|
2585
|
-
return !isIgnored(self, m2);
|
|
2586
|
-
});
|
|
2587
|
-
self.found = all;
|
|
2588
|
-
}
|
|
2589
|
-
function mark(self, p) {
|
|
2590
|
-
var abs = makeAbs(self, p);
|
|
2591
|
-
var c = self.cache[abs];
|
|
2592
|
-
var m = p;
|
|
2593
|
-
if (c) {
|
|
2594
|
-
var isDir = c === "DIR" || Array.isArray(c);
|
|
2595
|
-
var slash = p.slice(-1) === "/";
|
|
2596
|
-
if (isDir && !slash)
|
|
2597
|
-
m += "/";
|
|
2598
|
-
else if (!isDir && slash)
|
|
2599
|
-
m = m.slice(0, -1);
|
|
2600
|
-
if (m !== p) {
|
|
2601
|
-
var mabs = makeAbs(self, m);
|
|
2602
|
-
self.statCache[mabs] = self.statCache[abs];
|
|
2603
|
-
self.cache[mabs] = self.cache[abs];
|
|
2604
|
-
}
|
|
2605
|
-
}
|
|
2606
|
-
return m;
|
|
2607
|
-
}
|
|
2608
|
-
function makeAbs(self, f) {
|
|
2609
|
-
var abs = f;
|
|
2610
|
-
if (f.charAt(0) === "/") {
|
|
2611
|
-
abs = path10.join(self.root, f);
|
|
2612
|
-
} else if (isAbsolute(f) || f === "") {
|
|
2613
|
-
abs = f;
|
|
2614
|
-
} else if (self.changedCwd) {
|
|
2615
|
-
abs = path10.resolve(self.cwd, f);
|
|
2616
|
-
} else {
|
|
2617
|
-
abs = path10.resolve(f);
|
|
2618
|
-
}
|
|
2619
|
-
if (process.platform === "win32")
|
|
2620
|
-
abs = abs.replace(/\\/g, "/");
|
|
2621
|
-
return abs;
|
|
2622
|
-
}
|
|
2623
|
-
function isIgnored(self, path11) {
|
|
2624
|
-
if (!self.ignore.length)
|
|
2625
|
-
return false;
|
|
2626
|
-
return self.ignore.some(function(item) {
|
|
2627
|
-
return item.matcher.match(path11) || !!(item.gmatcher && item.gmatcher.match(path11));
|
|
2628
|
-
});
|
|
2629
|
-
}
|
|
2630
|
-
function childrenIgnored(self, path11) {
|
|
2631
|
-
if (!self.ignore.length)
|
|
2632
|
-
return false;
|
|
2633
|
-
return self.ignore.some(function(item) {
|
|
2634
|
-
return !!(item.gmatcher && item.gmatcher.match(path11));
|
|
2635
|
-
});
|
|
2636
|
-
}
|
|
2637
|
-
}
|
|
2638
|
-
});
|
|
2639
|
-
|
|
2640
|
-
// node_modules/glob/sync.js
|
|
2641
|
-
var require_sync = __commonJS({
|
|
2642
|
-
"node_modules/glob/sync.js"(exports, module) {
|
|
2643
|
-
module.exports = globSync;
|
|
2644
|
-
globSync.GlobSync = GlobSync;
|
|
2645
|
-
var rp = require_fs();
|
|
2646
|
-
var minimatch = require_minimatch();
|
|
2647
|
-
var Minimatch = minimatch.Minimatch;
|
|
2648
|
-
var Glob = require_glob().Glob;
|
|
2649
|
-
var util = __require("util");
|
|
2650
|
-
var path10 = __require("path");
|
|
2651
|
-
var assert = __require("assert");
|
|
2652
|
-
var isAbsolute = require_path_is_absolute();
|
|
2653
|
-
var common = require_common();
|
|
2654
|
-
var setopts = common.setopts;
|
|
2655
|
-
var ownProp = common.ownProp;
|
|
2656
|
-
var childrenIgnored = common.childrenIgnored;
|
|
2657
|
-
var isIgnored = common.isIgnored;
|
|
2658
|
-
function globSync(pattern, options) {
|
|
2659
|
-
if (typeof options === "function" || arguments.length === 3)
|
|
2660
|
-
throw new TypeError("callback provided to sync glob\nSee: https://github.com/isaacs/node-glob/issues/167");
|
|
2661
|
-
return new GlobSync(pattern, options).found;
|
|
2662
|
-
}
|
|
2663
|
-
function GlobSync(pattern, options) {
|
|
2664
|
-
if (!pattern)
|
|
2665
|
-
throw new Error("must provide pattern");
|
|
2666
|
-
if (typeof options === "function" || arguments.length === 3)
|
|
2667
|
-
throw new TypeError("callback provided to sync glob\nSee: https://github.com/isaacs/node-glob/issues/167");
|
|
2668
|
-
if (!(this instanceof GlobSync))
|
|
2669
|
-
return new GlobSync(pattern, options);
|
|
2670
|
-
setopts(this, pattern, options);
|
|
2671
|
-
if (this.noprocess)
|
|
2672
|
-
return this;
|
|
2673
|
-
var n = this.minimatch.set.length;
|
|
2674
|
-
this.matches = new Array(n);
|
|
2675
|
-
for (var i = 0; i < n; i++) {
|
|
2676
|
-
this._process(this.minimatch.set[i], i, false);
|
|
2677
|
-
}
|
|
2678
|
-
this._finish();
|
|
2679
|
-
}
|
|
2680
|
-
GlobSync.prototype._finish = function() {
|
|
2681
|
-
assert.ok(this instanceof GlobSync);
|
|
2682
|
-
if (this.realpath) {
|
|
2683
|
-
var self = this;
|
|
2684
|
-
this.matches.forEach(function(matchset, index) {
|
|
2685
|
-
var set = self.matches[index] = /* @__PURE__ */ Object.create(null);
|
|
2686
|
-
for (var p in matchset) {
|
|
2687
|
-
try {
|
|
2688
|
-
p = self._makeAbs(p);
|
|
2689
|
-
var real = rp.realpathSync(p, self.realpathCache);
|
|
2690
|
-
set[real] = true;
|
|
2691
|
-
} catch (er) {
|
|
2692
|
-
if (er.syscall === "stat")
|
|
2693
|
-
set[self._makeAbs(p)] = true;
|
|
2694
|
-
else
|
|
2695
|
-
throw er;
|
|
2696
|
-
}
|
|
2697
|
-
}
|
|
2698
|
-
});
|
|
2699
|
-
}
|
|
2700
|
-
common.finish(this);
|
|
2701
|
-
};
|
|
2702
|
-
GlobSync.prototype._process = function(pattern, index, inGlobStar) {
|
|
2703
|
-
assert.ok(this instanceof GlobSync);
|
|
2704
|
-
var n = 0;
|
|
2705
|
-
while (typeof pattern[n] === "string") {
|
|
2706
|
-
n++;
|
|
2707
|
-
}
|
|
2708
|
-
var prefix;
|
|
2709
|
-
switch (n) {
|
|
2710
|
-
case pattern.length:
|
|
2711
|
-
this._processSimple(pattern.join("/"), index);
|
|
2712
|
-
return;
|
|
2713
|
-
case 0:
|
|
2714
|
-
prefix = null;
|
|
2715
|
-
break;
|
|
2716
|
-
default:
|
|
2717
|
-
prefix = pattern.slice(0, n).join("/");
|
|
2718
|
-
break;
|
|
2719
|
-
}
|
|
2720
|
-
var remain = pattern.slice(n);
|
|
2721
|
-
var read;
|
|
2722
|
-
if (prefix === null)
|
|
2723
|
-
read = ".";
|
|
2724
|
-
else if (isAbsolute(prefix) || isAbsolute(pattern.map(function(p) {
|
|
2725
|
-
return typeof p === "string" ? p : "[*]";
|
|
2726
|
-
}).join("/"))) {
|
|
2727
|
-
if (!prefix || !isAbsolute(prefix))
|
|
2728
|
-
prefix = "/" + prefix;
|
|
2729
|
-
read = prefix;
|
|
2730
|
-
} else
|
|
2731
|
-
read = prefix;
|
|
2732
|
-
var abs = this._makeAbs(read);
|
|
2733
|
-
if (childrenIgnored(this, read))
|
|
2734
|
-
return;
|
|
2735
|
-
var isGlobStar = remain[0] === minimatch.GLOBSTAR;
|
|
2736
|
-
if (isGlobStar)
|
|
2737
|
-
this._processGlobStar(prefix, read, abs, remain, index, inGlobStar);
|
|
2738
|
-
else
|
|
2739
|
-
this._processReaddir(prefix, read, abs, remain, index, inGlobStar);
|
|
2740
|
-
};
|
|
2741
|
-
GlobSync.prototype._processReaddir = function(prefix, read, abs, remain, index, inGlobStar) {
|
|
2742
|
-
var entries = this._readdir(abs, inGlobStar);
|
|
2743
|
-
if (!entries)
|
|
2744
|
-
return;
|
|
2745
|
-
var pn = remain[0];
|
|
2746
|
-
var negate = !!this.minimatch.negate;
|
|
2747
|
-
var rawGlob = pn._glob;
|
|
2748
|
-
var dotOk = this.dot || rawGlob.charAt(0) === ".";
|
|
2749
|
-
var matchedEntries = [];
|
|
2750
|
-
for (var i = 0; i < entries.length; i++) {
|
|
2751
|
-
var e = entries[i];
|
|
2752
|
-
if (e.charAt(0) !== "." || dotOk) {
|
|
2753
|
-
var m;
|
|
2754
|
-
if (negate && !prefix) {
|
|
2755
|
-
m = !e.match(pn);
|
|
2756
|
-
} else {
|
|
2757
|
-
m = e.match(pn);
|
|
2758
|
-
}
|
|
2759
|
-
if (m)
|
|
2760
|
-
matchedEntries.push(e);
|
|
2761
|
-
}
|
|
2762
|
-
}
|
|
2763
|
-
var len = matchedEntries.length;
|
|
2764
|
-
if (len === 0)
|
|
2765
|
-
return;
|
|
2766
|
-
if (remain.length === 1 && !this.mark && !this.stat) {
|
|
2767
|
-
if (!this.matches[index])
|
|
2768
|
-
this.matches[index] = /* @__PURE__ */ Object.create(null);
|
|
2769
|
-
for (var i = 0; i < len; i++) {
|
|
2770
|
-
var e = matchedEntries[i];
|
|
2771
|
-
if (prefix) {
|
|
2772
|
-
if (prefix.slice(-1) !== "/")
|
|
2773
|
-
e = prefix + "/" + e;
|
|
2774
|
-
else
|
|
2775
|
-
e = prefix + e;
|
|
2776
|
-
}
|
|
2777
|
-
if (e.charAt(0) === "/" && !this.nomount) {
|
|
2778
|
-
e = path10.join(this.root, e);
|
|
2779
|
-
}
|
|
2780
|
-
this._emitMatch(index, e);
|
|
2781
|
-
}
|
|
2782
|
-
return;
|
|
2783
|
-
}
|
|
2784
|
-
remain.shift();
|
|
2785
|
-
for (var i = 0; i < len; i++) {
|
|
2786
|
-
var e = matchedEntries[i];
|
|
2787
|
-
var newPattern;
|
|
2788
|
-
if (prefix)
|
|
2789
|
-
newPattern = [prefix, e];
|
|
2790
|
-
else
|
|
2791
|
-
newPattern = [e];
|
|
2792
|
-
this._process(newPattern.concat(remain), index, inGlobStar);
|
|
2793
|
-
}
|
|
2794
|
-
};
|
|
2795
|
-
GlobSync.prototype._emitMatch = function(index, e) {
|
|
2796
|
-
if (isIgnored(this, e))
|
|
2797
|
-
return;
|
|
2798
|
-
var abs = this._makeAbs(e);
|
|
2799
|
-
if (this.mark)
|
|
2800
|
-
e = this._mark(e);
|
|
2801
|
-
if (this.absolute) {
|
|
2802
|
-
e = abs;
|
|
2803
|
-
}
|
|
2804
|
-
if (this.matches[index][e])
|
|
2805
|
-
return;
|
|
2806
|
-
if (this.nodir) {
|
|
2807
|
-
var c = this.cache[abs];
|
|
2808
|
-
if (c === "DIR" || Array.isArray(c))
|
|
2809
|
-
return;
|
|
2810
|
-
}
|
|
2811
|
-
this.matches[index][e] = true;
|
|
2812
|
-
if (this.stat)
|
|
2813
|
-
this._stat(e);
|
|
2814
|
-
};
|
|
2815
|
-
GlobSync.prototype._readdirInGlobStar = function(abs) {
|
|
2816
|
-
if (this.follow)
|
|
2817
|
-
return this._readdir(abs, false);
|
|
2818
|
-
var entries;
|
|
2819
|
-
var lstat;
|
|
2820
|
-
var stat;
|
|
2821
|
-
try {
|
|
2822
|
-
lstat = this.fs.lstatSync(abs);
|
|
2823
|
-
} catch (er) {
|
|
2824
|
-
if (er.code === "ENOENT") {
|
|
2825
|
-
return null;
|
|
2826
|
-
}
|
|
2827
|
-
}
|
|
2828
|
-
var isSym = lstat && lstat.isSymbolicLink();
|
|
2829
|
-
this.symlinks[abs] = isSym;
|
|
2830
|
-
if (!isSym && lstat && !lstat.isDirectory())
|
|
2831
|
-
this.cache[abs] = "FILE";
|
|
2832
|
-
else
|
|
2833
|
-
entries = this._readdir(abs, false);
|
|
2834
|
-
return entries;
|
|
2835
|
-
};
|
|
2836
|
-
GlobSync.prototype._readdir = function(abs, inGlobStar) {
|
|
2837
|
-
var entries;
|
|
2838
|
-
if (inGlobStar && !ownProp(this.symlinks, abs))
|
|
2839
|
-
return this._readdirInGlobStar(abs);
|
|
2840
|
-
if (ownProp(this.cache, abs)) {
|
|
2841
|
-
var c = this.cache[abs];
|
|
2842
|
-
if (!c || c === "FILE")
|
|
2843
|
-
return null;
|
|
2844
|
-
if (Array.isArray(c))
|
|
2845
|
-
return c;
|
|
2846
|
-
}
|
|
2847
|
-
try {
|
|
2848
|
-
return this._readdirEntries(abs, this.fs.readdirSync(abs));
|
|
2849
|
-
} catch (er) {
|
|
2850
|
-
this._readdirError(abs, er);
|
|
2851
|
-
return null;
|
|
2852
|
-
}
|
|
2853
|
-
};
|
|
2854
|
-
GlobSync.prototype._readdirEntries = function(abs, entries) {
|
|
2855
|
-
if (!this.mark && !this.stat) {
|
|
2856
|
-
for (var i = 0; i < entries.length; i++) {
|
|
2857
|
-
var e = entries[i];
|
|
2858
|
-
if (abs === "/")
|
|
2859
|
-
e = abs + e;
|
|
2860
|
-
else
|
|
2861
|
-
e = abs + "/" + e;
|
|
2862
|
-
this.cache[e] = true;
|
|
2863
|
-
}
|
|
2864
|
-
}
|
|
2865
|
-
this.cache[abs] = entries;
|
|
2866
|
-
return entries;
|
|
2867
|
-
};
|
|
2868
|
-
GlobSync.prototype._readdirError = function(f, er) {
|
|
2869
|
-
switch (er.code) {
|
|
2870
|
-
case "ENOTSUP":
|
|
2871
|
-
case "ENOTDIR":
|
|
2872
|
-
var abs = this._makeAbs(f);
|
|
2873
|
-
this.cache[abs] = "FILE";
|
|
2874
|
-
if (abs === this.cwdAbs) {
|
|
2875
|
-
var error = new Error(er.code + " invalid cwd " + this.cwd);
|
|
2876
|
-
error.path = this.cwd;
|
|
2877
|
-
error.code = er.code;
|
|
2878
|
-
throw error;
|
|
2879
|
-
}
|
|
2880
|
-
break;
|
|
2881
|
-
case "ENOENT":
|
|
2882
|
-
case "ELOOP":
|
|
2883
|
-
case "ENAMETOOLONG":
|
|
2884
|
-
case "UNKNOWN":
|
|
2885
|
-
this.cache[this._makeAbs(f)] = false;
|
|
2886
|
-
break;
|
|
2887
|
-
default:
|
|
2888
|
-
this.cache[this._makeAbs(f)] = false;
|
|
2889
|
-
if (this.strict)
|
|
2890
|
-
throw er;
|
|
2891
|
-
if (!this.silent)
|
|
2892
|
-
console.error("glob error", er);
|
|
2893
|
-
break;
|
|
2894
|
-
}
|
|
2895
|
-
};
|
|
2896
|
-
GlobSync.prototype._processGlobStar = function(prefix, read, abs, remain, index, inGlobStar) {
|
|
2897
|
-
var entries = this._readdir(abs, inGlobStar);
|
|
2898
|
-
if (!entries)
|
|
2899
|
-
return;
|
|
2900
|
-
var remainWithoutGlobStar = remain.slice(1);
|
|
2901
|
-
var gspref = prefix ? [prefix] : [];
|
|
2902
|
-
var noGlobStar = gspref.concat(remainWithoutGlobStar);
|
|
2903
|
-
this._process(noGlobStar, index, false);
|
|
2904
|
-
var len = entries.length;
|
|
2905
|
-
var isSym = this.symlinks[abs];
|
|
2906
|
-
if (isSym && inGlobStar)
|
|
2907
|
-
return;
|
|
2908
|
-
for (var i = 0; i < len; i++) {
|
|
2909
|
-
var e = entries[i];
|
|
2910
|
-
if (e.charAt(0) === "." && !this.dot)
|
|
2911
|
-
continue;
|
|
2912
|
-
var instead = gspref.concat(entries[i], remainWithoutGlobStar);
|
|
2913
|
-
this._process(instead, index, true);
|
|
2914
|
-
var below = gspref.concat(entries[i], remain);
|
|
2915
|
-
this._process(below, index, true);
|
|
2916
|
-
}
|
|
2917
|
-
};
|
|
2918
|
-
GlobSync.prototype._processSimple = function(prefix, index) {
|
|
2919
|
-
var exists = this._stat(prefix);
|
|
2920
|
-
if (!this.matches[index])
|
|
2921
|
-
this.matches[index] = /* @__PURE__ */ Object.create(null);
|
|
2922
|
-
if (!exists)
|
|
2923
|
-
return;
|
|
2924
|
-
if (prefix && isAbsolute(prefix) && !this.nomount) {
|
|
2925
|
-
var trail = /[\/\\]$/.test(prefix);
|
|
2926
|
-
if (prefix.charAt(0) === "/") {
|
|
2927
|
-
prefix = path10.join(this.root, prefix);
|
|
2928
|
-
} else {
|
|
2929
|
-
prefix = path10.resolve(this.root, prefix);
|
|
2930
|
-
if (trail)
|
|
2931
|
-
prefix += "/";
|
|
2932
|
-
}
|
|
2933
|
-
}
|
|
2934
|
-
if (process.platform === "win32")
|
|
2935
|
-
prefix = prefix.replace(/\\/g, "/");
|
|
2936
|
-
this._emitMatch(index, prefix);
|
|
2937
|
-
};
|
|
2938
|
-
GlobSync.prototype._stat = function(f) {
|
|
2939
|
-
var abs = this._makeAbs(f);
|
|
2940
|
-
var needDir = f.slice(-1) === "/";
|
|
2941
|
-
if (f.length > this.maxLength)
|
|
2942
|
-
return false;
|
|
2943
|
-
if (!this.stat && ownProp(this.cache, abs)) {
|
|
2944
|
-
var c = this.cache[abs];
|
|
2945
|
-
if (Array.isArray(c))
|
|
2946
|
-
c = "DIR";
|
|
2947
|
-
if (!needDir || c === "DIR")
|
|
2948
|
-
return c;
|
|
2949
|
-
if (needDir && c === "FILE")
|
|
2950
|
-
return false;
|
|
2951
|
-
}
|
|
2952
|
-
var exists;
|
|
2953
|
-
var stat = this.statCache[abs];
|
|
2954
|
-
if (!stat) {
|
|
2955
|
-
var lstat;
|
|
2956
|
-
try {
|
|
2957
|
-
lstat = this.fs.lstatSync(abs);
|
|
2958
|
-
} catch (er) {
|
|
2959
|
-
if (er && (er.code === "ENOENT" || er.code === "ENOTDIR")) {
|
|
2960
|
-
this.statCache[abs] = false;
|
|
2961
|
-
return false;
|
|
2962
|
-
}
|
|
2963
|
-
}
|
|
2964
|
-
if (lstat && lstat.isSymbolicLink()) {
|
|
2965
|
-
try {
|
|
2966
|
-
stat = this.fs.statSync(abs);
|
|
2967
|
-
} catch (er) {
|
|
2968
|
-
stat = lstat;
|
|
2969
|
-
}
|
|
2970
|
-
} else {
|
|
2971
|
-
stat = lstat;
|
|
2972
|
-
}
|
|
2973
|
-
}
|
|
2974
|
-
this.statCache[abs] = stat;
|
|
2975
|
-
var c = true;
|
|
2976
|
-
if (stat)
|
|
2977
|
-
c = stat.isDirectory() ? "DIR" : "FILE";
|
|
2978
|
-
this.cache[abs] = this.cache[abs] || c;
|
|
2979
|
-
if (needDir && c === "FILE")
|
|
2980
|
-
return false;
|
|
2981
|
-
return c;
|
|
2982
|
-
};
|
|
2983
|
-
GlobSync.prototype._mark = function(p) {
|
|
2984
|
-
return common.mark(this, p);
|
|
2985
|
-
};
|
|
2986
|
-
GlobSync.prototype._makeAbs = function(f) {
|
|
2987
|
-
return common.makeAbs(this, f);
|
|
2988
|
-
};
|
|
2989
|
-
}
|
|
2990
|
-
});
|
|
2991
|
-
|
|
2992
|
-
// node_modules/wrappy/wrappy.js
|
|
2993
|
-
var require_wrappy = __commonJS({
|
|
2994
|
-
"node_modules/wrappy/wrappy.js"(exports, module) {
|
|
2995
|
-
module.exports = wrappy;
|
|
2996
|
-
function wrappy(fn, cb) {
|
|
2997
|
-
if (fn && cb)
|
|
2998
|
-
return wrappy(fn)(cb);
|
|
2999
|
-
if (typeof fn !== "function")
|
|
3000
|
-
throw new TypeError("need wrapper function");
|
|
3001
|
-
Object.keys(fn).forEach(function(k) {
|
|
3002
|
-
wrapper[k] = fn[k];
|
|
3003
|
-
});
|
|
3004
|
-
return wrapper;
|
|
3005
|
-
function wrapper() {
|
|
3006
|
-
var args = new Array(arguments.length);
|
|
3007
|
-
for (var i = 0; i < args.length; i++) {
|
|
3008
|
-
args[i] = arguments[i];
|
|
3009
|
-
}
|
|
3010
|
-
var ret = fn.apply(this, args);
|
|
3011
|
-
var cb2 = args[args.length - 1];
|
|
3012
|
-
if (typeof ret === "function" && ret !== cb2) {
|
|
3013
|
-
Object.keys(cb2).forEach(function(k) {
|
|
3014
|
-
ret[k] = cb2[k];
|
|
3015
|
-
});
|
|
3016
|
-
}
|
|
3017
|
-
return ret;
|
|
3018
|
-
}
|
|
3019
|
-
}
|
|
3020
|
-
}
|
|
3021
|
-
});
|
|
3022
|
-
|
|
3023
|
-
// node_modules/once/once.js
|
|
3024
|
-
var require_once = __commonJS({
|
|
3025
|
-
"node_modules/once/once.js"(exports, module) {
|
|
3026
|
-
var wrappy = require_wrappy();
|
|
3027
|
-
module.exports = wrappy(once);
|
|
3028
|
-
module.exports.strict = wrappy(onceStrict);
|
|
3029
|
-
once.proto = once(function() {
|
|
3030
|
-
Object.defineProperty(Function.prototype, "once", {
|
|
3031
|
-
value: function() {
|
|
3032
|
-
return once(this);
|
|
3033
|
-
},
|
|
3034
|
-
configurable: true
|
|
3035
|
-
});
|
|
3036
|
-
Object.defineProperty(Function.prototype, "onceStrict", {
|
|
3037
|
-
value: function() {
|
|
3038
|
-
return onceStrict(this);
|
|
3039
|
-
},
|
|
3040
|
-
configurable: true
|
|
3041
|
-
});
|
|
3042
|
-
});
|
|
3043
|
-
function once(fn) {
|
|
3044
|
-
var f = function() {
|
|
3045
|
-
if (f.called)
|
|
3046
|
-
return f.value;
|
|
3047
|
-
f.called = true;
|
|
3048
|
-
return f.value = fn.apply(this, arguments);
|
|
3049
|
-
};
|
|
3050
|
-
f.called = false;
|
|
3051
|
-
return f;
|
|
3052
|
-
}
|
|
3053
|
-
function onceStrict(fn) {
|
|
3054
|
-
var f = function() {
|
|
3055
|
-
if (f.called)
|
|
3056
|
-
throw new Error(f.onceError);
|
|
3057
|
-
f.called = true;
|
|
3058
|
-
return f.value = fn.apply(this, arguments);
|
|
3059
|
-
};
|
|
3060
|
-
var name = fn.name || "Function wrapped with `once`";
|
|
3061
|
-
f.onceError = name + " shouldn't be called more than once";
|
|
3062
|
-
f.called = false;
|
|
3063
|
-
return f;
|
|
3064
|
-
}
|
|
3065
|
-
}
|
|
3066
|
-
});
|
|
3067
|
-
|
|
3068
|
-
// node_modules/inflight/inflight.js
|
|
3069
|
-
var require_inflight = __commonJS({
|
|
3070
|
-
"node_modules/inflight/inflight.js"(exports, module) {
|
|
3071
|
-
var wrappy = require_wrappy();
|
|
3072
|
-
var reqs = /* @__PURE__ */ Object.create(null);
|
|
3073
|
-
var once = require_once();
|
|
3074
|
-
module.exports = wrappy(inflight);
|
|
3075
|
-
function inflight(key, cb) {
|
|
3076
|
-
if (reqs[key]) {
|
|
3077
|
-
reqs[key].push(cb);
|
|
3078
|
-
return null;
|
|
3079
|
-
} else {
|
|
3080
|
-
reqs[key] = [cb];
|
|
3081
|
-
return makeres(key);
|
|
3082
|
-
}
|
|
3083
|
-
}
|
|
3084
|
-
function makeres(key) {
|
|
3085
|
-
return once(function RES() {
|
|
3086
|
-
var cbs = reqs[key];
|
|
3087
|
-
var len = cbs.length;
|
|
3088
|
-
var args = slice(arguments);
|
|
3089
|
-
try {
|
|
3090
|
-
for (var i = 0; i < len; i++) {
|
|
3091
|
-
cbs[i].apply(null, args);
|
|
3092
|
-
}
|
|
3093
|
-
} finally {
|
|
3094
|
-
if (cbs.length > len) {
|
|
3095
|
-
cbs.splice(0, len);
|
|
3096
|
-
process.nextTick(function() {
|
|
3097
|
-
RES.apply(null, args);
|
|
3098
|
-
});
|
|
3099
|
-
} else {
|
|
3100
|
-
delete reqs[key];
|
|
3101
|
-
}
|
|
3102
|
-
}
|
|
3103
|
-
});
|
|
3104
|
-
}
|
|
3105
|
-
function slice(args) {
|
|
3106
|
-
var length = args.length;
|
|
3107
|
-
var array2 = [];
|
|
3108
|
-
for (var i = 0; i < length; i++)
|
|
3109
|
-
array2[i] = args[i];
|
|
3110
|
-
return array2;
|
|
3111
|
-
}
|
|
3112
|
-
}
|
|
3113
|
-
});
|
|
3114
|
-
|
|
3115
|
-
// node_modules/glob/glob.js
|
|
3116
|
-
var require_glob = __commonJS({
|
|
3117
|
-
"node_modules/glob/glob.js"(exports, module) {
|
|
3118
|
-
module.exports = glob;
|
|
3119
|
-
var rp = require_fs();
|
|
3120
|
-
var minimatch = require_minimatch();
|
|
3121
|
-
var Minimatch = minimatch.Minimatch;
|
|
3122
|
-
var inherits = require_inherits();
|
|
3123
|
-
var EE = __require("events").EventEmitter;
|
|
3124
|
-
var path10 = __require("path");
|
|
3125
|
-
var assert = __require("assert");
|
|
3126
|
-
var isAbsolute = require_path_is_absolute();
|
|
3127
|
-
var globSync = require_sync();
|
|
3128
|
-
var common = require_common();
|
|
3129
|
-
var setopts = common.setopts;
|
|
3130
|
-
var ownProp = common.ownProp;
|
|
3131
|
-
var inflight = require_inflight();
|
|
3132
|
-
var util = __require("util");
|
|
3133
|
-
var childrenIgnored = common.childrenIgnored;
|
|
3134
|
-
var isIgnored = common.isIgnored;
|
|
3135
|
-
var once = require_once();
|
|
3136
|
-
function glob(pattern, options, cb) {
|
|
3137
|
-
if (typeof options === "function")
|
|
3138
|
-
cb = options, options = {};
|
|
3139
|
-
if (!options)
|
|
3140
|
-
options = {};
|
|
3141
|
-
if (options.sync) {
|
|
3142
|
-
if (cb)
|
|
3143
|
-
throw new TypeError("callback provided to sync glob");
|
|
3144
|
-
return globSync(pattern, options);
|
|
3145
|
-
}
|
|
3146
|
-
return new Glob(pattern, options, cb);
|
|
3147
|
-
}
|
|
3148
|
-
glob.sync = globSync;
|
|
3149
|
-
var GlobSync = glob.GlobSync = globSync.GlobSync;
|
|
3150
|
-
glob.glob = glob;
|
|
3151
|
-
function extend(origin, add) {
|
|
3152
|
-
if (add === null || typeof add !== "object") {
|
|
3153
|
-
return origin;
|
|
3154
|
-
}
|
|
3155
|
-
var keys = Object.keys(add);
|
|
3156
|
-
var i = keys.length;
|
|
3157
|
-
while (i--) {
|
|
3158
|
-
origin[keys[i]] = add[keys[i]];
|
|
3159
|
-
}
|
|
3160
|
-
return origin;
|
|
3161
|
-
}
|
|
3162
|
-
glob.hasMagic = function(pattern, options_) {
|
|
3163
|
-
var options = extend({}, options_);
|
|
3164
|
-
options.noprocess = true;
|
|
3165
|
-
var g = new Glob(pattern, options);
|
|
3166
|
-
var set = g.minimatch.set;
|
|
3167
|
-
if (!pattern)
|
|
3168
|
-
return false;
|
|
3169
|
-
if (set.length > 1)
|
|
3170
|
-
return true;
|
|
3171
|
-
for (var j = 0; j < set[0].length; j++) {
|
|
3172
|
-
if (typeof set[0][j] !== "string")
|
|
3173
|
-
return true;
|
|
3174
|
-
}
|
|
3175
|
-
return false;
|
|
3176
|
-
};
|
|
3177
|
-
glob.Glob = Glob;
|
|
3178
|
-
inherits(Glob, EE);
|
|
3179
|
-
function Glob(pattern, options, cb) {
|
|
3180
|
-
if (typeof options === "function") {
|
|
3181
|
-
cb = options;
|
|
3182
|
-
options = null;
|
|
3183
|
-
}
|
|
3184
|
-
if (options && options.sync) {
|
|
3185
|
-
if (cb)
|
|
3186
|
-
throw new TypeError("callback provided to sync glob");
|
|
3187
|
-
return new GlobSync(pattern, options);
|
|
3188
|
-
}
|
|
3189
|
-
if (!(this instanceof Glob))
|
|
3190
|
-
return new Glob(pattern, options, cb);
|
|
3191
|
-
setopts(this, pattern, options);
|
|
3192
|
-
this._didRealPath = false;
|
|
3193
|
-
var n = this.minimatch.set.length;
|
|
3194
|
-
this.matches = new Array(n);
|
|
3195
|
-
if (typeof cb === "function") {
|
|
3196
|
-
cb = once(cb);
|
|
3197
|
-
this.on("error", cb);
|
|
3198
|
-
this.on("end", function(matches) {
|
|
3199
|
-
cb(null, matches);
|
|
3200
|
-
});
|
|
3201
|
-
}
|
|
3202
|
-
var self = this;
|
|
3203
|
-
this._processing = 0;
|
|
3204
|
-
this._emitQueue = [];
|
|
3205
|
-
this._processQueue = [];
|
|
3206
|
-
this.paused = false;
|
|
3207
|
-
if (this.noprocess)
|
|
3208
|
-
return this;
|
|
3209
|
-
if (n === 0)
|
|
3210
|
-
return done();
|
|
3211
|
-
var sync = true;
|
|
3212
|
-
for (var i = 0; i < n; i++) {
|
|
3213
|
-
this._process(this.minimatch.set[i], i, false, done);
|
|
3214
|
-
}
|
|
3215
|
-
sync = false;
|
|
3216
|
-
function done() {
|
|
3217
|
-
--self._processing;
|
|
3218
|
-
if (self._processing <= 0) {
|
|
3219
|
-
if (sync) {
|
|
3220
|
-
process.nextTick(function() {
|
|
3221
|
-
self._finish();
|
|
3222
|
-
});
|
|
3223
|
-
} else {
|
|
3224
|
-
self._finish();
|
|
3225
|
-
}
|
|
3226
|
-
}
|
|
3227
|
-
}
|
|
3228
|
-
}
|
|
3229
|
-
Glob.prototype._finish = function() {
|
|
3230
|
-
assert(this instanceof Glob);
|
|
3231
|
-
if (this.aborted)
|
|
3232
|
-
return;
|
|
3233
|
-
if (this.realpath && !this._didRealpath)
|
|
3234
|
-
return this._realpath();
|
|
3235
|
-
common.finish(this);
|
|
3236
|
-
this.emit("end", this.found);
|
|
3237
|
-
};
|
|
3238
|
-
Glob.prototype._realpath = function() {
|
|
3239
|
-
if (this._didRealpath)
|
|
3240
|
-
return;
|
|
3241
|
-
this._didRealpath = true;
|
|
3242
|
-
var n = this.matches.length;
|
|
3243
|
-
if (n === 0)
|
|
3244
|
-
return this._finish();
|
|
3245
|
-
var self = this;
|
|
3246
|
-
for (var i = 0; i < this.matches.length; i++)
|
|
3247
|
-
this._realpathSet(i, next);
|
|
3248
|
-
function next() {
|
|
3249
|
-
if (--n === 0)
|
|
3250
|
-
self._finish();
|
|
3251
|
-
}
|
|
3252
|
-
};
|
|
3253
|
-
Glob.prototype._realpathSet = function(index, cb) {
|
|
3254
|
-
var matchset = this.matches[index];
|
|
3255
|
-
if (!matchset)
|
|
3256
|
-
return cb();
|
|
3257
|
-
var found = Object.keys(matchset);
|
|
3258
|
-
var self = this;
|
|
3259
|
-
var n = found.length;
|
|
3260
|
-
if (n === 0)
|
|
3261
|
-
return cb();
|
|
3262
|
-
var set = this.matches[index] = /* @__PURE__ */ Object.create(null);
|
|
3263
|
-
found.forEach(function(p, i) {
|
|
3264
|
-
p = self._makeAbs(p);
|
|
3265
|
-
rp.realpath(p, self.realpathCache, function(er, real) {
|
|
3266
|
-
if (!er)
|
|
3267
|
-
set[real] = true;
|
|
3268
|
-
else if (er.syscall === "stat")
|
|
3269
|
-
set[p] = true;
|
|
3270
|
-
else
|
|
3271
|
-
self.emit("error", er);
|
|
3272
|
-
if (--n === 0) {
|
|
3273
|
-
self.matches[index] = set;
|
|
3274
|
-
cb();
|
|
3275
|
-
}
|
|
3276
|
-
});
|
|
3277
|
-
});
|
|
3278
|
-
};
|
|
3279
|
-
Glob.prototype._mark = function(p) {
|
|
3280
|
-
return common.mark(this, p);
|
|
3281
|
-
};
|
|
3282
|
-
Glob.prototype._makeAbs = function(f) {
|
|
3283
|
-
return common.makeAbs(this, f);
|
|
3284
|
-
};
|
|
3285
|
-
Glob.prototype.abort = function() {
|
|
3286
|
-
this.aborted = true;
|
|
3287
|
-
this.emit("abort");
|
|
3288
|
-
};
|
|
3289
|
-
Glob.prototype.pause = function() {
|
|
3290
|
-
if (!this.paused) {
|
|
3291
|
-
this.paused = true;
|
|
3292
|
-
this.emit("pause");
|
|
3293
|
-
}
|
|
3294
|
-
};
|
|
3295
|
-
Glob.prototype.resume = function() {
|
|
3296
|
-
if (this.paused) {
|
|
3297
|
-
this.emit("resume");
|
|
3298
|
-
this.paused = false;
|
|
3299
|
-
if (this._emitQueue.length) {
|
|
3300
|
-
var eq = this._emitQueue.slice(0);
|
|
3301
|
-
this._emitQueue.length = 0;
|
|
3302
|
-
for (var i = 0; i < eq.length; i++) {
|
|
3303
|
-
var e = eq[i];
|
|
3304
|
-
this._emitMatch(e[0], e[1]);
|
|
3305
|
-
}
|
|
3306
|
-
}
|
|
3307
|
-
if (this._processQueue.length) {
|
|
3308
|
-
var pq = this._processQueue.slice(0);
|
|
3309
|
-
this._processQueue.length = 0;
|
|
3310
|
-
for (var i = 0; i < pq.length; i++) {
|
|
3311
|
-
var p = pq[i];
|
|
3312
|
-
this._processing--;
|
|
3313
|
-
this._process(p[0], p[1], p[2], p[3]);
|
|
3314
|
-
}
|
|
3315
|
-
}
|
|
3316
|
-
}
|
|
3317
|
-
};
|
|
3318
|
-
Glob.prototype._process = function(pattern, index, inGlobStar, cb) {
|
|
3319
|
-
assert(this instanceof Glob);
|
|
3320
|
-
assert(typeof cb === "function");
|
|
3321
|
-
if (this.aborted)
|
|
3322
|
-
return;
|
|
3323
|
-
this._processing++;
|
|
3324
|
-
if (this.paused) {
|
|
3325
|
-
this._processQueue.push([pattern, index, inGlobStar, cb]);
|
|
3326
|
-
return;
|
|
3327
|
-
}
|
|
3328
|
-
var n = 0;
|
|
3329
|
-
while (typeof pattern[n] === "string") {
|
|
3330
|
-
n++;
|
|
3331
|
-
}
|
|
3332
|
-
var prefix;
|
|
3333
|
-
switch (n) {
|
|
3334
|
-
case pattern.length:
|
|
3335
|
-
this._processSimple(pattern.join("/"), index, cb);
|
|
3336
|
-
return;
|
|
3337
|
-
case 0:
|
|
3338
|
-
prefix = null;
|
|
3339
|
-
break;
|
|
3340
|
-
default:
|
|
3341
|
-
prefix = pattern.slice(0, n).join("/");
|
|
3342
|
-
break;
|
|
3343
|
-
}
|
|
3344
|
-
var remain = pattern.slice(n);
|
|
3345
|
-
var read;
|
|
3346
|
-
if (prefix === null)
|
|
3347
|
-
read = ".";
|
|
3348
|
-
else if (isAbsolute(prefix) || isAbsolute(pattern.map(function(p) {
|
|
3349
|
-
return typeof p === "string" ? p : "[*]";
|
|
3350
|
-
}).join("/"))) {
|
|
3351
|
-
if (!prefix || !isAbsolute(prefix))
|
|
3352
|
-
prefix = "/" + prefix;
|
|
3353
|
-
read = prefix;
|
|
3354
|
-
} else
|
|
3355
|
-
read = prefix;
|
|
3356
|
-
var abs = this._makeAbs(read);
|
|
3357
|
-
if (childrenIgnored(this, read))
|
|
3358
|
-
return cb();
|
|
3359
|
-
var isGlobStar = remain[0] === minimatch.GLOBSTAR;
|
|
3360
|
-
if (isGlobStar)
|
|
3361
|
-
this._processGlobStar(prefix, read, abs, remain, index, inGlobStar, cb);
|
|
3362
|
-
else
|
|
3363
|
-
this._processReaddir(prefix, read, abs, remain, index, inGlobStar, cb);
|
|
3364
|
-
};
|
|
3365
|
-
Glob.prototype._processReaddir = function(prefix, read, abs, remain, index, inGlobStar, cb) {
|
|
3366
|
-
var self = this;
|
|
3367
|
-
this._readdir(abs, inGlobStar, function(er, entries) {
|
|
3368
|
-
return self._processReaddir2(prefix, read, abs, remain, index, inGlobStar, entries, cb);
|
|
3369
|
-
});
|
|
3370
|
-
};
|
|
3371
|
-
Glob.prototype._processReaddir2 = function(prefix, read, abs, remain, index, inGlobStar, entries, cb) {
|
|
3372
|
-
if (!entries)
|
|
3373
|
-
return cb();
|
|
3374
|
-
var pn = remain[0];
|
|
3375
|
-
var negate = !!this.minimatch.negate;
|
|
3376
|
-
var rawGlob = pn._glob;
|
|
3377
|
-
var dotOk = this.dot || rawGlob.charAt(0) === ".";
|
|
3378
|
-
var matchedEntries = [];
|
|
3379
|
-
for (var i = 0; i < entries.length; i++) {
|
|
3380
|
-
var e = entries[i];
|
|
3381
|
-
if (e.charAt(0) !== "." || dotOk) {
|
|
3382
|
-
var m;
|
|
3383
|
-
if (negate && !prefix) {
|
|
3384
|
-
m = !e.match(pn);
|
|
3385
|
-
} else {
|
|
3386
|
-
m = e.match(pn);
|
|
3387
|
-
}
|
|
3388
|
-
if (m)
|
|
3389
|
-
matchedEntries.push(e);
|
|
3390
|
-
}
|
|
3391
|
-
}
|
|
3392
|
-
var len = matchedEntries.length;
|
|
3393
|
-
if (len === 0)
|
|
3394
|
-
return cb();
|
|
3395
|
-
if (remain.length === 1 && !this.mark && !this.stat) {
|
|
3396
|
-
if (!this.matches[index])
|
|
3397
|
-
this.matches[index] = /* @__PURE__ */ Object.create(null);
|
|
3398
|
-
for (var i = 0; i < len; i++) {
|
|
3399
|
-
var e = matchedEntries[i];
|
|
3400
|
-
if (prefix) {
|
|
3401
|
-
if (prefix !== "/")
|
|
3402
|
-
e = prefix + "/" + e;
|
|
3403
|
-
else
|
|
3404
|
-
e = prefix + e;
|
|
3405
|
-
}
|
|
3406
|
-
if (e.charAt(0) === "/" && !this.nomount) {
|
|
3407
|
-
e = path10.join(this.root, e);
|
|
3408
|
-
}
|
|
3409
|
-
this._emitMatch(index, e);
|
|
3410
|
-
}
|
|
3411
|
-
return cb();
|
|
3412
|
-
}
|
|
3413
|
-
remain.shift();
|
|
3414
|
-
for (var i = 0; i < len; i++) {
|
|
3415
|
-
var e = matchedEntries[i];
|
|
3416
|
-
var newPattern;
|
|
3417
|
-
if (prefix) {
|
|
3418
|
-
if (prefix !== "/")
|
|
3419
|
-
e = prefix + "/" + e;
|
|
3420
|
-
else
|
|
3421
|
-
e = prefix + e;
|
|
561
|
+
set(key, value, ttl) {
|
|
562
|
+
const keyPrefixed = this._getKeyPrefix(key);
|
|
563
|
+
if (typeof ttl === "undefined") {
|
|
564
|
+
ttl = this.opts.ttl;
|
|
3422
565
|
}
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
cb();
|
|
3426
|
-
};
|
|
3427
|
-
Glob.prototype._emitMatch = function(index, e) {
|
|
3428
|
-
if (this.aborted)
|
|
3429
|
-
return;
|
|
3430
|
-
if (isIgnored(this, e))
|
|
3431
|
-
return;
|
|
3432
|
-
if (this.paused) {
|
|
3433
|
-
this._emitQueue.push([index, e]);
|
|
3434
|
-
return;
|
|
3435
|
-
}
|
|
3436
|
-
var abs = isAbsolute(e) ? e : this._makeAbs(e);
|
|
3437
|
-
if (this.mark)
|
|
3438
|
-
e = this._mark(e);
|
|
3439
|
-
if (this.absolute)
|
|
3440
|
-
e = abs;
|
|
3441
|
-
if (this.matches[index][e])
|
|
3442
|
-
return;
|
|
3443
|
-
if (this.nodir) {
|
|
3444
|
-
var c = this.cache[abs];
|
|
3445
|
-
if (c === "DIR" || Array.isArray(c))
|
|
3446
|
-
return;
|
|
3447
|
-
}
|
|
3448
|
-
this.matches[index][e] = true;
|
|
3449
|
-
var st = this.statCache[abs];
|
|
3450
|
-
if (st)
|
|
3451
|
-
this.emit("stat", e, st);
|
|
3452
|
-
this.emit("match", e);
|
|
3453
|
-
};
|
|
3454
|
-
Glob.prototype._readdirInGlobStar = function(abs, cb) {
|
|
3455
|
-
if (this.aborted)
|
|
3456
|
-
return;
|
|
3457
|
-
if (this.follow)
|
|
3458
|
-
return this._readdir(abs, false, cb);
|
|
3459
|
-
var lstatkey = "lstat\0" + abs;
|
|
3460
|
-
var self = this;
|
|
3461
|
-
var lstatcb = inflight(lstatkey, lstatcb_);
|
|
3462
|
-
if (lstatcb)
|
|
3463
|
-
self.fs.lstat(abs, lstatcb);
|
|
3464
|
-
function lstatcb_(er, lstat) {
|
|
3465
|
-
if (er && er.code === "ENOENT")
|
|
3466
|
-
return cb();
|
|
3467
|
-
var isSym = lstat && lstat.isSymbolicLink();
|
|
3468
|
-
self.symlinks[abs] = isSym;
|
|
3469
|
-
if (!isSym && lstat && !lstat.isDirectory()) {
|
|
3470
|
-
self.cache[abs] = "FILE";
|
|
3471
|
-
cb();
|
|
3472
|
-
} else
|
|
3473
|
-
self._readdir(abs, false, cb);
|
|
3474
|
-
}
|
|
3475
|
-
};
|
|
3476
|
-
Glob.prototype._readdir = function(abs, inGlobStar, cb) {
|
|
3477
|
-
if (this.aborted)
|
|
3478
|
-
return;
|
|
3479
|
-
cb = inflight("readdir\0" + abs + "\0" + inGlobStar, cb);
|
|
3480
|
-
if (!cb)
|
|
3481
|
-
return;
|
|
3482
|
-
if (inGlobStar && !ownProp(this.symlinks, abs))
|
|
3483
|
-
return this._readdirInGlobStar(abs, cb);
|
|
3484
|
-
if (ownProp(this.cache, abs)) {
|
|
3485
|
-
var c = this.cache[abs];
|
|
3486
|
-
if (!c || c === "FILE")
|
|
3487
|
-
return cb();
|
|
3488
|
-
if (Array.isArray(c))
|
|
3489
|
-
return cb(null, c);
|
|
3490
|
-
}
|
|
3491
|
-
var self = this;
|
|
3492
|
-
self.fs.readdir(abs, readdirCb(this, abs, cb));
|
|
3493
|
-
};
|
|
3494
|
-
function readdirCb(self, abs, cb) {
|
|
3495
|
-
return function(er, entries) {
|
|
3496
|
-
if (er)
|
|
3497
|
-
self._readdirError(abs, er, cb);
|
|
3498
|
-
else
|
|
3499
|
-
self._readdirEntries(abs, entries, cb);
|
|
3500
|
-
};
|
|
3501
|
-
}
|
|
3502
|
-
Glob.prototype._readdirEntries = function(abs, entries, cb) {
|
|
3503
|
-
if (this.aborted)
|
|
3504
|
-
return;
|
|
3505
|
-
if (!this.mark && !this.stat) {
|
|
3506
|
-
for (var i = 0; i < entries.length; i++) {
|
|
3507
|
-
var e = entries[i];
|
|
3508
|
-
if (abs === "/")
|
|
3509
|
-
e = abs + e;
|
|
3510
|
-
else
|
|
3511
|
-
e = abs + "/" + e;
|
|
3512
|
-
this.cache[e] = true;
|
|
566
|
+
if (ttl === 0) {
|
|
567
|
+
ttl = void 0;
|
|
3513
568
|
}
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
if (this.aborted)
|
|
3520
|
-
return;
|
|
3521
|
-
switch (er.code) {
|
|
3522
|
-
case "ENOTSUP":
|
|
3523
|
-
case "ENOTDIR":
|
|
3524
|
-
var abs = this._makeAbs(f);
|
|
3525
|
-
this.cache[abs] = "FILE";
|
|
3526
|
-
if (abs === this.cwdAbs) {
|
|
3527
|
-
var error = new Error(er.code + " invalid cwd " + this.cwd);
|
|
3528
|
-
error.path = this.cwd;
|
|
3529
|
-
error.code = er.code;
|
|
3530
|
-
this.emit("error", error);
|
|
3531
|
-
this.abort();
|
|
3532
|
-
}
|
|
3533
|
-
break;
|
|
3534
|
-
case "ENOENT":
|
|
3535
|
-
case "ELOOP":
|
|
3536
|
-
case "ENAMETOOLONG":
|
|
3537
|
-
case "UNKNOWN":
|
|
3538
|
-
this.cache[this._makeAbs(f)] = false;
|
|
3539
|
-
break;
|
|
3540
|
-
default:
|
|
3541
|
-
this.cache[this._makeAbs(f)] = false;
|
|
3542
|
-
if (this.strict) {
|
|
3543
|
-
this.emit("error", er);
|
|
3544
|
-
this.abort();
|
|
569
|
+
const { store } = this.opts;
|
|
570
|
+
return Promise.resolve().then(() => {
|
|
571
|
+
const expires = typeof ttl === "number" ? Date.now() + ttl : null;
|
|
572
|
+
if (typeof value === "symbol") {
|
|
573
|
+
this.emit("error", "symbol cannot be serialized");
|
|
3545
574
|
}
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
}
|
|
3550
|
-
return cb();
|
|
3551
|
-
};
|
|
3552
|
-
Glob.prototype._processGlobStar = function(prefix, read, abs, remain, index, inGlobStar, cb) {
|
|
3553
|
-
var self = this;
|
|
3554
|
-
this._readdir(abs, inGlobStar, function(er, entries) {
|
|
3555
|
-
self._processGlobStar2(prefix, read, abs, remain, index, inGlobStar, entries, cb);
|
|
3556
|
-
});
|
|
3557
|
-
};
|
|
3558
|
-
Glob.prototype._processGlobStar2 = function(prefix, read, abs, remain, index, inGlobStar, entries, cb) {
|
|
3559
|
-
if (!entries)
|
|
3560
|
-
return cb();
|
|
3561
|
-
var remainWithoutGlobStar = remain.slice(1);
|
|
3562
|
-
var gspref = prefix ? [prefix] : [];
|
|
3563
|
-
var noGlobStar = gspref.concat(remainWithoutGlobStar);
|
|
3564
|
-
this._process(noGlobStar, index, false, cb);
|
|
3565
|
-
var isSym = this.symlinks[abs];
|
|
3566
|
-
var len = entries.length;
|
|
3567
|
-
if (isSym && inGlobStar)
|
|
3568
|
-
return cb();
|
|
3569
|
-
for (var i = 0; i < len; i++) {
|
|
3570
|
-
var e = entries[i];
|
|
3571
|
-
if (e.charAt(0) === "." && !this.dot)
|
|
3572
|
-
continue;
|
|
3573
|
-
var instead = gspref.concat(entries[i], remainWithoutGlobStar);
|
|
3574
|
-
this._process(instead, index, true, cb);
|
|
3575
|
-
var below = gspref.concat(entries[i], remain);
|
|
3576
|
-
this._process(below, index, true, cb);
|
|
575
|
+
value = { value, expires };
|
|
576
|
+
return this.opts.serialize(value);
|
|
577
|
+
}).then((value2) => store.set(keyPrefixed, value2, ttl)).then(() => true);
|
|
3577
578
|
}
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
return cb();
|
|
3591
|
-
if (prefix && isAbsolute(prefix) && !this.nomount) {
|
|
3592
|
-
var trail = /[\/\\]$/.test(prefix);
|
|
3593
|
-
if (prefix.charAt(0) === "/") {
|
|
3594
|
-
prefix = path10.join(this.root, prefix);
|
|
3595
|
-
} else {
|
|
3596
|
-
prefix = path10.resolve(this.root, prefix);
|
|
3597
|
-
if (trail)
|
|
3598
|
-
prefix += "/";
|
|
579
|
+
delete(key) {
|
|
580
|
+
const { store } = this.opts;
|
|
581
|
+
if (Array.isArray(key)) {
|
|
582
|
+
const keyPrefixed2 = this._getKeyPrefixArray(key);
|
|
583
|
+
if (store.deleteMany === void 0) {
|
|
584
|
+
const promises = [];
|
|
585
|
+
for (const key2 of keyPrefixed2) {
|
|
586
|
+
promises.push(store.delete(key2));
|
|
587
|
+
}
|
|
588
|
+
return Promise.allSettled(promises).then((values) => values.every((x) => x.value === true));
|
|
589
|
+
}
|
|
590
|
+
return Promise.resolve().then(() => store.deleteMany(keyPrefixed2));
|
|
3599
591
|
}
|
|
592
|
+
const keyPrefixed = this._getKeyPrefix(key);
|
|
593
|
+
return Promise.resolve().then(() => store.delete(keyPrefixed));
|
|
3600
594
|
}
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
cb();
|
|
3605
|
-
};
|
|
3606
|
-
Glob.prototype._stat = function(f, cb) {
|
|
3607
|
-
var abs = this._makeAbs(f);
|
|
3608
|
-
var needDir = f.slice(-1) === "/";
|
|
3609
|
-
if (f.length > this.maxLength)
|
|
3610
|
-
return cb();
|
|
3611
|
-
if (!this.stat && ownProp(this.cache, abs)) {
|
|
3612
|
-
var c = this.cache[abs];
|
|
3613
|
-
if (Array.isArray(c))
|
|
3614
|
-
c = "DIR";
|
|
3615
|
-
if (!needDir || c === "DIR")
|
|
3616
|
-
return cb(null, c);
|
|
3617
|
-
if (needDir && c === "FILE")
|
|
3618
|
-
return cb();
|
|
595
|
+
clear() {
|
|
596
|
+
const { store } = this.opts;
|
|
597
|
+
return Promise.resolve().then(() => store.clear());
|
|
3619
598
|
}
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
return cb(null, type, stat);
|
|
3631
|
-
}
|
|
599
|
+
has(key) {
|
|
600
|
+
const keyPrefixed = this._getKeyPrefix(key);
|
|
601
|
+
const { store } = this.opts;
|
|
602
|
+
return Promise.resolve().then(async () => {
|
|
603
|
+
if (typeof store.has === "function") {
|
|
604
|
+
return store.has(keyPrefixed);
|
|
605
|
+
}
|
|
606
|
+
const value = await store.get(keyPrefixed);
|
|
607
|
+
return value !== void 0;
|
|
608
|
+
});
|
|
3632
609
|
}
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
function lstatcb_(er, lstat) {
|
|
3638
|
-
if (lstat && lstat.isSymbolicLink()) {
|
|
3639
|
-
return self.fs.stat(abs, function(er2, stat2) {
|
|
3640
|
-
if (er2)
|
|
3641
|
-
self._stat2(f, abs, null, lstat, cb);
|
|
3642
|
-
else
|
|
3643
|
-
self._stat2(f, abs, er2, stat2, cb);
|
|
3644
|
-
});
|
|
3645
|
-
} else {
|
|
3646
|
-
self._stat2(f, abs, er, lstat, cb);
|
|
610
|
+
disconnect() {
|
|
611
|
+
const { store } = this.opts;
|
|
612
|
+
if (typeof store.disconnect === "function") {
|
|
613
|
+
return store.disconnect();
|
|
3647
614
|
}
|
|
3648
615
|
}
|
|
3649
616
|
};
|
|
3650
|
-
|
|
3651
|
-
if (er && (er.code === "ENOENT" || er.code === "ENOTDIR")) {
|
|
3652
|
-
this.statCache[abs] = false;
|
|
3653
|
-
return cb();
|
|
3654
|
-
}
|
|
3655
|
-
var needDir = f.slice(-1) === "/";
|
|
3656
|
-
this.statCache[abs] = stat;
|
|
3657
|
-
if (abs.slice(-1) === "/" && stat && !stat.isDirectory())
|
|
3658
|
-
return cb(null, false, stat);
|
|
3659
|
-
var c = true;
|
|
3660
|
-
if (stat)
|
|
3661
|
-
c = stat.isDirectory() ? "DIR" : "FILE";
|
|
3662
|
-
this.cache[abs] = this.cache[abs] || c;
|
|
3663
|
-
if (needDir && c === "FILE")
|
|
3664
|
-
return cb();
|
|
3665
|
-
return cb(null, c, stat);
|
|
3666
|
-
};
|
|
617
|
+
module.exports = Keyv;
|
|
3667
618
|
}
|
|
3668
619
|
});
|
|
3669
620
|
|
|
3670
|
-
// node_modules/
|
|
3671
|
-
var
|
|
3672
|
-
"node_modules/
|
|
3673
|
-
|
|
3674
|
-
var
|
|
3675
|
-
var
|
|
3676
|
-
var
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
var
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
|
|
3692
|
-
|
|
3693
|
-
|
|
3694
|
-
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
m = m + "Sync";
|
|
3699
|
-
options[m] = options[m] || fs6[m];
|
|
3700
|
-
});
|
|
3701
|
-
options.maxBusyTries = options.maxBusyTries || 3;
|
|
3702
|
-
options.emfileWait = options.emfileWait || 1e3;
|
|
3703
|
-
if (options.glob === false) {
|
|
3704
|
-
options.disableGlob = true;
|
|
3705
|
-
}
|
|
3706
|
-
if (options.disableGlob !== true && glob === void 0) {
|
|
3707
|
-
throw Error("glob dependency not found, set `options.disableGlob = true` if intentional");
|
|
3708
|
-
}
|
|
3709
|
-
options.disableGlob = options.disableGlob || false;
|
|
3710
|
-
options.glob = options.glob || defaultGlobOpts;
|
|
3711
|
-
};
|
|
3712
|
-
var rimraf = (p, options, cb) => {
|
|
3713
|
-
if (typeof options === "function") {
|
|
3714
|
-
cb = options;
|
|
3715
|
-
options = {};
|
|
3716
|
-
}
|
|
3717
|
-
assert(p, "rimraf: missing path");
|
|
3718
|
-
assert.equal(typeof p, "string", "rimraf: path should be a string");
|
|
3719
|
-
assert.equal(typeof cb, "function", "rimraf: callback function required");
|
|
3720
|
-
assert(options, "rimraf: invalid options argument provided");
|
|
3721
|
-
assert.equal(typeof options, "object", "rimraf: options should be object");
|
|
3722
|
-
defaults(options);
|
|
3723
|
-
let busyTries = 0;
|
|
3724
|
-
let errState = null;
|
|
3725
|
-
let n = 0;
|
|
3726
|
-
const next = (er) => {
|
|
3727
|
-
errState = errState || er;
|
|
3728
|
-
if (--n === 0)
|
|
3729
|
-
cb(errState);
|
|
3730
|
-
};
|
|
3731
|
-
const afterGlob = (er, results) => {
|
|
3732
|
-
if (er)
|
|
3733
|
-
return cb(er);
|
|
3734
|
-
n = results.length;
|
|
3735
|
-
if (n === 0)
|
|
3736
|
-
return cb();
|
|
3737
|
-
results.forEach((p2) => {
|
|
3738
|
-
const CB = (er2) => {
|
|
3739
|
-
if (er2) {
|
|
3740
|
-
if ((er2.code === "EBUSY" || er2.code === "ENOTEMPTY" || er2.code === "EPERM") && busyTries < options.maxBusyTries) {
|
|
3741
|
-
busyTries++;
|
|
3742
|
-
return setTimeout(() => rimraf_(p2, options, CB), busyTries * 100);
|
|
3743
|
-
}
|
|
3744
|
-
if (er2.code === "EMFILE" && timeout < options.emfileWait) {
|
|
3745
|
-
return setTimeout(() => rimraf_(p2, options, CB), timeout++);
|
|
3746
|
-
}
|
|
3747
|
-
if (er2.code === "ENOENT")
|
|
3748
|
-
er2 = null;
|
|
3749
|
-
}
|
|
3750
|
-
timeout = 0;
|
|
3751
|
-
next(er2);
|
|
3752
|
-
};
|
|
3753
|
-
rimraf_(p2, options, CB);
|
|
3754
|
-
});
|
|
3755
|
-
};
|
|
3756
|
-
if (options.disableGlob || !glob.hasMagic(p))
|
|
3757
|
-
return afterGlob(null, [p]);
|
|
3758
|
-
options.lstat(p, (er, stat) => {
|
|
3759
|
-
if (!er)
|
|
3760
|
-
return afterGlob(null, [p]);
|
|
3761
|
-
glob(p, options.glob, afterGlob);
|
|
3762
|
-
});
|
|
3763
|
-
};
|
|
3764
|
-
var rimraf_ = (p, options, cb) => {
|
|
3765
|
-
assert(p);
|
|
3766
|
-
assert(options);
|
|
3767
|
-
assert(typeof cb === "function");
|
|
3768
|
-
options.lstat(p, (er, st) => {
|
|
3769
|
-
if (er && er.code === "ENOENT")
|
|
3770
|
-
return cb(null);
|
|
3771
|
-
if (er && er.code === "EPERM" && isWindows)
|
|
3772
|
-
fixWinEPERM(p, options, er, cb);
|
|
3773
|
-
if (st && st.isDirectory())
|
|
3774
|
-
return rmdir(p, options, er, cb);
|
|
3775
|
-
options.unlink(p, (er2) => {
|
|
3776
|
-
if (er2) {
|
|
3777
|
-
if (er2.code === "ENOENT")
|
|
3778
|
-
return cb(null);
|
|
3779
|
-
if (er2.code === "EPERM")
|
|
3780
|
-
return isWindows ? fixWinEPERM(p, options, er2, cb) : rmdir(p, options, er2, cb);
|
|
3781
|
-
if (er2.code === "EISDIR")
|
|
3782
|
-
return rmdir(p, options, er2, cb);
|
|
3783
|
-
}
|
|
3784
|
-
return cb(er2);
|
|
3785
|
-
});
|
|
3786
|
-
});
|
|
3787
|
-
};
|
|
3788
|
-
var fixWinEPERM = (p, options, er, cb) => {
|
|
3789
|
-
assert(p);
|
|
3790
|
-
assert(options);
|
|
3791
|
-
assert(typeof cb === "function");
|
|
3792
|
-
options.chmod(p, 438, (er2) => {
|
|
3793
|
-
if (er2)
|
|
3794
|
-
cb(er2.code === "ENOENT" ? null : er);
|
|
3795
|
-
else
|
|
3796
|
-
options.stat(p, (er3, stats) => {
|
|
3797
|
-
if (er3)
|
|
3798
|
-
cb(er3.code === "ENOENT" ? null : er);
|
|
3799
|
-
else if (stats.isDirectory())
|
|
3800
|
-
rmdir(p, options, er, cb);
|
|
3801
|
-
else
|
|
3802
|
-
options.unlink(p, cb);
|
|
3803
|
-
});
|
|
3804
|
-
});
|
|
3805
|
-
};
|
|
3806
|
-
var fixWinEPERMSync = (p, options, er) => {
|
|
3807
|
-
assert(p);
|
|
3808
|
-
assert(options);
|
|
3809
|
-
try {
|
|
3810
|
-
options.chmodSync(p, 438);
|
|
3811
|
-
} catch (er2) {
|
|
3812
|
-
if (er2.code === "ENOENT")
|
|
3813
|
-
return;
|
|
3814
|
-
else
|
|
3815
|
-
throw er;
|
|
621
|
+
// node_modules/flatted/cjs/index.js
|
|
622
|
+
var require_cjs = __commonJS({
|
|
623
|
+
"node_modules/flatted/cjs/index.js"(exports) {
|
|
624
|
+
"use strict";
|
|
625
|
+
var { parse: $parse, stringify: $stringify } = JSON;
|
|
626
|
+
var { keys } = Object;
|
|
627
|
+
var Primitive = String;
|
|
628
|
+
var primitive = "string";
|
|
629
|
+
var ignore = {};
|
|
630
|
+
var object = "object";
|
|
631
|
+
var noop = (_, value) => value;
|
|
632
|
+
var primitives = (value) => value instanceof Primitive ? Primitive(value) : value;
|
|
633
|
+
var Primitives = (_, value) => typeof value === primitive ? new Primitive(value) : value;
|
|
634
|
+
var revive = (input, parsed, output, $) => {
|
|
635
|
+
const lazy = [];
|
|
636
|
+
for (let ke = keys(output), { length } = ke, y = 0; y < length; y++) {
|
|
637
|
+
const k = ke[y];
|
|
638
|
+
const value = output[k];
|
|
639
|
+
if (value instanceof Primitive) {
|
|
640
|
+
const tmp = input[value];
|
|
641
|
+
if (typeof tmp === object && !parsed.has(tmp)) {
|
|
642
|
+
parsed.add(tmp);
|
|
643
|
+
output[k] = ignore;
|
|
644
|
+
lazy.push({ k, a: [input, parsed, tmp, $] });
|
|
645
|
+
} else
|
|
646
|
+
output[k] = $.call(output, k, tmp);
|
|
647
|
+
} else if (output[k] !== ignore)
|
|
648
|
+
output[k] = $.call(output, k, value);
|
|
3816
649
|
}
|
|
3817
|
-
let
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
} catch (er3) {
|
|
3821
|
-
if (er3.code === "ENOENT")
|
|
3822
|
-
return;
|
|
3823
|
-
else
|
|
3824
|
-
throw er;
|
|
650
|
+
for (let { length } = lazy, i = 0; i < length; i++) {
|
|
651
|
+
const { k, a } = lazy[i];
|
|
652
|
+
output[k] = $.call(output, k, revive.apply(null, a));
|
|
3825
653
|
}
|
|
3826
|
-
|
|
3827
|
-
rmdirSync(p, options, er);
|
|
3828
|
-
else
|
|
3829
|
-
options.unlinkSync(p);
|
|
654
|
+
return output;
|
|
3830
655
|
};
|
|
3831
|
-
var
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
options.rmdir(p, (er) => {
|
|
3836
|
-
if (er && (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM"))
|
|
3837
|
-
rmkids(p, options, cb);
|
|
3838
|
-
else if (er && er.code === "ENOTDIR")
|
|
3839
|
-
cb(originalEr);
|
|
3840
|
-
else
|
|
3841
|
-
cb(er);
|
|
3842
|
-
});
|
|
656
|
+
var set = (known, input, value) => {
|
|
657
|
+
const index = Primitive(input.push(value) - 1);
|
|
658
|
+
known.set(value, index);
|
|
659
|
+
return index;
|
|
3843
660
|
};
|
|
3844
|
-
var
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
return cb(er);
|
|
3851
|
-
let n = files.length;
|
|
3852
|
-
if (n === 0)
|
|
3853
|
-
return options.rmdir(p, cb);
|
|
3854
|
-
let errState;
|
|
3855
|
-
files.forEach((f) => {
|
|
3856
|
-
rimraf(path10.join(p, f), options, (er2) => {
|
|
3857
|
-
if (errState)
|
|
3858
|
-
return;
|
|
3859
|
-
if (er2)
|
|
3860
|
-
return cb(errState = er2);
|
|
3861
|
-
if (--n === 0)
|
|
3862
|
-
options.rmdir(p, cb);
|
|
3863
|
-
});
|
|
3864
|
-
});
|
|
3865
|
-
});
|
|
661
|
+
var parse = (text, reviver) => {
|
|
662
|
+
const input = $parse(text, Primitives).map(primitives);
|
|
663
|
+
const value = input[0];
|
|
664
|
+
const $ = reviver || noop;
|
|
665
|
+
const tmp = typeof value === object && value ? revive(input, /* @__PURE__ */ new Set(), value, $) : value;
|
|
666
|
+
return $.call({ "": tmp }, "", tmp);
|
|
3866
667
|
};
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
let
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
try {
|
|
3879
|
-
options.lstatSync(p);
|
|
3880
|
-
results = [p];
|
|
3881
|
-
} catch (er) {
|
|
3882
|
-
results = glob.sync(p, options.glob);
|
|
3883
|
-
}
|
|
668
|
+
exports.parse = parse;
|
|
669
|
+
var stringify4 = (value, replacer, space) => {
|
|
670
|
+
const $ = replacer && typeof replacer === object ? (k, v) => k === "" || -1 < replacer.indexOf(k) ? v : void 0 : replacer || noop;
|
|
671
|
+
const known = /* @__PURE__ */ new Map();
|
|
672
|
+
const input = [];
|
|
673
|
+
const output = [];
|
|
674
|
+
let i = +set(known, input, $.call({ "": value }, "", value));
|
|
675
|
+
let firstRun = !i;
|
|
676
|
+
while (i < input.length) {
|
|
677
|
+
firstRun = true;
|
|
678
|
+
output[i] = $stringify(input[i++], replace, space);
|
|
3884
679
|
}
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
try {
|
|
3891
|
-
st = options.lstatSync(p2);
|
|
3892
|
-
} catch (er) {
|
|
3893
|
-
if (er.code === "ENOENT")
|
|
3894
|
-
return;
|
|
3895
|
-
if (er.code === "EPERM" && isWindows)
|
|
3896
|
-
fixWinEPERMSync(p2, options, er);
|
|
680
|
+
return "[" + output.join(",") + "]";
|
|
681
|
+
function replace(key, value2) {
|
|
682
|
+
if (firstRun) {
|
|
683
|
+
firstRun = !firstRun;
|
|
684
|
+
return value2;
|
|
3897
685
|
}
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
if (er.code === "ENOENT")
|
|
3905
|
-
return;
|
|
3906
|
-
if (er.code === "EPERM")
|
|
3907
|
-
return isWindows ? fixWinEPERMSync(p2, options, er) : rmdirSync(p2, options, er);
|
|
3908
|
-
if (er.code !== "EISDIR")
|
|
3909
|
-
throw er;
|
|
3910
|
-
rmdirSync(p2, options, er);
|
|
686
|
+
const after = $.call(this, key, value2);
|
|
687
|
+
switch (typeof after) {
|
|
688
|
+
case object:
|
|
689
|
+
if (after === null) return after;
|
|
690
|
+
case primitive:
|
|
691
|
+
return known.get(after) || set(known, input, after);
|
|
3911
692
|
}
|
|
693
|
+
return after;
|
|
3912
694
|
}
|
|
3913
695
|
};
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
696
|
+
exports.stringify = stringify4;
|
|
697
|
+
var toJSON = (value) => $parse(stringify4(value));
|
|
698
|
+
exports.toJSON = toJSON;
|
|
699
|
+
var fromJSON = (value) => parse($stringify(value));
|
|
700
|
+
exports.fromJSON = fromJSON;
|
|
701
|
+
}
|
|
702
|
+
});
|
|
703
|
+
|
|
704
|
+
// node_modules/file-entry-cache/node_modules/flat-cache/src/utils.js
|
|
705
|
+
var require_utils = __commonJS({
|
|
706
|
+
"node_modules/file-entry-cache/node_modules/flat-cache/src/utils.js"(exports, module) {
|
|
707
|
+
var fs6 = __require("fs");
|
|
708
|
+
var path10 = __require("path");
|
|
709
|
+
var flatted = require_cjs();
|
|
710
|
+
function tryParse(filePath, defaultValue) {
|
|
711
|
+
let result;
|
|
3917
712
|
try {
|
|
3918
|
-
|
|
3919
|
-
} catch
|
|
3920
|
-
|
|
3921
|
-
return;
|
|
3922
|
-
if (er.code === "ENOTDIR")
|
|
3923
|
-
throw originalEr;
|
|
3924
|
-
if (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM")
|
|
3925
|
-
rmkidsSync(p, options);
|
|
713
|
+
result = readJSON(filePath);
|
|
714
|
+
} catch {
|
|
715
|
+
result = defaultValue;
|
|
3926
716
|
}
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
|
|
3942
|
-
|
|
3943
|
-
}
|
|
3944
|
-
} while (true);
|
|
3945
|
-
};
|
|
3946
|
-
module.exports = rimraf;
|
|
3947
|
-
rimraf.sync = rimrafSync;
|
|
717
|
+
return result;
|
|
718
|
+
}
|
|
719
|
+
function readJSON(filePath) {
|
|
720
|
+
return flatted.parse(
|
|
721
|
+
fs6.readFileSync(filePath, {
|
|
722
|
+
encoding: "utf8"
|
|
723
|
+
})
|
|
724
|
+
);
|
|
725
|
+
}
|
|
726
|
+
function writeJSON(filePath, data) {
|
|
727
|
+
fs6.mkdirSync(path10.dirname(filePath), {
|
|
728
|
+
recursive: true
|
|
729
|
+
});
|
|
730
|
+
fs6.writeFileSync(filePath, flatted.stringify(data));
|
|
731
|
+
}
|
|
732
|
+
module.exports = { tryParse, readJSON, writeJSON };
|
|
3948
733
|
}
|
|
3949
734
|
});
|
|
3950
735
|
|
|
3951
|
-
// node_modules/flat-cache/src/del.js
|
|
736
|
+
// node_modules/file-entry-cache/node_modules/flat-cache/src/del.js
|
|
3952
737
|
var require_del = __commonJS({
|
|
3953
|
-
"node_modules/flat-cache/src/del.js"(exports, module) {
|
|
3954
|
-
var rimraf = require_rimraf().sync;
|
|
738
|
+
"node_modules/file-entry-cache/node_modules/flat-cache/src/del.js"(exports, module) {
|
|
3955
739
|
var fs6 = __require("fs");
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
740
|
+
var path10 = __require("path");
|
|
741
|
+
function del(targetPath) {
|
|
742
|
+
if (!fs6.existsSync(targetPath)) {
|
|
743
|
+
return false;
|
|
744
|
+
}
|
|
745
|
+
try {
|
|
746
|
+
if (fs6.statSync(targetPath).isDirectory()) {
|
|
747
|
+
for (const file of fs6.readdirSync(targetPath)) {
|
|
748
|
+
const currentPath = path10.join(targetPath, file);
|
|
749
|
+
if (fs6.statSync(currentPath).isFile()) {
|
|
750
|
+
fs6.unlinkSync(currentPath);
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
fs6.rmdirSync(targetPath);
|
|
754
|
+
} else {
|
|
755
|
+
fs6.unlinkSync(targetPath);
|
|
756
|
+
}
|
|
3961
757
|
return true;
|
|
758
|
+
} catch (error) {
|
|
759
|
+
console.error(`Error while deleting ${targetPath}: ${error.message}`);
|
|
3962
760
|
}
|
|
3963
|
-
|
|
3964
|
-
};
|
|
761
|
+
}
|
|
762
|
+
module.exports = { del };
|
|
3965
763
|
}
|
|
3966
764
|
});
|
|
3967
765
|
|
|
3968
|
-
// node_modules/flat-cache/src/cache.js
|
|
766
|
+
// node_modules/file-entry-cache/node_modules/flat-cache/src/cache.js
|
|
3969
767
|
var require_cache = __commonJS({
|
|
3970
|
-
"node_modules/flat-cache/src/cache.js"(exports, module) {
|
|
768
|
+
"node_modules/file-entry-cache/node_modules/flat-cache/src/cache.js"(exports, module) {
|
|
3971
769
|
var path10 = __require("path");
|
|
3972
770
|
var fs6 = __require("fs");
|
|
3973
771
|
var Keyv = require_src();
|
|
3974
|
-
var
|
|
3975
|
-
var del = require_del();
|
|
3976
|
-
var writeJSON = utils.writeJSON;
|
|
772
|
+
var { writeJSON, tryParse } = require_utils();
|
|
773
|
+
var { del } = require_del();
|
|
3977
774
|
var cache = {
|
|
3978
775
|
/**
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
load
|
|
3988
|
-
|
|
776
|
+
* Load a cache identified by the given Id. If the element does not exists, then initialize an empty
|
|
777
|
+
* cache storage. If specified `cacheDir` will be used as the directory to persist the data to. If omitted
|
|
778
|
+
* then the cache module directory `./cache` will be used instead
|
|
779
|
+
*
|
|
780
|
+
* @method load
|
|
781
|
+
* @param docId {String} the id of the cache, would also be used as the name of the file cache
|
|
782
|
+
* @param [cacheDir] {String} directory for the cache entry
|
|
783
|
+
*/
|
|
784
|
+
load(documentId, cacheDir) {
|
|
785
|
+
const me = this;
|
|
3989
786
|
me.keyv = new Keyv();
|
|
3990
787
|
me.__visited = {};
|
|
3991
788
|
me.__persisted = {};
|
|
3992
|
-
me._pathToFile = cacheDir ? path10.resolve(cacheDir,
|
|
789
|
+
me._pathToFile = cacheDir ? path10.resolve(cacheDir, documentId) : path10.resolve(__dirname, "../.cache/", documentId);
|
|
3993
790
|
if (fs6.existsSync(me._pathToFile)) {
|
|
3994
|
-
me._persisted =
|
|
791
|
+
me._persisted = tryParse(me._pathToFile, {});
|
|
3995
792
|
}
|
|
3996
793
|
},
|
|
3997
794
|
get _persisted() {
|
|
@@ -3999,110 +796,108 @@ var require_cache = __commonJS({
|
|
|
3999
796
|
},
|
|
4000
797
|
set _persisted(value) {
|
|
4001
798
|
this.__persisted = value;
|
|
4002
|
-
this.keyv.set("persisted", value);
|
|
4003
799
|
},
|
|
4004
800
|
get _visited() {
|
|
4005
801
|
return this.__visited;
|
|
4006
802
|
},
|
|
4007
803
|
set _visited(value) {
|
|
4008
804
|
this.__visited = value;
|
|
4009
|
-
this.keyv.set("visited", value);
|
|
4010
805
|
},
|
|
4011
806
|
/**
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
loadFile
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
807
|
+
* Load the cache from the provided file
|
|
808
|
+
* @method loadFile
|
|
809
|
+
* @param {String} pathToFile the path to the file containing the info for the cache
|
|
810
|
+
*/
|
|
811
|
+
loadFile(pathToFile) {
|
|
812
|
+
const me = this;
|
|
813
|
+
const dir = path10.dirname(pathToFile);
|
|
814
|
+
const fName = path10.basename(pathToFile);
|
|
4020
815
|
me.load(fName, dir);
|
|
4021
816
|
},
|
|
4022
817
|
/**
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
all
|
|
818
|
+
* Returns the entire persisted object
|
|
819
|
+
* @method all
|
|
820
|
+
* @returns {*}
|
|
821
|
+
*/
|
|
822
|
+
all() {
|
|
4028
823
|
return this._persisted;
|
|
4029
824
|
},
|
|
4030
|
-
keys
|
|
825
|
+
keys() {
|
|
4031
826
|
return Object.keys(this._persisted);
|
|
4032
827
|
},
|
|
4033
828
|
/**
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
setKey
|
|
829
|
+
* Sets a key to a given value
|
|
830
|
+
* @method setKey
|
|
831
|
+
* @param key {string} the key to set
|
|
832
|
+
* @param value {object} the value of the key. Could be any object that can be serialized with JSON.stringify
|
|
833
|
+
*/
|
|
834
|
+
setKey(key, value) {
|
|
4040
835
|
this._visited[key] = true;
|
|
4041
836
|
this._persisted[key] = value;
|
|
4042
837
|
},
|
|
4043
838
|
/**
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
removeKey
|
|
839
|
+
* Remove a given key from the cache
|
|
840
|
+
* @method removeKey
|
|
841
|
+
* @param key {String} the key to remove from the object
|
|
842
|
+
*/
|
|
843
|
+
removeKey(key) {
|
|
4049
844
|
delete this._visited[key];
|
|
4050
845
|
delete this._persisted[key];
|
|
4051
846
|
},
|
|
4052
847
|
/**
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
getKey
|
|
848
|
+
* Return the value of the provided key
|
|
849
|
+
* @method getKey
|
|
850
|
+
* @param key {String} the name of the key to retrieve
|
|
851
|
+
* @returns {*} the value from the key
|
|
852
|
+
*/
|
|
853
|
+
getKey(key) {
|
|
4059
854
|
this._visited[key] = true;
|
|
4060
855
|
return this._persisted[key];
|
|
4061
856
|
},
|
|
4062
857
|
/**
|
|
4063
|
-
|
|
4064
|
-
|
|
4065
|
-
|
|
4066
|
-
|
|
4067
|
-
|
|
4068
|
-
_prune
|
|
4069
|
-
|
|
4070
|
-
|
|
4071
|
-
|
|
858
|
+
* Remove keys that were not accessed/set since the
|
|
859
|
+
* last time the `prune` method was called.
|
|
860
|
+
* @method _prune
|
|
861
|
+
* @private
|
|
862
|
+
*/
|
|
863
|
+
_prune() {
|
|
864
|
+
const me = this;
|
|
865
|
+
const object = {};
|
|
866
|
+
const keys = Object.keys(me._visited);
|
|
4072
867
|
if (keys.length === 0) {
|
|
4073
868
|
return;
|
|
4074
869
|
}
|
|
4075
|
-
|
|
4076
|
-
|
|
4077
|
-
}
|
|
870
|
+
for (const key of keys) {
|
|
871
|
+
object[key] = me._persisted[key];
|
|
872
|
+
}
|
|
4078
873
|
me._visited = {};
|
|
4079
|
-
me._persisted =
|
|
874
|
+
me._persisted = object;
|
|
4080
875
|
},
|
|
4081
876
|
/**
|
|
4082
|
-
|
|
4083
|
-
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
save
|
|
4088
|
-
|
|
877
|
+
* Save the state of the cache identified by the docId to disk
|
|
878
|
+
* as a JSON structure
|
|
879
|
+
* @param [noPrune=false] {Boolean} whether to remove from cache the non visited files
|
|
880
|
+
* @method save
|
|
881
|
+
*/
|
|
882
|
+
save(noPrune) {
|
|
883
|
+
const me = this;
|
|
4089
884
|
!noPrune && me._prune();
|
|
4090
885
|
writeJSON(me._pathToFile, me._persisted);
|
|
4091
886
|
},
|
|
4092
887
|
/**
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
removeCacheFile
|
|
888
|
+
* Remove the file where the cache is persisted
|
|
889
|
+
* @method removeCacheFile
|
|
890
|
+
* @return {Boolean} true or false if the file was successfully deleted
|
|
891
|
+
*/
|
|
892
|
+
removeCacheFile() {
|
|
4098
893
|
return del(this._pathToFile);
|
|
4099
894
|
},
|
|
4100
895
|
/**
|
|
4101
|
-
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
destroy
|
|
4105
|
-
|
|
896
|
+
* Destroy the file cache and cache content.
|
|
897
|
+
* @method destroy
|
|
898
|
+
*/
|
|
899
|
+
destroy() {
|
|
900
|
+
const me = this;
|
|
4106
901
|
me._visited = {};
|
|
4107
902
|
me._persisted = {};
|
|
4108
903
|
me.removeCacheFile();
|
|
@@ -4110,54 +905,54 @@ var require_cache = __commonJS({
|
|
|
4110
905
|
};
|
|
4111
906
|
module.exports = {
|
|
4112
907
|
/**
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
load
|
|
4121
|
-
return this.create(
|
|
908
|
+
* Alias for create. Should be considered depreacted. Will be removed in next releases
|
|
909
|
+
*
|
|
910
|
+
* @method load
|
|
911
|
+
* @param docId {String} the id of the cache, would also be used as the name of the file cache
|
|
912
|
+
* @param [cacheDir] {String} directory for the cache entry
|
|
913
|
+
* @returns {cache} cache instance
|
|
914
|
+
*/
|
|
915
|
+
load(documentId, cacheDir) {
|
|
916
|
+
return this.create(documentId, cacheDir);
|
|
4122
917
|
},
|
|
4123
918
|
/**
|
|
4124
|
-
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
create
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
return
|
|
919
|
+
* Load a cache identified by the given Id. If the element does not exists, then initialize an empty
|
|
920
|
+
* cache storage.
|
|
921
|
+
*
|
|
922
|
+
* @method create
|
|
923
|
+
* @param docId {String} the id of the cache, would also be used as the name of the file cache
|
|
924
|
+
* @param [cacheDir] {String} directory for the cache entry
|
|
925
|
+
* @returns {cache} cache instance
|
|
926
|
+
*/
|
|
927
|
+
create(documentId, cacheDir) {
|
|
928
|
+
const object = Object.create(cache);
|
|
929
|
+
object.load(documentId, cacheDir);
|
|
930
|
+
return object;
|
|
4136
931
|
},
|
|
4137
|
-
createFromFile
|
|
4138
|
-
|
|
4139
|
-
|
|
4140
|
-
return
|
|
932
|
+
createFromFile(filePath) {
|
|
933
|
+
const object = Object.create(cache);
|
|
934
|
+
object.loadFile(filePath);
|
|
935
|
+
return object;
|
|
4141
936
|
},
|
|
4142
937
|
/**
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
clearCacheById
|
|
4151
|
-
|
|
938
|
+
* Clear the cache identified by the given id. Caches stored in a different cache directory can be deleted directly
|
|
939
|
+
*
|
|
940
|
+
* @method clearCache
|
|
941
|
+
* @param docId {String} the id of the cache, would also be used as the name of the file cache
|
|
942
|
+
* @param cacheDir {String} the directory where the cache file was written
|
|
943
|
+
* @returns {Boolean} true if the cache folder was deleted. False otherwise
|
|
944
|
+
*/
|
|
945
|
+
clearCacheById(documentId, cacheDir) {
|
|
946
|
+
const filePath = cacheDir ? path10.resolve(cacheDir, documentId) : path10.resolve(__dirname, "../.cache/", documentId);
|
|
4152
947
|
return del(filePath);
|
|
4153
948
|
},
|
|
4154
949
|
/**
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
clearAll
|
|
4160
|
-
|
|
950
|
+
* Remove all cache stored in the cache directory
|
|
951
|
+
* @method clearAll
|
|
952
|
+
* @returns {Boolean} true if the cache folder was deleted. False otherwise
|
|
953
|
+
*/
|
|
954
|
+
clearAll(cacheDir) {
|
|
955
|
+
const filePath = cacheDir ? path10.resolve(cacheDir) : path10.resolve(__dirname, "../.cache/");
|
|
4161
956
|
return del(filePath);
|
|
4162
957
|
}
|
|
4163
958
|
};
|
|
@@ -4168,135 +963,139 @@ var require_cache = __commonJS({
|
|
|
4168
963
|
var require_cache2 = __commonJS({
|
|
4169
964
|
"node_modules/file-entry-cache/cache.js"(exports, module) {
|
|
4170
965
|
var path10 = __require("path");
|
|
966
|
+
var process5 = __require("process");
|
|
4171
967
|
var crypto = __require("crypto");
|
|
4172
968
|
module.exports = {
|
|
4173
|
-
createFromFile
|
|
4174
|
-
|
|
4175
|
-
|
|
969
|
+
createFromFile(filePath, useChecksum) {
|
|
970
|
+
const fname = path10.basename(filePath);
|
|
971
|
+
const dir = path10.dirname(filePath);
|
|
4176
972
|
return this.create(fname, dir, useChecksum);
|
|
4177
973
|
},
|
|
4178
|
-
create
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
974
|
+
create(cacheId, _path, useChecksum) {
|
|
975
|
+
const fs6 = __require("fs");
|
|
976
|
+
const flatCache = require_cache();
|
|
977
|
+
const cache = flatCache.load(cacheId, _path);
|
|
978
|
+
let normalizedEntries = {};
|
|
979
|
+
const removeNotFoundFiles = function removeNotFoundFiles2() {
|
|
4184
980
|
const cachedEntries = cache.keys();
|
|
4185
|
-
|
|
981
|
+
for (const fPath of cachedEntries) {
|
|
4186
982
|
try {
|
|
4187
983
|
fs6.statSync(fPath);
|
|
4188
|
-
} catch (
|
|
4189
|
-
if (
|
|
984
|
+
} catch (error) {
|
|
985
|
+
if (error.code === "ENOENT") {
|
|
4190
986
|
cache.removeKey(fPath);
|
|
4191
987
|
}
|
|
4192
988
|
}
|
|
4193
|
-
}
|
|
989
|
+
}
|
|
4194
990
|
};
|
|
4195
991
|
removeNotFoundFiles();
|
|
4196
992
|
return {
|
|
4197
993
|
/**
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
994
|
+
* The flat cache storage used to persist the metadata of the `files
|
|
995
|
+
* @type {Object}
|
|
996
|
+
*/
|
|
4201
997
|
cache,
|
|
4202
998
|
/**
|
|
4203
|
-
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
getHash
|
|
999
|
+
* Given a buffer, calculate md5 hash of its content.
|
|
1000
|
+
* @method getHash
|
|
1001
|
+
* @param {Buffer} buffer buffer to calculate hash on
|
|
1002
|
+
* @return {String} content hash digest
|
|
1003
|
+
*/
|
|
1004
|
+
getHash(buffer) {
|
|
4209
1005
|
return crypto.createHash("md5").update(buffer).digest("hex");
|
|
4210
1006
|
},
|
|
4211
1007
|
/**
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
|
|
4216
|
-
|
|
4217
|
-
hasFileChanged
|
|
1008
|
+
* Return whether or not a file has changed since last time reconcile was called.
|
|
1009
|
+
* @method hasFileChanged
|
|
1010
|
+
* @param {String} file the filepath to check
|
|
1011
|
+
* @return {Boolean} wheter or not the file has changed
|
|
1012
|
+
*/
|
|
1013
|
+
hasFileChanged(file) {
|
|
4218
1014
|
return this.getFileDescriptor(file).changed;
|
|
4219
1015
|
},
|
|
4220
1016
|
/**
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
analyzeFiles
|
|
4230
|
-
|
|
4231
|
-
files
|
|
4232
|
-
|
|
1017
|
+
* Given an array of file paths it return and object with three arrays:
|
|
1018
|
+
* - changedFiles: Files that changed since previous run
|
|
1019
|
+
* - notChangedFiles: Files that haven't change
|
|
1020
|
+
* - notFoundFiles: Files that were not found, probably deleted
|
|
1021
|
+
*
|
|
1022
|
+
* @param {Array} files the files to analyze and compare to the previous seen files
|
|
1023
|
+
* @return {[type]} [description]
|
|
1024
|
+
*/
|
|
1025
|
+
analyzeFiles(files) {
|
|
1026
|
+
const me = this;
|
|
1027
|
+
files || (files = []);
|
|
1028
|
+
const res = {
|
|
4233
1029
|
changedFiles: [],
|
|
4234
1030
|
notFoundFiles: [],
|
|
4235
1031
|
notChangedFiles: []
|
|
4236
1032
|
};
|
|
4237
|
-
me.normalizeEntries(files)
|
|
1033
|
+
for (const entry of me.normalizeEntries(files)) {
|
|
4238
1034
|
if (entry.changed) {
|
|
4239
1035
|
res.changedFiles.push(entry.key);
|
|
4240
|
-
|
|
1036
|
+
continue;
|
|
4241
1037
|
}
|
|
4242
1038
|
if (entry.notFound) {
|
|
4243
1039
|
res.notFoundFiles.push(entry.key);
|
|
4244
|
-
|
|
1040
|
+
continue;
|
|
4245
1041
|
}
|
|
4246
1042
|
res.notChangedFiles.push(entry.key);
|
|
4247
|
-
}
|
|
1043
|
+
}
|
|
4248
1044
|
return res;
|
|
4249
1045
|
},
|
|
4250
|
-
getFileDescriptor
|
|
4251
|
-
|
|
1046
|
+
getFileDescriptor(file) {
|
|
1047
|
+
let fstat;
|
|
4252
1048
|
try {
|
|
1049
|
+
if (!path10.isAbsolute(file)) {
|
|
1050
|
+
file = path10.resolve(process5.cwd(), file);
|
|
1051
|
+
}
|
|
4253
1052
|
fstat = fs6.statSync(file);
|
|
4254
|
-
} catch (
|
|
1053
|
+
} catch (error) {
|
|
4255
1054
|
this.removeEntry(file);
|
|
4256
|
-
return { key: file, notFound: true, err:
|
|
1055
|
+
return { key: file, notFound: true, err: error };
|
|
4257
1056
|
}
|
|
4258
1057
|
if (useChecksum) {
|
|
4259
1058
|
return this._getFileDescriptorUsingChecksum(file);
|
|
4260
1059
|
}
|
|
4261
1060
|
return this._getFileDescriptorUsingMtimeAndSize(file, fstat);
|
|
4262
1061
|
},
|
|
4263
|
-
_getFileDescriptorUsingMtimeAndSize
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
if (
|
|
4271
|
-
meta = { size: cSize, mtime: cTime };
|
|
4272
|
-
} else {
|
|
1062
|
+
_getFileDescriptorUsingMtimeAndSize(file, fstat) {
|
|
1063
|
+
let meta = cache.getKey(file);
|
|
1064
|
+
const cacheExists = Boolean(meta);
|
|
1065
|
+
const cSize = fstat.size;
|
|
1066
|
+
const cTime = fstat.mtime.getTime();
|
|
1067
|
+
let isDifferentDate;
|
|
1068
|
+
let isDifferentSize;
|
|
1069
|
+
if (meta) {
|
|
4273
1070
|
isDifferentDate = cTime !== meta.mtime;
|
|
4274
1071
|
isDifferentSize = cSize !== meta.size;
|
|
1072
|
+
} else {
|
|
1073
|
+
meta = { size: cSize, mtime: cTime };
|
|
4275
1074
|
}
|
|
4276
|
-
|
|
1075
|
+
const nEntry = normalizedEntries[file] = {
|
|
4277
1076
|
key: file,
|
|
4278
1077
|
changed: !cacheExists || isDifferentDate || isDifferentSize,
|
|
4279
1078
|
meta
|
|
4280
1079
|
};
|
|
4281
1080
|
return nEntry;
|
|
4282
1081
|
},
|
|
4283
|
-
_getFileDescriptorUsingChecksum
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
|
|
1082
|
+
_getFileDescriptorUsingChecksum(file) {
|
|
1083
|
+
let meta = cache.getKey(file);
|
|
1084
|
+
const cacheExists = Boolean(meta);
|
|
1085
|
+
let contentBuffer;
|
|
4287
1086
|
try {
|
|
4288
1087
|
contentBuffer = fs6.readFileSync(file);
|
|
4289
|
-
} catch
|
|
1088
|
+
} catch {
|
|
4290
1089
|
contentBuffer = "";
|
|
4291
1090
|
}
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
if (
|
|
4295
|
-
meta = { hash };
|
|
4296
|
-
} else {
|
|
1091
|
+
let isDifferent = true;
|
|
1092
|
+
const hash = this.getHash(contentBuffer);
|
|
1093
|
+
if (meta) {
|
|
4297
1094
|
isDifferent = hash !== meta.hash;
|
|
1095
|
+
} else {
|
|
1096
|
+
meta = { hash };
|
|
4298
1097
|
}
|
|
4299
|
-
|
|
1098
|
+
const nEntry = normalizedEntries[file] = {
|
|
4300
1099
|
key: file,
|
|
4301
1100
|
changed: !cacheExists || isDifferent,
|
|
4302
1101
|
meta
|
|
@@ -4304,72 +1103,69 @@ var require_cache2 = __commonJS({
|
|
|
4304
1103
|
return nEntry;
|
|
4305
1104
|
},
|
|
4306
1105
|
/**
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
getUpdatedFiles
|
|
4315
|
-
|
|
4316
|
-
files
|
|
4317
|
-
return me.normalizeEntries(files).filter(
|
|
4318
|
-
return entry.changed;
|
|
4319
|
-
}).map(function(entry) {
|
|
4320
|
-
return entry.key;
|
|
4321
|
-
});
|
|
1106
|
+
* Return the list o the files that changed compared
|
|
1107
|
+
* against the ones stored in the cache
|
|
1108
|
+
*
|
|
1109
|
+
* @method getUpdated
|
|
1110
|
+
* @param files {Array} the array of files to compare against the ones in the cache
|
|
1111
|
+
* @returns {Array}
|
|
1112
|
+
*/
|
|
1113
|
+
getUpdatedFiles(files) {
|
|
1114
|
+
const me = this;
|
|
1115
|
+
files || (files = []);
|
|
1116
|
+
return me.normalizeEntries(files).filter((entry) => entry.changed).map((entry) => entry.key);
|
|
4322
1117
|
},
|
|
4323
1118
|
/**
|
|
4324
|
-
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
|
|
4329
|
-
normalizeEntries
|
|
4330
|
-
files
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
return me.getFileDescriptor(file);
|
|
4334
|
-
});
|
|
1119
|
+
* Return the list of files
|
|
1120
|
+
* @method normalizeEntries
|
|
1121
|
+
* @param files
|
|
1122
|
+
* @returns {*}
|
|
1123
|
+
*/
|
|
1124
|
+
normalizeEntries(files) {
|
|
1125
|
+
files || (files = []);
|
|
1126
|
+
const me = this;
|
|
1127
|
+
const nEntries = files.map((file) => me.getFileDescriptor(file));
|
|
4335
1128
|
return nEntries;
|
|
4336
1129
|
},
|
|
4337
1130
|
/**
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
removeEntry
|
|
1131
|
+
* Remove an entry from the file-entry-cache. Useful to force the file to still be considered
|
|
1132
|
+
* modified the next time the process is run
|
|
1133
|
+
*
|
|
1134
|
+
* @method removeEntry
|
|
1135
|
+
* @param entryName
|
|
1136
|
+
*/
|
|
1137
|
+
removeEntry(entryName) {
|
|
1138
|
+
if (!path10.isAbsolute(entryName)) {
|
|
1139
|
+
entryName = path10.resolve(process5.cwd(), entryName);
|
|
1140
|
+
}
|
|
4345
1141
|
delete normalizedEntries[entryName];
|
|
4346
1142
|
cache.removeKey(entryName);
|
|
4347
1143
|
},
|
|
4348
1144
|
/**
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
deleteCacheFile
|
|
1145
|
+
* Delete the cache file from the disk
|
|
1146
|
+
* @method deleteCacheFile
|
|
1147
|
+
*/
|
|
1148
|
+
deleteCacheFile() {
|
|
4353
1149
|
cache.removeCacheFile();
|
|
4354
1150
|
},
|
|
4355
1151
|
/**
|
|
4356
|
-
|
|
4357
|
-
|
|
4358
|
-
destroy
|
|
1152
|
+
* Remove the cache from the file and clear the memory cache
|
|
1153
|
+
*/
|
|
1154
|
+
destroy() {
|
|
4359
1155
|
normalizedEntries = {};
|
|
4360
1156
|
cache.destroy();
|
|
4361
1157
|
},
|
|
4362
|
-
_getMetaForFileUsingCheckSum
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
1158
|
+
_getMetaForFileUsingCheckSum(cacheEntry) {
|
|
1159
|
+
const contentBuffer = fs6.readFileSync(cacheEntry.key);
|
|
1160
|
+
const hash = this.getHash(contentBuffer);
|
|
1161
|
+
const meta = Object.assign(cacheEntry.meta, { hash });
|
|
4366
1162
|
delete meta.size;
|
|
4367
1163
|
delete meta.mtime;
|
|
4368
1164
|
return meta;
|
|
4369
1165
|
},
|
|
4370
|
-
_getMetaForFileUsingMtimeAndSize
|
|
4371
|
-
|
|
4372
|
-
|
|
1166
|
+
_getMetaForFileUsingMtimeAndSize(cacheEntry) {
|
|
1167
|
+
const stat = fs6.statSync(cacheEntry.key);
|
|
1168
|
+
const meta = Object.assign(cacheEntry.meta, {
|
|
4373
1169
|
size: stat.size,
|
|
4374
1170
|
mtime: stat.mtime.getTime()
|
|
4375
1171
|
});
|
|
@@ -4377,29 +1173,29 @@ var require_cache2 = __commonJS({
|
|
|
4377
1173
|
return meta;
|
|
4378
1174
|
},
|
|
4379
1175
|
/**
|
|
4380
|
-
|
|
4381
|
-
|
|
4382
|
-
|
|
4383
|
-
reconcile
|
|
1176
|
+
* Sync the files and persist them to the cache
|
|
1177
|
+
* @method reconcile
|
|
1178
|
+
*/
|
|
1179
|
+
reconcile(noPrune) {
|
|
4384
1180
|
removeNotFoundFiles();
|
|
4385
|
-
noPrune =
|
|
4386
|
-
|
|
4387
|
-
|
|
1181
|
+
noPrune = noPrune === void 0 ? true : noPrune;
|
|
1182
|
+
const entries = normalizedEntries;
|
|
1183
|
+
const keys = Object.keys(entries);
|
|
4388
1184
|
if (keys.length === 0) {
|
|
4389
1185
|
return;
|
|
4390
1186
|
}
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
|
|
1187
|
+
const me = this;
|
|
1188
|
+
for (const entryName of keys) {
|
|
1189
|
+
const cacheEntry = entries[entryName];
|
|
4394
1190
|
try {
|
|
4395
|
-
|
|
1191
|
+
const meta = useChecksum ? me._getMetaForFileUsingCheckSum(cacheEntry) : me._getMetaForFileUsingMtimeAndSize(cacheEntry);
|
|
4396
1192
|
cache.setKey(entryName, meta);
|
|
4397
|
-
} catch (
|
|
4398
|
-
if (
|
|
4399
|
-
throw
|
|
1193
|
+
} catch (error) {
|
|
1194
|
+
if (error.code !== "ENOENT") {
|
|
1195
|
+
throw error;
|
|
4400
1196
|
}
|
|
4401
1197
|
}
|
|
4402
|
-
}
|
|
1198
|
+
}
|
|
4403
1199
|
cache.save(noPrune);
|
|
4404
1200
|
}
|
|
4405
1201
|
};
|
|
@@ -4570,26 +1366,19 @@ var require_wcwidth = __commonJS({
|
|
|
4570
1366
|
let min = 0;
|
|
4571
1367
|
let max = combining.length - 1;
|
|
4572
1368
|
let mid;
|
|
4573
|
-
if (ucs < combining[0][0] || ucs > combining[max][1])
|
|
4574
|
-
return false;
|
|
1369
|
+
if (ucs < combining[0][0] || ucs > combining[max][1]) return false;
|
|
4575
1370
|
while (max >= min) {
|
|
4576
1371
|
mid = Math.floor((min + max) / 2);
|
|
4577
|
-
if (ucs > combining[mid][1])
|
|
4578
|
-
|
|
4579
|
-
else
|
|
4580
|
-
max = mid - 1;
|
|
4581
|
-
else
|
|
4582
|
-
return true;
|
|
1372
|
+
if (ucs > combining[mid][1]) min = mid + 1;
|
|
1373
|
+
else if (ucs < combining[mid][0]) max = mid - 1;
|
|
1374
|
+
else return true;
|
|
4583
1375
|
}
|
|
4584
1376
|
return false;
|
|
4585
1377
|
}
|
|
4586
1378
|
function wcwidth2(ucs, opts) {
|
|
4587
|
-
if (ucs === 0)
|
|
4588
|
-
|
|
4589
|
-
if (ucs
|
|
4590
|
-
return opts.control;
|
|
4591
|
-
if (bisearch(ucs))
|
|
4592
|
-
return 0;
|
|
1379
|
+
if (ucs === 0) return opts.nul;
|
|
1380
|
+
if (ucs < 32 || ucs >= 127 && ucs < 160) return opts.control;
|
|
1381
|
+
if (bisearch(ucs)) return 0;
|
|
4593
1382
|
return 1 + (ucs >= 4352 && (ucs <= 4447 || // Hangul Jamo init. consonants
|
|
4594
1383
|
ucs == 9001 || ucs == 9002 || ucs >= 11904 && ucs <= 42191 && ucs != 12351 || // CJK ... Yi
|
|
4595
1384
|
ucs >= 44032 && ucs <= 55203 || // Hangul Syllables
|
|
@@ -4604,8 +1393,7 @@ var require_wcwidth = __commonJS({
|
|
|
4604
1393
|
let l;
|
|
4605
1394
|
let s = 0;
|
|
4606
1395
|
let n;
|
|
4607
|
-
if (typeof str !== "string")
|
|
4608
|
-
return wcwidth2(str, opts);
|
|
1396
|
+
if (typeof str !== "string") return wcwidth2(str, opts);
|
|
4609
1397
|
for (let i = 0; i < str.length; i++) {
|
|
4610
1398
|
h = str.charCodeAt(i);
|
|
4611
1399
|
if (h >= 55296 && h <= 56319) {
|
|
@@ -4617,8 +1405,7 @@ var require_wcwidth = __commonJS({
|
|
|
4617
1405
|
}
|
|
4618
1406
|
}
|
|
4619
1407
|
n = wcwidth2(h, opts);
|
|
4620
|
-
if (n < 0)
|
|
4621
|
-
return -1;
|
|
1408
|
+
if (n < 0) return -1;
|
|
4622
1409
|
s += n;
|
|
4623
1410
|
}
|
|
4624
1411
|
return s;
|
|
@@ -4833,6 +1620,7 @@ var {
|
|
|
4833
1620
|
normalizeOptionSettings,
|
|
4834
1621
|
vnopts,
|
|
4835
1622
|
fastGlob,
|
|
1623
|
+
createTwoFilesPatch,
|
|
4836
1624
|
mockable
|
|
4837
1625
|
} = sharedWithCli;
|
|
4838
1626
|
|
|
@@ -4951,7 +1739,7 @@ var preserveCamelCase = (string, toLowerCase, toUpperCase, preserveConsecutiveUp
|
|
|
4951
1739
|
var preserveConsecutiveUppercase = (input, toLowerCase) => {
|
|
4952
1740
|
LEADING_CAPITAL.lastIndex = 0;
|
|
4953
1741
|
return string_replace_all_default(
|
|
4954
|
-
/* isOptionalObject*/
|
|
1742
|
+
/* isOptionalObject */
|
|
4955
1743
|
false,
|
|
4956
1744
|
input,
|
|
4957
1745
|
LEADING_CAPITAL,
|
|
@@ -4962,10 +1750,10 @@ var postProcess = (input, toUpperCase) => {
|
|
|
4962
1750
|
SEPARATORS_AND_IDENTIFIER.lastIndex = 0;
|
|
4963
1751
|
NUMBERS_AND_IDENTIFIER.lastIndex = 0;
|
|
4964
1752
|
return string_replace_all_default(
|
|
4965
|
-
/* isOptionalObject*/
|
|
1753
|
+
/* isOptionalObject */
|
|
4966
1754
|
false,
|
|
4967
1755
|
string_replace_all_default(
|
|
4968
|
-
/* isOptionalObject*/
|
|
1756
|
+
/* isOptionalObject */
|
|
4969
1757
|
false,
|
|
4970
1758
|
input,
|
|
4971
1759
|
NUMBERS_AND_IDENTIFIER,
|
|
@@ -5074,7 +1862,7 @@ function isJson(value) {
|
|
|
5074
1862
|
}
|
|
5075
1863
|
}
|
|
5076
1864
|
var normalizeToPosix = path.sep === "\\" ? (filepath) => string_replace_all_default(
|
|
5077
|
-
/* isOptionalObject*/
|
|
1865
|
+
/* isOptionalObject */
|
|
5078
1866
|
false,
|
|
5079
1867
|
filepath,
|
|
5080
1868
|
"\\",
|
|
@@ -5782,7 +2570,7 @@ var Context = class {
|
|
|
5782
2570
|
popContextPlugins() {
|
|
5783
2571
|
__privateGet(this, _stack).pop();
|
|
5784
2572
|
Object.assign(this, at_default(
|
|
5785
|
-
/* isOptionalObject*/
|
|
2573
|
+
/* isOptionalObject */
|
|
5786
2574
|
false,
|
|
5787
2575
|
__privateGet(this, _stack),
|
|
5788
2576
|
-1
|
|
@@ -5858,7 +2646,6 @@ var find_config_path_default = logResolvedConfigPathOrDie;
|
|
|
5858
2646
|
// src/cli/format.js
|
|
5859
2647
|
import fs5 from "fs/promises";
|
|
5860
2648
|
import path9 from "path";
|
|
5861
|
-
var import_diff = __toESM(require_create(), 1);
|
|
5862
2649
|
import * as prettier from "../index.mjs";
|
|
5863
2650
|
|
|
5864
2651
|
// src/cli/expand-patterns.js
|
|
@@ -5999,14 +2786,14 @@ function sortPaths(paths) {
|
|
|
5999
2786
|
}
|
|
6000
2787
|
function escapePathForGlob(path10) {
|
|
6001
2788
|
return string_replace_all_default(
|
|
6002
|
-
/* isOptionalObject*/
|
|
2789
|
+
/* isOptionalObject */
|
|
6003
2790
|
false,
|
|
6004
2791
|
string_replace_all_default(
|
|
6005
|
-
/* isOptionalObject*/
|
|
2792
|
+
/* isOptionalObject */
|
|
6006
2793
|
false,
|
|
6007
2794
|
fastGlob.escapePath(
|
|
6008
2795
|
string_replace_all_default(
|
|
6009
|
-
/* isOptionalObject*/
|
|
2796
|
+
/* isOptionalObject */
|
|
6010
2797
|
false,
|
|
6011
2798
|
path10,
|
|
6012
2799
|
"\\",
|
|
@@ -6014,11 +2801,11 @@ function escapePathForGlob(path10) {
|
|
|
6014
2801
|
)
|
|
6015
2802
|
// Workaround for fast-glob#262 (part 1)
|
|
6016
2803
|
),
|
|
6017
|
-
|
|
2804
|
+
String.raw`\!`,
|
|
6018
2805
|
"@(!)"
|
|
6019
2806
|
),
|
|
6020
2807
|
"\0",
|
|
6021
|
-
|
|
2808
|
+
String.raw`@(\\)`
|
|
6022
2809
|
);
|
|
6023
2810
|
}
|
|
6024
2811
|
var fixWindowsSlashes = normalizeToPosix;
|
|
@@ -6046,64 +2833,6 @@ import process3 from "process";
|
|
|
6046
2833
|
import path4 from "path";
|
|
6047
2834
|
import fs2, { promises as fsPromises } from "fs";
|
|
6048
2835
|
import { fileURLToPath } from "url";
|
|
6049
|
-
|
|
6050
|
-
// node_modules/pkg-dir/node_modules/yocto-queue/index.js
|
|
6051
|
-
var Node = class {
|
|
6052
|
-
value;
|
|
6053
|
-
next;
|
|
6054
|
-
constructor(value) {
|
|
6055
|
-
this.value = value;
|
|
6056
|
-
}
|
|
6057
|
-
};
|
|
6058
|
-
var _head, _tail, _size;
|
|
6059
|
-
var Queue = class {
|
|
6060
|
-
constructor() {
|
|
6061
|
-
__privateAdd(this, _head, void 0);
|
|
6062
|
-
__privateAdd(this, _tail, void 0);
|
|
6063
|
-
__privateAdd(this, _size, void 0);
|
|
6064
|
-
this.clear();
|
|
6065
|
-
}
|
|
6066
|
-
enqueue(value) {
|
|
6067
|
-
const node = new Node(value);
|
|
6068
|
-
if (__privateGet(this, _head)) {
|
|
6069
|
-
__privateGet(this, _tail).next = node;
|
|
6070
|
-
__privateSet(this, _tail, node);
|
|
6071
|
-
} else {
|
|
6072
|
-
__privateSet(this, _head, node);
|
|
6073
|
-
__privateSet(this, _tail, node);
|
|
6074
|
-
}
|
|
6075
|
-
__privateWrapper(this, _size)._++;
|
|
6076
|
-
}
|
|
6077
|
-
dequeue() {
|
|
6078
|
-
const current = __privateGet(this, _head);
|
|
6079
|
-
if (!current) {
|
|
6080
|
-
return;
|
|
6081
|
-
}
|
|
6082
|
-
__privateSet(this, _head, __privateGet(this, _head).next);
|
|
6083
|
-
__privateWrapper(this, _size)._--;
|
|
6084
|
-
return current.value;
|
|
6085
|
-
}
|
|
6086
|
-
clear() {
|
|
6087
|
-
__privateSet(this, _head, void 0);
|
|
6088
|
-
__privateSet(this, _tail, void 0);
|
|
6089
|
-
__privateSet(this, _size, 0);
|
|
6090
|
-
}
|
|
6091
|
-
get size() {
|
|
6092
|
-
return __privateGet(this, _size);
|
|
6093
|
-
}
|
|
6094
|
-
*[Symbol.iterator]() {
|
|
6095
|
-
let current = __privateGet(this, _head);
|
|
6096
|
-
while (current) {
|
|
6097
|
-
yield current.value;
|
|
6098
|
-
current = current.next;
|
|
6099
|
-
}
|
|
6100
|
-
}
|
|
6101
|
-
};
|
|
6102
|
-
_head = new WeakMap();
|
|
6103
|
-
_tail = new WeakMap();
|
|
6104
|
-
_size = new WeakMap();
|
|
6105
|
-
|
|
6106
|
-
// node_modules/pkg-dir/node_modules/locate-path/index.js
|
|
6107
2836
|
var typeMappings = {
|
|
6108
2837
|
directory: "isDirectory",
|
|
6109
2838
|
file: "isFile"
|
|
@@ -6288,7 +3017,7 @@ var FormatResultsCache = class {
|
|
|
6288
3017
|
* @param {string} cacheStrategy
|
|
6289
3018
|
*/
|
|
6290
3019
|
constructor(cacheFileLocation, cacheStrategy) {
|
|
6291
|
-
__privateAdd(this, _fileEntryCache
|
|
3020
|
+
__privateAdd(this, _fileEntryCache);
|
|
6292
3021
|
const useChecksum = cacheStrategy === "content";
|
|
6293
3022
|
__privateSet(this, _fileEntryCache, import_file_entry_cache.default.create(
|
|
6294
3023
|
/* cacheId */
|
|
@@ -6451,7 +3180,7 @@ var get_options_for_file_default = getOptionsForFile;
|
|
|
6451
3180
|
// src/cli/format.js
|
|
6452
3181
|
var { getStdin, writeFormattedFile } = mockable;
|
|
6453
3182
|
function diff(a, b) {
|
|
6454
|
-
return
|
|
3183
|
+
return createTwoFilesPatch("", "", a, b, "", "", { context: 2 });
|
|
6455
3184
|
}
|
|
6456
3185
|
var DebugError = class extends Error {
|
|
6457
3186
|
name = "DebugError";
|
|
@@ -6811,7 +3540,7 @@ ${error2.message}`
|
|
|
6811
3540
|
} else {
|
|
6812
3541
|
const files = numberOfUnformattedFilesFound === 1 ? "the above file" : `${numberOfUnformattedFilesFound} files`;
|
|
6813
3542
|
context.logger.warn(
|
|
6814
|
-
context.argv.write ? `Code style issues fixed in ${files}.` : `Code style issues found in ${files}. Run Prettier to fix.`
|
|
3543
|
+
context.argv.write ? `Code style issues fixed in ${files}.` : `Code style issues found in ${files}. Run Prettier with --write to fix.`
|
|
6815
3544
|
);
|
|
6816
3545
|
}
|
|
6817
3546
|
}
|
|
@@ -6887,7 +3616,7 @@ function createLogger(logLevel = "log") {
|
|
|
6887
3616
|
...options
|
|
6888
3617
|
};
|
|
6889
3618
|
message = string_replace_all_default(
|
|
6890
|
-
/* isOptionalObject*/
|
|
3619
|
+
/* isOptionalObject */
|
|
6891
3620
|
false,
|
|
6892
3621
|
message,
|
|
6893
3622
|
/^/gm,
|
|
@@ -6956,7 +3685,7 @@ var CHOICE_USAGE_MARGIN = 3;
|
|
|
6956
3685
|
var CHOICE_USAGE_INDENTATION = 2;
|
|
6957
3686
|
function indent(str, spaces) {
|
|
6958
3687
|
return string_replace_all_default(
|
|
6959
|
-
/* isOptionalObject*/
|
|
3688
|
+
/* isOptionalObject */
|
|
6960
3689
|
false,
|
|
6961
3690
|
str,
|
|
6962
3691
|
/^/gm,
|
|
@@ -6987,7 +3716,7 @@ function createOptionUsageRow(header, content, threshold) {
|
|
|
6987
3716
|
const separator = header.length >= threshold ? `
|
|
6988
3717
|
${" ".repeat(threshold)}` : " ".repeat(threshold - header.length);
|
|
6989
3718
|
const description = string_replace_all_default(
|
|
6990
|
-
/* isOptionalObject*/
|
|
3719
|
+
/* isOptionalObject */
|
|
6991
3720
|
false,
|
|
6992
3721
|
content,
|
|
6993
3722
|
"\n",
|