knip 5.64.1 → 5.64.2

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.
@@ -1,5 +1,5 @@
1
1
  import type { Configuration, IgnorePatterns, RawConfiguration, WorkspaceConfiguration } from './types/config.js';
2
- import type { ConfigurationHints } from './types/issues.js';
2
+ import type { ConfigurationHint } from './types/issues.js';
3
3
  import type { WorkspacePackage } from './types/package-json.js';
4
4
  import type { MainOptions } from './util/create-options.js';
5
5
  import { type WorkspaceGraph } from './util/create-workspace-graph.js';
@@ -36,7 +36,7 @@ export declare class ConfigurationChief {
36
36
  workspaceGraph: WorkspaceGraph;
37
37
  includedWorkspaces: Workspace[];
38
38
  constructor(options: MainOptions);
39
- getConfigurationHints(): ConfigurationHints;
39
+ getConfigurationHints(): Set<ConfigurationHint>;
40
40
  private normalize;
41
41
  getWorkspaces(): Promise<Workspace[]>;
42
42
  private getListedWorkspaces;
@@ -1,5 +1,5 @@
1
1
  import type { Workspace } from './ConfigurationChief.js';
2
- import type { ConfigurationHints, Counters, Issue, Issues, SymbolIssueType } from './types/issues.js';
2
+ import type { ConfigurationHint, Counters, Issue, Issues, SymbolIssueType } from './types/issues.js';
3
3
  import type { PackageJson } from './types/package-json.js';
4
4
  import type { DependencyArray, DependencySet, HostDependencies, InstalledBinaries, WorkspaceManifests } from './types/workspace.js';
5
5
  import type { MainOptions } from './util/create-options.js';
@@ -70,7 +70,7 @@ export declare class DependencyDeputy {
70
70
  issues: Issues;
71
71
  counters: Counters;
72
72
  }): void;
73
- getConfigurationHints(): ConfigurationHints;
73
+ getConfigurationHints(): Set<ConfigurationHint>;
74
74
  addIgnoredDependencies(workspaceName: string, identifier: string): void;
75
75
  addIgnoredBinaries(workspaceName: string, identifier: string): void;
76
76
  }
@@ -2,7 +2,6 @@ import picomatch from 'picomatch';
2
2
  import { initCounters, initIssues } from './util/issue-initializers.js';
3
3
  import { timerify } from './util/Performance.js';
4
4
  import { join, relative } from './util/path.js';
5
- const hasConfigurationHint = (hints, hint) => Array.from(hints).some(item => item.identifier === hint.identifier && item.type === hint.type && item.workspaceName === hint.workspaceName);
6
5
  const isMatch = timerify(picomatch.isMatch, 'isMatch');
7
6
  export class IssueCollector {
8
7
  cwd;
@@ -11,7 +10,7 @@ export class IssueCollector {
11
10
  issues = initIssues();
12
11
  counters = initCounters();
13
12
  referencedFiles = new Set();
14
- configurationHints = new Set();
13
+ configurationHints = new Map();
15
14
  tagHints = new Set();
16
15
  ignorePatterns = new Set();
17
16
  isMatch;
@@ -64,9 +63,9 @@ export class IssueCollector {
64
63
  return issue;
65
64
  }
66
65
  addConfigurationHint(issue) {
67
- if (!hasConfigurationHint(this.configurationHints, issue)) {
68
- this.configurationHints.add(issue);
69
- }
66
+ const key = `${issue.workspaceName}::${issue.type}::${issue.identifier}`;
67
+ if (!this.configurationHints.has(key))
68
+ this.configurationHints.set(key, issue);
70
69
  }
71
70
  addTagHint(issue) {
72
71
  this.tagHints.add(issue);
@@ -82,7 +81,7 @@ export class IssueCollector {
82
81
  issues: this.issues,
83
82
  counters: this.counters,
84
83
  tagHints: this.tagHints,
85
- configurationHints: this.configurationHints,
84
+ configurationHints: new Set(this.configurationHints.values()),
86
85
  };
87
86
  }
88
87
  }
@@ -1,7 +1,7 @@
1
1
  import { CacheConsultant } from './CacheConsultant.js';
2
2
  import { type Workspace } from './ConfigurationChief.js';
3
3
  import type { Configuration, GetReferencedInternalFilePath, GetSourceFile, WorkspaceConfiguration } from './types/config.js';
4
- import type { ConfigurationHints } from './types/issues.js';
4
+ import type { ConfigurationHint } from './types/issues.js';
5
5
  import type { PluginName } from './types/PluginNames.js';
6
6
  import type { PackageJson } from './types/package-json.js';
7
7
  import type { DependencySet } from './types/workspace.js';
@@ -60,7 +60,7 @@ export declare class WorkspaceWorker {
60
60
  private getConfigurationFilePatterns;
61
61
  getIgnorePatterns(): string[];
62
62
  runPlugins(): Promise<Input[]>;
63
- getConfigurationHints(type: 'entry' | 'project', patterns: string[], filePaths: string[], includedPaths: Set<string>): ConfigurationHints;
63
+ getConfigurationHints(type: 'entry' | 'project', patterns: string[], filePaths: string[], includedPaths: Set<string>): Set<ConfigurationHint>;
64
64
  onDispose(): void;
65
65
  }
66
66
  export {};
package/dist/cli.js CHANGED
@@ -72,7 +72,7 @@ const run = async () => {
72
72
  logWarning('WARNING', 'Class members are not tracked when using the --isolate-workspaces flag');
73
73
  }
74
74
  if ((!parsedCLIArgs['no-exit-code'] && totalErrorCount > Number(parsedCLIArgs['max-issues'] ?? 0)) ||
75
- (options.isTreatConfigHintsAsErrors && configurationHints.size > 0)) {
75
+ (!options.isDisableConfigHints && options.isTreatConfigHintsAsErrors && configurationHints.size > 0)) {
76
76
  process.exit(1);
77
77
  }
78
78
  }
