knip 5.55.1 → 5.57.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 (71) hide show
  1. package/README.md +44 -20
  2. package/dist/CacheConsultant.d.ts +1 -0
  3. package/dist/CacheConsultant.js +1 -1
  4. package/dist/ConfigurationChief.d.ts +5 -0
  5. package/dist/DependencyDeputy.d.ts +2 -0
  6. package/dist/DependencyDeputy.js +6 -0
  7. package/dist/PrincipalFactory.d.ts +2 -9
  8. package/dist/PrincipalFactory.js +10 -6
  9. package/dist/ProjectPrincipal.d.ts +1 -1
  10. package/dist/ProjectPrincipal.js +3 -3
  11. package/dist/WorkspaceWorker.js +1 -1
  12. package/dist/cli.js +6 -5
  13. package/dist/compilers/index.d.ts +50 -0
  14. package/dist/graph/build.js +11 -2
  15. package/dist/plugins/changelogen/index.d.ts +9 -0
  16. package/dist/plugins/changelogen/index.js +14 -0
  17. package/dist/plugins/changelogithub/index.d.ts +9 -0
  18. package/dist/plugins/changelogithub/index.js +14 -0
  19. package/dist/plugins/convex/index.d.ts +8 -0
  20. package/dist/plugins/convex/index.js +11 -0
  21. package/dist/plugins/docusaurus/helpers.d.ts +5 -0
  22. package/dist/plugins/docusaurus/helpers.js +89 -0
  23. package/dist/plugins/docusaurus/index.d.ts +12 -0
  24. package/dist/plugins/docusaurus/index.js +36 -0
  25. package/dist/plugins/docusaurus/types.d.ts +40 -0
  26. package/dist/plugins/docusaurus/types.js +1 -0
  27. package/dist/plugins/hardhat/index.d.ts +9 -0
  28. package/dist/plugins/hardhat/index.js +16 -0
  29. package/dist/plugins/index.d.ts +40 -0
  30. package/dist/plugins/index.js +10 -0
  31. package/dist/plugins/mocha/index.js +5 -2
  32. package/dist/plugins/nx/index.js +1 -1
  33. package/dist/plugins/nx/types.d.ts +3 -1
  34. package/dist/plugins/tsx/index.d.ts +6 -0
  35. package/dist/plugins/tsx/index.js +24 -0
  36. package/dist/reporters/codeclimate.js +3 -3
  37. package/dist/reporters/codeowners.js +15 -30
  38. package/dist/reporters/compact.js +10 -4
  39. package/dist/reporters/disclosure.js +5 -24
  40. package/dist/reporters/markdown.js +2 -2
  41. package/dist/reporters/symbols.d.ts +1 -1
  42. package/dist/reporters/symbols.js +10 -45
  43. package/dist/reporters/util.d.ts +11 -7
  44. package/dist/reporters/util.js +45 -14
  45. package/dist/reporters/watch.js +7 -21
  46. package/dist/schema/configuration.d.ts +280 -0
  47. package/dist/schema/plugins.d.ts +115 -0
  48. package/dist/schema/plugins.js +5 -0
  49. package/dist/types/PluginNames.d.ts +2 -2
  50. package/dist/types/PluginNames.js +5 -0
  51. package/dist/types/project.d.ts +1 -0
  52. package/dist/typescript/resolve-module-names.js +2 -2
  53. package/dist/util/Performance.d.ts +7 -7
  54. package/dist/util/Performance.js +20 -16
  55. package/dist/util/cli-arguments.d.ts +2 -1
  56. package/dist/util/cli-arguments.js +2 -0
  57. package/dist/util/input.d.ts +8 -1
  58. package/dist/util/input.js +6 -0
  59. package/dist/util/math.js +1 -1
  60. package/dist/util/plugin-config.d.ts +8 -0
  61. package/dist/util/plugin-config.js +1 -0
  62. package/dist/util/resolve.d.ts +3 -1
  63. package/dist/util/resolve.js +7 -9
  64. package/dist/util/table.d.ts +4 -2
  65. package/dist/util/table.js +20 -24
  66. package/dist/util/watch.js +2 -2
  67. package/dist/version.d.ts +1 -1
  68. package/dist/version.js +1 -1
  69. package/package.json +2 -2
  70. package/schema.json +20 -0
  71. package/license +0 -12
@@ -105,6 +105,32 @@ export declare const pluginsSchema: z.ZodObject<{
105
105
  entry?: string | string[] | undefined;
106
106
  project?: string | string[] | undefined;
107
107
  }>]>;
108
+ changelogen: z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
109
+ config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
110
+ entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
111
+ project: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
112
+ }, "strip", z.ZodTypeAny, {
113
+ config?: string | string[] | undefined;
114
+ entry?: string | string[] | undefined;
115
+ project?: string | string[] | undefined;
116
+ }, {
117
+ config?: string | string[] | undefined;
118
+ entry?: string | string[] | undefined;
119
+ project?: string | string[] | undefined;
120
+ }>]>;
121
+ changelogithub: z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
122
+ config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
123
+ entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
124
+ project: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
125
+ }, "strip", z.ZodTypeAny, {
126
+ config?: string | string[] | undefined;
127
+ entry?: string | string[] | undefined;
128
+ project?: string | string[] | undefined;
129
+ }, {
130
+ config?: string | string[] | undefined;
131
+ entry?: string | string[] | undefined;
132
+ project?: string | string[] | undefined;
133
+ }>]>;
108
134
  changesets: z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
109
135
  config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
110
136
  entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
