knip 6.44.1 → 6.45.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 (231) hide show
  1. package/dist/ConfigurationChief.d.ts +23 -1033
  2. package/dist/ConfigurationChief.js +71 -15
  3. package/dist/DependencyDeputy.d.ts +10 -6
  4. package/dist/DependencyDeputy.js +51 -27
  5. package/dist/IssueCollector.d.ts +14 -11
  6. package/dist/IssueCollector.js +25 -20
  7. package/dist/IssueFixer.js +1 -1
  8. package/dist/PackagePeeker.d.ts +6 -0
  9. package/dist/PackagePeeker.js +43 -14
  10. package/dist/ProjectPrincipal.d.ts +6 -3
  11. package/dist/ProjectPrincipal.js +83 -32
  12. package/dist/WorkspaceWorker.d.ts +5 -1
  13. package/dist/WorkspaceWorker.js +39 -22
  14. package/dist/binaries/bash-parser.js +1 -7
  15. package/dist/binaries/command.d.ts +3 -3
  16. package/dist/binaries/command.js +6 -2
  17. package/dist/binaries/fallback.js +1 -1
  18. package/dist/binaries/plugins.d.ts +4 -1
  19. package/dist/binaries/plugins.js +66 -18
  20. package/dist/binaries/resolvers/bun.js +2 -2
  21. package/dist/binaries/resolvers/index.d.ts +1 -0
  22. package/dist/binaries/resolvers/index.js +2 -0
  23. package/dist/binaries/resolvers/npm.js +7 -5
  24. package/dist/binaries/resolvers/npx.js +15 -12
  25. package/dist/binaries/resolvers/nub.js +2 -2
  26. package/dist/binaries/resolvers/vp.d.ts +2 -0
  27. package/dist/binaries/resolvers/vp.js +52 -0
  28. package/dist/binaries/util.d.ts +13 -1
  29. package/dist/binaries/util.js +35 -1
  30. package/dist/cli.js +10 -84
  31. package/dist/compilers/scss.js +2 -1
  32. package/dist/configuration-hints.d.ts +16 -0
  33. package/dist/configuration-hints.js +64 -0
  34. package/dist/constants.d.ts +2 -1
  35. package/dist/constants.js +37 -0
  36. package/dist/graph/SubpathReferences.d.ts +33 -0
  37. package/dist/graph/SubpathReferences.js +114 -0
  38. package/dist/graph/analyze.d.ts +4 -1
  39. package/dist/graph/analyze.js +16 -5
  40. package/dist/graph/build.d.ts +3 -1
  41. package/dist/graph/build.js +47 -23
  42. package/dist/graph-explorer/operations/resolve-export-origins.js +1 -1
  43. package/dist/plugins/angular/index.js +10 -17
  44. package/dist/plugins/aws-cdk/index.d.ts +3 -0
  45. package/dist/plugins/aws-cdk/index.js +32 -0
  46. package/dist/plugins/aws-cdk/types.d.ts +5 -0
  47. package/dist/plugins/aws-cdk/types.js +1 -0
  48. package/dist/plugins/babel/index.d.ts +1 -1
  49. package/dist/plugins/babel/index.js +25 -6
  50. package/dist/plugins/babel/types.d.ts +1 -0
  51. package/dist/plugins/bun/index.js +8 -7
  52. package/dist/plugins/c8/index.js +17 -4
  53. package/dist/plugins/changesets/index.js +3 -2
  54. package/dist/plugins/commitizen/index.js +6 -3
  55. package/dist/plugins/commitlint/index.js +10 -11
  56. package/dist/plugins/cypress/index.js +4 -2
  57. package/dist/plugins/danger/index.js +1 -1
  58. package/dist/plugins/docusaurus/helpers.js +6 -6
  59. package/dist/plugins/docusaurus/index.js +2 -2
  60. package/dist/plugins/electron-forge/index.js +2 -2
  61. package/dist/plugins/electron-vite/index.js +2 -2
  62. package/dist/plugins/eleventy/index.js +3 -2
  63. package/dist/plugins/eslint/helpers.js +4 -3
  64. package/dist/plugins/eslint/resolveFromAST.js +2 -2
  65. package/dist/plugins/evalite/index.d.ts +3 -0
  66. package/dist/plugins/evalite/index.js +26 -0
  67. package/dist/plugins/flue/index.js +2 -2
  68. package/dist/plugins/gatsby/index.js +1 -1
  69. package/dist/plugins/github-action/index.js +2 -2
  70. package/dist/plugins/github-actions/index.js +2 -2
  71. package/dist/plugins/graphql-codegen/index.js +13 -9
  72. package/dist/plugins/index.d.ts +5 -0
  73. package/dist/plugins/index.js +10 -0
  74. package/dist/plugins/jest/index.js +5 -5
  75. package/dist/plugins/knex/index.js +2 -2
  76. package/dist/plugins/laravel-vite-plugin/resolveFromAST.js +2 -2
  77. package/dist/plugins/lunaria/index.js +5 -2
  78. package/dist/plugins/markdownlint/index.js +8 -2
  79. package/dist/plugins/marko/index.js +2 -2
  80. package/dist/plugins/marko/taglibs.d.ts +1 -1
  81. package/dist/plugins/marko/taglibs.js +4 -28
  82. package/dist/plugins/mdx/index.d.ts +2 -1
  83. package/dist/plugins/mdx/index.js +7 -4
  84. package/dist/plugins/mdxlint/index.js +18 -15
  85. package/dist/plugins/mikro-orm/index.d.ts +3 -0
  86. package/dist/plugins/mikro-orm/index.js +77 -0
  87. package/dist/plugins/mikro-orm/types.d.ts +21 -0
  88. package/dist/plugins/mikro-orm/types.js +1 -0
  89. package/dist/plugins/msw/index.js +6 -3
  90. package/dist/plugins/msw/types.d.ts +1 -1
  91. package/dist/plugins/netlify/index.js +7 -3
  92. package/dist/plugins/next/index.js +63 -9
  93. package/dist/plugins/next/types.d.ts +5 -0
  94. package/dist/plugins/next-mdx/resolveFromAST.js +15 -10
  95. package/dist/plugins/nitro/index.js +5 -6
  96. package/dist/plugins/node/index.js +4 -4
  97. package/dist/plugins/npm-package-json-lint/index.js +10 -3
  98. package/dist/plugins/nuxt/index.js +18 -10
  99. package/dist/plugins/nuxt/types.d.ts +4 -0
  100. package/dist/plugins/nx/index.js +6 -3
  101. package/dist/plugins/openclaw/index.js +11 -11
  102. package/dist/plugins/oxlint/index.js +2 -2
  103. package/dist/plugins/payload/index.js +1 -1
  104. package/dist/plugins/playwright/index.js +3 -3
  105. package/dist/plugins/pm2/index.js +7 -7
  106. package/dist/plugins/prettier/index.js +2 -1
  107. package/dist/plugins/prisma/index.js +2 -2
  108. package/dist/plugins/quasar/resolveFromAST.js +14 -9
  109. package/dist/plugins/react-router/index.js +12 -15
  110. package/dist/plugins/release-it/index.js +6 -2
  111. package/dist/plugins/remix/index.js +3 -3
  112. package/dist/plugins/retry-cli/index.d.ts +3 -0
  113. package/dist/plugins/retry-cli/index.js +14 -0
  114. package/dist/plugins/rollup/index.js +1 -4
  115. package/dist/plugins/rstest/index.js +3 -3
  116. package/dist/plugins/semantic-release/index.js +3 -3
  117. package/dist/plugins/serverless-framework/index.js +10 -8
  118. package/dist/plugins/solidjs-vite-plugin/resolveFromAST.js +2 -2
  119. package/dist/plugins/stencil/resolveFromAST.js +5 -5
  120. package/dist/plugins/storybook/index.js +9 -3
  121. package/dist/plugins/stryker/index.js +2 -2
  122. package/dist/plugins/stylelint/index.js +2 -2
  123. package/dist/plugins/swc/index.js +4 -3
  124. package/dist/plugins/tailwind/index.js +2 -2
  125. package/dist/plugins/tanstack-router/index.js +2 -2
  126. package/dist/plugins/ts-node/index.js +6 -1
  127. package/dist/plugins/turbo/index.js +3 -3
  128. package/dist/plugins/typedoc/index.js +2 -2
  129. package/dist/plugins/typescript/content-mappers.d.ts +1 -1
  130. package/dist/plugins/typescript/index.js +6 -9
  131. package/dist/plugins/unocss/index.js +3 -0
  132. package/dist/plugins/varlock/scan.js +1 -1
  133. package/dist/plugins/vite/helpers.d.ts +1 -0
  134. package/dist/plugins/vite/helpers.js +13 -3
  135. package/dist/plugins/vite/index.js +5 -2
  136. package/dist/plugins/vite-plugin-pwa/resolveFromAST.js +2 -2
  137. package/dist/plugins/vitest/index.js +26 -18
  138. package/dist/plugins/vitest/types.d.ts +1 -0
  139. package/dist/plugins/vue/index.js +1 -1
  140. package/dist/plugins/web-test-runner/index.d.ts +3 -0
  141. package/dist/plugins/web-test-runner/index.js +86 -0
  142. package/dist/plugins/wrangler/index.js +3 -3
  143. package/dist/plugins/yarn/index.js +5 -5
  144. package/dist/plugins.js +2 -5
  145. package/dist/reporters/github-actions.js +3 -7
  146. package/dist/reporters/json.d.ts +1 -0
  147. package/dist/reporters/json.js +1 -0
  148. package/dist/reporters/util/configuration-hints.d.ts +3 -1
  149. package/dist/reporters/util/configuration-hints.js +40 -21
  150. package/dist/reporters/util/util.d.ts +1 -1
  151. package/dist/run-cli.d.ts +2 -0
  152. package/dist/run-cli.js +82 -0
  153. package/dist/run.js +12 -0
  154. package/dist/session/incremental.d.ts +1 -0
  155. package/dist/session/incremental.js +1 -0
  156. package/dist/session/watch.js +2 -1
  157. package/dist/types/PluginNames.d.ts +2 -2
  158. package/dist/types/PluginNames.js +5 -0
  159. package/dist/types/args.d.ts +3 -1
  160. package/dist/types/config.d.ts +17 -10
  161. package/dist/types/configuration.d.ts +45 -0
  162. package/dist/types/configuration.js +1 -0
  163. package/dist/types/issues.d.ts +4 -0
  164. package/dist/types/module-graph.d.ts +1 -0
  165. package/dist/types/options.d.ts +1 -0
  166. package/dist/types/package-json.d.ts +3 -8
  167. package/dist/types/workspace.d.ts +1 -0
  168. package/dist/typescript/get-imports-and-exports.js +18 -6
  169. package/dist/typescript/resolve-module-names.js +7 -45
  170. package/dist/typescript/visitors/calls.d.ts +1 -1
  171. package/dist/typescript/visitors/calls.js +14 -10
  172. package/dist/typescript/visitors/exports.js +16 -26
  173. package/dist/typescript/visitors/imports.d.ts +2 -1
  174. package/dist/typescript/visitors/imports.js +41 -24
  175. package/dist/typescript/visitors/members.d.ts +1 -1
  176. package/dist/typescript/visitors/members.js +38 -24
  177. package/dist/typescript/visitors/shadow.d.ts +2 -0
  178. package/dist/typescript/visitors/shadow.js +25 -0
  179. package/dist/typescript/visitors/walk.d.ts +20 -12
  180. package/dist/typescript/visitors/walk.js +78 -48
  181. package/dist/util/Performance.d.ts +25 -3
  182. package/dist/util/Performance.js +51 -27
  183. package/dist/util/cli-arguments.d.ts +2 -1
  184. package/dist/util/cli-arguments.js +5 -3
  185. package/dist/util/create-input-handler.js +138 -119
  186. package/dist/util/create-options.d.ts +4 -2071
  187. package/dist/util/create-options.js +6 -4
  188. package/dist/util/create-workspace-graph.js +2 -1
  189. package/dist/util/errors.d.ts +5 -2
  190. package/dist/util/errors.js +11 -18
  191. package/dist/util/fs.js +4 -2
  192. package/dist/util/input.d.ts +2 -2
  193. package/dist/util/input.js +2 -2
  194. package/dist/util/is-plugin-name.d.ts +2 -0
  195. package/dist/util/is-plugin-name.js +3 -0
  196. package/dist/util/jiti.d.ts +2 -1
  197. package/dist/util/jiti.js +11 -3
  198. package/dist/util/load-config.d.ts +1 -1
  199. package/dist/util/load-config.js +3 -2
  200. package/dist/util/loader.js +3 -2
  201. package/dist/util/map-workspaces.js +23 -1
  202. package/dist/util/module-graph.js +1 -0
  203. package/dist/util/modules.d.ts +2 -0
  204. package/dist/util/modules.js +78 -0
  205. package/dist/util/package-json.d.ts +12 -5
  206. package/dist/util/package-json.js +54 -26
  207. package/dist/util/parse-and-convert-gitignores.d.ts +2 -2
  208. package/dist/util/parse-and-convert-gitignores.js +5 -5
  209. package/dist/util/parse-configuration.d.ts +2 -0
  210. package/dist/util/parse-configuration.js +66 -0
  211. package/dist/util/plugin.js +8 -12
  212. package/dist/util/resolve.d.ts +1 -0
  213. package/dist/util/resolve.js +3 -2
  214. package/dist/util/scripts.d.ts +0 -5
  215. package/dist/util/scripts.js +1 -32
  216. package/dist/util/to-source-path.d.ts +4 -1
  217. package/dist/util/to-source-path.js +2 -2
  218. package/dist/util/unhandled-rejection.d.ts +8 -0
  219. package/dist/util/unhandled-rejection.js +29 -0
  220. package/dist/util/validation.d.ts +11 -0
  221. package/dist/util/validation.js +68 -0
  222. package/dist/util/watch.d.ts +3 -1
  223. package/dist/util/watch.js +5 -2
  224. package/dist/version.d.ts +1 -1
  225. package/dist/version.js +1 -1
  226. package/package.json +9 -10
  227. package/schema.json +34 -0
  228. package/dist/schema/configuration.d.ts +0 -3103
  229. package/dist/schema/configuration.js +0 -94
  230. package/dist/schema/plugins.d.ts +0 -1019
  231. package/dist/schema/plugins.js +0 -215
