knip 5.25.2 → 5.27.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 (93) hide show
  1. package/dist/CacheConsultant.d.ts +8 -2
  2. package/dist/CacheConsultant.js +9 -16
  3. package/dist/ConfigurationChief.d.ts +11 -4
  4. package/dist/ConfigurationChief.js +22 -21
  5. package/dist/ConfigurationValidator.d.ts +224 -0
  6. package/dist/ConfigurationValidator.js +4 -0
  7. package/dist/DependencyDeputy.d.ts +3 -2
  8. package/dist/DependencyDeputy.js +4 -4
  9. package/dist/PrincipalFactory.d.ts +4 -0
  10. package/dist/ProjectPrincipal.d.ts +5 -4
  11. package/dist/ProjectPrincipal.js +8 -6
  12. package/dist/WorkspaceWorker.d.ts +5 -3
  13. package/dist/WorkspaceWorker.js +2 -2
  14. package/dist/binaries/resolvers/bun.js +1 -1
  15. package/dist/cli.js +23 -12
  16. package/dist/compilers/index.d.ts +40 -0
  17. package/dist/index.js +55 -134
  18. package/dist/plugins/babel/index.js +2 -1
  19. package/dist/plugins/babel/types.d.ts +1 -0
  20. package/dist/plugins/cypress/helpers.d.ts +3 -0
  21. package/dist/plugins/cypress/helpers.js +23 -0
  22. package/dist/plugins/cypress/index.d.ts +3 -1
  23. package/dist/plugins/cypress/index.js +5 -0
  24. package/dist/plugins/cypress/types.d.ts +6 -0
  25. package/dist/plugins/cypress/types.js +1 -0
  26. package/dist/plugins/graphql-codegen/index.js +5 -3
  27. package/dist/plugins/husky/index.d.ts +1 -1
  28. package/dist/plugins/husky/index.js +9 -2
  29. package/dist/plugins/index.d.ts +4 -0
  30. package/dist/plugins/index.js +4 -0
  31. package/dist/plugins/ladle/index.d.ts +13 -0
  32. package/dist/plugins/ladle/index.js +36 -0
  33. package/dist/plugins/ladle/types.d.ts +4 -0
  34. package/dist/plugins/ladle/types.js +1 -0
  35. package/dist/plugins/react-cosmos/index.d.ts +12 -0
  36. package/dist/plugins/react-cosmos/index.js +33 -0
  37. package/dist/plugins/react-cosmos/types.d.ts +5 -0
  38. package/dist/plugins/react-cosmos/types.js +1 -0
  39. package/dist/plugins/rsbuild/index.d.ts +10 -0
  40. package/dist/plugins/rsbuild/index.js +15 -0
  41. package/dist/plugins/rsbuild/types.d.ts +3 -0
  42. package/dist/plugins/rsbuild/types.js +1 -0
  43. package/dist/plugins/rspack/index.d.ts +10 -0
  44. package/dist/plugins/rspack/index.js +22 -0
  45. package/dist/plugins/vitest/index.js +1 -1
  46. package/dist/types/cli.d.ts +16 -9
  47. package/dist/typescript/{createHosts.js → create-hosts.js} +1 -1
  48. package/dist/typescript/{resolveModuleNames.js → resolve-module-names.js} +35 -13
  49. package/dist/typescript/visitors/dynamic-imports/importCall.d.ts +1 -1
  50. package/dist/typescript/visitors/dynamic-imports/importCall.js +13 -15
  51. package/dist/typescript/visitors/dynamic-imports/importType.d.ts +1 -1
  52. package/dist/typescript/visitors/dynamic-imports/index.d.ts +1 -1
  53. package/dist/typescript/visitors/dynamic-imports/jsDocType.d.ts +1 -1
  54. package/dist/typescript/visitors/dynamic-imports/propertyAccessCall.d.ts +1 -1
  55. package/dist/typescript/visitors/dynamic-imports/requireCall.d.ts +1 -1
  56. package/dist/typescript/visitors/exports/exportAssignment.d.ts +1 -1
  57. package/dist/typescript/visitors/exports/exportDeclaration.d.ts +1 -1
  58. package/dist/typescript/visitors/exports/exportKeyword.d.ts +1 -1
  59. package/dist/typescript/visitors/exports/exportsAccessExpression.d.ts +1 -1
  60. package/dist/typescript/visitors/exports/index.d.ts +1 -1
  61. package/dist/typescript/visitors/exports/moduleExportsAccessExpression.d.ts +1 -1
  62. package/dist/typescript/visitors/imports/importDeclaration.d.ts +1 -1
  63. package/dist/typescript/visitors/imports/importEqualsDeclaration.d.ts +1 -1
  64. package/dist/typescript/visitors/imports/index.d.ts +1 -1
  65. package/dist/typescript/visitors/imports/reExportDeclaration.d.ts +1 -1
  66. package/dist/typescript/visitors/index.d.ts +1 -1
  67. package/dist/typescript/visitors/scripts/bun.d.ts +1 -1
  68. package/dist/typescript/visitors/scripts/execa.d.ts +1 -1
  69. package/dist/typescript/visitors/scripts/index.d.ts +1 -1
  70. package/dist/typescript/visitors/scripts/zx.d.ts +1 -1
  71. package/dist/util/create-workspace-graph.d.ts +8 -0
  72. package/dist/util/{pkgs-graph.js → create-workspace-graph.js} +3 -3
  73. package/dist/util/dependency-graph.d.ts +3 -4
  74. package/dist/util/dependency-graph.js +35 -3
  75. package/dist/util/get-included-issue-types.d.ts +6 -6
  76. package/dist/util/get-included-issue-types.js +5 -5
  77. package/dist/util/globby.js +2 -2
  78. package/dist/util/handle-dependency.d.ts +1 -1
  79. package/dist/util/handle-dependency.js +1 -1
  80. package/dist/util/reporter.d.ts +2 -2
  81. package/dist/util/reporter.js +12 -10
  82. package/dist/util/to-source-path.d.ts +2 -2
  83. package/dist/util/watch.d.ts +25 -0
  84. package/dist/util/watch.js +85 -0
  85. package/dist/version.d.ts +1 -1
  86. package/dist/version.js +1 -1
  87. package/package.json +1 -2
  88. package/schema.json +16 -0
  89. package/dist/util/pkgs-graph.d.ts +0 -8
  90. /package/dist/typescript/{createHosts.d.ts → create-hosts.d.ts} +0 -0
  91. /package/dist/typescript/{getImportsAndExports.d.ts → get-imports-and-exports.d.ts} +0 -0
  92. /package/dist/typescript/{getImportsAndExports.js → get-imports-and-exports.js} +0 -0
  93. /package/dist/typescript/{resolveModuleNames.d.ts → resolve-module-names.d.ts} +0 -0
