@cplieger/deadset-ts 8.0.0-dev.15 → 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 (134) hide show
  1. package/dist/src/analysis.js +41 -37
  2. package/dist/src/commands/read.js +6 -7
  3. package/dist/src/conformance-record.js +1 -1
  4. package/dist/src/consumers.js +3 -1
  5. package/dist/src/contract/config.generated.js +1 -1
  6. package/dist/src/contract/contract.generated.js +119 -2
  7. package/dist/src/dependencies.js +79 -48
  8. package/dist/src/entries/build-scripts.js +222 -0
  9. package/dist/src/{configuration-files.js → entries/configuration-files.js} +20 -58
  10. package/dist/src/{convention-rows.js → entries/convention-rows.js} +120 -27
  11. package/dist/src/entries/conventions.js +739 -0
  12. package/dist/src/{html-entries.js → entries/html-entries.js} +3 -3
  13. package/dist/src/{mdx-entries.js → entries/mdx-entries.js} +2 -2
  14. package/dist/src/entries/run-directories.js +77 -0
  15. package/dist/src/entries/sources.js +144 -0
  16. package/dist/src/entries/static-module.js +669 -0
  17. package/dist/src/entries/test-runners.js +684 -0
  18. package/dist/src/{workflow-steps.js → entries/workflow-steps.js} +18 -8
  19. package/dist/src/extensions.js +37 -0
  20. package/dist/src/facts.js +38 -0
  21. package/dist/src/findings/emitters.js +5 -8
  22. package/dist/src/findings/self-check.js +36 -20
  23. package/dist/src/findings-pass.js +5 -6
  24. package/dist/src/framework-lifecycle.js +1 -1
  25. package/dist/src/fs/manifest.js +15 -20
  26. package/dist/src/generated-file.js +172 -29
  27. package/dist/src/graph.js +2 -4
  28. package/dist/src/index.js +1 -1
  29. package/dist/src/injection-container.js +1 -1
  30. package/dist/src/inventory/commonjs.js +62 -17
  31. package/dist/src/inventory/enumerate.js +2 -1
  32. package/dist/src/javascript-file.js +26 -11
  33. package/dist/src/load/classify.js +28 -9
  34. package/dist/src/load/diagnostics.js +8 -1
  35. package/dist/src/load/discover.js +15 -7
  36. package/dist/src/load/plan.js +2 -2
  37. package/dist/src/load/synthesize.js +5 -5
  38. package/dist/src/load/workspace-manifests.js +1 -1
  39. package/dist/src/matrix.js +6 -13
  40. package/dist/src/outside-tests.js +1 -1
  41. package/dist/src/paths.js +16 -0
  42. package/dist/src/platform-calls.js +78 -0
  43. package/dist/src/platform-symbols.js +140 -0
  44. package/dist/src/references.js +202 -32
  45. package/dist/src/resolve.js +1 -1
  46. package/dist/src/{configured-declarations.js → roots/configured-declarations.js} +4 -4
  47. package/dist/src/{entry-point-gaps.js → roots/entry-point-gaps.js} +5 -8
  48. package/dist/src/{manifest.js → roots/manifest.js} +4 -4
  49. package/dist/src/roots/published-reach.js +412 -0
  50. package/dist/src/roots/root-set.js +489 -0
  51. package/dist/src/roots/unseen-loads.js +208 -0
  52. package/dist/src/serialization-contract.js +1 -1
  53. package/dist/src/source-files.js +5 -9
  54. package/dist/src/suppress.js +30 -32
  55. package/dist/src/test-support.js +4 -2
  56. package/dist/src/verbs/analyze.js +13 -1
  57. package/dist/src/verbs/describe.js +5 -3
  58. package/jsr.json +1 -1
  59. package/package.json +2 -2
  60. package/src/analysis.ts +75 -52
  61. package/src/automatic-types.ts +1 -1
  62. package/src/commands/read.ts +6 -8
  63. package/src/conformance-record.ts +1 -1
  64. package/src/consumers.ts +4 -0
  65. package/src/contract/config.generated.ts +1 -1
  66. package/src/contract/contract.generated.ts +138 -2
  67. package/src/dependencies.ts +96 -49
  68. package/src/entries/build-scripts.ts +292 -0
  69. package/src/{configuration-files.ts → entries/configuration-files.ts} +23 -75
  70. package/src/{convention-rows.ts → entries/convention-rows.ts} +167 -28
  71. package/src/{conventions.ts → entries/conventions.ts} +347 -522
  72. package/src/{html-entries.ts → entries/html-entries.ts} +5 -5
  73. package/src/{mdx-entries.ts → entries/mdx-entries.ts} +4 -4
  74. package/src/entries/run-directories.ts +108 -0
  75. package/src/entries/sources.ts +266 -0
  76. package/src/entries/static-module.ts +857 -0
  77. package/src/entries/test-runners.ts +868 -0
  78. package/src/{workflow-steps.ts → entries/workflow-steps.ts} +29 -11
  79. package/src/exempt.ts +3 -2
  80. package/src/extensions.ts +45 -0
  81. package/src/facts.ts +44 -0
  82. package/src/file-facts.ts +1 -1
  83. package/src/findings/emitters.ts +14 -10
  84. package/src/findings/self-check.ts +41 -22
  85. package/src/findings/visibility-narrowing.ts +1 -1
  86. package/src/findings-pass.ts +5 -12
  87. package/src/framework-lifecycle.ts +1 -1
  88. package/src/fs/manifest.ts +25 -21
  89. package/src/generated-file.ts +240 -36
  90. package/src/graph.ts +3 -5
  91. package/src/index.ts +1 -1
  92. package/src/injection-container.ts +1 -1
  93. package/src/inventory/commonjs.ts +102 -17
  94. package/src/inventory/enumerate.ts +2 -1
  95. package/src/javascript-file.ts +29 -12
  96. package/src/load/classify.ts +49 -13
  97. package/src/load/diagnostics.ts +11 -1
  98. package/src/load/discover.ts +27 -11
  99. package/src/load/plan.ts +11 -2
  100. package/src/load/synthesize.ts +6 -6
  101. package/src/load/test-globals.ts +1 -1
  102. package/src/load/workspace-manifests.ts +1 -1
  103. package/src/load/workspace-run.ts +1 -1
  104. package/src/matrix.ts +7 -14
  105. package/src/outside-tests.ts +1 -1
  106. package/src/paths.ts +18 -0
  107. package/src/platform-calls.ts +119 -0
  108. package/src/platform-symbols.ts +205 -0
  109. package/src/references.ts +281 -34
  110. package/src/report.ts +1 -1
  111. package/src/resolve.ts +1 -1
  112. package/src/{configured-declarations.ts → roots/configured-declarations.ts} +7 -7
  113. package/src/{entry-point-gaps.ts → roots/entry-point-gaps.ts} +5 -8
  114. package/src/{manifest.ts → roots/manifest.ts} +5 -5
  115. package/src/roots/published-reach.ts +481 -0
  116. package/src/{roots.ts → roots/root-set.ts} +203 -630
  117. package/src/roots/unseen-loads.ts +307 -0
  118. package/src/serialization-contract.ts +1 -1
  119. package/src/source-files.ts +5 -10
  120. package/src/suppress.ts +48 -33
  121. package/src/test-support.ts +8 -3
  122. package/src/verbs/analyze.ts +17 -4
  123. package/src/verbs/describe.ts +5 -2
  124. package/src/verbs/explain.ts +1 -1
  125. package/dist/src/build-scripts.js +0 -418
  126. package/dist/src/conventions.js +0 -907
  127. package/dist/src/entry-points.js +0 -444
  128. package/dist/src/own-body.js +0 -28
  129. package/dist/src/roots.js +0 -865
  130. package/dist/src/unseen-loads.js +0 -189
  131. package/src/build-scripts.ts +0 -536
  132. package/src/entry-points.ts +0 -584
  133. package/src/own-body.ts +0 -42
  134. package/src/unseen-loads.ts +0 -282
