@cplieger/deadset-ts 8.0.0-dev.14 → 8.0.0-dev.16

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 (149) hide show
  1. package/dist/src/alias-chain.js +2 -2
  2. package/dist/src/analysis.js +43 -38
  3. package/dist/src/commands/read.js +6 -7
  4. package/dist/src/conformance-record.js +1 -1
  5. package/dist/src/consumers.js +4 -2
  6. package/dist/src/contract/config.generated.js +1 -1
  7. package/dist/src/contract/contract.generated.js +120 -2
  8. package/dist/src/dependencies.js +81 -49
  9. package/dist/src/entries/build-scripts.js +222 -0
  10. package/dist/src/{configuration-files.js → entries/configuration-files.js} +20 -58
  11. package/dist/src/{convention-rows.js → entries/convention-rows.js} +120 -27
  12. package/dist/src/entries/conventions.js +739 -0
  13. package/dist/src/{html-entries.js → entries/html-entries.js} +3 -3
  14. package/dist/src/{mdx-entries.js → entries/mdx-entries.js} +2 -2
  15. package/dist/src/entries/run-directories.js +77 -0
  16. package/dist/src/entries/sources.js +144 -0
  17. package/dist/src/entries/static-module.js +669 -0
  18. package/dist/src/entries/test-runners.js +684 -0
  19. package/dist/src/{workflow-steps.js → entries/workflow-steps.js} +18 -8
  20. package/dist/src/extensions.js +37 -0
  21. package/dist/src/facts.js +38 -0
  22. package/dist/src/file-facts.js +1 -1
  23. package/dist/src/findings/emitters.js +5 -8
  24. package/dist/src/findings/self-check.js +36 -20
  25. package/dist/src/findings-pass.js +5 -6
  26. package/dist/src/framework-lifecycle.js +1 -1
  27. package/dist/src/fs/manifest.js +15 -20
  28. package/dist/src/generated-file.js +172 -29
  29. package/dist/src/graph.js +2 -5
  30. package/dist/src/index.js +1 -1
  31. package/dist/src/injection-container.js +1 -1
  32. package/dist/src/inventory/commonjs.js +507 -0
  33. package/dist/src/inventory/enumerate.js +167 -0
  34. package/dist/src/inventory/syntax.js +236 -0
  35. package/dist/src/inventory.js +305 -705
  36. package/dist/src/javascript-file.js +26 -11
  37. package/dist/src/load/classify.js +28 -9
  38. package/dist/src/load/diagnostics.js +8 -1
  39. package/dist/src/load/discover.js +16 -8
  40. package/dist/src/load/package-scope.js +56 -0
  41. package/dist/src/load/plan.js +2 -2
  42. package/dist/src/load/synthesize.js +5 -5
  43. package/dist/src/load/workspace-manifests.js +1 -1
  44. package/dist/src/matrix.js +6 -13
  45. package/dist/src/outside-tests.js +1 -1
  46. package/dist/src/paths.js +16 -0
  47. package/dist/src/platform-calls.js +78 -0
  48. package/dist/src/platform-symbols.js +140 -0
  49. package/dist/src/position.js +41 -0
  50. package/dist/src/ref.js +11 -20
  51. package/dist/src/references.js +281 -50
  52. package/dist/src/resolve.js +1 -1
  53. package/dist/src/{configured-declarations.js → roots/configured-declarations.js} +4 -4
  54. package/dist/src/{entry-point-gaps.js → roots/entry-point-gaps.js} +5 -8
  55. package/dist/src/{manifest.js → roots/manifest.js} +4 -4
  56. package/dist/src/roots/published-reach.js +412 -0
  57. package/dist/src/roots/root-set.js +489 -0
  58. package/dist/src/roots/unseen-loads.js +208 -0
  59. package/dist/src/serialization-contract.js +1 -1
  60. package/dist/src/session.js +3 -0
  61. package/dist/src/source-files.js +5 -9
  62. package/dist/src/suppress-inline.js +33 -81
  63. package/dist/src/suppress.js +30 -32
  64. package/dist/src/test-support.js +4 -2
  65. package/dist/src/verbs/analyze.js +13 -1
  66. package/dist/src/verbs/describe.js +5 -3
  67. package/jsr.json +1 -1
  68. package/package.json +3 -3
  69. package/src/alias-chain.ts +2 -2
  70. package/src/analysis.ts +77 -53
  71. package/src/automatic-types.ts +1 -1
  72. package/src/commands/read.ts +6 -8
  73. package/src/conformance-record.ts +1 -1
  74. package/src/consumers.ts +5 -1
  75. package/src/contract/config.generated.ts +1 -1
  76. package/src/contract/contract.generated.ts +139 -2
  77. package/src/dependencies.ts +98 -50
  78. package/src/entries/build-scripts.ts +292 -0
  79. package/src/{configuration-files.ts → entries/configuration-files.ts} +23 -75
  80. package/src/{convention-rows.ts → entries/convention-rows.ts} +167 -28
  81. package/src/{conventions.ts → entries/conventions.ts} +347 -522
  82. package/src/{html-entries.ts → entries/html-entries.ts} +5 -5
  83. package/src/{mdx-entries.ts → entries/mdx-entries.ts} +4 -4
  84. package/src/entries/run-directories.ts +108 -0
  85. package/src/entries/sources.ts +266 -0
  86. package/src/entries/static-module.ts +857 -0
  87. package/src/entries/test-runners.ts +868 -0
  88. package/src/{workflow-steps.ts → entries/workflow-steps.ts} +29 -11
  89. package/src/exempt.ts +3 -2
  90. package/src/extensions.ts +45 -0
  91. package/src/facts.ts +44 -0
  92. package/src/file-facts.ts +2 -2
  93. package/src/findings/emitters.ts +14 -10
  94. package/src/findings/self-check.ts +41 -22
  95. package/src/findings/visibility-narrowing.ts +1 -1
  96. package/src/findings-pass.ts +5 -12
  97. package/src/framework-lifecycle.ts +1 -1
  98. package/src/fs/manifest.ts +25 -21
  99. package/src/generated-file.ts +240 -36
  100. package/src/graph.ts +3 -6
  101. package/src/index.ts +1 -1
  102. package/src/injection-container.ts +1 -1
  103. package/src/inventory/commonjs.ts +696 -0
  104. package/src/inventory/enumerate.ts +203 -0
  105. package/src/inventory/syntax.ts +311 -0
  106. package/src/inventory.ts +424 -878
  107. package/src/javascript-file.ts +29 -12
  108. package/src/load/classify.ts +49 -13
  109. package/src/load/diagnostics.ts +11 -1
  110. package/src/load/discover.ts +28 -12
  111. package/src/load/package-scope.ts +74 -0
  112. package/src/load/plan.ts +11 -2
  113. package/src/load/synthesize.ts +6 -6
  114. package/src/load/test-globals.ts +1 -1
  115. package/src/load/workspace-manifests.ts +1 -1
  116. package/src/load/workspace-run.ts +1 -1
  117. package/src/matrix.ts +7 -14
  118. package/src/outside-tests.ts +1 -1
  119. package/src/paths.ts +18 -0
  120. package/src/platform-calls.ts +119 -0
  121. package/src/platform-symbols.ts +205 -0
  122. package/src/position.ts +42 -0
  123. package/src/ref.ts +11 -20
  124. package/src/references.ts +383 -73
  125. package/src/report.ts +1 -1
  126. package/src/resolve.ts +1 -1
  127. package/src/{configured-declarations.ts → roots/configured-declarations.ts} +7 -7
  128. package/src/{entry-point-gaps.ts → roots/entry-point-gaps.ts} +5 -8
  129. package/src/{manifest.ts → roots/manifest.ts} +5 -5
  130. package/src/roots/published-reach.ts +481 -0
  131. package/src/{roots.ts → roots/root-set.ts} +203 -630
  132. package/src/roots/unseen-loads.ts +307 -0
  133. package/src/serialization-contract.ts +1 -1
  134. package/src/session.ts +17 -1
  135. package/src/source-files.ts +5 -10
  136. package/src/suppress-inline.ts +53 -89
  137. package/src/suppress.ts +48 -33
  138. package/src/test-support.ts +8 -3
  139. package/src/verbs/analyze.ts +17 -4
  140. package/src/verbs/describe.ts +5 -2
  141. package/src/verbs/explain.ts +1 -1
  142. package/dist/src/build-scripts.js +0 -418
  143. package/dist/src/conventions.js +0 -907
  144. package/dist/src/entry-points.js +0 -513
  145. package/dist/src/roots.js +0 -865
  146. package/dist/src/unseen-loads.js +0 -100
  147. package/src/build-scripts.ts +0 -536
  148. package/src/entry-points.ts +0 -661
  149. package/src/unseen-loads.ts +0 -134
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import { isExportAssignment, isExportSpecifier, isIdentifier, isImportClause, isImportSpecifier, isNamespaceExport, isNamespaceImport, } from "@typescript/native/ast";
7
7
  import { SymbolFlags } from "@typescript/native/sync";
