knip 5.61.3 → 5.63.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 (77) hide show
  1. package/README.md +22 -24
  2. package/dist/ConfigurationChief.d.ts +3 -0
  3. package/dist/ConfigurationChief.js +14 -6
  4. package/dist/IssueCollector.js +1 -1
  5. package/dist/ProjectPrincipal.d.ts +1 -0
  6. package/dist/ProjectPrincipal.js +9 -3
  7. package/dist/binaries/fallback.js +4 -2
  8. package/dist/binaries/package-manager/bun.js +15 -1
  9. package/dist/cli.js +3 -2
  10. package/dist/compilers/index.d.ts +20 -0
  11. package/dist/graph/analyze.js +1 -1
  12. package/dist/graph/build.js +19 -9
  13. package/dist/index.d.ts +1 -0
  14. package/dist/index.js +2 -1
  15. package/dist/plugins/angular/index.js +6 -2
  16. package/dist/plugins/astro/index.d.ts +1 -0
  17. package/dist/plugins/astro/index.js +7 -7
  18. package/dist/plugins/astro/resolveFromAST.js +1 -2
  19. package/dist/plugins/biome/index.js +10 -2
  20. package/dist/plugins/eslint/helpers.js +2 -1
  21. package/dist/plugins/index.d.ts +19 -1
  22. package/dist/plugins/index.js +4 -0
  23. package/dist/plugins/lefthook/index.js +2 -0
  24. package/dist/plugins/node-modules-inspector/index.d.ts +12 -0
  25. package/dist/plugins/node-modules-inspector/index.js +17 -0
  26. package/dist/plugins/playwright/index.js +8 -1
  27. package/dist/plugins/playwright/types.d.ts +20 -14
  28. package/dist/plugins/postcss/index.js +1 -1
  29. package/dist/plugins/preconstruct/index.js +2 -1
  30. package/dist/plugins/react-router/index.js +18 -8
  31. package/dist/plugins/rsbuild/index.js +11 -2
  32. package/dist/plugins/rsbuild/types.d.ts +8 -0
  33. package/dist/plugins/rslib/index.d.ts +10 -0
  34. package/dist/plugins/rslib/index.js +15 -0
  35. package/dist/plugins/rslib/types.d.ts +1 -0
  36. package/dist/plugins/rslib/types.js +1 -0
  37. package/dist/plugins/rspack/index.js +1 -1
  38. package/dist/plugins/size-limit/index.js +1 -1
  39. package/dist/plugins/typescript/index.d.ts +1 -1
  40. package/dist/plugins/vitest/index.js +41 -1
  41. package/dist/plugins/vitest/types.d.ts +5 -0
  42. package/dist/reporters/symbols.js +3 -1
  43. package/dist/reporters/util/configuration-hints.d.ts +1 -1
  44. package/dist/reporters/util/configuration-hints.js +55 -19
  45. package/dist/reporters/util/util.d.ts +0 -2
  46. package/dist/reporters/util/util.js +2 -2
  47. package/dist/schema/configuration.d.ts +112 -0
  48. package/dist/schema/plugins.d.ts +46 -0
  49. package/dist/schema/plugins.js +2 -0
  50. package/dist/types/PluginNames.d.ts +2 -2
  51. package/dist/types/PluginNames.js +2 -0
  52. package/dist/types/entries.d.ts +3 -0
  53. package/dist/types/entries.js +1 -0
  54. package/dist/types/issues.d.ts +3 -1
  55. package/dist/types/package-json.d.ts +4 -0
  56. package/dist/types/tsconfig-json.d.ts +14 -0
  57. package/dist/types/tsconfig-json.js +1 -0
  58. package/dist/typescript/ast-helpers.js +2 -2
  59. package/dist/util/fs.d.ts +1 -1
  60. package/dist/util/glob-core.d.ts +1 -1
  61. package/dist/util/glob-core.js +8 -7
  62. package/dist/util/glob.d.ts +1 -0
  63. package/dist/util/glob.js +1 -1
  64. package/dist/util/is-identifier-referenced.js +17 -17
  65. package/dist/util/package-json.d.ts +2 -1
  66. package/dist/util/package-json.js +24 -12
  67. package/dist/util/parse-and-convert-gitignores.js +2 -0
  68. package/dist/util/plugin-config.js +1 -1
  69. package/dist/util/reporter.js +3 -3
  70. package/dist/util/resolve.js +1 -1
  71. package/dist/util/table.js +1 -3
  72. package/dist/version.d.ts +1 -1
  73. package/dist/version.js +1 -1
  74. package/package.json +9 -14
  75. package/schema.json +8 -0
  76. /package/dist/util/{tsconfig-loader.d.ts → load-tsconfig.d.ts} +0 -0
  77. /package/dist/util/{tsconfig-loader.js → load-tsconfig.js} +0 -0
