knip 5.68.0 → 5.69.0

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 (305) hide show
  1. package/dist/CatalogCounselor.d.ts +18 -0
  2. package/dist/CatalogCounselor.js +47 -0
  3. package/dist/ConfigurationChief.d.ts +6 -0
  4. package/dist/ConfigurationChief.js +3 -1
  5. package/dist/IssueFixer.d.ts +2 -1
  6. package/dist/IssueFixer.js +51 -3
  7. package/dist/JsonCatalogPeeker.d.ts +12 -0
  8. package/dist/JsonCatalogPeeker.js +68 -0
  9. package/dist/PackagePeeker.js +1 -0
  10. package/dist/YamlCatalogPeeker.d.ts +12 -0
  11. package/dist/YamlCatalogPeeker.js +66 -0
  12. package/dist/binaries/bash-parser.js +1 -1
  13. package/dist/compilers/index.d.ts +14 -4
  14. package/dist/constants.d.ts +9 -1
  15. package/dist/constants.js +9 -0
  16. package/dist/graph/analyze.d.ts +3 -1
  17. package/dist/graph/analyze.js +4 -1
  18. package/dist/graph/build.d.ts +3 -1
  19. package/dist/graph/build.js +2 -1
  20. package/dist/index.js +4 -0
  21. package/dist/plugins/_template/index.d.ts +3 -12
  22. package/dist/plugins/_template/index.js +2 -1
  23. package/dist/plugins/angular/index.d.ts +3 -10
  24. package/dist/plugins/angular/index.js +2 -1
  25. package/dist/plugins/astro/index.d.ts +3 -13
  26. package/dist/plugins/astro/index.js +2 -1
  27. package/dist/plugins/astro-db/index.d.ts +3 -8
  28. package/dist/plugins/astro-db/index.js +2 -1
  29. package/dist/plugins/ava/index.d.ts +3 -11
  30. package/dist/plugins/ava/index.js +2 -1
  31. package/dist/plugins/babel/index.d.ts +4 -10
  32. package/dist/plugins/babel/index.js +2 -1
  33. package/dist/plugins/biome/index.d.ts +3 -10
  34. package/dist/plugins/biome/index.js +2 -1
  35. package/dist/plugins/bumpp/index.d.ts +3 -8
  36. package/dist/plugins/bumpp/index.js +2 -1
  37. package/dist/plugins/bun/index.d.ts +3 -11
  38. package/dist/plugins/bun/index.js +2 -1
  39. package/dist/plugins/c8/index.d.ts +3 -10
  40. package/dist/plugins/c8/index.js +2 -1
  41. package/dist/plugins/capacitor/index.d.ts +3 -10
  42. package/dist/plugins/capacitor/index.js +2 -1
  43. package/dist/plugins/changelogen/index.d.ts +3 -9
  44. package/dist/plugins/changelogen/index.js +2 -1
  45. package/dist/plugins/changelogithub/index.d.ts +3 -9
  46. package/dist/plugins/changelogithub/index.js +2 -1
  47. package/dist/plugins/changesets/index.d.ts +3 -11
  48. package/dist/plugins/changesets/index.js +2 -1
  49. package/dist/plugins/commitizen/index.d.ts +3 -12
  50. package/dist/plugins/commitizen/index.js +2 -1
  51. package/dist/plugins/commitlint/index.d.ts +3 -10
  52. package/dist/plugins/commitlint/index.js +2 -1
  53. package/dist/plugins/convex/index.d.ts +3 -8
  54. package/dist/plugins/convex/index.js +2 -1
  55. package/dist/plugins/create-typescript-app/index.d.ts +3 -8
  56. package/dist/plugins/create-typescript-app/index.js +2 -1
  57. package/dist/plugins/cspell/index.d.ts +3 -10
  58. package/dist/plugins/cspell/index.js +2 -1
  59. package/dist/plugins/cucumber/index.d.ts +3 -11
  60. package/dist/plugins/cucumber/index.js +2 -1
  61. package/dist/plugins/cypress/index.d.ts +3 -11
  62. package/dist/plugins/cypress/index.js +2 -1
  63. package/dist/plugins/danger/index.d.ts +3 -8
  64. package/dist/plugins/danger/index.js +2 -1
  65. package/dist/plugins/dependency-cruiser/index.d.ts +3 -12
  66. package/dist/plugins/dependency-cruiser/index.js +2 -1
  67. package/dist/plugins/docusaurus/index.d.ts +3 -12
  68. package/dist/plugins/docusaurus/index.js +2 -1
  69. package/dist/plugins/dotenv/index.d.ts +3 -8
  70. package/dist/plugins/dotenv/index.js +2 -1
  71. package/dist/plugins/drizzle/index.d.ts +3 -10
  72. package/dist/plugins/drizzle/index.js +2 -1
  73. package/dist/plugins/eleventy/index.d.ts +3 -11
  74. package/dist/plugins/eleventy/index.js +2 -1
  75. package/dist/plugins/eslint/helpers.d.ts +1 -0
  76. package/dist/plugins/eslint/helpers.js +14 -1
  77. package/dist/plugins/eslint/index.d.ts +3 -19
  78. package/dist/plugins/eslint/index.js +7 -2
  79. package/dist/plugins/expo/index.d.ts +3 -11
  80. package/dist/plugins/expo/index.js +2 -1
  81. package/dist/plugins/gatsby/index.d.ts +3 -11
  82. package/dist/plugins/gatsby/index.js +2 -1
  83. package/dist/plugins/github-action/index.d.ts +3 -9
  84. package/dist/plugins/github-action/index.js +2 -1
  85. package/dist/plugins/github-actions/index.d.ts +3 -10
  86. package/dist/plugins/github-actions/index.js +2 -1
  87. package/dist/plugins/glob/index.d.ts +3 -11
  88. package/dist/plugins/glob/index.js +2 -1
  89. package/dist/plugins/graphql-codegen/index.d.ts +3 -11
  90. package/dist/plugins/graphql-codegen/index.js +2 -1
  91. package/dist/plugins/hardhat/index.d.ts +3 -9
  92. package/dist/plugins/hardhat/index.js +2 -1
  93. package/dist/plugins/husky/index.d.ts +3 -10
  94. package/dist/plugins/husky/index.js +2 -1
  95. package/dist/plugins/i18next-parser/index.d.ts +3 -12
  96. package/dist/plugins/i18next-parser/index.js +2 -1
  97. package/dist/plugins/index.d.ts +118 -942
  98. package/dist/plugins/index.js +2 -0
  99. package/dist/plugins/jest/index.d.ts +3 -14
  100. package/dist/plugins/jest/index.js +2 -1
  101. package/dist/plugins/karma/index.d.ts +3 -10
  102. package/dist/plugins/karma/index.js +2 -1
  103. package/dist/plugins/ladle/index.d.ts +3 -12
  104. package/dist/plugins/ladle/index.js +2 -1
  105. package/dist/plugins/lefthook/index.d.ts +3 -9
  106. package/dist/plugins/lefthook/index.js +2 -1
  107. package/dist/plugins/lint-staged/index.d.ts +3 -10
  108. package/dist/plugins/lint-staged/index.js +2 -1
  109. package/dist/plugins/linthtml/index.d.ts +3 -11
  110. package/dist/plugins/linthtml/index.js +2 -1
  111. package/dist/plugins/lockfile-lint/index.d.ts +3 -8
  112. package/dist/plugins/lockfile-lint/index.js +2 -1
  113. package/dist/plugins/lost-pixel/index.d.ts +3 -8
  114. package/dist/plugins/lost-pixel/index.js +2 -1
  115. package/dist/plugins/markdownlint/index.d.ts +3 -10
  116. package/dist/plugins/markdownlint/index.js +2 -1
  117. package/dist/plugins/mdx/index.d.ts +3 -0
  118. package/dist/plugins/mdx/index.js +32 -0
  119. package/dist/plugins/mdx/types.d.ts +3 -0
  120. package/dist/plugins/mdx/types.js +1 -0
  121. package/dist/plugins/mdxlint/index.d.ts +3 -10
  122. package/dist/plugins/mdxlint/index.js +7 -2
  123. package/dist/plugins/metro/index.d.ts +3 -11
  124. package/dist/plugins/metro/index.js +2 -1
  125. package/dist/plugins/mocha/index.d.ts +3 -14
  126. package/dist/plugins/mocha/index.js +2 -1
  127. package/dist/plugins/moonrepo/index.d.ts +3 -11
  128. package/dist/plugins/moonrepo/index.js +2 -1
  129. package/dist/plugins/msw/index.d.ts +3 -11
  130. package/dist/plugins/msw/index.js +2 -1
  131. package/dist/plugins/nano-staged/index.d.ts +3 -10
  132. package/dist/plugins/nano-staged/index.js +2 -1
  133. package/dist/plugins/nest/index.d.ts +3 -10
  134. package/dist/plugins/nest/index.js +2 -1
  135. package/dist/plugins/netlify/index.d.ts +3 -11
  136. package/dist/plugins/netlify/index.js +2 -1
  137. package/dist/plugins/next/index.d.ts +3 -10
  138. package/dist/plugins/next/index.js +2 -1
  139. package/dist/plugins/node/index.d.ts +3 -17
  140. package/dist/plugins/node/index.js +2 -1
  141. package/dist/plugins/node-modules-inspector/index.d.ts +3 -11
  142. package/dist/plugins/node-modules-inspector/index.js +2 -1
  143. package/dist/plugins/nodemon/index.d.ts +3 -10
  144. package/dist/plugins/nodemon/index.js +2 -1
  145. package/dist/plugins/npm-package-json-lint/index.d.ts +3 -11
  146. package/dist/plugins/npm-package-json-lint/index.js +2 -1
  147. package/dist/plugins/nuxt/index.d.ts +3 -12
  148. package/dist/plugins/nuxt/index.js +2 -1
  149. package/dist/plugins/nx/index.d.ts +3 -14
  150. package/dist/plugins/nx/index.js +2 -1
  151. package/dist/plugins/nyc/index.d.ts +3 -10
  152. package/dist/plugins/nyc/index.js +2 -1
  153. package/dist/plugins/oclif/index.d.ts +3 -10
  154. package/dist/plugins/oclif/index.js +2 -1
  155. package/dist/plugins/oxlint/index.d.ts +3 -11
  156. package/dist/plugins/oxlint/index.js +2 -1
  157. package/dist/plugins/playwright/index.d.ts +3 -15
  158. package/dist/plugins/playwright/index.js +2 -1
  159. package/dist/plugins/playwright-ct/index.d.ts +3 -10
  160. package/dist/plugins/playwright-ct/index.js +2 -1
  161. package/dist/plugins/playwright-test/index.d.ts +3 -12
  162. package/dist/plugins/playwright-test/index.js +2 -1
  163. package/dist/plugins/plop/index.d.ts +3 -8
  164. package/dist/plugins/plop/index.js +2 -1
  165. package/dist/plugins/pnpm/index.d.ts +3 -8
  166. package/dist/plugins/pnpm/index.js +2 -1
  167. package/dist/plugins/postcss/index.d.ts +3 -10
  168. package/dist/plugins/postcss/index.js +2 -1
  169. package/dist/plugins/preconstruct/index.d.ts +3 -10
  170. package/dist/plugins/preconstruct/index.js +2 -1
  171. package/dist/plugins/prettier/index.d.ts +3 -10
  172. package/dist/plugins/prettier/index.js +2 -1
  173. package/dist/plugins/prisma/index.d.ts +3 -13
  174. package/dist/plugins/prisma/index.js +10 -2
  175. package/dist/plugins/prisma/types.d.ts +3 -0
  176. package/dist/plugins/react-cosmos/index.d.ts +3 -11
  177. package/dist/plugins/react-cosmos/index.js +2 -1
  178. package/dist/plugins/react-router/index.d.ts +3 -10
  179. package/dist/plugins/react-router/index.js +3 -2
  180. package/dist/plugins/relay/index.d.ts +3 -15
  181. package/dist/plugins/relay/index.js +2 -1
  182. package/dist/plugins/release-it/index.d.ts +3 -10
  183. package/dist/plugins/release-it/index.js +2 -1
  184. package/dist/plugins/remark/index.d.ts +3 -11
  185. package/dist/plugins/remark/index.js +2 -1
  186. package/dist/plugins/remix/index.d.ts +3 -9
  187. package/dist/plugins/remix/index.js +2 -1
  188. package/dist/plugins/rollup/index.d.ts +3 -10
  189. package/dist/plugins/rollup/index.js +2 -1
  190. package/dist/plugins/rsbuild/index.d.ts +3 -10
  191. package/dist/plugins/rsbuild/index.js +2 -1
  192. package/dist/plugins/rslib/index.d.ts +3 -10
  193. package/dist/plugins/rslib/index.js +2 -1
  194. package/dist/plugins/rspack/index.d.ts +3 -10
  195. package/dist/plugins/rspack/index.js +2 -1
  196. package/dist/plugins/rstest/index.d.ts +3 -10
  197. package/dist/plugins/rstest/index.js +2 -1
  198. package/dist/plugins/semantic-release/index.d.ts +3 -12
  199. package/dist/plugins/semantic-release/index.js +2 -1
  200. package/dist/plugins/sentry/index.d.ts +3 -8
  201. package/dist/plugins/sentry/index.js +2 -1
  202. package/dist/plugins/simple-git-hooks/index.d.ts +3 -10
  203. package/dist/plugins/simple-git-hooks/index.js +2 -1
  204. package/dist/plugins/size-limit/index.d.ts +3 -9
  205. package/dist/plugins/size-limit/index.js +2 -1
  206. package/dist/plugins/sst/index.d.ts +3 -9
  207. package/dist/plugins/sst/index.js +2 -1
  208. package/dist/plugins/starlight/index.d.ts +3 -9
  209. package/dist/plugins/starlight/index.js +2 -1
  210. package/dist/plugins/storybook/index.d.ts +3 -12
  211. package/dist/plugins/storybook/index.js +2 -1
  212. package/dist/plugins/stryker/index.d.ts +3 -10
  213. package/dist/plugins/stryker/index.js +2 -1
  214. package/dist/plugins/stylelint/index.d.ts +3 -10
  215. package/dist/plugins/stylelint/index.js +2 -1
  216. package/dist/plugins/svelte/index.d.ts +3 -10
  217. package/dist/plugins/svelte/index.js +2 -1
  218. package/dist/plugins/svgo/index.d.ts +3 -8
  219. package/dist/plugins/svgo/index.js +2 -1
  220. package/dist/plugins/syncpack/index.d.ts +3 -8
  221. package/dist/plugins/syncpack/index.js +2 -1
  222. package/dist/plugins/tailwind/index.d.ts +3 -8
  223. package/dist/plugins/tailwind/index.js +2 -1
  224. package/dist/plugins/travis/index.d.ts +3 -10
  225. package/dist/plugins/travis/index.js +2 -1
  226. package/dist/plugins/ts-node/index.d.ts +3 -14
  227. package/dist/plugins/ts-node/index.js +2 -1
  228. package/dist/plugins/tsdown/index.d.ts +3 -13
  229. package/dist/plugins/tsdown/index.js +2 -1
  230. package/dist/plugins/tsup/index.d.ts +3 -13
  231. package/dist/plugins/tsup/index.js +2 -1
  232. package/dist/plugins/tsx/index.d.ts +3 -15
  233. package/dist/plugins/tsx/index.js +2 -1
  234. package/dist/plugins/typedoc/index.d.ts +3 -16
  235. package/dist/plugins/typedoc/index.js +2 -1
  236. package/dist/plugins/typescript/index.d.ts +3 -18
  237. package/dist/plugins/typescript/index.js +2 -1
  238. package/dist/plugins/unbuild/index.d.ts +3 -10
  239. package/dist/plugins/unbuild/index.js +2 -1
  240. package/dist/plugins/unocss/index.d.ts +3 -8
  241. package/dist/plugins/unocss/index.js +2 -1
  242. package/dist/plugins/vercel-og/index.d.ts +3 -8
  243. package/dist/plugins/vercel-og/index.js +2 -1
  244. package/dist/plugins/vike/index.d.ts +3 -8
  245. package/dist/plugins/vike/index.js +2 -1
  246. package/dist/plugins/vite/index.d.ts +3 -10
  247. package/dist/plugins/vite/index.js +2 -1
  248. package/dist/plugins/vitest/index.d.ts +3 -16
  249. package/dist/plugins/vitest/index.js +2 -1
  250. package/dist/plugins/vue/index.d.ts +3 -10
  251. package/dist/plugins/vue/index.js +2 -1
  252. package/dist/plugins/webdriver-io/index.d.ts +3 -10
  253. package/dist/plugins/webdriver-io/index.js +2 -1
  254. package/dist/plugins/webpack/index.d.ts +3 -13
  255. package/dist/plugins/webpack/index.js +2 -1
  256. package/dist/plugins/wireit/index.d.ts +3 -10
  257. package/dist/plugins/wireit/index.js +2 -1
  258. package/dist/plugins/wrangler/index.d.ts +3 -10
  259. package/dist/plugins/wrangler/index.js +2 -1
  260. package/dist/plugins/xo/index.d.ts +3 -11
  261. package/dist/plugins/xo/index.js +2 -1
  262. package/dist/plugins/yarn/index.d.ts +3 -9
  263. package/dist/plugins/yarn/index.js +2 -1
  264. package/dist/plugins/yorkie/index.d.ts +3 -11
  265. package/dist/plugins/yorkie/index.js +2 -1
  266. package/dist/reporters/json.js +1 -0
  267. package/dist/reporters/util/util.d.ts +1 -1
  268. package/dist/schema/configuration.d.ts +14 -4
  269. package/dist/schema/configuration.js +1 -0
  270. package/dist/schema/plugins.d.ts +5 -0
  271. package/dist/schema/plugins.js +1 -0
  272. package/dist/types/PluginNames.d.ts +2 -2
  273. package/dist/types/PluginNames.js +1 -0
  274. package/dist/types/config.d.ts +2 -0
  275. package/dist/types/imports.d.ts +1 -3
  276. package/dist/types/issues.d.ts +1 -0
  277. package/dist/types/package-json.d.ts +12 -1
  278. package/dist/types.d.ts +1 -1
  279. package/dist/typescript/get-imports-and-exports.js +12 -8
  280. package/dist/typescript/visitors/dynamic-imports/importCall.js +23 -15
  281. package/dist/typescript/visitors/dynamic-imports/importType.js +7 -1
  282. package/dist/typescript/visitors/dynamic-imports/index.js +2 -1
  283. package/dist/typescript/visitors/dynamic-imports/jsDocType.js +13 -2
  284. package/dist/typescript/visitors/dynamic-imports/requireCall.js +13 -9
  285. package/dist/typescript/visitors/dynamic-imports/resolveCall.js +7 -1
  286. package/dist/typescript/visitors/dynamic-imports/urlConstructor.d.ts +3 -0
  287. package/dist/typescript/visitors/dynamic-imports/urlConstructor.js +24 -0
  288. package/dist/typescript/visitors/helpers.js +13 -2
  289. package/dist/typescript/visitors/imports/importDeclaration.js +6 -5
  290. package/dist/typescript/visitors/imports/importEqualsDeclaration.js +9 -1
  291. package/dist/typescript/visitors/imports/reExportDeclaration.js +10 -5
  292. package/dist/util/catalog.d.ts +6 -0
  293. package/dist/util/catalog.js +62 -0
  294. package/dist/util/cli-arguments.d.ts +1 -1
  295. package/dist/util/cli-arguments.js +3 -3
  296. package/dist/util/create-options.d.ts +17 -4
  297. package/dist/util/create-options.js +8 -5
  298. package/dist/util/errors.js +11 -1
  299. package/dist/util/get-included-issue-types.d.ts +1 -1
  300. package/dist/util/get-included-issue-types.js +3 -2
  301. package/dist/util/trace.js +4 -4
  302. package/dist/version.d.ts +1 -1
  303. package/dist/version.js +1 -1
  304. package/package.json +1 -1
  305. package/schema.json +4 -0
