knip 6.30.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 (64) hide show
  1. package/dist/ConfigurationChief.d.ts +24 -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 +40 -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 +4 -0
  29. package/dist/plugins/index.js +8 -0
  30. package/dist/plugins/jest/index.js +6 -2
  31. package/dist/plugins/marko/compiler.d.ts +2 -0
  32. package/dist/plugins/marko/compiler.js +85 -0
  33. package/dist/plugins/marko/index.d.ts +3 -0
  34. package/dist/plugins/marko/index.js +63 -0
  35. package/dist/plugins/marko/taglibs.d.ts +4 -0
  36. package/dist/plugins/marko/taglibs.js +111 -0
  37. package/dist/plugins/marko/types.d.ts +9 -0
  38. package/dist/plugins/marko/types.js +1 -0
  39. package/dist/plugins/mocha/index.js +59 -0
  40. package/dist/plugins/playwright/index.js +1 -1
  41. package/dist/plugins/pre-commit/index.d.ts +3 -0
  42. package/dist/plugins/pre-commit/index.js +23 -0
  43. package/dist/plugins/rollup/index.js +5 -1
  44. package/dist/plugins/tsd/index.d.ts +3 -0
  45. package/dist/plugins/tsd/index.js +43 -0
  46. package/dist/plugins/tsd/types.d.ts +4 -0
  47. package/dist/plugins/tsd/types.js +1 -0
  48. package/dist/schema/configuration.d.ts +60 -0
  49. package/dist/schema/plugins.d.ts +20 -0
  50. package/dist/schema/plugins.js +4 -0
  51. package/dist/types/PluginNames.d.ts +2 -2
  52. package/dist/types/PluginNames.js +4 -0
  53. package/dist/types/config.d.ts +4 -2
  54. package/dist/util/create-input-handler.js +2 -0
  55. package/dist/util/create-options.d.ts +40 -0
  56. package/dist/util/package-json.d.ts +4 -0
  57. package/dist/util/package-json.js +6 -2
  58. package/dist/util/parse-args.d.ts +2 -1
  59. package/dist/util/parse-args.js +8 -1
  60. package/dist/util/scripts.js +9 -5
  61. package/dist/version.d.ts +1 -1
  62. package/dist/version.js +1 -1
  63. package/package.json +3 -3
  64. package/schema.json +16 -0
@@ -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;
@@ -226,6 +227,7 @@ export declare const getPublishedTypeManifest: (manifest: PackageJson) => {
226
227
  "lost-pixel": unknown;
227
228
  lunaria: unknown;
228
229
  markdownlint: unknown;
230
+ marko: unknown;
229
231
  mdx: unknown;
230
232
  mdxlint: unknown;
231
233
  metro: unknown;
@@ -264,6 +266,7 @@ export declare const getPublishedTypeManifest: (manifest: PackageJson) => {
264
266
  plop: unknown;
265
267
  pm2: unknown;
266
268
  postcss: unknown;
269
+ "pre-commit": unknown;
267
270
  preconstruct: unknown;
268
271
  prettier: unknown;
269
272
  prisma: unknown;
@@ -310,6 +313,7 @@ export declare const getPublishedTypeManifest: (manifest: PackageJson) => {
310
313
  temporal: unknown;
311
314
  travis: unknown;
312
315
  "ts-node": unknown;
316
+ tsd: unknown;
313
317
  tsdown: unknown;
314
318
  tsup: unknown;
315
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.30.0";
1
+ export declare const version = "6.32.0";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const version = '6.30.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.30.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"
@@ -630,6 +634,10 @@
630
634
  "title": "markdownlint plugin configuration (https://knip.dev/reference/plugins/markdownlint)",
631
635
  "$ref": "#/definitions/plugin"
632
636
  },
637
+ "marko": {
638
+ "title": "marko plugin configuration (https://knip.dev/reference/plugins/marko)",
639
+ "$ref": "#/definitions/plugin"
640
+ },
633
641
  "mdx": {
634
642
  "title": "mdx plugin configuration (https://knip.dev/reference/plugins/mdx)",
635
643
  "$ref": "#/definitions/plugin"
@@ -782,6 +790,10 @@
782
790
  "title": "PostCSS plugin configuration (https://knip.dev/reference/plugins/postcss)",
783
791
  "$ref": "#/definitions/plugin"
784
792
  },
793
+ "pre-commit": {
794
+ "title": "pre-commit plugin configuration (https://knip.dev/reference/plugins/pre-commit)",
795
+ "$ref": "#/definitions/plugin"
796
+ },
785
797
  "preconstruct": {
786
798
  "title": "preconstruct plugin configuration (https://knip.dev/reference/plugins/preconstruct)",
787
799
  "$ref": "#/definitions/plugin"
@@ -962,6 +974,10 @@
962
974
  "title": "ts-node plugin configuration (https://knip.dev/reference/plugins/ts-node)",
963
975
  "$ref": "#/definitions/plugin"
964
976
  },
977
+ "tsd": {
978
+ "title": "tsd plugin configuration (https://knip.dev/reference/plugins/tsd)",
979
+ "$ref": "#/definitions/plugin"
980
+ },
965
981
  "tsdown": {
966
982
  "title": "tsdown plugin configuration (https://knip.dev/reference/plugins/tsdown)",
967
983
  "$ref": "#/definitions/plugin"