knip 5.47.0 → 5.48.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 (65) hide show
  1. package/dist/ConfigurationChief.d.ts +3 -0
  2. package/dist/ProjectPrincipal.d.ts +2 -2
  3. package/dist/ProjectPrincipal.js +9 -7
  4. package/dist/WorkspaceWorker.d.ts +9 -8
  5. package/dist/WorkspaceWorker.js +100 -72
  6. package/dist/cli.js +2 -2
  7. package/dist/compilers/index.d.ts +31 -0
  8. package/dist/graph/analyze.js +0 -2
  9. package/dist/graph/build.js +7 -8
  10. package/dist/plugins/astro/index.d.ts +1 -0
  11. package/dist/plugins/astro/index.js +3 -1
  12. package/dist/plugins/ava/index.js +1 -1
  13. package/dist/plugins/index.d.ts +27 -2
  14. package/dist/plugins/index.js +6 -0
  15. package/dist/plugins/jest/index.js +3 -1
  16. package/dist/plugins/next/index.d.ts +3 -2
  17. package/dist/plugins/next/index.js +19 -8
  18. package/dist/plugins/next/resolveFromAST.d.ts +2 -0
  19. package/dist/plugins/next/resolveFromAST.js +15 -0
  20. package/dist/plugins/nodemon/index.js +1 -1
  21. package/dist/plugins/nuxt/index.d.ts +1 -1
  22. package/dist/plugins/nuxt/index.js +2 -2
  23. package/dist/plugins/playwright/index.js +1 -3
  24. package/dist/plugins/react-router/index.js +3 -1
  25. package/dist/plugins/sst/index.d.ts +9 -0
  26. package/dist/plugins/sst/index.js +17 -0
  27. package/dist/plugins/sst/resolveFromAST.d.ts +2 -0
  28. package/dist/plugins/sst/resolveFromAST.js +47 -0
  29. package/dist/plugins/starlight/index.d.ts +9 -0
  30. package/dist/plugins/starlight/index.js +18 -0
  31. package/dist/plugins/starlight/resolveFromAST.d.ts +2 -0
  32. package/dist/plugins/starlight/resolveFromAST.js +20 -0
  33. package/dist/plugins/storybook/index.js +4 -1
  34. package/dist/plugins/tanstack-router/index.d.ts +12 -0
  35. package/dist/plugins/tanstack-router/index.js +46 -0
  36. package/dist/plugins/tanstack-router/resolveFromAST.d.ts +2 -0
  37. package/dist/plugins/tanstack-router/resolveFromAST.js +28 -0
  38. package/dist/plugins/tanstack-router/types.d.ts +7 -0
  39. package/dist/plugins/tanstack-router/types.js +1 -0
  40. package/dist/reporters/codeowners.js +8 -6
  41. package/dist/reporters/json.js +3 -3
  42. package/dist/schema/configuration.d.ts +172 -1
  43. package/dist/schema/configuration.js +3 -1
  44. package/dist/schema/plugins.d.ts +69 -0
  45. package/dist/schema/plugins.js +3 -0
  46. package/dist/types/PluginNames.d.ts +2 -2
  47. package/dist/types/PluginNames.js +3 -0
  48. package/dist/types/config.d.ts +8 -0
  49. package/dist/typescript/ast-helpers.d.ts +4 -0
  50. package/dist/typescript/ast-helpers.js +62 -0
  51. package/dist/typescript/create-hosts.d.ts +3 -2
  52. package/dist/typescript/create-hosts.js +1 -3
  53. package/dist/util/Performance.js +7 -7
  54. package/dist/util/codeowners.d.ts +2 -0
  55. package/dist/util/codeowners.js +32 -0
  56. package/dist/util/errors.d.ts +1 -1
  57. package/dist/util/errors.js +2 -2
  58. package/dist/util/math.d.ts +6 -0
  59. package/dist/util/math.js +11 -0
  60. package/dist/util/plugin.d.ts +0 -2
  61. package/dist/util/plugin.js +1 -14
  62. package/dist/version.d.ts +1 -1
  63. package/dist/version.js +1 -1
  64. package/package.json +3 -5
  65. package/schema.json +12 -0
@@ -1,5 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  export declare const knipConfigurationSchema: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.extendShape<z.objectUtil.extendShape<{
3
+ $schema: z.ZodOptional<z.ZodString>;
3
4
  rules: z.ZodOptional<z.ZodRecord<z.ZodUnion<[z.ZodLiteral<"files">, z.ZodLiteral<"dependencies">, z.ZodLiteral<"devDependencies">, z.ZodLiteral<"optionalPeerDependencies">, z.ZodLiteral<"unlisted">, z.ZodLiteral<"binaries">, z.ZodLiteral<"unresolved">, z.ZodLiteral<"exports">, z.ZodLiteral<"types">, z.ZodLiteral<"nsExports">, z.ZodLiteral<"nsTypes">, z.ZodLiteral<"duplicates">, z.ZodLiteral<"enumMembers">, z.ZodLiteral<"classMembers">]>, z.ZodEnum<["error", "warn", "off"]>>>;
4
5
  entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
5
6
  project: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
@@ -889,6 +890,32 @@ export declare const knipConfigurationSchema: z.ZodObject<z.objectUtil.extendSha
889
890
  entry?: string | string[] | undefined;
890
891
  project?: string | string[] | undefined;
891
892
  }>]>>;