@@ -144,6 +170,19 @@ export declare const pluginsSchema: z.ZodObject<{
144
170
  entry?: string | string[] | undefined;
145
171
  project?: string | string[] | undefined;
146
172
  }>]>;
173
+ convex: z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
174
+ config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
175
+ entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
176
+ project: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
177
+ }, "strip", z.ZodTypeAny, {
178
+ config?: string | string[] | undefined;
179
+ entry?: string | string[] | undefined;
180
+ project?: string | string[] | undefined;
181
+ }, {
182
+ config?: string | string[] | undefined;
183
+ entry?: string | string[] | undefined;
184
+ project?: string | string[] | undefined;
185
+ }>]>;
147
186
  'create-typescript-app': z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
148
187
  config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
149
188
  entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
@@ -209,6 +248,19 @@ export declare const pluginsSchema: z.ZodObject<{
209
248
  entry?: string | string[] | undefined;
210
249
  project?: string | string[] | undefined;
211
250
  }>]>;
251
+ docusaurus: z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
252
+ config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
253
+ entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
254
+ project: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
255
+ }, "strip", z.ZodTypeAny, {
256
+ config?: string | string[] | undefined;
257
+ entry?: string | string[] | undefined;
258
+ project?: string | string[] | undefined;
259
+ }, {
260
+ config?: string | string[] | undefined;
261
+ entry?: string | string[] | undefined;
262
+ project?: string | string[] | undefined;
263
+ }>]>;
212
264
  dotenv: z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
213
265
  config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
214
266
  entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
@@ -339,6 +391,19 @@ export declare const pluginsSchema: z.ZodObject<{
339
391
  entry?: string | string[] | undefined;
340
392
  project?: string | string[] | undefined;
341
393
  }>]>;
