encoding-aware-fs 0.1.4 → 0.1.6
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/README.md +74 -0
- package/RESEARCH.md +502 -0
- package/dist/index.js +3371 -205
- package/dist/server.js +3176 -69
- package/package.json +16 -7
- package/skills/claude-code/SKILL.md +7 -4
- package/skills/opencode/SKILL.md +7 -4
package/dist/server.js
CHANGED
|
@@ -3600,49 +3600,49 @@ var require_fast_uri = __commonJS({
|
|
|
3600
3600
|
schemelessOptions.skipEscape = true;
|
|
3601
3601
|
return serialize(resolved, schemelessOptions);
|
|
3602
3602
|
}
|
|
3603
|
-
function resolveComponent(base,
|
|
3603
|
+
function resolveComponent(base, relative2, options, skipNormalization) {
|
|
3604
3604
|
const target = {};
|
|
3605
3605
|
if (!skipNormalization) {
|
|
3606
3606
|
base = parse3(serialize(base, options), options);
|
|
3607
|
-
|
|
3607
|
+
relative2 = parse3(serialize(relative2, options), options);
|
|
3608
3608
|
}
|
|
3609
3609
|
options = options || {};
|
|
3610
|
-
if (!options.tolerant &&
|
|
3611
|
-
target.scheme =
|
|
3612
|
-
target.userinfo =
|
|
3613
|
-
target.host =
|
|
3614
|
-
target.port =
|
|
3615
|
-
target.path = removeDotSegments(
|
|
3616
|
-
target.query =
|
|
3610
|
+
if (!options.tolerant && relative2.scheme) {
|
|
3611
|
+
target.scheme = relative2.scheme;
|
|
3612
|
+
target.userinfo = relative2.userinfo;
|
|
3613
|
+
target.host = relative2.host;
|
|
3614
|
+
target.port = relative2.port;
|
|
3615
|
+
target.path = removeDotSegments(relative2.path || "");
|
|
3616
|
+
target.query = relative2.query;
|
|
3617
3617
|
} else {
|
|
3618
|
-
if (
|
|
3619
|
-
target.userinfo =
|
|
3620
|
-
target.host =
|
|
3621
|
-
target.port =
|
|
3622
|
-
target.path = removeDotSegments(
|
|
3623
|
-
target.query =
|
|
3618
|
+
if (relative2.userinfo !== void 0 || relative2.host !== void 0 || relative2.port !== void 0) {
|
|
3619
|
+
target.userinfo = relative2.userinfo;
|
|
3620
|
+
target.host = relative2.host;
|
|
3621
|
+
target.port = relative2.port;
|
|
3622
|
+
target.path = removeDotSegments(relative2.path || "");
|
|
3623
|
+
target.query = relative2.query;
|
|
3624
3624
|
} else {
|
|
3625
|
-
if (!
|
|
3625
|
+
if (!relative2.path) {
|
|
3626
3626
|
target.path = base.path;
|
|
3627
|
-
if (
|
|
3628
|
-
target.query =
|
|
3627
|
+
if (relative2.query !== void 0) {
|
|
3628
|
+
target.query = relative2.query;
|
|
3629
3629
|
} else {
|
|
3630
3630
|
target.query = base.query;
|
|
3631
3631
|
}
|
|
3632
3632
|
} else {
|
|
3633
|
-
if (
|
|
3634
|
-
target.path = removeDotSegments(
|
|
3633
|
+
if (relative2.path[0] === "/") {
|
|
3634
|
+
target.path = removeDotSegments(relative2.path);
|
|
3635
3635
|
} else {
|
|
3636
3636
|
if ((base.userinfo !== void 0 || base.host !== void 0 || base.port !== void 0) && !base.path) {
|
|
3637
|
-
target.path = "/" +
|
|
3637
|
+
target.path = "/" + relative2.path;
|
|
3638
3638
|
} else if (!base.path) {
|
|
3639
|
-
target.path =
|
|
3639
|
+
target.path = relative2.path;
|
|
3640
3640
|
} else {
|
|
3641
|
-
target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) +
|
|
3641
|
+
target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative2.path;
|
|
3642
3642
|
}
|
|
3643
3643
|
target.path = removeDotSegments(target.path);
|
|
3644
3644
|
}
|
|
3645
|
-
target.query =
|
|
3645
|
+
target.query = relative2.query;
|
|
3646
3646
|
}
|
|
3647
3647
|
target.userinfo = base.userinfo;
|
|
3648
3648
|
target.host = base.host;
|
|
@@ -3650,7 +3650,7 @@ var require_fast_uri = __commonJS({
|
|
|
3650
3650
|
}
|
|
3651
3651
|
target.scheme = base.scheme;
|
|
3652
3652
|
}
|
|
3653
|
-
target.fragment =
|
|
3653
|
+
target.fragment = relative2.fragment;
|
|
3654
3654
|
return target;
|
|
3655
3655
|
}
|
|
3656
3656
|
function equal(uriA, uriB, options) {
|
|
@@ -10471,6 +10471,3042 @@ var require_lib = __commonJS({
|
|
|
10471
10471
|
}
|
|
10472
10472
|
});
|
|
10473
10473
|
|
|
10474
|
+
// node_modules/braces/lib/utils.js
|
|
10475
|
+
var require_utils2 = __commonJS({
|
|
10476
|
+
"node_modules/braces/lib/utils.js"(exports2) {
|
|
10477
|
+
"use strict";
|
|
10478
|
+
exports2.isInteger = (num) => {
|
|
10479
|
+
if (typeof num === "number") {
|
|
10480
|
+
return Number.isInteger(num);
|
|
10481
|
+
}
|
|
10482
|
+
if (typeof num === "string" && num.trim() !== "") {
|
|
10483
|
+
return Number.isInteger(Number(num));
|
|
10484
|
+
}
|
|
10485
|
+
return false;
|
|
10486
|
+
};
|
|
10487
|
+
exports2.find = (node, type) => node.nodes.find((node2) => node2.type === type);
|
|
10488
|
+
exports2.exceedsLimit = (min, max, step = 1, limit) => {
|
|
10489
|
+
if (limit === false)
|
|
10490
|
+
return false;
|
|
10491
|
+
if (!exports2.isInteger(min) || !exports2.isInteger(max))
|
|
10492
|
+
return false;
|
|
10493
|
+
return (Number(max) - Number(min)) / Number(step) >= limit;
|
|
10494
|
+
};
|
|
10495
|
+
exports2.escapeNode = (block, n = 0, type) => {
|
|
10496
|
+
const node = block.nodes[n];
|
|
10497
|
+
if (!node)
|
|
10498
|
+
return;
|
|
10499
|
+
if (type && node.type === type || node.type === "open" || node.type === "close") {
|
|
10500
|
+
if (node.escaped !== true) {
|
|
10501
|
+
node.value = "\\" + node.value;
|
|
10502
|
+
node.escaped = true;
|
|
10503
|
+
}
|
|
10504
|
+
}
|
|
10505
|
+
};
|
|
10506
|
+
exports2.encloseBrace = (node) => {
|
|
10507
|
+
if (node.type !== "brace")
|
|
10508
|
+
return false;
|
|
10509
|
+
if (node.commas >> 0 + node.ranges >> 0 === 0) {
|
|
10510
|
+
node.invalid = true;
|
|
10511
|
+
return true;
|
|
10512
|
+
}
|
|
10513
|
+
return false;
|
|
10514
|
+
};
|
|
10515
|
+
exports2.isInvalidBrace = (block) => {
|
|
10516
|
+
if (block.type !== "brace")
|
|
10517
|
+
return false;
|
|
10518
|
+
if (block.invalid === true || block.dollar)
|
|
10519
|
+
return true;
|
|
10520
|
+
if (block.commas >> 0 + block.ranges >> 0 === 0) {
|
|
10521
|
+
block.invalid = true;
|
|
10522
|
+
return true;
|
|
10523
|
+
}
|
|
10524
|
+
if (block.open !== true || block.close !== true) {
|
|
10525
|
+
block.invalid = true;
|
|
10526
|
+
return true;
|
|
10527
|
+
}
|
|
10528
|
+
return false;
|
|
10529
|
+
};
|
|
10530
|
+
exports2.isOpenOrClose = (node) => {
|
|
10531
|
+
if (node.type === "open" || node.type === "close") {
|
|
10532
|
+
return true;
|
|
10533
|
+
}
|
|
10534
|
+
return node.open === true || node.close === true;
|
|
10535
|
+
};
|
|
10536
|
+
exports2.reduce = (nodes) => nodes.reduce((acc, node) => {
|
|
10537
|
+
if (node.type === "text")
|
|
10538
|
+
acc.push(node.value);
|
|
10539
|
+
if (node.type === "range")
|
|
10540
|
+
node.type = "text";
|
|
10541
|
+
return acc;
|
|
10542
|
+
}, []);
|
|
10543
|
+
exports2.flatten = (...args) => {
|
|
10544
|
+
const result = [];
|
|
10545
|
+
const flat = (arr) => {
|
|
10546
|
+
for (let i = 0; i < arr.length; i++) {
|
|
10547
|
+
const ele = arr[i];
|
|
10548
|
+
if (Array.isArray(ele)) {
|
|
10549
|
+
flat(ele);
|
|
10550
|
+
continue;
|
|
10551
|
+
}
|
|
10552
|
+
if (ele !== void 0) {
|
|
10553
|
+
result.push(ele);
|
|
10554
|
+
}
|
|
10555
|
+
}
|
|
10556
|
+
return result;
|
|
10557
|
+
};
|
|
10558
|
+
flat(args);
|
|
10559
|
+
return result;
|
|
10560
|
+
};
|
|
10561
|
+
}
|
|
10562
|
+
});
|
|
10563
|
+
|
|
10564
|
+
// node_modules/braces/lib/stringify.js
|
|
10565
|
+
var require_stringify = __commonJS({
|
|
10566
|
+
"node_modules/braces/lib/stringify.js"(exports2, module2) {
|
|
10567
|
+
"use strict";
|
|
10568
|
+
var utils = require_utils2();
|
|
10569
|
+
module2.exports = (ast, options = {}) => {
|
|
10570
|
+
const stringify = (node, parent = {}) => {
|
|
10571
|
+
const invalidBlock = options.escapeInvalid && utils.isInvalidBrace(parent);
|
|
10572
|
+
const invalidNode = node.invalid === true && options.escapeInvalid === true;
|
|
10573
|
+
let output = "";
|
|
10574
|
+
if (node.value) {
|
|
10575
|
+
if ((invalidBlock || invalidNode) && utils.isOpenOrClose(node)) {
|
|
10576
|
+
return "\\" + node.value;
|
|
10577
|
+
}
|
|
10578
|
+
return node.value;
|
|
10579
|
+
}
|
|
10580
|
+
if (node.value) {
|
|
10581
|
+
return node.value;
|
|
10582
|
+
}
|
|
10583
|
+
if (node.nodes) {
|
|
10584
|
+
for (const child of node.nodes) {
|
|
10585
|
+
output += stringify(child);
|
|
10586
|
+
}
|
|
10587
|
+
}
|
|
10588
|
+
return output;
|
|
10589
|
+
};
|
|
10590
|
+
return stringify(ast);
|
|
10591
|
+
};
|
|
10592
|
+
}
|
|
10593
|
+
});
|
|
10594
|
+
|
|
10595
|
+
// node_modules/is-number/index.js
|
|
10596
|
+
var require_is_number = __commonJS({
|
|
10597
|
+
"node_modules/is-number/index.js"(exports2, module2) {
|
|
10598
|
+
"use strict";
|
|
10599
|
+
module2.exports = function(num) {
|
|
10600
|
+
if (typeof num === "number") {
|
|
10601
|
+
return num - num === 0;
|
|
10602
|
+
}
|
|
10603
|
+
if (typeof num === "string" && num.trim() !== "") {
|
|
10604
|
+
return Number.isFinite ? Number.isFinite(+num) : isFinite(+num);
|
|
10605
|
+
}
|
|
10606
|
+
return false;
|
|
10607
|
+
};
|
|
10608
|
+
}
|
|
10609
|
+
});
|
|
10610
|
+
|
|
10611
|
+
// node_modules/to-regex-range/index.js
|
|
10612
|
+
var require_to_regex_range = __commonJS({
|
|
10613
|
+
"node_modules/to-regex-range/index.js"(exports2, module2) {
|
|
10614
|
+
"use strict";
|
|
10615
|
+
var isNumber = require_is_number();
|
|
10616
|
+
var toRegexRange = (min, max, options) => {
|
|
10617
|
+
if (isNumber(min) === false) {
|
|
10618
|
+
throw new TypeError("toRegexRange: expected the first argument to be a number");
|
|
10619
|
+
}
|
|
10620
|
+
if (max === void 0 || min === max) {
|
|
10621
|
+
return String(min);
|
|
10622
|
+
}
|
|
10623
|
+
if (isNumber(max) === false) {
|
|
10624
|
+
throw new TypeError("toRegexRange: expected the second argument to be a number.");
|
|
10625
|
+
}
|
|
10626
|
+
let opts = { relaxZeros: true, ...options };
|
|
10627
|
+
if (typeof opts.strictZeros === "boolean") {
|
|
10628
|
+
opts.relaxZeros = opts.strictZeros === false;
|
|
10629
|
+
}
|
|
10630
|
+
let relax = String(opts.relaxZeros);
|
|
10631
|
+
let shorthand = String(opts.shorthand);
|
|
10632
|
+
let capture = String(opts.capture);
|
|
10633
|
+
let wrap = String(opts.wrap);
|
|
10634
|
+
let cacheKey = min + ":" + max + "=" + relax + shorthand + capture + wrap;
|
|
10635
|
+
if (toRegexRange.cache.hasOwnProperty(cacheKey)) {
|
|
10636
|
+
return toRegexRange.cache[cacheKey].result;
|
|
10637
|
+
}
|
|
10638
|
+
let a = Math.min(min, max);
|
|
10639
|
+
let b = Math.max(min, max);
|
|
10640
|
+
if (Math.abs(a - b) === 1) {
|
|
10641
|
+
let result = min + "|" + max;
|
|
10642
|
+
if (opts.capture) {
|
|
10643
|
+
return `(${result})`;
|
|
10644
|
+
}
|
|
10645
|
+
if (opts.wrap === false) {
|
|
10646
|
+
return result;
|
|
10647
|
+
}
|
|
10648
|
+
return `(?:${result})`;
|
|
10649
|
+
}
|
|
10650
|
+
let isPadded = hasPadding(min) || hasPadding(max);
|
|
10651
|
+
let state = { min, max, a, b };
|
|
10652
|
+
let positives = [];
|
|
10653
|
+
let negatives = [];
|
|
10654
|
+
if (isPadded) {
|
|
10655
|
+
state.isPadded = isPadded;
|
|
10656
|
+
state.maxLen = String(state.max).length;
|
|
10657
|
+
}
|
|
10658
|
+
if (a < 0) {
|
|
10659
|
+
let newMin = b < 0 ? Math.abs(b) : 1;
|
|
10660
|
+
negatives = splitToPatterns(newMin, Math.abs(a), state, opts);
|
|
10661
|
+
a = state.a = 0;
|
|
10662
|
+
}
|
|
10663
|
+
if (b >= 0) {
|
|
10664
|
+
positives = splitToPatterns(a, b, state, opts);
|
|
10665
|
+
}
|
|
10666
|
+
state.negatives = negatives;
|
|
10667
|
+
state.positives = positives;
|
|
10668
|
+
state.result = collatePatterns(negatives, positives, opts);
|
|
10669
|
+
if (opts.capture === true) {
|
|
10670
|
+
state.result = `(${state.result})`;
|
|
10671
|
+
} else if (opts.wrap !== false && positives.length + negatives.length > 1) {
|
|
10672
|
+
state.result = `(?:${state.result})`;
|
|
10673
|
+
}
|
|
10674
|
+
toRegexRange.cache[cacheKey] = state;
|
|
10675
|
+
return state.result;
|
|
10676
|
+
};
|
|
10677
|
+
function collatePatterns(neg, pos, options) {
|
|
10678
|
+
let onlyNegative = filterPatterns(neg, pos, "-", false, options) || [];
|
|
10679
|
+
let onlyPositive = filterPatterns(pos, neg, "", false, options) || [];
|
|
10680
|
+
let intersected = filterPatterns(neg, pos, "-?", true, options) || [];
|
|
10681
|
+
let subpatterns = onlyNegative.concat(intersected).concat(onlyPositive);
|
|
10682
|
+
return subpatterns.join("|");
|
|
10683
|
+
}
|
|
10684
|
+
function splitToRanges(min, max) {
|
|
10685
|
+
let nines = 1;
|
|
10686
|
+
let zeros = 1;
|
|
10687
|
+
let stop = countNines(min, nines);
|
|
10688
|
+
let stops = /* @__PURE__ */ new Set([max]);
|
|
10689
|
+
while (min <= stop && stop <= max) {
|
|
10690
|
+
stops.add(stop);
|
|
10691
|
+
nines += 1;
|
|
10692
|
+
stop = countNines(min, nines);
|
|
10693
|
+
}
|
|
10694
|
+
stop = countZeros(max + 1, zeros) - 1;
|
|
10695
|
+
while (min < stop && stop <= max) {
|
|
10696
|
+
stops.add(stop);
|
|
10697
|
+
zeros += 1;
|
|
10698
|
+
stop = countZeros(max + 1, zeros) - 1;
|
|
10699
|
+
}
|
|
10700
|
+
stops = [...stops];
|
|
10701
|
+
stops.sort(compare);
|
|
10702
|
+
return stops;
|
|
10703
|
+
}
|
|
10704
|
+
function rangeToPattern(start, stop, options) {
|
|
10705
|
+
if (start === stop) {
|
|
10706
|
+
return { pattern: start, count: [], digits: 0 };
|
|
10707
|
+
}
|
|
10708
|
+
let zipped = zip(start, stop);
|
|
10709
|
+
let digits = zipped.length;
|
|
10710
|
+
let pattern = "";
|
|
10711
|
+
let count = 0;
|
|
10712
|
+
for (let i = 0; i < digits; i++) {
|
|
10713
|
+
let [startDigit, stopDigit] = zipped[i];
|
|
10714
|
+
if (startDigit === stopDigit) {
|
|
10715
|
+
pattern += startDigit;
|
|
10716
|
+
} else if (startDigit !== "0" || stopDigit !== "9") {
|
|
10717
|
+
pattern += toCharacterClass(startDigit, stopDigit, options);
|
|
10718
|
+
} else {
|
|
10719
|
+
count++;
|
|
10720
|
+
}
|
|
10721
|
+
}
|
|
10722
|
+
if (count) {
|
|
10723
|
+
pattern += options.shorthand === true ? "\\d" : "[0-9]";
|
|
10724
|
+
}
|
|
10725
|
+
return { pattern, count: [count], digits };
|
|
10726
|
+
}
|
|
10727
|
+
function splitToPatterns(min, max, tok, options) {
|
|
10728
|
+
let ranges = splitToRanges(min, max);
|
|
10729
|
+
let tokens = [];
|
|
10730
|
+
let start = min;
|
|
10731
|
+
let prev;
|
|
10732
|
+
for (let i = 0; i < ranges.length; i++) {
|
|
10733
|
+
let max2 = ranges[i];
|
|
10734
|
+
let obj = rangeToPattern(String(start), String(max2), options);
|
|
10735
|
+
let zeros = "";
|
|
10736
|
+
if (!tok.isPadded && prev && prev.pattern === obj.pattern) {
|
|
10737
|
+
if (prev.count.length > 1) {
|
|
10738
|
+
prev.count.pop();
|
|
10739
|
+
}
|
|
10740
|
+
prev.count.push(obj.count[0]);
|
|
10741
|
+
prev.string = prev.pattern + toQuantifier(prev.count);
|
|
10742
|
+
start = max2 + 1;
|
|
10743
|
+
continue;
|
|
10744
|
+
}
|
|
10745
|
+
if (tok.isPadded) {
|
|
10746
|
+
zeros = padZeros(max2, tok, options);
|
|
10747
|
+
}
|
|
10748
|
+
obj.string = zeros + obj.pattern + toQuantifier(obj.count);
|
|
10749
|
+
tokens.push(obj);
|
|
10750
|
+
start = max2 + 1;
|
|
10751
|
+
prev = obj;
|
|
10752
|
+
}
|
|
10753
|
+
return tokens;
|
|
10754
|
+
}
|
|
10755
|
+
function filterPatterns(arr, comparison, prefix, intersection2, options) {
|
|
10756
|
+
let result = [];
|
|
10757
|
+
for (let ele of arr) {
|
|
10758
|
+
let { string: string3 } = ele;
|
|
10759
|
+
if (!intersection2 && !contains(comparison, "string", string3)) {
|
|
10760
|
+
result.push(prefix + string3);
|
|
10761
|
+
}
|
|
10762
|
+
if (intersection2 && contains(comparison, "string", string3)) {
|
|
10763
|
+
result.push(prefix + string3);
|
|
10764
|
+
}
|
|
10765
|
+
}
|
|
10766
|
+
return result;
|
|
10767
|
+
}
|
|
10768
|
+
function zip(a, b) {
|
|
10769
|
+
let arr = [];
|
|
10770
|
+
for (let i = 0; i < a.length; i++)
|
|
10771
|
+
arr.push([a[i], b[i]]);
|
|
10772
|
+
return arr;
|
|
10773
|
+
}
|
|
10774
|
+
function compare(a, b) {
|
|
10775
|
+
return a > b ? 1 : b > a ? -1 : 0;
|
|
10776
|
+
}
|
|
10777
|
+
function contains(arr, key, val) {
|
|
10778
|
+
return arr.some((ele) => ele[key] === val);
|
|
10779
|
+
}
|
|
10780
|
+
function countNines(min, len) {
|
|
10781
|
+
return Number(String(min).slice(0, -len) + "9".repeat(len));
|
|
10782
|
+
}
|
|
10783
|
+
function countZeros(integer2, zeros) {
|
|
10784
|
+
return integer2 - integer2 % Math.pow(10, zeros);
|
|
10785
|
+
}
|
|
10786
|
+
function toQuantifier(digits) {
|
|
10787
|
+
let [start = 0, stop = ""] = digits;
|
|
10788
|
+
if (stop || start > 1) {
|
|
10789
|
+
return `{${start + (stop ? "," + stop : "")}}`;
|
|
10790
|
+
}
|
|
10791
|
+
return "";
|
|
10792
|
+
}
|
|
10793
|
+
function toCharacterClass(a, b, options) {
|
|
10794
|
+
return `[${a}${b - a === 1 ? "" : "-"}${b}]`;
|
|
10795
|
+
}
|
|
10796
|
+
function hasPadding(str) {
|
|
10797
|
+
return /^-?(0+)\d/.test(str);
|
|
10798
|
+
}
|
|
10799
|
+
function padZeros(value, tok, options) {
|
|
10800
|
+
if (!tok.isPadded) {
|
|
10801
|
+
return value;
|
|
10802
|
+
}
|
|
10803
|
+
let diff = Math.abs(tok.maxLen - String(value).length);
|
|
10804
|
+
let relax = options.relaxZeros !== false;
|
|
10805
|
+
switch (diff) {
|
|
10806
|
+
case 0:
|
|
10807
|
+
return "";
|
|
10808
|
+
case 1:
|
|
10809
|
+
return relax ? "0?" : "0";
|
|
10810
|
+
case 2:
|
|
10811
|
+
return relax ? "0{0,2}" : "00";
|
|
10812
|
+
default: {
|
|
10813
|
+
return relax ? `0{0,${diff}}` : `0{${diff}}`;
|
|
10814
|
+
}
|
|
10815
|
+
}
|
|
10816
|
+
}
|
|
10817
|
+
toRegexRange.cache = {};
|
|
10818
|
+
toRegexRange.clearCache = () => toRegexRange.cache = {};
|
|
10819
|
+
module2.exports = toRegexRange;
|
|
10820
|
+
}
|
|
10821
|
+
});
|
|
10822
|
+
|
|
10823
|
+
// node_modules/fill-range/index.js
|
|
10824
|
+
var require_fill_range = __commonJS({
|
|
10825
|
+
"node_modules/fill-range/index.js"(exports2, module2) {
|
|
10826
|
+
"use strict";
|
|
10827
|
+
var util2 = require("util");
|
|
10828
|
+
var toRegexRange = require_to_regex_range();
|
|
10829
|
+
var isObject2 = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
|
|
10830
|
+
var transform2 = (toNumber) => {
|
|
10831
|
+
return (value) => toNumber === true ? Number(value) : String(value);
|
|
10832
|
+
};
|
|
10833
|
+
var isValidValue = (value) => {
|
|
10834
|
+
return typeof value === "number" || typeof value === "string" && value !== "";
|
|
10835
|
+
};
|
|
10836
|
+
var isNumber = (num) => Number.isInteger(+num);
|
|
10837
|
+
var zeros = (input) => {
|
|
10838
|
+
let value = `${input}`;
|
|
10839
|
+
let index = -1;
|
|
10840
|
+
if (value[0] === "-")
|
|
10841
|
+
value = value.slice(1);
|
|
10842
|
+
if (value === "0")
|
|
10843
|
+
return false;
|
|
10844
|
+
while (value[++index] === "0")
|
|
10845
|
+
;
|
|
10846
|
+
return index > 0;
|
|
10847
|
+
};
|
|
10848
|
+
var stringify = (start, end, options) => {
|
|
10849
|
+
if (typeof start === "string" || typeof end === "string") {
|
|
10850
|
+
return true;
|
|
10851
|
+
}
|
|
10852
|
+
return options.stringify === true;
|
|
10853
|
+
};
|
|
10854
|
+
var pad = (input, maxLength, toNumber) => {
|
|
10855
|
+
if (maxLength > 0) {
|
|
10856
|
+
let dash = input[0] === "-" ? "-" : "";
|
|
10857
|
+
if (dash)
|
|
10858
|
+
input = input.slice(1);
|
|
10859
|
+
input = dash + input.padStart(dash ? maxLength - 1 : maxLength, "0");
|
|
10860
|
+
}
|
|
10861
|
+
if (toNumber === false) {
|
|
10862
|
+
return String(input);
|
|
10863
|
+
}
|
|
10864
|
+
return input;
|
|
10865
|
+
};
|
|
10866
|
+
var toMaxLen = (input, maxLength) => {
|
|
10867
|
+
let negative = input[0] === "-" ? "-" : "";
|
|
10868
|
+
if (negative) {
|
|
10869
|
+
input = input.slice(1);
|
|
10870
|
+
maxLength--;
|
|
10871
|
+
}
|
|
10872
|
+
while (input.length < maxLength)
|
|
10873
|
+
input = "0" + input;
|
|
10874
|
+
return negative ? "-" + input : input;
|
|
10875
|
+
};
|
|
10876
|
+
var toSequence = (parts, options, maxLen) => {
|
|
10877
|
+
parts.negatives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
10878
|
+
parts.positives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
10879
|
+
let prefix = options.capture ? "" : "?:";
|
|
10880
|
+
let positives = "";
|
|
10881
|
+
let negatives = "";
|
|
10882
|
+
let result;
|
|
10883
|
+
if (parts.positives.length) {
|
|
10884
|
+
positives = parts.positives.map((v) => toMaxLen(String(v), maxLen)).join("|");
|
|
10885
|
+
}
|
|
10886
|
+
if (parts.negatives.length) {
|
|
10887
|
+
negatives = `-(${prefix}${parts.negatives.map((v) => toMaxLen(String(v), maxLen)).join("|")})`;
|
|
10888
|
+
}
|
|
10889
|
+
if (positives && negatives) {
|
|
10890
|
+
result = `${positives}|${negatives}`;
|
|
10891
|
+
} else {
|
|
10892
|
+
result = positives || negatives;
|
|
10893
|
+
}
|
|
10894
|
+
if (options.wrap) {
|
|
10895
|
+
return `(${prefix}${result})`;
|
|
10896
|
+
}
|
|
10897
|
+
return result;
|
|
10898
|
+
};
|
|
10899
|
+
var toRange = (a, b, isNumbers, options) => {
|
|
10900
|
+
if (isNumbers) {
|
|
10901
|
+
return toRegexRange(a, b, { wrap: false, ...options });
|
|
10902
|
+
}
|
|
10903
|
+
let start = String.fromCharCode(a);
|
|
10904
|
+
if (a === b)
|
|
10905
|
+
return start;
|
|
10906
|
+
let stop = String.fromCharCode(b);
|
|
10907
|
+
return `[${start}-${stop}]`;
|
|
10908
|
+
};
|
|
10909
|
+
var toRegex = (start, end, options) => {
|
|
10910
|
+
if (Array.isArray(start)) {
|
|
10911
|
+
let wrap = options.wrap === true;
|
|
10912
|
+
let prefix = options.capture ? "" : "?:";
|
|
10913
|
+
return wrap ? `(${prefix}${start.join("|")})` : start.join("|");
|
|
10914
|
+
}
|
|
10915
|
+
return toRegexRange(start, end, options);
|
|
10916
|
+
};
|
|
10917
|
+
var rangeError = (...args) => {
|
|
10918
|
+
return new RangeError("Invalid range arguments: " + util2.inspect(...args));
|
|
10919
|
+
};
|
|
10920
|
+
var invalidRange = (start, end, options) => {
|
|
10921
|
+
if (options.strictRanges === true)
|
|
10922
|
+
throw rangeError([start, end]);
|
|
10923
|
+
return [];
|
|
10924
|
+
};
|
|
10925
|
+
var invalidStep = (step, options) => {
|
|
10926
|
+
if (options.strictRanges === true) {
|
|
10927
|
+
throw new TypeError(`Expected step "${step}" to be a number`);
|
|
10928
|
+
}
|
|
10929
|
+
return [];
|
|
10930
|
+
};
|
|
10931
|
+
var fillNumbers = (start, end, step = 1, options = {}) => {
|
|
10932
|
+
let a = Number(start);
|
|
10933
|
+
let b = Number(end);
|
|
10934
|
+
if (!Number.isInteger(a) || !Number.isInteger(b)) {
|
|
10935
|
+
if (options.strictRanges === true)
|
|
10936
|
+
throw rangeError([start, end]);
|
|
10937
|
+
return [];
|
|
10938
|
+
}
|
|
10939
|
+
if (a === 0)
|
|
10940
|
+
a = 0;
|
|
10941
|
+
if (b === 0)
|
|
10942
|
+
b = 0;
|
|
10943
|
+
let descending = a > b;
|
|
10944
|
+
let startString = String(start);
|
|
10945
|
+
let endString = String(end);
|
|
10946
|
+
let stepString = String(step);
|
|
10947
|
+
step = Math.max(Math.abs(step), 1);
|
|
10948
|
+
let padded = zeros(startString) || zeros(endString) || zeros(stepString);
|
|
10949
|
+
let maxLen = padded ? Math.max(startString.length, endString.length, stepString.length) : 0;
|
|
10950
|
+
let toNumber = padded === false && stringify(start, end, options) === false;
|
|
10951
|
+
let format = options.transform || transform2(toNumber);
|
|
10952
|
+
if (options.toRegex && step === 1) {
|
|
10953
|
+
return toRange(toMaxLen(start, maxLen), toMaxLen(end, maxLen), true, options);
|
|
10954
|
+
}
|
|
10955
|
+
let parts = { negatives: [], positives: [] };
|
|
10956
|
+
let push = (num) => parts[num < 0 ? "negatives" : "positives"].push(Math.abs(num));
|
|
10957
|
+
let range = [];
|
|
10958
|
+
let index = 0;
|
|
10959
|
+
while (descending ? a >= b : a <= b) {
|
|
10960
|
+
if (options.toRegex === true && step > 1) {
|
|
10961
|
+
push(a);
|
|
10962
|
+
} else {
|
|
10963
|
+
range.push(pad(format(a, index), maxLen, toNumber));
|
|
10964
|
+
}
|
|
10965
|
+
a = descending ? a - step : a + step;
|
|
10966
|
+
index++;
|
|
10967
|
+
}
|
|
10968
|
+
if (options.toRegex === true) {
|
|
10969
|
+
return step > 1 ? toSequence(parts, options, maxLen) : toRegex(range, null, { wrap: false, ...options });
|
|
10970
|
+
}
|
|
10971
|
+
return range;
|
|
10972
|
+
};
|
|
10973
|
+
var fillLetters = (start, end, step = 1, options = {}) => {
|
|
10974
|
+
if (!isNumber(start) && start.length > 1 || !isNumber(end) && end.length > 1) {
|
|
10975
|
+
return invalidRange(start, end, options);
|
|
10976
|
+
}
|
|
10977
|
+
let format = options.transform || ((val) => String.fromCharCode(val));
|
|
10978
|
+
let a = `${start}`.charCodeAt(0);
|
|
10979
|
+
let b = `${end}`.charCodeAt(0);
|
|
10980
|
+
let descending = a > b;
|
|
10981
|
+
let min = Math.min(a, b);
|
|
10982
|
+
let max = Math.max(a, b);
|
|
10983
|
+
if (options.toRegex && step === 1) {
|
|
10984
|
+
return toRange(min, max, false, options);
|
|
10985
|
+
}
|
|
10986
|
+
let range = [];
|
|
10987
|
+
let index = 0;
|
|
10988
|
+
while (descending ? a >= b : a <= b) {
|
|
10989
|
+
range.push(format(a, index));
|
|
10990
|
+
a = descending ? a - step : a + step;
|
|
10991
|
+
index++;
|
|
10992
|
+
}
|
|
10993
|
+
if (options.toRegex === true) {
|
|
10994
|
+
return toRegex(range, null, { wrap: false, options });
|
|
10995
|
+
}
|
|
10996
|
+
return range;
|
|
10997
|
+
};
|
|
10998
|
+
var fill = (start, end, step, options = {}) => {
|
|
10999
|
+
if (end == null && isValidValue(start)) {
|
|
11000
|
+
return [start];
|
|
11001
|
+
}
|
|
11002
|
+
if (!isValidValue(start) || !isValidValue(end)) {
|
|
11003
|
+
return invalidRange(start, end, options);
|
|
11004
|
+
}
|
|
11005
|
+
if (typeof step === "function") {
|
|
11006
|
+
return fill(start, end, 1, { transform: step });
|
|
11007
|
+
}
|
|
11008
|
+
if (isObject2(step)) {
|
|
11009
|
+
return fill(start, end, 0, step);
|
|
11010
|
+
}
|
|
11011
|
+
let opts = { ...options };
|
|
11012
|
+
if (opts.capture === true)
|
|
11013
|
+
opts.wrap = true;
|
|
11014
|
+
step = step || opts.step || 1;
|
|
11015
|
+
if (!isNumber(step)) {
|
|
11016
|
+
if (step != null && !isObject2(step))
|
|
11017
|
+
return invalidStep(step, opts);
|
|
11018
|
+
return fill(start, end, 1, step);
|
|
11019
|
+
}
|
|
11020
|
+
if (isNumber(start) && isNumber(end)) {
|
|
11021
|
+
return fillNumbers(start, end, step, opts);
|
|
11022
|
+
}
|
|
11023
|
+
return fillLetters(start, end, Math.max(Math.abs(step), 1), opts);
|
|
11024
|
+
};
|
|
11025
|
+
module2.exports = fill;
|
|
11026
|
+
}
|
|
11027
|
+
});
|
|
11028
|
+
|
|
11029
|
+
// node_modules/braces/lib/compile.js
|
|
11030
|
+
var require_compile2 = __commonJS({
|
|
11031
|
+
"node_modules/braces/lib/compile.js"(exports2, module2) {
|
|
11032
|
+
"use strict";
|
|
11033
|
+
var fill = require_fill_range();
|
|
11034
|
+
var utils = require_utils2();
|
|
11035
|
+
var compile = (ast, options = {}) => {
|
|
11036
|
+
const walk = (node, parent = {}) => {
|
|
11037
|
+
const invalidBlock = utils.isInvalidBrace(parent);
|
|
11038
|
+
const invalidNode = node.invalid === true && options.escapeInvalid === true;
|
|
11039
|
+
const invalid = invalidBlock === true || invalidNode === true;
|
|
11040
|
+
const prefix = options.escapeInvalid === true ? "\\" : "";
|
|
11041
|
+
let output = "";
|
|
11042
|
+
if (node.isOpen === true) {
|
|
11043
|
+
return prefix + node.value;
|
|
11044
|
+
}
|
|
11045
|
+
if (node.isClose === true) {
|
|
11046
|
+
console.log("node.isClose", prefix, node.value);
|
|
11047
|
+
return prefix + node.value;
|
|
11048
|
+
}
|
|
11049
|
+
if (node.type === "open") {
|
|
11050
|
+
return invalid ? prefix + node.value : "(";
|
|
11051
|
+
}
|
|
11052
|
+
if (node.type === "close") {
|
|
11053
|
+
return invalid ? prefix + node.value : ")";
|
|
11054
|
+
}
|
|
11055
|
+
if (node.type === "comma") {
|
|
11056
|
+
return node.prev.type === "comma" ? "" : invalid ? node.value : "|";
|
|
11057
|
+
}
|
|
11058
|
+
if (node.value) {
|
|
11059
|
+
return node.value;
|
|
11060
|
+
}
|
|
11061
|
+
if (node.nodes && node.ranges > 0) {
|
|
11062
|
+
const args = utils.reduce(node.nodes);
|
|
11063
|
+
const range = fill(...args, { ...options, wrap: false, toRegex: true, strictZeros: true });
|
|
11064
|
+
if (range.length !== 0) {
|
|
11065
|
+
return args.length > 1 && range.length > 1 ? `(${range})` : range;
|
|
11066
|
+
}
|
|
11067
|
+
}
|
|
11068
|
+
if (node.nodes) {
|
|
11069
|
+
for (const child of node.nodes) {
|
|
11070
|
+
output += walk(child, node);
|
|
11071
|
+
}
|
|
11072
|
+
}
|
|
11073
|
+
return output;
|
|
11074
|
+
};
|
|
11075
|
+
return walk(ast);
|
|
11076
|
+
};
|
|
11077
|
+
module2.exports = compile;
|
|
11078
|
+
}
|
|
11079
|
+
});
|
|
11080
|
+
|
|
11081
|
+
// node_modules/braces/lib/expand.js
|
|
11082
|
+
var require_expand = __commonJS({
|
|
11083
|
+
"node_modules/braces/lib/expand.js"(exports2, module2) {
|
|
11084
|
+
"use strict";
|
|
11085
|
+
var fill = require_fill_range();
|
|
11086
|
+
var stringify = require_stringify();
|
|
11087
|
+
var utils = require_utils2();
|
|
11088
|
+
var append = (queue = "", stash = "", enclose = false) => {
|
|
11089
|
+
const result = [];
|
|
11090
|
+
queue = [].concat(queue);
|
|
11091
|
+
stash = [].concat(stash);
|
|
11092
|
+
if (!stash.length)
|
|
11093
|
+
return queue;
|
|
11094
|
+
if (!queue.length) {
|
|
11095
|
+
return enclose ? utils.flatten(stash).map((ele) => `{${ele}}`) : stash;
|
|
11096
|
+
}
|
|
11097
|
+
for (const item of queue) {
|
|
11098
|
+
if (Array.isArray(item)) {
|
|
11099
|
+
for (const value of item) {
|
|
11100
|
+
result.push(append(value, stash, enclose));
|
|
11101
|
+
}
|
|
11102
|
+
} else {
|
|
11103
|
+
for (let ele of stash) {
|
|
11104
|
+
if (enclose === true && typeof ele === "string")
|
|
11105
|
+
ele = `{${ele}}`;
|
|
11106
|
+
result.push(Array.isArray(ele) ? append(item, ele, enclose) : item + ele);
|
|
11107
|
+
}
|
|
11108
|
+
}
|
|
11109
|
+
}
|
|
11110
|
+
return utils.flatten(result);
|
|
11111
|
+
};
|
|
11112
|
+
var expand = (ast, options = {}) => {
|
|
11113
|
+
const rangeLimit = options.rangeLimit === void 0 ? 1e3 : options.rangeLimit;
|
|
11114
|
+
const walk = (node, parent = {}) => {
|
|
11115
|
+
node.queue = [];
|
|
11116
|
+
let p = parent;
|
|
11117
|
+
let q = parent.queue;
|
|
11118
|
+
while (p.type !== "brace" && p.type !== "root" && p.parent) {
|
|
11119
|
+
p = p.parent;
|
|
11120
|
+
q = p.queue;
|
|
11121
|
+
}
|
|
11122
|
+
if (node.invalid || node.dollar) {
|
|
11123
|
+
q.push(append(q.pop(), stringify(node, options)));
|
|
11124
|
+
return;
|
|
11125
|
+
}
|
|
11126
|
+
if (node.type === "brace" && node.invalid !== true && node.nodes.length === 2) {
|
|
11127
|
+
q.push(append(q.pop(), ["{}"]));
|
|
11128
|
+
return;
|
|
11129
|
+
}
|
|
11130
|
+
if (node.nodes && node.ranges > 0) {
|
|
11131
|
+
const args = utils.reduce(node.nodes);
|
|
11132
|
+
if (utils.exceedsLimit(...args, options.step, rangeLimit)) {
|
|
11133
|
+
throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");
|
|
11134
|
+
}
|
|
11135
|
+
let range = fill(...args, options);
|
|
11136
|
+
if (range.length === 0) {
|
|
11137
|
+
range = stringify(node, options);
|
|
11138
|
+
}
|
|
11139
|
+
q.push(append(q.pop(), range));
|
|
11140
|
+
node.nodes = [];
|
|
11141
|
+
return;
|
|
11142
|
+
}
|
|
11143
|
+
const enclose = utils.encloseBrace(node);
|
|
11144
|
+
let queue = node.queue;
|
|
11145
|
+
let block = node;
|
|
11146
|
+
while (block.type !== "brace" && block.type !== "root" && block.parent) {
|
|
11147
|
+
block = block.parent;
|
|
11148
|
+
queue = block.queue;
|
|
11149
|
+
}
|
|
11150
|
+
for (let i = 0; i < node.nodes.length; i++) {
|
|
11151
|
+
const child = node.nodes[i];
|
|
11152
|
+
if (child.type === "comma" && node.type === "brace") {
|
|
11153
|
+
if (i === 1)
|
|
11154
|
+
queue.push("");
|
|
11155
|
+
queue.push("");
|
|
11156
|
+
continue;
|
|
11157
|
+
}
|
|
11158
|
+
if (child.type === "close") {
|
|
11159
|
+
q.push(append(q.pop(), queue, enclose));
|
|
11160
|
+
continue;
|
|
11161
|
+
}
|
|
11162
|
+
if (child.value && child.type !== "open") {
|
|
11163
|
+
queue.push(append(queue.pop(), child.value));
|
|
11164
|
+
continue;
|
|
11165
|
+
}
|
|
11166
|
+
if (child.nodes) {
|
|
11167
|
+
walk(child, node);
|
|
11168
|
+
}
|
|
11169
|
+
}
|
|
11170
|
+
return queue;
|
|
11171
|
+
};
|
|
11172
|
+
return utils.flatten(walk(ast));
|
|
11173
|
+
};
|
|
11174
|
+
module2.exports = expand;
|
|
11175
|
+
}
|
|
11176
|
+
});
|
|
11177
|
+
|
|
11178
|
+
// node_modules/braces/lib/constants.js
|
|
11179
|
+
var require_constants = __commonJS({
|
|
11180
|
+
"node_modules/braces/lib/constants.js"(exports2, module2) {
|
|
11181
|
+
"use strict";
|
|
11182
|
+
module2.exports = {
|
|
11183
|
+
MAX_LENGTH: 1e4,
|
|
11184
|
+
// Digits
|
|
11185
|
+
CHAR_0: "0",
|
|
11186
|
+
/* 0 */
|
|
11187
|
+
CHAR_9: "9",
|
|
11188
|
+
/* 9 */
|
|
11189
|
+
// Alphabet chars.
|
|
11190
|
+
CHAR_UPPERCASE_A: "A",
|
|
11191
|
+
/* A */
|
|
11192
|
+
CHAR_LOWERCASE_A: "a",
|
|
11193
|
+
/* a */
|
|
11194
|
+
CHAR_UPPERCASE_Z: "Z",
|
|
11195
|
+
/* Z */
|
|
11196
|
+
CHAR_LOWERCASE_Z: "z",
|
|
11197
|
+
/* z */
|
|
11198
|
+
CHAR_LEFT_PARENTHESES: "(",
|
|
11199
|
+
/* ( */
|
|
11200
|
+
CHAR_RIGHT_PARENTHESES: ")",
|
|
11201
|
+
/* ) */
|
|
11202
|
+
CHAR_ASTERISK: "*",
|
|
11203
|
+
/* * */
|
|
11204
|
+
// Non-alphabetic chars.
|
|
11205
|
+
CHAR_AMPERSAND: "&",
|
|
11206
|
+
/* & */
|
|
11207
|
+
CHAR_AT: "@",
|
|
11208
|
+
/* @ */
|
|
11209
|
+
CHAR_BACKSLASH: "\\",
|
|
11210
|
+
/* \ */
|
|
11211
|
+
CHAR_BACKTICK: "`",
|
|
11212
|
+
/* ` */
|
|
11213
|
+
CHAR_CARRIAGE_RETURN: "\r",
|
|
11214
|
+
/* \r */
|
|
11215
|
+
CHAR_CIRCUMFLEX_ACCENT: "^",
|
|
11216
|
+
/* ^ */
|
|
11217
|
+
CHAR_COLON: ":",
|
|
11218
|
+
/* : */
|
|
11219
|
+
CHAR_COMMA: ",",
|
|
11220
|
+
/* , */
|
|
11221
|
+
CHAR_DOLLAR: "$",
|
|
11222
|
+
/* . */
|
|
11223
|
+
CHAR_DOT: ".",
|
|
11224
|
+
/* . */
|
|
11225
|
+
CHAR_DOUBLE_QUOTE: '"',
|
|
11226
|
+
/* " */
|
|
11227
|
+
CHAR_EQUAL: "=",
|
|
11228
|
+
/* = */
|
|
11229
|
+
CHAR_EXCLAMATION_MARK: "!",
|
|
11230
|
+
/* ! */
|
|
11231
|
+
CHAR_FORM_FEED: "\f",
|
|
11232
|
+
/* \f */
|
|
11233
|
+
CHAR_FORWARD_SLASH: "/",
|
|
11234
|
+
/* / */
|
|
11235
|
+
CHAR_HASH: "#",
|
|
11236
|
+
/* # */
|
|
11237
|
+
CHAR_HYPHEN_MINUS: "-",
|
|
11238
|
+
/* - */
|
|
11239
|
+
CHAR_LEFT_ANGLE_BRACKET: "<",
|
|
11240
|
+
/* < */
|
|
11241
|
+
CHAR_LEFT_CURLY_BRACE: "{",
|
|
11242
|
+
/* { */
|
|
11243
|
+
CHAR_LEFT_SQUARE_BRACKET: "[",
|
|
11244
|
+
/* [ */
|
|
11245
|
+
CHAR_LINE_FEED: "\n",
|
|
11246
|
+
/* \n */
|
|
11247
|
+
CHAR_NO_BREAK_SPACE: "\xA0",
|
|
11248
|
+
/* \u00A0 */
|
|
11249
|
+
CHAR_PERCENT: "%",
|
|
11250
|
+
/* % */
|
|
11251
|
+
CHAR_PLUS: "+",
|
|
11252
|
+
/* + */
|
|
11253
|
+
CHAR_QUESTION_MARK: "?",
|
|
11254
|
+
/* ? */
|
|
11255
|
+
CHAR_RIGHT_ANGLE_BRACKET: ">",
|
|
11256
|
+
/* > */
|
|
11257
|
+
CHAR_RIGHT_CURLY_BRACE: "}",
|
|
11258
|
+
/* } */
|
|
11259
|
+
CHAR_RIGHT_SQUARE_BRACKET: "]",
|
|
11260
|
+
/* ] */
|
|
11261
|
+
CHAR_SEMICOLON: ";",
|
|
11262
|
+
/* ; */
|
|
11263
|
+
CHAR_SINGLE_QUOTE: "'",
|
|
11264
|
+
/* ' */
|
|
11265
|
+
CHAR_SPACE: " ",
|
|
11266
|
+
/* */
|
|
11267
|
+
CHAR_TAB: " ",
|
|
11268
|
+
/* \t */
|
|
11269
|
+
CHAR_UNDERSCORE: "_",
|
|
11270
|
+
/* _ */
|
|
11271
|
+
CHAR_VERTICAL_LINE: "|",
|
|
11272
|
+
/* | */
|
|
11273
|
+
CHAR_ZERO_WIDTH_NOBREAK_SPACE: "\uFEFF"
|
|
11274
|
+
/* \uFEFF */
|
|
11275
|
+
};
|
|
11276
|
+
}
|
|
11277
|
+
});
|
|
11278
|
+
|
|
11279
|
+
// node_modules/braces/lib/parse.js
|
|
11280
|
+
var require_parse = __commonJS({
|
|
11281
|
+
"node_modules/braces/lib/parse.js"(exports2, module2) {
|
|
11282
|
+
"use strict";
|
|
11283
|
+
var stringify = require_stringify();
|
|
11284
|
+
var {
|
|
11285
|
+
MAX_LENGTH,
|
|
11286
|
+
CHAR_BACKSLASH,
|
|
11287
|
+
/* \ */
|
|
11288
|
+
CHAR_BACKTICK,
|
|
11289
|
+
/* ` */
|
|
11290
|
+
CHAR_COMMA,
|
|
11291
|
+
/* , */
|
|
11292
|
+
CHAR_DOT,
|
|
11293
|
+
/* . */
|
|
11294
|
+
CHAR_LEFT_PARENTHESES,
|
|
11295
|
+
/* ( */
|
|
11296
|
+
CHAR_RIGHT_PARENTHESES,
|
|
11297
|
+
/* ) */
|
|
11298
|
+
CHAR_LEFT_CURLY_BRACE,
|
|
11299
|
+
/* { */
|
|
11300
|
+
CHAR_RIGHT_CURLY_BRACE,
|
|
11301
|
+
/* } */
|
|
11302
|
+
CHAR_LEFT_SQUARE_BRACKET,
|
|
11303
|
+
/* [ */
|
|
11304
|
+
CHAR_RIGHT_SQUARE_BRACKET,
|
|
11305
|
+
/* ] */
|
|
11306
|
+
CHAR_DOUBLE_QUOTE,
|
|
11307
|
+
/* " */
|
|
11308
|
+
CHAR_SINGLE_QUOTE,
|
|
11309
|
+
/* ' */
|
|
11310
|
+
CHAR_NO_BREAK_SPACE,
|
|
11311
|
+
CHAR_ZERO_WIDTH_NOBREAK_SPACE
|
|
11312
|
+
} = require_constants();
|
|
11313
|
+
var parse3 = (input, options = {}) => {
|
|
11314
|
+
if (typeof input !== "string") {
|
|
11315
|
+
throw new TypeError("Expected a string");
|
|
11316
|
+
}
|
|
11317
|
+
const opts = options || {};
|
|
11318
|
+
const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
|
11319
|
+
if (input.length > max) {
|
|
11320
|
+
throw new SyntaxError(`Input length (${input.length}), exceeds max characters (${max})`);
|
|
11321
|
+
}
|
|
11322
|
+
const ast = { type: "root", input, nodes: [] };
|
|
11323
|
+
const stack = [ast];
|
|
11324
|
+
let block = ast;
|
|
11325
|
+
let prev = ast;
|
|
11326
|
+
let brackets = 0;
|
|
11327
|
+
const length = input.length;
|
|
11328
|
+
let index = 0;
|
|
11329
|
+
let depth = 0;
|
|
11330
|
+
let value;
|
|
11331
|
+
const advance = () => input[index++];
|
|
11332
|
+
const push = (node) => {
|
|
11333
|
+
if (node.type === "text" && prev.type === "dot") {
|
|
11334
|
+
prev.type = "text";
|
|
11335
|
+
}
|
|
11336
|
+
if (prev && prev.type === "text" && node.type === "text") {
|
|
11337
|
+
prev.value += node.value;
|
|
11338
|
+
return;
|
|
11339
|
+
}
|
|
11340
|
+
block.nodes.push(node);
|
|
11341
|
+
node.parent = block;
|
|
11342
|
+
node.prev = prev;
|
|
11343
|
+
prev = node;
|
|
11344
|
+
return node;
|
|
11345
|
+
};
|
|
11346
|
+
push({ type: "bos" });
|
|
11347
|
+
while (index < length) {
|
|
11348
|
+
block = stack[stack.length - 1];
|
|
11349
|
+
value = advance();
|
|
11350
|
+
if (value === CHAR_ZERO_WIDTH_NOBREAK_SPACE || value === CHAR_NO_BREAK_SPACE) {
|
|
11351
|
+
continue;
|
|
11352
|
+
}
|
|
11353
|
+
if (value === CHAR_BACKSLASH) {
|
|
11354
|
+
push({ type: "text", value: (options.keepEscaping ? value : "") + advance() });
|
|
11355
|
+
continue;
|
|
11356
|
+
}
|
|
11357
|
+
if (value === CHAR_RIGHT_SQUARE_BRACKET) {
|
|
11358
|
+
push({ type: "text", value: "\\" + value });
|
|
11359
|
+
continue;
|
|
11360
|
+
}
|
|
11361
|
+
if (value === CHAR_LEFT_SQUARE_BRACKET) {
|
|
11362
|
+
brackets++;
|
|
11363
|
+
let next;
|
|
11364
|
+
while (index < length && (next = advance())) {
|
|
11365
|
+
value += next;
|
|
11366
|
+
if (next === CHAR_LEFT_SQUARE_BRACKET) {
|
|
11367
|
+
brackets++;
|
|
11368
|
+
continue;
|
|
11369
|
+
}
|
|
11370
|
+
if (next === CHAR_BACKSLASH) {
|
|
11371
|
+
value += advance();
|
|
11372
|
+
continue;
|
|
11373
|
+
}
|
|
11374
|
+
if (next === CHAR_RIGHT_SQUARE_BRACKET) {
|
|
11375
|
+
brackets--;
|
|
11376
|
+
if (brackets === 0) {
|
|
11377
|
+
break;
|
|
11378
|
+
}
|
|
11379
|
+
}
|
|
11380
|
+
}
|
|
11381
|
+
push({ type: "text", value });
|
|
11382
|
+
continue;
|
|
11383
|
+
}
|
|
11384
|
+
if (value === CHAR_LEFT_PARENTHESES) {
|
|
11385
|
+
block = push({ type: "paren", nodes: [] });
|
|
11386
|
+
stack.push(block);
|
|
11387
|
+
push({ type: "text", value });
|
|
11388
|
+
continue;
|
|
11389
|
+
}
|
|
11390
|
+
if (value === CHAR_RIGHT_PARENTHESES) {
|
|
11391
|
+
if (block.type !== "paren") {
|
|
11392
|
+
push({ type: "text", value });
|
|
11393
|
+
continue;
|
|
11394
|
+
}
|
|
11395
|
+
block = stack.pop();
|
|
11396
|
+
push({ type: "text", value });
|
|
11397
|
+
block = stack[stack.length - 1];
|
|
11398
|
+
continue;
|
|
11399
|
+
}
|
|
11400
|
+
if (value === CHAR_DOUBLE_QUOTE || value === CHAR_SINGLE_QUOTE || value === CHAR_BACKTICK) {
|
|
11401
|
+
const open2 = value;
|
|
11402
|
+
let next;
|
|
11403
|
+
if (options.keepQuotes !== true) {
|
|
11404
|
+
value = "";
|
|
11405
|
+
}
|
|
11406
|
+
while (index < length && (next = advance())) {
|
|
11407
|
+
if (next === CHAR_BACKSLASH) {
|
|
11408
|
+
value += next + advance();
|
|
11409
|
+
continue;
|
|
11410
|
+
}
|
|
11411
|
+
if (next === open2) {
|
|
11412
|
+
if (options.keepQuotes === true)
|
|
11413
|
+
value += next;
|
|
11414
|
+
break;
|
|
11415
|
+
}
|
|
11416
|
+
value += next;
|
|
11417
|
+
}
|
|
11418
|
+
push({ type: "text", value });
|
|
11419
|
+
continue;
|
|
11420
|
+
}
|
|
11421
|
+
if (value === CHAR_LEFT_CURLY_BRACE) {
|
|
11422
|
+
depth++;
|
|
11423
|
+
const dollar = prev.value && prev.value.slice(-1) === "$" || block.dollar === true;
|
|
11424
|
+
const brace = {
|
|
11425
|
+
type: "brace",
|
|
11426
|
+
open: true,
|
|
11427
|
+
close: false,
|
|
11428
|
+
dollar,
|
|
11429
|
+
depth,
|
|
11430
|
+
commas: 0,
|
|
11431
|
+
ranges: 0,
|
|
11432
|
+
nodes: []
|
|
11433
|
+
};
|
|
11434
|
+
block = push(brace);
|
|
11435
|
+
stack.push(block);
|
|
11436
|
+
push({ type: "open", value });
|
|
11437
|
+
continue;
|
|
11438
|
+
}
|
|
11439
|
+
if (value === CHAR_RIGHT_CURLY_BRACE) {
|
|
11440
|
+
if (block.type !== "brace") {
|
|
11441
|
+
push({ type: "text", value });
|
|
11442
|
+
continue;
|
|
11443
|
+
}
|
|
11444
|
+
const type = "close";
|
|
11445
|
+
block = stack.pop();
|
|
11446
|
+
block.close = true;
|
|
11447
|
+
push({ type, value });
|
|
11448
|
+
depth--;
|
|
11449
|
+
block = stack[stack.length - 1];
|
|
11450
|
+
continue;
|
|
11451
|
+
}
|
|
11452
|
+
if (value === CHAR_COMMA && depth > 0) {
|
|
11453
|
+
if (block.ranges > 0) {
|
|
11454
|
+
block.ranges = 0;
|
|
11455
|
+
const open2 = block.nodes.shift();
|
|
11456
|
+
block.nodes = [open2, { type: "text", value: stringify(block) }];
|
|
11457
|
+
}
|
|
11458
|
+
push({ type: "comma", value });
|
|
11459
|
+
block.commas++;
|
|
11460
|
+
continue;
|
|
11461
|
+
}
|
|
11462
|
+
if (value === CHAR_DOT && depth > 0 && block.commas === 0) {
|
|
11463
|
+
const siblings = block.nodes;
|
|
11464
|
+
if (depth === 0 || siblings.length === 0) {
|
|
11465
|
+
push({ type: "text", value });
|
|
11466
|
+
continue;
|
|
11467
|
+
}
|
|
11468
|
+
if (prev.type === "dot") {
|
|
11469
|
+
block.range = [];
|
|
11470
|
+
prev.value += value;
|
|
11471
|
+
prev.type = "range";
|
|
11472
|
+
if (block.nodes.length !== 3 && block.nodes.length !== 5) {
|
|
11473
|
+
block.invalid = true;
|
|
11474
|
+
block.ranges = 0;
|
|
11475
|
+
prev.type = "text";
|
|
11476
|
+
continue;
|
|
11477
|
+
}
|
|
11478
|
+
block.ranges++;
|
|
11479
|
+
block.args = [];
|
|
11480
|
+
continue;
|
|
11481
|
+
}
|
|
11482
|
+
if (prev.type === "range") {
|
|
11483
|
+
siblings.pop();
|
|
11484
|
+
const before = siblings[siblings.length - 1];
|
|
11485
|
+
before.value += prev.value + value;
|
|
11486
|
+
prev = before;
|
|
11487
|
+
block.ranges--;
|
|
11488
|
+
continue;
|
|
11489
|
+
}
|
|
11490
|
+
push({ type: "dot", value });
|
|
11491
|
+
continue;
|
|
11492
|
+
}
|
|
11493
|
+
push({ type: "text", value });
|
|
11494
|
+
}
|
|
11495
|
+
do {
|
|
11496
|
+
block = stack.pop();
|
|
11497
|
+
if (block.type !== "root") {
|
|
11498
|
+
block.nodes.forEach((node) => {
|
|
11499
|
+
if (!node.nodes) {
|
|
11500
|
+
if (node.type === "open")
|
|
11501
|
+
node.isOpen = true;
|
|
11502
|
+
if (node.type === "close")
|
|
11503
|
+
node.isClose = true;
|
|
11504
|
+
if (!node.nodes)
|
|
11505
|
+
node.type = "text";
|
|
11506
|
+
node.invalid = true;
|
|
11507
|
+
}
|
|
11508
|
+
});
|
|
11509
|
+
const parent = stack[stack.length - 1];
|
|
11510
|
+
const index2 = parent.nodes.indexOf(block);
|
|
11511
|
+
parent.nodes.splice(index2, 1, ...block.nodes);
|
|
11512
|
+
}
|
|
11513
|
+
} while (stack.length > 0);
|
|
11514
|
+
push({ type: "eos" });
|
|
11515
|
+
return ast;
|
|
11516
|
+
};
|
|
11517
|
+
module2.exports = parse3;
|
|
11518
|
+
}
|
|
11519
|
+
});
|
|
11520
|
+
|
|
11521
|
+
// node_modules/braces/index.js
|
|
11522
|
+
var require_braces = __commonJS({
|
|
11523
|
+
"node_modules/braces/index.js"(exports2, module2) {
|
|
11524
|
+
"use strict";
|
|
11525
|
+
var stringify = require_stringify();
|
|
11526
|
+
var compile = require_compile2();
|
|
11527
|
+
var expand = require_expand();
|
|
11528
|
+
var parse3 = require_parse();
|
|
11529
|
+
var braces = (input, options = {}) => {
|
|
11530
|
+
let output = [];
|
|
11531
|
+
if (Array.isArray(input)) {
|
|
11532
|
+
for (const pattern of input) {
|
|
11533
|
+
const result = braces.create(pattern, options);
|
|
11534
|
+
if (Array.isArray(result)) {
|
|
11535
|
+
output.push(...result);
|
|
11536
|
+
} else {
|
|
11537
|
+
output.push(result);
|
|
11538
|
+
}
|
|
11539
|
+
}
|
|
11540
|
+
} else {
|
|
11541
|
+
output = [].concat(braces.create(input, options));
|
|
11542
|
+
}
|
|
11543
|
+
if (options && options.expand === true && options.nodupes === true) {
|
|
11544
|
+
output = [...new Set(output)];
|
|
11545
|
+
}
|
|
11546
|
+
return output;
|
|
11547
|
+
};
|
|
11548
|
+
braces.parse = (input, options = {}) => parse3(input, options);
|
|
11549
|
+
braces.stringify = (input, options = {}) => {
|
|
11550
|
+
if (typeof input === "string") {
|
|
11551
|
+
return stringify(braces.parse(input, options), options);
|
|
11552
|
+
}
|
|
11553
|
+
return stringify(input, options);
|
|
11554
|
+
};
|
|
11555
|
+
braces.compile = (input, options = {}) => {
|
|
11556
|
+
if (typeof input === "string") {
|
|
11557
|
+
input = braces.parse(input, options);
|
|
11558
|
+
}
|
|
11559
|
+
return compile(input, options);
|
|
11560
|
+
};
|
|
11561
|
+
braces.expand = (input, options = {}) => {
|
|
11562
|
+
if (typeof input === "string") {
|
|
11563
|
+
input = braces.parse(input, options);
|
|
11564
|
+
}
|
|
11565
|
+
let result = expand(input, options);
|
|
11566
|
+
if (options.noempty === true) {
|
|
11567
|
+
result = result.filter(Boolean);
|
|
11568
|
+
}
|
|
11569
|
+
if (options.nodupes === true) {
|
|
11570
|
+
result = [...new Set(result)];
|
|
11571
|
+
}
|
|
11572
|
+
return result;
|
|
11573
|
+
};
|
|
11574
|
+
braces.create = (input, options = {}) => {
|
|
11575
|
+
if (input === "" || input.length < 3) {
|
|
11576
|
+
return [input];
|
|
11577
|
+
}
|
|
11578
|
+
return options.expand !== true ? braces.compile(input, options) : braces.expand(input, options);
|
|
11579
|
+
};
|
|
11580
|
+
module2.exports = braces;
|
|
11581
|
+
}
|
|
11582
|
+
});
|
|
11583
|
+
|
|
11584
|
+
// node_modules/micromatch/node_modules/picomatch/lib/constants.js
|
|
11585
|
+
var require_constants2 = __commonJS({
|
|
11586
|
+
"node_modules/micromatch/node_modules/picomatch/lib/constants.js"(exports2, module2) {
|
|
11587
|
+
"use strict";
|
|
11588
|
+
var path5 = require("path");
|
|
11589
|
+
var WIN_SLASH = "\\\\/";
|
|
11590
|
+
var WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
|
11591
|
+
var DEFAULT_MAX_EXTGLOB_RECURSION = 0;
|
|
11592
|
+
var DOT_LITERAL = "\\.";
|
|
11593
|
+
var PLUS_LITERAL = "\\+";
|
|
11594
|
+
var QMARK_LITERAL = "\\?";
|
|
11595
|
+
var SLASH_LITERAL = "\\/";
|
|
11596
|
+
var ONE_CHAR = "(?=.)";
|
|
11597
|
+
var QMARK = "[^/]";
|
|
11598
|
+
var END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
|
|
11599
|
+
var START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
|
|
11600
|
+
var DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
|
|
11601
|
+
var NO_DOT = `(?!${DOT_LITERAL})`;
|
|
11602
|
+
var NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
|
|
11603
|
+
var NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
|
|
11604
|
+
var NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
|
|
11605
|
+
var QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
|
|
11606
|
+
var STAR = `${QMARK}*?`;
|
|
11607
|
+
var POSIX_CHARS = {
|
|
11608
|
+
DOT_LITERAL,
|
|
11609
|
+
PLUS_LITERAL,
|
|
11610
|
+
QMARK_LITERAL,
|
|
11611
|
+
SLASH_LITERAL,
|
|
11612
|
+
ONE_CHAR,
|
|
11613
|
+
QMARK,
|
|
11614
|
+
END_ANCHOR,
|
|
11615
|
+
DOTS_SLASH,
|
|
11616
|
+
NO_DOT,
|
|
11617
|
+
NO_DOTS,
|
|
11618
|
+
NO_DOT_SLASH,
|
|
11619
|
+
NO_DOTS_SLASH,
|
|
11620
|
+
QMARK_NO_DOT,
|
|
11621
|
+
STAR,
|
|
11622
|
+
START_ANCHOR
|
|
11623
|
+
};
|
|
11624
|
+
var WINDOWS_CHARS = {
|
|
11625
|
+
...POSIX_CHARS,
|
|
11626
|
+
SLASH_LITERAL: `[${WIN_SLASH}]`,
|
|
11627
|
+
QMARK: WIN_NO_SLASH,
|
|
11628
|
+
STAR: `${WIN_NO_SLASH}*?`,
|
|
11629
|
+
DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
|
|
11630
|
+
NO_DOT: `(?!${DOT_LITERAL})`,
|
|
11631
|
+
NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
|
11632
|
+
NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
|
|
11633
|
+
NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
|
11634
|
+
QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
|
|
11635
|
+
START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
|
|
11636
|
+
END_ANCHOR: `(?:[${WIN_SLASH}]|$)`
|
|
11637
|
+
};
|
|
11638
|
+
var POSIX_REGEX_SOURCE = {
|
|
11639
|
+
__proto__: null,
|
|
11640
|
+
alnum: "a-zA-Z0-9",
|
|
11641
|
+
alpha: "a-zA-Z",
|
|
11642
|
+
ascii: "\\x00-\\x7F",
|
|
11643
|
+
blank: " \\t",
|
|
11644
|
+
cntrl: "\\x00-\\x1F\\x7F",
|
|
11645
|
+
digit: "0-9",
|
|
11646
|
+
graph: "\\x21-\\x7E",
|
|
11647
|
+
lower: "a-z",
|
|
11648
|
+
print: "\\x20-\\x7E ",
|
|
11649
|
+
punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",
|
|
11650
|
+
space: " \\t\\r\\n\\v\\f",
|
|
11651
|
+
upper: "A-Z",
|
|
11652
|
+
word: "A-Za-z0-9_",
|
|
11653
|
+
xdigit: "A-Fa-f0-9"
|
|
11654
|
+
};
|
|
11655
|
+
module2.exports = {
|
|
11656
|
+
DEFAULT_MAX_EXTGLOB_RECURSION,
|
|
11657
|
+
MAX_LENGTH: 1024 * 64,
|
|
11658
|
+
POSIX_REGEX_SOURCE,
|
|
11659
|
+
// regular expressions
|
|
11660
|
+
REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
|
|
11661
|
+
REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
|
|
11662
|
+
REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
|
|
11663
|
+
REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
|
|
11664
|
+
REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
|
|
11665
|
+
REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
|
|
11666
|
+
// Replace globs with equivalent patterns to reduce parsing time.
|
|
11667
|
+
REPLACEMENTS: {
|
|
11668
|
+
__proto__: null,
|
|
11669
|
+
"***": "*",
|
|
11670
|
+
"**/**": "**",
|
|
11671
|
+
"**/**/**": "**"
|
|
11672
|
+
},
|
|
11673
|
+
// Digits
|
|
11674
|
+
CHAR_0: 48,
|
|
11675
|
+
/* 0 */
|
|
11676
|
+
CHAR_9: 57,
|
|
11677
|
+
/* 9 */
|
|
11678
|
+
// Alphabet chars.
|
|
11679
|
+
CHAR_UPPERCASE_A: 65,
|
|
11680
|
+
/* A */
|
|
11681
|
+
CHAR_LOWERCASE_A: 97,
|
|
11682
|
+
/* a */
|
|
11683
|
+
CHAR_UPPERCASE_Z: 90,
|
|
11684
|
+
/* Z */
|
|
11685
|
+
CHAR_LOWERCASE_Z: 122,
|
|
11686
|
+
/* z */
|
|
11687
|
+
CHAR_LEFT_PARENTHESES: 40,
|
|
11688
|
+
/* ( */
|
|
11689
|
+
CHAR_RIGHT_PARENTHESES: 41,
|
|
11690
|
+
/* ) */
|
|
11691
|
+
CHAR_ASTERISK: 42,
|
|
11692
|
+
/* * */
|
|
11693
|
+
// Non-alphabetic chars.
|
|
11694
|
+
CHAR_AMPERSAND: 38,
|
|
11695
|
+
/* & */
|
|
11696
|
+
CHAR_AT: 64,
|
|
11697
|
+
/* @ */
|
|
11698
|
+
CHAR_BACKWARD_SLASH: 92,
|
|
11699
|
+
/* \ */
|
|
11700
|
+
CHAR_CARRIAGE_RETURN: 13,
|
|
11701
|
+
/* \r */
|
|
11702
|
+
CHAR_CIRCUMFLEX_ACCENT: 94,
|
|
11703
|
+
/* ^ */
|
|
11704
|
+
CHAR_COLON: 58,
|
|
11705
|
+
/* : */
|
|
11706
|
+
CHAR_COMMA: 44,
|
|
11707
|
+
/* , */
|
|
11708
|
+
CHAR_DOT: 46,
|
|
11709
|
+
/* . */
|
|
11710
|
+
CHAR_DOUBLE_QUOTE: 34,
|
|
11711
|
+
/* " */
|
|
11712
|
+
CHAR_EQUAL: 61,
|
|
11713
|
+
/* = */
|
|
11714
|
+
CHAR_EXCLAMATION_MARK: 33,
|
|
11715
|
+
/* ! */
|
|
11716
|
+
CHAR_FORM_FEED: 12,
|
|
11717
|
+
/* \f */
|
|
11718
|
+
CHAR_FORWARD_SLASH: 47,
|
|
11719
|
+
/* / */
|
|
11720
|
+
CHAR_GRAVE_ACCENT: 96,
|
|
11721
|
+
/* ` */
|
|
11722
|
+
CHAR_HASH: 35,
|
|
11723
|
+
/* # */
|
|
11724
|
+
CHAR_HYPHEN_MINUS: 45,
|
|
11725
|
+
/* - */
|
|
11726
|
+
CHAR_LEFT_ANGLE_BRACKET: 60,
|
|
11727
|
+
/* < */
|
|
11728
|
+
CHAR_LEFT_CURLY_BRACE: 123,
|
|
11729
|
+
/* { */
|
|
11730
|
+
CHAR_LEFT_SQUARE_BRACKET: 91,
|
|
11731
|
+
/* [ */
|
|
11732
|
+
CHAR_LINE_FEED: 10,
|
|
11733
|
+
/* \n */
|
|
11734
|
+
CHAR_NO_BREAK_SPACE: 160,
|
|
11735
|
+
/* \u00A0 */
|
|
11736
|
+
CHAR_PERCENT: 37,
|
|
11737
|
+
/* % */
|
|
11738
|
+
CHAR_PLUS: 43,
|
|
11739
|
+
/* + */
|
|
11740
|
+
CHAR_QUESTION_MARK: 63,
|
|
11741
|
+
/* ? */
|
|
11742
|
+
CHAR_RIGHT_ANGLE_BRACKET: 62,
|
|
11743
|
+
/* > */
|
|
11744
|
+
CHAR_RIGHT_CURLY_BRACE: 125,
|
|
11745
|
+
/* } */
|
|
11746
|
+
CHAR_RIGHT_SQUARE_BRACKET: 93,
|
|
11747
|
+
/* ] */
|
|
11748
|
+
CHAR_SEMICOLON: 59,
|
|
11749
|
+
/* ; */
|
|
11750
|
+
CHAR_SINGLE_QUOTE: 39,
|
|
11751
|
+
/* ' */
|
|
11752
|
+
CHAR_SPACE: 32,
|
|
11753
|
+
/* */
|
|
11754
|
+
CHAR_TAB: 9,
|
|
11755
|
+
/* \t */
|
|
11756
|
+
CHAR_UNDERSCORE: 95,
|
|
11757
|
+
/* _ */
|
|
11758
|
+
CHAR_VERTICAL_LINE: 124,
|
|
11759
|
+
/* | */
|
|
11760
|
+
CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
|
|
11761
|
+
/* \uFEFF */
|
|
11762
|
+
SEP: path5.sep,
|
|
11763
|
+
/**
|
|
11764
|
+
* Create EXTGLOB_CHARS
|
|
11765
|
+
*/
|
|
11766
|
+
extglobChars(chars) {
|
|
11767
|
+
return {
|
|
11768
|
+
"!": { type: "negate", open: "(?:(?!(?:", close: `))${chars.STAR})` },
|
|
11769
|
+
"?": { type: "qmark", open: "(?:", close: ")?" },
|
|
11770
|
+
"+": { type: "plus", open: "(?:", close: ")+" },
|
|
11771
|
+
"*": { type: "star", open: "(?:", close: ")*" },
|
|
11772
|
+
"@": { type: "at", open: "(?:", close: ")" }
|
|
11773
|
+
};
|
|
11774
|
+
},
|
|
11775
|
+
/**
|
|
11776
|
+
* Create GLOB_CHARS
|
|
11777
|
+
*/
|
|
11778
|
+
globChars(win32) {
|
|
11779
|
+
return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
|
|
11780
|
+
}
|
|
11781
|
+
};
|
|
11782
|
+
}
|
|
11783
|
+
});
|
|
11784
|
+
|
|
11785
|
+
// node_modules/micromatch/node_modules/picomatch/lib/utils.js
|
|
11786
|
+
var require_utils3 = __commonJS({
|
|
11787
|
+
"node_modules/micromatch/node_modules/picomatch/lib/utils.js"(exports2) {
|
|
11788
|
+
"use strict";
|
|
11789
|
+
var path5 = require("path");
|
|
11790
|
+
var win32 = process.platform === "win32";
|
|
11791
|
+
var {
|
|
11792
|
+
REGEX_BACKSLASH,
|
|
11793
|
+
REGEX_REMOVE_BACKSLASH,
|
|
11794
|
+
REGEX_SPECIAL_CHARS,
|
|
11795
|
+
REGEX_SPECIAL_CHARS_GLOBAL
|
|
11796
|
+
} = require_constants2();
|
|
11797
|
+
exports2.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
|
|
11798
|
+
exports2.hasRegexChars = (str) => REGEX_SPECIAL_CHARS.test(str);
|
|
11799
|
+
exports2.isRegexChar = (str) => str.length === 1 && exports2.hasRegexChars(str);
|
|
11800
|
+
exports2.escapeRegex = (str) => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, "\\$1");
|
|
11801
|
+
exports2.toPosixSlashes = (str) => str.replace(REGEX_BACKSLASH, "/");
|
|
11802
|
+
exports2.removeBackslashes = (str) => {
|
|
11803
|
+
return str.replace(REGEX_REMOVE_BACKSLASH, (match) => {
|
|
11804
|
+
return match === "\\" ? "" : match;
|
|
11805
|
+
});
|
|
11806
|
+
};
|
|
11807
|
+
exports2.supportsLookbehinds = () => {
|
|
11808
|
+
const segs = process.version.slice(1).split(".").map(Number);
|
|
11809
|
+
if (segs.length === 3 && segs[0] >= 9 || segs[0] === 8 && segs[1] >= 10) {
|
|
11810
|
+
return true;
|
|
11811
|
+
}
|
|
11812
|
+
return false;
|
|
11813
|
+
};
|
|
11814
|
+
exports2.isWindows = (options) => {
|
|
11815
|
+
if (options && typeof options.windows === "boolean") {
|
|
11816
|
+
return options.windows;
|
|
11817
|
+
}
|
|
11818
|
+
return win32 === true || path5.sep === "\\";
|
|
11819
|
+
};
|
|
11820
|
+
exports2.escapeLast = (input, char, lastIdx) => {
|
|
11821
|
+
const idx = input.lastIndexOf(char, lastIdx);
|
|
11822
|
+
if (idx === -1)
|
|
11823
|
+
return input;
|
|
11824
|
+
if (input[idx - 1] === "\\")
|
|
11825
|
+
return exports2.escapeLast(input, char, idx - 1);
|
|
11826
|
+
return `${input.slice(0, idx)}\\${input.slice(idx)}`;
|
|
11827
|
+
};
|
|
11828
|
+
exports2.removePrefix = (input, state = {}) => {
|
|
11829
|
+
let output = input;
|
|
11830
|
+
if (output.startsWith("./")) {
|
|
11831
|
+
output = output.slice(2);
|
|
11832
|
+
state.prefix = "./";
|
|
11833
|
+
}
|
|
11834
|
+
return output;
|
|
11835
|
+
};
|
|
11836
|
+
exports2.wrapOutput = (input, state = {}, options = {}) => {
|
|
11837
|
+
const prepend = options.contains ? "" : "^";
|
|
11838
|
+
const append = options.contains ? "" : "$";
|
|
11839
|
+
let output = `${prepend}(?:${input})${append}`;
|
|
11840
|
+
if (state.negated === true) {
|
|
11841
|
+
output = `(?:^(?!${output}).*$)`;
|
|
11842
|
+
}
|
|
11843
|
+
return output;
|
|
11844
|
+
};
|
|
11845
|
+
}
|
|
11846
|
+
});
|
|
11847
|
+
|
|
11848
|
+
// node_modules/micromatch/node_modules/picomatch/lib/scan.js
|
|
11849
|
+
var require_scan = __commonJS({
|
|
11850
|
+
"node_modules/micromatch/node_modules/picomatch/lib/scan.js"(exports2, module2) {
|
|
11851
|
+
"use strict";
|
|
11852
|
+
var utils = require_utils3();
|
|
11853
|
+
var {
|
|
11854
|
+
CHAR_ASTERISK,
|
|
11855
|
+
/* * */
|
|
11856
|
+
CHAR_AT,
|
|
11857
|
+
/* @ */
|
|
11858
|
+
CHAR_BACKWARD_SLASH,
|
|
11859
|
+
/* \ */
|
|
11860
|
+
CHAR_COMMA,
|
|
11861
|
+
/* , */
|
|
11862
|
+
CHAR_DOT,
|
|
11863
|
+
/* . */
|
|
11864
|
+
CHAR_EXCLAMATION_MARK,
|
|
11865
|
+
/* ! */
|
|
11866
|
+
CHAR_FORWARD_SLASH,
|
|
11867
|
+
/* / */
|
|
11868
|
+
CHAR_LEFT_CURLY_BRACE,
|
|
11869
|
+
/* { */
|
|
11870
|
+
CHAR_LEFT_PARENTHESES,
|
|
11871
|
+
/* ( */
|
|
11872
|
+
CHAR_LEFT_SQUARE_BRACKET,
|
|
11873
|
+
/* [ */
|
|
11874
|
+
CHAR_PLUS,
|
|
11875
|
+
/* + */
|
|
11876
|
+
CHAR_QUESTION_MARK,
|
|
11877
|
+
/* ? */
|
|
11878
|
+
CHAR_RIGHT_CURLY_BRACE,
|
|
11879
|
+
/* } */
|
|
11880
|
+
CHAR_RIGHT_PARENTHESES,
|
|
11881
|
+
/* ) */
|
|
11882
|
+
CHAR_RIGHT_SQUARE_BRACKET
|
|
11883
|
+
/* ] */
|
|
11884
|
+
} = require_constants2();
|
|
11885
|
+
var isPathSeparator = (code) => {
|
|
11886
|
+
return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
|
|
11887
|
+
};
|
|
11888
|
+
var depth = (token) => {
|
|
11889
|
+
if (token.isPrefix !== true) {
|
|
11890
|
+
token.depth = token.isGlobstar ? Infinity : 1;
|
|
11891
|
+
}
|
|
11892
|
+
};
|
|
11893
|
+
var scan = (input, options) => {
|
|
11894
|
+
const opts = options || {};
|
|
11895
|
+
const length = input.length - 1;
|
|
11896
|
+
const scanToEnd = opts.parts === true || opts.scanToEnd === true;
|
|
11897
|
+
const slashes = [];
|
|
11898
|
+
const tokens = [];
|
|
11899
|
+
const parts = [];
|
|
11900
|
+
let str = input;
|
|
11901
|
+
let index = -1;
|
|
11902
|
+
let start = 0;
|
|
11903
|
+
let lastIndex = 0;
|
|
11904
|
+
let isBrace = false;
|
|
11905
|
+
let isBracket = false;
|
|
11906
|
+
let isGlob = false;
|
|
11907
|
+
let isExtglob = false;
|
|
11908
|
+
let isGlobstar = false;
|
|
11909
|
+
let braceEscaped = false;
|
|
11910
|
+
let backslashes = false;
|
|
11911
|
+
let negated = false;
|
|
11912
|
+
let negatedExtglob = false;
|
|
11913
|
+
let finished = false;
|
|
11914
|
+
let braces = 0;
|
|
11915
|
+
let prev;
|
|
11916
|
+
let code;
|
|
11917
|
+
let token = { value: "", depth: 0, isGlob: false };
|
|
11918
|
+
const eos = () => index >= length;
|
|
11919
|
+
const peek = () => str.charCodeAt(index + 1);
|
|
11920
|
+
const advance = () => {
|
|
11921
|
+
prev = code;
|
|
11922
|
+
return str.charCodeAt(++index);
|
|
11923
|
+
};
|
|
11924
|
+
while (index < length) {
|
|
11925
|
+
code = advance();
|
|
11926
|
+
let next;
|
|
11927
|
+
if (code === CHAR_BACKWARD_SLASH) {
|
|
11928
|
+
backslashes = token.backslashes = true;
|
|
11929
|
+
code = advance();
|
|
11930
|
+
if (code === CHAR_LEFT_CURLY_BRACE) {
|
|
11931
|
+
braceEscaped = true;
|
|
11932
|
+
}
|
|
11933
|
+
continue;
|
|
11934
|
+
}
|
|
11935
|
+
if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
|
|
11936
|
+
braces++;
|
|
11937
|
+
while (eos() !== true && (code = advance())) {
|
|
11938
|
+
if (code === CHAR_BACKWARD_SLASH) {
|
|
11939
|
+
backslashes = token.backslashes = true;
|
|
11940
|
+
advance();
|
|
11941
|
+
continue;
|
|
11942
|
+
}
|
|
11943
|
+
if (code === CHAR_LEFT_CURLY_BRACE) {
|
|
11944
|
+
braces++;
|
|
11945
|
+
continue;
|
|
11946
|
+
}
|
|
11947
|
+
if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
|
|
11948
|
+
isBrace = token.isBrace = true;
|
|
11949
|
+
isGlob = token.isGlob = true;
|
|
11950
|
+
finished = true;
|
|
11951
|
+
if (scanToEnd === true) {
|
|
11952
|
+
continue;
|
|
11953
|
+
}
|
|
11954
|
+
break;
|
|
11955
|
+
}
|
|
11956
|
+
if (braceEscaped !== true && code === CHAR_COMMA) {
|
|
11957
|
+
isBrace = token.isBrace = true;
|
|
11958
|
+
isGlob = token.isGlob = true;
|
|
11959
|
+
finished = true;
|
|
11960
|
+
if (scanToEnd === true) {
|
|
11961
|
+
continue;
|
|
11962
|
+
}
|
|
11963
|
+
break;
|
|
11964
|
+
}
|
|
11965
|
+
if (code === CHAR_RIGHT_CURLY_BRACE) {
|
|
11966
|
+
braces--;
|
|
11967
|
+
if (braces === 0) {
|
|
11968
|
+
braceEscaped = false;
|
|
11969
|
+
isBrace = token.isBrace = true;
|
|
11970
|
+
finished = true;
|
|
11971
|
+
break;
|
|
11972
|
+
}
|
|
11973
|
+
}
|
|
11974
|
+
}
|
|
11975
|
+
if (scanToEnd === true) {
|
|
11976
|
+
continue;
|
|
11977
|
+
}
|
|
11978
|
+
break;
|
|
11979
|
+
}
|
|
11980
|
+
if (code === CHAR_FORWARD_SLASH) {
|
|
11981
|
+
slashes.push(index);
|
|
11982
|
+
tokens.push(token);
|
|
11983
|
+
token = { value: "", depth: 0, isGlob: false };
|
|
11984
|
+
if (finished === true)
|
|
11985
|
+
continue;
|
|
11986
|
+
if (prev === CHAR_DOT && index === start + 1) {
|
|
11987
|
+
start += 2;
|
|
11988
|
+
continue;
|
|
11989
|
+
}
|
|
11990
|
+
lastIndex = index + 1;
|
|
11991
|
+
continue;
|
|
11992
|
+
}
|
|
11993
|
+
if (opts.noext !== true) {
|
|
11994
|
+
const isExtglobChar = code === CHAR_PLUS || code === CHAR_AT || code === CHAR_ASTERISK || code === CHAR_QUESTION_MARK || code === CHAR_EXCLAMATION_MARK;
|
|
11995
|
+
if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) {
|
|
11996
|
+
isGlob = token.isGlob = true;
|
|
11997
|
+
isExtglob = token.isExtglob = true;
|
|
11998
|
+
finished = true;
|
|
11999
|
+
if (code === CHAR_EXCLAMATION_MARK && index === start) {
|
|
12000
|
+
negatedExtglob = true;
|
|
12001
|
+
}
|
|
12002
|
+
if (scanToEnd === true) {
|
|
12003
|
+
while (eos() !== true && (code = advance())) {
|
|
12004
|
+
if (code === CHAR_BACKWARD_SLASH) {
|
|
12005
|
+
backslashes = token.backslashes = true;
|
|
12006
|
+
code = advance();
|
|
12007
|
+
continue;
|
|
12008
|
+
}
|
|
12009
|
+
if (code === CHAR_RIGHT_PARENTHESES) {
|
|
12010
|
+
isGlob = token.isGlob = true;
|
|
12011
|
+
finished = true;
|
|
12012
|
+
break;
|
|
12013
|
+
}
|
|
12014
|
+
}
|
|
12015
|
+
continue;
|
|
12016
|
+
}
|
|
12017
|
+
break;
|
|
12018
|
+
}
|
|
12019
|
+
}
|
|
12020
|
+
if (code === CHAR_ASTERISK) {
|
|
12021
|
+
if (prev === CHAR_ASTERISK)
|
|
12022
|
+
isGlobstar = token.isGlobstar = true;
|
|
12023
|
+
isGlob = token.isGlob = true;
|
|
12024
|
+
finished = true;
|
|
12025
|
+
if (scanToEnd === true) {
|
|
12026
|
+
continue;
|
|
12027
|
+
}
|
|
12028
|
+
break;
|
|
12029
|
+
}
|
|
12030
|
+
if (code === CHAR_QUESTION_MARK) {
|
|
12031
|
+
isGlob = token.isGlob = true;
|
|
12032
|
+
finished = true;
|
|
12033
|
+
if (scanToEnd === true) {
|
|
12034
|
+
continue;
|
|
12035
|
+
}
|
|
12036
|
+
break;
|
|
12037
|
+
}
|
|
12038
|
+
if (code === CHAR_LEFT_SQUARE_BRACKET) {
|
|
12039
|
+
while (eos() !== true && (next = advance())) {
|
|
12040
|
+
if (next === CHAR_BACKWARD_SLASH) {
|
|
12041
|
+
backslashes = token.backslashes = true;
|
|
12042
|
+
advance();
|
|
12043
|
+
continue;
|
|
12044
|
+
}
|
|
12045
|
+
if (next === CHAR_RIGHT_SQUARE_BRACKET) {
|
|
12046
|
+
isBracket = token.isBracket = true;
|
|
12047
|
+
isGlob = token.isGlob = true;
|
|
12048
|
+
finished = true;
|
|
12049
|
+
break;
|
|
12050
|
+
}
|
|
12051
|
+
}
|
|
12052
|
+
if (scanToEnd === true) {
|
|
12053
|
+
continue;
|
|
12054
|
+
}
|
|
12055
|
+
break;
|
|
12056
|
+
}
|
|
12057
|
+
if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
|
|
12058
|
+
negated = token.negated = true;
|
|
12059
|
+
start++;
|
|
12060
|
+
continue;
|
|
12061
|
+
}
|
|
12062
|
+
if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
|
|
12063
|
+
isGlob = token.isGlob = true;
|
|
12064
|
+
if (scanToEnd === true) {
|
|
12065
|
+
while (eos() !== true && (code = advance())) {
|
|
12066
|
+
if (code === CHAR_LEFT_PARENTHESES) {
|
|
12067
|
+
backslashes = token.backslashes = true;
|
|
12068
|
+
code = advance();
|
|
12069
|
+
continue;
|
|
12070
|
+
}
|
|
12071
|
+
if (code === CHAR_RIGHT_PARENTHESES) {
|
|
12072
|
+
finished = true;
|
|
12073
|
+
break;
|
|
12074
|
+
}
|
|
12075
|
+
}
|
|
12076
|
+
continue;
|
|
12077
|
+
}
|
|
12078
|
+
break;
|
|
12079
|
+
}
|
|
12080
|
+
if (isGlob === true) {
|
|
12081
|
+
finished = true;
|
|
12082
|
+
if (scanToEnd === true) {
|
|
12083
|
+
continue;
|
|
12084
|
+
}
|
|
12085
|
+
break;
|
|
12086
|
+
}
|
|
12087
|
+
}
|
|
12088
|
+
if (opts.noext === true) {
|
|
12089
|
+
isExtglob = false;
|
|
12090
|
+
isGlob = false;
|
|
12091
|
+
}
|
|
12092
|
+
let base = str;
|
|
12093
|
+
let prefix = "";
|
|
12094
|
+
let glob = "";
|
|
12095
|
+
if (start > 0) {
|
|
12096
|
+
prefix = str.slice(0, start);
|
|
12097
|
+
str = str.slice(start);
|
|
12098
|
+
lastIndex -= start;
|
|
12099
|
+
}
|
|
12100
|
+
if (base && isGlob === true && lastIndex > 0) {
|
|
12101
|
+
base = str.slice(0, lastIndex);
|
|
12102
|
+
glob = str.slice(lastIndex);
|
|
12103
|
+
} else if (isGlob === true) {
|
|
12104
|
+
base = "";
|
|
12105
|
+
glob = str;
|
|
12106
|
+
} else {
|
|
12107
|
+
base = str;
|
|
12108
|
+
}
|
|
12109
|
+
if (base && base !== "" && base !== "/" && base !== str) {
|
|
12110
|
+
if (isPathSeparator(base.charCodeAt(base.length - 1))) {
|
|
12111
|
+
base = base.slice(0, -1);
|
|
12112
|
+
}
|
|
12113
|
+
}
|
|
12114
|
+
if (opts.unescape === true) {
|
|
12115
|
+
if (glob)
|
|
12116
|
+
glob = utils.removeBackslashes(glob);
|
|
12117
|
+
if (base && backslashes === true) {
|
|
12118
|
+
base = utils.removeBackslashes(base);
|
|
12119
|
+
}
|
|
12120
|
+
}
|
|
12121
|
+
const state = {
|
|
12122
|
+
prefix,
|
|
12123
|
+
input,
|
|
12124
|
+
start,
|
|
12125
|
+
base,
|
|
12126
|
+
glob,
|
|
12127
|
+
isBrace,
|
|
12128
|
+
isBracket,
|
|
12129
|
+
isGlob,
|
|
12130
|
+
isExtglob,
|
|
12131
|
+
isGlobstar,
|
|
12132
|
+
negated,
|
|
12133
|
+
negatedExtglob
|
|
12134
|
+
};
|
|
12135
|
+
if (opts.tokens === true) {
|
|
12136
|
+
state.maxDepth = 0;
|
|
12137
|
+
if (!isPathSeparator(code)) {
|
|
12138
|
+
tokens.push(token);
|
|
12139
|
+
}
|
|
12140
|
+
state.tokens = tokens;
|
|
12141
|
+
}
|
|
12142
|
+
if (opts.parts === true || opts.tokens === true) {
|
|
12143
|
+
let prevIndex;
|
|
12144
|
+
for (let idx = 0; idx < slashes.length; idx++) {
|
|
12145
|
+
const n = prevIndex ? prevIndex + 1 : start;
|
|
12146
|
+
const i = slashes[idx];
|
|
12147
|
+
const value = input.slice(n, i);
|
|
12148
|
+
if (opts.tokens) {
|
|
12149
|
+
if (idx === 0 && start !== 0) {
|
|
12150
|
+
tokens[idx].isPrefix = true;
|
|
12151
|
+
tokens[idx].value = prefix;
|
|
12152
|
+
} else {
|
|
12153
|
+
tokens[idx].value = value;
|
|
12154
|
+
}
|
|
12155
|
+
depth(tokens[idx]);
|
|
12156
|
+
state.maxDepth += tokens[idx].depth;
|
|
12157
|
+
}
|
|
12158
|
+
if (idx !== 0 || value !== "") {
|
|
12159
|
+
parts.push(value);
|
|
12160
|
+
}
|
|
12161
|
+
prevIndex = i;
|
|
12162
|
+
}
|
|
12163
|
+
if (prevIndex && prevIndex + 1 < input.length) {
|
|
12164
|
+
const value = input.slice(prevIndex + 1);
|
|
12165
|
+
parts.push(value);
|
|
12166
|
+
if (opts.tokens) {
|
|
12167
|
+
tokens[tokens.length - 1].value = value;
|
|
12168
|
+
depth(tokens[tokens.length - 1]);
|
|
12169
|
+
state.maxDepth += tokens[tokens.length - 1].depth;
|
|
12170
|
+
}
|
|
12171
|
+
}
|
|
12172
|
+
state.slashes = slashes;
|
|
12173
|
+
state.parts = parts;
|
|
12174
|
+
}
|
|
12175
|
+
return state;
|
|
12176
|
+
};
|
|
12177
|
+
module2.exports = scan;
|
|
12178
|
+
}
|
|
12179
|
+
});
|
|
12180
|
+
|
|
12181
|
+
// node_modules/micromatch/node_modules/picomatch/lib/parse.js
|
|
12182
|
+
var require_parse2 = __commonJS({
|
|
12183
|
+
"node_modules/micromatch/node_modules/picomatch/lib/parse.js"(exports2, module2) {
|
|
12184
|
+
"use strict";
|
|
12185
|
+
var constants = require_constants2();
|
|
12186
|
+
var utils = require_utils3();
|
|
12187
|
+
var {
|
|
12188
|
+
MAX_LENGTH,
|
|
12189
|
+
POSIX_REGEX_SOURCE,
|
|
12190
|
+
REGEX_NON_SPECIAL_CHARS,
|
|
12191
|
+
REGEX_SPECIAL_CHARS_BACKREF,
|
|
12192
|
+
REPLACEMENTS
|
|
12193
|
+
} = constants;
|
|
12194
|
+
var expandRange = (args, options) => {
|
|
12195
|
+
if (typeof options.expandRange === "function") {
|
|
12196
|
+
return options.expandRange(...args, options);
|
|
12197
|
+
}
|
|
12198
|
+
args.sort();
|
|
12199
|
+
const value = `[${args.join("-")}]`;
|
|
12200
|
+
try {
|
|
12201
|
+
new RegExp(value);
|
|
12202
|
+
} catch (ex) {
|
|
12203
|
+
return args.map((v) => utils.escapeRegex(v)).join("..");
|
|
12204
|
+
}
|
|
12205
|
+
return value;
|
|
12206
|
+
};
|
|
12207
|
+
var syntaxError = (type, char) => {
|
|
12208
|
+
return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
|
|
12209
|
+
};
|
|
12210
|
+
var splitTopLevel = (input) => {
|
|
12211
|
+
const parts = [];
|
|
12212
|
+
let bracket = 0;
|
|
12213
|
+
let paren = 0;
|
|
12214
|
+
let quote = 0;
|
|
12215
|
+
let value = "";
|
|
12216
|
+
let escaped = false;
|
|
12217
|
+
for (const ch of input) {
|
|
12218
|
+
if (escaped === true) {
|
|
12219
|
+
value += ch;
|
|
12220
|
+
escaped = false;
|
|
12221
|
+
continue;
|
|
12222
|
+
}
|
|
12223
|
+
if (ch === "\\") {
|
|
12224
|
+
value += ch;
|
|
12225
|
+
escaped = true;
|
|
12226
|
+
continue;
|
|
12227
|
+
}
|
|
12228
|
+
if (ch === '"') {
|
|
12229
|
+
quote = quote === 1 ? 0 : 1;
|
|
12230
|
+
value += ch;
|
|
12231
|
+
continue;
|
|
12232
|
+
}
|
|
12233
|
+
if (quote === 0) {
|
|
12234
|
+
if (ch === "[") {
|
|
12235
|
+
bracket++;
|
|
12236
|
+
} else if (ch === "]" && bracket > 0) {
|
|
12237
|
+
bracket--;
|
|
12238
|
+
} else if (bracket === 0) {
|
|
12239
|
+
if (ch === "(") {
|
|
12240
|
+
paren++;
|
|
12241
|
+
} else if (ch === ")" && paren > 0) {
|
|
12242
|
+
paren--;
|
|
12243
|
+
} else if (ch === "|" && paren === 0) {
|
|
12244
|
+
parts.push(value);
|
|
12245
|
+
value = "";
|
|
12246
|
+
continue;
|
|
12247
|
+
}
|
|
12248
|
+
}
|
|
12249
|
+
}
|
|
12250
|
+
value += ch;
|
|
12251
|
+
}
|
|
12252
|
+
parts.push(value);
|
|
12253
|
+
return parts;
|
|
12254
|
+
};
|
|
12255
|
+
var isPlainBranch = (branch) => {
|
|
12256
|
+
let escaped = false;
|
|
12257
|
+
for (const ch of branch) {
|
|
12258
|
+
if (escaped === true) {
|
|
12259
|
+
escaped = false;
|
|
12260
|
+
continue;
|
|
12261
|
+
}
|
|
12262
|
+
if (ch === "\\") {
|
|
12263
|
+
escaped = true;
|
|
12264
|
+
continue;
|
|
12265
|
+
}
|
|
12266
|
+
if (/[?*+@!()[\]{}]/.test(ch)) {
|
|
12267
|
+
return false;
|
|
12268
|
+
}
|
|
12269
|
+
}
|
|
12270
|
+
return true;
|
|
12271
|
+
};
|
|
12272
|
+
var normalizeSimpleBranch = (branch) => {
|
|
12273
|
+
let value = branch.trim();
|
|
12274
|
+
let changed = true;
|
|
12275
|
+
while (changed === true) {
|
|
12276
|
+
changed = false;
|
|
12277
|
+
if (/^@\([^\\()[\]{}|]+\)$/.test(value)) {
|
|
12278
|
+
value = value.slice(2, -1);
|
|
12279
|
+
changed = true;
|
|
12280
|
+
}
|
|
12281
|
+
}
|
|
12282
|
+
if (!isPlainBranch(value)) {
|
|
12283
|
+
return;
|
|
12284
|
+
}
|
|
12285
|
+
return value.replace(/\\(.)/g, "$1");
|
|
12286
|
+
};
|
|
12287
|
+
var hasRepeatedCharPrefixOverlap = (branches) => {
|
|
12288
|
+
const values = branches.map(normalizeSimpleBranch).filter(Boolean);
|
|
12289
|
+
for (let i = 0; i < values.length; i++) {
|
|
12290
|
+
for (let j = i + 1; j < values.length; j++) {
|
|
12291
|
+
const a = values[i];
|
|
12292
|
+
const b = values[j];
|
|
12293
|
+
const char = a[0];
|
|
12294
|
+
if (!char || a !== char.repeat(a.length) || b !== char.repeat(b.length)) {
|
|
12295
|
+
continue;
|
|
12296
|
+
}
|
|
12297
|
+
if (a === b || a.startsWith(b) || b.startsWith(a)) {
|
|
12298
|
+
return true;
|
|
12299
|
+
}
|
|
12300
|
+
}
|
|
12301
|
+
}
|
|
12302
|
+
return false;
|
|
12303
|
+
};
|
|
12304
|
+
var parseRepeatedExtglob = (pattern, requireEnd = true) => {
|
|
12305
|
+
if (pattern[0] !== "+" && pattern[0] !== "*" || pattern[1] !== "(") {
|
|
12306
|
+
return;
|
|
12307
|
+
}
|
|
12308
|
+
let bracket = 0;
|
|
12309
|
+
let paren = 0;
|
|
12310
|
+
let quote = 0;
|
|
12311
|
+
let escaped = false;
|
|
12312
|
+
for (let i = 1; i < pattern.length; i++) {
|
|
12313
|
+
const ch = pattern[i];
|
|
12314
|
+
if (escaped === true) {
|
|
12315
|
+
escaped = false;
|
|
12316
|
+
continue;
|
|
12317
|
+
}
|
|
12318
|
+
if (ch === "\\") {
|
|
12319
|
+
escaped = true;
|
|
12320
|
+
continue;
|
|
12321
|
+
}
|
|
12322
|
+
if (ch === '"') {
|
|
12323
|
+
quote = quote === 1 ? 0 : 1;
|
|
12324
|
+
continue;
|
|
12325
|
+
}
|
|
12326
|
+
if (quote === 1) {
|
|
12327
|
+
continue;
|
|
12328
|
+
}
|
|
12329
|
+
if (ch === "[") {
|
|
12330
|
+
bracket++;
|
|
12331
|
+
continue;
|
|
12332
|
+
}
|
|
12333
|
+
if (ch === "]" && bracket > 0) {
|
|
12334
|
+
bracket--;
|
|
12335
|
+
continue;
|
|
12336
|
+
}
|
|
12337
|
+
if (bracket > 0) {
|
|
12338
|
+
continue;
|
|
12339
|
+
}
|
|
12340
|
+
if (ch === "(") {
|
|
12341
|
+
paren++;
|
|
12342
|
+
continue;
|
|
12343
|
+
}
|
|
12344
|
+
if (ch === ")") {
|
|
12345
|
+
paren--;
|
|
12346
|
+
if (paren === 0) {
|
|
12347
|
+
if (requireEnd === true && i !== pattern.length - 1) {
|
|
12348
|
+
return;
|
|
12349
|
+
}
|
|
12350
|
+
return {
|
|
12351
|
+
type: pattern[0],
|
|
12352
|
+
body: pattern.slice(2, i),
|
|
12353
|
+
end: i
|
|
12354
|
+
};
|
|
12355
|
+
}
|
|
12356
|
+
}
|
|
12357
|
+
}
|
|
12358
|
+
};
|
|
12359
|
+
var getStarExtglobSequenceOutput = (pattern) => {
|
|
12360
|
+
let index = 0;
|
|
12361
|
+
const chars = [];
|
|
12362
|
+
while (index < pattern.length) {
|
|
12363
|
+
const match = parseRepeatedExtglob(pattern.slice(index), false);
|
|
12364
|
+
if (!match || match.type !== "*") {
|
|
12365
|
+
return;
|
|
12366
|
+
}
|
|
12367
|
+
const branches = splitTopLevel(match.body).map((branch2) => branch2.trim());
|
|
12368
|
+
if (branches.length !== 1) {
|
|
12369
|
+
return;
|
|
12370
|
+
}
|
|
12371
|
+
const branch = normalizeSimpleBranch(branches[0]);
|
|
12372
|
+
if (!branch || branch.length !== 1) {
|
|
12373
|
+
return;
|
|
12374
|
+
}
|
|
12375
|
+
chars.push(branch);
|
|
12376
|
+
index += match.end + 1;
|
|
12377
|
+
}
|
|
12378
|
+
if (chars.length < 1) {
|
|
12379
|
+
return;
|
|
12380
|
+
}
|
|
12381
|
+
const source = chars.length === 1 ? utils.escapeRegex(chars[0]) : `[${chars.map((ch) => utils.escapeRegex(ch)).join("")}]`;
|
|
12382
|
+
return `${source}*`;
|
|
12383
|
+
};
|
|
12384
|
+
var repeatedExtglobRecursion = (pattern) => {
|
|
12385
|
+
let depth = 0;
|
|
12386
|
+
let value = pattern.trim();
|
|
12387
|
+
let match = parseRepeatedExtglob(value);
|
|
12388
|
+
while (match) {
|
|
12389
|
+
depth++;
|
|
12390
|
+
value = match.body.trim();
|
|
12391
|
+
match = parseRepeatedExtglob(value);
|
|
12392
|
+
}
|
|
12393
|
+
return depth;
|
|
12394
|
+
};
|
|
12395
|
+
var analyzeRepeatedExtglob = (body, options) => {
|
|
12396
|
+
if (options.maxExtglobRecursion === false) {
|
|
12397
|
+
return { risky: false };
|
|
12398
|
+
}
|
|
12399
|
+
const max = typeof options.maxExtglobRecursion === "number" ? options.maxExtglobRecursion : constants.DEFAULT_MAX_EXTGLOB_RECURSION;
|
|
12400
|
+
const branches = splitTopLevel(body).map((branch) => branch.trim());
|
|
12401
|
+
if (branches.length > 1) {
|
|
12402
|
+
if (branches.some((branch) => branch === "") || branches.some((branch) => /^[*?]+$/.test(branch)) || hasRepeatedCharPrefixOverlap(branches)) {
|
|
12403
|
+
return { risky: true };
|
|
12404
|
+
}
|
|
12405
|
+
}
|
|
12406
|
+
for (const branch of branches) {
|
|
12407
|
+
const safeOutput = getStarExtglobSequenceOutput(branch);
|
|
12408
|
+
if (safeOutput) {
|
|
12409
|
+
return { risky: true, safeOutput };
|
|
12410
|
+
}
|
|
12411
|
+
if (repeatedExtglobRecursion(branch) > max) {
|
|
12412
|
+
return { risky: true };
|
|
12413
|
+
}
|
|
12414
|
+
}
|
|
12415
|
+
return { risky: false };
|
|
12416
|
+
};
|
|
12417
|
+
var parse3 = (input, options) => {
|
|
12418
|
+
if (typeof input !== "string") {
|
|
12419
|
+
throw new TypeError("Expected a string");
|
|
12420
|
+
}
|
|
12421
|
+
input = REPLACEMENTS[input] || input;
|
|
12422
|
+
const opts = { ...options };
|
|
12423
|
+
const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
|
12424
|
+
let len = input.length;
|
|
12425
|
+
if (len > max) {
|
|
12426
|
+
throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
|
|
12427
|
+
}
|
|
12428
|
+
const bos = { type: "bos", value: "", output: opts.prepend || "" };
|
|
12429
|
+
const tokens = [bos];
|
|
12430
|
+
const capture = opts.capture ? "" : "?:";
|
|
12431
|
+
const win32 = utils.isWindows(options);
|
|
12432
|
+
const PLATFORM_CHARS = constants.globChars(win32);
|
|
12433
|
+
const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS);
|
|
12434
|
+
const {
|
|
12435
|
+
DOT_LITERAL,
|
|
12436
|
+
PLUS_LITERAL,
|
|
12437
|
+
SLASH_LITERAL,
|
|
12438
|
+
ONE_CHAR,
|
|
12439
|
+
DOTS_SLASH,
|
|
12440
|
+
NO_DOT,
|
|
12441
|
+
NO_DOT_SLASH,
|
|
12442
|
+
NO_DOTS_SLASH,
|
|
12443
|
+
QMARK,
|
|
12444
|
+
QMARK_NO_DOT,
|
|
12445
|
+
STAR,
|
|
12446
|
+
START_ANCHOR
|
|
12447
|
+
} = PLATFORM_CHARS;
|
|
12448
|
+
const globstar = (opts2) => {
|
|
12449
|
+
return `(${capture}(?:(?!${START_ANCHOR}${opts2.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
|
|
12450
|
+
};
|
|
12451
|
+
const nodot = opts.dot ? "" : NO_DOT;
|
|
12452
|
+
const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
|
|
12453
|
+
let star = opts.bash === true ? globstar(opts) : STAR;
|
|
12454
|
+
if (opts.capture) {
|
|
12455
|
+
star = `(${star})`;
|
|
12456
|
+
}
|
|
12457
|
+
if (typeof opts.noext === "boolean") {
|
|
12458
|
+
opts.noextglob = opts.noext;
|
|
12459
|
+
}
|
|
12460
|
+
const state = {
|
|
12461
|
+
input,
|
|
12462
|
+
index: -1,
|
|
12463
|
+
start: 0,
|
|
12464
|
+
dot: opts.dot === true,
|
|
12465
|
+
consumed: "",
|
|
12466
|
+
output: "",
|
|
12467
|
+
prefix: "",
|
|
12468
|
+
backtrack: false,
|
|
12469
|
+
negated: false,
|
|
12470
|
+
brackets: 0,
|
|
12471
|
+
braces: 0,
|
|
12472
|
+
parens: 0,
|
|
12473
|
+
quotes: 0,
|
|
12474
|
+
globstar: false,
|
|
12475
|
+
tokens
|
|
12476
|
+
};
|
|
12477
|
+
input = utils.removePrefix(input, state);
|
|
12478
|
+
len = input.length;
|
|
12479
|
+
const extglobs = [];
|
|
12480
|
+
const braces = [];
|
|
12481
|
+
const stack = [];
|
|
12482
|
+
let prev = bos;
|
|
12483
|
+
let value;
|
|
12484
|
+
const eos = () => state.index === len - 1;
|
|
12485
|
+
const peek = state.peek = (n = 1) => input[state.index + n];
|
|
12486
|
+
const advance = state.advance = () => input[++state.index] || "";
|
|
12487
|
+
const remaining = () => input.slice(state.index + 1);
|
|
12488
|
+
const consume = (value2 = "", num = 0) => {
|
|
12489
|
+
state.consumed += value2;
|
|
12490
|
+
state.index += num;
|
|
12491
|
+
};
|
|
12492
|
+
const append = (token) => {
|
|
12493
|
+
state.output += token.output != null ? token.output : token.value;
|
|
12494
|
+
consume(token.value);
|
|
12495
|
+
};
|
|
12496
|
+
const negate = () => {
|
|
12497
|
+
let count = 1;
|
|
12498
|
+
while (peek() === "!" && (peek(2) !== "(" || peek(3) === "?")) {
|
|
12499
|
+
advance();
|
|
12500
|
+
state.start++;
|
|
12501
|
+
count++;
|
|
12502
|
+
}
|
|
12503
|
+
if (count % 2 === 0) {
|
|
12504
|
+
return false;
|
|
12505
|
+
}
|
|
12506
|
+
state.negated = true;
|
|
12507
|
+
state.start++;
|
|
12508
|
+
return true;
|
|
12509
|
+
};
|
|
12510
|
+
const increment = (type) => {
|
|
12511
|
+
state[type]++;
|
|
12512
|
+
stack.push(type);
|
|
12513
|
+
};
|
|
12514
|
+
const decrement = (type) => {
|
|
12515
|
+
state[type]--;
|
|
12516
|
+
stack.pop();
|
|
12517
|
+
};
|
|
12518
|
+
const push = (tok) => {
|
|
12519
|
+
if (prev.type === "globstar") {
|
|
12520
|
+
const isBrace = state.braces > 0 && (tok.type === "comma" || tok.type === "brace");
|
|
12521
|
+
const isExtglob = tok.extglob === true || extglobs.length && (tok.type === "pipe" || tok.type === "paren");
|
|
12522
|
+
if (tok.type !== "slash" && tok.type !== "paren" && !isBrace && !isExtglob) {
|
|
12523
|
+
state.output = state.output.slice(0, -prev.output.length);
|
|
12524
|
+
prev.type = "star";
|
|
12525
|
+
prev.value = "*";
|
|
12526
|
+
prev.output = star;
|
|
12527
|
+
state.output += prev.output;
|
|
12528
|
+
}
|
|
12529
|
+
}
|
|
12530
|
+
if (extglobs.length && tok.type !== "paren") {
|
|
12531
|
+
extglobs[extglobs.length - 1].inner += tok.value;
|
|
12532
|
+
}
|
|
12533
|
+
if (tok.value || tok.output)
|
|
12534
|
+
append(tok);
|
|
12535
|
+
if (prev && prev.type === "text" && tok.type === "text") {
|
|
12536
|
+
prev.value += tok.value;
|
|
12537
|
+
prev.output = (prev.output || "") + tok.value;
|
|
12538
|
+
return;
|
|
12539
|
+
}
|
|
12540
|
+
tok.prev = prev;
|
|
12541
|
+
tokens.push(tok);
|
|
12542
|
+
prev = tok;
|
|
12543
|
+
};
|
|
12544
|
+
const extglobOpen = (type, value2) => {
|
|
12545
|
+
const token = { ...EXTGLOB_CHARS[value2], conditions: 1, inner: "" };
|
|
12546
|
+
token.prev = prev;
|
|
12547
|
+
token.parens = state.parens;
|
|
12548
|
+
token.output = state.output;
|
|
12549
|
+
token.startIndex = state.index;
|
|
12550
|
+
token.tokensIndex = tokens.length;
|
|
12551
|
+
const output = (opts.capture ? "(" : "") + token.open;
|
|
12552
|
+
increment("parens");
|
|
12553
|
+
push({ type, value: value2, output: state.output ? "" : ONE_CHAR });
|
|
12554
|
+
push({ type: "paren", extglob: true, value: advance(), output });
|
|
12555
|
+
extglobs.push(token);
|
|
12556
|
+
};
|
|
12557
|
+
const extglobClose = (token) => {
|
|
12558
|
+
const literal2 = input.slice(token.startIndex, state.index + 1);
|
|
12559
|
+
const body = input.slice(token.startIndex + 2, state.index);
|
|
12560
|
+
const analysis = analyzeRepeatedExtglob(body, opts);
|
|
12561
|
+
if ((token.type === "plus" || token.type === "star") && analysis.risky) {
|
|
12562
|
+
const safeOutput = analysis.safeOutput ? (token.output ? "" : ONE_CHAR) + (opts.capture ? `(${analysis.safeOutput})` : analysis.safeOutput) : void 0;
|
|
12563
|
+
const open2 = tokens[token.tokensIndex];
|
|
12564
|
+
open2.type = "text";
|
|
12565
|
+
open2.value = literal2;
|
|
12566
|
+
open2.output = safeOutput || utils.escapeRegex(literal2);
|
|
12567
|
+
for (let i = token.tokensIndex + 1; i < tokens.length; i++) {
|
|
12568
|
+
tokens[i].value = "";
|
|
12569
|
+
tokens[i].output = "";
|
|
12570
|
+
delete tokens[i].suffix;
|
|
12571
|
+
}
|
|
12572
|
+
state.output = token.output + open2.output;
|
|
12573
|
+
state.backtrack = true;
|
|
12574
|
+
push({ type: "paren", extglob: true, value, output: "" });
|
|
12575
|
+
decrement("parens");
|
|
12576
|
+
return;
|
|
12577
|
+
}
|
|
12578
|
+
let output = token.close + (opts.capture ? ")" : "");
|
|
12579
|
+
let rest;
|
|
12580
|
+
if (token.type === "negate") {
|
|
12581
|
+
let extglobStar = star;
|
|
12582
|
+
if (token.inner && token.inner.length > 1 && token.inner.includes("/")) {
|
|
12583
|
+
extglobStar = globstar(opts);
|
|
12584
|
+
}
|
|
12585
|
+
if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) {
|
|
12586
|
+
output = token.close = `)$))${extglobStar}`;
|
|
12587
|
+
}
|
|
12588
|
+
if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
|
|
12589
|
+
const expression = parse3(rest, { ...options, fastpaths: false }).output;
|
|
12590
|
+
output = token.close = `)${expression})${extglobStar})`;
|
|
12591
|
+
}
|
|
12592
|
+
if (token.prev.type === "bos") {
|
|
12593
|
+
state.negatedExtglob = true;
|
|
12594
|
+
}
|
|
12595
|
+
}
|
|
12596
|
+
push({ type: "paren", extglob: true, value, output });
|
|
12597
|
+
decrement("parens");
|
|
12598
|
+
};
|
|
12599
|
+
if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
|
|
12600
|
+
let backslashes = false;
|
|
12601
|
+
let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc2, chars, first, rest, index) => {
|
|
12602
|
+
if (first === "\\") {
|
|
12603
|
+
backslashes = true;
|
|
12604
|
+
return m;
|
|
12605
|
+
}
|
|
12606
|
+
if (first === "?") {
|
|
12607
|
+
if (esc2) {
|
|
12608
|
+
return esc2 + first + (rest ? QMARK.repeat(rest.length) : "");
|
|
12609
|
+
}
|
|
12610
|
+
if (index === 0) {
|
|
12611
|
+
return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : "");
|
|
12612
|
+
}
|
|
12613
|
+
return QMARK.repeat(chars.length);
|
|
12614
|
+
}
|
|
12615
|
+
if (first === ".") {
|
|
12616
|
+
return DOT_LITERAL.repeat(chars.length);
|
|
12617
|
+
}
|
|
12618
|
+
if (first === "*") {
|
|
12619
|
+
if (esc2) {
|
|
12620
|
+
return esc2 + first + (rest ? star : "");
|
|
12621
|
+
}
|
|
12622
|
+
return star;
|
|
12623
|
+
}
|
|
12624
|
+
return esc2 ? m : `\\${m}`;
|
|
12625
|
+
});
|
|
12626
|
+
if (backslashes === true) {
|
|
12627
|
+
if (opts.unescape === true) {
|
|
12628
|
+
output = output.replace(/\\/g, "");
|
|
12629
|
+
} else {
|
|
12630
|
+
output = output.replace(/\\+/g, (m) => {
|
|
12631
|
+
return m.length % 2 === 0 ? "\\\\" : m ? "\\" : "";
|
|
12632
|
+
});
|
|
12633
|
+
}
|
|
12634
|
+
}
|
|
12635
|
+
if (output === input && opts.contains === true) {
|
|
12636
|
+
state.output = input;
|
|
12637
|
+
return state;
|
|
12638
|
+
}
|
|
12639
|
+
state.output = utils.wrapOutput(output, state, options);
|
|
12640
|
+
return state;
|
|
12641
|
+
}
|
|
12642
|
+
while (!eos()) {
|
|
12643
|
+
value = advance();
|
|
12644
|
+
if (value === "\0") {
|
|
12645
|
+
continue;
|
|
12646
|
+
}
|
|
12647
|
+
if (value === "\\") {
|
|
12648
|
+
const next = peek();
|
|
12649
|
+
if (next === "/" && opts.bash !== true) {
|
|
12650
|
+
continue;
|
|
12651
|
+
}
|
|
12652
|
+
if (next === "." || next === ";") {
|
|
12653
|
+
continue;
|
|
12654
|
+
}
|
|
12655
|
+
if (!next) {
|
|
12656
|
+
value += "\\";
|
|
12657
|
+
push({ type: "text", value });
|
|
12658
|
+
continue;
|
|
12659
|
+
}
|
|
12660
|
+
const match = /^\\+/.exec(remaining());
|
|
12661
|
+
let slashes = 0;
|
|
12662
|
+
if (match && match[0].length > 2) {
|
|
12663
|
+
slashes = match[0].length;
|
|
12664
|
+
state.index += slashes;
|
|
12665
|
+
if (slashes % 2 !== 0) {
|
|
12666
|
+
value += "\\";
|
|
12667
|
+
}
|
|
12668
|
+
}
|
|
12669
|
+
if (opts.unescape === true) {
|
|
12670
|
+
value = advance();
|
|
12671
|
+
} else {
|
|
12672
|
+
value += advance();
|
|
12673
|
+
}
|
|
12674
|
+
if (state.brackets === 0) {
|
|
12675
|
+
push({ type: "text", value });
|
|
12676
|
+
continue;
|
|
12677
|
+
}
|
|
12678
|
+
}
|
|
12679
|
+
if (state.brackets > 0 && (value !== "]" || prev.value === "[" || prev.value === "[^")) {
|
|
12680
|
+
if (opts.posix !== false && value === ":") {
|
|
12681
|
+
const inner = prev.value.slice(1);
|
|
12682
|
+
if (inner.includes("[")) {
|
|
12683
|
+
prev.posix = true;
|
|
12684
|
+
if (inner.includes(":")) {
|
|
12685
|
+
const idx = prev.value.lastIndexOf("[");
|
|
12686
|
+
const pre = prev.value.slice(0, idx);
|
|
12687
|
+
const rest2 = prev.value.slice(idx + 2);
|
|
12688
|
+
const posix = POSIX_REGEX_SOURCE[rest2];
|
|
12689
|
+
if (posix) {
|
|
12690
|
+
prev.value = pre + posix;
|
|
12691
|
+
state.backtrack = true;
|
|
12692
|
+
advance();
|
|
12693
|
+
if (!bos.output && tokens.indexOf(prev) === 1) {
|
|
12694
|
+
bos.output = ONE_CHAR;
|
|
12695
|
+
}
|
|
12696
|
+
continue;
|
|
12697
|
+
}
|
|
12698
|
+
}
|
|
12699
|
+
}
|
|
12700
|
+
}
|
|
12701
|
+
if (value === "[" && peek() !== ":" || value === "-" && peek() === "]") {
|
|
12702
|
+
value = `\\${value}`;
|
|
12703
|
+
}
|
|
12704
|
+
if (value === "]" && (prev.value === "[" || prev.value === "[^")) {
|
|
12705
|
+
value = `\\${value}`;
|
|
12706
|
+
}
|
|
12707
|
+
if (opts.posix === true && value === "!" && prev.value === "[") {
|
|
12708
|
+
value = "^";
|
|
12709
|
+
}
|
|
12710
|
+
prev.value += value;
|
|
12711
|
+
append({ value });
|
|
12712
|
+
continue;
|
|
12713
|
+
}
|
|
12714
|
+
if (state.quotes === 1 && value !== '"') {
|
|
12715
|
+
value = utils.escapeRegex(value);
|
|
12716
|
+
prev.value += value;
|
|
12717
|
+
append({ value });
|
|
12718
|
+
continue;
|
|
12719
|
+
}
|
|
12720
|
+
if (value === '"') {
|
|
12721
|
+
state.quotes = state.quotes === 1 ? 0 : 1;
|
|
12722
|
+
if (opts.keepQuotes === true) {
|
|
12723
|
+
push({ type: "text", value });
|
|
12724
|
+
}
|
|
12725
|
+
continue;
|
|
12726
|
+
}
|
|
12727
|
+
if (value === "(") {
|
|
12728
|
+
increment("parens");
|
|
12729
|
+
push({ type: "paren", value });
|
|
12730
|
+
continue;
|
|
12731
|
+
}
|
|
12732
|
+
if (value === ")") {
|
|
12733
|
+
if (state.parens === 0 && opts.strictBrackets === true) {
|
|
12734
|
+
throw new SyntaxError(syntaxError("opening", "("));
|
|
12735
|
+
}
|
|
12736
|
+
const extglob = extglobs[extglobs.length - 1];
|
|
12737
|
+
if (extglob && state.parens === extglob.parens + 1) {
|
|
12738
|
+
extglobClose(extglobs.pop());
|
|
12739
|
+
continue;
|
|
12740
|
+
}
|
|
12741
|
+
push({ type: "paren", value, output: state.parens ? ")" : "\\)" });
|
|
12742
|
+
decrement("parens");
|
|
12743
|
+
continue;
|
|
12744
|
+
}
|
|
12745
|
+
if (value === "[") {
|
|
12746
|
+
if (opts.nobracket === true || !remaining().includes("]")) {
|
|
12747
|
+
if (opts.nobracket !== true && opts.strictBrackets === true) {
|
|
12748
|
+
throw new SyntaxError(syntaxError("closing", "]"));
|
|
12749
|
+
}
|
|
12750
|
+
value = `\\${value}`;
|
|
12751
|
+
} else {
|
|
12752
|
+
increment("brackets");
|
|
12753
|
+
}
|
|
12754
|
+
push({ type: "bracket", value });
|
|
12755
|
+
continue;
|
|
12756
|
+
}
|
|
12757
|
+
if (value === "]") {
|
|
12758
|
+
if (opts.nobracket === true || prev && prev.type === "bracket" && prev.value.length === 1) {
|
|
12759
|
+
push({ type: "text", value, output: `\\${value}` });
|
|
12760
|
+
continue;
|
|
12761
|
+
}
|
|
12762
|
+
if (state.brackets === 0) {
|
|
12763
|
+
if (opts.strictBrackets === true) {
|
|
12764
|
+
throw new SyntaxError(syntaxError("opening", "["));
|
|
12765
|
+
}
|
|
12766
|
+
push({ type: "text", value, output: `\\${value}` });
|
|
12767
|
+
continue;
|
|
12768
|
+
}
|
|
12769
|
+
decrement("brackets");
|
|
12770
|
+
const prevValue = prev.value.slice(1);
|
|
12771
|
+
if (prev.posix !== true && prevValue[0] === "^" && !prevValue.includes("/")) {
|
|
12772
|
+
value = `/${value}`;
|
|
12773
|
+
}
|
|
12774
|
+
prev.value += value;
|
|
12775
|
+
append({ value });
|
|
12776
|
+
if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) {
|
|
12777
|
+
continue;
|
|
12778
|
+
}
|
|
12779
|
+
const escaped = utils.escapeRegex(prev.value);
|
|
12780
|
+
state.output = state.output.slice(0, -prev.value.length);
|
|
12781
|
+
if (opts.literalBrackets === true) {
|
|
12782
|
+
state.output += escaped;
|
|
12783
|
+
prev.value = escaped;
|
|
12784
|
+
continue;
|
|
12785
|
+
}
|
|
12786
|
+
prev.value = `(${capture}${escaped}|${prev.value})`;
|
|
12787
|
+
state.output += prev.value;
|
|
12788
|
+
continue;
|
|
12789
|
+
}
|
|
12790
|
+
if (value === "{" && opts.nobrace !== true) {
|
|
12791
|
+
increment("braces");
|
|
12792
|
+
const open2 = {
|
|
12793
|
+
type: "brace",
|
|
12794
|
+
value,
|
|
12795
|
+
output: "(",
|
|
12796
|
+
outputIndex: state.output.length,
|
|
12797
|
+
tokensIndex: state.tokens.length
|
|
12798
|
+
};
|
|
12799
|
+
braces.push(open2);
|
|
12800
|
+
push(open2);
|
|
12801
|
+
continue;
|
|
12802
|
+
}
|
|
12803
|
+
if (value === "}") {
|
|
12804
|
+
const brace = braces[braces.length - 1];
|
|
12805
|
+
if (opts.nobrace === true || !brace) {
|
|
12806
|
+
push({ type: "text", value, output: value });
|
|
12807
|
+
continue;
|
|
12808
|
+
}
|
|
12809
|
+
let output = ")";
|
|
12810
|
+
if (brace.dots === true) {
|
|
12811
|
+
const arr = tokens.slice();
|
|
12812
|
+
const range = [];
|
|
12813
|
+
for (let i = arr.length - 1; i >= 0; i--) {
|
|
12814
|
+
tokens.pop();
|
|
12815
|
+
if (arr[i].type === "brace") {
|
|
12816
|
+
break;
|
|
12817
|
+
}
|
|
12818
|
+
if (arr[i].type !== "dots") {
|
|
12819
|
+
range.unshift(arr[i].value);
|
|
12820
|
+
}
|
|
12821
|
+
}
|
|
12822
|
+
output = expandRange(range, opts);
|
|
12823
|
+
state.backtrack = true;
|
|
12824
|
+
}
|
|
12825
|
+
if (brace.comma !== true && brace.dots !== true) {
|
|
12826
|
+
const out = state.output.slice(0, brace.outputIndex);
|
|
12827
|
+
const toks = state.tokens.slice(brace.tokensIndex);
|
|
12828
|
+
brace.value = brace.output = "\\{";
|
|
12829
|
+
value = output = "\\}";
|
|
12830
|
+
state.output = out;
|
|
12831
|
+
for (const t of toks) {
|
|
12832
|
+
state.output += t.output || t.value;
|
|
12833
|
+
}
|
|
12834
|
+
}
|
|
12835
|
+
push({ type: "brace", value, output });
|
|
12836
|
+
decrement("braces");
|
|
12837
|
+
braces.pop();
|
|
12838
|
+
continue;
|
|
12839
|
+
}
|
|
12840
|
+
if (value === "|") {
|
|
12841
|
+
if (extglobs.length > 0) {
|
|
12842
|
+
extglobs[extglobs.length - 1].conditions++;
|
|
12843
|
+
}
|
|
12844
|
+
push({ type: "text", value });
|
|
12845
|
+
continue;
|
|
12846
|
+
}
|
|
12847
|
+
if (value === ",") {
|
|
12848
|
+
let output = value;
|
|
12849
|
+
const brace = braces[braces.length - 1];
|
|
12850
|
+
if (brace && stack[stack.length - 1] === "braces") {
|
|
12851
|
+
brace.comma = true;
|
|
12852
|
+
output = "|";
|
|
12853
|
+
}
|
|
12854
|
+
push({ type: "comma", value, output });
|
|
12855
|
+
continue;
|
|
12856
|
+
}
|
|
12857
|
+
if (value === "/") {
|
|
12858
|
+
if (prev.type === "dot" && state.index === state.start + 1) {
|
|
12859
|
+
state.start = state.index + 1;
|
|
12860
|
+
state.consumed = "";
|
|
12861
|
+
state.output = "";
|
|
12862
|
+
tokens.pop();
|
|
12863
|
+
prev = bos;
|
|
12864
|
+
continue;
|
|
12865
|
+
}
|
|
12866
|
+
push({ type: "slash", value, output: SLASH_LITERAL });
|
|
12867
|
+
continue;
|
|
12868
|
+
}
|
|
12869
|
+
if (value === ".") {
|
|
12870
|
+
if (state.braces > 0 && prev.type === "dot") {
|
|
12871
|
+
if (prev.value === ".")
|
|
12872
|
+
prev.output = DOT_LITERAL;
|
|
12873
|
+
const brace = braces[braces.length - 1];
|
|
12874
|
+
prev.type = "dots";
|
|
12875
|
+
prev.output += value;
|
|
12876
|
+
prev.value += value;
|
|
12877
|
+
brace.dots = true;
|
|
12878
|
+
continue;
|
|
12879
|
+
}
|
|
12880
|
+
if (state.braces + state.parens === 0 && prev.type !== "bos" && prev.type !== "slash") {
|
|
12881
|
+
push({ type: "text", value, output: DOT_LITERAL });
|
|
12882
|
+
continue;
|
|
12883
|
+
}
|
|
12884
|
+
push({ type: "dot", value, output: DOT_LITERAL });
|
|
12885
|
+
continue;
|
|
12886
|
+
}
|
|
12887
|
+
if (value === "?") {
|
|
12888
|
+
const isGroup = prev && prev.value === "(";
|
|
12889
|
+
if (!isGroup && opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
|
|
12890
|
+
extglobOpen("qmark", value);
|
|
12891
|
+
continue;
|
|
12892
|
+
}
|
|
12893
|
+
if (prev && prev.type === "paren") {
|
|
12894
|
+
const next = peek();
|
|
12895
|
+
let output = value;
|
|
12896
|
+
if (next === "<" && !utils.supportsLookbehinds()) {
|
|
12897
|
+
throw new Error("Node.js v10 or higher is required for regex lookbehinds");
|
|
12898
|
+
}
|
|
12899
|
+
if (prev.value === "(" && !/[!=<:]/.test(next) || next === "<" && !/<([!=]|\w+>)/.test(remaining())) {
|
|
12900
|
+
output = `\\${value}`;
|
|
12901
|
+
}
|
|
12902
|
+
push({ type: "text", value, output });
|
|
12903
|
+
continue;
|
|
12904
|
+
}
|
|
12905
|
+
if (opts.dot !== true && (prev.type === "slash" || prev.type === "bos")) {
|
|
12906
|
+
push({ type: "qmark", value, output: QMARK_NO_DOT });
|
|
12907
|
+
continue;
|
|
12908
|
+
}
|
|
12909
|
+
push({ type: "qmark", value, output: QMARK });
|
|
12910
|
+
continue;
|
|
12911
|
+
}
|
|
12912
|
+
if (value === "!") {
|
|
12913
|
+
if (opts.noextglob !== true && peek() === "(") {
|
|
12914
|
+
if (peek(2) !== "?" || !/[!=<:]/.test(peek(3))) {
|
|
12915
|
+
extglobOpen("negate", value);
|
|
12916
|
+
continue;
|
|
12917
|
+
}
|
|
12918
|
+
}
|
|
12919
|
+
if (opts.nonegate !== true && state.index === 0) {
|
|
12920
|
+
negate();
|
|
12921
|
+
continue;
|
|
12922
|
+
}
|
|
12923
|
+
}
|
|
12924
|
+
if (value === "+") {
|
|
12925
|
+
if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
|
|
12926
|
+
extglobOpen("plus", value);
|
|
12927
|
+
continue;
|
|
12928
|
+
}
|
|
12929
|
+
if (prev && prev.value === "(" || opts.regex === false) {
|
|
12930
|
+
push({ type: "plus", value, output: PLUS_LITERAL });
|
|
12931
|
+
continue;
|
|
12932
|
+
}
|
|
12933
|
+
if (prev && (prev.type === "bracket" || prev.type === "paren" || prev.type === "brace") || state.parens > 0) {
|
|
12934
|
+
push({ type: "plus", value });
|
|
12935
|
+
continue;
|
|
12936
|
+
}
|
|
12937
|
+
push({ type: "plus", value: PLUS_LITERAL });
|
|
12938
|
+
continue;
|
|
12939
|
+
}
|
|
12940
|
+
if (value === "@") {
|
|
12941
|
+
if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
|
|
12942
|
+
push({ type: "at", extglob: true, value, output: "" });
|
|
12943
|
+
continue;
|
|
12944
|
+
}
|
|
12945
|
+
push({ type: "text", value });
|
|
12946
|
+
continue;
|
|
12947
|
+
}
|
|
12948
|
+
if (value !== "*") {
|
|
12949
|
+
if (value === "$" || value === "^") {
|
|
12950
|
+
value = `\\${value}`;
|
|
12951
|
+
}
|
|
12952
|
+
const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
|
|
12953
|
+
if (match) {
|
|
12954
|
+
value += match[0];
|
|
12955
|
+
state.index += match[0].length;
|
|
12956
|
+
}
|
|
12957
|
+
push({ type: "text", value });
|
|
12958
|
+
continue;
|
|
12959
|
+
}
|
|
12960
|
+
if (prev && (prev.type === "globstar" || prev.star === true)) {
|
|
12961
|
+
prev.type = "star";
|
|
12962
|
+
prev.star = true;
|
|
12963
|
+
prev.value += value;
|
|
12964
|
+
prev.output = star;
|
|
12965
|
+
state.backtrack = true;
|
|
12966
|
+
state.globstar = true;
|
|
12967
|
+
consume(value);
|
|
12968
|
+
continue;
|
|
12969
|
+
}
|
|
12970
|
+
let rest = remaining();
|
|
12971
|
+
if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
|
|
12972
|
+
extglobOpen("star", value);
|
|
12973
|
+
continue;
|
|
12974
|
+
}
|
|
12975
|
+
if (prev.type === "star") {
|
|
12976
|
+
if (opts.noglobstar === true) {
|
|
12977
|
+
consume(value);
|
|
12978
|
+
continue;
|
|
12979
|
+
}
|
|
12980
|
+
const prior = prev.prev;
|
|
12981
|
+
const before = prior.prev;
|
|
12982
|
+
const isStart = prior.type === "slash" || prior.type === "bos";
|
|
12983
|
+
const afterStar = before && (before.type === "star" || before.type === "globstar");
|
|
12984
|
+
if (opts.bash === true && (!isStart || rest[0] && rest[0] !== "/")) {
|
|
12985
|
+
push({ type: "star", value, output: "" });
|
|
12986
|
+
continue;
|
|
12987
|
+
}
|
|
12988
|
+
const isBrace = state.braces > 0 && (prior.type === "comma" || prior.type === "brace");
|
|
12989
|
+
const isExtglob = extglobs.length && (prior.type === "pipe" || prior.type === "paren");
|
|
12990
|
+
if (!isStart && prior.type !== "paren" && !isBrace && !isExtglob) {
|
|
12991
|
+
push({ type: "star", value, output: "" });
|
|
12992
|
+
continue;
|
|
12993
|
+
}
|
|
12994
|
+
while (rest.slice(0, 3) === "/**") {
|
|
12995
|
+
const after = input[state.index + 4];
|
|
12996
|
+
if (after && after !== "/") {
|
|
12997
|
+
break;
|
|
12998
|
+
}
|
|
12999
|
+
rest = rest.slice(3);
|
|
13000
|
+
consume("/**", 3);
|
|
13001
|
+
}
|
|
13002
|
+
if (prior.type === "bos" && eos()) {
|
|
13003
|
+
prev.type = "globstar";
|
|
13004
|
+
prev.value += value;
|
|
13005
|
+
prev.output = globstar(opts);
|
|
13006
|
+
state.output = prev.output;
|
|
13007
|
+
state.globstar = true;
|
|
13008
|
+
consume(value);
|
|
13009
|
+
continue;
|
|
13010
|
+
}
|
|
13011
|
+
if (prior.type === "slash" && prior.prev.type !== "bos" && !afterStar && eos()) {
|
|
13012
|
+
state.output = state.output.slice(0, -(prior.output + prev.output).length);
|
|
13013
|
+
prior.output = `(?:${prior.output}`;
|
|
13014
|
+
prev.type = "globstar";
|
|
13015
|
+
prev.output = globstar(opts) + (opts.strictSlashes ? ")" : "|$)");
|
|
13016
|
+
prev.value += value;
|
|
13017
|
+
state.globstar = true;
|
|
13018
|
+
state.output += prior.output + prev.output;
|
|
13019
|
+
consume(value);
|
|
13020
|
+
continue;
|
|
13021
|
+
}
|
|
13022
|
+
if (prior.type === "slash" && prior.prev.type !== "bos" && rest[0] === "/") {
|
|
13023
|
+
const end = rest[1] !== void 0 ? "|$" : "";
|
|
13024
|
+
state.output = state.output.slice(0, -(prior.output + prev.output).length);
|
|
13025
|
+
prior.output = `(?:${prior.output}`;
|
|
13026
|
+
prev.type = "globstar";
|
|
13027
|
+
prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
|
|
13028
|
+
prev.value += value;
|
|
13029
|
+
state.output += prior.output + prev.output;
|
|
13030
|
+
state.globstar = true;
|
|
13031
|
+
consume(value + advance());
|
|
13032
|
+
push({ type: "slash", value: "/", output: "" });
|
|
13033
|
+
continue;
|
|
13034
|
+
}
|
|
13035
|
+
if (prior.type === "bos" && rest[0] === "/") {
|
|
13036
|
+
prev.type = "globstar";
|
|
13037
|
+
prev.value += value;
|
|
13038
|
+
prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
|
|
13039
|
+
state.output = prev.output;
|
|
13040
|
+
state.globstar = true;
|
|
13041
|
+
consume(value + advance());
|
|
13042
|
+
push({ type: "slash", value: "/", output: "" });
|
|
13043
|
+
continue;
|
|
13044
|
+
}
|
|
13045
|
+
state.output = state.output.slice(0, -prev.output.length);
|
|
13046
|
+
prev.type = "globstar";
|
|
13047
|
+
prev.output = globstar(opts);
|
|
13048
|
+
prev.value += value;
|
|
13049
|
+
state.output += prev.output;
|
|
13050
|
+
state.globstar = true;
|
|
13051
|
+
consume(value);
|
|
13052
|
+
continue;
|
|
13053
|
+
}
|
|
13054
|
+
const token = { type: "star", value, output: star };
|
|
13055
|
+
if (opts.bash === true) {
|
|
13056
|
+
token.output = ".*?";
|
|
13057
|
+
if (prev.type === "bos" || prev.type === "slash") {
|
|
13058
|
+
token.output = nodot + token.output;
|
|
13059
|
+
}
|
|
13060
|
+
push(token);
|
|
13061
|
+
continue;
|
|
13062
|
+
}
|
|
13063
|
+
if (prev && (prev.type === "bracket" || prev.type === "paren") && opts.regex === true) {
|
|
13064
|
+
token.output = value;
|
|
13065
|
+
push(token);
|
|
13066
|
+
continue;
|
|
13067
|
+
}
|
|
13068
|
+
if (state.index === state.start || prev.type === "slash" || prev.type === "dot") {
|
|
13069
|
+
if (prev.type === "dot") {
|
|
13070
|
+
state.output += NO_DOT_SLASH;
|
|
13071
|
+
prev.output += NO_DOT_SLASH;
|
|
13072
|
+
} else if (opts.dot === true) {
|
|
13073
|
+
state.output += NO_DOTS_SLASH;
|
|
13074
|
+
prev.output += NO_DOTS_SLASH;
|
|
13075
|
+
} else {
|
|
13076
|
+
state.output += nodot;
|
|
13077
|
+
prev.output += nodot;
|
|
13078
|
+
}
|
|
13079
|
+
if (peek() !== "*") {
|
|
13080
|
+
state.output += ONE_CHAR;
|
|
13081
|
+
prev.output += ONE_CHAR;
|
|
13082
|
+
}
|
|
13083
|
+
}
|
|
13084
|
+
push(token);
|
|
13085
|
+
}
|
|
13086
|
+
while (state.brackets > 0) {
|
|
13087
|
+
if (opts.strictBrackets === true)
|
|
13088
|
+
throw new SyntaxError(syntaxError("closing", "]"));
|
|
13089
|
+
state.output = utils.escapeLast(state.output, "[");
|
|
13090
|
+
decrement("brackets");
|
|
13091
|
+
}
|
|
13092
|
+
while (state.parens > 0) {
|
|
13093
|
+
if (opts.strictBrackets === true)
|
|
13094
|
+
throw new SyntaxError(syntaxError("closing", ")"));
|
|
13095
|
+
state.output = utils.escapeLast(state.output, "(");
|
|
13096
|
+
decrement("parens");
|
|
13097
|
+
}
|
|
13098
|
+
while (state.braces > 0) {
|
|
13099
|
+
if (opts.strictBrackets === true)
|
|
13100
|
+
throw new SyntaxError(syntaxError("closing", "}"));
|
|
13101
|
+
state.output = utils.escapeLast(state.output, "{");
|
|
13102
|
+
decrement("braces");
|
|
13103
|
+
}
|
|
13104
|
+
if (opts.strictSlashes !== true && (prev.type === "star" || prev.type === "bracket")) {
|
|
13105
|
+
push({ type: "maybe_slash", value: "", output: `${SLASH_LITERAL}?` });
|
|
13106
|
+
}
|
|
13107
|
+
if (state.backtrack === true) {
|
|
13108
|
+
state.output = "";
|
|
13109
|
+
for (const token of state.tokens) {
|
|
13110
|
+
state.output += token.output != null ? token.output : token.value;
|
|
13111
|
+
if (token.suffix) {
|
|
13112
|
+
state.output += token.suffix;
|
|
13113
|
+
}
|
|
13114
|
+
}
|
|
13115
|
+
}
|
|
13116
|
+
return state;
|
|
13117
|
+
};
|
|
13118
|
+
parse3.fastpaths = (input, options) => {
|
|
13119
|
+
const opts = { ...options };
|
|
13120
|
+
const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
|
13121
|
+
const len = input.length;
|
|
13122
|
+
if (len > max) {
|
|
13123
|
+
throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
|
|
13124
|
+
}
|
|
13125
|
+
input = REPLACEMENTS[input] || input;
|
|
13126
|
+
const win32 = utils.isWindows(options);
|
|
13127
|
+
const {
|
|
13128
|
+
DOT_LITERAL,
|
|
13129
|
+
SLASH_LITERAL,
|
|
13130
|
+
ONE_CHAR,
|
|
13131
|
+
DOTS_SLASH,
|
|
13132
|
+
NO_DOT,
|
|
13133
|
+
NO_DOTS,
|
|
13134
|
+
NO_DOTS_SLASH,
|
|
13135
|
+
STAR,
|
|
13136
|
+
START_ANCHOR
|
|
13137
|
+
} = constants.globChars(win32);
|
|
13138
|
+
const nodot = opts.dot ? NO_DOTS : NO_DOT;
|
|
13139
|
+
const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
|
|
13140
|
+
const capture = opts.capture ? "" : "?:";
|
|
13141
|
+
const state = { negated: false, prefix: "" };
|
|
13142
|
+
let star = opts.bash === true ? ".*?" : STAR;
|
|
13143
|
+
if (opts.capture) {
|
|
13144
|
+
star = `(${star})`;
|
|
13145
|
+
}
|
|
13146
|
+
const globstar = (opts2) => {
|
|
13147
|
+
if (opts2.noglobstar === true)
|
|
13148
|
+
return star;
|
|
13149
|
+
return `(${capture}(?:(?!${START_ANCHOR}${opts2.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
|
|
13150
|
+
};
|
|
13151
|
+
const create = (str) => {
|
|
13152
|
+
switch (str) {
|
|
13153
|
+
case "*":
|
|
13154
|
+
return `${nodot}${ONE_CHAR}${star}`;
|
|
13155
|
+
case ".*":
|
|
13156
|
+
return `${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
13157
|
+
case "*.*":
|
|
13158
|
+
return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
13159
|
+
case "*/*":
|
|
13160
|
+
return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
|
|
13161
|
+
case "**":
|
|
13162
|
+
return nodot + globstar(opts);
|
|
13163
|
+
case "**/*":
|
|
13164
|
+
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
|
|
13165
|
+
case "**/*.*":
|
|
13166
|
+
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
13167
|
+
case "**/.*":
|
|
13168
|
+
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
13169
|
+
default: {
|
|
13170
|
+
const match = /^(.*?)\.(\w+)$/.exec(str);
|
|
13171
|
+
if (!match)
|
|
13172
|
+
return;
|
|
13173
|
+
const source2 = create(match[1]);
|
|
13174
|
+
if (!source2)
|
|
13175
|
+
return;
|
|
13176
|
+
return source2 + DOT_LITERAL + match[2];
|
|
13177
|
+
}
|
|
13178
|
+
}
|
|
13179
|
+
};
|
|
13180
|
+
const output = utils.removePrefix(input, state);
|
|
13181
|
+
let source = create(output);
|
|
13182
|
+
if (source && opts.strictSlashes !== true) {
|
|
13183
|
+
source += `${SLASH_LITERAL}?`;
|
|
13184
|
+
}
|
|
13185
|
+
return source;
|
|
13186
|
+
};
|
|
13187
|
+
module2.exports = parse3;
|
|
13188
|
+
}
|
|
13189
|
+
});
|
|
13190
|
+
|
|
13191
|
+
// node_modules/micromatch/node_modules/picomatch/lib/picomatch.js
|
|
13192
|
+
var require_picomatch = __commonJS({
|
|
13193
|
+
"node_modules/micromatch/node_modules/picomatch/lib/picomatch.js"(exports2, module2) {
|
|
13194
|
+
"use strict";
|
|
13195
|
+
var path5 = require("path");
|
|
13196
|
+
var scan = require_scan();
|
|
13197
|
+
var parse3 = require_parse2();
|
|
13198
|
+
var utils = require_utils3();
|
|
13199
|
+
var constants = require_constants2();
|
|
13200
|
+
var isObject2 = (val) => val && typeof val === "object" && !Array.isArray(val);
|
|
13201
|
+
var picomatch = (glob, options, returnState = false) => {
|
|
13202
|
+
if (Array.isArray(glob)) {
|
|
13203
|
+
const fns = glob.map((input) => picomatch(input, options, returnState));
|
|
13204
|
+
const arrayMatcher = (str) => {
|
|
13205
|
+
for (const isMatch of fns) {
|
|
13206
|
+
const state2 = isMatch(str);
|
|
13207
|
+
if (state2)
|
|
13208
|
+
return state2;
|
|
13209
|
+
}
|
|
13210
|
+
return false;
|
|
13211
|
+
};
|
|
13212
|
+
return arrayMatcher;
|
|
13213
|
+
}
|
|
13214
|
+
const isState = isObject2(glob) && glob.tokens && glob.input;
|
|
13215
|
+
if (glob === "" || typeof glob !== "string" && !isState) {
|
|
13216
|
+
throw new TypeError("Expected pattern to be a non-empty string");
|
|
13217
|
+
}
|
|
13218
|
+
const opts = options || {};
|
|
13219
|
+
const posix = utils.isWindows(options);
|
|
13220
|
+
const regex = isState ? picomatch.compileRe(glob, options) : picomatch.makeRe(glob, options, false, true);
|
|
13221
|
+
const state = regex.state;
|
|
13222
|
+
delete regex.state;
|
|
13223
|
+
let isIgnored = () => false;
|
|
13224
|
+
if (opts.ignore) {
|
|
13225
|
+
const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null };
|
|
13226
|
+
isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
|
|
13227
|
+
}
|
|
13228
|
+
const matcher = (input, returnObject = false) => {
|
|
13229
|
+
const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix });
|
|
13230
|
+
const result = { glob, state, regex, posix, input, output, match, isMatch };
|
|
13231
|
+
if (typeof opts.onResult === "function") {
|
|
13232
|
+
opts.onResult(result);
|
|
13233
|
+
}
|
|
13234
|
+
if (isMatch === false) {
|
|
13235
|
+
result.isMatch = false;
|
|
13236
|
+
return returnObject ? result : false;
|
|
13237
|
+
}
|
|
13238
|
+
if (isIgnored(input)) {
|
|
13239
|
+
if (typeof opts.onIgnore === "function") {
|
|
13240
|
+
opts.onIgnore(result);
|
|
13241
|
+
}
|
|
13242
|
+
result.isMatch = false;
|
|
13243
|
+
return returnObject ? result : false;
|
|
13244
|
+
}
|
|
13245
|
+
if (typeof opts.onMatch === "function") {
|
|
13246
|
+
opts.onMatch(result);
|
|
13247
|
+
}
|
|
13248
|
+
return returnObject ? result : true;
|
|
13249
|
+
};
|
|
13250
|
+
if (returnState) {
|
|
13251
|
+
matcher.state = state;
|
|
13252
|
+
}
|
|
13253
|
+
return matcher;
|
|
13254
|
+
};
|
|
13255
|
+
picomatch.test = (input, regex, options, { glob, posix } = {}) => {
|
|
13256
|
+
if (typeof input !== "string") {
|
|
13257
|
+
throw new TypeError("Expected input to be a string");
|
|
13258
|
+
}
|
|
13259
|
+
if (input === "") {
|
|
13260
|
+
return { isMatch: false, output: "" };
|
|
13261
|
+
}
|
|
13262
|
+
const opts = options || {};
|
|
13263
|
+
const format = opts.format || (posix ? utils.toPosixSlashes : null);
|
|
13264
|
+
let match = input === glob;
|
|
13265
|
+
let output = match && format ? format(input) : input;
|
|
13266
|
+
if (match === false) {
|
|
13267
|
+
output = format ? format(input) : input;
|
|
13268
|
+
match = output === glob;
|
|
13269
|
+
}
|
|
13270
|
+
if (match === false || opts.capture === true) {
|
|
13271
|
+
if (opts.matchBase === true || opts.basename === true) {
|
|
13272
|
+
match = picomatch.matchBase(input, regex, options, posix);
|
|
13273
|
+
} else {
|
|
13274
|
+
match = regex.exec(output);
|
|
13275
|
+
}
|
|
13276
|
+
}
|
|
13277
|
+
return { isMatch: Boolean(match), match, output };
|
|
13278
|
+
};
|
|
13279
|
+
picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => {
|
|
13280
|
+
const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
|
|
13281
|
+
return regex.test(path5.basename(input));
|
|
13282
|
+
};
|
|
13283
|
+
picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
|
|
13284
|
+
picomatch.parse = (pattern, options) => {
|
|
13285
|
+
if (Array.isArray(pattern))
|
|
13286
|
+
return pattern.map((p) => picomatch.parse(p, options));
|
|
13287
|
+
return parse3(pattern, { ...options, fastpaths: false });
|
|
13288
|
+
};
|
|
13289
|
+
picomatch.scan = (input, options) => scan(input, options);
|
|
13290
|
+
picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => {
|
|
13291
|
+
if (returnOutput === true) {
|
|
13292
|
+
return state.output;
|
|
13293
|
+
}
|
|
13294
|
+
const opts = options || {};
|
|
13295
|
+
const prepend = opts.contains ? "" : "^";
|
|
13296
|
+
const append = opts.contains ? "" : "$";
|
|
13297
|
+
let source = `${prepend}(?:${state.output})${append}`;
|
|
13298
|
+
if (state && state.negated === true) {
|
|
13299
|
+
source = `^(?!${source}).*$`;
|
|
13300
|
+
}
|
|
13301
|
+
const regex = picomatch.toRegex(source, options);
|
|
13302
|
+
if (returnState === true) {
|
|
13303
|
+
regex.state = state;
|
|
13304
|
+
}
|
|
13305
|
+
return regex;
|
|
13306
|
+
};
|
|
13307
|
+
picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
|
|
13308
|
+
if (!input || typeof input !== "string") {
|
|
13309
|
+
throw new TypeError("Expected a non-empty string");
|
|
13310
|
+
}
|
|
13311
|
+
let parsed = { negated: false, fastpaths: true };
|
|
13312
|
+
if (options.fastpaths !== false && (input[0] === "." || input[0] === "*")) {
|
|
13313
|
+
parsed.output = parse3.fastpaths(input, options);
|
|
13314
|
+
}
|
|
13315
|
+
if (!parsed.output) {
|
|
13316
|
+
parsed = parse3(input, options);
|
|
13317
|
+
}
|
|
13318
|
+
return picomatch.compileRe(parsed, options, returnOutput, returnState);
|
|
13319
|
+
};
|
|
13320
|
+
picomatch.toRegex = (source, options) => {
|
|
13321
|
+
try {
|
|
13322
|
+
const opts = options || {};
|
|
13323
|
+
return new RegExp(source, opts.flags || (opts.nocase ? "i" : ""));
|
|
13324
|
+
} catch (err) {
|
|
13325
|
+
if (options && options.debug === true)
|
|
13326
|
+
throw err;
|
|
13327
|
+
return /$^/;
|
|
13328
|
+
}
|
|
13329
|
+
};
|
|
13330
|
+
picomatch.constants = constants;
|
|
13331
|
+
module2.exports = picomatch;
|
|
13332
|
+
}
|
|
13333
|
+
});
|
|
13334
|
+
|
|
13335
|
+
// node_modules/micromatch/node_modules/picomatch/index.js
|
|
13336
|
+
var require_picomatch2 = __commonJS({
|
|
13337
|
+
"node_modules/micromatch/node_modules/picomatch/index.js"(exports2, module2) {
|
|
13338
|
+
"use strict";
|
|
13339
|
+
module2.exports = require_picomatch();
|
|
13340
|
+
}
|
|
13341
|
+
});
|
|
13342
|
+
|
|
13343
|
+
// node_modules/micromatch/index.js
|
|
13344
|
+
var require_micromatch = __commonJS({
|
|
13345
|
+
"node_modules/micromatch/index.js"(exports2, module2) {
|
|
13346
|
+
"use strict";
|
|
13347
|
+
var util2 = require("util");
|
|
13348
|
+
var braces = require_braces();
|
|
13349
|
+
var picomatch = require_picomatch2();
|
|
13350
|
+
var utils = require_utils3();
|
|
13351
|
+
var isEmptyString = (v) => v === "" || v === "./";
|
|
13352
|
+
var hasBraces = (v) => {
|
|
13353
|
+
const index = v.indexOf("{");
|
|
13354
|
+
return index > -1 && v.indexOf("}", index) > -1;
|
|
13355
|
+
};
|
|
13356
|
+
var micromatch2 = (list, patterns, options) => {
|
|
13357
|
+
patterns = [].concat(patterns);
|
|
13358
|
+
list = [].concat(list);
|
|
13359
|
+
let omit2 = /* @__PURE__ */ new Set();
|
|
13360
|
+
let keep = /* @__PURE__ */ new Set();
|
|
13361
|
+
let items = /* @__PURE__ */ new Set();
|
|
13362
|
+
let negatives = 0;
|
|
13363
|
+
let onResult = (state) => {
|
|
13364
|
+
items.add(state.output);
|
|
13365
|
+
if (options && options.onResult) {
|
|
13366
|
+
options.onResult(state);
|
|
13367
|
+
}
|
|
13368
|
+
};
|
|
13369
|
+
for (let i = 0; i < patterns.length; i++) {
|
|
13370
|
+
let isMatch = picomatch(String(patterns[i]), { ...options, onResult }, true);
|
|
13371
|
+
let negated = isMatch.state.negated || isMatch.state.negatedExtglob;
|
|
13372
|
+
if (negated)
|
|
13373
|
+
negatives++;
|
|
13374
|
+
for (let item of list) {
|
|
13375
|
+
let matched = isMatch(item, true);
|
|
13376
|
+
let match = negated ? !matched.isMatch : matched.isMatch;
|
|
13377
|
+
if (!match)
|
|
13378
|
+
continue;
|
|
13379
|
+
if (negated) {
|
|
13380
|
+
omit2.add(matched.output);
|
|
13381
|
+
} else {
|
|
13382
|
+
omit2.delete(matched.output);
|
|
13383
|
+
keep.add(matched.output);
|
|
13384
|
+
}
|
|
13385
|
+
}
|
|
13386
|
+
}
|
|
13387
|
+
let result = negatives === patterns.length ? [...items] : [...keep];
|
|
13388
|
+
let matches = result.filter((item) => !omit2.has(item));
|
|
13389
|
+
if (options && matches.length === 0) {
|
|
13390
|
+
if (options.failglob === true) {
|
|
13391
|
+
throw new Error(`No matches found for "${patterns.join(", ")}"`);
|
|
13392
|
+
}
|
|
13393
|
+
if (options.nonull === true || options.nullglob === true) {
|
|
13394
|
+
return options.unescape ? patterns.map((p) => p.replace(/\\/g, "")) : patterns;
|
|
13395
|
+
}
|
|
13396
|
+
}
|
|
13397
|
+
return matches;
|
|
13398
|
+
};
|
|
13399
|
+
micromatch2.match = micromatch2;
|
|
13400
|
+
micromatch2.matcher = (pattern, options) => picomatch(pattern, options);
|
|
13401
|
+
micromatch2.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
|
|
13402
|
+
micromatch2.any = micromatch2.isMatch;
|
|
13403
|
+
micromatch2.not = (list, patterns, options = {}) => {
|
|
13404
|
+
patterns = [].concat(patterns).map(String);
|
|
13405
|
+
let result = /* @__PURE__ */ new Set();
|
|
13406
|
+
let items = [];
|
|
13407
|
+
let onResult = (state) => {
|
|
13408
|
+
if (options.onResult)
|
|
13409
|
+
options.onResult(state);
|
|
13410
|
+
items.push(state.output);
|
|
13411
|
+
};
|
|
13412
|
+
let matches = new Set(micromatch2(list, patterns, { ...options, onResult }));
|
|
13413
|
+
for (let item of items) {
|
|
13414
|
+
if (!matches.has(item)) {
|
|
13415
|
+
result.add(item);
|
|
13416
|
+
}
|
|
13417
|
+
}
|
|
13418
|
+
return [...result];
|
|
13419
|
+
};
|
|
13420
|
+
micromatch2.contains = (str, pattern, options) => {
|
|
13421
|
+
if (typeof str !== "string") {
|
|
13422
|
+
throw new TypeError(`Expected a string: "${util2.inspect(str)}"`);
|
|
13423
|
+
}
|
|
13424
|
+
if (Array.isArray(pattern)) {
|
|
13425
|
+
return pattern.some((p) => micromatch2.contains(str, p, options));
|
|
13426
|
+
}
|
|
13427
|
+
if (typeof pattern === "string") {
|
|
13428
|
+
if (isEmptyString(str) || isEmptyString(pattern)) {
|
|
13429
|
+
return false;
|
|
13430
|
+
}
|
|
13431
|
+
if (str.includes(pattern) || str.startsWith("./") && str.slice(2).includes(pattern)) {
|
|
13432
|
+
return true;
|
|
13433
|
+
}
|
|
13434
|
+
}
|
|
13435
|
+
return micromatch2.isMatch(str, pattern, { ...options, contains: true });
|
|
13436
|
+
};
|
|
13437
|
+
micromatch2.matchKeys = (obj, patterns, options) => {
|
|
13438
|
+
if (!utils.isObject(obj)) {
|
|
13439
|
+
throw new TypeError("Expected the first argument to be an object");
|
|
13440
|
+
}
|
|
13441
|
+
let keys = micromatch2(Object.keys(obj), patterns, options);
|
|
13442
|
+
let res = {};
|
|
13443
|
+
for (let key of keys)
|
|
13444
|
+
res[key] = obj[key];
|
|
13445
|
+
return res;
|
|
13446
|
+
};
|
|
13447
|
+
micromatch2.some = (list, patterns, options) => {
|
|
13448
|
+
let items = [].concat(list);
|
|
13449
|
+
for (let pattern of [].concat(patterns)) {
|
|
13450
|
+
let isMatch = picomatch(String(pattern), options);
|
|
13451
|
+
if (items.some((item) => isMatch(item))) {
|
|
13452
|
+
return true;
|
|
13453
|
+
}
|
|
13454
|
+
}
|
|
13455
|
+
return false;
|
|
13456
|
+
};
|
|
13457
|
+
micromatch2.every = (list, patterns, options) => {
|
|
13458
|
+
let items = [].concat(list);
|
|
13459
|
+
for (let pattern of [].concat(patterns)) {
|
|
13460
|
+
let isMatch = picomatch(String(pattern), options);
|
|
13461
|
+
if (!items.every((item) => isMatch(item))) {
|
|
13462
|
+
return false;
|
|
13463
|
+
}
|
|
13464
|
+
}
|
|
13465
|
+
return true;
|
|
13466
|
+
};
|
|
13467
|
+
micromatch2.all = (str, patterns, options) => {
|
|
13468
|
+
if (typeof str !== "string") {
|
|
13469
|
+
throw new TypeError(`Expected a string: "${util2.inspect(str)}"`);
|
|
13470
|
+
}
|
|
13471
|
+
return [].concat(patterns).every((p) => picomatch(p, options)(str));
|
|
13472
|
+
};
|
|
13473
|
+
micromatch2.capture = (glob, input, options) => {
|
|
13474
|
+
let posix = utils.isWindows(options);
|
|
13475
|
+
let regex = picomatch.makeRe(String(glob), { ...options, capture: true });
|
|
13476
|
+
let match = regex.exec(posix ? utils.toPosixSlashes(input) : input);
|
|
13477
|
+
if (match) {
|
|
13478
|
+
return match.slice(1).map((v) => v === void 0 ? "" : v);
|
|
13479
|
+
}
|
|
13480
|
+
};
|
|
13481
|
+
micromatch2.makeRe = (...args) => picomatch.makeRe(...args);
|
|
13482
|
+
micromatch2.scan = (...args) => picomatch.scan(...args);
|
|
13483
|
+
micromatch2.parse = (patterns, options) => {
|
|
13484
|
+
let res = [];
|
|
13485
|
+
for (let pattern of [].concat(patterns || [])) {
|
|
13486
|
+
for (let str of braces(String(pattern), options)) {
|
|
13487
|
+
res.push(picomatch.parse(str, options));
|
|
13488
|
+
}
|
|
13489
|
+
}
|
|
13490
|
+
return res;
|
|
13491
|
+
};
|
|
13492
|
+
micromatch2.braces = (pattern, options) => {
|
|
13493
|
+
if (typeof pattern !== "string")
|
|
13494
|
+
throw new TypeError("Expected a string");
|
|
13495
|
+
if (options && options.nobrace === true || !hasBraces(pattern)) {
|
|
13496
|
+
return [pattern];
|
|
13497
|
+
}
|
|
13498
|
+
return braces(pattern, options);
|
|
13499
|
+
};
|
|
13500
|
+
micromatch2.braceExpand = (pattern, options) => {
|
|
13501
|
+
if (typeof pattern !== "string")
|
|
13502
|
+
throw new TypeError("Expected a string");
|
|
13503
|
+
return micromatch2.braces(pattern, { ...options, expand: true });
|
|
13504
|
+
};
|
|
13505
|
+
micromatch2.hasBraces = hasBraces;
|
|
13506
|
+
module2.exports = micromatch2;
|
|
13507
|
+
}
|
|
13508
|
+
});
|
|
13509
|
+
|
|
10474
13510
|
// src/server.ts
|
|
10475
13511
|
var server_exports = {};
|
|
10476
13512
|
__export(server_exports, {
|
|
@@ -24665,7 +27701,7 @@ var StdioServerTransport = class {
|
|
|
24665
27701
|
};
|
|
24666
27702
|
|
|
24667
27703
|
// src/tools/read-file.ts
|
|
24668
|
-
var
|
|
27704
|
+
var fs5 = __toESM(require("fs/promises"));
|
|
24669
27705
|
|
|
24670
27706
|
// src/path-validation.ts
|
|
24671
27707
|
var import_promises = __toESM(require("fs/promises"));
|
|
@@ -24911,7 +27947,7 @@ import json
|
|
|
24911
27947
|
|
|
24912
27948
|
try:
|
|
24913
27949
|
with open(sys.argv[1], 'rb') as f:
|
|
24914
|
-
data = f.read(
|
|
27950
|
+
data = f.read(32768)
|
|
24915
27951
|
if not data:
|
|
24916
27952
|
print(json.dumps({"encoding": None, "confidence": 0.0}))
|
|
24917
27953
|
else:
|
|
@@ -24996,6 +28032,60 @@ async function isBinaryFile(filePath) {
|
|
|
24996
28032
|
}
|
|
24997
28033
|
}
|
|
24998
28034
|
|
|
28035
|
+
// src/config.ts
|
|
28036
|
+
var fs4 = __toESM(require("fs/promises"));
|
|
28037
|
+
var path4 = __toESM(require("path"));
|
|
28038
|
+
var import_micromatch = __toESM(require_micromatch());
|
|
28039
|
+
var DEFAULT_CONFIG = {
|
|
28040
|
+
sourceEncoding: "GB18030",
|
|
28041
|
+
targetEncoding: "UTF-8",
|
|
28042
|
+
confidenceThreshold: 0.8
|
|
28043
|
+
};
|
|
28044
|
+
async function loadProjectConfig(cwd) {
|
|
28045
|
+
const configPath = path4.join(cwd, ".encoding-converter.json");
|
|
28046
|
+
try {
|
|
28047
|
+
const content = await fs4.readFile(configPath, "utf-8");
|
|
28048
|
+
const parsed = JSON.parse(content);
|
|
28049
|
+
return { ...DEFAULT_CONFIG, ...parsed };
|
|
28050
|
+
} catch (err) {
|
|
28051
|
+
if (err.code !== "ENOENT") {
|
|
28052
|
+
log("error", "Failed to parse config file", { path: configPath, error: err.message });
|
|
28053
|
+
}
|
|
28054
|
+
return { ...DEFAULT_CONFIG };
|
|
28055
|
+
}
|
|
28056
|
+
}
|
|
28057
|
+
function scoreSpecificity(pattern) {
|
|
28058
|
+
if (!pattern)
|
|
28059
|
+
return 0;
|
|
28060
|
+
const segments = pattern.split("/");
|
|
28061
|
+
let score = 0;
|
|
28062
|
+
for (const seg of segments) {
|
|
28063
|
+
if (seg === "**")
|
|
28064
|
+
score += 1;
|
|
28065
|
+
else if (seg === "*")
|
|
28066
|
+
score += 2;
|
|
28067
|
+
else if (seg.includes("*") || seg.includes("?"))
|
|
28068
|
+
score += 5;
|
|
28069
|
+
else
|
|
28070
|
+
score += 10;
|
|
28071
|
+
}
|
|
28072
|
+
return score;
|
|
28073
|
+
}
|
|
28074
|
+
function resolveEncoding(relativePath, config3) {
|
|
28075
|
+
if (!config3.overrides?.length)
|
|
28076
|
+
return config3.sourceEncoding;
|
|
28077
|
+
const matches = config3.overrides.map((rule, index) => ({ rule, score: scoreSpecificity(rule.pattern), index })).filter((item) => {
|
|
28078
|
+
if (!item.rule.pattern)
|
|
28079
|
+
return false;
|
|
28080
|
+
const isBare = !item.rule.pattern.includes("/");
|
|
28081
|
+
return import_micromatch.default.isMatch(relativePath, item.rule.pattern, isBare ? { matchBase: true } : void 0);
|
|
28082
|
+
}).sort((a, b) => b.score - a.score || a.index - b.index);
|
|
28083
|
+
return matches[0]?.rule.sourceEncoding ?? config3.sourceEncoding;
|
|
28084
|
+
}
|
|
28085
|
+
function toRelativePath(validPath, allowedDir) {
|
|
28086
|
+
return path4.relative(allowedDir, validPath).replace(/\\/g, "/");
|
|
28087
|
+
}
|
|
28088
|
+
|
|
24999
28089
|
// src/tools/read-file.ts
|
|
25000
28090
|
function registerReadFile(server2, config3, allowedDirectories) {
|
|
25001
28091
|
server2.registerTool(
|
|
@@ -25018,7 +28108,11 @@ function registerReadFile(server2, config3, allowedDirectories) {
|
|
|
25018
28108
|
if (await isBinaryFile(validPath)) {
|
|
25019
28109
|
throw new Error("Binary file, cannot process as text");
|
|
25020
28110
|
}
|
|
25021
|
-
const buffer = await
|
|
28111
|
+
const buffer = await fs5.readFile(validPath);
|
|
28112
|
+
const resolvedSourceEncoding = resolveEncoding(
|
|
28113
|
+
toRelativePath(validPath, allowedDirectories[0]),
|
|
28114
|
+
config3
|
|
28115
|
+
);
|
|
25022
28116
|
const detection = await detectEncoding(validPath);
|
|
25023
28117
|
let text;
|
|
25024
28118
|
const detectedEncoding = detection.encoding;
|
|
@@ -25027,9 +28121,9 @@ function registerReadFile(server2, config3, allowedDirectories) {
|
|
|
25027
28121
|
text = decodeToUtf8(buffer, detectedEncoding);
|
|
25028
28122
|
} else if (detectedEncoding && isUtf8Encoding(detectedEncoding)) {
|
|
25029
28123
|
text = buffer.toString("utf-8");
|
|
25030
|
-
} else if (
|
|
25031
|
-
log("info", "
|
|
25032
|
-
text = decodeToUtf8(buffer,
|
|
28124
|
+
} else if (isGBEncoding(resolvedSourceEncoding)) {
|
|
28125
|
+
log("info", "Falling back to resolved sourceEncoding", { path: args.path, encoding: resolvedSourceEncoding, detected: detectedEncoding, confidence: detection.confidence });
|
|
28126
|
+
text = decodeToUtf8(buffer, resolvedSourceEncoding);
|
|
25033
28127
|
} else {
|
|
25034
28128
|
text = buffer.toString("utf-8");
|
|
25035
28129
|
}
|
|
@@ -25048,7 +28142,7 @@ function registerReadFile(server2, config3, allowedDirectories) {
|
|
|
25048
28142
|
}
|
|
25049
28143
|
|
|
25050
28144
|
// src/tools/write-file.ts
|
|
25051
|
-
var
|
|
28145
|
+
var fs6 = __toESM(require("fs/promises"));
|
|
25052
28146
|
var import_crypto = require("crypto");
|
|
25053
28147
|
|
|
25054
28148
|
// src/encoding/line-endings.ts
|
|
@@ -25091,10 +28185,13 @@ function registerWriteFile(server2, config3, allowedDirectories) {
|
|
|
25091
28185
|
},
|
|
25092
28186
|
async (args) => {
|
|
25093
28187
|
const validPath = await validatePath(args.path, allowedDirectories);
|
|
25094
|
-
let targetEncoding =
|
|
28188
|
+
let targetEncoding = resolveEncoding(
|
|
28189
|
+
toRelativePath(validPath, allowedDirectories[0]),
|
|
28190
|
+
config3
|
|
28191
|
+
);
|
|
25095
28192
|
let lineEndingStyle = process.platform === "win32" ? "CRLF" : "LF";
|
|
25096
28193
|
try {
|
|
25097
|
-
const existingBuffer = await
|
|
28194
|
+
const existingBuffer = await fs6.readFile(validPath);
|
|
25098
28195
|
lineEndingStyle = detectLineEnding(existingBuffer);
|
|
25099
28196
|
const detection = await detectEncoding(validPath);
|
|
25100
28197
|
if (detection.encoding && isUtf8Encoding(detection.encoding)) {
|
|
@@ -25107,16 +28204,16 @@ function registerWriteFile(server2, config3, allowedDirectories) {
|
|
|
25107
28204
|
const finalContent = restoreLineEndings(args.content, lineEndingStyle);
|
|
25108
28205
|
const encoded = encodeFromUtf8(finalContent, targetEncoding);
|
|
25109
28206
|
try {
|
|
25110
|
-
await
|
|
28207
|
+
await fs6.writeFile(validPath, encoded, { flag: "wx" });
|
|
25111
28208
|
} catch (error2) {
|
|
25112
28209
|
if (error2.code === "EEXIST") {
|
|
25113
28210
|
const tempPath = `${validPath}.${(0, import_crypto.randomBytes)(16).toString("hex")}.tmp`;
|
|
25114
28211
|
try {
|
|
25115
|
-
await
|
|
25116
|
-
await
|
|
28212
|
+
await fs6.writeFile(tempPath, encoded);
|
|
28213
|
+
await fs6.rename(tempPath, validPath);
|
|
25117
28214
|
} catch (renameError) {
|
|
25118
28215
|
try {
|
|
25119
|
-
await
|
|
28216
|
+
await fs6.unlink(tempPath);
|
|
25120
28217
|
} catch {
|
|
25121
28218
|
}
|
|
25122
28219
|
throw renameError;
|
|
@@ -25133,7 +28230,7 @@ function registerWriteFile(server2, config3, allowedDirectories) {
|
|
|
25133
28230
|
}
|
|
25134
28231
|
|
|
25135
28232
|
// src/tools/edit-file.ts
|
|
25136
|
-
var
|
|
28233
|
+
var fs7 = __toESM(require("fs/promises"));
|
|
25137
28234
|
var import_crypto2 = require("crypto");
|
|
25138
28235
|
|
|
25139
28236
|
// node_modules/diff/libesm/diff/base.js
|
|
@@ -25633,14 +28730,20 @@ function registerEditFile(server2, config3, allowedDirectories) {
|
|
|
25633
28730
|
},
|
|
25634
28731
|
async (args) => {
|
|
25635
28732
|
const validPath = await validatePath(args.path, allowedDirectories);
|
|
25636
|
-
const buffer = await
|
|
28733
|
+
const buffer = await fs7.readFile(validPath);
|
|
25637
28734
|
const originalLineEnding = detectLineEnding(buffer);
|
|
25638
28735
|
const detection = await detectEncoding(validPath);
|
|
28736
|
+
const resolvedSourceEncoding = resolveEncoding(
|
|
28737
|
+
toRelativePath(validPath, allowedDirectories[0]),
|
|
28738
|
+
config3
|
|
28739
|
+
);
|
|
25639
28740
|
let originalEncoding = "UTF-8";
|
|
25640
|
-
if (detection.encoding && detection.confidence >= config3.confidenceThreshold
|
|
25641
|
-
|
|
25642
|
-
|
|
25643
|
-
|
|
28741
|
+
if (detection.encoding && detection.confidence >= config3.confidenceThreshold) {
|
|
28742
|
+
if (isGBEncoding(detection.encoding)) {
|
|
28743
|
+
originalEncoding = detection.encoding;
|
|
28744
|
+
}
|
|
28745
|
+
} else if (isGBEncoding(resolvedSourceEncoding)) {
|
|
28746
|
+
originalEncoding = resolvedSourceEncoding;
|
|
25644
28747
|
}
|
|
25645
28748
|
const utf8Content = isGBEncoding(originalEncoding) ? decodeToUtf8(buffer, originalEncoding) : buffer.toString("utf-8");
|
|
25646
28749
|
const modifiedContent = applyEditsToContent(utf8Content, args.edits);
|
|
@@ -25650,11 +28753,11 @@ function registerEditFile(server2, config3, allowedDirectories) {
|
|
|
25650
28753
|
const encoded = isGBEncoding(originalEncoding) ? encodeFromUtf8(finalContent, originalEncoding) : Buffer.from(finalContent, "utf-8");
|
|
25651
28754
|
const tempPath = `${validPath}.${(0, import_crypto2.randomBytes)(16).toString("hex")}.tmp`;
|
|
25652
28755
|
try {
|
|
25653
|
-
await
|
|
25654
|
-
await
|
|
28756
|
+
await fs7.writeFile(tempPath, encoded);
|
|
28757
|
+
await fs7.rename(tempPath, validPath);
|
|
25655
28758
|
} catch (error2) {
|
|
25656
28759
|
try {
|
|
25657
|
-
await
|
|
28760
|
+
await fs7.unlink(tempPath);
|
|
25658
28761
|
} catch {
|
|
25659
28762
|
}
|
|
25660
28763
|
throw error2;
|
|
@@ -25667,28 +28770,6 @@ function registerEditFile(server2, config3, allowedDirectories) {
|
|
|
25667
28770
|
);
|
|
25668
28771
|
}
|
|
25669
28772
|
|
|
25670
|
-
// src/config.ts
|
|
25671
|
-
var fs7 = __toESM(require("fs/promises"));
|
|
25672
|
-
var path4 = __toESM(require("path"));
|
|
25673
|
-
var DEFAULT_CONFIG = {
|
|
25674
|
-
sourceEncoding: "GB18030",
|
|
25675
|
-
targetEncoding: "UTF-8",
|
|
25676
|
-
confidenceThreshold: 0.8
|
|
25677
|
-
};
|
|
25678
|
-
async function loadProjectConfig(cwd) {
|
|
25679
|
-
const configPath = path4.join(cwd, ".encoding-converter.json");
|
|
25680
|
-
try {
|
|
25681
|
-
const content = await fs7.readFile(configPath, "utf-8");
|
|
25682
|
-
const parsed = JSON.parse(content);
|
|
25683
|
-
return { ...DEFAULT_CONFIG, ...parsed };
|
|
25684
|
-
} catch (err) {
|
|
25685
|
-
if (err.code !== "ENOENT") {
|
|
25686
|
-
log("error", "Failed to parse config file", { path: configPath, error: err.message });
|
|
25687
|
-
}
|
|
25688
|
-
return { ...DEFAULT_CONFIG };
|
|
25689
|
-
}
|
|
25690
|
-
}
|
|
25691
|
-
|
|
25692
28773
|
// src/server.ts
|
|
25693
28774
|
var server = new McpServer({
|
|
25694
28775
|
name: "encoding-aware-fs",
|
|
@@ -25709,4 +28790,30 @@ async function startServer() {
|
|
|
25709
28790
|
0 && (module.exports = {
|
|
25710
28791
|
startServer
|
|
25711
28792
|
});
|
|
28793
|
+
/*! Bundled license information:
|
|
28794
|
+
|
|
28795
|
+
is-number/index.js:
|
|
28796
|
+
(*!
|
|
28797
|
+
* is-number <https://github.com/jonschlinkert/is-number>
|
|
28798
|
+
*
|
|
28799
|
+
* Copyright (c) 2014-present, Jon Schlinkert.
|
|
28800
|
+
* Released under the MIT License.
|
|
28801
|
+
*)
|
|
28802
|
+
|
|
28803
|
+
to-regex-range/index.js:
|
|
28804
|
+
(*!
|
|
28805
|
+
* to-regex-range <https://github.com/micromatch/to-regex-range>
|
|
28806
|
+
*
|
|
28807
|
+
* Copyright (c) 2015-present, Jon Schlinkert.
|
|
28808
|
+
* Released under the MIT License.
|
|
28809
|
+
*)
|
|
28810
|
+
|
|
28811
|
+
fill-range/index.js:
|
|
28812
|
+
(*!
|
|
28813
|
+
* fill-range <https://github.com/jonschlinkert/fill-range>
|
|
28814
|
+
*
|
|
28815
|
+
* Copyright (c) 2014-present, Jon Schlinkert.
|
|
28816
|
+
* Licensed under the MIT License.
|
|
28817
|
+
*)
|
|
28818
|
+
*/
|
|
25712
28819
|
//# sourceMappingURL=server.js.map
|