@vltpkg/cli-js 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/{access-SXQICNAN.js → access-5WETTBDZ.js} +9 -7
  2. package/{bugs-OOPMFRCI.js → bugs-KONFLIQQ.js} +19 -18
  3. package/{build-HDXI5OA7.js → build-S7G2DU7I.js} +12 -10
  4. package/{cache-RW4Y4XNQ.js → cache-Z4OIMLXQ.js} +23 -21
  5. package/{chunk-RXNA2XCX.js → chunk-4KCU2KZL.js} +8 -1
  6. package/{chunk-F2FKLPZD.js → chunk-5B23EKN4.js} +4 -4
  7. package/{chunk-4ZXA6RLP.js → chunk-5QJEOGEM.js} +3 -1
  8. package/{chunk-CCQYIYTA.js → chunk-5UPPEUG2.js} +11 -11
  9. package/chunk-BJBFEQRR.js +667 -0
  10. package/{chunk-MU7Y4R5E.js → chunk-DYCF76WI.js} +4 -4
  11. package/{chunk-EHEVBLDB.js → chunk-E737X73P.js} +38 -24
  12. package/{chunk-ICJRCXSG.js → chunk-FFOXTPQA.js} +12 -9
  13. package/chunk-G7UPIJAP.js +903 -0
  14. package/{chunk-CNSTFT7U.js → chunk-HAYXR3MW.js} +1 -1
  15. package/{chunk-U6DM3ROE.js → chunk-HNCE3YE5.js} +1649 -1569
  16. package/{chunk-2PLIV3N3.js → chunk-IITIX4ID.js} +740 -6
  17. package/chunk-LPIBYUMT.js +854 -0
  18. package/{chunk-E5YE7UTZ.js → chunk-LZGKX7JI.js} +114 -50
  19. package/{chunk-3SQ5Y324.js → chunk-NXEH3NQZ.js} +11 -13
  20. package/{chunk-MT76WHSM.js → chunk-OCJDISSI.js} +12 -6
  21. package/chunk-RNJSI3NZ.js +75 -0
  22. package/{chunk-FAG776ZD.js → chunk-T4GYDWUJ.js} +1 -1
  23. package/{chunk-VM2RMMY4.js → chunk-TMBNGWXK.js} +3 -3
  24. package/{chunk-EQ633HIM.js → chunk-UAAZW4N6.js} +4 -4
  25. package/{chunk-D5CP6O6G.js → chunk-UXIRAU5T.js} +4 -4
  26. package/{chunk-EFWPI6IY.js → chunk-VB3IWNHX.js} +1 -1
  27. package/chunk-VE6CCH33.js +3000 -0
  28. package/{chunk-UCD3RJYG.js → chunk-W2Q5EIMH.js} +8 -8
  29. package/{chunk-VZ7UNZHR.js → chunk-XQSBCMSC.js} +5 -5
  30. package/{reporter-2XBYWAVU.js → chunk-XU5SMHXP.js} +35 -10
  31. package/{ci-MTYU2K2A.js → ci-RZZE375O.js} +17 -16
  32. package/cli-package.json +1 -1
  33. package/{config-TVAXCTQO.js → config-LL3RLMZG.js} +9 -12
  34. package/{config-6NXV2BXW.js → config-MDFY3ORD.js} +15 -18
  35. package/{create-LXI5DCDW.js → create-GVSDTOGQ.js} +23 -23
  36. package/{deprecate-2AQBL5XT.js → deprecate-T4TQLGXQ.js} +16 -14
  37. package/{dist-tag-BFSYLRIH.js → dist-tag-GO46UQUN.js} +11 -9
  38. package/{docs-ADPJ4B4C.js → docs-FJME563T.js} +19 -18
  39. package/{exec-GMS54RAC.js → exec-M22KBPCK.js} +23 -23
  40. package/{exec-cache-R5LVZL5Z.js → exec-cache-3UNLDUAP.js} +22 -22
  41. package/{exec-local-TVCLZGIM.js → exec-local-YHVO5RLU.js} +20 -18
  42. package/{help-6CECUD6C.js → help-ZEWMLOJX.js} +3 -3
  43. package/{init-XXFLGYVP.js → init-4HPZY2KN.js} +12 -10
  44. package/{install-6KMXYSF5.js → install-2TZIP4PJ.js} +18 -17
  45. package/{list-RUO3SUKY.js → list-NFFXER43.js} +20 -18
  46. package/{login-6I2CGO7I.js → login-KV5YC5Z2.js} +9 -7
  47. package/{logout-JTU4BJKH.js → logout-I2VT3NAR.js} +9 -7
  48. package/{pack-NCWH2TUA.js → pack-47ZKFSHI.js} +16 -14
  49. package/package.json +6 -6
  50. package/{ping-4MEAC2WD.js → ping-Q7Y7QV63.js} +9 -7
  51. package/{pkg-ENSKG6G7.js → pkg-VTJS2ISJ.js} +13 -11
  52. package/{profile-62YHNFSO.js → profile-YXZYVEUX.js} +9 -7
  53. package/{publish-PPY724N2.js → publish-CBN67KN2.js} +21 -19
  54. package/{query-NLWXKOOT.js → query-U3QHF3ZE.js} +20 -18
  55. package/{registry-QGI44LG4.js → registry-CZPFR3OF.js} +3 -3
  56. package/registry-client-package.json +1 -1
  57. package/registry-client-src-revalidate.js +2080 -349
  58. package/{repo-BFRAXIVU.js → repo-4UIQRBI7.js} +19 -18
  59. package/{chunk-4RZDJQ5U.js → reporter-DKZTTACW.js} +5 -5
  60. package/{run-7O65747G.js → run-5DUYI6GL.js} +20 -18
  61. package/{run-exec-2OYWHL6K.js → run-exec-HPNBVAXH.js} +20 -18
  62. package/security-archive-src-update-expired.js +39 -4
  63. package/{setup-MMIDAIJI.js → setup-23W5FQVW.js} +24 -15
  64. package/{src-OK3KHDYR.js → src-2NB67FPG.js} +22 -23
  65. package/src-6OKPBJJT.js +59 -0
  66. package/src-M5RRGKUM.js +913 -0
  67. package/{token-VLVXUW54.js → token-SRCS5CRU.js} +9 -7
  68. package/{uninstall-TAG6QIAG.js → uninstall-JXHAFXZ2.js} +18 -17
  69. package/{unpublish-Y4L5J2IA.js → unpublish-GRYB5KQH.js} +12 -10
  70. package/{update-RYH4RKBS.js → update-GDLL4ER6.js} +17 -16
  71. package/{version-COHB32ON.js → version-JVG4CI4L.js} +13 -11
  72. package/{view-P7U4MF43.js → view-ABQLVL4L.js} +13 -15
  73. package/vlr.js +1 -1
  74. package/vlrx.js +1 -1
  75. package/vlt.js +1 -1
  76. package/vlx.js +1 -1
  77. package/vlxl.js +1 -1
  78. package/{whoami-47MVFMZC.js → whoami-RCCZ7BXI.js} +9 -7
  79. package/chunk-7NHXV6AH.js +0 -4488
  80. package/chunk-HB7CKTYO.js +0 -75
  81. package/chunk-PW6S6AIO.js +0 -716
  82. package/chunk-WXMYKCQW.js +0 -1640
  83. package/{chunk-Y7CQIZ7Y.js → chunk-FEIPJIEN.js} +3 -3
