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