@@ -7,6 +7,8 @@ export const convertGitignoreToPicomatchIgnorePatterns = (pattern) => {
7
7
  pattern = pattern.slice(0, -1);
8
8
  if (pattern.startsWith('*/**/'))
9
9
  pattern = pattern.slice(5);
10
+ if (pattern === '*' || pattern === '**')
11
+ return { negated, patterns: [pattern, pattern] };
10
12
  if (pattern.startsWith('/'))
11
13
  pattern = pattern.slice(1);
12
14
  else if (!pattern.startsWith('**/'))
@@ -23,7 +23,7 @@ const toConfigMap = (defaultExtensions, builderConfig) => (moduleName, options)
23
23
  return [...baseFiles, rcFiles, ...configFiles, ...configDirFiles];
24
24
  };
25
25
  export const toCosmiconfig = toConfigMap(['json', 'yaml', 'yml', 'js', 'ts', 'cjs', 'mjs'], { configDir: true });
26
- export const toLilconfig = toConfigMap(['json', 'js', 'cjs', 'mjs'], { configDir: true });
26
+ export const toLilconfig = toConfigMap(['json', 'ts', 'js', 'cjs', 'mjs'], { configDir: true });
27
27
  export const toUnconfig = toConfigMap(['json', 'ts', 'mts', 'cts', 'js', 'mjs', 'cjs'], {
28
28
  configDir: false,
29
29
  rcPrefix: '',
@@ -1,8 +1,8 @@
1
1
  import internalReporters from '../reporters/index.js';
2
2
  import { _load } from './loader.js';
3
- import { isInternal, resolve } from './path.js';
3
+ import { isAbsolute, isInternal, resolve } from './path.js';
4
4
  export const runPreprocessors = async (processors, data) => {
5
- const preprocessors = await Promise.all(processors.map(proc => _load(isInternal(proc) ? resolve(proc) : proc)));
5
+ const preprocessors = await Promise.all(processors.map(proc => _load(isInternal(proc) && !isAbsolute(proc) ? resolve(proc) : proc)));
6
6
  return preprocessors.length === 0
7
7
  ? Promise.resolve(data)
8
8
  : runPreprocessors(preprocessors.slice(1), preprocessors[0](data));
@@ -11,7 +11,7 @@ export const runReporters = async (reporter, options) => {
11
11
  const reporters = await Promise.all(reporter.map(async (reporter) => {
12
12
  return reporter in internalReporters
13
13
  ? internalReporters[reporter]
14
- : await _load(isInternal(reporter) ? resolve(reporter) : reporter);
14
+ : await _load(isInternal(reporter) && !isAbsolute(reporter) ? resolve(reporter) : reporter);
15
15
  }));
16
16
  for (const reporter of reporters)
17
17
  await reporter(options);
@@ -16,6 +16,6 @@ const createSyncResolver = (extensions) => {
16
16
  catch (_error) { }
17
17
  };
18
18
  };
19
- const resolveSync = createSyncResolver([...DEFAULT_EXTENSIONS, '.json']);
19
+ const resolveSync = createSyncResolver([...DEFAULT_EXTENSIONS, '.json', '.jsonc']);
20
20
  export const _resolveSync = timerify(resolveSync);
21
21
  export const _createSyncResolver = extensions => timerify(createSyncResolver(extensions));
@@ -55,9 +55,7 @@ export class Table {
55
55
  this.rows.unshift(headerRow);
56
56
  }
57
57
  const columnWidths = columns.reduce((acc, col) => {
58
- acc[col] = Math.max(...this.rows.map(row => row[col]?.formatted
59
- ? stripVTControlCharacters(row[col].formatted).length
60
- : String(row[col]?.value || '').length));
58
+ acc[col] = Math.max(...this.rows.map(row => stripVTControlCharacters(row[col]?.formatted ?? String(row[col].value || '')).length));
61
59
  return acc;
62
60
  }, {});
63
61
  const separatorWidth = (columns.length - 1) * COLUMN_SEPARATOR.length;
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "5.61.3";
1
+ export declare const version = "5.63.0";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const version = '5.61.3';
1
+ export const version = '5.63.0';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "knip",
3
- "version": "5.61.3",
3
+ "version": "5.63.0",
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": {
@@ -22,10 +22,6 @@
22
22
  {
23
23
  "type": "opencollective",
24
24
  "url": "https://opencollective.com/knip"
25
- },
26
- {
27
- "type": "polar",
28
- "url": "https://polar.sh/webpro-nl"
29
25
  }
30
26
  ],
31
27
  "main": "./dist/index.js",
@@ -63,14 +59,14 @@
63
59
  "dependencies": {
64
60
  "@nodelib/fs.walk": "^1.2.3",
65
61
  "fast-glob": "^3.3.3",
66
- "formatly": "^0.2.4",
67
- "jiti": "^2.4.2",
62
+ "formatly": "^0.3.0",
63
+ "jiti": "^2.5.1",
68
64
  "js-yaml": "^4.1.0",
69
65
  "minimist": "^1.2.8",
70
- "oxc-resolver": "^11.1.0",
66
+ "oxc-resolver": "^11.6.2",
71
67
  "picocolors": "^1.1.1",
72
68
  "picomatch": "^4.0.1",
73
- "smol-toml": "^1.3.4",
69
+ "smol-toml": "^1.4.1",
74
70
  "strip-json-comments": "5.0.2",
75
71
  "zod": "^3.22.4",
76
72
  "zod-validation-error": "^3.0.3"
@@ -82,17 +78,16 @@
82
78
  "devDependencies": {
83
79
  "@jest/types": "^29.6.3",
84
80
  "@release-it/bumper": "^7.0.5",
85
- "@types/bun": "1.2.15",
81
+ "@types/bun": "1.2.19",
86
82
  "@types/js-yaml": "^4.0.9",
87
83
  "@types/minimist": "^1.2.5",
88
84
  "@types/picomatch": "3.0.1",
89
85
  "@types/webpack": "^5.28.5",
90
- "@wdio/types": "^9.15.0",
86
+ "@wdio/types": "^9.16.2",
91
87
  "codeclimate-types": "^0.3.1",
92
88
  "glob": "^11.0.2",
93
- "release-it": "^19.0.3",
94
- "tsx": "^4.19.4",
95
- "type-fest": "^4.31.0",
89
+ "release-it": "^19.0.4",
90
+ "tsx": "^4.20.3",
96
91
  "typescript": "^5.5.2"
97
92
  },
98
93
  "engines": {
package/schema.json CHANGED
@@ -499,6 +499,10 @@
499
499
  "title": "node plugin configuration (https://knip.dev/reference/plugins/node)",
500
500
  "$ref": "#/definitions/plugin"
501
501
  },
502
+ "node-modules-inspector": {
503
+ "title": "node-modules-inspector plugin configuration (https://knip.dev/reference/plugins/node-modules-inspector)",
504
+ "$ref": "#/definitions/plugin"
505
+ },
502
506
  "node-test-runner": {
503
507
  "title": "node-test-runner plugin configuration (https://knip.dev/reference/plugins/node-test-runner)",
504
508
  "$ref": "#/definitions/plugin"
@@ -591,6 +595,10 @@
591
595
  "title": "rsbuild plugin configuration (https://knip.dev/reference/plugins/rsbuild)",
592
596
  "$ref": "#/definitions/plugin"
593
597
  },
598
+ "rslib": {
599
+ "title": "rslib plugin configuration (https://knip.dev/reference/plugins/rslib)",
600
+ "$ref": "#/definitions/plugin"
601
+ },
594
602
  "rspack": {
595
603
  "title": "rspack plugin configuration (https://knip.dev/reference/plugins/rspack)",
596
604
  "$ref": "#/definitions/plugin"