@aku11i/phantom 6.3.0-3 → 6.3.0-5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/server/{app-BLBOjh4e.mjs → app-CYTfYqUa.mjs} +3801 -227
- package/app/server/app-CYTfYqUa.mjs.map +1 -0
- package/app/server/index.mjs +1 -1
- package/app/server/start.mjs +1 -1
- package/app/web/assets/index-2tOj0_vn.js +52 -0
- package/app/web/assets/index-CwcMZa7-.css +2 -0
- package/app/web/index.html +3 -3
- package/app/web/manifest.webmanifest +1 -1
- package/package.json +1 -1
- package/phantom.js +3177 -6
- package/app/server/app-BLBOjh4e.mjs.map +0 -1
- package/app/web/assets/index-DfF5Sezp.css +0 -2
- package/app/web/assets/index-IIn3YvIM.js +0 -52
package/phantom.js
CHANGED
|
@@ -2,10 +2,15 @@
|
|
|
2
2
|
import process$1, { argv, exit, stdout } from "node:process";
|
|
3
3
|
import { execFile, spawn, spawnSync } from "node:child_process";
|
|
4
4
|
import { parseArgs, promisify } from "node:util";
|
|
5
|
-
import fs, { access, copyFile, mkdir, stat } from "node:fs/promises";
|
|
6
|
-
import path, { dirname, isAbsolute, join, relative, resolve } from "node:path";
|
|
7
|
-
import { existsSync } from "node:fs";
|
|
5
|
+
import fs, { access, copyFile, lstat, mkdir, readdir, readlink, realpath, stat } from "node:fs/promises";
|
|
6
|
+
import path, { dirname, isAbsolute, join, posix, relative, resolve, win32 } from "node:path";
|
|
8
7
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
8
|
+
import { lstatSync, readdir as readdir$1, readdirSync, readlinkSync, realpathSync } from "fs";
|
|
9
|
+
import * as xi from "node:fs";
|
|
10
|
+
import { existsSync } from "node:fs";
|
|
11
|
+
import { EventEmitter } from "node:events";
|
|
12
|
+
import Pe from "node:stream";
|
|
13
|
+
import { StringDecoder } from "node:string_decoder";
|
|
9
14
|
//#region \0rolldown/runtime.js
|
|
10
15
|
var __create = Object.create;
|
|
11
16
|
var __defProp = Object.defineProperty;
|
|
@@ -7545,6 +7550,3169 @@ async function runWorktreeAction(options) {
|
|
|
7545
7550
|
return ok({});
|
|
7546
7551
|
}
|
|
7547
7552
|
//#endregion
|
|
7553
|
+
//#region ../../node_modules/.pnpm/glob@13.0.6/node_modules/glob/dist/esm/index.min.js
|
|
7554
|
+
var Gt = (n, t, e) => {
|
|
7555
|
+
let s = n instanceof RegExp ? ce(n, e) : n, i = t instanceof RegExp ? ce(t, e) : t, r = s !== null && i != null && ss(s, i, e);
|
|
7556
|
+
return r && {
|
|
7557
|
+
start: r[0],
|
|
7558
|
+
end: r[1],
|
|
7559
|
+
pre: e.slice(0, r[0]),
|
|
7560
|
+
body: e.slice(r[0] + s.length, r[1]),
|
|
7561
|
+
post: e.slice(r[1] + i.length)
|
|
7562
|
+
};
|
|
7563
|
+
}, ce = (n, t) => {
|
|
7564
|
+
let e = t.match(n);
|
|
7565
|
+
return e ? e[0] : null;
|
|
7566
|
+
}, ss = (n, t, e) => {
|
|
7567
|
+
let s, i, r, o, h, a = e.indexOf(n), l = e.indexOf(t, a + 1), u = a;
|
|
7568
|
+
if (a >= 0 && l > 0) {
|
|
7569
|
+
if (n === t) return [a, l];
|
|
7570
|
+
for (s = [], r = e.length; u >= 0 && !h;) {
|
|
7571
|
+
if (u === a) s.push(u), a = e.indexOf(n, u + 1);
|
|
7572
|
+
else if (s.length === 1) {
|
|
7573
|
+
let c = s.pop();
|
|
7574
|
+
c !== void 0 && (h = [c, l]);
|
|
7575
|
+
} else i = s.pop(), i !== void 0 && i < r && (r = i, o = l), l = e.indexOf(t, u + 1);
|
|
7576
|
+
u = a < l && a >= 0 ? a : l;
|
|
7577
|
+
}
|
|
7578
|
+
s.length && o !== void 0 && (h = [r, o]);
|
|
7579
|
+
}
|
|
7580
|
+
return h;
|
|
7581
|
+
};
|
|
7582
|
+
var fe = "\0SLASH" + Math.random() + "\0", ue = "\0OPEN" + Math.random() + "\0", qt = "\0CLOSE" + Math.random() + "\0", de = "\0COMMA" + Math.random() + "\0", pe = "\0PERIOD" + Math.random() + "\0", is = new RegExp(fe, "g"), rs = new RegExp(ue, "g"), ns = new RegExp(qt, "g"), os = new RegExp(de, "g"), hs = new RegExp(pe, "g"), as = /\\\\/g, ls = /\\{/g, cs = /\\}/g, fs$1 = /\\,/g, us = /\\./g, ds = 1e5;
|
|
7583
|
+
function Ht(n) {
|
|
7584
|
+
return isNaN(n) ? n.charCodeAt(0) : parseInt(n, 10);
|
|
7585
|
+
}
|
|
7586
|
+
function ps(n) {
|
|
7587
|
+
return n.replace(as, fe).replace(ls, ue).replace(cs, qt).replace(fs$1, de).replace(us, pe);
|
|
7588
|
+
}
|
|
7589
|
+
function ms(n) {
|
|
7590
|
+
return n.replace(is, "\\").replace(rs, "{").replace(ns, "}").replace(os, ",").replace(hs, ".");
|
|
7591
|
+
}
|
|
7592
|
+
function me(n) {
|
|
7593
|
+
if (!n) return [""];
|
|
7594
|
+
let t = [], e = Gt("{", "}", n);
|
|
7595
|
+
if (!e) return n.split(",");
|
|
7596
|
+
let { pre: s, body: i, post: r } = e, o = s.split(",");
|
|
7597
|
+
o[o.length - 1] += "{" + i + "}";
|
|
7598
|
+
let h = me(r);
|
|
7599
|
+
return r.length && (o[o.length - 1] += h.shift(), o.push.apply(o, h)), t.push.apply(t, o), t;
|
|
7600
|
+
}
|
|
7601
|
+
function ge(n, t = {}) {
|
|
7602
|
+
if (!n) return [];
|
|
7603
|
+
let { max: e = ds } = t;
|
|
7604
|
+
return n.slice(0, 2) === "{}" && (n = "\\{\\}" + n.slice(2)), ht(ps(n), e, !0).map(ms);
|
|
7605
|
+
}
|
|
7606
|
+
function gs(n) {
|
|
7607
|
+
return "{" + n + "}";
|
|
7608
|
+
}
|
|
7609
|
+
function ws(n) {
|
|
7610
|
+
return /^-?0\d/.test(n);
|
|
7611
|
+
}
|
|
7612
|
+
function ys(n, t) {
|
|
7613
|
+
return n <= t;
|
|
7614
|
+
}
|
|
7615
|
+
function bs(n, t) {
|
|
7616
|
+
return n >= t;
|
|
7617
|
+
}
|
|
7618
|
+
function ht(n, t, e) {
|
|
7619
|
+
let s = [], i = Gt("{", "}", n);
|
|
7620
|
+
if (!i) return [n];
|
|
7621
|
+
let r = i.pre, o = i.post.length ? ht(i.post, t, !1) : [""];
|
|
7622
|
+
if (/\$$/.test(i.pre)) for (let h = 0; h < o.length && h < t; h++) {
|
|
7623
|
+
let a = r + "{" + i.body + "}" + o[h];
|
|
7624
|
+
s.push(a);
|
|
7625
|
+
}
|
|
7626
|
+
else {
|
|
7627
|
+
let h = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body), a = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body), l = h || a, u = i.body.indexOf(",") >= 0;
|
|
7628
|
+
if (!l && !u) return i.post.match(/,(?!,).*\}/) ? (n = i.pre + "{" + i.body + qt + i.post, ht(n, t, !0)) : [n];
|
|
7629
|
+
let c;
|
|
7630
|
+
if (l) c = i.body.split(/\.\./);
|
|
7631
|
+
else if (c = me(i.body), c.length === 1 && c[0] !== void 0 && (c = ht(c[0], t, !1).map(gs), c.length === 1)) return o.map((f) => i.pre + c[0] + f);
|
|
7632
|
+
let d;
|
|
7633
|
+
if (l && c[0] !== void 0 && c[1] !== void 0) {
|
|
7634
|
+
let f = Ht(c[0]), m = Ht(c[1]), p = Math.max(c[0].length, c[1].length), w = c.length === 3 && c[2] !== void 0 ? Math.abs(Ht(c[2])) : 1, g = ys;
|
|
7635
|
+
m < f && (w *= -1, g = bs);
|
|
7636
|
+
let E = c.some(ws);
|
|
7637
|
+
d = [];
|
|
7638
|
+
for (let y = f; g(y, m); y += w) {
|
|
7639
|
+
let b;
|
|
7640
|
+
if (a) b = String.fromCharCode(y), b === "\\" && (b = "");
|
|
7641
|
+
else if (b = String(y), E) {
|
|
7642
|
+
let z = p - b.length;
|
|
7643
|
+
if (z > 0) {
|
|
7644
|
+
let $ = new Array(z + 1).join("0");
|
|
7645
|
+
y < 0 ? b = "-" + $ + b.slice(1) : b = $ + b;
|
|
7646
|
+
}
|
|
7647
|
+
}
|
|
7648
|
+
d.push(b);
|
|
7649
|
+
}
|
|
7650
|
+
} else {
|
|
7651
|
+
d = [];
|
|
7652
|
+
for (let f = 0; f < c.length; f++) d.push.apply(d, ht(c[f], t, !1));
|
|
7653
|
+
}
|
|
7654
|
+
for (let f = 0; f < d.length; f++) for (let m = 0; m < o.length && s.length < t; m++) {
|
|
7655
|
+
let p = r + d[f] + o[m];
|
|
7656
|
+
(!e || l || p) && s.push(p);
|
|
7657
|
+
}
|
|
7658
|
+
}
|
|
7659
|
+
return s;
|
|
7660
|
+
}
|
|
7661
|
+
var at = (n) => {
|
|
7662
|
+
if (typeof n != "string") throw new TypeError("invalid pattern");
|
|
7663
|
+
if (n.length > 65536) throw new TypeError("pattern is too long");
|
|
7664
|
+
};
|
|
7665
|
+
var Ss = {
|
|
7666
|
+
"[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", !0],
|
|
7667
|
+
"[:alpha:]": ["\\p{L}\\p{Nl}", !0],
|
|
7668
|
+
"[:ascii:]": ["\\x00-\\x7f", !1],
|
|
7669
|
+
"[:blank:]": ["\\p{Zs}\\t", !0],
|
|
7670
|
+
"[:cntrl:]": ["\\p{Cc}", !0],
|
|
7671
|
+
"[:digit:]": ["\\p{Nd}", !0],
|
|
7672
|
+
"[:graph:]": [
|
|
7673
|
+
"\\p{Z}\\p{C}",
|
|
7674
|
+
!0,
|
|
7675
|
+
!0
|
|
7676
|
+
],
|
|
7677
|
+
"[:lower:]": ["\\p{Ll}", !0],
|
|
7678
|
+
"[:print:]": ["\\p{C}", !0],
|
|
7679
|
+
"[:punct:]": ["\\p{P}", !0],
|
|
7680
|
+
"[:space:]": ["\\p{Z}\\t\\r\\n\\v\\f", !0],
|
|
7681
|
+
"[:upper:]": ["\\p{Lu}", !0],
|
|
7682
|
+
"[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}", !0],
|
|
7683
|
+
"[:xdigit:]": ["A-Fa-f0-9", !1]
|
|
7684
|
+
}, lt = (n) => n.replace(/[[\]\\-]/g, "\\$&"), Es = (n) => n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), we = (n) => n.join(""), ye = (n, t) => {
|
|
7685
|
+
let e = t;
|
|
7686
|
+
if (n.charAt(e) !== "[") throw new Error("not in a brace expression");
|
|
7687
|
+
let s = [], i = [], r = e + 1, o = !1, h = !1, a = !1, l = !1, u = e, c = "";
|
|
7688
|
+
t: for (; r < n.length;) {
|
|
7689
|
+
let p = n.charAt(r);
|
|
7690
|
+
if ((p === "!" || p === "^") && r === e + 1) {
|
|
7691
|
+
l = !0, r++;
|
|
7692
|
+
continue;
|
|
7693
|
+
}
|
|
7694
|
+
if (p === "]" && o && !a) {
|
|
7695
|
+
u = r + 1;
|
|
7696
|
+
break;
|
|
7697
|
+
}
|
|
7698
|
+
if (o = !0, p === "\\" && !a) {
|
|
7699
|
+
a = !0, r++;
|
|
7700
|
+
continue;
|
|
7701
|
+
}
|
|
7702
|
+
if (p === "[" && !a) {
|
|
7703
|
+
for (let [w, [g, S, E]] of Object.entries(Ss)) if (n.startsWith(w, r)) {
|
|
7704
|
+
if (c) return [
|
|
7705
|
+
"$.",
|
|
7706
|
+
!1,
|
|
7707
|
+
n.length - e,
|
|
7708
|
+
!0
|
|
7709
|
+
];
|
|
7710
|
+
r += w.length, E ? i.push(g) : s.push(g), h = h || S;
|
|
7711
|
+
continue t;
|
|
7712
|
+
}
|
|
7713
|
+
}
|
|
7714
|
+
if (a = !1, c) {
|
|
7715
|
+
p > c ? s.push(lt(c) + "-" + lt(p)) : p === c && s.push(lt(p)), c = "", r++;
|
|
7716
|
+
continue;
|
|
7717
|
+
}
|
|
7718
|
+
if (n.startsWith("-]", r + 1)) {
|
|
7719
|
+
s.push(lt(p + "-")), r += 2;
|
|
7720
|
+
continue;
|
|
7721
|
+
}
|
|
7722
|
+
if (n.startsWith("-", r + 1)) {
|
|
7723
|
+
c = p, r += 2;
|
|
7724
|
+
continue;
|
|
7725
|
+
}
|
|
7726
|
+
s.push(lt(p)), r++;
|
|
7727
|
+
}
|
|
7728
|
+
if (u < r) return [
|
|
7729
|
+
"",
|
|
7730
|
+
!1,
|
|
7731
|
+
0,
|
|
7732
|
+
!1
|
|
7733
|
+
];
|
|
7734
|
+
if (!s.length && !i.length) return [
|
|
7735
|
+
"$.",
|
|
7736
|
+
!1,
|
|
7737
|
+
n.length - e,
|
|
7738
|
+
!0
|
|
7739
|
+
];
|
|
7740
|
+
if (i.length === 0 && s.length === 1 && /^\\?.$/.test(s[0]) && !l) return [
|
|
7741
|
+
Es(s[0].length === 2 ? s[0].slice(-1) : s[0]),
|
|
7742
|
+
!1,
|
|
7743
|
+
u - e,
|
|
7744
|
+
!1
|
|
7745
|
+
];
|
|
7746
|
+
let d = "[" + (l ? "^" : "") + we(s) + "]", f = "[" + (l ? "" : "^") + we(i) + "]";
|
|
7747
|
+
return [
|
|
7748
|
+
s.length && i.length ? "(" + d + "|" + f + ")" : s.length ? d : f,
|
|
7749
|
+
h,
|
|
7750
|
+
u - e,
|
|
7751
|
+
!0
|
|
7752
|
+
];
|
|
7753
|
+
};
|
|
7754
|
+
var W = (n, { windowsPathsNoEscape: t = !1, magicalBraces: e = !0 } = {}) => e ? t ? n.replace(/\[([^\/\\])\]/g, "$1") : n.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1") : t ? n.replace(/\[([^\/\\{}])\]/g, "$1") : n.replace(/((?!\\).|^)\[([^\/\\{}])\]/g, "$1$2").replace(/\\([^\/{}])/g, "$1");
|
|
7755
|
+
var xs = new Set([
|
|
7756
|
+
"!",
|
|
7757
|
+
"?",
|
|
7758
|
+
"+",
|
|
7759
|
+
"*",
|
|
7760
|
+
"@"
|
|
7761
|
+
]), be = (n) => xs.has(n), vs = "(?!(?:^|/)\\.\\.?(?:$|/))", Ct = "(?!\\.)", Cs = new Set(["[", "."]), Ts = new Set(["..", "."]), As = /* @__PURE__ */ new Set("().*{}+?[]^$\\!"), ks = (n) => n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), Kt = "[^/]", Se = Kt + "*?", Ee = Kt + "+?", Q = class n {
|
|
7762
|
+
type;
|
|
7763
|
+
#t;
|
|
7764
|
+
#s;
|
|
7765
|
+
#n = !1;
|
|
7766
|
+
#r = [];
|
|
7767
|
+
#o;
|
|
7768
|
+
#S;
|
|
7769
|
+
#w;
|
|
7770
|
+
#c = !1;
|
|
7771
|
+
#h;
|
|
7772
|
+
#u;
|
|
7773
|
+
#f = !1;
|
|
7774
|
+
constructor(t, e, s = {}) {
|
|
7775
|
+
this.type = t, t && (this.#s = !0), this.#o = e, this.#t = this.#o ? this.#o.#t : this, this.#h = this.#t === this ? s : this.#t.#h, this.#w = this.#t === this ? [] : this.#t.#w, t === "!" && !this.#t.#c && this.#w.push(this), this.#S = this.#o ? this.#o.#r.length : 0;
|
|
7776
|
+
}
|
|
7777
|
+
get hasMagic() {
|
|
7778
|
+
if (this.#s !== void 0) return this.#s;
|
|
7779
|
+
for (let t of this.#r) if (typeof t != "string" && (t.type || t.hasMagic)) return this.#s = !0;
|
|
7780
|
+
return this.#s;
|
|
7781
|
+
}
|
|
7782
|
+
toString() {
|
|
7783
|
+
return this.#u !== void 0 ? this.#u : this.type ? this.#u = this.type + "(" + this.#r.map((t) => String(t)).join("|") + ")" : this.#u = this.#r.map((t) => String(t)).join("");
|
|
7784
|
+
}
|
|
7785
|
+
#a() {
|
|
7786
|
+
if (this !== this.#t) throw new Error("should only call on root");
|
|
7787
|
+
if (this.#c) return this;
|
|
7788
|
+
this.toString(), this.#c = !0;
|
|
7789
|
+
let t;
|
|
7790
|
+
for (; t = this.#w.pop();) {
|
|
7791
|
+
if (t.type !== "!") continue;
|
|
7792
|
+
let e = t, s = e.#o;
|
|
7793
|
+
for (; s;) {
|
|
7794
|
+
for (let i = e.#S + 1; !s.type && i < s.#r.length; i++) for (let r of t.#r) {
|
|
7795
|
+
if (typeof r == "string") throw new Error("string part in extglob AST??");
|
|
7796
|
+
r.copyIn(s.#r[i]);
|
|
7797
|
+
}
|
|
7798
|
+
e = s, s = e.#o;
|
|
7799
|
+
}
|
|
7800
|
+
}
|
|
7801
|
+
return this;
|
|
7802
|
+
}
|
|
7803
|
+
push(...t) {
|
|
7804
|
+
for (let e of t) if (e !== "") {
|
|
7805
|
+
if (typeof e != "string" && !(e instanceof n && e.#o === this)) throw new Error("invalid part: " + e);
|
|
7806
|
+
this.#r.push(e);
|
|
7807
|
+
}
|
|
7808
|
+
}
|
|
7809
|
+
toJSON() {
|
|
7810
|
+
let t = this.type === null ? this.#r.slice().map((e) => typeof e == "string" ? e : e.toJSON()) : [this.type, ...this.#r.map((e) => e.toJSON())];
|
|
7811
|
+
return this.isStart() && !this.type && t.unshift([]), this.isEnd() && (this === this.#t || this.#t.#c && this.#o?.type === "!") && t.push({}), t;
|
|
7812
|
+
}
|
|
7813
|
+
isStart() {
|
|
7814
|
+
if (this.#t === this) return !0;
|
|
7815
|
+
if (!this.#o?.isStart()) return !1;
|
|
7816
|
+
if (this.#S === 0) return !0;
|
|
7817
|
+
let t = this.#o;
|
|
7818
|
+
for (let e = 0; e < this.#S; e++) {
|
|
7819
|
+
let s = t.#r[e];
|
|
7820
|
+
if (!(s instanceof n && s.type === "!")) return !1;
|
|
7821
|
+
}
|
|
7822
|
+
return !0;
|
|
7823
|
+
}
|
|
7824
|
+
isEnd() {
|
|
7825
|
+
if (this.#t === this || this.#o?.type === "!") return !0;
|
|
7826
|
+
if (!this.#o?.isEnd()) return !1;
|
|
7827
|
+
if (!this.type) return this.#o?.isEnd();
|
|
7828
|
+
let t = this.#o ? this.#o.#r.length : 0;
|
|
7829
|
+
return this.#S === t - 1;
|
|
7830
|
+
}
|
|
7831
|
+
copyIn(t) {
|
|
7832
|
+
typeof t == "string" ? this.push(t) : this.push(t.clone(this));
|
|
7833
|
+
}
|
|
7834
|
+
clone(t) {
|
|
7835
|
+
let e = new n(this.type, t);
|
|
7836
|
+
for (let s of this.#r) e.copyIn(s);
|
|
7837
|
+
return e;
|
|
7838
|
+
}
|
|
7839
|
+
static #i(t, e, s, i) {
|
|
7840
|
+
let r = !1, o = !1, h = -1, a = !1;
|
|
7841
|
+
if (e.type === null) {
|
|
7842
|
+
let f = s, m = "";
|
|
7843
|
+
for (; f < t.length;) {
|
|
7844
|
+
let p = t.charAt(f++);
|
|
7845
|
+
if (r || p === "\\") {
|
|
7846
|
+
r = !r, m += p;
|
|
7847
|
+
continue;
|
|
7848
|
+
}
|
|
7849
|
+
if (o) {
|
|
7850
|
+
f === h + 1 ? (p === "^" || p === "!") && (a = !0) : p === "]" && !(f === h + 2 && a) && (o = !1), m += p;
|
|
7851
|
+
continue;
|
|
7852
|
+
} else if (p === "[") {
|
|
7853
|
+
o = !0, h = f, a = !1, m += p;
|
|
7854
|
+
continue;
|
|
7855
|
+
}
|
|
7856
|
+
if (!i.noext && be(p) && t.charAt(f) === "(") {
|
|
7857
|
+
e.push(m), m = "";
|
|
7858
|
+
let w = new n(p, e);
|
|
7859
|
+
f = n.#i(t, w, f, i), e.push(w);
|
|
7860
|
+
continue;
|
|
7861
|
+
}
|
|
7862
|
+
m += p;
|
|
7863
|
+
}
|
|
7864
|
+
return e.push(m), f;
|
|
7865
|
+
}
|
|
7866
|
+
let l = s + 1, u = new n(null, e), c = [], d = "";
|
|
7867
|
+
for (; l < t.length;) {
|
|
7868
|
+
let f = t.charAt(l++);
|
|
7869
|
+
if (r || f === "\\") {
|
|
7870
|
+
r = !r, d += f;
|
|
7871
|
+
continue;
|
|
7872
|
+
}
|
|
7873
|
+
if (o) {
|
|
7874
|
+
l === h + 1 ? (f === "^" || f === "!") && (a = !0) : f === "]" && !(l === h + 2 && a) && (o = !1), d += f;
|
|
7875
|
+
continue;
|
|
7876
|
+
} else if (f === "[") {
|
|
7877
|
+
o = !0, h = l, a = !1, d += f;
|
|
7878
|
+
continue;
|
|
7879
|
+
}
|
|
7880
|
+
if (be(f) && t.charAt(l) === "(") {
|
|
7881
|
+
u.push(d), d = "";
|
|
7882
|
+
let m = new n(f, u);
|
|
7883
|
+
u.push(m), l = n.#i(t, m, l, i);
|
|
7884
|
+
continue;
|
|
7885
|
+
}
|
|
7886
|
+
if (f === "|") {
|
|
7887
|
+
u.push(d), d = "", c.push(u), u = new n(null, e);
|
|
7888
|
+
continue;
|
|
7889
|
+
}
|
|
7890
|
+
if (f === ")") return d === "" && e.#r.length === 0 && (e.#f = !0), u.push(d), d = "", e.push(...c, u), l;
|
|
7891
|
+
d += f;
|
|
7892
|
+
}
|
|
7893
|
+
return e.type = null, e.#s = void 0, e.#r = [t.substring(s - 1)], l;
|
|
7894
|
+
}
|
|
7895
|
+
static fromGlob(t, e = {}) {
|
|
7896
|
+
let s = new n(null, void 0, e);
|
|
7897
|
+
return n.#i(t, s, 0, e), s;
|
|
7898
|
+
}
|
|
7899
|
+
toMMPattern() {
|
|
7900
|
+
if (this !== this.#t) return this.#t.toMMPattern();
|
|
7901
|
+
let t = this.toString(), [e, s, i, r] = this.toRegExpSource();
|
|
7902
|
+
if (!(i || this.#s || this.#h.nocase && !this.#h.nocaseMagicOnly && t.toUpperCase() !== t.toLowerCase())) return s;
|
|
7903
|
+
let h = (this.#h.nocase ? "i" : "") + (r ? "u" : "");
|
|
7904
|
+
return Object.assign(new RegExp(`^${e}$`, h), {
|
|
7905
|
+
_src: e,
|
|
7906
|
+
_glob: t
|
|
7907
|
+
});
|
|
7908
|
+
}
|
|
7909
|
+
get options() {
|
|
7910
|
+
return this.#h;
|
|
7911
|
+
}
|
|
7912
|
+
toRegExpSource(t) {
|
|
7913
|
+
let e = t ?? !!this.#h.dot;
|
|
7914
|
+
if (this.#t === this && this.#a(), !this.type) {
|
|
7915
|
+
let a = this.isStart() && this.isEnd() && !this.#r.some((f) => typeof f != "string"), l = this.#r.map((f) => {
|
|
7916
|
+
let [m, p, w, g] = typeof f == "string" ? n.#E(f, this.#s, a) : f.toRegExpSource(t);
|
|
7917
|
+
return this.#s = this.#s || w, this.#n = this.#n || g, m;
|
|
7918
|
+
}).join(""), u = "";
|
|
7919
|
+
if (this.isStart() && typeof this.#r[0] == "string" && !(this.#r.length === 1 && Ts.has(this.#r[0]))) {
|
|
7920
|
+
let m = Cs, p = e && m.has(l.charAt(0)) || l.startsWith("\\.") && m.has(l.charAt(2)) || l.startsWith("\\.\\.") && m.has(l.charAt(4)), w = !e && !t && m.has(l.charAt(0));
|
|
7921
|
+
u = p ? vs : w ? Ct : "";
|
|
7922
|
+
}
|
|
7923
|
+
let c = "";
|
|
7924
|
+
return this.isEnd() && this.#t.#c && this.#o?.type === "!" && (c = "(?:$|\\/)"), [
|
|
7925
|
+
u + l + c,
|
|
7926
|
+
W(l),
|
|
7927
|
+
this.#s = !!this.#s,
|
|
7928
|
+
this.#n
|
|
7929
|
+
];
|
|
7930
|
+
}
|
|
7931
|
+
let s = this.type === "*" || this.type === "+", i = this.type === "!" ? "(?:(?!(?:" : "(?:", r = this.#d(e);
|
|
7932
|
+
if (this.isStart() && this.isEnd() && !r && this.type !== "!") {
|
|
7933
|
+
let a = this.toString();
|
|
7934
|
+
return this.#r = [a], this.type = null, this.#s = void 0, [
|
|
7935
|
+
a,
|
|
7936
|
+
W(this.toString()),
|
|
7937
|
+
!1,
|
|
7938
|
+
!1
|
|
7939
|
+
];
|
|
7940
|
+
}
|
|
7941
|
+
let o = !s || t || e || !Ct ? "" : this.#d(!0);
|
|
7942
|
+
o === r && (o = ""), o && (r = `(?:${r})(?:${o})*?`);
|
|
7943
|
+
let h = "";
|
|
7944
|
+
if (this.type === "!" && this.#f) h = (this.isStart() && !e ? Ct : "") + Ee;
|
|
7945
|
+
else {
|
|
7946
|
+
let a = this.type === "!" ? "))" + (this.isStart() && !e && !t ? Ct : "") + Se + ")" : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && o ? ")" : this.type === "*" && o ? ")?" : `)${this.type}`;
|
|
7947
|
+
h = i + r + a;
|
|
7948
|
+
}
|
|
7949
|
+
return [
|
|
7950
|
+
h,
|
|
7951
|
+
W(r),
|
|
7952
|
+
this.#s = !!this.#s,
|
|
7953
|
+
this.#n
|
|
7954
|
+
];
|
|
7955
|
+
}
|
|
7956
|
+
#d(t) {
|
|
7957
|
+
return this.#r.map((e) => {
|
|
7958
|
+
if (typeof e == "string") throw new Error("string type in extglob ast??");
|
|
7959
|
+
let [s, i, r, o] = e.toRegExpSource(t);
|
|
7960
|
+
return this.#n = this.#n || o, s;
|
|
7961
|
+
}).filter((e) => !(this.isStart() && this.isEnd()) || !!e).join("|");
|
|
7962
|
+
}
|
|
7963
|
+
static #E(t, e, s = !1) {
|
|
7964
|
+
let i = !1, r = "", o = !1, h = !1;
|
|
7965
|
+
for (let a = 0; a < t.length; a++) {
|
|
7966
|
+
let l = t.charAt(a);
|
|
7967
|
+
if (i) {
|
|
7968
|
+
i = !1, r += (As.has(l) ? "\\" : "") + l;
|
|
7969
|
+
continue;
|
|
7970
|
+
}
|
|
7971
|
+
if (l === "*") {
|
|
7972
|
+
if (h) continue;
|
|
7973
|
+
h = !0, r += s && /^[*]+$/.test(t) ? Ee : Se, e = !0;
|
|
7974
|
+
continue;
|
|
7975
|
+
} else h = !1;
|
|
7976
|
+
if (l === "\\") {
|
|
7977
|
+
a === t.length - 1 ? r += "\\\\" : i = !0;
|
|
7978
|
+
continue;
|
|
7979
|
+
}
|
|
7980
|
+
if (l === "[") {
|
|
7981
|
+
let [u, c, d, f] = ye(t, a);
|
|
7982
|
+
if (d) {
|
|
7983
|
+
r += u, o = o || c, a += d - 1, e = e || f;
|
|
7984
|
+
continue;
|
|
7985
|
+
}
|
|
7986
|
+
}
|
|
7987
|
+
if (l === "?") {
|
|
7988
|
+
r += Kt, e = !0;
|
|
7989
|
+
continue;
|
|
7990
|
+
}
|
|
7991
|
+
r += ks(l);
|
|
7992
|
+
}
|
|
7993
|
+
return [
|
|
7994
|
+
r,
|
|
7995
|
+
W(t),
|
|
7996
|
+
!!e,
|
|
7997
|
+
o
|
|
7998
|
+
];
|
|
7999
|
+
}
|
|
8000
|
+
};
|
|
8001
|
+
var tt = (n, { windowsPathsNoEscape: t = !1, magicalBraces: e = !1 } = {}) => e ? t ? n.replace(/[?*()[\]{}]/g, "[$&]") : n.replace(/[?*()[\]\\{}]/g, "\\$&") : t ? n.replace(/[?*()[\]]/g, "[$&]") : n.replace(/[?*()[\]\\]/g, "\\$&");
|
|
8002
|
+
var O = (n, t, e = {}) => (at(t), !e.nocomment && t.charAt(0) === "#" ? !1 : new D(t, e).match(n)), Rs = /^\*+([^+@!?\*\[\(]*)$/, Os = (n) => (t) => !t.startsWith(".") && t.endsWith(n), Fs = (n) => (t) => t.endsWith(n), Ds = (n) => (n = n.toLowerCase(), (t) => !t.startsWith(".") && t.toLowerCase().endsWith(n)), Ms = (n) => (n = n.toLowerCase(), (t) => t.toLowerCase().endsWith(n)), Ns = /^\*+\.\*+$/, _s = (n) => !n.startsWith(".") && n.includes("."), Ls = (n) => n !== "." && n !== ".." && n.includes("."), Ws = /^\.\*+$/, Ps = (n) => n !== "." && n !== ".." && n.startsWith("."), js = /^\*+$/, Is = (n) => n.length !== 0 && !n.startsWith("."), zs = (n) => n.length !== 0 && n !== "." && n !== "..", Bs = /^\?+([^+@!?\*\[\(]*)?$/, Us = ([n, t = ""]) => {
|
|
8003
|
+
let e = Ce([n]);
|
|
8004
|
+
return t ? (t = t.toLowerCase(), (s) => e(s) && s.toLowerCase().endsWith(t)) : e;
|
|
8005
|
+
}, $s = ([n, t = ""]) => {
|
|
8006
|
+
let e = Te([n]);
|
|
8007
|
+
return t ? (t = t.toLowerCase(), (s) => e(s) && s.toLowerCase().endsWith(t)) : e;
|
|
8008
|
+
}, Gs = ([n, t = ""]) => {
|
|
8009
|
+
let e = Te([n]);
|
|
8010
|
+
return t ? (s) => e(s) && s.endsWith(t) : e;
|
|
8011
|
+
}, Hs = ([n, t = ""]) => {
|
|
8012
|
+
let e = Ce([n]);
|
|
8013
|
+
return t ? (s) => e(s) && s.endsWith(t) : e;
|
|
8014
|
+
}, Ce = ([n]) => {
|
|
8015
|
+
let t = n.length;
|
|
8016
|
+
return (e) => e.length === t && !e.startsWith(".");
|
|
8017
|
+
}, Te = ([n]) => {
|
|
8018
|
+
let t = n.length;
|
|
8019
|
+
return (e) => e.length === t && e !== "." && e !== "..";
|
|
8020
|
+
}, Ae = typeof process == "object" && process ? typeof process.env == "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix", xe = {
|
|
8021
|
+
win32: { sep: "\\" },
|
|
8022
|
+
posix: { sep: "/" }
|
|
8023
|
+
};
|
|
8024
|
+
O.sep = Ae === "win32" ? xe.win32.sep : xe.posix.sep;
|
|
8025
|
+
var A = Symbol("globstar **");
|
|
8026
|
+
O.GLOBSTAR = A;
|
|
8027
|
+
var Vs = "[^/]*?", Ys = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?", Xs = "(?:(?!(?:\\/|^)\\.).)*?", Js = (n, t = {}) => (e) => O(e, n, t);
|
|
8028
|
+
O.filter = Js;
|
|
8029
|
+
var N = (n, t = {}) => Object.assign({}, n, t), Zs = (n) => {
|
|
8030
|
+
if (!n || typeof n != "object" || !Object.keys(n).length) return O;
|
|
8031
|
+
let t = O;
|
|
8032
|
+
return Object.assign((s, i, r = {}) => t(s, i, N(n, r)), {
|
|
8033
|
+
Minimatch: class extends t.Minimatch {
|
|
8034
|
+
constructor(i, r = {}) {
|
|
8035
|
+
super(i, N(n, r));
|
|
8036
|
+
}
|
|
8037
|
+
static defaults(i) {
|
|
8038
|
+
return t.defaults(N(n, i)).Minimatch;
|
|
8039
|
+
}
|
|
8040
|
+
},
|
|
8041
|
+
AST: class extends t.AST {
|
|
8042
|
+
constructor(i, r, o = {}) {
|
|
8043
|
+
super(i, r, N(n, o));
|
|
8044
|
+
}
|
|
8045
|
+
static fromGlob(i, r = {}) {
|
|
8046
|
+
return t.AST.fromGlob(i, N(n, r));
|
|
8047
|
+
}
|
|
8048
|
+
},
|
|
8049
|
+
unescape: (s, i = {}) => t.unescape(s, N(n, i)),
|
|
8050
|
+
escape: (s, i = {}) => t.escape(s, N(n, i)),
|
|
8051
|
+
filter: (s, i = {}) => t.filter(s, N(n, i)),
|
|
8052
|
+
defaults: (s) => t.defaults(N(n, s)),
|
|
8053
|
+
makeRe: (s, i = {}) => t.makeRe(s, N(n, i)),
|
|
8054
|
+
braceExpand: (s, i = {}) => t.braceExpand(s, N(n, i)),
|
|
8055
|
+
match: (s, i, r = {}) => t.match(s, i, N(n, r)),
|
|
8056
|
+
sep: t.sep,
|
|
8057
|
+
GLOBSTAR: A
|
|
8058
|
+
});
|
|
8059
|
+
};
|
|
8060
|
+
O.defaults = Zs;
|
|
8061
|
+
var ke = (n, t = {}) => (at(n), t.nobrace || !/\{(?:(?!\{).)*\}/.test(n) ? [n] : ge(n, { max: t.braceExpandMax }));
|
|
8062
|
+
O.braceExpand = ke;
|
|
8063
|
+
var Qs = (n, t = {}) => new D(n, t).makeRe();
|
|
8064
|
+
O.makeRe = Qs;
|
|
8065
|
+
var ti = (n, t, e = {}) => {
|
|
8066
|
+
let s = new D(t, e);
|
|
8067
|
+
return n = n.filter((i) => s.match(i)), s.options.nonull && !n.length && n.push(t), n;
|
|
8068
|
+
};
|
|
8069
|
+
O.match = ti;
|
|
8070
|
+
var ve = /[?*]|[+@!]\(.*?\)|\[|\]/, ei = (n) => n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), D = class {
|
|
8071
|
+
options;
|
|
8072
|
+
set;
|
|
8073
|
+
pattern;
|
|
8074
|
+
windowsPathsNoEscape;
|
|
8075
|
+
nonegate;
|
|
8076
|
+
negate;
|
|
8077
|
+
comment;
|
|
8078
|
+
empty;
|
|
8079
|
+
preserveMultipleSlashes;
|
|
8080
|
+
partial;
|
|
8081
|
+
globSet;
|
|
8082
|
+
globParts;
|
|
8083
|
+
nocase;
|
|
8084
|
+
isWindows;
|
|
8085
|
+
platform;
|
|
8086
|
+
windowsNoMagicRoot;
|
|
8087
|
+
regexp;
|
|
8088
|
+
constructor(t, e = {}) {
|
|
8089
|
+
at(t), e = e || {}, this.options = e, this.pattern = t, this.platform = e.platform || Ae, this.isWindows = this.platform === "win32";
|
|
8090
|
+
this.windowsPathsNoEscape = !!e.windowsPathsNoEscape || e["allowWindowsEscape"] === !1, this.windowsPathsNoEscape && (this.pattern = this.pattern.replace(/\\/g, "/")), this.preserveMultipleSlashes = !!e.preserveMultipleSlashes, this.regexp = null, this.negate = !1, this.nonegate = !!e.nonegate, this.comment = !1, this.empty = !1, this.partial = !!e.partial, this.nocase = !!this.options.nocase, this.windowsNoMagicRoot = e.windowsNoMagicRoot !== void 0 ? e.windowsNoMagicRoot : !!(this.isWindows && this.nocase), this.globSet = [], this.globParts = [], this.set = [], this.make();
|
|
8091
|
+
}
|
|
8092
|
+
hasMagic() {
|
|
8093
|
+
if (this.options.magicalBraces && this.set.length > 1) return !0;
|
|
8094
|
+
for (let t of this.set) for (let e of t) if (typeof e != "string") return !0;
|
|
8095
|
+
return !1;
|
|
8096
|
+
}
|
|
8097
|
+
debug(...t) {}
|
|
8098
|
+
make() {
|
|
8099
|
+
let t = this.pattern, e = this.options;
|
|
8100
|
+
if (!e.nocomment && t.charAt(0) === "#") {
|
|
8101
|
+
this.comment = !0;
|
|
8102
|
+
return;
|
|
8103
|
+
}
|
|
8104
|
+
if (!t) {
|
|
8105
|
+
this.empty = !0;
|
|
8106
|
+
return;
|
|
8107
|
+
}
|
|
8108
|
+
this.parseNegate(), this.globSet = [...new Set(this.braceExpand())], e.debug && (this.debug = (...r) => console.error(...r)), this.debug(this.pattern, this.globSet);
|
|
8109
|
+
let s = this.globSet.map((r) => this.slashSplit(r));
|
|
8110
|
+
this.globParts = this.preprocess(s), this.debug(this.pattern, this.globParts);
|
|
8111
|
+
let i = this.globParts.map((r, o, h) => {
|
|
8112
|
+
if (this.isWindows && this.windowsNoMagicRoot) {
|
|
8113
|
+
let a = r[0] === "" && r[1] === "" && (r[2] === "?" || !ve.test(r[2])) && !ve.test(r[3]), l = /^[a-z]:/i.test(r[0]);
|
|
8114
|
+
if (a) return [...r.slice(0, 4), ...r.slice(4).map((u) => this.parse(u))];
|
|
8115
|
+
if (l) return [r[0], ...r.slice(1).map((u) => this.parse(u))];
|
|
8116
|
+
}
|
|
8117
|
+
return r.map((a) => this.parse(a));
|
|
8118
|
+
});
|
|
8119
|
+
if (this.debug(this.pattern, i), this.set = i.filter((r) => r.indexOf(!1) === -1), this.isWindows) for (let r = 0; r < this.set.length; r++) {
|
|
8120
|
+
let o = this.set[r];
|
|
8121
|
+
o[0] === "" && o[1] === "" && this.globParts[r][2] === "?" && typeof o[3] == "string" && /^[a-z]:$/i.test(o[3]) && (o[2] = "?");
|
|
8122
|
+
}
|
|
8123
|
+
this.debug(this.pattern, this.set);
|
|
8124
|
+
}
|
|
8125
|
+
preprocess(t) {
|
|
8126
|
+
if (this.options.noglobstar) for (let s = 0; s < t.length; s++) for (let i = 0; i < t[s].length; i++) t[s][i] === "**" && (t[s][i] = "*");
|
|
8127
|
+
let { optimizationLevel: e = 1 } = this.options;
|
|
8128
|
+
return e >= 2 ? (t = this.firstPhasePreProcess(t), t = this.secondPhasePreProcess(t)) : e >= 1 ? t = this.levelOneOptimize(t) : t = this.adjascentGlobstarOptimize(t), t;
|
|
8129
|
+
}
|
|
8130
|
+
adjascentGlobstarOptimize(t) {
|
|
8131
|
+
return t.map((e) => {
|
|
8132
|
+
let s = -1;
|
|
8133
|
+
for (; (s = e.indexOf("**", s + 1)) !== -1;) {
|
|
8134
|
+
let i = s;
|
|
8135
|
+
for (; e[i + 1] === "**";) i++;
|
|
8136
|
+
i !== s && e.splice(s, i - s);
|
|
8137
|
+
}
|
|
8138
|
+
return e;
|
|
8139
|
+
});
|
|
8140
|
+
}
|
|
8141
|
+
levelOneOptimize(t) {
|
|
8142
|
+
return t.map((e) => (e = e.reduce((s, i) => {
|
|
8143
|
+
let r = s[s.length - 1];
|
|
8144
|
+
return i === "**" && r === "**" ? s : i === ".." && r && r !== ".." && r !== "." && r !== "**" ? (s.pop(), s) : (s.push(i), s);
|
|
8145
|
+
}, []), e.length === 0 ? [""] : e));
|
|
8146
|
+
}
|
|
8147
|
+
levelTwoFileOptimize(t) {
|
|
8148
|
+
Array.isArray(t) || (t = this.slashSplit(t));
|
|
8149
|
+
let e = !1;
|
|
8150
|
+
do {
|
|
8151
|
+
if (e = !1, !this.preserveMultipleSlashes) {
|
|
8152
|
+
for (let i = 1; i < t.length - 1; i++) {
|
|
8153
|
+
let r = t[i];
|
|
8154
|
+
i === 1 && r === "" && t[0] === "" || (r === "." || r === "") && (e = !0, t.splice(i, 1), i--);
|
|
8155
|
+
}
|
|
8156
|
+
t[0] === "." && t.length === 2 && (t[1] === "." || t[1] === "") && (e = !0, t.pop());
|
|
8157
|
+
}
|
|
8158
|
+
let s = 0;
|
|
8159
|
+
for (; (s = t.indexOf("..", s + 1)) !== -1;) {
|
|
8160
|
+
let i = t[s - 1];
|
|
8161
|
+
i && i !== "." && i !== ".." && i !== "**" && (e = !0, t.splice(s - 1, 2), s -= 2);
|
|
8162
|
+
}
|
|
8163
|
+
} while (e);
|
|
8164
|
+
return t.length === 0 ? [""] : t;
|
|
8165
|
+
}
|
|
8166
|
+
firstPhasePreProcess(t) {
|
|
8167
|
+
let e = !1;
|
|
8168
|
+
do {
|
|
8169
|
+
e = !1;
|
|
8170
|
+
for (let s of t) {
|
|
8171
|
+
let i = -1;
|
|
8172
|
+
for (; (i = s.indexOf("**", i + 1)) !== -1;) {
|
|
8173
|
+
let o = i;
|
|
8174
|
+
for (; s[o + 1] === "**";) o++;
|
|
8175
|
+
o > i && s.splice(i + 1, o - i);
|
|
8176
|
+
let h = s[i + 1], a = s[i + 2], l = s[i + 3];
|
|
8177
|
+
if (h !== ".." || !a || a === "." || a === ".." || !l || l === "." || l === "..") continue;
|
|
8178
|
+
e = !0, s.splice(i, 1);
|
|
8179
|
+
let u = s.slice(0);
|
|
8180
|
+
u[i] = "**", t.push(u), i--;
|
|
8181
|
+
}
|
|
8182
|
+
if (!this.preserveMultipleSlashes) {
|
|
8183
|
+
for (let o = 1; o < s.length - 1; o++) {
|
|
8184
|
+
let h = s[o];
|
|
8185
|
+
o === 1 && h === "" && s[0] === "" || (h === "." || h === "") && (e = !0, s.splice(o, 1), o--);
|
|
8186
|
+
}
|
|
8187
|
+
s[0] === "." && s.length === 2 && (s[1] === "." || s[1] === "") && (e = !0, s.pop());
|
|
8188
|
+
}
|
|
8189
|
+
let r = 0;
|
|
8190
|
+
for (; (r = s.indexOf("..", r + 1)) !== -1;) {
|
|
8191
|
+
let o = s[r - 1];
|
|
8192
|
+
if (o && o !== "." && o !== ".." && o !== "**") {
|
|
8193
|
+
e = !0;
|
|
8194
|
+
let a = r === 1 && s[r + 1] === "**" ? ["."] : [];
|
|
8195
|
+
s.splice(r - 1, 2, ...a), s.length === 0 && s.push(""), r -= 2;
|
|
8196
|
+
}
|
|
8197
|
+
}
|
|
8198
|
+
}
|
|
8199
|
+
} while (e);
|
|
8200
|
+
return t;
|
|
8201
|
+
}
|
|
8202
|
+
secondPhasePreProcess(t) {
|
|
8203
|
+
for (let e = 0; e < t.length - 1; e++) for (let s = e + 1; s < t.length; s++) {
|
|
8204
|
+
let i = this.partsMatch(t[e], t[s], !this.preserveMultipleSlashes);
|
|
8205
|
+
if (i) {
|
|
8206
|
+
t[e] = [], t[s] = i;
|
|
8207
|
+
break;
|
|
8208
|
+
}
|
|
8209
|
+
}
|
|
8210
|
+
return t.filter((e) => e.length);
|
|
8211
|
+
}
|
|
8212
|
+
partsMatch(t, e, s = !1) {
|
|
8213
|
+
let i = 0, r = 0, o = [], h = "";
|
|
8214
|
+
for (; i < t.length && r < e.length;) if (t[i] === e[r]) o.push(h === "b" ? e[r] : t[i]), i++, r++;
|
|
8215
|
+
else if (s && t[i] === "**" && e[r] === t[i + 1]) o.push(t[i]), i++;
|
|
8216
|
+
else if (s && e[r] === "**" && t[i] === e[r + 1]) o.push(e[r]), r++;
|
|
8217
|
+
else if (t[i] === "*" && e[r] && (this.options.dot || !e[r].startsWith(".")) && e[r] !== "**") {
|
|
8218
|
+
if (h === "b") return !1;
|
|
8219
|
+
h = "a", o.push(t[i]), i++, r++;
|
|
8220
|
+
} else if (e[r] === "*" && t[i] && (this.options.dot || !t[i].startsWith(".")) && t[i] !== "**") {
|
|
8221
|
+
if (h === "a") return !1;
|
|
8222
|
+
h = "b", o.push(e[r]), i++, r++;
|
|
8223
|
+
} else return !1;
|
|
8224
|
+
return t.length === e.length && o;
|
|
8225
|
+
}
|
|
8226
|
+
parseNegate() {
|
|
8227
|
+
if (this.nonegate) return;
|
|
8228
|
+
let t = this.pattern, e = !1, s = 0;
|
|
8229
|
+
for (let i = 0; i < t.length && t.charAt(i) === "!"; i++) e = !e, s++;
|
|
8230
|
+
s && (this.pattern = t.slice(s)), this.negate = e;
|
|
8231
|
+
}
|
|
8232
|
+
matchOne(t, e, s = !1) {
|
|
8233
|
+
let i = this.options;
|
|
8234
|
+
if (this.isWindows) {
|
|
8235
|
+
let p = typeof t[0] == "string" && /^[a-z]:$/i.test(t[0]), w = !p && t[0] === "" && t[1] === "" && t[2] === "?" && /^[a-z]:$/i.test(t[3]), g = typeof e[0] == "string" && /^[a-z]:$/i.test(e[0]), S = !g && e[0] === "" && e[1] === "" && e[2] === "?" && typeof e[3] == "string" && /^[a-z]:$/i.test(e[3]), E = w ? 3 : p ? 0 : void 0, y = S ? 3 : g ? 0 : void 0;
|
|
8236
|
+
if (typeof E == "number" && typeof y == "number") {
|
|
8237
|
+
let [b, z] = [t[E], e[y]];
|
|
8238
|
+
b.toLowerCase() === z.toLowerCase() && (e[y] = b, y > E ? e = e.slice(y) : E > y && (t = t.slice(E)));
|
|
8239
|
+
}
|
|
8240
|
+
}
|
|
8241
|
+
let { optimizationLevel: r = 1 } = this.options;
|
|
8242
|
+
r >= 2 && (t = this.levelTwoFileOptimize(t)), this.debug("matchOne", this, {
|
|
8243
|
+
file: t,
|
|
8244
|
+
pattern: e
|
|
8245
|
+
}), this.debug("matchOne", t.length, e.length);
|
|
8246
|
+
for (var o = 0, h = 0, a = t.length, l = e.length; o < a && h < l; o++, h++) {
|
|
8247
|
+
this.debug("matchOne loop");
|
|
8248
|
+
var u = e[h], c = t[o];
|
|
8249
|
+
if (this.debug(e, u, c), u === !1) return !1;
|
|
8250
|
+
if (u === A) {
|
|
8251
|
+
this.debug("GLOBSTAR", [
|
|
8252
|
+
e,
|
|
8253
|
+
u,
|
|
8254
|
+
c
|
|
8255
|
+
]);
|
|
8256
|
+
var d = o, f = h + 1;
|
|
8257
|
+
if (f === l) {
|
|
8258
|
+
for (this.debug("** at the end"); o < a; o++) if (t[o] === "." || t[o] === ".." || !i.dot && t[o].charAt(0) === ".") return !1;
|
|
8259
|
+
return !0;
|
|
8260
|
+
}
|
|
8261
|
+
for (; d < a;) {
|
|
8262
|
+
var m = t[d];
|
|
8263
|
+
if (this.debug(`
|
|
8264
|
+
globstar while`, t, d, e, f, m), this.matchOne(t.slice(d), e.slice(f), s)) return this.debug("globstar found match!", d, a, m), !0;
|
|
8265
|
+
if (m === "." || m === ".." || !i.dot && m.charAt(0) === ".") {
|
|
8266
|
+
this.debug("dot detected!", t, d, e, f);
|
|
8267
|
+
break;
|
|
8268
|
+
}
|
|
8269
|
+
this.debug("globstar swallow a segment, and continue"), d++;
|
|
8270
|
+
}
|
|
8271
|
+
return !!(s && (this.debug(`
|
|
8272
|
+
>>> no match, partial?`, t, d, e, f), d === a));
|
|
8273
|
+
}
|
|
8274
|
+
let p;
|
|
8275
|
+
if (typeof u == "string" ? (p = c === u, this.debug("string match", u, c, p)) : (p = u.test(c), this.debug("pattern match", u, c, p)), !p) return !1;
|
|
8276
|
+
}
|
|
8277
|
+
if (o === a && h === l) return !0;
|
|
8278
|
+
if (o === a) return s;
|
|
8279
|
+
if (h === l) return o === a - 1 && t[o] === "";
|
|
8280
|
+
throw new Error("wtf?");
|
|
8281
|
+
}
|
|
8282
|
+
braceExpand() {
|
|
8283
|
+
return ke(this.pattern, this.options);
|
|
8284
|
+
}
|
|
8285
|
+
parse(t) {
|
|
8286
|
+
at(t);
|
|
8287
|
+
let e = this.options;
|
|
8288
|
+
if (t === "**") return A;
|
|
8289
|
+
if (t === "") return "";
|
|
8290
|
+
let s, i = null;
|
|
8291
|
+
(s = t.match(js)) ? i = e.dot ? zs : Is : (s = t.match(Rs)) ? i = (e.nocase ? e.dot ? Ms : Ds : e.dot ? Fs : Os)(s[1]) : (s = t.match(Bs)) ? i = (e.nocase ? e.dot ? $s : Us : e.dot ? Gs : Hs)(s) : (s = t.match(Ns)) ? i = e.dot ? Ls : _s : (s = t.match(Ws)) && (i = Ps);
|
|
8292
|
+
let r = Q.fromGlob(t, this.options).toMMPattern();
|
|
8293
|
+
return i && typeof r == "object" && Reflect.defineProperty(r, "test", { value: i }), r;
|
|
8294
|
+
}
|
|
8295
|
+
makeRe() {
|
|
8296
|
+
if (this.regexp || this.regexp === !1) return this.regexp;
|
|
8297
|
+
let t = this.set;
|
|
8298
|
+
if (!t.length) return this.regexp = !1, this.regexp;
|
|
8299
|
+
let e = this.options, s = e.noglobstar ? Vs : e.dot ? Ys : Xs, i = new Set(e.nocase ? ["i"] : []), r = t.map((a) => {
|
|
8300
|
+
let l = a.map((c) => {
|
|
8301
|
+
if (c instanceof RegExp) for (let d of c.flags.split("")) i.add(d);
|
|
8302
|
+
return typeof c == "string" ? ei(c) : c === A ? A : c._src;
|
|
8303
|
+
});
|
|
8304
|
+
l.forEach((c, d) => {
|
|
8305
|
+
let f = l[d + 1], m = l[d - 1];
|
|
8306
|
+
c !== A || m === A || (m === void 0 ? f !== void 0 && f !== A ? l[d + 1] = "(?:\\/|" + s + "\\/)?" + f : l[d] = s : f === void 0 ? l[d - 1] = m + "(?:\\/|\\/" + s + ")?" : f !== A && (l[d - 1] = m + "(?:\\/|\\/" + s + "\\/)" + f, l[d + 1] = A));
|
|
8307
|
+
});
|
|
8308
|
+
let u = l.filter((c) => c !== A);
|
|
8309
|
+
if (this.partial && u.length >= 1) {
|
|
8310
|
+
let c = [];
|
|
8311
|
+
for (let d = 1; d <= u.length; d++) c.push(u.slice(0, d).join("/"));
|
|
8312
|
+
return "(?:" + c.join("|") + ")";
|
|
8313
|
+
}
|
|
8314
|
+
return u.join("/");
|
|
8315
|
+
}).join("|"), [o, h] = t.length > 1 ? ["(?:", ")"] : ["", ""];
|
|
8316
|
+
r = "^" + o + r + h + "$", this.partial && (r = "^(?:\\/|" + o + r.slice(1, -1) + h + ")$"), this.negate && (r = "^(?!" + r + ").+$");
|
|
8317
|
+
try {
|
|
8318
|
+
this.regexp = new RegExp(r, [...i].join(""));
|
|
8319
|
+
} catch {
|
|
8320
|
+
this.regexp = !1;
|
|
8321
|
+
}
|
|
8322
|
+
return this.regexp;
|
|
8323
|
+
}
|
|
8324
|
+
slashSplit(t) {
|
|
8325
|
+
return this.preserveMultipleSlashes ? t.split("/") : this.isWindows && /^\/\/[^\/]+/.test(t) ? ["", ...t.split(/\/+/)] : t.split(/\/+/);
|
|
8326
|
+
}
|
|
8327
|
+
match(t, e = this.partial) {
|
|
8328
|
+
if (this.debug("match", t, this.pattern), this.comment) return !1;
|
|
8329
|
+
if (this.empty) return t === "";
|
|
8330
|
+
if (t === "/" && e) return !0;
|
|
8331
|
+
let s = this.options;
|
|
8332
|
+
this.isWindows && (t = t.split("\\").join("/"));
|
|
8333
|
+
let i = this.slashSplit(t);
|
|
8334
|
+
this.debug(this.pattern, "split", i);
|
|
8335
|
+
let r = this.set;
|
|
8336
|
+
this.debug(this.pattern, "set", r);
|
|
8337
|
+
let o = i[i.length - 1];
|
|
8338
|
+
if (!o) for (let h = i.length - 2; !o && h >= 0; h--) o = i[h];
|
|
8339
|
+
for (let h = 0; h < r.length; h++) {
|
|
8340
|
+
let a = r[h], l = i;
|
|
8341
|
+
if (s.matchBase && a.length === 1 && (l = [o]), this.matchOne(l, a, e)) return s.flipNegate ? !0 : !this.negate;
|
|
8342
|
+
}
|
|
8343
|
+
return s.flipNegate ? !1 : this.negate;
|
|
8344
|
+
}
|
|
8345
|
+
static defaults(t) {
|
|
8346
|
+
return O.defaults(t).Minimatch;
|
|
8347
|
+
}
|
|
8348
|
+
};
|
|
8349
|
+
O.AST = Q;
|
|
8350
|
+
O.Minimatch = D;
|
|
8351
|
+
O.escape = tt;
|
|
8352
|
+
O.unescape = W;
|
|
8353
|
+
var si = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date, Oe = /* @__PURE__ */ new Set(), Vt = typeof process == "object" && process ? process : {}, Fe = (n, t, e, s) => {
|
|
8354
|
+
typeof Vt.emitWarning == "function" ? Vt.emitWarning(n, t, e, s) : console.error(`[${e}] ${t}: ${n}`);
|
|
8355
|
+
}, At = globalThis.AbortController, Re = globalThis.AbortSignal;
|
|
8356
|
+
if (typeof At > "u") {
|
|
8357
|
+
Re = class {
|
|
8358
|
+
onabort;
|
|
8359
|
+
_onabort = [];
|
|
8360
|
+
reason;
|
|
8361
|
+
aborted = !1;
|
|
8362
|
+
addEventListener(e, s) {
|
|
8363
|
+
this._onabort.push(s);
|
|
8364
|
+
}
|
|
8365
|
+
}, At = class {
|
|
8366
|
+
constructor() {
|
|
8367
|
+
t();
|
|
8368
|
+
}
|
|
8369
|
+
signal = new Re();
|
|
8370
|
+
abort(e) {
|
|
8371
|
+
if (!this.signal.aborted) {
|
|
8372
|
+
this.signal.reason = e, this.signal.aborted = !0;
|
|
8373
|
+
for (let s of this.signal._onabort) s(e);
|
|
8374
|
+
this.signal.onabort?.(e);
|
|
8375
|
+
}
|
|
8376
|
+
}
|
|
8377
|
+
};
|
|
8378
|
+
let n = Vt.env?.LRU_CACHE_IGNORE_AC_WARNING !== "1", t = () => {
|
|
8379
|
+
n && (n = !1, Fe("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.", "NO_ABORT_CONTROLLER", "ENOTSUP", t));
|
|
8380
|
+
};
|
|
8381
|
+
}
|
|
8382
|
+
var ii = (n) => !Oe.has(n);
|
|
8383
|
+
var q = (n) => n && n === Math.floor(n) && n > 0 && isFinite(n), De = (n) => q(n) ? n <= Math.pow(2, 8) ? Uint8Array : n <= Math.pow(2, 16) ? Uint16Array : n <= Math.pow(2, 32) ? Uint32Array : n <= Number.MAX_SAFE_INTEGER ? Tt : null : null, Tt = class extends Array {
|
|
8384
|
+
constructor(n) {
|
|
8385
|
+
super(n), this.fill(0);
|
|
8386
|
+
}
|
|
8387
|
+
}, ri = class ct {
|
|
8388
|
+
heap;
|
|
8389
|
+
length;
|
|
8390
|
+
static #t = !1;
|
|
8391
|
+
static create(t) {
|
|
8392
|
+
let e = De(t);
|
|
8393
|
+
if (!e) return [];
|
|
8394
|
+
ct.#t = !0;
|
|
8395
|
+
let s = new ct(t, e);
|
|
8396
|
+
return ct.#t = !1, s;
|
|
8397
|
+
}
|
|
8398
|
+
constructor(t, e) {
|
|
8399
|
+
if (!ct.#t) throw new TypeError("instantiate Stack using Stack.create(n)");
|
|
8400
|
+
this.heap = new e(t), this.length = 0;
|
|
8401
|
+
}
|
|
8402
|
+
push(t) {
|
|
8403
|
+
this.heap[this.length++] = t;
|
|
8404
|
+
}
|
|
8405
|
+
pop() {
|
|
8406
|
+
return this.heap[--this.length];
|
|
8407
|
+
}
|
|
8408
|
+
}, ft = class Me {
|
|
8409
|
+
#t;
|
|
8410
|
+
#s;
|
|
8411
|
+
#n;
|
|
8412
|
+
#r;
|
|
8413
|
+
#o;
|
|
8414
|
+
#S;
|
|
8415
|
+
#w;
|
|
8416
|
+
#c;
|
|
8417
|
+
get perf() {
|
|
8418
|
+
return this.#c;
|
|
8419
|
+
}
|
|
8420
|
+
ttl;
|
|
8421
|
+
ttlResolution;
|
|
8422
|
+
ttlAutopurge;
|
|
8423
|
+
updateAgeOnGet;
|
|
8424
|
+
updateAgeOnHas;
|
|
8425
|
+
allowStale;
|
|
8426
|
+
noDisposeOnSet;
|
|
8427
|
+
noUpdateTTL;
|
|
8428
|
+
maxEntrySize;
|
|
8429
|
+
sizeCalculation;
|
|
8430
|
+
noDeleteOnFetchRejection;
|
|
8431
|
+
noDeleteOnStaleGet;
|
|
8432
|
+
allowStaleOnFetchAbort;
|
|
8433
|
+
allowStaleOnFetchRejection;
|
|
8434
|
+
ignoreFetchAbort;
|
|
8435
|
+
#h;
|
|
8436
|
+
#u;
|
|
8437
|
+
#f;
|
|
8438
|
+
#a;
|
|
8439
|
+
#i;
|
|
8440
|
+
#d;
|
|
8441
|
+
#E;
|
|
8442
|
+
#b;
|
|
8443
|
+
#p;
|
|
8444
|
+
#R;
|
|
8445
|
+
#m;
|
|
8446
|
+
#C;
|
|
8447
|
+
#T;
|
|
8448
|
+
#g;
|
|
8449
|
+
#y;
|
|
8450
|
+
#x;
|
|
8451
|
+
#A;
|
|
8452
|
+
#e;
|
|
8453
|
+
#_;
|
|
8454
|
+
static unsafeExposeInternals(t) {
|
|
8455
|
+
return {
|
|
8456
|
+
starts: t.#T,
|
|
8457
|
+
ttls: t.#g,
|
|
8458
|
+
autopurgeTimers: t.#y,
|
|
8459
|
+
sizes: t.#C,
|
|
8460
|
+
keyMap: t.#f,
|
|
8461
|
+
keyList: t.#a,
|
|
8462
|
+
valList: t.#i,
|
|
8463
|
+
next: t.#d,
|
|
8464
|
+
prev: t.#E,
|
|
8465
|
+
get head() {
|
|
8466
|
+
return t.#b;
|
|
8467
|
+
},
|
|
8468
|
+
get tail() {
|
|
8469
|
+
return t.#p;
|
|
8470
|
+
},
|
|
8471
|
+
free: t.#R,
|
|
8472
|
+
isBackgroundFetch: (e) => t.#l(e),
|
|
8473
|
+
backgroundFetch: (e, s, i, r) => t.#U(e, s, i, r),
|
|
8474
|
+
moveToTail: (e) => t.#W(e),
|
|
8475
|
+
indexes: (e) => t.#F(e),
|
|
8476
|
+
rindexes: (e) => t.#D(e),
|
|
8477
|
+
isStale: (e) => t.#v(e)
|
|
8478
|
+
};
|
|
8479
|
+
}
|
|
8480
|
+
get max() {
|
|
8481
|
+
return this.#t;
|
|
8482
|
+
}
|
|
8483
|
+
get maxSize() {
|
|
8484
|
+
return this.#s;
|
|
8485
|
+
}
|
|
8486
|
+
get calculatedSize() {
|
|
8487
|
+
return this.#u;
|
|
8488
|
+
}
|
|
8489
|
+
get size() {
|
|
8490
|
+
return this.#h;
|
|
8491
|
+
}
|
|
8492
|
+
get fetchMethod() {
|
|
8493
|
+
return this.#S;
|
|
8494
|
+
}
|
|
8495
|
+
get memoMethod() {
|
|
8496
|
+
return this.#w;
|
|
8497
|
+
}
|
|
8498
|
+
get dispose() {
|
|
8499
|
+
return this.#n;
|
|
8500
|
+
}
|
|
8501
|
+
get onInsert() {
|
|
8502
|
+
return this.#r;
|
|
8503
|
+
}
|
|
8504
|
+
get disposeAfter() {
|
|
8505
|
+
return this.#o;
|
|
8506
|
+
}
|
|
8507
|
+
constructor(t) {
|
|
8508
|
+
let { max: e = 0, ttl: s, ttlResolution: i = 1, ttlAutopurge: r, updateAgeOnGet: o, updateAgeOnHas: h, allowStale: a, dispose: l, onInsert: u, disposeAfter: c, noDisposeOnSet: d, noUpdateTTL: f, maxSize: m = 0, maxEntrySize: p = 0, sizeCalculation: w, fetchMethod: g, memoMethod: S, noDeleteOnFetchRejection: E, noDeleteOnStaleGet: y, allowStaleOnFetchRejection: b, allowStaleOnFetchAbort: z, ignoreFetchAbort: $, perf: J } = t;
|
|
8509
|
+
if (J !== void 0 && typeof J?.now != "function") throw new TypeError("perf option must have a now() method if specified");
|
|
8510
|
+
if (this.#c = J ?? si, e !== 0 && !q(e)) throw new TypeError("max option must be a nonnegative integer");
|
|
8511
|
+
let Z = e ? De(e) : Array;
|
|
8512
|
+
if (!Z) throw new Error("invalid max value: " + e);
|
|
8513
|
+
if (this.#t = e, this.#s = m, this.maxEntrySize = p || this.#s, this.sizeCalculation = w, this.sizeCalculation) {
|
|
8514
|
+
if (!this.#s && !this.maxEntrySize) throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");
|
|
8515
|
+
if (typeof this.sizeCalculation != "function") throw new TypeError("sizeCalculation set to non-function");
|
|
8516
|
+
}
|
|
8517
|
+
if (S !== void 0 && typeof S != "function") throw new TypeError("memoMethod must be a function if defined");
|
|
8518
|
+
if (this.#w = S, g !== void 0 && typeof g != "function") throw new TypeError("fetchMethod must be a function if specified");
|
|
8519
|
+
if (this.#S = g, this.#A = !!g, this.#f = /* @__PURE__ */ new Map(), this.#a = new Array(e).fill(void 0), this.#i = new Array(e).fill(void 0), this.#d = new Z(e), this.#E = new Z(e), this.#b = 0, this.#p = 0, this.#R = ri.create(e), this.#h = 0, this.#u = 0, typeof l == "function" && (this.#n = l), typeof u == "function" && (this.#r = u), typeof c == "function" ? (this.#o = c, this.#m = []) : (this.#o = void 0, this.#m = void 0), this.#x = !!this.#n, this.#_ = !!this.#r, this.#e = !!this.#o, this.noDisposeOnSet = !!d, this.noUpdateTTL = !!f, this.noDeleteOnFetchRejection = !!E, this.allowStaleOnFetchRejection = !!b, this.allowStaleOnFetchAbort = !!z, this.ignoreFetchAbort = !!$, this.maxEntrySize !== 0) {
|
|
8520
|
+
if (this.#s !== 0 && !q(this.#s)) throw new TypeError("maxSize must be a positive integer if specified");
|
|
8521
|
+
if (!q(this.maxEntrySize)) throw new TypeError("maxEntrySize must be a positive integer if specified");
|
|
8522
|
+
this.#G();
|
|
8523
|
+
}
|
|
8524
|
+
if (this.allowStale = !!a, this.noDeleteOnStaleGet = !!y, this.updateAgeOnGet = !!o, this.updateAgeOnHas = !!h, this.ttlResolution = q(i) || i === 0 ? i : 1, this.ttlAutopurge = !!r, this.ttl = s || 0, this.ttl) {
|
|
8525
|
+
if (!q(this.ttl)) throw new TypeError("ttl must be a positive integer if specified");
|
|
8526
|
+
this.#M();
|
|
8527
|
+
}
|
|
8528
|
+
if (this.#t === 0 && this.ttl === 0 && this.#s === 0) throw new TypeError("At least one of max, maxSize, or ttl is required");
|
|
8529
|
+
if (!this.ttlAutopurge && !this.#t && !this.#s) {
|
|
8530
|
+
let $t = "LRU_CACHE_UNBOUNDED";
|
|
8531
|
+
ii($t) && (Oe.add($t), Fe("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.", "UnboundedCacheWarning", $t, Me));
|
|
8532
|
+
}
|
|
8533
|
+
}
|
|
8534
|
+
getRemainingTTL(t) {
|
|
8535
|
+
return this.#f.has(t) ? Infinity : 0;
|
|
8536
|
+
}
|
|
8537
|
+
#M() {
|
|
8538
|
+
let t = new Tt(this.#t), e = new Tt(this.#t);
|
|
8539
|
+
this.#g = t, this.#T = e;
|
|
8540
|
+
let s = this.ttlAutopurge ? new Array(this.#t) : void 0;
|
|
8541
|
+
this.#y = s, this.#j = (o, h, a = this.#c.now()) => {
|
|
8542
|
+
if (e[o] = h !== 0 ? a : 0, t[o] = h, s?.[o] && (clearTimeout(s[o]), s[o] = void 0), h !== 0 && s) {
|
|
8543
|
+
let l = setTimeout(() => {
|
|
8544
|
+
this.#v(o) && this.#O(this.#a[o], "expire");
|
|
8545
|
+
}, h + 1);
|
|
8546
|
+
l.unref && l.unref(), s[o] = l;
|
|
8547
|
+
}
|
|
8548
|
+
}, this.#k = (o) => {
|
|
8549
|
+
e[o] = t[o] !== 0 ? this.#c.now() : 0;
|
|
8550
|
+
}, this.#N = (o, h) => {
|
|
8551
|
+
if (t[h]) {
|
|
8552
|
+
let a = t[h], l = e[h];
|
|
8553
|
+
if (!a || !l) return;
|
|
8554
|
+
o.ttl = a, o.start = l, o.now = i || r();
|
|
8555
|
+
o.remainingTTL = a - (o.now - l);
|
|
8556
|
+
}
|
|
8557
|
+
};
|
|
8558
|
+
let i = 0, r = () => {
|
|
8559
|
+
let o = this.#c.now();
|
|
8560
|
+
if (this.ttlResolution > 0) {
|
|
8561
|
+
i = o;
|
|
8562
|
+
let h = setTimeout(() => i = 0, this.ttlResolution);
|
|
8563
|
+
h.unref && h.unref();
|
|
8564
|
+
}
|
|
8565
|
+
return o;
|
|
8566
|
+
};
|
|
8567
|
+
this.getRemainingTTL = (o) => {
|
|
8568
|
+
let h = this.#f.get(o);
|
|
8569
|
+
if (h === void 0) return 0;
|
|
8570
|
+
let a = t[h], l = e[h];
|
|
8571
|
+
if (!a || !l) return Infinity;
|
|
8572
|
+
return a - ((i || r()) - l);
|
|
8573
|
+
}, this.#v = (o) => {
|
|
8574
|
+
let h = e[o], a = t[o];
|
|
8575
|
+
return !!a && !!h && (i || r()) - h > a;
|
|
8576
|
+
};
|
|
8577
|
+
}
|
|
8578
|
+
#k = () => {};
|
|
8579
|
+
#N = () => {};
|
|
8580
|
+
#j = () => {};
|
|
8581
|
+
#v = () => !1;
|
|
8582
|
+
#G() {
|
|
8583
|
+
let t = new Tt(this.#t);
|
|
8584
|
+
this.#u = 0, this.#C = t, this.#P = (e) => {
|
|
8585
|
+
this.#u -= t[e], t[e] = 0;
|
|
8586
|
+
}, this.#I = (e, s, i, r) => {
|
|
8587
|
+
if (this.#l(s)) return 0;
|
|
8588
|
+
if (!q(i)) if (r) {
|
|
8589
|
+
if (typeof r != "function") throw new TypeError("sizeCalculation must be a function");
|
|
8590
|
+
if (i = r(s, e), !q(i)) throw new TypeError("sizeCalculation return invalid (expect positive integer)");
|
|
8591
|
+
} else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");
|
|
8592
|
+
return i;
|
|
8593
|
+
}, this.#L = (e, s, i) => {
|
|
8594
|
+
if (t[e] = s, this.#s) {
|
|
8595
|
+
let r = this.#s - t[e];
|
|
8596
|
+
for (; this.#u > r;) this.#B(!0);
|
|
8597
|
+
}
|
|
8598
|
+
this.#u += t[e], i && (i.entrySize = s, i.totalCalculatedSize = this.#u);
|
|
8599
|
+
};
|
|
8600
|
+
}
|
|
8601
|
+
#P = (t) => {};
|
|
8602
|
+
#L = (t, e, s) => {};
|
|
8603
|
+
#I = (t, e, s, i) => {
|
|
8604
|
+
if (s || i) throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");
|
|
8605
|
+
return 0;
|
|
8606
|
+
};
|
|
8607
|
+
*#F({ allowStale: t = this.allowStale } = {}) {
|
|
8608
|
+
if (this.#h) for (let e = this.#p; !(!this.#z(e) || ((t || !this.#v(e)) && (yield e), e === this.#b));) e = this.#E[e];
|
|
8609
|
+
}
|
|
8610
|
+
*#D({ allowStale: t = this.allowStale } = {}) {
|
|
8611
|
+
if (this.#h) for (let e = this.#b; !(!this.#z(e) || ((t || !this.#v(e)) && (yield e), e === this.#p));) e = this.#d[e];
|
|
8612
|
+
}
|
|
8613
|
+
#z(t) {
|
|
8614
|
+
return t !== void 0 && this.#f.get(this.#a[t]) === t;
|
|
8615
|
+
}
|
|
8616
|
+
*entries() {
|
|
8617
|
+
for (let t of this.#F()) this.#i[t] !== void 0 && this.#a[t] !== void 0 && !this.#l(this.#i[t]) && (yield [this.#a[t], this.#i[t]]);
|
|
8618
|
+
}
|
|
8619
|
+
*rentries() {
|
|
8620
|
+
for (let t of this.#D()) this.#i[t] !== void 0 && this.#a[t] !== void 0 && !this.#l(this.#i[t]) && (yield [this.#a[t], this.#i[t]]);
|
|
8621
|
+
}
|
|
8622
|
+
*keys() {
|
|
8623
|
+
for (let t of this.#F()) {
|
|
8624
|
+
let e = this.#a[t];
|
|
8625
|
+
e !== void 0 && !this.#l(this.#i[t]) && (yield e);
|
|
8626
|
+
}
|
|
8627
|
+
}
|
|
8628
|
+
*rkeys() {
|
|
8629
|
+
for (let t of this.#D()) {
|
|
8630
|
+
let e = this.#a[t];
|
|
8631
|
+
e !== void 0 && !this.#l(this.#i[t]) && (yield e);
|
|
8632
|
+
}
|
|
8633
|
+
}
|
|
8634
|
+
*values() {
|
|
8635
|
+
for (let t of this.#F()) this.#i[t] !== void 0 && !this.#l(this.#i[t]) && (yield this.#i[t]);
|
|
8636
|
+
}
|
|
8637
|
+
*rvalues() {
|
|
8638
|
+
for (let t of this.#D()) this.#i[t] !== void 0 && !this.#l(this.#i[t]) && (yield this.#i[t]);
|
|
8639
|
+
}
|
|
8640
|
+
[Symbol.iterator]() {
|
|
8641
|
+
return this.entries();
|
|
8642
|
+
}
|
|
8643
|
+
[Symbol.toStringTag] = "LRUCache";
|
|
8644
|
+
find(t, e = {}) {
|
|
8645
|
+
for (let s of this.#F()) {
|
|
8646
|
+
let i = this.#i[s], r = this.#l(i) ? i.__staleWhileFetching : i;
|
|
8647
|
+
if (r !== void 0 && t(r, this.#a[s], this)) return this.get(this.#a[s], e);
|
|
8648
|
+
}
|
|
8649
|
+
}
|
|
8650
|
+
forEach(t, e = this) {
|
|
8651
|
+
for (let s of this.#F()) {
|
|
8652
|
+
let i = this.#i[s], r = this.#l(i) ? i.__staleWhileFetching : i;
|
|
8653
|
+
r !== void 0 && t.call(e, r, this.#a[s], this);
|
|
8654
|
+
}
|
|
8655
|
+
}
|
|
8656
|
+
rforEach(t, e = this) {
|
|
8657
|
+
for (let s of this.#D()) {
|
|
8658
|
+
let i = this.#i[s], r = this.#l(i) ? i.__staleWhileFetching : i;
|
|
8659
|
+
r !== void 0 && t.call(e, r, this.#a[s], this);
|
|
8660
|
+
}
|
|
8661
|
+
}
|
|
8662
|
+
purgeStale() {
|
|
8663
|
+
let t = !1;
|
|
8664
|
+
for (let e of this.#D({ allowStale: !0 })) this.#v(e) && (this.#O(this.#a[e], "expire"), t = !0);
|
|
8665
|
+
return t;
|
|
8666
|
+
}
|
|
8667
|
+
info(t) {
|
|
8668
|
+
let e = this.#f.get(t);
|
|
8669
|
+
if (e === void 0) return;
|
|
8670
|
+
let s = this.#i[e], i = this.#l(s) ? s.__staleWhileFetching : s;
|
|
8671
|
+
if (i === void 0) return;
|
|
8672
|
+
let r = { value: i };
|
|
8673
|
+
if (this.#g && this.#T) {
|
|
8674
|
+
let o = this.#g[e], h = this.#T[e];
|
|
8675
|
+
if (o && h) r.ttl = o - (this.#c.now() - h), r.start = Date.now();
|
|
8676
|
+
}
|
|
8677
|
+
return this.#C && (r.size = this.#C[e]), r;
|
|
8678
|
+
}
|
|
8679
|
+
dump() {
|
|
8680
|
+
let t = [];
|
|
8681
|
+
for (let e of this.#F({ allowStale: !0 })) {
|
|
8682
|
+
let s = this.#a[e], i = this.#i[e], r = this.#l(i) ? i.__staleWhileFetching : i;
|
|
8683
|
+
if (r === void 0 || s === void 0) continue;
|
|
8684
|
+
let o = { value: r };
|
|
8685
|
+
if (this.#g && this.#T) {
|
|
8686
|
+
o.ttl = this.#g[e];
|
|
8687
|
+
let h = this.#c.now() - this.#T[e];
|
|
8688
|
+
o.start = Math.floor(Date.now() - h);
|
|
8689
|
+
}
|
|
8690
|
+
this.#C && (o.size = this.#C[e]), t.unshift([s, o]);
|
|
8691
|
+
}
|
|
8692
|
+
return t;
|
|
8693
|
+
}
|
|
8694
|
+
load(t) {
|
|
8695
|
+
this.clear();
|
|
8696
|
+
for (let [e, s] of t) {
|
|
8697
|
+
if (s.start) {
|
|
8698
|
+
let i = Date.now() - s.start;
|
|
8699
|
+
s.start = this.#c.now() - i;
|
|
8700
|
+
}
|
|
8701
|
+
this.set(e, s.value, s);
|
|
8702
|
+
}
|
|
8703
|
+
}
|
|
8704
|
+
set(t, e, s = {}) {
|
|
8705
|
+
if (e === void 0) return this.delete(t), this;
|
|
8706
|
+
let { ttl: i = this.ttl, start: r, noDisposeOnSet: o = this.noDisposeOnSet, sizeCalculation: h = this.sizeCalculation, status: a } = s, { noUpdateTTL: l = this.noUpdateTTL } = s, u = this.#I(t, e, s.size || 0, h);
|
|
8707
|
+
if (this.maxEntrySize && u > this.maxEntrySize) return a && (a.set = "miss", a.maxEntrySizeExceeded = !0), this.#O(t, "set"), this;
|
|
8708
|
+
let c = this.#h === 0 ? void 0 : this.#f.get(t);
|
|
8709
|
+
if (c === void 0) c = this.#h === 0 ? this.#p : this.#R.length !== 0 ? this.#R.pop() : this.#h === this.#t ? this.#B(!1) : this.#h, this.#a[c] = t, this.#i[c] = e, this.#f.set(t, c), this.#d[this.#p] = c, this.#E[c] = this.#p, this.#p = c, this.#h++, this.#L(c, u, a), a && (a.set = "add"), l = !1, this.#_ && this.#r?.(e, t, "add");
|
|
8710
|
+
else {
|
|
8711
|
+
this.#W(c);
|
|
8712
|
+
let d = this.#i[c];
|
|
8713
|
+
if (e !== d) {
|
|
8714
|
+
if (this.#A && this.#l(d)) {
|
|
8715
|
+
d.__abortController.abort(/* @__PURE__ */ new Error("replaced"));
|
|
8716
|
+
let { __staleWhileFetching: f } = d;
|
|
8717
|
+
f !== void 0 && !o && (this.#x && this.#n?.(f, t, "set"), this.#e && this.#m?.push([
|
|
8718
|
+
f,
|
|
8719
|
+
t,
|
|
8720
|
+
"set"
|
|
8721
|
+
]));
|
|
8722
|
+
} else o || (this.#x && this.#n?.(d, t, "set"), this.#e && this.#m?.push([
|
|
8723
|
+
d,
|
|
8724
|
+
t,
|
|
8725
|
+
"set"
|
|
8726
|
+
]));
|
|
8727
|
+
if (this.#P(c), this.#L(c, u, a), this.#i[c] = e, a) {
|
|
8728
|
+
a.set = "replace";
|
|
8729
|
+
let f = d && this.#l(d) ? d.__staleWhileFetching : d;
|
|
8730
|
+
f !== void 0 && (a.oldValue = f);
|
|
8731
|
+
}
|
|
8732
|
+
} else a && (a.set = "update");
|
|
8733
|
+
this.#_ && this.onInsert?.(e, t, e === d ? "update" : "replace");
|
|
8734
|
+
}
|
|
8735
|
+
if (i !== 0 && !this.#g && this.#M(), this.#g && (l || this.#j(c, i, r), a && this.#N(a, c)), !o && this.#e && this.#m) {
|
|
8736
|
+
let d = this.#m, f;
|
|
8737
|
+
for (; f = d?.shift();) this.#o?.(...f);
|
|
8738
|
+
}
|
|
8739
|
+
return this;
|
|
8740
|
+
}
|
|
8741
|
+
pop() {
|
|
8742
|
+
try {
|
|
8743
|
+
for (; this.#h;) {
|
|
8744
|
+
let t = this.#i[this.#b];
|
|
8745
|
+
if (this.#B(!0), this.#l(t)) {
|
|
8746
|
+
if (t.__staleWhileFetching) return t.__staleWhileFetching;
|
|
8747
|
+
} else if (t !== void 0) return t;
|
|
8748
|
+
}
|
|
8749
|
+
} finally {
|
|
8750
|
+
if (this.#e && this.#m) {
|
|
8751
|
+
let t = this.#m, e;
|
|
8752
|
+
for (; e = t?.shift();) this.#o?.(...e);
|
|
8753
|
+
}
|
|
8754
|
+
}
|
|
8755
|
+
}
|
|
8756
|
+
#B(t) {
|
|
8757
|
+
let e = this.#b, s = this.#a[e], i = this.#i[e];
|
|
8758
|
+
return this.#A && this.#l(i) ? i.__abortController.abort(/* @__PURE__ */ new Error("evicted")) : (this.#x || this.#e) && (this.#x && this.#n?.(i, s, "evict"), this.#e && this.#m?.push([
|
|
8759
|
+
i,
|
|
8760
|
+
s,
|
|
8761
|
+
"evict"
|
|
8762
|
+
])), this.#P(e), this.#y?.[e] && (clearTimeout(this.#y[e]), this.#y[e] = void 0), t && (this.#a[e] = void 0, this.#i[e] = void 0, this.#R.push(e)), this.#h === 1 ? (this.#b = this.#p = 0, this.#R.length = 0) : this.#b = this.#d[e], this.#f.delete(s), this.#h--, e;
|
|
8763
|
+
}
|
|
8764
|
+
has(t, e = {}) {
|
|
8765
|
+
let { updateAgeOnHas: s = this.updateAgeOnHas, status: i } = e, r = this.#f.get(t);
|
|
8766
|
+
if (r !== void 0) {
|
|
8767
|
+
let o = this.#i[r];
|
|
8768
|
+
if (this.#l(o) && o.__staleWhileFetching === void 0) return !1;
|
|
8769
|
+
if (this.#v(r)) i && (i.has = "stale", this.#N(i, r));
|
|
8770
|
+
else return s && this.#k(r), i && (i.has = "hit", this.#N(i, r)), !0;
|
|
8771
|
+
} else i && (i.has = "miss");
|
|
8772
|
+
return !1;
|
|
8773
|
+
}
|
|
8774
|
+
peek(t, e = {}) {
|
|
8775
|
+
let { allowStale: s = this.allowStale } = e, i = this.#f.get(t);
|
|
8776
|
+
if (i === void 0 || !s && this.#v(i)) return;
|
|
8777
|
+
let r = this.#i[i];
|
|
8778
|
+
return this.#l(r) ? r.__staleWhileFetching : r;
|
|
8779
|
+
}
|
|
8780
|
+
#U(t, e, s, i) {
|
|
8781
|
+
let r = e === void 0 ? void 0 : this.#i[e];
|
|
8782
|
+
if (this.#l(r)) return r;
|
|
8783
|
+
let o = new At(), { signal: h } = s;
|
|
8784
|
+
h?.addEventListener("abort", () => o.abort(h.reason), { signal: o.signal });
|
|
8785
|
+
let a = {
|
|
8786
|
+
signal: o.signal,
|
|
8787
|
+
options: s,
|
|
8788
|
+
context: i
|
|
8789
|
+
}, l = (p, w = !1) => {
|
|
8790
|
+
let { aborted: g } = o.signal, S = s.ignoreFetchAbort && p !== void 0, E = s.ignoreFetchAbort || !!(s.allowStaleOnFetchAbort && p !== void 0);
|
|
8791
|
+
if (s.status && (g && !w ? (s.status.fetchAborted = !0, s.status.fetchError = o.signal.reason, S && (s.status.fetchAbortIgnored = !0)) : s.status.fetchResolved = !0), g && !S && !w) return c(o.signal.reason, E);
|
|
8792
|
+
let y = f, b = this.#i[e];
|
|
8793
|
+
return (b === f || S && w && b === void 0) && (p === void 0 ? y.__staleWhileFetching !== void 0 ? this.#i[e] = y.__staleWhileFetching : this.#O(t, "fetch") : (s.status && (s.status.fetchUpdated = !0), this.set(t, p, a.options))), p;
|
|
8794
|
+
}, u = (p) => (s.status && (s.status.fetchRejected = !0, s.status.fetchError = p), c(p, !1)), c = (p, w) => {
|
|
8795
|
+
let { aborted: g } = o.signal, S = g && s.allowStaleOnFetchAbort, E = S || s.allowStaleOnFetchRejection, y = E || s.noDeleteOnFetchRejection, b = f;
|
|
8796
|
+
if (this.#i[e] === f && (!y || !w && b.__staleWhileFetching === void 0 ? this.#O(t, "fetch") : S || (this.#i[e] = b.__staleWhileFetching)), E) return s.status && b.__staleWhileFetching !== void 0 && (s.status.returnedStale = !0), b.__staleWhileFetching;
|
|
8797
|
+
if (b.__returned === b) throw p;
|
|
8798
|
+
}, d = (p, w) => {
|
|
8799
|
+
let g = this.#S?.(t, r, a);
|
|
8800
|
+
g && g instanceof Promise && g.then((S) => p(S === void 0 ? void 0 : S), w), o.signal.addEventListener("abort", () => {
|
|
8801
|
+
(!s.ignoreFetchAbort || s.allowStaleOnFetchAbort) && (p(void 0), s.allowStaleOnFetchAbort && (p = (S) => l(S, !0)));
|
|
8802
|
+
});
|
|
8803
|
+
};
|
|
8804
|
+
s.status && (s.status.fetchDispatched = !0);
|
|
8805
|
+
let f = new Promise(d).then(l, u), m = Object.assign(f, {
|
|
8806
|
+
__abortController: o,
|
|
8807
|
+
__staleWhileFetching: r,
|
|
8808
|
+
__returned: void 0
|
|
8809
|
+
});
|
|
8810
|
+
return e === void 0 ? (this.set(t, m, {
|
|
8811
|
+
...a.options,
|
|
8812
|
+
status: void 0
|
|
8813
|
+
}), e = this.#f.get(t)) : this.#i[e] = m, m;
|
|
8814
|
+
}
|
|
8815
|
+
#l(t) {
|
|
8816
|
+
if (!this.#A) return !1;
|
|
8817
|
+
let e = t;
|
|
8818
|
+
return !!e && e instanceof Promise && e.hasOwnProperty("__staleWhileFetching") && e.__abortController instanceof At;
|
|
8819
|
+
}
|
|
8820
|
+
async fetch(t, e = {}) {
|
|
8821
|
+
let { allowStale: s = this.allowStale, updateAgeOnGet: i = this.updateAgeOnGet, noDeleteOnStaleGet: r = this.noDeleteOnStaleGet, ttl: o = this.ttl, noDisposeOnSet: h = this.noDisposeOnSet, size: a = 0, sizeCalculation: l = this.sizeCalculation, noUpdateTTL: u = this.noUpdateTTL, noDeleteOnFetchRejection: c = this.noDeleteOnFetchRejection, allowStaleOnFetchRejection: d = this.allowStaleOnFetchRejection, ignoreFetchAbort: f = this.ignoreFetchAbort, allowStaleOnFetchAbort: m = this.allowStaleOnFetchAbort, context: p, forceRefresh: w = !1, status: g, signal: S } = e;
|
|
8822
|
+
if (!this.#A) return g && (g.fetch = "get"), this.get(t, {
|
|
8823
|
+
allowStale: s,
|
|
8824
|
+
updateAgeOnGet: i,
|
|
8825
|
+
noDeleteOnStaleGet: r,
|
|
8826
|
+
status: g
|
|
8827
|
+
});
|
|
8828
|
+
let E = {
|
|
8829
|
+
allowStale: s,
|
|
8830
|
+
updateAgeOnGet: i,
|
|
8831
|
+
noDeleteOnStaleGet: r,
|
|
8832
|
+
ttl: o,
|
|
8833
|
+
noDisposeOnSet: h,
|
|
8834
|
+
size: a,
|
|
8835
|
+
sizeCalculation: l,
|
|
8836
|
+
noUpdateTTL: u,
|
|
8837
|
+
noDeleteOnFetchRejection: c,
|
|
8838
|
+
allowStaleOnFetchRejection: d,
|
|
8839
|
+
allowStaleOnFetchAbort: m,
|
|
8840
|
+
ignoreFetchAbort: f,
|
|
8841
|
+
status: g,
|
|
8842
|
+
signal: S
|
|
8843
|
+
}, y = this.#f.get(t);
|
|
8844
|
+
if (y === void 0) {
|
|
8845
|
+
g && (g.fetch = "miss");
|
|
8846
|
+
let b = this.#U(t, y, E, p);
|
|
8847
|
+
return b.__returned = b;
|
|
8848
|
+
} else {
|
|
8849
|
+
let b = this.#i[y];
|
|
8850
|
+
if (this.#l(b)) {
|
|
8851
|
+
let Z = s && b.__staleWhileFetching !== void 0;
|
|
8852
|
+
return g && (g.fetch = "inflight", Z && (g.returnedStale = !0)), Z ? b.__staleWhileFetching : b.__returned = b;
|
|
8853
|
+
}
|
|
8854
|
+
let z = this.#v(y);
|
|
8855
|
+
if (!w && !z) return g && (g.fetch = "hit"), this.#W(y), i && this.#k(y), g && this.#N(g, y), b;
|
|
8856
|
+
let $ = this.#U(t, y, E, p), J = $.__staleWhileFetching !== void 0 && s;
|
|
8857
|
+
return g && (g.fetch = z ? "stale" : "refresh", J && z && (g.returnedStale = !0)), J ? $.__staleWhileFetching : $.__returned = $;
|
|
8858
|
+
}
|
|
8859
|
+
}
|
|
8860
|
+
async forceFetch(t, e = {}) {
|
|
8861
|
+
let s = await this.fetch(t, e);
|
|
8862
|
+
if (s === void 0) throw new Error("fetch() returned undefined");
|
|
8863
|
+
return s;
|
|
8864
|
+
}
|
|
8865
|
+
memo(t, e = {}) {
|
|
8866
|
+
let s = this.#w;
|
|
8867
|
+
if (!s) throw new Error("no memoMethod provided to constructor");
|
|
8868
|
+
let { context: i, forceRefresh: r, ...o } = e, h = this.get(t, o);
|
|
8869
|
+
if (!r && h !== void 0) return h;
|
|
8870
|
+
let a = s(t, h, {
|
|
8871
|
+
options: o,
|
|
8872
|
+
context: i
|
|
8873
|
+
});
|
|
8874
|
+
return this.set(t, a, o), a;
|
|
8875
|
+
}
|
|
8876
|
+
get(t, e = {}) {
|
|
8877
|
+
let { allowStale: s = this.allowStale, updateAgeOnGet: i = this.updateAgeOnGet, noDeleteOnStaleGet: r = this.noDeleteOnStaleGet, status: o } = e, h = this.#f.get(t);
|
|
8878
|
+
if (h !== void 0) {
|
|
8879
|
+
let a = this.#i[h], l = this.#l(a);
|
|
8880
|
+
return o && this.#N(o, h), this.#v(h) ? (o && (o.get = "stale"), l ? (o && s && a.__staleWhileFetching !== void 0 && (o.returnedStale = !0), s ? a.__staleWhileFetching : void 0) : (r || this.#O(t, "expire"), o && s && (o.returnedStale = !0), s ? a : void 0)) : (o && (o.get = "hit"), l ? a.__staleWhileFetching : (this.#W(h), i && this.#k(h), a));
|
|
8881
|
+
} else o && (o.get = "miss");
|
|
8882
|
+
}
|
|
8883
|
+
#$(t, e) {
|
|
8884
|
+
this.#E[e] = t, this.#d[t] = e;
|
|
8885
|
+
}
|
|
8886
|
+
#W(t) {
|
|
8887
|
+
t !== this.#p && (t === this.#b ? this.#b = this.#d[t] : this.#$(this.#E[t], this.#d[t]), this.#$(this.#p, t), this.#p = t);
|
|
8888
|
+
}
|
|
8889
|
+
delete(t) {
|
|
8890
|
+
return this.#O(t, "delete");
|
|
8891
|
+
}
|
|
8892
|
+
#O(t, e) {
|
|
8893
|
+
let s = !1;
|
|
8894
|
+
if (this.#h !== 0) {
|
|
8895
|
+
let i = this.#f.get(t);
|
|
8896
|
+
if (i !== void 0) if (this.#y?.[i] && (clearTimeout(this.#y?.[i]), this.#y[i] = void 0), s = !0, this.#h === 1) this.#H(e);
|
|
8897
|
+
else {
|
|
8898
|
+
this.#P(i);
|
|
8899
|
+
let r = this.#i[i];
|
|
8900
|
+
if (this.#l(r) ? r.__abortController.abort(/* @__PURE__ */ new Error("deleted")) : (this.#x || this.#e) && (this.#x && this.#n?.(r, t, e), this.#e && this.#m?.push([
|
|
8901
|
+
r,
|
|
8902
|
+
t,
|
|
8903
|
+
e
|
|
8904
|
+
])), this.#f.delete(t), this.#a[i] = void 0, this.#i[i] = void 0, i === this.#p) this.#p = this.#E[i];
|
|
8905
|
+
else if (i === this.#b) this.#b = this.#d[i];
|
|
8906
|
+
else {
|
|
8907
|
+
let o = this.#E[i];
|
|
8908
|
+
this.#d[o] = this.#d[i];
|
|
8909
|
+
let h = this.#d[i];
|
|
8910
|
+
this.#E[h] = this.#E[i];
|
|
8911
|
+
}
|
|
8912
|
+
this.#h--, this.#R.push(i);
|
|
8913
|
+
}
|
|
8914
|
+
}
|
|
8915
|
+
if (this.#e && this.#m?.length) {
|
|
8916
|
+
let i = this.#m, r;
|
|
8917
|
+
for (; r = i?.shift();) this.#o?.(...r);
|
|
8918
|
+
}
|
|
8919
|
+
return s;
|
|
8920
|
+
}
|
|
8921
|
+
clear() {
|
|
8922
|
+
return this.#H("delete");
|
|
8923
|
+
}
|
|
8924
|
+
#H(t) {
|
|
8925
|
+
for (let e of this.#D({ allowStale: !0 })) {
|
|
8926
|
+
let s = this.#i[e];
|
|
8927
|
+
if (this.#l(s)) s.__abortController.abort(/* @__PURE__ */ new Error("deleted"));
|
|
8928
|
+
else {
|
|
8929
|
+
let i = this.#a[e];
|
|
8930
|
+
this.#x && this.#n?.(s, i, t), this.#e && this.#m?.push([
|
|
8931
|
+
s,
|
|
8932
|
+
i,
|
|
8933
|
+
t
|
|
8934
|
+
]);
|
|
8935
|
+
}
|
|
8936
|
+
}
|
|
8937
|
+
if (this.#f.clear(), this.#i.fill(void 0), this.#a.fill(void 0), this.#g && this.#T) {
|
|
8938
|
+
this.#g.fill(0), this.#T.fill(0);
|
|
8939
|
+
for (let e of this.#y ?? []) e !== void 0 && clearTimeout(e);
|
|
8940
|
+
this.#y?.fill(void 0);
|
|
8941
|
+
}
|
|
8942
|
+
if (this.#C && this.#C.fill(0), this.#b = 0, this.#p = 0, this.#R.length = 0, this.#u = 0, this.#h = 0, this.#e && this.#m) {
|
|
8943
|
+
let e = this.#m, s;
|
|
8944
|
+
for (; s = e?.shift();) this.#o?.(...s);
|
|
8945
|
+
}
|
|
8946
|
+
}
|
|
8947
|
+
};
|
|
8948
|
+
var Ne = typeof process == "object" && process ? process : {
|
|
8949
|
+
stdout: null,
|
|
8950
|
+
stderr: null
|
|
8951
|
+
}, oi = (n) => !!n && typeof n == "object" && (n instanceof V || n instanceof Pe || hi(n) || ai(n)), hi = (n) => !!n && typeof n == "object" && n instanceof EventEmitter && typeof n.pipe == "function" && n.pipe !== Pe.Writable.prototype.pipe, ai = (n) => !!n && typeof n == "object" && n instanceof EventEmitter && typeof n.write == "function" && typeof n.end == "function", G = Symbol("EOF"), H = Symbol("maybeEmitEnd"), K = Symbol("emittedEnd"), kt = Symbol("emittingEnd"), ut = Symbol("emittedError"), Rt = Symbol("closed"), _e = Symbol("read"), Ot = Symbol("flush"), Le = Symbol("flushChunk"), P = Symbol("encoding"), et = Symbol("decoder"), v = Symbol("flowing"), dt = Symbol("paused"), st = Symbol("resume"), C = Symbol("buffer"), F = Symbol("pipes"), T = Symbol("bufferLength"), Yt = Symbol("bufferPush"), Ft = Symbol("bufferShift"), k = Symbol("objectMode"), x = Symbol("destroyed"), Xt = Symbol("error"), Jt = Symbol("emitData"), We = Symbol("emitEnd"), Zt = Symbol("emitEnd2"), B = Symbol("async"), Qt = Symbol("abort"), Dt = Symbol("aborted"), pt = Symbol("signal"), Y = Symbol("dataListeners"), M = Symbol("discarded"), mt = (n) => Promise.resolve().then(n), li = (n) => n(), ci = (n) => n === "end" || n === "finish" || n === "prefinish", fi = (n) => n instanceof ArrayBuffer || !!n && typeof n == "object" && n.constructor && n.constructor.name === "ArrayBuffer" && n.byteLength >= 0, ui = (n) => !Buffer.isBuffer(n) && ArrayBuffer.isView(n), Mt = class {
|
|
8952
|
+
src;
|
|
8953
|
+
dest;
|
|
8954
|
+
opts;
|
|
8955
|
+
ondrain;
|
|
8956
|
+
constructor(t, e, s) {
|
|
8957
|
+
this.src = t, this.dest = e, this.opts = s, this.ondrain = () => t[st](), this.dest.on("drain", this.ondrain);
|
|
8958
|
+
}
|
|
8959
|
+
unpipe() {
|
|
8960
|
+
this.dest.removeListener("drain", this.ondrain);
|
|
8961
|
+
}
|
|
8962
|
+
proxyErrors(t) {}
|
|
8963
|
+
end() {
|
|
8964
|
+
this.unpipe(), this.opts.end && this.dest.end();
|
|
8965
|
+
}
|
|
8966
|
+
}, te = class extends Mt {
|
|
8967
|
+
unpipe() {
|
|
8968
|
+
this.src.removeListener("error", this.proxyErrors), super.unpipe();
|
|
8969
|
+
}
|
|
8970
|
+
constructor(t, e, s) {
|
|
8971
|
+
super(t, e, s), this.proxyErrors = (i) => this.dest.emit("error", i), t.on("error", this.proxyErrors);
|
|
8972
|
+
}
|
|
8973
|
+
}, di = (n) => !!n.objectMode, pi = (n) => !n.objectMode && !!n.encoding && n.encoding !== "buffer", V = class extends EventEmitter {
|
|
8974
|
+
[v] = !1;
|
|
8975
|
+
[dt] = !1;
|
|
8976
|
+
[F] = [];
|
|
8977
|
+
[C] = [];
|
|
8978
|
+
[k];
|
|
8979
|
+
[P];
|
|
8980
|
+
[B];
|
|
8981
|
+
[et];
|
|
8982
|
+
[G] = !1;
|
|
8983
|
+
[K] = !1;
|
|
8984
|
+
[kt] = !1;
|
|
8985
|
+
[Rt] = !1;
|
|
8986
|
+
[ut] = null;
|
|
8987
|
+
[T] = 0;
|
|
8988
|
+
[x] = !1;
|
|
8989
|
+
[pt];
|
|
8990
|
+
[Dt] = !1;
|
|
8991
|
+
[Y] = 0;
|
|
8992
|
+
[M] = !1;
|
|
8993
|
+
writable = !0;
|
|
8994
|
+
readable = !0;
|
|
8995
|
+
constructor(...t) {
|
|
8996
|
+
let e = t[0] || {};
|
|
8997
|
+
if (super(), e.objectMode && typeof e.encoding == "string") throw new TypeError("Encoding and objectMode may not be used together");
|
|
8998
|
+
di(e) ? (this[k] = !0, this[P] = null) : pi(e) ? (this[P] = e.encoding, this[k] = !1) : (this[k] = !1, this[P] = null), this[B] = !!e.async, this[et] = this[P] ? new StringDecoder(this[P]) : null, e && e.debugExposeBuffer === !0 && Object.defineProperty(this, "buffer", { get: () => this[C] }), e && e.debugExposePipes === !0 && Object.defineProperty(this, "pipes", { get: () => this[F] });
|
|
8999
|
+
let { signal: s } = e;
|
|
9000
|
+
s && (this[pt] = s, s.aborted ? this[Qt]() : s.addEventListener("abort", () => this[Qt]()));
|
|
9001
|
+
}
|
|
9002
|
+
get bufferLength() {
|
|
9003
|
+
return this[T];
|
|
9004
|
+
}
|
|
9005
|
+
get encoding() {
|
|
9006
|
+
return this[P];
|
|
9007
|
+
}
|
|
9008
|
+
set encoding(t) {
|
|
9009
|
+
throw new Error("Encoding must be set at instantiation time");
|
|
9010
|
+
}
|
|
9011
|
+
setEncoding(t) {
|
|
9012
|
+
throw new Error("Encoding must be set at instantiation time");
|
|
9013
|
+
}
|
|
9014
|
+
get objectMode() {
|
|
9015
|
+
return this[k];
|
|
9016
|
+
}
|
|
9017
|
+
set objectMode(t) {
|
|
9018
|
+
throw new Error("objectMode must be set at instantiation time");
|
|
9019
|
+
}
|
|
9020
|
+
get async() {
|
|
9021
|
+
return this[B];
|
|
9022
|
+
}
|
|
9023
|
+
set async(t) {
|
|
9024
|
+
this[B] = this[B] || !!t;
|
|
9025
|
+
}
|
|
9026
|
+
[Qt]() {
|
|
9027
|
+
this[Dt] = !0, this.emit("abort", this[pt]?.reason), this.destroy(this[pt]?.reason);
|
|
9028
|
+
}
|
|
9029
|
+
get aborted() {
|
|
9030
|
+
return this[Dt];
|
|
9031
|
+
}
|
|
9032
|
+
set aborted(t) {}
|
|
9033
|
+
write(t, e, s) {
|
|
9034
|
+
if (this[Dt]) return !1;
|
|
9035
|
+
if (this[G]) throw new Error("write after end");
|
|
9036
|
+
if (this[x]) return this.emit("error", Object.assign(/* @__PURE__ */ new Error("Cannot call write after a stream was destroyed"), { code: "ERR_STREAM_DESTROYED" })), !0;
|
|
9037
|
+
typeof e == "function" && (s = e, e = "utf8"), e || (e = "utf8");
|
|
9038
|
+
let i = this[B] ? mt : li;
|
|
9039
|
+
if (!this[k] && !Buffer.isBuffer(t)) {
|
|
9040
|
+
if (ui(t)) t = Buffer.from(t.buffer, t.byteOffset, t.byteLength);
|
|
9041
|
+
else if (fi(t)) t = Buffer.from(t);
|
|
9042
|
+
else if (typeof t != "string") throw new Error("Non-contiguous data written to non-objectMode stream");
|
|
9043
|
+
}
|
|
9044
|
+
return this[k] ? (this[v] && this[T] !== 0 && this[Ot](!0), this[v] ? this.emit("data", t) : this[Yt](t), this[T] !== 0 && this.emit("readable"), s && i(s), this[v]) : t.length ? (typeof t == "string" && !(e === this[P] && !this[et]?.lastNeed) && (t = Buffer.from(t, e)), Buffer.isBuffer(t) && this[P] && (t = this[et].write(t)), this[v] && this[T] !== 0 && this[Ot](!0), this[v] ? this.emit("data", t) : this[Yt](t), this[T] !== 0 && this.emit("readable"), s && i(s), this[v]) : (this[T] !== 0 && this.emit("readable"), s && i(s), this[v]);
|
|
9045
|
+
}
|
|
9046
|
+
read(t) {
|
|
9047
|
+
if (this[x]) return null;
|
|
9048
|
+
if (this[M] = !1, this[T] === 0 || t === 0 || t && t > this[T]) return this[H](), null;
|
|
9049
|
+
this[k] && (t = null), this[C].length > 1 && !this[k] && (this[C] = [this[P] ? this[C].join("") : Buffer.concat(this[C], this[T])]);
|
|
9050
|
+
let e = this[_e](t || null, this[C][0]);
|
|
9051
|
+
return this[H](), e;
|
|
9052
|
+
}
|
|
9053
|
+
[_e](t, e) {
|
|
9054
|
+
if (this[k]) this[Ft]();
|
|
9055
|
+
else {
|
|
9056
|
+
let s = e;
|
|
9057
|
+
t === s.length || t === null ? this[Ft]() : typeof s == "string" ? (this[C][0] = s.slice(t), e = s.slice(0, t), this[T] -= t) : (this[C][0] = s.subarray(t), e = s.subarray(0, t), this[T] -= t);
|
|
9058
|
+
}
|
|
9059
|
+
return this.emit("data", e), !this[C].length && !this[G] && this.emit("drain"), e;
|
|
9060
|
+
}
|
|
9061
|
+
end(t, e, s) {
|
|
9062
|
+
return typeof t == "function" && (s = t, t = void 0), typeof e == "function" && (s = e, e = "utf8"), t !== void 0 && this.write(t, e), s && this.once("end", s), this[G] = !0, this.writable = !1, (this[v] || !this[dt]) && this[H](), this;
|
|
9063
|
+
}
|
|
9064
|
+
[st]() {
|
|
9065
|
+
this[x] || (!this[Y] && !this[F].length && (this[M] = !0), this[dt] = !1, this[v] = !0, this.emit("resume"), this[C].length ? this[Ot]() : this[G] ? this[H]() : this.emit("drain"));
|
|
9066
|
+
}
|
|
9067
|
+
resume() {
|
|
9068
|
+
return this[st]();
|
|
9069
|
+
}
|
|
9070
|
+
pause() {
|
|
9071
|
+
this[v] = !1, this[dt] = !0, this[M] = !1;
|
|
9072
|
+
}
|
|
9073
|
+
get destroyed() {
|
|
9074
|
+
return this[x];
|
|
9075
|
+
}
|
|
9076
|
+
get flowing() {
|
|
9077
|
+
return this[v];
|
|
9078
|
+
}
|
|
9079
|
+
get paused() {
|
|
9080
|
+
return this[dt];
|
|
9081
|
+
}
|
|
9082
|
+
[Yt](t) {
|
|
9083
|
+
this[k] ? this[T] += 1 : this[T] += t.length, this[C].push(t);
|
|
9084
|
+
}
|
|
9085
|
+
[Ft]() {
|
|
9086
|
+
return this[k] ? this[T] -= 1 : this[T] -= this[C][0].length, this[C].shift();
|
|
9087
|
+
}
|
|
9088
|
+
[Ot](t = !1) {
|
|
9089
|
+
do ;
|
|
9090
|
+
while (this[Le](this[Ft]()) && this[C].length);
|
|
9091
|
+
!t && !this[C].length && !this[G] && this.emit("drain");
|
|
9092
|
+
}
|
|
9093
|
+
[Le](t) {
|
|
9094
|
+
return this.emit("data", t), this[v];
|
|
9095
|
+
}
|
|
9096
|
+
pipe(t, e) {
|
|
9097
|
+
if (this[x]) return t;
|
|
9098
|
+
this[M] = !1;
|
|
9099
|
+
let s = this[K];
|
|
9100
|
+
return e = e || {}, t === Ne.stdout || t === Ne.stderr ? e.end = !1 : e.end = e.end !== !1, e.proxyErrors = !!e.proxyErrors, s ? e.end && t.end() : (this[F].push(e.proxyErrors ? new te(this, t, e) : new Mt(this, t, e)), this[B] ? mt(() => this[st]()) : this[st]()), t;
|
|
9101
|
+
}
|
|
9102
|
+
unpipe(t) {
|
|
9103
|
+
let e = this[F].find((s) => s.dest === t);
|
|
9104
|
+
e && (this[F].length === 1 ? (this[v] && this[Y] === 0 && (this[v] = !1), this[F] = []) : this[F].splice(this[F].indexOf(e), 1), e.unpipe());
|
|
9105
|
+
}
|
|
9106
|
+
addListener(t, e) {
|
|
9107
|
+
return this.on(t, e);
|
|
9108
|
+
}
|
|
9109
|
+
on(t, e) {
|
|
9110
|
+
let s = super.on(t, e);
|
|
9111
|
+
if (t === "data") this[M] = !1, this[Y]++, !this[F].length && !this[v] && this[st]();
|
|
9112
|
+
else if (t === "readable" && this[T] !== 0) super.emit("readable");
|
|
9113
|
+
else if (ci(t) && this[K]) super.emit(t), this.removeAllListeners(t);
|
|
9114
|
+
else if (t === "error" && this[ut]) {
|
|
9115
|
+
let i = e;
|
|
9116
|
+
this[B] ? mt(() => i.call(this, this[ut])) : i.call(this, this[ut]);
|
|
9117
|
+
}
|
|
9118
|
+
return s;
|
|
9119
|
+
}
|
|
9120
|
+
removeListener(t, e) {
|
|
9121
|
+
return this.off(t, e);
|
|
9122
|
+
}
|
|
9123
|
+
off(t, e) {
|
|
9124
|
+
let s = super.off(t, e);
|
|
9125
|
+
return t === "data" && (this[Y] = this.listeners("data").length, this[Y] === 0 && !this[M] && !this[F].length && (this[v] = !1)), s;
|
|
9126
|
+
}
|
|
9127
|
+
removeAllListeners(t) {
|
|
9128
|
+
let e = super.removeAllListeners(t);
|
|
9129
|
+
return (t === "data" || t === void 0) && (this[Y] = 0, !this[M] && !this[F].length && (this[v] = !1)), e;
|
|
9130
|
+
}
|
|
9131
|
+
get emittedEnd() {
|
|
9132
|
+
return this[K];
|
|
9133
|
+
}
|
|
9134
|
+
[H]() {
|
|
9135
|
+
!this[kt] && !this[K] && !this[x] && this[C].length === 0 && this[G] && (this[kt] = !0, this.emit("end"), this.emit("prefinish"), this.emit("finish"), this[Rt] && this.emit("close"), this[kt] = !1);
|
|
9136
|
+
}
|
|
9137
|
+
emit(t, ...e) {
|
|
9138
|
+
let s = e[0];
|
|
9139
|
+
if (t !== "error" && t !== "close" && t !== x && this[x]) return !1;
|
|
9140
|
+
if (t === "data") return !this[k] && !s ? !1 : this[B] ? (mt(() => this[Jt](s)), !0) : this[Jt](s);
|
|
9141
|
+
if (t === "end") return this[We]();
|
|
9142
|
+
if (t === "close") {
|
|
9143
|
+
if (this[Rt] = !0, !this[K] && !this[x]) return !1;
|
|
9144
|
+
let r = super.emit("close");
|
|
9145
|
+
return this.removeAllListeners("close"), r;
|
|
9146
|
+
} else if (t === "error") {
|
|
9147
|
+
this[ut] = s, super.emit(Xt, s);
|
|
9148
|
+
let r = !this[pt] || this.listeners("error").length ? super.emit("error", s) : !1;
|
|
9149
|
+
return this[H](), r;
|
|
9150
|
+
} else if (t === "resume") {
|
|
9151
|
+
let r = super.emit("resume");
|
|
9152
|
+
return this[H](), r;
|
|
9153
|
+
} else if (t === "finish" || t === "prefinish") {
|
|
9154
|
+
let r = super.emit(t);
|
|
9155
|
+
return this.removeAllListeners(t), r;
|
|
9156
|
+
}
|
|
9157
|
+
let i = super.emit(t, ...e);
|
|
9158
|
+
return this[H](), i;
|
|
9159
|
+
}
|
|
9160
|
+
[Jt](t) {
|
|
9161
|
+
for (let s of this[F]) s.dest.write(t) === !1 && this.pause();
|
|
9162
|
+
let e = this[M] ? !1 : super.emit("data", t);
|
|
9163
|
+
return this[H](), e;
|
|
9164
|
+
}
|
|
9165
|
+
[We]() {
|
|
9166
|
+
return this[K] ? !1 : (this[K] = !0, this.readable = !1, this[B] ? (mt(() => this[Zt]()), !0) : this[Zt]());
|
|
9167
|
+
}
|
|
9168
|
+
[Zt]() {
|
|
9169
|
+
if (this[et]) {
|
|
9170
|
+
let e = this[et].end();
|
|
9171
|
+
if (e) {
|
|
9172
|
+
for (let s of this[F]) s.dest.write(e);
|
|
9173
|
+
this[M] || super.emit("data", e);
|
|
9174
|
+
}
|
|
9175
|
+
}
|
|
9176
|
+
for (let e of this[F]) e.end();
|
|
9177
|
+
let t = super.emit("end");
|
|
9178
|
+
return this.removeAllListeners("end"), t;
|
|
9179
|
+
}
|
|
9180
|
+
async collect() {
|
|
9181
|
+
let t = Object.assign([], { dataLength: 0 });
|
|
9182
|
+
this[k] || (t.dataLength = 0);
|
|
9183
|
+
let e = this.promise();
|
|
9184
|
+
return this.on("data", (s) => {
|
|
9185
|
+
t.push(s), this[k] || (t.dataLength += s.length);
|
|
9186
|
+
}), await e, t;
|
|
9187
|
+
}
|
|
9188
|
+
async concat() {
|
|
9189
|
+
if (this[k]) throw new Error("cannot concat in objectMode");
|
|
9190
|
+
let t = await this.collect();
|
|
9191
|
+
return this[P] ? t.join("") : Buffer.concat(t, t.dataLength);
|
|
9192
|
+
}
|
|
9193
|
+
async promise() {
|
|
9194
|
+
return new Promise((t, e) => {
|
|
9195
|
+
this.on(x, () => e(/* @__PURE__ */ new Error("stream destroyed"))), this.on("error", (s) => e(s)), this.on("end", () => t());
|
|
9196
|
+
});
|
|
9197
|
+
}
|
|
9198
|
+
[Symbol.asyncIterator]() {
|
|
9199
|
+
this[M] = !1;
|
|
9200
|
+
let t = !1, e = async () => (this.pause(), t = !0, {
|
|
9201
|
+
value: void 0,
|
|
9202
|
+
done: !0
|
|
9203
|
+
});
|
|
9204
|
+
return {
|
|
9205
|
+
next: () => {
|
|
9206
|
+
if (t) return e();
|
|
9207
|
+
let i = this.read();
|
|
9208
|
+
if (i !== null) return Promise.resolve({
|
|
9209
|
+
done: !1,
|
|
9210
|
+
value: i
|
|
9211
|
+
});
|
|
9212
|
+
if (this[G]) return e();
|
|
9213
|
+
let r, o, h = (c) => {
|
|
9214
|
+
this.off("data", a), this.off("end", l), this.off(x, u), e(), o(c);
|
|
9215
|
+
}, a = (c) => {
|
|
9216
|
+
this.off("error", h), this.off("end", l), this.off(x, u), this.pause(), r({
|
|
9217
|
+
value: c,
|
|
9218
|
+
done: !!this[G]
|
|
9219
|
+
});
|
|
9220
|
+
}, l = () => {
|
|
9221
|
+
this.off("error", h), this.off("data", a), this.off(x, u), e(), r({
|
|
9222
|
+
done: !0,
|
|
9223
|
+
value: void 0
|
|
9224
|
+
});
|
|
9225
|
+
}, u = () => h(/* @__PURE__ */ new Error("stream destroyed"));
|
|
9226
|
+
return new Promise((c, d) => {
|
|
9227
|
+
o = d, r = c, this.once(x, u), this.once("error", h), this.once("end", l), this.once("data", a);
|
|
9228
|
+
});
|
|
9229
|
+
},
|
|
9230
|
+
throw: e,
|
|
9231
|
+
return: e,
|
|
9232
|
+
[Symbol.asyncIterator]() {
|
|
9233
|
+
return this;
|
|
9234
|
+
},
|
|
9235
|
+
[Symbol.asyncDispose]: async () => {}
|
|
9236
|
+
};
|
|
9237
|
+
}
|
|
9238
|
+
[Symbol.iterator]() {
|
|
9239
|
+
this[M] = !1;
|
|
9240
|
+
let t = !1, e = () => (this.pause(), this.off(Xt, e), this.off(x, e), this.off("end", e), t = !0, {
|
|
9241
|
+
done: !0,
|
|
9242
|
+
value: void 0
|
|
9243
|
+
}), s = () => {
|
|
9244
|
+
if (t) return e();
|
|
9245
|
+
let i = this.read();
|
|
9246
|
+
return i === null ? e() : {
|
|
9247
|
+
done: !1,
|
|
9248
|
+
value: i
|
|
9249
|
+
};
|
|
9250
|
+
};
|
|
9251
|
+
return this.once("end", e), this.once(Xt, e), this.once(x, e), {
|
|
9252
|
+
next: s,
|
|
9253
|
+
throw: e,
|
|
9254
|
+
return: e,
|
|
9255
|
+
[Symbol.iterator]() {
|
|
9256
|
+
return this;
|
|
9257
|
+
},
|
|
9258
|
+
[Symbol.dispose]: () => {}
|
|
9259
|
+
};
|
|
9260
|
+
}
|
|
9261
|
+
destroy(t) {
|
|
9262
|
+
if (this[x]) return t ? this.emit("error", t) : this.emit(x), this;
|
|
9263
|
+
this[x] = !0, this[M] = !0, this[C].length = 0, this[T] = 0;
|
|
9264
|
+
let e = this;
|
|
9265
|
+
return typeof e.close == "function" && !this[Rt] && e.close(), t ? this.emit("error", t) : this.emit(x), this;
|
|
9266
|
+
}
|
|
9267
|
+
static get isStream() {
|
|
9268
|
+
return oi;
|
|
9269
|
+
}
|
|
9270
|
+
}, wt = {
|
|
9271
|
+
lstatSync,
|
|
9272
|
+
readdir: readdir$1,
|
|
9273
|
+
readdirSync,
|
|
9274
|
+
readlinkSync,
|
|
9275
|
+
realpathSync: realpathSync.native,
|
|
9276
|
+
promises: {
|
|
9277
|
+
lstat,
|
|
9278
|
+
readdir,
|
|
9279
|
+
readlink,
|
|
9280
|
+
realpath
|
|
9281
|
+
}
|
|
9282
|
+
}, Ue = (n) => !n || n === wt || n === xi ? wt : {
|
|
9283
|
+
...wt,
|
|
9284
|
+
...n,
|
|
9285
|
+
promises: {
|
|
9286
|
+
...wt.promises,
|
|
9287
|
+
...n.promises || {}
|
|
9288
|
+
}
|
|
9289
|
+
}, $e = /^\\\\\?\\([a-z]:)\\?$/i, Ri = (n) => n.replace(/\//g, "\\").replace($e, "$1\\"), Oi = /[\\\/]/, L = 0, Ge = 1, He = 2, U = 4, qe = 6, Ke = 8, X = 10, Ve = 12, _ = 15, gt = ~_, se = 16, je = 32, yt = 64, j = 128, Nt = 256, Lt = 512, Ie = yt | j | Lt, Fi = 1023, ie = (n) => n.isFile() ? Ke : n.isDirectory() ? U : n.isSymbolicLink() ? X : n.isCharacterDevice() ? He : n.isBlockDevice() ? qe : n.isSocket() ? Ve : n.isFIFO() ? Ge : L, ze = new ft({ max: 2 ** 12 }), bt = (n) => {
|
|
9290
|
+
let t = ze.get(n);
|
|
9291
|
+
if (t) return t;
|
|
9292
|
+
let e = n.normalize("NFKD");
|
|
9293
|
+
return ze.set(n, e), e;
|
|
9294
|
+
}, Be = new ft({ max: 2 ** 12 }), _t = (n) => {
|
|
9295
|
+
let t = Be.get(n);
|
|
9296
|
+
if (t) return t;
|
|
9297
|
+
let e = bt(n.toLowerCase());
|
|
9298
|
+
return Be.set(n, e), e;
|
|
9299
|
+
}, Wt = class extends ft {
|
|
9300
|
+
constructor() {
|
|
9301
|
+
super({ max: 256 });
|
|
9302
|
+
}
|
|
9303
|
+
}, ne = class extends ft {
|
|
9304
|
+
constructor(t = 16 * 1024) {
|
|
9305
|
+
super({
|
|
9306
|
+
maxSize: t,
|
|
9307
|
+
sizeCalculation: (e) => e.length + 1
|
|
9308
|
+
});
|
|
9309
|
+
}
|
|
9310
|
+
}, Ye = Symbol("PathScurry setAsCwd"), R = class {
|
|
9311
|
+
name;
|
|
9312
|
+
root;
|
|
9313
|
+
roots;
|
|
9314
|
+
parent;
|
|
9315
|
+
nocase;
|
|
9316
|
+
isCWD = !1;
|
|
9317
|
+
#t;
|
|
9318
|
+
#s;
|
|
9319
|
+
get dev() {
|
|
9320
|
+
return this.#s;
|
|
9321
|
+
}
|
|
9322
|
+
#n;
|
|
9323
|
+
get mode() {
|
|
9324
|
+
return this.#n;
|
|
9325
|
+
}
|
|
9326
|
+
#r;
|
|
9327
|
+
get nlink() {
|
|
9328
|
+
return this.#r;
|
|
9329
|
+
}
|
|
9330
|
+
#o;
|
|
9331
|
+
get uid() {
|
|
9332
|
+
return this.#o;
|
|
9333
|
+
}
|
|
9334
|
+
#S;
|
|
9335
|
+
get gid() {
|
|
9336
|
+
return this.#S;
|
|
9337
|
+
}
|
|
9338
|
+
#w;
|
|
9339
|
+
get rdev() {
|
|
9340
|
+
return this.#w;
|
|
9341
|
+
}
|
|
9342
|
+
#c;
|
|
9343
|
+
get blksize() {
|
|
9344
|
+
return this.#c;
|
|
9345
|
+
}
|
|
9346
|
+
#h;
|
|
9347
|
+
get ino() {
|
|
9348
|
+
return this.#h;
|
|
9349
|
+
}
|
|
9350
|
+
#u;
|
|
9351
|
+
get size() {
|
|
9352
|
+
return this.#u;
|
|
9353
|
+
}
|
|
9354
|
+
#f;
|
|
9355
|
+
get blocks() {
|
|
9356
|
+
return this.#f;
|
|
9357
|
+
}
|
|
9358
|
+
#a;
|
|
9359
|
+
get atimeMs() {
|
|
9360
|
+
return this.#a;
|
|
9361
|
+
}
|
|
9362
|
+
#i;
|
|
9363
|
+
get mtimeMs() {
|
|
9364
|
+
return this.#i;
|
|
9365
|
+
}
|
|
9366
|
+
#d;
|
|
9367
|
+
get ctimeMs() {
|
|
9368
|
+
return this.#d;
|
|
9369
|
+
}
|
|
9370
|
+
#E;
|
|
9371
|
+
get birthtimeMs() {
|
|
9372
|
+
return this.#E;
|
|
9373
|
+
}
|
|
9374
|
+
#b;
|
|
9375
|
+
get atime() {
|
|
9376
|
+
return this.#b;
|
|
9377
|
+
}
|
|
9378
|
+
#p;
|
|
9379
|
+
get mtime() {
|
|
9380
|
+
return this.#p;
|
|
9381
|
+
}
|
|
9382
|
+
#R;
|
|
9383
|
+
get ctime() {
|
|
9384
|
+
return this.#R;
|
|
9385
|
+
}
|
|
9386
|
+
#m;
|
|
9387
|
+
get birthtime() {
|
|
9388
|
+
return this.#m;
|
|
9389
|
+
}
|
|
9390
|
+
#C;
|
|
9391
|
+
#T;
|
|
9392
|
+
#g;
|
|
9393
|
+
#y;
|
|
9394
|
+
#x;
|
|
9395
|
+
#A;
|
|
9396
|
+
#e;
|
|
9397
|
+
#_;
|
|
9398
|
+
#M;
|
|
9399
|
+
#k;
|
|
9400
|
+
get parentPath() {
|
|
9401
|
+
return (this.parent || this).fullpath();
|
|
9402
|
+
}
|
|
9403
|
+
get path() {
|
|
9404
|
+
return this.parentPath;
|
|
9405
|
+
}
|
|
9406
|
+
constructor(t, e = L, s, i, r, o, h) {
|
|
9407
|
+
this.name = t, this.#C = r ? _t(t) : bt(t), this.#e = e & Fi, this.nocase = r, this.roots = i, this.root = s || this, this.#_ = o, this.#g = h.fullpath, this.#x = h.relative, this.#A = h.relativePosix, this.parent = h.parent, this.parent ? this.#t = this.parent.#t : this.#t = Ue(h.fs);
|
|
9408
|
+
}
|
|
9409
|
+
depth() {
|
|
9410
|
+
return this.#T !== void 0 ? this.#T : this.parent ? this.#T = this.parent.depth() + 1 : this.#T = 0;
|
|
9411
|
+
}
|
|
9412
|
+
childrenCache() {
|
|
9413
|
+
return this.#_;
|
|
9414
|
+
}
|
|
9415
|
+
resolve(t) {
|
|
9416
|
+
if (!t) return this;
|
|
9417
|
+
let e = this.getRootString(t), i = t.substring(e.length).split(this.splitSep);
|
|
9418
|
+
return e ? this.getRoot(e).#N(i) : this.#N(i);
|
|
9419
|
+
}
|
|
9420
|
+
#N(t) {
|
|
9421
|
+
let e = this;
|
|
9422
|
+
for (let s of t) e = e.child(s);
|
|
9423
|
+
return e;
|
|
9424
|
+
}
|
|
9425
|
+
children() {
|
|
9426
|
+
let t = this.#_.get(this);
|
|
9427
|
+
if (t) return t;
|
|
9428
|
+
let e = Object.assign([], { provisional: 0 });
|
|
9429
|
+
return this.#_.set(this, e), this.#e &= ~se, e;
|
|
9430
|
+
}
|
|
9431
|
+
child(t, e) {
|
|
9432
|
+
if (t === "" || t === ".") return this;
|
|
9433
|
+
if (t === "..") return this.parent || this;
|
|
9434
|
+
let s = this.children(), i = this.nocase ? _t(t) : bt(t);
|
|
9435
|
+
for (let a of s) if (a.#C === i) return a;
|
|
9436
|
+
let r = this.parent ? this.sep : "", o = this.#g ? this.#g + r + t : void 0, h = this.newChild(t, L, {
|
|
9437
|
+
...e,
|
|
9438
|
+
parent: this,
|
|
9439
|
+
fullpath: o
|
|
9440
|
+
});
|
|
9441
|
+
return this.canReaddir() || (h.#e |= j), s.push(h), h;
|
|
9442
|
+
}
|
|
9443
|
+
relative() {
|
|
9444
|
+
if (this.isCWD) return "";
|
|
9445
|
+
if (this.#x !== void 0) return this.#x;
|
|
9446
|
+
let t = this.name, e = this.parent;
|
|
9447
|
+
if (!e) return this.#x = this.name;
|
|
9448
|
+
let s = e.relative();
|
|
9449
|
+
return s + (!s || !e.parent ? "" : this.sep) + t;
|
|
9450
|
+
}
|
|
9451
|
+
relativePosix() {
|
|
9452
|
+
if (this.sep === "/") return this.relative();
|
|
9453
|
+
if (this.isCWD) return "";
|
|
9454
|
+
if (this.#A !== void 0) return this.#A;
|
|
9455
|
+
let t = this.name, e = this.parent;
|
|
9456
|
+
if (!e) return this.#A = this.fullpathPosix();
|
|
9457
|
+
let s = e.relativePosix();
|
|
9458
|
+
return s + (!s || !e.parent ? "" : "/") + t;
|
|
9459
|
+
}
|
|
9460
|
+
fullpath() {
|
|
9461
|
+
if (this.#g !== void 0) return this.#g;
|
|
9462
|
+
let t = this.name, e = this.parent;
|
|
9463
|
+
if (!e) return this.#g = this.name;
|
|
9464
|
+
return this.#g = e.fullpath() + (e.parent ? this.sep : "") + t;
|
|
9465
|
+
}
|
|
9466
|
+
fullpathPosix() {
|
|
9467
|
+
if (this.#y !== void 0) return this.#y;
|
|
9468
|
+
if (this.sep === "/") return this.#y = this.fullpath();
|
|
9469
|
+
if (!this.parent) {
|
|
9470
|
+
let i = this.fullpath().replace(/\\/g, "/");
|
|
9471
|
+
return /^[a-z]:\//i.test(i) ? this.#y = `//?/${i}` : this.#y = i;
|
|
9472
|
+
}
|
|
9473
|
+
let t = this.parent, e = t.fullpathPosix();
|
|
9474
|
+
return this.#y = e + (!e || !t.parent ? "" : "/") + this.name;
|
|
9475
|
+
}
|
|
9476
|
+
isUnknown() {
|
|
9477
|
+
return (this.#e & _) === L;
|
|
9478
|
+
}
|
|
9479
|
+
isType(t) {
|
|
9480
|
+
return this[`is${t}`]();
|
|
9481
|
+
}
|
|
9482
|
+
getType() {
|
|
9483
|
+
return this.isUnknown() ? "Unknown" : this.isDirectory() ? "Directory" : this.isFile() ? "File" : this.isSymbolicLink() ? "SymbolicLink" : this.isFIFO() ? "FIFO" : this.isCharacterDevice() ? "CharacterDevice" : this.isBlockDevice() ? "BlockDevice" : this.isSocket() ? "Socket" : "Unknown";
|
|
9484
|
+
}
|
|
9485
|
+
isFile() {
|
|
9486
|
+
return (this.#e & _) === Ke;
|
|
9487
|
+
}
|
|
9488
|
+
isDirectory() {
|
|
9489
|
+
return (this.#e & _) === U;
|
|
9490
|
+
}
|
|
9491
|
+
isCharacterDevice() {
|
|
9492
|
+
return (this.#e & _) === He;
|
|
9493
|
+
}
|
|
9494
|
+
isBlockDevice() {
|
|
9495
|
+
return (this.#e & _) === qe;
|
|
9496
|
+
}
|
|
9497
|
+
isFIFO() {
|
|
9498
|
+
return (this.#e & _) === Ge;
|
|
9499
|
+
}
|
|
9500
|
+
isSocket() {
|
|
9501
|
+
return (this.#e & _) === Ve;
|
|
9502
|
+
}
|
|
9503
|
+
isSymbolicLink() {
|
|
9504
|
+
return (this.#e & X) === X;
|
|
9505
|
+
}
|
|
9506
|
+
lstatCached() {
|
|
9507
|
+
return this.#e & je ? this : void 0;
|
|
9508
|
+
}
|
|
9509
|
+
readlinkCached() {
|
|
9510
|
+
return this.#M;
|
|
9511
|
+
}
|
|
9512
|
+
realpathCached() {
|
|
9513
|
+
return this.#k;
|
|
9514
|
+
}
|
|
9515
|
+
readdirCached() {
|
|
9516
|
+
let t = this.children();
|
|
9517
|
+
return t.slice(0, t.provisional);
|
|
9518
|
+
}
|
|
9519
|
+
canReadlink() {
|
|
9520
|
+
if (this.#M) return !0;
|
|
9521
|
+
if (!this.parent) return !1;
|
|
9522
|
+
let t = this.#e & _;
|
|
9523
|
+
return !(t !== L && t !== X || this.#e & Nt || this.#e & j);
|
|
9524
|
+
}
|
|
9525
|
+
calledReaddir() {
|
|
9526
|
+
return !!(this.#e & se);
|
|
9527
|
+
}
|
|
9528
|
+
isENOENT() {
|
|
9529
|
+
return !!(this.#e & j);
|
|
9530
|
+
}
|
|
9531
|
+
isNamed(t) {
|
|
9532
|
+
return this.nocase ? this.#C === _t(t) : this.#C === bt(t);
|
|
9533
|
+
}
|
|
9534
|
+
async readlink() {
|
|
9535
|
+
let t = this.#M;
|
|
9536
|
+
if (t) return t;
|
|
9537
|
+
if (this.canReadlink() && this.parent) try {
|
|
9538
|
+
let e = await this.#t.promises.readlink(this.fullpath()), s = (await this.parent.realpath())?.resolve(e);
|
|
9539
|
+
if (s) return this.#M = s;
|
|
9540
|
+
} catch (e) {
|
|
9541
|
+
this.#D(e.code);
|
|
9542
|
+
return;
|
|
9543
|
+
}
|
|
9544
|
+
}
|
|
9545
|
+
readlinkSync() {
|
|
9546
|
+
let t = this.#M;
|
|
9547
|
+
if (t) return t;
|
|
9548
|
+
if (this.canReadlink() && this.parent) try {
|
|
9549
|
+
let e = this.#t.readlinkSync(this.fullpath()), s = this.parent.realpathSync()?.resolve(e);
|
|
9550
|
+
if (s) return this.#M = s;
|
|
9551
|
+
} catch (e) {
|
|
9552
|
+
this.#D(e.code);
|
|
9553
|
+
return;
|
|
9554
|
+
}
|
|
9555
|
+
}
|
|
9556
|
+
#j(t) {
|
|
9557
|
+
this.#e |= se;
|
|
9558
|
+
for (let e = t.provisional; e < t.length; e++) {
|
|
9559
|
+
let s = t[e];
|
|
9560
|
+
s && s.#v();
|
|
9561
|
+
}
|
|
9562
|
+
}
|
|
9563
|
+
#v() {
|
|
9564
|
+
this.#e & j || (this.#e = (this.#e | j) & gt, this.#G());
|
|
9565
|
+
}
|
|
9566
|
+
#G() {
|
|
9567
|
+
let t = this.children();
|
|
9568
|
+
t.provisional = 0;
|
|
9569
|
+
for (let e of t) e.#v();
|
|
9570
|
+
}
|
|
9571
|
+
#P() {
|
|
9572
|
+
this.#e |= Lt, this.#L();
|
|
9573
|
+
}
|
|
9574
|
+
#L() {
|
|
9575
|
+
if (this.#e & yt) return;
|
|
9576
|
+
let t = this.#e;
|
|
9577
|
+
(t & _) === U && (t &= gt), this.#e = t | yt, this.#G();
|
|
9578
|
+
}
|
|
9579
|
+
#I(t = "") {
|
|
9580
|
+
t === "ENOTDIR" || t === "EPERM" ? this.#L() : t === "ENOENT" ? this.#v() : this.children().provisional = 0;
|
|
9581
|
+
}
|
|
9582
|
+
#F(t = "") {
|
|
9583
|
+
t === "ENOTDIR" ? this.parent.#L() : t === "ENOENT" && this.#v();
|
|
9584
|
+
}
|
|
9585
|
+
#D(t = "") {
|
|
9586
|
+
let e = this.#e;
|
|
9587
|
+
e |= Nt, t === "ENOENT" && (e |= j), (t === "EINVAL" || t === "UNKNOWN") && (e &= gt), this.#e = e, t === "ENOTDIR" && this.parent && this.parent.#L();
|
|
9588
|
+
}
|
|
9589
|
+
#z(t, e) {
|
|
9590
|
+
return this.#U(t, e) || this.#B(t, e);
|
|
9591
|
+
}
|
|
9592
|
+
#B(t, e) {
|
|
9593
|
+
let s = ie(t), i = this.newChild(t.name, s, { parent: this }), r = i.#e & _;
|
|
9594
|
+
return r !== U && r !== X && r !== L && (i.#e |= yt), e.unshift(i), e.provisional++, i;
|
|
9595
|
+
}
|
|
9596
|
+
#U(t, e) {
|
|
9597
|
+
for (let s = e.provisional; s < e.length; s++) {
|
|
9598
|
+
let i = e[s];
|
|
9599
|
+
if ((this.nocase ? _t(t.name) : bt(t.name)) === i.#C) return this.#l(t, i, s, e);
|
|
9600
|
+
}
|
|
9601
|
+
}
|
|
9602
|
+
#l(t, e, s, i) {
|
|
9603
|
+
let r = e.name;
|
|
9604
|
+
return e.#e = e.#e & gt | ie(t), r !== t.name && (e.name = t.name), s !== i.provisional && (s === i.length - 1 ? i.pop() : i.splice(s, 1), i.unshift(e)), i.provisional++, e;
|
|
9605
|
+
}
|
|
9606
|
+
async lstat() {
|
|
9607
|
+
if ((this.#e & j) === 0) try {
|
|
9608
|
+
return this.#$(await this.#t.promises.lstat(this.fullpath())), this;
|
|
9609
|
+
} catch (t) {
|
|
9610
|
+
this.#F(t.code);
|
|
9611
|
+
}
|
|
9612
|
+
}
|
|
9613
|
+
lstatSync() {
|
|
9614
|
+
if ((this.#e & j) === 0) try {
|
|
9615
|
+
return this.#$(this.#t.lstatSync(this.fullpath())), this;
|
|
9616
|
+
} catch (t) {
|
|
9617
|
+
this.#F(t.code);
|
|
9618
|
+
}
|
|
9619
|
+
}
|
|
9620
|
+
#$(t) {
|
|
9621
|
+
let { atime: e, atimeMs: s, birthtime: i, birthtimeMs: r, blksize: o, blocks: h, ctime: a, ctimeMs: l, dev: u, gid: c, ino: d, mode: f, mtime: m, mtimeMs: p, nlink: w, rdev: g, size: S, uid: E } = t;
|
|
9622
|
+
this.#b = e, this.#a = s, this.#m = i, this.#E = r, this.#c = o, this.#f = h, this.#R = a, this.#d = l, this.#s = u, this.#S = c, this.#h = d, this.#n = f, this.#p = m, this.#i = p, this.#r = w, this.#w = g, this.#u = S, this.#o = E;
|
|
9623
|
+
let y = ie(t);
|
|
9624
|
+
this.#e = this.#e & gt | y | je, y !== L && y !== U && y !== X && (this.#e |= yt);
|
|
9625
|
+
}
|
|
9626
|
+
#W = [];
|
|
9627
|
+
#O = !1;
|
|
9628
|
+
#H(t) {
|
|
9629
|
+
this.#O = !1;
|
|
9630
|
+
let e = this.#W.slice();
|
|
9631
|
+
this.#W.length = 0, e.forEach((s) => s(null, t));
|
|
9632
|
+
}
|
|
9633
|
+
readdirCB(t, e = !1) {
|
|
9634
|
+
if (!this.canReaddir()) {
|
|
9635
|
+
e ? t(null, []) : queueMicrotask(() => t(null, []));
|
|
9636
|
+
return;
|
|
9637
|
+
}
|
|
9638
|
+
let s = this.children();
|
|
9639
|
+
if (this.calledReaddir()) {
|
|
9640
|
+
let r = s.slice(0, s.provisional);
|
|
9641
|
+
e ? t(null, r) : queueMicrotask(() => t(null, r));
|
|
9642
|
+
return;
|
|
9643
|
+
}
|
|
9644
|
+
if (this.#W.push(t), this.#O) return;
|
|
9645
|
+
this.#O = !0;
|
|
9646
|
+
let i = this.fullpath();
|
|
9647
|
+
this.#t.readdir(i, { withFileTypes: !0 }, (r, o) => {
|
|
9648
|
+
if (r) this.#I(r.code), s.provisional = 0;
|
|
9649
|
+
else {
|
|
9650
|
+
for (let h of o) this.#z(h, s);
|
|
9651
|
+
this.#j(s);
|
|
9652
|
+
}
|
|
9653
|
+
this.#H(s.slice(0, s.provisional));
|
|
9654
|
+
});
|
|
9655
|
+
}
|
|
9656
|
+
#q;
|
|
9657
|
+
async readdir() {
|
|
9658
|
+
if (!this.canReaddir()) return [];
|
|
9659
|
+
let t = this.children();
|
|
9660
|
+
if (this.calledReaddir()) return t.slice(0, t.provisional);
|
|
9661
|
+
let e = this.fullpath();
|
|
9662
|
+
if (this.#q) await this.#q;
|
|
9663
|
+
else {
|
|
9664
|
+
let s = () => {};
|
|
9665
|
+
this.#q = new Promise((i) => s = i);
|
|
9666
|
+
try {
|
|
9667
|
+
for (let i of await this.#t.promises.readdir(e, { withFileTypes: !0 })) this.#z(i, t);
|
|
9668
|
+
this.#j(t);
|
|
9669
|
+
} catch (i) {
|
|
9670
|
+
this.#I(i.code), t.provisional = 0;
|
|
9671
|
+
}
|
|
9672
|
+
this.#q = void 0, s();
|
|
9673
|
+
}
|
|
9674
|
+
return t.slice(0, t.provisional);
|
|
9675
|
+
}
|
|
9676
|
+
readdirSync() {
|
|
9677
|
+
if (!this.canReaddir()) return [];
|
|
9678
|
+
let t = this.children();
|
|
9679
|
+
if (this.calledReaddir()) return t.slice(0, t.provisional);
|
|
9680
|
+
let e = this.fullpath();
|
|
9681
|
+
try {
|
|
9682
|
+
for (let s of this.#t.readdirSync(e, { withFileTypes: !0 })) this.#z(s, t);
|
|
9683
|
+
this.#j(t);
|
|
9684
|
+
} catch (s) {
|
|
9685
|
+
this.#I(s.code), t.provisional = 0;
|
|
9686
|
+
}
|
|
9687
|
+
return t.slice(0, t.provisional);
|
|
9688
|
+
}
|
|
9689
|
+
canReaddir() {
|
|
9690
|
+
if (this.#e & Ie) return !1;
|
|
9691
|
+
let t = _ & this.#e;
|
|
9692
|
+
return t === L || t === U || t === X;
|
|
9693
|
+
}
|
|
9694
|
+
shouldWalk(t, e) {
|
|
9695
|
+
return (this.#e & U) === U && !(this.#e & Ie) && !t.has(this) && (!e || e(this));
|
|
9696
|
+
}
|
|
9697
|
+
async realpath() {
|
|
9698
|
+
if (this.#k) return this.#k;
|
|
9699
|
+
if (!((Lt | Nt | j) & this.#e)) try {
|
|
9700
|
+
let t = await this.#t.promises.realpath(this.fullpath());
|
|
9701
|
+
return this.#k = this.resolve(t);
|
|
9702
|
+
} catch {
|
|
9703
|
+
this.#P();
|
|
9704
|
+
}
|
|
9705
|
+
}
|
|
9706
|
+
realpathSync() {
|
|
9707
|
+
if (this.#k) return this.#k;
|
|
9708
|
+
if (!((Lt | Nt | j) & this.#e)) try {
|
|
9709
|
+
let t = this.#t.realpathSync(this.fullpath());
|
|
9710
|
+
return this.#k = this.resolve(t);
|
|
9711
|
+
} catch {
|
|
9712
|
+
this.#P();
|
|
9713
|
+
}
|
|
9714
|
+
}
|
|
9715
|
+
[Ye](t) {
|
|
9716
|
+
if (t === this) return;
|
|
9717
|
+
t.isCWD = !1, this.isCWD = !0;
|
|
9718
|
+
let e = /* @__PURE__ */ new Set([]), s = [], i = this;
|
|
9719
|
+
for (; i && i.parent;) e.add(i), i.#x = s.join(this.sep), i.#A = s.join("/"), i = i.parent, s.push("..");
|
|
9720
|
+
for (i = t; i && i.parent && !e.has(i);) i.#x = void 0, i.#A = void 0, i = i.parent;
|
|
9721
|
+
}
|
|
9722
|
+
}, Pt = class n extends R {
|
|
9723
|
+
sep = "\\";
|
|
9724
|
+
splitSep = Oi;
|
|
9725
|
+
constructor(t, e = L, s, i, r, o, h) {
|
|
9726
|
+
super(t, e, s, i, r, o, h);
|
|
9727
|
+
}
|
|
9728
|
+
newChild(t, e = L, s = {}) {
|
|
9729
|
+
return new n(t, e, this.root, this.roots, this.nocase, this.childrenCache(), s);
|
|
9730
|
+
}
|
|
9731
|
+
getRootString(t) {
|
|
9732
|
+
return win32.parse(t).root;
|
|
9733
|
+
}
|
|
9734
|
+
getRoot(t) {
|
|
9735
|
+
if (t = Ri(t.toUpperCase()), t === this.root.name) return this.root;
|
|
9736
|
+
for (let [e, s] of Object.entries(this.roots)) if (this.sameRoot(t, e)) return this.roots[t] = s;
|
|
9737
|
+
return this.roots[t] = new it(t, this).root;
|
|
9738
|
+
}
|
|
9739
|
+
sameRoot(t, e = this.root.name) {
|
|
9740
|
+
return t = t.toUpperCase().replace(/\//g, "\\").replace($e, "$1\\"), t === e;
|
|
9741
|
+
}
|
|
9742
|
+
}, jt = class n extends R {
|
|
9743
|
+
splitSep = "/";
|
|
9744
|
+
sep = "/";
|
|
9745
|
+
constructor(t, e = L, s, i, r, o, h) {
|
|
9746
|
+
super(t, e, s, i, r, o, h);
|
|
9747
|
+
}
|
|
9748
|
+
getRootString(t) {
|
|
9749
|
+
return t.startsWith("/") ? "/" : "";
|
|
9750
|
+
}
|
|
9751
|
+
getRoot(t) {
|
|
9752
|
+
return this.root;
|
|
9753
|
+
}
|
|
9754
|
+
newChild(t, e = L, s = {}) {
|
|
9755
|
+
return new n(t, e, this.root, this.roots, this.nocase, this.childrenCache(), s);
|
|
9756
|
+
}
|
|
9757
|
+
}, It = class {
|
|
9758
|
+
root;
|
|
9759
|
+
rootPath;
|
|
9760
|
+
roots;
|
|
9761
|
+
cwd;
|
|
9762
|
+
#t;
|
|
9763
|
+
#s;
|
|
9764
|
+
#n;
|
|
9765
|
+
nocase;
|
|
9766
|
+
#r;
|
|
9767
|
+
constructor(t = process.cwd(), e, s, { nocase: i, childrenCacheSize: r = 16 * 1024, fs: o = wt } = {}) {
|
|
9768
|
+
this.#r = Ue(o), (t instanceof URL || t.startsWith("file://")) && (t = fileURLToPath(t));
|
|
9769
|
+
let h = e.resolve(t);
|
|
9770
|
+
this.roots = Object.create(null), this.rootPath = this.parseRootPath(h), this.#t = new Wt(), this.#s = new Wt(), this.#n = new ne(r);
|
|
9771
|
+
let a = h.substring(this.rootPath.length).split(s);
|
|
9772
|
+
if (a.length === 1 && !a[0] && a.pop(), i === void 0) throw new TypeError("must provide nocase setting to PathScurryBase ctor");
|
|
9773
|
+
this.nocase = i, this.root = this.newRoot(this.#r), this.roots[this.rootPath] = this.root;
|
|
9774
|
+
let l = this.root, u = a.length - 1, c = e.sep, d = this.rootPath, f = !1;
|
|
9775
|
+
for (let m of a) {
|
|
9776
|
+
let p = u--;
|
|
9777
|
+
l = l.child(m, {
|
|
9778
|
+
relative: new Array(p).fill("..").join(c),
|
|
9779
|
+
relativePosix: new Array(p).fill("..").join("/"),
|
|
9780
|
+
fullpath: d += (f ? "" : c) + m
|
|
9781
|
+
}), f = !0;
|
|
9782
|
+
}
|
|
9783
|
+
this.cwd = l;
|
|
9784
|
+
}
|
|
9785
|
+
depth(t = this.cwd) {
|
|
9786
|
+
return typeof t == "string" && (t = this.cwd.resolve(t)), t.depth();
|
|
9787
|
+
}
|
|
9788
|
+
childrenCache() {
|
|
9789
|
+
return this.#n;
|
|
9790
|
+
}
|
|
9791
|
+
resolve(...t) {
|
|
9792
|
+
let e = "";
|
|
9793
|
+
for (let r = t.length - 1; r >= 0; r--) {
|
|
9794
|
+
let o = t[r];
|
|
9795
|
+
if (!(!o || o === ".") && (e = e ? `${o}/${e}` : o, this.isAbsolute(o))) break;
|
|
9796
|
+
}
|
|
9797
|
+
let s = this.#t.get(e);
|
|
9798
|
+
if (s !== void 0) return s;
|
|
9799
|
+
let i = this.cwd.resolve(e).fullpath();
|
|
9800
|
+
return this.#t.set(e, i), i;
|
|
9801
|
+
}
|
|
9802
|
+
resolvePosix(...t) {
|
|
9803
|
+
let e = "";
|
|
9804
|
+
for (let r = t.length - 1; r >= 0; r--) {
|
|
9805
|
+
let o = t[r];
|
|
9806
|
+
if (!(!o || o === ".") && (e = e ? `${o}/${e}` : o, this.isAbsolute(o))) break;
|
|
9807
|
+
}
|
|
9808
|
+
let s = this.#s.get(e);
|
|
9809
|
+
if (s !== void 0) return s;
|
|
9810
|
+
let i = this.cwd.resolve(e).fullpathPosix();
|
|
9811
|
+
return this.#s.set(e, i), i;
|
|
9812
|
+
}
|
|
9813
|
+
relative(t = this.cwd) {
|
|
9814
|
+
return typeof t == "string" && (t = this.cwd.resolve(t)), t.relative();
|
|
9815
|
+
}
|
|
9816
|
+
relativePosix(t = this.cwd) {
|
|
9817
|
+
return typeof t == "string" && (t = this.cwd.resolve(t)), t.relativePosix();
|
|
9818
|
+
}
|
|
9819
|
+
basename(t = this.cwd) {
|
|
9820
|
+
return typeof t == "string" && (t = this.cwd.resolve(t)), t.name;
|
|
9821
|
+
}
|
|
9822
|
+
dirname(t = this.cwd) {
|
|
9823
|
+
return typeof t == "string" && (t = this.cwd.resolve(t)), (t.parent || t).fullpath();
|
|
9824
|
+
}
|
|
9825
|
+
async readdir(t = this.cwd, e = { withFileTypes: !0 }) {
|
|
9826
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
|
|
9827
|
+
let { withFileTypes: s } = e;
|
|
9828
|
+
if (t.canReaddir()) {
|
|
9829
|
+
let i = await t.readdir();
|
|
9830
|
+
return s ? i : i.map((r) => r.name);
|
|
9831
|
+
} else return [];
|
|
9832
|
+
}
|
|
9833
|
+
readdirSync(t = this.cwd, e = { withFileTypes: !0 }) {
|
|
9834
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
|
|
9835
|
+
let { withFileTypes: s = !0 } = e;
|
|
9836
|
+
return t.canReaddir() ? s ? t.readdirSync() : t.readdirSync().map((i) => i.name) : [];
|
|
9837
|
+
}
|
|
9838
|
+
async lstat(t = this.cwd) {
|
|
9839
|
+
return typeof t == "string" && (t = this.cwd.resolve(t)), t.lstat();
|
|
9840
|
+
}
|
|
9841
|
+
lstatSync(t = this.cwd) {
|
|
9842
|
+
return typeof t == "string" && (t = this.cwd.resolve(t)), t.lstatSync();
|
|
9843
|
+
}
|
|
9844
|
+
async readlink(t = this.cwd, { withFileTypes: e } = { withFileTypes: !1 }) {
|
|
9845
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t.withFileTypes, t = this.cwd);
|
|
9846
|
+
let s = await t.readlink();
|
|
9847
|
+
return e ? s : s?.fullpath();
|
|
9848
|
+
}
|
|
9849
|
+
readlinkSync(t = this.cwd, { withFileTypes: e } = { withFileTypes: !1 }) {
|
|
9850
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t.withFileTypes, t = this.cwd);
|
|
9851
|
+
let s = t.readlinkSync();
|
|
9852
|
+
return e ? s : s?.fullpath();
|
|
9853
|
+
}
|
|
9854
|
+
async realpath(t = this.cwd, { withFileTypes: e } = { withFileTypes: !1 }) {
|
|
9855
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t.withFileTypes, t = this.cwd);
|
|
9856
|
+
let s = await t.realpath();
|
|
9857
|
+
return e ? s : s?.fullpath();
|
|
9858
|
+
}
|
|
9859
|
+
realpathSync(t = this.cwd, { withFileTypes: e } = { withFileTypes: !1 }) {
|
|
9860
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t.withFileTypes, t = this.cwd);
|
|
9861
|
+
let s = t.realpathSync();
|
|
9862
|
+
return e ? s : s?.fullpath();
|
|
9863
|
+
}
|
|
9864
|
+
async walk(t = this.cwd, e = {}) {
|
|
9865
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
|
|
9866
|
+
let { withFileTypes: s = !0, follow: i = !1, filter: r, walkFilter: o } = e, h = [];
|
|
9867
|
+
(!r || r(t)) && h.push(s ? t : t.fullpath());
|
|
9868
|
+
let a = /* @__PURE__ */ new Set(), l = (c, d) => {
|
|
9869
|
+
a.add(c), c.readdirCB((f, m) => {
|
|
9870
|
+
if (f) return d(f);
|
|
9871
|
+
let p = m.length;
|
|
9872
|
+
if (!p) return d();
|
|
9873
|
+
let w = () => {
|
|
9874
|
+
--p === 0 && d();
|
|
9875
|
+
};
|
|
9876
|
+
for (let g of m) (!r || r(g)) && h.push(s ? g : g.fullpath()), i && g.isSymbolicLink() ? g.realpath().then((S) => S?.isUnknown() ? S.lstat() : S).then((S) => S?.shouldWalk(a, o) ? l(S, w) : w()) : g.shouldWalk(a, o) ? l(g, w) : w();
|
|
9877
|
+
}, !0);
|
|
9878
|
+
}, u = t;
|
|
9879
|
+
return new Promise((c, d) => {
|
|
9880
|
+
l(u, (f) => {
|
|
9881
|
+
if (f) return d(f);
|
|
9882
|
+
c(h);
|
|
9883
|
+
});
|
|
9884
|
+
});
|
|
9885
|
+
}
|
|
9886
|
+
walkSync(t = this.cwd, e = {}) {
|
|
9887
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
|
|
9888
|
+
let { withFileTypes: s = !0, follow: i = !1, filter: r, walkFilter: o } = e, h = [];
|
|
9889
|
+
(!r || r(t)) && h.push(s ? t : t.fullpath());
|
|
9890
|
+
let a = new Set([t]);
|
|
9891
|
+
for (let l of a) {
|
|
9892
|
+
let u = l.readdirSync();
|
|
9893
|
+
for (let c of u) {
|
|
9894
|
+
(!r || r(c)) && h.push(s ? c : c.fullpath());
|
|
9895
|
+
let d = c;
|
|
9896
|
+
if (c.isSymbolicLink()) {
|
|
9897
|
+
if (!(i && (d = c.realpathSync()))) continue;
|
|
9898
|
+
d.isUnknown() && d.lstatSync();
|
|
9899
|
+
}
|
|
9900
|
+
d.shouldWalk(a, o) && a.add(d);
|
|
9901
|
+
}
|
|
9902
|
+
}
|
|
9903
|
+
return h;
|
|
9904
|
+
}
|
|
9905
|
+
[Symbol.asyncIterator]() {
|
|
9906
|
+
return this.iterate();
|
|
9907
|
+
}
|
|
9908
|
+
iterate(t = this.cwd, e = {}) {
|
|
9909
|
+
return typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd), this.stream(t, e)[Symbol.asyncIterator]();
|
|
9910
|
+
}
|
|
9911
|
+
[Symbol.iterator]() {
|
|
9912
|
+
return this.iterateSync();
|
|
9913
|
+
}
|
|
9914
|
+
*iterateSync(t = this.cwd, e = {}) {
|
|
9915
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
|
|
9916
|
+
let { withFileTypes: s = !0, follow: i = !1, filter: r, walkFilter: o } = e;
|
|
9917
|
+
(!r || r(t)) && (yield s ? t : t.fullpath());
|
|
9918
|
+
let h = new Set([t]);
|
|
9919
|
+
for (let a of h) {
|
|
9920
|
+
let l = a.readdirSync();
|
|
9921
|
+
for (let u of l) {
|
|
9922
|
+
(!r || r(u)) && (yield s ? u : u.fullpath());
|
|
9923
|
+
let c = u;
|
|
9924
|
+
if (u.isSymbolicLink()) {
|
|
9925
|
+
if (!(i && (c = u.realpathSync()))) continue;
|
|
9926
|
+
c.isUnknown() && c.lstatSync();
|
|
9927
|
+
}
|
|
9928
|
+
c.shouldWalk(h, o) && h.add(c);
|
|
9929
|
+
}
|
|
9930
|
+
}
|
|
9931
|
+
}
|
|
9932
|
+
stream(t = this.cwd, e = {}) {
|
|
9933
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
|
|
9934
|
+
let { withFileTypes: s = !0, follow: i = !1, filter: r, walkFilter: o } = e, h = new V({ objectMode: !0 });
|
|
9935
|
+
(!r || r(t)) && h.write(s ? t : t.fullpath());
|
|
9936
|
+
let a = /* @__PURE__ */ new Set(), l = [t], u = 0, c = () => {
|
|
9937
|
+
let d = !1;
|
|
9938
|
+
for (; !d;) {
|
|
9939
|
+
let f = l.shift();
|
|
9940
|
+
if (!f) {
|
|
9941
|
+
u === 0 && h.end();
|
|
9942
|
+
return;
|
|
9943
|
+
}
|
|
9944
|
+
u++, a.add(f);
|
|
9945
|
+
let m = (w, g, S = !1) => {
|
|
9946
|
+
if (w) return h.emit("error", w);
|
|
9947
|
+
if (i && !S) {
|
|
9948
|
+
let E = [];
|
|
9949
|
+
for (let y of g) y.isSymbolicLink() && E.push(y.realpath().then((b) => b?.isUnknown() ? b.lstat() : b));
|
|
9950
|
+
if (E.length) {
|
|
9951
|
+
Promise.all(E).then(() => m(null, g, !0));
|
|
9952
|
+
return;
|
|
9953
|
+
}
|
|
9954
|
+
}
|
|
9955
|
+
for (let E of g) E && (!r || r(E)) && (h.write(s ? E : E.fullpath()) || (d = !0));
|
|
9956
|
+
u--;
|
|
9957
|
+
for (let E of g) {
|
|
9958
|
+
let y = E.realpathCached() || E;
|
|
9959
|
+
y.shouldWalk(a, o) && l.push(y);
|
|
9960
|
+
}
|
|
9961
|
+
d && !h.flowing ? h.once("drain", c) : p || c();
|
|
9962
|
+
}, p = !0;
|
|
9963
|
+
f.readdirCB(m, !0), p = !1;
|
|
9964
|
+
}
|
|
9965
|
+
};
|
|
9966
|
+
return c(), h;
|
|
9967
|
+
}
|
|
9968
|
+
streamSync(t = this.cwd, e = {}) {
|
|
9969
|
+
typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R || (e = t, t = this.cwd);
|
|
9970
|
+
let { withFileTypes: s = !0, follow: i = !1, filter: r, walkFilter: o } = e, h = new V({ objectMode: !0 }), a = /* @__PURE__ */ new Set();
|
|
9971
|
+
(!r || r(t)) && h.write(s ? t : t.fullpath());
|
|
9972
|
+
let l = [t], u = 0, c = () => {
|
|
9973
|
+
let d = !1;
|
|
9974
|
+
for (; !d;) {
|
|
9975
|
+
let f = l.shift();
|
|
9976
|
+
if (!f) {
|
|
9977
|
+
u === 0 && h.end();
|
|
9978
|
+
return;
|
|
9979
|
+
}
|
|
9980
|
+
u++, a.add(f);
|
|
9981
|
+
let m = f.readdirSync();
|
|
9982
|
+
for (let p of m) (!r || r(p)) && (h.write(s ? p : p.fullpath()) || (d = !0));
|
|
9983
|
+
u--;
|
|
9984
|
+
for (let p of m) {
|
|
9985
|
+
let w = p;
|
|
9986
|
+
if (p.isSymbolicLink()) {
|
|
9987
|
+
if (!(i && (w = p.realpathSync()))) continue;
|
|
9988
|
+
w.isUnknown() && w.lstatSync();
|
|
9989
|
+
}
|
|
9990
|
+
w.shouldWalk(a, o) && l.push(w);
|
|
9991
|
+
}
|
|
9992
|
+
}
|
|
9993
|
+
d && !h.flowing && h.once("drain", c);
|
|
9994
|
+
};
|
|
9995
|
+
return c(), h;
|
|
9996
|
+
}
|
|
9997
|
+
chdir(t = this.cwd) {
|
|
9998
|
+
let e = this.cwd;
|
|
9999
|
+
this.cwd = typeof t == "string" ? this.cwd.resolve(t) : t, this.cwd[Ye](e);
|
|
10000
|
+
}
|
|
10001
|
+
}, it = class extends It {
|
|
10002
|
+
sep = "\\";
|
|
10003
|
+
constructor(t = process.cwd(), e = {}) {
|
|
10004
|
+
let { nocase: s = !0 } = e;
|
|
10005
|
+
super(t, win32, "\\", {
|
|
10006
|
+
...e,
|
|
10007
|
+
nocase: s
|
|
10008
|
+
}), this.nocase = s;
|
|
10009
|
+
for (let i = this.cwd; i; i = i.parent) i.nocase = this.nocase;
|
|
10010
|
+
}
|
|
10011
|
+
parseRootPath(t) {
|
|
10012
|
+
return win32.parse(t).root.toUpperCase();
|
|
10013
|
+
}
|
|
10014
|
+
newRoot(t) {
|
|
10015
|
+
return new Pt(this.rootPath, U, void 0, this.roots, this.nocase, this.childrenCache(), { fs: t });
|
|
10016
|
+
}
|
|
10017
|
+
isAbsolute(t) {
|
|
10018
|
+
return t.startsWith("/") || t.startsWith("\\") || /^[a-z]:(\/|\\)/i.test(t);
|
|
10019
|
+
}
|
|
10020
|
+
}, rt = class extends It {
|
|
10021
|
+
sep = "/";
|
|
10022
|
+
constructor(t = process.cwd(), e = {}) {
|
|
10023
|
+
let { nocase: s = !1 } = e;
|
|
10024
|
+
super(t, posix, "/", {
|
|
10025
|
+
...e,
|
|
10026
|
+
nocase: s
|
|
10027
|
+
}), this.nocase = s;
|
|
10028
|
+
}
|
|
10029
|
+
parseRootPath(t) {
|
|
10030
|
+
return "/";
|
|
10031
|
+
}
|
|
10032
|
+
newRoot(t) {
|
|
10033
|
+
return new jt(this.rootPath, U, void 0, this.roots, this.nocase, this.childrenCache(), { fs: t });
|
|
10034
|
+
}
|
|
10035
|
+
isAbsolute(t) {
|
|
10036
|
+
return t.startsWith("/");
|
|
10037
|
+
}
|
|
10038
|
+
}, St = class extends rt {
|
|
10039
|
+
constructor(t = process.cwd(), e = {}) {
|
|
10040
|
+
let { nocase: s = !0 } = e;
|
|
10041
|
+
super(t, {
|
|
10042
|
+
...e,
|
|
10043
|
+
nocase: s
|
|
10044
|
+
});
|
|
10045
|
+
}
|
|
10046
|
+
};
|
|
10047
|
+
process.platform;
|
|
10048
|
+
var Xe = process.platform === "win32" ? it : process.platform === "darwin" ? St : rt;
|
|
10049
|
+
var Di = (n) => n.length >= 1, Mi = (n) => n.length >= 1, Ni = Symbol.for("nodejs.util.inspect.custom"), nt = class n {
|
|
10050
|
+
#t;
|
|
10051
|
+
#s;
|
|
10052
|
+
#n;
|
|
10053
|
+
length;
|
|
10054
|
+
#r;
|
|
10055
|
+
#o;
|
|
10056
|
+
#S;
|
|
10057
|
+
#w;
|
|
10058
|
+
#c;
|
|
10059
|
+
#h;
|
|
10060
|
+
#u = !0;
|
|
10061
|
+
constructor(t, e, s, i) {
|
|
10062
|
+
if (!Di(t)) throw new TypeError("empty pattern list");
|
|
10063
|
+
if (!Mi(e)) throw new TypeError("empty glob list");
|
|
10064
|
+
if (e.length !== t.length) throw new TypeError("mismatched pattern list and glob list lengths");
|
|
10065
|
+
if (this.length = t.length, s < 0 || s >= this.length) throw new TypeError("index out of range");
|
|
10066
|
+
if (this.#t = t, this.#s = e, this.#n = s, this.#r = i, this.#n === 0) {
|
|
10067
|
+
if (this.isUNC()) {
|
|
10068
|
+
let [r, o, h, a, ...l] = this.#t, [u, c, d, f, ...m] = this.#s;
|
|
10069
|
+
l[0] === "" && (l.shift(), m.shift());
|
|
10070
|
+
let p = [
|
|
10071
|
+
r,
|
|
10072
|
+
o,
|
|
10073
|
+
h,
|
|
10074
|
+
a,
|
|
10075
|
+
""
|
|
10076
|
+
].join("/"), w = [
|
|
10077
|
+
u,
|
|
10078
|
+
c,
|
|
10079
|
+
d,
|
|
10080
|
+
f,
|
|
10081
|
+
""
|
|
10082
|
+
].join("/");
|
|
10083
|
+
this.#t = [p, ...l], this.#s = [w, ...m], this.length = this.#t.length;
|
|
10084
|
+
} else if (this.isDrive() || this.isAbsolute()) {
|
|
10085
|
+
let [r, ...o] = this.#t, [h, ...a] = this.#s;
|
|
10086
|
+
o[0] === "" && (o.shift(), a.shift());
|
|
10087
|
+
let l = r + "/", u = h + "/";
|
|
10088
|
+
this.#t = [l, ...o], this.#s = [u, ...a], this.length = this.#t.length;
|
|
10089
|
+
}
|
|
10090
|
+
}
|
|
10091
|
+
}
|
|
10092
|
+
[Ni]() {
|
|
10093
|
+
return "Pattern <" + this.#s.slice(this.#n).join("/") + ">";
|
|
10094
|
+
}
|
|
10095
|
+
pattern() {
|
|
10096
|
+
return this.#t[this.#n];
|
|
10097
|
+
}
|
|
10098
|
+
isString() {
|
|
10099
|
+
return typeof this.#t[this.#n] == "string";
|
|
10100
|
+
}
|
|
10101
|
+
isGlobstar() {
|
|
10102
|
+
return this.#t[this.#n] === A;
|
|
10103
|
+
}
|
|
10104
|
+
isRegExp() {
|
|
10105
|
+
return this.#t[this.#n] instanceof RegExp;
|
|
10106
|
+
}
|
|
10107
|
+
globString() {
|
|
10108
|
+
return this.#S = this.#S || (this.#n === 0 ? this.isAbsolute() ? this.#s[0] + this.#s.slice(1).join("/") : this.#s.join("/") : this.#s.slice(this.#n).join("/"));
|
|
10109
|
+
}
|
|
10110
|
+
hasMore() {
|
|
10111
|
+
return this.length > this.#n + 1;
|
|
10112
|
+
}
|
|
10113
|
+
rest() {
|
|
10114
|
+
return this.#o !== void 0 ? this.#o : this.hasMore() ? (this.#o = new n(this.#t, this.#s, this.#n + 1, this.#r), this.#o.#h = this.#h, this.#o.#c = this.#c, this.#o.#w = this.#w, this.#o) : this.#o = null;
|
|
10115
|
+
}
|
|
10116
|
+
isUNC() {
|
|
10117
|
+
let t = this.#t;
|
|
10118
|
+
return this.#c !== void 0 ? this.#c : this.#c = this.#r === "win32" && this.#n === 0 && t[0] === "" && t[1] === "" && typeof t[2] == "string" && !!t[2] && typeof t[3] == "string" && !!t[3];
|
|
10119
|
+
}
|
|
10120
|
+
isDrive() {
|
|
10121
|
+
let t = this.#t;
|
|
10122
|
+
return this.#w !== void 0 ? this.#w : this.#w = this.#r === "win32" && this.#n === 0 && this.length > 1 && typeof t[0] == "string" && /^[a-z]:$/i.test(t[0]);
|
|
10123
|
+
}
|
|
10124
|
+
isAbsolute() {
|
|
10125
|
+
let t = this.#t;
|
|
10126
|
+
return this.#h !== void 0 ? this.#h : this.#h = t[0] === "" && t.length > 1 || this.isDrive() || this.isUNC();
|
|
10127
|
+
}
|
|
10128
|
+
root() {
|
|
10129
|
+
let t = this.#t[0];
|
|
10130
|
+
return typeof t == "string" && this.isAbsolute() && this.#n === 0 ? t : "";
|
|
10131
|
+
}
|
|
10132
|
+
checkFollowGlobstar() {
|
|
10133
|
+
return !(this.#n === 0 || !this.isGlobstar() || !this.#u);
|
|
10134
|
+
}
|
|
10135
|
+
markFollowGlobstar() {
|
|
10136
|
+
return this.#n === 0 || !this.isGlobstar() || !this.#u ? !1 : (this.#u = !1, !0);
|
|
10137
|
+
}
|
|
10138
|
+
};
|
|
10139
|
+
var _i = typeof process == "object" && process && typeof process.platform == "string" ? process.platform : "linux", ot = class {
|
|
10140
|
+
relative;
|
|
10141
|
+
relativeChildren;
|
|
10142
|
+
absolute;
|
|
10143
|
+
absoluteChildren;
|
|
10144
|
+
platform;
|
|
10145
|
+
mmopts;
|
|
10146
|
+
constructor(t, { nobrace: e, nocase: s, noext: i, noglobstar: r, platform: o = _i }) {
|
|
10147
|
+
this.relative = [], this.absolute = [], this.relativeChildren = [], this.absoluteChildren = [], this.platform = o, this.mmopts = {
|
|
10148
|
+
dot: !0,
|
|
10149
|
+
nobrace: e,
|
|
10150
|
+
nocase: s,
|
|
10151
|
+
noext: i,
|
|
10152
|
+
noglobstar: r,
|
|
10153
|
+
optimizationLevel: 2,
|
|
10154
|
+
platform: o,
|
|
10155
|
+
nocomment: !0,
|
|
10156
|
+
nonegate: !0
|
|
10157
|
+
};
|
|
10158
|
+
for (let h of t) this.add(h);
|
|
10159
|
+
}
|
|
10160
|
+
add(t) {
|
|
10161
|
+
let e = new D(t, this.mmopts);
|
|
10162
|
+
for (let s = 0; s < e.set.length; s++) {
|
|
10163
|
+
let i = e.set[s], r = e.globParts[s];
|
|
10164
|
+
if (!i || !r) throw new Error("invalid pattern object");
|
|
10165
|
+
for (; i[0] === "." && r[0] === ".";) i.shift(), r.shift();
|
|
10166
|
+
let o = new nt(i, r, 0, this.platform), h = new D(o.globString(), this.mmopts), a = r[r.length - 1] === "**", l = o.isAbsolute();
|
|
10167
|
+
l ? this.absolute.push(h) : this.relative.push(h), a && (l ? this.absoluteChildren.push(h) : this.relativeChildren.push(h));
|
|
10168
|
+
}
|
|
10169
|
+
}
|
|
10170
|
+
ignored(t) {
|
|
10171
|
+
let e = t.fullpath(), s = `${e}/`, i = t.relative() || ".", r = `${i}/`;
|
|
10172
|
+
for (let o of this.relative) if (o.match(i) || o.match(r)) return !0;
|
|
10173
|
+
for (let o of this.absolute) if (o.match(e) || o.match(s)) return !0;
|
|
10174
|
+
return !1;
|
|
10175
|
+
}
|
|
10176
|
+
childrenIgnored(t) {
|
|
10177
|
+
let e = t.fullpath() + "/", s = (t.relative() || ".") + "/";
|
|
10178
|
+
for (let i of this.relativeChildren) if (i.match(s)) return !0;
|
|
10179
|
+
for (let i of this.absoluteChildren) if (i.match(e)) return !0;
|
|
10180
|
+
return !1;
|
|
10181
|
+
}
|
|
10182
|
+
};
|
|
10183
|
+
var oe = class n {
|
|
10184
|
+
store;
|
|
10185
|
+
constructor(t = /* @__PURE__ */ new Map()) {
|
|
10186
|
+
this.store = t;
|
|
10187
|
+
}
|
|
10188
|
+
copy() {
|
|
10189
|
+
return new n(new Map(this.store));
|
|
10190
|
+
}
|
|
10191
|
+
hasWalked(t, e) {
|
|
10192
|
+
return this.store.get(t.fullpath())?.has(e.globString());
|
|
10193
|
+
}
|
|
10194
|
+
storeWalked(t, e) {
|
|
10195
|
+
let s = t.fullpath(), i = this.store.get(s);
|
|
10196
|
+
i ? i.add(e.globString()) : this.store.set(s, new Set([e.globString()]));
|
|
10197
|
+
}
|
|
10198
|
+
}, he = class {
|
|
10199
|
+
store = /* @__PURE__ */ new Map();
|
|
10200
|
+
add(t, e, s) {
|
|
10201
|
+
let i = (e ? 2 : 0) | (s ? 1 : 0), r = this.store.get(t);
|
|
10202
|
+
this.store.set(t, r === void 0 ? i : i & r);
|
|
10203
|
+
}
|
|
10204
|
+
entries() {
|
|
10205
|
+
return [...this.store.entries()].map(([t, e]) => [
|
|
10206
|
+
t,
|
|
10207
|
+
!!(e & 2),
|
|
10208
|
+
!!(e & 1)
|
|
10209
|
+
]);
|
|
10210
|
+
}
|
|
10211
|
+
}, ae = class {
|
|
10212
|
+
store = /* @__PURE__ */ new Map();
|
|
10213
|
+
add(t, e) {
|
|
10214
|
+
if (!t.canReaddir()) return;
|
|
10215
|
+
let s = this.store.get(t);
|
|
10216
|
+
s ? s.find((i) => i.globString() === e.globString()) || s.push(e) : this.store.set(t, [e]);
|
|
10217
|
+
}
|
|
10218
|
+
get(t) {
|
|
10219
|
+
let e = this.store.get(t);
|
|
10220
|
+
if (!e) throw new Error("attempting to walk unknown path");
|
|
10221
|
+
return e;
|
|
10222
|
+
}
|
|
10223
|
+
entries() {
|
|
10224
|
+
return this.keys().map((t) => [t, this.store.get(t)]);
|
|
10225
|
+
}
|
|
10226
|
+
keys() {
|
|
10227
|
+
return [...this.store.keys()].filter((t) => t.canReaddir());
|
|
10228
|
+
}
|
|
10229
|
+
}, Et = class n {
|
|
10230
|
+
hasWalkedCache;
|
|
10231
|
+
matches = new he();
|
|
10232
|
+
subwalks = new ae();
|
|
10233
|
+
patterns;
|
|
10234
|
+
follow;
|
|
10235
|
+
dot;
|
|
10236
|
+
opts;
|
|
10237
|
+
constructor(t, e) {
|
|
10238
|
+
this.opts = t, this.follow = !!t.follow, this.dot = !!t.dot, this.hasWalkedCache = e ? e.copy() : new oe();
|
|
10239
|
+
}
|
|
10240
|
+
processPatterns(t, e) {
|
|
10241
|
+
this.patterns = e;
|
|
10242
|
+
let s = e.map((i) => [t, i]);
|
|
10243
|
+
for (let [i, r] of s) {
|
|
10244
|
+
this.hasWalkedCache.storeWalked(i, r);
|
|
10245
|
+
let o = r.root(), h = r.isAbsolute() && this.opts.absolute !== !1;
|
|
10246
|
+
if (o) {
|
|
10247
|
+
i = i.resolve(o === "/" && this.opts.root !== void 0 ? this.opts.root : o);
|
|
10248
|
+
let c = r.rest();
|
|
10249
|
+
if (c) r = c;
|
|
10250
|
+
else {
|
|
10251
|
+
this.matches.add(i, !0, !1);
|
|
10252
|
+
continue;
|
|
10253
|
+
}
|
|
10254
|
+
}
|
|
10255
|
+
if (i.isENOENT()) continue;
|
|
10256
|
+
let a, l, u = !1;
|
|
10257
|
+
for (; typeof (a = r.pattern()) == "string" && (l = r.rest());) i = i.resolve(a), r = l, u = !0;
|
|
10258
|
+
if (a = r.pattern(), l = r.rest(), u) {
|
|
10259
|
+
if (this.hasWalkedCache.hasWalked(i, r)) continue;
|
|
10260
|
+
this.hasWalkedCache.storeWalked(i, r);
|
|
10261
|
+
}
|
|
10262
|
+
if (typeof a == "string") {
|
|
10263
|
+
let c = a === ".." || a === "" || a === ".";
|
|
10264
|
+
this.matches.add(i.resolve(a), h, c);
|
|
10265
|
+
continue;
|
|
10266
|
+
} else if (a === A) {
|
|
10267
|
+
(!i.isSymbolicLink() || this.follow || r.checkFollowGlobstar()) && this.subwalks.add(i, r);
|
|
10268
|
+
let c = l?.pattern(), d = l?.rest();
|
|
10269
|
+
if (!l || (c === "" || c === ".") && !d) this.matches.add(i, h, c === "" || c === ".");
|
|
10270
|
+
else if (c === "..") {
|
|
10271
|
+
let f = i.parent || i;
|
|
10272
|
+
d ? this.hasWalkedCache.hasWalked(f, d) || this.subwalks.add(f, d) : this.matches.add(f, h, !0);
|
|
10273
|
+
}
|
|
10274
|
+
} else a instanceof RegExp && this.subwalks.add(i, r);
|
|
10275
|
+
}
|
|
10276
|
+
return this;
|
|
10277
|
+
}
|
|
10278
|
+
subwalkTargets() {
|
|
10279
|
+
return this.subwalks.keys();
|
|
10280
|
+
}
|
|
10281
|
+
child() {
|
|
10282
|
+
return new n(this.opts, this.hasWalkedCache);
|
|
10283
|
+
}
|
|
10284
|
+
filterEntries(t, e) {
|
|
10285
|
+
let s = this.subwalks.get(t), i = this.child();
|
|
10286
|
+
for (let r of e) for (let o of s) {
|
|
10287
|
+
let h = o.isAbsolute(), a = o.pattern(), l = o.rest();
|
|
10288
|
+
a === A ? i.testGlobstar(r, o, l, h) : a instanceof RegExp ? i.testRegExp(r, a, l, h) : i.testString(r, a, l, h);
|
|
10289
|
+
}
|
|
10290
|
+
return i;
|
|
10291
|
+
}
|
|
10292
|
+
testGlobstar(t, e, s, i) {
|
|
10293
|
+
if ((this.dot || !t.name.startsWith(".")) && (e.hasMore() || this.matches.add(t, i, !1), t.canReaddir() && (this.follow || !t.isSymbolicLink() ? this.subwalks.add(t, e) : t.isSymbolicLink() && (s && e.checkFollowGlobstar() ? this.subwalks.add(t, s) : e.markFollowGlobstar() && this.subwalks.add(t, e)))), s) {
|
|
10294
|
+
let r = s.pattern();
|
|
10295
|
+
if (typeof r == "string" && r !== ".." && r !== "" && r !== ".") this.testString(t, r, s.rest(), i);
|
|
10296
|
+
else if (r === "..") {
|
|
10297
|
+
let o = t.parent || t;
|
|
10298
|
+
this.subwalks.add(o, s);
|
|
10299
|
+
} else r instanceof RegExp && this.testRegExp(t, r, s.rest(), i);
|
|
10300
|
+
}
|
|
10301
|
+
}
|
|
10302
|
+
testRegExp(t, e, s, i) {
|
|
10303
|
+
e.test(t.name) && (s ? this.subwalks.add(t, s) : this.matches.add(t, i, !1));
|
|
10304
|
+
}
|
|
10305
|
+
testString(t, e, s, i) {
|
|
10306
|
+
t.isNamed(e) && (s ? this.subwalks.add(t, s) : this.matches.add(t, i, !1));
|
|
10307
|
+
}
|
|
10308
|
+
};
|
|
10309
|
+
var Li = (n, t) => typeof n == "string" ? new ot([n], t) : Array.isArray(n) ? new ot(n, t) : n, zt = class {
|
|
10310
|
+
path;
|
|
10311
|
+
patterns;
|
|
10312
|
+
opts;
|
|
10313
|
+
seen = /* @__PURE__ */ new Set();
|
|
10314
|
+
paused = !1;
|
|
10315
|
+
aborted = !1;
|
|
10316
|
+
#t = [];
|
|
10317
|
+
#s;
|
|
10318
|
+
#n;
|
|
10319
|
+
signal;
|
|
10320
|
+
maxDepth;
|
|
10321
|
+
includeChildMatches;
|
|
10322
|
+
constructor(t, e, s) {
|
|
10323
|
+
if (this.patterns = t, this.path = e, this.opts = s, this.#n = !s.posix && s.platform === "win32" ? "\\" : "/", this.includeChildMatches = s.includeChildMatches !== !1, (s.ignore || !this.includeChildMatches) && (this.#s = Li(s.ignore ?? [], s), !this.includeChildMatches && typeof this.#s.add != "function")) throw new Error("cannot ignore child matches, ignore lacks add() method.");
|
|
10324
|
+
this.maxDepth = s.maxDepth || Infinity, s.signal && (this.signal = s.signal, this.signal.addEventListener("abort", () => {
|
|
10325
|
+
this.#t.length = 0;
|
|
10326
|
+
}));
|
|
10327
|
+
}
|
|
10328
|
+
#r(t) {
|
|
10329
|
+
return this.seen.has(t) || !!this.#s?.ignored?.(t);
|
|
10330
|
+
}
|
|
10331
|
+
#o(t) {
|
|
10332
|
+
return !!this.#s?.childrenIgnored?.(t);
|
|
10333
|
+
}
|
|
10334
|
+
pause() {
|
|
10335
|
+
this.paused = !0;
|
|
10336
|
+
}
|
|
10337
|
+
resume() {
|
|
10338
|
+
if (this.signal?.aborted) return;
|
|
10339
|
+
this.paused = !1;
|
|
10340
|
+
let t;
|
|
10341
|
+
for (; !this.paused && (t = this.#t.shift());) t();
|
|
10342
|
+
}
|
|
10343
|
+
onResume(t) {
|
|
10344
|
+
this.signal?.aborted || (this.paused ? this.#t.push(t) : t());
|
|
10345
|
+
}
|
|
10346
|
+
async matchCheck(t, e) {
|
|
10347
|
+
if (e && this.opts.nodir) return;
|
|
10348
|
+
let s;
|
|
10349
|
+
if (this.opts.realpath) {
|
|
10350
|
+
if (s = t.realpathCached() || await t.realpath(), !s) return;
|
|
10351
|
+
t = s;
|
|
10352
|
+
}
|
|
10353
|
+
let r = t.isUnknown() || this.opts.stat ? await t.lstat() : t;
|
|
10354
|
+
if (this.opts.follow && this.opts.nodir && r?.isSymbolicLink()) {
|
|
10355
|
+
let o = await r.realpath();
|
|
10356
|
+
o && (o.isUnknown() || this.opts.stat) && await o.lstat();
|
|
10357
|
+
}
|
|
10358
|
+
return this.matchCheckTest(r, e);
|
|
10359
|
+
}
|
|
10360
|
+
matchCheckTest(t, e) {
|
|
10361
|
+
return t && (this.maxDepth === Infinity || t.depth() <= this.maxDepth) && (!e || t.canReaddir()) && (!this.opts.nodir || !t.isDirectory()) && (!this.opts.nodir || !this.opts.follow || !t.isSymbolicLink() || !t.realpathCached()?.isDirectory()) && !this.#r(t) ? t : void 0;
|
|
10362
|
+
}
|
|
10363
|
+
matchCheckSync(t, e) {
|
|
10364
|
+
if (e && this.opts.nodir) return;
|
|
10365
|
+
let s;
|
|
10366
|
+
if (this.opts.realpath) {
|
|
10367
|
+
if (s = t.realpathCached() || t.realpathSync(), !s) return;
|
|
10368
|
+
t = s;
|
|
10369
|
+
}
|
|
10370
|
+
let r = t.isUnknown() || this.opts.stat ? t.lstatSync() : t;
|
|
10371
|
+
if (this.opts.follow && this.opts.nodir && r?.isSymbolicLink()) {
|
|
10372
|
+
let o = r.realpathSync();
|
|
10373
|
+
o && (o?.isUnknown() || this.opts.stat) && o.lstatSync();
|
|
10374
|
+
}
|
|
10375
|
+
return this.matchCheckTest(r, e);
|
|
10376
|
+
}
|
|
10377
|
+
matchFinish(t, e) {
|
|
10378
|
+
if (this.#r(t)) return;
|
|
10379
|
+
if (!this.includeChildMatches && this.#s?.add) {
|
|
10380
|
+
let r = `${t.relativePosix()}/**`;
|
|
10381
|
+
this.#s.add(r);
|
|
10382
|
+
}
|
|
10383
|
+
let s = this.opts.absolute === void 0 ? e : this.opts.absolute;
|
|
10384
|
+
this.seen.add(t);
|
|
10385
|
+
let i = this.opts.mark && t.isDirectory() ? this.#n : "";
|
|
10386
|
+
if (this.opts.withFileTypes) this.matchEmit(t);
|
|
10387
|
+
else if (s) {
|
|
10388
|
+
let r = this.opts.posix ? t.fullpathPosix() : t.fullpath();
|
|
10389
|
+
this.matchEmit(r + i);
|
|
10390
|
+
} else {
|
|
10391
|
+
let r = this.opts.posix ? t.relativePosix() : t.relative(), o = this.opts.dotRelative && !r.startsWith(".." + this.#n) ? "." + this.#n : "";
|
|
10392
|
+
this.matchEmit(r ? o + r + i : "." + i);
|
|
10393
|
+
}
|
|
10394
|
+
}
|
|
10395
|
+
async match(t, e, s) {
|
|
10396
|
+
let i = await this.matchCheck(t, s);
|
|
10397
|
+
i && this.matchFinish(i, e);
|
|
10398
|
+
}
|
|
10399
|
+
matchSync(t, e, s) {
|
|
10400
|
+
let i = this.matchCheckSync(t, s);
|
|
10401
|
+
i && this.matchFinish(i, e);
|
|
10402
|
+
}
|
|
10403
|
+
walkCB(t, e, s) {
|
|
10404
|
+
this.signal?.aborted && s(), this.walkCB2(t, e, new Et(this.opts), s);
|
|
10405
|
+
}
|
|
10406
|
+
walkCB2(t, e, s, i) {
|
|
10407
|
+
if (this.#o(t)) return i();
|
|
10408
|
+
if (this.signal?.aborted && i(), this.paused) {
|
|
10409
|
+
this.onResume(() => this.walkCB2(t, e, s, i));
|
|
10410
|
+
return;
|
|
10411
|
+
}
|
|
10412
|
+
s.processPatterns(t, e);
|
|
10413
|
+
let r = 1, o = () => {
|
|
10414
|
+
--r === 0 && i();
|
|
10415
|
+
};
|
|
10416
|
+
for (let [h, a, l] of s.matches.entries()) this.#r(h) || (r++, this.match(h, a, l).then(() => o()));
|
|
10417
|
+
for (let h of s.subwalkTargets()) {
|
|
10418
|
+
if (this.maxDepth !== Infinity && h.depth() >= this.maxDepth) continue;
|
|
10419
|
+
r++;
|
|
10420
|
+
let a = h.readdirCached();
|
|
10421
|
+
h.calledReaddir() ? this.walkCB3(h, a, s, o) : h.readdirCB((l, u) => this.walkCB3(h, u, s, o), !0);
|
|
10422
|
+
}
|
|
10423
|
+
o();
|
|
10424
|
+
}
|
|
10425
|
+
walkCB3(t, e, s, i) {
|
|
10426
|
+
s = s.filterEntries(t, e);
|
|
10427
|
+
let r = 1, o = () => {
|
|
10428
|
+
--r === 0 && i();
|
|
10429
|
+
};
|
|
10430
|
+
for (let [h, a, l] of s.matches.entries()) this.#r(h) || (r++, this.match(h, a, l).then(() => o()));
|
|
10431
|
+
for (let [h, a] of s.subwalks.entries()) r++, this.walkCB2(h, a, s.child(), o);
|
|
10432
|
+
o();
|
|
10433
|
+
}
|
|
10434
|
+
walkCBSync(t, e, s) {
|
|
10435
|
+
this.signal?.aborted && s(), this.walkCB2Sync(t, e, new Et(this.opts), s);
|
|
10436
|
+
}
|
|
10437
|
+
walkCB2Sync(t, e, s, i) {
|
|
10438
|
+
if (this.#o(t)) return i();
|
|
10439
|
+
if (this.signal?.aborted && i(), this.paused) {
|
|
10440
|
+
this.onResume(() => this.walkCB2Sync(t, e, s, i));
|
|
10441
|
+
return;
|
|
10442
|
+
}
|
|
10443
|
+
s.processPatterns(t, e);
|
|
10444
|
+
let r = 1, o = () => {
|
|
10445
|
+
--r === 0 && i();
|
|
10446
|
+
};
|
|
10447
|
+
for (let [h, a, l] of s.matches.entries()) this.#r(h) || this.matchSync(h, a, l);
|
|
10448
|
+
for (let h of s.subwalkTargets()) {
|
|
10449
|
+
if (this.maxDepth !== Infinity && h.depth() >= this.maxDepth) continue;
|
|
10450
|
+
r++;
|
|
10451
|
+
let a = h.readdirSync();
|
|
10452
|
+
this.walkCB3Sync(h, a, s, o);
|
|
10453
|
+
}
|
|
10454
|
+
o();
|
|
10455
|
+
}
|
|
10456
|
+
walkCB3Sync(t, e, s, i) {
|
|
10457
|
+
s = s.filterEntries(t, e);
|
|
10458
|
+
let r = 1, o = () => {
|
|
10459
|
+
--r === 0 && i();
|
|
10460
|
+
};
|
|
10461
|
+
for (let [h, a, l] of s.matches.entries()) this.#r(h) || this.matchSync(h, a, l);
|
|
10462
|
+
for (let [h, a] of s.subwalks.entries()) r++, this.walkCB2Sync(h, a, s.child(), o);
|
|
10463
|
+
o();
|
|
10464
|
+
}
|
|
10465
|
+
}, xt = class extends zt {
|
|
10466
|
+
matches = /* @__PURE__ */ new Set();
|
|
10467
|
+
constructor(t, e, s) {
|
|
10468
|
+
super(t, e, s);
|
|
10469
|
+
}
|
|
10470
|
+
matchEmit(t) {
|
|
10471
|
+
this.matches.add(t);
|
|
10472
|
+
}
|
|
10473
|
+
async walk() {
|
|
10474
|
+
if (this.signal?.aborted) throw this.signal.reason;
|
|
10475
|
+
return this.path.isUnknown() && await this.path.lstat(), await new Promise((t, e) => {
|
|
10476
|
+
this.walkCB(this.path, this.patterns, () => {
|
|
10477
|
+
this.signal?.aborted ? e(this.signal.reason) : t(this.matches);
|
|
10478
|
+
});
|
|
10479
|
+
}), this.matches;
|
|
10480
|
+
}
|
|
10481
|
+
walkSync() {
|
|
10482
|
+
if (this.signal?.aborted) throw this.signal.reason;
|
|
10483
|
+
return this.path.isUnknown() && this.path.lstatSync(), this.walkCBSync(this.path, this.patterns, () => {
|
|
10484
|
+
if (this.signal?.aborted) throw this.signal.reason;
|
|
10485
|
+
}), this.matches;
|
|
10486
|
+
}
|
|
10487
|
+
}, vt = class extends zt {
|
|
10488
|
+
results;
|
|
10489
|
+
constructor(t, e, s) {
|
|
10490
|
+
super(t, e, s), this.results = new V({
|
|
10491
|
+
signal: this.signal,
|
|
10492
|
+
objectMode: !0
|
|
10493
|
+
}), this.results.on("drain", () => this.resume()), this.results.on("resume", () => this.resume());
|
|
10494
|
+
}
|
|
10495
|
+
matchEmit(t) {
|
|
10496
|
+
this.results.write(t), this.results.flowing || this.pause();
|
|
10497
|
+
}
|
|
10498
|
+
stream() {
|
|
10499
|
+
let t = this.path;
|
|
10500
|
+
return t.isUnknown() ? t.lstat().then(() => {
|
|
10501
|
+
this.walkCB(t, this.patterns, () => this.results.end());
|
|
10502
|
+
}) : this.walkCB(t, this.patterns, () => this.results.end()), this.results;
|
|
10503
|
+
}
|
|
10504
|
+
streamSync() {
|
|
10505
|
+
return this.path.isUnknown() && this.path.lstatSync(), this.walkCBSync(this.path, this.patterns, () => this.results.end()), this.results;
|
|
10506
|
+
}
|
|
10507
|
+
};
|
|
10508
|
+
var Pi = typeof process == "object" && process && typeof process.platform == "string" ? process.platform : "linux", I = class {
|
|
10509
|
+
absolute;
|
|
10510
|
+
cwd;
|
|
10511
|
+
root;
|
|
10512
|
+
dot;
|
|
10513
|
+
dotRelative;
|
|
10514
|
+
follow;
|
|
10515
|
+
ignore;
|
|
10516
|
+
magicalBraces;
|
|
10517
|
+
mark;
|
|
10518
|
+
matchBase;
|
|
10519
|
+
maxDepth;
|
|
10520
|
+
nobrace;
|
|
10521
|
+
nocase;
|
|
10522
|
+
nodir;
|
|
10523
|
+
noext;
|
|
10524
|
+
noglobstar;
|
|
10525
|
+
pattern;
|
|
10526
|
+
platform;
|
|
10527
|
+
realpath;
|
|
10528
|
+
scurry;
|
|
10529
|
+
stat;
|
|
10530
|
+
signal;
|
|
10531
|
+
windowsPathsNoEscape;
|
|
10532
|
+
withFileTypes;
|
|
10533
|
+
includeChildMatches;
|
|
10534
|
+
opts;
|
|
10535
|
+
patterns;
|
|
10536
|
+
constructor(t, e) {
|
|
10537
|
+
if (!e) throw new TypeError("glob options required");
|
|
10538
|
+
if (this.withFileTypes = !!e.withFileTypes, this.signal = e.signal, this.follow = !!e.follow, this.dot = !!e.dot, this.dotRelative = !!e.dotRelative, this.nodir = !!e.nodir, this.mark = !!e.mark, e.cwd ? (e.cwd instanceof URL || e.cwd.startsWith("file://")) && (e.cwd = fileURLToPath(e.cwd)) : this.cwd = "", this.cwd = e.cwd || "", this.root = e.root, this.magicalBraces = !!e.magicalBraces, this.nobrace = !!e.nobrace, this.noext = !!e.noext, this.realpath = !!e.realpath, this.absolute = e.absolute, this.includeChildMatches = e.includeChildMatches !== !1, this.noglobstar = !!e.noglobstar, this.matchBase = !!e.matchBase, this.maxDepth = typeof e.maxDepth == "number" ? e.maxDepth : Infinity, this.stat = !!e.stat, this.ignore = e.ignore, this.withFileTypes && this.absolute !== void 0) throw new Error("cannot set absolute and withFileTypes:true");
|
|
10539
|
+
if (typeof t == "string" && (t = [t]), this.windowsPathsNoEscape = !!e.windowsPathsNoEscape || e.allowWindowsEscape === !1, this.windowsPathsNoEscape && (t = t.map((a) => a.replace(/\\/g, "/"))), this.matchBase) {
|
|
10540
|
+
if (e.noglobstar) throw new TypeError("base matching requires globstar");
|
|
10541
|
+
t = t.map((a) => a.includes("/") ? a : `./**/${a}`);
|
|
10542
|
+
}
|
|
10543
|
+
if (this.pattern = t, this.platform = e.platform || Pi, this.opts = {
|
|
10544
|
+
...e,
|
|
10545
|
+
platform: this.platform
|
|
10546
|
+
}, e.scurry) {
|
|
10547
|
+
if (this.scurry = e.scurry, e.nocase !== void 0 && e.nocase !== e.scurry.nocase) throw new Error("nocase option contradicts provided scurry option");
|
|
10548
|
+
} else this.scurry = new (e.platform === "win32" ? it : e.platform === "darwin" ? St : e.platform ? rt : Xe)(this.cwd, {
|
|
10549
|
+
nocase: e.nocase,
|
|
10550
|
+
fs: e.fs
|
|
10551
|
+
});
|
|
10552
|
+
this.nocase = this.scurry.nocase;
|
|
10553
|
+
let s = this.platform === "darwin" || this.platform === "win32", i = {
|
|
10554
|
+
braceExpandMax: 1e4,
|
|
10555
|
+
...e,
|
|
10556
|
+
dot: this.dot,
|
|
10557
|
+
matchBase: this.matchBase,
|
|
10558
|
+
nobrace: this.nobrace,
|
|
10559
|
+
nocase: this.nocase,
|
|
10560
|
+
nocaseMagicOnly: s,
|
|
10561
|
+
nocomment: !0,
|
|
10562
|
+
noext: this.noext,
|
|
10563
|
+
nonegate: !0,
|
|
10564
|
+
optimizationLevel: 2,
|
|
10565
|
+
platform: this.platform,
|
|
10566
|
+
windowsPathsNoEscape: this.windowsPathsNoEscape,
|
|
10567
|
+
debug: !!this.opts.debug
|
|
10568
|
+
}, [o, h] = this.pattern.map((a) => new D(a, i)).reduce((a, l) => (a[0].push(...l.set), a[1].push(...l.globParts), a), [[], []]);
|
|
10569
|
+
this.patterns = o.map((a, l) => {
|
|
10570
|
+
let u = h[l];
|
|
10571
|
+
if (!u) throw new Error("invalid pattern object");
|
|
10572
|
+
return new nt(a, u, 0, this.platform);
|
|
10573
|
+
});
|
|
10574
|
+
}
|
|
10575
|
+
async walk() {
|
|
10576
|
+
return [...await new xt(this.patterns, this.scurry.cwd, {
|
|
10577
|
+
...this.opts,
|
|
10578
|
+
maxDepth: this.maxDepth !== Infinity ? this.maxDepth + this.scurry.cwd.depth() : Infinity,
|
|
10579
|
+
platform: this.platform,
|
|
10580
|
+
nocase: this.nocase,
|
|
10581
|
+
includeChildMatches: this.includeChildMatches
|
|
10582
|
+
}).walk()];
|
|
10583
|
+
}
|
|
10584
|
+
walkSync() {
|
|
10585
|
+
return [...new xt(this.patterns, this.scurry.cwd, {
|
|
10586
|
+
...this.opts,
|
|
10587
|
+
maxDepth: this.maxDepth !== Infinity ? this.maxDepth + this.scurry.cwd.depth() : Infinity,
|
|
10588
|
+
platform: this.platform,
|
|
10589
|
+
nocase: this.nocase,
|
|
10590
|
+
includeChildMatches: this.includeChildMatches
|
|
10591
|
+
}).walkSync()];
|
|
10592
|
+
}
|
|
10593
|
+
stream() {
|
|
10594
|
+
return new vt(this.patterns, this.scurry.cwd, {
|
|
10595
|
+
...this.opts,
|
|
10596
|
+
maxDepth: this.maxDepth !== Infinity ? this.maxDepth + this.scurry.cwd.depth() : Infinity,
|
|
10597
|
+
platform: this.platform,
|
|
10598
|
+
nocase: this.nocase,
|
|
10599
|
+
includeChildMatches: this.includeChildMatches
|
|
10600
|
+
}).stream();
|
|
10601
|
+
}
|
|
10602
|
+
streamSync() {
|
|
10603
|
+
return new vt(this.patterns, this.scurry.cwd, {
|
|
10604
|
+
...this.opts,
|
|
10605
|
+
maxDepth: this.maxDepth !== Infinity ? this.maxDepth + this.scurry.cwd.depth() : Infinity,
|
|
10606
|
+
platform: this.platform,
|
|
10607
|
+
nocase: this.nocase,
|
|
10608
|
+
includeChildMatches: this.includeChildMatches
|
|
10609
|
+
}).streamSync();
|
|
10610
|
+
}
|
|
10611
|
+
iterateSync() {
|
|
10612
|
+
return this.streamSync()[Symbol.iterator]();
|
|
10613
|
+
}
|
|
10614
|
+
[Symbol.iterator]() {
|
|
10615
|
+
return this.iterateSync();
|
|
10616
|
+
}
|
|
10617
|
+
iterate() {
|
|
10618
|
+
return this.stream()[Symbol.asyncIterator]();
|
|
10619
|
+
}
|
|
10620
|
+
[Symbol.asyncIterator]() {
|
|
10621
|
+
return this.iterate();
|
|
10622
|
+
}
|
|
10623
|
+
};
|
|
10624
|
+
var le = (n, t = {}) => {
|
|
10625
|
+
Array.isArray(n) || (n = [n]);
|
|
10626
|
+
for (let e of n) if (new D(e, t).hasMagic()) return !0;
|
|
10627
|
+
return !1;
|
|
10628
|
+
};
|
|
10629
|
+
function Bt(n, t = {}) {
|
|
10630
|
+
return new I(n, t).streamSync();
|
|
10631
|
+
}
|
|
10632
|
+
function Qe(n, t = {}) {
|
|
10633
|
+
return new I(n, t).stream();
|
|
10634
|
+
}
|
|
10635
|
+
function ts(n, t = {}) {
|
|
10636
|
+
return new I(n, t).walkSync();
|
|
10637
|
+
}
|
|
10638
|
+
async function Je(n, t = {}) {
|
|
10639
|
+
return new I(n, t).walk();
|
|
10640
|
+
}
|
|
10641
|
+
function Ut(n, t = {}) {
|
|
10642
|
+
return new I(n, t).iterateSync();
|
|
10643
|
+
}
|
|
10644
|
+
function es(n, t = {}) {
|
|
10645
|
+
return new I(n, t).iterate();
|
|
10646
|
+
}
|
|
10647
|
+
var ji = Bt, Ii = Object.assign(Qe, { sync: Bt }), zi = Ut, Bi = Object.assign(es, { sync: Ut }), Ui = Object.assign(ts, {
|
|
10648
|
+
stream: Bt,
|
|
10649
|
+
iterate: Ut
|
|
10650
|
+
}), Ze = Object.assign(Je, {
|
|
10651
|
+
glob: Je,
|
|
10652
|
+
globSync: ts,
|
|
10653
|
+
sync: Ui,
|
|
10654
|
+
globStream: Qe,
|
|
10655
|
+
stream: Ii,
|
|
10656
|
+
globStreamSync: Bt,
|
|
10657
|
+
streamSync: ji,
|
|
10658
|
+
globIterate: es,
|
|
10659
|
+
iterate: Bi,
|
|
10660
|
+
globIterateSync: Ut,
|
|
10661
|
+
iterateSync: zi,
|
|
10662
|
+
Glob: I,
|
|
10663
|
+
hasMagic: le,
|
|
10664
|
+
escape: tt,
|
|
10665
|
+
unescape: W
|
|
10666
|
+
});
|
|
10667
|
+
Ze.glob = Ze;
|
|
10668
|
+
//#endregion
|
|
10669
|
+
//#region ../core/src/worktree/glob-resolver.ts
|
|
10670
|
+
var GlobResolutionError = class extends Error {
|
|
10671
|
+
pattern;
|
|
10672
|
+
constructor(pattern, message) {
|
|
10673
|
+
super(`Failed to resolve pattern '${pattern}': ${message}`);
|
|
10674
|
+
this.name = "GlobResolutionError";
|
|
10675
|
+
this.pattern = pattern;
|
|
10676
|
+
}
|
|
10677
|
+
};
|
|
10678
|
+
function normalizePatternPath(filePath) {
|
|
10679
|
+
return filePath.replace(/\\/g, "/");
|
|
10680
|
+
}
|
|
10681
|
+
/**
|
|
10682
|
+
* Resolve glob patterns to actual file paths
|
|
10683
|
+
*
|
|
10684
|
+
* @param gitRoot - The git repository root directory
|
|
10685
|
+
* @param patterns - Array of file paths or glob patterns
|
|
10686
|
+
* @returns Result containing resolved files and pattern details, or error
|
|
10687
|
+
*/
|
|
10688
|
+
async function resolveGlobPatterns(gitRoot, patterns) {
|
|
10689
|
+
const allFiles = /* @__PURE__ */ new Set();
|
|
10690
|
+
const resolutionDetails = [];
|
|
10691
|
+
for (const pattern of patterns) {
|
|
10692
|
+
const normalizedPattern = normalizePatternPath(pattern);
|
|
10693
|
+
try {
|
|
10694
|
+
const resolvedFiles = le(normalizedPattern, { magicalBraces: true }) ? await Ze(normalizedPattern, {
|
|
10695
|
+
cwd: gitRoot,
|
|
10696
|
+
dot: true,
|
|
10697
|
+
ignore: ".git/**",
|
|
10698
|
+
nodir: true,
|
|
10699
|
+
posix: true
|
|
10700
|
+
}) : [normalizedPattern];
|
|
10701
|
+
for (const file of resolvedFiles) allFiles.add(file);
|
|
10702
|
+
resolutionDetails.push({
|
|
10703
|
+
pattern,
|
|
10704
|
+
resolvedFiles
|
|
10705
|
+
});
|
|
10706
|
+
} catch (error) {
|
|
10707
|
+
return err(new GlobResolutionError(pattern, error instanceof Error ? error.message : String(error)));
|
|
10708
|
+
}
|
|
10709
|
+
}
|
|
10710
|
+
return ok({
|
|
10711
|
+
resolvedFiles: Array.from(allFiles),
|
|
10712
|
+
patterns: resolutionDetails
|
|
10713
|
+
});
|
|
10714
|
+
}
|
|
10715
|
+
//#endregion
|
|
7548
10716
|
//#region ../core/src/worktree/file-copier.ts
|
|
7549
10717
|
var FileCopyError = class extends Error {
|
|
7550
10718
|
file;
|
|
@@ -7555,9 +10723,12 @@ var FileCopyError = class extends Error {
|
|
|
7555
10723
|
}
|
|
7556
10724
|
};
|
|
7557
10725
|
async function copyFiles(sourceDir, targetDir, files) {
|
|
10726
|
+
const resolveResult = await resolveGlobPatterns(sourceDir, files);
|
|
10727
|
+
if (isErr(resolveResult)) return resolveResult;
|
|
10728
|
+
const resolvedFiles = resolveResult.value.resolvedFiles;
|
|
7558
10729
|
const copiedFiles = [];
|
|
7559
10730
|
const skippedFiles = [];
|
|
7560
|
-
for (const file of
|
|
10731
|
+
for (const file of resolvedFiles) {
|
|
7561
10732
|
const sourcePath = path.join(sourceDir, file);
|
|
7562
10733
|
const targetPath = path.join(targetDir, file);
|
|
7563
10734
|
try {
|
|
@@ -24682,7 +27853,7 @@ var StdioServerTransport = class {
|
|
|
24682
27853
|
};
|
|
24683
27854
|
//#endregion
|
|
24684
27855
|
//#region ../mcp/package.json
|
|
24685
|
-
var version$1 = "6.3.0-
|
|
27856
|
+
var version$1 = "6.3.0-5";
|
|
24686
27857
|
const createWorktreeTool = {
|
|
24687
27858
|
name: "phantom_create_worktree",
|
|
24688
27859
|
description: "Create a new Git worktree (phantom)",
|
|
@@ -25281,7 +28452,7 @@ async function shellHandler(args) {
|
|
|
25281
28452
|
}
|
|
25282
28453
|
//#endregion
|
|
25283
28454
|
//#region package.json
|
|
25284
|
-
var version = "6.3.0-
|
|
28455
|
+
var version = "6.3.0-5";
|
|
25285
28456
|
//#endregion
|
|
25286
28457
|
//#region src/version.ts
|
|
25287
28458
|
function getVersion() {
|