knip 6.4.1 → 6.6.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 (336) hide show
  1. package/dist/CacheConsultant.js +3 -3
  2. package/dist/CatalogCounselor.js +5 -5
  3. package/dist/ConfigurationChief.d.ts +39 -16
  4. package/dist/ConfigurationChief.js +15 -15
  5. package/dist/DependencyDeputy.d.ts +1 -1
  6. package/dist/DependencyDeputy.js +5 -5
  7. package/dist/IssueCollector.js +3 -3
  8. package/dist/IssueFixer.js +5 -5
  9. package/dist/JsonCatalogPeeker.js +1 -1
  10. package/dist/ProjectPrincipal.js +13 -13
  11. package/dist/WorkspaceWorker.d.ts +3 -2
  12. package/dist/WorkspaceWorker.js +39 -26
  13. package/dist/YamlCatalogPeeker.js +1 -1
  14. package/dist/binaries/bash-parser.js +10 -10
  15. package/dist/binaries/fallback.js +3 -3
  16. package/dist/binaries/index.js +3 -3
  17. package/dist/binaries/plugins.js +6 -6
  18. package/dist/binaries/resolvers/bun.js +4 -4
  19. package/dist/binaries/resolvers/bunx.js +4 -4
  20. package/dist/binaries/resolvers/find.js +1 -1
  21. package/dist/binaries/resolvers/index.js +8 -8
  22. package/dist/binaries/resolvers/npx.js +4 -4
  23. package/dist/binaries/resolvers/pnpm.js +3 -3
  24. package/dist/binaries/resolvers/pnpx.js +2 -2
  25. package/dist/binaries/resolvers/yarn.js +4 -4
  26. package/dist/cli.js +10 -10
  27. package/dist/compilers/index.d.ts +62 -22
  28. package/dist/compilers/index.js +2 -2
  29. package/dist/compilers/mdx.js +1 -1
  30. package/dist/compilers/scss.js +1 -1
  31. package/dist/constants.d.ts +25 -25
  32. package/dist/constants.js +1 -1
  33. package/dist/graph/analyze.js +7 -7
  34. package/dist/graph/build.d.ts +2 -2
  35. package/dist/graph/build.js +34 -26
  36. package/dist/graph-explorer/constants.d.ts +5 -5
  37. package/dist/graph-explorer/explorer.js +9 -9
  38. package/dist/graph-explorer/operations/build-exports-tree.js +2 -2
  39. package/dist/graph-explorer/operations/get-contention.js +3 -3
  40. package/dist/graph-explorer/operations/get-dependency-usage.js +1 -1
  41. package/dist/graph-explorer/operations/get-usage.js +5 -5
  42. package/dist/graph-explorer/operations/has-strictly-ns-references.js +1 -1
  43. package/dist/graph-explorer/operations/is-referenced.js +2 -2
  44. package/dist/graph-explorer/operations/resolve-definition.js +3 -3
  45. package/dist/graph-explorer/utils.d.ts +1 -1
  46. package/dist/graph-explorer/utils.js +2 -2
  47. package/dist/graph-explorer/visitors.js +1 -1
  48. package/dist/graph-explorer/walk-down.js +2 -2
  49. package/dist/graph-explorer/walk-up.js +2 -2
  50. package/dist/index.js +2 -2
  51. package/dist/manifest/helpers.js +2 -2
  52. package/dist/manifest/index.js +3 -3
  53. package/dist/plugins/_template/index.js +2 -2
  54. package/dist/plugins/angular/index.js +4 -4
  55. package/dist/plugins/astro/compiler-mdx.js +1 -1
  56. package/dist/plugins/astro/compiler.js +1 -1
  57. package/dist/plugins/astro/index.js +8 -6
  58. package/dist/plugins/astro/resolveFromAST.d.ts +1 -0
  59. package/dist/plugins/astro/resolveFromAST.js +40 -1
  60. package/dist/plugins/astro-db/index.js +1 -1
  61. package/dist/plugins/astro-og-canvas/index.js +2 -2
  62. package/dist/plugins/ava/index.js +2 -2
  63. package/dist/plugins/babel/helpers.d.ts +44 -6
  64. package/dist/plugins/babel/helpers.js +1 -1
  65. package/dist/plugins/babel/index.js +4 -4
  66. package/dist/plugins/biome/index.js +4 -4
  67. package/dist/plugins/bumpp/index.js +2 -2
  68. package/dist/plugins/bun/index.js +1 -1
  69. package/dist/plugins/c8/index.js +1 -1
  70. package/dist/plugins/capacitor/index.js +3 -3
  71. package/dist/plugins/changelogen/index.js +2 -2
  72. package/dist/plugins/changelogithub/index.js +2 -2
  73. package/dist/plugins/changesets/index.js +3 -3
  74. package/dist/plugins/commitizen/index.js +2 -2
  75. package/dist/plugins/commitlint/index.js +3 -3
  76. package/dist/plugins/convex/index.js +1 -1
  77. package/dist/plugins/create-typescript-app/index.js +1 -1
  78. package/dist/plugins/cspell/index.js +2 -2
  79. package/dist/plugins/cucumber/index.js +2 -2
  80. package/dist/plugins/cypress/helpers.js +2 -2
  81. package/dist/plugins/cypress/index.js +3 -3
  82. package/dist/plugins/danger/index.js +1 -1
  83. package/dist/plugins/dependency-cruiser/index.js +1 -1
  84. package/dist/plugins/docusaurus/helpers.js +2 -2
  85. package/dist/plugins/docusaurus/index.js +4 -4
  86. package/dist/plugins/dotenv/index.js +1 -1
  87. package/dist/plugins/drizzle/index.js +2 -2
  88. package/dist/plugins/eleventy/index.js +6 -6
  89. package/dist/plugins/eslint/helpers.js +5 -5
  90. package/dist/plugins/eslint/index.js +4 -4
  91. package/dist/plugins/eslint/resolveFromAST.js +3 -3
  92. package/dist/plugins/execa/index.js +2 -2
  93. package/dist/plugins/execa/visitors/execa.js +1 -1
  94. package/dist/plugins/expo/helpers.d.ts +3 -3
  95. package/dist/plugins/expo/helpers.js +3 -3
  96. package/dist/plugins/expo/index.js +4 -4
  97. package/dist/plugins/expressive-code/index.js +1 -1
  98. package/dist/plugins/gatsby/index.js +2 -2
  99. package/dist/plugins/github-action/index.js +4 -4
  100. package/dist/plugins/github-actions/index.js +4 -4
  101. package/dist/plugins/graphql-codegen/index.js +5 -5
  102. package/dist/plugins/hardhat/index.js +2 -2
  103. package/dist/plugins/husky/index.js +3 -3
  104. package/dist/plugins/i18next-parser/index.js +1 -1
  105. package/dist/plugins/index.d.ts +4 -0
  106. package/dist/plugins/index.js +152 -144
  107. package/dist/plugins/jest/helpers.js +2 -2
  108. package/dist/plugins/jest/index.js +4 -4
  109. package/dist/plugins/karma/helpers.d.ts +1 -1
  110. package/dist/plugins/karma/helpers.js +2 -2
  111. package/dist/plugins/karma/index.js +4 -4
  112. package/dist/plugins/knex/index.js +3 -3
  113. package/dist/plugins/ladle/index.js +4 -4
  114. package/dist/plugins/lefthook/index.js +5 -5
  115. package/dist/plugins/lint-staged/index.js +2 -2
  116. package/dist/plugins/linthtml/index.js +3 -3
  117. package/dist/plugins/lockfile-lint/index.js +2 -2
  118. package/dist/plugins/lost-pixel/index.js +1 -1
  119. package/dist/plugins/markdownlint/index.js +3 -3
  120. package/dist/plugins/mdx/index.js +2 -2
  121. package/dist/plugins/mdxlint/index.js +3 -3
  122. package/dist/plugins/metro/index.js +4 -4
  123. package/dist/plugins/mocha/index.js +2 -2
  124. package/dist/plugins/moonrepo/index.js +1 -1
  125. package/dist/plugins/msw/index.js +3 -3
  126. package/dist/plugins/nano-staged/index.js +1 -1
  127. package/dist/plugins/nest/index.js +2 -2
  128. package/dist/plugins/netlify/index.js +4 -4
  129. package/dist/plugins/next/index.js +3 -3
  130. package/dist/plugins/next/resolveFromAST.js +1 -1
  131. package/dist/plugins/next-intl/index.js +1 -1
  132. package/dist/plugins/next-mdx/index.js +3 -3
  133. package/dist/plugins/next-mdx/resolveFromAST.js +1 -1
  134. package/dist/plugins/nitro/index.js +3 -3
  135. package/dist/plugins/node/index.js +1 -1
  136. package/dist/plugins/node-modules-inspector/index.js +2 -2
  137. package/dist/plugins/npm-package-json-lint/index.js +3 -3
  138. package/dist/plugins/nuxt/helpers.js +3 -3
  139. package/dist/plugins/nuxt/index.js +10 -11
  140. package/dist/plugins/nx/index.js +4 -4
  141. package/dist/plugins/nyc/index.js +2 -2
  142. package/dist/plugins/oclif/index.js +2 -2
  143. package/dist/plugins/openapi-ts/index.js +2 -2
  144. package/dist/plugins/oxfmt/index.js +1 -1
  145. package/dist/plugins/oxlint/index.js +3 -3
  146. package/dist/plugins/panda-css/index.js +2 -2
  147. package/dist/plugins/parcel/index.js +2 -2
  148. package/dist/plugins/payload/index.js +2 -2
  149. package/dist/plugins/pino/index.d.ts +3 -0
  150. package/dist/plugins/pino/index.js +15 -0
  151. package/dist/plugins/pino/visitors/transportCall.d.ts +2 -0
  152. package/dist/plugins/pino/visitors/transportCall.js +87 -0
  153. package/dist/plugins/playwright/index.js +4 -4
  154. package/dist/plugins/playwright-ct/index.js +3 -3
  155. package/dist/plugins/playwright-test/index.js +1 -1
  156. package/dist/plugins/plop/index.js +1 -1
  157. package/dist/plugins/pm2/index.js +3 -3
  158. package/dist/plugins/pnpm/index.js +1 -1
  159. package/dist/plugins/postcss/index.js +3 -3
  160. package/dist/plugins/preconstruct/index.js +3 -3
  161. package/dist/plugins/prettier/index.js +6 -2
  162. package/dist/plugins/prisma/index.js +5 -5
  163. package/dist/plugins/qwik/index.js +5 -5
  164. package/dist/plugins/qwik/resolveFromAST.js +1 -1
  165. package/dist/plugins/raycast/index.js +3 -3
  166. package/dist/plugins/react-cosmos/index.js +3 -3
  167. package/dist/plugins/react-email/index.d.ts +3 -0
  168. package/dist/plugins/react-email/index.js +26 -0
  169. package/dist/plugins/react-native/index.js +2 -2
  170. package/dist/plugins/react-router/index.js +6 -10
  171. package/dist/plugins/relay/index.js +3 -3
  172. package/dist/plugins/release-it/index.js +2 -2
  173. package/dist/plugins/remark/index.js +3 -3
  174. package/dist/plugins/remix/index.js +1 -1
  175. package/dist/plugins/rolldown/index.js +3 -3
  176. package/dist/plugins/rolldown/resolveFromAST.js +1 -1
  177. package/dist/plugins/rollup/index.js +3 -3
  178. package/dist/plugins/rollup/resolveFromAST.js +1 -1
  179. package/dist/plugins/rsbuild/index.js +2 -2
  180. package/dist/plugins/rslib/index.js +1 -1
  181. package/dist/plugins/rspack/index.js +2 -2
  182. package/dist/plugins/rstest/index.js +2 -2
  183. package/dist/plugins/sanity/index.js +1 -1
  184. package/dist/plugins/semantic-release/index.js +3 -3
  185. package/dist/plugins/sentry/index.js +1 -1
  186. package/dist/plugins/serverless-framework/index.d.ts +3 -0
  187. package/dist/plugins/serverless-framework/index.js +23 -0
  188. package/dist/plugins/serverless-framework/types.d.ts +7 -0
  189. package/dist/plugins/serverless-framework/types.js +1 -0
  190. package/dist/plugins/simple-git-hooks/index.js +2 -2
  191. package/dist/plugins/size-limit/index.js +3 -3
  192. package/dist/plugins/sst/index.js +2 -2
  193. package/dist/plugins/sst/resolveFromAST.js +5 -5
  194. package/dist/plugins/starlight/index.js +4 -4
  195. package/dist/plugins/starlight/resolveFromAST.js +1 -1
  196. package/dist/plugins/stencil/index.js +3 -3
  197. package/dist/plugins/storybook/index.js +3 -3
  198. package/dist/plugins/stryker/index.js +2 -2
  199. package/dist/plugins/stylelint/index.js +3 -3
  200. package/dist/plugins/svelte/compiler.js +1 -1
  201. package/dist/plugins/svelte/index.js +3 -3
  202. package/dist/plugins/sveltejs-package/helpers.d.ts +8 -0
  203. package/dist/plugins/sveltejs-package/helpers.js +65 -0
  204. package/dist/plugins/sveltejs-package/index.d.ts +3 -0
  205. package/dist/plugins/sveltejs-package/index.js +27 -0
  206. package/dist/plugins/sveltekit/index.js +3 -3
  207. package/dist/plugins/svgo/index.js +1 -1
  208. package/dist/plugins/svgr/index.js +2 -2
  209. package/dist/plugins/swc/index.js +3 -3
  210. package/dist/plugins/syncpack/index.js +2 -2
  211. package/dist/plugins/tailwind/index.js +2 -2
  212. package/dist/plugins/tanstack-router/index.js +3 -3
  213. package/dist/plugins/taskfile/index.js +3 -3
  214. package/dist/plugins/travis/index.js +1 -1
  215. package/dist/plugins/tsdown/index.js +3 -3
  216. package/dist/plugins/tsdown/resolveFromAST.js +1 -1
  217. package/dist/plugins/tsup/index.js +3 -3
  218. package/dist/plugins/tsup/resolveFromAST.js +1 -1
  219. package/dist/plugins/tsx/index.js +2 -2
  220. package/dist/plugins/typedoc/index.js +2 -2
  221. package/dist/plugins/typescript/index.js +4 -4
  222. package/dist/plugins/unbuild/index.js +2 -2
  223. package/dist/plugins/unocss/index.js +2 -2
  224. package/dist/plugins/vercel-og/index.js +1 -1
  225. package/dist/plugins/vike/index.js +1 -1
  226. package/dist/plugins/vite/helpers.js +4 -4
  227. package/dist/plugins/vite/index.js +5 -5
  228. package/dist/plugins/vite/visitors/importMetaGlob.js +4 -4
  229. package/dist/plugins/vitepress/index.js +1 -1
  230. package/dist/plugins/vitest/helpers.d.ts +4 -2
  231. package/dist/plugins/vitest/helpers.js +18 -0
  232. package/dist/plugins/vitest/index.js +9 -23
  233. package/dist/plugins/vue/compiler.js +1 -1
  234. package/dist/plugins/vue/index.js +4 -4
  235. package/dist/plugins/webdriver-io/index.js +2 -2
  236. package/dist/plugins/webpack/index.js +5 -5
  237. package/dist/plugins/webpack/visitors/requireContext.js +6 -7
  238. package/dist/plugins/wireit/index.js +1 -1
  239. package/dist/plugins/wrangler/index.js +2 -2
  240. package/dist/plugins/xo/index.js +2 -2
  241. package/dist/plugins/yarn/index.js +2 -2
  242. package/dist/plugins/yorkie/index.js +2 -2
  243. package/dist/plugins/zx/index.js +2 -2
  244. package/dist/plugins.js +2 -2
  245. package/dist/reporters/codeclimate.js +2 -2
  246. package/dist/reporters/codeowners.js +3 -3
  247. package/dist/reporters/compact.js +1 -1
  248. package/dist/reporters/disclosure.js +1 -1
  249. package/dist/reporters/github-actions.js +4 -4
  250. package/dist/reporters/index.js +8 -8
  251. package/dist/reporters/json.js +4 -4
  252. package/dist/reporters/markdown.js +2 -2
  253. package/dist/reporters/symbols.js +2 -2
  254. package/dist/reporters/trace.js +7 -7
  255. package/dist/reporters/util/configuration-hints.d.ts +2 -2
  256. package/dist/reporters/util/configuration-hints.js +7 -10
  257. package/dist/reporters/util/util.d.ts +3 -3
  258. package/dist/reporters/util/util.js +16 -15
  259. package/dist/reporters/watch.js +7 -7
  260. package/dist/run.js +14 -14
  261. package/dist/schema/configuration.d.ts +89 -31
  262. package/dist/schema/configuration.js +2 -2
  263. package/dist/schema/plugins.d.ts +20 -0
  264. package/dist/schema/plugins.js +4 -0
  265. package/dist/session/build-maps.js +3 -3
  266. package/dist/session/file-descriptor.js +3 -3
  267. package/dist/session/index.js +7 -7
  268. package/dist/session/package-json-descriptor.js +1 -1
  269. package/dist/session/session.js +3 -3
  270. package/dist/types/PluginNames.d.ts +2 -2
  271. package/dist/types/PluginNames.js +4 -0
  272. package/dist/types/config.d.ts +13 -0
  273. package/dist/types/issues.d.ts +1 -1
  274. package/dist/typescript/SourceFileManager.js +3 -3
  275. package/dist/typescript/ast-helpers.d.ts +2 -0
  276. package/dist/typescript/ast-helpers.js +5 -5
  277. package/dist/typescript/comments.js +1 -1
  278. package/dist/typescript/follow-imports.js +2 -2
  279. package/dist/typescript/get-imports-and-exports.js +10 -10
  280. package/dist/typescript/resolve-module-names.js +5 -5
  281. package/dist/typescript/visitors/calls.js +3 -3
  282. package/dist/typescript/visitors/exports.js +4 -4
  283. package/dist/typescript/visitors/helpers.js +3 -3
  284. package/dist/typescript/visitors/imports.js +4 -4
  285. package/dist/typescript/visitors/members.js +4 -4
  286. package/dist/typescript/visitors/walk.js +9 -9
  287. package/dist/util/Performance.d.ts +1 -1
  288. package/dist/util/Performance.js +2 -2
  289. package/dist/util/catalog.js +3 -3
  290. package/dist/util/codeowners.js +4 -4
  291. package/dist/util/colors.d.ts +18 -0
  292. package/dist/util/colors.js +24 -0
  293. package/dist/util/create-input-handler.js +6 -6
  294. package/dist/util/create-options.d.ts +72 -33
  295. package/dist/util/create-options.js +14 -15
  296. package/dist/util/create-workspace-graph.js +1 -1
  297. package/dist/util/debug.js +2 -4
  298. package/dist/util/file-entry-cache.js +4 -4
  299. package/dist/util/fs.js +2 -2
  300. package/dist/util/get-included-issue-types.js +2 -2
  301. package/dist/util/git.js +1 -1
  302. package/dist/util/glob-cache.js +4 -4
  303. package/dist/util/glob-core.d.ts +3 -3
  304. package/dist/util/glob-core.js +80 -64
  305. package/dist/util/glob.d.ts +1 -1
  306. package/dist/util/glob.js +14 -7
  307. package/dist/util/input.js +1 -1
  308. package/dist/util/issue-initializers.js +1 -1
  309. package/dist/util/jiti.js +1 -1
  310. package/dist/util/load-config.js +3 -3
  311. package/dist/util/load-tsconfig.js +62 -50
  312. package/dist/util/loader.js +5 -5
  313. package/dist/util/log.js +3 -3
  314. package/dist/util/map-workspaces.js +6 -6
  315. package/dist/util/modules.js +2 -2
  316. package/dist/util/package-name.js +1 -1
  317. package/dist/util/parse-and-convert-gitignores.d.ts +4 -2
  318. package/dist/util/parse-and-convert-gitignores.js +19 -7
  319. package/dist/util/plugin.js +5 -5
  320. package/dist/util/remove-export.js +1 -1
  321. package/dist/util/reporter.js +3 -3
  322. package/dist/util/require.js +1 -1
  323. package/dist/util/resolve.js +3 -3
  324. package/dist/util/string.d.ts +1 -1
  325. package/dist/util/table.js +1 -1
  326. package/dist/util/tag.js +1 -1
  327. package/dist/util/to-source-path.d.ts +4 -2
  328. package/dist/util/to-source-path.js +46 -22
  329. package/dist/util/trace.js +8 -8
  330. package/dist/util/watch.js +8 -8
  331. package/dist/util/workspace-file-filter.js +2 -2
  332. package/dist/util/workspace-selectors.js +4 -4
  333. package/dist/version.d.ts +1 -1
  334. package/dist/version.js +1 -1
  335. package/package.json +12 -19
  336. package/schema.json +13 -1