@@ -82,6 +82,7 @@ const pluginsSchema = z.object({
82
82
  'graphql-codegen': pluginSchema,
83
83
  husky: pluginSchema,
84
84
  jest: pluginSchema,
85
+ ladle: pluginSchema,
85
86
  lefthook: pluginSchema,
86
87
  'lint-staged': pluginSchema,
87
88
  linthtml: pluginSchema,
@@ -102,10 +103,13 @@ const pluginsSchema = z.object({
102
103
  'playwright-ct': pluginSchema,
103
104
  postcss: pluginSchema,
104
105
  prettier: pluginSchema,
106
+ 'react-cosmos': pluginSchema,
105
107
  'release-it': pluginSchema,
106
108
  remark: pluginSchema,
107
109
  remix: pluginSchema,
108
110
  rollup: pluginSchema,
111
+ rsbuild: pluginSchema,
112
+ rspack: pluginSchema,
109
113
  'semantic-release': pluginSchema,
110
114
  sentry: pluginSchema,
111
115
  'simple-git-hooks': pluginSchema,
@@ -63,9 +63,10 @@ export declare class DependencyDeputy {
63
63
  };
64
64
  handleIgnoredDependencies(issues: Issues, counters: Counters, type: SymbolIssueType): void;
65
65
  handleIgnoredBinaries(issues: Issues, counters: Counters, type: SymbolIssueType): void;
66
- getConfigurationHints({ issues, counters }: {
66
+ removeIgnoredIssues({ issues, counters }: {
67
67
  issues: Issues;
68
68
  counters: Counters;
69
- }): ConfigurationHints;
69
+ }): void;
70
+ getConfigurationHints(): ConfigurationHints;
70
71
  }
71
72
  export {};
@@ -279,15 +279,15 @@ export class DependencyDeputy {
279
279
  }
280
280
  }
281
281
  }
282
- getConfigurationHints({ issues, counters }) {
283
- const configurationHints = new Set();
282
+ removeIgnoredIssues({ issues, counters }) {
284
283
  this.handleIgnoredDependencies(issues, counters, 'dependencies');
285
284
  this.handleIgnoredDependencies(issues, counters, 'devDependencies');
286
285
  this.handleIgnoredDependencies(issues, counters, 'optionalPeerDependencies');
287
286
  this.handleIgnoredDependencies(issues, counters, 'unlisted');
288
287
  this.handleIgnoredBinaries(issues, counters, 'binaries');
289
- if (this.isProduction)
290
- return configurationHints;
288
+ }
289
+ getConfigurationHints() {
290
+ const configurationHints = new Set();
291
291
  for (const [workspaceName, manifest] of this._manifests.entries()) {
292
292
  for (const identifier of manifest.ignoreDependencies) {
293
293
  if (!manifest.usedIgnoreDependencies.has(identifier)) {
@@ -1,6 +1,7 @@
1
1
  import ts from 'typescript';
2
2
  import { ProjectPrincipal } from './ProjectPrincipal.js';
3
3
  import type { AsyncCompilers, SyncCompilers } from './compilers/types.js';
4
+ import type { ToSourceFilePath } from './util/to-source-path.js';
4
5
  type Paths = ts.CompilerOptions['paths'];
5
6
  type Principal = {
6
7
  principal: ProjectPrincipal;
@@ -19,6 +20,9 @@ export type PrincipalOptions = {
19
20
  isIsolateWorkspaces: boolean;
20
21
  isSkipLibs: boolean;
21
22
  isWatch: boolean;
23
+ toSourceFilePath: ToSourceFilePath;
24
+ isCache: boolean;
25
+ cacheLocation: string;
22
26
  };
23
27
  export declare class PrincipalFactory {
24
28
  principals: Principals;
@@ -5,8 +5,8 @@ import type { ReferencedDependencies } from './WorkspaceWorker.js';
5
5
  import type { AsyncCompilers, SyncCompilers } from './compilers/types.js';
6
6
  import type { DependencyGraph, Export, ExportMember, FileNode } from './types/dependency-graph.js';
7
7
  import type { SourceFileManager } from './typescript/SourceFileManager.js';
8
- import { type GetImportsAndExportsOptions } from './typescript/getImportsAndExports.js';
9
- import type { ResolveModuleNames } from './typescript/resolveModuleNames.js';
8
+ import { type GetImportsAndExportsOptions } from './typescript/get-imports-and-exports.js';
9
+ import type { ResolveModuleNames } from './typescript/resolve-module-names.js';
10
10
  import type { ToSourceFilePath } from './util/to-source-path.js';
11
11
  export declare class ProjectPrincipal {
12
12
  entryPaths: Set<string>;
@@ -22,6 +22,7 @@ export declare class ProjectPrincipal {
22
22
  isSkipLibs: boolean;
23
23
  isWatch: boolean;
24
24
  cache: CacheConsultant<FileNode>;
25
+ toSourceFilePath: ToSourceFilePath;
25
26
  backend: {
26
27
  fileManager: SourceFileManager;
27
28
  compilerHost: ts.CompilerHost;
@@ -31,8 +32,8 @@ export declare class ProjectPrincipal {
31
32
  languageServiceHost: ts.LanguageServiceHost;
32
33
  };
33
34
  findReferences?: ts.LanguageService['findReferences'];
34
- constructor({ compilerOptions, cwd, compilers, isSkipLibs, isWatch, pkgName }: PrincipalOptions);
35
- init(toSourceFilePath: ToSourceFilePath): void;
35
+ constructor({ compilerOptions, cwd, compilers, isSkipLibs, isWatch, pkgName, toSourceFilePath, isCache, cacheLocation, }: PrincipalOptions);
36
+ init(): void;
36
37
  addPaths(paths: ts.CompilerOptions['paths']): void;
37
38
  addCompilers(compilers: [SyncCompilers, AsyncCompilers]): void;
38
39
  private createProgram;
@@ -2,8 +2,8 @@ import ts from 'typescript';
2
2
  import { CacheConsultant } from './CacheConsultant.js';
3
3
  import { getCompilerExtensions } from './compilers/index.js';
4
4
  import { ANONYMOUS, DEFAULT_EXTENSIONS, FOREIGN_FILE_EXTENSIONS, PUBLIC_TAG } from './constants.js';
5
- import { createHosts } from './typescript/createHosts.js';
6
- import { _getImportsAndExports } from './typescript/getImportsAndExports.js';
5
+ import { createHosts } from './typescript/create-hosts.js';
6
+ import { _getImportsAndExports } from './typescript/get-imports-and-exports.js';
7
7
  import { timerify } from './util/Performance.js';
8
8
  import { compact } from './util/array.js';
9
9
  import { getPackageNameFromModuleSpecifier, isStartsLikePackageName, sanitizeSpecifier } from './util/modules.js';
@@ -40,9 +40,10 @@ export class ProjectPrincipal {
40
40
  isSkipLibs;
41
41
  isWatch;
42
42
  cache;
43
+ toSourceFilePath;
43
44
  backend;
44
45
  findReferences;
45
- constructor({ compilerOptions, cwd, compilers, isSkipLibs, isWatch, pkgName }) {
46
+ constructor({ compilerOptions, cwd, compilers, isSkipLibs, isWatch, pkgName, toSourceFilePath, isCache, cacheLocation, }) {
46
47
  this.cwd = cwd;
47
48
  this.compilerOptions = {
48
49
  ...compilerOptions,
@@ -56,16 +57,17 @@ export class ProjectPrincipal {
56
57
  this.asyncCompilers = asyncCompilers;
57
58
  this.isSkipLibs = isSkipLibs;
58
59
  this.isWatch = isWatch;
59
- this.cache = new CacheConsultant(pkgName || ANONYMOUS);
60
+ this.cache = new CacheConsultant({ name: pkgName || ANONYMOUS, isEnabled: isCache, cacheLocation });
61
+ this.toSourceFilePath = toSourceFilePath;
60
62
  }
61
- init(toSourceFilePath) {
63
+ init() {
62
64
  const { fileManager, compilerHost, resolveModuleNames, languageServiceHost } = createHosts({
63
65
  cwd: this.cwd,
64
66
  compilerOptions: this.compilerOptions,
65
67
  entryPaths: this.entryPaths,
66
68
  compilers: [this.syncCompilers, this.asyncCompilers],
67
69
  isSkipLibs: this.isSkipLibs,
68
- toSourceFilePath,
70
+ toSourceFilePath: this.toSourceFilePath,
69
71
  useResolverCache: !this.isWatch,
70
72
  });
71
73
  this.backend = {
@@ -14,6 +14,8 @@ type WorkspaceManagerOptions = {
14
14
  enabledPluginsInAncestors: string[];
15
15
  isProduction: boolean;
16
16
  isStrict: boolean;
17
+ isCache: boolean;
18
+ cacheLocation: string;
17
19
  };
18
20
  export type ReferencedDependencies = Set<[string, string]>;
19
21
  type CacheItem = {
@@ -32,11 +34,11 @@ export declare class WorkspaceWorker {
32
34
  isStrict: boolean;
33
35
  rootIgnore: Configuration['ignore'];
34
36
  negatedWorkspacePatterns: string[];
35
- enabledPluginsMap: Record<"astro" | "angular" | "ava" | "babel" | "capacitor" | "changesets" | "commitizen" | "commitlint" | "cspell" | "cucumber" | "cypress" | "eleventy" | "eslint" | "gatsby" | "husky" | "jest" | "lefthook" | "linthtml" | "markdownlint" | "mocha" | "moonrepo" | "msw" | "netlify" | "next" | "nx" | "nyc" | "oclif" | "playwright" | "postcss" | "prettier" | "remark" | "remix" | "rollup" | "sentry" | "storybook" | "stryker" | "stylelint" | "svelte" | "syncpack" | "tailwind" | "tsup" | "typedoc" | "typescript" | "unbuild" | "unocss" | "vue" | "vite" | "vitest" | "webpack" | "wireit" | "wrangler" | "xo" | "yorkie" | "drizzle" | "githubActions" | "graphqlCodegen" | "lintStaged" | "lockfileLint" | "lostPixel" | "nodeTestRunner" | "npmPackageJsonLint" | "playwrightCt" | "releaseIt" | "semanticRelease" | "simpleGitHooks" | "sizeLimit" | "vercelOg" | "webdriverIo", boolean>;
37
+ enabledPluginsMap: Record<"angular" | "astro" | "ava" | "babel" | "capacitor" | "changesets" | "commitizen" | "commitlint" | "cspell" | "cucumber" | "cypress" | "drizzle" | "eleventy" | "eslint" | "gatsby" | "githubActions" | "graphqlCodegen" | "husky" | "jest" | "ladle" | "lefthook" | "linthtml" | "lintStaged" | "lockfileLint" | "lostPixel" | "markdownlint" | "mocha" | "moonrepo" | "msw" | "netlify" | "next" | "nodeTestRunner" | "npmPackageJsonLint" | "nx" | "nyc" | "oclif" | "playwright" | "playwrightCt" | "postcss" | "prettier" | "reactCosmos" | "releaseIt" | "remark" | "remix" | "rollup" | "rsbuild" | "rspack" | "semanticRelease" | "sentry" | "simpleGitHooks" | "sizeLimit" | "storybook" | "stryker" | "stylelint" | "svelte" | "syncpack" | "tailwind" | "tsup" | "typedoc" | "typescript" | "unbuild" | "unocss" | "vercelOg" | "vite" | "vitest" | "vue" | "webdriverIo" | "webpack" | "wireit" | "wrangler" | "xo" | "yorkie", boolean>;
36
38
  enabledPlugins: PluginName[];
37
39
  enabledPluginsInAncestors: string[];
38
40
  cache: CacheConsultant<CacheItem>;
39
- constructor({ name, dir, cwd, config, manifest, dependencies, isProduction, isStrict, rootIgnore, negatedWorkspacePatterns, enabledPluginsInAncestors, }: WorkspaceManagerOptions);
41
+ constructor({ name, dir, cwd, config, manifest, dependencies, isProduction, isStrict, rootIgnore, negatedWorkspacePatterns, enabledPluginsInAncestors, isCache, cacheLocation, }: WorkspaceManagerOptions);
40
42
  init(): Promise<void>;
41
43
  private determineEnabledPlugins;
42
44
  private getConfigForPlugin;
@@ -52,7 +54,7 @@ export declare class WorkspaceWorker {
52
54
  entryFilePatterns: Set<string>;
53
55
  productionEntryFilePatterns: Set<string>;
54
56
  referencedDependencies: ReferencedDependencies;
55
- enabledPlugins: ("astro" | "angular" | "ava" | "babel" | "capacitor" | "changesets" | "commitizen" | "commitlint" | "cspell" | "cucumber" | "cypress" | "eleventy" | "eslint" | "gatsby" | "husky" | "jest" | "lefthook" | "linthtml" | "markdownlint" | "mocha" | "moonrepo" | "msw" | "netlify" | "next" | "nx" | "nyc" | "oclif" | "playwright" | "postcss" | "prettier" | "remark" | "remix" | "rollup" | "sentry" | "storybook" | "stryker" | "stylelint" | "svelte" | "syncpack" | "tailwind" | "tsup" | "typedoc" | "typescript" | "unbuild" | "unocss" | "vue" | "vite" | "vitest" | "webpack" | "wireit" | "wrangler" | "xo" | "yorkie" | "drizzle" | "githubActions" | "graphqlCodegen" | "lintStaged" | "lockfileLint" | "lostPixel" | "nodeTestRunner" | "npmPackageJsonLint" | "playwrightCt" | "releaseIt" | "semanticRelease" | "simpleGitHooks" | "sizeLimit" | "vercelOg" | "webdriverIo")[];
57
+ enabledPlugins: ("angular" | "astro" | "ava" | "babel" | "capacitor" | "changesets" | "commitizen" | "commitlint" | "cspell" | "cucumber" | "cypress" | "drizzle" | "eleventy" | "eslint" | "gatsby" | "githubActions" | "graphqlCodegen" | "husky" | "jest" | "ladle" | "lefthook" | "linthtml" | "lintStaged" | "lockfileLint" | "lostPixel" | "markdownlint" | "mocha" | "moonrepo" | "msw" | "netlify" | "next" | "nodeTestRunner" | "npmPackageJsonLint" | "nx" | "nyc" | "oclif" | "playwright" | "playwrightCt" | "postcss" | "prettier" | "reactCosmos" | "releaseIt" | "remark" | "remix" | "rollup" | "rsbuild" | "rspack" | "semanticRelease" | "sentry" | "simpleGitHooks" | "sizeLimit" | "storybook" | "stryker" | "stylelint" | "svelte" | "syncpack" | "tailwind" | "tsup" | "typedoc" | "typescript" | "unbuild" | "unocss" | "vercelOg" | "vite" | "vitest" | "vue" | "webdriverIo" | "webpack" | "wireit" | "wrangler" | "xo" | "yorkie")[];
56
58
  }>;
57
59
  onDispose(): void;
58
60
  }
@@ -24,7 +24,7 @@ export class WorkspaceWorker {
24
24
  enabledPlugins = [];
25
25
  enabledPluginsInAncestors;
26
26
  cache;
27
- constructor({ name, dir, cwd, config, manifest, dependencies, isProduction, isStrict, rootIgnore, negatedWorkspacePatterns, enabledPluginsInAncestors, }) {
27
+ constructor({ name, dir, cwd, config, manifest, dependencies, isProduction, isStrict, rootIgnore, negatedWorkspacePatterns, enabledPluginsInAncestors, isCache, cacheLocation, }) {
28
28
  this.name = name;
29
29
  this.dir = dir;
30
30
  this.cwd = cwd;
@@ -37,7 +37,7 @@ export class WorkspaceWorker {
37
37
  this.rootIgnore = rootIgnore;
38
38
  this.negatedWorkspacePatterns = negatedWorkspacePatterns;
39
39
  this.enabledPluginsInAncestors = enabledPluginsInAncestors;
40
- this.cache = new CacheConsultant(`plugins-${name}`);
40
+ this.cache = new CacheConsultant({ name: `plugins-${name}`, isEnabled: isCache, cacheLocation });
41
41
  }
42
42
  async init() {
43
43
  this.enabledPlugins = await this.determineEnabledPlugins();
@@ -1,6 +1,6 @@
1
1
  import parseArgs from 'minimist';
2
2
  import { tryResolveFilePath } from '../util.js';
3
- const commands = ['add', 'create', 'init', 'install', 'link', 'pm', 'remove', 'run', 'test', 'update'];
3
+ const commands = ['add', 'create', 'init', 'install', 'link', 'pm', 'remove', 'run', 'test', 'update', 'upgrade'];
4
4
  export const resolve = (_binary, args, { manifestScriptNames, cwd, fromArgs }) => {
5
5
  const parsed = parseArgs(args);
6
6
  const [command, script] = parsed._;
package/dist/cli.js CHANGED
@@ -4,12 +4,13 @@ import { main } from './index.js';
4
4
  import { perfObserver } from './util/Performance.js';
5
5
  import parsedArgValues, { helpText } from './util/cli-arguments.js';
6
6
  import { getKnownError, hasCause, isConfigurationError, isKnownError } from './util/errors.js';
7
- import { cwd } from './util/path.js';
7
+ import { cwd, join, toPosix } from './util/path.js';
8
8
  import { runPreprocessors, runReporters } from './util/reporter.js';
9
9
  import { splitTags } from './util/tag.js';
10
10
  import { isTrace } from './util/trace.js';
11
11
  import { version } from './version.js';
12
- const { debug: isDebug = false, help: isHelp, 'max-issues': maxIssues = '0', 'no-config-hints': noConfigHints = false, 'no-exit-code': noExitCode = false, 'no-gitignore': isNoGitIgnore = false, 'no-progress': isNoProgress = isDebug || isTrace, 'include-entry-exports': isIncludeEntryExports = false, 'include-libs': isIncludeLibs = false, 'isolate-workspaces': isIsolateWorkspaces = false, production: isProduction = false, 'reporter-options': reporterOptions = '', 'preprocessor-options': preprocessorOptions = '', strict: isStrict = false, fix: isFix = false, 'fix-type': fixTypes = [], 'allow-remove-files': isRemoveFiles = false, tsConfig, version: isVersion, 'experimental-tags': experimentalTags = [], tags = [], watch: isWatch = false, } = parsedArgValues;
12
+ const defaultCacheLocation = join(cwd, 'node_modules', '.cache', 'knip');
13
+ const { 'allow-remove-files': isRemoveFiles = false, cache: isCache = false, 'cache-location': cacheLocation = defaultCacheLocation, debug: isDebug = false, dependencies: isDependenciesShorthand = false, exclude: excludedIssueTypes = [], 'experimental-tags': experimentalTags = [], exports: isExportsShorthand = false, files: isFilesShorthand = false, fix: isFix = false, 'fix-type': fixTypes = [], help: isHelp, include: includedIssueTypes = [], 'include-entry-exports': isIncludeEntryExports = false, 'include-libs': isIncludeLibs = false, 'isolate-workspaces': isIsolateWorkspaces = false, 'max-issues': maxIssues = '0', 'no-config-hints': isHideConfigHints = false, 'no-exit-code': noExitCode = false, 'no-gitignore': isNoGitIgnore = false, 'no-progress': isNoProgress = isDebug || isTrace, preprocessor = [], 'preprocessor-options': preprocessorOptions = '', production: isProduction = false, reporter = ['symbols'], 'reporter-options': reporterOptions = '', strict: isStrict = false, tags = [], tsConfig, version: isVersion, watch: isWatch = false, workspace: rawWorkspaceArg, } = parsedArgValues;
13
14
  if (isHelp) {
14
15
  console.log(helpText);
15
16
  process.exit(0);
@@ -19,24 +20,34 @@ if (isVersion) {
19
20
  process.exit(0);
20
21
  }
21
22
  const isShowProgress = isNoProgress === false && process.stdout.isTTY && typeof process.stdout.cursorTo === 'function';
23
+ const workspace = rawWorkspaceArg ? toPosix(rawWorkspaceArg).replace(/^\.\//, '').replace(/\/$/, '') : undefined;
22
24
  const run = async () => {
23
25
  try {
24
26
  const { report, issues, counters, rules, tagHints, configurationHints } = await main({
27
+ cacheLocation,
25
28
  cwd,
26
- tsConfigFile: tsConfig,
29
+ excludedIssueTypes,
30
+ fixTypes: fixTypes.flatMap(type => type.split(',')),
27
31
  gitignore: !isNoGitIgnore,
32
+ includedIssueTypes,
33
+ isCache,
28
34
  isDebug,
29
- isProduction: isStrict || isProduction,
30
- isStrict,
31
- isShowProgress,
35
+ isDependenciesShorthand,
36
+ isExportsShorthand,
37
+ isFilesShorthand,
38
+ isFix: isFix || fixTypes.length > 0,
39
+ isHideConfigHints,
32
40
  isIncludeEntryExports,
33
41
  isIncludeLibs,
34
42
  isIsolateWorkspaces,
43
+ isProduction: isStrict || isProduction,
44
+ isRemoveFiles,
45
+ isShowProgress,
46
+ isStrict,
35
47
  isWatch,
36
48
  tags: tags.length > 0 ? splitTags(tags) : splitTags(experimentalTags),
37
- isFix: isFix || fixTypes.length > 0,
38
- fixTypes: fixTypes.flatMap(type => type.split(',')),
39
- isRemoveFiles,
49
+ tsConfigFile: tsConfig,
50
+ workspace,
40
51
  });
41
52
  if (isWatch || isTrace)
42
53
  return;
@@ -46,15 +57,15 @@ const run = async () => {
46
57
  counters,
47
58
  tagHints,
48
59
  configurationHints,
49
- noConfigHints,
60
+ noConfigHints: isHideConfigHints,
50
61
  cwd,
51
62
  isProduction,
52
63
  isShowProgress,
53
64
  options: reporterOptions,
54
65
  preprocessorOptions,
55
66
  };
56
- const finalData = await runPreprocessors(initialData);
57
- await runReporters(finalData);
67
+ const finalData = await runPreprocessors(preprocessor, initialData);
68
+ await runReporters(reporter, finalData);
58
69
  const totalErrorCount = Object.keys(finalData.report)
59
70
  .filter(reportGroup => finalData.report[reportGroup] && rules[reportGroup] === 'error')
60
71
  .reduce((errorCount, reportGroup) => errorCount + finalData.counters[reportGroup], 0);
@@ -108,6 +108,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
108
108
  entry?: string | string[] | undefined;
109
109
  project?: string | string[] | undefined;
110
110
  } | undefined;
111
+ ladle?: string | boolean | string[] | {
112
+ config?: string | string[] | undefined;
113
+ entry?: string | string[] | undefined;
114
+ project?: string | string[] | undefined;
115
+ } | undefined;
111
116
  lefthook?: string | boolean | string[] | {
112
117
  config?: string | string[] | undefined;
113
118
  entry?: string | string[] | undefined;
@@ -208,6 +213,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
208
213
  entry?: string | string[] | undefined;
209
214
  project?: string | string[] | undefined;
210
215
  } | undefined;
216
+ 'react-cosmos'?: string | boolean | string[] | {
217
+ config?: string | string[] | undefined;
218
+ entry?: string | string[] | undefined;
219
+ project?: string | string[] | undefined;
220
+ } | undefined;
211
221
  'release-it'?: string | boolean | string[] | {
212
222
  config?: string | string[] | undefined;
213
223
  entry?: string | string[] | undefined;
@@ -228,6 +238,16 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
228
238
  entry?: string | string[] | undefined;
229
239
  project?: string | string[] | undefined;
230
240
  } | undefined;
241
+ rsbuild?: string | boolean | string[] | {
242
+ config?: string | string[] | undefined;
243
+ entry?: string | string[] | undefined;
244
+ project?: string | string[] | undefined;
245
+ } | undefined;
246
+ rspack?: string | boolean | string[] | {
247
+ config?: string | string[] | undefined;
248
+ entry?: string | string[] | undefined;
249
+ project?: string | string[] | undefined;
250
+ } | undefined;
231
251
  'semantic-release'?: string | boolean | string[] | {
232
252
  config?: string | string[] | undefined;
233
253
  entry?: string | string[] | undefined;
@@ -452,6 +472,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
452
472
  entry?: string | string[] | undefined;
453
473
  project?: string | string[] | undefined;
454
474
  } | undefined;
475
+ ladle?: string | boolean | string[] | {
476
+ config?: string | string[] | undefined;
477
+ entry?: string | string[] | undefined;
478
+ project?: string | string[] | undefined;
479
+ } | undefined;
455
480
  lefthook?: string | boolean | string[] | {
456
481
  config?: string | string[] | undefined;
457
482
  entry?: string | string[] | undefined;
@@ -552,6 +577,11 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
552
577
  entry?: string | string[] | undefined;
553
578
  project?: string | string[] | undefined;
554
579
  } | undefined;
580
+ 'react-cosmos'?: string | boolean | string[] | {
581
+ config?: string | string[] | undefined;
582
+ entry?: string | string[] | undefined;
583
+ project?: string | string[] | undefined;
584
+ } | undefined;
555
585
  'release-it'?: string | boolean | string[] | {
556
586
  config?: string | string[] | undefined;
557
587
  entry?: string | string[] | undefined;
@@ -572,6 +602,16 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
572
602
  entry?: string | string[] | undefined;
573
603
  project?: string | string[] | undefined;
574
604
  } | undefined;
605
+ rsbuild?: string | boolean | string[] | {
606
+ config?: string | string[] | undefined;
607
+ entry?: string | string[] | undefined;
608
+ project?: string | string[] | undefined;
609
+ } | undefined;
610
+ rspack?: string | boolean | string[] | {
611
+ config?: string | string[] | undefined;
612
+ entry?: string | string[] | undefined;
613
+ project?: string | string[] | undefined;
614
+ } | undefined;
575
615
  'semantic-release'?: string | boolean | string[] | {
576
616
  config?: string | string[] | undefined;
577
617
  entry?: string | string[] | undefined;