893
+ sst: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
894
+ config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
895
+ entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
896
+ project: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
897
+ }, "strip", z.ZodTypeAny, {
898
+ config?: string | string[] | undefined;
899
+ entry?: string | string[] | undefined;
900
+ project?: string | string[] | undefined;
901
+ }, {
902
+ config?: string | string[] | undefined;
903
+ entry?: string | string[] | undefined;
904
+ project?: string | string[] | undefined;
905
+ }>]>>;
906
+ starlight: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
907
+ config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
908
+ entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
909
+ project: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
910
+ }, "strip", z.ZodTypeAny, {
911
+ config?: string | string[] | undefined;
912
+ entry?: string | string[] | undefined;
913
+ project?: string | string[] | undefined;
914
+ }, {
915
+ config?: string | string[] | undefined;
916
+ entry?: string | string[] | undefined;
917
+ project?: string | string[] | undefined;
918
+ }>]>>;
892
919
  storybook: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
893
920
  config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
894
921
  entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
@@ -967,6 +994,19 @@ export declare const knipConfigurationSchema: z.ZodObject<z.objectUtil.extendSha
967
994
  entry?: string | string[] | undefined;
968
995
  project?: string | string[] | undefined;
969
996
  }>]>>;
997
+ 'tanstack-router': z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
998
+ config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
999
+ entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
1000
+ project: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
1001
+ }, "strip", z.ZodTypeAny, {
1002
+ config?: string | string[] | undefined;
1003
+ entry?: string | string[] | undefined;
1004
+ project?: string | string[] | undefined;
1005
+ }, {
1006
+ config?: string | string[] | undefined;
1007
+ entry?: string | string[] | undefined;
1008
+ project?: string | string[] | undefined;
1009
+ }>]>>;
970
1010
  travis: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
971
1011
  config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
972
1012
  entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
@@ -1560,6 +1600,16 @@ export declare const knipConfigurationSchema: z.ZodObject<z.objectUtil.extendSha
1560
1600
  entry?: string | string[] | undefined;
1561
1601
  project?: string | string[] | undefined;
1562
1602
  } | undefined;
1603
+ sst?: string | boolean | string[] | {
1604
+ config?: string | string[] | undefined;
1605
+ entry?: string | string[] | undefined;
1606
+ project?: string | string[] | undefined;
1607
+ } | undefined;
1608
+ starlight?: string | boolean | string[] | {
1609
+ config?: string | string[] | undefined;
1610
+ entry?: string | string[] | undefined;
1611
+ project?: string | string[] | undefined;
1612
+ } | undefined;
1563
1613
  storybook?: string | boolean | string[] | {
1564
1614
  config?: string | string[] | undefined;
1565
1615
  entry?: string | string[] | undefined;
@@ -1590,6 +1640,11 @@ export declare const knipConfigurationSchema: z.ZodObject<z.objectUtil.extendSha
1590
1640
  entry?: string | string[] | undefined;
1591
1641
  project?: string | string[] | undefined;
1592
1642
  } | undefined;
1643
+ 'tanstack-router'?: string | boolean | string[] | {
1644
+ config?: string | string[] | undefined;
1645
+ entry?: string | string[] | undefined;
1646
+ project?: string | string[] | undefined;
1647
+ } | undefined;
1593
1648
  travis?: string | boolean | string[] | {
1594
1649
  config?: string | string[] | undefined;
1595
1650
  entry?: string | string[] | undefined;
@@ -2030,6 +2085,16 @@ export declare const knipConfigurationSchema: z.ZodObject<z.objectUtil.extendSha
2030
2085
  entry?: string | string[] | undefined;
2031
2086
  project?: string | string[] | undefined;
2032
2087
  } | undefined;
2088
+ sst?: string | boolean | string[] | {
2089
+ config?: string | string[] | undefined;
2090
+ entry?: string | string[] | undefined;
2091
+ project?: string | string[] | undefined;
2092
+ } | undefined;
2093
+ starlight?: string | boolean | string[] | {
2094
+ config?: string | string[] | undefined;
2095
+ entry?: string | string[] | undefined;
2096
+ project?: string | string[] | undefined;
2097
+ } | undefined;
2033
2098
  storybook?: string | boolean | string[] | {
2034
2099
  config?: string | string[] | undefined;
2035
2100
  entry?: string | string[] | undefined;
@@ -2060,6 +2125,11 @@ export declare const knipConfigurationSchema: z.ZodObject<z.objectUtil.extendSha
2060
2125
  entry?: string | string[] | undefined;
2061
2126
  project?: string | string[] | undefined;
2062
2127
  } | undefined;
2128
+ 'tanstack-router'?: string | boolean | string[] | {
2129
+ config?: string | string[] | undefined;
2130
+ entry?: string | string[] | undefined;
2131
+ project?: string | string[] | undefined;
2132
+ } | undefined;
2063
2133
  travis?: string | boolean | string[] | {
2064
2134
  config?: string | string[] | undefined;
2065
2135
  entry?: string | string[] | undefined;
@@ -3027,6 +3097,32 @@ export declare const knipConfigurationSchema: z.ZodObject<z.objectUtil.extendSha
3027
3097
  entry?: string | string[] | undefined;
3028
3098
  project?: string | string[] | undefined;
3029
3099
  }>]>>;
