@datadog/datadog-ci-plugin-terraform 5.26.1 → 5.27.0
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/dist/bundle.d.ts +1 -1
- package/dist/bundle.js +1754 -1056
- package/dist/bundle.js.LEGAL.txt +59 -0
- package/dist/bundle.js.map +1 -1
- package/package.json +2 -2
package/dist/bundle.js
CHANGED
|
@@ -6182,7 +6182,7 @@ var require_upath = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
6182
6182
|
}));
|
|
6183
6183
|
//#endregion
|
|
6184
6184
|
//#region ../../node_modules/brace-expansion/node_modules/balanced-match/dist/commonjs/index.js
|
|
6185
|
-
var require_commonjs$
|
|
6185
|
+
var require_commonjs$7 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
6186
6186
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6187
6187
|
exports.range = exports.balanced = void 0;
|
|
6188
6188
|
const balanced = (a, b, str) => {
|
|
@@ -6236,11 +6236,11 @@ var require_commonjs$6 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
6236
6236
|
}));
|
|
6237
6237
|
//#endregion
|
|
6238
6238
|
//#region ../../node_modules/brace-expansion/dist/commonjs/index.js
|
|
6239
|
-
var require_commonjs$
|
|
6239
|
+
var require_commonjs$6 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
6240
6240
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6241
6241
|
exports.EXPANSION_MAX_REWRITES = exports.EXPANSION_MAX_DEPTH = exports.EXPANSION_MAX_LENGTH = exports.EXPANSION_MAX = void 0;
|
|
6242
6242
|
exports.expand = expand;
|
|
6243
|
-
const balanced_match_1 = require_commonjs$
|
|
6243
|
+
const balanced_match_1 = require_commonjs$7();
|
|
6244
6244
|
const escSlash = "\0SLASH" + Math.random() + "\0";
|
|
6245
6245
|
const escOpen = "\0OPEN" + Math.random() + "\0";
|
|
6246
6246
|
const escClose = "\0CLOSE" + Math.random() + "\0";
|
|
@@ -6442,46 +6442,33 @@ var require_commonjs$5 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
6442
6442
|
}
|
|
6443
6443
|
}));
|
|
6444
6444
|
//#endregion
|
|
6445
|
-
//#region ../../node_modules/glob/
|
|
6446
|
-
var
|
|
6447
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6448
|
-
exports.assertValidPattern = void 0;
|
|
6449
|
-
const MAX_PATTERN_LENGTH = 1024 * 64;
|
|
6450
|
-
const assertValidPattern = (pattern) => {
|
|
6451
|
-
if (typeof pattern !== "string") throw new TypeError("invalid pattern");
|
|
6452
|
-
if (pattern.length > MAX_PATTERN_LENGTH) throw new TypeError("pattern is too long");
|
|
6453
|
-
};
|
|
6454
|
-
exports.assertValidPattern = assertValidPattern;
|
|
6455
|
-
}));
|
|
6456
|
-
//#endregion
|
|
6457
|
-
//#region ../../node_modules/glob/node_modules/minimatch/dist/commonjs/brace-expressions.js
|
|
6458
|
-
var require_brace_expressions = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
6445
|
+
//#region ../../node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/parse-class.js
|
|
6446
|
+
var require_parse_class = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
6459
6447
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6460
6448
|
exports.parseClass = void 0;
|
|
6461
6449
|
const posixClasses = {
|
|
6462
|
-
"[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}"
|
|
6463
|
-
"[:alpha:]": ["\\p{L}\\p{Nl}"
|
|
6464
|
-
"[:ascii:]": ["\\x00-\\x7f"
|
|
6465
|
-
"[:blank:]": ["\\p{Zs}\\t"
|
|
6466
|
-
"[:cntrl:]": ["\\p{Cc}"
|
|
6467
|
-
"[:digit:]": ["\\p{Nd}"
|
|
6468
|
-
"[:graph:]": [
|
|
6469
|
-
|
|
6470
|
-
true,
|
|
6471
|
-
true
|
|
6472
|
-
],
|
|
6473
|
-
"[:lower:]": ["\\p{Ll}", true],
|
|
6450
|
+
"[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}"],
|
|
6451
|
+
"[:alpha:]": ["\\p{L}\\p{Nl}"],
|
|
6452
|
+
"[:ascii:]": ["\\x00-\\x7f"],
|
|
6453
|
+
"[:blank:]": ["\\p{Zs}\\t"],
|
|
6454
|
+
"[:cntrl:]": ["\\p{Cc}"],
|
|
6455
|
+
"[:digit:]": ["\\p{Nd}"],
|
|
6456
|
+
"[:graph:]": ["\\p{Z}\\p{C}", true],
|
|
6457
|
+
"[:lower:]": ["\\p{Ll}"],
|
|
6474
6458
|
"[:print:]": ["\\p{C}", true],
|
|
6475
|
-
"[:punct:]": ["\\p{P}"
|
|
6476
|
-
"[:space:]": ["\\p{Z}\\t\\r\\n\\v\\f"
|
|
6477
|
-
"[:upper:]": ["\\p{Lu}"
|
|
6478
|
-
"[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}"
|
|
6479
|
-
"[:xdigit:]": ["A-Fa-f0-9"
|
|
6459
|
+
"[:punct:]": ["\\p{P}\\p{S}"],
|
|
6460
|
+
"[:space:]": ["\\p{Z}\\t\\r\\n\\v\\f"],
|
|
6461
|
+
"[:upper:]": ["\\p{Lu}"],
|
|
6462
|
+
"[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}"],
|
|
6463
|
+
"[:xdigit:]": ["A-Fa-f0-9"]
|
|
6480
6464
|
};
|
|
6481
6465
|
const braceEscape = (s) => s.replace(/[[\]\\-]/g, "\\$&");
|
|
6482
|
-
const
|
|
6483
|
-
const
|
|
6484
|
-
|
|
6466
|
+
const noMatch = /$./;
|
|
6467
|
+
const parseClass = (glob, position, nocase = false, form) => {
|
|
6468
|
+
const norm = (c) => {
|
|
6469
|
+
const n = form ? c.normalize(form) : c;
|
|
6470
|
+
return [...n].length === 1 ? n : c;
|
|
6471
|
+
};
|
|
6485
6472
|
const pos = position;
|
|
6486
6473
|
/* c8 ignore start */
|
|
6487
6474
|
if (glob.charAt(pos) !== "[") throw new Error("not in a brace expression");
|
|
@@ -6490,13 +6477,12 @@ var require_brace_expressions = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
6490
6477
|
const negs = [];
|
|
6491
6478
|
let i = pos + 1;
|
|
6492
6479
|
let sawStart = false;
|
|
6493
|
-
let uflag = false;
|
|
6494
6480
|
let escaping = false;
|
|
6495
6481
|
let negate = false;
|
|
6496
6482
|
let endPos = pos;
|
|
6497
6483
|
let rangeStart = "";
|
|
6498
6484
|
WHILE: while (i < glob.length) {
|
|
6499
|
-
const c = glob.
|
|
6485
|
+
const c = String.fromCodePoint(glob.codePointAt(i));
|
|
6500
6486
|
if ((c === "!" || c === "^") && i === pos + 1) {
|
|
6501
6487
|
negate = true;
|
|
6502
6488
|
i++;
|
|
@@ -6515,615 +6501,652 @@ var require_brace_expressions = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
6515
6501
|
}
|
|
6516
6502
|
}
|
|
6517
6503
|
if (c === "[" && !escaping) {
|
|
6518
|
-
for (const [cls, [unip,
|
|
6519
|
-
if (rangeStart) return [
|
|
6520
|
-
"$.",
|
|
6521
|
-
false,
|
|
6522
|
-
glob.length - pos,
|
|
6523
|
-
true
|
|
6524
|
-
];
|
|
6504
|
+
for (const [cls, [unip, neg]] of Object.entries(posixClasses)) if (glob.startsWith(cls, i)) {
|
|
6505
|
+
if (rangeStart) return [noMatch, glob.length - pos];
|
|
6525
6506
|
i += cls.length;
|
|
6526
6507
|
if (neg) negs.push(unip);
|
|
6527
6508
|
else ranges.push(unip);
|
|
6528
|
-
uflag = uflag || u;
|
|
6529
6509
|
continue WHILE;
|
|
6530
6510
|
}
|
|
6531
6511
|
}
|
|
6532
6512
|
escaping = false;
|
|
6513
|
+
const n = norm(c);
|
|
6533
6514
|
if (rangeStart) {
|
|
6534
|
-
if (
|
|
6535
|
-
else if (
|
|
6515
|
+
if (n.codePointAt(0) > rangeStart.codePointAt(0)) ranges.push(braceEscape(rangeStart) + "-" + braceEscape(n));
|
|
6516
|
+
else if (n === rangeStart) ranges.push(braceEscape(n));
|
|
6536
6517
|
rangeStart = "";
|
|
6537
|
-
i
|
|
6518
|
+
i += c.length;
|
|
6538
6519
|
continue;
|
|
6539
6520
|
}
|
|
6540
|
-
if (glob.startsWith("-]", i +
|
|
6541
|
-
ranges.push(braceEscape(
|
|
6542
|
-
i +=
|
|
6521
|
+
if (glob.startsWith("-]", i + c.length)) {
|
|
6522
|
+
ranges.push(braceEscape(n + "-"));
|
|
6523
|
+
i += c.length + 1;
|
|
6543
6524
|
continue;
|
|
6544
6525
|
}
|
|
6545
|
-
if (glob.startsWith("-", i +
|
|
6546
|
-
rangeStart =
|
|
6547
|
-
i +=
|
|
6526
|
+
if (glob.startsWith("-", i + c.length)) {
|
|
6527
|
+
rangeStart = n;
|
|
6528
|
+
i += c.length + 1;
|
|
6548
6529
|
continue;
|
|
6549
6530
|
}
|
|
6550
|
-
ranges.push(braceEscape(
|
|
6551
|
-
i
|
|
6531
|
+
ranges.push(braceEscape(n));
|
|
6532
|
+
i += c.length;
|
|
6552
6533
|
}
|
|
6553
|
-
if (endPos < i) return [
|
|
6554
|
-
|
|
6555
|
-
|
|
6556
|
-
|
|
6557
|
-
|
|
6558
|
-
];
|
|
6559
|
-
if (!ranges.length && !negs.length) return [
|
|
6560
|
-
"$.",
|
|
6561
|
-
false,
|
|
6562
|
-
glob.length - pos,
|
|
6563
|
-
true
|
|
6564
|
-
];
|
|
6565
|
-
if (negs.length === 0 && ranges.length === 1 && /^\\?.$/.test(ranges[0]) && !negate) return [
|
|
6566
|
-
regexpEscape(ranges[0].length === 2 ? ranges[0].slice(-1) : ranges[0]),
|
|
6567
|
-
false,
|
|
6568
|
-
endPos - pos,
|
|
6569
|
-
false
|
|
6570
|
-
];
|
|
6571
|
-
const sranges = "[" + (negate ? "^" : "") + rangesToString(ranges) + "]";
|
|
6572
|
-
const snegs = "[" + (negate ? "" : "^") + rangesToString(negs) + "]";
|
|
6573
|
-
return [
|
|
6574
|
-
ranges.length && negs.length ? "(" + sranges + "|" + snegs + ")" : ranges.length ? sranges : snegs,
|
|
6575
|
-
uflag,
|
|
6576
|
-
endPos - pos,
|
|
6577
|
-
true
|
|
6578
|
-
];
|
|
6534
|
+
if (endPos < i) return [noMatch, 0];
|
|
6535
|
+
if (!ranges.length && !negs.length) return [noMatch, glob.length - pos];
|
|
6536
|
+
const sranges = "[" + (negate ? "^" : "") + ranges.join("") + "]";
|
|
6537
|
+
const snegs = "[" + (negate ? "" : "^") + negs.join("") + "]";
|
|
6538
|
+
const comb = "^" + (ranges.length && negs.length ? "(" + sranges + "|" + snegs + ")" : ranges.length ? sranges : snegs);
|
|
6539
|
+
return [new RegExp(comb, nocase ? "iu" : "u"), endPos - pos];
|
|
6579
6540
|
};
|
|
6580
6541
|
exports.parseClass = parseClass;
|
|
6581
6542
|
}));
|
|
6582
6543
|
//#endregion
|
|
6583
|
-
//#region ../../node_modules/glob/
|
|
6584
|
-
var
|
|
6585
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6586
|
-
exports.unescape = void 0;
|
|
6587
|
-
/**
|
|
6588
|
-
* Un-escape a string that has been escaped with {@link escape}.
|
|
6589
|
-
*
|
|
6590
|
-
* If the {@link MinimatchOptions.windowsPathsNoEscape} option is used, then
|
|
6591
|
-
* square-bracket escapes are removed, but not backslash escapes.
|
|
6592
|
-
*
|
|
6593
|
-
* For example, it will turn the string `'[*]'` into `*`, but it will not
|
|
6594
|
-
* turn `'\\*'` into `'*'`, because `\` is a path separator in
|
|
6595
|
-
* `windowsPathsNoEscape` mode.
|
|
6596
|
-
*
|
|
6597
|
-
* When `windowsPathsNoEscape` is not set, then both square-bracket escapes and
|
|
6598
|
-
* backslash escapes are removed.
|
|
6599
|
-
*
|
|
6600
|
-
* Slashes (and backslashes in `windowsPathsNoEscape` mode) cannot be escaped
|
|
6601
|
-
* or unescaped.
|
|
6602
|
-
*
|
|
6603
|
-
* When `magicalBraces` is not set, escapes of braces (`{` and `}`) will not be
|
|
6604
|
-
* unescaped.
|
|
6605
|
-
*/
|
|
6606
|
-
const unescape = (s, { windowsPathsNoEscape = false, magicalBraces = true } = {}) => {
|
|
6607
|
-
if (magicalBraces) return windowsPathsNoEscape ? s.replace(/\[([^/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^/\\])\]/g, "$1$2").replace(/\\([^/])/g, "$1");
|
|
6608
|
-
return windowsPathsNoEscape ? s.replace(/\[([^/\\{}])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^/\\{}])\]/g, "$1$2").replace(/\\([^/{}])/g, "$1");
|
|
6609
|
-
};
|
|
6610
|
-
exports.unescape = unescape;
|
|
6611
|
-
}));
|
|
6612
|
-
//#endregion
|
|
6613
|
-
//#region ../../node_modules/glob/node_modules/minimatch/dist/commonjs/ast.js
|
|
6614
|
-
var require_ast$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
6615
|
-
var _a;
|
|
6544
|
+
//#region ../../node_modules/@isaacs/nonrecursive-glob-match/dist/commonjs/index.js
|
|
6545
|
+
var require_commonjs$5 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
6616
6546
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6617
|
-
exports.
|
|
6618
|
-
const
|
|
6619
|
-
const
|
|
6620
|
-
|
|
6621
|
-
|
|
6622
|
-
|
|
6623
|
-
|
|
6624
|
-
|
|
6625
|
-
"
|
|
6626
|
-
|
|
6627
|
-
|
|
6628
|
-
const
|
|
6629
|
-
const
|
|
6630
|
-
|
|
6631
|
-
|
|
6632
|
-
|
|
6633
|
-
|
|
6634
|
-
|
|
6635
|
-
|
|
6636
|
-
|
|
6637
|
-
|
|
6638
|
-
|
|
6639
|
-
|
|
6640
|
-
|
|
6641
|
-
|
|
6642
|
-
|
|
6643
|
-
|
|
6644
|
-
|
|
6645
|
-
|
|
6646
|
-
|
|
6647
|
-
|
|
6648
|
-
|
|
6649
|
-
|
|
6650
|
-
|
|
6651
|
-
|
|
6652
|
-
|
|
6653
|
-
"
|
|
6654
|
-
|
|
6655
|
-
|
|
6656
|
-
|
|
6657
|
-
|
|
6658
|
-
|
|
6659
|
-
|
|
6660
|
-
"
|
|
6661
|
-
|
|
6662
|
-
|
|
6663
|
-
|
|
6664
|
-
|
|
6665
|
-
|
|
6666
|
-
|
|
6667
|
-
|
|
6668
|
-
|
|
6669
|
-
|
|
6670
|
-
|
|
6671
|
-
[
|
|
6672
|
-
|
|
6673
|
-
|
|
6674
|
-
|
|
6675
|
-
|
|
6676
|
-
|
|
6677
|
-
|
|
6678
|
-
const justDots = new Set(["..", "."]);
|
|
6679
|
-
const reSpecials = /* @__PURE__ */ new Set("().*{}+?[]^$\\!");
|
|
6680
|
-
const regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
6681
|
-
const qmark = "[^/]";
|
|
6682
|
-
const star = qmark + "*?";
|
|
6683
|
-
const starNoEmpty = qmark + "+?";
|
|
6684
|
-
let ID = 0;
|
|
6685
|
-
var AST = class {
|
|
6686
|
-
type;
|
|
6687
|
-
#root;
|
|
6688
|
-
#hasMagic;
|
|
6689
|
-
#uflag = false;
|
|
6690
|
-
#parts = [];
|
|
6691
|
-
#parent;
|
|
6692
|
-
#parentIndex;
|
|
6693
|
-
#negs;
|
|
6694
|
-
#filledNegs = false;
|
|
6695
|
-
#options;
|
|
6696
|
-
#toString;
|
|
6697
|
-
#emptyExt = false;
|
|
6698
|
-
id = ++ID;
|
|
6699
|
-
get depth() {
|
|
6700
|
-
return (this.#parent?.depth ?? -1) + 1;
|
|
6701
|
-
}
|
|
6702
|
-
[Symbol.for("nodejs.util.inspect.custom")]() {
|
|
6703
|
-
return {
|
|
6704
|
-
"@@type": "AST",
|
|
6705
|
-
id: this.id,
|
|
6706
|
-
type: this.type,
|
|
6707
|
-
root: this.#root.id,
|
|
6708
|
-
parent: this.#parent?.id,
|
|
6709
|
-
depth: this.depth,
|
|
6710
|
-
partsLength: this.#parts.length,
|
|
6711
|
-
parts: this.#parts
|
|
6712
|
-
};
|
|
6713
|
-
}
|
|
6714
|
-
constructor(type, parent, options = {}) {
|
|
6715
|
-
this.type = type;
|
|
6716
|
-
if (type) this.#hasMagic = true;
|
|
6717
|
-
this.#parent = parent;
|
|
6718
|
-
this.#root = this.#parent ? this.#parent.#root : this;
|
|
6719
|
-
this.#options = this.#root === this ? options : this.#root.#options;
|
|
6720
|
-
this.#negs = this.#root === this ? [] : this.#root.#negs;
|
|
6721
|
-
if (type === "!" && !this.#root.#filledNegs) this.#negs.push(this);
|
|
6722
|
-
this.#parentIndex = this.#parent ? this.#parent.#parts.length : 0;
|
|
6723
|
-
}
|
|
6724
|
-
get hasMagic() {
|
|
6725
|
-
/* c8 ignore start */
|
|
6726
|
-
if (this.#hasMagic !== void 0) return this.#hasMagic;
|
|
6727
|
-
/* c8 ignore stop */
|
|
6728
|
-
for (const p of this.#parts) {
|
|
6729
|
-
if (typeof p === "string") continue;
|
|
6730
|
-
if (p.type || p.hasMagic) return this.#hasMagic = true;
|
|
6547
|
+
exports.Matcher = void 0;
|
|
6548
|
+
const parse_class_js_1 = require_parse_class();
|
|
6549
|
+
const MATCH = {
|
|
6550
|
+
t: "match",
|
|
6551
|
+
id: 0
|
|
6552
|
+
};
|
|
6553
|
+
const extTypes = "!?+*@";
|
|
6554
|
+
const lit = (ch) => ({
|
|
6555
|
+
t: "lit",
|
|
6556
|
+
ch
|
|
6557
|
+
});
|
|
6558
|
+
const reEscape = (s) => s.replace(/[\\^$.*+?()[\]{}|/]/g, "\\$&");
|
|
6559
|
+
const newFoldRe = (s) => new RegExp(`^${reEscape(s)}$`, "iu");
|
|
6560
|
+
const foldCache = /* @__PURE__ */ new Map();
|
|
6561
|
+
const foldRe = (ch) => {
|
|
6562
|
+
let re = foldCache.get(ch);
|
|
6563
|
+
if (!re) {
|
|
6564
|
+
re = newFoldRe(ch);
|
|
6565
|
+
if (foldCache.size >= 1e3) foldCache.clear();
|
|
6566
|
+
foldCache.set(ch, re);
|
|
6567
|
+
}
|
|
6568
|
+
return re;
|
|
6569
|
+
};
|
|
6570
|
+
const litMatch = (l, c) => {
|
|
6571
|
+
if (c === l.ch) return true;
|
|
6572
|
+
if (!l.re) return false;
|
|
6573
|
+
const code = c.charCodeAt(0);
|
|
6574
|
+
if (code >= 128) return l.re.test(c);
|
|
6575
|
+
const ascii = l.ascii ??= new Uint8Array(128);
|
|
6576
|
+
ascii[code] ||= l.re.test(c) ? 1 : 2;
|
|
6577
|
+
return ascii[code] === 1;
|
|
6578
|
+
};
|
|
6579
|
+
const tokenize = (p, nocase, noext, form) => {
|
|
6580
|
+
const toks = [];
|
|
6581
|
+
for (let i = 0; i < p.length;) {
|
|
6582
|
+
const c = String.fromCodePoint(p.codePointAt(i));
|
|
6583
|
+
if (c === "\\") {
|
|
6584
|
+
const e = p.codePointAt(i + 1);
|
|
6585
|
+
const ch = e === void 0 ? c : String.fromCodePoint(e);
|
|
6586
|
+
toks.push(lit(ch));
|
|
6587
|
+
i += 1 + ch.length;
|
|
6588
|
+
continue;
|
|
6589
|
+
}
|
|
6590
|
+
if (c === "[") {
|
|
6591
|
+
const [re, consumed] = (0, parse_class_js_1.parseClass)(p, i, nocase, form);
|
|
6592
|
+
if (consumed) {
|
|
6593
|
+
toks.push({
|
|
6594
|
+
t: "class",
|
|
6595
|
+
re
|
|
6596
|
+
});
|
|
6597
|
+
i += consumed;
|
|
6598
|
+
continue;
|
|
6599
|
+
}
|
|
6600
|
+
}
|
|
6601
|
+
if (!noext && extTypes.includes(c) && p[i + 1] === "(") {
|
|
6602
|
+
toks.push({
|
|
6603
|
+
t: "open",
|
|
6604
|
+
type: c
|
|
6605
|
+
});
|
|
6606
|
+
i += 2;
|
|
6607
|
+
continue;
|
|
6731
6608
|
}
|
|
6732
|
-
|
|
6609
|
+
toks.push(!noext && c === "|" ? { t: "bar" } : !noext && c === ")" ? { t: "close" } : c === "*" ? { t: "star" } : c === "?" ? { t: "any" } : lit(c));
|
|
6610
|
+
i += c.length;
|
|
6733
6611
|
}
|
|
6734
|
-
|
|
6735
|
-
|
|
6612
|
+
return toks;
|
|
6613
|
+
};
|
|
6614
|
+
const pair = (toks) => {
|
|
6615
|
+
const pairs = /* @__PURE__ */ new Map();
|
|
6616
|
+
const stack = [];
|
|
6617
|
+
toks.forEach((tok, i) => {
|
|
6618
|
+
if (tok.t === "open") stack.push(i);
|
|
6619
|
+
else if (tok.t === "close" && stack.length) pairs.set(stack.pop(), i);
|
|
6620
|
+
});
|
|
6621
|
+
return pairs;
|
|
6622
|
+
};
|
|
6623
|
+
const build = (toks, pairs, start, end, top) => {
|
|
6624
|
+
let seq = [];
|
|
6625
|
+
const alts = [seq];
|
|
6626
|
+
for (let i = start; i < end; i++) {
|
|
6627
|
+
const tok = toks[i];
|
|
6628
|
+
const close = pairs.get(i);
|
|
6629
|
+
if (tok.t === "open" && close !== void 0) {
|
|
6630
|
+
const sub = build(toks, pairs, i + 1, close, false);
|
|
6631
|
+
seq.push({
|
|
6632
|
+
t: "ext",
|
|
6633
|
+
type: tok.type,
|
|
6634
|
+
alts: sub
|
|
6635
|
+
});
|
|
6636
|
+
i = close;
|
|
6637
|
+
} else if (tok.t === "bar" && !top) alts.push(seq = []);
|
|
6638
|
+
else if (tok.t === "open") seq.push(lit(tok.type), lit("("));
|
|
6639
|
+
else if (tok.t === "bar") seq.push(lit("|"));
|
|
6640
|
+
else if (tok.t === "close") seq.push(lit(")"));
|
|
6641
|
+
else seq.push(tok);
|
|
6736
6642
|
}
|
|
6737
|
-
|
|
6738
|
-
|
|
6739
|
-
|
|
6740
|
-
|
|
6741
|
-
|
|
6742
|
-
|
|
6743
|
-
|
|
6744
|
-
|
|
6745
|
-
|
|
6746
|
-
|
|
6747
|
-
|
|
6748
|
-
|
|
6749
|
-
|
|
6750
|
-
for (let i = p.#parentIndex + 1; !pp.type && i < pp.#parts.length; i++) for (const part of n.#parts) {
|
|
6751
|
-
/* c8 ignore start */
|
|
6752
|
-
if (typeof part === "string") throw new Error("string part in extglob AST??");
|
|
6753
|
-
/* c8 ignore stop */
|
|
6754
|
-
part.copyIn(pp.#parts[i]);
|
|
6755
|
-
}
|
|
6756
|
-
p = pp;
|
|
6757
|
-
pp = p.#parent;
|
|
6758
|
-
}
|
|
6643
|
+
return alts;
|
|
6644
|
+
};
|
|
6645
|
+
const normalize = (items, form) => {
|
|
6646
|
+
const out = [];
|
|
6647
|
+
let run = "";
|
|
6648
|
+
const flush = () => {
|
|
6649
|
+
for (const ch of run.normalize(form)) out.push(lit(ch));
|
|
6650
|
+
run = "";
|
|
6651
|
+
};
|
|
6652
|
+
for (const it of items) {
|
|
6653
|
+
if (it.t === "lit") {
|
|
6654
|
+
run += it.ch;
|
|
6655
|
+
continue;
|
|
6759
6656
|
}
|
|
6760
|
-
|
|
6657
|
+
flush();
|
|
6658
|
+
out.push(it.t === "ext" ? {
|
|
6659
|
+
...it,
|
|
6660
|
+
alts: it.alts.map((a) => normalize(a, form))
|
|
6661
|
+
} : it);
|
|
6761
6662
|
}
|
|
6762
|
-
|
|
6763
|
-
|
|
6764
|
-
|
|
6765
|
-
|
|
6766
|
-
|
|
6767
|
-
|
|
6768
|
-
|
|
6663
|
+
flush();
|
|
6664
|
+
return out;
|
|
6665
|
+
};
|
|
6666
|
+
const compile = (items, nocase) => {
|
|
6667
|
+
let id = 1;
|
|
6668
|
+
const split = (out) => ({
|
|
6669
|
+
t: "split",
|
|
6670
|
+
id: id++,
|
|
6671
|
+
out
|
|
6672
|
+
});
|
|
6673
|
+
const seq = (items, next) => items.reduceRight((next, it) => item(it, next), next);
|
|
6674
|
+
const item = (it, next) => {
|
|
6675
|
+
switch (it.t) {
|
|
6676
|
+
case "lit":
|
|
6677
|
+
const re = nocase ? foldRe(it.ch) : void 0;
|
|
6678
|
+
return {
|
|
6679
|
+
t: "lit",
|
|
6680
|
+
id: id++,
|
|
6681
|
+
ch: it.ch,
|
|
6682
|
+
re,
|
|
6683
|
+
next
|
|
6684
|
+
};
|
|
6685
|
+
case "any":
|
|
6686
|
+
case "star": return {
|
|
6687
|
+
t: it.t,
|
|
6688
|
+
id: id++,
|
|
6689
|
+
next
|
|
6690
|
+
};
|
|
6691
|
+
case "class": return {
|
|
6692
|
+
t: "class",
|
|
6693
|
+
id: id++,
|
|
6694
|
+
re: it.re,
|
|
6695
|
+
next
|
|
6696
|
+
};
|
|
6697
|
+
}
|
|
6698
|
+
const alts = (next) => it.alts.map((a) => seq(a, next));
|
|
6699
|
+
switch (it.type) {
|
|
6700
|
+
case "@": return split(alts(next));
|
|
6701
|
+
case "?": return split([next, ...alts(next)]);
|
|
6702
|
+
case "!": return {
|
|
6703
|
+
t: "neg",
|
|
6704
|
+
id: id++,
|
|
6705
|
+
sub: split(alts(MATCH)),
|
|
6706
|
+
next
|
|
6707
|
+
};
|
|
6769
6708
|
}
|
|
6709
|
+
const after = split([]);
|
|
6710
|
+
const entry = split(alts(after));
|
|
6711
|
+
after.out.push(next, entry);
|
|
6712
|
+
return it.type === "*" ? after : entry;
|
|
6713
|
+
};
|
|
6714
|
+
return [seq(items, MATCH), id];
|
|
6715
|
+
};
|
|
6716
|
+
const show = (start) => {
|
|
6717
|
+
const lines = [];
|
|
6718
|
+
const seen = /* @__PURE__ */ new Set();
|
|
6719
|
+
const ref = (n) => n.t === "match" ? "match" : String(n.id);
|
|
6720
|
+
const walk = (n, indent) => {
|
|
6721
|
+
if (n.t === "match" || seen.has(n)) return;
|
|
6722
|
+
seen.add(n);
|
|
6723
|
+
const line = (desc) => lines.push(`${indent}${n.id}: ${desc}`);
|
|
6724
|
+
switch (n.t) {
|
|
6725
|
+
case "split":
|
|
6726
|
+
line(`split -> ${n.out.map(ref).join(", ")}`);
|
|
6727
|
+
for (const o of n.out) walk(o, indent);
|
|
6728
|
+
return;
|
|
6729
|
+
case "neg":
|
|
6730
|
+
line(`!(${ref(n.sub)}) -> ${ref(n.next)}`);
|
|
6731
|
+
walk(n.sub, indent + " ");
|
|
6732
|
+
return walk(n.next, indent);
|
|
6733
|
+
case "lit":
|
|
6734
|
+
line(`${JSON.stringify(n.ch)} -> ${ref(n.next)}`);
|
|
6735
|
+
break;
|
|
6736
|
+
case "class":
|
|
6737
|
+
line(`${n.re} -> ${ref(n.next)}`);
|
|
6738
|
+
break;
|
|
6739
|
+
default: line(`${n.t === "any" ? "?" : "*"} -> ${ref(n.next)}`);
|
|
6740
|
+
}
|
|
6741
|
+
walk(n.next, indent);
|
|
6742
|
+
};
|
|
6743
|
+
walk(start, "");
|
|
6744
|
+
return [`start -> ${ref(start)}`, ...lines].join("\n");
|
|
6745
|
+
};
|
|
6746
|
+
var State = class {
|
|
6747
|
+
gen;
|
|
6748
|
+
threads = [];
|
|
6749
|
+
match = false;
|
|
6750
|
+
runs = [];
|
|
6751
|
+
ids = [];
|
|
6752
|
+
constructor(gen) {
|
|
6753
|
+
this.gen = gen;
|
|
6754
|
+
}
|
|
6755
|
+
get dead() {
|
|
6756
|
+
return !this.threads.length && !this.match && !this.runs.length;
|
|
6757
|
+
}
|
|
6758
|
+
};
|
|
6759
|
+
const sameState = (a, b) => {
|
|
6760
|
+
if (a.ids.length !== b.ids.length) return false;
|
|
6761
|
+
if (a.runs.length !== b.runs.length) return false;
|
|
6762
|
+
if (a.ids.some((id, i) => id !== b.ids[i])) return false;
|
|
6763
|
+
return a.runs.every((r) => b.runs.some((o) => o.neg === r.neg && sameState(o.state, r.state)));
|
|
6764
|
+
};
|
|
6765
|
+
const marks = (size) => ({
|
|
6766
|
+
has: new Float64Array(size),
|
|
6767
|
+
seen: new Float64Array(size),
|
|
6768
|
+
gen: 0
|
|
6769
|
+
});
|
|
6770
|
+
var Sim = class {
|
|
6771
|
+
dots;
|
|
6772
|
+
dotStart;
|
|
6773
|
+
#marks;
|
|
6774
|
+
constructor(dots, dotStart, marks) {
|
|
6775
|
+
this.dots = dots;
|
|
6776
|
+
this.dotStart = dotStart;
|
|
6777
|
+
this.#marks = marks;
|
|
6778
|
+
}
|
|
6779
|
+
state() {
|
|
6780
|
+
return new State(++this.#marks.gen);
|
|
6781
|
+
}
|
|
6782
|
+
done(state) {
|
|
6783
|
+
state.ids = state.threads.map((n) => n.id).sort((a, b) => a - b);
|
|
6784
|
+
if (state.match) state.ids.unshift(MATCH.id);
|
|
6785
|
+
return state;
|
|
6770
6786
|
}
|
|
6771
|
-
|
|
6772
|
-
const
|
|
6773
|
-
if (
|
|
6774
|
-
|
|
6775
|
-
return
|
|
6787
|
+
#visit(state, node) {
|
|
6788
|
+
const { seen } = this.#marks;
|
|
6789
|
+
if (seen[node.id] === state.gen) return false;
|
|
6790
|
+
seen[node.id] = state.gen;
|
|
6791
|
+
return true;
|
|
6776
6792
|
}
|
|
6777
|
-
|
|
6778
|
-
|
|
6779
|
-
if (
|
|
6780
|
-
|
|
6781
|
-
|
|
6782
|
-
for (let i = 0; i < this.#parentIndex; i++) {
|
|
6783
|
-
const pp = p.#parts[i];
|
|
6784
|
-
if (!(pp instanceof _a && pp.type === "!")) return false;
|
|
6785
|
-
}
|
|
6793
|
+
#addThread(state, node) {
|
|
6794
|
+
const { has } = this.#marks;
|
|
6795
|
+
if (has[node.id] === state.gen) return false;
|
|
6796
|
+
has[node.id] = state.gen;
|
|
6797
|
+
state.threads.push(node);
|
|
6786
6798
|
return true;
|
|
6787
6799
|
}
|
|
6788
|
-
|
|
6789
|
-
|
|
6790
|
-
|
|
6791
|
-
|
|
6792
|
-
|
|
6793
|
-
|
|
6794
|
-
|
|
6795
|
-
|
|
6796
|
-
|
|
6797
|
-
|
|
6798
|
-
|
|
6799
|
-
|
|
6800
|
-
|
|
6801
|
-
|
|
6802
|
-
|
|
6803
|
-
|
|
6804
|
-
|
|
6805
|
-
|
|
6806
|
-
|
|
6807
|
-
|
|
6808
|
-
|
|
6809
|
-
|
|
6810
|
-
|
|
6811
|
-
|
|
6812
|
-
|
|
6813
|
-
|
|
6814
|
-
|
|
6815
|
-
let acc = "";
|
|
6816
|
-
while (i < str.length) {
|
|
6817
|
-
const c = str.charAt(i++);
|
|
6818
|
-
if (escaping || c === "\\") {
|
|
6819
|
-
escaping = !escaping;
|
|
6820
|
-
acc += c;
|
|
6821
|
-
continue;
|
|
6822
|
-
}
|
|
6823
|
-
if (inBrace) {
|
|
6824
|
-
if (i === braceStart + 1) {
|
|
6825
|
-
if (c === "^" || c === "!") braceNeg = true;
|
|
6826
|
-
} else if (c === "]" && !(i === braceStart + 2 && braceNeg)) inBrace = false;
|
|
6827
|
-
acc += c;
|
|
6828
|
-
continue;
|
|
6829
|
-
} else if (c === "[") {
|
|
6830
|
-
inBrace = true;
|
|
6831
|
-
braceStart = i;
|
|
6832
|
-
braceNeg = false;
|
|
6833
|
-
acc += c;
|
|
6834
|
-
continue;
|
|
6835
|
-
}
|
|
6836
|
-
if (!opt.noext && isExtglobType(c) && str.charAt(i) === "(" && extDepth <= maxDepth) {
|
|
6837
|
-
ast.push(acc);
|
|
6838
|
-
acc = "";
|
|
6839
|
-
const ext = new _a(c, ast);
|
|
6840
|
-
i = _a.#parseAST(str, ext, i, opt, extDepth + 1);
|
|
6841
|
-
ast.push(ext);
|
|
6842
|
-
continue;
|
|
6843
|
-
}
|
|
6844
|
-
acc += c;
|
|
6845
|
-
}
|
|
6846
|
-
ast.push(acc);
|
|
6847
|
-
return i;
|
|
6848
|
-
}
|
|
6849
|
-
let i = pos + 1;
|
|
6850
|
-
let part = new _a(null, ast);
|
|
6851
|
-
const parts = [];
|
|
6852
|
-
let acc = "";
|
|
6853
|
-
while (i < str.length) {
|
|
6854
|
-
const c = str.charAt(i++);
|
|
6855
|
-
if (escaping || c === "\\") {
|
|
6856
|
-
escaping = !escaping;
|
|
6857
|
-
acc += c;
|
|
6858
|
-
continue;
|
|
6859
|
-
}
|
|
6860
|
-
if (inBrace) {
|
|
6861
|
-
if (i === braceStart + 1) {
|
|
6862
|
-
if (c === "^" || c === "!") braceNeg = true;
|
|
6863
|
-
} else if (c === "]" && !(i === braceStart + 2 && braceNeg)) inBrace = false;
|
|
6864
|
-
acc += c;
|
|
6865
|
-
continue;
|
|
6866
|
-
} else if (c === "[") {
|
|
6867
|
-
inBrace = true;
|
|
6868
|
-
braceStart = i;
|
|
6869
|
-
braceNeg = false;
|
|
6870
|
-
acc += c;
|
|
6871
|
-
continue;
|
|
6872
|
-
}
|
|
6873
|
-
/* c8 ignore stop */
|
|
6874
|
-
if (!opt.noext && isExtglobType(c) && str.charAt(i) === "(" && (extDepth <= maxDepth || ast && ast.#canAdoptType(c))) {
|
|
6875
|
-
const depthAdd = ast && ast.#canAdoptType(c) ? 0 : 1;
|
|
6876
|
-
part.push(acc);
|
|
6877
|
-
acc = "";
|
|
6878
|
-
const ext = new _a(c, part);
|
|
6879
|
-
part.push(ext);
|
|
6880
|
-
i = _a.#parseAST(str, ext, i, opt, extDepth + depthAdd);
|
|
6881
|
-
continue;
|
|
6882
|
-
}
|
|
6883
|
-
if (c === "|") {
|
|
6884
|
-
part.push(acc);
|
|
6885
|
-
acc = "";
|
|
6886
|
-
parts.push(part);
|
|
6887
|
-
part = new _a(null, ast);
|
|
6888
|
-
continue;
|
|
6889
|
-
}
|
|
6890
|
-
if (c === ")") {
|
|
6891
|
-
if (acc === "" && ast.#parts.length === 0) ast.#emptyExt = true;
|
|
6892
|
-
part.push(acc);
|
|
6893
|
-
acc = "";
|
|
6894
|
-
ast.push(...parts, part);
|
|
6895
|
-
return i;
|
|
6896
|
-
}
|
|
6897
|
-
acc += c;
|
|
6800
|
+
restricted(i, top) {
|
|
6801
|
+
return top && (this.dots || this.dotStart && i === 0);
|
|
6802
|
+
}
|
|
6803
|
+
add(state, node, i, top) {
|
|
6804
|
+
switch (node.t) {
|
|
6805
|
+
case "split":
|
|
6806
|
+
if (!this.#visit(state, node)) return;
|
|
6807
|
+
for (const o of node.out) this.add(state, o, i, top);
|
|
6808
|
+
return;
|
|
6809
|
+
case "neg":
|
|
6810
|
+
if (!this.#visit(state, node)) return;
|
|
6811
|
+
const sub = this.state();
|
|
6812
|
+
this.add(sub, node.sub, i, false);
|
|
6813
|
+
this.done(sub);
|
|
6814
|
+
return this.addRun(state, {
|
|
6815
|
+
t: "run",
|
|
6816
|
+
neg: node,
|
|
6817
|
+
state: sub
|
|
6818
|
+
}, i, top);
|
|
6819
|
+
case "star":
|
|
6820
|
+
if (this.restricted(i, top)) return;
|
|
6821
|
+
if (this.#addThread(state, node)) this.add(state, node.next, i, top);
|
|
6822
|
+
return;
|
|
6823
|
+
case "match":
|
|
6824
|
+
state.match = true;
|
|
6825
|
+
return;
|
|
6826
|
+
default: this.#addThread(state, node);
|
|
6898
6827
|
}
|
|
6899
|
-
ast.type = null;
|
|
6900
|
-
ast.#hasMagic = void 0;
|
|
6901
|
-
ast.#parts = [str.substring(pos - 1)];
|
|
6902
|
-
return i;
|
|
6903
6828
|
}
|
|
6904
|
-
|
|
6905
|
-
|
|
6906
|
-
|
|
6907
|
-
|
|
6908
|
-
if (!child || typeof child !== "object" || child.type !== null || child.#parts.length !== 1 || this.type === null) return false;
|
|
6909
|
-
const gc = child.#parts[0];
|
|
6910
|
-
if (!gc || typeof gc !== "object" || gc.type === null) return false;
|
|
6911
|
-
return this.#canAdoptType(gc.type, map);
|
|
6912
|
-
}
|
|
6913
|
-
#canAdoptType(c, map = adoptionAnyMap) {
|
|
6914
|
-
return !!map.get(this.type)?.includes(c);
|
|
6915
|
-
}
|
|
6916
|
-
#adoptWithSpace(child, index) {
|
|
6917
|
-
const gc = child.#parts[0];
|
|
6918
|
-
const blank = new _a(null, gc, this.options);
|
|
6919
|
-
blank.#parts.push("");
|
|
6920
|
-
gc.push(blank);
|
|
6921
|
-
this.#adopt(child, index);
|
|
6922
|
-
}
|
|
6923
|
-
#adopt(child, index) {
|
|
6924
|
-
const gc = child.#parts[0];
|
|
6925
|
-
this.#parts.splice(index, 1, ...gc.#parts);
|
|
6926
|
-
for (const p of gc.#parts) if (typeof p === "object") p.#parent = this;
|
|
6927
|
-
this.#toString = void 0;
|
|
6928
|
-
}
|
|
6929
|
-
#canUsurpType(c) {
|
|
6930
|
-
return !!usurpMap.get(this.type)?.has(c);
|
|
6931
|
-
}
|
|
6932
|
-
#canUsurp(child) {
|
|
6933
|
-
if (!child || typeof child !== "object" || child.type !== null || child.#parts.length !== 1 || this.type === null || this.#parts.length !== 1) return false;
|
|
6934
|
-
const gc = child.#parts[0];
|
|
6935
|
-
if (!gc || typeof gc !== "object" || gc.type === null) return false;
|
|
6936
|
-
return this.#canUsurpType(gc.type);
|
|
6937
|
-
}
|
|
6938
|
-
#usurp(child) {
|
|
6939
|
-
const m = usurpMap.get(this.type);
|
|
6940
|
-
const gc = child.#parts[0];
|
|
6941
|
-
const nt = m?.get(gc.type);
|
|
6942
|
-
/* c8 ignore start - impossible */
|
|
6943
|
-
if (!nt) return false;
|
|
6944
|
-
/* c8 ignore stop */
|
|
6945
|
-
this.#parts = gc.#parts;
|
|
6946
|
-
for (const p of this.#parts) if (typeof p === "object") p.#parent = this;
|
|
6947
|
-
this.type = nt;
|
|
6948
|
-
this.#toString = void 0;
|
|
6949
|
-
this.#emptyExt = false;
|
|
6950
|
-
}
|
|
6951
|
-
static fromGlob(pattern, options = {}) {
|
|
6952
|
-
const ast = new _a(null, void 0, options);
|
|
6953
|
-
_a.#parseAST(pattern, ast, 0, options, 0);
|
|
6954
|
-
return ast;
|
|
6955
|
-
}
|
|
6956
|
-
toMMPattern() {
|
|
6957
|
-
/* c8 ignore start */
|
|
6958
|
-
if (this !== this.#root) return this.#root.toMMPattern();
|
|
6959
|
-
/* c8 ignore stop */
|
|
6960
|
-
const glob = this.toString();
|
|
6961
|
-
const [re, body, hasMagic, uflag] = this.toRegExpSource();
|
|
6962
|
-
if (!(hasMagic || this.#hasMagic || this.#options.nocase && !this.#options.nocaseMagicOnly && glob.toUpperCase() !== glob.toLowerCase())) return body;
|
|
6963
|
-
const flags = (this.#options.nocase ? "i" : "") + (uflag ? "u" : "");
|
|
6964
|
-
return Object.assign(new RegExp(`^${re}$`, flags), {
|
|
6965
|
-
_src: re,
|
|
6966
|
-
_glob: glob
|
|
6967
|
-
});
|
|
6829
|
+
addRun(state, run, i, top) {
|
|
6830
|
+
for (const r of state.runs) if (r.neg === run.neg && sameState(r.state, run.state)) return;
|
|
6831
|
+
state.runs.push(run);
|
|
6832
|
+
if (!run.state.match) this.add(state, run.neg.next, i, top);
|
|
6968
6833
|
}
|
|
6969
|
-
|
|
6970
|
-
|
|
6971
|
-
|
|
6972
|
-
|
|
6973
|
-
|
|
6974
|
-
|
|
6975
|
-
|
|
6976
|
-
|
|
6977
|
-
|
|
6978
|
-
|
|
6979
|
-
|
|
6980
|
-
|
|
6981
|
-
|
|
6982
|
-
this.#hasMagic = this.#hasMagic || hasMagic;
|
|
6983
|
-
this.#uflag = this.#uflag || uflag;
|
|
6984
|
-
return re;
|
|
6985
|
-
}).join("");
|
|
6986
|
-
let start = "";
|
|
6987
|
-
if (this.isStart()) {
|
|
6988
|
-
if (typeof this.#parts[0] === "string") {
|
|
6989
|
-
if (!(this.#parts.length === 1 && justDots.has(this.#parts[0]))) {
|
|
6990
|
-
const aps = addPatternStart;
|
|
6991
|
-
const needNoTrav = dot && aps.has(src.charAt(0)) || src.startsWith("\\.") && aps.has(src.charAt(2)) || src.startsWith("\\.\\.") && aps.has(src.charAt(4));
|
|
6992
|
-
const needNoDot = !dot && !allowDot && aps.has(src.charAt(0));
|
|
6993
|
-
start = needNoTrav ? startNoTraversal : needNoDot ? startNoDot : "";
|
|
6994
|
-
}
|
|
6995
|
-
}
|
|
6996
|
-
}
|
|
6997
|
-
let end = "";
|
|
6998
|
-
if (this.isEnd() && this.#root.#filledNegs && this.#parent?.type === "!") end = "(?:$|\\/)";
|
|
6999
|
-
return [
|
|
7000
|
-
start + src + end,
|
|
7001
|
-
(0, unescape_js_1.unescape)(src),
|
|
7002
|
-
this.#hasMagic = !!this.#hasMagic,
|
|
7003
|
-
this.#uflag
|
|
7004
|
-
];
|
|
7005
|
-
}
|
|
7006
|
-
const repeated = this.type === "*" || this.type === "+";
|
|
7007
|
-
const start = this.type === "!" ? "(?:(?!(?:" : "(?:";
|
|
7008
|
-
let body = this.#partsToRegExp(dot);
|
|
7009
|
-
if (this.isStart() && this.isEnd() && !body && this.type !== "!") {
|
|
7010
|
-
const s = this.toString();
|
|
7011
|
-
const me = this;
|
|
7012
|
-
me.#parts = [s];
|
|
7013
|
-
me.type = null;
|
|
7014
|
-
me.#hasMagic = void 0;
|
|
7015
|
-
return [
|
|
7016
|
-
s,
|
|
7017
|
-
(0, unescape_js_1.unescape)(this.toString()),
|
|
7018
|
-
false,
|
|
7019
|
-
false
|
|
7020
|
-
];
|
|
6834
|
+
step(state, c, i, top) {
|
|
6835
|
+
const next = this.state();
|
|
6836
|
+
for (const th of state.threads) switch (th.t) {
|
|
6837
|
+
case "lit":
|
|
6838
|
+
if (litMatch(th, c)) this.add(next, th.next, i + 1, top);
|
|
6839
|
+
break;
|
|
6840
|
+
case "any":
|
|
6841
|
+
if (!this.restricted(i, top)) this.add(next, th.next, i + 1, top);
|
|
6842
|
+
break;
|
|
6843
|
+
case "class":
|
|
6844
|
+
if (!this.restricted(i, top) && th.re.test(c)) this.add(next, th.next, i + 1, top);
|
|
6845
|
+
break;
|
|
6846
|
+
case "star": if (!this.restricted(i, top)) this.add(next, th, i + 1, top);
|
|
7021
6847
|
}
|
|
7022
|
-
|
|
7023
|
-
|
|
7024
|
-
|
|
7025
|
-
|
|
7026
|
-
|
|
7027
|
-
|
|
7028
|
-
|
|
7029
|
-
|
|
6848
|
+
if (!this.restricted(i, top)) for (const run of state.runs) {
|
|
6849
|
+
if (run.state.dead) {
|
|
6850
|
+
this.addRun(next, run, i + 1, top);
|
|
6851
|
+
continue;
|
|
6852
|
+
}
|
|
6853
|
+
const sub = this.step(run.state, c, i, false);
|
|
6854
|
+
this.addRun(next, {
|
|
6855
|
+
t: "run",
|
|
6856
|
+
neg: run.neg,
|
|
6857
|
+
state: sub
|
|
6858
|
+
}, i + 1, top);
|
|
7030
6859
|
}
|
|
7031
|
-
return
|
|
7032
|
-
final,
|
|
7033
|
-
(0, unescape_js_1.unescape)(body),
|
|
7034
|
-
this.#hasMagic = !!this.#hasMagic,
|
|
7035
|
-
this.#uflag
|
|
7036
|
-
];
|
|
6860
|
+
return this.done(next);
|
|
7037
6861
|
}
|
|
7038
|
-
|
|
7039
|
-
|
|
7040
|
-
|
|
7041
|
-
|
|
7042
|
-
|
|
7043
|
-
|
|
7044
|
-
|
|
7045
|
-
|
|
7046
|
-
|
|
7047
|
-
|
|
7048
|
-
|
|
7049
|
-
|
|
7050
|
-
|
|
7051
|
-
|
|
7052
|
-
|
|
7053
|
-
|
|
7054
|
-
|
|
7055
|
-
|
|
7056
|
-
|
|
7057
|
-
|
|
7058
|
-
|
|
7059
|
-
|
|
7060
|
-
|
|
7061
|
-
|
|
7062
|
-
|
|
7063
|
-
|
|
7064
|
-
|
|
6862
|
+
};
|
|
6863
|
+
const stateKey = (state) => {
|
|
6864
|
+
const ids = state.ids.join();
|
|
6865
|
+
if (!state.runs.length) return ids;
|
|
6866
|
+
return `${ids}|${state.runs.map((r) => `${r.neg.id}(${stateKey(r.state)})`).sort().join("|")}`;
|
|
6867
|
+
};
|
|
6868
|
+
const DFA_BUDGET = 1 << 18;
|
|
6869
|
+
var Dfa = class {
|
|
6870
|
+
#start;
|
|
6871
|
+
#states = /* @__PURE__ */ new Map();
|
|
6872
|
+
#size = 0;
|
|
6873
|
+
#plain;
|
|
6874
|
+
#dotStart;
|
|
6875
|
+
#sim;
|
|
6876
|
+
#dotSim;
|
|
6877
|
+
constructor(start, marks) {
|
|
6878
|
+
this.#start = start;
|
|
6879
|
+
this.#sim = new Sim(false, false, marks);
|
|
6880
|
+
this.#dotSim = new Sim(false, true, marks);
|
|
6881
|
+
}
|
|
6882
|
+
#make(state) {
|
|
6883
|
+
return {
|
|
6884
|
+
state,
|
|
6885
|
+
match: state.match,
|
|
6886
|
+
dead: state.dead,
|
|
6887
|
+
next: /* @__PURE__ */ new Map()
|
|
6888
|
+
};
|
|
7065
6889
|
}
|
|
7066
|
-
#
|
|
7067
|
-
|
|
7068
|
-
|
|
7069
|
-
|
|
7070
|
-
|
|
7071
|
-
|
|
7072
|
-
|
|
7073
|
-
|
|
7074
|
-
|
|
7075
|
-
}
|
|
7076
|
-
|
|
7077
|
-
|
|
7078
|
-
|
|
7079
|
-
|
|
7080
|
-
|
|
7081
|
-
|
|
7082
|
-
|
|
7083
|
-
|
|
7084
|
-
|
|
7085
|
-
|
|
7086
|
-
|
|
7087
|
-
|
|
7088
|
-
|
|
7089
|
-
|
|
7090
|
-
|
|
7091
|
-
|
|
7092
|
-
|
|
7093
|
-
|
|
7094
|
-
|
|
7095
|
-
|
|
7096
|
-
|
|
7097
|
-
|
|
7098
|
-
|
|
7099
|
-
|
|
7100
|
-
if (
|
|
7101
|
-
|
|
7102
|
-
|
|
7103
|
-
|
|
7104
|
-
|
|
7105
|
-
|
|
7106
|
-
|
|
7107
|
-
|
|
7108
|
-
|
|
7109
|
-
|
|
7110
|
-
|
|
7111
|
-
|
|
7112
|
-
|
|
7113
|
-
|
|
7114
|
-
|
|
7115
|
-
|
|
6890
|
+
#intern(state) {
|
|
6891
|
+
const key = stateKey(state);
|
|
6892
|
+
const found = this.#states.get(key);
|
|
6893
|
+
if (found) return found;
|
|
6894
|
+
if (this.#size > DFA_BUDGET) this.#clear();
|
|
6895
|
+
const d = this.#make(state);
|
|
6896
|
+
this.#states.set(key, d);
|
|
6897
|
+
this.#size += key.length + 1;
|
|
6898
|
+
return d;
|
|
6899
|
+
}
|
|
6900
|
+
#clear() {
|
|
6901
|
+
this.#states.clear();
|
|
6902
|
+
this.#size = 0;
|
|
6903
|
+
this.#plain = void 0;
|
|
6904
|
+
this.#dotStart = void 0;
|
|
6905
|
+
}
|
|
6906
|
+
start(dotStart) {
|
|
6907
|
+
if (dotStart) {
|
|
6908
|
+
if (this.#dotStart) return this.#dotStart;
|
|
6909
|
+
const state = this.#dotSim.state();
|
|
6910
|
+
this.#dotSim.add(state, this.#start, 0, true);
|
|
6911
|
+
return this.#dotStart = this.#make(this.#dotSim.done(state));
|
|
6912
|
+
}
|
|
6913
|
+
if (this.#plain) return this.#plain;
|
|
6914
|
+
const state = this.#sim.state();
|
|
6915
|
+
this.#sim.add(state, this.#start, 0, true);
|
|
6916
|
+
return this.#plain = this.#intern(this.#sim.done(state));
|
|
6917
|
+
}
|
|
6918
|
+
next(d, c) {
|
|
6919
|
+
const code = c.charCodeAt(0);
|
|
6920
|
+
const found = code < 128 ? void 0 : d.next.get(c);
|
|
6921
|
+
if (found) return found;
|
|
6922
|
+
const n = d === this.#dotStart ? this.#intern(this.#dotSim.step(d.state, c, 0, true)) : this.#intern(this.#sim.step(d.state, c, 1, true));
|
|
6923
|
+
if (code < 128) {
|
|
6924
|
+
if (!d.ascii) {
|
|
6925
|
+
d.ascii = new Array(128);
|
|
6926
|
+
this.#size += 128;
|
|
6927
|
+
}
|
|
6928
|
+
d.ascii[code] = n;
|
|
6929
|
+
} else d.next.set(c, n);
|
|
6930
|
+
this.#size++;
|
|
6931
|
+
return n;
|
|
6932
|
+
}
|
|
6933
|
+
};
|
|
6934
|
+
const linear = (start) => {
|
|
6935
|
+
const nodes = [];
|
|
6936
|
+
for (let n = start; n.t !== "match"; n = n.next) {
|
|
6937
|
+
if (n.t === "split" || n.t === "neg") return void 0;
|
|
6938
|
+
nodes.push(n);
|
|
6939
|
+
}
|
|
6940
|
+
return nodes;
|
|
6941
|
+
};
|
|
6942
|
+
const testLinear = (nodes, chars, start, end) => {
|
|
6943
|
+
let ni = 0;
|
|
6944
|
+
let ci = start;
|
|
6945
|
+
let starNi = -1;
|
|
6946
|
+
let starCi = 0;
|
|
6947
|
+
while (ci < end) {
|
|
6948
|
+
const n = nodes[ni];
|
|
6949
|
+
if (n?.t === "star") {
|
|
6950
|
+
starNi = ni++;
|
|
6951
|
+
starCi = ci;
|
|
6952
|
+
continue;
|
|
7116
6953
|
}
|
|
7117
|
-
|
|
7118
|
-
|
|
7119
|
-
|
|
7120
|
-
|
|
7121
|
-
|
|
7122
|
-
|
|
6954
|
+
const c = chars[ci];
|
|
6955
|
+
if (n && (n.t === "any" || n.t === "lit" && litMatch(n, c) || n.t === "class" && n.re.test(c))) {
|
|
6956
|
+
ni++;
|
|
6957
|
+
ci++;
|
|
6958
|
+
continue;
|
|
6959
|
+
}
|
|
6960
|
+
if (starNi === -1) return false;
|
|
6961
|
+
ni = starNi + 1;
|
|
6962
|
+
ci = ++starCi;
|
|
6963
|
+
}
|
|
6964
|
+
while (nodes[ni]?.t === "star") ni++;
|
|
6965
|
+
return ni === nodes.length;
|
|
6966
|
+
};
|
|
6967
|
+
const lengths = (items) => {
|
|
6968
|
+
let min = 0;
|
|
6969
|
+
let max = 0;
|
|
6970
|
+
for (const it of items) {
|
|
6971
|
+
const [lo, hi] = itemLengths(it);
|
|
6972
|
+
min += lo;
|
|
6973
|
+
max += hi;
|
|
6974
|
+
}
|
|
6975
|
+
return [min, max];
|
|
6976
|
+
};
|
|
6977
|
+
const itemLengths = (it) => {
|
|
6978
|
+
if (it.t === "star") return [0, Infinity];
|
|
6979
|
+
if (it.t !== "ext") return [1, 1];
|
|
6980
|
+
if (it.type === "!") return [0, Infinity];
|
|
6981
|
+
const alts = it.alts.map(lengths);
|
|
6982
|
+
const min = Math.min(...alts.map((a) => a[0]));
|
|
6983
|
+
const max = Math.max(...alts.map((a) => a[1]));
|
|
6984
|
+
const loop = max === 0 ? 0 : Infinity;
|
|
6985
|
+
return it.type === "@" ? [min, max] : it.type === "?" ? [0, max] : it.type === "*" ? [0, loop] : [min, loop];
|
|
6986
|
+
};
|
|
6987
|
+
const hasAffix = (lits, chars, start) => {
|
|
6988
|
+
for (let j = 0; j < lits.length; j++) if (!litMatch(lits[j], chars[start + j])) return false;
|
|
6989
|
+
return true;
|
|
6990
|
+
};
|
|
6991
|
+
const slashOrSurrogate = /[/\ud800-\udfff]/;
|
|
6992
|
+
const surrogate = /[\ud800-\udfff]/;
|
|
6993
|
+
const codePoints = (s) => surrogate.test(s) ? [...s] : s;
|
|
6994
|
+
const noSlash = (s) => {
|
|
6995
|
+
if (s.includes("/")) throw new Error("can only match a single path portion, got: " + s);
|
|
6996
|
+
};
|
|
6997
|
+
var Matcher = class {
|
|
6998
|
+
pattern;
|
|
6999
|
+
options;
|
|
7000
|
+
#start;
|
|
7001
|
+
#size;
|
|
7002
|
+
#marks;
|
|
7003
|
+
#dotsSim;
|
|
7004
|
+
#literal;
|
|
7005
|
+
#literalFold = false;
|
|
7006
|
+
#literalRe;
|
|
7007
|
+
#linear;
|
|
7008
|
+
#wild = false;
|
|
7009
|
+
#min = 0;
|
|
7010
|
+
#max = Infinity;
|
|
7011
|
+
#prefix = [];
|
|
7012
|
+
#suffix = [];
|
|
7013
|
+
#prefixStr;
|
|
7014
|
+
#suffixStr;
|
|
7015
|
+
#affix = false;
|
|
7016
|
+
#dfa;
|
|
7017
|
+
#form;
|
|
7018
|
+
constructor(pattern, options = {}) {
|
|
7019
|
+
if (pattern.includes("/")) throw new Error("can only match a single path portion, got pattern: " + pattern);
|
|
7020
|
+
this.pattern = pattern;
|
|
7021
|
+
this.options = options;
|
|
7022
|
+
const { nocase = false, noext = false, normalize: n } = options;
|
|
7023
|
+
this.#form = n === true ? "NFC" : n || void 0;
|
|
7024
|
+
const literal = /^[?*+@]\(\)$/.test(pattern);
|
|
7025
|
+
const toks = tokenize(pattern, nocase, noext || literal, this.#form);
|
|
7026
|
+
let [items] = build(toks, pair(toks), 0, toks.length, true);
|
|
7027
|
+
if (this.#form) items = normalize(items, this.#form);
|
|
7028
|
+
const [start, size] = compile(items, nocase);
|
|
7029
|
+
this.#start = start;
|
|
7030
|
+
this.#size = size;
|
|
7031
|
+
if (items.every((it) => it.t === "lit")) {
|
|
7032
|
+
this.#literal = items.map((it) => it.ch).join("");
|
|
7033
|
+
this.#literalFold = nocase;
|
|
7034
|
+
} else {
|
|
7035
|
+
const lit = (it) => it.t !== "lit" ? void 0 : nocase ? {
|
|
7036
|
+
ch: it.ch,
|
|
7037
|
+
re: foldRe(it.ch)
|
|
7038
|
+
} : { ch: it.ch };
|
|
7039
|
+
for (const it of items) {
|
|
7040
|
+
const l = lit(it);
|
|
7041
|
+
if (!l) break;
|
|
7042
|
+
this.#prefix.push(l);
|
|
7043
|
+
}
|
|
7044
|
+
for (let j = items.length - 1; j >= 0; j--) {
|
|
7045
|
+
const l = lit(items[j]);
|
|
7046
|
+
if (!l) break;
|
|
7047
|
+
this.#suffix.unshift(l);
|
|
7048
|
+
}
|
|
7049
|
+
this.#affix = !!(this.#prefix.length || this.#suffix.length);
|
|
7050
|
+
if (!nocase) {
|
|
7051
|
+
this.#prefixStr = this.#prefix.map((l) => l.ch).join("");
|
|
7052
|
+
this.#suffixStr = this.#suffix.map((l) => l.ch).join("");
|
|
7053
|
+
}
|
|
7054
|
+
this.#linear = linear(this.#start)?.slice(this.#prefix.length, -this.#suffix.length || void 0);
|
|
7055
|
+
this.#wild = !!this.#linear?.every((n) => n.t === "star" || n.t === "any");
|
|
7056
|
+
const [min, max] = lengths(items);
|
|
7057
|
+
this.#min = min;
|
|
7058
|
+
this.#max = max;
|
|
7059
|
+
}
|
|
7060
|
+
}
|
|
7061
|
+
test(s) {
|
|
7062
|
+
if (this.#form) {
|
|
7063
|
+
noSlash(s);
|
|
7064
|
+
return this.#test(s.normalize(this.#form));
|
|
7065
|
+
}
|
|
7066
|
+
if (slashOrSurrogate.test(s)) {
|
|
7067
|
+
noSlash(s);
|
|
7068
|
+
return this.#test(s, [...s]);
|
|
7069
|
+
}
|
|
7070
|
+
return this.#test(s, s);
|
|
7071
|
+
}
|
|
7072
|
+
/**
|
|
7073
|
+
* The same as {@link Matcher#test}, but the string is not checked
|
|
7074
|
+
* for `/` chars, so the result for a string that has one is not
|
|
7075
|
+
* defined. Only use it for a string that is known to be one path
|
|
7076
|
+
* portion, such as a part of a path that was split on `/`. It can
|
|
7077
|
+
* be faster, because some patterns do not need to look at each char
|
|
7078
|
+
* of the string.
|
|
7079
|
+
*/
|
|
7080
|
+
testUnchecked(s) {
|
|
7081
|
+
return this.#test(this.#form ? s.normalize(this.#form) : s);
|
|
7082
|
+
}
|
|
7083
|
+
#test(s, chars) {
|
|
7084
|
+
if (this.#literal !== void 0) return this.#literalFold ? (this.#literalRe ??= newFoldRe(this.#literal)).test(s) : s === this.#literal;
|
|
7085
|
+
const min = this.#min;
|
|
7086
|
+
const max = this.#max;
|
|
7087
|
+
if (chars === void 0) {
|
|
7088
|
+
const most = s.length;
|
|
7089
|
+
const least = most + 1 >> 1;
|
|
7090
|
+
if (most < min || least > max) return false;
|
|
7091
|
+
if (least < min || most > max) chars = codePoints(s);
|
|
7092
|
+
}
|
|
7093
|
+
if (chars !== void 0 && (chars.length < min || chars.length > max)) return false;
|
|
7094
|
+
const prefix = this.#prefix.length;
|
|
7095
|
+
if (this.#affix) if (this.#prefixStr !== void 0 && this.#suffixStr !== void 0) {
|
|
7096
|
+
if (!s.startsWith(this.#prefixStr) || !s.endsWith(this.#suffixStr)) return false;
|
|
7097
|
+
} else {
|
|
7098
|
+
chars ??= codePoints(s);
|
|
7099
|
+
const end = chars.length - this.#suffix.length;
|
|
7100
|
+
if (!hasAffix(this.#prefix, chars, 0) || !hasAffix(this.#suffix, chars, end)) return false;
|
|
7101
|
+
}
|
|
7102
|
+
const dotStart = !this.options.dot && s.startsWith(".");
|
|
7103
|
+
if (this.#linear) {
|
|
7104
|
+
if (s === "." || s === "..") return false;
|
|
7105
|
+
if (dotStart && !prefix) return false;
|
|
7106
|
+
if (this.#wild) return true;
|
|
7107
|
+
chars ??= codePoints(s);
|
|
7108
|
+
const end = chars.length - this.#suffix.length;
|
|
7109
|
+
return testLinear(this.#linear, chars, prefix, end);
|
|
7110
|
+
}
|
|
7111
|
+
chars ??= codePoints(s);
|
|
7112
|
+
if (s === "." || s === "..") {
|
|
7113
|
+
this.#marks ??= marks(this.#size);
|
|
7114
|
+
const sim = this.#dotsSim ??= new Sim(true, false, this.#marks);
|
|
7115
|
+
const start = sim.state();
|
|
7116
|
+
sim.add(start, this.#start, 0, true);
|
|
7117
|
+
let state = sim.done(start);
|
|
7118
|
+
for (let i = 0; i < chars.length; i++) state = sim.step(state, chars[i], i, true);
|
|
7119
|
+
return state.match;
|
|
7120
|
+
}
|
|
7121
|
+
this.#marks ??= marks(this.#size);
|
|
7122
|
+
const dfa = this.#dfa ??= new Dfa(this.#start, this.#marks);
|
|
7123
|
+
let d = dfa.start(dotStart);
|
|
7124
|
+
const str = chars === s;
|
|
7125
|
+
for (let i = 0; i < chars.length; i++) {
|
|
7126
|
+
if (d.dead) return false;
|
|
7127
|
+
const code = str ? s.charCodeAt(i) : chars[i].charCodeAt(0);
|
|
7128
|
+
d = d.ascii?.[code] ?? dfa.next(d, chars[i]);
|
|
7129
|
+
}
|
|
7130
|
+
return d.match;
|
|
7131
|
+
}
|
|
7132
|
+
/** a readable listing of the state machine */
|
|
7133
|
+
toString() {
|
|
7134
|
+
return show(this.#start);
|
|
7123
7135
|
}
|
|
7124
7136
|
};
|
|
7125
|
-
exports.
|
|
7126
|
-
|
|
7137
|
+
exports.Matcher = Matcher;
|
|
7138
|
+
}));
|
|
7139
|
+
//#endregion
|
|
7140
|
+
//#region ../../node_modules/glob/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js
|
|
7141
|
+
var require_assert_valid_pattern = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
7142
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7143
|
+
exports.assertValidPattern = void 0;
|
|
7144
|
+
const MAX_PATTERN_LENGTH = 1024 * 64;
|
|
7145
|
+
const assertValidPattern = (pattern) => {
|
|
7146
|
+
if (typeof pattern !== "string") throw new TypeError("invalid pattern");
|
|
7147
|
+
if (pattern.length > MAX_PATTERN_LENGTH) throw new TypeError("pattern is too long");
|
|
7148
|
+
};
|
|
7149
|
+
exports.assertValidPattern = assertValidPattern;
|
|
7127
7150
|
}));
|
|
7128
7151
|
//#endregion
|
|
7129
7152
|
//#region ../../node_modules/glob/node_modules/minimatch/dist/commonjs/escape.js
|
|
@@ -7149,71 +7172,66 @@ var require_escape = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
7149
7172
|
exports.escape = escape;
|
|
7150
7173
|
}));
|
|
7151
7174
|
//#endregion
|
|
7175
|
+
//#region ../../node_modules/glob/node_modules/minimatch/dist/commonjs/unescape.js
|
|
7176
|
+
var require_unescape = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
7177
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7178
|
+
exports.unescape = void 0;
|
|
7179
|
+
/**
|
|
7180
|
+
* Un-escape a string that has been escaped with {@link escape}.
|
|
7181
|
+
*
|
|
7182
|
+
* If the {@link MinimatchOptions.windowsPathsNoEscape} option is used, then
|
|
7183
|
+
* square-bracket escapes are removed, but not backslash escapes.
|
|
7184
|
+
*
|
|
7185
|
+
* For example, it will turn the string `'[*]'` into `*`, but it will not
|
|
7186
|
+
* turn `'\\*'` into `'*'`, because `\` is a path separator in
|
|
7187
|
+
* `windowsPathsNoEscape` mode.
|
|
7188
|
+
*
|
|
7189
|
+
* When `windowsPathsNoEscape` is not set, then both square-bracket escapes and
|
|
7190
|
+
* backslash escapes are removed.
|
|
7191
|
+
*
|
|
7192
|
+
* Slashes (and backslashes in `windowsPathsNoEscape` mode) cannot be escaped
|
|
7193
|
+
* or unescaped.
|
|
7194
|
+
*
|
|
7195
|
+
* When `magicalBraces` is not set, escapes of braces (`{` and `}`) will not be
|
|
7196
|
+
* unescaped.
|
|
7197
|
+
*/
|
|
7198
|
+
const unescape = (s, { windowsPathsNoEscape = false, magicalBraces = true } = {}) => {
|
|
7199
|
+
if (magicalBraces) return windowsPathsNoEscape ? s.replace(/\[([^/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^/\\])\]/g, "$1$2").replace(/\\([^/])/g, "$1");
|
|
7200
|
+
return windowsPathsNoEscape ? s.replace(/\[([^/\\{}])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^/\\{}])\]/g, "$1$2").replace(/\\([^/{}])/g, "$1");
|
|
7201
|
+
};
|
|
7202
|
+
exports.unescape = unescape;
|
|
7203
|
+
}));
|
|
7204
|
+
//#endregion
|
|
7152
7205
|
//#region ../../node_modules/glob/node_modules/minimatch/dist/commonjs/index.js
|
|
7153
7206
|
var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
7154
7207
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7155
|
-
exports.unescape = exports.escape = exports.
|
|
7156
|
-
const brace_expansion_1 = require_commonjs$
|
|
7208
|
+
exports.unescape = exports.escape = exports.Minimatch = exports.match = exports.braceExpand = exports.defaults = exports.filter = exports.GLOBSTAR = exports.sep = exports.minimatch = void 0;
|
|
7209
|
+
const brace_expansion_1 = require_commonjs$6();
|
|
7210
|
+
const nonrecursive_glob_match_1 = require_commonjs$5();
|
|
7157
7211
|
const assert_valid_pattern_js_1 = require_assert_valid_pattern();
|
|
7158
|
-
const ast_js_1 = require_ast$1();
|
|
7159
7212
|
const escape_js_1 = require_escape();
|
|
7160
7213
|
const unescape_js_1 = require_unescape();
|
|
7161
7214
|
const minimatch = (p, pattern, options = {}) => {
|
|
7162
7215
|
(0, assert_valid_pattern_js_1.assertValidPattern)(pattern);
|
|
7163
7216
|
if (!options.nocomment && pattern.charAt(0) === "#") return false;
|
|
7164
|
-
return
|
|
7217
|
+
return cachedMinimatch(pattern, options).match(p);
|
|
7165
7218
|
};
|
|
7166
7219
|
exports.minimatch = minimatch;
|
|
7167
|
-
const
|
|
7168
|
-
const
|
|
7169
|
-
const
|
|
7170
|
-
|
|
7171
|
-
|
|
7172
|
-
|
|
7173
|
-
|
|
7174
|
-
|
|
7175
|
-
|
|
7176
|
-
|
|
7177
|
-
|
|
7178
|
-
|
|
7179
|
-
const starDotStarTest = (f) => !f.startsWith(".") && f.includes(".");
|
|
7180
|
-
const starDotStarTestDot = (f) => f !== "." && f !== ".." && f.includes(".");
|
|
7181
|
-
const dotStarRE = /^\.\*+$/;
|
|
7182
|
-
const dotStarTest = (f) => f !== "." && f !== ".." && f.startsWith(".");
|
|
7183
|
-
const starRE = /^\*+$/;
|
|
7184
|
-
const starTest = (f) => f.length !== 0 && !f.startsWith(".");
|
|
7185
|
-
const starTestDot = (f) => f.length !== 0 && f !== "." && f !== "..";
|
|
7186
|
-
const qmarksRE = /^\?+([^+@!?*[(]*)?$/;
|
|
7187
|
-
const qmarksTestNocase = ([$0, ext = ""]) => {
|
|
7188
|
-
const noext = qmarksTestNoExt([$0]);
|
|
7189
|
-
if (!ext) return noext;
|
|
7190
|
-
ext = ext.toLowerCase();
|
|
7191
|
-
return (f) => noext(f) && f.toLowerCase().endsWith(ext);
|
|
7192
|
-
};
|
|
7193
|
-
const qmarksTestNocaseDot = ([$0, ext = ""]) => {
|
|
7194
|
-
const noext = qmarksTestNoExtDot([$0]);
|
|
7195
|
-
if (!ext) return noext;
|
|
7196
|
-
ext = ext.toLowerCase();
|
|
7197
|
-
return (f) => noext(f) && f.toLowerCase().endsWith(ext);
|
|
7198
|
-
};
|
|
7199
|
-
const qmarksTestDot = ([$0, ext = ""]) => {
|
|
7200
|
-
const noext = qmarksTestNoExtDot([$0]);
|
|
7201
|
-
return !ext ? noext : (f) => noext(f) && f.endsWith(ext);
|
|
7202
|
-
};
|
|
7203
|
-
const qmarksTest = ([$0, ext = ""]) => {
|
|
7204
|
-
const noext = qmarksTestNoExt([$0]);
|
|
7205
|
-
return !ext ? noext : (f) => noext(f) && f.endsWith(ext);
|
|
7206
|
-
};
|
|
7207
|
-
const qmarksTestNoExt = ([$0]) => {
|
|
7208
|
-
const len = $0.length;
|
|
7209
|
-
return (f) => f.length === len && !f.startsWith(".");
|
|
7210
|
-
};
|
|
7211
|
-
const qmarksTestNoExtDot = ([$0]) => {
|
|
7212
|
-
const len = $0.length;
|
|
7213
|
-
return (f) => f.length === len && f !== "." && f !== "..";
|
|
7220
|
+
const cache = /* @__PURE__ */ new Map();
|
|
7221
|
+
const cacheMax = 256;
|
|
7222
|
+
const cachedMinimatch = (pattern, options) => {
|
|
7223
|
+
const key = pattern + "\0" + JSON.stringify(options);
|
|
7224
|
+
let mm = cache.get(key);
|
|
7225
|
+
if (mm) cache.delete(key);
|
|
7226
|
+
else {
|
|
7227
|
+
mm = new Minimatch(pattern, { ...options });
|
|
7228
|
+
if (cache.size >= cacheMax) cache.delete(cache.keys().next().value);
|
|
7229
|
+
}
|
|
7230
|
+
cache.set(key, mm);
|
|
7231
|
+
return mm;
|
|
7214
7232
|
};
|
|
7215
7233
|
/* c8 ignore start */
|
|
7216
|
-
const defaultPlatform = typeof process === "object" && process ?
|
|
7234
|
+
const defaultPlatform = typeof process === "object" && process ? process.env?.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
|
|
7217
7235
|
const path = {
|
|
7218
7236
|
win32: { sep: "\\" },
|
|
7219
7237
|
posix: { sep: "/" }
|
|
@@ -7223,9 +7241,6 @@ var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
7223
7241
|
exports.minimatch.sep = exports.sep;
|
|
7224
7242
|
exports.GLOBSTAR = Symbol("globstar **");
|
|
7225
7243
|
exports.minimatch.GLOBSTAR = exports.GLOBSTAR;
|
|
7226
|
-
const star = "[^/]*?";
|
|
7227
|
-
const twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
|
|
7228
|
-
const twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
|
|
7229
7244
|
const filter = (pattern, options = {}) => (p) => (0, exports.minimatch)(p, pattern, options);
|
|
7230
7245
|
exports.filter = filter;
|
|
7231
7246
|
exports.minimatch.filter = exports.filter;
|
|
@@ -7243,21 +7258,10 @@ var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
7243
7258
|
return orig.defaults(ext(def, options)).Minimatch;
|
|
7244
7259
|
}
|
|
7245
7260
|
},
|
|
7246
|
-
AST: class AST extends orig.AST {
|
|
7247
|
-
/* c8 ignore start */
|
|
7248
|
-
constructor(type, parent, options = {}) {
|
|
7249
|
-
super(type, parent, ext(def, options));
|
|
7250
|
-
}
|
|
7251
|
-
/* c8 ignore stop */
|
|
7252
|
-
static fromGlob(pattern, options = {}) {
|
|
7253
|
-
return orig.AST.fromGlob(pattern, ext(def, options));
|
|
7254
|
-
}
|
|
7255
|
-
},
|
|
7256
7261
|
unescape: (s, options = {}) => orig.unescape(s, ext(def, options)),
|
|
7257
7262
|
escape: (s, options = {}) => orig.escape(s, ext(def, options)),
|
|
7258
7263
|
filter: (pattern, options = {}) => orig.filter(pattern, ext(def, options)),
|
|
7259
7264
|
defaults: (options) => orig.defaults(ext(def, options)),
|
|
7260
|
-
makeRe: (pattern, options = {}) => orig.makeRe(pattern, ext(def, options)),
|
|
7261
7265
|
braceExpand: (pattern, options = {}) => orig.braceExpand(pattern, ext(def, options)),
|
|
7262
7266
|
match: (list, pattern, options = {}) => orig.match(list, pattern, ext(def, options)),
|
|
7263
7267
|
sep: orig.sep,
|
|
@@ -7273,9 +7277,6 @@ var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
7273
7277
|
};
|
|
7274
7278
|
exports.braceExpand = braceExpand;
|
|
7275
7279
|
exports.minimatch.braceExpand = exports.braceExpand;
|
|
7276
|
-
const makeRe = (pattern, options = {}) => new Minimatch(pattern, options).makeRe();
|
|
7277
|
-
exports.makeRe = makeRe;
|
|
7278
|
-
exports.minimatch.makeRe = exports.makeRe;
|
|
7279
7280
|
const match = (list, pattern, options = {}) => {
|
|
7280
7281
|
const mm = new Minimatch(pattern, options);
|
|
7281
7282
|
list = list.filter((f) => mm.match(f));
|
|
@@ -7285,7 +7286,98 @@ var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
7285
7286
|
exports.match = match;
|
|
7286
7287
|
exports.minimatch.match = exports.match;
|
|
7287
7288
|
const globMagic = /[?*]|[+@!]\(.*?\)|\[|\]/;
|
|
7288
|
-
const
|
|
7289
|
+
const classEnd = (pattern, start) => {
|
|
7290
|
+
let i = start + 1;
|
|
7291
|
+
if (pattern.charAt(i) === "!" || pattern.charAt(i) === "^") i++;
|
|
7292
|
+
let sawStart = false;
|
|
7293
|
+
for (; i < pattern.length; i++) {
|
|
7294
|
+
const c = pattern.charAt(i);
|
|
7295
|
+
if (c === "]" && sawStart) return i;
|
|
7296
|
+
sawStart = true;
|
|
7297
|
+
if (c === "\\") i++;
|
|
7298
|
+
}
|
|
7299
|
+
return -1;
|
|
7300
|
+
};
|
|
7301
|
+
const literal = (pattern, noext) => {
|
|
7302
|
+
if (!noext && (pattern === "+()" || pattern === "@()")) return pattern;
|
|
7303
|
+
let lit = "";
|
|
7304
|
+
for (let i = 0; i < pattern.length; i++) {
|
|
7305
|
+
const c = pattern.charAt(i);
|
|
7306
|
+
if (c === "\\") lit += pattern.charAt(++i) || c;
|
|
7307
|
+
else if (c === "*" || c === "?") return;
|
|
7308
|
+
else if (c === "[") {
|
|
7309
|
+
const close = classEnd(pattern, i);
|
|
7310
|
+
if (close === -1) {
|
|
7311
|
+
lit += c;
|
|
7312
|
+
continue;
|
|
7313
|
+
}
|
|
7314
|
+
let body = pattern.slice(i + 1, close);
|
|
7315
|
+
if (body.startsWith("\\")) body = body.slice(1);
|
|
7316
|
+
if ([...body].length !== 1 || "!^".includes(pattern.charAt(i + 1))) return;
|
|
7317
|
+
lit += body;
|
|
7318
|
+
i = close;
|
|
7319
|
+
} else if (!noext && "+@!".includes(c) && pattern.charAt(i + 1) === "(" && pattern.includes(")", i + 2)) return;
|
|
7320
|
+
else lit += c;
|
|
7321
|
+
}
|
|
7322
|
+
return lit;
|
|
7323
|
+
};
|
|
7324
|
+
const extSafe = (pattern) => {
|
|
7325
|
+
if (/^[?*+@]\(\)$/.test(pattern) || pattern.includes("[:")) return false;
|
|
7326
|
+
let depth = 0;
|
|
7327
|
+
for (let i = 0; i < pattern.length; i++) {
|
|
7328
|
+
const c = pattern.charAt(i);
|
|
7329
|
+
if (c === "\\") {
|
|
7330
|
+
if (++i === pattern.length) return false;
|
|
7331
|
+
} else if (c === "[") {
|
|
7332
|
+
const close = classEnd(pattern, i);
|
|
7333
|
+
if (close !== -1) i = close;
|
|
7334
|
+
} else if ("+@!?*".includes(c) && pattern.charAt(i + 1) === "(") {
|
|
7335
|
+
depth++;
|
|
7336
|
+
i++;
|
|
7337
|
+
} else if (c === ")") {
|
|
7338
|
+
if (!depth--) return false;
|
|
7339
|
+
} else if (c === "|" && !depth) return false;
|
|
7340
|
+
}
|
|
7341
|
+
return !depth;
|
|
7342
|
+
};
|
|
7343
|
+
let lastSplit;
|
|
7344
|
+
let lastChecked;
|
|
7345
|
+
const portionMatch = (p, f) => typeof p === "string" ? f === p : f !== "" && p.testUnchecked(f);
|
|
7346
|
+
const endIndex = (p, last, lastStart, prev, prevStart) => portionMatch(p, last) ? lastStart : prev !== void 0 && portionMatch(p, prev) ? prevStart : -1;
|
|
7347
|
+
const isDots = (p) => p === "." || p === "..";
|
|
7348
|
+
const isDrive = (p) => typeof p === "string" && /^[a-z]:$/i.test(p);
|
|
7349
|
+
const isLongUNC = (p) => typeof p === "string" && /^unc$/i.test(p);
|
|
7350
|
+
const uncHost = (p) => {
|
|
7351
|
+
if (p[0] !== "" || p[1] !== "") return -1;
|
|
7352
|
+
const h = p[2] !== "?" ? 2 : isLongUNC(p[3]) ? 4 : -1;
|
|
7353
|
+
const host = p[h];
|
|
7354
|
+
const share = p[h + 1];
|
|
7355
|
+
return h !== -1 && host !== void 0 && host !== "" && host !== exports.GLOBSTAR && share !== void 0 && share !== "" && share !== exports.GLOBSTAR ? h : -1;
|
|
7356
|
+
};
|
|
7357
|
+
const walkable = (p, dot) => !isDots(p) && (dot || !p.startsWith("."));
|
|
7358
|
+
const dotPortion = (f, start, end, dot, sep) => {
|
|
7359
|
+
for (let k = start; k < end;) {
|
|
7360
|
+
if (f.charCodeAt(k) === 46) {
|
|
7361
|
+
if (!dot) return true;
|
|
7362
|
+
const n = f.charCodeAt(k + 1) === 46 ? k + 2 : k + 1;
|
|
7363
|
+
if (n >= end || isSep(f.charCodeAt(n), sep)) return true;
|
|
7364
|
+
}
|
|
7365
|
+
const s = nextSep(f, k, sep);
|
|
7366
|
+
if (s === -1) return false;
|
|
7367
|
+
k = s + 1;
|
|
7368
|
+
while (k < end && isSep(f.charCodeAt(k), sep)) k++;
|
|
7369
|
+
}
|
|
7370
|
+
return false;
|
|
7371
|
+
};
|
|
7372
|
+
const isSep = (c, sep) => sep === "/" ? c === 47 : sep === "\\" ? c === 92 : c === 47 || c === 92;
|
|
7373
|
+
const nextSep = (f, from, sep) => {
|
|
7374
|
+
if (sep !== "both") return f.indexOf(sep, from);
|
|
7375
|
+
const s = f.indexOf("/", from);
|
|
7376
|
+
const b = f.indexOf("\\", from);
|
|
7377
|
+
return s === -1 ? b : b === -1 ? s : Math.min(s, b);
|
|
7378
|
+
};
|
|
7379
|
+
const lastSep = (f, from, sep) => sep !== "both" ? f.lastIndexOf(sep, from) : Math.max(f.lastIndexOf("/", from), f.lastIndexOf("\\", from));
|
|
7380
|
+
const PENDING = {};
|
|
7289
7381
|
var Minimatch = class {
|
|
7290
7382
|
options;
|
|
7291
7383
|
set;
|
|
@@ -7304,7 +7396,16 @@ var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
7304
7396
|
platform;
|
|
7305
7397
|
windowsNoMagicRoot;
|
|
7306
7398
|
maxGlobstarRecursion;
|
|
7307
|
-
|
|
7399
|
+
#endCheck;
|
|
7400
|
+
#literalCheck;
|
|
7401
|
+
#level2;
|
|
7402
|
+
#form;
|
|
7403
|
+
#literals = [];
|
|
7404
|
+
#shapes = [];
|
|
7405
|
+
#endRows = [];
|
|
7406
|
+
#matchers = /* @__PURE__ */ new Map();
|
|
7407
|
+
#pending = false;
|
|
7408
|
+
#globstarParts = /* @__PURE__ */ new WeakMap();
|
|
7308
7409
|
constructor(pattern, options = {}) {
|
|
7309
7410
|
(0, assert_valid_pattern_js_1.assertValidPattern)(pattern);
|
|
7310
7411
|
options = options || {};
|
|
@@ -7316,7 +7417,6 @@ var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
7316
7417
|
this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options["allowWindowsEscape"] === false;
|
|
7317
7418
|
if (this.windowsPathsNoEscape) this.pattern = this.pattern.replace(/\\/g, "/");
|
|
7318
7419
|
this.preserveMultipleSlashes = !!options.preserveMultipleSlashes;
|
|
7319
|
-
this.regexp = null;
|
|
7320
7420
|
this.negate = false;
|
|
7321
7421
|
this.nonegate = !!options.nonegate;
|
|
7322
7422
|
this.comment = false;
|
|
@@ -7327,14 +7427,45 @@ var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
7327
7427
|
this.globSet = [];
|
|
7328
7428
|
this.globParts = [];
|
|
7329
7429
|
this.set = [];
|
|
7430
|
+
this.#endCheck = !this.preserveMultipleSlashes;
|
|
7431
|
+
this.#level2 = (options.optimizationLevel ?? 1) >= 2;
|
|
7432
|
+
const n = options.normalize;
|
|
7433
|
+
this.#form = n === true ? "NFC" : n || void 0;
|
|
7330
7434
|
this.make();
|
|
7435
|
+
const drives = this.set.map((row) => this.#rootIndex(row));
|
|
7436
|
+
this.#endRows = this.set.map((row, r) => this.#endCheck && row.length - 1 > drives[r]);
|
|
7437
|
+
this.#literals = this.set.map((row, r) => {
|
|
7438
|
+
const end = this.#endRows[r] ? row.length - 1 : row.length;
|
|
7439
|
+
const lits = row.slice(drives[r] + 1, end).filter((p) => typeof p === "string" && !!p);
|
|
7440
|
+
return [...new Set(lits)];
|
|
7441
|
+
});
|
|
7442
|
+
this.#literalCheck = this.#literals.some((l) => l.length);
|
|
7443
|
+
this.#shapes = this.set.map((row, r) => {
|
|
7444
|
+
const [p0, p1, p2] = row;
|
|
7445
|
+
if (this.#endRows[r] && row.length === 2) {
|
|
7446
|
+
if (p0 === exports.GLOBSTAR && p1 !== exports.GLOBSTAR) return "tail";
|
|
7447
|
+
}
|
|
7448
|
+
if (this.#endRows[r] && options.matchBase && row.length === 1 && p0 !== exports.GLOBSTAR && p0 !== "") return "base";
|
|
7449
|
+
if (!this.#endCheck || drives[r] !== -1) return void 0;
|
|
7450
|
+
if (row.length === 3 && p0 === exports.GLOBSTAR && p2 === exports.GLOBSTAR && p1 !== exports.GLOBSTAR && p1 !== "" && this.maxGlobstarRecursion > 0) return "mid";
|
|
7451
|
+
if (row.length === 2 && p1 === exports.GLOBSTAR && p0 !== exports.GLOBSTAR && p0 !== "") return "head";
|
|
7452
|
+
});
|
|
7453
|
+
}
|
|
7454
|
+
#norm(p) {
|
|
7455
|
+
return this.#form ? p.normalize(this.#form) : p;
|
|
7456
|
+
}
|
|
7457
|
+
#rootIndex(row) {
|
|
7458
|
+
if (!this.isWindows) return -1;
|
|
7459
|
+
if (isDrive(row[0])) return 0;
|
|
7460
|
+
if (row[0] === "" && row[1] === "" && row[2] === "?" && isDrive(row[3])) return 3;
|
|
7461
|
+
const h = uncHost(row);
|
|
7462
|
+
return h === -1 ? -1 : h + 1;
|
|
7331
7463
|
}
|
|
7332
7464
|
hasMagic() {
|
|
7333
7465
|
if (this.options.magicalBraces && this.set.length > 1) return true;
|
|
7334
7466
|
for (const pattern of this.set) for (const part of pattern) if (typeof part !== "string") return true;
|
|
7335
7467
|
return false;
|
|
7336
7468
|
}
|
|
7337
|
-
debug(..._) {}
|
|
7338
7469
|
make() {
|
|
7339
7470
|
const pattern = this.pattern;
|
|
7340
7471
|
const options = this.options;
|
|
@@ -7348,27 +7479,64 @@ var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
7348
7479
|
}
|
|
7349
7480
|
this.parseNegate();
|
|
7350
7481
|
this.globSet = [...new Set(this.braceExpand())];
|
|
7351
|
-
|
|
7352
|
-
this.debug(this.pattern, this.globSet);
|
|
7353
|
-
const rawGlobParts = this.globSet.map((s) => this.slashSplit(s));
|
|
7482
|
+
const rawGlobParts = this.globSet.map((s) => this.#slashSplit(s));
|
|
7354
7483
|
this.globParts = this.preprocess(rawGlobParts);
|
|
7355
|
-
this
|
|
7356
|
-
|
|
7484
|
+
this.#pending = true;
|
|
7485
|
+
this.set = this.globParts.map((s, _, __) => {
|
|
7357
7486
|
if (this.isWindows && this.windowsNoMagicRoot) {
|
|
7358
|
-
const
|
|
7487
|
+
const n = s[2] === "?" && isLongUNC(s[3]) ? 6 : 4;
|
|
7488
|
+
const isUNC = s[0] === "" && s[1] === "" && (s[2] === "?" || !globMagic.test(s[2])) && s.slice(3, n).every((p) => !globMagic.test(p));
|
|
7359
7489
|
const isDrive = /^[a-z]:/i.test(s[0]);
|
|
7360
|
-
if (isUNC) return [...s.slice(0,
|
|
7361
|
-
else if (isDrive) return [s[0], ...s.slice(1).map((ss) => this.parse(ss))];
|
|
7490
|
+
if (isUNC) return [...s.slice(0, n).map((p) => this.#norm(p)), ...s.slice(n).map((ss) => this.parse(ss))];
|
|
7491
|
+
else if (isDrive) return [this.#norm(s[0]), ...s.slice(1).map((ss) => this.parse(ss))];
|
|
7362
7492
|
}
|
|
7363
7493
|
return s.map((ss) => this.parse(ss));
|
|
7364
|
-
});
|
|
7365
|
-
this.debug(this.pattern, set);
|
|
7366
|
-
this.set = set.filter((s) => s.indexOf(false) === -1);
|
|
7494
|
+
}).filter((s) => s.indexOf(false) === -1);
|
|
7367
7495
|
if (this.isWindows) for (let i = 0; i < this.set.length; i++) {
|
|
7368
7496
|
const p = this.set[i];
|
|
7369
|
-
if (p[0] === "" && p[1] === "" && this.globParts[i][2] === "?" &&
|
|
7497
|
+
if (p[0] === "" && p[1] === "" && this.globParts[i][2] === "?" && (isDrive(p[3]) || isLongUNC(this.globParts[i][3]))) {
|
|
7498
|
+
if (isLongUNC(this.globParts[i][3])) p[3] = "UNC";
|
|
7499
|
+
p[2] = "?";
|
|
7500
|
+
}
|
|
7501
|
+
}
|
|
7502
|
+
if (!options.noext) this.mergeRows();
|
|
7503
|
+
this.#pending = false;
|
|
7504
|
+
this.set.forEach((row, i) => {
|
|
7505
|
+
for (let k = 0; k < row.length; k++) if (row[k] === PENDING) row[k] = this.parse(this.globParts[i][k]);
|
|
7506
|
+
});
|
|
7507
|
+
}
|
|
7508
|
+
mergeRows() {
|
|
7509
|
+
let merged = true;
|
|
7510
|
+
while (merged) {
|
|
7511
|
+
merged = false;
|
|
7512
|
+
const len = Math.max(0, ...this.set.map((r) => r.length));
|
|
7513
|
+
for (let k = 0; k < len; k++) {
|
|
7514
|
+
const groups = /* @__PURE__ */ new Map();
|
|
7515
|
+
this.set.forEach((row, i) => {
|
|
7516
|
+
if (!(row[k] instanceof nonrecursive_glob_match_1.Matcher || row[k] === PENDING) || !extSafe(this.globParts[i][k])) return;
|
|
7517
|
+
const parts = [...this.globParts[i]];
|
|
7518
|
+
parts[k] = "";
|
|
7519
|
+
const key = `${row.length}/${parts.join("/")}`;
|
|
7520
|
+
const g = groups.get(key);
|
|
7521
|
+
if (g) g.push(i);
|
|
7522
|
+
else groups.set(key, [i]);
|
|
7523
|
+
});
|
|
7524
|
+
const drop = /* @__PURE__ */ new Set();
|
|
7525
|
+
for (const g of groups.values()) {
|
|
7526
|
+
if (g.length < 2) continue;
|
|
7527
|
+
const [first, ...rest] = g;
|
|
7528
|
+
const glob = `@(${g.map((i) => this.globParts[i][k]).join("|")})`;
|
|
7529
|
+
this.globParts[first][k] = glob;
|
|
7530
|
+
this.set[first][k] = this.parse(glob);
|
|
7531
|
+
for (const i of rest) drop.add(i);
|
|
7532
|
+
}
|
|
7533
|
+
if (drop.size) {
|
|
7534
|
+
merged = true;
|
|
7535
|
+
this.set = this.set.filter((_, i) => !drop.has(i));
|
|
7536
|
+
this.globParts = this.globParts.filter((_, i) => !drop.has(i));
|
|
7537
|
+
}
|
|
7538
|
+
}
|
|
7370
7539
|
}
|
|
7371
|
-
this.debug(this.pattern, this.set);
|
|
7372
7540
|
}
|
|
7373
7541
|
preprocess(globParts) {
|
|
7374
7542
|
if (this.options.noglobstar) {
|
|
@@ -7395,11 +7563,12 @@ var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
7395
7563
|
}
|
|
7396
7564
|
levelOneOptimize(globParts) {
|
|
7397
7565
|
return globParts.map((parts) => {
|
|
7566
|
+
const root = this.#rootIndex(parts) + 1;
|
|
7398
7567
|
parts = parts.reduce((set, part) => {
|
|
7399
7568
|
const prev = set[set.length - 1];
|
|
7400
7569
|
if (part === "**" && prev === "**") return set;
|
|
7401
7570
|
if (part === "..") {
|
|
7402
|
-
if (prev && prev !== ".." && prev !== "." && prev !== "**") {
|
|
7571
|
+
if (set.length > root && prev && prev !== ".." && prev !== "." && prev !== "**") {
|
|
7403
7572
|
set.pop();
|
|
7404
7573
|
return set;
|
|
7405
7574
|
}
|
|
@@ -7410,8 +7579,120 @@ var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
7410
7579
|
return parts.length === 0 ? [""] : parts;
|
|
7411
7580
|
});
|
|
7412
7581
|
}
|
|
7413
|
-
|
|
7414
|
-
|
|
7582
|
+
#canMatch(f) {
|
|
7583
|
+
const sep = !this.isWindows || !f.includes("\\") ? "/" : f.includes("/") ? "both" : "\\";
|
|
7584
|
+
let ends = this.#endCheck ? 0 : -1;
|
|
7585
|
+
let last = "";
|
|
7586
|
+
let lastStart = 0;
|
|
7587
|
+
let prev;
|
|
7588
|
+
let prevStart = 0;
|
|
7589
|
+
const dot = !!this.options.dot;
|
|
7590
|
+
ROWS: for (let r = 0; r < this.set.length; r++) {
|
|
7591
|
+
const row = this.set[r];
|
|
7592
|
+
const p = row[row.length - 1];
|
|
7593
|
+
let end = ends !== -1 && this.#endRows[r] && p !== exports.GLOBSTAR;
|
|
7594
|
+
if (end && ends === 0) {
|
|
7595
|
+
const i = lastSep(f, f.length, sep);
|
|
7596
|
+
lastStart = i + 1;
|
|
7597
|
+
last = f.slice(lastStart);
|
|
7598
|
+
if (last === "" && i >= 0) {
|
|
7599
|
+
let j = i;
|
|
7600
|
+
while (j > 0 && isSep(f.charCodeAt(j - 1), sep)) j--;
|
|
7601
|
+
prevStart = j === 0 ? 0 : lastSep(f, j - 1, sep) + 1;
|
|
7602
|
+
prev = f.slice(prevStart, j);
|
|
7603
|
+
}
|
|
7604
|
+
const resolves = this.#level2 && (isDots(last) || last === "" && prev !== void 0 && isDots(prev));
|
|
7605
|
+
ends = resolves ? -1 : 1;
|
|
7606
|
+
end = !resolves;
|
|
7607
|
+
}
|
|
7608
|
+
let tailStart = -1;
|
|
7609
|
+
if (end && typeof p === "string") {
|
|
7610
|
+
tailStart = endIndex(p, last, lastStart, prev, prevStart);
|
|
7611
|
+
if (tailStart === -1) continue;
|
|
7612
|
+
}
|
|
7613
|
+
if (this.#literalCheck) {
|
|
7614
|
+
for (const l of this.#literals[r]) if (!f.includes(l)) continue ROWS;
|
|
7615
|
+
}
|
|
7616
|
+
if (end && typeof p === "object") {
|
|
7617
|
+
tailStart = endIndex(p, last, lastStart, prev, prevStart);
|
|
7618
|
+
if (tailStart === -1) continue;
|
|
7619
|
+
}
|
|
7620
|
+
const shape = this.#shapes[r];
|
|
7621
|
+
if (shape === "base" && end) return "yes";
|
|
7622
|
+
if (shape === "tail" && end) {
|
|
7623
|
+
if (this.#level2 && dotPortion(f, 0, tailStart, true, sep)) return "maybe";
|
|
7624
|
+
if (!dotPortion(f, 0, tailStart, dot, sep)) return "yes";
|
|
7625
|
+
continue;
|
|
7626
|
+
}
|
|
7627
|
+
if (shape === "mid" || shape === "head") {
|
|
7628
|
+
const m = this.#walk(f, row, shape === "head", dot, sep);
|
|
7629
|
+
if (m !== "no") return m;
|
|
7630
|
+
continue;
|
|
7631
|
+
}
|
|
7632
|
+
return "maybe";
|
|
7633
|
+
}
|
|
7634
|
+
return "no";
|
|
7635
|
+
}
|
|
7636
|
+
#matchShape(file, row, shape) {
|
|
7637
|
+
const dot = !!this.options.dot;
|
|
7638
|
+
const n = file.length;
|
|
7639
|
+
if (shape === "head") {
|
|
7640
|
+
if (n < 2 || !portionMatch(row[0], file[0])) return false;
|
|
7641
|
+
for (let i = 1; i < n; i++) if (!walkable(file[i], dot)) return false;
|
|
7642
|
+
return true;
|
|
7643
|
+
}
|
|
7644
|
+
const x = row[1];
|
|
7645
|
+
if (shape === "tail") {
|
|
7646
|
+
let t = n - 1;
|
|
7647
|
+
if (!portionMatch(x, file[t])) {
|
|
7648
|
+
if (file[t] !== "" || n === 1 || !portionMatch(x, file[--t])) return false;
|
|
7649
|
+
}
|
|
7650
|
+
for (let i = 0; i < t; i++) if (!walkable(file[i], dot)) return false;
|
|
7651
|
+
return true;
|
|
7652
|
+
}
|
|
7653
|
+
for (let k = 0; k < n; k++) {
|
|
7654
|
+
if (portionMatch(x, file[k]) && k + 1 < n) {
|
|
7655
|
+
let i = k + 1;
|
|
7656
|
+
while (i < n && walkable(file[i], dot)) i++;
|
|
7657
|
+
if (i === n) return true;
|
|
7658
|
+
}
|
|
7659
|
+
if (!walkable(file[k], dot)) return false;
|
|
7660
|
+
}
|
|
7661
|
+
return false;
|
|
7662
|
+
}
|
|
7663
|
+
#walk(f, row, head, dot, sep) {
|
|
7664
|
+
if (this.#level2 && dotPortion(f, 0, f.length, true, sep)) return "maybe";
|
|
7665
|
+
const x = row[head ? 0 : 1];
|
|
7666
|
+
let s = 0;
|
|
7667
|
+
for (let e = nextSep(f, s, sep); e !== -1; e = nextSep(f, s, sep)) {
|
|
7668
|
+
let next = e + 1;
|
|
7669
|
+
while (next < f.length && isSep(f.charCodeAt(next), sep)) next++;
|
|
7670
|
+
if ((typeof x === "string" ? e - s === x.length && f.startsWith(x, s) : e > s && x.testUnchecked(f.slice(s, e))) && !dotPortion(f, next, f.length, dot, sep)) return "yes";
|
|
7671
|
+
if (head || dotPortion(f, s, next, dot, sep)) return "no";
|
|
7672
|
+
s = next;
|
|
7673
|
+
}
|
|
7674
|
+
return "no";
|
|
7675
|
+
}
|
|
7676
|
+
#cachedSplit(f) {
|
|
7677
|
+
const last = lastSplit;
|
|
7678
|
+
return last?.f === f && last.isWindows === this.isWindows && last.preserveMultipleSlashes === this.preserveMultipleSlashes && last.normalize === this.#form ? last : void 0;
|
|
7679
|
+
}
|
|
7680
|
+
#split(f) {
|
|
7681
|
+
const { isWindows, preserveMultipleSlashes } = this;
|
|
7682
|
+
let parts = this.#slashSplit(isWindows ? f.split("\\").join("/") : f);
|
|
7683
|
+
const normalize = this.#form;
|
|
7684
|
+
if (normalize) parts = parts.map((p) => p.normalize(normalize));
|
|
7685
|
+
lastSplit = {
|
|
7686
|
+
f,
|
|
7687
|
+
isWindows,
|
|
7688
|
+
preserveMultipleSlashes,
|
|
7689
|
+
normalize,
|
|
7690
|
+
parts
|
|
7691
|
+
};
|
|
7692
|
+
return lastSplit;
|
|
7693
|
+
}
|
|
7694
|
+
#levelTwoFileOptimize(file) {
|
|
7695
|
+
const parts = [...file];
|
|
7415
7696
|
let didSomething = false;
|
|
7416
7697
|
do {
|
|
7417
7698
|
didSomething = false;
|
|
@@ -7430,19 +7711,21 @@ var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
7430
7711
|
parts.pop();
|
|
7431
7712
|
}
|
|
7432
7713
|
}
|
|
7433
|
-
|
|
7714
|
+
const root = this.#rootIndex(parts) + 1;
|
|
7715
|
+
let dd = root;
|
|
7434
7716
|
while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
|
|
7435
7717
|
const p = parts[dd - 1];
|
|
7436
|
-
if (p && p !== "." && p !== ".." && p !== "**"
|
|
7718
|
+
if (p && p !== "." && p !== ".." && p !== "**") {
|
|
7437
7719
|
didSomething = true;
|
|
7438
7720
|
parts.splice(dd - 1, 2);
|
|
7439
|
-
dd
|
|
7721
|
+
dd = Math.max(dd - 2, root);
|
|
7440
7722
|
}
|
|
7441
7723
|
}
|
|
7442
7724
|
} while (didSomething);
|
|
7443
7725
|
return parts.length === 0 ? [""] : parts;
|
|
7444
7726
|
}
|
|
7445
7727
|
firstPhasePreProcess(globParts) {
|
|
7728
|
+
const { braceExpandMax = 1e5 } = this.options;
|
|
7446
7729
|
let didSomething = false;
|
|
7447
7730
|
do {
|
|
7448
7731
|
didSomething = false;
|
|
@@ -7456,7 +7739,7 @@ var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
7456
7739
|
const p = parts[gs + 2];
|
|
7457
7740
|
const p2 = parts[gs + 3];
|
|
7458
7741
|
if (next !== "..") continue;
|
|
7459
|
-
if (!p || p === "." || p === ".." || !p2 || p2 === "." || p2 === "..") continue;
|
|
7742
|
+
if (!p || p === "." || p === ".." || !p2 || p2 === "." || p2 === ".." || globParts.length >= braceExpandMax) continue;
|
|
7460
7743
|
didSomething = true;
|
|
7461
7744
|
parts.splice(gs, 1);
|
|
7462
7745
|
const other = parts.slice(0);
|
|
@@ -7479,7 +7762,8 @@ var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
7479
7762
|
parts.pop();
|
|
7480
7763
|
}
|
|
7481
7764
|
}
|
|
7482
|
-
|
|
7765
|
+
const root = this.#rootIndex(parts) + 1;
|
|
7766
|
+
let dd = root;
|
|
7483
7767
|
while (-1 !== (dd = parts.indexOf("..", dd + 1))) {
|
|
7484
7768
|
const p = parts[dd - 1];
|
|
7485
7769
|
if (p && p !== "." && p !== ".." && p !== "**") {
|
|
@@ -7487,7 +7771,7 @@ var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
7487
7771
|
const splin = dd === 1 && parts[dd + 1] === "**" ? ["."] : [];
|
|
7488
7772
|
parts.splice(dd - 1, 2, ...splin);
|
|
7489
7773
|
if (parts.length === 0) parts.push("");
|
|
7490
|
-
dd
|
|
7774
|
+
dd = Math.max(dd - 2, root);
|
|
7491
7775
|
}
|
|
7492
7776
|
}
|
|
7493
7777
|
}
|
|
@@ -7495,6 +7779,7 @@ var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
7495
7779
|
return globParts;
|
|
7496
7780
|
}
|
|
7497
7781
|
secondPhasePreProcess(globParts) {
|
|
7782
|
+
if (globParts.length > 1e3) return globParts;
|
|
7498
7783
|
for (let i = 0; i < globParts.length - 1; i++) for (let j = i + 1; j < globParts.length; j++) {
|
|
7499
7784
|
const matched = this.partsMatch(globParts[i], globParts[j], !this.preserveMultipleSlashes);
|
|
7500
7785
|
if (matched) {
|
|
@@ -7547,10 +7832,22 @@ var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
7547
7832
|
if (negateOffset) this.pattern = pattern.slice(negateOffset);
|
|
7548
7833
|
this.negate = negate;
|
|
7549
7834
|
}
|
|
7550
|
-
|
|
7835
|
+
#matchRow(file, resolved, pattern, partial) {
|
|
7551
7836
|
let fileStartIndex = 0;
|
|
7552
7837
|
let patternStartIndex = 0;
|
|
7553
|
-
|
|
7838
|
+
const fh = this.isWindows ? uncHost(resolved) : -1;
|
|
7839
|
+
const ph = fh === -1 ? -1 : uncHost(pattern);
|
|
7840
|
+
if (ph !== -1) {
|
|
7841
|
+
const host = pattern[ph];
|
|
7842
|
+
const share = pattern[ph + 1];
|
|
7843
|
+
if (typeof host !== "string" || typeof share !== "string") {
|
|
7844
|
+
fileStartIndex = fh;
|
|
7845
|
+
patternStartIndex = ph;
|
|
7846
|
+
} else if (resolved[fh].toLowerCase() === host.toLowerCase() && resolved[fh + 1].toLowerCase() === share.toLowerCase()) {
|
|
7847
|
+
fileStartIndex = fh + 2;
|
|
7848
|
+
patternStartIndex = ph + 2;
|
|
7849
|
+
}
|
|
7850
|
+
} else if (this.isWindows) {
|
|
7554
7851
|
const fileDrive = typeof file[0] === "string" && /^[a-z]:$/i.test(file[0]);
|
|
7555
7852
|
const fileUNC = !fileDrive && file[0] === "" && file[1] === "" && file[2] === "?" && /^[a-z]:$/i.test(file[3]);
|
|
7556
7853
|
const patternDrive = typeof pattern[0] === "string" && /^[a-z]:$/i.test(pattern[0]);
|
|
@@ -7560,32 +7857,20 @@ var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
7560
7857
|
if (typeof fdi === "number" && typeof pdi === "number") {
|
|
7561
7858
|
const [fd, pd] = [file[fdi], pattern[pdi]];
|
|
7562
7859
|
if (fd.toLowerCase() === pd.toLowerCase()) {
|
|
7563
|
-
|
|
7564
|
-
|
|
7565
|
-
fileStartIndex = fdi;
|
|
7860
|
+
patternStartIndex = pdi + 1;
|
|
7861
|
+
fileStartIndex = fdi + 1;
|
|
7566
7862
|
}
|
|
7567
7863
|
}
|
|
7568
7864
|
}
|
|
7569
|
-
|
|
7570
|
-
if (optimizationLevel >= 2) file = this.levelTwoFileOptimize(file);
|
|
7865
|
+
file = resolved;
|
|
7571
7866
|
if (pattern.includes(exports.GLOBSTAR)) return this.#matchGlobstar(file, pattern, partial, fileStartIndex, patternStartIndex);
|
|
7572
7867
|
return this.#matchOne(file, pattern, partial, fileStartIndex, patternStartIndex);
|
|
7573
7868
|
}
|
|
7574
7869
|
#matchGlobstar(file, pattern, partial, fileIndex, patternIndex) {
|
|
7575
|
-
const
|
|
7576
|
-
const lastgs = pattern.lastIndexOf(exports.GLOBSTAR);
|
|
7577
|
-
const [head, body, tail] = partial ? [
|
|
7578
|
-
pattern.slice(patternIndex, firstgs),
|
|
7579
|
-
pattern.slice(firstgs + 1),
|
|
7580
|
-
[]
|
|
7581
|
-
] : [
|
|
7582
|
-
pattern.slice(patternIndex, firstgs),
|
|
7583
|
-
pattern.slice(firstgs + 1, lastgs),
|
|
7584
|
-
pattern.slice(lastgs + 1)
|
|
7585
|
-
];
|
|
7870
|
+
const { head, body, tail, segments } = this.#getGlobstarParts(pattern, partial, patternIndex);
|
|
7586
7871
|
if (head.length) {
|
|
7587
|
-
const
|
|
7588
|
-
if (!this.#matchOne(
|
|
7872
|
+
const headEnd = fileIndex + head.length;
|
|
7873
|
+
if (!this.#matchOne(file, head, partial, fileIndex, 0, headEnd)) return false;
|
|
7589
7874
|
fileIndex += head.length;
|
|
7590
7875
|
patternIndex += head.length;
|
|
7591
7876
|
}
|
|
@@ -7610,67 +7895,86 @@ var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
7610
7895
|
}
|
|
7611
7896
|
return partial || sawSome;
|
|
7612
7897
|
}
|
|
7613
|
-
|
|
7614
|
-
|
|
7898
|
+
return !!this.#matchGlobStarBodySections(file, segments, file.length - fileTailMatch, fileIndex, 0, partial, 0, !!fileTailMatch, /* @__PURE__ */ new Set());
|
|
7899
|
+
}
|
|
7900
|
+
#getGlobstarParts(pattern, partial, patternIndex) {
|
|
7901
|
+
let byStart = this.#globstarParts.get(pattern);
|
|
7902
|
+
if (!byStart) {
|
|
7903
|
+
byStart = [];
|
|
7904
|
+
this.#globstarParts.set(pattern, byStart);
|
|
7905
|
+
}
|
|
7906
|
+
const key = patternIndex * 2 + (partial ? 1 : 0);
|
|
7907
|
+
const found = byStart[key];
|
|
7908
|
+
if (found) return found;
|
|
7909
|
+
const firstgs = pattern.indexOf(exports.GLOBSTAR, patternIndex);
|
|
7910
|
+
const lastgs = pattern.lastIndexOf(exports.GLOBSTAR);
|
|
7911
|
+
const head = pattern.slice(patternIndex, firstgs);
|
|
7912
|
+
const body = pattern.slice(firstgs + 1, partial ? void 0 : lastgs);
|
|
7913
|
+
const tail = partial ? [] : pattern.slice(lastgs + 1);
|
|
7914
|
+
const segments = [[[], 0]];
|
|
7915
|
+
let current = segments[0];
|
|
7615
7916
|
let nonGsParts = 0;
|
|
7616
7917
|
const nonGsPartsSums = [0];
|
|
7617
7918
|
for (const b of body) if (b === exports.GLOBSTAR) {
|
|
7618
7919
|
nonGsPartsSums.push(nonGsParts);
|
|
7619
|
-
|
|
7620
|
-
|
|
7920
|
+
current = [[], 0];
|
|
7921
|
+
segments.push(current);
|
|
7621
7922
|
} else {
|
|
7622
|
-
|
|
7923
|
+
current[0].push(b);
|
|
7623
7924
|
nonGsParts++;
|
|
7624
7925
|
}
|
|
7625
|
-
|
|
7626
|
-
|
|
7627
|
-
|
|
7628
|
-
|
|
7926
|
+
segments.forEach((b, i) => {
|
|
7927
|
+
b[1] = nonGsParts - nonGsPartsSums[i];
|
|
7928
|
+
});
|
|
7929
|
+
const parts = {
|
|
7930
|
+
head,
|
|
7931
|
+
body,
|
|
7932
|
+
tail,
|
|
7933
|
+
segments
|
|
7934
|
+
};
|
|
7935
|
+
byStart[key] = parts;
|
|
7936
|
+
return parts;
|
|
7629
7937
|
}
|
|
7630
|
-
#matchGlobStarBodySections(file, bodySegments, fileIndex, bodyIndex, partial, globStarDepth, sawTail) {
|
|
7938
|
+
#matchGlobStarBodySections(file, bodySegments, fileLength, fileIndex, bodyIndex, partial, globStarDepth, sawTail, tried) {
|
|
7631
7939
|
const bs = bodySegments[bodyIndex];
|
|
7632
7940
|
if (!bs) {
|
|
7633
|
-
|
|
7941
|
+
if (partial) return fileIndex >= fileLength || fileIndex === fileLength - 1 && file[fileIndex] === "";
|
|
7942
|
+
for (let i = fileIndex; i < fileLength; i++) {
|
|
7634
7943
|
sawTail = true;
|
|
7635
7944
|
const f = file[i];
|
|
7636
7945
|
if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) return false;
|
|
7637
7946
|
}
|
|
7638
7947
|
return sawTail;
|
|
7639
7948
|
}
|
|
7640
|
-
const [body,
|
|
7949
|
+
const [body, need] = bs;
|
|
7950
|
+
const after = partial ? fileLength : fileLength - need;
|
|
7641
7951
|
while (fileIndex <= after) {
|
|
7642
|
-
|
|
7643
|
-
|
|
7952
|
+
const key = bodyIndex * (file.length + 1) + fileIndex;
|
|
7953
|
+
if (tried.has(key)) return false;
|
|
7954
|
+
tried.add(key);
|
|
7955
|
+
if (this.#matchOne(file, body, partial, fileIndex, 0, fileIndex + body.length) && globStarDepth < this.maxGlobstarRecursion) {
|
|
7956
|
+
const sub = this.#matchGlobStarBodySections(file, bodySegments, fileLength, fileIndex + body.length, bodyIndex + 1, partial, globStarDepth + 1, sawTail, tried);
|
|
7644
7957
|
if (sub !== false) return sub;
|
|
7645
7958
|
}
|
|
7959
|
+
if (fileIndex === after) break;
|
|
7646
7960
|
const f = file[fileIndex];
|
|
7647
7961
|
if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) return false;
|
|
7648
7962
|
fileIndex++;
|
|
7649
7963
|
}
|
|
7650
7964
|
return partial || null;
|
|
7651
7965
|
}
|
|
7652
|
-
#matchOne(file, pattern, partial, fileIndex, patternIndex) {
|
|
7966
|
+
#matchOne(file, pattern, partial, fileIndex, patternIndex, fileEnd = file.length) {
|
|
7653
7967
|
let fi;
|
|
7654
7968
|
let pi;
|
|
7655
7969
|
let pl;
|
|
7656
7970
|
let fl;
|
|
7657
|
-
for (fi = fileIndex, pi = patternIndex, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
|
|
7658
|
-
this.debug("matchOne loop");
|
|
7971
|
+
for (fi = fileIndex, pi = patternIndex, fl = Math.min(fileEnd, file.length), pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
|
|
7659
7972
|
let p = pattern[pi];
|
|
7660
7973
|
let f = file[fi];
|
|
7661
|
-
this.debug(pattern, p, f);
|
|
7662
7974
|
/* c8 ignore start */
|
|
7663
7975
|
if (p === false || p === exports.GLOBSTAR) return false;
|
|
7664
7976
|
/* c8 ignore stop */
|
|
7665
|
-
|
|
7666
|
-
if (typeof p === "string") {
|
|
7667
|
-
hit = f === p;
|
|
7668
|
-
this.debug("string match", p, f, hit);
|
|
7669
|
-
} else {
|
|
7670
|
-
hit = p.test(f);
|
|
7671
|
-
this.debug("pattern match", p, f, hit);
|
|
7672
|
-
}
|
|
7673
|
-
if (!hit) return false;
|
|
7977
|
+
if (!portionMatch(p, f)) return false;
|
|
7674
7978
|
}
|
|
7675
7979
|
if (fi === fl && pi === pl) return true;
|
|
7676
7980
|
else if (fi === fl) return partial;
|
|
@@ -7686,86 +7990,51 @@ var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
7686
7990
|
const options = this.options;
|
|
7687
7991
|
if (pattern === "**") return exports.GLOBSTAR;
|
|
7688
7992
|
if (pattern === "") return "";
|
|
7689
|
-
|
|
7690
|
-
|
|
7691
|
-
if (
|
|
7692
|
-
|
|
7693
|
-
|
|
7694
|
-
|
|
7695
|
-
|
|
7696
|
-
|
|
7697
|
-
|
|
7698
|
-
|
|
7699
|
-
|
|
7700
|
-
makeRe() {
|
|
7701
|
-
if (this.regexp || this.regexp === false) return this.regexp;
|
|
7702
|
-
const set = this.set;
|
|
7703
|
-
if (!set.length) {
|
|
7704
|
-
this.regexp = false;
|
|
7705
|
-
return this.regexp;
|
|
7706
|
-
}
|
|
7707
|
-
const options = this.options;
|
|
7708
|
-
const twoStar = options.noglobstar ? star : options.dot ? twoStarDot : twoStarNoDot;
|
|
7709
|
-
const flags = new Set(options.nocase ? ["i"] : []);
|
|
7710
|
-
let re = set.map((pattern) => {
|
|
7711
|
-
const pp = pattern.map((p) => {
|
|
7712
|
-
if (p instanceof RegExp) for (const f of p.flags.split("")) flags.add(f);
|
|
7713
|
-
return typeof p === "string" ? regExpEscape(p) : p === exports.GLOBSTAR ? exports.GLOBSTAR : p._src;
|
|
7714
|
-
});
|
|
7715
|
-
pp.forEach((p, i) => {
|
|
7716
|
-
const next = pp[i + 1];
|
|
7717
|
-
const prev = pp[i - 1];
|
|
7718
|
-
if (p !== exports.GLOBSTAR || prev === exports.GLOBSTAR) return;
|
|
7719
|
-
if (prev === void 0) if (next !== void 0 && next !== exports.GLOBSTAR) pp[i + 1] = "(?:\\/|" + twoStar + "\\/)?" + next;
|
|
7720
|
-
else pp[i] = twoStar;
|
|
7721
|
-
else if (next === void 0) pp[i - 1] = prev + "(?:\\/|\\/" + twoStar + ")?";
|
|
7722
|
-
else if (next !== exports.GLOBSTAR) {
|
|
7723
|
-
pp[i - 1] = prev + "(?:\\/|\\/" + twoStar + "\\/)" + next;
|
|
7724
|
-
pp[i + 1] = exports.GLOBSTAR;
|
|
7725
|
-
}
|
|
7993
|
+
const { nocase, nocaseMagicOnly, noext = false, dot, normalize } = options;
|
|
7994
|
+
const lit = literal(pattern, noext);
|
|
7995
|
+
if (lit !== void 0 && !(nocase && !nocaseMagicOnly && pattern.toUpperCase() !== pattern.toLowerCase())) return this.#norm(lit);
|
|
7996
|
+
if (this.#pending) return PENDING;
|
|
7997
|
+
let m = this.#matchers.get(pattern);
|
|
7998
|
+
if (!m) {
|
|
7999
|
+
m = new nonrecursive_glob_match_1.Matcher(pattern, {
|
|
8000
|
+
nocase,
|
|
8001
|
+
noext,
|
|
8002
|
+
dot,
|
|
8003
|
+
normalize
|
|
7726
8004
|
});
|
|
7727
|
-
|
|
7728
|
-
if (this.partial && filtered.length >= 1) {
|
|
7729
|
-
const prefixes = [];
|
|
7730
|
-
for (let i = 1; i <= filtered.length; i++) prefixes.push(filtered.slice(0, i).join("/"));
|
|
7731
|
-
return "(?:" + prefixes.join("|") + ")";
|
|
7732
|
-
}
|
|
7733
|
-
return filtered.join("/");
|
|
7734
|
-
}).join("|");
|
|
7735
|
-
const [open, close] = set.length > 1 ? ["(?:", ")"] : ["", ""];
|
|
7736
|
-
re = "^" + open + re + close + "$";
|
|
7737
|
-
if (this.partial) re = "^(?:\\/|" + open + re.slice(1, -1) + close + ")$";
|
|
7738
|
-
if (this.negate) re = "^(?!" + re + ").+$";
|
|
7739
|
-
try {
|
|
7740
|
-
this.regexp = new RegExp(re, [...flags].join(""));
|
|
7741
|
-
} catch {
|
|
7742
|
-
this.regexp = false;
|
|
8005
|
+
this.#matchers.set(pattern, m);
|
|
7743
8006
|
}
|
|
7744
|
-
|
|
7745
|
-
return this.regexp;
|
|
8007
|
+
return m;
|
|
7746
8008
|
}
|
|
7747
|
-
slashSplit(p) {
|
|
8009
|
+
#slashSplit(p) {
|
|
7748
8010
|
if (this.preserveMultipleSlashes) return p.split("/");
|
|
7749
8011
|
else if (this.isWindows && /^\/\/[^/]+/.test(p)) return ["", ...p.split(/\/+/)];
|
|
7750
8012
|
else return p.split(/\/+/);
|
|
7751
8013
|
}
|
|
7752
8014
|
match(f, partial = this.partial) {
|
|
7753
|
-
this.debug("match", f, this.pattern);
|
|
7754
8015
|
if (this.comment) return false;
|
|
7755
8016
|
if (this.empty) return f === "";
|
|
7756
8017
|
if (f === "/" && partial) return true;
|
|
7757
8018
|
const options = this.options;
|
|
7758
|
-
|
|
7759
|
-
|
|
7760
|
-
|
|
8019
|
+
let split = this.#cachedSplit(f);
|
|
8020
|
+
if (!split) {
|
|
8021
|
+
if (!partial && !this.#form && (this.#endCheck || this.#literalCheck) && lastChecked !== f) {
|
|
8022
|
+
lastChecked = f;
|
|
8023
|
+
const can = this.#canMatch(f);
|
|
8024
|
+
if (can === "no") return options.flipNegate ? false : this.negate;
|
|
8025
|
+
if (can === "yes") return options.flipNegate ? true : !this.negate;
|
|
8026
|
+
}
|
|
8027
|
+
split = this.#split(f);
|
|
8028
|
+
}
|
|
8029
|
+
const ff = split.parts;
|
|
8030
|
+
const resolved = this.#level2 ? split.resolved ??= this.#levelTwoFileOptimize(ff) : ff;
|
|
7761
8031
|
const set = this.set;
|
|
7762
|
-
this.debug(this.pattern, "set", set);
|
|
7763
8032
|
let filename = ff[ff.length - 1];
|
|
7764
8033
|
if (!filename) for (let i = ff.length - 2; !filename && i >= 0; i--) filename = ff[i];
|
|
7765
|
-
for (
|
|
7766
|
-
|
|
7767
|
-
|
|
7768
|
-
if (this.
|
|
8034
|
+
for (let r = 0; r < set.length; r++) {
|
|
8035
|
+
const pattern = set[r];
|
|
8036
|
+
const shape = partial ? void 0 : this.#shapes[r];
|
|
8037
|
+
if (shape === "base" ? portionMatch(pattern[0], filename) : shape ? this.#matchShape(resolved, pattern, shape) : options.matchBase && pattern.length === 1 ? this.#matchRow([filename], [filename], pattern, partial) : this.#matchRow(ff, resolved, pattern, partial)) {
|
|
7769
8038
|
if (options.flipNegate) return true;
|
|
7770
8039
|
return !this.negate;
|
|
7771
8040
|
}
|
|
@@ -7779,13 +8048,6 @@ var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
7779
8048
|
};
|
|
7780
8049
|
exports.Minimatch = Minimatch;
|
|
7781
8050
|
/* c8 ignore start */
|
|
7782
|
-
var ast_js_2 = require_ast$1();
|
|
7783
|
-
Object.defineProperty(exports, "AST", {
|
|
7784
|
-
enumerable: true,
|
|
7785
|
-
get: function() {
|
|
7786
|
-
return ast_js_2.AST;
|
|
7787
|
-
}
|
|
7788
|
-
});
|
|
7789
8051
|
var escape_js_2 = require_escape();
|
|
7790
8052
|
Object.defineProperty(exports, "escape", {
|
|
7791
8053
|
enumerable: true,
|
|
@@ -7801,7 +8063,6 @@ var require_commonjs$4 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
7801
8063
|
}
|
|
7802
8064
|
});
|
|
7803
8065
|
/* c8 ignore stop */
|
|
7804
|
-
exports.minimatch.AST = ast_js_1.AST;
|
|
7805
8066
|
exports.minimatch.Minimatch = Minimatch;
|
|
7806
8067
|
exports.minimatch.escape = escape_js_1.escape;
|
|
7807
8068
|
exports.minimatch.unescape = unescape_js_1.unescape;
|
|
@@ -9830,7 +10091,7 @@ while (this[FLUSHCHUNK](this[BUFFERSHIFT]()) && this[BUFFER].length);
|
|
|
9830
10091
|
exports.Minipass = Minipass;
|
|
9831
10092
|
}));
|
|
9832
10093
|
//#endregion
|
|
9833
|
-
//#region ../../node_modules/path-scurry/dist/commonjs/index.js
|
|
10094
|
+
//#region ../../node_modules/glob/node_modules/path-scurry/dist/commonjs/index.js
|
|
9834
10095
|
var require_commonjs$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
9835
10096
|
var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
9836
10097
|
if (k2 === void 0) k2 = k;
|
|
@@ -9854,15 +10115,25 @@ var require_commonjs$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
9854
10115
|
}) : function(o, v) {
|
|
9855
10116
|
o["default"] = v;
|
|
9856
10117
|
});
|
|
9857
|
-
var __importStar = exports && exports.__importStar || function(
|
|
9858
|
-
|
|
9859
|
-
|
|
9860
|
-
|
|
9861
|
-
|
|
9862
|
-
|
|
9863
|
-
|
|
9864
|
-
|
|
9865
|
-
|
|
10118
|
+
var __importStar = exports && exports.__importStar || (function() {
|
|
10119
|
+
var ownKeys = function(o) {
|
|
10120
|
+
ownKeys = Object.getOwnPropertyNames || function(o) {
|
|
10121
|
+
var ar = [];
|
|
10122
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
10123
|
+
return ar;
|
|
10124
|
+
};
|
|
10125
|
+
return ownKeys(o);
|
|
10126
|
+
};
|
|
10127
|
+
return function(mod) {
|
|
10128
|
+
if (mod && mod.__esModule) return mod;
|
|
10129
|
+
var result = {};
|
|
10130
|
+
if (mod != null) {
|
|
10131
|
+
for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
10132
|
+
}
|
|
10133
|
+
__setModuleDefault(result, mod);
|
|
10134
|
+
return result;
|
|
10135
|
+
};
|
|
10136
|
+
})();
|
|
9866
10137
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9867
10138
|
exports.PathScurry = exports.Path = exports.PathScurryDarwin = exports.PathScurryPosix = exports.PathScurryWin32 = exports.PathScurryBase = exports.PathPosix = exports.PathWin32 = exports.PathBase = exports.ChildrenCache = exports.ResolveCache = void 0;
|
|
9868
10139
|
const lru_cache_1 = require_commonjs$3();
|
|
@@ -9891,12 +10162,17 @@ var require_commonjs$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
9891
10162
|
...fsOption,
|
|
9892
10163
|
promises: {
|
|
9893
10164
|
...defaultFS.promises,
|
|
9894
|
-
...fsOption.promises
|
|
10165
|
+
...fsOption.promises
|
|
9895
10166
|
}
|
|
9896
10167
|
};
|
|
9897
10168
|
const uncDriveRegexp = /^\\\\\?\\([a-z]:)\\?$/i;
|
|
9898
|
-
const
|
|
9899
|
-
const
|
|
10169
|
+
const uncLongRegexp = /^\\\\\?\\UNC\\([^\\]+\\[^\\]+)\\?$/i;
|
|
10170
|
+
const uncShareRegexp = /^\\\\[^\\?]+\\[^\\]+$/;
|
|
10171
|
+
const uncToDrive = (rootPath) => rootPath.replace(/\//g, "\\").replace(uncDriveRegexp, "$1\\").replace(uncLongRegexp, "\\\\$1\\").replace(uncShareRegexp, "$&\\");
|
|
10172
|
+
const longUncRoot = /^[\\/]{2}\?[\\/]unc[\\/][^\\/]+[\\/][^\\/]+(?:[\\/]|$)/i;
|
|
10173
|
+
const longDrivePrefix = /^[\\/]{2}\?[\\/](?=[a-z]:)/i;
|
|
10174
|
+
const longUncPrefix = /^[\\/]{2}\?[\\/]unc(?=[\\/][^\\/]+[\\/][^\\/])/i;
|
|
10175
|
+
const eitherSep = /[\\/]/;
|
|
9900
10176
|
const UNKNOWN = 0;
|
|
9901
10177
|
const IFIFO = 1;
|
|
9902
10178
|
const IFCHR = 2;
|
|
@@ -10133,6 +10409,15 @@ var require_commonjs$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
10133
10409
|
else this.#fs = fsFromOption(opts.fs);
|
|
10134
10410
|
}
|
|
10135
10411
|
/**
|
|
10412
|
+
* The file system methods that this Path uses, for a new root on
|
|
10413
|
+
* another drive or UNC share.
|
|
10414
|
+
*
|
|
10415
|
+
* @internal
|
|
10416
|
+
*/
|
|
10417
|
+
get fs() {
|
|
10418
|
+
return this.#fs;
|
|
10419
|
+
}
|
|
10420
|
+
/**
|
|
10136
10421
|
* Returns the depth of the Path object from its root.
|
|
10137
10422
|
*
|
|
10138
10423
|
* For example, a path at `/foo/bar` would have a depth of 2.
|
|
@@ -10722,7 +11007,7 @@ var require_commonjs$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
10722
11007
|
try {
|
|
10723
11008
|
const rp = await this.#fs.promises.realpath(this.fullpath());
|
|
10724
11009
|
return this.#realpath = this.resolve(rp);
|
|
10725
|
-
} catch
|
|
11010
|
+
} catch {
|
|
10726
11011
|
this.#markENOREALPATH();
|
|
10727
11012
|
}
|
|
10728
11013
|
}
|
|
@@ -10735,7 +11020,7 @@ var require_commonjs$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
10735
11020
|
try {
|
|
10736
11021
|
const rp = this.#fs.realpathSync(this.fullpath());
|
|
10737
11022
|
return this.#realpath = this.resolve(rp);
|
|
10738
|
-
} catch
|
|
11023
|
+
} catch {
|
|
10739
11024
|
this.#markENOREALPATH();
|
|
10740
11025
|
}
|
|
10741
11026
|
}
|
|
@@ -10802,23 +11087,25 @@ var require_commonjs$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
10802
11087
|
* @internal
|
|
10803
11088
|
*/
|
|
10804
11089
|
getRootString(path) {
|
|
10805
|
-
return node_path_1$1.win32.parse(path).root;
|
|
11090
|
+
return longUncRoot.exec(path)?.[0] ?? node_path_1$1.win32.parse(path).root;
|
|
10806
11091
|
}
|
|
10807
11092
|
/**
|
|
10808
11093
|
* @internal
|
|
10809
11094
|
*/
|
|
10810
11095
|
getRoot(rootPath) {
|
|
10811
11096
|
rootPath = uncToDrive(rootPath.toUpperCase());
|
|
10812
|
-
if (rootPath === this.root.name) return this.root;
|
|
11097
|
+
if (rootPath === this.root.name || /^[\\/]$/.test(rootPath)) return this.root;
|
|
10813
11098
|
for (const [compare, root] of Object.entries(this.roots)) if (this.sameRoot(rootPath, compare)) return this.roots[rootPath] = root;
|
|
10814
|
-
return this.roots[rootPath] = new PathScurryWin32(rootPath,
|
|
11099
|
+
return this.roots[rootPath] = new PathScurryWin32(rootPath, {
|
|
11100
|
+
nocase: this.nocase,
|
|
11101
|
+
fs: this.fs
|
|
11102
|
+
}).root;
|
|
10815
11103
|
}
|
|
10816
11104
|
/**
|
|
10817
11105
|
* @internal
|
|
10818
11106
|
*/
|
|
10819
11107
|
sameRoot(rootPath, compare = this.root.name) {
|
|
10820
|
-
|
|
10821
|
-
return rootPath === compare;
|
|
11108
|
+
return uncToDrive(rootPath.toUpperCase()) === compare;
|
|
10822
11109
|
}
|
|
10823
11110
|
};
|
|
10824
11111
|
exports.PathWin32 = PathWin32;
|
|
@@ -11346,6 +11633,7 @@ var require_commonjs$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
11346
11633
|
sep = "\\";
|
|
11347
11634
|
constructor(cwd = process.cwd(), opts = {}) {
|
|
11348
11635
|
const { nocase = true } = opts;
|
|
11636
|
+
if (typeof cwd === "string" && !cwd.startsWith("file://")) cwd = cwd.replace(longDrivePrefix, "").replace(longUncPrefix, "\\");
|
|
11349
11637
|
super(cwd, node_path_1$1.win32, "\\", {
|
|
11350
11638
|
...opts,
|
|
11351
11639
|
nocase
|
|
@@ -11478,26 +11766,17 @@ var require_pattern = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
11478
11766
|
this.#platform = platform;
|
|
11479
11767
|
if (this.#index === 0) {
|
|
11480
11768
|
if (this.isUNC()) {
|
|
11481
|
-
const
|
|
11482
|
-
const
|
|
11769
|
+
const n = this.#isLongUNC() ? 6 : 4;
|
|
11770
|
+
const proot = this.#patternList.slice(0, n);
|
|
11771
|
+
const groot = this.#globList.slice(0, n);
|
|
11772
|
+
const prest = this.#patternList.slice(n);
|
|
11773
|
+
const grest = this.#globList.slice(n);
|
|
11483
11774
|
if (prest[0] === "") {
|
|
11484
11775
|
prest.shift();
|
|
11485
11776
|
grest.shift();
|
|
11486
11777
|
}
|
|
11487
|
-
const p = [
|
|
11488
|
-
|
|
11489
|
-
p1,
|
|
11490
|
-
p2,
|
|
11491
|
-
p3,
|
|
11492
|
-
""
|
|
11493
|
-
].join("/");
|
|
11494
|
-
const g = [
|
|
11495
|
-
g0,
|
|
11496
|
-
g1,
|
|
11497
|
-
g2,
|
|
11498
|
-
g3,
|
|
11499
|
-
""
|
|
11500
|
-
].join("/");
|
|
11778
|
+
const p = [...proot, ""].join("/");
|
|
11779
|
+
const g = [...groot, ""].join("/");
|
|
11501
11780
|
this.#patternList = [p, ...prest];
|
|
11502
11781
|
this.#globList = [g, ...grest];
|
|
11503
11782
|
this.length = this.#patternList.length;
|
|
@@ -11508,8 +11787,8 @@ var require_pattern = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
11508
11787
|
prest.shift();
|
|
11509
11788
|
grest.shift();
|
|
11510
11789
|
}
|
|
11511
|
-
const p = p1
|
|
11512
|
-
const g = g1
|
|
11790
|
+
const p = `${p1}/`;
|
|
11791
|
+
const g = `${g1}/`;
|
|
11513
11792
|
this.#patternList = [p, ...prest];
|
|
11514
11793
|
this.#globList = [g, ...grest];
|
|
11515
11794
|
this.length = this.#patternList.length;
|
|
@@ -11517,7 +11796,7 @@ var require_pattern = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
11517
11796
|
}
|
|
11518
11797
|
}
|
|
11519
11798
|
[customInspect]() {
|
|
11520
|
-
return
|
|
11799
|
+
return `Pattern <${this.#globList.slice(this.#index).join("/")}>`;
|
|
11521
11800
|
}
|
|
11522
11801
|
/**
|
|
11523
11802
|
* The first entry in the parsed list of patterns
|
|
@@ -11538,10 +11817,10 @@ var require_pattern = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
11538
11817
|
return this.#patternList[this.#index] === minimatch_1.GLOBSTAR;
|
|
11539
11818
|
}
|
|
11540
11819
|
/**
|
|
11541
|
-
* true if pattern() returns a
|
|
11820
|
+
* true if pattern() returns a Matcher, for a portion with magic
|
|
11542
11821
|
*/
|
|
11543
|
-
|
|
11544
|
-
return this.#patternList[this.#index]
|
|
11822
|
+
isMatcher() {
|
|
11823
|
+
return typeof this.#patternList[this.#index] === "object";
|
|
11545
11824
|
}
|
|
11546
11825
|
/**
|
|
11547
11826
|
* The /-joined set of glob parts that make up this pattern
|
|
@@ -11567,12 +11846,17 @@ var require_pattern = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
11567
11846
|
this.#rest.#isDrive = this.#isDrive;
|
|
11568
11847
|
return this.#rest;
|
|
11569
11848
|
}
|
|
11849
|
+
#isLongUNC() {
|
|
11850
|
+
const pl = this.#patternList;
|
|
11851
|
+
return pl[2] === "?" && typeof pl[3] === "string" && /^unc$/i.test(pl[3]);
|
|
11852
|
+
}
|
|
11570
11853
|
/**
|
|
11571
11854
|
* true if the pattern represents a //unc/path/ on windows
|
|
11572
11855
|
*/
|
|
11573
11856
|
isUNC() {
|
|
11574
11857
|
const pl = this.#patternList;
|
|
11575
|
-
|
|
11858
|
+
const h = this.#isLongUNC() ? 4 : 2;
|
|
11859
|
+
return this.#isUNC !== void 0 ? this.#isUNC : this.#isUNC = this.#platform === "win32" && this.#index === 0 && pl[0] === "" && pl[1] === "" && typeof pl[h] === "string" && !!pl[h] && typeof pl[h + 1] === "string" && !!pl[h + 1];
|
|
11576
11860
|
}
|
|
11577
11861
|
/**
|
|
11578
11862
|
* True if the pattern starts with a drive letter on Windows
|
|
@@ -11630,23 +11914,39 @@ var require_ignore = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
11630
11914
|
absoluteChildren;
|
|
11631
11915
|
platform;
|
|
11632
11916
|
mmopts;
|
|
11633
|
-
|
|
11917
|
+
/**
|
|
11918
|
+
* The escaped glob for the directory that a pattern starting with
|
|
11919
|
+
* `/` is rooted at, with no trailing `/`.
|
|
11920
|
+
*/
|
|
11921
|
+
slashRoot;
|
|
11922
|
+
/**
|
|
11923
|
+
* Patterns that start with `/` (but not drive letters or UNC paths
|
|
11924
|
+
* on Windows) start at the `root` option if it is set, or else at
|
|
11925
|
+
* the root of `cwd`, the same as non-ignored patterns. If `cwd` is
|
|
11926
|
+
* not provided, they start at `/`.
|
|
11927
|
+
*/
|
|
11928
|
+
constructor(ignored, { nobrace, nocase, noext, noglobstar, normalize, platform = defaultPlatform, root, windowsPathsNoEscape, allowWindowsEscape }, cwd) {
|
|
11634
11929
|
this.relative = [];
|
|
11635
11930
|
this.absolute = [];
|
|
11636
11931
|
this.relativeChildren = [];
|
|
11637
11932
|
this.absoluteChildren = [];
|
|
11638
11933
|
this.platform = platform;
|
|
11934
|
+
windowsPathsNoEscape = !!windowsPathsNoEscape || allowWindowsEscape === false;
|
|
11639
11935
|
this.mmopts = {
|
|
11640
11936
|
dot: true,
|
|
11641
11937
|
nobrace,
|
|
11642
11938
|
nocase,
|
|
11643
11939
|
noext,
|
|
11644
11940
|
noglobstar,
|
|
11941
|
+
normalize,
|
|
11645
11942
|
optimizationLevel: 2,
|
|
11646
11943
|
platform,
|
|
11647
11944
|
nocomment: true,
|
|
11648
|
-
nonegate: true
|
|
11945
|
+
nonegate: true,
|
|
11946
|
+
windowsPathsNoEscape
|
|
11649
11947
|
};
|
|
11948
|
+
const slashRoot = cwd?.resolve(root ?? "/").fullpath() ?? "/";
|
|
11949
|
+
this.slashRoot = (0, minimatch_1.escape)(slashRoot.replace(/\\/g, "/").replace(/\/$/, ""), { windowsPathsNoEscape });
|
|
11650
11950
|
for (const ign of ignored) this.add(ign);
|
|
11651
11951
|
}
|
|
11652
11952
|
add(ign) {
|
|
@@ -11662,7 +11962,8 @@ var require_ignore = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
11662
11962
|
}
|
|
11663
11963
|
/* c8 ignore stop */
|
|
11664
11964
|
const p = new pattern_js_1.Pattern(parsed, globParts, 0, this.platform);
|
|
11665
|
-
const
|
|
11965
|
+
const glob = p.root() === "/" ? `${this.slashRoot}/${p.rest()?.globString() ?? ""}` : p.globString();
|
|
11966
|
+
const m = new minimatch_1.Minimatch(glob, this.mmopts);
|
|
11666
11967
|
const children = globParts[globParts.length - 1] === "**";
|
|
11667
11968
|
const absolute = p.isAbsolute();
|
|
11668
11969
|
if (absolute) this.absolute.push(m);
|
|
@@ -11681,8 +11982,8 @@ var require_ignore = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
11681
11982
|
return false;
|
|
11682
11983
|
}
|
|
11683
11984
|
childrenIgnored(p) {
|
|
11684
|
-
const fullpath = p.fullpath()
|
|
11685
|
-
const relative =
|
|
11985
|
+
const fullpath = `${p.fullpath()}/`;
|
|
11986
|
+
const relative = `${p.relative() || "."}/`;
|
|
11686
11987
|
for (const m of this.relativeChildren) if (m.match(relative)) return true;
|
|
11687
11988
|
for (const m of this.absoluteChildren) if (m.match(fullpath)) return true;
|
|
11688
11989
|
return false;
|
|
@@ -11697,24 +11998,38 @@ var require_processor = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
11697
11998
|
exports.Processor = exports.SubWalks = exports.MatchRecord = exports.HasWalkedCache = void 0;
|
|
11698
11999
|
const minimatch_1 = require_commonjs$4();
|
|
11699
12000
|
/**
|
|
11700
|
-
* A cache of which patterns have been processed for a given Path
|
|
12001
|
+
* A cache of which patterns have been processed for a given Path, in
|
|
12002
|
+
* this walk step and the steps that led to it.
|
|
12003
|
+
*
|
|
12004
|
+
* A step only adds to it before it makes the caches for the next
|
|
12005
|
+
* steps, so a copy can look up the chain of caches before it, in
|
|
12006
|
+
* place of copying their entries. A pattern for a path that a cache
|
|
12007
|
+
* up the chain has already seen is added to that cache's set, so that
|
|
12008
|
+
* the other steps that share it see it too. Paths are keyed by their
|
|
12009
|
+
* full path, because path-scurry can make a new Path object for the
|
|
12010
|
+
* same path once its cache of children is full.
|
|
11701
12011
|
*/
|
|
11702
12012
|
var HasWalkedCache = class HasWalkedCache {
|
|
12013
|
+
parent;
|
|
11703
12014
|
store;
|
|
11704
|
-
constructor(
|
|
11705
|
-
this.
|
|
12015
|
+
constructor(parent) {
|
|
12016
|
+
this.parent = parent;
|
|
11706
12017
|
}
|
|
11707
12018
|
copy() {
|
|
11708
|
-
return new HasWalkedCache(
|
|
12019
|
+
return new HasWalkedCache(this);
|
|
12020
|
+
}
|
|
12021
|
+
#find(fullpath) {
|
|
12022
|
+
const set = this.store?.get(fullpath);
|
|
12023
|
+
return set || !this.parent ? set : this.parent.#find(fullpath);
|
|
11709
12024
|
}
|
|
11710
12025
|
hasWalked(target, pattern) {
|
|
11711
|
-
return this
|
|
12026
|
+
return !!this.#find(target.fullpath())?.has(pattern.globString());
|
|
11712
12027
|
}
|
|
11713
12028
|
storeWalked(target, pattern) {
|
|
11714
12029
|
const fullpath = target.fullpath();
|
|
11715
|
-
const cached = this
|
|
12030
|
+
const cached = this.#find(fullpath);
|
|
11716
12031
|
if (cached) cached.add(pattern.globString());
|
|
11717
|
-
else this.store.set(fullpath, new Set([pattern.globString()]));
|
|
12032
|
+
else (this.store ??= /* @__PURE__ */ new Map()).set(fullpath, new Set([pattern.globString()]));
|
|
11718
12033
|
}
|
|
11719
12034
|
};
|
|
11720
12035
|
exports.HasWalkedCache = HasWalkedCache;
|
|
@@ -11722,21 +12037,18 @@ var require_processor = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
11722
12037
|
* A record of which paths have been matched in a given walk step,
|
|
11723
12038
|
* and whether they only are considered a match if they are a directory,
|
|
11724
12039
|
* and whether their absolute or relative path should be returned.
|
|
12040
|
+
* The store maps each path to {@link MatchRecord.ABSOLUTE} and
|
|
12041
|
+
* {@link MatchRecord.IF_DIR} flags.
|
|
11725
12042
|
*/
|
|
11726
|
-
var MatchRecord = class {
|
|
12043
|
+
var MatchRecord = class MatchRecord {
|
|
12044
|
+
static ABSOLUTE = 2;
|
|
12045
|
+
static IF_DIR = 1;
|
|
11727
12046
|
store = /* @__PURE__ */ new Map();
|
|
11728
12047
|
add(target, absolute, ifDir) {
|
|
11729
|
-
const n = (absolute ?
|
|
12048
|
+
const n = (absolute ? MatchRecord.ABSOLUTE : 0) | (ifDir ? MatchRecord.IF_DIR : 0);
|
|
11730
12049
|
const current = this.store.get(target);
|
|
11731
12050
|
this.store.set(target, current === void 0 ? n : n & current);
|
|
11732
12051
|
}
|
|
11733
|
-
entries() {
|
|
11734
|
-
return [...this.store.entries()].map(([path, n]) => [
|
|
11735
|
-
path,
|
|
11736
|
-
!!(n & 2),
|
|
11737
|
-
!!(n & 1)
|
|
11738
|
-
]);
|
|
11739
|
-
}
|
|
11740
12052
|
};
|
|
11741
12053
|
exports.MatchRecord = MatchRecord;
|
|
11742
12054
|
/**
|
|
@@ -11827,7 +12139,7 @@ var require_processor = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
11827
12139
|
if (!rrest) this.matches.add(tp, absolute, true);
|
|
11828
12140
|
else if (!this.hasWalkedCache.hasWalked(tp, rrest)) this.subwalks.add(tp, rrest);
|
|
11829
12141
|
}
|
|
11830
|
-
} else if (p
|
|
12142
|
+
} else if (typeof p === "object") this.subwalks.add(t, pattern);
|
|
11831
12143
|
}
|
|
11832
12144
|
return this;
|
|
11833
12145
|
}
|
|
@@ -11845,7 +12157,7 @@ var require_processor = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
11845
12157
|
const p = pattern.pattern();
|
|
11846
12158
|
const rest = pattern.rest();
|
|
11847
12159
|
if (p === minimatch_1.GLOBSTAR) results.testGlobstar(e, pattern, rest, absolute);
|
|
11848
|
-
else if (p
|
|
12160
|
+
else if (typeof p === "object") results.testMatcher(e, p, rest, absolute);
|
|
11849
12161
|
else results.testString(e, p, rest, absolute);
|
|
11850
12162
|
}
|
|
11851
12163
|
return results;
|
|
@@ -11869,11 +12181,11 @@ var require_processor = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
11869
12181
|
const ep = e.parent || e;
|
|
11870
12182
|
/* c8 ignore stop */
|
|
11871
12183
|
this.subwalks.add(ep, rest);
|
|
11872
|
-
} else if (rp
|
|
12184
|
+
} else if (typeof rp === "object") this.testMatcher(e, rp, rest.rest(), absolute);
|
|
11873
12185
|
}
|
|
11874
12186
|
}
|
|
11875
|
-
|
|
11876
|
-
if (!p.
|
|
12187
|
+
testMatcher(e, p, rest, absolute) {
|
|
12188
|
+
if (!p.testUnchecked(e.name)) return;
|
|
11877
12189
|
if (!rest) this.matches.add(e, absolute, false);
|
|
11878
12190
|
else this.subwalks.add(e, rest);
|
|
11879
12191
|
}
|
|
@@ -11898,7 +12210,8 @@ var require_walker = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
11898
12210
|
const minipass_1 = require_commonjs$2();
|
|
11899
12211
|
const ignore_js_1 = require_ignore();
|
|
11900
12212
|
const processor_js_1 = require_processor();
|
|
11901
|
-
const
|
|
12213
|
+
const { ABSOLUTE, IF_DIR } = processor_js_1.MatchRecord;
|
|
12214
|
+
const makeIgnore = (ignore, opts, cwd) => typeof ignore === "string" ? new ignore_js_1.Ignore([ignore], opts, cwd) : Array.isArray(ignore) ? new ignore_js_1.Ignore(ignore, opts, cwd) : ignore;
|
|
11902
12215
|
/**
|
|
11903
12216
|
* basic walking utilities that all the glob walker types use
|
|
11904
12217
|
*/
|
|
@@ -11922,7 +12235,7 @@ var require_walker = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
11922
12235
|
this.#sep = !opts.posix && opts.platform === "win32" ? "\\" : "/";
|
|
11923
12236
|
this.includeChildMatches = opts.includeChildMatches !== false;
|
|
11924
12237
|
if (opts.ignore || !this.includeChildMatches) {
|
|
11925
|
-
this.#ignore = makeIgnore(opts.ignore ?? [], opts);
|
|
12238
|
+
this.#ignore = makeIgnore(opts.ignore ?? [], opts, path);
|
|
11926
12239
|
if (!this.includeChildMatches && typeof this.#ignore.add !== "function") throw new Error("cannot ignore child matches, ignore lacks add() method.");
|
|
11927
12240
|
}
|
|
11928
12241
|
/* c8 ignore start */
|
|
@@ -11953,21 +12266,21 @@ var require_walker = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
11953
12266
|
while (!this.paused && (fn = this.#onResume.shift())) fn();
|
|
11954
12267
|
}
|
|
11955
12268
|
onResume(fn) {
|
|
11956
|
-
if (this.signal?.aborted) return;
|
|
11957
12269
|
/* c8 ignore start */
|
|
11958
12270
|
if (!this.paused) fn();
|
|
11959
12271
|
else
|
|
11960
12272
|
/* c8 ignore stop */
|
|
11961
12273
|
this.#onResume.push(fn);
|
|
11962
12274
|
}
|
|
11963
|
-
async matchCheck(
|
|
12275
|
+
async matchCheck(inPath, ifDir) {
|
|
11964
12276
|
if (ifDir && this.opts.nodir) return void 0;
|
|
11965
12277
|
let rpc;
|
|
12278
|
+
let e;
|
|
11966
12279
|
if (this.opts.realpath) {
|
|
11967
|
-
rpc =
|
|
12280
|
+
rpc = inPath.realpathCached() || await inPath.realpath();
|
|
11968
12281
|
if (!rpc) return void 0;
|
|
11969
12282
|
e = rpc;
|
|
11970
|
-
}
|
|
12283
|
+
} else e = inPath;
|
|
11971
12284
|
const s = e.isUnknown() || this.opts.stat ? await e.lstat() : e;
|
|
11972
12285
|
if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) {
|
|
11973
12286
|
const target = await s.realpath();
|
|
@@ -11979,14 +12292,15 @@ var require_walker = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
11979
12292
|
matchCheckTest(e, ifDir) {
|
|
11980
12293
|
return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && (!this.opts.nodir || !this.opts.follow || !e.isSymbolicLink() || !e.realpathCached()?.isDirectory()) && !this.#ignored(e) ? e : void 0;
|
|
11981
12294
|
}
|
|
11982
|
-
matchCheckSync(
|
|
12295
|
+
matchCheckSync(inPath, ifDir) {
|
|
11983
12296
|
if (ifDir && this.opts.nodir) return void 0;
|
|
11984
12297
|
let rpc;
|
|
12298
|
+
let e;
|
|
11985
12299
|
if (this.opts.realpath) {
|
|
11986
|
-
rpc =
|
|
12300
|
+
rpc = inPath.realpathCached() || inPath.realpathSync();
|
|
11987
12301
|
if (!rpc) return void 0;
|
|
11988
12302
|
e = rpc;
|
|
11989
|
-
}
|
|
12303
|
+
} else e = inPath;
|
|
11990
12304
|
const s = e.isUnknown() || this.opts.stat ? e.lstatSync() : e;
|
|
11991
12305
|
if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) {
|
|
11992
12306
|
const target = s.realpathSync();
|
|
@@ -11996,6 +12310,9 @@ var require_walker = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
11996
12310
|
}
|
|
11997
12311
|
matchFinish(e, absolute) {
|
|
11998
12312
|
if (this.#ignored(e)) return;
|
|
12313
|
+
this.#matchEmitChecked(e, absolute);
|
|
12314
|
+
}
|
|
12315
|
+
#matchEmitChecked(e, absolute) {
|
|
11999
12316
|
if (!this.includeChildMatches && this.#ignore?.add) {
|
|
12000
12317
|
const ign = `${e.relativePosix()}/**`;
|
|
12001
12318
|
this.#ignore.add(ign);
|
|
@@ -12009,8 +12326,8 @@ var require_walker = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
12009
12326
|
this.matchEmit(abs + mark);
|
|
12010
12327
|
} else {
|
|
12011
12328
|
const rel = this.opts.posix ? e.relativePosix() : e.relative();
|
|
12012
|
-
const pre = this.opts.dotRelative && !rel.startsWith(
|
|
12013
|
-
this.matchEmit(!rel ?
|
|
12329
|
+
const pre = this.opts.dotRelative && !rel.startsWith(`..${this.#sep}`) ? `.${this.#sep}` : "";
|
|
12330
|
+
this.matchEmit(!rel ? `.${mark}` : pre + rel + mark);
|
|
12014
12331
|
}
|
|
12015
12332
|
}
|
|
12016
12333
|
async match(e, absolute, ifDir) {
|
|
@@ -12019,17 +12336,17 @@ var require_walker = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
12019
12336
|
}
|
|
12020
12337
|
matchSync(e, absolute, ifDir) {
|
|
12021
12338
|
const p = this.matchCheckSync(e, ifDir);
|
|
12022
|
-
if (p) this
|
|
12339
|
+
if (p) this.#matchEmitChecked(p, absolute);
|
|
12023
12340
|
}
|
|
12024
12341
|
walkCB(target, patterns, cb) {
|
|
12025
12342
|
/* c8 ignore start */
|
|
12026
|
-
if (this.signal?.aborted) cb();
|
|
12343
|
+
if (this.signal?.aborted) return cb();
|
|
12027
12344
|
/* c8 ignore stop */
|
|
12028
12345
|
this.walkCB2(target, patterns, new processor_js_1.Processor(this.opts), cb);
|
|
12029
12346
|
}
|
|
12030
12347
|
walkCB2(target, patterns, processor, cb) {
|
|
12031
12348
|
if (this.#childrenIgnored(target)) return cb();
|
|
12032
|
-
if (this.signal?.aborted) cb();
|
|
12349
|
+
if (this.signal?.aborted) return cb();
|
|
12033
12350
|
if (this.paused) {
|
|
12034
12351
|
this.onResume(() => this.walkCB2(target, patterns, processor, cb));
|
|
12035
12352
|
return;
|
|
@@ -12039,10 +12356,10 @@ var require_walker = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
12039
12356
|
const next = () => {
|
|
12040
12357
|
if (--tasks === 0) cb();
|
|
12041
12358
|
};
|
|
12042
|
-
for (const [m,
|
|
12359
|
+
for (const [m, n] of processor.matches.store) {
|
|
12043
12360
|
if (this.#ignored(m)) continue;
|
|
12044
12361
|
tasks++;
|
|
12045
|
-
this.match(m,
|
|
12362
|
+
this.match(m, !!(n & ABSOLUTE), !!(n & IF_DIR)).then(() => next());
|
|
12046
12363
|
}
|
|
12047
12364
|
for (const t of processor.subwalkTargets()) {
|
|
12048
12365
|
if (this.maxDepth !== Infinity && t.depth() >= this.maxDepth) continue;
|
|
@@ -12053,32 +12370,32 @@ var require_walker = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
12053
12370
|
}
|
|
12054
12371
|
next();
|
|
12055
12372
|
}
|
|
12056
|
-
walkCB3(target, entries,
|
|
12057
|
-
|
|
12373
|
+
walkCB3(target, entries, processorx, cb) {
|
|
12374
|
+
const proc = processorx.filterEntries(target, entries);
|
|
12058
12375
|
let tasks = 1;
|
|
12059
12376
|
const next = () => {
|
|
12060
12377
|
if (--tasks === 0) cb();
|
|
12061
12378
|
};
|
|
12062
|
-
for (const [m,
|
|
12379
|
+
for (const [m, n] of proc.matches.store) {
|
|
12063
12380
|
if (this.#ignored(m)) continue;
|
|
12064
12381
|
tasks++;
|
|
12065
|
-
this.match(m,
|
|
12382
|
+
this.match(m, !!(n & ABSOLUTE), !!(n & IF_DIR)).then(() => next());
|
|
12066
12383
|
}
|
|
12067
|
-
for (const [target, patterns] of
|
|
12384
|
+
for (const [target, patterns] of proc.subwalks.entries()) {
|
|
12068
12385
|
tasks++;
|
|
12069
|
-
this.walkCB2(target, patterns,
|
|
12386
|
+
this.walkCB2(target, patterns, proc.child(), next);
|
|
12070
12387
|
}
|
|
12071
12388
|
next();
|
|
12072
12389
|
}
|
|
12073
12390
|
walkCBSync(target, patterns, cb) {
|
|
12074
12391
|
/* c8 ignore start */
|
|
12075
|
-
if (this.signal?.aborted) cb();
|
|
12392
|
+
if (this.signal?.aborted) return cb();
|
|
12076
12393
|
/* c8 ignore stop */
|
|
12077
12394
|
this.walkCB2Sync(target, patterns, new processor_js_1.Processor(this.opts), cb);
|
|
12078
12395
|
}
|
|
12079
12396
|
walkCB2Sync(target, patterns, processor, cb) {
|
|
12080
12397
|
if (this.#childrenIgnored(target)) return cb();
|
|
12081
|
-
if (this.signal?.aborted) cb();
|
|
12398
|
+
if (this.signal?.aborted) return cb();
|
|
12082
12399
|
if (this.paused) {
|
|
12083
12400
|
this.onResume(() => this.walkCB2Sync(target, patterns, processor, cb));
|
|
12084
12401
|
return;
|
|
@@ -12088,9 +12405,9 @@ var require_walker = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
12088
12405
|
const next = () => {
|
|
12089
12406
|
if (--tasks === 0) cb();
|
|
12090
12407
|
};
|
|
12091
|
-
for (const [m,
|
|
12408
|
+
for (const [m, n] of processor.matches.store) {
|
|
12092
12409
|
if (this.#ignored(m)) continue;
|
|
12093
|
-
this.matchSync(m,
|
|
12410
|
+
this.matchSync(m, !!(n & ABSOLUTE), !!(n & IF_DIR));
|
|
12094
12411
|
}
|
|
12095
12412
|
for (const t of processor.subwalkTargets()) {
|
|
12096
12413
|
if (this.maxDepth !== Infinity && t.depth() >= this.maxDepth) continue;
|
|
@@ -12101,30 +12418,30 @@ var require_walker = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
12101
12418
|
next();
|
|
12102
12419
|
}
|
|
12103
12420
|
walkCB3Sync(target, entries, processor, cb) {
|
|
12104
|
-
|
|
12421
|
+
const proc = processor.filterEntries(target, entries);
|
|
12105
12422
|
let tasks = 1;
|
|
12106
12423
|
const next = () => {
|
|
12107
12424
|
if (--tasks === 0) cb();
|
|
12108
12425
|
};
|
|
12109
|
-
for (const [m,
|
|
12426
|
+
for (const [m, n] of proc.matches.store) {
|
|
12110
12427
|
if (this.#ignored(m)) continue;
|
|
12111
|
-
this.matchSync(m,
|
|
12428
|
+
this.matchSync(m, !!(n & ABSOLUTE), !!(n & IF_DIR));
|
|
12112
12429
|
}
|
|
12113
|
-
for (const [target, patterns] of
|
|
12430
|
+
for (const [target, patterns] of proc.subwalks.entries()) {
|
|
12114
12431
|
tasks++;
|
|
12115
|
-
this.walkCB2Sync(target, patterns,
|
|
12432
|
+
this.walkCB2Sync(target, patterns, proc.child(), next);
|
|
12116
12433
|
}
|
|
12117
12434
|
next();
|
|
12118
12435
|
}
|
|
12119
12436
|
};
|
|
12120
12437
|
exports.GlobUtil = GlobUtil;
|
|
12121
12438
|
var GlobWalker = class extends GlobUtil {
|
|
12122
|
-
matches =
|
|
12439
|
+
matches = [];
|
|
12123
12440
|
constructor(patterns, path, opts) {
|
|
12124
12441
|
super(patterns, path, opts);
|
|
12125
12442
|
}
|
|
12126
12443
|
matchEmit(e) {
|
|
12127
|
-
this.matches.
|
|
12444
|
+
this.matches.push(e);
|
|
12128
12445
|
}
|
|
12129
12446
|
async walk() {
|
|
12130
12447
|
if (this.signal?.aborted) throw this.signal.reason;
|
|
@@ -12265,14 +12582,14 @@ var require_glob$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
12265
12582
|
this.stat = !!opts.stat;
|
|
12266
12583
|
this.ignore = opts.ignore;
|
|
12267
12584
|
if (this.withFileTypes && this.absolute !== void 0) throw new Error("cannot set absolute and withFileTypes:true");
|
|
12268
|
-
|
|
12585
|
+
let p = typeof pattern === "string" ? [pattern] : pattern;
|
|
12269
12586
|
this.windowsPathsNoEscape = !!opts.windowsPathsNoEscape || opts.allowWindowsEscape === false;
|
|
12270
|
-
if (this.windowsPathsNoEscape)
|
|
12587
|
+
if (this.windowsPathsNoEscape) p = p.map((p) => p.replace(/\\/g, "/"));
|
|
12271
12588
|
if (this.matchBase) {
|
|
12272
12589
|
if (opts.noglobstar) throw new TypeError("base matching requires globstar");
|
|
12273
|
-
|
|
12590
|
+
p = p.map((p) => p.includes("/") ? p : `./**/${p}`);
|
|
12274
12591
|
}
|
|
12275
|
-
this.pattern =
|
|
12592
|
+
this.pattern = p;
|
|
12276
12593
|
this.platform = opts.platform || defaultPlatform;
|
|
12277
12594
|
this.opts = {
|
|
12278
12595
|
...opts,
|
|
@@ -12300,8 +12617,7 @@ var require_glob$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
12300
12617
|
nonegate: true,
|
|
12301
12618
|
optimizationLevel: 2,
|
|
12302
12619
|
platform: this.platform,
|
|
12303
|
-
windowsPathsNoEscape: this.windowsPathsNoEscape
|
|
12304
|
-
debug: !!this.opts.debug
|
|
12620
|
+
windowsPathsNoEscape: this.windowsPathsNoEscape
|
|
12305
12621
|
};
|
|
12306
12622
|
const [matchSet, globParts] = this.pattern.map((p) => new minimatch_1.Minimatch(p, mmo)).reduce((set, m) => {
|
|
12307
12623
|
set[0].push(...m.set);
|
|
@@ -12317,22 +12633,22 @@ var require_glob$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
12317
12633
|
});
|
|
12318
12634
|
}
|
|
12319
12635
|
async walk() {
|
|
12320
|
-
return
|
|
12636
|
+
return await new walker_js_1.GlobWalker(this.patterns, this.scurry.cwd, {
|
|
12321
12637
|
...this.opts,
|
|
12322
12638
|
maxDepth: this.maxDepth !== Infinity ? this.maxDepth + this.scurry.cwd.depth() : Infinity,
|
|
12323
12639
|
platform: this.platform,
|
|
12324
12640
|
nocase: this.nocase,
|
|
12325
12641
|
includeChildMatches: this.includeChildMatches
|
|
12326
|
-
}).walk()
|
|
12642
|
+
}).walk();
|
|
12327
12643
|
}
|
|
12328
12644
|
walkSync() {
|
|
12329
|
-
return
|
|
12645
|
+
return new walker_js_1.GlobWalker(this.patterns, this.scurry.cwd, {
|
|
12330
12646
|
...this.opts,
|
|
12331
12647
|
maxDepth: this.maxDepth !== Infinity ? this.maxDepth + this.scurry.cwd.depth() : Infinity,
|
|
12332
12648
|
platform: this.platform,
|
|
12333
12649
|
nocase: this.nocase,
|
|
12334
12650
|
includeChildMatches: this.includeChildMatches
|
|
12335
|
-
}).walkSync()
|
|
12651
|
+
}).walkSync();
|
|
12336
12652
|
}
|
|
12337
12653
|
stream() {
|
|
12338
12654
|
return new walker_js_1.GlobStream(this.patterns, this.scurry.cwd, {
|
|
@@ -12393,8 +12709,7 @@ var require_has_magic = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
12393
12709
|
* is in the options, brace expansion _is_ treated as a pattern having magic.
|
|
12394
12710
|
*/
|
|
12395
12711
|
const hasMagic = (pattern, options = {}) => {
|
|
12396
|
-
|
|
12397
|
-
for (const p of pattern) if (new minimatch_1.Minimatch(p, options).hasMagic()) return true;
|
|
12712
|
+
for (const p of Array.isArray(pattern) ? pattern : [pattern]) if (new minimatch_1.Minimatch(p, options).hasMagic()) return true;
|
|
12398
12713
|
return false;
|
|
12399
12714
|
};
|
|
12400
12715
|
exports.hasMagic = hasMagic;
|
|
@@ -12586,7 +12901,7 @@ var require_glob = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
12586
12901
|
var require_package$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
12587
12902
|
module.exports = {
|
|
12588
12903
|
"name": "@datadog/datadog-ci-base",
|
|
12589
|
-
"version": "5.
|
|
12904
|
+
"version": "5.27.0",
|
|
12590
12905
|
"description": "Base package for Datadog CI",
|
|
12591
12906
|
"license": "Apache-2.0",
|
|
12592
12907
|
"keywords": ["datadog", "datadog-ci"],
|
|
@@ -12688,7 +13003,7 @@ var require_package$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
12688
13003
|
"deep-extend": "^0.6.0",
|
|
12689
13004
|
"fast-xml-parser": "^5.7.2",
|
|
12690
13005
|
"form-data": "^4.0.6",
|
|
12691
|
-
"glob": "^
|
|
13006
|
+
"glob": "^14.0.3",
|
|
12692
13007
|
"inquirer": "^8.2.7",
|
|
12693
13008
|
"is-docker": "^4.0.0",
|
|
12694
13009
|
"jest-diff": "^30.2.0",
|
|
@@ -12700,7 +13015,7 @@ var require_package$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
12700
13015
|
"terminal-link": "^2.1.1",
|
|
12701
13016
|
"tiny-async-pool": "^2.1.0",
|
|
12702
13017
|
"typanion": "^3.14.0",
|
|
12703
|
-
"undici": "^7.
|
|
13018
|
+
"undici": "^7.30.1",
|
|
12704
13019
|
"upath": "^2.0.1",
|
|
12705
13020
|
"webpack-sources": "^3.5.1"
|
|
12706
13021
|
},
|
|
@@ -19034,6 +19349,8 @@ var require_ipv4 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
19034
19349
|
* address.correctForm(); // '192.0.2.42'
|
|
19035
19350
|
*/
|
|
19036
19351
|
static fromArpa(arpaFormAddress) {
|
|
19352
|
+
const longest = constants.GROUPS * 4 - 1 + 3 + 14;
|
|
19353
|
+
if (arpaFormAddress.length > longest) throw new address_error_1.AddressError(`in-addr.arpa names are at most ${longest} characters.`);
|
|
19037
19354
|
return new Address4(arpaFormAddress.replace(/(\.in-addr\.arpa)?\.?$/i, "").split(".").reverse().join("."));
|
|
19038
19355
|
}
|
|
19039
19356
|
/**
|
|
@@ -19454,6 +19771,9 @@ var require_constants$6 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
19454
19771
|
* A regular expression that matches an IPv6 zone
|
|
19455
19772
|
* @memberof Address6
|
|
19456
19773
|
* @static
|
|
19774
|
+
* @deprecated Takes quadratic time on input holding many `%` characters
|
|
19775
|
+
* followed by a line terminator. The library finds the zone by index, as
|
|
19776
|
+
* `Address6`'s constructor shows, and 11.0.0 removes this export.
|
|
19457
19777
|
*/
|
|
19458
19778
|
exports.RE_ZONE_STRING = /%.*$/;
|
|
19459
19779
|
exports.RE_URL = /^(?:\[([0-9a-f:.]+)\]|([0-9a-f:.]+))(?:[/?#].*)?$/i;
|
|
@@ -19843,10 +20163,10 @@ var require_ipv6 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
19843
20163
|
address = address.replace(constants6.RE_SUBNET_STRING, "");
|
|
19844
20164
|
}
|
|
19845
20165
|
if (/\//.test(address)) throw new address_error_1.AddressError("Invalid subnet mask.");
|
|
19846
|
-
const
|
|
19847
|
-
if (
|
|
19848
|
-
this.zone =
|
|
19849
|
-
address = address.
|
|
20166
|
+
const zoneStart = address.indexOf("%");
|
|
20167
|
+
if (zoneStart !== -1 && /^.*$/.test(address.slice(zoneStart))) {
|
|
20168
|
+
this.zone = address.slice(zoneStart);
|
|
20169
|
+
address = address.slice(0, zoneStart);
|
|
19850
20170
|
}
|
|
19851
20171
|
const longest = this.groups * 5 + 5;
|
|
19852
20172
|
if (address.length > longest) throw new address_error_1.AddressError(`IPv6 addresses are at most ${longest} characters.`);
|
|
@@ -24036,6 +24356,7 @@ var require_FtpContext = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
24036
24356
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24037
24357
|
exports.FTPContext = exports.FTPError = void 0;
|
|
24038
24358
|
const net_1$1 = require("net");
|
|
24359
|
+
const tls_1$3 = require("tls");
|
|
24039
24360
|
const parseControlResponse_1 = require_parseControlResponse();
|
|
24040
24361
|
/**
|
|
24041
24362
|
* Describes an FTP server error response including the FTP response code.
|
|
@@ -24074,6 +24395,8 @@ var require_FtpContext = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
24074
24395
|
this.ipFamily = void 0;
|
|
24075
24396
|
/** Options for TLS connections. */
|
|
24076
24397
|
this.tlsOptions = {};
|
|
24398
|
+
/** Most recent TLS session from the control connection, used to resume the session on data connections. */
|
|
24399
|
+
this.tlsSessionStore = void 0;
|
|
24077
24400
|
/** A multiline response might be received as multiple chunks. */
|
|
24078
24401
|
this._partialResponse = "";
|
|
24079
24402
|
this._encoding = encoding;
|
|
@@ -24124,6 +24447,7 @@ var require_FtpContext = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
24124
24447
|
set socket(socket) {
|
|
24125
24448
|
this.dataSocket = void 0;
|
|
24126
24449
|
this.tlsOptions = {};
|
|
24450
|
+
this.tlsSessionStore = void 0;
|
|
24127
24451
|
this._partialResponse = "";
|
|
24128
24452
|
if (this._socket) if (socket.localPort === this._socket.localPort) this._removeSocketListeners(this.socket);
|
|
24129
24453
|
else this._closeControlSocket();
|
|
@@ -24138,6 +24462,9 @@ var require_FtpContext = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
24138
24462
|
if (!hadError) this.closeWithError(/* @__PURE__ */ new Error("Server closed connection unexpectedly."));
|
|
24139
24463
|
});
|
|
24140
24464
|
this._setupDefaultErrorHandlers(socket, "control socket");
|
|
24465
|
+
if (socket instanceof tls_1$3.TLSSocket) socket.on("session", (session) => {
|
|
24466
|
+
this.tlsSessionStore = session;
|
|
24467
|
+
});
|
|
24141
24468
|
}
|
|
24142
24469
|
this._socket = socket;
|
|
24143
24470
|
}
|
|
@@ -24178,9 +24505,9 @@ var require_FtpContext = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
24178
24505
|
* Send an FTP command without waiting for or handling the result.
|
|
24179
24506
|
*/
|
|
24180
24507
|
send(command) {
|
|
24181
|
-
|
|
24182
|
-
|
|
24183
|
-
this.log(
|
|
24508
|
+
const description = command.startsWith("PASS") ? "PASS ###" : command;
|
|
24509
|
+
if (/[\r\n\0]/.test(command)) throw new Error(`Invalid command: Contains control characters. (${description})`);
|
|
24510
|
+
this.log(`> ${description}`);
|
|
24184
24511
|
this._socket.write(command + "\r\n", this.encoding);
|
|
24185
24512
|
}
|
|
24186
24513
|
/**
|
|
@@ -24204,16 +24531,22 @@ var require_FtpContext = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
24204
24531
|
this.closeWithError(err);
|
|
24205
24532
|
}
|
|
24206
24533
|
return new Promise((resolveTask, rejectTask) => {
|
|
24534
|
+
let settled = false;
|
|
24535
|
+
const stopTrackingOnce = () => {
|
|
24536
|
+
if (settled) return;
|
|
24537
|
+
settled = true;
|
|
24538
|
+
this._stopTrackingTask();
|
|
24539
|
+
};
|
|
24207
24540
|
this._task = {
|
|
24208
24541
|
stack: (/* @__PURE__ */ new Error()).stack || "Unknown call stack",
|
|
24209
24542
|
responseHandler,
|
|
24210
24543
|
resolver: {
|
|
24211
24544
|
resolve: (arg) => {
|
|
24212
|
-
|
|
24545
|
+
stopTrackingOnce();
|
|
24213
24546
|
resolveTask(arg);
|
|
24214
24547
|
},
|
|
24215
24548
|
reject: (err) => {
|
|
24216
|
-
|
|
24549
|
+
stopTrackingOnce();
|
|
24217
24550
|
rejectTask(err);
|
|
24218
24551
|
}
|
|
24219
24552
|
}
|
|
@@ -24226,7 +24559,11 @@ var require_FtpContext = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
24226
24559
|
return;
|
|
24227
24560
|
}
|
|
24228
24561
|
this.socket.setTimeout(this.timeout);
|
|
24229
|
-
if (command)
|
|
24562
|
+
if (command) try {
|
|
24563
|
+
this.send(command);
|
|
24564
|
+
} catch (err) {
|
|
24565
|
+
this._task.resolver.reject(err);
|
|
24566
|
+
}
|
|
24230
24567
|
});
|
|
24231
24568
|
}
|
|
24232
24569
|
/**
|
|
@@ -24280,7 +24617,13 @@ var require_FtpContext = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
24280
24617
|
* @protected
|
|
24281
24618
|
*/
|
|
24282
24619
|
_passToHandler(response) {
|
|
24283
|
-
|
|
24620
|
+
const task = this._task;
|
|
24621
|
+
if (task) try {
|
|
24622
|
+
task.responseHandler(response, task.resolver);
|
|
24623
|
+
} catch (err) {
|
|
24624
|
+
task.resolver.reject(err);
|
|
24625
|
+
this.closeWithError(err);
|
|
24626
|
+
}
|
|
24284
24627
|
}
|
|
24285
24628
|
/**
|
|
24286
24629
|
* Setup all error handlers for a socket.
|
|
@@ -24350,6 +24693,7 @@ var require_netUtils = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
24350
24693
|
exports.describeTLS = describeTLS;
|
|
24351
24694
|
exports.describeAddress = describeAddress;
|
|
24352
24695
|
exports.upgradeSocket = upgradeSocket;
|
|
24696
|
+
exports.isLoopback = isLoopback;
|
|
24353
24697
|
exports.ipIsPrivateV4Address = ipIsPrivateV4Address;
|
|
24354
24698
|
const tls_1$2 = require("tls");
|
|
24355
24699
|
/**
|
|
@@ -24387,6 +24731,12 @@ var require_netUtils = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
24387
24731
|
});
|
|
24388
24732
|
}
|
|
24389
24733
|
/**
|
|
24734
|
+
* Returns true if an IP address is a loopback address.
|
|
24735
|
+
*/
|
|
24736
|
+
function isLoopback(ip) {
|
|
24737
|
+
return ip === "::1" || ip.startsWith("127.");
|
|
24738
|
+
}
|
|
24739
|
+
/**
|
|
24390
24740
|
* Returns true if an IP is a private address according to https://tools.ietf.org/html/rfc1918#section-3.
|
|
24391
24741
|
* This will handle IPv4-mapped IPv6 addresses correctly but return false for all other IPv6 addresses.
|
|
24392
24742
|
*
|
|
@@ -24506,8 +24856,12 @@ var require_parseListDOS = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
24506
24856
|
* under the Apache 2.0 license. It has been simplified and rewritten to better fit the Javascript language.
|
|
24507
24857
|
*
|
|
24508
24858
|
* https://github.com/apache/commons-net/blob/master/src/main/java/org/apache/commons/net/ftp/parser/NTFTPEntryParser.java
|
|
24859
|
+
*
|
|
24860
|
+
* Keep this expression anchored: without it a line that can't be parsed is retried at every position,
|
|
24861
|
+
* and as the expression starts with `\S+` each attempt is itself linear in the length of the line. A
|
|
24862
|
+
* single long line without whitespace would cost O(n²), which a server could use to block the event loop.
|
|
24509
24863
|
*/
|
|
24510
|
-
const RE_LINE = /* @__PURE__ */ new RegExp("(\\S+)\\s+(\\S+)\\s+(?:(<DIR>)|([0-9]+))\\s+(\\S.*)");
|
|
24864
|
+
const RE_LINE = /* @__PURE__ */ new RegExp("^\\s*(\\S+)\\s+(\\S+)\\s+(?:(<DIR>)|([0-9]+))\\s+(\\S.*)");
|
|
24511
24865
|
/**
|
|
24512
24866
|
* Returns true if a given line might be a DOS-style listing.
|
|
24513
24867
|
*
|
|
@@ -24576,8 +24930,12 @@ var require_parseListUnix = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
24576
24930
|
* Note: local listings on MacOSX also use '@'
|
|
24577
24931
|
* this is not allowed for here as does not appear to be shown by FTP servers
|
|
24578
24932
|
* {@code @} file has extended attributes
|
|
24933
|
+
*
|
|
24934
|
+
* Keep this expression anchored and both name quantifiers bounded: spaces are allowed in the owner and
|
|
24935
|
+
* group name, so an unbounded pair of them makes a line that can't be parsed cost O(n²) in its length,
|
|
24936
|
+
* which a server could use to block the event loop.
|
|
24579
24937
|
*/
|
|
24580
|
-
const RE_LINE = /* @__PURE__ */ new RegExp("([bcdelfmpSs-])(((r|-)(w|-)([xsStTL-]))((r|-)(w|-)([xsStTL-]))((r|-)(w|-)([xsStTL-]?)))\\+?\\s*(\\d+)\\s+(?:(\\S+(?:\\s\\S+)
|
|
24938
|
+
const RE_LINE = /* @__PURE__ */ new RegExp("^[\\s\\d]*([bcdelfmpSs-])(((r|-)(w|-)([xsStTL-]))((r|-)(w|-)([xsStTL-]))((r|-)(w|-)([xsStTL-]?)))\\+?\\s*(\\d+)\\s+(?:(\\S+(?:\\s\\S+){0,7}?)\\s+)?(?:(\\S+(?:\\s\\S+){0,7})\\s+)?(\\d+(?:,\\s*\\d+)?)\\s+((?:\\d+[-/]\\d+[-/]\\d+)|(?:\\S{3}\\s+\\d{1,2})|(?:\\d{1,2}\\s+\\S{3})|(?:\\d{1,2}月\\s+\\d{1,2}日))\\s+((?:\\d+(?::\\d+)?)|(?:\\d{4}年))\\s(.*)");
|
|
24581
24939
|
/**
|
|
24582
24940
|
* Returns true if a given line might be a Unix-style listing.
|
|
24583
24941
|
*
|
|
@@ -24733,9 +25091,12 @@ var require_parseListMLSD = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
24733
25091
|
*
|
|
24734
25092
|
* - Example 1: `size=15227;type=dir;perm=el;modify=20190419065730; test one`
|
|
24735
25093
|
* - Example 2: ` file name` (leading space)
|
|
25094
|
+
*
|
|
25095
|
+
* Keep `=` out of the fact name: if both sides of the first `=` could contain it, a long line of `=`
|
|
25096
|
+
* without `;` would be retried at every split point, costing O(n²) and blocking the event loop.
|
|
24736
25097
|
*/
|
|
24737
25098
|
function testLine(line) {
|
|
24738
|
-
return
|
|
25099
|
+
return /^[^\s=]+=\S+;/.test(line) || line.startsWith(" ");
|
|
24739
25100
|
}
|
|
24740
25101
|
/**
|
|
24741
25102
|
* Parse single line as MLSD listing, see specification at https://tools.ietf.org/html/rfc3659#section-7.
|
|
@@ -24960,6 +25321,104 @@ var require_StringWriter = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
24960
25321
|
exports.StringWriter = StringWriter;
|
|
24961
25322
|
}));
|
|
24962
25323
|
//#endregion
|
|
25324
|
+
//#region ../../node_modules/basic-ftp/dist/TransferWatchdog.js
|
|
25325
|
+
var require_TransferWatchdog = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
25326
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25327
|
+
exports.TransferWatchdog = void 0;
|
|
25328
|
+
/** How long to wait between two checks of a transfer at most, in milliseconds. */
|
|
25329
|
+
const maxCheckIntervalMs = 500;
|
|
25330
|
+
/**
|
|
25331
|
+
* How many checks a timeout is split into, at least. A transfer is only reported as stalled if
|
|
25332
|
+
* every single one of them found the connection idle. Deciding on a single check would make brief
|
|
25333
|
+
* moments where a transfer looks idle without being stalled matter, for example just after a
|
|
25334
|
+
* destination signalled that it can accept data again but before the first bytes arrived.
|
|
25335
|
+
*
|
|
25336
|
+
* Splitting into n checks means such a moment has to last about (n-1)/n of the timeout to be
|
|
25337
|
+
* mistaken for a stall, so the value matters much less than it being greater than one. It only
|
|
25338
|
+
* has an effect on timeouts below `minChecksPerTimeout * maxCheckIntervalMs` anyway, longer ones
|
|
25339
|
+
* are split into more checks by the interval limit alone.
|
|
25340
|
+
*/
|
|
25341
|
+
const minChecksPerTimeout = 4;
|
|
25342
|
+
/**
|
|
25343
|
+
* Watches a data connection during a transfer and reports it as stalled if the server stopped
|
|
25344
|
+
* making progress.
|
|
25345
|
+
*
|
|
25346
|
+
* This replaces a plain inactivity timeout on the data socket. Such a timeout can't tell apart
|
|
25347
|
+
* "the server stopped sending" from "our own source or destination isn't ready yet". A slow local
|
|
25348
|
+
* stream is not an error: A download piped into a decompressor, or an upload fed by a stream that
|
|
25349
|
+
* computes its data, can legitimately leave the connection idle for minutes. Timing out on that
|
|
25350
|
+
* kills a healthy transfer and truncates the data the destination already received.
|
|
25351
|
+
*
|
|
25352
|
+
* Only time spent waiting for the server counts towards the timeout, see `isWaitingForServer`.
|
|
25353
|
+
*/
|
|
25354
|
+
var TransferWatchdog = class {
|
|
25355
|
+
constructor() {
|
|
25356
|
+
this.timer = void 0;
|
|
25357
|
+
}
|
|
25358
|
+
/**
|
|
25359
|
+
* Start watching a transfer. Calls `onStall` if the server hasn't made progress for
|
|
25360
|
+
* `timeout` milliseconds, or for twice that if we made it wait ourselves before that.
|
|
25361
|
+
* A timeout of 0 disables the watchdog.
|
|
25362
|
+
*/
|
|
25363
|
+
start(socket, direction, timeout, onStall) {
|
|
25364
|
+
this.stop();
|
|
25365
|
+
if (timeout <= 0) return;
|
|
25366
|
+
const intervalMs = Math.max(1, Math.min(Math.floor(timeout / minChecksPerTimeout), maxCheckIntervalMs));
|
|
25367
|
+
let lastBytes = countBytes(socket);
|
|
25368
|
+
let idleMs = 0;
|
|
25369
|
+
let graceMs = 0;
|
|
25370
|
+
this.timer = setInterval(() => {
|
|
25371
|
+
const bytes = countBytes(socket);
|
|
25372
|
+
const madeProgress = bytes !== lastBytes;
|
|
25373
|
+
lastBytes = bytes;
|
|
25374
|
+
if (!isWaitingForServer(socket, direction)) {
|
|
25375
|
+
idleMs = 0;
|
|
25376
|
+
graceMs = timeout;
|
|
25377
|
+
return;
|
|
25378
|
+
}
|
|
25379
|
+
if (madeProgress) {
|
|
25380
|
+
idleMs = 0;
|
|
25381
|
+
graceMs = 0;
|
|
25382
|
+
return;
|
|
25383
|
+
}
|
|
25384
|
+
idleMs += intervalMs;
|
|
25385
|
+
if (idleMs >= timeout + graceMs) {
|
|
25386
|
+
this.stop();
|
|
25387
|
+
onStall();
|
|
25388
|
+
}
|
|
25389
|
+
}, intervalMs);
|
|
25390
|
+
this.timer.unref();
|
|
25391
|
+
}
|
|
25392
|
+
/**
|
|
25393
|
+
* Stop watching. Safe to call at any time, also if no transfer is being watched.
|
|
25394
|
+
*/
|
|
25395
|
+
stop() {
|
|
25396
|
+
if (this.timer) {
|
|
25397
|
+
clearInterval(this.timer);
|
|
25398
|
+
this.timer = void 0;
|
|
25399
|
+
}
|
|
25400
|
+
}
|
|
25401
|
+
};
|
|
25402
|
+
exports.TransferWatchdog = TransferWatchdog;
|
|
25403
|
+
function countBytes(socket) {
|
|
25404
|
+
return socket.bytesRead + socket.bytesWritten;
|
|
25405
|
+
}
|
|
25406
|
+
/**
|
|
25407
|
+
* Returns true if the transfer can only continue once the server acts. When downloading, that's
|
|
25408
|
+
* the case as long as we're ready to receive: if the socket is paused, our destination applied
|
|
25409
|
+
* backpressure and the server may well be waiting for us. When uploading, it's the case if we
|
|
25410
|
+
* still have data queued that the server isn't accepting: an empty queue means we're waiting for
|
|
25411
|
+
* our own source instead.
|
|
25412
|
+
*
|
|
25413
|
+
* `isPaused()` only reports backpressure for a socket that is being piped, which is what
|
|
25414
|
+
* `downloadTo` in transfer.ts does. Should that ever change to reading the socket directly, e.g.
|
|
25415
|
+
* by iterating over it, this would report a transfer as stalled while it's waiting for us.
|
|
25416
|
+
*/
|
|
25417
|
+
function isWaitingForServer(socket, direction) {
|
|
25418
|
+
return direction === "download" ? !socket.isPaused() : socket.writableLength > 0;
|
|
25419
|
+
}
|
|
25420
|
+
}));
|
|
25421
|
+
//#endregion
|
|
24963
25422
|
//#region ../../node_modules/basic-ftp/dist/transfer.js
|
|
24964
25423
|
var require_transfer = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
24965
25424
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -24971,9 +25430,10 @@ var require_transfer = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
24971
25430
|
exports.connectForPassiveTransfer = connectForPassiveTransfer;
|
|
24972
25431
|
exports.uploadFrom = uploadFrom;
|
|
24973
25432
|
exports.downloadTo = downloadTo;
|
|
24974
|
-
const netUtils_1 = require_netUtils();
|
|
24975
25433
|
const stream_1$2 = require("stream");
|
|
24976
25434
|
const tls_1$1 = require("tls");
|
|
25435
|
+
const TransferWatchdog_1 = require_TransferWatchdog();
|
|
25436
|
+
const netUtils_1 = require_netUtils();
|
|
24977
25437
|
const parseControlResponse_1 = require_parseControlResponse();
|
|
24978
25438
|
/**
|
|
24979
25439
|
* Prepare a data socket using passive mode over IPv6.
|
|
@@ -25010,9 +25470,11 @@ var require_transfer = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
25010
25470
|
return res;
|
|
25011
25471
|
}
|
|
25012
25472
|
/**
|
|
25013
|
-
* Prepare a data socket using passive mode over IPv4.
|
|
25014
|
-
*
|
|
25015
|
-
*
|
|
25473
|
+
* Prepare a data socket using passive mode over IPv4.
|
|
25474
|
+
*
|
|
25475
|
+
* Will throw an error if the IP provided by the PASV response doesn't match the one of the control connection.
|
|
25476
|
+
* The error will contain detailed information. This is done to provide more security by preventing FTP bounce
|
|
25477
|
+
* attacks.
|
|
25016
25478
|
*/
|
|
25017
25479
|
async function enterPassiveModeIPv4_forceControlHostIP(ftp) {
|
|
25018
25480
|
const res = await ftp.request("PASV");
|
|
@@ -25020,14 +25482,16 @@ var require_transfer = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
25020
25482
|
if (!target) throw new Error("Can't parse PASV response: " + res.message);
|
|
25021
25483
|
const controlHost = ftp.socket.remoteAddress;
|
|
25022
25484
|
if (controlHost === void 0) throw new Error("Control socket is disconnected, can't get remote address.");
|
|
25023
|
-
|
|
25485
|
+
const normalizedControlHost = controlHost.replace(/^::ffff:/i, "");
|
|
25486
|
+
if (!(normalizedControlHost === target.host || (0, netUtils_1.isLoopback)(normalizedControlHost) && (0, netUtils_1.isLoopback)(target.host))) throw new Error(`PASV returned another host (${target.host}) for data transfer that you have connected to (${controlHost}). Even though the FTP protocol allows this, basic-ftp disables this feature by default for security reasons. If you do need this feature, instantiate the Client with the optional paramter "allowSeparateTransferHost: true". See the README documentation for more information.`);
|
|
25487
|
+
await connectForPassiveTransfer(normalizedControlHost, target.port, ftp);
|
|
25024
25488
|
return res;
|
|
25025
25489
|
}
|
|
25026
25490
|
/**
|
|
25027
25491
|
* Parse a PASV response.
|
|
25028
25492
|
*/
|
|
25029
25493
|
function parsePasvResponse(message) {
|
|
25030
|
-
const groups = message.match(/([-\d]+,[-\d]+,[-\d]+,[-\d]+),([-\d]+),([-\d]+)/);
|
|
25494
|
+
const groups = message.match(/(?<![-\d])([-\d]+,[-\d]+,[-\d]+,[-\d]+),([-\d]+),([-\d]+)/);
|
|
25031
25495
|
if (groups === null || groups.length !== 4) throw new Error(`Can't parse response to 'PASV': ${message}`);
|
|
25032
25496
|
return {
|
|
25033
25497
|
host: groups[1].replace(/,/g, "."),
|
|
@@ -25036,7 +25500,8 @@ var require_transfer = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
25036
25500
|
}
|
|
25037
25501
|
function connectForPassiveTransfer(host, port, ftp) {
|
|
25038
25502
|
return new Promise((resolve, reject) => {
|
|
25039
|
-
|
|
25503
|
+
const rawSocket = ftp._newSocket();
|
|
25504
|
+
let socket = rawSocket;
|
|
25040
25505
|
const handleConnErr = function(err) {
|
|
25041
25506
|
err.message = "Can't open data connection in passive mode: " + err.message;
|
|
25042
25507
|
reject(err);
|
|
@@ -25053,10 +25518,18 @@ var require_transfer = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
25053
25518
|
host,
|
|
25054
25519
|
family: ftp.ipFamily
|
|
25055
25520
|
}, () => {
|
|
25056
|
-
|
|
25057
|
-
|
|
25058
|
-
|
|
25059
|
-
|
|
25521
|
+
var _a;
|
|
25522
|
+
if (ftp.socket instanceof tls_1$1.TLSSocket) {
|
|
25523
|
+
const tlsSocket = (0, tls_1$1.connect)(Object.assign({}, ftp.tlsOptions, {
|
|
25524
|
+
socket: rawSocket,
|
|
25525
|
+
session: (_a = ftp.tlsSessionStore) !== null && _a !== void 0 ? _a : ftp.socket.getSession()
|
|
25526
|
+
}));
|
|
25527
|
+
tlsSocket.on("session", (session) => {
|
|
25528
|
+
ftp.tlsSessionStore = session;
|
|
25529
|
+
});
|
|
25530
|
+
socket = tlsSocket;
|
|
25531
|
+
}
|
|
25532
|
+
rawSocket.setTimeout(0);
|
|
25060
25533
|
socket.removeListener("error", handleConnErr);
|
|
25061
25534
|
socket.removeListener("timeout", handleTimeout);
|
|
25062
25535
|
ftp.dataSocket = socket;
|
|
@@ -25081,6 +25554,8 @@ var require_transfer = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
25081
25554
|
this.progress = progress;
|
|
25082
25555
|
this.response = void 0;
|
|
25083
25556
|
this.dataTransferDone = false;
|
|
25557
|
+
this.taskSettled = false;
|
|
25558
|
+
this.watchdog = new TransferWatchdog_1.TransferWatchdog();
|
|
25084
25559
|
}
|
|
25085
25560
|
/**
|
|
25086
25561
|
* Mark the beginning of a transfer.
|
|
@@ -25091,16 +25566,20 @@ var require_transfer = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
25091
25566
|
onDataStart(name, type) {
|
|
25092
25567
|
if (this.ftp.dataSocket === void 0) throw new Error("Data transfer should start but there is no data connection.");
|
|
25093
25568
|
this.ftp.socket.setTimeout(0);
|
|
25094
|
-
this.ftp.dataSocket.setTimeout(
|
|
25569
|
+
this.ftp.dataSocket.setTimeout(0);
|
|
25570
|
+
this.watchdog.start(this.ftp.dataSocket, type === "upload" ? "upload" : "download", this.ftp.timeout, () => {
|
|
25571
|
+
this.ftp.closeWithError(/* @__PURE__ */ new Error("Timeout (data socket)"));
|
|
25572
|
+
});
|
|
25095
25573
|
this.progress.start(this.ftp.dataSocket, name, type);
|
|
25096
25574
|
}
|
|
25097
25575
|
/**
|
|
25098
25576
|
* The data connection has finished the transfer.
|
|
25099
25577
|
*/
|
|
25100
25578
|
onDataDone(task) {
|
|
25579
|
+
if (this.taskSettled) return;
|
|
25580
|
+
this.watchdog.stop();
|
|
25101
25581
|
this.progress.updateAndStop();
|
|
25102
25582
|
this.ftp.socket.setTimeout(this.ftp.timeout);
|
|
25103
|
-
if (this.ftp.dataSocket) this.ftp.dataSocket.setTimeout(0);
|
|
25104
25583
|
this.dataTransferDone = true;
|
|
25105
25584
|
this.tryResolve(task);
|
|
25106
25585
|
}
|
|
@@ -25115,6 +25594,9 @@ var require_transfer = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
25115
25594
|
* An error has been reported and the task should be rejected.
|
|
25116
25595
|
*/
|
|
25117
25596
|
onError(task, err) {
|
|
25597
|
+
if (this.taskSettled) return;
|
|
25598
|
+
this.taskSettled = true;
|
|
25599
|
+
this.watchdog.stop();
|
|
25118
25600
|
this.progress.updateAndStop();
|
|
25119
25601
|
this.ftp.socket.setTimeout(this.ftp.timeout);
|
|
25120
25602
|
this.ftp.dataSocket = void 0;
|
|
@@ -25131,6 +25613,7 @@ var require_transfer = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
25131
25613
|
}
|
|
25132
25614
|
tryResolve(task) {
|
|
25133
25615
|
if (this.dataTransferDone && this.response !== void 0) {
|
|
25616
|
+
this.taskSettled = true;
|
|
25134
25617
|
this.ftp.dataSocket = void 0;
|
|
25135
25618
|
task.resolve(this.response);
|
|
25136
25619
|
}
|
|
@@ -25139,9 +25622,12 @@ var require_transfer = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
25139
25622
|
function uploadFrom(source, config) {
|
|
25140
25623
|
const resolver = new TransferResolver(config.ftp, config.tracker);
|
|
25141
25624
|
const fullCommand = `${config.command} ${config.remotePath}`;
|
|
25625
|
+
let transferStarted = false;
|
|
25142
25626
|
return config.ftp.handle(fullCommand, (res, task) => {
|
|
25143
25627
|
if (res instanceof Error) resolver.onError(task, res);
|
|
25144
25628
|
else if (res.code === 150 || res.code === 125) {
|
|
25629
|
+
if (transferStarted) return;
|
|
25630
|
+
transferStarted = true;
|
|
25145
25631
|
const dataSocket = config.ftp.dataSocket;
|
|
25146
25632
|
if (!dataSocket) {
|
|
25147
25633
|
resolver.onError(task, /* @__PURE__ */ new Error("Upload should begin but no data connection is available."));
|
|
@@ -25162,9 +25648,12 @@ var require_transfer = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
25162
25648
|
function downloadTo(destination, config) {
|
|
25163
25649
|
if (!config.ftp.dataSocket) throw new Error("Download will be initiated but no data connection is available.");
|
|
25164
25650
|
const resolver = new TransferResolver(config.ftp, config.tracker);
|
|
25651
|
+
let transferStarted = false;
|
|
25165
25652
|
return config.ftp.handle(config.command, (res, task) => {
|
|
25166
25653
|
if (res instanceof Error) resolver.onError(task, res);
|
|
25167
25654
|
else if (res.code === 150 || res.code === 125) {
|
|
25655
|
+
if (transferStarted) return;
|
|
25656
|
+
transferStarted = true;
|
|
25168
25657
|
const dataSocket = config.ftp.dataSocket;
|
|
25169
25658
|
if (!dataSocket) {
|
|
25170
25659
|
resolver.onError(task, /* @__PURE__ */ new Error("Download should begin but no data connection is available."));
|
|
@@ -25215,11 +25704,12 @@ var require_Client = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
25215
25704
|
const fsReadDir = (0, util_1$3.promisify)(fs_1$5.readdir);
|
|
25216
25705
|
const fsMkDir = (0, util_1$3.promisify)(fs_1$5.mkdir);
|
|
25217
25706
|
const fsStat = (0, util_1$3.promisify)(fs_1$5.stat);
|
|
25707
|
+
const fsFStat = (0, util_1$3.promisify)(fs_1$5.fstat);
|
|
25218
25708
|
const fsOpen = (0, util_1$3.promisify)(fs_1$5.open);
|
|
25219
25709
|
const fsClose = (0, util_1$3.promisify)(fs_1$5.close);
|
|
25220
25710
|
const fsUnlink = (0, util_1$3.promisify)(fs_1$5.unlink);
|
|
25221
25711
|
const defaultClientOptions = {
|
|
25222
|
-
allowSeparateTransferHost:
|
|
25712
|
+
allowSeparateTransferHost: false,
|
|
25223
25713
|
maxListingBytes: 40 * 1024 * 1024
|
|
25224
25714
|
};
|
|
25225
25715
|
const LIST_COMMANDS_DEFAULT = () => ["LIST -a", "LIST"];
|
|
@@ -25291,7 +25781,9 @@ var require_Client = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
25291
25781
|
* explicit TLS. There are still FTP servers that support only implicit TLS, though.
|
|
25292
25782
|
*/
|
|
25293
25783
|
connectImplicitTLS(host = "localhost", port = 21, tlsOptions = {}) {
|
|
25784
|
+
var _a;
|
|
25294
25785
|
this.ftp.reset();
|
|
25786
|
+
tlsOptions.host = (_a = tlsOptions.host) !== null && _a !== void 0 ? _a : host;
|
|
25295
25787
|
this.ftp.socket = (0, tls_1.connect)(port, host, tlsOptions, () => this.ftp.log(`Connected to ${(0, netUtils_1.describeAddress)(this.ftp.socket)} (${(0, netUtils_1.describeTLS)(this.ftp.socket)})`));
|
|
25296
25788
|
this.ftp.tlsOptions = tlsOptions;
|
|
25297
25789
|
return this._handleConnectResponse();
|
|
@@ -25534,7 +26026,10 @@ var require_Client = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
25534
26026
|
autoClose: false
|
|
25535
26027
|
});
|
|
25536
26028
|
try {
|
|
25537
|
-
|
|
26029
|
+
const expectedBytes = await expectedBytesFromLocalFile(fd, options);
|
|
26030
|
+
const response = await this._uploadFromStream(source, remotePath, command);
|
|
26031
|
+
if (expectedBytes !== void 0 && source.bytesRead !== expectedBytes) throw new Error(`Local file "${localPath}" changed while it was being uploaded to "${remotePath}": expected to send ${expectedBytes} bytes but sent ${source.bytesRead}. The remote file is incomplete.`);
|
|
26032
|
+
return response;
|
|
25538
26033
|
} finally {
|
|
25539
26034
|
await ignoreError(() => fsClose(fd));
|
|
25540
26035
|
}
|
|
@@ -25866,6 +26361,19 @@ var require_Client = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
25866
26361
|
await fsMkDir(path, { recursive: true });
|
|
25867
26362
|
}
|
|
25868
26363
|
}
|
|
26364
|
+
/**
|
|
26365
|
+
* Return how many bytes an upload should read from an open local file, taking the optional
|
|
26366
|
+
* range described by `options` into account. Returns `undefined` if the size can't be known
|
|
26367
|
+
* upfront, for example because the source is a pipe or another non-regular file.
|
|
26368
|
+
*/
|
|
26369
|
+
async function expectedBytesFromLocalFile(fd, options) {
|
|
26370
|
+
var _a;
|
|
26371
|
+
const stats = await fsFStat(fd);
|
|
26372
|
+
if (!stats.isFile()) return;
|
|
26373
|
+
const start = (_a = options.localStart) !== null && _a !== void 0 ? _a : 0;
|
|
26374
|
+
const endExclusive = options.localEndInclusive !== void 0 ? Math.min(options.localEndInclusive + 1, stats.size) : stats.size;
|
|
26375
|
+
return Math.max(0, endExclusive - start);
|
|
26376
|
+
}
|
|
25869
26377
|
async function ignoreError(func) {
|
|
25870
26378
|
try {
|
|
25871
26379
|
return await func();
|
|
@@ -43259,6 +43767,7 @@ var require_symbols = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
43259
43767
|
kDestroy: Symbol("destroy"),
|
|
43260
43768
|
kDispatch: Symbol("dispatch"),
|
|
43261
43769
|
kUrl: Symbol("url"),
|
|
43770
|
+
kRedirectCacheControl: Symbol("redirect cache control"),
|
|
43262
43771
|
kWriting: Symbol("writing"),
|
|
43263
43772
|
kResuming: Symbol("resuming"),
|
|
43264
43773
|
kQueue: Symbol("queue"),
|
|
@@ -45791,6 +46300,7 @@ var require_unwrap_handler = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
45791
46300
|
//#endregion
|
|
45792
46301
|
//#region ../../node_modules/undici/lib/dispatcher/dispatcher-base.js
|
|
45793
46302
|
var require_dispatcher_base = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
46303
|
+
const buffer$1 = require("node:buffer");
|
|
45794
46304
|
const Dispatcher = require_dispatcher();
|
|
45795
46305
|
const UnwrapHandler = require_unwrap_handler();
|
|
45796
46306
|
const { ClientDestroyedError, ClientClosedError, InvalidArgumentError } = require_errors$1();
|
|
@@ -45798,6 +46308,7 @@ var require_dispatcher_base = /* @__PURE__ */ __commonJSMin(((exports, module) =
|
|
|
45798
46308
|
const kOnDestroyed = Symbol("onDestroyed");
|
|
45799
46309
|
const kOnClosed = Symbol("onClosed");
|
|
45800
46310
|
const kWebSocketOptions = Symbol("webSocketOptions");
|
|
46311
|
+
const kEventSourceOptions = Symbol("eventSourceOptions");
|
|
45801
46312
|
var DispatcherBase = class extends Dispatcher {
|
|
45802
46313
|
/** @type {boolean} */
|
|
45803
46314
|
[kDestroyed] = false;
|
|
@@ -45813,6 +46324,7 @@ var require_dispatcher_base = /* @__PURE__ */ __commonJSMin(((exports, module) =
|
|
|
45813
46324
|
constructor(opts) {
|
|
45814
46325
|
super();
|
|
45815
46326
|
this[kWebSocketOptions] = opts?.webSocket ?? {};
|
|
46327
|
+
this[kEventSourceOptions] = opts?.eventSource ?? {};
|
|
45816
46328
|
}
|
|
45817
46329
|
/**
|
|
45818
46330
|
* @returns {import('../../types/dispatcher').WebSocketOptions}
|
|
@@ -45823,6 +46335,12 @@ var require_dispatcher_base = /* @__PURE__ */ __commonJSMin(((exports, module) =
|
|
|
45823
46335
|
maxPayloadSize: this[kWebSocketOptions].maxPayloadSize ?? 128 * 1024 * 1024
|
|
45824
46336
|
};
|
|
45825
46337
|
}
|
|
46338
|
+
/**
|
|
46339
|
+
* @returns {import('../../types/client').Client.EventSourceOptions}
|
|
46340
|
+
*/
|
|
46341
|
+
get eventSourceOptions() {
|
|
46342
|
+
return { maxEventSize: this[kEventSourceOptions].maxEventSize ?? buffer$1.kStringMaxLength };
|
|
46343
|
+
}
|
|
45826
46344
|
/** @returns {boolean} */
|
|
45827
46345
|
get destroyed() {
|
|
45828
46346
|
return this[kDestroyed];
|
|
@@ -45928,12 +46446,16 @@ var require_connect = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
45928
46446
|
if (this._maxCachedSessions === 0) return;
|
|
45929
46447
|
if (this._sessionCache.has(sessionKey)) this._sessionCache.delete(sessionKey);
|
|
45930
46448
|
else if (this._sessionCache.size >= this._maxCachedSessions) {
|
|
46449
|
+
let evicted = false;
|
|
45931
46450
|
for (const [key, ref] of this._sessionCache) if (ref.deref() === void 0) {
|
|
45932
46451
|
this._sessionCache.delete(key);
|
|
45933
|
-
|
|
46452
|
+
evicted = true;
|
|
46453
|
+
break;
|
|
46454
|
+
}
|
|
46455
|
+
if (!evicted) {
|
|
46456
|
+
const oldest = this._sessionCache.keys().next();
|
|
46457
|
+
if (!oldest.done) this._sessionCache.delete(oldest.value);
|
|
45934
46458
|
}
|
|
45935
|
-
const oldest = this._sessionCache.keys().next();
|
|
45936
|
-
if (!oldest.done) this._sessionCache.delete(oldest.value);
|
|
45937
46459
|
}
|
|
45938
46460
|
this._sessionCache.set(sessionKey, new WeakRef(session));
|
|
45939
46461
|
this._sessionRegistry.register(session, sessionKey);
|
|
@@ -46939,6 +47461,16 @@ var require_infra = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
46939
47461
|
return input.slice(start, position.position);
|
|
46940
47462
|
}
|
|
46941
47463
|
const ASCII_WHITESPACE_REPLACE_REGEX = /[\u0009\u000A\u000C\u000D\u0020]/g;
|
|
47464
|
+
const nonASCIIRegex = /[^\x00-\x7F]/;
|
|
47465
|
+
/**
|
|
47466
|
+
* @param {string} str
|
|
47467
|
+
* @returns {string}
|
|
47468
|
+
*
|
|
47469
|
+
* @see https://infra.spec.whatwg.org/#ascii-lowercase
|
|
47470
|
+
*/
|
|
47471
|
+
function asciiLowercase(str) {
|
|
47472
|
+
return nonASCIIRegex.test(str) ? str.replace(/[A-Z]+/g, (upper) => upper.toLowerCase()) : str.toLowerCase();
|
|
47473
|
+
}
|
|
46942
47474
|
/**
|
|
46943
47475
|
* @param {string} data
|
|
46944
47476
|
* @returns {Uint8Array | 'failure'}
|
|
@@ -47036,6 +47568,7 @@ var require_infra = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
47036
47568
|
return result;
|
|
47037
47569
|
}
|
|
47038
47570
|
module.exports = {
|
|
47571
|
+
asciiLowercase,
|
|
47039
47572
|
collectASequenceOfCodePoints,
|
|
47040
47573
|
collectASequenceOfCodePointsFast,
|
|
47041
47574
|
forgivingBase64,
|
|
@@ -49883,7 +50416,6 @@ var require_client_h1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
49883
50416
|
};
|
|
49884
50417
|
}
|
|
49885
50418
|
function onHttpSocketError(err) {
|
|
49886
|
-
assert$23(err.code !== "ERR_TLS_CERT_ALTNAME_INVALID");
|
|
49887
50419
|
const parser = this[kParser];
|
|
49888
50420
|
if (err.code === "ECONNRESET" && parser.statusCode && !parser.shouldKeepAlive) {
|
|
49889
50421
|
const parserErr = parser.finish();
|
|
@@ -50508,7 +51040,6 @@ var require_client_h2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
50508
51040
|
}
|
|
50509
51041
|
}
|
|
50510
51042
|
function onHttp2SessionError(err) {
|
|
50511
|
-
assert$22(err.code !== "ERR_TLS_CERT_ALTNAME_INVALID");
|
|
50512
51043
|
this[kSocket][kError] = err;
|
|
50513
51044
|
this[kClient][kOnError](err);
|
|
50514
51045
|
}
|
|
@@ -50596,7 +51127,6 @@ var require_client_h2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
50596
51127
|
client[kResume]();
|
|
50597
51128
|
}
|
|
50598
51129
|
function onHttp2SocketError(err) {
|
|
50599
|
-
assert$22(err.code !== "ERR_TLS_CERT_ALTNAME_INVALID");
|
|
50600
51130
|
this[kError] = err;
|
|
50601
51131
|
this[kClient][kOnError](err);
|
|
50602
51132
|
}
|
|
@@ -50962,7 +51492,7 @@ var require_client = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
50962
51492
|
* @param {string|URL} url
|
|
50963
51493
|
* @param {import('../../types/client.js').Client.Options} options
|
|
50964
51494
|
*/
|
|
50965
|
-
constructor(url, { maxHeaderSize, headersTimeout, socketTimeout, requestTimeout, connectTimeout, bodyTimeout, idleTimeout, keepAlive, keepAliveTimeout, maxKeepAliveTimeout, keepAliveMaxTimeout, keepAliveTimeoutThreshold, socketPath, pipelining, tls, strictContentLength, maxCachedSessions, connect, maxRequestsPerClient, localAddress, maxResponseSize, autoSelectFamily, autoSelectFamilyAttemptTimeout, maxConcurrentStreams, allowH2, useH2c, initialWindowSize, connectionWindowSize, pingInterval, webSocket } = {}) {
|
|
51495
|
+
constructor(url, { maxHeaderSize, headersTimeout, socketTimeout, requestTimeout, connectTimeout, bodyTimeout, idleTimeout, keepAlive, keepAliveTimeout, maxKeepAliveTimeout, keepAliveMaxTimeout, keepAliveTimeoutThreshold, socketPath, pipelining, tls, strictContentLength, maxCachedSessions, connect, maxRequestsPerClient, localAddress, maxResponseSize, autoSelectFamily, autoSelectFamilyAttemptTimeout, maxConcurrentStreams, allowH2, useH2c, initialWindowSize, connectionWindowSize, pingInterval, webSocket, eventSource } = {}) {
|
|
50966
51496
|
if (keepAlive !== void 0) throw new InvalidArgumentError("unsupported keepAlive, use pipelining=0 instead");
|
|
50967
51497
|
if (socketTimeout !== void 0) throw new InvalidArgumentError("unsupported socketTimeout, use headersTimeout & bodyTimeout instead");
|
|
50968
51498
|
if (requestTimeout !== void 0) throw new InvalidArgumentError("unsupported requestTimeout, use headersTimeout & bodyTimeout instead");
|
|
@@ -50989,7 +51519,10 @@ var require_client = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
50989
51519
|
if (initialWindowSize != null && (!Number.isInteger(initialWindowSize) || initialWindowSize < 1)) throw new InvalidArgumentError("initialWindowSize must be a positive integer, greater than 0");
|
|
50990
51520
|
if (connectionWindowSize != null && (!Number.isInteger(connectionWindowSize) || connectionWindowSize < 1)) throw new InvalidArgumentError("connectionWindowSize must be a positive integer, greater than 0");
|
|
50991
51521
|
if (pingInterval != null && (typeof pingInterval !== "number" || !Number.isInteger(pingInterval) || pingInterval < 0)) throw new InvalidArgumentError("pingInterval must be a positive integer, greater or equal to 0");
|
|
50992
|
-
super({
|
|
51522
|
+
super({
|
|
51523
|
+
webSocket,
|
|
51524
|
+
eventSource
|
|
51525
|
+
});
|
|
50993
51526
|
if (typeof connect !== "function") connect = buildConnector({
|
|
50994
51527
|
...tls,
|
|
50995
51528
|
maxCachedSessions,
|
|
@@ -51814,16 +52347,18 @@ var require_agent = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
51814
52347
|
return opts && opts.connections === 1 ? new Client(origin, opts) : new Pool(origin, opts);
|
|
51815
52348
|
}
|
|
51816
52349
|
var Agent = class extends DispatcherBase {
|
|
51817
|
-
constructor({ factory = defaultFactory, maxOrigins = Infinity, connect, ...options } = {}) {
|
|
52350
|
+
constructor({ factory = defaultFactory, maxOrigins = Infinity, connect, tls, ...options } = {}) {
|
|
51818
52351
|
if (typeof factory !== "function") throw new InvalidArgumentError("factory must be a function.");
|
|
51819
52352
|
if (connect != null && typeof connect !== "function" && typeof connect !== "object") throw new InvalidArgumentError("connect must be a function or an object");
|
|
51820
52353
|
if (typeof maxOrigins !== "number" || Number.isNaN(maxOrigins) || maxOrigins <= 0) throw new InvalidArgumentError("maxOrigins must be a number greater than 0");
|
|
51821
52354
|
super(options);
|
|
51822
52355
|
if (connect && typeof connect !== "function") connect = { ...connect };
|
|
52356
|
+
if (tls && typeof tls !== "function") tls = { ...tls };
|
|
51823
52357
|
this[kOptions] = {
|
|
51824
52358
|
...util.deepClone(options),
|
|
51825
52359
|
maxOrigins,
|
|
51826
|
-
connect
|
|
52360
|
+
connect,
|
|
52361
|
+
tls
|
|
51827
52362
|
};
|
|
51828
52363
|
this[kFactory] = factory;
|
|
51829
52364
|
this[kClients] = /* @__PURE__ */ new Map();
|
|
@@ -56115,7 +56650,7 @@ var require_decorator_handler = /* @__PURE__ */ __commonJSMin(((exports, module)
|
|
|
56115
56650
|
//#region ../../node_modules/undici/lib/handler/redirect-handler.js
|
|
56116
56651
|
var require_redirect_handler = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
56117
56652
|
const util = require_util$5();
|
|
56118
|
-
const { kBodyUsed } = require_symbols();
|
|
56653
|
+
const { kBodyUsed, kRedirectCacheControl } = require_symbols();
|
|
56119
56654
|
const assert$12 = require("node:assert");
|
|
56120
56655
|
const { InvalidArgumentError } = require_errors$1();
|
|
56121
56656
|
const EE$1 = require("node:events");
|
|
@@ -56155,6 +56690,10 @@ var require_redirect_handler = /* @__PURE__ */ __commonJSMin(((exports, module)
|
|
|
56155
56690
|
this.maxRedirections = maxRedirections;
|
|
56156
56691
|
this.handler = handler;
|
|
56157
56692
|
this.history = [];
|
|
56693
|
+
Object.defineProperty(this.history, kRedirectCacheControl, {
|
|
56694
|
+
value: [],
|
|
56695
|
+
enumerable: false
|
|
56696
|
+
});
|
|
56158
56697
|
if (util.isStream(this.opts.body)) {
|
|
56159
56698
|
if (util.bodyLength(this.opts.body) === 0) this.opts.body.on("data", function() {
|
|
56160
56699
|
assert$12(false);
|
|
@@ -56195,6 +56734,7 @@ var require_redirect_handler = /* @__PURE__ */ __commonJSMin(((exports, module)
|
|
|
56195
56734
|
this.handler.onResponseStart?.(controller, statusCode, headers, statusMessage);
|
|
56196
56735
|
return;
|
|
56197
56736
|
}
|
|
56737
|
+
this.history[kRedirectCacheControl].push(headers["cache-control"]);
|
|
56198
56738
|
const { origin, pathname, search } = util.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)));
|
|
56199
56739
|
const path = search ? `${pathname}${search}` : pathname;
|
|
56200
56740
|
const redirectUrlString = `${origin}${path}`;
|
|
@@ -57476,9 +58016,22 @@ var require_date = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
57476
58016
|
//#region ../../node_modules/undici/lib/handler/cache-handler.js
|
|
57477
58017
|
var require_cache_handler = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
57478
58018
|
const util = require_util$5();
|
|
58019
|
+
const { kRedirectCacheControl } = require_symbols();
|
|
57479
58020
|
const { parseCacheControlHeader, hasInvalidCacheControlDirective, parseVaryHeader, hasVaryStar, isInvalidOrWildcardVaryHeader, isEtagUsable } = require_cache$2();
|
|
57480
58021
|
const { parseHttpDate } = require_date();
|
|
57481
58022
|
function noop() {}
|
|
58023
|
+
/**
|
|
58024
|
+
* @param {string | URL} a
|
|
58025
|
+
* @param {string | URL} b
|
|
58026
|
+
* @returns {boolean}
|
|
58027
|
+
*/
|
|
58028
|
+
function sameOrigin(a, b) {
|
|
58029
|
+
try {
|
|
58030
|
+
return new URL(String(a)).origin === new URL(String(b)).origin;
|
|
58031
|
+
} catch {
|
|
58032
|
+
return String(a) === String(b);
|
|
58033
|
+
}
|
|
58034
|
+
}
|
|
57482
58035
|
const HEURISTICALLY_CACHEABLE_STATUS_CODES = [
|
|
57483
58036
|
200,
|
|
57484
58037
|
203,
|
|
@@ -57582,6 +58135,13 @@ var require_cache_handler = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
57582
58135
|
*/
|
|
57583
58136
|
#writeStream;
|
|
57584
58137
|
/**
|
|
58138
|
+
* The URLs visited while following redirects, shared by reference from the
|
|
58139
|
+
* redirect handler through the request context. Carries the suppressed hops'
|
|
58140
|
+
* cache-control under {@link kRedirectCacheControl}.
|
|
58141
|
+
* @type {URL[] | undefined}
|
|
58142
|
+
*/
|
|
58143
|
+
#history;
|
|
58144
|
+
/**
|
|
57585
58145
|
* @param {import('../../types/cache-interceptor.d.ts').default.CacheHandlerOptions} opts
|
|
57586
58146
|
* @param {import('../../types/cache-interceptor.d.ts').default.CacheKey} cacheKey
|
|
57587
58147
|
* @param {import('../../types/dispatcher.d.ts').default.DispatchHandler} handler
|
|
@@ -57596,6 +58156,7 @@ var require_cache_handler = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
57596
58156
|
onRequestStart(controller, context) {
|
|
57597
58157
|
this.#writeStream?.destroy();
|
|
57598
58158
|
this.#writeStream = void 0;
|
|
58159
|
+
this.#history = context?.history;
|
|
57599
58160
|
this.#handler.onRequestStart?.(controller, context);
|
|
57600
58161
|
}
|
|
57601
58162
|
onRequestUpgrade(controller, statusCode, headers, socket) {
|
|
@@ -57614,6 +58175,15 @@ var require_cache_handler = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
57614
58175
|
invalidateUnsafeRequest(this.#store, this.#cacheKey, resHeaders);
|
|
57615
58176
|
return downstreamOnHeaders();
|
|
57616
58177
|
}
|
|
58178
|
+
if (this.#history && this.#history.length > 0) {
|
|
58179
|
+
const finalUrl = this.#history[this.#history.length - 1];
|
|
58180
|
+
if (!sameOrigin(finalUrl.origin, this.#cacheKey.origin)) return downstreamOnHeaders();
|
|
58181
|
+
}
|
|
58182
|
+
const redirectCacheControl = this.#history?.[kRedirectCacheControl];
|
|
58183
|
+
if (redirectCacheControl) for (const hopCacheControl of redirectCacheControl) {
|
|
58184
|
+
const hopDirectives = hopCacheControl ? parseCacheControlHeader(hopCacheControl) : {};
|
|
58185
|
+
if (hopDirectives["no-store"] === true || this.#cacheType === "shared" && hopDirectives.private === true) return downstreamOnHeaders();
|
|
58186
|
+
}
|
|
57617
58187
|
const cacheControlHeader = resHeaders["cache-control"];
|
|
57618
58188
|
const cacheControlDirectives = cacheControlHeader ? parseCacheControlHeader(cacheControlHeader) : {};
|
|
57619
58189
|
if (revalidationResponseDisallowsCachedReuse(this.#cacheType, resHeaders, cacheControlDirectives)) {
|
|
@@ -58704,7 +59274,12 @@ var require_decompress = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
58704
59274
|
}
|
|
58705
59275
|
this.#decompressedSize = decompressedSize;
|
|
58706
59276
|
}
|
|
58707
|
-
|
|
59277
|
+
try {
|
|
59278
|
+
if (super.onResponseData(this.#controller, chunk) === false && !this.#controller.paused) this.#controller.pause();
|
|
59279
|
+
} catch (err) {
|
|
59280
|
+
this.#fail(err);
|
|
59281
|
+
return;
|
|
59282
|
+
}
|
|
58708
59283
|
}
|
|
58709
59284
|
} while (this.#drainRequested && !this.#terminated && !this.#controller.paused);
|
|
58710
59285
|
} finally {
|
|
@@ -58715,9 +59290,14 @@ var require_decompress = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
58715
59290
|
}
|
|
58716
59291
|
#finishIfReady() {
|
|
58717
59292
|
if (this.#terminated || !this.#completionPending || this.#controller.paused || this.#draining) return;
|
|
58718
|
-
this.#terminated = true;
|
|
58719
59293
|
this.#cleanupDecompressors();
|
|
58720
|
-
|
|
59294
|
+
try {
|
|
59295
|
+
super.onResponseEnd(this.#controller, this.#trailers);
|
|
59296
|
+
} catch (err) {
|
|
59297
|
+
this.#fail(err);
|
|
59298
|
+
return;
|
|
59299
|
+
}
|
|
59300
|
+
this.#terminated = true;
|
|
58721
59301
|
}
|
|
58722
59302
|
#onDecompressionEnd() {
|
|
58723
59303
|
if (this.#terminated) return;
|
|
@@ -58952,6 +59532,7 @@ var require_deduplication_handler = /* @__PURE__ */ __commonJSMin(((exports, mod
|
|
|
58952
59532
|
* @property {number} bufferedBytes
|
|
58953
59533
|
* @property {object | null} pendingTrailers
|
|
58954
59534
|
* @property {boolean} done
|
|
59535
|
+
* @property {boolean} [pendingStart] onRequestStart deferred until the primary request's context is known
|
|
58955
59536
|
*/
|
|
58956
59537
|
/**
|
|
58957
59538
|
* Handler that forwards response events to multiple waiting handlers.
|
|
@@ -58965,6 +59546,18 @@ var require_deduplication_handler = /* @__PURE__ */ __commonJSMin(((exports, mod
|
|
|
58965
59546
|
*/
|
|
58966
59547
|
#primaryHandler;
|
|
58967
59548
|
/**
|
|
59549
|
+
* Whether the primary request has started (onRequestStart received). Until
|
|
59550
|
+
* then the request context is unknown and cannot be given to waiting handlers.
|
|
59551
|
+
* @type {boolean}
|
|
59552
|
+
*/
|
|
59553
|
+
#requestStarted = false;
|
|
59554
|
+
/**
|
|
59555
|
+
* The primary request context, replayed to waiting handlers so they observe
|
|
59556
|
+
* the same redirect history as the primary.
|
|
59557
|
+
* @type {any}
|
|
59558
|
+
*/
|
|
59559
|
+
#context = null;
|
|
59560
|
+
/**
|
|
58968
59561
|
* @type {WaitingHandler[]}
|
|
58969
59562
|
*/
|
|
58970
59563
|
#waitingHandlers = [];
|
|
@@ -59030,12 +59623,14 @@ var require_deduplication_handler = /* @__PURE__ */ __commonJSMin(((exports, mod
|
|
|
59030
59623
|
const waitingHandler = this.#createWaitingHandler(handler);
|
|
59031
59624
|
const waitingController = waitingHandler.controller;
|
|
59032
59625
|
try {
|
|
59033
|
-
|
|
59034
|
-
|
|
59035
|
-
|
|
59036
|
-
|
|
59037
|
-
|
|
59038
|
-
|
|
59626
|
+
if (this.#requestStarted) {
|
|
59627
|
+
handler.onRequestStart?.(waitingController, this.#context);
|
|
59628
|
+
if (waitingController.aborted) {
|
|
59629
|
+
waitingHandler.done = true;
|
|
59630
|
+
return true;
|
|
59631
|
+
}
|
|
59632
|
+
if (this.#responseStarted) handler.onResponseStart?.(waitingController, this.#statusCode, this.#headers, this.#statusMessage);
|
|
59633
|
+
} else waitingHandler.pendingStart = true;
|
|
59039
59634
|
} catch {
|
|
59040
59635
|
waitingHandler.done = true;
|
|
59041
59636
|
return true;
|
|
@@ -59049,6 +59644,19 @@ var require_deduplication_handler = /* @__PURE__ */ __commonJSMin(((exports, mod
|
|
|
59049
59644
|
*/
|
|
59050
59645
|
onRequestStart(controller, context) {
|
|
59051
59646
|
this.#controller = controller;
|
|
59647
|
+
if (!this.#requestStarted) {
|
|
59648
|
+
this.#requestStarted = true;
|
|
59649
|
+
this.#context = context;
|
|
59650
|
+
for (const waitingHandler of this.#waitingHandlers) if (waitingHandler.pendingStart && !waitingHandler.done && !waitingHandler.controller.aborted) {
|
|
59651
|
+
waitingHandler.pendingStart = false;
|
|
59652
|
+
try {
|
|
59653
|
+
waitingHandler.handler.onRequestStart?.(waitingHandler.controller, context);
|
|
59654
|
+
} catch {
|
|
59655
|
+
waitingHandler.done = true;
|
|
59656
|
+
}
|
|
59657
|
+
}
|
|
59658
|
+
this.#pruneDoneWaitingHandlers();
|
|
59659
|
+
}
|
|
59052
59660
|
this.#primaryHandler.onRequestStart?.(controller, context);
|
|
59053
59661
|
}
|
|
59054
59662
|
/**
|
|
@@ -59169,7 +59777,8 @@ var require_deduplication_handler = /* @__PURE__ */ __commonJSMin(((exports, mod
|
|
|
59169
59777
|
bufferedChunks: [],
|
|
59170
59778
|
bufferedBytes: 0,
|
|
59171
59779
|
pendingTrailers: null,
|
|
59172
|
-
done: false
|
|
59780
|
+
done: false,
|
|
59781
|
+
pendingStart: false
|
|
59173
59782
|
};
|
|
59174
59783
|
const state = {
|
|
59175
59784
|
aborted: false,
|
|
@@ -60987,6 +61596,7 @@ var require_request$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
60987
61596
|
var require_subresource_integrity = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
60988
61597
|
const assert$6 = require("node:assert");
|
|
60989
61598
|
const { runtimeFeatures } = require_runtime_features();
|
|
61599
|
+
const { asciiLowercase } = require_infra();
|
|
60990
61600
|
/**
|
|
60991
61601
|
* @typedef {object} Metadata
|
|
60992
61602
|
* @property {SRIHashAlgorithm} alg - The algorithm used for the hash.
|
|
@@ -61031,11 +61641,12 @@ var require_subresource_integrity = /* @__PURE__ */ __commonJSMin(((exports, mod
|
|
|
61031
61641
|
const getSRIHashAlgorithmIndex = Map.prototype.get.bind(validSRIHashAlgorithmTokenSet);
|
|
61032
61642
|
/**
|
|
61033
61643
|
* @typedef IsValidSRIHashAlgorithm
|
|
61644
|
+
* @see https://w3c.github.io/webappsec-subresource-integrity/#valid-sri-hash-algorithm-token
|
|
61034
61645
|
* @type {(algorithm: string) => algorithm is SRIHashAlgorithm}
|
|
61035
61646
|
* @param {*} algorithm
|
|
61036
61647
|
* @returns {algorithm is SRIHashAlgorithm}
|
|
61037
61648
|
*/
|
|
61038
|
-
const isValidSRIHashAlgorithm =
|
|
61649
|
+
const isValidSRIHashAlgorithm = (algorithm) => validSRIHashAlgorithmTokenSet.has(asciiLowercase(algorithm));
|
|
61039
61650
|
/**
|
|
61040
61651
|
* @param {Uint8Array} bytes
|
|
61041
61652
|
* @param {string} metadataList
|
|
@@ -61099,7 +61710,7 @@ var require_subresource_integrity = /* @__PURE__ */ __commonJSMin(((exports, mod
|
|
|
61099
61710
|
if (!isValidSRIHashAlgorithm(algorithm)) continue;
|
|
61100
61711
|
if (algorithmAndValue[1]) base64Value = algorithmAndValue[1];
|
|
61101
61712
|
const metadata = {
|
|
61102
|
-
alg: algorithm,
|
|
61713
|
+
alg: asciiLowercase(algorithm),
|
|
61103
61714
|
val: base64Value
|
|
61104
61715
|
};
|
|
61105
61716
|
result.push(metadata);
|
|
@@ -61791,9 +62402,7 @@ var require_fetch = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
61791
62402
|
if (Array.isArray(value) && !Buffer.isBuffer(rawHeaders[i + 1])) for (const val of value) headersList.append(nameStr, val.toString("latin1"), true);
|
|
61792
62403
|
else headersList.append(nameStr, value.toString("latin1"), true);
|
|
61793
62404
|
}
|
|
61794
|
-
const
|
|
61795
|
-
this.body = new Readable({ read: resume });
|
|
61796
|
-
const willFollow = location && request.redirect === "follow" && redirectStatusSet.has(status);
|
|
62405
|
+
const willFollow = headersList.get("location", true) && request.redirect === "follow" && redirectStatusSet.has(status);
|
|
61797
62406
|
const decoders = [];
|
|
61798
62407
|
if (request.method !== "HEAD" && request.method !== "CONNECT" && !nullBodyStatus.includes(status) && !willFollow) {
|
|
61799
62408
|
const contentEncoding = headersList.get("content-encoding", true);
|
|
@@ -61801,7 +62410,7 @@ var require_fetch = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
61801
62410
|
const codings = contentEncoding ? contentEncoding.toLowerCase().split(",") : [];
|
|
61802
62411
|
const maxContentEncodings = 5;
|
|
61803
62412
|
if (codings.length > maxContentEncodings) {
|
|
61804
|
-
|
|
62413
|
+
this.abort(/* @__PURE__ */ new Error(`too many content-encodings in response: ${codings.length}, maximum allowed is ${maxContentEncodings}`));
|
|
61805
62414
|
return true;
|
|
61806
62415
|
}
|
|
61807
62416
|
for (let i = codings.length - 1; i >= 0; --i) {
|
|
@@ -61828,6 +62437,7 @@ var require_fetch = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
61828
62437
|
}
|
|
61829
62438
|
}
|
|
61830
62439
|
}
|
|
62440
|
+
this.body = new Readable({ read: resume });
|
|
61831
62441
|
const onError = this.onError.bind(this);
|
|
61832
62442
|
resolve({
|
|
61833
62443
|
status,
|
|
@@ -62694,7 +63304,10 @@ var require_util$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
62694
63304
|
validateCookiePath(cookie.path);
|
|
62695
63305
|
out.push(`Path=${cookie.path}`);
|
|
62696
63306
|
}
|
|
62697
|
-
if (cookie.expires
|
|
63307
|
+
if (cookie.expires != null) {
|
|
63308
|
+
const expiresMs = cookie.expires instanceof Date ? cookie.expires.getTime() : cookie.expires;
|
|
63309
|
+
if (typeof expiresMs === "number" && Number.isFinite(expiresMs) && Math.abs(expiresMs) <= 864e13) out.push(`Expires=${toIMFDate(cookie.expires)}`);
|
|
63310
|
+
}
|
|
62698
63311
|
if (cookie.sameSite) out.push(`SameSite=${cookie.sameSite}`);
|
|
62699
63312
|
for (const part of cookie.unparsed) {
|
|
62700
63313
|
if (!part.includes("=")) throw new Error("Invalid unparsed");
|
|
@@ -62762,56 +63375,57 @@ var require_parse$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
62762
63375
|
* @param {Object.<string, unknown>} [cookieAttributeList={}]
|
|
62763
63376
|
*/
|
|
62764
63377
|
function parseUnparsedAttributes(unparsedAttributes, cookieAttributeList = {}) {
|
|
62765
|
-
|
|
62766
|
-
|
|
62767
|
-
|
|
62768
|
-
|
|
62769
|
-
|
|
62770
|
-
|
|
62771
|
-
|
|
62772
|
-
|
|
62773
|
-
|
|
62774
|
-
|
|
62775
|
-
|
|
62776
|
-
|
|
62777
|
-
|
|
62778
|
-
|
|
62779
|
-
|
|
62780
|
-
|
|
62781
|
-
|
|
62782
|
-
|
|
62783
|
-
|
|
62784
|
-
|
|
62785
|
-
|
|
62786
|
-
|
|
62787
|
-
|
|
62788
|
-
|
|
62789
|
-
|
|
62790
|
-
|
|
62791
|
-
|
|
62792
|
-
|
|
62793
|
-
|
|
62794
|
-
|
|
62795
|
-
|
|
62796
|
-
|
|
62797
|
-
|
|
62798
|
-
|
|
62799
|
-
|
|
62800
|
-
|
|
62801
|
-
|
|
62802
|
-
|
|
62803
|
-
|
|
62804
|
-
|
|
62805
|
-
|
|
62806
|
-
|
|
62807
|
-
|
|
62808
|
-
|
|
62809
|
-
|
|
62810
|
-
|
|
62811
|
-
|
|
62812
|
-
|
|
63378
|
+
while (true) {
|
|
63379
|
+
if (unparsedAttributes.length === 0) return cookieAttributeList;
|
|
63380
|
+
assert$2(unparsedAttributes[0] === ";");
|
|
63381
|
+
unparsedAttributes = unparsedAttributes.slice(1);
|
|
63382
|
+
let cookieAv = "";
|
|
63383
|
+
if (unparsedAttributes.includes(";")) {
|
|
63384
|
+
cookieAv = collectASequenceOfCodePointsFast(";", unparsedAttributes, { position: 0 });
|
|
63385
|
+
unparsedAttributes = unparsedAttributes.slice(cookieAv.length);
|
|
63386
|
+
} else {
|
|
63387
|
+
cookieAv = unparsedAttributes;
|
|
63388
|
+
unparsedAttributes = "";
|
|
63389
|
+
}
|
|
63390
|
+
let attributeName = "";
|
|
63391
|
+
let attributeValue = "";
|
|
63392
|
+
if (cookieAv.includes("=")) {
|
|
63393
|
+
const position = { position: 0 };
|
|
63394
|
+
attributeName = collectASequenceOfCodePointsFast("=", cookieAv, position);
|
|
63395
|
+
attributeValue = cookieAv.slice(position.position + 1);
|
|
63396
|
+
} else attributeName = cookieAv;
|
|
63397
|
+
attributeName = attributeName.trim();
|
|
63398
|
+
attributeValue = attributeValue.trim();
|
|
63399
|
+
if (attributeValue.length > maxAttributeValueSize) continue;
|
|
63400
|
+
const attributeNameLowercase = attributeName.toLowerCase();
|
|
63401
|
+
if (attributeNameLowercase === "expires") cookieAttributeList.expires = new Date(attributeValue);
|
|
63402
|
+
else if (attributeNameLowercase === "max-age") {
|
|
63403
|
+
const charCode = attributeValue.charCodeAt(0);
|
|
63404
|
+
if ((charCode < 48 || charCode > 57) && attributeValue[0] !== "-") continue;
|
|
63405
|
+
if (!/^\d+$/.test(attributeValue)) continue;
|
|
63406
|
+
cookieAttributeList.maxAge = Number(attributeValue);
|
|
63407
|
+
} else if (attributeNameLowercase === "domain") {
|
|
63408
|
+
let cookieDomain = attributeValue;
|
|
63409
|
+
if (cookieDomain[0] === ".") cookieDomain = cookieDomain.slice(1);
|
|
63410
|
+
cookieDomain = cookieDomain.toLowerCase();
|
|
63411
|
+
cookieAttributeList.domain = cookieDomain;
|
|
63412
|
+
} else if (attributeNameLowercase === "path") {
|
|
63413
|
+
let cookiePath = "";
|
|
63414
|
+
if (attributeValue.length === 0 || attributeValue[0] !== "/") cookiePath = "/";
|
|
63415
|
+
else cookiePath = attributeValue;
|
|
63416
|
+
cookieAttributeList.path = cookiePath;
|
|
63417
|
+
} else if (attributeNameLowercase === "secure") cookieAttributeList.secure = true;
|
|
63418
|
+
else if (attributeNameLowercase === "httponly") cookieAttributeList.httpOnly = true;
|
|
63419
|
+
else if (attributeNameLowercase === "samesite") {
|
|
63420
|
+
const attributeValueLowercase = attributeValue.toLowerCase();
|
|
63421
|
+
if (attributeValueLowercase === "none") cookieAttributeList.sameSite = "None";
|
|
63422
|
+
else if (attributeValueLowercase === "strict") cookieAttributeList.sameSite = "Strict";
|
|
63423
|
+
else if (attributeValueLowercase === "lax") cookieAttributeList.sameSite = "Lax";
|
|
63424
|
+
} else {
|
|
63425
|
+
cookieAttributeList.unparsed ??= [];
|
|
63426
|
+
cookieAttributeList.unparsed.push(`${attributeName}=${attributeValue}`);
|
|
63427
|
+
}
|
|
62813
63428
|
}
|
|
62814
|
-
return parseUnparsedAttributes(unparsedAttributes, cookieAttributeList);
|
|
62815
63429
|
}
|
|
62816
63430
|
module.exports = {
|
|
62817
63431
|
parseSetCookie,
|
|
@@ -62848,7 +63462,7 @@ var require_cookies = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
62848
63462
|
brandChecks(headers);
|
|
62849
63463
|
const cookie = headers.get("cookie");
|
|
62850
63464
|
/** @type {Record<string, string>} */
|
|
62851
|
-
const out = {};
|
|
63465
|
+
const out = { __proto__: null };
|
|
62852
63466
|
if (!cookie) return out;
|
|
62853
63467
|
for (const piece of cookie.split(";")) {
|
|
62854
63468
|
const [name, ...value] = piece.split("=");
|
|
@@ -63974,6 +64588,15 @@ var require_receiver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
63974
64588
|
if (isControlFrame(this.#info.opcode)) {
|
|
63975
64589
|
this.#loop = this.parseControlFrame(body);
|
|
63976
64590
|
this.#state = parserStates.INFO;
|
|
64591
|
+
if (this.#loop && this.#handler.socket.writableNeedDrain) {
|
|
64592
|
+
this.#loop = false;
|
|
64593
|
+
this.#handler.socket.once("drain", () => {
|
|
64594
|
+
if (this.destroyed) return;
|
|
64595
|
+
this.#loop = true;
|
|
64596
|
+
this.run(callback);
|
|
64597
|
+
});
|
|
64598
|
+
return;
|
|
64599
|
+
}
|
|
63977
64600
|
} else if (!this.#info.compressed) {
|
|
63978
64601
|
if (!this.writeFragments(body)) return;
|
|
63979
64602
|
if (!this.#info.fragmented && this.#info.fin) websocketMessageReceived(this.#handler, this.#info.binaryType, this.consumeFragments());
|
|
@@ -64992,6 +65615,7 @@ var require_util = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
64992
65615
|
//#endregion
|
|
64993
65616
|
//#region ../../node_modules/undici/lib/web/eventsource/eventsource-stream.js
|
|
64994
65617
|
var require_eventsource_stream = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
65618
|
+
const buffer = require("node:buffer");
|
|
64995
65619
|
const { Transform } = require("node:stream");
|
|
64996
65620
|
const { isASCIINumber, isValidLastEventId } = require_util();
|
|
64997
65621
|
/**
|
|
@@ -65018,10 +65642,14 @@ var require_eventsource_stream = /* @__PURE__ */ __commonJSMin(((exports, module
|
|
|
65018
65642
|
* @type {32} SPACE
|
|
65019
65643
|
*/
|
|
65020
65644
|
const SPACE = 32;
|
|
65645
|
+
const defaultMaxEventSize = buffer.kStringMaxLength;
|
|
65021
65646
|
const DATA = Buffer.from("data");
|
|
65022
65647
|
const EVENT = Buffer.from("event");
|
|
65023
65648
|
const ID = Buffer.from("id");
|
|
65024
65649
|
const RETRY = Buffer.from("retry");
|
|
65650
|
+
const minParserItems = 1024;
|
|
65651
|
+
const maxParserItems = 131072;
|
|
65652
|
+
const bytesPerParserItem = 128;
|
|
65025
65653
|
function isASCIINumberBytes(buffer, start) {
|
|
65026
65654
|
if (start >= buffer.length) return false;
|
|
65027
65655
|
for (let i = start; i < buffer.length; i++) if (buffer[i] < 48 || buffer[i] > 57) return false;
|
|
@@ -65036,6 +65664,11 @@ var require_eventsource_stream = /* @__PURE__ */ __commonJSMin(((exports, module
|
|
|
65036
65664
|
for (let i = 0; i < length; i++) if (line[i] !== field[i]) return false;
|
|
65037
65665
|
return true;
|
|
65038
65666
|
}
|
|
65667
|
+
function createMaxEventSizeExceededError() {
|
|
65668
|
+
const error = /* @__PURE__ */ new Error("EventSource message size exceeded");
|
|
65669
|
+
error.aborted = false;
|
|
65670
|
+
return error;
|
|
65671
|
+
}
|
|
65039
65672
|
/**
|
|
65040
65673
|
* @typedef {object} EventSourceStreamEvent
|
|
65041
65674
|
* @type {object}
|
|
@@ -65077,6 +65710,18 @@ var require_eventsource_stream = /* @__PURE__ */ __commonJSMin(((exports, module
|
|
|
65077
65710
|
pos = 0;
|
|
65078
65711
|
lineChunkIndex = 0;
|
|
65079
65712
|
linePos = 0;
|
|
65713
|
+
lineLength = 0;
|
|
65714
|
+
eventSize = 0;
|
|
65715
|
+
eventFieldSizes = {
|
|
65716
|
+
data: 0,
|
|
65717
|
+
event: 0,
|
|
65718
|
+
id: 0,
|
|
65719
|
+
retry: 0
|
|
65720
|
+
};
|
|
65721
|
+
dataLineCount = 0;
|
|
65722
|
+
maxEventSize;
|
|
65723
|
+
maxDataLines;
|
|
65724
|
+
maxBufferedChunks;
|
|
65080
65725
|
event = {
|
|
65081
65726
|
data: void 0,
|
|
65082
65727
|
event: void 0,
|
|
@@ -65086,6 +65731,7 @@ var require_eventsource_stream = /* @__PURE__ */ __commonJSMin(((exports, module
|
|
|
65086
65731
|
/**
|
|
65087
65732
|
* @param {object} options
|
|
65088
65733
|
* @param {boolean} [options.readableObjectMode]
|
|
65734
|
+
* @param {number} [options.maxEventSize]
|
|
65089
65735
|
* @param {eventSourceSettings} [options.eventSourceSettings]
|
|
65090
65736
|
* @param {(chunk: any, encoding?: BufferEncoding | undefined) => boolean} [options.push]
|
|
65091
65737
|
*/
|
|
@@ -65093,6 +65739,10 @@ var require_eventsource_stream = /* @__PURE__ */ __commonJSMin(((exports, module
|
|
|
65093
65739
|
options.readableObjectMode = true;
|
|
65094
65740
|
super(options);
|
|
65095
65741
|
this.state = options.eventSourceSettings || {};
|
|
65742
|
+
this.maxEventSize = options.maxEventSize ?? defaultMaxEventSize;
|
|
65743
|
+
const parserItemLimit = this.maxEventSize > 0 ? Math.min(maxParserItems, Math.max(minParserItems, Math.floor(this.maxEventSize / bytesPerParserItem))) : 0;
|
|
65744
|
+
this.maxDataLines = parserItemLimit;
|
|
65745
|
+
this.maxBufferedChunks = parserItemLimit;
|
|
65096
65746
|
if (options.push) this.push = options.push;
|
|
65097
65747
|
}
|
|
65098
65748
|
/**
|
|
@@ -65106,6 +65756,10 @@ var require_eventsource_stream = /* @__PURE__ */ __commonJSMin(((exports, module
|
|
|
65106
65756
|
callback();
|
|
65107
65757
|
return;
|
|
65108
65758
|
}
|
|
65759
|
+
if (this.maxEventSize > 0 && this.chunks.length >= this.maxBufferedChunks && chunk[0] !== LF && chunk[0] !== CR) {
|
|
65760
|
+
callback(createMaxEventSizeExceededError());
|
|
65761
|
+
return;
|
|
65762
|
+
}
|
|
65109
65763
|
this.chunks.push(chunk);
|
|
65110
65764
|
if (this.checkBOM) {
|
|
65111
65765
|
if (this.handleBOM()) {
|
|
@@ -65136,15 +65790,29 @@ var require_eventsource_stream = /* @__PURE__ */ __commonJSMin(((exports, module
|
|
|
65136
65790
|
}
|
|
65137
65791
|
if (byte === LF || byte === CR) {
|
|
65138
65792
|
if (byte === CR) this.crlfCheck = true;
|
|
65139
|
-
|
|
65793
|
+
try {
|
|
65794
|
+
this.parseLine(this.readLine(), this.event);
|
|
65795
|
+
} catch (error) {
|
|
65796
|
+
callback(error);
|
|
65797
|
+
return;
|
|
65798
|
+
}
|
|
65140
65799
|
this.consumeCurrentByte();
|
|
65141
65800
|
this.eventEndCheck = true;
|
|
65142
65801
|
continue;
|
|
65143
65802
|
}
|
|
65803
|
+
if (this.maxEventSize > 0 && ++this.lineLength > this.maxEventSize + 7) {
|
|
65804
|
+
callback(createMaxEventSizeExceededError());
|
|
65805
|
+
return;
|
|
65806
|
+
}
|
|
65144
65807
|
this.advanceCursor();
|
|
65145
65808
|
}
|
|
65146
65809
|
callback();
|
|
65147
65810
|
}
|
|
65811
|
+
_destroy(error, callback) {
|
|
65812
|
+
this.chunks.length = 0;
|
|
65813
|
+
this.clearEvent();
|
|
65814
|
+
super._destroy(error, callback);
|
|
65815
|
+
}
|
|
65148
65816
|
/**
|
|
65149
65817
|
* @param {Buffer} line
|
|
65150
65818
|
* @param {EventSourceStreamEvent} event
|
|
@@ -65161,24 +65829,43 @@ var require_eventsource_stream = /* @__PURE__ */ __commonJSMin(((exports, module
|
|
|
65161
65829
|
if (line[valueStart] === SPACE) ++valueStart;
|
|
65162
65830
|
}
|
|
65163
65831
|
if (isFieldName(line, fieldLength, DATA)) {
|
|
65832
|
+
if (this.maxEventSize > 0 && this.dataLineCount >= this.maxDataLines) throw createMaxEventSizeExceededError();
|
|
65833
|
+
const valueBytes = line.length - valueStart;
|
|
65834
|
+
const dataSize = this.eventFieldSizes.data + (event.data === void 0 ? 0 : 1) + valueBytes;
|
|
65835
|
+
this.setEventFieldSize("data", dataSize);
|
|
65164
65836
|
const value = line.toString("utf8", valueStart);
|
|
65165
65837
|
if (event.data === void 0) event.data = value;
|
|
65166
65838
|
else event.data += `\n${value}`;
|
|
65839
|
+
this.dataLineCount++;
|
|
65167
65840
|
return;
|
|
65168
65841
|
}
|
|
65169
65842
|
if (isFieldName(line, fieldLength, RETRY)) {
|
|
65170
|
-
if (isASCIINumberBytes(line, valueStart))
|
|
65843
|
+
if (isASCIINumberBytes(line, valueStart)) {
|
|
65844
|
+
this.setEventFieldSize("retry", line.length - valueStart);
|
|
65845
|
+
event.retry = line.toString("utf8", valueStart);
|
|
65846
|
+
}
|
|
65171
65847
|
return;
|
|
65172
65848
|
}
|
|
65173
65849
|
if (isFieldName(line, fieldLength, ID)) {
|
|
65174
|
-
if (isValidLastEventIdBytes(line, valueStart))
|
|
65850
|
+
if (isValidLastEventIdBytes(line, valueStart)) {
|
|
65851
|
+
this.setEventFieldSize("id", line.length - valueStart);
|
|
65852
|
+
event.id = line.toString("utf8", valueStart);
|
|
65853
|
+
}
|
|
65175
65854
|
return;
|
|
65176
65855
|
}
|
|
65177
65856
|
if (isFieldName(line, fieldLength, EVENT)) {
|
|
65178
|
-
|
|
65179
|
-
|
|
65857
|
+
if (valueStart < line.length) {
|
|
65858
|
+
this.setEventFieldSize("event", line.length - valueStart);
|
|
65859
|
+
event.event = line.toString("utf8", valueStart);
|
|
65860
|
+
}
|
|
65180
65861
|
}
|
|
65181
65862
|
}
|
|
65863
|
+
setEventFieldSize(field, size) {
|
|
65864
|
+
const eventSize = this.eventSize - this.eventFieldSizes[field] + size;
|
|
65865
|
+
if (this.maxEventSize > 0 && eventSize > this.maxEventSize) throw createMaxEventSizeExceededError();
|
|
65866
|
+
this.eventSize = eventSize;
|
|
65867
|
+
this.eventFieldSizes[field] = size;
|
|
65868
|
+
}
|
|
65182
65869
|
/**
|
|
65183
65870
|
* @param {EventSourceStreamEvent} event
|
|
65184
65871
|
*/
|
|
@@ -65199,6 +65886,12 @@ var require_eventsource_stream = /* @__PURE__ */ __commonJSMin(((exports, module
|
|
|
65199
65886
|
this.event.event = void 0;
|
|
65200
65887
|
this.event.id = void 0;
|
|
65201
65888
|
this.event.retry = void 0;
|
|
65889
|
+
this.eventSize = 0;
|
|
65890
|
+
this.dataLineCount = 0;
|
|
65891
|
+
this.eventFieldSizes.data = 0;
|
|
65892
|
+
this.eventFieldSizes.event = 0;
|
|
65893
|
+
this.eventFieldSizes.id = 0;
|
|
65894
|
+
this.eventFieldSizes.retry = 0;
|
|
65202
65895
|
}
|
|
65203
65896
|
hasPendingEvent() {
|
|
65204
65897
|
return this.event.data !== void 0 || this.event.event !== void 0 || this.event.id !== void 0 || this.event.retry !== void 0;
|
|
@@ -65223,13 +65916,15 @@ var require_eventsource_stream = /* @__PURE__ */ __commonJSMin(((exports, module
|
|
|
65223
65916
|
syncLineStartToCursor() {
|
|
65224
65917
|
this.lineChunkIndex = this.chunkIndex;
|
|
65225
65918
|
this.linePos = this.pos;
|
|
65919
|
+
this.lineLength = 0;
|
|
65226
65920
|
this.dropConsumedChunks();
|
|
65227
65921
|
}
|
|
65228
65922
|
dropConsumedChunks() {
|
|
65229
|
-
|
|
65230
|
-
this.
|
|
65231
|
-
this.
|
|
65232
|
-
this.
|
|
65923
|
+
if (this.lineChunkIndex > 0) {
|
|
65924
|
+
const consumed = this.lineChunkIndex;
|
|
65925
|
+
this.chunks.splice(0, consumed);
|
|
65926
|
+
this.lineChunkIndex = 0;
|
|
65927
|
+
this.chunkIndex -= consumed;
|
|
65233
65928
|
}
|
|
65234
65929
|
if (this.chunkIndex === this.chunks.length) {
|
|
65235
65930
|
this.chunks.length = 0;
|
|
@@ -65315,6 +66010,7 @@ var require_eventsource = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
65315
66010
|
const { isNetworkError } = require_response();
|
|
65316
66011
|
const { kEnumerableProperty } = require_util$5();
|
|
65317
66012
|
const { environmentSettingsObject } = require_util$4();
|
|
66013
|
+
const { getGlobalDispatcher } = require_global();
|
|
65318
66014
|
let experimentalWarned = false;
|
|
65319
66015
|
/**
|
|
65320
66016
|
* A reconnection time, in milliseconds. This must initially be an implementation-defined value,
|
|
@@ -65499,6 +66195,7 @@ var require_eventsource = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
65499
66195
|
this.#state.origin = response.urlList[response.urlList.length - 1].origin;
|
|
65500
66196
|
const eventSourceStream = new EventSourceStream({
|
|
65501
66197
|
eventSourceSettings: this.#state,
|
|
66198
|
+
maxEventSize: this.#dispatcher.eventSourceOptions?.maxEventSize,
|
|
65502
66199
|
push: (event) => {
|
|
65503
66200
|
this.dispatchEvent(createFastMessageEvent(event.type, event.options));
|
|
65504
66201
|
}
|
|
@@ -65613,7 +66310,8 @@ var require_eventsource = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
65613
66310
|
},
|
|
65614
66311
|
{
|
|
65615
66312
|
key: "dispatcher",
|
|
65616
|
-
converter: webidl.converters.any
|
|
66313
|
+
converter: webidl.converters.any,
|
|
66314
|
+
defaultValue: () => getGlobalDispatcher()
|
|
65617
66315
|
},
|
|
65618
66316
|
{
|
|
65619
66317
|
key: "node",
|