knip 5.62.0 → 5.63.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.
Files changed (134) hide show
  1. package/README.md +22 -24
  2. package/dist/CacheConsultant.d.ts +3 -9
  3. package/dist/CacheConsultant.js +5 -5
  4. package/dist/ConfigurationChief.d.ts +588 -38
  5. package/dist/ConfigurationChief.js +43 -124
  6. package/dist/ConsoleStreamer.d.ts +2 -3
  7. package/dist/ConsoleStreamer.js +2 -2
  8. package/dist/DependencyDeputy.d.ts +2 -6
  9. package/dist/IssueCollector.d.ts +4 -12
  10. package/dist/IssueCollector.js +10 -10
  11. package/dist/IssueFixer.d.ts +3 -14
  12. package/dist/IssueFixer.js +11 -21
  13. package/dist/PrincipalFactory.d.ts +3 -2
  14. package/dist/PrincipalFactory.js +11 -11
  15. package/dist/ProjectPrincipal.d.ts +5 -3
  16. package/dist/ProjectPrincipal.js +17 -11
  17. package/dist/WorkspaceWorker.d.ts +4 -9
  18. package/dist/WorkspaceWorker.js +8 -12
  19. package/dist/binaries/bash-parser.js +1 -1
  20. package/dist/binaries/fallback.js +4 -2
  21. package/dist/binaries/package-manager/pnpm.js +6 -1
  22. package/dist/cli.js +43 -60
  23. package/dist/compilers/index.d.ts +34 -4
  24. package/dist/graph/analyze.d.ts +3 -8
  25. package/dist/graph/analyze.js +24 -27
  26. package/dist/graph/build.d.ts +3 -17
  27. package/dist/graph/build.js +60 -47
  28. package/dist/index.d.ts +3 -6
  29. package/dist/index.js +23 -62
  30. package/dist/plugins/astro/index.d.ts +1 -0
  31. package/dist/plugins/astro/index.js +4 -0
  32. package/dist/plugins/index.d.ts +24 -1
  33. package/dist/plugins/index.js +6 -0
  34. package/dist/plugins/lefthook/index.js +2 -0
  35. package/dist/plugins/node-modules-inspector/index.d.ts +12 -0
  36. package/dist/plugins/node-modules-inspector/index.js +17 -0
  37. package/dist/plugins/nuxt/index.js +4 -3
  38. package/dist/plugins/nuxt/types.d.ts +3 -2
  39. package/dist/plugins/playwright/index.js +8 -1
  40. package/dist/plugins/playwright/types.d.ts +20 -14
  41. package/dist/plugins/pnpm/index.d.ts +7 -0
  42. package/dist/plugins/pnpm/index.js +8 -0
  43. package/dist/plugins/preconstruct/index.js +2 -1
  44. package/dist/plugins/react-router/index.js +18 -8
  45. package/dist/plugins/rsbuild/index.js +28 -2
  46. package/dist/plugins/rsbuild/types.d.ts +11 -0
  47. package/dist/plugins/rslib/index.d.ts +10 -0
  48. package/dist/plugins/rslib/index.js +15 -0
  49. package/dist/plugins/rslib/types.d.ts +1 -0
  50. package/dist/plugins/rspack/index.js +1 -1
  51. package/dist/plugins/typescript/index.d.ts +1 -1
  52. package/dist/plugins.js +3 -2
  53. package/dist/reporters/codeclimate.d.ts +1 -1
  54. package/dist/reporters/codeclimate.js +10 -10
  55. package/dist/reporters/codeowners.d.ts +1 -1
  56. package/dist/reporters/codeowners.js +5 -5
  57. package/dist/reporters/compact.d.ts +1 -1
  58. package/dist/reporters/compact.js +7 -7
  59. package/dist/reporters/disclosure.d.ts +1 -1
  60. package/dist/reporters/disclosure.js +2 -2
  61. package/dist/reporters/index.d.ts +6 -6
  62. package/dist/reporters/json.d.ts +1 -1
  63. package/dist/reporters/json.js +3 -3
  64. package/dist/reporters/markdown.d.ts +1 -1
  65. package/dist/reporters/markdown.js +4 -4
  66. package/dist/reporters/symbols.js +4 -2
  67. package/dist/reporters/util/configuration-hints.d.ts +1 -1
  68. package/dist/reporters/util/configuration-hints.js +58 -23
  69. package/dist/reporters/util/util.d.ts +2 -4
  70. package/dist/reporters/util/util.js +6 -6
  71. package/dist/reporters/watch.d.ts +3 -4
  72. package/dist/reporters/watch.js +5 -5
  73. package/dist/schema/configuration.d.ts +176 -8
  74. package/dist/schema/plugins.d.ts +69 -0
  75. package/dist/schema/plugins.js +3 -0
  76. package/dist/types/PluginNames.d.ts +2 -2
  77. package/dist/types/PluginNames.js +3 -0
  78. package/dist/types/config.d.ts +4 -10
  79. package/dist/types/entries.d.ts +3 -0
  80. package/dist/types/entries.js +1 -0
  81. package/dist/types/issues.d.ts +4 -3
  82. package/dist/types/{cli.d.ts → options.d.ts} +2 -2
  83. package/dist/types/options.js +1 -0
  84. package/dist/types/package-json.d.ts +5 -0
  85. package/dist/types/project.d.ts +1 -7
  86. package/dist/types/tsconfig-json.d.ts +14 -0
  87. package/dist/types/tsconfig-json.js +1 -0
  88. package/dist/typescript/ast-helpers.js +1 -1
  89. package/dist/typescript/get-imports-and-exports.d.ts +2 -2
  90. package/dist/typescript/get-imports-and-exports.js +9 -10
  91. package/dist/util/Performance.js +16 -6
  92. package/dist/util/cli-arguments.d.ts +1 -2
  93. package/dist/util/cli-arguments.js +3 -13
  94. package/dist/util/create-options.d.ts +1219 -0
  95. package/dist/util/create-options.js +112 -0
  96. package/dist/util/debug.js +3 -4
  97. package/dist/util/errors.d.ts +1 -1
  98. package/dist/util/file-entry-cache.js +3 -3
  99. package/dist/util/fs.d.ts +1 -1
  100. package/dist/util/get-included-issue-types.d.ts +9 -13
  101. package/dist/util/get-included-issue-types.js +10 -16
  102. package/dist/util/get-referenced-inputs.js +1 -1
  103. package/dist/util/glob-core.d.ts +1 -1
  104. package/dist/util/glob-core.js +8 -7
  105. package/dist/util/glob.d.ts +1 -0
  106. package/dist/util/glob.js +1 -1
  107. package/dist/util/input.d.ts +1 -1
  108. package/dist/util/input.js +1 -1
  109. package/dist/util/is-identifier-referenced.d.ts +1 -1
  110. package/dist/util/is-identifier-referenced.js +19 -19
  111. package/dist/util/load-config.d.ts +1 -0
  112. package/dist/util/load-config.js +24 -0
  113. package/dist/util/package-json.d.ts +2 -1
  114. package/dist/util/package-json.js +24 -12
  115. package/dist/util/parse-and-convert-gitignores.js +2 -0
  116. package/dist/util/path.d.ts +4 -4
  117. package/dist/util/path.js +5 -7
  118. package/dist/util/reporter.js +3 -3
  119. package/dist/util/require.js +1 -2
  120. package/dist/util/table.js +1 -3
  121. package/dist/util/tag.d.ts +1 -1
  122. package/dist/util/to-source-path.d.ts +1 -1
  123. package/dist/util/to-source-path.js +5 -5
  124. package/dist/util/trace.d.ts +6 -6
  125. package/dist/util/trace.js +18 -22
  126. package/dist/util/watch.d.ts +2 -5
  127. package/dist/util/watch.js +3 -3
  128. package/dist/version.d.ts +1 -1
  129. package/dist/version.js +1 -1
  130. package/package.json +10 -15
  131. package/schema.json +12 -0
  132. package/dist/util/unwrap-function.d.ts +0 -1
  133. package/dist/util/unwrap-function.js +0 -13
  134. /package/dist/{types/cli.js → plugins/rslib/types.js} +0 -0
