knip 5.69.0 → 5.70.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 (66) hide show
  1. package/dist/CatalogCounselor.d.ts +1 -1
  2. package/dist/CatalogCounselor.js +5 -2
  3. package/dist/ConfigurationChief.d.ts +6 -0
  4. package/dist/DependencyDeputy.js +10 -3
  5. package/dist/IssueFixer.d.ts +0 -6
  6. package/dist/IssueFixer.js +37 -56
  7. package/dist/binaries/package-manager/yarn.js +1 -0
  8. package/dist/binaries/plugins.js +4 -4
  9. package/dist/compilers/index.d.ts +10 -0
  10. package/dist/compilers/index.js +2 -0
  11. package/dist/compilers/prisma.d.ts +6 -0
  12. package/dist/compilers/prisma.js +13 -0
  13. package/dist/constants.d.ts +4 -0
  14. package/dist/constants.js +4 -0
  15. package/dist/graph/analyze.d.ts +1 -1
  16. package/dist/graph/analyze.js +20 -17
  17. package/dist/graph/build.js +3 -3
  18. package/dist/index.js +1 -2
  19. package/dist/plugins/index.d.ts +1 -0
  20. package/dist/plugins/index.js +2 -0
  21. package/dist/plugins/next/index.js +4 -5
  22. package/dist/plugins/prisma/index.js +27 -5
  23. package/dist/plugins/prisma/types.d.ts +1 -0
  24. package/dist/plugins/taskfile/index.d.ts +3 -0
  25. package/dist/plugins/taskfile/index.js +111 -0
  26. package/dist/plugins/taskfile/types.d.ts +25 -0
  27. package/dist/plugins/taskfile/types.js +1 -0
  28. package/dist/plugins/vitest/helpers.d.ts +1 -1
  29. package/dist/plugins/vitest/helpers.js +1 -1
  30. package/dist/plugins/vitest/index.js +11 -4
  31. package/dist/reporters/util/configuration-hints.js +1 -1
  32. package/dist/schema/configuration.d.ts +10 -0
  33. package/dist/schema/plugins.d.ts +5 -0
  34. package/dist/schema/plugins.js +1 -0
  35. package/dist/types/PluginNames.d.ts +2 -2
  36. package/dist/types/PluginNames.js +1 -0
  37. package/dist/types/args.d.ts +4 -1
  38. package/dist/types/exports.d.ts +1 -1
  39. package/dist/types/issues.d.ts +2 -0
  40. package/dist/types/module-graph.d.ts +6 -6
  41. package/dist/typescript/ast-helpers.d.ts +10 -1
  42. package/dist/typescript/ast-helpers.js +33 -4
  43. package/dist/typescript/get-imports-and-exports.js +51 -46
  44. package/dist/typescript/pragmas/custom.d.ts +3 -0
  45. package/dist/typescript/pragmas/custom.js +25 -0
  46. package/dist/typescript/pragmas/index.d.ts +3 -0
  47. package/dist/typescript/pragmas/index.js +3 -0
  48. package/dist/typescript/pragmas/typescript.d.ts +3 -0
  49. package/dist/typescript/pragmas/typescript.js +29 -0
  50. package/dist/typescript/visitors/dynamic-imports/importCall.js +21 -9
  51. package/dist/typescript/visitors/dynamic-imports/importType.js +1 -1
  52. package/dist/typescript/visitors/exports/exportDeclaration.js +1 -1
  53. package/dist/typescript/visitors/helpers.d.ts +0 -2
  54. package/dist/typescript/visitors/helpers.js +0 -38
  55. package/dist/typescript/visitors/imports/importDeclaration.js +4 -4
  56. package/dist/typescript/visitors/imports/importEqualsDeclaration.js +1 -1
  57. package/dist/util/create-options.d.ts +10 -0
  58. package/dist/util/get-referenced-inputs.js +4 -0
  59. package/dist/util/has-strictly-ns-references.d.ts +3 -3
  60. package/dist/util/is-identifier-referenced.js +10 -10
  61. package/dist/util/module-graph.d.ts +2 -2
  62. package/dist/util/module-graph.js +22 -22
  63. package/dist/version.d.ts +1 -1
  64. package/dist/version.js +1 -1
  65. package/package.json +5 -5
  66. package/schema.json +4 -0
@@ -1,31 +1,31 @@
1
1
  export const getOrCreateFileNode = (graph, filePath) => graph.get(filePath) ?? createFileNode();