package/chunk-7NHXV6AH.js DELETED
@@ -1,4488 +0,0 @@
1
- var global = globalThis;
2
- import {Buffer} from "node:buffer";
3
- import {setTimeout as _vlt_setTimeout,clearTimeout as _vlt_clearTimeout,setImmediate as _vlt_setImmediate,clearImmediate as _vlt_clearImmediate,setInterval as _vlt_setInterval,clearInterval as _vlt_clearInterval} from "node:timers";
4
- globalThis.setTimeout = _vlt_setTimeout;
5
- globalThis.clearTimeout = _vlt_clearTimeout;
6
- globalThis.setImmediate = _vlt_setImmediate;
7
- globalThis.clearImmediate = _vlt_clearImmediate;
8
- globalThis.setInterval = _vlt_setInterval;
9
- globalThis.clearInterval = _vlt_clearInterval;
10
- import {createRequire as _vlt_createRequire} from "node:module";
11
- var require = _vlt_createRequire(import.meta.filename);
12
- import {
13
- error
14
- } from "./chunk-WZWDS3W4.js";
15
-
16
- // ../../node_modules/.vlt/~npm~lru-cache@11.5.2/node_modules/lru-cache/dist/esm/node/index.min.js
17
- import { tracingChannel as G, channel as P } from "node:diagnostics_channel";
18
- var S = P("lru-cache:metrics");
19
- var W = G("lru-cache");
20
- var L = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date;
21
- var R = () => S.hasSubscribers || W.hasSubscribers;
22
- var U = /* @__PURE__ */ new Set();
23
- var M = typeof process == "object" && process ? process : {};
24
- var k = (d4, e, t, i2) => {
25
- typeof M.emitWarning == "function" ? M.emitWarning(d4, e, t, i2) : console.error(`[${t}] ${e}: ${d4}`);
26
- };
27
- var H = (d4) => !U.has(d4);
28
- var T = (d4) => !!d4 && d4 === Math.floor(d4) && d4 > 0 && isFinite(d4);
29
- var j = (d4) => T(d4) ? d4 <= Math.pow(2, 8) ? Uint8Array : d4 <= Math.pow(2, 16) ? Uint16Array : d4 <= Math.pow(2, 32) ? Uint32Array : d4 <= Number.MAX_SAFE_INTEGER ? O : null : null;
30
- var O = class extends Array {
31
- constructor(e) {
32
- super(e), this.fill(0);
33
- }
34
- };
35
- var x = class d {
36
- heap;
37
- length;
38
- static #o = false;
39
- static create(e) {
40
- let t = j(e);
41
- if (!t) return [];
42
- d.#o = true;
43
- let i2 = new d(e, t);
44
- return d.#o = false, i2;
45
- }
46
- constructor(e, t) {
47
- if (!d.#o) throw new TypeError("instantiate Stack using Stack.create(n)");
48
- this.heap = new t(e), this.length = 0;
49
- }
50
- push(e) {
51
- this.heap[this.length++] = e;
52
- }
53
- pop() {
54
- return this.heap[--this.length];
55
- }
56
- };
57
- var I = class d2 {
58
- #o;
59
- #c;
60
- #S;
61
- #O;
62
- #w;
63
- #M;
64
- #I;
65
- #m;
66
- get perf() {
67
- return this.#m;
68
- }
69
- ttl;
70
- ttlResolution;
71
- ttlAutopurge;
72
- updateAgeOnGet;
73
- updateAgeOnHas;
74
- allowStale;
75
- noDisposeOnSet;
76
- noUpdateTTL;
77
- maxEntrySize;
78
- sizeCalculation;
79
- noDeleteOnFetchRejection;
80
- noDeleteOnStaleGet;
81
- allowStaleOnFetchAbort;
82
- allowStaleOnFetchRejection;
83
- ignoreFetchAbort;
84
- backgroundFetchSize;
85
- #n;
86
- #b;
87
- #s;
88
- #i;
89
- #t;
90
- #l;
91
- #u;
92
- #a;
93
- #h;
94
- #y;
95
- #r;
96
- #_;
97
- #F;
98
- #d;
99
- #g;
100
- #T;
101
- #U;
102
- #f;
103
- #D;
104
- static unsafeExposeInternals(e) {
105
- return { starts: e.#F, ttls: e.#d, autopurgeTimers: e.#g, sizes: e.#_, keyMap: e.#s, keyList: e.#i, valList: e.#t, next: e.#l, prev: e.#u, get head() {
106
- return e.#a;
107
- }, get tail() {
108
- return e.#h;
109
- }, free: e.#y, isBackgroundFetch: (t) => e.#e(t), backgroundFetch: (t, i2, s, n7) => e.#P(t, i2, s, n7), moveToTail: (t) => e.#L(t), indexes: (t) => e.#A(t), rindexes: (t) => e.#z(t), isStale: (t) => e.#p(t) };
110
- }
111
- get max() {
112
- return this.#o;
113
- }
114
- get maxSize() {
115
- return this.#c;
116
- }
117
- get calculatedSize() {
118
- return this.#b;
119
- }
120
- get size() {
121
- return this.#n;
122
- }
123
- get fetchMethod() {
124
- return this.#M;
125
- }
126
- get memoMethod() {
127
- return this.#I;
128
- }
129
- get dispose() {
130
- return this.#S;
131
- }
132
- get onInsert() {
133
- return this.#O;
134
- }
135
- get disposeAfter() {
136
- return this.#w;
137
- }
138
- constructor(e) {
139
- let { max: t = 0, ttl: i2, ttlResolution: s = 1, ttlAutopurge: n7, updateAgeOnGet: o, updateAgeOnHas: l, allowStale: h, dispose: r, onInsert: c, disposeAfter: m2, noDisposeOnSet: _3, noUpdateTTL: u2, maxSize: g2 = 0, maxEntrySize: f = 0, sizeCalculation: y2, fetchMethod: a2, memoMethod: w2, noDeleteOnFetchRejection: F3, noDeleteOnStaleGet: b, allowStaleOnFetchRejection: p, allowStaleOnFetchAbort: A3, ignoreFetchAbort: z, backgroundFetchSize: C3 = 1, perf: E } = e;
140
- if (this.backgroundFetchSize = C3, E !== void 0 && typeof E?.now != "function") throw new TypeError("perf option must have a now() method if specified");
141
- if (this.#m = E ?? L, t !== 0 && !T(t)) throw new TypeError("max option must be a nonnegative integer");
142
- let v3 = t ? j(t) : Array;
143
- if (!v3) throw new Error("invalid max value: " + t);
144
- if (this.#o = t, this.#c = g2, this.maxEntrySize = f || this.#c, this.sizeCalculation = y2, this.sizeCalculation) {
145
- if (!this.#c && !this.maxEntrySize) throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");
146
- if (typeof this.sizeCalculation != "function") throw new TypeError("sizeCalculation set to non-function");
147
- }
148
- if (w2 !== void 0 && typeof w2 != "function") throw new TypeError("memoMethod must be a function if defined");
149
- if (this.#I = w2, a2 !== void 0 && typeof a2 != "function") throw new TypeError("fetchMethod must be a function if specified");
150
- if (this.#M = a2, this.#U = !!a2, this.#s = /* @__PURE__ */ new Map(), this.#i = Array.from({ length: t }).fill(void 0), this.#t = Array.from({ length: t }).fill(void 0), this.#l = new v3(t), this.#u = new v3(t), this.#a = 0, this.#h = 0, this.#y = x.create(t), this.#n = 0, this.#b = 0, typeof r == "function" && (this.#S = r), typeof c == "function" && (this.#O = c), typeof m2 == "function" ? (this.#w = m2, this.#r = []) : (this.#w = void 0, this.#r = void 0), this.#T = !!this.#S, this.#D = !!this.#O, this.#f = !!this.#w, this.noDisposeOnSet = !!_3, this.noUpdateTTL = !!u2, this.noDeleteOnFetchRejection = !!F3, this.allowStaleOnFetchRejection = !!p, this.allowStaleOnFetchAbort = !!A3, this.ignoreFetchAbort = !!z, this.maxEntrySize !== 0) {
151
- if (this.#c !== 0 && !T(this.#c)) throw new TypeError("maxSize must be a positive integer if specified");
152
- if (!T(this.maxEntrySize)) throw new TypeError("maxEntrySize must be a positive integer if specified");
153
- this.#X();
154
- }
155
- if (this.allowStale = !!h, this.noDeleteOnStaleGet = !!b, this.updateAgeOnGet = !!o, this.updateAgeOnHas = !!l, this.ttlResolution = T(s) || s === 0 ? s : 1, this.ttlAutopurge = !!n7, this.ttl = i2 || 0, this.ttl) {
156
- if (!T(this.ttl)) throw new TypeError("ttl must be a positive integer if specified");
157
- this.#k();
158
- }
159
- if (this.#o === 0 && this.ttl === 0 && this.#c === 0) throw new TypeError("At least one of max, maxSize, or ttl is required");
160
- if (!this.ttlAutopurge && !this.#o && !this.#c) {
161
- let D2 = "LRU_CACHE_UNBOUNDED";
162
- H(D2) && (U.add(D2), k("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.", "UnboundedCacheWarning", D2, d2));
163
- }
164
- }
165
- getRemainingTTL(e) {
166
- return this.#s.has(e) ? 1 / 0 : 0;
167
- }
168
- #k() {
169
- let e = new O(this.#o), t = new O(this.#o);
170
- this.#d = e, this.#F = t;
171
- let i2 = this.ttlAutopurge ? Array.from({ length: this.#o }) : void 0;
172
- this.#g = i2, this.#H = (h, r, c = this.#m.now()) => {
173
- t[h] = r !== 0 ? c : 0, e[h] = r, s(h, r);
174
- }, this.#R = (h) => {
175
- t[h] = e[h] !== 0 ? this.#m.now() : 0, s(h, e[h]);
176
- };
177
- let s = this.ttlAutopurge ? (h, r) => {
178
- if (i2?.[h] && (clearTimeout(i2[h]), i2[h] = void 0), r && r !== 0 && i2) {
179
- let c = setTimeout(() => {
180
- this.#p(h) ? (this.#E(this.#i[h], "expire"), i2[h] = void 0) : s(h, l(h));
181
- }, r + 1);
182
- c.unref && c.unref(), i2[h] = c;
183
- }
184
- } : () => {
185
- };
186
- this.#v = (h, r) => {
187
- if (e[r]) {
188
- let c = e[r], m2 = t[r];
189
- if (!c || !m2) return;
190
- h.ttl = c, h.start = m2, h.now = n7 || o();
191
- let _3 = h.now - m2;
192
- h.remainingTTL = c - _3;
193
- }
194
- };
195
- let n7 = 0, o = () => {
196
- let h = this.#m.now();
197
- if (this.ttlResolution > 0) {
198
- n7 = h;
199
- let r = setTimeout(() => n7 = 0, this.ttlResolution);
200
- r.unref && r.unref();
201
- }
202
- return h;
203
- };
204
- this.getRemainingTTL = (h) => {
205
- let r = this.#s.get(h);
206
- return r === void 0 ? 0 : l(r);
207
- };
208
- let l = (h) => {
209
- let r = e[h], c = t[h];
210
- if (!r || !c) return 1 / 0;
211
- let m2 = (n7 || o()) - c;
212
- return r - m2;
213
- };
214
- this.#p = (h) => {
215
- let r = t[h], c = e[h];
216
- return !!c && !!r && (n7 || o()) - r > c;
217
- };
218
- }
219
- #R = () => {
220
- };
221
- #v = () => {
222
- };
223
- #H = () => {
224
- };
225
- #p = () => false;
226
- #X() {
227
- let e = new O(this.#o);
228
- this.#b = 0, this.#_ = e, this.#x = (t) => {
229
- this.#b -= e[t], e[t] = 0;
230
- }, this.#N = (t, i2, s, n7) => {
231
- if (!T(s)) {
232
- if (this.#e(i2)) return this.backgroundFetchSize;
233
- if (n7) {
234
- if (typeof n7 != "function") throw new TypeError("sizeCalculation must be a function");
235
- if (s = n7(i2, t), !T(s)) throw new TypeError("sizeCalculation return invalid (expect positive integer)");
236
- } else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");
237
- }
238
- return s;
239
- }, this.#j = (t, i2, s) => {
240
- if (e[t] = i2, this.#c) {
241
- let n7 = this.#c - e[t];
242
- for (; this.#b > n7; ) this.#G(true);
243
- }
244
- this.#b += e[t], s && (s.entrySize = i2, s.totalCalculatedSize = this.#b);
245
- };
246
- }
247
- #x = (e) => {
248
- };
249
- #j = (e, t, i2) => {
250
- };
251
- #N = (e, t, i2, s) => {
252
- if (i2 || s) throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");
253
- return 0;
254
- };
255
- *#A({ allowStale: e = this.allowStale } = {}) {
256
- if (this.#n) for (let t = this.#h; this.#V(t) && ((e || !this.#p(t)) && (yield t), t !== this.#a); ) t = this.#u[t];
257
- }
258
- *#z({ allowStale: e = this.allowStale } = {}) {
259
- if (this.#n) for (let t = this.#a; this.#V(t) && ((e || !this.#p(t)) && (yield t), t !== this.#h); ) t = this.#l[t];
260
- }
261
- #V(e) {
262
- return e !== void 0 && this.#s.get(this.#i[e]) === e;
263
- }
264
- *entries() {
265
- for (let e of this.#A()) this.#t[e] !== void 0 && this.#i[e] !== void 0 && !this.#e(this.#t[e]) && (yield [this.#i[e], this.#t[e]]);
266
- }
267
- *rentries() {
268
- for (let e of this.#z()) this.#t[e] !== void 0 && this.#i[e] !== void 0 && !this.#e(this.#t[e]) && (yield [this.#i[e], this.#t[e]]);
269
- }
270
- *keys() {
271
- for (let e of this.#A()) {
272
- let t = this.#i[e];
273
- t !== void 0 && !this.#e(this.#t[e]) && (yield t);
274
- }
275
- }
276
- *rkeys() {
277
- for (let e of this.#z()) {
278
- let t = this.#i[e];
279
- t !== void 0 && !this.#e(this.#t[e]) && (yield t);
280
- }
281
- }
282
- *values() {
283
- for (let e of this.#A()) this.#t[e] !== void 0 && !this.#e(this.#t[e]) && (yield this.#t[e]);
284
- }
285
- *rvalues() {
286
- for (let e of this.#z()) this.#t[e] !== void 0 && !this.#e(this.#t[e]) && (yield this.#t[e]);
287
- }
288
- [Symbol.iterator]() {
289
- return this.entries();
290
- }
291
- [Symbol.toStringTag] = "LRUCache";
292
- find(e, t = {}) {
293
- for (let i2 of this.#A()) {
294
- let s = this.#t[i2], n7 = this.#e(s) ? s.__staleWhileFetching : s;
295
- if (n7 !== void 0 && e(n7, this.#i[i2], this)) return this.#C(this.#i[i2], t);
296
- }
297
- }
298
- forEach(e, t = this) {
299
- for (let i2 of this.#A()) {
300
- let s = this.#t[i2], n7 = this.#e(s) ? s.__staleWhileFetching : s;
301
- n7 !== void 0 && e.call(t, n7, this.#i[i2], this);
302
- }
303
- }
304
- rforEach(e, t = this) {
305
- for (let i2 of this.#z()) {
306
- let s = this.#t[i2], n7 = this.#e(s) ? s.__staleWhileFetching : s;
307
- n7 !== void 0 && e.call(t, n7, this.#i[i2], this);
308
- }
309
- }
310
- purgeStale() {
311
- let e = false;
312
- for (let t of this.#z({ allowStale: true })) this.#p(t) && (this.#E(this.#i[t], "expire"), e = true);
313
- return e;
314
- }
315
- info(e) {
316
- let t = this.#s.get(e);
317
- if (t === void 0) return;
318
- let i2 = this.#t[t], s = this.#e(i2) ? i2.__staleWhileFetching : i2;
319
- if (s === void 0) return;
320
- let n7 = { value: s };
321
- if (this.#d && this.#F) {
322
- let o = this.#d[t], l = this.#F[t];
323
- if (o && l) {
324
- let h = o - (this.#m.now() - l);
325
- n7.ttl = h, n7.start = Date.now();
326
- }
327
- }
328
- return this.#_ && (n7.size = this.#_[t]), n7;
329
- }
330
- dump() {
331
- let e = [];
332
- for (let t of this.#A({ allowStale: true })) {
333
- let i2 = this.#i[t], s = this.#t[t], n7 = this.#e(s) ? s.__staleWhileFetching : s;
334
- if (n7 === void 0 || i2 === void 0) continue;
335
- let o = { value: n7 };
336
- if (this.#d && this.#F) {
337
- o.ttl = this.#d[t];
338
- let l = this.#m.now() - this.#F[t];
339
- o.start = Math.floor(Date.now() - l);
340
- }
341
- this.#_ && (o.size = this.#_[t]), e.unshift([i2, o]);
342
- }
343
- return e;
344
- }
345
- load(e) {
346
- this.clear();
347
- for (let [t, i2] of e) {
348
- if (i2.start) {
349
- let s = Date.now() - i2.start;
350
- i2.start = this.#m.now() - s;
351
- }
352
- this.#W(t, i2.value, i2);
353
- }
354
- }
355
- set(e, t, i2 = {}) {
356
- let { status: s = S.hasSubscribers ? {} : void 0 } = i2;
357
- i2.status = s, s && (s.op = "set", s.key = e, t !== void 0 && (s.value = t), s.cache = this);
358
- let n7 = this.#W(e, t, i2);
359
- return s && S.hasSubscribers && S.publish(s), n7;
360
- }
361
- #W(e, t, i2, s) {
362
- let { ttl: n7 = this.ttl, start: o, noDisposeOnSet: l = this.noDisposeOnSet, sizeCalculation: h = this.sizeCalculation, status: r } = i2, c = this.#e(t);
363
- if (t === void 0) return r && (r.set = "deleted"), this.delete(e), this;
364
- let { noUpdateTTL: m2 = this.noUpdateTTL } = i2;
365
- r && !c && (r.value = t);
366
- let _3 = this.#N(e, t, i2.size || 0, h, r);
367
- if (this.maxEntrySize && _3 > this.maxEntrySize) return this.#E(e, "set"), r && (r.set = "miss", r.maxEntrySizeExceeded = true), this;
368
- let u2 = this.#n === 0 ? void 0 : this.#s.get(e);
369
- if (u2 === void 0) u2 = this.#n === 0 ? this.#h : this.#y.length !== 0 ? this.#y.pop() : this.#n === this.#o ? this.#G(false) : this.#n, this.#i[u2] = e, this.#t[u2] = t, this.#s.set(e, u2), this.#l[this.#h] = u2, this.#u[u2] = this.#h, this.#h = u2, this.#n++, this.#j(u2, _3, r), r && (r.set = "add"), m2 = false, this.#D && !c && this.#O?.(t, e, "add");
370
- else {
371
- this.#L(u2);
372
- let g2 = this.#t[u2];
373
- if (t !== g2) {
374
- if (!l) if (this.#e(g2)) {
375
- g2 !== s && g2.__abortController.abort(new Error("replaced"));
376
- let { __staleWhileFetching: f } = g2;
377
- f !== void 0 && f !== t && (this.#T && this.#S?.(f, e, "set"), this.#f && this.#r?.push([f, e, "set"]));
378
- } else this.#T && this.#S?.(g2, e, "set"), this.#f && this.#r?.push([g2, e, "set"]);
379
- if (this.#x(u2), this.#j(u2, _3, r), this.#t[u2] = t, !c) {
380
- let f = g2 && this.#e(g2) ? g2.__staleWhileFetching : g2, y2 = f === void 0 ? "add" : t !== f ? "replace" : "update";
381
- r && (r.set = y2, f !== void 0 && (r.oldValue = f)), this.#D && this.onInsert?.(t, e, y2);
382
- }
383
- } else c || (r && (r.set = "update"), this.#D && this.onInsert?.(t, e, "update"));
384
- }
385
- if (n7 !== 0 && !this.#d && this.#k(), this.#d && (m2 || this.#H(u2, n7, o), r && this.#v(r, u2)), !l && this.#f && this.#r) {
386
- let g2 = this.#r, f;
387
- for (; f = g2?.shift(); ) this.#w?.(...f);
388
- }
389
- return this;
390
- }
391
- pop() {
392
- try {
393
- for (; this.#n; ) {
394
- let e = this.#t[this.#a];
395
- if (this.#G(true), this.#e(e)) {
396
- if (e.__staleWhileFetching) return e.__staleWhileFetching;
397
- } else if (e !== void 0) return e;
398
- }
399
- } finally {
400
- if (this.#f && this.#r) {
401
- let e = this.#r, t;
402
- for (; t = e?.shift(); ) this.#w?.(...t);
403
- }
404
- }
405
- }
406
- #G(e) {
407
- let t = this.#a, i2 = this.#i[t], s = this.#t[t], n7 = this.#e(s);
408
- n7 && s.__abortController.abort(new Error("evicted"));
409
- let o = n7 ? s.__staleWhileFetching : s;
410
- return (this.#T || this.#f) && o !== void 0 && (this.#T && this.#S?.(o, i2, "evict"), this.#f && this.#r?.push([o, i2, "evict"])), this.#x(t), this.#g?.[t] && (clearTimeout(this.#g[t]), this.#g[t] = void 0), e && (this.#i[t] = void 0, this.#t[t] = void 0, this.#y.push(t)), this.#n === 1 ? (this.#a = this.#h = 0, this.#y.length = 0) : this.#a = this.#l[t], this.#s.delete(i2), this.#n--, t;
411
- }
412
- has(e, t = {}) {
413
- let { status: i2 = S.hasSubscribers ? {} : void 0 } = t;
414
- t.status = i2, i2 && (i2.op = "has", i2.key = e, i2.cache = this);
415
- let s = this.#Y(e, t);
416
- return S.hasSubscribers && S.publish(i2), s;
417
- }
418
- #Y(e, t = {}) {
419
- let { updateAgeOnHas: i2 = this.updateAgeOnHas, status: s } = t, n7 = this.#s.get(e);
420
- if (n7 !== void 0) {
421
- let o = this.#t[n7];
422
- if (this.#e(o) && o.__staleWhileFetching === void 0) return false;
423
- if (this.#p(n7)) s && (s.has = "stale", this.#v(s, n7));
424
- else return i2 && this.#R(n7), s && (s.has = "hit", this.#v(s, n7)), true;
425
- } else s && (s.has = "miss");
426
- return false;
427
- }
428
- peek(e, t = {}) {
429
- let { status: i2 = R() ? {} : void 0 } = t;
430
- i2 && (i2.op = "peek", i2.key = e, i2.cache = this), t.status = i2;
431
- let s = this.#J(e, t);
432
- return S.hasSubscribers && S.publish(i2), s;
433
- }
434
- #J(e, t) {
435
- let { status: i2, allowStale: s = this.allowStale } = t, n7 = this.#s.get(e);
436
- if (n7 === void 0 || !s && this.#p(n7)) {
437
- i2 && (i2.peek = n7 === void 0 ? "miss" : "stale");
438
- return;
439
- }
440
- let o = this.#t[n7], l = this.#e(o) ? o.__staleWhileFetching : o;
441
- return i2 && (l !== void 0 ? (i2.peek = "hit", i2.value = l) : i2.peek = "miss"), l;
442
- }
443
- #P(e, t, i2, s) {
444
- let n7 = t === void 0 ? void 0 : this.#t[t];
445
- if (this.#e(n7)) return n7;
446
- let o = new AbortController(), { signal: l } = i2;
447
- l?.addEventListener("abort", () => o.abort(l.reason), { signal: o.signal });
448
- let h = { signal: o.signal, options: i2, context: s }, r = (f, y2 = false) => {
449
- let { aborted: a2 } = o.signal, w2 = i2.ignoreFetchAbort && f !== void 0, F3 = i2.ignoreFetchAbort || !!(i2.allowStaleOnFetchAbort && f !== void 0);
450
- if (i2.status && (a2 && !y2 ? (i2.status.fetchAborted = true, i2.status.fetchError = o.signal.reason, w2 && (i2.status.fetchAbortIgnored = true)) : i2.status.fetchResolved = true), a2 && !w2 && !y2) return m2(o.signal.reason, F3);
451
- let b = u2, p = this.#t[t];
452
- return (p === u2 || p === void 0 && w2 && y2) && (f === void 0 ? b.__staleWhileFetching !== void 0 ? this.#t[t] = b.__staleWhileFetching : this.#E(e, "fetch") : (i2.status && (i2.status.fetchUpdated = true), this.#W(e, f, h.options, b))), f;
453
- }, c = (f) => (i2.status && (i2.status.fetchRejected = true, i2.status.fetchError = f), m2(f, false)), m2 = (f, y2) => {
454
- let { aborted: a2 } = o.signal, w2 = a2 && i2.allowStaleOnFetchAbort, F3 = w2 || i2.allowStaleOnFetchRejection, b = F3 || i2.noDeleteOnFetchRejection, p = u2;
455
- if (this.#t[t] === u2 && (!b || !y2 && p.__staleWhileFetching === void 0 ? this.#E(e, "fetch") : w2 || (this.#t[t] = p.__staleWhileFetching)), F3) return i2.status && p.__staleWhileFetching !== void 0 && (i2.status.returnedStale = true), p.__staleWhileFetching;
456
- if (p.__returned === p) throw f;
457
- }, _3 = (f, y2) => {
458
- let a2 = this.#M?.(e, n7, h);
459
- o.signal.addEventListener("abort", () => {
460
- (!i2.ignoreFetchAbort || i2.allowStaleOnFetchAbort) && (f(void 0), i2.allowStaleOnFetchAbort && (f = (w2) => r(w2, true)));
461
- }), a2 && a2 instanceof Promise ? a2.then((w2) => f(w2 === void 0 ? void 0 : w2), y2) : a2 !== void 0 && f(a2);
462
- };
463
- i2.status && (i2.status.fetchDispatched = true);
464
- let u2 = new Promise(_3).then(r, c), g2 = Object.assign(u2, { __abortController: o, __staleWhileFetching: n7, __returned: void 0 });
465
- return t === void 0 ? (this.#W(e, g2, { ...h.options, status: void 0 }), t = this.#s.get(e)) : this.#t[t] = g2, g2;
466
- }
467
- #e(e) {
468
- if (!this.#U) return false;
469
- let t = e;
470
- return !!t && t instanceof Promise && t.hasOwnProperty("__staleWhileFetching") && t.__abortController instanceof AbortController;
471
- }
472
- fetch(e, t = {}) {
473
- let i2 = W.hasSubscribers, { status: s = R() ? {} : void 0 } = t;
474
- t.status = s, s && t.context && (s.context = t.context);
475
- let n7 = this.#B(e, t);
476
- return s && i2 && (s.trace = true, W.tracePromise(() => n7, s).catch(() => {
477
- })), n7;
478
- }
479
- async #B(e, t = {}) {
480
- let { allowStale: i2 = this.allowStale, updateAgeOnGet: s = this.updateAgeOnGet, noDeleteOnStaleGet: n7 = this.noDeleteOnStaleGet, ttl: o = this.ttl, noDisposeOnSet: l = this.noDisposeOnSet, size: h = 0, sizeCalculation: r = this.sizeCalculation, noUpdateTTL: c = this.noUpdateTTL, noDeleteOnFetchRejection: m2 = this.noDeleteOnFetchRejection, allowStaleOnFetchRejection: _3 = this.allowStaleOnFetchRejection, ignoreFetchAbort: u2 = this.ignoreFetchAbort, allowStaleOnFetchAbort: g2 = this.allowStaleOnFetchAbort, context: f, forceRefresh: y2 = false, status: a2, signal: w2 } = t;
481
- if (a2 && (a2.op = "fetch", a2.key = e, y2 && (a2.forceRefresh = true), a2.cache = this), !this.#U) return a2 && (a2.fetch = "get"), this.#C(e, { allowStale: i2, updateAgeOnGet: s, noDeleteOnStaleGet: n7, status: a2 });
482
- let F3 = { allowStale: i2, updateAgeOnGet: s, noDeleteOnStaleGet: n7, ttl: o, noDisposeOnSet: l, size: h, sizeCalculation: r, noUpdateTTL: c, noDeleteOnFetchRejection: m2, allowStaleOnFetchRejection: _3, allowStaleOnFetchAbort: g2, ignoreFetchAbort: u2, status: a2, signal: w2 }, b = this.#s.get(e);
483
- if (b === void 0) {
484
- a2 && (a2.fetch = "miss");
485
- let p = this.#P(e, b, F3, f);
486
- return p.__returned = p;
487
- } else {
488
- let p = this.#t[b];
489
- if (this.#e(p)) {
490
- let v3 = i2 && p.__staleWhileFetching !== void 0;
491
- return a2 && (a2.fetch = "inflight", v3 && (a2.returnedStale = true)), v3 ? p.__staleWhileFetching : p.__returned = p;
492
- }
493
- let A3 = this.#p(b);
494
- if (!y2 && !A3) return a2 && (a2.fetch = "hit"), this.#L(b), s && this.#R(b), a2 && this.#v(a2, b), p;
495
- let z = this.#P(e, b, F3, f), E = z.__staleWhileFetching !== void 0 && i2;
496
- return a2 && (a2.fetch = A3 ? "stale" : "refresh", E && A3 && (a2.returnedStale = true)), E ? z.__staleWhileFetching : z.__returned = z;
497
- }
498
- }
499
- forceFetch(e, t = {}) {
500
- let i2 = W.hasSubscribers, { status: s = R() ? {} : void 0 } = t;
501
- t.status = s, s && t.context && (s.context = t.context);
502
- let n7 = this.#K(e, t);
503
- return s && i2 && (s.trace = true, W.tracePromise(() => n7, s).catch(() => {
504
- })), n7;
505
- }
506
- async #K(e, t = {}) {
507
- let i2 = await this.#B(e, t);
508
- if (i2 === void 0) throw new Error("fetch() returned undefined");
509
- return i2;
510
- }
511
- memo(e, t = {}) {
512
- let { status: i2 = S.hasSubscribers ? {} : void 0 } = t;
513
- t.status = i2, i2 && (i2.op = "memo", i2.key = e, t.context && (i2.context = t.context), i2.cache = this);
514
- let s = this.#Q(e, t);
515
- return i2 && (i2.value = s), S.hasSubscribers && S.publish(i2), s;
516
- }
517
- #Q(e, t = {}) {
518
- let i2 = this.#I;
519
- if (!i2) throw new Error("no memoMethod provided to constructor");
520
- let { context: s, status: n7, forceRefresh: o, ...l } = t;
521
- n7 && o && (n7.forceRefresh = true);
522
- let h = this.#C(e, l), r = o || h === void 0;
523
- if (n7 && (n7.memo = r ? "miss" : "hit", r || (n7.value = h)), !r) return h;
524
- let c = i2(e, h, { options: l, context: s });
525
- return n7 && (n7.value = c), this.#W(e, c, l), c;
526
- }
527
- get(e, t = {}) {
528
- let { status: i2 = S.hasSubscribers ? {} : void 0 } = t;
529
- t.status = i2, i2 && (i2.op = "get", i2.key = e, i2.cache = this);
530
- let s = this.#C(e, t);
531
- return i2 && (s !== void 0 && (i2.value = s), S.hasSubscribers && S.publish(i2)), s;
532
- }
533
- #C(e, t = {}) {
534
- let { allowStale: i2 = this.allowStale, updateAgeOnGet: s = this.updateAgeOnGet, noDeleteOnStaleGet: n7 = this.noDeleteOnStaleGet, status: o } = t, l = this.#s.get(e);
535
- if (l === void 0) {
536
- o && (o.get = "miss");
537
- return;
538
- }
539
- let h = this.#t[l], r = this.#e(h);
540
- return o && this.#v(o, l), this.#p(l) ? r ? (o && (o.get = "stale-fetching"), i2 && h.__staleWhileFetching !== void 0 ? (o && (o.returnedStale = true), h.__staleWhileFetching) : void 0) : (n7 || this.#E(e, "expire"), o && (o.get = "stale"), i2 ? (o && (o.returnedStale = true), h) : void 0) : (o && (o.get = r ? "fetching" : "hit"), this.#L(l), s && this.#R(l), r ? h.__staleWhileFetching : h);
541
- }
542
- #$(e, t) {
543
- this.#u[t] = e, this.#l[e] = t;
544
- }
545
- #L(e) {
546
- e !== this.#h && (e === this.#a ? this.#a = this.#l[e] : this.#$(this.#u[e], this.#l[e]), this.#$(this.#h, e), this.#h = e);
547
- }
548
- delete(e) {
549
- return this.#E(e, "delete");
550
- }
551
- #E(e, t) {
552
- S.hasSubscribers && S.publish({ op: "delete", delete: t, key: e, cache: this });
553
- let i2 = false;
554
- if (this.#n !== 0) {
555
- let s = this.#s.get(e);
556
- if (s !== void 0) if (this.#g?.[s] && (clearTimeout(this.#g[s]), this.#g[s] = void 0), i2 = true, this.#n === 1) this.#q(t);
557
- else {
558
- this.#x(s);
559
- let n7 = this.#t[s];
560
- if (this.#e(n7) ? n7.__abortController.abort(new Error("deleted")) : (this.#T || this.#f) && (this.#T && this.#S?.(n7, e, t), this.#f && this.#r?.push([n7, e, t])), this.#s.delete(e), this.#i[s] = void 0, this.#t[s] = void 0, s === this.#h) this.#h = this.#u[s];
561
- else if (s === this.#a) this.#a = this.#l[s];
562
- else {
563
- let o = this.#u[s];
564
- this.#l[o] = this.#l[s];
565
- let l = this.#l[s];
566
- this.#u[l] = this.#u[s];
567
- }
568
- this.#n--, this.#y.push(s);
569
- }
570
- }
571
- if (this.#f && this.#r?.length) {
572
- let s = this.#r, n7;
573
- for (; n7 = s?.shift(); ) this.#w?.(...n7);
574
- }
575
- return i2;
576
- }
577
- clear() {
578
- return this.#q("delete");
579
- }
580
- #q(e) {
581
- for (let t of this.#z({ allowStale: true })) {
582
- let i2 = this.#t[t];
583
- if (this.#e(i2)) i2.__abortController.abort(new Error("deleted"));
584
- else {
585
- let s = this.#i[t];
586
- this.#T && this.#S?.(i2, s, e), this.#f && this.#r?.push([i2, s, e]);
587
- }
588
- }
589
- if (this.#s.clear(), this.#t.fill(void 0), this.#i.fill(void 0), this.#d && this.#F) {
590
- this.#d.fill(0), this.#F.fill(0);
591
- for (let t of this.#g ?? []) t !== void 0 && clearTimeout(t);
592
- this.#g?.fill(void 0);
593
- }
594
- if (this.#_ && this.#_.fill(0), this.#a = 0, this.#h = 0, this.#y.length = 0, this.#b = 0, this.#n = 0, this.#f && this.#r) {
595
- let t = this.#r, i2;
596
- for (; i2 = t?.shift(); ) this.#w?.(...i2);
597
- }
598
- }
599
- };
600
-
601
- // ../../src/promise-spawn/src/index.ts
602
- import { spawn } from "node:child_process";
603
- var isPipe = (stdio = "pipe", fd) => stdio === "pipe" || stdio === "overlapped" || stdio === null ? true : Array.isArray(stdio) ? isPipe(stdio[fd], fd) : false;
604
- function stdioResult(stdout, stderr, o) {
605
- return {
606
- stdout: !isPipe(o.stdio, 1) ? null : o.stdioString !== false ? Buffer.concat(stdout).toString().trim() : Buffer.concat(stdout),
607
- stderr: !isPipe(o.stdio, 2) ? null : o.stdioString !== false ? Buffer.concat(stderr).toString().trim() : Buffer.concat(stderr)
608
- };
609
- }
610
- var SpawnPromise = class extends Promise {
611
- [Symbol.toStringTag] = "SpawnPromise";
612
- /** The spawned process this promise references */
613
- process;
614
- /** Expose the child process stdin, if available */
615
- stdin;
616
- /**
617
- * Set static `Symbol.species` back to the base Promise class so that
618
- * v8 doesn't get confused by the changed constructor signature.
619
- */
620
- static get [Symbol.species]() {
621
- return Promise;
622
- }
623
- constructor(command, args, opts, extra = {}) {
624
- let proc;
625
- super((res, rej) => {
626
- proc = spawn(command, args, opts);
627
- const stdout = [];
628
- const stderr = [];
629
- const reject = (er, status, signal) => {
630
- const stdio = stdioResult(stdout, stderr, opts);
631
- const errorResult = {
632
- command,
633
- args,
634
- stdout: stdio.stdout,
635
- stderr: stdio.stderr,
636
- cwd: opts.cwd?.toString() ?? process.cwd()
637
- };
638
- if (er !== void 0) {
639
- errorResult.cause = er;
640
- }
641
- if (status !== void 0) {
642
- errorResult.status = status;
643
- }
644
- if (signal !== void 0) {
645
- errorResult.signal = signal;
646
- }
647
- Object.assign(errorResult, extra);
648
- rej(error("command failed", errorResult));
649
- };
650
- const resolve6 = (status, signal) => {
651
- const stdio = stdioResult(stdout, stderr, opts);
652
- const successResult = {
653
- command,
654
- args,
655
- status,
656
- signal,
657
- stdout: stdio.stdout,
658
- stderr: stdio.stderr,
659
- cwd: opts.cwd?.toString() ?? process.cwd()
660
- };
661
- Object.assign(successResult, extra);
662
- res(successResult);
663
- };
664
- proc.on("error", reject);
665
- proc.stdout?.on("data", (c) => stdout.push(c)).on("error", reject);
666
- proc.stderr?.on("data", (c) => stderr.push(c)).on("error", reject);
667
- proc.on("close", (status, signal) => {
668
- if ((status || signal) && !opts.acceptFail) {
669
- reject(void 0, status, signal);
670
- } else {
671
- resolve6(status, signal);
672
- }
673
- });
674
- });
675
- this.process = proc;
676
- this.stdin = proc.stdin;
677
- }
678
- };
679
- function promiseSpawn(command, args, opts = {}, extra = {}) {
680
- return new SpawnPromise(command, args, opts, extra);
681
- }
682
-
683
- // ../../node_modules/.vlt/~npm~isexe@3.1.5/node_modules/isexe/dist/esm/index.min.js
684
- import { statSync as w } from "node:fs";
685
- import { stat as S2 } from "node:fs/promises";
686
- import { statSync as k2 } from "node:fs";
687
- import { stat as I2 } from "node:fs/promises";
688
- import { delimiter as _ } from "node:path";
689
- var y = Object.defineProperty;
690
- var u = (t, r) => {
691
- for (var e in r) y(t, e, { get: r[e], enumerable: true });
692
- };
693
- var i = {};
694
- u(i, { isexe: () => C, sync: () => A });
695
- var C = async (t, r = {}) => {
696
- let { ignoreErrors: e = false } = r;
697
- try {
698
- return d3(await S2(t), r);
699
- } catch (s) {
700
- let o = s;
701
- if (e || o.code === "EACCES") return false;
702
- throw o;
703
- }
704
- };
705
- var A = (t, r = {}) => {
706
- let { ignoreErrors: e = false } = r;
707
- try {
708
- return d3(w(t), r);
709
- } catch (s) {
710
- let o = s;
711
- if (e || o.code === "EACCES") return false;
712
- throw o;
713
- }
714
- };
715
- var d3 = (t, r) => t.isFile() && T2(t, r);
716
- var T2 = (t, r) => {
717
- let e = r.uid ?? process.getuid?.(), s = r.groups ?? process.getgroups?.() ?? [], o = r.gid ?? process.getgid?.() ?? s[0];
718
- if (e === void 0 || o === void 0) throw new Error("cannot get uid or gid");
719
- let c = /* @__PURE__ */ new Set([o, ...s]), n7 = t.mode, l = t.uid, E = t.gid, f = parseInt("100", 8), p = parseInt("010", 8), x3 = parseInt("001", 8), h = f | p;
720
- return !!(n7 & x3 || n7 & p && c.has(E) || n7 & f && l === e || n7 & h && e === 0);
721
- };
722
- var a = {};
723
- u(a, { isexe: () => F, sync: () => L2 });
724
- var F = async (t, r = {}) => {
725
- let { ignoreErrors: e = false } = r;
726
- try {
727
- return m(await I2(t), t, r);
728
- } catch (s) {
729
- let o = s;
730
- if (e || o.code === "EACCES") return false;
731
- throw o;
732
- }
733
- };
734
- var L2 = (t, r = {}) => {
735
- let { ignoreErrors: e = false } = r;
736
- try {
737
- return m(k2(t), t, r);
738
- } catch (s) {
739
- let o = s;
740
- if (e || o.code === "EACCES") return false;
741
- throw o;
742
- }
743
- };
744
- var P2 = (t, r) => {
745
- let { pathExt: e = process.env.PATHEXT || "" } = r, s = e.split(_);
746
- if (s.indexOf("") !== -1) return true;
747
- for (let o of s) {
748
- let c = o.toLowerCase(), n7 = t.substring(t.length - c.length).toLowerCase();
749
- if (c && n7 === c) return true;
750
- }
751
- return false;
752
- };
753
- var m = (t, r, e) => t.isFile() && P2(r, e);
754
- var v = process.env._ISEXE_TEST_PLATFORM_ || process.platform;
755
- var g = v === "win32" ? a : i;
756
- var R2 = g.isexe;
757
- var U2 = g.sync;
758
-
759
- // ../../src/which/src/index.ts
760
- import { delimiter, join, sep } from "node:path";
761
- var isWindows = process.platform === "win32";
762
- var rSlash = sep === "/" ? /\// : /[\\/]/;
763
- var rRel = new RegExp(`^\\.${rSlash.source}`);
764
- var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
765
- var getPathInfo = (cmd, {
766
- path: optPath = process.env.PATH,
767
- pathExt: optPathExt = process.env.PATHEXT,
768
- delimiter: optDelimiter = delimiter
769
- }) => {
770
- const pathEnv = cmd.match(rSlash) ? [""] : [
771
- // windows always checks the cwd first
772
- /* c8 ignore next - platform-specific */
773
- ...isWindows ? [process.cwd()] : [],
774
- ...(optPath ?? /* c8 ignore next - very unusual */
775
- "").split(
776
- optDelimiter
777
- )
778
- ];
779
- if (isWindows) {
780
- const pathExtExe = optPathExt || [".EXE", ".CMD", ".BAT", ".COM"].join(optDelimiter);
781
- const pathExt = pathExtExe.split(optDelimiter).flatMap((item) => [item, item.toLowerCase()]);
782
- if (cmd.includes(".") && pathExt[0] !== "") {
783
- pathExt.unshift("");
784
- }
785
- return { pathEnv, pathExt, pathExtExe };
786
- }
787
- return { pathEnv, pathExt: [""] };
788
- };
789
- var getPathPart = (raw, cmd) => {
790
- const pathPart = /^".*"$/.test(raw) ? raw.slice(1, -1) : raw;
791
- const prefix = !pathPart && rRel.test(cmd) ? cmd.slice(0, 2) : "";
792
- return prefix + join(pathPart, cmd);
793
- };
794
- async function which(cmd, opt = {}) {
795
- const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
796
- const found = [];
797
- for (const envPart of pathEnv) {
798
- const p = getPathPart(envPart, cmd);
799
- for (const ext of pathExt) {
800
- const withExt = p + ext;
801
- const is2 = await R2(withExt, {
802
- pathExt: pathExtExe,
803
- ignoreErrors: true
804
- });
805
- if (is2) {
806
- if (!opt.all) {
807
- return withExt;
808
- }
809
- found.push(withExt);
810
- }
811
- }
812
- }
813
- if (opt.all && found.length) {
814
- return found;
815
- }
816
- if (opt.nothrow) {
817
- return null;
818
- }
819
- throw getNotFoundError(cmd);
820
- }
821
- function whichSync(cmd, opt = {}) {
822
- const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
823
- const found = [];
824
- for (const pathEnvPart of pathEnv) {
825
- const p = getPathPart(pathEnvPart, cmd);
826
- for (const ext of pathExt) {
827
- const withExt = p + ext;
828
- const is2 = U2(withExt, {
829
- pathExt: pathExtExe,
830
- ignoreErrors: true
831
- });
832
- if (is2) {
833
- if (!opt.all) {
834
- return withExt;
835
- }
836
- found.push(withExt);
837
- }
838
- }
839
- }
840
- if (opt.all && found.length) {
841
- return found;
842
- }
843
- if (opt.nothrow) {
844
- return null;
845
- }
846
- throw getNotFoundError(cmd);
847
- }
848
-
849
- // ../../node_modules/.vlt/~npm~glob@13.0.6/node_modules/glob/dist/esm/index.min.js
850
- import { fileURLToPath as Wi } from "node:url";
851
- import { posix as mi, win32 as re } from "node:path";
852
- import { fileURLToPath as gi } from "node:url";
853
- import { lstatSync as wi, readdir as yi, readdirSync as bi, readlinkSync as Si, realpathSync as Ei } from "node:fs";
854
- import * as xi from "node:fs";
855
- import { lstat as Ci, readdir as Ti, readlink as Ai, realpath as ki } from "node:fs/promises";
856
- import { EventEmitter as ee } from "node:events";
857
- import Pe from "node:stream";
858
- import { StringDecoder as ni } from "node:string_decoder";
859
- var Gt = (n7, t, e) => {
860
- let s = n7 instanceof RegExp ? ce(n7, e) : n7, i2 = t instanceof RegExp ? ce(t, e) : t, r = s !== null && i2 != null && ss(s, i2, e);
861
- 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] + i2.length) };
862
- };
863
- var ce = (n7, t) => {
864
- let e = t.match(n7);
865
- return e ? e[0] : null;
866
- };
867
- var ss = (n7, t, e) => {
868
- let s, i2, r, o, h, a2 = e.indexOf(n7), l = e.indexOf(t, a2 + 1), u2 = a2;
869
- if (a2 >= 0 && l > 0) {
870
- if (n7 === t) return [a2, l];
871
- for (s = [], r = e.length; u2 >= 0 && !h; ) {
872
- if (u2 === a2) s.push(u2), a2 = e.indexOf(n7, u2 + 1);
873
- else if (s.length === 1) {
874
- let c = s.pop();
875
- c !== void 0 && (h = [c, l]);
876
- } else i2 = s.pop(), i2 !== void 0 && i2 < r && (r = i2, o = l), l = e.indexOf(t, u2 + 1);
877
- u2 = a2 < l && a2 >= 0 ? a2 : l;
878
- }
879
- s.length && o !== void 0 && (h = [r, o]);
880
- }
881
- return h;
882
- };
883
- var fe = "\0SLASH" + Math.random() + "\0";
884
- var ue = "\0OPEN" + Math.random() + "\0";
885
- var qt = "\0CLOSE" + Math.random() + "\0";
886
- var de = "\0COMMA" + Math.random() + "\0";
887
- var pe = "\0PERIOD" + Math.random() + "\0";
888
- var is = new RegExp(fe, "g");
889
- var rs = new RegExp(ue, "g");
890
- var ns = new RegExp(qt, "g");
891
- var os = new RegExp(de, "g");
892
- var hs = new RegExp(pe, "g");
893
- var as = /\\\\/g;
894
- var ls = /\\{/g;
895
- var cs = /\\}/g;
896
- var fs = /\\,/g;
897
- var us = /\\./g;
898
- var ds = 1e5;
899
- function Ht(n7) {
900
- return isNaN(n7) ? n7.charCodeAt(0) : parseInt(n7, 10);
901
- }
902
- function ps(n7) {
903
- return n7.replace(as, fe).replace(ls, ue).replace(cs, qt).replace(fs, de).replace(us, pe);
904
- }
905
- function ms(n7) {
906
- return n7.replace(is, "\\").replace(rs, "{").replace(ns, "}").replace(os, ",").replace(hs, ".");
907
- }
908
- function me(n7) {
909
- if (!n7) return [""];
910
- let t = [], e = Gt("{", "}", n7);
911
- if (!e) return n7.split(",");
912
- let { pre: s, body: i2, post: r } = e, o = s.split(",");
913
- o[o.length - 1] += "{" + i2 + "}";
914
- let h = me(r);
915
- return r.length && (o[o.length - 1] += h.shift(), o.push.apply(o, h)), t.push.apply(t, o), t;
916
- }
917
- function ge(n7, t = {}) {
918
- if (!n7) return [];
919
- let { max: e = ds } = t;
920
- return n7.slice(0, 2) === "{}" && (n7 = "\\{\\}" + n7.slice(2)), ht(ps(n7), e, true).map(ms);
921
- }
922
- function gs(n7) {
923
- return "{" + n7 + "}";
924
- }
925
- function ws(n7) {
926
- return /^-?0\d/.test(n7);
927
- }
928
- function ys(n7, t) {
929
- return n7 <= t;
930
- }
931
- function bs(n7, t) {
932
- return n7 >= t;
933
- }
934
- function ht(n7, t, e) {
935
- let s = [], i2 = Gt("{", "}", n7);
936
- if (!i2) return [n7];
937
- let r = i2.pre, o = i2.post.length ? ht(i2.post, t, false) : [""];
938
- if (/\$$/.test(i2.pre)) for (let h = 0; h < o.length && h < t; h++) {
939
- let a2 = r + "{" + i2.body + "}" + o[h];
940
- s.push(a2);
941
- }
942
- else {
943
- let h = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i2.body), a2 = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i2.body), l = h || a2, u2 = i2.body.indexOf(",") >= 0;
944
- if (!l && !u2) return i2.post.match(/,(?!,).*\}/) ? (n7 = i2.pre + "{" + i2.body + qt + i2.post, ht(n7, t, true)) : [n7];
945
- let c;
946
- if (l) c = i2.body.split(/\.\./);
947
- else if (c = me(i2.body), c.length === 1 && c[0] !== void 0 && (c = ht(c[0], t, false).map(gs), c.length === 1)) return o.map((f) => i2.pre + c[0] + f);
948
- let d4;
949
- if (l && c[0] !== void 0 && c[1] !== void 0) {
950
- let f = Ht(c[0]), m2 = Ht(c[1]), p = Math.max(c[0].length, c[1].length), w2 = c.length === 3 && c[2] !== void 0 ? Math.abs(Ht(c[2])) : 1, g2 = ys;
951
- m2 < f && (w2 *= -1, g2 = bs);
952
- let E = c.some(ws);
953
- d4 = [];
954
- for (let y2 = f; g2(y2, m2); y2 += w2) {
955
- let b;
956
- if (a2) b = String.fromCharCode(y2), b === "\\" && (b = "");
957
- else if (b = String(y2), E) {
958
- let z = p - b.length;
959
- if (z > 0) {
960
- let $ = new Array(z + 1).join("0");
961
- y2 < 0 ? b = "-" + $ + b.slice(1) : b = $ + b;
962
- }
963
- }
964
- d4.push(b);
965
- }
966
- } else {
967
- d4 = [];
968
- for (let f = 0; f < c.length; f++) d4.push.apply(d4, ht(c[f], t, false));
969
- }
970
- for (let f = 0; f < d4.length; f++) for (let m2 = 0; m2 < o.length && s.length < t; m2++) {
971
- let p = r + d4[f] + o[m2];
972
- (!e || l || p) && s.push(p);
973
- }
974
- }
975
- return s;
976
- }
977
- var at = (n7) => {
978
- if (typeof n7 != "string") throw new TypeError("invalid pattern");
979
- if (n7.length > 65536) throw new TypeError("pattern is too long");
980
- };
981
- var Ss = { "[: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] };
982
- var lt = (n7) => n7.replace(/[[\]\\-]/g, "\\$&");
983
- var Es = (n7) => n7.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
984
- var we = (n7) => n7.join("");
985
- var ye = (n7, t) => {
986
- let e = t;
987
- if (n7.charAt(e) !== "[") throw new Error("not in a brace expression");
988
- let s = [], i2 = [], r = e + 1, o = false, h = false, a2 = false, l = false, u2 = e, c = "";
989
- t: for (; r < n7.length; ) {
990
- let p = n7.charAt(r);
991
- if ((p === "!" || p === "^") && r === e + 1) {
992
- l = true, r++;
993
- continue;
994
- }
995
- if (p === "]" && o && !a2) {
996
- u2 = r + 1;
997
- break;
998
- }
999
- if (o = true, p === "\\" && !a2) {
1000
- a2 = true, r++;
1001
- continue;
1002
- }
1003
- if (p === "[" && !a2) {
1004
- for (let [w2, [g2, S3, E]] of Object.entries(Ss)) if (n7.startsWith(w2, r)) {
1005
- if (c) return ["$.", false, n7.length - e, true];
1006
- r += w2.length, E ? i2.push(g2) : s.push(g2), h = h || S3;
1007
- continue t;
1008
- }
1009
- }
1010
- if (a2 = false, c) {
1011
- p > c ? s.push(lt(c) + "-" + lt(p)) : p === c && s.push(lt(p)), c = "", r++;
1012
- continue;
1013
- }
1014
- if (n7.startsWith("-]", r + 1)) {
1015
- s.push(lt(p + "-")), r += 2;
1016
- continue;
1017
- }
1018
- if (n7.startsWith("-", r + 1)) {
1019
- c = p, r += 2;
1020
- continue;
1021
- }
1022
- s.push(lt(p)), r++;
1023
- }
1024
- if (u2 < r) return ["", false, 0, false];
1025
- if (!s.length && !i2.length) return ["$.", false, n7.length - e, true];
1026
- if (i2.length === 0 && s.length === 1 && /^\\?.$/.test(s[0]) && !l) {
1027
- let p = s[0].length === 2 ? s[0].slice(-1) : s[0];
1028
- return [Es(p), false, u2 - e, false];
1029
- }
1030
- let d4 = "[" + (l ? "^" : "") + we(s) + "]", f = "[" + (l ? "" : "^") + we(i2) + "]";
1031
- return [s.length && i2.length ? "(" + d4 + "|" + f + ")" : s.length ? d4 : f, h, u2 - e, true];
1032
- };
1033
- var W2 = (n7, { windowsPathsNoEscape: t = false, magicalBraces: e = true } = {}) => e ? t ? n7.replace(/\[([^\/\\])\]/g, "$1") : n7.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1") : t ? n7.replace(/\[([^\/\\{}])\]/g, "$1") : n7.replace(/((?!\\).|^)\[([^\/\\{}])\]/g, "$1$2").replace(/\\([^\/{}])/g, "$1");
1034
- var xs = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]);
1035
- var be = (n7) => xs.has(n7);
1036
- var vs = "(?!(?:^|/)\\.\\.?(?:$|/))";
1037
- var Ct = "(?!\\.)";
1038
- var Cs = /* @__PURE__ */ new Set(["[", "."]);
1039
- var Ts = /* @__PURE__ */ new Set(["..", "."]);
1040
- var As = new Set("().*{}+?[]^$\\!");
1041
- var ks = (n7) => n7.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
1042
- var Kt = "[^/]";
1043
- var Se = Kt + "*?";
1044
- var Ee = Kt + "+?";
1045
- var Q = class n {
1046
- type;
1047
- #t;
1048
- #s;
1049
- #n = false;
1050
- #r = [];
1051
- #o;
1052
- #S;
1053
- #w;
1054
- #c = false;
1055
- #h;
1056
- #u;
1057
- #f = false;
1058
- constructor(t, e, s = {}) {
1059
- this.type = t, t && (this.#s = true), this.#o = e, this.#t = this.#o ? this.#o.#t : this, this.#h = this.#t === this ? s : this.#t.#h, this.#w = this.#t === this ? [] : this.#t.#w, t === "!" && !this.#t.#c && this.#w.push(this), this.#S = this.#o ? this.#o.#r.length : 0;
1060
- }
1061
- get hasMagic() {
1062
- if (this.#s !== void 0) return this.#s;
1063
- for (let t of this.#r) if (typeof t != "string" && (t.type || t.hasMagic)) return this.#s = true;
1064
- return this.#s;
1065
- }
1066
- toString() {
1067
- return this.#u !== void 0 ? this.#u : this.type ? this.#u = this.type + "(" + this.#r.map((t) => String(t)).join("|") + ")" : this.#u = this.#r.map((t) => String(t)).join("");
1068
- }
1069
- #a() {
1070
- if (this !== this.#t) throw new Error("should only call on root");
1071
- if (this.#c) return this;
1072
- this.toString(), this.#c = true;
1073
- let t;
1074
- for (; t = this.#w.pop(); ) {
1075
- if (t.type !== "!") continue;
1076
- let e = t, s = e.#o;
1077
- for (; s; ) {
1078
- for (let i2 = e.#S + 1; !s.type && i2 < s.#r.length; i2++) for (let r of t.#r) {
1079
- if (typeof r == "string") throw new Error("string part in extglob AST??");
1080
- r.copyIn(s.#r[i2]);
1081
- }
1082
- e = s, s = e.#o;
1083
- }
1084
- }
1085
- return this;
1086
- }
1087
- push(...t) {
1088
- for (let e of t) if (e !== "") {
1089
- if (typeof e != "string" && !(e instanceof n && e.#o === this)) throw new Error("invalid part: " + e);
1090
- this.#r.push(e);
1091
- }
1092
- }
1093
- toJSON() {
1094
- let t = this.type === null ? this.#r.slice().map((e) => typeof e == "string" ? e : e.toJSON()) : [this.type, ...this.#r.map((e) => e.toJSON())];
1095
- return this.isStart() && !this.type && t.unshift([]), this.isEnd() && (this === this.#t || this.#t.#c && this.#o?.type === "!") && t.push({}), t;
1096
- }
1097
- isStart() {
1098
- if (this.#t === this) return true;
1099
- if (!this.#o?.isStart()) return false;
1100
- if (this.#S === 0) return true;
1101
- let t = this.#o;
1102
- for (let e = 0; e < this.#S; e++) {
1103
- let s = t.#r[e];
1104
- if (!(s instanceof n && s.type === "!")) return false;
1105
- }
1106
- return true;
1107
- }
1108
- isEnd() {
1109
- if (this.#t === this || this.#o?.type === "!") return true;
1110
- if (!this.#o?.isEnd()) return false;
1111
- if (!this.type) return this.#o?.isEnd();
1112
- let t = this.#o ? this.#o.#r.length : 0;
1113
- return this.#S === t - 1;
1114
- }
1115
- copyIn(t) {
1116
- typeof t == "string" ? this.push(t) : this.push(t.clone(this));
1117
- }
1118
- clone(t) {
1119
- let e = new n(this.type, t);
1120
- for (let s of this.#r) e.copyIn(s);
1121
- return e;
1122
- }
1123
- static #i(t, e, s, i2) {
1124
- let r = false, o = false, h = -1, a2 = false;
1125
- if (e.type === null) {
1126
- let f = s, m2 = "";
1127
- for (; f < t.length; ) {
1128
- let p = t.charAt(f++);
1129
- if (r || p === "\\") {
1130
- r = !r, m2 += p;
1131
- continue;
1132
- }
1133
- if (o) {
1134
- f === h + 1 ? (p === "^" || p === "!") && (a2 = true) : p === "]" && !(f === h + 2 && a2) && (o = false), m2 += p;
1135
- continue;
1136
- } else if (p === "[") {
1137
- o = true, h = f, a2 = false, m2 += p;
1138
- continue;
1139
- }
1140
- if (!i2.noext && be(p) && t.charAt(f) === "(") {
1141
- e.push(m2), m2 = "";
1142
- let w2 = new n(p, e);
1143
- f = n.#i(t, w2, f, i2), e.push(w2);
1144
- continue;
1145
- }
1146
- m2 += p;
1147
- }
1148
- return e.push(m2), f;
1149
- }
1150
- let l = s + 1, u2 = new n(null, e), c = [], d4 = "";
1151
- for (; l < t.length; ) {
1152
- let f = t.charAt(l++);
1153
- if (r || f === "\\") {
1154
- r = !r, d4 += f;
1155
- continue;
1156
- }
1157
- if (o) {
1158
- l === h + 1 ? (f === "^" || f === "!") && (a2 = true) : f === "]" && !(l === h + 2 && a2) && (o = false), d4 += f;
1159
- continue;
1160
- } else if (f === "[") {
1161
- o = true, h = l, a2 = false, d4 += f;
1162
- continue;
1163
- }
1164
- if (be(f) && t.charAt(l) === "(") {
1165
- u2.push(d4), d4 = "";
1166
- let m2 = new n(f, u2);
1167
- u2.push(m2), l = n.#i(t, m2, l, i2);
1168
- continue;
1169
- }
1170
- if (f === "|") {
1171
- u2.push(d4), d4 = "", c.push(u2), u2 = new n(null, e);
1172
- continue;
1173
- }
1174
- if (f === ")") return d4 === "" && e.#r.length === 0 && (e.#f = true), u2.push(d4), d4 = "", e.push(...c, u2), l;
1175
- d4 += f;
1176
- }
1177
- return e.type = null, e.#s = void 0, e.#r = [t.substring(s - 1)], l;
1178
- }
1179
- static fromGlob(t, e = {}) {
1180
- let s = new n(null, void 0, e);
1181
- return n.#i(t, s, 0, e), s;
1182
- }
1183
- toMMPattern() {
1184
- if (this !== this.#t) return this.#t.toMMPattern();
1185
- let t = this.toString(), [e, s, i2, r] = this.toRegExpSource();
1186
- if (!(i2 || this.#s || this.#h.nocase && !this.#h.nocaseMagicOnly && t.toUpperCase() !== t.toLowerCase())) return s;
1187
- let h = (this.#h.nocase ? "i" : "") + (r ? "u" : "");
1188
- return Object.assign(new RegExp(`^${e}$`, h), { _src: e, _glob: t });
1189
- }
1190
- get options() {
1191
- return this.#h;
1192
- }
1193
- toRegExpSource(t) {
1194
- let e = t ?? !!this.#h.dot;
1195
- if (this.#t === this && this.#a(), !this.type) {
1196
- let a2 = this.isStart() && this.isEnd() && !this.#r.some((f) => typeof f != "string"), l = this.#r.map((f) => {
1197
- let [m2, p, w2, g2] = typeof f == "string" ? n.#E(f, this.#s, a2) : f.toRegExpSource(t);
1198
- return this.#s = this.#s || w2, this.#n = this.#n || g2, m2;
1199
- }).join(""), u2 = "";
1200
- if (this.isStart() && typeof this.#r[0] == "string" && !(this.#r.length === 1 && Ts.has(this.#r[0]))) {
1201
- let m2 = Cs, p = e && m2.has(l.charAt(0)) || l.startsWith("\\.") && m2.has(l.charAt(2)) || l.startsWith("\\.\\.") && m2.has(l.charAt(4)), w2 = !e && !t && m2.has(l.charAt(0));
1202
- u2 = p ? vs : w2 ? Ct : "";
1203
- }
1204
- let c = "";
1205
- return this.isEnd() && this.#t.#c && this.#o?.type === "!" && (c = "(?:$|\\/)"), [u2 + l + c, W2(l), this.#s = !!this.#s, this.#n];
1206
- }
1207
- let s = this.type === "*" || this.type === "+", i2 = this.type === "!" ? "(?:(?!(?:" : "(?:", r = this.#d(e);
1208
- if (this.isStart() && this.isEnd() && !r && this.type !== "!") {
1209
- let a2 = this.toString();
1210
- return this.#r = [a2], this.type = null, this.#s = void 0, [a2, W2(this.toString()), false, false];
1211
- }
1212
- let o = !s || t || e || !Ct ? "" : this.#d(true);
1213
- o === r && (o = ""), o && (r = `(?:${r})(?:${o})*?`);
1214
- let h = "";
1215
- if (this.type === "!" && this.#f) h = (this.isStart() && !e ? Ct : "") + Ee;
1216
- else {
1217
- let a2 = this.type === "!" ? "))" + (this.isStart() && !e && !t ? Ct : "") + Se + ")" : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && o ? ")" : this.type === "*" && o ? ")?" : `)${this.type}`;
1218
- h = i2 + r + a2;
1219
- }
1220
- return [h, W2(r), this.#s = !!this.#s, this.#n];
1221
- }
1222
- #d(t) {
1223
- return this.#r.map((e) => {
1224
- if (typeof e == "string") throw new Error("string type in extglob ast??");
1225
- let [s, i2, r, o] = e.toRegExpSource(t);
1226
- return this.#n = this.#n || o, s;
1227
- }).filter((e) => !(this.isStart() && this.isEnd()) || !!e).join("|");
1228
- }
1229
- static #E(t, e, s = false) {
1230
- let i2 = false, r = "", o = false, h = false;
1231
- for (let a2 = 0; a2 < t.length; a2++) {
1232
- let l = t.charAt(a2);
1233
- if (i2) {
1234
- i2 = false, r += (As.has(l) ? "\\" : "") + l;
1235
- continue;
1236
- }
1237
- if (l === "*") {
1238
- if (h) continue;
1239
- h = true, r += s && /^[*]+$/.test(t) ? Ee : Se, e = true;
1240
- continue;
1241
- } else h = false;
1242
- if (l === "\\") {
1243
- a2 === t.length - 1 ? r += "\\\\" : i2 = true;
1244
- continue;
1245
- }
1246
- if (l === "[") {
1247
- let [u2, c, d4, f] = ye(t, a2);
1248
- if (d4) {
1249
- r += u2, o = o || c, a2 += d4 - 1, e = e || f;
1250
- continue;
1251
- }
1252
- }
1253
- if (l === "?") {
1254
- r += Kt, e = true;
1255
- continue;
1256
- }
1257
- r += ks(l);
1258
- }
1259
- return [r, W2(t), !!e, o];
1260
- }
1261
- };
1262
- var tt = (n7, { windowsPathsNoEscape: t = false, magicalBraces: e = false } = {}) => e ? t ? n7.replace(/[?*()[\]{}]/g, "[$&]") : n7.replace(/[?*()[\]\\{}]/g, "\\$&") : t ? n7.replace(/[?*()[\]]/g, "[$&]") : n7.replace(/[?*()[\]\\]/g, "\\$&");
1263
- var O2 = (n7, t, e = {}) => (at(t), !e.nocomment && t.charAt(0) === "#" ? false : new D(t, e).match(n7));
1264
- var Rs = /^\*+([^+@!?\*\[\(]*)$/;
1265
- var Os = (n7) => (t) => !t.startsWith(".") && t.endsWith(n7);
1266
- var Fs = (n7) => (t) => t.endsWith(n7);
1267
- var Ds = (n7) => (n7 = n7.toLowerCase(), (t) => !t.startsWith(".") && t.toLowerCase().endsWith(n7));
1268
- var Ms = (n7) => (n7 = n7.toLowerCase(), (t) => t.toLowerCase().endsWith(n7));
1269
- var Ns = /^\*+\.\*+$/;
1270
- var _s = (n7) => !n7.startsWith(".") && n7.includes(".");
1271
- var Ls = (n7) => n7 !== "." && n7 !== ".." && n7.includes(".");
1272
- var Ws = /^\.\*+$/;
1273
- var Ps = (n7) => n7 !== "." && n7 !== ".." && n7.startsWith(".");
1274
- var js = /^\*+$/;
1275
- var Is = (n7) => n7.length !== 0 && !n7.startsWith(".");
1276
- var zs = (n7) => n7.length !== 0 && n7 !== "." && n7 !== "..";
1277
- var Bs = /^\?+([^+@!?\*\[\(]*)?$/;
1278
- var Us = ([n7, t = ""]) => {
1279
- let e = Ce([n7]);
1280
- return t ? (t = t.toLowerCase(), (s) => e(s) && s.toLowerCase().endsWith(t)) : e;
1281
- };
1282
- var $s = ([n7, t = ""]) => {
1283
- let e = Te([n7]);
1284
- return t ? (t = t.toLowerCase(), (s) => e(s) && s.toLowerCase().endsWith(t)) : e;
1285
- };
1286
- var Gs = ([n7, t = ""]) => {
1287
- let e = Te([n7]);
1288
- return t ? (s) => e(s) && s.endsWith(t) : e;
1289
- };
1290
- var Hs = ([n7, t = ""]) => {
1291
- let e = Ce([n7]);
1292
- return t ? (s) => e(s) && s.endsWith(t) : e;
1293
- };
1294
- var Ce = ([n7]) => {
1295
- let t = n7.length;
1296
- return (e) => e.length === t && !e.startsWith(".");
1297
- };
1298
- var Te = ([n7]) => {
1299
- let t = n7.length;
1300
- return (e) => e.length === t && e !== "." && e !== "..";
1301
- };
1302
- var Ae = typeof process == "object" && process ? typeof process.env == "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
1303
- var xe = { win32: { sep: "\\" }, posix: { sep: "/" } };
1304
- var qs = Ae === "win32" ? xe.win32.sep : xe.posix.sep;
1305
- O2.sep = qs;
1306
- var A2 = /* @__PURE__ */ Symbol("globstar **");
1307
- O2.GLOBSTAR = A2;
1308
- var Ks = "[^/]";
1309
- var Vs = Ks + "*?";
1310
- var Ys = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
1311
- var Xs = "(?:(?!(?:\\/|^)\\.).)*?";
1312
- var Js = (n7, t = {}) => (e) => O2(e, n7, t);
1313
- O2.filter = Js;
1314
- var N = (n7, t = {}) => Object.assign({}, n7, t);
1315
- var Zs = (n7) => {
1316
- if (!n7 || typeof n7 != "object" || !Object.keys(n7).length) return O2;
1317
- let t = O2;
1318
- return Object.assign((s, i2, r = {}) => t(s, i2, N(n7, r)), { Minimatch: class extends t.Minimatch {
1319
- constructor(i2, r = {}) {
1320
- super(i2, N(n7, r));
1321
- }
1322
- static defaults(i2) {
1323
- return t.defaults(N(n7, i2)).Minimatch;
1324
- }
1325
- }, AST: class extends t.AST {
1326
- constructor(i2, r, o = {}) {
1327
- super(i2, r, N(n7, o));
1328
- }
1329
- static fromGlob(i2, r = {}) {
1330
- return t.AST.fromGlob(i2, N(n7, r));
1331
- }
1332
- }, unescape: (s, i2 = {}) => t.unescape(s, N(n7, i2)), escape: (s, i2 = {}) => t.escape(s, N(n7, i2)), filter: (s, i2 = {}) => t.filter(s, N(n7, i2)), defaults: (s) => t.defaults(N(n7, s)), makeRe: (s, i2 = {}) => t.makeRe(s, N(n7, i2)), braceExpand: (s, i2 = {}) => t.braceExpand(s, N(n7, i2)), match: (s, i2, r = {}) => t.match(s, i2, N(n7, r)), sep: t.sep, GLOBSTAR: A2 });
1333
- };
1334
- O2.defaults = Zs;
1335
- var ke = (n7, t = {}) => (at(n7), t.nobrace || !/\{(?:(?!\{).)*\}/.test(n7) ? [n7] : ge(n7, { max: t.braceExpandMax }));
1336
- O2.braceExpand = ke;
1337
- var Qs = (n7, t = {}) => new D(n7, t).makeRe();
1338
- O2.makeRe = Qs;
1339
- var ti = (n7, t, e = {}) => {
1340
- let s = new D(t, e);
1341
- return n7 = n7.filter((i2) => s.match(i2)), s.options.nonull && !n7.length && n7.push(t), n7;
1342
- };
1343
- O2.match = ti;
1344
- var ve = /[?*]|[+@!]\(.*?\)|\[|\]/;
1345
- var ei = (n7) => n7.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
1346
- var D = class {
1347
- options;
1348
- set;
1349
- pattern;
1350
- windowsPathsNoEscape;
1351
- nonegate;
1352
- negate;
1353
- comment;
1354
- empty;
1355
- preserveMultipleSlashes;
1356
- partial;
1357
- globSet;
1358
- globParts;
1359
- nocase;
1360
- isWindows;
1361
- platform;
1362
- windowsNoMagicRoot;
1363
- regexp;
1364
- constructor(t, e = {}) {
1365
- at(t), e = e || {}, this.options = e, this.pattern = t, this.platform = e.platform || Ae, this.isWindows = this.platform === "win32";
1366
- let s = "allowWindowsEscape";
1367
- 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();
1368
- }
1369
- hasMagic() {
1370
- if (this.options.magicalBraces && this.set.length > 1) return true;
1371
- for (let t of this.set) for (let e of t) if (typeof e != "string") return true;
1372
- return false;
1373
- }
1374
- debug(...t) {
1375
- }
1376
- make() {
1377
- let t = this.pattern, e = this.options;
1378
- if (!e.nocomment && t.charAt(0) === "#") {
1379
- this.comment = true;
1380
- return;
1381
- }
1382
- if (!t) {
1383
- this.empty = true;
1384
- return;
1385
- }
1386
- this.parseNegate(), this.globSet = [...new Set(this.braceExpand())], e.debug && (this.debug = (...r) => console.error(...r)), this.debug(this.pattern, this.globSet);
1387
- let s = this.globSet.map((r) => this.slashSplit(r));
1388
- this.globParts = this.preprocess(s), this.debug(this.pattern, this.globParts);
1389
- let i2 = this.globParts.map((r, o, h) => {
1390
- if (this.isWindows && this.windowsNoMagicRoot) {
1391
- let a2 = r[0] === "" && r[1] === "" && (r[2] === "?" || !ve.test(r[2])) && !ve.test(r[3]), l = /^[a-z]:/i.test(r[0]);
1392
- if (a2) return [...r.slice(0, 4), ...r.slice(4).map((u2) => this.parse(u2))];
1393
- if (l) return [r[0], ...r.slice(1).map((u2) => this.parse(u2))];
1394
- }
1395
- return r.map((a2) => this.parse(a2));
1396
- });
1397
- if (this.debug(this.pattern, i2), this.set = i2.filter((r) => r.indexOf(false) === -1), this.isWindows) for (let r = 0; r < this.set.length; r++) {
1398
- let o = this.set[r];
1399
- o[0] === "" && o[1] === "" && this.globParts[r][2] === "?" && typeof o[3] == "string" && /^[a-z]:$/i.test(o[3]) && (o[2] = "?");
1400
- }
1401
- this.debug(this.pattern, this.set);
1402
- }
1403
- preprocess(t) {
1404
- if (this.options.noglobstar) for (let s = 0; s < t.length; s++) for (let i2 = 0; i2 < t[s].length; i2++) t[s][i2] === "**" && (t[s][i2] = "*");
1405
- let { optimizationLevel: e = 1 } = this.options;
1406
- return e >= 2 ? (t = this.firstPhasePreProcess(t), t = this.secondPhasePreProcess(t)) : e >= 1 ? t = this.levelOneOptimize(t) : t = this.adjascentGlobstarOptimize(t), t;
1407
- }
1408
- adjascentGlobstarOptimize(t) {
1409
- return t.map((e) => {
1410
- let s = -1;
1411
- for (; (s = e.indexOf("**", s + 1)) !== -1; ) {
1412
- let i2 = s;
1413
- for (; e[i2 + 1] === "**"; ) i2++;
1414
- i2 !== s && e.splice(s, i2 - s);
1415
- }
1416
- return e;
1417
- });
1418
- }
1419
- levelOneOptimize(t) {
1420
- return t.map((e) => (e = e.reduce((s, i2) => {
1421
- let r = s[s.length - 1];
1422
- return i2 === "**" && r === "**" ? s : i2 === ".." && r && r !== ".." && r !== "." && r !== "**" ? (s.pop(), s) : (s.push(i2), s);
1423
- }, []), e.length === 0 ? [""] : e));
1424
- }
1425
- levelTwoFileOptimize(t) {
1426
- Array.isArray(t) || (t = this.slashSplit(t));
1427
- let e = false;
1428
- do {
1429
- if (e = false, !this.preserveMultipleSlashes) {
1430
- for (let i2 = 1; i2 < t.length - 1; i2++) {
1431
- let r = t[i2];
1432
- i2 === 1 && r === "" && t[0] === "" || (r === "." || r === "") && (e = true, t.splice(i2, 1), i2--);
1433
- }
1434
- t[0] === "." && t.length === 2 && (t[1] === "." || t[1] === "") && (e = true, t.pop());
1435
- }
1436
- let s = 0;
1437
- for (; (s = t.indexOf("..", s + 1)) !== -1; ) {
1438
- let i2 = t[s - 1];
1439
- i2 && i2 !== "." && i2 !== ".." && i2 !== "**" && (e = true, t.splice(s - 1, 2), s -= 2);
1440
- }
1441
- } while (e);
1442
- return t.length === 0 ? [""] : t;
1443
- }
1444
- firstPhasePreProcess(t) {
1445
- let e = false;
1446
- do {
1447
- e = false;
1448
- for (let s of t) {
1449
- let i2 = -1;
1450
- for (; (i2 = s.indexOf("**", i2 + 1)) !== -1; ) {
1451
- let o = i2;
1452
- for (; s[o + 1] === "**"; ) o++;
1453
- o > i2 && s.splice(i2 + 1, o - i2);
1454
- let h = s[i2 + 1], a2 = s[i2 + 2], l = s[i2 + 3];
1455
- if (h !== ".." || !a2 || a2 === "." || a2 === ".." || !l || l === "." || l === "..") continue;
1456
- e = true, s.splice(i2, 1);
1457
- let u2 = s.slice(0);
1458
- u2[i2] = "**", t.push(u2), i2--;
1459
- }
1460
- if (!this.preserveMultipleSlashes) {
1461
- for (let o = 1; o < s.length - 1; o++) {
1462
- let h = s[o];
1463
- o === 1 && h === "" && s[0] === "" || (h === "." || h === "") && (e = true, s.splice(o, 1), o--);
1464
- }
1465
- s[0] === "." && s.length === 2 && (s[1] === "." || s[1] === "") && (e = true, s.pop());
1466
- }
1467
- let r = 0;
1468
- for (; (r = s.indexOf("..", r + 1)) !== -1; ) {
1469
- let o = s[r - 1];
1470
- if (o && o !== "." && o !== ".." && o !== "**") {
1471
- e = true;
1472
- let a2 = r === 1 && s[r + 1] === "**" ? ["."] : [];
1473
- s.splice(r - 1, 2, ...a2), s.length === 0 && s.push(""), r -= 2;
1474
- }
1475
- }
1476
- }
1477
- } while (e);
1478
- return t;
1479
- }
1480
- secondPhasePreProcess(t) {
1481
- for (let e = 0; e < t.length - 1; e++) for (let s = e + 1; s < t.length; s++) {
1482
- let i2 = this.partsMatch(t[e], t[s], !this.preserveMultipleSlashes);
1483
- if (i2) {
1484
- t[e] = [], t[s] = i2;
1485
- break;
1486
- }
1487
- }
1488
- return t.filter((e) => e.length);
1489
- }
1490
- partsMatch(t, e, s = false) {
1491
- let i2 = 0, r = 0, o = [], h = "";
1492
- for (; i2 < t.length && r < e.length; ) if (t[i2] === e[r]) o.push(h === "b" ? e[r] : t[i2]), i2++, r++;
1493
- else if (s && t[i2] === "**" && e[r] === t[i2 + 1]) o.push(t[i2]), i2++;
1494
- else if (s && e[r] === "**" && t[i2] === e[r + 1]) o.push(e[r]), r++;
1495
- else if (t[i2] === "*" && e[r] && (this.options.dot || !e[r].startsWith(".")) && e[r] !== "**") {
1496
- if (h === "b") return false;
1497
- h = "a", o.push(t[i2]), i2++, r++;
1498
- } else if (e[r] === "*" && t[i2] && (this.options.dot || !t[i2].startsWith(".")) && t[i2] !== "**") {
1499
- if (h === "a") return false;
1500
- h = "b", o.push(e[r]), i2++, r++;
1501
- } else return false;
1502
- return t.length === e.length && o;
1503
- }
1504
- parseNegate() {
1505
- if (this.nonegate) return;
1506
- let t = this.pattern, e = false, s = 0;
1507
- for (let i2 = 0; i2 < t.length && t.charAt(i2) === "!"; i2++) e = !e, s++;
1508
- s && (this.pattern = t.slice(s)), this.negate = e;
1509
- }
1510
- matchOne(t, e, s = false) {
1511
- let i2 = this.options;
1512
- if (this.isWindows) {
1513
- let p = typeof t[0] == "string" && /^[a-z]:$/i.test(t[0]), w2 = !p && t[0] === "" && t[1] === "" && t[2] === "?" && /^[a-z]:$/i.test(t[3]), g2 = typeof e[0] == "string" && /^[a-z]:$/i.test(e[0]), S3 = !g2 && e[0] === "" && e[1] === "" && e[2] === "?" && typeof e[3] == "string" && /^[a-z]:$/i.test(e[3]), E = w2 ? 3 : p ? 0 : void 0, y2 = S3 ? 3 : g2 ? 0 : void 0;
1514
- if (typeof E == "number" && typeof y2 == "number") {
1515
- let [b, z] = [t[E], e[y2]];
1516
- b.toLowerCase() === z.toLowerCase() && (e[y2] = b, y2 > E ? e = e.slice(y2) : E > y2 && (t = t.slice(E)));
1517
- }
1518
- }
1519
- let { optimizationLevel: r = 1 } = this.options;
1520
- r >= 2 && (t = this.levelTwoFileOptimize(t)), this.debug("matchOne", this, { file: t, pattern: e }), this.debug("matchOne", t.length, e.length);
1521
- for (var o = 0, h = 0, a2 = t.length, l = e.length; o < a2 && h < l; o++, h++) {
1522
- this.debug("matchOne loop");
1523
- var u2 = e[h], c = t[o];
1524
- if (this.debug(e, u2, c), u2 === false) return false;
1525
- if (u2 === A2) {
1526
- this.debug("GLOBSTAR", [e, u2, c]);
1527
- var d4 = o, f = h + 1;
1528
- if (f === l) {
1529
- for (this.debug("** at the end"); o < a2; o++) if (t[o] === "." || t[o] === ".." || !i2.dot && t[o].charAt(0) === ".") return false;
1530
- return true;
1531
- }
1532
- for (; d4 < a2; ) {
1533
- var m2 = t[d4];
1534
- if (this.debug(`
1535
- globstar while`, t, d4, e, f, m2), this.matchOne(t.slice(d4), e.slice(f), s)) return this.debug("globstar found match!", d4, a2, m2), true;
1536
- if (m2 === "." || m2 === ".." || !i2.dot && m2.charAt(0) === ".") {
1537
- this.debug("dot detected!", t, d4, e, f);
1538
- break;
1539
- }
1540
- this.debug("globstar swallow a segment, and continue"), d4++;
1541
- }
1542
- return !!(s && (this.debug(`
1543
- >>> no match, partial?`, t, d4, e, f), d4 === a2));
1544
- }
1545
- let p;
1546
- if (typeof u2 == "string" ? (p = c === u2, this.debug("string match", u2, c, p)) : (p = u2.test(c), this.debug("pattern match", u2, c, p)), !p) return false;
1547
- }
1548
- if (o === a2 && h === l) return true;
1549
- if (o === a2) return s;
1550
- if (h === l) return o === a2 - 1 && t[o] === "";
1551
- throw new Error("wtf?");
1552
- }
1553
- braceExpand() {
1554
- return ke(this.pattern, this.options);
1555
- }
1556
- parse(t) {
1557
- at(t);
1558
- let e = this.options;
1559
- if (t === "**") return A2;
1560
- if (t === "") return "";
1561
- let s, i2 = null;
1562
- (s = t.match(js)) ? i2 = e.dot ? zs : Is : (s = t.match(Rs)) ? i2 = (e.nocase ? e.dot ? Ms : Ds : e.dot ? Fs : Os)(s[1]) : (s = t.match(Bs)) ? i2 = (e.nocase ? e.dot ? $s : Us : e.dot ? Gs : Hs)(s) : (s = t.match(Ns)) ? i2 = e.dot ? Ls : _s : (s = t.match(Ws)) && (i2 = Ps);
1563
- let r = Q.fromGlob(t, this.options).toMMPattern();
1564
- return i2 && typeof r == "object" && Reflect.defineProperty(r, "test", { value: i2 }), r;
1565
- }
1566
- makeRe() {
1567
- if (this.regexp || this.regexp === false) return this.regexp;
1568
- let t = this.set;
1569
- if (!t.length) return this.regexp = false, this.regexp;
1570
- let e = this.options, s = e.noglobstar ? Vs : e.dot ? Ys : Xs, i2 = new Set(e.nocase ? ["i"] : []), r = t.map((a2) => {
1571
- let l = a2.map((c) => {
1572
- if (c instanceof RegExp) for (let d4 of c.flags.split("")) i2.add(d4);
1573
- return typeof c == "string" ? ei(c) : c === A2 ? A2 : c._src;
1574
- });
1575
- l.forEach((c, d4) => {
1576
- let f = l[d4 + 1], m2 = l[d4 - 1];
1577
- c !== A2 || m2 === A2 || (m2 === void 0 ? f !== void 0 && f !== A2 ? l[d4 + 1] = "(?:\\/|" + s + "\\/)?" + f : l[d4] = s : f === void 0 ? l[d4 - 1] = m2 + "(?:\\/|\\/" + s + ")?" : f !== A2 && (l[d4 - 1] = m2 + "(?:\\/|\\/" + s + "\\/)" + f, l[d4 + 1] = A2));
1578
- });
1579
- let u2 = l.filter((c) => c !== A2);
1580
- if (this.partial && u2.length >= 1) {
1581
- let c = [];
1582
- for (let d4 = 1; d4 <= u2.length; d4++) c.push(u2.slice(0, d4).join("/"));
1583
- return "(?:" + c.join("|") + ")";
1584
- }
1585
- return u2.join("/");
1586
- }).join("|"), [o, h] = t.length > 1 ? ["(?:", ")"] : ["", ""];
1587
- r = "^" + o + r + h + "$", this.partial && (r = "^(?:\\/|" + o + r.slice(1, -1) + h + ")$"), this.negate && (r = "^(?!" + r + ").+$");
1588
- try {
1589
- this.regexp = new RegExp(r, [...i2].join(""));
1590
- } catch {
1591
- this.regexp = false;
1592
- }
1593
- return this.regexp;
1594
- }
1595
- slashSplit(t) {
1596
- return this.preserveMultipleSlashes ? t.split("/") : this.isWindows && /^\/\/[^\/]+/.test(t) ? ["", ...t.split(/\/+/)] : t.split(/\/+/);
1597
- }
1598
- match(t, e = this.partial) {
1599
- if (this.debug("match", t, this.pattern), this.comment) return false;
1600
- if (this.empty) return t === "";
1601
- if (t === "/" && e) return true;
1602
- let s = this.options;
1603
- this.isWindows && (t = t.split("\\").join("/"));
1604
- let i2 = this.slashSplit(t);
1605
- this.debug(this.pattern, "split", i2);
1606
- let r = this.set;
1607
- this.debug(this.pattern, "set", r);
1608
- let o = i2[i2.length - 1];
1609
- if (!o) for (let h = i2.length - 2; !o && h >= 0; h--) o = i2[h];
1610
- for (let h = 0; h < r.length; h++) {
1611
- let a2 = r[h], l = i2;
1612
- if (s.matchBase && a2.length === 1 && (l = [o]), this.matchOne(l, a2, e)) return s.flipNegate ? true : !this.negate;
1613
- }
1614
- return s.flipNegate ? false : this.negate;
1615
- }
1616
- static defaults(t) {
1617
- return O2.defaults(t).Minimatch;
1618
- }
1619
- };
1620
- O2.AST = Q;
1621
- O2.Minimatch = D;
1622
- O2.escape = tt;
1623
- O2.unescape = W2;
1624
- var si = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date;
1625
- var Oe = /* @__PURE__ */ new Set();
1626
- var Vt = typeof process == "object" && process ? process : {};
1627
- var Fe = (n7, t, e, s) => {
1628
- typeof Vt.emitWarning == "function" ? Vt.emitWarning(n7, t, e, s) : console.error(`[${e}] ${t}: ${n7}`);
1629
- };
1630
- var At = globalThis.AbortController;
1631
- var Re = globalThis.AbortSignal;
1632
- if (typeof At > "u") {
1633
- Re = class {
1634
- onabort;
1635
- _onabort = [];
1636
- reason;
1637
- aborted = false;
1638
- addEventListener(e, s) {
1639
- this._onabort.push(s);
1640
- }
1641
- }, At = class {
1642
- constructor() {
1643
- t();
1644
- }
1645
- signal = new Re();
1646
- abort(e) {
1647
- if (!this.signal.aborted) {
1648
- this.signal.reason = e, this.signal.aborted = true;
1649
- for (let s of this.signal._onabort) s(e);
1650
- this.signal.onabort?.(e);
1651
- }
1652
- }
1653
- };
1654
- let n7 = Vt.env?.LRU_CACHE_IGNORE_AC_WARNING !== "1", t = () => {
1655
- n7 && (n7 = false, Fe("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.", "NO_ABORT_CONTROLLER", "ENOTSUP", t));
1656
- };
1657
- }
1658
- var ii = (n7) => !Oe.has(n7);
1659
- var q = (n7) => n7 && n7 === Math.floor(n7) && n7 > 0 && isFinite(n7);
1660
- var De = (n7) => q(n7) ? n7 <= Math.pow(2, 8) ? Uint8Array : n7 <= Math.pow(2, 16) ? Uint16Array : n7 <= Math.pow(2, 32) ? Uint32Array : n7 <= Number.MAX_SAFE_INTEGER ? Tt : null : null;
1661
- var Tt = class extends Array {
1662
- constructor(n7) {
1663
- super(n7), this.fill(0);
1664
- }
1665
- };
1666
- var ri = class ct {
1667
- heap;
1668
- length;
1669
- static #t = false;
1670
- static create(t) {
1671
- let e = De(t);
1672
- if (!e) return [];
1673
- ct.#t = true;
1674
- let s = new ct(t, e);
1675
- return ct.#t = false, s;
1676
- }
1677
- constructor(t, e) {
1678
- if (!ct.#t) throw new TypeError("instantiate Stack using Stack.create(n)");
1679
- this.heap = new e(t), this.length = 0;
1680
- }
1681
- push(t) {
1682
- this.heap[this.length++] = t;
1683
- }
1684
- pop() {
1685
- return this.heap[--this.length];
1686
- }
1687
- };
1688
- var ft = class Me {
1689
- #t;
1690
- #s;
1691
- #n;
1692
- #r;
1693
- #o;
1694
- #S;
1695
- #w;
1696
- #c;
1697
- get perf() {
1698
- return this.#c;
1699
- }
1700
- ttl;
1701
- ttlResolution;
1702
- ttlAutopurge;
1703
- updateAgeOnGet;
1704
- updateAgeOnHas;
1705
- allowStale;
1706
- noDisposeOnSet;
1707
- noUpdateTTL;
1708
- maxEntrySize;
1709
- sizeCalculation;
1710
- noDeleteOnFetchRejection;
1711
- noDeleteOnStaleGet;
1712
- allowStaleOnFetchAbort;
1713
- allowStaleOnFetchRejection;
1714
- ignoreFetchAbort;
1715
- #h;
1716
- #u;
1717
- #f;
1718
- #a;
1719
- #i;
1720
- #d;
1721
- #E;
1722
- #b;
1723
- #p;
1724
- #R;
1725
- #m;
1726
- #C;
1727
- #T;
1728
- #g;
1729
- #y;
1730
- #x;
1731
- #A;
1732
- #e;
1733
- #_;
1734
- static unsafeExposeInternals(t) {
1735
- return { starts: t.#T, ttls: t.#g, autopurgeTimers: t.#y, sizes: t.#C, keyMap: t.#f, keyList: t.#a, valList: t.#i, next: t.#d, prev: t.#E, get head() {
1736
- return t.#b;
1737
- }, get tail() {
1738
- return t.#p;
1739
- }, free: t.#R, isBackgroundFetch: (e) => t.#l(e), backgroundFetch: (e, s, i2, r) => t.#U(e, s, i2, r), moveToTail: (e) => t.#W(e), indexes: (e) => t.#F(e), rindexes: (e) => t.#D(e), isStale: (e) => t.#v(e) };
1740
- }
1741
- get max() {
1742
- return this.#t;
1743
- }
1744
- get maxSize() {
1745
- return this.#s;
1746
- }
1747
- get calculatedSize() {
1748
- return this.#u;
1749
- }
1750
- get size() {
1751
- return this.#h;
1752
- }
1753
- get fetchMethod() {
1754
- return this.#S;
1755
- }
1756
- get memoMethod() {
1757
- return this.#w;
1758
- }
1759
- get dispose() {
1760
- return this.#n;
1761
- }
1762
- get onInsert() {
1763
- return this.#r;
1764
- }
1765
- get disposeAfter() {
1766
- return this.#o;
1767
- }
1768
- constructor(t) {
1769
- let { max: e = 0, ttl: s, ttlResolution: i2 = 1, ttlAutopurge: r, updateAgeOnGet: o, updateAgeOnHas: h, allowStale: a2, dispose: l, onInsert: u2, disposeAfter: c, noDisposeOnSet: d4, noUpdateTTL: f, maxSize: m2 = 0, maxEntrySize: p = 0, sizeCalculation: w2, fetchMethod: g2, memoMethod: S3, noDeleteOnFetchRejection: E, noDeleteOnStaleGet: y2, allowStaleOnFetchRejection: b, allowStaleOnFetchAbort: z, ignoreFetchAbort: $, perf: J } = t;
1770
- if (J !== void 0 && typeof J?.now != "function") throw new TypeError("perf option must have a now() method if specified");
1771
- if (this.#c = J ?? si, e !== 0 && !q(e)) throw new TypeError("max option must be a nonnegative integer");
1772
- let Z = e ? De(e) : Array;
1773
- if (!Z) throw new Error("invalid max value: " + e);
1774
- if (this.#t = e, this.#s = m2, this.maxEntrySize = p || this.#s, this.sizeCalculation = w2, this.sizeCalculation) {
1775
- if (!this.#s && !this.maxEntrySize) throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");
1776
- if (typeof this.sizeCalculation != "function") throw new TypeError("sizeCalculation set to non-function");
1777
- }
1778
- if (S3 !== void 0 && typeof S3 != "function") throw new TypeError("memoMethod must be a function if defined");
1779
- if (this.#w = S3, g2 !== void 0 && typeof g2 != "function") throw new TypeError("fetchMethod must be a function if specified");
1780
- if (this.#S = g2, this.#A = !!g2, this.#f = /* @__PURE__ */ new Map(), this.#a = new Array(e).fill(void 0), this.#i = new Array(e).fill(void 0), this.#d = new Z(e), this.#E = new Z(e), this.#b = 0, this.#p = 0, this.#R = ri.create(e), this.#h = 0, this.#u = 0, typeof l == "function" && (this.#n = l), typeof u2 == "function" && (this.#r = u2), typeof c == "function" ? (this.#o = c, this.#m = []) : (this.#o = void 0, this.#m = void 0), this.#x = !!this.#n, this.#_ = !!this.#r, this.#e = !!this.#o, this.noDisposeOnSet = !!d4, this.noUpdateTTL = !!f, this.noDeleteOnFetchRejection = !!E, this.allowStaleOnFetchRejection = !!b, this.allowStaleOnFetchAbort = !!z, this.ignoreFetchAbort = !!$, this.maxEntrySize !== 0) {
1781
- if (this.#s !== 0 && !q(this.#s)) throw new TypeError("maxSize must be a positive integer if specified");
1782
- if (!q(this.maxEntrySize)) throw new TypeError("maxEntrySize must be a positive integer if specified");
1783
- this.#G();
1784
- }
1785
- if (this.allowStale = !!a2, this.noDeleteOnStaleGet = !!y2, this.updateAgeOnGet = !!o, this.updateAgeOnHas = !!h, this.ttlResolution = q(i2) || i2 === 0 ? i2 : 1, this.ttlAutopurge = !!r, this.ttl = s || 0, this.ttl) {
1786
- if (!q(this.ttl)) throw new TypeError("ttl must be a positive integer if specified");
1787
- this.#M();
1788
- }
1789
- if (this.#t === 0 && this.ttl === 0 && this.#s === 0) throw new TypeError("At least one of max, maxSize, or ttl is required");
1790
- if (!this.ttlAutopurge && !this.#t && !this.#s) {
1791
- let $t = "LRU_CACHE_UNBOUNDED";
1792
- ii($t) && (Oe.add($t), Fe("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.", "UnboundedCacheWarning", $t, Me));
1793
- }
1794
- }
1795
- getRemainingTTL(t) {
1796
- return this.#f.has(t) ? 1 / 0 : 0;
1797
- }
1798
- #M() {
1799
- let t = new Tt(this.#t), e = new Tt(this.#t);
1800
- this.#g = t, this.#T = e;
1801
- let s = this.ttlAutopurge ? new Array(this.#t) : void 0;
1802
- this.#y = s, this.#j = (o, h, a2 = this.#c.now()) => {
1803
- if (e[o] = h !== 0 ? a2 : 0, t[o] = h, s?.[o] && (clearTimeout(s[o]), s[o] = void 0), h !== 0 && s) {
1804
- let l = setTimeout(() => {
1805
- this.#v(o) && this.#O(this.#a[o], "expire");
1806
- }, h + 1);
1807
- l.unref && l.unref(), s[o] = l;
1808
- }
1809
- }, this.#k = (o) => {
1810
- e[o] = t[o] !== 0 ? this.#c.now() : 0;
1811
- }, this.#N = (o, h) => {
1812
- if (t[h]) {
1813
- let a2 = t[h], l = e[h];
1814
- if (!a2 || !l) return;
1815
- o.ttl = a2, o.start = l, o.now = i2 || r();
1816
- let u2 = o.now - l;
1817
- o.remainingTTL = a2 - u2;
1818
- }
1819
- };
1820
- let i2 = 0, r = () => {
1821
- let o = this.#c.now();
1822
- if (this.ttlResolution > 0) {
1823
- i2 = o;
1824
- let h = setTimeout(() => i2 = 0, this.ttlResolution);
1825
- h.unref && h.unref();
1826
- }
1827
- return o;
1828
- };
1829
- this.getRemainingTTL = (o) => {
1830
- let h = this.#f.get(o);
1831
- if (h === void 0) return 0;
1832
- let a2 = t[h], l = e[h];
1833
- if (!a2 || !l) return 1 / 0;
1834
- let u2 = (i2 || r()) - l;
1835
- return a2 - u2;
1836
- }, this.#v = (o) => {
1837
- let h = e[o], a2 = t[o];
1838
- return !!a2 && !!h && (i2 || r()) - h > a2;
1839
- };
1840
- }
1841
- #k = () => {
1842
- };
1843
- #N = () => {
1844
- };
1845
- #j = () => {
1846
- };
1847
- #v = () => false;
1848
- #G() {
1849
- let t = new Tt(this.#t);
1850
- this.#u = 0, this.#C = t, this.#P = (e) => {
1851
- this.#u -= t[e], t[e] = 0;
1852
- }, this.#I = (e, s, i2, r) => {
1853
- if (this.#l(s)) return 0;
1854
- if (!q(i2)) if (r) {
1855
- if (typeof r != "function") throw new TypeError("sizeCalculation must be a function");
1856
- if (i2 = r(s, e), !q(i2)) throw new TypeError("sizeCalculation return invalid (expect positive integer)");
1857
- } else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");
1858
- return i2;
1859
- }, this.#L = (e, s, i2) => {
1860
- if (t[e] = s, this.#s) {
1861
- let r = this.#s - t[e];
1862
- for (; this.#u > r; ) this.#B(true);
1863
- }
1864
- this.#u += t[e], i2 && (i2.entrySize = s, i2.totalCalculatedSize = this.#u);
1865
- };
1866
- }
1867
- #P = (t) => {
1868
- };
1869
- #L = (t, e, s) => {
1870
- };
1871
- #I = (t, e, s, i2) => {
1872
- if (s || i2) throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");
1873
- return 0;
1874
- };
1875
- *#F({ allowStale: t = this.allowStale } = {}) {
1876
- if (this.#h) for (let e = this.#p; !(!this.#z(e) || ((t || !this.#v(e)) && (yield e), e === this.#b)); ) e = this.#E[e];
1877
- }
1878
- *#D({ allowStale: t = this.allowStale } = {}) {
1879
- if (this.#h) for (let e = this.#b; !(!this.#z(e) || ((t || !this.#v(e)) && (yield e), e === this.#p)); ) e = this.#d[e];
1880
- }
1881
- #z(t) {
1882
- return t !== void 0 && this.#f.get(this.#a[t]) === t;
1883
- }
1884
- *entries() {
1885
- for (let t of this.#F()) this.#i[t] !== void 0 && this.#a[t] !== void 0 && !this.#l(this.#i[t]) && (yield [this.#a[t], this.#i[t]]);
1886
- }
1887
- *rentries() {
1888
- for (let t of this.#D()) this.#i[t] !== void 0 && this.#a[t] !== void 0 && !this.#l(this.#i[t]) && (yield [this.#a[t], this.#i[t]]);
1889
- }
1890
- *keys() {
1891
- for (let t of this.#F()) {
1892
- let e = this.#a[t];
1893
- e !== void 0 && !this.#l(this.#i[t]) && (yield e);
1894
- }
1895
- }
1896
- *rkeys() {
1897
- for (let t of this.#D()) {
1898
- let e = this.#a[t];
1899
- e !== void 0 && !this.#l(this.#i[t]) && (yield e);
1900
- }
1901
- }
1902
- *values() {
1903
- for (let t of this.#F()) this.#i[t] !== void 0 && !this.#l(this.#i[t]) && (yield this.#i[t]);
1904
- }
1905
- *rvalues() {
1906
- for (let t of this.#D()) this.#i[t] !== void 0 && !this.#l(this.#i[t]) && (yield this.#i[t]);
1907
- }
1908
- [Symbol.iterator]() {
1909
- return this.entries();
1910
- }
1911
- [Symbol.toStringTag] = "LRUCache";
1912
- find(t, e = {}) {
1913
- for (let s of this.#F()) {
1914
- let i2 = this.#i[s], r = this.#l(i2) ? i2.__staleWhileFetching : i2;
1915
- if (r !== void 0 && t(r, this.#a[s], this)) return this.get(this.#a[s], e);
1916
- }
1917
- }
1918
- forEach(t, e = this) {
1919
- for (let s of this.#F()) {
1920
- let i2 = this.#i[s], r = this.#l(i2) ? i2.__staleWhileFetching : i2;
1921
- r !== void 0 && t.call(e, r, this.#a[s], this);
1922
- }
1923
- }
1924
- rforEach(t, e = this) {
1925
- for (let s of this.#D()) {
1926
- let i2 = this.#i[s], r = this.#l(i2) ? i2.__staleWhileFetching : i2;
1927
- r !== void 0 && t.call(e, r, this.#a[s], this);
1928
- }
1929
- }
1930
- purgeStale() {
1931
- let t = false;
1932
- for (let e of this.#D({ allowStale: true })) this.#v(e) && (this.#O(this.#a[e], "expire"), t = true);
1933
- return t;
1934
- }
1935
- info(t) {
1936
- let e = this.#f.get(t);
1937
- if (e === void 0) return;
1938
- let s = this.#i[e], i2 = this.#l(s) ? s.__staleWhileFetching : s;
1939
- if (i2 === void 0) return;
1940
- let r = { value: i2 };
1941
- if (this.#g && this.#T) {
1942
- let o = this.#g[e], h = this.#T[e];
1943
- if (o && h) {
1944
- let a2 = o - (this.#c.now() - h);
1945
- r.ttl = a2, r.start = Date.now();
1946
- }
1947
- }
1948
- return this.#C && (r.size = this.#C[e]), r;
1949
- }
1950
- dump() {
1951
- let t = [];
1952
- for (let e of this.#F({ allowStale: true })) {
1953
- let s = this.#a[e], i2 = this.#i[e], r = this.#l(i2) ? i2.__staleWhileFetching : i2;
1954
- if (r === void 0 || s === void 0) continue;
1955
- let o = { value: r };
1956
- if (this.#g && this.#T) {
1957
- o.ttl = this.#g[e];
1958
- let h = this.#c.now() - this.#T[e];
1959
- o.start = Math.floor(Date.now() - h);
1960
- }
1961
- this.#C && (o.size = this.#C[e]), t.unshift([s, o]);
1962
- }
1963
- return t;
1964
- }
1965
- load(t) {
1966
- this.clear();
1967
- for (let [e, s] of t) {
1968
- if (s.start) {
1969
- let i2 = Date.now() - s.start;
1970
- s.start = this.#c.now() - i2;
1971
- }
1972
- this.set(e, s.value, s);
1973
- }
1974
- }
1975
- set(t, e, s = {}) {
1976
- if (e === void 0) return this.delete(t), this;
1977
- let { ttl: i2 = this.ttl, start: r, noDisposeOnSet: o = this.noDisposeOnSet, sizeCalculation: h = this.sizeCalculation, status: a2 } = s, { noUpdateTTL: l = this.noUpdateTTL } = s, u2 = this.#I(t, e, s.size || 0, h);
1978
- if (this.maxEntrySize && u2 > this.maxEntrySize) return a2 && (a2.set = "miss", a2.maxEntrySizeExceeded = true), this.#O(t, "set"), this;
1979
- let c = this.#h === 0 ? void 0 : this.#f.get(t);
1980
- if (c === void 0) c = this.#h === 0 ? this.#p : this.#R.length !== 0 ? this.#R.pop() : this.#h === this.#t ? this.#B(false) : this.#h, this.#a[c] = t, this.#i[c] = e, this.#f.set(t, c), this.#d[this.#p] = c, this.#E[c] = this.#p, this.#p = c, this.#h++, this.#L(c, u2, a2), a2 && (a2.set = "add"), l = false, this.#_ && this.#r?.(e, t, "add");
1981
- else {
1982
- this.#W(c);
1983
- let d4 = this.#i[c];
1984
- if (e !== d4) {
1985
- if (this.#A && this.#l(d4)) {
1986
- d4.__abortController.abort(new Error("replaced"));
1987
- let { __staleWhileFetching: f } = d4;
1988
- f !== void 0 && !o && (this.#x && this.#n?.(f, t, "set"), this.#e && this.#m?.push([f, t, "set"]));
1989
- } else o || (this.#x && this.#n?.(d4, t, "set"), this.#e && this.#m?.push([d4, t, "set"]));
1990
- if (this.#P(c), this.#L(c, u2, a2), this.#i[c] = e, a2) {
1991
- a2.set = "replace";
1992
- let f = d4 && this.#l(d4) ? d4.__staleWhileFetching : d4;
1993
- f !== void 0 && (a2.oldValue = f);
1994
- }
1995
- } else a2 && (a2.set = "update");
1996
- this.#_ && this.onInsert?.(e, t, e === d4 ? "update" : "replace");
1997
- }
1998
- if (i2 !== 0 && !this.#g && this.#M(), this.#g && (l || this.#j(c, i2, r), a2 && this.#N(a2, c)), !o && this.#e && this.#m) {
1999
- let d4 = this.#m, f;
2000
- for (; f = d4?.shift(); ) this.#o?.(...f);
2001
- }
2002
- return this;
2003
- }
2004
- pop() {
2005
- try {
2006
- for (; this.#h; ) {
2007
- let t = this.#i[this.#b];
2008
- if (this.#B(true), this.#l(t)) {
2009
- if (t.__staleWhileFetching) return t.__staleWhileFetching;
2010
- } else if (t !== void 0) return t;
2011
- }
2012
- } finally {
2013
- if (this.#e && this.#m) {
2014
- let t = this.#m, e;
2015
- for (; e = t?.shift(); ) this.#o?.(...e);
2016
- }
2017
- }
2018
- }
2019
- #B(t) {
2020
- let e = this.#b, s = this.#a[e], i2 = this.#i[e];
2021
- return this.#A && this.#l(i2) ? i2.__abortController.abort(new Error("evicted")) : (this.#x || this.#e) && (this.#x && this.#n?.(i2, s, "evict"), this.#e && this.#m?.push([i2, s, "evict"])), this.#P(e), this.#y?.[e] && (clearTimeout(this.#y[e]), this.#y[e] = void 0), t && (this.#a[e] = void 0, this.#i[e] = void 0, this.#R.push(e)), this.#h === 1 ? (this.#b = this.#p = 0, this.#R.length = 0) : this.#b = this.#d[e], this.#f.delete(s), this.#h--, e;
2022
- }
2023
- has(t, e = {}) {
2024
- let { updateAgeOnHas: s = this.updateAgeOnHas, status: i2 } = e, r = this.#f.get(t);
2025
- if (r !== void 0) {
2026
- let o = this.#i[r];
2027
- if (this.#l(o) && o.__staleWhileFetching === void 0) return false;
2028
- if (this.#v(r)) i2 && (i2.has = "stale", this.#N(i2, r));
2029
- else return s && this.#k(r), i2 && (i2.has = "hit", this.#N(i2, r)), true;
2030
- } else i2 && (i2.has = "miss");
2031
- return false;
2032
- }
2033
- peek(t, e = {}) {
2034
- let { allowStale: s = this.allowStale } = e, i2 = this.#f.get(t);
2035
- if (i2 === void 0 || !s && this.#v(i2)) return;
2036
- let r = this.#i[i2];
2037
- return this.#l(r) ? r.__staleWhileFetching : r;
2038
- }
2039
- #U(t, e, s, i2) {
2040
- let r = e === void 0 ? void 0 : this.#i[e];
2041
- if (this.#l(r)) return r;
2042
- let o = new At(), { signal: h } = s;
2043
- h?.addEventListener("abort", () => o.abort(h.reason), { signal: o.signal });
2044
- let a2 = { signal: o.signal, options: s, context: i2 }, l = (p, w2 = false) => {
2045
- let { aborted: g2 } = o.signal, S3 = s.ignoreFetchAbort && p !== void 0, E = s.ignoreFetchAbort || !!(s.allowStaleOnFetchAbort && p !== void 0);
2046
- if (s.status && (g2 && !w2 ? (s.status.fetchAborted = true, s.status.fetchError = o.signal.reason, S3 && (s.status.fetchAbortIgnored = true)) : s.status.fetchResolved = true), g2 && !S3 && !w2) return c(o.signal.reason, E);
2047
- let y2 = f, b = this.#i[e];
2048
- return (b === f || S3 && w2 && b === void 0) && (p === void 0 ? y2.__staleWhileFetching !== void 0 ? this.#i[e] = y2.__staleWhileFetching : this.#O(t, "fetch") : (s.status && (s.status.fetchUpdated = true), this.set(t, p, a2.options))), p;
2049
- }, u2 = (p) => (s.status && (s.status.fetchRejected = true, s.status.fetchError = p), c(p, false)), c = (p, w2) => {
2050
- let { aborted: g2 } = o.signal, S3 = g2 && s.allowStaleOnFetchAbort, E = S3 || s.allowStaleOnFetchRejection, y2 = E || s.noDeleteOnFetchRejection, b = f;
2051
- if (this.#i[e] === f && (!y2 || !w2 && b.__staleWhileFetching === void 0 ? this.#O(t, "fetch") : S3 || (this.#i[e] = b.__staleWhileFetching)), E) return s.status && b.__staleWhileFetching !== void 0 && (s.status.returnedStale = true), b.__staleWhileFetching;
2052
- if (b.__returned === b) throw p;
2053
- }, d4 = (p, w2) => {
2054
- let g2 = this.#S?.(t, r, a2);
2055
- g2 && g2 instanceof Promise && g2.then((S3) => p(S3 === void 0 ? void 0 : S3), w2), o.signal.addEventListener("abort", () => {
2056
- (!s.ignoreFetchAbort || s.allowStaleOnFetchAbort) && (p(void 0), s.allowStaleOnFetchAbort && (p = (S3) => l(S3, true)));
2057
- });
2058
- };
2059
- s.status && (s.status.fetchDispatched = true);
2060
- let f = new Promise(d4).then(l, u2), m2 = Object.assign(f, { __abortController: o, __staleWhileFetching: r, __returned: void 0 });
2061
- return e === void 0 ? (this.set(t, m2, { ...a2.options, status: void 0 }), e = this.#f.get(t)) : this.#i[e] = m2, m2;
2062
- }
2063
- #l(t) {
2064
- if (!this.#A) return false;
2065
- let e = t;
2066
- return !!e && e instanceof Promise && e.hasOwnProperty("__staleWhileFetching") && e.__abortController instanceof At;
2067
- }
2068
- async fetch(t, e = {}) {
2069
- let { allowStale: s = this.allowStale, updateAgeOnGet: i2 = this.updateAgeOnGet, noDeleteOnStaleGet: r = this.noDeleteOnStaleGet, ttl: o = this.ttl, noDisposeOnSet: h = this.noDisposeOnSet, size: a2 = 0, sizeCalculation: l = this.sizeCalculation, noUpdateTTL: u2 = this.noUpdateTTL, noDeleteOnFetchRejection: c = this.noDeleteOnFetchRejection, allowStaleOnFetchRejection: d4 = this.allowStaleOnFetchRejection, ignoreFetchAbort: f = this.ignoreFetchAbort, allowStaleOnFetchAbort: m2 = this.allowStaleOnFetchAbort, context: p, forceRefresh: w2 = false, status: g2, signal: S3 } = e;
2070
- if (!this.#A) return g2 && (g2.fetch = "get"), this.get(t, { allowStale: s, updateAgeOnGet: i2, noDeleteOnStaleGet: r, status: g2 });
2071
- let E = { allowStale: s, updateAgeOnGet: i2, noDeleteOnStaleGet: r, ttl: o, noDisposeOnSet: h, size: a2, sizeCalculation: l, noUpdateTTL: u2, noDeleteOnFetchRejection: c, allowStaleOnFetchRejection: d4, allowStaleOnFetchAbort: m2, ignoreFetchAbort: f, status: g2, signal: S3 }, y2 = this.#f.get(t);
2072
- if (y2 === void 0) {
2073
- g2 && (g2.fetch = "miss");
2074
- let b = this.#U(t, y2, E, p);
2075
- return b.__returned = b;
2076
- } else {
2077
- let b = this.#i[y2];
2078
- if (this.#l(b)) {
2079
- let Z = s && b.__staleWhileFetching !== void 0;
2080
- return g2 && (g2.fetch = "inflight", Z && (g2.returnedStale = true)), Z ? b.__staleWhileFetching : b.__returned = b;
2081
- }
2082
- let z = this.#v(y2);
2083
- if (!w2 && !z) return g2 && (g2.fetch = "hit"), this.#W(y2), i2 && this.#k(y2), g2 && this.#N(g2, y2), b;
2084
- let $ = this.#U(t, y2, E, p), J = $.__staleWhileFetching !== void 0 && s;
2085
- return g2 && (g2.fetch = z ? "stale" : "refresh", J && z && (g2.returnedStale = true)), J ? $.__staleWhileFetching : $.__returned = $;
2086
- }
2087
- }
2088
- async forceFetch(t, e = {}) {
2089
- let s = await this.fetch(t, e);
2090
- if (s === void 0) throw new Error("fetch() returned undefined");
2091
- return s;
2092
- }
2093
- memo(t, e = {}) {
2094
- let s = this.#w;
2095
- if (!s) throw new Error("no memoMethod provided to constructor");
2096
- let { context: i2, forceRefresh: r, ...o } = e, h = this.get(t, o);
2097
- if (!r && h !== void 0) return h;
2098
- let a2 = s(t, h, { options: o, context: i2 });
2099
- return this.set(t, a2, o), a2;
2100
- }
2101
- get(t, e = {}) {
2102
- let { allowStale: s = this.allowStale, updateAgeOnGet: i2 = this.updateAgeOnGet, noDeleteOnStaleGet: r = this.noDeleteOnStaleGet, status: o } = e, h = this.#f.get(t);
2103
- if (h !== void 0) {
2104
- let a2 = this.#i[h], l = this.#l(a2);
2105
- return o && this.#N(o, h), this.#v(h) ? (o && (o.get = "stale"), l ? (o && s && a2.__staleWhileFetching !== void 0 && (o.returnedStale = true), s ? a2.__staleWhileFetching : void 0) : (r || this.#O(t, "expire"), o && s && (o.returnedStale = true), s ? a2 : void 0)) : (o && (o.get = "hit"), l ? a2.__staleWhileFetching : (this.#W(h), i2 && this.#k(h), a2));
2106
- } else o && (o.get = "miss");
2107
- }
2108
- #$(t, e) {
2109
- this.#E[e] = t, this.#d[t] = e;
2110
- }
2111
- #W(t) {
2112
- t !== this.#p && (t === this.#b ? this.#b = this.#d[t] : this.#$(this.#E[t], this.#d[t]), this.#$(this.#p, t), this.#p = t);
2113
- }
2114
- delete(t) {
2115
- return this.#O(t, "delete");
2116
- }
2117
- #O(t, e) {
2118
- let s = false;
2119
- if (this.#h !== 0) {
2120
- let i2 = this.#f.get(t);
2121
- if (i2 !== void 0) if (this.#y?.[i2] && (clearTimeout(this.#y?.[i2]), this.#y[i2] = void 0), s = true, this.#h === 1) this.#H(e);
2122
- else {
2123
- this.#P(i2);
2124
- let r = this.#i[i2];
2125
- if (this.#l(r) ? r.__abortController.abort(new Error("deleted")) : (this.#x || this.#e) && (this.#x && this.#n?.(r, t, e), this.#e && this.#m?.push([r, t, e])), this.#f.delete(t), this.#a[i2] = void 0, this.#i[i2] = void 0, i2 === this.#p) this.#p = this.#E[i2];
2126
- else if (i2 === this.#b) this.#b = this.#d[i2];
2127
- else {
2128
- let o = this.#E[i2];
2129
- this.#d[o] = this.#d[i2];
2130
- let h = this.#d[i2];
2131
- this.#E[h] = this.#E[i2];
2132
- }
2133
- this.#h--, this.#R.push(i2);
2134
- }
2135
- }
2136
- if (this.#e && this.#m?.length) {
2137
- let i2 = this.#m, r;
2138
- for (; r = i2?.shift(); ) this.#o?.(...r);
2139
- }
2140
- return s;
2141
- }
2142
- clear() {
2143
- return this.#H("delete");
2144
- }
2145
- #H(t) {
2146
- for (let e of this.#D({ allowStale: true })) {
2147
- let s = this.#i[e];
2148
- if (this.#l(s)) s.__abortController.abort(new Error("deleted"));
2149
- else {
2150
- let i2 = this.#a[e];
2151
- this.#x && this.#n?.(s, i2, t), this.#e && this.#m?.push([s, i2, t]);
2152
- }
2153
- }
2154
- if (this.#f.clear(), this.#i.fill(void 0), this.#a.fill(void 0), this.#g && this.#T) {
2155
- this.#g.fill(0), this.#T.fill(0);
2156
- for (let e of this.#y ?? []) e !== void 0 && clearTimeout(e);
2157
- this.#y?.fill(void 0);
2158
- }
2159
- if (this.#C && this.#C.fill(0), this.#b = 0, this.#p = 0, this.#R.length = 0, this.#u = 0, this.#h = 0, this.#e && this.#m) {
2160
- let e = this.#m, s;
2161
- for (; s = e?.shift(); ) this.#o?.(...s);
2162
- }
2163
- }
2164
- };
2165
- var Ne = typeof process == "object" && process ? process : { stdout: null, stderr: null };
2166
- var oi = (n7) => !!n7 && typeof n7 == "object" && (n7 instanceof V || n7 instanceof Pe || hi(n7) || ai(n7));
2167
- var hi = (n7) => !!n7 && typeof n7 == "object" && n7 instanceof ee && typeof n7.pipe == "function" && n7.pipe !== Pe.Writable.prototype.pipe;
2168
- var ai = (n7) => !!n7 && typeof n7 == "object" && n7 instanceof ee && typeof n7.write == "function" && typeof n7.end == "function";
2169
- var G2 = /* @__PURE__ */ Symbol("EOF");
2170
- var H2 = /* @__PURE__ */ Symbol("maybeEmitEnd");
2171
- var K = /* @__PURE__ */ Symbol("emittedEnd");
2172
- var kt = /* @__PURE__ */ Symbol("emittingEnd");
2173
- var ut = /* @__PURE__ */ Symbol("emittedError");
2174
- var Rt = /* @__PURE__ */ Symbol("closed");
2175
- var _e = /* @__PURE__ */ Symbol("read");
2176
- var Ot = /* @__PURE__ */ Symbol("flush");
2177
- var Le = /* @__PURE__ */ Symbol("flushChunk");
2178
- var P3 = /* @__PURE__ */ Symbol("encoding");
2179
- var et = /* @__PURE__ */ Symbol("decoder");
2180
- var v2 = /* @__PURE__ */ Symbol("flowing");
2181
- var dt = /* @__PURE__ */ Symbol("paused");
2182
- var st = /* @__PURE__ */ Symbol("resume");
2183
- var C2 = /* @__PURE__ */ Symbol("buffer");
2184
- var F2 = /* @__PURE__ */ Symbol("pipes");
2185
- var T3 = /* @__PURE__ */ Symbol("bufferLength");
2186
- var Yt = /* @__PURE__ */ Symbol("bufferPush");
2187
- var Ft = /* @__PURE__ */ Symbol("bufferShift");
2188
- var k3 = /* @__PURE__ */ Symbol("objectMode");
2189
- var x2 = /* @__PURE__ */ Symbol("destroyed");
2190
- var Xt = /* @__PURE__ */ Symbol("error");
2191
- var Jt = /* @__PURE__ */ Symbol("emitData");
2192
- var We = /* @__PURE__ */ Symbol("emitEnd");
2193
- var Zt = /* @__PURE__ */ Symbol("emitEnd2");
2194
- var B = /* @__PURE__ */ Symbol("async");
2195
- var Qt = /* @__PURE__ */ Symbol("abort");
2196
- var Dt = /* @__PURE__ */ Symbol("aborted");
2197
- var pt = /* @__PURE__ */ Symbol("signal");
2198
- var Y = /* @__PURE__ */ Symbol("dataListeners");
2199
- var M2 = /* @__PURE__ */ Symbol("discarded");
2200
- var mt = (n7) => Promise.resolve().then(n7);
2201
- var li = (n7) => n7();
2202
- var ci = (n7) => n7 === "end" || n7 === "finish" || n7 === "prefinish";
2203
- var fi = (n7) => n7 instanceof ArrayBuffer || !!n7 && typeof n7 == "object" && n7.constructor && n7.constructor.name === "ArrayBuffer" && n7.byteLength >= 0;
2204
- var ui = (n7) => !Buffer.isBuffer(n7) && ArrayBuffer.isView(n7);
2205
- var Mt = class {
2206
- src;
2207
- dest;
2208
- opts;
2209
- ondrain;
2210
- constructor(t, e, s) {
2211
- this.src = t, this.dest = e, this.opts = s, this.ondrain = () => t[st](), this.dest.on("drain", this.ondrain);
2212
- }
2213
- unpipe() {
2214
- this.dest.removeListener("drain", this.ondrain);
2215
- }
2216
- proxyErrors(t) {
2217
- }
2218
- end() {
2219
- this.unpipe(), this.opts.end && this.dest.end();
2220
- }
2221
- };
2222
- var te = class extends Mt {
2223
- unpipe() {
2224
- this.src.removeListener("error", this.proxyErrors), super.unpipe();
2225
- }
2226
- constructor(t, e, s) {
2227
- super(t, e, s), this.proxyErrors = (i2) => this.dest.emit("error", i2), t.on("error", this.proxyErrors);
2228
- }
2229
- };
2230
- var di = (n7) => !!n7.objectMode;
2231
- var pi = (n7) => !n7.objectMode && !!n7.encoding && n7.encoding !== "buffer";
2232
- var V = class extends ee {
2233
- [v2] = false;
2234
- [dt] = false;
2235
- [F2] = [];
2236
- [C2] = [];
2237
- [k3];
2238
- [P3];
2239
- [B];
2240
- [et];
2241
- [G2] = false;
2242
- [K] = false;
2243
- [kt] = false;
2244
- [Rt] = false;
2245
- [ut] = null;
2246
- [T3] = 0;
2247
- [x2] = false;
2248
- [pt];
2249
- [Dt] = false;
2250
- [Y] = 0;
2251
- [M2] = false;
2252
- writable = true;
2253
- readable = true;
2254
- constructor(...t) {
2255
- let e = t[0] || {};
2256
- if (super(), e.objectMode && typeof e.encoding == "string") throw new TypeError("Encoding and objectMode may not be used together");
2257
- di(e) ? (this[k3] = true, this[P3] = null) : pi(e) ? (this[P3] = e.encoding, this[k3] = false) : (this[k3] = false, this[P3] = null), this[B] = !!e.async, this[et] = this[P3] ? new ni(this[P3]) : null, e && e.debugExposeBuffer === true && Object.defineProperty(this, "buffer", { get: () => this[C2] }), e && e.debugExposePipes === true && Object.defineProperty(this, "pipes", { get: () => this[F2] });
2258
- let { signal: s } = e;
2259
- s && (this[pt] = s, s.aborted ? this[Qt]() : s.addEventListener("abort", () => this[Qt]()));
2260
- }
2261
- get bufferLength() {
2262
- return this[T3];
2263
- }
2264
- get encoding() {
2265
- return this[P3];
2266
- }
2267
- set encoding(t) {
2268
- throw new Error("Encoding must be set at instantiation time");
2269
- }
2270
- setEncoding(t) {
2271
- throw new Error("Encoding must be set at instantiation time");
2272
- }
2273
- get objectMode() {
2274
- return this[k3];
2275
- }
2276
- set objectMode(t) {
2277
- throw new Error("objectMode must be set at instantiation time");
2278
- }
2279
- get async() {
2280
- return this[B];
2281
- }
2282
- set async(t) {
2283
- this[B] = this[B] || !!t;
2284
- }
2285
- [Qt]() {
2286
- this[Dt] = true, this.emit("abort", this[pt]?.reason), this.destroy(this[pt]?.reason);
2287
- }
2288
- get aborted() {
2289
- return this[Dt];
2290
- }
2291
- set aborted(t) {
2292
- }
2293
- write(t, e, s) {
2294
- if (this[Dt]) return false;
2295
- if (this[G2]) throw new Error("write after end");
2296
- if (this[x2]) return this.emit("error", Object.assign(new Error("Cannot call write after a stream was destroyed"), { code: "ERR_STREAM_DESTROYED" })), true;
2297
- typeof e == "function" && (s = e, e = "utf8"), e || (e = "utf8");
2298
- let i2 = this[B] ? mt : li;
2299
- if (!this[k3] && !Buffer.isBuffer(t)) {
2300
- if (ui(t)) t = Buffer.from(t.buffer, t.byteOffset, t.byteLength);
2301
- else if (fi(t)) t = Buffer.from(t);
2302
- else if (typeof t != "string") throw new Error("Non-contiguous data written to non-objectMode stream");
2303
- }
2304
- return this[k3] ? (this[v2] && this[T3] !== 0 && this[Ot](true), this[v2] ? this.emit("data", t) : this[Yt](t), this[T3] !== 0 && this.emit("readable"), s && i2(s), this[v2]) : t.length ? (typeof t == "string" && !(e === this[P3] && !this[et]?.lastNeed) && (t = Buffer.from(t, e)), Buffer.isBuffer(t) && this[P3] && (t = this[et].write(t)), this[v2] && this[T3] !== 0 && this[Ot](true), this[v2] ? this.emit("data", t) : this[Yt](t), this[T3] !== 0 && this.emit("readable"), s && i2(s), this[v2]) : (this[T3] !== 0 && this.emit("readable"), s && i2(s), this[v2]);
2305
- }
2306
- read(t) {
2307
- if (this[x2]) return null;
2308
- if (this[M2] = false, this[T3] === 0 || t === 0 || t && t > this[T3]) return this[H2](), null;
2309
- this[k3] && (t = null), this[C2].length > 1 && !this[k3] && (this[C2] = [this[P3] ? this[C2].join("") : Buffer.concat(this[C2], this[T3])]);
2310
- let e = this[_e](t || null, this[C2][0]);
2311
- return this[H2](), e;
2312
- }
2313
- [_e](t, e) {
2314
- if (this[k3]) this[Ft]();
2315
- else {
2316
- let s = e;
2317
- t === s.length || t === null ? this[Ft]() : typeof s == "string" ? (this[C2][0] = s.slice(t), e = s.slice(0, t), this[T3] -= t) : (this[C2][0] = s.subarray(t), e = s.subarray(0, t), this[T3] -= t);
2318
- }
2319
- return this.emit("data", e), !this[C2].length && !this[G2] && this.emit("drain"), e;
2320
- }
2321
- end(t, e, s) {
2322
- 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[G2] = true, this.writable = false, (this[v2] || !this[dt]) && this[H2](), this;
2323
- }
2324
- [st]() {
2325
- this[x2] || (!this[Y] && !this[F2].length && (this[M2] = true), this[dt] = false, this[v2] = true, this.emit("resume"), this[C2].length ? this[Ot]() : this[G2] ? this[H2]() : this.emit("drain"));
2326
- }
2327
- resume() {
2328
- return this[st]();
2329
- }
2330
- pause() {
2331
- this[v2] = false, this[dt] = true, this[M2] = false;
2332
- }
2333
- get destroyed() {
2334
- return this[x2];
2335
- }
2336
- get flowing() {
2337
- return this[v2];
2338
- }
2339
- get paused() {
2340
- return this[dt];
2341
- }
2342
- [Yt](t) {
2343
- this[k3] ? this[T3] += 1 : this[T3] += t.length, this[C2].push(t);
2344
- }
2345
- [Ft]() {
2346
- return this[k3] ? this[T3] -= 1 : this[T3] -= this[C2][0].length, this[C2].shift();
2347
- }
2348
- [Ot](t = false) {
2349
- do
2350
- ;
2351
- while (this[Le](this[Ft]()) && this[C2].length);
2352
- !t && !this[C2].length && !this[G2] && this.emit("drain");
2353
- }
2354
- [Le](t) {
2355
- return this.emit("data", t), this[v2];
2356
- }
2357
- pipe(t, e) {
2358
- if (this[x2]) return t;
2359
- this[M2] = false;
2360
- let s = this[K];
2361
- return e = e || {}, t === Ne.stdout || t === Ne.stderr ? e.end = false : e.end = e.end !== false, e.proxyErrors = !!e.proxyErrors, s ? e.end && t.end() : (this[F2].push(e.proxyErrors ? new te(this, t, e) : new Mt(this, t, e)), this[B] ? mt(() => this[st]()) : this[st]()), t;
2362
- }
2363
- unpipe(t) {
2364
- let e = this[F2].find((s) => s.dest === t);
2365
- e && (this[F2].length === 1 ? (this[v2] && this[Y] === 0 && (this[v2] = false), this[F2] = []) : this[F2].splice(this[F2].indexOf(e), 1), e.unpipe());
2366
- }
2367
- addListener(t, e) {
2368
- return this.on(t, e);
2369
- }
2370
- on(t, e) {
2371
- let s = super.on(t, e);
2372
- if (t === "data") this[M2] = false, this[Y]++, !this[F2].length && !this[v2] && this[st]();
2373
- else if (t === "readable" && this[T3] !== 0) super.emit("readable");
2374
- else if (ci(t) && this[K]) super.emit(t), this.removeAllListeners(t);
2375
- else if (t === "error" && this[ut]) {
2376
- let i2 = e;
2377
- this[B] ? mt(() => i2.call(this, this[ut])) : i2.call(this, this[ut]);
2378
- }
2379
- return s;
2380
- }
2381
- removeListener(t, e) {
2382
- return this.off(t, e);
2383
- }
2384
- off(t, e) {
2385
- let s = super.off(t, e);
2386
- return t === "data" && (this[Y] = this.listeners("data").length, this[Y] === 0 && !this[M2] && !this[F2].length && (this[v2] = false)), s;
2387
- }
2388
- removeAllListeners(t) {
2389
- let e = super.removeAllListeners(t);
2390
- return (t === "data" || t === void 0) && (this[Y] = 0, !this[M2] && !this[F2].length && (this[v2] = false)), e;
2391
- }
2392
- get emittedEnd() {
2393
- return this[K];
2394
- }
2395
- [H2]() {
2396
- !this[kt] && !this[K] && !this[x2] && this[C2].length === 0 && this[G2] && (this[kt] = true, this.emit("end"), this.emit("prefinish"), this.emit("finish"), this[Rt] && this.emit("close"), this[kt] = false);
2397
- }
2398
- emit(t, ...e) {
2399
- let s = e[0];
2400
- if (t !== "error" && t !== "close" && t !== x2 && this[x2]) return false;
2401
- if (t === "data") return !this[k3] && !s ? false : this[B] ? (mt(() => this[Jt](s)), true) : this[Jt](s);
2402
- if (t === "end") return this[We]();
2403
- if (t === "close") {
2404
- if (this[Rt] = true, !this[K] && !this[x2]) return false;
2405
- let r = super.emit("close");
2406
- return this.removeAllListeners("close"), r;
2407
- } else if (t === "error") {
2408
- this[ut] = s, super.emit(Xt, s);
2409
- let r = !this[pt] || this.listeners("error").length ? super.emit("error", s) : false;
2410
- return this[H2](), r;
2411
- } else if (t === "resume") {
2412
- let r = super.emit("resume");
2413
- return this[H2](), r;
2414
- } else if (t === "finish" || t === "prefinish") {
2415
- let r = super.emit(t);
2416
- return this.removeAllListeners(t), r;
2417
- }
2418
- let i2 = super.emit(t, ...e);
2419
- return this[H2](), i2;
2420
- }
2421
- [Jt](t) {
2422
- for (let s of this[F2]) s.dest.write(t) === false && this.pause();
2423
- let e = this[M2] ? false : super.emit("data", t);
2424
- return this[H2](), e;
2425
- }
2426
- [We]() {
2427
- return this[K] ? false : (this[K] = true, this.readable = false, this[B] ? (mt(() => this[Zt]()), true) : this[Zt]());
2428
- }
2429
- [Zt]() {
2430
- if (this[et]) {
2431
- let e = this[et].end();
2432
- if (e) {
2433
- for (let s of this[F2]) s.dest.write(e);
2434
- this[M2] || super.emit("data", e);
2435
- }
2436
- }
2437
- for (let e of this[F2]) e.end();
2438
- let t = super.emit("end");
2439
- return this.removeAllListeners("end"), t;
2440
- }
2441
- async collect() {
2442
- let t = Object.assign([], { dataLength: 0 });
2443
- this[k3] || (t.dataLength = 0);
2444
- let e = this.promise();
2445
- return this.on("data", (s) => {
2446
- t.push(s), this[k3] || (t.dataLength += s.length);
2447
- }), await e, t;
2448
- }
2449
- async concat() {
2450
- if (this[k3]) throw new Error("cannot concat in objectMode");
2451
- let t = await this.collect();
2452
- return this[P3] ? t.join("") : Buffer.concat(t, t.dataLength);
2453
- }
2454
- async promise() {
2455
- return new Promise((t, e) => {
2456
- this.on(x2, () => e(new Error("stream destroyed"))), this.on("error", (s) => e(s)), this.on("end", () => t());
2457
- });
2458
- }
2459
- [Symbol.asyncIterator]() {
2460
- this[M2] = false;
2461
- let t = false, e = async () => (this.pause(), t = true, { value: void 0, done: true });
2462
- return { next: () => {
2463
- if (t) return e();
2464
- let i2 = this.read();
2465
- if (i2 !== null) return Promise.resolve({ done: false, value: i2 });
2466
- if (this[G2]) return e();
2467
- let r, o, h = (c) => {
2468
- this.off("data", a2), this.off("end", l), this.off(x2, u2), e(), o(c);
2469
- }, a2 = (c) => {
2470
- this.off("error", h), this.off("end", l), this.off(x2, u2), this.pause(), r({ value: c, done: !!this[G2] });
2471
- }, l = () => {
2472
- this.off("error", h), this.off("data", a2), this.off(x2, u2), e(), r({ done: true, value: void 0 });
2473
- }, u2 = () => h(new Error("stream destroyed"));
2474
- return new Promise((c, d4) => {
2475
- o = d4, r = c, this.once(x2, u2), this.once("error", h), this.once("end", l), this.once("data", a2);
2476
- });
2477
- }, throw: e, return: e, [Symbol.asyncIterator]() {
2478
- return this;
2479
- }, [Symbol.asyncDispose]: async () => {
2480
- } };
2481
- }
2482
- [Symbol.iterator]() {
2483
- this[M2] = false;
2484
- let t = false, e = () => (this.pause(), this.off(Xt, e), this.off(x2, e), this.off("end", e), t = true, { done: true, value: void 0 }), s = () => {
2485
- if (t) return e();
2486
- let i2 = this.read();
2487
- return i2 === null ? e() : { done: false, value: i2 };
2488
- };
2489
- return this.once("end", e), this.once(Xt, e), this.once(x2, e), { next: s, throw: e, return: e, [Symbol.iterator]() {
2490
- return this;
2491
- }, [Symbol.dispose]: () => {
2492
- } };
2493
- }
2494
- destroy(t) {
2495
- if (this[x2]) return t ? this.emit("error", t) : this.emit(x2), this;
2496
- this[x2] = true, this[M2] = true, this[C2].length = 0, this[T3] = 0;
2497
- let e = this;
2498
- return typeof e.close == "function" && !this[Rt] && e.close(), t ? this.emit("error", t) : this.emit(x2), this;
2499
- }
2500
- static get isStream() {
2501
- return oi;
2502
- }
2503
- };
2504
- var vi = Ei.native;
2505
- var wt = { lstatSync: wi, readdir: yi, readdirSync: bi, readlinkSync: Si, realpathSync: vi, promises: { lstat: Ci, readdir: Ti, readlink: Ai, realpath: ki } };
2506
- var Ue = (n7) => !n7 || n7 === wt || n7 === xi ? wt : { ...wt, ...n7, promises: { ...wt.promises, ...n7.promises || {} } };
2507
- var $e = /^\\\\\?\\([a-z]:)\\?$/i;
2508
- var Ri = (n7) => n7.replace(/\//g, "\\").replace($e, "$1\\");
2509
- var Oi = /[\\\/]/;
2510
- var L3 = 0;
2511
- var Ge = 1;
2512
- var He = 2;
2513
- var U3 = 4;
2514
- var qe = 6;
2515
- var Ke = 8;
2516
- var X = 10;
2517
- var Ve = 12;
2518
- var _2 = 15;
2519
- var gt = ~_2;
2520
- var se = 16;
2521
- var je = 32;
2522
- var yt = 64;
2523
- var j2 = 128;
2524
- var Nt = 256;
2525
- var Lt = 512;
2526
- var Ie = yt | j2 | Lt;
2527
- var Fi = 1023;
2528
- var ie = (n7) => n7.isFile() ? Ke : n7.isDirectory() ? U3 : n7.isSymbolicLink() ? X : n7.isCharacterDevice() ? He : n7.isBlockDevice() ? qe : n7.isSocket() ? Ve : n7.isFIFO() ? Ge : L3;
2529
- var ze = new ft({ max: 2 ** 12 });
2530
- var bt = (n7) => {
2531
- let t = ze.get(n7);
2532
- if (t) return t;
2533
- let e = n7.normalize("NFKD");
2534
- return ze.set(n7, e), e;
2535
- };
2536
- var Be = new ft({ max: 2 ** 12 });
2537
- var _t = (n7) => {
2538
- let t = Be.get(n7);
2539
- if (t) return t;
2540
- let e = bt(n7.toLowerCase());
2541
- return Be.set(n7, e), e;
2542
- };
2543
- var Wt = class extends ft {
2544
- constructor() {
2545
- super({ max: 256 });
2546
- }
2547
- };
2548
- var ne = class extends ft {
2549
- constructor(t = 16 * 1024) {
2550
- super({ maxSize: t, sizeCalculation: (e) => e.length + 1 });
2551
- }
2552
- };
2553
- var Ye = /* @__PURE__ */ Symbol("PathScurry setAsCwd");
2554
- var R3 = class {
2555
- name;
2556
- root;
2557
- roots;
2558
- parent;
2559
- nocase;
2560
- isCWD = false;
2561
- #t;
2562
- #s;
2563
- get dev() {
2564
- return this.#s;
2565
- }
2566
- #n;
2567
- get mode() {
2568
- return this.#n;
2569
- }
2570
- #r;
2571
- get nlink() {
2572
- return this.#r;
2573
- }
2574
- #o;
2575
- get uid() {
2576
- return this.#o;
2577
- }
2578
- #S;
2579
- get gid() {
2580
- return this.#S;
2581
- }
2582
- #w;
2583
- get rdev() {
2584
- return this.#w;
2585
- }
2586
- #c;
2587
- get blksize() {
2588
- return this.#c;
2589
- }
2590
- #h;
2591
- get ino() {
2592
- return this.#h;
2593
- }
2594
- #u;
2595
- get size() {
2596
- return this.#u;
2597
- }
2598
- #f;
2599
- get blocks() {
2600
- return this.#f;
2601
- }
2602
- #a;
2603
- get atimeMs() {
2604
- return this.#a;
2605
- }
2606
- #i;
2607
- get mtimeMs() {
2608
- return this.#i;
2609
- }
2610
- #d;
2611
- get ctimeMs() {
2612
- return this.#d;
2613
- }
2614
- #E;
2615
- get birthtimeMs() {
2616
- return this.#E;
2617
- }
2618
- #b;
2619
- get atime() {
2620
- return this.#b;
2621
- }
2622
- #p;
2623
- get mtime() {
2624
- return this.#p;
2625
- }
2626
- #R;
2627
- get ctime() {
2628
- return this.#R;
2629
- }
2630
- #m;
2631
- get birthtime() {
2632
- return this.#m;
2633
- }
2634
- #C;
2635
- #T;
2636
- #g;
2637
- #y;
2638
- #x;
2639
- #A;
2640
- #e;
2641
- #_;
2642
- #M;
2643
- #k;
2644
- get parentPath() {
2645
- return (this.parent || this).fullpath();
2646
- }
2647
- get path() {
2648
- return this.parentPath;
2649
- }
2650
- constructor(t, e = L3, s, i2, r, o, h) {
2651
- this.name = t, this.#C = r ? _t(t) : bt(t), this.#e = e & Fi, this.nocase = r, this.roots = i2, this.root = s || this, this.#_ = o, this.#g = h.fullpath, this.#x = h.relative, this.#A = h.relativePosix, this.parent = h.parent, this.parent ? this.#t = this.parent.#t : this.#t = Ue(h.fs);
2652
- }
2653
- depth() {
2654
- return this.#T !== void 0 ? this.#T : this.parent ? this.#T = this.parent.depth() + 1 : this.#T = 0;
2655
- }
2656
- childrenCache() {
2657
- return this.#_;
2658
- }
2659
- resolve(t) {
2660
- if (!t) return this;
2661
- let e = this.getRootString(t), i2 = t.substring(e.length).split(this.splitSep);
2662
- return e ? this.getRoot(e).#N(i2) : this.#N(i2);
2663
- }
2664
- #N(t) {
2665
- let e = this;
2666
- for (let s of t) e = e.child(s);
2667
- return e;
2668
- }
2669
- children() {
2670
- let t = this.#_.get(this);
2671
- if (t) return t;
2672
- let e = Object.assign([], { provisional: 0 });
2673
- return this.#_.set(this, e), this.#e &= ~se, e;
2674
- }
2675
- child(t, e) {
2676
- if (t === "" || t === ".") return this;
2677
- if (t === "..") return this.parent || this;
2678
- let s = this.children(), i2 = this.nocase ? _t(t) : bt(t);
2679
- for (let a2 of s) if (a2.#C === i2) return a2;
2680
- let r = this.parent ? this.sep : "", o = this.#g ? this.#g + r + t : void 0, h = this.newChild(t, L3, { ...e, parent: this, fullpath: o });
2681
- return this.canReaddir() || (h.#e |= j2), s.push(h), h;
2682
- }
2683
- relative() {
2684
- if (this.isCWD) return "";
2685
- if (this.#x !== void 0) return this.#x;
2686
- let t = this.name, e = this.parent;
2687
- if (!e) return this.#x = this.name;
2688
- let s = e.relative();
2689
- return s + (!s || !e.parent ? "" : this.sep) + t;
2690
- }
2691
- relativePosix() {
2692
- if (this.sep === "/") return this.relative();
2693
- if (this.isCWD) return "";
2694
- if (this.#A !== void 0) return this.#A;
2695
- let t = this.name, e = this.parent;
2696
- if (!e) return this.#A = this.fullpathPosix();
2697
- let s = e.relativePosix();
2698
- return s + (!s || !e.parent ? "" : "/") + t;
2699
- }
2700
- fullpath() {
2701
- if (this.#g !== void 0) return this.#g;
2702
- let t = this.name, e = this.parent;
2703
- if (!e) return this.#g = this.name;
2704
- let i2 = e.fullpath() + (e.parent ? this.sep : "") + t;
2705
- return this.#g = i2;
2706
- }
2707
- fullpathPosix() {
2708
- if (this.#y !== void 0) return this.#y;
2709
- if (this.sep === "/") return this.#y = this.fullpath();
2710
- if (!this.parent) {
2711
- let i2 = this.fullpath().replace(/\\/g, "/");
2712
- return /^[a-z]:\//i.test(i2) ? this.#y = `//?/${i2}` : this.#y = i2;
2713
- }
2714
- let t = this.parent, e = t.fullpathPosix(), s = e + (!e || !t.parent ? "" : "/") + this.name;
2715
- return this.#y = s;
2716
- }
2717
- isUnknown() {
2718
- return (this.#e & _2) === L3;
2719
- }
2720
- isType(t) {
2721
- return this[`is${t}`]();
2722
- }
2723
- getType() {
2724
- 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";
2725
- }
2726
- isFile() {
2727
- return (this.#e & _2) === Ke;
2728
- }
2729
- isDirectory() {
2730
- return (this.#e & _2) === U3;
2731
- }
2732
- isCharacterDevice() {
2733
- return (this.#e & _2) === He;
2734
- }
2735
- isBlockDevice() {
2736
- return (this.#e & _2) === qe;
2737
- }
2738
- isFIFO() {
2739
- return (this.#e & _2) === Ge;
2740
- }
2741
- isSocket() {
2742
- return (this.#e & _2) === Ve;
2743
- }
2744
- isSymbolicLink() {
2745
- return (this.#e & X) === X;
2746
- }
2747
- lstatCached() {
2748
- return this.#e & je ? this : void 0;
2749
- }
2750
- readlinkCached() {
2751
- return this.#M;
2752
- }
2753
- realpathCached() {
2754
- return this.#k;
2755
- }
2756
- readdirCached() {
2757
- let t = this.children();
2758
- return t.slice(0, t.provisional);
2759
- }
2760
- canReadlink() {
2761
- if (this.#M) return true;
2762
- if (!this.parent) return false;
2763
- let t = this.#e & _2;
2764
- return !(t !== L3 && t !== X || this.#e & Nt || this.#e & j2);
2765
- }
2766
- calledReaddir() {
2767
- return !!(this.#e & se);
2768
- }
2769
- isENOENT() {
2770
- return !!(this.#e & j2);
2771
- }
2772
- isNamed(t) {
2773
- return this.nocase ? this.#C === _t(t) : this.#C === bt(t);
2774
- }
2775
- async readlink() {
2776
- let t = this.#M;
2777
- if (t) return t;
2778
- if (this.canReadlink() && this.parent) try {
2779
- let e = await this.#t.promises.readlink(this.fullpath()), s = (await this.parent.realpath())?.resolve(e);
2780
- if (s) return this.#M = s;
2781
- } catch (e) {
2782
- this.#D(e.code);
2783
- return;
2784
- }
2785
- }
2786
- readlinkSync() {
2787
- let t = this.#M;
2788
- if (t) return t;
2789
- if (this.canReadlink() && this.parent) try {
2790
- let e = this.#t.readlinkSync(this.fullpath()), s = this.parent.realpathSync()?.resolve(e);
2791
- if (s) return this.#M = s;
2792
- } catch (e) {
2793
- this.#D(e.code);
2794
- return;
2795
- }
2796
- }
2797
- #j(t) {
2798
- this.#e |= se;
2799
- for (let e = t.provisional; e < t.length; e++) {
2800
- let s = t[e];
2801
- s && s.#v();
2802
- }
2803
- }
2804
- #v() {
2805
- this.#e & j2 || (this.#e = (this.#e | j2) & gt, this.#G());
2806
- }
2807
- #G() {
2808
- let t = this.children();
2809
- t.provisional = 0;
2810
- for (let e of t) e.#v();
2811
- }
2812
- #P() {
2813
- this.#e |= Lt, this.#L();
2814
- }
2815
- #L() {
2816
- if (this.#e & yt) return;
2817
- let t = this.#e;
2818
- (t & _2) === U3 && (t &= gt), this.#e = t | yt, this.#G();
2819
- }
2820
- #I(t = "") {
2821
- t === "ENOTDIR" || t === "EPERM" ? this.#L() : t === "ENOENT" ? this.#v() : this.children().provisional = 0;
2822
- }
2823
- #F(t = "") {
2824
- t === "ENOTDIR" ? this.parent.#L() : t === "ENOENT" && this.#v();
2825
- }
2826
- #D(t = "") {
2827
- let e = this.#e;
2828
- e |= Nt, t === "ENOENT" && (e |= j2), (t === "EINVAL" || t === "UNKNOWN") && (e &= gt), this.#e = e, t === "ENOTDIR" && this.parent && this.parent.#L();
2829
- }
2830
- #z(t, e) {
2831
- return this.#U(t, e) || this.#B(t, e);
2832
- }
2833
- #B(t, e) {
2834
- let s = ie(t), i2 = this.newChild(t.name, s, { parent: this }), r = i2.#e & _2;
2835
- return r !== U3 && r !== X && r !== L3 && (i2.#e |= yt), e.unshift(i2), e.provisional++, i2;
2836
- }
2837
- #U(t, e) {
2838
- for (let s = e.provisional; s < e.length; s++) {
2839
- let i2 = e[s];
2840
- if ((this.nocase ? _t(t.name) : bt(t.name)) === i2.#C) return this.#l(t, i2, s, e);
2841
- }
2842
- }
2843
- #l(t, e, s, i2) {
2844
- let r = e.name;
2845
- return e.#e = e.#e & gt | ie(t), r !== t.name && (e.name = t.name), s !== i2.provisional && (s === i2.length - 1 ? i2.pop() : i2.splice(s, 1), i2.unshift(e)), i2.provisional++, e;
2846
- }
2847
- async lstat() {
2848
- if ((this.#e & j2) === 0) try {
2849
- return this.#$(await this.#t.promises.lstat(this.fullpath())), this;
2850
- } catch (t) {
2851
- this.#F(t.code);
2852
- }
2853
- }
2854
- lstatSync() {
2855
- if ((this.#e & j2) === 0) try {
2856
- return this.#$(this.#t.lstatSync(this.fullpath())), this;
2857
- } catch (t) {
2858
- this.#F(t.code);
2859
- }
2860
- }
2861
- #$(t) {
2862
- let { atime: e, atimeMs: s, birthtime: i2, birthtimeMs: r, blksize: o, blocks: h, ctime: a2, ctimeMs: l, dev: u2, gid: c, ino: d4, mode: f, mtime: m2, mtimeMs: p, nlink: w2, rdev: g2, size: S3, uid: E } = t;
2863
- this.#b = e, this.#a = s, this.#m = i2, this.#E = r, this.#c = o, this.#f = h, this.#R = a2, this.#d = l, this.#s = u2, this.#S = c, this.#h = d4, this.#n = f, this.#p = m2, this.#i = p, this.#r = w2, this.#w = g2, this.#u = S3, this.#o = E;
2864
- let y2 = ie(t);
2865
- this.#e = this.#e & gt | y2 | je, y2 !== L3 && y2 !== U3 && y2 !== X && (this.#e |= yt);
2866
- }
2867
- #W = [];
2868
- #O = false;
2869
- #H(t) {
2870
- this.#O = false;
2871
- let e = this.#W.slice();
2872
- this.#W.length = 0, e.forEach((s) => s(null, t));
2873
- }
2874
- readdirCB(t, e = false) {
2875
- if (!this.canReaddir()) {
2876
- e ? t(null, []) : queueMicrotask(() => t(null, []));
2877
- return;
2878
- }
2879
- let s = this.children();
2880
- if (this.calledReaddir()) {
2881
- let r = s.slice(0, s.provisional);
2882
- e ? t(null, r) : queueMicrotask(() => t(null, r));
2883
- return;
2884
- }
2885
- if (this.#W.push(t), this.#O) return;
2886
- this.#O = true;
2887
- let i2 = this.fullpath();
2888
- this.#t.readdir(i2, { withFileTypes: true }, (r, o) => {
2889
- if (r) this.#I(r.code), s.provisional = 0;
2890
- else {
2891
- for (let h of o) this.#z(h, s);
2892
- this.#j(s);
2893
- }
2894
- this.#H(s.slice(0, s.provisional));
2895
- });
2896
- }
2897
- #q;
2898
- async readdir() {
2899
- if (!this.canReaddir()) return [];
2900
- let t = this.children();
2901
- if (this.calledReaddir()) return t.slice(0, t.provisional);
2902
- let e = this.fullpath();
2903
- if (this.#q) await this.#q;
2904
- else {
2905
- let s = () => {
2906
- };
2907
- this.#q = new Promise((i2) => s = i2);
2908
- try {
2909
- for (let i2 of await this.#t.promises.readdir(e, { withFileTypes: true })) this.#z(i2, t);
2910
- this.#j(t);
2911
- } catch (i2) {
2912
- this.#I(i2.code), t.provisional = 0;
2913
- }
2914
- this.#q = void 0, s();
2915
- }
2916
- return t.slice(0, t.provisional);
2917
- }
2918
- readdirSync() {
2919
- if (!this.canReaddir()) return [];
2920
- let t = this.children();
2921
- if (this.calledReaddir()) return t.slice(0, t.provisional);
2922
- let e = this.fullpath();
2923
- try {
2924
- for (let s of this.#t.readdirSync(e, { withFileTypes: true })) this.#z(s, t);
2925
- this.#j(t);
2926
- } catch (s) {
2927
- this.#I(s.code), t.provisional = 0;
2928
- }
2929
- return t.slice(0, t.provisional);
2930
- }
2931
- canReaddir() {
2932
- if (this.#e & Ie) return false;
2933
- let t = _2 & this.#e;
2934
- return t === L3 || t === U3 || t === X;
2935
- }
2936
- shouldWalk(t, e) {
2937
- return (this.#e & U3) === U3 && !(this.#e & Ie) && !t.has(this) && (!e || e(this));
2938
- }
2939
- async realpath() {
2940
- if (this.#k) return this.#k;
2941
- if (!((Lt | Nt | j2) & this.#e)) try {
2942
- let t = await this.#t.promises.realpath(this.fullpath());
2943
- return this.#k = this.resolve(t);
2944
- } catch {
2945
- this.#P();
2946
- }
2947
- }
2948
- realpathSync() {
2949
- if (this.#k) return this.#k;
2950
- if (!((Lt | Nt | j2) & this.#e)) try {
2951
- let t = this.#t.realpathSync(this.fullpath());
2952
- return this.#k = this.resolve(t);
2953
- } catch {
2954
- this.#P();
2955
- }
2956
- }
2957
- [Ye](t) {
2958
- if (t === this) return;
2959
- t.isCWD = false, this.isCWD = true;
2960
- let e = /* @__PURE__ */ new Set([]), s = [], i2 = this;
2961
- for (; i2 && i2.parent; ) e.add(i2), i2.#x = s.join(this.sep), i2.#A = s.join("/"), i2 = i2.parent, s.push("..");
2962
- for (i2 = t; i2 && i2.parent && !e.has(i2); ) i2.#x = void 0, i2.#A = void 0, i2 = i2.parent;
2963
- }
2964
- };
2965
- var Pt = class n2 extends R3 {
2966
- sep = "\\";
2967
- splitSep = Oi;
2968
- constructor(t, e = L3, s, i2, r, o, h) {
2969
- super(t, e, s, i2, r, o, h);
2970
- }
2971
- newChild(t, e = L3, s = {}) {
2972
- return new n2(t, e, this.root, this.roots, this.nocase, this.childrenCache(), s);
2973
- }
2974
- getRootString(t) {
2975
- return re.parse(t).root;
2976
- }
2977
- getRoot(t) {
2978
- if (t = Ri(t.toUpperCase()), t === this.root.name) return this.root;
2979
- for (let [e, s] of Object.entries(this.roots)) if (this.sameRoot(t, e)) return this.roots[t] = s;
2980
- return this.roots[t] = new it(t, this).root;
2981
- }
2982
- sameRoot(t, e = this.root.name) {
2983
- return t = t.toUpperCase().replace(/\//g, "\\").replace($e, "$1\\"), t === e;
2984
- }
2985
- };
2986
- var jt = class n3 extends R3 {
2987
- splitSep = "/";
2988
- sep = "/";
2989
- constructor(t, e = L3, s, i2, r, o, h) {
2990
- super(t, e, s, i2, r, o, h);
2991
- }
2992
- getRootString(t) {
2993
- return t.startsWith("/") ? "/" : "";
2994
- }
2995
- getRoot(t) {
2996
- return this.root;
2997
- }
2998
- newChild(t, e = L3, s = {}) {
2999
- return new n3(t, e, this.root, this.roots, this.nocase, this.childrenCache(), s);
3000
- }
3001
- };
3002
- var It = class {
3003
- root;
3004
- rootPath;
3005
- roots;
3006
- cwd;
3007
- #t;
3008
- #s;
3009
- #n;
3010
- nocase;
3011
- #r;
3012
- constructor(t = process.cwd(), e, s, { nocase: i2, childrenCacheSize: r = 16 * 1024, fs: o = wt } = {}) {
3013
- this.#r = Ue(o), (t instanceof URL || t.startsWith("file://")) && (t = gi(t));
3014
- let h = e.resolve(t);
3015
- this.roots = /* @__PURE__ */ Object.create(null), this.rootPath = this.parseRootPath(h), this.#t = new Wt(), this.#s = new Wt(), this.#n = new ne(r);
3016
- let a2 = h.substring(this.rootPath.length).split(s);
3017
- if (a2.length === 1 && !a2[0] && a2.pop(), i2 === void 0) throw new TypeError("must provide nocase setting to PathScurryBase ctor");
3018
- this.nocase = i2, this.root = this.newRoot(this.#r), this.roots[this.rootPath] = this.root;
3019
- let l = this.root, u2 = a2.length - 1, c = e.sep, d4 = this.rootPath, f = false;
3020
- for (let m2 of a2) {
3021
- let p = u2--;
3022
- l = l.child(m2, { relative: new Array(p).fill("..").join(c), relativePosix: new Array(p).fill("..").join("/"), fullpath: d4 += (f ? "" : c) + m2 }), f = true;
3023
- }
3024
- this.cwd = l;
3025
- }
3026
- depth(t = this.cwd) {
3027
- return typeof t == "string" && (t = this.cwd.resolve(t)), t.depth();
3028
- }
3029
- childrenCache() {
3030
- return this.#n;
3031
- }
3032
- resolve(...t) {
3033
- let e = "";
3034
- for (let r = t.length - 1; r >= 0; r--) {
3035
- let o = t[r];
3036
- if (!(!o || o === ".") && (e = e ? `${o}/${e}` : o, this.isAbsolute(o))) break;
3037
- }
3038
- let s = this.#t.get(e);
3039
- if (s !== void 0) return s;
3040
- let i2 = this.cwd.resolve(e).fullpath();
3041
- return this.#t.set(e, i2), i2;
3042
- }
3043
- resolvePosix(...t) {
3044
- let e = "";
3045
- for (let r = t.length - 1; r >= 0; r--) {
3046
- let o = t[r];
3047
- if (!(!o || o === ".") && (e = e ? `${o}/${e}` : o, this.isAbsolute(o))) break;
3048
- }
3049
- let s = this.#s.get(e);
3050
- if (s !== void 0) return s;
3051
- let i2 = this.cwd.resolve(e).fullpathPosix();
3052
- return this.#s.set(e, i2), i2;
3053
- }
3054
- relative(t = this.cwd) {
3055
- return typeof t == "string" && (t = this.cwd.resolve(t)), t.relative();
3056
- }
3057
- relativePosix(t = this.cwd) {
3058
- return typeof t == "string" && (t = this.cwd.resolve(t)), t.relativePosix();
3059
- }
3060
- basename(t = this.cwd) {
3061
- return typeof t == "string" && (t = this.cwd.resolve(t)), t.name;
3062
- }
3063
- dirname(t = this.cwd) {
3064
- return typeof t == "string" && (t = this.cwd.resolve(t)), (t.parent || t).fullpath();
3065
- }
3066
- async readdir(t = this.cwd, e = { withFileTypes: true }) {
3067
- typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R3 || (e = t, t = this.cwd);
3068
- let { withFileTypes: s } = e;
3069
- if (t.canReaddir()) {
3070
- let i2 = await t.readdir();
3071
- return s ? i2 : i2.map((r) => r.name);
3072
- } else return [];
3073
- }
3074
- readdirSync(t = this.cwd, e = { withFileTypes: true }) {
3075
- typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R3 || (e = t, t = this.cwd);
3076
- let { withFileTypes: s = true } = e;
3077
- return t.canReaddir() ? s ? t.readdirSync() : t.readdirSync().map((i2) => i2.name) : [];
3078
- }
3079
- async lstat(t = this.cwd) {
3080
- return typeof t == "string" && (t = this.cwd.resolve(t)), t.lstat();
3081
- }
3082
- lstatSync(t = this.cwd) {
3083
- return typeof t == "string" && (t = this.cwd.resolve(t)), t.lstatSync();
3084
- }
3085
- async readlink(t = this.cwd, { withFileTypes: e } = { withFileTypes: false }) {
3086
- typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R3 || (e = t.withFileTypes, t = this.cwd);
3087
- let s = await t.readlink();
3088
- return e ? s : s?.fullpath();
3089
- }
3090
- readlinkSync(t = this.cwd, { withFileTypes: e } = { withFileTypes: false }) {
3091
- typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R3 || (e = t.withFileTypes, t = this.cwd);
3092
- let s = t.readlinkSync();
3093
- return e ? s : s?.fullpath();
3094
- }
3095
- async realpath(t = this.cwd, { withFileTypes: e } = { withFileTypes: false }) {
3096
- typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R3 || (e = t.withFileTypes, t = this.cwd);
3097
- let s = await t.realpath();
3098
- return e ? s : s?.fullpath();
3099
- }
3100
- realpathSync(t = this.cwd, { withFileTypes: e } = { withFileTypes: false }) {
3101
- typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R3 || (e = t.withFileTypes, t = this.cwd);
3102
- let s = t.realpathSync();
3103
- return e ? s : s?.fullpath();
3104
- }
3105
- async walk(t = this.cwd, e = {}) {
3106
- typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R3 || (e = t, t = this.cwd);
3107
- let { withFileTypes: s = true, follow: i2 = false, filter: r, walkFilter: o } = e, h = [];
3108
- (!r || r(t)) && h.push(s ? t : t.fullpath());
3109
- let a2 = /* @__PURE__ */ new Set(), l = (c, d4) => {
3110
- a2.add(c), c.readdirCB((f, m2) => {
3111
- if (f) return d4(f);
3112
- let p = m2.length;
3113
- if (!p) return d4();
3114
- let w2 = () => {
3115
- --p === 0 && d4();
3116
- };
3117
- for (let g2 of m2) (!r || r(g2)) && h.push(s ? g2 : g2.fullpath()), i2 && g2.isSymbolicLink() ? g2.realpath().then((S3) => S3?.isUnknown() ? S3.lstat() : S3).then((S3) => S3?.shouldWalk(a2, o) ? l(S3, w2) : w2()) : g2.shouldWalk(a2, o) ? l(g2, w2) : w2();
3118
- }, true);
3119
- }, u2 = t;
3120
- return new Promise((c, d4) => {
3121
- l(u2, (f) => {
3122
- if (f) return d4(f);
3123
- c(h);
3124
- });
3125
- });
3126
- }
3127
- walkSync(t = this.cwd, e = {}) {
3128
- typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R3 || (e = t, t = this.cwd);
3129
- let { withFileTypes: s = true, follow: i2 = false, filter: r, walkFilter: o } = e, h = [];
3130
- (!r || r(t)) && h.push(s ? t : t.fullpath());
3131
- let a2 = /* @__PURE__ */ new Set([t]);
3132
- for (let l of a2) {
3133
- let u2 = l.readdirSync();
3134
- for (let c of u2) {
3135
- (!r || r(c)) && h.push(s ? c : c.fullpath());
3136
- let d4 = c;
3137
- if (c.isSymbolicLink()) {
3138
- if (!(i2 && (d4 = c.realpathSync()))) continue;
3139
- d4.isUnknown() && d4.lstatSync();
3140
- }
3141
- d4.shouldWalk(a2, o) && a2.add(d4);
3142
- }
3143
- }
3144
- return h;
3145
- }
3146
- [Symbol.asyncIterator]() {
3147
- return this.iterate();
3148
- }
3149
- iterate(t = this.cwd, e = {}) {
3150
- return typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R3 || (e = t, t = this.cwd), this.stream(t, e)[Symbol.asyncIterator]();
3151
- }
3152
- [Symbol.iterator]() {
3153
- return this.iterateSync();
3154
- }
3155
- *iterateSync(t = this.cwd, e = {}) {
3156
- typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R3 || (e = t, t = this.cwd);
3157
- let { withFileTypes: s = true, follow: i2 = false, filter: r, walkFilter: o } = e;
3158
- (!r || r(t)) && (yield s ? t : t.fullpath());
3159
- let h = /* @__PURE__ */ new Set([t]);
3160
- for (let a2 of h) {
3161
- let l = a2.readdirSync();
3162
- for (let u2 of l) {
3163
- (!r || r(u2)) && (yield s ? u2 : u2.fullpath());
3164
- let c = u2;
3165
- if (u2.isSymbolicLink()) {
3166
- if (!(i2 && (c = u2.realpathSync()))) continue;
3167
- c.isUnknown() && c.lstatSync();
3168
- }
3169
- c.shouldWalk(h, o) && h.add(c);
3170
- }
3171
- }
3172
- }
3173
- stream(t = this.cwd, e = {}) {
3174
- typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R3 || (e = t, t = this.cwd);
3175
- let { withFileTypes: s = true, follow: i2 = false, filter: r, walkFilter: o } = e, h = new V({ objectMode: true });
3176
- (!r || r(t)) && h.write(s ? t : t.fullpath());
3177
- let a2 = /* @__PURE__ */ new Set(), l = [t], u2 = 0, c = () => {
3178
- let d4 = false;
3179
- for (; !d4; ) {
3180
- let f = l.shift();
3181
- if (!f) {
3182
- u2 === 0 && h.end();
3183
- return;
3184
- }
3185
- u2++, a2.add(f);
3186
- let m2 = (w2, g2, S3 = false) => {
3187
- if (w2) return h.emit("error", w2);
3188
- if (i2 && !S3) {
3189
- let E = [];
3190
- for (let y2 of g2) y2.isSymbolicLink() && E.push(y2.realpath().then((b) => b?.isUnknown() ? b.lstat() : b));
3191
- if (E.length) {
3192
- Promise.all(E).then(() => m2(null, g2, true));
3193
- return;
3194
- }
3195
- }
3196
- for (let E of g2) E && (!r || r(E)) && (h.write(s ? E : E.fullpath()) || (d4 = true));
3197
- u2--;
3198
- for (let E of g2) {
3199
- let y2 = E.realpathCached() || E;
3200
- y2.shouldWalk(a2, o) && l.push(y2);
3201
- }
3202
- d4 && !h.flowing ? h.once("drain", c) : p || c();
3203
- }, p = true;
3204
- f.readdirCB(m2, true), p = false;
3205
- }
3206
- };
3207
- return c(), h;
3208
- }
3209
- streamSync(t = this.cwd, e = {}) {
3210
- typeof t == "string" ? t = this.cwd.resolve(t) : t instanceof R3 || (e = t, t = this.cwd);
3211
- let { withFileTypes: s = true, follow: i2 = false, filter: r, walkFilter: o } = e, h = new V({ objectMode: true }), a2 = /* @__PURE__ */ new Set();
3212
- (!r || r(t)) && h.write(s ? t : t.fullpath());
3213
- let l = [t], u2 = 0, c = () => {
3214
- let d4 = false;
3215
- for (; !d4; ) {
3216
- let f = l.shift();
3217
- if (!f) {
3218
- u2 === 0 && h.end();
3219
- return;
3220
- }
3221
- u2++, a2.add(f);
3222
- let m2 = f.readdirSync();
3223
- for (let p of m2) (!r || r(p)) && (h.write(s ? p : p.fullpath()) || (d4 = true));
3224
- u2--;
3225
- for (let p of m2) {
3226
- let w2 = p;
3227
- if (p.isSymbolicLink()) {
3228
- if (!(i2 && (w2 = p.realpathSync()))) continue;
3229
- w2.isUnknown() && w2.lstatSync();
3230
- }
3231
- w2.shouldWalk(a2, o) && l.push(w2);
3232
- }
3233
- }
3234
- d4 && !h.flowing && h.once("drain", c);
3235
- };
3236
- return c(), h;
3237
- }
3238
- chdir(t = this.cwd) {
3239
- let e = this.cwd;
3240
- this.cwd = typeof t == "string" ? this.cwd.resolve(t) : t, this.cwd[Ye](e);
3241
- }
3242
- };
3243
- var it = class extends It {
3244
- sep = "\\";
3245
- constructor(t = process.cwd(), e = {}) {
3246
- let { nocase: s = true } = e;
3247
- super(t, re, "\\", { ...e, nocase: s }), this.nocase = s;
3248
- for (let i2 = this.cwd; i2; i2 = i2.parent) i2.nocase = this.nocase;
3249
- }
3250
- parseRootPath(t) {
3251
- return re.parse(t).root.toUpperCase();
3252
- }
3253
- newRoot(t) {
3254
- return new Pt(this.rootPath, U3, void 0, this.roots, this.nocase, this.childrenCache(), { fs: t });
3255
- }
3256
- isAbsolute(t) {
3257
- return t.startsWith("/") || t.startsWith("\\") || /^[a-z]:(\/|\\)/i.test(t);
3258
- }
3259
- };
3260
- var rt = class extends It {
3261
- sep = "/";
3262
- constructor(t = process.cwd(), e = {}) {
3263
- let { nocase: s = false } = e;
3264
- super(t, mi, "/", { ...e, nocase: s }), this.nocase = s;
3265
- }
3266
- parseRootPath(t) {
3267
- return "/";
3268
- }
3269
- newRoot(t) {
3270
- return new jt(this.rootPath, U3, void 0, this.roots, this.nocase, this.childrenCache(), { fs: t });
3271
- }
3272
- isAbsolute(t) {
3273
- return t.startsWith("/");
3274
- }
3275
- };
3276
- var St = class extends rt {
3277
- constructor(t = process.cwd(), e = {}) {
3278
- let { nocase: s = true } = e;
3279
- super(t, { ...e, nocase: s });
3280
- }
3281
- };
3282
- var Cr = process.platform === "win32" ? Pt : jt;
3283
- var Xe = process.platform === "win32" ? it : process.platform === "darwin" ? St : rt;
3284
- var Di = (n7) => n7.length >= 1;
3285
- var Mi = (n7) => n7.length >= 1;
3286
- var Ni = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom");
3287
- var nt = class n4 {
3288
- #t;
3289
- #s;
3290
- #n;
3291
- length;
3292
- #r;
3293
- #o;
3294
- #S;
3295
- #w;
3296
- #c;
3297
- #h;
3298
- #u = true;
3299
- constructor(t, e, s, i2) {
3300
- if (!Di(t)) throw new TypeError("empty pattern list");
3301
- if (!Mi(e)) throw new TypeError("empty glob list");
3302
- if (e.length !== t.length) throw new TypeError("mismatched pattern list and glob list lengths");
3303
- if (this.length = t.length, s < 0 || s >= this.length) throw new TypeError("index out of range");
3304
- if (this.#t = t, this.#s = e, this.#n = s, this.#r = i2, this.#n === 0) {
3305
- if (this.isUNC()) {
3306
- let [r, o, h, a2, ...l] = this.#t, [u2, c, d4, f, ...m2] = this.#s;
3307
- l[0] === "" && (l.shift(), m2.shift());
3308
- let p = [r, o, h, a2, ""].join("/"), w2 = [u2, c, d4, f, ""].join("/");
3309
- this.#t = [p, ...l], this.#s = [w2, ...m2], this.length = this.#t.length;
3310
- } else if (this.isDrive() || this.isAbsolute()) {
3311
- let [r, ...o] = this.#t, [h, ...a2] = this.#s;
3312
- o[0] === "" && (o.shift(), a2.shift());
3313
- let l = r + "/", u2 = h + "/";
3314
- this.#t = [l, ...o], this.#s = [u2, ...a2], this.length = this.#t.length;
3315
- }
3316
- }
3317
- }
3318
- [Ni]() {
3319
- return "Pattern <" + this.#s.slice(this.#n).join("/") + ">";
3320
- }
3321
- pattern() {
3322
- return this.#t[this.#n];
3323
- }
3324
- isString() {
3325
- return typeof this.#t[this.#n] == "string";
3326
- }
3327
- isGlobstar() {
3328
- return this.#t[this.#n] === A2;
3329
- }
3330
- isRegExp() {
3331
- return this.#t[this.#n] instanceof RegExp;
3332
- }
3333
- globString() {
3334
- 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("/"));
3335
- }
3336
- hasMore() {
3337
- return this.length > this.#n + 1;
3338
- }
3339
- rest() {
3340
- return this.#o !== void 0 ? this.#o : this.hasMore() ? (this.#o = new n4(this.#t, this.#s, this.#n + 1, this.#r), this.#o.#h = this.#h, this.#o.#c = this.#c, this.#o.#w = this.#w, this.#o) : this.#o = null;
3341
- }
3342
- isUNC() {
3343
- let t = this.#t;
3344
- 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];
3345
- }
3346
- isDrive() {
3347
- let t = this.#t;
3348
- 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]);
3349
- }
3350
- isAbsolute() {
3351
- let t = this.#t;
3352
- return this.#h !== void 0 ? this.#h : this.#h = t[0] === "" && t.length > 1 || this.isDrive() || this.isUNC();
3353
- }
3354
- root() {
3355
- let t = this.#t[0];
3356
- return typeof t == "string" && this.isAbsolute() && this.#n === 0 ? t : "";
3357
- }
3358
- checkFollowGlobstar() {
3359
- return !(this.#n === 0 || !this.isGlobstar() || !this.#u);
3360
- }
3361
- markFollowGlobstar() {
3362
- return this.#n === 0 || !this.isGlobstar() || !this.#u ? false : (this.#u = false, true);
3363
- }
3364
- };
3365
- var _i = typeof process == "object" && process && typeof process.platform == "string" ? process.platform : "linux";
3366
- var ot = class {
3367
- relative;
3368
- relativeChildren;
3369
- absolute;
3370
- absoluteChildren;
3371
- platform;
3372
- mmopts;
3373
- constructor(t, { nobrace: e, nocase: s, noext: i2, noglobstar: r, platform: o = _i }) {
3374
- this.relative = [], this.absolute = [], this.relativeChildren = [], this.absoluteChildren = [], this.platform = o, this.mmopts = { dot: true, nobrace: e, nocase: s, noext: i2, noglobstar: r, optimizationLevel: 2, platform: o, nocomment: true, nonegate: true };
3375
- for (let h of t) this.add(h);
3376
- }
3377
- add(t) {
3378
- let e = new D(t, this.mmopts);
3379
- for (let s = 0; s < e.set.length; s++) {
3380
- let i2 = e.set[s], r = e.globParts[s];
3381
- if (!i2 || !r) throw new Error("invalid pattern object");
3382
- for (; i2[0] === "." && r[0] === "."; ) i2.shift(), r.shift();
3383
- let o = new nt(i2, r, 0, this.platform), h = new D(o.globString(), this.mmopts), a2 = r[r.length - 1] === "**", l = o.isAbsolute();
3384
- l ? this.absolute.push(h) : this.relative.push(h), a2 && (l ? this.absoluteChildren.push(h) : this.relativeChildren.push(h));
3385
- }
3386
- }
3387
- ignored(t) {
3388
- let e = t.fullpath(), s = `${e}/`, i2 = t.relative() || ".", r = `${i2}/`;
3389
- for (let o of this.relative) if (o.match(i2) || o.match(r)) return true;
3390
- for (let o of this.absolute) if (o.match(e) || o.match(s)) return true;
3391
- return false;
3392
- }
3393
- childrenIgnored(t) {
3394
- let e = t.fullpath() + "/", s = (t.relative() || ".") + "/";
3395
- for (let i2 of this.relativeChildren) if (i2.match(s)) return true;
3396
- for (let i2 of this.absoluteChildren) if (i2.match(e)) return true;
3397
- return false;
3398
- }
3399
- };
3400
- var oe = class n5 {
3401
- store;
3402
- constructor(t = /* @__PURE__ */ new Map()) {
3403
- this.store = t;
3404
- }
3405
- copy() {
3406
- return new n5(new Map(this.store));
3407
- }
3408
- hasWalked(t, e) {
3409
- return this.store.get(t.fullpath())?.has(e.globString());
3410
- }
3411
- storeWalked(t, e) {
3412
- let s = t.fullpath(), i2 = this.store.get(s);
3413
- i2 ? i2.add(e.globString()) : this.store.set(s, /* @__PURE__ */ new Set([e.globString()]));
3414
- }
3415
- };
3416
- var he = class {
3417
- store = /* @__PURE__ */ new Map();
3418
- add(t, e, s) {
3419
- let i2 = (e ? 2 : 0) | (s ? 1 : 0), r = this.store.get(t);
3420
- this.store.set(t, r === void 0 ? i2 : i2 & r);
3421
- }
3422
- entries() {
3423
- return [...this.store.entries()].map(([t, e]) => [t, !!(e & 2), !!(e & 1)]);
3424
- }
3425
- };
3426
- var ae = class {
3427
- store = /* @__PURE__ */ new Map();
3428
- add(t, e) {
3429
- if (!t.canReaddir()) return;
3430
- let s = this.store.get(t);
3431
- s ? s.find((i2) => i2.globString() === e.globString()) || s.push(e) : this.store.set(t, [e]);
3432
- }
3433
- get(t) {
3434
- let e = this.store.get(t);
3435
- if (!e) throw new Error("attempting to walk unknown path");
3436
- return e;
3437
- }
3438
- entries() {
3439
- return this.keys().map((t) => [t, this.store.get(t)]);
3440
- }
3441
- keys() {
3442
- return [...this.store.keys()].filter((t) => t.canReaddir());
3443
- }
3444
- };
3445
- var Et = class n6 {
3446
- hasWalkedCache;
3447
- matches = new he();
3448
- subwalks = new ae();
3449
- patterns;
3450
- follow;
3451
- dot;
3452
- opts;
3453
- constructor(t, e) {
3454
- this.opts = t, this.follow = !!t.follow, this.dot = !!t.dot, this.hasWalkedCache = e ? e.copy() : new oe();
3455
- }
3456
- processPatterns(t, e) {
3457
- this.patterns = e;
3458
- let s = e.map((i2) => [t, i2]);
3459
- for (let [i2, r] of s) {
3460
- this.hasWalkedCache.storeWalked(i2, r);
3461
- let o = r.root(), h = r.isAbsolute() && this.opts.absolute !== false;
3462
- if (o) {
3463
- i2 = i2.resolve(o === "/" && this.opts.root !== void 0 ? this.opts.root : o);
3464
- let c = r.rest();
3465
- if (c) r = c;
3466
- else {
3467
- this.matches.add(i2, true, false);
3468
- continue;
3469
- }
3470
- }
3471
- if (i2.isENOENT()) continue;
3472
- let a2, l, u2 = false;
3473
- for (; typeof (a2 = r.pattern()) == "string" && (l = r.rest()); ) i2 = i2.resolve(a2), r = l, u2 = true;
3474
- if (a2 = r.pattern(), l = r.rest(), u2) {
3475
- if (this.hasWalkedCache.hasWalked(i2, r)) continue;
3476
- this.hasWalkedCache.storeWalked(i2, r);
3477
- }
3478
- if (typeof a2 == "string") {
3479
- let c = a2 === ".." || a2 === "" || a2 === ".";
3480
- this.matches.add(i2.resolve(a2), h, c);
3481
- continue;
3482
- } else if (a2 === A2) {
3483
- (!i2.isSymbolicLink() || this.follow || r.checkFollowGlobstar()) && this.subwalks.add(i2, r);
3484
- let c = l?.pattern(), d4 = l?.rest();
3485
- if (!l || (c === "" || c === ".") && !d4) this.matches.add(i2, h, c === "" || c === ".");
3486
- else if (c === "..") {
3487
- let f = i2.parent || i2;
3488
- d4 ? this.hasWalkedCache.hasWalked(f, d4) || this.subwalks.add(f, d4) : this.matches.add(f, h, true);
3489
- }
3490
- } else a2 instanceof RegExp && this.subwalks.add(i2, r);
3491
- }
3492
- return this;
3493
- }
3494
- subwalkTargets() {
3495
- return this.subwalks.keys();
3496
- }
3497
- child() {
3498
- return new n6(this.opts, this.hasWalkedCache);
3499
- }
3500
- filterEntries(t, e) {
3501
- let s = this.subwalks.get(t), i2 = this.child();
3502
- for (let r of e) for (let o of s) {
3503
- let h = o.isAbsolute(), a2 = o.pattern(), l = o.rest();
3504
- a2 === A2 ? i2.testGlobstar(r, o, l, h) : a2 instanceof RegExp ? i2.testRegExp(r, a2, l, h) : i2.testString(r, a2, l, h);
3505
- }
3506
- return i2;
3507
- }
3508
- testGlobstar(t, e, s, i2) {
3509
- if ((this.dot || !t.name.startsWith(".")) && (e.hasMore() || this.matches.add(t, i2, 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) {
3510
- let r = s.pattern();
3511
- if (typeof r == "string" && r !== ".." && r !== "" && r !== ".") this.testString(t, r, s.rest(), i2);
3512
- else if (r === "..") {
3513
- let o = t.parent || t;
3514
- this.subwalks.add(o, s);
3515
- } else r instanceof RegExp && this.testRegExp(t, r, s.rest(), i2);
3516
- }
3517
- }
3518
- testRegExp(t, e, s, i2) {
3519
- e.test(t.name) && (s ? this.subwalks.add(t, s) : this.matches.add(t, i2, false));
3520
- }
3521
- testString(t, e, s, i2) {
3522
- t.isNamed(e) && (s ? this.subwalks.add(t, s) : this.matches.add(t, i2, false));
3523
- }
3524
- };
3525
- var Li = (n7, t) => typeof n7 == "string" ? new ot([n7], t) : Array.isArray(n7) ? new ot(n7, t) : n7;
3526
- var zt = class {
3527
- path;
3528
- patterns;
3529
- opts;
3530
- seen = /* @__PURE__ */ new Set();
3531
- paused = false;
3532
- aborted = false;
3533
- #t = [];
3534
- #s;
3535
- #n;
3536
- signal;
3537
- maxDepth;
3538
- includeChildMatches;
3539
- constructor(t, e, s) {
3540
- 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 = Li(s.ignore ?? [], s), !this.includeChildMatches && typeof this.#s.add != "function")) {
3541
- let i2 = "cannot ignore child matches, ignore lacks add() method.";
3542
- throw new Error(i2);
3543
- }
3544
- this.maxDepth = s.maxDepth || 1 / 0, s.signal && (this.signal = s.signal, this.signal.addEventListener("abort", () => {
3545
- this.#t.length = 0;
3546
- }));
3547
- }
3548
- #r(t) {
3549
- return this.seen.has(t) || !!this.#s?.ignored?.(t);
3550
- }
3551
- #o(t) {
3552
- return !!this.#s?.childrenIgnored?.(t);
3553
- }
3554
- pause() {
3555
- this.paused = true;
3556
- }
3557
- resume() {
3558
- if (this.signal?.aborted) return;
3559
- this.paused = false;
3560
- let t;
3561
- for (; !this.paused && (t = this.#t.shift()); ) t();
3562
- }
3563
- onResume(t) {
3564
- this.signal?.aborted || (this.paused ? this.#t.push(t) : t());
3565
- }
3566
- async matchCheck(t, e) {
3567
- if (e && this.opts.nodir) return;
3568
- let s;
3569
- if (this.opts.realpath) {
3570
- if (s = t.realpathCached() || await t.realpath(), !s) return;
3571
- t = s;
3572
- }
3573
- let r = t.isUnknown() || this.opts.stat ? await t.lstat() : t;
3574
- if (this.opts.follow && this.opts.nodir && r?.isSymbolicLink()) {
3575
- let o = await r.realpath();
3576
- o && (o.isUnknown() || this.opts.stat) && await o.lstat();
3577
- }
3578
- return this.matchCheckTest(r, e);
3579
- }
3580
- matchCheckTest(t, e) {
3581
- 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;
3582
- }
3583
- matchCheckSync(t, e) {
3584
- if (e && this.opts.nodir) return;
3585
- let s;
3586
- if (this.opts.realpath) {
3587
- if (s = t.realpathCached() || t.realpathSync(), !s) return;
3588
- t = s;
3589
- }
3590
- let r = t.isUnknown() || this.opts.stat ? t.lstatSync() : t;
3591
- if (this.opts.follow && this.opts.nodir && r?.isSymbolicLink()) {
3592
- let o = r.realpathSync();
3593
- o && (o?.isUnknown() || this.opts.stat) && o.lstatSync();
3594
- }
3595
- return this.matchCheckTest(r, e);
3596
- }
3597
- matchFinish(t, e) {
3598
- if (this.#r(t)) return;
3599
- if (!this.includeChildMatches && this.#s?.add) {
3600
- let r = `${t.relativePosix()}/**`;
3601
- this.#s.add(r);
3602
- }
3603
- let s = this.opts.absolute === void 0 ? e : this.opts.absolute;
3604
- this.seen.add(t);
3605
- let i2 = this.opts.mark && t.isDirectory() ? this.#n : "";
3606
- if (this.opts.withFileTypes) this.matchEmit(t);
3607
- else if (s) {
3608
- let r = this.opts.posix ? t.fullpathPosix() : t.fullpath();
3609
- this.matchEmit(r + i2);
3610
- } else {
3611
- let r = this.opts.posix ? t.relativePosix() : t.relative(), o = this.opts.dotRelative && !r.startsWith(".." + this.#n) ? "." + this.#n : "";
3612
- this.matchEmit(r ? o + r + i2 : "." + i2);
3613
- }
3614
- }
3615
- async match(t, e, s) {
3616
- let i2 = await this.matchCheck(t, s);
3617
- i2 && this.matchFinish(i2, e);
3618
- }
3619
- matchSync(t, e, s) {
3620
- let i2 = this.matchCheckSync(t, s);
3621
- i2 && this.matchFinish(i2, e);
3622
- }
3623
- walkCB(t, e, s) {
3624
- this.signal?.aborted && s(), this.walkCB2(t, e, new Et(this.opts), s);
3625
- }
3626
- walkCB2(t, e, s, i2) {
3627
- if (this.#o(t)) return i2();
3628
- if (this.signal?.aborted && i2(), this.paused) {
3629
- this.onResume(() => this.walkCB2(t, e, s, i2));
3630
- return;
3631
- }
3632
- s.processPatterns(t, e);
3633
- let r = 1, o = () => {
3634
- --r === 0 && i2();
3635
- };
3636
- for (let [h, a2, l] of s.matches.entries()) this.#r(h) || (r++, this.match(h, a2, l).then(() => o()));
3637
- for (let h of s.subwalkTargets()) {
3638
- if (this.maxDepth !== 1 / 0 && h.depth() >= this.maxDepth) continue;
3639
- r++;
3640
- let a2 = h.readdirCached();
3641
- h.calledReaddir() ? this.walkCB3(h, a2, s, o) : h.readdirCB((l, u2) => this.walkCB3(h, u2, s, o), true);
3642
- }
3643
- o();
3644
- }
3645
- walkCB3(t, e, s, i2) {
3646
- s = s.filterEntries(t, e);
3647
- let r = 1, o = () => {
3648
- --r === 0 && i2();
3649
- };
3650
- for (let [h, a2, l] of s.matches.entries()) this.#r(h) || (r++, this.match(h, a2, l).then(() => o()));
3651
- for (let [h, a2] of s.subwalks.entries()) r++, this.walkCB2(h, a2, s.child(), o);
3652
- o();
3653
- }
3654
- walkCBSync(t, e, s) {
3655
- this.signal?.aborted && s(), this.walkCB2Sync(t, e, new Et(this.opts), s);
3656
- }
3657
- walkCB2Sync(t, e, s, i2) {
3658
- if (this.#o(t)) return i2();
3659
- if (this.signal?.aborted && i2(), this.paused) {
3660
- this.onResume(() => this.walkCB2Sync(t, e, s, i2));
3661
- return;
3662
- }
3663
- s.processPatterns(t, e);
3664
- let r = 1, o = () => {
3665
- --r === 0 && i2();
3666
- };
3667
- for (let [h, a2, l] of s.matches.entries()) this.#r(h) || this.matchSync(h, a2, l);
3668
- for (let h of s.subwalkTargets()) {
3669
- if (this.maxDepth !== 1 / 0 && h.depth() >= this.maxDepth) continue;
3670
- r++;
3671
- let a2 = h.readdirSync();
3672
- this.walkCB3Sync(h, a2, s, o);
3673
- }
3674
- o();
3675
- }
3676
- walkCB3Sync(t, e, s, i2) {
3677
- s = s.filterEntries(t, e);
3678
- let r = 1, o = () => {
3679
- --r === 0 && i2();
3680
- };
3681
- for (let [h, a2, l] of s.matches.entries()) this.#r(h) || this.matchSync(h, a2, l);
3682
- for (let [h, a2] of s.subwalks.entries()) r++, this.walkCB2Sync(h, a2, s.child(), o);
3683
- o();
3684
- }
3685
- };
3686
- var xt = class extends zt {
3687
- matches = /* @__PURE__ */ new Set();
3688
- constructor(t, e, s) {
3689
- super(t, e, s);
3690
- }
3691
- matchEmit(t) {
3692
- this.matches.add(t);
3693
- }
3694
- async walk() {
3695
- if (this.signal?.aborted) throw this.signal.reason;
3696
- return this.path.isUnknown() && await this.path.lstat(), await new Promise((t, e) => {
3697
- this.walkCB(this.path, this.patterns, () => {
3698
- this.signal?.aborted ? e(this.signal.reason) : t(this.matches);
3699
- });
3700
- }), this.matches;
3701
- }
3702
- walkSync() {
3703
- if (this.signal?.aborted) throw this.signal.reason;
3704
- return this.path.isUnknown() && this.path.lstatSync(), this.walkCBSync(this.path, this.patterns, () => {
3705
- if (this.signal?.aborted) throw this.signal.reason;
3706
- }), this.matches;
3707
- }
3708
- };
3709
- var vt = class extends zt {
3710
- results;
3711
- constructor(t, e, s) {
3712
- super(t, e, s), this.results = new V({ signal: this.signal, objectMode: true }), this.results.on("drain", () => this.resume()), this.results.on("resume", () => this.resume());
3713
- }
3714
- matchEmit(t) {
3715
- this.results.write(t), this.results.flowing || this.pause();
3716
- }
3717
- stream() {
3718
- let t = this.path;
3719
- return t.isUnknown() ? t.lstat().then(() => {
3720
- this.walkCB(t, this.patterns, () => this.results.end());
3721
- }) : this.walkCB(t, this.patterns, () => this.results.end()), this.results;
3722
- }
3723
- streamSync() {
3724
- return this.path.isUnknown() && this.path.lstatSync(), this.walkCBSync(this.path, this.patterns, () => this.results.end()), this.results;
3725
- }
3726
- };
3727
- var Pi = typeof process == "object" && process && typeof process.platform == "string" ? process.platform : "linux";
3728
- var I3 = class {
3729
- absolute;
3730
- cwd;
3731
- root;
3732
- dot;
3733
- dotRelative;
3734
- follow;
3735
- ignore;
3736
- magicalBraces;
3737
- mark;
3738
- matchBase;
3739
- maxDepth;
3740
- nobrace;
3741
- nocase;
3742
- nodir;
3743
- noext;
3744
- noglobstar;
3745
- pattern;
3746
- platform;
3747
- realpath;
3748
- scurry;
3749
- stat;
3750
- signal;
3751
- windowsPathsNoEscape;
3752
- withFileTypes;
3753
- includeChildMatches;
3754
- opts;
3755
- patterns;
3756
- constructor(t, e) {
3757
- if (!e) throw new TypeError("glob options required");
3758
- 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 = Wi(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");
3759
- if (typeof t == "string" && (t = [t]), this.windowsPathsNoEscape = !!e.windowsPathsNoEscape || e.allowWindowsEscape === false, this.windowsPathsNoEscape && (t = t.map((a2) => a2.replace(/\\/g, "/"))), this.matchBase) {
3760
- if (e.noglobstar) throw new TypeError("base matching requires globstar");
3761
- t = t.map((a2) => a2.includes("/") ? a2 : `./**/${a2}`);
3762
- }
3763
- if (this.pattern = t, this.platform = e.platform || Pi, this.opts = { ...e, platform: this.platform }, e.scurry) {
3764
- if (this.scurry = e.scurry, e.nocase !== void 0 && e.nocase !== e.scurry.nocase) throw new Error("nocase option contradicts provided scurry option");
3765
- } else {
3766
- let a2 = e.platform === "win32" ? it : e.platform === "darwin" ? St : e.platform ? rt : Xe;
3767
- this.scurry = new a2(this.cwd, { nocase: e.nocase, fs: e.fs });
3768
- }
3769
- this.nocase = this.scurry.nocase;
3770
- let s = this.platform === "darwin" || this.platform === "win32", i2 = { 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((a2) => new D(a2, i2)), [o, h] = r.reduce((a2, l) => (a2[0].push(...l.set), a2[1].push(...l.globParts), a2), [[], []]);
3771
- this.patterns = o.map((a2, l) => {
3772
- let u2 = h[l];
3773
- if (!u2) throw new Error("invalid pattern object");
3774
- return new nt(a2, u2, 0, this.platform);
3775
- });
3776
- }
3777
- async walk() {
3778
- return [...await new xt(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()];
3779
- }
3780
- walkSync() {
3781
- return [...new xt(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()];
3782
- }
3783
- stream() {
3784
- return new vt(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();
3785
- }
3786
- streamSync() {
3787
- return new vt(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();
3788
- }
3789
- iterateSync() {
3790
- return this.streamSync()[Symbol.iterator]();
3791
- }
3792
- [Symbol.iterator]() {
3793
- return this.iterateSync();
3794
- }
3795
- iterate() {
3796
- return this.stream()[Symbol.asyncIterator]();
3797
- }
3798
- [Symbol.asyncIterator]() {
3799
- return this.iterate();
3800
- }
3801
- };
3802
- var le = (n7, t = {}) => {
3803
- Array.isArray(n7) || (n7 = [n7]);
3804
- for (let e of n7) if (new D(e, t).hasMagic()) return true;
3805
- return false;
3806
- };
3807
- function Bt(n7, t = {}) {
3808
- return new I3(n7, t).streamSync();
3809
- }
3810
- function Qe(n7, t = {}) {
3811
- return new I3(n7, t).stream();
3812
- }
3813
- function ts(n7, t = {}) {
3814
- return new I3(n7, t).walkSync();
3815
- }
3816
- async function Je(n7, t = {}) {
3817
- return new I3(n7, t).walk();
3818
- }
3819
- function Ut(n7, t = {}) {
3820
- return new I3(n7, t).iterateSync();
3821
- }
3822
- function es(n7, t = {}) {
3823
- return new I3(n7, t).iterate();
3824
- }
3825
- var ji = Bt;
3826
- var Ii = Object.assign(Qe, { sync: Bt });
3827
- var zi = Ut;
3828
- var Bi = Object.assign(es, { sync: Ut });
3829
- var Ui = Object.assign(ts, { stream: Bt, iterate: Ut });
3830
- var Ze = Object.assign(Je, { glob: Je, globSync: ts, sync: Ui, globStream: Qe, stream: Ii, globStreamSync: Bt, streamSync: ji, globIterate: es, iterate: Bi, globIterateSync: Ut, iterateSync: zi, Glob: I3, hasMagic: le, escape: tt, unescape: W2 });
3831
- Ze.glob = Ze;
3832
-
3833
- // ../../node_modules/.vlt/~npm~rimraf@6.1.3/node_modules/rimraf/dist/esm/opt-arg.js
3834
- var typeOrUndef = (val, t) => typeof val === "undefined" || typeof val === t;
3835
- var isRimrafOptions = (o) => !!o && typeof o === "object" && typeOrUndef(o.preserveRoot, "boolean") && typeOrUndef(o.tmp, "string") && typeOrUndef(o.maxRetries, "number") && typeOrUndef(o.retryDelay, "number") && typeOrUndef(o.backoff, "number") && typeOrUndef(o.maxBackoff, "number") && (typeOrUndef(o.glob, "boolean") || o.glob && typeof o.glob === "object") && typeOrUndef(o.filter, "function");
3836
- var assertRimrafOptions = (o) => {
3837
- if (!isRimrafOptions(o)) {
3838
- throw new Error("invalid rimraf options");
3839
- }
3840
- };
3841
- var optArgT = (opt) => {
3842
- assertRimrafOptions(opt);
3843
- const { glob, ...options } = opt;
3844
- if (!glob) {
3845
- return options;
3846
- }
3847
- const globOpt = glob === true ? opt.signal ? { signal: opt.signal } : {} : opt.signal ? {
3848
- signal: opt.signal,
3849
- ...glob
3850
- } : glob;
3851
- return {
3852
- ...options,
3853
- glob: {
3854
- ...globOpt,
3855
- // always get absolute paths from glob, to ensure
3856
- // that we are referencing the correct thing.
3857
- absolute: true,
3858
- withFileTypes: false
3859
- }
3860
- };
3861
- };
3862
- var optArg = (opt = {}) => optArgT(opt);
3863
- var optArgSync = (opt = {}) => optArgT(opt);
3864
-
3865
- // ../../node_modules/.vlt/~npm~rimraf@6.1.3/node_modules/rimraf/dist/esm/path-arg.js
3866
- import { parse, resolve } from "node:path";
3867
- import { inspect } from "node:util";
3868
- var pathArg = (path, opt = {}) => {
3869
- const type = typeof path;
3870
- if (type !== "string") {
3871
- const ctor = path && type === "object" && path.constructor;
3872
- const received = ctor && ctor.name ? `an instance of ${ctor.name}` : type === "object" ? inspect(path) : `type ${type} ${path}`;
3873
- const msg = `The "path" argument must be of type string. Received ${received}`;
3874
- throw Object.assign(new TypeError(msg), {
3875
- path,
3876
- code: "ERR_INVALID_ARG_TYPE"
3877
- });
3878
- }
3879
- if (/\0/.test(path)) {
3880
- const msg = "path must be a string without null bytes";
3881
- throw Object.assign(new TypeError(msg), {
3882
- path,
3883
- code: "ERR_INVALID_ARG_VALUE"
3884
- });
3885
- }
3886
- path = resolve(path);
3887
- const { root } = parse(path);
3888
- if (path === root && opt.preserveRoot !== false) {
3889
- const msg = "refusing to remove root directory without preserveRoot:false";
3890
- throw Object.assign(new Error(msg), {
3891
- path,
3892
- code: "ERR_PRESERVE_ROOT"
3893
- });
3894
- }
3895
- if (process.platform === "win32") {
3896
- const badWinChars = /[*|"<>?:]/;
3897
- const { root: root2 } = parse(path);
3898
- if (badWinChars.test(path.substring(root2.length))) {
3899
- throw Object.assign(new Error("Illegal characters in path."), {
3900
- path,
3901
- code: "EINVAL"
3902
- });
3903
- }
3904
- }
3905
- return path;
3906
- };
3907
- var path_arg_default = pathArg;
3908
-
3909
- // ../../node_modules/.vlt/~npm~rimraf@6.1.3/node_modules/rimraf/dist/esm/fs.js
3910
- import { readdirSync as rdSync } from "node:fs";
3911
- import fsPromises from "node:fs/promises";
3912
- import { chmodSync, mkdirSync, renameSync, rmdirSync, rmSync, statSync, lstatSync, unlinkSync } from "node:fs";
3913
- var readdirSync = (path) => rdSync(path, { withFileTypes: true });
3914
- var promises = {
3915
- chmod: fsPromises.chmod,
3916
- mkdir: fsPromises.mkdir,
3917
- readdir: (path) => fsPromises.readdir(path, { withFileTypes: true }),
3918
- rename: fsPromises.rename,
3919
- rm: fsPromises.rm,
3920
- rmdir: fsPromises.rmdir,
3921
- stat: fsPromises.stat,
3922
- lstat: fsPromises.lstat,
3923
- unlink: fsPromises.unlink
3924
- };
3925
-
3926
- // ../../node_modules/.vlt/~npm~rimraf@6.1.3/node_modules/rimraf/dist/esm/rimraf-posix.js
3927
- import { parse as parse2, resolve as resolve2 } from "node:path";
3928
-
3929
- // ../../node_modules/.vlt/~npm~rimraf@6.1.3/node_modules/rimraf/dist/esm/readdir-or-error.js
3930
- var { readdir } = promises;
3931
- var readdirOrError = (path) => readdir(path).catch((er) => er);
3932
- var readdirOrErrorSync = (path) => {
3933
- try {
3934
- return readdirSync(path);
3935
- } catch (er) {
3936
- return er;
3937
- }
3938
- };
3939
-
3940
- // ../../node_modules/.vlt/~npm~rimraf@6.1.3/node_modules/rimraf/dist/esm/error.js
3941
- var isRecord = (o) => !!o && typeof o === "object";
3942
- var hasString = (o, key) => key in o && typeof o[key] === "string";
3943
- var isFsError = (o) => isRecord(o) && hasString(o, "code") && hasString(o, "path");
3944
- var errorCode = (er) => isRecord(er) && hasString(er, "code") ? er.code : null;
3945
-
3946
- // ../../node_modules/.vlt/~npm~rimraf@6.1.3/node_modules/rimraf/dist/esm/ignore-enoent.js
3947
- var ignoreENOENT = async (p, rethrow) => p.catch((er) => {
3948
- if (errorCode(er) === "ENOENT") {
3949
- return;
3950
- }
3951
- throw rethrow ?? er;
3952
- });
3953
- var ignoreENOENTSync = (fn, rethrow) => {
3954
- try {
3955
- return fn();
3956
- } catch (er) {
3957
- if (errorCode(er) === "ENOENT") {
3958
- return;
3959
- }
3960
- throw rethrow ?? er;
3961
- }
3962
- };
3963
-
3964
- // ../../node_modules/.vlt/~npm~rimraf@6.1.3/node_modules/rimraf/dist/esm/rimraf-posix.js
3965
- var { lstat, rmdir, unlink } = promises;
3966
- var rimrafPosix = async (path, opt) => {
3967
- opt?.signal?.throwIfAborted();
3968
- return await ignoreENOENT(lstat(path).then((stat2) => rimrafPosixDir(path, opt, stat2))) ?? true;
3969
- };
3970
- var rimrafPosixSync = (path, opt) => {
3971
- opt?.signal?.throwIfAborted();
3972
- return ignoreENOENTSync(() => rimrafPosixDirSync(path, opt, lstatSync(path))) ?? true;
3973
- };
3974
- var rimrafPosixDir = async (path, opt, ent) => {
3975
- opt?.signal?.throwIfAborted();
3976
- const entries = ent.isDirectory() ? await readdirOrError(path) : null;
3977
- if (!Array.isArray(entries)) {
3978
- if (entries) {
3979
- if (errorCode(entries) === "ENOENT") {
3980
- return true;
3981
- }
3982
- if (errorCode(entries) !== "ENOTDIR") {
3983
- throw entries;
3984
- }
3985
- }
3986
- if (opt.filter && !await opt.filter(path, ent)) {
3987
- return false;
3988
- }
3989
- await ignoreENOENT(unlink(path));
3990
- return true;
3991
- }
3992
- const removedAll = (await Promise.all(entries.map((ent2) => rimrafPosixDir(resolve2(path, ent2.name), opt, ent2)))).every((v3) => v3 === true);
3993
- if (!removedAll) {
3994
- return false;
3995
- }
3996
- if (opt.preserveRoot === false && path === parse2(path).root) {
3997
- return false;
3998
- }
3999
- if (opt.filter && !await opt.filter(path, ent)) {
4000
- return false;
4001
- }
4002
- await ignoreENOENT(rmdir(path));
4003
- return true;
4004
- };
4005
- var rimrafPosixDirSync = (path, opt, ent) => {
4006
- opt?.signal?.throwIfAborted();
4007
- const entries = ent.isDirectory() ? readdirOrErrorSync(path) : null;
4008
- if (!Array.isArray(entries)) {
4009
- if (entries) {
4010
- if (errorCode(entries) === "ENOENT") {
4011
- return true;
4012
- }
4013
- if (errorCode(entries) !== "ENOTDIR") {
4014
- throw entries;
4015
- }
4016
- }
4017
- if (opt.filter && !opt.filter(path, ent)) {
4018
- return false;
4019
- }
4020
- ignoreENOENTSync(() => unlinkSync(path));
4021
- return true;
4022
- }
4023
- let removedAll = true;
4024
- for (const ent2 of entries) {
4025
- const p = resolve2(path, ent2.name);
4026
- removedAll = rimrafPosixDirSync(p, opt, ent2) && removedAll;
4027
- }
4028
- if (opt.preserveRoot === false && path === parse2(path).root) {
4029
- return false;
4030
- }
4031
- if (!removedAll) {
4032
- return false;
4033
- }
4034
- if (opt.filter && !opt.filter(path, ent)) {
4035
- return false;
4036
- }
4037
- ignoreENOENTSync(() => rmdirSync(path));
4038
- return true;
4039
- };
4040
-
4041
- // ../../node_modules/.vlt/~npm~rimraf@6.1.3/node_modules/rimraf/dist/esm/rimraf-windows.js
4042
- import { parse as parse5, resolve as resolve5 } from "node:path";
4043
-
4044
- // ../../node_modules/.vlt/~npm~rimraf@6.1.3/node_modules/rimraf/dist/esm/fix-eperm.js
4045
- var { chmod } = promises;
4046
- var fixEPERM = (fn) => async (path) => {
4047
- try {
4048
- return void await ignoreENOENT(fn(path));
4049
- } catch (er) {
4050
- if (errorCode(er) === "EPERM") {
4051
- if (!await ignoreENOENT(chmod(path, 438).then(() => true), er)) {
4052
- return;
4053
- }
4054
- return void await fn(path);
4055
- }
4056
- throw er;
4057
- }
4058
- };
4059
- var fixEPERMSync = (fn) => (path) => {
4060
- try {
4061
- return void ignoreENOENTSync(() => fn(path));
4062
- } catch (er) {
4063
- if (errorCode(er) === "EPERM") {
4064
- if (!ignoreENOENTSync(() => (chmodSync(path, 438), true), er)) {
4065
- return;
4066
- }
4067
- return void fn(path);
4068
- }
4069
- throw er;
4070
- }
4071
- };
4072
-
4073
- // ../../node_modules/.vlt/~npm~rimraf@6.1.3/node_modules/rimraf/dist/esm/retry-busy.js
4074
- import { setTimeout as setTimeout2 } from "node:timers/promises";
4075
- var MAXBACKOFF = 200;
4076
- var RATE = 1.2;
4077
- var MAXRETRIES = 10;
4078
- var codes = /* @__PURE__ */ new Set(["EMFILE", "ENFILE", "EBUSY"]);
4079
- var retryBusy = (fn) => {
4080
- const method = async (path, opt, backoff = 1, total = 0) => {
4081
- const mbo = opt.maxBackoff || MAXBACKOFF;
4082
- const rate = opt.backoff || RATE;
4083
- const max = opt.maxRetries || MAXRETRIES;
4084
- let retries = 0;
4085
- while (true) {
4086
- try {
4087
- return await fn(path);
4088
- } catch (er) {
4089
- if (isFsError(er) && er.path === path && codes.has(er.code)) {
4090
- backoff = Math.ceil(backoff * rate);
4091
- total = backoff + total;
4092
- if (total < mbo) {
4093
- await setTimeout2(backoff);
4094
- return method(path, opt, backoff, total);
4095
- }
4096
- if (retries < max) {
4097
- retries++;
4098
- continue;
4099
- }
4100
- }
4101
- throw er;
4102
- }
4103
- }
4104
- };
4105
- return method;
4106
- };
4107
- var retryBusySync = (fn) => {
4108
- const method = (path, opt) => {
4109
- const max = opt.maxRetries || MAXRETRIES;
4110
- let retries = 0;
4111
- while (true) {
4112
- try {
4113
- return fn(path);
4114
- } catch (er) {
4115
- if (isFsError(er) && er.path === path && codes.has(er.code) && retries < max) {
4116
- retries++;
4117
- continue;
4118
- }
4119
- throw er;
4120
- }
4121
- }
4122
- };
4123
- return method;
4124
- };
4125
-
4126
- // ../../node_modules/.vlt/~npm~rimraf@6.1.3/node_modules/rimraf/dist/esm/rimraf-move-remove.js
4127
- import { basename, parse as parse4, resolve as resolve4 } from "node:path";
4128
-
4129
- // ../../node_modules/.vlt/~npm~rimraf@6.1.3/node_modules/rimraf/dist/esm/default-tmp.js
4130
- import { tmpdir } from "node:os";
4131
- import { parse as parse3, resolve as resolve3 } from "node:path";
4132
- var { stat } = promises;
4133
- var isDirSync = (path) => {
4134
- try {
4135
- return statSync(path).isDirectory();
4136
- } catch {
4137
- return false;
4138
- }
4139
- };
4140
- var isDir = (path) => stat(path).then((st2) => st2.isDirectory(), () => false);
4141
- var win32DefaultTmp = async (path) => {
4142
- const { root } = parse3(path);
4143
- const tmp = tmpdir();
4144
- const { root: tmpRoot } = parse3(tmp);
4145
- if (root.toLowerCase() === tmpRoot.toLowerCase()) {
4146
- return tmp;
4147
- }
4148
- const driveTmp = resolve3(root, "/temp");
4149
- if (await isDir(driveTmp)) {
4150
- return driveTmp;
4151
- }
4152
- return root;
4153
- };
4154
- var win32DefaultTmpSync = (path) => {
4155
- const { root } = parse3(path);
4156
- const tmp = tmpdir();
4157
- const { root: tmpRoot } = parse3(tmp);
4158
- if (root.toLowerCase() === tmpRoot.toLowerCase()) {
4159
- return tmp;
4160
- }
4161
- const driveTmp = resolve3(root, "/temp");
4162
- if (isDirSync(driveTmp)) {
4163
- return driveTmp;
4164
- }
4165
- return root;
4166
- };
4167
- var posixDefaultTmp = async () => tmpdir();
4168
- var posixDefaultTmpSync = () => tmpdir();
4169
- var defaultTmp = process.platform === "win32" ? win32DefaultTmp : posixDefaultTmp;
4170
- var defaultTmpSync = process.platform === "win32" ? win32DefaultTmpSync : posixDefaultTmpSync;
4171
-
4172
- // ../../node_modules/.vlt/~npm~rimraf@6.1.3/node_modules/rimraf/dist/esm/rimraf-move-remove.js
4173
- var { lstat: lstat2, rename, unlink: unlink2, rmdir: rmdir2 } = promises;
4174
- var uniqueFilename = (path) => `.${basename(path)}.${Math.random()}`;
4175
- var unlinkFixEPERM = fixEPERM(unlink2);
4176
- var unlinkFixEPERMSync = fixEPERMSync(unlinkSync);
4177
- var rimrafMoveRemove = async (path, opt) => {
4178
- opt?.signal?.throwIfAborted();
4179
- return await ignoreENOENT(lstat2(path).then((stat2) => rimrafMoveRemoveDir(path, opt, stat2))) ?? true;
4180
- };
4181
- var rimrafMoveRemoveDir = async (path, opt, ent) => {
4182
- opt?.signal?.throwIfAborted();
4183
- if (!opt.tmp) {
4184
- return rimrafMoveRemoveDir(path, { ...opt, tmp: await defaultTmp(path) }, ent);
4185
- }
4186
- if (path === opt.tmp && parse4(path).root !== path) {
4187
- throw new Error("cannot delete temp directory used for deletion");
4188
- }
4189
- const entries = ent.isDirectory() ? await readdirOrError(path) : null;
4190
- if (!Array.isArray(entries)) {
4191
- if (entries) {
4192
- if (errorCode(entries) === "ENOENT") {
4193
- return true;
4194
- }
4195
- if (errorCode(entries) !== "ENOTDIR") {
4196
- throw entries;
4197
- }
4198
- }
4199
- if (opt.filter && !await opt.filter(path, ent)) {
4200
- return false;
4201
- }
4202
- await ignoreENOENT(tmpUnlink(path, opt.tmp, unlinkFixEPERM));
4203
- return true;
4204
- }
4205
- const removedAll = (await Promise.all(entries.map((ent2) => rimrafMoveRemoveDir(resolve4(path, ent2.name), opt, ent2)))).every((v3) => v3 === true);
4206
- if (!removedAll) {
4207
- return false;
4208
- }
4209
- if (opt.preserveRoot === false && path === parse4(path).root) {
4210
- return false;
4211
- }
4212
- if (opt.filter && !await opt.filter(path, ent)) {
4213
- return false;
4214
- }
4215
- await ignoreENOENT(tmpUnlink(path, opt.tmp, rmdir2));
4216
- return true;
4217
- };
4218
- var tmpUnlink = async (path, tmp, rm2) => {
4219
- const tmpFile = resolve4(tmp, uniqueFilename(path));
4220
- await rename(path, tmpFile);
4221
- return await rm2(tmpFile);
4222
- };
4223
- var rimrafMoveRemoveSync = (path, opt) => {
4224
- opt?.signal?.throwIfAborted();
4225
- return ignoreENOENTSync(() => rimrafMoveRemoveDirSync(path, opt, lstatSync(path))) ?? true;
4226
- };
4227
- var rimrafMoveRemoveDirSync = (path, opt, ent) => {
4228
- opt?.signal?.throwIfAborted();
4229
- if (!opt.tmp) {
4230
- return rimrafMoveRemoveDirSync(path, { ...opt, tmp: defaultTmpSync(path) }, ent);
4231
- }
4232
- const tmp = opt.tmp;
4233
- if (path === opt.tmp && parse4(path).root !== path) {
4234
- throw new Error("cannot delete temp directory used for deletion");
4235
- }
4236
- const entries = ent.isDirectory() ? readdirOrErrorSync(path) : null;
4237
- if (!Array.isArray(entries)) {
4238
- if (entries) {
4239
- if (errorCode(entries) === "ENOENT") {
4240
- return true;
4241
- }
4242
- if (errorCode(entries) !== "ENOTDIR") {
4243
- throw entries;
4244
- }
4245
- }
4246
- if (opt.filter && !opt.filter(path, ent)) {
4247
- return false;
4248
- }
4249
- ignoreENOENTSync(() => tmpUnlinkSync(path, tmp, unlinkFixEPERMSync));
4250
- return true;
4251
- }
4252
- let removedAll = true;
4253
- for (const ent2 of entries) {
4254
- const p = resolve4(path, ent2.name);
4255
- removedAll = rimrafMoveRemoveDirSync(p, opt, ent2) && removedAll;
4256
- }
4257
- if (!removedAll) {
4258
- return false;
4259
- }
4260
- if (opt.preserveRoot === false && path === parse4(path).root) {
4261
- return false;
4262
- }
4263
- if (opt.filter && !opt.filter(path, ent)) {
4264
- return false;
4265
- }
4266
- ignoreENOENTSync(() => tmpUnlinkSync(path, tmp, rmdirSync));
4267
- return true;
4268
- };
4269
- var tmpUnlinkSync = (path, tmp, rmSync2) => {
4270
- const tmpFile = resolve4(tmp, uniqueFilename(path));
4271
- renameSync(path, tmpFile);
4272
- return rmSync2(tmpFile);
4273
- };
4274
-
4275
- // ../../node_modules/.vlt/~npm~rimraf@6.1.3/node_modules/rimraf/dist/esm/rimraf-windows.js
4276
- var { unlink: unlink3, rmdir: rmdir3, lstat: lstat3 } = promises;
4277
- var rimrafWindowsFile = retryBusy(fixEPERM(unlink3));
4278
- var rimrafWindowsFileSync = retryBusySync(fixEPERMSync(unlinkSync));
4279
- var rimrafWindowsDirRetry = retryBusy(fixEPERM(rmdir3));
4280
- var rimrafWindowsDirRetrySync = retryBusySync(fixEPERMSync(rmdirSync));
4281
- var rimrafWindowsDirMoveRemoveFallback = async (path, { filter, ...opt }) => {
4282
- opt?.signal?.throwIfAborted();
4283
- try {
4284
- await rimrafWindowsDirRetry(path, opt);
4285
- return true;
4286
- } catch (er) {
4287
- if (errorCode(er) === "ENOTEMPTY") {
4288
- return rimrafMoveRemove(path, opt);
4289
- }
4290
- throw er;
4291
- }
4292
- };
4293
- var rimrafWindowsDirMoveRemoveFallbackSync = (path, { filter, ...opt }) => {
4294
- opt?.signal?.throwIfAborted();
4295
- try {
4296
- rimrafWindowsDirRetrySync(path, opt);
4297
- return true;
4298
- } catch (er) {
4299
- if (errorCode(er) === "ENOTEMPTY") {
4300
- return rimrafMoveRemoveSync(path, opt);
4301
- }
4302
- throw er;
4303
- }
4304
- };
4305
- var START = /* @__PURE__ */ Symbol("start");
4306
- var CHILD = /* @__PURE__ */ Symbol("child");
4307
- var FINISH = /* @__PURE__ */ Symbol("finish");
4308
- var rimrafWindows = async (path, opt) => {
4309
- opt?.signal?.throwIfAborted();
4310
- return await ignoreENOENT(lstat3(path).then((stat2) => rimrafWindowsDir(path, opt, stat2, START))) ?? true;
4311
- };
4312
- var rimrafWindowsSync = (path, opt) => {
4313
- opt?.signal?.throwIfAborted();
4314
- return ignoreENOENTSync(() => rimrafWindowsDirSync(path, opt, lstatSync(path), START)) ?? true;
4315
- };
4316
- var rimrafWindowsDir = async (path, opt, ent, state = START) => {
4317
- opt?.signal?.throwIfAborted();
4318
- const entries = ent.isDirectory() ? await readdirOrError(path) : null;
4319
- if (!Array.isArray(entries)) {
4320
- if (entries) {
4321
- if (errorCode(entries) === "ENOENT") {
4322
- return true;
4323
- }
4324
- if (errorCode(entries) !== "ENOTDIR") {
4325
- throw entries;
4326
- }
4327
- }
4328
- if (opt.filter && !await opt.filter(path, ent)) {
4329
- return false;
4330
- }
4331
- await ignoreENOENT(rimrafWindowsFile(path, opt));
4332
- return true;
4333
- }
4334
- const s = state === START ? CHILD : state;
4335
- const removedAll = (await Promise.all(entries.map((ent2) => rimrafWindowsDir(resolve5(path, ent2.name), opt, ent2, s)))).every((v3) => v3 === true);
4336
- if (state === START) {
4337
- return rimrafWindowsDir(path, opt, ent, FINISH);
4338
- } else if (state === FINISH) {
4339
- if (opt.preserveRoot === false && path === parse5(path).root) {
4340
- return false;
4341
- }
4342
- if (!removedAll) {
4343
- return false;
4344
- }
4345
- if (opt.filter && !await opt.filter(path, ent)) {
4346
- return false;
4347
- }
4348
- await ignoreENOENT(rimrafWindowsDirMoveRemoveFallback(path, opt));
4349
- }
4350
- return true;
4351
- };
4352
- var rimrafWindowsDirSync = (path, opt, ent, state = START) => {
4353
- const entries = ent.isDirectory() ? readdirOrErrorSync(path) : null;
4354
- if (!Array.isArray(entries)) {
4355
- if (entries) {
4356
- if (errorCode(entries) === "ENOENT") {
4357
- return true;
4358
- }
4359
- if (errorCode(entries) !== "ENOTDIR") {
4360
- throw entries;
4361
- }
4362
- }
4363
- if (opt.filter && !opt.filter(path, ent)) {
4364
- return false;
4365
- }
4366
- ignoreENOENTSync(() => rimrafWindowsFileSync(path, opt));
4367
- return true;
4368
- }
4369
- let removedAll = true;
4370
- for (const ent2 of entries) {
4371
- const s = state === START ? CHILD : state;
4372
- const p = resolve5(path, ent2.name);
4373
- removedAll = rimrafWindowsDirSync(p, opt, ent2, s) && removedAll;
4374
- }
4375
- if (state === START) {
4376
- return rimrafWindowsDirSync(path, opt, ent, FINISH);
4377
- } else if (state === FINISH) {
4378
- if (opt.preserveRoot === false && path === parse5(path).root) {
4379
- return false;
4380
- }
4381
- if (!removedAll) {
4382
- return false;
4383
- }
4384
- if (opt.filter && !opt.filter(path, ent)) {
4385
- return false;
4386
- }
4387
- ignoreENOENTSync(() => rimrafWindowsDirMoveRemoveFallbackSync(path, opt));
4388
- }
4389
- return true;
4390
- };
4391
-
4392
- // ../../node_modules/.vlt/~npm~rimraf@6.1.3/node_modules/rimraf/dist/esm/rimraf-manual.js
4393
- var rimrafManual = process.platform === "win32" ? rimrafWindows : rimrafPosix;
4394
- var rimrafManualSync = process.platform === "win32" ? rimrafWindowsSync : rimrafPosixSync;
4395
-
4396
- // ../../node_modules/.vlt/~npm~rimraf@6.1.3/node_modules/rimraf/dist/esm/rimraf-native.js
4397
- var { rm } = promises;
4398
- var rimrafNative = async (path, opt) => {
4399
- await rm(path, {
4400
- ...opt,
4401
- force: true,
4402
- recursive: true
4403
- });
4404
- return true;
4405
- };
4406
- var rimrafNativeSync = (path, opt) => {
4407
- rmSync(path, {
4408
- ...opt,
4409
- force: true,
4410
- recursive: true
4411
- });
4412
- return true;
4413
- };
4414
-
4415
- // ../../node_modules/.vlt/~npm~rimraf@6.1.3/node_modules/rimraf/dist/esm/use-native.js
4416
- var [major = 0, minor = 0] = process.version.replace(/^v/, "").split(".").map((v3) => parseInt(v3, 10));
4417
- var hasNative = major > 14 || major === 14 && minor >= 14;
4418
- var useNative = !hasNative || process.platform === "win32" ? () => false : (opt) => !opt?.signal && !opt?.filter;
4419
- var useNativeSync = !hasNative || process.platform === "win32" ? () => false : (opt) => !opt?.signal && !opt?.filter;
4420
-
4421
- // ../../node_modules/.vlt/~npm~rimraf@6.1.3/node_modules/rimraf/dist/esm/index.js
4422
- var wrap = (fn) => async (path, opt) => {
4423
- const options = optArg(opt);
4424
- if (options.glob) {
4425
- path = await Ze(path, options.glob);
4426
- }
4427
- if (Array.isArray(path)) {
4428
- return !!(await Promise.all(path.map((p) => fn(path_arg_default(p, options), options)))).reduce((a2, b) => a2 && b, true);
4429
- } else {
4430
- return !!await fn(path_arg_default(path, options), options);
4431
- }
4432
- };
4433
- var wrapSync = (fn) => (path, opt) => {
4434
- const options = optArgSync(opt);
4435
- if (options.glob) {
4436
- path = ts(path, options.glob);
4437
- }
4438
- if (Array.isArray(path)) {
4439
- return !!path.map((p) => fn(path_arg_default(p, options), options)).reduce((a2, b) => a2 && b, true);
4440
- } else {
4441
- return !!fn(path_arg_default(path, options), options);
4442
- }
4443
- };
4444
- var nativeSync = wrapSync(rimrafNativeSync);
4445
- var native = Object.assign(wrap(rimrafNative), {
4446
- sync: nativeSync
4447
- });
4448
- var manualSync = wrapSync(rimrafManualSync);
4449
- var manual = Object.assign(wrap(rimrafManual), {
4450
- sync: manualSync
4451
- });
4452
- var windowsSync = wrapSync(rimrafWindowsSync);
4453
- var windows = Object.assign(wrap(rimrafWindows), {
4454
- sync: windowsSync
4455
- });
4456
- var posixSync = wrapSync(rimrafPosixSync);
4457
- var posix = Object.assign(wrap(rimrafPosix), { sync: posixSync });
4458
- var moveRemoveSync = wrapSync(rimrafMoveRemoveSync);
4459
- var moveRemove = Object.assign(wrap(rimrafMoveRemove), {
4460
- sync: moveRemoveSync
4461
- });
4462
- var rimrafSync = wrapSync((path, opt) => useNativeSync(opt) ? rimrafNativeSync(path, opt) : rimrafManualSync(path, opt));
4463
- var rimraf_ = wrap((path, opt) => useNative(opt) ? rimrafNative(path, opt) : rimrafManual(path, opt));
4464
- var rimraf = Object.assign(rimraf_, {
4465
- rimraf: rimraf_,
4466
- sync: rimrafSync,
4467
- rimrafSync,
4468
- manual,
4469
- manualSync,
4470
- native,
4471
- nativeSync,
4472
- posix,
4473
- posixSync,
4474
- windows,
4475
- windowsSync,
4476
- moveRemove,
4477
- moveRemoveSync
4478
- });
4479
- rimraf.rimraf = rimraf;
4480
-
4481
- export {
4482
- I,
4483
- promiseSpawn,
4484
- which,
4485
- whichSync,
4486
- ts,
4487
- rimraf
4488
- };