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