wp-typia 0.22.7 → 0.22.8
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/dist-bunli/.bunli/commands.gen.js +1054 -830
- package/dist-bunli/{cli-add-8jpdnz1r.js → cli-add-1xvw17yg.js} +142 -119
- package/dist-bunli/{cli-2hsp17nd.js → cli-arz4rcye.js} +13 -4
- package/dist-bunli/{cli-ta3y0hp2.js → cli-bbj0kn1e.js} +122 -25
- package/dist-bunli/{cli-27v2qpjg.js → cli-bwwssctv.js} +1 -1
- package/dist-bunli/{cli-doctor-h5tq4ztr.js → cli-doctor-bjv6z74k.js} +3 -3
- package/dist-bunli/{cli-cjygr56g.js → cli-e7n7hbvr.js} +3 -3
- package/dist-bunli/{cli-8snabymq.js → cli-fa7g1aqm.js} +334 -3966
- package/dist-bunli/{cli-init-w9p558th.js → cli-init-zdfrmp3y.js} +3 -3
- package/dist-bunli/cli-mzvzbpnz.js +3702 -0
- package/dist-bunli/{cli-10pe4mf8.js → cli-pnjx2e2h.js} +1 -1
- package/dist-bunli/{cli-tke8twkn.js → cli-qse6myha.js} +4 -6
- package/dist-bunli/{cli-scaffold-qve8rqja.js → cli-scaffold-pbb67zxg.js} +10 -8
- package/dist-bunli/{cli-templates-9t2a7zqd.js → cli-templates-hc71dfc2.js} +1 -1
- package/dist-bunli/cli.js +11 -8
- package/dist-bunli/{command-list-6zr1tj96.js → command-list-hbcv3bz6.js} +54 -38
- package/dist-bunli/create-template-validation-7k2752mz.js +14 -0
- package/dist-bunli/{migrations-v0avgyg6.js → migrations-ads3j14z.js} +4 -3
- package/dist-bunli/node-cli.js +443 -413
- package/package.json +2 -2
|
@@ -0,0 +1,3702 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
BUILTIN_TEMPLATE_IDS,
|
|
4
|
+
OFFICIAL_WORKSPACE_TEMPLATE_ALIAS,
|
|
5
|
+
OFFICIAL_WORKSPACE_TEMPLATE_PACKAGE,
|
|
6
|
+
TEMPLATE_IDS,
|
|
7
|
+
getRemovedBuiltInTemplateMessage,
|
|
8
|
+
getTemplateById,
|
|
9
|
+
isBuiltInTemplateId,
|
|
10
|
+
isRemovedBuiltInTemplateId
|
|
11
|
+
} from "./cli-qse6myha.js";
|
|
12
|
+
import {
|
|
13
|
+
CLI_DIAGNOSTIC_CODES,
|
|
14
|
+
createCliDiagnosticCodeError
|
|
15
|
+
} from "./cli-p95wr1q8.js";
|
|
16
|
+
import {
|
|
17
|
+
__commonJS,
|
|
18
|
+
__require,
|
|
19
|
+
__toESM
|
|
20
|
+
} from "./cli-xnn9xjcy.js";
|
|
21
|
+
|
|
22
|
+
// ../../node_modules/.bun/lru-cache@11.2.7/node_modules/lru-cache/dist/commonjs/index.min.js
|
|
23
|
+
var require_index_min = __commonJS((exports) => {
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.LRUCache = undefined;
|
|
26
|
+
var G = typeof performance == "object" && performance && typeof performance.now == "function" ? performance : Date;
|
|
27
|
+
var U = new Set;
|
|
28
|
+
var R = typeof process == "object" && process ? process : {};
|
|
29
|
+
var I = (c, t, e, i) => {
|
|
30
|
+
typeof R.emitWarning == "function" ? R.emitWarning(c, t, e, i) : console.error(`[${e}] ${t}: ${c}`);
|
|
31
|
+
};
|
|
32
|
+
var C = globalThis.AbortController;
|
|
33
|
+
var L = globalThis.AbortSignal;
|
|
34
|
+
if (typeof C > "u") {
|
|
35
|
+
L = class {
|
|
36
|
+
onabort;
|
|
37
|
+
_onabort = [];
|
|
38
|
+
reason;
|
|
39
|
+
aborted = false;
|
|
40
|
+
addEventListener(i, s) {
|
|
41
|
+
this._onabort.push(s);
|
|
42
|
+
}
|
|
43
|
+
}, C = class {
|
|
44
|
+
constructor() {
|
|
45
|
+
t();
|
|
46
|
+
}
|
|
47
|
+
signal = new L;
|
|
48
|
+
abort(i) {
|
|
49
|
+
if (!this.signal.aborted) {
|
|
50
|
+
this.signal.reason = i, this.signal.aborted = true;
|
|
51
|
+
for (let s of this.signal._onabort)
|
|
52
|
+
s(i);
|
|
53
|
+
this.signal.onabort?.(i);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
let c = R.env?.LRU_CACHE_IGNORE_AC_WARNING !== "1", t = () => {
|
|
58
|
+
c && (c = false, I("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.", "NO_ABORT_CONTROLLER", "ENOTSUP", t));
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
var x = (c) => !U.has(c);
|
|
62
|
+
var H = Symbol("type");
|
|
63
|
+
var y = (c) => c && c === Math.floor(c) && c > 0 && isFinite(c);
|
|
64
|
+
var M = (c) => y(c) ? c <= Math.pow(2, 8) ? Uint8Array : c <= Math.pow(2, 16) ? Uint16Array : c <= Math.pow(2, 32) ? Uint32Array : c <= Number.MAX_SAFE_INTEGER ? z : null : null;
|
|
65
|
+
var z = class extends Array {
|
|
66
|
+
constructor(t) {
|
|
67
|
+
super(t), this.fill(0);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
var W = class c {
|
|
71
|
+
heap;
|
|
72
|
+
length;
|
|
73
|
+
static #o = false;
|
|
74
|
+
static create(t) {
|
|
75
|
+
let e = M(t);
|
|
76
|
+
if (!e)
|
|
77
|
+
return [];
|
|
78
|
+
c.#o = true;
|
|
79
|
+
let i = new c(t, e);
|
|
80
|
+
return c.#o = false, i;
|
|
81
|
+
}
|
|
82
|
+
constructor(t, e) {
|
|
83
|
+
if (!c.#o)
|
|
84
|
+
throw new TypeError("instantiate Stack using Stack.create(n)");
|
|
85
|
+
this.heap = new e(t), this.length = 0;
|
|
86
|
+
}
|
|
87
|
+
push(t) {
|
|
88
|
+
this.heap[this.length++] = t;
|
|
89
|
+
}
|
|
90
|
+
pop() {
|
|
91
|
+
return this.heap[--this.length];
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
var D = class c {
|
|
95
|
+
#o;
|
|
96
|
+
#c;
|
|
97
|
+
#w;
|
|
98
|
+
#C;
|
|
99
|
+
#S;
|
|
100
|
+
#L;
|
|
101
|
+
#U;
|
|
102
|
+
#m;
|
|
103
|
+
get perf() {
|
|
104
|
+
return this.#m;
|
|
105
|
+
}
|
|
106
|
+
ttl;
|
|
107
|
+
ttlResolution;
|
|
108
|
+
ttlAutopurge;
|
|
109
|
+
updateAgeOnGet;
|
|
110
|
+
updateAgeOnHas;
|
|
111
|
+
allowStale;
|
|
112
|
+
noDisposeOnSet;
|
|
113
|
+
noUpdateTTL;
|
|
114
|
+
maxEntrySize;
|
|
115
|
+
sizeCalculation;
|
|
116
|
+
noDeleteOnFetchRejection;
|
|
117
|
+
noDeleteOnStaleGet;
|
|
118
|
+
allowStaleOnFetchAbort;
|
|
119
|
+
allowStaleOnFetchRejection;
|
|
120
|
+
ignoreFetchAbort;
|
|
121
|
+
#n;
|
|
122
|
+
#_;
|
|
123
|
+
#s;
|
|
124
|
+
#i;
|
|
125
|
+
#t;
|
|
126
|
+
#a;
|
|
127
|
+
#u;
|
|
128
|
+
#l;
|
|
129
|
+
#h;
|
|
130
|
+
#b;
|
|
131
|
+
#r;
|
|
132
|
+
#y;
|
|
133
|
+
#A;
|
|
134
|
+
#d;
|
|
135
|
+
#g;
|
|
136
|
+
#T;
|
|
137
|
+
#v;
|
|
138
|
+
#f;
|
|
139
|
+
#I;
|
|
140
|
+
static unsafeExposeInternals(t) {
|
|
141
|
+
return { starts: t.#A, ttls: t.#d, autopurgeTimers: t.#g, sizes: t.#y, keyMap: t.#s, keyList: t.#i, valList: t.#t, next: t.#a, prev: t.#u, get head() {
|
|
142
|
+
return t.#l;
|
|
143
|
+
}, get tail() {
|
|
144
|
+
return t.#h;
|
|
145
|
+
}, free: t.#b, isBackgroundFetch: (e) => t.#e(e), backgroundFetch: (e, i, s, n) => t.#x(e, i, s, n), moveToTail: (e) => t.#D(e), indexes: (e) => t.#F(e), rindexes: (e) => t.#O(e), isStale: (e) => t.#p(e) };
|
|
146
|
+
}
|
|
147
|
+
get max() {
|
|
148
|
+
return this.#o;
|
|
149
|
+
}
|
|
150
|
+
get maxSize() {
|
|
151
|
+
return this.#c;
|
|
152
|
+
}
|
|
153
|
+
get calculatedSize() {
|
|
154
|
+
return this.#_;
|
|
155
|
+
}
|
|
156
|
+
get size() {
|
|
157
|
+
return this.#n;
|
|
158
|
+
}
|
|
159
|
+
get fetchMethod() {
|
|
160
|
+
return this.#L;
|
|
161
|
+
}
|
|
162
|
+
get memoMethod() {
|
|
163
|
+
return this.#U;
|
|
164
|
+
}
|
|
165
|
+
get dispose() {
|
|
166
|
+
return this.#w;
|
|
167
|
+
}
|
|
168
|
+
get onInsert() {
|
|
169
|
+
return this.#C;
|
|
170
|
+
}
|
|
171
|
+
get disposeAfter() {
|
|
172
|
+
return this.#S;
|
|
173
|
+
}
|
|
174
|
+
constructor(t) {
|
|
175
|
+
let { max: e = 0, ttl: i, ttlResolution: s = 1, ttlAutopurge: n, updateAgeOnGet: o, updateAgeOnHas: h, allowStale: r, dispose: a, onInsert: w, disposeAfter: f, noDisposeOnSet: d, noUpdateTTL: g, maxSize: A = 0, maxEntrySize: p = 0, sizeCalculation: _, fetchMethod: l, memoMethod: S, noDeleteOnFetchRejection: b, noDeleteOnStaleGet: m, allowStaleOnFetchRejection: u, allowStaleOnFetchAbort: T, ignoreFetchAbort: F, perf: v } = t;
|
|
176
|
+
if (v !== undefined && typeof v?.now != "function")
|
|
177
|
+
throw new TypeError("perf option must have a now() method if specified");
|
|
178
|
+
if (this.#m = v ?? G, e !== 0 && !y(e))
|
|
179
|
+
throw new TypeError("max option must be a nonnegative integer");
|
|
180
|
+
let O = e ? M(e) : Array;
|
|
181
|
+
if (!O)
|
|
182
|
+
throw new Error("invalid max value: " + e);
|
|
183
|
+
if (this.#o = e, this.#c = A, this.maxEntrySize = p || this.#c, this.sizeCalculation = _, this.sizeCalculation) {
|
|
184
|
+
if (!this.#c && !this.maxEntrySize)
|
|
185
|
+
throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");
|
|
186
|
+
if (typeof this.sizeCalculation != "function")
|
|
187
|
+
throw new TypeError("sizeCalculation set to non-function");
|
|
188
|
+
}
|
|
189
|
+
if (S !== undefined && typeof S != "function")
|
|
190
|
+
throw new TypeError("memoMethod must be a function if defined");
|
|
191
|
+
if (this.#U = S, l !== undefined && typeof l != "function")
|
|
192
|
+
throw new TypeError("fetchMethod must be a function if specified");
|
|
193
|
+
if (this.#L = l, this.#v = !!l, this.#s = new Map, this.#i = new Array(e).fill(undefined), this.#t = new Array(e).fill(undefined), this.#a = new O(e), this.#u = new O(e), this.#l = 0, this.#h = 0, this.#b = W.create(e), this.#n = 0, this.#_ = 0, typeof a == "function" && (this.#w = a), typeof w == "function" && (this.#C = w), typeof f == "function" ? (this.#S = f, this.#r = []) : (this.#S = undefined, this.#r = undefined), this.#T = !!this.#w, this.#I = !!this.#C, this.#f = !!this.#S, this.noDisposeOnSet = !!d, this.noUpdateTTL = !!g, this.noDeleteOnFetchRejection = !!b, this.allowStaleOnFetchRejection = !!u, this.allowStaleOnFetchAbort = !!T, this.ignoreFetchAbort = !!F, this.maxEntrySize !== 0) {
|
|
194
|
+
if (this.#c !== 0 && !y(this.#c))
|
|
195
|
+
throw new TypeError("maxSize must be a positive integer if specified");
|
|
196
|
+
if (!y(this.maxEntrySize))
|
|
197
|
+
throw new TypeError("maxEntrySize must be a positive integer if specified");
|
|
198
|
+
this.#B();
|
|
199
|
+
}
|
|
200
|
+
if (this.allowStale = !!r, this.noDeleteOnStaleGet = !!m, this.updateAgeOnGet = !!o, this.updateAgeOnHas = !!h, this.ttlResolution = y(s) || s === 0 ? s : 1, this.ttlAutopurge = !!n, this.ttl = i || 0, this.ttl) {
|
|
201
|
+
if (!y(this.ttl))
|
|
202
|
+
throw new TypeError("ttl must be a positive integer if specified");
|
|
203
|
+
this.#j();
|
|
204
|
+
}
|
|
205
|
+
if (this.#o === 0 && this.ttl === 0 && this.#c === 0)
|
|
206
|
+
throw new TypeError("At least one of max, maxSize, or ttl is required");
|
|
207
|
+
if (!this.ttlAutopurge && !this.#o && !this.#c) {
|
|
208
|
+
let E = "LRU_CACHE_UNBOUNDED";
|
|
209
|
+
x(E) && (U.add(E), I("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.", "UnboundedCacheWarning", E, c));
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
getRemainingTTL(t) {
|
|
213
|
+
return this.#s.has(t) ? 1 / 0 : 0;
|
|
214
|
+
}
|
|
215
|
+
#j() {
|
|
216
|
+
let t = new z(this.#o), e = new z(this.#o);
|
|
217
|
+
this.#d = t, this.#A = e;
|
|
218
|
+
let i = this.ttlAutopurge ? new Array(this.#o) : undefined;
|
|
219
|
+
this.#g = i, this.#N = (h, r, a = this.#m.now()) => {
|
|
220
|
+
e[h] = r !== 0 ? a : 0, t[h] = r, s(h, r);
|
|
221
|
+
}, this.#R = (h) => {
|
|
222
|
+
e[h] = t[h] !== 0 ? this.#m.now() : 0, s(h, t[h]);
|
|
223
|
+
};
|
|
224
|
+
let s = this.ttlAutopurge ? (h, r) => {
|
|
225
|
+
if (i?.[h] && (clearTimeout(i[h]), i[h] = undefined), r && r !== 0 && i) {
|
|
226
|
+
let a = setTimeout(() => {
|
|
227
|
+
this.#p(h) && this.#E(this.#i[h], "expire");
|
|
228
|
+
}, r + 1);
|
|
229
|
+
a.unref && a.unref(), i[h] = a;
|
|
230
|
+
}
|
|
231
|
+
} : () => {};
|
|
232
|
+
this.#z = (h, r) => {
|
|
233
|
+
if (t[r]) {
|
|
234
|
+
let a = t[r], w = e[r];
|
|
235
|
+
if (!a || !w)
|
|
236
|
+
return;
|
|
237
|
+
h.ttl = a, h.start = w, h.now = n || o();
|
|
238
|
+
let f = h.now - w;
|
|
239
|
+
h.remainingTTL = a - f;
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
let n = 0, o = () => {
|
|
243
|
+
let h = this.#m.now();
|
|
244
|
+
if (this.ttlResolution > 0) {
|
|
245
|
+
n = h;
|
|
246
|
+
let r = setTimeout(() => n = 0, this.ttlResolution);
|
|
247
|
+
r.unref && r.unref();
|
|
248
|
+
}
|
|
249
|
+
return h;
|
|
250
|
+
};
|
|
251
|
+
this.getRemainingTTL = (h) => {
|
|
252
|
+
let r = this.#s.get(h);
|
|
253
|
+
if (r === undefined)
|
|
254
|
+
return 0;
|
|
255
|
+
let a = t[r], w = e[r];
|
|
256
|
+
if (!a || !w)
|
|
257
|
+
return 1 / 0;
|
|
258
|
+
let f = (n || o()) - w;
|
|
259
|
+
return a - f;
|
|
260
|
+
}, this.#p = (h) => {
|
|
261
|
+
let r = e[h], a = t[h];
|
|
262
|
+
return !!a && !!r && (n || o()) - r > a;
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
#R = () => {};
|
|
266
|
+
#z = () => {};
|
|
267
|
+
#N = () => {};
|
|
268
|
+
#p = () => false;
|
|
269
|
+
#B() {
|
|
270
|
+
let t = new z(this.#o);
|
|
271
|
+
this.#_ = 0, this.#y = t, this.#W = (e) => {
|
|
272
|
+
this.#_ -= t[e], t[e] = 0;
|
|
273
|
+
}, this.#P = (e, i, s, n) => {
|
|
274
|
+
if (this.#e(i))
|
|
275
|
+
return 0;
|
|
276
|
+
if (!y(s))
|
|
277
|
+
if (n) {
|
|
278
|
+
if (typeof n != "function")
|
|
279
|
+
throw new TypeError("sizeCalculation must be a function");
|
|
280
|
+
if (s = n(i, e), !y(s))
|
|
281
|
+
throw new TypeError("sizeCalculation return invalid (expect positive integer)");
|
|
282
|
+
} else
|
|
283
|
+
throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");
|
|
284
|
+
return s;
|
|
285
|
+
}, this.#M = (e, i, s) => {
|
|
286
|
+
if (t[e] = i, this.#c) {
|
|
287
|
+
let n = this.#c - t[e];
|
|
288
|
+
for (;this.#_ > n; )
|
|
289
|
+
this.#G(true);
|
|
290
|
+
}
|
|
291
|
+
this.#_ += t[e], s && (s.entrySize = i, s.totalCalculatedSize = this.#_);
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
#W = (t) => {};
|
|
295
|
+
#M = (t, e, i) => {};
|
|
296
|
+
#P = (t, e, i, s) => {
|
|
297
|
+
if (i || s)
|
|
298
|
+
throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");
|
|
299
|
+
return 0;
|
|
300
|
+
};
|
|
301
|
+
*#F({ allowStale: t = this.allowStale } = {}) {
|
|
302
|
+
if (this.#n)
|
|
303
|
+
for (let e = this.#h;!(!this.#H(e) || ((t || !this.#p(e)) && (yield e), e === this.#l)); )
|
|
304
|
+
e = this.#u[e];
|
|
305
|
+
}
|
|
306
|
+
*#O({ allowStale: t = this.allowStale } = {}) {
|
|
307
|
+
if (this.#n)
|
|
308
|
+
for (let e = this.#l;!(!this.#H(e) || ((t || !this.#p(e)) && (yield e), e === this.#h)); )
|
|
309
|
+
e = this.#a[e];
|
|
310
|
+
}
|
|
311
|
+
#H(t) {
|
|
312
|
+
return t !== undefined && this.#s.get(this.#i[t]) === t;
|
|
313
|
+
}
|
|
314
|
+
*entries() {
|
|
315
|
+
for (let t of this.#F())
|
|
316
|
+
this.#t[t] !== undefined && this.#i[t] !== undefined && !this.#e(this.#t[t]) && (yield [this.#i[t], this.#t[t]]);
|
|
317
|
+
}
|
|
318
|
+
*rentries() {
|
|
319
|
+
for (let t of this.#O())
|
|
320
|
+
this.#t[t] !== undefined && this.#i[t] !== undefined && !this.#e(this.#t[t]) && (yield [this.#i[t], this.#t[t]]);
|
|
321
|
+
}
|
|
322
|
+
*keys() {
|
|
323
|
+
for (let t of this.#F()) {
|
|
324
|
+
let e = this.#i[t];
|
|
325
|
+
e !== undefined && !this.#e(this.#t[t]) && (yield e);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
*rkeys() {
|
|
329
|
+
for (let t of this.#O()) {
|
|
330
|
+
let e = this.#i[t];
|
|
331
|
+
e !== undefined && !this.#e(this.#t[t]) && (yield e);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
*values() {
|
|
335
|
+
for (let t of this.#F())
|
|
336
|
+
this.#t[t] !== undefined && !this.#e(this.#t[t]) && (yield this.#t[t]);
|
|
337
|
+
}
|
|
338
|
+
*rvalues() {
|
|
339
|
+
for (let t of this.#O())
|
|
340
|
+
this.#t[t] !== undefined && !this.#e(this.#t[t]) && (yield this.#t[t]);
|
|
341
|
+
}
|
|
342
|
+
[Symbol.iterator]() {
|
|
343
|
+
return this.entries();
|
|
344
|
+
}
|
|
345
|
+
[Symbol.toStringTag] = "LRUCache";
|
|
346
|
+
find(t, e = {}) {
|
|
347
|
+
for (let i of this.#F()) {
|
|
348
|
+
let s = this.#t[i], n = this.#e(s) ? s.__staleWhileFetching : s;
|
|
349
|
+
if (n !== undefined && t(n, this.#i[i], this))
|
|
350
|
+
return this.get(this.#i[i], e);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
forEach(t, e = this) {
|
|
354
|
+
for (let i of this.#F()) {
|
|
355
|
+
let s = this.#t[i], n = this.#e(s) ? s.__staleWhileFetching : s;
|
|
356
|
+
n !== undefined && t.call(e, n, this.#i[i], this);
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
rforEach(t, e = this) {
|
|
360
|
+
for (let i of this.#O()) {
|
|
361
|
+
let s = this.#t[i], n = this.#e(s) ? s.__staleWhileFetching : s;
|
|
362
|
+
n !== undefined && t.call(e, n, this.#i[i], this);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
purgeStale() {
|
|
366
|
+
let t = false;
|
|
367
|
+
for (let e of this.#O({ allowStale: true }))
|
|
368
|
+
this.#p(e) && (this.#E(this.#i[e], "expire"), t = true);
|
|
369
|
+
return t;
|
|
370
|
+
}
|
|
371
|
+
info(t) {
|
|
372
|
+
let e = this.#s.get(t);
|
|
373
|
+
if (e === undefined)
|
|
374
|
+
return;
|
|
375
|
+
let i = this.#t[e], s = this.#e(i) ? i.__staleWhileFetching : i;
|
|
376
|
+
if (s === undefined)
|
|
377
|
+
return;
|
|
378
|
+
let n = { value: s };
|
|
379
|
+
if (this.#d && this.#A) {
|
|
380
|
+
let o = this.#d[e], h = this.#A[e];
|
|
381
|
+
if (o && h) {
|
|
382
|
+
let r = o - (this.#m.now() - h);
|
|
383
|
+
n.ttl = r, n.start = Date.now();
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
return this.#y && (n.size = this.#y[e]), n;
|
|
387
|
+
}
|
|
388
|
+
dump() {
|
|
389
|
+
let t = [];
|
|
390
|
+
for (let e of this.#F({ allowStale: true })) {
|
|
391
|
+
let i = this.#i[e], s = this.#t[e], n = this.#e(s) ? s.__staleWhileFetching : s;
|
|
392
|
+
if (n === undefined || i === undefined)
|
|
393
|
+
continue;
|
|
394
|
+
let o = { value: n };
|
|
395
|
+
if (this.#d && this.#A) {
|
|
396
|
+
o.ttl = this.#d[e];
|
|
397
|
+
let h = this.#m.now() - this.#A[e];
|
|
398
|
+
o.start = Math.floor(Date.now() - h);
|
|
399
|
+
}
|
|
400
|
+
this.#y && (o.size = this.#y[e]), t.unshift([i, o]);
|
|
401
|
+
}
|
|
402
|
+
return t;
|
|
403
|
+
}
|
|
404
|
+
load(t) {
|
|
405
|
+
this.clear();
|
|
406
|
+
for (let [e, i] of t) {
|
|
407
|
+
if (i.start) {
|
|
408
|
+
let s = Date.now() - i.start;
|
|
409
|
+
i.start = this.#m.now() - s;
|
|
410
|
+
}
|
|
411
|
+
this.set(e, i.value, i);
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
set(t, e, i = {}) {
|
|
415
|
+
if (e === undefined)
|
|
416
|
+
return this.delete(t), this;
|
|
417
|
+
let { ttl: s = this.ttl, start: n, noDisposeOnSet: o = this.noDisposeOnSet, sizeCalculation: h = this.sizeCalculation, status: r } = i, { noUpdateTTL: a = this.noUpdateTTL } = i, w = this.#P(t, e, i.size || 0, h);
|
|
418
|
+
if (this.maxEntrySize && w > this.maxEntrySize)
|
|
419
|
+
return r && (r.set = "miss", r.maxEntrySizeExceeded = true), this.#E(t, "set"), this;
|
|
420
|
+
let f = this.#n === 0 ? undefined : this.#s.get(t);
|
|
421
|
+
if (f === undefined)
|
|
422
|
+
f = this.#n === 0 ? this.#h : this.#b.length !== 0 ? this.#b.pop() : this.#n === this.#o ? this.#G(false) : this.#n, this.#i[f] = t, this.#t[f] = e, this.#s.set(t, f), this.#a[this.#h] = f, this.#u[f] = this.#h, this.#h = f, this.#n++, this.#M(f, w, r), r && (r.set = "add"), a = false, this.#I && this.#C?.(e, t, "add");
|
|
423
|
+
else {
|
|
424
|
+
this.#D(f);
|
|
425
|
+
let d = this.#t[f];
|
|
426
|
+
if (e !== d) {
|
|
427
|
+
if (this.#v && this.#e(d)) {
|
|
428
|
+
d.__abortController.abort(new Error("replaced"));
|
|
429
|
+
let { __staleWhileFetching: g } = d;
|
|
430
|
+
g !== undefined && !o && (this.#T && this.#w?.(g, t, "set"), this.#f && this.#r?.push([g, t, "set"]));
|
|
431
|
+
} else
|
|
432
|
+
o || (this.#T && this.#w?.(d, t, "set"), this.#f && this.#r?.push([d, t, "set"]));
|
|
433
|
+
if (this.#W(f), this.#M(f, w, r), this.#t[f] = e, r) {
|
|
434
|
+
r.set = "replace";
|
|
435
|
+
let g = d && this.#e(d) ? d.__staleWhileFetching : d;
|
|
436
|
+
g !== undefined && (r.oldValue = g);
|
|
437
|
+
}
|
|
438
|
+
} else
|
|
439
|
+
r && (r.set = "update");
|
|
440
|
+
this.#I && this.onInsert?.(e, t, e === d ? "update" : "replace");
|
|
441
|
+
}
|
|
442
|
+
if (s !== 0 && !this.#d && this.#j(), this.#d && (a || this.#N(f, s, n), r && this.#z(r, f)), !o && this.#f && this.#r) {
|
|
443
|
+
let d = this.#r, g;
|
|
444
|
+
for (;g = d?.shift(); )
|
|
445
|
+
this.#S?.(...g);
|
|
446
|
+
}
|
|
447
|
+
return this;
|
|
448
|
+
}
|
|
449
|
+
pop() {
|
|
450
|
+
try {
|
|
451
|
+
for (;this.#n; ) {
|
|
452
|
+
let t = this.#t[this.#l];
|
|
453
|
+
if (this.#G(true), this.#e(t)) {
|
|
454
|
+
if (t.__staleWhileFetching)
|
|
455
|
+
return t.__staleWhileFetching;
|
|
456
|
+
} else if (t !== undefined)
|
|
457
|
+
return t;
|
|
458
|
+
}
|
|
459
|
+
} finally {
|
|
460
|
+
if (this.#f && this.#r) {
|
|
461
|
+
let t = this.#r, e;
|
|
462
|
+
for (;e = t?.shift(); )
|
|
463
|
+
this.#S?.(...e);
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
#G(t) {
|
|
468
|
+
let e = this.#l, i = this.#i[e], s = this.#t[e];
|
|
469
|
+
return this.#v && this.#e(s) ? s.__abortController.abort(new Error("evicted")) : (this.#T || this.#f) && (this.#T && this.#w?.(s, i, "evict"), this.#f && this.#r?.push([s, i, "evict"])), this.#W(e), this.#g?.[e] && (clearTimeout(this.#g[e]), this.#g[e] = undefined), t && (this.#i[e] = undefined, this.#t[e] = undefined, this.#b.push(e)), this.#n === 1 ? (this.#l = this.#h = 0, this.#b.length = 0) : this.#l = this.#a[e], this.#s.delete(i), this.#n--, e;
|
|
470
|
+
}
|
|
471
|
+
has(t, e = {}) {
|
|
472
|
+
let { updateAgeOnHas: i = this.updateAgeOnHas, status: s } = e, n = this.#s.get(t);
|
|
473
|
+
if (n !== undefined) {
|
|
474
|
+
let o = this.#t[n];
|
|
475
|
+
if (this.#e(o) && o.__staleWhileFetching === undefined)
|
|
476
|
+
return false;
|
|
477
|
+
if (this.#p(n))
|
|
478
|
+
s && (s.has = "stale", this.#z(s, n));
|
|
479
|
+
else
|
|
480
|
+
return i && this.#R(n), s && (s.has = "hit", this.#z(s, n)), true;
|
|
481
|
+
} else
|
|
482
|
+
s && (s.has = "miss");
|
|
483
|
+
return false;
|
|
484
|
+
}
|
|
485
|
+
peek(t, e = {}) {
|
|
486
|
+
let { allowStale: i = this.allowStale } = e, s = this.#s.get(t);
|
|
487
|
+
if (s === undefined || !i && this.#p(s))
|
|
488
|
+
return;
|
|
489
|
+
let n = this.#t[s];
|
|
490
|
+
return this.#e(n) ? n.__staleWhileFetching : n;
|
|
491
|
+
}
|
|
492
|
+
#x(t, e, i, s) {
|
|
493
|
+
let n = e === undefined ? undefined : this.#t[e];
|
|
494
|
+
if (this.#e(n))
|
|
495
|
+
return n;
|
|
496
|
+
let o = new C, { signal: h } = i;
|
|
497
|
+
h?.addEventListener("abort", () => o.abort(h.reason), { signal: o.signal });
|
|
498
|
+
let r = { signal: o.signal, options: i, context: s }, a = (p, _ = false) => {
|
|
499
|
+
let { aborted: l } = o.signal, S = i.ignoreFetchAbort && p !== undefined, b = i.ignoreFetchAbort || !!(i.allowStaleOnFetchAbort && p !== undefined);
|
|
500
|
+
if (i.status && (l && !_ ? (i.status.fetchAborted = true, i.status.fetchError = o.signal.reason, S && (i.status.fetchAbortIgnored = true)) : i.status.fetchResolved = true), l && !S && !_)
|
|
501
|
+
return f(o.signal.reason, b);
|
|
502
|
+
let m = g, u = this.#t[e];
|
|
503
|
+
return (u === g || S && _ && u === undefined) && (p === undefined ? m.__staleWhileFetching !== undefined ? this.#t[e] = m.__staleWhileFetching : this.#E(t, "fetch") : (i.status && (i.status.fetchUpdated = true), this.set(t, p, r.options))), p;
|
|
504
|
+
}, w = (p) => (i.status && (i.status.fetchRejected = true, i.status.fetchError = p), f(p, false)), f = (p, _) => {
|
|
505
|
+
let { aborted: l } = o.signal, S = l && i.allowStaleOnFetchAbort, b = S || i.allowStaleOnFetchRejection, m = b || i.noDeleteOnFetchRejection, u = g;
|
|
506
|
+
if (this.#t[e] === g && (!m || !_ && u.__staleWhileFetching === undefined ? this.#E(t, "fetch") : S || (this.#t[e] = u.__staleWhileFetching)), b)
|
|
507
|
+
return i.status && u.__staleWhileFetching !== undefined && (i.status.returnedStale = true), u.__staleWhileFetching;
|
|
508
|
+
if (u.__returned === u)
|
|
509
|
+
throw p;
|
|
510
|
+
}, d = (p, _) => {
|
|
511
|
+
let l = this.#L?.(t, n, r);
|
|
512
|
+
l && l instanceof Promise && l.then((S) => p(S === undefined ? undefined : S), _), o.signal.addEventListener("abort", () => {
|
|
513
|
+
(!i.ignoreFetchAbort || i.allowStaleOnFetchAbort) && (p(undefined), i.allowStaleOnFetchAbort && (p = (S) => a(S, true)));
|
|
514
|
+
});
|
|
515
|
+
};
|
|
516
|
+
i.status && (i.status.fetchDispatched = true);
|
|
517
|
+
let g = new Promise(d).then(a, w), A = Object.assign(g, { __abortController: o, __staleWhileFetching: n, __returned: undefined });
|
|
518
|
+
return e === undefined ? (this.set(t, A, { ...r.options, status: undefined }), e = this.#s.get(t)) : this.#t[e] = A, A;
|
|
519
|
+
}
|
|
520
|
+
#e(t) {
|
|
521
|
+
if (!this.#v)
|
|
522
|
+
return false;
|
|
523
|
+
let e = t;
|
|
524
|
+
return !!e && e instanceof Promise && e.hasOwnProperty("__staleWhileFetching") && e.__abortController instanceof C;
|
|
525
|
+
}
|
|
526
|
+
async fetch(t, e = {}) {
|
|
527
|
+
let { allowStale: i = this.allowStale, updateAgeOnGet: s = this.updateAgeOnGet, noDeleteOnStaleGet: n = this.noDeleteOnStaleGet, ttl: o = this.ttl, noDisposeOnSet: h = this.noDisposeOnSet, size: r = 0, sizeCalculation: a = this.sizeCalculation, noUpdateTTL: w = this.noUpdateTTL, noDeleteOnFetchRejection: f = this.noDeleteOnFetchRejection, allowStaleOnFetchRejection: d = this.allowStaleOnFetchRejection, ignoreFetchAbort: g = this.ignoreFetchAbort, allowStaleOnFetchAbort: A = this.allowStaleOnFetchAbort, context: p, forceRefresh: _ = false, status: l, signal: S } = e;
|
|
528
|
+
if (!this.#v)
|
|
529
|
+
return l && (l.fetch = "get"), this.get(t, { allowStale: i, updateAgeOnGet: s, noDeleteOnStaleGet: n, status: l });
|
|
530
|
+
let b = { allowStale: i, updateAgeOnGet: s, noDeleteOnStaleGet: n, ttl: o, noDisposeOnSet: h, size: r, sizeCalculation: a, noUpdateTTL: w, noDeleteOnFetchRejection: f, allowStaleOnFetchRejection: d, allowStaleOnFetchAbort: A, ignoreFetchAbort: g, status: l, signal: S }, m = this.#s.get(t);
|
|
531
|
+
if (m === undefined) {
|
|
532
|
+
l && (l.fetch = "miss");
|
|
533
|
+
let u = this.#x(t, m, b, p);
|
|
534
|
+
return u.__returned = u;
|
|
535
|
+
} else {
|
|
536
|
+
let u = this.#t[m];
|
|
537
|
+
if (this.#e(u)) {
|
|
538
|
+
let E = i && u.__staleWhileFetching !== undefined;
|
|
539
|
+
return l && (l.fetch = "inflight", E && (l.returnedStale = true)), E ? u.__staleWhileFetching : u.__returned = u;
|
|
540
|
+
}
|
|
541
|
+
let T = this.#p(m);
|
|
542
|
+
if (!_ && !T)
|
|
543
|
+
return l && (l.fetch = "hit"), this.#D(m), s && this.#R(m), l && this.#z(l, m), u;
|
|
544
|
+
let F = this.#x(t, m, b, p), O = F.__staleWhileFetching !== undefined && i;
|
|
545
|
+
return l && (l.fetch = T ? "stale" : "refresh", O && T && (l.returnedStale = true)), O ? F.__staleWhileFetching : F.__returned = F;
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
async forceFetch(t, e = {}) {
|
|
549
|
+
let i = await this.fetch(t, e);
|
|
550
|
+
if (i === undefined)
|
|
551
|
+
throw new Error("fetch() returned undefined");
|
|
552
|
+
return i;
|
|
553
|
+
}
|
|
554
|
+
memo(t, e = {}) {
|
|
555
|
+
let i = this.#U;
|
|
556
|
+
if (!i)
|
|
557
|
+
throw new Error("no memoMethod provided to constructor");
|
|
558
|
+
let { context: s, forceRefresh: n, ...o } = e, h = this.get(t, o);
|
|
559
|
+
if (!n && h !== undefined)
|
|
560
|
+
return h;
|
|
561
|
+
let r = i(t, h, { options: o, context: s });
|
|
562
|
+
return this.set(t, r, o), r;
|
|
563
|
+
}
|
|
564
|
+
get(t, e = {}) {
|
|
565
|
+
let { allowStale: i = this.allowStale, updateAgeOnGet: s = this.updateAgeOnGet, noDeleteOnStaleGet: n = this.noDeleteOnStaleGet, status: o } = e, h = this.#s.get(t);
|
|
566
|
+
if (h !== undefined) {
|
|
567
|
+
let r = this.#t[h], a = this.#e(r);
|
|
568
|
+
return o && this.#z(o, h), this.#p(h) ? (o && (o.get = "stale"), a ? (o && i && r.__staleWhileFetching !== undefined && (o.returnedStale = true), i ? r.__staleWhileFetching : undefined) : (n || this.#E(t, "expire"), o && i && (o.returnedStale = true), i ? r : undefined)) : (o && (o.get = "hit"), a ? r.__staleWhileFetching : (this.#D(h), s && this.#R(h), r));
|
|
569
|
+
} else
|
|
570
|
+
o && (o.get = "miss");
|
|
571
|
+
}
|
|
572
|
+
#k(t, e) {
|
|
573
|
+
this.#u[e] = t, this.#a[t] = e;
|
|
574
|
+
}
|
|
575
|
+
#D(t) {
|
|
576
|
+
t !== this.#h && (t === this.#l ? this.#l = this.#a[t] : this.#k(this.#u[t], this.#a[t]), this.#k(this.#h, t), this.#h = t);
|
|
577
|
+
}
|
|
578
|
+
delete(t) {
|
|
579
|
+
return this.#E(t, "delete");
|
|
580
|
+
}
|
|
581
|
+
#E(t, e) {
|
|
582
|
+
let i = false;
|
|
583
|
+
if (this.#n !== 0) {
|
|
584
|
+
let s = this.#s.get(t);
|
|
585
|
+
if (s !== undefined)
|
|
586
|
+
if (this.#g?.[s] && (clearTimeout(this.#g?.[s]), this.#g[s] = undefined), i = true, this.#n === 1)
|
|
587
|
+
this.#V(e);
|
|
588
|
+
else {
|
|
589
|
+
this.#W(s);
|
|
590
|
+
let n = this.#t[s];
|
|
591
|
+
if (this.#e(n) ? n.__abortController.abort(new Error("deleted")) : (this.#T || this.#f) && (this.#T && this.#w?.(n, t, e), this.#f && this.#r?.push([n, t, e])), this.#s.delete(t), this.#i[s] = undefined, this.#t[s] = undefined, s === this.#h)
|
|
592
|
+
this.#h = this.#u[s];
|
|
593
|
+
else if (s === this.#l)
|
|
594
|
+
this.#l = this.#a[s];
|
|
595
|
+
else {
|
|
596
|
+
let o = this.#u[s];
|
|
597
|
+
this.#a[o] = this.#a[s];
|
|
598
|
+
let h = this.#a[s];
|
|
599
|
+
this.#u[h] = this.#u[s];
|
|
600
|
+
}
|
|
601
|
+
this.#n--, this.#b.push(s);
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
if (this.#f && this.#r?.length) {
|
|
605
|
+
let s = this.#r, n;
|
|
606
|
+
for (;n = s?.shift(); )
|
|
607
|
+
this.#S?.(...n);
|
|
608
|
+
}
|
|
609
|
+
return i;
|
|
610
|
+
}
|
|
611
|
+
clear() {
|
|
612
|
+
return this.#V("delete");
|
|
613
|
+
}
|
|
614
|
+
#V(t) {
|
|
615
|
+
for (let e of this.#O({ allowStale: true })) {
|
|
616
|
+
let i = this.#t[e];
|
|
617
|
+
if (this.#e(i))
|
|
618
|
+
i.__abortController.abort(new Error("deleted"));
|
|
619
|
+
else {
|
|
620
|
+
let s = this.#i[e];
|
|
621
|
+
this.#T && this.#w?.(i, s, t), this.#f && this.#r?.push([i, s, t]);
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
if (this.#s.clear(), this.#t.fill(undefined), this.#i.fill(undefined), this.#d && this.#A) {
|
|
625
|
+
this.#d.fill(0), this.#A.fill(0);
|
|
626
|
+
for (let e of this.#g ?? [])
|
|
627
|
+
e !== undefined && clearTimeout(e);
|
|
628
|
+
this.#g?.fill(undefined);
|
|
629
|
+
}
|
|
630
|
+
if (this.#y && this.#y.fill(0), this.#l = 0, this.#h = 0, this.#b.length = 0, this.#_ = 0, this.#n = 0, this.#f && this.#r) {
|
|
631
|
+
let e = this.#r, i;
|
|
632
|
+
for (;i = e?.shift(); )
|
|
633
|
+
this.#S?.(...i);
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
};
|
|
637
|
+
exports.LRUCache = D;
|
|
638
|
+
});
|
|
639
|
+
|
|
640
|
+
// ../../node_modules/.bun/hosted-git-info@9.0.2/node_modules/hosted-git-info/lib/hosts.js
|
|
641
|
+
var require_hosts = __commonJS((exports, module) => {
|
|
642
|
+
var maybeJoin = (...args) => args.every((arg) => arg) ? args.join("") : "";
|
|
643
|
+
var maybeEncode = (arg) => arg ? encodeURIComponent(arg) : "";
|
|
644
|
+
var formatHashFragment = (f) => f.toLowerCase().replace(/^\W+/g, "").replace(/(?<!\W)\W+$/, "").replace(/\//g, "").replace(/\W+/g, "-");
|
|
645
|
+
var defaults = {
|
|
646
|
+
sshtemplate: ({ domain, user, project, committish }) => `git@${domain}:${user}/${project}.git${maybeJoin("#", committish)}`,
|
|
647
|
+
sshurltemplate: ({ domain, user, project, committish }) => `git+ssh://git@${domain}/${user}/${project}.git${maybeJoin("#", committish)}`,
|
|
648
|
+
edittemplate: ({ domain, user, project, committish, editpath, path }) => `https://${domain}/${user}/${project}${maybeJoin("/", editpath, "/", maybeEncode(committish || "HEAD"), "/", path)}`,
|
|
649
|
+
browsetemplate: ({ domain, user, project, committish, treepath }) => `https://${domain}/${user}/${project}${maybeJoin("/", treepath, "/", maybeEncode(committish))}`,
|
|
650
|
+
browsetreetemplate: ({ domain, user, project, committish, treepath, path, fragment, hashformat }) => `https://${domain}/${user}/${project}/${treepath}/${maybeEncode(committish || "HEAD")}/${path}${maybeJoin("#", hashformat(fragment || ""))}`,
|
|
651
|
+
browseblobtemplate: ({ domain, user, project, committish, blobpath, path, fragment, hashformat }) => `https://${domain}/${user}/${project}/${blobpath}/${maybeEncode(committish || "HEAD")}/${path}${maybeJoin("#", hashformat(fragment || ""))}`,
|
|
652
|
+
docstemplate: ({ domain, user, project, treepath, committish }) => `https://${domain}/${user}/${project}${maybeJoin("/", treepath, "/", maybeEncode(committish))}#readme`,
|
|
653
|
+
httpstemplate: ({ auth, domain, user, project, committish }) => `git+https://${maybeJoin(auth, "@")}${domain}/${user}/${project}.git${maybeJoin("#", committish)}`,
|
|
654
|
+
filetemplate: ({ domain, user, project, committish, path }) => `https://${domain}/${user}/${project}/raw/${maybeEncode(committish || "HEAD")}/${path}`,
|
|
655
|
+
shortcuttemplate: ({ type, user, project, committish }) => `${type}:${user}/${project}${maybeJoin("#", committish)}`,
|
|
656
|
+
pathtemplate: ({ user, project, committish }) => `${user}/${project}${maybeJoin("#", committish)}`,
|
|
657
|
+
bugstemplate: ({ domain, user, project }) => `https://${domain}/${user}/${project}/issues`,
|
|
658
|
+
hashformat: formatHashFragment
|
|
659
|
+
};
|
|
660
|
+
var hosts = {};
|
|
661
|
+
hosts.github = {
|
|
662
|
+
protocols: ["git:", "http:", "git+ssh:", "git+https:", "ssh:", "https:"],
|
|
663
|
+
domain: "github.com",
|
|
664
|
+
treepath: "tree",
|
|
665
|
+
blobpath: "blob",
|
|
666
|
+
editpath: "edit",
|
|
667
|
+
filetemplate: ({ auth, user, project, committish, path }) => `https://${maybeJoin(auth, "@")}raw.githubusercontent.com/${user}/${project}/${maybeEncode(committish || "HEAD")}/${path}`,
|
|
668
|
+
gittemplate: ({ auth, domain, user, project, committish }) => `git://${maybeJoin(auth, "@")}${domain}/${user}/${project}.git${maybeJoin("#", committish)}`,
|
|
669
|
+
tarballtemplate: ({ domain, user, project, committish }) => `https://codeload.${domain}/${user}/${project}/tar.gz/${maybeEncode(committish || "HEAD")}`,
|
|
670
|
+
extract: (url) => {
|
|
671
|
+
let [, user, project, type, committish] = url.pathname.split("/", 5);
|
|
672
|
+
if (type && type !== "tree") {
|
|
673
|
+
return;
|
|
674
|
+
}
|
|
675
|
+
if (!type) {
|
|
676
|
+
committish = url.hash.slice(1);
|
|
677
|
+
}
|
|
678
|
+
if (project && project.endsWith(".git")) {
|
|
679
|
+
project = project.slice(0, -4);
|
|
680
|
+
}
|
|
681
|
+
if (!user || !project) {
|
|
682
|
+
return;
|
|
683
|
+
}
|
|
684
|
+
return { user, project, committish };
|
|
685
|
+
}
|
|
686
|
+
};
|
|
687
|
+
hosts.bitbucket = {
|
|
688
|
+
protocols: ["git+ssh:", "git+https:", "ssh:", "https:"],
|
|
689
|
+
domain: "bitbucket.org",
|
|
690
|
+
treepath: "src",
|
|
691
|
+
blobpath: "src",
|
|
692
|
+
editpath: "?mode=edit",
|
|
693
|
+
edittemplate: ({ domain, user, project, committish, treepath, path, editpath }) => `https://${domain}/${user}/${project}${maybeJoin("/", treepath, "/", maybeEncode(committish || "HEAD"), "/", path, editpath)}`,
|
|
694
|
+
tarballtemplate: ({ domain, user, project, committish }) => `https://${domain}/${user}/${project}/get/${maybeEncode(committish || "HEAD")}.tar.gz`,
|
|
695
|
+
extract: (url) => {
|
|
696
|
+
let [, user, project, aux] = url.pathname.split("/", 4);
|
|
697
|
+
if (["get"].includes(aux)) {
|
|
698
|
+
return;
|
|
699
|
+
}
|
|
700
|
+
if (project && project.endsWith(".git")) {
|
|
701
|
+
project = project.slice(0, -4);
|
|
702
|
+
}
|
|
703
|
+
if (!user || !project) {
|
|
704
|
+
return;
|
|
705
|
+
}
|
|
706
|
+
return { user, project, committish: url.hash.slice(1) };
|
|
707
|
+
}
|
|
708
|
+
};
|
|
709
|
+
hosts.gitlab = {
|
|
710
|
+
protocols: ["git+ssh:", "git+https:", "ssh:", "https:"],
|
|
711
|
+
domain: "gitlab.com",
|
|
712
|
+
treepath: "tree",
|
|
713
|
+
blobpath: "tree",
|
|
714
|
+
editpath: "-/edit",
|
|
715
|
+
tarballtemplate: ({ domain, user, project, committish }) => `https://${domain}/${user}/${project}/repository/archive.tar.gz?ref=${maybeEncode(committish || "HEAD")}`,
|
|
716
|
+
extract: (url) => {
|
|
717
|
+
const path = url.pathname.slice(1);
|
|
718
|
+
if (path.includes("/-/") || path.includes("/archive.tar.gz")) {
|
|
719
|
+
return;
|
|
720
|
+
}
|
|
721
|
+
const segments = path.split("/");
|
|
722
|
+
let project = segments.pop();
|
|
723
|
+
if (project.endsWith(".git")) {
|
|
724
|
+
project = project.slice(0, -4);
|
|
725
|
+
}
|
|
726
|
+
const user = segments.join("/");
|
|
727
|
+
if (!user || !project) {
|
|
728
|
+
return;
|
|
729
|
+
}
|
|
730
|
+
return { user, project, committish: url.hash.slice(1) };
|
|
731
|
+
}
|
|
732
|
+
};
|
|
733
|
+
hosts.gist = {
|
|
734
|
+
protocols: ["git:", "git+ssh:", "git+https:", "ssh:", "https:"],
|
|
735
|
+
domain: "gist.github.com",
|
|
736
|
+
editpath: "edit",
|
|
737
|
+
sshtemplate: ({ domain, project, committish }) => `git@${domain}:${project}.git${maybeJoin("#", committish)}`,
|
|
738
|
+
sshurltemplate: ({ domain, project, committish }) => `git+ssh://git@${domain}/${project}.git${maybeJoin("#", committish)}`,
|
|
739
|
+
edittemplate: ({ domain, user, project, committish, editpath }) => `https://${domain}/${user}/${project}${maybeJoin("/", maybeEncode(committish))}/${editpath}`,
|
|
740
|
+
browsetemplate: ({ domain, project, committish }) => `https://${domain}/${project}${maybeJoin("/", maybeEncode(committish))}`,
|
|
741
|
+
browsetreetemplate: ({ domain, project, committish, path, hashformat }) => `https://${domain}/${project}${maybeJoin("/", maybeEncode(committish))}${maybeJoin("#", hashformat(path))}`,
|
|
742
|
+
browseblobtemplate: ({ domain, project, committish, path, hashformat }) => `https://${domain}/${project}${maybeJoin("/", maybeEncode(committish))}${maybeJoin("#", hashformat(path))}`,
|
|
743
|
+
docstemplate: ({ domain, project, committish }) => `https://${domain}/${project}${maybeJoin("/", maybeEncode(committish))}`,
|
|
744
|
+
httpstemplate: ({ domain, project, committish }) => `git+https://${domain}/${project}.git${maybeJoin("#", committish)}`,
|
|
745
|
+
filetemplate: ({ user, project, committish, path }) => `https://gist.githubusercontent.com/${user}/${project}/raw${maybeJoin("/", maybeEncode(committish))}/${path}`,
|
|
746
|
+
shortcuttemplate: ({ type, project, committish }) => `${type}:${project}${maybeJoin("#", committish)}`,
|
|
747
|
+
pathtemplate: ({ project, committish }) => `${project}${maybeJoin("#", committish)}`,
|
|
748
|
+
bugstemplate: ({ domain, project }) => `https://${domain}/${project}`,
|
|
749
|
+
gittemplate: ({ domain, project, committish }) => `git://${domain}/${project}.git${maybeJoin("#", committish)}`,
|
|
750
|
+
tarballtemplate: ({ project, committish }) => `https://codeload.github.com/gist/${project}/tar.gz/${maybeEncode(committish || "HEAD")}`,
|
|
751
|
+
extract: (url) => {
|
|
752
|
+
let [, user, project, aux] = url.pathname.split("/", 4);
|
|
753
|
+
if (aux === "raw") {
|
|
754
|
+
return;
|
|
755
|
+
}
|
|
756
|
+
if (!project) {
|
|
757
|
+
if (!user) {
|
|
758
|
+
return;
|
|
759
|
+
}
|
|
760
|
+
project = user;
|
|
761
|
+
user = null;
|
|
762
|
+
}
|
|
763
|
+
if (project.endsWith(".git")) {
|
|
764
|
+
project = project.slice(0, -4);
|
|
765
|
+
}
|
|
766
|
+
return { user, project, committish: url.hash.slice(1) };
|
|
767
|
+
},
|
|
768
|
+
hashformat: function(fragment) {
|
|
769
|
+
return fragment && "file-" + formatHashFragment(fragment);
|
|
770
|
+
}
|
|
771
|
+
};
|
|
772
|
+
hosts.sourcehut = {
|
|
773
|
+
protocols: ["git+ssh:", "https:"],
|
|
774
|
+
domain: "git.sr.ht",
|
|
775
|
+
treepath: "tree",
|
|
776
|
+
blobpath: "tree",
|
|
777
|
+
filetemplate: ({ domain, user, project, committish, path }) => `https://${domain}/${user}/${project}/blob/${maybeEncode(committish) || "HEAD"}/${path}`,
|
|
778
|
+
httpstemplate: ({ domain, user, project, committish }) => `https://${domain}/${user}/${project}.git${maybeJoin("#", committish)}`,
|
|
779
|
+
tarballtemplate: ({ domain, user, project, committish }) => `https://${domain}/${user}/${project}/archive/${maybeEncode(committish) || "HEAD"}.tar.gz`,
|
|
780
|
+
bugstemplate: () => null,
|
|
781
|
+
extract: (url) => {
|
|
782
|
+
let [, user, project, aux] = url.pathname.split("/", 4);
|
|
783
|
+
if (["archive"].includes(aux)) {
|
|
784
|
+
return;
|
|
785
|
+
}
|
|
786
|
+
if (project && project.endsWith(".git")) {
|
|
787
|
+
project = project.slice(0, -4);
|
|
788
|
+
}
|
|
789
|
+
if (!user || !project) {
|
|
790
|
+
return;
|
|
791
|
+
}
|
|
792
|
+
return { user, project, committish: url.hash.slice(1) };
|
|
793
|
+
}
|
|
794
|
+
};
|
|
795
|
+
for (const [name, host] of Object.entries(hosts)) {
|
|
796
|
+
hosts[name] = Object.assign({}, defaults, host);
|
|
797
|
+
}
|
|
798
|
+
module.exports = hosts;
|
|
799
|
+
});
|
|
800
|
+
|
|
801
|
+
// ../../node_modules/.bun/hosted-git-info@9.0.2/node_modules/hosted-git-info/lib/parse-url.js
|
|
802
|
+
var require_parse_url = __commonJS((exports, module) => {
|
|
803
|
+
var url = __require("url");
|
|
804
|
+
var lastIndexOfBefore = (str, char, beforeChar) => {
|
|
805
|
+
const startPosition = str.indexOf(beforeChar);
|
|
806
|
+
return str.lastIndexOf(char, startPosition > -1 ? startPosition : Infinity);
|
|
807
|
+
};
|
|
808
|
+
var safeUrl = (u) => {
|
|
809
|
+
try {
|
|
810
|
+
return new url.URL(u);
|
|
811
|
+
} catch {}
|
|
812
|
+
};
|
|
813
|
+
var correctProtocol = (arg, protocols) => {
|
|
814
|
+
const firstColon = arg.indexOf(":");
|
|
815
|
+
const proto = arg.slice(0, firstColon + 1);
|
|
816
|
+
if (Object.prototype.hasOwnProperty.call(protocols, proto)) {
|
|
817
|
+
return arg;
|
|
818
|
+
}
|
|
819
|
+
if (arg.substr(firstColon, 3) === "://") {
|
|
820
|
+
return arg;
|
|
821
|
+
}
|
|
822
|
+
const firstAt = arg.indexOf("@");
|
|
823
|
+
if (firstAt > -1) {
|
|
824
|
+
if (firstAt > firstColon) {
|
|
825
|
+
return `git+ssh://${arg}`;
|
|
826
|
+
} else {
|
|
827
|
+
return arg;
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
return `${arg.slice(0, firstColon + 1)}//${arg.slice(firstColon + 1)}`;
|
|
831
|
+
};
|
|
832
|
+
var correctUrl = (giturl) => {
|
|
833
|
+
const firstAt = lastIndexOfBefore(giturl, "@", "#");
|
|
834
|
+
const lastColonBeforeHash = lastIndexOfBefore(giturl, ":", "#");
|
|
835
|
+
if (lastColonBeforeHash > firstAt) {
|
|
836
|
+
giturl = giturl.slice(0, lastColonBeforeHash) + "/" + giturl.slice(lastColonBeforeHash + 1);
|
|
837
|
+
}
|
|
838
|
+
if (lastIndexOfBefore(giturl, ":", "#") === -1 && giturl.indexOf("//") === -1) {
|
|
839
|
+
giturl = `git+ssh://${giturl}`;
|
|
840
|
+
}
|
|
841
|
+
return giturl;
|
|
842
|
+
};
|
|
843
|
+
module.exports = (giturl, protocols) => {
|
|
844
|
+
const withProtocol = protocols ? correctProtocol(giturl, protocols) : giturl;
|
|
845
|
+
return safeUrl(withProtocol) || safeUrl(correctUrl(withProtocol));
|
|
846
|
+
};
|
|
847
|
+
});
|
|
848
|
+
|
|
849
|
+
// ../../node_modules/.bun/hosted-git-info@9.0.2/node_modules/hosted-git-info/lib/from-url.js
|
|
850
|
+
var require_from_url = __commonJS((exports, module) => {
|
|
851
|
+
var parseUrl = require_parse_url();
|
|
852
|
+
var isGitHubShorthand = (arg) => {
|
|
853
|
+
const firstHash = arg.indexOf("#");
|
|
854
|
+
const firstSlash = arg.indexOf("/");
|
|
855
|
+
const secondSlash = arg.indexOf("/", firstSlash + 1);
|
|
856
|
+
const firstColon = arg.indexOf(":");
|
|
857
|
+
const firstSpace = /\s/.exec(arg);
|
|
858
|
+
const firstAt = arg.indexOf("@");
|
|
859
|
+
const spaceOnlyAfterHash = !firstSpace || firstHash > -1 && firstSpace.index > firstHash;
|
|
860
|
+
const atOnlyAfterHash = firstAt === -1 || firstHash > -1 && firstAt > firstHash;
|
|
861
|
+
const colonOnlyAfterHash = firstColon === -1 || firstHash > -1 && firstColon > firstHash;
|
|
862
|
+
const secondSlashOnlyAfterHash = secondSlash === -1 || firstHash > -1 && secondSlash > firstHash;
|
|
863
|
+
const hasSlash = firstSlash > 0;
|
|
864
|
+
const doesNotEndWithSlash = firstHash > -1 ? arg[firstHash - 1] !== "/" : !arg.endsWith("/");
|
|
865
|
+
const doesNotStartWithDot = !arg.startsWith(".");
|
|
866
|
+
return spaceOnlyAfterHash && hasSlash && doesNotEndWithSlash && doesNotStartWithDot && atOnlyAfterHash && colonOnlyAfterHash && secondSlashOnlyAfterHash;
|
|
867
|
+
};
|
|
868
|
+
module.exports = (giturl, opts, { gitHosts, protocols }) => {
|
|
869
|
+
if (!giturl) {
|
|
870
|
+
return;
|
|
871
|
+
}
|
|
872
|
+
const correctedUrl = isGitHubShorthand(giturl) ? `github:${giturl}` : giturl;
|
|
873
|
+
const parsed = parseUrl(correctedUrl, protocols);
|
|
874
|
+
if (!parsed) {
|
|
875
|
+
return;
|
|
876
|
+
}
|
|
877
|
+
const gitHostShortcut = gitHosts.byShortcut[parsed.protocol];
|
|
878
|
+
const gitHostDomain = gitHosts.byDomain[parsed.hostname.startsWith("www.") ? parsed.hostname.slice(4) : parsed.hostname];
|
|
879
|
+
const gitHostName = gitHostShortcut || gitHostDomain;
|
|
880
|
+
if (!gitHostName) {
|
|
881
|
+
return;
|
|
882
|
+
}
|
|
883
|
+
const gitHostInfo = gitHosts[gitHostShortcut || gitHostDomain];
|
|
884
|
+
let auth = null;
|
|
885
|
+
if (protocols[parsed.protocol]?.auth && (parsed.username || parsed.password)) {
|
|
886
|
+
auth = `${parsed.username}${parsed.password ? ":" + parsed.password : ""}`;
|
|
887
|
+
}
|
|
888
|
+
let committish = null;
|
|
889
|
+
let user = null;
|
|
890
|
+
let project = null;
|
|
891
|
+
let defaultRepresentation = null;
|
|
892
|
+
try {
|
|
893
|
+
if (gitHostShortcut) {
|
|
894
|
+
let pathname = parsed.pathname.startsWith("/") ? parsed.pathname.slice(1) : parsed.pathname;
|
|
895
|
+
const firstAt = pathname.indexOf("@");
|
|
896
|
+
if (firstAt > -1) {
|
|
897
|
+
pathname = pathname.slice(firstAt + 1);
|
|
898
|
+
}
|
|
899
|
+
const lastSlash = pathname.lastIndexOf("/");
|
|
900
|
+
if (lastSlash > -1) {
|
|
901
|
+
user = decodeURIComponent(pathname.slice(0, lastSlash));
|
|
902
|
+
if (!user) {
|
|
903
|
+
user = null;
|
|
904
|
+
}
|
|
905
|
+
project = decodeURIComponent(pathname.slice(lastSlash + 1));
|
|
906
|
+
} else {
|
|
907
|
+
project = decodeURIComponent(pathname);
|
|
908
|
+
}
|
|
909
|
+
if (project.endsWith(".git")) {
|
|
910
|
+
project = project.slice(0, -4);
|
|
911
|
+
}
|
|
912
|
+
if (parsed.hash) {
|
|
913
|
+
committish = decodeURIComponent(parsed.hash.slice(1));
|
|
914
|
+
}
|
|
915
|
+
defaultRepresentation = "shortcut";
|
|
916
|
+
} else {
|
|
917
|
+
if (!gitHostInfo.protocols.includes(parsed.protocol)) {
|
|
918
|
+
return;
|
|
919
|
+
}
|
|
920
|
+
const segments = gitHostInfo.extract(parsed);
|
|
921
|
+
if (!segments) {
|
|
922
|
+
return;
|
|
923
|
+
}
|
|
924
|
+
user = segments.user && decodeURIComponent(segments.user);
|
|
925
|
+
project = decodeURIComponent(segments.project);
|
|
926
|
+
committish = decodeURIComponent(segments.committish);
|
|
927
|
+
defaultRepresentation = protocols[parsed.protocol]?.name || parsed.protocol.slice(0, -1);
|
|
928
|
+
}
|
|
929
|
+
} catch (err) {
|
|
930
|
+
if (err instanceof URIError) {
|
|
931
|
+
return;
|
|
932
|
+
} else {
|
|
933
|
+
throw err;
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
return [gitHostName, user, auth, project, committish, defaultRepresentation, opts];
|
|
937
|
+
};
|
|
938
|
+
});
|
|
939
|
+
|
|
940
|
+
// ../../node_modules/.bun/hosted-git-info@9.0.2/node_modules/hosted-git-info/lib/index.js
|
|
941
|
+
var require_lib = __commonJS((exports, module) => {
|
|
942
|
+
var { LRUCache } = require_index_min();
|
|
943
|
+
var hosts = require_hosts();
|
|
944
|
+
var fromUrl = require_from_url();
|
|
945
|
+
var parseUrl = require_parse_url();
|
|
946
|
+
var cache = new LRUCache({ max: 1000 });
|
|
947
|
+
function unknownHostedUrl(url) {
|
|
948
|
+
try {
|
|
949
|
+
const {
|
|
950
|
+
protocol,
|
|
951
|
+
hostname,
|
|
952
|
+
pathname
|
|
953
|
+
} = new URL(url);
|
|
954
|
+
if (!hostname) {
|
|
955
|
+
return null;
|
|
956
|
+
}
|
|
957
|
+
const proto = /(?:git\+)http:$/.test(protocol) ? "http:" : "https:";
|
|
958
|
+
const path = pathname.replace(/\.git$/, "");
|
|
959
|
+
return `${proto}//${hostname}${path}`;
|
|
960
|
+
} catch {
|
|
961
|
+
return null;
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
class GitHost {
|
|
966
|
+
constructor(type, user, auth, project, committish, defaultRepresentation, opts = {}) {
|
|
967
|
+
Object.assign(this, GitHost.#gitHosts[type], {
|
|
968
|
+
type,
|
|
969
|
+
user,
|
|
970
|
+
auth,
|
|
971
|
+
project,
|
|
972
|
+
committish,
|
|
973
|
+
default: defaultRepresentation,
|
|
974
|
+
opts
|
|
975
|
+
});
|
|
976
|
+
}
|
|
977
|
+
static #gitHosts = { byShortcut: {}, byDomain: {} };
|
|
978
|
+
static #protocols = {
|
|
979
|
+
"git+ssh:": { name: "sshurl" },
|
|
980
|
+
"ssh:": { name: "sshurl" },
|
|
981
|
+
"git+https:": { name: "https", auth: true },
|
|
982
|
+
"git:": { auth: true },
|
|
983
|
+
"http:": { auth: true },
|
|
984
|
+
"https:": { auth: true },
|
|
985
|
+
"git+http:": { auth: true }
|
|
986
|
+
};
|
|
987
|
+
static addHost(name, host) {
|
|
988
|
+
GitHost.#gitHosts[name] = host;
|
|
989
|
+
GitHost.#gitHosts.byDomain[host.domain] = name;
|
|
990
|
+
GitHost.#gitHosts.byShortcut[`${name}:`] = name;
|
|
991
|
+
GitHost.#protocols[`${name}:`] = { name };
|
|
992
|
+
}
|
|
993
|
+
static fromUrl(giturl, opts) {
|
|
994
|
+
if (typeof giturl !== "string") {
|
|
995
|
+
return;
|
|
996
|
+
}
|
|
997
|
+
const key = giturl + JSON.stringify(opts || {});
|
|
998
|
+
if (!cache.has(key)) {
|
|
999
|
+
const hostArgs = fromUrl(giturl, opts, {
|
|
1000
|
+
gitHosts: GitHost.#gitHosts,
|
|
1001
|
+
protocols: GitHost.#protocols
|
|
1002
|
+
});
|
|
1003
|
+
cache.set(key, hostArgs ? new GitHost(...hostArgs) : undefined);
|
|
1004
|
+
}
|
|
1005
|
+
return cache.get(key);
|
|
1006
|
+
}
|
|
1007
|
+
static fromManifest(manifest, opts = {}) {
|
|
1008
|
+
if (!manifest || typeof manifest !== "object") {
|
|
1009
|
+
return;
|
|
1010
|
+
}
|
|
1011
|
+
const r = manifest.repository;
|
|
1012
|
+
const rurl = r && (typeof r === "string" ? r : typeof r === "object" && typeof r.url === "string" ? r.url : null);
|
|
1013
|
+
if (!rurl) {
|
|
1014
|
+
throw new Error("no repository");
|
|
1015
|
+
}
|
|
1016
|
+
const info = rurl && GitHost.fromUrl(rurl.replace(/^git\+/, ""), opts) || null;
|
|
1017
|
+
if (info) {
|
|
1018
|
+
return info;
|
|
1019
|
+
}
|
|
1020
|
+
const unk = unknownHostedUrl(rurl);
|
|
1021
|
+
return GitHost.fromUrl(unk, opts) || unk;
|
|
1022
|
+
}
|
|
1023
|
+
static parseUrl(url) {
|
|
1024
|
+
return parseUrl(url);
|
|
1025
|
+
}
|
|
1026
|
+
#fill(template, opts) {
|
|
1027
|
+
if (typeof template !== "function") {
|
|
1028
|
+
return null;
|
|
1029
|
+
}
|
|
1030
|
+
const options = { ...this, ...this.opts, ...opts };
|
|
1031
|
+
if (!options.path) {
|
|
1032
|
+
options.path = "";
|
|
1033
|
+
}
|
|
1034
|
+
if (options.path.startsWith("/")) {
|
|
1035
|
+
options.path = options.path.slice(1);
|
|
1036
|
+
}
|
|
1037
|
+
if (options.noCommittish) {
|
|
1038
|
+
options.committish = null;
|
|
1039
|
+
}
|
|
1040
|
+
const result = template(options);
|
|
1041
|
+
return options.noGitPlus && result.startsWith("git+") ? result.slice(4) : result;
|
|
1042
|
+
}
|
|
1043
|
+
hash() {
|
|
1044
|
+
return this.committish ? `#${this.committish}` : "";
|
|
1045
|
+
}
|
|
1046
|
+
ssh(opts) {
|
|
1047
|
+
return this.#fill(this.sshtemplate, opts);
|
|
1048
|
+
}
|
|
1049
|
+
sshurl(opts) {
|
|
1050
|
+
return this.#fill(this.sshurltemplate, opts);
|
|
1051
|
+
}
|
|
1052
|
+
browse(path, ...args) {
|
|
1053
|
+
if (typeof path !== "string") {
|
|
1054
|
+
return this.#fill(this.browsetemplate, path);
|
|
1055
|
+
}
|
|
1056
|
+
if (typeof args[0] !== "string") {
|
|
1057
|
+
return this.#fill(this.browsetreetemplate, { ...args[0], path });
|
|
1058
|
+
}
|
|
1059
|
+
return this.#fill(this.browsetreetemplate, { ...args[1], fragment: args[0], path });
|
|
1060
|
+
}
|
|
1061
|
+
browseFile(path, ...args) {
|
|
1062
|
+
if (typeof args[0] !== "string") {
|
|
1063
|
+
return this.#fill(this.browseblobtemplate, { ...args[0], path });
|
|
1064
|
+
}
|
|
1065
|
+
return this.#fill(this.browseblobtemplate, { ...args[1], fragment: args[0], path });
|
|
1066
|
+
}
|
|
1067
|
+
docs(opts) {
|
|
1068
|
+
return this.#fill(this.docstemplate, opts);
|
|
1069
|
+
}
|
|
1070
|
+
bugs(opts) {
|
|
1071
|
+
return this.#fill(this.bugstemplate, opts);
|
|
1072
|
+
}
|
|
1073
|
+
https(opts) {
|
|
1074
|
+
return this.#fill(this.httpstemplate, opts);
|
|
1075
|
+
}
|
|
1076
|
+
git(opts) {
|
|
1077
|
+
return this.#fill(this.gittemplate, opts);
|
|
1078
|
+
}
|
|
1079
|
+
shortcut(opts) {
|
|
1080
|
+
return this.#fill(this.shortcuttemplate, opts);
|
|
1081
|
+
}
|
|
1082
|
+
path(opts) {
|
|
1083
|
+
return this.#fill(this.pathtemplate, opts);
|
|
1084
|
+
}
|
|
1085
|
+
tarball(opts) {
|
|
1086
|
+
return this.#fill(this.tarballtemplate, { ...opts, noCommittish: false });
|
|
1087
|
+
}
|
|
1088
|
+
file(path, opts) {
|
|
1089
|
+
return this.#fill(this.filetemplate, { ...opts, path });
|
|
1090
|
+
}
|
|
1091
|
+
edit(path, opts) {
|
|
1092
|
+
return this.#fill(this.edittemplate, { ...opts, path });
|
|
1093
|
+
}
|
|
1094
|
+
getDefaultRepresentation() {
|
|
1095
|
+
return this.default;
|
|
1096
|
+
}
|
|
1097
|
+
toString(opts) {
|
|
1098
|
+
if (this.default && typeof this[this.default] === "function") {
|
|
1099
|
+
return this[this.default](opts);
|
|
1100
|
+
}
|
|
1101
|
+
return this.sshurl(opts);
|
|
1102
|
+
}
|
|
1103
|
+
}
|
|
1104
|
+
for (const [name, host] of Object.entries(hosts)) {
|
|
1105
|
+
GitHost.addHost(name, host);
|
|
1106
|
+
}
|
|
1107
|
+
module.exports = GitHost;
|
|
1108
|
+
});
|
|
1109
|
+
|
|
1110
|
+
// ../../node_modules/.bun/semver@7.7.4/node_modules/semver/internal/constants.js
|
|
1111
|
+
var require_constants = __commonJS((exports, module) => {
|
|
1112
|
+
var SEMVER_SPEC_VERSION = "2.0.0";
|
|
1113
|
+
var MAX_LENGTH = 256;
|
|
1114
|
+
var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;
|
|
1115
|
+
var MAX_SAFE_COMPONENT_LENGTH = 16;
|
|
1116
|
+
var MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6;
|
|
1117
|
+
var RELEASE_TYPES = [
|
|
1118
|
+
"major",
|
|
1119
|
+
"premajor",
|
|
1120
|
+
"minor",
|
|
1121
|
+
"preminor",
|
|
1122
|
+
"patch",
|
|
1123
|
+
"prepatch",
|
|
1124
|
+
"prerelease"
|
|
1125
|
+
];
|
|
1126
|
+
module.exports = {
|
|
1127
|
+
MAX_LENGTH,
|
|
1128
|
+
MAX_SAFE_COMPONENT_LENGTH,
|
|
1129
|
+
MAX_SAFE_BUILD_LENGTH,
|
|
1130
|
+
MAX_SAFE_INTEGER,
|
|
1131
|
+
RELEASE_TYPES,
|
|
1132
|
+
SEMVER_SPEC_VERSION,
|
|
1133
|
+
FLAG_INCLUDE_PRERELEASE: 1,
|
|
1134
|
+
FLAG_LOOSE: 2
|
|
1135
|
+
};
|
|
1136
|
+
});
|
|
1137
|
+
|
|
1138
|
+
// ../../node_modules/.bun/semver@7.7.4/node_modules/semver/internal/debug.js
|
|
1139
|
+
var require_debug = __commonJS((exports, module) => {
|
|
1140
|
+
var debug = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {};
|
|
1141
|
+
module.exports = debug;
|
|
1142
|
+
});
|
|
1143
|
+
|
|
1144
|
+
// ../../node_modules/.bun/semver@7.7.4/node_modules/semver/internal/re.js
|
|
1145
|
+
var require_re = __commonJS((exports, module) => {
|
|
1146
|
+
var {
|
|
1147
|
+
MAX_SAFE_COMPONENT_LENGTH,
|
|
1148
|
+
MAX_SAFE_BUILD_LENGTH,
|
|
1149
|
+
MAX_LENGTH
|
|
1150
|
+
} = require_constants();
|
|
1151
|
+
var debug = require_debug();
|
|
1152
|
+
exports = module.exports = {};
|
|
1153
|
+
var re = exports.re = [];
|
|
1154
|
+
var safeRe = exports.safeRe = [];
|
|
1155
|
+
var src = exports.src = [];
|
|
1156
|
+
var safeSrc = exports.safeSrc = [];
|
|
1157
|
+
var t = exports.t = {};
|
|
1158
|
+
var R = 0;
|
|
1159
|
+
var LETTERDASHNUMBER = "[a-zA-Z0-9-]";
|
|
1160
|
+
var safeRegexReplacements = [
|
|
1161
|
+
["\\s", 1],
|
|
1162
|
+
["\\d", MAX_LENGTH],
|
|
1163
|
+
[LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]
|
|
1164
|
+
];
|
|
1165
|
+
var makeSafeRegex = (value) => {
|
|
1166
|
+
for (const [token, max] of safeRegexReplacements) {
|
|
1167
|
+
value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);
|
|
1168
|
+
}
|
|
1169
|
+
return value;
|
|
1170
|
+
};
|
|
1171
|
+
var createToken = (name, value, isGlobal) => {
|
|
1172
|
+
const safe = makeSafeRegex(value);
|
|
1173
|
+
const index = R++;
|
|
1174
|
+
debug(name, index, value);
|
|
1175
|
+
t[name] = index;
|
|
1176
|
+
src[index] = value;
|
|
1177
|
+
safeSrc[index] = safe;
|
|
1178
|
+
re[index] = new RegExp(value, isGlobal ? "g" : undefined);
|
|
1179
|
+
safeRe[index] = new RegExp(safe, isGlobal ? "g" : undefined);
|
|
1180
|
+
};
|
|
1181
|
+
createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
|
|
1182
|
+
createToken("NUMERICIDENTIFIERLOOSE", "\\d+");
|
|
1183
|
+
createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
|
|
1184
|
+
createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.` + `(${src[t.NUMERICIDENTIFIER]})\\.` + `(${src[t.NUMERICIDENTIFIER]})`);
|
|
1185
|
+
createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + `(${src[t.NUMERICIDENTIFIERLOOSE]})`);
|
|
1186
|
+
createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIER]})`);
|
|
1187
|
+
createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIERLOOSE]})`);
|
|
1188
|
+
createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
|
|
1189
|
+
createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
|
|
1190
|
+
createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
|
|
1191
|
+
createToken("BUILD", `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
|
|
1192
|
+
createToken("FULLPLAIN", `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);
|
|
1193
|
+
createToken("FULL", `^${src[t.FULLPLAIN]}$`);
|
|
1194
|
+
createToken("LOOSEPLAIN", `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`);
|
|
1195
|
+
createToken("LOOSE", `^${src[t.LOOSEPLAIN]}$`);
|
|
1196
|
+
createToken("GTLT", "((?:<|>)?=?)");
|
|
1197
|
+
createToken("XRANGEIDENTIFIERLOOSE", `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
|
|
1198
|
+
createToken("XRANGEIDENTIFIER", `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
|
|
1199
|
+
createToken("XRANGEPLAIN", `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` + `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + `(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?` + `)?)?`);
|
|
1200
|
+
createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` + `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + `(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?` + `)?)?`);
|
|
1201
|
+
createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
|
|
1202
|
+
createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
|
|
1203
|
+
createToken("COERCEPLAIN", `${"(^|[^\\d])" + "(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH}})` + `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` + `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
|
|
1204
|
+
createToken("COERCE", `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
|
|
1205
|
+
createToken("COERCEFULL", src[t.COERCEPLAIN] + `(?:${src[t.PRERELEASE]})?` + `(?:${src[t.BUILD]})?` + `(?:$|[^\\d])`);
|
|
1206
|
+
createToken("COERCERTL", src[t.COERCE], true);
|
|
1207
|
+
createToken("COERCERTLFULL", src[t.COERCEFULL], true);
|
|
1208
|
+
createToken("LONETILDE", "(?:~>?)");
|
|
1209
|
+
createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, true);
|
|
1210
|
+
exports.tildeTrimReplace = "$1~";
|
|
1211
|
+
createToken("TILDE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
|
|
1212
|
+
createToken("TILDELOOSE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
|
|
1213
|
+
createToken("LONECARET", "(?:\\^)");
|
|
1214
|
+
createToken("CARETTRIM", `(\\s*)${src[t.LONECARET]}\\s+`, true);
|
|
1215
|
+
exports.caretTrimReplace = "$1^";
|
|
1216
|
+
createToken("CARET", `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
|
|
1217
|
+
createToken("CARETLOOSE", `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
|
|
1218
|
+
createToken("COMPARATORLOOSE", `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
|
|
1219
|
+
createToken("COMPARATOR", `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
|
|
1220
|
+
createToken("COMPARATORTRIM", `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
|
|
1221
|
+
exports.comparatorTrimReplace = "$1$2$3";
|
|
1222
|
+
createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})` + `\\s+-\\s+` + `(${src[t.XRANGEPLAIN]})` + `\\s*$`);
|
|
1223
|
+
createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})` + `\\s+-\\s+` + `(${src[t.XRANGEPLAINLOOSE]})` + `\\s*$`);
|
|
1224
|
+
createToken("STAR", "(<|>)?=?\\s*\\*");
|
|
1225
|
+
createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
|
|
1226
|
+
createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
|
|
1227
|
+
});
|
|
1228
|
+
|
|
1229
|
+
// ../../node_modules/.bun/semver@7.7.4/node_modules/semver/internal/parse-options.js
|
|
1230
|
+
var require_parse_options = __commonJS((exports, module) => {
|
|
1231
|
+
var looseOption = Object.freeze({ loose: true });
|
|
1232
|
+
var emptyOpts = Object.freeze({});
|
|
1233
|
+
var parseOptions = (options) => {
|
|
1234
|
+
if (!options) {
|
|
1235
|
+
return emptyOpts;
|
|
1236
|
+
}
|
|
1237
|
+
if (typeof options !== "object") {
|
|
1238
|
+
return looseOption;
|
|
1239
|
+
}
|
|
1240
|
+
return options;
|
|
1241
|
+
};
|
|
1242
|
+
module.exports = parseOptions;
|
|
1243
|
+
});
|
|
1244
|
+
|
|
1245
|
+
// ../../node_modules/.bun/semver@7.7.4/node_modules/semver/internal/identifiers.js
|
|
1246
|
+
var require_identifiers = __commonJS((exports, module) => {
|
|
1247
|
+
var numeric = /^[0-9]+$/;
|
|
1248
|
+
var compareIdentifiers = (a, b) => {
|
|
1249
|
+
if (typeof a === "number" && typeof b === "number") {
|
|
1250
|
+
return a === b ? 0 : a < b ? -1 : 1;
|
|
1251
|
+
}
|
|
1252
|
+
const anum = numeric.test(a);
|
|
1253
|
+
const bnum = numeric.test(b);
|
|
1254
|
+
if (anum && bnum) {
|
|
1255
|
+
a = +a;
|
|
1256
|
+
b = +b;
|
|
1257
|
+
}
|
|
1258
|
+
return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
|
|
1259
|
+
};
|
|
1260
|
+
var rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
|
|
1261
|
+
module.exports = {
|
|
1262
|
+
compareIdentifiers,
|
|
1263
|
+
rcompareIdentifiers
|
|
1264
|
+
};
|
|
1265
|
+
});
|
|
1266
|
+
|
|
1267
|
+
// ../../node_modules/.bun/semver@7.7.4/node_modules/semver/classes/semver.js
|
|
1268
|
+
var require_semver = __commonJS((exports, module) => {
|
|
1269
|
+
var debug = require_debug();
|
|
1270
|
+
var { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants();
|
|
1271
|
+
var { safeRe: re, t } = require_re();
|
|
1272
|
+
var parseOptions = require_parse_options();
|
|
1273
|
+
var { compareIdentifiers } = require_identifiers();
|
|
1274
|
+
|
|
1275
|
+
class SemVer {
|
|
1276
|
+
constructor(version, options) {
|
|
1277
|
+
options = parseOptions(options);
|
|
1278
|
+
if (version instanceof SemVer) {
|
|
1279
|
+
if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) {
|
|
1280
|
+
return version;
|
|
1281
|
+
} else {
|
|
1282
|
+
version = version.version;
|
|
1283
|
+
}
|
|
1284
|
+
} else if (typeof version !== "string") {
|
|
1285
|
+
throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`);
|
|
1286
|
+
}
|
|
1287
|
+
if (version.length > MAX_LENGTH) {
|
|
1288
|
+
throw new TypeError(`version is longer than ${MAX_LENGTH} characters`);
|
|
1289
|
+
}
|
|
1290
|
+
debug("SemVer", version, options);
|
|
1291
|
+
this.options = options;
|
|
1292
|
+
this.loose = !!options.loose;
|
|
1293
|
+
this.includePrerelease = !!options.includePrerelease;
|
|
1294
|
+
const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
|
|
1295
|
+
if (!m) {
|
|
1296
|
+
throw new TypeError(`Invalid Version: ${version}`);
|
|
1297
|
+
}
|
|
1298
|
+
this.raw = version;
|
|
1299
|
+
this.major = +m[1];
|
|
1300
|
+
this.minor = +m[2];
|
|
1301
|
+
this.patch = +m[3];
|
|
1302
|
+
if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
|
|
1303
|
+
throw new TypeError("Invalid major version");
|
|
1304
|
+
}
|
|
1305
|
+
if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
|
|
1306
|
+
throw new TypeError("Invalid minor version");
|
|
1307
|
+
}
|
|
1308
|
+
if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
|
|
1309
|
+
throw new TypeError("Invalid patch version");
|
|
1310
|
+
}
|
|
1311
|
+
if (!m[4]) {
|
|
1312
|
+
this.prerelease = [];
|
|
1313
|
+
} else {
|
|
1314
|
+
this.prerelease = m[4].split(".").map((id) => {
|
|
1315
|
+
if (/^[0-9]+$/.test(id)) {
|
|
1316
|
+
const num = +id;
|
|
1317
|
+
if (num >= 0 && num < MAX_SAFE_INTEGER) {
|
|
1318
|
+
return num;
|
|
1319
|
+
}
|
|
1320
|
+
}
|
|
1321
|
+
return id;
|
|
1322
|
+
});
|
|
1323
|
+
}
|
|
1324
|
+
this.build = m[5] ? m[5].split(".") : [];
|
|
1325
|
+
this.format();
|
|
1326
|
+
}
|
|
1327
|
+
format() {
|
|
1328
|
+
this.version = `${this.major}.${this.minor}.${this.patch}`;
|
|
1329
|
+
if (this.prerelease.length) {
|
|
1330
|
+
this.version += `-${this.prerelease.join(".")}`;
|
|
1331
|
+
}
|
|
1332
|
+
return this.version;
|
|
1333
|
+
}
|
|
1334
|
+
toString() {
|
|
1335
|
+
return this.version;
|
|
1336
|
+
}
|
|
1337
|
+
compare(other) {
|
|
1338
|
+
debug("SemVer.compare", this.version, this.options, other);
|
|
1339
|
+
if (!(other instanceof SemVer)) {
|
|
1340
|
+
if (typeof other === "string" && other === this.version) {
|
|
1341
|
+
return 0;
|
|
1342
|
+
}
|
|
1343
|
+
other = new SemVer(other, this.options);
|
|
1344
|
+
}
|
|
1345
|
+
if (other.version === this.version) {
|
|
1346
|
+
return 0;
|
|
1347
|
+
}
|
|
1348
|
+
return this.compareMain(other) || this.comparePre(other);
|
|
1349
|
+
}
|
|
1350
|
+
compareMain(other) {
|
|
1351
|
+
if (!(other instanceof SemVer)) {
|
|
1352
|
+
other = new SemVer(other, this.options);
|
|
1353
|
+
}
|
|
1354
|
+
if (this.major < other.major) {
|
|
1355
|
+
return -1;
|
|
1356
|
+
}
|
|
1357
|
+
if (this.major > other.major) {
|
|
1358
|
+
return 1;
|
|
1359
|
+
}
|
|
1360
|
+
if (this.minor < other.minor) {
|
|
1361
|
+
return -1;
|
|
1362
|
+
}
|
|
1363
|
+
if (this.minor > other.minor) {
|
|
1364
|
+
return 1;
|
|
1365
|
+
}
|
|
1366
|
+
if (this.patch < other.patch) {
|
|
1367
|
+
return -1;
|
|
1368
|
+
}
|
|
1369
|
+
if (this.patch > other.patch) {
|
|
1370
|
+
return 1;
|
|
1371
|
+
}
|
|
1372
|
+
return 0;
|
|
1373
|
+
}
|
|
1374
|
+
comparePre(other) {
|
|
1375
|
+
if (!(other instanceof SemVer)) {
|
|
1376
|
+
other = new SemVer(other, this.options);
|
|
1377
|
+
}
|
|
1378
|
+
if (this.prerelease.length && !other.prerelease.length) {
|
|
1379
|
+
return -1;
|
|
1380
|
+
} else if (!this.prerelease.length && other.prerelease.length) {
|
|
1381
|
+
return 1;
|
|
1382
|
+
} else if (!this.prerelease.length && !other.prerelease.length) {
|
|
1383
|
+
return 0;
|
|
1384
|
+
}
|
|
1385
|
+
let i = 0;
|
|
1386
|
+
do {
|
|
1387
|
+
const a = this.prerelease[i];
|
|
1388
|
+
const b = other.prerelease[i];
|
|
1389
|
+
debug("prerelease compare", i, a, b);
|
|
1390
|
+
if (a === undefined && b === undefined) {
|
|
1391
|
+
return 0;
|
|
1392
|
+
} else if (b === undefined) {
|
|
1393
|
+
return 1;
|
|
1394
|
+
} else if (a === undefined) {
|
|
1395
|
+
return -1;
|
|
1396
|
+
} else if (a === b) {
|
|
1397
|
+
continue;
|
|
1398
|
+
} else {
|
|
1399
|
+
return compareIdentifiers(a, b);
|
|
1400
|
+
}
|
|
1401
|
+
} while (++i);
|
|
1402
|
+
}
|
|
1403
|
+
compareBuild(other) {
|
|
1404
|
+
if (!(other instanceof SemVer)) {
|
|
1405
|
+
other = new SemVer(other, this.options);
|
|
1406
|
+
}
|
|
1407
|
+
let i = 0;
|
|
1408
|
+
do {
|
|
1409
|
+
const a = this.build[i];
|
|
1410
|
+
const b = other.build[i];
|
|
1411
|
+
debug("build compare", i, a, b);
|
|
1412
|
+
if (a === undefined && b === undefined) {
|
|
1413
|
+
return 0;
|
|
1414
|
+
} else if (b === undefined) {
|
|
1415
|
+
return 1;
|
|
1416
|
+
} else if (a === undefined) {
|
|
1417
|
+
return -1;
|
|
1418
|
+
} else if (a === b) {
|
|
1419
|
+
continue;
|
|
1420
|
+
} else {
|
|
1421
|
+
return compareIdentifiers(a, b);
|
|
1422
|
+
}
|
|
1423
|
+
} while (++i);
|
|
1424
|
+
}
|
|
1425
|
+
inc(release, identifier, identifierBase) {
|
|
1426
|
+
if (release.startsWith("pre")) {
|
|
1427
|
+
if (!identifier && identifierBase === false) {
|
|
1428
|
+
throw new Error("invalid increment argument: identifier is empty");
|
|
1429
|
+
}
|
|
1430
|
+
if (identifier) {
|
|
1431
|
+
const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE]);
|
|
1432
|
+
if (!match || match[1] !== identifier) {
|
|
1433
|
+
throw new Error(`invalid identifier: ${identifier}`);
|
|
1434
|
+
}
|
|
1435
|
+
}
|
|
1436
|
+
}
|
|
1437
|
+
switch (release) {
|
|
1438
|
+
case "premajor":
|
|
1439
|
+
this.prerelease.length = 0;
|
|
1440
|
+
this.patch = 0;
|
|
1441
|
+
this.minor = 0;
|
|
1442
|
+
this.major++;
|
|
1443
|
+
this.inc("pre", identifier, identifierBase);
|
|
1444
|
+
break;
|
|
1445
|
+
case "preminor":
|
|
1446
|
+
this.prerelease.length = 0;
|
|
1447
|
+
this.patch = 0;
|
|
1448
|
+
this.minor++;
|
|
1449
|
+
this.inc("pre", identifier, identifierBase);
|
|
1450
|
+
break;
|
|
1451
|
+
case "prepatch":
|
|
1452
|
+
this.prerelease.length = 0;
|
|
1453
|
+
this.inc("patch", identifier, identifierBase);
|
|
1454
|
+
this.inc("pre", identifier, identifierBase);
|
|
1455
|
+
break;
|
|
1456
|
+
case "prerelease":
|
|
1457
|
+
if (this.prerelease.length === 0) {
|
|
1458
|
+
this.inc("patch", identifier, identifierBase);
|
|
1459
|
+
}
|
|
1460
|
+
this.inc("pre", identifier, identifierBase);
|
|
1461
|
+
break;
|
|
1462
|
+
case "release":
|
|
1463
|
+
if (this.prerelease.length === 0) {
|
|
1464
|
+
throw new Error(`version ${this.raw} is not a prerelease`);
|
|
1465
|
+
}
|
|
1466
|
+
this.prerelease.length = 0;
|
|
1467
|
+
break;
|
|
1468
|
+
case "major":
|
|
1469
|
+
if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
|
|
1470
|
+
this.major++;
|
|
1471
|
+
}
|
|
1472
|
+
this.minor = 0;
|
|
1473
|
+
this.patch = 0;
|
|
1474
|
+
this.prerelease = [];
|
|
1475
|
+
break;
|
|
1476
|
+
case "minor":
|
|
1477
|
+
if (this.patch !== 0 || this.prerelease.length === 0) {
|
|
1478
|
+
this.minor++;
|
|
1479
|
+
}
|
|
1480
|
+
this.patch = 0;
|
|
1481
|
+
this.prerelease = [];
|
|
1482
|
+
break;
|
|
1483
|
+
case "patch":
|
|
1484
|
+
if (this.prerelease.length === 0) {
|
|
1485
|
+
this.patch++;
|
|
1486
|
+
}
|
|
1487
|
+
this.prerelease = [];
|
|
1488
|
+
break;
|
|
1489
|
+
case "pre": {
|
|
1490
|
+
const base = Number(identifierBase) ? 1 : 0;
|
|
1491
|
+
if (this.prerelease.length === 0) {
|
|
1492
|
+
this.prerelease = [base];
|
|
1493
|
+
} else {
|
|
1494
|
+
let i = this.prerelease.length;
|
|
1495
|
+
while (--i >= 0) {
|
|
1496
|
+
if (typeof this.prerelease[i] === "number") {
|
|
1497
|
+
this.prerelease[i]++;
|
|
1498
|
+
i = -2;
|
|
1499
|
+
}
|
|
1500
|
+
}
|
|
1501
|
+
if (i === -1) {
|
|
1502
|
+
if (identifier === this.prerelease.join(".") && identifierBase === false) {
|
|
1503
|
+
throw new Error("invalid increment argument: identifier already exists");
|
|
1504
|
+
}
|
|
1505
|
+
this.prerelease.push(base);
|
|
1506
|
+
}
|
|
1507
|
+
}
|
|
1508
|
+
if (identifier) {
|
|
1509
|
+
let prerelease = [identifier, base];
|
|
1510
|
+
if (identifierBase === false) {
|
|
1511
|
+
prerelease = [identifier];
|
|
1512
|
+
}
|
|
1513
|
+
if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
|
|
1514
|
+
if (isNaN(this.prerelease[1])) {
|
|
1515
|
+
this.prerelease = prerelease;
|
|
1516
|
+
}
|
|
1517
|
+
} else {
|
|
1518
|
+
this.prerelease = prerelease;
|
|
1519
|
+
}
|
|
1520
|
+
}
|
|
1521
|
+
break;
|
|
1522
|
+
}
|
|
1523
|
+
default:
|
|
1524
|
+
throw new Error(`invalid increment argument: ${release}`);
|
|
1525
|
+
}
|
|
1526
|
+
this.raw = this.format();
|
|
1527
|
+
if (this.build.length) {
|
|
1528
|
+
this.raw += `+${this.build.join(".")}`;
|
|
1529
|
+
}
|
|
1530
|
+
return this;
|
|
1531
|
+
}
|
|
1532
|
+
}
|
|
1533
|
+
module.exports = SemVer;
|
|
1534
|
+
});
|
|
1535
|
+
|
|
1536
|
+
// ../../node_modules/.bun/semver@7.7.4/node_modules/semver/functions/parse.js
|
|
1537
|
+
var require_parse = __commonJS((exports, module) => {
|
|
1538
|
+
var SemVer = require_semver();
|
|
1539
|
+
var parse = (version, options, throwErrors = false) => {
|
|
1540
|
+
if (version instanceof SemVer) {
|
|
1541
|
+
return version;
|
|
1542
|
+
}
|
|
1543
|
+
try {
|
|
1544
|
+
return new SemVer(version, options);
|
|
1545
|
+
} catch (er) {
|
|
1546
|
+
if (!throwErrors) {
|
|
1547
|
+
return null;
|
|
1548
|
+
}
|
|
1549
|
+
throw er;
|
|
1550
|
+
}
|
|
1551
|
+
};
|
|
1552
|
+
module.exports = parse;
|
|
1553
|
+
});
|
|
1554
|
+
|
|
1555
|
+
// ../../node_modules/.bun/semver@7.7.4/node_modules/semver/functions/valid.js
|
|
1556
|
+
var require_valid = __commonJS((exports, module) => {
|
|
1557
|
+
var parse = require_parse();
|
|
1558
|
+
var valid = (version, options) => {
|
|
1559
|
+
const v = parse(version, options);
|
|
1560
|
+
return v ? v.version : null;
|
|
1561
|
+
};
|
|
1562
|
+
module.exports = valid;
|
|
1563
|
+
});
|
|
1564
|
+
|
|
1565
|
+
// ../../node_modules/.bun/semver@7.7.4/node_modules/semver/functions/clean.js
|
|
1566
|
+
var require_clean = __commonJS((exports, module) => {
|
|
1567
|
+
var parse = require_parse();
|
|
1568
|
+
var clean = (version, options) => {
|
|
1569
|
+
const s = parse(version.trim().replace(/^[=v]+/, ""), options);
|
|
1570
|
+
return s ? s.version : null;
|
|
1571
|
+
};
|
|
1572
|
+
module.exports = clean;
|
|
1573
|
+
});
|
|
1574
|
+
|
|
1575
|
+
// ../../node_modules/.bun/semver@7.7.4/node_modules/semver/functions/inc.js
|
|
1576
|
+
var require_inc = __commonJS((exports, module) => {
|
|
1577
|
+
var SemVer = require_semver();
|
|
1578
|
+
var inc = (version, release, options, identifier, identifierBase) => {
|
|
1579
|
+
if (typeof options === "string") {
|
|
1580
|
+
identifierBase = identifier;
|
|
1581
|
+
identifier = options;
|
|
1582
|
+
options = undefined;
|
|
1583
|
+
}
|
|
1584
|
+
try {
|
|
1585
|
+
return new SemVer(version instanceof SemVer ? version.version : version, options).inc(release, identifier, identifierBase).version;
|
|
1586
|
+
} catch (er) {
|
|
1587
|
+
return null;
|
|
1588
|
+
}
|
|
1589
|
+
};
|
|
1590
|
+
module.exports = inc;
|
|
1591
|
+
});
|
|
1592
|
+
|
|
1593
|
+
// ../../node_modules/.bun/semver@7.7.4/node_modules/semver/functions/diff.js
|
|
1594
|
+
var require_diff = __commonJS((exports, module) => {
|
|
1595
|
+
var parse = require_parse();
|
|
1596
|
+
var diff = (version1, version2) => {
|
|
1597
|
+
const v1 = parse(version1, null, true);
|
|
1598
|
+
const v2 = parse(version2, null, true);
|
|
1599
|
+
const comparison = v1.compare(v2);
|
|
1600
|
+
if (comparison === 0) {
|
|
1601
|
+
return null;
|
|
1602
|
+
}
|
|
1603
|
+
const v1Higher = comparison > 0;
|
|
1604
|
+
const highVersion = v1Higher ? v1 : v2;
|
|
1605
|
+
const lowVersion = v1Higher ? v2 : v1;
|
|
1606
|
+
const highHasPre = !!highVersion.prerelease.length;
|
|
1607
|
+
const lowHasPre = !!lowVersion.prerelease.length;
|
|
1608
|
+
if (lowHasPre && !highHasPre) {
|
|
1609
|
+
if (!lowVersion.patch && !lowVersion.minor) {
|
|
1610
|
+
return "major";
|
|
1611
|
+
}
|
|
1612
|
+
if (lowVersion.compareMain(highVersion) === 0) {
|
|
1613
|
+
if (lowVersion.minor && !lowVersion.patch) {
|
|
1614
|
+
return "minor";
|
|
1615
|
+
}
|
|
1616
|
+
return "patch";
|
|
1617
|
+
}
|
|
1618
|
+
}
|
|
1619
|
+
const prefix = highHasPre ? "pre" : "";
|
|
1620
|
+
if (v1.major !== v2.major) {
|
|
1621
|
+
return prefix + "major";
|
|
1622
|
+
}
|
|
1623
|
+
if (v1.minor !== v2.minor) {
|
|
1624
|
+
return prefix + "minor";
|
|
1625
|
+
}
|
|
1626
|
+
if (v1.patch !== v2.patch) {
|
|
1627
|
+
return prefix + "patch";
|
|
1628
|
+
}
|
|
1629
|
+
return "prerelease";
|
|
1630
|
+
};
|
|
1631
|
+
module.exports = diff;
|
|
1632
|
+
});
|
|
1633
|
+
|
|
1634
|
+
// ../../node_modules/.bun/semver@7.7.4/node_modules/semver/functions/major.js
|
|
1635
|
+
var require_major = __commonJS((exports, module) => {
|
|
1636
|
+
var SemVer = require_semver();
|
|
1637
|
+
var major = (a, loose) => new SemVer(a, loose).major;
|
|
1638
|
+
module.exports = major;
|
|
1639
|
+
});
|
|
1640
|
+
|
|
1641
|
+
// ../../node_modules/.bun/semver@7.7.4/node_modules/semver/functions/minor.js
|
|
1642
|
+
var require_minor = __commonJS((exports, module) => {
|
|
1643
|
+
var SemVer = require_semver();
|
|
1644
|
+
var minor = (a, loose) => new SemVer(a, loose).minor;
|
|
1645
|
+
module.exports = minor;
|
|
1646
|
+
});
|
|
1647
|
+
|
|
1648
|
+
// ../../node_modules/.bun/semver@7.7.4/node_modules/semver/functions/patch.js
|
|
1649
|
+
var require_patch = __commonJS((exports, module) => {
|
|
1650
|
+
var SemVer = require_semver();
|
|
1651
|
+
var patch = (a, loose) => new SemVer(a, loose).patch;
|
|
1652
|
+
module.exports = patch;
|
|
1653
|
+
});
|
|
1654
|
+
|
|
1655
|
+
// ../../node_modules/.bun/semver@7.7.4/node_modules/semver/functions/prerelease.js
|
|
1656
|
+
var require_prerelease = __commonJS((exports, module) => {
|
|
1657
|
+
var parse = require_parse();
|
|
1658
|
+
var prerelease = (version, options) => {
|
|
1659
|
+
const parsed = parse(version, options);
|
|
1660
|
+
return parsed && parsed.prerelease.length ? parsed.prerelease : null;
|
|
1661
|
+
};
|
|
1662
|
+
module.exports = prerelease;
|
|
1663
|
+
});
|
|
1664
|
+
|
|
1665
|
+
// ../../node_modules/.bun/semver@7.7.4/node_modules/semver/functions/compare.js
|
|
1666
|
+
var require_compare = __commonJS((exports, module) => {
|
|
1667
|
+
var SemVer = require_semver();
|
|
1668
|
+
var compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
|
|
1669
|
+
module.exports = compare;
|
|
1670
|
+
});
|
|
1671
|
+
|
|
1672
|
+
// ../../node_modules/.bun/semver@7.7.4/node_modules/semver/functions/rcompare.js
|
|
1673
|
+
var require_rcompare = __commonJS((exports, module) => {
|
|
1674
|
+
var compare = require_compare();
|
|
1675
|
+
var rcompare = (a, b, loose) => compare(b, a, loose);
|
|
1676
|
+
module.exports = rcompare;
|
|
1677
|
+
});
|
|
1678
|
+
|
|
1679
|
+
// ../../node_modules/.bun/semver@7.7.4/node_modules/semver/functions/compare-loose.js
|
|
1680
|
+
var require_compare_loose = __commonJS((exports, module) => {
|
|
1681
|
+
var compare = require_compare();
|
|
1682
|
+
var compareLoose = (a, b) => compare(a, b, true);
|
|
1683
|
+
module.exports = compareLoose;
|
|
1684
|
+
});
|
|
1685
|
+
|
|
1686
|
+
// ../../node_modules/.bun/semver@7.7.4/node_modules/semver/functions/compare-build.js
|
|
1687
|
+
var require_compare_build = __commonJS((exports, module) => {
|
|
1688
|
+
var SemVer = require_semver();
|
|
1689
|
+
var compareBuild = (a, b, loose) => {
|
|
1690
|
+
const versionA = new SemVer(a, loose);
|
|
1691
|
+
const versionB = new SemVer(b, loose);
|
|
1692
|
+
return versionA.compare(versionB) || versionA.compareBuild(versionB);
|
|
1693
|
+
};
|
|
1694
|
+
module.exports = compareBuild;
|
|
1695
|
+
});
|
|
1696
|
+
|
|
1697
|
+
// ../../node_modules/.bun/semver@7.7.4/node_modules/semver/functions/sort.js
|
|
1698
|
+
var require_sort = __commonJS((exports, module) => {
|
|
1699
|
+
var compareBuild = require_compare_build();
|
|
1700
|
+
var sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose));
|
|
1701
|
+
module.exports = sort;
|
|
1702
|
+
});
|
|
1703
|
+
|
|
1704
|
+
// ../../node_modules/.bun/semver@7.7.4/node_modules/semver/functions/rsort.js
|
|
1705
|
+
var require_rsort = __commonJS((exports, module) => {
|
|
1706
|
+
var compareBuild = require_compare_build();
|
|
1707
|
+
var rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose));
|
|
1708
|
+
module.exports = rsort;
|
|
1709
|
+
});
|
|
1710
|
+
|
|
1711
|
+
// ../../node_modules/.bun/semver@7.7.4/node_modules/semver/functions/gt.js
|
|
1712
|
+
var require_gt = __commonJS((exports, module) => {
|
|
1713
|
+
var compare = require_compare();
|
|
1714
|
+
var gt = (a, b, loose) => compare(a, b, loose) > 0;
|
|
1715
|
+
module.exports = gt;
|
|
1716
|
+
});
|
|
1717
|
+
|
|
1718
|
+
// ../../node_modules/.bun/semver@7.7.4/node_modules/semver/functions/lt.js
|
|
1719
|
+
var require_lt = __commonJS((exports, module) => {
|
|
1720
|
+
var compare = require_compare();
|
|
1721
|
+
var lt = (a, b, loose) => compare(a, b, loose) < 0;
|
|
1722
|
+
module.exports = lt;
|
|
1723
|
+
});
|
|
1724
|
+
|
|
1725
|
+
// ../../node_modules/.bun/semver@7.7.4/node_modules/semver/functions/eq.js
|
|
1726
|
+
var require_eq = __commonJS((exports, module) => {
|
|
1727
|
+
var compare = require_compare();
|
|
1728
|
+
var eq = (a, b, loose) => compare(a, b, loose) === 0;
|
|
1729
|
+
module.exports = eq;
|
|
1730
|
+
});
|
|
1731
|
+
|
|
1732
|
+
// ../../node_modules/.bun/semver@7.7.4/node_modules/semver/functions/neq.js
|
|
1733
|
+
var require_neq = __commonJS((exports, module) => {
|
|
1734
|
+
var compare = require_compare();
|
|
1735
|
+
var neq = (a, b, loose) => compare(a, b, loose) !== 0;
|
|
1736
|
+
module.exports = neq;
|
|
1737
|
+
});
|
|
1738
|
+
|
|
1739
|
+
// ../../node_modules/.bun/semver@7.7.4/node_modules/semver/functions/gte.js
|
|
1740
|
+
var require_gte = __commonJS((exports, module) => {
|
|
1741
|
+
var compare = require_compare();
|
|
1742
|
+
var gte = (a, b, loose) => compare(a, b, loose) >= 0;
|
|
1743
|
+
module.exports = gte;
|
|
1744
|
+
});
|
|
1745
|
+
|
|
1746
|
+
// ../../node_modules/.bun/semver@7.7.4/node_modules/semver/functions/lte.js
|
|
1747
|
+
var require_lte = __commonJS((exports, module) => {
|
|
1748
|
+
var compare = require_compare();
|
|
1749
|
+
var lte = (a, b, loose) => compare(a, b, loose) <= 0;
|
|
1750
|
+
module.exports = lte;
|
|
1751
|
+
});
|
|
1752
|
+
|
|
1753
|
+
// ../../node_modules/.bun/semver@7.7.4/node_modules/semver/functions/cmp.js
|
|
1754
|
+
var require_cmp = __commonJS((exports, module) => {
|
|
1755
|
+
var eq = require_eq();
|
|
1756
|
+
var neq = require_neq();
|
|
1757
|
+
var gt = require_gt();
|
|
1758
|
+
var gte = require_gte();
|
|
1759
|
+
var lt = require_lt();
|
|
1760
|
+
var lte = require_lte();
|
|
1761
|
+
var cmp = (a, op, b, loose) => {
|
|
1762
|
+
switch (op) {
|
|
1763
|
+
case "===":
|
|
1764
|
+
if (typeof a === "object") {
|
|
1765
|
+
a = a.version;
|
|
1766
|
+
}
|
|
1767
|
+
if (typeof b === "object") {
|
|
1768
|
+
b = b.version;
|
|
1769
|
+
}
|
|
1770
|
+
return a === b;
|
|
1771
|
+
case "!==":
|
|
1772
|
+
if (typeof a === "object") {
|
|
1773
|
+
a = a.version;
|
|
1774
|
+
}
|
|
1775
|
+
if (typeof b === "object") {
|
|
1776
|
+
b = b.version;
|
|
1777
|
+
}
|
|
1778
|
+
return a !== b;
|
|
1779
|
+
case "":
|
|
1780
|
+
case "=":
|
|
1781
|
+
case "==":
|
|
1782
|
+
return eq(a, b, loose);
|
|
1783
|
+
case "!=":
|
|
1784
|
+
return neq(a, b, loose);
|
|
1785
|
+
case ">":
|
|
1786
|
+
return gt(a, b, loose);
|
|
1787
|
+
case ">=":
|
|
1788
|
+
return gte(a, b, loose);
|
|
1789
|
+
case "<":
|
|
1790
|
+
return lt(a, b, loose);
|
|
1791
|
+
case "<=":
|
|
1792
|
+
return lte(a, b, loose);
|
|
1793
|
+
default:
|
|
1794
|
+
throw new TypeError(`Invalid operator: ${op}`);
|
|
1795
|
+
}
|
|
1796
|
+
};
|
|
1797
|
+
module.exports = cmp;
|
|
1798
|
+
});
|
|
1799
|
+
|
|
1800
|
+
// ../../node_modules/.bun/semver@7.7.4/node_modules/semver/functions/coerce.js
|
|
1801
|
+
var require_coerce = __commonJS((exports, module) => {
|
|
1802
|
+
var SemVer = require_semver();
|
|
1803
|
+
var parse = require_parse();
|
|
1804
|
+
var { safeRe: re, t } = require_re();
|
|
1805
|
+
var coerce = (version, options) => {
|
|
1806
|
+
if (version instanceof SemVer) {
|
|
1807
|
+
return version;
|
|
1808
|
+
}
|
|
1809
|
+
if (typeof version === "number") {
|
|
1810
|
+
version = String(version);
|
|
1811
|
+
}
|
|
1812
|
+
if (typeof version !== "string") {
|
|
1813
|
+
return null;
|
|
1814
|
+
}
|
|
1815
|
+
options = options || {};
|
|
1816
|
+
let match = null;
|
|
1817
|
+
if (!options.rtl) {
|
|
1818
|
+
match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]);
|
|
1819
|
+
} else {
|
|
1820
|
+
const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL];
|
|
1821
|
+
let next;
|
|
1822
|
+
while ((next = coerceRtlRegex.exec(version)) && (!match || match.index + match[0].length !== version.length)) {
|
|
1823
|
+
if (!match || next.index + next[0].length !== match.index + match[0].length) {
|
|
1824
|
+
match = next;
|
|
1825
|
+
}
|
|
1826
|
+
coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length;
|
|
1827
|
+
}
|
|
1828
|
+
coerceRtlRegex.lastIndex = -1;
|
|
1829
|
+
}
|
|
1830
|
+
if (match === null) {
|
|
1831
|
+
return null;
|
|
1832
|
+
}
|
|
1833
|
+
const major = match[2];
|
|
1834
|
+
const minor = match[3] || "0";
|
|
1835
|
+
const patch = match[4] || "0";
|
|
1836
|
+
const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : "";
|
|
1837
|
+
const build = options.includePrerelease && match[6] ? `+${match[6]}` : "";
|
|
1838
|
+
return parse(`${major}.${minor}.${patch}${prerelease}${build}`, options);
|
|
1839
|
+
};
|
|
1840
|
+
module.exports = coerce;
|
|
1841
|
+
});
|
|
1842
|
+
|
|
1843
|
+
// ../../node_modules/.bun/semver@7.7.4/node_modules/semver/internal/lrucache.js
|
|
1844
|
+
var require_lrucache = __commonJS((exports, module) => {
|
|
1845
|
+
class LRUCache {
|
|
1846
|
+
constructor() {
|
|
1847
|
+
this.max = 1000;
|
|
1848
|
+
this.map = new Map;
|
|
1849
|
+
}
|
|
1850
|
+
get(key) {
|
|
1851
|
+
const value = this.map.get(key);
|
|
1852
|
+
if (value === undefined) {
|
|
1853
|
+
return;
|
|
1854
|
+
} else {
|
|
1855
|
+
this.map.delete(key);
|
|
1856
|
+
this.map.set(key, value);
|
|
1857
|
+
return value;
|
|
1858
|
+
}
|
|
1859
|
+
}
|
|
1860
|
+
delete(key) {
|
|
1861
|
+
return this.map.delete(key);
|
|
1862
|
+
}
|
|
1863
|
+
set(key, value) {
|
|
1864
|
+
const deleted = this.delete(key);
|
|
1865
|
+
if (!deleted && value !== undefined) {
|
|
1866
|
+
if (this.map.size >= this.max) {
|
|
1867
|
+
const firstKey = this.map.keys().next().value;
|
|
1868
|
+
this.delete(firstKey);
|
|
1869
|
+
}
|
|
1870
|
+
this.map.set(key, value);
|
|
1871
|
+
}
|
|
1872
|
+
return this;
|
|
1873
|
+
}
|
|
1874
|
+
}
|
|
1875
|
+
module.exports = LRUCache;
|
|
1876
|
+
});
|
|
1877
|
+
|
|
1878
|
+
// ../../node_modules/.bun/semver@7.7.4/node_modules/semver/classes/range.js
|
|
1879
|
+
var require_range = __commonJS((exports, module) => {
|
|
1880
|
+
var SPACE_CHARACTERS = /\s+/g;
|
|
1881
|
+
|
|
1882
|
+
class Range {
|
|
1883
|
+
constructor(range, options) {
|
|
1884
|
+
options = parseOptions(options);
|
|
1885
|
+
if (range instanceof Range) {
|
|
1886
|
+
if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) {
|
|
1887
|
+
return range;
|
|
1888
|
+
} else {
|
|
1889
|
+
return new Range(range.raw, options);
|
|
1890
|
+
}
|
|
1891
|
+
}
|
|
1892
|
+
if (range instanceof Comparator) {
|
|
1893
|
+
this.raw = range.value;
|
|
1894
|
+
this.set = [[range]];
|
|
1895
|
+
this.formatted = undefined;
|
|
1896
|
+
return this;
|
|
1897
|
+
}
|
|
1898
|
+
this.options = options;
|
|
1899
|
+
this.loose = !!options.loose;
|
|
1900
|
+
this.includePrerelease = !!options.includePrerelease;
|
|
1901
|
+
this.raw = range.trim().replace(SPACE_CHARACTERS, " ");
|
|
1902
|
+
this.set = this.raw.split("||").map((r) => this.parseRange(r.trim())).filter((c) => c.length);
|
|
1903
|
+
if (!this.set.length) {
|
|
1904
|
+
throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
|
|
1905
|
+
}
|
|
1906
|
+
if (this.set.length > 1) {
|
|
1907
|
+
const first = this.set[0];
|
|
1908
|
+
this.set = this.set.filter((c) => !isNullSet(c[0]));
|
|
1909
|
+
if (this.set.length === 0) {
|
|
1910
|
+
this.set = [first];
|
|
1911
|
+
} else if (this.set.length > 1) {
|
|
1912
|
+
for (const c of this.set) {
|
|
1913
|
+
if (c.length === 1 && isAny(c[0])) {
|
|
1914
|
+
this.set = [c];
|
|
1915
|
+
break;
|
|
1916
|
+
}
|
|
1917
|
+
}
|
|
1918
|
+
}
|
|
1919
|
+
}
|
|
1920
|
+
this.formatted = undefined;
|
|
1921
|
+
}
|
|
1922
|
+
get range() {
|
|
1923
|
+
if (this.formatted === undefined) {
|
|
1924
|
+
this.formatted = "";
|
|
1925
|
+
for (let i = 0;i < this.set.length; i++) {
|
|
1926
|
+
if (i > 0) {
|
|
1927
|
+
this.formatted += "||";
|
|
1928
|
+
}
|
|
1929
|
+
const comps = this.set[i];
|
|
1930
|
+
for (let k = 0;k < comps.length; k++) {
|
|
1931
|
+
if (k > 0) {
|
|
1932
|
+
this.formatted += " ";
|
|
1933
|
+
}
|
|
1934
|
+
this.formatted += comps[k].toString().trim();
|
|
1935
|
+
}
|
|
1936
|
+
}
|
|
1937
|
+
}
|
|
1938
|
+
return this.formatted;
|
|
1939
|
+
}
|
|
1940
|
+
format() {
|
|
1941
|
+
return this.range;
|
|
1942
|
+
}
|
|
1943
|
+
toString() {
|
|
1944
|
+
return this.range;
|
|
1945
|
+
}
|
|
1946
|
+
parseRange(range) {
|
|
1947
|
+
const memoOpts = (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE);
|
|
1948
|
+
const memoKey = memoOpts + ":" + range;
|
|
1949
|
+
const cached = cache.get(memoKey);
|
|
1950
|
+
if (cached) {
|
|
1951
|
+
return cached;
|
|
1952
|
+
}
|
|
1953
|
+
const loose = this.options.loose;
|
|
1954
|
+
const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
|
|
1955
|
+
range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
|
|
1956
|
+
debug("hyphen replace", range);
|
|
1957
|
+
range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
|
|
1958
|
+
debug("comparator trim", range);
|
|
1959
|
+
range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
|
|
1960
|
+
debug("tilde trim", range);
|
|
1961
|
+
range = range.replace(re[t.CARETTRIM], caretTrimReplace);
|
|
1962
|
+
debug("caret trim", range);
|
|
1963
|
+
let rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
|
|
1964
|
+
if (loose) {
|
|
1965
|
+
rangeList = rangeList.filter((comp) => {
|
|
1966
|
+
debug("loose invalid filter", comp, this.options);
|
|
1967
|
+
return !!comp.match(re[t.COMPARATORLOOSE]);
|
|
1968
|
+
});
|
|
1969
|
+
}
|
|
1970
|
+
debug("range list", rangeList);
|
|
1971
|
+
const rangeMap = new Map;
|
|
1972
|
+
const comparators = rangeList.map((comp) => new Comparator(comp, this.options));
|
|
1973
|
+
for (const comp of comparators) {
|
|
1974
|
+
if (isNullSet(comp)) {
|
|
1975
|
+
return [comp];
|
|
1976
|
+
}
|
|
1977
|
+
rangeMap.set(comp.value, comp);
|
|
1978
|
+
}
|
|
1979
|
+
if (rangeMap.size > 1 && rangeMap.has("")) {
|
|
1980
|
+
rangeMap.delete("");
|
|
1981
|
+
}
|
|
1982
|
+
const result = [...rangeMap.values()];
|
|
1983
|
+
cache.set(memoKey, result);
|
|
1984
|
+
return result;
|
|
1985
|
+
}
|
|
1986
|
+
intersects(range, options) {
|
|
1987
|
+
if (!(range instanceof Range)) {
|
|
1988
|
+
throw new TypeError("a Range is required");
|
|
1989
|
+
}
|
|
1990
|
+
return this.set.some((thisComparators) => {
|
|
1991
|
+
return isSatisfiable(thisComparators, options) && range.set.some((rangeComparators) => {
|
|
1992
|
+
return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => {
|
|
1993
|
+
return rangeComparators.every((rangeComparator) => {
|
|
1994
|
+
return thisComparator.intersects(rangeComparator, options);
|
|
1995
|
+
});
|
|
1996
|
+
});
|
|
1997
|
+
});
|
|
1998
|
+
});
|
|
1999
|
+
}
|
|
2000
|
+
test(version) {
|
|
2001
|
+
if (!version) {
|
|
2002
|
+
return false;
|
|
2003
|
+
}
|
|
2004
|
+
if (typeof version === "string") {
|
|
2005
|
+
try {
|
|
2006
|
+
version = new SemVer(version, this.options);
|
|
2007
|
+
} catch (er) {
|
|
2008
|
+
return false;
|
|
2009
|
+
}
|
|
2010
|
+
}
|
|
2011
|
+
for (let i = 0;i < this.set.length; i++) {
|
|
2012
|
+
if (testSet(this.set[i], version, this.options)) {
|
|
2013
|
+
return true;
|
|
2014
|
+
}
|
|
2015
|
+
}
|
|
2016
|
+
return false;
|
|
2017
|
+
}
|
|
2018
|
+
}
|
|
2019
|
+
module.exports = Range;
|
|
2020
|
+
var LRU = require_lrucache();
|
|
2021
|
+
var cache = new LRU;
|
|
2022
|
+
var parseOptions = require_parse_options();
|
|
2023
|
+
var Comparator = require_comparator();
|
|
2024
|
+
var debug = require_debug();
|
|
2025
|
+
var SemVer = require_semver();
|
|
2026
|
+
var {
|
|
2027
|
+
safeRe: re,
|
|
2028
|
+
t,
|
|
2029
|
+
comparatorTrimReplace,
|
|
2030
|
+
tildeTrimReplace,
|
|
2031
|
+
caretTrimReplace
|
|
2032
|
+
} = require_re();
|
|
2033
|
+
var { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants();
|
|
2034
|
+
var isNullSet = (c) => c.value === "<0.0.0-0";
|
|
2035
|
+
var isAny = (c) => c.value === "";
|
|
2036
|
+
var isSatisfiable = (comparators, options) => {
|
|
2037
|
+
let result = true;
|
|
2038
|
+
const remainingComparators = comparators.slice();
|
|
2039
|
+
let testComparator = remainingComparators.pop();
|
|
2040
|
+
while (result && remainingComparators.length) {
|
|
2041
|
+
result = remainingComparators.every((otherComparator) => {
|
|
2042
|
+
return testComparator.intersects(otherComparator, options);
|
|
2043
|
+
});
|
|
2044
|
+
testComparator = remainingComparators.pop();
|
|
2045
|
+
}
|
|
2046
|
+
return result;
|
|
2047
|
+
};
|
|
2048
|
+
var parseComparator = (comp, options) => {
|
|
2049
|
+
comp = comp.replace(re[t.BUILD], "");
|
|
2050
|
+
debug("comp", comp, options);
|
|
2051
|
+
comp = replaceCarets(comp, options);
|
|
2052
|
+
debug("caret", comp);
|
|
2053
|
+
comp = replaceTildes(comp, options);
|
|
2054
|
+
debug("tildes", comp);
|
|
2055
|
+
comp = replaceXRanges(comp, options);
|
|
2056
|
+
debug("xrange", comp);
|
|
2057
|
+
comp = replaceStars(comp, options);
|
|
2058
|
+
debug("stars", comp);
|
|
2059
|
+
return comp;
|
|
2060
|
+
};
|
|
2061
|
+
var isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
|
|
2062
|
+
var replaceTildes = (comp, options) => {
|
|
2063
|
+
return comp.trim().split(/\s+/).map((c) => replaceTilde(c, options)).join(" ");
|
|
2064
|
+
};
|
|
2065
|
+
var replaceTilde = (comp, options) => {
|
|
2066
|
+
const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
|
|
2067
|
+
return comp.replace(r, (_, M, m, p, pr) => {
|
|
2068
|
+
debug("tilde", comp, _, M, m, p, pr);
|
|
2069
|
+
let ret;
|
|
2070
|
+
if (isX(M)) {
|
|
2071
|
+
ret = "";
|
|
2072
|
+
} else if (isX(m)) {
|
|
2073
|
+
ret = `>=${M}.0.0 <${+M + 1}.0.0-0`;
|
|
2074
|
+
} else if (isX(p)) {
|
|
2075
|
+
ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;
|
|
2076
|
+
} else if (pr) {
|
|
2077
|
+
debug("replaceTilde pr", pr);
|
|
2078
|
+
ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
|
|
2079
|
+
} else {
|
|
2080
|
+
ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
|
|
2081
|
+
}
|
|
2082
|
+
debug("tilde return", ret);
|
|
2083
|
+
return ret;
|
|
2084
|
+
});
|
|
2085
|
+
};
|
|
2086
|
+
var replaceCarets = (comp, options) => {
|
|
2087
|
+
return comp.trim().split(/\s+/).map((c) => replaceCaret(c, options)).join(" ");
|
|
2088
|
+
};
|
|
2089
|
+
var replaceCaret = (comp, options) => {
|
|
2090
|
+
debug("caret", comp, options);
|
|
2091
|
+
const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
|
|
2092
|
+
const z = options.includePrerelease ? "-0" : "";
|
|
2093
|
+
return comp.replace(r, (_, M, m, p, pr) => {
|
|
2094
|
+
debug("caret", comp, _, M, m, p, pr);
|
|
2095
|
+
let ret;
|
|
2096
|
+
if (isX(M)) {
|
|
2097
|
+
ret = "";
|
|
2098
|
+
} else if (isX(m)) {
|
|
2099
|
+
ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
|
|
2100
|
+
} else if (isX(p)) {
|
|
2101
|
+
if (M === "0") {
|
|
2102
|
+
ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
|
|
2103
|
+
} else {
|
|
2104
|
+
ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
|
|
2105
|
+
}
|
|
2106
|
+
} else if (pr) {
|
|
2107
|
+
debug("replaceCaret pr", pr);
|
|
2108
|
+
if (M === "0") {
|
|
2109
|
+
if (m === "0") {
|
|
2110
|
+
ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`;
|
|
2111
|
+
} else {
|
|
2112
|
+
ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
|
|
2113
|
+
}
|
|
2114
|
+
} else {
|
|
2115
|
+
ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`;
|
|
2116
|
+
}
|
|
2117
|
+
} else {
|
|
2118
|
+
debug("no pr");
|
|
2119
|
+
if (M === "0") {
|
|
2120
|
+
if (m === "0") {
|
|
2121
|
+
ret = `>=${M}.${m}.${p}${z} <${M}.${m}.${+p + 1}-0`;
|
|
2122
|
+
} else {
|
|
2123
|
+
ret = `>=${M}.${m}.${p}${z} <${M}.${+m + 1}.0-0`;
|
|
2124
|
+
}
|
|
2125
|
+
} else {
|
|
2126
|
+
ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
|
|
2127
|
+
}
|
|
2128
|
+
}
|
|
2129
|
+
debug("caret return", ret);
|
|
2130
|
+
return ret;
|
|
2131
|
+
});
|
|
2132
|
+
};
|
|
2133
|
+
var replaceXRanges = (comp, options) => {
|
|
2134
|
+
debug("replaceXRanges", comp, options);
|
|
2135
|
+
return comp.split(/\s+/).map((c) => replaceXRange(c, options)).join(" ");
|
|
2136
|
+
};
|
|
2137
|
+
var replaceXRange = (comp, options) => {
|
|
2138
|
+
comp = comp.trim();
|
|
2139
|
+
const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
|
|
2140
|
+
return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
|
|
2141
|
+
debug("xRange", comp, ret, gtlt, M, m, p, pr);
|
|
2142
|
+
const xM = isX(M);
|
|
2143
|
+
const xm = xM || isX(m);
|
|
2144
|
+
const xp = xm || isX(p);
|
|
2145
|
+
const anyX = xp;
|
|
2146
|
+
if (gtlt === "=" && anyX) {
|
|
2147
|
+
gtlt = "";
|
|
2148
|
+
}
|
|
2149
|
+
pr = options.includePrerelease ? "-0" : "";
|
|
2150
|
+
if (xM) {
|
|
2151
|
+
if (gtlt === ">" || gtlt === "<") {
|
|
2152
|
+
ret = "<0.0.0-0";
|
|
2153
|
+
} else {
|
|
2154
|
+
ret = "*";
|
|
2155
|
+
}
|
|
2156
|
+
} else if (gtlt && anyX) {
|
|
2157
|
+
if (xm) {
|
|
2158
|
+
m = 0;
|
|
2159
|
+
}
|
|
2160
|
+
p = 0;
|
|
2161
|
+
if (gtlt === ">") {
|
|
2162
|
+
gtlt = ">=";
|
|
2163
|
+
if (xm) {
|
|
2164
|
+
M = +M + 1;
|
|
2165
|
+
m = 0;
|
|
2166
|
+
p = 0;
|
|
2167
|
+
} else {
|
|
2168
|
+
m = +m + 1;
|
|
2169
|
+
p = 0;
|
|
2170
|
+
}
|
|
2171
|
+
} else if (gtlt === "<=") {
|
|
2172
|
+
gtlt = "<";
|
|
2173
|
+
if (xm) {
|
|
2174
|
+
M = +M + 1;
|
|
2175
|
+
} else {
|
|
2176
|
+
m = +m + 1;
|
|
2177
|
+
}
|
|
2178
|
+
}
|
|
2179
|
+
if (gtlt === "<") {
|
|
2180
|
+
pr = "-0";
|
|
2181
|
+
}
|
|
2182
|
+
ret = `${gtlt + M}.${m}.${p}${pr}`;
|
|
2183
|
+
} else if (xm) {
|
|
2184
|
+
ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
|
|
2185
|
+
} else if (xp) {
|
|
2186
|
+
ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`;
|
|
2187
|
+
}
|
|
2188
|
+
debug("xRange return", ret);
|
|
2189
|
+
return ret;
|
|
2190
|
+
});
|
|
2191
|
+
};
|
|
2192
|
+
var replaceStars = (comp, options) => {
|
|
2193
|
+
debug("replaceStars", comp, options);
|
|
2194
|
+
return comp.trim().replace(re[t.STAR], "");
|
|
2195
|
+
};
|
|
2196
|
+
var replaceGTE0 = (comp, options) => {
|
|
2197
|
+
debug("replaceGTE0", comp, options);
|
|
2198
|
+
return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], "");
|
|
2199
|
+
};
|
|
2200
|
+
var hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => {
|
|
2201
|
+
if (isX(fM)) {
|
|
2202
|
+
from = "";
|
|
2203
|
+
} else if (isX(fm)) {
|
|
2204
|
+
from = `>=${fM}.0.0${incPr ? "-0" : ""}`;
|
|
2205
|
+
} else if (isX(fp)) {
|
|
2206
|
+
from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`;
|
|
2207
|
+
} else if (fpr) {
|
|
2208
|
+
from = `>=${from}`;
|
|
2209
|
+
} else {
|
|
2210
|
+
from = `>=${from}${incPr ? "-0" : ""}`;
|
|
2211
|
+
}
|
|
2212
|
+
if (isX(tM)) {
|
|
2213
|
+
to = "";
|
|
2214
|
+
} else if (isX(tm)) {
|
|
2215
|
+
to = `<${+tM + 1}.0.0-0`;
|
|
2216
|
+
} else if (isX(tp)) {
|
|
2217
|
+
to = `<${tM}.${+tm + 1}.0-0`;
|
|
2218
|
+
} else if (tpr) {
|
|
2219
|
+
to = `<=${tM}.${tm}.${tp}-${tpr}`;
|
|
2220
|
+
} else if (incPr) {
|
|
2221
|
+
to = `<${tM}.${tm}.${+tp + 1}-0`;
|
|
2222
|
+
} else {
|
|
2223
|
+
to = `<=${to}`;
|
|
2224
|
+
}
|
|
2225
|
+
return `${from} ${to}`.trim();
|
|
2226
|
+
};
|
|
2227
|
+
var testSet = (set, version, options) => {
|
|
2228
|
+
for (let i = 0;i < set.length; i++) {
|
|
2229
|
+
if (!set[i].test(version)) {
|
|
2230
|
+
return false;
|
|
2231
|
+
}
|
|
2232
|
+
}
|
|
2233
|
+
if (version.prerelease.length && !options.includePrerelease) {
|
|
2234
|
+
for (let i = 0;i < set.length; i++) {
|
|
2235
|
+
debug(set[i].semver);
|
|
2236
|
+
if (set[i].semver === Comparator.ANY) {
|
|
2237
|
+
continue;
|
|
2238
|
+
}
|
|
2239
|
+
if (set[i].semver.prerelease.length > 0) {
|
|
2240
|
+
const allowed = set[i].semver;
|
|
2241
|
+
if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) {
|
|
2242
|
+
return true;
|
|
2243
|
+
}
|
|
2244
|
+
}
|
|
2245
|
+
}
|
|
2246
|
+
return false;
|
|
2247
|
+
}
|
|
2248
|
+
return true;
|
|
2249
|
+
};
|
|
2250
|
+
});
|
|
2251
|
+
|
|
2252
|
+
// ../../node_modules/.bun/semver@7.7.4/node_modules/semver/classes/comparator.js
|
|
2253
|
+
var require_comparator = __commonJS((exports, module) => {
|
|
2254
|
+
var ANY = Symbol("SemVer ANY");
|
|
2255
|
+
|
|
2256
|
+
class Comparator {
|
|
2257
|
+
static get ANY() {
|
|
2258
|
+
return ANY;
|
|
2259
|
+
}
|
|
2260
|
+
constructor(comp, options) {
|
|
2261
|
+
options = parseOptions(options);
|
|
2262
|
+
if (comp instanceof Comparator) {
|
|
2263
|
+
if (comp.loose === !!options.loose) {
|
|
2264
|
+
return comp;
|
|
2265
|
+
} else {
|
|
2266
|
+
comp = comp.value;
|
|
2267
|
+
}
|
|
2268
|
+
}
|
|
2269
|
+
comp = comp.trim().split(/\s+/).join(" ");
|
|
2270
|
+
debug("comparator", comp, options);
|
|
2271
|
+
this.options = options;
|
|
2272
|
+
this.loose = !!options.loose;
|
|
2273
|
+
this.parse(comp);
|
|
2274
|
+
if (this.semver === ANY) {
|
|
2275
|
+
this.value = "";
|
|
2276
|
+
} else {
|
|
2277
|
+
this.value = this.operator + this.semver.version;
|
|
2278
|
+
}
|
|
2279
|
+
debug("comp", this);
|
|
2280
|
+
}
|
|
2281
|
+
parse(comp) {
|
|
2282
|
+
const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
|
|
2283
|
+
const m = comp.match(r);
|
|
2284
|
+
if (!m) {
|
|
2285
|
+
throw new TypeError(`Invalid comparator: ${comp}`);
|
|
2286
|
+
}
|
|
2287
|
+
this.operator = m[1] !== undefined ? m[1] : "";
|
|
2288
|
+
if (this.operator === "=") {
|
|
2289
|
+
this.operator = "";
|
|
2290
|
+
}
|
|
2291
|
+
if (!m[2]) {
|
|
2292
|
+
this.semver = ANY;
|
|
2293
|
+
} else {
|
|
2294
|
+
this.semver = new SemVer(m[2], this.options.loose);
|
|
2295
|
+
}
|
|
2296
|
+
}
|
|
2297
|
+
toString() {
|
|
2298
|
+
return this.value;
|
|
2299
|
+
}
|
|
2300
|
+
test(version) {
|
|
2301
|
+
debug("Comparator.test", version, this.options.loose);
|
|
2302
|
+
if (this.semver === ANY || version === ANY) {
|
|
2303
|
+
return true;
|
|
2304
|
+
}
|
|
2305
|
+
if (typeof version === "string") {
|
|
2306
|
+
try {
|
|
2307
|
+
version = new SemVer(version, this.options);
|
|
2308
|
+
} catch (er) {
|
|
2309
|
+
return false;
|
|
2310
|
+
}
|
|
2311
|
+
}
|
|
2312
|
+
return cmp(version, this.operator, this.semver, this.options);
|
|
2313
|
+
}
|
|
2314
|
+
intersects(comp, options) {
|
|
2315
|
+
if (!(comp instanceof Comparator)) {
|
|
2316
|
+
throw new TypeError("a Comparator is required");
|
|
2317
|
+
}
|
|
2318
|
+
if (this.operator === "") {
|
|
2319
|
+
if (this.value === "") {
|
|
2320
|
+
return true;
|
|
2321
|
+
}
|
|
2322
|
+
return new Range(comp.value, options).test(this.value);
|
|
2323
|
+
} else if (comp.operator === "") {
|
|
2324
|
+
if (comp.value === "") {
|
|
2325
|
+
return true;
|
|
2326
|
+
}
|
|
2327
|
+
return new Range(this.value, options).test(comp.semver);
|
|
2328
|
+
}
|
|
2329
|
+
options = parseOptions(options);
|
|
2330
|
+
if (options.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0")) {
|
|
2331
|
+
return false;
|
|
2332
|
+
}
|
|
2333
|
+
if (!options.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) {
|
|
2334
|
+
return false;
|
|
2335
|
+
}
|
|
2336
|
+
if (this.operator.startsWith(">") && comp.operator.startsWith(">")) {
|
|
2337
|
+
return true;
|
|
2338
|
+
}
|
|
2339
|
+
if (this.operator.startsWith("<") && comp.operator.startsWith("<")) {
|
|
2340
|
+
return true;
|
|
2341
|
+
}
|
|
2342
|
+
if (this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=")) {
|
|
2343
|
+
return true;
|
|
2344
|
+
}
|
|
2345
|
+
if (cmp(this.semver, "<", comp.semver, options) && this.operator.startsWith(">") && comp.operator.startsWith("<")) {
|
|
2346
|
+
return true;
|
|
2347
|
+
}
|
|
2348
|
+
if (cmp(this.semver, ">", comp.semver, options) && this.operator.startsWith("<") && comp.operator.startsWith(">")) {
|
|
2349
|
+
return true;
|
|
2350
|
+
}
|
|
2351
|
+
return false;
|
|
2352
|
+
}
|
|
2353
|
+
}
|
|
2354
|
+
module.exports = Comparator;
|
|
2355
|
+
var parseOptions = require_parse_options();
|
|
2356
|
+
var { safeRe: re, t } = require_re();
|
|
2357
|
+
var cmp = require_cmp();
|
|
2358
|
+
var debug = require_debug();
|
|
2359
|
+
var SemVer = require_semver();
|
|
2360
|
+
var Range = require_range();
|
|
2361
|
+
});
|
|
2362
|
+
|
|
2363
|
+
// ../../node_modules/.bun/semver@7.7.4/node_modules/semver/functions/satisfies.js
|
|
2364
|
+
var require_satisfies = __commonJS((exports, module) => {
|
|
2365
|
+
var Range = require_range();
|
|
2366
|
+
var satisfies = (version, range, options) => {
|
|
2367
|
+
try {
|
|
2368
|
+
range = new Range(range, options);
|
|
2369
|
+
} catch (er) {
|
|
2370
|
+
return false;
|
|
2371
|
+
}
|
|
2372
|
+
return range.test(version);
|
|
2373
|
+
};
|
|
2374
|
+
module.exports = satisfies;
|
|
2375
|
+
});
|
|
2376
|
+
|
|
2377
|
+
// ../../node_modules/.bun/semver@7.7.4/node_modules/semver/ranges/to-comparators.js
|
|
2378
|
+
var require_to_comparators = __commonJS((exports, module) => {
|
|
2379
|
+
var Range = require_range();
|
|
2380
|
+
var toComparators = (range, options) => new Range(range, options).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" "));
|
|
2381
|
+
module.exports = toComparators;
|
|
2382
|
+
});
|
|
2383
|
+
|
|
2384
|
+
// ../../node_modules/.bun/semver@7.7.4/node_modules/semver/ranges/max-satisfying.js
|
|
2385
|
+
var require_max_satisfying = __commonJS((exports, module) => {
|
|
2386
|
+
var SemVer = require_semver();
|
|
2387
|
+
var Range = require_range();
|
|
2388
|
+
var maxSatisfying = (versions, range, options) => {
|
|
2389
|
+
let max = null;
|
|
2390
|
+
let maxSV = null;
|
|
2391
|
+
let rangeObj = null;
|
|
2392
|
+
try {
|
|
2393
|
+
rangeObj = new Range(range, options);
|
|
2394
|
+
} catch (er) {
|
|
2395
|
+
return null;
|
|
2396
|
+
}
|
|
2397
|
+
versions.forEach((v) => {
|
|
2398
|
+
if (rangeObj.test(v)) {
|
|
2399
|
+
if (!max || maxSV.compare(v) === -1) {
|
|
2400
|
+
max = v;
|
|
2401
|
+
maxSV = new SemVer(max, options);
|
|
2402
|
+
}
|
|
2403
|
+
}
|
|
2404
|
+
});
|
|
2405
|
+
return max;
|
|
2406
|
+
};
|
|
2407
|
+
module.exports = maxSatisfying;
|
|
2408
|
+
});
|
|
2409
|
+
|
|
2410
|
+
// ../../node_modules/.bun/semver@7.7.4/node_modules/semver/ranges/min-satisfying.js
|
|
2411
|
+
var require_min_satisfying = __commonJS((exports, module) => {
|
|
2412
|
+
var SemVer = require_semver();
|
|
2413
|
+
var Range = require_range();
|
|
2414
|
+
var minSatisfying = (versions, range, options) => {
|
|
2415
|
+
let min = null;
|
|
2416
|
+
let minSV = null;
|
|
2417
|
+
let rangeObj = null;
|
|
2418
|
+
try {
|
|
2419
|
+
rangeObj = new Range(range, options);
|
|
2420
|
+
} catch (er) {
|
|
2421
|
+
return null;
|
|
2422
|
+
}
|
|
2423
|
+
versions.forEach((v) => {
|
|
2424
|
+
if (rangeObj.test(v)) {
|
|
2425
|
+
if (!min || minSV.compare(v) === 1) {
|
|
2426
|
+
min = v;
|
|
2427
|
+
minSV = new SemVer(min, options);
|
|
2428
|
+
}
|
|
2429
|
+
}
|
|
2430
|
+
});
|
|
2431
|
+
return min;
|
|
2432
|
+
};
|
|
2433
|
+
module.exports = minSatisfying;
|
|
2434
|
+
});
|
|
2435
|
+
|
|
2436
|
+
// ../../node_modules/.bun/semver@7.7.4/node_modules/semver/ranges/min-version.js
|
|
2437
|
+
var require_min_version = __commonJS((exports, module) => {
|
|
2438
|
+
var SemVer = require_semver();
|
|
2439
|
+
var Range = require_range();
|
|
2440
|
+
var gt = require_gt();
|
|
2441
|
+
var minVersion = (range, loose) => {
|
|
2442
|
+
range = new Range(range, loose);
|
|
2443
|
+
let minver = new SemVer("0.0.0");
|
|
2444
|
+
if (range.test(minver)) {
|
|
2445
|
+
return minver;
|
|
2446
|
+
}
|
|
2447
|
+
minver = new SemVer("0.0.0-0");
|
|
2448
|
+
if (range.test(minver)) {
|
|
2449
|
+
return minver;
|
|
2450
|
+
}
|
|
2451
|
+
minver = null;
|
|
2452
|
+
for (let i = 0;i < range.set.length; ++i) {
|
|
2453
|
+
const comparators = range.set[i];
|
|
2454
|
+
let setMin = null;
|
|
2455
|
+
comparators.forEach((comparator) => {
|
|
2456
|
+
const compver = new SemVer(comparator.semver.version);
|
|
2457
|
+
switch (comparator.operator) {
|
|
2458
|
+
case ">":
|
|
2459
|
+
if (compver.prerelease.length === 0) {
|
|
2460
|
+
compver.patch++;
|
|
2461
|
+
} else {
|
|
2462
|
+
compver.prerelease.push(0);
|
|
2463
|
+
}
|
|
2464
|
+
compver.raw = compver.format();
|
|
2465
|
+
case "":
|
|
2466
|
+
case ">=":
|
|
2467
|
+
if (!setMin || gt(compver, setMin)) {
|
|
2468
|
+
setMin = compver;
|
|
2469
|
+
}
|
|
2470
|
+
break;
|
|
2471
|
+
case "<":
|
|
2472
|
+
case "<=":
|
|
2473
|
+
break;
|
|
2474
|
+
default:
|
|
2475
|
+
throw new Error(`Unexpected operation: ${comparator.operator}`);
|
|
2476
|
+
}
|
|
2477
|
+
});
|
|
2478
|
+
if (setMin && (!minver || gt(minver, setMin))) {
|
|
2479
|
+
minver = setMin;
|
|
2480
|
+
}
|
|
2481
|
+
}
|
|
2482
|
+
if (minver && range.test(minver)) {
|
|
2483
|
+
return minver;
|
|
2484
|
+
}
|
|
2485
|
+
return null;
|
|
2486
|
+
};
|
|
2487
|
+
module.exports = minVersion;
|
|
2488
|
+
});
|
|
2489
|
+
|
|
2490
|
+
// ../../node_modules/.bun/semver@7.7.4/node_modules/semver/ranges/valid.js
|
|
2491
|
+
var require_valid2 = __commonJS((exports, module) => {
|
|
2492
|
+
var Range = require_range();
|
|
2493
|
+
var validRange = (range, options) => {
|
|
2494
|
+
try {
|
|
2495
|
+
return new Range(range, options).range || "*";
|
|
2496
|
+
} catch (er) {
|
|
2497
|
+
return null;
|
|
2498
|
+
}
|
|
2499
|
+
};
|
|
2500
|
+
module.exports = validRange;
|
|
2501
|
+
});
|
|
2502
|
+
|
|
2503
|
+
// ../../node_modules/.bun/semver@7.7.4/node_modules/semver/ranges/outside.js
|
|
2504
|
+
var require_outside = __commonJS((exports, module) => {
|
|
2505
|
+
var SemVer = require_semver();
|
|
2506
|
+
var Comparator = require_comparator();
|
|
2507
|
+
var { ANY } = Comparator;
|
|
2508
|
+
var Range = require_range();
|
|
2509
|
+
var satisfies = require_satisfies();
|
|
2510
|
+
var gt = require_gt();
|
|
2511
|
+
var lt = require_lt();
|
|
2512
|
+
var lte = require_lte();
|
|
2513
|
+
var gte = require_gte();
|
|
2514
|
+
var outside = (version, range, hilo, options) => {
|
|
2515
|
+
version = new SemVer(version, options);
|
|
2516
|
+
range = new Range(range, options);
|
|
2517
|
+
let gtfn, ltefn, ltfn, comp, ecomp;
|
|
2518
|
+
switch (hilo) {
|
|
2519
|
+
case ">":
|
|
2520
|
+
gtfn = gt;
|
|
2521
|
+
ltefn = lte;
|
|
2522
|
+
ltfn = lt;
|
|
2523
|
+
comp = ">";
|
|
2524
|
+
ecomp = ">=";
|
|
2525
|
+
break;
|
|
2526
|
+
case "<":
|
|
2527
|
+
gtfn = lt;
|
|
2528
|
+
ltefn = gte;
|
|
2529
|
+
ltfn = gt;
|
|
2530
|
+
comp = "<";
|
|
2531
|
+
ecomp = "<=";
|
|
2532
|
+
break;
|
|
2533
|
+
default:
|
|
2534
|
+
throw new TypeError('Must provide a hilo val of "<" or ">"');
|
|
2535
|
+
}
|
|
2536
|
+
if (satisfies(version, range, options)) {
|
|
2537
|
+
return false;
|
|
2538
|
+
}
|
|
2539
|
+
for (let i = 0;i < range.set.length; ++i) {
|
|
2540
|
+
const comparators = range.set[i];
|
|
2541
|
+
let high = null;
|
|
2542
|
+
let low = null;
|
|
2543
|
+
comparators.forEach((comparator) => {
|
|
2544
|
+
if (comparator.semver === ANY) {
|
|
2545
|
+
comparator = new Comparator(">=0.0.0");
|
|
2546
|
+
}
|
|
2547
|
+
high = high || comparator;
|
|
2548
|
+
low = low || comparator;
|
|
2549
|
+
if (gtfn(comparator.semver, high.semver, options)) {
|
|
2550
|
+
high = comparator;
|
|
2551
|
+
} else if (ltfn(comparator.semver, low.semver, options)) {
|
|
2552
|
+
low = comparator;
|
|
2553
|
+
}
|
|
2554
|
+
});
|
|
2555
|
+
if (high.operator === comp || high.operator === ecomp) {
|
|
2556
|
+
return false;
|
|
2557
|
+
}
|
|
2558
|
+
if ((!low.operator || low.operator === comp) && ltefn(version, low.semver)) {
|
|
2559
|
+
return false;
|
|
2560
|
+
} else if (low.operator === ecomp && ltfn(version, low.semver)) {
|
|
2561
|
+
return false;
|
|
2562
|
+
}
|
|
2563
|
+
}
|
|
2564
|
+
return true;
|
|
2565
|
+
};
|
|
2566
|
+
module.exports = outside;
|
|
2567
|
+
});
|
|
2568
|
+
|
|
2569
|
+
// ../../node_modules/.bun/semver@7.7.4/node_modules/semver/ranges/gtr.js
|
|
2570
|
+
var require_gtr = __commonJS((exports, module) => {
|
|
2571
|
+
var outside = require_outside();
|
|
2572
|
+
var gtr = (version, range, options) => outside(version, range, ">", options);
|
|
2573
|
+
module.exports = gtr;
|
|
2574
|
+
});
|
|
2575
|
+
|
|
2576
|
+
// ../../node_modules/.bun/semver@7.7.4/node_modules/semver/ranges/ltr.js
|
|
2577
|
+
var require_ltr = __commonJS((exports, module) => {
|
|
2578
|
+
var outside = require_outside();
|
|
2579
|
+
var ltr = (version, range, options) => outside(version, range, "<", options);
|
|
2580
|
+
module.exports = ltr;
|
|
2581
|
+
});
|
|
2582
|
+
|
|
2583
|
+
// ../../node_modules/.bun/semver@7.7.4/node_modules/semver/ranges/intersects.js
|
|
2584
|
+
var require_intersects = __commonJS((exports, module) => {
|
|
2585
|
+
var Range = require_range();
|
|
2586
|
+
var intersects = (r1, r2, options) => {
|
|
2587
|
+
r1 = new Range(r1, options);
|
|
2588
|
+
r2 = new Range(r2, options);
|
|
2589
|
+
return r1.intersects(r2, options);
|
|
2590
|
+
};
|
|
2591
|
+
module.exports = intersects;
|
|
2592
|
+
});
|
|
2593
|
+
|
|
2594
|
+
// ../../node_modules/.bun/semver@7.7.4/node_modules/semver/ranges/simplify.js
|
|
2595
|
+
var require_simplify = __commonJS((exports, module) => {
|
|
2596
|
+
var satisfies = require_satisfies();
|
|
2597
|
+
var compare = require_compare();
|
|
2598
|
+
module.exports = (versions, range, options) => {
|
|
2599
|
+
const set = [];
|
|
2600
|
+
let first = null;
|
|
2601
|
+
let prev = null;
|
|
2602
|
+
const v = versions.sort((a, b) => compare(a, b, options));
|
|
2603
|
+
for (const version of v) {
|
|
2604
|
+
const included = satisfies(version, range, options);
|
|
2605
|
+
if (included) {
|
|
2606
|
+
prev = version;
|
|
2607
|
+
if (!first) {
|
|
2608
|
+
first = version;
|
|
2609
|
+
}
|
|
2610
|
+
} else {
|
|
2611
|
+
if (prev) {
|
|
2612
|
+
set.push([first, prev]);
|
|
2613
|
+
}
|
|
2614
|
+
prev = null;
|
|
2615
|
+
first = null;
|
|
2616
|
+
}
|
|
2617
|
+
}
|
|
2618
|
+
if (first) {
|
|
2619
|
+
set.push([first, null]);
|
|
2620
|
+
}
|
|
2621
|
+
const ranges = [];
|
|
2622
|
+
for (const [min, max] of set) {
|
|
2623
|
+
if (min === max) {
|
|
2624
|
+
ranges.push(min);
|
|
2625
|
+
} else if (!max && min === v[0]) {
|
|
2626
|
+
ranges.push("*");
|
|
2627
|
+
} else if (!max) {
|
|
2628
|
+
ranges.push(`>=${min}`);
|
|
2629
|
+
} else if (min === v[0]) {
|
|
2630
|
+
ranges.push(`<=${max}`);
|
|
2631
|
+
} else {
|
|
2632
|
+
ranges.push(`${min} - ${max}`);
|
|
2633
|
+
}
|
|
2634
|
+
}
|
|
2635
|
+
const simplified = ranges.join(" || ");
|
|
2636
|
+
const original = typeof range.raw === "string" ? range.raw : String(range);
|
|
2637
|
+
return simplified.length < original.length ? simplified : range;
|
|
2638
|
+
};
|
|
2639
|
+
});
|
|
2640
|
+
|
|
2641
|
+
// ../../node_modules/.bun/semver@7.7.4/node_modules/semver/ranges/subset.js
|
|
2642
|
+
var require_subset = __commonJS((exports, module) => {
|
|
2643
|
+
var Range = require_range();
|
|
2644
|
+
var Comparator = require_comparator();
|
|
2645
|
+
var { ANY } = Comparator;
|
|
2646
|
+
var satisfies = require_satisfies();
|
|
2647
|
+
var compare = require_compare();
|
|
2648
|
+
var subset = (sub, dom, options = {}) => {
|
|
2649
|
+
if (sub === dom) {
|
|
2650
|
+
return true;
|
|
2651
|
+
}
|
|
2652
|
+
sub = new Range(sub, options);
|
|
2653
|
+
dom = new Range(dom, options);
|
|
2654
|
+
let sawNonNull = false;
|
|
2655
|
+
OUTER:
|
|
2656
|
+
for (const simpleSub of sub.set) {
|
|
2657
|
+
for (const simpleDom of dom.set) {
|
|
2658
|
+
const isSub = simpleSubset(simpleSub, simpleDom, options);
|
|
2659
|
+
sawNonNull = sawNonNull || isSub !== null;
|
|
2660
|
+
if (isSub) {
|
|
2661
|
+
continue OUTER;
|
|
2662
|
+
}
|
|
2663
|
+
}
|
|
2664
|
+
if (sawNonNull) {
|
|
2665
|
+
return false;
|
|
2666
|
+
}
|
|
2667
|
+
}
|
|
2668
|
+
return true;
|
|
2669
|
+
};
|
|
2670
|
+
var minimumVersionWithPreRelease = [new Comparator(">=0.0.0-0")];
|
|
2671
|
+
var minimumVersion = [new Comparator(">=0.0.0")];
|
|
2672
|
+
var simpleSubset = (sub, dom, options) => {
|
|
2673
|
+
if (sub === dom) {
|
|
2674
|
+
return true;
|
|
2675
|
+
}
|
|
2676
|
+
if (sub.length === 1 && sub[0].semver === ANY) {
|
|
2677
|
+
if (dom.length === 1 && dom[0].semver === ANY) {
|
|
2678
|
+
return true;
|
|
2679
|
+
} else if (options.includePrerelease) {
|
|
2680
|
+
sub = minimumVersionWithPreRelease;
|
|
2681
|
+
} else {
|
|
2682
|
+
sub = minimumVersion;
|
|
2683
|
+
}
|
|
2684
|
+
}
|
|
2685
|
+
if (dom.length === 1 && dom[0].semver === ANY) {
|
|
2686
|
+
if (options.includePrerelease) {
|
|
2687
|
+
return true;
|
|
2688
|
+
} else {
|
|
2689
|
+
dom = minimumVersion;
|
|
2690
|
+
}
|
|
2691
|
+
}
|
|
2692
|
+
const eqSet = new Set;
|
|
2693
|
+
let gt, lt;
|
|
2694
|
+
for (const c of sub) {
|
|
2695
|
+
if (c.operator === ">" || c.operator === ">=") {
|
|
2696
|
+
gt = higherGT(gt, c, options);
|
|
2697
|
+
} else if (c.operator === "<" || c.operator === "<=") {
|
|
2698
|
+
lt = lowerLT(lt, c, options);
|
|
2699
|
+
} else {
|
|
2700
|
+
eqSet.add(c.semver);
|
|
2701
|
+
}
|
|
2702
|
+
}
|
|
2703
|
+
if (eqSet.size > 1) {
|
|
2704
|
+
return null;
|
|
2705
|
+
}
|
|
2706
|
+
let gtltComp;
|
|
2707
|
+
if (gt && lt) {
|
|
2708
|
+
gtltComp = compare(gt.semver, lt.semver, options);
|
|
2709
|
+
if (gtltComp > 0) {
|
|
2710
|
+
return null;
|
|
2711
|
+
} else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<=")) {
|
|
2712
|
+
return null;
|
|
2713
|
+
}
|
|
2714
|
+
}
|
|
2715
|
+
for (const eq of eqSet) {
|
|
2716
|
+
if (gt && !satisfies(eq, String(gt), options)) {
|
|
2717
|
+
return null;
|
|
2718
|
+
}
|
|
2719
|
+
if (lt && !satisfies(eq, String(lt), options)) {
|
|
2720
|
+
return null;
|
|
2721
|
+
}
|
|
2722
|
+
for (const c of dom) {
|
|
2723
|
+
if (!satisfies(eq, String(c), options)) {
|
|
2724
|
+
return false;
|
|
2725
|
+
}
|
|
2726
|
+
}
|
|
2727
|
+
return true;
|
|
2728
|
+
}
|
|
2729
|
+
let higher, lower;
|
|
2730
|
+
let hasDomLT, hasDomGT;
|
|
2731
|
+
let needDomLTPre = lt && !options.includePrerelease && lt.semver.prerelease.length ? lt.semver : false;
|
|
2732
|
+
let needDomGTPre = gt && !options.includePrerelease && gt.semver.prerelease.length ? gt.semver : false;
|
|
2733
|
+
if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt.operator === "<" && needDomLTPre.prerelease[0] === 0) {
|
|
2734
|
+
needDomLTPre = false;
|
|
2735
|
+
}
|
|
2736
|
+
for (const c of dom) {
|
|
2737
|
+
hasDomGT = hasDomGT || c.operator === ">" || c.operator === ">=";
|
|
2738
|
+
hasDomLT = hasDomLT || c.operator === "<" || c.operator === "<=";
|
|
2739
|
+
if (gt) {
|
|
2740
|
+
if (needDomGTPre) {
|
|
2741
|
+
if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomGTPre.major && c.semver.minor === needDomGTPre.minor && c.semver.patch === needDomGTPre.patch) {
|
|
2742
|
+
needDomGTPre = false;
|
|
2743
|
+
}
|
|
2744
|
+
}
|
|
2745
|
+
if (c.operator === ">" || c.operator === ">=") {
|
|
2746
|
+
higher = higherGT(gt, c, options);
|
|
2747
|
+
if (higher === c && higher !== gt) {
|
|
2748
|
+
return false;
|
|
2749
|
+
}
|
|
2750
|
+
} else if (gt.operator === ">=" && !satisfies(gt.semver, String(c), options)) {
|
|
2751
|
+
return false;
|
|
2752
|
+
}
|
|
2753
|
+
}
|
|
2754
|
+
if (lt) {
|
|
2755
|
+
if (needDomLTPre) {
|
|
2756
|
+
if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomLTPre.major && c.semver.minor === needDomLTPre.minor && c.semver.patch === needDomLTPre.patch) {
|
|
2757
|
+
needDomLTPre = false;
|
|
2758
|
+
}
|
|
2759
|
+
}
|
|
2760
|
+
if (c.operator === "<" || c.operator === "<=") {
|
|
2761
|
+
lower = lowerLT(lt, c, options);
|
|
2762
|
+
if (lower === c && lower !== lt) {
|
|
2763
|
+
return false;
|
|
2764
|
+
}
|
|
2765
|
+
} else if (lt.operator === "<=" && !satisfies(lt.semver, String(c), options)) {
|
|
2766
|
+
return false;
|
|
2767
|
+
}
|
|
2768
|
+
}
|
|
2769
|
+
if (!c.operator && (lt || gt) && gtltComp !== 0) {
|
|
2770
|
+
return false;
|
|
2771
|
+
}
|
|
2772
|
+
}
|
|
2773
|
+
if (gt && hasDomLT && !lt && gtltComp !== 0) {
|
|
2774
|
+
return false;
|
|
2775
|
+
}
|
|
2776
|
+
if (lt && hasDomGT && !gt && gtltComp !== 0) {
|
|
2777
|
+
return false;
|
|
2778
|
+
}
|
|
2779
|
+
if (needDomGTPre || needDomLTPre) {
|
|
2780
|
+
return false;
|
|
2781
|
+
}
|
|
2782
|
+
return true;
|
|
2783
|
+
};
|
|
2784
|
+
var higherGT = (a, b, options) => {
|
|
2785
|
+
if (!a) {
|
|
2786
|
+
return b;
|
|
2787
|
+
}
|
|
2788
|
+
const comp = compare(a.semver, b.semver, options);
|
|
2789
|
+
return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a;
|
|
2790
|
+
};
|
|
2791
|
+
var lowerLT = (a, b, options) => {
|
|
2792
|
+
if (!a) {
|
|
2793
|
+
return b;
|
|
2794
|
+
}
|
|
2795
|
+
const comp = compare(a.semver, b.semver, options);
|
|
2796
|
+
return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a;
|
|
2797
|
+
};
|
|
2798
|
+
module.exports = subset;
|
|
2799
|
+
});
|
|
2800
|
+
|
|
2801
|
+
// ../../node_modules/.bun/semver@7.7.4/node_modules/semver/index.js
|
|
2802
|
+
var require_semver2 = __commonJS((exports, module) => {
|
|
2803
|
+
var internalRe = require_re();
|
|
2804
|
+
var constants = require_constants();
|
|
2805
|
+
var SemVer = require_semver();
|
|
2806
|
+
var identifiers = require_identifiers();
|
|
2807
|
+
var parse = require_parse();
|
|
2808
|
+
var valid = require_valid();
|
|
2809
|
+
var clean = require_clean();
|
|
2810
|
+
var inc = require_inc();
|
|
2811
|
+
var diff = require_diff();
|
|
2812
|
+
var major = require_major();
|
|
2813
|
+
var minor = require_minor();
|
|
2814
|
+
var patch = require_patch();
|
|
2815
|
+
var prerelease = require_prerelease();
|
|
2816
|
+
var compare = require_compare();
|
|
2817
|
+
var rcompare = require_rcompare();
|
|
2818
|
+
var compareLoose = require_compare_loose();
|
|
2819
|
+
var compareBuild = require_compare_build();
|
|
2820
|
+
var sort = require_sort();
|
|
2821
|
+
var rsort = require_rsort();
|
|
2822
|
+
var gt = require_gt();
|
|
2823
|
+
var lt = require_lt();
|
|
2824
|
+
var eq = require_eq();
|
|
2825
|
+
var neq = require_neq();
|
|
2826
|
+
var gte = require_gte();
|
|
2827
|
+
var lte = require_lte();
|
|
2828
|
+
var cmp = require_cmp();
|
|
2829
|
+
var coerce = require_coerce();
|
|
2830
|
+
var Comparator = require_comparator();
|
|
2831
|
+
var Range = require_range();
|
|
2832
|
+
var satisfies = require_satisfies();
|
|
2833
|
+
var toComparators = require_to_comparators();
|
|
2834
|
+
var maxSatisfying = require_max_satisfying();
|
|
2835
|
+
var minSatisfying = require_min_satisfying();
|
|
2836
|
+
var minVersion = require_min_version();
|
|
2837
|
+
var validRange = require_valid2();
|
|
2838
|
+
var outside = require_outside();
|
|
2839
|
+
var gtr = require_gtr();
|
|
2840
|
+
var ltr = require_ltr();
|
|
2841
|
+
var intersects = require_intersects();
|
|
2842
|
+
var simplifyRange = require_simplify();
|
|
2843
|
+
var subset = require_subset();
|
|
2844
|
+
module.exports = {
|
|
2845
|
+
parse,
|
|
2846
|
+
valid,
|
|
2847
|
+
clean,
|
|
2848
|
+
inc,
|
|
2849
|
+
diff,
|
|
2850
|
+
major,
|
|
2851
|
+
minor,
|
|
2852
|
+
patch,
|
|
2853
|
+
prerelease,
|
|
2854
|
+
compare,
|
|
2855
|
+
rcompare,
|
|
2856
|
+
compareLoose,
|
|
2857
|
+
compareBuild,
|
|
2858
|
+
sort,
|
|
2859
|
+
rsort,
|
|
2860
|
+
gt,
|
|
2861
|
+
lt,
|
|
2862
|
+
eq,
|
|
2863
|
+
neq,
|
|
2864
|
+
gte,
|
|
2865
|
+
lte,
|
|
2866
|
+
cmp,
|
|
2867
|
+
coerce,
|
|
2868
|
+
Comparator,
|
|
2869
|
+
Range,
|
|
2870
|
+
satisfies,
|
|
2871
|
+
toComparators,
|
|
2872
|
+
maxSatisfying,
|
|
2873
|
+
minSatisfying,
|
|
2874
|
+
minVersion,
|
|
2875
|
+
validRange,
|
|
2876
|
+
outside,
|
|
2877
|
+
gtr,
|
|
2878
|
+
ltr,
|
|
2879
|
+
intersects,
|
|
2880
|
+
simplifyRange,
|
|
2881
|
+
subset,
|
|
2882
|
+
SemVer,
|
|
2883
|
+
re: internalRe.re,
|
|
2884
|
+
src: internalRe.src,
|
|
2885
|
+
tokens: internalRe.t,
|
|
2886
|
+
SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
|
|
2887
|
+
RELEASE_TYPES: constants.RELEASE_TYPES,
|
|
2888
|
+
compareIdentifiers: identifiers.compareIdentifiers,
|
|
2889
|
+
rcompareIdentifiers: identifiers.rcompareIdentifiers
|
|
2890
|
+
};
|
|
2891
|
+
});
|
|
2892
|
+
|
|
2893
|
+
// ../../node_modules/.bun/validate-npm-package-name@7.0.2/node_modules/validate-npm-package-name/lib/builtin-modules.json
|
|
2894
|
+
var require_builtin_modules = __commonJS((exports, module) => {
|
|
2895
|
+
module.exports = ["_http_agent", "_http_client", "_http_common", "_http_incoming", "_http_outgoing", "_http_server", "_stream_duplex", "_stream_passthrough", "_stream_readable", "_stream_transform", "_stream_wrap", "_stream_writable", "_tls_common", "_tls_wrap", "assert", "assert/strict", "async_hooks", "buffer", "child_process", "cluster", "console", "constants", "crypto", "dgram", "diagnostics_channel", "dns", "dns/promises", "domain", "events", "fs", "fs/promises", "http", "http2", "https", "inspector", "inspector/promises", "module", "net", "os", "path", "path/posix", "path/win32", "perf_hooks", "process", "punycode", "querystring", "readline", "readline/promises", "repl", "stream", "stream/consumers", "stream/promises", "stream/web", "string_decoder", "sys", "timers", "timers/promises", "tls", "trace_events", "tty", "url", "util", "util/types", "v8", "vm", "wasi", "worker_threads", "zlib", "node:sea", "node:sqlite", "node:test", "node:test/reporters"];
|
|
2896
|
+
});
|
|
2897
|
+
|
|
2898
|
+
// ../../node_modules/.bun/validate-npm-package-name@7.0.2/node_modules/validate-npm-package-name/lib/index.js
|
|
2899
|
+
var require_lib2 = __commonJS((exports, module) => {
|
|
2900
|
+
var builtins = require_builtin_modules();
|
|
2901
|
+
var scopedPackagePattern = new RegExp("^(?:@([^/]+?)[/])?([^/]+?)$");
|
|
2902
|
+
var exclusionList = [
|
|
2903
|
+
"node_modules",
|
|
2904
|
+
"favicon.ico"
|
|
2905
|
+
];
|
|
2906
|
+
function validate(name) {
|
|
2907
|
+
var warnings = [];
|
|
2908
|
+
var errors = [];
|
|
2909
|
+
if (name === null) {
|
|
2910
|
+
errors.push("name cannot be null");
|
|
2911
|
+
return done(warnings, errors);
|
|
2912
|
+
}
|
|
2913
|
+
if (name === undefined) {
|
|
2914
|
+
errors.push("name cannot be undefined");
|
|
2915
|
+
return done(warnings, errors);
|
|
2916
|
+
}
|
|
2917
|
+
if (typeof name !== "string") {
|
|
2918
|
+
errors.push("name must be a string");
|
|
2919
|
+
return done(warnings, errors);
|
|
2920
|
+
}
|
|
2921
|
+
if (!name.length) {
|
|
2922
|
+
errors.push("name length must be greater than zero");
|
|
2923
|
+
}
|
|
2924
|
+
if (name.startsWith(".")) {
|
|
2925
|
+
errors.push("name cannot start with a period");
|
|
2926
|
+
}
|
|
2927
|
+
if (name.startsWith("-")) {
|
|
2928
|
+
errors.push("name cannot start with a hyphen");
|
|
2929
|
+
}
|
|
2930
|
+
if (name.match(/^_/)) {
|
|
2931
|
+
errors.push("name cannot start with an underscore");
|
|
2932
|
+
}
|
|
2933
|
+
if (name.trim() !== name) {
|
|
2934
|
+
errors.push("name cannot contain leading or trailing spaces");
|
|
2935
|
+
}
|
|
2936
|
+
exclusionList.forEach(function(excludedName) {
|
|
2937
|
+
if (name.toLowerCase() === excludedName) {
|
|
2938
|
+
errors.push(excludedName + " is not a valid package name");
|
|
2939
|
+
}
|
|
2940
|
+
});
|
|
2941
|
+
if (builtins.includes(name.toLowerCase())) {
|
|
2942
|
+
warnings.push(name + " is a core module name");
|
|
2943
|
+
}
|
|
2944
|
+
if (name.length > 214) {
|
|
2945
|
+
warnings.push("name can no longer contain more than 214 characters");
|
|
2946
|
+
}
|
|
2947
|
+
if (name.toLowerCase() !== name) {
|
|
2948
|
+
warnings.push("name can no longer contain capital letters");
|
|
2949
|
+
}
|
|
2950
|
+
if (/[~'!()*]/.test(name.split("/").slice(-1)[0])) {
|
|
2951
|
+
warnings.push(`name can no longer contain special characters ("~'!()*")`);
|
|
2952
|
+
}
|
|
2953
|
+
if (encodeURIComponent(name) !== name) {
|
|
2954
|
+
var nameMatch = name.match(scopedPackagePattern);
|
|
2955
|
+
if (nameMatch) {
|
|
2956
|
+
var user = nameMatch[1];
|
|
2957
|
+
var pkg = nameMatch[2];
|
|
2958
|
+
if (pkg.startsWith(".")) {
|
|
2959
|
+
errors.push("name cannot start with a period");
|
|
2960
|
+
}
|
|
2961
|
+
if (encodeURIComponent(user) === user && encodeURIComponent(pkg) === pkg) {
|
|
2962
|
+
return done(warnings, errors);
|
|
2963
|
+
}
|
|
2964
|
+
}
|
|
2965
|
+
errors.push("name can only contain URL-friendly characters");
|
|
2966
|
+
}
|
|
2967
|
+
return done(warnings, errors);
|
|
2968
|
+
}
|
|
2969
|
+
var done = function(warnings, errors) {
|
|
2970
|
+
var result = {
|
|
2971
|
+
validForNewPackages: errors.length === 0 && warnings.length === 0,
|
|
2972
|
+
validForOldPackages: errors.length === 0,
|
|
2973
|
+
warnings,
|
|
2974
|
+
errors
|
|
2975
|
+
};
|
|
2976
|
+
if (!result.warnings.length) {
|
|
2977
|
+
delete result.warnings;
|
|
2978
|
+
}
|
|
2979
|
+
if (!result.errors.length) {
|
|
2980
|
+
delete result.errors;
|
|
2981
|
+
}
|
|
2982
|
+
return result;
|
|
2983
|
+
};
|
|
2984
|
+
module.exports = validate;
|
|
2985
|
+
});
|
|
2986
|
+
|
|
2987
|
+
// ../../node_modules/.bun/proc-log@6.1.0/node_modules/proc-log/lib/index.js
|
|
2988
|
+
var require_lib3 = __commonJS((exports, module) => {
|
|
2989
|
+
var META = Symbol("proc-log.meta");
|
|
2990
|
+
module.exports = {
|
|
2991
|
+
META,
|
|
2992
|
+
output: {
|
|
2993
|
+
LEVELS: [
|
|
2994
|
+
"standard",
|
|
2995
|
+
"error",
|
|
2996
|
+
"buffer",
|
|
2997
|
+
"flush"
|
|
2998
|
+
],
|
|
2999
|
+
KEYS: {
|
|
3000
|
+
standard: "standard",
|
|
3001
|
+
error: "error",
|
|
3002
|
+
buffer: "buffer",
|
|
3003
|
+
flush: "flush"
|
|
3004
|
+
},
|
|
3005
|
+
standard: function(...args) {
|
|
3006
|
+
return process.emit("output", "standard", ...args);
|
|
3007
|
+
},
|
|
3008
|
+
error: function(...args) {
|
|
3009
|
+
return process.emit("output", "error", ...args);
|
|
3010
|
+
},
|
|
3011
|
+
buffer: function(...args) {
|
|
3012
|
+
return process.emit("output", "buffer", ...args);
|
|
3013
|
+
},
|
|
3014
|
+
flush: function(...args) {
|
|
3015
|
+
return process.emit("output", "flush", ...args);
|
|
3016
|
+
}
|
|
3017
|
+
},
|
|
3018
|
+
log: {
|
|
3019
|
+
LEVELS: [
|
|
3020
|
+
"notice",
|
|
3021
|
+
"error",
|
|
3022
|
+
"warn",
|
|
3023
|
+
"info",
|
|
3024
|
+
"verbose",
|
|
3025
|
+
"http",
|
|
3026
|
+
"silly",
|
|
3027
|
+
"timing",
|
|
3028
|
+
"pause",
|
|
3029
|
+
"resume"
|
|
3030
|
+
],
|
|
3031
|
+
KEYS: {
|
|
3032
|
+
notice: "notice",
|
|
3033
|
+
error: "error",
|
|
3034
|
+
warn: "warn",
|
|
3035
|
+
info: "info",
|
|
3036
|
+
verbose: "verbose",
|
|
3037
|
+
http: "http",
|
|
3038
|
+
silly: "silly",
|
|
3039
|
+
timing: "timing",
|
|
3040
|
+
pause: "pause",
|
|
3041
|
+
resume: "resume"
|
|
3042
|
+
},
|
|
3043
|
+
error: function(...args) {
|
|
3044
|
+
return process.emit("log", "error", ...args);
|
|
3045
|
+
},
|
|
3046
|
+
notice: function(...args) {
|
|
3047
|
+
return process.emit("log", "notice", ...args);
|
|
3048
|
+
},
|
|
3049
|
+
warn: function(...args) {
|
|
3050
|
+
return process.emit("log", "warn", ...args);
|
|
3051
|
+
},
|
|
3052
|
+
info: function(...args) {
|
|
3053
|
+
return process.emit("log", "info", ...args);
|
|
3054
|
+
},
|
|
3055
|
+
verbose: function(...args) {
|
|
3056
|
+
return process.emit("log", "verbose", ...args);
|
|
3057
|
+
},
|
|
3058
|
+
http: function(...args) {
|
|
3059
|
+
return process.emit("log", "http", ...args);
|
|
3060
|
+
},
|
|
3061
|
+
silly: function(...args) {
|
|
3062
|
+
return process.emit("log", "silly", ...args);
|
|
3063
|
+
},
|
|
3064
|
+
timing: function(...args) {
|
|
3065
|
+
return process.emit("log", "timing", ...args);
|
|
3066
|
+
},
|
|
3067
|
+
pause: function() {
|
|
3068
|
+
return process.emit("log", "pause");
|
|
3069
|
+
},
|
|
3070
|
+
resume: function() {
|
|
3071
|
+
return process.emit("log", "resume");
|
|
3072
|
+
}
|
|
3073
|
+
},
|
|
3074
|
+
time: {
|
|
3075
|
+
LEVELS: [
|
|
3076
|
+
"start",
|
|
3077
|
+
"end"
|
|
3078
|
+
],
|
|
3079
|
+
KEYS: {
|
|
3080
|
+
start: "start",
|
|
3081
|
+
end: "end"
|
|
3082
|
+
},
|
|
3083
|
+
start: function(name, fn) {
|
|
3084
|
+
process.emit("time", "start", name);
|
|
3085
|
+
function end() {
|
|
3086
|
+
return process.emit("time", "end", name);
|
|
3087
|
+
}
|
|
3088
|
+
if (typeof fn === "function") {
|
|
3089
|
+
const res = fn();
|
|
3090
|
+
if (res && res.finally) {
|
|
3091
|
+
return res.finally(end);
|
|
3092
|
+
}
|
|
3093
|
+
end();
|
|
3094
|
+
return res;
|
|
3095
|
+
}
|
|
3096
|
+
return end;
|
|
3097
|
+
},
|
|
3098
|
+
end: function(name) {
|
|
3099
|
+
return process.emit("time", "end", name);
|
|
3100
|
+
}
|
|
3101
|
+
},
|
|
3102
|
+
input: {
|
|
3103
|
+
LEVELS: [
|
|
3104
|
+
"start",
|
|
3105
|
+
"end",
|
|
3106
|
+
"read"
|
|
3107
|
+
],
|
|
3108
|
+
KEYS: {
|
|
3109
|
+
start: "start",
|
|
3110
|
+
end: "end",
|
|
3111
|
+
read: "read"
|
|
3112
|
+
},
|
|
3113
|
+
start: function(...args) {
|
|
3114
|
+
let fn;
|
|
3115
|
+
if (typeof args[0] === "function") {
|
|
3116
|
+
fn = args.shift();
|
|
3117
|
+
}
|
|
3118
|
+
process.emit("input", "start", ...args);
|
|
3119
|
+
function end() {
|
|
3120
|
+
return process.emit("input", "end", ...args);
|
|
3121
|
+
}
|
|
3122
|
+
if (typeof fn === "function") {
|
|
3123
|
+
const res = fn();
|
|
3124
|
+
if (res && res.finally) {
|
|
3125
|
+
return res.finally(end);
|
|
3126
|
+
}
|
|
3127
|
+
end();
|
|
3128
|
+
return res;
|
|
3129
|
+
}
|
|
3130
|
+
return end;
|
|
3131
|
+
},
|
|
3132
|
+
end: function(...args) {
|
|
3133
|
+
return process.emit("input", "end", ...args);
|
|
3134
|
+
},
|
|
3135
|
+
read: function(...args) {
|
|
3136
|
+
let resolve, reject;
|
|
3137
|
+
const promise = new Promise((_resolve, _reject) => {
|
|
3138
|
+
resolve = _resolve;
|
|
3139
|
+
reject = _reject;
|
|
3140
|
+
});
|
|
3141
|
+
process.emit("input", "read", resolve, reject, ...args);
|
|
3142
|
+
return promise;
|
|
3143
|
+
}
|
|
3144
|
+
}
|
|
3145
|
+
};
|
|
3146
|
+
});
|
|
3147
|
+
|
|
3148
|
+
// ../../node_modules/.bun/npm-package-arg@13.0.2/node_modules/npm-package-arg/lib/npa.js
|
|
3149
|
+
var require_npa = __commonJS((exports, module) => {
|
|
3150
|
+
var isWindows = process.platform === "win32";
|
|
3151
|
+
var { URL: URL2 } = __require("url");
|
|
3152
|
+
var path = isWindows ? __require("path/win32") : __require("path");
|
|
3153
|
+
var { homedir } = __require("os");
|
|
3154
|
+
var HostedGit = require_lib();
|
|
3155
|
+
var semver = require_semver2();
|
|
3156
|
+
var validatePackageName = require_lib2();
|
|
3157
|
+
var { log } = require_lib3();
|
|
3158
|
+
var hasSlashes = isWindows ? /\\|[/]/ : /[/]/;
|
|
3159
|
+
var isURL = /^(?:git[+])?[a-z]+:/i;
|
|
3160
|
+
var isGit = /^[^@]+@[^:.]+\.[^:]+:.+$/i;
|
|
3161
|
+
var isFileType = /[.](?:tgz|tar\.gz|tar)$/i;
|
|
3162
|
+
var isPortNumber = /:[0-9]+(\/|$)/i;
|
|
3163
|
+
var isWindowsFile = /^(?:[.]|~[/]|[/\\]|[a-zA-Z]:)/;
|
|
3164
|
+
var isPosixFile = /^(?:[.]|~[/]|[/]|[a-zA-Z]:)/;
|
|
3165
|
+
var defaultRegistry = "https://registry.npmjs.org";
|
|
3166
|
+
function npa(arg, where) {
|
|
3167
|
+
let name;
|
|
3168
|
+
let spec;
|
|
3169
|
+
if (typeof arg === "object") {
|
|
3170
|
+
if (arg instanceof Result && (!where || where === arg.where)) {
|
|
3171
|
+
return arg;
|
|
3172
|
+
} else if (arg.name && arg.rawSpec) {
|
|
3173
|
+
return npa.resolve(arg.name, arg.rawSpec, where || arg.where);
|
|
3174
|
+
} else {
|
|
3175
|
+
return npa(arg.raw, where || arg.where);
|
|
3176
|
+
}
|
|
3177
|
+
}
|
|
3178
|
+
const nameEndsAt = arg.indexOf("@", 1);
|
|
3179
|
+
const namePart = nameEndsAt > 0 ? arg.slice(0, nameEndsAt) : arg;
|
|
3180
|
+
if (isURL.test(arg)) {
|
|
3181
|
+
spec = arg;
|
|
3182
|
+
} else if (isGit.test(arg)) {
|
|
3183
|
+
spec = `git+ssh://${arg}`;
|
|
3184
|
+
} else if (!namePart.startsWith("@") && (hasSlashes.test(namePart) || isFileType.test(namePart))) {
|
|
3185
|
+
spec = arg;
|
|
3186
|
+
} else if (nameEndsAt > 0) {
|
|
3187
|
+
name = namePart;
|
|
3188
|
+
spec = arg.slice(nameEndsAt + 1) || "*";
|
|
3189
|
+
} else {
|
|
3190
|
+
const valid = validatePackageName(arg);
|
|
3191
|
+
if (valid.validForOldPackages) {
|
|
3192
|
+
name = arg;
|
|
3193
|
+
spec = "*";
|
|
3194
|
+
} else {
|
|
3195
|
+
spec = arg;
|
|
3196
|
+
}
|
|
3197
|
+
}
|
|
3198
|
+
return resolve(name, spec, where, arg);
|
|
3199
|
+
}
|
|
3200
|
+
function isFileSpec(spec) {
|
|
3201
|
+
if (!spec) {
|
|
3202
|
+
return false;
|
|
3203
|
+
}
|
|
3204
|
+
if (spec.toLowerCase().startsWith("file:")) {
|
|
3205
|
+
return true;
|
|
3206
|
+
}
|
|
3207
|
+
if (isWindows) {
|
|
3208
|
+
return isWindowsFile.test(spec);
|
|
3209
|
+
}
|
|
3210
|
+
return isPosixFile.test(spec);
|
|
3211
|
+
}
|
|
3212
|
+
function isAliasSpec(spec) {
|
|
3213
|
+
if (!spec) {
|
|
3214
|
+
return false;
|
|
3215
|
+
}
|
|
3216
|
+
return spec.toLowerCase().startsWith("npm:");
|
|
3217
|
+
}
|
|
3218
|
+
function resolve(name, spec, where, arg) {
|
|
3219
|
+
const res = new Result({
|
|
3220
|
+
raw: arg,
|
|
3221
|
+
name,
|
|
3222
|
+
rawSpec: spec,
|
|
3223
|
+
fromArgument: arg != null
|
|
3224
|
+
});
|
|
3225
|
+
if (name) {
|
|
3226
|
+
res.name = name;
|
|
3227
|
+
}
|
|
3228
|
+
if (!where) {
|
|
3229
|
+
where = process.cwd();
|
|
3230
|
+
}
|
|
3231
|
+
if (isFileSpec(spec)) {
|
|
3232
|
+
return fromFile(res, where);
|
|
3233
|
+
} else if (isAliasSpec(spec)) {
|
|
3234
|
+
return fromAlias(res, where);
|
|
3235
|
+
}
|
|
3236
|
+
const hosted = HostedGit.fromUrl(spec, {
|
|
3237
|
+
noGitPlus: true,
|
|
3238
|
+
noCommittish: true
|
|
3239
|
+
});
|
|
3240
|
+
if (hosted) {
|
|
3241
|
+
return fromHostedGit(res, hosted);
|
|
3242
|
+
} else if (spec && isURL.test(spec)) {
|
|
3243
|
+
return fromURL(res);
|
|
3244
|
+
} else if (spec && (hasSlashes.test(spec) || isFileType.test(spec))) {
|
|
3245
|
+
return fromFile(res, where);
|
|
3246
|
+
} else {
|
|
3247
|
+
return fromRegistry(res);
|
|
3248
|
+
}
|
|
3249
|
+
}
|
|
3250
|
+
function toPurl(arg, reg = defaultRegistry) {
|
|
3251
|
+
const res = npa(arg);
|
|
3252
|
+
if (res.type !== "version") {
|
|
3253
|
+
throw invalidPurlType(res.type, res.raw);
|
|
3254
|
+
}
|
|
3255
|
+
let purl = "pkg:npm/" + res.name.replace(/^@/, "%40") + "@" + res.rawSpec;
|
|
3256
|
+
if (reg !== defaultRegistry) {
|
|
3257
|
+
purl += "?repository_url=" + reg;
|
|
3258
|
+
}
|
|
3259
|
+
return purl;
|
|
3260
|
+
}
|
|
3261
|
+
function invalidPackageName(name, valid, raw) {
|
|
3262
|
+
const err = new Error(`Invalid package name "${name}" of package "${raw}": ${valid.errors.join("; ")}.`);
|
|
3263
|
+
err.code = "EINVALIDPACKAGENAME";
|
|
3264
|
+
return err;
|
|
3265
|
+
}
|
|
3266
|
+
function invalidTagName(name, raw) {
|
|
3267
|
+
const err = new Error(`Invalid tag name "${name}" of package "${raw}": Tags may not have any characters that encodeURIComponent encodes.`);
|
|
3268
|
+
err.code = "EINVALIDTAGNAME";
|
|
3269
|
+
return err;
|
|
3270
|
+
}
|
|
3271
|
+
function invalidPurlType(type, raw) {
|
|
3272
|
+
const err = new Error(`Invalid type "${type}" of package "${raw}": Purl can only be generated for "version" types.`);
|
|
3273
|
+
err.code = "EINVALIDPURLTYPE";
|
|
3274
|
+
return err;
|
|
3275
|
+
}
|
|
3276
|
+
|
|
3277
|
+
class Result {
|
|
3278
|
+
constructor(opts) {
|
|
3279
|
+
this.type = opts.type;
|
|
3280
|
+
this.registry = opts.registry;
|
|
3281
|
+
this.where = opts.where;
|
|
3282
|
+
if (opts.raw == null) {
|
|
3283
|
+
this.raw = opts.name ? `${opts.name}@${opts.rawSpec}` : opts.rawSpec;
|
|
3284
|
+
} else {
|
|
3285
|
+
this.raw = opts.raw;
|
|
3286
|
+
}
|
|
3287
|
+
this.name = undefined;
|
|
3288
|
+
this.escapedName = undefined;
|
|
3289
|
+
this.scope = undefined;
|
|
3290
|
+
this.rawSpec = opts.rawSpec || "";
|
|
3291
|
+
this.saveSpec = opts.saveSpec;
|
|
3292
|
+
this.fetchSpec = opts.fetchSpec;
|
|
3293
|
+
if (opts.name) {
|
|
3294
|
+
this.setName(opts.name);
|
|
3295
|
+
}
|
|
3296
|
+
this.gitRange = opts.gitRange;
|
|
3297
|
+
this.gitCommittish = opts.gitCommittish;
|
|
3298
|
+
this.gitSubdir = opts.gitSubdir;
|
|
3299
|
+
this.hosted = opts.hosted;
|
|
3300
|
+
}
|
|
3301
|
+
setName(name) {
|
|
3302
|
+
const valid = validatePackageName(name);
|
|
3303
|
+
if (!valid.validForOldPackages) {
|
|
3304
|
+
throw invalidPackageName(name, valid, this.raw);
|
|
3305
|
+
}
|
|
3306
|
+
this.name = name;
|
|
3307
|
+
this.scope = name[0] === "@" ? name.slice(0, name.indexOf("/")) : undefined;
|
|
3308
|
+
this.escapedName = name.replace("/", "%2f");
|
|
3309
|
+
return this;
|
|
3310
|
+
}
|
|
3311
|
+
toString() {
|
|
3312
|
+
const full = [];
|
|
3313
|
+
if (this.name != null && this.name !== "") {
|
|
3314
|
+
full.push(this.name);
|
|
3315
|
+
}
|
|
3316
|
+
const spec = this.saveSpec || this.fetchSpec || this.rawSpec;
|
|
3317
|
+
if (spec != null && spec !== "") {
|
|
3318
|
+
full.push(spec);
|
|
3319
|
+
}
|
|
3320
|
+
return full.length ? full.join("@") : this.raw;
|
|
3321
|
+
}
|
|
3322
|
+
toJSON() {
|
|
3323
|
+
const result = Object.assign({}, this);
|
|
3324
|
+
delete result.hosted;
|
|
3325
|
+
return result;
|
|
3326
|
+
}
|
|
3327
|
+
}
|
|
3328
|
+
function setGitAttrs(res, committish) {
|
|
3329
|
+
if (!committish) {
|
|
3330
|
+
res.gitCommittish = null;
|
|
3331
|
+
return;
|
|
3332
|
+
}
|
|
3333
|
+
for (const part of committish.split("::")) {
|
|
3334
|
+
if (!part.includes(":")) {
|
|
3335
|
+
if (res.gitRange) {
|
|
3336
|
+
throw new Error("cannot override existing semver range with a committish");
|
|
3337
|
+
}
|
|
3338
|
+
if (res.gitCommittish) {
|
|
3339
|
+
throw new Error("cannot override existing committish with a second committish");
|
|
3340
|
+
}
|
|
3341
|
+
res.gitCommittish = part;
|
|
3342
|
+
continue;
|
|
3343
|
+
}
|
|
3344
|
+
const [name, value] = part.split(":");
|
|
3345
|
+
if (name === "semver") {
|
|
3346
|
+
if (res.gitCommittish) {
|
|
3347
|
+
throw new Error("cannot override existing committish with a semver range");
|
|
3348
|
+
}
|
|
3349
|
+
if (res.gitRange) {
|
|
3350
|
+
throw new Error("cannot override existing semver range with a second semver range");
|
|
3351
|
+
}
|
|
3352
|
+
res.gitRange = decodeURIComponent(value);
|
|
3353
|
+
continue;
|
|
3354
|
+
}
|
|
3355
|
+
if (name === "path") {
|
|
3356
|
+
if (res.gitSubdir) {
|
|
3357
|
+
throw new Error("cannot override existing path with a second path");
|
|
3358
|
+
}
|
|
3359
|
+
res.gitSubdir = `/${value}`;
|
|
3360
|
+
continue;
|
|
3361
|
+
}
|
|
3362
|
+
log.warn("npm-package-arg", `ignoring unknown key "${name}"`);
|
|
3363
|
+
}
|
|
3364
|
+
}
|
|
3365
|
+
var encodedPathChars = new Map([
|
|
3366
|
+
["\x00", "%00"],
|
|
3367
|
+
["\t", "%09"],
|
|
3368
|
+
[`
|
|
3369
|
+
`, "%0A"],
|
|
3370
|
+
["\r", "%0D"],
|
|
3371
|
+
[" ", "%20"],
|
|
3372
|
+
['"', "%22"],
|
|
3373
|
+
["#", "%23"],
|
|
3374
|
+
["%", "%25"],
|
|
3375
|
+
["?", "%3F"],
|
|
3376
|
+
["[", "%5B"],
|
|
3377
|
+
["\\", isWindows ? "/" : "%5C"],
|
|
3378
|
+
["]", "%5D"],
|
|
3379
|
+
["^", "%5E"],
|
|
3380
|
+
["|", "%7C"],
|
|
3381
|
+
["~", "%7E"]
|
|
3382
|
+
]);
|
|
3383
|
+
function pathToFileURL(str) {
|
|
3384
|
+
let result = "";
|
|
3385
|
+
for (let i = 0;i < str.length; i++) {
|
|
3386
|
+
result = `${result}${encodedPathChars.get(str[i]) ?? str[i]}`;
|
|
3387
|
+
}
|
|
3388
|
+
if (result.startsWith("file:")) {
|
|
3389
|
+
return result;
|
|
3390
|
+
}
|
|
3391
|
+
return `file:${result}`;
|
|
3392
|
+
}
|
|
3393
|
+
function fromFile(res, where) {
|
|
3394
|
+
res.type = isFileType.test(res.rawSpec) ? "file" : "directory";
|
|
3395
|
+
res.where = where;
|
|
3396
|
+
let rawSpec = pathToFileURL(res.rawSpec);
|
|
3397
|
+
if (rawSpec.startsWith("file:/")) {
|
|
3398
|
+
if (/^file:\/\/[^/]/.test(rawSpec)) {
|
|
3399
|
+
rawSpec = `file:/${rawSpec.slice(5)}`;
|
|
3400
|
+
}
|
|
3401
|
+
if (/^\/{1,3}\.\.?(\/|$)/.test(rawSpec.slice(5))) {
|
|
3402
|
+
rawSpec = rawSpec.replace(/^file:\/{1,3}/, "file:");
|
|
3403
|
+
}
|
|
3404
|
+
}
|
|
3405
|
+
let resolvedUrl;
|
|
3406
|
+
let specUrl;
|
|
3407
|
+
try {
|
|
3408
|
+
resolvedUrl = new URL2(rawSpec, `${pathToFileURL(path.resolve(where))}/`);
|
|
3409
|
+
specUrl = new URL2(rawSpec);
|
|
3410
|
+
} catch (originalError) {
|
|
3411
|
+
const er = new Error("Invalid file: URL, must comply with RFC 8089");
|
|
3412
|
+
throw Object.assign(er, {
|
|
3413
|
+
raw: res.rawSpec,
|
|
3414
|
+
spec: res,
|
|
3415
|
+
where,
|
|
3416
|
+
originalError
|
|
3417
|
+
});
|
|
3418
|
+
}
|
|
3419
|
+
let specPath = decodeURIComponent(specUrl.pathname);
|
|
3420
|
+
let resolvedPath = decodeURIComponent(resolvedUrl.pathname);
|
|
3421
|
+
if (isWindows) {
|
|
3422
|
+
specPath = specPath.replace(/^\/+([a-z]:\/)/i, "$1");
|
|
3423
|
+
resolvedPath = resolvedPath.replace(/^\/+([a-z]:\/)/i, "$1");
|
|
3424
|
+
}
|
|
3425
|
+
if (/^\/~(\/|$)/.test(specPath)) {
|
|
3426
|
+
res.saveSpec = `file:${specPath.substr(1)}`;
|
|
3427
|
+
resolvedPath = path.resolve(homedir(), specPath.substr(3));
|
|
3428
|
+
} else if (!path.isAbsolute(rawSpec.slice(5))) {
|
|
3429
|
+
res.saveSpec = `file:${path.relative(where, resolvedPath)}`;
|
|
3430
|
+
} else {
|
|
3431
|
+
res.saveSpec = `file:${path.resolve(resolvedPath)}`;
|
|
3432
|
+
}
|
|
3433
|
+
res.fetchSpec = path.resolve(where, resolvedPath);
|
|
3434
|
+
res.saveSpec = res.saveSpec.split("\\").join("/");
|
|
3435
|
+
if (res.saveSpec.startsWith("file://")) {
|
|
3436
|
+
res.saveSpec = `file:/${res.saveSpec.slice(7)}`;
|
|
3437
|
+
}
|
|
3438
|
+
return res;
|
|
3439
|
+
}
|
|
3440
|
+
function fromHostedGit(res, hosted) {
|
|
3441
|
+
res.type = "git";
|
|
3442
|
+
res.hosted = hosted;
|
|
3443
|
+
res.saveSpec = hosted.toString({ noGitPlus: false, noCommittish: false });
|
|
3444
|
+
res.fetchSpec = hosted.getDefaultRepresentation() === "shortcut" ? null : hosted.toString();
|
|
3445
|
+
setGitAttrs(res, hosted.committish);
|
|
3446
|
+
return res;
|
|
3447
|
+
}
|
|
3448
|
+
function unsupportedURLType(protocol, spec) {
|
|
3449
|
+
const err = new Error(`Unsupported URL Type "${protocol}": ${spec}`);
|
|
3450
|
+
err.code = "EUNSUPPORTEDPROTOCOL";
|
|
3451
|
+
return err;
|
|
3452
|
+
}
|
|
3453
|
+
function fromURL(res) {
|
|
3454
|
+
let rawSpec = res.rawSpec;
|
|
3455
|
+
res.saveSpec = rawSpec;
|
|
3456
|
+
if (rawSpec.startsWith("git+ssh:")) {
|
|
3457
|
+
const matched = rawSpec.match(/^git\+ssh:\/\/([^:#]+:[^#]+(?:\.git)?)(?:#(.*))?$/i);
|
|
3458
|
+
if (matched && !matched[1].match(isPortNumber)) {
|
|
3459
|
+
res.type = "git";
|
|
3460
|
+
setGitAttrs(res, matched[2]);
|
|
3461
|
+
res.fetchSpec = matched[1];
|
|
3462
|
+
return res;
|
|
3463
|
+
}
|
|
3464
|
+
} else if (rawSpec.startsWith("git+file://")) {
|
|
3465
|
+
rawSpec = rawSpec.replace(/\\/g, "/");
|
|
3466
|
+
}
|
|
3467
|
+
const parsedUrl = new URL2(rawSpec);
|
|
3468
|
+
switch (parsedUrl.protocol) {
|
|
3469
|
+
case "git:":
|
|
3470
|
+
case "git+http:":
|
|
3471
|
+
case "git+https:":
|
|
3472
|
+
case "git+rsync:":
|
|
3473
|
+
case "git+ftp:":
|
|
3474
|
+
case "git+file:":
|
|
3475
|
+
case "git+ssh:":
|
|
3476
|
+
res.type = "git";
|
|
3477
|
+
setGitAttrs(res, parsedUrl.hash.slice(1));
|
|
3478
|
+
if (parsedUrl.protocol === "git+file:" && /^git\+file:\/\/[a-z]:/i.test(rawSpec)) {
|
|
3479
|
+
res.fetchSpec = `git+file://${parsedUrl.host.toLowerCase()}:${parsedUrl.pathname}`;
|
|
3480
|
+
} else {
|
|
3481
|
+
parsedUrl.hash = "";
|
|
3482
|
+
res.fetchSpec = parsedUrl.toString();
|
|
3483
|
+
}
|
|
3484
|
+
if (res.fetchSpec.startsWith("git+")) {
|
|
3485
|
+
res.fetchSpec = res.fetchSpec.slice(4);
|
|
3486
|
+
}
|
|
3487
|
+
break;
|
|
3488
|
+
case "http:":
|
|
3489
|
+
case "https:":
|
|
3490
|
+
res.type = "remote";
|
|
3491
|
+
res.fetchSpec = res.saveSpec;
|
|
3492
|
+
break;
|
|
3493
|
+
default:
|
|
3494
|
+
throw unsupportedURLType(parsedUrl.protocol, rawSpec);
|
|
3495
|
+
}
|
|
3496
|
+
return res;
|
|
3497
|
+
}
|
|
3498
|
+
function fromAlias(res, where) {
|
|
3499
|
+
const subSpec = npa(res.rawSpec.substr(4), where);
|
|
3500
|
+
if (subSpec.type === "alias") {
|
|
3501
|
+
throw new Error("nested aliases not supported");
|
|
3502
|
+
}
|
|
3503
|
+
if (!subSpec.registry) {
|
|
3504
|
+
throw new Error("aliases only work for registry deps");
|
|
3505
|
+
}
|
|
3506
|
+
if (!subSpec.name) {
|
|
3507
|
+
throw new Error("aliases must have a name");
|
|
3508
|
+
}
|
|
3509
|
+
res.subSpec = subSpec;
|
|
3510
|
+
res.registry = true;
|
|
3511
|
+
res.type = "alias";
|
|
3512
|
+
res.saveSpec = null;
|
|
3513
|
+
res.fetchSpec = null;
|
|
3514
|
+
return res;
|
|
3515
|
+
}
|
|
3516
|
+
function fromRegistry(res) {
|
|
3517
|
+
res.registry = true;
|
|
3518
|
+
const spec = res.rawSpec.trim();
|
|
3519
|
+
res.saveSpec = null;
|
|
3520
|
+
res.fetchSpec = spec;
|
|
3521
|
+
const version = semver.valid(spec, true);
|
|
3522
|
+
const range = semver.validRange(spec, true);
|
|
3523
|
+
if (version) {
|
|
3524
|
+
res.type = "version";
|
|
3525
|
+
} else if (range) {
|
|
3526
|
+
res.type = "range";
|
|
3527
|
+
} else {
|
|
3528
|
+
if (encodeURIComponent(spec) !== spec) {
|
|
3529
|
+
throw invalidTagName(spec, res.raw);
|
|
3530
|
+
}
|
|
3531
|
+
res.type = "tag";
|
|
3532
|
+
}
|
|
3533
|
+
return res;
|
|
3534
|
+
}
|
|
3535
|
+
module.exports = npa;
|
|
3536
|
+
module.exports.resolve = resolve;
|
|
3537
|
+
module.exports.toPurl = toPurl;
|
|
3538
|
+
module.exports.Result = Result;
|
|
3539
|
+
});
|
|
3540
|
+
|
|
3541
|
+
// ../wp-typia-project-tools/src/runtime/create-template-validation.ts
|
|
3542
|
+
import path2 from "path";
|
|
3543
|
+
|
|
3544
|
+
// ../wp-typia-project-tools/src/runtime/template-source-locators.ts
|
|
3545
|
+
var import_npm_package_arg = __toESM(require_npa(), 1);
|
|
3546
|
+
import path from "path";
|
|
3547
|
+
function isTemplatePathLocator(templateId) {
|
|
3548
|
+
return path.isAbsolute(templateId) || templateId.startsWith("./") || templateId.startsWith("../");
|
|
3549
|
+
}
|
|
3550
|
+
function parseGitHubTemplateLocator(templateId) {
|
|
3551
|
+
if (!templateId.startsWith("github:")) {
|
|
3552
|
+
return null;
|
|
3553
|
+
}
|
|
3554
|
+
const [locatorBody, refSegment] = templateId.slice("github:".length).split("#", 2);
|
|
3555
|
+
const segments = locatorBody.split("/").filter(Boolean);
|
|
3556
|
+
if (segments.length < 3) {
|
|
3557
|
+
throw new Error(`GitHub template locators must look like github:owner/repo/path[#ref]. Received: ${templateId}`);
|
|
3558
|
+
}
|
|
3559
|
+
const [owner, repo, ...sourcePathSegments] = segments;
|
|
3560
|
+
return {
|
|
3561
|
+
owner,
|
|
3562
|
+
repo,
|
|
3563
|
+
ref: refSegment ?? null,
|
|
3564
|
+
sourcePath: sourcePathSegments.join("/")
|
|
3565
|
+
};
|
|
3566
|
+
}
|
|
3567
|
+
function parseNpmTemplateLocator(templateId) {
|
|
3568
|
+
if (isBuiltInTemplateId(templateId) || isTemplatePathLocator(templateId) || templateId.startsWith("github:")) {
|
|
3569
|
+
return null;
|
|
3570
|
+
}
|
|
3571
|
+
try {
|
|
3572
|
+
const parsed = import_npm_package_arg.default(templateId);
|
|
3573
|
+
if (!parsed.registry || !parsed.name) {
|
|
3574
|
+
return null;
|
|
3575
|
+
}
|
|
3576
|
+
const parsedWithRawSpec = parsed;
|
|
3577
|
+
const rawSpec = typeof parsedWithRawSpec.rawSpec === "string" ? parsedWithRawSpec.rawSpec : "";
|
|
3578
|
+
return {
|
|
3579
|
+
fetchSpec: typeof parsed.fetchSpec === "string" ? parsed.fetchSpec : "",
|
|
3580
|
+
name: parsed.name,
|
|
3581
|
+
raw: templateId,
|
|
3582
|
+
rawSpec,
|
|
3583
|
+
type: parsed.type
|
|
3584
|
+
};
|
|
3585
|
+
} catch {
|
|
3586
|
+
return null;
|
|
3587
|
+
}
|
|
3588
|
+
}
|
|
3589
|
+
function parseTemplateLocator(templateId) {
|
|
3590
|
+
if (isRemovedBuiltInTemplateId(templateId)) {
|
|
3591
|
+
throw new Error(getRemovedBuiltInTemplateMessage(templateId));
|
|
3592
|
+
}
|
|
3593
|
+
const githubLocator = parseGitHubTemplateLocator(templateId);
|
|
3594
|
+
if (githubLocator) {
|
|
3595
|
+
return { kind: "github", locator: githubLocator };
|
|
3596
|
+
}
|
|
3597
|
+
if (isTemplatePathLocator(templateId)) {
|
|
3598
|
+
return { kind: "path", templatePath: templateId };
|
|
3599
|
+
}
|
|
3600
|
+
const npmLocator = parseNpmTemplateLocator(templateId);
|
|
3601
|
+
if (npmLocator) {
|
|
3602
|
+
return { kind: "npm", locator: npmLocator };
|
|
3603
|
+
}
|
|
3604
|
+
throw new Error(`Unknown template "${templateId}". Expected one of: ${BUILTIN_TEMPLATE_IDS.join(", ")}, a local path, github:owner/repo/path[#ref], or an npm package spec.`);
|
|
3605
|
+
}
|
|
3606
|
+
|
|
3607
|
+
// ../wp-typia-project-tools/src/runtime/create-template-validation.ts
|
|
3608
|
+
var CREATE_TEMPLATE_SELECTION_HINT = `--template <${[
|
|
3609
|
+
...TEMPLATE_IDS,
|
|
3610
|
+
OFFICIAL_WORKSPACE_TEMPLATE_ALIAS
|
|
3611
|
+
].join("|")}|./path|github:owner/repo/path[#ref]|npm-package>`;
|
|
3612
|
+
var TEMPLATE_SUGGESTION_IDS = [
|
|
3613
|
+
...TEMPLATE_IDS,
|
|
3614
|
+
OFFICIAL_WORKSPACE_TEMPLATE_ALIAS
|
|
3615
|
+
];
|
|
3616
|
+
var USER_FACING_TEMPLATE_IDS = [
|
|
3617
|
+
...TEMPLATE_IDS,
|
|
3618
|
+
OFFICIAL_WORKSPACE_TEMPLATE_ALIAS
|
|
3619
|
+
];
|
|
3620
|
+
function normalizeCreateTemplateSelection(templateId) {
|
|
3621
|
+
return templateId === OFFICIAL_WORKSPACE_TEMPLATE_ALIAS ? OFFICIAL_WORKSPACE_TEMPLATE_PACKAGE : templateId;
|
|
3622
|
+
}
|
|
3623
|
+
function looksLikeWindowsAbsoluteTemplatePath(templateId) {
|
|
3624
|
+
return /^[a-z]:[\\/]/iu.test(templateId) || /^\\\\[^\\]+\\[^\\]+/u.test(templateId);
|
|
3625
|
+
}
|
|
3626
|
+
function looksLikeExplicitNonNpmExternalTemplateLocator(templateId) {
|
|
3627
|
+
return path2.isAbsolute(templateId) || looksLikeWindowsAbsoluteTemplatePath(templateId) || templateId.startsWith("./") || templateId.startsWith(".\\") || templateId.startsWith("../") || templateId.startsWith("..\\") || templateId.startsWith("@") || templateId.startsWith("github:") || templateId.includes("/") || templateId.includes("\\");
|
|
3628
|
+
}
|
|
3629
|
+
function looksLikeExplicitCreateExternalTemplateLocator(templateId) {
|
|
3630
|
+
return looksLikeExplicitNonNpmExternalTemplateLocator(templateId) || parseNpmTemplateLocator(templateId) !== null;
|
|
3631
|
+
}
|
|
3632
|
+
function getEditDistance(left, right) {
|
|
3633
|
+
const previous = Array.from({ length: right.length + 1 }, (_, index) => index);
|
|
3634
|
+
const current = new Array(right.length + 1);
|
|
3635
|
+
for (let leftIndex = 0;leftIndex < left.length; leftIndex += 1) {
|
|
3636
|
+
current[0] = leftIndex + 1;
|
|
3637
|
+
for (let rightIndex = 0;rightIndex < right.length; rightIndex += 1) {
|
|
3638
|
+
const substitutionCost = left[leftIndex] === right[rightIndex] ? 0 : 1;
|
|
3639
|
+
current[rightIndex + 1] = Math.min(current[rightIndex] + 1, previous[rightIndex + 1] + 1, previous[rightIndex] + substitutionCost);
|
|
3640
|
+
}
|
|
3641
|
+
for (let index = 0;index < current.length; index += 1) {
|
|
3642
|
+
previous[index] = current[index];
|
|
3643
|
+
}
|
|
3644
|
+
}
|
|
3645
|
+
return previous[right.length];
|
|
3646
|
+
}
|
|
3647
|
+
function findMistypedBuiltInTemplateSuggestion(templateId) {
|
|
3648
|
+
const normalizedTemplateId = templateId.trim().toLowerCase();
|
|
3649
|
+
if (normalizedTemplateId.length === 0 || looksLikeExplicitNonNpmExternalTemplateLocator(normalizedTemplateId)) {
|
|
3650
|
+
return null;
|
|
3651
|
+
}
|
|
3652
|
+
let bestCandidate = null;
|
|
3653
|
+
for (const candidateId of TEMPLATE_SUGGESTION_IDS) {
|
|
3654
|
+
const distance = getEditDistance(normalizedTemplateId, candidateId);
|
|
3655
|
+
if (bestCandidate === null || distance < bestCandidate.distance) {
|
|
3656
|
+
bestCandidate = {
|
|
3657
|
+
distance,
|
|
3658
|
+
id: candidateId
|
|
3659
|
+
};
|
|
3660
|
+
}
|
|
3661
|
+
}
|
|
3662
|
+
return bestCandidate && bestCandidate.distance <= 2 ? bestCandidate.id : null;
|
|
3663
|
+
}
|
|
3664
|
+
function getMistypedBuiltInTemplateMessage(templateId) {
|
|
3665
|
+
const suggestion = findMistypedBuiltInTemplateSuggestion(templateId);
|
|
3666
|
+
if (!suggestion) {
|
|
3667
|
+
return null;
|
|
3668
|
+
}
|
|
3669
|
+
const suggestionDescription = suggestion === OFFICIAL_WORKSPACE_TEMPLATE_ALIAS ? "official workspace scaffold" : "built-in scaffold";
|
|
3670
|
+
return `Unknown template "${templateId}". Did you mean "${suggestion}"? Use \`--template ${suggestion}\` for the ${suggestionDescription}, or pass a local path, \`github:owner/repo/path[#ref]\`, or an npm package spec for an external template.`;
|
|
3671
|
+
}
|
|
3672
|
+
function getUnknownTemplateMessage(templateId) {
|
|
3673
|
+
return [
|
|
3674
|
+
`Unknown template "${templateId}". Expected one of: ${USER_FACING_TEMPLATE_IDS.join(", ")}.`,
|
|
3675
|
+
"Run `wp-typia templates list` to inspect available templates.",
|
|
3676
|
+
"Pass an explicit external template locator such as `./path`, `github:owner/repo/path[#ref]`, or `@scope/template` for custom templates."
|
|
3677
|
+
].join(" ");
|
|
3678
|
+
}
|
|
3679
|
+
function validateExplicitCreateTemplateId(templateId) {
|
|
3680
|
+
const normalizedTemplateId = normalizeCreateTemplateSelection(templateId);
|
|
3681
|
+
if (isRemovedBuiltInTemplateId(templateId)) {
|
|
3682
|
+
throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.UNKNOWN_TEMPLATE, getRemovedBuiltInTemplateMessage(templateId));
|
|
3683
|
+
}
|
|
3684
|
+
if (normalizedTemplateId === OFFICIAL_WORKSPACE_TEMPLATE_PACKAGE) {
|
|
3685
|
+
return normalizedTemplateId;
|
|
3686
|
+
}
|
|
3687
|
+
if (isBuiltInTemplateId(normalizedTemplateId)) {
|
|
3688
|
+
return getTemplateById(normalizedTemplateId).id;
|
|
3689
|
+
}
|
|
3690
|
+
const mistypedBuiltInTemplateMessage = getMistypedBuiltInTemplateMessage(templateId);
|
|
3691
|
+
if (mistypedBuiltInTemplateMessage) {
|
|
3692
|
+
throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.UNKNOWN_TEMPLATE, mistypedBuiltInTemplateMessage);
|
|
3693
|
+
}
|
|
3694
|
+
if (!looksLikeExplicitCreateExternalTemplateLocator(normalizedTemplateId)) {
|
|
3695
|
+
throw createCliDiagnosticCodeError(CLI_DIAGNOSTIC_CODES.UNKNOWN_TEMPLATE, getUnknownTemplateMessage(templateId));
|
|
3696
|
+
}
|
|
3697
|
+
return normalizedTemplateId;
|
|
3698
|
+
}
|
|
3699
|
+
|
|
3700
|
+
export { require_semver2 as require_semver, parseTemplateLocator, CREATE_TEMPLATE_SELECTION_HINT, validateExplicitCreateTemplateId };
|
|
3701
|
+
|
|
3702
|
+
//# debugId=BE9DD1EB4BD209FD64756E2164756E21
|