knip 6.25.0 → 6.26.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 (138) hide show
  1. package/dist/ConfigurationChief.d.ts +102 -0
  2. package/dist/compilers/index.d.ts +170 -0
  3. package/dist/constants.js +13 -0
  4. package/dist/graph/build.js +8 -3
  5. package/dist/plugins/_vue/auto-import.d.ts +12 -0
  6. package/dist/plugins/_vue/auto-import.js +272 -0
  7. package/dist/plugins/_vue/types.d.ts +38 -0
  8. package/dist/plugins/_vue/types.js +1 -0
  9. package/dist/plugins/astro/index.js +2 -37
  10. package/dist/plugins/astro/resolveFromAST.d.ts +4 -4
  11. package/dist/plugins/astro/resolveFromAST.js +34 -7
  12. package/dist/plugins/electron-vite/index.d.ts +3 -0
  13. package/dist/plugins/electron-vite/index.js +51 -0
  14. package/dist/plugins/electron-vite/types.d.ts +23 -0
  15. package/dist/plugins/electron-vite/types.js +1 -0
  16. package/dist/plugins/esbuild/index.d.ts +3 -0
  17. package/dist/plugins/esbuild/index.js +17 -0
  18. package/dist/plugins/eslint/resolveFromAST.js +18 -21
  19. package/dist/plugins/index.d.ts +17 -0
  20. package/dist/plugins/index.js +34 -0
  21. package/dist/plugins/laravel-vite-plugin/index.d.ts +3 -0
  22. package/dist/plugins/laravel-vite-plugin/index.js +14 -0
  23. package/dist/plugins/laravel-vite-plugin/resolveFromAST.d.ts +2 -0
  24. package/dist/plugins/laravel-vite-plugin/resolveFromAST.js +27 -0
  25. package/dist/plugins/next/index.js +2 -2
  26. package/dist/plugins/next-mdx/index.js +2 -8
  27. package/dist/plugins/next-mdx/resolveFromAST.d.ts +3 -2
  28. package/dist/plugins/next-mdx/resolveFromAST.js +17 -21
  29. package/dist/plugins/nuxt/index.js +5 -68
  30. package/dist/plugins/nuxt/types.d.ts +0 -34
  31. package/dist/plugins/nuxtjs-i18n/index.d.ts +3 -0
  32. package/dist/plugins/nuxtjs-i18n/index.js +12 -0
  33. package/dist/plugins/oclif/index.js +10 -5
  34. package/dist/plugins/orval/index.js +1 -3
  35. package/dist/plugins/orval/resolveFromAST.d.ts +2 -2
  36. package/dist/plugins/orval/resolveFromAST.js +4 -7
  37. package/dist/plugins/oxlint/index.js +23 -2
  38. package/dist/plugins/pnpm/index.js +2 -1
  39. package/dist/plugins/pnpm/types.d.ts +2 -4
  40. package/dist/plugins/quasar/index.d.ts +3 -0
  41. package/dist/plugins/quasar/index.js +15 -0
  42. package/dist/plugins/quasar/resolveFromAST.d.ts +3 -0
  43. package/dist/plugins/quasar/resolveFromAST.js +63 -0
  44. package/dist/plugins/qwik/index.js +1 -25
  45. package/dist/plugins/qwik/resolveFromAST.d.ts +5 -3
  46. package/dist/plugins/qwik/resolveFromAST.js +28 -9
  47. package/dist/plugins/rolldown/index.js +2 -5
  48. package/dist/plugins/rollup/index.js +2 -5
  49. package/dist/plugins/rslib/index.js +2 -5
  50. package/dist/plugins/sst/index.js +1 -5
  51. package/dist/plugins/sst/resolveFromAST.d.ts +1 -1
  52. package/dist/plugins/sst/resolveFromAST.js +1 -1
  53. package/dist/plugins/starlight/index.js +1 -19
  54. package/dist/plugins/starlight/resolveFromAST.d.ts +2 -2
  55. package/dist/plugins/starlight/resolveFromAST.js +12 -8
  56. package/dist/plugins/stencil/index.js +2 -37
  57. package/dist/plugins/stencil/resolveFromAST.d.ts +3 -0
  58. package/dist/plugins/stencil/resolveFromAST.js +36 -0
  59. package/dist/plugins/storybook/index.js +3 -0
  60. package/dist/plugins/sveltekit/index.js +1 -48
  61. package/dist/plugins/sveltekit/resolveFromAST.d.ts +2 -0
  62. package/dist/plugins/sveltekit/resolveFromAST.js +45 -0
  63. package/dist/plugins/tauri/index.d.ts +3 -0
  64. package/dist/plugins/tauri/index.js +42 -0
  65. package/dist/plugins/tauri/types.d.ts +16 -0
  66. package/dist/plugins/tauri/types.js +1 -0
  67. package/dist/plugins/tsdown/index.js +2 -5
  68. package/dist/plugins/tsup/index.js +2 -5
  69. package/dist/plugins/unplugin-auto-import/index.d.ts +3 -0
  70. package/dist/plugins/unplugin-auto-import/index.js +18 -0
  71. package/dist/plugins/unplugin-icons/index.d.ts +3 -0
  72. package/dist/plugins/unplugin-icons/index.js +17 -0
  73. package/dist/plugins/unplugin-vue-components/index.d.ts +3 -0
  74. package/dist/plugins/unplugin-vue-components/index.js +16 -0
  75. package/dist/plugins/unplugin-vue-i18n/index.d.ts +3 -0
  76. package/dist/plugins/unplugin-vue-i18n/index.js +10 -0
  77. package/dist/plugins/unplugin-vue-markdown/index.d.ts +3 -0
  78. package/dist/plugins/unplugin-vue-markdown/index.js +16 -0
  79. package/dist/plugins/unplugin-vue-router/index.d.ts +3 -0
  80. package/dist/plugins/unplugin-vue-router/index.js +14 -0
  81. package/dist/plugins/vite/helpers.d.ts +2 -0
  82. package/dist/plugins/vite/helpers.js +46 -31
  83. package/dist/plugins/vite/index.js +1 -1
  84. package/dist/plugins/vite-plugin-pages/index.d.ts +3 -0
  85. package/dist/plugins/vite-plugin-pages/index.js +26 -0
  86. package/dist/plugins/vite-plugin-pwa/index.d.ts +3 -0
  87. package/dist/plugins/vite-plugin-pwa/index.js +17 -0
  88. package/dist/plugins/vite-plugin-pwa/resolveFromAST.d.ts +4 -0
  89. package/dist/plugins/vite-plugin-pwa/resolveFromAST.js +37 -0
  90. package/dist/plugins/vite-plugin-vue-layouts-next/index.d.ts +3 -0
  91. package/dist/plugins/vite-plugin-vue-layouts-next/index.js +23 -0
  92. package/dist/plugins/vite-plus/index.d.ts +3 -0
  93. package/dist/plugins/vite-plus/index.js +14 -0
  94. package/dist/plugins/vite-plus/resolveFromAST.d.ts +2 -0
  95. package/dist/plugins/vite-plus/resolveFromAST.js +37 -0
  96. package/dist/plugins/vite-pwa-assets-generator/index.d.ts +3 -0
  97. package/dist/plugins/vite-pwa-assets-generator/index.js +12 -0
  98. package/dist/plugins/vitepress/index.js +5 -1
  99. package/dist/plugins/vitest/index.js +4 -0
  100. package/dist/plugins/vitest/types.d.ts +3 -0
  101. package/dist/plugins/vue/index.js +5 -3
  102. package/dist/plugins/yarn/index.js +2 -1
  103. package/dist/plugins/yarn/types.d.ts +2 -4
  104. package/dist/schema/configuration.d.ts +255 -0
  105. package/dist/schema/plugins.d.ts +85 -0
  106. package/dist/schema/plugins.js +17 -0
  107. package/dist/types/PluginNames.d.ts +2 -2
  108. package/dist/types/PluginNames.js +17 -0
  109. package/dist/types/package-json.d.ts +8 -4
  110. package/dist/typescript/ast-helpers.d.ts +7 -2
  111. package/dist/typescript/ast-helpers.js +36 -8
  112. package/dist/typescript/ast-nodes.d.ts +1 -0
  113. package/dist/typescript/ast-nodes.js +8 -0
  114. package/dist/util/cli-arguments.d.ts +1 -1
  115. package/dist/util/cli-arguments.js +1 -1
  116. package/dist/util/create-options.d.ts +170 -0
  117. package/dist/util/resolve.js +4 -1
  118. package/dist/util/to-source-path.js +1 -1
  119. package/dist/version.d.ts +1 -1
  120. package/dist/version.js +1 -1
  121. package/package.json +1 -1
  122. package/schema.json +68 -0
  123. package/dist/plugins/next/resolveFromAST.d.ts +0 -2
  124. package/dist/plugins/next/resolveFromAST.js +0 -2
  125. package/dist/plugins/nuxt/helpers.d.ts +0 -15
  126. package/dist/plugins/nuxt/helpers.js +0 -133
  127. package/dist/plugins/rolldown/resolveFromAST.d.ts +0 -2
  128. package/dist/plugins/rolldown/resolveFromAST.js +0 -4
  129. package/dist/plugins/rollup/resolveFromAST.d.ts +0 -2
  130. package/dist/plugins/rollup/resolveFromAST.js +0 -4
  131. package/dist/plugins/rslib/resolveFromAST.d.ts +0 -2
  132. package/dist/plugins/rslib/resolveFromAST.js +0 -4
  133. package/dist/plugins/tsdown/resolveFromAST.d.ts +0 -2
  134. package/dist/plugins/tsdown/resolveFromAST.js +0 -4
  135. package/dist/plugins/tsup/resolveFromAST.d.ts +0 -2
  136. package/dist/plugins/tsup/resolveFromAST.js +0 -4
  137. package/dist/plugins/vue/compiler.d.ts +0 -3
  138. package/dist/plugins/vue/compiler.js +0 -10
