knip 4.3.0 → 4.3.1

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.
@@ -13,8 +13,8 @@ export declare class IssueFixer {
13
13
  cwd: string;
14
14
  fixTypes: string[];
15
15
  });
16
- addUnusedTypeNode(filePath: string, fix: Fixes): void;
17
- addUnusedExportNode(filePath: string, fix: Fixes): void;
16
+ addUnusedTypeNode(filePath: string, fixes: Fixes | undefined): void;
17
+ addUnusedExportNode(filePath: string, fixes: Fixes | undefined): void;
18
18
  fixIssues(issues: Issues): Promise<void>;
19
19
  private removeUnusedExportKeywords;
20
20
  private removeUnusedDependencies;
@@ -16,21 +16,21 @@ export class IssueFixer {
16
16
  this.isFixUnusedTypes = fixTypes.length === 0 || fixTypes.includes('types');
17
17
  this.isFixUnusedExports = fixTypes.length === 0 || fixTypes.includes('exports');
18
18
  }
19
- addUnusedTypeNode(filePath, fix) {
20
- if (fix.length === 0)
19
+ addUnusedTypeNode(filePath, fixes) {
20
+ if (!fixes || fixes.length === 0)
21
21
  return;
22
22
  if (this.unusedTypeNodes.has(filePath))
23
- fix.forEach(fix => this.unusedTypeNodes.get(filePath).add(fix));
23
+ fixes.forEach(fix => this.unusedTypeNodes.get(filePath).add(fix));
24
24
  else
25
- this.unusedTypeNodes.set(filePath, new Set(fix));
25
+ this.unusedTypeNodes.set(filePath, new Set(fixes));
26
26
  }
27
- addUnusedExportNode(filePath, fix) {
28
- if (fix.length === 0)
27
+ addUnusedExportNode(filePath, fixes) {
28
+ if (!fixes || fixes.length === 0)
29
29
  return;
30
30
  if (this.unusedExportNodes.has(filePath))
31
- fix.forEach(fix => this.unusedExportNodes.get(filePath).add(fix));
31
+ fixes.forEach(fix => this.unusedExportNodes.get(filePath).add(fix));
32
32
  else
33
- this.unusedExportNodes.set(filePath, new Set(fix));
33
+ this.unusedExportNodes.set(filePath, new Set(fixes));
34
34
  }
35
35
  async fixIssues(issues) {
36
36
  await this.removeUnusedExportKeywords();
@@ -52,7 +52,10 @@ const commands = [
52
52
  'why',
53
53
  ];
54
54
  export const resolve = (_binary, args, { manifestScriptNames }) => {
55
- const parsed = parseArgs(args, { alias: { recursive: 'r' }, boolean: ['recursive'] });
55
+ const parsed = parseArgs(args, {
56
+ boolean: ['recursive', 'silent', 'shell-mode'],
57
+ alias: { recursive: 'r', silent: 's', 'shell-mode': 'c' },
58
+ });
56
59
  const [command, binary] = parsed._;
57
60
  if (manifestScriptNames.has(command) || commands.includes(command))
58
61
  return [];
@@ -53,7 +53,7 @@ export const findVitestDependencies = async (configFilePath, localConfig, option
53
53
  const dependencies = (typeof entry === 'string' ? [entry] : Object.values(entry)).map(specifier => resolveEntry(configFilePath, specifier));
54
54
  if (!options.enabledPlugins.includes('vitest'))
55
55
  return dependencies;
56
- return [...dependencies, ...findConfigDependencies(configFilePath, localConfig, options)];
56
+ return compact([...dependencies, ...findConfigDependencies(configFilePath, localConfig, options)]);
57
57
  };
58
58
  const findVitestWorkspaceDependencies = async (configFilePath, options) => {
59
59
  const localConfig = await load(configFilePath);
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "4.3.0";
1
+ export declare const version = "4.3.1";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const version = '4.3.0';
1
+ export const version = '4.3.1';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "knip",
3
- "version": "4.3.0",
3
+ "version": "4.3.1",
4
4
  "description": "Find unused files, dependencies and exports in your TypeScript and JavaScript projects",
5
5
  "homepage": "https://knip.dev",
6
6
  "repository": {