3100
+ sst: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
3101
+ config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
3102
+ entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
3103
+ project: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
3104
+ }, "strip", z.ZodTypeAny, {
3105
+ config?: string | string[] | undefined;
3106
+ entry?: string | string[] | undefined;
3107
+ project?: string | string[] | undefined;
3108
+ }, {
3109
+ config?: string | string[] | undefined;
3110
+ entry?: string | string[] | undefined;
3111
+ project?: string | string[] | undefined;
3112
+ }>]>>;
3113
+ starlight: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
3114
+ config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
3115
+ entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
3116
+ project: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
3117
+ }, "strip", z.ZodTypeAny, {
3118
+ config?: string | string[] | undefined;
3119
+ entry?: string | string[] | undefined;
3120
+ project?: string | string[] | undefined;
3121
+ }, {
3122
+ config?: string | string[] | undefined;
3123
+ entry?: string | string[] | undefined;
3124
+ project?: string | string[] | undefined;
3125
+ }>]>>;
3030
3126
  storybook: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
3031
3127
  config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
3032
3128
  entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
@@ -3105,6 +3201,19 @@ export declare const knipConfigurationSchema: z.ZodObject<z.objectUtil.extendSha
3105
3201
  entry?: string | string[] | undefined;
3106
3202
  project?: string | string[] | undefined;
3107
3203
  }>]>>;
3204
+ 'tanstack-router': z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
3205
+ config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
3206
+ entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
3207
+ project: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
3208
+ }, "strip", z.ZodTypeAny, {
3209
+ config?: string | string[] | undefined;
3210
+ entry?: string | string[] | undefined;
3211
+ project?: string | string[] | undefined;
3212
+ }, {
3213
+ config?: string | string[] | undefined;
3214
+ entry?: string | string[] | undefined;
3215
+ project?: string | string[] | undefined;
3216
+ }>]>>;
3108
3217
  travis: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
3109
3218
  config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
3110
3219
  entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
@@ -3365,7 +3474,7 @@ export declare const knipConfigurationSchema: z.ZodObject<z.objectUtil.extendSha
3365
3474
  entry?: string | string[] | undefined;
3366
3475
  project?: string | string[] | undefined;
3367
3476
  }>]>>;
3368
- }>, "strip", z.ZodTypeAny, {
3477
+ }>, "strict", z.ZodTypeAny, {
3369
3478
  exclude?: ("dependencies" | "exports" | "files" | "devDependencies" | "optionalPeerDependencies" | "unlisted" | "binaries" | "unresolved" | "types" | "nsExports" | "nsTypes" | "duplicates" | "enumMembers" | "classMembers")[] | undefined;
3370
3479
  tags?: string[] | undefined;
3371
3480
  include?: ("dependencies" | "exports" | "files" | "devDependencies" | "optionalPeerDependencies" | "unlisted" | "binaries" | "unresolved" | "types" | "nsExports" | "nsTypes" | "duplicates" | "enumMembers" | "classMembers")[] | undefined;
@@ -3701,6 +3810,16 @@ export declare const knipConfigurationSchema: z.ZodObject<z.objectUtil.extendSha
3701
3810
  entry?: string | string[] | undefined;
3702
3811
  project?: string | string[] | undefined;
3703
3812
  } | undefined;
3813
+ sst?: string | boolean | string[] | {
3814
+ config?: string | string[] | undefined;
3815
+ entry?: string | string[] | undefined;
3816
+ project?: string | string[] | undefined;
3817
+ } | undefined;
3818
+ starlight?: string | boolean | string[] | {
3819
+ config?: string | string[] | undefined;
3820
+ entry?: string | string[] | undefined;
3821
+ project?: string | string[] | undefined;
3822
+ } | undefined;
3704
3823
  storybook?: string | boolean | string[] | {
3705
3824
  config?: string | string[] | undefined;
3706
3825
  entry?: string | string[] | undefined;
@@ -3731,6 +3850,11 @@ export declare const knipConfigurationSchema: z.ZodObject<z.objectUtil.extendSha
3731
3850
  entry?: string | string[] | undefined;
3732
3851
  project?: string | string[] | undefined;
3733
3852
  } | undefined;
3853
+ 'tanstack-router'?: string | boolean | string[] | {
3854
+ config?: string | string[] | undefined;
3855
+ entry?: string | string[] | undefined;
3856
+ project?: string | string[] | undefined;
3857
+ } | undefined;
3734
3858
  travis?: string | boolean | string[] | {
3735
3859
  config?: string | string[] | undefined;
3736
3860
  entry?: string | string[] | undefined;
@@ -3831,6 +3955,7 @@ export declare const knipConfigurationSchema: z.ZodObject<z.objectUtil.extendSha
3831
3955
  entry?: string | string[] | undefined;
3832
3956
  project?: string | string[] | undefined;
3833
3957
  } | undefined;
3958
+ $schema?: string | undefined;
3834
3959
  rules?: Partial<Record<"dependencies" | "exports" | "files" | "devDependencies" | "optionalPeerDependencies" | "unlisted" | "binaries" | "unresolved" | "types" | "nsExports" | "nsTypes" | "duplicates" | "enumMembers" | "classMembers", "error" | "warn" | "off">> | undefined;
3835
3960
  paths?: Record<string, string[]> | undefined;
3836
3961
  ignore?: string | string[] | undefined;
