@vltpkg/cli-js 1.0.2 → 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.
- package/{access-DB347PPG.js → access-5WETTBDZ.js} +9 -7
- package/{bugs-QBKI62J6.js → bugs-KONFLIQQ.js} +19 -18
- package/{build-EFJ3FFGU.js → build-S7G2DU7I.js} +12 -10
- package/{cache-BQJCMDJN.js → cache-Z4OIMLXQ.js} +23 -21
- package/{chunk-RXNA2XCX.js → chunk-4KCU2KZL.js} +8 -1
- package/{chunk-3MBSXZ62.js → chunk-5B23EKN4.js} +4 -4
- package/{chunk-5OGQND6H.js → chunk-5QJEOGEM.js} +3 -1
- package/{chunk-DEMBZY23.js → chunk-5UPPEUG2.js} +11 -11
- package/chunk-BJBFEQRR.js +667 -0
- package/{chunk-L34LR5DV.js → chunk-DYCF76WI.js} +4 -4
- package/{chunk-ULCDRVY2.js → chunk-E737X73P.js} +38 -24
- package/{chunk-F2GLBPGQ.js → chunk-FFOXTPQA.js} +8 -6
- package/chunk-G7UPIJAP.js +903 -0
- package/{chunk-CNSTFT7U.js → chunk-HAYXR3MW.js} +1 -1
- package/{chunk-3HUTU5SO.js → chunk-HNCE3YE5.js} +1649 -1569
- package/{chunk-Q46JRSZU.js → chunk-IITIX4ID.js} +22 -3
- package/chunk-LPIBYUMT.js +854 -0
- package/{chunk-47IR6Z6C.js → chunk-LZGKX7JI.js} +87 -40
- package/{chunk-5PFGKHIS.js → chunk-NXEH3NQZ.js} +10 -10
- package/{chunk-FM5DQZVN.js → chunk-OCJDISSI.js} +2 -2
- package/chunk-RNJSI3NZ.js +75 -0
- package/{chunk-ONVLPT73.js → chunk-T4GYDWUJ.js} +1 -1
- package/{chunk-YDUHQU7N.js → chunk-TMBNGWXK.js} +3 -3
- package/{chunk-CTDFRLS4.js → chunk-UAAZW4N6.js} +4 -4
- package/{chunk-TM4LHSZV.js → chunk-UXIRAU5T.js} +3 -3
- package/{chunk-BSB4XGBB.js → chunk-VB3IWNHX.js} +1 -1
- package/chunk-VE6CCH33.js +3000 -0
- package/{chunk-42UTZKAU.js → chunk-W2Q5EIMH.js} +8 -8
- package/{chunk-YRMICBI4.js → chunk-XQSBCMSC.js} +5 -5
- package/{chunk-NS4VFXHX.js → chunk-XU5SMHXP.js} +1 -1
- package/{ci-A22A6TCQ.js → ci-RZZE375O.js} +17 -16
- package/cli-package.json +1 -1
- package/{config-JL4TW2AV.js → config-LL3RLMZG.js} +9 -12
- package/{config-VOLRKFYD.js → config-MDFY3ORD.js} +15 -18
- package/{create-SL7HEXCS.js → create-GVSDTOGQ.js} +23 -23
- package/{deprecate-ZK525LQW.js → deprecate-T4TQLGXQ.js} +16 -14
- package/{dist-tag-FY3FB5VH.js → dist-tag-GO46UQUN.js} +11 -9
- package/{docs-6BPWZJFW.js → docs-FJME563T.js} +19 -18
- package/{exec-JZ5J7DI7.js → exec-M22KBPCK.js} +23 -23
- package/{exec-cache-VGSXKZVF.js → exec-cache-3UNLDUAP.js} +22 -22
- package/{exec-local-GPZUSOSM.js → exec-local-YHVO5RLU.js} +20 -18
- package/{help-XI7TNIRU.js → help-ZEWMLOJX.js} +3 -3
- package/{init-6KWM7CDI.js → init-4HPZY2KN.js} +12 -10
- package/{install-4VLOKCWH.js → install-2TZIP4PJ.js} +18 -17
- package/{list-3VLGWGKU.js → list-NFFXER43.js} +20 -18
- package/{login-3DGPSWCG.js → login-KV5YC5Z2.js} +9 -7
- package/{logout-DBFMZC6J.js → logout-I2VT3NAR.js} +9 -7
- package/{pack-LHNYEZ5W.js → pack-47ZKFSHI.js} +16 -14
- package/package.json +1 -1
- package/{ping-VLLX5LIH.js → ping-Q7Y7QV63.js} +9 -7
- package/{pkg-FYPUMX7U.js → pkg-VTJS2ISJ.js} +13 -11
- package/{profile-FOQ74TB7.js → profile-YXZYVEUX.js} +9 -7
- package/{publish-DFURU7DW.js → publish-CBN67KN2.js} +21 -19
- package/{query-NC3EABMW.js → query-U3QHF3ZE.js} +20 -18
- package/{registry-5DUFCPD6.js → registry-CZPFR3OF.js} +3 -3
- package/registry-client-package.json +1 -1
- package/registry-client-src-revalidate.js +403 -328
- package/{repo-IZXACKQ2.js → repo-4UIQRBI7.js} +19 -18
- package/{chunk-UVZJFBYE.js → reporter-DKZTTACW.js} +5 -5
- package/{run-RDFVO7FY.js → run-5DUYI6GL.js} +20 -18
- package/{run-exec-OGMXEVN5.js → run-exec-HPNBVAXH.js} +20 -18
- package/security-archive-src-update-expired.js +11 -2
- package/{setup-KTJQPDJB.js → setup-23W5FQVW.js} +15 -13
- package/{src-BJU7XZNK.js → src-2NB67FPG.js} +22 -23
- package/{reporter-UU654STB.js → src-6OKPBJJT.js} +42 -7
- package/src-M5RRGKUM.js +913 -0
- package/{token-SKICECA4.js → token-SRCS5CRU.js} +9 -7
- package/{uninstall-MTZJ33TO.js → uninstall-JXHAFXZ2.js} +18 -17
- package/{unpublish-3QBJZFHQ.js → unpublish-GRYB5KQH.js} +12 -10
- package/{update-TH477PKA.js → update-GDLL4ER6.js} +17 -16
- package/{version-YIBQZLQS.js → version-JVG4CI4L.js} +13 -11
- package/{view-FG74OAOV.js → view-ABQLVL4L.js} +12 -14
- package/vlr.js +1 -1
- package/vlrx.js +1 -1
- package/vlt.js +1 -1
- package/vlx.js +1 -1
- package/vlxl.js +1 -1
- package/{whoami-LHJ4PRJQ.js → whoami-RCCZ7BXI.js} +9 -7
- package/chunk-7NHXV6AH.js +0 -4488
- package/chunk-WAFERMRI.js +0 -1663
- package/chunk-ZLZ4XF46.js +0 -75
- package/{chunk-Y7CQIZ7Y.js → chunk-FEIPJIEN.js} +3 -3
|
@@ -0,0 +1,854 @@
|
|
|
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, n) => e.#P(t, i2, s, n), 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: n, updateAgeOnGet: o, updateAgeOnHas: l, allowStale: h, dispose: r, onInsert: c, disposeAfter: m2, noDisposeOnSet: _2, noUpdateTTL: u2, maxSize: g2 = 0, maxEntrySize: f = 0, sizeCalculation: y2, fetchMethod: a2, memoMethod: w2, noDeleteOnFetchRejection: F2, noDeleteOnStaleGet: b, allowStaleOnFetchRejection: p, allowStaleOnFetchAbort: A2, ignoreFetchAbort: z, backgroundFetchSize: C2 = 1, perf: E } = e;
|
|
140
|
+
if (this.backgroundFetchSize = C2, 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 v2 = t ? j(t) : Array;
|
|
143
|
+
if (!v2) 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 v2(t), this.#u = new v2(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 = !!_2, this.noUpdateTTL = !!u2, this.noDeleteOnFetchRejection = !!F2, this.allowStaleOnFetchRejection = !!p, this.allowStaleOnFetchAbort = !!A2, 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 = !!n, 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 D = "LRU_CACHE_UNBOUNDED";
|
|
162
|
+
H(D) && (U.add(D), k("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.", "UnboundedCacheWarning", D, 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 = n || o();
|
|
191
|
+
let _2 = h.now - m2;
|
|
192
|
+
h.remainingTTL = c - _2;
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
let n = 0, o = () => {
|
|
196
|
+
let h = this.#m.now();
|
|
197
|
+
if (this.ttlResolution > 0) {
|
|
198
|
+
n = h;
|
|
199
|
+
let r = setTimeout(() => n = 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 = (n || o()) - c;
|
|
212
|
+
return r - m2;
|
|
213
|
+
};
|
|
214
|
+
this.#p = (h) => {
|
|
215
|
+
let r = t[h], c = e[h];
|
|
216
|
+
return !!c && !!r && (n || 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, n) => {
|
|
231
|
+
if (!T(s)) {
|
|
232
|
+
if (this.#e(i2)) return this.backgroundFetchSize;
|
|
233
|
+
if (n) {
|
|
234
|
+
if (typeof n != "function") throw new TypeError("sizeCalculation must be a function");
|
|
235
|
+
if (s = n(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 n = this.#c - e[t];
|
|
242
|
+
for (; this.#b > n; ) 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], n = this.#e(s) ? s.__staleWhileFetching : s;
|
|
295
|
+
if (n !== void 0 && e(n, 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], n = this.#e(s) ? s.__staleWhileFetching : s;
|
|
301
|
+
n !== void 0 && e.call(t, n, this.#i[i2], this);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
rforEach(e, t = this) {
|
|
305
|
+
for (let i2 of this.#z()) {
|
|
306
|
+
let s = this.#t[i2], n = this.#e(s) ? s.__staleWhileFetching : s;
|
|
307
|
+
n !== void 0 && e.call(t, n, 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 n = { 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
|
+
n.ttl = h, n.start = Date.now();
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
return this.#_ && (n.size = this.#_[t]), n;
|
|
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], n = this.#e(s) ? s.__staleWhileFetching : s;
|
|
334
|
+
if (n === void 0 || i2 === void 0) continue;
|
|
335
|
+
let o = { value: n };
|
|
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 n = this.#W(e, t, i2);
|
|
359
|
+
return s && S.hasSubscribers && S.publish(s), n;
|
|
360
|
+
}
|
|
361
|
+
#W(e, t, i2, s) {
|
|
362
|
+
let { ttl: n = 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 _2 = this.#N(e, t, i2.size || 0, h, r);
|
|
367
|
+
if (this.maxEntrySize && _2 > 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, _2, 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, _2, 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 (n !== 0 && !this.#d && this.#k(), this.#d && (m2 || this.#H(u2, n, 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], n = this.#e(s);
|
|
408
|
+
n && s.__abortController.abort(new Error("evicted"));
|
|
409
|
+
let o = n ? 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, n = this.#s.get(e);
|
|
420
|
+
if (n !== void 0) {
|
|
421
|
+
let o = this.#t[n];
|
|
422
|
+
if (this.#e(o) && o.__staleWhileFetching === void 0) return false;
|
|
423
|
+
if (this.#p(n)) s && (s.has = "stale", this.#v(s, n));
|
|
424
|
+
else return i2 && this.#R(n), s && (s.has = "hit", this.#v(s, n)), 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, n = this.#s.get(e);
|
|
436
|
+
if (n === void 0 || !s && this.#p(n)) {
|
|
437
|
+
i2 && (i2.peek = n === void 0 ? "miss" : "stale");
|
|
438
|
+
return;
|
|
439
|
+
}
|
|
440
|
+
let o = this.#t[n], 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 n = t === void 0 ? void 0 : this.#t[t];
|
|
445
|
+
if (this.#e(n)) return n;
|
|
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, F2 = 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, F2);
|
|
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, F2 = w2 || i2.allowStaleOnFetchRejection, b = F2 || 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)), F2) return i2.status && p.__staleWhileFetching !== void 0 && (i2.status.returnedStale = true), p.__staleWhileFetching;
|
|
456
|
+
if (p.__returned === p) throw f;
|
|
457
|
+
}, _2 = (f, y2) => {
|
|
458
|
+
let a2 = this.#M?.(e, n, 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(_2).then(r, c), g2 = Object.assign(u2, { __abortController: o, __staleWhileFetching: n, __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 n = this.#B(e, t);
|
|
476
|
+
return s && i2 && (s.trace = true, W.tracePromise(() => n, s).catch(() => {
|
|
477
|
+
})), n;
|
|
478
|
+
}
|
|
479
|
+
async #B(e, t = {}) {
|
|
480
|
+
let { allowStale: i2 = this.allowStale, updateAgeOnGet: s = this.updateAgeOnGet, noDeleteOnStaleGet: n = 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: _2 = 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: n, status: a2 });
|
|
482
|
+
let F2 = { allowStale: i2, updateAgeOnGet: s, noDeleteOnStaleGet: n, ttl: o, noDisposeOnSet: l, size: h, sizeCalculation: r, noUpdateTTL: c, noDeleteOnFetchRejection: m2, allowStaleOnFetchRejection: _2, 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, F2, f);
|
|
486
|
+
return p.__returned = p;
|
|
487
|
+
} else {
|
|
488
|
+
let p = this.#t[b];
|
|
489
|
+
if (this.#e(p)) {
|
|
490
|
+
let v2 = i2 && p.__staleWhileFetching !== void 0;
|
|
491
|
+
return a2 && (a2.fetch = "inflight", v2 && (a2.returnedStale = true)), v2 ? p.__staleWhileFetching : p.__returned = p;
|
|
492
|
+
}
|
|
493
|
+
let A2 = this.#p(b);
|
|
494
|
+
if (!y2 && !A2) 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, F2, f), E = z.__staleWhileFetching !== void 0 && i2;
|
|
496
|
+
return a2 && (a2.fetch = A2 ? "stale" : "refresh", E && A2 && (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 n = this.#K(e, t);
|
|
503
|
+
return s && i2 && (s.trace = true, W.tracePromise(() => n, s).catch(() => {
|
|
504
|
+
})), n;
|
|
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: n, forceRefresh: o, ...l } = t;
|
|
521
|
+
n && o && (n.forceRefresh = true);
|
|
522
|
+
let h = this.#C(e, l), r = o || h === void 0;
|
|
523
|
+
if (n && (n.memo = r ? "miss" : "hit", r || (n.value = h)), !r) return h;
|
|
524
|
+
let c = i2(e, h, { options: l, context: s });
|
|
525
|
+
return n && (n.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: n = 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) : (n || 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 n = this.#t[s];
|
|
560
|
+
if (this.#e(n) ? n.__abortController.abort(new Error("deleted")) : (this.#T || this.#f) && (this.#T && this.#S?.(n, e, t), this.#f && this.#r?.push([n, 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, n;
|
|
573
|
+
for (; n = s?.shift(); ) this.#w?.(...n);
|
|
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 resolve = (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
|
+
resolve(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]), n = t.mode, l = t.uid, E = t.gid, f = parseInt("100", 8), p = parseInt("010", 8), x2 = parseInt("001", 8), h = f | p;
|
|
720
|
+
return !!(n & x2 || n & p && c.has(E) || n & f && l === e || n & 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(), n = t.substring(t.length - c.length).toLowerCase();
|
|
749
|
+
if (c && n === 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 is = await R2(withExt, {
|
|
802
|
+
pathExt: pathExtExe,
|
|
803
|
+
ignoreErrors: true
|
|
804
|
+
});
|
|
805
|
+
if (is) {
|
|
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 is = U2(withExt, {
|
|
829
|
+
pathExt: pathExtExe,
|
|
830
|
+
ignoreErrors: true
|
|
831
|
+
});
|
|
832
|
+
if (is) {
|
|
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
|
+
export {
|
|
850
|
+
I,
|
|
851
|
+
promiseSpawn,
|
|
852
|
+
which,
|
|
853
|
+
whichSync
|
|
854
|
+
};
|