394
+ hardhat: z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
395
+ config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
396
+ entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
397
+ project: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
398
+ }, "strip", z.ZodTypeAny, {
399
+ config?: string | string[] | undefined;
400
+ entry?: string | string[] | undefined;
401
+ project?: string | string[] | undefined;
402
+ }, {
403
+ config?: string | string[] | undefined;
404
+ entry?: string | string[] | undefined;
405
+ project?: string | string[] | undefined;
406
+ }>]>;
342
407
  husky: z.ZodUnion<[z.ZodBoolean, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>, z.ZodObject<{
343
408
  config: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
344
409
  entry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
@@ -1381,6 +1446,16 @@ export declare const pluginsSchema: z.ZodObject<{
1381
1446
  entry?: string | string[] | undefined;
1382
1447
  project?: string | string[] | undefined;
1383
1448
  };
1449
+ changelogen: string | boolean | string[] | {
1450
+ config?: string | string[] | undefined;
1451
+ entry?: string | string[] | undefined;
1452
+ project?: string | string[] | undefined;
1453
+ };
1454
+ changelogithub: string | boolean | string[] | {
1455
+ config?: string | string[] | undefined;
1456
+ entry?: string | string[] | undefined;
1457
+ project?: string | string[] | undefined;
1458
+ };
1384
1459
  changesets: string | boolean | string[] | {
1385
1460
  config?: string | string[] | undefined;
1386
1461
  entry?: string | string[] | undefined;
@@ -1396,6 +1471,11 @@ export declare const pluginsSchema: z.ZodObject<{
1396
1471
  entry?: string | string[] | undefined;
1397
1472
  project?: string | string[] | undefined;
1398
1473
  };
1474
+ convex: string | boolean | string[] | {
1475
+ config?: string | string[] | undefined;
1476
+ entry?: string | string[] | undefined;
1477
+ project?: string | string[] | undefined;
1478
+ };
1399
1479
  'create-typescript-app': string | boolean | string[] | {
1400
1480
  config?: string | string[] | undefined;
1401
1481
  entry?: string | string[] | undefined;
@@ -1421,6 +1501,11 @@ export declare const pluginsSchema: z.ZodObject<{
1421
1501
  entry?: string | string[] | undefined;
1422
1502
  project?: string | string[] | undefined;
1423
1503
  };
1504
+ docusaurus: string | boolean | string[] | {
1505
+ config?: string | string[] | undefined;
1506
+ entry?: string | string[] | undefined;
1507
+ project?: string | string[] | undefined;
1508
+ };
1424
1509
  dotenv: string | boolean | string[] | {
1425
1510
  config?: string | string[] | undefined;
1426
1511
  entry?: string | string[] | undefined;
@@ -1471,6 +1556,11 @@ export declare const pluginsSchema: z.ZodObject<{
1471
1556
  entry?: string | string[] | undefined;
1472
1557
  project?: string | string[] | undefined;
1473
1558
  };
1559
+ hardhat: string | boolean | string[] | {
1560
+ config?: string | string[] | undefined;
1561
+ entry?: string | string[] | undefined;
1562
+ project?: string | string[] | undefined;
1563
+ };
1474
1564
  husky: string | boolean | string[] | {
1475
1565
  config?: string | string[] | undefined;
1476
1566
  entry?: string | string[] | undefined;
@@ -1892,6 +1982,16 @@ export declare const pluginsSchema: z.ZodObject<{
1892
1982
  entry?: string | string[] | undefined;
1893
1983
  project?: string | string[] | undefined;
1894
1984
  };
1985
+ changelogen: string | boolean | string[] | {
1986
+ config?: string | string[] | undefined;
1987
+ entry?: string | string[] | undefined;
1988
+ project?: string | string[] | undefined;
1989
+ };
1990
+ changelogithub: string | boolean | string[] | {
1991
+ config?: string | string[] | undefined;
1992
+ entry?: string | string[] | undefined;
1993
+ project?: string | string[] | undefined;
1994
+ };
1895
1995
  changesets: string | boolean | string[] | {
1896
1996
  config?: string | string[] | undefined;
1897
1997
  entry?: string | string[] | undefined;
@@ -1907,6 +2007,11 @@ export declare const pluginsSchema: z.ZodObject<{
1907
2007
  entry?: string | string[] | undefined;
1908
2008
  project?: string | string[] | undefined;
1909
2009
  };
2010
+ convex: string | boolean | string[] | {
2011
+ config?: string | string[] | undefined;
2012
+ entry?: string | string[] | undefined;
2013
+ project?: string | string[] | undefined;
2014
+ };
1910
2015
  'create-typescript-app': string | boolean | string[] | {
1911
2016
  config?: string | string[] | undefined;
1912
2017
  entry?: string | string[] | undefined;
@@ -1932,6 +2037,11 @@ export declare const pluginsSchema: z.ZodObject<{
1932
2037
  entry?: string | string[] | undefined;
1933
2038
  project?: string | string[] | undefined;
1934
2039
  };
2040
+ docusaurus: string | boolean | string[] | {
2041
+ config?: string | string[] | undefined;
2042
+ entry?: string | string[] | undefined;
2043
+ project?: string | string[] | undefined;
2044
+ };
1935
2045
  dotenv: string | boolean | string[] | {
1936
2046
  config?: string | string[] | undefined;
1937
2047
  entry?: string | string[] | undefined;
@@ -1982,6 +2092,11 @@ export declare const pluginsSchema: z.ZodObject<{
1982
2092
  entry?: string | string[] | undefined;
1983
2093
  project?: string | string[] | undefined;
1984
2094
  };
2095
+ hardhat: string | boolean | string[] | {
2096
+ config?: string | string[] | undefined;
2097
+ entry?: string | string[] | undefined;
2098
+ project?: string | string[] | undefined;
2099
+ };
1985
2100
  husky: string | boolean | string[] | {
1986
2101
  config?: string | string[] | undefined;
1987
2102
  entry?: string | string[] | undefined;
@@ -17,14 +17,18 @@ export const pluginsSchema = z.object({
17
17
  bun: pluginSchema,
18
18
  c8: pluginSchema,
19
19
  capacitor: pluginSchema,
20
+ changelogen: pluginSchema,
21
+ changelogithub: pluginSchema,
20
22
  changesets: pluginSchema,
21
23
  commitizen: pluginSchema,
22
24
  commitlint: pluginSchema,
25
+ convex: pluginSchema,
23
26
  'create-typescript-app': pluginSchema,
24
27
  cspell: pluginSchema,
25
28
  cucumber: pluginSchema,
26
29
  cypress: pluginSchema,
27
30
  'dependency-cruiser': pluginSchema,
31
+ docusaurus: pluginSchema,
28
32
  dotenv: pluginSchema,
29
33
  drizzle: pluginSchema,
30
34
  eleventy: pluginSchema,
@@ -35,6 +39,7 @@ export const pluginsSchema = z.object({
35
39
  'github-actions': pluginSchema,
36
40
  glob: pluginSchema,
37
41
  'graphql-codegen': pluginSchema,
42
+ hardhat: pluginSchema,
38
43
  husky: pluginSchema,
39
44
  'i18next-parser': pluginSchema,
40
45
  jest: pluginSchema,
@@ -1,2 +1,2 @@
1
- export type PluginName = 'angular' | 'astro' | 'ava' | 'babel' | 'bun' | 'c8' | 'capacitor' | 'changesets' | 'commitizen' | 'commitlint' | 'create-typescript-app' | 'cspell' | 'cucumber' | 'cypress' | 'dependency-cruiser' | 'dotenv' | 'drizzle' | 'eleventy' | 'eslint' | 'expo' | 'gatsby' | 'github-action' | 'github-actions' | 'glob' | 'graphql-codegen' | 'husky' | 'i18next-parser' | 'jest' | 'karma' | 'ladle' | 'lefthook' | 'lint-staged' | 'linthtml' | 'lockfile-lint' | 'lost-pixel' | 'markdownlint' | 'metro' | 'mocha' | 'moonrepo' | 'msw' | 'nano-staged' | 'nest' | 'netlify' | 'next' | 'node' | 'nodemon' | 'npm-package-json-lint' | 'nuxt' | 'nx' | 'nyc' | 'oclif' | 'oxlint' | 'playwright' | 'playwright-ct' | 'playwright-test' | 'plop' | 'postcss' | 'preconstruct' | 'prettier' | 'prisma' | 'react-cosmos' | 'react-router' | 'relay' | 'release-it' | 'remark' | 'remix' | 'rollup' | 'rsbuild' | 'rspack' | 'semantic-release' | 'sentry' | 'simple-git-hooks' | 'size-limit' | 'sst' | 'starlight' | 'storybook' | 'stryker' | 'stylelint' | 'svelte' | 'svgo' | '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", "bun", "c8", "capacitor", "changesets", "commitizen", "commitlint", "create-typescript-app", "cspell", "cucumber", "cypress", "dependency-cruiser", "dotenv", "drizzle", "eleventy", "eslint", "expo", "gatsby", "github-action", "github-actions", "glob", "graphql-codegen", "husky", "i18next-parser", "jest", "karma", "ladle", "lefthook", "lint-staged", "linthtml", "lockfile-lint", "lost-pixel", "markdownlint", "metro", "mocha", "moonrepo", "msw", "nano-staged", "nest", "netlify", "next", "node", "nodemon", "npm-package-json-lint", "nuxt", "nx", "nyc", "oclif", "oxlint", "playwright", "playwright-ct", "playwright-test", "plop", "postcss", "preconstruct", "prettier", "prisma", "react-cosmos", "react-router", "relay", "release-it", "remark", "remix", "rollup", "rsbuild", "rspack", "semantic-release", "sentry", "simple-git-hooks", "size-limit", "sst", "starlight", "storybook", "stryker", "stylelint", "svelte", "svgo", "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' | 'bun' | 'c8' | 'capacitor' | 'changelogen' | 'changelogithub' | 'changesets' | 'commitizen' | 'commitlint' | 'convex' | 'create-typescript-app' | 'cspell' | 'cucumber' | 'cypress' | 'dependency-cruiser' | 'docusaurus' | 'dotenv' | 'drizzle' | 'eleventy' | 'eslint' | 'expo' | 'gatsby' | 'github-action' | 'github-actions' | 'glob' | 'graphql-codegen' | 'hardhat' | 'husky' | 'i18next-parser' | 'jest' | 'karma' | 'ladle' | 'lefthook' | 'lint-staged' | 'linthtml' | 'lockfile-lint' | 'lost-pixel' | 'markdownlint' | 'metro' | 'mocha' | 'moonrepo' | 'msw' | 'nano-staged' | 'nest' | 'netlify' | 'next' | 'node' | 'nodemon' | 'npm-package-json-lint' | 'nuxt' | 'nx' | 'nyc' | 'oclif' | 'oxlint' | 'playwright' | 'playwright-ct' | 'playwright-test' | 'plop' | 'postcss' | 'preconstruct' | 'prettier' | 'prisma' | 'react-cosmos' | 'react-router' | 'relay' | 'release-it' | 'remark' | 'remix' | 'rollup' | 'rsbuild' | 'rspack' | 'semantic-release' | 'sentry' | 'simple-git-hooks' | 'size-limit' | 'sst' | 'starlight' | 'storybook' | 'stryker' | 'stylelint' | 'svelte' | 'svgo' | '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", "bun", "c8", "capacitor", "changelogen", "changelogithub", "changesets", "commitizen", "commitlint", "convex", "create-typescript-app", "cspell", "cucumber", "cypress", "dependency-cruiser", "docusaurus", "dotenv", "drizzle", "eleventy", "eslint", "expo", "gatsby", "github-action", "github-actions", "glob", "graphql-codegen", "hardhat", "husky", "i18next-parser", "jest", "karma", "ladle", "lefthook", "lint-staged", "linthtml", "lockfile-lint", "lost-pixel", "markdownlint", "metro", "mocha", "moonrepo", "msw", "nano-staged", "nest", "netlify", "next", "node", "nodemon", "npm-package-json-lint", "nuxt", "nx", "nyc", "oclif", "oxlint", "playwright", "playwright-ct", "playwright-test", "plop", "postcss", "preconstruct", "prettier", "prisma", "react-cosmos", "react-router", "relay", "release-it", "remark", "remix", "rollup", "rsbuild", "rspack", "semantic-release", "sentry", "simple-git-hooks", "size-limit", "sst", "starlight", "storybook", "stryker", "stylelint", "svelte", "svgo", "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"];
@@ -6,14 +6,18 @@ export const pluginNames = [
6
6
  'bun',
7
7
  'c8',
8
8
  'capacitor',
9
+ 'changelogen',
10
+ 'changelogithub',
9
11
  'changesets',
10
12
  'commitizen',
11
13
  'commitlint',
14
+ 'convex',
12
15
  'create-typescript-app',
13
16
  'cspell',
14
17
  'cucumber',
15
18
  'cypress',
16
19
  'dependency-cruiser',
20
+ 'docusaurus',
17
21
  'dotenv',
18
22
  'drizzle',
19
23
  'eleventy',
@@ -24,6 +28,7 @@ export const pluginNames = [
24
28
  'github-actions',
25
29
  'glob',
26
30
  'graphql-codegen',
31
+ 'hardhat',
27
32
  'husky',
28
33
  'i18next-parser',
29
34
  'jest',
@@ -14,4 +14,5 @@ export type PrincipalOptions = {
14
14
  toSourceFilePath: ToSourceFilePath;
15
15
  isCache: boolean;
16
16
  cacheLocation: string;
17
+ isProduction: boolean;
17
18
  };
@@ -5,7 +5,7 @@ import { DEFAULT_EXTENSIONS } from '../constants.js';
5
5
  import { timerify } from '../util/Performance.js';
6
6
  import { sanitizeSpecifier } from '../util/modules.js';
7
7
  import { dirname, extname, isAbsolute, isInNodeModules, join } from '../util/path.js';
8
- import { _resolveSync, createSyncResolver } from '../util/resolve.js';
8
+ import { _createSyncResolver, _resolveSync } from '../util/resolve.js';
9
9
  import { isDeclarationFileExtension } from './ast-helpers.js';
10
10
  const resolutionCache = new Map();
11
11
  const fileExists = (name, containingFile) => {
@@ -22,7 +22,7 @@ const fileExists = (name, containingFile) => {
22
22
  export function createCustomModuleResolver(compilerOptions, customCompilerExtensions, toSourceFilePath, useCache = true, isSkipLibs = true) {
23
23
  const customCompilerExtensionsSet = new Set(customCompilerExtensions);
24
24
  const extensions = [...DEFAULT_EXTENSIONS, ...customCompilerExtensions];
25
- const resolveSync = customCompilerExtensionsSet.size === 0 ? _resolveSync : createSyncResolver(extensions);
25
+ const resolveSync = customCompilerExtensionsSet.size === 0 ? _resolveSync : _createSyncResolver(extensions);
26
26
  const virtualDeclarationFiles = new Map();
27
27
  const tsSys = {
28
28
  ...ts.sys,
@@ -11,8 +11,8 @@ interface MemoryEntry extends PerformanceEntry {
11
11
  }
12
12
  declare class Performance {
13
13
  isEnabled: boolean;
14
- isPerformanceEnabled: boolean;
15
- isMemoryEnabled: boolean;
14
+ isTimerifyFunctions: boolean;
15
+ isMemoryUsageEnabled: boolean;
16
16
  startTime: number;
17
17
  endTime: number;
18
18
  perfEntries: PerformanceEntry[];
@@ -23,17 +23,17 @@ declare class Performance {
23
23
  memObserver?: PerformanceObserver;
24
24
  memoryUsageStart?: ReturnType<typeof memoryUsage>;
25
25
  freeMemoryStart?: number;
26
- constructor({ isPerformanceEnabled, isMemoryEnabled }: {
27
- isPerformanceEnabled?: boolean | undefined;
28
- isMemoryEnabled?: boolean | undefined;
26
+ constructor({ isTimerifyFunctions, isMemoryUsageEnabled }: {
27
+ isTimerifyFunctions?: boolean | undefined;
28
+ isMemoryUsageEnabled?: boolean | undefined;
29
29
  });
30
30
  private setMark;
31
31
  private clearMark;
32
32
  private flush;
33
33
  private getPerfEntriesByName;
34
- getPerformanceTable(): string;
34
+ getTimerifiedFunctionsTable(): string;
35
35
  addMemoryMark(index: number): void;
36
- getMemoryTable(): string;
36
+ getMemoryUsageTable(): string;
37
37
  getCurrentDurationInMs(startTime?: number): number;
38
38
  getMemHeapUsage(): number;
39
39
  getCurrentMemUsageInMb(): any;
@@ -4,9 +4,13 @@ import { memoryUsage } from 'node:process';
4
4
  import parsedArgValues from './cli-arguments.js';
5
5
  import { getStats } from './math.js';
6
6
  import { Table } from './table.js';
7
- const { performance: isPerformanceEnabled = false, memory: isMemoryEnabled = false, 'memory-realtime': memoryRealtime = false, } = parsedArgValues;
7
+ const { performance: enableTimerify = false, 'performance-fn': timerifyOnlyFnName, memory: enableMemoryUsage = false, 'memory-realtime': memoryRealtime = false, } = parsedArgValues;
8
+ const isTimerifyFunctions = enableTimerify || !!timerifyOnlyFnName;
9
+ const isMemoryUsageEnabled = enableMemoryUsage || memoryRealtime;
8
10
  export const timerify = (fn, name = fn.name) => {
9
- if (!isPerformanceEnabled)
11
+ if (!isTimerifyFunctions)
12
+ return fn;
13
+ if (timerifyOnlyFnName && name !== timerifyOnlyFnName)
10
14
  return fn;
11
15
  return performance.timerify(Object.defineProperty(fn, 'name', { get: () => name }));
12
16
  };
@@ -18,8 +22,8 @@ const logHead = () => console.log(keys.map(key => key.padStart(10)).join(' '));
18
22
  const log = (memInfo) => console.log(keys.map(key => twoFixed(inMB(memInfo[key])).padStart(10)).join(' '));
19
23
  class Performance {
20
24
  isEnabled;
21
- isPerformanceEnabled;
22
- isMemoryEnabled;
25
+ isTimerifyFunctions;
26
+ isMemoryUsageEnabled;
23
27
  startTime = 0;
24
28
  endTime = 0;
25
29
  perfEntries = [];
@@ -30,15 +34,15 @@ class Performance {
30
34
  memObserver;
31
35
  memoryUsageStart;
32
36
  freeMemoryStart;
33
- constructor({ isPerformanceEnabled = false, isMemoryEnabled = false }) {
34
- this.isEnabled = isPerformanceEnabled || isMemoryEnabled;
35
- this.isPerformanceEnabled = isPerformanceEnabled;
36
- this.isMemoryEnabled = isMemoryEnabled;
37
+ constructor({ isTimerifyFunctions = false, isMemoryUsageEnabled = false }) {
38
+ this.isEnabled = isTimerifyFunctions || isMemoryUsageEnabled;
39
+ this.isTimerifyFunctions = isTimerifyFunctions;
40
+ this.isMemoryUsageEnabled = isMemoryUsageEnabled;
37
41
  this.startTime = performance.now();
38
42
  const instanceId = Math.floor(performance.now() * 100);
39
43
  this.perfId = `perf-${instanceId}`;
40
44
  this.memId = `mem-${instanceId}`;
41
- if (isPerformanceEnabled) {
45
+ if (isTimerifyFunctions) {
42
46
  this.fnObserver = new PerformanceObserver(items => {
43
47
  for (const entry of items.getEntries()) {
44
48
  this.perfEntries.push(entry);
@@ -46,7 +50,7 @@ class Performance {
46
50
  });
47
51
  this.fnObserver.observe({ type: 'function' });
48
52
  }
49
- if (isMemoryEnabled) {
53
+ if (isMemoryUsageEnabled) {
50
54
  this.memObserver = new PerformanceObserver(items => {
51
55
  for (const entry of items.getEntries()) {
52
56
  this.memEntries.push(entry);
@@ -82,12 +86,12 @@ class Performance {
82
86
  return entries;
83
87
  }, {});
84
88
  }
85
- getPerformanceTable() {
89
+ getTimerifiedFunctionsTable() {
86
90
  const entriesByName = this.getPerfEntriesByName();
87
91
  const table = new Table({ header: true });
88
92
  for (const [name, values] of Object.entries(entriesByName)) {
89
93
  const stats = getStats(values);
90
- table.newRow();
94
+ table.row();
91
95
  table.cell('Name', name);
92
96
  table.cell('size', values.length);
93
97
  table.cell('min', stats.min, twoFixed);
@@ -99,7 +103,7 @@ class Performance {
99
103
  return table.toString();
100
104
  }
101
105
  addMemoryMark(index) {
102
- if (!this.isMemoryEnabled)
106
+ if (!this.isMemoryUsageEnabled)
103
107
  return;
104
108
  const id = `${this.memId}:${index}`;
105
109
  const detail = getMemInfo();
@@ -107,12 +111,12 @@ class Performance {
107
111
  if (memoryRealtime && detail)
108
112
  log(detail);
109
113
  }
110
- getMemoryTable() {
114
+ getMemoryUsageTable() {
111
115
  const table = new Table({ header: true });
112
116
  for (const entry of this.memEntries) {
113
117
  if (!entry.detail)
114
118
  continue;
115
- table.newRow();
119
+ table.row();
116
120
  table.cell('heapUsed', inMB(entry.detail.heapUsed), twoFixed);
117
121
  table.cell('heapTotal', inMB(entry.detail.heapTotal), twoFixed);
118
122
  table.cell('freemem', inMB(entry.detail.freemem), twoFixed);
@@ -139,4 +143,4 @@ class Performance {
139
143
  this.memObserver?.disconnect();
140
144
  }
141
145
  }
142
- export const perfObserver = new Performance({ isPerformanceEnabled, isMemoryEnabled });
146
+ export const perfObserver = new Performance({ isTimerifyFunctions, isMemoryUsageEnabled });
@@ -1,4 +1,4 @@
1
- export declare const helpText = "\u2702\uFE0F Find unused dependencies, exports and files in your JavaScript and TypeScript projects\n\nUsage: knip [options]\n\nOptions:\n -c, --config [file] Configuration file path (default: [.]knip.json[c], knip.(js|ts), knip.config.(js|ts) or package.json#knip)\n -t, --tsConfig [file] TypeScript configuration path (default: tsconfig.json)\n --production Analyze only production source files (e.g. no test files, devDependencies)\n --strict Consider only direct dependencies of workspace (not devDependencies, not other workspaces)\n -W, --workspace [dir] Analyze a single workspace (default: analyze all configured workspaces)\n --directory [dir] Run process from a different directory (default: cwd)\n --cache Enable caching\n --cache-location Change cache location (default: node_modules/.cache/knip)\n --watch Watch mode\n --no-gitignore Don't use .gitignore\n --include Report only provided issue type(s), can be comma-separated or repeated (1)\n --exclude Exclude provided issue type(s) from report, can be comma-separated or repeated (1)\n --dependencies Shortcut for --include dependencies,unlisted,binaries,unresolved\n --exports Shortcut for --include exports,nsExports,classMembers,types,nsTypes,enumMembers,duplicates\n --files Shortcut for --include files\n --fix Fix issues\n --fix-type Fix only issues of type, can be comma-separated or repeated (2)\n --format Format modified files after --fix using the local formatter\n --allow-remove-files Allow Knip to remove files (with --fix)\n --include-libs Include type definitions from external dependencies (default: false)\n --include-entry-exports Include entry files when reporting unused exports\n --isolate-workspaces Isolate workspaces into separate programs\n -n, --no-progress Don't show dynamic progress updates (automatically enabled in CI environments)\n --preprocessor Preprocess the results before providing it to the reporter(s), can be repeated\n --preprocessor-options Pass extra options to the preprocessor (as JSON string, see --reporter-options example)\n --reporter Select reporter: symbols, compact, codeowners, json, codeclimate, markdown, disclosure, can be repeated (default: symbols)\n --reporter-options Pass extra options to the reporter (as JSON string, see example)\n --tags Include or exclude tagged exports\n --no-config-hints Suppress configuration hints\n --treat-config-hints-as-errors Exit with non-zero code (1) if there are any configuration hints\n --no-exit-code Always exit with code zero (0)\n --max-issues Maximum number of issues before non-zero exit code (default: 0)\n -d, --debug Show debug output\n --trace Show trace output\n --trace-export [name] Show trace output for named export(s)\n --trace-file [file] Show trace output for exports in file\n --performance Measure count and running time of key functions and display stats table\n --memory Measure memory usage and display data table\n --memory-realtime Log memory usage in realtime\n -h, --help Print this help text\n -V, --version Print version\n\n(1) Issue types: files, dependencies, unlisted, unresolved, exports, nsExports, classMembers, types, nsTypes, enumMembers, duplicates\n(2) Fixable issue types: dependencies, exports, types\n\nExamples:\n\n$ knip\n$ knip --production\n$ knip --workspace packages/client --include files,dependencies\n$ knip -c ./config/knip.json --reporter compact\n$ knip --reporter codeowners --reporter-options '{\"path\":\".github/CODEOWNERS\"}'\n$ knip --tags=-lintignore\n\nWebsite: https://knip.dev";
1
+ export declare const helpText = "\u2702\uFE0F Find unused dependencies, exports and files in your JavaScript and TypeScript projects\n\nUsage: knip [options]\n\nOptions:\n -c, --config [file] Configuration file path (default: [.]knip.json[c], knip.(js|ts), knip.config.(js|ts) or package.json#knip)\n -t, --tsConfig [file] TypeScript configuration path (default: tsconfig.json)\n --production Analyze only production source files (e.g. no test files, devDependencies)\n --strict Consider only direct dependencies of workspace (not devDependencies, not other workspaces)\n -W, --workspace [dir] Analyze a single workspace (default: analyze all configured workspaces)\n --directory [dir] Run process from a different directory (default: cwd)\n --cache Enable caching\n --cache-location Change cache location (default: node_modules/.cache/knip)\n --watch Watch mode\n --no-gitignore Don't use .gitignore\n --include Report only provided issue type(s), can be comma-separated or repeated (1)\n --exclude Exclude provided issue type(s) from report, can be comma-separated or repeated (1)\n --dependencies Shortcut for --include dependencies,unlisted,binaries,unresolved\n --exports Shortcut for --include exports,nsExports,classMembers,types,nsTypes,enumMembers,duplicates\n --files Shortcut for --include files\n --fix Fix issues\n --fix-type Fix only issues of type, can be comma-separated or repeated (2)\n --format Format modified files after --fix using the local formatter\n --allow-remove-files Allow Knip to remove files (with --fix)\n --include-libs Include type definitions from external dependencies (default: false)\n --include-entry-exports Include entry files when reporting unused exports\n --isolate-workspaces Isolate workspaces into separate programs\n -n, --no-progress Don't show dynamic progress updates (automatically enabled in CI environments)\n --preprocessor Preprocess the results before providing it to the reporter(s), can be repeated\n --preprocessor-options Pass extra options to the preprocessor (as JSON string, see --reporter-options example)\n --reporter Select reporter: symbols, compact, codeowners, json, codeclimate, markdown, disclosure, can be repeated (default: symbols)\n --reporter-options Pass extra options to the reporter (as JSON string, see example)\n --tags Include or exclude tagged exports\n --no-config-hints Suppress configuration hints\n --treat-config-hints-as-errors Exit with non-zero code (1) if there are any configuration hints\n --no-exit-code Always exit with code zero (0)\n --max-issues Maximum number of issues before non-zero exit code (default: 0)\n -d, --debug Show debug output\n --trace Show trace output\n --trace-export [name] Show trace output for named export(s)\n --trace-file [file] Show trace output for exports in file\n --performance Measure count and running time of key functions and display stats table\n --performance-fn [name] Measure only function [name]\n --memory Measure memory usage and display data table\n --memory-realtime Log memory usage in realtime\n -h, --help Print this help text\n -V, --version Print version\n\n(1) Issue types: files, dependencies, unlisted, unresolved, exports, nsExports, classMembers, types, nsTypes, enumMembers, duplicates\n(2) Fixable issue types: dependencies, exports, types\n\nExamples:\n\n$ knip\n$ knip --production\n$ knip --workspace packages/client --include files,dependencies\n$ knip -c ./config/knip.json --reporter compact\n$ knip --reporter codeowners --reporter-options '{\"path\":\".github/CODEOWNERS\"}'\n$ knip --tags=-lintignore\n\nWebsite: https://knip.dev";
2
2
  declare const _default: {
3
3
  cache?: boolean | undefined;
4
4
  'cache-location'?: string | undefined;
@@ -29,6 +29,7 @@ declare const _default: {
29
29
  'no-gitignore'?: boolean | undefined;
30
30
  'no-progress'?: boolean | undefined;
31
31
  performance?: boolean | undefined;
32
+ 'performance-fn'?: string | undefined;
32
33
  production?: boolean | undefined;
33
34
  preprocessor?: string[] | undefined;
34
35
  'preprocessor-options'?: string | undefined;
@@ -41,6 +41,7 @@ Options:
41
41
  --trace-export [name] Show trace output for named export(s)
42
42
  --trace-file [file] Show trace output for exports in file
43
43
  --performance Measure count and running time of key functions and display stats table
44
+ --performance-fn [name] Measure only function [name]
44
45
  --memory Measure memory usage and display data table
45
46
  --memory-realtime Log memory usage in realtime
46
47
  -h, --help Print this help text
@@ -92,6 +93,7 @@ try {
92
93
  'no-gitignore': { type: 'boolean' },
93
94
  'no-progress': { type: 'boolean', short: 'n' },
94
95
  performance: { type: 'boolean' },
96
+ 'performance-fn': { type: 'string' },
95
97
  production: { type: 'boolean' },
96
98
  preprocessor: { type: 'string', multiple: true },
97
99
  'preprocessor-options': { type: 'string' },
@@ -1,5 +1,6 @@
1
1
  import type { PluginName } from '../types/PluginNames.js';
2
- type InputType = 'binary' | 'entry' | 'project' | 'config' | 'dependency' | 'deferResolve' | 'deferResolveEntry' | 'alias';
2
+ import type { IssueType } from '../types/issues.js';
3
+ type InputType = 'binary' | 'entry' | 'project' | 'config' | 'dependency' | 'deferResolve' | 'deferResolveEntry' | 'alias' | 'ignore';
3
4
  export interface Input {
4
5
  type: InputType;
5
6
  specifier: string;
@@ -19,6 +20,10 @@ interface AliasInput extends Input {
19
20
  type: 'alias';
20
21
  prefixes: string[];
21
22
  }
23
+ interface IgnoreInput extends Input {
24
+ type: 'ignore';
25
+ issueType: IssueType;
26
+ }
22
27
  type Options = {
23
28
  optional?: boolean;
24
29
  dir?: string;
@@ -47,5 +52,7 @@ export declare const toDeferResolveEntry: (specifier: string, options?: Options)
47
52
  export declare const isDeferResolveEntry: (input: Input) => boolean;
48
53
  export declare const toAlias: (specifier: string, prefix: string | string[], options?: Options) => AliasInput;
49
54
  export declare const isAlias: (input: Input) => input is AliasInput;
55
+ export declare const toIgnore: (specifier: string, issueType: IssueType) => IgnoreInput;
56
+ export declare const isIgnore: (input: Input) => input is IgnoreInput;
50
57
  export declare const toDebugString: (input: Input) => string;
51
58
  export {};
@@ -57,4 +57,10 @@ export const toAlias = (specifier, prefix, options = {}) => ({
57
57
  ...options,
58
58
  });
59
59
  export const isAlias = (input) => input.type === 'alias';
60
+ export const toIgnore = (specifier, issueType) => ({
61
+ type: 'ignore',
62
+ specifier,
63
+ issueType,
64
+ });
65
+ export const isIgnore = (input) => input.type === 'ignore';
60
66
  export const toDebugString = (input) => `${input.type}:${isAbsolute(input.specifier) ? toRelative(input.specifier) : input.specifier}${input.containingFilePath ? ` (${toRelative(input.containingFilePath)})` : ''}`;
package/dist/util/math.js CHANGED
@@ -1,7 +1,7 @@
1
1
  export function getStats(values) {
2
2
  if (values.length === 0)
3
3
  return { min: 0, max: 0, sum: 0, median: 0 };
4
- const sorted = values.toSorted((a, b) => a - b);
4
+ const sorted = values.sort((a, b) => a - b);
5
5
  const min = sorted[0];
6
6
  const max = sorted[sorted.length - 1];
7
7
  const sum = sorted.reduce((a, b) => a + b, 0);
@@ -22,3 +22,11 @@ export declare const toUnconfig: (moduleName: string, options?: {
22
22
  configFilesAllExtensions?: boolean;
23
23
  additionalExtensions?: string[];
24
24
  }) => string[];
25
+ export declare const toC12config: (moduleName: string, options?: {
26
+ rcPrefix?: string;
27
+ rcSuffix?: string;
28
+ configDir?: boolean;
29
+ configFiles?: boolean;
30
+ configFilesAllExtensions?: boolean;
31
+ additionalExtensions?: string[];
32
+ }) => string[];
@@ -30,3 +30,4 @@ export const toUnconfig = toConfigMap(['json', 'ts', 'mts', 'cts', 'js', 'mjs',
30
30
  rcSuffix: '',
31
31
  configFiles: false,
32
32
  });
33
+ export const toC12config = toConfigMap(['json', 'jsonc', 'json5', 'yaml', 'yml', 'js', 'ts', 'mjs', 'cjs', 'mts', 'cts', 'toml'], { configDir: true });
@@ -1,2 +1,4 @@
1
- export declare const createSyncResolver: (extensions: string[]) => (specifier: string, baseDir: string) => string | undefined;
1
+ declare const createSyncResolver: (extensions: string[]) => (specifier: string, baseDir: string) => string | undefined;
2
2
  export declare const _resolveSync: (specifier: string, baseDir: string) => string | undefined;
3
+ export declare const _createSyncResolver: typeof createSyncResolver;
4
+ export {};
@@ -1,23 +1,21 @@
1
- import fs from 'node:fs';
2
- import ER from 'enhanced-resolve';
1
+ import { ResolverFactory } from 'oxc-resolver';
3
2
  import { DEFAULT_EXTENSIONS } from '../constants.js';
4
3
  import { timerify } from './Performance.js';
5
4
  import { toPosix } from './path.js';
6
- const fileSystem = new ER.CachedInputFileSystem(fs, 9999999);
7
- export const createSyncResolver = (extensions) => {
8
- const resolver = ER.create.sync({
9
- fileSystem,
5
+ const createSyncResolver = (extensions) => {
6
+ const resolver = new ResolverFactory({
10
7
  extensions,
11
8
  conditionNames: ['require', 'import', 'node', 'default'],
12
9
  });
13
10
  return function resolveSync(specifier, baseDir) {
14
11
  try {
15
- const resolved = resolver({}, baseDir, specifier);
16
- if (resolved)
17
- return toPosix(resolved);
12
+ const resolved = resolver.sync(baseDir, specifier);
13
+ if (resolved?.path)
14
+ return toPosix(resolved.path);
18
15
  }
19
16
  catch (_error) { }
20
17
  };
21
18
  };
22
19
  const resolveSync = createSyncResolver([...DEFAULT_EXTENSIONS, '.json']);
23
20
  export const _resolveSync = timerify(resolveSync);
21
+ export const _createSyncResolver = extensions => timerify(createSyncResolver(extensions));
@@ -12,9 +12,11 @@ export declare class Table {
12
12
  truncateStart?: string[];
13
13
  noTruncate?: string[];
14
14
  });
15
+ row(): this;
15
16
  cell(column: string, value: Value, formatter?: (value: Value) => string): this;
16
- newRow(): this;
17
- sort(compareFn: ((a: any, b: any) => number) | string): this;
17
+ sort(column: string): this;
18
+ toCells(): string[][];
19
+ toRows(): string[];
18
20
  toString(): string;
19
21
  }
20
22
  export {};