veoflow 0.5.5 → 0.5.6
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/bin/veoflow.mjs +1 -1
- package/dist/veo.mjs +197 -78
- package/native/veo-extract.darwin-arm64.node +0 -0
- package/native/veo-extract.darwin-x64.node +0 -0
- package/native/veo-extract.linux-arm64-gnu.node +0 -0
- package/native/veo-extract.linux-x64-gnu.node +0 -0
- package/native/veo-extract.win32-x64-msvc.node +0 -0
- package/package.json +1 -1
- package/web/assets/{callLayout.worker-BugXMtxI.js → callLayout.worker-Bq-i56H_.js} +1 -1
- package/web/assets/{index-dL51osPc.js → index-DLPLxvCf.js} +9 -8
- package/web/assets/index-Dsixf95A.css +1 -0
- package/web/index.html +2 -2
- package/web/assets/index-DuPpioTn.css +0 -1
package/bin/veoflow.mjs
CHANGED
|
@@ -17,7 +17,7 @@ const here = dirname(fileURLToPath(import.meta.url));
|
|
|
17
17
|
process.env.VEO_CHECKERS_MODULE ??= pathToFileURL(join(here, "../dist/checkers.mjs")).href;
|
|
18
18
|
process.env.VEO_NATIVE_DIR ??= join(here, "../native");
|
|
19
19
|
process.env.VEO_WEB_ROOT ??= join(here, "../web");
|
|
20
|
-
process.env.VEO_VERSION = "0.5.
|
|
20
|
+
process.env.VEO_VERSION = "0.5.6";
|
|
21
21
|
const { main } = await import("../dist/veo.mjs");
|
|
22
22
|
const code = await main(process.argv.slice(2), {
|
|
23
23
|
out: (line) => process.stdout.write(line + "\n"),
|
package/dist/veo.mjs
CHANGED
|
@@ -2129,7 +2129,10 @@ function transaction(db, fn, mode = "IMMEDIATE") {
|
|
|
2129
2129
|
db.exec("COMMIT");
|
|
2130
2130
|
return result2;
|
|
2131
2131
|
} catch (e) {
|
|
2132
|
-
|
|
2132
|
+
try {
|
|
2133
|
+
db.exec("ROLLBACK");
|
|
2134
|
+
} catch {
|
|
2135
|
+
}
|
|
2133
2136
|
throw e;
|
|
2134
2137
|
}
|
|
2135
2138
|
}
|
|
@@ -4065,6 +4068,11 @@ function sleep(ms) {
|
|
|
4065
4068
|
function message(e) {
|
|
4066
4069
|
return e instanceof Error ? e.message : String(e);
|
|
4067
4070
|
}
|
|
4071
|
+
function failureMessage(e) {
|
|
4072
|
+
const text = message(e);
|
|
4073
|
+
const full = e.errcode === 13 || /database or disk is full/i.test(text);
|
|
4074
|
+
return full ? `the disk holding veoflow's data is full: ${text}` : text;
|
|
4075
|
+
}
|
|
4068
4076
|
function badRequest(request) {
|
|
4069
4077
|
const names = request.stages.map((s) => s.name);
|
|
4070
4078
|
for (const name of [...names, ...request.retire ?? []])
|
|
@@ -4515,15 +4523,16 @@ async function runNow(request) {
|
|
|
4515
4523
|
stopProgress();
|
|
4516
4524
|
const code = e.code;
|
|
4517
4525
|
const errorCode = typeof code === "string" ? code : void 0;
|
|
4526
|
+
const error62 = failureMessage(e);
|
|
4518
4527
|
try {
|
|
4519
|
-
run2.fail(
|
|
4528
|
+
run2.fail(error62, current ?? "commit", errorCode);
|
|
4520
4529
|
} finally {
|
|
4521
4530
|
emit({
|
|
4522
4531
|
type: "run.failed",
|
|
4523
4532
|
projectId,
|
|
4524
4533
|
runId: run2.runId,
|
|
4525
4534
|
stage: current,
|
|
4526
|
-
error:
|
|
4535
|
+
error: error62,
|
|
4527
4536
|
...errorCode ? { code: errorCode } : {}
|
|
4528
4537
|
});
|
|
4529
4538
|
}
|
|
@@ -5197,7 +5206,7 @@ function childRepositories(root) {
|
|
|
5197
5206
|
other: entries.filter((d) => !isRepo(d)).map((d) => d.isDirectory() ? `${d.name}/` : d.name)
|
|
5198
5207
|
};
|
|
5199
5208
|
}
|
|
5200
|
-
var HISTORY_CAP, HISTORY_MAX, DIFF_ITEMS_MAX, DIFF_FILES_MAX, scratch, UNNAMED, CODE_HEAD, CODE_BEFORE, GROUP_BY, SEARCH_LIMIT, SEARCH_MAX, AGGREGATE_MAX, OUTLINE_MAX, sleep2, MB, R1_STAGES, MAX_FILE_MB_CAP, normalizePath2, slug2, LICENSE_FINDINGS, Engine;
|
|
5209
|
+
var HISTORY_CAP, HISTORY_MAX, DIFF_ITEMS_MAX, DIFF_FILES_MAX, scratch, UNNAMED, CODE_HEAD, CODE_BEFORE, GROUP_BY, SEARCH_LIMIT, SEARCH_MAX, AGGREGATE_MAX, OUTLINE_MAX, sleep2, MB, MEMO_MAX, R1_STAGES, MAX_FILE_MB_CAP, normalizePath2, slug2, LICENSE_FINDINGS, Engine;
|
|
5201
5210
|
var init_engine = __esm({
|
|
5202
5211
|
"packages/query/src/engine.ts"() {
|
|
5203
5212
|
"use strict";
|
|
@@ -5227,6 +5236,7 @@ var init_engine = __esm({
|
|
|
5227
5236
|
OUTLINE_MAX = 500;
|
|
5228
5237
|
sleep2 = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
5229
5238
|
MB = 1024 * 1024;
|
|
5239
|
+
MEMO_MAX = 32;
|
|
5230
5240
|
R1_STAGES = [stage1.name, templateLink.name];
|
|
5231
5241
|
MAX_FILE_MB_CAP = 64;
|
|
5232
5242
|
normalizePath2 = (p) => p.replace(/\\/g, "/").replace(/^\.?\/+|\/+$/g, "");
|
|
@@ -5238,6 +5248,8 @@ var init_engine = __esm({
|
|
|
5238
5248
|
catalog;
|
|
5239
5249
|
/** Run events from every project (run.started, stage.completed, ...). */
|
|
5240
5250
|
events = new EventEmitter();
|
|
5251
|
+
/** Whole-project reads already made, by project, run and key (#386); the oldest goes first. */
|
|
5252
|
+
memos = /* @__PURE__ */ new Map();
|
|
5241
5253
|
/** Each project's run in progress, as far as its events say (#299). */
|
|
5242
5254
|
progress = /* @__PURE__ */ new Map();
|
|
5243
5255
|
license;
|
|
@@ -6640,6 +6652,28 @@ var init_engine = __esm({
|
|
|
6640
6652
|
setRunSummary(project2, run2, key, value) {
|
|
6641
6653
|
this.handle(this.resolveProject({ project: project2 })).store.setRunSummary(run2, key, value);
|
|
6642
6654
|
}
|
|
6655
|
+
/**
|
|
6656
|
+
* A read's result kept while this engine lives (#386), for whole-project
|
|
6657
|
+
* reads that cost seconds on a large project and can't change until the
|
|
6658
|
+
* next run: the same project (by id and when it was made), run and key get
|
|
6659
|
+
* the same value back, so callers must not change what they get. At most
|
|
6660
|
+
* MEMO_MAX results are kept, the least recently used dropped first; a run
|
|
6661
|
+
* that isn't committed yet (0) is never kept.
|
|
6662
|
+
*/
|
|
6663
|
+
memo(project2, run2, key, compute) {
|
|
6664
|
+
if (run2 === 0) return compute();
|
|
6665
|
+
const k = `${project2.id}\0${project2.createdAt}\0${run2}\0${key}`;
|
|
6666
|
+
if (this.memos.has(k)) {
|
|
6667
|
+
const hit = this.memos.get(k);
|
|
6668
|
+
this.memos.delete(k);
|
|
6669
|
+
this.memos.set(k, hit);
|
|
6670
|
+
return hit;
|
|
6671
|
+
}
|
|
6672
|
+
const value = compute();
|
|
6673
|
+
if (this.memos.size >= MEMO_MAX) this.memos.delete(this.memos.keys().next().value);
|
|
6674
|
+
this.memos.set(k, value);
|
|
6675
|
+
return value;
|
|
6676
|
+
}
|
|
6643
6677
|
readAllStages(args, cwd) {
|
|
6644
6678
|
const project2 = this.resolveProject(args, cwd);
|
|
6645
6679
|
const reader = this.pinnedReader(project2, args.run);
|
|
@@ -7016,10 +7050,23 @@ var init_engine = __esm({
|
|
|
7016
7050
|
fields: ["filters"]
|
|
7017
7051
|
});
|
|
7018
7052
|
const limit = checkLimit(args.limit, AGGREGATE_MAX, AGGREGATE_MAX);
|
|
7053
|
+
const pending = args.filters?.ownCode ? this.pendingLibraries(project2.id, args.run ?? this.handle(project2).store.currentRun()) : /* @__PURE__ */ new Map();
|
|
7054
|
+
const offers = JSON.stringify([...pending].map(([s, paths]) => [s, [...paths].sort()]).sort());
|
|
7055
|
+
const key = `aggregate\0${JSON.stringify([args.label, args.groupBy, args.filters ?? null, limit, args.source ?? null, offers])}`;
|
|
7056
|
+
const counted = this.memo(
|
|
7057
|
+
project2,
|
|
7058
|
+
reader.run,
|
|
7059
|
+
key,
|
|
7060
|
+
() => this.aggregateCounts(project2, reader, args, limit, pending)
|
|
7061
|
+
);
|
|
7062
|
+
return { ...this.meta(project2, reader), label: args.label, groupBy: args.groupBy, ...counted };
|
|
7063
|
+
}
|
|
7064
|
+
/** `aggregate`'s counting, apart from the read's meta (#386). */
|
|
7065
|
+
aggregateCounts(project2, reader, args, limit, pending) {
|
|
7066
|
+
const open3 = args.filters?.open;
|
|
7019
7067
|
const prefix = args.filters?.path;
|
|
7020
7068
|
const files = reader.facts("File");
|
|
7021
7069
|
const pathOf9 = new Map(files.map((f) => [f.id, f.path]));
|
|
7022
|
-
const pending = args.filters?.ownCode ? this.pendingLibraries(project2.id, args.run ?? this.handle(project2).store.currentRun()) : /* @__PURE__ */ new Map();
|
|
7023
7070
|
const foreign = new Set(
|
|
7024
7071
|
args.filters?.ownCode ? files.filter((f) => f.origin || inPendingLibrary(f, pending)).map((f) => f.id) : []
|
|
7025
7072
|
);
|
|
@@ -7070,9 +7117,6 @@ var init_engine = __esm({
|
|
|
7070
7117
|
let total = 0;
|
|
7071
7118
|
for (const [, n2] of sorted) total += n2;
|
|
7072
7119
|
return {
|
|
7073
|
-
...this.meta(project2, reader),
|
|
7074
|
-
label: args.label,
|
|
7075
|
-
groupBy: args.groupBy,
|
|
7076
7120
|
total,
|
|
7077
7121
|
groupCount: sorted.length,
|
|
7078
7122
|
truncated: sorted.length > limit,
|
|
@@ -7137,16 +7181,27 @@ var init_engine = __esm({
|
|
|
7137
7181
|
const reader = this.reader(project2, args.run);
|
|
7138
7182
|
if (args.file && reader.fact(args.file)?.type !== "File")
|
|
7139
7183
|
throw new VeoError("not-found", `no file ${args.file}`, { kind: "file", id: args.file });
|
|
7140
|
-
const
|
|
7141
|
-
|
|
7142
|
-
|
|
7143
|
-
|
|
7184
|
+
const list = () => {
|
|
7185
|
+
const everywhere = args.file ? visibleSites(reader.inFile(args.file)) : visibleSites(reader.facts("UnresolvedCallSite"), reader);
|
|
7186
|
+
const all2 = args.source ? everywhere.filter((s) => s.file.startsWith(`${args.source}:`)) : everywhere;
|
|
7187
|
+
return args.includeAll ? all2 : all2.filter(isOpenQuestion);
|
|
7188
|
+
};
|
|
7189
|
+
if (!paged) return { ...this.meta(project2, reader), sites: withProvenance(reader, list()) };
|
|
7190
|
+
const ids2 = args.file ? null : this.memo(
|
|
7191
|
+
project2,
|
|
7192
|
+
reader.run,
|
|
7193
|
+
`unresolved\0${args.source ?? ""}\0${args.includeAll ? 1 : 0}`,
|
|
7194
|
+
() => list().map((s) => s.id)
|
|
7195
|
+
);
|
|
7196
|
+
const byId = (some) => some.map((id) => reader.fact(id));
|
|
7197
|
+
const ofFile = ids2 ? null : list();
|
|
7144
7198
|
const offset = args.offset ?? 0;
|
|
7145
|
-
const
|
|
7199
|
+
const end2 = args.limit === void 0 ? void 0 : offset + args.limit;
|
|
7200
|
+
const page = ids2 ? byId(ids2.slice(offset, end2)) : ofFile.slice(offset, end2);
|
|
7146
7201
|
return {
|
|
7147
7202
|
...this.meta(project2, reader),
|
|
7148
7203
|
sites: withProvenance(reader, page),
|
|
7149
|
-
total:
|
|
7204
|
+
total: ids2 ? ids2.length : ofFile.length,
|
|
7150
7205
|
offset
|
|
7151
7206
|
};
|
|
7152
7207
|
}
|
|
@@ -7360,7 +7415,9 @@ var init_view = __esm({
|
|
|
7360
7415
|
// The project map (no group) is the whole map again; a group keeps the area it was opened from.
|
|
7361
7416
|
area: a.group ? s.area : null,
|
|
7362
7417
|
// A folder opened with it, in one step (#290: the outline, from a file's level).
|
|
7363
|
-
expand: a.folder && !kept.includes(a.folder) ? [...kept, a.folder].sort() : kept
|
|
7418
|
+
expand: a.folder && !kept.includes(a.folder) ? [...kept, a.folder].sort() : kept,
|
|
7419
|
+
// What was revealed belonged to the file level left behind (#378, #390).
|
|
7420
|
+
reveal: []
|
|
7364
7421
|
};
|
|
7365
7422
|
}
|
|
7366
7423
|
},
|
|
@@ -7376,7 +7433,9 @@ var init_view = __esm({
|
|
|
7376
7433
|
group: null,
|
|
7377
7434
|
pick: null,
|
|
7378
7435
|
fileLevel: false,
|
|
7379
|
-
area: a.area ?? null
|
|
7436
|
+
area: a.area ?? null,
|
|
7437
|
+
// What was revealed belonged to the file level left behind (#378, #390).
|
|
7438
|
+
reveal: []
|
|
7380
7439
|
})
|
|
7381
7440
|
},
|
|
7382
7441
|
openImportsFile: {
|
|
@@ -9020,8 +9079,8 @@ function projectTotals(engine, args, cwd) {
|
|
|
9020
9079
|
const withinFiles = sum(reader.countByFile("CALLS"));
|
|
9021
9080
|
const acrossFiles = sum(reader.countByFile("CALLS_CROSS_FILE"));
|
|
9022
9081
|
const run2 = args.run ?? meta3.committedRun;
|
|
9023
|
-
const summary2 = args.
|
|
9024
|
-
const kept = summary2?.completenessPending === pendingKey(pending) ? summary2.completeness : void 0;
|
|
9082
|
+
const summary2 = args.source === void 0 && run2 !== null ? keptFindingSummary(engine, meta3.project, run2) : void 0;
|
|
9083
|
+
const kept = summary2?.completenessPending === pendingKey(pending) ? args.own ? summary2.completeness : summary2.completenessAll : void 0;
|
|
9025
9084
|
const completeness = kept ?? completenessOf(reader, inScope, withinFiles, acrossFiles);
|
|
9026
9085
|
return {
|
|
9027
9086
|
...meta3,
|
|
@@ -9037,9 +9096,9 @@ function projectTotals(engine, args, cwd) {
|
|
|
9037
9096
|
completeness
|
|
9038
9097
|
};
|
|
9039
9098
|
}
|
|
9040
|
-
function completenessOf(reader, inScope, withinFiles, acrossFiles) {
|
|
9099
|
+
function completenessOf(reader, inScope, withinFiles, acrossFiles, file2) {
|
|
9041
9100
|
const resolutions = new Map(
|
|
9042
|
-
reader.facts("SiteResolution").filter((r) => inScope(r.file)).map((r) => [r.site, r])
|
|
9101
|
+
reader.facts("SiteResolution", file2).filter((r) => inScope(r.file)).map((r) => [r.site, r])
|
|
9043
9102
|
);
|
|
9044
9103
|
let external = 0;
|
|
9045
9104
|
const candidates = { one: 0, several: 0 };
|
|
@@ -9051,7 +9110,8 @@ function completenessOf(reader, inScope, withinFiles, acrossFiles) {
|
|
|
9051
9110
|
else exits2.named++;
|
|
9052
9111
|
if (x.byType) exits2.byType++;
|
|
9053
9112
|
};
|
|
9054
|
-
|
|
9113
|
+
const sites = file2 ? visibleSites([...reader.facts("UnresolvedCallSite", file2), ...reader.facts("CALLS_CROSS_FILE", file2)]) : visibleSites(reader.facts("UnresolvedCallSite"), reader);
|
|
9114
|
+
for (const site of sites) {
|
|
9055
9115
|
if (!inScope(site.file)) continue;
|
|
9056
9116
|
const r = resolutions.get(site.id);
|
|
9057
9117
|
if (r?.status === "linked" || !r && (site.status === "linked" || site.status === "runtime-confirmed"))
|
|
@@ -9071,7 +9131,7 @@ function completenessOf(reader, inScope, withinFiles, acrossFiles) {
|
|
|
9071
9131
|
open3.set(reason, (open3.get(reason) ?? 0) + 1);
|
|
9072
9132
|
}
|
|
9073
9133
|
const references = { functions: 0, packages: 0 };
|
|
9074
|
-
for (const e of reader.facts("REFERENCES")) {
|
|
9134
|
+
for (const e of reader.facts("REFERENCES", file2)) {
|
|
9075
9135
|
if (!inScope(e.evidence.file)) continue;
|
|
9076
9136
|
if (e.exit) {
|
|
9077
9137
|
references.packages++;
|
|
@@ -9086,7 +9146,7 @@ function completenessOf(reader, inScope, withinFiles, acrossFiles) {
|
|
|
9086
9146
|
external,
|
|
9087
9147
|
candidates,
|
|
9088
9148
|
open: openTotal,
|
|
9089
|
-
openByReason: [...open3].map(([reason,
|
|
9149
|
+
openByReason: [...open3].map(([reason, sites2]) => ({ reason, sites: sites2 })).sort((a, b) => b.sites - a.sites || (a.reason < b.reason ? -1 : 1)),
|
|
9090
9150
|
references,
|
|
9091
9151
|
exits: exits2
|
|
9092
9152
|
};
|
|
@@ -9963,13 +10023,16 @@ function summarizeFindings(engine, project2, run2) {
|
|
|
9963
10023
|
};
|
|
9964
10024
|
engine.setRunSummary(project2, run2, IMPACT_SUMMARY, { pending: pendingNow, items });
|
|
9965
10025
|
if (reader.count("Group") > 0) {
|
|
9966
|
-
const
|
|
10026
|
+
const within = reader.countByFile("CALLS");
|
|
10027
|
+
const across = reader.countByFile("CALLS_CROSS_FILE");
|
|
10028
|
+
const count2 = (byFile, own3) => [...byFile].reduce((n2, [f, c]) => n2 + (!own3 || inOwn.has(f) ? c : 0), 0);
|
|
9967
10029
|
summary2.completeness = completenessOf(
|
|
9968
10030
|
reader,
|
|
9969
10031
|
(file2) => inOwn.has(file2),
|
|
9970
|
-
count2(
|
|
9971
|
-
count2(
|
|
10032
|
+
count2(within, true),
|
|
10033
|
+
count2(across, true)
|
|
9972
10034
|
);
|
|
10035
|
+
summary2.completenessAll = completenessOf(reader, () => true, count2(within, false), count2(across, false));
|
|
9973
10036
|
summary2.completenessPending = pendingNow;
|
|
9974
10037
|
}
|
|
9975
10038
|
engine.setRunSummary(project2, run2, FINDINGS_SUMMARY, summary2);
|
|
@@ -10038,7 +10101,7 @@ var init_reads = __esm({
|
|
|
10038
10101
|
pending: a.pending + b.pending,
|
|
10039
10102
|
openCalls: a.openCalls + b.openCalls
|
|
10040
10103
|
});
|
|
10041
|
-
FINDINGS_SUMMARY = "findings/
|
|
10104
|
+
FINDINGS_SUMMARY = "findings/v8";
|
|
10042
10105
|
IMPACT_SUMMARY = "impact/v3";
|
|
10043
10106
|
}
|
|
10044
10107
|
});
|
|
@@ -10875,53 +10938,60 @@ function listExits(engine, args, cwd) {
|
|
|
10875
10938
|
if (!g) groups2.set(key, g = { exit: x, calls: [], references: 0 });
|
|
10876
10939
|
return g;
|
|
10877
10940
|
};
|
|
10878
|
-
const
|
|
10879
|
-
|
|
10880
|
-
|
|
10881
|
-
|
|
10882
|
-
|
|
10883
|
-
|
|
10884
|
-
|
|
10885
|
-
|
|
10886
|
-
|
|
10887
|
-
|
|
10888
|
-
|
|
10889
|
-
|
|
10890
|
-
|
|
10891
|
-
|
|
10892
|
-
|
|
10893
|
-
|
|
10894
|
-
|
|
10895
|
-
|
|
10896
|
-
|
|
10897
|
-
|
|
10898
|
-
|
|
10899
|
-
|
|
10900
|
-
|
|
10901
|
-
|
|
10902
|
-
|
|
10903
|
-
|
|
10904
|
-
|
|
10905
|
-
|
|
10906
|
-
|
|
10907
|
-
|
|
10908
|
-
|
|
10909
|
-
|
|
10910
|
-
|
|
10911
|
-
|
|
10912
|
-
|
|
10913
|
-
|
|
10914
|
-
|
|
10915
|
-
|
|
10916
|
-
|
|
10917
|
-
|
|
10918
|
-
|
|
10941
|
+
const grouped = () => {
|
|
10942
|
+
const sites = new Map(
|
|
10943
|
+
(args.file !== void 0 ? reader.facts("UnresolvedCallSite", args.file) : reader.facts("UnresolvedCallSite")).map((s) => [s.id, s])
|
|
10944
|
+
);
|
|
10945
|
+
const resolutions = args.file !== void 0 ? reader.facts("SiteResolution", args.file) : reader.facts("SiteResolution");
|
|
10946
|
+
for (const r of resolutions) {
|
|
10947
|
+
if (!r.exit || !wanted2(r.file, r.exit)) continue;
|
|
10948
|
+
const s = sites.get(r.site);
|
|
10949
|
+
if (!s) continue;
|
|
10950
|
+
at(r.exit).calls.push({
|
|
10951
|
+
evidence: r.evidence,
|
|
10952
|
+
make: (rd) => ({
|
|
10953
|
+
id: r.id,
|
|
10954
|
+
kind: "call",
|
|
10955
|
+
path: pathOf5(r.file),
|
|
10956
|
+
line: r.evidence.span.start.line,
|
|
10957
|
+
function: fnEnd(rd, s.enclosingFn),
|
|
10958
|
+
expression: s.expression,
|
|
10959
|
+
...r.exit.literals?.length ? { literals: r.exit.literals } : {},
|
|
10960
|
+
...r.exit.reason ? { reason: r.exit.reason } : {},
|
|
10961
|
+
evidence: r.evidence
|
|
10962
|
+
})
|
|
10963
|
+
});
|
|
10964
|
+
}
|
|
10965
|
+
const references = args.file !== void 0 ? reader.facts("REFERENCES", args.file) : reader.facts("REFERENCES");
|
|
10966
|
+
for (const e of references) {
|
|
10967
|
+
if (!e.exit || !wanted2(e.evidence.file, e.exit)) continue;
|
|
10968
|
+
const g = at(e.exit);
|
|
10969
|
+
g.references++;
|
|
10970
|
+
g.calls.push({
|
|
10971
|
+
evidence: e.evidence,
|
|
10972
|
+
make: (rd) => ({
|
|
10973
|
+
id: e.id,
|
|
10974
|
+
kind: "reference",
|
|
10975
|
+
path: pathOf5(e.evidence.file),
|
|
10976
|
+
line: e.evidence.span.start.line,
|
|
10977
|
+
function: fnEnd(rd, e.from),
|
|
10978
|
+
expression: [e.exit.name, e.exit.member].filter(Boolean).join("."),
|
|
10979
|
+
evidence: e.evidence
|
|
10980
|
+
})
|
|
10981
|
+
});
|
|
10982
|
+
}
|
|
10983
|
+
for (const g of groups2.values()) g.calls.sort(byPosition2);
|
|
10984
|
+
return [...groups2.entries()].sort(([ka, a], [kb, b]) => b.calls.length - a.calls.length || cmp7(ka, kb));
|
|
10985
|
+
};
|
|
10919
10986
|
const pkgName = (id) => {
|
|
10920
10987
|
const p = reader.fact(id);
|
|
10921
10988
|
return p?.type === "ExternalPackage" ? p.name : id;
|
|
10922
10989
|
};
|
|
10923
|
-
const all2 =
|
|
10924
|
-
(
|
|
10990
|
+
const all2 = args.file !== void 0 || meta3.committedRun === null ? grouped() : engine.memo(
|
|
10991
|
+
engine.resolveProject({ project: meta3.project }),
|
|
10992
|
+
reader.run,
|
|
10993
|
+
`exits\0${JSON.stringify([args.package ?? null, args.name ?? null, args.member ?? null, args.source ?? null])}`,
|
|
10994
|
+
grouped
|
|
10925
10995
|
);
|
|
10926
10996
|
let calls = 0;
|
|
10927
10997
|
let refs = 0;
|
|
@@ -10944,7 +11014,7 @@ function listExits(engine, args, cwd) {
|
|
|
10944
11014
|
instance: !!g.exit.instance,
|
|
10945
11015
|
calls: g.calls.length - g.references,
|
|
10946
11016
|
references: g.references,
|
|
10947
|
-
sites: g.calls.
|
|
11017
|
+
sites: g.calls.slice(0, perGroup).map((c) => c.make(reader))
|
|
10948
11018
|
}))
|
|
10949
11019
|
};
|
|
10950
11020
|
}
|
|
@@ -11277,7 +11347,8 @@ function outcomes(reader, file2) {
|
|
|
11277
11347
|
reader,
|
|
11278
11348
|
(f) => f === file2,
|
|
11279
11349
|
reader.facts("CALLS", file2).length,
|
|
11280
|
-
reader.facts("CALLS_CROSS_FILE", file2).length
|
|
11350
|
+
reader.facts("CALLS_CROSS_FILE", file2).length,
|
|
11351
|
+
file2
|
|
11281
11352
|
);
|
|
11282
11353
|
return {
|
|
11283
11354
|
sites: c.sites,
|
|
@@ -11523,7 +11594,13 @@ function listLibraries(engine, args, cwd) {
|
|
|
11523
11594
|
const limit = positive(args.limit, LIBRARIES_MAX, LIBRARIES_MAX, "limit");
|
|
11524
11595
|
const offset = nonNegative(args.offset);
|
|
11525
11596
|
const s = scope(engine, args, cwd);
|
|
11526
|
-
const
|
|
11597
|
+
const tallied = s.run === null ? tallies(engine, s) : engine.memo(
|
|
11598
|
+
engine.resolveProject({ project: s.meta.project }),
|
|
11599
|
+
s.run,
|
|
11600
|
+
`libraries\0${args.source ?? ""}\0${pendingKey(engine.pendingLibraries(s.meta.project, s.run))}`,
|
|
11601
|
+
() => tallies(engine, s)
|
|
11602
|
+
);
|
|
11603
|
+
const packages = [...tallied.values()].map((t) => t.row).sort(byUse);
|
|
11527
11604
|
const kept = new Map(
|
|
11528
11605
|
engine.listSources({ project: s.meta.project }).sources.map((x) => [x.id, x.kept ?? []])
|
|
11529
11606
|
);
|
|
@@ -11613,6 +11690,7 @@ var init_libraries2 = __esm({
|
|
|
11613
11690
|
"packages/query-imports/src/libraries.ts"() {
|
|
11614
11691
|
"use strict";
|
|
11615
11692
|
init_src();
|
|
11693
|
+
init_reads();
|
|
11616
11694
|
init_symbols();
|
|
11617
11695
|
LIBRARIES_MAX = 1e3;
|
|
11618
11696
|
LIBRARY_IMPORTERS_MAX = 1e3;
|
|
@@ -14095,6 +14173,11 @@ function statements(source, path, result2) {
|
|
|
14095
14173
|
const fileId = ids.file(source, path);
|
|
14096
14174
|
const byKey2 = /* @__PURE__ */ new Map();
|
|
14097
14175
|
const formOf = (i) => i.kind === "require" ? "require" : i.kind === "dynamic" ? "dynamic" : i.typeOnly ? "type-only" : "static";
|
|
14176
|
+
const typesOnlyOf = (i) => {
|
|
14177
|
+
if (i.typeOnly) return true;
|
|
14178
|
+
const u = i.uses;
|
|
14179
|
+
return u !== void 0 && u.calls + u.values + u.jsx + u.extends + u.reexports === 0;
|
|
14180
|
+
};
|
|
14098
14181
|
for (const i of result2.imports) {
|
|
14099
14182
|
const key = `${i.span.start.offset}\0${i.specifier}`;
|
|
14100
14183
|
const existing = byKey2.get(key);
|
|
@@ -14105,6 +14188,7 @@ function statements(source, path, result2) {
|
|
|
14105
14188
|
if (existing) {
|
|
14106
14189
|
existing.bindings.push(binding2);
|
|
14107
14190
|
if (existing.form === "type-only" && !i.typeOnly) existing.form = "static";
|
|
14191
|
+
existing.typesOnly &&= typesOnlyOf(i);
|
|
14108
14192
|
continue;
|
|
14109
14193
|
}
|
|
14110
14194
|
byKey2.set(key, {
|
|
@@ -14114,7 +14198,9 @@ function statements(source, path, result2) {
|
|
|
14114
14198
|
specifier: i.specifier,
|
|
14115
14199
|
form: formOf(i),
|
|
14116
14200
|
span: i.span,
|
|
14117
|
-
bindings: [binding2]
|
|
14201
|
+
bindings: [binding2],
|
|
14202
|
+
language: result2.language,
|
|
14203
|
+
typesOnly: typesOnlyOf(i)
|
|
14118
14204
|
});
|
|
14119
14205
|
}
|
|
14120
14206
|
const reexports = (e) => (e.kind === "reexport" || e.kind === "reexport-all") && e.fromSpecifier;
|
|
@@ -14129,6 +14215,7 @@ function statements(source, path, result2) {
|
|
|
14129
14215
|
if (existing) {
|
|
14130
14216
|
existing.bindings.push(binding2);
|
|
14131
14217
|
if (existing.form === "type-only" && !e.typeOnly) existing.form = "re-export";
|
|
14218
|
+
existing.typesOnly &&= e.typeOnly;
|
|
14132
14219
|
} else
|
|
14133
14220
|
byKey2.set(key, {
|
|
14134
14221
|
source,
|
|
@@ -14137,7 +14224,9 @@ function statements(source, path, result2) {
|
|
|
14137
14224
|
specifier,
|
|
14138
14225
|
form: e.typeOnly ? "type-only" : "re-export",
|
|
14139
14226
|
span: e.span,
|
|
14140
|
-
bindings: [binding2]
|
|
14227
|
+
bindings: [binding2],
|
|
14228
|
+
language: result2.language,
|
|
14229
|
+
typesOnly: e.typeOnly
|
|
14141
14230
|
});
|
|
14142
14231
|
}
|
|
14143
14232
|
const list = [...byKey2.values()].sort(
|
|
@@ -14819,6 +14908,29 @@ function resolveImports2(plans, files) {
|
|
|
14819
14908
|
return m;
|
|
14820
14909
|
};
|
|
14821
14910
|
const workspaceOf = new Map(trees.map((t) => [t, t.plan.workspace?.realRoot ?? null]));
|
|
14911
|
+
const typesPackage = (t, s, name) => {
|
|
14912
|
+
if (!s.typesOnly || s.form !== "static" && s.form !== "type-only") return null;
|
|
14913
|
+
if (s.language !== "typescript" && s.language !== "tsx") return null;
|
|
14914
|
+
const types = name.startsWith("@") ? `@types/${name.slice(1).replace("/", "__")}` : `@types/${name}`;
|
|
14915
|
+
const spec = packageJsons(t, s.path).map((p) => declared(p, types)).find((v) => v !== void 0);
|
|
14916
|
+
const m = managerOf(t);
|
|
14917
|
+
const declarers = spec === void 0 && m.hoists ? workspaceDeclarers(t, types) : [];
|
|
14918
|
+
if (spec === void 0 && !declarers.length) return null;
|
|
14919
|
+
const how = s.form === "type-only" ? "is type-only" : "is used only as types";
|
|
14920
|
+
const erased = s.form === "type-only" ? "TypeScript resolves it to the type package and erases it" : "TypeScript would resolve it to the type package and erase it";
|
|
14921
|
+
const where = spec !== void 0 ? `${types} is a declared dependency (${spec})` : `${declarers.join(", ")} declare${declarers.length === 1 ? "s" : ""} ${types}, which ${m.name} hoists into reach`;
|
|
14922
|
+
return {
|
|
14923
|
+
kind: "package",
|
|
14924
|
+
pkg: external(s.source, "npm", name, lockfileVersion(t, s.path, name)),
|
|
14925
|
+
via: "dependency",
|
|
14926
|
+
steps: [
|
|
14927
|
+
{
|
|
14928
|
+
kind: "types",
|
|
14929
|
+
detail: `no package.json up from ${s.path} declares ${name}, but the import ${how} and ${where}: ${erased}`
|
|
14930
|
+
}
|
|
14931
|
+
]
|
|
14932
|
+
};
|
|
14933
|
+
};
|
|
14822
14934
|
const workspaceDeclarers = (t, name) => {
|
|
14823
14935
|
const ws = workspaceOf.get(t);
|
|
14824
14936
|
const out2 = [];
|
|
@@ -15234,7 +15346,8 @@ function resolveImports2(plans, files) {
|
|
|
15234
15346
|
} else {
|
|
15235
15347
|
const declarers = workspaceDeclarers(tree, name);
|
|
15236
15348
|
const m = managerOf(tree);
|
|
15237
|
-
const
|
|
15349
|
+
const types = typesPackage(tree, s, name);
|
|
15350
|
+
const config2 = declarers.length && m.hoists || types ? null : baseUrlMiss(tree, s.path, s.specifier);
|
|
15238
15351
|
target2 = config2 ? {
|
|
15239
15352
|
kind: "unresolved",
|
|
15240
15353
|
outcome: "broken",
|
|
@@ -15256,7 +15369,7 @@ function resolveImports2(plans, files) {
|
|
|
15256
15369
|
detail: `${name} isn't declared by a package.json up from ${s.path}; ${declarers.join(", ")} declare${declarers.length === 1 ? "s" : ""} it, and ${m.name} hoists it into reach`
|
|
15257
15370
|
}
|
|
15258
15371
|
]
|
|
15259
|
-
} : declarers.length ? {
|
|
15372
|
+
} : types ? types : declarers.length ? {
|
|
15260
15373
|
kind: "unresolved",
|
|
15261
15374
|
outcome: "broken",
|
|
15262
15375
|
reason: "undeclared-dependency",
|
|
@@ -21830,6 +21943,8 @@ function typedResolutions(input2, graph, s) {
|
|
|
21830
21943
|
let a = member !== null ? answer(type, member, 0, subject.kind === ts.SyntaxKind.SuperKeyword) : answerCall(call);
|
|
21831
21944
|
const fallback = a.kind === "candidates" ? defaultOf(subject) : void 0;
|
|
21832
21945
|
if (fallback) a = { kind: "default", text: fallback.getText(sf) };
|
|
21946
|
+
const earlier = input2.resolutions.get(base2.id);
|
|
21947
|
+
if (earlier && stoppedAtValue(earlier) && a.kind !== "runtime") continue;
|
|
21833
21948
|
const at = declOf(type.getSymbol()?.declarations?.[0]);
|
|
21834
21949
|
const where = at ? ` (${at.file.slice(at.file.indexOf(":") + 1)})` : "";
|
|
21835
21950
|
const typed = { kind: "type", detail: `${written2} is ${typeName}${where}` };
|
|
@@ -21919,9 +22034,13 @@ function typedResolutions(input2, graph, s) {
|
|
|
21919
22034
|
function wanted(site, existing) {
|
|
21920
22035
|
if (site.reason === "dynamic-dispatch") return !existing;
|
|
21921
22036
|
if (site.reason !== "imported-symbol" || !existing) return false;
|
|
22037
|
+
if (stoppedAtValue(existing)) return true;
|
|
21922
22038
|
const last = existing.steps.at(-1);
|
|
21923
22039
|
return existing.status === "unresolved" && existing.importOutcome === null && !existing.candidates && last?.kind === "member" && last.detail.includes(` ${MEMBER_OF_FUNCTION} `);
|
|
21924
22040
|
}
|
|
22041
|
+
function stoppedAtValue(existing) {
|
|
22042
|
+
return existing.status === "unresolved" && existing.importOutcome === null && !existing.candidates && existing.steps.at(-1)?.kind === "not-a-function";
|
|
22043
|
+
}
|
|
21925
22044
|
function plural2(n2, one, many = `${one}s`) {
|
|
21926
22045
|
return `${n2} ${n2 === 1 ? one : many}`;
|
|
21927
22046
|
}
|
|
@@ -22508,7 +22627,7 @@ var init_src8 = __esm({
|
|
|
22508
22627
|
symbolsScope = (fileId) => `${STAGE23}:symbols:${fileId}`;
|
|
22509
22628
|
groupSource = (groupId) => groupId.split("|")[1];
|
|
22510
22629
|
STEPS = 5;
|
|
22511
|
-
STAGE2_VERSION =
|
|
22630
|
+
STAGE2_VERSION = 8;
|
|
22512
22631
|
stage2 = createStage2();
|
|
22513
22632
|
}
|
|
22514
22633
|
});
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|