8
- import { declarationsByName, isParameterProperty, nodeKey } from "./inventory.js";
8
+ import { isParameterProperty, nodeKey } from "./inventory.js";
9
9
  import { UNANSWERED } from "./query.js";
10
10
  /**
11
11
  * The chain walks over one project, against the declarations of `held`, the same
@@ -83,7 +83,7 @@ export function aliasChains(project, held) {
83
83
  names.add(node.expression.text);
84
84
  }
85
85
  }
86
- const byName = declarationsByName(held);
86
+ const byName = held.byName;
87
87
  const ids = [...names].flatMap((name) => byName.get(name) ?? []);
88
88
  return [...new Set([...ids, ...(module ? files : [])])].map((id) => ({
89
89
  id,
@@ -9,13 +9,14 @@ import { isStringLiteralLikeNode } from "@typescript/native/ast";
9
9
  import { lineOf, readComponent } from "./component-files.js";
10
10
  import { kindOf } from "./config.js";
11
11
  import { consumerReferences } from "./consumers.js";
12
- import { configuredDeclarations, configuredRef, declarationsNamed, } from "./configured-declarations.js";
12
+ import { configuredDeclarations, configuredRef, declarationsNamed, } from "./roots/configured-declarations.js";
13
13
  import { decorator } from "./decorator.js";
14
14
  import { configurationNeeds, dependenciesOf, projectNeeds } from "./dependencies.js";
15
15
  import { deprecatedDeclarations } from "./deprecation.js";
16
16
  import { moduleIdentity } from "./load/discover.js";
17
17
  import { loadRun } from "./load/load.js";
18
- import { generatedFiles } from "./conventions.js";
18
+ import { readSources } from "./entries/sources.js";
19
+ import { readWorkflows } from "./entries/workflow-steps.js";
19
20
  import { readEdgeSides } from "./edges.js";
20
21
  import { enumGroup } from "./enum-group.js";
21
22
  import { generatedFile, generatedFilesOf } from "./generated-file.js";
@@ -30,19 +31,18 @@ import { implementations, mergeImplementations } from "./implementations.js";
30
31
  import { injectionContainer } from "./injection-container.js";
31
32
  import { interfaceSatisfaction, settledSatisfaction } from "./interface-satisfaction.js";
32
33
  import { intraFunctionFacts, projectParts } from "./intra-function-parts.js";
33
- import { inventory } from "./inventory.js";
34
- import { readManifest } from "./manifest.js";
34
+ import {} from "./inventory.js";
35
+ import { inventory } from "./inventory/enumerate.js";
36
+ import { readManifest } from "./roots/manifest.js";
35
37
  import { liveFilesAt, matrixOf, referenceKey, sweepMatrix, } from "./matrix.js";
36
38
  import { ancestors, dirnamePath, extensionOf, joinPath, relativePath, resolvePath, } from "./paths.js";
37
39
  import { byPosition, isComponentFile } from "./position.js";
38
- import { skippedRoots, skippedUnits } from "./type-errors.js";
40
+ import { skippedUnits } from "./type-errors.js";
39
41
  import { reflectiveLookup } from "./reflective-lookup.js";
40
42
  import { references, testFileRulesOf } from "./references.js";
41
- import { roots, unmatchedEverywhere, } from "./roots.js";
43
+ import { rootSet, unmatchedEverywhere, } from "./roots/root-set.js";
42
44
  import { decodedMembers, serializationContract } from "./serialization-contract.js";
43
45
  import { outsideTestReferences, testFilesAt } from "./outside-tests.js";
44
- import { mergedGlobalInterfaces } from "./augmentations.js";
45
- import { unseenLoadsOf } from "./unseen-loads.js";
46
46
  import { GLOBALS_RUNNER, namesTestGlobals } from "./load/test-globals.js";
47
47
  import { supportReferences, testSupportFiles } from "./test-support.js";
48
48
  import { accessorsOf, storesOf } from "./stores.js";
@@ -52,6 +52,7 @@ import { inlineDirectives, inlineSuppressions } from "./suppress-inline.js";
52
52
  import { readTemplates, templateField } from "./template-field.js";
53
53
  import { bytewise } from "./text/compare.js";
54
54
  import { holdsManifest, manifestAt } from "./fs/manifest.js";
55
+ import { runDirectories } from "./entries/run-directories.js";
55
56
  import { globExpression } from "./text/glob.js";
56
57
  /** The setting whose source decides where a finding about a configured root sits. */