@@ -1,7 +1,7 @@
1
- import { compact } from "../../util/array.js";
2
- import { toAlias, toConfig, toDeferResolve, toProductionDependency } from "../../util/input.js";
3
- import { dirname, join } from "../../util/path.js";
4
- import { hasDependency } from "../../util/plugin.js";
1
+ import { compact } from '../../util/array.js';
2
+ import { toAlias, toConfig, toDeferResolve, toProductionDependency } from '../../util/input.js';
3
+ import { dirname, join } from '../../util/path.js';
4
+ import { hasDependency } from '../../util/plugin.js';
5
5
  const title = 'TypeScript';
6
6
  const enablers = ['typescript', '@typescript/native-preview'];
7
7
  const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
@@ -1,5 +1,5 @@
1
- import { toEntry } from "../../util/input.js";
2
- import { hasDependency } from "../../util/plugin.js";
1
+ import { toEntry } from '../../util/input.js';
2
+ import { hasDependency } from '../../util/plugin.js';
3
3
  const title = 'unbuild';
4
4
  const enablers = ['unbuild'];
5
5
  const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
@@ -1,5 +1,5 @@
1
- import { hasDependency } from "../../util/plugin.js";
2
- import { toUnconfig } from "../../util/plugin-config.js";
1
+ import { hasDependency } from '../../util/plugin.js';
2
+ import { toUnconfig } from '../../util/plugin-config.js';
3
3
  const title = 'UnoCSS';
