@cplieger/deadset-ts 8.0.0-dev.15 → 8.0.0-dev.17

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 (207) hide show
  1. package/dist/src/alias-chain.js +0 -5
  2. package/dist/src/amd.js +81 -0
  3. package/dist/src/analysis.js +94 -54
  4. package/dist/src/augmentations.js +23 -24
  5. package/dist/src/bindings.js +382 -0
  6. package/dist/src/calls.js +25 -8
  7. package/dist/src/commands/read.js +6 -7
  8. package/dist/src/commands/tools.js +5 -9
  9. package/dist/src/component-files.js +3 -2
  10. package/dist/src/conformance-record.js +1 -1
  11. package/dist/src/consumers.js +9 -10
  12. package/dist/src/contextual-uses.js +1 -17
  13. package/dist/src/contract/config.generated.js +5 -2
  14. package/dist/src/contract/contract.generated.js +119 -2
  15. package/dist/src/contract/report.generated.js +6 -2
  16. package/dist/src/dependencies.js +98 -71
  17. package/dist/src/destructuring.js +1 -19
  18. package/dist/src/element-access.js +179 -164
  19. package/dist/src/entries/build-scripts.js +222 -0
  20. package/dist/src/{configuration-files.js → entries/configuration-files.js} +22 -64
  21. package/dist/src/{convention-rows.js → entries/convention-rows.js} +120 -27
  22. package/dist/src/entries/conventions.js +739 -0
  23. package/dist/src/{html-entries.js → entries/html-entries.js} +9 -12
  24. package/dist/src/{mdx-entries.js → entries/mdx-entries.js} +3 -3
  25. package/dist/src/entries/run-directories.js +77 -0
  26. package/dist/src/entries/sources.js +144 -0
  27. package/dist/src/entries/static-module.js +670 -0
  28. package/dist/src/entries/test-runners.js +684 -0
  29. package/dist/src/{workflow-steps.js → entries/workflow-steps.js} +18 -8
  30. package/dist/src/extensions.js +37 -0
  31. package/dist/src/facts.js +38 -0
  32. package/dist/src/findings/completion.js +40 -4
  33. package/dist/src/findings/emitters.js +5 -8
  34. package/dist/src/{implementations.js → findings/implementations.js} +3 -3
  35. package/dist/src/{in-operands.js → findings/in-operands.js} +2 -2
  36. package/dist/src/findings/self-check.js +36 -20
  37. package/dist/src/findings-pass.js +5 -6
  38. package/dist/src/framework-lifecycle.js +42 -15
  39. package/dist/src/fs/manifest.js +15 -20
  40. package/dist/src/generated-file.js +172 -29
  41. package/dist/src/graph.js +14 -8
  42. package/dist/src/import-bindings.js +73 -28
  43. package/dist/src/index/sites.js +557 -0
  44. package/dist/src/index.js +1 -1
  45. package/dist/src/indexed-access.js +523 -478
  46. package/dist/src/injection-container.js +1 -1
  47. package/dist/src/interface-satisfaction.js +1 -1
  48. package/dist/src/inventory/commonjs.js +62 -17
  49. package/dist/src/inventory/enumerate.js +2 -1
  50. package/dist/src/javascript-file.js +26 -11
  51. package/dist/src/keyof-comparisons.js +124 -103
  52. package/dist/src/load/classify.js +28 -9
  53. package/dist/src/load/diagnostics.js +8 -1
  54. package/dist/src/load/discover.js +15 -7
  55. package/dist/src/load/expected-module.js +2 -2
  56. package/dist/src/load/plan.js +2 -2
  57. package/dist/src/load/specifiers.js +2 -4
  58. package/dist/src/load/synthesize.js +10 -5
  59. package/dist/src/load/workspace-manifests.js +1 -1
  60. package/dist/src/load/workspace-resolution.js +2 -2
  61. package/dist/src/matrix.js +12 -17
  62. package/dist/src/module-declarations.js +70 -85
  63. package/dist/src/overrides.js +134 -112
  64. package/dist/src/paths.js +56 -1
  65. package/dist/src/platform-calls.js +78 -0
  66. package/dist/src/platform-symbols.js +134 -0
  67. package/dist/src/references/read-rule.js +1 -0
  68. package/dist/src/references/read-rules.js +48 -0
  69. package/dist/src/references/sink.js +151 -0
  70. package/dist/src/references/sources.js +450 -0
  71. package/dist/src/references.js +111 -1116
  72. package/dist/src/resolve.js +1 -1
  73. package/dist/src/{configured-declarations.js → roots/configured-declarations.js} +7 -4
  74. package/dist/src/{entry-point-gaps.js → roots/entry-point-gaps.js} +5 -8
  75. package/dist/src/{manifest.js → roots/manifest.js} +4 -4
  76. package/dist/src/roots/published-reach.js +412 -0
  77. package/dist/src/roots/root-set.js +489 -0
  78. package/dist/src/roots/unseen-loads.js +236 -0
  79. package/dist/src/serialization-contract.js +9 -4
  80. package/dist/src/source-files.js +5 -9
  81. package/dist/src/stores.js +4 -2
  82. package/dist/src/suppress.js +30 -32
  83. package/dist/src/sweep.js +25 -13
  84. package/dist/src/symbol-keys.js +89 -83
  85. package/dist/src/tests/file-class.js +76 -0
  86. package/dist/src/{outside-tests.js → tests/outside.js} +7 -7
  87. package/dist/src/{test-support.js → tests/support.js} +5 -12
  88. package/dist/src/type-parameter-reads.js +178 -139
  89. package/dist/src/unimplemented-callees.js +262 -242
  90. package/dist/src/verbs/analyze.js +15 -3
  91. package/dist/src/verbs/describe.js +5 -3
  92. package/dist/src/verbs/explain.js +50 -28
  93. package/dist/src/verbs/print-retained.js +2 -2
  94. package/jsr.json +1 -1
  95. package/package.json +3 -3
  96. package/src/alias-chain.ts +0 -7
  97. package/src/amd.ts +130 -0
  98. package/src/analysis.ts +156 -70
  99. package/src/augmentations.ts +41 -27
  100. package/src/automatic-types.ts +1 -1
  101. package/src/bindings.ts +460 -0
  102. package/src/calls.ts +25 -7
  103. package/src/commands/read.ts +6 -8
  104. package/src/commands/tools.ts +5 -11
  105. package/src/component-files.ts +4 -2
  106. package/src/conformance-record.ts +1 -1
  107. package/src/consumers.ts +12 -11
  108. package/src/contextual-uses.ts +2 -22
  109. package/src/contract/config.generated.ts +5 -2
  110. package/src/contract/contract.generated.ts +138 -2
  111. package/src/contract/report.generated.ts +6 -2
  112. package/src/dependencies.ts +117 -71
  113. package/src/destructuring.ts +1 -31
  114. package/src/element-access.ts +188 -182
  115. package/src/entries/build-scripts.ts +292 -0
  116. package/src/{configuration-files.ts → entries/configuration-files.ts} +33 -82
  117. package/src/{convention-rows.ts → entries/convention-rows.ts} +167 -28
  118. package/src/{conventions.ts → entries/conventions.ts} +349 -523
  119. package/src/{html-entries.ts → entries/html-entries.ts} +19 -18
  120. package/src/{mdx-entries.ts → entries/mdx-entries.ts} +5 -5
  121. package/src/entries/run-directories.ts +108 -0
  122. package/src/entries/sources.ts +266 -0
  123. package/src/entries/static-module.ts +858 -0
  124. package/src/entries/test-runners.ts +868 -0
  125. package/src/{workflow-steps.ts → entries/workflow-steps.ts} +29 -11
  126. package/src/exempt.ts +3 -2
  127. package/src/extensions.ts +45 -0
  128. package/src/facts.ts +46 -0
  129. package/src/file-facts.ts +1 -1
  130. package/src/findings/boundary.ts +2 -0
  131. package/src/findings/completion.ts +43 -4
  132. package/src/findings/emitter.ts +1 -1
  133. package/src/findings/emitters.ts +14 -10
  134. package/src/{implementations.ts → findings/implementations.ts} +4 -4
  135. package/src/{in-operands.ts → findings/in-operands.ts} +3 -3
  136. package/src/findings/self-check.ts +41 -22
  137. package/src/findings/visibility-narrowing.ts +1 -1
  138. package/src/findings-pass.ts +5 -12
  139. package/src/framework-lifecycle.ts +43 -15
  140. package/src/fs/manifest.ts +25 -21
  141. package/src/generated-file.ts +240 -36
  142. package/src/graph.ts +27 -11
  143. package/src/import-bindings.ts +98 -29
  144. package/src/index/sites.ts +781 -0
  145. package/src/index.ts +1 -1
  146. package/src/indexed-access.ts +570 -527
  147. package/src/injection-container.ts +1 -1
  148. package/src/interface-satisfaction.ts +1 -1
  149. package/src/inventory/commonjs.ts +102 -17
  150. package/src/inventory/enumerate.ts +2 -1
  151. package/src/javascript-file.ts +29 -12
  152. package/src/keyof-comparisons.ts +131 -116
  153. package/src/load/classify.ts +49 -13
  154. package/src/load/diagnostics.ts +11 -1
  155. package/src/load/discover.ts +27 -11
  156. package/src/load/expected-module.ts +8 -2
  157. package/src/load/plan.ts +11 -2
  158. package/src/load/specifiers.ts +8 -5
  159. package/src/load/synthesize.ts +12 -6
  160. package/src/load/test-globals.ts +1 -1
  161. package/src/load/workspace-manifests.ts +1 -1
  162. package/src/load/workspace-resolution.ts +9 -2
  163. package/src/load/workspace-run.ts +1 -1
  164. package/src/matrix.ts +13 -17
  165. package/src/module-declarations.ts +74 -98
  166. package/src/overrides.ts +162 -134
  167. package/src/paths.ts +65 -1
  168. package/src/platform-calls.ts +119 -0
  169. package/src/platform-symbols.ts +189 -0
  170. package/src/references/read-rule.ts +60 -0
  171. package/src/references/read-rules.ts +55 -0
  172. package/src/references/sink.ts +213 -0
  173. package/src/references/sources.ts +632 -0
  174. package/src/references.ts +174 -1492
  175. package/src/report.ts +2 -2
  176. package/src/resolve.ts +1 -1
  177. package/src/{configured-declarations.ts → roots/configured-declarations.ts} +10 -7
  178. package/src/{entry-point-gaps.ts → roots/entry-point-gaps.ts} +5 -8
  179. package/src/{manifest.ts → roots/manifest.ts} +5 -5
  180. package/src/roots/published-reach.ts +481 -0
  181. package/src/{roots.ts → roots/root-set.ts} +203 -630
  182. package/src/roots/unseen-loads.ts +345 -0
  183. package/src/serialization-contract.ts +9 -4
  184. package/src/source-files.ts +5 -10
  185. package/src/stores.ts +13 -2
  186. package/src/suppress.ts +48 -33
  187. package/src/sweep.ts +37 -14
  188. package/src/symbol-keys.ts +102 -102
  189. package/src/tests/file-class.ts +118 -0
  190. package/src/{outside-tests.ts → tests/outside.ts} +16 -10
  191. package/src/{test-support.ts → tests/support.ts} +15 -21
  192. package/src/type-parameter-reads.ts +187 -158
  193. package/src/unimplemented-callees.ts +297 -280
  194. package/src/verbs/analyze.ts +19 -5
  195. package/src/verbs/describe.ts +5 -2
  196. package/src/verbs/explain.ts +75 -32
  197. package/src/verbs/print-retained.ts +2 -2
  198. package/dist/src/build-scripts.js +0 -418
  199. package/dist/src/conventions.js +0 -907
  200. package/dist/src/entry-points.js +0 -444
  201. package/dist/src/own-body.js +0 -28
  202. package/dist/src/roots.js +0 -865
  203. package/dist/src/unseen-loads.js +0 -189
  204. package/src/build-scripts.ts +0 -536
  205. package/src/entry-points.ts +0 -584
  206. package/src/own-body.ts +0 -42
  207. package/src/unseen-loads.ts +0 -282