package/README.md CHANGED
@@ -20,29 +20,28 @@ performance, less maintenance and easier refactorings.
20
20
  - Website: [knip.dev][6]
21
21
  - GitHub repo: [webpro-nl/knip][4]
22
22
  - npm package: [knip][1]
23
- - [Discord][7]
24
- - [Contributing Guide][8]
25
- - [Sponsor Knip!][9]
23
+ - [Contributing Guide][7]
24
+ - [Sponsor Knip!][8]
26
25
 
27
26
  ## Contributors
28
27
 
29
- Special thanks to [the wonderful people who have contributed to Knip][10]!
28
+ Special thanks to [the wonderful people who have contributed to Knip][9]!
30
29
 
31
30
  ## Knip
32
31
 
33
- /'knɪp/ means "(to) cut" and is [pronounced with a hard "K"][11] 🇳🇱
32
+ /'knɪp/ means "(to) cut" and is [pronounced with a hard "K"][10] 🇳🇱
34
33
 
35
34
  ## License
36
35
 
37
- Knip is free and open-source software licensed under the [ISC License][12].
36
+ Knip is free and open-source software licensed under the [ISC License][11].
38
37
 
39
38
  Parts of Knip have been inspired by and/or partially copy code from the
40
39
  following projects:
41
40
 
42
- - [@npmcli/package-json][17] ([ISC][18])
43
- - [@pnpm/deps.graph-sequencer][15] ([MIT][16])
44
- - [file-entry-cache][13] ([MIT][14])
45
- - [json-parse-even-better-errors][19] ([MIT][20])
41
+ - [@npmcli/package-json][12] ([ISC][13])
42
+ - [@pnpm/deps.graph-sequencer][14] ([MIT][15])
43
+ - [file-entry-cache][16] ([MIT][17])
44
+ - [json-parse-even-better-errors][18] ([MIT][19])
46
45
 
