supercov 0.0.44 → 0.0.45

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.
Files changed (37) hide show
  1. package/README.md +21 -12
  2. package/docs/agent-loop.md +12 -8
  3. package/docs/assertion-agent.md +156 -0
  4. package/docs/assertion-evidence.md +9 -694
  5. package/docs/assertion-maps.md +252 -0
  6. package/docs/assertions.md +82 -0
  7. package/docs/cli.md +23 -8
  8. package/docs/coverage-model.md +12 -0
  9. package/package.json +34 -35
  10. package/runtime/javascript/runtime.mjs +18 -33
  11. package/schemas/assertions.schema.json +276 -0
  12. package/analyzers/typescript/README.md +0 -59
  13. package/analyzers/typescript/bin/compiler-identity.mjs +0 -78
  14. package/analyzers/typescript/bin/identity.mjs +0 -71
  15. package/analyzers/typescript/bin/query.mjs +0 -29
  16. package/analyzers/typescript/dist/analyze.js +0 -5273
  17. package/analyzers/typescript/dist/archive.js +0 -337
  18. package/analyzers/typescript/dist/awaited-observations.js +0 -376
  19. package/analyzers/typescript/dist/build-identity.json +0 -1
  20. package/analyzers/typescript/dist/compiler.js +0 -32
  21. package/analyzers/typescript/dist/frontend.js +0 -75
  22. package/analyzers/typescript/dist/mock-counts.js +0 -2517
  23. package/analyzers/typescript/dist/native-frontend.js +0 -271
  24. package/analyzers/typescript/dist/pragmas.js +0 -186
  25. package/analyzers/typescript/dist/types.js +0 -1
  26. package/analyzers/typescript/package.json +0 -27
  27. package/analyzers/typescript/src/analyze.ts +0 -6180
  28. package/analyzers/typescript/src/archive.ts +0 -471
  29. package/analyzers/typescript/src/awaited-observations.ts +0 -561
  30. package/analyzers/typescript/src/compiler.ts +0 -49
  31. package/analyzers/typescript/src/frontend.ts +0 -136
  32. package/analyzers/typescript/src/mock-counts.ts +0 -3219
  33. package/analyzers/typescript/src/native-frontend.ts +0 -315
  34. package/analyzers/typescript/src/pragmas.ts +0 -284
  35. package/analyzers/typescript/src/types.ts +0 -45
  36. package/analyzers/typescript/tsconfig.json +0 -12
  37. package/docs/code-verification.md +0 -4
