knip 6.42.1 → 6.43.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 (55) hide show
  1. package/dist/ConfigurationChief.d.ts +18 -0
  2. package/dist/IssueFixer.js +10 -5
  3. package/dist/WorkspaceWorker.js +15 -10
  4. package/dist/binaries/resolvers/bun.js +1 -0
  5. package/dist/binaries/resolvers/npm.js +12 -2
  6. package/dist/binaries/resolvers/pnpm.js +5 -3
  7. package/dist/compilers/compilers.js +2 -2
  8. package/dist/constants.js +1 -0
  9. package/dist/plugins/_vue/auto-import.js +31 -1
  10. package/dist/plugins/buf/index.d.ts +3 -0
  11. package/dist/plugins/buf/index.js +33 -0
  12. package/dist/plugins/buf/types.d.ts +8 -0
  13. package/dist/plugins/buf/types.js +1 -0
  14. package/dist/plugins/electron-forge/index.d.ts +3 -0
  15. package/dist/plugins/electron-forge/index.js +94 -0
  16. package/dist/plugins/eslint/helpers.d.ts +1 -0
  17. package/dist/plugins/eslint/helpers.js +1 -1
  18. package/dist/plugins/eslint/resolveFromAST.js +35 -10
  19. package/dist/plugins/expo/helpers.d.ts +1 -1
  20. package/dist/plugins/expo/helpers.js +15 -8
  21. package/dist/plugins/expo/types.d.ts +2 -1
  22. package/dist/plugins/index.d.ts +3 -0
  23. package/dist/plugins/index.js +6 -0
  24. package/dist/plugins/mcp/index.d.ts +3 -0
  25. package/dist/plugins/mcp/index.js +33 -0
  26. package/dist/plugins/mcp/types.d.ts +11 -0
  27. package/dist/plugins/mcp/types.js +1 -0
  28. package/dist/plugins/next/index.d.ts +3 -0
  29. package/dist/plugins/next/index.js +57 -9
  30. package/dist/plugins/next/types.d.ts +11 -0
  31. package/dist/plugins/next/types.js +1 -0
  32. package/dist/plugins/tailwind/compiler.js +6 -2
  33. package/dist/plugins/travis/index.js +2 -2
  34. package/dist/plugins/typescript/index.js +2 -4
  35. package/dist/plugins/vitest/helpers.d.ts +1 -1
  36. package/dist/plugins/vitest/helpers.js +13 -3
  37. package/dist/plugins/vitest/index.js +52 -44
  38. package/dist/plugins/vitest/types.d.ts +11 -7
  39. package/dist/run.js +1 -1
  40. package/dist/schema/configuration.d.ts +45 -0
  41. package/dist/schema/plugins.d.ts +15 -0
  42. package/dist/schema/plugins.js +3 -0
  43. package/dist/types/PluginNames.d.ts +2 -2
  44. package/dist/types/PluginNames.js +3 -0
  45. package/dist/types/config.d.ts +1 -0
  46. package/dist/typescript/ast-nodes.js +3 -3
  47. package/dist/typescript/visitors/exports.js +5 -4
  48. package/dist/typescript/visitors/walk.js +13 -1
  49. package/dist/util/create-options.d.ts +30 -0
  50. package/dist/util/modules.js +2 -1
  51. package/dist/util/remove-export.js +3 -1
  52. package/dist/version.d.ts +1 -1
  53. package/dist/version.js +1 -1
  54. package/package.json +4 -4
  55. package/schema.json +12 -0
@@ -51,6 +51,11 @@ export declare const pluginsSchema: z.ZodMiniObject<{
51
51
  entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
52
52
  project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
53
53
  }, z.core.$strip>]>;
54
+ buf: z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
55
+ config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
56
+ entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
57
+ project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
58
+ }, z.core.$strip>]>;
54
59
  bumpp: z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
55
60
  config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
56
61
  entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
@@ -151,6 +156,11 @@ export declare const pluginsSchema: z.ZodMiniObject<{
151
156
  entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
152
157
  project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
153
158
  }, z.core.$strip>]>;
159
+ 'electron-forge': z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
160
+ config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
161
+ entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
162
+ project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
163
+ }, z.core.$strip>]>;
154
164
  'electron-vite': z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
155
165
  config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
156
166
  entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
@@ -331,6 +341,11 @@ export declare const pluginsSchema: z.ZodMiniObject<{
331
341
  entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
332
342
  project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
333
343
  }, z.core.$strip>]>;
