@cplieger/deadset-ts 7.0.0-dev.1 → 7.0.0-dev.3

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 (113) hide show
  1. package/dist/src/analysis.js +95 -60
  2. package/dist/src/augmentations.js +14 -12
  3. package/dist/src/component-layer.js +1 -1
  4. package/dist/src/components.js +62 -20
  5. package/dist/src/configuration-files.js +230 -30
  6. package/dist/src/conformance-record.js +1 -1
  7. package/dist/src/contextual-uses.js +104 -13
  8. package/dist/src/convention-rows.js +10 -0
  9. package/dist/src/conventions.js +35 -1
  10. package/dist/src/dependencies.js +90 -32
  11. package/dist/src/discover.js +1 -1
  12. package/dist/src/edges.js +1 -1
  13. package/dist/src/element-access.js +341 -0
  14. package/dist/src/erased-stores.js +317 -0
  15. package/dist/src/exempt-classes.js +9 -22
  16. package/dist/src/exempt.js +3 -15
  17. package/dist/src/findings/completion.js +78 -16
  18. package/dist/src/findings/dependencies-and-module-machinery.js +1 -1
  19. package/dist/src/findings/emitters.js +1 -5
  20. package/dist/src/findings/self-check.js +27 -10
  21. package/dist/src/findings-pass.js +6 -5
  22. package/dist/src/in-operands.js +30 -0
  23. package/dist/src/indexed-access.js +264 -119
  24. package/dist/src/intra-function-parts.js +25 -11
  25. package/dist/src/inventory.js +28 -12
  26. package/dist/src/keyof-comparisons.js +170 -0
  27. package/dist/src/kinds.js +17 -7
  28. package/dist/src/manifest.js +6 -16
  29. package/dist/src/matrix.js +20 -2
  30. package/dist/src/query.js +3 -0
  31. package/dist/src/references.js +14 -3
  32. package/dist/src/report.js +4 -1
  33. package/dist/src/reporters/sarif.js +4 -0
  34. package/dist/src/roots.js +0 -1
  35. package/dist/src/run.js +0 -2
  36. package/dist/src/schema.js +1 -1
  37. package/dist/src/scope.js +2 -2
  38. package/dist/src/serialization-contract.js +43 -14
  39. package/dist/src/session.js +12 -8
  40. package/dist/src/suppress-file.js +58 -6
  41. package/dist/src/suppress-inline.js +14 -5
  42. package/dist/src/suppress.js +64 -35
  43. package/dist/src/unimplemented-callees.js +312 -0
  44. package/dist/src/value-reach.js +7 -7
  45. package/dist/src/verbs/analyze.js +11 -9
  46. package/dist/src/workspace-programs.js +0 -3
  47. package/dist/src/workspace-resolution.js +0 -2
  48. package/dist/src/workspace.js +0 -3
  49. package/jsr.json +1 -1
  50. package/package.json +3 -2
  51. package/src/analysis.ts +145 -82
  52. package/src/augmentations.ts +14 -11
  53. package/src/calls.ts +3 -3
  54. package/src/component-files.ts +7 -7
  55. package/src/component-layer.ts +2 -2
  56. package/src/components.ts +104 -22
  57. package/src/config.ts +4 -4
  58. package/src/configuration-files.ts +250 -31
  59. package/src/conformance-record.ts +1 -1
  60. package/src/contextual-uses.ts +135 -17
  61. package/src/convention-rows.ts +23 -0
  62. package/src/conventions.ts +53 -1
  63. package/src/dependencies.ts +119 -38
  64. package/src/discover.ts +3 -3
  65. package/src/edges.ts +3 -3
  66. package/src/element-access.ts +446 -0
  67. package/src/entry-points.ts +1 -1
  68. package/src/erased-stores.ts +413 -0
  69. package/src/exempt-classes.ts +10 -24
  70. package/src/exempt.ts +5 -29
  71. package/src/file-facts.ts +3 -1
  72. package/src/finding.ts +3 -1
  73. package/src/findings/completion.ts +97 -21
  74. package/src/findings/dependencies-and-module-machinery.ts +1 -1
  75. package/src/findings/emitters.ts +4 -9
  76. package/src/findings/self-check.ts +31 -14
  77. package/src/findings-pass.ts +14 -7
  78. package/src/graph.ts +2 -2
  79. package/src/html-entries.ts +1 -1
  80. package/src/in-operands.ts +45 -0
  81. package/src/indexed-access.ts +303 -137
  82. package/src/intra-function-parts.ts +41 -16
  83. package/src/inventory.ts +37 -33
  84. package/src/json-document.ts +1 -1
  85. package/src/keyof-comparisons.ts +211 -0
  86. package/src/kinds.ts +20 -7
  87. package/src/manifest.ts +7 -22
  88. package/src/matrix.ts +34 -2
  89. package/src/namespace-objects.ts +1 -1
  90. package/src/pnpm-workspace.ts +1 -1
  91. package/src/query.ts +10 -0
  92. package/src/references.ts +30 -7
  93. package/src/report.ts +11 -5
  94. package/src/reporters/sarif.ts +4 -0
  95. package/src/roots.ts +0 -3
  96. package/src/run.ts +0 -2
  97. package/src/schema.ts +2 -2
  98. package/src/scope.ts +2 -2
  99. package/src/serialization-contract.ts +53 -14
  100. package/src/session.ts +34 -31
  101. package/src/stores.ts +1 -1
  102. package/src/suppress-file.ts +68 -5
  103. package/src/suppress-inline.ts +17 -7
  104. package/src/suppress.ts +79 -47
  105. package/src/template-field.ts +1 -1
  106. package/src/unimplemented-callees.ts +411 -0
  107. package/src/value-reach.ts +12 -8
  108. package/src/verbs/analyze.ts +15 -9
  109. package/src/verbs/verb.ts +1 -4
  110. package/src/workspace-programs.ts +2 -9
  111. package/src/workspace-resolution.ts +0 -3
  112. package/src/workspace-run.ts +1 -1
  113. package/src/workspace.ts +1 -9