2
- const updateImportDetails = (importedModule, importItems) => {
3
- for (const id of importItems.refs)
4
- importedModule.refs.add(id);
5
- for (const [id, v] of importItems.imported.entries())
6
- addValues(importedModule.imported, id, v);
7
- for (const [id, v] of importItems.importedAs.entries())
8
- addNsValues(importedModule.importedAs, id, v);
9
- for (const [id, v] of importItems.importedNs.entries())
10
- addValues(importedModule.importedNs, id, v);
11
- for (const [id, v] of importItems.reExported.entries())
12
- addValues(importedModule.reExported, id, v);
13
- for (const [id, v] of importItems.reExportedAs.entries())
14
- addNsValues(importedModule.reExportedAs, id, v);
15
- for (const [id, v] of importItems.reExportedNs.entries())
16
- addValues(importedModule.reExportedNs, id, v);
2
+ const updateImportMaps = (fromImportMaps, toImportMaps) => {
3
+ for (const id of fromImportMaps.refs)
4
+ toImportMaps.refs.add(id);
5
+ for (const [id, v] of fromImportMaps.imported.entries())
6
+ addValues(toImportMaps.imported, id, v);
7
+ for (const [id, v] of fromImportMaps.importedAs.entries())
8
+ addNsValues(toImportMaps.importedAs, id, v);
9
+ for (const [id, v] of fromImportMaps.importedNs.entries())
10
+ addValues(toImportMaps.importedNs, id, v);
11
+ for (const [id, v] of fromImportMaps.reExported.entries())
12
+ addValues(toImportMaps.reExported, id, v);
13
+ for (const [id, v] of fromImportMaps.reExportedAs.entries())
14
+ addNsValues(toImportMaps.reExportedAs, id, v);
15
+ for (const [id, v] of fromImportMaps.reExportedNs.entries())
16
+ addValues(toImportMaps.reExportedNs, id, v);
17
17
  };
18
18
  export const updateImportMap = (file, importMap, graph) => {
19
- for (const [importedFilePath, importDetails] of importMap.entries()) {
20
- const importedFileImports = file.imports.internal.get(importedFilePath);
21
- if (!importedFileImports)
22
- file.imports.internal.set(importedFilePath, importDetails);
19
+ for (const [importedFilePath, fileImportMaps] of importMap.entries()) {
20
+ const importMaps = file.imports.internal.get(importedFilePath);
21
+ if (!importMaps)
22
+ file.imports.internal.set(importedFilePath, fileImportMaps);
23
23
  else
24
- updateImportDetails(importedFileImports, importDetails);
24
+ updateImportMaps(fileImportMaps, importMaps);
25
25
  const importedFile = getOrCreateFileNode(graph, importedFilePath);
26
26
  if (!importedFile.imported)
27
27
  importedFile.imported = createImports();
28
- updateImportDetails(importedFile.imported, importDetails);
28
+ updateImportMaps(fileImportMaps, importedFile.imported);
29
29
  graph.set(importedFilePath, importedFile);
30
30
  }
31
31
  };
@@ -35,7 +35,7 @@ const createFileNode = () => ({
35
35
  external: new Set(),
36
36
  unresolved: new Set(),
37
37
  resolved: new Set(),
38
- specifiers: new Set(),
38
+ imports: new Set(),
39
39
  },
40
40
  exports: new Map(),
41
41
  duplicates: new Set(),
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "5.69.0";
1
+ export declare const version = "5.70.0";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const version = '5.69.0';
1
+ export const version = '5.70.0';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "knip",
3
- "version": "5.69.0",
3
+ "version": "5.70.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": {
@@ -61,13 +61,13 @@
61
61
  "fast-glob": "^3.3.3",
62
62
  "formatly": "^0.3.0",
63
63
  "jiti": "^2.6.0",
64
- "js-yaml": "^4.1.0",
64
+ "js-yaml": "^4.1.1",
65
65
  "minimist": "^1.2.8",
66
- "oxc-resolver": "^11.12.0",
66
+ "oxc-resolver": "^11.13.2",
67
67
  "picocolors": "^1.1.1",
68
68
  "picomatch": "^4.0.1",
69
- "smol-toml": "^1.4.1",
70
- "strip-json-comments": "5.0.2",
69
+ "smol-toml": "^1.5.2",
70
+ "strip-json-comments": "5.0.3",
71
71
  "zod": "^4.1.11"
72
72
  },
73
73
  "peerDependencies": {
package/schema.json CHANGED
@@ -722,6 +722,10 @@
722
722
  "title": "tailwind plugin configuration (https://knip.dev/reference/plugins/tailwind)",
723
723
  "$ref": "#/definitions/plugin"
724
724
  },
725
+ "taskfile": {
726
+ "title": "taskfile plugin configuration (https://knip.dev/reference/plugins/taskfile)",
727
+ "$ref": "#/definitions/plugin"
728
+ },
725
729
  "travis": {
726
730
  "title": "travis plugin configuration (https://knip.dev/reference/plugins/travis)",
727
731
  "$ref": "#/definitions/plugin"