candor-ts 0.7.1 → 0.7.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/package.json +1 -1
- package/query-core.mjs +6 -1
- package/query.mjs +6 -1
package/package.json
CHANGED
package/query-core.mjs
CHANGED
|
@@ -247,8 +247,13 @@ function commonPrefixLen(fns) {
|
|
|
247
247
|
return (best ?? []).length;
|
|
248
248
|
}
|
|
249
249
|
function layerOf(fn, prefixLen) {
|
|
250
|
+
// The layer = the first segment after the common prefix, the leaf excluded. candor-ts names functions
|
|
251
|
+
// with a FILE.fn (free fns) or FILE.Class.method tail — a SHALLOW 1-segment-minimum tail — so the rule is
|
|
252
|
+
// `prefixLen + 1 < length` (matching candor-rust's layer_of). candor-java uses `+2` because its names carry
|
|
253
|
+
// an extra Package.Class.method segment; copying that here collapsed every 2-segment free function to
|
|
254
|
+
// "(root)", killing the dispersion signal on real TS reports.
|
|
250
255
|
const segs = fn.split(".");
|
|
251
|
-
return prefixLen +
|
|
256
|
+
return prefixLen + 1 < segs.length ? segs[prefixLen] : "(root)";
|
|
252
257
|
}
|
|
253
258
|
export function containment(fns, baseFns) {
|
|
254
259
|
const pl = commonPrefixLen(fns);
|
package/query.mjs
CHANGED
|
@@ -89,7 +89,12 @@ switch (cmd) {
|
|
|
89
89
|
// new leak), matching candor-java / candor-query. JSON-only, like every other candor-ts query command.
|
|
90
90
|
const [prefix, basePrefix] = args;
|
|
91
91
|
if (basePrefix) {
|
|
92
|
-
const
|
|
92
|
+
const baseFns = loadReport(basePrefix);
|
|
93
|
+
if (baseFns.length === 0) { // fail CLOSED (exit 2), not a wall of bogus "everything leaked" (exit 1)
|
|
94
|
+
console.error(`candor-ts: no report at baseline prefix '${basePrefix}' — check the path`);
|
|
95
|
+
process.exit(2);
|
|
96
|
+
}
|
|
97
|
+
const r = coreContainment(loadReport(prefix), baseFns);
|
|
93
98
|
emit(r);
|
|
94
99
|
process.exit(r.leaks.length ? 1 : 0);
|
|
95
100
|
}
|