@@ -26,7 +26,7 @@ import { json } from "../reporters/json.ts";
26
26
  import { RENDERINGS } from "../reporters/reporters.ts";
27
27
  import { parseTemplate, TemplateError, type Template } from "../reporters/template.ts";
28
28
  import { resolve } from "../resolve.ts";
29
- import { rowReason, writeBaseline, type Recorded } from "../suppress-file.ts";
29
+ import { otherSchemeRows, rowReason, writeBaseline, type Recorded } from "../suppress-file.ts";
30
30
  import { CONTRACT_VERSION } from "../version.ts";
31
31
  import { EXIT_CLEAN, EXIT_FAILURE, type Verb, type VerbOptions } from "./verb.ts";
32
32
 
@@ -174,13 +174,12 @@ interface Documents {
174
174
  }
175
175
 
176
176
  /**
177
- * Analyzes the scope under the configuration and writes the JSON report to the path
178
- * `--report` names, each rendering `--format` names beside it at the report's path with the
179
- * format's suffix appended, and where `--baseline-write` names a path the baseline a fixpoint
180
- * over the analysis records, the report then being its first round, which reads no
181
- * baseline. The template format renders the template `--template` names. Nothing is written to
182
- * the output stream; diagnostics go to the error stream and the verdict is the exit code, or 0
183
- * under `--exit-code=off`, and a rendering that cannot be written ends the run with 3.
177
+ * Analyzes the scope and writes the JSON report to the path `--report` names, each
178
+ * `--format` rendering beside it with the format's suffix appended, and under
179
+ * `--baseline-write` the baseline a fixpoint over the analysis records, the report being its
180
+ * first round. Diagnostics go to the error stream and nothing to the output stream; the
181
+ * verdict is the exit code, or 0 under `--exit-code=off`, and a rendering that cannot be
182
+ * written ends the run with 3.
184
183
  */
