encoding-aware-fs 0.1.4 → 0.1.5
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 +54 -0
- package/RESEARCH.md +502 -0
- package/dist/index.js +3360 -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/index.js
CHANGED
|
@@ -12837,7 +12837,7 @@ var init_protocol = __esm({
|
|
|
12837
12837
|
}
|
|
12838
12838
|
};
|
|
12839
12839
|
}
|
|
12840
|
-
const
|
|
12840
|
+
const cancel3 = (reason) => {
|
|
12841
12841
|
this._responseHandlers.delete(messageId);
|
|
12842
12842
|
this._progressHandlers.delete(messageId);
|
|
12843
12843
|
this._cleanupTimeout(messageId);
|
|
@@ -12871,10 +12871,10 @@ var init_protocol = __esm({
|
|
|
12871
12871
|
}
|
|
12872
12872
|
});
|
|
12873
12873
|
options?.signal?.addEventListener("abort", () => {
|
|
12874
|
-
|
|
12874
|
+
cancel3(options?.signal?.reason);
|
|
12875
12875
|
});
|
|
12876
12876
|
const timeout = options?.timeout ?? DEFAULT_REQUEST_TIMEOUT_MSEC;
|
|
12877
|
-
const timeoutHandler = () =>
|
|
12877
|
+
const timeoutHandler = () => cancel3(McpError.fromError(ErrorCode.RequestTimeout, "Request timed out", { timeout }));
|
|
12878
12878
|
this._setupTimeout(messageId, timeout, options?.maxTotalTimeout, timeoutHandler, options?.resetTimeoutOnProgress ?? false);
|
|
12879
12879
|
const relatedTaskId = relatedTask?.taskId;
|
|
12880
12880
|
if (relatedTaskId) {
|
|
@@ -16776,49 +16776,49 @@ var require_fast_uri = __commonJS({
|
|
|
16776
16776
|
schemelessOptions.skipEscape = true;
|
|
16777
16777
|
return serialize(resolved, schemelessOptions);
|
|
16778
16778
|
}
|
|
16779
|
-
function resolveComponent(base,
|
|
16779
|
+
function resolveComponent(base, relative2, options, skipNormalization) {
|
|
16780
16780
|
const target = {};
|
|
16781
16781
|
if (!skipNormalization) {
|
|
16782
16782
|
base = parse3(serialize(base, options), options);
|
|
16783
|
-
|
|
16783
|
+
relative2 = parse3(serialize(relative2, options), options);
|
|
16784
16784
|
}
|
|
16785
16785
|
options = options || {};
|
|
16786
|
-
if (!options.tolerant &&
|
|
16787
|
-
target.scheme =
|
|
16788
|
-
target.userinfo =
|
|
16789
|
-
target.host =
|
|
16790
|
-
target.port =
|
|
16791
|
-
target.path = removeDotSegments(
|
|
16792
|
-
target.query =
|
|
16786
|
+
if (!options.tolerant && relative2.scheme) {
|
|
16787
|
+
target.scheme = relative2.scheme;
|
|
16788
|
+
target.userinfo = relative2.userinfo;
|
|
16789
|
+
target.host = relative2.host;
|
|
16790
|
+
target.port = relative2.port;
|
|
16791
|
+
target.path = removeDotSegments(relative2.path || "");
|
|
16792
|
+
target.query = relative2.query;
|
|
16793
16793
|
} else {
|
|
16794
|
-
if (
|
|
16795
|
-
target.userinfo =
|
|
16796
|
-
target.host =
|
|
16797
|
-
target.port =
|
|
16798
|
-
target.path = removeDotSegments(
|
|
16799
|
-
target.query =
|
|
16794
|
+
if (relative2.userinfo !== void 0 || relative2.host !== void 0 || relative2.port !== void 0) {
|
|
16795
|
+
target.userinfo = relative2.userinfo;
|
|
16796
|
+
target.host = relative2.host;
|
|
16797
|
+
target.port = relative2.port;
|
|
16798
|
+
target.path = removeDotSegments(relative2.path || "");
|
|
16799
|
+
target.query = relative2.query;
|
|
16800
16800
|
} else {
|
|
16801
|
-
if (!
|
|
16801
|
+
if (!relative2.path) {
|
|
16802
16802
|
target.path = base.path;
|
|
16803
|
-
if (
|
|
16804
|
-
target.query =
|
|
16803
|
+
if (relative2.query !== void 0) {
|
|
16804
|
+
target.query = relative2.query;
|
|
16805
16805
|
} else {
|
|
16806
16806
|
target.query = base.query;
|
|
16807
16807
|
}
|
|
16808
16808
|
} else {
|
|
16809
|
-
if (
|
|
16810
|
-
target.path = removeDotSegments(
|
|
16809
|
+
if (relative2.path[0] === "/") {
|
|
16810
|
+
target.path = removeDotSegments(relative2.path);
|
|
16811
16811
|
} else {
|
|
16812
16812
|
if ((base.userinfo !== void 0 || base.host !== void 0 || base.port !== void 0) && !base.path) {
|
|
16813
|
-
target.path = "/" +
|
|
16813
|
+
target.path = "/" + relative2.path;
|
|
16814
16814
|
} else if (!base.path) {
|
|
16815
|
-
target.path =
|
|
16815
|
+
target.path = relative2.path;
|
|
16816
16816
|
} else {
|
|
16817
|
-
target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) +
|
|
16817
|
+
target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative2.path;
|
|
16818
16818
|
}
|
|
16819
16819
|
target.path = removeDotSegments(target.path);
|
|
16820
16820
|
}
|
|
16821
|
-
target.query =
|
|
16821
|
+
target.query = relative2.query;
|
|
16822
16822
|
}
|
|
16823
16823
|
target.userinfo = base.userinfo;
|
|
16824
16824
|
target.host = base.host;
|
|
@@ -16826,7 +16826,7 @@ var require_fast_uri = __commonJS({
|
|
|
16826
16826
|
}
|
|
16827
16827
|
target.scheme = base.scheme;
|
|
16828
16828
|
}
|
|
16829
|
-
target.fragment =
|
|
16829
|
+
target.fragment = relative2.fragment;
|
|
16830
16830
|
return target;
|
|
16831
16831
|
}
|
|
16832
16832
|
function equal(uriA, uriB, options) {
|
|
@@ -17413,7 +17413,7 @@ var require_core = __commonJS({
|
|
|
17413
17413
|
errorsText(errors = this.errors, { separator = ", ", dataVar = "data" } = {}) {
|
|
17414
17414
|
if (!errors || errors.length === 0)
|
|
17415
17415
|
return "No errors";
|
|
17416
|
-
return errors.map((e) => `${dataVar}${e.instancePath} ${e.message}`).reduce((
|
|
17416
|
+
return errors.map((e) => `${dataVar}${e.instancePath} ${e.message}`).reduce((text2, msg) => text2 + separator + msg);
|
|
17417
17417
|
}
|
|
17418
17418
|
$dataMetaSchema(metaSchema, keywordsJsonPointers) {
|
|
17419
17419
|
const rules = this.RULES.all;
|
|
@@ -17502,11 +17502,11 @@ var require_core = __commonJS({
|
|
|
17502
17502
|
Ajv2.ValidationError = validation_error_1.default;
|
|
17503
17503
|
Ajv2.MissingRefError = ref_error_1.default;
|
|
17504
17504
|
exports2.default = Ajv2;
|
|
17505
|
-
function checkOptions(checkOpts, options, msg,
|
|
17505
|
+
function checkOptions(checkOpts, options, msg, log4 = "error") {
|
|
17506
17506
|
for (const key in checkOpts) {
|
|
17507
17507
|
const opt = key;
|
|
17508
17508
|
if (opt in options)
|
|
17509
|
-
this.logger[
|
|
17509
|
+
this.logger[log4](`${msg}: option ${key}. ${checkOpts[opt]}`);
|
|
17510
17510
|
}
|
|
17511
17511
|
}
|
|
17512
17512
|
function getSchEnv(keyRef) {
|
|
@@ -21983,7 +21983,7 @@ import json
|
|
|
21983
21983
|
|
|
21984
21984
|
try:
|
|
21985
21985
|
with open(sys.argv[1], 'rb') as f:
|
|
21986
|
-
data = f.read(
|
|
21986
|
+
data = f.read(32768)
|
|
21987
21987
|
if not data:
|
|
21988
21988
|
print(json.dumps({"encoding": None, "confidence": 0.0}))
|
|
21989
21989
|
else:
|
|
@@ -25707,8 +25707,8 @@ function isUtf8Encoding(encoding) {
|
|
|
25707
25707
|
function decodeToUtf8(buffer, encoding) {
|
|
25708
25708
|
return import_iconv_lite.default.decode(buffer, encoding);
|
|
25709
25709
|
}
|
|
25710
|
-
function encodeFromUtf8(
|
|
25711
|
-
return import_iconv_lite.default.encode(
|
|
25710
|
+
function encodeFromUtf8(text2, encoding) {
|
|
25711
|
+
return import_iconv_lite.default.encode(text2, encoding);
|
|
25712
25712
|
}
|
|
25713
25713
|
var import_iconv_lite;
|
|
25714
25714
|
var init_converter = __esm({
|
|
@@ -25749,6 +25749,3103 @@ var init_binary = __esm({
|
|
|
25749
25749
|
}
|
|
25750
25750
|
});
|
|
25751
25751
|
|
|
25752
|
+
// node_modules/braces/lib/utils.js
|
|
25753
|
+
var require_utils2 = __commonJS({
|
|
25754
|
+
"node_modules/braces/lib/utils.js"(exports2) {
|
|
25755
|
+
"use strict";
|
|
25756
|
+
exports2.isInteger = (num) => {
|
|
25757
|
+
if (typeof num === "number") {
|
|
25758
|
+
return Number.isInteger(num);
|
|
25759
|
+
}
|
|
25760
|
+
if (typeof num === "string" && num.trim() !== "") {
|
|
25761
|
+
return Number.isInteger(Number(num));
|
|
25762
|
+
}
|
|
25763
|
+
return false;
|
|
25764
|
+
};
|
|
25765
|
+
exports2.find = (node, type) => node.nodes.find((node2) => node2.type === type);
|
|
25766
|
+
exports2.exceedsLimit = (min, max, step = 1, limit) => {
|
|
25767
|
+
if (limit === false)
|
|
25768
|
+
return false;
|
|
25769
|
+
if (!exports2.isInteger(min) || !exports2.isInteger(max))
|
|
25770
|
+
return false;
|
|
25771
|
+
return (Number(max) - Number(min)) / Number(step) >= limit;
|
|
25772
|
+
};
|
|
25773
|
+
exports2.escapeNode = (block, n = 0, type) => {
|
|
25774
|
+
const node = block.nodes[n];
|
|
25775
|
+
if (!node)
|
|
25776
|
+
return;
|
|
25777
|
+
if (type && node.type === type || node.type === "open" || node.type === "close") {
|
|
25778
|
+
if (node.escaped !== true) {
|
|
25779
|
+
node.value = "\\" + node.value;
|
|
25780
|
+
node.escaped = true;
|
|
25781
|
+
}
|
|
25782
|
+
}
|
|
25783
|
+
};
|
|
25784
|
+
exports2.encloseBrace = (node) => {
|
|
25785
|
+
if (node.type !== "brace")
|
|
25786
|
+
return false;
|
|
25787
|
+
if (node.commas >> 0 + node.ranges >> 0 === 0) {
|
|
25788
|
+
node.invalid = true;
|
|
25789
|
+
return true;
|
|
25790
|
+
}
|
|
25791
|
+
return false;
|
|
25792
|
+
};
|
|
25793
|
+
exports2.isInvalidBrace = (block) => {
|
|
25794
|
+
if (block.type !== "brace")
|
|
25795
|
+
return false;
|
|
25796
|
+
if (block.invalid === true || block.dollar)
|
|
25797
|
+
return true;
|
|
25798
|
+
if (block.commas >> 0 + block.ranges >> 0 === 0) {
|
|
25799
|
+
block.invalid = true;
|
|
25800
|
+
return true;
|
|
25801
|
+
}
|
|
25802
|
+
if (block.open !== true || block.close !== true) {
|
|
25803
|
+
block.invalid = true;
|
|
25804
|
+
return true;
|
|
25805
|
+
}
|
|
25806
|
+
return false;
|
|
25807
|
+
};
|
|
25808
|
+
exports2.isOpenOrClose = (node) => {
|
|
25809
|
+
if (node.type === "open" || node.type === "close") {
|
|
25810
|
+
return true;
|
|
25811
|
+
}
|
|
25812
|
+
return node.open === true || node.close === true;
|
|
25813
|
+
};
|
|
25814
|
+
exports2.reduce = (nodes) => nodes.reduce((acc, node) => {
|
|
25815
|
+
if (node.type === "text")
|
|
25816
|
+
acc.push(node.value);
|
|
25817
|
+
if (node.type === "range")
|
|
25818
|
+
node.type = "text";
|
|
25819
|
+
return acc;
|
|
25820
|
+
}, []);
|
|
25821
|
+
exports2.flatten = (...args) => {
|
|
25822
|
+
const result = [];
|
|
25823
|
+
const flat = (arr) => {
|
|
25824
|
+
for (let i = 0; i < arr.length; i++) {
|
|
25825
|
+
const ele = arr[i];
|
|
25826
|
+
if (Array.isArray(ele)) {
|
|
25827
|
+
flat(ele);
|
|
25828
|
+
continue;
|
|
25829
|
+
}
|
|
25830
|
+
if (ele !== void 0) {
|
|
25831
|
+
result.push(ele);
|
|
25832
|
+
}
|
|
25833
|
+
}
|
|
25834
|
+
return result;
|
|
25835
|
+
};
|
|
25836
|
+
flat(args);
|
|
25837
|
+
return result;
|
|
25838
|
+
};
|
|
25839
|
+
}
|
|
25840
|
+
});
|
|
25841
|
+
|
|
25842
|
+
// node_modules/braces/lib/stringify.js
|
|
25843
|
+
var require_stringify = __commonJS({
|
|
25844
|
+
"node_modules/braces/lib/stringify.js"(exports2, module2) {
|
|
25845
|
+
"use strict";
|
|
25846
|
+
var utils = require_utils2();
|
|
25847
|
+
module2.exports = (ast, options = {}) => {
|
|
25848
|
+
const stringify = (node, parent = {}) => {
|
|
25849
|
+
const invalidBlock = options.escapeInvalid && utils.isInvalidBrace(parent);
|
|
25850
|
+
const invalidNode = node.invalid === true && options.escapeInvalid === true;
|
|
25851
|
+
let output = "";
|
|
25852
|
+
if (node.value) {
|
|
25853
|
+
if ((invalidBlock || invalidNode) && utils.isOpenOrClose(node)) {
|
|
25854
|
+
return "\\" + node.value;
|
|
25855
|
+
}
|
|
25856
|
+
return node.value;
|
|
25857
|
+
}
|
|
25858
|
+
if (node.value) {
|
|
25859
|
+
return node.value;
|
|
25860
|
+
}
|
|
25861
|
+
if (node.nodes) {
|
|
25862
|
+
for (const child of node.nodes) {
|
|
25863
|
+
output += stringify(child);
|
|
25864
|
+
}
|
|
25865
|
+
}
|
|
25866
|
+
return output;
|
|
25867
|
+
};
|
|
25868
|
+
return stringify(ast);
|
|
25869
|
+
};
|
|
25870
|
+
}
|
|
25871
|
+
});
|
|
25872
|
+
|
|
25873
|
+
// node_modules/is-number/index.js
|
|
25874
|
+
var require_is_number = __commonJS({
|
|
25875
|
+
"node_modules/is-number/index.js"(exports2, module2) {
|
|
25876
|
+
"use strict";
|
|
25877
|
+
module2.exports = function(num) {
|
|
25878
|
+
if (typeof num === "number") {
|
|
25879
|
+
return num - num === 0;
|
|
25880
|
+
}
|
|
25881
|
+
if (typeof num === "string" && num.trim() !== "") {
|
|
25882
|
+
return Number.isFinite ? Number.isFinite(+num) : isFinite(+num);
|
|
25883
|
+
}
|
|
25884
|
+
return false;
|
|
25885
|
+
};
|
|
25886
|
+
}
|
|
25887
|
+
});
|
|
25888
|
+
|
|
25889
|
+
// node_modules/to-regex-range/index.js
|
|
25890
|
+
var require_to_regex_range = __commonJS({
|
|
25891
|
+
"node_modules/to-regex-range/index.js"(exports2, module2) {
|
|
25892
|
+
"use strict";
|
|
25893
|
+
var isNumber = require_is_number();
|
|
25894
|
+
var toRegexRange = (min, max, options) => {
|
|
25895
|
+
if (isNumber(min) === false) {
|
|
25896
|
+
throw new TypeError("toRegexRange: expected the first argument to be a number");
|
|
25897
|
+
}
|
|
25898
|
+
if (max === void 0 || min === max) {
|
|
25899
|
+
return String(min);
|
|
25900
|
+
}
|
|
25901
|
+
if (isNumber(max) === false) {
|
|
25902
|
+
throw new TypeError("toRegexRange: expected the second argument to be a number.");
|
|
25903
|
+
}
|
|
25904
|
+
let opts = { relaxZeros: true, ...options };
|
|
25905
|
+
if (typeof opts.strictZeros === "boolean") {
|
|
25906
|
+
opts.relaxZeros = opts.strictZeros === false;
|
|
25907
|
+
}
|
|
25908
|
+
let relax = String(opts.relaxZeros);
|
|
25909
|
+
let shorthand = String(opts.shorthand);
|
|
25910
|
+
let capture = String(opts.capture);
|
|
25911
|
+
let wrap = String(opts.wrap);
|
|
25912
|
+
let cacheKey = min + ":" + max + "=" + relax + shorthand + capture + wrap;
|
|
25913
|
+
if (toRegexRange.cache.hasOwnProperty(cacheKey)) {
|
|
25914
|
+
return toRegexRange.cache[cacheKey].result;
|
|
25915
|
+
}
|
|
25916
|
+
let a = Math.min(min, max);
|
|
25917
|
+
let b = Math.max(min, max);
|
|
25918
|
+
if (Math.abs(a - b) === 1) {
|
|
25919
|
+
let result = min + "|" + max;
|
|
25920
|
+
if (opts.capture) {
|
|
25921
|
+
return `(${result})`;
|
|
25922
|
+
}
|
|
25923
|
+
if (opts.wrap === false) {
|
|
25924
|
+
return result;
|
|
25925
|
+
}
|
|
25926
|
+
return `(?:${result})`;
|
|
25927
|
+
}
|
|
25928
|
+
let isPadded = hasPadding(min) || hasPadding(max);
|
|
25929
|
+
let state = { min, max, a, b };
|
|
25930
|
+
let positives = [];
|
|
25931
|
+
let negatives = [];
|
|
25932
|
+
if (isPadded) {
|
|
25933
|
+
state.isPadded = isPadded;
|
|
25934
|
+
state.maxLen = String(state.max).length;
|
|
25935
|
+
}
|
|
25936
|
+
if (a < 0) {
|
|
25937
|
+
let newMin = b < 0 ? Math.abs(b) : 1;
|
|
25938
|
+
negatives = splitToPatterns(newMin, Math.abs(a), state, opts);
|
|
25939
|
+
a = state.a = 0;
|
|
25940
|
+
}
|
|
25941
|
+
if (b >= 0) {
|
|
25942
|
+
positives = splitToPatterns(a, b, state, opts);
|
|
25943
|
+
}
|
|
25944
|
+
state.negatives = negatives;
|
|
25945
|
+
state.positives = positives;
|
|
25946
|
+
state.result = collatePatterns(negatives, positives, opts);
|
|
25947
|
+
if (opts.capture === true) {
|
|
25948
|
+
state.result = `(${state.result})`;
|
|
25949
|
+
} else if (opts.wrap !== false && positives.length + negatives.length > 1) {
|
|
25950
|
+
state.result = `(?:${state.result})`;
|
|
25951
|
+
}
|
|
25952
|
+
toRegexRange.cache[cacheKey] = state;
|
|
25953
|
+
return state.result;
|
|
25954
|
+
};
|
|
25955
|
+
function collatePatterns(neg, pos, options) {
|
|
25956
|
+
let onlyNegative = filterPatterns(neg, pos, "-", false, options) || [];
|
|
25957
|
+
let onlyPositive = filterPatterns(pos, neg, "", false, options) || [];
|
|
25958
|
+
let intersected = filterPatterns(neg, pos, "-?", true, options) || [];
|
|
25959
|
+
let subpatterns = onlyNegative.concat(intersected).concat(onlyPositive);
|
|
25960
|
+
return subpatterns.join("|");
|
|
25961
|
+
}
|
|
25962
|
+
function splitToRanges(min, max) {
|
|
25963
|
+
let nines = 1;
|
|
25964
|
+
let zeros = 1;
|
|
25965
|
+
let stop = countNines(min, nines);
|
|
25966
|
+
let stops = /* @__PURE__ */ new Set([max]);
|
|
25967
|
+
while (min <= stop && stop <= max) {
|
|
25968
|
+
stops.add(stop);
|
|
25969
|
+
nines += 1;
|
|
25970
|
+
stop = countNines(min, nines);
|
|
25971
|
+
}
|
|
25972
|
+
stop = countZeros(max + 1, zeros) - 1;
|
|
25973
|
+
while (min < stop && stop <= max) {
|
|
25974
|
+
stops.add(stop);
|
|
25975
|
+
zeros += 1;
|
|
25976
|
+
stop = countZeros(max + 1, zeros) - 1;
|
|
25977
|
+
}
|
|
25978
|
+
stops = [...stops];
|
|
25979
|
+
stops.sort(compare);
|
|
25980
|
+
return stops;
|
|
25981
|
+
}
|
|
25982
|
+
function rangeToPattern(start, stop, options) {
|
|
25983
|
+
if (start === stop) {
|
|
25984
|
+
return { pattern: start, count: [], digits: 0 };
|
|
25985
|
+
}
|
|
25986
|
+
let zipped = zip(start, stop);
|
|
25987
|
+
let digits = zipped.length;
|
|
25988
|
+
let pattern = "";
|
|
25989
|
+
let count = 0;
|
|
25990
|
+
for (let i = 0; i < digits; i++) {
|
|
25991
|
+
let [startDigit, stopDigit] = zipped[i];
|
|
25992
|
+
if (startDigit === stopDigit) {
|
|
25993
|
+
pattern += startDigit;
|
|
25994
|
+
} else if (startDigit !== "0" || stopDigit !== "9") {
|
|
25995
|
+
pattern += toCharacterClass(startDigit, stopDigit, options);
|
|
25996
|
+
} else {
|
|
25997
|
+
count++;
|
|
25998
|
+
}
|
|
25999
|
+
}
|
|
26000
|
+
if (count) {
|
|
26001
|
+
pattern += options.shorthand === true ? "\\d" : "[0-9]";
|
|
26002
|
+
}
|
|
26003
|
+
return { pattern, count: [count], digits };
|
|
26004
|
+
}
|
|
26005
|
+
function splitToPatterns(min, max, tok, options) {
|
|
26006
|
+
let ranges = splitToRanges(min, max);
|
|
26007
|
+
let tokens = [];
|
|
26008
|
+
let start = min;
|
|
26009
|
+
let prev;
|
|
26010
|
+
for (let i = 0; i < ranges.length; i++) {
|
|
26011
|
+
let max2 = ranges[i];
|
|
26012
|
+
let obj = rangeToPattern(String(start), String(max2), options);
|
|
26013
|
+
let zeros = "";
|
|
26014
|
+
if (!tok.isPadded && prev && prev.pattern === obj.pattern) {
|
|
26015
|
+
if (prev.count.length > 1) {
|
|
26016
|
+
prev.count.pop();
|
|
26017
|
+
}
|
|
26018
|
+
prev.count.push(obj.count[0]);
|
|
26019
|
+
prev.string = prev.pattern + toQuantifier(prev.count);
|
|
26020
|
+
start = max2 + 1;
|
|
26021
|
+
continue;
|
|
26022
|
+
}
|
|
26023
|
+
if (tok.isPadded) {
|
|
26024
|
+
zeros = padZeros(max2, tok, options);
|
|
26025
|
+
}
|
|
26026
|
+
obj.string = zeros + obj.pattern + toQuantifier(obj.count);
|
|
26027
|
+
tokens.push(obj);
|
|
26028
|
+
start = max2 + 1;
|
|
26029
|
+
prev = obj;
|
|
26030
|
+
}
|
|
26031
|
+
return tokens;
|
|
26032
|
+
}
|
|
26033
|
+
function filterPatterns(arr, comparison, prefix, intersection2, options) {
|
|
26034
|
+
let result = [];
|
|
26035
|
+
for (let ele of arr) {
|
|
26036
|
+
let { string: string3 } = ele;
|
|
26037
|
+
if (!intersection2 && !contains(comparison, "string", string3)) {
|
|
26038
|
+
result.push(prefix + string3);
|
|
26039
|
+
}
|
|
26040
|
+
if (intersection2 && contains(comparison, "string", string3)) {
|
|
26041
|
+
result.push(prefix + string3);
|
|
26042
|
+
}
|
|
26043
|
+
}
|
|
26044
|
+
return result;
|
|
26045
|
+
}
|
|
26046
|
+
function zip(a, b) {
|
|
26047
|
+
let arr = [];
|
|
26048
|
+
for (let i = 0; i < a.length; i++)
|
|
26049
|
+
arr.push([a[i], b[i]]);
|
|
26050
|
+
return arr;
|
|
26051
|
+
}
|
|
26052
|
+
function compare(a, b) {
|
|
26053
|
+
return a > b ? 1 : b > a ? -1 : 0;
|
|
26054
|
+
}
|
|
26055
|
+
function contains(arr, key, val) {
|
|
26056
|
+
return arr.some((ele) => ele[key] === val);
|
|
26057
|
+
}
|
|
26058
|
+
function countNines(min, len) {
|
|
26059
|
+
return Number(String(min).slice(0, -len) + "9".repeat(len));
|
|
26060
|
+
}
|
|
26061
|
+
function countZeros(integer2, zeros) {
|
|
26062
|
+
return integer2 - integer2 % Math.pow(10, zeros);
|
|
26063
|
+
}
|
|
26064
|
+
function toQuantifier(digits) {
|
|
26065
|
+
let [start = 0, stop = ""] = digits;
|
|
26066
|
+
if (stop || start > 1) {
|
|
26067
|
+
return `{${start + (stop ? "," + stop : "")}}`;
|
|
26068
|
+
}
|
|
26069
|
+
return "";
|
|
26070
|
+
}
|
|
26071
|
+
function toCharacterClass(a, b, options) {
|
|
26072
|
+
return `[${a}${b - a === 1 ? "" : "-"}${b}]`;
|
|
26073
|
+
}
|
|
26074
|
+
function hasPadding(str) {
|
|
26075
|
+
return /^-?(0+)\d/.test(str);
|
|
26076
|
+
}
|
|
26077
|
+
function padZeros(value, tok, options) {
|
|
26078
|
+
if (!tok.isPadded) {
|
|
26079
|
+
return value;
|
|
26080
|
+
}
|
|
26081
|
+
let diff = Math.abs(tok.maxLen - String(value).length);
|
|
26082
|
+
let relax = options.relaxZeros !== false;
|
|
26083
|
+
switch (diff) {
|
|
26084
|
+
case 0:
|
|
26085
|
+
return "";
|
|
26086
|
+
case 1:
|
|
26087
|
+
return relax ? "0?" : "0";
|
|
26088
|
+
case 2:
|
|
26089
|
+
return relax ? "0{0,2}" : "00";
|
|
26090
|
+
default: {
|
|
26091
|
+
return relax ? `0{0,${diff}}` : `0{${diff}}`;
|
|
26092
|
+
}
|
|
26093
|
+
}
|
|
26094
|
+
}
|
|
26095
|
+
toRegexRange.cache = {};
|
|
26096
|
+
toRegexRange.clearCache = () => toRegexRange.cache = {};
|
|
26097
|
+
module2.exports = toRegexRange;
|
|
26098
|
+
}
|
|
26099
|
+
});
|
|
26100
|
+
|
|
26101
|
+
// node_modules/fill-range/index.js
|
|
26102
|
+
var require_fill_range = __commonJS({
|
|
26103
|
+
"node_modules/fill-range/index.js"(exports2, module2) {
|
|
26104
|
+
"use strict";
|
|
26105
|
+
var util2 = require("util");
|
|
26106
|
+
var toRegexRange = require_to_regex_range();
|
|
26107
|
+
var isObject2 = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
|
|
26108
|
+
var transform2 = (toNumber) => {
|
|
26109
|
+
return (value) => toNumber === true ? Number(value) : String(value);
|
|
26110
|
+
};
|
|
26111
|
+
var isValidValue = (value) => {
|
|
26112
|
+
return typeof value === "number" || typeof value === "string" && value !== "";
|
|
26113
|
+
};
|
|
26114
|
+
var isNumber = (num) => Number.isInteger(+num);
|
|
26115
|
+
var zeros = (input) => {
|
|
26116
|
+
let value = `${input}`;
|
|
26117
|
+
let index = -1;
|
|
26118
|
+
if (value[0] === "-")
|
|
26119
|
+
value = value.slice(1);
|
|
26120
|
+
if (value === "0")
|
|
26121
|
+
return false;
|
|
26122
|
+
while (value[++index] === "0")
|
|
26123
|
+
;
|
|
26124
|
+
return index > 0;
|
|
26125
|
+
};
|
|
26126
|
+
var stringify = (start, end, options) => {
|
|
26127
|
+
if (typeof start === "string" || typeof end === "string") {
|
|
26128
|
+
return true;
|
|
26129
|
+
}
|
|
26130
|
+
return options.stringify === true;
|
|
26131
|
+
};
|
|
26132
|
+
var pad = (input, maxLength, toNumber) => {
|
|
26133
|
+
if (maxLength > 0) {
|
|
26134
|
+
let dash = input[0] === "-" ? "-" : "";
|
|
26135
|
+
if (dash)
|
|
26136
|
+
input = input.slice(1);
|
|
26137
|
+
input = dash + input.padStart(dash ? maxLength - 1 : maxLength, "0");
|
|
26138
|
+
}
|
|
26139
|
+
if (toNumber === false) {
|
|
26140
|
+
return String(input);
|
|
26141
|
+
}
|
|
26142
|
+
return input;
|
|
26143
|
+
};
|
|
26144
|
+
var toMaxLen = (input, maxLength) => {
|
|
26145
|
+
let negative = input[0] === "-" ? "-" : "";
|
|
26146
|
+
if (negative) {
|
|
26147
|
+
input = input.slice(1);
|
|
26148
|
+
maxLength--;
|
|
26149
|
+
}
|
|
26150
|
+
while (input.length < maxLength)
|
|
26151
|
+
input = "0" + input;
|
|
26152
|
+
return negative ? "-" + input : input;
|
|
26153
|
+
};
|
|
26154
|
+
var toSequence = (parts, options, maxLen) => {
|
|
26155
|
+
parts.negatives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
26156
|
+
parts.positives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
26157
|
+
let prefix = options.capture ? "" : "?:";
|
|
26158
|
+
let positives = "";
|
|
26159
|
+
let negatives = "";
|
|
26160
|
+
let result;
|
|
26161
|
+
if (parts.positives.length) {
|
|
26162
|
+
positives = parts.positives.map((v) => toMaxLen(String(v), maxLen)).join("|");
|
|
26163
|
+
}
|
|
26164
|
+
if (parts.negatives.length) {
|
|
26165
|
+
negatives = `-(${prefix}${parts.negatives.map((v) => toMaxLen(String(v), maxLen)).join("|")})`;
|
|
26166
|
+
}
|
|
26167
|
+
if (positives && negatives) {
|
|
26168
|
+
result = `${positives}|${negatives}`;
|
|
26169
|
+
} else {
|
|
26170
|
+
result = positives || negatives;
|
|
26171
|
+
}
|
|
26172
|
+
if (options.wrap) {
|
|
26173
|
+
return `(${prefix}${result})`;
|
|
26174
|
+
}
|
|
26175
|
+
return result;
|
|
26176
|
+
};
|
|
26177
|
+
var toRange = (a, b, isNumbers, options) => {
|
|
26178
|
+
if (isNumbers) {
|
|
26179
|
+
return toRegexRange(a, b, { wrap: false, ...options });
|
|
26180
|
+
}
|
|
26181
|
+
let start = String.fromCharCode(a);
|
|
26182
|
+
if (a === b)
|
|
26183
|
+
return start;
|
|
26184
|
+
let stop = String.fromCharCode(b);
|
|
26185
|
+
return `[${start}-${stop}]`;
|
|
26186
|
+
};
|
|
26187
|
+
var toRegex = (start, end, options) => {
|
|
26188
|
+
if (Array.isArray(start)) {
|
|
26189
|
+
let wrap = options.wrap === true;
|
|
26190
|
+
let prefix = options.capture ? "" : "?:";
|
|
26191
|
+
return wrap ? `(${prefix}${start.join("|")})` : start.join("|");
|
|
26192
|
+
}
|
|
26193
|
+
return toRegexRange(start, end, options);
|
|
26194
|
+
};
|
|
26195
|
+
var rangeError = (...args) => {
|
|
26196
|
+
return new RangeError("Invalid range arguments: " + util2.inspect(...args));
|
|
26197
|
+
};
|
|
26198
|
+
var invalidRange = (start, end, options) => {
|
|
26199
|
+
if (options.strictRanges === true)
|
|
26200
|
+
throw rangeError([start, end]);
|
|
26201
|
+
return [];
|
|
26202
|
+
};
|
|
26203
|
+
var invalidStep = (step, options) => {
|
|
26204
|
+
if (options.strictRanges === true) {
|
|
26205
|
+
throw new TypeError(`Expected step "${step}" to be a number`);
|
|
26206
|
+
}
|
|
26207
|
+
return [];
|
|
26208
|
+
};
|
|
26209
|
+
var fillNumbers = (start, end, step = 1, options = {}) => {
|
|
26210
|
+
let a = Number(start);
|
|
26211
|
+
let b = Number(end);
|
|
26212
|
+
if (!Number.isInteger(a) || !Number.isInteger(b)) {
|
|
26213
|
+
if (options.strictRanges === true)
|
|
26214
|
+
throw rangeError([start, end]);
|
|
26215
|
+
return [];
|
|
26216
|
+
}
|
|
26217
|
+
if (a === 0)
|
|
26218
|
+
a = 0;
|
|
26219
|
+
if (b === 0)
|
|
26220
|
+
b = 0;
|
|
26221
|
+
let descending = a > b;
|
|
26222
|
+
let startString = String(start);
|
|
26223
|
+
let endString = String(end);
|
|
26224
|
+
let stepString = String(step);
|
|
26225
|
+
step = Math.max(Math.abs(step), 1);
|
|
26226
|
+
let padded = zeros(startString) || zeros(endString) || zeros(stepString);
|
|
26227
|
+
let maxLen = padded ? Math.max(startString.length, endString.length, stepString.length) : 0;
|
|
26228
|
+
let toNumber = padded === false && stringify(start, end, options) === false;
|
|
26229
|
+
let format = options.transform || transform2(toNumber);
|
|
26230
|
+
if (options.toRegex && step === 1) {
|
|
26231
|
+
return toRange(toMaxLen(start, maxLen), toMaxLen(end, maxLen), true, options);
|
|
26232
|
+
}
|
|
26233
|
+
let parts = { negatives: [], positives: [] };
|
|
26234
|
+
let push = (num) => parts[num < 0 ? "negatives" : "positives"].push(Math.abs(num));
|
|
26235
|
+
let range = [];
|
|
26236
|
+
let index = 0;
|
|
26237
|
+
while (descending ? a >= b : a <= b) {
|
|
26238
|
+
if (options.toRegex === true && step > 1) {
|
|
26239
|
+
push(a);
|
|
26240
|
+
} else {
|
|
26241
|
+
range.push(pad(format(a, index), maxLen, toNumber));
|
|
26242
|
+
}
|
|
26243
|
+
a = descending ? a - step : a + step;
|
|
26244
|
+
index++;
|
|
26245
|
+
}
|
|
26246
|
+
if (options.toRegex === true) {
|
|
26247
|
+
return step > 1 ? toSequence(parts, options, maxLen) : toRegex(range, null, { wrap: false, ...options });
|
|
26248
|
+
}
|
|
26249
|
+
return range;
|
|
26250
|
+
};
|
|
26251
|
+
var fillLetters = (start, end, step = 1, options = {}) => {
|
|
26252
|
+
if (!isNumber(start) && start.length > 1 || !isNumber(end) && end.length > 1) {
|
|
26253
|
+
return invalidRange(start, end, options);
|
|
26254
|
+
}
|
|
26255
|
+
let format = options.transform || ((val) => String.fromCharCode(val));
|
|
26256
|
+
let a = `${start}`.charCodeAt(0);
|
|
26257
|
+
let b = `${end}`.charCodeAt(0);
|
|
26258
|
+
let descending = a > b;
|
|
26259
|
+
let min = Math.min(a, b);
|
|
26260
|
+
let max = Math.max(a, b);
|
|
26261
|
+
if (options.toRegex && step === 1) {
|
|
26262
|
+
return toRange(min, max, false, options);
|
|
26263
|
+
}
|
|
26264
|
+
let range = [];
|
|
26265
|
+
let index = 0;
|
|
26266
|
+
while (descending ? a >= b : a <= b) {
|
|
26267
|
+
range.push(format(a, index));
|
|
26268
|
+
a = descending ? a - step : a + step;
|
|
26269
|
+
index++;
|
|
26270
|
+
}
|
|
26271
|
+
if (options.toRegex === true) {
|
|
26272
|
+
return toRegex(range, null, { wrap: false, options });
|
|
26273
|
+
}
|
|
26274
|
+
return range;
|
|
26275
|
+
};
|
|
26276
|
+
var fill = (start, end, step, options = {}) => {
|
|
26277
|
+
if (end == null && isValidValue(start)) {
|
|
26278
|
+
return [start];
|
|
26279
|
+
}
|
|
26280
|
+
if (!isValidValue(start) || !isValidValue(end)) {
|
|
26281
|
+
return invalidRange(start, end, options);
|
|
26282
|
+
}
|
|
26283
|
+
if (typeof step === "function") {
|
|
26284
|
+
return fill(start, end, 1, { transform: step });
|
|
26285
|
+
}
|
|
26286
|
+
if (isObject2(step)) {
|
|
26287
|
+
return fill(start, end, 0, step);
|
|
26288
|
+
}
|
|
26289
|
+
let opts = { ...options };
|
|
26290
|
+
if (opts.capture === true)
|
|
26291
|
+
opts.wrap = true;
|
|
26292
|
+
step = step || opts.step || 1;
|
|
26293
|
+
if (!isNumber(step)) {
|
|
26294
|
+
if (step != null && !isObject2(step))
|
|
26295
|
+
return invalidStep(step, opts);
|
|
26296
|
+
return fill(start, end, 1, step);
|
|
26297
|
+
}
|
|
26298
|
+
if (isNumber(start) && isNumber(end)) {
|
|
26299
|
+
return fillNumbers(start, end, step, opts);
|
|
26300
|
+
}
|
|
26301
|
+
return fillLetters(start, end, Math.max(Math.abs(step), 1), opts);
|
|
26302
|
+
};
|
|
26303
|
+
module2.exports = fill;
|
|
26304
|
+
}
|
|
26305
|
+
});
|
|
26306
|
+
|
|
26307
|
+
// node_modules/braces/lib/compile.js
|
|
26308
|
+
var require_compile2 = __commonJS({
|
|
26309
|
+
"node_modules/braces/lib/compile.js"(exports2, module2) {
|
|
26310
|
+
"use strict";
|
|
26311
|
+
var fill = require_fill_range();
|
|
26312
|
+
var utils = require_utils2();
|
|
26313
|
+
var compile = (ast, options = {}) => {
|
|
26314
|
+
const walk = (node, parent = {}) => {
|
|
26315
|
+
const invalidBlock = utils.isInvalidBrace(parent);
|
|
26316
|
+
const invalidNode = node.invalid === true && options.escapeInvalid === true;
|
|
26317
|
+
const invalid = invalidBlock === true || invalidNode === true;
|
|
26318
|
+
const prefix = options.escapeInvalid === true ? "\\" : "";
|
|
26319
|
+
let output = "";
|
|
26320
|
+
if (node.isOpen === true) {
|
|
26321
|
+
return prefix + node.value;
|
|
26322
|
+
}
|
|
26323
|
+
if (node.isClose === true) {
|
|
26324
|
+
console.log("node.isClose", prefix, node.value);
|
|
26325
|
+
return prefix + node.value;
|
|
26326
|
+
}
|
|
26327
|
+
if (node.type === "open") {
|
|
26328
|
+
return invalid ? prefix + node.value : "(";
|
|
26329
|
+
}
|
|
26330
|
+
if (node.type === "close") {
|
|
26331
|
+
return invalid ? prefix + node.value : ")";
|
|
26332
|
+
}
|
|
26333
|
+
if (node.type === "comma") {
|
|
26334
|
+
return node.prev.type === "comma" ? "" : invalid ? node.value : "|";
|
|
26335
|
+
}
|
|
26336
|
+
if (node.value) {
|
|
26337
|
+
return node.value;
|
|
26338
|
+
}
|
|
26339
|
+
if (node.nodes && node.ranges > 0) {
|
|
26340
|
+
const args = utils.reduce(node.nodes);
|
|
26341
|
+
const range = fill(...args, { ...options, wrap: false, toRegex: true, strictZeros: true });
|
|
26342
|
+
if (range.length !== 0) {
|
|
26343
|
+
return args.length > 1 && range.length > 1 ? `(${range})` : range;
|
|
26344
|
+
}
|
|
26345
|
+
}
|
|
26346
|
+
if (node.nodes) {
|
|
26347
|
+
for (const child of node.nodes) {
|
|
26348
|
+
output += walk(child, node);
|
|
26349
|
+
}
|
|
26350
|
+
}
|
|
26351
|
+
return output;
|
|
26352
|
+
};
|
|
26353
|
+
return walk(ast);
|
|
26354
|
+
};
|
|
26355
|
+
module2.exports = compile;
|
|
26356
|
+
}
|
|
26357
|
+
});
|
|
26358
|
+
|
|
26359
|
+
// node_modules/braces/lib/expand.js
|
|
26360
|
+
var require_expand = __commonJS({
|
|
26361
|
+
"node_modules/braces/lib/expand.js"(exports2, module2) {
|
|
26362
|
+
"use strict";
|
|
26363
|
+
var fill = require_fill_range();
|
|
26364
|
+
var stringify = require_stringify();
|
|
26365
|
+
var utils = require_utils2();
|
|
26366
|
+
var append = (queue = "", stash = "", enclose = false) => {
|
|
26367
|
+
const result = [];
|
|
26368
|
+
queue = [].concat(queue);
|
|
26369
|
+
stash = [].concat(stash);
|
|
26370
|
+
if (!stash.length)
|
|
26371
|
+
return queue;
|
|
26372
|
+
if (!queue.length) {
|
|
26373
|
+
return enclose ? utils.flatten(stash).map((ele) => `{${ele}}`) : stash;
|
|
26374
|
+
}
|
|
26375
|
+
for (const item of queue) {
|
|
26376
|
+
if (Array.isArray(item)) {
|
|
26377
|
+
for (const value of item) {
|
|
26378
|
+
result.push(append(value, stash, enclose));
|
|
26379
|
+
}
|
|
26380
|
+
} else {
|
|
26381
|
+
for (let ele of stash) {
|
|
26382
|
+
if (enclose === true && typeof ele === "string")
|
|
26383
|
+
ele = `{${ele}}`;
|
|
26384
|
+
result.push(Array.isArray(ele) ? append(item, ele, enclose) : item + ele);
|
|
26385
|
+
}
|
|
26386
|
+
}
|
|
26387
|
+
}
|
|
26388
|
+
return utils.flatten(result);
|
|
26389
|
+
};
|
|
26390
|
+
var expand = (ast, options = {}) => {
|
|
26391
|
+
const rangeLimit = options.rangeLimit === void 0 ? 1e3 : options.rangeLimit;
|
|
26392
|
+
const walk = (node, parent = {}) => {
|
|
26393
|
+
node.queue = [];
|
|
26394
|
+
let p = parent;
|
|
26395
|
+
let q = parent.queue;
|
|
26396
|
+
while (p.type !== "brace" && p.type !== "root" && p.parent) {
|
|
26397
|
+
p = p.parent;
|
|
26398
|
+
q = p.queue;
|
|
26399
|
+
}
|
|
26400
|
+
if (node.invalid || node.dollar) {
|
|
26401
|
+
q.push(append(q.pop(), stringify(node, options)));
|
|
26402
|
+
return;
|
|
26403
|
+
}
|
|
26404
|
+
if (node.type === "brace" && node.invalid !== true && node.nodes.length === 2) {
|
|
26405
|
+
q.push(append(q.pop(), ["{}"]));
|
|
26406
|
+
return;
|
|
26407
|
+
}
|
|
26408
|
+
if (node.nodes && node.ranges > 0) {
|
|
26409
|
+
const args = utils.reduce(node.nodes);
|
|
26410
|
+
if (utils.exceedsLimit(...args, options.step, rangeLimit)) {
|
|
26411
|
+
throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");
|
|
26412
|
+
}
|
|
26413
|
+
let range = fill(...args, options);
|
|
26414
|
+
if (range.length === 0) {
|
|
26415
|
+
range = stringify(node, options);
|
|
26416
|
+
}
|
|
26417
|
+
q.push(append(q.pop(), range));
|
|
26418
|
+
node.nodes = [];
|
|
26419
|
+
return;
|
|
26420
|
+
}
|
|
26421
|
+
const enclose = utils.encloseBrace(node);
|
|
26422
|
+
let queue = node.queue;
|
|
26423
|
+
let block = node;
|
|
26424
|
+
while (block.type !== "brace" && block.type !== "root" && block.parent) {
|
|
26425
|
+
block = block.parent;
|
|
26426
|
+
queue = block.queue;
|
|
26427
|
+
}
|
|
26428
|
+
for (let i = 0; i < node.nodes.length; i++) {
|
|
26429
|
+
const child = node.nodes[i];
|
|
26430
|
+
if (child.type === "comma" && node.type === "brace") {
|
|
26431
|
+
if (i === 1)
|
|
26432
|
+
queue.push("");
|
|
26433
|
+
queue.push("");
|
|
26434
|
+
continue;
|
|
26435
|
+
}
|
|
26436
|
+
if (child.type === "close") {
|
|
26437
|
+
q.push(append(q.pop(), queue, enclose));
|
|
26438
|
+
continue;
|
|
26439
|
+
}
|
|
26440
|
+
if (child.value && child.type !== "open") {
|
|
26441
|
+
queue.push(append(queue.pop(), child.value));
|
|
26442
|
+
continue;
|
|
26443
|
+
}
|
|
26444
|
+
if (child.nodes) {
|
|
26445
|
+
walk(child, node);
|
|
26446
|
+
}
|
|
26447
|
+
}
|
|
26448
|
+
return queue;
|
|
26449
|
+
};
|
|
26450
|
+
return utils.flatten(walk(ast));
|
|
26451
|
+
};
|
|
26452
|
+
module2.exports = expand;
|
|
26453
|
+
}
|
|
26454
|
+
});
|
|
26455
|
+
|
|
26456
|
+
// node_modules/braces/lib/constants.js
|
|
26457
|
+
var require_constants = __commonJS({
|
|
26458
|
+
"node_modules/braces/lib/constants.js"(exports2, module2) {
|
|
26459
|
+
"use strict";
|
|
26460
|
+
module2.exports = {
|
|
26461
|
+
MAX_LENGTH: 1e4,
|
|
26462
|
+
// Digits
|
|
26463
|
+
CHAR_0: "0",
|
|
26464
|
+
/* 0 */
|
|
26465
|
+
CHAR_9: "9",
|
|
26466
|
+
/* 9 */
|
|
26467
|
+
// Alphabet chars.
|
|
26468
|
+
CHAR_UPPERCASE_A: "A",
|
|
26469
|
+
/* A */
|
|
26470
|
+
CHAR_LOWERCASE_A: "a",
|
|
26471
|
+
/* a */
|
|
26472
|
+
CHAR_UPPERCASE_Z: "Z",
|
|
26473
|
+
/* Z */
|
|
26474
|
+
CHAR_LOWERCASE_Z: "z",
|
|
26475
|
+
/* z */
|
|
26476
|
+
CHAR_LEFT_PARENTHESES: "(",
|
|
26477
|
+
/* ( */
|
|
26478
|
+
CHAR_RIGHT_PARENTHESES: ")",
|
|
26479
|
+
/* ) */
|
|
26480
|
+
CHAR_ASTERISK: "*",
|
|
26481
|
+
/* * */
|
|
26482
|
+
// Non-alphabetic chars.
|
|
26483
|
+
CHAR_AMPERSAND: "&",
|
|
26484
|
+
/* & */
|
|
26485
|
+
CHAR_AT: "@",
|
|
26486
|
+
/* @ */
|
|
26487
|
+
CHAR_BACKSLASH: "\\",
|
|
26488
|
+
/* \ */
|
|
26489
|
+
CHAR_BACKTICK: "`",
|
|
26490
|
+
/* ` */
|
|
26491
|
+
CHAR_CARRIAGE_RETURN: "\r",
|
|
26492
|
+
/* \r */
|
|
26493
|
+
CHAR_CIRCUMFLEX_ACCENT: "^",
|
|
26494
|
+
/* ^ */
|
|
26495
|
+
CHAR_COLON: ":",
|
|
26496
|
+
/* : */
|
|
26497
|
+
CHAR_COMMA: ",",
|
|
26498
|
+
/* , */
|
|
26499
|
+
CHAR_DOLLAR: "$",
|
|
26500
|
+
/* . */
|
|
26501
|
+
CHAR_DOT: ".",
|
|
26502
|
+
/* . */
|
|
26503
|
+
CHAR_DOUBLE_QUOTE: '"',
|
|
26504
|
+
/* " */
|
|
26505
|
+
CHAR_EQUAL: "=",
|
|
26506
|
+
/* = */
|
|
26507
|
+
CHAR_EXCLAMATION_MARK: "!",
|
|
26508
|
+
/* ! */
|
|
26509
|
+
CHAR_FORM_FEED: "\f",
|
|
26510
|
+
/* \f */
|
|
26511
|
+
CHAR_FORWARD_SLASH: "/",
|
|
26512
|
+
/* / */
|
|
26513
|
+
CHAR_HASH: "#",
|
|
26514
|
+
/* # */
|
|
26515
|
+
CHAR_HYPHEN_MINUS: "-",
|
|
26516
|
+
/* - */
|
|
26517
|
+
CHAR_LEFT_ANGLE_BRACKET: "<",
|
|
26518
|
+
/* < */
|
|
26519
|
+
CHAR_LEFT_CURLY_BRACE: "{",
|
|
26520
|
+
/* { */
|
|
26521
|
+
CHAR_LEFT_SQUARE_BRACKET: "[",
|
|
26522
|
+
/* [ */
|
|
26523
|
+
CHAR_LINE_FEED: "\n",
|
|
26524
|
+
/* \n */
|
|
26525
|
+
CHAR_NO_BREAK_SPACE: "\xA0",
|
|
26526
|
+
/* \u00A0 */
|
|
26527
|
+
CHAR_PERCENT: "%",
|
|
26528
|
+
/* % */
|
|
26529
|
+
CHAR_PLUS: "+",
|
|
26530
|
+
/* + */
|
|
26531
|
+
CHAR_QUESTION_MARK: "?",
|
|
26532
|
+
/* ? */
|
|
26533
|
+
CHAR_RIGHT_ANGLE_BRACKET: ">",
|
|
26534
|
+
/* > */
|
|
26535
|
+
CHAR_RIGHT_CURLY_BRACE: "}",
|
|
26536
|
+
/* } */
|
|
26537
|
+
CHAR_RIGHT_SQUARE_BRACKET: "]",
|
|
26538
|
+
/* ] */
|
|
26539
|
+
CHAR_SEMICOLON: ";",
|
|
26540
|
+
/* ; */
|
|
26541
|
+
CHAR_SINGLE_QUOTE: "'",
|
|
26542
|
+
/* ' */
|
|
26543
|
+
CHAR_SPACE: " ",
|
|
26544
|
+
/* */
|
|
26545
|
+
CHAR_TAB: " ",
|
|
26546
|
+
/* \t */
|
|
26547
|
+
CHAR_UNDERSCORE: "_",
|
|
26548
|
+
/* _ */
|
|
26549
|
+
CHAR_VERTICAL_LINE: "|",
|
|
26550
|
+
/* | */
|
|
26551
|
+
CHAR_ZERO_WIDTH_NOBREAK_SPACE: "\uFEFF"
|
|
26552
|
+
/* \uFEFF */
|
|
26553
|
+
};
|
|
26554
|
+
}
|
|
26555
|
+
});
|
|
26556
|
+
|
|
26557
|
+
// node_modules/braces/lib/parse.js
|
|
26558
|
+
var require_parse = __commonJS({
|
|
26559
|
+
"node_modules/braces/lib/parse.js"(exports2, module2) {
|
|
26560
|
+
"use strict";
|
|
26561
|
+
var stringify = require_stringify();
|
|
26562
|
+
var {
|
|
26563
|
+
MAX_LENGTH,
|
|
26564
|
+
CHAR_BACKSLASH,
|
|
26565
|
+
/* \ */
|
|
26566
|
+
CHAR_BACKTICK,
|
|
26567
|
+
/* ` */
|
|
26568
|
+
CHAR_COMMA,
|
|
26569
|
+
/* , */
|
|
26570
|
+
CHAR_DOT,
|
|
26571
|
+
/* . */
|
|
26572
|
+
CHAR_LEFT_PARENTHESES,
|
|
26573
|
+
/* ( */
|
|
26574
|
+
CHAR_RIGHT_PARENTHESES,
|
|
26575
|
+
/* ) */
|
|
26576
|
+
CHAR_LEFT_CURLY_BRACE,
|
|
26577
|
+
/* { */
|
|
26578
|
+
CHAR_RIGHT_CURLY_BRACE,
|
|
26579
|
+
/* } */
|
|
26580
|
+
CHAR_LEFT_SQUARE_BRACKET,
|
|
26581
|
+
/* [ */
|
|
26582
|
+
CHAR_RIGHT_SQUARE_BRACKET,
|
|
26583
|
+
/* ] */
|
|
26584
|
+
CHAR_DOUBLE_QUOTE,
|
|
26585
|
+
/* " */
|
|
26586
|
+
CHAR_SINGLE_QUOTE,
|
|
26587
|
+
/* ' */
|
|
26588
|
+
CHAR_NO_BREAK_SPACE,
|
|
26589
|
+
CHAR_ZERO_WIDTH_NOBREAK_SPACE
|
|
26590
|
+
} = require_constants();
|
|
26591
|
+
var parse3 = (input, options = {}) => {
|
|
26592
|
+
if (typeof input !== "string") {
|
|
26593
|
+
throw new TypeError("Expected a string");
|
|
26594
|
+
}
|
|
26595
|
+
const opts = options || {};
|
|
26596
|
+
const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
|
26597
|
+
if (input.length > max) {
|
|
26598
|
+
throw new SyntaxError(`Input length (${input.length}), exceeds max characters (${max})`);
|
|
26599
|
+
}
|
|
26600
|
+
const ast = { type: "root", input, nodes: [] };
|
|
26601
|
+
const stack = [ast];
|
|
26602
|
+
let block = ast;
|
|
26603
|
+
let prev = ast;
|
|
26604
|
+
let brackets = 0;
|
|
26605
|
+
const length = input.length;
|
|
26606
|
+
let index = 0;
|
|
26607
|
+
let depth = 0;
|
|
26608
|
+
let value;
|
|
26609
|
+
const advance = () => input[index++];
|
|
26610
|
+
const push = (node) => {
|
|
26611
|
+
if (node.type === "text" && prev.type === "dot") {
|
|
26612
|
+
prev.type = "text";
|
|
26613
|
+
}
|
|
26614
|
+
if (prev && prev.type === "text" && node.type === "text") {
|
|
26615
|
+
prev.value += node.value;
|
|
26616
|
+
return;
|
|
26617
|
+
}
|
|
26618
|
+
block.nodes.push(node);
|
|
26619
|
+
node.parent = block;
|
|
26620
|
+
node.prev = prev;
|
|
26621
|
+
prev = node;
|
|
26622
|
+
return node;
|
|
26623
|
+
};
|
|
26624
|
+
push({ type: "bos" });
|
|
26625
|
+
while (index < length) {
|
|
26626
|
+
block = stack[stack.length - 1];
|
|
26627
|
+
value = advance();
|
|
26628
|
+
if (value === CHAR_ZERO_WIDTH_NOBREAK_SPACE || value === CHAR_NO_BREAK_SPACE) {
|
|
26629
|
+
continue;
|
|
26630
|
+
}
|
|
26631
|
+
if (value === CHAR_BACKSLASH) {
|
|
26632
|
+
push({ type: "text", value: (options.keepEscaping ? value : "") + advance() });
|
|
26633
|
+
continue;
|
|
26634
|
+
}
|
|
26635
|
+
if (value === CHAR_RIGHT_SQUARE_BRACKET) {
|
|
26636
|
+
push({ type: "text", value: "\\" + value });
|
|
26637
|
+
continue;
|
|
26638
|
+
}
|
|
26639
|
+
if (value === CHAR_LEFT_SQUARE_BRACKET) {
|
|
26640
|
+
brackets++;
|
|
26641
|
+
let next;
|
|
26642
|
+
while (index < length && (next = advance())) {
|
|
26643
|
+
value += next;
|
|
26644
|
+
if (next === CHAR_LEFT_SQUARE_BRACKET) {
|
|
26645
|
+
brackets++;
|
|
26646
|
+
continue;
|
|
26647
|
+
}
|
|
26648
|
+
if (next === CHAR_BACKSLASH) {
|
|
26649
|
+
value += advance();
|
|
26650
|
+
continue;
|
|
26651
|
+
}
|
|
26652
|
+
if (next === CHAR_RIGHT_SQUARE_BRACKET) {
|
|
26653
|
+
brackets--;
|
|
26654
|
+
if (brackets === 0) {
|
|
26655
|
+
break;
|
|
26656
|
+
}
|
|
26657
|
+
}
|
|
26658
|
+
}
|
|
26659
|
+
push({ type: "text", value });
|
|
26660
|
+
continue;
|
|
26661
|
+
}
|
|
26662
|
+
if (value === CHAR_LEFT_PARENTHESES) {
|
|
26663
|
+
block = push({ type: "paren", nodes: [] });
|
|
26664
|
+
stack.push(block);
|
|
26665
|
+
push({ type: "text", value });
|
|
26666
|
+
continue;
|
|
26667
|
+
}
|
|
26668
|
+
if (value === CHAR_RIGHT_PARENTHESES) {
|
|
26669
|
+
if (block.type !== "paren") {
|
|
26670
|
+
push({ type: "text", value });
|
|
26671
|
+
continue;
|
|
26672
|
+
}
|
|
26673
|
+
block = stack.pop();
|
|
26674
|
+
push({ type: "text", value });
|
|
26675
|
+
block = stack[stack.length - 1];
|
|
26676
|
+
continue;
|
|
26677
|
+
}
|
|
26678
|
+
if (value === CHAR_DOUBLE_QUOTE || value === CHAR_SINGLE_QUOTE || value === CHAR_BACKTICK) {
|
|
26679
|
+
const open2 = value;
|
|
26680
|
+
let next;
|
|
26681
|
+
if (options.keepQuotes !== true) {
|
|
26682
|
+
value = "";
|
|
26683
|
+
}
|
|
26684
|
+
while (index < length && (next = advance())) {
|
|
26685
|
+
if (next === CHAR_BACKSLASH) {
|
|
26686
|
+
value += next + advance();
|
|
26687
|
+
continue;
|
|
26688
|
+
}
|
|
26689
|
+
if (next === open2) {
|
|
26690
|
+
if (options.keepQuotes === true)
|
|
26691
|
+
value += next;
|
|
26692
|
+
break;
|
|
26693
|
+
}
|
|
26694
|
+
value += next;
|
|
26695
|
+
}
|
|
26696
|
+
push({ type: "text", value });
|
|
26697
|
+
continue;
|
|
26698
|
+
}
|
|
26699
|
+
if (value === CHAR_LEFT_CURLY_BRACE) {
|
|
26700
|
+
depth++;
|
|
26701
|
+
const dollar = prev.value && prev.value.slice(-1) === "$" || block.dollar === true;
|
|
26702
|
+
const brace = {
|
|
26703
|
+
type: "brace",
|
|
26704
|
+
open: true,
|
|
26705
|
+
close: false,
|
|
26706
|
+
dollar,
|
|
26707
|
+
depth,
|
|
26708
|
+
commas: 0,
|
|
26709
|
+
ranges: 0,
|
|
26710
|
+
nodes: []
|
|
26711
|
+
};
|
|
26712
|
+
block = push(brace);
|
|
26713
|
+
stack.push(block);
|
|
26714
|
+
push({ type: "open", value });
|
|
26715
|
+
continue;
|
|
26716
|
+
}
|
|
26717
|
+
if (value === CHAR_RIGHT_CURLY_BRACE) {
|
|
26718
|
+
if (block.type !== "brace") {
|
|
26719
|
+
push({ type: "text", value });
|
|
26720
|
+
continue;
|
|
26721
|
+
}
|
|
26722
|
+
const type = "close";
|
|
26723
|
+
block = stack.pop();
|
|
26724
|
+
block.close = true;
|
|
26725
|
+
push({ type, value });
|
|
26726
|
+
depth--;
|
|
26727
|
+
block = stack[stack.length - 1];
|
|
26728
|
+
continue;
|
|
26729
|
+
}
|
|
26730
|
+
if (value === CHAR_COMMA && depth > 0) {
|
|
26731
|
+
if (block.ranges > 0) {
|
|
26732
|
+
block.ranges = 0;
|
|
26733
|
+
const open2 = block.nodes.shift();
|
|
26734
|
+
block.nodes = [open2, { type: "text", value: stringify(block) }];
|
|
26735
|
+
}
|
|
26736
|
+
push({ type: "comma", value });
|
|
26737
|
+
block.commas++;
|
|
26738
|
+
continue;
|
|
26739
|
+
}
|
|
26740
|
+
if (value === CHAR_DOT && depth > 0 && block.commas === 0) {
|
|
26741
|
+
const siblings = block.nodes;
|
|
26742
|
+
if (depth === 0 || siblings.length === 0) {
|
|
26743
|
+
push({ type: "text", value });
|
|
26744
|
+
continue;
|
|
26745
|
+
}
|
|
26746
|
+
if (prev.type === "dot") {
|
|
26747
|
+
block.range = [];
|
|
26748
|
+
prev.value += value;
|
|
26749
|
+
prev.type = "range";
|
|
26750
|
+
if (block.nodes.length !== 3 && block.nodes.length !== 5) {
|
|
26751
|
+
block.invalid = true;
|
|
26752
|
+
block.ranges = 0;
|
|
26753
|
+
prev.type = "text";
|
|
26754
|
+
continue;
|
|
26755
|
+
}
|
|
26756
|
+
block.ranges++;
|
|
26757
|
+
block.args = [];
|
|
26758
|
+
continue;
|
|
26759
|
+
}
|
|
26760
|
+
if (prev.type === "range") {
|
|
26761
|
+
siblings.pop();
|
|
26762
|
+
const before = siblings[siblings.length - 1];
|
|
26763
|
+
before.value += prev.value + value;
|
|
26764
|
+
prev = before;
|
|
26765
|
+
block.ranges--;
|
|
26766
|
+
continue;
|
|
26767
|
+
}
|
|
26768
|
+
push({ type: "dot", value });
|
|
26769
|
+
continue;
|
|
26770
|
+
}
|
|
26771
|
+
push({ type: "text", value });
|
|
26772
|
+
}
|
|
26773
|
+
do {
|
|
26774
|
+
block = stack.pop();
|
|
26775
|
+
if (block.type !== "root") {
|
|
26776
|
+
block.nodes.forEach((node) => {
|
|
26777
|
+
if (!node.nodes) {
|
|
26778
|
+
if (node.type === "open")
|
|
26779
|
+
node.isOpen = true;
|
|
26780
|
+
if (node.type === "close")
|
|
26781
|
+
node.isClose = true;
|
|
26782
|
+
if (!node.nodes)
|
|
26783
|
+
node.type = "text";
|
|
26784
|
+
node.invalid = true;
|
|
26785
|
+
}
|
|
26786
|
+
});
|
|
26787
|
+
const parent = stack[stack.length - 1];
|
|
26788
|
+
const index2 = parent.nodes.indexOf(block);
|
|
26789
|
+
parent.nodes.splice(index2, 1, ...block.nodes);
|
|
26790
|
+
}
|
|
26791
|
+
} while (stack.length > 0);
|
|
26792
|
+
push({ type: "eos" });
|
|
26793
|
+
return ast;
|
|
26794
|
+
};
|
|
26795
|
+
module2.exports = parse3;
|
|
26796
|
+
}
|
|
26797
|
+
});
|
|
26798
|
+
|
|
26799
|
+
// node_modules/braces/index.js
|
|
26800
|
+
var require_braces = __commonJS({
|
|
26801
|
+
"node_modules/braces/index.js"(exports2, module2) {
|
|
26802
|
+
"use strict";
|
|
26803
|
+
var stringify = require_stringify();
|
|
26804
|
+
var compile = require_compile2();
|
|
26805
|
+
var expand = require_expand();
|
|
26806
|
+
var parse3 = require_parse();
|
|
26807
|
+
var braces = (input, options = {}) => {
|
|
26808
|
+
let output = [];
|
|
26809
|
+
if (Array.isArray(input)) {
|
|
26810
|
+
for (const pattern of input) {
|
|
26811
|
+
const result = braces.create(pattern, options);
|
|
26812
|
+
if (Array.isArray(result)) {
|
|
26813
|
+
output.push(...result);
|
|
26814
|
+
} else {
|
|
26815
|
+
output.push(result);
|
|
26816
|
+
}
|
|
26817
|
+
}
|
|
26818
|
+
} else {
|
|
26819
|
+
output = [].concat(braces.create(input, options));
|
|
26820
|
+
}
|
|
26821
|
+
if (options && options.expand === true && options.nodupes === true) {
|
|
26822
|
+
output = [...new Set(output)];
|
|
26823
|
+
}
|
|
26824
|
+
return output;
|
|
26825
|
+
};
|
|
26826
|
+
braces.parse = (input, options = {}) => parse3(input, options);
|
|
26827
|
+
braces.stringify = (input, options = {}) => {
|
|
26828
|
+
if (typeof input === "string") {
|
|
26829
|
+
return stringify(braces.parse(input, options), options);
|
|
26830
|
+
}
|
|
26831
|
+
return stringify(input, options);
|
|
26832
|
+
};
|
|
26833
|
+
braces.compile = (input, options = {}) => {
|
|
26834
|
+
if (typeof input === "string") {
|
|
26835
|
+
input = braces.parse(input, options);
|
|
26836
|
+
}
|
|
26837
|
+
return compile(input, options);
|
|
26838
|
+
};
|
|
26839
|
+
braces.expand = (input, options = {}) => {
|
|
26840
|
+
if (typeof input === "string") {
|
|
26841
|
+
input = braces.parse(input, options);
|
|
26842
|
+
}
|
|
26843
|
+
let result = expand(input, options);
|
|
26844
|
+
if (options.noempty === true) {
|
|
26845
|
+
result = result.filter(Boolean);
|
|
26846
|
+
}
|
|
26847
|
+
if (options.nodupes === true) {
|
|
26848
|
+
result = [...new Set(result)];
|
|
26849
|
+
}
|
|
26850
|
+
return result;
|
|
26851
|
+
};
|
|
26852
|
+
braces.create = (input, options = {}) => {
|
|
26853
|
+
if (input === "" || input.length < 3) {
|
|
26854
|
+
return [input];
|
|
26855
|
+
}
|
|
26856
|
+
return options.expand !== true ? braces.compile(input, options) : braces.expand(input, options);
|
|
26857
|
+
};
|
|
26858
|
+
module2.exports = braces;
|
|
26859
|
+
}
|
|
26860
|
+
});
|
|
26861
|
+
|
|
26862
|
+
// node_modules/micromatch/node_modules/picomatch/lib/constants.js
|
|
26863
|
+
var require_constants2 = __commonJS({
|
|
26864
|
+
"node_modules/micromatch/node_modules/picomatch/lib/constants.js"(exports2, module2) {
|
|
26865
|
+
"use strict";
|
|
26866
|
+
var path7 = require("path");
|
|
26867
|
+
var WIN_SLASH = "\\\\/";
|
|
26868
|
+
var WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
|
26869
|
+
var DEFAULT_MAX_EXTGLOB_RECURSION = 0;
|
|
26870
|
+
var DOT_LITERAL = "\\.";
|
|
26871
|
+
var PLUS_LITERAL = "\\+";
|
|
26872
|
+
var QMARK_LITERAL = "\\?";
|
|
26873
|
+
var SLASH_LITERAL = "\\/";
|
|
26874
|
+
var ONE_CHAR = "(?=.)";
|
|
26875
|
+
var QMARK = "[^/]";
|
|
26876
|
+
var END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
|
|
26877
|
+
var START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
|
|
26878
|
+
var DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
|
|
26879
|
+
var NO_DOT = `(?!${DOT_LITERAL})`;
|
|
26880
|
+
var NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
|
|
26881
|
+
var NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
|
|
26882
|
+
var NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
|
|
26883
|
+
var QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
|
|
26884
|
+
var STAR = `${QMARK}*?`;
|
|
26885
|
+
var POSIX_CHARS = {
|
|
26886
|
+
DOT_LITERAL,
|
|
26887
|
+
PLUS_LITERAL,
|
|
26888
|
+
QMARK_LITERAL,
|
|
26889
|
+
SLASH_LITERAL,
|
|
26890
|
+
ONE_CHAR,
|
|
26891
|
+
QMARK,
|
|
26892
|
+
END_ANCHOR,
|
|
26893
|
+
DOTS_SLASH,
|
|
26894
|
+
NO_DOT,
|
|
26895
|
+
NO_DOTS,
|
|
26896
|
+
NO_DOT_SLASH,
|
|
26897
|
+
NO_DOTS_SLASH,
|
|
26898
|
+
QMARK_NO_DOT,
|
|
26899
|
+
STAR,
|
|
26900
|
+
START_ANCHOR
|
|
26901
|
+
};
|
|
26902
|
+
var WINDOWS_CHARS = {
|
|
26903
|
+
...POSIX_CHARS,
|
|
26904
|
+
SLASH_LITERAL: `[${WIN_SLASH}]`,
|
|
26905
|
+
QMARK: WIN_NO_SLASH,
|
|
26906
|
+
STAR: `${WIN_NO_SLASH}*?`,
|
|
26907
|
+
DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
|
|
26908
|
+
NO_DOT: `(?!${DOT_LITERAL})`,
|
|
26909
|
+
NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
|
26910
|
+
NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
|
|
26911
|
+
NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
|
26912
|
+
QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
|
|
26913
|
+
START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
|
|
26914
|
+
END_ANCHOR: `(?:[${WIN_SLASH}]|$)`
|
|
26915
|
+
};
|
|
26916
|
+
var POSIX_REGEX_SOURCE = {
|
|
26917
|
+
__proto__: null,
|
|
26918
|
+
alnum: "a-zA-Z0-9",
|
|
26919
|
+
alpha: "a-zA-Z",
|
|
26920
|
+
ascii: "\\x00-\\x7F",
|
|
26921
|
+
blank: " \\t",
|
|
26922
|
+
cntrl: "\\x00-\\x1F\\x7F",
|
|
26923
|
+
digit: "0-9",
|
|
26924
|
+
graph: "\\x21-\\x7E",
|
|
26925
|
+
lower: "a-z",
|
|
26926
|
+
print: "\\x20-\\x7E ",
|
|
26927
|
+
punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",
|
|
26928
|
+
space: " \\t\\r\\n\\v\\f",
|
|
26929
|
+
upper: "A-Z",
|
|
26930
|
+
word: "A-Za-z0-9_",
|
|
26931
|
+
xdigit: "A-Fa-f0-9"
|
|
26932
|
+
};
|
|
26933
|
+
module2.exports = {
|
|
26934
|
+
DEFAULT_MAX_EXTGLOB_RECURSION,
|
|
26935
|
+
MAX_LENGTH: 1024 * 64,
|
|
26936
|
+
POSIX_REGEX_SOURCE,
|
|
26937
|
+
// regular expressions
|
|
26938
|
+
REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
|
|
26939
|
+
REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
|
|
26940
|
+
REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
|
|
26941
|
+
REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
|
|
26942
|
+
REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
|
|
26943
|
+
REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
|
|
26944
|
+
// Replace globs with equivalent patterns to reduce parsing time.
|
|
26945
|
+
REPLACEMENTS: {
|
|
26946
|
+
__proto__: null,
|
|
26947
|
+
"***": "*",
|
|
26948
|
+
"**/**": "**",
|
|
26949
|
+
"**/**/**": "**"
|
|
26950
|
+
},
|
|
26951
|
+
// Digits
|
|
26952
|
+
CHAR_0: 48,
|
|
26953
|
+
/* 0 */
|
|
26954
|
+
CHAR_9: 57,
|
|
26955
|
+
/* 9 */
|
|
26956
|
+
// Alphabet chars.
|
|
26957
|
+
CHAR_UPPERCASE_A: 65,
|
|
26958
|
+
/* A */
|
|
26959
|
+
CHAR_LOWERCASE_A: 97,
|
|
26960
|
+
/* a */
|
|
26961
|
+
CHAR_UPPERCASE_Z: 90,
|
|
26962
|
+
/* Z */
|
|
26963
|
+
CHAR_LOWERCASE_Z: 122,
|
|
26964
|
+
/* z */
|
|
26965
|
+
CHAR_LEFT_PARENTHESES: 40,
|
|
26966
|
+
/* ( */
|
|
26967
|
+
CHAR_RIGHT_PARENTHESES: 41,
|
|
26968
|
+
/* ) */
|
|
26969
|
+
CHAR_ASTERISK: 42,
|
|
26970
|
+
/* * */
|
|
26971
|
+
// Non-alphabetic chars.
|
|
26972
|
+
CHAR_AMPERSAND: 38,
|
|
26973
|
+
/* & */
|
|
26974
|
+
CHAR_AT: 64,
|
|
26975
|
+
/* @ */
|
|
26976
|
+
CHAR_BACKWARD_SLASH: 92,
|
|
26977
|
+
/* \ */
|
|
26978
|
+
CHAR_CARRIAGE_RETURN: 13,
|
|
26979
|
+
/* \r */
|
|
26980
|
+
CHAR_CIRCUMFLEX_ACCENT: 94,
|
|
26981
|
+
/* ^ */
|
|
26982
|
+
CHAR_COLON: 58,
|
|
26983
|
+
/* : */
|
|
26984
|
+
CHAR_COMMA: 44,
|
|
26985
|
+
/* , */
|
|
26986
|
+
CHAR_DOT: 46,
|
|
26987
|
+
/* . */
|
|
26988
|
+
CHAR_DOUBLE_QUOTE: 34,
|
|
26989
|
+
/* " */
|
|
26990
|
+
CHAR_EQUAL: 61,
|
|
26991
|
+
/* = */
|
|
26992
|
+
CHAR_EXCLAMATION_MARK: 33,
|
|
26993
|
+
/* ! */
|
|
26994
|
+
CHAR_FORM_FEED: 12,
|
|
26995
|
+
/* \f */
|
|
26996
|
+
CHAR_FORWARD_SLASH: 47,
|
|
26997
|
+
/* / */
|
|
26998
|
+
CHAR_GRAVE_ACCENT: 96,
|
|
26999
|
+
/* ` */
|
|
27000
|
+
CHAR_HASH: 35,
|
|
27001
|
+
/* # */
|
|
27002
|
+
CHAR_HYPHEN_MINUS: 45,
|
|
27003
|
+
/* - */
|
|
27004
|
+
CHAR_LEFT_ANGLE_BRACKET: 60,
|
|
27005
|
+
/* < */
|
|
27006
|
+
CHAR_LEFT_CURLY_BRACE: 123,
|
|
27007
|
+
/* { */
|
|
27008
|
+
CHAR_LEFT_SQUARE_BRACKET: 91,
|
|
27009
|
+
/* [ */
|
|
27010
|
+
CHAR_LINE_FEED: 10,
|
|
27011
|
+
/* \n */
|
|
27012
|
+
CHAR_NO_BREAK_SPACE: 160,
|
|
27013
|
+
/* \u00A0 */
|
|
27014
|
+
CHAR_PERCENT: 37,
|
|
27015
|
+
/* % */
|
|
27016
|
+
CHAR_PLUS: 43,
|
|
27017
|
+
/* + */
|
|
27018
|
+
CHAR_QUESTION_MARK: 63,
|
|
27019
|
+
/* ? */
|
|
27020
|
+
CHAR_RIGHT_ANGLE_BRACKET: 62,
|
|
27021
|
+
/* > */
|
|
27022
|
+
CHAR_RIGHT_CURLY_BRACE: 125,
|
|
27023
|
+
/* } */
|
|
27024
|
+
CHAR_RIGHT_SQUARE_BRACKET: 93,
|
|
27025
|
+
/* ] */
|
|
27026
|
+
CHAR_SEMICOLON: 59,
|
|
27027
|
+
/* ; */
|
|
27028
|
+
CHAR_SINGLE_QUOTE: 39,
|
|
27029
|
+
/* ' */
|
|
27030
|
+
CHAR_SPACE: 32,
|
|
27031
|
+
/* */
|
|
27032
|
+
CHAR_TAB: 9,
|
|
27033
|
+
/* \t */
|
|
27034
|
+
CHAR_UNDERSCORE: 95,
|
|
27035
|
+
/* _ */
|
|
27036
|
+
CHAR_VERTICAL_LINE: 124,
|
|
27037
|
+
/* | */
|
|
27038
|
+
CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
|
|
27039
|
+
/* \uFEFF */
|
|
27040
|
+
SEP: path7.sep,
|
|
27041
|
+
/**
|
|
27042
|
+
* Create EXTGLOB_CHARS
|
|
27043
|
+
*/
|
|
27044
|
+
extglobChars(chars) {
|
|
27045
|
+
return {
|
|
27046
|
+
"!": { type: "negate", open: "(?:(?!(?:", close: `))${chars.STAR})` },
|
|
27047
|
+
"?": { type: "qmark", open: "(?:", close: ")?" },
|
|
27048
|
+
"+": { type: "plus", open: "(?:", close: ")+" },
|
|
27049
|
+
"*": { type: "star", open: "(?:", close: ")*" },
|
|
27050
|
+
"@": { type: "at", open: "(?:", close: ")" }
|
|
27051
|
+
};
|
|
27052
|
+
},
|
|
27053
|
+
/**
|
|
27054
|
+
* Create GLOB_CHARS
|
|
27055
|
+
*/
|
|
27056
|
+
globChars(win32) {
|
|
27057
|
+
return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
|
|
27058
|
+
}
|
|
27059
|
+
};
|
|
27060
|
+
}
|
|
27061
|
+
});
|
|
27062
|
+
|
|
27063
|
+
// node_modules/micromatch/node_modules/picomatch/lib/utils.js
|
|
27064
|
+
var require_utils3 = __commonJS({
|
|
27065
|
+
"node_modules/micromatch/node_modules/picomatch/lib/utils.js"(exports2) {
|
|
27066
|
+
"use strict";
|
|
27067
|
+
var path7 = require("path");
|
|
27068
|
+
var win32 = process.platform === "win32";
|
|
27069
|
+
var {
|
|
27070
|
+
REGEX_BACKSLASH,
|
|
27071
|
+
REGEX_REMOVE_BACKSLASH,
|
|
27072
|
+
REGEX_SPECIAL_CHARS,
|
|
27073
|
+
REGEX_SPECIAL_CHARS_GLOBAL
|
|
27074
|
+
} = require_constants2();
|
|
27075
|
+
exports2.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
|
|
27076
|
+
exports2.hasRegexChars = (str) => REGEX_SPECIAL_CHARS.test(str);
|
|
27077
|
+
exports2.isRegexChar = (str) => str.length === 1 && exports2.hasRegexChars(str);
|
|
27078
|
+
exports2.escapeRegex = (str) => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, "\\$1");
|
|
27079
|
+
exports2.toPosixSlashes = (str) => str.replace(REGEX_BACKSLASH, "/");
|
|
27080
|
+
exports2.removeBackslashes = (str) => {
|
|
27081
|
+
return str.replace(REGEX_REMOVE_BACKSLASH, (match) => {
|
|
27082
|
+
return match === "\\" ? "" : match;
|
|
27083
|
+
});
|
|
27084
|
+
};
|
|
27085
|
+
exports2.supportsLookbehinds = () => {
|
|
27086
|
+
const segs = process.version.slice(1).split(".").map(Number);
|
|
27087
|
+
if (segs.length === 3 && segs[0] >= 9 || segs[0] === 8 && segs[1] >= 10) {
|
|
27088
|
+
return true;
|
|
27089
|
+
}
|
|
27090
|
+
return false;
|
|
27091
|
+
};
|
|
27092
|
+
exports2.isWindows = (options) => {
|
|
27093
|
+
if (options && typeof options.windows === "boolean") {
|
|
27094
|
+
return options.windows;
|
|
27095
|
+
}
|
|
27096
|
+
return win32 === true || path7.sep === "\\";
|
|
27097
|
+
};
|
|
27098
|
+
exports2.escapeLast = (input, char, lastIdx) => {
|
|
27099
|
+
const idx = input.lastIndexOf(char, lastIdx);
|
|
27100
|
+
if (idx === -1)
|
|
27101
|
+
return input;
|
|
27102
|
+
if (input[idx - 1] === "\\")
|
|
27103
|
+
return exports2.escapeLast(input, char, idx - 1);
|
|
27104
|
+
return `${input.slice(0, idx)}\\${input.slice(idx)}`;
|
|
27105
|
+
};
|
|
27106
|
+
exports2.removePrefix = (input, state = {}) => {
|
|
27107
|
+
let output = input;
|
|
27108
|
+
if (output.startsWith("./")) {
|
|
27109
|
+
output = output.slice(2);
|
|
27110
|
+
state.prefix = "./";
|
|
27111
|
+
}
|
|
27112
|
+
return output;
|
|
27113
|
+
};
|
|
27114
|
+
exports2.wrapOutput = (input, state = {}, options = {}) => {
|
|
27115
|
+
const prepend = options.contains ? "" : "^";
|
|
27116
|
+
const append = options.contains ? "" : "$";
|
|
27117
|
+
let output = `${prepend}(?:${input})${append}`;
|
|
27118
|
+
if (state.negated === true) {
|
|
27119
|
+
output = `(?:^(?!${output}).*$)`;
|
|
27120
|
+
}
|
|
27121
|
+
return output;
|
|
27122
|
+
};
|
|
27123
|
+
}
|
|
27124
|
+
});
|
|
27125
|
+
|
|
27126
|
+
// node_modules/micromatch/node_modules/picomatch/lib/scan.js
|
|
27127
|
+
var require_scan = __commonJS({
|
|
27128
|
+
"node_modules/micromatch/node_modules/picomatch/lib/scan.js"(exports2, module2) {
|
|
27129
|
+
"use strict";
|
|
27130
|
+
var utils = require_utils3();
|
|
27131
|
+
var {
|
|
27132
|
+
CHAR_ASTERISK,
|
|
27133
|
+
/* * */
|
|
27134
|
+
CHAR_AT,
|
|
27135
|
+
/* @ */
|
|
27136
|
+
CHAR_BACKWARD_SLASH,
|
|
27137
|
+
/* \ */
|
|
27138
|
+
CHAR_COMMA,
|
|
27139
|
+
/* , */
|
|
27140
|
+
CHAR_DOT,
|
|
27141
|
+
/* . */
|
|
27142
|
+
CHAR_EXCLAMATION_MARK,
|
|
27143
|
+
/* ! */
|
|
27144
|
+
CHAR_FORWARD_SLASH,
|
|
27145
|
+
/* / */
|
|
27146
|
+
CHAR_LEFT_CURLY_BRACE,
|
|
27147
|
+
/* { */
|
|
27148
|
+
CHAR_LEFT_PARENTHESES,
|
|
27149
|
+
/* ( */
|
|
27150
|
+
CHAR_LEFT_SQUARE_BRACKET,
|
|
27151
|
+
/* [ */
|
|
27152
|
+
CHAR_PLUS,
|
|
27153
|
+
/* + */
|
|
27154
|
+
CHAR_QUESTION_MARK,
|
|
27155
|
+
/* ? */
|
|
27156
|
+
CHAR_RIGHT_CURLY_BRACE,
|
|
27157
|
+
/* } */
|
|
27158
|
+
CHAR_RIGHT_PARENTHESES,
|
|
27159
|
+
/* ) */
|
|
27160
|
+
CHAR_RIGHT_SQUARE_BRACKET
|
|
27161
|
+
/* ] */
|
|
27162
|
+
} = require_constants2();
|
|
27163
|
+
var isPathSeparator = (code) => {
|
|
27164
|
+
return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
|
|
27165
|
+
};
|
|
27166
|
+
var depth = (token) => {
|
|
27167
|
+
if (token.isPrefix !== true) {
|
|
27168
|
+
token.depth = token.isGlobstar ? Infinity : 1;
|
|
27169
|
+
}
|
|
27170
|
+
};
|
|
27171
|
+
var scan = (input, options) => {
|
|
27172
|
+
const opts = options || {};
|
|
27173
|
+
const length = input.length - 1;
|
|
27174
|
+
const scanToEnd = opts.parts === true || opts.scanToEnd === true;
|
|
27175
|
+
const slashes = [];
|
|
27176
|
+
const tokens = [];
|
|
27177
|
+
const parts = [];
|
|
27178
|
+
let str = input;
|
|
27179
|
+
let index = -1;
|
|
27180
|
+
let start = 0;
|
|
27181
|
+
let lastIndex = 0;
|
|
27182
|
+
let isBrace = false;
|
|
27183
|
+
let isBracket = false;
|
|
27184
|
+
let isGlob = false;
|
|
27185
|
+
let isExtglob = false;
|
|
27186
|
+
let isGlobstar = false;
|
|
27187
|
+
let braceEscaped = false;
|
|
27188
|
+
let backslashes = false;
|
|
27189
|
+
let negated = false;
|
|
27190
|
+
let negatedExtglob = false;
|
|
27191
|
+
let finished = false;
|
|
27192
|
+
let braces = 0;
|
|
27193
|
+
let prev;
|
|
27194
|
+
let code;
|
|
27195
|
+
let token = { value: "", depth: 0, isGlob: false };
|
|
27196
|
+
const eos = () => index >= length;
|
|
27197
|
+
const peek = () => str.charCodeAt(index + 1);
|
|
27198
|
+
const advance = () => {
|
|
27199
|
+
prev = code;
|
|
27200
|
+
return str.charCodeAt(++index);
|
|
27201
|
+
};
|
|
27202
|
+
while (index < length) {
|
|
27203
|
+
code = advance();
|
|
27204
|
+
let next;
|
|
27205
|
+
if (code === CHAR_BACKWARD_SLASH) {
|
|
27206
|
+
backslashes = token.backslashes = true;
|
|
27207
|
+
code = advance();
|
|
27208
|
+
if (code === CHAR_LEFT_CURLY_BRACE) {
|
|
27209
|
+
braceEscaped = true;
|
|
27210
|
+
}
|
|
27211
|
+
continue;
|
|
27212
|
+
}
|
|
27213
|
+
if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
|
|
27214
|
+
braces++;
|
|
27215
|
+
while (eos() !== true && (code = advance())) {
|
|
27216
|
+
if (code === CHAR_BACKWARD_SLASH) {
|
|
27217
|
+
backslashes = token.backslashes = true;
|
|
27218
|
+
advance();
|
|
27219
|
+
continue;
|
|
27220
|
+
}
|
|
27221
|
+
if (code === CHAR_LEFT_CURLY_BRACE) {
|
|
27222
|
+
braces++;
|
|
27223
|
+
continue;
|
|
27224
|
+
}
|
|
27225
|
+
if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
|
|
27226
|
+
isBrace = token.isBrace = true;
|
|
27227
|
+
isGlob = token.isGlob = true;
|
|
27228
|
+
finished = true;
|
|
27229
|
+
if (scanToEnd === true) {
|
|
27230
|
+
continue;
|
|
27231
|
+
}
|
|
27232
|
+
break;
|
|
27233
|
+
}
|
|
27234
|
+
if (braceEscaped !== true && code === CHAR_COMMA) {
|
|
27235
|
+
isBrace = token.isBrace = true;
|
|
27236
|
+
isGlob = token.isGlob = true;
|
|
27237
|
+
finished = true;
|
|
27238
|
+
if (scanToEnd === true) {
|
|
27239
|
+
continue;
|
|
27240
|
+
}
|
|
27241
|
+
break;
|
|
27242
|
+
}
|
|
27243
|
+
if (code === CHAR_RIGHT_CURLY_BRACE) {
|
|
27244
|
+
braces--;
|
|
27245
|
+
if (braces === 0) {
|
|
27246
|
+
braceEscaped = false;
|
|
27247
|
+
isBrace = token.isBrace = true;
|
|
27248
|
+
finished = true;
|
|
27249
|
+
break;
|
|
27250
|
+
}
|
|
27251
|
+
}
|
|
27252
|
+
}
|
|
27253
|
+
if (scanToEnd === true) {
|
|
27254
|
+
continue;
|
|
27255
|
+
}
|
|
27256
|
+
break;
|
|
27257
|
+
}
|
|
27258
|
+
if (code === CHAR_FORWARD_SLASH) {
|
|
27259
|
+
slashes.push(index);
|
|
27260
|
+
tokens.push(token);
|
|
27261
|
+
token = { value: "", depth: 0, isGlob: false };
|
|
27262
|
+
if (finished === true)
|
|
27263
|
+
continue;
|
|
27264
|
+
if (prev === CHAR_DOT && index === start + 1) {
|
|
27265
|
+
start += 2;
|
|
27266
|
+
continue;
|
|
27267
|
+
}
|
|
27268
|
+
lastIndex = index + 1;
|
|
27269
|
+
continue;
|
|
27270
|
+
}
|
|
27271
|
+
if (opts.noext !== true) {
|
|
27272
|
+
const isExtglobChar = code === CHAR_PLUS || code === CHAR_AT || code === CHAR_ASTERISK || code === CHAR_QUESTION_MARK || code === CHAR_EXCLAMATION_MARK;
|
|
27273
|
+
if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) {
|
|
27274
|
+
isGlob = token.isGlob = true;
|
|
27275
|
+
isExtglob = token.isExtglob = true;
|
|
27276
|
+
finished = true;
|
|
27277
|
+
if (code === CHAR_EXCLAMATION_MARK && index === start) {
|
|
27278
|
+
negatedExtglob = true;
|
|
27279
|
+
}
|
|
27280
|
+
if (scanToEnd === true) {
|
|
27281
|
+
while (eos() !== true && (code = advance())) {
|
|
27282
|
+
if (code === CHAR_BACKWARD_SLASH) {
|
|
27283
|
+
backslashes = token.backslashes = true;
|
|
27284
|
+
code = advance();
|
|
27285
|
+
continue;
|
|
27286
|
+
}
|
|
27287
|
+
if (code === CHAR_RIGHT_PARENTHESES) {
|
|
27288
|
+
isGlob = token.isGlob = true;
|
|
27289
|
+
finished = true;
|
|
27290
|
+
break;
|
|
27291
|
+
}
|
|
27292
|
+
}
|
|
27293
|
+
continue;
|
|
27294
|
+
}
|
|
27295
|
+
break;
|
|
27296
|
+
}
|
|
27297
|
+
}
|
|
27298
|
+
if (code === CHAR_ASTERISK) {
|
|
27299
|
+
if (prev === CHAR_ASTERISK)
|
|
27300
|
+
isGlobstar = token.isGlobstar = true;
|
|
27301
|
+
isGlob = token.isGlob = true;
|
|
27302
|
+
finished = true;
|
|
27303
|
+
if (scanToEnd === true) {
|
|
27304
|
+
continue;
|
|
27305
|
+
}
|
|
27306
|
+
break;
|
|
27307
|
+
}
|
|
27308
|
+
if (code === CHAR_QUESTION_MARK) {
|
|
27309
|
+
isGlob = token.isGlob = true;
|
|
27310
|
+
finished = true;
|
|
27311
|
+
if (scanToEnd === true) {
|
|
27312
|
+
continue;
|
|
27313
|
+
}
|
|
27314
|
+
break;
|
|
27315
|
+
}
|
|
27316
|
+
if (code === CHAR_LEFT_SQUARE_BRACKET) {
|
|
27317
|
+
while (eos() !== true && (next = advance())) {
|
|
27318
|
+
if (next === CHAR_BACKWARD_SLASH) {
|
|
27319
|
+
backslashes = token.backslashes = true;
|
|
27320
|
+
advance();
|
|
27321
|
+
continue;
|
|
27322
|
+
}
|
|
27323
|
+
if (next === CHAR_RIGHT_SQUARE_BRACKET) {
|
|
27324
|
+
isBracket = token.isBracket = true;
|
|
27325
|
+
isGlob = token.isGlob = true;
|
|
27326
|
+
finished = true;
|
|
27327
|
+
break;
|
|
27328
|
+
}
|
|
27329
|
+
}
|
|
27330
|
+
if (scanToEnd === true) {
|
|
27331
|
+
continue;
|
|
27332
|
+
}
|
|
27333
|
+
break;
|
|
27334
|
+
}
|
|
27335
|
+
if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
|
|
27336
|
+
negated = token.negated = true;
|
|
27337
|
+
start++;
|
|
27338
|
+
continue;
|
|
27339
|
+
}
|
|
27340
|
+
if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
|
|
27341
|
+
isGlob = token.isGlob = true;
|
|
27342
|
+
if (scanToEnd === true) {
|
|
27343
|
+
while (eos() !== true && (code = advance())) {
|
|
27344
|
+
if (code === CHAR_LEFT_PARENTHESES) {
|
|
27345
|
+
backslashes = token.backslashes = true;
|
|
27346
|
+
code = advance();
|
|
27347
|
+
continue;
|
|
27348
|
+
}
|
|
27349
|
+
if (code === CHAR_RIGHT_PARENTHESES) {
|
|
27350
|
+
finished = true;
|
|
27351
|
+
break;
|
|
27352
|
+
}
|
|
27353
|
+
}
|
|
27354
|
+
continue;
|
|
27355
|
+
}
|
|
27356
|
+
break;
|
|
27357
|
+
}
|
|
27358
|
+
if (isGlob === true) {
|
|
27359
|
+
finished = true;
|
|
27360
|
+
if (scanToEnd === true) {
|
|
27361
|
+
continue;
|
|
27362
|
+
}
|
|
27363
|
+
break;
|
|
27364
|
+
}
|
|
27365
|
+
}
|
|
27366
|
+
if (opts.noext === true) {
|
|
27367
|
+
isExtglob = false;
|
|
27368
|
+
isGlob = false;
|
|
27369
|
+
}
|
|
27370
|
+
let base = str;
|
|
27371
|
+
let prefix = "";
|
|
27372
|
+
let glob = "";
|
|
27373
|
+
if (start > 0) {
|
|
27374
|
+
prefix = str.slice(0, start);
|
|
27375
|
+
str = str.slice(start);
|
|
27376
|
+
lastIndex -= start;
|
|
27377
|
+
}
|
|
27378
|
+
if (base && isGlob === true && lastIndex > 0) {
|
|
27379
|
+
base = str.slice(0, lastIndex);
|
|
27380
|
+
glob = str.slice(lastIndex);
|
|
27381
|
+
} else if (isGlob === true) {
|
|
27382
|
+
base = "";
|
|
27383
|
+
glob = str;
|
|
27384
|
+
} else {
|
|
27385
|
+
base = str;
|
|
27386
|
+
}
|
|
27387
|
+
if (base && base !== "" && base !== "/" && base !== str) {
|
|
27388
|
+
if (isPathSeparator(base.charCodeAt(base.length - 1))) {
|
|
27389
|
+
base = base.slice(0, -1);
|
|
27390
|
+
}
|
|
27391
|
+
}
|
|
27392
|
+
if (opts.unescape === true) {
|
|
27393
|
+
if (glob)
|
|
27394
|
+
glob = utils.removeBackslashes(glob);
|
|
27395
|
+
if (base && backslashes === true) {
|
|
27396
|
+
base = utils.removeBackslashes(base);
|
|
27397
|
+
}
|
|
27398
|
+
}
|
|
27399
|
+
const state = {
|
|
27400
|
+
prefix,
|
|
27401
|
+
input,
|
|
27402
|
+
start,
|
|
27403
|
+
base,
|
|
27404
|
+
glob,
|
|
27405
|
+
isBrace,
|
|
27406
|
+
isBracket,
|
|
27407
|
+
isGlob,
|
|
27408
|
+
isExtglob,
|
|
27409
|
+
isGlobstar,
|
|
27410
|
+
negated,
|
|
27411
|
+
negatedExtglob
|
|
27412
|
+
};
|
|
27413
|
+
if (opts.tokens === true) {
|
|
27414
|
+
state.maxDepth = 0;
|
|
27415
|
+
if (!isPathSeparator(code)) {
|
|
27416
|
+
tokens.push(token);
|
|
27417
|
+
}
|
|
27418
|
+
state.tokens = tokens;
|
|
27419
|
+
}
|
|
27420
|
+
if (opts.parts === true || opts.tokens === true) {
|
|
27421
|
+
let prevIndex;
|
|
27422
|
+
for (let idx = 0; idx < slashes.length; idx++) {
|
|
27423
|
+
const n = prevIndex ? prevIndex + 1 : start;
|
|
27424
|
+
const i = slashes[idx];
|
|
27425
|
+
const value = input.slice(n, i);
|
|
27426
|
+
if (opts.tokens) {
|
|
27427
|
+
if (idx === 0 && start !== 0) {
|
|
27428
|
+
tokens[idx].isPrefix = true;
|
|
27429
|
+
tokens[idx].value = prefix;
|
|
27430
|
+
} else {
|
|
27431
|
+
tokens[idx].value = value;
|
|
27432
|
+
}
|
|
27433
|
+
depth(tokens[idx]);
|
|
27434
|
+
state.maxDepth += tokens[idx].depth;
|
|
27435
|
+
}
|
|
27436
|
+
if (idx !== 0 || value !== "") {
|
|
27437
|
+
parts.push(value);
|
|
27438
|
+
}
|
|
27439
|
+
prevIndex = i;
|
|
27440
|
+
}
|
|
27441
|
+
if (prevIndex && prevIndex + 1 < input.length) {
|
|
27442
|
+
const value = input.slice(prevIndex + 1);
|
|
27443
|
+
parts.push(value);
|
|
27444
|
+
if (opts.tokens) {
|
|
27445
|
+
tokens[tokens.length - 1].value = value;
|
|
27446
|
+
depth(tokens[tokens.length - 1]);
|
|
27447
|
+
state.maxDepth += tokens[tokens.length - 1].depth;
|
|
27448
|
+
}
|
|
27449
|
+
}
|
|
27450
|
+
state.slashes = slashes;
|
|
27451
|
+
state.parts = parts;
|
|
27452
|
+
}
|
|
27453
|
+
return state;
|
|
27454
|
+
};
|
|
27455
|
+
module2.exports = scan;
|
|
27456
|
+
}
|
|
27457
|
+
});
|
|
27458
|
+
|
|
27459
|
+
// node_modules/micromatch/node_modules/picomatch/lib/parse.js
|
|
27460
|
+
var require_parse2 = __commonJS({
|
|
27461
|
+
"node_modules/micromatch/node_modules/picomatch/lib/parse.js"(exports2, module2) {
|
|
27462
|
+
"use strict";
|
|
27463
|
+
var constants = require_constants2();
|
|
27464
|
+
var utils = require_utils3();
|
|
27465
|
+
var {
|
|
27466
|
+
MAX_LENGTH,
|
|
27467
|
+
POSIX_REGEX_SOURCE,
|
|
27468
|
+
REGEX_NON_SPECIAL_CHARS,
|
|
27469
|
+
REGEX_SPECIAL_CHARS_BACKREF,
|
|
27470
|
+
REPLACEMENTS
|
|
27471
|
+
} = constants;
|
|
27472
|
+
var expandRange = (args, options) => {
|
|
27473
|
+
if (typeof options.expandRange === "function") {
|
|
27474
|
+
return options.expandRange(...args, options);
|
|
27475
|
+
}
|
|
27476
|
+
args.sort();
|
|
27477
|
+
const value = `[${args.join("-")}]`;
|
|
27478
|
+
try {
|
|
27479
|
+
new RegExp(value);
|
|
27480
|
+
} catch (ex) {
|
|
27481
|
+
return args.map((v) => utils.escapeRegex(v)).join("..");
|
|
27482
|
+
}
|
|
27483
|
+
return value;
|
|
27484
|
+
};
|
|
27485
|
+
var syntaxError = (type, char) => {
|
|
27486
|
+
return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
|
|
27487
|
+
};
|
|
27488
|
+
var splitTopLevel = (input) => {
|
|
27489
|
+
const parts = [];
|
|
27490
|
+
let bracket = 0;
|
|
27491
|
+
let paren = 0;
|
|
27492
|
+
let quote = 0;
|
|
27493
|
+
let value = "";
|
|
27494
|
+
let escaped = false;
|
|
27495
|
+
for (const ch of input) {
|
|
27496
|
+
if (escaped === true) {
|
|
27497
|
+
value += ch;
|
|
27498
|
+
escaped = false;
|
|
27499
|
+
continue;
|
|
27500
|
+
}
|
|
27501
|
+
if (ch === "\\") {
|
|
27502
|
+
value += ch;
|
|
27503
|
+
escaped = true;
|
|
27504
|
+
continue;
|
|
27505
|
+
}
|
|
27506
|
+
if (ch === '"') {
|
|
27507
|
+
quote = quote === 1 ? 0 : 1;
|
|
27508
|
+
value += ch;
|
|
27509
|
+
continue;
|
|
27510
|
+
}
|
|
27511
|
+
if (quote === 0) {
|
|
27512
|
+
if (ch === "[") {
|
|
27513
|
+
bracket++;
|
|
27514
|
+
} else if (ch === "]" && bracket > 0) {
|
|
27515
|
+
bracket--;
|
|
27516
|
+
} else if (bracket === 0) {
|
|
27517
|
+
if (ch === "(") {
|
|
27518
|
+
paren++;
|
|
27519
|
+
} else if (ch === ")" && paren > 0) {
|
|
27520
|
+
paren--;
|
|
27521
|
+
} else if (ch === "|" && paren === 0) {
|
|
27522
|
+
parts.push(value);
|
|
27523
|
+
value = "";
|
|
27524
|
+
continue;
|
|
27525
|
+
}
|
|
27526
|
+
}
|
|
27527
|
+
}
|
|
27528
|
+
value += ch;
|
|
27529
|
+
}
|
|
27530
|
+
parts.push(value);
|
|
27531
|
+
return parts;
|
|
27532
|
+
};
|
|
27533
|
+
var isPlainBranch = (branch) => {
|
|
27534
|
+
let escaped = false;
|
|
27535
|
+
for (const ch of branch) {
|
|
27536
|
+
if (escaped === true) {
|
|
27537
|
+
escaped = false;
|
|
27538
|
+
continue;
|
|
27539
|
+
}
|
|
27540
|
+
if (ch === "\\") {
|
|
27541
|
+
escaped = true;
|
|
27542
|
+
continue;
|
|
27543
|
+
}
|
|
27544
|
+
if (/[?*+@!()[\]{}]/.test(ch)) {
|
|
27545
|
+
return false;
|
|
27546
|
+
}
|
|
27547
|
+
}
|
|
27548
|
+
return true;
|
|
27549
|
+
};
|
|
27550
|
+
var normalizeSimpleBranch = (branch) => {
|
|
27551
|
+
let value = branch.trim();
|
|
27552
|
+
let changed = true;
|
|
27553
|
+
while (changed === true) {
|
|
27554
|
+
changed = false;
|
|
27555
|
+
if (/^@\([^\\()[\]{}|]+\)$/.test(value)) {
|
|
27556
|
+
value = value.slice(2, -1);
|
|
27557
|
+
changed = true;
|
|
27558
|
+
}
|
|
27559
|
+
}
|
|
27560
|
+
if (!isPlainBranch(value)) {
|
|
27561
|
+
return;
|
|
27562
|
+
}
|
|
27563
|
+
return value.replace(/\\(.)/g, "$1");
|
|
27564
|
+
};
|
|
27565
|
+
var hasRepeatedCharPrefixOverlap = (branches) => {
|
|
27566
|
+
const values = branches.map(normalizeSimpleBranch).filter(Boolean);
|
|
27567
|
+
for (let i = 0; i < values.length; i++) {
|
|
27568
|
+
for (let j = i + 1; j < values.length; j++) {
|
|
27569
|
+
const a = values[i];
|
|
27570
|
+
const b = values[j];
|
|
27571
|
+
const char = a[0];
|
|
27572
|
+
if (!char || a !== char.repeat(a.length) || b !== char.repeat(b.length)) {
|
|
27573
|
+
continue;
|
|
27574
|
+
}
|
|
27575
|
+
if (a === b || a.startsWith(b) || b.startsWith(a)) {
|
|
27576
|
+
return true;
|
|
27577
|
+
}
|
|
27578
|
+
}
|
|
27579
|
+
}
|
|
27580
|
+
return false;
|
|
27581
|
+
};
|
|
27582
|
+
var parseRepeatedExtglob = (pattern, requireEnd = true) => {
|
|
27583
|
+
if (pattern[0] !== "+" && pattern[0] !== "*" || pattern[1] !== "(") {
|
|
27584
|
+
return;
|
|
27585
|
+
}
|
|
27586
|
+
let bracket = 0;
|
|
27587
|
+
let paren = 0;
|
|
27588
|
+
let quote = 0;
|
|
27589
|
+
let escaped = false;
|
|
27590
|
+
for (let i = 1; i < pattern.length; i++) {
|
|
27591
|
+
const ch = pattern[i];
|
|
27592
|
+
if (escaped === true) {
|
|
27593
|
+
escaped = false;
|
|
27594
|
+
continue;
|
|
27595
|
+
}
|
|
27596
|
+
if (ch === "\\") {
|
|
27597
|
+
escaped = true;
|
|
27598
|
+
continue;
|
|
27599
|
+
}
|
|
27600
|
+
if (ch === '"') {
|
|
27601
|
+
quote = quote === 1 ? 0 : 1;
|
|
27602
|
+
continue;
|
|
27603
|
+
}
|
|
27604
|
+
if (quote === 1) {
|
|
27605
|
+
continue;
|
|
27606
|
+
}
|
|
27607
|
+
if (ch === "[") {
|
|
27608
|
+
bracket++;
|
|
27609
|
+
continue;
|
|
27610
|
+
}
|
|
27611
|
+
if (ch === "]" && bracket > 0) {
|
|
27612
|
+
bracket--;
|
|
27613
|
+
continue;
|
|
27614
|
+
}
|
|
27615
|
+
if (bracket > 0) {
|
|
27616
|
+
continue;
|
|
27617
|
+
}
|
|
27618
|
+
if (ch === "(") {
|
|
27619
|
+
paren++;
|
|
27620
|
+
continue;
|
|
27621
|
+
}
|
|
27622
|
+
if (ch === ")") {
|
|
27623
|
+
paren--;
|
|
27624
|
+
if (paren === 0) {
|
|
27625
|
+
if (requireEnd === true && i !== pattern.length - 1) {
|
|
27626
|
+
return;
|
|
27627
|
+
}
|
|
27628
|
+
return {
|
|
27629
|
+
type: pattern[0],
|
|
27630
|
+
body: pattern.slice(2, i),
|
|
27631
|
+
end: i
|
|
27632
|
+
};
|
|
27633
|
+
}
|
|
27634
|
+
}
|
|
27635
|
+
}
|
|
27636
|
+
};
|
|
27637
|
+
var getStarExtglobSequenceOutput = (pattern) => {
|
|
27638
|
+
let index = 0;
|
|
27639
|
+
const chars = [];
|
|
27640
|
+
while (index < pattern.length) {
|
|
27641
|
+
const match = parseRepeatedExtglob(pattern.slice(index), false);
|
|
27642
|
+
if (!match || match.type !== "*") {
|
|
27643
|
+
return;
|
|
27644
|
+
}
|
|
27645
|
+
const branches = splitTopLevel(match.body).map((branch2) => branch2.trim());
|
|
27646
|
+
if (branches.length !== 1) {
|
|
27647
|
+
return;
|
|
27648
|
+
}
|
|
27649
|
+
const branch = normalizeSimpleBranch(branches[0]);
|
|
27650
|
+
if (!branch || branch.length !== 1) {
|
|
27651
|
+
return;
|
|
27652
|
+
}
|
|
27653
|
+
chars.push(branch);
|
|
27654
|
+
index += match.end + 1;
|
|
27655
|
+
}
|
|
27656
|
+
if (chars.length < 1) {
|
|
27657
|
+
return;
|
|
27658
|
+
}
|
|
27659
|
+
const source = chars.length === 1 ? utils.escapeRegex(chars[0]) : `[${chars.map((ch) => utils.escapeRegex(ch)).join("")}]`;
|
|
27660
|
+
return `${source}*`;
|
|
27661
|
+
};
|
|
27662
|
+
var repeatedExtglobRecursion = (pattern) => {
|
|
27663
|
+
let depth = 0;
|
|
27664
|
+
let value = pattern.trim();
|
|
27665
|
+
let match = parseRepeatedExtglob(value);
|
|
27666
|
+
while (match) {
|
|
27667
|
+
depth++;
|
|
27668
|
+
value = match.body.trim();
|
|
27669
|
+
match = parseRepeatedExtglob(value);
|
|
27670
|
+
}
|
|
27671
|
+
return depth;
|
|
27672
|
+
};
|
|
27673
|
+
var analyzeRepeatedExtglob = (body, options) => {
|
|
27674
|
+
if (options.maxExtglobRecursion === false) {
|
|
27675
|
+
return { risky: false };
|
|
27676
|
+
}
|
|
27677
|
+
const max = typeof options.maxExtglobRecursion === "number" ? options.maxExtglobRecursion : constants.DEFAULT_MAX_EXTGLOB_RECURSION;
|
|
27678
|
+
const branches = splitTopLevel(body).map((branch) => branch.trim());
|
|
27679
|
+
if (branches.length > 1) {
|
|
27680
|
+
if (branches.some((branch) => branch === "") || branches.some((branch) => /^[*?]+$/.test(branch)) || hasRepeatedCharPrefixOverlap(branches)) {
|
|
27681
|
+
return { risky: true };
|
|
27682
|
+
}
|
|
27683
|
+
}
|
|
27684
|
+
for (const branch of branches) {
|
|
27685
|
+
const safeOutput = getStarExtglobSequenceOutput(branch);
|
|
27686
|
+
if (safeOutput) {
|
|
27687
|
+
return { risky: true, safeOutput };
|
|
27688
|
+
}
|
|
27689
|
+
if (repeatedExtglobRecursion(branch) > max) {
|
|
27690
|
+
return { risky: true };
|
|
27691
|
+
}
|
|
27692
|
+
}
|
|
27693
|
+
return { risky: false };
|
|
27694
|
+
};
|
|
27695
|
+
var parse3 = (input, options) => {
|
|
27696
|
+
if (typeof input !== "string") {
|
|
27697
|
+
throw new TypeError("Expected a string");
|
|
27698
|
+
}
|
|
27699
|
+
input = REPLACEMENTS[input] || input;
|
|
27700
|
+
const opts = { ...options };
|
|
27701
|
+
const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
|
27702
|
+
let len = input.length;
|
|
27703
|
+
if (len > max) {
|
|
27704
|
+
throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
|
|
27705
|
+
}
|
|
27706
|
+
const bos = { type: "bos", value: "", output: opts.prepend || "" };
|
|
27707
|
+
const tokens = [bos];
|
|
27708
|
+
const capture = opts.capture ? "" : "?:";
|
|
27709
|
+
const win32 = utils.isWindows(options);
|
|
27710
|
+
const PLATFORM_CHARS = constants.globChars(win32);
|
|
27711
|
+
const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS);
|
|
27712
|
+
const {
|
|
27713
|
+
DOT_LITERAL,
|
|
27714
|
+
PLUS_LITERAL,
|
|
27715
|
+
SLASH_LITERAL,
|
|
27716
|
+
ONE_CHAR,
|
|
27717
|
+
DOTS_SLASH,
|
|
27718
|
+
NO_DOT,
|
|
27719
|
+
NO_DOT_SLASH,
|
|
27720
|
+
NO_DOTS_SLASH,
|
|
27721
|
+
QMARK,
|
|
27722
|
+
QMARK_NO_DOT,
|
|
27723
|
+
STAR,
|
|
27724
|
+
START_ANCHOR
|
|
27725
|
+
} = PLATFORM_CHARS;
|
|
27726
|
+
const globstar = (opts2) => {
|
|
27727
|
+
return `(${capture}(?:(?!${START_ANCHOR}${opts2.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
|
|
27728
|
+
};
|
|
27729
|
+
const nodot = opts.dot ? "" : NO_DOT;
|
|
27730
|
+
const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
|
|
27731
|
+
let star = opts.bash === true ? globstar(opts) : STAR;
|
|
27732
|
+
if (opts.capture) {
|
|
27733
|
+
star = `(${star})`;
|
|
27734
|
+
}
|
|
27735
|
+
if (typeof opts.noext === "boolean") {
|
|
27736
|
+
opts.noextglob = opts.noext;
|
|
27737
|
+
}
|
|
27738
|
+
const state = {
|
|
27739
|
+
input,
|
|
27740
|
+
index: -1,
|
|
27741
|
+
start: 0,
|
|
27742
|
+
dot: opts.dot === true,
|
|
27743
|
+
consumed: "",
|
|
27744
|
+
output: "",
|
|
27745
|
+
prefix: "",
|
|
27746
|
+
backtrack: false,
|
|
27747
|
+
negated: false,
|
|
27748
|
+
brackets: 0,
|
|
27749
|
+
braces: 0,
|
|
27750
|
+
parens: 0,
|
|
27751
|
+
quotes: 0,
|
|
27752
|
+
globstar: false,
|
|
27753
|
+
tokens
|
|
27754
|
+
};
|
|
27755
|
+
input = utils.removePrefix(input, state);
|
|
27756
|
+
len = input.length;
|
|
27757
|
+
const extglobs = [];
|
|
27758
|
+
const braces = [];
|
|
27759
|
+
const stack = [];
|
|
27760
|
+
let prev = bos;
|
|
27761
|
+
let value;
|
|
27762
|
+
const eos = () => state.index === len - 1;
|
|
27763
|
+
const peek = state.peek = (n = 1) => input[state.index + n];
|
|
27764
|
+
const advance = state.advance = () => input[++state.index] || "";
|
|
27765
|
+
const remaining = () => input.slice(state.index + 1);
|
|
27766
|
+
const consume = (value2 = "", num = 0) => {
|
|
27767
|
+
state.consumed += value2;
|
|
27768
|
+
state.index += num;
|
|
27769
|
+
};
|
|
27770
|
+
const append = (token) => {
|
|
27771
|
+
state.output += token.output != null ? token.output : token.value;
|
|
27772
|
+
consume(token.value);
|
|
27773
|
+
};
|
|
27774
|
+
const negate = () => {
|
|
27775
|
+
let count = 1;
|
|
27776
|
+
while (peek() === "!" && (peek(2) !== "(" || peek(3) === "?")) {
|
|
27777
|
+
advance();
|
|
27778
|
+
state.start++;
|
|
27779
|
+
count++;
|
|
27780
|
+
}
|
|
27781
|
+
if (count % 2 === 0) {
|
|
27782
|
+
return false;
|
|
27783
|
+
}
|
|
27784
|
+
state.negated = true;
|
|
27785
|
+
state.start++;
|
|
27786
|
+
return true;
|
|
27787
|
+
};
|
|
27788
|
+
const increment = (type) => {
|
|
27789
|
+
state[type]++;
|
|
27790
|
+
stack.push(type);
|
|
27791
|
+
};
|
|
27792
|
+
const decrement = (type) => {
|
|
27793
|
+
state[type]--;
|
|
27794
|
+
stack.pop();
|
|
27795
|
+
};
|
|
27796
|
+
const push = (tok) => {
|
|
27797
|
+
if (prev.type === "globstar") {
|
|
27798
|
+
const isBrace = state.braces > 0 && (tok.type === "comma" || tok.type === "brace");
|
|
27799
|
+
const isExtglob = tok.extglob === true || extglobs.length && (tok.type === "pipe" || tok.type === "paren");
|
|
27800
|
+
if (tok.type !== "slash" && tok.type !== "paren" && !isBrace && !isExtglob) {
|
|
27801
|
+
state.output = state.output.slice(0, -prev.output.length);
|
|
27802
|
+
prev.type = "star";
|
|
27803
|
+
prev.value = "*";
|
|
27804
|
+
prev.output = star;
|
|
27805
|
+
state.output += prev.output;
|
|
27806
|
+
}
|
|
27807
|
+
}
|
|
27808
|
+
if (extglobs.length && tok.type !== "paren") {
|
|
27809
|
+
extglobs[extglobs.length - 1].inner += tok.value;
|
|
27810
|
+
}
|
|
27811
|
+
if (tok.value || tok.output)
|
|
27812
|
+
append(tok);
|
|
27813
|
+
if (prev && prev.type === "text" && tok.type === "text") {
|
|
27814
|
+
prev.value += tok.value;
|
|
27815
|
+
prev.output = (prev.output || "") + tok.value;
|
|
27816
|
+
return;
|
|
27817
|
+
}
|
|
27818
|
+
tok.prev = prev;
|
|
27819
|
+
tokens.push(tok);
|
|
27820
|
+
prev = tok;
|
|
27821
|
+
};
|
|
27822
|
+
const extglobOpen = (type, value2) => {
|
|
27823
|
+
const token = { ...EXTGLOB_CHARS[value2], conditions: 1, inner: "" };
|
|
27824
|
+
token.prev = prev;
|
|
27825
|
+
token.parens = state.parens;
|
|
27826
|
+
token.output = state.output;
|
|
27827
|
+
token.startIndex = state.index;
|
|
27828
|
+
token.tokensIndex = tokens.length;
|
|
27829
|
+
const output = (opts.capture ? "(" : "") + token.open;
|
|
27830
|
+
increment("parens");
|
|
27831
|
+
push({ type, value: value2, output: state.output ? "" : ONE_CHAR });
|
|
27832
|
+
push({ type: "paren", extglob: true, value: advance(), output });
|
|
27833
|
+
extglobs.push(token);
|
|
27834
|
+
};
|
|
27835
|
+
const extglobClose = (token) => {
|
|
27836
|
+
const literal2 = input.slice(token.startIndex, state.index + 1);
|
|
27837
|
+
const body = input.slice(token.startIndex + 2, state.index);
|
|
27838
|
+
const analysis = analyzeRepeatedExtglob(body, opts);
|
|
27839
|
+
if ((token.type === "plus" || token.type === "star") && analysis.risky) {
|
|
27840
|
+
const safeOutput = analysis.safeOutput ? (token.output ? "" : ONE_CHAR) + (opts.capture ? `(${analysis.safeOutput})` : analysis.safeOutput) : void 0;
|
|
27841
|
+
const open2 = tokens[token.tokensIndex];
|
|
27842
|
+
open2.type = "text";
|
|
27843
|
+
open2.value = literal2;
|
|
27844
|
+
open2.output = safeOutput || utils.escapeRegex(literal2);
|
|
27845
|
+
for (let i = token.tokensIndex + 1; i < tokens.length; i++) {
|
|
27846
|
+
tokens[i].value = "";
|
|
27847
|
+
tokens[i].output = "";
|
|
27848
|
+
delete tokens[i].suffix;
|
|
27849
|
+
}
|
|
27850
|
+
state.output = token.output + open2.output;
|
|
27851
|
+
state.backtrack = true;
|
|
27852
|
+
push({ type: "paren", extglob: true, value, output: "" });
|
|
27853
|
+
decrement("parens");
|
|
27854
|
+
return;
|
|
27855
|
+
}
|
|
27856
|
+
let output = token.close + (opts.capture ? ")" : "");
|
|
27857
|
+
let rest;
|
|
27858
|
+
if (token.type === "negate") {
|
|
27859
|
+
let extglobStar = star;
|
|
27860
|
+
if (token.inner && token.inner.length > 1 && token.inner.includes("/")) {
|
|
27861
|
+
extglobStar = globstar(opts);
|
|
27862
|
+
}
|
|
27863
|
+
if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) {
|
|
27864
|
+
output = token.close = `)$))${extglobStar}`;
|
|
27865
|
+
}
|
|
27866
|
+
if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
|
|
27867
|
+
const expression = parse3(rest, { ...options, fastpaths: false }).output;
|
|
27868
|
+
output = token.close = `)${expression})${extglobStar})`;
|
|
27869
|
+
}
|
|
27870
|
+
if (token.prev.type === "bos") {
|
|
27871
|
+
state.negatedExtglob = true;
|
|
27872
|
+
}
|
|
27873
|
+
}
|
|
27874
|
+
push({ type: "paren", extglob: true, value, output });
|
|
27875
|
+
decrement("parens");
|
|
27876
|
+
};
|
|
27877
|
+
if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
|
|
27878
|
+
let backslashes = false;
|
|
27879
|
+
let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc2, chars, first, rest, index) => {
|
|
27880
|
+
if (first === "\\") {
|
|
27881
|
+
backslashes = true;
|
|
27882
|
+
return m;
|
|
27883
|
+
}
|
|
27884
|
+
if (first === "?") {
|
|
27885
|
+
if (esc2) {
|
|
27886
|
+
return esc2 + first + (rest ? QMARK.repeat(rest.length) : "");
|
|
27887
|
+
}
|
|
27888
|
+
if (index === 0) {
|
|
27889
|
+
return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : "");
|
|
27890
|
+
}
|
|
27891
|
+
return QMARK.repeat(chars.length);
|
|
27892
|
+
}
|
|
27893
|
+
if (first === ".") {
|
|
27894
|
+
return DOT_LITERAL.repeat(chars.length);
|
|
27895
|
+
}
|
|
27896
|
+
if (first === "*") {
|
|
27897
|
+
if (esc2) {
|
|
27898
|
+
return esc2 + first + (rest ? star : "");
|
|
27899
|
+
}
|
|
27900
|
+
return star;
|
|
27901
|
+
}
|
|
27902
|
+
return esc2 ? m : `\\${m}`;
|
|
27903
|
+
});
|
|
27904
|
+
if (backslashes === true) {
|
|
27905
|
+
if (opts.unescape === true) {
|
|
27906
|
+
output = output.replace(/\\/g, "");
|
|
27907
|
+
} else {
|
|
27908
|
+
output = output.replace(/\\+/g, (m) => {
|
|
27909
|
+
return m.length % 2 === 0 ? "\\\\" : m ? "\\" : "";
|
|
27910
|
+
});
|
|
27911
|
+
}
|
|
27912
|
+
}
|
|
27913
|
+
if (output === input && opts.contains === true) {
|
|
27914
|
+
state.output = input;
|
|
27915
|
+
return state;
|
|
27916
|
+
}
|
|
27917
|
+
state.output = utils.wrapOutput(output, state, options);
|
|
27918
|
+
return state;
|
|
27919
|
+
}
|
|
27920
|
+
while (!eos()) {
|
|
27921
|
+
value = advance();
|
|
27922
|
+
if (value === "\0") {
|
|
27923
|
+
continue;
|
|
27924
|
+
}
|
|
27925
|
+
if (value === "\\") {
|
|
27926
|
+
const next = peek();
|
|
27927
|
+
if (next === "/" && opts.bash !== true) {
|
|
27928
|
+
continue;
|
|
27929
|
+
}
|
|
27930
|
+
if (next === "." || next === ";") {
|
|
27931
|
+
continue;
|
|
27932
|
+
}
|
|
27933
|
+
if (!next) {
|
|
27934
|
+
value += "\\";
|
|
27935
|
+
push({ type: "text", value });
|
|
27936
|
+
continue;
|
|
27937
|
+
}
|
|
27938
|
+
const match = /^\\+/.exec(remaining());
|
|
27939
|
+
let slashes = 0;
|
|
27940
|
+
if (match && match[0].length > 2) {
|
|
27941
|
+
slashes = match[0].length;
|
|
27942
|
+
state.index += slashes;
|
|
27943
|
+
if (slashes % 2 !== 0) {
|
|
27944
|
+
value += "\\";
|
|
27945
|
+
}
|
|
27946
|
+
}
|
|
27947
|
+
if (opts.unescape === true) {
|
|
27948
|
+
value = advance();
|
|
27949
|
+
} else {
|
|
27950
|
+
value += advance();
|
|
27951
|
+
}
|
|
27952
|
+
if (state.brackets === 0) {
|
|
27953
|
+
push({ type: "text", value });
|
|
27954
|
+
continue;
|
|
27955
|
+
}
|
|
27956
|
+
}
|
|
27957
|
+
if (state.brackets > 0 && (value !== "]" || prev.value === "[" || prev.value === "[^")) {
|
|
27958
|
+
if (opts.posix !== false && value === ":") {
|
|
27959
|
+
const inner = prev.value.slice(1);
|
|
27960
|
+
if (inner.includes("[")) {
|
|
27961
|
+
prev.posix = true;
|
|
27962
|
+
if (inner.includes(":")) {
|
|
27963
|
+
const idx = prev.value.lastIndexOf("[");
|
|
27964
|
+
const pre = prev.value.slice(0, idx);
|
|
27965
|
+
const rest2 = prev.value.slice(idx + 2);
|
|
27966
|
+
const posix = POSIX_REGEX_SOURCE[rest2];
|
|
27967
|
+
if (posix) {
|
|
27968
|
+
prev.value = pre + posix;
|
|
27969
|
+
state.backtrack = true;
|
|
27970
|
+
advance();
|
|
27971
|
+
if (!bos.output && tokens.indexOf(prev) === 1) {
|
|
27972
|
+
bos.output = ONE_CHAR;
|
|
27973
|
+
}
|
|
27974
|
+
continue;
|
|
27975
|
+
}
|
|
27976
|
+
}
|
|
27977
|
+
}
|
|
27978
|
+
}
|
|
27979
|
+
if (value === "[" && peek() !== ":" || value === "-" && peek() === "]") {
|
|
27980
|
+
value = `\\${value}`;
|
|
27981
|
+
}
|
|
27982
|
+
if (value === "]" && (prev.value === "[" || prev.value === "[^")) {
|
|
27983
|
+
value = `\\${value}`;
|
|
27984
|
+
}
|
|
27985
|
+
if (opts.posix === true && value === "!" && prev.value === "[") {
|
|
27986
|
+
value = "^";
|
|
27987
|
+
}
|
|
27988
|
+
prev.value += value;
|
|
27989
|
+
append({ value });
|
|
27990
|
+
continue;
|
|
27991
|
+
}
|
|
27992
|
+
if (state.quotes === 1 && value !== '"') {
|
|
27993
|
+
value = utils.escapeRegex(value);
|
|
27994
|
+
prev.value += value;
|
|
27995
|
+
append({ value });
|
|
27996
|
+
continue;
|
|
27997
|
+
}
|
|
27998
|
+
if (value === '"') {
|
|
27999
|
+
state.quotes = state.quotes === 1 ? 0 : 1;
|
|
28000
|
+
if (opts.keepQuotes === true) {
|
|
28001
|
+
push({ type: "text", value });
|
|
28002
|
+
}
|
|
28003
|
+
continue;
|
|
28004
|
+
}
|
|
28005
|
+
if (value === "(") {
|
|
28006
|
+
increment("parens");
|
|
28007
|
+
push({ type: "paren", value });
|
|
28008
|
+
continue;
|
|
28009
|
+
}
|
|
28010
|
+
if (value === ")") {
|
|
28011
|
+
if (state.parens === 0 && opts.strictBrackets === true) {
|
|
28012
|
+
throw new SyntaxError(syntaxError("opening", "("));
|
|
28013
|
+
}
|
|
28014
|
+
const extglob = extglobs[extglobs.length - 1];
|
|
28015
|
+
if (extglob && state.parens === extglob.parens + 1) {
|
|
28016
|
+
extglobClose(extglobs.pop());
|
|
28017
|
+
continue;
|
|
28018
|
+
}
|
|
28019
|
+
push({ type: "paren", value, output: state.parens ? ")" : "\\)" });
|
|
28020
|
+
decrement("parens");
|
|
28021
|
+
continue;
|
|
28022
|
+
}
|
|
28023
|
+
if (value === "[") {
|
|
28024
|
+
if (opts.nobracket === true || !remaining().includes("]")) {
|
|
28025
|
+
if (opts.nobracket !== true && opts.strictBrackets === true) {
|
|
28026
|
+
throw new SyntaxError(syntaxError("closing", "]"));
|
|
28027
|
+
}
|
|
28028
|
+
value = `\\${value}`;
|
|
28029
|
+
} else {
|
|
28030
|
+
increment("brackets");
|
|
28031
|
+
}
|
|
28032
|
+
push({ type: "bracket", value });
|
|
28033
|
+
continue;
|
|
28034
|
+
}
|
|
28035
|
+
if (value === "]") {
|
|
28036
|
+
if (opts.nobracket === true || prev && prev.type === "bracket" && prev.value.length === 1) {
|
|
28037
|
+
push({ type: "text", value, output: `\\${value}` });
|
|
28038
|
+
continue;
|
|
28039
|
+
}
|
|
28040
|
+
if (state.brackets === 0) {
|
|
28041
|
+
if (opts.strictBrackets === true) {
|
|
28042
|
+
throw new SyntaxError(syntaxError("opening", "["));
|
|
28043
|
+
}
|
|
28044
|
+
push({ type: "text", value, output: `\\${value}` });
|
|
28045
|
+
continue;
|
|
28046
|
+
}
|
|
28047
|
+
decrement("brackets");
|
|
28048
|
+
const prevValue = prev.value.slice(1);
|
|
28049
|
+
if (prev.posix !== true && prevValue[0] === "^" && !prevValue.includes("/")) {
|
|
28050
|
+
value = `/${value}`;
|
|
28051
|
+
}
|
|
28052
|
+
prev.value += value;
|
|
28053
|
+
append({ value });
|
|
28054
|
+
if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) {
|
|
28055
|
+
continue;
|
|
28056
|
+
}
|
|
28057
|
+
const escaped = utils.escapeRegex(prev.value);
|
|
28058
|
+
state.output = state.output.slice(0, -prev.value.length);
|
|
28059
|
+
if (opts.literalBrackets === true) {
|
|
28060
|
+
state.output += escaped;
|
|
28061
|
+
prev.value = escaped;
|
|
28062
|
+
continue;
|
|
28063
|
+
}
|
|
28064
|
+
prev.value = `(${capture}${escaped}|${prev.value})`;
|
|
28065
|
+
state.output += prev.value;
|
|
28066
|
+
continue;
|
|
28067
|
+
}
|
|
28068
|
+
if (value === "{" && opts.nobrace !== true) {
|
|
28069
|
+
increment("braces");
|
|
28070
|
+
const open2 = {
|
|
28071
|
+
type: "brace",
|
|
28072
|
+
value,
|
|
28073
|
+
output: "(",
|
|
28074
|
+
outputIndex: state.output.length,
|
|
28075
|
+
tokensIndex: state.tokens.length
|
|
28076
|
+
};
|
|
28077
|
+
braces.push(open2);
|
|
28078
|
+
push(open2);
|
|
28079
|
+
continue;
|
|
28080
|
+
}
|
|
28081
|
+
if (value === "}") {
|
|
28082
|
+
const brace = braces[braces.length - 1];
|
|
28083
|
+
if (opts.nobrace === true || !brace) {
|
|
28084
|
+
push({ type: "text", value, output: value });
|
|
28085
|
+
continue;
|
|
28086
|
+
}
|
|
28087
|
+
let output = ")";
|
|
28088
|
+
if (brace.dots === true) {
|
|
28089
|
+
const arr = tokens.slice();
|
|
28090
|
+
const range = [];
|
|
28091
|
+
for (let i = arr.length - 1; i >= 0; i--) {
|
|
28092
|
+
tokens.pop();
|
|
28093
|
+
if (arr[i].type === "brace") {
|
|
28094
|
+
break;
|
|
28095
|
+
}
|
|
28096
|
+
if (arr[i].type !== "dots") {
|
|
28097
|
+
range.unshift(arr[i].value);
|
|
28098
|
+
}
|
|
28099
|
+
}
|
|
28100
|
+
output = expandRange(range, opts);
|
|
28101
|
+
state.backtrack = true;
|
|
28102
|
+
}
|
|
28103
|
+
if (brace.comma !== true && brace.dots !== true) {
|
|
28104
|
+
const out = state.output.slice(0, brace.outputIndex);
|
|
28105
|
+
const toks = state.tokens.slice(brace.tokensIndex);
|
|
28106
|
+
brace.value = brace.output = "\\{";
|
|
28107
|
+
value = output = "\\}";
|
|
28108
|
+
state.output = out;
|
|
28109
|
+
for (const t of toks) {
|
|
28110
|
+
state.output += t.output || t.value;
|
|
28111
|
+
}
|
|
28112
|
+
}
|
|
28113
|
+
push({ type: "brace", value, output });
|
|
28114
|
+
decrement("braces");
|
|
28115
|
+
braces.pop();
|
|
28116
|
+
continue;
|
|
28117
|
+
}
|
|
28118
|
+
if (value === "|") {
|
|
28119
|
+
if (extglobs.length > 0) {
|
|
28120
|
+
extglobs[extglobs.length - 1].conditions++;
|
|
28121
|
+
}
|
|
28122
|
+
push({ type: "text", value });
|
|
28123
|
+
continue;
|
|
28124
|
+
}
|
|
28125
|
+
if (value === ",") {
|
|
28126
|
+
let output = value;
|
|
28127
|
+
const brace = braces[braces.length - 1];
|
|
28128
|
+
if (brace && stack[stack.length - 1] === "braces") {
|
|
28129
|
+
brace.comma = true;
|
|
28130
|
+
output = "|";
|
|
28131
|
+
}
|
|
28132
|
+
push({ type: "comma", value, output });
|
|
28133
|
+
continue;
|
|
28134
|
+
}
|
|
28135
|
+
if (value === "/") {
|
|
28136
|
+
if (prev.type === "dot" && state.index === state.start + 1) {
|
|
28137
|
+
state.start = state.index + 1;
|
|
28138
|
+
state.consumed = "";
|
|
28139
|
+
state.output = "";
|
|
28140
|
+
tokens.pop();
|
|
28141
|
+
prev = bos;
|
|
28142
|
+
continue;
|
|
28143
|
+
}
|
|
28144
|
+
push({ type: "slash", value, output: SLASH_LITERAL });
|
|
28145
|
+
continue;
|
|
28146
|
+
}
|
|
28147
|
+
if (value === ".") {
|
|
28148
|
+
if (state.braces > 0 && prev.type === "dot") {
|
|
28149
|
+
if (prev.value === ".")
|
|
28150
|
+
prev.output = DOT_LITERAL;
|
|
28151
|
+
const brace = braces[braces.length - 1];
|
|
28152
|
+
prev.type = "dots";
|
|
28153
|
+
prev.output += value;
|
|
28154
|
+
prev.value += value;
|
|
28155
|
+
brace.dots = true;
|
|
28156
|
+
continue;
|
|
28157
|
+
}
|
|
28158
|
+
if (state.braces + state.parens === 0 && prev.type !== "bos" && prev.type !== "slash") {
|
|
28159
|
+
push({ type: "text", value, output: DOT_LITERAL });
|
|
28160
|
+
continue;
|
|
28161
|
+
}
|
|
28162
|
+
push({ type: "dot", value, output: DOT_LITERAL });
|
|
28163
|
+
continue;
|
|
28164
|
+
}
|
|
28165
|
+
if (value === "?") {
|
|
28166
|
+
const isGroup = prev && prev.value === "(";
|
|
28167
|
+
if (!isGroup && opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
|
|
28168
|
+
extglobOpen("qmark", value);
|
|
28169
|
+
continue;
|
|
28170
|
+
}
|
|
28171
|
+
if (prev && prev.type === "paren") {
|
|
28172
|
+
const next = peek();
|
|
28173
|
+
let output = value;
|
|
28174
|
+
if (next === "<" && !utils.supportsLookbehinds()) {
|
|
28175
|
+
throw new Error("Node.js v10 or higher is required for regex lookbehinds");
|
|
28176
|
+
}
|
|
28177
|
+
if (prev.value === "(" && !/[!=<:]/.test(next) || next === "<" && !/<([!=]|\w+>)/.test(remaining())) {
|
|
28178
|
+
output = `\\${value}`;
|
|
28179
|
+
}
|
|
28180
|
+
push({ type: "text", value, output });
|
|
28181
|
+
continue;
|
|
28182
|
+
}
|
|
28183
|
+
if (opts.dot !== true && (prev.type === "slash" || prev.type === "bos")) {
|
|
28184
|
+
push({ type: "qmark", value, output: QMARK_NO_DOT });
|
|
28185
|
+
continue;
|
|
28186
|
+
}
|
|
28187
|
+
push({ type: "qmark", value, output: QMARK });
|
|
28188
|
+
continue;
|
|
28189
|
+
}
|
|
28190
|
+
if (value === "!") {
|
|
28191
|
+
if (opts.noextglob !== true && peek() === "(") {
|
|
28192
|
+
if (peek(2) !== "?" || !/[!=<:]/.test(peek(3))) {
|
|
28193
|
+
extglobOpen("negate", value);
|
|
28194
|
+
continue;
|
|
28195
|
+
}
|
|
28196
|
+
}
|
|
28197
|
+
if (opts.nonegate !== true && state.index === 0) {
|
|
28198
|
+
negate();
|
|
28199
|
+
continue;
|
|
28200
|
+
}
|
|
28201
|
+
}
|
|
28202
|
+
if (value === "+") {
|
|
28203
|
+
if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
|
|
28204
|
+
extglobOpen("plus", value);
|
|
28205
|
+
continue;
|
|
28206
|
+
}
|
|
28207
|
+
if (prev && prev.value === "(" || opts.regex === false) {
|
|
28208
|
+
push({ type: "plus", value, output: PLUS_LITERAL });
|
|
28209
|
+
continue;
|
|
28210
|
+
}
|
|
28211
|
+
if (prev && (prev.type === "bracket" || prev.type === "paren" || prev.type === "brace") || state.parens > 0) {
|
|
28212
|
+
push({ type: "plus", value });
|
|
28213
|
+
continue;
|
|
28214
|
+
}
|
|
28215
|
+
push({ type: "plus", value: PLUS_LITERAL });
|
|
28216
|
+
continue;
|
|
28217
|
+
}
|
|
28218
|
+
if (value === "@") {
|
|
28219
|
+
if (opts.noextglob !== true && peek() === "(" && peek(2) !== "?") {
|
|
28220
|
+
push({ type: "at", extglob: true, value, output: "" });
|
|
28221
|
+
continue;
|
|
28222
|
+
}
|
|
28223
|
+
push({ type: "text", value });
|
|
28224
|
+
continue;
|
|
28225
|
+
}
|
|
28226
|
+
if (value !== "*") {
|
|
28227
|
+
if (value === "$" || value === "^") {
|
|
28228
|
+
value = `\\${value}`;
|
|
28229
|
+
}
|
|
28230
|
+
const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
|
|
28231
|
+
if (match) {
|
|
28232
|
+
value += match[0];
|
|
28233
|
+
state.index += match[0].length;
|
|
28234
|
+
}
|
|
28235
|
+
push({ type: "text", value });
|
|
28236
|
+
continue;
|
|
28237
|
+
}
|
|
28238
|
+
if (prev && (prev.type === "globstar" || prev.star === true)) {
|
|
28239
|
+
prev.type = "star";
|
|
28240
|
+
prev.star = true;
|
|
28241
|
+
prev.value += value;
|
|
28242
|
+
prev.output = star;
|
|
28243
|
+
state.backtrack = true;
|
|
28244
|
+
state.globstar = true;
|
|
28245
|
+
consume(value);
|
|
28246
|
+
continue;
|
|
28247
|
+
}
|
|
28248
|
+
let rest = remaining();
|
|
28249
|
+
if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
|
|
28250
|
+
extglobOpen("star", value);
|
|
28251
|
+
continue;
|
|
28252
|
+
}
|
|
28253
|
+
if (prev.type === "star") {
|
|
28254
|
+
if (opts.noglobstar === true) {
|
|
28255
|
+
consume(value);
|
|
28256
|
+
continue;
|
|
28257
|
+
}
|
|
28258
|
+
const prior = prev.prev;
|
|
28259
|
+
const before = prior.prev;
|
|
28260
|
+
const isStart = prior.type === "slash" || prior.type === "bos";
|
|
28261
|
+
const afterStar = before && (before.type === "star" || before.type === "globstar");
|
|
28262
|
+
if (opts.bash === true && (!isStart || rest[0] && rest[0] !== "/")) {
|
|
28263
|
+
push({ type: "star", value, output: "" });
|
|
28264
|
+
continue;
|
|
28265
|
+
}
|
|
28266
|
+
const isBrace = state.braces > 0 && (prior.type === "comma" || prior.type === "brace");
|
|
28267
|
+
const isExtglob = extglobs.length && (prior.type === "pipe" || prior.type === "paren");
|
|
28268
|
+
if (!isStart && prior.type !== "paren" && !isBrace && !isExtglob) {
|
|
28269
|
+
push({ type: "star", value, output: "" });
|
|
28270
|
+
continue;
|
|
28271
|
+
}
|
|
28272
|
+
while (rest.slice(0, 3) === "/**") {
|
|
28273
|
+
const after = input[state.index + 4];
|
|
28274
|
+
if (after && after !== "/") {
|
|
28275
|
+
break;
|
|
28276
|
+
}
|
|
28277
|
+
rest = rest.slice(3);
|
|
28278
|
+
consume("/**", 3);
|
|
28279
|
+
}
|
|
28280
|
+
if (prior.type === "bos" && eos()) {
|
|
28281
|
+
prev.type = "globstar";
|
|
28282
|
+
prev.value += value;
|
|
28283
|
+
prev.output = globstar(opts);
|
|
28284
|
+
state.output = prev.output;
|
|
28285
|
+
state.globstar = true;
|
|
28286
|
+
consume(value);
|
|
28287
|
+
continue;
|
|
28288
|
+
}
|
|
28289
|
+
if (prior.type === "slash" && prior.prev.type !== "bos" && !afterStar && eos()) {
|
|
28290
|
+
state.output = state.output.slice(0, -(prior.output + prev.output).length);
|
|
28291
|
+
prior.output = `(?:${prior.output}`;
|
|
28292
|
+
prev.type = "globstar";
|
|
28293
|
+
prev.output = globstar(opts) + (opts.strictSlashes ? ")" : "|$)");
|
|
28294
|
+
prev.value += value;
|
|
28295
|
+
state.globstar = true;
|
|
28296
|
+
state.output += prior.output + prev.output;
|
|
28297
|
+
consume(value);
|
|
28298
|
+
continue;
|
|
28299
|
+
}
|
|
28300
|
+
if (prior.type === "slash" && prior.prev.type !== "bos" && rest[0] === "/") {
|
|
28301
|
+
const end = rest[1] !== void 0 ? "|$" : "";
|
|
28302
|
+
state.output = state.output.slice(0, -(prior.output + prev.output).length);
|
|
28303
|
+
prior.output = `(?:${prior.output}`;
|
|
28304
|
+
prev.type = "globstar";
|
|
28305
|
+
prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
|
|
28306
|
+
prev.value += value;
|
|
28307
|
+
state.output += prior.output + prev.output;
|
|
28308
|
+
state.globstar = true;
|
|
28309
|
+
consume(value + advance());
|
|
28310
|
+
push({ type: "slash", value: "/", output: "" });
|
|
28311
|
+
continue;
|
|
28312
|
+
}
|
|
28313
|
+
if (prior.type === "bos" && rest[0] === "/") {
|
|
28314
|
+
prev.type = "globstar";
|
|
28315
|
+
prev.value += value;
|
|
28316
|
+
prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
|
|
28317
|
+
state.output = prev.output;
|
|
28318
|
+
state.globstar = true;
|
|
28319
|
+
consume(value + advance());
|
|
28320
|
+
push({ type: "slash", value: "/", output: "" });
|
|
28321
|
+
continue;
|
|
28322
|
+
}
|
|
28323
|
+
state.output = state.output.slice(0, -prev.output.length);
|
|
28324
|
+
prev.type = "globstar";
|
|
28325
|
+
prev.output = globstar(opts);
|
|
28326
|
+
prev.value += value;
|
|
28327
|
+
state.output += prev.output;
|
|
28328
|
+
state.globstar = true;
|
|
28329
|
+
consume(value);
|
|
28330
|
+
continue;
|
|
28331
|
+
}
|
|
28332
|
+
const token = { type: "star", value, output: star };
|
|
28333
|
+
if (opts.bash === true) {
|
|
28334
|
+
token.output = ".*?";
|
|
28335
|
+
if (prev.type === "bos" || prev.type === "slash") {
|
|
28336
|
+
token.output = nodot + token.output;
|
|
28337
|
+
}
|
|
28338
|
+
push(token);
|
|
28339
|
+
continue;
|
|
28340
|
+
}
|
|
28341
|
+
if (prev && (prev.type === "bracket" || prev.type === "paren") && opts.regex === true) {
|
|
28342
|
+
token.output = value;
|
|
28343
|
+
push(token);
|
|
28344
|
+
continue;
|
|
28345
|
+
}
|
|
28346
|
+
if (state.index === state.start || prev.type === "slash" || prev.type === "dot") {
|
|
28347
|
+
if (prev.type === "dot") {
|
|
28348
|
+
state.output += NO_DOT_SLASH;
|
|
28349
|
+
prev.output += NO_DOT_SLASH;
|
|
28350
|
+
} else if (opts.dot === true) {
|
|
28351
|
+
state.output += NO_DOTS_SLASH;
|
|
28352
|
+
prev.output += NO_DOTS_SLASH;
|
|
28353
|
+
} else {
|
|
28354
|
+
state.output += nodot;
|
|
28355
|
+
prev.output += nodot;
|
|
28356
|
+
}
|
|
28357
|
+
if (peek() !== "*") {
|
|
28358
|
+
state.output += ONE_CHAR;
|
|
28359
|
+
prev.output += ONE_CHAR;
|
|
28360
|
+
}
|
|
28361
|
+
}
|
|
28362
|
+
push(token);
|
|
28363
|
+
}
|
|
28364
|
+
while (state.brackets > 0) {
|
|
28365
|
+
if (opts.strictBrackets === true)
|
|
28366
|
+
throw new SyntaxError(syntaxError("closing", "]"));
|
|
28367
|
+
state.output = utils.escapeLast(state.output, "[");
|
|
28368
|
+
decrement("brackets");
|
|
28369
|
+
}
|
|
28370
|
+
while (state.parens > 0) {
|
|
28371
|
+
if (opts.strictBrackets === true)
|
|
28372
|
+
throw new SyntaxError(syntaxError("closing", ")"));
|
|
28373
|
+
state.output = utils.escapeLast(state.output, "(");
|
|
28374
|
+
decrement("parens");
|
|
28375
|
+
}
|
|
28376
|
+
while (state.braces > 0) {
|
|
28377
|
+
if (opts.strictBrackets === true)
|
|
28378
|
+
throw new SyntaxError(syntaxError("closing", "}"));
|
|
28379
|
+
state.output = utils.escapeLast(state.output, "{");
|
|
28380
|
+
decrement("braces");
|
|
28381
|
+
}
|
|
28382
|
+
if (opts.strictSlashes !== true && (prev.type === "star" || prev.type === "bracket")) {
|
|
28383
|
+
push({ type: "maybe_slash", value: "", output: `${SLASH_LITERAL}?` });
|
|
28384
|
+
}
|
|
28385
|
+
if (state.backtrack === true) {
|
|
28386
|
+
state.output = "";
|
|
28387
|
+
for (const token of state.tokens) {
|
|
28388
|
+
state.output += token.output != null ? token.output : token.value;
|
|
28389
|
+
if (token.suffix) {
|
|
28390
|
+
state.output += token.suffix;
|
|
28391
|
+
}
|
|
28392
|
+
}
|
|
28393
|
+
}
|
|
28394
|
+
return state;
|
|
28395
|
+
};
|
|
28396
|
+
parse3.fastpaths = (input, options) => {
|
|
28397
|
+
const opts = { ...options };
|
|
28398
|
+
const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
|
28399
|
+
const len = input.length;
|
|
28400
|
+
if (len > max) {
|
|
28401
|
+
throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
|
|
28402
|
+
}
|
|
28403
|
+
input = REPLACEMENTS[input] || input;
|
|
28404
|
+
const win32 = utils.isWindows(options);
|
|
28405
|
+
const {
|
|
28406
|
+
DOT_LITERAL,
|
|
28407
|
+
SLASH_LITERAL,
|
|
28408
|
+
ONE_CHAR,
|
|
28409
|
+
DOTS_SLASH,
|
|
28410
|
+
NO_DOT,
|
|
28411
|
+
NO_DOTS,
|
|
28412
|
+
NO_DOTS_SLASH,
|
|
28413
|
+
STAR,
|
|
28414
|
+
START_ANCHOR
|
|
28415
|
+
} = constants.globChars(win32);
|
|
28416
|
+
const nodot = opts.dot ? NO_DOTS : NO_DOT;
|
|
28417
|
+
const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
|
|
28418
|
+
const capture = opts.capture ? "" : "?:";
|
|
28419
|
+
const state = { negated: false, prefix: "" };
|
|
28420
|
+
let star = opts.bash === true ? ".*?" : STAR;
|
|
28421
|
+
if (opts.capture) {
|
|
28422
|
+
star = `(${star})`;
|
|
28423
|
+
}
|
|
28424
|
+
const globstar = (opts2) => {
|
|
28425
|
+
if (opts2.noglobstar === true)
|
|
28426
|
+
return star;
|
|
28427
|
+
return `(${capture}(?:(?!${START_ANCHOR}${opts2.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
|
|
28428
|
+
};
|
|
28429
|
+
const create = (str) => {
|
|
28430
|
+
switch (str) {
|
|
28431
|
+
case "*":
|
|
28432
|
+
return `${nodot}${ONE_CHAR}${star}`;
|
|
28433
|
+
case ".*":
|
|
28434
|
+
return `${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
28435
|
+
case "*.*":
|
|
28436
|
+
return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
28437
|
+
case "*/*":
|
|
28438
|
+
return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
|
|
28439
|
+
case "**":
|
|
28440
|
+
return nodot + globstar(opts);
|
|
28441
|
+
case "**/*":
|
|
28442
|
+
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
|
|
28443
|
+
case "**/*.*":
|
|
28444
|
+
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
28445
|
+
case "**/.*":
|
|
28446
|
+
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
28447
|
+
default: {
|
|
28448
|
+
const match = /^(.*?)\.(\w+)$/.exec(str);
|
|
28449
|
+
if (!match)
|
|
28450
|
+
return;
|
|
28451
|
+
const source2 = create(match[1]);
|
|
28452
|
+
if (!source2)
|
|
28453
|
+
return;
|
|
28454
|
+
return source2 + DOT_LITERAL + match[2];
|
|
28455
|
+
}
|
|
28456
|
+
}
|
|
28457
|
+
};
|
|
28458
|
+
const output = utils.removePrefix(input, state);
|
|
28459
|
+
let source = create(output);
|
|
28460
|
+
if (source && opts.strictSlashes !== true) {
|
|
28461
|
+
source += `${SLASH_LITERAL}?`;
|
|
28462
|
+
}
|
|
28463
|
+
return source;
|
|
28464
|
+
};
|
|
28465
|
+
module2.exports = parse3;
|
|
28466
|
+
}
|
|
28467
|
+
});
|
|
28468
|
+
|
|
28469
|
+
// node_modules/micromatch/node_modules/picomatch/lib/picomatch.js
|
|
28470
|
+
var require_picomatch = __commonJS({
|
|
28471
|
+
"node_modules/micromatch/node_modules/picomatch/lib/picomatch.js"(exports2, module2) {
|
|
28472
|
+
"use strict";
|
|
28473
|
+
var path7 = require("path");
|
|
28474
|
+
var scan = require_scan();
|
|
28475
|
+
var parse3 = require_parse2();
|
|
28476
|
+
var utils = require_utils3();
|
|
28477
|
+
var constants = require_constants2();
|
|
28478
|
+
var isObject2 = (val) => val && typeof val === "object" && !Array.isArray(val);
|
|
28479
|
+
var picomatch = (glob, options, returnState = false) => {
|
|
28480
|
+
if (Array.isArray(glob)) {
|
|
28481
|
+
const fns = glob.map((input) => picomatch(input, options, returnState));
|
|
28482
|
+
const arrayMatcher = (str) => {
|
|
28483
|
+
for (const isMatch of fns) {
|
|
28484
|
+
const state2 = isMatch(str);
|
|
28485
|
+
if (state2)
|
|
28486
|
+
return state2;
|
|
28487
|
+
}
|
|
28488
|
+
return false;
|
|
28489
|
+
};
|
|
28490
|
+
return arrayMatcher;
|
|
28491
|
+
}
|
|
28492
|
+
const isState = isObject2(glob) && glob.tokens && glob.input;
|
|
28493
|
+
if (glob === "" || typeof glob !== "string" && !isState) {
|
|
28494
|
+
throw new TypeError("Expected pattern to be a non-empty string");
|
|
28495
|
+
}
|
|
28496
|
+
const opts = options || {};
|
|
28497
|
+
const posix = utils.isWindows(options);
|
|
28498
|
+
const regex = isState ? picomatch.compileRe(glob, options) : picomatch.makeRe(glob, options, false, true);
|
|
28499
|
+
const state = regex.state;
|
|
28500
|
+
delete regex.state;
|
|
28501
|
+
let isIgnored = () => false;
|
|
28502
|
+
if (opts.ignore) {
|
|
28503
|
+
const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null };
|
|
28504
|
+
isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
|
|
28505
|
+
}
|
|
28506
|
+
const matcher = (input, returnObject = false) => {
|
|
28507
|
+
const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix });
|
|
28508
|
+
const result = { glob, state, regex, posix, input, output, match, isMatch };
|
|
28509
|
+
if (typeof opts.onResult === "function") {
|
|
28510
|
+
opts.onResult(result);
|
|
28511
|
+
}
|
|
28512
|
+
if (isMatch === false) {
|
|
28513
|
+
result.isMatch = false;
|
|
28514
|
+
return returnObject ? result : false;
|
|
28515
|
+
}
|
|
28516
|
+
if (isIgnored(input)) {
|
|
28517
|
+
if (typeof opts.onIgnore === "function") {
|
|
28518
|
+
opts.onIgnore(result);
|
|
28519
|
+
}
|
|
28520
|
+
result.isMatch = false;
|
|
28521
|
+
return returnObject ? result : false;
|
|
28522
|
+
}
|
|
28523
|
+
if (typeof opts.onMatch === "function") {
|
|
28524
|
+
opts.onMatch(result);
|
|
28525
|
+
}
|
|
28526
|
+
return returnObject ? result : true;
|
|
28527
|
+
};
|
|
28528
|
+
if (returnState) {
|
|
28529
|
+
matcher.state = state;
|
|
28530
|
+
}
|
|
28531
|
+
return matcher;
|
|
28532
|
+
};
|
|
28533
|
+
picomatch.test = (input, regex, options, { glob, posix } = {}) => {
|
|
28534
|
+
if (typeof input !== "string") {
|
|
28535
|
+
throw new TypeError("Expected input to be a string");
|
|
28536
|
+
}
|
|
28537
|
+
if (input === "") {
|
|
28538
|
+
return { isMatch: false, output: "" };
|
|
28539
|
+
}
|
|
28540
|
+
const opts = options || {};
|
|
28541
|
+
const format = opts.format || (posix ? utils.toPosixSlashes : null);
|
|
28542
|
+
let match = input === glob;
|
|
28543
|
+
let output = match && format ? format(input) : input;
|
|
28544
|
+
if (match === false) {
|
|
28545
|
+
output = format ? format(input) : input;
|
|
28546
|
+
match = output === glob;
|
|
28547
|
+
}
|
|
28548
|
+
if (match === false || opts.capture === true) {
|
|
28549
|
+
if (opts.matchBase === true || opts.basename === true) {
|
|
28550
|
+
match = picomatch.matchBase(input, regex, options, posix);
|
|
28551
|
+
} else {
|
|
28552
|
+
match = regex.exec(output);
|
|
28553
|
+
}
|
|
28554
|
+
}
|
|
28555
|
+
return { isMatch: Boolean(match), match, output };
|
|
28556
|
+
};
|
|
28557
|
+
picomatch.matchBase = (input, glob, options, posix = utils.isWindows(options)) => {
|
|
28558
|
+
const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
|
|
28559
|
+
return regex.test(path7.basename(input));
|
|
28560
|
+
};
|
|
28561
|
+
picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
|
|
28562
|
+
picomatch.parse = (pattern, options) => {
|
|
28563
|
+
if (Array.isArray(pattern))
|
|
28564
|
+
return pattern.map((p) => picomatch.parse(p, options));
|
|
28565
|
+
return parse3(pattern, { ...options, fastpaths: false });
|
|
28566
|
+
};
|
|
28567
|
+
picomatch.scan = (input, options) => scan(input, options);
|
|
28568
|
+
picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => {
|
|
28569
|
+
if (returnOutput === true) {
|
|
28570
|
+
return state.output;
|
|
28571
|
+
}
|
|
28572
|
+
const opts = options || {};
|
|
28573
|
+
const prepend = opts.contains ? "" : "^";
|
|
28574
|
+
const append = opts.contains ? "" : "$";
|
|
28575
|
+
let source = `${prepend}(?:${state.output})${append}`;
|
|
28576
|
+
if (state && state.negated === true) {
|
|
28577
|
+
source = `^(?!${source}).*$`;
|
|
28578
|
+
}
|
|
28579
|
+
const regex = picomatch.toRegex(source, options);
|
|
28580
|
+
if (returnState === true) {
|
|
28581
|
+
regex.state = state;
|
|
28582
|
+
}
|
|
28583
|
+
return regex;
|
|
28584
|
+
};
|
|
28585
|
+
picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
|
|
28586
|
+
if (!input || typeof input !== "string") {
|
|
28587
|
+
throw new TypeError("Expected a non-empty string");
|
|
28588
|
+
}
|
|
28589
|
+
let parsed = { negated: false, fastpaths: true };
|
|
28590
|
+
if (options.fastpaths !== false && (input[0] === "." || input[0] === "*")) {
|
|
28591
|
+
parsed.output = parse3.fastpaths(input, options);
|
|
28592
|
+
}
|
|
28593
|
+
if (!parsed.output) {
|
|
28594
|
+
parsed = parse3(input, options);
|
|
28595
|
+
}
|
|
28596
|
+
return picomatch.compileRe(parsed, options, returnOutput, returnState);
|
|
28597
|
+
};
|
|
28598
|
+
picomatch.toRegex = (source, options) => {
|
|
28599
|
+
try {
|
|
28600
|
+
const opts = options || {};
|
|
28601
|
+
return new RegExp(source, opts.flags || (opts.nocase ? "i" : ""));
|
|
28602
|
+
} catch (err) {
|
|
28603
|
+
if (options && options.debug === true)
|
|
28604
|
+
throw err;
|
|
28605
|
+
return /$^/;
|
|
28606
|
+
}
|
|
28607
|
+
};
|
|
28608
|
+
picomatch.constants = constants;
|
|
28609
|
+
module2.exports = picomatch;
|
|
28610
|
+
}
|
|
28611
|
+
});
|
|
28612
|
+
|
|
28613
|
+
// node_modules/micromatch/node_modules/picomatch/index.js
|
|
28614
|
+
var require_picomatch2 = __commonJS({
|
|
28615
|
+
"node_modules/micromatch/node_modules/picomatch/index.js"(exports2, module2) {
|
|
28616
|
+
"use strict";
|
|
28617
|
+
module2.exports = require_picomatch();
|
|
28618
|
+
}
|
|
28619
|
+
});
|
|
28620
|
+
|
|
28621
|
+
// node_modules/micromatch/index.js
|
|
28622
|
+
var require_micromatch = __commonJS({
|
|
28623
|
+
"node_modules/micromatch/index.js"(exports2, module2) {
|
|
28624
|
+
"use strict";
|
|
28625
|
+
var util2 = require("util");
|
|
28626
|
+
var braces = require_braces();
|
|
28627
|
+
var picomatch = require_picomatch2();
|
|
28628
|
+
var utils = require_utils3();
|
|
28629
|
+
var isEmptyString = (v) => v === "" || v === "./";
|
|
28630
|
+
var hasBraces = (v) => {
|
|
28631
|
+
const index = v.indexOf("{");
|
|
28632
|
+
return index > -1 && v.indexOf("}", index) > -1;
|
|
28633
|
+
};
|
|
28634
|
+
var micromatch2 = (list, patterns, options) => {
|
|
28635
|
+
patterns = [].concat(patterns);
|
|
28636
|
+
list = [].concat(list);
|
|
28637
|
+
let omit2 = /* @__PURE__ */ new Set();
|
|
28638
|
+
let keep = /* @__PURE__ */ new Set();
|
|
28639
|
+
let items = /* @__PURE__ */ new Set();
|
|
28640
|
+
let negatives = 0;
|
|
28641
|
+
let onResult = (state) => {
|
|
28642
|
+
items.add(state.output);
|
|
28643
|
+
if (options && options.onResult) {
|
|
28644
|
+
options.onResult(state);
|
|
28645
|
+
}
|
|
28646
|
+
};
|
|
28647
|
+
for (let i = 0; i < patterns.length; i++) {
|
|
28648
|
+
let isMatch = picomatch(String(patterns[i]), { ...options, onResult }, true);
|
|
28649
|
+
let negated = isMatch.state.negated || isMatch.state.negatedExtglob;
|
|
28650
|
+
if (negated)
|
|
28651
|
+
negatives++;
|
|
28652
|
+
for (let item of list) {
|
|
28653
|
+
let matched = isMatch(item, true);
|
|
28654
|
+
let match = negated ? !matched.isMatch : matched.isMatch;
|
|
28655
|
+
if (!match)
|
|
28656
|
+
continue;
|
|
28657
|
+
if (negated) {
|
|
28658
|
+
omit2.add(matched.output);
|
|
28659
|
+
} else {
|
|
28660
|
+
omit2.delete(matched.output);
|
|
28661
|
+
keep.add(matched.output);
|
|
28662
|
+
}
|
|
28663
|
+
}
|
|
28664
|
+
}
|
|
28665
|
+
let result = negatives === patterns.length ? [...items] : [...keep];
|
|
28666
|
+
let matches = result.filter((item) => !omit2.has(item));
|
|
28667
|
+
if (options && matches.length === 0) {
|
|
28668
|
+
if (options.failglob === true) {
|
|
28669
|
+
throw new Error(`No matches found for "${patterns.join(", ")}"`);
|
|
28670
|
+
}
|
|
28671
|
+
if (options.nonull === true || options.nullglob === true) {
|
|
28672
|
+
return options.unescape ? patterns.map((p) => p.replace(/\\/g, "")) : patterns;
|
|
28673
|
+
}
|
|
28674
|
+
}
|
|
28675
|
+
return matches;
|
|
28676
|
+
};
|
|
28677
|
+
micromatch2.match = micromatch2;
|
|
28678
|
+
micromatch2.matcher = (pattern, options) => picomatch(pattern, options);
|
|
28679
|
+
micromatch2.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
|
|
28680
|
+
micromatch2.any = micromatch2.isMatch;
|
|
28681
|
+
micromatch2.not = (list, patterns, options = {}) => {
|
|
28682
|
+
patterns = [].concat(patterns).map(String);
|
|
28683
|
+
let result = /* @__PURE__ */ new Set();
|
|
28684
|
+
let items = [];
|
|
28685
|
+
let onResult = (state) => {
|
|
28686
|
+
if (options.onResult)
|
|
28687
|
+
options.onResult(state);
|
|
28688
|
+
items.push(state.output);
|
|
28689
|
+
};
|
|
28690
|
+
let matches = new Set(micromatch2(list, patterns, { ...options, onResult }));
|
|
28691
|
+
for (let item of items) {
|
|
28692
|
+
if (!matches.has(item)) {
|
|
28693
|
+
result.add(item);
|
|
28694
|
+
}
|
|
28695
|
+
}
|
|
28696
|
+
return [...result];
|
|
28697
|
+
};
|
|
28698
|
+
micromatch2.contains = (str, pattern, options) => {
|
|
28699
|
+
if (typeof str !== "string") {
|
|
28700
|
+
throw new TypeError(`Expected a string: "${util2.inspect(str)}"`);
|
|
28701
|
+
}
|
|
28702
|
+
if (Array.isArray(pattern)) {
|
|
28703
|
+
return pattern.some((p) => micromatch2.contains(str, p, options));
|
|
28704
|
+
}
|
|
28705
|
+
if (typeof pattern === "string") {
|
|
28706
|
+
if (isEmptyString(str) || isEmptyString(pattern)) {
|
|
28707
|
+
return false;
|
|
28708
|
+
}
|
|
28709
|
+
if (str.includes(pattern) || str.startsWith("./") && str.slice(2).includes(pattern)) {
|
|
28710
|
+
return true;
|
|
28711
|
+
}
|
|
28712
|
+
}
|
|
28713
|
+
return micromatch2.isMatch(str, pattern, { ...options, contains: true });
|
|
28714
|
+
};
|
|
28715
|
+
micromatch2.matchKeys = (obj, patterns, options) => {
|
|
28716
|
+
if (!utils.isObject(obj)) {
|
|
28717
|
+
throw new TypeError("Expected the first argument to be an object");
|
|
28718
|
+
}
|
|
28719
|
+
let keys = micromatch2(Object.keys(obj), patterns, options);
|
|
28720
|
+
let res = {};
|
|
28721
|
+
for (let key of keys)
|
|
28722
|
+
res[key] = obj[key];
|
|
28723
|
+
return res;
|
|
28724
|
+
};
|
|
28725
|
+
micromatch2.some = (list, patterns, options) => {
|
|
28726
|
+
let items = [].concat(list);
|
|
28727
|
+
for (let pattern of [].concat(patterns)) {
|
|
28728
|
+
let isMatch = picomatch(String(pattern), options);
|
|
28729
|
+
if (items.some((item) => isMatch(item))) {
|
|
28730
|
+
return true;
|
|
28731
|
+
}
|
|
28732
|
+
}
|
|
28733
|
+
return false;
|
|
28734
|
+
};
|
|
28735
|
+
micromatch2.every = (list, patterns, options) => {
|
|
28736
|
+
let items = [].concat(list);
|
|
28737
|
+
for (let pattern of [].concat(patterns)) {
|
|
28738
|
+
let isMatch = picomatch(String(pattern), options);
|
|
28739
|
+
if (!items.every((item) => isMatch(item))) {
|
|
28740
|
+
return false;
|
|
28741
|
+
}
|
|
28742
|
+
}
|
|
28743
|
+
return true;
|
|
28744
|
+
};
|
|
28745
|
+
micromatch2.all = (str, patterns, options) => {
|
|
28746
|
+
if (typeof str !== "string") {
|
|
28747
|
+
throw new TypeError(`Expected a string: "${util2.inspect(str)}"`);
|
|
28748
|
+
}
|
|
28749
|
+
return [].concat(patterns).every((p) => picomatch(p, options)(str));
|
|
28750
|
+
};
|
|
28751
|
+
micromatch2.capture = (glob, input, options) => {
|
|
28752
|
+
let posix = utils.isWindows(options);
|
|
28753
|
+
let regex = picomatch.makeRe(String(glob), { ...options, capture: true });
|
|
28754
|
+
let match = regex.exec(posix ? utils.toPosixSlashes(input) : input);
|
|
28755
|
+
if (match) {
|
|
28756
|
+
return match.slice(1).map((v) => v === void 0 ? "" : v);
|
|
28757
|
+
}
|
|
28758
|
+
};
|
|
28759
|
+
micromatch2.makeRe = (...args) => picomatch.makeRe(...args);
|
|
28760
|
+
micromatch2.scan = (...args) => picomatch.scan(...args);
|
|
28761
|
+
micromatch2.parse = (patterns, options) => {
|
|
28762
|
+
let res = [];
|
|
28763
|
+
for (let pattern of [].concat(patterns || [])) {
|
|
28764
|
+
for (let str of braces(String(pattern), options)) {
|
|
28765
|
+
res.push(picomatch.parse(str, options));
|
|
28766
|
+
}
|
|
28767
|
+
}
|
|
28768
|
+
return res;
|
|
28769
|
+
};
|
|
28770
|
+
micromatch2.braces = (pattern, options) => {
|
|
28771
|
+
if (typeof pattern !== "string")
|
|
28772
|
+
throw new TypeError("Expected a string");
|
|
28773
|
+
if (options && options.nobrace === true || !hasBraces(pattern)) {
|
|
28774
|
+
return [pattern];
|
|
28775
|
+
}
|
|
28776
|
+
return braces(pattern, options);
|
|
28777
|
+
};
|
|
28778
|
+
micromatch2.braceExpand = (pattern, options) => {
|
|
28779
|
+
if (typeof pattern !== "string")
|
|
28780
|
+
throw new TypeError("Expected a string");
|
|
28781
|
+
return micromatch2.braces(pattern, { ...options, expand: true });
|
|
28782
|
+
};
|
|
28783
|
+
micromatch2.hasBraces = hasBraces;
|
|
28784
|
+
module2.exports = micromatch2;
|
|
28785
|
+
}
|
|
28786
|
+
});
|
|
28787
|
+
|
|
28788
|
+
// src/config.ts
|
|
28789
|
+
async function loadProjectConfig(cwd) {
|
|
28790
|
+
const configPath = path4.join(cwd, ".encoding-converter.json");
|
|
28791
|
+
try {
|
|
28792
|
+
const content = await fs4.readFile(configPath, "utf-8");
|
|
28793
|
+
const parsed = JSON.parse(content);
|
|
28794
|
+
return { ...DEFAULT_CONFIG, ...parsed };
|
|
28795
|
+
} catch (err) {
|
|
28796
|
+
if (err.code !== "ENOENT") {
|
|
28797
|
+
log("error", "Failed to parse config file", { path: configPath, error: err.message });
|
|
28798
|
+
}
|
|
28799
|
+
return { ...DEFAULT_CONFIG };
|
|
28800
|
+
}
|
|
28801
|
+
}
|
|
28802
|
+
function scoreSpecificity(pattern) {
|
|
28803
|
+
if (!pattern)
|
|
28804
|
+
return 0;
|
|
28805
|
+
const segments = pattern.split("/");
|
|
28806
|
+
let score = 0;
|
|
28807
|
+
for (const seg of segments) {
|
|
28808
|
+
if (seg === "**")
|
|
28809
|
+
score += 1;
|
|
28810
|
+
else if (seg === "*")
|
|
28811
|
+
score += 2;
|
|
28812
|
+
else if (seg.includes("*") || seg.includes("?"))
|
|
28813
|
+
score += 5;
|
|
28814
|
+
else
|
|
28815
|
+
score += 10;
|
|
28816
|
+
}
|
|
28817
|
+
return score;
|
|
28818
|
+
}
|
|
28819
|
+
function resolveEncoding(relativePath, config3) {
|
|
28820
|
+
if (!config3.overrides?.length)
|
|
28821
|
+
return config3.sourceEncoding;
|
|
28822
|
+
const matches = config3.overrides.map((rule, index) => ({ rule, score: scoreSpecificity(rule.pattern), index })).filter((item) => {
|
|
28823
|
+
if (!item.rule.pattern)
|
|
28824
|
+
return false;
|
|
28825
|
+
const isBare = !item.rule.pattern.includes("/");
|
|
28826
|
+
return import_micromatch.default.isMatch(relativePath, item.rule.pattern, isBare ? { matchBase: true } : void 0);
|
|
28827
|
+
}).sort((a, b) => b.score - a.score || a.index - b.index);
|
|
28828
|
+
return matches[0]?.rule.sourceEncoding ?? config3.sourceEncoding;
|
|
28829
|
+
}
|
|
28830
|
+
function toRelativePath(validPath, allowedDir) {
|
|
28831
|
+
return path4.relative(allowedDir, validPath).replace(/\\/g, "/");
|
|
28832
|
+
}
|
|
28833
|
+
var fs4, path4, import_micromatch, DEFAULT_CONFIG;
|
|
28834
|
+
var init_config = __esm({
|
|
28835
|
+
"src/config.ts"() {
|
|
28836
|
+
"use strict";
|
|
28837
|
+
fs4 = __toESM(require("fs/promises"));
|
|
28838
|
+
path4 = __toESM(require("path"));
|
|
28839
|
+
import_micromatch = __toESM(require_micromatch());
|
|
28840
|
+
init_logger();
|
|
28841
|
+
DEFAULT_CONFIG = {
|
|
28842
|
+
sourceEncoding: "GB18030",
|
|
28843
|
+
targetEncoding: "UTF-8",
|
|
28844
|
+
confidenceThreshold: 0.8
|
|
28845
|
+
};
|
|
28846
|
+
}
|
|
28847
|
+
});
|
|
28848
|
+
|
|
25752
28849
|
// src/tools/read-file.ts
|
|
25753
28850
|
function registerReadFile(server2, config3, allowedDirectories) {
|
|
25754
28851
|
server2.registerTool(
|
|
@@ -25771,44 +28868,49 @@ function registerReadFile(server2, config3, allowedDirectories) {
|
|
|
25771
28868
|
if (await isBinaryFile(validPath)) {
|
|
25772
28869
|
throw new Error("Binary file, cannot process as text");
|
|
25773
28870
|
}
|
|
25774
|
-
const buffer = await
|
|
28871
|
+
const buffer = await fs5.readFile(validPath);
|
|
28872
|
+
const resolvedSourceEncoding = resolveEncoding(
|
|
28873
|
+
toRelativePath(validPath, allowedDirectories[0]),
|
|
28874
|
+
config3
|
|
28875
|
+
);
|
|
25775
28876
|
const detection = await detectEncoding(validPath);
|
|
25776
|
-
let
|
|
28877
|
+
let text2;
|
|
25777
28878
|
const detectedEncoding = detection.encoding;
|
|
25778
28879
|
if (detectedEncoding && detection.confidence >= config3.confidenceThreshold && isGBEncoding(detectedEncoding)) {
|
|
25779
28880
|
log("info", "Decoding GB file to UTF-8", { path: args.path, encoding: detectedEncoding, confidence: detection.confidence });
|
|
25780
|
-
|
|
28881
|
+
text2 = decodeToUtf8(buffer, detectedEncoding);
|
|
25781
28882
|
} else if (detectedEncoding && isUtf8Encoding(detectedEncoding)) {
|
|
25782
|
-
|
|
25783
|
-
} else if (
|
|
25784
|
-
log("info", "
|
|
25785
|
-
|
|
28883
|
+
text2 = buffer.toString("utf-8");
|
|
28884
|
+
} else if (isGBEncoding(resolvedSourceEncoding)) {
|
|
28885
|
+
log("info", "Falling back to resolved sourceEncoding", { path: args.path, encoding: resolvedSourceEncoding, detected: detectedEncoding, confidence: detection.confidence });
|
|
28886
|
+
text2 = decodeToUtf8(buffer, resolvedSourceEncoding);
|
|
25786
28887
|
} else {
|
|
25787
|
-
|
|
28888
|
+
text2 = buffer.toString("utf-8");
|
|
25788
28889
|
}
|
|
25789
28890
|
if (args.head !== void 0) {
|
|
25790
|
-
const lines =
|
|
25791
|
-
|
|
28891
|
+
const lines = text2.split("\n");
|
|
28892
|
+
text2 = lines.slice(0, args.head).join("\n");
|
|
25792
28893
|
} else if (args.tail !== void 0) {
|
|
25793
|
-
const lines =
|
|
25794
|
-
|
|
28894
|
+
const lines = text2.split("\n");
|
|
28895
|
+
text2 = lines.slice(-args.tail).join("\n");
|
|
25795
28896
|
}
|
|
25796
28897
|
return {
|
|
25797
|
-
content: [{ type: "text", text }]
|
|
28898
|
+
content: [{ type: "text", text: text2 }]
|
|
25798
28899
|
};
|
|
25799
28900
|
}
|
|
25800
28901
|
);
|
|
25801
28902
|
}
|
|
25802
|
-
var
|
|
28903
|
+
var fs5;
|
|
25803
28904
|
var init_read_file = __esm({
|
|
25804
28905
|
"src/tools/read-file.ts"() {
|
|
25805
28906
|
"use strict";
|
|
25806
28907
|
init_zod();
|
|
25807
|
-
|
|
28908
|
+
fs5 = __toESM(require("fs/promises"));
|
|
25808
28909
|
init_path_validation();
|
|
25809
28910
|
init_detector();
|
|
25810
28911
|
init_converter();
|
|
25811
28912
|
init_binary();
|
|
28913
|
+
init_config();
|
|
25812
28914
|
init_logger();
|
|
25813
28915
|
}
|
|
25814
28916
|
});
|
|
@@ -25830,8 +28932,8 @@ function detectLineEnding(buffer) {
|
|
|
25830
28932
|
}
|
|
25831
28933
|
return crlf >= lf ? "CRLF" : "LF";
|
|
25832
28934
|
}
|
|
25833
|
-
function restoreLineEndings(
|
|
25834
|
-
const normalized =
|
|
28935
|
+
function restoreLineEndings(text2, style) {
|
|
28936
|
+
const normalized = text2.replace(/\r\n/g, "\n");
|
|
25835
28937
|
if (style === "CRLF") {
|
|
25836
28938
|
return normalized.replace(/\n/g, "\r\n");
|
|
25837
28939
|
}
|
|
@@ -25858,10 +28960,13 @@ function registerWriteFile(server2, config3, allowedDirectories) {
|
|
|
25858
28960
|
},
|
|
25859
28961
|
async (args) => {
|
|
25860
28962
|
const validPath = await validatePath(args.path, allowedDirectories);
|
|
25861
|
-
let targetEncoding =
|
|
28963
|
+
let targetEncoding = resolveEncoding(
|
|
28964
|
+
toRelativePath(validPath, allowedDirectories[0]),
|
|
28965
|
+
config3
|
|
28966
|
+
);
|
|
25862
28967
|
let lineEndingStyle = process.platform === "win32" ? "CRLF" : "LF";
|
|
25863
28968
|
try {
|
|
25864
|
-
const existingBuffer = await
|
|
28969
|
+
const existingBuffer = await fs6.readFile(validPath);
|
|
25865
28970
|
lineEndingStyle = detectLineEnding(existingBuffer);
|
|
25866
28971
|
const detection = await detectEncoding(validPath);
|
|
25867
28972
|
if (detection.encoding && isUtf8Encoding(detection.encoding)) {
|
|
@@ -25874,16 +28979,16 @@ function registerWriteFile(server2, config3, allowedDirectories) {
|
|
|
25874
28979
|
const finalContent = restoreLineEndings(args.content, lineEndingStyle);
|
|
25875
28980
|
const encoded = encodeFromUtf8(finalContent, targetEncoding);
|
|
25876
28981
|
try {
|
|
25877
|
-
await
|
|
28982
|
+
await fs6.writeFile(validPath, encoded, { flag: "wx" });
|
|
25878
28983
|
} catch (error2) {
|
|
25879
28984
|
if (error2.code === "EEXIST") {
|
|
25880
28985
|
const tempPath = `${validPath}.${(0, import_crypto.randomBytes)(16).toString("hex")}.tmp`;
|
|
25881
28986
|
try {
|
|
25882
|
-
await
|
|
25883
|
-
await
|
|
28987
|
+
await fs6.writeFile(tempPath, encoded);
|
|
28988
|
+
await fs6.rename(tempPath, validPath);
|
|
25884
28989
|
} catch (renameError) {
|
|
25885
28990
|
try {
|
|
25886
|
-
await
|
|
28991
|
+
await fs6.unlink(tempPath);
|
|
25887
28992
|
} catch {
|
|
25888
28993
|
}
|
|
25889
28994
|
throw renameError;
|
|
@@ -25898,16 +29003,17 @@ function registerWriteFile(server2, config3, allowedDirectories) {
|
|
|
25898
29003
|
}
|
|
25899
29004
|
);
|
|
25900
29005
|
}
|
|
25901
|
-
var
|
|
29006
|
+
var fs6, import_crypto;
|
|
25902
29007
|
var init_write_file = __esm({
|
|
25903
29008
|
"src/tools/write-file.ts"() {
|
|
25904
29009
|
"use strict";
|
|
25905
29010
|
init_zod();
|
|
25906
|
-
|
|
29011
|
+
fs6 = __toESM(require("fs/promises"));
|
|
25907
29012
|
import_crypto = require("crypto");
|
|
25908
29013
|
init_path_validation();
|
|
25909
29014
|
init_detector();
|
|
25910
29015
|
init_converter();
|
|
29016
|
+
init_config();
|
|
25911
29017
|
init_line_endings();
|
|
25912
29018
|
}
|
|
25913
29019
|
});
|
|
@@ -26337,9 +29443,9 @@ function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader
|
|
|
26337
29443
|
} }));
|
|
26338
29444
|
}
|
|
26339
29445
|
}
|
|
26340
|
-
function splitLines(
|
|
26341
|
-
const hasTrailingNl =
|
|
26342
|
-
const result =
|
|
29446
|
+
function splitLines(text2) {
|
|
29447
|
+
const hasTrailingNl = text2.endsWith("\n");
|
|
29448
|
+
const result = text2.split("\n").map((line) => line + "\n");
|
|
26343
29449
|
if (hasTrailingNl) {
|
|
26344
29450
|
result.pop();
|
|
26345
29451
|
} else {
|
|
@@ -26367,8 +29473,8 @@ var init_libesm = __esm({
|
|
|
26367
29473
|
});
|
|
26368
29474
|
|
|
26369
29475
|
// src/tools/edit-file.ts
|
|
26370
|
-
function normalizeLineEndings(
|
|
26371
|
-
return
|
|
29476
|
+
function normalizeLineEndings(text2) {
|
|
29477
|
+
return text2.replace(/\r\n/g, "\n");
|
|
26372
29478
|
}
|
|
26373
29479
|
function createUnifiedDiff(original, modified, filepath) {
|
|
26374
29480
|
return createTwoFilesPatch(filepath, filepath, normalizeLineEndings(original), normalizeLineEndings(modified), "original", "modified");
|
|
@@ -26433,14 +29539,20 @@ function registerEditFile(server2, config3, allowedDirectories) {
|
|
|
26433
29539
|
},
|
|
26434
29540
|
async (args) => {
|
|
26435
29541
|
const validPath = await validatePath(args.path, allowedDirectories);
|
|
26436
|
-
const buffer = await
|
|
29542
|
+
const buffer = await fs7.readFile(validPath);
|
|
26437
29543
|
const originalLineEnding = detectLineEnding(buffer);
|
|
26438
29544
|
const detection = await detectEncoding(validPath);
|
|
29545
|
+
const resolvedSourceEncoding = resolveEncoding(
|
|
29546
|
+
toRelativePath(validPath, allowedDirectories[0]),
|
|
29547
|
+
config3
|
|
29548
|
+
);
|
|
26439
29549
|
let originalEncoding = "UTF-8";
|
|
26440
|
-
if (detection.encoding && detection.confidence >= config3.confidenceThreshold
|
|
26441
|
-
|
|
26442
|
-
|
|
26443
|
-
|
|
29550
|
+
if (detection.encoding && detection.confidence >= config3.confidenceThreshold) {
|
|
29551
|
+
if (isGBEncoding(detection.encoding)) {
|
|
29552
|
+
originalEncoding = detection.encoding;
|
|
29553
|
+
}
|
|
29554
|
+
} else if (isGBEncoding(resolvedSourceEncoding)) {
|
|
29555
|
+
originalEncoding = resolvedSourceEncoding;
|
|
26444
29556
|
}
|
|
26445
29557
|
const utf8Content = isGBEncoding(originalEncoding) ? decodeToUtf8(buffer, originalEncoding) : buffer.toString("utf-8");
|
|
26446
29558
|
const modifiedContent = applyEditsToContent(utf8Content, args.edits);
|
|
@@ -26450,11 +29562,11 @@ function registerEditFile(server2, config3, allowedDirectories) {
|
|
|
26450
29562
|
const encoded = isGBEncoding(originalEncoding) ? encodeFromUtf8(finalContent, originalEncoding) : Buffer.from(finalContent, "utf-8");
|
|
26451
29563
|
const tempPath = `${validPath}.${(0, import_crypto2.randomBytes)(16).toString("hex")}.tmp`;
|
|
26452
29564
|
try {
|
|
26453
|
-
await
|
|
26454
|
-
await
|
|
29565
|
+
await fs7.writeFile(tempPath, encoded);
|
|
29566
|
+
await fs7.rename(tempPath, validPath);
|
|
26455
29567
|
} catch (error2) {
|
|
26456
29568
|
try {
|
|
26457
|
-
await
|
|
29569
|
+
await fs7.unlink(tempPath);
|
|
26458
29570
|
} catch {
|
|
26459
29571
|
}
|
|
26460
29572
|
throw error2;
|
|
@@ -26466,50 +29578,22 @@ function registerEditFile(server2, config3, allowedDirectories) {
|
|
|
26466
29578
|
}
|
|
26467
29579
|
);
|
|
26468
29580
|
}
|
|
26469
|
-
var
|
|
29581
|
+
var fs7, import_crypto2;
|
|
26470
29582
|
var init_edit_file = __esm({
|
|
26471
29583
|
"src/tools/edit-file.ts"() {
|
|
26472
29584
|
"use strict";
|
|
26473
29585
|
init_zod();
|
|
26474
|
-
|
|
29586
|
+
fs7 = __toESM(require("fs/promises"));
|
|
26475
29587
|
import_crypto2 = require("crypto");
|
|
26476
29588
|
init_libesm();
|
|
26477
29589
|
init_path_validation();
|
|
26478
29590
|
init_detector();
|
|
26479
29591
|
init_converter();
|
|
29592
|
+
init_config();
|
|
26480
29593
|
init_line_endings();
|
|
26481
29594
|
}
|
|
26482
29595
|
});
|
|
26483
29596
|
|
|
26484
|
-
// src/config.ts
|
|
26485
|
-
async function loadProjectConfig(cwd) {
|
|
26486
|
-
const configPath = path4.join(cwd, ".encoding-converter.json");
|
|
26487
|
-
try {
|
|
26488
|
-
const content = await fs7.readFile(configPath, "utf-8");
|
|
26489
|
-
const parsed = JSON.parse(content);
|
|
26490
|
-
return { ...DEFAULT_CONFIG, ...parsed };
|
|
26491
|
-
} catch (err) {
|
|
26492
|
-
if (err.code !== "ENOENT") {
|
|
26493
|
-
log("error", "Failed to parse config file", { path: configPath, error: err.message });
|
|
26494
|
-
}
|
|
26495
|
-
return { ...DEFAULT_CONFIG };
|
|
26496
|
-
}
|
|
26497
|
-
}
|
|
26498
|
-
var fs7, path4, DEFAULT_CONFIG;
|
|
26499
|
-
var init_config = __esm({
|
|
26500
|
-
"src/config.ts"() {
|
|
26501
|
-
"use strict";
|
|
26502
|
-
fs7 = __toESM(require("fs/promises"));
|
|
26503
|
-
path4 = __toESM(require("path"));
|
|
26504
|
-
init_logger();
|
|
26505
|
-
DEFAULT_CONFIG = {
|
|
26506
|
-
sourceEncoding: "GB18030",
|
|
26507
|
-
targetEncoding: "UTF-8",
|
|
26508
|
-
confidenceThreshold: 0.8
|
|
26509
|
-
};
|
|
26510
|
-
}
|
|
26511
|
-
});
|
|
26512
|
-
|
|
26513
29597
|
// src/server.ts
|
|
26514
29598
|
var server_exports = {};
|
|
26515
29599
|
__export(server_exports, {
|
|
@@ -26657,10 +29741,8 @@ async function removeClaudeCodeEntry(configPath) {
|
|
|
26657
29741
|
delete data.mcpServers["encoding-aware-fs"];
|
|
26658
29742
|
if (isEmptyMcpJson(data)) {
|
|
26659
29743
|
await fs9.unlink(configPath);
|
|
26660
|
-
console.log(` \u2713 Removed ${configPath} (was empty after cleanup)`);
|
|
26661
29744
|
} else {
|
|
26662
29745
|
await writeJsonFile(configPath, data);
|
|
26663
|
-
console.log(` \u2713 Removed encoding-aware-fs entry from ${configPath}`);
|
|
26664
29746
|
}
|
|
26665
29747
|
}
|
|
26666
29748
|
async function removeOpenCodeConfig(configPath) {
|
|
@@ -26681,10 +29763,8 @@ async function removeOpenCodeConfig(configPath) {
|
|
|
26681
29763
|
}
|
|
26682
29764
|
if (isOpenCodeJsoncEmpty(data) || Object.keys(data).length === 0) {
|
|
26683
29765
|
await fs9.unlink(configPath);
|
|
26684
|
-
console.log(` \u2713 Removed ${configPath} (was empty after cleanup)`);
|
|
26685
29766
|
} else {
|
|
26686
29767
|
await writeJsonFile(configPath, data);
|
|
26687
|
-
console.log(` \u2713 Removed encoding-aware-fs entries from ${configPath}`);
|
|
26688
29768
|
}
|
|
26689
29769
|
}
|
|
26690
29770
|
async function removeSkillFiles(platform) {
|
|
@@ -26692,7 +29772,6 @@ async function removeSkillFiles(platform) {
|
|
|
26692
29772
|
return;
|
|
26693
29773
|
try {
|
|
26694
29774
|
await fs9.unlink(platform.skillPath);
|
|
26695
|
-
console.log(` \u2713 Removed ${platform.skillPath}`);
|
|
26696
29775
|
} catch (err) {
|
|
26697
29776
|
if (err.code !== "ENOENT")
|
|
26698
29777
|
throw err;
|
|
@@ -26710,7 +29789,6 @@ async function removeRuleFile(platform) {
|
|
|
26710
29789
|
return;
|
|
26711
29790
|
try {
|
|
26712
29791
|
await fs9.unlink(platform.rulePath);
|
|
26713
|
-
console.log(` \u2713 Removed ${platform.rulePath}`);
|
|
26714
29792
|
} catch (err) {
|
|
26715
29793
|
if (err.code !== "ENOENT")
|
|
26716
29794
|
throw err;
|
|
@@ -26723,37 +29801,35 @@ async function removeRuleFile(platform) {
|
|
|
26723
29801
|
}
|
|
26724
29802
|
async function runUninstaller() {
|
|
26725
29803
|
const cwd = process.cwd();
|
|
26726
|
-
|
|
26727
|
-
|
|
26728
|
-
|
|
26729
|
-
console.log("\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D");
|
|
26730
|
-
console.log();
|
|
29804
|
+
clack.intro("encoding-aware-fs \u5378\u8F7D");
|
|
29805
|
+
const s = clack.spinner();
|
|
29806
|
+
s.start("Detecting installed components...");
|
|
26731
29807
|
const installed = await detectInstalled(cwd);
|
|
29808
|
+
s.stop("Detection complete");
|
|
26732
29809
|
if (installed.length === 0) {
|
|
26733
|
-
|
|
26734
|
-
|
|
29810
|
+
clack.log.info("No encoding-aware-fs MCP config found in this directory.");
|
|
29811
|
+
clack.outro("Nothing to uninstall");
|
|
26735
29812
|
return;
|
|
26736
29813
|
}
|
|
26737
|
-
|
|
26738
|
-
|
|
26739
|
-
|
|
26740
|
-
|
|
26741
|
-
|
|
26742
|
-
|
|
26743
|
-
|
|
26744
|
-
|
|
26745
|
-
|
|
26746
|
-
|
|
26747
|
-
console.log();
|
|
26748
|
-
const proceed = await (0, import_prompts.confirm)({
|
|
29814
|
+
const details = installed.map((p) => {
|
|
29815
|
+
const lines = [p.name];
|
|
29816
|
+
if (p.skillPath)
|
|
29817
|
+
lines.push(` Skill: ${p.skillPath}`);
|
|
29818
|
+
if (p.rulePath)
|
|
29819
|
+
lines.push(` Rule: ${p.rulePath}`);
|
|
29820
|
+
return lines.join("\n");
|
|
29821
|
+
}).join("\n");
|
|
29822
|
+
clack.note(details, "Found configurations");
|
|
29823
|
+
const proceed = await clack.confirm({
|
|
26749
29824
|
message: "Remove encoding-aware-fs MCP config entries, skill files, and rule files?",
|
|
26750
|
-
|
|
29825
|
+
initialValue: false
|
|
26751
29826
|
});
|
|
26752
|
-
if (!proceed) {
|
|
26753
|
-
|
|
29827
|
+
if (clack.isCancel(proceed) || !proceed) {
|
|
29828
|
+
clack.cancel("Cancelled");
|
|
26754
29829
|
return;
|
|
26755
29830
|
}
|
|
26756
|
-
|
|
29831
|
+
const s2 = clack.spinner();
|
|
29832
|
+
s2.start("Cleaning up...");
|
|
26757
29833
|
for (const p of installed) {
|
|
26758
29834
|
if (p.type === "claude-code") {
|
|
26759
29835
|
await removeClaudeCodeEntry(p.configPath);
|
|
@@ -26767,23 +29843,22 @@ async function runUninstaller() {
|
|
|
26767
29843
|
for (const p of installed) {
|
|
26768
29844
|
await removeRuleFile(p);
|
|
26769
29845
|
}
|
|
29846
|
+
s2.stop("Cleanup complete");
|
|
26770
29847
|
const encodingConfigPath = path5.join(cwd, ".encoding-converter.json");
|
|
26771
29848
|
try {
|
|
26772
29849
|
await fs9.access(encodingConfigPath);
|
|
26773
|
-
|
|
29850
|
+
clack.log.info(`Kept ${encodingConfigPath} (project encoding config)`);
|
|
26774
29851
|
} catch {
|
|
26775
29852
|
}
|
|
26776
|
-
|
|
26777
|
-
console.log(" \u2705 Uninstallation complete.");
|
|
26778
|
-
console.log();
|
|
29853
|
+
clack.outro("\u5378\u8F7D\u5B8C\u6210");
|
|
26779
29854
|
}
|
|
26780
|
-
var fs9, path5,
|
|
29855
|
+
var fs9, path5, clack;
|
|
26781
29856
|
var init_uninstaller = __esm({
|
|
26782
29857
|
"src/uninstaller.ts"() {
|
|
26783
29858
|
"use strict";
|
|
26784
29859
|
fs9 = __toESM(require("fs/promises"));
|
|
26785
29860
|
path5 = __toESM(require("path"));
|
|
26786
|
-
|
|
29861
|
+
clack = __toESM(require("@clack/prompts"));
|
|
26787
29862
|
init_config_io();
|
|
26788
29863
|
}
|
|
26789
29864
|
});
|
|
@@ -26825,7 +29900,6 @@ async function writeClaudeCodeConfig(cwd) {
|
|
|
26825
29900
|
env: {}
|
|
26826
29901
|
};
|
|
26827
29902
|
await writeJsonFile(configPath, merged);
|
|
26828
|
-
console.log(` \u2713 Wrote ${configPath}`);
|
|
26829
29903
|
}
|
|
26830
29904
|
async function writeOpenCodeConfig(cwd) {
|
|
26831
29905
|
const configPath = path6.join(cwd, "opencode.jsonc");
|
|
@@ -26842,35 +29916,32 @@ async function writeOpenCodeConfig(cwd) {
|
|
|
26842
29916
|
timeout: 3e4
|
|
26843
29917
|
};
|
|
26844
29918
|
await writeJsonFile(configPath, merged);
|
|
26845
|
-
console.log(` \u2713 Wrote ${configPath}`);
|
|
26846
29919
|
}
|
|
26847
29920
|
async function copySkillFile(cwd, platform) {
|
|
26848
29921
|
const sourcePath = path6.join(path6.resolve(__dirname, ".."), "skills", platform, "SKILL.md");
|
|
26849
29922
|
try {
|
|
26850
29923
|
await fs10.access(sourcePath);
|
|
26851
29924
|
} catch {
|
|
26852
|
-
|
|
29925
|
+
clack2.log.warn("Skill file not found, skipping");
|
|
26853
29926
|
return;
|
|
26854
29927
|
}
|
|
26855
29928
|
const targetDir = platform === "claude-code" ? path6.join(cwd, ".claude", "skills", "encoding-aware-fs") : path6.join(cwd, ".agents", "skills", "encoding-aware-fs");
|
|
26856
29929
|
const targetPath = path6.join(targetDir, "SKILL.md");
|
|
26857
29930
|
await fs10.mkdir(targetDir, { recursive: true });
|
|
26858
29931
|
await fs10.copyFile(sourcePath, targetPath);
|
|
26859
|
-
console.log(` \u2713 Installed skill \u2192 ${targetPath}`);
|
|
26860
29932
|
}
|
|
26861
29933
|
async function copyRuleFile(cwd, platform) {
|
|
26862
29934
|
const sourcePath = path6.join(path6.resolve(__dirname, ".."), "skills", platform, "RULE.md");
|
|
26863
29935
|
try {
|
|
26864
29936
|
await fs10.access(sourcePath);
|
|
26865
29937
|
} catch {
|
|
26866
|
-
|
|
29938
|
+
clack2.log.warn("Rule file template not found, skipping");
|
|
26867
29939
|
return;
|
|
26868
29940
|
}
|
|
26869
29941
|
const ruleDir = platform === "claude-code" ? path6.join(cwd, ".claude", "rules") : path6.join(cwd, ".agents", "rules");
|
|
26870
29942
|
const rulePath = path6.join(ruleDir, "encoding-aware-fs.md");
|
|
26871
29943
|
await fs10.mkdir(ruleDir, { recursive: true });
|
|
26872
29944
|
await fs10.copyFile(sourcePath, rulePath);
|
|
26873
|
-
console.log(` \u2713 Installed rule \u2192 ${rulePath}`);
|
|
26874
29945
|
}
|
|
26875
29946
|
async function addOpenCodeInstructions(cwd) {
|
|
26876
29947
|
const configPath = path6.join(cwd, "opencode.jsonc");
|
|
@@ -26885,57 +29956,133 @@ async function addOpenCodeInstructions(cwd) {
|
|
|
26885
29956
|
}
|
|
26886
29957
|
await writeJsonFile(configPath, merged);
|
|
26887
29958
|
}
|
|
26888
|
-
async function
|
|
29959
|
+
async function promptEncodingConfig(cwd) {
|
|
26889
29960
|
const configPath = path6.join(cwd, ".encoding-converter.json");
|
|
29961
|
+
let existingConfig = null;
|
|
26890
29962
|
try {
|
|
26891
|
-
await fs10.
|
|
26892
|
-
|
|
29963
|
+
const content = await fs10.readFile(configPath, "utf-8");
|
|
29964
|
+
existingConfig = JSON.parse(content);
|
|
26893
29965
|
} catch {
|
|
26894
|
-
const defaultConfig = {
|
|
26895
|
-
sourceEncoding: "GB18030",
|
|
26896
|
-
targetEncoding: "UTF-8",
|
|
26897
|
-
confidenceThreshold: 0.8
|
|
26898
|
-
};
|
|
26899
|
-
await writeJsonFile(configPath, defaultConfig);
|
|
26900
|
-
console.log(` \u2713 Generated ${configPath}`);
|
|
26901
29966
|
}
|
|
29967
|
+
let sourceEncoding;
|
|
29968
|
+
let confidenceThreshold;
|
|
29969
|
+
let overrides = [];
|
|
29970
|
+
if (existingConfig) {
|
|
29971
|
+
clack2.note(
|
|
29972
|
+
`sourceEncoding: ${existingConfig.sourceEncoding ?? "GB18030"}
|
|
29973
|
+
confidenceThreshold: ${existingConfig.confidenceThreshold ?? 0.8}${existingConfig.overrides?.length ? `
|
|
29974
|
+
overrides: ${existingConfig.overrides.length} rule(s)` : ""}`,
|
|
29975
|
+
"Existing encoding config found"
|
|
29976
|
+
);
|
|
29977
|
+
sourceEncoding = existingConfig.sourceEncoding ?? "GB18030";
|
|
29978
|
+
confidenceThreshold = existingConfig.confidenceThreshold ?? 0.8;
|
|
29979
|
+
overrides = existingConfig.overrides ?? [];
|
|
29980
|
+
} else {
|
|
29981
|
+
sourceEncoding = await clack2.text({
|
|
29982
|
+
message: "Default source encoding",
|
|
29983
|
+
initialValue: "GB18030"
|
|
29984
|
+
});
|
|
29985
|
+
if (clack2.isCancel(sourceEncoding)) {
|
|
29986
|
+
clack2.cancel("Cancelled");
|
|
29987
|
+
process.exit(0);
|
|
29988
|
+
}
|
|
29989
|
+
const thresholdStr = await clack2.text({
|
|
29990
|
+
message: "Detection confidence threshold (0-1)",
|
|
29991
|
+
initialValue: "0.8",
|
|
29992
|
+
validate: (v) => {
|
|
29993
|
+
const n = parseFloat(v);
|
|
29994
|
+
if (isNaN(n) || n < 0 || n > 1)
|
|
29995
|
+
return "Please enter a number between 0 and 1";
|
|
29996
|
+
}
|
|
29997
|
+
});
|
|
29998
|
+
if (clack2.isCancel(thresholdStr)) {
|
|
29999
|
+
clack2.cancel("Cancelled");
|
|
30000
|
+
process.exit(0);
|
|
30001
|
+
}
|
|
30002
|
+
confidenceThreshold = parseFloat(thresholdStr);
|
|
30003
|
+
}
|
|
30004
|
+
const addOverrides = await clack2.confirm({
|
|
30005
|
+
message: "Add directory-level encoding rules?",
|
|
30006
|
+
initialValue: false
|
|
30007
|
+
});
|
|
30008
|
+
if (clack2.isCancel(addOverrides)) {
|
|
30009
|
+
clack2.cancel("Cancelled");
|
|
30010
|
+
process.exit(0);
|
|
30011
|
+
}
|
|
30012
|
+
if (addOverrides) {
|
|
30013
|
+
let addMore = true;
|
|
30014
|
+
while (addMore) {
|
|
30015
|
+
const pattern = await clack2.text({
|
|
30016
|
+
message: "Glob pattern (e.g. legacy/**, openspec/**)"
|
|
30017
|
+
});
|
|
30018
|
+
if (clack2.isCancel(pattern)) {
|
|
30019
|
+
clack2.cancel("Cancelled");
|
|
30020
|
+
process.exit(0);
|
|
30021
|
+
}
|
|
30022
|
+
const encoding = await clack2.text({
|
|
30023
|
+
message: `Source encoding for ${pattern}`,
|
|
30024
|
+
initialValue: "UTF-8"
|
|
30025
|
+
});
|
|
30026
|
+
if (clack2.isCancel(encoding)) {
|
|
30027
|
+
clack2.cancel("Cancelled");
|
|
30028
|
+
process.exit(0);
|
|
30029
|
+
}
|
|
30030
|
+
overrides.push({ pattern, sourceEncoding: encoding });
|
|
30031
|
+
const more = await clack2.confirm({
|
|
30032
|
+
message: "Add another rule?",
|
|
30033
|
+
initialValue: false
|
|
30034
|
+
});
|
|
30035
|
+
if (clack2.isCancel(more)) {
|
|
30036
|
+
clack2.cancel("Cancelled");
|
|
30037
|
+
process.exit(0);
|
|
30038
|
+
}
|
|
30039
|
+
addMore = more;
|
|
30040
|
+
}
|
|
30041
|
+
}
|
|
30042
|
+
const configToWrite = {
|
|
30043
|
+
sourceEncoding,
|
|
30044
|
+
confidenceThreshold
|
|
30045
|
+
};
|
|
30046
|
+
if (overrides.length > 0) {
|
|
30047
|
+
configToWrite.overrides = overrides;
|
|
30048
|
+
}
|
|
30049
|
+
const s = clack2.spinner();
|
|
30050
|
+
s.start("Writing encoding config...");
|
|
30051
|
+
await writeJsonFile(configPath, configToWrite);
|
|
30052
|
+
s.stop("Encoding config written");
|
|
26902
30053
|
}
|
|
26903
30054
|
async function runInstaller() {
|
|
26904
30055
|
const cwd = process.cwd();
|
|
26905
|
-
|
|
26906
|
-
|
|
26907
|
-
|
|
26908
|
-
console.log("\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D");
|
|
26909
|
-
console.log();
|
|
26910
|
-
console.log("Environment checks:");
|
|
30056
|
+
clack2.intro("encoding-aware-fs \u5B89\u88C5\u5411\u5BFC");
|
|
30057
|
+
const s = clack2.spinner();
|
|
30058
|
+
s.start("Checking environment...");
|
|
26911
30059
|
const nodeCheck = checkNodeVersion();
|
|
26912
|
-
|
|
26913
|
-
|
|
30060
|
+
const chardetCheck = await checkPythonChardet();
|
|
30061
|
+
s.stop("Environment checked");
|
|
30062
|
+
if (!nodeCheck.ok) {
|
|
30063
|
+
clack2.log.warn(`Node.js ${nodeCheck.version} (>= 18 recommended)`);
|
|
26914
30064
|
} else {
|
|
26915
|
-
|
|
30065
|
+
clack2.log.success(`Node.js ${nodeCheck.version}`);
|
|
26916
30066
|
}
|
|
26917
|
-
|
|
26918
|
-
|
|
26919
|
-
|
|
30067
|
+
if (!chardetCheck.ok) {
|
|
30068
|
+
clack2.log.warn("Python chardet not found \u2014 encoding detection will use heuristic fallback");
|
|
30069
|
+
clack2.log.info("Install with: pip install chardet");
|
|
26920
30070
|
} else {
|
|
26921
|
-
|
|
26922
|
-
console.log(" Install with: pip install chardet");
|
|
30071
|
+
clack2.log.success(chardetCheck.detail);
|
|
26923
30072
|
}
|
|
26924
|
-
|
|
26925
|
-
const platforms = await (0, import_prompts2.checkbox)({
|
|
30073
|
+
const platforms = await clack2.multiselect({
|
|
26926
30074
|
message: "Select platforms to configure:",
|
|
26927
|
-
|
|
26928
|
-
{
|
|
26929
|
-
{
|
|
30075
|
+
options: [
|
|
30076
|
+
{ value: "claude-code", label: "Claude Code (.mcp.json)" },
|
|
30077
|
+
{ value: "opencode", label: "OpenCode (opencode.jsonc)" }
|
|
26930
30078
|
]
|
|
26931
30079
|
});
|
|
26932
|
-
if (platforms.length === 0) {
|
|
26933
|
-
|
|
26934
|
-
|
|
30080
|
+
if (clack2.isCancel(platforms) || platforms.length === 0) {
|
|
30081
|
+
clack2.cancel("No platforms selected");
|
|
30082
|
+
process.exit(0);
|
|
26935
30083
|
}
|
|
26936
|
-
|
|
26937
|
-
|
|
26938
|
-
console.log();
|
|
30084
|
+
const s2 = clack2.spinner();
|
|
30085
|
+
s2.start("Writing config files...");
|
|
26939
30086
|
for (const platform of platforms) {
|
|
26940
30087
|
if (platform === "claude-code") {
|
|
26941
30088
|
await writeClaudeCodeConfig(cwd);
|
|
@@ -26943,39 +30090,21 @@ async function runInstaller() {
|
|
|
26943
30090
|
await writeOpenCodeConfig(cwd);
|
|
26944
30091
|
}
|
|
26945
30092
|
}
|
|
26946
|
-
|
|
26947
|
-
|
|
30093
|
+
s2.stop("MCP configs written");
|
|
30094
|
+
const s3 = clack2.spinner();
|
|
30095
|
+
s3.start("Installing skill and rule files...");
|
|
26948
30096
|
for (const platform of platforms) {
|
|
26949
30097
|
await copySkillFile(cwd, platform);
|
|
26950
|
-
}
|
|
26951
|
-
console.log();
|
|
26952
|
-
console.log("Rule files:");
|
|
26953
|
-
for (const platform of platforms) {
|
|
26954
30098
|
await copyRuleFile(cwd, platform);
|
|
26955
30099
|
}
|
|
26956
30100
|
if (platforms.includes("opencode")) {
|
|
26957
30101
|
await addOpenCodeInstructions(cwd);
|
|
26958
|
-
console.log(" \u2713 Added rule to opencode.jsonc instructions");
|
|
26959
|
-
}
|
|
26960
|
-
await ensureEncodingConfig(cwd);
|
|
26961
|
-
console.log();
|
|
26962
|
-
console.log("\u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510");
|
|
26963
|
-
console.log("\u2502 \u2705 Installation complete! \u2502");
|
|
26964
|
-
console.log("\u2502 \u2502");
|
|
26965
|
-
if (platforms.includes("claude-code")) {
|
|
26966
|
-
console.log("\u2502 Claude Code: restart your IDE / agent \u2502");
|
|
26967
|
-
}
|
|
26968
|
-
if (platforms.includes("opencode")) {
|
|
26969
|
-
console.log("\u2502 OpenCode: restart opencode \u2502");
|
|
26970
30102
|
}
|
|
26971
|
-
|
|
26972
|
-
|
|
26973
|
-
|
|
26974
|
-
console.log("\u2502 when your AI tool connects. \u2502");
|
|
26975
|
-
console.log("\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518");
|
|
26976
|
-
console.log();
|
|
30103
|
+
s3.stop("Skill & rule files installed");
|
|
30104
|
+
await promptEncodingConfig(cwd);
|
|
30105
|
+
clack2.outro("\u5B89\u88C5\u5B8C\u6210\uFF01\u8BF7\u91CD\u542F Claude Code / OpenCode \u4EE5\u751F\u6548");
|
|
26977
30106
|
}
|
|
26978
|
-
var fs10, path6, import_child_process2, import_util6,
|
|
30107
|
+
var fs10, path6, import_child_process2, import_util6, clack2, execFileAsync;
|
|
26979
30108
|
var init_installer = __esm({
|
|
26980
30109
|
"src/installer.ts"() {
|
|
26981
30110
|
"use strict";
|
|
@@ -26983,7 +30112,7 @@ var init_installer = __esm({
|
|
|
26983
30112
|
path6 = __toESM(require("path"));
|
|
26984
30113
|
import_child_process2 = require("child_process");
|
|
26985
30114
|
import_util6 = require("util");
|
|
26986
|
-
|
|
30115
|
+
clack2 = __toESM(require("@clack/prompts"));
|
|
26987
30116
|
init_config_io();
|
|
26988
30117
|
execFileAsync = (0, import_util6.promisify)(import_child_process2.execFile);
|
|
26989
30118
|
}
|
|
@@ -27011,4 +30140,30 @@ main().catch((err) => {
|
|
|
27011
30140
|
console.error(err);
|
|
27012
30141
|
process.exit(1);
|
|
27013
30142
|
});
|
|
30143
|
+
/*! Bundled license information:
|
|
30144
|
+
|
|
30145
|
+
is-number/index.js:
|
|
30146
|
+
(*!
|
|
30147
|
+
* is-number <https://github.com/jonschlinkert/is-number>
|
|
30148
|
+
*
|
|
30149
|
+
* Copyright (c) 2014-present, Jon Schlinkert.
|
|
30150
|
+
* Released under the MIT License.
|
|
30151
|
+
*)
|
|
30152
|
+
|
|
30153
|
+
to-regex-range/index.js:
|
|
30154
|
+
(*!
|
|
30155
|
+
* to-regex-range <https://github.com/micromatch/to-regex-range>
|
|
30156
|
+
*
|
|
30157
|
+
* Copyright (c) 2015-present, Jon Schlinkert.
|
|
30158
|
+
* Released under the MIT License.
|
|
30159
|
+
*)
|
|
30160
|
+
|
|
30161
|
+
fill-range/index.js:
|
|
30162
|
+
(*!
|
|
30163
|
+
* fill-range <https://github.com/jonschlinkert/fill-range>
|
|
30164
|
+
*
|
|
30165
|
+
* Copyright (c) 2014-present, Jon Schlinkert.
|
|
30166
|
+
* Licensed under the MIT License.
|
|
30167
|
+
*)
|
|
30168
|
+
*/
|
|
27014
30169
|
//# sourceMappingURL=index.js.map
|