@@ -1,136 +0,0 @@
1
- /** Compiler-specific work stays here; assertion/flow rules do not select a compiler. */
2
- import type ts from "typescript";
3
- import { existsSync, readdirSync } from "node:fs";
4
- import { dirname, resolve } from "node:path";
5
- import { createRequire } from "node:module";
6
- import { pathToFileURL } from "node:url";
7
- import {
8
- analysisPath,
9
- loadProjectCompiler,
10
- projectCompilerPath,
11
- } from "./compiler.js";
12
- import { nativeFrontend } from "./native-frontend.js";
13
- import type { AnalyzeOptions } from "./types.js";
14
-
15
- // Only syntax predicates, traversal, comments and enums cross this boundary.
16
- // Program creation, resolution and symbol handles have separate adapters.
17
- export type SyntaxAPI = Pick<
18
- typeof ts,
19
- | Extract<keyof typeof ts, `is${string}`>
20
- | "SyntaxKind"
21
- | "NodeFlags"
22
- | "SymbolFlags"
23
- | "forEachChild"
24
- | "canHaveModifiers"
25
- | "getModifiers"
26
- | "getLeadingCommentRanges"
27
- | "getTrailingCommentRanges"
28
- >;
29
- export type CheckerAPI = Pick<
30
- ts.TypeChecker,
31
- | "getSymbolAtLocation"
32
- | "getShorthandAssignmentValueSymbol"
33
- | "getAliasedSymbol"
34
- | "getResolvedSignature"
35
- >;
36
- export interface AnalysisProgram {
37
- files: ts.SourceFile[];
38
- checker: CheckerAPI;
39
- resolveModule(specifier: string, from: string): string | undefined;
40
- }
41
- export interface CompilerFrontend {
42
- kind: "typescript-legacy" | "typescript-native-7";
43
- version: string;
44
- syntax: SyntaxAPI;
45
- limitations: Set<string>;
46
- openProgram(options: AnalyzeOptions): AnalysisProgram;
47
- parseSource(file: string, text: string): ts.SourceFile;
48
- close(): void;
49
- }
50
-
51
- export function selectedRootFiles(
52
- options: AnalyzeOptions,
53
- configured: string[],
54
- ): string[] {
55
- const root = analysisPath(options.projectRoot);
56
- if (options.sourceFiles)
57
- return [...options.sourceFiles, ...(options.testFiles ?? [])].map((f) =>
58
- resolve(root, f),
59
- );
60
- if (!options.sourceDir) return configured;
61
- function walk(dir: string): string[] {
62
- if (!existsSync(dir)) return [];
63
- return readdirSync(dir, { withFileTypes: true }).flatMap((e) => {
64
- if (e.name === "node_modules" || e.name.startsWith(".")) return [];
65
- const file = resolve(dir, e.name);
66
- return e.isDirectory()
67
- ? walk(file)
68
- : /\.(ts|tsx|mts)$/.test(e.name) && !e.name.endsWith(".d.ts")
69
- ? [file]
70
- : [];
71
- });
72
- }
73
- return [
74
- ...walk(resolve(root, options.sourceDir)),
75
- ...walk(resolve(root, options.testDir ?? "tests")),
76
- ...(existsSync(resolve(root, "env.d.ts"))
77
- ? [resolve(root, "env.d.ts")]
78
- : []),
79
- ];
80
- }
81
-
82
- function legacyFrontend(compiler: typeof ts): CompilerFrontend {
83
- return {
84
- kind: "typescript-legacy",
85
- version: compiler.version,
86
- syntax: compiler,
87
- limitations: new Set(),
88
- close() {},
89
- openProgram(options) {
90
- const root = analysisPath(options.projectRoot);
91
- const configPath = resolve(root, options.tsconfig ?? "tsconfig.json");
92
- const cfg =
93
- options.sourceFiles && !existsSync(configPath)
94
- ? { config: { compilerOptions: { allowJs: true, checkJs: true } } }
95
- : compiler.readConfigFile(configPath, compiler.sys.readFile);
96
- if (cfg.error)
97
- throw new Error(
98
- compiler.flattenDiagnosticMessageText(cfg.error.messageText, "\n"),
99
- );
100
- const parsed = compiler.parseJsonConfigFileContent(
101
- cfg.config,
102
- compiler.sys,
103
- dirname(configPath),
104
- );
105
- const program = compiler.createProgram(
106
- selectedRootFiles(options, parsed.fileNames),
107
- {
108
- ...parsed.options,
109
- ...(options.sourceFiles ? { allowJs: true, checkJs: true } : {}),
110
- noEmit: true,
111
- },
112
- );
113
- return {
114
- files: program.getSourceFiles() as ts.SourceFile[],
115
- checker: program.getTypeChecker(),
116
- resolveModule: (spec, from) =>
117
- compiler.resolveModuleName(spec, from, parsed.options, compiler.sys)
118
- .resolvedModule?.resolvedFileName,
119
- };
120
- },
121
- parseSource: (file, text) =>
122
- compiler.createSourceFile(file, text, compiler.ScriptTarget.Latest, true),
123
- };
124
- }
125
-
126
- export function createFrontend(
127
- root: string,
128
- supplied?: typeof ts,
129
- ): CompilerFrontend {
130
- if (supplied) return legacyFrontend(supplied);
131
- const entry = projectCompilerPath(root);
132
- const require = createRequire(pathToFileURL(entry));
133
- const version = require(entry).version;
134
- if (version === "7.0.2") return nativeFrontend(entry, root);
135
- return legacyFrontend(loadProjectCompiler(root));
136
- }