@@ -4177,6 +4302,16 @@ export declare const knipConfigurationSchema: z.ZodObject<z.objectUtil.extendSha
4177
4302
  entry?: string | string[] | undefined;
4178
4303
  project?: string | string[] | undefined;
4179
4304
  } | undefined;
4305
+ sst?: string | boolean | string[] | {
4306
+ config?: string | string[] | undefined;
4307
+ entry?: string | string[] | undefined;
4308
+ project?: string | string[] | undefined;
4309
+ } | undefined;
4310
+ starlight?: string | boolean | string[] | {
4311
+ config?: string | string[] | undefined;
4312
+ entry?: string | string[] | undefined;
4313
+ project?: string | string[] | undefined;
4314
+ } | undefined;
4180
4315
  storybook?: string | boolean | string[] | {
4181
4316
  config?: string | string[] | undefined;
4182
4317
  entry?: string | string[] | undefined;
@@ -4207,6 +4342,11 @@ export declare const knipConfigurationSchema: z.ZodObject<z.objectUtil.extendSha
4207
4342
  entry?: string | string[] | undefined;
4208
4343
  project?: string | string[] | undefined;
4209
4344
  } | undefined;
4345
+ 'tanstack-router'?: string | boolean | string[] | {
4346
+ config?: string | string[] | undefined;
4347
+ entry?: string | string[] | undefined;
4348
+ project?: string | string[] | undefined;
4349
+ } | undefined;
4210
4350
  travis?: string | boolean | string[] | {
4211
4351
  config?: string | string[] | undefined;
4212
4352
  entry?: string | string[] | undefined;
@@ -4651,6 +4791,16 @@ export declare const knipConfigurationSchema: z.ZodObject<z.objectUtil.extendSha
4651
4791
  entry?: string | string[] | undefined;
4652
4792
  project?: string | string[] | undefined;
4653
4793
  } | undefined;
4794
+ sst?: string | boolean | string[] | {
4795
+ config?: string | string[] | undefined;
4796
+ entry?: string | string[] | undefined;
4797
+ project?: string | string[] | undefined;
4798
+ } | undefined;
4799
+ starlight?: string | boolean | string[] | {
4800
+ config?: string | string[] | undefined;
4801
+ entry?: string | string[] | undefined;
4802
+ project?: string | string[] | undefined;
4803
+ } | undefined;
4654
4804
  storybook?: string | boolean | string[] | {
4655
4805
  config?: string | string[] | undefined;
4656
4806
  entry?: string | string[] | undefined;
@@ -4681,6 +4831,11 @@ export declare const knipConfigurationSchema: z.ZodObject<z.objectUtil.extendSha
4681
4831
  entry?: string | string[] | undefined;
4682
4832
  project?: string | string[] | undefined;
4683
4833
  } | undefined;
4834
+ 'tanstack-router'?: string | boolean | string[] | {
4835
+ config?: string | string[] | undefined;
4836
+ entry?: string | string[] | undefined;
4837
+ project?: string | string[] | undefined;
4838
+ } | undefined;
4684
4839
  travis?: string | boolean | string[] | {
4685
4840
  config?: string | string[] | undefined;
4686
4841
  entry?: string | string[] | undefined;
@@ -4781,6 +4936,7 @@ export declare const knipConfigurationSchema: z.ZodObject<z.objectUtil.extendSha
4781
4936
  entry?: string | string[] | undefined;
4782
4937
  project?: string | string[] | undefined;
4783
4938
  } | undefined;
4939
+ $schema?: string | undefined;
4784
4940
  rules?: Partial<Record<"dependencies" | "exports" | "files" | "devDependencies" | "optionalPeerDependencies" | "unlisted" | "binaries" | "unresolved" | "types" | "nsExports" | "nsTypes" | "duplicates" | "enumMembers" | "classMembers", "error" | "warn" | "off">> | undefined;
4785
4941
  paths?: Record<string, string[]> | undefined;
4786
4942
  ignore?: string | string[] | undefined;
@@ -5127,6 +5283,16 @@ export declare const knipConfigurationSchema: z.ZodObject<z.objectUtil.extendSha
5127
5283
  entry?: string | string[] | undefined;
5128
5284
  project?: string | string[] | undefined;
5129
5285
  } | undefined;
5286
+ sst?: string | boolean | string[] | {
5287
+ config?: string | string[] | undefined;
5288
+ entry?: string | string[] | undefined;
5289
+ project?: string | string[] | undefined;
5290
+ } | undefined;
5291
+ starlight?: string | boolean | string[] | {
5292
+ config?: string | string[] | undefined;
5293
+ entry?: string | string[] | undefined;
5294
+ project?: string | string[] | undefined;
5295
+ } | undefined;
5130
5296
  storybook?: string | boolean | string[] | {
5131
5297
  config?: string | string[] | undefined;
5132
5298
  entry?: string | string[] | undefined;
@@ -5157,6 +5323,11 @@ export declare const knipConfigurationSchema: z.ZodObject<z.objectUtil.extendSha
5157
5323
  entry?: string | string[] | undefined;
5158
5324
  project?: string | string[] | undefined;
5159
5325
  } | undefined;
5326
+ 'tanstack-router'?: string | boolean | string[] | {
5327
+ config?: string | string[] | undefined;
5328
+ entry?: string | string[] | undefined;
5329
+ project?: string | string[] | undefined;
5330
+ } | undefined;
5160
5331
  travis?: string | boolean | string[] | {
5161
5332
  config?: string | string[] | undefined;
5162
5333
  entry?: string | string[] | undefined;
@@ -35,6 +35,7 @@ const ignoreExportsUsedInFileSchema = z.union([
35
35
  ]), z.boolean()),
