@moldea.ai/cli 13.0.3 → 14.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -9
- package/dist/chunks/{composition-eP3YRV8y.js → composition-D1OYuZ5d.js} +1 -1
- package/dist/chunks/{composition-BNE2Fn_6.js → composition-_3bygS_a.js} +21 -23
- package/dist/chunks/composition-_3bygS_a.js.map +1 -0
- package/dist/chunks/{core-composition-CJkwbKa4.js → core-composition-BKcJ--NX.js} +2 -2
- package/dist/chunks/{core-composition-CJkwbKa4.js.map → core-composition-BKcJ--NX.js.map} +1 -1
- package/dist/moldea.js +7 -12
- package/dist/moldea.js.map +1 -1
- package/dist/portable/LICENSES.md +506 -0
- package/dist/portable/SHA256SUMS +17 -0
- package/dist/portable/analysis-worker.mjs +193 -0
- package/dist/portable/chunk-131f8005.mjs +115 -0
- package/dist/portable/chunk-2ba7e89e.mjs +26 -0
- package/dist/portable/chunk-459da9cf.mjs +4138 -0
- package/dist/portable/chunk-728df961.mjs +544 -0
- package/dist/portable/chunk-8d6114d2.mjs +588 -0
- package/dist/portable/chunk-90403e67.mjs +2 -0
- package/dist/portable/chunk-94b5ac22.mjs +59 -0
- package/dist/portable/chunk-a5514957.mjs +5870 -0
- package/dist/portable/chunk-b98ca669.mjs +2 -0
- package/dist/portable/chunk-c13db66a.mjs +380 -0
- package/dist/portable/chunk-d5af3eda.mjs +2926 -0
- package/dist/portable/chunk-ec3f49d3.mjs +367 -0
- package/dist/portable/chunk-fcbcf4e3.mjs +147458 -0
- package/dist/portable/moldea.mjs +3529 -0
- package/dist/portable/node-runner.mjs +146 -0
- package/package.json +3 -3
- package/dist/chunks/composition-BNE2Fn_6.js.map +0 -1
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { n as CoreOperationException } from "./chunk-728df961.mjs";
|
|
2
|
+
import { u as normalizeCoreOptions } from "./chunk-a5514957.mjs";
|
|
3
|
+
import { i as RepositorySourceException } from "./chunk-8d6114d2.mjs";
|
|
4
|
+
import { a as createInspectionProcessFailure, c as encodeInspectionMessage, i as NODE_INSPECTION_TRANSPORT_BYTES, l as serializeInspectionFailure, o as decodeInspectionMessage, s as deserializeInspectionFailure, t as NODE_INSPECTION_FILE_PAGE_BYTES } from "./chunk-ec3f49d3.mjs";
|
|
5
|
+
import { a as parseRpcLinkText, i as parseRpcFilePage, n as parseRpcEntry, r as parseRpcEntryPage } from "./chunk-131f8005.mjs";
|
|
6
|
+
import { parentPort, workerData } from "node:worker_threads";
|
|
7
|
+
import { getHeapStatistics } from "node:v8";
|
|
8
|
+
//#region ../core/dist/analysis-worker.js
|
|
9
|
+
var port = parentPort;
|
|
10
|
+
if (port === null) throw createInspectionProcessFailure();
|
|
11
|
+
var start = decodeInspectionMessage(workerData);
|
|
12
|
+
if (start.kind !== "start") throw createInspectionProcessFailure();
|
|
13
|
+
var attemptId = start.attemptId;
|
|
14
|
+
var maxAnalysisHeapBytes = getHeapStatistics().heap_size_limit;
|
|
15
|
+
var inspection;
|
|
16
|
+
var hasRun = false;
|
|
17
|
+
var isReadingPage = false;
|
|
18
|
+
var nextRequestId = 0;
|
|
19
|
+
var pending = new Map();
|
|
20
|
+
var send = (message) => {
|
|
21
|
+
port.postMessage(encodeInspectionMessage(message));
|
|
22
|
+
};
|
|
23
|
+
var requestReader = (request) => {
|
|
24
|
+
if (pending.size >= 4) return Promise.reject(new CoreOperationException({
|
|
25
|
+
code: "RESOURCE_LIMIT_EXCEEDED",
|
|
26
|
+
operation: "create-project-inspection",
|
|
27
|
+
limit: "maxReaderRequests",
|
|
28
|
+
limitMaximum: 4,
|
|
29
|
+
observedUsage: pending.size + 1,
|
|
30
|
+
nextAction: null
|
|
31
|
+
}));
|
|
32
|
+
const requestId = nextRequestId++;
|
|
33
|
+
return new Promise((resolve, reject) => {
|
|
34
|
+
pending.set(requestId, {
|
|
35
|
+
resolve,
|
|
36
|
+
reject
|
|
37
|
+
});
|
|
38
|
+
try {
|
|
39
|
+
send({
|
|
40
|
+
attemptId,
|
|
41
|
+
kind: "reader-request",
|
|
42
|
+
requestId,
|
|
43
|
+
request
|
|
44
|
+
});
|
|
45
|
+
} catch (cause) {
|
|
46
|
+
pending.delete(requestId);
|
|
47
|
+
reject(cause instanceof Error ? cause : createInspectionProcessFailure(cause));
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
var createProxyReader = (source, snapshot) => ({
|
|
52
|
+
snapshot,
|
|
53
|
+
getEntry: async (path) => parseRpcEntry(await requestReader({
|
|
54
|
+
method: "getEntry",
|
|
55
|
+
path,
|
|
56
|
+
source
|
|
57
|
+
})),
|
|
58
|
+
listEntriesPage: async (options) => source === "repository" ? parseRpcEntryPage(await requestReader({
|
|
59
|
+
method: "listEntriesPage",
|
|
60
|
+
maxEntries: Math.min(128, options.maxEntries),
|
|
61
|
+
...options.cursor === void 0 ? {} : { cursor: options.cursor },
|
|
62
|
+
...options.prefix === void 0 ? {} : { prefix: options.prefix }
|
|
63
|
+
})) : Promise.reject(new RepositorySourceException({
|
|
64
|
+
code: "SOURCE_UNAVAILABLE",
|
|
65
|
+
operation: "list-entries-page",
|
|
66
|
+
path: null,
|
|
67
|
+
retryable: false
|
|
68
|
+
})),
|
|
69
|
+
readFilePage: async (path, options) => parseRpcFilePage(await requestReader({
|
|
70
|
+
method: "readFilePage",
|
|
71
|
+
path,
|
|
72
|
+
offset: options.offset,
|
|
73
|
+
maxBytes: Math.min(NODE_INSPECTION_FILE_PAGE_BYTES, options.maxBytes),
|
|
74
|
+
source
|
|
75
|
+
})),
|
|
76
|
+
readLinkText: async (path) => parseRpcLinkText(await requestReader({
|
|
77
|
+
method: "readLinkText",
|
|
78
|
+
path,
|
|
79
|
+
source
|
|
80
|
+
})),
|
|
81
|
+
compare: () => Promise.reject(new RepositorySourceException({
|
|
82
|
+
code: "SOURCE_UNAVAILABLE",
|
|
83
|
+
operation: "create-comparison",
|
|
84
|
+
path: null,
|
|
85
|
+
retryable: false
|
|
86
|
+
}))
|
|
87
|
+
});
|
|
88
|
+
var repository = createProxyReader("repository", start.snapshot);
|
|
89
|
+
var instructions = start.instructions === null ? null : createProxyReader("instructions", start.instructions.snapshot);
|
|
90
|
+
var prepare = async () => {
|
|
91
|
+
const { createCore } = await import("./chunk-b98ca669.mjs").then((n) => n.t);
|
|
92
|
+
inspection = await createCore(normalizeCoreOptions({ limits: {
|
|
93
|
+
...start.limits,
|
|
94
|
+
maxRetainedBytes: start.limits.maxRetainedBytes - NODE_INSPECTION_TRANSPORT_BYTES
|
|
95
|
+
} })).createProjectInspection({
|
|
96
|
+
repository,
|
|
97
|
+
...instructions === null ? {} : { instructions }
|
|
98
|
+
});
|
|
99
|
+
const metadata = {
|
|
100
|
+
source: inspection.source,
|
|
101
|
+
formatVersion: inspection.formatVersion,
|
|
102
|
+
valid: inspection.valid,
|
|
103
|
+
counts: inspection.counts,
|
|
104
|
+
coverageCounts: inspection.coverageCounts,
|
|
105
|
+
summary: inspection.summary,
|
|
106
|
+
resourceUsage: inspection.resourceUsage,
|
|
107
|
+
inspectionDigest: inspection.inspectionDigest
|
|
108
|
+
};
|
|
109
|
+
send({
|
|
110
|
+
attemptId,
|
|
111
|
+
kind: "prepared",
|
|
112
|
+
inspection: {
|
|
113
|
+
...metadata,
|
|
114
|
+
maxAnalysisHeapBytes,
|
|
115
|
+
resourceUsage: {
|
|
116
|
+
...metadata.resourceUsage,
|
|
117
|
+
retainedBytes: metadata.resourceUsage.retainedBytes + NODE_INSPECTION_TRANSPORT_BYTES,
|
|
118
|
+
peakRetainedBytes: metadata.resourceUsage.peakRetainedBytes + NODE_INSPECTION_TRANSPORT_BYTES
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
};
|
|
123
|
+
var fail = (cause) => {
|
|
124
|
+
try {
|
|
125
|
+
const failure = serializeInspectionFailure(cause);
|
|
126
|
+
if (cause instanceof CoreOperationException && cause.code === "RESOURCE_LIMIT_EXCEEDED" && cause.limit === "maxRetainedBytes" && cause.observedUsage !== null) {
|
|
127
|
+
failure.options["limitMaximum"] = start.limits.maxRetainedBytes;
|
|
128
|
+
failure.options["observedUsage"] = cause.observedUsage + NODE_INSPECTION_TRANSPORT_BYTES;
|
|
129
|
+
}
|
|
130
|
+
send({
|
|
131
|
+
attemptId,
|
|
132
|
+
kind: "failure",
|
|
133
|
+
failure
|
|
134
|
+
});
|
|
135
|
+
} catch {
|
|
136
|
+
port.close();
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
port.on("message", (frame) => {
|
|
140
|
+
try {
|
|
141
|
+
const message = decodeInspectionMessage(frame);
|
|
142
|
+
if (message.attemptId !== attemptId) throw createInspectionProcessFailure();
|
|
143
|
+
if (message.kind === "run") {
|
|
144
|
+
if (hasRun) throw createInspectionProcessFailure();
|
|
145
|
+
hasRun = true;
|
|
146
|
+
prepare().catch(fail);
|
|
147
|
+
} else if (message.kind === "reader-response" || message.kind === "reader-failure") {
|
|
148
|
+
const request = pending.get(message.requestId);
|
|
149
|
+
if (request === void 0) throw createInspectionProcessFailure();
|
|
150
|
+
pending.delete(message.requestId);
|
|
151
|
+
if (message.kind === "reader-failure") request.reject(deserializeInspectionFailure(message.failure));
|
|
152
|
+
else request.resolve(message.result);
|
|
153
|
+
} else if (message.kind === "read-page") {
|
|
154
|
+
if (inspection === void 0 || isReadingPage) throw createInspectionProcessFailure();
|
|
155
|
+
isReadingPage = true;
|
|
156
|
+
try {
|
|
157
|
+
if (message.input.maxItems > start.limits.maxEntries) throw new CoreOperationException({
|
|
158
|
+
code: "INVALID_ARGUMENT",
|
|
159
|
+
operation: "create-project-inspection"
|
|
160
|
+
});
|
|
161
|
+
let maxItems = Math.min(256, message.input.maxItems);
|
|
162
|
+
while (true) try {
|
|
163
|
+
const frame = encodeInspectionMessage({
|
|
164
|
+
attemptId,
|
|
165
|
+
kind: "page",
|
|
166
|
+
requestId: message.requestId,
|
|
167
|
+
result: inspection.readPage({
|
|
168
|
+
...message.input,
|
|
169
|
+
maxItems
|
|
170
|
+
})
|
|
171
|
+
});
|
|
172
|
+
port.postMessage(frame);
|
|
173
|
+
break;
|
|
174
|
+
} catch (cause) {
|
|
175
|
+
if (!(cause instanceof CoreOperationException) || cause.code !== "RESOURCE_LIMIT_EXCEEDED" || cause.limit !== "maxInspectionMessageBytes" || maxItems === 1) throw cause;
|
|
176
|
+
maxItems = Math.max(1, Math.floor(maxItems / 2));
|
|
177
|
+
}
|
|
178
|
+
} finally {
|
|
179
|
+
isReadingPage = false;
|
|
180
|
+
}
|
|
181
|
+
} else throw createInspectionProcessFailure();
|
|
182
|
+
} catch (cause) {
|
|
183
|
+
fail(cause);
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
port.on("messageerror", fail);
|
|
187
|
+
send({
|
|
188
|
+
attemptId,
|
|
189
|
+
kind: "ready",
|
|
190
|
+
maxAnalysisHeapBytes
|
|
191
|
+
});
|
|
192
|
+
//#endregion
|
|
193
|
+
export {};
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { u as isObjectValid } from "./chunk-728df961.mjs";
|
|
2
|
+
import { c as isRepositoryPath, i as RepositorySourceException, l as parseRepositoryPath } from "./chunk-8d6114d2.mjs";
|
|
3
|
+
import { Buffer } from "node:buffer";
|
|
4
|
+
//#region ../core/dist/chunks/repository-rpc-DVgCPLGx.js
|
|
5
|
+
var invalidSource = () => {
|
|
6
|
+
throw new RepositorySourceException({
|
|
7
|
+
code: "INVALID_SOURCE_DATA",
|
|
8
|
+
operation: "create-reader",
|
|
9
|
+
path: null,
|
|
10
|
+
retryable: false
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var isInteger = (input) => typeof input === "number" && Number.isSafeInteger(input) && input >= 0;
|
|
14
|
+
var keysMatch = (input, keys) => Object.keys(input).length === keys.length && keys.every((key) => Object.hasOwn(input, key));
|
|
15
|
+
var parseSnapshot = (input) => {
|
|
16
|
+
if (!isObjectValid(input, true) || !keysMatch(input, ["id", "sourceKind"]) || typeof input["id"] !== "string" || input["id"].length === 0 || typeof input["sourceKind"] !== "string" || input["sourceKind"].length === 0) return invalidSource();
|
|
17
|
+
return {
|
|
18
|
+
id: input["id"],
|
|
19
|
+
sourceKind: input["sourceKind"]
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
var parseRpcEntry = (input) => {
|
|
23
|
+
if (input === null) return null;
|
|
24
|
+
if (!isObjectValid(input, true)) return invalidSource();
|
|
25
|
+
const entry = input;
|
|
26
|
+
if (!keysMatch(entry, [
|
|
27
|
+
"path",
|
|
28
|
+
"type",
|
|
29
|
+
"byteLength",
|
|
30
|
+
"contentIdentity"
|
|
31
|
+
]) || !isRepositoryPath(entry["path"]) || entry["type"] !== "file" && entry["type"] !== "directory" && entry["type"] !== "symlink" || entry["byteLength"] !== null && !isInteger(entry["byteLength"]) || entry["contentIdentity"] !== null && typeof entry["contentIdentity"] !== "string") return invalidSource();
|
|
32
|
+
return {
|
|
33
|
+
path: entry["path"],
|
|
34
|
+
type: entry["type"],
|
|
35
|
+
byteLength: entry["byteLength"],
|
|
36
|
+
contentIdentity: entry["contentIdentity"]
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
var parseRpcEntryPage = (input) => {
|
|
40
|
+
if (!isObjectValid(input, true)) return invalidSource();
|
|
41
|
+
const page = input;
|
|
42
|
+
if (!keysMatch(page, [
|
|
43
|
+
"entries",
|
|
44
|
+
"isComplete",
|
|
45
|
+
"nextCursor",
|
|
46
|
+
"snapshot"
|
|
47
|
+
]) || !Array.isArray(page["entries"]) || page["entries"].length > 128 || typeof page["isComplete"] !== "boolean" || page["nextCursor"] !== null && typeof page["nextCursor"] !== "string") return invalidSource();
|
|
48
|
+
const entries = [];
|
|
49
|
+
for (const candidate of page["entries"]) {
|
|
50
|
+
const entry = parseRpcEntry(candidate);
|
|
51
|
+
if (entry === null) return invalidSource();
|
|
52
|
+
entries.push(entry);
|
|
53
|
+
}
|
|
54
|
+
return {
|
|
55
|
+
entries,
|
|
56
|
+
isComplete: page["isComplete"],
|
|
57
|
+
nextCursor: page["nextCursor"],
|
|
58
|
+
snapshot: parseSnapshot(page["snapshot"])
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
var parseRpcLinkText = (input) => {
|
|
62
|
+
if (input === null) return null;
|
|
63
|
+
if (typeof input !== "string" || Buffer.byteLength(input, "utf8") > 4096) return invalidSource();
|
|
64
|
+
return input;
|
|
65
|
+
};
|
|
66
|
+
var parseRpcFilePage = (input) => {
|
|
67
|
+
if (!isObjectValid(input, true)) return invalidSource();
|
|
68
|
+
const filePage = input;
|
|
69
|
+
if (!keysMatch(filePage, [
|
|
70
|
+
"bytes",
|
|
71
|
+
"isComplete",
|
|
72
|
+
"nextOffset",
|
|
73
|
+
"offset",
|
|
74
|
+
"snapshot",
|
|
75
|
+
"totalBytes"
|
|
76
|
+
]) || typeof filePage["bytes"] !== "string" || filePage["bytes"].length > Math.ceil(65536 / 3) * 4 || !/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(filePage["bytes"]) || typeof filePage["isComplete"] !== "boolean" || !isInteger(filePage["offset"]) || !isInteger(filePage["totalBytes"]) || filePage["nextOffset"] !== null && !isInteger(filePage["nextOffset"])) return invalidSource();
|
|
77
|
+
const bytes = Buffer.from(filePage["bytes"], "base64");
|
|
78
|
+
if (bytes.byteLength > 65536 || bytes.toString("base64") !== filePage["bytes"]) return invalidSource();
|
|
79
|
+
return {
|
|
80
|
+
bytes,
|
|
81
|
+
isComplete: filePage["isComplete"],
|
|
82
|
+
nextOffset: filePage["nextOffset"],
|
|
83
|
+
offset: filePage["offset"],
|
|
84
|
+
snapshot: parseSnapshot(filePage["snapshot"]),
|
|
85
|
+
totalBytes: filePage["totalBytes"]
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
var encodeFilePage = (page, maxBytes) => {
|
|
89
|
+
if (!(page.bytes instanceof Uint8Array) || page.bytes.byteLength > maxBytes) return invalidSource();
|
|
90
|
+
const result = {
|
|
91
|
+
...page,
|
|
92
|
+
bytes: Buffer.from(page.bytes.buffer, page.bytes.byteOffset, page.bytes.byteLength).toString("base64")
|
|
93
|
+
};
|
|
94
|
+
parseRpcFilePage(result);
|
|
95
|
+
return result;
|
|
96
|
+
};
|
|
97
|
+
var executeRepositoryRpc = async (sources, request, signal) => {
|
|
98
|
+
const getReader = (source) => source === "repository" ? sources.repository : sources.instructions ?? invalidSource();
|
|
99
|
+
if (request.method === "readLinkText") return parseRpcLinkText(await getReader(request.source).readLinkText(parseRepositoryPath(request.path), { signal }));
|
|
100
|
+
if (request.method === "getEntry") return parseRpcEntry(await getReader(request.source).getEntry(parseRepositoryPath(request.path), { signal }));
|
|
101
|
+
const reader = sources.repository;
|
|
102
|
+
if (request.method === "listEntriesPage") return parseRpcEntryPage(await reader.listEntriesPage({
|
|
103
|
+
maxEntries: request.maxEntries,
|
|
104
|
+
signal,
|
|
105
|
+
...request.prefix === void 0 ? {} : { prefix: parseRepositoryPath(request.prefix) },
|
|
106
|
+
...request.cursor === void 0 ? {} : { cursor: request.cursor }
|
|
107
|
+
}));
|
|
108
|
+
return encodeFilePage(await getReader(request.source).readFilePage(parseRepositoryPath(request.path), {
|
|
109
|
+
maxBytes: request.maxBytes,
|
|
110
|
+
offset: request.offset,
|
|
111
|
+
signal
|
|
112
|
+
}), request.maxBytes);
|
|
113
|
+
};
|
|
114
|
+
//#endregion
|
|
115
|
+
export { parseRpcLinkText as a, parseRpcFilePage as i, parseRpcEntry as n, parseRpcEntryPage as r, executeRepositoryRpc as t };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
//#region \0rolldown/runtime.js
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
12
|
+
key = keys[i];
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
14
|
+
get: ((k) => from[k]).bind(null, key),
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
21
|
+
value: mod,
|
|
22
|
+
enumerable: true
|
|
23
|
+
}) : target, mod));
|
|
24
|
+
var __require = (() => createRequire(import.meta.url))();
|
|
25
|
+
//#endregion
|
|
26
|
+
export { __require as n, __toESM as r, __commonJSMin as t };
|