knip 6.31.0 → 6.32.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 (56) hide show
  1. package/dist/ConfigurationChief.d.ts +18 -0
  2. package/dist/DependencyDeputy.d.ts +2 -1
  3. package/dist/DependencyDeputy.js +2 -2
  4. package/dist/binaries/bash-parser.js +20 -8
  5. package/dist/binaries/fallback.js +6 -4
  6. package/dist/binaries/plugins.js +8 -4
  7. package/dist/binaries/resolvers/bun.js +7 -7
  8. package/dist/binaries/resolvers/bunx.d.ts +2 -1
  9. package/dist/binaries/resolvers/bunx.js +10 -6
  10. package/dist/binaries/resolvers/find.js +5 -5
  11. package/dist/binaries/resolvers/npm.js +5 -5
  12. package/dist/binaries/resolvers/npx.js +3 -4
  13. package/dist/binaries/resolvers/nub.js +4 -4
  14. package/dist/binaries/resolvers/pnpm.js +12 -9
  15. package/dist/binaries/resolvers/pnpx.d.ts +2 -1
  16. package/dist/binaries/resolvers/pnpx.js +4 -4
  17. package/dist/binaries/resolvers/yarn.js +17 -13
  18. package/dist/binaries/util.d.ts +6 -4
  19. package/dist/binaries/util.js +25 -3
  20. package/dist/compilers/index.d.ts +30 -0
  21. package/dist/graph/analyze.js +1 -0
  22. package/dist/graph/build.js +1 -0
  23. package/dist/plugins/babel/types.d.ts +1 -0
  24. package/dist/plugins/borp/index.d.ts +3 -0
  25. package/dist/plugins/borp/index.js +61 -0
  26. package/dist/plugins/borp/types.d.ts +4 -0
  27. package/dist/plugins/borp/types.js +1 -0
  28. package/dist/plugins/index.d.ts +3 -0
  29. package/dist/plugins/index.js +6 -0
  30. package/dist/plugins/jest/index.js +6 -2
  31. package/dist/plugins/mocha/index.js +59 -0
  32. package/dist/plugins/playwright/index.js +1 -1
  33. package/dist/plugins/pre-commit/index.d.ts +3 -0
  34. package/dist/plugins/pre-commit/index.js +23 -0
  35. package/dist/plugins/rollup/index.js +5 -1
  36. package/dist/plugins/tsd/index.d.ts +3 -0
  37. package/dist/plugins/tsd/index.js +43 -0
  38. package/dist/plugins/tsd/types.d.ts +4 -0
  39. package/dist/plugins/tsd/types.js +1 -0
  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 +4 -2
  46. package/dist/util/create-input-handler.js +2 -0
  47. package/dist/util/create-options.d.ts +30 -0
  48. package/dist/util/package-json.d.ts +3 -0
  49. package/dist/util/package-json.js +6 -2
  50. package/dist/util/parse-args.d.ts +2 -1
  51. package/dist/util/parse-args.js +8 -1
  52. package/dist/util/scripts.js +9 -5
  53. package/dist/version.d.ts +1 -1
  54. package/dist/version.js +1 -1
  55. package/package.json +3 -3
  56. package/schema.json +12 -0