package/src/consumers.ts CHANGED
@@ -1,16 +1,19 @@
1
1
  import type { PartialConfig } from "./config.ts";
2
+ import type { ParseFile } from "./entries/configuration-files.ts";
3
+ import { runDirectories } from "./entries/run-directories.ts";
2
4
  import type { Host } from "./host.ts";
3
5
  import { inventory } from "./inventory/enumerate.ts";
4
6
  import { relativePath } from "./paths.ts";
5
- import { references, type ConsumerSide, type Reference } from "./references.ts";
7
+ import { references, type ConsumerSide, type References } from "./references.ts";
6
8
  import { narrowedTo, type ProjectView } from "./session.ts";
9
+ import { patternTestFile } from "./tests/file-class.ts";
7
10
 
8
11
  /**
9
12
  * Every reference one consumer project's own files make to a declaration of the target.
10
13
  * The target's declarations are enumerated over the target's files the consumer's
11
14
  * program holds, against the target root, so each carries the identifier the target's
12
- * own projects give it. A reference from a consumer's test file is a test reference
13
- * unless the configuration counts it as a production one.
15
+ * own projects give it. A reference from a consumer's test file is a test reference;
16
+ * whether the run counts it as a production one is the sweep's mode.
14
17
  */
15
18
  export function consumerReferences<Brand>(
16
19
  project: ProjectView<Brand>,
@@ -18,18 +21,16 @@ export function consumerReferences<Brand>(
18
21
  targetRoot: string,
19
22
  consumer: ConsumerSide,
20
23
  config: PartialConfig,
21
- ): readonly Reference[] {
24
+ parse: ParseFile,
25
+ ): References {
22
26
  const held = inventory(
23
27
  narrowedTo(project, (file) => relativePath(targetRoot, file.fileName) !== undefined),
24
28
  host,
25
29
  targetRoot,
26
30
  );
27
- const found = references(project, held, targetRoot, {
28
- testFiles: config.ts.test_files,
31
+ return references(project, held, targetRoot, {
32
+ testFile: patternTestFile(config.ts.test_files, consumer.root),
29
33
  consumer,
30
- }).references;
31
- if (config.analysis.consumer_tests !== "production") {
32
- return found;
33
- }
34
- return found.map((reference) => (reference.test ? { ...reference, test: false } : reference));
34
+ directories: runDirectories(host, consumer.root, parse),
35
+ });
35
36
  }
@@ -56,16 +56,12 @@ interface ContextualUse {
56
56
  readonly ids: readonly string[];
57
57
  }
58
58
 
59
- /** What the contextual types of one project's literals and values use, and what asking cost. */
59
+ /** What the contextual types of one project's literals and values use. */
60
60
  interface ContextualUses {
61
61
  /** Each literal property that writes a member, by the property's node. */
62
62
  readonly writes: readonly ContextualUse[];
63
63
  /** Each value whose members a position typed by another object type reads. */
64
64
  readonly reads: readonly ContextualUse[];
65
- /** The batched lookups: contextual types and value types, one per capped run. */
66
- readonly batches: number;
67
- /** The per-type lookups: each distinct type's constituents, properties and declaring symbol. */
68
- readonly lookups: number;
69
65
  }
70
66
 
71
67
  /**
@@ -169,9 +165,6 @@ export function contextualUses<Brand>(
169
165
  .filter((symbol) => symbol.visibility === "private-name")
170
166
  .map((symbol) => symbol.id),
171
167
  );
172
- let batches = 0;
173
- let lookups = 0;
174
- const batchesOf = (count: number): number => Math.ceil(count / cap);
175
168
 
176
169
  const parts = new Map<number, readonly Type[]>();
177
170
  /** The object types one type is: itself, or its constituents at any depth. */
@@ -182,7 +175,6 @@ export function contextualUses<Brand>(
182
175
  }
183
176
  let found: readonly Type[] = [];
184
177
  if (type.isUnionType() || type.isIntersectionType()) {
185
- lookups += 1;
186
178
  const constituents = queries.constituents(type);
187
179
  found = isAnswered(constituents) ? constituents.flatMap(partsOf) : [];
188
180
  } else if (type.isObjectType()) {
@@ -201,7 +193,6 @@ export function contextualUses<Brand>(
201
193
  }
202
194
  const table = new Map<string, Member>();
203
195
  const read = properties.of(type);
204
- lookups += read.asked ? 1 : 0;
205
196
  for (const property of isAnswered(read.properties) ? read.properties : []) {
206
197
  table.set(property.name, {
207
198
  ids: chains
@@ -222,7 +213,6 @@ export function contextualUses<Brand>(
222
213
  };
223
214
 
224
215
  const writes: ContextualUse[] = [];
225
- batches += batchesOf(literals.length);
226
216
  const contexts = queries.contextualTypes(
227
217
  literals.map((one) => one.literal),
228
218
  cap,
@@ -238,7 +228,6 @@ export function contextualUses<Brand>(
238
228
  return name !== undefined && name.text === undefined ? [name.node] : [];
239
229
  }),
240
230
  );
241
- batches += batchesOf(computed.length);
242
231
  const keys = new Map<Node, string>();
243
232
  (computed.length === 0
244
233
  ? []
@@ -272,7 +261,6 @@ export function contextualUses<Brand>(
272
261
  });
273
262
 
274
263
  const carried = flows.filter((flow) => !isObjectLiteralExpression(flow.value));
275
- batches += batchesOf(carried.length);
276
264
  const types = queries.typesAt(
277
265
  carried.map((flow) => flow.value),
278
266
  cap,
@@ -327,11 +315,9 @@ export function contextualUses<Brand>(
327
315
  if (elements.has(type.id)) {
328
316
  return elements.get(type.id);
329
317
  }
330
- lookups += 1;
331
318
  const isArray = queries.isArray(type);
332
319
  let element: Type | undefined;
333
320
  if (isAnswered(isArray) && isArray) {
334
- lookups += 1;
335
321
  const held = queries.typeArguments(type);
336
322
  element = isAnswered(held) ? held[0] : undefined;
337
323
  }
@@ -346,7 +332,6 @@ export function contextualUses<Brand>(
346
332
  if (known !== undefined) {
347
333
  return known;
348
334
  }
349
- lookups += type.isTypeReference() ? 1 : 0;
350
335
  const held = queries.typeArguments(type);
351
336
  const found = isAnswered(held) ? held : [];
352
337
  argumentsOf.set(type.id, found);
@@ -363,11 +348,9 @@ export function contextualUses<Brand>(
363
348
  if (known !== undefined) {
364
349
  return known;
365
350
  }
366
- lookups += 1;
367
351
  let kind = SignatureKind.Call;
368
352
  let signatures = queries.signaturesOf(type, kind);
369
353
  if (isAnswered(signatures) && signatures.length === 0) {
370
- lookups += 1;
371
354
  kind = SignatureKind.Construct;
372
355
  signatures = queries.signaturesOf(type, kind);
373
356
  }
@@ -376,7 +359,6 @@ export function contextualUses<Brand>(
376
359
  queries.parameterType(signature, index),
377
360
  );
378
361
  const result = queries.returnTypeOf(signature);
379
- lookups += parameters.length + 1;
380
362
  return {
381
363
  kind,
382
364
  parameters: parameters.map((one) => (isAnswered(one) ? one : undefined)),
@@ -474,7 +456,6 @@ export function contextualUses<Brand>(
474
456
  const type = types[index];
475
457
  return type === undefined || !isAnswered(type) || !mayCarry(type) ? [] : [{ flow, type }];
476
458
  });
477
- batches += batchesOf(sourced.length);
478
459
  const positions = queries.contextualTypes(
479
460
  sourced.map((one) => one.flow.value),
480
461
  cap,
@@ -556,7 +537,6 @@ export function contextualUses<Brand>(
556
537
  isSpreadAssignment(property) ? [{ value: property.expression, from }] : [],
557
538
  ),
558
539
  );
559
- batches += batchesOf(spreads.length);
560
540
  const spreadTypes = queries.typesAt(
561
541
  spreads.map((one) => one.value),
562
542
  cap,
@@ -583,5 +563,5 @@ export function contextualUses<Brand>(
583
563
  reads.push({ at: value, from, ids });
584
564
  }
585
565
  });
586
- return { writes, reads, batches, lookups };
566
+ return { writes, reads };
587
567
  }
@@ -291,7 +291,7 @@ export const SETTINGS: readonly SettingRow[] = [
291
291
  role: "setting",
292
292
  read: true,
293
293
  default: [
294
- "**/*.test.{ts,tsx,mts,cts}",
294
+ "**/*.test.{ts,tsx,mts,cts,js,jsx,mjs,cjs}",
295
295
  "**/*.test-d.{ts,tsx,mts,cts}",
296
296
  "**/*.spec-d.{ts,tsx,mts,cts}",
297
297
  "**/*.spec.*",
@@ -501,7 +501,10 @@ export const SETTINGS: readonly SettingRow[] = [
501
501
  key: "provenance",
502
502
  role: "ignored",
503
503
  read: true,
504
- value: { type: "string", pattern: "^(default|(repository|central|flag): [^\\r\\n]+)$" },
504
+ value: {
505
+ type: "string",
506
+ pattern: "^(default|(repository|central|flag): ([^\\r\\n]|[\\r\\n])+)$",
507
+ },
505
508
  keyPattern: "^[a-z][a-z_]*(\\.[A-Za-z0-9_]+)*$",
506
509
  },
507
510
  ];
@@ -3,6 +3,7 @@
3
3
  export const CONTRACT_VERSION = "8.0.0";
4
4
  export const SCHEMA_VERSIONS = ["9.0.0"] as const;
5
5
  export const SCHEMA_VERSION = "9.0.0";
6
+ export const FACTS_VERSION = "1.0.0";
6
7
  export const CORPUS_VERSION = "6.0.0";
7
8
  export const CODE_PREFIX = "DS";
8
9
  export const FAMILY_KEY_LENGTH = 4;
@@ -34,16 +35,19 @@ export const LANGUAGE_ROWS = {
34
35
  analyzer: "deadset-go",
35
36
  markers: ["go.mod"],
36
37
  skippedDirectories: ["node_modules", "testdata", "vendor", ".*", "_*"],
38
+ skippedFiles: ["_*", ".*"],
37
39
  },
38
40
  ts: {
39
41
  analyzer: "deadset-ts",
40
42
  markers: ["tsconfig*.json", "jsconfig*.json"],
41
43
  skippedDirectories: ["node_modules", ".git"],
44
+ skippedFiles: ["*.min.js", "*.min.cjs", "*.min.mjs"],
42
45
  },
43
46
  proto: {
44
47
  analyzer: "deadset-proto",
45
48
  markers: ["buf.yaml", "buf.work.yaml"],
46
49
  skippedDirectories: ["node_modules", "vendor", ".*"],
50
+ skippedFiles: [],
47
51
  },
48
52
  } as const satisfies Readonly<
49
53
  Partial<
@@ -53,6 +57,7 @@ export const LANGUAGE_ROWS = {
53
57
  readonly analyzer: string;
54
58
  readonly markers: readonly string[];
55
59
  readonly skippedDirectories: readonly string[];
60
+ readonly skippedFiles: readonly string[];
56
61
  }
57
62
  >
58
63
  >
@@ -494,9 +499,9 @@ export const KIND_ROWS = [
494
499
  languages: ["go", "ts"],
495
500
  subject: "dependency",
496
501
  holdsLive: false,
497
- 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.",
502
+ 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.",
498
503
  precondition:
499
- "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.",
504
+ "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.",
500
505
  details: { dependency_class: "required" },
501
506
  defaultEnabled: true,
502
507
  defaultSeverity: "deny",
@@ -769,6 +774,49 @@ export const SYMBOL_SUBJECTS = {
769
774
  edge: "record",
770
775
  } as const satisfies Readonly<Record<string, Subject>>;
771
776
 
777
+ export const REMEDIES = {
778
+ declaration: {
779
+ names: "a declaration",
780
+ suppressions: ["inline", "ignore", "baseline"],
781
+ remedy: "delete the symbol, or wire it up so the program uses it",
782
+ },
783
+ binding: {
784
+ names: "an import binding",
785
+ suppressions: ["inline", "ignore", "baseline"],
786
+ remedy: "delete the import, or use what it binds",
787
+ },
788
+ part: {
789
+ names: "a part of a declaration",
790
+ suppressions: ["inline", "ignore", "baseline"],
791
+ remedy: "remove the part, or use it",
792
+ },
793
+ file: {
794
+ names: "a file",
795
+ suppressions: [],
796
+ remedy:
797
+ "delete the file, name it as a root, or build it in a configuration of the build matrix",
798
+ },
799
+ dependency: {
800
+ names: "a dependency row",
801
+ suppressions: ["ignore", "baseline"],
802
+ remedy: "remove the dependency",
803
+ },
804
+ record: {
805
+ names: "a record of deadset's own configuration",
806
+ suppressions: [],
807
+ remedy: "correct or remove the record the finding names",
808
+ },
809
+ } as const satisfies Readonly<
810
+ Record<
811
+ Subject,
812
+ {
813
+ readonly names: string;
814
+ readonly suppressions: readonly ("inline" | "ignore" | "baseline")[];
815
+ readonly remedy: string;
816
+ }
817
+ >
818
+ >;
819
+
772
820
  export const EXEMPTION_CLASSES = [
773
821
  {
774
822
  class: "interface-satisfaction",
@@ -1283,6 +1331,93 @@ export const EVIDENCE = [
1283
1331
  },
1284
1332
  ] as const;
1285
1333
 
1334
+ /** The generators whose TypeScript output a generated file is matched against, in the document's order. */
1335
+ export const GENERATORS = [
1336
+ {
1337
+ id: "protoc-gen-es-2",
1338
+ plugin: "protoc-gen-es",
1339
+ header: "^// @generated by protoc-gen-es v2\\.",
1340
+ versions: { min: "v2.10.0", max: "v2.16.0" },
1341
+ cell: "exact",
1342
+ },
1343
+ {
1344
+ id: "protoc-gen-es-2-fallback",
1345
+ plugin: "protoc-gen-es",
1346
+ header: "^// @generated by protoc-gen-es v2\\.",
1347
+ cell: "fallback",
1348
+ },
1349
+ {
1350
+ id: "protoc-gen-es-1",
1351
+ plugin: "protoc-gen-es",
1352
+ header: "^// @generated by protoc-gen-es v1\\.",
1353
+ cell: "exact",
1354
+ },
1355
+ {
1356
+ id: "protoc-gen-connect-es-1",
1357
+ plugin: "protoc-gen-connect-es",
1358
+ header: "^// @generated by protoc-gen-connect-es v1\\.",
1359
+ cell: "exact",
1360
+ },
1361
+ {
1362
+ id: "ts-proto-2-output-schema",
1363
+ plugin: "ts-proto",
1364
+ header: "^// Code generated by protoc-gen-ts_proto\\. DO NOT EDIT\\.$",
1365
+ versions: { min: "v2.11.4", max: "v2.15.0" },
1366
+ cell: "exact",
1367
+ },
1368
+ {
1369
+ id: "ts-proto-2",
1370
+ plugin: "ts-proto",
1371
+ header: "^// Code generated by protoc-gen-ts_proto\\. DO NOT EDIT\\.$",
1372
+ versions: { min: "v2.11.4", max: "v2.15.0" },
1373
+ cell: "rpc-types-fallback",
1374
+ },
1375
+ {
1376
+ id: "ts-proto-2-types",
1377
+ plugin: "ts-proto",
1378
+ header: "^// Code generated by protoc-gen-ts_proto\\. DO NOT EDIT\\.$",
1379
+ versions: { min: "v2.11.4", max: "v2.15.0" },
1380
+ cell: "fallback",
1381
+ },
1382
+ {
1383
+ id: "ts-proto-2-fallback",
1384
+ plugin: "ts-proto",
1385
+ header: "^// Code generated by protoc-gen-ts_proto\\. DO NOT EDIT\\.$",
1386
+ cell: "fallback",
1387
+ },
1388
+ {
1389
+ id: "protoc-gen-js",
1390
+ plugin: "protoc-gen-js",
1391
+ header: "^// GENERATED CODE -- DO NOT EDIT!$",
1392
+ cell: "fallback",
1393
+ },
1394
+ {
1395
+ id: "protoc-gen-grpc-web",
1396
+ plugin: "protoc-gen-grpc-web",
1397
+ header: "^// Code generated by protoc-gen-grpc-web\\. DO NOT EDIT\\.$",
1398
+ cell: "fallback",
1399
+ },
1400
+ {
1401
+ id: "protobuf-ts",
1402
+ plugin: "protobuf-ts",
1403
+ header: "^// @generated by protobuf-ts ",
1404
+ cell: "fallback",
1405
+ },
1406
+ { id: "ts-protoc-gen", plugin: "ts-protoc-gen", header: "^// package: ", cell: "fallback" },
1407
+ {
1408
+ id: "protoc-gen-es-unsupported",
1409
+ plugin: "protoc-gen-es",
1410
+ header: "^// @generated by protoc-gen-es v(?:0|[3-9]|[1-9][0-9]+)\\.",
1411
+ cell: "unsupported",
1412
+ },
1413
+ ] as const satisfies readonly {
1414
+ readonly id: string;
1415
+ readonly plugin: string;
1416
+ readonly header: string;
1417
+ readonly versions?: { readonly min: string; readonly max: string };
1418
+ readonly cell: string;
1419
+ }[];
1420
+
1286
1421
  /** Each group of failure classes, and the text opening the line that names one of its failures. */
1287
1422
  export const FAILURE_PREFIXES = { setup: "setup failure: ", run: "run failure: " } as const;
1288
1423
 
@@ -1294,6 +1429,7 @@ export const FAILURE_CLASSES = {
1294
1429
  "workspace-member-without-source": "setup",
1295
1430
  "convention-not-literal": "setup",
1296
1431
  "no-program": "setup",
1432
+ "unreadable-configuration": "setup",
1297
1433
  "unreadable-document": "setup",
1298
1434
  "missing-import-path": "setup",
1299
1435
  "binding-undecodable": "setup",
@@ -408,6 +408,11 @@ export const REPORT_SCHEMAS = {
408
408
  },
409
409
  else: { properties: { configurations: { minItems: 1 }, target: { required: ["kind"] } } },
410
410
  },
411
+ {
412
+ if: { required: ["merged_from"], properties: { merged_from: { maxItems: 0 } } },
413
+ then: { properties: { analyzer: { properties: { languages: { maxItems: 0 } } } } },
414
+ else: { properties: { analyzer: { properties: { languages: { minItems: 1 } } } } },
415
+ },
411
416
  ],
412
417
  properties: {
413
418
  schema_version: { type: "string", pattern: "^[0-9]+\\.[0-9]+\\.[0-9]+$" },
@@ -424,7 +429,6 @@ export const REPORT_SCHEMAS = {
424
429
  },
425
430
  languages: {
426
431
  type: "array",
427
- minItems: 1,
428
432
  uniqueItems: true,
429
433
  items: { type: "string", enum: ["go", "ts", "proto"] },
430
434
  },
@@ -460,7 +464,7 @@ export const REPORT_SCHEMAS = {
460
464
  pattern: "^[0-9]+\\.[0-9]+\\.[0-9]+(-[0-9A-Za-z.-]+)?(\\+[0-9A-Za-z.-]+)?$",
461
465
  },
462
466
  digest: { type: "string", pattern: "^sha256:[0-9a-f]{64}$" },
463
- languages: { $ref: "#/properties/analyzer/properties/languages" },
467
+ languages: { $ref: "#/properties/analyzer/properties/languages", minItems: 1 },
464
468
  totals: { $ref: "#/properties/totals" },
465
469
  },
466
470
  },