@@ -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";
@@ -32,18 +33,16 @@ import { interfaceSatisfaction, settledSatisfaction } from "./interface-satisfac
32
33
  import { intraFunctionFacts, projectParts } from "./intra-function-parts.js";
33
34
  import {} from "./inventory.js";
34
35
  import { inventory } from "./inventory/enumerate.js";
35
- import { readManifest } from "./manifest.js";
36
+ import { readManifest } from "./roots/manifest.js";
36
37
  import { liveFilesAt, matrixOf, referenceKey, sweepMatrix, } from "./matrix.js";
37
38
  import { ancestors, dirnamePath, extensionOf, joinPath, relativePath, resolvePath, } from "./paths.js";
38
39
  import { byPosition, isComponentFile } from "./position.js";
39
- import { skippedRoots, skippedUnits } from "./type-errors.js";
40
+ import { skippedUnits } from "./type-errors.js";
40
41
  import { reflectiveLookup } from "./reflective-lookup.js";
41
42
  import { references, testFileRulesOf } from "./references.js";
42
- import { roots, unmatchedEverywhere, } from "./roots.js";
43
+ import { rootSet, unmatchedEverywhere, } from "./roots/root-set.js";
43
44
  import { decodedMembers, serializationContract } from "./serialization-contract.js";