@@ -185,11 +185,21 @@ export declare const createOptions: (options: CreateOptions) => Promise<{
185
185
  entry?: string | string[] | undefined;
186
186
  project?: string | string[] | undefined;
187
187
  } | undefined;
188
+ 'electron-vite'?: string | boolean | string[] | {
189
+ config?: string | string[] | undefined;
190
+ entry?: string | string[] | undefined;
191
+ project?: string | string[] | undefined;
192
+ } | undefined;
188
193
  eleventy?: string | boolean | string[] | {
189
194
  config?: string | string[] | undefined;
190
195
  entry?: string | string[] | undefined;
191
196
  project?: string | string[] | undefined;
192
197
  } | undefined;
198
+ esbuild?: string | boolean | string[] | {
199
+ config?: string | string[] | undefined;
200
+ entry?: string | string[] | undefined;
201
+ project?: string | string[] | undefined;
202
+ } | undefined;
193
203
  eslint?: string | boolean | string[] | {
194
204
  config?: string | string[] | undefined;
195
205
  entry?: string | string[] | undefined;
@@ -285,6 +295,11 @@ export declare const createOptions: (options: CreateOptions) => Promise<{
285
295
  entry?: string | string[] | undefined;
286
296
  project?: string | string[] | undefined;
287
297
  } | undefined;
298
+ 'laravel-vite-plugin'?: string | boolean | string[] | {
299
+ config?: string | string[] | undefined;
300
+ entry?: string | string[] | undefined;
301
+ project?: string | string[] | undefined;
302
+ } | undefined;
288
303
  lefthook?: string | boolean | string[] | {
289
304
  config?: string | string[] | undefined;
290
305
  entry?: string | string[] | undefined;
@@ -420,6 +435,11 @@ export declare const createOptions: (options: CreateOptions) => Promise<{
420
435
  entry?: string | string[] | undefined;
421
436
  project?: string | string[] | undefined;
422
437
  } | undefined;
438
+ 'nuxtjs-i18n'?: string | boolean | string[] | {
439
+ config?: string | string[] | undefined;
440
+ entry?: string | string[] | undefined;
441
+ project?: string | string[] | undefined;
442
+ } | undefined;
423
443
  nx?: string | boolean | string[] | {
424
444
  config?: string | string[] | undefined;
425
445
  entry?: string | string[] | undefined;
@@ -525,6 +545,11 @@ export declare const createOptions: (options: CreateOptions) => Promise<{
525
545
  entry?: string | string[] | undefined;
526
546
  project?: string | string[] | undefined;
527
547
  } | undefined;
548
+ quasar?: string | boolean | string[] | {
549
+ config?: string | string[] | undefined;
550
+ entry?: string | string[] | undefined;
551
+ project?: string | string[] | undefined;
552
+ } | undefined;
528
553
  qwik?: string | boolean | string[] | {
529
554
  config?: string | string[] | undefined;
530
555
  entry?: string | string[] | undefined;
@@ -715,6 +740,11 @@ export declare const createOptions: (options: CreateOptions) => Promise<{
715
740
  entry?: string | string[] | undefined;
716
741
  project?: string | string[] | undefined;
717
742
  } | undefined;
743
+ tauri?: string | boolean | string[] | {
744
+ config?: string | string[] | undefined;
745
+ entry?: string | string[] | undefined;
746
+ project?: string | string[] | undefined;
747
+ } | undefined;
718
748
  travis?: string | boolean | string[] | {
719
749
  config?: string | string[] | undefined;
720
750
  entry?: string | string[] | undefined;
@@ -760,6 +790,36 @@ export declare const createOptions: (options: CreateOptions) => Promise<{
760
790
  entry?: string | string[] | undefined;
761
791
  project?: string | string[] | undefined;
762
792
  } | undefined;
793
+ 'unplugin-auto-import'?: string | boolean | string[] | {
794
+ config?: string | string[] | undefined;
795
+ entry?: string | string[] | undefined;
796
+ project?: string | string[] | undefined;
797
+ } | undefined;
798
+ 'unplugin-icons'?: string | boolean | string[] | {
799
+ config?: string | string[] | undefined;
800
+ entry?: string | string[] | undefined;
801
+ project?: string | string[] | undefined;
802
+ } | undefined;
803
+ 'unplugin-vue-components'?: string | boolean | string[] | {
804
+ config?: string | string[] | undefined;
805
+ entry?: string | string[] | undefined;
806
+ project?: string | string[] | undefined;
807
+ } | undefined;
808
+ 'unplugin-vue-i18n'?: string | boolean | string[] | {
809
+ config?: string | string[] | undefined;
810
+ entry?: string | string[] | undefined;
811
+ project?: string | string[] | undefined;
812
+ } | undefined;
813
+ 'unplugin-vue-markdown'?: string | boolean | string[] | {
814
+ config?: string | string[] | undefined;
815
+ entry?: string | string[] | undefined;
816
+ project?: string | string[] | undefined;
817
+ } | undefined;
818
+ 'unplugin-vue-router'?: string | boolean | string[] | {
819
+ config?: string | string[] | undefined;
820
+ entry?: string | string[] | undefined;
821
+ project?: string | string[] | undefined;
822
+ } | undefined;
763
823
  vercel?: string | boolean | string[] | {
764
824
  config?: string | string[] | undefined;
765
825
  entry?: string | string[] | undefined;
@@ -780,6 +840,31 @@ export declare const createOptions: (options: CreateOptions) => Promise<{
780
840
  entry?: string | string[] | undefined;
781
841
  project?: string | string[] | undefined;
782
842
  } | undefined;
843
+ 'vite-plugin-pages'?: string | boolean | string[] | {
844
+ config?: string | string[] | undefined;
845
+ entry?: string | string[] | undefined;
846
+ project?: string | string[] | undefined;
847
+ } | undefined;
848
+ 'vite-plugin-pwa'?: string | boolean | string[] | {
849
+ config?: string | string[] | undefined;
850
+ entry?: string | string[] | undefined;
851
+ project?: string | string[] | undefined;
852
+ } | undefined;
853
+ 'vite-plugin-vue-layouts-next'?: string | boolean | string[] | {
854
+ config?: string | string[] | undefined;
855
+ entry?: string | string[] | undefined;
856
+ project?: string | string[] | undefined;
857
+ } | undefined;
858
+ 'vite-plus'?: string | boolean | string[] | {
859
+ config?: string | string[] | undefined;
860
+ entry?: string | string[] | undefined;
861
+ project?: string | string[] | undefined;
862
+ } | undefined;
863
+ 'vite-pwa-assets-generator'?: string | boolean | string[] | {
864
+ config?: string | string[] | undefined;
865
+ entry?: string | string[] | undefined;
866
+ project?: string | string[] | undefined;
867
+ } | undefined;
783
868
  vitepress?: string | boolean | string[] | {
784
869
  config?: string | string[] | undefined;
785
870
  entry?: string | string[] | undefined;
@@ -1008,11 +1093,21 @@ export declare const createOptions: (options: CreateOptions) => Promise<{
1008
1093
  entry?: string | string[] | undefined;
1009
1094
  project?: string | string[] | undefined;
1010
1095
  } | undefined;
1096
+ 'electron-vite'?: string | boolean | string[] | {
1097
+ config?: string | string[] | undefined;
1098
+ entry?: string | string[] | undefined;
1099
+ project?: string | string[] | undefined;
1100
+ } | undefined;
1011
1101
  eleventy?: string | boolean | string[] | {
1012
1102
  config?: string | string[] | undefined;
1013
1103
  entry?: string | string[] | undefined;
1014
1104
  project?: string | string[] | undefined;
1015
1105
  } | undefined;
1106
+ esbuild?: string | boolean | string[] | {
1107
+ config?: string | string[] | undefined;
1108
+ entry?: string | string[] | undefined;
1109
+ project?: string | string[] | undefined;
1110
+ } | undefined;
1016
1111
  eslint?: string | boolean | string[] | {
1017
1112
  config?: string | string[] | undefined;
1018
1113
  entry?: string | string[] | undefined;
@@ -1108,6 +1203,11 @@ export declare const createOptions: (options: CreateOptions) => Promise<{
1108
1203
  entry?: string | string[] | undefined;
1109
1204
  project?: string | string[] | undefined;
1110
1205
  } | undefined;
1206
+ 'laravel-vite-plugin'?: string | boolean | string[] | {
1207
+ config?: string | string[] | undefined;
1208
+ entry?: string | string[] | undefined;
1209
+ project?: string | string[] | undefined;
1210
+ } | undefined;
1111
1211
  lefthook?: string | boolean | string[] | {
1112
1212
  config?: string | string[] | undefined;
1113
1213
  entry?: string | string[] | undefined;
@@ -1243,6 +1343,11 @@ export declare const createOptions: (options: CreateOptions) => Promise<{
1243
1343
  entry?: string | string[] | undefined;
1244
1344
  project?: string | string[] | undefined;
1245
1345
  } | undefined;
1346
+ 'nuxtjs-i18n'?: string | boolean | string[] | {
1347
+ config?: string | string[] | undefined;
1348
+ entry?: string | string[] | undefined;
1349
+ project?: string | string[] | undefined;
1350
+ } | undefined;
1246
1351
  nx?: string | boolean | string[] | {
1247
1352
  config?: string | string[] | undefined;
1248
1353
  entry?: string | string[] | undefined;
@@ -1348,6 +1453,11 @@ export declare const createOptions: (options: CreateOptions) => Promise<{
1348
1453
  entry?: string | string[] | undefined;
1349
1454
  project?: string | string[] | undefined;
1350
1455
  } | undefined;
1456
+ quasar?: string | boolean | string[] | {
1457
+ config?: string | string[] | undefined;
1458
+ entry?: string | string[] | undefined;
1459
+ project?: string | string[] | undefined;
1460
+ } | undefined;
1351
1461
  qwik?: string | boolean | string[] | {
1352
1462
  config?: string | string[] | undefined;
1353
1463
  entry?: string | string[] | undefined;
@@ -1538,6 +1648,11 @@ export declare const createOptions: (options: CreateOptions) => Promise<{
1538
1648
  entry?: string | string[] | undefined;
1539
1649
  project?: string | string[] | undefined;
1540
1650
  } | undefined;
1651
+ tauri?: string | boolean | string[] | {
1652
+ config?: string | string[] | undefined;
1653
+ entry?: string | string[] | undefined;
1654
+ project?: string | string[] | undefined;
1655
+ } | undefined;
1541
1656
  travis?: string | boolean | string[] | {
1542
1657
  config?: string | string[] | undefined;
1543
1658
  entry?: string | string[] | undefined;
@@ -1583,6 +1698,36 @@ export declare const createOptions: (options: CreateOptions) => Promise<{
1583
1698
  entry?: string | string[] | undefined;
1584
1699
  project?: string | string[] | undefined;
1585
1700
  } | undefined;
1701
+ 'unplugin-auto-import'?: string | boolean | string[] | {
1702
+ config?: string | string[] | undefined;
1703
+ entry?: string | string[] | undefined;
1704
+ project?: string | string[] | undefined;
1705
+ } | undefined;
1706
+ 'unplugin-icons'?: string | boolean | string[] | {
1707
+ config?: string | string[] | undefined;
1708
+ entry?: string | string[] | undefined;
1709
+ project?: string | string[] | undefined;
1710
+ } | undefined;
1711
+ 'unplugin-vue-components'?: string | boolean | string[] | {
1712
+ config?: string | string[] | undefined;
1713
+ entry?: string | string[] | undefined;
1714
+ project?: string | string[] | undefined;
1715
+ } | undefined;
1716
+ 'unplugin-vue-i18n'?: string | boolean | string[] | {
1717
+ config?: string | string[] | undefined;
1718
+ entry?: string | string[] | undefined;
1719
+ project?: string | string[] | undefined;
1720
+ } | undefined;
1721
+ 'unplugin-vue-markdown'?: string | boolean | string[] | {
1722
+ config?: string | string[] | undefined;
1723
+ entry?: string | string[] | undefined;
1724
+ project?: string | string[] | undefined;
1725
+ } | undefined;
1726
+ 'unplugin-vue-router'?: string | boolean | string[] | {
1727
+ config?: string | string[] | undefined;
1728
+ entry?: string | string[] | undefined;
1729
+ project?: string | string[] | undefined;
1730
+ } | undefined;
1586
1731
  vercel?: string | boolean | string[] | {
1587
1732
  config?: string | string[] | undefined;
1588
1733
  entry?: string | string[] | undefined;
@@ -1603,6 +1748,31 @@ export declare const createOptions: (options: CreateOptions) => Promise<{
1603
1748
  entry?: string | string[] | undefined;
1604
1749
  project?: string | string[] | undefined;
1605
1750
  } | undefined;
1751
+ 'vite-plugin-pages'?: string | boolean | string[] | {
1752
+ config?: string | string[] | undefined;
1753
+ entry?: string | string[] | undefined;
1754
+ project?: string | string[] | undefined;
1755
+ } | undefined;
1756
+ 'vite-plugin-pwa'?: string | boolean | string[] | {
1757
+ config?: string | string[] | undefined;
1758
+ entry?: string | string[] | undefined;
1759
+ project?: string | string[] | undefined;
1760
+ } | undefined;
1761
+ 'vite-plugin-vue-layouts-next'?: string | boolean | string[] | {
1762
+ config?: string | string[] | undefined;
1763
+ entry?: string | string[] | undefined;
1764
+ project?: string | string[] | undefined;
1765
+ } | undefined;
1766
+ 'vite-plus'?: string | boolean | string[] | {
1767
+ config?: string | string[] | undefined;
1768
+ entry?: string | string[] | undefined;
1769
+ project?: string | string[] | undefined;
1770
+ } | undefined;
1771
+ 'vite-pwa-assets-generator'?: string | boolean | string[] | {
1772
+ config?: string | string[] | undefined;
1773
+ entry?: string | string[] | undefined;
1774
+ project?: string | string[] | undefined;
1775
+ } | undefined;
1606
1776
  vitepress?: string | boolean | string[] | {
1607
1777
  config?: string | string[] | undefined;
1608
1778
  entry?: string | string[] | undefined;
@@ -20,7 +20,10 @@ const createSyncModuleResolver = (extensions, tsConfigFile) => {
20
20
  tsconfig: tsConfigFile ? { configFile: tsConfigFile, references: 'auto' } : 'auto',
21
21
  ...baseOptions,
22
22
  });
23
- const fallbackResolver = new ResolverFactory(baseOptions);
23
+ const fallbackResolver = new ResolverFactory({
24
+ ...baseOptions,
25
+ conditionNames: ['require', 'import', 'browser', 'default'],
26
+ });
24
27
  resolverInstances.push(resolver, fallbackResolver);
25
28
  return function resolveSync(specifier, basePath) {
26
29
  const resolved = resolver.resolveFileSync(basePath, specifier);
@@ -87,7 +87,7 @@ export const getToSourcePathsHandler = (chief) => {
87
87
  const mapped = ws?.sourceMaps && rewritePattern(ws.sourceMaps, absSpecifier, extensions);
88
88
  patterns.add(mapped ?? absSpecifier);
89
89
  }
90
- const filePaths = await _glob({ patterns: Array.from(patterns), cwd: dir, label });
90
+ const filePaths = await _glob({ patterns: Array.from(patterns), cwd: chief.cwd, dir, label });
91
91
  debugLogArray(toRelative(dir, chief.cwd), 'Source mapping (package.json)', filePaths);
92
92
  return filePaths;
93
93
  };
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "6.25.0";
1
+ export declare const version = "6.26.0";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const version = '6.25.0';
1
+ export const version = '6.26.0';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "knip",
3
- "version": "6.25.0",
3
+ "version": "6.26.0",
4
4
  "description": "Find and fix unused dependencies, exports and files in your TypeScript and JavaScript projects",
5
5
  "keywords": [
6
6
  "analysis",
package/schema.json CHANGED
@@ -506,10 +506,18 @@
506
506
  "title": "Drizzle plugin configuration (https://knip.dev/reference/plugins/drizzle)",
507
507
  "$ref": "#/definitions/plugin"
508
508
  },
509
+ "electron-vite": {
510
+ "title": "electron-vite plugin configuration (https://knip.dev/reference/plugins/electron-vite)",
511
+ "$ref": "#/definitions/plugin"
512
+ },
509
513
  "eleventy": {
510
514
  "title": "eleventy plugin configuration (https://knip.dev/reference/plugins/eleventy)",
511
515
  "$ref": "#/definitions/plugin"
512
516
  },
517
+ "esbuild": {
518
+ "title": "esbuild plugin configuration (https://knip.dev/reference/plugins/esbuild)",
519
+ "$ref": "#/definitions/plugin"
520
+ },
513
521
  "eslint": {
514
522
  "title": "ESLint plugin configuration (https://knip.dev/reference/plugins/eslint)",
515
523
  "$ref": "#/definitions/plugin"
@@ -582,6 +590,10 @@
582
590
  "title": "ladle plugin configuration (https://knip.dev/reference/plugins/ladle)",
583
591
  "$ref": "#/definitions/plugin"
584
592
  },
593
+ "laravel-vite-plugin": {
594
+ "title": "laravel-vite-plugin plugin configuration (https://knip.dev/reference/plugins/laravel-vite-plugin)",
595
+ "$ref": "#/definitions/plugin"
596
+ },
585
597
  "lefthook": {
586
598
  "title": "lefthook plugin configuration (https://knip.dev/reference/plugins/lefthook)",
587
599
  "$ref": "#/definitions/plugin"
@@ -694,6 +706,10 @@
694
706
  "title": "Nuxt plugin configuration (https://knip.dev/reference/plugins/nuxt)",
695
707
  "$ref": "#/definitions/plugin"
696
708
  },
709
+ "nuxtjs-i18n": {
710
+ "title": "nuxtjs-i18n plugin configuration (https://knip.dev/reference/plugins/nuxtjs-i18n)",
711
+ "$ref": "#/definitions/plugin"
712
+ },
697
713
  "nx": {
698
714
  "title": "Nx plugin configuration (https://knip.dev/reference/plugins/nx)",
699
715
  "$ref": "#/definitions/plugin"
@@ -770,6 +786,10 @@
770
786
  "title": "Prisma plugin configuration (https://knip.dev/reference/plugins/prisma)",
771
787
  "$ref": "#/definitions/plugin"
772
788
  },
789
+ "quasar": {
790
+ "title": "quasar plugin configuration (https://knip.dev/reference/plugins/quasar)",
791
+ "$ref": "#/definitions/plugin"
792
+ },
773
793
  "qwik": {
774
794
  "title": "qwik plugin configuration (https://knip.dev/reference/plugins/qwik)",
775
795
  "$ref": "#/definitions/plugin"
@@ -918,6 +938,10 @@
918
938
  "title": "taskfile plugin configuration (https://knip.dev/reference/plugins/taskfile)",
919
939
  "$ref": "#/definitions/plugin"
920
940
  },
941
+ "tauri": {
942
+ "title": "tauri plugin configuration (https://knip.dev/reference/plugins/tauri)",
943
+ "$ref": "#/definitions/plugin"
944
+ },
921
945
  "travis": {
922
946
  "title": "travis plugin configuration (https://knip.dev/reference/plugins/travis)",
923
947
  "$ref": "#/definitions/plugin"
@@ -954,6 +978,30 @@
954
978
  "title": "unocss plugin configuration (https://knip.dev/reference/plugins/unocss)",
955
979
  "$ref": "#/definitions/plugin"
956
980
  },
981
+ "unplugin-auto-import": {
982
+ "title": "unplugin-auto-import plugin configuration (https://knip.dev/reference/plugins/unplugin-auto-import)",
983
+ "$ref": "#/definitions/plugin"
984
+ },
985
+ "unplugin-icons": {
986
+ "title": "unplugin-icons plugin configuration (https://knip.dev/reference/plugins/unplugin-icons)",
987
+ "$ref": "#/definitions/plugin"
988
+ },
989
+ "unplugin-vue-components": {
990
+ "title": "unplugin-vue-components plugin configuration (https://knip.dev/reference/plugins/unplugin-vue-components)",
991
+ "$ref": "#/definitions/plugin"
992
+ },
993
+ "unplugin-vue-i18n": {
994
+ "title": "unplugin-vue-i18n plugin configuration (https://knip.dev/reference/plugins/unplugin-vue-i18n)",
995
+ "$ref": "#/definitions/plugin"
996
+ },
997
+ "unplugin-vue-markdown": {
998
+ "title": "unplugin-vue-markdown plugin configuration (https://knip.dev/reference/plugins/unplugin-vue-markdown)",
999
+ "$ref": "#/definitions/plugin"
1000
+ },
1001
+ "unplugin-vue-router": {
1002
+ "title": "unplugin-vue-router plugin configuration (https://knip.dev/reference/plugins/unplugin-vue-router)",
1003
+ "$ref": "#/definitions/plugin"
1004
+ },
957
1005
  "vercel": {
958
1006
  "title": "vercel plugin configuration (https://knip.dev/reference/plugins/vercel)",
959
1007
  "$ref": "#/definitions/plugin"
@@ -970,6 +1018,26 @@
970
1018
  "title": "vite plugin configuration (https://knip.dev/reference/plugins/vite)",
971
1019
  "$ref": "#/definitions/plugin"
972
1020
  },
1021
+ "vite-plugin-pages": {
1022
+ "title": "vite-plugin-pages plugin configuration (https://knip.dev/reference/plugins/vite-plugin-pages)",
1023
+ "$ref": "#/definitions/plugin"
1024
+ },
1025
+ "vite-plugin-pwa": {
1026
+ "title": "vite-plugin-pwa plugin configuration (https://knip.dev/reference/plugins/vite-plugin-pwa)",
1027
+ "$ref": "#/definitions/plugin"
1028
+ },
1029
+ "vite-plugin-vue-layouts-next": {
1030
+ "title": "vite-plugin-vue-layouts-next plugin configuration (https://knip.dev/reference/plugins/vite-plugin-vue-layouts-next)",
1031
+ "$ref": "#/definitions/plugin"
1032
+ },
1033
+ "vite-plus": {
1034
+ "title": "vite-plus plugin configuration (https://knip.dev/reference/plugins/vite-plus)",
1035
+ "$ref": "#/definitions/plugin"
1036
+ },
1037
+ "vite-pwa-assets-generator": {
1038
+ "title": "vite-pwa-assets-generator plugin configuration (https://knip.dev/reference/plugins/vite-pwa-assets-generator)",
1039
+ "$ref": "#/definitions/plugin"
1040
+ },
973
1041
  "vitepress": {
974
1042
  "title": "vitepress plugin configuration (https://knip.dev/reference/plugins/vitepress)",
975
1043
  "$ref": "#/definitions/plugin"
@@ -1,2 +0,0 @@
1
- import type { Program } from 'oxc-parser';
2
- export declare const getPageExtensions: (program: Program) => string[];
@@ -1,2 +0,0 @@
1
- import { collectPropertyValues } from '../../typescript/ast-helpers.js';
2
- export const getPageExtensions = (program) => Array.from(collectPropertyValues(program, 'pageExtensions'));
@@ -1,15 +0,0 @@
1
- import { type ParseResult } from 'oxc-parser';
2
- import type { TemplateAstNode, VueSfc } from './types.ts';
3
- export declare const getVueSfc: (cwd: string) => VueSfc;
4
- export declare const readAndParseFile: (filePath: string) => ParseResult;
5
- export declare const collectIdentifiers: (source: string, fileName: string) => Set<string>;
6
- export declare const collectTemplateInfo: (tree: TemplateAstNode) => {
7
- tags: Set<string>;
8
- identifiers: Set<string>;
9
- };
10
- export declare const toKebabCase: (s: string) => string;
11
- export declare const collectLocalImportPaths: (filePath: string, result: ParseResult) => Set<string>;
12
- export declare function buildAutoImportMap(filePath: string, result: ParseResult): {
13
- importMap: Map<string, string>;
14
- componentMap: Map<string, string[]>;
15
- };
@@ -1,133 +0,0 @@
1
- import { readFileSync } from 'node:fs';
2
- import { createRequire } from 'node:module';
3
- import { Visitor } from 'oxc-parser';
4
- import { scriptBodies } from '../../compilers/compilers.js';
5
- import { _parseFile } from '../../typescript/ast-nodes.js';
6
- import { basename, dirname, isInNodeModules, join } from '../../util/path.js';
7
- export const getVueSfc = (cwd) => {
8
- try {
9
- return createRequire(join(cwd, 'package.json'))('vue/compiler-sfc');
10
- }
11
- catch { }
12
- return {
13
- parse: (source, path) => ({
14
- descriptor: { script: { content: scriptBodies(source, path) }, scriptSetup: null, template: { content: '' } },
15
- }),
16
- };
17
- };
18
- const readFile = (filePath) => {
19
- try {
20
- return readFileSync(filePath, 'utf8');
21
- }
22
- catch {
23
- return '';
24
- }
25
- };
26
- export const readAndParseFile = (filePath) => _parseFile(filePath, readFile(filePath));
27
- export const collectIdentifiers = (source, fileName) => {
28
- const identifiers = new Set();
29
- const visitor = new Visitor({
30
- Identifier(node) {
31
- identifiers.add(node.name);
32
- },
33
- });
34
- visitor.visit(_parseFile(fileName, source).program);
35
- return identifiers;
36
- };
37
- export const collectTemplateInfo = (tree) => {
38
- const tags = new Set();
39
- const identifiers = new Set();
40
- const addExprIdentifiers = (expr) => {
41
- for (const id of collectIdentifiers(expr, 'expr.ts'))
42
- identifiers.add(id);
43
- };
44
- const visit = (node) => {
45
- if (node.tag)
46
- tags.add(node.tag);
47
- if (node.type === 5 && node.content && !node.content.isStatic)
48
- addExprIdentifiers(node.content.content);
49
- if (node.props) {
50
- for (const prop of node.props) {
51
- if (prop.type === 7) {
52
- if (prop.exp && !prop.exp.isStatic)
53
- addExprIdentifiers(prop.exp.content);
54
- if (prop.arg && !prop.arg.isStatic)
55
- addExprIdentifiers(prop.arg.content);
56
- }
57
- }
58
- }
59
- if (node.children)
60
- for (const child of node.children)
61
- visit(child);
62
- };
63
- visit(tree);
64
- return { tags, identifiers };
65
- };
66
- export const toKebabCase = (s) => s.replace(/[A-Z]/g, (m, i) => (i ? '-' : '') + m.toLowerCase());
67
- const isLocalSpecifier = (specifier) => specifier.startsWith('.') && !isInNodeModules(specifier);
68
- export const collectLocalImportPaths = (filePath, result) => {
69
- const dir = dirname(filePath);
70
- const paths = new Set();
71
- const visitor = new Visitor({
72
- TSImportType(node) {
73
- const specifier = node.source.value;
74
- if (isLocalSpecifier(specifier))
75
- paths.add(join(dir, specifier));
76
- },
77
- });
78
- visitor.visit(result.program);
79
- return paths;
80
- };
81
- export function buildAutoImportMap(filePath, result) {
82
- const dir = dirname(filePath);
83
- const isComponents = basename(filePath) === 'components.d.ts';
84
- const importMap = new Map();
85
- const componentMap = new Map();
86
- const importTypes = [];
87
- const collectVisitor = new Visitor({
88
- TSImportType(node) {
89
- importTypes.push({ start: node.start, end: node.end, specifier: node.source.value });
90
- },
91
- });
92
- collectVisitor.visit(result.program);
93
- const matchVisitor = new Visitor({
94
- VariableDeclarator(node) {
95
- if (node.id?.type !== 'Identifier')
96
- return;
97
- const name = node.id.name;
98
- if (name.startsWith('Lazy'))
99
- return;
100
- const importType = importTypes.find(it => it.start >= node.start && it.end <= node.end);
101
- if (!importType)
102
- return;
103
- if (!isLocalSpecifier(importType.specifier))
104
- return;
105
- const absSpecifier = join(dir, importType.specifier);
106
- if (isComponents) {
107
- const components = componentMap.get(name);
108
- if (components)
109
- components.push(absSpecifier);
110
- else
111
- componentMap.set(name, [absSpecifier]);
112
- }
113
- else {
114
- importMap.set(name, absSpecifier);
115
- }
116
- },
117
- ExportNamedDeclaration(node) {
118
- if (!node.source)
119
- return;
120
- const specifier = node.source.value;
121
- if (!isLocalSpecifier(specifier))
122
- return;
123
- const absSpecifier = join(dir, specifier);
124
- for (const s of node.specifiers) {
125
- const name = s.exported.type === 'Identifier' ? s.exported.name : s.exported.value;
126
- if (name)
127
- importMap.set(name, absSpecifier);
128
- }
129
- },
130
- });
131
- matchVisitor.visit(result.program);
132
- return { importMap, componentMap };
133
- }
@@ -1,2 +0,0 @@
1
- import type { Program } from 'oxc-parser';
2
- export declare const getInputFromAST: (program: Program) => Set<string>;
@@ -1,4 +0,0 @@
1
- import { collectPropertyValues } from '../../typescript/ast-helpers.js';
2
- export const getInputFromAST = (program) => {
3
- return collectPropertyValues(program, 'input');
4
- };
@@ -1,2 +0,0 @@
1
- import type { Program } from 'oxc-parser';
2
- export declare const getInputFromAST: (program: Program) => Set<string>;
@@ -1,4 +0,0 @@
1
- import { collectPropertyValues } from '../../typescript/ast-helpers.js';
2
- export const getInputFromAST = (program) => {
3
- return collectPropertyValues(program, 'input');
4
- };
@@ -1,2 +0,0 @@
1
- import type { Program } from 'oxc-parser';
2
- export declare const getEntryFromAST: (program: Program) => Set<string>;
@@ -1,4 +0,0 @@
1
- import { collectPropertyValues } from '../../typescript/ast-helpers.js';
2
- export const getEntryFromAST = (program) => {
3
- return collectPropertyValues(program, 'entry');
4
- };
@@ -1,2 +0,0 @@
1
- import type { Program } from 'oxc-parser';
2
- export declare const getEntryFromAST: (program: Program) => Set<string>;
@@ -1,4 +0,0 @@
1
- import { collectPropertyValues } from '../../typescript/ast-helpers.js';
2
- export const getEntryFromAST = (program) => {
3
- return collectPropertyValues(program, 'entry');
4
- };
@@ -1,2 +0,0 @@
1
- import type { Program } from 'oxc-parser';
2
- export declare const getEntryFromAST: (program: Program) => Set<string>;
@@ -1,4 +0,0 @@
1
- import { collectPropertyValues } from '../../typescript/ast-helpers.js';
2
- export const getEntryFromAST = (program) => {
3
- return collectPropertyValues(program, 'entry');
4
- };
@@ -1,3 +0,0 @@
1
- import type { CompilerSync } from '../../compilers/types.ts';
2
- declare const compiler: CompilerSync;
3
- export default compiler;
@@ -1,10 +0,0 @@
1
- import { scriptBodies } from '../../compilers/compilers.js';
2
- import { stylePreprocessorImports } from '../../compilers/style-preprocessors.js';
3
- const compiler = (text, path) => {
4
- const scripts = scriptBodies(text, path);
5
- const styles = stylePreprocessorImports(text, path);
6
- if (!scripts)
7
- return styles;
8
- return styles ? `${scripts};\n${styles}` : scripts;
9
- };
10
- export default compiler;