knip 5.67.1 → 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 (309) hide show
  1. package/dist/CatalogCounselor.d.ts +18 -0
  2. package/dist/CatalogCounselor.js +47 -0
  3. package/dist/ConfigurationChief.d.ts +12 -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 +24 -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 +3 -2
  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 -935
  98. package/dist/plugins/index.js +4 -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 -0
  122. package/dist/plugins/mdxlint/index.js +31 -0
  123. package/dist/plugins/mdxlint/types.d.ts +3 -0
  124. package/dist/plugins/mdxlint/types.js +1 -0
  125. package/dist/plugins/metro/index.d.ts +3 -11
  126. package/dist/plugins/metro/index.js +2 -1
  127. package/dist/plugins/mocha/index.d.ts +3 -14
  128. package/dist/plugins/mocha/index.js +2 -1
  129. package/dist/plugins/moonrepo/index.d.ts +3 -11
  130. package/dist/plugins/moonrepo/index.js +2 -1
  131. package/dist/plugins/msw/index.d.ts +3 -11
  132. package/dist/plugins/msw/index.js +2 -1
  133. package/dist/plugins/nano-staged/index.d.ts +3 -10
  134. package/dist/plugins/nano-staged/index.js +2 -1
  135. package/dist/plugins/nest/index.d.ts +3 -10
  136. package/dist/plugins/nest/index.js +2 -1
  137. package/dist/plugins/netlify/index.d.ts +3 -11
  138. package/dist/plugins/netlify/index.js +2 -1
  139. package/dist/plugins/next/index.d.ts +3 -10
  140. package/dist/plugins/next/index.js +2 -1
  141. package/dist/plugins/node/index.d.ts +3 -17
  142. package/dist/plugins/node/index.js +2 -1
  143. package/dist/plugins/node-modules-inspector/index.d.ts +3 -11
  144. package/dist/plugins/node-modules-inspector/index.js +2 -1
  145. package/dist/plugins/nodemon/index.d.ts +3 -10
  146. package/dist/plugins/nodemon/index.js +2 -1
  147. package/dist/plugins/npm-package-json-lint/index.d.ts +3 -11
  148. package/dist/plugins/npm-package-json-lint/index.js +2 -1
  149. package/dist/plugins/nuxt/index.d.ts +3 -12
  150. package/dist/plugins/nuxt/index.js +2 -1
  151. package/dist/plugins/nx/index.d.ts +3 -14
  152. package/dist/plugins/nx/index.js +2 -1
  153. package/dist/plugins/nyc/index.d.ts +3 -10
  154. package/dist/plugins/nyc/index.js +2 -1
  155. package/dist/plugins/oclif/index.d.ts +3 -10
  156. package/dist/plugins/oclif/index.js +2 -1
  157. package/dist/plugins/oxlint/index.d.ts +3 -11
  158. package/dist/plugins/oxlint/index.js +2 -1
  159. package/dist/plugins/playwright/index.d.ts +3 -15
  160. package/dist/plugins/playwright/index.js +2 -1
  161. package/dist/plugins/playwright-ct/index.d.ts +3 -10
  162. package/dist/plugins/playwright-ct/index.js +2 -1
  163. package/dist/plugins/playwright-test/index.d.ts +3 -12
  164. package/dist/plugins/playwright-test/index.js +2 -1
  165. package/dist/plugins/plop/index.d.ts +3 -8
  166. package/dist/plugins/plop/index.js +2 -1
  167. package/dist/plugins/pnpm/index.d.ts +3 -8
  168. package/dist/plugins/pnpm/index.js +2 -1
  169. package/dist/plugins/postcss/index.d.ts +3 -10
  170. package/dist/plugins/postcss/index.js +2 -1
  171. package/dist/plugins/preconstruct/index.d.ts +3 -10
  172. package/dist/plugins/preconstruct/index.js +2 -1
  173. package/dist/plugins/prettier/index.d.ts +3 -10
  174. package/dist/plugins/prettier/index.js +2 -1
  175. package/dist/plugins/prisma/index.d.ts +3 -13
  176. package/dist/plugins/prisma/index.js +10 -2
  177. package/dist/plugins/prisma/types.d.ts +3 -0
  178. package/dist/plugins/react-cosmos/index.d.ts +3 -11
  179. package/dist/plugins/react-cosmos/index.js +2 -1
  180. package/dist/plugins/react-router/index.d.ts +3 -10
  181. package/dist/plugins/react-router/index.js +3 -2
  182. package/dist/plugins/relay/index.d.ts +3 -15
  183. package/dist/plugins/relay/index.js +2 -1
  184. package/dist/plugins/release-it/index.d.ts +3 -10
  185. package/dist/plugins/release-it/index.js +2 -1
  186. package/dist/plugins/remark/index.d.ts +3 -11
  187. package/dist/plugins/remark/index.js +4 -2
  188. package/dist/plugins/remark/types.d.ts +1 -1
  189. package/dist/plugins/remix/index.d.ts +3 -9
  190. package/dist/plugins/remix/index.js +2 -1
  191. package/dist/plugins/rollup/index.d.ts +3 -10
  192. package/dist/plugins/rollup/index.js +2 -1
  193. package/dist/plugins/rsbuild/index.d.ts +3 -10
  194. package/dist/plugins/rsbuild/index.js +2 -1
  195. package/dist/plugins/rslib/index.d.ts +3 -10
  196. package/dist/plugins/rslib/index.js +2 -1
  197. package/dist/plugins/rspack/index.d.ts +3 -10
  198. package/dist/plugins/rspack/index.js +2 -1
  199. package/dist/plugins/rstest/index.d.ts +3 -10
  200. package/dist/plugins/rstest/index.js +2 -1
  201. package/dist/plugins/semantic-release/index.d.ts +3 -12
  202. package/dist/plugins/semantic-release/index.js +2 -1
  203. package/dist/plugins/sentry/index.d.ts +3 -8
  204. package/dist/plugins/sentry/index.js +2 -1
  205. package/dist/plugins/simple-git-hooks/index.d.ts +3 -10
  206. package/dist/plugins/simple-git-hooks/index.js +2 -1
  207. package/dist/plugins/size-limit/index.d.ts +3 -9
  208. package/dist/plugins/size-limit/index.js +2 -1
  209. package/dist/plugins/sst/index.d.ts +3 -9
  210. package/dist/plugins/sst/index.js +2 -1
  211. package/dist/plugins/starlight/index.d.ts +3 -9
  212. package/dist/plugins/starlight/index.js +2 -1
  213. package/dist/plugins/storybook/index.d.ts +3 -12
  214. package/dist/plugins/storybook/index.js +2 -1
  215. package/dist/plugins/stryker/index.d.ts +3 -10
  216. package/dist/plugins/stryker/index.js +2 -1
  217. package/dist/plugins/stylelint/index.d.ts +3 -10
  218. package/dist/plugins/stylelint/index.js +2 -1
  219. package/dist/plugins/svelte/index.d.ts +3 -10
  220. package/dist/plugins/svelte/index.js +2 -1
  221. package/dist/plugins/svgo/index.d.ts +3 -8
  222. package/dist/plugins/svgo/index.js +2 -1
  223. package/dist/plugins/syncpack/index.d.ts +3 -8
  224. package/dist/plugins/syncpack/index.js +2 -1
  225. package/dist/plugins/tailwind/index.d.ts +3 -8
  226. package/dist/plugins/tailwind/index.js +2 -1
  227. package/dist/plugins/travis/index.d.ts +3 -10
  228. package/dist/plugins/travis/index.js +2 -1
  229. package/dist/plugins/ts-node/index.d.ts +3 -14
  230. package/dist/plugins/ts-node/index.js +2 -1
  231. package/dist/plugins/tsdown/index.d.ts +3 -13
  232. package/dist/plugins/tsdown/index.js +2 -1
  233. package/dist/plugins/tsup/index.d.ts +3 -13
  234. package/dist/plugins/tsup/index.js +2 -1
  235. package/dist/plugins/tsx/index.d.ts +3 -15
  236. package/dist/plugins/tsx/index.js +2 -1
  237. package/dist/plugins/typedoc/index.d.ts +3 -16
  238. package/dist/plugins/typedoc/index.js +2 -1
  239. package/dist/plugins/typescript/index.d.ts +3 -18
  240. package/dist/plugins/typescript/index.js +2 -1
  241. package/dist/plugins/unbuild/index.d.ts +3 -10
  242. package/dist/plugins/unbuild/index.js +2 -1
  243. package/dist/plugins/unocss/index.d.ts +3 -8
  244. package/dist/plugins/unocss/index.js +2 -1
  245. package/dist/plugins/vercel-og/index.d.ts +3 -8
  246. package/dist/plugins/vercel-og/index.js +2 -1
  247. package/dist/plugins/vike/index.d.ts +3 -8
  248. package/dist/plugins/vike/index.js +2 -1
  249. package/dist/plugins/vite/index.d.ts +3 -10
  250. package/dist/plugins/vite/index.js +2 -1
  251. package/dist/plugins/vitest/index.d.ts +3 -16
  252. package/dist/plugins/vitest/index.js +2 -1
  253. package/dist/plugins/vue/index.d.ts +3 -10
  254. package/dist/plugins/vue/index.js +2 -1
  255. package/dist/plugins/webdriver-io/index.d.ts +3 -10
  256. package/dist/plugins/webdriver-io/index.js +2 -1
  257. package/dist/plugins/webpack/index.d.ts +3 -13
  258. package/dist/plugins/webpack/index.js +2 -1
  259. package/dist/plugins/wireit/index.d.ts +3 -10
  260. package/dist/plugins/wireit/index.js +2 -1
  261. package/dist/plugins/wrangler/index.d.ts +3 -10
  262. package/dist/plugins/wrangler/index.js +2 -1
  263. package/dist/plugins/xo/index.d.ts +3 -11
  264. package/dist/plugins/xo/index.js +2 -1
  265. package/dist/plugins/yarn/index.d.ts +3 -9
  266. package/dist/plugins/yarn/index.js +2 -1
  267. package/dist/plugins/yorkie/index.d.ts +3 -11
  268. package/dist/plugins/yorkie/index.js +2 -1
  269. package/dist/reporters/json.js +1 -0
  270. package/dist/reporters/util/util.d.ts +1 -1
  271. package/dist/schema/configuration.d.ts +24 -4
  272. package/dist/schema/configuration.js +1 -0
  273. package/dist/schema/plugins.d.ts +10 -0
  274. package/dist/schema/plugins.js +2 -0
  275. package/dist/types/PluginNames.d.ts +2 -2
  276. package/dist/types/PluginNames.js +2 -0
  277. package/dist/types/config.d.ts +2 -0
  278. package/dist/types/imports.d.ts +1 -3
  279. package/dist/types/issues.d.ts +1 -0
  280. package/dist/types/package-json.d.ts +12 -1
  281. package/dist/types.d.ts +1 -1
  282. package/dist/typescript/get-imports-and-exports.js +12 -8
  283. package/dist/typescript/visitors/dynamic-imports/importCall.js +23 -15
  284. package/dist/typescript/visitors/dynamic-imports/importType.js +7 -1
  285. package/dist/typescript/visitors/dynamic-imports/index.js +2 -1
  286. package/dist/typescript/visitors/dynamic-imports/jsDocType.js +13 -2
  287. package/dist/typescript/visitors/dynamic-imports/requireCall.js +13 -9
  288. package/dist/typescript/visitors/dynamic-imports/resolveCall.js +7 -1
  289. package/dist/typescript/visitors/dynamic-imports/urlConstructor.d.ts +3 -0
  290. package/dist/typescript/visitors/dynamic-imports/urlConstructor.js +24 -0
  291. package/dist/typescript/visitors/helpers.js +13 -2
  292. package/dist/typescript/visitors/imports/importDeclaration.js +6 -5
  293. package/dist/typescript/visitors/imports/importEqualsDeclaration.js +9 -1
  294. package/dist/typescript/visitors/imports/reExportDeclaration.js +10 -5
  295. package/dist/util/catalog.d.ts +6 -0
  296. package/dist/util/catalog.js +62 -0
  297. package/dist/util/cli-arguments.d.ts +1 -1
  298. package/dist/util/cli-arguments.js +3 -3
  299. package/dist/util/create-options.d.ts +27 -4
  300. package/dist/util/create-options.js +8 -5
  301. package/dist/util/errors.js +11 -1
  302. package/dist/util/get-included-issue-types.d.ts +1 -1
  303. package/dist/util/get-included-issue-types.js +3 -2
  304. package/dist/util/modules.js +26 -14
  305. package/dist/util/trace.js +4 -4
  306. package/dist/version.d.ts +1 -1
  307. package/dist/version.js +1 -1
  308. package/package.json +1 -1
  309. package/schema.json +52 -32