@@ -0,0 +1,86 @@
1
+ import { findProperty, getPropertyValues, resolveObjectArg } from '../../typescript/ast-helpers.js';
2
+ import { toEntry } from '../../util/input.js';
3
+ import { toAbsolute } from '../../util/path.js';
4
+ import { hasDependency } from '../../util/plugin.js';
5
+ const title = 'Web Test Runner';
6
+ const enablers = ['@web/test-runner'];
7
+ const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
8
+ const config = ['web-test-runner.config.{js,cjs,mjs}'];
9
+ const toFileEntries = (ids, base) => Array.from(ids, id => {
10
+ const pattern = String(id);
11
+ return toEntry(pattern.startsWith('!') ? `!${toAbsolute(pattern.slice(1), base)}` : toAbsolute(pattern, base));
12
+ });
13
+ const getConfigObject = (program) => {
14
+ const body = program.body ?? [];
15
+ const bindings = new Map();
16
+ for (const node of body) {
17
+ if (node.type !== 'VariableDeclaration')
18
+ continue;
19
+ for (const declaration of node.declarations) {
20
+ if (declaration.id?.type === 'Identifier' && declaration.init)
21
+ bindings.set(declaration.id.name, declaration.init);
22
+ }
23
+ }
24
+ const dereference = (node) => {
25
+ const seen = new Set();
26
+ while (node?.type === 'Identifier' && bindings.has(node.name) && !seen.has(node.name)) {
27
+ seen.add(node.name);
28
+ node = bindings.get(node.name);
29
+ }
30
+ return node;
31
+ };
32
+ for (const node of body) {
33
+ if (node.type === 'ExportDefaultDeclaration')
34
+ return resolveObjectArg(dereference(node.declaration));
35
+ const { expression } = node;
36
+ if (node.type === 'ExpressionStatement' &&
37
+ expression?.type === 'AssignmentExpression' &&
38
+ expression.left?.type === 'MemberExpression' &&
39
+ expression.left.object?.name === 'module' &&
40
+ expression.left.property?.name === 'exports') {
41
+ return resolveObjectArg(dereference(expression.right));
42
+ }
43
+ }
44
+ };
45
+ const resolveFromAST = (program, options) => {
46
+ const localConfig = getConfigObject(program);
47
+ const patterns = new Set();
48
+ for (const pattern of getPropertyValues(localConfig, 'files'))
49
+ patterns.add(pattern);
50
+ const groups = findProperty(localConfig, 'groups');
51
+ if (groups?.type === 'ArrayExpression') {
52
+ for (const group of groups.elements ?? [])
53
+ for (const pattern of getPropertyValues(group, 'files'))
54
+ patterns.add(pattern);
55
+ }
56
+ return toFileEntries(patterns, options.cwd);
57
+ };
58
+ const args = {
59
+ binaries: ['web-test-runner', 'wtr'],
60
+ config: ['config'],
61
+ string: ['files'],
62
+ boolean: [
63
+ 'coverage',
64
+ 'debug',
65
+ 'help',
66
+ 'manual',
67
+ 'node-resolve',
68
+ 'open',
69
+ 'playwright',
70
+ 'preserve-symlinks',
71
+ 'puppeteer',
72
+ 'static-logging',
73
+ 'update-snapshots',
74
+ 'watch',
75
+ ],
76
+ resolveInputs: (parsed, { cwd }) => toFileEntries([...parsed._, ...(parsed['--'] ?? []), ...[parsed.files ?? []].flat()].map(String), cwd),
77
+ };
78
+ const plugin = {
79
+ title,
80
+ enablers,
81
+ isEnabled,
82
+ config,
83
+ resolveFromAST,
84
+ args,
85
+ };
86
+ export default plugin;
@@ -1,11 +1,11 @@
1
- import { toProductionEntry } from '../../util/input.js';
1
+ import { toDeferResolveProductionEntry } from '../../util/input.js';
2
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);
6
6
  const config = ['wrangler.{json,jsonc,toml}'];
