@moldea.ai/cli 14.0.0 → 14.0.2
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 +1 -1
- package/dist/chunks/{composition-_3bygS_a.js → composition-BzwNJ346.js} +2 -2
- package/dist/chunks/{composition-_3bygS_a.js.map → composition-BzwNJ346.js.map} +1 -1
- package/dist/chunks/{composition-D1OYuZ5d.js → composition-aJXeA6un.js} +1 -1
- package/dist/chunks/{core-composition-BKcJ--NX.js → core-composition-CzdeqYS9.js} +2 -2
- package/dist/chunks/{core-composition-BKcJ--NX.js.map → core-composition-CzdeqYS9.js.map} +1 -1
- package/dist/moldea.js +3 -3
- package/dist/portable/SHA256SUMS +16 -16
- package/dist/portable/analysis-worker.mjs +110 -133
- package/dist/portable/chunk-1b3c5f05.mjs +1837 -0
- package/dist/portable/chunk-24ea7c23.mjs +328 -0
- package/dist/portable/chunk-2cc3bf5c.mjs +399 -0
- package/dist/portable/chunk-2e9d4c63.mjs +95 -0
- package/dist/portable/chunk-8a1dadf9.mjs +2 -0
- package/dist/portable/chunk-8f198616.mjs +4414 -0
- package/dist/portable/chunk-936e5d09.mjs +112519 -0
- package/dist/portable/chunk-98d84174.mjs +422 -0
- package/dist/portable/chunk-a6007228.mjs +302 -0
- package/dist/portable/chunk-b1f86976.mjs +2 -0
- package/dist/portable/chunk-cea1378f.mjs +50 -0
- package/dist/portable/chunk-d372f5e0.mjs +3120 -0
- package/dist/portable/chunk-d6656fa6.mjs +14 -0
- package/dist/portable/moldea.mjs +1997 -2870
- package/dist/portable/node-runner.mjs +77 -106
- package/package.json +2 -2
- package/dist/portable/chunk-131f8005.mjs +0 -115
- package/dist/portable/chunk-2ba7e89e.mjs +0 -26
- package/dist/portable/chunk-459da9cf.mjs +0 -4138
- package/dist/portable/chunk-728df961.mjs +0 -544
- package/dist/portable/chunk-8d6114d2.mjs +0 -588
- package/dist/portable/chunk-90403e67.mjs +0 -2
- package/dist/portable/chunk-94b5ac22.mjs +0 -59
- package/dist/portable/chunk-a5514957.mjs +0 -5870
- package/dist/portable/chunk-b98ca669.mjs +0 -2
- package/dist/portable/chunk-c13db66a.mjs +0 -380
- package/dist/portable/chunk-d5af3eda.mjs +0 -2926
- package/dist/portable/chunk-ec3f49d3.mjs +0 -367
- package/dist/portable/chunk-fcbcf4e3.mjs +0 -147458
|
@@ -1,2926 +0,0 @@
|
|
|
1
|
-
import { t as __commonJSMin } from "./chunk-2ba7e89e.mjs";
|
|
2
|
-
import { f as Exception, p as getErrorCode, s as stringifyJsonDeterministically } from "./chunk-728df961.mjs";
|
|
3
|
-
import { m as takeWithinByteBudget, n as SUPPORTED_REPOSITORY_FORMAT_VERSIONS, p as deepFreeze } from "./chunk-a5514957.mjs";
|
|
4
|
-
import { execFile, spawn } from "node:child_process";
|
|
5
|
-
import { setTimeout as setTimeout$1 } from "node:timers/promises";
|
|
6
|
-
import { createHash, timingSafeEqual } from "node:crypto";
|
|
7
|
-
import { stat } from "node:fs/promises";
|
|
8
|
-
//#region ../../node_modules/.pnpm/jg-process@1.6.2/node_modules/jg-process/dist/shared/constants.js
|
|
9
|
-
var DEFAULT_MAX_OUTPUT_BYTES = 1048576;
|
|
10
|
-
//#endregion
|
|
11
|
-
//#region ../../node_modules/.pnpm/jg-process@1.6.2/node_modules/jg-process/dist/shared/errors.js
|
|
12
|
-
var ERRORS$2 = {
|
|
13
|
-
PROCESS_START_FAILED: "PROCESS_START_FAILED",
|
|
14
|
-
PROCESS_TIMED_OUT: "PROCESS_TIMED_OUT",
|
|
15
|
-
PROCESS_OUTPUT_TOO_LARGE: "PROCESS_OUTPUT_TOO_LARGE",
|
|
16
|
-
PROCESS_TREE_SURVIVED: "PROCESS_TREE_SURVIVED",
|
|
17
|
-
INVALID_PORT: "INVALID_PORT",
|
|
18
|
-
PORT_RESERVATION_FAILED: "PORT_RESERVATION_FAILED",
|
|
19
|
-
UNSUPPORTED_PACKAGE_MANAGER: "UNSUPPORTED_PACKAGE_MANAGER",
|
|
20
|
-
PACKAGE_MANAGER_NOT_FOUND: "PACKAGE_MANAGER_NOT_FOUND",
|
|
21
|
-
INVALID_READINESS_OPTIONS: "INVALID_READINESS_OPTIONS",
|
|
22
|
-
PROCESS_NOT_READY: "PROCESS_NOT_READY",
|
|
23
|
-
PROCESS_EXITED_BEFORE_READY: "PROCESS_EXITED_BEFORE_READY",
|
|
24
|
-
PROCESS_INTERRUPTED: "PROCESS_INTERRUPTED",
|
|
25
|
-
INVALID_SIGNAL: "INVALID_SIGNAL",
|
|
26
|
-
INVALID_PROCESS_OPTIONS: "INVALID_PROCESS_OPTIONS",
|
|
27
|
-
INVALID_PROCESS_ID: "INVALID_PROCESS_ID",
|
|
28
|
-
INVALID_ARGUMENTS: "INVALID_ARGUMENTS",
|
|
29
|
-
STDIN_TOO_LARGE: "STDIN_TOO_LARGE"
|
|
30
|
-
};
|
|
31
|
-
//#endregion
|
|
32
|
-
//#region ../../node_modules/.pnpm/jg-process@1.6.2/node_modules/jg-process/dist/process-tree/constants.js
|
|
33
|
-
var WINDOWS_PROCESS_LIST_COMMAND = "Get-CimInstance -ClassName Win32_Process | ForEach-Object { '{0} {1} {2}' -f $_.ProcessId, $_.ParentProcessId, $(if ($_.CreationDate) { $_.CreationDate.ToFileTimeUtc() } else { 0 }) }";
|
|
34
|
-
var WINDOWS_PROCESS_LINE_PATTERN = /^(\d+) (\d+) (\d+)$/u;
|
|
35
|
-
//#endregion
|
|
36
|
-
//#region ../../node_modules/.pnpm/jg-process@1.6.2/node_modules/jg-process/dist/process-tree/utilities.js
|
|
37
|
-
var hasExited = (child) => child.exitCode !== null || child.signalCode !== null;
|
|
38
|
-
var waitFor = async (condition, milliseconds) => {
|
|
39
|
-
const deadline = Date.now() + milliseconds;
|
|
40
|
-
while (!condition()) {
|
|
41
|
-
if (Date.now() >= deadline) return false;
|
|
42
|
-
await setTimeout$1(50);
|
|
43
|
-
}
|
|
44
|
-
return true;
|
|
45
|
-
};
|
|
46
|
-
var treeSurvived = (pid) => new Exception(`The process tree of pid ${pid} is still running after it was force-stopped.`, { code: ERRORS$2.PROCESS_TREE_SURVIVED });
|
|
47
|
-
var parseWindowsProcessList = (output) => output.split(/\r?\n/u).flatMap((line) => {
|
|
48
|
-
const match = WINDOWS_PROCESS_LINE_PATTERN.exec(line.trim());
|
|
49
|
-
if (match === null) return [];
|
|
50
|
-
const [, pid = "", parentPid = "", createdAt = ""] = match;
|
|
51
|
-
return [{
|
|
52
|
-
pid: Number(pid),
|
|
53
|
-
parentPid: Number(parentPid),
|
|
54
|
-
createdAt: BigInt(createdAt)
|
|
55
|
-
}];
|
|
56
|
-
});
|
|
57
|
-
var findWindowsDescendants = (processes, pid) => {
|
|
58
|
-
const childrenByParent = new Map();
|
|
59
|
-
for (const entry of processes) {
|
|
60
|
-
const siblings = childrenByParent.get(entry.parentPid);
|
|
61
|
-
if (siblings === void 0) childrenByParent.set(entry.parentPid, [entry]);
|
|
62
|
-
else siblings.push(entry);
|
|
63
|
-
}
|
|
64
|
-
const root = processes.find((entry) => entry.pid === pid);
|
|
65
|
-
if (root === void 0) return [];
|
|
66
|
-
const tree = [root];
|
|
67
|
-
const seen = new Set([pid]);
|
|
68
|
-
for (const parent of tree) for (const entry of childrenByParent.get(parent.pid) ?? []) if (!seen.has(entry.pid) && entry.createdAt >= parent.createdAt) {
|
|
69
|
-
seen.add(entry.pid);
|
|
70
|
-
tree.push(entry);
|
|
71
|
-
}
|
|
72
|
-
return tree.slice(1).map((entry) => entry.pid);
|
|
73
|
-
};
|
|
74
|
-
//#endregion
|
|
75
|
-
//#region ../../node_modules/.pnpm/jg-process@1.6.2/node_modules/jg-process/dist/process-tree/stop-windows-tree.js
|
|
76
|
-
var listWindowsDescendants = (pid) => new Promise((resolve) => {
|
|
77
|
-
execFile("powershell.exe", [
|
|
78
|
-
"-NoProfile",
|
|
79
|
-
"-NonInteractive",
|
|
80
|
-
"-Command",
|
|
81
|
-
WINDOWS_PROCESS_LIST_COMMAND
|
|
82
|
-
], {
|
|
83
|
-
timeout: 1e4,
|
|
84
|
-
windowsHide: true
|
|
85
|
-
}, (error, stdout) => {
|
|
86
|
-
resolve(error === null ? findWindowsDescendants(parseWindowsProcessList(stdout), pid) : []);
|
|
87
|
-
});
|
|
88
|
-
});
|
|
89
|
-
var isOwnProcessRunning = (pid) => {
|
|
90
|
-
try {
|
|
91
|
-
process.kill(pid, 0);
|
|
92
|
-
return true;
|
|
93
|
-
} catch {
|
|
94
|
-
return false;
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
var stopWindowsTree = async (child, pid) => {
|
|
98
|
-
if (hasExited(child)) return;
|
|
99
|
-
const descendants = new Set(await listWindowsDescendants(pid));
|
|
100
|
-
if (hasExited(child)) return;
|
|
101
|
-
await new Promise((resolve) => {
|
|
102
|
-
execFile("taskkill", [
|
|
103
|
-
"/PID",
|
|
104
|
-
String(pid),
|
|
105
|
-
"/T",
|
|
106
|
-
"/F"
|
|
107
|
-
], {
|
|
108
|
-
timeout: 1e4,
|
|
109
|
-
windowsHide: true
|
|
110
|
-
}, () => resolve());
|
|
111
|
-
});
|
|
112
|
-
const isStopped = () => {
|
|
113
|
-
for (const descendant of descendants) if (!isOwnProcessRunning(descendant)) descendants.delete(descendant);
|
|
114
|
-
return hasExited(child) && descendants.size === 0;
|
|
115
|
-
};
|
|
116
|
-
if (!await waitFor(isStopped, 1e4)) throw treeSurvived(pid);
|
|
117
|
-
};
|
|
118
|
-
//#endregion
|
|
119
|
-
//#region ../../node_modules/.pnpm/jg-process@1.6.2/node_modules/jg-process/dist/process-tree/process-tree.js
|
|
120
|
-
var IS_WINDOWS = process.platform === "win32";
|
|
121
|
-
var exists = (target) => {
|
|
122
|
-
try {
|
|
123
|
-
process.kill(target, 0);
|
|
124
|
-
return true;
|
|
125
|
-
} catch (error) {
|
|
126
|
-
return error.code === "EPERM";
|
|
127
|
-
}
|
|
128
|
-
};
|
|
129
|
-
var sendSignal = (target, signal) => {
|
|
130
|
-
try {
|
|
131
|
-
process.kill(target, signal);
|
|
132
|
-
return true;
|
|
133
|
-
} catch {
|
|
134
|
-
return false;
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
|
-
var isTreeStopped = (child, pid) => hasExited(child) && !exists(-pid);
|
|
138
|
-
var signalTree = (child, pid, signal) => {
|
|
139
|
-
if (!sendSignal(-pid, signal) && !hasExited(child)) sendSignal(pid, signal);
|
|
140
|
-
};
|
|
141
|
-
var stopPosixTree = async (child, pid, gracePeriodSeconds) => {
|
|
142
|
-
const isStopped = () => isTreeStopped(child, pid);
|
|
143
|
-
if (isStopped()) return;
|
|
144
|
-
signalTree(child, pid, "SIGTERM");
|
|
145
|
-
if (await waitFor(isStopped, gracePeriodSeconds * 1e3)) return;
|
|
146
|
-
signalTree(child, pid, "SIGKILL");
|
|
147
|
-
if (await waitFor(isStopped, 2e3)) return;
|
|
148
|
-
throw treeSurvived(pid);
|
|
149
|
-
};
|
|
150
|
-
var stopProcessTree = async (child, gracePeriodSeconds = 5) => {
|
|
151
|
-
const { pid } = child;
|
|
152
|
-
if (pid === void 0) return;
|
|
153
|
-
if (IS_WINDOWS) {
|
|
154
|
-
await stopWindowsTree(child, pid);
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
await stopPosixTree(child, pid, gracePeriodSeconds);
|
|
158
|
-
};
|
|
159
|
-
//#endregion
|
|
160
|
-
//#region ../../node_modules/.pnpm/jg-process@1.6.2/node_modules/jg-process/dist/run-process/constants.js
|
|
161
|
-
var IGNORED_STDIN_ERROR_CODES = [
|
|
162
|
-
"EPIPE",
|
|
163
|
-
"EOF",
|
|
164
|
-
"ERR_STREAM_DESTROYED"
|
|
165
|
-
];
|
|
166
|
-
//#endregion
|
|
167
|
-
//#region ../../node_modules/.pnpm/jg-process@1.6.2/node_modules/jg-process/dist/run-process/run-process.js
|
|
168
|
-
var startFailed = (command, cause) => new Exception(`Unable to start '${command}'.`, {
|
|
169
|
-
code: ERRORS$2.PROCESS_START_FAILED,
|
|
170
|
-
cause
|
|
171
|
-
});
|
|
172
|
-
var outputTooLarge = (command, maxOutputBytes) => new Exception(`The process '${command}' wrote more than ${maxOutputBytes} bytes of output.`, { code: ERRORS$2.PROCESS_OUTPUT_TOO_LARGE });
|
|
173
|
-
var validateLimits = (timeoutSeconds, maxOutputBytes) => {
|
|
174
|
-
if (!(timeoutSeconds === void 0 || typeof timeoutSeconds === "number" && Number.isFinite(timeoutSeconds) && timeoutSeconds > 0 && timeoutSeconds <= 2147483) || !Number.isSafeInteger(maxOutputBytes) || maxOutputBytes <= 0) throw new Exception("The timeout must be a positive number of at most 2,147,483 seconds, and the output limit a positive safe integer.", {
|
|
175
|
-
code: ERRORS$2.INVALID_PROCESS_OPTIONS,
|
|
176
|
-
data: {
|
|
177
|
-
timeoutSeconds: String(timeoutSeconds),
|
|
178
|
-
maxOutputBytes: String(maxOutputBytes)
|
|
179
|
-
}
|
|
180
|
-
});
|
|
181
|
-
};
|
|
182
|
-
var decodeOutput = (chunks, encoding) => {
|
|
183
|
-
const output = Buffer.concat(chunks);
|
|
184
|
-
return encoding === "buffer" ? output : output.toString("utf-8");
|
|
185
|
-
};
|
|
186
|
-
var destroyStdio = (child) => {
|
|
187
|
-
child.stdin?.destroy();
|
|
188
|
-
child.stdout?.destroy();
|
|
189
|
-
child.stderr?.destroy();
|
|
190
|
-
};
|
|
191
|
-
var waitForClose = (child, isClosed, milliseconds) => new Promise((resolve) => {
|
|
192
|
-
if (isClosed()) {
|
|
193
|
-
resolve(true);
|
|
194
|
-
return;
|
|
195
|
-
}
|
|
196
|
-
const onClose = () => {
|
|
197
|
-
clearTimeout(timer);
|
|
198
|
-
resolve(true);
|
|
199
|
-
};
|
|
200
|
-
const timer = setTimeout(() => {
|
|
201
|
-
child.off("close", onClose);
|
|
202
|
-
resolve(false);
|
|
203
|
-
}, milliseconds);
|
|
204
|
-
child.once("close", onClose);
|
|
205
|
-
});
|
|
206
|
-
var stopTree = async (child) => {
|
|
207
|
-
try {
|
|
208
|
-
await stopProcessTree(child);
|
|
209
|
-
} catch (error) {
|
|
210
|
-
destroyStdio(child);
|
|
211
|
-
throw error;
|
|
212
|
-
}
|
|
213
|
-
};
|
|
214
|
-
var runProcess = async (options) => {
|
|
215
|
-
const { command, args, cwd, env, input, timeoutSeconds, maxOutputBytes = DEFAULT_MAX_OUTPUT_BYTES, signal, encoding = "utf-8" } = options;
|
|
216
|
-
validateLimits(timeoutSeconds, maxOutputBytes);
|
|
217
|
-
signal?.throwIfAborted();
|
|
218
|
-
const startedAt = performance.now();
|
|
219
|
-
const child = spawn(command, args, {
|
|
220
|
-
cwd,
|
|
221
|
-
env,
|
|
222
|
-
stdio: "pipe",
|
|
223
|
-
detached: process.platform !== "win32",
|
|
224
|
-
windowsHide: true
|
|
225
|
-
});
|
|
226
|
-
const stdout = [];
|
|
227
|
-
const stderr = [];
|
|
228
|
-
let outputBytes = 0;
|
|
229
|
-
let isClosed = false;
|
|
230
|
-
child.once("close", () => {
|
|
231
|
-
isClosed = true;
|
|
232
|
-
});
|
|
233
|
-
const outcome = await new Promise((resolve) => {
|
|
234
|
-
let timer;
|
|
235
|
-
const onAbort = () => {
|
|
236
|
-
clearTimeout(timer);
|
|
237
|
-
resolve({
|
|
238
|
-
kind: "failed",
|
|
239
|
-
error: signal?.reason
|
|
240
|
-
});
|
|
241
|
-
};
|
|
242
|
-
const settle = (value) => {
|
|
243
|
-
clearTimeout(timer);
|
|
244
|
-
signal?.removeEventListener("abort", onAbort);
|
|
245
|
-
resolve(value);
|
|
246
|
-
};
|
|
247
|
-
const collect = (chunks) => (chunk) => {
|
|
248
|
-
outputBytes += chunk.length;
|
|
249
|
-
if (outputBytes > maxOutputBytes) {
|
|
250
|
-
settle({
|
|
251
|
-
kind: "failed",
|
|
252
|
-
error: outputTooLarge(command, maxOutputBytes)
|
|
253
|
-
});
|
|
254
|
-
return;
|
|
255
|
-
}
|
|
256
|
-
chunks.push(chunk);
|
|
257
|
-
};
|
|
258
|
-
child.stdout.on("data", collect(stdout));
|
|
259
|
-
child.stderr.on("data", collect(stderr));
|
|
260
|
-
child.stdout.on("error", () => void 0);
|
|
261
|
-
child.stderr.on("error", () => void 0);
|
|
262
|
-
child.on("error", (error) => settle({
|
|
263
|
-
kind: "failed",
|
|
264
|
-
error: startFailed(command, error)
|
|
265
|
-
}));
|
|
266
|
-
child.once("exit", (exitCode, signalCode) => settle({
|
|
267
|
-
kind: "exited",
|
|
268
|
-
exitCode,
|
|
269
|
-
signalCode
|
|
270
|
-
}));
|
|
271
|
-
child.stdin.on("error", (error) => {
|
|
272
|
-
if (!IGNORED_STDIN_ERROR_CODES.includes(error.code ?? "")) settle({
|
|
273
|
-
kind: "failed",
|
|
274
|
-
error: startFailed(command, error)
|
|
275
|
-
});
|
|
276
|
-
});
|
|
277
|
-
if (timeoutSeconds !== void 0) timer = setTimeout(() => settle({
|
|
278
|
-
kind: "failed",
|
|
279
|
-
error: new Exception(`The process '${command}' didn't finish within ${timeoutSeconds} seconds.`, { code: ERRORS$2.PROCESS_TIMED_OUT })
|
|
280
|
-
}), timeoutSeconds * 1e3);
|
|
281
|
-
signal?.addEventListener("abort", onAbort, { once: true });
|
|
282
|
-
child.stdin.end(input);
|
|
283
|
-
});
|
|
284
|
-
if (outcome.kind === "failed") {
|
|
285
|
-
await stopTree(child);
|
|
286
|
-
destroyStdio(child);
|
|
287
|
-
throw outcome.error;
|
|
288
|
-
}
|
|
289
|
-
await stopTree(child);
|
|
290
|
-
if (!await waitForClose(child, () => isClosed, 5e3)) {
|
|
291
|
-
destroyStdio(child);
|
|
292
|
-
throw new Exception(`A process started by '${command}' kept its output open after it exited.`, { code: ERRORS$2.PROCESS_TREE_SURVIVED });
|
|
293
|
-
}
|
|
294
|
-
if (outputBytes > maxOutputBytes) throw outputTooLarge(command, maxOutputBytes);
|
|
295
|
-
return {
|
|
296
|
-
exitCode: outcome.exitCode,
|
|
297
|
-
signalCode: outcome.signalCode,
|
|
298
|
-
stdout: decodeOutput(stdout, encoding),
|
|
299
|
-
stderr: decodeOutput(stderr, encoding),
|
|
300
|
-
durationMs: Math.round(performance.now() - startedAt)
|
|
301
|
-
};
|
|
302
|
-
};
|
|
303
|
-
//#endregion
|
|
304
|
-
//#region src/command-line/constants.ts
|
|
305
|
-
var MOLDEA_CLI_COMMANDS = {
|
|
306
|
-
Composition: "composition",
|
|
307
|
-
Content: "content",
|
|
308
|
-
Inspect: "inspect",
|
|
309
|
-
Scope: "scope",
|
|
310
|
-
Validate: "validate"
|
|
311
|
-
};
|
|
312
|
-
var MOLDEA_CLI_OPTIONS = {
|
|
313
|
-
Help: "--help",
|
|
314
|
-
Json: "--json",
|
|
315
|
-
Cursor: "--cursor",
|
|
316
|
-
MaxDiagnostics: "--max-diagnostics",
|
|
317
|
-
MaxEntries: "--max-entries",
|
|
318
|
-
MaxCoverage: "--max-coverage",
|
|
319
|
-
MaxFileBytes: "--max-file-bytes",
|
|
320
|
-
MaxManifestBytes: "--max-manifest-bytes",
|
|
321
|
-
MaxOutputBytes: "--max-output-bytes",
|
|
322
|
-
MaxTotalBytes: "--max-total-bytes",
|
|
323
|
-
NoColor: "--no-color",
|
|
324
|
-
Path: "--path",
|
|
325
|
-
PathsStdin: "--paths-stdin",
|
|
326
|
-
Repository: "--repository",
|
|
327
|
-
Version: "--version"
|
|
328
|
-
};
|
|
329
|
-
var DEFAULT_MOLDEA_CLI_RESOURCE_LIMITS = Object.freeze({
|
|
330
|
-
maxDiagnostics: 1e4,
|
|
331
|
-
maxEntries: 1e5,
|
|
332
|
-
maxCoverage: 1e4,
|
|
333
|
-
maxFileBytes: 8388608,
|
|
334
|
-
maxManifestBytes: 2097152,
|
|
335
|
-
maxTotalBytes: 134217728
|
|
336
|
-
});
|
|
337
|
-
var MOLDEA_CLI_DEFAULT_OUTPUT_BYTES = 65536;
|
|
338
|
-
//#endregion
|
|
339
|
-
//#region src/output-page/exception.ts
|
|
340
|
-
var MoldeaCliOutputPageException = class extends Error {
|
|
341
|
-
code;
|
|
342
|
-
constructor(code) {
|
|
343
|
-
super(code);
|
|
344
|
-
this.code = code;
|
|
345
|
-
this.name = "MoldeaCliOutputPageException";
|
|
346
|
-
}
|
|
347
|
-
};
|
|
348
|
-
//#endregion
|
|
349
|
-
//#region ../../node_modules/.pnpm/jg-crypto@0.3.0/node_modules/jg-crypto/dist/shared/errors.js
|
|
350
|
-
var ERRORS$1 = {
|
|
351
|
-
UNSUPPORTED_HASH_ALGORITHM: "UNSUPPORTED_HASH_ALGORITHM",
|
|
352
|
-
INVALID_BYTE_LENGTH: "INVALID_BYTE_LENGTH",
|
|
353
|
-
UNSUPPORTED_ENCODING: "UNSUPPORTED_ENCODING",
|
|
354
|
-
INVALID_DIGIT_COUNT: "INVALID_DIGIT_COUNT",
|
|
355
|
-
INVALID_HMAC_SECRET: "INVALID_HMAC_SECRET",
|
|
356
|
-
INVALID_HMAC_DOMAIN: "INVALID_HMAC_DOMAIN",
|
|
357
|
-
INVALID_TOTP_SECRET: "INVALID_TOTP_SECRET",
|
|
358
|
-
TOTP_INVALID: "TOTP_INVALID",
|
|
359
|
-
TOTP_ALREADY_USED: "TOTP_ALREADY_USED"
|
|
360
|
-
};
|
|
361
|
-
//#endregion
|
|
362
|
-
//#region ../../node_modules/.pnpm/jg-crypto@0.3.0/node_modules/jg-crypto/dist/hashing/hashing.js
|
|
363
|
-
var HASH_ALGORITHMS = [
|
|
364
|
-
"sha256",
|
|
365
|
-
"sha384",
|
|
366
|
-
"sha512"
|
|
367
|
-
];
|
|
368
|
-
var hashValue = (value, algorithm = "sha256") => {
|
|
369
|
-
if (!HASH_ALGORITHMS.includes(algorithm)) throw new Exception("The hash algorithm must be sha256, sha384, or sha512.", {
|
|
370
|
-
code: ERRORS$1.UNSUPPORTED_HASH_ALGORITHM,
|
|
371
|
-
data: { algorithm: String(algorithm) }
|
|
372
|
-
});
|
|
373
|
-
return createHash(algorithm).update(value).digest("hex");
|
|
374
|
-
};
|
|
375
|
-
//#endregion
|
|
376
|
-
//#region src/output-page/cursor.ts
|
|
377
|
-
var SHA256_PATTERN = /^sha256:[0-9a-f]{64}$/u;
|
|
378
|
-
var BASE64URL_PATTERN = /^[A-Za-z0-9_-]+$/u;
|
|
379
|
-
var CURSOR_DOCUMENT_KEYS = Object.freeze([
|
|
380
|
-
"checksum",
|
|
381
|
-
"command",
|
|
382
|
-
"filtersDigest",
|
|
383
|
-
"lastKey",
|
|
384
|
-
"snapshotDigest",
|
|
385
|
-
"sourceCursor",
|
|
386
|
-
"version"
|
|
387
|
-
]);
|
|
388
|
-
var calculateMoldeaCliJsonDigest = (value) => {
|
|
389
|
-
return `sha256:${hashValue(stringifyJsonDeterministically(value, { strict: true }))}`;
|
|
390
|
-
};
|
|
391
|
-
var calculateCursorChecksum = (payload) => {
|
|
392
|
-
return calculateMoldeaCliJsonDigest(payload);
|
|
393
|
-
};
|
|
394
|
-
var areChecksumsEqual = (left, right) => {
|
|
395
|
-
const leftBytes = Buffer.from(left, "utf8");
|
|
396
|
-
const rightBytes = Buffer.from(right, "utf8");
|
|
397
|
-
return leftBytes.length === rightBytes.length && timingSafeEqual(leftBytes, rightBytes);
|
|
398
|
-
};
|
|
399
|
-
var isCursorDocument = (value) => {
|
|
400
|
-
if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
|
|
401
|
-
const record = value;
|
|
402
|
-
const keys = Object.keys(record).sort();
|
|
403
|
-
return keys.length === CURSOR_DOCUMENT_KEYS.length && keys.every((key, index) => key === CURSOR_DOCUMENT_KEYS[index]) && record["version"] === 2 && (record["command"] === "content" || record["command"] === "inspect" || record["command"] === "scope" || record["command"] === "validate") && typeof record["filtersDigest"] === "string" && SHA256_PATTERN.test(record["filtersDigest"]) && typeof record["lastKey"] === "string" && record["lastKey"].length > 0 && (record["sourceCursor"] === null || typeof record["sourceCursor"] === "string") && typeof record["snapshotDigest"] === "string" && SHA256_PATTERN.test(record["snapshotDigest"]) && typeof record["checksum"] === "string" && SHA256_PATTERN.test(record["checksum"]);
|
|
404
|
-
};
|
|
405
|
-
var encodeMoldeaCliCursor = (command, filters, snapshotDigest, lastKey, sourceCursor = null) => {
|
|
406
|
-
const payload = {
|
|
407
|
-
command,
|
|
408
|
-
filtersDigest: calculateMoldeaCliJsonDigest(filters),
|
|
409
|
-
lastKey,
|
|
410
|
-
sourceCursor,
|
|
411
|
-
snapshotDigest,
|
|
412
|
-
version: 2
|
|
413
|
-
};
|
|
414
|
-
const document = {
|
|
415
|
-
...payload,
|
|
416
|
-
checksum: calculateCursorChecksum(payload)
|
|
417
|
-
};
|
|
418
|
-
return Buffer.from(stringifyJsonDeterministically(document, { strict: true }), "utf8").toString("base64url");
|
|
419
|
-
};
|
|
420
|
-
var decodeMoldeaCliCursor = (input) => {
|
|
421
|
-
let decoded;
|
|
422
|
-
try {
|
|
423
|
-
if (!BASE64URL_PATTERN.test(input.cursor)) throw new TypeError("The cursor is not canonical base64url.");
|
|
424
|
-
const bytes = Buffer.from(input.cursor, "base64url");
|
|
425
|
-
if (bytes.toString("base64url") !== input.cursor) throw new TypeError("The cursor is not canonical base64url.");
|
|
426
|
-
const text = bytes.toString("utf8");
|
|
427
|
-
decoded = JSON.parse(text);
|
|
428
|
-
} catch {
|
|
429
|
-
throw new MoldeaCliOutputPageException("CURSOR_INVALID");
|
|
430
|
-
}
|
|
431
|
-
if (!isCursorDocument(decoded)) throw new MoldeaCliOutputPageException("CURSOR_INVALID");
|
|
432
|
-
const { checksum, ...payload } = decoded;
|
|
433
|
-
if (!areChecksumsEqual(checksum, calculateCursorChecksum(payload)) || decoded.command !== input.command || decoded.filtersDigest !== calculateMoldeaCliJsonDigest(input.filters)) throw new MoldeaCliOutputPageException("CURSOR_INVALID");
|
|
434
|
-
if (input.snapshotDigest !== void 0 && decoded.snapshotDigest !== input.snapshotDigest) throw new MoldeaCliOutputPageException("CURSOR_SNAPSHOT_CHANGED");
|
|
435
|
-
return Object.freeze({
|
|
436
|
-
lastKey: decoded.lastKey,
|
|
437
|
-
snapshotDigest: decoded.snapshotDigest,
|
|
438
|
-
sourceCursor: decoded.sourceCursor
|
|
439
|
-
});
|
|
440
|
-
};
|
|
441
|
-
//#endregion
|
|
442
|
-
//#region src/output-page/page.ts
|
|
443
|
-
var assertRecordOrder = (records) => {
|
|
444
|
-
for (let index = 0; index < records.length; index += 1) {
|
|
445
|
-
const key = records[index]?.key;
|
|
446
|
-
const previousKey = records[index - 1]?.key;
|
|
447
|
-
if (key === void 0 || key.length === 0 || previousKey !== void 0 && key <= previousKey) throw new TypeError("Output records must have unique keys in ascending order.");
|
|
448
|
-
}
|
|
449
|
-
};
|
|
450
|
-
var createMoldeaCliOutputPage = (input) => {
|
|
451
|
-
assertRecordOrder(input.records);
|
|
452
|
-
const cursorState = input.cursor === null ? null : decodeMoldeaCliCursor({
|
|
453
|
-
command: input.command,
|
|
454
|
-
cursor: input.cursor,
|
|
455
|
-
filters: input.filters,
|
|
456
|
-
snapshotDigest: input.snapshotDigest
|
|
457
|
-
});
|
|
458
|
-
const startIndex = cursorState === null ? 0 : cursorState.sourceCursor !== null ? 0 : input.records.findIndex(({ key }) => key === cursorState.lastKey) + 1;
|
|
459
|
-
if (cursorState !== null && cursorState.sourceCursor === null && startIndex === 0) throw new MoldeaCliOutputPageException("CURSOR_INVALID");
|
|
460
|
-
const emptyRecords = Object.freeze([]);
|
|
461
|
-
const emptyPage = Object.freeze({
|
|
462
|
-
cursor: null,
|
|
463
|
-
records: emptyRecords
|
|
464
|
-
});
|
|
465
|
-
if (startIndex === input.records.length) {
|
|
466
|
-
if (input.measure(emptyPage, 2) > input.maxOutputBytes) throw new MoldeaCliOutputPageException("OUTPUT_BUDGET_TOO_SMALL");
|
|
467
|
-
return emptyPage;
|
|
468
|
-
}
|
|
469
|
-
const createCursor = (record, endIndex) => {
|
|
470
|
-
const sourceCursor = input.sourceCursorForRecord?.(record) ?? null;
|
|
471
|
-
return (input.sourceCursorForRecord === void 0 ? endIndex < input.records.length : sourceCursor !== null) ? encodeMoldeaCliCursor(input.command, input.filters, input.snapshotDigest, record.key, sourceCursor) : null;
|
|
472
|
-
};
|
|
473
|
-
const selectedRecords = takeWithinByteBudget(input.records.slice(startIndex), {
|
|
474
|
-
maxBytes: input.maxOutputBytes,
|
|
475
|
-
measurePage: (page, itemsBytes) => input.measure(Object.freeze({
|
|
476
|
-
cursor: createCursor(page[page.length - 1], startIndex + page.length),
|
|
477
|
-
records: page
|
|
478
|
-
}), itemsBytes)
|
|
479
|
-
});
|
|
480
|
-
const lastRecord = selectedRecords[selectedRecords.length - 1];
|
|
481
|
-
if (lastRecord === void 0) throw new MoldeaCliOutputPageException("OUTPUT_BUDGET_TOO_SMALL");
|
|
482
|
-
return Object.freeze({
|
|
483
|
-
cursor: createCursor(lastRecord, startIndex + selectedRecords.length),
|
|
484
|
-
records: Object.freeze(selectedRecords)
|
|
485
|
-
});
|
|
486
|
-
};
|
|
487
|
-
//#endregion
|
|
488
|
-
//#region src/command-line/validations.ts
|
|
489
|
-
var POSITIVE_INTEGER_PATTERN = /^\d+$/u;
|
|
490
|
-
var parsePositiveSafeInteger = (input) => {
|
|
491
|
-
if (!POSITIVE_INTEGER_PATTERN.test(input)) return null;
|
|
492
|
-
const parsedInteger = Number(input);
|
|
493
|
-
return Number.isSafeInteger(parsedInteger) && parsedInteger > 0 ? parsedInteger : null;
|
|
494
|
-
};
|
|
495
|
-
var parseMoldeaCliOutputByteLimit = (input) => {
|
|
496
|
-
const parsed = parsePositiveSafeInteger(input);
|
|
497
|
-
return parsed !== null && parsed >= 4096 && parsed <= 1048576 ? parsed : null;
|
|
498
|
-
};
|
|
499
|
-
var areMoldeaCliResourceLimitsConsistent = (limits) => {
|
|
500
|
-
return limits.maxManifestBytes <= limits.maxFileBytes && limits.maxFileBytes <= limits.maxTotalBytes;
|
|
501
|
-
};
|
|
502
|
-
var isRepositoryDirectoryInputValid = (input) => {
|
|
503
|
-
return input.length > 0 && !input.includes("\0") && input.isWellFormed();
|
|
504
|
-
};
|
|
505
|
-
var isMoldeaCliCursorInputValid = (input) => {
|
|
506
|
-
return input.length > 0 && input.length <= 16384 && !input.includes("\0") && input.isWellFormed();
|
|
507
|
-
};
|
|
508
|
-
//#endregion
|
|
509
|
-
//#region src/command-line/parser.ts
|
|
510
|
-
var COMMAND_NAMES = new Set(Object.values(MOLDEA_CLI_COMMANDS));
|
|
511
|
-
var RESOURCE_OPTION_FIELDS = {
|
|
512
|
-
[MOLDEA_CLI_OPTIONS.MaxDiagnostics]: "maxDiagnostics",
|
|
513
|
-
[MOLDEA_CLI_OPTIONS.MaxEntries]: "maxEntries",
|
|
514
|
-
[MOLDEA_CLI_OPTIONS.MaxCoverage]: "maxCoverage",
|
|
515
|
-
[MOLDEA_CLI_OPTIONS.MaxFileBytes]: "maxFileBytes",
|
|
516
|
-
[MOLDEA_CLI_OPTIONS.MaxManifestBytes]: "maxManifestBytes",
|
|
517
|
-
[MOLDEA_CLI_OPTIONS.MaxTotalBytes]: "maxTotalBytes"
|
|
518
|
-
};
|
|
519
|
-
var createArgumentError = (code, command, isJson) => ({
|
|
520
|
-
code,
|
|
521
|
-
command,
|
|
522
|
-
isJson,
|
|
523
|
-
kind: "error"
|
|
524
|
-
});
|
|
525
|
-
var isMoldeaCliCommand = (input) => {
|
|
526
|
-
return input !== void 0 && COMMAND_NAMES.has(input);
|
|
527
|
-
};
|
|
528
|
-
var parseMoldeaCliArguments = (commandLineArguments) => {
|
|
529
|
-
const isJson = commandLineArguments.includes(MOLDEA_CLI_OPTIONS.Json);
|
|
530
|
-
if (commandLineArguments.length === 0) return {
|
|
531
|
-
command: null,
|
|
532
|
-
kind: "help"
|
|
533
|
-
};
|
|
534
|
-
const firstArgument = commandLineArguments[0];
|
|
535
|
-
if (firstArgument === MOLDEA_CLI_OPTIONS.Help) return commandLineArguments.length === 1 ? {
|
|
536
|
-
command: null,
|
|
537
|
-
kind: "help"
|
|
538
|
-
} : createArgumentError("INVALID_ARGUMENT", null, isJson);
|
|
539
|
-
if (firstArgument === MOLDEA_CLI_OPTIONS.Version) return commandLineArguments.length === 1 ? { kind: "version" } : createArgumentError("INVALID_ARGUMENT", null, isJson);
|
|
540
|
-
const command = isMoldeaCliCommand(firstArgument) ? firstArgument : null;
|
|
541
|
-
if (command === null) return createArgumentError("INVALID_ARGUMENT", null, isJson);
|
|
542
|
-
if (commandLineArguments.length === 2 && commandLineArguments[1] === MOLDEA_CLI_OPTIONS.Help) return {
|
|
543
|
-
command,
|
|
544
|
-
kind: "help"
|
|
545
|
-
};
|
|
546
|
-
const seenOptions = new Set();
|
|
547
|
-
const resourceLimits = { ...DEFAULT_MOLDEA_CLI_RESOURCE_LIMITS };
|
|
548
|
-
let isColorDisabled = false;
|
|
549
|
-
let cursor = null;
|
|
550
|
-
let maxOutputBytes = MOLDEA_CLI_DEFAULT_OUTPUT_BYTES;
|
|
551
|
-
let path = null;
|
|
552
|
-
let pathsInput = "none";
|
|
553
|
-
let repositoryDirectory = null;
|
|
554
|
-
for (let index = 1; index < commandLineArguments.length; index += 1) {
|
|
555
|
-
const option = commandLineArguments[index];
|
|
556
|
-
if (option === void 0 || seenOptions.has(option)) return createArgumentError("INVALID_ARGUMENT", command, isJson);
|
|
557
|
-
seenOptions.add(option);
|
|
558
|
-
if (option === MOLDEA_CLI_OPTIONS.Json) continue;
|
|
559
|
-
if (option === MOLDEA_CLI_OPTIONS.NoColor) {
|
|
560
|
-
isColorDisabled = true;
|
|
561
|
-
continue;
|
|
562
|
-
}
|
|
563
|
-
if (option === MOLDEA_CLI_OPTIONS.PathsStdin) {
|
|
564
|
-
pathsInput = "stdin";
|
|
565
|
-
continue;
|
|
566
|
-
}
|
|
567
|
-
if (option === MOLDEA_CLI_OPTIONS.Help || option === MOLDEA_CLI_OPTIONS.Version) return createArgumentError("INVALID_ARGUMENT", command, isJson);
|
|
568
|
-
const resourceField = RESOURCE_OPTION_FIELDS[option];
|
|
569
|
-
const isRepositoryOption = option === MOLDEA_CLI_OPTIONS.Repository;
|
|
570
|
-
const isCursorOption = option === MOLDEA_CLI_OPTIONS.Cursor;
|
|
571
|
-
const isOutputLimitOption = option === MOLDEA_CLI_OPTIONS.MaxOutputBytes;
|
|
572
|
-
const isPathOption = option === MOLDEA_CLI_OPTIONS.Path;
|
|
573
|
-
if (resourceField === void 0 && !isRepositoryOption && !isCursorOption && !isOutputLimitOption && !isPathOption) return createArgumentError("INVALID_ARGUMENT", command, isJson);
|
|
574
|
-
if (command === MOLDEA_CLI_COMMANDS.Composition) return createArgumentError("INVALID_ARGUMENT", command, isJson);
|
|
575
|
-
const optionValue = commandLineArguments[index + 1];
|
|
576
|
-
if (optionValue === void 0 || optionValue.startsWith("--")) return createArgumentError("INVALID_ARGUMENT", command, isJson);
|
|
577
|
-
index += 1;
|
|
578
|
-
if (isCursorOption) {
|
|
579
|
-
if (!isMoldeaCliCursorInputValid(optionValue)) return createArgumentError("INVALID_ARGUMENT", command, isJson);
|
|
580
|
-
cursor = optionValue;
|
|
581
|
-
continue;
|
|
582
|
-
}
|
|
583
|
-
if (isOutputLimitOption) {
|
|
584
|
-
const parsedOutputLimit = parseMoldeaCliOutputByteLimit(optionValue);
|
|
585
|
-
if (parsedOutputLimit === null) return createArgumentError("RESOURCE_LIMIT_CONFIGURATION_INVALID", command, isJson);
|
|
586
|
-
maxOutputBytes = parsedOutputLimit;
|
|
587
|
-
continue;
|
|
588
|
-
}
|
|
589
|
-
if (isPathOption) {
|
|
590
|
-
if (!isRepositoryDirectoryInputValid(optionValue)) return createArgumentError("INVALID_ARGUMENT", command, isJson);
|
|
591
|
-
path = optionValue;
|
|
592
|
-
pathsInput = "path";
|
|
593
|
-
continue;
|
|
594
|
-
}
|
|
595
|
-
if (isRepositoryOption) {
|
|
596
|
-
if (!isRepositoryDirectoryInputValid(optionValue)) return createArgumentError("INVALID_ARGUMENT", command, isJson);
|
|
597
|
-
repositoryDirectory = optionValue;
|
|
598
|
-
continue;
|
|
599
|
-
}
|
|
600
|
-
const parsedLimit = parsePositiveSafeInteger(optionValue);
|
|
601
|
-
if (parsedLimit === null || resourceField === void 0) return createArgumentError("RESOURCE_LIMIT_CONFIGURATION_INVALID", command, isJson);
|
|
602
|
-
resourceLimits[resourceField] = parsedLimit;
|
|
603
|
-
}
|
|
604
|
-
if (!areMoldeaCliResourceLimitsConsistent(resourceLimits)) return createArgumentError("RESOURCE_LIMIT_CONFIGURATION_INVALID", command, isJson);
|
|
605
|
-
const isScope = command === MOLDEA_CLI_COMMANDS.Scope;
|
|
606
|
-
const isContent = command === MOLDEA_CLI_COMMANDS.Content;
|
|
607
|
-
const hasPathInput = path !== null;
|
|
608
|
-
const hasStdinInput = seenOptions.has(MOLDEA_CLI_OPTIONS.PathsStdin);
|
|
609
|
-
if ((hasPathInput || hasStdinInput) && !isScope && !isContent) return createArgumentError("INVALID_ARGUMENT", command, isJson);
|
|
610
|
-
if (isScope && hasPathInput === hasStdinInput) return createArgumentError("INVALID_ARGUMENT", command, isJson);
|
|
611
|
-
if (isContent && (!hasPathInput || hasStdinInput)) return createArgumentError("INVALID_ARGUMENT", command, isJson);
|
|
612
|
-
if (isScope && seenOptions.has(MOLDEA_CLI_OPTIONS.MaxCoverage)) return createArgumentError("INVALID_ARGUMENT", command, isJson);
|
|
613
|
-
if (isContent && [
|
|
614
|
-
MOLDEA_CLI_OPTIONS.MaxDiagnostics,
|
|
615
|
-
MOLDEA_CLI_OPTIONS.MaxCoverage,
|
|
616
|
-
MOLDEA_CLI_OPTIONS.MaxManifestBytes
|
|
617
|
-
].some((option) => seenOptions.has(option))) return createArgumentError("INVALID_ARGUMENT", command, isJson);
|
|
618
|
-
if (!isJson && (cursor !== null || seenOptions.has(MOLDEA_CLI_OPTIONS.MaxOutputBytes))) return createArgumentError("INVALID_ARGUMENT", command, isJson);
|
|
619
|
-
const options = {
|
|
620
|
-
cursor,
|
|
621
|
-
isColorDisabled,
|
|
622
|
-
isJson,
|
|
623
|
-
maxOutputBytes,
|
|
624
|
-
path,
|
|
625
|
-
pathsInput,
|
|
626
|
-
repositoryDirectory,
|
|
627
|
-
resourceLimits: Object.freeze({ ...resourceLimits })
|
|
628
|
-
};
|
|
629
|
-
return {
|
|
630
|
-
invocation: Object.freeze({
|
|
631
|
-
command,
|
|
632
|
-
options: Object.freeze(options)
|
|
633
|
-
}),
|
|
634
|
-
kind: "command"
|
|
635
|
-
};
|
|
636
|
-
};
|
|
637
|
-
//#endregion
|
|
638
|
-
//#region src/presentation/constants.ts
|
|
639
|
-
var MOLDEA_CLI_ERROR_DEFINITIONS = Object.freeze({
|
|
640
|
-
COMPOSITION_STATE_INVALID: Object.freeze({
|
|
641
|
-
message: "The installed composition state is invalid.",
|
|
642
|
-
retryable: false,
|
|
643
|
-
source: "cli"
|
|
644
|
-
}),
|
|
645
|
-
CONTENT_INVALID: Object.freeze({
|
|
646
|
-
message: "The requested canonical asset is not valid moldea text.",
|
|
647
|
-
retryable: false,
|
|
648
|
-
source: "cli"
|
|
649
|
-
}),
|
|
650
|
-
CONTENT_PATH_INVALID: Object.freeze({
|
|
651
|
-
message: "The content path must identify one canonical moldea text asset.",
|
|
652
|
-
retryable: false,
|
|
653
|
-
source: "cli"
|
|
654
|
-
}),
|
|
655
|
-
CURSOR_INVALID: Object.freeze({
|
|
656
|
-
message: "The continuation cursor is invalid for this request.",
|
|
657
|
-
retryable: false,
|
|
658
|
-
source: "cli"
|
|
659
|
-
}),
|
|
660
|
-
CURSOR_SNAPSHOT_CHANGED: Object.freeze({
|
|
661
|
-
message: "The continuation cursor belongs to a different repository snapshot.",
|
|
662
|
-
retryable: true,
|
|
663
|
-
source: "cli"
|
|
664
|
-
}),
|
|
665
|
-
GIT_ACCESS_DENIED: Object.freeze({
|
|
666
|
-
message: "Git access was denied.",
|
|
667
|
-
retryable: true,
|
|
668
|
-
source: "git"
|
|
669
|
-
}),
|
|
670
|
-
GIT_COMMAND_FAILED: Object.freeze({
|
|
671
|
-
message: "The Git command failed.",
|
|
672
|
-
retryable: true,
|
|
673
|
-
source: "git"
|
|
674
|
-
}),
|
|
675
|
-
GIT_CONTENT_TRANSFORM_UNSUPPORTED: Object.freeze({
|
|
676
|
-
message: "The requested file uses an unsupported Git content transformation.",
|
|
677
|
-
retryable: false,
|
|
678
|
-
source: "git"
|
|
679
|
-
}),
|
|
680
|
-
GIT_NOT_FOUND: Object.freeze({
|
|
681
|
-
message: "The Git executable is unavailable.",
|
|
682
|
-
retryable: false,
|
|
683
|
-
source: "git"
|
|
684
|
-
}),
|
|
685
|
-
GIT_OPERATION_ABORTED: Object.freeze({
|
|
686
|
-
message: "The Git operation was aborted.",
|
|
687
|
-
retryable: true,
|
|
688
|
-
source: "git"
|
|
689
|
-
}),
|
|
690
|
-
GIT_OUTPUT_INVALID: Object.freeze({
|
|
691
|
-
message: "Git returned invalid output.",
|
|
692
|
-
retryable: false,
|
|
693
|
-
source: "git"
|
|
694
|
-
}),
|
|
695
|
-
GIT_REPOSITORY_NOT_FOUND: Object.freeze({
|
|
696
|
-
message: "The selected path is not inside a Git repository.",
|
|
697
|
-
retryable: false,
|
|
698
|
-
source: "git"
|
|
699
|
-
}),
|
|
700
|
-
GIT_SPARSE_CHECKOUT_UNSUPPORTED: Object.freeze({
|
|
701
|
-
message: "Sparse Git checkouts are unsupported.",
|
|
702
|
-
retryable: false,
|
|
703
|
-
source: "git"
|
|
704
|
-
}),
|
|
705
|
-
GIT_VERSION_INVALID: Object.freeze({
|
|
706
|
-
message: "The Git version output is invalid.",
|
|
707
|
-
retryable: false,
|
|
708
|
-
source: "git"
|
|
709
|
-
}),
|
|
710
|
-
GIT_VERSION_UNSUPPORTED: Object.freeze({
|
|
711
|
-
message: "The installed Git version is unsupported.",
|
|
712
|
-
retryable: false,
|
|
713
|
-
source: "git"
|
|
714
|
-
}),
|
|
715
|
-
GIT_WORK_TREE_REQUIRED: Object.freeze({
|
|
716
|
-
message: "A usable Git working tree is required.",
|
|
717
|
-
retryable: false,
|
|
718
|
-
source: "git"
|
|
719
|
-
}),
|
|
720
|
-
INTERNAL_ERROR: Object.freeze({
|
|
721
|
-
message: "The command could not be completed.",
|
|
722
|
-
retryable: false,
|
|
723
|
-
source: "cli"
|
|
724
|
-
}),
|
|
725
|
-
INVALID_ARGUMENT: Object.freeze({
|
|
726
|
-
message: "The command invocation is invalid.",
|
|
727
|
-
retryable: false,
|
|
728
|
-
source: "cli"
|
|
729
|
-
}),
|
|
730
|
-
OUTPUT_BUDGET_TOO_SMALL: Object.freeze({
|
|
731
|
-
message: "The output byte budget cannot contain the next complete result.",
|
|
732
|
-
retryable: false,
|
|
733
|
-
source: "cli"
|
|
734
|
-
}),
|
|
735
|
-
PATH_INPUT_INVALID: Object.freeze({
|
|
736
|
-
message: "The scope path input is invalid. Use leading-slash repository-logical paths and NUL-delimited UTF-8 on stdin.",
|
|
737
|
-
retryable: false,
|
|
738
|
-
source: "cli"
|
|
739
|
-
}),
|
|
740
|
-
RESOURCE_LIMIT_CONFIGURATION_INVALID: Object.freeze({
|
|
741
|
-
message: "The resource-limit configuration is invalid.",
|
|
742
|
-
retryable: false,
|
|
743
|
-
source: "cli"
|
|
744
|
-
}),
|
|
745
|
-
RESOURCE_LIMIT_EXCEEDED: Object.freeze({
|
|
746
|
-
message: "A resource limit was exceeded.",
|
|
747
|
-
retryable: false,
|
|
748
|
-
source: "cli"
|
|
749
|
-
}),
|
|
750
|
-
WORKING_TREE_UNSTABLE: Object.freeze({
|
|
751
|
-
message: "The working tree did not remain stable.",
|
|
752
|
-
retryable: true,
|
|
753
|
-
source: "cli"
|
|
754
|
-
})
|
|
755
|
-
});
|
|
756
|
-
var MOLDEA_CLI_GIT_WORKING_TREE_SOURCE = Object.freeze({ kind: "git-working-tree" });
|
|
757
|
-
var MOLDEA_CLI_TOP_LEVEL_HELP = `Usage: moldea <command> [options]
|
|
758
|
-
|
|
759
|
-
Commands:
|
|
760
|
-
validate Validate the current moldea project.
|
|
761
|
-
inspect Inspect content-free project metadata.
|
|
762
|
-
scope Match changed paths to declared moldea relationships.
|
|
763
|
-
content Read one canonical moldea asset explicitly.
|
|
764
|
-
composition Report the installed CLI composition state.
|
|
765
|
-
|
|
766
|
-
Global options:
|
|
767
|
-
--help Show top-level help.
|
|
768
|
-
--version Show the CLI version.
|
|
769
|
-
|
|
770
|
-
Run "moldea <command> --help" for command-specific options.
|
|
771
|
-
`;
|
|
772
|
-
var REPOSITORY_OPTIONS_HELP = ` --repository <path> Select a Git working-tree directory.
|
|
773
|
-
--json Emit one machine-readable JSON result.
|
|
774
|
-
--no-color Disable ANSI styling in human output.
|
|
775
|
-
`;
|
|
776
|
-
var BASE_RESOURCE_OPTIONS_HELP = ` --max-entries <integer> Override the repository entry limit.
|
|
777
|
-
--max-file-bytes <integer> Override the per-file byte limit.
|
|
778
|
-
--max-total-bytes <integer> Override the total cached-byte limit.
|
|
779
|
-
`;
|
|
780
|
-
var INSPECTION_RESOURCE_OPTIONS_HELP = `${BASE_RESOURCE_OPTIONS_HELP} --max-manifest-bytes <integer> Override the manifest byte limit.
|
|
781
|
-
--max-diagnostics <integer> Override the diagnostic count limit.
|
|
782
|
-
`;
|
|
783
|
-
var PAGINATION_OPTIONS_HELP = ` --max-output-bytes <integer> Bound JSON output from 4096 to 1048576 bytes.
|
|
784
|
-
--cursor <opaque-cursor> Continue a prior JSON result page.
|
|
785
|
-
`;
|
|
786
|
-
var COMPLETE_INSPECTION_OPTIONS_HELP = `${REPOSITORY_OPTIONS_HELP}${INSPECTION_RESOURCE_OPTIONS_HELP} --max-coverage <integer> Override the binding coverage count limit.
|
|
787
|
-
${PAGINATION_OPTIONS_HELP}`;
|
|
788
|
-
var SCOPE_OPTIONS_HELP = `${REPOSITORY_OPTIONS_HELP}${INSPECTION_RESOURCE_OPTIONS_HELP}${PAGINATION_OPTIONS_HELP}`;
|
|
789
|
-
var CONTENT_OPTIONS_HELP = `${REPOSITORY_OPTIONS_HELP}${BASE_RESOURCE_OPTIONS_HELP}${PAGINATION_OPTIONS_HELP}`;
|
|
790
|
-
var MOLDEA_CLI_COMMAND_HELP = {
|
|
791
|
-
[MOLDEA_CLI_COMMANDS.Composition]: `Usage: moldea composition [options]
|
|
792
|
-
|
|
793
|
-
Report the installed CLI composition state.
|
|
794
|
-
|
|
795
|
-
Options:
|
|
796
|
-
--json Emit one machine-readable JSON result.
|
|
797
|
-
--no-color Disable ANSI styling in human output.
|
|
798
|
-
--help Show this help.
|
|
799
|
-
`,
|
|
800
|
-
[MOLDEA_CLI_COMMANDS.Inspect]: `Usage: moldea inspect [options]
|
|
801
|
-
|
|
802
|
-
Inspect content-free metadata for the current moldea project.
|
|
803
|
-
|
|
804
|
-
Options:
|
|
805
|
-
${COMPLETE_INSPECTION_OPTIONS_HELP} --help Show this help.
|
|
806
|
-
`,
|
|
807
|
-
[MOLDEA_CLI_COMMANDS.Scope]: `Usage: moldea scope (--path <logical-path> | --paths-stdin) [options]
|
|
808
|
-
|
|
809
|
-
Match changed repository paths to declared moldea relationships. The stdin form accepts NUL-delimited UTF-8 logical paths.
|
|
810
|
-
|
|
811
|
-
Options:
|
|
812
|
-
${SCOPE_OPTIONS_HELP} --path <logical-path> Match one repository-logical path.
|
|
813
|
-
--paths-stdin Read NUL-delimited paths from stdin.
|
|
814
|
-
--help Show this help.
|
|
815
|
-
`,
|
|
816
|
-
[MOLDEA_CLI_COMMANDS.Content]: `Usage: moldea content --path <canonical-logical-path> [options]
|
|
817
|
-
|
|
818
|
-
Read one canonical moldea text asset in bounded Unicode-safe chunks.
|
|
819
|
-
|
|
820
|
-
Options:
|
|
821
|
-
${CONTENT_OPTIONS_HELP} --path <canonical-logical-path> Select exactly one canonical moldea file.
|
|
822
|
-
--help Show this help.
|
|
823
|
-
`,
|
|
824
|
-
[MOLDEA_CLI_COMMANDS.Validate]: `Usage: moldea validate [options]
|
|
825
|
-
|
|
826
|
-
Validate the current moldea project.
|
|
827
|
-
|
|
828
|
-
Options:
|
|
829
|
-
${COMPLETE_INSPECTION_OPTIONS_HELP} --help Show this help.
|
|
830
|
-
`
|
|
831
|
-
};
|
|
832
|
-
//#endregion
|
|
833
|
-
//#region src/presentation/errors.ts
|
|
834
|
-
var EMPTY_ERROR_DETAILS = Object.freeze({});
|
|
835
|
-
var createMoldeaCliOwnedError = (code, details = EMPTY_ERROR_DETAILS) => {
|
|
836
|
-
const definition = MOLDEA_CLI_ERROR_DEFINITIONS[code];
|
|
837
|
-
return Object.freeze({
|
|
838
|
-
code,
|
|
839
|
-
details: Object.freeze({ ...details }),
|
|
840
|
-
message: definition.message,
|
|
841
|
-
path: null,
|
|
842
|
-
retryable: definition.retryable,
|
|
843
|
-
source: definition.source
|
|
844
|
-
});
|
|
845
|
-
};
|
|
846
|
-
//#endregion
|
|
847
|
-
//#region src/json-output-contract/document.ts
|
|
848
|
-
var createMoldeaCliJsonEnvelope = (input) => Object.freeze({
|
|
849
|
-
cliVersion: input.cliVersion,
|
|
850
|
-
command: input.command,
|
|
851
|
-
error: input.error,
|
|
852
|
-
result: input.result,
|
|
853
|
-
schemaVersion: 8,
|
|
854
|
-
status: input.status
|
|
855
|
-
});
|
|
856
|
-
var serializeMoldeaCliJsonEnvelope = (input) => `${stringifyJsonDeterministically(createMoldeaCliJsonEnvelope(input), { strict: true })}\n`;
|
|
857
|
-
//#endregion
|
|
858
|
-
//#region src/presentation/formatters.ts
|
|
859
|
-
var DIAGNOSTIC_ENTITY_KEYS = [
|
|
860
|
-
"agentId",
|
|
861
|
-
"capabilityKind",
|
|
862
|
-
"capabilityId",
|
|
863
|
-
"decisionId",
|
|
864
|
-
"contextPath",
|
|
865
|
-
"integrationPath"
|
|
866
|
-
];
|
|
867
|
-
var formatMoldeaCliHumanDiagnosticEntity = (entity) => DIAGNOSTIC_ENTITY_KEYS.flatMap((key) => {
|
|
868
|
-
const identifier = entity[key];
|
|
869
|
-
return identifier === void 0 ? [] : [`${key}=${identifier}`];
|
|
870
|
-
}).join(", ");
|
|
871
|
-
var formatMoldeaCliHumanDiagnostic = (diagnostic) => {
|
|
872
|
-
const location = diagnostic.path === null ? "" : diagnostic.range === null ? ` ${diagnostic.path}` : ` ${diagnostic.path}:${diagnostic.range.start.line}:${diagnostic.range.start.column}`;
|
|
873
|
-
const lines = [`${diagnostic.source}:${diagnostic.code}${location} ${diagnostic.message}`];
|
|
874
|
-
if (diagnostic.pointer !== null) lines.push(` pointer: ${diagnostic.pointer}`);
|
|
875
|
-
if (diagnostic.entity !== null) lines.push(` entity: ${formatMoldeaCliHumanDiagnosticEntity(diagnostic.entity)}`);
|
|
876
|
-
if (diagnostic.severity === "warning") {
|
|
877
|
-
lines.push(` subject: ${diagnostic.subject}`);
|
|
878
|
-
if (diagnostic.qualifier !== null) lines.push(` qualifier: ${diagnostic.qualifier}`);
|
|
879
|
-
}
|
|
880
|
-
return lines.join("\n");
|
|
881
|
-
};
|
|
882
|
-
var createMoldeaCliHumanStatusLines = (isValid, formatVersion, warningCount = 0) => {
|
|
883
|
-
const lines = [`The moldea project is ${isValid ? warningCount > 0 ? "valid with warnings" : "valid" : "invalid"}.`];
|
|
884
|
-
if (formatVersion !== null) lines.push(`Repository format: ${formatVersion}`);
|
|
885
|
-
return lines;
|
|
886
|
-
};
|
|
887
|
-
var formatMoldeaCliHumanCount = (count, singularLabel, pluralLabel) => `${count === 1 ? singularLabel : pluralLabel}: ${count}`;
|
|
888
|
-
var formatMoldeaCliHelp = (command) => {
|
|
889
|
-
return command === null ? MOLDEA_CLI_TOP_LEVEL_HELP : MOLDEA_CLI_COMMAND_HELP[command];
|
|
890
|
-
};
|
|
891
|
-
var formatMoldeaCliHumanError = (error) => `${error.source}:${error.code} ${error.message}\n`;
|
|
892
|
-
var formatMoldeaCliJsonResult = (command, result, error, status, cliVersion) => serializeMoldeaCliJsonEnvelope({
|
|
893
|
-
cliVersion,
|
|
894
|
-
command,
|
|
895
|
-
error,
|
|
896
|
-
result,
|
|
897
|
-
status
|
|
898
|
-
});
|
|
899
|
-
var formatMoldeaCliJsonError = (error, command, cliVersion) => formatMoldeaCliJsonResult(command, null, error, "error", cliVersion);
|
|
900
|
-
var formatMoldeaCliHumanCompositionResult = (result, cliVersion) => {
|
|
901
|
-
return `${[
|
|
902
|
-
"The installed CLI composition state is valid.",
|
|
903
|
-
`CLI version: ${cliVersion}`,
|
|
904
|
-
`Supported Node.js: ${result.supportedNodeRange}`,
|
|
905
|
-
`JSON output schema: 8`,
|
|
906
|
-
`Minimum Git: ${result.minimumGitVersion}`,
|
|
907
|
-
`Repository formats: ${result.repositoryFormatVersions.join(", ")}`,
|
|
908
|
-
"Packages:",
|
|
909
|
-
...result.packages.map(({ name, version }) => ` ${name}: ${version}`)
|
|
910
|
-
].join("\n")}\n`;
|
|
911
|
-
};
|
|
912
|
-
var formatMoldeaCliJsonCompositionResult = (result, cliVersion) => formatMoldeaCliJsonResult(MOLDEA_CLI_COMMANDS.Composition, result, null, "valid", cliVersion);
|
|
913
|
-
var formatCoverage = (counts) => `Coverage: ${counts.bindings} bindings, ${counts.exportsPassed} exports confirmed, ${counts.exportsFailed} exports missing, ${counts.exportsNotChecked} not checked`;
|
|
914
|
-
var formatMoldeaCliHumanValidateResult = (result) => {
|
|
915
|
-
const lines = createMoldeaCliHumanStatusLines(result.valid, result.formatVersion, result.warningCount);
|
|
916
|
-
lines.push(formatCoverage(result.coverageCounts));
|
|
917
|
-
for (const record of result.page.records) if (record.kind === "diagnostic" && !(record.severity === "warning" && record.accepted)) lines.push(formatMoldeaCliHumanDiagnostic(record));
|
|
918
|
-
lines.push(formatMoldeaCliHumanCount(result.diagnosticCount, "Diagnostic", "Diagnostics"));
|
|
919
|
-
lines.push(formatMoldeaCliHumanCount(result.errorCount, "Error", "Errors"));
|
|
920
|
-
lines.push(formatMoldeaCliHumanCount(result.warningCount, "Warning", "Warnings"));
|
|
921
|
-
lines.push(`${result.acceptedWarningCount} accepted ${result.acceptedWarningCount === 1 ? "warning" : "warnings"}`);
|
|
922
|
-
if (result.page.cursor !== null) lines.push("Additional records are available through JSON pagination.");
|
|
923
|
-
return `${lines.join("\n")}\n`;
|
|
924
|
-
};
|
|
925
|
-
var formatMoldeaCliJsonValidateResult = (result, cliVersion) => formatMoldeaCliJsonResult(MOLDEA_CLI_COMMANDS.Validate, result, null, result.valid ? "valid" : "invalid", cliVersion);
|
|
926
|
-
var formatMoldeaCliHumanInspectResult = (result) => {
|
|
927
|
-
const lines = createMoldeaCliHumanStatusLines(result.valid, result.formatVersion, result.counts.warnings);
|
|
928
|
-
lines.push(formatCoverage(result.coverageCounts));
|
|
929
|
-
lines.push(`${result.counts.acceptedWarnings} accepted ${result.counts.acceptedWarnings === 1 ? "warning" : "warnings"}`);
|
|
930
|
-
for (const record of result.page.records) if (record.kind === "diagnostic" && !(record.severity === "warning" && record.accepted)) lines.push(formatMoldeaCliHumanDiagnostic(record));
|
|
931
|
-
for (const [label, count] of Object.entries(result.counts)) lines.push(`${label}: ${count}`);
|
|
932
|
-
return `${lines.join("\n")}\n`;
|
|
933
|
-
};
|
|
934
|
-
var formatMoldeaCliJsonInspectResult = (result, cliVersion) => formatMoldeaCliJsonResult(MOLDEA_CLI_COMMANDS.Inspect, result, null, result.valid ? "valid" : "invalid", cliVersion);
|
|
935
|
-
var formatMoldeaCliHumanScopeResult = (result) => {
|
|
936
|
-
return `${[
|
|
937
|
-
`The moldea scope result is ${result.valid ? "valid" : "invalid"}.`,
|
|
938
|
-
`Relevant: ${result.relevant ? "yes" : "no"}`,
|
|
939
|
-
...Object.entries(result.counts).map(([label, count]) => `${label}: ${count}`)
|
|
940
|
-
].join("\n")}\n`;
|
|
941
|
-
};
|
|
942
|
-
var formatMoldeaCliJsonScopeResult = (result, cliVersion) => formatMoldeaCliJsonResult(MOLDEA_CLI_COMMANDS.Scope, result, null, result.valid ? "valid" : "invalid", cliVersion);
|
|
943
|
-
var formatMoldeaCliHumanContentResult = (result) => {
|
|
944
|
-
return `${[
|
|
945
|
-
`Path: ${result.asset.path}`,
|
|
946
|
-
`Content identity: ${result.asset.contentIdentity ?? "unavailable"}`,
|
|
947
|
-
`Bytes: ${result.chunk.byteStart}-${result.chunk.byteEnd} of ${result.asset.totalBytes}`,
|
|
948
|
-
result.cursor === null ? "Cursor: none" : `Cursor: ${result.cursor}`,
|
|
949
|
-
...result.cursor === null ? [] : ["Continue this asset by passing the cursor to a JSON content request."],
|
|
950
|
-
"",
|
|
951
|
-
result.chunk.content
|
|
952
|
-
].join("\n")}\n`;
|
|
953
|
-
};
|
|
954
|
-
var formatMoldeaCliJsonContentResult = (result, cliVersion) => formatMoldeaCliJsonResult(MOLDEA_CLI_COMMANDS.Content, result, null, "valid", cliVersion);
|
|
955
|
-
//#endregion
|
|
956
|
-
//#region src/presentation/transformers.ts
|
|
957
|
-
var assertProjectValidationInvariant = (validation) => {
|
|
958
|
-
const observedErrorCount = validation.diagnostics.filter((diagnostic) => diagnostic.severity === "error").length;
|
|
959
|
-
if (!(Number.isSafeInteger(validation.errorCount) && Number.isSafeInteger(validation.warningCount) && validation.errorCount === observedErrorCount && validation.acceptedWarningCount === validation.diagnostics.filter((diagnostic) => diagnostic.severity === "warning" && diagnostic.accepted === true).length && validation.warningCount === validation.diagnostics.length - observedErrorCount - validation.acceptedWarningCount && validation.diagnosticCount === validation.errorCount + validation.warningCount + validation.acceptedWarningCount && validation.valid === (validation.summary !== null && validation.errorCount === 0) && (validation.valid || validation.errorCount > 0))) throw new TypeError("The Core validation result is internally inconsistent.");
|
|
960
|
-
};
|
|
961
|
-
var createRecordKey = (kind, ...parts) => JSON.stringify([kind, ...parts]);
|
|
962
|
-
var createMoldeaCliDiagnosticRecord = (diagnostic, occurrence = 0) => {
|
|
963
|
-
const record = {
|
|
964
|
-
code: diagnostic.code,
|
|
965
|
-
group: diagnostic.group,
|
|
966
|
-
entity: diagnostic.entity,
|
|
967
|
-
key: createRecordKey("diagnostic", diagnostic.source, diagnostic.severity, diagnostic.code, diagnostic.path, diagnostic.pointer, diagnostic.severity === "warning" ? [
|
|
968
|
-
diagnostic.subject,
|
|
969
|
-
diagnostic.qualifier,
|
|
970
|
-
diagnostic.accepted === true,
|
|
971
|
-
diagnostic.accepted === true ? diagnostic.reason : null
|
|
972
|
-
] : null, occurrence),
|
|
973
|
-
kind: "diagnostic",
|
|
974
|
-
message: diagnostic.message,
|
|
975
|
-
path: diagnostic.path,
|
|
976
|
-
pointer: diagnostic.pointer,
|
|
977
|
-
range: diagnostic.range,
|
|
978
|
-
source: diagnostic.source
|
|
979
|
-
};
|
|
980
|
-
if (diagnostic.severity === "warning") return Object.freeze({
|
|
981
|
-
...record,
|
|
982
|
-
severity: "warning",
|
|
983
|
-
subject: diagnostic.subject,
|
|
984
|
-
qualifier: diagnostic.qualifier,
|
|
985
|
-
acceptable: diagnostic.acceptable,
|
|
986
|
-
accepted: diagnostic.accepted === true,
|
|
987
|
-
reason: diagnostic.accepted === true ? diagnostic.reason : null
|
|
988
|
-
});
|
|
989
|
-
return Object.freeze({
|
|
990
|
-
...record,
|
|
991
|
-
severity: "error"
|
|
992
|
-
});
|
|
993
|
-
};
|
|
994
|
-
var createCoverageRecord = (coverage, index, order = "coverage") => Object.freeze({
|
|
995
|
-
entity: coverage.entity,
|
|
996
|
-
relationship: coverage.relationship,
|
|
997
|
-
path: coverage.path,
|
|
998
|
-
symbol: coverage.symbol,
|
|
999
|
-
fileCheck: coverage.fileCheck,
|
|
1000
|
-
...coverage.exportCheck === "not-checked" ? {
|
|
1001
|
-
exportCheck: coverage.exportCheck,
|
|
1002
|
-
exportNotCheckedReason: coverage.exportNotCheckedReason
|
|
1003
|
-
} : { exportCheck: coverage.exportCheck },
|
|
1004
|
-
key: createRecordKey(order, "coverage", coverage.relationship, coverage.entity, coverage.path, coverage.symbol, index),
|
|
1005
|
-
kind: "coverage"
|
|
1006
|
-
});
|
|
1007
|
-
var createInspectRecord = (item, index) => {
|
|
1008
|
-
const order = index.toString().padStart(6, "0");
|
|
1009
|
-
if (item.kind === "agent") {
|
|
1010
|
-
const record = {
|
|
1011
|
-
agentId: item.agent.agentId,
|
|
1012
|
-
key: createRecordKey(order, "agent", item.agent.agentId),
|
|
1013
|
-
kind: "agent"
|
|
1014
|
-
};
|
|
1015
|
-
return Object.freeze(record);
|
|
1016
|
-
}
|
|
1017
|
-
if (item.kind === "diagnostic") return Object.freeze({
|
|
1018
|
-
...createMoldeaCliDiagnosticRecord(item.diagnostic, index),
|
|
1019
|
-
key: createRecordKey(order, "diagnostic", item.diagnostic.source, item.diagnostic.severity, item.diagnostic.code, createMoldeaCliDiagnosticRecord(item.diagnostic, index).key)
|
|
1020
|
-
});
|
|
1021
|
-
if (item.kind === "coverage") return createCoverageRecord(item.coverage, index, order);
|
|
1022
|
-
const metadata = item.metadata;
|
|
1023
|
-
const record = {
|
|
1024
|
-
agentId: metadata.agentId,
|
|
1025
|
-
byteLength: metadata.byteLength,
|
|
1026
|
-
canonicalDigest: metadata.canonicalDigest,
|
|
1027
|
-
decisionId: metadata.decisionId,
|
|
1028
|
-
digest: metadata.digest,
|
|
1029
|
-
key: createRecordKey(order, "metadata", metadata.path, metadata.kind, metadata.agentId),
|
|
1030
|
-
kind: "metadata",
|
|
1031
|
-
metadataKind: metadata.kind,
|
|
1032
|
-
path: metadata.path,
|
|
1033
|
-
scalarLength: metadata.scalarLength
|
|
1034
|
-
};
|
|
1035
|
-
return Object.freeze(record);
|
|
1036
|
-
};
|
|
1037
|
-
var createMoldeaCliValidateProjection = (validation) => {
|
|
1038
|
-
assertProjectValidationInvariant(validation);
|
|
1039
|
-
const diagnostics = validation.diagnostics.map((diagnostic, index) => {
|
|
1040
|
-
const record = createMoldeaCliDiagnosticRecord(diagnostic, index);
|
|
1041
|
-
return Object.freeze({
|
|
1042
|
-
...record,
|
|
1043
|
-
key: createRecordKey(index.toString().padStart(6, "0"), "diagnostic", record.key)
|
|
1044
|
-
});
|
|
1045
|
-
});
|
|
1046
|
-
const records = Object.freeze([...diagnostics, ...validation.coverage.map((coverage, index) => createCoverageRecord(coverage, index, (diagnostics.length + index).toString().padStart(6, "0")))]);
|
|
1047
|
-
const snapshotDigest = calculateMoldeaCliJsonDigest({
|
|
1048
|
-
records,
|
|
1049
|
-
coverageCounts: validation.coverageCounts,
|
|
1050
|
-
acceptedWarningCount: validation.acceptedWarningCount,
|
|
1051
|
-
errorCount: validation.errorCount,
|
|
1052
|
-
formatVersion: validation.formatVersion,
|
|
1053
|
-
summary: validation.summary,
|
|
1054
|
-
valid: validation.valid,
|
|
1055
|
-
warningCount: validation.warningCount
|
|
1056
|
-
});
|
|
1057
|
-
return Object.freeze({
|
|
1058
|
-
records,
|
|
1059
|
-
diagnosticCount: validation.diagnosticCount,
|
|
1060
|
-
acceptedWarningCount: validation.acceptedWarningCount,
|
|
1061
|
-
coverageCounts: validation.coverageCounts,
|
|
1062
|
-
errorCount: validation.errorCount,
|
|
1063
|
-
formatVersion: validation.formatVersion,
|
|
1064
|
-
snapshotDigest,
|
|
1065
|
-
source: MOLDEA_CLI_GIT_WORKING_TREE_SOURCE,
|
|
1066
|
-
valid: validation.valid,
|
|
1067
|
-
warningCount: validation.warningCount
|
|
1068
|
-
});
|
|
1069
|
-
};
|
|
1070
|
-
var createMoldeaCliInspectProjection = (inspection) => {
|
|
1071
|
-
const project = inspection.summary === null ? null : Object.freeze({
|
|
1072
|
-
manifest: Object.freeze({
|
|
1073
|
-
digest: inspection.summary.manifestDigest,
|
|
1074
|
-
path: inspection.summary.manifestPath
|
|
1075
|
-
}),
|
|
1076
|
-
project: Object.freeze({
|
|
1077
|
-
digest: inspection.summary.projectDigest,
|
|
1078
|
-
path: inspection.summary.projectPath
|
|
1079
|
-
})
|
|
1080
|
-
});
|
|
1081
|
-
const records = Object.freeze(inspection.page.records.map(({ item }, index) => createInspectRecord(item, index)));
|
|
1082
|
-
const sourceCursors = new Map(inspection.page.records.map((record, index) => {
|
|
1083
|
-
const projected = records[index];
|
|
1084
|
-
if (projected === void 0) throw new TypeError("A projected inspection record is missing.");
|
|
1085
|
-
return [projected.key, record.nextCursor];
|
|
1086
|
-
}));
|
|
1087
|
-
const snapshotDigest = inspection.inspectionDigest;
|
|
1088
|
-
return Object.freeze({
|
|
1089
|
-
counts: inspection.counts,
|
|
1090
|
-
formatVersion: inspection.formatVersion,
|
|
1091
|
-
getSourceCursor: (record) => sourceCursors.get(record.key) ?? null,
|
|
1092
|
-
project,
|
|
1093
|
-
records,
|
|
1094
|
-
snapshotDigest,
|
|
1095
|
-
source: MOLDEA_CLI_GIT_WORKING_TREE_SOURCE,
|
|
1096
|
-
coverageCounts: inspection.coverageCounts,
|
|
1097
|
-
valid: inspection.valid,
|
|
1098
|
-
view: inspection.view
|
|
1099
|
-
});
|
|
1100
|
-
};
|
|
1101
|
-
//#endregion
|
|
1102
|
-
//#region ../../node_modules/.pnpm/jg-git-commands@0.4.0/node_modules/jg-git-commands/dist/shared/constants.js
|
|
1103
|
-
var GIT_NULL_DEVICE = "/dev/null";
|
|
1104
|
-
//#endregion
|
|
1105
|
-
//#region ../../node_modules/.pnpm/jg-git-commands@0.4.0/node_modules/jg-git-commands/dist/shared/errors.js
|
|
1106
|
-
var ERRORS = {
|
|
1107
|
-
GIT_NOT_FOUND: "GIT_NOT_FOUND",
|
|
1108
|
-
GIT_COMMAND_FAILED: "GIT_COMMAND_FAILED",
|
|
1109
|
-
GIT_INVALID_ARGUMENT: "GIT_INVALID_ARGUMENT",
|
|
1110
|
-
GIT_OUTPUT_INVALID: "GIT_OUTPUT_INVALID",
|
|
1111
|
-
GIT_REPOSITORY_NOT_FOUND: "GIT_REPOSITORY_NOT_FOUND",
|
|
1112
|
-
GIT_ACCESS_DENIED: "GIT_ACCESS_DENIED"
|
|
1113
|
-
};
|
|
1114
|
-
//#endregion
|
|
1115
|
-
//#region ../../node_modules/.pnpm/jg-git-commands@0.4.0/node_modules/jg-git-commands/dist/shared/utilities.js
|
|
1116
|
-
var invalidArgument = (name) => new Exception("An argument isn't valid.", {
|
|
1117
|
-
code: ERRORS.GIT_INVALID_ARGUMENT,
|
|
1118
|
-
data: { argument: name }
|
|
1119
|
-
});
|
|
1120
|
-
var invalidOutput = (subcommand) => new Exception("Git's output isn't in the expected format.", {
|
|
1121
|
-
code: ERRORS.GIT_OUTPUT_INVALID,
|
|
1122
|
-
data: { subcommand }
|
|
1123
|
-
});
|
|
1124
|
-
var isArgumentValid = (value) => typeof value === "string" && value.length > 0 && !value.includes("\0");
|
|
1125
|
-
//#endregion
|
|
1126
|
-
//#region ../../node_modules/.pnpm/jg-git-commands@0.4.0/node_modules/jg-git-commands/dist/environment/constants.js
|
|
1127
|
-
var DEFAULT_GIT_SSH_COMMAND = "ssh -o BatchMode=yes -o ConnectTimeout=10";
|
|
1128
|
-
var NON_INTERACTIVE_VARIABLES = {
|
|
1129
|
-
GIT_TERMINAL_PROMPT: "0",
|
|
1130
|
-
GIT_ASKPASS: "",
|
|
1131
|
-
GCM_INTERACTIVE: "never",
|
|
1132
|
-
GIT_OPTIONAL_LOCKS: "0",
|
|
1133
|
-
GIT_NO_REPLACE_OBJECTS: "1",
|
|
1134
|
-
GIT_NO_LAZY_FETCH: "1",
|
|
1135
|
-
GIT_LITERAL_PATHSPECS: "1",
|
|
1136
|
-
GIT_ALLOW_PROTOCOL: "",
|
|
1137
|
-
LC_ALL: "C",
|
|
1138
|
-
LANG: "C",
|
|
1139
|
-
LANGUAGE: "C"
|
|
1140
|
-
};
|
|
1141
|
-
//#endregion
|
|
1142
|
-
//#region ../../node_modules/.pnpm/jg-git-commands@0.4.0/node_modules/jg-git-commands/dist/environment/environment.js
|
|
1143
|
-
var SET_VARIABLES = new Set(Object.keys(NON_INTERACTIVE_VARIABLES));
|
|
1144
|
-
var isBaseVariableKept = (key) => {
|
|
1145
|
-
const name = key.toUpperCase();
|
|
1146
|
-
return !name.startsWith("GIT_") && !name.startsWith("SSH_ASKPASS") && !SET_VARIABLES.has(name);
|
|
1147
|
-
};
|
|
1148
|
-
var createGitEnvironment = ({ isolateConfig = false, sshCommand = DEFAULT_GIT_SSH_COMMAND, baseEnv = process.env } = {}) => ({
|
|
1149
|
-
...Object.fromEntries(Object.entries(baseEnv).filter(([key]) => isBaseVariableKept(key))),
|
|
1150
|
-
...NON_INTERACTIVE_VARIABLES,
|
|
1151
|
-
GIT_SSH_COMMAND: sshCommand,
|
|
1152
|
-
...isolateConfig ? {
|
|
1153
|
-
GIT_CONFIG_NOSYSTEM: "1",
|
|
1154
|
-
GIT_CONFIG_GLOBAL: GIT_NULL_DEVICE,
|
|
1155
|
-
GIT_ATTR_NOSYSTEM: "1"
|
|
1156
|
-
} : {}
|
|
1157
|
-
});
|
|
1158
|
-
//#endregion
|
|
1159
|
-
//#region ../../node_modules/.pnpm/jg-git-commands@0.4.0/node_modules/jg-git-commands/dist/run-git/constants.js
|
|
1160
|
-
var DEFAULT_GIT_MAX_OUTPUT_BYTES = 1048576;
|
|
1161
|
-
var FIXED_CONFIG_ARGS = [
|
|
1162
|
-
"-c",
|
|
1163
|
-
"core.fsmonitor=",
|
|
1164
|
-
"-c",
|
|
1165
|
-
"core.askPass=",
|
|
1166
|
-
"-c",
|
|
1167
|
-
"core.pager=cat",
|
|
1168
|
-
"-c",
|
|
1169
|
-
"color.ui=false",
|
|
1170
|
-
"-c",
|
|
1171
|
-
"submodule.recurse=false"
|
|
1172
|
-
];
|
|
1173
|
-
var NO_CREDENTIAL_HELPERS_ARGS = ["-c", "credential.helper="];
|
|
1174
|
-
var REPOSITORY_NOT_FOUND_PATTERN = /^fatal: not a git repository/mu;
|
|
1175
|
-
var ACCESS_DENIED_PATTERN = /^fatal: (?:detected dubious ownership in repository at |.*: Permission denied\r?$)/mu;
|
|
1176
|
-
//#endregion
|
|
1177
|
-
//#region ../../node_modules/.pnpm/jg-git-commands@0.4.0/node_modules/jg-git-commands/dist/run-git/run-git.js
|
|
1178
|
-
var isDirectory = async (path) => {
|
|
1179
|
-
try {
|
|
1180
|
-
return (await stat(path)).isDirectory();
|
|
1181
|
-
} catch {
|
|
1182
|
-
return false;
|
|
1183
|
-
}
|
|
1184
|
-
};
|
|
1185
|
-
var areArgsValid = (args) => Array.isArray(args) && args.every((arg) => typeof arg === "string" && !arg.includes("\0"));
|
|
1186
|
-
var isCallerVariable = (key) => {
|
|
1187
|
-
const name = key.toUpperCase();
|
|
1188
|
-
return name !== "GIT_ASKPASS" && name !== "GIT_TERMINAL_PROMPT" && name !== "GCM_INTERACTIVE" && !name.startsWith("SSH_ASKPASS");
|
|
1189
|
-
};
|
|
1190
|
-
var runGit = async (args, { cwd, timeoutSeconds = 30, maxOutputBytes = DEFAULT_GIT_MAX_OUTPUT_BYTES, input, signal, isolateConfig = false, useCredentialHelpers = false, env, encoding }) => {
|
|
1191
|
-
if (!areArgsValid(args)) throw invalidArgument("args");
|
|
1192
|
-
if (!isArgumentValid(cwd) || !await isDirectory(cwd)) throw invalidArgument("cwd");
|
|
1193
|
-
const gitEnv = {
|
|
1194
|
-
...createGitEnvironment({ isolateConfig }),
|
|
1195
|
-
...Object.fromEntries(Object.entries(env ?? {}).filter(([key]) => isCallerVariable(key)))
|
|
1196
|
-
};
|
|
1197
|
-
try {
|
|
1198
|
-
return await runProcess({
|
|
1199
|
-
command: "git",
|
|
1200
|
-
args: [
|
|
1201
|
-
...FIXED_CONFIG_ARGS,
|
|
1202
|
-
...isolateConfig ? ["-c", `core.attributesFile=${GIT_NULL_DEVICE}`] : [],
|
|
1203
|
-
...useCredentialHelpers ? [] : NO_CREDENTIAL_HELPERS_ARGS,
|
|
1204
|
-
"--no-pager",
|
|
1205
|
-
...args
|
|
1206
|
-
],
|
|
1207
|
-
cwd,
|
|
1208
|
-
env: gitEnv,
|
|
1209
|
-
timeoutSeconds,
|
|
1210
|
-
maxOutputBytes,
|
|
1211
|
-
...input === void 0 ? {} : { input },
|
|
1212
|
-
...signal === void 0 ? {} : { signal },
|
|
1213
|
-
...encoding === void 0 ? {} : { encoding }
|
|
1214
|
-
});
|
|
1215
|
-
} catch (error) {
|
|
1216
|
-
const isNotFound = getErrorCode(error) === ERRORS$2.PROCESS_START_FAILED && getErrorCode(error.cause) === "ENOENT";
|
|
1217
|
-
if (isNotFound && process.platform === "win32" && cwd.length >= 260) throw invalidArgument("cwd");
|
|
1218
|
-
if (isNotFound) throw new Exception("Git isn't installed, or isn't on the PATH.", {
|
|
1219
|
-
code: ERRORS.GIT_NOT_FOUND,
|
|
1220
|
-
cause: error
|
|
1221
|
-
});
|
|
1222
|
-
throw error;
|
|
1223
|
-
}
|
|
1224
|
-
};
|
|
1225
|
-
//#endregion
|
|
1226
|
-
//#region ../../node_modules/.pnpm/jg-git-commands@0.4.0/node_modules/jg-git-commands/dist/run-git/assert-succeeded.js
|
|
1227
|
-
var assertGitSucceeded = (result, subcommand) => {
|
|
1228
|
-
if (result.exitCode === 0) return;
|
|
1229
|
-
const stderr = typeof result.stderr === "string" ? result.stderr : result.stderr.toString("utf8");
|
|
1230
|
-
const data = {
|
|
1231
|
-
subcommand,
|
|
1232
|
-
exitCode: result.exitCode
|
|
1233
|
-
};
|
|
1234
|
-
if (REPOSITORY_NOT_FOUND_PATTERN.test(stderr)) throw new Exception("The directory isn't in a Git repository.", {
|
|
1235
|
-
code: ERRORS.GIT_REPOSITORY_NOT_FOUND,
|
|
1236
|
-
data
|
|
1237
|
-
});
|
|
1238
|
-
if (ACCESS_DENIED_PATTERN.test(stderr)) throw new Exception("Git can't access the repository.", {
|
|
1239
|
-
code: ERRORS.GIT_ACCESS_DENIED,
|
|
1240
|
-
data
|
|
1241
|
-
});
|
|
1242
|
-
throw new Exception("The git command failed.", {
|
|
1243
|
-
code: ERRORS.GIT_COMMAND_FAILED,
|
|
1244
|
-
data
|
|
1245
|
-
});
|
|
1246
|
-
};
|
|
1247
|
-
//#endregion
|
|
1248
|
-
//#region ../../node_modules/.pnpm/jg-git-commands@0.4.0/node_modules/jg-git-commands/dist/commands/utilities.js
|
|
1249
|
-
var INDEX_ENTRY_HEADER_PATTERN = /^([0-7]{6}) [0-9a-f]{40,64} ([0-3])$/;
|
|
1250
|
-
var readSuccessfulOutput = (result, subcommand) => {
|
|
1251
|
-
assertGitSucceeded(result, subcommand);
|
|
1252
|
-
return result.stdout;
|
|
1253
|
-
};
|
|
1254
|
-
var readCompleteOutput = (result, subcommand) => {
|
|
1255
|
-
const stdout = readSuccessfulOutput(result, subcommand);
|
|
1256
|
-
if (result.stderr.length > 0) throw invalidOutput(subcommand);
|
|
1257
|
-
return stdout;
|
|
1258
|
-
};
|
|
1259
|
-
var decodeText = (output, subcommand) => {
|
|
1260
|
-
try {
|
|
1261
|
-
return new TextDecoder("utf-8", {
|
|
1262
|
-
fatal: true,
|
|
1263
|
-
ignoreBOM: true
|
|
1264
|
-
}).decode(output);
|
|
1265
|
-
} catch {
|
|
1266
|
-
throw invalidOutput(subcommand);
|
|
1267
|
-
}
|
|
1268
|
-
};
|
|
1269
|
-
var decodeRecords = (output, subcommand) => {
|
|
1270
|
-
const text = decodeText(output, subcommand);
|
|
1271
|
-
if (text === "") return [];
|
|
1272
|
-
const records = text.split("\0");
|
|
1273
|
-
if (records.pop() !== "") throw invalidOutput(subcommand);
|
|
1274
|
-
return records;
|
|
1275
|
-
};
|
|
1276
|
-
var parseIndexEntries = (records) => records.map((record) => {
|
|
1277
|
-
const tab = record.indexOf(" ");
|
|
1278
|
-
const header = tab === -1 ? null : INDEX_ENTRY_HEADER_PATTERN.exec(record.slice(0, tab));
|
|
1279
|
-
if (header === null || tab === record.length - 1) throw invalidOutput("ls-files");
|
|
1280
|
-
return {
|
|
1281
|
-
mode: header[1],
|
|
1282
|
-
stage: Number(header[2]),
|
|
1283
|
-
path: record.slice(tab + 1)
|
|
1284
|
-
};
|
|
1285
|
-
});
|
|
1286
|
-
//#endregion
|
|
1287
|
-
//#region ../../node_modules/.pnpm/jg-git-commands@0.4.0/node_modules/jg-git-commands/dist/commands/commands.js
|
|
1288
|
-
var GIT_VERSION_PATTERN = /^git version (0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:[.-][0-9A-Za-z]+)*(?: \([0-9A-Za-z](?:[0-9A-Za-z ._+/-]*[0-9A-Za-z])?\))?\r?\n$/;
|
|
1289
|
-
var toPathspecArgs = (paths) => {
|
|
1290
|
-
if (paths === void 0) return ["--"];
|
|
1291
|
-
if (!Array.isArray(paths) || !paths.every(isArgumentValid)) throw invalidArgument("paths");
|
|
1292
|
-
return ["--", ...paths];
|
|
1293
|
-
};
|
|
1294
|
-
var readIndexEntries = async (cwd, { paths, ...options } = {}) => {
|
|
1295
|
-
return parseIndexEntries(decodeRecords(readCompleteOutput(await runGit([
|
|
1296
|
-
"ls-files",
|
|
1297
|
-
"--cached",
|
|
1298
|
-
"--stage",
|
|
1299
|
-
"--full-name",
|
|
1300
|
-
"-z",
|
|
1301
|
-
...toPathspecArgs(paths)
|
|
1302
|
-
], {
|
|
1303
|
-
...options,
|
|
1304
|
-
cwd,
|
|
1305
|
-
encoding: "buffer"
|
|
1306
|
-
}), "ls-files"), "ls-files"));
|
|
1307
|
-
};
|
|
1308
|
-
var listUntrackedFiles = async (cwd, { paths, ...options } = {}) => {
|
|
1309
|
-
return decodeRecords(readCompleteOutput(await runGit([
|
|
1310
|
-
"ls-files",
|
|
1311
|
-
"--others",
|
|
1312
|
-
"--exclude-standard",
|
|
1313
|
-
"--full-name",
|
|
1314
|
-
"-z",
|
|
1315
|
-
...toPathspecArgs(paths)
|
|
1316
|
-
], {
|
|
1317
|
-
...options,
|
|
1318
|
-
cwd,
|
|
1319
|
-
encoding: "buffer"
|
|
1320
|
-
}), "ls-files"), "ls-files");
|
|
1321
|
-
};
|
|
1322
|
-
var readTopLevel = async (cwd, options = {}) => {
|
|
1323
|
-
const inside = readSuccessfulOutput(await runGit(["rev-parse", "--is-inside-work-tree"], {
|
|
1324
|
-
...options,
|
|
1325
|
-
cwd
|
|
1326
|
-
}), "rev-parse").trim();
|
|
1327
|
-
if (inside === "false") return null;
|
|
1328
|
-
if (inside !== "true") throw invalidOutput("rev-parse");
|
|
1329
|
-
const output = decodeText(readSuccessfulOutput(await runGit(["rev-parse", "--show-toplevel"], {
|
|
1330
|
-
...options,
|
|
1331
|
-
cwd,
|
|
1332
|
-
encoding: "buffer"
|
|
1333
|
-
}), "rev-parse"), "rev-parse");
|
|
1334
|
-
const root = output.endsWith("\n") ? output.slice(0, -1) : "";
|
|
1335
|
-
if (root === "" || root.includes("\n")) throw invalidOutput("rev-parse");
|
|
1336
|
-
return root;
|
|
1337
|
-
};
|
|
1338
|
-
var readConfigBoolean = async (cwd, key, defaultValue, options = {}) => {
|
|
1339
|
-
if (!isArgumentValid(key) || key.startsWith("-") || /\s/.test(key)) throw invalidArgument("key");
|
|
1340
|
-
if (typeof defaultValue !== "boolean") throw invalidArgument("defaultValue");
|
|
1341
|
-
const value = readSuccessfulOutput(await runGit([
|
|
1342
|
-
"config",
|
|
1343
|
-
"--type=bool",
|
|
1344
|
-
`--default=${String(defaultValue)}`,
|
|
1345
|
-
"--get",
|
|
1346
|
-
key
|
|
1347
|
-
], {
|
|
1348
|
-
...options,
|
|
1349
|
-
cwd
|
|
1350
|
-
}), "config");
|
|
1351
|
-
if (value !== "true\n" && value !== "false\n") throw invalidOutput("config");
|
|
1352
|
-
return value === "true\n";
|
|
1353
|
-
};
|
|
1354
|
-
var readGitVersion = async (cwd, options = {}) => {
|
|
1355
|
-
const output = readSuccessfulOutput(await runGit(["version"], {
|
|
1356
|
-
...options,
|
|
1357
|
-
cwd
|
|
1358
|
-
}), "version");
|
|
1359
|
-
const match = GIT_VERSION_PATTERN.exec(output);
|
|
1360
|
-
const version = {
|
|
1361
|
-
major: Number(match?.[1]),
|
|
1362
|
-
minor: Number(match?.[2]),
|
|
1363
|
-
patch: Number(match?.[3])
|
|
1364
|
-
};
|
|
1365
|
-
if (!Object.values(version).every(Number.isSafeInteger)) throw invalidOutput("version");
|
|
1366
|
-
return version;
|
|
1367
|
-
};
|
|
1368
|
-
//#endregion
|
|
1369
|
-
//#region src/git-command/utilities.ts
|
|
1370
|
-
var createGitFailure = (reason, subcommand) => Object.freeze({
|
|
1371
|
-
kind: "failed",
|
|
1372
|
-
reason,
|
|
1373
|
-
...subcommand === void 0 ? {} : { subcommand }
|
|
1374
|
-
});
|
|
1375
|
-
var classifyGitFailure = (error, signal) => {
|
|
1376
|
-
if (signal?.aborted === true) return "aborted";
|
|
1377
|
-
switch (getErrorCode(error)) {
|
|
1378
|
-
case ERRORS.GIT_NOT_FOUND: return "not-found";
|
|
1379
|
-
case ERRORS.GIT_REPOSITORY_NOT_FOUND: return "repository-not-found";
|
|
1380
|
-
case ERRORS.GIT_ACCESS_DENIED: return "access-denied";
|
|
1381
|
-
case ERRORS.GIT_OUTPUT_INVALID: return "output-invalid";
|
|
1382
|
-
case ERRORS$2.PROCESS_OUTPUT_TOO_LARGE: return "output-limit-exceeded";
|
|
1383
|
-
case ERRORS$2.PROCESS_START_FAILED: {
|
|
1384
|
-
const causeCode = getErrorCode(error.cause);
|
|
1385
|
-
return causeCode === "EACCES" || causeCode === "EPERM" ? "access-denied" : "command-failed";
|
|
1386
|
-
}
|
|
1387
|
-
default: return "command-failed";
|
|
1388
|
-
}
|
|
1389
|
-
};
|
|
1390
|
-
var readGit = async (read, signal, subcommand) => {
|
|
1391
|
-
try {
|
|
1392
|
-
return Object.freeze({
|
|
1393
|
-
kind: "completed",
|
|
1394
|
-
value: await read()
|
|
1395
|
-
});
|
|
1396
|
-
} catch (error) {
|
|
1397
|
-
return createGitFailure(classifyGitFailure(error, signal), subcommand);
|
|
1398
|
-
}
|
|
1399
|
-
};
|
|
1400
|
-
var checkGitResult = (result, subcommand) => {
|
|
1401
|
-
if (result.stderr.byteLength > 4096) return "output-invalid";
|
|
1402
|
-
try {
|
|
1403
|
-
assertGitSucceeded(result, subcommand);
|
|
1404
|
-
} catch (error) {
|
|
1405
|
-
return classifyGitFailure(error);
|
|
1406
|
-
}
|
|
1407
|
-
return result.stderr.byteLength === 0 ? null : "output-invalid";
|
|
1408
|
-
};
|
|
1409
|
-
//#endregion
|
|
1410
|
-
//#region src/git-version/constants.ts
|
|
1411
|
-
var MINIMUM_GIT_VERSION_COMPONENTS = Object.freeze({
|
|
1412
|
-
major: 2,
|
|
1413
|
-
minor: 32,
|
|
1414
|
-
patch: 0
|
|
1415
|
-
});
|
|
1416
|
-
var MINIMUM_GIT_VERSION = `${MINIMUM_GIT_VERSION_COMPONENTS.major}.${MINIMUM_GIT_VERSION_COMPONENTS.minor}.${MINIMUM_GIT_VERSION_COMPONENTS.patch}`;
|
|
1417
|
-
var MAX_GIT_VERSION_OUTPUT_BYTES = 4096;
|
|
1418
|
-
//#endregion
|
|
1419
|
-
//#region src/git-version/preflight.ts
|
|
1420
|
-
var mapGitFailure = (reason) => {
|
|
1421
|
-
switch (reason) {
|
|
1422
|
-
case "aborted": return "GIT_OPERATION_ABORTED";
|
|
1423
|
-
case "not-found": return "GIT_NOT_FOUND";
|
|
1424
|
-
case "access-denied": return "GIT_ACCESS_DENIED";
|
|
1425
|
-
case "output-limit-exceeded":
|
|
1426
|
-
case "output-invalid": return "GIT_VERSION_INVALID";
|
|
1427
|
-
case "repository-not-found":
|
|
1428
|
-
case "command-failed": return "GIT_COMMAND_FAILED";
|
|
1429
|
-
}
|
|
1430
|
-
};
|
|
1431
|
-
var isGitVersionSupported = (version) => {
|
|
1432
|
-
if (version.major !== MINIMUM_GIT_VERSION_COMPONENTS.major) return version.major > MINIMUM_GIT_VERSION_COMPONENTS.major;
|
|
1433
|
-
if (version.minor !== MINIMUM_GIT_VERSION_COMPONENTS.minor) return version.minor > MINIMUM_GIT_VERSION_COMPONENTS.minor;
|
|
1434
|
-
return version.patch >= MINIMUM_GIT_VERSION_COMPONENTS.patch;
|
|
1435
|
-
};
|
|
1436
|
-
var createGitVersionPreflight = (readVersion = readGitVersion) => async (directory, signal) => {
|
|
1437
|
-
const versionResult = await readGit(() => readVersion(directory, {
|
|
1438
|
-
maxOutputBytes: MAX_GIT_VERSION_OUTPUT_BYTES,
|
|
1439
|
-
timeoutSeconds: 300,
|
|
1440
|
-
...signal === void 0 ? {} : { signal }
|
|
1441
|
-
}), signal);
|
|
1442
|
-
if (versionResult.kind === "failed") return Object.freeze({
|
|
1443
|
-
errorCode: mapGitFailure(versionResult.reason),
|
|
1444
|
-
kind: "failed"
|
|
1445
|
-
});
|
|
1446
|
-
if (!isGitVersionSupported(versionResult.value)) return Object.freeze({
|
|
1447
|
-
errorCode: "GIT_VERSION_UNSUPPORTED",
|
|
1448
|
-
kind: "failed"
|
|
1449
|
-
});
|
|
1450
|
-
return Object.freeze({
|
|
1451
|
-
kind: "supported",
|
|
1452
|
-
version: Object.freeze({ ...versionResult.value })
|
|
1453
|
-
});
|
|
1454
|
-
};
|
|
1455
|
-
//#endregion
|
|
1456
|
-
//#region src/composition/exception.ts
|
|
1457
|
-
var MoldeaCliCompositionException = class extends Error {
|
|
1458
|
-
code = "COMPOSITION_STATE_INVALID";
|
|
1459
|
-
constructor() {
|
|
1460
|
-
super(createMoldeaCliOwnedError("COMPOSITION_STATE_INVALID").message);
|
|
1461
|
-
this.name = "MoldeaCliCompositionException";
|
|
1462
|
-
}
|
|
1463
|
-
};
|
|
1464
|
-
//#endregion
|
|
1465
|
-
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/constants.js
|
|
1466
|
-
var require_constants = __commonJSMin(((exports, module) => {
|
|
1467
|
-
module.exports = {
|
|
1468
|
-
MAX_LENGTH: 256,
|
|
1469
|
-
MAX_SAFE_COMPONENT_LENGTH: 16,
|
|
1470
|
-
MAX_SAFE_BUILD_LENGTH: 250,
|
|
1471
|
-
MAX_SAFE_INTEGER: Number.MAX_SAFE_INTEGER || 9007199254740991,
|
|
1472
|
-
RELEASE_TYPES: [
|
|
1473
|
-
"major",
|
|
1474
|
-
"premajor",
|
|
1475
|
-
"minor",
|
|
1476
|
-
"preminor",
|
|
1477
|
-
"patch",
|
|
1478
|
-
"prepatch",
|
|
1479
|
-
"prerelease"
|
|
1480
|
-
],
|
|
1481
|
-
SEMVER_SPEC_VERSION: "2.0.0",
|
|
1482
|
-
FLAG_INCLUDE_PRERELEASE: 1,
|
|
1483
|
-
FLAG_LOOSE: 2
|
|
1484
|
-
};
|
|
1485
|
-
}));
|
|
1486
|
-
//#endregion
|
|
1487
|
-
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/debug.js
|
|
1488
|
-
var require_debug = __commonJSMin(((exports, module) => {
|
|
1489
|
-
module.exports = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {};
|
|
1490
|
-
}));
|
|
1491
|
-
//#endregion
|
|
1492
|
-
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/re.js
|
|
1493
|
-
var require_re = __commonJSMin(((exports, module) => {
|
|
1494
|
-
var { MAX_SAFE_COMPONENT_LENGTH, MAX_SAFE_BUILD_LENGTH, MAX_LENGTH } = require_constants();
|
|
1495
|
-
var debug = require_debug();
|
|
1496
|
-
exports = module.exports = {};
|
|
1497
|
-
var re = exports.re = [];
|
|
1498
|
-
var safeRe = exports.safeRe = [];
|
|
1499
|
-
var src = exports.src = [];
|
|
1500
|
-
var safeSrc = exports.safeSrc = [];
|
|
1501
|
-
var t = exports.t = {};
|
|
1502
|
-
var R = 0;
|
|
1503
|
-
var LETTERDASHNUMBER = "[a-zA-Z0-9-]";
|
|
1504
|
-
var safeRegexReplacements = [
|
|
1505
|
-
["\\s", 1],
|
|
1506
|
-
["\\d", MAX_LENGTH],
|
|
1507
|
-
[LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]
|
|
1508
|
-
];
|
|
1509
|
-
var makeSafeRegex = (value) => {
|
|
1510
|
-
for (const [token, max] of safeRegexReplacements) value = value.split(`${token}*`).join(`${token}{0,${max}}`).split(`${token}+`).join(`${token}{1,${max}}`);
|
|
1511
|
-
return value;
|
|
1512
|
-
};
|
|
1513
|
-
var createToken = (name, value, isGlobal) => {
|
|
1514
|
-
const safe = makeSafeRegex(value);
|
|
1515
|
-
const index = R++;
|
|
1516
|
-
debug(name, index, value);
|
|
1517
|
-
t[name] = index;
|
|
1518
|
-
src[index] = value;
|
|
1519
|
-
safeSrc[index] = safe;
|
|
1520
|
-
re[index] = new RegExp(value, isGlobal ? "g" : void 0);
|
|
1521
|
-
safeRe[index] = new RegExp(safe, isGlobal ? "g" : void 0);
|
|
1522
|
-
};
|
|
1523
|
-
createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
|
|
1524
|
-
createToken("NUMERICIDENTIFIERLOOSE", "\\d+");
|
|
1525
|
-
createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
|
|
1526
|
-
createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})`);
|
|
1527
|
-
createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})`);
|
|
1528
|
-
createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIER]})`);
|
|
1529
|
-
createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NONNUMERICIDENTIFIER]}|${src[t.NUMERICIDENTIFIERLOOSE]})`);
|
|
1530
|
-
createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
|
|
1531
|
-
createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
|
|
1532
|
-
createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
|
|
1533
|
-
createToken("BUILD", `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
|
|
1534
|
-
createToken("FULLPLAIN", `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);
|
|
1535
|
-
createToken("FULL", `^${src[t.FULLPLAIN]}$`);
|
|
1536
|
-
createToken("LOOSEPLAIN", `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`);
|
|
1537
|
-
createToken("LOOSE", `^${src[t.LOOSEPLAIN]}$`);
|
|
1538
|
-
createToken("GTLT", "((?:<|>)?=?)");
|
|
1539
|
-
createToken("XRANGEIDENTIFIERLOOSE", `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
|
|
1540
|
-
createToken("XRANGEIDENTIFIER", `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
|
|
1541
|
-
createToken("XRANGEPLAIN", `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?)?)?`);
|
|
1542
|
-
createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?)?)?`);
|
|
1543
|
-
createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
|
|
1544
|
-
createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
|
|
1545
|
-
createToken("COERCEPLAIN", `(^|[^\\d])(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
|
|
1546
|
-
createToken("COERCE", `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
|
|
1547
|
-
createToken("COERCEFULL", src[t.COERCEPLAIN] + `(?:${src[t.PRERELEASE]})?(?:${src[t.BUILD]})?(?:$|[^\\d])`);
|
|
1548
|
-
createToken("COERCERTL", src[t.COERCE], true);
|
|
1549
|
-
createToken("COERCERTLFULL", src[t.COERCEFULL], true);
|
|
1550
|
-
createToken("LONETILDE", "(?:~>?)");
|
|
1551
|
-
createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, true);
|
|
1552
|
-
exports.tildeTrimReplace = "$1~";
|
|
1553
|
-
createToken("TILDE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
|
|
1554
|
-
createToken("TILDELOOSE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
|
|
1555
|
-
createToken("LONECARET", "(?:\\^)");
|
|
1556
|
-
createToken("CARETTRIM", `(\\s*)${src[t.LONECARET]}\\s+`, true);
|
|
1557
|
-
exports.caretTrimReplace = "$1^";
|
|
1558
|
-
createToken("CARET", `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
|
|
1559
|
-
createToken("CARETLOOSE", `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
|
|
1560
|
-
createToken("COMPARATORLOOSE", `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
|
|
1561
|
-
createToken("COMPARATOR", `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
|
|
1562
|
-
createToken("COMPARATORTRIM", `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
|
|
1563
|
-
exports.comparatorTrimReplace = "$1$2$3";
|
|
1564
|
-
createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})\\s+-\\s+(${src[t.XRANGEPLAIN]})\\s*$`);
|
|
1565
|
-
createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t.XRANGEPLAINLOOSE]})\\s*$`);
|
|
1566
|
-
createToken("STAR", "(<|>)?=?\\s*\\*");
|
|
1567
|
-
createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
|
|
1568
|
-
createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
|
|
1569
|
-
}));
|
|
1570
|
-
//#endregion
|
|
1571
|
-
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/parse-options.js
|
|
1572
|
-
var require_parse_options = __commonJSMin(((exports, module) => {
|
|
1573
|
-
var looseOption = Object.freeze({ loose: true });
|
|
1574
|
-
var emptyOpts = Object.freeze({});
|
|
1575
|
-
var parseOptions = (options) => {
|
|
1576
|
-
if (!options) return emptyOpts;
|
|
1577
|
-
if (typeof options !== "object") return looseOption;
|
|
1578
|
-
return options;
|
|
1579
|
-
};
|
|
1580
|
-
module.exports = parseOptions;
|
|
1581
|
-
}));
|
|
1582
|
-
//#endregion
|
|
1583
|
-
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/identifiers.js
|
|
1584
|
-
var require_identifiers = __commonJSMin(((exports, module) => {
|
|
1585
|
-
var numeric = /^[0-9]+$/;
|
|
1586
|
-
var compareIdentifiers = (a, b) => {
|
|
1587
|
-
if (typeof a === "number" && typeof b === "number") return a === b ? 0 : a < b ? -1 : 1;
|
|
1588
|
-
const anum = numeric.test(a);
|
|
1589
|
-
const bnum = numeric.test(b);
|
|
1590
|
-
if (anum && bnum) {
|
|
1591
|
-
a = +a;
|
|
1592
|
-
b = +b;
|
|
1593
|
-
}
|
|
1594
|
-
return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
|
|
1595
|
-
};
|
|
1596
|
-
var rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
|
|
1597
|
-
module.exports = {
|
|
1598
|
-
compareIdentifiers,
|
|
1599
|
-
rcompareIdentifiers
|
|
1600
|
-
};
|
|
1601
|
-
}));
|
|
1602
|
-
//#endregion
|
|
1603
|
-
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/classes/semver.js
|
|
1604
|
-
var require_semver$1 = __commonJSMin(((exports, module) => {
|
|
1605
|
-
var debug = require_debug();
|
|
1606
|
-
var { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants();
|
|
1607
|
-
var { safeRe: re, t } = require_re();
|
|
1608
|
-
var parseOptions = require_parse_options();
|
|
1609
|
-
var { compareIdentifiers } = require_identifiers();
|
|
1610
|
-
var isPrereleaseIdentifier = (prerelease, identifier) => {
|
|
1611
|
-
const identifiers = identifier.split(".");
|
|
1612
|
-
if (identifiers.length > prerelease.length) return false;
|
|
1613
|
-
for (let i = 0; i < identifiers.length; i++) if (compareIdentifiers(prerelease[i], identifiers[i]) !== 0) return false;
|
|
1614
|
-
return true;
|
|
1615
|
-
};
|
|
1616
|
-
module.exports = class SemVer {
|
|
1617
|
-
constructor(version, options) {
|
|
1618
|
-
options = parseOptions(options);
|
|
1619
|
-
if (version instanceof SemVer) {
|
|
1620
|
-
if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) return version;
|
|
1621
|
-
else version = version.version;
|
|
1622
|
-
} else if (typeof version !== "string") throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`);
|
|
1623
|
-
if (version.length > MAX_LENGTH) throw new TypeError(`version is longer than ${MAX_LENGTH} characters`);
|
|
1624
|
-
debug("SemVer", version, options);
|
|
1625
|
-
this.options = options;
|
|
1626
|
-
this.loose = !!options.loose;
|
|
1627
|
-
this.includePrerelease = !!options.includePrerelease;
|
|
1628
|
-
const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
|
|
1629
|
-
if (!m) throw new TypeError(`Invalid Version: ${version}`);
|
|
1630
|
-
this.raw = version;
|
|
1631
|
-
this.major = +m[1];
|
|
1632
|
-
this.minor = +m[2];
|
|
1633
|
-
this.patch = +m[3];
|
|
1634
|
-
if (this.major > MAX_SAFE_INTEGER || this.major < 0) throw new TypeError("Invalid major version");
|
|
1635
|
-
if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) throw new TypeError("Invalid minor version");
|
|
1636
|
-
if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) throw new TypeError("Invalid patch version");
|
|
1637
|
-
if (!m[4]) this.prerelease = [];
|
|
1638
|
-
else this.prerelease = m[4].split(".").map((id) => {
|
|
1639
|
-
if (/^[0-9]+$/.test(id)) {
|
|
1640
|
-
const num = +id;
|
|
1641
|
-
if (num >= 0 && num < MAX_SAFE_INTEGER) return num;
|
|
1642
|
-
}
|
|
1643
|
-
return id;
|
|
1644
|
-
});
|
|
1645
|
-
this.build = m[5] ? m[5].split(".") : [];
|
|
1646
|
-
this.format();
|
|
1647
|
-
}
|
|
1648
|
-
format() {
|
|
1649
|
-
this.version = `${this.major}.${this.minor}.${this.patch}`;
|
|
1650
|
-
if (this.prerelease.length) this.version += `-${this.prerelease.join(".")}`;
|
|
1651
|
-
return this.version;
|
|
1652
|
-
}
|
|
1653
|
-
toString() {
|
|
1654
|
-
return this.version;
|
|
1655
|
-
}
|
|
1656
|
-
compare(other) {
|
|
1657
|
-
debug("SemVer.compare", this.version, this.options, other);
|
|
1658
|
-
if (!(other instanceof SemVer)) {
|
|
1659
|
-
if (typeof other === "string" && other === this.version) return 0;
|
|
1660
|
-
other = new SemVer(other, this.options);
|
|
1661
|
-
}
|
|
1662
|
-
if (other.version === this.version) return 0;
|
|
1663
|
-
return this.compareMain(other) || this.comparePre(other);
|
|
1664
|
-
}
|
|
1665
|
-
compareMain(other) {
|
|
1666
|
-
if (!(other instanceof SemVer)) other = new SemVer(other, this.options);
|
|
1667
|
-
if (this.major < other.major) return -1;
|
|
1668
|
-
if (this.major > other.major) return 1;
|
|
1669
|
-
if (this.minor < other.minor) return -1;
|
|
1670
|
-
if (this.minor > other.minor) return 1;
|
|
1671
|
-
if (this.patch < other.patch) return -1;
|
|
1672
|
-
if (this.patch > other.patch) return 1;
|
|
1673
|
-
return 0;
|
|
1674
|
-
}
|
|
1675
|
-
comparePre(other) {
|
|
1676
|
-
if (!(other instanceof SemVer)) other = new SemVer(other, this.options);
|
|
1677
|
-
if (this.prerelease.length && !other.prerelease.length) return -1;
|
|
1678
|
-
else if (!this.prerelease.length && other.prerelease.length) return 1;
|
|
1679
|
-
else if (!this.prerelease.length && !other.prerelease.length) return 0;
|
|
1680
|
-
let i = 0;
|
|
1681
|
-
do {
|
|
1682
|
-
const a = this.prerelease[i];
|
|
1683
|
-
const b = other.prerelease[i];
|
|
1684
|
-
debug("prerelease compare", i, a, b);
|
|
1685
|
-
if (a === void 0 && b === void 0) return 0;
|
|
1686
|
-
else if (b === void 0) return 1;
|
|
1687
|
-
else if (a === void 0) return -1;
|
|
1688
|
-
else if (a === b) continue;
|
|
1689
|
-
else return compareIdentifiers(a, b);
|
|
1690
|
-
} while (++i);
|
|
1691
|
-
}
|
|
1692
|
-
compareBuild(other) {
|
|
1693
|
-
if (!(other instanceof SemVer)) other = new SemVer(other, this.options);
|
|
1694
|
-
let i = 0;
|
|
1695
|
-
do {
|
|
1696
|
-
const a = this.build[i];
|
|
1697
|
-
const b = other.build[i];
|
|
1698
|
-
debug("build compare", i, a, b);
|
|
1699
|
-
if (a === void 0 && b === void 0) return 0;
|
|
1700
|
-
else if (b === void 0) return 1;
|
|
1701
|
-
else if (a === void 0) return -1;
|
|
1702
|
-
else if (a === b) continue;
|
|
1703
|
-
else return compareIdentifiers(a, b);
|
|
1704
|
-
} while (++i);
|
|
1705
|
-
}
|
|
1706
|
-
inc(release, identifier, identifierBase) {
|
|
1707
|
-
if (release.startsWith("pre")) {
|
|
1708
|
-
if (!identifier && identifierBase === false) throw new Error("invalid increment argument: identifier is empty");
|
|
1709
|
-
if (identifier) {
|
|
1710
|
-
const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE]);
|
|
1711
|
-
if (!match || match[1] !== identifier) throw new Error(`invalid identifier: ${identifier}`);
|
|
1712
|
-
}
|
|
1713
|
-
}
|
|
1714
|
-
switch (release) {
|
|
1715
|
-
case "premajor":
|
|
1716
|
-
this.prerelease.length = 0;
|
|
1717
|
-
this.patch = 0;
|
|
1718
|
-
this.minor = 0;
|
|
1719
|
-
this.major++;
|
|
1720
|
-
this.inc("pre", identifier, identifierBase);
|
|
1721
|
-
break;
|
|
1722
|
-
case "preminor":
|
|
1723
|
-
this.prerelease.length = 0;
|
|
1724
|
-
this.patch = 0;
|
|
1725
|
-
this.minor++;
|
|
1726
|
-
this.inc("pre", identifier, identifierBase);
|
|
1727
|
-
break;
|
|
1728
|
-
case "prepatch":
|
|
1729
|
-
this.prerelease.length = 0;
|
|
1730
|
-
this.inc("patch", identifier, identifierBase);
|
|
1731
|
-
this.inc("pre", identifier, identifierBase);
|
|
1732
|
-
break;
|
|
1733
|
-
case "prerelease":
|
|
1734
|
-
if (this.prerelease.length === 0) this.inc("patch", identifier, identifierBase);
|
|
1735
|
-
this.inc("pre", identifier, identifierBase);
|
|
1736
|
-
break;
|
|
1737
|
-
case "release":
|
|
1738
|
-
if (this.prerelease.length === 0) throw new Error(`version ${this.raw} is not a prerelease`);
|
|
1739
|
-
this.prerelease.length = 0;
|
|
1740
|
-
break;
|
|
1741
|
-
case "major":
|
|
1742
|
-
if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) this.major++;
|
|
1743
|
-
this.minor = 0;
|
|
1744
|
-
this.patch = 0;
|
|
1745
|
-
this.prerelease = [];
|
|
1746
|
-
break;
|
|
1747
|
-
case "minor":
|
|
1748
|
-
if (this.patch !== 0 || this.prerelease.length === 0) this.minor++;
|
|
1749
|
-
this.patch = 0;
|
|
1750
|
-
this.prerelease = [];
|
|
1751
|
-
break;
|
|
1752
|
-
case "patch":
|
|
1753
|
-
if (this.prerelease.length === 0) this.patch++;
|
|
1754
|
-
this.prerelease = [];
|
|
1755
|
-
break;
|
|
1756
|
-
case "pre": {
|
|
1757
|
-
const base = Number(identifierBase) ? 1 : 0;
|
|
1758
|
-
if (this.prerelease.length === 0) this.prerelease = [base];
|
|
1759
|
-
else {
|
|
1760
|
-
let i = this.prerelease.length;
|
|
1761
|
-
while (--i >= 0) if (typeof this.prerelease[i] === "number") {
|
|
1762
|
-
this.prerelease[i]++;
|
|
1763
|
-
i = -2;
|
|
1764
|
-
}
|
|
1765
|
-
if (i === -1) {
|
|
1766
|
-
if (identifier === this.prerelease.join(".") && identifierBase === false) throw new Error("invalid increment argument: identifier already exists");
|
|
1767
|
-
this.prerelease.push(base);
|
|
1768
|
-
}
|
|
1769
|
-
}
|
|
1770
|
-
if (identifier) {
|
|
1771
|
-
let prerelease = [identifier, base];
|
|
1772
|
-
if (identifierBase === false) prerelease = [identifier];
|
|
1773
|
-
if (isPrereleaseIdentifier(this.prerelease, identifier)) {
|
|
1774
|
-
const prereleaseBase = this.prerelease[identifier.split(".").length];
|
|
1775
|
-
if (isNaN(prereleaseBase)) this.prerelease = prerelease;
|
|
1776
|
-
} else this.prerelease = prerelease;
|
|
1777
|
-
}
|
|
1778
|
-
break;
|
|
1779
|
-
}
|
|
1780
|
-
default: throw new Error(`invalid increment argument: ${release}`);
|
|
1781
|
-
}
|
|
1782
|
-
this.raw = this.format();
|
|
1783
|
-
if (this.build.length) this.raw += `+${this.build.join(".")}`;
|
|
1784
|
-
return this;
|
|
1785
|
-
}
|
|
1786
|
-
};
|
|
1787
|
-
}));
|
|
1788
|
-
//#endregion
|
|
1789
|
-
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/parse.js
|
|
1790
|
-
var require_parse = __commonJSMin(((exports, module) => {
|
|
1791
|
-
var SemVer = require_semver$1();
|
|
1792
|
-
var parse = (version, options, throwErrors = false) => {
|
|
1793
|
-
if (version instanceof SemVer) return version;
|
|
1794
|
-
try {
|
|
1795
|
-
return new SemVer(version, options);
|
|
1796
|
-
} catch (er) {
|
|
1797
|
-
if (!throwErrors) return null;
|
|
1798
|
-
throw er;
|
|
1799
|
-
}
|
|
1800
|
-
};
|
|
1801
|
-
module.exports = parse;
|
|
1802
|
-
}));
|
|
1803
|
-
//#endregion
|
|
1804
|
-
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/valid.js
|
|
1805
|
-
var require_valid$1 = __commonJSMin(((exports, module) => {
|
|
1806
|
-
var parse = require_parse();
|
|
1807
|
-
var valid = (version, options) => {
|
|
1808
|
-
const v = parse(version, options);
|
|
1809
|
-
return v ? v.version : null;
|
|
1810
|
-
};
|
|
1811
|
-
module.exports = valid;
|
|
1812
|
-
}));
|
|
1813
|
-
//#endregion
|
|
1814
|
-
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/clean.js
|
|
1815
|
-
var require_clean = __commonJSMin(((exports, module) => {
|
|
1816
|
-
var parse = require_parse();
|
|
1817
|
-
var clean = (version, options) => {
|
|
1818
|
-
const s = parse(version.trim().replace(/^[=v]+/, ""), options);
|
|
1819
|
-
return s ? s.version : null;
|
|
1820
|
-
};
|
|
1821
|
-
module.exports = clean;
|
|
1822
|
-
}));
|
|
1823
|
-
//#endregion
|
|
1824
|
-
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/inc.js
|
|
1825
|
-
var require_inc = __commonJSMin(((exports, module) => {
|
|
1826
|
-
var SemVer = require_semver$1();
|
|
1827
|
-
var inc = (version, release, options, identifier, identifierBase) => {
|
|
1828
|
-
if (typeof options === "string") {
|
|
1829
|
-
identifierBase = identifier;
|
|
1830
|
-
identifier = options;
|
|
1831
|
-
options = void 0;
|
|
1832
|
-
}
|
|
1833
|
-
try {
|
|
1834
|
-
return new SemVer(version instanceof SemVer ? version.version : version, options).inc(release, identifier, identifierBase).version;
|
|
1835
|
-
} catch (er) {
|
|
1836
|
-
return null;
|
|
1837
|
-
}
|
|
1838
|
-
};
|
|
1839
|
-
module.exports = inc;
|
|
1840
|
-
}));
|
|
1841
|
-
//#endregion
|
|
1842
|
-
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/diff.js
|
|
1843
|
-
var require_diff = __commonJSMin(((exports, module) => {
|
|
1844
|
-
var parse = require_parse();
|
|
1845
|
-
var diff = (version1, version2) => {
|
|
1846
|
-
const v1 = parse(version1, null, true);
|
|
1847
|
-
const v2 = parse(version2, null, true);
|
|
1848
|
-
const comparison = v1.compare(v2);
|
|
1849
|
-
if (comparison === 0) return null;
|
|
1850
|
-
const v1Higher = comparison > 0;
|
|
1851
|
-
const highVersion = v1Higher ? v1 : v2;
|
|
1852
|
-
const lowVersion = v1Higher ? v2 : v1;
|
|
1853
|
-
const highHasPre = !!highVersion.prerelease.length;
|
|
1854
|
-
if (!!lowVersion.prerelease.length && !highHasPre) {
|
|
1855
|
-
if (!lowVersion.patch && !lowVersion.minor) return "major";
|
|
1856
|
-
if (lowVersion.compareMain(highVersion) === 0) {
|
|
1857
|
-
if (lowVersion.minor && !lowVersion.patch) return "minor";
|
|
1858
|
-
return "patch";
|
|
1859
|
-
}
|
|
1860
|
-
}
|
|
1861
|
-
const prefix = highHasPre ? "pre" : "";
|
|
1862
|
-
if (v1.major !== v2.major) return prefix + "major";
|
|
1863
|
-
if (v1.minor !== v2.minor) return prefix + "minor";
|
|
1864
|
-
if (v1.patch !== v2.patch) return prefix + "patch";
|
|
1865
|
-
return "prerelease";
|
|
1866
|
-
};
|
|
1867
|
-
module.exports = diff;
|
|
1868
|
-
}));
|
|
1869
|
-
//#endregion
|
|
1870
|
-
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/major.js
|
|
1871
|
-
var require_major = __commonJSMin(((exports, module) => {
|
|
1872
|
-
var SemVer = require_semver$1();
|
|
1873
|
-
var major = (a, loose) => new SemVer(a, loose).major;
|
|
1874
|
-
module.exports = major;
|
|
1875
|
-
}));
|
|
1876
|
-
//#endregion
|
|
1877
|
-
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/minor.js
|
|
1878
|
-
var require_minor = __commonJSMin(((exports, module) => {
|
|
1879
|
-
var SemVer = require_semver$1();
|
|
1880
|
-
var minor = (a, loose) => new SemVer(a, loose).minor;
|
|
1881
|
-
module.exports = minor;
|
|
1882
|
-
}));
|
|
1883
|
-
//#endregion
|
|
1884
|
-
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/patch.js
|
|
1885
|
-
var require_patch = __commonJSMin(((exports, module) => {
|
|
1886
|
-
var SemVer = require_semver$1();
|
|
1887
|
-
var patch = (a, loose) => new SemVer(a, loose).patch;
|
|
1888
|
-
module.exports = patch;
|
|
1889
|
-
}));
|
|
1890
|
-
//#endregion
|
|
1891
|
-
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/prerelease.js
|
|
1892
|
-
var require_prerelease = __commonJSMin(((exports, module) => {
|
|
1893
|
-
var parse = require_parse();
|
|
1894
|
-
var prerelease = (version, options) => {
|
|
1895
|
-
const parsed = parse(version, options);
|
|
1896
|
-
return parsed && parsed.prerelease.length ? parsed.prerelease : null;
|
|
1897
|
-
};
|
|
1898
|
-
module.exports = prerelease;
|
|
1899
|
-
}));
|
|
1900
|
-
//#endregion
|
|
1901
|
-
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/compare.js
|
|
1902
|
-
var require_compare = __commonJSMin(((exports, module) => {
|
|
1903
|
-
var SemVer = require_semver$1();
|
|
1904
|
-
var compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
|
|
1905
|
-
module.exports = compare;
|
|
1906
|
-
}));
|
|
1907
|
-
//#endregion
|
|
1908
|
-
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/rcompare.js
|
|
1909
|
-
var require_rcompare = __commonJSMin(((exports, module) => {
|
|
1910
|
-
var compare = require_compare();
|
|
1911
|
-
var rcompare = (a, b, loose) => compare(b, a, loose);
|
|
1912
|
-
module.exports = rcompare;
|
|
1913
|
-
}));
|
|
1914
|
-
//#endregion
|
|
1915
|
-
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/compare-loose.js
|
|
1916
|
-
var require_compare_loose = __commonJSMin(((exports, module) => {
|
|
1917
|
-
var compare = require_compare();
|
|
1918
|
-
var compareLoose = (a, b) => compare(a, b, true);
|
|
1919
|
-
module.exports = compareLoose;
|
|
1920
|
-
}));
|
|
1921
|
-
//#endregion
|
|
1922
|
-
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/compare-build.js
|
|
1923
|
-
var require_compare_build = __commonJSMin(((exports, module) => {
|
|
1924
|
-
var SemVer = require_semver$1();
|
|
1925
|
-
var compareBuild = (a, b, loose) => {
|
|
1926
|
-
const versionA = new SemVer(a, loose);
|
|
1927
|
-
const versionB = new SemVer(b, loose);
|
|
1928
|
-
return versionA.compare(versionB) || versionA.compareBuild(versionB);
|
|
1929
|
-
};
|
|
1930
|
-
module.exports = compareBuild;
|
|
1931
|
-
}));
|
|
1932
|
-
//#endregion
|
|
1933
|
-
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/sort.js
|
|
1934
|
-
var require_sort = __commonJSMin(((exports, module) => {
|
|
1935
|
-
var compareBuild = require_compare_build();
|
|
1936
|
-
var sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose));
|
|
1937
|
-
module.exports = sort;
|
|
1938
|
-
}));
|
|
1939
|
-
//#endregion
|
|
1940
|
-
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/rsort.js
|
|
1941
|
-
var require_rsort = __commonJSMin(((exports, module) => {
|
|
1942
|
-
var compareBuild = require_compare_build();
|
|
1943
|
-
var rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose));
|
|
1944
|
-
module.exports = rsort;
|
|
1945
|
-
}));
|
|
1946
|
-
//#endregion
|
|
1947
|
-
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/gt.js
|
|
1948
|
-
var require_gt = __commonJSMin(((exports, module) => {
|
|
1949
|
-
var compare = require_compare();
|
|
1950
|
-
var gt = (a, b, loose) => compare(a, b, loose) > 0;
|
|
1951
|
-
module.exports = gt;
|
|
1952
|
-
}));
|
|
1953
|
-
//#endregion
|
|
1954
|
-
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/lt.js
|
|
1955
|
-
var require_lt = __commonJSMin(((exports, module) => {
|
|
1956
|
-
var compare = require_compare();
|
|
1957
|
-
var lt = (a, b, loose) => compare(a, b, loose) < 0;
|
|
1958
|
-
module.exports = lt;
|
|
1959
|
-
}));
|
|
1960
|
-
//#endregion
|
|
1961
|
-
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/eq.js
|
|
1962
|
-
var require_eq = __commonJSMin(((exports, module) => {
|
|
1963
|
-
var compare = require_compare();
|
|
1964
|
-
var eq = (a, b, loose) => compare(a, b, loose) === 0;
|
|
1965
|
-
module.exports = eq;
|
|
1966
|
-
}));
|
|
1967
|
-
//#endregion
|
|
1968
|
-
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/neq.js
|
|
1969
|
-
var require_neq = __commonJSMin(((exports, module) => {
|
|
1970
|
-
var compare = require_compare();
|
|
1971
|
-
var neq = (a, b, loose) => compare(a, b, loose) !== 0;
|
|
1972
|
-
module.exports = neq;
|
|
1973
|
-
}));
|
|
1974
|
-
//#endregion
|
|
1975
|
-
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/gte.js
|
|
1976
|
-
var require_gte = __commonJSMin(((exports, module) => {
|
|
1977
|
-
var compare = require_compare();
|
|
1978
|
-
var gte = (a, b, loose) => compare(a, b, loose) >= 0;
|
|
1979
|
-
module.exports = gte;
|
|
1980
|
-
}));
|
|
1981
|
-
//#endregion
|
|
1982
|
-
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/lte.js
|
|
1983
|
-
var require_lte = __commonJSMin(((exports, module) => {
|
|
1984
|
-
var compare = require_compare();
|
|
1985
|
-
var lte = (a, b, loose) => compare(a, b, loose) <= 0;
|
|
1986
|
-
module.exports = lte;
|
|
1987
|
-
}));
|
|
1988
|
-
//#endregion
|
|
1989
|
-
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/cmp.js
|
|
1990
|
-
var require_cmp = __commonJSMin(((exports, module) => {
|
|
1991
|
-
var eq = require_eq();
|
|
1992
|
-
var neq = require_neq();
|
|
1993
|
-
var gt = require_gt();
|
|
1994
|
-
var gte = require_gte();
|
|
1995
|
-
var lt = require_lt();
|
|
1996
|
-
var lte = require_lte();
|
|
1997
|
-
var cmp = (a, op, b, loose) => {
|
|
1998
|
-
switch (op) {
|
|
1999
|
-
case "===":
|
|
2000
|
-
if (typeof a === "object") a = a.version;
|
|
2001
|
-
if (typeof b === "object") b = b.version;
|
|
2002
|
-
return a === b;
|
|
2003
|
-
case "!==":
|
|
2004
|
-
if (typeof a === "object") a = a.version;
|
|
2005
|
-
if (typeof b === "object") b = b.version;
|
|
2006
|
-
return a !== b;
|
|
2007
|
-
case "":
|
|
2008
|
-
case "=":
|
|
2009
|
-
case "==": return eq(a, b, loose);
|
|
2010
|
-
case "!=": return neq(a, b, loose);
|
|
2011
|
-
case ">": return gt(a, b, loose);
|
|
2012
|
-
case ">=": return gte(a, b, loose);
|
|
2013
|
-
case "<": return lt(a, b, loose);
|
|
2014
|
-
case "<=": return lte(a, b, loose);
|
|
2015
|
-
default: throw new TypeError(`Invalid operator: ${op}`);
|
|
2016
|
-
}
|
|
2017
|
-
};
|
|
2018
|
-
module.exports = cmp;
|
|
2019
|
-
}));
|
|
2020
|
-
//#endregion
|
|
2021
|
-
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/coerce.js
|
|
2022
|
-
var require_coerce = __commonJSMin(((exports, module) => {
|
|
2023
|
-
var SemVer = require_semver$1();
|
|
2024
|
-
var parse = require_parse();
|
|
2025
|
-
var { safeRe: re, t } = require_re();
|
|
2026
|
-
var coerce = (version, options) => {
|
|
2027
|
-
if (version instanceof SemVer) return version;
|
|
2028
|
-
if (typeof version === "number") version = String(version);
|
|
2029
|
-
if (typeof version !== "string") return null;
|
|
2030
|
-
options = options || {};
|
|
2031
|
-
let match = null;
|
|
2032
|
-
if (!options.rtl) match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]);
|
|
2033
|
-
else {
|
|
2034
|
-
const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL];
|
|
2035
|
-
let next;
|
|
2036
|
-
while ((next = coerceRtlRegex.exec(version)) && (!match || match.index + match[0].length !== version.length)) {
|
|
2037
|
-
if (!match || next.index + next[0].length !== match.index + match[0].length) match = next;
|
|
2038
|
-
coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length;
|
|
2039
|
-
}
|
|
2040
|
-
coerceRtlRegex.lastIndex = -1;
|
|
2041
|
-
}
|
|
2042
|
-
if (match === null) return null;
|
|
2043
|
-
const major = match[2];
|
|
2044
|
-
return parse(`${major}.${match[3] || "0"}.${match[4] || "0"}${options.includePrerelease && match[5] ? `-${match[5]}` : ""}${options.includePrerelease && match[6] ? `+${match[6]}` : ""}`, options);
|
|
2045
|
-
};
|
|
2046
|
-
module.exports = coerce;
|
|
2047
|
-
}));
|
|
2048
|
-
//#endregion
|
|
2049
|
-
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/truncate.js
|
|
2050
|
-
var require_truncate = __commonJSMin(((exports, module) => {
|
|
2051
|
-
var parse = require_parse();
|
|
2052
|
-
var constants = require_constants();
|
|
2053
|
-
var SemVer = require_semver$1();
|
|
2054
|
-
var truncate = (version, truncation, options) => {
|
|
2055
|
-
if (!constants.RELEASE_TYPES.includes(truncation)) return null;
|
|
2056
|
-
const clonedVersion = cloneInputVersion(version, options);
|
|
2057
|
-
return clonedVersion && doTruncation(clonedVersion, truncation);
|
|
2058
|
-
};
|
|
2059
|
-
var cloneInputVersion = (version, options) => {
|
|
2060
|
-
return parse(version instanceof SemVer ? version.version : version, options);
|
|
2061
|
-
};
|
|
2062
|
-
var doTruncation = (version, truncation) => {
|
|
2063
|
-
if (isPrerelease(truncation)) return version.version;
|
|
2064
|
-
version.prerelease = [];
|
|
2065
|
-
switch (truncation) {
|
|
2066
|
-
case "major":
|
|
2067
|
-
version.minor = 0;
|
|
2068
|
-
version.patch = 0;
|
|
2069
|
-
break;
|
|
2070
|
-
case "minor": version.patch = 0;
|
|
2071
|
-
}
|
|
2072
|
-
return version.format();
|
|
2073
|
-
};
|
|
2074
|
-
var isPrerelease = (type) => {
|
|
2075
|
-
return type.startsWith("pre");
|
|
2076
|
-
};
|
|
2077
|
-
module.exports = truncate;
|
|
2078
|
-
}));
|
|
2079
|
-
//#endregion
|
|
2080
|
-
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/internal/lrucache.js
|
|
2081
|
-
var require_lrucache = __commonJSMin(((exports, module) => {
|
|
2082
|
-
var LRUCache = class {
|
|
2083
|
-
constructor() {
|
|
2084
|
-
this.max = 1e3;
|
|
2085
|
-
this.map = new Map();
|
|
2086
|
-
}
|
|
2087
|
-
get(key) {
|
|
2088
|
-
const value = this.map.get(key);
|
|
2089
|
-
if (value === void 0) return;
|
|
2090
|
-
else {
|
|
2091
|
-
this.map.delete(key);
|
|
2092
|
-
this.map.set(key, value);
|
|
2093
|
-
return value;
|
|
2094
|
-
}
|
|
2095
|
-
}
|
|
2096
|
-
delete(key) {
|
|
2097
|
-
return this.map.delete(key);
|
|
2098
|
-
}
|
|
2099
|
-
set(key, value) {
|
|
2100
|
-
if (!this.delete(key) && value !== void 0) {
|
|
2101
|
-
if (this.map.size >= this.max) {
|
|
2102
|
-
const firstKey = this.map.keys().next().value;
|
|
2103
|
-
this.delete(firstKey);
|
|
2104
|
-
}
|
|
2105
|
-
this.map.set(key, value);
|
|
2106
|
-
}
|
|
2107
|
-
return this;
|
|
2108
|
-
}
|
|
2109
|
-
};
|
|
2110
|
-
module.exports = LRUCache;
|
|
2111
|
-
}));
|
|
2112
|
-
//#endregion
|
|
2113
|
-
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/classes/range.js
|
|
2114
|
-
var require_range = __commonJSMin(((exports, module) => {
|
|
2115
|
-
var SPACE_CHARACTERS = /\s+/g;
|
|
2116
|
-
module.exports = class Range {
|
|
2117
|
-
constructor(range, options) {
|
|
2118
|
-
options = parseOptions(options);
|
|
2119
|
-
if (range instanceof Range) {
|
|
2120
|
-
if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) return range;
|
|
2121
|
-
else return new Range(range.raw, options);
|
|
2122
|
-
}
|
|
2123
|
-
if (range instanceof Comparator) {
|
|
2124
|
-
this.raw = range.value;
|
|
2125
|
-
this.set = [[range]];
|
|
2126
|
-
this.formatted = void 0;
|
|
2127
|
-
return this;
|
|
2128
|
-
}
|
|
2129
|
-
this.options = options;
|
|
2130
|
-
this.loose = !!options.loose;
|
|
2131
|
-
this.includePrerelease = !!options.includePrerelease;
|
|
2132
|
-
this.raw = range.trim().replace(SPACE_CHARACTERS, " ");
|
|
2133
|
-
this.set = this.raw.split("||").map((r) => this.parseRange(r.trim())).filter((c) => c.length);
|
|
2134
|
-
if (!this.set.length) throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
|
|
2135
|
-
if (this.set.length > 1) {
|
|
2136
|
-
const first = this.set[0];
|
|
2137
|
-
this.set = this.set.filter((c) => !isNullSet(c[0]));
|
|
2138
|
-
if (this.set.length === 0) this.set = [first];
|
|
2139
|
-
else if (this.set.length > 1) {
|
|
2140
|
-
for (const c of this.set) if (c.length === 1 && isAny(c[0])) {
|
|
2141
|
-
this.set = [c];
|
|
2142
|
-
break;
|
|
2143
|
-
}
|
|
2144
|
-
}
|
|
2145
|
-
}
|
|
2146
|
-
this.formatted = void 0;
|
|
2147
|
-
}
|
|
2148
|
-
get range() {
|
|
2149
|
-
if (this.formatted === void 0) {
|
|
2150
|
-
this.formatted = "";
|
|
2151
|
-
for (let i = 0; i < this.set.length; i++) {
|
|
2152
|
-
if (i > 0) this.formatted += "||";
|
|
2153
|
-
const comps = this.set[i];
|
|
2154
|
-
for (let k = 0; k < comps.length; k++) {
|
|
2155
|
-
if (k > 0) this.formatted += " ";
|
|
2156
|
-
this.formatted += comps[k].toString().trim();
|
|
2157
|
-
}
|
|
2158
|
-
}
|
|
2159
|
-
}
|
|
2160
|
-
return this.formatted;
|
|
2161
|
-
}
|
|
2162
|
-
format() {
|
|
2163
|
-
return this.range;
|
|
2164
|
-
}
|
|
2165
|
-
toString() {
|
|
2166
|
-
return this.range;
|
|
2167
|
-
}
|
|
2168
|
-
parseRange(range) {
|
|
2169
|
-
range = range.replace(BUILDSTRIPRE, "");
|
|
2170
|
-
const memoKey = ((this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE)) + ":" + range;
|
|
2171
|
-
const cached = cache.get(memoKey);
|
|
2172
|
-
if (cached) return cached;
|
|
2173
|
-
const loose = this.options.loose;
|
|
2174
|
-
const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
|
|
2175
|
-
range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
|
|
2176
|
-
debug("hyphen replace", range);
|
|
2177
|
-
range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
|
|
2178
|
-
debug("comparator trim", range);
|
|
2179
|
-
range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
|
|
2180
|
-
debug("tilde trim", range);
|
|
2181
|
-
range = range.replace(re[t.CARETTRIM], caretTrimReplace);
|
|
2182
|
-
debug("caret trim", range);
|
|
2183
|
-
let rangeList = range.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
|
|
2184
|
-
if (loose) rangeList = rangeList.filter((comp) => {
|
|
2185
|
-
debug("loose invalid filter", comp, this.options);
|
|
2186
|
-
return !!comp.match(re[t.COMPARATORLOOSE]);
|
|
2187
|
-
});
|
|
2188
|
-
debug("range list", rangeList);
|
|
2189
|
-
const rangeMap = new Map();
|
|
2190
|
-
const comparators = rangeList.map((comp) => new Comparator(comp, this.options));
|
|
2191
|
-
for (const comp of comparators) {
|
|
2192
|
-
if (isNullSet(comp)) return [comp];
|
|
2193
|
-
rangeMap.set(comp.value, comp);
|
|
2194
|
-
}
|
|
2195
|
-
if (rangeMap.size > 1 && rangeMap.has("")) rangeMap.delete("");
|
|
2196
|
-
const result = [...rangeMap.values()];
|
|
2197
|
-
cache.set(memoKey, result);
|
|
2198
|
-
return result;
|
|
2199
|
-
}
|
|
2200
|
-
intersects(range, options) {
|
|
2201
|
-
if (!(range instanceof Range)) throw new TypeError("a Range is required");
|
|
2202
|
-
return this.set.some((thisComparators) => {
|
|
2203
|
-
return isSatisfiable(thisComparators, options) && range.set.some((rangeComparators) => {
|
|
2204
|
-
return isSatisfiable(rangeComparators, options) && thisComparators.every((thisComparator) => {
|
|
2205
|
-
return rangeComparators.every((rangeComparator) => {
|
|
2206
|
-
return thisComparator.intersects(rangeComparator, options);
|
|
2207
|
-
});
|
|
2208
|
-
});
|
|
2209
|
-
});
|
|
2210
|
-
});
|
|
2211
|
-
}
|
|
2212
|
-
test(version) {
|
|
2213
|
-
if (!version) return false;
|
|
2214
|
-
if (typeof version === "string") try {
|
|
2215
|
-
version = new SemVer(version, this.options);
|
|
2216
|
-
} catch (er) {
|
|
2217
|
-
return false;
|
|
2218
|
-
}
|
|
2219
|
-
for (let i = 0; i < this.set.length; i++) if (testSet(this.set[i], version, this.options)) return true;
|
|
2220
|
-
return false;
|
|
2221
|
-
}
|
|
2222
|
-
};
|
|
2223
|
-
var cache = new (require_lrucache())();
|
|
2224
|
-
var parseOptions = require_parse_options();
|
|
2225
|
-
var Comparator = require_comparator();
|
|
2226
|
-
var debug = require_debug();
|
|
2227
|
-
var SemVer = require_semver$1();
|
|
2228
|
-
var { safeRe: re, src, t, comparatorTrimReplace, tildeTrimReplace, caretTrimReplace } = require_re();
|
|
2229
|
-
var { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = require_constants();
|
|
2230
|
-
var BUILDSTRIPRE = new RegExp(src[t.BUILD], "g");
|
|
2231
|
-
var isNullSet = (c) => c.value === "<0.0.0-0";
|
|
2232
|
-
var isAny = (c) => c.value === "";
|
|
2233
|
-
var isSatisfiable = (comparators, options) => {
|
|
2234
|
-
let result = true;
|
|
2235
|
-
const remainingComparators = comparators.slice();
|
|
2236
|
-
let testComparator = remainingComparators.pop();
|
|
2237
|
-
while (result && remainingComparators.length) {
|
|
2238
|
-
result = remainingComparators.every((otherComparator) => {
|
|
2239
|
-
return testComparator.intersects(otherComparator, options);
|
|
2240
|
-
});
|
|
2241
|
-
testComparator = remainingComparators.pop();
|
|
2242
|
-
}
|
|
2243
|
-
return result;
|
|
2244
|
-
};
|
|
2245
|
-
var parseComparator = (comp, options) => {
|
|
2246
|
-
comp = comp.replace(re[t.BUILD], "");
|
|
2247
|
-
debug("comp", comp, options);
|
|
2248
|
-
comp = replaceCarets(comp, options);
|
|
2249
|
-
debug("caret", comp);
|
|
2250
|
-
comp = replaceTildes(comp, options);
|
|
2251
|
-
debug("tildes", comp);
|
|
2252
|
-
comp = replaceXRanges(comp, options);
|
|
2253
|
-
debug("xrange", comp);
|
|
2254
|
-
comp = replaceStars(comp, options);
|
|
2255
|
-
debug("stars", comp);
|
|
2256
|
-
return comp;
|
|
2257
|
-
};
|
|
2258
|
-
var isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
|
|
2259
|
-
var invalidXRangeOrder = (M, m, p) => isX(M) && !isX(m) || isX(m) && p && !isX(p);
|
|
2260
|
-
var replaceTildes = (comp, options) => {
|
|
2261
|
-
return comp.trim().split(/\s+/).map((c) => replaceTilde(c, options)).join(" ");
|
|
2262
|
-
};
|
|
2263
|
-
var replaceTilde = (comp, options) => {
|
|
2264
|
-
const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
|
|
2265
|
-
const z = options.includePrerelease ? "-0" : "";
|
|
2266
|
-
return comp.replace(r, (_, M, m, p, pr) => {
|
|
2267
|
-
debug("tilde", comp, _, M, m, p, pr);
|
|
2268
|
-
let ret;
|
|
2269
|
-
if (isX(M)) ret = "";
|
|
2270
|
-
else if (isX(m)) ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
|
|
2271
|
-
else if (isX(p)) ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
|
|
2272
|
-
else if (pr) {
|
|
2273
|
-
debug("replaceTilde pr", pr);
|
|
2274
|
-
ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
|
|
2275
|
-
} else ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
|
|
2276
|
-
debug("tilde return", ret);
|
|
2277
|
-
return ret;
|
|
2278
|
-
});
|
|
2279
|
-
};
|
|
2280
|
-
var replaceCarets = (comp, options) => {
|
|
2281
|
-
return comp.trim().split(/\s+/).map((c) => replaceCaret(c, options)).join(" ");
|
|
2282
|
-
};
|
|
2283
|
-
var replaceCaret = (comp, options) => {
|
|
2284
|
-
debug("caret", comp, options);
|
|
2285
|
-
const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
|
|
2286
|
-
const z = options.includePrerelease ? "-0" : "";
|
|
2287
|
-
return comp.replace(r, (_, M, m, p, pr) => {
|
|
2288
|
-
debug("caret", comp, _, M, m, p, pr);
|
|
2289
|
-
let ret;
|
|
2290
|
-
if (isX(M)) ret = "";
|
|
2291
|
-
else if (isX(m)) ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
|
|
2292
|
-
else if (isX(p)) {
|
|
2293
|
-
if (M === "0") ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
|
|
2294
|
-
else ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
|
|
2295
|
-
} else if (pr) {
|
|
2296
|
-
debug("replaceCaret pr", pr);
|
|
2297
|
-
if (M === "0") {
|
|
2298
|
-
if (m === "0") ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`;
|
|
2299
|
-
else ret = `>=${M}.${m}.${p}-${pr} <${M}.${+m + 1}.0-0`;
|
|
2300
|
-
} else ret = `>=${M}.${m}.${p}-${pr} <${+M + 1}.0.0-0`;
|
|
2301
|
-
} else {
|
|
2302
|
-
debug("no pr");
|
|
2303
|
-
if (M === "0") {
|
|
2304
|
-
if (m === "0") ret = `>=${M}.${m}.${p} <${M}.${m}.${+p + 1}-0`;
|
|
2305
|
-
else ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`;
|
|
2306
|
-
} else ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`;
|
|
2307
|
-
}
|
|
2308
|
-
debug("caret return", ret);
|
|
2309
|
-
return ret;
|
|
2310
|
-
});
|
|
2311
|
-
};
|
|
2312
|
-
var replaceXRanges = (comp, options) => {
|
|
2313
|
-
debug("replaceXRanges", comp, options);
|
|
2314
|
-
return comp.split(/\s+/).map((c) => replaceXRange(c, options)).join(" ");
|
|
2315
|
-
};
|
|
2316
|
-
var replaceXRange = (comp, options) => {
|
|
2317
|
-
comp = comp.trim();
|
|
2318
|
-
const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
|
|
2319
|
-
return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
|
|
2320
|
-
debug("xRange", comp, ret, gtlt, M, m, p, pr);
|
|
2321
|
-
if (invalidXRangeOrder(M, m, p)) return comp;
|
|
2322
|
-
const xM = isX(M);
|
|
2323
|
-
const xm = xM || isX(m);
|
|
2324
|
-
const xp = xm || isX(p);
|
|
2325
|
-
const anyX = xp;
|
|
2326
|
-
if (gtlt === "=" && anyX) gtlt = "";
|
|
2327
|
-
pr = options.includePrerelease ? "-0" : "";
|
|
2328
|
-
if (xM) {
|
|
2329
|
-
if (gtlt === ">" || gtlt === "<") ret = "<0.0.0-0";
|
|
2330
|
-
else ret = "*";
|
|
2331
|
-
} else if (gtlt && anyX) {
|
|
2332
|
-
if (xm) m = 0;
|
|
2333
|
-
p = 0;
|
|
2334
|
-
if (gtlt === ">") {
|
|
2335
|
-
gtlt = ">=";
|
|
2336
|
-
if (xm) {
|
|
2337
|
-
M = +M + 1;
|
|
2338
|
-
m = 0;
|
|
2339
|
-
p = 0;
|
|
2340
|
-
} else {
|
|
2341
|
-
m = +m + 1;
|
|
2342
|
-
p = 0;
|
|
2343
|
-
}
|
|
2344
|
-
} else if (gtlt === "<=") {
|
|
2345
|
-
gtlt = "<";
|
|
2346
|
-
if (xm) M = +M + 1;
|
|
2347
|
-
else m = +m + 1;
|
|
2348
|
-
}
|
|
2349
|
-
if (gtlt === "<") pr = "-0";
|
|
2350
|
-
ret = `${gtlt + M}.${m}.${p}${pr}`;
|
|
2351
|
-
} else if (xm) ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
|
|
2352
|
-
else if (xp) ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`;
|
|
2353
|
-
debug("xRange return", ret);
|
|
2354
|
-
return ret;
|
|
2355
|
-
});
|
|
2356
|
-
};
|
|
2357
|
-
var replaceStars = (comp, options) => {
|
|
2358
|
-
debug("replaceStars", comp, options);
|
|
2359
|
-
return comp.trim().replace(re[t.STAR], "");
|
|
2360
|
-
};
|
|
2361
|
-
var replaceGTE0 = (comp, options) => {
|
|
2362
|
-
debug("replaceGTE0", comp, options);
|
|
2363
|
-
return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], "");
|
|
2364
|
-
};
|
|
2365
|
-
var hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => {
|
|
2366
|
-
if (isX(fM)) from = "";
|
|
2367
|
-
else if (isX(fm)) from = `>=${fM}.0.0${incPr ? "-0" : ""}`;
|
|
2368
|
-
else if (isX(fp)) from = `>=${fM}.${fm}.0${incPr ? "-0" : ""}`;
|
|
2369
|
-
else if (fpr) from = `>=${from}`;
|
|
2370
|
-
else from = `>=${from}${incPr ? "-0" : ""}`;
|
|
2371
|
-
if (isX(tM)) to = "";
|
|
2372
|
-
else if (isX(tm)) to = `<${+tM + 1}.0.0-0`;
|
|
2373
|
-
else if (isX(tp)) to = `<${tM}.${+tm + 1}.0-0`;
|
|
2374
|
-
else if (tpr) to = `<=${tM}.${tm}.${tp}-${tpr}`;
|
|
2375
|
-
else if (incPr) to = `<${tM}.${tm}.${+tp + 1}-0`;
|
|
2376
|
-
else to = `<=${to}`;
|
|
2377
|
-
return `${from} ${to}`.trim();
|
|
2378
|
-
};
|
|
2379
|
-
var testSet = (set, version, options) => {
|
|
2380
|
-
for (let i = 0; i < set.length; i++) if (!set[i].test(version)) return false;
|
|
2381
|
-
if (version.prerelease.length && !options.includePrerelease) {
|
|
2382
|
-
for (let i = 0; i < set.length; i++) {
|
|
2383
|
-
debug(set[i].semver);
|
|
2384
|
-
if (set[i].semver === Comparator.ANY) continue;
|
|
2385
|
-
if (set[i].semver.prerelease.length > 0) {
|
|
2386
|
-
const allowed = set[i].semver;
|
|
2387
|
-
if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) return true;
|
|
2388
|
-
}
|
|
2389
|
-
}
|
|
2390
|
-
return false;
|
|
2391
|
-
}
|
|
2392
|
-
return true;
|
|
2393
|
-
};
|
|
2394
|
-
}));
|
|
2395
|
-
//#endregion
|
|
2396
|
-
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/classes/comparator.js
|
|
2397
|
-
var require_comparator = __commonJSMin(((exports, module) => {
|
|
2398
|
-
var ANY = Symbol("SemVer ANY");
|
|
2399
|
-
module.exports = class Comparator {
|
|
2400
|
-
static get ANY() {
|
|
2401
|
-
return ANY;
|
|
2402
|
-
}
|
|
2403
|
-
constructor(comp, options) {
|
|
2404
|
-
options = parseOptions(options);
|
|
2405
|
-
if (comp instanceof Comparator) {
|
|
2406
|
-
if (comp.loose === !!options.loose) return comp;
|
|
2407
|
-
else comp = comp.value;
|
|
2408
|
-
}
|
|
2409
|
-
comp = comp.trim().split(/\s+/).join(" ");
|
|
2410
|
-
debug("comparator", comp, options);
|
|
2411
|
-
this.options = options;
|
|
2412
|
-
this.loose = !!options.loose;
|
|
2413
|
-
this.parse(comp);
|
|
2414
|
-
if (this.semver === ANY) this.value = "";
|
|
2415
|
-
else this.value = this.operator + this.semver.version;
|
|
2416
|
-
debug("comp", this);
|
|
2417
|
-
}
|
|
2418
|
-
parse(comp) {
|
|
2419
|
-
const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
|
|
2420
|
-
const m = comp.match(r);
|
|
2421
|
-
if (!m) throw new TypeError(`Invalid comparator: ${comp}`);
|
|
2422
|
-
this.operator = m[1] !== void 0 ? m[1] : "";
|
|
2423
|
-
if (this.operator === "=") this.operator = "";
|
|
2424
|
-
if (!m[2]) this.semver = ANY;
|
|
2425
|
-
else this.semver = new SemVer(m[2], this.options.loose);
|
|
2426
|
-
}
|
|
2427
|
-
toString() {
|
|
2428
|
-
return this.value;
|
|
2429
|
-
}
|
|
2430
|
-
test(version) {
|
|
2431
|
-
debug("Comparator.test", version, this.options.loose);
|
|
2432
|
-
if (this.semver === ANY || version === ANY) return true;
|
|
2433
|
-
if (typeof version === "string") try {
|
|
2434
|
-
version = new SemVer(version, this.options);
|
|
2435
|
-
} catch (er) {
|
|
2436
|
-
return false;
|
|
2437
|
-
}
|
|
2438
|
-
return cmp(version, this.operator, this.semver, this.options);
|
|
2439
|
-
}
|
|
2440
|
-
intersects(comp, options) {
|
|
2441
|
-
if (!(comp instanceof Comparator)) throw new TypeError("a Comparator is required");
|
|
2442
|
-
if (this.operator === "") {
|
|
2443
|
-
if (this.value === "") return true;
|
|
2444
|
-
return new Range(comp.value, options).test(this.value);
|
|
2445
|
-
} else if (comp.operator === "") {
|
|
2446
|
-
if (comp.value === "") return true;
|
|
2447
|
-
return new Range(this.value, options).test(comp.semver);
|
|
2448
|
-
}
|
|
2449
|
-
options = parseOptions(options);
|
|
2450
|
-
if (options.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0")) return false;
|
|
2451
|
-
if (!options.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) return false;
|
|
2452
|
-
if (this.operator.startsWith(">") && comp.operator.startsWith(">")) return true;
|
|
2453
|
-
if (this.operator.startsWith("<") && comp.operator.startsWith("<")) return true;
|
|
2454
|
-
if (this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=")) return true;
|
|
2455
|
-
if (cmp(this.semver, "<", comp.semver, options) && this.operator.startsWith(">") && comp.operator.startsWith("<")) return true;
|
|
2456
|
-
if (cmp(this.semver, ">", comp.semver, options) && this.operator.startsWith("<") && comp.operator.startsWith(">")) return true;
|
|
2457
|
-
return false;
|
|
2458
|
-
}
|
|
2459
|
-
};
|
|
2460
|
-
var parseOptions = require_parse_options();
|
|
2461
|
-
var { safeRe: re, t } = require_re();
|
|
2462
|
-
var cmp = require_cmp();
|
|
2463
|
-
var debug = require_debug();
|
|
2464
|
-
var SemVer = require_semver$1();
|
|
2465
|
-
var Range = require_range();
|
|
2466
|
-
}));
|
|
2467
|
-
//#endregion
|
|
2468
|
-
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/satisfies.js
|
|
2469
|
-
var require_satisfies = __commonJSMin(((exports, module) => {
|
|
2470
|
-
var Range = require_range();
|
|
2471
|
-
var satisfies = (version, range, options) => {
|
|
2472
|
-
try {
|
|
2473
|
-
range = new Range(range, options);
|
|
2474
|
-
} catch (er) {
|
|
2475
|
-
return false;
|
|
2476
|
-
}
|
|
2477
|
-
return range.test(version);
|
|
2478
|
-
};
|
|
2479
|
-
module.exports = satisfies;
|
|
2480
|
-
}));
|
|
2481
|
-
//#endregion
|
|
2482
|
-
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/to-comparators.js
|
|
2483
|
-
var require_to_comparators = __commonJSMin(((exports, module) => {
|
|
2484
|
-
var Range = require_range();
|
|
2485
|
-
var toComparators = (range, options) => new Range(range, options).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" "));
|
|
2486
|
-
module.exports = toComparators;
|
|
2487
|
-
}));
|
|
2488
|
-
//#endregion
|
|
2489
|
-
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/max-satisfying.js
|
|
2490
|
-
var require_max_satisfying = __commonJSMin(((exports, module) => {
|
|
2491
|
-
var SemVer = require_semver$1();
|
|
2492
|
-
var Range = require_range();
|
|
2493
|
-
var maxSatisfying = (versions, range, options) => {
|
|
2494
|
-
let max = null;
|
|
2495
|
-
let maxSV = null;
|
|
2496
|
-
let rangeObj = null;
|
|
2497
|
-
try {
|
|
2498
|
-
rangeObj = new Range(range, options);
|
|
2499
|
-
} catch (er) {
|
|
2500
|
-
return null;
|
|
2501
|
-
}
|
|
2502
|
-
versions.forEach((v) => {
|
|
2503
|
-
if (rangeObj.test(v)) {
|
|
2504
|
-
if (!max || maxSV.compare(v) === -1) {
|
|
2505
|
-
max = v;
|
|
2506
|
-
maxSV = new SemVer(max, options);
|
|
2507
|
-
}
|
|
2508
|
-
}
|
|
2509
|
-
});
|
|
2510
|
-
return max;
|
|
2511
|
-
};
|
|
2512
|
-
module.exports = maxSatisfying;
|
|
2513
|
-
}));
|
|
2514
|
-
//#endregion
|
|
2515
|
-
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/min-satisfying.js
|
|
2516
|
-
var require_min_satisfying = __commonJSMin(((exports, module) => {
|
|
2517
|
-
var SemVer = require_semver$1();
|
|
2518
|
-
var Range = require_range();
|
|
2519
|
-
var minSatisfying = (versions, range, options) => {
|
|
2520
|
-
let min = null;
|
|
2521
|
-
let minSV = null;
|
|
2522
|
-
let rangeObj = null;
|
|
2523
|
-
try {
|
|
2524
|
-
rangeObj = new Range(range, options);
|
|
2525
|
-
} catch (er) {
|
|
2526
|
-
return null;
|
|
2527
|
-
}
|
|
2528
|
-
versions.forEach((v) => {
|
|
2529
|
-
if (rangeObj.test(v)) {
|
|
2530
|
-
if (!min || minSV.compare(v) === 1) {
|
|
2531
|
-
min = v;
|
|
2532
|
-
minSV = new SemVer(min, options);
|
|
2533
|
-
}
|
|
2534
|
-
}
|
|
2535
|
-
});
|
|
2536
|
-
return min;
|
|
2537
|
-
};
|
|
2538
|
-
module.exports = minSatisfying;
|
|
2539
|
-
}));
|
|
2540
|
-
//#endregion
|
|
2541
|
-
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/min-version.js
|
|
2542
|
-
var require_min_version = __commonJSMin(((exports, module) => {
|
|
2543
|
-
var SemVer = require_semver$1();
|
|
2544
|
-
var Range = require_range();
|
|
2545
|
-
var gt = require_gt();
|
|
2546
|
-
var minVersion = (range, loose) => {
|
|
2547
|
-
range = new Range(range, loose);
|
|
2548
|
-
let minver = new SemVer("0.0.0");
|
|
2549
|
-
if (range.test(minver)) return minver;
|
|
2550
|
-
minver = new SemVer("0.0.0-0");
|
|
2551
|
-
if (range.test(minver)) return minver;
|
|
2552
|
-
minver = null;
|
|
2553
|
-
for (let i = 0; i < range.set.length; ++i) {
|
|
2554
|
-
const comparators = range.set[i];
|
|
2555
|
-
let setMin = null;
|
|
2556
|
-
comparators.forEach((comparator) => {
|
|
2557
|
-
const compver = new SemVer(comparator.semver.version);
|
|
2558
|
-
switch (comparator.operator) {
|
|
2559
|
-
case ">":
|
|
2560
|
-
if (compver.prerelease.length === 0) compver.patch++;
|
|
2561
|
-
else compver.prerelease.push(0);
|
|
2562
|
-
compver.raw = compver.format();
|
|
2563
|
-
case "":
|
|
2564
|
-
case ">=":
|
|
2565
|
-
if (!setMin || gt(compver, setMin)) setMin = compver;
|
|
2566
|
-
break;
|
|
2567
|
-
case "<":
|
|
2568
|
-
case "<=": break;
|
|
2569
|
-
default: throw new Error(`Unexpected operation: ${comparator.operator}`);
|
|
2570
|
-
}
|
|
2571
|
-
});
|
|
2572
|
-
if (setMin && (!minver || gt(minver, setMin))) minver = setMin;
|
|
2573
|
-
}
|
|
2574
|
-
if (minver && range.test(minver)) return minver;
|
|
2575
|
-
return null;
|
|
2576
|
-
};
|
|
2577
|
-
module.exports = minVersion;
|
|
2578
|
-
}));
|
|
2579
|
-
//#endregion
|
|
2580
|
-
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/valid.js
|
|
2581
|
-
var require_valid = __commonJSMin(((exports, module) => {
|
|
2582
|
-
var Range = require_range();
|
|
2583
|
-
var validRange = (range, options) => {
|
|
2584
|
-
try {
|
|
2585
|
-
return new Range(range, options).range || "*";
|
|
2586
|
-
} catch (er) {
|
|
2587
|
-
return null;
|
|
2588
|
-
}
|
|
2589
|
-
};
|
|
2590
|
-
module.exports = validRange;
|
|
2591
|
-
}));
|
|
2592
|
-
//#endregion
|
|
2593
|
-
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/outside.js
|
|
2594
|
-
var require_outside = __commonJSMin(((exports, module) => {
|
|
2595
|
-
var SemVer = require_semver$1();
|
|
2596
|
-
var Comparator = require_comparator();
|
|
2597
|
-
var { ANY } = Comparator;
|
|
2598
|
-
var Range = require_range();
|
|
2599
|
-
var satisfies = require_satisfies();
|
|
2600
|
-
var gt = require_gt();
|
|
2601
|
-
var lt = require_lt();
|
|
2602
|
-
var lte = require_lte();
|
|
2603
|
-
var gte = require_gte();
|
|
2604
|
-
var outside = (version, range, hilo, options) => {
|
|
2605
|
-
version = new SemVer(version, options);
|
|
2606
|
-
range = new Range(range, options);
|
|
2607
|
-
let gtfn, ltefn, ltfn, comp, ecomp;
|
|
2608
|
-
switch (hilo) {
|
|
2609
|
-
case ">":
|
|
2610
|
-
gtfn = gt;
|
|
2611
|
-
ltefn = lte;
|
|
2612
|
-
ltfn = lt;
|
|
2613
|
-
comp = ">";
|
|
2614
|
-
ecomp = ">=";
|
|
2615
|
-
break;
|
|
2616
|
-
case "<":
|
|
2617
|
-
gtfn = lt;
|
|
2618
|
-
ltefn = gte;
|
|
2619
|
-
ltfn = gt;
|
|
2620
|
-
comp = "<";
|
|
2621
|
-
ecomp = "<=";
|
|
2622
|
-
break;
|
|
2623
|
-
default: throw new TypeError("Must provide a hilo val of \"<\" or \">\"");
|
|
2624
|
-
}
|
|
2625
|
-
if (satisfies(version, range, options)) return false;
|
|
2626
|
-
for (let i = 0; i < range.set.length; ++i) {
|
|
2627
|
-
const comparators = range.set[i];
|
|
2628
|
-
let high = null;
|
|
2629
|
-
let low = null;
|
|
2630
|
-
comparators.forEach((comparator) => {
|
|
2631
|
-
if (comparator.semver === ANY) comparator = new Comparator(">=0.0.0");
|
|
2632
|
-
high = high || comparator;
|
|
2633
|
-
low = low || comparator;
|
|
2634
|
-
if (gtfn(comparator.semver, high.semver, options)) high = comparator;
|
|
2635
|
-
else if (ltfn(comparator.semver, low.semver, options)) low = comparator;
|
|
2636
|
-
});
|
|
2637
|
-
if (high.operator === comp || high.operator === ecomp) return false;
|
|
2638
|
-
if ((!low.operator || low.operator === comp) && ltefn(version, low.semver)) return false;
|
|
2639
|
-
else if (low.operator === ecomp && ltfn(version, low.semver)) return false;
|
|
2640
|
-
}
|
|
2641
|
-
return true;
|
|
2642
|
-
};
|
|
2643
|
-
module.exports = outside;
|
|
2644
|
-
}));
|
|
2645
|
-
//#endregion
|
|
2646
|
-
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/gtr.js
|
|
2647
|
-
var require_gtr = __commonJSMin(((exports, module) => {
|
|
2648
|
-
var outside = require_outside();
|
|
2649
|
-
var gtr = (version, range, options) => outside(version, range, ">", options);
|
|
2650
|
-
module.exports = gtr;
|
|
2651
|
-
}));
|
|
2652
|
-
//#endregion
|
|
2653
|
-
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/ltr.js
|
|
2654
|
-
var require_ltr = __commonJSMin(((exports, module) => {
|
|
2655
|
-
var outside = require_outside();
|
|
2656
|
-
var ltr = (version, range, options) => outside(version, range, "<", options);
|
|
2657
|
-
module.exports = ltr;
|
|
2658
|
-
}));
|
|
2659
|
-
//#endregion
|
|
2660
|
-
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/intersects.js
|
|
2661
|
-
var require_intersects = __commonJSMin(((exports, module) => {
|
|
2662
|
-
var Range = require_range();
|
|
2663
|
-
var intersects = (r1, r2, options) => {
|
|
2664
|
-
r1 = new Range(r1, options);
|
|
2665
|
-
r2 = new Range(r2, options);
|
|
2666
|
-
return r1.intersects(r2, options);
|
|
2667
|
-
};
|
|
2668
|
-
module.exports = intersects;
|
|
2669
|
-
}));
|
|
2670
|
-
//#endregion
|
|
2671
|
-
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/simplify.js
|
|
2672
|
-
var require_simplify = __commonJSMin(((exports, module) => {
|
|
2673
|
-
var satisfies = require_satisfies();
|
|
2674
|
-
var compare = require_compare();
|
|
2675
|
-
module.exports = (versions, range, options) => {
|
|
2676
|
-
const set = [];
|
|
2677
|
-
let first = null;
|
|
2678
|
-
let prev = null;
|
|
2679
|
-
const v = versions.sort((a, b) => compare(a, b, options));
|
|
2680
|
-
for (const version of v) if (satisfies(version, range, options)) {
|
|
2681
|
-
prev = version;
|
|
2682
|
-
if (!first) first = version;
|
|
2683
|
-
} else {
|
|
2684
|
-
if (prev) set.push([first, prev]);
|
|
2685
|
-
prev = null;
|
|
2686
|
-
first = null;
|
|
2687
|
-
}
|
|
2688
|
-
if (first) set.push([first, null]);
|
|
2689
|
-
const ranges = [];
|
|
2690
|
-
for (const [min, max] of set) if (min === max) ranges.push(min);
|
|
2691
|
-
else if (!max && min === v[0]) ranges.push("*");
|
|
2692
|
-
else if (!max) ranges.push(`>=${min}`);
|
|
2693
|
-
else if (min === v[0]) ranges.push(`<=${max}`);
|
|
2694
|
-
else ranges.push(`${min} - ${max}`);
|
|
2695
|
-
const simplified = ranges.join(" || ");
|
|
2696
|
-
const original = typeof range.raw === "string" ? range.raw : String(range);
|
|
2697
|
-
return simplified.length < original.length ? simplified : range;
|
|
2698
|
-
};
|
|
2699
|
-
}));
|
|
2700
|
-
//#endregion
|
|
2701
|
-
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/subset.js
|
|
2702
|
-
var require_subset = __commonJSMin(((exports, module) => {
|
|
2703
|
-
var Range = require_range();
|
|
2704
|
-
var Comparator = require_comparator();
|
|
2705
|
-
var { ANY } = Comparator;
|
|
2706
|
-
var satisfies = require_satisfies();
|
|
2707
|
-
var compare = require_compare();
|
|
2708
|
-
var subset = (sub, dom, options = {}) => {
|
|
2709
|
-
if (sub === dom) return true;
|
|
2710
|
-
sub = new Range(sub, options);
|
|
2711
|
-
dom = new Range(dom, options);
|
|
2712
|
-
let sawNonNull = false;
|
|
2713
|
-
OUTER: for (const simpleSub of sub.set) {
|
|
2714
|
-
for (const simpleDom of dom.set) {
|
|
2715
|
-
const isSub = simpleSubset(simpleSub, simpleDom, options);
|
|
2716
|
-
sawNonNull = sawNonNull || isSub !== null;
|
|
2717
|
-
if (isSub) continue OUTER;
|
|
2718
|
-
}
|
|
2719
|
-
if (sawNonNull) return false;
|
|
2720
|
-
}
|
|
2721
|
-
return true;
|
|
2722
|
-
};
|
|
2723
|
-
var minimumVersionWithPreRelease = [new Comparator(">=0.0.0-0")];
|
|
2724
|
-
var minimumVersion = [new Comparator(">=0.0.0")];
|
|
2725
|
-
var simpleSubset = (sub, dom, options) => {
|
|
2726
|
-
if (sub === dom) return true;
|
|
2727
|
-
if (sub.length === 1 && sub[0].semver === ANY) {
|
|
2728
|
-
if (dom.length === 1 && dom[0].semver === ANY) return true;
|
|
2729
|
-
else if (options.includePrerelease) sub = minimumVersionWithPreRelease;
|
|
2730
|
-
else sub = minimumVersion;
|
|
2731
|
-
}
|
|
2732
|
-
if (dom.length === 1 && dom[0].semver === ANY) {
|
|
2733
|
-
if (options.includePrerelease) return true;
|
|
2734
|
-
else dom = minimumVersion;
|
|
2735
|
-
}
|
|
2736
|
-
const eqSet = new Set();
|
|
2737
|
-
let gt, lt;
|
|
2738
|
-
for (const c of sub) if (c.operator === ">" || c.operator === ">=") gt = higherGT(gt, c, options);
|
|
2739
|
-
else if (c.operator === "<" || c.operator === "<=") lt = lowerLT(lt, c, options);
|
|
2740
|
-
else eqSet.add(c.semver);
|
|
2741
|
-
if (eqSet.size > 1) return null;
|
|
2742
|
-
let gtltComp;
|
|
2743
|
-
if (gt && lt) {
|
|
2744
|
-
gtltComp = compare(gt.semver, lt.semver, options);
|
|
2745
|
-
if (gtltComp > 0) return null;
|
|
2746
|
-
else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<=")) return null;
|
|
2747
|
-
}
|
|
2748
|
-
for (const eq of eqSet) {
|
|
2749
|
-
if (gt && !satisfies(eq, String(gt), options)) return null;
|
|
2750
|
-
if (lt && !satisfies(eq, String(lt), options)) return null;
|
|
2751
|
-
for (const c of dom) if (!satisfies(eq, String(c), options)) return false;
|
|
2752
|
-
return true;
|
|
2753
|
-
}
|
|
2754
|
-
let higher, lower;
|
|
2755
|
-
let hasDomLT, hasDomGT;
|
|
2756
|
-
let needDomLTPre = lt && !options.includePrerelease && lt.semver.prerelease.length ? lt.semver : false;
|
|
2757
|
-
let needDomGTPre = gt && !options.includePrerelease && gt.semver.prerelease.length ? gt.semver : false;
|
|
2758
|
-
if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt.operator === "<" && needDomLTPre.prerelease[0] === 0) needDomLTPre = false;
|
|
2759
|
-
for (const c of dom) {
|
|
2760
|
-
hasDomGT = hasDomGT || c.operator === ">" || c.operator === ">=";
|
|
2761
|
-
hasDomLT = hasDomLT || c.operator === "<" || c.operator === "<=";
|
|
2762
|
-
if (gt) {
|
|
2763
|
-
if (needDomGTPre) {
|
|
2764
|
-
if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomGTPre.major && c.semver.minor === needDomGTPre.minor && c.semver.patch === needDomGTPre.patch) needDomGTPre = false;
|
|
2765
|
-
}
|
|
2766
|
-
if (c.operator === ">" || c.operator === ">=") {
|
|
2767
|
-
higher = higherGT(gt, c, options);
|
|
2768
|
-
if (higher === c && higher !== gt) return false;
|
|
2769
|
-
} else if (gt.operator === ">=" && !c.test(gt.semver)) return false;
|
|
2770
|
-
}
|
|
2771
|
-
if (lt) {
|
|
2772
|
-
if (needDomLTPre) {
|
|
2773
|
-
if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomLTPre.major && c.semver.minor === needDomLTPre.minor && c.semver.patch === needDomLTPre.patch) needDomLTPre = false;
|
|
2774
|
-
}
|
|
2775
|
-
if (c.operator === "<" || c.operator === "<=") {
|
|
2776
|
-
lower = lowerLT(lt, c, options);
|
|
2777
|
-
if (lower === c && lower !== lt) return false;
|
|
2778
|
-
} else if (lt.operator === "<=" && !c.test(lt.semver)) return false;
|
|
2779
|
-
}
|
|
2780
|
-
if (!c.operator && (lt || gt) && gtltComp !== 0) return false;
|
|
2781
|
-
}
|
|
2782
|
-
if (gt && hasDomLT && !lt && gtltComp !== 0) return false;
|
|
2783
|
-
if (lt && hasDomGT && !gt && gtltComp !== 0) return false;
|
|
2784
|
-
if (needDomGTPre || needDomLTPre) return false;
|
|
2785
|
-
return true;
|
|
2786
|
-
};
|
|
2787
|
-
var higherGT = (a, b, options) => {
|
|
2788
|
-
if (!a) return b;
|
|
2789
|
-
const comp = compare(a.semver, b.semver, options);
|
|
2790
|
-
return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a;
|
|
2791
|
-
};
|
|
2792
|
-
var lowerLT = (a, b, options) => {
|
|
2793
|
-
if (!a) return b;
|
|
2794
|
-
const comp = compare(a.semver, b.semver, options);
|
|
2795
|
-
return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a;
|
|
2796
|
-
};
|
|
2797
|
-
module.exports = subset;
|
|
2798
|
-
}));
|
|
2799
|
-
//#endregion
|
|
2800
|
-
//#region ../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/index.js
|
|
2801
|
-
var require_semver = __commonJSMin(((exports, module) => {
|
|
2802
|
-
var internalRe = require_re();
|
|
2803
|
-
var constants = require_constants();
|
|
2804
|
-
var SemVer = require_semver$1();
|
|
2805
|
-
var identifiers = require_identifiers();
|
|
2806
|
-
module.exports = {
|
|
2807
|
-
parse: require_parse(),
|
|
2808
|
-
valid: require_valid$1(),
|
|
2809
|
-
clean: require_clean(),
|
|
2810
|
-
inc: require_inc(),
|
|
2811
|
-
diff: require_diff(),
|
|
2812
|
-
major: require_major(),
|
|
2813
|
-
minor: require_minor(),
|
|
2814
|
-
patch: require_patch(),
|
|
2815
|
-
prerelease: require_prerelease(),
|
|
2816
|
-
compare: require_compare(),
|
|
2817
|
-
rcompare: require_rcompare(),
|
|
2818
|
-
compareLoose: require_compare_loose(),
|
|
2819
|
-
compareBuild: require_compare_build(),
|
|
2820
|
-
sort: require_sort(),
|
|
2821
|
-
rsort: require_rsort(),
|
|
2822
|
-
gt: require_gt(),
|
|
2823
|
-
lt: require_lt(),
|
|
2824
|
-
eq: require_eq(),
|
|
2825
|
-
neq: require_neq(),
|
|
2826
|
-
gte: require_gte(),
|
|
2827
|
-
lte: require_lte(),
|
|
2828
|
-
cmp: require_cmp(),
|
|
2829
|
-
coerce: require_coerce(),
|
|
2830
|
-
truncate: require_truncate(),
|
|
2831
|
-
Comparator: require_comparator(),
|
|
2832
|
-
Range: require_range(),
|
|
2833
|
-
satisfies: require_satisfies(),
|
|
2834
|
-
toComparators: require_to_comparators(),
|
|
2835
|
-
maxSatisfying: require_max_satisfying(),
|
|
2836
|
-
minSatisfying: require_min_satisfying(),
|
|
2837
|
-
minVersion: require_min_version(),
|
|
2838
|
-
validRange: require_valid(),
|
|
2839
|
-
outside: require_outside(),
|
|
2840
|
-
gtr: require_gtr(),
|
|
2841
|
-
ltr: require_ltr(),
|
|
2842
|
-
intersects: require_intersects(),
|
|
2843
|
-
simplifyRange: require_simplify(),
|
|
2844
|
-
subset: require_subset(),
|
|
2845
|
-
SemVer,
|
|
2846
|
-
re: internalRe.re,
|
|
2847
|
-
src: internalRe.src,
|
|
2848
|
-
tokens: internalRe.t,
|
|
2849
|
-
SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
|
|
2850
|
-
RELEASE_TYPES: constants.RELEASE_TYPES,
|
|
2851
|
-
compareIdentifiers: identifiers.compareIdentifiers,
|
|
2852
|
-
rcompareIdentifiers: identifiers.rcompareIdentifiers
|
|
2853
|
-
};
|
|
2854
|
-
}));
|
|
2855
|
-
//#endregion
|
|
2856
|
-
//#region src/composition/constants.ts
|
|
2857
|
-
var import_semver = require_semver();
|
|
2858
|
-
var MOLDEA_CLI_FOUNDATIONAL_PACKAGE_NAMES = Object.freeze([
|
|
2859
|
-
"@moldea.ai/core",
|
|
2860
|
-
"@moldea.ai/repository",
|
|
2861
|
-
"@moldea.ai/repository-fs"
|
|
2862
|
-
]);
|
|
2863
|
-
var MOLDEA_CLI_FIRST_CLASS_PACKAGE_RANGES = Object.freeze({
|
|
2864
|
-
"@moldea.ai/core": "^10.0.0",
|
|
2865
|
-
"@moldea.ai/repository": "^4.0.0",
|
|
2866
|
-
"@moldea.ai/repository-fs": "^4.0.0"
|
|
2867
|
-
});
|
|
2868
|
-
//#endregion
|
|
2869
|
-
//#region src/composition/validations.ts
|
|
2870
|
-
var hasExactStringSet = (left, right) => {
|
|
2871
|
-
if (left.length !== right.length || new Set(left).size !== left.length || new Set(right).size !== right.length) return false;
|
|
2872
|
-
const rightValues = new Set(right);
|
|
2873
|
-
return left.every((entry) => rightValues.has(entry));
|
|
2874
|
-
};
|
|
2875
|
-
var hasUniquePositiveIntegers = (entries) => entries.length > 0 && entries.every((entry) => Number.isSafeInteger(entry) && entry > 0) && new Set(entries).size === entries.length;
|
|
2876
|
-
var isMoldeaCliCompositionStateValid = (input) => {
|
|
2877
|
-
const { dependencies, installedPackageVersions, supportedNodeRange, version } = input.packageMetadata;
|
|
2878
|
-
if ((0, import_semver.valid)(version) === null || supportedNodeRange === null || (0, import_semver.validRange)(supportedNodeRange) === null || (0, import_semver.valid)(input.minimumGitVersion) === null || input.outputSchemaVersion !== 8 || dependencies === null || installedPackageVersions === null || !hasUniquePositiveIntegers(input.coreSupportedRepositoryFormatVersions)) return false;
|
|
2879
|
-
const expectedPackageNames = [...MOLDEA_CLI_FOUNDATIONAL_PACKAGE_NAMES];
|
|
2880
|
-
const declaredPackageNames = Object.keys(dependencies).filter((packageName) => packageName.startsWith("@moldea.ai/"));
|
|
2881
|
-
const resolvedPackageNames = Object.keys(installedPackageVersions);
|
|
2882
|
-
if (!hasExactStringSet(declaredPackageNames, expectedPackageNames) || !hasExactStringSet(resolvedPackageNames, expectedPackageNames)) return false;
|
|
2883
|
-
return expectedPackageNames.every((packageName) => {
|
|
2884
|
-
const resolvedVersion = installedPackageVersions[packageName];
|
|
2885
|
-
const declaredRange = dependencies[packageName];
|
|
2886
|
-
const supportedRange = MOLDEA_CLI_FIRST_CLASS_PACKAGE_RANGES[packageName];
|
|
2887
|
-
return resolvedVersion !== void 0 && (0, import_semver.valid)(resolvedVersion) !== null && supportedRange !== void 0 && (declaredRange === supportedRange || declaredRange === `workspace:${supportedRange}`) && (0, import_semver.satisfies)(resolvedVersion, supportedRange);
|
|
2888
|
-
});
|
|
2889
|
-
};
|
|
2890
|
-
//#endregion
|
|
2891
|
-
//#region src/composition/transformers.ts
|
|
2892
|
-
var compareIdentifiers = (left, right) => left < right ? -1 : left > right ? 1 : 0;
|
|
2893
|
-
var createMoldeaCliCompositionResult = (input) => {
|
|
2894
|
-
const packages = Object.entries(input.packageMetadata.installedPackageVersions ?? {}).map(([name, version]) => ({
|
|
2895
|
-
name,
|
|
2896
|
-
version
|
|
2897
|
-
})).sort((left, right) => compareIdentifiers(left.name, right.name));
|
|
2898
|
-
return deepFreeze({
|
|
2899
|
-
minimumGitVersion: input.minimumGitVersion,
|
|
2900
|
-
packages,
|
|
2901
|
-
repositoryFormatVersions: [...input.coreSupportedRepositoryFormatVersions].sort((left, right) => left - right),
|
|
2902
|
-
supportedNodeRange: input.packageMetadata.supportedNodeRange ?? ""
|
|
2903
|
-
});
|
|
2904
|
-
};
|
|
2905
|
-
//#endregion
|
|
2906
|
-
//#region src/composition/composition.ts
|
|
2907
|
-
var INVALID_COMPOSITION_RESOLUTION = Object.freeze({ kind: "invalid" });
|
|
2908
|
-
var resolveMoldeaCliComposition = (input) => {
|
|
2909
|
-
try {
|
|
2910
|
-
if (!isMoldeaCliCompositionStateValid(input)) return INVALID_COMPOSITION_RESOLUTION;
|
|
2911
|
-
return Object.freeze({
|
|
2912
|
-
kind: "valid",
|
|
2913
|
-
result: createMoldeaCliCompositionResult(input)
|
|
2914
|
-
});
|
|
2915
|
-
} catch {
|
|
2916
|
-
return INVALID_COMPOSITION_RESOLUTION;
|
|
2917
|
-
}
|
|
2918
|
-
};
|
|
2919
|
-
var resolveInstalledMoldeaCliComposition = (input) => resolveMoldeaCliComposition({
|
|
2920
|
-
coreSupportedRepositoryFormatVersions: SUPPORTED_REPOSITORY_FORMAT_VERSIONS,
|
|
2921
|
-
minimumGitVersion: MINIMUM_GIT_VERSION,
|
|
2922
|
-
outputSchemaVersion: 8,
|
|
2923
|
-
packageMetadata: input.packageMetadata
|
|
2924
|
-
});
|
|
2925
|
-
//#endregion
|
|
2926
|
-
export { formatMoldeaCliJsonScopeResult as A, ERRORS$1 as B, formatMoldeaCliHumanInspectResult as C, formatMoldeaCliJsonContentResult as D, formatMoldeaCliJsonCompositionResult as E, isRepositoryDirectoryInputValid as F, MOLDEA_CLI_COMMANDS as H, createMoldeaCliOutputPage as I, calculateMoldeaCliJsonDigest as L, createMoldeaCliOwnedError as M, MOLDEA_CLI_GIT_WORKING_TREE_SOURCE as N, formatMoldeaCliJsonError as O, parseMoldeaCliArguments as P, decodeMoldeaCliCursor as R, formatMoldeaCliHumanError as S, formatMoldeaCliHumanValidateResult as T, ERRORS$2 as U, MoldeaCliOutputPageException as V, createMoldeaCliInspectProjection as _, require_semver as a, formatMoldeaCliHumanCompositionResult as b, checkGitResult as c, listUntrackedFiles as d, readConfigBoolean as f, createMoldeaCliDiagnosticRecord as g, runGit as h, isMoldeaCliCompositionStateValid as i, formatMoldeaCliJsonValidateResult as j, formatMoldeaCliJsonInspectResult as k, createGitFailure as l, readTopLevel as m, resolveMoldeaCliComposition as n, MoldeaCliCompositionException as o, readIndexEntries as p, createMoldeaCliCompositionResult as r, createGitVersionPreflight as s, resolveInstalledMoldeaCliComposition as t, readGit as u, createMoldeaCliValidateProjection as v, formatMoldeaCliHumanScopeResult as w, formatMoldeaCliHumanContentResult as x, formatMoldeaCliHelp as y, encodeMoldeaCliCursor as z };
|