@@ -3,7 +3,7 @@ import type { Issue, IssueSeverity, IssueSymbol } from '../../types/issues.js';
3
3
  import { Table } from '../../util/table.js';
4
4
  export declare const dim: import("picocolors/types.js").Formatter;
5
5
  export declare const bright: import("picocolors/types.js").Formatter;
6
- export declare const getIssueTypeTitle: (reportType: keyof typeof ISSUE_TYPE_TITLE) => "Unused files" | "Unused dependencies" | "Unused devDependencies" | "Referenced optional peerDependencies" | "Unlisted dependencies" | "Unlisted binaries" | "Unresolved imports" | "Unused exports" | "Exports in used namespace" | "Unused exported types" | "Exported types in used namespace" | "Unused exported enum members" | "Unused exported class members" | "Duplicate exports";
6
+ export declare const getIssueTypeTitle: (reportType: keyof typeof ISSUE_TYPE_TITLE) => "Unused files" | "Unused dependencies" | "Unused devDependencies" | "Referenced optional peerDependencies" | "Unlisted dependencies" | "Unlisted binaries" | "Unresolved imports" | "Unused exports" | "Exports in used namespace" | "Unused exported types" | "Exported types in used namespace" | "Unused exported enum members" | "Unused exported class members" | "Duplicate exports" | "Unused catalog entries";
7
7
  export declare const getColoredTitle: (title: string, count: number) => string;