@@ -1,8 +1,9 @@
1
1
  import { hasDependency } from '../../util/plugin.js';
2
+ import { toC12config } from '../../util/plugin-config.js';
2
3
  const title = 'bumpp';
3
4
  const enablers = ['bumpp'];
4
5
  const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
5
- const entry = ['bump.config.{mjs,ts,js,cjs,mts,cts}'];
6
+ const entry = ['package.json', ...toC12config('bump')];
6
7
  export default {
7
8
  title,
8
9
  enablers,
@@ -8,7 +8,8 @@ export const getInputs = (config, options) => {
8
8
  if (extname(configFileName) === '.json' || !/eslint\.config/.test(configFileName)) {
9
9
  return getInputsDeprecated(config, options);
10
10
  }
11
- const dependencies = config.flatMap(config => config.settings ? getDependenciesFromSettings(config.settings) : []);
11
+ const configArray = Array.isArray(config) ? config : [config];
12
+ const dependencies = configArray.flatMap(config => config.settings ? getDependenciesFromSettings(config.settings) : []);
12
13
  dependencies.push('eslint-import-resolver-typescript');
13
14
  return compact(dependencies).map(id => toDeferResolve(id, { optional: true }));
14
15
  };
@@ -857,6 +857,7 @@ export declare const Plugins: {
857
857
  resolveConfig: import("../types/config.js").ResolveConfig<import("./vitest/types.js").ViteConfigOrFn | import("./vitest/types.js").VitestWorkspaceConfig>;
858
858
  args: {
859
859
  config: boolean;
860
+ resolveInputs: (parsed: import("minimist").ParsedArgs) => import("../util/input.js").Input[];
860
861
  };
861
862
  };
862
863
  vue: {
@@ -11,7 +11,8 @@ const productionEntryFilePatterns = [
11
11
  'app/global-error.{js,jsx,ts,tsx}',
12
12
  'app/**/{error,layout,loading,not-found,page,template,default}.{js,jsx,ts,tsx}',
13
13
  'app/**/route.{js,jsx,ts,tsx}',
14
- 'app/{manifest,sitemap,robots}.{js,ts}',
14
+ 'app/{manifest,robots}.{js,ts}',
15
+ 'app/**/sitemap.{js,ts}',
15
16
  'app/**/{icon,apple-icon}.{js,jsx,ts,tsx}',
16
17
  'app/**/{opengraph,twitter}-image.{js,jsx,ts,tsx}',
17
18
  'mdx-components.{js,jsx,ts,tsx}',
@@ -1,4 +1,6 @@
1
+ import type { ParsedArgs } from 'minimist';
1
2
  import type { IsPluginEnabled, ResolveConfig } from '../../types/config.js';
3
+ import { type Input } from '../../util/input.js';
2
4
  import type { ViteConfigOrFn, VitestWorkspaceConfig } from './types.js';
3
5
  export declare const resolveConfig: ResolveConfig<ViteConfigOrFn | VitestWorkspaceConfig>;
4
6
  declare const _default: {
@@ -10,6 +12,7 @@ declare const _default: {
10
12
  resolveConfig: ResolveConfig<ViteConfigOrFn | VitestWorkspaceConfig>;
11
13
  args: {
12
14
  config: boolean;
15
+ resolveInputs: (parsed: ParsedArgs) => Input[];
13
16
  };
14
17
  };
15
18
  export default _default;
@@ -154,6 +154,12 @@ export const resolveConfig = async (localConfig, options) => {
154
154
  };
155
155
  const args = {
156
156
  config: true,
157
+ resolveInputs: (parsed) => {
158
+ const inputs = [];
159
+ if (parsed['ui'])
160
+ inputs.push(toDependency('@vitest/ui', { optional: true }));
161
+ return inputs;
162
+ },
157
163
  };
158
164
  export default {
159
165
  title,
@@ -59,7 +59,7 @@ export type ReporterOptions = {
59
59
  issues: Issues;
60
60
  counters: Counters;
61
61
  tagHints: TagHints;
62
- configurationHints: ConfigurationHints;
62
+ configurationHints: Set<ConfigurationHint>;
63
63
  isDisableConfigHints: boolean;
64
64
  isTreatConfigHintsAsErrors: boolean;
65
65
  cwd: string;
@@ -74,7 +74,7 @@ export type Reporter = (options: ReporterOptions) => void;
74
74
  export type Preprocessor = (options: ReporterOptions) => ReporterOptions;
75
75
  export type IssueSeverity = 'error' | 'warn' | 'off';
76
76
  export type Rules = Record<IssueType, IssueSeverity>;
77
- export type ConfigurationHints = Set<ConfigurationHint>;
77
+ export type ConfigurationHints = Map<string, ConfigurationHint>;
78
78
  export type ConfigurationHintType = 'ignoreBinaries' | 'ignoreDependencies' | 'ignoreUnresolved' | 'ignoreWorkspaces' | 'entry-redundant' | 'project-redundant' | 'entry-top-level' | 'project-top-level' | 'entry-empty' | 'project-empty' | 'package-entry' | 'workspace-unconfigured';
79
79
  export type ConfigurationHint = {
80
80
  type: ConfigurationHintType;
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "5.64.1";
1
+ export declare const version = "5.64.2";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const version = '5.64.1';
1
+ export const version = '5.64.2';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "knip",
3
- "version": "5.64.1",
3
+ "version": "5.64.2",
4
4
  "description": "Find and fix unused dependencies, exports and files in your TypeScript and JavaScript projects",
5
5
  "homepage": "https://knip.dev",
6
6
  "repository": {