@@ -1,2 +1,2 @@
1
- export type PluginName = 'angular' | 'astro' | 'astro-db' | 'astro-markdoc' | 'astro-og-canvas' | 'ava' | 'babel' | 'biome' | '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' | 'expressive-code' | 'fast' | 'fumadocs' | 'gatsby' | 'github-action' | 'github-actions' | 'glob' | 'graphql-codegen' | 'hardhat' | 'husky' | 'i18next-parser' | 'jest' | 'karma' | 'knex' | 'ladle' | 'laravel-vite-plugin' | 'lefthook' | 'lint-staged' | 'linthtml' | 'lit' | 'lockfile-lint' | 'lost-pixel' | 'lunaria' | 'markdownlint' | 'marko' | 'mdx' | 'mdxlint' | 'metro' | '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' | 'oxfmt' | 'oxlint' | 'panda-css' | 'parcel' | 'payload' | 'pino' | 'playwright' | 'playwright-ct' | 'playwright-test' | 'plop' | 'pm2' | 'pnpm' | 'postcss' | 'preconstruct' | 'prettier' | 'prisma' | 'quasar' | 'qwik' | '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' | 'sst' | 'starlight' | 'stencil' | 'storybook' | 'stryker' | 'stylelint' | 'svelte' | 'sveltejs-package' | 'sveltekit' | 'svgo' | 'svgr' | 'swc' | 'syncpack' | 'tailwind' | 'tanstack-router' | 'taskfile' | 'tauri' | 'temporal' | 'travis' | 'ts-node' | 'tsdown' | 'tsup' | 'tsx' | 'typedoc' | 'typescript' | 'unbuild' | 'unocss' | 'unplugin-auto-import' | 'unplugin-icons' | 'unplugin-vue-components' | 'unplugin-vue-i18n' | 'unplugin-vue-markdown' | 'unplugin-vue-router' | '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', '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', 'expressive-code', 'fast', 'fumadocs', 'gatsby', 'github-action', 'github-actions', 'glob', 'graphql-codegen', 'hardhat', 'husky', 'i18next-parser', 'jest', 'karma', 'knex', 'ladle', 'laravel-vite-plugin', 'lefthook', 'lint-staged', 'linthtml', 'lit', 'lockfile-lint', 'lost-pixel', 'lunaria', 'markdownlint', 'marko', 'mdx', 'mdxlint', 'metro', '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', 'oxfmt', 'oxlint', 'panda-css', 'parcel', 'payload', 'pino', 'playwright', 'playwright-ct', 'playwright-test', 'plop', 'pm2', 'pnpm', 'postcss', 'preconstruct', 'prettier', 'prisma', 'quasar', 'qwik', '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', 'sst', 'starlight', 'stencil', 'storybook', 'stryker', 'stylelint', 'svelte', 'sveltejs-package', 'sveltekit', 'svgo', 'svgr', 'swc', 'syncpack', 'tailwind', 'tanstack-router', 'taskfile', 'tauri', 'temporal', 'travis', 'ts-node', 'tsdown', 'tsup', 'tsx', 'typedoc', 'typescript', 'unbuild', 'unocss', 'unplugin-auto-import', 'unplugin-icons', 'unplugin-vue-components', 'unplugin-vue-i18n', 'unplugin-vue-markdown', 'unplugin-vue-router', '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' | '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' | 'expressive-code' | 'fast' | 'fumadocs' | 'gatsby' | 'github-action' | 'github-actions' | 'glob' | 'graphql-codegen' | 'hardhat' | 'husky' | 'i18next-parser' | 'jest' | 'karma' | 'knex' | 'ladle' | 'laravel-vite-plugin' | 'lefthook' | 'lint-staged' | 'linthtml' | 'lit' | 'lockfile-lint' | 'lost-pixel' | 'lunaria' | 'markdownlint' | 'marko' | 'mdx' | 'mdxlint' | 'metro' | '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' | 'oxfmt' | 'oxlint' | 'panda-css' | 'parcel' | 'payload' | 'pino' | 'playwright' | 'playwright-ct' | 'playwright-test' | 'plop' | 'pm2' | 'pnpm' | 'postcss' | 'pre-commit' | 'preconstruct' | 'prettier' | 'prisma' | 'quasar' | 'qwik' | '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' | 'sst' | 'starlight' | 'stencil' | 'storybook' | 'stryker' | 'stylelint' | 'svelte' | 'sveltejs-package' | 'sveltekit' | 'svgo' | 'svgr' | 'swc' | 'syncpack' | 'tailwind' | 'tanstack-router' | 'taskfile' | 'tauri' | 'temporal' | 'travis' | 'ts-node' | 'tsd' | 'tsdown' | 'tsup' | 'tsx' | 'typedoc' | 'typescript' | 'unbuild' | 'unocss' | 'unplugin-auto-import' | 'unplugin-icons' | 'unplugin-vue-components' | 'unplugin-vue-i18n' | 'unplugin-vue-markdown' | 'unplugin-vue-router' | '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', 'expressive-code', 'fast', 'fumadocs', 'gatsby', 'github-action', 'github-actions', 'glob', 'graphql-codegen', 'hardhat', 'husky', 'i18next-parser', 'jest', 'karma', 'knex', 'ladle', 'laravel-vite-plugin', 'lefthook', 'lint-staged', 'linthtml', 'lit', 'lockfile-lint', 'lost-pixel', 'lunaria', 'markdownlint', 'marko', 'mdx', 'mdxlint', 'metro', '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', 'oxfmt', 'oxlint', 'panda-css', 'parcel', 'payload', 'pino', 'playwright', 'playwright-ct', 'playwright-test', 'plop', 'pm2', 'pnpm', 'postcss', 'pre-commit', 'preconstruct', 'prettier', 'prisma', 'quasar', 'qwik', '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', 'sst', 'starlight', 'stencil', 'storybook', 'stryker', 'stylelint', 'svelte', 'sveltejs-package', 'sveltekit', 'svgo', 'svgr', 'swc', 'syncpack', 'tailwind', 'tanstack-router', 'taskfile', 'tauri', 'temporal', 'travis', 'ts-node', 'tsd', 'tsdown', 'tsup', 'tsx', 'typedoc', 'typescript', 'unbuild', 'unocss', 'unplugin-auto-import', 'unplugin-icons', 'unplugin-vue-components', 'unplugin-vue-i18n', 'unplugin-vue-markdown', 'unplugin-vue-router', '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'];
@@ -7,6 +7,7 @@ export const pluginNames = [
7
7
  'ava',
8
8
  'babel',
9
9
  'biome',
10
+ 'borp',
10
11
  'bumpp',
11
12
  'bun',
12
13
  'c8',
@@ -98,6 +99,7 @@ export const pluginNames = [
98
99
  'pm2',
99
100
  'pnpm',
100
101
  'postcss',
102
+ 'pre-commit',
101
103
  'preconstruct',
102
104
  'prettier',
103
105
  'prisma',
@@ -144,6 +146,7 @@ export const pluginNames = [
144
146
  'temporal',
145
147
  'travis',
146
148
  'ts-node',
149
+ 'tsd',
147
150
  'tsdown',
148
151
  'tsup',
149
152
  'tsx',
@@ -1,4 +1,5 @@
1
1
  import type { Program, VisitorObject } from 'oxc-parser';
2
+ import type { Word } from 'unbash';
2
3
  import type { z } from 'zod/mini';
3
4
  import type { AsyncCompilers, CompilerSync, HasDependency, SyncCompilers } from '../compilers/types.ts';
4
5
  import type { knipConfigurationSchema, workspaceConfigurationSchema } from '../schema/configuration.ts';
@@ -18,11 +19,12 @@ export interface GetInputsFromScriptsOptions extends BaseOptions {
18
19
  }
19
20
  export type GetInputsFromScripts<T = GetInputsFromScriptsOptions> = (npmScripts: string | string[] | Set<string>, options: T) => Input[];
20
21
  export type GetInputsFromScriptsPartial = (npmScripts: string | string[] | Set<string>, options?: Partial<GetInputsFromScriptsOptions>) => Input[];
21
- export type FromArgs = (args: string[], options?: Partial<GetInputsFromScriptsOptions>) => Input[];
22
+ export type ScriptArg = string | Word;
23
+ export type FromArgs = (args: ScriptArg[], options?: Partial<GetInputsFromScriptsOptions>) => Input[];
22
24
  export interface BinaryResolverOptions extends GetInputsFromScriptsOptions {
23
25
  fromArgs: FromArgs;
24
26
  }
25
- export type BinaryResolver = (binary: string, args: string[], options: BinaryResolverOptions) => Input[];
27
+ export type BinaryResolver = (binary: string, words: Word[], options: BinaryResolverOptions) => Input[];
26
28
  export type RawConfiguration = z.infer<typeof knipConfigurationSchema>;
27
29
  export type RawConfigurationOrFn = RawConfiguration | ((options: ParsedCLIArgs) => RawConfiguration | Promise<RawConfiguration>);
28
30
  export type RawPluginConfiguration = z.infer<typeof pluginSchema>;
@@ -56,6 +56,7 @@ export const createInputHandler = (deputy, chief, isGitIgnored, addIssue, extern
56
56
  const inputWorkspace = getWorkspaceFor(input, chief, workspace);
57
57
  if (inputWorkspace) {
58
58
  let isHandled = deputy.maybeAddReferencedExternalDependency(inputWorkspace, packageName, {
59
+ specifier,
59
60
  isDevOnly: isConfig(input),
60
61
  isTypeOnly: input.isTypeOnly,
61
62
  });
@@ -63,6 +64,7 @@ export const createInputHandler = (deputy, chief, isGitIgnored, addIssue, extern
63
64
  const owningWorkspace = chief.findWorkspaceByFilePath(input.containingFilePath);
64
65
  if (owningWorkspace && owningWorkspace !== inputWorkspace) {
65
66
  const isOwnerHandled = deputy.maybeAddReferencedExternalDependency(owningWorkspace, packageName, {
67
+ specifier,
66
68
  isDevOnly: isConfig(input),
67
69
  isTypeOnly: input.isTypeOnly,
68
70
  });
@@ -85,6 +85,11 @@ export declare const createOptions: (options: CreateOptions) => Promise<{
85
85
  entry?: string | string[] | undefined;
86
86
  project?: string | string[] | undefined;
87
87
  } | undefined;
88
+ borp?: string | boolean | string[] | {
89
+ config?: string | string[] | undefined;
90
+ entry?: string | string[] | undefined;
91
+ project?: string | string[] | undefined;
92
+ } | undefined;
88
93
  bumpp?: string | boolean | string[] | {
89
94
  config?: string | string[] | undefined;
90
95
  entry?: string | string[] | undefined;
@@ -540,6 +545,11 @@ export declare const createOptions: (options: CreateOptions) => Promise<{
540
545
  entry?: string | string[] | undefined;
541
546
  project?: string | string[] | undefined;
542
547
  } | undefined;
548
+ 'pre-commit'?: string | boolean | string[] | {
549
+ config?: string | string[] | undefined;
550
+ entry?: string | string[] | undefined;
551
+ project?: string | string[] | undefined;
552
+ } | undefined;
543
553
  preconstruct?: string | boolean | string[] | {
544
554
  config?: string | string[] | undefined;
545
555
  entry?: string | string[] | undefined;
@@ -770,6 +780,11 @@ export declare const createOptions: (options: CreateOptions) => Promise<{
770
780
  entry?: string | string[] | undefined;
771
781
  project?: string | string[] | undefined;
772
782
  } | undefined;
783
+ tsd?: string | boolean | string[] | {
784
+ config?: string | string[] | undefined;
785
+ entry?: string | string[] | undefined;
786
+ project?: string | string[] | undefined;
787
+ } | undefined;
773
788
  tsdown?: string | boolean | string[] | {
774
789
  config?: string | string[] | undefined;
775
790
  entry?: string | string[] | undefined;
@@ -1008,6 +1023,11 @@ export declare const createOptions: (options: CreateOptions) => Promise<{
1008
1023
  entry?: string | string[] | undefined;
1009
1024
  project?: string | string[] | undefined;
1010
1025
  } | undefined;
1026
+ borp?: string | boolean | string[] | {
1027
+ config?: string | string[] | undefined;
1028
+ entry?: string | string[] | undefined;
1029
+ project?: string | string[] | undefined;
1030
+ } | undefined;
1011
1031
  bumpp?: string | boolean | string[] | {
1012
1032
  config?: string | string[] | undefined;
1013
1033
  entry?: string | string[] | undefined;
@@ -1463,6 +1483,11 @@ export declare const createOptions: (options: CreateOptions) => Promise<{
1463
1483
  entry?: string | string[] | undefined;
1464
1484
  project?: string | string[] | undefined;
1465
1485
  } | undefined;
1486
+ 'pre-commit'?: string | boolean | string[] | {
1487
+ config?: string | string[] | undefined;
1488
+ entry?: string | string[] | undefined;
1489
+ project?: string | string[] | undefined;
1490
+ } | undefined;
1466
1491
  preconstruct?: string | boolean | string[] | {
1467
1492
  config?: string | string[] | undefined;
1468
1493
  entry?: string | string[] | undefined;
@@ -1693,6 +1718,11 @@ export declare const createOptions: (options: CreateOptions) => Promise<{
1693
1718
  entry?: string | string[] | undefined;
1694
1719
  project?: string | string[] | undefined;
1695
1720
  } | undefined;
1721
+ tsd?: string | boolean | string[] | {
1722
+ config?: string | string[] | undefined;
1723
+ entry?: string | string[] | undefined;
1724
+ project?: string | string[] | undefined;
1725
+ } | undefined;
1696
1726
  tsdown?: string | boolean | string[] | {
1697
1727
  config?: string | string[] | undefined;
1698
1728
  entry?: string | string[] | undefined;
@@ -175,6 +175,7 @@ export declare const getPublishedTypeManifest: (manifest: PackageJson) => {
175
175
  ava: unknown;
176
176
  babel: unknown;
177
177
  biome: unknown;
178
+ borp: unknown;
178
179
  bumpp: unknown;
179
180
  bun: unknown;
180
181
  c8: unknown;
@@ -265,6 +266,7 @@ export declare const getPublishedTypeManifest: (manifest: PackageJson) => {
265
266
  plop: unknown;
266
267
  pm2: unknown;
267
268
  postcss: unknown;
269
+ "pre-commit": unknown;
268
270
  preconstruct: unknown;
269
271
  prettier: unknown;
270
272
  prisma: unknown;
@@ -311,6 +313,7 @@ export declare const getPublishedTypeManifest: (manifest: PackageJson) => {
311
313
  temporal: unknown;
312
314
  travis: unknown;
313
315
  "ts-node": unknown;
316
+ tsd: unknown;
314
317
  tsdown: unknown;
315
318
  tsup: unknown;
316
319
  tsx: unknown;
@@ -1,5 +1,6 @@
1
1
  import { readFile, writeFile } from 'node:fs/promises';
2
2
  import { IS_DTS } from '../constants.js';
3
+ import { getPackageNameFromModuleSpecifier } from './modules.js';
3
4
  const INDENT = Symbol.for('indent');
4
5
  const NEWLINE = Symbol.for('newline');
5
6
  const DEFAULT_NEWLINE = '\n';
@@ -265,8 +266,11 @@ export const getManifestImportDependencies = (manifest) => {
265
266
  if (!entry.startsWith('#'))
266
267
  continue;
267
268
  for (const item of getEntriesFromExports(exportValue)) {
268
- if (!item.startsWith('.') && !item.startsWith('!'))
269
- dependencies.add(item);
269
+ if (item.startsWith('.') || item.startsWith('!'))
270
+ continue;
271
+ const packageName = getPackageNameFromModuleSpecifier(item);
272
+ if (packageName)
273
+ dependencies.add(packageName);
270
274
  }
271
275
  }
272
276
  return dependencies;
@@ -1,3 +1,4 @@
1
+ import type { Word } from 'unbash';
1
2
  type ParsedValue = any;
2
3
  export interface ParsedArgs {
3
4
  _: string[];
@@ -10,5 +11,5 @@ interface Opts {
10
11
  alias?: Record<string, string | string[]>;
11
12
  '--'?: boolean;
12
13
  }
13
- declare const parseArgs: (argv: string[], opts?: Opts) => ParsedArgs;
14
+ declare const parseArgs: (input: readonly (string | Word)[], opts?: Opts) => ParsedArgs;
14
15
  export default parseArgs;
@@ -17,7 +17,14 @@ const setNested = (target, key, value) => {
17
17
  }
18
18
  obj[parts[parts.length - 1]] = value;
19
19
  };
20
- const parseArgs = (argv, opts = {}) => {
20
+ const parseArgs = (input, opts = {}) => {
21
+ const argv = [];
22
+ for (const arg of input) {
23
+ if (typeof arg === 'string')
24
+ argv.push(arg);
25
+ else if (arg && typeof arg.value === 'string')
26
+ argv.push(arg.value);
27
+ }
21
28
  const strings = new Set(opts.string ?? []);
22
29
  const booleans = new Set(opts.boolean ?? []);
23
30
  const groups = new Map();
@@ -1,6 +1,6 @@
1
1
  import { parse } from 'unbash';
2
2
  import { extractBinary } from './modules.js';
3
- const spawningBinaries = new Set(['cross-env', 'retry-cli']);
3
+ const spawningBinaries = new Set(['c8', 'cross-env', 'retry-cli']);
4
4
  export function* walkCommands(node) {
5
5
  switch (node.type) {
6
6
  case 'Command':
@@ -64,11 +64,15 @@ export const getScriptCommands = (script) => {
64
64
  if (!text)
65
65
  continue;
66
66
  const binary = extractBinary(text);
67
- const args = node.suffix.map(word => word.value);
68
- if (spawningBinaries.has(binary))
69
- out.push(...getScriptCommands(args.filter(arg => arg !== '--').join(' ')));
67
+ if (spawningBinaries.has(binary)) {
68
+ const rest = node.suffix
69
+ .filter(word => word.text !== '--')
70
+ .map(word => word.text)
71
+ .join(' ');
72
+ out.push(...getScriptCommands(rest));
73
+ }
70
74
  else
71
- out.push({ binary, args });
75
+ out.push({ binary, args: node.suffix.map(word => word.value) });
72
76
  }
73
77
  }
74
78
  return out;
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "6.31.0";
1
+ export declare const version = "6.32.0";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const version = '6.31.0';
1
+ export const version = '6.32.0';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "knip",
3
- "version": "6.31.0",
3
+ "version": "6.32.0",
4
4
  "description": "Find and fix unused dependencies, exports and files in your TypeScript and JavaScript projects",
5
5
  "keywords": [
6
6
  "analysis",
@@ -79,7 +79,7 @@
79
79
  "dependencies": {
80
80
  "fdir": "^6.5.0",
81
81
  "formatly": "^0.3.0",
82
- "get-tsconfig": "4.14.0",
82
+ "get-tsconfig": "4.14.1",
83
83
  "jiti": "^2.7.0",
84
84
  "oxc-parser": "^0.142.0",
85
85
  "oxc-resolver": "11.24.2",
@@ -98,7 +98,7 @@
98
98
  "@types/webpack": "^5.28.5",
99
99
  "codeclimate-types": "^0.3.1",
100
100
  "prettier": "^3.9.6",
101
- "tsx": "^4.23.1",
101
+ "tsx": "^4.23.5",
102
102
  "typescript": "7.0.2"
103
103
  },
104
104
  "engines": {
package/schema.json CHANGED
@@ -430,6 +430,10 @@
430
430
  "title": "biome plugin configuration (https://knip.dev/reference/plugins/biome)",
431
431
  "$ref": "#/definitions/plugin"
432
432
  },
433
+ "borp": {
434
+ "title": "borp plugin configuration (https://knip.dev/reference/plugins/borp)",
435
+ "$ref": "#/definitions/plugin"
436
+ },
433
437
  "bumpp": {
434
438
  "title": "bumpp plugin configuration (https://knip.dev/reference/plugins/bumpp)",
435
439
  "$ref": "#/definitions/plugin"
@@ -786,6 +790,10 @@
786
790
  "title": "PostCSS plugin configuration (https://knip.dev/reference/plugins/postcss)",
787
791
  "$ref": "#/definitions/plugin"
788
792
  },
793
+ "pre-commit": {
794
+ "title": "pre-commit plugin configuration (https://knip.dev/reference/plugins/pre-commit)",
795
+ "$ref": "#/definitions/plugin"
796
+ },
789
797
  "preconstruct": {
790
798
  "title": "preconstruct plugin configuration (https://knip.dev/reference/plugins/preconstruct)",
791
799
  "$ref": "#/definitions/plugin"
@@ -966,6 +974,10 @@
966
974
  "title": "ts-node plugin configuration (https://knip.dev/reference/plugins/ts-node)",
967
975
  "$ref": "#/definitions/plugin"
968
976
  },
977
+ "tsd": {
978
+ "title": "tsd plugin configuration (https://knip.dev/reference/plugins/tsd)",
979
+ "$ref": "#/definitions/plugin"
980
+ },
969
981
  "tsdown": {
970
982
  "title": "tsdown plugin configuration (https://knip.dev/reference/plugins/tsdown)",
971
983
  "$ref": "#/definitions/plugin"