8
8
  export declare const getDimmedTitle: (title: string, count: number) => string;
9
9
  type LogIssueLine = {
@@ -227,6 +227,16 @@ export declare const knipConfigurationSchema: z.ZodMiniObject<{
227
227
  entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
228
228
  project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
229
229
  }, z.core.$strip>]>>;
230
+ mdx: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
231
+ config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
232
+ entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
233
+ project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
234
+ }, z.core.$strip>]>>;
235
+ mdxlint: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
236
+ config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
237
+ entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
238
+ project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
239
+ }, z.core.$strip>]>>;
230
240
  metro: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
231
241
  config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
232
242
  entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
@@ -808,6 +818,16 @@ export declare const knipConfigurationSchema: z.ZodMiniObject<{
808
818
  entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
809
819
  project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
810
820
  }, z.core.$strip>]>>;
821
+ mdx: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
822
+ config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
823
+ entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
824
+ project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
825
+ }, z.core.$strip>]>>;
826
+ mdxlint: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
827
+ config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
828
+ entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
829
+ project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
830
+ }, z.core.$strip>]>>;
811
831
  metro: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
812
832
  config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
813
833
  entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
@@ -1174,10 +1194,10 @@ export declare const knipConfigurationSchema: z.ZodMiniObject<{
1174
1194
  ignoreUnresolved: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniCustom<RegExp, RegExp>]>>>;
1175
1195
  includeEntryExports: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
1176
1196
  }, z.core.$strict>>>;
1177
- include: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniLiteral<"files">, z.ZodMiniLiteral<"dependencies">, z.ZodMiniLiteral<"devDependencies">, z.ZodMiniLiteral<"optionalPeerDependencies">, z.ZodMiniLiteral<"unlisted">, z.ZodMiniLiteral<"binaries">, z.ZodMiniLiteral<"unresolved">, z.ZodMiniLiteral<"exports">, z.ZodMiniLiteral<"types">, z.ZodMiniLiteral<"nsExports">, z.ZodMiniLiteral<"nsTypes">, z.ZodMiniLiteral<"duplicates">, z.ZodMiniLiteral<"enumMembers">, z.ZodMiniLiteral<"classMembers">]>>>;
1178
- exclude: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniLiteral<"files">, z.ZodMiniLiteral<"dependencies">, z.ZodMiniLiteral<"devDependencies">, z.ZodMiniLiteral<"optionalPeerDependencies">, z.ZodMiniLiteral<"unlisted">, z.ZodMiniLiteral<"binaries">, z.ZodMiniLiteral<"unresolved">, z.ZodMiniLiteral<"exports">, z.ZodMiniLiteral<"types">, z.ZodMiniLiteral<"nsExports">, z.ZodMiniLiteral<"nsTypes">, z.ZodMiniLiteral<"duplicates">, z.ZodMiniLiteral<"enumMembers">, z.ZodMiniLiteral<"classMembers">]>>>;
1197
+ include: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniLiteral<"files">, z.ZodMiniLiteral<"dependencies">, z.ZodMiniLiteral<"devDependencies">, z.ZodMiniLiteral<"optionalPeerDependencies">, z.ZodMiniLiteral<"unlisted">, z.ZodMiniLiteral<"binaries">, z.ZodMiniLiteral<"unresolved">, z.ZodMiniLiteral<"exports">, z.ZodMiniLiteral<"types">, z.ZodMiniLiteral<"nsExports">, z.ZodMiniLiteral<"nsTypes">, z.ZodMiniLiteral<"duplicates">, z.ZodMiniLiteral<"enumMembers">, z.ZodMiniLiteral<"classMembers">, z.ZodMiniLiteral<"catalog">]>>>;
1198
+ exclude: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniLiteral<"files">, z.ZodMiniLiteral<"dependencies">, z.ZodMiniLiteral<"devDependencies">, z.ZodMiniLiteral<"optionalPeerDependencies">, z.ZodMiniLiteral<"unlisted">, z.ZodMiniLiteral<"binaries">, z.ZodMiniLiteral<"unresolved">, z.ZodMiniLiteral<"exports">, z.ZodMiniLiteral<"types">, z.ZodMiniLiteral<"nsExports">, z.ZodMiniLiteral<"nsTypes">, z.ZodMiniLiteral<"duplicates">, z.ZodMiniLiteral<"enumMembers">, z.ZodMiniLiteral<"classMembers">, z.ZodMiniLiteral<"catalog">]>>>;
1179
1199
  $schema: z.ZodMiniOptional<z.ZodMiniString<string>>;
1180
- rules: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniUnion<readonly [z.ZodMiniLiteral<"files">, z.ZodMiniLiteral<"dependencies">, z.ZodMiniLiteral<"devDependencies">, z.ZodMiniLiteral<"optionalPeerDependencies">, z.ZodMiniLiteral<"unlisted">, z.ZodMiniLiteral<"binaries">, z.ZodMiniLiteral<"unresolved">, z.ZodMiniLiteral<"exports">, z.ZodMiniLiteral<"types">, z.ZodMiniLiteral<"nsExports">, z.ZodMiniLiteral<"nsTypes">, z.ZodMiniLiteral<"duplicates">, z.ZodMiniLiteral<"enumMembers">, z.ZodMiniLiteral<"classMembers">]> & z.core.$partial, z.ZodMiniEnum<{
1200
+ rules: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniUnion<readonly [z.ZodMiniLiteral<"files">, z.ZodMiniLiteral<"dependencies">, z.ZodMiniLiteral<"devDependencies">, z.ZodMiniLiteral<"optionalPeerDependencies">, z.ZodMiniLiteral<"unlisted">, z.ZodMiniLiteral<"binaries">, z.ZodMiniLiteral<"unresolved">, z.ZodMiniLiteral<"exports">, z.ZodMiniLiteral<"types">, z.ZodMiniLiteral<"nsExports">, z.ZodMiniLiteral<"nsTypes">, z.ZodMiniLiteral<"duplicates">, z.ZodMiniLiteral<"enumMembers">, z.ZodMiniLiteral<"classMembers">, z.ZodMiniLiteral<"catalog">]> & z.core.$partial, z.ZodMiniEnum<{
1181
1201
  error: "error";
1182
1202
  warn: "warn";
1183
1203
  off: "off";
@@ -1194,7 +1214,7 @@ export declare const knipConfigurationSchema: z.ZodMiniObject<{
1194
1214
  ignoreExportsUsedInFile: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniObject<{
1195
1215
  [k: string]: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
1196
1216
  }, z.core.$strict>]>>;
1197
- ignoreIssues: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniLiteral<"files">, z.ZodMiniLiteral<"dependencies">, z.ZodMiniLiteral<"devDependencies">, z.ZodMiniLiteral<"optionalPeerDependencies">, z.ZodMiniLiteral<"unlisted">, z.ZodMiniLiteral<"binaries">, z.ZodMiniLiteral<"unresolved">, z.ZodMiniLiteral<"exports">, z.ZodMiniLiteral<"types">, z.ZodMiniLiteral<"nsExports">, z.ZodMiniLiteral<"nsTypes">, z.ZodMiniLiteral<"duplicates">, z.ZodMiniLiteral<"enumMembers">, z.ZodMiniLiteral<"classMembers">]>>>>;
1217
+ ignoreIssues: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniLiteral<"files">, z.ZodMiniLiteral<"dependencies">, z.ZodMiniLiteral<"devDependencies">, z.ZodMiniLiteral<"optionalPeerDependencies">, z.ZodMiniLiteral<"unlisted">, z.ZodMiniLiteral<"binaries">, z.ZodMiniLiteral<"unresolved">, z.ZodMiniLiteral<"exports">, z.ZodMiniLiteral<"types">, z.ZodMiniLiteral<"nsExports">, z.ZodMiniLiteral<"nsTypes">, z.ZodMiniLiteral<"duplicates">, z.ZodMiniLiteral<"enumMembers">, z.ZodMiniLiteral<"classMembers">, z.ZodMiniLiteral<"catalog">]>>>>;
1198
1218
  ignoreWorkspaces: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>;