44
45
  import { outsideTestReferences, testFilesAt } from "./outside-tests.js";
45
- import { mergedGlobalInterfaces } from "./augmentations.js";
46
- import { unseenLoadsOf } from "./unseen-loads.js";
47
46
  import { GLOBALS_RUNNER, namesTestGlobals } from "./load/test-globals.js";
48
47
  import { supportReferences, testSupportFiles } from "./test-support.js";
49
48
  import { accessorsOf, storesOf } from "./stores.js";
@@ -53,6 +52,7 @@ import { inlineDirectives, inlineSuppressions } from "./suppress-inline.js";
53
52
  import { readTemplates, templateField } from "./template-field.js";
54
53
  import { bytewise } from "./text/compare.js";
55
54
  import { holdsManifest, manifestAt } from "./fs/manifest.js";
55
+ import { runDirectories } from "./entries/run-directories.js";
56
56
  import { globExpression } from "./text/glob.js";
57
57
  /** The setting whose source decides where a finding about a configured root sits. */
58
58
  const ROOTS_SETTING = "roots.patterns";
@@ -82,14 +82,13 @@ function readProjects(engine, host, scope, config, stage) {
82
82
  const parse = (fileName, text) => engine.parseSourceFile(fileName, text);
83
83
  return loadRun(engine, host, scope, config, ({ plan, classified, runFiles }) => {
84
84
  const { packages, conventions } = plan;
85
+ const workflows = readWorkflows(host, targetRoot);
85
86
  const options = {
86
87
  host,
87
88
  manifest: packages.manifest,
88
89
  otherPackages: packages.entries,
89
90
  patterns: config.roots.patterns,
90
91
  entryFiles: config.ts.entry_files,
91
- conventions,
92
- testFiles: config.ts.test_files,
93
92
  parse,
94
93
  publishedAPI: config.target.kind !== undefined && kindOf(config.target.kind) === "library",
95
94
  publishedMembers: packages.published,
@@ -99,18 +98,17 @@ function readProjects(engine, host, scope, config, stage) {
99
98
  const answers = classified.analyzed.map(({ plan: planned, project, skips, referenceOnly }) => {
100
99
  const read = () => {
101
100
  const held = inventory(project, host, targetRoot);
102
- const found = roots(project, held, targetRoot, options);
103
- const kept = skippedRoots(project, held, skips);
104
- const rooted = kept.length === 0
105
- ? found
106
- : {
107
- ...found,
108
- liveUnderReachability: [
109
- ...found.liveUnderReachability,
110
- ...kept.map((id) => ({ id, kind: "type-error", source: "" })),
111
- ],
112
- };
113
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 });
114
112
  return {
115
113
  configuration: planned.id,
116
114
  configFile: project.configFile,
@@ -122,8 +120,8 @@ function readProjects(engine, host, scope, config, stage) {
122
120
  .ownSourceFiles()
123
121
  .filter((file) => referenceOnly(file.fileName))
124
122
  .flatMap((file) => relativePath(absoluteRoot, file.fileName) ?? []),
125
- generated: generatedFilesOf(own, generatedFiles(conventions, own)),
126
- testFileNames: conventions.testFiles,
123
+ generated: generatedFilesOf(own, sources.generated),
124
+ sources,
127
125
  };
128
126
  };
129
127
  for (const file of project.ownSourceFiles()) {
@@ -134,12 +132,12 @@ function readProjects(engine, host, scope, config, stage) {
134
132
  const consumed = new Map();
135
133
  for (const { project, consumer } of classified.consumed) {
136
134
  const side = { id: consumer.id, root: consumer.path };
137
- for (const reference of consumerReferences(project, host, targetRoot, side, config)) {
135
+ for (const reference of consumerReferences(project, host, targetRoot, side, config, parse)) {
138
136
  consumed.set(referenceKey(reference), reference);
139
137
  }
140
138
  }
141
139
  const outsideTests = testFilesAt(host, targetRoot, sourcePaths(host, targetRoot).filter((path) => !heldFiles.has(path) && testPatterns.some((pattern) => pattern.test(path))), parse);
142
- return { answers, references: [...consumed.values()], outsideTests };
140
+ return { answers, references: [...consumed.values()], outsideTests, workflows };
143
141
  });
144
142
  }
145
143
  /**
@@ -267,11 +265,13 @@ function readRun(engine, host, scope, config, mode, detectors, extra) {
267
265
  ? { delimiters: config.analysis.template_delimiters, files: [] }
268
266
  : readTemplates(host, targetRoot, config.analysis);
269
267
  const consumers = scope.consumers.map((consumer) => consumer.path);
268
+ const directories = runDirectories(host, targetRoot, (fileName, text) => engine.parseSourceFile(fileName, text));
270
269
  const read = readProjects(engine, host, scope, config, (project, opened) => {
271
270
  const projectRead = opened.read();
272
271
  const resolved = references(project, projectRead.held, targetRoot, {
273
272
  testFiles: config.ts.test_files,
274
- testFileNames: projectRead.testFileNames,
273
+ testFileNames: projectRead.sources.testFiles,
274
+ directories,
275
275
  });
276
276
  const evidence = evidenceRecords({
277
277
  project,
@@ -295,7 +295,6 @@ function readRun(engine, host, scope, config, mode, detectors, extra) {
295
295
  testFiles: resolved.testFilePaths,
296
296
  evidence,
297
297
  componentFiles: components.map(pathOf),
298
- augmented: mergedGlobalInterfaces(project, projectRead.held, sourceFilesOf(project, targetRoot)).map((id) => ({ id, kind: "global-augmentation", source: "" })),
299
298
  imports: new Map(project.ownSourceFiles().flatMap((file) => {
300
299
  const path = relativePath(targetRoot, file.fileName);
301
300
  if (path === undefined) {
@@ -318,7 +317,10 @@ function readRun(engine, host, scope, config, mode, detectors, extra) {
318
317
  reason: warning.reason,
319
318
  }))),
320
319
  decoded: decodedMembers(project, projectRead.held, productionFiles(project, targetRoot, resolved.testFilePaths), consumers),
321
- 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
+ }))),
322
324
  };
323
325
  });
324
326
  const outsidePaths = read.result.outsideTests.map((one) => one.path);
@@ -332,7 +334,9 @@ function readRun(engine, host, scope, config, mode, detectors, extra) {
332
334
  }));
333
335
  // Test-support code is code only test code imports in any configuration of the run: a
334
336
  // configuration that holds no test file says nothing about what the tests import.
335
- 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));
336
340
  // A member a decode fills or a copy carries is written: a value decoded and sent again carries it on.
337
341
  const written = new Set([
338
342
  ...countedWrites([...withOutside.flatMap((one) => one.references), ...read.result.references], support, mode),
@@ -363,9 +367,7 @@ function readRun(engine, host, scope, config, mode, detectors, extra) {
363
367
  configuration: projectRead.configuration,
364
368
  symbols: projectRead.held.symbols,
365
369
  references: [...made, ...evidenceReferences(projectRead.held.symbols, detected.inTestFiles)],
366
- // The augmentations are rooted after test support is read: an outside declaration
367
- // naming one calls nothing of its file.
368
- roots: [...projectRead.rooted.liveUnderReachability, ...one.augmented],
370
+ roots: projectRead.rooted.liveUnderReachability,
369
371
  testFiles: [...one.testFiles, ...supportFiles],
370
372
  ...(supportFiles.length === 0 ? {} : { supportFiles }),
371
373
  ...(testUsedFiles.length === 0 ? {} : { testUsedFiles }),
@@ -431,6 +433,7 @@ function readRun(engine, host, scope, config, mode, detectors, extra) {
431
433
  conventionUses: read.plan.conventions.uses,
432
434
  memberDirs: read.plan.packages.members,
433
435
  nestedDirs: read.plan.packages.nested,
436
+ workflows: read.result.workflows,
434
437
  };
435
438
  }
436
439
  /**
@@ -582,19 +585,19 @@ function productionFiles(project, targetRoot, testFiles) {
582
585
  /** Reads a run's projects with every per-project fact an emitter reads. */
583
586
  export function readEmitterRun(engine, host, scope, config, mode, detectors) {
584
587
  const targetRoot = scope.target.path;
585
- 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) => ({
586
589
  deprecation: deprecatedDeclarations(project, read.held),
587
590
  accessors: accessorsOf(project, read.held),
588
- 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),
589
592
  implementations: implementations(project, read.held),
590
593
  heldByInclusion: heldByInclusion(project, targetRoot),
591
- generated: [...read.generated.keys()],
594
+ generated: read.generated,
592
595
  inOperands: inOperandNames(project, targetRoot, testFiles),
593
596
  rooted: read.rooted,
594
597
  directives: inlineDirectives(project, read.held, targetRoot).filter((directive) => !read.referenceOnly.includes(directive.site.path)),
595
598
  declarationsNamed: declarationsNamed(project, read.held, configuredDeclarations(config)),
596
599
  parts: projectParts(project, read.held, references, targetRoot),
597
- unseenLoads: unseenLoadsOf(project, read.configuration, targetRoot, testFiles),
600
+ unseenLoads,
598
601
  }));
599
602
  // Whether a declaration carries the marker decides its code, so one whose answer went
600
603
  // unread is reported by nothing.
@@ -658,12 +661,12 @@ export function emitterInputOver(host, scope, config, read, input, selfCheck) {
658
661
  references: one.configured.references,
659
662
  accessors: one.extra.accessors,
660
663
  })), swept.exempt, input.mode),
661
- 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),
662
665
  implementations: mergeImplementations(projects.map((one) => one.extra.implementations)),