57
58
  const ROOTS_SETTING = "roots.patterns";
@@ -81,14 +82,13 @@ function readProjects(engine, host, scope, config, stage) {
81
82
  const parse = (fileName, text) => engine.parseSourceFile(fileName, text);
82
83
  return loadRun(engine, host, scope, config, ({ plan, classified, runFiles }) => {
83
84
  const { packages, conventions } = plan;
85
+ const workflows = readWorkflows(host, targetRoot);
84
86
  const options = {
85
87
  host,
86
88
  manifest: packages.manifest,
87
89
  otherPackages: packages.entries,
88
90
  patterns: config.roots.patterns,
89
91
  entryFiles: config.ts.entry_files,
90
- conventions,
91
- testFiles: config.ts.test_files,
92
92
  parse,
93
93
  publishedAPI: config.target.kind !== undefined && kindOf(config.target.kind) === "library",
94
94
  publishedMembers: packages.published,
@@ -98,18 +98,17 @@ function readProjects(engine, host, scope, config, stage) {
98
98
  const answers = classified.analyzed.map(({ plan: planned, project, skips, referenceOnly }) => {
99
99
  const read = () => {
100
100
  const held = inventory(project, host, targetRoot);
101
- const found = roots(project, held, targetRoot, options);
102
- const kept = skippedRoots(project, held, skips);
103
- const rooted = kept.length === 0
104
- ? found
105
- : {
106
- ...found,
107
- liveUnderReachability: [
108
- ...found.liveUnderReachability,
109
- ...kept.map((id) => ({ id, kind: "type-error", source: "" })),
110
- ],
111
- };
112
101
  const own = sourceFilesOf(project, targetRoot);
102
+ const sources = readSources({
103
+ host,
104
+ targetRoot,
105
+ files: own,
106
+ parse,
107
+ testFiles: config.ts.test_files,
108
+ conventions,
109
+ workflows,
110
+ });
111
+ const rooted = rootSet(project, held, targetRoot, { ...options, sources, skips });
113
112
  return {
114
113
  configuration: planned.id,
115
114
  configFile: project.configFile,
@@ -121,8 +120,8 @@ function readProjects(engine, host, scope, config, stage) {
121
120
  .ownSourceFiles()
122
121
  .filter((file) => referenceOnly(file.fileName))
123
122
  .flatMap((file) => relativePath(absoluteRoot, file.fileName) ?? []),
124
- generated: generatedFilesOf(own, generatedFiles(conventions, own)),
125
- testFileNames: conventions.testFiles,
123
+ generated: generatedFilesOf(own, sources.generated),
124
+ sources,
126
125
  };
127
126
  };
128
127
  for (const file of project.ownSourceFiles()) {
@@ -133,12 +132,12 @@ function readProjects(engine, host, scope, config, stage) {
133
132
  const consumed = new Map();
134
133
  for (const { project, consumer } of classified.consumed) {
135
134
  const side = { id: consumer.id, root: consumer.path };
136
- for (const reference of consumerReferences(project, host, targetRoot, side, config)) {
135
+ for (const reference of consumerReferences(project, host, targetRoot, side, config, parse)) {
137
136
  consumed.set(referenceKey(reference), reference);
138
137
  }
139
138
  }
140
139
  const outsideTests = testFilesAt(host, targetRoot, sourcePaths(host, targetRoot).filter((path) => !heldFiles.has(path) && testPatterns.some((pattern) => pattern.test(path))), parse);
141
- return { answers, references: [...consumed.values()], outsideTests };
140
+ return { answers, references: [...consumed.values()], outsideTests, workflows };
142
141
  });
143
142
  }
144
143
  /**
@@ -266,11 +265,13 @@ function readRun(engine, host, scope, config, mode, detectors, extra) {
266
265
  ? { delimiters: config.analysis.template_delimiters, files: [] }
267
266
  : readTemplates(host, targetRoot, config.analysis);
268
267
  const consumers = scope.consumers.map((consumer) => consumer.path);
268
+ const directories = runDirectories(host, targetRoot, (fileName, text) => engine.parseSourceFile(fileName, text));
269
269
  const read = readProjects(engine, host, scope, config, (project, opened) => {
270
270
  const projectRead = opened.read();
271
271
  const resolved = references(project, projectRead.held, targetRoot, {
272
272
  testFiles: config.ts.test_files,
273
- testFileNames: projectRead.testFileNames,
273
+ testFileNames: projectRead.sources.testFiles,
274
+ directories,
274
275
  });
275
276
  const evidence = evidenceRecords({
276
277
  project,
@@ -294,7 +295,6 @@ function readRun(engine, host, scope, config, mode, detectors, extra) {
294
295
  testFiles: resolved.testFilePaths,
295
296
  evidence,
296
297
  componentFiles: components.map(pathOf),
297
- augmented: mergedGlobalInterfaces(project, projectRead.held, sourceFilesOf(project, targetRoot)).map((id) => ({ id, kind: "global-augmentation", source: "" })),
298
298
  imports: new Map(project.ownSourceFiles().flatMap((file) => {
299
299
  const path = relativePath(targetRoot, file.fileName);
300
300
  if (path === undefined) {
@@ -317,7 +317,10 @@ function readRun(engine, host, scope, config, mode, detectors, extra) {
317
317
  reason: warning.reason,
318
318
  }))),
319
319
  decoded: decodedMembers(project, projectRead.held, productionFiles(project, targetRoot, resolved.testFilePaths), consumers),
320
- extra: extra(project, projectRead, resolved.references, resolved.testFilePaths),
320
+ extra: extra(project, projectRead, resolved.references, resolved.testFilePaths, resolved.unseenLoads.map((position) => ({
321
+ configuration: projectRead.configuration,
322
+ position,
323
+ }))),
321
324
  };
322
325
  });
323
326
  const outsidePaths = read.result.outsideTests.map((one) => one.path);
@@ -331,7 +334,9 @@ function readRun(engine, host, scope, config, mode, detectors, extra) {
331
334
  }));
332
335
  // Test-support code is code only test code imports in any configuration of the run: a
333
336
  // configuration that holds no test file says nothing about what the tests import.
334
- const { support, testUsed } = testSupportFiles(withOutside.flatMap((one) => one.projectRead.held.symbols), withOutside.flatMap((one) => one.references), withOutside.flatMap((one) => one.projectRead.rooted.liveUnderReachability), withOutside.flatMap((one) => one.testFiles), testEvidence(host, targetRoot, withOutside));
337
+ const { support, testUsed } = testSupportFiles(withOutside.flatMap((one) => one.projectRead.held.symbols), withOutside.flatMap((one) => one.references),
338
+ // An outside declaration naming a global augmentation calls nothing of its file.
339
+ withOutside.flatMap((one) => one.projectRead.rooted.liveUnderReachability.filter((root) => root.kind !== "global-augmentation")), withOutside.flatMap((one) => one.testFiles), testEvidence(host, targetRoot, withOutside));
335
340
  // A member a decode fills or a copy carries is written: a value decoded and sent again carries it on.
336
341
  const written = new Set([
337
342
  ...countedWrites([...withOutside.flatMap((one) => one.references), ...read.result.references], support, mode),
@@ -362,9 +367,7 @@ function readRun(engine, host, scope, config, mode, detectors, extra) {
362
367
  configuration: projectRead.configuration,
363
368
  symbols: projectRead.held.symbols,
364
369
  references: [...made, ...evidenceReferences(projectRead.held.symbols, detected.inTestFiles)],
365
- // The augmentations are rooted after test support is read: an outside declaration
366
- // naming one calls nothing of its file.
367
- roots: [...projectRead.rooted.liveUnderReachability, ...one.augmented],
370
+ roots: projectRead.rooted.liveUnderReachability,
368
371
  testFiles: [...one.testFiles, ...supportFiles],
369
372
  ...(supportFiles.length === 0 ? {} : { supportFiles }),
370
373
  ...(testUsedFiles.length === 0 ? {} : { testUsedFiles }),
@@ -430,6 +433,7 @@ function readRun(engine, host, scope, config, mode, detectors, extra) {
430
433
  conventionUses: read.plan.conventions.uses,
431
434
  memberDirs: read.plan.packages.members,
432
435
  nestedDirs: read.plan.packages.nested,
436
+ workflows: read.result.workflows,
433
437
  };
434
438
  }
435
439
  /**
@@ -581,19 +585,19 @@ function productionFiles(project, targetRoot, testFiles) {
581
585
  /** Reads a run's projects with every per-project fact an emitter reads. */
582
586
  export function readEmitterRun(engine, host, scope, config, mode, detectors) {
583
587
  const targetRoot = scope.target.path;
584
- const run = readRun(engine, host, scope, config, mode, detectors, (project, read, references, testFiles) => ({
588
+ const run = readRun(engine, host, scope, config, mode, detectors, (project, read, references, testFiles, unseenLoads) => ({
585
589
  deprecation: deprecatedDeclarations(project, read.held),
586
590
  accessors: accessorsOf(project, read.held),
587
- needs: projectNeeds(project, read.held, host, targetRoot, (fileName, text) => engine.parseSourceFile(fileName, text)),
591
+ needs: projectNeeds(project, read.held, host, targetRoot, (fileName, text) => engine.parseSourceFile(fileName, text), read.sources.configuration, read.sources.workflows),
588
592
  implementations: implementations(project, read.held),
589
593
  heldByInclusion: heldByInclusion(project, targetRoot),
590
- generated: [...read.generated.keys()],
594
+ generated: read.generated,
591
595
  inOperands: inOperandNames(project, targetRoot, testFiles),
592
596
  rooted: read.rooted,
593
597
  directives: inlineDirectives(project, read.held, targetRoot).filter((directive) => !read.referenceOnly.includes(directive.site.path)),
594
598
  declarationsNamed: declarationsNamed(project, read.held, configuredDeclarations(config)),
595
599
  parts: projectParts(project, read.held, references, targetRoot),
596
- unseenLoads: unseenLoadsOf(project, read.configuration, targetRoot, testFiles),
600
+ unseenLoads,
597
601
  }));
598
602
  // Whether a declaration carries the marker decides its code, so one whose answer went
599
603
  // unread is reported by nothing.
@@ -657,12 +661,12 @@ export function emitterInputOver(host, scope, config, read, input, selfCheck) {
657
661
  references: one.configured.references,
658
662
  accessors: one.extra.accessors,
659
663
  })), swept.exempt, input.mode),
660
- dependencies: dependenciesOf(host, targetRoot, [...projects.map((one) => one.extra.needs), configurationNeeds(read.conventionUses)], swept.sweep.candidates.map((candidate) => candidate.id), members.read, members.unbuilt, read.nestedDirs),
664
+ dependencies: dependenciesOf(host, targetRoot, read.workflows, [...projects.map((one) => one.extra.needs), configurationNeeds(read.conventionUses)], swept.sweep.candidates.map((candidate) => candidate.id), members.read, members.unbuilt, read.nestedDirs),
661
665
  implementations: mergeImplementations(projects.map((one) => one.extra.implementations)),
662
666
  files: {
663
667
  tree: sourceTree(host, targetRoot),
664
668
  heldByInclusion: new Set(projects.flatMap((one) => one.extra.heldByInclusion)),
665
- generated: new Set(projects.flatMap((one) => one.extra.generated)),
669
+ generated: new Set(projects.flatMap((one) => [...one.extra.generated.keys()])),
666
670
  inOperands: new Set(projects.flatMap((one) => one.extra.inOperands)),
667
671
  unseenLoads: projects.flatMap((one) => one.extra.unseenLoads),
668
672
  },
@@ -720,6 +724,7 @@ function readAnalysis(engine, host, scope, config, provenance, mode, detectors)
720
724
  unmappedEntries: unmappedEverywhere(read.projects),
721
725
  heldScripts: read.projects.flatMap((one) => one.heldScripts.map((held) => ({ ...held, configFile: one.configFile }))),
722
726
  unseenLoads: read.projects.flatMap((one) => one.extra.unseenLoads),
727
+ generated: new Map(read.projects.flatMap((one) => [...one.extra.generated])),
723
728
  },
724
729
  configured: read.projects.map((one) => one.configured),
725
730
  symbols,
@@ -1,12 +1,13 @@
1
1
  /**
2
2
  * The one reader of every command string the analysis reads. Layer 3, the holding rule
3
- * `roots.ts` applies through `text/named-files.ts`, reads all of the string's text whatever
4
- * the other two layers make of it; layer 1 parses the string and layer 2 reads each simple
5
- * command a tool's reader understands, and they only add the files and modules it runs.
3
+ * `roots/root-set.ts` applies through `text/named-files.ts`, reads all of the string's text
4
+ * whatever the other two layers make of it; layer 1 parses the string and layer 2 reads each
5
+ * simple command a tool's reader understands, and they only add the files and modules it runs.
6
6
  */
7
7
  import { joinPath, resolvePath } from "../paths.js";
8
8
  import { shellLine } from "./shell.js";
9
9
  import { configurationsOf, preloadTarget, readBuiltin, readTool, } from "./tools.js";
10
+ import { APPENDED_EXTENSIONS } from "../extensions.js";
10
11
  /**
11
12
  * The outcomes of one pipeline run in `dir`: those of the builtin that is its one member, as
12
13
  * `readBuiltin` gives them, a directory the analysis does not know after a part layer 1 does
@@ -104,8 +105,6 @@ export function readCommands(text, dir) {
104
105
  held: text,
105
106
  };
106
107
  }
107
- /** The extensions a runtime or a loader tries after a path written without one. */
108
- const TRIED_EXTENSIONS = [".ts", ".tsx", ".mts", ".cts", ".js", ".jsx", ".mjs", ".cjs"];
109
108
  /**
110
109
  * The files `run` loads: its entry, and each preload written as a path. Each may be at its
111
110
  * path, with each extension tried, and as a directory's `index` file.
@@ -126,8 +125,8 @@ export function loadsOf(run) {
126
125
  written: one,
127
126
  paths: [
128
127
  path,
129
- ...TRIED_EXTENSIONS.map((extension) => `${path}${extension}`),
130
- ...TRIED_EXTENSIONS.map((extension) => joinPath(path, `index${extension}`)),
128
+ ...APPENDED_EXTENSIONS.map((extension) => `${path}${extension}`),
129
+ ...APPENDED_EXTENSIONS.map((extension) => joinPath(path, `index${extension}`)),
131
130
  ],
132
131
  }));
133
132
  }
@@ -4,7 +4,7 @@ export const RECORD = {
4
4
  conformance: {
5
5
  corpusVersion: "6.0.0",
6
6
  result: "pass",
7
- digest: "sha256:58ac31fa90fcbefdbbcbcbd6d2c7a8af6dd4cd883c04d79abfe96f979ffe10e1",
7
+ digest: "sha256:d8d2a417c5cb9b3829739424d9cfd3bd7b631231d8f420300656f6df86f5a6d1",
8
8
  },
9
9
  gaps: [],
10
10
  };
@@ -1,4 +1,5 @@
1
- import { inventory } from "./inventory.js";
1
+ import { runDirectories } from "./entries/run-directories.js";
2
+ import { inventory } from "./inventory/enumerate.js";
2
3
  import { relativePath } from "./paths.js";
3
4
  import { references } from "./references.js";
4
5
  import { narrowedTo } from "./session.js";
@@ -9,11 +10,12 @@ import { narrowedTo } from "./session.js";
9
10
  * own projects give it. A reference from a consumer's test file is a test reference
10
11
  * unless the configuration counts it as a production one.
11
12
  */
12
- export function consumerReferences(project, host, targetRoot, consumer, config) {
13
+ export function consumerReferences(project, host, targetRoot, consumer, config, parse) {
13
14
  const held = inventory(narrowedTo(project, (file) => relativePath(targetRoot, file.fileName) !== undefined), host, targetRoot);
14
15
  const found = references(project, held, targetRoot, {
15
16
  testFiles: config.ts.test_files,
16
17
  consumer,
18
+ directories: runDirectories(host, consumer.root, parse),
17
19
  }).references;
18
20
  if (config.analysis.consumer_tests !== "production") {
19
21
  return found;
@@ -273,7 +273,7 @@ export const SETTINGS = [
273
273
  role: "setting",
274
274
  read: true,
275
275
  default: [
276
- "**/*.test.{ts,tsx,mts,cts}",
276
+ "**/*.test.{ts,tsx,mts,cts,js,jsx,mjs,cjs}",
277
277
  "**/*.test-d.{ts,tsx,mts,cts}",
278
278
  "**/*.spec-d.{ts,tsx,mts,cts}",
279
279
  "**/*.spec.*",
@@ -2,6 +2,7 @@
2
2
  export const CONTRACT_VERSION = "8.0.0";
3
3
  export const SCHEMA_VERSIONS = ["9.0.0"];
4
4
  export const SCHEMA_VERSION = "9.0.0";
5
+ export const FACTS_VERSION = "1.0.0";
5
6
  export const CORPUS_VERSION = "6.0.0";
6
7
  export const CODE_PREFIX = "DS";
7
8
  export const FAMILY_KEY_LENGTH = 4;
@@ -25,16 +26,19 @@ export const LANGUAGE_ROWS = {
25
26
  analyzer: "deadset-go",
26
27
  markers: ["go.mod"],
27
28
  skippedDirectories: ["node_modules", "testdata", "vendor", ".*", "_*"],
29
+ skippedFiles: ["_*", ".*"],
28
30
  },
29
31
  ts: {
30
32
  analyzer: "deadset-ts",
31
33
  markers: ["tsconfig*.json", "jsconfig*.json"],
32
34
  skippedDirectories: ["node_modules", ".git"],
35
+ skippedFiles: ["*.min.js", "*.min.cjs", "*.min.mjs"],
33
36
  },
34
37
  proto: {
35
38
  analyzer: "deadset-proto",
36
39
  markers: ["buf.yaml", "buf.work.yaml"],
37
40
  skippedDirectories: ["node_modules", "vendor", ".*"],
41
+ skippedFiles: [],
38
42
  },
39
43
  };
40
44
  export const EXIT_CLEAN = 0;
@@ -441,8 +445,8 @@ export const KIND_ROWS = [
441
445
  languages: ["go", "ts"],
442
446
  subject: "dependency",
443
447
  holdsLive: false,
444
- rule: "A directly declared dependency that no import in the target needs. On the Go side, a direct require whose module provides no package any target package or test variant imports. On the TypeScript side, a manifest dependency, development dependency or peer dependency the project's import closure does not need. A deletion finding whose fix would remove the last use of a dependency names that dependency. On the TypeScript side, a needed dependency whose every use is written inside declarations that are members of the run's dead components, or at the top level of a file reported under DS1602, that no command runs and that no needed dependency used otherwise names as a peer, is reported as well, dead only through that code: at the reachability class possible where one of those declarations belongs to a library's published API, and found under reachability alone where one of those declarations or files is, so at probable unless ts.roots_complete is true. A use the configuration makes, a use an unanswered specifier may make and an import none of whose bindings is used are uses by live code.",
445
- precondition: "On the Go side the rule is the semantics of `go mod tidy -diff` exactly: a requirement marked indirect is never reported, because it exists to pin a transitive version and removing it changes the build list. On the TypeScript side the import closure is the files of the run's projects, and a call of `import.meta.resolve` or of `require.resolve` in them, whatever `require` names, whose first argument is a string literal or a template literal with no substitution needs each dependency an import of that specifier needs. A `@types/<name>` package in a type root of a compiler configuration that lists no `types`, a `node_modules/@types` directory at or above the configuration's directory or a `typeRoots` entry naming one, is needed by a use, in a file of that configuration, of a global name or an ambient module that one of the package's declaration files declares, which resolves to no declaration of the program: a compiler before version 6 includes every package of the type roots where `types` is not listed, and version 6 and later include none, so the program the analysis builds holds none of those declarations. A package's declaration files are the file its `types` or `typings` names, else its `index.d.ts`, and each file a `/// <reference path>` of one of them reaches inside the package. A global is a top-level declaration of such a file that is no module, or a declaration of a `declare global` block of one that is, and an ambient module is a `declare module` with a string name of a file that is no module. A name that names a member, a property or a label is no use of a global. Four more dependencies are needed: one whose command a script entry, a workflow step or a git hook runs, one that a string of a configuration file names, and one that a string names under a manifest key or a package key of an applied convention row, each as grammar/analysis/conventions.md states, and one that a needed dependency names as a peer, as stated below. A command no script entry, workflow step or git hook runs needs nothing. A declared dependency that the installed manifest of a needed declared dependency names in its peerDependencies is needed, and so on until no further dependency joins. A peer dependency is a package the needed dependency expects beside it at a version its manifest states, whether or not it imports the package, and the project's declaration is what keeps that package present at a version the project chooses, so removing the declaration can break the needed dependency where nothing the analysis reads imports the peer. A peer that peerDependenciesMeta marks optional is needed in the same way, because the needed dependency's manifest still names it as a package it works with, and a package manager may leave an optional peer out where the project does not declare it, so the project's declaration is what keeps it present for the needed dependency. A declared dependency that only dependencies nothing needs name as a peer is needed by nothing. A dependency of a manifest whose directory holds source only in configurations the run lists in configurations_not_built is reported at the reachability class possible, because the source that may import it was not analyzed. An installed manifest is the package's manifest in the nearest node_modules directory at or above the directory of the manifest that declares the dependency, and a dependency with none is decided by the import closure alone. On the TypeScript side, the dependencies judged are those of every manifest grammar/analysis/program.md says the analysis reads, a nested package's among them, each read against its own directory: a dependency is needed by a use written in a file at or below the directory of the manifest that declares it where no manifest between them declares a dependency of the same name, so a use below a nested manifest that declares the same dependency needs that nested manifest's declaration only, by a use no one file holds, and as a peer of a needed dependency of the same manifest or of a manifest below it. A dependency a nested package's manifest declares whose installed manifest the analysis cannot find is not judged, because no run requires a nested package to be installed and its commands and peers cannot be read, while a workspace member's and the target's own are judged as above.",
448
+ rule: "A directly declared dependency that no import in the target needs. On the Go side, a direct require whose module provides no package any target package or test variant imports. On the TypeScript side, a manifest dependency, development dependency or peer dependency the project's import closure does not need. A deletion finding whose fix would remove the last use of a dependency names that dependency. On the TypeScript side, a needed dependency whose every use is written inside declarations that are members of the run's dead components, or at the top level of a file reported under DS1602, that no command runs and that no needed dependency used otherwise names as a peer, is reported as well, dead only through that code: at the reachability class possible where one of those declarations belongs to a library's published API, and found under reachability alone where one of those declarations or files is, so at probable unless ts.roots_complete is true. A use the configuration makes, a use an unanswered specifier or callee may make and an import none of whose bindings is used are uses by live code.",
449
+ precondition: "On the Go side the rule is the semantics of `go mod tidy -diff` exactly: a requirement marked indirect is never reported, because it exists to pin a transitive version and removing it changes the build list. On the TypeScript side the import closure is the files of the run's projects, and a `require()` call as `roots.23` reads one, or a call of `import.meta.resolve`, of `require.resolve`, whatever `require` names, or of `resolve` on another name that is such a `require`, in them, whose first argument is a string literal or a template literal with no substitution needs each dependency an import of that specifier needs. A `@types/<name>` package in a type root of a compiler configuration that lists no `types`, a `node_modules/@types` directory at or above the configuration's directory or a `typeRoots` entry naming one, is needed by a use, in a file of that configuration, of a global name or an ambient module that one of the package's declaration files declares, which resolves to no declaration of the program: a compiler before version 6 includes every package of the type roots where `types` is not listed, and version 6 and later include none, so the program the analysis builds holds none of those declarations. A package's declaration files are the file its `types` or `typings` names, else its `index.d.ts`, and each file a `/// <reference path>` of one of them reaches inside the package. A global is a top-level declaration of such a file that is no module, or a declaration of a `declare global` block of one that is, and an ambient module is a `declare module` with a string name of a file that is no module. A name that names a member, a property or a label is no use of a global. Four more dependencies are needed: one whose command a script entry, a workflow step or a git hook runs, one that a string of a configuration file names, and one that a string names under a manifest key or a package key of an applied convention row, each as grammar/analysis/conventions.md states, and one that a needed dependency names as a peer, as stated below. A command no script entry, workflow step or git hook runs needs nothing. A declared dependency that the installed manifest of a needed declared dependency names in its peerDependencies is needed, and so on until no further dependency joins. A peer dependency is a package the needed dependency expects beside it at a version its manifest states, whether or not it imports the package, and the project's declaration is what keeps that package present at a version the project chooses, so removing the declaration can break the needed dependency where nothing the analysis reads imports the peer. A peer that peerDependenciesMeta marks optional is needed in the same way, because the needed dependency's manifest still names it as a package it works with, and a package manager may leave an optional peer out where the project does not declare it, so the project's declaration is what keeps it present for the needed dependency. A declared dependency that only dependencies nothing needs name as a peer is needed by nothing. A dependency of a manifest whose directory holds source only in configurations the run lists in configurations_not_built is reported at the reachability class possible, because the source that may import it was not analyzed. An installed manifest is the package's manifest in the nearest node_modules directory at or above the directory of the manifest that declares the dependency, and a dependency with none is decided by the import closure alone. On the TypeScript side, the dependencies judged are those of every manifest grammar/analysis/program.md says the analysis reads, a nested package's among them, each read against its own directory: a dependency is needed by a use written in a file at or below the directory of the manifest that declares it where no manifest between them declares a dependency of the same name, so a use below a nested manifest that declares the same dependency needs that nested manifest's declaration only, by a use no one file holds, and as a peer of a needed dependency of the same manifest or of a manifest below it. A dependency a nested package's manifest declares whose installed manifest the analysis cannot find is not judged, because no run requires a nested package to be installed and its commands and peers cannot be read, while a workspace member's and the target's own are judged as above.",
446
450
  details: { dependency_class: "required" },
447
451
  defaultEnabled: true,
448
452
  defaultSeverity: "deny",
@@ -708,6 +712,38 @@ export const SYMBOL_SUBJECTS = {
708
712
  "configured-declaration": "record",
709
713
  edge: "record",
710
714
  };
715
+ export const REMEDIES = {
716
+ declaration: {
717
+ names: "a declaration",
718
+ suppressions: ["inline", "ignore", "baseline"],
719
+ remedy: "delete the symbol, or wire it up so the program uses it",
720
+ },
721
+ binding: {
722
+ names: "an import binding",
723
+ suppressions: ["inline", "ignore", "baseline"],
724
+ remedy: "delete the import, or use what it binds",
725
+ },
726
+ part: {
727
+ names: "a part of a declaration",
728
+ suppressions: ["inline", "ignore", "baseline"],
729
+ remedy: "remove the part, or use it",
730
+ },
731
+ file: {
732
+ names: "a file",
733
+ suppressions: [],
734
+ remedy: "delete the file, name it as a root, or build it in a configuration of the build matrix",
735
+ },
736
+ dependency: {
737
+ names: "a dependency row",
738
+ suppressions: ["ignore", "baseline"],
739
+ remedy: "remove the dependency",
740
+ },
741
+ record: {
742
+ names: "a record of deadset's own configuration",
743
+ suppressions: [],
744
+ remedy: "correct or remove the record the finding names",
745
+ },
746
+ };
711
747
  export const EXEMPTION_CLASSES = [
712
748
  {
713
749
  class: "interface-satisfaction",
@@ -1220,6 +1256,86 @@ export const EVIDENCE = [
1220
1256
  codes: ["DS1801", "DS1802", "DS1803", "DS1804", "DS1805"],
1221
1257
  },
1222
1258
  ];
1259
+ /** The generators whose TypeScript output a generated file is matched against, in the document's order. */
1260
+ export const GENERATORS = [
1261
+ {
1262
+ id: "protoc-gen-es-2",
1263
+ plugin: "protoc-gen-es",
1264
+ header: "^// @generated by protoc-gen-es v2\\.",
1265
+ versions: { min: "v2.10.0", max: "v2.16.0" },
1266
+ cell: "exact",
1267
+ },
1268
+ {
1269
+ id: "protoc-gen-es-2-fallback",
1270
+ plugin: "protoc-gen-es",
1271
+ header: "^// @generated by protoc-gen-es v2\\.",
1272
+ cell: "fallback",
1273
+ },
1274
+ {
1275
+ id: "protoc-gen-es-1",
1276
+ plugin: "protoc-gen-es",
1277
+ header: "^// @generated by protoc-gen-es v1\\.",
1278
+ cell: "exact",
1279
+ },
1280
+ {
1281
+ id: "protoc-gen-connect-es-1",
1282
+ plugin: "protoc-gen-connect-es",
1283
+ header: "^// @generated by protoc-gen-connect-es v1\\.",
1284
+ cell: "exact",
1285
+ },
1286
+ {
1287
+ id: "ts-proto-2-output-schema",
1288
+ plugin: "ts-proto",
1289
+ header: "^// Code generated by protoc-gen-ts_proto\\. DO NOT EDIT\\.$",
1290
+ versions: { min: "v2.11.4", max: "v2.15.0" },
1291
+ cell: "exact",
1292
+ },
1293
+ {
1294
+ id: "ts-proto-2",
1295
+ plugin: "ts-proto",
1296
+ header: "^// Code generated by protoc-gen-ts_proto\\. DO NOT EDIT\\.$",
1297
+ versions: { min: "v2.11.4", max: "v2.15.0" },
1298
+ cell: "rpc-types-fallback",
1299
+ },
1300
+ {
1301
+ id: "ts-proto-2-types",
1302
+ plugin: "ts-proto",
1303
+ header: "^// Code generated by protoc-gen-ts_proto\\. DO NOT EDIT\\.$",
1304
+ versions: { min: "v2.11.4", max: "v2.15.0" },
1305
+ cell: "fallback",
1306
+ },
1307
+ {
1308
+ id: "ts-proto-2-fallback",
1309
+ plugin: "ts-proto",
1310
+ header: "^// Code generated by protoc-gen-ts_proto\\. DO NOT EDIT\\.$",
1311
+ cell: "fallback",
1312
+ },
1313
+ {
1314
+ id: "protoc-gen-js",
1315
+ plugin: "protoc-gen-js",
1316
+ header: "^// GENERATED CODE -- DO NOT EDIT!$",
1317
+ cell: "fallback",
1318
+ },
1319
+ {
1320
+ id: "protoc-gen-grpc-web",
1321
+ plugin: "protoc-gen-grpc-web",
1322
+ header: "^// Code generated by protoc-gen-grpc-web\\. DO NOT EDIT\\.$",
1323
+ cell: "fallback",
1324
+ },
1325
+ {
1326
+ id: "protobuf-ts",
1327
+ plugin: "protobuf-ts",
1328
+ header: "^// @generated by protobuf-ts ",
1329
+ cell: "fallback",
1330
+ },
1331
+ { id: "ts-protoc-gen", plugin: "ts-protoc-gen", header: "^// package: ", cell: "fallback" },
1332
+ {
1333
+ id: "protoc-gen-es-unsupported",
1334
+ plugin: "protoc-gen-es",
1335
+ header: "^// @generated by protoc-gen-es v(?:0|[3-9]|[1-9][0-9]+)\\.",
1336
+ cell: "unsupported",
1337
+ },
1338
+ ];
1223
1339
  /** Each group of failure classes, and the text opening the line that names one of its failures. */
1224
1340
  export const FAILURE_PREFIXES = { setup: "setup failure: ", run: "run failure: " };
1225
1341
  /** Each failure class the Contract names, and its group. */
@@ -1230,9 +1346,11 @@ export const FAILURE_CLASSES = {
1230
1346
  "workspace-member-without-source": "setup",
1231
1347
  "convention-not-literal": "setup",
1232
1348
  "no-program": "setup",
1349
+ "unreadable-configuration": "setup",
1233
1350
  "unreadable-document": "setup",
1234
1351
  "missing-import-path": "setup",
1235
1352
  "binding-undecodable": "setup",
1353
+ "unsupported-language": "setup",
1236
1354
  "unwritten-output": "run",
1237
1355
  "unreportable-path": "run",
1238
1356
  "memory-exhausted": "run",