@cplieger/deadset-ts 7.2.0-dev.4 → 8.0.0-dev.10

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 (288) hide show
  1. package/README.md +1 -1
  2. package/dist/bin/mapper-connection.js +2 -1
  3. package/dist/bin/node-host.js +24 -5
  4. package/dist/src/analysis.js +245 -309
  5. package/dist/src/augmentations.js +124 -18
  6. package/dist/src/automatic-types.js +170 -0
  7. package/dist/src/build-scripts.js +425 -0
  8. package/dist/src/component-layer.js +4 -2
  9. package/dist/src/components.js +9 -9
  10. package/dist/src/config.js +6 -81
  11. package/dist/src/configuration-files.js +78 -188
  12. package/dist/src/configured-declarations.js +15 -20
  13. package/dist/src/conformance-record.js +2 -2
  14. package/dist/src/consumers.js +3 -30
  15. package/dist/src/contextual-uses.js +56 -9
  16. package/dist/src/contract/config.generated.js +558 -0
  17. package/dist/src/contract/contract.generated.js +1244 -0
  18. package/dist/src/contract/report.generated.js +862 -0
  19. package/dist/src/convention-rows.js +146 -1
  20. package/dist/src/conventions.js +136 -70
  21. package/dist/src/decorator.js +21 -18
  22. package/dist/src/dependencies.js +280 -62
  23. package/dist/src/edges.js +38 -122
  24. package/dist/src/element-access.js +4 -6
  25. package/dist/src/entry-point-gaps.js +9 -18
  26. package/dist/src/entry-points.js +106 -21
  27. package/dist/src/enum-group.js +3 -10
  28. package/dist/src/erased-stores.js +4 -6
  29. package/dist/src/exempt-classes.js +1 -63
  30. package/dist/src/exempt.js +21 -40
  31. package/dist/src/failure.js +36 -0
  32. package/dist/src/file-facts.js +2 -25
  33. package/dist/src/findings/completion.js +225 -63
  34. package/dist/src/findings/dependencies-and-module-machinery.js +72 -27
  35. package/dist/src/findings/emitters.js +6 -6
  36. package/dist/src/findings/interfaces.js +4 -5
  37. package/dist/src/findings/intra-function.js +53 -19
  38. package/dist/src/findings/non-code-artifacts.js +71 -39
  39. package/dist/src/findings/reads-and-writes.js +16 -13
  40. package/dist/src/findings/self-check.js +10 -12
  41. package/dist/src/findings/unused-declarations.js +57 -28
  42. package/dist/src/findings/visibility-narrowing.js +40 -18
  43. package/dist/src/findings-pass.js +8 -15
  44. package/dist/src/framework-lifecycle.js +7 -7
  45. package/dist/src/fs/document.js +52 -0
  46. package/dist/src/fs/manifest.js +72 -0
  47. package/dist/src/fs/tree.js +88 -0
  48. package/dist/src/generated-file.js +18 -4
  49. package/dist/src/git-ignore.js +99 -0
  50. package/dist/src/graph.js +9 -4
  51. package/dist/src/html-entries.js +6 -33
  52. package/dist/src/import-bindings.js +97 -0
  53. package/dist/src/in-operands.js +2 -1
  54. package/dist/src/index.js +1 -1
  55. package/dist/src/indexed-access.js +130 -28
  56. package/dist/src/injection-container.js +1 -1
  57. package/dist/src/interface-satisfaction.js +30 -12
  58. package/dist/src/intra-function-parts.js +341 -69
  59. package/dist/src/inventory.js +54 -29
  60. package/dist/src/javascript-file.js +33 -0
  61. package/dist/src/json-document.js +198 -67
  62. package/dist/src/keyof-comparisons.js +4 -6
  63. package/dist/src/kinds.js +3 -366
  64. package/dist/src/load/classify.js +270 -0
  65. package/dist/src/load/diagnostics.js +80 -0
  66. package/dist/src/load/discover.js +277 -0
  67. package/dist/src/{emit-map.js → load/emit-map.js} +1 -1
  68. package/dist/src/load/expected-module.js +136 -0
  69. package/dist/src/load/load.js +27 -0
  70. package/dist/src/load/module-lookup.js +37 -0
  71. package/dist/src/load/plan.js +313 -0
  72. package/dist/src/load/specifiers.js +115 -0
  73. package/dist/src/load/synthesize.js +140 -0
  74. package/dist/src/load/test-globals.js +207 -0
  75. package/dist/src/load/test-joins.js +82 -0
  76. package/dist/src/{workspace-manifests.js → load/workspace-manifests.js} +4 -4
  77. package/dist/src/{workspace-programs.js → load/workspace-programs.js} +88 -61
  78. package/dist/src/{workspace-resolution.js → load/workspace-resolution.js} +60 -59
  79. package/dist/src/{workspace-run.js → load/workspace-run.js} +7 -7
  80. package/dist/src/{workspace.js → load/workspace.js} +62 -124
  81. package/dist/src/manifest.js +49 -54
  82. package/dist/src/matrix.js +94 -13
  83. package/dist/src/mdx-entries.js +174 -0
  84. package/dist/src/module-declarations.js +9 -13
  85. package/dist/src/outside-tests.js +1 -1
  86. package/dist/src/overrides.js +41 -10
  87. package/dist/src/partial.js +2 -1
  88. package/dist/src/paths.js +26 -15
  89. package/dist/src/position.js +2 -1
  90. package/dist/src/print.js +11 -78
  91. package/dist/src/product.js +13 -0
  92. package/dist/src/query.js +1 -0
  93. package/dist/src/ref.js +11 -0
  94. package/dist/src/references.js +52 -31
  95. package/dist/src/report-schema.js +51 -0
  96. package/dist/src/report.js +59 -41
  97. package/dist/src/reporters/annotations.js +15 -8
  98. package/dist/src/reporters/sarif.js +16 -10
  99. package/dist/src/reporters/template.js +4 -19
  100. package/dist/src/resolve.js +245 -727
  101. package/dist/src/roots.js +374 -116
  102. package/dist/src/run.js +66 -77
  103. package/dist/src/schema.js +320 -342
  104. package/dist/src/scope.js +38 -115
  105. package/dist/src/serialization-contract.js +649 -29
  106. package/dist/src/session.js +41 -29
  107. package/dist/src/source-files.js +40 -15
  108. package/dist/src/suppress-file.js +34 -29
  109. package/dist/src/suppress-inline.js +21 -4
  110. package/dist/src/suppress.js +40 -56
  111. package/dist/src/sweep.js +32 -17
  112. package/dist/src/symbol-keys.js +105 -6
  113. package/dist/src/template-field.js +9 -19
  114. package/dist/src/test-support.js +119 -18
  115. package/dist/src/text/compare.js +26 -0
  116. package/dist/src/text/glob.js +194 -0
  117. package/dist/src/text/named-files.js +54 -0
  118. package/dist/src/text/shell.js +159 -0
  119. package/dist/src/text/yaml.js +393 -0
  120. package/dist/src/type-errors.js +27 -221
  121. package/dist/src/type-parameter-reads.js +172 -0
  122. package/dist/src/unseen-loads.js +100 -0
  123. package/dist/src/unwrap.js +23 -0
  124. package/dist/src/usage.js +10 -0
  125. package/dist/src/verbs/analyze.js +181 -125
  126. package/dist/src/verbs/describe.js +9 -16
  127. package/dist/src/verbs/explain.js +14 -9
  128. package/dist/src/verbs/print-config.js +2 -1
  129. package/dist/src/verbs/print-projects.js +6 -4
  130. package/dist/src/verbs/print-retained.js +4 -2
  131. package/dist/src/verbs/print-roots.js +4 -2
  132. package/dist/src/verbs/verb.js +1 -5
  133. package/dist/src/verbs/version.js +14 -3
  134. package/dist/src/workflow-steps.js +128 -33
  135. package/jsr.json +1 -1
  136. package/package.json +5 -4
  137. package/src/analysis.ts +333 -457
  138. package/src/augmentations.ts +152 -23
  139. package/src/automatic-types.ts +228 -0
  140. package/src/build-scripts.ts +543 -0
  141. package/src/component-layer.ts +4 -2
  142. package/src/components.ts +9 -10
  143. package/src/config.ts +31 -299
  144. package/src/configuration-files.ts +100 -191
  145. package/src/configured-declarations.ts +18 -23
  146. package/src/conformance-record.ts +2 -2
  147. package/src/consumers.ts +6 -57
  148. package/src/contextual-uses.ts +64 -12
  149. package/src/contract/config.generated.ts +818 -0
  150. package/src/contract/contract.generated.ts +1308 -0
  151. package/src/contract/report.generated.ts +1237 -0
  152. package/src/convention-rows.ts +186 -1
  153. package/src/conventions.ts +166 -90
  154. package/src/decorator.ts +28 -18
  155. package/src/dependencies.ts +356 -78
  156. package/src/edges.ts +41 -140
  157. package/src/element-access.ts +4 -7
  158. package/src/entry-point-gaps.ts +11 -20
  159. package/src/entry-points.ts +124 -28
  160. package/src/enum-group.ts +2 -11
  161. package/src/erased-stores.ts +3 -7
  162. package/src/exempt-classes.ts +1 -75
  163. package/src/exempt.ts +36 -50
  164. package/src/failure.ts +63 -0
  165. package/src/file-facts.ts +9 -24
  166. package/src/finding.ts +24 -9
  167. package/src/findings/boundary.ts +2 -0
  168. package/src/findings/completion.ts +297 -77
  169. package/src/findings/dependencies-and-module-machinery.ts +90 -31
  170. package/src/findings/emitter.ts +8 -9
  171. package/src/findings/emitters.ts +8 -8
  172. package/src/findings/interfaces.ts +4 -6
  173. package/src/findings/intra-function.ts +64 -20
  174. package/src/findings/non-code-artifacts.ts +88 -50
  175. package/src/findings/reads-and-writes.ts +20 -16
  176. package/src/findings/self-check.ts +11 -17
  177. package/src/findings/unused-declarations.ts +65 -28
  178. package/src/findings/visibility-narrowing.ts +51 -19
  179. package/src/findings-pass.ts +10 -19
  180. package/src/framework-lifecycle.ts +7 -7
  181. package/src/fs/document.ts +70 -0
  182. package/src/fs/manifest.ts +92 -0
  183. package/src/fs/tree.ts +110 -0
  184. package/src/generated-file.ts +23 -4
  185. package/src/git-ignore.ts +122 -0
  186. package/src/graph.ts +11 -3
  187. package/src/host.ts +17 -14
  188. package/src/html-entries.ts +6 -33
  189. package/src/import-bindings.ts +128 -0
  190. package/src/in-operands.ts +2 -1
  191. package/src/index.ts +1 -1
  192. package/src/indexed-access.ts +152 -30
  193. package/src/injection-container.ts +1 -1
  194. package/src/interface-satisfaction.ts +33 -13
  195. package/src/intra-function-parts.ts +449 -85
  196. package/src/inventory.ts +73 -27
  197. package/src/javascript-file.ts +37 -0
  198. package/src/json-document.ts +241 -76
  199. package/src/keyof-comparisons.ts +3 -7
  200. package/src/kinds.ts +5 -413
  201. package/src/load/classify.ts +397 -0
  202. package/src/load/diagnostics.ts +144 -0
  203. package/src/load/discover.ts +455 -0
  204. package/src/{emit-map.ts → load/emit-map.ts} +1 -1
  205. package/src/load/expected-module.ts +188 -0
  206. package/src/load/load.ts +73 -0
  207. package/src/load/module-lookup.ts +50 -0
  208. package/src/load/plan.ts +504 -0
  209. package/src/load/specifiers.ts +168 -0
  210. package/src/load/synthesize.ts +211 -0
  211. package/src/load/test-globals.ts +251 -0
  212. package/src/load/test-joins.ts +98 -0
  213. package/src/{workspace-manifests.ts → load/workspace-manifests.ts} +5 -5
  214. package/src/{workspace-programs.ts → load/workspace-programs.ts} +127 -80
  215. package/src/{workspace-resolution.ts → load/workspace-resolution.ts} +73 -64
  216. package/src/{workspace-run.ts → load/workspace-run.ts} +18 -16
  217. package/src/{workspace.ts → load/workspace.ts} +90 -134
  218. package/src/manifest.ts +81 -75
  219. package/src/matrix.ts +154 -18
  220. package/src/mdx-entries.ts +218 -0
  221. package/src/module-declarations.ts +11 -13
  222. package/src/outside-tests.ts +1 -1
  223. package/src/overrides.ts +51 -12
  224. package/src/partial.ts +3 -2
  225. package/src/paths.ts +27 -15
  226. package/src/position.ts +2 -1
  227. package/src/print.ts +12 -91
  228. package/src/product.ts +18 -0
  229. package/src/query.ts +11 -0
  230. package/src/ref.ts +13 -0
  231. package/src/references.ts +62 -32
  232. package/src/report-schema.ts +68 -0
  233. package/src/report.ts +105 -215
  234. package/src/reporters/annotations.ts +22 -11
  235. package/src/reporters/json.ts +1 -1
  236. package/src/reporters/reporter.ts +2 -4
  237. package/src/reporters/reporters.ts +1 -1
  238. package/src/reporters/sarif.ts +29 -16
  239. package/src/reporters/template.ts +4 -20
  240. package/src/reporters/text.ts +3 -3
  241. package/src/resolve.ts +283 -1111
  242. package/src/roots.ts +490 -137
  243. package/src/run.ts +75 -91
  244. package/src/schema.ts +391 -387
  245. package/src/scope.ts +46 -138
  246. package/src/serialization-contract.ts +818 -26
  247. package/src/session.ts +77 -54
  248. package/src/source-files.ts +67 -17
  249. package/src/suppress-file.ts +36 -34
  250. package/src/suppress-inline.ts +20 -3
  251. package/src/suppress.ts +52 -63
  252. package/src/sweep.ts +53 -18
  253. package/src/symbol-keys.ts +131 -7
  254. package/src/template-field.ts +15 -25
  255. package/src/test-support.ts +155 -18
  256. package/src/text/compare.ts +27 -0
  257. package/src/text/glob.ts +210 -0
  258. package/src/text/named-files.inputs.json +1522 -0
  259. package/src/text/named-files.ts +68 -0
  260. package/src/text/shell.ts +161 -0
  261. package/src/text/yaml.ts +423 -0
  262. package/src/type-errors.ts +35 -273
  263. package/src/type-parameter-reads.ts +227 -0
  264. package/src/unseen-loads.ts +134 -0
  265. package/src/unwrap.ts +34 -0
  266. package/src/usage.ts +10 -0
  267. package/src/verbs/analyze.ts +245 -161
  268. package/src/verbs/describe.ts +14 -15
  269. package/src/verbs/explain.ts +15 -13
  270. package/src/verbs/print-config.ts +2 -1
  271. package/src/verbs/print-projects.ts +6 -4
  272. package/src/verbs/print-retained.ts +4 -2
  273. package/src/verbs/print-roots.ts +4 -2
  274. package/src/verbs/verb.ts +2 -8
  275. package/src/verbs/version.ts +15 -3
  276. package/src/workflow-steps.ts +149 -34
  277. package/dist/src/discover.js +0 -347
  278. package/dist/src/glob.js +0 -65
  279. package/dist/src/pnpm-workspace.js +0 -120
  280. package/dist/src/setup-failure.js +0 -23
  281. package/dist/src/test-joins.js +0 -101
  282. package/dist/src/version.js +0 -7
  283. package/src/discover.ts +0 -510
  284. package/src/glob.ts +0 -67
  285. package/src/pnpm-workspace.ts +0 -135
  286. package/src/setup-failure.ts +0 -39
  287. package/src/test-joins.ts +0 -120
  288. package/src/version.ts +0 -7
