@cplieger/deadset-ts 8.0.0-dev.7 → 8.0.0-dev.9
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/bin/node-host.js +21 -3
- package/dist/src/analysis.js +94 -299
- package/dist/src/config.js +6 -83
- package/dist/src/configuration-files.js +2 -9
- package/dist/src/configured-declarations.js +15 -20
- package/dist/src/consumers.js +3 -30
- package/dist/src/contract/config.generated.js +544 -0
- package/dist/src/contract/contract.generated.js +20 -10
- package/dist/src/contract/report.generated.js +3 -2
- package/dist/src/conventions.js +3 -8
- package/dist/src/edges.js +36 -112
- package/dist/src/exempt-classes.js +0 -2
- package/dist/src/exempt.js +1 -1
- package/dist/src/failure.js +36 -0
- package/dist/src/findings/completion.js +5 -4
- package/dist/src/findings/emitters.js +1 -1
- package/dist/src/findings/intra-function.js +1 -1
- package/dist/src/findings/non-code-artifacts.js +2 -2
- package/dist/src/findings/unused-declarations.js +1 -1
- package/dist/src/findings/visibility-narrowing.js +2 -2
- package/dist/src/findings-pass.js +1 -1
- package/dist/src/framework-lifecycle.js +7 -7
- package/dist/src/fs/document.js +52 -0
- package/dist/src/fs/manifest.js +7 -0
- package/dist/src/injection-container.js +1 -1
- package/dist/src/json-document.js +194 -67
- package/dist/src/kinds.js +0 -7
- package/dist/src/load/classify.js +236 -0
- package/dist/src/load/diagnostics.js +79 -0
- package/dist/src/load/discover.js +230 -0
- package/dist/src/{emit-map.js → load/emit-map.js} +1 -1
- package/dist/src/load/expected-module.js +136 -0
- package/dist/src/load/load.js +22 -0
- package/dist/src/load/module-lookup.js +37 -0
- package/dist/src/load/plan.js +155 -0
- package/dist/src/{test-globals.js → load/test-globals.js} +51 -56
- package/dist/src/load/test-joins.js +82 -0
- package/dist/src/{workspace-manifests.js → load/workspace-manifests.js} +3 -3
- package/dist/src/{workspace-programs.js → load/workspace-programs.js} +37 -40
- package/dist/src/{workspace-resolution.js → load/workspace-resolution.js} +21 -59
- package/dist/src/{workspace-run.js → load/workspace-run.js} +4 -3
- package/dist/src/{workspace.js → load/workspace.js} +21 -17
- package/dist/src/outside-tests.js +1 -1
- package/dist/src/print.js +10 -79
- package/dist/src/report-schema.js +3 -224
- package/dist/src/resolve.js +245 -715
- package/dist/src/run.js +59 -72
- package/dist/src/schema.js +320 -344
- package/dist/src/scope.js +37 -113
- package/dist/src/serialization-contract.js +1 -1
- package/dist/src/session.js +22 -28
- package/dist/src/source-files.js +1 -1
- package/dist/src/suppress-file.js +15 -17
- package/dist/src/suppress.js +3 -3
- package/dist/src/template-field.js +4 -4
- package/dist/src/type-errors.js +11 -216
- package/dist/src/usage.js +10 -0
- package/dist/src/verbs/analyze.js +100 -122
- package/dist/src/verbs/describe.js +5 -12
- package/dist/src/verbs/explain.js +3 -3
- package/dist/src/verbs/print-projects.js +2 -2
- package/dist/src/verbs/version.js +12 -2
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/analysis.ts +95 -460
- package/src/config.ts +31 -298
- package/src/configuration-files.ts +8 -10
- package/src/configured-declarations.ts +18 -23
- package/src/consumers.ts +6 -57
- package/src/contract/config.generated.ts +798 -0
- package/src/contract/contract.generated.ts +20 -10
- package/src/contract/report.generated.ts +3 -2
- package/src/conventions.ts +6 -12
- package/src/edges.ts +39 -124
- package/src/exempt-classes.ts +0 -5
- package/src/exempt.ts +4 -4
- package/src/failure.ts +63 -0
- package/src/findings/completion.ts +5 -6
- package/src/findings/emitter.ts +2 -2
- package/src/findings/emitters.ts +1 -1
- package/src/findings/intra-function.ts +1 -1
- package/src/findings/non-code-artifacts.ts +4 -4
- package/src/findings/unused-declarations.ts +1 -1
- package/src/findings/visibility-narrowing.ts +2 -2
- package/src/findings-pass.ts +3 -3
- package/src/framework-lifecycle.ts +7 -7
- package/src/fs/document.ts +70 -0
- package/src/fs/manifest.ts +8 -0
- package/src/host.ts +12 -5
- package/src/injection-container.ts +1 -1
- package/src/json-document.ts +236 -76
- package/src/kinds.ts +0 -8
- package/src/load/classify.ts +352 -0
- package/src/load/diagnostics.ts +141 -0
- package/src/load/discover.ts +378 -0
- package/src/{emit-map.ts → load/emit-map.ts} +1 -1
- package/src/load/expected-module.ts +188 -0
- package/src/load/load.ts +61 -0
- package/src/load/module-lookup.ts +50 -0
- package/src/load/plan.ts +258 -0
- package/src/{test-globals.ts → load/test-globals.ts} +59 -65
- package/src/load/test-joins.ts +98 -0
- package/src/{workspace-manifests.ts → load/workspace-manifests.ts} +4 -4
- package/src/{workspace-programs.ts → load/workspace-programs.ts} +59 -53
- package/src/{workspace-resolution.ts → load/workspace-resolution.ts} +31 -78
- package/src/{workspace-run.ts → load/workspace-run.ts} +14 -11
- package/src/{workspace.ts → load/workspace.ts} +28 -21
- package/src/outside-tests.ts +1 -1
- package/src/partial.ts +1 -1
- package/src/print.ts +11 -92
- package/src/report-schema.ts +3 -299
- package/src/resolve.ts +281 -1105
- package/src/run.ts +68 -80
- package/src/schema.ts +391 -389
- package/src/scope.ts +45 -131
- package/src/serialization-contract.ts +1 -1
- package/src/session.ts +52 -53
- package/src/source-files.ts +1 -1
- package/src/suppress-file.ts +15 -20
- package/src/suppress.ts +3 -3
- package/src/template-field.ts +10 -7
- package/src/type-errors.ts +18 -288
- package/src/usage.ts +10 -0
- package/src/verbs/analyze.ts +139 -157
- package/src/verbs/describe.ts +4 -11
- package/src/verbs/explain.ts +3 -7
- package/src/verbs/print-projects.ts +2 -2
- package/src/verbs/verb.ts +2 -2
- package/src/verbs/version.ts +13 -2
- package/dist/src/base-url.js +0 -18
- package/dist/src/discover.js +0 -374
- package/dist/src/setup-failure.js +0 -19
- package/dist/src/test-joins.js +0 -101
- package/src/base-url.ts +0 -24
- package/src/discover.ts +0 -548
- package/src/setup-failure.ts +0 -37
- package/src/test-joins.ts +0 -118
package/src/test-joins.ts
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The test files a derived matrix holds although no configuration's file list names them.
|
|
3
|
-
* The test runner compiles such a file with the options of the nearest compiler
|
|
4
|
-
* configuration at or above it, so the file joins that configuration's program as a file
|
|
5
|
-
* its list names, unless a `package.json` below that configuration's directory makes the
|
|
6
|
-
* file another package's, which its own test runner compiles.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import { sourcePaths } from "./file-facts.ts";
|
|
10
|
-
import type { Host } from "./host.ts";
|
|
11
|
-
import { ancestors, dirnamePath, joinPath } from "./paths.ts";
|
|
12
|
-
import type { Engine } from "./session.ts";
|
|
13
|
-
import { writtenPath, type WorkspaceProgram } from "./workspace-programs.ts";
|
|
14
|
-
import { bytewise } from "./text/compare.ts";
|
|
15
|
-
import { holdsManifest } from "./fs/manifest.ts";
|
|
16
|
-
|
|
17
|
-
const PREFERRED = "/tsconfig.json";
|
|
18
|
-
|
|
19
|
-
/** The configurations of one directory in the order a file joins them: `tsconfig.json` first. */
|
|
20
|
-
function byPreference(a: string, b: string): number {
|
|
21
|
-
const first = a.endsWith(PREFERRED) ? 0 : 1;
|
|
22
|
-
const second = b.endsWith(PREFERRED) ? 0 : 1;
|
|
23
|
-
return first - second || bytewise(a, b);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Per configuration of `configFiles`, the absolute paths of the test files that join it:
|
|
28
|
-
* each file below `root` a pattern of `patterns` names, that no configuration's file list
|
|
29
|
-
* holds, joins the configuration nearest at or above its directory when no `package.json`
|
|
30
|
-
* sits between them. A configuration the compiler cannot read lists nothing and is joined
|
|
31
|
-
* by nothing.
|
|
32
|
-
*/
|
|
33
|
-
export function joinedTestFiles(
|
|
34
|
-
engine: Engine,
|
|
35
|
-
host: Host,
|
|
36
|
-
root: string,
|
|
37
|
-
configFiles: readonly string[],
|
|
38
|
-
patterns: readonly RegExp[],
|
|
39
|
-
): ReadonlyMap<string, readonly string[]> {
|
|
40
|
-
const listed = new Set<string>();
|
|
41
|
-
const byDir = new Map<string, string[]>();
|
|
42
|
-
for (const configFile of configFiles) {
|
|
43
|
-
let fileNames: readonly string[];
|
|
44
|
-
try {
|
|
45
|
-
fileNames = engine.parseConfigFile(configFile).fileNames;
|
|
46
|
-
} catch {
|
|
47
|
-
continue;
|
|
48
|
-
}
|
|
49
|
-
fileNames.forEach((name) => listed.add(name));
|
|
50
|
-
const dir = dirnamePath(configFile);
|
|
51
|
-
byDir.set(dir, [...(byDir.get(dir) ?? []), configFile].sort(byPreference));
|
|
52
|
-
}
|
|
53
|
-
const joins = new Map<string, string[]>();
|
|
54
|
-
for (const path of sourcePaths(host, root)) {
|
|
55
|
-
const file = joinPath(root, path);
|
|
56
|
-
if (listed.has(file) || !patterns.some((pattern) => pattern.test(path))) {
|
|
57
|
-
continue;
|
|
58
|
-
}
|
|
59
|
-
for (const dir of ancestors(dirnamePath(file), root)) {
|
|
60
|
-
const [nearest] = byDir.get(dir) ?? [];
|
|
61
|
-
if (nearest !== undefined) {
|
|
62
|
-
joins.set(nearest, [...(joins.get(nearest) ?? []), file]);
|
|
63
|
-
break;
|
|
64
|
-
}
|
|
65
|
-
if (holdsManifest(host, dir)) {
|
|
66
|
-
break;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
return joins;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* How the snapshot reads each configuration a test file joins: the program `programs`
|
|
75
|
-
* describes with the files added to its root files, or a configuration only the snapshot
|
|
76
|
-
* holds that extends the one `programs` writes, or the configuration itself, and lists
|
|
77
|
-
* every file the configuration lists and the joined ones.
|
|
78
|
-
*/
|
|
79
|
-
export function withJoinedTests(
|
|
80
|
-
engine: Engine,
|
|
81
|
-
host: Host,
|
|
82
|
-
programs: ReadonlyMap<string, WorkspaceProgram>,
|
|
83
|
-
joins: ReadonlyMap<string, readonly string[]>,
|
|
84
|
-
): ReadonlyMap<string, WorkspaceProgram> {
|
|
85
|
-
const found = new Map(programs);
|
|
86
|
-
for (const [configFile, files] of joins) {
|
|
87
|
-
const program = programs.get(configFile);
|
|
88
|
-
if (program?.kind === "program") {
|
|
89
|
-
found.set(configFile, {
|
|
90
|
-
kind: "program",
|
|
91
|
-
params: {
|
|
92
|
-
...program.params,
|
|
93
|
-
rootFiles: [...(program.params.rootFiles ?? []), ...files],
|
|
94
|
-
},
|
|
95
|
-
});
|
|
96
|
-
continue;
|
|
97
|
-
}
|
|
98
|
-
let listed: readonly string[];
|
|
99
|
-
try {
|
|
100
|
-
listed =
|
|
101
|
-
program?.kind === "configuration"
|
|
102
|
-
? engine.parseConfigJson(JSON.parse(program.text), program.file).fileNames
|
|
103
|
-
: engine.parseConfigFile(configFile).fileNames;
|
|
104
|
-
} catch {
|
|
105
|
-
continue;
|
|
106
|
-
}
|
|
107
|
-
const value =
|
|
108
|
-
program?.kind === "configuration"
|
|
109
|
-
? { ...(JSON.parse(program.text) as Record<string, unknown>), files: [...listed, ...files] }
|
|
110
|
-
: { extends: configFile, files: [...listed, ...files] };
|
|
111
|
-
found.set(configFile, {
|
|
112
|
-
kind: "configuration",
|
|
113
|
-
file: program?.kind === "configuration" ? program.file : writtenPath(host, configFile),
|
|
114
|
-
text: `${JSON.stringify({ ...value, include: [] }, null, 2)}\n`,
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
return found;
|
|
118
|
-
}
|