36
36
  ]);
37
37
  const rootConfigurationSchema = z.object({
38
+ $schema: z.string().optional(),
38
39
  rules: rulesSchema.optional(),
39
40
  entry: globSchema.optional(),
40
41
  project: globSchema.optional(),
@@ -74,4 +75,5 @@ const workspacesConfigurationSchema = z.object({
74
75
  export const knipConfigurationSchema = rootConfigurationSchema
75
76
  .merge(reportConfigSchema)
76
77
  .merge(workspacesConfigurationSchema)
77
- .merge(pluginsSchema.partial());
78
+ .merge(pluginsSchema.partial())
79
+ .strict();
@@ -872,6 +872,32 @@ export declare const pluginsSchema: z.ZodObject<{
872
872
  entry?: string | string[] | undefined;
873
873
  project?: string | string[] | undefined;
874
874
  }>]>;
875
+ sst: z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
876
+ config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
877
+ entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
878
+ project: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
879
+ }, "strip", z.ZodTypeAny, {
880
+ config?: string | string[] | undefined;
881
+ entry?: string | string[] | undefined;
882
+ project?: string | string[] | undefined;
883
+ }, {
884
+ config?: string | string[] | undefined;
885
+ entry?: string | string[] | undefined;
886
+ project?: string | string[] | undefined;
887
+ }>]>;
888
+ starlight: z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
889
+ config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
890
+ entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
891
+ project: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
892
+ }, "strip", z.ZodTypeAny, {
893
+ config?: string | string[] | undefined;
894
+ entry?: string | string[] | undefined;
895
+ project?: string | string[] | undefined;
896
+ }, {
897
+ config?: string | string[] | undefined;
898
+ entry?: string | string[] | undefined;
899
+ project?: string | string[] | undefined;
900
+ }>]>;
875
901
  storybook: z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
876
902
  config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
877
903
  entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
@@ -950,6 +976,19 @@ export declare const pluginsSchema: z.ZodObject<{
950
976
  entry?: string | string[] | undefined;
951
977
  project?: string | string[] | undefined;
952
978
  }>]>;
979
+ 'tanstack-router': z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
980
+ config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
981
+ entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
982
+ project: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
983
+ }, "strip", z.ZodTypeAny, {
984
+ config?: string | string[] | undefined;
985
+ entry?: string | string[] | undefined;
986
+ project?: string | string[] | undefined;
987
+ }, {
988
+ config?: string | string[] | undefined;
989
+ entry?: string | string[] | undefined;
990
+ project?: string | string[] | undefined;
991
+ }>]>;
953
992
  travis: z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
954
993
  config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
955
994
  entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
@@ -1541,6 +1580,16 @@ export declare const pluginsSchema: z.ZodObject<{
1541
1580
  entry?: string | string[] | undefined;
1542
1581
  project?: string | string[] | undefined;
1543
1582
  };