1199
1219
  includeEntryExports: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
1200
1220
  compilers: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnion<readonly [z.ZodMiniUnion<readonly [z.ZodMiniLiteral<true>, z.ZodMiniCustom<SyncCompiler, SyncCompiler>]>, z.ZodMiniCustom<AsyncCompiler, AsyncCompiler>]>>>;
@@ -22,6 +22,7 @@ const issueTypeSchema = z.union([
22
22
  z.literal('duplicates'),
23
23
  z.literal('enumMembers'),
24
24
  z.literal('classMembers'),
25
+ z.literal('catalog'),
25
26
  ]);
26
27
  const rulesSchema = z.partialRecord(issueTypeSchema, z.enum(['error', 'warn', 'off']));
27
28
  const ignorableSymbolTypes = Object.values(SYMBOL_TYPE).filter(type => type !== 'unknown');
@@ -231,6 +231,16 @@ export declare const pluginsSchema: z.ZodMiniObject<{
231
231
  entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
232
232
  project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
233
233
  }, z.core.$strip>]>;
234
+ mdx: z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
235
+ config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
236
+ entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
237
+ project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
238
+ }, z.core.$strip>]>;
239
+ mdxlint: z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
240
+ config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
241
+ entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
242
+ project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
243
+ }, z.core.$strip>]>;
234
244
  metro: z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
235
245
  config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
236
246
  entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