344
+ mcp: z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
345
+ config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
346
+ entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
347
+ project: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
348
+ }, z.core.$strip>]>;
334
349
  mdx: z.ZodMiniUnion<readonly [z.ZodMiniBoolean<boolean>, z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>, z.ZodMiniObject<{
335
350
  config: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
336
351
  entry: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniArray<z.ZodMiniString<string>>]>>;
@@ -19,6 +19,7 @@ export const pluginsSchema = z.object({
19
19
  babel: pluginSchema,
20
20
  biome: pluginSchema,
21
21
  borp: pluginSchema,
22
+ buf: pluginSchema,
22
23
  bumpp: pluginSchema,
23
24
  bun: pluginSchema,
24
25
  c8: pluginSchema,
@@ -39,6 +40,7 @@ export const pluginsSchema = z.object({
39
40
  docusaurus: pluginSchema,
40
41
  dotenv: pluginSchema,
41
42
  drizzle: pluginSchema,
43
+ 'electron-forge': pluginSchema,
42
44
  'electron-vite': pluginSchema,
43
45
  eleventy: pluginSchema,
44
46
  esbuild: pluginSchema,
@@ -75,6 +77,7 @@ export const pluginsSchema = z.object({
75
77
  lunaria: pluginSchema,
76
78
  markdownlint: pluginSchema,
77
79
  marko: pluginSchema,
80
+ mcp: pluginSchema,
78
81
  mdx: pluginSchema,
79
82
  mdxlint: pluginSchema,
80
83
  metro: pluginSchema,
@@ -1,2 +1,2 @@
1
- export type PluginName = 'angular' | 'astro' | 'astro-db' | 'astro-markdoc' | 'astro-og-canvas' | 'ava' | 'babel' | 'biome' | 'borp' | 'bumpp' | 'bun' | 'c8' | 'capacitor' | 'catalyst' | 'changelogen' | 'changelogithub' | 'changesets' | 'commitizen' | 'commitlint' | 'convex' | 'create-typescript-app' | 'cspell' | 'cucumber' | 'cypress' | 'danger' | 'dependency-cruiser' | 'docusaurus' | 'dotenv' | 'drizzle' | 'electron-vite' | 'eleventy' | 'esbuild' | 'eslint' | 'eve' | 'execa' | 'expo' | 'expo-router' | 'expressive-code' | 'fast' | 'filesystem-routing' | 'flue' | 'fumadocs' | 'gatsby' | 'github-action' | 'github-actions' | 'glob' | 'graphql-codegen' | 'hardhat' | 'husky' | 'i18next-parser' | 'jasmine' | 'jest' | 'karma' | 'knex' | 'ladle' | 'laravel-vite-plugin' | 'lefthook' | 'lint-staged' | 'linthtml' | 'lit' | 'lockfile-lint' | 'lost-pixel' | 'lunaria' | 'markdownlint' | 'marko' | 'mdx' | 'mdxlint' | 'metro' | 'mise' | 'mocha' | 'moonrepo' | 'msw' | 'nano-spawn' | 'nano-staged' | 'nest' | 'netlify' | 'next' | 'next-intl' | 'next-mdx' | 'nitro' | 'node' | 'node-modules-inspector' | 'nodemon' | 'npm-package-json-lint' | 'nuxt' | 'nuxtjs-i18n' | 'nx' | 'nyc' | 'oclif' | 'openapi-ts' | 'openclaw' | 'orval' | 'osls' | 'oxfmt' | 'oxlint' | 'panda-css' | 'parcel' | 'payload' | 'pino' | 'playwright' | 'playwright-ct' | 'playwright-test' | 'plop' | 'pm2' | 'pnpm' | 'postcss' | 'pre-commit' | 'preconstruct' | 'prettier' | 'prisma' | 'quasar' | 'qwik' | 'railway' | 'raycast' | 'react-cosmos' | 'react-email' | 'react-native' | 'react-router' | 'relay' | 'release-it' | 'remark' | 'remix' | 'rolldown' | 'rollup' | 'rsbuild' | 'rslib' | 'rspack' | 'rstest' | 'sanity' | 'semantic-release' | 'sentry' | 'serverless-framework' | 'simple-git-hooks' | 'size-limit' | 'solidjs-vite-plugin' | 'sst' | 'starlight' | 'stencil' | 'storybook' | 'stryker' | 'stylelint' | 'svelte' | 'sveltejs-package' | 'sveltekit' | 'svgo' | 'svgr' | 'swc' | 'syncpack' | 'tailwind' | 'tanstack-router' | 'taskfile' | 'tauri' | 'temporal' | 'textlint' | 'travis' | 'ts-node' | 'tsd' | 'tsdown' | 'tsrs' | 'tsup' | 'tsx' | 'turbo' | 'typedoc' | 'typescript' | 'typescript-content-mapper' | 'unbuild' | 'unocss' | 'unplugin-auto-import' | 'unplugin-icons' | 'unplugin-vue-components' | 'unplugin-vue-i18n' | 'unplugin-vue-markdown' | 'unplugin-vue-router' | 'varlock' | 'vercel' | 'vercel-og' | 'vike' | 'vite' | 'vite-plugin-pages' | 'vite-plugin-pwa' | 'vite-plugin-vue-layouts-next' | 'vite-plus' | 'vite-pwa-assets-generator' | 'vitepress' | 'vitest' | 'vue' | 'webdriver-io' | 'webpack' | 'wireit' | 'wrangler' | 'wxt' | 'xo' | 'yarn' | 'yorkie' | 'zx';
2
- export declare const pluginNames: readonly ['angular', 'astro', 'astro-db', 'astro-markdoc', 'astro-og-canvas', 'ava', 'babel', 'biome', 'borp', 'bumpp', 'bun', 'c8', 'capacitor', 'catalyst', 'changelogen', 'changelogithub', 'changesets', 'commitizen', 'commitlint', 'convex', 'create-typescript-app', 'cspell', 'cucumber', 'cypress', 'danger', 'dependency-cruiser', 'docusaurus', 'dotenv', 'drizzle', 'electron-vite', 'eleventy', 'esbuild', 'eslint', 'eve', 'execa', 'expo', 'expo-router', 'expressive-code', 'fast', 'filesystem-routing', 'flue', 'fumadocs', 'gatsby', 'github-action', 'github-actions', 'glob', 'graphql-codegen', 'hardhat', 'husky', 'i18next-parser', 'jasmine', 'jest', 'karma', 'knex', 'ladle', 'laravel-vite-plugin', 'lefthook', 'lint-staged', 'linthtml', 'lit', 'lockfile-lint', 'lost-pixel', 'lunaria', 'markdownlint', 'marko', 'mdx', 'mdxlint', 'metro', 'mise', 'mocha', 'moonrepo', 'msw', 'nano-spawn', 'nano-staged', 'nest', 'netlify', 'next', 'next-intl', 'next-mdx', 'nitro', 'node', 'node-modules-inspector', 'nodemon', 'npm-package-json-lint', 'nuxt', 'nuxtjs-i18n', 'nx', 'nyc', 'oclif', 'openapi-ts', 'openclaw', 'orval', 'osls', 'oxfmt', 'oxlint', 'panda-css', 'parcel', 'payload', 'pino', 'playwright', 'playwright-ct', 'playwright-test', 'plop', 'pm2', 'pnpm', 'postcss', 'pre-commit', 'preconstruct', 'prettier', 'prisma', 'quasar', 'qwik', 'railway', 'raycast', 'react-cosmos', 'react-email', 'react-native', 'react-router', 'relay', 'release-it', 'remark', 'remix', 'rolldown', 'rollup', 'rsbuild', 'rslib', 'rspack', 'rstest', 'sanity', 'semantic-release', 'sentry', 'serverless-framework', 'simple-git-hooks', 'size-limit', 'solidjs-vite-plugin', 'sst', 'starlight', 'stencil', 'storybook', 'stryker', 'stylelint', 'svelte', 'sveltejs-package', 'sveltekit', 'svgo', 'svgr', 'swc', 'syncpack', 'tailwind', 'tanstack-router', 'taskfile', 'tauri', 'temporal', 'textlint', 'travis', 'ts-node', 'tsd', 'tsdown', 'tsrs', 'tsup', 'tsx', 'turbo', 'typedoc', 'typescript', 'typescript-content-mapper', 'unbuild', 'unocss', 'unplugin-auto-import', 'unplugin-icons', 'unplugin-vue-components', 'unplugin-vue-i18n', 'unplugin-vue-markdown', 'unplugin-vue-router', 'varlock', 'vercel', 'vercel-og', 'vike', 'vite', 'vite-plugin-pages', 'vite-plugin-pwa', 'vite-plugin-vue-layouts-next', 'vite-plus', 'vite-pwa-assets-generator', 'vitepress', 'vitest', 'vue', 'webdriver-io', 'webpack', 'wireit', 'wrangler', 'wxt', 'xo', 'yarn', 'yorkie', 'zx'];
1
+ export type PluginName = 'angular' | 'astro' | 'astro-db' | 'astro-markdoc' | 'astro-og-canvas' | 'ava' | 'babel' | 'biome' | 'borp' | 'buf' | 'bumpp' | 'bun' | 'c8' | 'capacitor' | 'catalyst' | 'changelogen' | 'changelogithub' | 'changesets' | 'commitizen' | 'commitlint' | 'convex' | 'create-typescript-app' | 'cspell' | 'cucumber' | 'cypress' | 'danger' | 'dependency-cruiser' | 'docusaurus' | 'dotenv' | 'drizzle' | 'electron-forge' | 'electron-vite' | 'eleventy' | 'esbuild' | 'eslint' | 'eve' | 'execa' | 'expo' | 'expo-router' | 'expressive-code' | 'fast' | 'filesystem-routing' | 'flue' | 'fumadocs' | 'gatsby' | 'github-action' | 'github-actions' | 'glob' | 'graphql-codegen' | 'hardhat' | 'husky' | 'i18next-parser' | 'jasmine' | 'jest' | 'karma' | 'knex' | 'ladle' | 'laravel-vite-plugin' | 'lefthook' | 'lint-staged' | 'linthtml' | 'lit' | 'lockfile-lint' | 'lost-pixel' | 'lunaria' | 'markdownlint' | 'marko' | 'mcp' | 'mdx' | 'mdxlint' | 'metro' | 'mise' | 'mocha' | 'moonrepo' | 'msw' | 'nano-spawn' | 'nano-staged' | 'nest' | 'netlify' | 'next' | 'next-intl' | 'next-mdx' | 'nitro' | 'node' | 'node-modules-inspector' | 'nodemon' | 'npm-package-json-lint' | 'nuxt' | 'nuxtjs-i18n' | 'nx' | 'nyc' | 'oclif' | 'openapi-ts' | 'openclaw' | 'orval' | 'osls' | 'oxfmt' | 'oxlint' | 'panda-css' | 'parcel' | 'payload' | 'pino' | 'playwright' | 'playwright-ct' | 'playwright-test' | 'plop' | 'pm2' | 'pnpm' | 'postcss' | 'pre-commit' | 'preconstruct' | 'prettier' | 'prisma' | 'quasar' | 'qwik' | 'railway' | 'raycast' | 'react-cosmos' | 'react-email' | 'react-native' | 'react-router' | 'relay' | 'release-it' | 'remark' | 'remix' | 'rolldown' | 'rollup' | 'rsbuild' | 'rslib' | 'rspack' | 'rstest' | 'sanity' | 'semantic-release' | 'sentry' | 'serverless-framework' | 'simple-git-hooks' | 'size-limit' | 'solidjs-vite-plugin' | 'sst' | 'starlight' | 'stencil' | 'storybook' | 'stryker' | 'stylelint' | 'svelte' | 'sveltejs-package' | 'sveltekit' | 'svgo' | 'svgr' | 'swc' | 'syncpack' | 'tailwind' | 'tanstack-router' | 'taskfile' | 'tauri' | 'temporal' | 'textlint' | 'travis' | 'ts-node' | 'tsd' | 'tsdown' | 'tsrs' | 'tsup' | 'tsx' | 'turbo' | 'typedoc' | 'typescript' | 'typescript-content-mapper' | 'unbuild' | 'unocss' | 'unplugin-auto-import' | 'unplugin-icons' | 'unplugin-vue-components' | 'unplugin-vue-i18n' | 'unplugin-vue-markdown' | 'unplugin-vue-router' | 'varlock' | 'vercel' | 'vercel-og' | 'vike' | 'vite' | 'vite-plugin-pages' | 'vite-plugin-pwa' | 'vite-plugin-vue-layouts-next' | 'vite-plus' | 'vite-pwa-assets-generator' | 'vitepress' | 'vitest' | 'vue' | 'webdriver-io' | 'webpack' | 'wireit' | 'wrangler' | 'wxt' | 'xo' | 'yarn' | 'yorkie' | 'zx';
2
+ export declare const pluginNames: readonly ['angular', 'astro', 'astro-db', 'astro-markdoc', 'astro-og-canvas', 'ava', 'babel', 'biome', 'borp', 'buf', 'bumpp', 'bun', 'c8', 'capacitor', 'catalyst', 'changelogen', 'changelogithub', 'changesets', 'commitizen', 'commitlint', 'convex', 'create-typescript-app', 'cspell', 'cucumber', 'cypress', 'danger', 'dependency-cruiser', 'docusaurus', 'dotenv', 'drizzle', 'electron-forge', 'electron-vite', 'eleventy', 'esbuild', 'eslint', 'eve', 'execa', 'expo', 'expo-router', 'expressive-code', 'fast', 'filesystem-routing', 'flue', 'fumadocs', 'gatsby', 'github-action', 'github-actions', 'glob', 'graphql-codegen', 'hardhat', 'husky', 'i18next-parser', 'jasmine', 'jest', 'karma', 'knex', 'ladle', 'laravel-vite-plugin', 'lefthook', 'lint-staged', 'linthtml', 'lit', 'lockfile-lint', 'lost-pixel', 'lunaria', 'markdownlint', 'marko', 'mcp', 'mdx', 'mdxlint', 'metro', 'mise', 'mocha', 'moonrepo', 'msw', 'nano-spawn', 'nano-staged', 'nest', 'netlify', 'next', 'next-intl', 'next-mdx', 'nitro', 'node', 'node-modules-inspector', 'nodemon', 'npm-package-json-lint', 'nuxt', 'nuxtjs-i18n', 'nx', 'nyc', 'oclif', 'openapi-ts', 'openclaw', 'orval', 'osls', 'oxfmt', 'oxlint', 'panda-css', 'parcel', 'payload', 'pino', 'playwright', 'playwright-ct', 'playwright-test', 'plop', 'pm2', 'pnpm', 'postcss', 'pre-commit', 'preconstruct', 'prettier', 'prisma', 'quasar', 'qwik', 'railway', 'raycast', 'react-cosmos', 'react-email', 'react-native', 'react-router', 'relay', 'release-it', 'remark', 'remix', 'rolldown', 'rollup', 'rsbuild', 'rslib', 'rspack', 'rstest', 'sanity', 'semantic-release', 'sentry', 'serverless-framework', 'simple-git-hooks', 'size-limit', 'solidjs-vite-plugin', 'sst', 'starlight', 'stencil', 'storybook', 'stryker', 'stylelint', 'svelte', 'sveltejs-package', 'sveltekit', 'svgo', 'svgr', 'swc', 'syncpack', 'tailwind', 'tanstack-router', 'taskfile', 'tauri', 'temporal', 'textlint', 'travis', 'ts-node', 'tsd', 'tsdown', 'tsrs', 'tsup', 'tsx', 'turbo', 'typedoc', 'typescript', 'typescript-content-mapper', 'unbuild', 'unocss', 'unplugin-auto-import', 'unplugin-icons', 'unplugin-vue-components', 'unplugin-vue-i18n', 'unplugin-vue-markdown', 'unplugin-vue-router', 'varlock', 'vercel', 'vercel-og', 'vike', 'vite', 'vite-plugin-pages', 'vite-plugin-pwa', 'vite-plugin-vue-layouts-next', 'vite-plus', 'vite-pwa-assets-generator', 'vitepress', 'vitest', 'vue', 'webdriver-io', 'webpack', 'wireit', 'wrangler', 'wxt', 'xo', 'yarn', 'yorkie', 'zx'];
@@ -8,6 +8,7 @@ export const pluginNames = [
8
8
  'babel',
9
9
  'biome',
10
10
  'borp',
11
+ 'buf',
11
12
  'bumpp',
12
13
  'bun',
13
14
  'c8',
@@ -28,6 +29,7 @@ export const pluginNames = [
28
29
  'docusaurus',
29
30
  'dotenv',
30
31
  'drizzle',
32
+ 'electron-forge',
31
33
  'electron-vite',
32
34
  'eleventy',
33
35
  'esbuild',
@@ -64,6 +66,7 @@ export const pluginNames = [
64
66
  'lunaria',
65
67
  'markdownlint',
66
68
  'marko',
69
+ 'mcp',
67
70
  'mdx',
68
71
  'mdxlint',
69
72
  'metro',
@@ -173,6 +173,7 @@ export interface Plugin {
173
173
  project?: string[];
174
174
  setup?: PluginSetup;
175
175
  isLoadConfig?: IsLoadConfig;
176
+ isLoadConfigOptional?: boolean;
176
177
  resolveConfig?: ResolveConfig;
177
178
  resolve?: Resolve;
178
179
  resolveSourceMap?: ResolveSourceMap;
@@ -94,7 +94,7 @@ export function extractNamespaceMembers(decl, options, lineStarts, getJSDocTags,
94
94
  if (!decl.body || decl.body.type !== 'TSModuleBlock')
95
95
  return [];
96
96
  const members = [];
97
- const addMember = (name, pos, stmtStart, stmtEnd) => {
97
+ const addMember = (name, pos, stmtStart, stmtEnd, isFixable = true) => {
98
98
  const fullName = prefix ? `${prefix}.${name}` : name;
99
99
  const tags = getJSDocTags(stmtStart);
100
100
  const existing = members.find(m => m.identifier === fullName);
@@ -109,7 +109,7 @@ export function extractNamespaceMembers(decl, options, lineStarts, getJSDocTags,
109
109
  return;
110
110
  }
111
111
  const { line, col } = getLineAndCol(lineStarts, pos);
112
- const fix = options.isFixExports
112
+ const fix = options.isFixExports && isFixable
113
113
  ? [stmtStart, stmtEnd, FIX_FLAGS.OBJECT_BINDING | FIX_FLAGS.WITH_NEWLINE]
114
114
  : undefined;
115
115
  members.push({
@@ -131,7 +131,7 @@ export function extractNamespaceMembers(decl, options, lineStarts, getJSDocTags,
131
131
  if (d.type === 'VariableDeclaration') {
132
132
  for (const declarator of d.declarations) {
133
133
  if (declarator.id.type === 'Identifier') {
134
- addMember(declarator.id.name, declarator.id.start, stmt.start, stmt.end);
134
+ addMember(declarator.id.name, declarator.id.start, stmt.start, stmt.end, d.declarations.length === 1);
135
135
  }
136
136
  }
137
137
  }
@@ -88,7 +88,7 @@ export function handleExportNamed(node, s) {
88
88
  }
89
89
  else if (declarator.id.type === 'Identifier') {
90
90
  const name = declarator.id.name;
91
- const fix = s.getFix(exportStart, exportStart + 7);
91
+ const fix = decl.declarations.length === 1 ? s.getFix(exportStart, exportStart + 7) : undefined;
92
92
  const jsDocTags = s.getJSDocTags(exportStart);
93
93
  let isReExport = false;
94
94
  if (declarator.init?.type === 'Identifier') {
@@ -235,11 +235,12 @@ export function handleExportDefault(node, s) {
235
235
  if (s.skipExports || s.isInNamespace(node))
236
236
  return;
237
237
  const decl = node.declaration;
238
- const hasDeclarationBody = decl.type === 'ClassDeclaration' || decl.type === 'FunctionDeclaration';
238
+ const isNamedDeclaration = (decl.type === 'ClassDeclaration' || decl.type === 'FunctionDeclaration') && decl.id;
239
+ const start = decl.type === 'ClassDeclaration' ? Math.min(node.start, decl.decorators[0]?.start ?? node.start) : node.start;
239
240
  const fix = s.options.isFixExports
240
- ? hasDeclarationBody
241
+ ? isNamedDeclaration
241
242
  ? [node.start, decl.start, FIX_FLAGS.NONE]
242
- : [node.start, node.end + 1, FIX_FLAGS.NONE]
243
+ : [start, node.end + 1, FIX_FLAGS.NONE]
243
244
  : undefined;
244
245
  let type = SYMBOL_TYPE.UNKNOWN;
245
246
  let pos = decl.start;
@@ -272,11 +272,23 @@ const coreVisitorObject = {
272
272
  },
273
273
  TSModuleDeclaration(node) {
274
274
  state.nsRanges.push([node.start, node.end]);
275
- if (node.kind !== 'global' && state.isModuleFile && isStringLiteral(node.id)) {
275
+ if (node.kind === 'global' || !isStringLiteral(node.id))
276
+ return;
277
+ if (state.isModuleFile) {
276
278
  const specifier = getStringValue(node.id);
277
279
  for (const name of collectAugmentationRefs(node))
278
280
  state.addImport(specifier, name, undefined, undefined, node.id.start, IMPORT_FLAGS.TYPE_ONLY | IMPORT_FLAGS.AUGMENT);
279
281
  }
282
+ else if (node.body?.type === 'TSModuleBlock') {
283
+ for (const stmt of node.body.body) {
284
+ if ((stmt.type === 'ImportDeclaration' ||
285
+ stmt.type === 'ExportAllDeclaration' ||
286
+ stmt.type === 'ExportNamedDeclaration') &&
287
+ stmt.source) {
288
+ state.addImport(stmt.source.value, undefined, undefined, undefined, stmt.source.start, IMPORT_FLAGS.TYPE_ONLY | IMPORT_FLAGS.OPAQUE);
289
+ }
290
+ }
291
+ }
280
292
  },
281
293
  TSInterfaceDeclaration(node) {
282
294
  if (state.scopeDepth > 0 || state.isInNamespace(node))
@@ -91,6 +91,11 @@ export declare const createOptions: (options: CreateOptions) => Promise<{
91
91
  entry?: string | string[] | undefined;
92
92
  project?: string | string[] | undefined;
93
93
  } | undefined;
94
+ buf?: string | boolean | string[] | {
95
+ config?: string | string[] | undefined;
96
+ entry?: string | string[] | undefined;
97
+ project?: string | string[] | undefined;
98
+ } | undefined;
94
99
  bumpp?: string | boolean | string[] | {
95
100
  config?: string | string[] | undefined;
96
101
  entry?: string | string[] | undefined;
@@ -191,6 +196,11 @@ export declare const createOptions: (options: CreateOptions) => Promise<{
191
196
  entry?: string | string[] | undefined;
192
197
  project?: string | string[] | undefined;
193
198
  } | undefined;
199
+ 'electron-forge'?: string | boolean | string[] | {
200
+ config?: string | string[] | undefined;
201
+ entry?: string | string[] | undefined;
202
+ project?: string | string[] | undefined;
203
+ } | undefined;
194
204
  'electron-vite'?: string | boolean | string[] | {
195
205
  config?: string | string[] | undefined;
196
206
  entry?: string | string[] | undefined;
@@ -371,6 +381,11 @@ export declare const createOptions: (options: CreateOptions) => Promise<{
371
381
  entry?: string | string[] | undefined;
372
382
  project?: string | string[] | undefined;
373
383
  } | undefined;
384
+ mcp?: string | boolean | string[] | {
385
+ config?: string | string[] | undefined;
386
+ entry?: string | string[] | undefined;
387
+ project?: string | string[] | undefined;
388
+ } | undefined;
374
389
  mdx?: string | boolean | string[] | {
375
390
  config?: string | string[] | undefined;
376
391
  entry?: string | string[] | undefined;
@@ -1098,6 +1113,11 @@ export declare const createOptions: (options: CreateOptions) => Promise<{
1098
1113
  entry?: string | string[] | undefined;
1099
1114
  project?: string | string[] | undefined;
1100
1115
  } | undefined;
1116
+ buf?: string | boolean | string[] | {
1117
+ config?: string | string[] | undefined;
1118
+ entry?: string | string[] | undefined;
1119
+ project?: string | string[] | undefined;
1120
+ } | undefined;
1101
1121
  bumpp?: string | boolean | string[] | {
1102
1122
  config?: string | string[] | undefined;
1103
1123
  entry?: string | string[] | undefined;
@@ -1198,6 +1218,11 @@ export declare const createOptions: (options: CreateOptions) => Promise<{
1198
1218
  entry?: string | string[] | undefined;
1199
1219
  project?: string | string[] | undefined;
1200
1220
  } | undefined;
1221
+ 'electron-forge'?: string | boolean | string[] | {
1222
+ config?: string | string[] | undefined;
1223
+ entry?: string | string[] | undefined;
1224
+ project?: string | string[] | undefined;
1225
+ } | undefined;
1201
1226
  'electron-vite'?: string | boolean | string[] | {
1202
1227
  config?: string | string[] | undefined;
1203
1228
  entry?: string | string[] | undefined;
@@ -1378,6 +1403,11 @@ export declare const createOptions: (options: CreateOptions) => Promise<{
1378
1403
  entry?: string | string[] | undefined;
1379
1404
  project?: string | string[] | undefined;
1380
1405
  } | undefined;
1406
+ mcp?: string | boolean | string[] | {
1407
+ config?: string | string[] | undefined;
1408
+ entry?: string | string[] | undefined;
1409
+ project?: string | string[] | undefined;
1410
+ } | undefined;
1381
1411
  mdx?: string | boolean | string[] | {
1382
1412
  config?: string | string[] | undefined;
1383
1413
  entry?: string | string[] | undefined;
@@ -2,7 +2,7 @@ import { readFileSync } from 'node:fs';
2
2
  import { DT_SCOPE, PROTOCOL_VIRTUAL } from '../constants.js';
3
3
  import { isAbsolute, isInNodeModules, join, toPosix } from './path.js';
4
4
  export const getPackageNameFromModuleSpecifier = (specifier) => {
5
- if (!isStartsLikePackageName(specifier))
5
+ if (!isStartsLikePackageName(specifier) && !isTildePackageName(specifier))
6
6
  return;
7
7
  let start = 0;
8
8
  if (specifier.charCodeAt(0) === 64) {
@@ -55,6 +55,7 @@ export const isStartsLikePackageName = (specifier) => {
55
55
  const ch = specifier.charCodeAt(0);
56
56
  return ch === 64 ? isPackageScopeStart(specifier.charCodeAt(1)) : isPackageNameStart(ch);
57
57
  };
58
+ const isTildePackageName = (specifier) => specifier.charCodeAt(0) === 126 && isPackageNameStart(specifier.charCodeAt(1));
58
59
  export const stripVersionFromSpecifier = (specifier) => specifier.replace(/(\S+)@.*/, '$1');
59
60
  export const isInNodeModulesBin = (value) => value.includes('node_modules/.bin/');
60
61
  export const isRelativeNodeModulesBin = (value) => /^(?:\.\.?\/)*node_modules\/\.bin\//.test(value);
@@ -1,4 +1,5 @@
1
1
  import { FIX_FLAGS } from '../constants.js';
2
+ const importAttributesMatcher = /^(?:\s*with|[^\S\r\n\u2028\u2029]*assert)\s*\{[^}]*\}/;
2
3
  const getOpeningBracketIndex = (text) => {
3
4
  let bracketOpenIndex = -1;
4
5
  let j = text.length - 1;
@@ -65,7 +66,8 @@ export const removeExport = ({ text, start, end, flags }) => {
65
66
  const specifierQuoteMatch = afterEnd.match(/['"][^'"]+['"]/);
66
67
  if (specifierQuoteMatch?.index) {
67
68
  const fromSpecifierLength = specifierQuoteMatch.index + specifierQuoteMatch[0].length;
68
- return beforeBracket.substring(0, exportKeywordOffset) + afterEnd.substring(fromSpecifierLength);
69
+ const afterSpecifier = afterEnd.substring(fromSpecifierLength).replace(importAttributesMatcher, '');
70
+ return beforeBracket.substring(0, exportKeywordOffset) + afterSpecifier;
69
71
  }
70
72
  }
71
73
  return beforeBracket.substring(0, exportKeywordOffset) + afterEnd.substring(closingBracketOffset);
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "6.42.1";
1
+ export declare const version = "6.43.0";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const version = '6.42.1';
1
+ export const version = '6.43.0';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "knip",
3
- "version": "6.42.1",
3
+ "version": "6.43.0",
4
4
  "description": "Find and fix unused dependencies, exports and files in your TypeScript and JavaScript projects",
5
5
  "keywords": [
6
6
  "analysis",
@@ -84,13 +84,13 @@
84
84
  "formatly": "^0.11.4",
85
85
  "get-tsconfig": "4.14.3",
86
86
  "jiti": "^2.7.0",
87
- "oxc-parser": "^0.154.0",
87
+ "oxc-parser": "^0.155.0",
88
88
  "oxc-resolver": "11.24.2",
89
89
  "picomatch": "^4.0.7",
90
90
  "smol-toml": "^1.9.0",
91
91
  "strip-json-comments": "5.0.3",
92
92
  "tinyglobby": "^0.2.17",
93
- "unbash": "^6.0.0",
93
+ "unbash": "^6.0.1",
94
94
  "yaml": "^2.9.1",
95
95
  "zod": "^4.6.5"
96
96
  },
@@ -102,7 +102,7 @@
102
102
  "prettier": "^3.9.10",
103
103
  "tsx": "^4.23.15",
104
104
  "typescript": "7.0.2",
105
- "webpack": "^5.111.1"
105
+ "webpack": "^5.112.0"
106
106
  },
107
107
  "engines": {
108
108
  "node": "^20.19.0 || >=22.12.0"
package/schema.json CHANGED
@@ -454,6 +454,10 @@
454
454
  "title": "borp plugin configuration (https://knip.dev/reference/plugins/borp)",
455
455
  "$ref": "#/definitions/plugin"
456
456
  },
457
+ "buf": {
458
+ "title": "buf plugin configuration (https://knip.dev/reference/plugins/buf)",
459
+ "$ref": "#/definitions/plugin"
460
+ },
457
461
  "bumpp": {
458
462
  "title": "bumpp plugin configuration (https://knip.dev/reference/plugins/bumpp)",
459
463
  "$ref": "#/definitions/plugin"
@@ -534,6 +538,10 @@
534
538
  "title": "Drizzle plugin configuration (https://knip.dev/reference/plugins/drizzle)",
535
539
  "$ref": "#/definitions/plugin"
536
540
  },
541
+ "electron-forge": {
542
+ "title": "Electron Forge plugin configuration (https://knip.dev/reference/plugins/electron-forge)",
543
+ "$ref": "#/definitions/plugin"
544
+ },
537
545
  "electron-vite": {
538
546
  "title": "electron-vite plugin configuration (https://knip.dev/reference/plugins/electron-vite)",
539
547
  "$ref": "#/definitions/plugin"
@@ -674,6 +682,10 @@
674
682
  "title": "marko plugin configuration (https://knip.dev/reference/plugins/marko)",
675
683
  "$ref": "#/definitions/plugin"
676
684
  },
685
+ "mcp": {
686
+ "title": "mcp plugin configuration (https://knip.dev/reference/plugins/mcp)",
687
+ "$ref": "#/definitions/plugin"
688
+ },
677
689
  "mdx": {
678
690
  "title": "mdx plugin configuration (https://knip.dev/reference/plugins/mdx)",
679
691
  "$ref": "#/definitions/plugin"