@@ -10,6 +10,8 @@ const SCRIPT = "{js,jsx,ts,tsx}";
10
10
  const MODULE = "{js,mjs,ts,mts}";
11
11
  const ANY_MODULE = "{js,mjs,cjs,ts,mts,cts}";
12
12
  const VITE_CONFIG = `vite.config.${ANY_MODULE}`;
13
+ /** The legacy configuration files of ESLint: JSON, YAML or a CommonJS module. */
14
+ const ESLINTRC = [".eslintrc", ".eslintrc.json", ".eslintrc.{yml,yaml}", ".eslintrc.{js,cjs}"];
13
15
  const SVELTEKIT_ROUTE_FILES = "+{page,layout,server,page.server,layout.server,error}";
14
16
  /** SvelteKit's entries other than its parameter matchers. */
15
17
  const SVELTEKIT_ENTRIES = [
@@ -59,6 +61,50 @@ const ANGULAR_PACKAGE_KEYS = [
59
61
  "styles",
60
62
  "scripts",
61
63
  ].map((key) => ({ key, files: ["angular.json"] }));
64
+ /**
65
+ * The row of a code generator that writes its output below one directory its
66
+ * configuration's `property` sets, `fallback` where no configuration file sets it, so
67
+ * every file there is a generated file.
68
+ */
69
+ function outputDirectoryRow(row) {
70
+ return {
71
+ name: row.name,
72
+ package: row.package,
73
+ range: row.range,
74
+ entries: [],
75
+ generated: ["<output>"],
76
+ moves: [
77
+ {
78
+ id: "output",
79
+ defaults: [row.fallback],
80
+ readings: [{ property: row.property, files: row.files }],
81
+ },
82
+ ],
83
+ };
84
+ }
85
+ /**
86
+ * The test runners and the assertion, mock and runner libraries whose import is test
87
+ * evidence beside each runner a row reads test files for. Each applies whether or not a
88
+ * manifest declares it, so none is a row.
89
+ */
90
+ export const TEST_LIBRARIES = [
91
+ "@jest/globals",
92
+ "@playwright/test",
93
+ "ava",
94
+ "chai",
95
+ "expect",
96
+ "jasmine",
97
+ "jest",
98
+ "mocha",
99
+ "msw",
100
+ "nock",
101
+ "node:test",
102
+ "sinon",
103
+ "tap",
104
+ "uvu",
105
+ ];
106
+ /** The scopes every package of which is a test library. */
107
+ export const TEST_LIBRARY_SCOPES = ["@testing-library/"];
62
108
  /** Every row, ordered by name and then by range. */
63
109
  export const CONVENTION_ROWS = [
64
110
  {
@@ -79,6 +125,7 @@ export const CONVENTION_ROWS = [
79
125
  },
80
126
  {
81
127
  name: "astro",
128
+ bundles: true,
82
129
  package: "astro",
83
130
  range: ">=5.0.0 <8.0.0",
84
131
  entries: [
@@ -111,6 +158,26 @@ export const CONVENTION_ROWS = [
111
158
  package: "@babel/runtime",
112
159
  })),
113
160
  },
161
+ {
162
+ name: "docusaurus",
163
+ package: "@docusaurus/core",
164
+ range: ">=2.0.0 <4.0.0",
165
+ entries: [`src/pages/**/*.${SCRIPT}`, `src/theme/**/*.${SCRIPT}`],
166
+ moves: [],
167
+ },
168
+ {
169
+ name: "eslint",
170
+ package: "eslint",
171
+ range: ">=4.0.0 <10.0.0",
172
+ entries: [],
173
+ moves: [],
174
+ packageKeys: [{ key: "parser", files: ESLINTRC }],
175
+ prefixedNames: [
176
+ { property: "plugins", files: ESLINTRC, prefix: "eslint-plugin" },
177
+ { property: "extends", files: ESLINTRC, prefix: "eslint-plugin", marker: "plugin:" },
178
+ { property: "extends", files: ESLINTRC, prefix: "eslint-config" },
179
+ ],
180
+ },
114
181
  {
115
182
  name: "eslint",
116
183
  package: "eslint",
@@ -118,15 +185,23 @@ export const CONVENTION_ROWS = [
118
185
  entries: [`**/eslint.config.${ANY_MODULE}`],
119
186
  moves: [],
120
187
  },
188
+ {
189
+ name: "expo",
190
+ package: "expo",
191
+ range: ">=44.0.0 <60.0.0",
192
+ entries: [`{index,App}.${SCRIPT}`],
193
+ moves: [],
194
+ },
121
195
  {
122
196
  name: "expo-router",
123
197
  package: "expo-router",
124
- range: ">=3.0.0 <58.0.0",
198
+ range: ">=3.0.0 <59.0.0",
125
199
  entries: [`{,src/}app/**/*.${SCRIPT}`],
126
200
  moves: [],
127
201
  },
128
202
  {
129
203
  name: "next",
204
+ bundles: true,
130
205
  package: "next",
131
206
  range: ">=13.4.0 <17.0.0",
132
207
  generated: [".next"],
@@ -144,6 +219,7 @@ export const CONVENTION_ROWS = [
144
219
  },
145
220
  {
146
221
  name: "nuxt",
222
+ bundles: true,
147
223
  package: "nuxt",
148
224
  range: ">=3.0.0 <5.0.0",
149
225
  generated: [".nuxt"],
@@ -202,6 +278,37 @@ export const CONVENTION_ROWS = [
202
278
  },
203
279
  ],
204
280
  },
281
+ {
282
+ name: "oclif",
283
+ package: "@oclif/core",
284
+ range: ">=1.0.0 <5.0.0",
285
+ entries: [`src/{commands,hooks}/**/*.${SCRIPT}`],
286
+ moves: [],
287
+ manifestEntries: [
288
+ { key: "oclif.commands", directory: true },
289
+ { key: "oclif.hooks", directory: false },
290
+ ],
291
+ },
292
+ outputDirectoryRow({
293
+ name: "panda",
294
+ package: "@pandacss/dev",
295
+ range: ">=0.1.0 <2.0.0",
296
+ files: [`panda.config.${ANY_MODULE}`],
297
+ property: "outdir",
298
+ fallback: "styled-system",
299
+ }),
300
+ {
301
+ name: "parcel",
302
+ bundles: true,
303
+ package: "parcel",
304
+ range: ">=2.0.0 <3.0.0",
305
+ entries: [],
306
+ moves: [],
307
+ manifestEntries: [
308
+ { key: "source", directory: false },
309
+ { key: "targets.*.source", directory: false },
310
+ ],
311
+ },
205
312
  {
206
313
  name: "prettier",
207
314
  package: "prettier",
@@ -258,6 +365,13 @@ export const CONVENTION_ROWS = [
258
365
  },
259
366
  ],
260
367
  },
368
+ {
369
+ name: "react-scripts",
370
+ package: "react-scripts",
371
+ range: ">=1.0.0 <6.0.0",
372
+ entries: [`src/index.${SCRIPT}`, "src/setupProxy.js", `src/setupTests.${SCRIPT}`],
373
+ moves: [],
374
+ },
261
375
  {
262
376
  name: "remix",
263
377
  package: "@remix-run/dev",
@@ -285,6 +399,7 @@ export const CONVENTION_ROWS = [
285
399
  },
286
400
  {
287
401
  name: "rolldown",
402
+ bundles: true,
288
403
  package: "rolldown",
289
404
  range: ">=1.0.0 <2.0.0",
290
405
  entries: [],
@@ -330,6 +445,7 @@ export const CONVENTION_ROWS = [
330
445
  },
331
446
  {
332
447
  name: "storybook",
448
+ bundles: true,
333
449
  package: "storybook",
334
450
  range: ">=7.0.0 <11.0.0",
335
451
  entries: [
@@ -363,6 +479,7 @@ export const CONVENTION_ROWS = [
363
479
  },
364
480
  {
365
481
  name: "sveltekit",
482
+ bundles: true,
366
483
  package: "@sveltejs/kit",
367
484
  range: ">=2.0.0 <3.0.0",
368
485
  entries: [...SVELTEKIT_ENTRIES, "<params>/*.{js,ts}"],
@@ -428,6 +545,7 @@ export const CONVENTION_ROWS = [
428
545
  },
429
546
  {
430
547
  name: "sveltekit",
548
+ bundles: true,
431
549
  package: "@sveltejs/kit",
432
550
  range: ">=3.0.0 <4.0.0",
433
551
  entries: [...SVELTEKIT_ENTRIES, "<params>.{js,ts}"],
@@ -493,8 +611,34 @@ export const CONVENTION_ROWS = [
493
611
  },
494
612
  ],
495
613
  },
614
+ {
615
+ name: "tanstack-router",
616
+ package: "@tanstack/router-plugin",
617
+ range: ">=1.0.0 <2.0.0",
618
+ entries: [`<routes>/**/*.${SCRIPT}`],
619
+ moves: [
620
+ {
621
+ id: "routes",
622
+ defaults: ["src/routes"],
623
+ readings: [
624
+ { property: "routesDirectory", files: ["tsr.config.json"] },
625
+ {
626
+ property: "routesDirectory",
627
+ files: [VITE_CONFIG],
628
+ call: { module: "@tanstack/router-plugin/vite", export: "tanstackRouter" },
629
+ },
630
+ {
631
+ property: "routesDirectory",
632
+ files: [VITE_CONFIG],
633
+ call: { module: "@tanstack/router-plugin/vite", export: "TanStackRouterVite" },
634
+ },
635
+ ],
636
+ },
637
+ ],
638
+ },
496
639
  {
497
640
  name: "vite",
641
+ bundles: true,
498
642
  package: "vite",
499
643
  range: ">=8.0.0 <9.0.0",
500
644
  entries: [],
@@ -510,6 +654,7 @@ export const CONVENTION_ROWS = [
510
654
  },
511
655
  {
512
656
  name: "vitepress",
657
+ bundles: true,
513
658
  package: "vitepress",
514
659
  range: ">=1.0.0 <2.0.0-0 || >=2.0.0-alpha.0 <3.0.0",
515
660
  entries: [
@@ -5,34 +5,30 @@
5
5
  * directory a configuration property moves read from the property's literal value.
6
6
  * No configuration file is run.
7
7
  */
8
- import { isArrayLiteralExpression, isAsExpression, isBinaryExpression, isCallExpression, isClassDeclaration, isComputedPropertyName, isExportAssignment, isExportDeclaration, isExpressionStatement, isFunctionDeclaration, isIdentifier, isImportDeclaration, isNamedExports, isNamespaceImport, isNoSubstitutionTemplateLiteral, isNonNullExpression, isNumericLiteral, isObjectBindingPattern, isObjectLiteralExpression, isParenthesizedExpression, isPropertyAccessExpression, isPropertyAssignment, isSatisfiesExpression, isShorthandPropertyAssignment, isSpreadAssignment, isStringLiteral, isVariableStatement, SyntaxKind, } from "@typescript/native/ast";
8
+ import { isArrayLiteralExpression, isBinaryExpression, isCallExpression, isClassDeclaration, isComputedPropertyName, isExportAssignment, isExportDeclaration, isExpressionStatement, isFunctionDeclaration, isIdentifier, isImportDeclaration, isNamedExports, isNamespaceImport, isNoSubstitutionTemplateLiteral, isNumericLiteral, isObjectBindingPattern, isObjectLiteralExpression, isPropertyAccessExpression, isPropertyAssignment, isShorthandPropertyAssignment, isSpreadAssignment, isStringLiteral, isVariableStatement, SyntaxKind, } from "@typescript/native/ast";
9
9
  import { lineOf } from "./component-files.js";
10
10
  import { CONVENTION_ROWS, } from "./convention-rows.js";
11
11
  import { documentStrings } from "./configuration-files.js";
12
- import { globExpression } from "./glob.js";
13
- import { dirnamePath, joinPath, normalizePath, relativePath, resolvePath } from "./paths.js";
12
+ import { ancestors, dirnamePath, joinPath, normalizePath, relativePath, resolvePath, } from "./paths.js";
14
13
  import { satisfies } from "./version-range.js";
14
+ import { bytewise } from "./text/compare.js";
15
+ import { isRecord } from "./json-document.js";
16
+ import { unwrapped } from "./unwrap.js";
17
+ import { filesIn } from "./fs/tree.js";
18
+ import { DEPENDENCY_SECTIONS, INSTALLED_PACKAGES, MANIFEST, readJSON } from "./fs/manifest.js";
19
+ import { globExpression } from "./text/glob.js";
20
+ import { yamlDocument } from "./text/yaml.js";
15
21
  const JSON_EXTENSION = ".json";
22
+ /**
23
+ * A configuration file its tool reads as a YAML document, read as the JSON document it
24
+ * denotes. Its nodes' offsets are that JSON text's, so no move may read one: a failure's
25
+ * line would name the wrong line.
26
+ */
27
+ const YAML_NAME = /\.ya?ml$/u;
16
28
  /** A configuration file with no extension that its tool reads as a JSON document. */
17
29
  const JSON_RC = /^\.[\w-]+rc$/u;
18
30
  /** The sections an installed package is required by, so its absence fails the run. */
19
31
  const REQUIRED_SECTIONS = ["dependencies", "devDependencies"];
20
- const DEPENDENCY_SECTIONS = [
21
- ...REQUIRED_SECTIONS,
22
- "peerDependencies",
23
- "optionalDependencies",
24
- ];
25
- function isRecord(value) {
26
- return typeof value === "object" && value !== null && !Array.isArray(value);
27
- }
28
- function readJSON(host, path) {
29
- try {
30
- return JSON.parse(host.readFile(path));
31
- }
32
- catch {
33
- return undefined;
34
- }
35
- }
36
32
  function declares(manifest, name, sections = DEPENDENCY_SECTIONS) {
37
33
  if (!isRecord(manifest)) {
38
34
  return false;
@@ -48,32 +44,15 @@ function declares(manifest, name, sections = DEPENDENCY_SECTIONS) {
48
44
  * none, or `undefined` where no `node_modules` holds it.
49
45
  */
50
46
  function installedVersion(host, dir, name) {
51
- for (let at = normalizePath(dir);; at = dirnamePath(at)) {
52
- const path = joinPath(at, "node_modules", name, "package.json");
47
+ for (const at of ancestors(dir)) {
48
+ const path = joinPath(at, INSTALLED_PACKAGES, name, MANIFEST);
53
49
  if (host.kindOf(path) === "file") {
54
50
  const manifest = readJSON(host, path);
55
51
  const version = isRecord(manifest) ? manifest["version"] : undefined;
56
52
  return typeof version === "string" ? version : "";
57
53
  }
58
- if (dirnamePath(at) === at) {
59
- return undefined;
60
- }
61
54
  }
62
- }
63
- /** Whether one node wraps an expression without changing its value. */
64
- function isWrapper(node) {
65
- return (isParenthesizedExpression(node) ||
66
- isAsExpression(node) ||
67
- isSatisfiesExpression(node) ||
68
- isNonNullExpression(node));
69
- }
70
- /** The expression a wrapper that changes no value holds. */
71
- function unwrapped(node) {
72
- let at = node;
73
- while (isWrapper(at)) {
74
- at = at.expression;
75
- }
76
- return at;
55
+ return undefined;
77
56
  }
78
57
  /** The key one property is written with, where it is written as a name or as literal text. */
79
58
  function keyOf(property) {
@@ -471,6 +450,40 @@ function manifestKeyUses(manifest, keys) {
471
450
  const strings = keys.flatMap((key) => documentStrings(manifest[key]));
472
451
  return declared.filter((name) => strings.some((text) => text === name || text.startsWith(`${name}/`)));
473
452
  }
453
+ /** The extensions an entry a manifest entry key names without one may carry. */
454
+ const ENTRY_EXTENSIONS = "{js,jsx,mjs,cjs,ts,tsx,mts,cts}";
455
+ /** The characters that make a manifest string a pattern rather than a directory's name. */
456
+ const PATTERN = /[*?{}[\]]/u;
457
+ /**
458
+ * The entry globs one applied row's manifest entry keys write, below the manifest's
459
+ * directory: a directory's every module, or a file with or without an extension. A string
460
+ * that leaves the directory names nothing.
461
+ */
462
+ function manifestEntryGlobs(manifest, keys) {
463
+ const at = (value, path) => {
464
+ const [key, ...rest] = path;
465
+ if (key === undefined) {
466
+ return [value];
467
+ }
468
+ if (!isRecord(value)) {
469
+ return [];
470
+ }
471
+ const next = key === "*" ? Object.values(value) : Object.hasOwn(value, key) ? [value[key]] : [];
472
+ return next.flatMap((one) => at(one, rest));
473
+ };
474
+ return keys.flatMap(({ key, directory }) => at(manifest, key.split(".")).flatMap((value) => documentStrings(value).flatMap((text) => {
475
+ const path = normalizePath(text)
476
+ .replace(/^(?:\.\/)+/u, "")
477
+ .replace(/\/+$/u, "");
478
+ if (path === "" || path === ".." || path.startsWith("../") || path.startsWith("/")) {
479
+ return [];
480
+ }
481
+ if (!directory) {
482
+ return [path, `${path}.${ENTRY_EXTENSIONS}`];
483
+ }
484
+ return PATTERN.test(path) ? [] : [`${path}/**/*.${ENTRY_EXTENSIONS}`];
485
+ })));
486
+ }
474
487
  /**
475
488
  * Every value one file writes at one property's path inside the object it is read from:
476
489
  * the options argument of every call `call` names, or the file's default export. A string
@@ -528,17 +541,7 @@ function expand(template, resolved) {
528
541
  /** The configuration files in one directory that one glob names, by name. */
529
542
  function configurationFiles(host, dir, glob) {
530
543
  const expression = globExpression(glob);
531
- let entries;
532
- try {
533
- entries = host.readDirectory(dir);
534
- }
535
- catch {
536
- return [];
537
- }
538
- return entries
539
- .filter((entry) => !entry.directory && expression.test(entry.name))
540
- .map((entry) => entry.name)
541
- .sort();
544
+ return filesIn(host, dir, (name) => expression.test(name));
542
545
  }
543
546
  function resolveMove(host, parse, dir, row, move, resolved) {
544
547
  const set = [];
@@ -580,6 +583,14 @@ function readingFiles(host, parse, dir, files) {
580
583
  catch {
581
584
  continue;
582
585
  }
586
+ if (YAML_NAME.test(name)) {
587
+ const value = yamlDocument(text);
588
+ if (value !== undefined) {
589
+ const json = JSON.stringify(value);
590
+ found.push({ name, text: json, file: parse(`${path}${JSON_EXTENSION}`, json) });
591
+ }
592
+ continue;
593
+ }
583
594
  found.push({
584
595
  name,
585
596
  text,
@@ -618,7 +629,58 @@ function shortNameUses(host, parse, dir, manifest, readings) {
618
629
  }
619
630
  }
620
631
  }
621
- return [...used].filter((name) => declared.has(name)).sort(compare);
632
+ return [...used].filter((name) => declared.has(name)).sort(bytewise);
633
+ }
634
+ /**
635
+ * The package one value of a prefixed-name reading names, or none: ESLint's own naming,
636
+ * https://github.com/eslint/eslintrc/blob/main/lib/shared/naming.js
637
+ */
638
+ function prefixedPackage(value, reading) {
639
+ const { prefix, marker } = reading;
640
+ let name;
641
+ if (marker === undefined) {
642
+ if (value.includes(":") || value.startsWith(".") || value.startsWith("/")) {
643
+ return undefined;
644
+ }
645
+ const parts = value.split("/");
646
+ name = (value.startsWith("@") ? parts.slice(0, 2) : parts.slice(0, 1)).join("/");
647
+ }
648
+ else {
649
+ if (!value.startsWith(marker) || !value.includes("/", marker.length)) {
650
+ return undefined;
651
+ }
652
+ name = value.slice(marker.length, value.lastIndexOf("/"));
653
+ }
654
+ if (name === "") {
655
+ return undefined;
656
+ }
657
+ if (!name.startsWith("@")) {
658
+ return name.startsWith(`${prefix}-`) ? name : `${prefix}-${name}`;
659
+ }
660
+ const [scope, rest] = name.split("/");
661
+ if (rest === undefined || rest === "" || rest === prefix) {
662
+ return `${scope ?? name}/${prefix}`;
663
+ }
664
+ return rest.startsWith(`${prefix}-`) ? name : `${scope ?? name}/${prefix}-${rest}`;
665
+ }
666
+ /** The declared dependencies an applied row's prefixed names use. */
667
+ function prefixedNameUses(host, parse, dir, manifest, readings) {
668
+ const declared = new Set(DEPENDENCY_SECTIONS.flatMap((section) => {
669
+ const held = isRecord(manifest) ? manifest[section] : undefined;
670
+ return isRecord(held) ? Object.keys(held) : [];
671
+ }));
672
+ const used = new Set();
673
+ for (const reading of readings) {
674
+ for (const { file } of readingFiles(host, parse, dir, reading.files)) {
675
+ for (const value of readProperty(file, reading.property, reading.call, true).values) {
676
+ const named = prefixedPackage(value, reading);
677
+ if (named !== undefined && declared.has(named)) {
678
+ used.add(named);
679
+ }
680
+ }
681
+ }
682
+ }
683
+ return [...used].sort(bytewise);
622
684
  }
623
685
  /** The declared dependencies an applied row's helper settings use. */
624
686
  function helperUses(host, parse, dir, manifest, readings) {
@@ -675,13 +737,6 @@ function packageKeyUses(host, parse, dir, manifest, keys) {
675
737
  text.startsWith(`${name}/`) ||
676
738
  (text.startsWith(`${name}:`) && text.length > name.length + 1)));
677
739
  }
678
- /** Two strings ordered bytewise. */
679
- function compare(a, b) {
680
- if (a === b) {
681
- return 0;
682
- }
683
- return a < b ? -1 : 1;
684
- }
685
740
  /**
686
741
  * What the rows decide over the manifests the analysis reads. A row `disabled` names
687
742
  * is skipped before anything is read for it.
@@ -695,7 +750,7 @@ export function readConventions(host, parse, manifests, disabled, rows = CONVENT
695
750
  const selected = new Map();
696
751
  const testFiles = new Set();
697
752
  for (const manifest of manifests) {
698
- const declared = readJSON(host, joinPath(manifest.dir, "package.json"));
753
+ const declared = readJSON(host, joinPath(manifest.dir, MANIFEST));
699
754
  const versions = new Map();
700
755
  const missing = new Set();
701
756
  for (const row of rows) {
@@ -716,7 +771,7 @@ export function readConventions(host, parse, manifests, disabled, rows = CONVENT
716
771
  failures.push({
717
772
  dir: manifest.dir,
718
773
  failure: {
719
- setupClass: "missing-module",
774
+ failureClass: "missing-module",
720
775
  detail: `${manifest.path} declares ${row.package}, which no node_modules at or ` +
721
776
  `above its directory holds: run the package manager's install`,
722
777
  },
@@ -741,7 +796,7 @@ export function readConventions(host, parse, manifests, disabled, rows = CONVENT
741
796
  failures.push({
742
797
  dir: manifest.dir,
743
798
  failure: {
744
- setupClass: "convention-not-literal",
799
+ failureClass: "convention-not-literal",
745
800
  detail: where === "." ? failed : `${where}/${failed}`,
746
801
  },
747
802
  });
@@ -756,6 +811,10 @@ export function readConventions(host, parse, manifests, disabled, rows = CONVENT
756
811
  for (const name of shortNameUses(host, parse, manifest.dir, declared, row.shortNames ?? [])) {
757
812
  uses.add(name);
758
813
  }
814
+ const prefixed = row.prefixedNames ?? [];
815
+ for (const name of prefixedNameUses(host, parse, manifest.dir, declared, prefixed)) {
816
+ uses.add(name);
817
+ }
759
818
  const keys = row.packageKeys ?? [];
760
819
  for (const name of packageKeyUses(host, parse, manifest.dir, declared, keys)) {
761
820
  uses.add(name);
@@ -774,7 +833,11 @@ export function readConventions(host, parse, manifests, disabled, rows = CONVENT
774
833
  for (const below of new Set((row.generated ?? []).flatMap((one) => expand(one, resolved)))) {
775
834
  generated.push({ dir: manifest.dir, row: row.name, below });
776
835
  }
777
- for (const glob of new Set(row.entries.flatMap((entry) => expand(entry, resolved)))) {
836
+ const written = [
837
+ ...row.entries.flatMap((entry) => expand(entry, resolved)),
838
+ ...manifestEntryGlobs(declared, row.manifestEntries ?? []),
839
+ ];
840
+ for (const glob of new Set(written)) {
778
841
  globs.push({
779
842
  dir: manifest.dir,
780
843
  row: row.name,
@@ -785,15 +848,15 @@ export function readConventions(host, parse, manifests, disabled, rows = CONVENT
785
848
  }
786
849
  }
787
850
  const unique = [...new Map(applied.map((one) => [JSON.stringify(one), one])).values()];
788
- unique.sort((a, b) => compare(a.name, b.name) ||
789
- compare(a.manifest, b.manifest) ||
790
- compare(JSON.stringify(a), JSON.stringify(b)));
851
+ unique.sort((a, b) => bytewise(a.name, b.name) ||
852
+ bytewise(a.manifest, b.manifest) ||
853
+ bytewise(JSON.stringify(a), JSON.stringify(b)));
791
854
  return {
792
855
  applied: unique,
793
856
  globs,
794
857
  generated,
795
858
  failures,
796
- uses: [...uses].sort(compare),
859
+ uses: [...uses].sort(bytewise),
797
860
  selected,
798
861
  testFiles,
799
862
  };
@@ -819,10 +882,13 @@ export function conventionEntries(conventions, files) {
819
882
  const found = new Map();
820
883
  for (const glob of conventions.globs) {
821
884
  for (const file of files.byName.values()) {
822
- const path = relativePath(glob.dir, file.fileName);
823
- if (path !== undefined &&
824
- glob.expression.test(path) &&
825
- !glob.excludes.some((one) => one.test(path))) {
885
+ const matched = [file.fileName, ...files.writtenAs(file)].some((name) => {
886
+ const path = relativePath(glob.dir, name);
887
+ return (path !== undefined &&
888
+ glob.expression.test(path) &&
889
+ !glob.excludes.some((one) => one.test(path)));
890
+ });
891
+ if (matched) {
826
892
  found.set(`${file.fileName}\u0000${glob.row}`, { file, row: glob.row });
827
893
  }
828
894
  }
@@ -1,14 +1,10 @@
1
1
  /**
2
- * The decorator class: a member a decorator expression is attached to, and every
3
- * member of a class a decorator expression is attached to, is held back, because the
4
- * decorator receives the member or the class when the class is defined and may reach
5
- * the member by its name.
6
- *
7
- * The rule is read from the tree alone: a decorator is attached where it is written.
8
- * The use the decorator itself makes of what it decorates is the reference pass's,
9
- * which records it as a `decorator` reference; this class records only that the
10
- * declaration is held back, and the member set of a decorated class is every member
11
- * the inventory holds for the class, static members included.
2
+ * The decorator class: a member a decorator expression is attached to, and every member
3
+ * of a class one is attached to but the member a parameter property declares, is held
4
+ * back, because the decorator may reach the member by its name. The rule is read from
5
+ * the tree alone. The decorator's own use of what it decorates is the reference pass's
6
+ * `decorator` reference; this class records only that the declaration is held back,
7
+ * static members of a decorated class included.
12
8
  */
13
9
  import { decoratorsOf, spelledDecorator } from "./calls.js";
14
10
  import { isParameterProperty, nodeKey, } from "./inventory.js";
@@ -34,25 +30,32 @@ export function decorator(input) {
34
30
  }
35
31
  }
36
32
  }
37
- const found = [];
33
+ const decorated = [];
34
+ // A decorated class's container passes each constructor argument, which keeps the
35
+ // parameter, not the member a parameter property stores it in.
36
+ const parameterMembers = new Set();
38
37
  for (const file of project.ownSourceFiles()) {
39
38
  const visit = (node) => {
40
39
  const id = held.declarations.get(nodeKey(file, node));
41
40
  const symbol = id === undefined ? undefined : byId.get(id);
41
+ if (id !== undefined && isParameterProperty(node)) {
42
+ parameterMembers.add(id);
43
+ }
42
44
  // A parameter property's decorator is attached to its parameter, and to no member.
43
45
  if (symbol !== undefined && DECORATED.has(symbol.kind) && !isParameterProperty(node)) {
44
46
  for (const attached of decoratorsOf(node)) {
45
- const detail = `decorated by ${spelledDecorator(attached)}`;
46
- const site = renderPosition(file, targetRoot, attached.getStart());
47
- const reached = symbol.kind === "class" ? (membersOf.get(symbol.id) ?? []) : [symbol];
48
- for (const member of reached) {
49
- found.push({ id: member.id, detail, site });
50
- }
47
+ decorated.push({
48
+ symbol,
49
+ detail: `decorated by ${spelledDecorator(attached)}`,
50
+ site: renderPosition(file, targetRoot, attached.getStart()),
51
+ });
51
52
  }
52
53
  }
53
54
  node.forEachChild(visit);
54
55
  };
55
56
  file.forEachChild(visit);
56
57
  }
57
- return found;
58
+ return decorated.flatMap(({ symbol, detail, site }) => (symbol.kind === "class"
59
+ ? (membersOf.get(symbol.id) ?? []).filter((member) => !parameterMembers.has(member.id))
60
+ : [symbol]).map((member) => ({ id: member.id, detail, site })));
58
61
  }