diff --git a/lib/entry-points.js b/lib/entry-points.js index 11a8c4c291..667db35b42 100644 --- a/lib/entry-points.js +++ b/lib/entry-points.js @@ -102450,7124 +102450,3025 @@ var require_isPlainObject = __commonJS({ } }); -// node_modules/glob/node_modules/balanced-match/dist/commonjs/index.js -var require_commonjs18 = __commonJS({ - "node_modules/glob/node_modules/balanced-match/dist/commonjs/index.js"(exports2) { +// node_modules/glob/dist/commonjs/index.min.js +var require_index_min = __commonJS({ + "node_modules/glob/dist/commonjs/index.min.js"(exports2) { "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.range = exports2.balanced = void 0; - var balanced2 = (a, b, str) => { - const ma = a instanceof RegExp ? maybeMatch2(a, str) : a; - const mb = b instanceof RegExp ? maybeMatch2(b, str) : b; - const r = ma !== null && mb != null && (0, exports2.range)(ma, mb, str); - return r && { - start: r[0], - end: r[1], - pre: str.slice(0, r[0]), - body: str.slice(r[0] + ma.length, r[1]), - post: str.slice(r[1] + mb.length) - }; - }; - exports2.balanced = balanced2; - var maybeMatch2 = (reg, str) => { - const m = str.match(reg); - return m ? m[0] : null; - }; - var range2 = (a, b, str) => { - let begs, beg, left, right = void 0, result; - let ai = str.indexOf(a); - let bi = str.indexOf(b, ai + 1); - let i = ai; - if (ai >= 0 && bi > 0) { - if (a === b) { - return [ai, bi]; + var R = (n, t) => () => (t || n((t = { exports: {} }).exports, t), t.exports); + var Ge = R((Y) => { + "use strict"; + Object.defineProperty(Y, "__esModule", { value: true }); + Y.range = Y.balanced = void 0; + var Gs = (n, t, e) => { + let s = n instanceof RegExp ? Ie(n, e) : n, i = t instanceof RegExp ? Ie(t, e) : t, r = s !== null && i != null && (0, Y.range)(s, i, e); + return r && { start: r[0], end: r[1], pre: e.slice(0, r[0]), body: e.slice(r[0] + s.length, r[1]), post: e.slice(r[1] + i.length) }; + }; + Y.balanced = Gs; + var Ie = (n, t) => { + let e = t.match(n); + return e ? e[0] : null; + }, zs = (n, t, e) => { + let s, i, r, h, o, a = e.indexOf(n), l = e.indexOf(t, a + 1), f = a; + if (a >= 0 && l > 0) { + if (n === t) return [a, l]; + for (s = [], r = e.length; f >= 0 && !o; ) { + if (f === a) s.push(f), a = e.indexOf(n, f + 1); + else if (s.length === 1) { + let c = s.pop(); + c !== void 0 && (o = [c, l]); + } else i = s.pop(), i !== void 0 && i < r && (r = i, h = l), l = e.indexOf(t, f + 1); + f = a < l && a >= 0 ? a : l; + } + s.length && h !== void 0 && (o = [r, h]); + } + return o; + }; + Y.range = zs; + }); + var Ke = R((it) => { + "use strict"; + Object.defineProperty(it, "__esModule", { value: true }); + it.EXPANSION_MAX = void 0; + it.expand = ei; + var ze = Ge(), Ue = "\0SLASH" + Math.random() + "\0", $e = "\0OPEN" + Math.random() + "\0", ue = "\0CLOSE" + Math.random() + "\0", qe = "\0COMMA" + Math.random() + "\0", He = "\0PERIOD" + Math.random() + "\0", Us = new RegExp(Ue, "g"), $s = new RegExp($e, "g"), qs = new RegExp(ue, "g"), Hs = new RegExp(qe, "g"), Vs = new RegExp(He, "g"), Ks = /\\\\/g, Xs = /\\{/g, Ys = /\\}/g, Js = /\\,/g, Zs = /\\./g; + it.EXPANSION_MAX = 1e5; + function ce(n) { + return isNaN(n) ? n.charCodeAt(0) : parseInt(n, 10); + } + function Qs(n) { + return n.replace(Ks, Ue).replace(Xs, $e).replace(Ys, ue).replace(Js, qe).replace(Zs, He); + } + function ti(n) { + return n.replace(Us, "\\").replace($s, "{").replace(qs, "}").replace(Hs, ",").replace(Vs, "."); + } + function Ve(n) { + if (!n) return [""]; + let t = [], e = (0, ze.balanced)("{", "}", n); + if (!e) return n.split(","); + let { pre: s, body: i, post: r } = e, h = s.split(","); + h[h.length - 1] += "{" + i + "}"; + let o = Ve(r); + return r.length && (h[h.length - 1] += o.shift(), h.push.apply(h, o)), t.push.apply(t, h), t; + } + function ei(n, t = {}) { + if (!n) return []; + let { max: e = it.EXPANSION_MAX } = t; + return n.slice(0, 2) === "{}" && (n = "\\{\\}" + n.slice(2)), ht(Qs(n), e, true).map(ti); + } + function si(n) { + return "{" + n + "}"; + } + function ii(n) { + return /^-?0\d/.test(n); + } + function ri(n, t) { + return n <= t; + } + function ni(n, t) { + return n >= t; + } + function ht(n, t, e) { + let s = [], i = (0, ze.balanced)("{", "}", n); + if (!i) return [n]; + let r = i.pre, h = i.post.length ? ht(i.post, t, false) : [""]; + if (/\$$/.test(i.pre)) for (let o = 0; o < h.length && o < t; o++) { + let a = r + "{" + i.body + "}" + h[o]; + s.push(a); } - begs = []; - left = str.length; - while (i >= 0 && !result) { - if (i === ai) { - begs.push(i); - ai = str.indexOf(a, i + 1); - } else if (begs.length === 1) { - const r = begs.pop(); - if (r !== void 0) - result = [r, bi]; + else { + let o = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body), a = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body), l = o || a, f = i.body.indexOf(",") >= 0; + if (!l && !f) return i.post.match(/,(?!,).*\}/) ? (n = i.pre + "{" + i.body + ue + i.post, ht(n, t, true)) : [n]; + let c; + if (l) c = i.body.split(/\.\./); + else if (c = Ve(i.body), c.length === 1 && c[0] !== void 0 && (c = ht(c[0], t, false).map(si), c.length === 1)) return h.map((u) => i.pre + c[0] + u); + let d; + if (l && c[0] !== void 0 && c[1] !== void 0) { + let u = ce(c[0]), m = ce(c[1]), p = Math.max(c[0].length, c[1].length), b = c.length === 3 && c[2] !== void 0 ? Math.abs(ce(c[2])) : 1, w = ri; + m < u && (b *= -1, w = ni); + let E = c.some(ii); + d = []; + for (let y = u; w(y, m); y += b) { + let S; + if (a) S = String.fromCharCode(y), S === "\\" && (S = ""); + else if (S = String(y), E) { + let B = p - S.length; + if (B > 0) { + let U = new Array(B + 1).join("0"); + y < 0 ? S = "-" + U + S.slice(1) : S = U + S; + } + } + d.push(S); + } } else { - beg = begs.pop(); - if (beg !== void 0 && beg < left) { - left = beg; - right = bi; + d = []; + for (let u = 0; u < c.length; u++) d.push.apply(d, ht(c[u], t, false)); + } + for (let u = 0; u < d.length; u++) for (let m = 0; m < h.length && s.length < t; m++) { + let p = r + d[u] + h[m]; + (!e || l || p) && s.push(p); + } + } + return s; + } + }); + var Xe = R((Ct) => { + "use strict"; + Object.defineProperty(Ct, "__esModule", { value: true }); + Ct.assertValidPattern = void 0; + var hi = 1024 * 64, oi = (n) => { + if (typeof n != "string") throw new TypeError("invalid pattern"); + if (n.length > hi) throw new TypeError("pattern is too long"); + }; + Ct.assertValidPattern = oi; + }); + var Je = R((Rt) => { + "use strict"; + Object.defineProperty(Rt, "__esModule", { value: true }); + Rt.parseClass = void 0; + var ai = { "[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", true], "[:alpha:]": ["\\p{L}\\p{Nl}", true], "[:ascii:]": ["\\x00-\\x7f", false], "[:blank:]": ["\\p{Zs}\\t", true], "[:cntrl:]": ["\\p{Cc}", true], "[:digit:]": ["\\p{Nd}", true], "[:graph:]": ["\\p{Z}\\p{C}", true, true], "[:lower:]": ["\\p{Ll}", true], "[:print:]": ["\\p{C}", true], "[:punct:]": ["\\p{P}", true], "[:space:]": ["\\p{Z}\\t\\r\\n\\v\\f", true], "[:upper:]": ["\\p{Lu}", true], "[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}", true], "[:xdigit:]": ["A-Fa-f0-9", false] }, ot = (n) => n.replace(/[[\]\\-]/g, "\\$&"), li = (n) => n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), Ye = (n) => n.join(""), ci = (n, t) => { + let e = t; + if (n.charAt(e) !== "[") throw new Error("not in a brace expression"); + let s = [], i = [], r = e + 1, h = false, o = false, a = false, l = false, f = e, c = ""; + t: for (; r < n.length; ) { + let p = n.charAt(r); + if ((p === "!" || p === "^") && r === e + 1) { + l = true, r++; + continue; + } + if (p === "]" && h && !a) { + f = r + 1; + break; + } + if (h = true, p === "\\" && !a) { + a = true, r++; + continue; + } + if (p === "[" && !a) { + for (let [b, [w, v, E]] of Object.entries(ai)) if (n.startsWith(b, r)) { + if (c) return ["$.", false, n.length - e, true]; + r += b.length, E ? i.push(w) : s.push(w), o = o || v; + continue t; } - bi = str.indexOf(b, i + 1); } - i = ai < bi && ai >= 0 ? ai : bi; + if (a = false, c) { + p > c ? s.push(ot(c) + "-" + ot(p)) : p === c && s.push(ot(p)), c = "", r++; + continue; + } + if (n.startsWith("-]", r + 1)) { + s.push(ot(p + "-")), r += 2; + continue; + } + if (n.startsWith("-", r + 1)) { + c = p, r += 2; + continue; + } + s.push(ot(p)), r++; } - if (begs.length && right !== void 0) { - result = [left, right]; + if (f < r) return ["", false, 0, false]; + if (!s.length && !i.length) return ["$.", false, n.length - e, true]; + if (i.length === 0 && s.length === 1 && /^\\?.$/.test(s[0]) && !l) { + let p = s[0].length === 2 ? s[0].slice(-1) : s[0]; + return [li(p), false, f - e, false]; } - } - return result; - }; - exports2.range = range2; - } -}); - -// node_modules/glob/node_modules/brace-expansion/dist/commonjs/index.js -var require_commonjs19 = __commonJS({ - "node_modules/glob/node_modules/brace-expansion/dist/commonjs/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.EXPANSION_MAX = void 0; - exports2.expand = expand3; - var balanced_match_1 = require_commonjs18(); - var escSlash2 = "\0SLASH" + Math.random() + "\0"; - var escOpen2 = "\0OPEN" + Math.random() + "\0"; - var escClose2 = "\0CLOSE" + Math.random() + "\0"; - var escComma2 = "\0COMMA" + Math.random() + "\0"; - var escPeriod2 = "\0PERIOD" + Math.random() + "\0"; - var escSlashPattern2 = new RegExp(escSlash2, "g"); - var escOpenPattern2 = new RegExp(escOpen2, "g"); - var escClosePattern2 = new RegExp(escClose2, "g"); - var escCommaPattern2 = new RegExp(escComma2, "g"); - var escPeriodPattern2 = new RegExp(escPeriod2, "g"); - var slashPattern2 = /\\\\/g; - var openPattern2 = /\\{/g; - var closePattern2 = /\\}/g; - var commaPattern2 = /\\,/g; - var periodPattern2 = /\\\./g; - exports2.EXPANSION_MAX = 1e5; - function numeric2(str) { - return !isNaN(str) ? parseInt(str, 10) : str.charCodeAt(0); - } - function escapeBraces2(str) { - return str.replace(slashPattern2, escSlash2).replace(openPattern2, escOpen2).replace(closePattern2, escClose2).replace(commaPattern2, escComma2).replace(periodPattern2, escPeriod2); - } - function unescapeBraces2(str) { - return str.replace(escSlashPattern2, "\\").replace(escOpenPattern2, "{").replace(escClosePattern2, "}").replace(escCommaPattern2, ",").replace(escPeriodPattern2, "."); - } - function parseCommaParts2(str) { - if (!str) { - return [""]; - } - const parts = []; - const m = (0, balanced_match_1.balanced)("{", "}", str); - if (!m) { - return str.split(","); - } - const { pre, body, post } = m; - const p = pre.split(","); - p[p.length - 1] += "{" + body + "}"; - const postParts = parseCommaParts2(post); - if (post.length) { - ; - p[p.length - 1] += postParts.shift(); - p.push.apply(p, postParts); - } - parts.push.apply(parts, p); - return parts; - } - function expand3(str, options = {}) { - if (!str) { - return []; - } - const { max = exports2.EXPANSION_MAX } = options; - if (str.slice(0, 2) === "{}") { - str = "\\{\\}" + str.slice(2); - } - return expand_2(escapeBraces2(str), max, true).map(unescapeBraces2); - } - function embrace2(str) { - return "{" + str + "}"; - } - function isPadded2(el) { - return /^-?0\d/.test(el); - } - function lte2(i, y) { - return i <= y; - } - function gte7(i, y) { - return i >= y; - } - function expand_2(str, max, isTop) { - const expansions = []; - const m = (0, balanced_match_1.balanced)("{", "}", str); - if (!m) - return [str]; - const pre = m.pre; - const post = m.post.length ? expand_2(m.post, max, false) : [""]; - if (/\$$/.test(m.pre)) { - for (let k = 0; k < post.length && k < max; k++) { - const expansion = pre + "{" + m.body + "}" + post[k]; - expansions.push(expansion); + let d = "[" + (l ? "^" : "") + Ye(s) + "]", u = "[" + (l ? "" : "^") + Ye(i) + "]"; + return [s.length && i.length ? "(" + d + "|" + u + ")" : s.length ? d : u, o, f - e, true]; + }; + Rt.parseClass = ci; + }); + var kt = R((At) => { + "use strict"; + Object.defineProperty(At, "__esModule", { value: true }); + At.unescape = void 0; + var ui = (n, { windowsPathsNoEscape: t = false, magicalBraces: e = true } = {}) => 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"); + At.unescape = ui; + }); + var pe = R((Dt) => { + "use strict"; + Object.defineProperty(Dt, "__esModule", { value: true }); + Dt.AST = void 0; + var fi = Je(), Mt = kt(), di = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]), Ze = (n) => di.has(n), pi = "(?!(?:^|/)\\.\\.?(?:$|/))", Pt = "(?!\\.)", mi = /* @__PURE__ */ new Set(["[", "."]), gi = /* @__PURE__ */ new Set(["..", "."]), wi = new Set("().*{}+?[]^$\\!"), bi = (n) => n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), de = "[^/]", Qe = de + "*?", ts = de + "+?", fe = class n { + type; + #t; + #s; + #n = false; + #r = []; + #h; + #S; + #w; + #c = false; + #o; + #f; + #u = false; + constructor(t, e, s = {}) { + this.type = t, t && (this.#s = true), this.#h = e, this.#t = this.#h ? this.#h.#t : this, this.#o = this.#t === this ? s : this.#t.#o, this.#w = this.#t === this ? [] : this.#t.#w, t === "!" && !this.#t.#c && this.#w.push(this), this.#S = this.#h ? this.#h.#r.length : 0; + } + get hasMagic() { + if (this.#s !== void 0) return this.#s; + for (let t of this.#r) if (typeof t != "string" && (t.type || t.hasMagic)) return this.#s = true; + return this.#s; } - } else { - const isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body); - const isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body); - const isSequence = isNumericSequence || isAlphaSequence; - const isOptions = m.body.indexOf(",") >= 0; - if (!isSequence && !isOptions) { - if (m.post.match(/,(?!,).*\}/)) { - str = m.pre + "{" + m.body + escClose2 + m.post; - return expand_2(str, max, true); - } - return [str]; + toString() { + return this.#f !== void 0 ? this.#f : this.type ? this.#f = this.type + "(" + this.#r.map((t) => String(t)).join("|") + ")" : this.#f = this.#r.map((t) => String(t)).join(""); } - let n; - if (isSequence) { - n = m.body.split(/\.\./); - } else { - n = parseCommaParts2(m.body); - if (n.length === 1 && n[0] !== void 0) { - n = expand_2(n[0], max, false).map(embrace2); - if (n.length === 1) { - return post.map((p) => m.pre + n[0] + p); + #a() { + if (this !== this.#t) throw new Error("should only call on root"); + if (this.#c) return this; + this.toString(), this.#c = true; + let t; + for (; t = this.#w.pop(); ) { + if (t.type !== "!") continue; + let e = t, s = e.#h; + for (; s; ) { + for (let i = e.#S + 1; !s.type && i < s.#r.length; i++) for (let r of t.#r) { + if (typeof r == "string") throw new Error("string part in extglob AST??"); + r.copyIn(s.#r[i]); + } + e = s, s = e.#h; } } + return this; } - let N; - if (isSequence && n[0] !== void 0 && n[1] !== void 0) { - const x = numeric2(n[0]); - const y = numeric2(n[1]); - const width = Math.max(n[0].length, n[1].length); - let incr = n.length === 3 && n[2] !== void 0 ? Math.max(Math.abs(numeric2(n[2])), 1) : 1; - let test = lte2; - const reverse = y < x; - if (reverse) { - incr *= -1; - test = gte7; + push(...t) { + for (let e of t) if (e !== "") { + if (typeof e != "string" && !(e instanceof n && e.#h === this)) throw new Error("invalid part: " + e); + this.#r.push(e); } - const pad = n.some(isPadded2); - N = []; - for (let i = x; test(i, y) && N.length < max; i += incr) { - let c; - if (isAlphaSequence) { - c = String.fromCharCode(i); - if (c === "\\") { - c = ""; + } + toJSON() { + let t = this.type === null ? this.#r.slice().map((e) => typeof e == "string" ? e : e.toJSON()) : [this.type, ...this.#r.map((e) => e.toJSON())]; + return this.isStart() && !this.type && t.unshift([]), this.isEnd() && (this === this.#t || this.#t.#c && this.#h?.type === "!") && t.push({}), t; + } + isStart() { + if (this.#t === this) return true; + if (!this.#h?.isStart()) return false; + if (this.#S === 0) return true; + let t = this.#h; + for (let e = 0; e < this.#S; e++) { + let s = t.#r[e]; + if (!(s instanceof n && s.type === "!")) return false; + } + return true; + } + isEnd() { + if (this.#t === this || this.#h?.type === "!") return true; + if (!this.#h?.isEnd()) return false; + if (!this.type) return this.#h?.isEnd(); + let t = this.#h ? this.#h.#r.length : 0; + return this.#S === t - 1; + } + copyIn(t) { + typeof t == "string" ? this.push(t) : this.push(t.clone(this)); + } + clone(t) { + let e = new n(this.type, t); + for (let s of this.#r) e.copyIn(s); + return e; + } + static #i(t, e, s, i) { + let r = false, h = false, o = -1, a = false; + if (e.type === null) { + let u = s, m = ""; + for (; u < t.length; ) { + let p = t.charAt(u++); + if (r || p === "\\") { + r = !r, m += p; + continue; } - } else { - c = String(i); - if (pad) { - const need = width - c.length; - if (need > 0) { - const z = new Array(need + 1).join("0"); - if (i < 0) { - c = "-" + z + c.slice(1); - } else { - c = z + c; - } - } + if (h) { + u === o + 1 ? (p === "^" || p === "!") && (a = true) : p === "]" && !(u === o + 2 && a) && (h = false), m += p; + continue; + } else if (p === "[") { + h = true, o = u, a = false, m += p; + continue; + } + if (!i.noext && Ze(p) && t.charAt(u) === "(") { + e.push(m), m = ""; + let b = new n(p, e); + u = n.#i(t, b, u, i), e.push(b); + continue; } + m += p; } - N.push(c); - } - } else { - N = []; - for (let j = 0; j < n.length; j++) { - N.push.apply(N, expand_2(n[j], max, false)); + return e.push(m), u; } - } - for (let j = 0; j < N.length; j++) { - for (let k = 0; k < post.length && expansions.length < max; k++) { - const expansion = pre + N[j] + post[k]; - if (!isTop || isSequence || expansion) { - expansions.push(expansion); + let l = s + 1, f = new n(null, e), c = [], d = ""; + for (; l < t.length; ) { + let u = t.charAt(l++); + if (r || u === "\\") { + r = !r, d += u; + continue; } + if (h) { + l === o + 1 ? (u === "^" || u === "!") && (a = true) : u === "]" && !(l === o + 2 && a) && (h = false), d += u; + continue; + } else if (u === "[") { + h = true, o = l, a = false, d += u; + continue; + } + if (Ze(u) && t.charAt(l) === "(") { + f.push(d), d = ""; + let m = new n(u, f); + f.push(m), l = n.#i(t, m, l, i); + continue; + } + if (u === "|") { + f.push(d), d = "", c.push(f), f = new n(null, e); + continue; + } + if (u === ")") return d === "" && e.#r.length === 0 && (e.#u = true), f.push(d), d = "", e.push(...c, f), l; + d += u; + } + return e.type = null, e.#s = void 0, e.#r = [t.substring(s - 1)], l; + } + static fromGlob(t, e = {}) { + let s = new n(null, void 0, e); + return n.#i(t, s, 0, e), s; + } + toMMPattern() { + if (this !== this.#t) return this.#t.toMMPattern(); + let t = this.toString(), [e, s, i, r] = this.toRegExpSource(); + if (!(i || this.#s || this.#o.nocase && !this.#o.nocaseMagicOnly && t.toUpperCase() !== t.toLowerCase())) return s; + let o = (this.#o.nocase ? "i" : "") + (r ? "u" : ""); + return Object.assign(new RegExp(`^${e}$`, o), { _src: e, _glob: t }); + } + get options() { + return this.#o; + } + toRegExpSource(t) { + let e = t ?? !!this.#o.dot; + if (this.#t === this && this.#a(), !this.type) { + let a = this.isStart() && this.isEnd() && !this.#r.some((u) => typeof u != "string"), l = this.#r.map((u) => { + let [m, p, b, w] = typeof u == "string" ? n.#v(u, this.#s, a) : u.toRegExpSource(t); + return this.#s = this.#s || b, this.#n = this.#n || w, m; + }).join(""), f = ""; + if (this.isStart() && typeof this.#r[0] == "string" && !(this.#r.length === 1 && gi.has(this.#r[0]))) { + let m = mi, p = e && m.has(l.charAt(0)) || l.startsWith("\\.") && m.has(l.charAt(2)) || l.startsWith("\\.\\.") && m.has(l.charAt(4)), b = !e && !t && m.has(l.charAt(0)); + f = p ? pi : b ? Pt : ""; + } + let c = ""; + return this.isEnd() && this.#t.#c && this.#h?.type === "!" && (c = "(?:$|\\/)"), [f + l + c, (0, Mt.unescape)(l), this.#s = !!this.#s, this.#n]; + } + let s = this.type === "*" || this.type === "+", i = this.type === "!" ? "(?:(?!(?:" : "(?:", r = this.#d(e); + if (this.isStart() && this.isEnd() && !r && this.type !== "!") { + let a = this.toString(); + return this.#r = [a], this.type = null, this.#s = void 0, [a, (0, Mt.unescape)(this.toString()), false, false]; + } + let h = !s || t || e || !Pt ? "" : this.#d(true); + h === r && (h = ""), h && (r = `(?:${r})(?:${h})*?`); + let o = ""; + if (this.type === "!" && this.#u) o = (this.isStart() && !e ? Pt : "") + ts; + else { + let a = this.type === "!" ? "))" + (this.isStart() && !e && !t ? Pt : "") + Qe + ")" : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && h ? ")" : this.type === "*" && h ? ")?" : `)${this.type}`; + o = i + r + a; + } + return [o, (0, Mt.unescape)(r), this.#s = !!this.#s, this.#n]; + } + #d(t) { + return this.#r.map((e) => { + if (typeof e == "string") throw new Error("string type in extglob ast??"); + let [s, i, r, h] = e.toRegExpSource(t); + return this.#n = this.#n || h, s; + }).filter((e) => !(this.isStart() && this.isEnd()) || !!e).join("|"); + } + static #v(t, e, s = false) { + let i = false, r = "", h = false, o = false; + for (let a = 0; a < t.length; a++) { + let l = t.charAt(a); + if (i) { + i = false, r += (wi.has(l) ? "\\" : "") + l; + continue; + } + if (l === "*") { + if (o) continue; + o = true, r += s && /^[*]+$/.test(t) ? ts : Qe, e = true; + continue; + } else o = false; + if (l === "\\") { + a === t.length - 1 ? r += "\\\\" : i = true; + continue; + } + if (l === "[") { + let [f, c, d, u] = (0, fi.parseClass)(t, a); + if (d) { + r += f, h = h || c, a += d - 1, e = e || u; + continue; + } + } + if (l === "?") { + r += de, e = true; + continue; + } + r += bi(l); } + return [r, (0, Mt.unescape)(t), !!e, h]; } - } - return expansions; - } - } -}); - -// node_modules/glob/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js -var require_assert_valid_pattern = __commonJS({ - "node_modules/glob/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.assertValidPattern = void 0; - var MAX_PATTERN_LENGTH2 = 1024 * 64; - var assertValidPattern2 = (pattern) => { - if (typeof pattern !== "string") { - throw new TypeError("invalid pattern"); - } - if (pattern.length > MAX_PATTERN_LENGTH2) { - throw new TypeError("pattern is too long"); - } - }; - exports2.assertValidPattern = assertValidPattern2; - } -}); - -// node_modules/glob/node_modules/minimatch/dist/commonjs/brace-expressions.js -var require_brace_expressions = __commonJS({ - "node_modules/glob/node_modules/minimatch/dist/commonjs/brace-expressions.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.parseClass = void 0; - var posixClasses2 = { - "[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", true], - "[:alpha:]": ["\\p{L}\\p{Nl}", true], - "[:ascii:]": ["\\x00-\\x7f", false], - "[:blank:]": ["\\p{Zs}\\t", true], - "[:cntrl:]": ["\\p{Cc}", true], - "[:digit:]": ["\\p{Nd}", true], - "[:graph:]": ["\\p{Z}\\p{C}", true, true], - "[:lower:]": ["\\p{Ll}", true], - "[:print:]": ["\\p{C}", true], - "[:punct:]": ["\\p{P}", true], - "[:space:]": ["\\p{Z}\\t\\r\\n\\v\\f", true], - "[:upper:]": ["\\p{Lu}", true], - "[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}", true], - "[:xdigit:]": ["A-Fa-f0-9", false] - }; - var braceEscape2 = (s) => s.replace(/[[\]\\-]/g, "\\$&"); - var regexpEscape2 = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); - var rangesToString2 = (ranges) => ranges.join(""); - var parseClass2 = (glob2, position) => { - const pos = position; - if (glob2.charAt(pos) !== "[") { - throw new Error("not in a brace expression"); - } - const ranges = []; - const negs = []; - let i = pos + 1; - let sawStart = false; - let uflag = false; - let escaping = false; - let negate2 = false; - let endPos = pos; - let rangeStart = ""; - WHILE: while (i < glob2.length) { - const c = glob2.charAt(i); - if ((c === "!" || c === "^") && i === pos + 1) { - negate2 = true; - i++; - continue; + }; + Dt.AST = fe; + }); + var me = R((Ft) => { + "use strict"; + Object.defineProperty(Ft, "__esModule", { value: true }); + Ft.escape = void 0; + var yi = (n, { windowsPathsNoEscape: t = false, magicalBraces: e = false } = {}) => e ? t ? n.replace(/[?*()[\]{}]/g, "[$&]") : n.replace(/[?*()[\]\\{}]/g, "\\$&") : t ? n.replace(/[?*()[\]]/g, "[$&]") : n.replace(/[?*()[\]\\]/g, "\\$&"); + Ft.escape = yi; + }); + var H = R((g) => { + "use strict"; + Object.defineProperty(g, "__esModule", { value: true }); + g.unescape = g.escape = g.AST = g.Minimatch = g.match = g.makeRe = g.braceExpand = g.defaults = g.filter = g.GLOBSTAR = g.sep = g.minimatch = void 0; + var Si = Ke(), jt = Xe(), is = pe(), vi = me(), Ei = kt(), _i = (n, t, e = {}) => ((0, jt.assertValidPattern)(t), !e.nocomment && t.charAt(0) === "#" ? false : new J(t, e).match(n)); + g.minimatch = _i; + var Oi = /^\*+([^+@!?\*\[\(]*)$/, xi = (n) => (t) => !t.startsWith(".") && t.endsWith(n), Ti = (n) => (t) => t.endsWith(n), Ci = (n) => (n = n.toLowerCase(), (t) => !t.startsWith(".") && t.toLowerCase().endsWith(n)), Ri = (n) => (n = n.toLowerCase(), (t) => t.toLowerCase().endsWith(n)), Ai = /^\*+\.\*+$/, ki = (n) => !n.startsWith(".") && n.includes("."), Mi = (n) => n !== "." && n !== ".." && n.includes("."), Pi = /^\.\*+$/, Di = (n) => n !== "." && n !== ".." && n.startsWith("."), Fi = /^\*+$/, ji = (n) => n.length !== 0 && !n.startsWith("."), Ni = (n) => n.length !== 0 && n !== "." && n !== "..", Li = /^\?+([^+@!?\*\[\(]*)?$/, Wi = ([n, t = ""]) => { + let e = rs([n]); + return t ? (t = t.toLowerCase(), (s) => e(s) && s.toLowerCase().endsWith(t)) : e; + }, Bi = ([n, t = ""]) => { + let e = ns([n]); + return t ? (t = t.toLowerCase(), (s) => e(s) && s.toLowerCase().endsWith(t)) : e; + }, Ii = ([n, t = ""]) => { + let e = ns([n]); + return t ? (s) => e(s) && s.endsWith(t) : e; + }, Gi = ([n, t = ""]) => { + let e = rs([n]); + return t ? (s) => e(s) && s.endsWith(t) : e; + }, rs = ([n]) => { + let t = n.length; + return (e) => e.length === t && !e.startsWith("."); + }, ns = ([n]) => { + let t = n.length; + return (e) => e.length === t && e !== "." && e !== ".."; + }, hs = typeof process == "object" && process ? typeof process.env == "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix", es = { win32: { sep: "\\" }, posix: { sep: "/" } }; + g.sep = hs === "win32" ? es.win32.sep : es.posix.sep; + g.minimatch.sep = g.sep; + g.GLOBSTAR = /* @__PURE__ */ Symbol("globstar **"); + g.minimatch.GLOBSTAR = g.GLOBSTAR; + var zi = "[^/]", Ui = zi + "*?", $i = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?", qi = "(?:(?!(?:\\/|^)\\.).)*?", Hi = (n, t = {}) => (e) => (0, g.minimatch)(e, n, t); + g.filter = Hi; + g.minimatch.filter = g.filter; + var F = (n, t = {}) => Object.assign({}, n, t), Vi = (n) => { + if (!n || typeof n != "object" || !Object.keys(n).length) return g.minimatch; + let t = g.minimatch; + return Object.assign((s, i, r = {}) => t(s, i, F(n, r)), { Minimatch: class extends t.Minimatch { + constructor(i, r = {}) { + super(i, F(n, r)); + } + static defaults(i) { + return t.defaults(F(n, i)).Minimatch; + } + }, AST: class extends t.AST { + constructor(i, r, h = {}) { + super(i, r, F(n, h)); + } + static fromGlob(i, r = {}) { + return t.AST.fromGlob(i, F(n, r)); + } + }, unescape: (s, i = {}) => t.unescape(s, F(n, i)), escape: (s, i = {}) => t.escape(s, F(n, i)), filter: (s, i = {}) => t.filter(s, F(n, i)), defaults: (s) => t.defaults(F(n, s)), makeRe: (s, i = {}) => t.makeRe(s, F(n, i)), braceExpand: (s, i = {}) => t.braceExpand(s, F(n, i)), match: (s, i, r = {}) => t.match(s, i, F(n, r)), sep: t.sep, GLOBSTAR: g.GLOBSTAR }); + }; + g.defaults = Vi; + g.minimatch.defaults = g.defaults; + var Ki = (n, t = {}) => ((0, jt.assertValidPattern)(n), t.nobrace || !/\{(?:(?!\{).)*\}/.test(n) ? [n] : (0, Si.expand)(n, { max: t.braceExpandMax })); + g.braceExpand = Ki; + g.minimatch.braceExpand = g.braceExpand; + var Xi = (n, t = {}) => new J(n, t).makeRe(); + g.makeRe = Xi; + g.minimatch.makeRe = g.makeRe; + var Yi = (n, t, e = {}) => { + let s = new J(t, e); + return n = n.filter((i) => s.match(i)), s.options.nonull && !n.length && n.push(t), n; + }; + g.match = Yi; + g.minimatch.match = g.match; + var ss = /[?*]|[+@!]\(.*?\)|\[|\]/, Ji = (n) => n.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), J = class { + options; + set; + pattern; + windowsPathsNoEscape; + nonegate; + negate; + comment; + empty; + preserveMultipleSlashes; + partial; + globSet; + globParts; + nocase; + isWindows; + platform; + windowsNoMagicRoot; + regexp; + constructor(t, e = {}) { + (0, jt.assertValidPattern)(t), e = e || {}, this.options = e, this.pattern = t, this.platform = e.platform || hs, this.isWindows = this.platform === "win32"; + let s = "allowWindowsEscape"; + this.windowsPathsNoEscape = !!e.windowsPathsNoEscape || e[s] === false, this.windowsPathsNoEscape && (this.pattern = this.pattern.replace(/\\/g, "/")), this.preserveMultipleSlashes = !!e.preserveMultipleSlashes, this.regexp = null, this.negate = false, this.nonegate = !!e.nonegate, this.comment = false, this.empty = false, 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(); + } + hasMagic() { + if (this.options.magicalBraces && this.set.length > 1) return true; + for (let t of this.set) for (let e of t) if (typeof e != "string") return true; + return false; } - if (c === "]" && sawStart && !escaping) { - endPos = i + 1; - break; + debug(...t) { } - sawStart = true; - if (c === "\\") { - if (!escaping) { - escaping = true; - i++; - continue; + make() { + let t = this.pattern, e = this.options; + if (!e.nocomment && t.charAt(0) === "#") { + this.comment = true; + return; + } + if (!t) { + this.empty = true; + return; } + this.parseNegate(), this.globSet = [...new Set(this.braceExpand())], e.debug && (this.debug = (...r) => console.error(...r)), this.debug(this.pattern, this.globSet); + let s = this.globSet.map((r) => this.slashSplit(r)); + this.globParts = this.preprocess(s), this.debug(this.pattern, this.globParts); + let i = this.globParts.map((r, h, o) => { + if (this.isWindows && this.windowsNoMagicRoot) { + let a = r[0] === "" && r[1] === "" && (r[2] === "?" || !ss.test(r[2])) && !ss.test(r[3]), l = /^[a-z]:/i.test(r[0]); + if (a) return [...r.slice(0, 4), ...r.slice(4).map((f) => this.parse(f))]; + if (l) return [r[0], ...r.slice(1).map((f) => this.parse(f))]; + } + return r.map((a) => this.parse(a)); + }); + if (this.debug(this.pattern, i), this.set = i.filter((r) => r.indexOf(false) === -1), this.isWindows) for (let r = 0; r < this.set.length; r++) { + let h = this.set[r]; + h[0] === "" && h[1] === "" && this.globParts[r][2] === "?" && typeof h[3] == "string" && /^[a-z]:$/i.test(h[3]) && (h[2] = "?"); + } + this.debug(this.pattern, this.set); + } + preprocess(t) { + 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] = "*"); + let { optimizationLevel: e = 1 } = this.options; + return e >= 2 ? (t = this.firstPhasePreProcess(t), t = this.secondPhasePreProcess(t)) : e >= 1 ? t = this.levelOneOptimize(t) : t = this.adjascentGlobstarOptimize(t), t; + } + adjascentGlobstarOptimize(t) { + return t.map((e) => { + let s = -1; + for (; (s = e.indexOf("**", s + 1)) !== -1; ) { + let i = s; + for (; e[i + 1] === "**"; ) i++; + i !== s && e.splice(s, i - s); + } + return e; + }); } - if (c === "[" && !escaping) { - for (const [cls, [unip, u, neg]] of Object.entries(posixClasses2)) { - if (glob2.startsWith(cls, i)) { - if (rangeStart) { - return ["$.", false, glob2.length - pos, true]; + levelOneOptimize(t) { + return t.map((e) => (e = e.reduce((s, i) => { + let r = s[s.length - 1]; + return i === "**" && r === "**" ? s : i === ".." && r && r !== ".." && r !== "." && r !== "**" ? (s.pop(), s) : (s.push(i), s); + }, []), e.length === 0 ? [""] : e)); + } + levelTwoFileOptimize(t) { + Array.isArray(t) || (t = this.slashSplit(t)); + let e = false; + do { + if (e = false, !this.preserveMultipleSlashes) { + for (let i = 1; i < t.length - 1; i++) { + let r = t[i]; + i === 1 && r === "" && t[0] === "" || (r === "." || r === "") && (e = true, t.splice(i, 1), i--); } - i += cls.length; - if (neg) - negs.push(unip); - else - ranges.push(unip); - uflag = uflag || u; - continue WHILE; + t[0] === "." && t.length === 2 && (t[1] === "." || t[1] === "") && (e = true, t.pop()); } - } + let s = 0; + for (; (s = t.indexOf("..", s + 1)) !== -1; ) { + let i = t[s - 1]; + i && i !== "." && i !== ".." && i !== "**" && (e = true, t.splice(s - 1, 2), s -= 2); + } + } while (e); + return t.length === 0 ? [""] : t; } - escaping = false; - if (rangeStart) { - if (c > rangeStart) { - ranges.push(braceEscape2(rangeStart) + "-" + braceEscape2(c)); - } else if (c === rangeStart) { - ranges.push(braceEscape2(c)); - } - rangeStart = ""; - i++; - continue; + firstPhasePreProcess(t) { + let e = false; + do { + e = false; + for (let s of t) { + let i = -1; + for (; (i = s.indexOf("**", i + 1)) !== -1; ) { + let h = i; + for (; s[h + 1] === "**"; ) h++; + h > i && s.splice(i + 1, h - i); + let o = s[i + 1], a = s[i + 2], l = s[i + 3]; + if (o !== ".." || !a || a === "." || a === ".." || !l || l === "." || l === "..") continue; + e = true, s.splice(i, 1); + let f = s.slice(0); + f[i] = "**", t.push(f), i--; + } + if (!this.preserveMultipleSlashes) { + for (let h = 1; h < s.length - 1; h++) { + let o = s[h]; + h === 1 && o === "" && s[0] === "" || (o === "." || o === "") && (e = true, s.splice(h, 1), h--); + } + s[0] === "." && s.length === 2 && (s[1] === "." || s[1] === "") && (e = true, s.pop()); + } + let r = 0; + for (; (r = s.indexOf("..", r + 1)) !== -1; ) { + let h = s[r - 1]; + if (h && h !== "." && h !== ".." && h !== "**") { + e = true; + let a = r === 1 && s[r + 1] === "**" ? ["."] : []; + s.splice(r - 1, 2, ...a), s.length === 0 && s.push(""), r -= 2; + } + } + } + } while (e); + return t; } - if (glob2.startsWith("-]", i + 1)) { - ranges.push(braceEscape2(c + "-")); - i += 2; - continue; + secondPhasePreProcess(t) { + for (let e = 0; e < t.length - 1; e++) for (let s = e + 1; s < t.length; s++) { + let i = this.partsMatch(t[e], t[s], !this.preserveMultipleSlashes); + if (i) { + t[e] = [], t[s] = i; + break; + } + } + return t.filter((e) => e.length); + } + partsMatch(t, e, s = false) { + let i = 0, r = 0, h = [], o = ""; + for (; i < t.length && r < e.length; ) if (t[i] === e[r]) h.push(o === "b" ? e[r] : t[i]), i++, r++; + else if (s && t[i] === "**" && e[r] === t[i + 1]) h.push(t[i]), i++; + else if (s && e[r] === "**" && t[i] === e[r + 1]) h.push(e[r]), r++; + else if (t[i] === "*" && e[r] && (this.options.dot || !e[r].startsWith(".")) && e[r] !== "**") { + if (o === "b") return false; + o = "a", h.push(t[i]), i++, r++; + } else if (e[r] === "*" && t[i] && (this.options.dot || !t[i].startsWith(".")) && t[i] !== "**") { + if (o === "a") return false; + o = "b", h.push(e[r]), i++, r++; + } else return false; + return t.length === e.length && h; + } + parseNegate() { + if (this.nonegate) return; + let t = this.pattern, e = false, s = 0; + for (let i = 0; i < t.length && t.charAt(i) === "!"; i++) e = !e, s++; + s && (this.pattern = t.slice(s)), this.negate = e; + } + matchOne(t, e, s = false) { + let i = this.options; + if (this.isWindows) { + let p = typeof t[0] == "string" && /^[a-z]:$/i.test(t[0]), b = !p && t[0] === "" && t[1] === "" && t[2] === "?" && /^[a-z]:$/i.test(t[3]), w = typeof e[0] == "string" && /^[a-z]:$/i.test(e[0]), v = !w && e[0] === "" && e[1] === "" && e[2] === "?" && typeof e[3] == "string" && /^[a-z]:$/i.test(e[3]), E = b ? 3 : p ? 0 : void 0, y = v ? 3 : w ? 0 : void 0; + if (typeof E == "number" && typeof y == "number") { + let [S, B] = [t[E], e[y]]; + S.toLowerCase() === B.toLowerCase() && (e[y] = S, y > E ? e = e.slice(y) : E > y && (t = t.slice(E))); + } + } + let { optimizationLevel: r = 1 } = this.options; + r >= 2 && (t = this.levelTwoFileOptimize(t)), this.debug("matchOne", this, { file: t, pattern: e }), this.debug("matchOne", t.length, e.length); + for (var h = 0, o = 0, a = t.length, l = e.length; h < a && o < l; h++, o++) { + this.debug("matchOne loop"); + var f = e[o], c = t[h]; + if (this.debug(e, f, c), f === false) return false; + if (f === g.GLOBSTAR) { + this.debug("GLOBSTAR", [e, f, c]); + var d = h, u = o + 1; + if (u === l) { + for (this.debug("** at the end"); h < a; h++) if (t[h] === "." || t[h] === ".." || !i.dot && t[h].charAt(0) === ".") return false; + return true; + } + for (; d < a; ) { + var m = t[d]; + if (this.debug(` +globstar while`, t, d, e, u, m), this.matchOne(t.slice(d), e.slice(u), s)) return this.debug("globstar found match!", d, a, m), true; + if (m === "." || m === ".." || !i.dot && m.charAt(0) === ".") { + this.debug("dot detected!", t, d, e, u); + break; + } + this.debug("globstar swallow a segment, and continue"), d++; + } + return !!(s && (this.debug(` +>>> no match, partial?`, t, d, e, u), d === a)); + } + let p; + if (typeof f == "string" ? (p = c === f, this.debug("string match", f, c, p)) : (p = f.test(c), this.debug("pattern match", f, c, p)), !p) return false; + } + if (h === a && o === l) return true; + if (h === a) return s; + if (o === l) return h === a - 1 && t[h] === ""; + throw new Error("wtf?"); } - if (glob2.startsWith("-", i + 1)) { - rangeStart = c; - i += 2; - continue; + braceExpand() { + return (0, g.braceExpand)(this.pattern, this.options); + } + parse(t) { + (0, jt.assertValidPattern)(t); + let e = this.options; + if (t === "**") return g.GLOBSTAR; + if (t === "") return ""; + let s, i = null; + (s = t.match(Fi)) ? i = e.dot ? Ni : ji : (s = t.match(Oi)) ? i = (e.nocase ? e.dot ? Ri : Ci : e.dot ? Ti : xi)(s[1]) : (s = t.match(Li)) ? i = (e.nocase ? e.dot ? Bi : Wi : e.dot ? Ii : Gi)(s) : (s = t.match(Ai)) ? i = e.dot ? Mi : ki : (s = t.match(Pi)) && (i = Di); + let r = is.AST.fromGlob(t, this.options).toMMPattern(); + return i && typeof r == "object" && Reflect.defineProperty(r, "test", { value: i }), r; + } + makeRe() { + if (this.regexp || this.regexp === false) return this.regexp; + let t = this.set; + if (!t.length) return this.regexp = false, this.regexp; + let e = this.options, s = e.noglobstar ? Ui : e.dot ? $i : qi, i = new Set(e.nocase ? ["i"] : []), r = t.map((a) => { + let l = a.map((c) => { + if (c instanceof RegExp) for (let d of c.flags.split("")) i.add(d); + return typeof c == "string" ? Ji(c) : c === g.GLOBSTAR ? g.GLOBSTAR : c._src; + }); + l.forEach((c, d) => { + let u = l[d + 1], m = l[d - 1]; + c !== g.GLOBSTAR || m === g.GLOBSTAR || (m === void 0 ? u !== void 0 && u !== g.GLOBSTAR ? l[d + 1] = "(?:\\/|" + s + "\\/)?" + u : l[d] = s : u === void 0 ? l[d - 1] = m + "(?:\\/|\\/" + s + ")?" : u !== g.GLOBSTAR && (l[d - 1] = m + "(?:\\/|\\/" + s + "\\/)" + u, l[d + 1] = g.GLOBSTAR)); + }); + let f = l.filter((c) => c !== g.GLOBSTAR); + if (this.partial && f.length >= 1) { + let c = []; + for (let d = 1; d <= f.length; d++) c.push(f.slice(0, d).join("/")); + return "(?:" + c.join("|") + ")"; + } + return f.join("/"); + }).join("|"), [h, o] = t.length > 1 ? ["(?:", ")"] : ["", ""]; + r = "^" + h + r + o + "$", this.partial && (r = "^(?:\\/|" + h + r.slice(1, -1) + o + ")$"), this.negate && (r = "^(?!" + r + ").+$"); + try { + this.regexp = new RegExp(r, [...i].join("")); + } catch { + this.regexp = false; + } + return this.regexp; } - ranges.push(braceEscape2(c)); - i++; - } - if (endPos < i) { - return ["", false, 0, false]; - } - if (!ranges.length && !negs.length) { - return ["$.", false, glob2.length - pos, true]; - } - if (negs.length === 0 && ranges.length === 1 && /^\\?.$/.test(ranges[0]) && !negate2) { - const r = ranges[0].length === 2 ? ranges[0].slice(-1) : ranges[0]; - return [regexpEscape2(r), false, endPos - pos, false]; - } - const sranges = "[" + (negate2 ? "^" : "") + rangesToString2(ranges) + "]"; - const snegs = "[" + (negate2 ? "" : "^") + rangesToString2(negs) + "]"; - const comb = ranges.length && negs.length ? "(" + sranges + "|" + snegs + ")" : ranges.length ? sranges : snegs; - return [comb, uflag, endPos - pos, true]; - }; - exports2.parseClass = parseClass2; - } -}); - -// node_modules/glob/node_modules/minimatch/dist/commonjs/unescape.js -var require_unescape = __commonJS({ - "node_modules/glob/node_modules/minimatch/dist/commonjs/unescape.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.unescape = void 0; - var unescape3 = (s, { windowsPathsNoEscape = false, magicalBraces = true } = {}) => { - if (magicalBraces) { - return windowsPathsNoEscape ? s.replace(/\[([^\/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1"); - } - return windowsPathsNoEscape ? s.replace(/\[([^\/\\{}])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^\/\\{}])\]/g, "$1$2").replace(/\\([^\/{}])/g, "$1"); - }; - exports2.unescape = unescape3; - } -}); - -// node_modules/glob/node_modules/minimatch/dist/commonjs/ast.js -var require_ast = __commonJS({ - "node_modules/glob/node_modules/minimatch/dist/commonjs/ast.js"(exports2) { - "use strict"; - var _a2; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.AST = void 0; - var brace_expressions_js_1 = require_brace_expressions(); - var unescape_js_1 = require_unescape(); - var types2 = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]); - var isExtglobType2 = (c) => types2.has(c); - var isExtglobAST2 = (c) => isExtglobType2(c.type); - var adoptionMap2 = /* @__PURE__ */ new Map([ - ["!", ["@"]], - ["?", ["?", "@"]], - ["@", ["@"]], - ["*", ["*", "+", "?", "@"]], - ["+", ["+", "@"]] - ]); - var adoptionWithSpaceMap2 = /* @__PURE__ */ new Map([ - ["!", ["?"]], - ["@", ["?"]], - ["+", ["?", "*"]] - ]); - var adoptionAnyMap2 = /* @__PURE__ */ new Map([ - ["!", ["?", "@"]], - ["?", ["?", "@"]], - ["@", ["?", "@"]], - ["*", ["*", "+", "?", "@"]], - ["+", ["+", "@", "?", "*"]] - ]); - var usurpMap2 = /* @__PURE__ */ new Map([ - ["!", /* @__PURE__ */ new Map([["!", "@"]])], - [ - "?", - /* @__PURE__ */ new Map([ - ["*", "*"], - ["+", "*"] - ]) - ], - [ - "@", - /* @__PURE__ */ new Map([ - ["!", "!"], - ["?", "?"], - ["@", "@"], - ["*", "*"], - ["+", "+"] - ]) - ], - [ - "+", - /* @__PURE__ */ new Map([ - ["?", "*"], - ["*", "*"] - ]) - ] - ]); - var startNoTraversal2 = "(?!(?:^|/)\\.\\.?(?:$|/))"; - var startNoDot2 = "(?!\\.)"; - var addPatternStart2 = /* @__PURE__ */ new Set(["[", "."]); - var justDots2 = /* @__PURE__ */ new Set(["..", "."]); - var reSpecials2 = new Set("().*{}+?[]^$\\!"); - var regExpEscape3 = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); - var qmark3 = "[^/]"; - var star3 = qmark3 + "*?"; - var starNoEmpty2 = qmark3 + "+?"; - var ID2 = 0; - var AST2 = class { - type; - #root; - #hasMagic; - #uflag = false; - #parts = []; - #parent; - #parentIndex; - #negs; - #filledNegs = false; - #options; - #toString; - // set to true if it's an extglob with no children - // (which really means one child of '') - #emptyExt = false; - id = ++ID2; - get depth() { - return (this.#parent?.depth ?? -1) + 1; - } - [/* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom")]() { - return { - "@@type": "AST", - id: this.id, - type: this.type, - root: this.#root.id, - parent: this.#parent?.id, - depth: this.depth, - partsLength: this.#parts.length, - parts: this.#parts - }; - } - constructor(type, parent, options = {}) { - this.type = type; - if (type) - this.#hasMagic = true; - this.#parent = parent; - this.#root = this.#parent ? this.#parent.#root : this; - this.#options = this.#root === this ? options : this.#root.#options; - this.#negs = this.#root === this ? [] : this.#root.#negs; - if (type === "!" && !this.#root.#filledNegs) - this.#negs.push(this); - this.#parentIndex = this.#parent ? this.#parent.#parts.length : 0; - } - get hasMagic() { - if (this.#hasMagic !== void 0) - return this.#hasMagic; - for (const p of this.#parts) { - if (typeof p === "string") - continue; - if (p.type || p.hasMagic) - return this.#hasMagic = true; - } - return this.#hasMagic; - } - // reconstructs the pattern - toString() { - if (this.#toString !== void 0) - return this.#toString; - if (!this.type) { - return this.#toString = this.#parts.map((p) => String(p)).join(""); - } else { - return this.#toString = this.type + "(" + this.#parts.map((p) => String(p)).join("|") + ")"; - } - } - #fillNegs() { - if (this !== this.#root) - throw new Error("should only call on root"); - if (this.#filledNegs) - return this; - this.toString(); - this.#filledNegs = true; - let n; - while (n = this.#negs.pop()) { - if (n.type !== "!") - continue; - let p = n; - let pp = p.#parent; - while (pp) { - for (let i = p.#parentIndex + 1; !pp.type && i < pp.#parts.length; i++) { - for (const part of n.#parts) { - if (typeof part === "string") { - throw new Error("string part in extglob AST??"); - } - part.copyIn(pp.#parts[i]); - } - } - p = pp; - pp = p.#parent; - } - } - return this; - } - push(...parts) { - for (const p of parts) { - if (p === "") - continue; - if (typeof p !== "string" && !(p instanceof _a2 && p.#parent === this)) { - throw new Error("invalid part: " + p); - } - this.#parts.push(p); - } - } - toJSON() { - const ret = this.type === null ? this.#parts.slice().map((p) => typeof p === "string" ? p : p.toJSON()) : [this.type, ...this.#parts.map((p) => p.toJSON())]; - if (this.isStart() && !this.type) - ret.unshift([]); - if (this.isEnd() && (this === this.#root || this.#root.#filledNegs && this.#parent?.type === "!")) { - ret.push({}); - } - return ret; - } - isStart() { - if (this.#root === this) - return true; - if (!this.#parent?.isStart()) - return false; - if (this.#parentIndex === 0) - return true; - const p = this.#parent; - for (let i = 0; i < this.#parentIndex; i++) { - const pp = p.#parts[i]; - if (!(pp instanceof _a2 && pp.type === "!")) { - return false; - } - } - return true; - } - isEnd() { - if (this.#root === this) - return true; - if (this.#parent?.type === "!") - return true; - if (!this.#parent?.isEnd()) - return false; - if (!this.type) - return this.#parent?.isEnd(); - const pl = this.#parent ? this.#parent.#parts.length : 0; - return this.#parentIndex === pl - 1; - } - copyIn(part) { - if (typeof part === "string") - this.push(part); - else - this.push(part.clone(this)); - } - clone(parent) { - const c = new _a2(this.type, parent); - for (const p of this.#parts) { - c.copyIn(p); - } - return c; - } - static #parseAST(str, ast, pos, opt, extDepth) { - const maxDepth = opt.maxExtglobRecursion ?? 2; - let escaping = false; - let inBrace = false; - let braceStart = -1; - let braceNeg = false; - if (ast.type === null) { - let i2 = pos; - let acc2 = ""; - while (i2 < str.length) { - const c = str.charAt(i2++); - if (escaping || c === "\\") { - escaping = !escaping; - acc2 += c; - continue; - } - if (inBrace) { - if (i2 === braceStart + 1) { - if (c === "^" || c === "!") { - braceNeg = true; - } - } else if (c === "]" && !(i2 === braceStart + 2 && braceNeg)) { - inBrace = false; - } - acc2 += c; - continue; - } else if (c === "[") { - inBrace = true; - braceStart = i2; - braceNeg = false; - acc2 += c; - continue; - } - const doRecurse = !opt.noext && isExtglobType2(c) && str.charAt(i2) === "(" && extDepth <= maxDepth; - if (doRecurse) { - ast.push(acc2); - acc2 = ""; - const ext2 = new _a2(c, ast); - i2 = _a2.#parseAST(str, ext2, i2, opt, extDepth + 1); - ast.push(ext2); - continue; - } - acc2 += c; - } - ast.push(acc2); - return i2; - } - let i = pos + 1; - let part = new _a2(null, ast); - const parts = []; - let acc = ""; - while (i < str.length) { - const c = str.charAt(i++); - if (escaping || c === "\\") { - escaping = !escaping; - acc += c; - continue; - } - if (inBrace) { - if (i === braceStart + 1) { - if (c === "^" || c === "!") { - braceNeg = true; - } - } else if (c === "]" && !(i === braceStart + 2 && braceNeg)) { - inBrace = false; - } - acc += c; - continue; - } else if (c === "[") { - inBrace = true; - braceStart = i; - braceNeg = false; - acc += c; - continue; - } - const doRecurse = !opt.noext && isExtglobType2(c) && str.charAt(i) === "(" && /* c8 ignore start - the maxDepth is sufficient here */ - (extDepth <= maxDepth || ast && ast.#canAdoptType(c)); - if (doRecurse) { - const depthAdd = ast && ast.#canAdoptType(c) ? 0 : 1; - part.push(acc); - acc = ""; - const ext2 = new _a2(c, part); - part.push(ext2); - i = _a2.#parseAST(str, ext2, i, opt, extDepth + depthAdd); - continue; - } - if (c === "|") { - part.push(acc); - acc = ""; - parts.push(part); - part = new _a2(null, ast); - continue; - } - if (c === ")") { - if (acc === "" && ast.#parts.length === 0) { - ast.#emptyExt = true; - } - part.push(acc); - acc = ""; - ast.push(...parts, part); - return i; - } - acc += c; - } - ast.type = null; - ast.#hasMagic = void 0; - ast.#parts = [str.substring(pos - 1)]; - return i; - } - #canAdoptWithSpace(child) { - return this.#canAdopt(child, adoptionWithSpaceMap2); - } - #canAdopt(child, map = adoptionMap2) { - if (!child || typeof child !== "object" || child.type !== null || child.#parts.length !== 1 || this.type === null) { - return false; - } - const gc = child.#parts[0]; - if (!gc || typeof gc !== "object" || gc.type === null) { - return false; - } - return this.#canAdoptType(gc.type, map); - } - #canAdoptType(c, map = adoptionAnyMap2) { - return !!map.get(this.type)?.includes(c); - } - #adoptWithSpace(child, index2) { - const gc = child.#parts[0]; - const blank = new _a2(null, gc, this.options); - blank.#parts.push(""); - gc.push(blank); - this.#adopt(child, index2); - } - #adopt(child, index2) { - const gc = child.#parts[0]; - this.#parts.splice(index2, 1, ...gc.#parts); - for (const p of gc.#parts) { - if (typeof p === "object") - p.#parent = this; - } - this.#toString = void 0; - } - #canUsurpType(c) { - const m = usurpMap2.get(this.type); - return !!m?.has(c); - } - #canUsurp(child) { - if (!child || typeof child !== "object" || child.type !== null || child.#parts.length !== 1 || this.type === null || this.#parts.length !== 1) { - return false; - } - const gc = child.#parts[0]; - if (!gc || typeof gc !== "object" || gc.type === null) { - return false; - } - return this.#canUsurpType(gc.type); - } - #usurp(child) { - const m = usurpMap2.get(this.type); - const gc = child.#parts[0]; - const nt = m?.get(gc.type); - if (!nt) - return false; - this.#parts = gc.#parts; - for (const p of this.#parts) { - if (typeof p === "object") { - p.#parent = this; - } - } - this.type = nt; - this.#toString = void 0; - this.#emptyExt = false; - } - static fromGlob(pattern, options = {}) { - const ast = new _a2(null, void 0, options); - _a2.#parseAST(pattern, ast, 0, options, 0); - return ast; - } - // returns the regular expression if there's magic, or the unescaped - // string if not. - toMMPattern() { - if (this !== this.#root) - return this.#root.toMMPattern(); - const glob2 = this.toString(); - const [re, body, hasMagic, uflag] = this.toRegExpSource(); - const anyMagic = hasMagic || this.#hasMagic || this.#options.nocase && !this.#options.nocaseMagicOnly && glob2.toUpperCase() !== glob2.toLowerCase(); - if (!anyMagic) { - return body; - } - const flags = (this.#options.nocase ? "i" : "") + (uflag ? "u" : ""); - return Object.assign(new RegExp(`^${re}$`, flags), { - _src: re, - _glob: glob2 - }); - } - get options() { - return this.#options; - } - // returns the string match, the regexp source, whether there's magic - // in the regexp (so a regular expression is required) and whether or - // not the uflag is needed for the regular expression (for posix classes) - // TODO: instead of injecting the start/end at this point, just return - // the BODY of the regexp, along with the start/end portions suitable - // for binding the start/end in either a joined full-path makeRe context - // (where we bind to (^|/), or a standalone matchPart context (where - // we bind to ^, and not /). Otherwise slashes get duped! - // - // In part-matching mode, the start is: - // - if not isStart: nothing - // - if traversal possible, but not allowed: ^(?!\.\.?$) - // - if dots allowed or not possible: ^ - // - if dots possible and not allowed: ^(?!\.) - // end is: - // - if not isEnd(): nothing - // - else: $ - // - // In full-path matching mode, we put the slash at the START of the - // pattern, so start is: - // - if first pattern: same as part-matching mode - // - if not isStart(): nothing - // - if traversal possible, but not allowed: /(?!\.\.?(?:$|/)) - // - if dots allowed or not possible: / - // - if dots possible and not allowed: /(?!\.) - // end is: - // - if last pattern, same as part-matching mode - // - else nothing - // - // Always put the (?:$|/) on negated tails, though, because that has to be - // there to bind the end of the negated pattern portion, and it's easier to - // just stick it in now rather than try to inject it later in the middle of - // the pattern. - // - // We can just always return the same end, and leave it up to the caller - // to know whether it's going to be used joined or in parts. - // And, if the start is adjusted slightly, can do the same there: - // - if not isStart: nothing - // - if traversal possible, but not allowed: (?:/|^)(?!\.\.?$) - // - if dots allowed or not possible: (?:/|^) - // - if dots possible and not allowed: (?:/|^)(?!\.) - // - // But it's better to have a simpler binding without a conditional, for - // performance, so probably better to return both start options. - // - // Then the caller just ignores the end if it's not the first pattern, - // and the start always gets applied. - // - // But that's always going to be $ if it's the ending pattern, or nothing, - // so the caller can just attach $ at the end of the pattern when building. - // - // So the todo is: - // - better detect what kind of start is needed - // - return both flavors of starting pattern - // - attach $ at the end of the pattern when creating the actual RegExp - // - // Ah, but wait, no, that all only applies to the root when the first pattern - // is not an extglob. If the first pattern IS an extglob, then we need all - // that dot prevention biz to live in the extglob portions, because eg - // +(*|.x*) can match .xy but not .yx. - // - // So, return the two flavors if it's #root and the first child is not an - // AST, otherwise leave it to the child AST to handle it, and there, - // use the (?:^|/) style of start binding. - // - // Even simplified further: - // - Since the start for a join is eg /(?!\.) and the start for a part - // is ^(?!\.), we can just prepend (?!\.) to the pattern (either root - // or start or whatever) and prepend ^ or / at the Regexp construction. - toRegExpSource(allowDot) { - const dot = allowDot ?? !!this.#options.dot; - if (this.#root === this) { - this.#flatten(); - this.#fillNegs(); - } - if (!isExtglobAST2(this)) { - const noEmpty = this.isStart() && this.isEnd() && !this.#parts.some((s) => typeof s !== "string"); - const src = this.#parts.map((p) => { - const [re, _2, hasMagic, uflag] = typeof p === "string" ? _a2.#parseGlob(p, this.#hasMagic, noEmpty) : p.toRegExpSource(allowDot); - this.#hasMagic = this.#hasMagic || hasMagic; - this.#uflag = this.#uflag || uflag; - return re; - }).join(""); - let start2 = ""; - if (this.isStart()) { - if (typeof this.#parts[0] === "string") { - const dotTravAllowed = this.#parts.length === 1 && justDots2.has(this.#parts[0]); - if (!dotTravAllowed) { - const aps = addPatternStart2; - const needNoTrav = ( - // dots are allowed, and the pattern starts with [ or . - dot && aps.has(src.charAt(0)) || // the pattern starts with \., and then [ or . - src.startsWith("\\.") && aps.has(src.charAt(2)) || // the pattern starts with \.\., and then [ or . - src.startsWith("\\.\\.") && aps.has(src.charAt(4)) - ); - const needNoDot = !dot && !allowDot && aps.has(src.charAt(0)); - start2 = needNoTrav ? startNoTraversal2 : needNoDot ? startNoDot2 : ""; - } - } - } - let end = ""; - if (this.isEnd() && this.#root.#filledNegs && this.#parent?.type === "!") { - end = "(?:$|\\/)"; - } - const final2 = start2 + src + end; - return [ - final2, - (0, unescape_js_1.unescape)(src), - this.#hasMagic = !!this.#hasMagic, - this.#uflag - ]; - } - const repeated = this.type === "*" || this.type === "+"; - const start = this.type === "!" ? "(?:(?!(?:" : "(?:"; - let body = this.#partsToRegExp(dot); - if (this.isStart() && this.isEnd() && !body && this.type !== "!") { - const s = this.toString(); - const me = this; - me.#parts = [s]; - me.type = null; - me.#hasMagic = void 0; - return [s, (0, unescape_js_1.unescape)(this.toString()), false, false]; - } - let bodyDotAllowed = !repeated || allowDot || dot || !startNoDot2 ? "" : this.#partsToRegExp(true); - if (bodyDotAllowed === body) { - bodyDotAllowed = ""; - } - if (bodyDotAllowed) { - body = `(?:${body})(?:${bodyDotAllowed})*?`; - } - let final = ""; - if (this.type === "!" && this.#emptyExt) { - final = (this.isStart() && !dot ? startNoDot2 : "") + starNoEmpty2; - } else { - const close = this.type === "!" ? ( - // !() must match something,but !(x) can match '' - "))" + (this.isStart() && !dot && !allowDot ? startNoDot2 : "") + star3 + ")" - ) : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && bodyDotAllowed ? ")" : this.type === "*" && bodyDotAllowed ? `)?` : `)${this.type}`; - final = start + body + close; - } - return [ - final, - (0, unescape_js_1.unescape)(body), - this.#hasMagic = !!this.#hasMagic, - this.#uflag - ]; - } - #flatten() { - if (!isExtglobAST2(this)) { - for (const p of this.#parts) { - if (typeof p === "object") { - p.#flatten(); - } - } - } else { - let iterations = 0; - let done = false; - do { - done = true; - for (let i = 0; i < this.#parts.length; i++) { - const c = this.#parts[i]; - if (typeof c === "object") { - c.#flatten(); - if (this.#canAdopt(c)) { - done = false; - this.#adopt(c, i); - } else if (this.#canAdoptWithSpace(c)) { - done = false; - this.#adoptWithSpace(c, i); - } else if (this.#canUsurp(c)) { - done = false; - this.#usurp(c); - } - } - } - } while (!done && ++iterations < 10); - } - this.#toString = void 0; - } - #partsToRegExp(dot) { - return this.#parts.map((p) => { - if (typeof p === "string") { - throw new Error("string type in extglob ast??"); - } - const [re, _2, _hasMagic, uflag] = p.toRegExpSource(dot); - this.#uflag = this.#uflag || uflag; - return re; - }).filter((p) => !(this.isStart() && this.isEnd()) || !!p).join("|"); - } - static #parseGlob(glob2, hasMagic, noEmpty = false) { - let escaping = false; - let re = ""; - let uflag = false; - let inStar = false; - for (let i = 0; i < glob2.length; i++) { - const c = glob2.charAt(i); - if (escaping) { - escaping = false; - re += (reSpecials2.has(c) ? "\\" : "") + c; - continue; - } - if (c === "*") { - if (inStar) - continue; - inStar = true; - re += noEmpty && /^[*]+$/.test(glob2) ? starNoEmpty2 : star3; - hasMagic = true; - continue; - } else { - inStar = false; - } - if (c === "\\") { - if (i === glob2.length - 1) { - re += "\\\\"; - } else { - escaping = true; - } - continue; - } - if (c === "[") { - const [src, needUflag, consumed, magic] = (0, brace_expressions_js_1.parseClass)(glob2, i); - if (consumed) { - re += src; - uflag = uflag || needUflag; - i += consumed - 1; - hasMagic = hasMagic || magic; - continue; - } - } - if (c === "?") { - re += qmark3; - hasMagic = true; - continue; - } - re += regExpEscape3(c); - } - return [re, (0, unescape_js_1.unescape)(glob2), !!hasMagic, uflag]; - } - }; - exports2.AST = AST2; - _a2 = AST2; - } -}); - -// node_modules/glob/node_modules/minimatch/dist/commonjs/escape.js -var require_escape = __commonJS({ - "node_modules/glob/node_modules/minimatch/dist/commonjs/escape.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.escape = void 0; - var escape3 = (s, { windowsPathsNoEscape = false, magicalBraces = false } = {}) => { - if (magicalBraces) { - return windowsPathsNoEscape ? s.replace(/[?*()[\]{}]/g, "[$&]") : s.replace(/[?*()[\]\\{}]/g, "\\$&"); - } - return windowsPathsNoEscape ? s.replace(/[?*()[\]]/g, "[$&]") : s.replace(/[?*()[\]\\]/g, "\\$&"); - }; - exports2.escape = escape3; - } -}); - -// node_modules/glob/node_modules/minimatch/dist/commonjs/index.js -var require_commonjs20 = __commonJS({ - "node_modules/glob/node_modules/minimatch/dist/commonjs/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.unescape = exports2.escape = exports2.AST = exports2.Minimatch = exports2.match = exports2.makeRe = exports2.braceExpand = exports2.defaults = exports2.filter = exports2.GLOBSTAR = exports2.sep = exports2.minimatch = void 0; - var brace_expansion_1 = require_commonjs19(); - var assert_valid_pattern_js_1 = require_assert_valid_pattern(); - var ast_js_1 = require_ast(); - var escape_js_1 = require_escape(); - var unescape_js_1 = require_unescape(); - var minimatch2 = (p, pattern, options = {}) => { - (0, assert_valid_pattern_js_1.assertValidPattern)(pattern); - if (!options.nocomment && pattern.charAt(0) === "#") { - return false; - } - return new Minimatch2(pattern, options).match(p); - }; - exports2.minimatch = minimatch2; - var starDotExtRE2 = /^\*+([^+@!?\*\[\(]*)$/; - var starDotExtTest2 = (ext3) => (f) => !f.startsWith(".") && f.endsWith(ext3); - var starDotExtTestDot2 = (ext3) => (f) => f.endsWith(ext3); - var starDotExtTestNocase2 = (ext3) => { - ext3 = ext3.toLowerCase(); - return (f) => !f.startsWith(".") && f.toLowerCase().endsWith(ext3); - }; - var starDotExtTestNocaseDot2 = (ext3) => { - ext3 = ext3.toLowerCase(); - return (f) => f.toLowerCase().endsWith(ext3); - }; - var starDotStarRE2 = /^\*+\.\*+$/; - var starDotStarTest2 = (f) => !f.startsWith(".") && f.includes("."); - var starDotStarTestDot2 = (f) => f !== "." && f !== ".." && f.includes("."); - var dotStarRE2 = /^\.\*+$/; - var dotStarTest2 = (f) => f !== "." && f !== ".." && f.startsWith("."); - var starRE2 = /^\*+$/; - var starTest2 = (f) => f.length !== 0 && !f.startsWith("."); - var starTestDot2 = (f) => f.length !== 0 && f !== "." && f !== ".."; - var qmarksRE2 = /^\?+([^+@!?\*\[\(]*)?$/; - var qmarksTestNocase2 = ([$0, ext3 = ""]) => { - const noext = qmarksTestNoExt2([$0]); - if (!ext3) - return noext; - ext3 = ext3.toLowerCase(); - return (f) => noext(f) && f.toLowerCase().endsWith(ext3); - }; - var qmarksTestNocaseDot2 = ([$0, ext3 = ""]) => { - const noext = qmarksTestNoExtDot2([$0]); - if (!ext3) - return noext; - ext3 = ext3.toLowerCase(); - return (f) => noext(f) && f.toLowerCase().endsWith(ext3); - }; - var qmarksTestDot2 = ([$0, ext3 = ""]) => { - const noext = qmarksTestNoExtDot2([$0]); - return !ext3 ? noext : (f) => noext(f) && f.endsWith(ext3); - }; - var qmarksTest2 = ([$0, ext3 = ""]) => { - const noext = qmarksTestNoExt2([$0]); - return !ext3 ? noext : (f) => noext(f) && f.endsWith(ext3); - }; - var qmarksTestNoExt2 = ([$0]) => { - const len = $0.length; - return (f) => f.length === len && !f.startsWith("."); - }; - var qmarksTestNoExtDot2 = ([$0]) => { - const len = $0.length; - return (f) => f.length === len && f !== "." && f !== ".."; - }; - var defaultPlatform2 = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix"; - var path29 = { - win32: { sep: "\\" }, - posix: { sep: "/" } - }; - exports2.sep = defaultPlatform2 === "win32" ? path29.win32.sep : path29.posix.sep; - exports2.minimatch.sep = exports2.sep; - exports2.GLOBSTAR = /* @__PURE__ */ Symbol("globstar **"); - exports2.minimatch.GLOBSTAR = exports2.GLOBSTAR; - var qmark3 = "[^/]"; - var star3 = qmark3 + "*?"; - var twoStarDot2 = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?"; - var twoStarNoDot2 = "(?:(?!(?:\\/|^)\\.).)*?"; - var filter2 = (pattern, options = {}) => (p) => (0, exports2.minimatch)(p, pattern, options); - exports2.filter = filter2; - exports2.minimatch.filter = exports2.filter; - var ext2 = (a, b = {}) => Object.assign({}, a, b); - var defaults2 = (def) => { - if (!def || typeof def !== "object" || !Object.keys(def).length) { - return exports2.minimatch; - } - const orig = exports2.minimatch; - const m = (p, pattern, options = {}) => orig(p, pattern, ext2(def, options)); - return Object.assign(m, { - Minimatch: class Minimatch extends orig.Minimatch { - constructor(pattern, options = {}) { - super(pattern, ext2(def, options)); - } - static defaults(options) { - return orig.defaults(ext2(def, options)).Minimatch; - } - }, - AST: class AST extends orig.AST { - /* c8 ignore start */ - constructor(type, parent, options = {}) { - super(type, parent, ext2(def, options)); - } - /* c8 ignore stop */ - static fromGlob(pattern, options = {}) { - return orig.AST.fromGlob(pattern, ext2(def, options)); - } - }, - unescape: (s, options = {}) => orig.unescape(s, ext2(def, options)), - escape: (s, options = {}) => orig.escape(s, ext2(def, options)), - filter: (pattern, options = {}) => orig.filter(pattern, ext2(def, options)), - defaults: (options) => orig.defaults(ext2(def, options)), - makeRe: (pattern, options = {}) => orig.makeRe(pattern, ext2(def, options)), - braceExpand: (pattern, options = {}) => orig.braceExpand(pattern, ext2(def, options)), - match: (list, pattern, options = {}) => orig.match(list, pattern, ext2(def, options)), - sep: orig.sep, - GLOBSTAR: exports2.GLOBSTAR - }); - }; - exports2.defaults = defaults2; - exports2.minimatch.defaults = exports2.defaults; - var braceExpand2 = (pattern, options = {}) => { - (0, assert_valid_pattern_js_1.assertValidPattern)(pattern); - if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) { - return [pattern]; - } - return (0, brace_expansion_1.expand)(pattern, { max: options.braceExpandMax }); - }; - exports2.braceExpand = braceExpand2; - exports2.minimatch.braceExpand = exports2.braceExpand; - var makeRe2 = (pattern, options = {}) => new Minimatch2(pattern, options).makeRe(); - exports2.makeRe = makeRe2; - exports2.minimatch.makeRe = exports2.makeRe; - var match2 = (list, pattern, options = {}) => { - const mm = new Minimatch2(pattern, options); - list = list.filter((f) => mm.match(f)); - if (mm.options.nonull && !list.length) { - list.push(pattern); - } - return list; - }; - exports2.match = match2; - exports2.minimatch.match = exports2.match; - var globMagic2 = /[?*]|[+@!]\(.*?\)|\[|\]/; - var regExpEscape3 = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"); - var Minimatch2 = class { - options; - set; - pattern; - windowsPathsNoEscape; - nonegate; - negate; - comment; - empty; - preserveMultipleSlashes; - partial; - globSet; - globParts; - nocase; - isWindows; - platform; - windowsNoMagicRoot; - maxGlobstarRecursion; - regexp; - constructor(pattern, options = {}) { - (0, assert_valid_pattern_js_1.assertValidPattern)(pattern); - options = options || {}; - this.options = options; - this.maxGlobstarRecursion = options.maxGlobstarRecursion ?? 200; - this.pattern = pattern; - this.platform = options.platform || defaultPlatform2; - this.isWindows = this.platform === "win32"; - const awe = "allowWindowsEscape"; - this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options[awe] === false; - if (this.windowsPathsNoEscape) { - this.pattern = this.pattern.replace(/\\/g, "/"); - } - this.preserveMultipleSlashes = !!options.preserveMultipleSlashes; - this.regexp = null; - this.negate = false; - this.nonegate = !!options.nonegate; - this.comment = false; - this.empty = false; - this.partial = !!options.partial; - this.nocase = !!this.options.nocase; - this.windowsNoMagicRoot = options.windowsNoMagicRoot !== void 0 ? options.windowsNoMagicRoot : !!(this.isWindows && this.nocase); - this.globSet = []; - this.globParts = []; - this.set = []; - this.make(); - } - hasMagic() { - if (this.options.magicalBraces && this.set.length > 1) { - return true; - } - for (const pattern of this.set) { - for (const part of pattern) { - if (typeof part !== "string") - return true; - } - } - return false; - } - debug(..._2) { - } - make() { - const pattern = this.pattern; - const options = this.options; - if (!options.nocomment && pattern.charAt(0) === "#") { - this.comment = true; - return; - } - if (!pattern) { - this.empty = true; - return; - } - this.parseNegate(); - this.globSet = [...new Set(this.braceExpand())]; - if (options.debug) { - this.debug = (...args) => console.error(...args); - } - this.debug(this.pattern, this.globSet); - const rawGlobParts = this.globSet.map((s) => this.slashSplit(s)); - this.globParts = this.preprocess(rawGlobParts); - this.debug(this.pattern, this.globParts); - let set = this.globParts.map((s, _2, __) => { - if (this.isWindows && this.windowsNoMagicRoot) { - const isUNC = s[0] === "" && s[1] === "" && (s[2] === "?" || !globMagic2.test(s[2])) && !globMagic2.test(s[3]); - const isDrive = /^[a-z]:/i.test(s[0]); - if (isUNC) { - return [ - ...s.slice(0, 4), - ...s.slice(4).map((ss) => this.parse(ss)) - ]; - } else if (isDrive) { - return [s[0], ...s.slice(1).map((ss) => this.parse(ss))]; - } - } - return s.map((ss) => this.parse(ss)); - }); - this.debug(this.pattern, set); - this.set = set.filter((s) => s.indexOf(false) === -1); - if (this.isWindows) { - for (let i = 0; i < this.set.length; i++) { - const p = this.set[i]; - if (p[0] === "" && p[1] === "" && this.globParts[i][2] === "?" && typeof p[3] === "string" && /^[a-z]:$/i.test(p[3])) { - p[2] = "?"; - } - } - } - this.debug(this.pattern, this.set); - } - // various transforms to equivalent pattern sets that are - // faster to process in a filesystem walk. The goal is to - // eliminate what we can, and push all ** patterns as far - // to the right as possible, even if it increases the number - // of patterns that we have to process. - preprocess(globParts) { - if (this.options.noglobstar) { - for (let i = 0; i < globParts.length; i++) { - for (let j = 0; j < globParts[i].length; j++) { - if (globParts[i][j] === "**") { - globParts[i][j] = "*"; - } - } - } - } - const { optimizationLevel = 1 } = this.options; - if (optimizationLevel >= 2) { - globParts = this.firstPhasePreProcess(globParts); - globParts = this.secondPhasePreProcess(globParts); - } else if (optimizationLevel >= 1) { - globParts = this.levelOneOptimize(globParts); - } else { - globParts = this.adjascentGlobstarOptimize(globParts); - } - return globParts; - } - // just get rid of adjascent ** portions - adjascentGlobstarOptimize(globParts) { - return globParts.map((parts) => { - let gs = -1; - while (-1 !== (gs = parts.indexOf("**", gs + 1))) { - let i = gs; - while (parts[i + 1] === "**") { - i++; - } - if (i !== gs) { - parts.splice(gs, i - gs); - } - } - return parts; - }); - } - // get rid of adjascent ** and resolve .. portions - levelOneOptimize(globParts) { - return globParts.map((parts) => { - parts = parts.reduce((set, part) => { - const prev = set[set.length - 1]; - if (part === "**" && prev === "**") { - return set; - } - if (part === "..") { - if (prev && prev !== ".." && prev !== "." && prev !== "**") { - set.pop(); - return set; - } - } - set.push(part); - return set; - }, []); - return parts.length === 0 ? [""] : parts; - }); - } - levelTwoFileOptimize(parts) { - if (!Array.isArray(parts)) { - parts = this.slashSplit(parts); - } - let didSomething = false; - do { - didSomething = false; - if (!this.preserveMultipleSlashes) { - for (let i = 1; i < parts.length - 1; i++) { - const p = parts[i]; - if (i === 1 && p === "" && parts[0] === "") - continue; - if (p === "." || p === "") { - didSomething = true; - parts.splice(i, 1); - i--; - } - } - if (parts[0] === "." && parts.length === 2 && (parts[1] === "." || parts[1] === "")) { - didSomething = true; - parts.pop(); - } - } - let dd = 0; - while (-1 !== (dd = parts.indexOf("..", dd + 1))) { - const p = parts[dd - 1]; - if (p && p !== "." && p !== ".." && p !== "**") { - didSomething = true; - parts.splice(dd - 1, 2); - dd -= 2; - } - } - } while (didSomething); - return parts.length === 0 ? [""] : parts; - } - // First phase: single-pattern processing - //
is 1 or more portions - //is 1 or more portions - // is any portion other than ., .., '', or ** - //
is . or '' - // - // **/.. is *brutal* for filesystem walking performance, because - // it effectively resets the recursive walk each time it occurs, - // and ** cannot be reduced out by a .. pattern part like a regexp - // or most strings (other than .., ., and '') can be. - // - // /**/..//
/
-> { /..//
/
, /**//
/
} - // // -> /- // //../
-> /- // **/**/ -> **/ - // - // **/*/ -> */**/ <== not valid because ** doesn't follow - // this WOULD be allowed if ** did follow symlinks, or * didn't - firstPhasePreProcess(globParts) { - let didSomething = false; - do { - didSomething = false; - for (let parts of globParts) { - let gs = -1; - while (-1 !== (gs = parts.indexOf("**", gs + 1))) { - let gss = gs; - while (parts[gss + 1] === "**") { - gss++; - } - if (gss > gs) { - parts.splice(gs + 1, gss - gs); - } - let next = parts[gs + 1]; - const p = parts[gs + 2]; - const p2 = parts[gs + 3]; - if (next !== "..") - continue; - if (!p || p === "." || p === ".." || !p2 || p2 === "." || p2 === "..") { - continue; - } - didSomething = true; - parts.splice(gs, 1); - const other = parts.slice(0); - other[gs] = "**"; - globParts.push(other); - gs--; - } - if (!this.preserveMultipleSlashes) { - for (let i = 1; i < parts.length - 1; i++) { - const p = parts[i]; - if (i === 1 && p === "" && parts[0] === "") - continue; - if (p === "." || p === "") { - didSomething = true; - parts.splice(i, 1); - i--; - } - } - if (parts[0] === "." && parts.length === 2 && (parts[1] === "." || parts[1] === "")) { - didSomething = true; - parts.pop(); - } - } - let dd = 0; - while (-1 !== (dd = parts.indexOf("..", dd + 1))) { - const p = parts[dd - 1]; - if (p && p !== "." && p !== ".." && p !== "**") { - didSomething = true; - const needDot = dd === 1 && parts[dd + 1] === "**"; - const splin = needDot ? ["."] : []; - parts.splice(dd - 1, 2, ...splin); - if (parts.length === 0) - parts.push(""); - dd -= 2; - } - } - } - } while (didSomething); - return globParts; - } - // second phase: multi-pattern dedupes - // { /*/, //
} -> /*/- // { /, /} -> /- // { /**/, /} -> /**/- // - // { /**/, /**//
} -> /**/- // ^-- not valid because ** doens't follow symlinks - secondPhasePreProcess(globParts) { - for (let i = 0; i < globParts.length - 1; i++) { - for (let j = i + 1; j < globParts.length; j++) { - const matched = this.partsMatch(globParts[i], globParts[j], !this.preserveMultipleSlashes); - if (matched) { - globParts[i] = []; - globParts[j] = matched; - break; - } - } - } - return globParts.filter((gs) => gs.length); - } - partsMatch(a, b, emptyGSMatch = false) { - let ai = 0; - let bi = 0; - let result = []; - let which9 = ""; - while (ai < a.length && bi < b.length) { - if (a[ai] === b[bi]) { - result.push(which9 === "b" ? b[bi] : a[ai]); - ai++; - bi++; - } else if (emptyGSMatch && a[ai] === "**" && b[bi] === a[ai + 1]) { - result.push(a[ai]); - ai++; - } else if (emptyGSMatch && b[bi] === "**" && a[ai] === b[bi + 1]) { - result.push(b[bi]); - bi++; - } else if (a[ai] === "*" && b[bi] && (this.options.dot || !b[bi].startsWith(".")) && b[bi] !== "**") { - if (which9 === "b") - return false; - which9 = "a"; - result.push(a[ai]); - ai++; - bi++; - } else if (b[bi] === "*" && a[ai] && (this.options.dot || !a[ai].startsWith(".")) && a[ai] !== "**") { - if (which9 === "a") - return false; - which9 = "b"; - result.push(b[bi]); - ai++; - bi++; - } else { - return false; - } - } - return a.length === b.length && result; - } - parseNegate() { - if (this.nonegate) - return; - const pattern = this.pattern; - let negate2 = false; - let negateOffset = 0; - for (let i = 0; i < pattern.length && pattern.charAt(i) === "!"; i++) { - negate2 = !negate2; - negateOffset++; - } - if (negateOffset) - this.pattern = pattern.slice(negateOffset); - this.negate = negate2; - } - // set partial to true to test if, for example, - // "/a/b" matches the start of "/*/b/*/d" - // Partial means, if you run out of file before you run - // out of pattern, then that's fine, as long as all - // the parts match. - matchOne(file, pattern, partial = false) { - let fileStartIndex = 0; - let patternStartIndex = 0; - if (this.isWindows) { - const fileDrive = typeof file[0] === "string" && /^[a-z]:$/i.test(file[0]); - const fileUNC = !fileDrive && file[0] === "" && file[1] === "" && file[2] === "?" && /^[a-z]:$/i.test(file[3]); - const patternDrive = typeof pattern[0] === "string" && /^[a-z]:$/i.test(pattern[0]); - const patternUNC = !patternDrive && pattern[0] === "" && pattern[1] === "" && pattern[2] === "?" && typeof pattern[3] === "string" && /^[a-z]:$/i.test(pattern[3]); - const fdi = fileUNC ? 3 : fileDrive ? 0 : void 0; - const pdi = patternUNC ? 3 : patternDrive ? 0 : void 0; - if (typeof fdi === "number" && typeof pdi === "number") { - const [fd, pd] = [ - file[fdi], - pattern[pdi] - ]; - if (fd.toLowerCase() === pd.toLowerCase()) { - pattern[pdi] = fd; - patternStartIndex = pdi; - fileStartIndex = fdi; - } - } - } - const { optimizationLevel = 1 } = this.options; - if (optimizationLevel >= 2) { - file = this.levelTwoFileOptimize(file); - } - if (pattern.includes(exports2.GLOBSTAR)) { - return this.#matchGlobstar(file, pattern, partial, fileStartIndex, patternStartIndex); - } - return this.#matchOne(file, pattern, partial, fileStartIndex, patternStartIndex); - } - #matchGlobstar(file, pattern, partial, fileIndex, patternIndex) { - const firstgs = pattern.indexOf(exports2.GLOBSTAR, patternIndex); - const lastgs = pattern.lastIndexOf(exports2.GLOBSTAR); - const [head, body, tail] = partial ? [ - pattern.slice(patternIndex, firstgs), - pattern.slice(firstgs + 1), - [] - ] : [ - pattern.slice(patternIndex, firstgs), - pattern.slice(firstgs + 1, lastgs), - pattern.slice(lastgs + 1) - ]; - if (head.length) { - const fileHead = file.slice(fileIndex, fileIndex + head.length); - if (!this.#matchOne(fileHead, head, partial, 0, 0)) { - return false; - } - fileIndex += head.length; - patternIndex += head.length; - } - let fileTailMatch = 0; - if (tail.length) { - if (tail.length + fileIndex > file.length) - return false; - let tailStart = file.length - tail.length; - if (this.#matchOne(file, tail, partial, tailStart, 0)) { - fileTailMatch = tail.length; - } else { - if (file[file.length - 1] !== "" || fileIndex + tail.length === file.length) { - return false; - } - tailStart--; - if (!this.#matchOne(file, tail, partial, tailStart, 0)) { - return false; - } - fileTailMatch = tail.length + 1; - } - } - if (!body.length) { - let sawSome = !!fileTailMatch; - for (let i2 = fileIndex; i2 < file.length - fileTailMatch; i2++) { - const f = String(file[i2]); - sawSome = true; - if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) { - return false; - } - } - return partial || sawSome; - } - const bodySegments = [[[], 0]]; - let currentBody = bodySegments[0]; - let nonGsParts = 0; - const nonGsPartsSums = [0]; - for (const b of body) { - if (b === exports2.GLOBSTAR) { - nonGsPartsSums.push(nonGsParts); - currentBody = [[], 0]; - bodySegments.push(currentBody); - } else { - currentBody[0].push(b); - nonGsParts++; - } - } - let i = bodySegments.length - 1; - const fileLength = file.length - fileTailMatch; - for (const b of bodySegments) { - b[1] = fileLength - (nonGsPartsSums[i--] + b[0].length); - } - return !!this.#matchGlobStarBodySections(file, bodySegments, fileIndex, 0, partial, 0, !!fileTailMatch); - } - // return false for "nope, not matching" - // return null for "not matching, cannot keep trying" - #matchGlobStarBodySections(file, bodySegments, fileIndex, bodyIndex, partial, globStarDepth, sawTail) { - const bs = bodySegments[bodyIndex]; - if (!bs) { - for (let i = fileIndex; i < file.length; i++) { - sawTail = true; - const f = file[i]; - if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) { - return false; - } - } - return sawTail; - } - const [body, after] = bs; - while (fileIndex <= after) { - const m = this.#matchOne(file.slice(0, fileIndex + body.length), body, partial, fileIndex, 0); - if (m && globStarDepth < this.maxGlobstarRecursion) { - const sub = this.#matchGlobStarBodySections(file, bodySegments, fileIndex + body.length, bodyIndex + 1, partial, globStarDepth + 1, sawTail); - if (sub !== false) { - return sub; - } - } - const f = file[fileIndex]; - if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) { - return false; - } - fileIndex++; - } - return partial || null; - } - #matchOne(file, pattern, partial, fileIndex, patternIndex) { - let fi; - let pi; - let pl; - let fl; - for (fi = fileIndex, pi = patternIndex, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) { - this.debug("matchOne loop"); - let p = pattern[pi]; - let f = file[fi]; - this.debug(pattern, p, f); - if (p === false || p === exports2.GLOBSTAR) { - return false; - } - let hit; - if (typeof p === "string") { - hit = f === p; - this.debug("string match", p, f, hit); - } else { - hit = p.test(f); - this.debug("pattern match", p, f, hit); - } - if (!hit) - return false; - } - if (fi === fl && pi === pl) { - return true; - } else if (fi === fl) { - return partial; - } else if (pi === pl) { - return fi === fl - 1 && file[fi] === ""; - } else { - throw new Error("wtf?"); - } - } - braceExpand() { - return (0, exports2.braceExpand)(this.pattern, this.options); - } - parse(pattern) { - (0, assert_valid_pattern_js_1.assertValidPattern)(pattern); - const options = this.options; - if (pattern === "**") - return exports2.GLOBSTAR; - if (pattern === "") - return ""; - let m; - let fastTest = null; - if (m = pattern.match(starRE2)) { - fastTest = options.dot ? starTestDot2 : starTest2; - } else if (m = pattern.match(starDotExtRE2)) { - fastTest = (options.nocase ? options.dot ? starDotExtTestNocaseDot2 : starDotExtTestNocase2 : options.dot ? starDotExtTestDot2 : starDotExtTest2)(m[1]); - } else if (m = pattern.match(qmarksRE2)) { - fastTest = (options.nocase ? options.dot ? qmarksTestNocaseDot2 : qmarksTestNocase2 : options.dot ? qmarksTestDot2 : qmarksTest2)(m); - } else if (m = pattern.match(starDotStarRE2)) { - fastTest = options.dot ? starDotStarTestDot2 : starDotStarTest2; - } else if (m = pattern.match(dotStarRE2)) { - fastTest = dotStarTest2; - } - const re = ast_js_1.AST.fromGlob(pattern, this.options).toMMPattern(); - if (fastTest && typeof re === "object") { - Reflect.defineProperty(re, "test", { value: fastTest }); - } - return re; - } - makeRe() { - if (this.regexp || this.regexp === false) - return this.regexp; - const set = this.set; - if (!set.length) { - this.regexp = false; - return this.regexp; - } - const options = this.options; - const twoStar = options.noglobstar ? star3 : options.dot ? twoStarDot2 : twoStarNoDot2; - const flags = new Set(options.nocase ? ["i"] : []); - let re = set.map((pattern) => { - const pp = pattern.map((p) => { - if (p instanceof RegExp) { - for (const f of p.flags.split("")) - flags.add(f); - } - return typeof p === "string" ? regExpEscape3(p) : p === exports2.GLOBSTAR ? exports2.GLOBSTAR : p._src; - }); - pp.forEach((p, i) => { - const next = pp[i + 1]; - const prev = pp[i - 1]; - if (p !== exports2.GLOBSTAR || prev === exports2.GLOBSTAR) { - return; - } - if (prev === void 0) { - if (next !== void 0 && next !== exports2.GLOBSTAR) { - pp[i + 1] = "(?:\\/|" + twoStar + "\\/)?" + next; - } else { - pp[i] = twoStar; - } - } else if (next === void 0) { - pp[i - 1] = prev + "(?:\\/|\\/" + twoStar + ")?"; - } else if (next !== exports2.GLOBSTAR) { - pp[i - 1] = prev + "(?:\\/|\\/" + twoStar + "\\/)" + next; - pp[i + 1] = exports2.GLOBSTAR; - } - }); - const filtered = pp.filter((p) => p !== exports2.GLOBSTAR); - if (this.partial && filtered.length >= 1) { - const prefixes = []; - for (let i = 1; i <= filtered.length; i++) { - prefixes.push(filtered.slice(0, i).join("/")); - } - return "(?:" + prefixes.join("|") + ")"; - } - return filtered.join("/"); - }).join("|"); - const [open, close] = set.length > 1 ? ["(?:", ")"] : ["", ""]; - re = "^" + open + re + close + "$"; - if (this.partial) { - re = "^(?:\\/|" + open + re.slice(1, -1) + close + ")$"; - } - if (this.negate) - re = "^(?!" + re + ").+$"; - try { - this.regexp = new RegExp(re, [...flags].join("")); - } catch (ex) { - this.regexp = false; - } - return this.regexp; - } - slashSplit(p) { - if (this.preserveMultipleSlashes) { - return p.split("/"); - } else if (this.isWindows && /^\/\/[^\/]+/.test(p)) { - return ["", ...p.split(/\/+/)]; - } else { - return p.split(/\/+/); - } - } - match(f, partial = this.partial) { - this.debug("match", f, this.pattern); - if (this.comment) { - return false; - } - if (this.empty) { - return f === ""; - } - if (f === "/" && partial) { - return true; - } - const options = this.options; - if (this.isWindows) { - f = f.split("\\").join("/"); - } - const ff = this.slashSplit(f); - this.debug(this.pattern, "split", ff); - const set = this.set; - this.debug(this.pattern, "set", set); - let filename = ff[ff.length - 1]; - if (!filename) { - for (let i = ff.length - 2; !filename && i >= 0; i--) { - filename = ff[i]; - } - } - for (let i = 0; i < set.length; i++) { - const pattern = set[i]; - let file = ff; - if (options.matchBase && pattern.length === 1) { - file = [filename]; - } - const hit = this.matchOne(file, pattern, partial); - if (hit) { - if (options.flipNegate) { - return true; - } - return !this.negate; - } - } - if (options.flipNegate) { - return false; - } - return this.negate; - } - static defaults(def) { - return exports2.minimatch.defaults(def).Minimatch; - } - }; - exports2.Minimatch = Minimatch2; - var ast_js_2 = require_ast(); - Object.defineProperty(exports2, "AST", { enumerable: true, get: function() { - return ast_js_2.AST; - } }); - var escape_js_2 = require_escape(); - Object.defineProperty(exports2, "escape", { enumerable: true, get: function() { - return escape_js_2.escape; - } }); - var unescape_js_2 = require_unescape(); - Object.defineProperty(exports2, "unescape", { enumerable: true, get: function() { - return unescape_js_2.unescape; - } }); - exports2.minimatch.AST = ast_js_1.AST; - exports2.minimatch.Minimatch = Minimatch2; - exports2.minimatch.escape = escape_js_1.escape; - exports2.minimatch.unescape = unescape_js_1.unescape; - } -}); - -// node_modules/lru-cache/dist/commonjs/index.js -var require_commonjs21 = __commonJS({ - "node_modules/lru-cache/dist/commonjs/index.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.LRUCache = void 0; - var perf = typeof performance === "object" && performance && typeof performance.now === "function" ? performance : Date; - var warned = /* @__PURE__ */ new Set(); - var PROCESS = typeof process === "object" && !!process ? process : {}; - var emitWarning = (msg, type, code, fn) => { - typeof PROCESS.emitWarning === "function" ? PROCESS.emitWarning(msg, type, code, fn) : console.error(`[${code}] ${type}: ${msg}`); - }; - var AC = globalThis.AbortController; - var AS = globalThis.AbortSignal; - if (typeof AC === "undefined") { - AS = class AbortSignal { - onabort; - _onabort = []; - reason; - aborted = false; - addEventListener(_2, fn) { - this._onabort.push(fn); - } - }; - AC = class AbortController { - constructor() { - warnACPolyfill(); - } - signal = new AS(); - abort(reason) { - if (this.signal.aborted) - return; - this.signal.reason = reason; - this.signal.aborted = true; - for (const fn of this.signal._onabort) { - fn(reason); - } - this.signal.onabort?.(reason); - } - }; - let printACPolyfillWarning = PROCESS.env?.LRU_CACHE_IGNORE_AC_WARNING !== "1"; - const warnACPolyfill = () => { - if (!printACPolyfillWarning) - return; - printACPolyfillWarning = false; - emitWarning("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", warnACPolyfill); - }; - } - var shouldWarn = (code) => !warned.has(code); - var isPosInt = (n) => n && n === Math.floor(n) && n > 0 && isFinite(n); - var getUintArray = (max) => !isPosInt(max) ? null : max <= Math.pow(2, 8) ? Uint8Array : max <= Math.pow(2, 16) ? Uint16Array : max <= Math.pow(2, 32) ? Uint32Array : max <= Number.MAX_SAFE_INTEGER ? ZeroArray : null; - var ZeroArray = class extends Array { - constructor(size) { - super(size); - this.fill(0); - } - }; - var Stack = class _Stack { - heap; - length; - // private constructor - static #constructing = false; - static create(max) { - const HeapCls = getUintArray(max); - if (!HeapCls) - return []; - _Stack.#constructing = true; - const s = new _Stack(max, HeapCls); - _Stack.#constructing = false; - return s; - } - constructor(max, HeapCls) { - if (!_Stack.#constructing) { - throw new TypeError("instantiate Stack using Stack.create(n)"); - } - this.heap = new HeapCls(max); - this.length = 0; - } - push(n) { - this.heap[this.length++] = n; - } - pop() { - return this.heap[--this.length]; - } - }; - var LRUCache = class _LRUCache { - // options that cannot be changed without disaster - #max; - #maxSize; - #dispose; - #onInsert; - #disposeAfter; - #fetchMethod; - #memoMethod; - /** - * {@link LRUCache.OptionsBase.ttl} - */ - ttl; - /** - * {@link LRUCache.OptionsBase.ttlResolution} - */ - ttlResolution; - /** - * {@link LRUCache.OptionsBase.ttlAutopurge} - */ - ttlAutopurge; - /** - * {@link LRUCache.OptionsBase.updateAgeOnGet} - */ - updateAgeOnGet; - /** - * {@link LRUCache.OptionsBase.updateAgeOnHas} - */ - updateAgeOnHas; - /** - * {@link LRUCache.OptionsBase.allowStale} - */ - allowStale; - /** - * {@link LRUCache.OptionsBase.noDisposeOnSet} - */ - noDisposeOnSet; - /** - * {@link LRUCache.OptionsBase.noUpdateTTL} - */ - noUpdateTTL; - /** - * {@link LRUCache.OptionsBase.maxEntrySize} - */ - maxEntrySize; - /** - * {@link LRUCache.OptionsBase.sizeCalculation} - */ - sizeCalculation; - /** - * {@link LRUCache.OptionsBase.noDeleteOnFetchRejection} - */ - noDeleteOnFetchRejection; - /** - * {@link LRUCache.OptionsBase.noDeleteOnStaleGet} - */ - noDeleteOnStaleGet; - /** - * {@link LRUCache.OptionsBase.allowStaleOnFetchAbort} - */ - allowStaleOnFetchAbort; - /** - * {@link LRUCache.OptionsBase.allowStaleOnFetchRejection} - */ - allowStaleOnFetchRejection; - /** - * {@link LRUCache.OptionsBase.ignoreFetchAbort} - */ - ignoreFetchAbort; - // computed properties - #size; - #calculatedSize; - #keyMap; - #keyList; - #valList; - #next; - #prev; - #head; - #tail; - #free; - #disposed; - #sizes; - #starts; - #ttls; - #hasDispose; - #hasFetchMethod; - #hasDisposeAfter; - #hasOnInsert; - /** - * Do not call this method unless you need to inspect the - * inner workings of the cache. If anything returned by this - * object is modified in any way, strange breakage may occur. - * - * These fields are private for a reason! - * - * @internal - */ - static unsafeExposeInternals(c) { - return { - // properties - starts: c.#starts, - ttls: c.#ttls, - sizes: c.#sizes, - keyMap: c.#keyMap, - keyList: c.#keyList, - valList: c.#valList, - next: c.#next, - prev: c.#prev, - get head() { - return c.#head; - }, - get tail() { - return c.#tail; - }, - free: c.#free, - // methods - isBackgroundFetch: (p) => c.#isBackgroundFetch(p), - backgroundFetch: (k, index2, options, context5) => c.#backgroundFetch(k, index2, options, context5), - moveToTail: (index2) => c.#moveToTail(index2), - indexes: (options) => c.#indexes(options), - rindexes: (options) => c.#rindexes(options), - isStale: (index2) => c.#isStale(index2) - }; - } - // Protected read-only members - /** - * {@link LRUCache.OptionsBase.max} (read-only) - */ - get max() { - return this.#max; - } - /** - * {@link LRUCache.OptionsBase.maxSize} (read-only) - */ - get maxSize() { - return this.#maxSize; - } - /** - * The total computed size of items in the cache (read-only) - */ - get calculatedSize() { - return this.#calculatedSize; - } - /** - * The number of items stored in the cache (read-only) - */ - get size() { - return this.#size; - } - /** - * {@link LRUCache.OptionsBase.fetchMethod} (read-only) - */ - get fetchMethod() { - return this.#fetchMethod; - } - get memoMethod() { - return this.#memoMethod; - } - /** - * {@link LRUCache.OptionsBase.dispose} (read-only) - */ - get dispose() { - return this.#dispose; - } - /** - * {@link LRUCache.OptionsBase.onInsert} (read-only) - */ - get onInsert() { - return this.#onInsert; - } - /** - * {@link LRUCache.OptionsBase.disposeAfter} (read-only) - */ - get disposeAfter() { - return this.#disposeAfter; - } - constructor(options) { - const { max = 0, ttl, ttlResolution = 1, ttlAutopurge, updateAgeOnGet, updateAgeOnHas, allowStale, dispose, onInsert, disposeAfter, noDisposeOnSet, noUpdateTTL, maxSize = 0, maxEntrySize = 0, sizeCalculation, fetchMethod, memoMethod, noDeleteOnFetchRejection, noDeleteOnStaleGet, allowStaleOnFetchRejection, allowStaleOnFetchAbort, ignoreFetchAbort } = options; - if (max !== 0 && !isPosInt(max)) { - throw new TypeError("max option must be a nonnegative integer"); - } - const UintArray = max ? getUintArray(max) : Array; - if (!UintArray) { - throw new Error("invalid max value: " + max); - } - this.#max = max; - this.#maxSize = maxSize; - this.maxEntrySize = maxEntrySize || this.#maxSize; - this.sizeCalculation = sizeCalculation; - if (this.sizeCalculation) { - if (!this.#maxSize && !this.maxEntrySize) { - throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize"); - } - if (typeof this.sizeCalculation !== "function") { - throw new TypeError("sizeCalculation set to non-function"); - } - } - if (memoMethod !== void 0 && typeof memoMethod !== "function") { - throw new TypeError("memoMethod must be a function if defined"); - } - this.#memoMethod = memoMethod; - if (fetchMethod !== void 0 && typeof fetchMethod !== "function") { - throw new TypeError("fetchMethod must be a function if specified"); - } - this.#fetchMethod = fetchMethod; - this.#hasFetchMethod = !!fetchMethod; - this.#keyMap = /* @__PURE__ */ new Map(); - this.#keyList = new Array(max).fill(void 0); - this.#valList = new Array(max).fill(void 0); - this.#next = new UintArray(max); - this.#prev = new UintArray(max); - this.#head = 0; - this.#tail = 0; - this.#free = Stack.create(max); - this.#size = 0; - this.#calculatedSize = 0; - if (typeof dispose === "function") { - this.#dispose = dispose; - } - if (typeof onInsert === "function") { - this.#onInsert = onInsert; - } - if (typeof disposeAfter === "function") { - this.#disposeAfter = disposeAfter; - this.#disposed = []; - } else { - this.#disposeAfter = void 0; - this.#disposed = void 0; - } - this.#hasDispose = !!this.#dispose; - this.#hasOnInsert = !!this.#onInsert; - this.#hasDisposeAfter = !!this.#disposeAfter; - this.noDisposeOnSet = !!noDisposeOnSet; - this.noUpdateTTL = !!noUpdateTTL; - this.noDeleteOnFetchRejection = !!noDeleteOnFetchRejection; - this.allowStaleOnFetchRejection = !!allowStaleOnFetchRejection; - this.allowStaleOnFetchAbort = !!allowStaleOnFetchAbort; - this.ignoreFetchAbort = !!ignoreFetchAbort; - if (this.maxEntrySize !== 0) { - if (this.#maxSize !== 0) { - if (!isPosInt(this.#maxSize)) { - throw new TypeError("maxSize must be a positive integer if specified"); - } - } - if (!isPosInt(this.maxEntrySize)) { - throw new TypeError("maxEntrySize must be a positive integer if specified"); - } - this.#initializeSizeTracking(); - } - this.allowStale = !!allowStale; - this.noDeleteOnStaleGet = !!noDeleteOnStaleGet; - this.updateAgeOnGet = !!updateAgeOnGet; - this.updateAgeOnHas = !!updateAgeOnHas; - this.ttlResolution = isPosInt(ttlResolution) || ttlResolution === 0 ? ttlResolution : 1; - this.ttlAutopurge = !!ttlAutopurge; - this.ttl = ttl || 0; - if (this.ttl) { - if (!isPosInt(this.ttl)) { - throw new TypeError("ttl must be a positive integer if specified"); - } - this.#initializeTTLTracking(); - } - if (this.#max === 0 && this.ttl === 0 && this.#maxSize === 0) { - throw new TypeError("At least one of max, maxSize, or ttl is required"); - } - if (!this.ttlAutopurge && !this.#max && !this.#maxSize) { - const code = "LRU_CACHE_UNBOUNDED"; - if (shouldWarn(code)) { - warned.add(code); - const msg = "TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption."; - emitWarning(msg, "UnboundedCacheWarning", code, _LRUCache); - } - } - } - /** - * Return the number of ms left in the item's TTL. If item is not in cache, - * returns `0`. Returns `Infinity` if item is in cache without a defined TTL. - */ - getRemainingTTL(key) { - return this.#keyMap.has(key) ? Infinity : 0; - } - #initializeTTLTracking() { - const ttls = new ZeroArray(this.#max); - const starts = new ZeroArray(this.#max); - this.#ttls = ttls; - this.#starts = starts; - this.#setItemTTL = (index2, ttl, start = perf.now()) => { - starts[index2] = ttl !== 0 ? start : 0; - ttls[index2] = ttl; - if (ttl !== 0 && this.ttlAutopurge) { - const t = setTimeout(() => { - if (this.#isStale(index2)) { - this.#delete(this.#keyList[index2], "expire"); - } - }, ttl + 1); - if (t.unref) { - t.unref(); - } - } - }; - this.#updateItemAge = (index2) => { - starts[index2] = ttls[index2] !== 0 ? perf.now() : 0; - }; - this.#statusTTL = (status, index2) => { - if (ttls[index2]) { - const ttl = ttls[index2]; - const start = starts[index2]; - if (!ttl || !start) - return; - status.ttl = ttl; - status.start = start; - status.now = cachedNow || getNow(); - const age = status.now - start; - status.remainingTTL = ttl - age; - } - }; - let cachedNow = 0; - const getNow = () => { - const n = perf.now(); - if (this.ttlResolution > 0) { - cachedNow = n; - const t = setTimeout(() => cachedNow = 0, this.ttlResolution); - if (t.unref) { - t.unref(); - } - } - return n; - }; - this.getRemainingTTL = (key) => { - const index2 = this.#keyMap.get(key); - if (index2 === void 0) { - return 0; - } - const ttl = ttls[index2]; - const start = starts[index2]; - if (!ttl || !start) { - return Infinity; - } - const age = (cachedNow || getNow()) - start; - return ttl - age; - }; - this.#isStale = (index2) => { - const s = starts[index2]; - const t = ttls[index2]; - return !!t && !!s && (cachedNow || getNow()) - s > t; - }; - } - // conditionally set private methods related to TTL - #updateItemAge = () => { - }; - #statusTTL = () => { - }; - #setItemTTL = () => { - }; - /* c8 ignore stop */ - #isStale = () => false; - #initializeSizeTracking() { - const sizes = new ZeroArray(this.#max); - this.#calculatedSize = 0; - this.#sizes = sizes; - this.#removeItemSize = (index2) => { - this.#calculatedSize -= sizes[index2]; - sizes[index2] = 0; - }; - this.#requireSize = (k, v, size, sizeCalculation) => { - if (this.#isBackgroundFetch(v)) { - return 0; - } - if (!isPosInt(size)) { - if (sizeCalculation) { - if (typeof sizeCalculation !== "function") { - throw new TypeError("sizeCalculation must be a function"); - } - size = sizeCalculation(v, k); - if (!isPosInt(size)) { - throw new TypeError("sizeCalculation return invalid (expect positive integer)"); - } - } else { - throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set."); - } - } - return size; - }; - this.#addItemSize = (index2, size, status) => { - sizes[index2] = size; - if (this.#maxSize) { - const maxSize = this.#maxSize - sizes[index2]; - while (this.#calculatedSize > maxSize) { - this.#evict(true); - } - } - this.#calculatedSize += sizes[index2]; - if (status) { - status.entrySize = size; - status.totalCalculatedSize = this.#calculatedSize; - } - }; - } - #removeItemSize = (_i) => { - }; - #addItemSize = (_i, _s, _st) => { - }; - #requireSize = (_k, _v, size, sizeCalculation) => { - if (size || sizeCalculation) { - throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache"); - } - return 0; - }; - *#indexes({ allowStale = this.allowStale } = {}) { - if (this.#size) { - for (let i = this.#tail; true; ) { - if (!this.#isValidIndex(i)) { - break; - } - if (allowStale || !this.#isStale(i)) { - yield i; - } - if (i === this.#head) { - break; - } else { - i = this.#prev[i]; - } - } - } - } - *#rindexes({ allowStale = this.allowStale } = {}) { - if (this.#size) { - for (let i = this.#head; true; ) { - if (!this.#isValidIndex(i)) { - break; - } - if (allowStale || !this.#isStale(i)) { - yield i; - } - if (i === this.#tail) { - break; - } else { - i = this.#next[i]; - } - } - } - } - #isValidIndex(index2) { - return index2 !== void 0 && this.#keyMap.get(this.#keyList[index2]) === index2; - } - /** - * Return a generator yielding `[key, value]` pairs, - * in order from most recently used to least recently used. - */ - *entries() { - for (const i of this.#indexes()) { - if (this.#valList[i] !== void 0 && this.#keyList[i] !== void 0 && !this.#isBackgroundFetch(this.#valList[i])) { - yield [this.#keyList[i], this.#valList[i]]; - } - } - } - /** - * Inverse order version of {@link LRUCache.entries} - * - * Return a generator yielding `[key, value]` pairs, - * in order from least recently used to most recently used. - */ - *rentries() { - for (const i of this.#rindexes()) { - if (this.#valList[i] !== void 0 && this.#keyList[i] !== void 0 && !this.#isBackgroundFetch(this.#valList[i])) { - yield [this.#keyList[i], this.#valList[i]]; - } - } - } - /** - * Return a generator yielding the keys in the cache, - * in order from most recently used to least recently used. - */ - *keys() { - for (const i of this.#indexes()) { - const k = this.#keyList[i]; - if (k !== void 0 && !this.#isBackgroundFetch(this.#valList[i])) { - yield k; - } - } - } - /** - * Inverse order version of {@link LRUCache.keys} - * - * Return a generator yielding the keys in the cache, - * in order from least recently used to most recently used. - */ - *rkeys() { - for (const i of this.#rindexes()) { - const k = this.#keyList[i]; - if (k !== void 0 && !this.#isBackgroundFetch(this.#valList[i])) { - yield k; - } - } - } - /** - * Return a generator yielding the values in the cache, - * in order from most recently used to least recently used. - */ - *values() { - for (const i of this.#indexes()) { - const v = this.#valList[i]; - if (v !== void 0 && !this.#isBackgroundFetch(this.#valList[i])) { - yield this.#valList[i]; - } - } - } - /** - * Inverse order version of {@link LRUCache.values} - * - * Return a generator yielding the values in the cache, - * in order from least recently used to most recently used. - */ - *rvalues() { - for (const i of this.#rindexes()) { - const v = this.#valList[i]; - if (v !== void 0 && !this.#isBackgroundFetch(this.#valList[i])) { - yield this.#valList[i]; - } - } - } - /** - * Iterating over the cache itself yields the same results as - * {@link LRUCache.entries} - */ - [Symbol.iterator]() { - return this.entries(); - } - /** - * A String value that is used in the creation of the default string - * description of an object. Called by the built-in method - * `Object.prototype.toString`. - */ - [Symbol.toStringTag] = "LRUCache"; - /** - * Find a value for which the supplied fn method returns a truthy value, - * similar to `Array.find()`. fn is called as `fn(value, key, cache)`. - */ - find(fn, getOptions = {}) { - for (const i of this.#indexes()) { - const v = this.#valList[i]; - const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; - if (value === void 0) - continue; - if (fn(value, this.#keyList[i], this)) { - return this.get(this.#keyList[i], getOptions); - } - } - } - /** - * Call the supplied function on each item in the cache, in order from most - * recently used to least recently used. - * - * `fn` is called as `fn(value, key, cache)`. - * - * If `thisp` is provided, function will be called in the `this`-context of - * the provided object, or the cache if no `thisp` object is provided. - * - * Does not update age or recenty of use, or iterate over stale values. - */ - forEach(fn, thisp = this) { - for (const i of this.#indexes()) { - const v = this.#valList[i]; - const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; - if (value === void 0) - continue; - fn.call(thisp, value, this.#keyList[i], this); - } - } - /** - * The same as {@link LRUCache.forEach} but items are iterated over in - * reverse order. (ie, less recently used items are iterated over first.) - */ - rforEach(fn, thisp = this) { - for (const i of this.#rindexes()) { - const v = this.#valList[i]; - const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; - if (value === void 0) - continue; - fn.call(thisp, value, this.#keyList[i], this); - } - } - /** - * Delete any stale entries. Returns true if anything was removed, - * false otherwise. - */ - purgeStale() { - let deleted = false; - for (const i of this.#rindexes({ allowStale: true })) { - if (this.#isStale(i)) { - this.#delete(this.#keyList[i], "expire"); - deleted = true; - } - } - return deleted; - } - /** - * Get the extended info about a given entry, to get its value, size, and - * TTL info simultaneously. Returns `undefined` if the key is not present. - * - * Unlike {@link LRUCache#dump}, which is designed to be portable and survive - * serialization, the `start` value is always the current timestamp, and the - * `ttl` is a calculated remaining time to live (negative if expired). - * - * Always returns stale values, if their info is found in the cache, so be - * sure to check for expirations (ie, a negative {@link LRUCache.Entry#ttl}) - * if relevant. - */ - info(key) { - const i = this.#keyMap.get(key); - if (i === void 0) - return void 0; - const v = this.#valList[i]; - const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; - if (value === void 0) - return void 0; - const entry = { value }; - if (this.#ttls && this.#starts) { - const ttl = this.#ttls[i]; - const start = this.#starts[i]; - if (ttl && start) { - const remain = ttl - (perf.now() - start); - entry.ttl = remain; - entry.start = Date.now(); - } - } - if (this.#sizes) { - entry.size = this.#sizes[i]; - } - return entry; - } - /** - * Return an array of [key, {@link LRUCache.Entry}] tuples which can be - * passed to {@link LRUCache#load}. - * - * The `start` fields are calculated relative to a portable `Date.now()` - * timestamp, even if `performance.now()` is available. - * - * Stale entries are always included in the `dump`, even if - * {@link LRUCache.OptionsBase.allowStale} is false. - * - * Note: this returns an actual array, not a generator, so it can be more - * easily passed around. - */ - dump() { - const arr = []; - for (const i of this.#indexes({ allowStale: true })) { - const key = this.#keyList[i]; - const v = this.#valList[i]; - const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; - if (value === void 0 || key === void 0) - continue; - const entry = { value }; - if (this.#ttls && this.#starts) { - entry.ttl = this.#ttls[i]; - const age = perf.now() - this.#starts[i]; - entry.start = Math.floor(Date.now() - age); - } - if (this.#sizes) { - entry.size = this.#sizes[i]; - } - arr.unshift([key, entry]); - } - return arr; - } - /** - * Reset the cache and load in the items in entries in the order listed. - * - * The shape of the resulting cache may be different if the same options are - * not used in both caches. - * - * The `start` fields are assumed to be calculated relative to a portable - * `Date.now()` timestamp, even if `performance.now()` is available. - */ - load(arr) { - this.clear(); - for (const [key, entry] of arr) { - if (entry.start) { - const age = Date.now() - entry.start; - entry.start = perf.now() - age; - } - this.set(key, entry.value, entry); - } - } - /** - * Add a value to the cache. - * - * Note: if `undefined` is specified as a value, this is an alias for - * {@link LRUCache#delete} - * - * Fields on the {@link LRUCache.SetOptions} options param will override - * their corresponding values in the constructor options for the scope - * of this single `set()` operation. - * - * If `start` is provided, then that will set the effective start - * time for the TTL calculation. Note that this must be a previous - * value of `performance.now()` if supported, or a previous value of - * `Date.now()` if not. - * - * Options object may also include `size`, which will prevent - * calling the `sizeCalculation` function and just use the specified - * number if it is a positive integer, and `noDisposeOnSet` which - * will prevent calling a `dispose` function in the case of - * overwrites. - * - * If the `size` (or return value of `sizeCalculation`) for a given - * entry is greater than `maxEntrySize`, then the item will not be - * added to the cache. - * - * Will update the recency of the entry. - * - * If the value is `undefined`, then this is an alias for - * `cache.delete(key)`. `undefined` is never stored in the cache. - */ - set(k, v, setOptions = {}) { - if (v === void 0) { - this.delete(k); - return this; - } - const { ttl = this.ttl, start, noDisposeOnSet = this.noDisposeOnSet, sizeCalculation = this.sizeCalculation, status } = setOptions; - let { noUpdateTTL = this.noUpdateTTL } = setOptions; - const size = this.#requireSize(k, v, setOptions.size || 0, sizeCalculation); - if (this.maxEntrySize && size > this.maxEntrySize) { - if (status) { - status.set = "miss"; - status.maxEntrySizeExceeded = true; - } - this.#delete(k, "set"); - return this; - } - let index2 = this.#size === 0 ? void 0 : this.#keyMap.get(k); - if (index2 === void 0) { - index2 = this.#size === 0 ? this.#tail : this.#free.length !== 0 ? this.#free.pop() : this.#size === this.#max ? this.#evict(false) : this.#size; - this.#keyList[index2] = k; - this.#valList[index2] = v; - this.#keyMap.set(k, index2); - this.#next[this.#tail] = index2; - this.#prev[index2] = this.#tail; - this.#tail = index2; - this.#size++; - this.#addItemSize(index2, size, status); - if (status) - status.set = "add"; - noUpdateTTL = false; - if (this.#hasOnInsert) { - this.#onInsert?.(v, k, "add"); - } - } else { - this.#moveToTail(index2); - const oldVal = this.#valList[index2]; - if (v !== oldVal) { - if (this.#hasFetchMethod && this.#isBackgroundFetch(oldVal)) { - oldVal.__abortController.abort(new Error("replaced")); - const { __staleWhileFetching: s } = oldVal; - if (s !== void 0 && !noDisposeOnSet) { - if (this.#hasDispose) { - this.#dispose?.(s, k, "set"); - } - if (this.#hasDisposeAfter) { - this.#disposed?.push([s, k, "set"]); - } - } - } else if (!noDisposeOnSet) { - if (this.#hasDispose) { - this.#dispose?.(oldVal, k, "set"); - } - if (this.#hasDisposeAfter) { - this.#disposed?.push([oldVal, k, "set"]); - } - } - this.#removeItemSize(index2); - this.#addItemSize(index2, size, status); - this.#valList[index2] = v; - if (status) { - status.set = "replace"; - const oldValue = oldVal && this.#isBackgroundFetch(oldVal) ? oldVal.__staleWhileFetching : oldVal; - if (oldValue !== void 0) - status.oldValue = oldValue; - } - } else if (status) { - status.set = "update"; - } - if (this.#hasOnInsert) { - this.onInsert?.(v, k, v === oldVal ? "update" : "replace"); - } - } - if (ttl !== 0 && !this.#ttls) { - this.#initializeTTLTracking(); - } - if (this.#ttls) { - if (!noUpdateTTL) { - this.#setItemTTL(index2, ttl, start); - } - if (status) - this.#statusTTL(status, index2); - } - if (!noDisposeOnSet && this.#hasDisposeAfter && this.#disposed) { - const dt = this.#disposed; - let task; - while (task = dt?.shift()) { - this.#disposeAfter?.(...task); - } - } - return this; - } - /** - * Evict the least recently used item, returning its value or - * `undefined` if cache is empty. - */ - pop() { - try { - while (this.#size) { - const val = this.#valList[this.#head]; - this.#evict(true); - if (this.#isBackgroundFetch(val)) { - if (val.__staleWhileFetching) { - return val.__staleWhileFetching; - } - } else if (val !== void 0) { - return val; - } - } - } finally { - if (this.#hasDisposeAfter && this.#disposed) { - const dt = this.#disposed; - let task; - while (task = dt?.shift()) { - this.#disposeAfter?.(...task); - } - } - } - } - #evict(free) { - const head = this.#head; - const k = this.#keyList[head]; - const v = this.#valList[head]; - if (this.#hasFetchMethod && this.#isBackgroundFetch(v)) { - v.__abortController.abort(new Error("evicted")); - } else if (this.#hasDispose || this.#hasDisposeAfter) { - if (this.#hasDispose) { - this.#dispose?.(v, k, "evict"); - } - if (this.#hasDisposeAfter) { - this.#disposed?.push([v, k, "evict"]); - } - } - this.#removeItemSize(head); - if (free) { - this.#keyList[head] = void 0; - this.#valList[head] = void 0; - this.#free.push(head); - } - if (this.#size === 1) { - this.#head = this.#tail = 0; - this.#free.length = 0; - } else { - this.#head = this.#next[head]; - } - this.#keyMap.delete(k); - this.#size--; - return head; - } - /** - * Check if a key is in the cache, without updating the recency of use. - * Will return false if the item is stale, even though it is technically - * in the cache. - * - * Check if a key is in the cache, without updating the recency of - * use. Age is updated if {@link LRUCache.OptionsBase.updateAgeOnHas} is set - * to `true` in either the options or the constructor. - * - * Will return `false` if the item is stale, even though it is technically in - * the cache. The difference can be determined (if it matters) by using a - * `status` argument, and inspecting the `has` field. - * - * Will not update item age unless - * {@link LRUCache.OptionsBase.updateAgeOnHas} is set. - */ - has(k, hasOptions = {}) { - const { updateAgeOnHas = this.updateAgeOnHas, status } = hasOptions; - const index2 = this.#keyMap.get(k); - if (index2 !== void 0) { - const v = this.#valList[index2]; - if (this.#isBackgroundFetch(v) && v.__staleWhileFetching === void 0) { - return false; - } - if (!this.#isStale(index2)) { - if (updateAgeOnHas) { - this.#updateItemAge(index2); - } - if (status) { - status.has = "hit"; - this.#statusTTL(status, index2); - } - return true; - } else if (status) { - status.has = "stale"; - this.#statusTTL(status, index2); - } - } else if (status) { - status.has = "miss"; - } - return false; - } - /** - * Like {@link LRUCache#get} but doesn't update recency or delete stale - * items. - * - * Returns `undefined` if the item is stale, unless - * {@link LRUCache.OptionsBase.allowStale} is set. - */ - peek(k, peekOptions = {}) { - const { allowStale = this.allowStale } = peekOptions; - const index2 = this.#keyMap.get(k); - if (index2 === void 0 || !allowStale && this.#isStale(index2)) { - return; - } - const v = this.#valList[index2]; - return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v; - } - #backgroundFetch(k, index2, options, context5) { - const v = index2 === void 0 ? void 0 : this.#valList[index2]; - if (this.#isBackgroundFetch(v)) { - return v; - } - const ac = new AC(); - const { signal } = options; - signal?.addEventListener("abort", () => ac.abort(signal.reason), { - signal: ac.signal - }); - const fetchOpts = { - signal: ac.signal, - options, - context: context5 - }; - const cb = (v2, updateCache = false) => { - const { aborted } = ac.signal; - const ignoreAbort = options.ignoreFetchAbort && v2 !== void 0; - if (options.status) { - if (aborted && !updateCache) { - options.status.fetchAborted = true; - options.status.fetchError = ac.signal.reason; - if (ignoreAbort) - options.status.fetchAbortIgnored = true; - } else { - options.status.fetchResolved = true; - } - } - if (aborted && !ignoreAbort && !updateCache) { - return fetchFail(ac.signal.reason); - } - const bf2 = p; - if (this.#valList[index2] === p) { - if (v2 === void 0) { - if (bf2.__staleWhileFetching) { - this.#valList[index2] = bf2.__staleWhileFetching; - } else { - this.#delete(k, "fetch"); - } - } else { - if (options.status) - options.status.fetchUpdated = true; - this.set(k, v2, fetchOpts.options); - } - } - return v2; - }; - const eb = (er) => { - if (options.status) { - options.status.fetchRejected = true; - options.status.fetchError = er; - } - return fetchFail(er); - }; - const fetchFail = (er) => { - const { aborted } = ac.signal; - const allowStaleAborted = aborted && options.allowStaleOnFetchAbort; - const allowStale = allowStaleAborted || options.allowStaleOnFetchRejection; - const noDelete = allowStale || options.noDeleteOnFetchRejection; - const bf2 = p; - if (this.#valList[index2] === p) { - const del = !noDelete || bf2.__staleWhileFetching === void 0; - if (del) { - this.#delete(k, "fetch"); - } else if (!allowStaleAborted) { - this.#valList[index2] = bf2.__staleWhileFetching; - } - } - if (allowStale) { - if (options.status && bf2.__staleWhileFetching !== void 0) { - options.status.returnedStale = true; - } - return bf2.__staleWhileFetching; - } else if (bf2.__returned === bf2) { - throw er; - } - }; - const pcall = (res, rej) => { - const fmp = this.#fetchMethod?.(k, v, fetchOpts); - if (fmp && fmp instanceof Promise) { - fmp.then((v2) => res(v2 === void 0 ? void 0 : v2), rej); - } - ac.signal.addEventListener("abort", () => { - if (!options.ignoreFetchAbort || options.allowStaleOnFetchAbort) { - res(void 0); - if (options.allowStaleOnFetchAbort) { - res = (v2) => cb(v2, true); - } - } - }); - }; - if (options.status) - options.status.fetchDispatched = true; - const p = new Promise(pcall).then(cb, eb); - const bf = Object.assign(p, { - __abortController: ac, - __staleWhileFetching: v, - __returned: void 0 - }); - if (index2 === void 0) { - this.set(k, bf, { ...fetchOpts.options, status: void 0 }); - index2 = this.#keyMap.get(k); - } else { - this.#valList[index2] = bf; - } - return bf; - } - #isBackgroundFetch(p) { - if (!this.#hasFetchMethod) - return false; - const b = p; - return !!b && b instanceof Promise && b.hasOwnProperty("__staleWhileFetching") && b.__abortController instanceof AC; - } - async fetch(k, fetchOptions = {}) { - const { - // get options - allowStale = this.allowStale, - updateAgeOnGet = this.updateAgeOnGet, - noDeleteOnStaleGet = this.noDeleteOnStaleGet, - // set options - ttl = this.ttl, - noDisposeOnSet = this.noDisposeOnSet, - size = 0, - sizeCalculation = this.sizeCalculation, - noUpdateTTL = this.noUpdateTTL, - // fetch exclusive options - noDeleteOnFetchRejection = this.noDeleteOnFetchRejection, - allowStaleOnFetchRejection = this.allowStaleOnFetchRejection, - ignoreFetchAbort = this.ignoreFetchAbort, - allowStaleOnFetchAbort = this.allowStaleOnFetchAbort, - context: context5, - forceRefresh = false, - status, - signal - } = fetchOptions; - if (!this.#hasFetchMethod) { - if (status) - status.fetch = "get"; - return this.get(k, { - allowStale, - updateAgeOnGet, - noDeleteOnStaleGet, - status - }); - } - const options = { - allowStale, - updateAgeOnGet, - noDeleteOnStaleGet, - ttl, - noDisposeOnSet, - size, - sizeCalculation, - noUpdateTTL, - noDeleteOnFetchRejection, - allowStaleOnFetchRejection, - allowStaleOnFetchAbort, - ignoreFetchAbort, - status, - signal - }; - let index2 = this.#keyMap.get(k); - if (index2 === void 0) { - if (status) - status.fetch = "miss"; - const p = this.#backgroundFetch(k, index2, options, context5); - return p.__returned = p; - } else { - const v = this.#valList[index2]; - if (this.#isBackgroundFetch(v)) { - const stale = allowStale && v.__staleWhileFetching !== void 0; - if (status) { - status.fetch = "inflight"; - if (stale) - status.returnedStale = true; - } - return stale ? v.__staleWhileFetching : v.__returned = v; - } - const isStale = this.#isStale(index2); - if (!forceRefresh && !isStale) { - if (status) - status.fetch = "hit"; - this.#moveToTail(index2); - if (updateAgeOnGet) { - this.#updateItemAge(index2); - } - if (status) - this.#statusTTL(status, index2); - return v; - } - const p = this.#backgroundFetch(k, index2, options, context5); - const hasStale = p.__staleWhileFetching !== void 0; - const staleVal = hasStale && allowStale; - if (status) { - status.fetch = isStale ? "stale" : "refresh"; - if (staleVal && isStale) - status.returnedStale = true; - } - return staleVal ? p.__staleWhileFetching : p.__returned = p; - } - } - async forceFetch(k, fetchOptions = {}) { - const v = await this.fetch(k, fetchOptions); - if (v === void 0) - throw new Error("fetch() returned undefined"); - return v; - } - memo(k, memoOptions = {}) { - const memoMethod = this.#memoMethod; - if (!memoMethod) { - throw new Error("no memoMethod provided to constructor"); - } - const { context: context5, forceRefresh, ...options } = memoOptions; - const v = this.get(k, options); - if (!forceRefresh && v !== void 0) - return v; - const vv = memoMethod(k, v, { - options, - context: context5 - }); - this.set(k, vv, options); - return vv; - } - /** - * Return a value from the cache. Will update the recency of the cache - * entry found. - * - * If the key is not found, get() will return `undefined`. - */ - get(k, getOptions = {}) { - const { allowStale = this.allowStale, updateAgeOnGet = this.updateAgeOnGet, noDeleteOnStaleGet = this.noDeleteOnStaleGet, status } = getOptions; - const index2 = this.#keyMap.get(k); - if (index2 !== void 0) { - const value = this.#valList[index2]; - const fetching = this.#isBackgroundFetch(value); - if (status) - this.#statusTTL(status, index2); - if (this.#isStale(index2)) { - if (status) - status.get = "stale"; - if (!fetching) { - if (!noDeleteOnStaleGet) { - this.#delete(k, "expire"); - } - if (status && allowStale) - status.returnedStale = true; - return allowStale ? value : void 0; - } else { - if (status && allowStale && value.__staleWhileFetching !== void 0) { - status.returnedStale = true; - } - return allowStale ? value.__staleWhileFetching : void 0; - } - } else { - if (status) - status.get = "hit"; - if (fetching) { - return value.__staleWhileFetching; - } - this.#moveToTail(index2); - if (updateAgeOnGet) { - this.#updateItemAge(index2); - } - return value; - } - } else if (status) { - status.get = "miss"; - } - } - #connect(p, n) { - this.#prev[n] = p; - this.#next[p] = n; - } - #moveToTail(index2) { - if (index2 !== this.#tail) { - if (index2 === this.#head) { - this.#head = this.#next[index2]; - } else { - this.#connect(this.#prev[index2], this.#next[index2]); - } - this.#connect(this.#tail, index2); - this.#tail = index2; - } - } - /** - * Deletes a key out of the cache. - * - * Returns true if the key was deleted, false otherwise. - */ - delete(k) { - return this.#delete(k, "delete"); - } - #delete(k, reason) { - let deleted = false; - if (this.#size !== 0) { - const index2 = this.#keyMap.get(k); - if (index2 !== void 0) { - deleted = true; - if (this.#size === 1) { - this.#clear(reason); - } else { - this.#removeItemSize(index2); - const v = this.#valList[index2]; - if (this.#isBackgroundFetch(v)) { - v.__abortController.abort(new Error("deleted")); - } else if (this.#hasDispose || this.#hasDisposeAfter) { - if (this.#hasDispose) { - this.#dispose?.(v, k, reason); - } - if (this.#hasDisposeAfter) { - this.#disposed?.push([v, k, reason]); - } - } - this.#keyMap.delete(k); - this.#keyList[index2] = void 0; - this.#valList[index2] = void 0; - if (index2 === this.#tail) { - this.#tail = this.#prev[index2]; - } else if (index2 === this.#head) { - this.#head = this.#next[index2]; - } else { - const pi = this.#prev[index2]; - this.#next[pi] = this.#next[index2]; - const ni = this.#next[index2]; - this.#prev[ni] = this.#prev[index2]; - } - this.#size--; - this.#free.push(index2); - } - } - } - if (this.#hasDisposeAfter && this.#disposed?.length) { - const dt = this.#disposed; - let task; - while (task = dt?.shift()) { - this.#disposeAfter?.(...task); - } - } - return deleted; - } - /** - * Clear the cache entirely, throwing away all values. - */ - clear() { - return this.#clear("delete"); - } - #clear(reason) { - for (const index2 of this.#rindexes({ allowStale: true })) { - const v = this.#valList[index2]; - if (this.#isBackgroundFetch(v)) { - v.__abortController.abort(new Error("deleted")); - } else { - const k = this.#keyList[index2]; - if (this.#hasDispose) { - this.#dispose?.(v, k, reason); - } - if (this.#hasDisposeAfter) { - this.#disposed?.push([v, k, reason]); - } - } - } - this.#keyMap.clear(); - this.#valList.fill(void 0); - this.#keyList.fill(void 0); - if (this.#ttls && this.#starts) { - this.#ttls.fill(0); - this.#starts.fill(0); - } - if (this.#sizes) { - this.#sizes.fill(0); - } - this.#head = 0; - this.#tail = 0; - this.#free.length = 0; - this.#calculatedSize = 0; - this.#size = 0; - if (this.#hasDisposeAfter && this.#disposed) { - const dt = this.#disposed; - let task; - while (task = dt?.shift()) { - this.#disposeAfter?.(...task); - } - } - } - }; - exports2.LRUCache = LRUCache; - } -}); - -// node_modules/minipass/dist/commonjs/index.js -var require_commonjs22 = __commonJS({ - "node_modules/minipass/dist/commonjs/index.js"(exports2) { - "use strict"; - var __importDefault2 = exports2 && exports2.__importDefault || function(mod) { - return mod && mod.__esModule ? mod : { "default": mod }; - }; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.Minipass = exports2.isWritable = exports2.isReadable = exports2.isStream = void 0; - var proc = typeof process === "object" && process ? process : { - stdout: null, - stderr: null - }; - var node_events_1 = require("node:events"); - var node_stream_1 = __importDefault2(require("node:stream")); - var node_string_decoder_1 = require("node:string_decoder"); - var isStream2 = (s) => !!s && typeof s === "object" && (s instanceof Minipass || s instanceof node_stream_1.default || (0, exports2.isReadable)(s) || (0, exports2.isWritable)(s)); - exports2.isStream = isStream2; - var isReadable = (s) => !!s && typeof s === "object" && s instanceof node_events_1.EventEmitter && typeof s.pipe === "function" && // node core Writable streams have a pipe() method, but it throws - s.pipe !== node_stream_1.default.Writable.prototype.pipe; - exports2.isReadable = isReadable; - var isWritable = (s) => !!s && typeof s === "object" && s instanceof node_events_1.EventEmitter && typeof s.write === "function" && typeof s.end === "function"; - exports2.isWritable = isWritable; - var EOF2 = /* @__PURE__ */ Symbol("EOF"); - var MAYBE_EMIT_END = /* @__PURE__ */ Symbol("maybeEmitEnd"); - var EMITTED_END = /* @__PURE__ */ Symbol("emittedEnd"); - var EMITTING_END = /* @__PURE__ */ Symbol("emittingEnd"); - var EMITTED_ERROR = /* @__PURE__ */ Symbol("emittedError"); - var CLOSED = /* @__PURE__ */ Symbol("closed"); - var READ = /* @__PURE__ */ Symbol("read"); - var FLUSH = /* @__PURE__ */ Symbol("flush"); - var FLUSHCHUNK = /* @__PURE__ */ Symbol("flushChunk"); - var ENCODING = /* @__PURE__ */ Symbol("encoding"); - var DECODER = /* @__PURE__ */ Symbol("decoder"); - var FLOWING = /* @__PURE__ */ Symbol("flowing"); - var PAUSED = /* @__PURE__ */ Symbol("paused"); - var RESUME = /* @__PURE__ */ Symbol("resume"); - var BUFFER = /* @__PURE__ */ Symbol("buffer"); - var PIPES = /* @__PURE__ */ Symbol("pipes"); - var BUFFERLENGTH = /* @__PURE__ */ Symbol("bufferLength"); - var BUFFERPUSH = /* @__PURE__ */ Symbol("bufferPush"); - var BUFFERSHIFT = /* @__PURE__ */ Symbol("bufferShift"); - var OBJECTMODE = /* @__PURE__ */ Symbol("objectMode"); - var DESTROYED = /* @__PURE__ */ Symbol("destroyed"); - var ERROR = /* @__PURE__ */ Symbol("error"); - var EMITDATA = /* @__PURE__ */ Symbol("emitData"); - var EMITEND = /* @__PURE__ */ Symbol("emitEnd"); - var EMITEND2 = /* @__PURE__ */ Symbol("emitEnd2"); - var ASYNC = /* @__PURE__ */ Symbol("async"); - var ABORT = /* @__PURE__ */ Symbol("abort"); - var ABORTED = /* @__PURE__ */ Symbol("aborted"); - var SIGNAL = /* @__PURE__ */ Symbol("signal"); - var DATALISTENERS = /* @__PURE__ */ Symbol("dataListeners"); - var DISCARDED = /* @__PURE__ */ Symbol("discarded"); - var defer = (fn) => Promise.resolve().then(fn); - var nodefer = (fn) => fn(); - var isEndish = (ev) => ev === "end" || ev === "finish" || ev === "prefinish"; - var isArrayBufferLike = (b) => b instanceof ArrayBuffer || !!b && typeof b === "object" && b.constructor && b.constructor.name === "ArrayBuffer" && b.byteLength >= 0; - var isArrayBufferView = (b) => !Buffer.isBuffer(b) && ArrayBuffer.isView(b); - var Pipe = class { - src; - dest; - opts; - ondrain; - constructor(src, dest, opts) { - this.src = src; - this.dest = dest; - this.opts = opts; - this.ondrain = () => src[RESUME](); - this.dest.on("drain", this.ondrain); - } - unpipe() { - this.dest.removeListener("drain", this.ondrain); - } - // only here for the prototype - /* c8 ignore start */ - proxyErrors(_er) { - } - /* c8 ignore stop */ - end() { - this.unpipe(); - if (this.opts.end) - this.dest.end(); - } - }; - var PipeProxyErrors = class extends Pipe { - unpipe() { - this.src.removeListener("error", this.proxyErrors); - super.unpipe(); - } - constructor(src, dest, opts) { - super(src, dest, opts); - this.proxyErrors = (er) => dest.emit("error", er); - src.on("error", this.proxyErrors); - } - }; - var isObjectModeOptions = (o) => !!o.objectMode; - var isEncodingOptions = (o) => !o.objectMode && !!o.encoding && o.encoding !== "buffer"; - var Minipass = class extends node_events_1.EventEmitter { - [FLOWING] = false; - [PAUSED] = false; - [PIPES] = []; - [BUFFER] = []; - [OBJECTMODE]; - [ENCODING]; - [ASYNC]; - [DECODER]; - [EOF2] = false; - [EMITTED_END] = false; - [EMITTING_END] = false; - [CLOSED] = false; - [EMITTED_ERROR] = null; - [BUFFERLENGTH] = 0; - [DESTROYED] = false; - [SIGNAL]; - [ABORTED] = false; - [DATALISTENERS] = 0; - [DISCARDED] = false; - /** - * true if the stream can be written - */ - writable = true; - /** - * true if the stream can be read - */ - readable = true; - /** - * If `RType` is Buffer, then options do not need to be provided. - * Otherwise, an options object must be provided to specify either - * {@link Minipass.SharedOptions.objectMode} or - * {@link Minipass.SharedOptions.encoding}, as appropriate. - */ - constructor(...args) { - const options = args[0] || {}; - super(); - if (options.objectMode && typeof options.encoding === "string") { - throw new TypeError("Encoding and objectMode may not be used together"); - } - if (isObjectModeOptions(options)) { - this[OBJECTMODE] = true; - this[ENCODING] = null; - } else if (isEncodingOptions(options)) { - this[ENCODING] = options.encoding; - this[OBJECTMODE] = false; - } else { - this[OBJECTMODE] = false; - this[ENCODING] = null; - } - this[ASYNC] = !!options.async; - this[DECODER] = this[ENCODING] ? new node_string_decoder_1.StringDecoder(this[ENCODING]) : null; - if (options && options.debugExposeBuffer === true) { - Object.defineProperty(this, "buffer", { get: () => this[BUFFER] }); - } - if (options && options.debugExposePipes === true) { - Object.defineProperty(this, "pipes", { get: () => this[PIPES] }); - } - const { signal } = options; - if (signal) { - this[SIGNAL] = signal; - if (signal.aborted) { - this[ABORT](); - } else { - signal.addEventListener("abort", () => this[ABORT]()); - } - } - } - /** - * The amount of data stored in the buffer waiting to be read. - * - * For Buffer strings, this will be the total byte length. - * For string encoding streams, this will be the string character length, - * according to JavaScript's `string.length` logic. - * For objectMode streams, this is a count of the items waiting to be - * emitted. - */ - get bufferLength() { - return this[BUFFERLENGTH]; - } - /** - * The `BufferEncoding` currently in use, or `null` - */ - get encoding() { - return this[ENCODING]; - } - /** - * @deprecated - This is a read only property - */ - set encoding(_enc) { - throw new Error("Encoding must be set at instantiation time"); - } - /** - * @deprecated - Encoding may only be set at instantiation time - */ - setEncoding(_enc) { - throw new Error("Encoding must be set at instantiation time"); - } - /** - * True if this is an objectMode stream - */ - get objectMode() { - return this[OBJECTMODE]; - } - /** - * @deprecated - This is a read-only property - */ - set objectMode(_om) { - throw new Error("objectMode must be set at instantiation time"); - } - /** - * true if this is an async stream - */ - get ["async"]() { - return this[ASYNC]; - } - /** - * Set to true to make this stream async. - * - * Once set, it cannot be unset, as this would potentially cause incorrect - * behavior. Ie, a sync stream can be made async, but an async stream - * cannot be safely made sync. - */ - set ["async"](a) { - this[ASYNC] = this[ASYNC] || !!a; - } - // drop everything and get out of the flow completely - [ABORT]() { - this[ABORTED] = true; - this.emit("abort", this[SIGNAL]?.reason); - this.destroy(this[SIGNAL]?.reason); - } - /** - * True if the stream has been aborted. - */ - get aborted() { - return this[ABORTED]; - } - /** - * No-op setter. Stream aborted status is set via the AbortSignal provided - * in the constructor options. - */ - set aborted(_2) { - } - write(chunk, encoding, cb) { - if (this[ABORTED]) - return false; - if (this[EOF2]) - throw new Error("write after end"); - if (this[DESTROYED]) { - this.emit("error", Object.assign(new Error("Cannot call write after a stream was destroyed"), { code: "ERR_STREAM_DESTROYED" })); - return true; - } - if (typeof encoding === "function") { - cb = encoding; - encoding = "utf8"; - } - if (!encoding) - encoding = "utf8"; - const fn = this[ASYNC] ? defer : nodefer; - if (!this[OBJECTMODE] && !Buffer.isBuffer(chunk)) { - if (isArrayBufferView(chunk)) { - chunk = Buffer.from(chunk.buffer, chunk.byteOffset, chunk.byteLength); - } else if (isArrayBufferLike(chunk)) { - chunk = Buffer.from(chunk); - } else if (typeof chunk !== "string") { - throw new Error("Non-contiguous data written to non-objectMode stream"); - } - } - if (this[OBJECTMODE]) { - if (this[FLOWING] && this[BUFFERLENGTH] !== 0) - this[FLUSH](true); - if (this[FLOWING]) - this.emit("data", chunk); - else - this[BUFFERPUSH](chunk); - if (this[BUFFERLENGTH] !== 0) - this.emit("readable"); - if (cb) - fn(cb); - return this[FLOWING]; - } - if (!chunk.length) { - if (this[BUFFERLENGTH] !== 0) - this.emit("readable"); - if (cb) - fn(cb); - return this[FLOWING]; - } - if (typeof chunk === "string" && // unless it is a string already ready for us to use - !(encoding === this[ENCODING] && !this[DECODER]?.lastNeed)) { - chunk = Buffer.from(chunk, encoding); - } - if (Buffer.isBuffer(chunk) && this[ENCODING]) { - chunk = this[DECODER].write(chunk); - } - if (this[FLOWING] && this[BUFFERLENGTH] !== 0) - this[FLUSH](true); - if (this[FLOWING]) - this.emit("data", chunk); - else - this[BUFFERPUSH](chunk); - if (this[BUFFERLENGTH] !== 0) - this.emit("readable"); - if (cb) - fn(cb); - return this[FLOWING]; - } - /** - * Low-level explicit read method. - * - * In objectMode, the argument is ignored, and one item is returned if - * available. - * - * `n` is the number of bytes (or in the case of encoding streams, - * characters) to consume. If `n` is not provided, then the entire buffer - * is returned, or `null` is returned if no data is available. - * - * If `n` is greater that the amount of data in the internal buffer, - * then `null` is returned. - */ - read(n) { - if (this[DESTROYED]) - return null; - this[DISCARDED] = false; - if (this[BUFFERLENGTH] === 0 || n === 0 || n && n > this[BUFFERLENGTH]) { - this[MAYBE_EMIT_END](); - return null; - } - if (this[OBJECTMODE]) - n = null; - if (this[BUFFER].length > 1 && !this[OBJECTMODE]) { - this[BUFFER] = [ - this[ENCODING] ? this[BUFFER].join("") : Buffer.concat(this[BUFFER], this[BUFFERLENGTH]) - ]; - } - const ret = this[READ](n || null, this[BUFFER][0]); - this[MAYBE_EMIT_END](); - return ret; - } - [READ](n, chunk) { - if (this[OBJECTMODE]) - this[BUFFERSHIFT](); - else { - const c = chunk; - if (n === c.length || n === null) - this[BUFFERSHIFT](); - else if (typeof c === "string") { - this[BUFFER][0] = c.slice(n); - chunk = c.slice(0, n); - this[BUFFERLENGTH] -= n; - } else { - this[BUFFER][0] = c.subarray(n); - chunk = c.subarray(0, n); - this[BUFFERLENGTH] -= n; - } - } - this.emit("data", chunk); - if (!this[BUFFER].length && !this[EOF2]) - this.emit("drain"); - return chunk; - } - end(chunk, encoding, cb) { - if (typeof chunk === "function") { - cb = chunk; - chunk = void 0; - } - if (typeof encoding === "function") { - cb = encoding; - encoding = "utf8"; - } - if (chunk !== void 0) - this.write(chunk, encoding); - if (cb) - this.once("end", cb); - this[EOF2] = true; - this.writable = false; - if (this[FLOWING] || !this[PAUSED]) - this[MAYBE_EMIT_END](); - return this; - } - // don't let the internal resume be overwritten - [RESUME]() { - if (this[DESTROYED]) - return; - if (!this[DATALISTENERS] && !this[PIPES].length) { - this[DISCARDED] = true; - } - this[PAUSED] = false; - this[FLOWING] = true; - this.emit("resume"); - if (this[BUFFER].length) - this[FLUSH](); - else if (this[EOF2]) - this[MAYBE_EMIT_END](); - else - this.emit("drain"); - } - /** - * Resume the stream if it is currently in a paused state - * - * If called when there are no pipe destinations or `data` event listeners, - * this will place the stream in a "discarded" state, where all data will - * be thrown away. The discarded state is removed if a pipe destination or - * data handler is added, if pause() is called, or if any synchronous or - * asynchronous iteration is started. - */ - resume() { - return this[RESUME](); - } - /** - * Pause the stream - */ - pause() { - this[FLOWING] = false; - this[PAUSED] = true; - this[DISCARDED] = false; - } - /** - * true if the stream has been forcibly destroyed - */ - get destroyed() { - return this[DESTROYED]; - } - /** - * true if the stream is currently in a flowing state, meaning that - * any writes will be immediately emitted. - */ - get flowing() { - return this[FLOWING]; - } - /** - * true if the stream is currently in a paused state - */ - get paused() { - return this[PAUSED]; - } - [BUFFERPUSH](chunk) { - if (this[OBJECTMODE]) - this[BUFFERLENGTH] += 1; - else - this[BUFFERLENGTH] += chunk.length; - this[BUFFER].push(chunk); - } - [BUFFERSHIFT]() { - if (this[OBJECTMODE]) - this[BUFFERLENGTH] -= 1; - else - this[BUFFERLENGTH] -= this[BUFFER][0].length; - return this[BUFFER].shift(); - } - [FLUSH](noDrain = false) { - do { - } while (this[FLUSHCHUNK](this[BUFFERSHIFT]()) && this[BUFFER].length); - if (!noDrain && !this[BUFFER].length && !this[EOF2]) - this.emit("drain"); - } - [FLUSHCHUNK](chunk) { - this.emit("data", chunk); - return this[FLOWING]; - } - /** - * Pipe all data emitted by this stream into the destination provided. - * - * Triggers the flow of data. - */ - pipe(dest, opts) { - if (this[DESTROYED]) - return dest; - this[DISCARDED] = false; - const ended = this[EMITTED_END]; - opts = opts || {}; - if (dest === proc.stdout || dest === proc.stderr) - opts.end = false; - else - opts.end = opts.end !== false; - opts.proxyErrors = !!opts.proxyErrors; - if (ended) { - if (opts.end) - dest.end(); - } else { - this[PIPES].push(!opts.proxyErrors ? new Pipe(this, dest, opts) : new PipeProxyErrors(this, dest, opts)); - if (this[ASYNC]) - defer(() => this[RESUME]()); - else - this[RESUME](); - } - return dest; - } - /** - * Fully unhook a piped destination stream. - * - * If the destination stream was the only consumer of this stream (ie, - * there are no other piped destinations or `'data'` event listeners) - * then the flow of data will stop until there is another consumer or - * {@link Minipass#resume} is explicitly called. - */ - unpipe(dest) { - const p = this[PIPES].find((p2) => p2.dest === dest); - if (p) { - if (this[PIPES].length === 1) { - if (this[FLOWING] && this[DATALISTENERS] === 0) { - this[FLOWING] = false; - } - this[PIPES] = []; - } else - this[PIPES].splice(this[PIPES].indexOf(p), 1); - p.unpipe(); - } - } - /** - * Alias for {@link Minipass#on} - */ - addListener(ev, handler2) { - return this.on(ev, handler2); - } - /** - * Mostly identical to `EventEmitter.on`, with the following - * behavior differences to prevent data loss and unnecessary hangs: - * - * - Adding a 'data' event handler will trigger the flow of data - * - * - Adding a 'readable' event handler when there is data waiting to be read - * will cause 'readable' to be emitted immediately. - * - * - Adding an 'endish' event handler ('end', 'finish', etc.) which has - * already passed will cause the event to be emitted immediately and all - * handlers removed. - * - * - Adding an 'error' event handler after an error has been emitted will - * cause the event to be re-emitted immediately with the error previously - * raised. - */ - on(ev, handler2) { - const ret = super.on(ev, handler2); - if (ev === "data") { - this[DISCARDED] = false; - this[DATALISTENERS]++; - if (!this[PIPES].length && !this[FLOWING]) { - this[RESUME](); - } - } else if (ev === "readable" && this[BUFFERLENGTH] !== 0) { - super.emit("readable"); - } else if (isEndish(ev) && this[EMITTED_END]) { - super.emit(ev); - this.removeAllListeners(ev); - } else if (ev === "error" && this[EMITTED_ERROR]) { - const h = handler2; - if (this[ASYNC]) - defer(() => h.call(this, this[EMITTED_ERROR])); - else - h.call(this, this[EMITTED_ERROR]); - } - return ret; - } - /** - * Alias for {@link Minipass#off} - */ - removeListener(ev, handler2) { - return this.off(ev, handler2); - } - /** - * Mostly identical to `EventEmitter.off` - * - * If a 'data' event handler is removed, and it was the last consumer - * (ie, there are no pipe destinations or other 'data' event listeners), - * then the flow of data will stop until there is another consumer or - * {@link Minipass#resume} is explicitly called. - */ - off(ev, handler2) { - const ret = super.off(ev, handler2); - if (ev === "data") { - this[DATALISTENERS] = this.listeners("data").length; - if (this[DATALISTENERS] === 0 && !this[DISCARDED] && !this[PIPES].length) { - this[FLOWING] = false; - } - } - return ret; - } - /** - * Mostly identical to `EventEmitter.removeAllListeners` - * - * If all 'data' event handlers are removed, and they were the last consumer - * (ie, there are no pipe destinations), then the flow of data will stop - * until there is another consumer or {@link Minipass#resume} is explicitly - * called. - */ - removeAllListeners(ev) { - const ret = super.removeAllListeners(ev); - if (ev === "data" || ev === void 0) { - this[DATALISTENERS] = 0; - if (!this[DISCARDED] && !this[PIPES].length) { - this[FLOWING] = false; - } - } - return ret; - } - /** - * true if the 'end' event has been emitted - */ - get emittedEnd() { - return this[EMITTED_END]; - } - [MAYBE_EMIT_END]() { - if (!this[EMITTING_END] && !this[EMITTED_END] && !this[DESTROYED] && this[BUFFER].length === 0 && this[EOF2]) { - this[EMITTING_END] = true; - this.emit("end"); - this.emit("prefinish"); - this.emit("finish"); - if (this[CLOSED]) - this.emit("close"); - this[EMITTING_END] = false; - } - } - /** - * Mostly identical to `EventEmitter.emit`, with the following - * behavior differences to prevent data loss and unnecessary hangs: - * - * If the stream has been destroyed, and the event is something other - * than 'close' or 'error', then `false` is returned and no handlers - * are called. - * - * If the event is 'end', and has already been emitted, then the event - * is ignored. If the stream is in a paused or non-flowing state, then - * the event will be deferred until data flow resumes. If the stream is - * async, then handlers will be called on the next tick rather than - * immediately. - * - * If the event is 'close', and 'end' has not yet been emitted, then - * the event will be deferred until after 'end' is emitted. - * - * If the event is 'error', and an AbortSignal was provided for the stream, - * and there are no listeners, then the event is ignored, matching the - * behavior of node core streams in the presense of an AbortSignal. - * - * If the event is 'finish' or 'prefinish', then all listeners will be - * removed after emitting the event, to prevent double-firing. - */ - emit(ev, ...args) { - const data = args[0]; - if (ev !== "error" && ev !== "close" && ev !== DESTROYED && this[DESTROYED]) { - return false; - } else if (ev === "data") { - return !this[OBJECTMODE] && !data ? false : this[ASYNC] ? (defer(() => this[EMITDATA](data)), true) : this[EMITDATA](data); - } else if (ev === "end") { - return this[EMITEND](); - } else if (ev === "close") { - this[CLOSED] = true; - if (!this[EMITTED_END] && !this[DESTROYED]) - return false; - const ret2 = super.emit("close"); - this.removeAllListeners("close"); - return ret2; - } else if (ev === "error") { - this[EMITTED_ERROR] = data; - super.emit(ERROR, data); - const ret2 = !this[SIGNAL] || this.listeners("error").length ? super.emit("error", data) : false; - this[MAYBE_EMIT_END](); - return ret2; - } else if (ev === "resume") { - const ret2 = super.emit("resume"); - this[MAYBE_EMIT_END](); - return ret2; - } else if (ev === "finish" || ev === "prefinish") { - const ret2 = super.emit(ev); - this.removeAllListeners(ev); - return ret2; - } - const ret = super.emit(ev, ...args); - this[MAYBE_EMIT_END](); - return ret; - } - [EMITDATA](data) { - for (const p of this[PIPES]) { - if (p.dest.write(data) === false) - this.pause(); - } - const ret = this[DISCARDED] ? false : super.emit("data", data); - this[MAYBE_EMIT_END](); - return ret; - } - [EMITEND]() { - if (this[EMITTED_END]) - return false; - this[EMITTED_END] = true; - this.readable = false; - return this[ASYNC] ? (defer(() => this[EMITEND2]()), true) : this[EMITEND2](); - } - [EMITEND2]() { - if (this[DECODER]) { - const data = this[DECODER].end(); - if (data) { - for (const p of this[PIPES]) { - p.dest.write(data); - } - if (!this[DISCARDED]) - super.emit("data", data); - } - } - for (const p of this[PIPES]) { - p.end(); - } - const ret = super.emit("end"); - this.removeAllListeners("end"); - return ret; - } - /** - * Return a Promise that resolves to an array of all emitted data once - * the stream ends. - */ - async collect() { - const buf = Object.assign([], { - dataLength: 0 - }); - if (!this[OBJECTMODE]) - buf.dataLength = 0; - const p = this.promise(); - this.on("data", (c) => { - buf.push(c); - if (!this[OBJECTMODE]) - buf.dataLength += c.length; - }); - await p; - return buf; - } - /** - * Return a Promise that resolves to the concatenation of all emitted data - * once the stream ends. - * - * Not allowed on objectMode streams. - */ - async concat() { - if (this[OBJECTMODE]) { - throw new Error("cannot concat in objectMode"); - } - const buf = await this.collect(); - return this[ENCODING] ? buf.join("") : Buffer.concat(buf, buf.dataLength); - } - /** - * Return a void Promise that resolves once the stream ends. - */ - async promise() { - return new Promise((resolve14, reject) => { - this.on(DESTROYED, () => reject(new Error("stream destroyed"))); - this.on("error", (er) => reject(er)); - this.on("end", () => resolve14()); - }); - } - /** - * Asynchronous `for await of` iteration. - * - * This will continue emitting all chunks until the stream terminates. - */ - [Symbol.asyncIterator]() { - this[DISCARDED] = false; - let stopped = false; - const stop = async () => { - this.pause(); - stopped = true; - return { value: void 0, done: true }; - }; - const next = () => { - if (stopped) - return stop(); - const res = this.read(); - if (res !== null) - return Promise.resolve({ done: false, value: res }); - if (this[EOF2]) - return stop(); - let resolve14; - let reject; - const onerr = (er) => { - this.off("data", ondata); - this.off("end", onend); - this.off(DESTROYED, ondestroy); - stop(); - reject(er); - }; - const ondata = (value) => { - this.off("error", onerr); - this.off("end", onend); - this.off(DESTROYED, ondestroy); - this.pause(); - resolve14({ value, done: !!this[EOF2] }); - }; - const onend = () => { - this.off("error", onerr); - this.off("data", ondata); - this.off(DESTROYED, ondestroy); - stop(); - resolve14({ done: true, value: void 0 }); - }; - const ondestroy = () => onerr(new Error("stream destroyed")); - return new Promise((res2, rej) => { - reject = rej; - resolve14 = res2; - this.once(DESTROYED, ondestroy); - this.once("error", onerr); - this.once("end", onend); - this.once("data", ondata); - }); - }; - return { - next, - throw: stop, - return: stop, - [Symbol.asyncIterator]() { - return this; + slashSplit(t) { + return this.preserveMultipleSlashes ? t.split("/") : this.isWindows && /^\/\/[^\/]+/.test(t) ? ["", ...t.split(/\/+/)] : t.split(/\/+/); + } + match(t, e = this.partial) { + if (this.debug("match", t, this.pattern), this.comment) return false; + if (this.empty) return t === ""; + if (t === "/" && e) return true; + let s = this.options; + this.isWindows && (t = t.split("\\").join("/")); + let i = this.slashSplit(t); + this.debug(this.pattern, "split", i); + let r = this.set; + this.debug(this.pattern, "set", r); + let h = i[i.length - 1]; + if (!h) for (let o = i.length - 2; !h && o >= 0; o--) h = i[o]; + for (let o = 0; o < r.length; o++) { + let a = r[o], l = i; + if (s.matchBase && a.length === 1 && (l = [h]), this.matchOne(l, a, e)) return s.flipNegate ? true : !this.negate; + } + return s.flipNegate ? false : this.negate; + } + static defaults(t) { + return g.minimatch.defaults(t).Minimatch; + } + }; + g.Minimatch = J; + var Zi = pe(); + Object.defineProperty(g, "AST", { enumerable: true, get: function() { + return Zi.AST; + } }); + var Qi = me(); + Object.defineProperty(g, "escape", { enumerable: true, get: function() { + return Qi.escape; + } }); + var tr = kt(); + Object.defineProperty(g, "unescape", { enumerable: true, get: function() { + return tr.unescape; + } }); + g.minimatch.AST = is.AST; + g.minimatch.Minimatch = J; + g.minimatch.escape = vi.escape; + g.minimatch.unescape = Ei.unescape; + }); + var fs31 = R((Wt) => { + "use strict"; + Object.defineProperty(Wt, "__esModule", { value: true }); + Wt.LRUCache = void 0; + var er = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date, as = /* @__PURE__ */ new Set(), ge = typeof process == "object" && process ? process : {}, ls = (n, t, e, s) => { + typeof ge.emitWarning == "function" ? ge.emitWarning(n, t, e, s) : console.error(`[${e}] ${t}: ${n}`); + }, Lt = globalThis.AbortController, os7 = globalThis.AbortSignal; + if (typeof Lt > "u") { + os7 = class { + onabort; + _onabort = []; + reason; + aborted = false; + addEventListener(e, s) { + this._onabort.push(s); + } + }, Lt = class { + constructor() { + t(); + } + signal = new os7(); + abort(e) { + if (!this.signal.aborted) { + this.signal.reason = e, this.signal.aborted = true; + for (let s of this.signal._onabort) s(e); + this.signal.onabort?.(e); + } } }; - } - /** - * Synchronous `for of` iteration. - * - * The iteration will terminate when the internal buffer runs out, even - * if the stream has not yet terminated. - */ - [Symbol.iterator]() { - this[DISCARDED] = false; - let stopped = false; - const stop = () => { - this.pause(); - this.off(ERROR, stop); - this.off(DESTROYED, stop); - this.off("end", stop); - stopped = true; - return { done: true, value: void 0 }; - }; - const next = () => { - if (stopped) - return stop(); - const value = this.read(); - return value === null ? stop() : { done: false, value }; - }; - this.once("end", stop); - this.once(ERROR, stop); - this.once(DESTROYED, stop); - return { - next, - throw: stop, - return: stop, - [Symbol.iterator]() { - return this; - } + let n = ge.env?.LRU_CACHE_IGNORE_AC_WARNING !== "1", t = () => { + n && (n = false, ls("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)); }; } - /** - * Destroy a stream, preventing it from being used for any further purpose. - * - * If the stream has a `close()` method, then it will be called on - * destruction. - * - * After destruction, any attempt to write data, read data, or emit most - * events will be ignored. - * - * If an error argument is provided, then it will be emitted in an - * 'error' event. - */ - destroy(er) { - if (this[DESTROYED]) { - if (er) - this.emit("error", er); - else - this.emit(DESTROYED); - return this; - } - this[DESTROYED] = true; - this[DISCARDED] = true; - this[BUFFER].length = 0; - this[BUFFERLENGTH] = 0; - const wc = this; - if (typeof wc.close === "function" && !this[CLOSED]) - wc.close(); - if (er) - this.emit("error", er); - else - this.emit(DESTROYED); - return this; - } - /** - * Alias for {@link isStream} - * - * Former export location, maintained for backwards compatibility. - * - * @deprecated - */ - static get isStream() { - return exports2.isStream; - } - }; - exports2.Minipass = Minipass; - } -}); - -// node_modules/path-scurry/dist/commonjs/index.js -var require_commonjs23 = __commonJS({ - "node_modules/path-scurry/dist/commonjs/index.js"(exports2) { - "use strict"; - var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { - return m[k]; - } }; - } - Object.defineProperty(o, k2, desc); - }) : (function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - o[k2] = m[k]; - })); - var __setModuleDefault2 = exports2 && exports2.__setModuleDefault || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - }) : function(o, v) { - o["default"] = v; - }); - var __importStar2 = exports2 && exports2.__importStar || function(mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) { - for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding2(result, mod, k); - } - __setModuleDefault2(result, mod); - return result; - }; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.PathScurry = exports2.Path = exports2.PathScurryDarwin = exports2.PathScurryPosix = exports2.PathScurryWin32 = exports2.PathScurryBase = exports2.PathPosix = exports2.PathWin32 = exports2.PathBase = exports2.ChildrenCache = exports2.ResolveCache = void 0; - var lru_cache_1 = require_commonjs21(); - var node_path_1 = require("node:path"); - var node_url_1 = require("node:url"); - var fs_1 = require("fs"); - var actualFS = __importStar2(require("node:fs")); - var realpathSync = fs_1.realpathSync.native; - var promises_1 = require("node:fs/promises"); - var minipass_1 = require_commonjs22(); - var defaultFS = { - lstatSync: fs_1.lstatSync, - readdir: fs_1.readdir, - readdirSync: fs_1.readdirSync, - readlinkSync: fs_1.readlinkSync, - realpathSync, - promises: { - lstat: promises_1.lstat, - readdir: promises_1.readdir, - readlink: promises_1.readlink, - realpath: promises_1.realpath - } - }; - var fsFromOption = (fsOption) => !fsOption || fsOption === defaultFS || fsOption === actualFS ? defaultFS : { - ...defaultFS, - ...fsOption, - promises: { - ...defaultFS.promises, - ...fsOption.promises || {} - } - }; - var uncDriveRegexp = /^\\\\\?\\([a-z]:)\\?$/i; - var uncToDrive = (rootPath) => rootPath.replace(/\//g, "\\").replace(uncDriveRegexp, "$1\\"); - var eitherSep = /[\\\/]/; - var UNKNOWN = 0; - var IFIFO = 1; - var IFCHR = 2; - var IFDIR = 4; - var IFBLK = 6; - var IFREG = 8; - var IFLNK = 10; - var IFSOCK = 12; - var IFMT = 15; - var IFMT_UNKNOWN = ~IFMT; - var READDIR_CALLED = 16; - var LSTAT_CALLED = 32; - var ENOTDIR = 64; - var ENOENT = 128; - var ENOREADLINK = 256; - var ENOREALPATH = 512; - var ENOCHILD = ENOTDIR | ENOENT | ENOREALPATH; - var TYPEMASK = 1023; - var entToType = (s) => s.isFile() ? IFREG : s.isDirectory() ? IFDIR : s.isSymbolicLink() ? IFLNK : s.isCharacterDevice() ? IFCHR : s.isBlockDevice() ? IFBLK : s.isSocket() ? IFSOCK : s.isFIFO() ? IFIFO : UNKNOWN; - var normalizeCache = /* @__PURE__ */ new Map(); - var normalize3 = (s) => { - const c = normalizeCache.get(s); - if (c) - return c; - const n = s.normalize("NFKD"); - normalizeCache.set(s, n); - return n; - }; - var normalizeNocaseCache = /* @__PURE__ */ new Map(); - var normalizeNocase = (s) => { - const c = normalizeNocaseCache.get(s); - if (c) - return c; - const n = normalize3(s.toLowerCase()); - normalizeNocaseCache.set(s, n); - return n; - }; - var ResolveCache = class extends lru_cache_1.LRUCache { - constructor() { - super({ max: 256 }); - } - }; - exports2.ResolveCache = ResolveCache; - var ChildrenCache = class extends lru_cache_1.LRUCache { - constructor(maxSize = 16 * 1024) { - super({ - maxSize, - // parent + children - sizeCalculation: (a) => a.length + 1 - }); - } - }; - exports2.ChildrenCache = ChildrenCache; - var setAsCwd = /* @__PURE__ */ Symbol("PathScurry setAsCwd"); - var PathBase = class { - /** - * the basename of this path - * - * **Important**: *always* test the path name against any test string - * usingthe {@link isNamed} method, and not by directly comparing this - * string. Otherwise, unicode path strings that the system sees as identical - * will not be properly treated as the same path, leading to incorrect - * behavior and possible security issues. - */ - name; - /** - * the Path entry corresponding to the path root. - * - * @internal - */ - root; - /** - * All roots found within the current PathScurry family - * - * @internal - */ - roots; - /** - * a reference to the parent path, or undefined in the case of root entries - * - * @internal - */ - parent; - /** - * boolean indicating whether paths are compared case-insensitively - * @internal - */ - nocase; - /** - * boolean indicating that this path is the current working directory - * of the PathScurry collection that contains it. - */ - isCWD = false; - // potential default fs override - #fs; - // Stats fields - #dev; - get dev() { - return this.#dev; - } - #mode; - get mode() { - return this.#mode; - } - #nlink; - get nlink() { - return this.#nlink; - } - #uid; - get uid() { - return this.#uid; - } - #gid; - get gid() { - return this.#gid; - } - #rdev; - get rdev() { - return this.#rdev; - } - #blksize; - get blksize() { - return this.#blksize; - } - #ino; - get ino() { - return this.#ino; - } - #size; - get size() { - return this.#size; - } - #blocks; - get blocks() { - return this.#blocks; - } - #atimeMs; - get atimeMs() { - return this.#atimeMs; - } - #mtimeMs; - get mtimeMs() { - return this.#mtimeMs; - } - #ctimeMs; - get ctimeMs() { - return this.#ctimeMs; - } - #birthtimeMs; - get birthtimeMs() { - return this.#birthtimeMs; - } - #atime; - get atime() { - return this.#atime; - } - #mtime; - get mtime() { - return this.#mtime; - } - #ctime; - get ctime() { - return this.#ctime; - } - #birthtime; - get birthtime() { - return this.#birthtime; - } - #matchName; - #depth; - #fullpath; - #fullpathPosix; - #relative; - #relativePosix; - #type; - #children; - #linkTarget; - #realpath; - /** - * This property is for compatibility with the Dirent class as of - * Node v20, where Dirent['parentPath'] refers to the path of the - * directory that was passed to readdir. For root entries, it's the path - * to the entry itself. - */ - get parentPath() { - return (this.parent || this).fullpath(); - } - /** - * Deprecated alias for Dirent['parentPath'] Somewhat counterintuitively, - * this property refers to the *parent* path, not the path object itself. - * - * @deprecated - */ - get path() { - return this.parentPath; - } - /** - * Do not create new Path objects directly. They should always be accessed - * via the PathScurry class or other methods on the Path class. - * - * @internal - */ - constructor(name, type = UNKNOWN, root, roots, nocase, children, opts) { - this.name = name; - this.#matchName = nocase ? normalizeNocase(name) : normalize3(name); - this.#type = type & TYPEMASK; - this.nocase = nocase; - this.roots = roots; - this.root = root || this; - this.#children = children; - this.#fullpath = opts.fullpath; - this.#relative = opts.relative; - this.#relativePosix = opts.relativePosix; - this.parent = opts.parent; - if (this.parent) { - this.#fs = this.parent.#fs; - } else { - this.#fs = fsFromOption(opts.fs); - } - } - /** - * Returns the depth of the Path object from its root. - * - * For example, a path at `/foo/bar` would have a depth of 2. - */ - depth() { - if (this.#depth !== void 0) - return this.#depth; - if (!this.parent) - return this.#depth = 0; - return this.#depth = this.parent.depth() + 1; - } - /** - * @internal - */ - childrenCache() { - return this.#children; - } - /** - * Get the Path object referenced by the string path, resolved from this Path - */ - resolve(path29) { - if (!path29) { - return this; - } - const rootPath = this.getRootString(path29); - const dir = path29.substring(rootPath.length); - const dirParts = dir.split(this.splitSep); - const result = rootPath ? this.getRoot(rootPath).#resolveParts(dirParts) : this.#resolveParts(dirParts); - return result; - } - #resolveParts(dirParts) { - let p = this; - for (const part of dirParts) { - p = p.child(part); - } - return p; - } - /** - * Returns the cached children Path objects, if still available. If they - * have fallen out of the cache, then returns an empty array, and resets the - * READDIR_CALLED bit, so that future calls to readdir() will require an fs - * lookup. - * - * @internal - */ - children() { - const cached = this.#children.get(this); - if (cached) { - return cached; - } - const children = Object.assign([], { provisional: 0 }); - this.#children.set(this, children); - this.#type &= ~READDIR_CALLED; - return children; - } - /** - * Resolves a path portion and returns or creates the child Path. - * - * Returns `this` if pathPart is `''` or `'.'`, or `parent` if pathPart is - * `'..'`. - * - * This should not be called directly. If `pathPart` contains any path - * separators, it will lead to unsafe undefined behavior. - * - * Use `Path.resolve()` instead. - * - * @internal - */ - child(pathPart, opts) { - if (pathPart === "" || pathPart === ".") { - return this; - } - if (pathPart === "..") { - return this.parent || this; - } - const children = this.children(); - const name = this.nocase ? normalizeNocase(pathPart) : normalize3(pathPart); - for (const p of children) { - if (p.#matchName === name) { - return p; - } - } - const s = this.parent ? this.sep : ""; - const fullpath = this.#fullpath ? this.#fullpath + s + pathPart : void 0; - const pchild = this.newChild(pathPart, UNKNOWN, { - ...opts, - parent: this, - fullpath - }); - if (!this.canReaddir()) { - pchild.#type |= ENOENT; - } - children.push(pchild); - return pchild; - } - /** - * The relative path from the cwd. If it does not share an ancestor with - * the cwd, then this ends up being equivalent to the fullpath() - */ - relative() { - if (this.isCWD) - return ""; - if (this.#relative !== void 0) { - return this.#relative; - } - const name = this.name; - const p = this.parent; - if (!p) { - return this.#relative = this.name; - } - const pv = p.relative(); - return pv + (!pv || !p.parent ? "" : this.sep) + name; - } - /** - * The relative path from the cwd, using / as the path separator. - * If it does not share an ancestor with - * the cwd, then this ends up being equivalent to the fullpathPosix() - * On posix systems, this is identical to relative(). - */ - relativePosix() { - if (this.sep === "/") - return this.relative(); - if (this.isCWD) - return ""; - if (this.#relativePosix !== void 0) - return this.#relativePosix; - const name = this.name; - const p = this.parent; - if (!p) { - return this.#relativePosix = this.fullpathPosix(); - } - const pv = p.relativePosix(); - return pv + (!pv || !p.parent ? "" : "/") + name; - } - /** - * The fully resolved path string for this Path entry - */ - fullpath() { - if (this.#fullpath !== void 0) { - return this.#fullpath; + var sr = (n) => !as.has(n), V = (n) => n && n === Math.floor(n) && n > 0 && isFinite(n), cs = (n) => V(n) ? n <= Math.pow(2, 8) ? Uint8Array : n <= Math.pow(2, 16) ? Uint16Array : n <= Math.pow(2, 32) ? Uint32Array : n <= Number.MAX_SAFE_INTEGER ? Nt : null : null, Nt = class extends Array { + constructor(n) { + super(n), this.fill(0); } - const name = this.name; - const p = this.parent; - if (!p) { - return this.#fullpath = this.name; + }, ir = class at { + heap; + length; + static #t = false; + static create(t) { + let e = cs(t); + if (!e) return []; + at.#t = true; + let s = new at(t, e); + return at.#t = false, s; } - const pv = p.fullpath(); - const fp = pv + (!p.parent ? "" : this.sep) + name; - return this.#fullpath = fp; - } - /** - * On platforms other than windows, this is identical to fullpath. - * - * On windows, this is overridden to return the forward-slash form of the - * full UNC path. - */ - fullpathPosix() { - if (this.#fullpathPosix !== void 0) - return this.#fullpathPosix; - if (this.sep === "/") - return this.#fullpathPosix = this.fullpath(); - if (!this.parent) { - const p2 = this.fullpath().replace(/\\/g, "/"); - if (/^[a-z]:\//i.test(p2)) { - return this.#fullpathPosix = `//?/${p2}`; - } else { - return this.#fullpathPosix = p2; - } + constructor(t, e) { + if (!at.#t) throw new TypeError("instantiate Stack using Stack.create(n)"); + this.heap = new e(t), this.length = 0; } - const p = this.parent; - const pfpp = p.fullpathPosix(); - const fpp = pfpp + (!pfpp || !p.parent ? "" : "/") + this.name; - return this.#fullpathPosix = fpp; - } - /** - * Is the Path of an unknown type? - * - * Note that we might know *something* about it if there has been a previous - * filesystem operation, for example that it does not exist, or is not a - * link, or whether it has child entries. - */ - isUnknown() { - return (this.#type & IFMT) === UNKNOWN; - } - isType(type) { - return this[`is${type}`](); - } - getType() { - return this.isUnknown() ? "Unknown" : this.isDirectory() ? "Directory" : this.isFile() ? "File" : this.isSymbolicLink() ? "SymbolicLink" : this.isFIFO() ? "FIFO" : this.isCharacterDevice() ? "CharacterDevice" : this.isBlockDevice() ? "BlockDevice" : ( - /* c8 ignore start */ - this.isSocket() ? "Socket" : "Unknown" - ); - } - /** - * Is the Path a regular file? - */ - isFile() { - return (this.#type & IFMT) === IFREG; - } - /** - * Is the Path a directory? - */ - isDirectory() { - return (this.#type & IFMT) === IFDIR; - } - /** - * Is the path a character device? - */ - isCharacterDevice() { - return (this.#type & IFMT) === IFCHR; - } - /** - * Is the path a block device? - */ - isBlockDevice() { - return (this.#type & IFMT) === IFBLK; - } - /** - * Is the path a FIFO pipe? - */ - isFIFO() { - return (this.#type & IFMT) === IFIFO; - } - /** - * Is the path a socket? - */ - isSocket() { - return (this.#type & IFMT) === IFSOCK; - } - /** - * Is the path a symbolic link? - */ - isSymbolicLink() { - return (this.#type & IFLNK) === IFLNK; - } - /** - * Return the entry if it has been subject of a successful lstat, or - * undefined otherwise. - * - * Does not read the filesystem, so an undefined result *could* simply - * mean that we haven't called lstat on it. - */ - lstatCached() { - return this.#type & LSTAT_CALLED ? this : void 0; - } - /** - * Return the cached link target if the entry has been the subject of a - * successful readlink, or undefined otherwise. - * - * Does not read the filesystem, so an undefined result *could* just mean we - * don't have any cached data. Only use it if you are very sure that a - * readlink() has been called at some point. - */ - readlinkCached() { - return this.#linkTarget; - } - /** - * Returns the cached realpath target if the entry has been the subject - * of a successful realpath, or undefined otherwise. - * - * Does not read the filesystem, so an undefined result *could* just mean we - * don't have any cached data. Only use it if you are very sure that a - * realpath() has been called at some point. - */ - realpathCached() { - return this.#realpath; - } - /** - * Returns the cached child Path entries array if the entry has been the - * subject of a successful readdir(), or [] otherwise. - * - * Does not read the filesystem, so an empty array *could* just mean we - * don't have any cached data. Only use it if you are very sure that a - * readdir() has been called recently enough to still be valid. - */ - readdirCached() { - const children = this.children(); - return children.slice(0, children.provisional); - } - /** - * Return true if it's worth trying to readlink. Ie, we don't (yet) have - * any indication that readlink will definitely fail. - * - * Returns false if the path is known to not be a symlink, if a previous - * readlink failed, or if the entry does not exist. - */ - canReadlink() { - if (this.#linkTarget) - return true; - if (!this.parent) - return false; - const ifmt = this.#type & IFMT; - return !(ifmt !== UNKNOWN && ifmt !== IFLNK || this.#type & ENOREADLINK || this.#type & ENOENT); - } - /** - * Return true if readdir has previously been successfully called on this - * path, indicating that cachedReaddir() is likely valid. - */ - calledReaddir() { - return !!(this.#type & READDIR_CALLED); - } - /** - * Returns true if the path is known to not exist. That is, a previous lstat - * or readdir failed to verify its existence when that would have been - * expected, or a parent entry was marked either enoent or enotdir. - */ - isENOENT() { - return !!(this.#type & ENOENT); - } - /** - * Return true if the path is a match for the given path name. This handles - * case sensitivity and unicode normalization. - * - * Note: even on case-sensitive systems, it is **not** safe to test the - * equality of the `.name` property to determine whether a given pathname - * matches, due to unicode normalization mismatches. - * - * Always use this method instead of testing the `path.name` property - * directly. - */ - isNamed(n) { - return !this.nocase ? this.#matchName === normalize3(n) : this.#matchName === normalizeNocase(n); - } - /** - * Return the Path object corresponding to the target of a symbolic link. - * - * If the Path is not a symbolic link, or if the readlink call fails for any - * reason, `undefined` is returned. - * - * Result is cached, and thus may be outdated if the filesystem is mutated. - */ - async readlink() { - const target = this.#linkTarget; - if (target) { - return target; + push(t) { + this.heap[this.length++] = t; } - if (!this.canReadlink()) { - return void 0; + pop() { + return this.heap[--this.length]; + } + }, rr = class us { + #t; + #s; + #n; + #r; + #h; + #S; + #w; + #c; + get perf() { + return this.#c; + } + ttl; + ttlResolution; + ttlAutopurge; + updateAgeOnGet; + updateAgeOnHas; + allowStale; + noDisposeOnSet; + noUpdateTTL; + maxEntrySize; + sizeCalculation; + noDeleteOnFetchRejection; + noDeleteOnStaleGet; + allowStaleOnFetchAbort; + allowStaleOnFetchRejection; + ignoreFetchAbort; + #o; + #f; + #u; + #a; + #i; + #d; + #v; + #y; + #p; + #R; + #m; + #O; + #x; + #g; + #b; + #E; + #T; + #e; + #F; + static unsafeExposeInternals(t) { + return { starts: t.#x, ttls: t.#g, autopurgeTimers: t.#b, sizes: t.#O, keyMap: t.#u, keyList: t.#a, valList: t.#i, next: t.#d, prev: t.#v, get head() { + return t.#y; + }, get tail() { + return t.#p; + }, free: t.#R, isBackgroundFetch: (e) => t.#l(e), backgroundFetch: (e, s, i, r) => t.#z(e, s, i, r), moveToTail: (e) => t.#N(e), indexes: (e) => t.#k(e), rindexes: (e) => t.#M(e), isStale: (e) => t.#_(e) }; + } + get max() { + return this.#t; + } + get maxSize() { + return this.#s; + } + get calculatedSize() { + return this.#f; } - if (!this.parent) { - return void 0; + get size() { + return this.#o; + } + get fetchMethod() { + return this.#S; + } + get memoMethod() { + return this.#w; + } + get dispose() { + return this.#n; + } + get onInsert() { + return this.#r; + } + get disposeAfter() { + return this.#h; + } + constructor(t) { + let { max: e = 0, ttl: s, ttlResolution: i = 1, ttlAutopurge: r, updateAgeOnGet: h, updateAgeOnHas: o, allowStale: a, dispose: l, onInsert: f, disposeAfter: c, noDisposeOnSet: d, noUpdateTTL: u, maxSize: m = 0, maxEntrySize: p = 0, sizeCalculation: b, fetchMethod: w, memoMethod: v, noDeleteOnFetchRejection: E, noDeleteOnStaleGet: y, allowStaleOnFetchRejection: S, allowStaleOnFetchAbort: B, ignoreFetchAbort: U, perf: et } = t; + if (et !== void 0 && typeof et?.now != "function") throw new TypeError("perf option must have a now() method if specified"); + if (this.#c = et ?? er, e !== 0 && !V(e)) throw new TypeError("max option must be a nonnegative integer"); + let st = e ? cs(e) : Array; + if (!st) throw new Error("invalid max value: " + e); + if (this.#t = e, this.#s = m, this.maxEntrySize = p || this.#s, this.sizeCalculation = b, this.sizeCalculation) { + if (!this.#s && !this.maxEntrySize) throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize"); + if (typeof this.sizeCalculation != "function") throw new TypeError("sizeCalculation set to non-function"); + } + if (v !== void 0 && typeof v != "function") throw new TypeError("memoMethod must be a function if defined"); + if (this.#w = v, w !== void 0 && typeof w != "function") throw new TypeError("fetchMethod must be a function if specified"); + if (this.#S = w, this.#T = !!w, this.#u = /* @__PURE__ */ new Map(), this.#a = new Array(e).fill(void 0), this.#i = new Array(e).fill(void 0), this.#d = new st(e), this.#v = new st(e), this.#y = 0, this.#p = 0, this.#R = ir.create(e), this.#o = 0, this.#f = 0, typeof l == "function" && (this.#n = l), typeof f == "function" && (this.#r = f), typeof c == "function" ? (this.#h = c, this.#m = []) : (this.#h = void 0, this.#m = void 0), this.#E = !!this.#n, this.#F = !!this.#r, this.#e = !!this.#h, this.noDisposeOnSet = !!d, this.noUpdateTTL = !!u, this.noDeleteOnFetchRejection = !!E, this.allowStaleOnFetchRejection = !!S, this.allowStaleOnFetchAbort = !!B, this.ignoreFetchAbort = !!U, this.maxEntrySize !== 0) { + if (this.#s !== 0 && !V(this.#s)) throw new TypeError("maxSize must be a positive integer if specified"); + if (!V(this.maxEntrySize)) throw new TypeError("maxEntrySize must be a positive integer if specified"); + this.#$(); + } + if (this.allowStale = !!a, this.noDeleteOnStaleGet = !!y, this.updateAgeOnGet = !!h, this.updateAgeOnHas = !!o, this.ttlResolution = V(i) || i === 0 ? i : 1, this.ttlAutopurge = !!r, this.ttl = s || 0, this.ttl) { + if (!V(this.ttl)) throw new TypeError("ttl must be a positive integer if specified"); + this.#P(); + } + if (this.#t === 0 && this.ttl === 0 && this.#s === 0) throw new TypeError("At least one of max, maxSize, or ttl is required"); + if (!this.ttlAutopurge && !this.#t && !this.#s) { + let le = "LRU_CACHE_UNBOUNDED"; + sr(le) && (as.add(le), ls("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.", "UnboundedCacheWarning", le, us)); + } + } + getRemainingTTL(t) { + return this.#u.has(t) ? 1 / 0 : 0; + } + #P() { + let t = new Nt(this.#t), e = new Nt(this.#t); + this.#g = t, this.#x = e; + let s = this.ttlAutopurge ? new Array(this.#t) : void 0; + this.#b = s, this.#W = (h, o, a = this.#c.now()) => { + if (e[h] = o !== 0 ? a : 0, t[h] = o, s?.[h] && (clearTimeout(s[h]), s[h] = void 0), o !== 0 && s) { + let l = setTimeout(() => { + this.#_(h) && this.#A(this.#a[h], "expire"); + }, o + 1); + l.unref && l.unref(), s[h] = l; + } + }, this.#C = (h) => { + e[h] = t[h] !== 0 ? this.#c.now() : 0; + }, this.#D = (h, o) => { + if (t[o]) { + let a = t[o], l = e[o]; + if (!a || !l) return; + h.ttl = a, h.start = l, h.now = i || r(); + let f = h.now - l; + h.remainingTTL = a - f; + } + }; + let i = 0, r = () => { + let h = this.#c.now(); + if (this.ttlResolution > 0) { + i = h; + let o = setTimeout(() => i = 0, this.ttlResolution); + o.unref && o.unref(); + } + return h; + }; + this.getRemainingTTL = (h) => { + let o = this.#u.get(h); + if (o === void 0) return 0; + let a = t[o], l = e[o]; + if (!a || !l) return 1 / 0; + let f = (i || r()) - l; + return a - f; + }, this.#_ = (h) => { + let o = e[h], a = t[h]; + return !!a && !!o && (i || r()) - o > a; + }; } - try { - const read = await this.#fs.promises.readlink(this.fullpath()); - const linkTarget = (await this.parent.realpath())?.resolve(read); - if (linkTarget) { - return this.#linkTarget = linkTarget; - } - } catch (er) { - this.#readlinkFail(er.code); - return void 0; + #C = () => { + }; + #D = () => { + }; + #W = () => { + }; + #_ = () => false; + #$() { + let t = new Nt(this.#t); + this.#f = 0, this.#O = t, this.#L = (e) => { + this.#f -= t[e], t[e] = 0; + }, this.#B = (e, s, i, r) => { + if (this.#l(s)) return 0; + if (!V(i)) if (r) { + if (typeof r != "function") throw new TypeError("sizeCalculation must be a function"); + if (i = r(s, e), !V(i)) throw new TypeError("sizeCalculation return invalid (expect positive integer)"); + } else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set."); + return i; + }, this.#j = (e, s, i) => { + if (t[e] = s, this.#s) { + let r = this.#s - t[e]; + for (; this.#f > r; ) this.#G(true); + } + this.#f += t[e], i && (i.entrySize = s, i.totalCalculatedSize = this.#f); + }; } - } - /** - * Synchronous {@link PathBase.readlink} - */ - readlinkSync() { - const target = this.#linkTarget; - if (target) { - return target; + #L = (t) => { + }; + #j = (t, e, s) => { + }; + #B = (t, e, s, i) => { + if (s || i) throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache"); + return 0; + }; + *#k({ allowStale: t = this.allowStale } = {}) { + if (this.#o) for (let e = this.#p; !(!this.#I(e) || ((t || !this.#_(e)) && (yield e), e === this.#y)); ) e = this.#v[e]; } - if (!this.canReadlink()) { - return void 0; + *#M({ allowStale: t = this.allowStale } = {}) { + if (this.#o) for (let e = this.#y; !(!this.#I(e) || ((t || !this.#_(e)) && (yield e), e === this.#p)); ) e = this.#d[e]; } - if (!this.parent) { - return void 0; + #I(t) { + return t !== void 0 && this.#u.get(this.#a[t]) === t; } - try { - const read = this.#fs.readlinkSync(this.fullpath()); - const linkTarget = this.parent.realpathSync()?.resolve(read); - if (linkTarget) { - return this.#linkTarget = linkTarget; + *entries() { + for (let t of this.#k()) this.#i[t] !== void 0 && this.#a[t] !== void 0 && !this.#l(this.#i[t]) && (yield [this.#a[t], this.#i[t]]); + } + *rentries() { + for (let t of this.#M()) this.#i[t] !== void 0 && this.#a[t] !== void 0 && !this.#l(this.#i[t]) && (yield [this.#a[t], this.#i[t]]); + } + *keys() { + for (let t of this.#k()) { + let e = this.#a[t]; + e !== void 0 && !this.#l(this.#i[t]) && (yield e); } - } catch (er) { - this.#readlinkFail(er.code); - return void 0; } - } - #readdirSuccess(children) { - this.#type |= READDIR_CALLED; - for (let p = children.provisional; p < children.length; p++) { - const c = children[p]; - if (c) - c.#markENOENT(); + *rkeys() { + for (let t of this.#M()) { + let e = this.#a[t]; + e !== void 0 && !this.#l(this.#i[t]) && (yield e); + } } - } - #markENOENT() { - if (this.#type & ENOENT) - return; - this.#type = (this.#type | ENOENT) & IFMT_UNKNOWN; - this.#markChildrenENOENT(); - } - #markChildrenENOENT() { - const children = this.children(); - children.provisional = 0; - for (const p of children) { - p.#markENOENT(); + *values() { + for (let t of this.#k()) this.#i[t] !== void 0 && !this.#l(this.#i[t]) && (yield this.#i[t]); } - } - #markENOREALPATH() { - this.#type |= ENOREALPATH; - this.#markENOTDIR(); - } - // save the information when we know the entry is not a dir - #markENOTDIR() { - if (this.#type & ENOTDIR) - return; - let t = this.#type; - if ((t & IFMT) === IFDIR) - t &= IFMT_UNKNOWN; - this.#type = t | ENOTDIR; - this.#markChildrenENOENT(); - } - #readdirFail(code = "") { - if (code === "ENOTDIR" || code === "EPERM") { - this.#markENOTDIR(); - } else if (code === "ENOENT") { - this.#markENOENT(); - } else { - this.children().provisional = 0; + *rvalues() { + for (let t of this.#M()) this.#i[t] !== void 0 && !this.#l(this.#i[t]) && (yield this.#i[t]); } - } - #lstatFail(code = "") { - if (code === "ENOTDIR") { - const p = this.parent; - p.#markENOTDIR(); - } else if (code === "ENOENT") { - this.#markENOENT(); + [Symbol.iterator]() { + return this.entries(); } - } - #readlinkFail(code = "") { - let ter = this.#type; - ter |= ENOREADLINK; - if (code === "ENOENT") - ter |= ENOENT; - if (code === "EINVAL" || code === "UNKNOWN") { - ter &= IFMT_UNKNOWN; + [Symbol.toStringTag] = "LRUCache"; + find(t, e = {}) { + for (let s of this.#k()) { + let i = this.#i[s], r = this.#l(i) ? i.__staleWhileFetching : i; + if (r !== void 0 && t(r, this.#a[s], this)) return this.get(this.#a[s], e); + } } - this.#type = ter; - if (code === "ENOTDIR" && this.parent) { - this.parent.#markENOTDIR(); + forEach(t, e = this) { + for (let s of this.#k()) { + let i = this.#i[s], r = this.#l(i) ? i.__staleWhileFetching : i; + r !== void 0 && t.call(e, r, this.#a[s], this); + } } - } - #readdirAddChild(e, c) { - return this.#readdirMaybePromoteChild(e, c) || this.#readdirAddNewChild(e, c); - } - #readdirAddNewChild(e, c) { - const type = entToType(e); - const child = this.newChild(e.name, type, { parent: this }); - const ifmt = child.#type & IFMT; - if (ifmt !== IFDIR && ifmt !== IFLNK && ifmt !== UNKNOWN) { - child.#type |= ENOTDIR; + rforEach(t, e = this) { + for (let s of this.#M()) { + let i = this.#i[s], r = this.#l(i) ? i.__staleWhileFetching : i; + r !== void 0 && t.call(e, r, this.#a[s], this); + } } - c.unshift(child); - c.provisional++; - return child; - } - #readdirMaybePromoteChild(e, c) { - for (let p = c.provisional; p < c.length; p++) { - const pchild = c[p]; - const name = this.nocase ? normalizeNocase(e.name) : normalize3(e.name); - if (name !== pchild.#matchName) { - continue; + purgeStale() { + let t = false; + for (let e of this.#M({ allowStale: true })) this.#_(e) && (this.#A(this.#a[e], "expire"), t = true); + return t; + } + info(t) { + let e = this.#u.get(t); + if (e === void 0) return; + let s = this.#i[e], i = this.#l(s) ? s.__staleWhileFetching : s; + if (i === void 0) return; + let r = { value: i }; + if (this.#g && this.#x) { + let h = this.#g[e], o = this.#x[e]; + if (h && o) { + let a = h - (this.#c.now() - o); + r.ttl = a, r.start = Date.now(); + } } - return this.#readdirPromoteChild(e, pchild, p, c); + return this.#O && (r.size = this.#O[e]), r; } - } - #readdirPromoteChild(e, p, index2, c) { - const v = p.name; - p.#type = p.#type & IFMT_UNKNOWN | entToType(e); - if (v !== e.name) - p.name = e.name; - if (index2 !== c.provisional) { - if (index2 === c.length - 1) - c.pop(); - else - c.splice(index2, 1); - c.unshift(p); + dump() { + let t = []; + for (let e of this.#k({ allowStale: true })) { + let s = this.#a[e], i = this.#i[e], r = this.#l(i) ? i.__staleWhileFetching : i; + if (r === void 0 || s === void 0) continue; + let h = { value: r }; + if (this.#g && this.#x) { + h.ttl = this.#g[e]; + let o = this.#c.now() - this.#x[e]; + h.start = Math.floor(Date.now() - o); + } + this.#O && (h.size = this.#O[e]), t.unshift([s, h]); + } + return t; } - c.provisional++; - return p; - } - /** - * Call lstat() on this Path, and update all known information that can be - * determined. - * - * Note that unlike `fs.lstat()`, the returned value does not contain some - * information, such as `mode`, `dev`, `nlink`, and `ino`. If that - * information is required, you will need to call `fs.lstat` yourself. - * - * If the Path refers to a nonexistent file, or if the lstat call fails for - * any reason, `undefined` is returned. Otherwise the updated Path object is - * returned. - * - * Results are cached, and thus may be out of date if the filesystem is - * mutated. - */ - async lstat() { - if ((this.#type & ENOENT) === 0) { - try { - this.#applyStat(await this.#fs.promises.lstat(this.fullpath())); - return this; - } catch (er) { - this.#lstatFail(er.code); + load(t) { + this.clear(); + for (let [e, s] of t) { + if (s.start) { + let i = Date.now() - s.start; + s.start = this.#c.now() - i; + } + this.set(e, s.value, s); } } - } - /** - * synchronous {@link PathBase.lstat} - */ - lstatSync() { - if ((this.#type & ENOENT) === 0) { + set(t, e, s = {}) { + if (e === void 0) return this.delete(t), this; + let { ttl: i = this.ttl, start: r, noDisposeOnSet: h = this.noDisposeOnSet, sizeCalculation: o = this.sizeCalculation, status: a } = s, { noUpdateTTL: l = this.noUpdateTTL } = s, f = this.#B(t, e, s.size || 0, o); + if (this.maxEntrySize && f > this.maxEntrySize) return a && (a.set = "miss", a.maxEntrySizeExceeded = true), this.#A(t, "set"), this; + let c = this.#o === 0 ? void 0 : this.#u.get(t); + if (c === void 0) c = this.#o === 0 ? this.#p : this.#R.length !== 0 ? this.#R.pop() : this.#o === this.#t ? this.#G(false) : this.#o, this.#a[c] = t, this.#i[c] = e, this.#u.set(t, c), this.#d[this.#p] = c, this.#v[c] = this.#p, this.#p = c, this.#o++, this.#j(c, f, a), a && (a.set = "add"), l = false, this.#F && this.#r?.(e, t, "add"); + else { + this.#N(c); + let d = this.#i[c]; + if (e !== d) { + if (this.#T && this.#l(d)) { + d.__abortController.abort(new Error("replaced")); + let { __staleWhileFetching: u } = d; + u !== void 0 && !h && (this.#E && this.#n?.(u, t, "set"), this.#e && this.#m?.push([u, t, "set"])); + } else h || (this.#E && this.#n?.(d, t, "set"), this.#e && this.#m?.push([d, t, "set"])); + if (this.#L(c), this.#j(c, f, a), this.#i[c] = e, a) { + a.set = "replace"; + let u = d && this.#l(d) ? d.__staleWhileFetching : d; + u !== void 0 && (a.oldValue = u); + } + } else a && (a.set = "update"); + this.#F && this.onInsert?.(e, t, e === d ? "update" : "replace"); + } + if (i !== 0 && !this.#g && this.#P(), this.#g && (l || this.#W(c, i, r), a && this.#D(a, c)), !h && this.#e && this.#m) { + let d = this.#m, u; + for (; u = d?.shift(); ) this.#h?.(...u); + } + return this; + } + pop() { try { - this.#applyStat(this.#fs.lstatSync(this.fullpath())); - return this; - } catch (er) { - this.#lstatFail(er.code); - } - } - } - #applyStat(st) { - const { atime, atimeMs, birthtime, birthtimeMs, blksize, blocks, ctime, ctimeMs, dev, gid, ino, mode, mtime, mtimeMs, nlink, rdev, size, uid } = st; - this.#atime = atime; - this.#atimeMs = atimeMs; - this.#birthtime = birthtime; - this.#birthtimeMs = birthtimeMs; - this.#blksize = blksize; - this.#blocks = blocks; - this.#ctime = ctime; - this.#ctimeMs = ctimeMs; - this.#dev = dev; - this.#gid = gid; - this.#ino = ino; - this.#mode = mode; - this.#mtime = mtime; - this.#mtimeMs = mtimeMs; - this.#nlink = nlink; - this.#rdev = rdev; - this.#size = size; - this.#uid = uid; - const ifmt = entToType(st); - this.#type = this.#type & IFMT_UNKNOWN | ifmt | LSTAT_CALLED; - if (ifmt !== UNKNOWN && ifmt !== IFDIR && ifmt !== IFLNK) { - this.#type |= ENOTDIR; - } - } - #onReaddirCB = []; - #readdirCBInFlight = false; - #callOnReaddirCB(children) { - this.#readdirCBInFlight = false; - const cbs = this.#onReaddirCB.slice(); - this.#onReaddirCB.length = 0; - cbs.forEach((cb) => cb(null, children)); - } - /** - * Standard node-style callback interface to get list of directory entries. - * - * If the Path cannot or does not contain any children, then an empty array - * is returned. - * - * Results are cached, and thus may be out of date if the filesystem is - * mutated. - * - * @param cb The callback called with (er, entries). Note that the `er` - * param is somewhat extraneous, as all readdir() errors are handled and - * simply result in an empty set of entries being returned. - * @param allowZalgo Boolean indicating that immediately known results should - * *not* be deferred with `queueMicrotask`. Defaults to `false`. Release - * zalgo at your peril, the dark pony lord is devious and unforgiving. - */ - readdirCB(cb, allowZalgo = false) { - if (!this.canReaddir()) { - if (allowZalgo) - cb(null, []); - else - queueMicrotask(() => cb(null, [])); - return; + for (; this.#o; ) { + let t = this.#i[this.#y]; + if (this.#G(true), this.#l(t)) { + if (t.__staleWhileFetching) return t.__staleWhileFetching; + } else if (t !== void 0) return t; + } + } finally { + if (this.#e && this.#m) { + let t = this.#m, e; + for (; e = t?.shift(); ) this.#h?.(...e); + } + } } - const children = this.children(); - if (this.calledReaddir()) { - const c = children.slice(0, children.provisional); - if (allowZalgo) - cb(null, c); - else - queueMicrotask(() => cb(null, c)); - return; + #G(t) { + let e = this.#y, s = this.#a[e], i = this.#i[e]; + return this.#T && this.#l(i) ? i.__abortController.abort(new Error("evicted")) : (this.#E || this.#e) && (this.#E && this.#n?.(i, s, "evict"), this.#e && this.#m?.push([i, s, "evict"])), this.#L(e), this.#b?.[e] && (clearTimeout(this.#b[e]), this.#b[e] = void 0), t && (this.#a[e] = void 0, this.#i[e] = void 0, this.#R.push(e)), this.#o === 1 ? (this.#y = this.#p = 0, this.#R.length = 0) : this.#y = this.#d[e], this.#u.delete(s), this.#o--, e; } - this.#onReaddirCB.push(cb); - if (this.#readdirCBInFlight) { - return; + has(t, e = {}) { + let { updateAgeOnHas: s = this.updateAgeOnHas, status: i } = e, r = this.#u.get(t); + if (r !== void 0) { + let h = this.#i[r]; + if (this.#l(h) && h.__staleWhileFetching === void 0) return false; + if (this.#_(r)) i && (i.has = "stale", this.#D(i, r)); + else return s && this.#C(r), i && (i.has = "hit", this.#D(i, r)), true; + } else i && (i.has = "miss"); + return false; } - this.#readdirCBInFlight = true; - const fullpath = this.fullpath(); - this.#fs.readdir(fullpath, { withFileTypes: true }, (er, entries) => { - if (er) { - this.#readdirFail(er.code); - children.provisional = 0; + peek(t, e = {}) { + let { allowStale: s = this.allowStale } = e, i = this.#u.get(t); + if (i === void 0 || !s && this.#_(i)) return; + let r = this.#i[i]; + return this.#l(r) ? r.__staleWhileFetching : r; + } + #z(t, e, s, i) { + let r = e === void 0 ? void 0 : this.#i[e]; + if (this.#l(r)) return r; + let h = new Lt(), { signal: o } = s; + o?.addEventListener("abort", () => h.abort(o.reason), { signal: h.signal }); + let a = { signal: h.signal, options: s, context: i }, l = (p, b = false) => { + let { aborted: w } = h.signal, v = s.ignoreFetchAbort && p !== void 0, E = s.ignoreFetchAbort || !!(s.allowStaleOnFetchAbort && p !== void 0); + if (s.status && (w && !b ? (s.status.fetchAborted = true, s.status.fetchError = h.signal.reason, v && (s.status.fetchAbortIgnored = true)) : s.status.fetchResolved = true), w && !v && !b) return c(h.signal.reason, E); + let y = u, S = this.#i[e]; + return (S === u || v && b && S === void 0) && (p === void 0 ? y.__staleWhileFetching !== void 0 ? this.#i[e] = y.__staleWhileFetching : this.#A(t, "fetch") : (s.status && (s.status.fetchUpdated = true), this.set(t, p, a.options))), p; + }, f = (p) => (s.status && (s.status.fetchRejected = true, s.status.fetchError = p), c(p, false)), c = (p, b) => { + let { aborted: w } = h.signal, v = w && s.allowStaleOnFetchAbort, E = v || s.allowStaleOnFetchRejection, y = E || s.noDeleteOnFetchRejection, S = u; + if (this.#i[e] === u && (!y || !b && S.__staleWhileFetching === void 0 ? this.#A(t, "fetch") : v || (this.#i[e] = S.__staleWhileFetching)), E) return s.status && S.__staleWhileFetching !== void 0 && (s.status.returnedStale = true), S.__staleWhileFetching; + if (S.__returned === S) throw p; + }, d = (p, b) => { + let w = this.#S?.(t, r, a); + w && w instanceof Promise && w.then((v) => p(v === void 0 ? void 0 : v), b), h.signal.addEventListener("abort", () => { + (!s.ignoreFetchAbort || s.allowStaleOnFetchAbort) && (p(void 0), s.allowStaleOnFetchAbort && (p = (v) => l(v, true))); + }); + }; + s.status && (s.status.fetchDispatched = true); + let u = new Promise(d).then(l, f), m = Object.assign(u, { __abortController: h, __staleWhileFetching: r, __returned: void 0 }); + return e === void 0 ? (this.set(t, m, { ...a.options, status: void 0 }), e = this.#u.get(t)) : this.#i[e] = m, m; + } + #l(t) { + if (!this.#T) return false; + let e = t; + return !!e && e instanceof Promise && e.hasOwnProperty("__staleWhileFetching") && e.__abortController instanceof Lt; + } + async fetch(t, e = {}) { + let { allowStale: s = this.allowStale, updateAgeOnGet: i = this.updateAgeOnGet, noDeleteOnStaleGet: r = this.noDeleteOnStaleGet, ttl: h = this.ttl, noDisposeOnSet: o = this.noDisposeOnSet, size: a = 0, sizeCalculation: l = this.sizeCalculation, noUpdateTTL: f = this.noUpdateTTL, noDeleteOnFetchRejection: c = this.noDeleteOnFetchRejection, allowStaleOnFetchRejection: d = this.allowStaleOnFetchRejection, ignoreFetchAbort: u = this.ignoreFetchAbort, allowStaleOnFetchAbort: m = this.allowStaleOnFetchAbort, context: p, forceRefresh: b = false, status: w, signal: v } = e; + if (!this.#T) return w && (w.fetch = "get"), this.get(t, { allowStale: s, updateAgeOnGet: i, noDeleteOnStaleGet: r, status: w }); + let E = { allowStale: s, updateAgeOnGet: i, noDeleteOnStaleGet: r, ttl: h, noDisposeOnSet: o, size: a, sizeCalculation: l, noUpdateTTL: f, noDeleteOnFetchRejection: c, allowStaleOnFetchRejection: d, allowStaleOnFetchAbort: m, ignoreFetchAbort: u, status: w, signal: v }, y = this.#u.get(t); + if (y === void 0) { + w && (w.fetch = "miss"); + let S = this.#z(t, y, E, p); + return S.__returned = S; } else { - for (const e of entries) { - this.#readdirAddChild(e, children); + let S = this.#i[y]; + if (this.#l(S)) { + let st = s && S.__staleWhileFetching !== void 0; + return w && (w.fetch = "inflight", st && (w.returnedStale = true)), st ? S.__staleWhileFetching : S.__returned = S; } - this.#readdirSuccess(children); + let B = this.#_(y); + if (!b && !B) return w && (w.fetch = "hit"), this.#N(y), i && this.#C(y), w && this.#D(w, y), S; + let U = this.#z(t, y, E, p), et = U.__staleWhileFetching !== void 0 && s; + return w && (w.fetch = B ? "stale" : "refresh", et && B && (w.returnedStale = true)), et ? U.__staleWhileFetching : U.__returned = U; } - this.#callOnReaddirCB(children.slice(0, children.provisional)); - return; - }); - } - #asyncReaddirInFlight; - /** - * Return an array of known child entries. - * - * If the Path cannot or does not contain any children, then an empty array - * is returned. - * - * Results are cached, and thus may be out of date if the filesystem is - * mutated. - */ - async readdir() { - if (!this.canReaddir()) { - return []; } - const children = this.children(); - if (this.calledReaddir()) { - return children.slice(0, children.provisional); + async forceFetch(t, e = {}) { + let s = await this.fetch(t, e); + if (s === void 0) throw new Error("fetch() returned undefined"); + return s; } - const fullpath = this.fullpath(); - if (this.#asyncReaddirInFlight) { - await this.#asyncReaddirInFlight; - } else { - let resolve14 = () => { - }; - this.#asyncReaddirInFlight = new Promise((res) => resolve14 = res); - try { - for (const e of await this.#fs.promises.readdir(fullpath, { - withFileTypes: true - })) { - this.#readdirAddChild(e, children); + memo(t, e = {}) { + let s = this.#w; + if (!s) throw new Error("no memoMethod provided to constructor"); + let { context: i, forceRefresh: r, ...h } = e, o = this.get(t, h); + if (!r && o !== void 0) return o; + let a = s(t, o, { options: h, context: i }); + return this.set(t, a, h), a; + } + get(t, e = {}) { + let { allowStale: s = this.allowStale, updateAgeOnGet: i = this.updateAgeOnGet, noDeleteOnStaleGet: r = this.noDeleteOnStaleGet, status: h } = e, o = this.#u.get(t); + if (o !== void 0) { + let a = this.#i[o], l = this.#l(a); + return h && this.#D(h, o), this.#_(o) ? (h && (h.get = "stale"), l ? (h && s && a.__staleWhileFetching !== void 0 && (h.returnedStale = true), s ? a.__staleWhileFetching : void 0) : (r || this.#A(t, "expire"), h && s && (h.returnedStale = true), s ? a : void 0)) : (h && (h.get = "hit"), l ? a.__staleWhileFetching : (this.#N(o), i && this.#C(o), a)); + } else h && (h.get = "miss"); + } + #U(t, e) { + this.#v[e] = t, this.#d[t] = e; + } + #N(t) { + t !== this.#p && (t === this.#y ? this.#y = this.#d[t] : this.#U(this.#v[t], this.#d[t]), this.#U(this.#p, t), this.#p = t); + } + delete(t) { + return this.#A(t, "delete"); + } + #A(t, e) { + let s = false; + if (this.#o !== 0) { + let i = this.#u.get(t); + if (i !== void 0) if (this.#b?.[i] && (clearTimeout(this.#b?.[i]), this.#b[i] = void 0), s = true, this.#o === 1) this.#q(e); + else { + this.#L(i); + let r = this.#i[i]; + if (this.#l(r) ? r.__abortController.abort(new Error("deleted")) : (this.#E || this.#e) && (this.#E && this.#n?.(r, t, e), this.#e && this.#m?.push([r, t, e])), this.#u.delete(t), this.#a[i] = void 0, this.#i[i] = void 0, i === this.#p) this.#p = this.#v[i]; + else if (i === this.#y) this.#y = this.#d[i]; + else { + let h = this.#v[i]; + this.#d[h] = this.#d[i]; + let o = this.#d[i]; + this.#v[o] = this.#v[i]; + } + this.#o--, this.#R.push(i); } - this.#readdirSuccess(children); - } catch (er) { - this.#readdirFail(er.code); - children.provisional = 0; } - this.#asyncReaddirInFlight = void 0; - resolve14(); + if (this.#e && this.#m?.length) { + let i = this.#m, r; + for (; r = i?.shift(); ) this.#h?.(...r); + } + return s; } - return children.slice(0, children.provisional); - } - /** - * synchronous {@link PathBase.readdir} - */ - readdirSync() { - if (!this.canReaddir()) { - return []; + clear() { + return this.#q("delete"); } - const children = this.children(); - if (this.calledReaddir()) { - return children.slice(0, children.provisional); + #q(t) { + for (let e of this.#M({ allowStale: true })) { + let s = this.#i[e]; + if (this.#l(s)) s.__abortController.abort(new Error("deleted")); + else { + let i = this.#a[e]; + this.#E && this.#n?.(s, i, t), this.#e && this.#m?.push([s, i, t]); + } + } + if (this.#u.clear(), this.#i.fill(void 0), this.#a.fill(void 0), this.#g && this.#x) { + this.#g.fill(0), this.#x.fill(0); + for (let e of this.#b ?? []) e !== void 0 && clearTimeout(e); + this.#b?.fill(void 0); + } + if (this.#O && this.#O.fill(0), this.#y = 0, this.#p = 0, this.#R.length = 0, this.#f = 0, this.#o = 0, this.#e && this.#m) { + let e = this.#m, s; + for (; s = e?.shift(); ) this.#h?.(...s); + } } - const fullpath = this.fullpath(); - try { - for (const e of this.#fs.readdirSync(fullpath, { - withFileTypes: true - })) { - this.#readdirAddChild(e, children); + }; + Wt.LRUCache = rr; + }); + var Oe = R((P) => { + "use strict"; + var nr = P && P.__importDefault || function(n) { + return n && n.__esModule ? n : { default: n }; + }; + Object.defineProperty(P, "__esModule", { value: true }); + P.Minipass = P.isWritable = P.isReadable = P.isStream = void 0; + var ds = typeof process == "object" && process ? process : { stdout: null, stderr: null }, _e = require("node:events"), ws = nr(require("node:stream")), hr = require("node:string_decoder"), or2 = (n) => !!n && typeof n == "object" && (n instanceof qt || n instanceof ws.default || (0, P.isReadable)(n) || (0, P.isWritable)(n)); + P.isStream = or2; + var ar = (n) => !!n && typeof n == "object" && n instanceof _e.EventEmitter && typeof n.pipe == "function" && n.pipe !== ws.default.Writable.prototype.pipe; + P.isReadable = ar; + var lr = (n) => !!n && typeof n == "object" && n instanceof _e.EventEmitter && typeof n.write == "function" && typeof n.end == "function"; + P.isWritable = lr; + var $ = /* @__PURE__ */ Symbol("EOF"), q = /* @__PURE__ */ Symbol("maybeEmitEnd"), K = /* @__PURE__ */ Symbol("emittedEnd"), Bt = /* @__PURE__ */ Symbol("emittingEnd"), lt2 = /* @__PURE__ */ Symbol("emittedError"), It = /* @__PURE__ */ Symbol("closed"), ps = /* @__PURE__ */ Symbol("read"), Gt = /* @__PURE__ */ Symbol("flush"), ms = /* @__PURE__ */ Symbol("flushChunk"), L = /* @__PURE__ */ Symbol("encoding"), rt = /* @__PURE__ */ Symbol("decoder"), x = /* @__PURE__ */ Symbol("flowing"), ct = /* @__PURE__ */ Symbol("paused"), nt = /* @__PURE__ */ Symbol("resume"), T = /* @__PURE__ */ Symbol("buffer"), M = /* @__PURE__ */ Symbol("pipes"), C = /* @__PURE__ */ Symbol("bufferLength"), we = /* @__PURE__ */ Symbol("bufferPush"), zt = /* @__PURE__ */ Symbol("bufferShift"), k = /* @__PURE__ */ Symbol("objectMode"), O = /* @__PURE__ */ Symbol("destroyed"), be = /* @__PURE__ */ Symbol("error"), ye = /* @__PURE__ */ Symbol("emitData"), gs = /* @__PURE__ */ Symbol("emitEnd"), Se = /* @__PURE__ */ Symbol("emitEnd2"), I = /* @__PURE__ */ Symbol("async"), ve = /* @__PURE__ */ Symbol("abort"), Ut = /* @__PURE__ */ Symbol("aborted"), ut = /* @__PURE__ */ Symbol("signal"), Z = /* @__PURE__ */ Symbol("dataListeners"), D = /* @__PURE__ */ Symbol("discarded"), ft = (n) => Promise.resolve().then(n), cr2 = (n) => n(), ur = (n) => n === "end" || n === "finish" || n === "prefinish", fr = (n) => n instanceof ArrayBuffer || !!n && typeof n == "object" && n.constructor && n.constructor.name === "ArrayBuffer" && n.byteLength >= 0, dr = (n) => !Buffer.isBuffer(n) && ArrayBuffer.isView(n), $t = class { + src; + dest; + opts; + ondrain; + constructor(t, e, s) { + this.src = t, this.dest = e, this.opts = s, this.ondrain = () => t[nt](), this.dest.on("drain", this.ondrain); + } + unpipe() { + this.dest.removeListener("drain", this.ondrain); + } + proxyErrors(t) { + } + end() { + this.unpipe(), this.opts.end && this.dest.end(); + } + }, Ee = class extends $t { + unpipe() { + this.src.removeListener("error", this.proxyErrors), super.unpipe(); + } + constructor(t, e, s) { + super(t, e, s), this.proxyErrors = (i) => this.dest.emit("error", i), t.on("error", this.proxyErrors); + } + }, pr = (n) => !!n.objectMode, mr = (n) => !n.objectMode && !!n.encoding && n.encoding !== "buffer", qt = class extends _e.EventEmitter { + [x] = false; + [ct] = false; + [M] = []; + [T] = []; + [k]; + [L]; + [I]; + [rt]; + [$] = false; + [K] = false; + [Bt] = false; + [It] = false; + [lt2] = null; + [C] = 0; + [O] = false; + [ut]; + [Ut] = false; + [Z] = 0; + [D] = false; + writable = true; + readable = true; + constructor(...t) { + let e = t[0] || {}; + if (super(), e.objectMode && typeof e.encoding == "string") throw new TypeError("Encoding and objectMode may not be used together"); + pr(e) ? (this[k] = true, this[L] = null) : mr(e) ? (this[L] = e.encoding, this[k] = false) : (this[k] = false, this[L] = null), this[I] = !!e.async, this[rt] = this[L] ? new hr.StringDecoder(this[L]) : null, e && e.debugExposeBuffer === true && Object.defineProperty(this, "buffer", { get: () => this[T] }), e && e.debugExposePipes === true && Object.defineProperty(this, "pipes", { get: () => this[M] }); + let { signal: s } = e; + s && (this[ut] = s, s.aborted ? this[ve]() : s.addEventListener("abort", () => this[ve]())); + } + get bufferLength() { + return this[C]; + } + get encoding() { + return this[L]; + } + set encoding(t) { + throw new Error("Encoding must be set at instantiation time"); + } + setEncoding(t) { + throw new Error("Encoding must be set at instantiation time"); + } + get objectMode() { + return this[k]; + } + set objectMode(t) { + throw new Error("objectMode must be set at instantiation time"); + } + get async() { + return this[I]; + } + set async(t) { + this[I] = this[I] || !!t; + } + [ve]() { + this[Ut] = true, this.emit("abort", this[ut]?.reason), this.destroy(this[ut]?.reason); + } + get aborted() { + return this[Ut]; + } + set aborted(t) { + } + write(t, e, s) { + if (this[Ut]) return false; + if (this[$]) throw new Error("write after end"); + if (this[O]) return this.emit("error", Object.assign(new Error("Cannot call write after a stream was destroyed"), { code: "ERR_STREAM_DESTROYED" })), true; + typeof e == "function" && (s = e, e = "utf8"), e || (e = "utf8"); + let i = this[I] ? ft : cr2; + if (!this[k] && !Buffer.isBuffer(t)) { + if (dr(t)) t = Buffer.from(t.buffer, t.byteOffset, t.byteLength); + else if (fr(t)) t = Buffer.from(t); + else if (typeof t != "string") throw new Error("Non-contiguous data written to non-objectMode stream"); + } + return this[k] ? (this[x] && this[C] !== 0 && this[Gt](true), this[x] ? this.emit("data", t) : this[we](t), this[C] !== 0 && this.emit("readable"), s && i(s), this[x]) : t.length ? (typeof t == "string" && !(e === this[L] && !this[rt]?.lastNeed) && (t = Buffer.from(t, e)), Buffer.isBuffer(t) && this[L] && (t = this[rt].write(t)), this[x] && this[C] !== 0 && this[Gt](true), this[x] ? this.emit("data", t) : this[we](t), this[C] !== 0 && this.emit("readable"), s && i(s), this[x]) : (this[C] !== 0 && this.emit("readable"), s && i(s), this[x]); + } + read(t) { + if (this[O]) return null; + if (this[D] = false, this[C] === 0 || t === 0 || t && t > this[C]) return this[q](), null; + this[k] && (t = null), this[T].length > 1 && !this[k] && (this[T] = [this[L] ? this[T].join("") : Buffer.concat(this[T], this[C])]); + let e = this[ps](t || null, this[T][0]); + return this[q](), e; + } + [ps](t, e) { + if (this[k]) this[zt](); + else { + let s = e; + t === s.length || t === null ? this[zt]() : typeof s == "string" ? (this[T][0] = s.slice(t), e = s.slice(0, t), this[C] -= t) : (this[T][0] = s.subarray(t), e = s.subarray(0, t), this[C] -= t); } - this.#readdirSuccess(children); - } catch (er) { - this.#readdirFail(er.code); - children.provisional = 0; + return this.emit("data", e), !this[T].length && !this[$] && this.emit("drain"), e; } - return children.slice(0, children.provisional); - } - canReaddir() { - if (this.#type & ENOCHILD) - return false; - const ifmt = IFMT & this.#type; - if (!(ifmt === UNKNOWN || ifmt === IFDIR || ifmt === IFLNK)) { - return false; + end(t, e, s) { + 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[$] = true, this.writable = false, (this[x] || !this[ct]) && this[q](), this; } - return true; - } - shouldWalk(dirs, walkFilter) { - return (this.#type & IFDIR) === IFDIR && !(this.#type & ENOCHILD) && !dirs.has(this) && (!walkFilter || walkFilter(this)); - } - /** - * Return the Path object corresponding to path as resolved - * by realpath(3). - * - * If the realpath call fails for any reason, `undefined` is returned. - * - * Result is cached, and thus may be outdated if the filesystem is mutated. - * On success, returns a Path object. - */ - async realpath() { - if (this.#realpath) - return this.#realpath; - if ((ENOREALPATH | ENOREADLINK | ENOENT) & this.#type) - return void 0; - try { - const rp = await this.#fs.promises.realpath(this.fullpath()); - return this.#realpath = this.resolve(rp); - } catch (_2) { - this.#markENOREALPATH(); + [nt]() { + this[O] || (!this[Z] && !this[M].length && (this[D] = true), this[ct] = false, this[x] = true, this.emit("resume"), this[T].length ? this[Gt]() : this[$] ? this[q]() : this.emit("drain")); } - } - /** - * Synchronous {@link realpath} - */ - realpathSync() { - if (this.#realpath) - return this.#realpath; - if ((ENOREALPATH | ENOREADLINK | ENOENT) & this.#type) - return void 0; - try { - const rp = this.#fs.realpathSync(this.fullpath()); - return this.#realpath = this.resolve(rp); - } catch (_2) { - this.#markENOREALPATH(); + resume() { + return this[nt](); } - } - /** - * Internal method to mark this Path object as the scurry cwd, - * called by {@link PathScurry#chdir} - * - * @internal - */ - [setAsCwd](oldCwd) { - if (oldCwd === this) - return; - oldCwd.isCWD = false; - this.isCWD = true; - const changed = /* @__PURE__ */ new Set([]); - let rp = []; - let p = this; - while (p && p.parent) { - changed.add(p); - p.#relative = rp.join(this.sep); - p.#relativePosix = rp.join("/"); - p = p.parent; - rp.push(".."); + pause() { + this[x] = false, this[ct] = true, this[D] = false; } - p = oldCwd; - while (p && p.parent && !changed.has(p)) { - p.#relative = void 0; - p.#relativePosix = void 0; - p = p.parent; + get destroyed() { + return this[O]; } - } - }; - exports2.PathBase = PathBase; - var PathWin32 = class _PathWin32 extends PathBase { - /** - * Separator for generating path strings. - */ - sep = "\\"; - /** - * Separator for parsing path strings. - */ - splitSep = eitherSep; - /** - * Do not create new Path objects directly. They should always be accessed - * via the PathScurry class or other methods on the Path class. - * - * @internal - */ - constructor(name, type = UNKNOWN, root, roots, nocase, children, opts) { - super(name, type, root, roots, nocase, children, opts); - } - /** - * @internal - */ - newChild(name, type = UNKNOWN, opts = {}) { - return new _PathWin32(name, type, this.root, this.roots, this.nocase, this.childrenCache(), opts); - } - /** - * @internal - */ - getRootString(path29) { - return node_path_1.win32.parse(path29).root; - } - /** - * @internal - */ - getRoot(rootPath) { - rootPath = uncToDrive(rootPath.toUpperCase()); - if (rootPath === this.root.name) { - return this.root; + get flowing() { + return this[x]; + } + get paused() { + return this[ct]; + } + [we](t) { + this[k] ? this[C] += 1 : this[C] += t.length, this[T].push(t); + } + [zt]() { + return this[k] ? this[C] -= 1 : this[C] -= this[T][0].length, this[T].shift(); + } + [Gt](t = false) { + do + ; + while (this[ms](this[zt]()) && this[T].length); + !t && !this[T].length && !this[$] && this.emit("drain"); } - for (const [compare3, root] of Object.entries(this.roots)) { - if (this.sameRoot(rootPath, compare3)) { - return this.roots[rootPath] = root; + [ms](t) { + return this.emit("data", t), this[x]; + } + pipe(t, e) { + if (this[O]) return t; + this[D] = false; + let s = this[K]; + return e = e || {}, t === ds.stdout || t === ds.stderr ? e.end = false : e.end = e.end !== false, e.proxyErrors = !!e.proxyErrors, s ? e.end && t.end() : (this[M].push(e.proxyErrors ? new Ee(this, t, e) : new $t(this, t, e)), this[I] ? ft(() => this[nt]()) : this[nt]()), t; + } + unpipe(t) { + let e = this[M].find((s) => s.dest === t); + e && (this[M].length === 1 ? (this[x] && this[Z] === 0 && (this[x] = false), this[M] = []) : this[M].splice(this[M].indexOf(e), 1), e.unpipe()); + } + addListener(t, e) { + return this.on(t, e); + } + on(t, e) { + let s = super.on(t, e); + if (t === "data") this[D] = false, this[Z]++, !this[M].length && !this[x] && this[nt](); + else if (t === "readable" && this[C] !== 0) super.emit("readable"); + else if (ur(t) && this[K]) super.emit(t), this.removeAllListeners(t); + else if (t === "error" && this[lt2]) { + let i = e; + this[I] ? ft(() => i.call(this, this[lt2])) : i.call(this, this[lt2]); } + return s; } - return this.roots[rootPath] = new PathScurryWin32(rootPath, this).root; - } - /** - * @internal - */ - sameRoot(rootPath, compare3 = this.root.name) { - rootPath = rootPath.toUpperCase().replace(/\//g, "\\").replace(uncDriveRegexp, "$1\\"); - return rootPath === compare3; - } - }; - exports2.PathWin32 = PathWin32; - var PathPosix = class _PathPosix extends PathBase { - /** - * separator for parsing path strings - */ - splitSep = "/"; - /** - * separator for generating path strings - */ - sep = "/"; - /** - * Do not create new Path objects directly. They should always be accessed - * via the PathScurry class or other methods on the Path class. - * - * @internal - */ - constructor(name, type = UNKNOWN, root, roots, nocase, children, opts) { - super(name, type, root, roots, nocase, children, opts); - } - /** - * @internal - */ - getRootString(path29) { - return path29.startsWith("/") ? "/" : ""; - } - /** - * @internal - */ - getRoot(_rootPath) { - return this.root; - } - /** - * @internal - */ - newChild(name, type = UNKNOWN, opts = {}) { - return new _PathPosix(name, type, this.root, this.roots, this.nocase, this.childrenCache(), opts); - } - }; - exports2.PathPosix = PathPosix; - var PathScurryBase = class { - /** - * The root Path entry for the current working directory of this Scurry - */ - root; - /** - * The string path for the root of this Scurry's current working directory - */ - rootPath; - /** - * A collection of all roots encountered, referenced by rootPath - */ - roots; - /** - * The Path entry corresponding to this PathScurry's current working directory. - */ - cwd; - #resolveCache; - #resolvePosixCache; - #children; - /** - * Perform path comparisons case-insensitively. - * - * Defaults true on Darwin and Windows systems, false elsewhere. - */ - nocase; - #fs; - /** - * This class should not be instantiated directly. - * - * Use PathScurryWin32, PathScurryDarwin, PathScurryPosix, or PathScurry - * - * @internal - */ - constructor(cwd = process.cwd(), pathImpl, sep7, { nocase, childrenCacheSize = 16 * 1024, fs: fs31 = defaultFS } = {}) { - this.#fs = fsFromOption(fs31); - if (cwd instanceof URL || cwd.startsWith("file://")) { - cwd = (0, node_url_1.fileURLToPath)(cwd); - } - const cwdPath = pathImpl.resolve(cwd); - this.roots = /* @__PURE__ */ Object.create(null); - this.rootPath = this.parseRootPath(cwdPath); - this.#resolveCache = new ResolveCache(); - this.#resolvePosixCache = new ResolveCache(); - this.#children = new ChildrenCache(childrenCacheSize); - const split = cwdPath.substring(this.rootPath.length).split(sep7); - if (split.length === 1 && !split[0]) { - split.pop(); - } - if (nocase === void 0) { - throw new TypeError("must provide nocase setting to PathScurryBase ctor"); - } - this.nocase = nocase; - this.root = this.newRoot(this.#fs); - this.roots[this.rootPath] = this.root; - let prev = this.root; - let len = split.length - 1; - const joinSep = pathImpl.sep; - let abs = this.rootPath; - let sawFirst = false; - for (const part of split) { - const l = len--; - prev = prev.child(part, { - relative: new Array(l).fill("..").join(joinSep), - relativePosix: new Array(l).fill("..").join("/"), - fullpath: abs += (sawFirst ? "" : joinSep) + part + removeListener(t, e) { + return this.off(t, e); + } + off(t, e) { + let s = super.off(t, e); + return t === "data" && (this[Z] = this.listeners("data").length, this[Z] === 0 && !this[D] && !this[M].length && (this[x] = false)), s; + } + removeAllListeners(t) { + let e = super.removeAllListeners(t); + return (t === "data" || t === void 0) && (this[Z] = 0, !this[D] && !this[M].length && (this[x] = false)), e; + } + get emittedEnd() { + return this[K]; + } + [q]() { + !this[Bt] && !this[K] && !this[O] && this[T].length === 0 && this[$] && (this[Bt] = true, this.emit("end"), this.emit("prefinish"), this.emit("finish"), this[It] && this.emit("close"), this[Bt] = false); + } + emit(t, ...e) { + let s = e[0]; + if (t !== "error" && t !== "close" && t !== O && this[O]) return false; + if (t === "data") return !this[k] && !s ? false : this[I] ? (ft(() => this[ye](s)), true) : this[ye](s); + if (t === "end") return this[gs](); + if (t === "close") { + if (this[It] = true, !this[K] && !this[O]) return false; + let r = super.emit("close"); + return this.removeAllListeners("close"), r; + } else if (t === "error") { + this[lt2] = s, super.emit(be, s); + let r = !this[ut] || this.listeners("error").length ? super.emit("error", s) : false; + return this[q](), r; + } else if (t === "resume") { + let r = super.emit("resume"); + return this[q](), r; + } else if (t === "finish" || t === "prefinish") { + let r = super.emit(t); + return this.removeAllListeners(t), r; + } + let i = super.emit(t, ...e); + return this[q](), i; + } + [ye](t) { + for (let s of this[M]) s.dest.write(t) === false && this.pause(); + let e = this[D] ? false : super.emit("data", t); + return this[q](), e; + } + [gs]() { + return this[K] ? false : (this[K] = true, this.readable = false, this[I] ? (ft(() => this[Se]()), true) : this[Se]()); + } + [Se]() { + if (this[rt]) { + let e = this[rt].end(); + if (e) { + for (let s of this[M]) s.dest.write(e); + this[D] || super.emit("data", e); + } + } + for (let e of this[M]) e.end(); + let t = super.emit("end"); + return this.removeAllListeners("end"), t; + } + async collect() { + let t = Object.assign([], { dataLength: 0 }); + this[k] || (t.dataLength = 0); + let e = this.promise(); + return this.on("data", (s) => { + t.push(s), this[k] || (t.dataLength += s.length); + }), await e, t; + } + async concat() { + if (this[k]) throw new Error("cannot concat in objectMode"); + let t = await this.collect(); + return this[L] ? t.join("") : Buffer.concat(t, t.dataLength); + } + async promise() { + return new Promise((t, e) => { + this.on(O, () => e(new Error("stream destroyed"))), this.on("error", (s) => e(s)), this.on("end", () => t()); }); - sawFirst = true; } - this.cwd = prev; - } - /** - * Get the depth of a provided path, string, or the cwd - */ - depth(path29 = this.cwd) { - if (typeof path29 === "string") { - path29 = this.cwd.resolve(path29); + [Symbol.asyncIterator]() { + this[D] = false; + let t = false, e = async () => (this.pause(), t = true, { value: void 0, done: true }); + return { next: () => { + if (t) return e(); + let i = this.read(); + if (i !== null) return Promise.resolve({ done: false, value: i }); + if (this[$]) return e(); + let r, h, o = (c) => { + this.off("data", a), this.off("end", l), this.off(O, f), e(), h(c); + }, a = (c) => { + this.off("error", o), this.off("end", l), this.off(O, f), this.pause(), r({ value: c, done: !!this[$] }); + }, l = () => { + this.off("error", o), this.off("data", a), this.off(O, f), e(), r({ done: true, value: void 0 }); + }, f = () => o(new Error("stream destroyed")); + return new Promise((c, d) => { + h = d, r = c, this.once(O, f), this.once("error", o), this.once("end", l), this.once("data", a); + }); + }, throw: e, return: e, [Symbol.asyncIterator]() { + return this; + }, [Symbol.asyncDispose]: async () => { + } }; + } + [Symbol.iterator]() { + this[D] = false; + let t = false, e = () => (this.pause(), this.off(be, e), this.off(O, e), this.off("end", e), t = true, { done: true, value: void 0 }), s = () => { + if (t) return e(); + let i = this.read(); + return i === null ? e() : { done: false, value: i }; + }; + return this.once("end", e), this.once(be, e), this.once(O, e), { next: s, throw: e, return: e, [Symbol.iterator]() { + return this; + }, [Symbol.dispose]: () => { + } }; + } + destroy(t) { + if (this[O]) return t ? this.emit("error", t) : this.emit(O), this; + this[O] = true, this[D] = true, this[T].length = 0, this[C] = 0; + let e = this; + return typeof e.close == "function" && !this[It] && e.close(), t ? this.emit("error", t) : this.emit(O), this; + } + static get isStream() { + return P.isStream; + } + }; + P.Minipass = qt; + }); + var Ms = R((_2) => { + "use strict"; + var gr = _2 && _2.__createBinding || (Object.create ? (function(n, t, e, s) { + s === void 0 && (s = e); + var i = Object.getOwnPropertyDescriptor(t, e); + (!i || ("get" in i ? !t.__esModule : i.writable || i.configurable)) && (i = { enumerable: true, get: function() { + return t[e]; + } }), Object.defineProperty(n, s, i); + }) : (function(n, t, e, s) { + s === void 0 && (s = e), n[s] = t[e]; + })), wr = _2 && _2.__setModuleDefault || (Object.create ? (function(n, t) { + Object.defineProperty(n, "default", { enumerable: true, value: t }); + }) : function(n, t) { + n.default = t; + }), br = _2 && _2.__importStar || function(n) { + if (n && n.__esModule) return n; + var t = {}; + if (n != null) for (var e in n) e !== "default" && Object.prototype.hasOwnProperty.call(n, e) && gr(t, n, e); + return wr(t, n), t; + }; + Object.defineProperty(_2, "__esModule", { value: true }); + _2.PathScurry = _2.Path = _2.PathScurryDarwin = _2.PathScurryPosix = _2.PathScurryWin32 = _2.PathScurryBase = _2.PathPosix = _2.PathWin32 = _2.PathBase = _2.ChildrenCache = _2.ResolveCache = void 0; + var Qt = fs31(), Yt = require("node:path"), yr = require("node:url"), pt = require("fs"), Sr = br(require("node:fs")), vr = pt.realpathSync.native, Ht = require("node:fs/promises"), bs = Oe(), mt = { lstatSync: pt.lstatSync, readdir: pt.readdir, readdirSync: pt.readdirSync, readlinkSync: pt.readlinkSync, realpathSync: vr, promises: { lstat: Ht.lstat, readdir: Ht.readdir, readlink: Ht.readlink, realpath: Ht.realpath } }, _s = (n) => !n || n === mt || n === Sr ? mt : { ...mt, ...n, promises: { ...mt.promises, ...n.promises || {} } }, Os = /^\\\\\?\\([a-z]:)\\?$/i, Er = (n) => n.replace(/\//g, "\\").replace(Os, "$1\\"), _r = /[\\\/]/, N = 0, xs = 1, Ts = 2, G = 4, Cs = 6, Rs = 8, Q = 10, As = 12, j = 15, dt = ~j, xe = 16, ys = 32, gt = 64, W = 128, Vt = 256, Xt = 512, Ss = gt | W | Xt, Or = 1023, Te = (n) => n.isFile() ? Rs : n.isDirectory() ? G : n.isSymbolicLink() ? Q : n.isCharacterDevice() ? Ts : n.isBlockDevice() ? Cs : n.isSocket() ? As : n.isFIFO() ? xs : N, vs = new Qt.LRUCache({ max: 2 ** 12 }), wt = (n) => { + let t = vs.get(n); + if (t) return t; + let e = n.normalize("NFKD"); + return vs.set(n, e), e; + }, Es = new Qt.LRUCache({ max: 2 ** 12 }), Kt = (n) => { + let t = Es.get(n); + if (t) return t; + let e = wt(n.toLowerCase()); + return Es.set(n, e), e; + }, bt = class extends Qt.LRUCache { + constructor() { + super({ max: 256 }); + } + }; + _2.ResolveCache = bt; + var Jt = class extends Qt.LRUCache { + constructor(t = 16 * 1024) { + super({ maxSize: t, sizeCalculation: (e) => e.length + 1 }); + } + }; + _2.ChildrenCache = Jt; + var ks = /* @__PURE__ */ Symbol("PathScurry setAsCwd"), A = class { + name; + root; + roots; + parent; + nocase; + isCWD = false; + #t; + #s; + get dev() { + return this.#s; + } + #n; + get mode() { + return this.#n; + } + #r; + get nlink() { + return this.#r; + } + #h; + get uid() { + return this.#h; + } + #S; + get gid() { + return this.#S; + } + #w; + get rdev() { + return this.#w; + } + #c; + get blksize() { + return this.#c; + } + #o; + get ino() { + return this.#o; + } + #f; + get size() { + return this.#f; + } + #u; + get blocks() { + return this.#u; + } + #a; + get atimeMs() { + return this.#a; + } + #i; + get mtimeMs() { + return this.#i; + } + #d; + get ctimeMs() { + return this.#d; + } + #v; + get birthtimeMs() { + return this.#v; + } + #y; + get atime() { + return this.#y; + } + #p; + get mtime() { + return this.#p; + } + #R; + get ctime() { + return this.#R; + } + #m; + get birthtime() { + return this.#m; + } + #O; + #x; + #g; + #b; + #E; + #T; + #e; + #F; + #P; + #C; + get parentPath() { + return (this.parent || this).fullpath(); + } + get path() { + return this.parentPath; + } + constructor(t, e = N, s, i, r, h, o) { + this.name = t, this.#O = r ? Kt(t) : wt(t), this.#e = e & Or, this.nocase = r, this.roots = i, this.root = s || this, this.#F = h, this.#g = o.fullpath, this.#E = o.relative, this.#T = o.relativePosix, this.parent = o.parent, this.parent ? this.#t = this.parent.#t : this.#t = _s(o.fs); + } + depth() { + return this.#x !== void 0 ? this.#x : this.parent ? this.#x = this.parent.depth() + 1 : this.#x = 0; + } + childrenCache() { + return this.#F; + } + resolve(t) { + if (!t) return this; + let e = this.getRootString(t), i = t.substring(e.length).split(this.splitSep); + return e ? this.getRoot(e).#D(i) : this.#D(i); + } + #D(t) { + let e = this; + for (let s of t) e = e.child(s); + return e; + } + children() { + let t = this.#F.get(this); + if (t) return t; + let e = Object.assign([], { provisional: 0 }); + return this.#F.set(this, e), this.#e &= ~xe, e; + } + child(t, e) { + if (t === "" || t === ".") return this; + if (t === "..") return this.parent || this; + let s = this.children(), i = this.nocase ? Kt(t) : wt(t); + for (let a of s) if (a.#O === i) return a; + let r = this.parent ? this.sep : "", h = this.#g ? this.#g + r + t : void 0, o = this.newChild(t, N, { ...e, parent: this, fullpath: h }); + return this.canReaddir() || (o.#e |= W), s.push(o), o; + } + relative() { + if (this.isCWD) return ""; + if (this.#E !== void 0) return this.#E; + let t = this.name, e = this.parent; + if (!e) return this.#E = this.name; + let s = e.relative(); + return s + (!s || !e.parent ? "" : this.sep) + t; + } + relativePosix() { + if (this.sep === "/") return this.relative(); + if (this.isCWD) return ""; + if (this.#T !== void 0) return this.#T; + let t = this.name, e = this.parent; + if (!e) return this.#T = this.fullpathPosix(); + let s = e.relativePosix(); + return s + (!s || !e.parent ? "" : "/") + t; + } + fullpath() { + if (this.#g !== void 0) return this.#g; + let t = this.name, e = this.parent; + if (!e) return this.#g = this.name; + let i = e.fullpath() + (e.parent ? this.sep : "") + t; + return this.#g = i; + } + fullpathPosix() { + if (this.#b !== void 0) return this.#b; + if (this.sep === "/") return this.#b = this.fullpath(); + if (!this.parent) { + let i = this.fullpath().replace(/\\/g, "/"); + return /^[a-z]:\//i.test(i) ? this.#b = `//?/${i}` : this.#b = i; + } + let t = this.parent, e = t.fullpathPosix(), s = e + (!e || !t.parent ? "" : "/") + this.name; + return this.#b = s; + } + isUnknown() { + return (this.#e & j) === N; + } + isType(t) { + return this[`is${t}`](); + } + getType() { + 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"; + } + isFile() { + return (this.#e & j) === Rs; + } + isDirectory() { + return (this.#e & j) === G; + } + isCharacterDevice() { + return (this.#e & j) === Ts; + } + isBlockDevice() { + return (this.#e & j) === Cs; + } + isFIFO() { + return (this.#e & j) === xs; + } + isSocket() { + return (this.#e & j) === As; + } + isSymbolicLink() { + return (this.#e & Q) === Q; + } + lstatCached() { + return this.#e & ys ? this : void 0; + } + readlinkCached() { + return this.#P; + } + realpathCached() { + return this.#C; + } + readdirCached() { + let t = this.children(); + return t.slice(0, t.provisional); + } + canReadlink() { + if (this.#P) return true; + if (!this.parent) return false; + let t = this.#e & j; + return !(t !== N && t !== Q || this.#e & Vt || this.#e & W); + } + calledReaddir() { + return !!(this.#e & xe); + } + isENOENT() { + return !!(this.#e & W); + } + isNamed(t) { + return this.nocase ? this.#O === Kt(t) : this.#O === wt(t); + } + async readlink() { + let t = this.#P; + if (t) return t; + if (this.canReadlink() && this.parent) try { + let e = await this.#t.promises.readlink(this.fullpath()), s = (await this.parent.realpath())?.resolve(e); + if (s) return this.#P = s; + } catch (e) { + this.#M(e.code); + return; + } + } + readlinkSync() { + let t = this.#P; + if (t) return t; + if (this.canReadlink() && this.parent) try { + let e = this.#t.readlinkSync(this.fullpath()), s = this.parent.realpathSync()?.resolve(e); + if (s) return this.#P = s; + } catch (e) { + this.#M(e.code); + return; + } } - return path29.depth(); - } - /** - * Return the cache of child entries. Exposed so subclasses can create - * child Path objects in a platform-specific way. - * - * @internal - */ - childrenCache() { - return this.#children; - } - /** - * Resolve one or more path strings to a resolved string - * - * Same interface as require('path').resolve. - * - * Much faster than path.resolve() when called multiple times for the same - * path, because the resolved Path objects are cached. Much slower - * otherwise. - */ - resolve(...paths) { - let r = ""; - for (let i = paths.length - 1; i >= 0; i--) { - const p = paths[i]; - if (!p || p === ".") - continue; - r = r ? `${p}/${r}` : p; - if (this.isAbsolute(p)) { - break; + #W(t) { + this.#e |= xe; + for (let e = t.provisional; e < t.length; e++) { + let s = t[e]; + s && s.#_(); } } - const cached = this.#resolveCache.get(r); - if (cached !== void 0) { - return cached; + #_() { + this.#e & W || (this.#e = (this.#e | W) & dt, this.#$()); } - const result = this.cwd.resolve(r).fullpath(); - this.#resolveCache.set(r, result); - return result; - } - /** - * Resolve one or more path strings to a resolved string, returning - * the posix path. Identical to .resolve() on posix systems, but on - * windows will return a forward-slash separated UNC path. - * - * Same interface as require('path').resolve. - * - * Much faster than path.resolve() when called multiple times for the same - * path, because the resolved Path objects are cached. Much slower - * otherwise. - */ - resolvePosix(...paths) { - let r = ""; - for (let i = paths.length - 1; i >= 0; i--) { - const p = paths[i]; - if (!p || p === ".") - continue; - r = r ? `${p}/${r}` : p; - if (this.isAbsolute(p)) { - break; - } + #$() { + let t = this.children(); + t.provisional = 0; + for (let e of t) e.#_(); } - const cached = this.#resolvePosixCache.get(r); - if (cached !== void 0) { - return cached; + #L() { + this.#e |= Xt, this.#j(); } - const result = this.cwd.resolve(r).fullpathPosix(); - this.#resolvePosixCache.set(r, result); - return result; - } - /** - * find the relative path from the cwd to the supplied path string or entry - */ - relative(entry = this.cwd) { - if (typeof entry === "string") { - entry = this.cwd.resolve(entry); + #j() { + if (this.#e & gt) return; + let t = this.#e; + (t & j) === G && (t &= dt), this.#e = t | gt, this.#$(); } - return entry.relative(); - } - /** - * find the relative path from the cwd to the supplied path string or - * entry, using / as the path delimiter, even on Windows. - */ - relativePosix(entry = this.cwd) { - if (typeof entry === "string") { - entry = this.cwd.resolve(entry); + #B(t = "") { + t === "ENOTDIR" || t === "EPERM" ? this.#j() : t === "ENOENT" ? this.#_() : this.children().provisional = 0; } - return entry.relativePosix(); - } - /** - * Return the basename for the provided string or Path object - */ - basename(entry = this.cwd) { - if (typeof entry === "string") { - entry = this.cwd.resolve(entry); + #k(t = "") { + t === "ENOTDIR" ? this.parent.#j() : t === "ENOENT" && this.#_(); } - return entry.name; - } - /** - * Return the dirname for the provided string or Path object - */ - dirname(entry = this.cwd) { - if (typeof entry === "string") { - entry = this.cwd.resolve(entry); + #M(t = "") { + let e = this.#e; + e |= Vt, t === "ENOENT" && (e |= W), (t === "EINVAL" || t === "UNKNOWN") && (e &= dt), this.#e = e, t === "ENOTDIR" && this.parent && this.parent.#j(); } - return (entry.parent || entry).fullpath(); - } - async readdir(entry = this.cwd, opts = { - withFileTypes: true - }) { - if (typeof entry === "string") { - entry = this.cwd.resolve(entry); - } else if (!(entry instanceof PathBase)) { - opts = entry; - entry = this.cwd; - } - const { withFileTypes } = opts; - if (!entry.canReaddir()) { - return []; - } else { - const p = await entry.readdir(); - return withFileTypes ? p : p.map((e) => e.name); + #I(t, e) { + return this.#z(t, e) || this.#G(t, e); } - } - readdirSync(entry = this.cwd, opts = { - withFileTypes: true - }) { - if (typeof entry === "string") { - entry = this.cwd.resolve(entry); - } else if (!(entry instanceof PathBase)) { - opts = entry; - entry = this.cwd; - } - const { withFileTypes = true } = opts; - if (!entry.canReaddir()) { - return []; - } else if (withFileTypes) { - return entry.readdirSync(); - } else { - return entry.readdirSync().map((e) => e.name); + #G(t, e) { + let s = Te(t), i = this.newChild(t.name, s, { parent: this }), r = i.#e & j; + return r !== G && r !== Q && r !== N && (i.#e |= gt), e.unshift(i), e.provisional++, i; } - } - /** - * Call lstat() on the string or Path object, and update all known - * information that can be determined. - * - * Note that unlike `fs.lstat()`, the returned value does not contain some - * information, such as `mode`, `dev`, `nlink`, and `ino`. If that - * information is required, you will need to call `fs.lstat` yourself. - * - * If the Path refers to a nonexistent file, or if the lstat call fails for - * any reason, `undefined` is returned. Otherwise the updated Path object is - * returned. - * - * Results are cached, and thus may be out of date if the filesystem is - * mutated. - */ - async lstat(entry = this.cwd) { - if (typeof entry === "string") { - entry = this.cwd.resolve(entry); + #z(t, e) { + for (let s = e.provisional; s < e.length; s++) { + let i = e[s]; + if ((this.nocase ? Kt(t.name) : wt(t.name)) === i.#O) return this.#l(t, i, s, e); + } } - return entry.lstat(); - } - /** - * synchronous {@link PathScurryBase.lstat} - */ - lstatSync(entry = this.cwd) { - if (typeof entry === "string") { - entry = this.cwd.resolve(entry); + #l(t, e, s, i) { + let r = e.name; + return e.#e = e.#e & dt | Te(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; } - return entry.lstatSync(); - } - async readlink(entry = this.cwd, { withFileTypes } = { - withFileTypes: false - }) { - if (typeof entry === "string") { - entry = this.cwd.resolve(entry); - } else if (!(entry instanceof PathBase)) { - withFileTypes = entry.withFileTypes; - entry = this.cwd; + async lstat() { + if ((this.#e & W) === 0) try { + return this.#U(await this.#t.promises.lstat(this.fullpath())), this; + } catch (t) { + this.#k(t.code); + } } - const e = await entry.readlink(); - return withFileTypes ? e : e?.fullpath(); - } - readlinkSync(entry = this.cwd, { withFileTypes } = { - withFileTypes: false - }) { - if (typeof entry === "string") { - entry = this.cwd.resolve(entry); - } else if (!(entry instanceof PathBase)) { - withFileTypes = entry.withFileTypes; - entry = this.cwd; + lstatSync() { + if ((this.#e & W) === 0) try { + return this.#U(this.#t.lstatSync(this.fullpath())), this; + } catch (t) { + this.#k(t.code); + } } - const e = entry.readlinkSync(); - return withFileTypes ? e : e?.fullpath(); - } - async realpath(entry = this.cwd, { withFileTypes } = { - withFileTypes: false - }) { - if (typeof entry === "string") { - entry = this.cwd.resolve(entry); - } else if (!(entry instanceof PathBase)) { - withFileTypes = entry.withFileTypes; - entry = this.cwd; + #U(t) { + let { atime: e, atimeMs: s, birthtime: i, birthtimeMs: r, blksize: h, blocks: o, ctime: a, ctimeMs: l, dev: f, gid: c, ino: d, mode: u, mtime: m, mtimeMs: p, nlink: b, rdev: w, size: v, uid: E } = t; + this.#y = e, this.#a = s, this.#m = i, this.#v = r, this.#c = h, this.#u = o, this.#R = a, this.#d = l, this.#s = f, this.#S = c, this.#o = d, this.#n = u, this.#p = m, this.#i = p, this.#r = b, this.#w = w, this.#f = v, this.#h = E; + let y = Te(t); + this.#e = this.#e & dt | y | ys, y !== N && y !== G && y !== Q && (this.#e |= gt); } - const e = await entry.realpath(); - return withFileTypes ? e : e?.fullpath(); - } - realpathSync(entry = this.cwd, { withFileTypes } = { - withFileTypes: false - }) { - if (typeof entry === "string") { - entry = this.cwd.resolve(entry); - } else if (!(entry instanceof PathBase)) { - withFileTypes = entry.withFileTypes; - entry = this.cwd; - } - const e = entry.realpathSync(); - return withFileTypes ? e : e?.fullpath(); - } - async walk(entry = this.cwd, opts = {}) { - if (typeof entry === "string") { - entry = this.cwd.resolve(entry); - } else if (!(entry instanceof PathBase)) { - opts = entry; - entry = this.cwd; - } - const { withFileTypes = true, follow = false, filter: filter2, walkFilter } = opts; - const results = []; - if (!filter2 || filter2(entry)) { - results.push(withFileTypes ? entry : entry.fullpath()); - } - const dirs = /* @__PURE__ */ new Set(); - const walk = (dir, cb) => { - dirs.add(dir); - dir.readdirCB((er, entries) => { - if (er) { - return cb(er); - } - let len = entries.length; - if (!len) - return cb(); - const next = () => { - if (--len === 0) { - cb(); - } - }; - for (const e of entries) { - if (!filter2 || filter2(e)) { - results.push(withFileTypes ? e : e.fullpath()); - } - if (follow && e.isSymbolicLink()) { - e.realpath().then((r) => r?.isUnknown() ? r.lstat() : r).then((r) => r?.shouldWalk(dirs, walkFilter) ? walk(r, next) : next()); - } else { - if (e.shouldWalk(dirs, walkFilter)) { - walk(e, next); - } else { - next(); - } - } + #N = []; + #A = false; + #q(t) { + this.#A = false; + let e = this.#N.slice(); + this.#N.length = 0, e.forEach((s) => s(null, t)); + } + readdirCB(t, e = false) { + if (!this.canReaddir()) { + e ? t(null, []) : queueMicrotask(() => t(null, [])); + return; + } + let s = this.children(); + if (this.calledReaddir()) { + let r = s.slice(0, s.provisional); + e ? t(null, r) : queueMicrotask(() => t(null, r)); + return; + } + if (this.#N.push(t), this.#A) return; + this.#A = true; + let i = this.fullpath(); + this.#t.readdir(i, { withFileTypes: true }, (r, h) => { + if (r) this.#B(r.code), s.provisional = 0; + else { + for (let o of h) this.#I(o, s); + this.#W(s); } - }, true); - }; - const start = entry; - return new Promise((res, rej) => { - walk(start, (er) => { - if (er) - return rej(er); - res(results); + this.#q(s.slice(0, s.provisional)); }); - }); - } - walkSync(entry = this.cwd, opts = {}) { - if (typeof entry === "string") { - entry = this.cwd.resolve(entry); - } else if (!(entry instanceof PathBase)) { - opts = entry; - entry = this.cwd; - } - const { withFileTypes = true, follow = false, filter: filter2, walkFilter } = opts; - const results = []; - if (!filter2 || filter2(entry)) { - results.push(withFileTypes ? entry : entry.fullpath()); - } - const dirs = /* @__PURE__ */ new Set([entry]); - for (const dir of dirs) { - const entries = dir.readdirSync(); - for (const e of entries) { - if (!filter2 || filter2(e)) { - results.push(withFileTypes ? e : e.fullpath()); - } - let r = e; - if (e.isSymbolicLink()) { - if (!(follow && (r = e.realpathSync()))) - continue; - if (r.isUnknown()) - r.lstatSync(); - } - if (r.shouldWalk(dirs, walkFilter)) { - dirs.add(r); + } + #H; + async readdir() { + if (!this.canReaddir()) return []; + let t = this.children(); + if (this.calledReaddir()) return t.slice(0, t.provisional); + let e = this.fullpath(); + if (this.#H) await this.#H; + else { + let s = () => { + }; + this.#H = new Promise((i) => s = i); + try { + for (let i of await this.#t.promises.readdir(e, { withFileTypes: true })) this.#I(i, t); + this.#W(t); + } catch (i) { + this.#B(i.code), t.provisional = 0; } + this.#H = void 0, s(); } + return t.slice(0, t.provisional); } - return results; - } - /** - * Support for `for await` - * - * Alias for {@link PathScurryBase.iterate} - * - * Note: As of Node 19, this is very slow, compared to other methods of - * walking. Consider using {@link PathScurryBase.stream} if memory overhead - * and backpressure are concerns, or {@link PathScurryBase.walk} if not. - */ - [Symbol.asyncIterator]() { - return this.iterate(); - } - iterate(entry = this.cwd, options = {}) { - if (typeof entry === "string") { - entry = this.cwd.resolve(entry); - } else if (!(entry instanceof PathBase)) { - options = entry; - entry = this.cwd; + readdirSync() { + if (!this.canReaddir()) return []; + let t = this.children(); + if (this.calledReaddir()) return t.slice(0, t.provisional); + let e = this.fullpath(); + try { + for (let s of this.#t.readdirSync(e, { withFileTypes: true })) this.#I(s, t); + this.#W(t); + } catch (s) { + this.#B(s.code), t.provisional = 0; + } + return t.slice(0, t.provisional); + } + canReaddir() { + if (this.#e & Ss) return false; + let t = j & this.#e; + return t === N || t === G || t === Q; + } + shouldWalk(t, e) { + return (this.#e & G) === G && !(this.#e & Ss) && !t.has(this) && (!e || e(this)); + } + async realpath() { + if (this.#C) return this.#C; + if (!((Xt | Vt | W) & this.#e)) try { + let t = await this.#t.promises.realpath(this.fullpath()); + return this.#C = this.resolve(t); + } catch { + this.#L(); + } } - return this.stream(entry, options)[Symbol.asyncIterator](); - } - /** - * Iterating over a PathScurry performs a synchronous walk. - * - * Alias for {@link PathScurryBase.iterateSync} - */ - [Symbol.iterator]() { - return this.iterateSync(); - } - *iterateSync(entry = this.cwd, opts = {}) { - if (typeof entry === "string") { - entry = this.cwd.resolve(entry); - } else if (!(entry instanceof PathBase)) { - opts = entry; - entry = this.cwd; - } - const { withFileTypes = true, follow = false, filter: filter2, walkFilter } = opts; - if (!filter2 || filter2(entry)) { - yield withFileTypes ? entry : entry.fullpath(); - } - const dirs = /* @__PURE__ */ new Set([entry]); - for (const dir of dirs) { - const entries = dir.readdirSync(); - for (const e of entries) { - if (!filter2 || filter2(e)) { - yield withFileTypes ? e : e.fullpath(); - } - let r = e; - if (e.isSymbolicLink()) { - if (!(follow && (r = e.realpathSync()))) - continue; - if (r.isUnknown()) - r.lstatSync(); - } - if (r.shouldWalk(dirs, walkFilter)) { - dirs.add(r); - } + realpathSync() { + if (this.#C) return this.#C; + if (!((Xt | Vt | W) & this.#e)) try { + let t = this.#t.realpathSync(this.fullpath()); + return this.#C = this.resolve(t); + } catch { + this.#L(); } } - } - stream(entry = this.cwd, opts = {}) { - if (typeof entry === "string") { - entry = this.cwd.resolve(entry); - } else if (!(entry instanceof PathBase)) { - opts = entry; - entry = this.cwd; + [ks](t) { + if (t === this) return; + t.isCWD = false, this.isCWD = true; + let e = /* @__PURE__ */ new Set([]), s = [], i = this; + for (; i && i.parent; ) e.add(i), i.#E = s.join(this.sep), i.#T = s.join("/"), i = i.parent, s.push(".."); + for (i = t; i && i.parent && !e.has(i); ) i.#E = void 0, i.#T = void 0, i = i.parent; } - const { withFileTypes = true, follow = false, filter: filter2, walkFilter } = opts; - const results = new minipass_1.Minipass({ objectMode: true }); - if (!filter2 || filter2(entry)) { - results.write(withFileTypes ? entry : entry.fullpath()); + }; + _2.PathBase = A; + var yt = class n extends A { + sep = "\\"; + splitSep = _r; + constructor(t, e = N, s, i, r, h, o) { + super(t, e, s, i, r, h, o); } - const dirs = /* @__PURE__ */ new Set(); - const queue2 = [entry]; - let processing = 0; - const process2 = () => { - let paused = false; - while (!paused) { - const dir = queue2.shift(); - if (!dir) { - if (processing === 0) - results.end(); - return; - } - processing++; - dirs.add(dir); - const onReaddir = (er, entries, didRealpaths = false) => { - if (er) - return results.emit("error", er); - if (follow && !didRealpaths) { - const promises6 = []; - for (const e of entries) { - if (e.isSymbolicLink()) { - promises6.push(e.realpath().then((r) => r?.isUnknown() ? r.lstat() : r)); - } - } - if (promises6.length) { - Promise.all(promises6).then(() => onReaddir(null, entries, true)); - return; - } - } - for (const e of entries) { - if (e && (!filter2 || filter2(e))) { - if (!results.write(withFileTypes ? e : e.fullpath())) { - paused = true; - } - } - } - processing--; - for (const e of entries) { - const r = e.realpathCached() || e; - if (r.shouldWalk(dirs, walkFilter)) { - queue2.push(r); - } - } - if (paused && !results.flowing) { - results.once("drain", process2); - } else if (!sync) { - process2(); - } - }; - let sync = true; - dir.readdirCB(onReaddir, true); - sync = false; - } - }; - process2(); - return results; - } - streamSync(entry = this.cwd, opts = {}) { - if (typeof entry === "string") { - entry = this.cwd.resolve(entry); - } else if (!(entry instanceof PathBase)) { - opts = entry; - entry = this.cwd; - } - const { withFileTypes = true, follow = false, filter: filter2, walkFilter } = opts; - const results = new minipass_1.Minipass({ objectMode: true }); - const dirs = /* @__PURE__ */ new Set(); - if (!filter2 || filter2(entry)) { - results.write(withFileTypes ? entry : entry.fullpath()); - } - const queue2 = [entry]; - let processing = 0; - const process2 = () => { - let paused = false; - while (!paused) { - const dir = queue2.shift(); - if (!dir) { - if (processing === 0) - results.end(); - return; - } - processing++; - dirs.add(dir); - const entries = dir.readdirSync(); - for (const e of entries) { - if (!filter2 || filter2(e)) { - if (!results.write(withFileTypes ? e : e.fullpath())) { - paused = true; - } - } - } - processing--; - for (const e of entries) { - let r = e; - if (e.isSymbolicLink()) { - if (!(follow && (r = e.realpathSync()))) - continue; - if (r.isUnknown()) - r.lstatSync(); - } - if (r.shouldWalk(dirs, walkFilter)) { - queue2.push(r); - } - } - } - if (paused && !results.flowing) - results.once("drain", process2); - }; - process2(); - return results; - } - chdir(path29 = this.cwd) { - const oldCwd = this.cwd; - this.cwd = typeof path29 === "string" ? this.cwd.resolve(path29) : path29; - this.cwd[setAsCwd](oldCwd); - } - }; - exports2.PathScurryBase = PathScurryBase; - var PathScurryWin32 = class extends PathScurryBase { - /** - * separator for generating path strings - */ - sep = "\\"; - constructor(cwd = process.cwd(), opts = {}) { - const { nocase = true } = opts; - super(cwd, node_path_1.win32, "\\", { ...opts, nocase }); - this.nocase = nocase; - for (let p = this.cwd; p; p = p.parent) { - p.nocase = this.nocase; + newChild(t, e = N, s = {}) { + return new n(t, e, this.root, this.roots, this.nocase, this.childrenCache(), s); } - } - /** - * @internal - */ - parseRootPath(dir) { - return node_path_1.win32.parse(dir).root.toUpperCase(); - } - /** - * @internal - */ - newRoot(fs31) { - return new PathWin32(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs31 }); - } - /** - * Return true if the provided path string is an absolute path - */ - isAbsolute(p) { - return p.startsWith("/") || p.startsWith("\\") || /^[a-z]:(\/|\\)/i.test(p); - } - }; - exports2.PathScurryWin32 = PathScurryWin32; - var PathScurryPosix = class extends PathScurryBase { - /** - * separator for generating path strings - */ - sep = "/"; - constructor(cwd = process.cwd(), opts = {}) { - const { nocase = false } = opts; - super(cwd, node_path_1.posix, "/", { ...opts, nocase }); - this.nocase = nocase; - } - /** - * @internal - */ - parseRootPath(_dir) { - return "/"; - } - /** - * @internal - */ - newRoot(fs31) { - return new PathPosix(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs31 }); - } - /** - * Return true if the provided path string is an absolute path - */ - isAbsolute(p) { - return p.startsWith("/"); - } - }; - exports2.PathScurryPosix = PathScurryPosix; - var PathScurryDarwin = class extends PathScurryPosix { - constructor(cwd = process.cwd(), opts = {}) { - const { nocase = true } = opts; - super(cwd, { ...opts, nocase }); - } - }; - exports2.PathScurryDarwin = PathScurryDarwin; - exports2.Path = process.platform === "win32" ? PathWin32 : PathPosix; - exports2.PathScurry = process.platform === "win32" ? PathScurryWin32 : process.platform === "darwin" ? PathScurryDarwin : PathScurryPosix; - } -}); - -// node_modules/glob/dist/commonjs/pattern.js -var require_pattern = __commonJS({ - "node_modules/glob/dist/commonjs/pattern.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.Pattern = void 0; - var minimatch_1 = require_commonjs20(); - var isPatternList = (pl) => pl.length >= 1; - var isGlobList = (gl) => gl.length >= 1; - var Pattern = class _Pattern { - #patternList; - #globList; - #index; - length; - #platform; - #rest; - #globString; - #isDrive; - #isUNC; - #isAbsolute; - #followGlobstar = true; - constructor(patternList, globList, index2, platform2) { - if (!isPatternList(patternList)) { - throw new TypeError("empty pattern list"); + getRootString(t) { + return Yt.win32.parse(t).root; } - if (!isGlobList(globList)) { - throw new TypeError("empty glob list"); + getRoot(t) { + if (t = Er(t.toUpperCase()), t === this.root.name) return this.root; + for (let [e, s] of Object.entries(this.roots)) if (this.sameRoot(t, e)) return this.roots[t] = s; + return this.roots[t] = new Et(t, this).root; } - if (globList.length !== patternList.length) { - throw new TypeError("mismatched pattern list and glob list lengths"); + sameRoot(t, e = this.root.name) { + return t = t.toUpperCase().replace(/\//g, "\\").replace(Os, "$1\\"), t === e; } - this.length = patternList.length; - if (index2 < 0 || index2 >= this.length) { - throw new TypeError("index out of range"); + }; + _2.PathWin32 = yt; + var St = class n extends A { + splitSep = "/"; + sep = "/"; + constructor(t, e = N, s, i, r, h, o) { + super(t, e, s, i, r, h, o); } - this.#patternList = patternList; - this.#globList = globList; - this.#index = index2; - this.#platform = platform2; - if (this.#index === 0) { - if (this.isUNC()) { - const [p0, p1, p2, p3, ...prest] = this.#patternList; - const [g0, g1, g2, g3, ...grest] = this.#globList; - if (prest[0] === "") { - prest.shift(); - grest.shift(); - } - const p = [p0, p1, p2, p3, ""].join("/"); - const g = [g0, g1, g2, g3, ""].join("/"); - this.#patternList = [p, ...prest]; - this.#globList = [g, ...grest]; - this.length = this.#patternList.length; - } else if (this.isDrive() || this.isAbsolute()) { - const [p1, ...prest] = this.#patternList; - const [g1, ...grest] = this.#globList; - if (prest[0] === "") { - prest.shift(); - grest.shift(); - } - const p = p1 + "/"; - const g = g1 + "/"; - this.#patternList = [p, ...prest]; - this.#globList = [g, ...grest]; - this.length = this.#patternList.length; - } + getRootString(t) { + return t.startsWith("/") ? "/" : ""; } - } - /** - * The first entry in the parsed list of patterns - */ - pattern() { - return this.#patternList[this.#index]; - } - /** - * true of if pattern() returns a string - */ - isString() { - return typeof this.#patternList[this.#index] === "string"; - } - /** - * true of if pattern() returns GLOBSTAR - */ - isGlobstar() { - return this.#patternList[this.#index] === minimatch_1.GLOBSTAR; - } - /** - * true if pattern() returns a regexp - */ - isRegExp() { - return this.#patternList[this.#index] instanceof RegExp; - } - /** - * The /-joined set of glob parts that make up this pattern - */ - globString() { - return this.#globString = this.#globString || (this.#index === 0 ? this.isAbsolute() ? this.#globList[0] + this.#globList.slice(1).join("/") : this.#globList.join("/") : this.#globList.slice(this.#index).join("/")); - } - /** - * true if there are more pattern parts after this one - */ - hasMore() { - return this.length > this.#index + 1; - } - /** - * The rest of the pattern after this part, or null if this is the end - */ - rest() { - if (this.#rest !== void 0) - return this.#rest; - if (!this.hasMore()) - return this.#rest = null; - this.#rest = new _Pattern(this.#patternList, this.#globList, this.#index + 1, this.#platform); - this.#rest.#isAbsolute = this.#isAbsolute; - this.#rest.#isUNC = this.#isUNC; - this.#rest.#isDrive = this.#isDrive; - return this.#rest; - } - /** - * true if the pattern represents a //unc/path/ on windows - */ - isUNC() { - const pl = this.#patternList; - return this.#isUNC !== void 0 ? this.#isUNC : this.#isUNC = this.#platform === "win32" && this.#index === 0 && pl[0] === "" && pl[1] === "" && typeof pl[2] === "string" && !!pl[2] && typeof pl[3] === "string" && !!pl[3]; - } - // pattern like C:/... - // split = ['C:', ...] - // XXX: would be nice to handle patterns like `c:*` to test the cwd - // in c: for *, but I don't know of a way to even figure out what that - // cwd is without actually chdir'ing into it? - /** - * True if the pattern starts with a drive letter on Windows - */ - isDrive() { - const pl = this.#patternList; - return this.#isDrive !== void 0 ? this.#isDrive : this.#isDrive = this.#platform === "win32" && this.#index === 0 && this.length > 1 && typeof pl[0] === "string" && /^[a-z]:$/i.test(pl[0]); - } - // pattern = '/' or '/...' or '/x/...' - // split = ['', ''] or ['', ...] or ['', 'x', ...] - // Drive and UNC both considered absolute on windows - /** - * True if the pattern is rooted on an absolute path - */ - isAbsolute() { - const pl = this.#patternList; - return this.#isAbsolute !== void 0 ? this.#isAbsolute : this.#isAbsolute = pl[0] === "" && pl.length > 1 || this.isDrive() || this.isUNC(); - } - /** - * consume the root of the pattern, and return it - */ - root() { - const p = this.#patternList[0]; - return typeof p === "string" && this.isAbsolute() && this.#index === 0 ? p : ""; - } - /** - * Check to see if the current globstar pattern is allowed to follow - * a symbolic link. - */ - checkFollowGlobstar() { - return !(this.#index === 0 || !this.isGlobstar() || !this.#followGlobstar); - } - /** - * Mark that the current globstar pattern is following a symbolic link - */ - markFollowGlobstar() { - if (this.#index === 0 || !this.isGlobstar() || !this.#followGlobstar) - return false; - this.#followGlobstar = false; - return true; - } - }; - exports2.Pattern = Pattern; - } -}); - -// node_modules/glob/dist/commonjs/ignore.js -var require_ignore = __commonJS({ - "node_modules/glob/dist/commonjs/ignore.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.Ignore = void 0; - var minimatch_1 = require_commonjs20(); - var pattern_js_1 = require_pattern(); - var defaultPlatform2 = typeof process === "object" && process && typeof process.platform === "string" ? process.platform : "linux"; - var Ignore = class { - relative; - relativeChildren; - absolute; - absoluteChildren; - platform; - mmopts; - constructor(ignored, { nobrace, nocase, noext, noglobstar, platform: platform2 = defaultPlatform2 }) { - this.relative = []; - this.absolute = []; - this.relativeChildren = []; - this.absoluteChildren = []; - this.platform = platform2; - this.mmopts = { - dot: true, - nobrace, - nocase, - noext, - noglobstar, - optimizationLevel: 2, - platform: platform2, - nocomment: true, - nonegate: true - }; - for (const ign of ignored) - this.add(ign); - } - add(ign) { - const mm = new minimatch_1.Minimatch(ign, this.mmopts); - for (let i = 0; i < mm.set.length; i++) { - const parsed = mm.set[i]; - const globParts = mm.globParts[i]; - if (!parsed || !globParts) { - throw new Error("invalid pattern object"); - } - while (parsed[0] === "." && globParts[0] === ".") { - parsed.shift(); - globParts.shift(); - } - const p = new pattern_js_1.Pattern(parsed, globParts, 0, this.platform); - const m = new minimatch_1.Minimatch(p.globString(), this.mmopts); - const children = globParts[globParts.length - 1] === "**"; - const absolute = p.isAbsolute(); - if (absolute) - this.absolute.push(m); - else - this.relative.push(m); - if (children) { - if (absolute) - this.absoluteChildren.push(m); - else - this.relativeChildren.push(m); - } + getRoot(t) { + return this.root; + } + newChild(t, e = N, s = {}) { + return new n(t, e, this.root, this.roots, this.nocase, this.childrenCache(), s); + } + }; + _2.PathPosix = St; + var vt = class { + root; + rootPath; + roots; + cwd; + #t; + #s; + #n; + nocase; + #r; + constructor(t = process.cwd(), e, s, { nocase: i, childrenCacheSize: r = 16 * 1024, fs: h = mt } = {}) { + this.#r = _s(h), (t instanceof URL || t.startsWith("file://")) && (t = (0, yr.fileURLToPath)(t)); + let o = e.resolve(t); + this.roots = /* @__PURE__ */ Object.create(null), this.rootPath = this.parseRootPath(o), this.#t = new bt(), this.#s = new bt(), this.#n = new Jt(r); + let a = o.substring(this.rootPath.length).split(s); + if (a.length === 1 && !a[0] && a.pop(), i === void 0) throw new TypeError("must provide nocase setting to PathScurryBase ctor"); + this.nocase = i, this.root = this.newRoot(this.#r), this.roots[this.rootPath] = this.root; + let l = this.root, f = a.length - 1, c = e.sep, d = this.rootPath, u = false; + for (let m of a) { + let p = f--; + l = l.child(m, { relative: new Array(p).fill("..").join(c), relativePosix: new Array(p).fill("..").join("/"), fullpath: d += (u ? "" : c) + m }), u = true; + } + this.cwd = l; + } + depth(t = this.cwd) { + return typeof t == "string" && (t = this.cwd.resolve(t)), t.depth(); + } + childrenCache() { + return this.#n; + } + resolve(...t) { + let e = ""; + for (let r = t.length - 1; r >= 0; r--) { + let h = t[r]; + if (!(!h || h === ".") && (e = e ? `${h}/${e}` : h, this.isAbsolute(h))) break; + } + let s = this.#t.get(e); + if (s !== void 0) return s; + let i = this.cwd.resolve(e).fullpath(); + return this.#t.set(e, i), i; + } + resolvePosix(...t) { + let e = ""; + for (let r = t.length - 1; r >= 0; r--) { + let h = t[r]; + if (!(!h || h === ".") && (e = e ? `${h}/${e}` : h, this.isAbsolute(h))) break; + } + let s = this.#s.get(e); + if (s !== void 0) return s; + let i = this.cwd.resolve(e).fullpathPosix(); + return this.#s.set(e, i), i; + } + relative(t = this.cwd) { + return typeof t == "string" && (t = this.cwd.resolve(t)), t.relative(); + } + relativePosix(t = this.cwd) { + return typeof t == "string" && (t = this.cwd.resolve(t)), t.relativePosix(); + } + basename(t = this.cwd) { + return typeof t == "string" && (t = this.cwd.resolve(t)), t.name; + } + dirname(t = this.cwd) { + return typeof t == "string" && (t = this.cwd.resolve(t)), (t.parent || t).fullpath(); + } + async readdir(t = this.cwd, e = { withFileTypes: true }) { + typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof A || (e = t, t = this.cwd); + let { withFileTypes: s } = e; + if (t.canReaddir()) { + let i = await t.readdir(); + return s ? i : i.map((r) => r.name); + } else return []; + } + readdirSync(t = this.cwd, e = { withFileTypes: true }) { + typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof A || (e = t, t = this.cwd); + let { withFileTypes: s = true } = e; + return t.canReaddir() ? s ? t.readdirSync() : t.readdirSync().map((i) => i.name) : []; + } + async lstat(t = this.cwd) { + return typeof t == "string" && (t = this.cwd.resolve(t)), t.lstat(); + } + lstatSync(t = this.cwd) { + return typeof t == "string" && (t = this.cwd.resolve(t)), t.lstatSync(); + } + async readlink(t = this.cwd, { withFileTypes: e } = { withFileTypes: false }) { + typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof A || (e = t.withFileTypes, t = this.cwd); + let s = await t.readlink(); + return e ? s : s?.fullpath(); + } + readlinkSync(t = this.cwd, { withFileTypes: e } = { withFileTypes: false }) { + typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof A || (e = t.withFileTypes, t = this.cwd); + let s = t.readlinkSync(); + return e ? s : s?.fullpath(); + } + async realpath(t = this.cwd, { withFileTypes: e } = { withFileTypes: false }) { + typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof A || (e = t.withFileTypes, t = this.cwd); + let s = await t.realpath(); + return e ? s : s?.fullpath(); + } + realpathSync(t = this.cwd, { withFileTypes: e } = { withFileTypes: false }) { + typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof A || (e = t.withFileTypes, t = this.cwd); + let s = t.realpathSync(); + return e ? s : s?.fullpath(); + } + async walk(t = this.cwd, e = {}) { + typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof A || (e = t, t = this.cwd); + let { withFileTypes: s = true, follow: i = false, filter: r, walkFilter: h } = e, o = []; + (!r || r(t)) && o.push(s ? t : t.fullpath()); + let a = /* @__PURE__ */ new Set(), l = (c, d) => { + a.add(c), c.readdirCB((u, m) => { + if (u) return d(u); + let p = m.length; + if (!p) return d(); + let b = () => { + --p === 0 && d(); + }; + for (let w of m) (!r || r(w)) && o.push(s ? w : w.fullpath()), i && w.isSymbolicLink() ? w.realpath().then((v) => v?.isUnknown() ? v.lstat() : v).then((v) => v?.shouldWalk(a, h) ? l(v, b) : b()) : w.shouldWalk(a, h) ? l(w, b) : b(); + }, true); + }, f = t; + return new Promise((c, d) => { + l(f, (u) => { + if (u) return d(u); + c(o); + }); + }); + } + walkSync(t = this.cwd, e = {}) { + typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof A || (e = t, t = this.cwd); + let { withFileTypes: s = true, follow: i = false, filter: r, walkFilter: h } = e, o = []; + (!r || r(t)) && o.push(s ? t : t.fullpath()); + let a = /* @__PURE__ */ new Set([t]); + for (let l of a) { + let f = l.readdirSync(); + for (let c of f) { + (!r || r(c)) && o.push(s ? c : c.fullpath()); + let d = c; + if (c.isSymbolicLink()) { + if (!(i && (d = c.realpathSync()))) continue; + d.isUnknown() && d.lstatSync(); + } + d.shouldWalk(a, h) && a.add(d); + } + } + return o; + } + [Symbol.asyncIterator]() { + return this.iterate(); + } + iterate(t = this.cwd, e = {}) { + return typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof A || (e = t, t = this.cwd), this.stream(t, e)[Symbol.asyncIterator](); + } + [Symbol.iterator]() { + return this.iterateSync(); + } + *iterateSync(t = this.cwd, e = {}) { + typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof A || (e = t, t = this.cwd); + let { withFileTypes: s = true, follow: i = false, filter: r, walkFilter: h } = e; + (!r || r(t)) && (yield s ? t : t.fullpath()); + let o = /* @__PURE__ */ new Set([t]); + for (let a of o) { + let l = a.readdirSync(); + for (let f of l) { + (!r || r(f)) && (yield s ? f : f.fullpath()); + let c = f; + if (f.isSymbolicLink()) { + if (!(i && (c = f.realpathSync()))) continue; + c.isUnknown() && c.lstatSync(); + } + c.shouldWalk(o, h) && o.add(c); + } + } + } + stream(t = this.cwd, e = {}) { + typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof A || (e = t, t = this.cwd); + let { withFileTypes: s = true, follow: i = false, filter: r, walkFilter: h } = e, o = new bs.Minipass({ objectMode: true }); + (!r || r(t)) && o.write(s ? t : t.fullpath()); + let a = /* @__PURE__ */ new Set(), l = [t], f = 0, c = () => { + let d = false; + for (; !d; ) { + let u = l.shift(); + if (!u) { + f === 0 && o.end(); + return; + } + f++, a.add(u); + let m = (b, w, v = false) => { + if (b) return o.emit("error", b); + if (i && !v) { + let E = []; + for (let y of w) y.isSymbolicLink() && E.push(y.realpath().then((S) => S?.isUnknown() ? S.lstat() : S)); + if (E.length) { + Promise.all(E).then(() => m(null, w, true)); + return; + } + } + for (let E of w) E && (!r || r(E)) && (o.write(s ? E : E.fullpath()) || (d = true)); + f--; + for (let E of w) { + let y = E.realpathCached() || E; + y.shouldWalk(a, h) && l.push(y); + } + d && !o.flowing ? o.once("drain", c) : p || c(); + }, p = true; + u.readdirCB(m, true), p = false; + } + }; + return c(), o; + } + streamSync(t = this.cwd, e = {}) { + typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof A || (e = t, t = this.cwd); + let { withFileTypes: s = true, follow: i = false, filter: r, walkFilter: h } = e, o = new bs.Minipass({ objectMode: true }), a = /* @__PURE__ */ new Set(); + (!r || r(t)) && o.write(s ? t : t.fullpath()); + let l = [t], f = 0, c = () => { + let d = false; + for (; !d; ) { + let u = l.shift(); + if (!u) { + f === 0 && o.end(); + return; + } + f++, a.add(u); + let m = u.readdirSync(); + for (let p of m) (!r || r(p)) && (o.write(s ? p : p.fullpath()) || (d = true)); + f--; + for (let p of m) { + let b = p; + if (p.isSymbolicLink()) { + if (!(i && (b = p.realpathSync()))) continue; + b.isUnknown() && b.lstatSync(); + } + b.shouldWalk(a, h) && l.push(b); + } + } + d && !o.flowing && o.once("drain", c); + }; + return c(), o; } - } - ignored(p) { - const fullpath = p.fullpath(); - const fullpaths = `${fullpath}/`; - const relative3 = p.relative() || "."; - const relatives = `${relative3}/`; - for (const m of this.relative) { - if (m.match(relative3) || m.match(relatives)) - return true; + chdir(t = this.cwd) { + let e = this.cwd; + this.cwd = typeof t == "string" ? this.cwd.resolve(t) : t, this.cwd[ks](e); } - for (const m of this.absolute) { - if (m.match(fullpath) || m.match(fullpaths)) - return true; + }; + _2.PathScurryBase = vt; + var Et = class extends vt { + sep = "\\"; + constructor(t = process.cwd(), e = {}) { + let { nocase: s = true } = e; + super(t, Yt.win32, "\\", { ...e, nocase: s }), this.nocase = s; + for (let i = this.cwd; i; i = i.parent) i.nocase = this.nocase; } - return false; - } - childrenIgnored(p) { - const fullpath = p.fullpath() + "/"; - const relative3 = (p.relative() || ".") + "/"; - for (const m of this.relativeChildren) { - if (m.match(relative3)) - return true; + parseRootPath(t) { + return Yt.win32.parse(t).root.toUpperCase(); } - for (const m of this.absoluteChildren) { - if (m.match(fullpath)) - return true; + newRoot(t) { + return new yt(this.rootPath, G, void 0, this.roots, this.nocase, this.childrenCache(), { fs: t }); } - return false; - } - }; - exports2.Ignore = Ignore; - } -}); - -// node_modules/glob/dist/commonjs/processor.js -var require_processor = __commonJS({ - "node_modules/glob/dist/commonjs/processor.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.Processor = exports2.SubWalks = exports2.MatchRecord = exports2.HasWalkedCache = void 0; - var minimatch_1 = require_commonjs20(); - var HasWalkedCache = class _HasWalkedCache { - store; - constructor(store = /* @__PURE__ */ new Map()) { - this.store = store; - } - copy() { - return new _HasWalkedCache(new Map(this.store)); - } - hasWalked(target, pattern) { - return this.store.get(target.fullpath())?.has(pattern.globString()); - } - storeWalked(target, pattern) { - const fullpath = target.fullpath(); - const cached = this.store.get(fullpath); - if (cached) - cached.add(pattern.globString()); - else - this.store.set(fullpath, /* @__PURE__ */ new Set([pattern.globString()])); - } - }; - exports2.HasWalkedCache = HasWalkedCache; - var MatchRecord = class { - store = /* @__PURE__ */ new Map(); - add(target, absolute, ifDir) { - const n = (absolute ? 2 : 0) | (ifDir ? 1 : 0); - const current = this.store.get(target); - this.store.set(target, current === void 0 ? n : n & current); - } - // match, absolute, ifdir - entries() { - return [...this.store.entries()].map(([path29, n]) => [ - path29, - !!(n & 2), - !!(n & 1) - ]); - } - }; - exports2.MatchRecord = MatchRecord; - var SubWalks = class { - store = /* @__PURE__ */ new Map(); - add(target, pattern) { - if (!target.canReaddir()) { - return; + isAbsolute(t) { + return t.startsWith("/") || t.startsWith("\\") || /^[a-z]:(\/|\\)/i.test(t); } - const subs = this.store.get(target); - if (subs) { - if (!subs.find((p) => p.globString() === pattern.globString())) { - subs.push(pattern); - } - } else - this.store.set(target, [pattern]); - } - get(target) { - const subs = this.store.get(target); - if (!subs) { - throw new Error("attempting to walk unknown path"); - } - return subs; - } - entries() { - return this.keys().map((k) => [k, this.store.get(k)]); - } - keys() { - return [...this.store.keys()].filter((t) => t.canReaddir()); - } - }; - exports2.SubWalks = SubWalks; - var Processor = class _Processor { - hasWalkedCache; - matches = new MatchRecord(); - subwalks = new SubWalks(); - patterns; - follow; - dot; - opts; - constructor(opts, hasWalkedCache) { - this.opts = opts; - this.follow = !!opts.follow; - this.dot = !!opts.dot; - this.hasWalkedCache = hasWalkedCache ? hasWalkedCache.copy() : new HasWalkedCache(); - } - processPatterns(target, patterns) { - this.patterns = patterns; - const processingSet = patterns.map((p) => [target, p]); - for (let [t, pattern] of processingSet) { - this.hasWalkedCache.storeWalked(t, pattern); - const root = pattern.root(); - const absolute = pattern.isAbsolute() && this.opts.absolute !== false; - if (root) { - t = t.resolve(root === "/" && this.opts.root !== void 0 ? this.opts.root : root); - const rest2 = pattern.rest(); - if (!rest2) { - this.matches.add(t, true, false); - continue; - } else { - pattern = rest2; + }; + _2.PathScurryWin32 = Et; + var _t = class extends vt { + sep = "/"; + constructor(t = process.cwd(), e = {}) { + let { nocase: s = false } = e; + super(t, Yt.posix, "/", { ...e, nocase: s }), this.nocase = s; + } + parseRootPath(t) { + return "/"; + } + newRoot(t) { + return new St(this.rootPath, G, void 0, this.roots, this.nocase, this.childrenCache(), { fs: t }); + } + isAbsolute(t) { + return t.startsWith("/"); + } + }; + _2.PathScurryPosix = _t; + var Zt = class extends _t { + constructor(t = process.cwd(), e = {}) { + let { nocase: s = true } = e; + super(t, { ...e, nocase: s }); + } + }; + _2.PathScurryDarwin = Zt; + _2.Path = process.platform === "win32" ? yt : St; + _2.PathScurry = process.platform === "win32" ? Et : process.platform === "darwin" ? Zt : _t; + }); + var Re = R((te) => { + "use strict"; + Object.defineProperty(te, "__esModule", { value: true }); + te.Pattern = void 0; + var xr = H(), Tr = (n) => n.length >= 1, Cr = (n) => n.length >= 1, Rr = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom"), Ce = class n { + #t; + #s; + #n; + length; + #r; + #h; + #S; + #w; + #c; + #o; + #f = true; + constructor(t, e, s, i) { + if (!Tr(t)) throw new TypeError("empty pattern list"); + if (!Cr(e)) throw new TypeError("empty glob list"); + if (e.length !== t.length) throw new TypeError("mismatched pattern list and glob list lengths"); + if (this.length = t.length, s < 0 || s >= this.length) throw new TypeError("index out of range"); + if (this.#t = t, this.#s = e, this.#n = s, this.#r = i, this.#n === 0) { + if (this.isUNC()) { + let [r, h, o, a, ...l] = this.#t, [f, c, d, u, ...m] = this.#s; + l[0] === "" && (l.shift(), m.shift()); + let p = [r, h, o, a, ""].join("/"), b = [f, c, d, u, ""].join("/"); + this.#t = [p, ...l], this.#s = [b, ...m], this.length = this.#t.length; + } else if (this.isDrive() || this.isAbsolute()) { + let [r, ...h] = this.#t, [o, ...a] = this.#s; + h[0] === "" && (h.shift(), a.shift()); + let l = r + "/", f = o + "/"; + this.#t = [l, ...h], this.#s = [f, ...a], this.length = this.#t.length; + } + } + } + [Rr]() { + return "Pattern <" + this.#s.slice(this.#n).join("/") + ">"; + } + pattern() { + return this.#t[this.#n]; + } + isString() { + return typeof this.#t[this.#n] == "string"; + } + isGlobstar() { + return this.#t[this.#n] === xr.GLOBSTAR; + } + isRegExp() { + return this.#t[this.#n] instanceof RegExp; + } + globString() { + 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("/")); + } + hasMore() { + return this.length > this.#n + 1; + } + rest() { + return this.#h !== void 0 ? this.#h : this.hasMore() ? (this.#h = new n(this.#t, this.#s, this.#n + 1, this.#r), this.#h.#o = this.#o, this.#h.#c = this.#c, this.#h.#w = this.#w, this.#h) : this.#h = null; + } + isUNC() { + let t = this.#t; + 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]; + } + isDrive() { + let t = this.#t; + 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]); + } + isAbsolute() { + let t = this.#t; + return this.#o !== void 0 ? this.#o : this.#o = t[0] === "" && t.length > 1 || this.isDrive() || this.isUNC(); + } + root() { + let t = this.#t[0]; + return typeof t == "string" && this.isAbsolute() && this.#n === 0 ? t : ""; + } + checkFollowGlobstar() { + return !(this.#n === 0 || !this.isGlobstar() || !this.#f); + } + markFollowGlobstar() { + return this.#n === 0 || !this.isGlobstar() || !this.#f ? false : (this.#f = false, true); + } + }; + te.Pattern = Ce; + }); + var ke = R((ee) => { + "use strict"; + Object.defineProperty(ee, "__esModule", { value: true }); + ee.Ignore = void 0; + var Ps = H(), Ar = Re(), kr = typeof process == "object" && process && typeof process.platform == "string" ? process.platform : "linux", Ae = class { + relative; + relativeChildren; + absolute; + absoluteChildren; + platform; + mmopts; + constructor(t, { nobrace: e, nocase: s, noext: i, noglobstar: r, platform: h = kr }) { + this.relative = [], this.absolute = [], this.relativeChildren = [], this.absoluteChildren = [], this.platform = h, this.mmopts = { dot: true, nobrace: e, nocase: s, noext: i, noglobstar: r, optimizationLevel: 2, platform: h, nocomment: true, nonegate: true }; + for (let o of t) this.add(o); + } + add(t) { + let e = new Ps.Minimatch(t, this.mmopts); + for (let s = 0; s < e.set.length; s++) { + let i = e.set[s], r = e.globParts[s]; + if (!i || !r) throw new Error("invalid pattern object"); + for (; i[0] === "." && r[0] === "."; ) i.shift(), r.shift(); + let h = new Ar.Pattern(i, r, 0, this.platform), o = new Ps.Minimatch(h.globString(), this.mmopts), a = r[r.length - 1] === "**", l = h.isAbsolute(); + l ? this.absolute.push(o) : this.relative.push(o), a && (l ? this.absoluteChildren.push(o) : this.relativeChildren.push(o)); + } + } + ignored(t) { + let e = t.fullpath(), s = `${e}/`, i = t.relative() || ".", r = `${i}/`; + for (let h of this.relative) if (h.match(i) || h.match(r)) return true; + for (let h of this.absolute) if (h.match(e) || h.match(s)) return true; + return false; + } + childrenIgnored(t) { + let e = t.fullpath() + "/", s = (t.relative() || ".") + "/"; + for (let i of this.relativeChildren) if (i.match(s)) return true; + for (let i of this.absoluteChildren) if (i.match(e)) return true; + return false; + } + }; + ee.Ignore = Ae; + }); + var Fs = R((z) => { + "use strict"; + Object.defineProperty(z, "__esModule", { value: true }); + z.Processor = z.SubWalks = z.MatchRecord = z.HasWalkedCache = void 0; + var Ds = H(), se = class n { + store; + constructor(t = /* @__PURE__ */ new Map()) { + this.store = t; + } + copy() { + return new n(new Map(this.store)); + } + hasWalked(t, e) { + return this.store.get(t.fullpath())?.has(e.globString()); + } + storeWalked(t, e) { + let s = t.fullpath(), i = this.store.get(s); + i ? i.add(e.globString()) : this.store.set(s, /* @__PURE__ */ new Set([e.globString()])); + } + }; + z.HasWalkedCache = se; + var ie = class { + store = /* @__PURE__ */ new Map(); + add(t, e, s) { + let i = (e ? 2 : 0) | (s ? 1 : 0), r = this.store.get(t); + this.store.set(t, r === void 0 ? i : i & r); + } + entries() { + return [...this.store.entries()].map(([t, e]) => [t, !!(e & 2), !!(e & 1)]); + } + }; + z.MatchRecord = ie; + var re = class { + store = /* @__PURE__ */ new Map(); + add(t, e) { + if (!t.canReaddir()) return; + let s = this.store.get(t); + s ? s.find((i) => i.globString() === e.globString()) || s.push(e) : this.store.set(t, [e]); + } + get(t) { + let e = this.store.get(t); + if (!e) throw new Error("attempting to walk unknown path"); + return e; + } + entries() { + return this.keys().map((t) => [t, this.store.get(t)]); + } + keys() { + return [...this.store.keys()].filter((t) => t.canReaddir()); + } + }; + z.SubWalks = re; + var Me = class n { + hasWalkedCache; + matches = new ie(); + subwalks = new re(); + patterns; + follow; + dot; + opts; + constructor(t, e) { + this.opts = t, this.follow = !!t.follow, this.dot = !!t.dot, this.hasWalkedCache = e ? e.copy() : new se(); + } + processPatterns(t, e) { + this.patterns = e; + let s = e.map((i) => [t, i]); + for (let [i, r] of s) { + this.hasWalkedCache.storeWalked(i, r); + let h = r.root(), o = r.isAbsolute() && this.opts.absolute !== false; + if (h) { + i = i.resolve(h === "/" && this.opts.root !== void 0 ? this.opts.root : h); + let c = r.rest(); + if (c) r = c; + else { + this.matches.add(i, true, false); + continue; + } } - } - if (t.isENOENT()) - continue; - let p; - let rest; - let changed = false; - while (typeof (p = pattern.pattern()) === "string" && (rest = pattern.rest())) { - const c = t.resolve(p); - t = c; - pattern = rest; - changed = true; - } - p = pattern.pattern(); - rest = pattern.rest(); - if (changed) { - if (this.hasWalkedCache.hasWalked(t, pattern)) + if (i.isENOENT()) continue; + let a, l, f = false; + for (; typeof (a = r.pattern()) == "string" && (l = r.rest()); ) i = i.resolve(a), r = l, f = true; + if (a = r.pattern(), l = r.rest(), f) { + if (this.hasWalkedCache.hasWalked(i, r)) continue; + this.hasWalkedCache.storeWalked(i, r); + } + if (typeof a == "string") { + let c = a === ".." || a === "" || a === "."; + this.matches.add(i.resolve(a), o, c); continue; - this.hasWalkedCache.storeWalked(t, pattern); - } - if (typeof p === "string") { - const ifDir = p === ".." || p === "" || p === "."; - this.matches.add(t.resolve(p), absolute, ifDir); - continue; - } else if (p === minimatch_1.GLOBSTAR) { - if (!t.isSymbolicLink() || this.follow || pattern.checkFollowGlobstar()) { - this.subwalks.add(t, pattern); - } - const rp = rest?.pattern(); - const rrest = rest?.rest(); - if (!rest || (rp === "" || rp === ".") && !rrest) { - this.matches.add(t, absolute, rp === "" || rp === "."); - } else { - if (rp === "..") { - const tp = t.parent || t; - if (!rrest) - this.matches.add(tp, absolute, true); - else if (!this.hasWalkedCache.hasWalked(tp, rrest)) { - this.subwalks.add(tp, rrest); - } + } else if (a === Ds.GLOBSTAR) { + (!i.isSymbolicLink() || this.follow || r.checkFollowGlobstar()) && this.subwalks.add(i, r); + let c = l?.pattern(), d = l?.rest(); + if (!l || (c === "" || c === ".") && !d) this.matches.add(i, o, c === "" || c === "."); + else if (c === "..") { + let u = i.parent || i; + d ? this.hasWalkedCache.hasWalked(u, d) || this.subwalks.add(u, d) : this.matches.add(u, o, true); } - } - } else if (p instanceof RegExp) { - this.subwalks.add(t, pattern); + } else a instanceof RegExp && this.subwalks.add(i, r); } + return this; } - return this; - } - subwalkTargets() { - return this.subwalks.keys(); - } - child() { - return new _Processor(this.opts, this.hasWalkedCache); - } - // return a new Processor containing the subwalks for each - // child entry, and a set of matches, and - // a hasWalkedCache that's a copy of this one - // then we're going to call - filterEntries(parent, entries) { - const patterns = this.subwalks.get(parent); - const results = this.child(); - for (const e of entries) { - for (const pattern of patterns) { - const absolute = pattern.isAbsolute(); - const p = pattern.pattern(); - const rest = pattern.rest(); - if (p === minimatch_1.GLOBSTAR) { - results.testGlobstar(e, pattern, rest, absolute); - } else if (p instanceof RegExp) { - results.testRegExp(e, p, rest, absolute); - } else { - results.testString(e, p, rest, absolute); - } - } + subwalkTargets() { + return this.subwalks.keys(); } - return results; - } - testGlobstar(e, pattern, rest, absolute) { - if (this.dot || !e.name.startsWith(".")) { - if (!pattern.hasMore()) { - this.matches.add(e, absolute, false); - } - if (e.canReaddir()) { - if (this.follow || !e.isSymbolicLink()) { - this.subwalks.add(e, pattern); - } else if (e.isSymbolicLink()) { - if (rest && pattern.checkFollowGlobstar()) { - this.subwalks.add(e, rest); - } else if (pattern.markFollowGlobstar()) { - this.subwalks.add(e, pattern); - } - } + child() { + return new n(this.opts, this.hasWalkedCache); + } + filterEntries(t, e) { + let s = this.subwalks.get(t), i = this.child(); + for (let r of e) for (let h of s) { + let o = h.isAbsolute(), a = h.pattern(), l = h.rest(); + a === Ds.GLOBSTAR ? i.testGlobstar(r, h, l, o) : a instanceof RegExp ? i.testRegExp(r, a, l, o) : i.testString(r, a, l, o); } + return i; } - if (rest) { - const rp = rest.pattern(); - if (typeof rp === "string" && // dots and empty were handled already - rp !== ".." && rp !== "" && rp !== ".") { - this.testString(e, rp, rest.rest(), absolute); - } else if (rp === "..") { - const ep = e.parent || e; - this.subwalks.add(ep, rest); - } else if (rp instanceof RegExp) { - this.testRegExp(e, rp, rest.rest(), absolute); + testGlobstar(t, e, s, i) { + if ((this.dot || !t.name.startsWith(".")) && (e.hasMore() || this.matches.add(t, i, false), 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) { + let r = s.pattern(); + if (typeof r == "string" && r !== ".." && r !== "" && r !== ".") this.testString(t, r, s.rest(), i); + else if (r === "..") { + let h = t.parent || t; + this.subwalks.add(h, s); + } else r instanceof RegExp && this.testRegExp(t, r, s.rest(), i); } } - } - testRegExp(e, p, rest, absolute) { - if (!p.test(e.name)) - return; - if (!rest) { - this.matches.add(e, absolute, false); - } else { - this.subwalks.add(e, rest); + testRegExp(t, e, s, i) { + e.test(t.name) && (s ? this.subwalks.add(t, s) : this.matches.add(t, i, false)); } - } - testString(e, p, rest, absolute) { - if (!e.isNamed(p)) - return; - if (!rest) { - this.matches.add(e, absolute, false); - } else { - this.subwalks.add(e, rest); + testString(t, e, s, i) { + t.isNamed(e) && (s ? this.subwalks.add(t, s) : this.matches.add(t, i, false)); } - } - }; - exports2.Processor = Processor; - } -}); - -// node_modules/glob/dist/commonjs/walker.js -var require_walker = __commonJS({ - "node_modules/glob/dist/commonjs/walker.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.GlobStream = exports2.GlobWalker = exports2.GlobUtil = void 0; - var minipass_1 = require_commonjs22(); - var ignore_js_1 = require_ignore(); - var processor_js_1 = require_processor(); - var makeIgnore = (ignore, opts) => typeof ignore === "string" ? new ignore_js_1.Ignore([ignore], opts) : Array.isArray(ignore) ? new ignore_js_1.Ignore(ignore, opts) : ignore; - var GlobUtil = class { - path; - patterns; - opts; - seen = /* @__PURE__ */ new Set(); - paused = false; - aborted = false; - #onResume = []; - #ignore; - #sep; - signal; - maxDepth; - includeChildMatches; - constructor(patterns, path29, opts) { - this.patterns = patterns; - this.path = path29; - this.opts = opts; - this.#sep = !opts.posix && opts.platform === "win32" ? "\\" : "/"; - this.includeChildMatches = opts.includeChildMatches !== false; - if (opts.ignore || !this.includeChildMatches) { - this.#ignore = makeIgnore(opts.ignore ?? [], opts); - if (!this.includeChildMatches && typeof this.#ignore.add !== "function") { - const m = "cannot ignore child matches, ignore lacks add() method."; - throw new Error(m); - } - } - this.maxDepth = opts.maxDepth || Infinity; - if (opts.signal) { - this.signal = opts.signal; - this.signal.addEventListener("abort", () => { - this.#onResume.length = 0; - }); + }; + z.Processor = Me; + }); + var Ls = R((X) => { + "use strict"; + Object.defineProperty(X, "__esModule", { value: true }); + X.GlobStream = X.GlobWalker = X.GlobUtil = void 0; + var Mr = Oe(), js = ke(), Ns = Fs(), Pr = (n, t) => typeof n == "string" ? new js.Ignore([n], t) : Array.isArray(n) ? new js.Ignore(n, t) : n, Ot = class { + path; + patterns; + opts; + seen = /* @__PURE__ */ new Set(); + paused = false; + aborted = false; + #t = []; + #s; + #n; + signal; + maxDepth; + includeChildMatches; + constructor(t, e, s) { + if (this.patterns = t, this.path = e, this.opts = s, this.#n = !s.posix && s.platform === "win32" ? "\\" : "/", this.includeChildMatches = s.includeChildMatches !== false, (s.ignore || !this.includeChildMatches) && (this.#s = Pr(s.ignore ?? [], s), !this.includeChildMatches && typeof this.#s.add != "function")) { + let i = "cannot ignore child matches, ignore lacks add() method."; + throw new Error(i); + } + this.maxDepth = s.maxDepth || 1 / 0, s.signal && (this.signal = s.signal, this.signal.addEventListener("abort", () => { + this.#t.length = 0; + })); } - } - #ignored(path29) { - return this.seen.has(path29) || !!this.#ignore?.ignored?.(path29); - } - #childrenIgnored(path29) { - return !!this.#ignore?.childrenIgnored?.(path29); - } - // backpressure mechanism - pause() { - this.paused = true; - } - resume() { - if (this.signal?.aborted) - return; - this.paused = false; - let fn = void 0; - while (!this.paused && (fn = this.#onResume.shift())) { - fn(); + #r(t) { + return this.seen.has(t) || !!this.#s?.ignored?.(t); } - } - onResume(fn) { - if (this.signal?.aborted) - return; - if (!this.paused) { - fn(); - } else { - this.#onResume.push(fn); + #h(t) { + return !!this.#s?.childrenIgnored?.(t); } - } - // do the requisite realpath/stat checking, and return the path - // to add or undefined to filter it out. - async matchCheck(e, ifDir) { - if (ifDir && this.opts.nodir) - return void 0; - let rpc; - if (this.opts.realpath) { - rpc = e.realpathCached() || await e.realpath(); - if (!rpc) - return void 0; - e = rpc; + pause() { + this.paused = true; } - const needStat = e.isUnknown() || this.opts.stat; - const s = needStat ? await e.lstat() : e; - if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { - const target = await s.realpath(); - if (target && (target.isUnknown() || this.opts.stat)) { - await target.lstat(); + resume() { + if (this.signal?.aborted) return; + this.paused = false; + let t; + for (; !this.paused && (t = this.#t.shift()); ) t(); + } + onResume(t) { + this.signal?.aborted || (this.paused ? this.#t.push(t) : t()); + } + async matchCheck(t, e) { + if (e && this.opts.nodir) return; + let s; + if (this.opts.realpath) { + if (s = t.realpathCached() || await t.realpath(), !s) return; + t = s; + } + let r = t.isUnknown() || this.opts.stat ? await t.lstat() : t; + if (this.opts.follow && this.opts.nodir && r?.isSymbolicLink()) { + let h = await r.realpath(); + h && (h.isUnknown() || this.opts.stat) && await h.lstat(); + } + return this.matchCheckTest(r, e); + } + matchCheckTest(t, e) { + return t && (this.maxDepth === 1 / 0 || 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; + } + matchCheckSync(t, e) { + if (e && this.opts.nodir) return; + let s; + if (this.opts.realpath) { + if (s = t.realpathCached() || t.realpathSync(), !s) return; + t = s; + } + let r = t.isUnknown() || this.opts.stat ? t.lstatSync() : t; + if (this.opts.follow && this.opts.nodir && r?.isSymbolicLink()) { + let h = r.realpathSync(); + h && (h?.isUnknown() || this.opts.stat) && h.lstatSync(); + } + return this.matchCheckTest(r, e); + } + matchFinish(t, e) { + if (this.#r(t)) return; + if (!this.includeChildMatches && this.#s?.add) { + let r = `${t.relativePosix()}/**`; + this.#s.add(r); + } + let s = this.opts.absolute === void 0 ? e : this.opts.absolute; + this.seen.add(t); + let i = this.opts.mark && t.isDirectory() ? this.#n : ""; + if (this.opts.withFileTypes) this.matchEmit(t); + else if (s) { + let r = this.opts.posix ? t.fullpathPosix() : t.fullpath(); + this.matchEmit(r + i); + } else { + let r = this.opts.posix ? t.relativePosix() : t.relative(), h = this.opts.dotRelative && !r.startsWith(".." + this.#n) ? "." + this.#n : ""; + this.matchEmit(r ? h + r + i : "." + i); } } - return this.matchCheckTest(s, ifDir); - } - matchCheckTest(e, ifDir) { - return e && (this.maxDepth === Infinity || e.depth() <= this.maxDepth) && (!ifDir || e.canReaddir()) && (!this.opts.nodir || !e.isDirectory()) && (!this.opts.nodir || !this.opts.follow || !e.isSymbolicLink() || !e.realpathCached()?.isDirectory()) && !this.#ignored(e) ? e : void 0; - } - matchCheckSync(e, ifDir) { - if (ifDir && this.opts.nodir) - return void 0; - let rpc; - if (this.opts.realpath) { - rpc = e.realpathCached() || e.realpathSync(); - if (!rpc) - return void 0; - e = rpc; + async match(t, e, s) { + let i = await this.matchCheck(t, s); + i && this.matchFinish(i, e); } - const needStat = e.isUnknown() || this.opts.stat; - const s = needStat ? e.lstatSync() : e; - if (this.opts.follow && this.opts.nodir && s?.isSymbolicLink()) { - const target = s.realpathSync(); - if (target && (target?.isUnknown() || this.opts.stat)) { - target.lstatSync(); - } + matchSync(t, e, s) { + let i = this.matchCheckSync(t, s); + i && this.matchFinish(i, e); } - return this.matchCheckTest(s, ifDir); - } - matchFinish(e, absolute) { - if (this.#ignored(e)) - return; - if (!this.includeChildMatches && this.#ignore?.add) { - const ign = `${e.relativePosix()}/**`; - this.#ignore.add(ign); - } - const abs = this.opts.absolute === void 0 ? absolute : this.opts.absolute; - this.seen.add(e); - const mark = this.opts.mark && e.isDirectory() ? this.#sep : ""; - if (this.opts.withFileTypes) { - this.matchEmit(e); - } else if (abs) { - const abs2 = this.opts.posix ? e.fullpathPosix() : e.fullpath(); - this.matchEmit(abs2 + mark); - } else { - const rel = this.opts.posix ? e.relativePosix() : e.relative(); - const pre = this.opts.dotRelative && !rel.startsWith(".." + this.#sep) ? "." + this.#sep : ""; - this.matchEmit(!rel ? "." + mark : pre + rel + mark); + walkCB(t, e, s) { + this.signal?.aborted && s(), this.walkCB2(t, e, new Ns.Processor(this.opts), s); } - } - async match(e, absolute, ifDir) { - const p = await this.matchCheck(e, ifDir); - if (p) - this.matchFinish(p, absolute); - } - matchSync(e, absolute, ifDir) { - const p = this.matchCheckSync(e, ifDir); - if (p) - this.matchFinish(p, absolute); - } - walkCB(target, patterns, cb) { - if (this.signal?.aborted) - cb(); - this.walkCB2(target, patterns, new processor_js_1.Processor(this.opts), cb); - } - walkCB2(target, patterns, processor, cb) { - if (this.#childrenIgnored(target)) - return cb(); - if (this.signal?.aborted) - cb(); - if (this.paused) { - this.onResume(() => this.walkCB2(target, patterns, processor, cb)); - return; + walkCB2(t, e, s, i) { + if (this.#h(t)) return i(); + if (this.signal?.aborted && i(), this.paused) { + this.onResume(() => this.walkCB2(t, e, s, i)); + return; + } + s.processPatterns(t, e); + let r = 1, h = () => { + --r === 0 && i(); + }; + for (let [o, a, l] of s.matches.entries()) this.#r(o) || (r++, this.match(o, a, l).then(() => h())); + for (let o of s.subwalkTargets()) { + if (this.maxDepth !== 1 / 0 && o.depth() >= this.maxDepth) continue; + r++; + let a = o.readdirCached(); + o.calledReaddir() ? this.walkCB3(o, a, s, h) : o.readdirCB((l, f) => this.walkCB3(o, f, s, h), true); + } + h(); + } + walkCB3(t, e, s, i) { + s = s.filterEntries(t, e); + let r = 1, h = () => { + --r === 0 && i(); + }; + for (let [o, a, l] of s.matches.entries()) this.#r(o) || (r++, this.match(o, a, l).then(() => h())); + for (let [o, a] of s.subwalks.entries()) r++, this.walkCB2(o, a, s.child(), h); + h(); } - processor.processPatterns(target, patterns); - let tasks = 1; - const next = () => { - if (--tasks === 0) - cb(); - }; - for (const [m, absolute, ifDir] of processor.matches.entries()) { - if (this.#ignored(m)) - continue; - tasks++; - this.match(m, absolute, ifDir).then(() => next()); + walkCBSync(t, e, s) { + this.signal?.aborted && s(), this.walkCB2Sync(t, e, new Ns.Processor(this.opts), s); } - for (const t of processor.subwalkTargets()) { - if (this.maxDepth !== Infinity && t.depth() >= this.maxDepth) { - continue; - } - tasks++; - const childrenCached = t.readdirCached(); - if (t.calledReaddir()) - this.walkCB3(t, childrenCached, processor, next); - else { - t.readdirCB((_2, entries) => this.walkCB3(t, entries, processor, next), true); + walkCB2Sync(t, e, s, i) { + if (this.#h(t)) return i(); + if (this.signal?.aborted && i(), this.paused) { + this.onResume(() => this.walkCB2Sync(t, e, s, i)); + return; } + s.processPatterns(t, e); + let r = 1, h = () => { + --r === 0 && i(); + }; + for (let [o, a, l] of s.matches.entries()) this.#r(o) || this.matchSync(o, a, l); + for (let o of s.subwalkTargets()) { + if (this.maxDepth !== 1 / 0 && o.depth() >= this.maxDepth) continue; + r++; + let a = o.readdirSync(); + this.walkCB3Sync(o, a, s, h); + } + h(); + } + walkCB3Sync(t, e, s, i) { + s = s.filterEntries(t, e); + let r = 1, h = () => { + --r === 0 && i(); + }; + for (let [o, a, l] of s.matches.entries()) this.#r(o) || this.matchSync(o, a, l); + for (let [o, a] of s.subwalks.entries()) r++, this.walkCB2Sync(o, a, s.child(), h); + h(); } - next(); - } - walkCB3(target, entries, processor, cb) { - processor = processor.filterEntries(target, entries); - let tasks = 1; - const next = () => { - if (--tasks === 0) - cb(); - }; - for (const [m, absolute, ifDir] of processor.matches.entries()) { - if (this.#ignored(m)) - continue; - tasks++; - this.match(m, absolute, ifDir).then(() => next()); + }; + X.GlobUtil = Ot; + var Pe = class extends Ot { + matches = /* @__PURE__ */ new Set(); + constructor(t, e, s) { + super(t, e, s); } - for (const [target2, patterns] of processor.subwalks.entries()) { - tasks++; - this.walkCB2(target2, patterns, processor.child(), next); + matchEmit(t) { + this.matches.add(t); } - next(); - } - walkCBSync(target, patterns, cb) { - if (this.signal?.aborted) - cb(); - this.walkCB2Sync(target, patterns, new processor_js_1.Processor(this.opts), cb); - } - walkCB2Sync(target, patterns, processor, cb) { - if (this.#childrenIgnored(target)) - return cb(); - if (this.signal?.aborted) - cb(); - if (this.paused) { - this.onResume(() => this.walkCB2Sync(target, patterns, processor, cb)); - return; + async walk() { + if (this.signal?.aborted) throw this.signal.reason; + return this.path.isUnknown() && await this.path.lstat(), await new Promise((t, e) => { + this.walkCB(this.path, this.patterns, () => { + this.signal?.aborted ? e(this.signal.reason) : t(this.matches); + }); + }), this.matches; } - processor.processPatterns(target, patterns); - let tasks = 1; - const next = () => { - if (--tasks === 0) - cb(); - }; - for (const [m, absolute, ifDir] of processor.matches.entries()) { - if (this.#ignored(m)) - continue; - this.matchSync(m, absolute, ifDir); + walkSync() { + if (this.signal?.aborted) throw this.signal.reason; + return this.path.isUnknown() && this.path.lstatSync(), this.walkCBSync(this.path, this.patterns, () => { + if (this.signal?.aborted) throw this.signal.reason; + }), this.matches; } - for (const t of processor.subwalkTargets()) { - if (this.maxDepth !== Infinity && t.depth() >= this.maxDepth) { - continue; - } - tasks++; - const children = t.readdirSync(); - this.walkCB3Sync(t, children, processor, next); + }; + X.GlobWalker = Pe; + var De = class extends Ot { + results; + constructor(t, e, s) { + super(t, e, s), this.results = new Mr.Minipass({ signal: this.signal, objectMode: true }), this.results.on("drain", () => this.resume()), this.results.on("resume", () => this.resume()); } - next(); - } - walkCB3Sync(target, entries, processor, cb) { - processor = processor.filterEntries(target, entries); - let tasks = 1; - const next = () => { - if (--tasks === 0) - cb(); - }; - for (const [m, absolute, ifDir] of processor.matches.entries()) { - if (this.#ignored(m)) - continue; - this.matchSync(m, absolute, ifDir); + matchEmit(t) { + this.results.write(t), this.results.flowing || this.pause(); } - for (const [target2, patterns] of processor.subwalks.entries()) { - tasks++; - this.walkCB2Sync(target2, patterns, processor.child(), next); + stream() { + let t = this.path; + return t.isUnknown() ? t.lstat().then(() => { + this.walkCB(t, this.patterns, () => this.results.end()); + }) : this.walkCB(t, this.patterns, () => this.results.end()), this.results; } - next(); - } - }; - exports2.GlobUtil = GlobUtil; - var GlobWalker = class extends GlobUtil { - matches = /* @__PURE__ */ new Set(); - constructor(patterns, path29, opts) { - super(patterns, path29, opts); - } - matchEmit(e) { - this.matches.add(e); - } - async walk() { - if (this.signal?.aborted) - throw this.signal.reason; - if (this.path.isUnknown()) { - await this.path.lstat(); + streamSync() { + return this.path.isUnknown() && this.path.lstatSync(), this.walkCBSync(this.path, this.patterns, () => this.results.end()), this.results; } - await new Promise((res, rej) => { - this.walkCB(this.path, this.patterns, () => { - if (this.signal?.aborted) { - rej(this.signal.reason); - } else { - res(this.matches); - } + }; + X.GlobStream = De; + }); + var je = R((oe) => { + "use strict"; + Object.defineProperty(oe, "__esModule", { value: true }); + oe.Glob = void 0; + var Dr = H(), Fr = require("node:url"), ne = Ms(), jr = Re(), he = Ls(), Nr = typeof process == "object" && process && typeof process.platform == "string" ? process.platform : "linux", Fe = class { + absolute; + cwd; + root; + dot; + dotRelative; + follow; + ignore; + magicalBraces; + mark; + matchBase; + maxDepth; + nobrace; + nocase; + nodir; + noext; + noglobstar; + pattern; + platform; + realpath; + scurry; + stat; + signal; + windowsPathsNoEscape; + withFileTypes; + includeChildMatches; + opts; + patterns; + constructor(t, e) { + if (!e) throw new TypeError("glob options required"); + 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 = (0, Fr.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 !== false, this.noglobstar = !!e.noglobstar, this.matchBase = !!e.matchBase, this.maxDepth = typeof e.maxDepth == "number" ? e.maxDepth : 1 / 0, this.stat = !!e.stat, this.ignore = e.ignore, this.withFileTypes && this.absolute !== void 0) throw new Error("cannot set absolute and withFileTypes:true"); + if (typeof t == "string" && (t = [t]), this.windowsPathsNoEscape = !!e.windowsPathsNoEscape || e.allowWindowsEscape === false, this.windowsPathsNoEscape && (t = t.map((a) => a.replace(/\\/g, "/"))), this.matchBase) { + if (e.noglobstar) throw new TypeError("base matching requires globstar"); + t = t.map((a) => a.includes("/") ? a : `./**/${a}`); + } + if (this.pattern = t, this.platform = e.platform || Nr, this.opts = { ...e, platform: this.platform }, e.scurry) { + if (this.scurry = e.scurry, e.nocase !== void 0 && e.nocase !== e.scurry.nocase) throw new Error("nocase option contradicts provided scurry option"); + } else { + let a = e.platform === "win32" ? ne.PathScurryWin32 : e.platform === "darwin" ? ne.PathScurryDarwin : e.platform ? ne.PathScurryPosix : ne.PathScurry; + this.scurry = new a(this.cwd, { nocase: e.nocase, fs: e.fs }); + } + this.nocase = this.scurry.nocase; + let s = this.platform === "darwin" || this.platform === "win32", i = { braceExpandMax: 1e4, ...e, dot: this.dot, matchBase: this.matchBase, nobrace: this.nobrace, nocase: this.nocase, nocaseMagicOnly: s, nocomment: true, noext: this.noext, nonegate: true, optimizationLevel: 2, platform: this.platform, windowsPathsNoEscape: this.windowsPathsNoEscape, debug: !!this.opts.debug }, r = this.pattern.map((a) => new Dr.Minimatch(a, i)), [h, o] = r.reduce((a, l) => (a[0].push(...l.set), a[1].push(...l.globParts), a), [[], []]); + this.patterns = h.map((a, l) => { + let f = o[l]; + if (!f) throw new Error("invalid pattern object"); + return new jr.Pattern(a, f, 0, this.platform); }); - }); - return this.matches; - } - walkSync() { - if (this.signal?.aborted) - throw this.signal.reason; - if (this.path.isUnknown()) { - this.path.lstatSync(); } - this.walkCBSync(this.path, this.patterns, () => { - if (this.signal?.aborted) - throw this.signal.reason; - }); - return this.matches; - } - }; - exports2.GlobWalker = GlobWalker; - var GlobStream = class extends GlobUtil { - results; - constructor(patterns, path29, opts) { - super(patterns, path29, opts); - this.results = new minipass_1.Minipass({ - signal: this.signal, - objectMode: true - }); - this.results.on("drain", () => this.resume()); - this.results.on("resume", () => this.resume()); - } - matchEmit(e) { - this.results.write(e); - if (!this.results.flowing) - this.pause(); - } - stream() { - const target = this.path; - if (target.isUnknown()) { - target.lstat().then(() => { - this.walkCB(target, this.patterns, () => this.results.end()); - }); - } else { - this.walkCB(target, this.patterns, () => this.results.end()); + async walk() { + return [...await new he.GlobWalker(this.patterns, this.scurry.cwd, { ...this.opts, maxDepth: this.maxDepth !== 1 / 0 ? this.maxDepth + this.scurry.cwd.depth() : 1 / 0, platform: this.platform, nocase: this.nocase, includeChildMatches: this.includeChildMatches }).walk()]; } - return this.results; - } - streamSync() { - if (this.path.isUnknown()) { - this.path.lstatSync(); + walkSync() { + return [...new he.GlobWalker(this.patterns, this.scurry.cwd, { ...this.opts, maxDepth: this.maxDepth !== 1 / 0 ? this.maxDepth + this.scurry.cwd.depth() : 1 / 0, platform: this.platform, nocase: this.nocase, includeChildMatches: this.includeChildMatches }).walkSync()]; } - this.walkCBSync(this.path, this.patterns, () => this.results.end()); - return this.results; - } - }; - exports2.GlobStream = GlobStream; - } -}); - -// node_modules/glob/dist/commonjs/glob.js -var require_glob2 = __commonJS({ - "node_modules/glob/dist/commonjs/glob.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.Glob = void 0; - var minimatch_1 = require_commonjs20(); - var node_url_1 = require("node:url"); - var path_scurry_1 = require_commonjs23(); - var pattern_js_1 = require_pattern(); - var walker_js_1 = require_walker(); - var defaultPlatform2 = typeof process === "object" && process && typeof process.platform === "string" ? process.platform : "linux"; - var Glob = class { - absolute; - cwd; - root; - dot; - dotRelative; - follow; - ignore; - magicalBraces; - mark; - matchBase; - maxDepth; - nobrace; - nocase; - nodir; - noext; - noglobstar; - pattern; - platform; - realpath; - scurry; - stat; - signal; - windowsPathsNoEscape; - withFileTypes; - includeChildMatches; - /** - * The options provided to the constructor. - */ - opts; - /** - * An array of parsed immutable {@link Pattern} objects. - */ - patterns; - /** - * All options are stored as properties on the `Glob` object. - * - * See {@link GlobOptions} for full options descriptions. - * - * Note that a previous `Glob` object can be passed as the - * `GlobOptions` to another `Glob` instantiation to re-use settings - * and caches with a new pattern. - * - * Traversal functions can be called multiple times to run the walk - * again. - */ - constructor(pattern, opts) { - if (!opts) - throw new TypeError("glob options required"); - this.withFileTypes = !!opts.withFileTypes; - this.signal = opts.signal; - this.follow = !!opts.follow; - this.dot = !!opts.dot; - this.dotRelative = !!opts.dotRelative; - this.nodir = !!opts.nodir; - this.mark = !!opts.mark; - if (!opts.cwd) { - this.cwd = ""; - } else if (opts.cwd instanceof URL || opts.cwd.startsWith("file://")) { - opts.cwd = (0, node_url_1.fileURLToPath)(opts.cwd); - } - this.cwd = opts.cwd || ""; - this.root = opts.root; - this.magicalBraces = !!opts.magicalBraces; - this.nobrace = !!opts.nobrace; - this.noext = !!opts.noext; - this.realpath = !!opts.realpath; - this.absolute = opts.absolute; - this.includeChildMatches = opts.includeChildMatches !== false; - this.noglobstar = !!opts.noglobstar; - this.matchBase = !!opts.matchBase; - this.maxDepth = typeof opts.maxDepth === "number" ? opts.maxDepth : Infinity; - this.stat = !!opts.stat; - this.ignore = opts.ignore; - if (this.withFileTypes && this.absolute !== void 0) { - throw new Error("cannot set absolute and withFileTypes:true"); - } - if (typeof pattern === "string") { - pattern = [pattern]; - } - this.windowsPathsNoEscape = !!opts.windowsPathsNoEscape || opts.allowWindowsEscape === false; - if (this.windowsPathsNoEscape) { - pattern = pattern.map((p) => p.replace(/\\/g, "/")); + stream() { + return new he.GlobStream(this.patterns, this.scurry.cwd, { ...this.opts, maxDepth: this.maxDepth !== 1 / 0 ? this.maxDepth + this.scurry.cwd.depth() : 1 / 0, platform: this.platform, nocase: this.nocase, includeChildMatches: this.includeChildMatches }).stream(); } - if (this.matchBase) { - if (opts.noglobstar) { - throw new TypeError("base matching requires globstar"); - } - pattern = pattern.map((p) => p.includes("/") ? p : `./**/${p}`); + streamSync() { + return new he.GlobStream(this.patterns, this.scurry.cwd, { ...this.opts, maxDepth: this.maxDepth !== 1 / 0 ? this.maxDepth + this.scurry.cwd.depth() : 1 / 0, platform: this.platform, nocase: this.nocase, includeChildMatches: this.includeChildMatches }).streamSync(); } - this.pattern = pattern; - this.platform = opts.platform || defaultPlatform2; - this.opts = { ...opts, platform: this.platform }; - if (opts.scurry) { - this.scurry = opts.scurry; - if (opts.nocase !== void 0 && opts.nocase !== opts.scurry.nocase) { - throw new Error("nocase option contradicts provided scurry option"); - } - } else { - const Scurry = opts.platform === "win32" ? path_scurry_1.PathScurryWin32 : opts.platform === "darwin" ? path_scurry_1.PathScurryDarwin : opts.platform ? path_scurry_1.PathScurryPosix : path_scurry_1.PathScurry; - this.scurry = new Scurry(this.cwd, { - nocase: opts.nocase, - fs: opts.fs - }); + iterateSync() { + return this.streamSync()[Symbol.iterator](); } - this.nocase = this.scurry.nocase; - const nocaseMagicOnly = this.platform === "darwin" || this.platform === "win32"; - const mmo = { - // default nocase based on platform - ...opts, - dot: this.dot, - matchBase: this.matchBase, - nobrace: this.nobrace, - nocase: this.nocase, - nocaseMagicOnly, - nocomment: true, - noext: this.noext, - nonegate: true, - optimizationLevel: 2, - platform: this.platform, - windowsPathsNoEscape: this.windowsPathsNoEscape, - debug: !!this.opts.debug - }; - const mms = this.pattern.map((p) => new minimatch_1.Minimatch(p, mmo)); - const [matchSet, globParts] = mms.reduce((set, m) => { - set[0].push(...m.set); - set[1].push(...m.globParts); - return set; - }, [[], []]); - this.patterns = matchSet.map((set, i) => { - const g = globParts[i]; - if (!g) - throw new Error("invalid pattern object"); - return new pattern_js_1.Pattern(set, g, 0, this.platform); - }); - } - async walk() { - return [ - ...await new walker_js_1.GlobWalker(this.patterns, this.scurry.cwd, { - ...this.opts, - maxDepth: this.maxDepth !== Infinity ? this.maxDepth + this.scurry.cwd.depth() : Infinity, - platform: this.platform, - nocase: this.nocase, - includeChildMatches: this.includeChildMatches - }).walk() - ]; - } - walkSync() { - return [ - ...new walker_js_1.GlobWalker(this.patterns, this.scurry.cwd, { - ...this.opts, - maxDepth: this.maxDepth !== Infinity ? this.maxDepth + this.scurry.cwd.depth() : Infinity, - platform: this.platform, - nocase: this.nocase, - includeChildMatches: this.includeChildMatches - }).walkSync() - ]; - } - stream() { - return new walker_js_1.GlobStream(this.patterns, this.scurry.cwd, { - ...this.opts, - maxDepth: this.maxDepth !== Infinity ? this.maxDepth + this.scurry.cwd.depth() : Infinity, - platform: this.platform, - nocase: this.nocase, - includeChildMatches: this.includeChildMatches - }).stream(); - } - streamSync() { - return new walker_js_1.GlobStream(this.patterns, this.scurry.cwd, { - ...this.opts, - maxDepth: this.maxDepth !== Infinity ? this.maxDepth + this.scurry.cwd.depth() : Infinity, - platform: this.platform, - nocase: this.nocase, - includeChildMatches: this.includeChildMatches - }).streamSync(); - } - /** - * Default sync iteration function. Returns a Generator that - * iterates over the results. - */ - iterateSync() { - return this.streamSync()[Symbol.iterator](); - } - [Symbol.iterator]() { - return this.iterateSync(); - } - /** - * Default async iteration function. Returns an AsyncGenerator that - * iterates over the results. - */ - iterate() { - return this.stream()[Symbol.asyncIterator](); - } - [Symbol.asyncIterator]() { - return this.iterate(); - } - }; - exports2.Glob = Glob; - } -}); - -// node_modules/glob/dist/commonjs/has-magic.js -var require_has_magic = __commonJS({ - "node_modules/glob/dist/commonjs/has-magic.js"(exports2) { - "use strict"; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.hasMagic = void 0; - var minimatch_1 = require_commonjs20(); - var hasMagic = (pattern, options = {}) => { - if (!Array.isArray(pattern)) { - pattern = [pattern]; - } - for (const p of pattern) { - if (new minimatch_1.Minimatch(p, options).hasMagic()) - return true; - } - return false; - }; - exports2.hasMagic = hasMagic; - } -}); - -// node_modules/glob/dist/commonjs/index.js -var require_commonjs24 = __commonJS({ - "node_modules/glob/dist/commonjs/index.js"(exports2) { - "use strict"; + [Symbol.iterator]() { + return this.iterateSync(); + } + iterate() { + return this.stream()[Symbol.asyncIterator](); + } + [Symbol.asyncIterator]() { + return this.iterate(); + } + }; + oe.Glob = Fe; + }); + var Ne = R((ae) => { + "use strict"; + Object.defineProperty(ae, "__esModule", { value: true }); + ae.hasMagic = void 0; + var Lr = H(), Wr = (n, t = {}) => { + Array.isArray(n) || (n = [n]); + for (let e of n) if (new Lr.Minimatch(e, t).hasMagic()) return true; + return false; + }; + ae.hasMagic = Wr; + }); Object.defineProperty(exports2, "__esModule", { value: true }); exports2.glob = exports2.sync = exports2.iterate = exports2.iterateSync = exports2.stream = exports2.streamSync = exports2.Ignore = exports2.hasMagic = exports2.Glob = exports2.unescape = exports2.escape = void 0; - exports2.globStreamSync = globStreamSync; - exports2.globStream = globStream; - exports2.globSync = globSync; - exports2.globIterateSync = globIterateSync; - exports2.globIterate = globIterate; - var minimatch_1 = require_commonjs20(); - var glob_js_1 = require_glob2(); - var has_magic_js_1 = require_has_magic(); - var minimatch_2 = require_commonjs20(); + exports2.globStreamSync = xt; + exports2.globStream = Le; + exports2.globSync = We; + exports2.globIterateSync = Tt; + exports2.globIterate = Be; + var Ws = H(); + var tt = je(); + var Br = Ne(); + var Is = H(); Object.defineProperty(exports2, "escape", { enumerable: true, get: function() { - return minimatch_2.escape; + return Is.escape; } }); Object.defineProperty(exports2, "unescape", { enumerable: true, get: function() { - return minimatch_2.unescape; + return Is.unescape; } }); - var glob_js_2 = require_glob2(); + var Ir = je(); Object.defineProperty(exports2, "Glob", { enumerable: true, get: function() { - return glob_js_2.Glob; + return Ir.Glob; } }); - var has_magic_js_2 = require_has_magic(); + var Gr = Ne(); Object.defineProperty(exports2, "hasMagic", { enumerable: true, get: function() { - return has_magic_js_2.hasMagic; + return Gr.hasMagic; } }); - var ignore_js_1 = require_ignore(); + var zr = ke(); Object.defineProperty(exports2, "Ignore", { enumerable: true, get: function() { - return ignore_js_1.Ignore; + return zr.Ignore; } }); - function globStreamSync(pattern, options = {}) { - return new glob_js_1.Glob(pattern, options).streamSync(); + function xt(n, t = {}) { + return new tt.Glob(n, t).streamSync(); } - function globStream(pattern, options = {}) { - return new glob_js_1.Glob(pattern, options).stream(); + function Le(n, t = {}) { + return new tt.Glob(n, t).stream(); } - function globSync(pattern, options = {}) { - return new glob_js_1.Glob(pattern, options).walkSync(); + function We(n, t = {}) { + return new tt.Glob(n, t).walkSync(); } - async function glob_(pattern, options = {}) { - return new glob_js_1.Glob(pattern, options).walk(); + async function Bs(n, t = {}) { + return new tt.Glob(n, t).walk(); } - function globIterateSync(pattern, options = {}) { - return new glob_js_1.Glob(pattern, options).iterateSync(); + function Tt(n, t = {}) { + return new tt.Glob(n, t).iterateSync(); } - function globIterate(pattern, options = {}) { - return new glob_js_1.Glob(pattern, options).iterate(); + function Be(n, t = {}) { + return new tt.Glob(n, t).iterate(); } - exports2.streamSync = globStreamSync; - exports2.stream = Object.assign(globStream, { sync: globStreamSync }); - exports2.iterateSync = globIterateSync; - exports2.iterate = Object.assign(globIterate, { - sync: globIterateSync - }); - exports2.sync = Object.assign(globSync, { - stream: globStreamSync, - iterate: globIterateSync - }); - exports2.glob = Object.assign(glob_, { - glob: glob_, - globSync, - sync: exports2.sync, - globStream, - stream: exports2.stream, - globStreamSync, - streamSync: exports2.streamSync, - globIterate, - iterate: exports2.iterate, - globIterateSync, - iterateSync: exports2.iterateSync, - Glob: glob_js_1.Glob, - hasMagic: has_magic_js_1.hasMagic, - escape: minimatch_1.escape, - unescape: minimatch_1.unescape - }); + exports2.streamSync = xt; + exports2.stream = Object.assign(Le, { sync: xt }); + exports2.iterateSync = Tt; + exports2.iterate = Object.assign(Be, { sync: Tt }); + exports2.sync = Object.assign(We, { stream: xt, iterate: Tt }); + exports2.glob = Object.assign(Bs, { glob: Bs, globSync: We, sync: exports2.sync, globStream: Le, stream: exports2.stream, globStreamSync: xt, streamSync: exports2.streamSync, globIterate: Be, iterate: exports2.iterate, globIterateSync: Tt, iterateSync: exports2.iterateSync, Glob: tt.Glob, hasMagic: Br.hasMagic, escape: Ws.escape, unescape: Ws.unescape }); exports2.glob.glob = exports2.glob; } }); @@ -109581,7 +105482,7 @@ var require_file3 = __commonJS({ var difference = require_difference(); var union = require_union(); var isPlainObject4 = require_isPlainObject(); - var glob2 = require_commonjs24(); + var glob2 = require_index_min(); var file = module2.exports = {}; var pathSeparatorRe = /[\/\\]/g; var processPatterns = function(patterns, fn) { diff --git a/package-lock.json b/package-lock.json index 95ac61f15c..753eb3dace 100644 --- a/package-lock.json +++ b/package-lock.json @@ -56,7 +56,7 @@ "eslint-plugin-import-x": "^4.16.2", "eslint-plugin-jsdoc": "^62.9.0", "eslint-plugin-no-async-foreach": "^0.1.1", - "glob": "^11.1.0", + "glob": "^13.0.6", "globals": "^17.6.0", "nock": "^14.0.15", "sinon": "^22.0.0", @@ -1681,90 +1681,6 @@ "url": "https://github.com/sponsors/nzakas" } }, - "node_modules/@isaacs/cliui": { - "version": "8.0.2", - "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", - "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", - "license": "ISC", - "dependencies": { - "string-width": "^5.1.2", - "string-width-cjs": "npm:string-width@^4.2.0", - "strip-ansi": "^7.0.1", - "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", - "wrap-ansi": "^8.1.0", - "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@isaacs/cliui/node_modules/ansi-regex": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.0.tgz", - "integrity": "sha512-TKY5pyBkHyADOPYlRT9Lx6F544mPl0vS5Ew7BJ45hA08Q+t3GjbueLliBWN3sMICk6+y7HdyxSzC4bWS8baBdg==", - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-regex?sponsor=1" - } - }, - "node_modules/@isaacs/cliui/node_modules/emoji-regex": { - "version": "9.2.2", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", - "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", - "license": "MIT" - }, - "node_modules/@isaacs/cliui/node_modules/string-width": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", - "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", - "license": "MIT", - "dependencies": { - "eastasianwidth": "^0.2.0", - "emoji-regex": "^9.2.2", - "strip-ansi": "^7.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@isaacs/cliui/node_modules/strip-ansi": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", - "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", - "license": "MIT", - "dependencies": { - "ansi-regex": "^6.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/strip-ansi?sponsor=1" - } - }, - "node_modules/@isaacs/cliui/node_modules/wrap-ansi": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", - "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", - "license": "MIT", - "dependencies": { - "ansi-styles": "^6.1.0", - "string-width": "^5.0.1", - "strip-ansi": "^7.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, "node_modules/@isaacs/fs-minipass": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/@isaacs/fs-minipass/-/fs-minipass-4.0.1.tgz", @@ -4618,12 +4534,6 @@ "node": ">= 0.4" } }, - "node_modules/eastasianwidth": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", - "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", - "license": "MIT" - }, "node_modules/electron-to-chromium": { "version": "1.5.68", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.68.tgz", @@ -5976,22 +5886,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/foreground-child": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.1.tgz", - "integrity": "sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==", - "license": "ISC", - "dependencies": { - "cross-spawn": "^7.0.6", - "signal-exit": "^4.0.1" - }, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/fsevents": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", @@ -6177,23 +6071,18 @@ } }, "node_modules/glob": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-11.1.0.tgz", - "integrity": "sha512-vuNwKSaKiqm7g0THUBu2x7ckSs3XJLXE+2ssL7/MfTGPLLcrJQ/4Uq1CjPTtO5cCIiRxqvN6Twy1qOwhL0Xjcw==", + "version": "13.0.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-13.0.6.tgz", + "integrity": "sha512-Wjlyrolmm8uDpm/ogGyXZXb1Z+Ca2B8NbJwqBVg0axK9GbBeoS7yGV6vjXnYdGm6X53iehEuxxbyiKp8QmN4Vw==", + "dev": true, "license": "BlueOak-1.0.0", "dependencies": { - "foreground-child": "^3.3.1", - "jackspeak": "^4.1.1", - "minimatch": "^10.1.1", - "minipass": "^7.1.2", - "package-json-from-dist": "^1.0.0", - "path-scurry": "^2.0.0" - }, - "bin": { - "glob": "dist/esm/bin.mjs" + "minimatch": "^10.2.2", + "minipass": "^7.1.3", + "path-scurry": "^2.0.2" }, "engines": { - "node": "20 || >=22" + "node": "18 || 20 || >=22" }, "funding": { "url": "https://github.com/sponsors/isaacs" @@ -6216,6 +6105,7 @@ "version": "4.0.4", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz", "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==", + "dev": true, "license": "MIT", "engines": { "node": "18 || 20 || >=22" @@ -6225,6 +6115,7 @@ "version": "5.0.6", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.6.tgz", "integrity": "sha512-kLpxurY4Z4r9sgMsyG0Z9uzsBlgiU/EFKhj/h91/8yHu0edo7XuixOIH3VcJ8kkxs6/jPzoI6U9Vj3WqbMQ94g==", + "dev": true, "license": "MIT", "dependencies": { "balanced-match": "^4.0.2" @@ -6237,6 +6128,7 @@ "version": "10.2.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.4.tgz", "integrity": "sha512-oRjTw/97aTBN0RHbYCdtF1MQfvusSIBQM0IZEgzl6426+8jSC0nF1a/GmnVLpfB9yyr6g6FTqWqiZVbxrtaCIg==", + "dev": true, "license": "BlueOak-1.0.0", "dependencies": { "brace-expansion": "^5.0.2" @@ -7080,21 +6972,6 @@ "version": "2.0.0", "license": "ISC" }, - "node_modules/jackspeak": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-4.1.1.tgz", - "integrity": "sha512-zptv57P3GpL+O0I7VdMJNBZCu+BPHVQUk55Ft8/QCJjTVxrnJHuVuX/0Bl2A6/+2oyR/ZMEuFKwmzqqZ/U5nPQ==", - "license": "BlueOak-1.0.0", - "dependencies": { - "@isaacs/cliui": "^8.0.2" - }, - "engines": { - "node": "20 || >=22" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/js-string-escape": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/js-string-escape/-/js-string-escape-1.0.1.tgz", @@ -7365,10 +7242,11 @@ "integrity": "sha512-mNAgZ1GmyNhD7AuqnTG3/VQ26o760+ZYBPKjPvugO8+nLbYfX6TVpJPseBvopbdY+qpZ/lKUnmEc1LeZYS3QAA==" }, "node_modules/lru-cache": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.1.0.tgz", - "integrity": "sha512-QIXZUBJUx+2zHUdQujWejBkcD9+cs94tLn0+YL8UrCh+D5sCXZ4c7LaEH48pNwRY3MLDgqUFyhlCyjJPf1WP0A==", - "license": "ISC", + "version": "11.5.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.1.tgz", + "integrity": "sha512-RPimw/7aMdv2oqRrxKwvZXcPfwBrn/JZ2xYcY9Hus/6LaS3VOAKVWKWgNLCFSiOm1ESXinjsDlidVU7JlnCN2A==", + "dev": true, + "license": "BlueOak-1.0.0", "engines": { "node": "20 || >=22" } @@ -7509,10 +7387,10 @@ } }, "node_modules/minipass": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", - "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", - "license": "ISC", + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.3.tgz", + "integrity": "sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A==", + "license": "BlueOak-1.0.0", "engines": { "node": ">=16 || 14 >=14.17" } @@ -7907,12 +7785,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/package-json-from-dist": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.0.tgz", - "integrity": "sha512-dATvCeZN/8wQsGywez1mzHtTlP22H8OEfPrVMLNr4/eGa+ijtLn/6M5f0dY8UKNrC2O9UCU6SSoG3qRKnt7STw==", - "license": "BlueOak-1.0.0" - }, "node_modules/parent-module": { "version": "1.0.1", "dev": true, @@ -7991,16 +7863,17 @@ "license": "MIT" }, "node_modules/path-scurry": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.0.tgz", - "integrity": "sha512-ypGJsmGtdXUOeM5u93TyeIEfEhM6s+ljAhrk5vAvSx8uyY/02OvrZnA0YNGUrPXfpJMgI1ODd3nwz8Npx4O4cg==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.2.tgz", + "integrity": "sha512-3O/iVVsJAPsOnpwWIeD+d6z/7PmqApyQePUtCndjatj/9I5LylHvt5qluFaBT3I5h3r1ejfR056c+FCv+NnNXg==", + "dev": true, "license": "BlueOak-1.0.0", "dependencies": { "lru-cache": "^11.0.0", "minipass": "^7.1.2" }, "engines": { - "node": "20 || >=22" + "node": "18 || 20 || >=22" }, "funding": { "url": "https://github.com/sponsors/isaacs" @@ -8859,21 +8732,6 @@ "node": ">=8" } }, - "node_modules/string-width-cjs": { - "name": "string-width", - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "license": "MIT", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/string.prototype.includes": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/string.prototype.includes/-/string.prototype.includes-2.0.1.tgz", @@ -8957,19 +8815,6 @@ "node": ">=8" } }, - "node_modules/strip-ansi-cjs": { - "name": "strip-ansi", - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/strip-bom": { "version": "3.0.0", "dev": true, @@ -9804,39 +9649,6 @@ "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, - "node_modules/wrap-ansi-cjs": { - "name": "wrap-ansi", - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, - "node_modules/wrap-ansi-cjs/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, "node_modules/wrap-ansi/node_modules/ansi-styles": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", diff --git a/package.json b/package.json index 1f0dd37a26..d3cd1651f3 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ "eslint-plugin-import-x": "^4.16.2", "eslint-plugin-jsdoc": "^62.9.0", "eslint-plugin-no-async-foreach": "^0.1.1", - "glob": "^11.1.0", + "glob": "^13.0.6", "globals": "^17.6.0", "nock": "^14.0.15", "sinon": "^22.0.0", @@ -90,7 +90,7 @@ "eslint-plugin-jsx-a11y": { "semver": ">=6.3.1" }, - "glob": "^11.1.0", + "glob": "^13.0.6", "undici": "^6.24.0" } }