4
4
  const enablers = ['unocss'];
5
5
  const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
@@ -1,4 +1,4 @@
1
- import { hasDependency } from "../../util/plugin.js";
1
+ import { hasDependency } from '../../util/plugin.js';
2
2
  const title = 'Vercel OG';
3
3
  const enablers = ['next', '@vercel/og'];
4
4
  const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
@@ -1,4 +1,4 @@
1
- import { hasDependency } from "../../util/plugin.js";
1
+ import { hasDependency } from '../../util/plugin.js';
2
2
  const title = 'Vike';
3
3
  const enablers = ['vike'];
4
4
  const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
@@ -1,8 +1,8 @@
1
1
  import { Visitor } from 'oxc-parser';
2
- import { findProperty, getDefaultImportName, getImportMap, getStringValues } from "../../typescript/ast-helpers.js";
3
- import { isFile, loadFile } from "../../util/fs.js";
4
- import { toProductionEntry } from "../../util/input.js";
5
- import { join } from "../../util/path.js";
2
+ import { findProperty, getDefaultImportName, getImportMap, getStringValues } from '../../typescript/ast-helpers.js';
3
+ import { isFile, loadFile } from '../../util/fs.js';
4
+ import { toProductionEntry } from '../../util/input.js';
5
+ import { join } from '../../util/path.js';
6
6
  export const getReactBabelPlugins = (program) => {
7
7
  const babelPlugins = [];
8
8
  const importMap = getImportMap(program);
@@ -1,8 +1,8 @@
1
- import { toDependency } from "../../util/input.js";
2
- import { hasDependency } from "../../util/plugin.js";
3
- import { resolveConfig } from "../vitest/index.js";
4
- import { getIndexHtmlEntries, getReactBabelPlugins } from "./helpers.js";
5
- import { createImportMetaGlobVisitor } from "./visitors/importMetaGlob.js";
1
+ import { toDependency } from '../../util/input.js';
2
+ import { hasDependency } from '../../util/plugin.js';
3
+ import { resolveConfig } from '../vitest/index.js';
4
+ import { getIndexHtmlEntries, getReactBabelPlugins } from './helpers.js';
5
+ import { createImportMetaGlobVisitor } from './visitors/importMetaGlob.js';
6
6
  const title = 'Vite';
7
7
  const enablers = ['vite', 'vitest'];
8
8
  const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
@@ -1,7 +1,7 @@
1
- import { IMPORT_FLAGS } from "../../../constants.js";
2
- import { _syncGlob } from "../../../util/glob.js";
3
- import { dirname, isAbsolute, join } from "../../../util/path.js";
4
- import { getStringValue, isStringLiteral } from "../../../typescript/visitors/helpers.js";
1
+ import { IMPORT_FLAGS } from '../../../constants.js';
2
+ import { _syncGlob } from '../../../util/glob.js';
3
+ import { dirname, isAbsolute, join } from '../../../util/path.js';
4
+ import { getStringValue, isStringLiteral } from '../../../typescript/visitors/helpers.js';
5
5
  export function createImportMetaGlobVisitor(ctx) {
6
6
  return {
7
7
  CallExpression(node) {
@@ -1,4 +1,4 @@
1
- import { hasDependency } from "../../util/plugin.js";
1
+ import { hasDependency } from '../../util/plugin.js';
2
2
  const title = 'VitePress';
3
3
  const enablers = ['vitepress'];
4
4
  const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
@@ -1,3 +1,5 @@
1
- import type { ViteConfig } from './types.ts';
1
+ import { type Input } from '../../util/input.ts';
2
+ import type { AliasOptions, ViteConfig } from './types.ts';
2
3
  export declare const getEnvSpecifier: (env: string) => string;
3
- export declare const getExternalReporters: (reporters?: ViteConfig["test"]["reporters"]) => string[];
4
+ export declare const getAliasInputs: (aliasOptions: AliasOptions, cwd: string) => Input[];
5
+ export declare const getExternalReporters: (reporters?: ViteConfig['test']['reporters']) => string[];
@@ -1,3 +1,5 @@
1
+ import { toAlias } from '../../util/input.js';
2
+ import { join, toPosix } from '../../util/path.js';
1
3
  const environments = {
2
4
  node: null,
3
5
  jsdom: null,
@@ -29,6 +31,22 @@ const builtInReporters = [
29
31
  'tree',
30
32
  'verbose',
31
33
  ];
34
+ const addStar = (value) => (value.endsWith('*') ? value : join(value, '*').replace(/\/\*\*$/, '/*'));
35
+ export const getAliasInputs = (aliasOptions, cwd) => {
36
+ const inputs = [];
37
+ for (const [alias, value] of Object.entries(aliasOptions)) {
38
+ if (!value)
39
+ continue;
40
+ const prefixes = [value]
41
+ .flat()
42
+ .filter((value) => typeof value === 'string')
43
+ .map(prefix => (toPosix(prefix).startsWith(cwd) ? prefix : join(cwd, prefix)));
44
+ if (alias.length > 1)
45
+ inputs.push(toAlias(alias, prefixes));
46
+ inputs.push(toAlias(addStar(alias), prefixes.map(addStar)));
47
+ }
48
+ return inputs;
49
+ };
32
50
  export const getExternalReporters = (reporters) => reporters
33
51
  ? [reporters]
34
52
  .flat()
@@ -1,10 +1,10 @@
1
- import { DEFAULT_EXTENSIONS } from "../../constants.js";
2
- import { _glob } from "../../util/glob.js";
3
- import { toAlias, toConfig, toDeferResolve, toDependency, toEntry } from "../../util/input.js";
4
- import { isAbsolute, isInternal, join, toAbsolute, toPosix } from "../../util/path.js";
5
- import { hasDependency } from "../../util/plugin.js";
6
- import { getIndexHtmlEntries } from "../vite/helpers.js";
7
- import { getEnvSpecifier, getExternalReporters } from "./helpers.js";
1
+ import { DEFAULT_EXTENSIONS } from '../../constants.js';
2
+ import { _glob } from '../../util/glob.js';
3
+ import { toConfig, toDeferResolve, toDependency, toEntry } from '../../util/input.js';
4
+ import { isAbsolute, isInternal, join, toAbsolute } from '../../util/path.js';
5
+ import { hasDependency } from '../../util/plugin.js';
6
+ import { getIndexHtmlEntries } from '../vite/helpers.js';
7
+ import { getAliasInputs, getEnvSpecifier, getExternalReporters } from './helpers.js';
8
8
  const title = 'Vitest';
9
9
  const enablers = ['vitest'];
10
10
  const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
@@ -106,23 +106,9 @@ export const resolveConfig = async (localConfig, options) => {
106
106
  }
107
107
  }
108
108
  }
109
- const addStar = (value) => (value.endsWith('*') ? value : join(value, '*').replace(/\/\*\*$/, '/*'));
110
109
  const addAliases = (aliasOptions) => {
111
- for (const [alias, value] of Object.entries(aliasOptions)) {
112
- if (!value)
113
- continue;
114
- const prefixes = [value]
115
- .flat()
116
- .filter(value => typeof value === 'string')
117
- .map(prefix => {
118
- if (toPosix(prefix).startsWith(options.cwd))
119
- return prefix;
120
- return join(options.cwd, prefix);
121
- });
122
- if (alias.length > 1)
123
- inputs.add(toAlias(alias, prefixes));
124
- inputs.add(toAlias(addStar(alias), prefixes.map(addStar)));
125
- }
110
+ for (const input of getAliasInputs(aliasOptions, options.cwd))
111
+ inputs.add(input);
126
112
  };
127
113
  const seenRoots = new Set();
128
114
  for (const cfg of configs) {
@@ -1,3 +1,3 @@
1
- import { scriptBodies } from "../../compilers/compilers.js";
1
+ import { scriptBodies } from '../../compilers/compilers.js';
2
2
  const compiler = scriptBodies;
3
3
  export default compiler;
@@ -1,7 +1,7 @@
1
- import { toDependency } from "../../util/input.js";
2
- import { hasDependency } from "../../util/plugin.js";
3
- import { findWebpackDependenciesFromConfig } from "../webpack/index.js";
4
- import compiler from "./compiler.js";
1
+ import { toDependency } from '../../util/input.js';
2
+ import { hasDependency } from '../../util/plugin.js';
3
+ import { findWebpackDependenciesFromConfig } from '../webpack/index.js';
4
+ import compiler from './compiler.js';
5
5
  const title = 'Vue';
6
6
  const enablers = ['vue'];
7
7
  const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
@@ -1,5 +1,5 @@
1
- import { toDependency } from "../../util/input.js";
2
- import { hasDependency } from "../../util/plugin.js";
1
+ import { toDependency } from '../../util/input.js';
2
+ import { hasDependency } from '../../util/plugin.js';
3
3
  const title = 'WebdriverIO';
4
4
  const enablers = ['@wdio/cli'];
5
5
  const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
@@ -1,8 +1,8 @@
1
- import { toAlias, toDeferResolve, toDeferResolveEntry, toDeferResolveProductionEntry, toDependency, } from "../../util/input.js";
2
- import { isInternal, join, toAbsolute } from "../../util/path.js";
3
- import { hasDependency } from "../../util/plugin.js";
4
- import { getDependenciesFromConfig } from "../babel/index.js";
5
- import { createRequireContextVisitor } from "./visitors/requireContext.js";
1
+ import { toAlias, toDeferResolve, toDeferResolveEntry, toDeferResolveProductionEntry, toDependency, } from '../../util/input.js';
2
+ import { isInternal, join, toAbsolute } from '../../util/path.js';
3
+ import { hasDependency } from '../../util/plugin.js';
4
+ import { getDependenciesFromConfig } from '../babel/index.js';
5
+ import { createRequireContextVisitor } from './visitors/requireContext.js';
6
6
  const title = 'webpack';
7
7
  const enablers = ['webpack', 'webpack-cli'];
8
8
  const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
@@ -1,7 +1,7 @@
1
- import { IMPORT_FLAGS } from "../../../constants.js";
2
- import { _syncGlob } from "../../../util/glob.js";
3
- import { dirname, isAbsolute, join } from "../../../util/path.js";
4
- import { getStringValue, isStringLiteral } from "../../../typescript/visitors/helpers.js";
1
+ import { IMPORT_FLAGS } from '../../../constants.js';
2
+ import { _syncGlob } from '../../../util/glob.js';
3
+ import { dirname, join, toRelative } from '../../../util/path.js';
4
+ import { getStringValue, isStringLiteral } from '../../../typescript/visitors/helpers.js';
5
5
  export function createRequireContextVisitor(ctx) {
6
6
  return {
7
7
  CallExpression(node) {
@@ -23,9 +23,8 @@ export function createRequireContextVisitor(ctx) {
23
23
  const files = _syncGlob({ patterns: [pattern], cwd: baseDir });
24
24
  const regex = regexArg && 'regex' in regexArg ? new RegExp(regexArg.regex.pattern, regexArg.regex.flags) : undefined;
25
25
  for (const f of files) {
26
- const relPath = `./${f}`;
27
- if (!regex || regex.test(relPath)) {
28
- ctx.addImport(isAbsolute(f) ? f : join(baseDir, f), node.arguments[0].start, IMPORT_FLAGS.ENTRY);
26
+ if (!regex || regex.test(`./${toRelative(f, baseDir)}`)) {
27
+ ctx.addImport(f, node.arguments[0].start, IMPORT_FLAGS.ENTRY);
29
28
  }
30
29
  }
31
30
  },
@@ -1,4 +1,4 @@
1
- import { hasDependency } from "../../util/plugin.js";
1
+ import { hasDependency } from '../../util/plugin.js';
2
2
  const title = 'Wireit';
3
3
  const enablers = ['wireit'];
4
4
  const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
@@ -1,5 +1,5 @@
1
- import { toProductionEntry } from "../../util/input.js";
2
- import { hasDependency } from "../../util/plugin.js";
1
+ import { toProductionEntry } from '../../util/input.js';
2
+ import { hasDependency } from '../../util/plugin.js';
3
3
  const title = 'Wrangler';
4
4
  const enablers = ['wrangler'];
5
5
  const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
@@ -1,5 +1,5 @@
1
- import { hasDependency } from "../../util/plugin.js";
2
- import { getInputs } from "../eslint/helpers.js";
1
+ import { hasDependency } from '../../util/plugin.js';
2
+ import { getInputs } from '../eslint/helpers.js';
3
3
  const title = 'xo';
4
4
  const enablers = ['xo'];
5
5
  const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
@@ -1,5 +1,5 @@
1
- import { isFile } from "../../util/fs.js";
2
- import { toEntry } from "../../util/input.js";
1
+ import { isFile } from '../../util/fs.js';
2
+ import { toEntry } from '../../util/input.js';
3
3
  const title = 'Yarn';
4
4
  const enablers = 'This plugin is enabled when a `yarn.lock` file is found in the root folder.';
5
5
  const isEnabled = async ({ cwd }) => isFile(cwd, 'yarn.lock');
@@ -1,5 +1,5 @@
1
- import { toDependency } from "../../util/input.js";
2
- import { hasDependency } from "../../util/plugin.js";
1
+ import { toDependency } from '../../util/input.js';
2
+ import { hasDependency } from '../../util/plugin.js';
3
3
  const title = 'yorkie';
4
4
  const enablers = ['yorkie'];
5
5
  const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
@@ -1,5 +1,5 @@
1
- import { hasDependency } from "../../util/plugin.js";
2
- import { createZxVisitor } from "./visitors/zx.js";
1
+ import { hasDependency } from '../../util/plugin.js';
2
+ import { createZxVisitor } from './visitors/zx.js';
3
3
  const title = 'zx';
4
4
  const enablers = ['zx'];
5
5
  const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
package/dist/plugins.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { parseArgs } from 'node:util';
2
- import { Plugins } from "./plugins/index.js";
3
- import { timerify } from "./util/Performance.js";
2
+ import { Plugins } from './plugins/index.js';
3
+ import { timerify } from './util/Performance.js';
4
4
  const PMap = Plugins;
5
5
  const { values } = parseArgs({ strict: false, options: { performance: { type: 'boolean' } } });
6
6
  const isEnabled = !!values.performance;
@@ -1,6 +1,6 @@
1
1
  import { createHash } from 'node:crypto';
2
- import { toRelative } from "../util/path.js";
3
- import { flattenIssues, getIssuePrefix, getIssueTypeTitle } from "./util/util.js";
2
+ import { toRelative } from '../util/path.js';
3
+ import { flattenIssues, getIssuePrefix, getIssueTypeTitle } from './util/util.js';
4
4
  export default async ({ report, issues, cwd }) => {
5
5
  const entries = [];
6
6
  for (const [type, isReportType] of Object.entries(report)) {
@@ -1,6 +1,6 @@
1
- import { createOwnershipEngine } from "../util/codeowners.js";
2
- import { relative, resolve } from "../util/path.js";
3
- import { getColoredTitle, getIssueLine, getIssueTypeTitle } from "./util/util.js";
1
+ import { createOwnershipEngine } from '../util/codeowners.js';
2
+ import { relative, resolve } from '../util/path.js';
3
+ import { getColoredTitle, getIssueLine, getIssueTypeTitle } from './util/util.js';
4
4
  const logIssueRecord = (issues, cwd) => {
5
5
  const sortedByFilePath = issues.sort((a, b) => (a.owner < b.owner ? -1 : 1));
6
6
  for (const { filePath, symbols, owner, parentSymbol } of sortedByFilePath) {
@@ -1,4 +1,4 @@
1
- import { flattenIssues, getColoredTitle, getIssueLine, getIssueTypeTitle } from "./util/util.js";
1
+ import { flattenIssues, getColoredTitle, getIssueLine, getIssueTypeTitle } from './util/util.js';
2
2
  const logIssueRecord = (issues, cwd) => {
3
3
  const sortedByFilePath = issues.sort((a, b) => (a.filePath > b.filePath ? 1 : -1));
4
4
  for (const issue of sortedByFilePath)
@@ -1,4 +1,4 @@
1
- import { flattenIssues, getIssueTypeTitle, getTableForType } from "./util/util.js";
1
+ import { flattenIssues, getIssueTypeTitle, getTableForType } from './util/util.js';
2
2
  export default ({ report, issues, cwd }) => {
3
3
  const reportMultipleGroups = Object.values(report).filter(Boolean).length > 1;
4
4
  for (const [reportType, isReportType] of Object.entries(report)) {
@@ -1,7 +1,7 @@
1
- import { ISSUE_TYPE_TITLE } from "../constants.js";
2
- import { relative } from "../util/path.js";
3
- import { hintPrinters } from "./util/configuration-hints.js";
4
- import { flattenIssues, getIssueTypeTitle } from "./util/util.js";
1
+ import { ISSUE_TYPE_TITLE } from '../constants.js';
2
+ import { relative } from '../util/path.js';
3
+ import { hintPrinters } from './util/configuration-hints.js';
4
+ import { flattenIssues, getIssueTypeTitle } from './util/util.js';
5
5
  const createGitHubActionsLogger = () => {
6
6
  const formatAnnotation = (level, message, options) => {
7
7
  const params = [`file=${options.file}`];
@@ -1,11 +1,11 @@
1
- import codeclimate from "./codeclimate.js";
2
- import codeowners from "./codeowners.js";
3
- import compact from "./compact.js";
4
- import disclosure from "./disclosure.js";
5
- import githubActions from "./github-actions.js";
6
- import json from "./json.js";
7
- import markdown from "./markdown.js";
8
- import symbols from "./symbols.js";
1
+ import codeclimate from './codeclimate.js';
2
+ import codeowners from './codeowners.js';
3
+ import compact from './compact.js';
4
+ import disclosure from './disclosure.js';
5
+ import githubActions from './github-actions.js';
6
+ import json from './json.js';
7
+ import markdown from './markdown.js';
8
+ import symbols from './symbols.js';
9
9
  export default {
10
10
  symbols,
11
11
  compact,
@@ -1,7 +1,7 @@
1
- import { createOwnershipEngine } from "../util/codeowners.js";
2
- import { isFile } from "../util/fs.js";
3
- import { relative, resolve } from "../util/path.js";
4
- import { convert, flattenIssues } from "./util/util.js";
1
+ import { createOwnershipEngine } from '../util/codeowners.js';
2
+ import { isFile } from '../util/fs.js';
3
+ import { relative, resolve } from '../util/path.js';
4
+ import { convert, flattenIssues } from './util/util.js';
5
5
  export default async ({ report, issues, options, cwd }) => {
6
6
  let opts = {};
7
7
  try {
@@ -1,5 +1,5 @@
1
- import { relative } from "../util/path.js";
2
- import { flattenIssues, getIssueTypeTitle } from "./util/util.js";
1
+ import { relative } from '../util/path.js';
2
+ import { flattenIssues, getIssueTypeTitle } from './util/util.js';
3
3
  export default ({ report, issues, cwd }) => {
4
4
  console.log('# Knip report\n');
5
5
  const getFilePath = (issue) => {
@@ -1,5 +1,5 @@
1
- import { printConfigurationHints } from "./util/configuration-hints.js";
2
- import { dim, flattenIssues, getColoredTitle, getIssueTypeTitle, getTableForType } from "./util/util.js";
1
+ import { printConfigurationHints } from './util/configuration-hints.js';
2
+ import { dim, flattenIssues, getColoredTitle, getIssueTypeTitle, getTableForType } from './util/util.js';
3
3
  export default (options) => {
4
4
  const { report, issues, isDisableConfigHints, isShowProgress } = options;
5
5
  const reportMultipleGroups = Object.values(report).filter(Boolean).length > 1;
@@ -1,8 +1,8 @@
1
- import pc from 'picocolors';
2
- import { toRelative } from "../util/path.js";
3
- import { toRegexOrString } from "../util/regex.js";
4
- import { Table } from "../util/table.js";
5
- import { formatTrace } from "../util/trace.js";
1
+ import st from '../util/colors.js';
2
+ import { toRelative } from '../util/path.js';
3
+ import { toRegexOrString } from '../util/regex.js';
4
+ import { Table } from '../util/table.js';
5
+ import { formatTrace } from '../util/trace.js';
6
6
  export default ({ graph, explorer, options, workspaceFilePathFilter }) => {
7
7
  if (options.traceDependency) {
8
8
  const pattern = toRegexOrString(options.traceDependency);
@@ -19,8 +19,8 @@ export default ({ graph, explorer, options, workspaceFilePathFilter }) => {
19
19
  continue;
20
20
  seen.add(key);
21
21
  table.row();
22
- table.cell('filePath', pc.whiteBright(`${toRel(_import.filePath)}${pos}`));
23
- table.cell('package', pc.cyanBright(packageName));
22
+ table.cell('filePath', st.whiteBright(`${toRel(_import.filePath)}${pos}`));
23
+ table.cell('package', st.cyanBright(packageName));
24
24
  }
25
25
  }
26
26
  for (const line of table.toRows())
@@ -8,10 +8,9 @@ interface PrintHintOptions {
8
8
  workspaceName?: string;
9
9
  size?: number;
10
10
  }
11
- declare const hintPrinters: Map<ConfigurationHintType, {
11
+ export declare const hintPrinters: Map<ConfigurationHintType, {
12
12
  print: (options: PrintHintOptions) => string;
13
13
  }>;
14
- export { hintPrinters };
15
14
  interface ProcessedHint extends ConfigurationHint {
16
15
  message: string;
17
16
  }
@@ -20,3 +19,4 @@ export declare const finalizeConfigurationHints: (results: Results, options: {
20
19
  configFilePath?: string;
21
20
  }) => ProcessedHint[];
22
21
  export declare const printConfigurationHints: ({ cwd, counters, issues, tagHints, configurationHints, enabledPlugins, isTreatConfigHintsAsErrors, includedWorkspaceDirs, selectedWorkspaces, configFilePath, }: ReporterOptions) => void;
22
+ export {};
@@ -1,7 +1,7 @@
1
- import { relative, toRelative } from "../../util/path.js";
2
- import { Table } from "../../util/table.js";
3
- import { byPathDepth } from "../../util/workspace.js";
4
- import { bright, dim, getColoredTitle, getDimmedTitle } from "./util.js";
1
+ import { relative, toRelative } from '../../util/path.js';
2
+ import { Table } from '../../util/table.js';
3
+ import { byPathDepth } from '../../util/workspace.js';
4
+ import { bright, dim, getColoredTitle, getDimmedTitle } from './util.js';
5
5
  const getWorkspaceName = (hint) => hint.workspaceName &&
6
6
  hint.workspaceName !== '.' &&
7
7
  hint.type !== 'top-level-unconfigured' &&
@@ -39,9 +39,8 @@ const addWorkspace = (options) => options.configFilePath
39
39
  ? `Add ${bright('entry')} and/or refine ${bright('project')} files in ${bright(`workspaces["${options.workspaceName}"]`)} (${options.size} unused files)`
40
40
  : `Create ${bright('knip.json')} configuration file with ${bright(`workspaces["${options.workspaceName}"]`)} object (${options.size} unused files)`;
41
41
  const packageEntry = () => 'Package entry file not found';
42
- const extensionUnregistered = () => `Extension in ${bright('project')} not registered as a compiler — see https://knip.dev/features/compilers#tracking-non-source-files`;
43
- const extensionRedundant = () => `Extension already registered as a compiler — remove from ${bright('project')} pattern`;
44
- const hintPrinters = new Map([
42
+ const extensionUnregistered = () => `Extension in ${bright('project')} not registered as a compiler`;
43
+ export const hintPrinters = new Map([
45
44
  ['ignore', { print: unused }],
46
45
  ['ignoreFiles', { print: unused }],
47
46
  ['ignoreBinaries', { print: unused }],
@@ -51,7 +50,6 @@ const hintPrinters = new Map([
51
50
  ['entry-empty', { print: empty }],
52
51
  ['project-empty', { print: empty }],
53
52
  ['project-extension-unregistered', { print: extensionUnregistered }],
54
- ['project-extension-redundant', { print: extensionRedundant }],
55
53
  ['entry-redundant', { print: remove }],
56
54
  ['project-redundant', { print: remove }],
57
55
  ['top-level-unconfigured', { print: add }],
@@ -60,7 +58,6 @@ const hintPrinters = new Map([
60
58
  ['project-top-level', { print: topLevel }],
61
59
  ['package-entry', { print: packageEntry }],
62
60
  ]);
63
- export { hintPrinters };
64
61
  const hintTypesOrder = [
65
62
  ['top-level-unconfigured', 'workspace-unconfigured'],
66
63
  ['entry-top-level', 'project-top-level'],
@@ -70,7 +67,7 @@ const hintTypesOrder = [
70
67
  ['ignoreBinaries'],
71
68
  ['ignoreUnresolved'],
72
69
  ['entry-empty', 'project-empty', 'entry-redundant', 'project-redundant'],
73
- ['project-extension-unregistered', 'project-extension-redundant'],
70
+ ['project-extension-unregistered'],
74
71
  ['package-entry'],
75
72
  ];
76
73
  export const finalizeConfigurationHints = (results, options) => {
@@ -1,9 +1,9 @@
1
1
  import { ISSUE_TYPE_TITLE } from '../../constants.ts';
2
2
  import type { Issue, IssueRecords, IssueSeverity, IssueSymbol, IssueType } from '../../types/issues.ts';
3
3
  import { Table } from '../../util/table.ts';
4
- export declare const dim: import("picocolors/types.js").Formatter;
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 namespace members" | "Duplicate exports" | "Unused catalog entries";
4
+ export declare const dim: (text: string | number | null | undefined) => string;
5
+ export declare const bright: (text: string | number | null | undefined) => string;
6
+ export declare const getIssueTypeTitle: (reportType: keyof typeof ISSUE_TYPE_TITLE) => "Duplicate exports" | "Exported types in used namespace" | "Exports in used namespace" | "Referenced optional peerDependencies" | "Unlisted binaries" | "Unlisted dependencies" | "Unresolved imports" | "Unused catalog entries" | "Unused dependencies" | "Unused devDependencies" | "Unused exported enum members" | "Unused exported namespace members" | "Unused exported types" | "Unused exports" | "Unused files";
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 = {
@@ -1,19 +1,18 @@
1
- import picocolors from 'picocolors';
2
- import { ISSUE_TYPE_TITLE, SYMBOL_TYPE } from "../../constants.js";
3
- import { relative } from "../../util/path.js";
4
- import { Table } from "../../util/table.js";
1
+ import { ISSUE_TYPE_TITLE, SYMBOL_TYPE } from '../../constants.js';
2
+ import st from '../../util/colors.js';
3
+ import { relative } from '../../util/path.js';
4
+ import { Table } from '../../util/table.js';
5
5
  const plain = (text) => text;
6
- export const dim = picocolors.gray;
7
- export const bright = picocolors.whiteBright;
8
- const yellow = picocolors.yellow;
6
+ export const dim = st.gray;
7
+ export const bright = st.whiteBright;
9
8
  export const getIssueTypeTitle = (reportType) => ISSUE_TYPE_TITLE[reportType];
10
- export const getColoredTitle = (title, count) => `${picocolors.yellowBright(picocolors.underline(title))} (${count})`;
11
- export const getDimmedTitle = (title, count) => `${yellow(`${picocolors.underline(title)} (${count})`)}`;
9
+ export const getColoredTitle = (title, count) => `${st.style(['yellowBright', 'underline'], title)} (${count})`;
10
+ export const getDimmedTitle = (title, count) => `${st.yellow(`${st.underline(title)} (${count})`)}`;
12
11
  export const getIssueLine = ({ owner, filePath, symbols, parentSymbol, severity }, cwd) => {
13
12
  const symbol = symbols ? `: ${symbols.map(s => s.symbol).join(', ')}` : '';
14
13
  const parent = parentSymbol ? ` (${parentSymbol})` : '';
15
14
  const print = severity === 'warn' ? dim : plain;
16
- return `${owner ? `${picocolors.cyan(owner)} ` : ''}${print(`${relative(cwd, filePath)}${symbol}${parent}`)}`;
15
+ return `${owner ? `${st.cyan(owner)} ` : ''}${print(`${relative(cwd, filePath)}${symbol}${parent}`)}`;
17
16
  };
18
17
  export const convert = (issue) => ({
19
18
  namespace: 'parentSymbol' in issue ? issue.parentSymbol : undefined,
@@ -32,12 +31,14 @@ const sortByPos = (a, b) => {
32
31
  : filePathA.localeCompare(filePathB);
33
32
  };
34
33
  const highlightSymbol = (issue) => (_) => {
35
- if (issue.specifier && issue.specifier !== issue.symbol && issue.specifier.includes(issue.symbol)) {
36
- const parts = issue.specifier.split(issue.symbol);
37
- const rest = parts.slice(1).join('');
38
- return [dim(parts[0]), bright(issue.symbol), dim(rest)].join('');
34
+ const { specifier, symbol } = issue;
35
+ if (specifier && specifier !== symbol) {
36
+ const idx = specifier.indexOf(symbol);
37
+ if (idx !== -1) {
38
+ return `${dim(specifier.slice(0, idx))}${bright(symbol)}${dim(specifier.slice(idx + symbol.length))}`;
39
+ }
39
40
  }
40
- return issue.symbol;
41
+ return symbol;
41
42
  };
42
43
  export const getTableForType = (issues, cwd, options = { isUseColors: true }) => {
43
44
  const table = new Table({ truncateStart: ['filePath'], noTruncate: ['symbolType'] });