@vltpkg/cli-js 1.4.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{access-422UGEWN.js → access-QPX4QXV4.js} +13 -12
- package/{bugs-RED7Y33Q.js → bugs-TLOECXEM.js} +28 -25
- package/{build-IHMPBWRO.js → build-IQOS3LKO.js} +28 -19
- package/{cache-FJP2RZJX.js → cache-O5IBYYSB.js} +17 -17
- package/cache-unzip-src-unzip.js +35 -11
- package/{chunk-OVPHE4O7.js → chunk-2U4PVHP4.js} +5232 -10882
- package/{chunk-OAJ3PO3Z.js → chunk-35EG6T3J.js} +7 -7
- package/{chunk-GIIAODRI.js → chunk-3S3W7QEM.js} +7 -5
- package/{chunk-UGCKF5ZE.js → chunk-43EJ4Q42.js} +1 -1
- package/{chunk-5Y4SYLJ2.js → chunk-4TSHLSRK.js} +1 -1
- package/chunk-4UH3KMTD.js +6444 -0
- package/{chunk-SR2VOY5J.js → chunk-5KW6AOTT.js} +1 -1
- package/{chunk-FLH4YC6W.js → chunk-6LZM3I4Q.js} +35 -11
- package/{chunk-X4FVR4R5.js → chunk-6W5XMVIZ.js} +12 -10
- package/{chunk-TPRK6IDA.js → chunk-7UWRR6EE.js} +2 -2
- package/{chunk-ASLX43R3.js → chunk-ARE7FKDG.js} +6 -4
- package/chunk-B6RIGNEO.js +626 -0
- package/{chunk-I7UMHYZX.js → chunk-C6ZVVEFV.js} +111 -1186
- package/{chunk-WF6KLKRN.js → chunk-CMLDLZZ3.js} +47 -1
- package/{chunk-ISE4IRHF.js → chunk-CS6AYPY5.js} +6 -6
- package/{chunk-LHPEBLOU.js → chunk-CW56EJIL.js} +1 -1
- package/{chunk-PLG3OYCX.js → chunk-F7NPYSI2.js} +3 -2
- package/{chunk-ZJMJ7MCT.js → chunk-G3FZ2ZJK.js} +1 -1
- package/chunk-GUP55DM6.js +59 -0
- package/chunk-HOF7LEIC.js +24 -0
- package/chunk-IFEZ6BFV.js +1111 -0
- package/{chunk-7T3XAYP4.js → chunk-IJUVVD7E.js} +1 -1
- package/{chunk-DNRR3XMG.js → chunk-ISAMD2FE.js} +1 -1
- package/{chunk-PHJJPY5G.js → chunk-LH7J5BDU.js} +5 -5
- package/{chunk-5IJTPZXP.js → chunk-LUVDMEW4.js} +1 -1
- package/{chunk-C23TDXRG.js → chunk-MYX4JCIJ.js} +1 -1
- package/{chunk-APMYKJI2.js → chunk-QNHBAGXQ.js} +1 -1
- package/{chunk-5TNXLRW2.js → chunk-SMXXFQPI.js} +50 -12
- package/chunk-SUU2WETN.js +268 -0
- package/chunk-T2VBCUF5.js +77 -0
- package/{chunk-MKWPTN3C.js → chunk-T5EP7QEF.js} +2 -2
- package/{chunk-THSYN5EK.js → chunk-UZ6ICZE3.js} +1 -1
- package/{chunk-TO23PR7J.js → chunk-VR7NRWAD.js} +14 -12
- package/chunk-W4T5CGCO.js +52 -0
- package/{chunk-FZUYGJZU.js → chunk-WHWPAYZY.js} +117 -19
- package/{chunk-QCSUWACA.js → chunk-X6JKMIOU.js} +5 -1
- package/{chunk-5RHABCYI.js → chunk-XCQCYB6G.js} +8 -8
- package/{chunk-2AMOC4DN.js → chunk-XCSNI6AO.js} +4 -4
- package/{chunk-4UCADW6S.js → chunk-XD5KUDXX.js} +7 -7
- package/{chunk-HZXJ423P.js → chunk-Z5D5KODU.js} +1 -1
- package/{ci-YSKNNO5M.js → ci-ESVUMOZO.js} +31 -13
- package/cli-package.json +1 -1
- package/{config-CSPCDMR3.js → config-TMB2X6DW.js} +11 -9
- package/{config-HO7GY3QT.js → config-ZVVLFKR7.js} +15 -13
- package/{create-2TJT3AHJ.js → create-BLTNKSBQ.js} +28 -26
- package/{deprecate-7FRJI2RL.js → deprecate-VA6PGHYL.js} +17 -15
- package/{dist-tag-WCFF5OEG.js → dist-tag-OYJREFO2.js} +13 -12
- package/{docs-JMBPTU23.js → docs-6OC3OQNM.js} +28 -25
- package/{exec-FBOUKZZ2.js → exec-AZPGFVRY.js} +28 -26
- package/{exec-cache-X3ZWM5S3.js → exec-cache-D75UY2WI.js} +24 -22
- package/{exec-local-Y3KQC22N.js → exec-local-E2JKB4X4.js} +22 -20
- package/{help-PUKVH5X7.js → help-UPW77X5N.js} +5 -5
- package/{init-GOKAQXXZ.js → init-SNO6QL7C.js} +14 -11
- package/{install-XFN4UFOC.js → install-TEJM2YVX.js} +67 -28
- package/{list-43JFFG5D.js → list-NHCC2RNB.js} +33 -27
- package/{login-RSTZKNKN.js → login-XNZXCGFD.js} +18 -16
- package/{logout-4576FFXZ.js → logout-YCM7O36Q.js} +13 -12
- package/{outdated-ACQ5A2Y7.js → outdated-4LA7N63W.js} +26 -22
- package/{pack-QQVJ3G25.js → pack-RC4CZSWF.js} +22 -18
- package/package.json +1 -1
- package/{ping-QCDQQRO5.js → ping-RLVAZGDL.js} +13 -12
- package/{pkg-CSOJV7UC.js → pkg-FED5C6TP.js} +18 -14
- package/{profile-VL4HPW3N.js → profile-DJZNLQPG.js} +13 -12
- package/{publish-2YBO6ZXE.js → publish-54AMVMTQ.js} +56 -45
- package/{query-IHHFMJRT.js → query-ZQLMSJ7O.js} +35 -29
- package/{registry-W7BRZZZ2.js → registry-6HKQYSZX.js} +7 -7
- package/registry-client-src-revalidate.js +36 -12
- package/{repo-L3BXAAWS.js → repo-ITA4BLZ4.js} +28 -25
- package/{reporter-5NYOHBO7.js → reporter-UYVR2WMB.js} +72 -14
- package/{run-AMUUVLTI.js → run-TP2HTJRN.js} +22 -20
- package/{run-exec-5W3XWQZA.js → run-exec-UGCC53DV.js} +22 -20
- package/security-archive-src-update-expired.js +43 -17
- package/{setup-TFM4GJF7.js → setup-XPAM5U3Z.js} +22 -21
- package/skills-LR6GXW3X.js +413 -0
- package/skills-YD2TB2VD.js +495 -0
- package/{src-4CYCUWZL.js → src-34D4DOOH.js} +23 -18
- package/{src-I3GMULFP.js → src-H6DFCAPH.js} +9 -8
- package/{src-LUTN2ODD.js → src-LHDC4NJO.js} +2 -2
- package/{token-OANOBE3G.js → token-OF63PFTQ.js} +13 -12
- package/{uninstall-YXTQ4AIZ.js → uninstall-B54FQ5KQ.js} +20 -15
- package/{unpublish-SZXYMYIU.js → unpublish-CSHIGMDQ.js} +31 -16
- package/{update-FHLMWGIM.js → update-HS4VJ5ZG.js} +50 -25
- package/{version-ZWFCTU5V.js → version-L7S3DHUS.js} +19 -14
- package/{view-NFNJXMLV.js → view-NWKKWFVA.js} +17 -15
- 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-O7GOSGCI.js → whoami-65K35VGW.js} +13 -12
- package/chunk-G2YT2GWF.js +0 -120
- package/chunk-T6FBP4OU.js +0 -76
- package/chunk-U7TEQCBN.js +0 -880
package/chunk-U7TEQCBN.js
DELETED
|
@@ -1,880 +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
|
-
// ../../src/output/src/index.ts
|
|
17
|
-
import EventEmitter from "node:events";
|
|
18
|
-
var OutputEmitter = class {
|
|
19
|
-
emitter = new EventEmitter();
|
|
20
|
-
emit(eventName, payload) {
|
|
21
|
-
this.emitter.emit(eventName, payload);
|
|
22
|
-
}
|
|
23
|
-
on(eventName, handler) {
|
|
24
|
-
this.emitter.on(eventName, handler);
|
|
25
|
-
}
|
|
26
|
-
off(eventName, handler) {
|
|
27
|
-
this.emitter.off(eventName, handler);
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
var emitter = new OutputEmitter();
|
|
31
|
-
var logRequest = (url, state, details = {}) => {
|
|
32
|
-
emitter.emit("request", { url, state, ...details });
|
|
33
|
-
};
|
|
34
|
-
var graphStep = (step) => {
|
|
35
|
-
emitter.emit("graphStep", { step, state: "start" });
|
|
36
|
-
return () => emitter.emit("graphStep", { step, state: "stop" });
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
// ../../node_modules/.vlt/~npm~lru-cache@11.5.2/node_modules/lru-cache/dist/esm/node/index.min.js
|
|
40
|
-
import { tracingChannel as G, channel as P } from "node:diagnostics_channel";
|
|
41
|
-
var S = P("lru-cache:metrics");
|
|
42
|
-
var W = G("lru-cache");
|
|
43
|
-
var L = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date;
|
|
44
|
-
var R = () => S.hasSubscribers || W.hasSubscribers;
|
|
45
|
-
var U = /* @__PURE__ */ new Set();
|
|
46
|
-
var M = typeof process == "object" && process ? process : {};
|
|
47
|
-
var k = (d4, e, t, i2) => {
|
|
48
|
-
typeof M.emitWarning == "function" ? M.emitWarning(d4, e, t, i2) : console.error(`[${t}] ${e}: ${d4}`);
|
|
49
|
-
};
|
|
50
|
-
var H = (d4) => !U.has(d4);
|
|
51
|
-
var T = (d4) => !!d4 && d4 === Math.floor(d4) && d4 > 0 && isFinite(d4);
|
|
52
|
-
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;
|
|
53
|
-
var O = class extends Array {
|
|
54
|
-
constructor(e) {
|
|
55
|
-
super(e), this.fill(0);
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
var x = class d {
|
|
59
|
-
heap;
|
|
60
|
-
length;
|
|
61
|
-
static #o = false;
|
|
62
|
-
static create(e) {
|
|
63
|
-
let t = j(e);
|
|
64
|
-
if (!t) return [];
|
|
65
|
-
d.#o = true;
|
|
66
|
-
let i2 = new d(e, t);
|
|
67
|
-
return d.#o = false, i2;
|
|
68
|
-
}
|
|
69
|
-
constructor(e, t) {
|
|
70
|
-
if (!d.#o) throw new TypeError("instantiate Stack using Stack.create(n)");
|
|
71
|
-
this.heap = new t(e), this.length = 0;
|
|
72
|
-
}
|
|
73
|
-
push(e) {
|
|
74
|
-
this.heap[this.length++] = e;
|
|
75
|
-
}
|
|
76
|
-
pop() {
|
|
77
|
-
return this.heap[--this.length];
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
var I = class d2 {
|
|
81
|
-
#o;
|
|
82
|
-
#c;
|
|
83
|
-
#S;
|
|
84
|
-
#O;
|
|
85
|
-
#w;
|
|
86
|
-
#M;
|
|
87
|
-
#I;
|
|
88
|
-
#m;
|
|
89
|
-
get perf() {
|
|
90
|
-
return this.#m;
|
|
91
|
-
}
|
|
92
|
-
ttl;
|
|
93
|
-
ttlResolution;
|
|
94
|
-
ttlAutopurge;
|
|
95
|
-
updateAgeOnGet;
|
|
96
|
-
updateAgeOnHas;
|
|
97
|
-
allowStale;
|
|
98
|
-
noDisposeOnSet;
|
|
99
|
-
noUpdateTTL;
|
|
100
|
-
maxEntrySize;
|
|
101
|
-
sizeCalculation;
|
|
102
|
-
noDeleteOnFetchRejection;
|
|
103
|
-
noDeleteOnStaleGet;
|
|
104
|
-
allowStaleOnFetchAbort;
|
|
105
|
-
allowStaleOnFetchRejection;
|
|
106
|
-
ignoreFetchAbort;
|
|
107
|
-
backgroundFetchSize;
|
|
108
|
-
#n;
|
|
109
|
-
#b;
|
|
110
|
-
#s;
|
|
111
|
-
#i;
|
|
112
|
-
#t;
|
|
113
|
-
#l;
|
|
114
|
-
#u;
|
|
115
|
-
#a;
|
|
116
|
-
#h;
|
|
117
|
-
#y;
|
|
118
|
-
#r;
|
|
119
|
-
#_;
|
|
120
|
-
#F;
|
|
121
|
-
#d;
|
|
122
|
-
#g;
|
|
123
|
-
#T;
|
|
124
|
-
#U;
|
|
125
|
-
#f;
|
|
126
|
-
#D;
|
|
127
|
-
static unsafeExposeInternals(e) {
|
|
128
|
-
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() {
|
|
129
|
-
return e.#a;
|
|
130
|
-
}, get tail() {
|
|
131
|
-
return e.#h;
|
|
132
|
-
}, 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) };
|
|
133
|
-
}
|
|
134
|
-
get max() {
|
|
135
|
-
return this.#o;
|
|
136
|
-
}
|
|
137
|
-
get maxSize() {
|
|
138
|
-
return this.#c;
|
|
139
|
-
}
|
|
140
|
-
get calculatedSize() {
|
|
141
|
-
return this.#b;
|
|
142
|
-
}
|
|
143
|
-
get size() {
|
|
144
|
-
return this.#n;
|
|
145
|
-
}
|
|
146
|
-
get fetchMethod() {
|
|
147
|
-
return this.#M;
|
|
148
|
-
}
|
|
149
|
-
get memoMethod() {
|
|
150
|
-
return this.#I;
|
|
151
|
-
}
|
|
152
|
-
get dispose() {
|
|
153
|
-
return this.#S;
|
|
154
|
-
}
|
|
155
|
-
get onInsert() {
|
|
156
|
-
return this.#O;
|
|
157
|
-
}
|
|
158
|
-
get disposeAfter() {
|
|
159
|
-
return this.#w;
|
|
160
|
-
}
|
|
161
|
-
constructor(e) {
|
|
162
|
-
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;
|
|
163
|
-
if (this.backgroundFetchSize = C2, E !== void 0 && typeof E?.now != "function") throw new TypeError("perf option must have a now() method if specified");
|
|
164
|
-
if (this.#m = E ?? L, t !== 0 && !T(t)) throw new TypeError("max option must be a nonnegative integer");
|
|
165
|
-
let v2 = t ? j(t) : Array;
|
|
166
|
-
if (!v2) throw new Error("invalid max value: " + t);
|
|
167
|
-
if (this.#o = t, this.#c = g2, this.maxEntrySize = f || this.#c, this.sizeCalculation = y2, this.sizeCalculation) {
|
|
168
|
-
if (!this.#c && !this.maxEntrySize) throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");
|
|
169
|
-
if (typeof this.sizeCalculation != "function") throw new TypeError("sizeCalculation set to non-function");
|
|
170
|
-
}
|
|
171
|
-
if (w2 !== void 0 && typeof w2 != "function") throw new TypeError("memoMethod must be a function if defined");
|
|
172
|
-
if (this.#I = w2, a2 !== void 0 && typeof a2 != "function") throw new TypeError("fetchMethod must be a function if specified");
|
|
173
|
-
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) {
|
|
174
|
-
if (this.#c !== 0 && !T(this.#c)) throw new TypeError("maxSize must be a positive integer if specified");
|
|
175
|
-
if (!T(this.maxEntrySize)) throw new TypeError("maxEntrySize must be a positive integer if specified");
|
|
176
|
-
this.#X();
|
|
177
|
-
}
|
|
178
|
-
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) {
|
|
179
|
-
if (!T(this.ttl)) throw new TypeError("ttl must be a positive integer if specified");
|
|
180
|
-
this.#k();
|
|
181
|
-
}
|
|
182
|
-
if (this.#o === 0 && this.ttl === 0 && this.#c === 0) throw new TypeError("At least one of max, maxSize, or ttl is required");
|
|
183
|
-
if (!this.ttlAutopurge && !this.#o && !this.#c) {
|
|
184
|
-
let D = "LRU_CACHE_UNBOUNDED";
|
|
185
|
-
H(D) && (U.add(D), k("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.", "UnboundedCacheWarning", D, d2));
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
getRemainingTTL(e) {
|
|
189
|
-
return this.#s.has(e) ? 1 / 0 : 0;
|
|
190
|
-
}
|
|
191
|
-
#k() {
|
|
192
|
-
let e = new O(this.#o), t = new O(this.#o);
|
|
193
|
-
this.#d = e, this.#F = t;
|
|
194
|
-
let i2 = this.ttlAutopurge ? Array.from({ length: this.#o }) : void 0;
|
|
195
|
-
this.#g = i2, this.#H = (h, r, c = this.#m.now()) => {
|
|
196
|
-
t[h] = r !== 0 ? c : 0, e[h] = r, s(h, r);
|
|
197
|
-
}, this.#R = (h) => {
|
|
198
|
-
t[h] = e[h] !== 0 ? this.#m.now() : 0, s(h, e[h]);
|
|
199
|
-
};
|
|
200
|
-
let s = this.ttlAutopurge ? (h, r) => {
|
|
201
|
-
if (i2?.[h] && (clearTimeout(i2[h]), i2[h] = void 0), r && r !== 0 && i2) {
|
|
202
|
-
let c = setTimeout(() => {
|
|
203
|
-
this.#p(h) ? (this.#E(this.#i[h], "expire"), i2[h] = void 0) : s(h, l(h));
|
|
204
|
-
}, r + 1);
|
|
205
|
-
c.unref && c.unref(), i2[h] = c;
|
|
206
|
-
}
|
|
207
|
-
} : () => {
|
|
208
|
-
};
|
|
209
|
-
this.#v = (h, r) => {
|
|
210
|
-
if (e[r]) {
|
|
211
|
-
let c = e[r], m2 = t[r];
|
|
212
|
-
if (!c || !m2) return;
|
|
213
|
-
h.ttl = c, h.start = m2, h.now = n || o();
|
|
214
|
-
let _2 = h.now - m2;
|
|
215
|
-
h.remainingTTL = c - _2;
|
|
216
|
-
}
|
|
217
|
-
};
|
|
218
|
-
let n = 0, o = () => {
|
|
219
|
-
let h = this.#m.now();
|
|
220
|
-
if (this.ttlResolution > 0) {
|
|
221
|
-
n = h;
|
|
222
|
-
let r = setTimeout(() => n = 0, this.ttlResolution);
|
|
223
|
-
r.unref && r.unref();
|
|
224
|
-
}
|
|
225
|
-
return h;
|
|
226
|
-
};
|
|
227
|
-
this.getRemainingTTL = (h) => {
|
|
228
|
-
let r = this.#s.get(h);
|
|
229
|
-
return r === void 0 ? 0 : l(r);
|
|
230
|
-
};
|
|
231
|
-
let l = (h) => {
|
|
232
|
-
let r = e[h], c = t[h];
|
|
233
|
-
if (!r || !c) return 1 / 0;
|
|
234
|
-
let m2 = (n || o()) - c;
|
|
235
|
-
return r - m2;
|
|
236
|
-
};
|
|
237
|
-
this.#p = (h) => {
|
|
238
|
-
let r = t[h], c = e[h];
|
|
239
|
-
return !!c && !!r && (n || o()) - r > c;
|
|
240
|
-
};
|
|
241
|
-
}
|
|
242
|
-
#R = () => {
|
|
243
|
-
};
|
|
244
|
-
#v = () => {
|
|
245
|
-
};
|
|
246
|
-
#H = () => {
|
|
247
|
-
};
|
|
248
|
-
#p = () => false;
|
|
249
|
-
#X() {
|
|
250
|
-
let e = new O(this.#o);
|
|
251
|
-
this.#b = 0, this.#_ = e, this.#x = (t) => {
|
|
252
|
-
this.#b -= e[t], e[t] = 0;
|
|
253
|
-
}, this.#N = (t, i2, s, n) => {
|
|
254
|
-
if (!T(s)) {
|
|
255
|
-
if (this.#e(i2)) return this.backgroundFetchSize;
|
|
256
|
-
if (n) {
|
|
257
|
-
if (typeof n != "function") throw new TypeError("sizeCalculation must be a function");
|
|
258
|
-
if (s = n(i2, t), !T(s)) throw new TypeError("sizeCalculation return invalid (expect positive integer)");
|
|
259
|
-
} else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");
|
|
260
|
-
}
|
|
261
|
-
return s;
|
|
262
|
-
}, this.#j = (t, i2, s) => {
|
|
263
|
-
if (e[t] = i2, this.#c) {
|
|
264
|
-
let n = this.#c - e[t];
|
|
265
|
-
for (; this.#b > n; ) this.#G(true);
|
|
266
|
-
}
|
|
267
|
-
this.#b += e[t], s && (s.entrySize = i2, s.totalCalculatedSize = this.#b);
|
|
268
|
-
};
|
|
269
|
-
}
|
|
270
|
-
#x = (e) => {
|
|
271
|
-
};
|
|
272
|
-
#j = (e, t, i2) => {
|
|
273
|
-
};
|
|
274
|
-
#N = (e, t, i2, s) => {
|
|
275
|
-
if (i2 || s) throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");
|
|
276
|
-
return 0;
|
|
277
|
-
};
|
|
278
|
-
*#A({ allowStale: e = this.allowStale } = {}) {
|
|
279
|
-
if (this.#n) for (let t = this.#h; this.#V(t) && ((e || !this.#p(t)) && (yield t), t !== this.#a); ) t = this.#u[t];
|
|
280
|
-
}
|
|
281
|
-
*#z({ allowStale: e = this.allowStale } = {}) {
|
|
282
|
-
if (this.#n) for (let t = this.#a; this.#V(t) && ((e || !this.#p(t)) && (yield t), t !== this.#h); ) t = this.#l[t];
|
|
283
|
-
}
|
|
284
|
-
#V(e) {
|
|
285
|
-
return e !== void 0 && this.#s.get(this.#i[e]) === e;
|
|
286
|
-
}
|
|
287
|
-
*entries() {
|
|
288
|
-
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]]);
|
|
289
|
-
}
|
|
290
|
-
*rentries() {
|
|
291
|
-
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]]);
|
|
292
|
-
}
|
|
293
|
-
*keys() {
|
|
294
|
-
for (let e of this.#A()) {
|
|
295
|
-
let t = this.#i[e];
|
|
296
|
-
t !== void 0 && !this.#e(this.#t[e]) && (yield t);
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
*rkeys() {
|
|
300
|
-
for (let e of this.#z()) {
|
|
301
|
-
let t = this.#i[e];
|
|
302
|
-
t !== void 0 && !this.#e(this.#t[e]) && (yield t);
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
*values() {
|
|
306
|
-
for (let e of this.#A()) this.#t[e] !== void 0 && !this.#e(this.#t[e]) && (yield this.#t[e]);
|
|
307
|
-
}
|
|
308
|
-
*rvalues() {
|
|
309
|
-
for (let e of this.#z()) this.#t[e] !== void 0 && !this.#e(this.#t[e]) && (yield this.#t[e]);
|
|
310
|
-
}
|
|
311
|
-
[Symbol.iterator]() {
|
|
312
|
-
return this.entries();
|
|
313
|
-
}
|
|
314
|
-
[Symbol.toStringTag] = "LRUCache";
|
|
315
|
-
find(e, t = {}) {
|
|
316
|
-
for (let i2 of this.#A()) {
|
|
317
|
-
let s = this.#t[i2], n = this.#e(s) ? s.__staleWhileFetching : s;
|
|
318
|
-
if (n !== void 0 && e(n, this.#i[i2], this)) return this.#C(this.#i[i2], t);
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
forEach(e, t = this) {
|
|
322
|
-
for (let i2 of this.#A()) {
|
|
323
|
-
let s = this.#t[i2], n = this.#e(s) ? s.__staleWhileFetching : s;
|
|
324
|
-
n !== void 0 && e.call(t, n, this.#i[i2], this);
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
rforEach(e, t = this) {
|
|
328
|
-
for (let i2 of this.#z()) {
|
|
329
|
-
let s = this.#t[i2], n = this.#e(s) ? s.__staleWhileFetching : s;
|
|
330
|
-
n !== void 0 && e.call(t, n, this.#i[i2], this);
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
purgeStale() {
|
|
334
|
-
let e = false;
|
|
335
|
-
for (let t of this.#z({ allowStale: true })) this.#p(t) && (this.#E(this.#i[t], "expire"), e = true);
|
|
336
|
-
return e;
|
|
337
|
-
}
|
|
338
|
-
info(e) {
|
|
339
|
-
let t = this.#s.get(e);
|
|
340
|
-
if (t === void 0) return;
|
|
341
|
-
let i2 = this.#t[t], s = this.#e(i2) ? i2.__staleWhileFetching : i2;
|
|
342
|
-
if (s === void 0) return;
|
|
343
|
-
let n = { value: s };
|
|
344
|
-
if (this.#d && this.#F) {
|
|
345
|
-
let o = this.#d[t], l = this.#F[t];
|
|
346
|
-
if (o && l) {
|
|
347
|
-
let h = o - (this.#m.now() - l);
|
|
348
|
-
n.ttl = h, n.start = Date.now();
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
return this.#_ && (n.size = this.#_[t]), n;
|
|
352
|
-
}
|
|
353
|
-
dump() {
|
|
354
|
-
let e = [];
|
|
355
|
-
for (let t of this.#A({ allowStale: true })) {
|
|
356
|
-
let i2 = this.#i[t], s = this.#t[t], n = this.#e(s) ? s.__staleWhileFetching : s;
|
|
357
|
-
if (n === void 0 || i2 === void 0) continue;
|
|
358
|
-
let o = { value: n };
|
|
359
|
-
if (this.#d && this.#F) {
|
|
360
|
-
o.ttl = this.#d[t];
|
|
361
|
-
let l = this.#m.now() - this.#F[t];
|
|
362
|
-
o.start = Math.floor(Date.now() - l);
|
|
363
|
-
}
|
|
364
|
-
this.#_ && (o.size = this.#_[t]), e.unshift([i2, o]);
|
|
365
|
-
}
|
|
366
|
-
return e;
|
|
367
|
-
}
|
|
368
|
-
load(e) {
|
|
369
|
-
this.clear();
|
|
370
|
-
for (let [t, i2] of e) {
|
|
371
|
-
if (i2.start) {
|
|
372
|
-
let s = Date.now() - i2.start;
|
|
373
|
-
i2.start = this.#m.now() - s;
|
|
374
|
-
}
|
|
375
|
-
this.#W(t, i2.value, i2);
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
set(e, t, i2 = {}) {
|
|
379
|
-
let { status: s = S.hasSubscribers ? {} : void 0 } = i2;
|
|
380
|
-
i2.status = s, s && (s.op = "set", s.key = e, t !== void 0 && (s.value = t), s.cache = this);
|
|
381
|
-
let n = this.#W(e, t, i2);
|
|
382
|
-
return s && S.hasSubscribers && S.publish(s), n;
|
|
383
|
-
}
|
|
384
|
-
#W(e, t, i2, s) {
|
|
385
|
-
let { ttl: n = this.ttl, start: o, noDisposeOnSet: l = this.noDisposeOnSet, sizeCalculation: h = this.sizeCalculation, status: r } = i2, c = this.#e(t);
|
|
386
|
-
if (t === void 0) return r && (r.set = "deleted"), this.delete(e), this;
|
|
387
|
-
let { noUpdateTTL: m2 = this.noUpdateTTL } = i2;
|
|
388
|
-
r && !c && (r.value = t);
|
|
389
|
-
let _2 = this.#N(e, t, i2.size || 0, h, r);
|
|
390
|
-
if (this.maxEntrySize && _2 > this.maxEntrySize) return this.#E(e, "set"), r && (r.set = "miss", r.maxEntrySizeExceeded = true), this;
|
|
391
|
-
let u2 = this.#n === 0 ? void 0 : this.#s.get(e);
|
|
392
|
-
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");
|
|
393
|
-
else {
|
|
394
|
-
this.#L(u2);
|
|
395
|
-
let g2 = this.#t[u2];
|
|
396
|
-
if (t !== g2) {
|
|
397
|
-
if (!l) if (this.#e(g2)) {
|
|
398
|
-
g2 !== s && g2.__abortController.abort(new Error("replaced"));
|
|
399
|
-
let { __staleWhileFetching: f } = g2;
|
|
400
|
-
f !== void 0 && f !== t && (this.#T && this.#S?.(f, e, "set"), this.#f && this.#r?.push([f, e, "set"]));
|
|
401
|
-
} else this.#T && this.#S?.(g2, e, "set"), this.#f && this.#r?.push([g2, e, "set"]);
|
|
402
|
-
if (this.#x(u2), this.#j(u2, _2, r), this.#t[u2] = t, !c) {
|
|
403
|
-
let f = g2 && this.#e(g2) ? g2.__staleWhileFetching : g2, y2 = f === void 0 ? "add" : t !== f ? "replace" : "update";
|
|
404
|
-
r && (r.set = y2, f !== void 0 && (r.oldValue = f)), this.#D && this.onInsert?.(t, e, y2);
|
|
405
|
-
}
|
|
406
|
-
} else c || (r && (r.set = "update"), this.#D && this.onInsert?.(t, e, "update"));
|
|
407
|
-
}
|
|
408
|
-
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) {
|
|
409
|
-
let g2 = this.#r, f;
|
|
410
|
-
for (; f = g2?.shift(); ) this.#w?.(...f);
|
|
411
|
-
}
|
|
412
|
-
return this;
|
|
413
|
-
}
|
|
414
|
-
pop() {
|
|
415
|
-
try {
|
|
416
|
-
for (; this.#n; ) {
|
|
417
|
-
let e = this.#t[this.#a];
|
|
418
|
-
if (this.#G(true), this.#e(e)) {
|
|
419
|
-
if (e.__staleWhileFetching) return e.__staleWhileFetching;
|
|
420
|
-
} else if (e !== void 0) return e;
|
|
421
|
-
}
|
|
422
|
-
} finally {
|
|
423
|
-
if (this.#f && this.#r) {
|
|
424
|
-
let e = this.#r, t;
|
|
425
|
-
for (; t = e?.shift(); ) this.#w?.(...t);
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
#G(e) {
|
|
430
|
-
let t = this.#a, i2 = this.#i[t], s = this.#t[t], n = this.#e(s);
|
|
431
|
-
n && s.__abortController.abort(new Error("evicted"));
|
|
432
|
-
let o = n ? s.__staleWhileFetching : s;
|
|
433
|
-
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;
|
|
434
|
-
}
|
|
435
|
-
has(e, t = {}) {
|
|
436
|
-
let { status: i2 = S.hasSubscribers ? {} : void 0 } = t;
|
|
437
|
-
t.status = i2, i2 && (i2.op = "has", i2.key = e, i2.cache = this);
|
|
438
|
-
let s = this.#Y(e, t);
|
|
439
|
-
return S.hasSubscribers && S.publish(i2), s;
|
|
440
|
-
}
|
|
441
|
-
#Y(e, t = {}) {
|
|
442
|
-
let { updateAgeOnHas: i2 = this.updateAgeOnHas, status: s } = t, n = this.#s.get(e);
|
|
443
|
-
if (n !== void 0) {
|
|
444
|
-
let o = this.#t[n];
|
|
445
|
-
if (this.#e(o) && o.__staleWhileFetching === void 0) return false;
|
|
446
|
-
if (this.#p(n)) s && (s.has = "stale", this.#v(s, n));
|
|
447
|
-
else return i2 && this.#R(n), s && (s.has = "hit", this.#v(s, n)), true;
|
|
448
|
-
} else s && (s.has = "miss");
|
|
449
|
-
return false;
|
|
450
|
-
}
|
|
451
|
-
peek(e, t = {}) {
|
|
452
|
-
let { status: i2 = R() ? {} : void 0 } = t;
|
|
453
|
-
i2 && (i2.op = "peek", i2.key = e, i2.cache = this), t.status = i2;
|
|
454
|
-
let s = this.#J(e, t);
|
|
455
|
-
return S.hasSubscribers && S.publish(i2), s;
|
|
456
|
-
}
|
|
457
|
-
#J(e, t) {
|
|
458
|
-
let { status: i2, allowStale: s = this.allowStale } = t, n = this.#s.get(e);
|
|
459
|
-
if (n === void 0 || !s && this.#p(n)) {
|
|
460
|
-
i2 && (i2.peek = n === void 0 ? "miss" : "stale");
|
|
461
|
-
return;
|
|
462
|
-
}
|
|
463
|
-
let o = this.#t[n], l = this.#e(o) ? o.__staleWhileFetching : o;
|
|
464
|
-
return i2 && (l !== void 0 ? (i2.peek = "hit", i2.value = l) : i2.peek = "miss"), l;
|
|
465
|
-
}
|
|
466
|
-
#P(e, t, i2, s) {
|
|
467
|
-
let n = t === void 0 ? void 0 : this.#t[t];
|
|
468
|
-
if (this.#e(n)) return n;
|
|
469
|
-
let o = new AbortController(), { signal: l } = i2;
|
|
470
|
-
l?.addEventListener("abort", () => o.abort(l.reason), { signal: o.signal });
|
|
471
|
-
let h = { signal: o.signal, options: i2, context: s }, r = (f, y2 = false) => {
|
|
472
|
-
let { aborted: a2 } = o.signal, w2 = i2.ignoreFetchAbort && f !== void 0, F2 = i2.ignoreFetchAbort || !!(i2.allowStaleOnFetchAbort && f !== void 0);
|
|
473
|
-
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);
|
|
474
|
-
let b = u2, p = this.#t[t];
|
|
475
|
-
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;
|
|
476
|
-
}, c = (f) => (i2.status && (i2.status.fetchRejected = true, i2.status.fetchError = f), m2(f, false)), m2 = (f, y2) => {
|
|
477
|
-
let { aborted: a2 } = o.signal, w2 = a2 && i2.allowStaleOnFetchAbort, F2 = w2 || i2.allowStaleOnFetchRejection, b = F2 || i2.noDeleteOnFetchRejection, p = u2;
|
|
478
|
-
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;
|
|
479
|
-
if (p.__returned === p) throw f;
|
|
480
|
-
}, _2 = (f, y2) => {
|
|
481
|
-
let a2 = this.#M?.(e, n, h);
|
|
482
|
-
o.signal.addEventListener("abort", () => {
|
|
483
|
-
(!i2.ignoreFetchAbort || i2.allowStaleOnFetchAbort) && (f(void 0), i2.allowStaleOnFetchAbort && (f = (w2) => r(w2, true)));
|
|
484
|
-
}), a2 && a2 instanceof Promise ? a2.then((w2) => f(w2 === void 0 ? void 0 : w2), y2) : a2 !== void 0 && f(a2);
|
|
485
|
-
};
|
|
486
|
-
i2.status && (i2.status.fetchDispatched = true);
|
|
487
|
-
let u2 = new Promise(_2).then(r, c), g2 = Object.assign(u2, { __abortController: o, __staleWhileFetching: n, __returned: void 0 });
|
|
488
|
-
return t === void 0 ? (this.#W(e, g2, { ...h.options, status: void 0 }), t = this.#s.get(e)) : this.#t[t] = g2, g2;
|
|
489
|
-
}
|
|
490
|
-
#e(e) {
|
|
491
|
-
if (!this.#U) return false;
|
|
492
|
-
let t = e;
|
|
493
|
-
return !!t && t instanceof Promise && t.hasOwnProperty("__staleWhileFetching") && t.__abortController instanceof AbortController;
|
|
494
|
-
}
|
|
495
|
-
fetch(e, t = {}) {
|
|
496
|
-
let i2 = W.hasSubscribers, { status: s = R() ? {} : void 0 } = t;
|
|
497
|
-
t.status = s, s && t.context && (s.context = t.context);
|
|
498
|
-
let n = this.#B(e, t);
|
|
499
|
-
return s && i2 && (s.trace = true, W.tracePromise(() => n, s).catch(() => {
|
|
500
|
-
})), n;
|
|
501
|
-
}
|
|
502
|
-
async #B(e, t = {}) {
|
|
503
|
-
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;
|
|
504
|
-
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 });
|
|
505
|
-
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);
|
|
506
|
-
if (b === void 0) {
|
|
507
|
-
a2 && (a2.fetch = "miss");
|
|
508
|
-
let p = this.#P(e, b, F2, f);
|
|
509
|
-
return p.__returned = p;
|
|
510
|
-
} else {
|
|
511
|
-
let p = this.#t[b];
|
|
512
|
-
if (this.#e(p)) {
|
|
513
|
-
let v2 = i2 && p.__staleWhileFetching !== void 0;
|
|
514
|
-
return a2 && (a2.fetch = "inflight", v2 && (a2.returnedStale = true)), v2 ? p.__staleWhileFetching : p.__returned = p;
|
|
515
|
-
}
|
|
516
|
-
let A2 = this.#p(b);
|
|
517
|
-
if (!y2 && !A2) return a2 && (a2.fetch = "hit"), this.#L(b), s && this.#R(b), a2 && this.#v(a2, b), p;
|
|
518
|
-
let z = this.#P(e, b, F2, f), E = z.__staleWhileFetching !== void 0 && i2;
|
|
519
|
-
return a2 && (a2.fetch = A2 ? "stale" : "refresh", E && A2 && (a2.returnedStale = true)), E ? z.__staleWhileFetching : z.__returned = z;
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
forceFetch(e, t = {}) {
|
|
523
|
-
let i2 = W.hasSubscribers, { status: s = R() ? {} : void 0 } = t;
|
|
524
|
-
t.status = s, s && t.context && (s.context = t.context);
|
|
525
|
-
let n = this.#K(e, t);
|
|
526
|
-
return s && i2 && (s.trace = true, W.tracePromise(() => n, s).catch(() => {
|
|
527
|
-
})), n;
|
|
528
|
-
}
|
|
529
|
-
async #K(e, t = {}) {
|
|
530
|
-
let i2 = await this.#B(e, t);
|
|
531
|
-
if (i2 === void 0) throw new Error("fetch() returned undefined");
|
|
532
|
-
return i2;
|
|
533
|
-
}
|
|
534
|
-
memo(e, t = {}) {
|
|
535
|
-
let { status: i2 = S.hasSubscribers ? {} : void 0 } = t;
|
|
536
|
-
t.status = i2, i2 && (i2.op = "memo", i2.key = e, t.context && (i2.context = t.context), i2.cache = this);
|
|
537
|
-
let s = this.#Q(e, t);
|
|
538
|
-
return i2 && (i2.value = s), S.hasSubscribers && S.publish(i2), s;
|
|
539
|
-
}
|
|
540
|
-
#Q(e, t = {}) {
|
|
541
|
-
let i2 = this.#I;
|
|
542
|
-
if (!i2) throw new Error("no memoMethod provided to constructor");
|
|
543
|
-
let { context: s, status: n, forceRefresh: o, ...l } = t;
|
|
544
|
-
n && o && (n.forceRefresh = true);
|
|
545
|
-
let h = this.#C(e, l), r = o || h === void 0;
|
|
546
|
-
if (n && (n.memo = r ? "miss" : "hit", r || (n.value = h)), !r) return h;
|
|
547
|
-
let c = i2(e, h, { options: l, context: s });
|
|
548
|
-
return n && (n.value = c), this.#W(e, c, l), c;
|
|
549
|
-
}
|
|
550
|
-
get(e, t = {}) {
|
|
551
|
-
let { status: i2 = S.hasSubscribers ? {} : void 0 } = t;
|
|
552
|
-
t.status = i2, i2 && (i2.op = "get", i2.key = e, i2.cache = this);
|
|
553
|
-
let s = this.#C(e, t);
|
|
554
|
-
return i2 && (s !== void 0 && (i2.value = s), S.hasSubscribers && S.publish(i2)), s;
|
|
555
|
-
}
|
|
556
|
-
#C(e, t = {}) {
|
|
557
|
-
let { allowStale: i2 = this.allowStale, updateAgeOnGet: s = this.updateAgeOnGet, noDeleteOnStaleGet: n = this.noDeleteOnStaleGet, status: o } = t, l = this.#s.get(e);
|
|
558
|
-
if (l === void 0) {
|
|
559
|
-
o && (o.get = "miss");
|
|
560
|
-
return;
|
|
561
|
-
}
|
|
562
|
-
let h = this.#t[l], r = this.#e(h);
|
|
563
|
-
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);
|
|
564
|
-
}
|
|
565
|
-
#$(e, t) {
|
|
566
|
-
this.#u[t] = e, this.#l[e] = t;
|
|
567
|
-
}
|
|
568
|
-
#L(e) {
|
|
569
|
-
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);
|
|
570
|
-
}
|
|
571
|
-
delete(e) {
|
|
572
|
-
return this.#E(e, "delete");
|
|
573
|
-
}
|
|
574
|
-
#E(e, t) {
|
|
575
|
-
S.hasSubscribers && S.publish({ op: "delete", delete: t, key: e, cache: this });
|
|
576
|
-
let i2 = false;
|
|
577
|
-
if (this.#n !== 0) {
|
|
578
|
-
let s = this.#s.get(e);
|
|
579
|
-
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);
|
|
580
|
-
else {
|
|
581
|
-
this.#x(s);
|
|
582
|
-
let n = this.#t[s];
|
|
583
|
-
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];
|
|
584
|
-
else if (s === this.#a) this.#a = this.#l[s];
|
|
585
|
-
else {
|
|
586
|
-
let o = this.#u[s];
|
|
587
|
-
this.#l[o] = this.#l[s];
|
|
588
|
-
let l = this.#l[s];
|
|
589
|
-
this.#u[l] = this.#u[s];
|
|
590
|
-
}
|
|
591
|
-
this.#n--, this.#y.push(s);
|
|
592
|
-
}
|
|
593
|
-
}
|
|
594
|
-
if (this.#f && this.#r?.length) {
|
|
595
|
-
let s = this.#r, n;
|
|
596
|
-
for (; n = s?.shift(); ) this.#w?.(...n);
|
|
597
|
-
}
|
|
598
|
-
return i2;
|
|
599
|
-
}
|
|
600
|
-
clear() {
|
|
601
|
-
return this.#q("delete");
|
|
602
|
-
}
|
|
603
|
-
#q(e) {
|
|
604
|
-
for (let t of this.#z({ allowStale: true })) {
|
|
605
|
-
let i2 = this.#t[t];
|
|
606
|
-
if (this.#e(i2)) i2.__abortController.abort(new Error("deleted"));
|
|
607
|
-
else {
|
|
608
|
-
let s = this.#i[t];
|
|
609
|
-
this.#T && this.#S?.(i2, s, e), this.#f && this.#r?.push([i2, s, e]);
|
|
610
|
-
}
|
|
611
|
-
}
|
|
612
|
-
if (this.#s.clear(), this.#t.fill(void 0), this.#i.fill(void 0), this.#d && this.#F) {
|
|
613
|
-
this.#d.fill(0), this.#F.fill(0);
|
|
614
|
-
for (let t of this.#g ?? []) t !== void 0 && clearTimeout(t);
|
|
615
|
-
this.#g?.fill(void 0);
|
|
616
|
-
}
|
|
617
|
-
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) {
|
|
618
|
-
let t = this.#r, i2;
|
|
619
|
-
for (; i2 = t?.shift(); ) this.#w?.(...i2);
|
|
620
|
-
}
|
|
621
|
-
}
|
|
622
|
-
};
|
|
623
|
-
|
|
624
|
-
// ../../src/promise-spawn/src/index.ts
|
|
625
|
-
import { spawn } from "node:child_process";
|
|
626
|
-
var isPipe = (stdio = "pipe", fd) => stdio === "pipe" || stdio === "overlapped" || stdio === null ? true : Array.isArray(stdio) ? isPipe(stdio[fd], fd) : false;
|
|
627
|
-
function stdioResult(stdout, stderr, o) {
|
|
628
|
-
return {
|
|
629
|
-
stdout: !isPipe(o.stdio, 1) ? null : o.stdioString !== false ? Buffer.concat(stdout).toString().trim() : Buffer.concat(stdout),
|
|
630
|
-
stderr: !isPipe(o.stdio, 2) ? null : o.stdioString !== false ? Buffer.concat(stderr).toString().trim() : Buffer.concat(stderr)
|
|
631
|
-
};
|
|
632
|
-
}
|
|
633
|
-
var SpawnPromise = class extends Promise {
|
|
634
|
-
[Symbol.toStringTag] = "SpawnPromise";
|
|
635
|
-
/** The spawned process this promise references */
|
|
636
|
-
process;
|
|
637
|
-
/** Expose the child process stdin, if available */
|
|
638
|
-
stdin;
|
|
639
|
-
/**
|
|
640
|
-
* Set static `Symbol.species` back to the base Promise class so that
|
|
641
|
-
* v8 doesn't get confused by the changed constructor signature.
|
|
642
|
-
*/
|
|
643
|
-
static get [Symbol.species]() {
|
|
644
|
-
return Promise;
|
|
645
|
-
}
|
|
646
|
-
constructor(command, args, opts, extra = {}) {
|
|
647
|
-
let proc;
|
|
648
|
-
super((res, rej) => {
|
|
649
|
-
proc = spawn(command, args, opts);
|
|
650
|
-
const stdout = [];
|
|
651
|
-
const stderr = [];
|
|
652
|
-
const reject = (er, status, signal) => {
|
|
653
|
-
const stdio = stdioResult(stdout, stderr, opts);
|
|
654
|
-
const errorResult = {
|
|
655
|
-
command,
|
|
656
|
-
args,
|
|
657
|
-
stdout: stdio.stdout,
|
|
658
|
-
stderr: stdio.stderr,
|
|
659
|
-
cwd: opts.cwd?.toString() ?? process.cwd()
|
|
660
|
-
};
|
|
661
|
-
if (er !== void 0) {
|
|
662
|
-
errorResult.cause = er;
|
|
663
|
-
}
|
|
664
|
-
if (status !== void 0) {
|
|
665
|
-
errorResult.status = status;
|
|
666
|
-
}
|
|
667
|
-
if (signal !== void 0) {
|
|
668
|
-
errorResult.signal = signal;
|
|
669
|
-
}
|
|
670
|
-
Object.assign(errorResult, extra);
|
|
671
|
-
rej(error("command failed", errorResult));
|
|
672
|
-
};
|
|
673
|
-
const resolve = (status, signal) => {
|
|
674
|
-
const stdio = stdioResult(stdout, stderr, opts);
|
|
675
|
-
const successResult = {
|
|
676
|
-
command,
|
|
677
|
-
args,
|
|
678
|
-
status,
|
|
679
|
-
signal,
|
|
680
|
-
stdout: stdio.stdout,
|
|
681
|
-
stderr: stdio.stderr,
|
|
682
|
-
cwd: opts.cwd?.toString() ?? process.cwd()
|
|
683
|
-
};
|
|
684
|
-
Object.assign(successResult, extra);
|
|
685
|
-
res(successResult);
|
|
686
|
-
};
|
|
687
|
-
proc.on("error", reject);
|
|
688
|
-
proc.stdout?.on("data", (c) => stdout.push(c)).on("error", reject);
|
|
689
|
-
proc.stderr?.on("data", (c) => stderr.push(c)).on("error", reject);
|
|
690
|
-
proc.on("close", (status, signal) => {
|
|
691
|
-
if ((status || signal) && !opts.acceptFail) {
|
|
692
|
-
reject(void 0, status, signal);
|
|
693
|
-
} else {
|
|
694
|
-
resolve(status, signal);
|
|
695
|
-
}
|
|
696
|
-
});
|
|
697
|
-
});
|
|
698
|
-
this.process = proc;
|
|
699
|
-
this.stdin = proc.stdin;
|
|
700
|
-
}
|
|
701
|
-
};
|
|
702
|
-
function promiseSpawn(command, args, opts = {}, extra = {}) {
|
|
703
|
-
return new SpawnPromise(command, args, opts, extra);
|
|
704
|
-
}
|
|
705
|
-
|
|
706
|
-
// ../../node_modules/.vlt/~npm~isexe@3.1.5/node_modules/isexe/dist/esm/index.min.js
|
|
707
|
-
import { statSync as w } from "node:fs";
|
|
708
|
-
import { stat as S2 } from "node:fs/promises";
|
|
709
|
-
import { statSync as k2 } from "node:fs";
|
|
710
|
-
import { stat as I2 } from "node:fs/promises";
|
|
711
|
-
import { delimiter as _ } from "node:path";
|
|
712
|
-
var y = Object.defineProperty;
|
|
713
|
-
var u = (t, r) => {
|
|
714
|
-
for (var e in r) y(t, e, { get: r[e], enumerable: true });
|
|
715
|
-
};
|
|
716
|
-
var i = {};
|
|
717
|
-
u(i, { isexe: () => C, sync: () => A });
|
|
718
|
-
var C = async (t, r = {}) => {
|
|
719
|
-
let { ignoreErrors: e = false } = r;
|
|
720
|
-
try {
|
|
721
|
-
return d3(await S2(t), r);
|
|
722
|
-
} catch (s) {
|
|
723
|
-
let o = s;
|
|
724
|
-
if (e || o.code === "EACCES") return false;
|
|
725
|
-
throw o;
|
|
726
|
-
}
|
|
727
|
-
};
|
|
728
|
-
var A = (t, r = {}) => {
|
|
729
|
-
let { ignoreErrors: e = false } = r;
|
|
730
|
-
try {
|
|
731
|
-
return d3(w(t), r);
|
|
732
|
-
} catch (s) {
|
|
733
|
-
let o = s;
|
|
734
|
-
if (e || o.code === "EACCES") return false;
|
|
735
|
-
throw o;
|
|
736
|
-
}
|
|
737
|
-
};
|
|
738
|
-
var d3 = (t, r) => t.isFile() && T2(t, r);
|
|
739
|
-
var T2 = (t, r) => {
|
|
740
|
-
let e = r.uid ?? process.getuid?.(), s = r.groups ?? process.getgroups?.() ?? [], o = r.gid ?? process.getgid?.() ?? s[0];
|
|
741
|
-
if (e === void 0 || o === void 0) throw new Error("cannot get uid or gid");
|
|
742
|
-
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;
|
|
743
|
-
return !!(n & x2 || n & p && c.has(E) || n & f && l === e || n & h && e === 0);
|
|
744
|
-
};
|
|
745
|
-
var a = {};
|
|
746
|
-
u(a, { isexe: () => F, sync: () => L2 });
|
|
747
|
-
var F = async (t, r = {}) => {
|
|
748
|
-
let { ignoreErrors: e = false } = r;
|
|
749
|
-
try {
|
|
750
|
-
return m(await I2(t), t, r);
|
|
751
|
-
} catch (s) {
|
|
752
|
-
let o = s;
|
|
753
|
-
if (e || o.code === "EACCES") return false;
|
|
754
|
-
throw o;
|
|
755
|
-
}
|
|
756
|
-
};
|
|
757
|
-
var L2 = (t, r = {}) => {
|
|
758
|
-
let { ignoreErrors: e = false } = r;
|
|
759
|
-
try {
|
|
760
|
-
return m(k2(t), t, r);
|
|
761
|
-
} catch (s) {
|
|
762
|
-
let o = s;
|
|
763
|
-
if (e || o.code === "EACCES") return false;
|
|
764
|
-
throw o;
|
|
765
|
-
}
|
|
766
|
-
};
|
|
767
|
-
var P2 = (t, r) => {
|
|
768
|
-
let { pathExt: e = process.env.PATHEXT || "" } = r, s = e.split(_);
|
|
769
|
-
if (s.indexOf("") !== -1) return true;
|
|
770
|
-
for (let o of s) {
|
|
771
|
-
let c = o.toLowerCase(), n = t.substring(t.length - c.length).toLowerCase();
|
|
772
|
-
if (c && n === c) return true;
|
|
773
|
-
}
|
|
774
|
-
return false;
|
|
775
|
-
};
|
|
776
|
-
var m = (t, r, e) => t.isFile() && P2(r, e);
|
|
777
|
-
var v = process.env._ISEXE_TEST_PLATFORM_ || process.platform;
|
|
778
|
-
var g = v === "win32" ? a : i;
|
|
779
|
-
var R2 = g.isexe;
|
|
780
|
-
var U2 = g.sync;
|
|
781
|
-
|
|
782
|
-
// ../../src/which/src/index.ts
|
|
783
|
-
import { delimiter, join, sep } from "node:path";
|
|
784
|
-
var isWindows = process.platform === "win32";
|
|
785
|
-
var rSlash = sep === "/" ? /\// : /[\\/]/;
|
|
786
|
-
var rRel = new RegExp(`^\\.${rSlash.source}`);
|
|
787
|
-
var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
|
|
788
|
-
var getPathInfo = (cmd, {
|
|
789
|
-
path: optPath = process.env.PATH,
|
|
790
|
-
pathExt: optPathExt = process.env.PATHEXT,
|
|
791
|
-
delimiter: optDelimiter = delimiter
|
|
792
|
-
}) => {
|
|
793
|
-
const pathEnv = cmd.match(rSlash) ? [""] : [
|
|
794
|
-
// windows always checks the cwd first
|
|
795
|
-
/* c8 ignore next - platform-specific */
|
|
796
|
-
...isWindows ? [process.cwd()] : [],
|
|
797
|
-
...(optPath ?? /* c8 ignore next - very unusual */
|
|
798
|
-
"").split(
|
|
799
|
-
optDelimiter
|
|
800
|
-
)
|
|
801
|
-
];
|
|
802
|
-
if (isWindows) {
|
|
803
|
-
const pathExtExe = optPathExt || [".EXE", ".CMD", ".BAT", ".COM"].join(optDelimiter);
|
|
804
|
-
const pathExt = pathExtExe.split(optDelimiter).flatMap((item) => [item, item.toLowerCase()]);
|
|
805
|
-
if (cmd.includes(".") && pathExt[0] !== "") {
|
|
806
|
-
pathExt.unshift("");
|
|
807
|
-
}
|
|
808
|
-
return { pathEnv, pathExt, pathExtExe };
|
|
809
|
-
}
|
|
810
|
-
return { pathEnv, pathExt: [""] };
|
|
811
|
-
};
|
|
812
|
-
var getPathPart = (raw, cmd) => {
|
|
813
|
-
const pathPart = /^".*"$/.test(raw) ? raw.slice(1, -1) : raw;
|
|
814
|
-
const prefix = !pathPart && rRel.test(cmd) ? cmd.slice(0, 2) : "";
|
|
815
|
-
return prefix + join(pathPart, cmd);
|
|
816
|
-
};
|
|
817
|
-
async function which(cmd, opt = {}) {
|
|
818
|
-
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
819
|
-
const found = [];
|
|
820
|
-
for (const envPart of pathEnv) {
|
|
821
|
-
const p = getPathPart(envPart, cmd);
|
|
822
|
-
for (const ext of pathExt) {
|
|
823
|
-
const withExt = p + ext;
|
|
824
|
-
const is = await R2(withExt, {
|
|
825
|
-
pathExt: pathExtExe,
|
|
826
|
-
ignoreErrors: true
|
|
827
|
-
});
|
|
828
|
-
if (is) {
|
|
829
|
-
if (!opt.all) {
|
|
830
|
-
return withExt;
|
|
831
|
-
}
|
|
832
|
-
found.push(withExt);
|
|
833
|
-
}
|
|
834
|
-
}
|
|
835
|
-
}
|
|
836
|
-
if (opt.all && found.length) {
|
|
837
|
-
return found;
|
|
838
|
-
}
|
|
839
|
-
if (opt.nothrow) {
|
|
840
|
-
return null;
|
|
841
|
-
}
|
|
842
|
-
throw getNotFoundError(cmd);
|
|
843
|
-
}
|
|
844
|
-
function whichSync(cmd, opt = {}) {
|
|
845
|
-
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
|
846
|
-
const found = [];
|
|
847
|
-
for (const pathEnvPart of pathEnv) {
|
|
848
|
-
const p = getPathPart(pathEnvPart, cmd);
|
|
849
|
-
for (const ext of pathExt) {
|
|
850
|
-
const withExt = p + ext;
|
|
851
|
-
const is = U2(withExt, {
|
|
852
|
-
pathExt: pathExtExe,
|
|
853
|
-
ignoreErrors: true
|
|
854
|
-
});
|
|
855
|
-
if (is) {
|
|
856
|
-
if (!opt.all) {
|
|
857
|
-
return withExt;
|
|
858
|
-
}
|
|
859
|
-
found.push(withExt);
|
|
860
|
-
}
|
|
861
|
-
}
|
|
862
|
-
}
|
|
863
|
-
if (opt.all && found.length) {
|
|
864
|
-
return found;
|
|
865
|
-
}
|
|
866
|
-
if (opt.nothrow) {
|
|
867
|
-
return null;
|
|
868
|
-
}
|
|
869
|
-
throw getNotFoundError(cmd);
|
|
870
|
-
}
|
|
871
|
-
|
|
872
|
-
export {
|
|
873
|
-
I,
|
|
874
|
-
promiseSpawn,
|
|
875
|
-
which,
|
|
876
|
-
whichSync,
|
|
877
|
-
emitter,
|
|
878
|
-
logRequest,
|
|
879
|
-
graphStep
|
|
880
|
-
};
|