663
666
  files: {
664
667
  tree: sourceTree(host, targetRoot),
665
668
  heldByInclusion: new Set(projects.flatMap((one) => one.extra.heldByInclusion)),
666
- generated: new Set(projects.flatMap((one) => one.extra.generated)),
669
+ generated: new Set(projects.flatMap((one) => [...one.extra.generated.keys()])),
667
670
  inOperands: new Set(projects.flatMap((one) => one.extra.inOperands)),
668
671
  unseenLoads: projects.flatMap((one) => one.extra.unseenLoads),
669
672
  },
@@ -721,6 +724,7 @@ function readAnalysis(engine, host, scope, config, provenance, mode, detectors)
721
724
  unmappedEntries: unmappedEverywhere(read.projects),
722
725
  heldScripts: read.projects.flatMap((one) => one.heldScripts.map((held) => ({ ...held, configFile: one.configFile }))),
723
726
  unseenLoads: read.projects.flatMap((one) => one.extra.unseenLoads),
727
+ generated: new Map(read.projects.flatMap((one) => [...one.extra.generated])),
724
728
  },
725
729
  configured: read.projects.map((one) => one.configured),
726
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:4a66f7f01b0f1a23cf843b77ef48d762f2dcf486153e665560f107f10b0ea838",
7
+ digest: "sha256:d8d2a417c5cb9b3829739424d9cfd3bd7b631231d8f420300656f6df86f5a6d1",
8
8
  },
9
9
  gaps: [],
10
10
  };
@@ -1,3 +1,4 @@
1
+ import { runDirectories } from "./entries/run-directories.js";
1
2
  import { inventory } from "./inventory/enumerate.js";
2
3
  import { relativePath } from "./paths.js";
3
4
  import { references } from "./references.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,6 +1346,7 @@ 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",