@@ -0,0 +1,18 @@
1
+ import type { Issue } from './types/issues.js';
2
+ import type { Catalog, Catalogs, PackageJson } from './types/package-json.js';
3
+ import type { MainOptions } from './util/create-options.js';
4
+ export type CatalogContainer = {
5
+ filePath: string;
6
+ catalog?: Catalog;
7
+ catalogs?: Catalogs;
8
+ };
9
+ export declare class CatalogCounselor {
10
+ private filePath;
11
+ private entries;
12
+ private referencedEntries;
13
+ private fileContent?;
14
+ constructor(options: MainOptions);
15
+ private addReferencedCatalogEntry;
16
+ addWorkspace(manifest: PackageJson): void;
17
+ settleCatalogIssues(): Promise<Issue[]>;
18
+ }
@@ -0,0 +1,47 @@
1
+ import { readFile } from 'node:fs/promises';
2
+ import { ROOT_WORKSPACE_NAME } from './constants.js';
3
+ import { JsonCatalogPeeker } from './JsonCatalogPeeker.js';
4
+ import { extractCatalogReferences, parseCatalog } from './util/catalog.js';
5
+ import { extname } from './util/path.js';
6
+ import { YamlCatalogPeeker } from './YamlCatalogPeeker.js';
7
+ export class CatalogCounselor {
8
+ filePath;
9
+ entries = new Set();
10
+ referencedEntries = new Set();
11
+ fileContent;
12
+ constructor(options) {
13
+ this.filePath = options.catalog.filePath;
14
+ this.entries = parseCatalog(options.catalog);
15
+ }
16
+ addReferencedCatalogEntry(entryName) {
17
+ this.referencedEntries.add(entryName);
18
+ }
19
+ addWorkspace(manifest) {
20
+ if (this.entries.size === 0)
21
+ return;
22
+ const catalogReferences = extractCatalogReferences(manifest);
23
+ for (const catalogEntryName of catalogReferences)
24
+ this.addReferencedCatalogEntry(catalogEntryName);
25
+ }
26
+ async settleCatalogIssues() {
27
+ if (this.entries.size === 0)
28
+ return [];
29
+ const filePath = this.filePath;
30
+ const workspace = ROOT_WORKSPACE_NAME;
31
+ const catalogIssues = [];
32
+ if (this.entries.size > this.referencedEntries.size) {
33
+ this.fileContent = await readFile(filePath, 'utf-8');
34
+ const isYaml = ['.yml', '.yaml'].includes(extname(filePath));
35
+ const Peeker = isYaml ? YamlCatalogPeeker : JsonCatalogPeeker;
36
+ const peeker = new Peeker(this.fileContent);
37
+ for (const entry of this.entries.keys()) {
38
+ if (!this.referencedEntries.has(entry)) {
39
+ const [parentSymbol, symbol] = entry.split(':');
40
+ const pos = peeker.getLocation(parentSymbol, symbol);
41
+ catalogIssues.push({ type: 'catalog', filePath, workspace, symbol, parentSymbol, ...pos });
42
+ }
43
+ }
44
+ }
45
+ return catalogIssues;
46
+ }
47
+ }
@@ -277,6 +277,11 @@ export declare class ConfigurationChief {
277
277
  entry?: string | string[] | undefined;
278
278
  project?: string | string[] | undefined;
279
279
  } | undefined;
