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