185
184
  export const analyzeVerb: Verb = ({ err, host, inputs, scope, openClient, option, repeated }) => {
186
185
  const reportPath = option("report");
@@ -304,7 +303,14 @@ export const analyzeVerb: Verb = ({ err, host, inputs, scope, openClient, option
304
303
  }
305
304
  }
306
305
  if (documents.baseline !== undefined) {
307
- host.writeDocument(documents.baseline, writeBaseline(recorded, analyzerProvenance(version)));
306
+ const kept =
307
+ host.kindOf(documents.baseline) === "file"
308
+ ? otherSchemeRows(host.readFile(documents.baseline))
309
+ : [];
310
+ host.writeDocument(
311
+ documents.baseline,
312
+ writeBaseline(recorded, analyzerProvenance(version), kept),
313
+ );
308
314
  }
309
315
  } catch (error: unknown) {
310
316
  err.write(`deadset-ts: ${error instanceof Error ? error.message : String(error)}\n`);
package/src/verbs/verb.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import type { Config, Inputs } from "../config.ts";
2
- import type { Emitters } from "../findings/emitter.ts";
3
2
  import type { Host } from "../host.ts";
4
3
  import type { Writer } from "../run.ts";
5
4
  import type { Scope } from "../scope.ts";
@@ -16,7 +15,7 @@ export const EXIT_FAILURE = 3;
16
15
  * options that follow its name, read only when the verb asks for what they name, so
17
16
  * a verb that asks for nothing refuses no option.
18
17
  */
19
- export interface Invocation {
18
+ interface Invocation {
20
19
  readonly out: Writer;
21
20
  readonly err: Writer;
22
21
  readonly host: Host;
@@ -29,8 +28,6 @@ export interface Invocation {
29
28
  * closed if the verb throws.
30
29
  */
31
30
  readonly openClient: (config: Config) => Engine;
32
- /** The emitter of every kind family, which a verb that reports findings runs. */
33
- readonly emitters: Emitters;
34
31
  /** The arguments after the verb's name, as written. */
35
32
  readonly args: readonly string[];
36
33
  /** The last value one of the verb's own options was given, undefined where none was. */
@@ -22,12 +22,10 @@ import type { Engine } from "./session.ts";
22
22
  import type { WorkspaceResolver } from "./workspace-resolution.ts";
23
23
 
24
24
  /** One member import no member source answers for. */
25
- export interface UnresolvedImport {
25
+ interface UnresolvedImport {
26
26
  /** The importing file, absolute. */
27
27
  readonly file: string;
28
28
  readonly specifier: string;
29
- readonly member: string;
30
- readonly subpath: string;
31
29
  readonly reason: string;
32
30
  }
33
31
 
@@ -36,8 +34,6 @@ export interface MemberReading {
36
34
  readonly configFile: string;
37
35
  /** The files the configuration itself compiles, absolute. */
38
36
  readonly fileNames: readonly string[];
39
- /** The static resolutions its program is built with; none for a configuration opened as a project. */
40
- readonly entries: readonly ModuleResolutionEntry[];
41
37
  readonly unresolved: readonly UnresolvedImport[];
42
38
  /**
43
39
  * Why the configuration's component files are not read, where the snapshots read
@@ -53,7 +49,7 @@ export type WorkspaceProgram =
53
49
  | { readonly kind: "configuration"; readonly file: string; readonly text: string };
54
50
 
55
51
  /** The programs one run builds instead of opening projects, with what reading them did. */
56
- export interface WorkspacePrograms {
52
+ interface WorkspacePrograms {
57
53
  /** Per configuration that imports a member, how the snapshot reads it. */
58
54
  readonly programs: ReadonlyMap<string, WorkspaceProgram>;
59
55
  readonly readings: readonly MemberReading[];
@@ -320,8 +316,6 @@ function scan(
320
316
  reading.unresolved.push({
321
317
  file: usage.file,
322
318
  specifier,
323
- member: answer.member,
324
- subpath: answer.subpath,
325
319
  reason: answer.reason,
326
320
  });
327
321
  }
@@ -449,7 +443,6 @@ export function workspacePrograms(
449
443
  readings: readings.map((reading) => ({
450
444
  configFile: reading.configFile,
451
445
  fileNames: reading.parsed.fileNames,
452
- entries: reading.entries,
453
446
  unresolved: reading.unresolved,
454
447
  componentsUnread: unread.get(reading.configFile),
455
448
  })),
@@ -30,7 +30,6 @@ export type MemberResolution =
30
30
  | {
31
31
  readonly kind: "unresolved";
32
32
  readonly member: string;
33
- readonly subpath: string;
34
33
  readonly reason: string;
35
34
  };
36
35
 
@@ -343,7 +342,6 @@ export function workspaceResolver(host: Host, workspace: Workspace): WorkspaceRe
343
342
  return {
344
343
  kind: "unresolved",
345
344
  member: name,
346
- subpath,
347
345
  reason: `${String(linked.dirs.length)} workspace packages are named ${name} (${linked.dirs.join(", ")}) and nothing links the importer to one of them; install the workspace, or declare the dependency with a range only one of them satisfies`,
348
346
  };
349
347
  }
@@ -381,7 +379,6 @@ export function workspaceResolver(host: Host, workspace: Workspace): WorkspaceRe
381
379
  return {
382
380
  kind: "unresolved",
383
381
  member: name,
384
- subpath,
385
382
  reason: built
386
383
  ? `its manifest names ${named}, output no tsconfig*.json of the package maps back to source, and nothing installed links the importer to it; install the workspace, or point an exports condition the importing configuration's customConditions lists at its source`
387
384
  : member.configurations.length === 0
@@ -20,7 +20,7 @@ import {
20
20
  import { workspaceResolver } from "./workspace-resolution.ts";
21
21
 
22
22
  /** One run's workspace. */
23
- export interface WorkspaceRun {
23
+ interface WorkspaceRun {
24
24
  /** Per configuration that imports a member, how the snapshot reads it. */
25
25
  readonly programs: ReadonlyMap<string, WorkspaceProgram>;
26
26
  /**
package/src/workspace.ts CHANGED
@@ -24,8 +24,7 @@ export interface ParsedLayout {
24
24
  }
25
25
 
26
26
  /** One compiler configuration in a member's directory. */
27
- export interface MemberConfiguration {
28
- readonly configFile: string;
27
+ interface MemberConfiguration {
29
28
  /** The files it compiles, absolute. */
30
29
  readonly fileNames: ReadonlySet<string>;
31
30
  /** Where it writes its output, where it writes any. */
@@ -46,10 +45,6 @@ export interface WorkspaceMember {
46
45
 
47
46
  /** The workspace one target sits in. */
48
47
  export interface Workspace {
49
- /** The directory that declares it. */
50
- readonly root: string;
51
- /** The file that declares it. */
52
- readonly declaredIn: string;
53
48
  /** Every member, the root first, then by directory. */
54
49
  readonly members: readonly WorkspaceMember[];
55
50
  /** The members one package name names; two members may share a name. */
@@ -336,7 +331,6 @@ function configurationsOf(
336
331
  ? []
337
332
  : [
338
333
  {
339
- configFile,
340
334
  fileNames: new Set(parsed.fileNames),
341
335
  layout: layoutOf(configFile, parsed),
342
336
  },
@@ -439,8 +433,6 @@ export function findWorkspace(
439
433
  return found;
440
434
  };
441
435
  return {
442
- root: declared.root,
443
- declaredIn: declared.file,
444
436
  members,
445
437
  named,
446
438
  memberOf: (path) => {