@@ -55,6 +55,8 @@ export const pluginsSchema = z.object({
55
55
  'lockfile-lint': pluginSchema,
56
56
  'lost-pixel': pluginSchema,
57
57
  markdownlint: pluginSchema,
58
+ mdx: pluginSchema,
59
+ mdxlint: pluginSchema,
58
60
  metro: pluginSchema,
59
61
  mocha: pluginSchema,
60
62
  moonrepo: pluginSchema,
@@ -1,2 +1,2 @@
1
- export type PluginName = 'angular' | 'astro' | 'astro-db' | 'ava' | 'babel' | 'biome' | 'bumpp' | 'bun' | 'c8' | 'capacitor' | 'changelogen' | 'changelogithub' | 'changesets' | 'commitizen' | 'commitlint' | 'convex' | 'create-typescript-app' | 'cspell' | 'cucumber' | 'cypress' | 'danger' | 'dependency-cruiser' | 'docusaurus' | 'dotenv' | 'drizzle' | 'eleventy' | 'eslint' | 'expo' | 'gatsby' | 'github-action' | 'github-actions' | 'glob' | 'graphql-codegen' | 'hardhat' | 'husky' | 'i18next-parser' | 'jest' | 'karma' | 'ladle' | 'lefthook' | 'lint-staged' | 'linthtml' | 'lockfile-lint' | 'lost-pixel' | 'markdownlint' | 'metro' | 'mocha' | 'moonrepo' | 'msw' | 'nano-staged' | 'nest' | 'netlify' | 'next' | 'node' | 'node-modules-inspector' | 'nodemon' | 'npm-package-json-lint' | 'nuxt' | 'nx' | 'nyc' | 'oclif' | 'oxlint' | 'playwright' | 'playwright-ct' | 'playwright-test' | 'plop' | 'pnpm' | 'postcss' | 'preconstruct' | 'prettier' | 'prisma' | 'react-cosmos' | 'react-router' | 'relay' | 'release-it' | 'remark' | 'remix' | 'rollup' | 'rsbuild' | 'rslib' | 'rspack' | 'rstest' | 'semantic-release' | 'sentry' | 'simple-git-hooks' | 'size-limit' | 'sst' | 'starlight' | 'storybook' | 'stryker' | 'stylelint' | 'svelte' | 'svgo' | 'syncpack' | 'tailwind' | 'travis' | 'ts-node' | 'tsdown' | 'tsup' | 'tsx' | 'typedoc' | 'typescript' | 'unbuild' | 'unocss' | 'vercel-og' | 'vike' | 'vite' | 'vitest' | 'vue' | 'webdriver-io' | 'webpack' | 'wireit' | 'wrangler' | 'xo' | 'yarn' | 'yorkie';
2
- export declare const pluginNames: readonly ["angular", "astro", "astro-db", "ava", "babel", "biome", "bumpp", "bun", "c8", "capacitor", "changelogen", "changelogithub", "changesets", "commitizen", "commitlint", "convex", "create-typescript-app", "cspell", "cucumber", "cypress", "danger", "dependency-cruiser", "docusaurus", "dotenv", "drizzle", "eleventy", "eslint", "expo", "gatsby", "github-action", "github-actions", "glob", "graphql-codegen", "hardhat", "husky", "i18next-parser", "jest", "karma", "ladle", "lefthook", "lint-staged", "linthtml", "lockfile-lint", "lost-pixel", "markdownlint", "metro", "mocha", "moonrepo", "msw", "nano-staged", "nest", "netlify", "next", "node", "node-modules-inspector", "nodemon", "npm-package-json-lint", "nuxt", "nx", "nyc", "oclif", "oxlint", "playwright", "playwright-ct", "playwright-test", "plop", "pnpm", "postcss", "preconstruct", "prettier", "prisma", "react-cosmos", "react-router", "relay", "release-it", "remark", "remix", "rollup", "rsbuild", "rslib", "rspack", "rstest", "semantic-release", "sentry", "simple-git-hooks", "size-limit", "sst", "starlight", "storybook", "stryker", "stylelint", "svelte", "svgo", "syncpack", "tailwind", "travis", "ts-node", "tsdown", "tsup", "tsx", "typedoc", "typescript", "unbuild", "unocss", "vercel-og", "vike", "vite", "vitest", "vue", "webdriver-io", "webpack", "wireit", "wrangler", "xo", "yarn", "yorkie"];
1
+ export type PluginName = 'angular' | 'astro' | 'astro-db' | 'ava' | 'babel' | 'biome' | 'bumpp' | 'bun' | 'c8' | 'capacitor' | 'changelogen' | 'changelogithub' | 'changesets' | 'commitizen' | 'commitlint' | 'convex' | 'create-typescript-app' | 'cspell' | 'cucumber' | 'cypress' | 'danger' | 'dependency-cruiser' | 'docusaurus' | 'dotenv' | 'drizzle' | 'eleventy' | 'eslint' | 'expo' | 'gatsby' | 'github-action' | 'github-actions' | 'glob' | 'graphql-codegen' | 'hardhat' | 'husky' | 'i18next-parser' | 'jest' | 'karma' | 'ladle' | 'lefthook' | 'lint-staged' | 'linthtml' | 'lockfile-lint' | 'lost-pixel' | 'markdownlint' | 'mdx' | 'mdxlint' | 'metro' | 'mocha' | 'moonrepo' | 'msw' | 'nano-staged' | 'nest' | 'netlify' | 'next' | 'node' | 'node-modules-inspector' | 'nodemon' | 'npm-package-json-lint' | 'nuxt' | 'nx' | 'nyc' | 'oclif' | 'oxlint' | 'playwright' | 'playwright-ct' | 'playwright-test' | 'plop' | 'pnpm' | 'postcss' | 'preconstruct' | 'prettier' | 'prisma' | 'react-cosmos' | 'react-router' | 'relay' | 'release-it' | 'remark' | 'remix' | 'rollup' | 'rsbuild' | 'rslib' | 'rspack' | 'rstest' | 'semantic-release' | 'sentry' | 'simple-git-hooks' | 'size-limit' | 'sst' | 'starlight' | 'storybook' | 'stryker' | 'stylelint' | 'svelte' | 'svgo' | 'syncpack' | 'tailwind' | 'travis' | 'ts-node' | 'tsdown' | 'tsup' | 'tsx' | 'typedoc' | 'typescript' | 'unbuild' | 'unocss' | 'vercel-og' | 'vike' | 'vite' | 'vitest' | 'vue' | 'webdriver-io' | 'webpack' | 'wireit' | 'wrangler' | 'xo' | 'yarn' | 'yorkie';
2
+ export declare const pluginNames: readonly ["angular", "astro", "astro-db", "ava", "babel", "biome", "bumpp", "bun", "c8", "capacitor", "changelogen", "changelogithub", "changesets", "commitizen", "commitlint", "convex", "create-typescript-app", "cspell", "cucumber", "cypress", "danger", "dependency-cruiser", "docusaurus", "dotenv", "drizzle", "eleventy", "eslint", "expo", "gatsby", "github-action", "github-actions", "glob", "graphql-codegen", "hardhat", "husky", "i18next-parser", "jest", "karma", "ladle", "lefthook", "lint-staged", "linthtml", "lockfile-lint", "lost-pixel", "markdownlint", "mdx", "mdxlint", "metro", "mocha", "moonrepo", "msw", "nano-staged", "nest", "netlify", "next", "node", "node-modules-inspector", "nodemon", "npm-package-json-lint", "nuxt", "nx", "nyc", "oclif", "oxlint", "playwright", "playwright-ct", "playwright-test", "plop", "pnpm", "postcss", "preconstruct", "prettier", "prisma", "react-cosmos", "react-router", "relay", "release-it", "remark", "remix", "rollup", "rsbuild", "rslib", "rspack", "rstest", "semantic-release", "sentry", "simple-git-hooks", "size-limit", "sst", "starlight", "storybook", "stryker", "stylelint", "svelte", "svgo", "syncpack", "tailwind", "travis", "ts-node", "tsdown", "tsup", "tsx", "typedoc", "typescript", "unbuild", "unocss", "vercel-og", "vike", "vite", "vitest", "vue", "webdriver-io", "webpack", "wireit", "wrangler", "xo", "yarn", "yorkie"];
@@ -44,6 +44,8 @@ export const pluginNames = [
44
44
  'lockfile-lint',
45
45
  'lost-pixel',
46
46
  'markdownlint',
47
+ 'mdx',
48
+ 'mdxlint',
47
49
  'metro',
48
50
  'mocha',
49
51
  'moonrepo',
@@ -3,6 +3,7 @@ import type { z } from 'zod/mini';
3
3
  import type { AsyncCompilers, SyncCompilers } from '../compilers/types.js';
4
4
  import type { knipConfigurationSchema } from '../schema/configuration.js';
5
5
  import type { pluginSchema } from '../schema/plugins.js';
6
+ import type { ParsedCLIArgs } from '../util/cli-arguments.js';
6
7
  import type { Input } from '../util/input.js';
7
8
  import type { Args } from './args.js';
8
9
  import type { IssueType, SymbolType } from './issues.js';
@@ -21,6 +22,7 @@ export interface BinaryResolverOptions extends GetInputsFromScriptsOptions {
21
22
  }
22
23
  export type BinaryResolver = (binary: string, args: string[], options: BinaryResolverOptions) => Input[];
23
24
  export type RawConfiguration = z.infer<typeof knipConfigurationSchema>;
25
+ export type RawConfigurationOrFn = RawConfiguration | ((options: ParsedCLIArgs) => RawConfiguration | Promise<RawConfiguration>);
24
26
  export type RawPluginConfiguration = z.infer<typeof pluginSchema>;
25
27
  export type IgnorePatterns = (string | RegExp)[];
26
28
  type IgnorableExport = Exclude<SymbolType, 'unknown'>;
@@ -6,7 +6,5 @@ export interface ImportNode {
6
6
  namespace?: string | undefined;
7
7
  pos: number;
8
8
  symbol?: ts.Symbol;
9
- isTypeOnly?: boolean;
10
- isReExport?: boolean;
11
- resolve?: boolean;
9
+ modifiers: number;
12
10
  }
@@ -39,6 +39,7 @@ export type Issues = {
39
39
  duplicates: IssueRecords;
40
40
  enumMembers: IssueRecords;
41
41
  classMembers: IssueRecords;
42
+ catalog: IssueRecords;
42
43
  };
43
44
  export type IssueType = keyof Issues;
44
45
  export type SymbolIssueType = Exclude<IssueType, 'files'>;
@@ -1,4 +1,4 @@
1
- import type { PluginMap } from './config.js';
1
+ import type { PluginMap, WorkspaceConfiguration } from './config.js';
2
2
  type Primitive = null | undefined | string | number | boolean | symbol | bigint;
3
3
  type LiteralUnion<LiteralType, BaseType extends Primitive> = LiteralType | (BaseType & Record<never, never>);
4
4
  type Dependencies = Record<string, string>;
@@ -23,6 +23,8 @@ type PluginConfig<P> = {
23
23
  };
24
24
  type Plugins = PluginConfig<PluginMap>;
25
25
  export type Scripts = Record<string, string>;
26
+ export type Catalog = Record<string, string>;
27
+ export type Catalogs = Record<string, Catalog>;
26
28
  export type PackageJson = {
27
29
  name?: string;
28
30
  main?: string;
@@ -30,6 +32,8 @@ export type PackageJson = {
30
32
  version?: string;
31
33
  workspaces?: string[] | {
32
34
  packages?: string[];
35
+ catalog?: Catalog;
36
+ catalogs?: Catalogs;
33
37
  };
34
38
  exports?: Exports;
35
39
  imports?: Imports;
@@ -41,11 +45,18 @@ export type PackageJson = {
41
45
  peerDependenciesMeta?: Record<string, {
42
46
  optional: true;
43
47
  }>;
48
+ resolutions?: Dependencies;
44
49
  module?: string;
45
50
  browser?: string;
46
51
  types?: string;
47
52
  typings?: string;
53
+ catalog?: Catalog;
54
+ catalogs?: Catalogs;
48
55
  packageManager?: string;
56
+ pnpm?: {
57
+ overrides?: Dependencies;
58
+ };
59
+ knip?: WorkspaceConfiguration;
49
60
  } & Plugins;
50
61
  export type WorkspacePackage = {
51
62
  dir: string;
package/dist/types.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export type { RawConfiguration as KnipConfig } from './types/config.js';
1
+ export type { RawConfigurationOrFn as KnipConfig } from './types/config.js';
2
2
  export type { Preprocessor, Reporter, ReporterOptions } from './types/issues.js';
@@ -1,10 +1,10 @@
1
1
  import { isBuiltin } from 'node:module';
2
2
  import ts from 'typescript';
3
- import { ALIAS_TAG, ANONYMOUS, IMPORT_STAR, PROTOCOL_VIRTUAL } from '../constants.js';
3
+ import { ALIAS_TAG, ANONYMOUS, IMPORT_MODIFIERS, IMPORT_STAR, PROTOCOL_VIRTUAL } from '../constants.js';
4
4
  import { addNsValue, addValue, createImports } from '../util/module-graph.js';
5
5
  import { getPackageNameFromFilePath, isStartsLikePackageName, sanitizeSpecifier } from '../util/modules.js';
6
6
  import { timerify } from '../util/Performance.js';
7
- import { isInNodeModules } from '../util/path.js';
7
+ import { dirname, isInNodeModules, resolve } from '../util/path.js';
8
8
  import { shouldIgnore } from '../util/tag.js';
9
9
  import { getAccessMembers, getDestructuredNames, getJSDocTags, getLineAndCharacterOfPosition, getTypeRef, isAccessExpression, isConsiderReferencedNS, isDestructuring, isImportSpecifier, isInForIteration, isObjectEnumerationCallExpressionArgument, isReferencedInExport, } from './ast-helpers.js';
10
10
  import { findInternalReferences, isType } from './find-internal-references.js';
@@ -76,7 +76,7 @@ const getImportsAndExports = (sourceFile, resolveModule, typeChecker, options, i
76
76
  }
77
77
  };
78
78
  const addInternalImport = (options) => {
79
- const { identifier, symbol, filePath, namespace, alias, specifier, isReExport } = options;
79
+ const { identifier, symbol, filePath, namespace, alias, specifier } = options;
80
80
  const isStar = identifier === IMPORT_STAR;
81
81
  specifiers.add([{ specifier, pos: options.pos, line: options.line, col: options.col }, filePath]);
82
82
  const file = internal.get(filePath);
@@ -84,7 +84,7 @@ const getImportsAndExports = (sourceFile, resolveModule, typeChecker, options, i
84
84
  if (!file)
85
85
  internal.set(filePath, imports);
86
86
  const nsOrAlias = symbol ? String(symbol.escapedName) : alias;
87
- if (isReExport) {
87
+ if (options.modifiers & IMPORT_MODIFIERS.RE_EXPORT) {
88
88
  if (isStar && namespace) {
89
89
  addValue(imports.reExportedNs, namespace, sourceFile.fileName);
90
90
  }
@@ -118,7 +118,7 @@ const getImportsAndExports = (sourceFile, resolveModule, typeChecker, options, i
118
118
  if (module) {
119
119
  const filePath = module.resolvedFileName;
120
120
  if (filePath) {
121
- if (opts.resolve && !isInNodeModules(filePath)) {
121
+ if (opts.modifiers && opts.modifiers & IMPORT_MODIFIERS.ENTRY && !isInNodeModules(filePath)) {
122
122
  resolved.add(filePath);
123
123
  return;
124
124
  }
@@ -128,13 +128,12 @@ const getImportsAndExports = (sourceFile, resolveModule, typeChecker, options, i
128
128
  ...opts,
129
129
  identifier: opts.identifier ?? ANONYMOUS,
130
130
  filePath,
131
- isReExport: opts.isReExport ?? false,
132
131
  line: line + 1,
133
132
  col: character + 1,
134
133
  });
135
134
  }
136
135
  if (module.isExternalLibraryImport) {
137
- if (options.skipTypeOnly && opts.isTypeOnly)
136
+ if (options.skipTypeOnly && opts.modifiers & IMPORT_MODIFIERS.TYPE_ONLY)
138
137
  return;
139
138
  const isInNM = isInNodeModules(opts.specifier);
140
139
  const sanitizedSpecifier = sanitizeSpecifier(isInNM || isInNodeModules(filePath) ? getPackageNameFromFilePath(opts.specifier) : opts.specifier);
@@ -152,12 +151,17 @@ const getImportsAndExports = (sourceFile, resolveModule, typeChecker, options, i
152
151
  }
153
152
  }
154
153
  else {
155
- if (options.skipTypeOnly && opts.isTypeOnly)
154
+ if (options.skipTypeOnly && opts.modifiers & IMPORT_MODIFIERS.TYPE_ONLY)
156
155
  return;
157
156
  if (shouldIgnore(getJSDocTags(node), options.tags))
158
157
  return;
159
158
  if (opts.specifier.startsWith(PROTOCOL_VIRTUAL))
160
159
  return;
160
+ const r = resolve(dirname(sourceFile.fileName), opts.specifier);
161
+ if (opts.modifiers && opts.modifiers & IMPORT_MODIFIERS.OPTIONAL) {
162
+ resolved.add(r);
163
+ return;
164
+ }
161
165
  const pos = 'moduleSpecifier' in node ? node.moduleSpecifier.pos : node.pos;
162
166
  const { line, character } = sourceFile.getLineAndCharacterOfPosition(pos);
163
167
  unresolved.add({ specifier: opts.specifier, pos, line: line + 1, col: character + 2 });
@@ -1,5 +1,5 @@
1
1
  import ts from 'typescript';
2
- import { ANONYMOUS } from '../../../constants.js';
2
+ import { ANONYMOUS, IMPORT_MODIFIERS } from '../../../constants.js';
3
3
  import { findAncestor, findDescendants, getAccessedIdentifiers, isAccessExpression, isImportCall, isTopLevel, stripQuotes, } from '../../ast-helpers.js';
4
4
  import { importVisitor as visit } from '../index.js';
5
5
  const getSymbol = (node, isTopLevel) => (isTopLevel ? node.symbol : undefined);
@@ -7,6 +7,7 @@ export default visit(() => true, node => {
7
7
  if (isImportCall(node)) {
8
8
  if (node.arguments[0] && ts.isStringLiteralLike(node.arguments[0])) {
9
9
  const specifier = node.arguments[0].text;
10
+ const modifiers = IMPORT_MODIFIERS.NONE;
10
11
  if (specifier) {
11
12
  const accessExpression = findAncestor(node, _node => {
12
13
  if (ts.isExpressionStatement(_node) || ts.isCallExpression(_node))
@@ -27,7 +28,7 @@ export default visit(() => true, node => {
27
28
  if (accessExpressions.length > 0) {
28
29
  return accessExpressions.map(binding => {
29
30
  const identifier = String(binding.name.escapedText);
30
- return { identifier, specifier, pos };
31
+ return { identifier, specifier, pos, modifiers };
31
32
  });
32
33
  }
33
34
  }
@@ -35,21 +36,21 @@ export default visit(() => true, node => {
35
36
  return arg.name.elements.map(element => {
36
37
  const identifier = (element.propertyName ?? element.name).getText();
37
38
  const alias = element.propertyName ? element.name.getText() : undefined;
38
- return { identifier, alias, specifier, pos: element.pos };
39
+ return { identifier, alias, specifier, pos: element.pos, modifiers };
39
40
  });
40
41
  }
41
42
  }
42
- return { identifier: 'default', specifier, pos };
43
+ return { identifier: 'default', specifier, pos, modifiers };
43
44
  }
44
45
  if (identifier !== 'catch')
45
- return { identifier, specifier, pos };
46
+ return { identifier, specifier, pos, modifiers };
46
47
  }
47
48
  if (ts.isElementAccessExpression(accessExpression) &&
48
49
  ts.isStringLiteral(accessExpression.argumentExpression)) {
49
50
  const name = stripQuotes(accessExpression.argumentExpression.text);
50
51
  const pos = accessExpression.argumentExpression.pos;
51
52
  const identifier = name;
52
- return { identifier, specifier, pos };
53
+ return { identifier, specifier, pos, modifiers };
53
54
  }
54
55
  }
55
56
  const variableDeclaration = accessExpression &&
@@ -67,9 +68,16 @@ export default visit(() => true, node => {
67
68
  const scope = findAncestor(variableDeclaration, ts.isFunctionBody) || node.getSourceFile();
68
69
  const accessed = getAccessedIdentifiers(alias, scope);
69
70
  if (accessed.length > 0) {
70
- return accessed.map(acc => ({ identifier: acc.identifier, alias, symbol, specifier, pos: acc.pos }));
71
+ return accessed.map(acc => ({
72
+ identifier: acc.identifier,
73
+ alias,
74
+ symbol,
75
+ specifier,
76
+ pos: acc.pos,
77
+ modifiers,
78
+ }));
71
79
  }
72
- return { identifier: 'default', alias, symbol, specifier, pos: node.arguments[0].pos };
80
+ return { identifier: 'default', alias, symbol, specifier, pos: node.arguments[0].pos, modifiers };
73
81
  }
74
82
  const bindings = findDescendants(variableDeclaration, ts.isBindingElement);
75
83
  if (bindings.length > 0) {
@@ -77,10 +85,10 @@ export default visit(() => true, node => {
77
85
  const identifier = (element.propertyName ?? element.name).getText();
78
86
  const alias = element.propertyName ? element.name.getText() : undefined;
79
87
  const symbol = getSymbol(element, isTLA);
80
- return { identifier, alias, symbol, specifier, pos: element.pos };
88
+ return { identifier, alias, symbol, specifier, pos: element.pos, modifiers };
81
89
  });
82
90
  }
83
- return { identifier: ANONYMOUS, specifier, pos: node.arguments[0].pos };
91
+ return { identifier: ANONYMOUS, specifier, pos: node.arguments[0].pos, modifiers };
84
92
  }
85
93
  const arrayLiteralExpression = node.parent;
86
94
  const variableDeclarationParent = node.parent.parent?.parent?.parent;
@@ -98,20 +106,20 @@ export default visit(() => true, node => {
98
106
  const identifier = (element.propertyName ?? element.name).getText();
99
107
  const alias = element.propertyName ? element.name.getText() : undefined;
100
108
  const symbol = getSymbol(element, isTL);
101
- return { identifier, alias, symbol, specifier, pos: element.pos };
109
+ return { identifier, alias, symbol, specifier, pos: element.pos, modifiers };
102
110
  });
103
111
  }
104
112
  if (!ts.isOmittedExpression(element) && ts.isIdentifier(element.name)) {
105
113
  const alias = String(element.name.escapedText);
106
114
  const symbol = getSymbol(element, isTL);
107
- return { identifier: 'default', symbol, alias, specifier, pos: element.pos };
115
+ return { identifier: 'default', symbol, alias, specifier, pos: element.pos, modifiers };
108
116
  }
109
- return { identifier: 'default', specifier, pos: element.pos };
117
+ return { identifier: 'default', specifier, pos: element.pos, modifiers };
110
118
  }
111
119
  }
112
- return { identifier: 'default', specifier, pos: node.arguments[0].pos };
120
+ return { identifier: 'default', specifier, pos: node.arguments[0].pos, modifiers };
113
121
  }
114
- return { specifier, identifier: 'default', pos: node.arguments[0].pos };
122
+ return { specifier, identifier: 'default', pos: node.arguments[0].pos, modifiers };
115
123
  }
116
124
  }
117
125
  });
@@ -1,9 +1,15 @@
1
1
  import ts from 'typescript';
2
+ import { IMPORT_MODIFIERS } from '../../../constants.js';
2
3
  import { importVisitor as visit } from '../index.js';
3
4
  export default visit(() => true, node => {
4
5
  if (ts.isImportTypeNode(node)) {
5
6
  if (ts.isLiteralTypeNode(node.argument) && ts.isStringLiteral(node.argument.literal)) {
6
- return { specifier: node.argument.literal.text, identifier: undefined, pos: 0, isTypeOnly: true };
7
+ return {
8
+ specifier: node.argument.literal.text,
9
+ identifier: undefined,
10
+ pos: 0,
11
+ modifiers: IMPORT_MODIFIERS.TYPE_ONLY,
12
+ };
7
13
  }
8
14
  }
9
15
  });
@@ -3,5 +3,6 @@ import importType from './importType.js';
3
3
  import jsDocType from './jsDocType.js';
4
4
  import requireCall from './requireCall.js';
5
5
  import resolveCall from './resolveCall.js';
6
- const visitors = [importCall, importType, jsDocType, resolveCall, requireCall];
6
+ import urlConstructor from './urlConstructor.js';
7
+ const visitors = [importCall, importType, jsDocType, resolveCall, requireCall, urlConstructor];
7
8
  export default (sourceFile) => visitors.map(v => v(sourceFile));
@@ -1,4 +1,5 @@
1
1
  import ts from 'typescript';
2
+ import { IMPORT_MODIFIERS } from '../../../constants.js';
2
3
  import { importVisitor as visit } from '../index.js';
3
4
  const supportsJSDocImportTag = 'isJSDocImportTag' in ts;
4
5
  const getImportSpecifiers = (node) => {
@@ -8,12 +9,22 @@ const getImportSpecifiers = (node) => {
8
9
  const importClause = node.argument;
9
10
  if (ts.isLiteralTypeNode(importClause) && ts.isStringLiteral(importClause.literal)) {
10
11
  const identifier = node.qualifier && ts.isIdentifier(node.qualifier) ? String(node.qualifier.escapedText) : 'default';
11
- imports.push({ specifier: importClause.literal.text, identifier, pos: importClause.literal.pos });
12
+ imports.push({
13
+ specifier: importClause.literal.text,
14
+ identifier,
15
+ pos: importClause.literal.pos,
16
+ modifiers: IMPORT_MODIFIERS.NONE,
17
+ });
12
18
  }
13
19
  }
14
20
  if (supportsJSDocImportTag && ts.isJSDocImportTag(node) && ts.isStringLiteralLike(node.moduleSpecifier)) {
15
21
  const moduleSpecifier = node.moduleSpecifier;
16
- imports.push({ specifier: moduleSpecifier.text, identifier: undefined, pos: moduleSpecifier.pos });
22
+ imports.push({
23
+ specifier: moduleSpecifier.text,
24
+ identifier: undefined,
25
+ pos: moduleSpecifier.pos,
26
+ modifiers: IMPORT_MODIFIERS.NONE,
27
+ });
17
28
  }
18
29
  ts.forEachChild(node, visit);
19
30
  }
@@ -1,22 +1,21 @@
1
1
  import ts from 'typescript';
2
- import { IMPORT_STAR } from '../../../constants.js';
2
+ import { IMPORT_MODIFIERS, IMPORT_STAR } from '../../../constants.js';
3
3
  import { findAncestor, findDescendants, isModuleExportsAccess, isRequireCall, isTopLevel } from '../../ast-helpers.js';
4
- import { isNotJS } from '../helpers.js';
5
4
  import { importVisitor as visit } from '../index.js';
6
5
  export default visit(() => true, node => {
7
6
  if (isRequireCall(node)) {
8
7
  if (ts.isStringLiteralLike(node.arguments[0])) {
9
8
  const specifier = node.arguments[0].text;
9
+ const modifiers = IMPORT_MODIFIERS.NONE;
10
10
  if (specifier) {
11
11
  const propertyAccessExpression = findAncestor(node, _node => {
12
12
  if (ts.isExpressionStatement(_node) || ts.isCallExpression(_node))
13
13
  return 'STOP';
14
14
  return ts.isPropertyAccessExpression(_node);
15
15
  });
16
- const resolve = isNotJS(node.getSourceFile());
17
16
  if (propertyAccessExpression) {
18
17
  const identifier = String(propertyAccessExpression.name.escapedText);
19
- return { identifier, specifier, pos: propertyAccessExpression.name.pos, resolve };
18
+ return { identifier, specifier, pos: propertyAccessExpression.name.pos, modifiers };
20
19
  }
21
20
  const variableDeclaration = node.parent;
22
21
  if (ts.isVariableDeclaration(variableDeclaration) &&
@@ -30,7 +29,7 @@ export default visit(() => true, node => {
30
29
  symbol: isTLA ? variableDeclaration.symbol : undefined,
31
30
  specifier,
32
31
  pos: node.arguments[0].pos,
33
- resolve,
32
+ modifiers,
34
33
  };
35
34
  }
36
35
  const bindings = findDescendants(variableDeclaration, ts.isBindingElement);
@@ -39,17 +38,22 @@ export default visit(() => true, node => {
39
38
  const identifier = (element.propertyName ?? element.name).getText();
40
39
  const alias = element.propertyName ? element.name.getText() : undefined;
41
40
  const symbol = isTLA ? element.symbol : undefined;
42
- return { identifier, specifier, alias, symbol, pos: element.pos, resolve };
41
+ return { identifier, specifier, alias, symbol, pos: element.pos, modifiers };
43
42
  });
44
43
  }
45
- return { identifier: 'default', specifier, pos: node.arguments[0].pos, resolve };
44
+ return { identifier: 'default', specifier, pos: node.arguments[0].pos, modifiers };
46
45
  }
47
46
  if (ts.isBinaryExpression(node.parent) &&
48
47
  ts.isPropertyAccessExpression(node.parent.left) &&
49
48
  isModuleExportsAccess(node.parent.left)) {
50
- return { identifier: IMPORT_STAR, specifier, isReExport: true, pos: node.arguments[0].pos };
49
+ return {
50
+ identifier: IMPORT_STAR,
51
+ specifier,
52
+ pos: node.arguments[0].pos,
53
+ modifiers: IMPORT_MODIFIERS.RE_EXPORT,
54
+ };
51
55
  }
52
- return { identifier: 'default', specifier, pos: node.arguments[0].pos, resolve };
56
+ return { identifier: 'default', specifier, pos: node.arguments[0].pos, modifiers };
53
57
  }
54
58
  }
55
59
  }
@@ -1,4 +1,5 @@
1
1
  import ts from 'typescript';
2
+ import { IMPORT_MODIFIERS } from '../../../constants.js';
2
3
  import { isPropertyAccessCall } from '../../ast-helpers.js';
3
4
  import { importVisitor as visit } from '../index.js';
4
5
  export default visit(() => true, node => {
@@ -6,7 +7,12 @@ export default visit(() => true, node => {
6
7
  if (node.arguments[0] && ts.isStringLiteralLike(node.arguments[0])) {
7
8
  const specifier = node.arguments[0].text;
8
9
  if (specifier)
9
- return { specifier, identifier: undefined, pos: node.arguments[0].pos, resolve: true };
10
+ return {
11
+ specifier,
12
+ identifier: undefined,
13
+ pos: node.arguments[0].pos,
14
+ modifiers: IMPORT_MODIFIERS.ENTRY,
15
+ };
10
16
  }
11
17
  }
12
18
  });
@@ -0,0 +1,3 @@
1
+ import ts from 'typescript';
2
+ declare const _default: (sourceFile: ts.SourceFile) => (node: ts.Node, options: import("../../../types/config.js").GetImportsAndExportsOptions) => import("../../../types/imports.js").ImportNode | import("../../../types/imports.js").ImportNode[] | undefined;
3
+ export default _default;
@@ -0,0 +1,24 @@
1
+ import ts from 'typescript';
2
+ import { IMPORT_MODIFIERS } from '../../../constants.js';
3
+ import { importVisitor as visit } from '../index.js';
4
+ export default visit(() => true, node => {
5
+ if (ts.isNewExpression(node) && ts.isIdentifier(node.expression) && node.expression.text === 'URL') {
6
+ if (node.arguments &&
7
+ node.arguments.length >= 2 &&
8
+ ts.isStringLiteralLike(node.arguments[0]) &&
9
+ ts.isPropertyAccessExpression(node.arguments[1]) &&
10
+ ts.isMetaProperty(node.arguments[1].expression) &&
11
+ node.arguments[1].expression.keywordToken === ts.SyntaxKind.ImportKeyword &&
12
+ node.arguments[1].expression.name.text === 'meta' &&
13
+ node.arguments[1].name.text === 'url') {
14
+ const specifier = node.arguments[0].text;
15
+ if (specifier)
16
+ return {
17
+ specifier,
18
+ identifier: undefined,
19
+ pos: node.arguments[0].pos,
20
+ modifiers: IMPORT_MODIFIERS.ENTRY | IMPORT_MODIFIERS.OPTIONAL,
21
+ };
22
+ }
23
+ }
24
+ });