280
+ mdx?: string | boolean | string[] | {
281
+ config?: string | string[] | undefined;
282
+ entry?: string | string[] | undefined;
283
+ project?: string | string[] | undefined;
284
+ } | undefined;
280
285
  mdxlint?: string | boolean | string[] | {
281
286
  config?: string | string[] | undefined;
282
287
  entry?: string | string[] | undefined;
@@ -703,6 +708,7 @@ export declare class ConfigurationChief {
703
708
  "lockfile-lint"?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
704
709
  "lost-pixel"?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
705
710
  markdownlint?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
711
+ mdx?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
706
712
  mdxlint?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
707
713
  metro?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
708
714
  mocha?: (boolean | import("./types/config.js").EnsuredPluginConfiguration) | undefined;
@@ -179,9 +179,11 @@ export class ConfigurationChief {
179
179
  }
180
180
  getAvailableWorkspaceNames(names) {
181
181
  const availableWorkspaceNames = [];
182
+ const [ignore, patterns] = partition(this.ignoredWorkspacePatterns, pattern => pattern.startsWith('!'));
182
183
  for (const name of names) {
183
- if (!picomatch.isMatch(name, this.ignoredWorkspacePatterns))
184
+ if (!picomatch.isMatch(name, patterns, { ignore: ignore.map(pattern => pattern.slice(1)) })) {
184
185
  availableWorkspaceNames.push(name);
186
+ }
185
187
  }
186
188
  return availableWorkspaceNames;
187
189
  }
@@ -9,8 +9,9 @@ export declare class IssueFixer {
9
9
  addUnusedTypeNode(filePath: string, fixes: Fixes | undefined): void;
10
10
  addUnusedExportNode(filePath: string, fixes: Fixes | undefined): void;
11
11
  fixIssues(issues: Issues): Promise<Set<string>>;
12
- private markExportFixed;
12
+ private markExportIssuesFixed;
13
13
  private removeUnusedFiles;
14
14
  private removeUnusedExports;
15
15
  private removeUnusedDependencies;
16
+ private removeUnusedCatalogEntries;
16
17
  }
@@ -1,6 +1,7 @@
1
1
  import { readFile, rm, writeFile } from 'node:fs/promises';
2
+ import { DEFAULT_CATALOG } from './util/catalog.js';
2
3
  import { load, save } from './util/package-json.js';
3
- import { join, relative } from './util/path.js';
4
+ import { extname, join, relative } from './util/path.js';
4
5
  import { removeExport } from './util/remove-export.js';
5
6
  export class IssueFixer {
6
7
  options;
@@ -34,9 +35,11 @@ export class IssueFixer {
34
35
  touchedFiles.add(filePath);
35
36
  for (const filePath of await this.removeUnusedDependencies(issues))
36
37
  touchedFiles.add(filePath);
38
+ for (const filePath of await this.removeUnusedCatalogEntries(issues))
39
+ touchedFiles.add(filePath);
37
40
  return touchedFiles;
38
41
  }
39
- markExportFixed(issues, filePath) {
42
+ markExportIssuesFixed(issues, filePath) {
40
43
  const relPath = relative(this.options.cwd, filePath);
41
44
  const types = [
42
45
  ...(this.options.isFixUnusedTypes ? ['types', 'nsTypes', 'classMembers', 'enumMembers'] : []),
@@ -69,7 +72,7 @@ export class IssueFixer {
69
72
  const sourceFileText = exportPositions.reduce((text, [start, end, flags]) => removeExport({ text, start, end, flags }), await readFile(filePath, 'utf-8'));
70
73
  await writeFile(filePath, sourceFileText);
71
74
  touchedFiles.add(filePath);
72
- this.markExportFixed(issues, filePath);
75
+ this.markExportIssuesFixed(issues, filePath);
73
76
  }
74
77
  }
75
78
  return touchedFiles;
@@ -103,4 +106,49 @@ export class IssueFixer {
103
106
  }
104
107
  return touchedFiles;
105
108
  }
109
+ async removeUnusedCatalogEntries(issues) {
110
+ const touchedFiles = new Set();
111
+ if (!this.options.isFixCatalog)
112
+ return touchedFiles;
113
+ const filePaths = new Set(Object.keys(issues.catalog));
114
+ for (const filePath of filePaths) {
115
+ if (['.yml', '.yaml'].includes(extname(filePath))) {
116
+ const absFilePath = join(this.options.cwd, filePath);
117
+ const fileContent = await readFile(absFilePath, 'utf-8');
118
+ const remove = new Set();
119
+ const isRemove = (_, i) => !remove.has(i);
120
+ for (const [key, issue] of Object.entries(issues.catalog[filePath])) {
121
+ if (issue.line) {
122
+ remove.add(issue.line - 1);
123
+ issues.catalog[filePath][key].isFixed = true;
124
+ }
125
+ }
126
+ await writeFile(absFilePath, fileContent.split('\n').filter(isRemove).join('\n'));
127
+ touchedFiles.add(filePath);
128
+ }
129
+ else {
130
+ const absFilePath = join(this.options.cwd, filePath);
131
+ const pkg = await load(absFilePath);
132
+ const catalog = pkg.catalog || (!Array.isArray(pkg.workspaces) && pkg.workspaces?.catalog);
133
+ const catalogs = pkg.catalogs || (!Array.isArray(pkg.workspaces) && pkg.workspaces?.catalogs);
134
+ for (const [key, issue] of Object.entries(issues.catalog[filePath])) {
135
+ if (issue.parentSymbol === DEFAULT_CATALOG) {
136
+ if (catalog) {
137
+ delete catalog[issue.symbol];
138
+ issues.catalog[filePath][key].isFixed = true;
139
+ }
140
+ }
141
+ else {
142
+ if (catalogs && issue.parentSymbol) {
143
+ delete catalogs[issue.parentSymbol][issue.symbol];
144
+ issues.catalog[filePath][key].isFixed = true;
145
+ }
146
+ }
147
+ }
148
+ await save(absFilePath, pkg);
149
+ touchedFiles.add(filePath);
150
+ }
151
+ }
152
+ return touchedFiles;
153
+ }
106
154
  }
@@ -0,0 +1,12 @@
1
+ export declare class JsonCatalogPeeker {
2
+ private fileContent;
3
+ private lines;
4
+ private sections;
5
+ private ready;
6
+ constructor(fileContent: string);
7
+ private init;
8
+ getLocation(parentSymbol: string, symbol: string): {
9
+ line: number;
10
+ col: number;
11
+ } | undefined;
12
+ }
@@ -0,0 +1,68 @@
1
+ import { DEFAULT_CATALOG } from './util/catalog.js';
2
+ export class JsonCatalogPeeker {
3
+ fileContent;
4
+ lines = [];
5
+ sections = {};
6
+ ready = false;
7
+ constructor(fileContent) {
8
+ this.fileContent = fileContent;
9
+ }
10
+ init() {
11
+ this.lines = this.fileContent.split('\n');
12
+ let inCatalogs = false;
13
+ let catalogName;
14
+ let braceLevel = 0;
15
+ for (let i = 0; i < this.lines.length; i++) {
16
+ const line = this.lines[i];
17
+ const trimmedLine = line.trim();
18
+ if (catalogName) {
19
+ if (line.includes('{'))
20
+ braceLevel++;
21
+ if (line.includes('}'))
22
+ braceLevel--;
23
+ if (braceLevel === 0) {
24
+ this.sections[catalogName].end = i;
25
+ catalogName = undefined;
26
+ }
27
+ }
28
+ else if (trimmedLine.startsWith('"catalog":')) {
29
+ catalogName = DEFAULT_CATALOG;
30
+ this.sections[catalogName] = { start: i, end: 0 };
31
+ braceLevel = (line.match(/{/g) ?? []).length - (line.match(/}/g) ?? []).length;
32
+ if (braceLevel === 0) {
33
+ this.sections[catalogName].end = i;
34
+ catalogName = undefined;
35
+ }
36
+ }
37
+ else if (trimmedLine.startsWith('"catalogs":')) {
38
+ inCatalogs = true;
39
+ }
40
+ else if (inCatalogs) {
41
+ if (trimmedLine.startsWith('}')) {
42
+ inCatalogs = false;
43
+ continue;
44
+ }
45
+ const match = trimmedLine.match(/"(.*?)"/);
46
+ if (match) {
47
+ catalogName = match[1];
48
+ this.sections[catalogName] = { start: i, end: 0 };
49
+ braceLevel = (line.match(/{/g) ?? []).length - (line.match(/}/g) ?? []).length;
50
+ }
51
+ }
52
+ }
53
+ this.ready = true;
54
+ }
55
+ getLocation(parentSymbol, symbol) {
56
+ if (!this.ready)
57
+ this.init();
58
+ const section = this.sections[parentSymbol];
59
+ if (!section)
60
+ return;
61
+ for (let i = section.start + 1; i < section.end; i++) {
62
+ const line = this.lines[i];
63
+ if (line.trim().startsWith(`"${symbol}":`)) {
64
+ return { line: i + 1, col: line.indexOf(`"${symbol}"`) + 1 };
65
+ }
66
+ }
67
+ }
68
+ }
@@ -22,6 +22,7 @@ export class PackagePeeker {
22
22
  this.sections[section] = { startLine: i, startPos: pos };
23
23
  pos += line.length + 1;
24
24
  }
25
+ this.ready = true;
25
26
  }
26
27
  getLocation(type, packageName) {
27
28
  if (!this.ready)
@@ -0,0 +1,12 @@
1
+ export declare class YamlCatalogPeeker {
2
+ private fileContent;
3
+ private lines;
4
+ private sections;
5
+ private ready;
6
+ constructor(fileContent: string);
7
+ private init;
8
+ getLocation(parentSymbol: string, symbol: string): {
9
+ line: number;
10
+ col: number;
11
+ } | undefined;
12
+ }
@@ -0,0 +1,66 @@
1
+ import { DEFAULT_CATALOG } from './util/catalog.js';
2
+ function matchesKey(line, indent, key) {
3
+ return (line.startsWith(`${indent}${key}:`) ||
4
+ line.startsWith(`${indent}"${key}":`) ||
5
+ line.startsWith(`${indent}'${key}':`));
6
+ }
7
+ export class YamlCatalogPeeker {
8
+ fileContent;
9
+ lines = [];
10
+ sections = {};
11
+ ready = false;
12
+ constructor(fileContent) {
13
+ this.fileContent = fileContent;
14
+ }
15
+ init() {
16
+ this.lines = this.fileContent.split('\n');
17
+ for (let i = 0; i < this.lines.length; i++) {
18
+ const line = this.lines[i];
19
+ if (line.startsWith('catalog:')) {
20
+ this.sections.catalog = i;
21
+ }
22
+ else if (line.startsWith('catalogs:')) {
23
+ this.sections.catalogs = i;
24
+ }
25
+ }
26
+ this.ready = true;
27
+ }
28
+ getLocation(parentSymbol, symbol) {
29
+ if (!this.ready)
30
+ this.init();
31
+ const isDefault = parentSymbol === DEFAULT_CATALOG;
32
+ const startLine = this.sections[isDefault ? 'catalog' : 'catalogs'];
33
+ if (typeof startLine === 'undefined')
34
+ return;
35
+ if (isDefault) {
36
+ for (let i = startLine + 1; i < this.lines.length; i++) {
37
+ const line = this.lines[i];
38
+ if (!line.startsWith(' '))
39
+ break;
40
+ if (matchesKey(line, ' ', symbol)) {
41
+ return { line: i + 1, col: line.indexOf(symbol) + 1 };
42
+ }
43
+ }
44
+ }
45
+ else {
46
+ let inTargetCatalog = false;
47
+ for (let i = startLine + 1; i < this.lines.length; i++) {
48
+ const line = this.lines[i];
49
+ if (!line.startsWith(' '))
50
+ break;
51
+ if (matchesKey(line, ' ', parentSymbol)) {
52
+ inTargetCatalog = true;
53
+ }
54
+ else if (inTargetCatalog) {
55
+ if (!line.startsWith(' ')) {
56
+ inTargetCatalog = false;
57
+ continue;
58
+ }
59
+ if (matchesKey(line, ' ', symbol)) {
60
+ return { line: i + 1, col: line.indexOf(symbol) + 1 };
61
+ }
62
+ }
63
+ }
64
+ }
65
+ }
66
+ }
@@ -17,7 +17,7 @@ export const getDependenciesFromScript = (script, options) => {
17
17
  if (!script)
18
18
  return [];
19
19
  const fromArgs = (args, opts) => {
20
- if (args.length === 0 || !isValidBinary(args[0]))
20
+ if (args.length === 0 || !isValidBinary(args[0].split(' ')[0]))
21
21
  return [];
22
22
  return getDependenciesFromScript(args.filter(arg => arg !== '--').join(' '), {
23
23
  ...options,
@@ -229,6 +229,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
229
229
  entry?: string | string[] | undefined;
230
230
  project?: string | string[] | undefined;
231
231
  } | undefined;
232
+ mdx?: string | boolean | string[] | {
233
+ config?: string | string[] | undefined;
234
+ entry?: string | string[] | undefined;
235
+ project?: string | string[] | undefined;
236
+ } | undefined;
232
237
  mdxlint?: string | boolean | string[] | {
233
238
  config?: string | string[] | undefined;
234
239
  entry?: string | string[] | undefined;
@@ -815,6 +820,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
815
820
  entry?: string | string[] | undefined;
816
821
  project?: string | string[] | undefined;
817
822
  } | undefined;
823
+ mdx?: string | boolean | string[] | {
824
+ config?: string | string[] | undefined;
825
+ entry?: string | string[] | undefined;
826
+ project?: string | string[] | undefined;
827
+ } | undefined;
818
828
  mdxlint?: string | boolean | string[] | {
819
829
  config?: string | string[] | undefined;
820
830
  entry?: string | string[] | undefined;
@@ -1186,10 +1196,10 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
1186
1196
  ignoreUnresolved?: (string | RegExp)[] | undefined;
1187
1197
  includeEntryExports?: boolean | undefined;
1188
1198
  }> | undefined;
1189
- include?: ("files" | "dependencies" | "devDependencies" | "optionalPeerDependencies" | "unlisted" | "binaries" | "unresolved" | "exports" | "nsExports" | "types" | "nsTypes" | "enumMembers" | "classMembers" | "duplicates")[] | undefined;
1190
- exclude?: ("files" | "dependencies" | "devDependencies" | "optionalPeerDependencies" | "unlisted" | "binaries" | "unresolved" | "exports" | "nsExports" | "types" | "nsTypes" | "enumMembers" | "classMembers" | "duplicates")[] | undefined;
1199
+ include?: ("files" | "dependencies" | "devDependencies" | "optionalPeerDependencies" | "unlisted" | "binaries" | "unresolved" | "exports" | "nsExports" | "types" | "nsTypes" | "enumMembers" | "classMembers" | "duplicates" | "catalog")[] | undefined;
1200
+ exclude?: ("files" | "dependencies" | "devDependencies" | "optionalPeerDependencies" | "unlisted" | "binaries" | "unresolved" | "exports" | "nsExports" | "types" | "nsTypes" | "enumMembers" | "classMembers" | "duplicates" | "catalog")[] | undefined;
1191
1201
  $schema?: string | undefined;
1192
- rules?: Partial<Record<"files" | "dependencies" | "devDependencies" | "optionalPeerDependencies" | "unlisted" | "binaries" | "unresolved" | "exports" | "nsExports" | "types" | "nsTypes" | "enumMembers" | "classMembers" | "duplicates", "error" | "warn" | "off">> | undefined;
1202
+ rules?: Partial<Record<"files" | "dependencies" | "devDependencies" | "optionalPeerDependencies" | "unlisted" | "binaries" | "unresolved" | "exports" | "nsExports" | "types" | "nsTypes" | "enumMembers" | "classMembers" | "duplicates" | "catalog", "error" | "warn" | "off">> | undefined;
1193
1203
  entry?: string | string[] | undefined;
1194
1204
  project?: string | string[] | undefined;
1195
1205
  paths?: Record<string, string[]> | undefined;
@@ -1200,7 +1210,7 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
1200
1210
  ignoreMembers?: (string | RegExp)[] | undefined;
1201
1211
  ignoreUnresolved?: (string | RegExp)[] | undefined;
1202
1212
  ignoreExportsUsedInFile?: boolean | Record<string, boolean | undefined> | undefined;
1203
- ignoreIssues?: Record<string, ("files" | "dependencies" | "devDependencies" | "optionalPeerDependencies" | "unlisted" | "binaries" | "unresolved" | "exports" | "nsExports" | "types" | "nsTypes" | "enumMembers" | "classMembers" | "duplicates")[]> | undefined;
1213
+ ignoreIssues?: Record<string, ("files" | "dependencies" | "devDependencies" | "optionalPeerDependencies" | "unlisted" | "binaries" | "unresolved" | "exports" | "nsExports" | "types" | "nsTypes" | "enumMembers" | "classMembers" | "duplicates" | "catalog")[]> | undefined;
1204
1214
  ignoreWorkspaces?: string[] | undefined;
1205
1215
  includeEntryExports?: boolean | undefined;
1206
1216
  compilers?: Record<string, true | ((filename: string, contents: string) => string) | ((filename: string, contents: string) => Promise<string>)> | undefined;
@@ -15,7 +15,7 @@ export declare const IGNORED_DEPENDENCIES: Set<string>;
15
15
  export declare const IGNORED_RUNTIME_DEPENDENCIES: Set<string>;
16
16
  export declare const FOREIGN_FILE_EXTENSIONS: Set<string>;
17
17
  export declare const IGNORE_DEFINITELY_TYPED: Set<string>;
18
- export declare const ISSUE_TYPES: readonly ["files", "dependencies", "devDependencies", "optionalPeerDependencies", "unlisted", "binaries", "unresolved", "exports", "nsExports", "types", "nsTypes", "enumMembers", "classMembers", "duplicates"];
18
+ export declare const ISSUE_TYPES: readonly ["files", "dependencies", "devDependencies", "optionalPeerDependencies", "unlisted", "binaries", "unresolved", "exports", "nsExports", "types", "nsTypes", "enumMembers", "classMembers", "duplicates", "catalog"];
19
19
  export declare const ISSUE_TYPE_TITLE: {
20
20
  readonly files: "Unused files";
21
21
  readonly _files: "Unused files";
@@ -32,6 +32,7 @@ export declare const ISSUE_TYPE_TITLE: {
32
32
  readonly enumMembers: "Unused exported enum members";
33
33
  readonly classMembers: "Unused exported class members";
34
34
  readonly duplicates: "Duplicate exports";
35
+ readonly catalog: "Unused catalog entries";
35
36
  };
36
37
  export declare const SYMBOL_TYPE: {
37
38
  readonly CLASS: "class";
@@ -49,3 +50,10 @@ export declare const FIX_FLAGS: {
49
50
  readonly EMPTY_DECLARATION: number;
50
51
  readonly WITH_NEWLINE: number;
51
52
  };
53
+ export declare const IMPORT_MODIFIERS: {
54
+ readonly NONE: 0;
55
+ readonly RE_EXPORT: number;
56
+ readonly TYPE_ONLY: number;
57
+ readonly ENTRY: number;
58
+ readonly OPTIONAL: number;
59
+ };
package/dist/constants.js CHANGED
@@ -172,6 +172,7 @@ export const ISSUE_TYPES = [
172
172
  'enumMembers',
173
173
  'classMembers',
174
174
  'duplicates',
175
+ 'catalog',
175
176
  ];
176
177
  export const ISSUE_TYPE_TITLE = {
177
178
  files: 'Unused files',
@@ -189,6 +190,7 @@ export const ISSUE_TYPE_TITLE = {
189
190
  enumMembers: 'Unused exported enum members',
190
191
  classMembers: 'Unused exported class members',
191
192
  duplicates: 'Duplicate exports',
193
+ catalog: 'Unused catalog entries',
192
194
  };
193
195
  export const SYMBOL_TYPE = {
194
196
  CLASS: 'class',
@@ -206,3 +208,10 @@ export const FIX_FLAGS = {
206
208
  EMPTY_DECLARATION: 1 << 1,
207
209
  WITH_NEWLINE: 1 << 2,
208
210
  };
211
+ export const IMPORT_MODIFIERS = {
212
+ NONE: 0,
213
+ RE_EXPORT: 1 << 0,
214
+ TYPE_ONLY: 1 << 1,
215
+ ENTRY: 1 << 2,
216
+ OPTIONAL: 1 << 3,
217
+ };
@@ -1,3 +1,4 @@
1
+ import type { CatalogCounselor } from '../CatalogCounselor.js';
1
2
  import type { ConfigurationChief } from '../ConfigurationChief.js';
2
3
  import type { ConsoleStreamer } from '../ConsoleStreamer.js';
3
4
  import type { DependencyDeputy } from '../DependencyDeputy.js';
@@ -8,6 +9,7 @@ import type { ModuleGraph } from '../types/module-graph.js';
8
9
  import type { MainOptions } from '../util/create-options.js';
9
10
  interface AnalyzeOptions {
10
11
  analyzedFiles: Set<string>;
12
+ counselor: CatalogCounselor;
11
13
  chief: ConfigurationChief;
12
14
  collector: IssueCollector;
13
15
  deputy: DependencyDeputy;
@@ -19,5 +21,5 @@ interface AnalyzeOptions {
19
21
  unreferencedFiles: Set<string>;
20
22
  options: MainOptions;
21
23
  }
22
- export declare const analyze: ({ analyzedFiles, chief, collector, deputy, entryPaths, factory, fixer, graph, streamer, unreferencedFiles, options, }: AnalyzeOptions) => Promise<() => Promise<void>>;
24
+ export declare const analyze: ({ analyzedFiles, counselor, chief, collector, deputy, entryPaths, factory, fixer, graph, streamer, unreferencedFiles, options, }: AnalyzeOptions) => Promise<() => Promise<void>>;
23
25
  export {};
@@ -4,7 +4,7 @@ import { getPackageNameFromModuleSpecifier } from '../util/modules.js';
4
4
  import { findMatch } from '../util/regex.js';
5
5
  import { getShouldIgnoreHandler, getShouldIgnoreTagHandler } from '../util/tag.js';
6
6
  import { createAndPrintTrace, printTrace } from '../util/trace.js';
7
- export const analyze = async ({ analyzedFiles, chief, collector, deputy, entryPaths, factory, fixer, graph, streamer, unreferencedFiles, options, }) => {
7
+ export const analyze = async ({ analyzedFiles, counselor, chief, collector, deputy, entryPaths, factory, fixer, graph, streamer, unreferencedFiles, options, }) => {
8
8
  const shouldIgnore = getShouldIgnoreHandler(options.isProduction);
9
9
  const shouldIgnoreTags = getShouldIgnoreTagHandler(options.tags);
10
10
  const isIdentifierReferenced = getIsIdentifierReferencedHandler(graph, entryPaths, options.isTrace);
@@ -213,6 +213,9 @@ export const analyze = async ({ analyzedFiles, chief, collector, deputy, entryPa
213
213
  for (const hint of configurationHints)
214
214
  collector.addConfigurationHint(hint);
215
215
  }
216
+ const catalogIssues = await counselor.settleCatalogIssues();
217
+ for (const issue of catalogIssues)
218
+ collector.addIssue(issue);
216
219
  const unusedIgnoredWorkspaces = chief.getUnusedIgnoredWorkspaces();
217
220
  for (const identifier of unusedIgnoredWorkspaces) {
218
221
  collector.addConfigurationHint({ type: 'ignoreWorkspaces', identifier });
@@ -1,3 +1,4 @@
1
+ import type { CatalogCounselor } from '../CatalogCounselor.js';
1
2
  import type { ConfigurationChief, Workspace } from '../ConfigurationChief.js';
2
3
  import type { ConsoleStreamer } from '../ConsoleStreamer.js';
3
4
  import type { DependencyDeputy } from '../DependencyDeputy.js';
@@ -9,6 +10,7 @@ import type { MainOptions } from '../util/create-options.js';
9
10
  interface BuildOptions {
10
11
  chief: ConfigurationChief;
11
12
  collector: IssueCollector;
13
+ counselor: CatalogCounselor;
12
14
  deputy: DependencyDeputy;
13
15
  factory: PrincipalFactory;
14
16
  isGitIgnored: (path: string) => boolean;
@@ -16,7 +18,7 @@ interface BuildOptions {
16
18
  workspaces: Workspace[];
17
19
  options: MainOptions;
18
20
  }
19
- export declare function build({ chief, collector, deputy, factory, isGitIgnored, streamer, workspaces, options, }: BuildOptions): Promise<{
21
+ export declare function build({ chief, collector, counselor, deputy, factory, isGitIgnored, streamer, workspaces, options, }: BuildOptions): Promise<{
20
22
  graph: ModuleGraph;
21
23
  entryPaths: Set<string>;
22
24
  analyzedFiles: Set<string>;
@@ -13,7 +13,7 @@ import { getEntrySpecifiersFromManifest, getManifestImportDependencies } from '.
13
13
  import { dirname, extname, isAbsolute, join, relative, toRelative } from '../util/path.js';
14
14
  import { augmentWorkspace, getToSourcePathHandler, getToSourcePathsHandler } from '../util/to-source-path.js';
15
15
  import { WorkspaceWorker } from '../WorkspaceWorker.js';
16
- export async function build({ chief, collector, deputy, factory, isGitIgnored, streamer, workspaces, options, }) {
16
+ export async function build({ chief, collector, counselor, deputy, factory, isGitIgnored, streamer, workspaces, options, }) {
17
17
  const configFilesMap = new Map();
18
18
  const enabledPluginsStore = new Map();
19
19
  const toSourceFilePath = getToSourcePathHandler(chief);
@@ -34,6 +34,7 @@ export async function build({ chief, collector, deputy, factory, isGitIgnored, s
34
34
  manifest,
35
35
  ...chief.getIgnores(name),
36
36
  });
37
+ counselor.addWorkspace(manifest);
37
38
  }
38
39
  collector.addIgnorePatterns(chief.config.ignore.map(p => join(options.cwd, p)));
39
40
  collector.addIgnoreFilesPatterns(chief.config.ignoreFiles.map(p => join(options.cwd, p)));
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { watch } from 'node:fs';
2
2
  import { formatly } from 'formatly';
3
+ import { CatalogCounselor } from './CatalogCounselor.js';
3
4
  import { ConfigurationChief } from './ConfigurationChief.js';
4
5
  import { ConsoleStreamer } from './ConsoleStreamer.js';
5
6
  import { DependencyDeputy } from './DependencyDeputy.js';
@@ -22,6 +23,7 @@ export const main = async (options) => {
22
23
  const streamer = new ConsoleStreamer(options);
23
24
  const fixer = new IssueFixer(options);
24
25
  const collector = new IssueCollector(options);
26
+ const counselor = new CatalogCounselor(options);
25
27
  streamer.cast('Reading workspace configuration');
26
28
  const workspaces = await chief.getWorkspaces();
27
29
  const isGitIgnored = await getGitIgnoredHandler(options);
@@ -31,6 +33,7 @@ export const main = async (options) => {
31
33
  const { graph, entryPaths, analyzedFiles, unreferencedFiles, analyzeSourceFile } = await build({
32
34
  chief,
33
35
  collector,
36
+ counselor,
34
37
  deputy,
35
38
  factory,
36
39
  isGitIgnored,
@@ -40,6 +43,7 @@ export const main = async (options) => {
40
43
  });
41
44
  const reAnalyze = await analyze({
42
45
  analyzedFiles,
46
+ counselor,
43
47
  chief,
44
48
  collector,
45
49
  deputy,
@@ -1,12 +1,3 @@
1
- import type { IsPluginEnabled, ResolveConfig } from '../../types/config.js';
2
- import type { PluginConfig } from './types.js';
3
- declare const _default: {
4
- title: string;
5
- enablers: string[];
6
- isEnabled: IsPluginEnabled;
7
- config: string[];
8
- entry: string[];
9
- production: string[];
10
- resolveConfig: ResolveConfig<PluginConfig>;
11
- };
12
- export default _default;
1
+ import type { Plugin } from '../../types/config.js';
2
+ declare const plugin: Plugin;
3
+ export default plugin;
@@ -10,7 +10,7 @@ const resolveConfig = async (config) => {
10
10
  const inputs = config?.plugins ?? [];
11
11
  return [...inputs].map(id => toDeferResolve(id));
12
12
  };
13
- export default {
13
+ const plugin = {
14
14
  title,
15
15
  enablers,
16
16
  isEnabled,
@@ -19,3 +19,4 @@ export default {
19
19
  production,
20
20
  resolveConfig,
21
21
  };
22
+ export default plugin;
@@ -1,10 +1,3 @@
1
- import type { IsPluginEnabled, ResolveConfig } from '../../types/config.js';
2
- import type { AngularCLIWorkspaceConfiguration } from './types.js';
3
- declare const _default: {
4
- title: string;
5
- enablers: string[];
6
- isEnabled: IsPluginEnabled;
7
- config: string[];
8
- resolveConfig: ResolveConfig<AngularCLIWorkspaceConfiguration>;
9
- };
10
- export default _default;
1
+ import type { Plugin } from '../../types/config.js';
2
+ declare const plugin: Plugin;
3
+ export default plugin;
@@ -108,10 +108,11 @@ const isAngularBuilderRefWithName = ({ builderRef, name }) => {
108
108
  };
109
109
  const PRODUCTION_CONFIG_NAME = 'production';
110
110
  const BUILD_TARGET_NAME = 'build';
111
- export default {
111
+ const plugin = {
112
112
  title,
113
113
  enablers,
114
114
  isEnabled,
115
115
  config,
116
116
  resolveConfig,
117
117
  };
118
+ export default plugin;