1583
+ sst: string | boolean | string[] | {
1584
+ config?: string | string[] | undefined;
1585
+ entry?: string | string[] | undefined;
1586
+ project?: string | string[] | undefined;
1587
+ };
1588
+ starlight: string | boolean | string[] | {
1589
+ config?: string | string[] | undefined;
1590
+ entry?: string | string[] | undefined;
1591
+ project?: string | string[] | undefined;
1592
+ };
1544
1593
  storybook: string | boolean | string[] | {
1545
1594
  config?: string | string[] | undefined;
1546
1595
  entry?: string | string[] | undefined;
@@ -1571,6 +1620,11 @@ export declare const pluginsSchema: z.ZodObject<{
1571
1620
  entry?: string | string[] | undefined;
1572
1621
  project?: string | string[] | undefined;
1573
1622
  };
1623
+ 'tanstack-router': string | boolean | string[] | {
1624
+ config?: string | string[] | undefined;
1625
+ entry?: string | string[] | undefined;
1626
+ project?: string | string[] | undefined;
1627
+ };
1574
1628
  travis: string | boolean | string[] | {
1575
1629
  config?: string | string[] | undefined;
1576
1630
  entry?: string | string[] | undefined;
@@ -2002,6 +2056,16 @@ export declare const pluginsSchema: z.ZodObject<{
2002
2056
  entry?: string | string[] | undefined;
2003
2057
  project?: string | string[] | undefined;
2004
2058
  };
2059
+ sst: string | boolean | string[] | {
2060
+ config?: string | string[] | undefined;
2061
+ entry?: string | string[] | undefined;
2062
+ project?: string | string[] | undefined;
2063
+ };
2064
+ starlight: string | boolean | string[] | {
2065
+ config?: string | string[] | undefined;
2066
+ entry?: string | string[] | undefined;
2067
+ project?: string | string[] | undefined;
2068
+ };
2005
2069
  storybook: string | boolean | string[] | {
2006
2070
  config?: string | string[] | undefined;
2007
2071
  entry?: string | string[] | undefined;
@@ -2032,6 +2096,11 @@ export declare const pluginsSchema: z.ZodObject<{
2032
2096
  entry?: string | string[] | undefined;
2033
2097
  project?: string | string[] | undefined;
2034
2098
  };
2099
+ 'tanstack-router': string | boolean | string[] | {
2100
+ config?: string | string[] | undefined;
2101
+ entry?: string | string[] | undefined;
2102
+ project?: string | string[] | undefined;
2103
+ };
2035
2104
  travis: string | boolean | string[] | {
2036
2105
  config?: string | string[] | undefined;
2037
2106
  entry?: string | string[] | undefined;
@@ -76,12 +76,15 @@ export const pluginsSchema = z.object({
76
76
  sentry: pluginSchema,
77
77
  'simple-git-hooks': pluginSchema,
78
78
  'size-limit': pluginSchema,
79
+ sst: pluginSchema,
80
+ starlight: pluginSchema,
79
81
  storybook: pluginSchema,
80
82
  stryker: pluginSchema,
81
83
  stylelint: pluginSchema,
82
84
  svelte: pluginSchema,
83
85
  syncpack: pluginSchema,
84
86
  tailwind: pluginSchema,
87
+ 'tanstack-router': pluginSchema,
85
88
  travis: pluginSchema,
86
89
  'ts-node': pluginSchema,
87
90
  tsup: pluginSchema,
@@ -1,2 +1,2 @@
1
- export type PluginName = 'angular' | 'astro' | 'ava' | 'babel' | 'c8' | 'capacitor' | 'changesets' | 'commitizen' | 'commitlint' | 'cspell' | 'cucumber' | 'cypress' | 'dependency-cruiser' | 'dotenv' | 'drizzle' | 'eleventy' | 'eslint' | 'expo' | 'gatsby' | 'github-action' | 'github-actions' | 'glob' | 'graphql-codegen' | 'husky' | 'jest' | 'karma' | 'ladle' | 'lefthook' | 'lint-staged' | 'linthtml' | 'lockfile-lint' | 'lost-pixel' | 'markdownlint' | 'metro' | 'mocha' | 'moonrepo' | 'msw' | 'nest' | 'netlify' | 'next' | 'node' | 'nodemon' | 'npm-package-json-lint' | 'nuxt' | 'nx' | 'nyc' | 'oclif' | 'playwright' | 'playwright-ct' | 'playwright-test' | 'plop' | 'postcss' | 'preconstruct' | 'prettier' | 'react-cosmos' | 'react-router' | 'release-it' | 'remark' | 'remix' | 'rollup' | 'rsbuild' | 'rspack' | 'semantic-release' | 'sentry' | 'simple-git-hooks' | 'size-limit' | 'storybook' | 'stryker' | 'stylelint' | 'svelte' | 'syncpack' | 'tailwind' | 'travis' | 'ts-node' | 'tsup' | 'tsx' | 'typedoc' | 'typescript' | 'unbuild' | 'unocss' | 'vercel-og' | 'vike' | 'vite' | 'vitest' | 'vue' | 'webdriver-io' | 'webpack' | 'wireit' | 'wrangler' | 'xo' | 'yarn' | 'yorkie';
2
- export declare const pluginNames: readonly ["angular", "astro", "ava", "babel", "c8", "capacitor", "changesets", "commitizen", "commitlint", "cspell", "cucumber", "cypress", "dependency-cruiser", "dotenv", "drizzle", "eleventy", "eslint", "expo", "gatsby", "github-action", "github-actions", "glob", "graphql-codegen", "husky", "jest", "karma", "ladle", "lefthook", "lint-staged", "linthtml", "lockfile-lint", "lost-pixel", "markdownlint", "metro", "mocha", "moonrepo", "msw", "nest", "netlify", "next", "node", "nodemon", "npm-package-json-lint", "nuxt", "nx", "nyc", "oclif", "playwright", "playwright-ct", "playwright-test", "plop", "postcss", "preconstruct", "prettier", "react-cosmos", "react-router", "release-it", "remark", "remix", "rollup", "rsbuild", "rspack", "semantic-release", "sentry", "simple-git-hooks", "size-limit", "storybook", "stryker", "stylelint", "svelte", "syncpack", "tailwind", "travis", "ts-node", "tsup", "tsx", "typedoc", "typescript", "unbuild", "unocss", "vercel-og", "vike", "vite", "vitest", "vue", "webdriver-io", "webpack", "wireit", "wrangler", "xo", "yarn", "yorkie"];
1
+ export type PluginName = 'angular' | 'astro' | 'ava' | 'babel' | 'c8' | 'capacitor' | 'changesets' | 'commitizen' | 'commitlint' | 'cspell' | 'cucumber' | 'cypress' | 'dependency-cruiser' | 'dotenv' | 'drizzle' | 'eleventy' | 'eslint' | 'expo' | 'gatsby' | 'github-action' | 'github-actions' | 'glob' | 'graphql-codegen' | 'husky' | 'jest' | 'karma' | 'ladle' | 'lefthook' | 'lint-staged' | 'linthtml' | 'lockfile-lint' | 'lost-pixel' | 'markdownlint' | 'metro' | 'mocha' | 'moonrepo' | 'msw' | 'nest' | 'netlify' | 'next' | 'node' | 'nodemon' | 'npm-package-json-lint' | 'nuxt' | 'nx' | 'nyc' | 'oclif' | 'playwright' | 'playwright-ct' | 'playwright-test' | 'plop' | 'postcss' | 'preconstruct' | 'prettier' | 'react-cosmos' | 'react-router' | 'release-it' | 'remark' | 'remix' | 'rollup' | 'rsbuild' | 'rspack' | 'semantic-release' | 'sentry' | 'simple-git-hooks' | 'size-limit' | 'sst' | 'starlight' | 'storybook' | 'stryker' | 'stylelint' | 'svelte' | 'syncpack' | 'tailwind' | 'tanstack-router' | 'travis' | 'ts-node' | 'tsup' | 'tsx' | 'typedoc' | 'typescript' | 'unbuild' | 'unocss' | 'vercel-og' | 'vike' | 'vite' | 'vitest' | 'vue' | 'webdriver-io' | 'webpack' | 'wireit' | 'wrangler' | 'xo' | 'yarn' | 'yorkie';
2
+ export declare const pluginNames: readonly ["angular", "astro", "ava", "babel", "c8", "capacitor", "changesets", "commitizen", "commitlint", "cspell", "cucumber", "cypress", "dependency-cruiser", "dotenv", "drizzle", "eleventy", "eslint", "expo", "gatsby", "github-action", "github-actions", "glob", "graphql-codegen", "husky", "jest", "karma", "ladle", "lefthook", "lint-staged", "linthtml", "lockfile-lint", "lost-pixel", "markdownlint", "metro", "mocha", "moonrepo", "msw", "nest", "netlify", "next", "node", "nodemon", "npm-package-json-lint", "nuxt", "nx", "nyc", "oclif", "playwright", "playwright-ct", "playwright-test", "plop", "postcss", "preconstruct", "prettier", "react-cosmos", "react-router", "release-it", "remark", "remix", "rollup", "rsbuild", "rspack", "semantic-release", "sentry", "simple-git-hooks", "size-limit", "sst", "starlight", "storybook", "stryker", "stylelint", "svelte", "syncpack", "tailwind", "tanstack-router", "travis", "ts-node", "tsup", "tsx", "typedoc", "typescript", "unbuild", "unocss", "vercel-og", "vike", "vite", "vitest", "vue", "webdriver-io", "webpack", "wireit", "wrangler", "xo", "yarn", "yorkie"];
@@ -65,12 +65,15 @@ export const pluginNames = [
65
65
  'sentry',
66
66
  'simple-git-hooks',
67
67
  'size-limit',
68
+ 'sst',
69
+ 'starlight',
68
70
  'storybook',
69
71
  'stryker',
70
72
  'stylelint',
71
73
  'svelte',
72
74
  'syncpack',
73
75
  'tailwind',
76
+ 'tanstack-router',
74
77
  'travis',
75
78
  'ts-node',
76
79
  'tsup',
@@ -1,3 +1,4 @@
1
+ import type ts from 'typescript';
1
2
  import type { z } from 'zod';
2
3
  import type { AsyncCompilers, SyncCompilers } from '../compilers/types.js';
3
4
  import type { knipConfigurationSchema } from '../schema/configuration.js';
@@ -91,6 +92,12 @@ export interface PluginOptions extends BaseOptions {
91
92
  export type ResolveEntryPaths<T = any> = (config: T, options: PluginOptions) => Promise<Input[]> | Input[];
92
93
  export type ResolveConfig<T = any> = (config: T, options: PluginOptions) => Promise<Input[]> | Input[];
93
94
  export type Resolve = (options: PluginOptions) => Promise<Input[]> | Input[];
95
+ export type GetSourceFile = (filePath: string) => ts.SourceFile | undefined;
96
+ export type GetReferencedInternalFilePath = (input: Input) => string | undefined;
97
+ export type ResolveFromAST = (sourceFile: ts.SourceFile, options: PluginOptions & {
98
+ getSourceFile: GetSourceFile;
99
+ getReferencedInternalFilePath: GetReferencedInternalFilePath;
100
+ }) => Input[];
94
101
  export interface Plugin {
95
102
  title: string;
96
103
  args?: Args;
@@ -105,6 +112,7 @@ export interface Plugin {
105
112
  resolveEntryPaths?: ResolveEntryPaths;
106
113
  resolveConfig?: ResolveConfig;
107
114
  resolve?: Resolve;
115
+ resolveFromAST?: ResolveFromAST;
108
116
  }
109
117
  export type PluginMap = Record<PluginName, Plugin>;
110
118
  export type Entries = [PluginName, Plugin][];
@@ -32,3 +32,7 @@ export declare const getExportKeywordNode: (node: ts.Node) => ts.ExportKeyword |
32
32
  export declare const getDefaultKeywordNode: (node: ts.Node) => ts.DefaultKeyword | undefined;
33
33
  export declare const hasRequireCall: (node: ts.Node) => boolean;
34
34
  export declare const isModuleExportsAccess: (node: ts.PropertyAccessExpression) => boolean;
35
+ export declare const getImportMap: (sourceFile: ts.SourceFile) => Map<string, string>;
36
+ export declare const getDefaultImportName: (importMap: ReturnType<typeof getImportMap>, specifier: string) => string | undefined;
37
+ export declare const getPropertyValues: (node: ts.ObjectLiteralExpression, propertyName: string) => Set<string>;
38
+ export declare const getPropertyValueEntries: (node: ts.ObjectLiteralExpression, propertyNames: Set<string>) => [string, string][];
@@ -197,3 +197,65 @@ export const hasRequireCall = (node) => {
197
197
  return node.getChildren().some(child => hasRequireCall(child));
198
198
  };
199
199
  export const isModuleExportsAccess = (node) => ts.isIdentifier(node.expression) && node.expression.escapedText === 'module' && node.name.escapedText === 'exports';
200
+ export const getImportMap = (sourceFile) => {
201
+ const importMap = new Map();
202
+ for (const statement of sourceFile.statements) {
203
+ if (ts.isImportDeclaration(statement)) {
204
+ const importClause = statement.importClause;
205
+ const importPath = stripQuotes(statement.moduleSpecifier.getText());
206
+ if (importClause?.name)
207
+ importMap.set(importClause.name.text, importPath);
208
+ if (importClause?.namedBindings && ts.isNamedImports(importClause.namedBindings)) {
209
+ for (const element of importClause.namedBindings.elements)
210
+ importMap.set(element.name.text, importPath);
211
+ }
212
+ }
213
+ }
214
+ return importMap;
215
+ };
216
+ export const getDefaultImportName = (importMap, specifier) => {
217
+ for (const [importName, importSpecifier] of importMap) {
218
+ if (importSpecifier === specifier)
219
+ return importName;
220
+ }
221
+ };
222
+ export const getPropertyValues = (node, propertyName) => {
223
+ const values = new Set();
224
+ if (ts.isObjectLiteralExpression(node)) {
225
+ const props = node.properties.find(prop => ts.isPropertyAssignment(prop) && prop.name.getText() === propertyName);
226
+ if (props && ts.isPropertyAssignment(props)) {
227
+ const initializer = props.initializer;
228
+ if (ts.isStringLiteral(initializer)) {
229
+ values.add(initializer.text);
230
+ }
231
+ else if (ts.isArrayLiteralExpression(initializer)) {
232
+ for (const element of initializer.elements) {
233
+ if (ts.isStringLiteral(element))
234
+ values.add(element.text);
235
+ }
236
+ }
237
+ else if (ts.isObjectLiteralExpression(initializer)) {
238
+ for (const prop of initializer.properties) {
239
+ if (ts.isPropertyAssignment(prop)) {
240
+ if (ts.isStringLiteral(prop.initializer))
241
+ values.add(prop.initializer.text);
242
+ }
243
+ }
244
+ }
245
+ }
246
+ }
247
+ return values;
248
+ };
249
+ export const getPropertyValueEntries = (node, propertyNames) => {
250
+ const entries = [];
251
+ for (const prop of node.properties) {
252
+ if (ts.isPropertyAssignment(prop) && ts.isIdentifier(prop.name)) {
253
+ if (propertyNames.has(prop.name.text)) {
254
+ if (ts.isStringLiteral(prop.initializer)) {
255
+ entries.push([prop.name.text, prop.initializer.text]);
256
+ }
257
+ }
258
+ }
259
+ }
260
+ return entries;
261
+ };
@@ -1,7 +1,7 @@
1
1
  import ts from 'typescript';
2
2
  import type { AsyncCompilers, SyncCompilers } from '../compilers/types.js';
3
3
  import type { ToSourceFilePath } from '../util/to-source-path.js';
4
- import { SourceFileManager } from './SourceFileManager.js';
4
+ import type { SourceFileManager } from './SourceFileManager.js';
5
5
  type CreateHostsOptions = {
6
6
  cwd: string;
7
7
  compilerOptions: ts.CompilerOptions;
@@ -10,8 +10,9 @@ type CreateHostsOptions = {
10
10
  isSkipLibs: boolean;
11
11
  toSourceFilePath: ToSourceFilePath;
12
12
  useResolverCache: boolean;
13
+ fileManager: SourceFileManager;
13
14
  };
14
- export declare const createHosts: ({ cwd, compilerOptions, entryPaths, compilers, isSkipLibs, toSourceFilePath, useResolverCache, }: CreateHostsOptions) => {
15
+ export declare const createHosts: ({ cwd, compilerOptions, fileManager, entryPaths, compilers, isSkipLibs, toSourceFilePath, useResolverCache, }: CreateHostsOptions) => {
15
16
  fileManager: SourceFileManager;
16
17
  compilerHost: ts.CompilerHost;
17
18
  resolveModuleNames: (moduleNames: string[], containingFile: string) => Array<ts.ResolvedModuleFull | undefined>;
@@ -2,11 +2,9 @@ import { EOL } from 'node:os';
2
2
  import path from 'node:path';
3
3
  import ts from 'typescript';
4
4
  import { getCompilerExtensions } from '../compilers/index.js';
5
- import { SourceFileManager } from './SourceFileManager.js';
6
5
  import { createCustomModuleResolver } from './resolve-module-names.js';
7
6
  const libLocation = path.dirname(ts.getDefaultLibFilePath({}));
8
- export const createHosts = ({ cwd, compilerOptions, entryPaths, compilers, isSkipLibs, toSourceFilePath, useResolverCache, }) => {
9
- const fileManager = new SourceFileManager({ compilers, isSkipLibs });
7
+ export const createHosts = ({ cwd, compilerOptions, fileManager, entryPaths, compilers, isSkipLibs, toSourceFilePath, useResolverCache, }) => {
10
8
  const compilerExtensions = getCompilerExtensions(compilers);
11
9
  const resolveModuleNames = createCustomModuleResolver(compilerOptions, compilerExtensions, toSourceFilePath, useResolverCache, isSkipLibs);
12
10
  const languageServiceHost = {