@cplieger/deadset-ts 5.1.1 → 5.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/analysis.js +7 -4
- package/dist/src/config.js +3 -0
- package/dist/src/configuration-files.js +23 -24
- package/dist/src/conformance-record.js +2 -2
- package/dist/src/contextual-uses.js +25 -4
- package/dist/src/convention-rows.js +7 -0
- package/dist/src/conventions.js +97 -33
- package/dist/src/dependencies.js +8 -0
- package/dist/src/entry-point-gaps.js +10 -26
- package/dist/src/entry-points.js +4 -0
- package/dist/src/findings/completion.js +27 -11
- package/dist/src/findings/interfaces.js +2 -6
- package/dist/src/findings/intra-function.js +15 -3
- package/dist/src/findings/unused-declarations.js +5 -6
- package/dist/src/findings/visibility-narrowing.js +6 -1
- package/dist/src/generated-file.js +72 -12
- package/dist/src/graph.js +5 -4
- package/dist/src/html-entries.js +137 -0
- package/dist/src/kinds.js +2 -2
- package/dist/src/manifest.js +5 -1
- package/dist/src/matrix.js +9 -3
- package/dist/src/namespace-objects.js +158 -0
- package/dist/src/partial.js +1 -1
- package/dist/src/references.js +120 -3
- package/dist/src/roots.js +52 -3
- package/dist/src/sweep.js +17 -0
- package/dist/src/test-support.js +35 -23
- package/dist/src/version.js +1 -1
- package/jsr.json +1 -1
- package/package.json +2 -2
- package/src/analysis.ts +12 -5
- package/src/config.ts +3 -0
- package/src/configuration-files.ts +28 -24
- package/src/conformance-record.ts +2 -2
- package/src/contextual-uses.ts +31 -4
- package/src/convention-rows.ts +15 -0
- package/src/conventions.ts +119 -30
- package/src/dependencies.ts +9 -0
- package/src/entry-point-gaps.ts +11 -28
- package/src/entry-points.ts +7 -1
- package/src/exempt.ts +1 -4
- package/src/file-facts.ts +1 -1
- package/src/findings/completion.ts +31 -11
- package/src/findings/interfaces.ts +2 -9
- package/src/findings/intra-function.ts +17 -3
- package/src/findings/unused-declarations.ts +5 -8
- package/src/findings/visibility-narrowing.ts +7 -1
- package/src/generated-file.ts +80 -12
- package/src/graph.ts +5 -4
- package/src/html-entries.ts +170 -0
- package/src/kinds.ts +2 -2
- package/src/manifest.ts +9 -3
- package/src/matrix.ts +21 -3
- package/src/namespace-objects.ts +216 -0
- package/src/partial.ts +1 -1
- package/src/references.ts +161 -3
- package/src/roots.ts +69 -10
- package/src/sweep.ts +19 -0
- package/src/test-support.ts +34 -22
- package/src/version.ts +1 -1
package/src/test-support.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Test-support code:
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* Test-support code: the files only tests reach. A test reaches each one through a chain
|
|
3
|
+
* of references, and every reference to a declaration of one, an import for its effects
|
|
4
|
+
* included, is written in a test file or in another such file, so it is judged with the
|
|
5
|
+
* tests: what it references is referenced by test code.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import type { InventorySymbol } from "./inventory.ts";
|
|
@@ -13,10 +13,11 @@ import type { Root } from "./roots.ts";
|
|
|
13
13
|
const SKIP_ROOT = "type-error";
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
* The files of one project that are test-support code, below the target root
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
16
|
+
* The files of one project that are test-support code, below the target root: the
|
|
17
|
+
* largest set of files a test file reaches, none of them a test file or holding a root,
|
|
18
|
+
* whose every user outside the set is a test file. A root has a caller outside the
|
|
19
|
+
* reference graph: a runtime, a tool, a configuration, or a consumer of a library's
|
|
20
|
+
* published API. `testFiles` are the files the test-file rules classified.
|
|
20
21
|
*/
|
|
21
22
|
export function testSupportFiles(
|
|
22
23
|
symbols: readonly InventorySymbol[],
|
|
@@ -26,34 +27,45 @@ export function testSupportFiles(
|
|
|
26
27
|
): ReadonlySet<string> {
|
|
27
28
|
const fileOf = new Map(symbols.map((symbol) => [symbol.id, symbol.position.path]));
|
|
28
29
|
const users = new Map<string, Set<string>>();
|
|
30
|
+
const uses = new Map<string, Set<string>>();
|
|
31
|
+
const add = (map: Map<string, Set<string>>, key: string, value: string): void => {
|
|
32
|
+
const held = map.get(key);
|
|
33
|
+
if (held === undefined) {
|
|
34
|
+
map.set(key, new Set([value]));
|
|
35
|
+
} else {
|
|
36
|
+
held.add(value);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
29
39
|
for (const reference of references) {
|
|
30
40
|
const used = fileOf.get(reference.to);
|
|
31
41
|
const from = reference.position.path;
|
|
32
42
|
if (reference.consumer !== undefined || used === undefined || used === from) {
|
|
33
43
|
continue;
|
|
34
44
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
users.set(used, new Set([from]));
|
|
38
|
-
} else {
|
|
39
|
-
held.add(from);
|
|
40
|
-
}
|
|
45
|
+
add(users, used, from);
|
|
46
|
+
add(uses, from, used);
|
|
41
47
|
}
|
|
42
48
|
const tests = new Set(testFiles);
|
|
43
49
|
const rooted = new Set(
|
|
44
50
|
roots.filter((root) => root.kind !== SKIP_ROOT).flatMap((root) => fileOf.get(root.id) ?? []),
|
|
45
51
|
);
|
|
46
|
-
const
|
|
47
|
-
const
|
|
52
|
+
const reached = new Set<string>();
|
|
53
|
+
const queue = [...tests];
|
|
54
|
+
for (let path = queue.pop(); path !== undefined; path = queue.pop()) {
|
|
55
|
+
for (const next of uses.get(path) ?? []) {
|
|
56
|
+
if (!reached.has(next) && !tests.has(next)) {
|
|
57
|
+
reached.add(next);
|
|
58
|
+
queue.push(next);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
const support = new Set([...reached].filter((path) => !rooted.has(path)));
|
|
48
63
|
for (let changed = true; changed;) {
|
|
49
64
|
changed = false;
|
|
50
|
-
for (const path of
|
|
51
|
-
if (support.has(path)) {
|
|
52
|
-
continue;
|
|
53
|
-
}
|
|
65
|
+
for (const path of support) {
|
|
54
66
|
const from = users.get(path) ?? new Set<string>();
|
|
55
|
-
if ([...from].every((one) => tests.has(one) || support.has(one))) {
|
|
56
|
-
support.
|
|
67
|
+
if (![...from].every((one) => tests.has(one) || support.has(one))) {
|
|
68
|
+
support.delete(path);
|
|
57
69
|
changed = true;
|
|
58
70
|
}
|
|
59
71
|
}
|
package/src/version.ts
CHANGED