@platforma-sdk/block-tools 2.5.51 → 2.5.52
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/cli.js +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/config-DrI3vxIZ.mjs +1935 -0
- package/dist/{config-DH2Xu4Iw.mjs.map → config-DrI3vxIZ.mjs.map} +1 -1
- package/dist/config-NXo7pge0.js +3 -0
- package/dist/{config-Djqeluth.js.map → config-NXo7pge0.js.map} +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -9
- package/dist/config-DH2Xu4Iw.mjs +0 -1719
- package/dist/config-Djqeluth.js +0 -3
|
@@ -0,0 +1,1935 @@
|
|
|
1
|
+
var as = Object.defineProperty;
|
|
2
|
+
var os = (t, e, r) => e in t ? as(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
|
|
3
|
+
var re = (t, e, r) => os(t, typeof e != "symbol" ? e + "" : e, r);
|
|
4
|
+
import { BlockPackMeta as M, ContentAbsoluteTextLocal as Nt, ContentAbsoluteBinaryLocal as ce, BlockPackMetaEmbeddedBase64 as cs, BlockPackMetaEmbeddedBytes as Gr, DescriptionContentText as ls, DescriptionContentBinary as us, ContentRelativeText as Z, ContentRelativeBinary as Q, BlockComponents as le, ContentAbsoluteFolder as fs, BlockComponentsManifest as ue, ContentRelative as ae, mapRemoteToAbsolute as jt, addPrefixToRelative as hs, BlockPackDescriptionManifest as X, CreateBlockPackDescriptionSchema as J, BlockPackManifest as xr, BlockPackManifestFile as ps, SemVer as kt, BlockPackDescriptionFromPackageJsonRaw as Ur, Sha256Schema as Rt, BlockPackIdNoVersion as ds, VersionWithChannels as gs, AnyChannel as oe, blockPackIdToString as ye } from "@milaboratories/pl-model-middle-layer";
|
|
5
|
+
import { z as L } from "zod";
|
|
6
|
+
import B from "node:path";
|
|
7
|
+
import V from "node:fs/promises";
|
|
8
|
+
import * as fe from "mime-types";
|
|
9
|
+
import * as ms from "tar";
|
|
10
|
+
import { tryResolve as Vr } from "@milaboratories/resolve-helper";
|
|
11
|
+
import { notEmpty as Mr, ConsoleLoggerAdapter as Es } from "@milaboratories/ts-helpers";
|
|
12
|
+
import { randomUUID as zr } from "node:crypto";
|
|
13
|
+
import vs from "yaml";
|
|
14
|
+
import * as Gt from "node:os";
|
|
15
|
+
import U from "node:path/posix";
|
|
16
|
+
import { S3 as $s, paginateListObjectsV2 as Rs } from "@aws-sdk/client-s3";
|
|
17
|
+
import * as K from "node:fs";
|
|
18
|
+
function ws(t) {
|
|
19
|
+
return L.string().transform((e, r) => {
|
|
20
|
+
const n = Vr(t, e);
|
|
21
|
+
return n === void 0 ? (r.addIssue({
|
|
22
|
+
code: L.ZodIssueCode.custom,
|
|
23
|
+
message: `Can't resolve ${e} against ${t}`
|
|
24
|
+
}), L.NEVER) : {
|
|
25
|
+
type: "absolute-file",
|
|
26
|
+
file: n
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
function Ss(t, ...e) {
|
|
31
|
+
return L.string().transform((r, n) => {
|
|
32
|
+
const a = r.endsWith("/") ? r : `${r}/`;
|
|
33
|
+
for (const l of e) {
|
|
34
|
+
const c = Vr(t, a + l);
|
|
35
|
+
if (c !== void 0) {
|
|
36
|
+
if (!c.endsWith(l))
|
|
37
|
+
throw new Error(`Unexpected resolve result ${c} with index file ${l}`);
|
|
38
|
+
return {
|
|
39
|
+
type: "absolute-folder",
|
|
40
|
+
folder: c.slice(0, c.length - l.length)
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return n.addIssue({
|
|
45
|
+
code: L.ZodIssueCode.custom,
|
|
46
|
+
message: `Can't resolve ${r} folder against ${t}, no index file found (${e.join(", ")})`
|
|
47
|
+
}), L.NEVER;
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
function xt(t) {
|
|
51
|
+
return (e) => e.type === "relative" ? { type: "absolute-file", file: B.resolve(t, e.path) } : e;
|
|
52
|
+
}
|
|
53
|
+
function Xr() {
|
|
54
|
+
return async (t) => t.type === "absolute-file" ? await V.readFile(t.file, { encoding: "utf-8" }) : t.content;
|
|
55
|
+
}
|
|
56
|
+
function ys() {
|
|
57
|
+
return async (t) => {
|
|
58
|
+
if (t.type === "absolute-file") {
|
|
59
|
+
const e = fe.lookup(t.file);
|
|
60
|
+
if (!e) throw new Error(`Can't recognize mime type of the file: ${t.file}.`);
|
|
61
|
+
return {
|
|
62
|
+
type: "explicit-base64",
|
|
63
|
+
mimeType: e,
|
|
64
|
+
content: await V.readFile(t.file, { encoding: "base64" })
|
|
65
|
+
};
|
|
66
|
+
} else return t;
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
function Is() {
|
|
70
|
+
return async (t) => {
|
|
71
|
+
if (t.type === "absolute-file") {
|
|
72
|
+
const e = fe.lookup(t.file);
|
|
73
|
+
if (!e) throw new Error(`Can't recognize mime type of the file: ${t.file}.`);
|
|
74
|
+
return {
|
|
75
|
+
type: "explicit-bytes",
|
|
76
|
+
mimeType: e,
|
|
77
|
+
content: Buffer.from(await V.readFile(t.file))
|
|
78
|
+
};
|
|
79
|
+
} else return t.type === "explicit-base64" ? {
|
|
80
|
+
type: "explicit-bytes",
|
|
81
|
+
mimeType: t.mimeType,
|
|
82
|
+
content: Buffer.from(t.content, "base64")
|
|
83
|
+
} : t;
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
function wt(t, e) {
|
|
87
|
+
return async (r) => {
|
|
88
|
+
if (r.type === "absolute-file") {
|
|
89
|
+
const n = B.basename(r.file), a = B.resolve(t, n);
|
|
90
|
+
return e == null || e.push(n), await V.cp(r.file, a), { type: "relative", path: n };
|
|
91
|
+
} else return r;
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
function Os(t, e, r) {
|
|
95
|
+
if (!e.endsWith(".tgz")) throw new Error(`Unexpected tgz file name: ${e}`);
|
|
96
|
+
return async (n) => {
|
|
97
|
+
const a = B.resolve(t, e);
|
|
98
|
+
return await ms.create(
|
|
99
|
+
{
|
|
100
|
+
gzip: !0,
|
|
101
|
+
file: a,
|
|
102
|
+
cwd: n.folder
|
|
103
|
+
},
|
|
104
|
+
["."]
|
|
105
|
+
), r == null || r.push(e), { type: "relative", path: e };
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
function Lt(t) {
|
|
109
|
+
return async (e) => e.type === "explicit-string" ? e : { type: "explicit-string", content: (await t(e.path)).toString("utf8") };
|
|
110
|
+
}
|
|
111
|
+
function Ps(t) {
|
|
112
|
+
return async (e) => e.type === "explicit-string" ? e.content : (await t(e.path)).toString("utf8");
|
|
113
|
+
}
|
|
114
|
+
function Vn(t) {
|
|
115
|
+
return async (e) => {
|
|
116
|
+
if (e.type === "explicit-base64") return e;
|
|
117
|
+
const r = fe.lookup(e.path);
|
|
118
|
+
if (!r) throw new Error(`Can't recognize mime type of the file: ${e.path}.`);
|
|
119
|
+
return {
|
|
120
|
+
type: "explicit-base64",
|
|
121
|
+
mimeType: r,
|
|
122
|
+
content: (await t(e.path)).toString("base64")
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
function he(t) {
|
|
127
|
+
return async (e) => {
|
|
128
|
+
if (e.type === "explicit-base64")
|
|
129
|
+
return {
|
|
130
|
+
type: "explicit-bytes",
|
|
131
|
+
mimeType: e.mimeType,
|
|
132
|
+
content: Buffer.from(e.content, "base64")
|
|
133
|
+
};
|
|
134
|
+
const r = fe.lookup(e.path);
|
|
135
|
+
if (!r) throw new Error(`Can't recognize mime type of the file: ${e.path}.`);
|
|
136
|
+
return {
|
|
137
|
+
type: "explicit-bytes",
|
|
138
|
+
mimeType: r,
|
|
139
|
+
content: await t(e.path)
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
function Ns(t) {
|
|
144
|
+
return M(
|
|
145
|
+
ls.transform(xt(t)),
|
|
146
|
+
us.transform(xt(t))
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
function ks(t, e) {
|
|
150
|
+
return M(
|
|
151
|
+
Nt.transform(wt(t, e)),
|
|
152
|
+
ce.transform(wt(t, e))
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
const Mn = M(
|
|
156
|
+
Nt.transform(Xr()),
|
|
157
|
+
ce.transform(ys())
|
|
158
|
+
).pipe(cs), zn = M(
|
|
159
|
+
Nt.transform(Xr()),
|
|
160
|
+
ce.transform(Is())
|
|
161
|
+
).pipe(Gr);
|
|
162
|
+
function Xn(t) {
|
|
163
|
+
return M(
|
|
164
|
+
Z.transform(Ps(t)),
|
|
165
|
+
Q.transform(he(t))
|
|
166
|
+
).pipe(Gr);
|
|
167
|
+
}
|
|
168
|
+
function Ls(t) {
|
|
169
|
+
return le(
|
|
170
|
+
ws(t),
|
|
171
|
+
Ss(t, "index.html")
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
function Cs(t, e) {
|
|
175
|
+
return le(
|
|
176
|
+
ce.transform(wt(t, e)),
|
|
177
|
+
fs.transform(Os(t, "ui.tgz", e))
|
|
178
|
+
).pipe(ue);
|
|
179
|
+
}
|
|
180
|
+
function Jn(t) {
|
|
181
|
+
return le(
|
|
182
|
+
ae.transform(jt(t)),
|
|
183
|
+
ae.transform(jt(t))
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
function Jr(t) {
|
|
187
|
+
return J(
|
|
188
|
+
Ls(t),
|
|
189
|
+
Ns(t)
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
function Ts(t, e) {
|
|
193
|
+
return J(
|
|
194
|
+
Cs(t, e),
|
|
195
|
+
ks(t, e)
|
|
196
|
+
).pipe(X);
|
|
197
|
+
}
|
|
198
|
+
function Ut(t) {
|
|
199
|
+
const e = hs(t);
|
|
200
|
+
return X.pipe(
|
|
201
|
+
J(
|
|
202
|
+
le(
|
|
203
|
+
ae.transform(e),
|
|
204
|
+
ae.transform(e)
|
|
205
|
+
),
|
|
206
|
+
M(
|
|
207
|
+
Z.transform(e),
|
|
208
|
+
Q.transform(e)
|
|
209
|
+
)
|
|
210
|
+
)
|
|
211
|
+
).pipe(X);
|
|
212
|
+
}
|
|
213
|
+
async function Ct(t, e) {
|
|
214
|
+
try {
|
|
215
|
+
return e(await V.readFile(t));
|
|
216
|
+
} catch (r) {
|
|
217
|
+
if (r.code == "ENOENT") return;
|
|
218
|
+
throw new Error("", { cause: r });
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
async function St(t) {
|
|
222
|
+
return Buffer.from(await crypto.subtle.digest("sha-256", t)).toString("hex").toUpperCase();
|
|
223
|
+
}
|
|
224
|
+
async function Wn(t, e) {
|
|
225
|
+
await V.mkdir(e, { recursive: !0 });
|
|
226
|
+
const r = [], n = await Ts(e, r).parseAsync(t), a = await Promise.all(
|
|
227
|
+
r.map(async (c) => {
|
|
228
|
+
const d = await V.readFile(B.resolve(e, c)), i = await St(d);
|
|
229
|
+
return { name: c, size: d.length, sha256: i };
|
|
230
|
+
})
|
|
231
|
+
), l = xr.parse({
|
|
232
|
+
schema: "v2",
|
|
233
|
+
description: n,
|
|
234
|
+
files: a,
|
|
235
|
+
timestamp: Date.now()
|
|
236
|
+
});
|
|
237
|
+
return await V.writeFile(B.resolve(e, ps), JSON.stringify(l)), l;
|
|
238
|
+
}
|
|
239
|
+
const yt = "block", As = /(?:@[a-zA-Z0-9-.]+\/)?(?<organization>[a-zA-Z0-9-]+)\.(?<name>[a-zA-Z0-9-]+)/;
|
|
240
|
+
function Wr(t) {
|
|
241
|
+
const e = t.match(As);
|
|
242
|
+
if (!e)
|
|
243
|
+
throw new Error(
|
|
244
|
+
`Malformed package name (${t}), can't infer organization and block pack name.`
|
|
245
|
+
);
|
|
246
|
+
const { name: r, organization: n } = e.groups;
|
|
247
|
+
return { name: r, organization: n };
|
|
248
|
+
}
|
|
249
|
+
async function Hn(t, e) {
|
|
250
|
+
const r = B.resolve(t, "package.json");
|
|
251
|
+
try {
|
|
252
|
+
const n = await Ct(
|
|
253
|
+
r,
|
|
254
|
+
(d) => JSON.parse(d.toString("utf-8"))
|
|
255
|
+
);
|
|
256
|
+
if (n === void 0) return;
|
|
257
|
+
const a = n[yt];
|
|
258
|
+
if (a === void 0) return;
|
|
259
|
+
const l = {
|
|
260
|
+
...Ur.parse(a),
|
|
261
|
+
id: {
|
|
262
|
+
...Wr(
|
|
263
|
+
Mr(n.name, `"name" not found in ${r}`)
|
|
264
|
+
),
|
|
265
|
+
version: kt.parse(n.version)
|
|
266
|
+
}
|
|
267
|
+
}, c = await Jr(t).safeParseAsync(l);
|
|
268
|
+
if (c.success) return c.data;
|
|
269
|
+
e == null || e.warn(c.error);
|
|
270
|
+
return;
|
|
271
|
+
} catch (n) {
|
|
272
|
+
e == null || e.warn(n);
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
async function Fs(t) {
|
|
277
|
+
const e = B.resolve(t, "package.json"), r = JSON.parse(await V.readFile(e, { encoding: "utf-8" })), n = r[yt];
|
|
278
|
+
if (n === void 0)
|
|
279
|
+
throw new Error(
|
|
280
|
+
`Block description (field ${yt}) not found in ${e}.`
|
|
281
|
+
);
|
|
282
|
+
return {
|
|
283
|
+
...Ur.parse(n),
|
|
284
|
+
id: {
|
|
285
|
+
...Wr(
|
|
286
|
+
Mr(r.name, `"name" not found in ${e}`)
|
|
287
|
+
),
|
|
288
|
+
version: kt.parse(r.version)
|
|
289
|
+
}
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
async function Yn(t) {
|
|
293
|
+
const e = await Fs(t);
|
|
294
|
+
return await Jr(t).parseAsync(e);
|
|
295
|
+
}
|
|
296
|
+
function bs(t) {
|
|
297
|
+
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
298
|
+
}
|
|
299
|
+
var se = { exports: {} }, Ie, Vt;
|
|
300
|
+
function pe() {
|
|
301
|
+
if (Vt) return Ie;
|
|
302
|
+
Vt = 1;
|
|
303
|
+
const t = "2.0.0", e = 256, r = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */
|
|
304
|
+
9007199254740991, n = 16, a = e - 6;
|
|
305
|
+
return Ie = {
|
|
306
|
+
MAX_LENGTH: e,
|
|
307
|
+
MAX_SAFE_COMPONENT_LENGTH: n,
|
|
308
|
+
MAX_SAFE_BUILD_LENGTH: a,
|
|
309
|
+
MAX_SAFE_INTEGER: r,
|
|
310
|
+
RELEASE_TYPES: [
|
|
311
|
+
"major",
|
|
312
|
+
"premajor",
|
|
313
|
+
"minor",
|
|
314
|
+
"preminor",
|
|
315
|
+
"patch",
|
|
316
|
+
"prepatch",
|
|
317
|
+
"prerelease"
|
|
318
|
+
],
|
|
319
|
+
SEMVER_SPEC_VERSION: t,
|
|
320
|
+
FLAG_INCLUDE_PRERELEASE: 1,
|
|
321
|
+
FLAG_LOOSE: 2
|
|
322
|
+
}, Ie;
|
|
323
|
+
}
|
|
324
|
+
var Oe, Mt;
|
|
325
|
+
function de() {
|
|
326
|
+
return Mt || (Mt = 1, Oe = typeof process == "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...e) => console.error("SEMVER", ...e) : () => {
|
|
327
|
+
}), Oe;
|
|
328
|
+
}
|
|
329
|
+
var zt;
|
|
330
|
+
function ee() {
|
|
331
|
+
return zt || (zt = 1, function(t, e) {
|
|
332
|
+
const {
|
|
333
|
+
MAX_SAFE_COMPONENT_LENGTH: r,
|
|
334
|
+
MAX_SAFE_BUILD_LENGTH: n,
|
|
335
|
+
MAX_LENGTH: a
|
|
336
|
+
} = pe(), l = de();
|
|
337
|
+
e = t.exports = {};
|
|
338
|
+
const c = e.re = [], d = e.safeRe = [], i = e.src = [], f = e.safeSrc = [], s = e.t = {};
|
|
339
|
+
let o = 0;
|
|
340
|
+
const u = "[a-zA-Z0-9-]", h = [
|
|
341
|
+
["\\s", 1],
|
|
342
|
+
["\\d", a],
|
|
343
|
+
[u, n]
|
|
344
|
+
], m = (v) => {
|
|
345
|
+
for (const [$, N] of h)
|
|
346
|
+
v = v.split(`${$}*`).join(`${$}{0,${N}}`).split(`${$}+`).join(`${$}{1,${N}}`);
|
|
347
|
+
return v;
|
|
348
|
+
}, p = (v, $, N) => {
|
|
349
|
+
const I = m($), F = o++;
|
|
350
|
+
l(v, F, $), s[v] = F, i[F] = $, f[F] = I, c[F] = new RegExp($, N ? "g" : void 0), d[F] = new RegExp(I, N ? "g" : void 0);
|
|
351
|
+
};
|
|
352
|
+
p("NUMERICIDENTIFIER", "0|[1-9]\\d*"), p("NUMERICIDENTIFIERLOOSE", "\\d+"), p("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${u}*`), p("MAINVERSION", `(${i[s.NUMERICIDENTIFIER]})\\.(${i[s.NUMERICIDENTIFIER]})\\.(${i[s.NUMERICIDENTIFIER]})`), p("MAINVERSIONLOOSE", `(${i[s.NUMERICIDENTIFIERLOOSE]})\\.(${i[s.NUMERICIDENTIFIERLOOSE]})\\.(${i[s.NUMERICIDENTIFIERLOOSE]})`), p("PRERELEASEIDENTIFIER", `(?:${i[s.NUMERICIDENTIFIER]}|${i[s.NONNUMERICIDENTIFIER]})`), p("PRERELEASEIDENTIFIERLOOSE", `(?:${i[s.NUMERICIDENTIFIERLOOSE]}|${i[s.NONNUMERICIDENTIFIER]})`), p("PRERELEASE", `(?:-(${i[s.PRERELEASEIDENTIFIER]}(?:\\.${i[s.PRERELEASEIDENTIFIER]})*))`), p("PRERELEASELOOSE", `(?:-?(${i[s.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${i[s.PRERELEASEIDENTIFIERLOOSE]})*))`), p("BUILDIDENTIFIER", `${u}+`), p("BUILD", `(?:\\+(${i[s.BUILDIDENTIFIER]}(?:\\.${i[s.BUILDIDENTIFIER]})*))`), p("FULLPLAIN", `v?${i[s.MAINVERSION]}${i[s.PRERELEASE]}?${i[s.BUILD]}?`), p("FULL", `^${i[s.FULLPLAIN]}$`), p("LOOSEPLAIN", `[v=\\s]*${i[s.MAINVERSIONLOOSE]}${i[s.PRERELEASELOOSE]}?${i[s.BUILD]}?`), p("LOOSE", `^${i[s.LOOSEPLAIN]}$`), p("GTLT", "((?:<|>)?=?)"), p("XRANGEIDENTIFIERLOOSE", `${i[s.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`), p("XRANGEIDENTIFIER", `${i[s.NUMERICIDENTIFIER]}|x|X|\\*`), p("XRANGEPLAIN", `[v=\\s]*(${i[s.XRANGEIDENTIFIER]})(?:\\.(${i[s.XRANGEIDENTIFIER]})(?:\\.(${i[s.XRANGEIDENTIFIER]})(?:${i[s.PRERELEASE]})?${i[s.BUILD]}?)?)?`), p("XRANGEPLAINLOOSE", `[v=\\s]*(${i[s.XRANGEIDENTIFIERLOOSE]})(?:\\.(${i[s.XRANGEIDENTIFIERLOOSE]})(?:\\.(${i[s.XRANGEIDENTIFIERLOOSE]})(?:${i[s.PRERELEASELOOSE]})?${i[s.BUILD]}?)?)?`), p("XRANGE", `^${i[s.GTLT]}\\s*${i[s.XRANGEPLAIN]}$`), p("XRANGELOOSE", `^${i[s.GTLT]}\\s*${i[s.XRANGEPLAINLOOSE]}$`), p("COERCEPLAIN", `(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?`), p("COERCE", `${i[s.COERCEPLAIN]}(?:$|[^\\d])`), p("COERCEFULL", i[s.COERCEPLAIN] + `(?:${i[s.PRERELEASE]})?(?:${i[s.BUILD]})?(?:$|[^\\d])`), p("COERCERTL", i[s.COERCE], !0), p("COERCERTLFULL", i[s.COERCEFULL], !0), p("LONETILDE", "(?:~>?)"), p("TILDETRIM", `(\\s*)${i[s.LONETILDE]}\\s+`, !0), e.tildeTrimReplace = "$1~", p("TILDE", `^${i[s.LONETILDE]}${i[s.XRANGEPLAIN]}$`), p("TILDELOOSE", `^${i[s.LONETILDE]}${i[s.XRANGEPLAINLOOSE]}$`), p("LONECARET", "(?:\\^)"), p("CARETTRIM", `(\\s*)${i[s.LONECARET]}\\s+`, !0), e.caretTrimReplace = "$1^", p("CARET", `^${i[s.LONECARET]}${i[s.XRANGEPLAIN]}$`), p("CARETLOOSE", `^${i[s.LONECARET]}${i[s.XRANGEPLAINLOOSE]}$`), p("COMPARATORLOOSE", `^${i[s.GTLT]}\\s*(${i[s.LOOSEPLAIN]})$|^$`), p("COMPARATOR", `^${i[s.GTLT]}\\s*(${i[s.FULLPLAIN]})$|^$`), p("COMPARATORTRIM", `(\\s*)${i[s.GTLT]}\\s*(${i[s.LOOSEPLAIN]}|${i[s.XRANGEPLAIN]})`, !0), e.comparatorTrimReplace = "$1$2$3", p("HYPHENRANGE", `^\\s*(${i[s.XRANGEPLAIN]})\\s+-\\s+(${i[s.XRANGEPLAIN]})\\s*$`), p("HYPHENRANGELOOSE", `^\\s*(${i[s.XRANGEPLAINLOOSE]})\\s+-\\s+(${i[s.XRANGEPLAINLOOSE]})\\s*$`), p("STAR", "(<|>)?=?\\s*\\*"), p("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$"), p("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
|
|
353
|
+
}(se, se.exports)), se.exports;
|
|
354
|
+
}
|
|
355
|
+
var Pe, Xt;
|
|
356
|
+
function Tt() {
|
|
357
|
+
if (Xt) return Pe;
|
|
358
|
+
Xt = 1;
|
|
359
|
+
const t = Object.freeze({ loose: !0 }), e = Object.freeze({});
|
|
360
|
+
return Pe = (n) => n ? typeof n != "object" ? t : n : e, Pe;
|
|
361
|
+
}
|
|
362
|
+
var Ne, Jt;
|
|
363
|
+
function Hr() {
|
|
364
|
+
if (Jt) return Ne;
|
|
365
|
+
Jt = 1;
|
|
366
|
+
const t = /^[0-9]+$/, e = (n, a) => {
|
|
367
|
+
const l = t.test(n), c = t.test(a);
|
|
368
|
+
return l && c && (n = +n, a = +a), n === a ? 0 : l && !c ? -1 : c && !l ? 1 : n < a ? -1 : 1;
|
|
369
|
+
};
|
|
370
|
+
return Ne = {
|
|
371
|
+
compareIdentifiers: e,
|
|
372
|
+
rcompareIdentifiers: (n, a) => e(a, n)
|
|
373
|
+
}, Ne;
|
|
374
|
+
}
|
|
375
|
+
var ke, Wt;
|
|
376
|
+
function j() {
|
|
377
|
+
if (Wt) return ke;
|
|
378
|
+
Wt = 1;
|
|
379
|
+
const t = de(), { MAX_LENGTH: e, MAX_SAFE_INTEGER: r } = pe(), { safeRe: n, safeSrc: a, t: l } = ee(), c = Tt(), { compareIdentifiers: d } = Hr();
|
|
380
|
+
class i {
|
|
381
|
+
constructor(s, o) {
|
|
382
|
+
if (o = c(o), s instanceof i) {
|
|
383
|
+
if (s.loose === !!o.loose && s.includePrerelease === !!o.includePrerelease)
|
|
384
|
+
return s;
|
|
385
|
+
s = s.version;
|
|
386
|
+
} else if (typeof s != "string")
|
|
387
|
+
throw new TypeError(`Invalid version. Must be a string. Got type "${typeof s}".`);
|
|
388
|
+
if (s.length > e)
|
|
389
|
+
throw new TypeError(
|
|
390
|
+
`version is longer than ${e} characters`
|
|
391
|
+
);
|
|
392
|
+
t("SemVer", s, o), this.options = o, this.loose = !!o.loose, this.includePrerelease = !!o.includePrerelease;
|
|
393
|
+
const u = s.trim().match(o.loose ? n[l.LOOSE] : n[l.FULL]);
|
|
394
|
+
if (!u)
|
|
395
|
+
throw new TypeError(`Invalid Version: ${s}`);
|
|
396
|
+
if (this.raw = s, this.major = +u[1], this.minor = +u[2], this.patch = +u[3], this.major > r || this.major < 0)
|
|
397
|
+
throw new TypeError("Invalid major version");
|
|
398
|
+
if (this.minor > r || this.minor < 0)
|
|
399
|
+
throw new TypeError("Invalid minor version");
|
|
400
|
+
if (this.patch > r || this.patch < 0)
|
|
401
|
+
throw new TypeError("Invalid patch version");
|
|
402
|
+
u[4] ? this.prerelease = u[4].split(".").map((h) => {
|
|
403
|
+
if (/^[0-9]+$/.test(h)) {
|
|
404
|
+
const m = +h;
|
|
405
|
+
if (m >= 0 && m < r)
|
|
406
|
+
return m;
|
|
407
|
+
}
|
|
408
|
+
return h;
|
|
409
|
+
}) : this.prerelease = [], this.build = u[5] ? u[5].split(".") : [], this.format();
|
|
410
|
+
}
|
|
411
|
+
format() {
|
|
412
|
+
return this.version = `${this.major}.${this.minor}.${this.patch}`, this.prerelease.length && (this.version += `-${this.prerelease.join(".")}`), this.version;
|
|
413
|
+
}
|
|
414
|
+
toString() {
|
|
415
|
+
return this.version;
|
|
416
|
+
}
|
|
417
|
+
compare(s) {
|
|
418
|
+
if (t("SemVer.compare", this.version, this.options, s), !(s instanceof i)) {
|
|
419
|
+
if (typeof s == "string" && s === this.version)
|
|
420
|
+
return 0;
|
|
421
|
+
s = new i(s, this.options);
|
|
422
|
+
}
|
|
423
|
+
return s.version === this.version ? 0 : this.compareMain(s) || this.comparePre(s);
|
|
424
|
+
}
|
|
425
|
+
compareMain(s) {
|
|
426
|
+
return s instanceof i || (s = new i(s, this.options)), d(this.major, s.major) || d(this.minor, s.minor) || d(this.patch, s.patch);
|
|
427
|
+
}
|
|
428
|
+
comparePre(s) {
|
|
429
|
+
if (s instanceof i || (s = new i(s, this.options)), this.prerelease.length && !s.prerelease.length)
|
|
430
|
+
return -1;
|
|
431
|
+
if (!this.prerelease.length && s.prerelease.length)
|
|
432
|
+
return 1;
|
|
433
|
+
if (!this.prerelease.length && !s.prerelease.length)
|
|
434
|
+
return 0;
|
|
435
|
+
let o = 0;
|
|
436
|
+
do {
|
|
437
|
+
const u = this.prerelease[o], h = s.prerelease[o];
|
|
438
|
+
if (t("prerelease compare", o, u, h), u === void 0 && h === void 0)
|
|
439
|
+
return 0;
|
|
440
|
+
if (h === void 0)
|
|
441
|
+
return 1;
|
|
442
|
+
if (u === void 0)
|
|
443
|
+
return -1;
|
|
444
|
+
if (u === h)
|
|
445
|
+
continue;
|
|
446
|
+
return d(u, h);
|
|
447
|
+
} while (++o);
|
|
448
|
+
}
|
|
449
|
+
compareBuild(s) {
|
|
450
|
+
s instanceof i || (s = new i(s, this.options));
|
|
451
|
+
let o = 0;
|
|
452
|
+
do {
|
|
453
|
+
const u = this.build[o], h = s.build[o];
|
|
454
|
+
if (t("build compare", o, u, h), u === void 0 && h === void 0)
|
|
455
|
+
return 0;
|
|
456
|
+
if (h === void 0)
|
|
457
|
+
return 1;
|
|
458
|
+
if (u === void 0)
|
|
459
|
+
return -1;
|
|
460
|
+
if (u === h)
|
|
461
|
+
continue;
|
|
462
|
+
return d(u, h);
|
|
463
|
+
} while (++o);
|
|
464
|
+
}
|
|
465
|
+
// preminor will bump the version up to the next minor release, and immediately
|
|
466
|
+
// down to pre-release. premajor and prepatch work the same way.
|
|
467
|
+
inc(s, o, u) {
|
|
468
|
+
if (s.startsWith("pre")) {
|
|
469
|
+
if (!o && u === !1)
|
|
470
|
+
throw new Error("invalid increment argument: identifier is empty");
|
|
471
|
+
if (o) {
|
|
472
|
+
const h = new RegExp(`^${this.options.loose ? a[l.PRERELEASELOOSE] : a[l.PRERELEASE]}$`), m = `-${o}`.match(h);
|
|
473
|
+
if (!m || m[1] !== o)
|
|
474
|
+
throw new Error(`invalid identifier: ${o}`);
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
switch (s) {
|
|
478
|
+
case "premajor":
|
|
479
|
+
this.prerelease.length = 0, this.patch = 0, this.minor = 0, this.major++, this.inc("pre", o, u);
|
|
480
|
+
break;
|
|
481
|
+
case "preminor":
|
|
482
|
+
this.prerelease.length = 0, this.patch = 0, this.minor++, this.inc("pre", o, u);
|
|
483
|
+
break;
|
|
484
|
+
case "prepatch":
|
|
485
|
+
this.prerelease.length = 0, this.inc("patch", o, u), this.inc("pre", o, u);
|
|
486
|
+
break;
|
|
487
|
+
// If the input is a non-prerelease version, this acts the same as
|
|
488
|
+
// prepatch.
|
|
489
|
+
case "prerelease":
|
|
490
|
+
this.prerelease.length === 0 && this.inc("patch", o, u), this.inc("pre", o, u);
|
|
491
|
+
break;
|
|
492
|
+
case "release":
|
|
493
|
+
if (this.prerelease.length === 0)
|
|
494
|
+
throw new Error(`version ${this.raw} is not a prerelease`);
|
|
495
|
+
this.prerelease.length = 0;
|
|
496
|
+
break;
|
|
497
|
+
case "major":
|
|
498
|
+
(this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) && this.major++, this.minor = 0, this.patch = 0, this.prerelease = [];
|
|
499
|
+
break;
|
|
500
|
+
case "minor":
|
|
501
|
+
(this.patch !== 0 || this.prerelease.length === 0) && this.minor++, this.patch = 0, this.prerelease = [];
|
|
502
|
+
break;
|
|
503
|
+
case "patch":
|
|
504
|
+
this.prerelease.length === 0 && this.patch++, this.prerelease = [];
|
|
505
|
+
break;
|
|
506
|
+
// This probably shouldn't be used publicly.
|
|
507
|
+
// 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
|
|
508
|
+
case "pre": {
|
|
509
|
+
const h = Number(u) ? 1 : 0;
|
|
510
|
+
if (this.prerelease.length === 0)
|
|
511
|
+
this.prerelease = [h];
|
|
512
|
+
else {
|
|
513
|
+
let m = this.prerelease.length;
|
|
514
|
+
for (; --m >= 0; )
|
|
515
|
+
typeof this.prerelease[m] == "number" && (this.prerelease[m]++, m = -2);
|
|
516
|
+
if (m === -1) {
|
|
517
|
+
if (o === this.prerelease.join(".") && u === !1)
|
|
518
|
+
throw new Error("invalid increment argument: identifier already exists");
|
|
519
|
+
this.prerelease.push(h);
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
if (o) {
|
|
523
|
+
let m = [o, h];
|
|
524
|
+
u === !1 && (m = [o]), d(this.prerelease[0], o) === 0 ? isNaN(this.prerelease[1]) && (this.prerelease = m) : this.prerelease = m;
|
|
525
|
+
}
|
|
526
|
+
break;
|
|
527
|
+
}
|
|
528
|
+
default:
|
|
529
|
+
throw new Error(`invalid increment argument: ${s}`);
|
|
530
|
+
}
|
|
531
|
+
return this.raw = this.format(), this.build.length && (this.raw += `+${this.build.join(".")}`), this;
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
return ke = i, ke;
|
|
535
|
+
}
|
|
536
|
+
var Le, Ht;
|
|
537
|
+
function W() {
|
|
538
|
+
if (Ht) return Le;
|
|
539
|
+
Ht = 1;
|
|
540
|
+
const t = j();
|
|
541
|
+
return Le = (r, n, a = !1) => {
|
|
542
|
+
if (r instanceof t)
|
|
543
|
+
return r;
|
|
544
|
+
try {
|
|
545
|
+
return new t(r, n);
|
|
546
|
+
} catch (l) {
|
|
547
|
+
if (!a)
|
|
548
|
+
return null;
|
|
549
|
+
throw l;
|
|
550
|
+
}
|
|
551
|
+
}, Le;
|
|
552
|
+
}
|
|
553
|
+
var Ce, Yt;
|
|
554
|
+
function qs() {
|
|
555
|
+
if (Yt) return Ce;
|
|
556
|
+
Yt = 1;
|
|
557
|
+
const t = W();
|
|
558
|
+
return Ce = (r, n) => {
|
|
559
|
+
const a = t(r, n);
|
|
560
|
+
return a ? a.version : null;
|
|
561
|
+
}, Ce;
|
|
562
|
+
}
|
|
563
|
+
var Te, Kt;
|
|
564
|
+
function Ds() {
|
|
565
|
+
if (Kt) return Te;
|
|
566
|
+
Kt = 1;
|
|
567
|
+
const t = W();
|
|
568
|
+
return Te = (r, n) => {
|
|
569
|
+
const a = t(r.trim().replace(/^[=v]+/, ""), n);
|
|
570
|
+
return a ? a.version : null;
|
|
571
|
+
}, Te;
|
|
572
|
+
}
|
|
573
|
+
var Ae, Zt;
|
|
574
|
+
function Bs() {
|
|
575
|
+
if (Zt) return Ae;
|
|
576
|
+
Zt = 1;
|
|
577
|
+
const t = j();
|
|
578
|
+
return Ae = (r, n, a, l, c) => {
|
|
579
|
+
typeof a == "string" && (c = l, l = a, a = void 0);
|
|
580
|
+
try {
|
|
581
|
+
return new t(
|
|
582
|
+
r instanceof t ? r.version : r,
|
|
583
|
+
a
|
|
584
|
+
).inc(n, l, c).version;
|
|
585
|
+
} catch {
|
|
586
|
+
return null;
|
|
587
|
+
}
|
|
588
|
+
}, Ae;
|
|
589
|
+
}
|
|
590
|
+
var Fe, Qt;
|
|
591
|
+
function _s() {
|
|
592
|
+
if (Qt) return Fe;
|
|
593
|
+
Qt = 1;
|
|
594
|
+
const t = W();
|
|
595
|
+
return Fe = (r, n) => {
|
|
596
|
+
const a = t(r, null, !0), l = t(n, null, !0), c = a.compare(l);
|
|
597
|
+
if (c === 0)
|
|
598
|
+
return null;
|
|
599
|
+
const d = c > 0, i = d ? a : l, f = d ? l : a, s = !!i.prerelease.length;
|
|
600
|
+
if (!!f.prerelease.length && !s) {
|
|
601
|
+
if (!f.patch && !f.minor)
|
|
602
|
+
return "major";
|
|
603
|
+
if (f.compareMain(i) === 0)
|
|
604
|
+
return f.minor && !f.patch ? "minor" : "patch";
|
|
605
|
+
}
|
|
606
|
+
const u = s ? "pre" : "";
|
|
607
|
+
return a.major !== l.major ? u + "major" : a.minor !== l.minor ? u + "minor" : a.patch !== l.patch ? u + "patch" : "prerelease";
|
|
608
|
+
}, Fe;
|
|
609
|
+
}
|
|
610
|
+
var be, er;
|
|
611
|
+
function js() {
|
|
612
|
+
if (er) return be;
|
|
613
|
+
er = 1;
|
|
614
|
+
const t = j();
|
|
615
|
+
return be = (r, n) => new t(r, n).major, be;
|
|
616
|
+
}
|
|
617
|
+
var qe, tr;
|
|
618
|
+
function Gs() {
|
|
619
|
+
if (tr) return qe;
|
|
620
|
+
tr = 1;
|
|
621
|
+
const t = j();
|
|
622
|
+
return qe = (r, n) => new t(r, n).minor, qe;
|
|
623
|
+
}
|
|
624
|
+
var De, rr;
|
|
625
|
+
function xs() {
|
|
626
|
+
if (rr) return De;
|
|
627
|
+
rr = 1;
|
|
628
|
+
const t = j();
|
|
629
|
+
return De = (r, n) => new t(r, n).patch, De;
|
|
630
|
+
}
|
|
631
|
+
var Be, sr;
|
|
632
|
+
function Us() {
|
|
633
|
+
if (sr) return Be;
|
|
634
|
+
sr = 1;
|
|
635
|
+
const t = W();
|
|
636
|
+
return Be = (r, n) => {
|
|
637
|
+
const a = t(r, n);
|
|
638
|
+
return a && a.prerelease.length ? a.prerelease : null;
|
|
639
|
+
}, Be;
|
|
640
|
+
}
|
|
641
|
+
var _e, nr;
|
|
642
|
+
function G() {
|
|
643
|
+
if (nr) return _e;
|
|
644
|
+
nr = 1;
|
|
645
|
+
const t = j();
|
|
646
|
+
return _e = (r, n, a) => new t(r, a).compare(new t(n, a)), _e;
|
|
647
|
+
}
|
|
648
|
+
var je, ir;
|
|
649
|
+
function Vs() {
|
|
650
|
+
if (ir) return je;
|
|
651
|
+
ir = 1;
|
|
652
|
+
const t = G();
|
|
653
|
+
return je = (r, n, a) => t(n, r, a), je;
|
|
654
|
+
}
|
|
655
|
+
var Ge, ar;
|
|
656
|
+
function Ms() {
|
|
657
|
+
if (ar) return Ge;
|
|
658
|
+
ar = 1;
|
|
659
|
+
const t = G();
|
|
660
|
+
return Ge = (r, n) => t(r, n, !0), Ge;
|
|
661
|
+
}
|
|
662
|
+
var xe, or;
|
|
663
|
+
function At() {
|
|
664
|
+
if (or) return xe;
|
|
665
|
+
or = 1;
|
|
666
|
+
const t = j();
|
|
667
|
+
return xe = (r, n, a) => {
|
|
668
|
+
const l = new t(r, a), c = new t(n, a);
|
|
669
|
+
return l.compare(c) || l.compareBuild(c);
|
|
670
|
+
}, xe;
|
|
671
|
+
}
|
|
672
|
+
var Ue, cr;
|
|
673
|
+
function zs() {
|
|
674
|
+
if (cr) return Ue;
|
|
675
|
+
cr = 1;
|
|
676
|
+
const t = At();
|
|
677
|
+
return Ue = (r, n) => r.sort((a, l) => t(a, l, n)), Ue;
|
|
678
|
+
}
|
|
679
|
+
var Ve, lr;
|
|
680
|
+
function Xs() {
|
|
681
|
+
if (lr) return Ve;
|
|
682
|
+
lr = 1;
|
|
683
|
+
const t = At();
|
|
684
|
+
return Ve = (r, n) => r.sort((a, l) => t(l, a, n)), Ve;
|
|
685
|
+
}
|
|
686
|
+
var Me, ur;
|
|
687
|
+
function ge() {
|
|
688
|
+
if (ur) return Me;
|
|
689
|
+
ur = 1;
|
|
690
|
+
const t = G();
|
|
691
|
+
return Me = (r, n, a) => t(r, n, a) > 0, Me;
|
|
692
|
+
}
|
|
693
|
+
var ze, fr;
|
|
694
|
+
function Ft() {
|
|
695
|
+
if (fr) return ze;
|
|
696
|
+
fr = 1;
|
|
697
|
+
const t = G();
|
|
698
|
+
return ze = (r, n, a) => t(r, n, a) < 0, ze;
|
|
699
|
+
}
|
|
700
|
+
var Xe, hr;
|
|
701
|
+
function Yr() {
|
|
702
|
+
if (hr) return Xe;
|
|
703
|
+
hr = 1;
|
|
704
|
+
const t = G();
|
|
705
|
+
return Xe = (r, n, a) => t(r, n, a) === 0, Xe;
|
|
706
|
+
}
|
|
707
|
+
var Je, pr;
|
|
708
|
+
function Kr() {
|
|
709
|
+
if (pr) return Je;
|
|
710
|
+
pr = 1;
|
|
711
|
+
const t = G();
|
|
712
|
+
return Je = (r, n, a) => t(r, n, a) !== 0, Je;
|
|
713
|
+
}
|
|
714
|
+
var We, dr;
|
|
715
|
+
function bt() {
|
|
716
|
+
if (dr) return We;
|
|
717
|
+
dr = 1;
|
|
718
|
+
const t = G();
|
|
719
|
+
return We = (r, n, a) => t(r, n, a) >= 0, We;
|
|
720
|
+
}
|
|
721
|
+
var He, gr;
|
|
722
|
+
function qt() {
|
|
723
|
+
if (gr) return He;
|
|
724
|
+
gr = 1;
|
|
725
|
+
const t = G();
|
|
726
|
+
return He = (r, n, a) => t(r, n, a) <= 0, He;
|
|
727
|
+
}
|
|
728
|
+
var Ye, mr;
|
|
729
|
+
function Zr() {
|
|
730
|
+
if (mr) return Ye;
|
|
731
|
+
mr = 1;
|
|
732
|
+
const t = Yr(), e = Kr(), r = ge(), n = bt(), a = Ft(), l = qt();
|
|
733
|
+
return Ye = (d, i, f, s) => {
|
|
734
|
+
switch (i) {
|
|
735
|
+
case "===":
|
|
736
|
+
return typeof d == "object" && (d = d.version), typeof f == "object" && (f = f.version), d === f;
|
|
737
|
+
case "!==":
|
|
738
|
+
return typeof d == "object" && (d = d.version), typeof f == "object" && (f = f.version), d !== f;
|
|
739
|
+
case "":
|
|
740
|
+
case "=":
|
|
741
|
+
case "==":
|
|
742
|
+
return t(d, f, s);
|
|
743
|
+
case "!=":
|
|
744
|
+
return e(d, f, s);
|
|
745
|
+
case ">":
|
|
746
|
+
return r(d, f, s);
|
|
747
|
+
case ">=":
|
|
748
|
+
return n(d, f, s);
|
|
749
|
+
case "<":
|
|
750
|
+
return a(d, f, s);
|
|
751
|
+
case "<=":
|
|
752
|
+
return l(d, f, s);
|
|
753
|
+
default:
|
|
754
|
+
throw new TypeError(`Invalid operator: ${i}`);
|
|
755
|
+
}
|
|
756
|
+
}, Ye;
|
|
757
|
+
}
|
|
758
|
+
var Ke, Er;
|
|
759
|
+
function Js() {
|
|
760
|
+
if (Er) return Ke;
|
|
761
|
+
Er = 1;
|
|
762
|
+
const t = j(), e = W(), { safeRe: r, t: n } = ee();
|
|
763
|
+
return Ke = (l, c) => {
|
|
764
|
+
if (l instanceof t)
|
|
765
|
+
return l;
|
|
766
|
+
if (typeof l == "number" && (l = String(l)), typeof l != "string")
|
|
767
|
+
return null;
|
|
768
|
+
c = c || {};
|
|
769
|
+
let d = null;
|
|
770
|
+
if (!c.rtl)
|
|
771
|
+
d = l.match(c.includePrerelease ? r[n.COERCEFULL] : r[n.COERCE]);
|
|
772
|
+
else {
|
|
773
|
+
const h = c.includePrerelease ? r[n.COERCERTLFULL] : r[n.COERCERTL];
|
|
774
|
+
let m;
|
|
775
|
+
for (; (m = h.exec(l)) && (!d || d.index + d[0].length !== l.length); )
|
|
776
|
+
(!d || m.index + m[0].length !== d.index + d[0].length) && (d = m), h.lastIndex = m.index + m[1].length + m[2].length;
|
|
777
|
+
h.lastIndex = -1;
|
|
778
|
+
}
|
|
779
|
+
if (d === null)
|
|
780
|
+
return null;
|
|
781
|
+
const i = d[2], f = d[3] || "0", s = d[4] || "0", o = c.includePrerelease && d[5] ? `-${d[5]}` : "", u = c.includePrerelease && d[6] ? `+${d[6]}` : "";
|
|
782
|
+
return e(`${i}.${f}.${s}${o}${u}`, c);
|
|
783
|
+
}, Ke;
|
|
784
|
+
}
|
|
785
|
+
var Ze, vr;
|
|
786
|
+
function Ws() {
|
|
787
|
+
if (vr) return Ze;
|
|
788
|
+
vr = 1;
|
|
789
|
+
class t {
|
|
790
|
+
constructor() {
|
|
791
|
+
this.max = 1e3, this.map = /* @__PURE__ */ new Map();
|
|
792
|
+
}
|
|
793
|
+
get(r) {
|
|
794
|
+
const n = this.map.get(r);
|
|
795
|
+
if (n !== void 0)
|
|
796
|
+
return this.map.delete(r), this.map.set(r, n), n;
|
|
797
|
+
}
|
|
798
|
+
delete(r) {
|
|
799
|
+
return this.map.delete(r);
|
|
800
|
+
}
|
|
801
|
+
set(r, n) {
|
|
802
|
+
if (!this.delete(r) && n !== void 0) {
|
|
803
|
+
if (this.map.size >= this.max) {
|
|
804
|
+
const l = this.map.keys().next().value;
|
|
805
|
+
this.delete(l);
|
|
806
|
+
}
|
|
807
|
+
this.map.set(r, n);
|
|
808
|
+
}
|
|
809
|
+
return this;
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
return Ze = t, Ze;
|
|
813
|
+
}
|
|
814
|
+
var Qe, $r;
|
|
815
|
+
function x() {
|
|
816
|
+
if ($r) return Qe;
|
|
817
|
+
$r = 1;
|
|
818
|
+
const t = /\s+/g;
|
|
819
|
+
class e {
|
|
820
|
+
constructor(g, S) {
|
|
821
|
+
if (S = a(S), g instanceof e)
|
|
822
|
+
return g.loose === !!S.loose && g.includePrerelease === !!S.includePrerelease ? g : new e(g.raw, S);
|
|
823
|
+
if (g instanceof l)
|
|
824
|
+
return this.raw = g.value, this.set = [[g]], this.formatted = void 0, this;
|
|
825
|
+
if (this.options = S, this.loose = !!S.loose, this.includePrerelease = !!S.includePrerelease, this.raw = g.trim().replace(t, " "), this.set = this.raw.split("||").map((R) => this.parseRange(R.trim())).filter((R) => R.length), !this.set.length)
|
|
826
|
+
throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
|
|
827
|
+
if (this.set.length > 1) {
|
|
828
|
+
const R = this.set[0];
|
|
829
|
+
if (this.set = this.set.filter((y) => !p(y[0])), this.set.length === 0)
|
|
830
|
+
this.set = [R];
|
|
831
|
+
else if (this.set.length > 1) {
|
|
832
|
+
for (const y of this.set)
|
|
833
|
+
if (y.length === 1 && v(y[0])) {
|
|
834
|
+
this.set = [y];
|
|
835
|
+
break;
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
this.formatted = void 0;
|
|
840
|
+
}
|
|
841
|
+
get range() {
|
|
842
|
+
if (this.formatted === void 0) {
|
|
843
|
+
this.formatted = "";
|
|
844
|
+
for (let g = 0; g < this.set.length; g++) {
|
|
845
|
+
g > 0 && (this.formatted += "||");
|
|
846
|
+
const S = this.set[g];
|
|
847
|
+
for (let R = 0; R < S.length; R++)
|
|
848
|
+
R > 0 && (this.formatted += " "), this.formatted += S[R].toString().trim();
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
return this.formatted;
|
|
852
|
+
}
|
|
853
|
+
format() {
|
|
854
|
+
return this.range;
|
|
855
|
+
}
|
|
856
|
+
toString() {
|
|
857
|
+
return this.range;
|
|
858
|
+
}
|
|
859
|
+
parseRange(g) {
|
|
860
|
+
const R = ((this.options.includePrerelease && h) | (this.options.loose && m)) + ":" + g, y = n.get(R);
|
|
861
|
+
if (y)
|
|
862
|
+
return y;
|
|
863
|
+
const w = this.options.loose, O = w ? i[f.HYPHENRANGELOOSE] : i[f.HYPHENRANGE];
|
|
864
|
+
g = g.replace(O, we(this.options.includePrerelease)), c("hyphen replace", g), g = g.replace(i[f.COMPARATORTRIM], s), c("comparator trim", g), g = g.replace(i[f.TILDETRIM], o), c("tilde trim", g), g = g.replace(i[f.CARETTRIM], u), c("caret trim", g);
|
|
865
|
+
let C = g.split(" ").map((q) => N(q, this.options)).join(" ").split(/\s+/).map((q) => Re(q, this.options));
|
|
866
|
+
w && (C = C.filter((q) => (c("loose invalid filter", q, this.options), !!q.match(i[f.COMPARATORLOOSE])))), c("range list", C);
|
|
867
|
+
const k = /* @__PURE__ */ new Map(), A = C.map((q) => new l(q, this.options));
|
|
868
|
+
for (const q of A) {
|
|
869
|
+
if (p(q))
|
|
870
|
+
return [q];
|
|
871
|
+
k.set(q.value, q);
|
|
872
|
+
}
|
|
873
|
+
k.size > 1 && k.has("") && k.delete("");
|
|
874
|
+
const _ = [...k.values()];
|
|
875
|
+
return n.set(R, _), _;
|
|
876
|
+
}
|
|
877
|
+
intersects(g, S) {
|
|
878
|
+
if (!(g instanceof e))
|
|
879
|
+
throw new TypeError("a Range is required");
|
|
880
|
+
return this.set.some((R) => $(R, S) && g.set.some((y) => $(y, S) && R.every((w) => y.every((O) => w.intersects(O, S)))));
|
|
881
|
+
}
|
|
882
|
+
// if ANY of the sets match ALL of its comparators, then pass
|
|
883
|
+
test(g) {
|
|
884
|
+
if (!g)
|
|
885
|
+
return !1;
|
|
886
|
+
if (typeof g == "string")
|
|
887
|
+
try {
|
|
888
|
+
g = new d(g, this.options);
|
|
889
|
+
} catch {
|
|
890
|
+
return !1;
|
|
891
|
+
}
|
|
892
|
+
for (let S = 0; S < this.set.length; S++)
|
|
893
|
+
if (Se(this.set[S], g, this.options))
|
|
894
|
+
return !0;
|
|
895
|
+
return !1;
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
Qe = e;
|
|
899
|
+
const r = Ws(), n = new r(), a = Tt(), l = me(), c = de(), d = j(), {
|
|
900
|
+
safeRe: i,
|
|
901
|
+
t: f,
|
|
902
|
+
comparatorTrimReplace: s,
|
|
903
|
+
tildeTrimReplace: o,
|
|
904
|
+
caretTrimReplace: u
|
|
905
|
+
} = ee(), { FLAG_INCLUDE_PRERELEASE: h, FLAG_LOOSE: m } = pe(), p = (E) => E.value === "<0.0.0-0", v = (E) => E.value === "", $ = (E, g) => {
|
|
906
|
+
let S = !0;
|
|
907
|
+
const R = E.slice();
|
|
908
|
+
let y = R.pop();
|
|
909
|
+
for (; S && R.length; )
|
|
910
|
+
S = R.every((w) => y.intersects(w, g)), y = R.pop();
|
|
911
|
+
return S;
|
|
912
|
+
}, N = (E, g) => (c("comp", E, g), E = T(E, g), c("caret", E), E = F(E, g), c("tildes", E), E = P(E, g), c("xrange", E), E = $e(E, g), c("stars", E), E), I = (E) => !E || E.toLowerCase() === "x" || E === "*", F = (E, g) => E.trim().split(/\s+/).map((S) => b(S, g)).join(" "), b = (E, g) => {
|
|
913
|
+
const S = g.loose ? i[f.TILDELOOSE] : i[f.TILDE];
|
|
914
|
+
return E.replace(S, (R, y, w, O, C) => {
|
|
915
|
+
c("tilde", E, R, y, w, O, C);
|
|
916
|
+
let k;
|
|
917
|
+
return I(y) ? k = "" : I(w) ? k = `>=${y}.0.0 <${+y + 1}.0.0-0` : I(O) ? k = `>=${y}.${w}.0 <${y}.${+w + 1}.0-0` : C ? (c("replaceTilde pr", C), k = `>=${y}.${w}.${O}-${C} <${y}.${+w + 1}.0-0`) : k = `>=${y}.${w}.${O} <${y}.${+w + 1}.0-0`, c("tilde return", k), k;
|
|
918
|
+
});
|
|
919
|
+
}, T = (E, g) => E.trim().split(/\s+/).map((S) => D(S, g)).join(" "), D = (E, g) => {
|
|
920
|
+
c("caret", E, g);
|
|
921
|
+
const S = g.loose ? i[f.CARETLOOSE] : i[f.CARET], R = g.includePrerelease ? "-0" : "";
|
|
922
|
+
return E.replace(S, (y, w, O, C, k) => {
|
|
923
|
+
c("caret", E, y, w, O, C, k);
|
|
924
|
+
let A;
|
|
925
|
+
return I(w) ? A = "" : I(O) ? A = `>=${w}.0.0${R} <${+w + 1}.0.0-0` : I(C) ? w === "0" ? A = `>=${w}.${O}.0${R} <${w}.${+O + 1}.0-0` : A = `>=${w}.${O}.0${R} <${+w + 1}.0.0-0` : k ? (c("replaceCaret pr", k), w === "0" ? O === "0" ? A = `>=${w}.${O}.${C}-${k} <${w}.${O}.${+C + 1}-0` : A = `>=${w}.${O}.${C}-${k} <${w}.${+O + 1}.0-0` : A = `>=${w}.${O}.${C}-${k} <${+w + 1}.0.0-0`) : (c("no pr"), w === "0" ? O === "0" ? A = `>=${w}.${O}.${C}${R} <${w}.${O}.${+C + 1}-0` : A = `>=${w}.${O}.${C}${R} <${w}.${+O + 1}.0-0` : A = `>=${w}.${O}.${C} <${+w + 1}.0.0-0`), c("caret return", A), A;
|
|
926
|
+
});
|
|
927
|
+
}, P = (E, g) => (c("replaceXRanges", E, g), E.split(/\s+/).map((S) => H(S, g)).join(" ")), H = (E, g) => {
|
|
928
|
+
E = E.trim();
|
|
929
|
+
const S = g.loose ? i[f.XRANGELOOSE] : i[f.XRANGE];
|
|
930
|
+
return E.replace(S, (R, y, w, O, C, k) => {
|
|
931
|
+
c("xRange", E, R, y, w, O, C, k);
|
|
932
|
+
const A = I(w), _ = A || I(O), q = _ || I(C), Y = q;
|
|
933
|
+
return y === "=" && Y && (y = ""), k = g.includePrerelease ? "-0" : "", A ? y === ">" || y === "<" ? R = "<0.0.0-0" : R = "*" : y && Y ? (_ && (O = 0), C = 0, y === ">" ? (y = ">=", _ ? (w = +w + 1, O = 0, C = 0) : (O = +O + 1, C = 0)) : y === "<=" && (y = "<", _ ? w = +w + 1 : O = +O + 1), y === "<" && (k = "-0"), R = `${y + w}.${O}.${C}${k}`) : _ ? R = `>=${w}.0.0${k} <${+w + 1}.0.0-0` : q && (R = `>=${w}.${O}.0${k} <${w}.${+O + 1}.0-0`), c("xRange return", R), R;
|
|
934
|
+
});
|
|
935
|
+
}, $e = (E, g) => (c("replaceStars", E, g), E.trim().replace(i[f.STAR], "")), Re = (E, g) => (c("replaceGTE0", E, g), E.trim().replace(i[g.includePrerelease ? f.GTE0PRE : f.GTE0], "")), we = (E) => (g, S, R, y, w, O, C, k, A, _, q, Y) => (I(R) ? S = "" : I(y) ? S = `>=${R}.0.0${E ? "-0" : ""}` : I(w) ? S = `>=${R}.${y}.0${E ? "-0" : ""}` : O ? S = `>=${S}` : S = `>=${S}${E ? "-0" : ""}`, I(A) ? k = "" : I(_) ? k = `<${+A + 1}.0.0-0` : I(q) ? k = `<${A}.${+_ + 1}.0-0` : Y ? k = `<=${A}.${_}.${q}-${Y}` : E ? k = `<${A}.${_}.${+q + 1}-0` : k = `<=${k}`, `${S} ${k}`.trim()), Se = (E, g, S) => {
|
|
936
|
+
for (let R = 0; R < E.length; R++)
|
|
937
|
+
if (!E[R].test(g))
|
|
938
|
+
return !1;
|
|
939
|
+
if (g.prerelease.length && !S.includePrerelease) {
|
|
940
|
+
for (let R = 0; R < E.length; R++)
|
|
941
|
+
if (c(E[R].semver), E[R].semver !== l.ANY && E[R].semver.prerelease.length > 0) {
|
|
942
|
+
const y = E[R].semver;
|
|
943
|
+
if (y.major === g.major && y.minor === g.minor && y.patch === g.patch)
|
|
944
|
+
return !0;
|
|
945
|
+
}
|
|
946
|
+
return !1;
|
|
947
|
+
}
|
|
948
|
+
return !0;
|
|
949
|
+
};
|
|
950
|
+
return Qe;
|
|
951
|
+
}
|
|
952
|
+
var et, Rr;
|
|
953
|
+
function me() {
|
|
954
|
+
if (Rr) return et;
|
|
955
|
+
Rr = 1;
|
|
956
|
+
const t = Symbol("SemVer ANY");
|
|
957
|
+
class e {
|
|
958
|
+
static get ANY() {
|
|
959
|
+
return t;
|
|
960
|
+
}
|
|
961
|
+
constructor(s, o) {
|
|
962
|
+
if (o = r(o), s instanceof e) {
|
|
963
|
+
if (s.loose === !!o.loose)
|
|
964
|
+
return s;
|
|
965
|
+
s = s.value;
|
|
966
|
+
}
|
|
967
|
+
s = s.trim().split(/\s+/).join(" "), c("comparator", s, o), this.options = o, this.loose = !!o.loose, this.parse(s), this.semver === t ? this.value = "" : this.value = this.operator + this.semver.version, c("comp", this);
|
|
968
|
+
}
|
|
969
|
+
parse(s) {
|
|
970
|
+
const o = this.options.loose ? n[a.COMPARATORLOOSE] : n[a.COMPARATOR], u = s.match(o);
|
|
971
|
+
if (!u)
|
|
972
|
+
throw new TypeError(`Invalid comparator: ${s}`);
|
|
973
|
+
this.operator = u[1] !== void 0 ? u[1] : "", this.operator === "=" && (this.operator = ""), u[2] ? this.semver = new d(u[2], this.options.loose) : this.semver = t;
|
|
974
|
+
}
|
|
975
|
+
toString() {
|
|
976
|
+
return this.value;
|
|
977
|
+
}
|
|
978
|
+
test(s) {
|
|
979
|
+
if (c("Comparator.test", s, this.options.loose), this.semver === t || s === t)
|
|
980
|
+
return !0;
|
|
981
|
+
if (typeof s == "string")
|
|
982
|
+
try {
|
|
983
|
+
s = new d(s, this.options);
|
|
984
|
+
} catch {
|
|
985
|
+
return !1;
|
|
986
|
+
}
|
|
987
|
+
return l(s, this.operator, this.semver, this.options);
|
|
988
|
+
}
|
|
989
|
+
intersects(s, o) {
|
|
990
|
+
if (!(s instanceof e))
|
|
991
|
+
throw new TypeError("a Comparator is required");
|
|
992
|
+
return this.operator === "" ? this.value === "" ? !0 : new i(s.value, o).test(this.value) : s.operator === "" ? s.value === "" ? !0 : new i(this.value, o).test(s.semver) : (o = r(o), o.includePrerelease && (this.value === "<0.0.0-0" || s.value === "<0.0.0-0") || !o.includePrerelease && (this.value.startsWith("<0.0.0") || s.value.startsWith("<0.0.0")) ? !1 : !!(this.operator.startsWith(">") && s.operator.startsWith(">") || this.operator.startsWith("<") && s.operator.startsWith("<") || this.semver.version === s.semver.version && this.operator.includes("=") && s.operator.includes("=") || l(this.semver, "<", s.semver, o) && this.operator.startsWith(">") && s.operator.startsWith("<") || l(this.semver, ">", s.semver, o) && this.operator.startsWith("<") && s.operator.startsWith(">")));
|
|
993
|
+
}
|
|
994
|
+
}
|
|
995
|
+
et = e;
|
|
996
|
+
const r = Tt(), { safeRe: n, t: a } = ee(), l = Zr(), c = de(), d = j(), i = x();
|
|
997
|
+
return et;
|
|
998
|
+
}
|
|
999
|
+
var tt, wr;
|
|
1000
|
+
function Ee() {
|
|
1001
|
+
if (wr) return tt;
|
|
1002
|
+
wr = 1;
|
|
1003
|
+
const t = x();
|
|
1004
|
+
return tt = (r, n, a) => {
|
|
1005
|
+
try {
|
|
1006
|
+
n = new t(n, a);
|
|
1007
|
+
} catch {
|
|
1008
|
+
return !1;
|
|
1009
|
+
}
|
|
1010
|
+
return n.test(r);
|
|
1011
|
+
}, tt;
|
|
1012
|
+
}
|
|
1013
|
+
var rt, Sr;
|
|
1014
|
+
function Hs() {
|
|
1015
|
+
if (Sr) return rt;
|
|
1016
|
+
Sr = 1;
|
|
1017
|
+
const t = x();
|
|
1018
|
+
return rt = (r, n) => new t(r, n).set.map((a) => a.map((l) => l.value).join(" ").trim().split(" ")), rt;
|
|
1019
|
+
}
|
|
1020
|
+
var st, yr;
|
|
1021
|
+
function Ys() {
|
|
1022
|
+
if (yr) return st;
|
|
1023
|
+
yr = 1;
|
|
1024
|
+
const t = j(), e = x();
|
|
1025
|
+
return st = (n, a, l) => {
|
|
1026
|
+
let c = null, d = null, i = null;
|
|
1027
|
+
try {
|
|
1028
|
+
i = new e(a, l);
|
|
1029
|
+
} catch {
|
|
1030
|
+
return null;
|
|
1031
|
+
}
|
|
1032
|
+
return n.forEach((f) => {
|
|
1033
|
+
i.test(f) && (!c || d.compare(f) === -1) && (c = f, d = new t(c, l));
|
|
1034
|
+
}), c;
|
|
1035
|
+
}, st;
|
|
1036
|
+
}
|
|
1037
|
+
var nt, Ir;
|
|
1038
|
+
function Ks() {
|
|
1039
|
+
if (Ir) return nt;
|
|
1040
|
+
Ir = 1;
|
|
1041
|
+
const t = j(), e = x();
|
|
1042
|
+
return nt = (n, a, l) => {
|
|
1043
|
+
let c = null, d = null, i = null;
|
|
1044
|
+
try {
|
|
1045
|
+
i = new e(a, l);
|
|
1046
|
+
} catch {
|
|
1047
|
+
return null;
|
|
1048
|
+
}
|
|
1049
|
+
return n.forEach((f) => {
|
|
1050
|
+
i.test(f) && (!c || d.compare(f) === 1) && (c = f, d = new t(c, l));
|
|
1051
|
+
}), c;
|
|
1052
|
+
}, nt;
|
|
1053
|
+
}
|
|
1054
|
+
var it, Or;
|
|
1055
|
+
function Zs() {
|
|
1056
|
+
if (Or) return it;
|
|
1057
|
+
Or = 1;
|
|
1058
|
+
const t = j(), e = x(), r = ge();
|
|
1059
|
+
return it = (a, l) => {
|
|
1060
|
+
a = new e(a, l);
|
|
1061
|
+
let c = new t("0.0.0");
|
|
1062
|
+
if (a.test(c) || (c = new t("0.0.0-0"), a.test(c)))
|
|
1063
|
+
return c;
|
|
1064
|
+
c = null;
|
|
1065
|
+
for (let d = 0; d < a.set.length; ++d) {
|
|
1066
|
+
const i = a.set[d];
|
|
1067
|
+
let f = null;
|
|
1068
|
+
i.forEach((s) => {
|
|
1069
|
+
const o = new t(s.semver.version);
|
|
1070
|
+
switch (s.operator) {
|
|
1071
|
+
case ">":
|
|
1072
|
+
o.prerelease.length === 0 ? o.patch++ : o.prerelease.push(0), o.raw = o.format();
|
|
1073
|
+
/* fallthrough */
|
|
1074
|
+
case "":
|
|
1075
|
+
case ">=":
|
|
1076
|
+
(!f || r(o, f)) && (f = o);
|
|
1077
|
+
break;
|
|
1078
|
+
case "<":
|
|
1079
|
+
case "<=":
|
|
1080
|
+
break;
|
|
1081
|
+
/* istanbul ignore next */
|
|
1082
|
+
default:
|
|
1083
|
+
throw new Error(`Unexpected operation: ${s.operator}`);
|
|
1084
|
+
}
|
|
1085
|
+
}), f && (!c || r(c, f)) && (c = f);
|
|
1086
|
+
}
|
|
1087
|
+
return c && a.test(c) ? c : null;
|
|
1088
|
+
}, it;
|
|
1089
|
+
}
|
|
1090
|
+
var at, Pr;
|
|
1091
|
+
function Qs() {
|
|
1092
|
+
if (Pr) return at;
|
|
1093
|
+
Pr = 1;
|
|
1094
|
+
const t = x();
|
|
1095
|
+
return at = (r, n) => {
|
|
1096
|
+
try {
|
|
1097
|
+
return new t(r, n).range || "*";
|
|
1098
|
+
} catch {
|
|
1099
|
+
return null;
|
|
1100
|
+
}
|
|
1101
|
+
}, at;
|
|
1102
|
+
}
|
|
1103
|
+
var ot, Nr;
|
|
1104
|
+
function Dt() {
|
|
1105
|
+
if (Nr) return ot;
|
|
1106
|
+
Nr = 1;
|
|
1107
|
+
const t = j(), e = me(), { ANY: r } = e, n = x(), a = Ee(), l = ge(), c = Ft(), d = qt(), i = bt();
|
|
1108
|
+
return ot = (s, o, u, h) => {
|
|
1109
|
+
s = new t(s, h), o = new n(o, h);
|
|
1110
|
+
let m, p, v, $, N;
|
|
1111
|
+
switch (u) {
|
|
1112
|
+
case ">":
|
|
1113
|
+
m = l, p = d, v = c, $ = ">", N = ">=";
|
|
1114
|
+
break;
|
|
1115
|
+
case "<":
|
|
1116
|
+
m = c, p = i, v = l, $ = "<", N = "<=";
|
|
1117
|
+
break;
|
|
1118
|
+
default:
|
|
1119
|
+
throw new TypeError('Must provide a hilo val of "<" or ">"');
|
|
1120
|
+
}
|
|
1121
|
+
if (a(s, o, h))
|
|
1122
|
+
return !1;
|
|
1123
|
+
for (let I = 0; I < o.set.length; ++I) {
|
|
1124
|
+
const F = o.set[I];
|
|
1125
|
+
let b = null, T = null;
|
|
1126
|
+
if (F.forEach((D) => {
|
|
1127
|
+
D.semver === r && (D = new e(">=0.0.0")), b = b || D, T = T || D, m(D.semver, b.semver, h) ? b = D : v(D.semver, T.semver, h) && (T = D);
|
|
1128
|
+
}), b.operator === $ || b.operator === N || (!T.operator || T.operator === $) && p(s, T.semver))
|
|
1129
|
+
return !1;
|
|
1130
|
+
if (T.operator === N && v(s, T.semver))
|
|
1131
|
+
return !1;
|
|
1132
|
+
}
|
|
1133
|
+
return !0;
|
|
1134
|
+
}, ot;
|
|
1135
|
+
}
|
|
1136
|
+
var ct, kr;
|
|
1137
|
+
function en() {
|
|
1138
|
+
if (kr) return ct;
|
|
1139
|
+
kr = 1;
|
|
1140
|
+
const t = Dt();
|
|
1141
|
+
return ct = (r, n, a) => t(r, n, ">", a), ct;
|
|
1142
|
+
}
|
|
1143
|
+
var lt, Lr;
|
|
1144
|
+
function tn() {
|
|
1145
|
+
if (Lr) return lt;
|
|
1146
|
+
Lr = 1;
|
|
1147
|
+
const t = Dt();
|
|
1148
|
+
return lt = (r, n, a) => t(r, n, "<", a), lt;
|
|
1149
|
+
}
|
|
1150
|
+
var ut, Cr;
|
|
1151
|
+
function rn() {
|
|
1152
|
+
if (Cr) return ut;
|
|
1153
|
+
Cr = 1;
|
|
1154
|
+
const t = x();
|
|
1155
|
+
return ut = (r, n, a) => (r = new t(r, a), n = new t(n, a), r.intersects(n, a)), ut;
|
|
1156
|
+
}
|
|
1157
|
+
var ft, Tr;
|
|
1158
|
+
function sn() {
|
|
1159
|
+
if (Tr) return ft;
|
|
1160
|
+
Tr = 1;
|
|
1161
|
+
const t = Ee(), e = G();
|
|
1162
|
+
return ft = (r, n, a) => {
|
|
1163
|
+
const l = [];
|
|
1164
|
+
let c = null, d = null;
|
|
1165
|
+
const i = r.sort((u, h) => e(u, h, a));
|
|
1166
|
+
for (const u of i)
|
|
1167
|
+
t(u, n, a) ? (d = u, c || (c = u)) : (d && l.push([c, d]), d = null, c = null);
|
|
1168
|
+
c && l.push([c, null]);
|
|
1169
|
+
const f = [];
|
|
1170
|
+
for (const [u, h] of l)
|
|
1171
|
+
u === h ? f.push(u) : !h && u === i[0] ? f.push("*") : h ? u === i[0] ? f.push(`<=${h}`) : f.push(`${u} - ${h}`) : f.push(`>=${u}`);
|
|
1172
|
+
const s = f.join(" || "), o = typeof n.raw == "string" ? n.raw : String(n);
|
|
1173
|
+
return s.length < o.length ? s : n;
|
|
1174
|
+
}, ft;
|
|
1175
|
+
}
|
|
1176
|
+
var ht, Ar;
|
|
1177
|
+
function nn() {
|
|
1178
|
+
if (Ar) return ht;
|
|
1179
|
+
Ar = 1;
|
|
1180
|
+
const t = x(), e = me(), { ANY: r } = e, n = Ee(), a = G(), l = (o, u, h = {}) => {
|
|
1181
|
+
if (o === u)
|
|
1182
|
+
return !0;
|
|
1183
|
+
o = new t(o, h), u = new t(u, h);
|
|
1184
|
+
let m = !1;
|
|
1185
|
+
e: for (const p of o.set) {
|
|
1186
|
+
for (const v of u.set) {
|
|
1187
|
+
const $ = i(p, v, h);
|
|
1188
|
+
if (m = m || $ !== null, $)
|
|
1189
|
+
continue e;
|
|
1190
|
+
}
|
|
1191
|
+
if (m)
|
|
1192
|
+
return !1;
|
|
1193
|
+
}
|
|
1194
|
+
return !0;
|
|
1195
|
+
}, c = [new e(">=0.0.0-0")], d = [new e(">=0.0.0")], i = (o, u, h) => {
|
|
1196
|
+
if (o === u)
|
|
1197
|
+
return !0;
|
|
1198
|
+
if (o.length === 1 && o[0].semver === r) {
|
|
1199
|
+
if (u.length === 1 && u[0].semver === r)
|
|
1200
|
+
return !0;
|
|
1201
|
+
h.includePrerelease ? o = c : o = d;
|
|
1202
|
+
}
|
|
1203
|
+
if (u.length === 1 && u[0].semver === r) {
|
|
1204
|
+
if (h.includePrerelease)
|
|
1205
|
+
return !0;
|
|
1206
|
+
u = d;
|
|
1207
|
+
}
|
|
1208
|
+
const m = /* @__PURE__ */ new Set();
|
|
1209
|
+
let p, v;
|
|
1210
|
+
for (const P of o)
|
|
1211
|
+
P.operator === ">" || P.operator === ">=" ? p = f(p, P, h) : P.operator === "<" || P.operator === "<=" ? v = s(v, P, h) : m.add(P.semver);
|
|
1212
|
+
if (m.size > 1)
|
|
1213
|
+
return null;
|
|
1214
|
+
let $;
|
|
1215
|
+
if (p && v) {
|
|
1216
|
+
if ($ = a(p.semver, v.semver, h), $ > 0)
|
|
1217
|
+
return null;
|
|
1218
|
+
if ($ === 0 && (p.operator !== ">=" || v.operator !== "<="))
|
|
1219
|
+
return null;
|
|
1220
|
+
}
|
|
1221
|
+
for (const P of m) {
|
|
1222
|
+
if (p && !n(P, String(p), h) || v && !n(P, String(v), h))
|
|
1223
|
+
return null;
|
|
1224
|
+
for (const H of u)
|
|
1225
|
+
if (!n(P, String(H), h))
|
|
1226
|
+
return !1;
|
|
1227
|
+
return !0;
|
|
1228
|
+
}
|
|
1229
|
+
let N, I, F, b, T = v && !h.includePrerelease && v.semver.prerelease.length ? v.semver : !1, D = p && !h.includePrerelease && p.semver.prerelease.length ? p.semver : !1;
|
|
1230
|
+
T && T.prerelease.length === 1 && v.operator === "<" && T.prerelease[0] === 0 && (T = !1);
|
|
1231
|
+
for (const P of u) {
|
|
1232
|
+
if (b = b || P.operator === ">" || P.operator === ">=", F = F || P.operator === "<" || P.operator === "<=", p) {
|
|
1233
|
+
if (D && P.semver.prerelease && P.semver.prerelease.length && P.semver.major === D.major && P.semver.minor === D.minor && P.semver.patch === D.patch && (D = !1), P.operator === ">" || P.operator === ">=") {
|
|
1234
|
+
if (N = f(p, P, h), N === P && N !== p)
|
|
1235
|
+
return !1;
|
|
1236
|
+
} else if (p.operator === ">=" && !n(p.semver, String(P), h))
|
|
1237
|
+
return !1;
|
|
1238
|
+
}
|
|
1239
|
+
if (v) {
|
|
1240
|
+
if (T && P.semver.prerelease && P.semver.prerelease.length && P.semver.major === T.major && P.semver.minor === T.minor && P.semver.patch === T.patch && (T = !1), P.operator === "<" || P.operator === "<=") {
|
|
1241
|
+
if (I = s(v, P, h), I === P && I !== v)
|
|
1242
|
+
return !1;
|
|
1243
|
+
} else if (v.operator === "<=" && !n(v.semver, String(P), h))
|
|
1244
|
+
return !1;
|
|
1245
|
+
}
|
|
1246
|
+
if (!P.operator && (v || p) && $ !== 0)
|
|
1247
|
+
return !1;
|
|
1248
|
+
}
|
|
1249
|
+
return !(p && F && !v && $ !== 0 || v && b && !p && $ !== 0 || D || T);
|
|
1250
|
+
}, f = (o, u, h) => {
|
|
1251
|
+
if (!o)
|
|
1252
|
+
return u;
|
|
1253
|
+
const m = a(o.semver, u.semver, h);
|
|
1254
|
+
return m > 0 ? o : m < 0 || u.operator === ">" && o.operator === ">=" ? u : o;
|
|
1255
|
+
}, s = (o, u, h) => {
|
|
1256
|
+
if (!o)
|
|
1257
|
+
return u;
|
|
1258
|
+
const m = a(o.semver, u.semver, h);
|
|
1259
|
+
return m < 0 ? o : m > 0 || u.operator === "<" && o.operator === "<=" ? u : o;
|
|
1260
|
+
};
|
|
1261
|
+
return ht = l, ht;
|
|
1262
|
+
}
|
|
1263
|
+
var pt, Fr;
|
|
1264
|
+
function an() {
|
|
1265
|
+
if (Fr) return pt;
|
|
1266
|
+
Fr = 1;
|
|
1267
|
+
const t = ee(), e = pe(), r = j(), n = Hr(), a = W(), l = qs(), c = Ds(), d = Bs(), i = _s(), f = js(), s = Gs(), o = xs(), u = Us(), h = G(), m = Vs(), p = Ms(), v = At(), $ = zs(), N = Xs(), I = ge(), F = Ft(), b = Yr(), T = Kr(), D = bt(), P = qt(), H = Zr(), $e = Js(), Re = me(), we = x(), Se = Ee(), E = Hs(), g = Ys(), S = Ks(), R = Zs(), y = Qs(), w = Dt(), O = en(), C = tn(), k = rn(), A = sn(), _ = nn();
|
|
1268
|
+
return pt = {
|
|
1269
|
+
parse: a,
|
|
1270
|
+
valid: l,
|
|
1271
|
+
clean: c,
|
|
1272
|
+
inc: d,
|
|
1273
|
+
diff: i,
|
|
1274
|
+
major: f,
|
|
1275
|
+
minor: s,
|
|
1276
|
+
patch: o,
|
|
1277
|
+
prerelease: u,
|
|
1278
|
+
compare: h,
|
|
1279
|
+
rcompare: m,
|
|
1280
|
+
compareLoose: p,
|
|
1281
|
+
compareBuild: v,
|
|
1282
|
+
sort: $,
|
|
1283
|
+
rsort: N,
|
|
1284
|
+
gt: I,
|
|
1285
|
+
lt: F,
|
|
1286
|
+
eq: b,
|
|
1287
|
+
neq: T,
|
|
1288
|
+
gte: D,
|
|
1289
|
+
lte: P,
|
|
1290
|
+
cmp: H,
|
|
1291
|
+
coerce: $e,
|
|
1292
|
+
Comparator: Re,
|
|
1293
|
+
Range: we,
|
|
1294
|
+
satisfies: Se,
|
|
1295
|
+
toComparators: E,
|
|
1296
|
+
maxSatisfying: g,
|
|
1297
|
+
minSatisfying: S,
|
|
1298
|
+
minVersion: R,
|
|
1299
|
+
validRange: y,
|
|
1300
|
+
outside: w,
|
|
1301
|
+
gtr: O,
|
|
1302
|
+
ltr: C,
|
|
1303
|
+
intersects: k,
|
|
1304
|
+
simplifyRange: A,
|
|
1305
|
+
subset: _,
|
|
1306
|
+
SemVer: r,
|
|
1307
|
+
re: t.re,
|
|
1308
|
+
src: t.src,
|
|
1309
|
+
tokens: t.t,
|
|
1310
|
+
SEMVER_SPEC_VERSION: e.SEMVER_SPEC_VERSION,
|
|
1311
|
+
RELEASE_TYPES: e.RELEASE_TYPES,
|
|
1312
|
+
compareIdentifiers: n.compareIdentifiers,
|
|
1313
|
+
rcompareIdentifiers: n.rcompareIdentifiers
|
|
1314
|
+
}, pt;
|
|
1315
|
+
}
|
|
1316
|
+
var Qr = an();
|
|
1317
|
+
const on = /* @__PURE__ */ bs(Qr), It = "_updates_v2/per_package_version/";
|
|
1318
|
+
function cn(t, e) {
|
|
1319
|
+
return `${It}${t.organization}/${t.name}/${t.version}/${e}`;
|
|
1320
|
+
}
|
|
1321
|
+
const ln = /(?<packageKeyWithoutVersion>(?<organization>[^\/]+)\/(?<name>[^\/]+))\/(?<version>[^\/]+)\/(?<seed>[^\/]+)$/, dt = "_updates_v2/_global_update_in", br = "_updates_v2/_global_update_out", te = "v2/", un = "overview.json", fn = "overview.json", ie = "manifest.json", Ot = "channels", gt = /^[-a-z0-9]+$/;
|
|
1322
|
+
function es(t) {
|
|
1323
|
+
return `${t.organization}/${t.name}/${t.version}`;
|
|
1324
|
+
}
|
|
1325
|
+
function ne(t) {
|
|
1326
|
+
return `${te}${es(t)}`;
|
|
1327
|
+
}
|
|
1328
|
+
const hn = "/" + ie, pn = L.object({
|
|
1329
|
+
description: X,
|
|
1330
|
+
channels: L.array(L.string()).default(() => []),
|
|
1331
|
+
manifestSha256: Rt
|
|
1332
|
+
}), qr = L.object({
|
|
1333
|
+
schema: L.literal("v2"),
|
|
1334
|
+
versions: L.array(pn)
|
|
1335
|
+
});
|
|
1336
|
+
function dn(t) {
|
|
1337
|
+
return `${t.organization}/${t.name}/${fn}`;
|
|
1338
|
+
}
|
|
1339
|
+
function Dr(t) {
|
|
1340
|
+
return `${te}${dn(t)}`;
|
|
1341
|
+
}
|
|
1342
|
+
function gn(t) {
|
|
1343
|
+
return `${es(t)}/${Ot}/`;
|
|
1344
|
+
}
|
|
1345
|
+
function mn(t) {
|
|
1346
|
+
return `${te}${gn(t)}`;
|
|
1347
|
+
}
|
|
1348
|
+
const En = /(?<packageKeyWithoutVersion>(?<organization>[^\/]+)\/(?<name>[^\/]+))\/(?<version>[^\/]+)\/manifest\.json$/, mt = `${te}${un}`;
|
|
1349
|
+
function ts(t) {
|
|
1350
|
+
const e = L.object({
|
|
1351
|
+
id: ds,
|
|
1352
|
+
/** @deprecated to be removed at some point, not used, left for compatibility with older versions */
|
|
1353
|
+
allVersions: L.array(L.string()).optional(),
|
|
1354
|
+
allVersionsWithChannels: L.array(gs).optional(),
|
|
1355
|
+
/** @deprecated to be removed at some point, not used, left for compatibility with older versions */
|
|
1356
|
+
latest: t,
|
|
1357
|
+
/** @deprecated to be removed at some point, not used, left for compatibility with older versions */
|
|
1358
|
+
latestManifestSha256: Rt,
|
|
1359
|
+
latestByChannel: L.record(
|
|
1360
|
+
L.string(),
|
|
1361
|
+
L.object({
|
|
1362
|
+
description: t,
|
|
1363
|
+
manifestSha256: Rt
|
|
1364
|
+
})
|
|
1365
|
+
).default({})
|
|
1366
|
+
});
|
|
1367
|
+
return e.transform((r) => r.allVersionsWithChannels ? r : {
|
|
1368
|
+
...r,
|
|
1369
|
+
allVersionsWithChannels: r.allVersions.map((n) => ({ version: n, channels: [] }))
|
|
1370
|
+
}).transform(
|
|
1371
|
+
(r) => r.latestByChannel[oe] ? r : {
|
|
1372
|
+
...r,
|
|
1373
|
+
latestByChannel: {
|
|
1374
|
+
...r.latestByChannel,
|
|
1375
|
+
[oe]: { description: r.latest, manifestSha256: r.latestManifestSha256 }
|
|
1376
|
+
}
|
|
1377
|
+
}
|
|
1378
|
+
).pipe(e.required({ allVersionsWithChannels: !0 }));
|
|
1379
|
+
}
|
|
1380
|
+
const Kn = ts(X);
|
|
1381
|
+
function Bt(t) {
|
|
1382
|
+
return L.object({
|
|
1383
|
+
schema: L.literal("v2"),
|
|
1384
|
+
packages: L.array(ts(t))
|
|
1385
|
+
});
|
|
1386
|
+
}
|
|
1387
|
+
const Br = Bt(X);
|
|
1388
|
+
function Zn(t) {
|
|
1389
|
+
return J(
|
|
1390
|
+
ue,
|
|
1391
|
+
M(
|
|
1392
|
+
Z.transform(Lt(t)),
|
|
1393
|
+
Q.transform(he(t))
|
|
1394
|
+
)
|
|
1395
|
+
);
|
|
1396
|
+
}
|
|
1397
|
+
function Qn(t) {
|
|
1398
|
+
return Bt(
|
|
1399
|
+
J(
|
|
1400
|
+
ue,
|
|
1401
|
+
M(
|
|
1402
|
+
Z.transform(Lt(t)),
|
|
1403
|
+
Q.transform(he(t))
|
|
1404
|
+
)
|
|
1405
|
+
)
|
|
1406
|
+
);
|
|
1407
|
+
}
|
|
1408
|
+
function ei(t) {
|
|
1409
|
+
return Bt(
|
|
1410
|
+
J(
|
|
1411
|
+
ue,
|
|
1412
|
+
M(
|
|
1413
|
+
Z.transform(Lt(t)),
|
|
1414
|
+
Q.transform(he(t))
|
|
1415
|
+
)
|
|
1416
|
+
)
|
|
1417
|
+
);
|
|
1418
|
+
}
|
|
1419
|
+
class ti {
|
|
1420
|
+
constructor(e, r = new Es()) {
|
|
1421
|
+
this.storage = e, this.logger = r;
|
|
1422
|
+
}
|
|
1423
|
+
async updateRegistry(e = "normal") {
|
|
1424
|
+
this.logger.info("Initiating registry refresh...");
|
|
1425
|
+
const r = /* @__PURE__ */ new Map(), n = [], a = await this.storage.listFiles(It), l = ({ organization: f, name: s, version: o }) => {
|
|
1426
|
+
const u = `${f}:${s}`;
|
|
1427
|
+
let h = r.get(u);
|
|
1428
|
+
if (h) {
|
|
1429
|
+
if (!h.versions.has(o))
|
|
1430
|
+
return h.versions.add(o), !0;
|
|
1431
|
+
} else return r.set(u, {
|
|
1432
|
+
package: { organization: f, name: s },
|
|
1433
|
+
versions: /* @__PURE__ */ new Set([o])
|
|
1434
|
+
}), !0;
|
|
1435
|
+
return !1;
|
|
1436
|
+
};
|
|
1437
|
+
this.logger.info("Packages to be updated:");
|
|
1438
|
+
for (const f of a) {
|
|
1439
|
+
const s = f.match(ln);
|
|
1440
|
+
if (!s) continue;
|
|
1441
|
+
n.push(f);
|
|
1442
|
+
const { organization: o, name: u, version: h, seed: m } = s.groups, p = l({ organization: o, name: u, version: h });
|
|
1443
|
+
this.logger.info(` - ${o}:${u}:${h} added:${p}`);
|
|
1444
|
+
}
|
|
1445
|
+
if (e === "force") {
|
|
1446
|
+
const f = await this.storage.listFiles(te);
|
|
1447
|
+
for (const s of f) {
|
|
1448
|
+
const o = s.match(En);
|
|
1449
|
+
if (!o) continue;
|
|
1450
|
+
const { organization: u, name: h, version: m } = o.groups, p = l({ organization: u, name: h, version: m });
|
|
1451
|
+
this.logger.info(` - ${u}:${h}:${m} force_added:${p}`);
|
|
1452
|
+
}
|
|
1453
|
+
}
|
|
1454
|
+
const c = await this.storage.getFile(mt);
|
|
1455
|
+
let i = (c === void 0 ? { packages: [] } : Br.parse(JSON.parse(c.toString()))).packages;
|
|
1456
|
+
this.logger.info(`Global overview loaded, ${i.length} records`);
|
|
1457
|
+
for (const [, f] of r.entries()) {
|
|
1458
|
+
const s = Dr(f.package), o = await this.storage.getFile(s), u = o === void 0 ? { versions: [] } : qr.parse(JSON.parse(o.toString()));
|
|
1459
|
+
this.logger.info(
|
|
1460
|
+
`Updating ${f.package.organization}:${f.package.name} overview, ${u.versions.length} records`
|
|
1461
|
+
);
|
|
1462
|
+
const h = u.versions.filter(
|
|
1463
|
+
(v) => !f.versions.has(v.description.id.version)
|
|
1464
|
+
);
|
|
1465
|
+
for (const [v] of f.versions.entries()) {
|
|
1466
|
+
const $ = v.toString(), N = {
|
|
1467
|
+
...f.package,
|
|
1468
|
+
version: $
|
|
1469
|
+
}, I = await this.storage.getFile(
|
|
1470
|
+
ne(N) + hn
|
|
1471
|
+
);
|
|
1472
|
+
if (!I) continue;
|
|
1473
|
+
const F = await St(I), b = (await this.storage.listFiles(mn(N))).filter((T) => T.match(gt) ? !0 : (this.logger.warn(`Unexpected channel in ${ye(N)}: ${T}`), !1));
|
|
1474
|
+
h.push({
|
|
1475
|
+
description: Ut($).parse(
|
|
1476
|
+
xr.parse(JSON.parse(I.toString("utf8"))).description
|
|
1477
|
+
),
|
|
1478
|
+
manifestSha256: F,
|
|
1479
|
+
channels: b
|
|
1480
|
+
});
|
|
1481
|
+
}
|
|
1482
|
+
h.sort(
|
|
1483
|
+
(v, $) => Qr.compare($.description.id.version, v.description.id.version)
|
|
1484
|
+
), e !== "dry-run" && await this.storage.putFile(
|
|
1485
|
+
s,
|
|
1486
|
+
Buffer.from(
|
|
1487
|
+
JSON.stringify({ schema: "v2", versions: h })
|
|
1488
|
+
)
|
|
1489
|
+
), this.logger.info(`Done (${h.length} records)`);
|
|
1490
|
+
const m = /* @__PURE__ */ new Set();
|
|
1491
|
+
for (const v of h) for (const $ of v.channels) m.add($);
|
|
1492
|
+
i = i.filter(
|
|
1493
|
+
(v) => v.id.organization !== f.package.organization || v.id.name !== f.package.name
|
|
1494
|
+
);
|
|
1495
|
+
const p = Ut(
|
|
1496
|
+
`${f.package.organization}/${f.package.name}`
|
|
1497
|
+
);
|
|
1498
|
+
i.push({
|
|
1499
|
+
id: {
|
|
1500
|
+
organization: f.package.organization,
|
|
1501
|
+
name: f.package.name
|
|
1502
|
+
},
|
|
1503
|
+
// left for backward compatibility
|
|
1504
|
+
allVersions: h.map((v) => v.description.id.version).reverse(),
|
|
1505
|
+
allVersionsWithChannels: h.map((v) => ({ version: v.description.id.version, channels: v.channels })).reverse(),
|
|
1506
|
+
// left for backward compatibility
|
|
1507
|
+
latest: p.parse(h[0].description),
|
|
1508
|
+
// left for backward compatibility
|
|
1509
|
+
latestManifestSha256: h[0].manifestSha256,
|
|
1510
|
+
latestByChannel: Object.fromEntries(
|
|
1511
|
+
[...m, oe].map((v) => {
|
|
1512
|
+
const $ = h.find((N) => v === oe || N.channels.indexOf(v) !== -1);
|
|
1513
|
+
if (!$) throw new Error("Assertion error");
|
|
1514
|
+
return [
|
|
1515
|
+
v,
|
|
1516
|
+
{
|
|
1517
|
+
description: p.parse($.description),
|
|
1518
|
+
manifestSha256: $ == null ? void 0 : $.manifestSha256
|
|
1519
|
+
}
|
|
1520
|
+
];
|
|
1521
|
+
})
|
|
1522
|
+
)
|
|
1523
|
+
});
|
|
1524
|
+
}
|
|
1525
|
+
e !== "dry-run" && await this.storage.putFile(
|
|
1526
|
+
mt,
|
|
1527
|
+
Buffer.from(
|
|
1528
|
+
JSON.stringify({ schema: "v2", packages: i })
|
|
1529
|
+
)
|
|
1530
|
+
), this.logger.info(`Global overview updated (${i.length} records)`), e !== "dry-run" && await this.storage.deleteFiles(...n.map((f) => `${It}${f}`)), this.logger.info("Version update requests cleared");
|
|
1531
|
+
}
|
|
1532
|
+
async updateIfNeeded(e = "normal") {
|
|
1533
|
+
this.logger.info("Checking if registry requires refresh...");
|
|
1534
|
+
const r = await this.storage.getFile(dt), n = await this.storage.getFile(br);
|
|
1535
|
+
if (e !== "force" && r === void 0 && n === void 0) {
|
|
1536
|
+
this.logger.info("No global seed files found, update not needed.");
|
|
1537
|
+
return;
|
|
1538
|
+
}
|
|
1539
|
+
if (e !== "force" && r !== void 0 && n !== void 0 && r.equals(n)) {
|
|
1540
|
+
this.logger.info("Registry is up to date.");
|
|
1541
|
+
return;
|
|
1542
|
+
}
|
|
1543
|
+
await this.updateRegistry(e), r && (e !== "dry-run" && await this.storage.putFile(br, r), this.logger.info("Refresh finished."));
|
|
1544
|
+
}
|
|
1545
|
+
async getPackageOverview(e) {
|
|
1546
|
+
const r = await this.storage.getFile(Dr(e));
|
|
1547
|
+
if (r !== void 0)
|
|
1548
|
+
return qr.parse(JSON.parse(r.toString()));
|
|
1549
|
+
}
|
|
1550
|
+
async getGlobalOverview() {
|
|
1551
|
+
const e = await this.storage.getFile(mt);
|
|
1552
|
+
if (e !== void 0)
|
|
1553
|
+
return Br.parse(JSON.parse(e.toString()));
|
|
1554
|
+
}
|
|
1555
|
+
async marchChanged(e) {
|
|
1556
|
+
const r = zr(), n = cn(e, r);
|
|
1557
|
+
this.logger.info(`Creating update seed at ${n} ...`), await this.storage.putFile(n, Buffer.from(r)), this.logger.info(`Touching global update seed ${dt} ...`), await this.storage.putFile(dt, Buffer.from(r));
|
|
1558
|
+
}
|
|
1559
|
+
async addPackageToChannel(e, r) {
|
|
1560
|
+
if (!r.match(gt))
|
|
1561
|
+
throw new Error(`Illegal characters in channel name: ${r}`);
|
|
1562
|
+
const n = ne(e);
|
|
1563
|
+
if (await this.storage.getFile(`${n}/${ie}`) === void 0)
|
|
1564
|
+
throw new Error(`Package ${ye(e)} not found in the registry.`);
|
|
1565
|
+
await this.storage.putFile(`${n}/${Ot}/${r}`, Buffer.from(r)), await this.marchChanged(e);
|
|
1566
|
+
}
|
|
1567
|
+
async removePackageFromChannel(e, r) {
|
|
1568
|
+
if (!r.match(gt))
|
|
1569
|
+
throw new Error(`Illegal characters in channel name: ${r}`);
|
|
1570
|
+
const n = ne(e);
|
|
1571
|
+
if (await this.storage.getFile(`${n}/${ie}`) === void 0)
|
|
1572
|
+
throw new Error(`Package ${ye(e)} not found in the registry.`);
|
|
1573
|
+
await this.storage.deleteFiles(`${n}/${Ot}/${r}`), await this.marchChanged(e);
|
|
1574
|
+
}
|
|
1575
|
+
async publishPackage(e, r) {
|
|
1576
|
+
const n = ne(e.description.id);
|
|
1577
|
+
for (const l of e.files) {
|
|
1578
|
+
const c = await r(l.name);
|
|
1579
|
+
if (c.length !== l.size)
|
|
1580
|
+
throw new Error(
|
|
1581
|
+
`Actual file size don't match file size from the manifest file for ${l.name} (actual = ${c.length}; manifest = ${l.size})`
|
|
1582
|
+
);
|
|
1583
|
+
const d = await St(c);
|
|
1584
|
+
if (d !== l.sha256.toUpperCase())
|
|
1585
|
+
throw new Error(
|
|
1586
|
+
`Actual file SHA-256 don't match the checksum from the manifest file for ${l.name} (actual = ${d}; manifest = ${l.sha256.toUpperCase()})`
|
|
1587
|
+
);
|
|
1588
|
+
const i = n + "/" + l.name;
|
|
1589
|
+
this.logger.info(`Uploading ${l.name} -> ${i} ...`), await this.storage.putFile(i, c);
|
|
1590
|
+
}
|
|
1591
|
+
const a = n + "/" + ie;
|
|
1592
|
+
this.logger.info(`Uploading manifest to ${a} ...`), await this.storage.putFile(a, Buffer.from(JSON.stringify(e))), await this.marchChanged(e.description.id);
|
|
1593
|
+
}
|
|
1594
|
+
}
|
|
1595
|
+
class vn {
|
|
1596
|
+
constructor(e, r, n) {
|
|
1597
|
+
this.client = e, this.bucket = r, this.root = n;
|
|
1598
|
+
}
|
|
1599
|
+
async getFile(e) {
|
|
1600
|
+
try {
|
|
1601
|
+
return Buffer.from(
|
|
1602
|
+
await (await this.client.getObject({
|
|
1603
|
+
Bucket: this.bucket,
|
|
1604
|
+
Key: U.join(this.root, e)
|
|
1605
|
+
})).Body.transformToByteArray()
|
|
1606
|
+
);
|
|
1607
|
+
} catch (r) {
|
|
1608
|
+
if (r.name === "NoSuchKey") return;
|
|
1609
|
+
throw r;
|
|
1610
|
+
}
|
|
1611
|
+
}
|
|
1612
|
+
async listFiles(e) {
|
|
1613
|
+
const r = U.join(this.root, e), n = Rs(
|
|
1614
|
+
{ client: this.client },
|
|
1615
|
+
{
|
|
1616
|
+
Bucket: this.bucket,
|
|
1617
|
+
Prefix: r
|
|
1618
|
+
}
|
|
1619
|
+
), a = [];
|
|
1620
|
+
for await (const l of n)
|
|
1621
|
+
a.push(...(l.Contents ?? []).map((c) => U.relative(r, c.Key)));
|
|
1622
|
+
return a;
|
|
1623
|
+
}
|
|
1624
|
+
async putFile(e, r) {
|
|
1625
|
+
await this.client.putObject({
|
|
1626
|
+
Bucket: this.bucket,
|
|
1627
|
+
Key: U.join(this.root, e),
|
|
1628
|
+
Body: r
|
|
1629
|
+
});
|
|
1630
|
+
}
|
|
1631
|
+
async deleteFiles(...e) {
|
|
1632
|
+
const r = await this.client.deleteObjects({
|
|
1633
|
+
Bucket: this.bucket,
|
|
1634
|
+
Delete: {
|
|
1635
|
+
Objects: e.map((n) => ({
|
|
1636
|
+
Key: U.join(this.root, n)
|
|
1637
|
+
}))
|
|
1638
|
+
}
|
|
1639
|
+
});
|
|
1640
|
+
if (r.Errors !== void 0 && r.Errors.length > 0)
|
|
1641
|
+
throw new Error(`Errors encountered while deleting files: ${r.Errors.join(`
|
|
1642
|
+
`)}`);
|
|
1643
|
+
}
|
|
1644
|
+
}
|
|
1645
|
+
class $n {
|
|
1646
|
+
constructor(e) {
|
|
1647
|
+
/** Absolute path */
|
|
1648
|
+
re(this, "root");
|
|
1649
|
+
this.root = B.resolve(e);
|
|
1650
|
+
}
|
|
1651
|
+
toAbsolutePath(e) {
|
|
1652
|
+
if (U.isAbsolute(e)) throw new Error("absolute path");
|
|
1653
|
+
return B.resolve(this.root, e.split(U.sep).join(B.sep));
|
|
1654
|
+
}
|
|
1655
|
+
async getFile(e) {
|
|
1656
|
+
try {
|
|
1657
|
+
return await K.promises.readFile(this.toAbsolutePath(e));
|
|
1658
|
+
} catch (r) {
|
|
1659
|
+
if (r.code == "ENOENT") return;
|
|
1660
|
+
throw new Error("", { cause: r });
|
|
1661
|
+
}
|
|
1662
|
+
}
|
|
1663
|
+
async listFiles(e) {
|
|
1664
|
+
try {
|
|
1665
|
+
const r = this.toAbsolutePath(e);
|
|
1666
|
+
return (await K.promises.readdir(r, { recursive: !0, withFileTypes: !0 })).filter((n) => n.isFile()).map(
|
|
1667
|
+
(n) => B.relative(r, B.resolve(n.path, n.name)).split(B.sep).join(U.sep)
|
|
1668
|
+
);
|
|
1669
|
+
} catch (r) {
|
|
1670
|
+
if (r.code == "ENOENT") return [];
|
|
1671
|
+
throw new Error("", { cause: r });
|
|
1672
|
+
}
|
|
1673
|
+
}
|
|
1674
|
+
async putFile(e, r) {
|
|
1675
|
+
const n = this.toAbsolutePath(e);
|
|
1676
|
+
await K.promises.mkdir(B.dirname(n), { recursive: !0 }), await K.promises.writeFile(n, r);
|
|
1677
|
+
}
|
|
1678
|
+
async deleteFiles(...e) {
|
|
1679
|
+
for (const r of e) await K.promises.rm(this.toAbsolutePath(r));
|
|
1680
|
+
}
|
|
1681
|
+
}
|
|
1682
|
+
function Rn(t) {
|
|
1683
|
+
const e = new URL(t, `file:${B.resolve(".").split(B.sep).join(U.sep)}/`);
|
|
1684
|
+
switch (e.protocol) {
|
|
1685
|
+
case "file:":
|
|
1686
|
+
const r = B.resolve(e.pathname);
|
|
1687
|
+
return new $n(r);
|
|
1688
|
+
case "s3:":
|
|
1689
|
+
const n = {}, a = e.searchParams.get("region");
|
|
1690
|
+
a && (n.region = a);
|
|
1691
|
+
const l = e.hostname;
|
|
1692
|
+
return new vn(new $s(n), l, e.pathname.replace(/^\//, ""));
|
|
1693
|
+
default:
|
|
1694
|
+
throw new Error(`Unknown protocol: ${e.protocol}`);
|
|
1695
|
+
}
|
|
1696
|
+
}
|
|
1697
|
+
const wn = L.string().regex(/^(?:s3:|file:)/), Sn = L.object({
|
|
1698
|
+
organization: L.string(),
|
|
1699
|
+
package: L.string(),
|
|
1700
|
+
version: kt.optional(),
|
|
1701
|
+
files: L.record(L.string().regex(/^[^\/]+$/), L.string()).default({}),
|
|
1702
|
+
meta: L.object({}).passthrough()
|
|
1703
|
+
}), yn = L.object({
|
|
1704
|
+
registries: L.record(L.string(), wn).default({}),
|
|
1705
|
+
registry: L.string().optional()
|
|
1706
|
+
}), rs = yn.merge(Sn).required(
|
|
1707
|
+
{ registry: !0, version: !0 }
|
|
1708
|
+
), _t = rs.partial().required({
|
|
1709
|
+
registries: !0,
|
|
1710
|
+
files: !0
|
|
1711
|
+
}), In = "pl.package.json", On = "pl.package.yaml", ve = "v1/";
|
|
1712
|
+
function ri(t) {
|
|
1713
|
+
return `${ve}${t.organization}/${t.package}/${t.version}`;
|
|
1714
|
+
}
|
|
1715
|
+
function ss(t, e) {
|
|
1716
|
+
return `${ve}${t.organization}/${t.package}/${t.version}/${e}`;
|
|
1717
|
+
}
|
|
1718
|
+
function _r(t) {
|
|
1719
|
+
return `${ve}${t.organization}/${t.package}/overview.json`;
|
|
1720
|
+
}
|
|
1721
|
+
const Et = `${ve}overview.json`, ns = "meta.json", Pt = "_updates_v1/per_package_version/";
|
|
1722
|
+
function Pn(t, e) {
|
|
1723
|
+
return `${Pt}${t.organization}/${t.package}/${t.version}/${e}`;
|
|
1724
|
+
}
|
|
1725
|
+
const Nn = /(?<packageKeyWithoutVersion>(?<organization>[^\/]+)\/(?<pkg>[^\/]+))\/(?<version>[^\/]+)\/(?<seed>[^\/]+)$/, is = "_updates_v1/_global_update_in", jr = "_updates_v1/_global_update_out";
|
|
1726
|
+
class kn {
|
|
1727
|
+
constructor(e, r) {
|
|
1728
|
+
this.storage = e, this.logger = r;
|
|
1729
|
+
}
|
|
1730
|
+
constructNewPackage(e) {
|
|
1731
|
+
return new Ln(this.storage, e);
|
|
1732
|
+
}
|
|
1733
|
+
async updateRegistry() {
|
|
1734
|
+
var c, d, i, f, s, o, u, h;
|
|
1735
|
+
(c = this.logger) == null || c.info("Initiating registry refresh...");
|
|
1736
|
+
const e = /* @__PURE__ */ new Map(), r = [], n = await this.storage.listFiles(Pt);
|
|
1737
|
+
(d = this.logger) == null || d.info("Packages to be updated:");
|
|
1738
|
+
for (const m of n) {
|
|
1739
|
+
const p = m.match(Nn);
|
|
1740
|
+
if (!p) continue;
|
|
1741
|
+
r.push(m);
|
|
1742
|
+
const { packageKeyWithoutVersion: v, organization: $, pkg: N, version: I, seed: F } = p.groups;
|
|
1743
|
+
let b = e.get(v);
|
|
1744
|
+
b ? b.versions.has(I) || b.versions.add(I) : e.set(v, {
|
|
1745
|
+
package: { organization: $, package: N },
|
|
1746
|
+
versions: /* @__PURE__ */ new Set([I])
|
|
1747
|
+
}), (i = this.logger) == null || i.info(` - ${$}:${N}:${I}`);
|
|
1748
|
+
}
|
|
1749
|
+
const a = await this.storage.getFile(Et);
|
|
1750
|
+
let l = a === void 0 ? [] : JSON.parse(a.toString());
|
|
1751
|
+
(f = this.logger) == null || f.info(`Global overview loaded, ${l.length} records`);
|
|
1752
|
+
for (const [, m] of e.entries()) {
|
|
1753
|
+
const p = _r(m.package), v = await this.storage.getFile(p);
|
|
1754
|
+
let $ = v === void 0 ? [] : JSON.parse(v.toString());
|
|
1755
|
+
(s = this.logger) == null || s.info(
|
|
1756
|
+
`Updating ${m.package.organization}:${m.package.package} overview, ${$.length} records`
|
|
1757
|
+
), $ = $.filter((N) => !m.versions.has(N.version));
|
|
1758
|
+
for (const [N] of m.versions.entries()) {
|
|
1759
|
+
const I = N.toString(), F = await this.storage.getFile(
|
|
1760
|
+
ss(
|
|
1761
|
+
{
|
|
1762
|
+
...m.package,
|
|
1763
|
+
version: I
|
|
1764
|
+
},
|
|
1765
|
+
ns
|
|
1766
|
+
)
|
|
1767
|
+
);
|
|
1768
|
+
F && $.push({ version: I, meta: JSON.parse(F.toString()) });
|
|
1769
|
+
}
|
|
1770
|
+
$.sort((N, I) => on.compare(I.version, N.version)), await this.storage.putFile(p, Buffer.from(JSON.stringify($))), (o = this.logger) == null || o.info(`Done (${$.length} records)`), l = l.filter(
|
|
1771
|
+
(N) => N.organization !== m.package.organization || N.package !== m.package.package
|
|
1772
|
+
), l.push({
|
|
1773
|
+
organization: m.package.organization,
|
|
1774
|
+
package: m.package.package,
|
|
1775
|
+
allVersions: $.map((N) => N.version).reverse(),
|
|
1776
|
+
latestVersion: $[0].version,
|
|
1777
|
+
latestMeta: $[0].meta
|
|
1778
|
+
});
|
|
1779
|
+
}
|
|
1780
|
+
await this.storage.putFile(Et, Buffer.from(JSON.stringify(l))), (u = this.logger) == null || u.info(`Global overview updated (${l.length} records)`), await this.storage.deleteFiles(...r.map((m) => `${Pt}${m}`)), (h = this.logger) == null || h.info("Version update requests cleared");
|
|
1781
|
+
}
|
|
1782
|
+
async updateIfNeeded(e = !1) {
|
|
1783
|
+
var a, l;
|
|
1784
|
+
(a = this.logger) == null || a.info("Checking if registry requires refresh...");
|
|
1785
|
+
const r = await this.storage.getFile(is), n = await this.storage.getFile(jr);
|
|
1786
|
+
!e && r === void 0 && n === void 0 || !e && r !== void 0 && n !== void 0 && r.equals(n) || (await this.updateRegistry(), r && (await this.storage.putFile(jr, r), (l = this.logger) == null || l.info("Refresh finished")));
|
|
1787
|
+
}
|
|
1788
|
+
async getPackageOverview(e) {
|
|
1789
|
+
const r = await this.storage.getFile(_r(e));
|
|
1790
|
+
if (r !== void 0)
|
|
1791
|
+
return JSON.parse(r.toString());
|
|
1792
|
+
}
|
|
1793
|
+
async getGlobalOverview() {
|
|
1794
|
+
const e = await this.storage.getFile(Et);
|
|
1795
|
+
if (e !== void 0)
|
|
1796
|
+
return JSON.parse(e.toString());
|
|
1797
|
+
}
|
|
1798
|
+
}
|
|
1799
|
+
class Ln {
|
|
1800
|
+
constructor(e, r) {
|
|
1801
|
+
re(this, "metaAdded", !1);
|
|
1802
|
+
re(this, "seed", zr());
|
|
1803
|
+
this.storage = e, this.name = r;
|
|
1804
|
+
}
|
|
1805
|
+
async addFile(e, r) {
|
|
1806
|
+
await this.storage.putFile(ss(this.name, e), r);
|
|
1807
|
+
}
|
|
1808
|
+
async writeMeta(e) {
|
|
1809
|
+
await this.addFile(ns, Buffer.from(JSON.stringify(e))), this.metaAdded = !0;
|
|
1810
|
+
}
|
|
1811
|
+
async finish() {
|
|
1812
|
+
if (!this.metaAdded) throw new Error("meta not added");
|
|
1813
|
+
await this.storage.putFile(Pn(this.name, this.seed), Buffer.of(0)), await this.storage.putFile(is, Buffer.from(this.seed));
|
|
1814
|
+
}
|
|
1815
|
+
}
|
|
1816
|
+
function z(t, e) {
|
|
1817
|
+
return e === void 0 ? t : {
|
|
1818
|
+
...t,
|
|
1819
|
+
...e,
|
|
1820
|
+
registries: { ...t.registries, ...e.registries },
|
|
1821
|
+
files: { ...t.files, ...e.files }
|
|
1822
|
+
};
|
|
1823
|
+
}
|
|
1824
|
+
async function vt(t) {
|
|
1825
|
+
return Ct(t, (e) => _t.parse(JSON.parse(e.toString())));
|
|
1826
|
+
}
|
|
1827
|
+
async function $t(t) {
|
|
1828
|
+
return Ct(t, (e) => _t.parse(vs.parse(e.toString())));
|
|
1829
|
+
}
|
|
1830
|
+
async function Cn() {
|
|
1831
|
+
let t = _t.parse({});
|
|
1832
|
+
return t = z(t, await vt("./.pl.reg.json")), t = z(t, await $t("./.pl.reg.yaml")), t = z(t, await vt(`${Gt.homedir()}/.pl.reg.json`)), t = z(t, await $t(`${Gt.homedir()}/.pl.reg.yaml`)), t = z(t, await vt(In)), t = z(t, await $t(On)), t;
|
|
1833
|
+
}
|
|
1834
|
+
class Tn {
|
|
1835
|
+
constructor(e) {
|
|
1836
|
+
this.conf = e;
|
|
1837
|
+
}
|
|
1838
|
+
createRegistry(e) {
|
|
1839
|
+
let r = this.conf.registry;
|
|
1840
|
+
if (!r.startsWith("file:") && !r.startsWith("s3:")) {
|
|
1841
|
+
const n = this.conf.registries[r];
|
|
1842
|
+
if (!n) throw new Error(`Registry with alias "${r}" not found`);
|
|
1843
|
+
r = n;
|
|
1844
|
+
}
|
|
1845
|
+
return new kn(Rn(r), e);
|
|
1846
|
+
}
|
|
1847
|
+
get fullPackageName() {
|
|
1848
|
+
return {
|
|
1849
|
+
organization: this.conf.organization,
|
|
1850
|
+
package: this.conf.package,
|
|
1851
|
+
version: this.conf.version
|
|
1852
|
+
};
|
|
1853
|
+
}
|
|
1854
|
+
}
|
|
1855
|
+
async function si(t) {
|
|
1856
|
+
const e = await Cn();
|
|
1857
|
+
return new Tn(
|
|
1858
|
+
rs.parse(z(e, t))
|
|
1859
|
+
);
|
|
1860
|
+
}
|
|
1861
|
+
export {
|
|
1862
|
+
Hn as $,
|
|
1863
|
+
Ss as A,
|
|
1864
|
+
Mn as B,
|
|
1865
|
+
xt as C,
|
|
1866
|
+
Xr as D,
|
|
1867
|
+
ys as E,
|
|
1868
|
+
$n as F,
|
|
1869
|
+
Br as G,
|
|
1870
|
+
Is as H,
|
|
1871
|
+
wt as I,
|
|
1872
|
+
Os as J,
|
|
1873
|
+
Lt as K,
|
|
1874
|
+
Ps as L,
|
|
1875
|
+
ie as M,
|
|
1876
|
+
Vn as N,
|
|
1877
|
+
he as O,
|
|
1878
|
+
_t as P,
|
|
1879
|
+
ks as Q,
|
|
1880
|
+
ws as R,
|
|
1881
|
+
vn as S,
|
|
1882
|
+
zn as T,
|
|
1883
|
+
Ls as U,
|
|
1884
|
+
Cs as V,
|
|
1885
|
+
Jr as W,
|
|
1886
|
+
Ts as X,
|
|
1887
|
+
Ut as Y,
|
|
1888
|
+
yt as Z,
|
|
1889
|
+
Wr as _,
|
|
1890
|
+
Ns as a,
|
|
1891
|
+
fn as a0,
|
|
1892
|
+
Ot as a1,
|
|
1893
|
+
gt as a2,
|
|
1894
|
+
ne as a3,
|
|
1895
|
+
pn as a4,
|
|
1896
|
+
qr as a5,
|
|
1897
|
+
dn as a6,
|
|
1898
|
+
Dr as a7,
|
|
1899
|
+
gn as a8,
|
|
1900
|
+
mn as a9,
|
|
1901
|
+
En as aa,
|
|
1902
|
+
mt as ab,
|
|
1903
|
+
ts as ac,
|
|
1904
|
+
Kn as ad,
|
|
1905
|
+
Bt as ae,
|
|
1906
|
+
Zn as af,
|
|
1907
|
+
Qn as ag,
|
|
1908
|
+
ei as ah,
|
|
1909
|
+
ti as b,
|
|
1910
|
+
Yn as c,
|
|
1911
|
+
Wn as d,
|
|
1912
|
+
on as e,
|
|
1913
|
+
te as f,
|
|
1914
|
+
si as g,
|
|
1915
|
+
Xn as h,
|
|
1916
|
+
un as i,
|
|
1917
|
+
hn as j,
|
|
1918
|
+
St as k,
|
|
1919
|
+
Fs as l,
|
|
1920
|
+
Jn as m,
|
|
1921
|
+
Et as n,
|
|
1922
|
+
ns as o,
|
|
1923
|
+
es as p,
|
|
1924
|
+
Sn as q,
|
|
1925
|
+
In as r,
|
|
1926
|
+
Rn as s,
|
|
1927
|
+
On as t,
|
|
1928
|
+
yn as u,
|
|
1929
|
+
rs as v,
|
|
1930
|
+
Tn as w,
|
|
1931
|
+
ri as x,
|
|
1932
|
+
_r as y,
|
|
1933
|
+
ss as z
|
|
1934
|
+
};
|
|
1935
|
+
//# sourceMappingURL=config-DrI3vxIZ.mjs.map
|