47
46
  [1]: https://www.npmjs.com/package/knip
48
47
  [2]: https://img.shields.io/npm/v/knip?color=f56e0f
@@ -51,18 +50,17 @@ following projects:
51
50
  [5]:
52
51
  https://img.shields.io/github/stars/webpro-nl/knip?style=flat-square&color=f56e0f
53
52
  [6]: https://knip.dev
54
- [7]: https://discord.gg/r5uXTtbTpc
55
- [8]: https://github.com/webpro-nl/knip/blob/main/.github/CONTRIBUTING.md
56
- [9]: https://knip.dev/sponsors
57
- [10]: https://knip.dev/#created-by-awesome-contributors
58
- [11]: https://www.youtube.com/watch?v=PE7h7KvQoUI&t=9s
59
- [12]: ./license
60
- [13]: https://github.com/jaredwray/cacheable/tree/main/packages/file-entry-cache
61
- [14]:
53
+ [7]: https://github.com/webpro-nl/knip/blob/main/.github/CONTRIBUTING.md
54
+ [8]: https://knip.dev/sponsors
55
+ [9]: https://knip.dev/#created-by-awesome-contributors
56
+ [10]: https://www.youtube.com/watch?v=PE7h7KvQoUI&t=9s
57
+ [11]: ./license
58
+ [12]: https://github.com/npm/package-json
59
+ [13]: https://github.com/npm/package-json/blob/main/LICENSE
60
+ [14]: https://github.com/pnpm/pnpm/tree/main/deps/graph-sequencer
61
+ [15]: https://github.com/pnpm/pnpm/blob/main/LICENSE
62
+ [16]: https://github.com/jaredwray/cacheable/tree/main/packages/file-entry-cache
63
+ [17]:
62
64
  https://github.com/jaredwray/cacheable/blob/main/packages/file-entry-cache/LICENSE
63
- [15]: https://github.com/pnpm/pnpm/tree/main/deps/graph-sequencer
64
- [16]: https://github.com/pnpm/pnpm/blob/main/LICENSE
65
- [17]: https://github.com/npm/package-json
66
- [18]: https://github.com/npm/package-json/blob/main/LICENSE
67
- [19]: https://github.com/npm/json-parse-even-better-errors
68
- [20]: https://github.com/npm/json-parse-even-better-errors/blob/main/LICENSE.md
65
+ [18]: https://github.com/npm/json-parse-even-better-errors
66
+ [19]: https://github.com/npm/json-parse-even-better-errors/blob/main/LICENSE.md
@@ -1,15 +1,9 @@
1
+ import type { MainOptions } from './util/create-options.js';
1
2
  import { type FileDescriptor } from './util/file-entry-cache.js';
2
- type CacheOptions = {
3
- name: string;
4
- isEnabled: boolean;
5
- cacheLocation: string;
6
- isProduction: boolean;
7
- };
8
3
  export declare class CacheConsultant<T> {
9
4
  private isEnabled;
10
5
  private cache;
11
- constructor(options: CacheOptions);
12
- getFileDescriptor(file: string): FileDescriptor<T>;
6
+ constructor(name: string, options: MainOptions);
7
+ getFileDescriptor(filePath: string): FileDescriptor<T>;
13
8
  reconcile(): void;
14
9
  }
15
- export {};
@@ -5,18 +5,18 @@ const dummyFileDescriptor = { key: '', changed: true, notFound: true };
5
5
  export class CacheConsultant {
6
6
  isEnabled;
7
7
  cache;
8
- constructor(options) {
9
- this.isEnabled = options.isEnabled;
8
+ constructor(name, options) {
9
+ this.isEnabled = options.isCache;
10
10
  if (this.isEnabled) {
11
- const cacheName = `${options.name.replace(/[^a-z0-9]/g, '-').replace(/-*$/, '')}-${options.isProduction ? '-prod' : ''}-${version}`;
11
+ const cacheName = `${name.replace(/[^a-z0-9]/g, '-').replace(/-*$/, '')}-${options.isProduction ? '-prod' : ''}-${version}`;
12
12
  this.cache = new FileEntryCache(cacheName, options.cacheLocation);
13
13
  this.reconcile = timerify(this.cache.reconcile).bind(this.cache);
14
14
  this.getFileDescriptor = timerify(this.cache.getFileDescriptor).bind(this.cache);
15
15
  }
16
16
  }
17
- getFileDescriptor(file) {
17
+ getFileDescriptor(filePath) {
18
18
  if (this.isEnabled && this.cache)
19
- return this.cache.getFileDescriptor(file);
19
+ return this.cache.getFileDescriptor(filePath);
20
20
  return dummyFileDescriptor;
21
21
  }
22
22
  reconcile() {