7
- const resolveConfig = async (config) => {
8
- return (config.main ? [config.main] : []).map(id => toProductionEntry(id));
7
+ const resolveConfig = async (config, { cwd }) => {
8
+ return (config.main ? [config.main] : []).map(id => toDeferResolveProductionEntry(id, { dir: cwd }));
9
9
  };
10
10
  const plugin = {
11
11
  title,
@@ -1,23 +1,23 @@
1
1
  import { isFile } from '../../util/fs.js';
2
- import { toDependency, toEntry } from '../../util/input.js';
2
+ import { toDeferResolveEntry, toDependency, 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 directory, or when `yarn@` is specified in the `packageManager` field of `package.json`.';
5
5
  const isEnabled = async ({ cwd, manifest }) => manifest.packageManager?.startsWith('yarn@') || isFile(cwd, 'yarn.lock');
6
6
  const isRootOnly = true;
7
7
  const config = ['.yarnrc.yml'];
8
8
  const entry = ['yarn.config.cjs'];
9
- const resolveConfig = config => {
9
+ const resolveConfig = (config, { cwd }) => {
10
10
  const inputs = entry.map(toEntry);
11
11
  if (Array.isArray(config.plugins)) {
12
12
  for (const plugin of config.plugins) {
13
13
  if (typeof plugin === 'string')
14
- inputs.push(toEntry(plugin));
14
+ inputs.push(toDeferResolveEntry(plugin, { dir: cwd }));
15
15
  else if (typeof plugin.path === 'string')
16
- inputs.push(toEntry(plugin.path));
16
+ inputs.push(toDeferResolveEntry(plugin.path, { dir: cwd }));
17
17
  }
18
18
  }
19
19
  if (config.yarnPath) {
20
- inputs.push(toEntry(config.yarnPath));
20
+ inputs.push(toDeferResolveEntry(config.yarnPath, { dir: cwd }));
21
21
  }
22
22
  if (config.packageExtensions) {
23
23
  for (const extension of Object.values(config.packageExtensions)) {
package/dist/plugins.js CHANGED
@@ -1,12 +1,9 @@
1
- import { parseArgs } from 'node:util';
2
1
  import { Plugins } from './plugins/index.js';
3
- import { timerify } from './util/Performance.js';
2
+ import { perfObserver, timerify } from './util/Performance.js';
4
3
  const PMap = Plugins;
5
- const { values } = parseArgs({ strict: false, options: { performance: { type: 'boolean' } } });
6
- const isEnabled = !!values.performance;
7
4
  const timerifyMethods = ['resolve', 'resolveConfig', 'resolveFromAST'];
8
5
  const PluginEntries = Object.entries(PMap);
9
- if (isEnabled) {
6
+ if (perfObserver.isTimerifyFunctions) {
10
7
  for (const [, plugin] of PluginEntries) {
11
8
  for (const method of timerifyMethods) {
12
9
  if (method in plugin)
@@ -59,18 +59,14 @@ export default ({ report, issues, cwd, configurationHints, tagHints, isDisableCo
59
59
  core.info(`${CONFIG_HINTS_TITLE} (${configurationHints.length})`);
60
60
  const sortedHints = configurationHints.toSorted((a, b) => compareStrings(a.filePath ?? '', b.filePath ?? ''));
61
61
  for (const hint of sortedHints) {
62
- const hintPrinter = hintPrinters.get(hint.type);
63
- const message = hintPrinter?.print({
64
- ...hint,
65
- filePath: hint.filePath ?? configFilePath ?? '',
66
- configFilePath,
67
- }) ?? '';
68
62
  const file = hint.filePath
69
63
  ? relative(cwd, hint.filePath)
70
64
  : configFilePath
71
65
  ? relative(cwd, configFilePath)
72
66
  : 'knip.json';
73
- const hintMessage = `${message}: ${hint.identifier} in ${file}`;
67
+ const hintPrinter = hintPrinters.get(hint.type);
68
+ const message = hintPrinter?.print({ ...hint, filePath: file, configFilePath }) ?? '';
69
+ const hintMessage = `${message}: ${hint.identifier}`;
74
70
  if (isTreatConfigHintsAsErrors) {
75
71
  core.error(hintMessage, {
76
72
  file,
@@ -27,6 +27,7 @@ export type JSONReportEntry = {
27
27
  nsExports?: Array<JSONReportItem>;
28
28
  nsTypes?: Array<JSONReportItem>;
29
29
  optionalPeerDependencies?: Array<JSONReportItem>;
30
+ subpaths?: Array<JSONReportItem>;
30
31
  types?: Array<JSONReportItem>;
31
32
  unlisted?: Array<JSONReportNamedItem>;
32
33
  unresolved?: Array<JSONReportItem>;
@@ -32,6 +32,7 @@ export default async ({ report, issues, options, cwd, write }) => {
32
32
  ...(report.nsExports && { nsExports: [] }),
33
33
  ...(report.nsTypes && { nsTypes: [] }),
34
34
  ...(report.optionalPeerDependencies && { optionalPeerDependencies: [] }),
35
+ ...(report.subpaths && { subpaths: [] }),
35
36
  ...(report.types && { types: [] }),
36
37
  ...(report.unlisted && { unlisted: [] }),
37
38
  ...(report.unresolved && { unresolved: [] }),
@@ -1,11 +1,13 @@
1
1
  import type { Results } from '../../run.ts';
2
- import type { ConfigurationHint, ConfigurationHintType, ReporterOptions } from '../../types/issues.ts';
2
+ import type { ConfigurationHint, ConfigurationHintType, ReporterOptions, UnusedIgnorePatternReason } from '../../types/issues.ts';
3
3
  interface PrintHintOptions {
4
4
  type: ConfigurationHintType;
5
5
  identifier: string | RegExp;
6
6
  filePath: string;
7
7
  configFilePath?: string;
8
8
  workspaceName?: string;
9
+ configKey?: string;
10
+ reason?: UnusedIgnorePatternReason;
9
11
  size?: number;
10
12
  }
11
13
  export declare const hintPrinters: Map<ConfigurationHintType, {
@@ -1,14 +1,8 @@
1
- import { relative, toRelative } from '../../util/path.js';
1
+ import { ROOT_WORKSPACE_NAME } from '../../constants.js';
2
+ import { basename, relative, toRelative } from '../../util/path.js';
2
3
  import { Table } from '../../util/table.js';
3
4
  import { byPathDepth } from '../../util/workspace.js';
4
5
  import { bright, dim, getColoredTitle, getDimmedTitle } from './util.js';
5
- const getWorkspaceName = (hint) => hint.workspaceName &&
6
- hint.workspaceName !== '.' &&
7
- hint.type !== 'top-level-unconfigured' &&
8
- hint.type !== 'workspace-unconfigured' &&
9
- hint.type !== 'package-entry'
10
- ? hint.workspaceName
11
- : '';
12
6
  const getIdentifier = (hint) => {
13
7
  if (hint.identifier === '.')
14
8
  return `. ${dim('(root)')}`;
@@ -17,30 +11,55 @@ const getIdentifier = (hint) => {
17
11
  return hint.identifier.toString();
18
12
  };
19
13
  const getTableForHints = (hints) => {
20
- const table = new Table({ truncate: { identifier: 'start', workspace: 'start', filePath: 'start' } });
14
+ const table = new Table({ truncate: { identifier: 'start', description: 'none' } });
21
15
  for (const hint of hints) {
22
16
  table.row();
23
17
  table.cell('identifier', getIdentifier(hint));
24
- table.cell('workspace', getWorkspaceName(hint));
25
- table.cell('filePath', hint.filePath);
26
18
  table.cell('description', dim(hint.message));
27
19
  }
28
20
  return table;
29
21
  };
30
- const type = (id) => bright(id.split('-').at(0));
31
- const unused = (options) => `Remove from ${type(options.type)}`;
32
- const empty = (options) => `Refine ${type(options.type)} pattern (no matches)`;
33
- const remove = (options) => `Remove redundant ${type(options.type)} pattern`;
34
- const topLevel = (options) => `Remove, or move unused top-level ${type(options.type)} to one of ${bright('"workspaces"')}`;
22
+ const type = (id) => id.split('-').at(0);
23
+ const SEP = ' → ';
24
+ const location = (options, key) => {
25
+ const segments = [];
26
+ if (options.filePath) {
27
+ segments.push(options.filePath);
28
+ if (basename(options.filePath) === 'package.json')
29
+ segments.push('knip');
30
+ }
31
+ const workspace = options.configKey ?? (options.workspaceName !== ROOT_WORKSPACE_NAME ? options.workspaceName : undefined);
32
+ if (workspace)
33
+ segments.push(workspace === ROOT_WORKSPACE_NAME ? '(root)' : workspace);
34
+ if (key)
35
+ segments.push(bright(key));
36
+ return segments.join(SEP);
37
+ };
38
+ const reasons = {
39
+ 'no-issues': 'no issues',
40
+ gitignored: 'gitignored',
41
+ 'no-matches': 'no matches',
42
+ };
43
+ const unused = (options) => {
44
+ const reason = options.reason
45
+ ? options.type === 'ignoreFiles' && options.reason === 'no-issues'
46
+ ? 'files are used'
47
+ : reasons[options.reason]
48
+ : undefined;
49
+ return `Remove from ${location(options, type(options.type))}${reason ? ` (${reason})` : ''}`;
50
+ };
51
+ const empty = (options) => `Refine ${location(options, type(options.type))} pattern (no matches)`;
52
+ const remove = (options) => `Remove redundant pattern from ${location(options, type(options.type))}`;
53
+ const topLevel = (options) => `Remove unused ${location(options, type(options.type))}, or move to ${bright('"workspaces"')}`;
35
54
  const add = (options) => options.configFilePath
36
- ? `Add ${bright('entry')} and/or refine ${bright('project')} files (${options.size} unused files)`
55
+ ? `Add ${bright('entry')} and/or refine ${bright('project')} files in ${location(options)} (${options.size} unused files)`
37
56
  : `Create ${bright('knip.json')} configuration file, and add ${bright('entry')} and/or refine ${bright('project')} files (${options.size} unused files)`;
38
57
  const addWorkspace = (options) => options.configFilePath
39
- ? `Add ${bright('entry')} and/or refine ${bright('project')} files in ${bright(`workspaces["${options.workspaceName}"]`)} (${options.size} unused files)`
58
+ ? `Add ${bright('entry')} and/or refine ${bright('project')} files in ${location({ ...options, workspaceName: undefined }, `workspaces["${options.workspaceName}"]`)} (${options.size} unused files)`
40
59
  : `Create ${bright('knip.json')} configuration file with ${bright(`workspaces["${options.workspaceName}"]`)} object (${options.size} unused files)`;
41
- const packageEntry = () => 'Package entry file not found';
42
- const extensionUnregistered = () => `Extension in ${bright('project')} not registered as a compiler`;
43
- const extensionExcluded = () => `Compiled extension excluded by ${bright('project')} (imports not followed)`;
60
+ const packageEntry = (options) => `Package entry file not found${options.filePath ? ` in ${options.filePath}` : ''}`;
61
+ const extensionUnregistered = (options) => `Extension in ${location(options, 'project')} not registered as a compiler`;
62
+ const extensionExcluded = (options) => `Compiled extension excluded by ${location(options, 'project')} (imports not followed)`;
44
63
  export const hintPrinters = new Map([
45
64
  ['ignore', { print: unused }],
46
65
  ['ignoreFiles', { print: unused }],
@@ -3,7 +3,7 @@ import type { Issue, IssueRecords, IssueSeverity, IssueSymbol, IssueType } from
3
3
  import { Table } from '../../util/table.ts';
4
4
  export declare const dim: (text: string | number | null | undefined) => string;
5
5
  export declare const bright: (text: string | number | null | undefined) => string;
6
- export declare const getIssueTypeTitle: (reportType: keyof typeof ISSUE_TYPE_TITLE) => "Circular dependencies" | "Duplicate exports" | "Exported types in used namespace" | "Exports in used namespace" | "Referenced optional peerDependencies" | "Unlisted binaries" | "Unlisted dependencies" | "Unresolved catalog references" | "Unresolved imports" | "Unused catalog entries" | "Unused dependencies" | "Unused devDependencies" | "Unused exported enum members" | "Unused exported namespace members" | "Unused exported types" | "Unused exports" | "Unused files";
6
+ export declare const getIssueTypeTitle: (reportType: keyof typeof ISSUE_TYPE_TITLE) => "Circular dependencies" | "Duplicate exports" | "Exported types in used namespace" | "Exports in used namespace" | "Referenced optional peerDependencies" | "Unlisted binaries" | "Unlisted dependencies" | "Unresolved catalog references" | "Unresolved imports" | "Unused catalog entries" | "Unused dependencies" | "Unused devDependencies" | "Unused exported enum members" | "Unused exported namespace members" | "Unused exported types" | "Unused exports" | "Unused files" | "Unused subpaths";
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 = {
@@ -0,0 +1,2 @@
1
+ import type { ParsedCLIArgs } from './util/cli-arguments.ts';
2
+ export declare const runCLI: (args: ParsedCLIArgs) => Promise<void>;
@@ -0,0 +1,82 @@
1
+ import { fix } from './IssueFixer.js';
2
+ import { run } from './run.js';
3
+ import { createOptions } from './util/create-options.js';
4
+ import { getKnownErrors, hasErrorCause, isConfigurationError, isKnownError, isLoaderError, isModuleNotFoundError, } from './util/errors.js';
5
+ import { logError } from './util/log.js';
6
+ import { perfObserver } from './util/Performance.js';
7
+ import { createPreprocessor, toReporterOptions } from './util/preprocessor.js';
8
+ import { runReporters } from './util/reporter.js';
9
+ import { prettyMilliseconds } from './util/string.js';
10
+ import { hasUnhandledRejection, listenForUnhandledRejections } from './util/unhandled-rejection.js';
11
+ import { watchSession } from './session/watch.js';
12
+ export const runCLI = async (args) => {
13
+ let cwd = process.cwd();
14
+ listenForUnhandledRejections(() => cwd);
15
+ if (perfObserver.isEnabled || perfObserver.isDurationEnabled)
16
+ perfObserver.startRun();
17
+ try {
18
+ const options = await createOptions({ args });
19
+ cwd = options.cwd;
20
+ if (options.isWatch) {
21
+ await watchSession(options);
22
+ return;
23
+ }
24
+ const { results } = await run(options);
25
+ if (options.isWatch || options.isTrace)
26
+ return;
27
+ const preprocess = await createPreprocessor(options.preprocessor);
28
+ const finalData = await preprocess(toReporterOptions(options, results, args));
29
+ if (options.isFix)
30
+ await fix(finalData.issues, finalData.counters, options);
31
+ await runReporters(args.reporter ?? ['symbols'], args['output-file'] ?? [], finalData);
32
+ const totalErrorCount = Object.keys(finalData.report)
33
+ .filter(reportGroup => finalData.report[reportGroup] && options.rules[reportGroup] === 'error')
34
+ .reduce((errorCount, reportGroup) => errorCount + finalData.counters[reportGroup], 0);
35
+ if (perfObserver.isEnabled || perfObserver.isDurationEnabled)
36
+ perfObserver.finalize();
37
+ if (perfObserver.isTimerifyFunctions)
38
+ console.log(`\n${perfObserver.getTimerifiedFunctionsTable()}`);
39
+ if (perfObserver.isMemoryUsageEnabled && !args['memory-realtime'])
40
+ console.log(`\n${perfObserver.getMemoryUsageTable()}`);
41
+ if (perfObserver.isEnabled || perfObserver.isDurationEnabled) {
42
+ const duration = perfObserver.getCurrentDurationInMs();
43
+ const startup = perfObserver.getProcessDurationInMs() - duration;
44
+ console.log(`\nTotal running time: ${prettyMilliseconds(duration)} (+${prettyMilliseconds(startup)} startup)`);
45
+ perfObserver.reset();
46
+ }
47
+ if (results.hasConfigLoadErrors || hasUnhandledRejection()) {
48
+ process.exitCode = 2;
49
+ return;
50
+ }
51
+ if (!args['no-exit-code'] &&
52
+ (totalErrorCount > options.maxIssues ||
53
+ (!options.isDisableConfigHints &&
54
+ options.isTreatConfigHintsAsErrors &&
55
+ finalData.configurationHints.length > 0) ||
56
+ (!options.isDisableTagHints && options.isTreatTagHintsAsErrors && finalData.tagHints.size > 0))) {
57
+ process.exitCode = 1;
58
+ return;
59
+ }
60
+ }
61
+ catch (error) {
62
+ process.exitCode = 2;
63
+ if (!args.debug && error instanceof Error && isKnownError(error)) {
64
+ const knownErrors = getKnownErrors(error);
65
+ for (const knownError of knownErrors)
66
+ logError(knownError.message);
67
+ if (hasErrorCause(knownErrors[0])) {
68
+ console.error('Reason:', knownErrors[0].cause.message);
69
+ if (isModuleNotFoundError(knownErrors[0].cause))
70
+ console.log('Module load error? Visit https://knip.dev/reference/known-issues');
71
+ if (isLoaderError(knownErrors[0]))
72
+ console.log('Configuration file load error? Visit https://knip.dev/reference/known-issues');
73
+ }
74
+ if (isConfigurationError(knownErrors[0]))
75
+ console.log('\nRun `knip --help` or visit https://knip.dev for help');
76
+ process.exitCode = 2;
77
+ return;
78
+ }
79
+ throw error;
80
+ }
81
+ process.exitCode = 0;
82
+ };
package/dist/run.js CHANGED
@@ -6,6 +6,7 @@ import { ConsoleStreamer } from './ConsoleStreamer.js';
6
6
  import { DependencyDeputy } from './DependencyDeputy.js';
7
7
  import { analyze } from './graph/analyze.js';
8
8
  import { build } from './graph/build.js';
9
+ import { SubpathReferences } from './graph/SubpathReferences.js';
9
10
  import { IssueCollector } from './IssueCollector.js';
10
11
  import { ProjectPrincipal } from './ProjectPrincipal.js';
11
12
  import { debugLogObject } from './util/debug.js';
@@ -61,6 +62,13 @@ export const run = async (options) => {
61
62
  const toSourceFilePath = getModuleSourcePathHandler(chief);
62
63
  const findWorkspacePackageTarget = getWorkspacePackageTargetHandler(chief);
63
64
  const principal = new ProjectPrincipal(options, toSourceFilePath, findWorkspacePackageTarget, filePath => chief.findWorkspaceByFilePath(filePath)?.name);
65
+ const subpathReferences = new SubpathReferences({
66
+ chief,
67
+ principal,
68
+ workspaces,
69
+ findWorkspacePackageTarget,
70
+ isGitIgnored,
71
+ });
64
72
  collector.setWorkspaceFilter(chief.workspaceFilePathFilter);
65
73
  collector.setSelectedWorkspaces(chief.selectedWorkspaces);
66
74
  collector.setIgnoreIssues(chief.getIgnoreIssues());
@@ -75,6 +83,7 @@ export const run = async (options) => {
75
83
  isGitIgnored,
76
84
  scriptParserContext,
77
85
  streamer,
86
+ subpathReferences,
78
87
  workspaces,
79
88
  options,
80
89
  });
@@ -86,7 +95,9 @@ export const run = async (options) => {
86
95
  deputy,
87
96
  entryPaths,
88
97
  graph,
98
+ isGitIgnored,
89
99
  streamer,
100
+ subpathReferences,
90
101
  unreferencedFiles,
91
102
  options,
92
103
  });
@@ -98,6 +109,7 @@ export const run = async (options) => {
98
109
  session = await getSessionHandler(options, {
99
110
  analyzedFiles,
100
111
  analyzeSourceFile,
112
+ subpathReferences,
101
113
  chief,
102
114
  collector,
103
115
  analyze: reAnalyze,
@@ -30,6 +30,7 @@ export declare const getFileTopology: (file: FileNode) => {
30
30
  modifiers: number;
31
31
  jsDocTags: Set<string> | undefined;
32
32
  }[];
33
+ subpathImports: Set<string> | undefined;
33
34
  externalRefs: Set<import("../types/module-graph.ts").ExternalRef>;
34
35
  exports: {
35
36
  identifier: string;
@@ -41,6 +41,7 @@ export const getFileTopology = (file) => {
41
41
  imports: facts(file.imports.imports),
42
42
  external: facts(file.imports.external),
43
43
  unresolved: facts(file.imports.unresolved),
44
+ subpathImports: file.imports.subpathImports,
44
45
  externalRefs: file.imports.externalRefs,
45
46
  exports,
46
47
  skipExports: file.skipExports,
@@ -6,6 +6,7 @@ import { hasErrorCause } from '../util/errors.js';
6
6
  import { isFile } from '../util/fs.js';
7
7
  import { logError } from '../util/log.js';
8
8
  import { toPosix } from '../util/path.js';
9
+ import { hasUnhandledRejection } from '../util/unhandled-rejection.js';
9
10
  import { createSession } from './session.js';
10
11
  export const watchSession = async (options) => {
11
12
  const streamer = new ConsoleStreamer(options);
@@ -29,7 +30,7 @@ export const watchSession = async (options) => {
29
30
  session.handleFileChanges([{ type, filePath: path }]).then(update => {
30
31
  if (!update)
31
32
  return;
32
- process.exitCode = 0;
33
+ process.exitCode = hasUnhandledRejection() ? 2 : 0;
33
34
  report(update.duration);
34
35
  }, onError);
35
36
  });
@@ -1,2 +1,2 @@
1
- export type PluginName = 'angular' | 'astro' | 'astro-db' | 'astro-markdoc' | 'astro-og-canvas' | 'ava' | 'babel' | 'biome' | 'borp' | 'buf' | 'bumpp' | 'bun' | 'c8' | 'capacitor' | 'catalyst' | 'changelogen' | 'changelogithub' | 'changesets' | 'commitizen' | 'commitlint' | 'convex' | 'create-typescript-app' | 'cspell' | 'cucumber' | 'cypress' | 'danger' | 'dependency-cruiser' | 'docusaurus' | 'dotenv' | 'drizzle' | 'electron-forge' | 'electron-vite' | 'eleventy' | 'esbuild' | 'eslint' | 'eve' | 'execa' | 'expo' | 'expo-router' | 'expressive-code' | 'fast' | 'filesystem-routing' | 'flue' | 'fumadocs' | 'gatsby' | 'github-action' | 'github-actions' | 'glob' | 'graphql-codegen' | 'hardhat' | 'husky' | 'i18next-parser' | 'jasmine' | 'jest' | 'karma' | 'knex' | 'kysely-codegen' | 'ladle' | 'laravel-vite-plugin' | 'lefthook' | 'lingui' | 'lint-staged' | 'linthtml' | 'lit' | 'lockfile-lint' | 'lost-pixel' | 'lunaria' | 'markdownlint' | 'marko' | 'mastra' | 'mcp' | 'mdx' | 'mdxlint' | 'metro' | 'mise' | 'mocha' | 'moonrepo' | 'msw' | 'nano-spawn' | 'nano-staged' | 'nest' | 'netlify' | 'next' | 'next-intl' | 'next-mdx' | 'nitro' | 'node' | 'node-modules-inspector' | 'nodemon' | 'npm-package-json-lint' | 'nuxt' | 'nuxtjs-i18n' | 'nx' | 'nyc' | 'oclif' | 'openapi-ts' | 'openclaw' | 'orval' | 'osls' | 'oxfmt' | 'oxlint' | 'panda-css' | 'parcel' | 'payload' | 'pino' | 'playwright' | 'playwright-ct' | 'playwright-test' | 'plop' | 'pm2' | 'pnpm' | 'postcss' | 'pre-commit' | 'preconstruct' | 'prettier' | 'prisma' | 'purgecss' | 'quasar' | 'qwik' | 'railway' | 'raycast' | 'react-cosmos' | 'react-email' | 'react-native' | 'react-router' | 'relay' | 'release-it' | 'remark' | 'remix' | 'rolldown' | 'rollup' | 'rsbuild' | 'rslib' | 'rspack' | 'rstest' | 'sanity' | 'semantic-release' | 'sentry' | 'serverless-framework' | 'simple-git-hooks' | 'size-limit' | 'solidjs-vite-plugin' | 'sst' | 'starlight' | 'stencil' | 'storybook' | 'stryker' | 'stylelint' | 'svelte' | 'sveltejs-package' | 'sveltekit' | 'svgo' | 'svgr' | 'swc' | 'syncpack' | 'tailwind' | 'tanstack-router' | 'taskfile' | 'tauri' | 'temporal' | 'textlint' | 'travis' | 'ts-node' | 'tsd' | 'tsdown' | 'tsrs' | 'tsup' | 'tsx' | 'turbo' | 'typedoc' | 'typescript' | 'typescript-content-mapper' | 'unbuild' | 'unocss' | 'unplugin-auto-import' | 'unplugin-icons' | 'unplugin-vue-components' | 'unplugin-vue-i18n' | 'unplugin-vue-markdown' | 'unplugin-vue-router' | 'varlock' | 'vercel' | 'vercel-og' | 'vike' | 'vite' | 'vite-plugin-pages' | 'vite-plugin-pwa' | 'vite-plugin-vue-layouts-next' | 'vite-plus' | 'vite-pwa-assets-generator' | 'vitepress' | 'vitest' | 'vue' | 'webdriver-io' | 'webpack' | 'wireit' | 'wrangler' | 'wxt' | 'xo' | 'yarn' | 'yorkie' | 'zx';
2
- export declare const pluginNames: readonly ['angular', 'astro', 'astro-db', 'astro-markdoc', 'astro-og-canvas', 'ava', 'babel', 'biome', 'borp', 'buf', 'bumpp', 'bun', 'c8', 'capacitor', 'catalyst', 'changelogen', 'changelogithub', 'changesets', 'commitizen', 'commitlint', 'convex', 'create-typescript-app', 'cspell', 'cucumber', 'cypress', 'danger', 'dependency-cruiser', 'docusaurus', 'dotenv', 'drizzle', 'electron-forge', 'electron-vite', 'eleventy', 'esbuild', 'eslint', 'eve', 'execa', 'expo', 'expo-router', 'expressive-code', 'fast', 'filesystem-routing', 'flue', 'fumadocs', 'gatsby', 'github-action', 'github-actions', 'glob', 'graphql-codegen', 'hardhat', 'husky', 'i18next-parser', 'jasmine', 'jest', 'karma', 'knex', 'kysely-codegen', 'ladle', 'laravel-vite-plugin', 'lefthook', 'lingui', 'lint-staged', 'linthtml', 'lit', 'lockfile-lint', 'lost-pixel', 'lunaria', 'markdownlint', 'marko', 'mastra', 'mcp', 'mdx', 'mdxlint', 'metro', 'mise', 'mocha', 'moonrepo', 'msw', 'nano-spawn', 'nano-staged', 'nest', 'netlify', 'next', 'next-intl', 'next-mdx', 'nitro', 'node', 'node-modules-inspector', 'nodemon', 'npm-package-json-lint', 'nuxt', 'nuxtjs-i18n', 'nx', 'nyc', 'oclif', 'openapi-ts', 'openclaw', 'orval', 'osls', 'oxfmt', 'oxlint', 'panda-css', 'parcel', 'payload', 'pino', 'playwright', 'playwright-ct', 'playwright-test', 'plop', 'pm2', 'pnpm', 'postcss', 'pre-commit', 'preconstruct', 'prettier', 'prisma', 'purgecss', 'quasar', 'qwik', 'railway', 'raycast', 'react-cosmos', 'react-email', 'react-native', 'react-router', 'relay', 'release-it', 'remark', 'remix', 'rolldown', 'rollup', 'rsbuild', 'rslib', 'rspack', 'rstest', 'sanity', 'semantic-release', 'sentry', 'serverless-framework', 'simple-git-hooks', 'size-limit', 'solidjs-vite-plugin', 'sst', 'starlight', 'stencil', 'storybook', 'stryker', 'stylelint', 'svelte', 'sveltejs-package', 'sveltekit', 'svgo', 'svgr', 'swc', 'syncpack', 'tailwind', 'tanstack-router', 'taskfile', 'tauri', 'temporal', 'textlint', 'travis', 'ts-node', 'tsd', 'tsdown', 'tsrs', 'tsup', 'tsx', 'turbo', 'typedoc', 'typescript', 'typescript-content-mapper', 'unbuild', 'unocss', 'unplugin-auto-import', 'unplugin-icons', 'unplugin-vue-components', 'unplugin-vue-i18n', 'unplugin-vue-markdown', 'unplugin-vue-router', 'varlock', 'vercel', 'vercel-og', 'vike', 'vite', 'vite-plugin-pages', 'vite-plugin-pwa', 'vite-plugin-vue-layouts-next', 'vite-plus', 'vite-pwa-assets-generator', 'vitepress', 'vitest', 'vue', 'webdriver-io', 'webpack', 'wireit', 'wrangler', 'wxt', 'xo', 'yarn', 'yorkie', 'zx'];
1
+ export type PluginName = 'angular' | 'astro' | 'astro-db' | 'astro-markdoc' | 'astro-og-canvas' | 'ava' | 'aws-cdk' | 'babel' | 'biome' | 'borp' | 'buf' | 'bumpp' | 'bun' | 'c8' | 'capacitor' | 'catalyst' | 'changelogen' | 'changelogithub' | 'changesets' | 'commitizen' | 'commitlint' | 'convex' | 'create-typescript-app' | 'cspell' | 'cucumber' | 'cypress' | 'danger' | 'dependency-cruiser' | 'docusaurus' | 'dotenv' | 'drizzle' | 'electron-forge' | 'electron-vite' | 'eleventy' | 'esbuild' | 'eslint' | 'evalite' | 'eve' | 'execa' | 'expo' | 'expo-router' | 'expressive-code' | 'fast' | 'filesystem-routing' | 'flue' | 'fumadocs' | 'gatsby' | 'github-action' | 'github-actions' | 'glob' | 'graphql-codegen' | 'hardhat' | 'husky' | 'i18next-parser' | 'jasmine' | 'jest' | 'karma' | 'knex' | 'kysely-codegen' | 'ladle' | 'laravel-vite-plugin' | 'lefthook' | 'lingui' | 'lint-staged' | 'linthtml' | 'lit' | 'lockfile-lint' | 'lost-pixel' | 'lunaria' | 'markdownlint' | 'marko' | 'mastra' | 'mcp' | 'mdx' | 'mdxlint' | 'metro' | 'mikro-orm' | 'mise' | 'mocha' | 'moonrepo' | 'msw' | 'nano-spawn' | 'nano-staged' | 'nest' | 'netlify' | 'next' | 'next-intl' | 'next-mdx' | 'nitro' | 'node' | 'node-modules-inspector' | 'nodemon' | 'npm-package-json-lint' | 'nuxt' | 'nuxtjs-i18n' | 'nx' | 'nyc' | 'oclif' | 'openapi-ts' | 'openclaw' | 'orval' | 'osls' | 'oxfmt' | 'oxlint' | 'panda-css' | 'parcel' | 'payload' | 'pino' | 'playwright' | 'playwright-ct' | 'playwright-test' | 'plop' | 'pm2' | 'pnpm' | 'postcss' | 'pre-commit' | 'preconstruct' | 'prettier' | 'prisma' | 'purgecss' | 'quasar' | 'qwik' | 'railway' | 'raycast' | 'react-cosmos' | 'react-email' | 'react-native' | 'react-router' | 'relay' | 'release-it' | 'remark' | 'remix' | 'retry-cli' | 'rolldown' | 'rollup' | 'rsbuild' | 'rslib' | 'rspack' | 'rstest' | 'sanity' | 'semantic-release' | 'sentry' | 'serverless-framework' | 'simple-git-hooks' | 'size-limit' | 'solidjs-vite-plugin' | 'sst' | 'starlight' | 'stencil' | 'storybook' | 'stryker' | 'stylelint' | 'svelte' | 'sveltejs-package' | 'sveltekit' | 'svgo' | 'svgr' | 'swc' | 'syncpack' | 'tailwind' | 'tanstack-router' | 'taskfile' | 'tauri' | 'temporal' | 'textlint' | 'travis' | 'ts-node' | 'tsd' | 'tsdown' | 'tsrs' | 'tsup' | 'tsx' | 'turbo' | 'typedoc' | 'typescript' | 'typescript-content-mapper' | 'unbuild' | 'unocss' | 'unplugin-auto-import' | 'unplugin-icons' | 'unplugin-vue-components' | 'unplugin-vue-i18n' | 'unplugin-vue-markdown' | 'unplugin-vue-router' | 'varlock' | 'vercel' | 'vercel-og' | 'vike' | 'vite' | 'vite-plugin-pages' | 'vite-plugin-pwa' | 'vite-plugin-vue-layouts-next' | 'vite-plus' | 'vite-pwa-assets-generator' | 'vitepress' | 'vitest' | 'vue' | 'web-test-runner' | 'webdriver-io' | 'webpack' | 'wireit' | 'wrangler' | 'wxt' | 'xo' | 'yarn' | 'yorkie' | 'zx';
2
+ export declare const pluginNames: readonly ['angular', 'astro', 'astro-db', 'astro-markdoc', 'astro-og-canvas', 'ava', 'aws-cdk', 'babel', 'biome', 'borp', 'buf', 'bumpp', 'bun', 'c8', 'capacitor', 'catalyst', 'changelogen', 'changelogithub', 'changesets', 'commitizen', 'commitlint', 'convex', 'create-typescript-app', 'cspell', 'cucumber', 'cypress', 'danger', 'dependency-cruiser', 'docusaurus', 'dotenv', 'drizzle', 'electron-forge', 'electron-vite', 'eleventy', 'esbuild', 'eslint', 'evalite', 'eve', 'execa', 'expo', 'expo-router', 'expressive-code', 'fast', 'filesystem-routing', 'flue', 'fumadocs', 'gatsby', 'github-action', 'github-actions', 'glob', 'graphql-codegen', 'hardhat', 'husky', 'i18next-parser', 'jasmine', 'jest', 'karma', 'knex', 'kysely-codegen', 'ladle', 'laravel-vite-plugin', 'lefthook', 'lingui', 'lint-staged', 'linthtml', 'lit', 'lockfile-lint', 'lost-pixel', 'lunaria', 'markdownlint', 'marko', 'mastra', 'mcp', 'mdx', 'mdxlint', 'metro', 'mikro-orm', 'mise', 'mocha', 'moonrepo', 'msw', 'nano-spawn', 'nano-staged', 'nest', 'netlify', 'next', 'next-intl', 'next-mdx', 'nitro', 'node', 'node-modules-inspector', 'nodemon', 'npm-package-json-lint', 'nuxt', 'nuxtjs-i18n', 'nx', 'nyc', 'oclif', 'openapi-ts', 'openclaw', 'orval', 'osls', 'oxfmt', 'oxlint', 'panda-css', 'parcel', 'payload', 'pino', 'playwright', 'playwright-ct', 'playwright-test', 'plop', 'pm2', 'pnpm', 'postcss', 'pre-commit', 'preconstruct', 'prettier', 'prisma', 'purgecss', 'quasar', 'qwik', 'railway', 'raycast', 'react-cosmos', 'react-email', 'react-native', 'react-router', 'relay', 'release-it', 'remark', 'remix', 'retry-cli', 'rolldown', 'rollup', 'rsbuild', 'rslib', 'rspack', 'rstest', 'sanity', 'semantic-release', 'sentry', 'serverless-framework', 'simple-git-hooks', 'size-limit', 'solidjs-vite-plugin', 'sst', 'starlight', 'stencil', 'storybook', 'stryker', 'stylelint', 'svelte', 'sveltejs-package', 'sveltekit', 'svgo', 'svgr', 'swc', 'syncpack', 'tailwind', 'tanstack-router', 'taskfile', 'tauri', 'temporal', 'textlint', 'travis', 'ts-node', 'tsd', 'tsdown', 'tsrs', 'tsup', 'tsx', 'turbo', 'typedoc', 'typescript', 'typescript-content-mapper', 'unbuild', 'unocss', 'unplugin-auto-import', 'unplugin-icons', 'unplugin-vue-components', 'unplugin-vue-i18n', 'unplugin-vue-markdown', 'unplugin-vue-router', 'varlock', 'vercel', 'vercel-og', 'vike', 'vite', 'vite-plugin-pages', 'vite-plugin-pwa', 'vite-plugin-vue-layouts-next', 'vite-plus', 'vite-pwa-assets-generator', 'vitepress', 'vitest', 'vue', 'web-test-runner', 'webdriver-io', 'webpack', 'wireit', 'wrangler', 'wxt', 'xo', 'yarn', 'yorkie', 'zx'];
@@ -5,6 +5,7 @@ export const pluginNames = [
5
5
  'astro-markdoc',
6
6
  'astro-og-canvas',
7
7
  'ava',
8
+ 'aws-cdk',
8
9
  'babel',
9
10
  'biome',
10
11
  'borp',
@@ -34,6 +35,7 @@ export const pluginNames = [
34
35
  'eleventy',
35
36
  'esbuild',
36
37
  'eslint',
38
+ 'evalite',
37
39
  'eve',
38
40
  'execa',
39
41
  'expo',
@@ -73,6 +75,7 @@ export const pluginNames = [
73
75
  'mdx',
74
76
  'mdxlint',
75
77
  'metro',
78
+ 'mikro-orm',
76
79
  'mise',
77
80
  'mocha',
78
81
  'moonrepo',
@@ -128,6 +131,7 @@ export const pluginNames = [
128
131
  'release-it',
129
132
  'remark',
130
133
  'remix',
134
+ 'retry-cli',
131
135
  'rolldown',
132
136
  'rollup',
133
137
  'rsbuild',
@@ -192,6 +196,7 @@ export const pluginNames = [
192
196
  'vitepress',
193
197
  'vitest',
194
198
  'vue',
199
+ 'web-test-runner',
195
200
  'webdriver-io',
196
201
  'webpack',
197
202
  'wireit',
@@ -12,7 +12,9 @@ export type Args = {
12
12
  nodeImportArgs?: boolean;
13
13
  config?: ConfigArg;
14
14
  args?: (args: string[]) => string[];
15
- fromArgs?: string[] | ((parsed: ParsedArgs, args: string[]) => string[]);
15
+ fromArgs?: string[] | ((parsed: ParsedArgs, args: string[], options: {
16
+ cwd: string;
17
+ }) => string[]);
16
18
  resolveInputs?: (parsed: ParsedArgs, options: {
17
19
  cwd: string;
18
20
  args: string[];