knip 6.23.0 → 6.25.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.
- package/LICENSE +1 -1
- package/dist/ConfigurationChief.d.ts +13 -1
- package/dist/ConfigurationChief.js +3 -0
- package/dist/ProjectPrincipal.d.ts +2 -0
- package/dist/ProjectPrincipal.js +7 -6
- package/dist/WorkspaceWorker.d.ts +3 -1
- package/dist/WorkspaceWorker.js +5 -2
- package/dist/binaries/bash-parser.js +55 -83
- package/dist/binaries/index.js +3 -0
- package/dist/binaries/resolvers/yarn.js +4 -3
- package/dist/compilers/compilers.d.ts +2 -0
- package/dist/compilers/compilers.js +15 -4
- package/dist/compilers/index.d.ts +30 -6
- package/dist/compilers/index.js +25 -10
- package/dist/compilers/less.d.ts +7 -0
- package/dist/compilers/less.js +37 -0
- package/dist/compilers/mdx.d.ts +1 -2
- package/dist/compilers/mdx.js +14 -8
- package/dist/compilers/scss.d.ts +3 -2
- package/dist/compilers/scss.js +17 -14
- package/dist/compilers/shared.d.ts +6 -0
- package/dist/compilers/shared.js +9 -0
- package/dist/compilers/style-preprocessors.d.ts +2 -0
- package/dist/compilers/style-preprocessors.js +41 -0
- package/dist/compilers/stylus.d.ts +7 -0
- package/dist/compilers/stylus.js +36 -0
- package/dist/constants.d.ts +5 -1
- package/dist/constants.js +7 -0
- package/dist/graph/analyze.js +37 -2
- package/dist/graph/build.js +23 -1
- package/dist/graph-explorer/explorer.d.ts +1 -0
- package/dist/graph-explorer/explorer.js +2 -0
- package/dist/graph-explorer/operations/find-all-cycles.d.ts +3 -0
- package/dist/graph-explorer/operations/find-all-cycles.js +43 -0
- package/dist/graph-explorer/operations/find-cycles.js +3 -9
- package/dist/graph-explorer/utils.d.ts +10 -1
- package/dist/graph-explorer/utils.js +53 -0
- package/dist/plugins/astro/compiler-mdx.js +11 -2
- package/dist/plugins/astro/compiler.js +8 -4
- package/dist/plugins/bun/index.js +28 -14
- package/dist/plugins/eve/index.d.ts +3 -0
- package/dist/plugins/eve/index.js +22 -0
- package/dist/plugins/execa/visitors/execa.js +10 -18
- package/dist/plugins/fumadocs/index.d.ts +3 -0
- package/dist/plugins/fumadocs/index.js +18 -0
- package/dist/plugins/github-actions/index.js +3 -2
- package/dist/plugins/graphql-codegen/index.js +9 -7
- package/dist/plugins/index.d.ts +2 -0
- package/dist/plugins/index.js +4 -0
- package/dist/plugins/jest/index.js +13 -3
- package/dist/plugins/next/index.js +23 -10
- package/dist/plugins/node/index.js +4 -1
- package/dist/plugins/nuxt/index.js +4 -2
- package/dist/plugins/pnpm/index.js +21 -1
- package/dist/plugins/pnpm/types.d.ts +6 -0
- package/dist/plugins/pnpm/types.js +1 -0
- package/dist/plugins/prettier/index.js +19 -3
- package/dist/plugins/prettier/types.d.ts +6 -1
- package/dist/plugins/prisma/compiler.js +3 -0
- package/dist/plugins/rspack/index.js +5 -0
- package/dist/plugins/serverless-framework/index.js +12 -1
- package/dist/plugins/serverless-framework/types.d.ts +5 -2
- package/dist/plugins/stencil/index.js +59 -1
- package/dist/plugins/storybook/index.js +7 -0
- package/dist/plugins/svelte/compiler.d.ts +2 -1
- package/dist/plugins/svelte/compiler.js +8 -1
- package/dist/plugins/tailwind/compiler.js +3 -0
- package/dist/plugins/tailwind/index.js +5 -1
- package/dist/plugins/typedoc/index.js +9 -3
- package/dist/plugins/typedoc/types.d.ts +2 -0
- package/dist/plugins/vite/visitors/importMetaGlob.js +1 -8
- package/dist/plugins/vue/compiler.d.ts +2 -1
- package/dist/plugins/vue/compiler.js +8 -1
- package/dist/plugins/webpack/visitors/requireContext.js +2 -13
- package/dist/plugins/yarn/index.js +13 -4
- package/dist/plugins/yarn/types.d.ts +10 -0
- package/dist/plugins/yarn/types.js +1 -0
- package/dist/plugins/zx/visitors/zx.js +4 -4
- package/dist/reporters/compact.js +1 -2
- package/dist/reporters/cycles.d.ts +3 -0
- package/dist/reporters/cycles.js +79 -0
- package/dist/reporters/index.d.ts +1 -0
- package/dist/reporters/index.js +2 -0
- package/dist/reporters/json.d.ts +3 -0
- package/dist/reporters/json.js +2 -1
- package/dist/reporters/symbols.js +1 -2
- package/dist/reporters/util/util.d.ts +3 -1
- package/dist/reporters/util/util.js +5 -1
- package/dist/schema/configuration.d.ts +40 -6
- package/dist/schema/configuration.js +6 -0
- package/dist/schema/plugins.d.ts +10 -0
- package/dist/schema/plugins.js +2 -0
- package/dist/types/PluginNames.d.ts +2 -2
- package/dist/types/PluginNames.js +2 -0
- package/dist/types/config.d.ts +10 -0
- package/dist/types/issues.d.ts +3 -0
- package/dist/types/module-graph.d.ts +7 -0
- package/dist/types/package-json.d.ts +4 -1
- package/dist/types.d.ts +1 -1
- package/dist/typescript/SourceFileManager.js +3 -2
- package/dist/typescript/ast-nodes.d.ts +4 -1
- package/dist/typescript/ast-nodes.js +60 -2
- package/dist/typescript/comments.js +22 -3
- package/dist/typescript/get-imports-and-exports.js +10 -0
- package/dist/typescript/glob-imports.d.ts +3 -0
- package/dist/typescript/glob-imports.js +49 -0
- package/dist/typescript/resolve-module-names.d.ts +2 -0
- package/dist/typescript/resolve-module-names.js +35 -1
- package/dist/typescript/visitors/calls.js +4 -6
- package/dist/typescript/visitors/imports.js +8 -8
- package/dist/typescript/visitors/script-visitors.js +4 -4
- package/dist/typescript/visitors/walk.js +6 -1
- package/dist/util/cli-arguments.d.ts +2 -1
- package/dist/util/cli-arguments.js +4 -2
- package/dist/util/create-options.d.ts +32 -5
- package/dist/util/create-options.js +4 -1
- package/dist/util/get-included-issue-types.d.ts +1 -0
- package/dist/util/get-included-issue-types.js +4 -2
- package/dist/util/issue-initializers.js +1 -1
- package/dist/util/load-tsconfig.js +17 -4
- package/dist/util/module-graph.js +1 -0
- package/dist/util/modules.js +25 -4
- package/dist/util/scripts.d.ts +7 -0
- package/dist/util/scripts.js +75 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/schema.json +40 -1
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { parse } from 'unbash';
|
|
2
|
+
import { extractBinary } from './modules.js';
|
|
3
|
+
const spawningBinaries = new Set(['cross-env', 'retry-cli']);
|
|
4
|
+
export function* walkCommands(node) {
|
|
5
|
+
switch (node.type) {
|
|
6
|
+
case 'Command':
|
|
7
|
+
yield node;
|
|
8
|
+
break;
|
|
9
|
+
case 'AndOr':
|
|
10
|
+
case 'Pipeline':
|
|
11
|
+
for (const command of node.commands)
|
|
12
|
+
yield* walkCommands(command);
|
|
13
|
+
break;
|
|
14
|
+
case 'If':
|
|
15
|
+
for (const statement of node.clause.commands)
|
|
16
|
+
yield* walkCommands(statement.command);
|
|
17
|
+
for (const statement of node.then.commands)
|
|
18
|
+
yield* walkCommands(statement.command);
|
|
19
|
+
if (node.else)
|
|
20
|
+
yield* walkCommands(node.else);
|
|
21
|
+
break;
|
|
22
|
+
case 'While':
|
|
23
|
+
for (const statement of node.clause.commands)
|
|
24
|
+
yield* walkCommands(statement.command);
|
|
25
|
+
for (const statement of node.body.commands)
|
|
26
|
+
yield* walkCommands(statement.command);
|
|
27
|
+
break;
|
|
28
|
+
case 'For':
|
|
29
|
+
case 'Select':
|
|
30
|
+
case 'Subshell':
|
|
31
|
+
case 'BraceGroup':
|
|
32
|
+
for (const statement of node.body.commands)
|
|
33
|
+
yield* walkCommands(statement.command);
|
|
34
|
+
break;
|
|
35
|
+
case 'CompoundList':
|
|
36
|
+
for (const statement of node.commands)
|
|
37
|
+
yield* walkCommands(statement.command);
|
|
38
|
+
break;
|
|
39
|
+
case 'Function':
|
|
40
|
+
case 'Coproc':
|
|
41
|
+
yield* walkCommands(node.body);
|
|
42
|
+
break;
|
|
43
|
+
case 'Statement':
|
|
44
|
+
yield* walkCommands(node.command);
|
|
45
|
+
break;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
export const getScriptCommands = (script) => {
|
|
49
|
+
if (!script)
|
|
50
|
+
return [];
|
|
51
|
+
let parsed;
|
|
52
|
+
try {
|
|
53
|
+
parsed = parse(script);
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
return [];
|
|
57
|
+
}
|
|
58
|
+
if (!parsed.commands)
|
|
59
|
+
return [];
|
|
60
|
+
const out = [];
|
|
61
|
+
for (const statement of parsed.commands) {
|
|
62
|
+
for (const node of walkCommands(statement.command)) {
|
|
63
|
+
const text = node.name?.value;
|
|
64
|
+
if (!text)
|
|
65
|
+
continue;
|
|
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(' ')));
|
|
70
|
+
else
|
|
71
|
+
out.push({ binary, args });
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return out;
|
|
75
|
+
};
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "6.
|
|
1
|
+
export declare const version = "6.25.0";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '6.
|
|
1
|
+
export const version = '6.25.0';
|
package/package.json
CHANGED
package/schema.json
CHANGED
|
@@ -67,6 +67,33 @@
|
|
|
67
67
|
"$ref": "#/definitions/issueTypes"
|
|
68
68
|
}
|
|
69
69
|
},
|
|
70
|
+
"cycles": {
|
|
71
|
+
"title": "Configure circular dependency (cycles) detection",
|
|
72
|
+
"examples": [
|
|
73
|
+
{
|
|
74
|
+
"dynamicImports": true,
|
|
75
|
+
"allow": [["src/a.ts", "src/b.ts"]]
|
|
76
|
+
}
|
|
77
|
+
],
|
|
78
|
+
"type": "object",
|
|
79
|
+
"additionalProperties": false,
|
|
80
|
+
"properties": {
|
|
81
|
+
"dynamicImports": {
|
|
82
|
+
"title": "Include dynamic import() edges in cycle detection (excluded by default)",
|
|
83
|
+
"type": "boolean"
|
|
84
|
+
},
|
|
85
|
+
"allow": {
|
|
86
|
+
"title": "Allow (accept) specific cycles by exact path, relative to the root and omitting the closing repeat of the first file",
|
|
87
|
+
"type": "array",
|
|
88
|
+
"items": {
|
|
89
|
+
"type": "array",
|
|
90
|
+
"items": {
|
|
91
|
+
"type": "string"
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
},
|
|
70
97
|
"includeEntryExports": {
|
|
71
98
|
"$ref": "#/definitions/includeEntryExports"
|
|
72
99
|
},
|
|
@@ -99,6 +126,9 @@
|
|
|
99
126
|
"catalog": {
|
|
100
127
|
"$ref": "#/definitions/ruleValue"
|
|
101
128
|
},
|
|
129
|
+
"cycles": {
|
|
130
|
+
"$ref": "#/definitions/ruleValue"
|
|
131
|
+
},
|
|
102
132
|
"dependencies": {
|
|
103
133
|
"$ref": "#/definitions/ruleValue"
|
|
104
134
|
},
|
|
@@ -251,7 +281,8 @@
|
|
|
251
281
|
"duplicates",
|
|
252
282
|
"enumMembers",
|
|
253
283
|
"namespaceMembers",
|
|
254
|
-
"catalog"
|
|
284
|
+
"catalog",
|
|
285
|
+
"cycles"
|
|
255
286
|
]
|
|
256
287
|
}
|
|
257
288
|
},
|
|
@@ -483,6 +514,10 @@
|
|
|
483
514
|
"title": "ESLint plugin configuration (https://knip.dev/reference/plugins/eslint)",
|
|
484
515
|
"$ref": "#/definitions/plugin"
|
|
485
516
|
},
|
|
517
|
+
"eve": {
|
|
518
|
+
"title": "eve plugin configuration (https://knip.dev/reference/plugins/eve)",
|
|
519
|
+
"$ref": "#/definitions/plugin"
|
|
520
|
+
},
|
|
486
521
|
"execa": {
|
|
487
522
|
"title": "execa plugin configuration (https://knip.dev/reference/plugins/execa)",
|
|
488
523
|
"$ref": "#/definitions/plugin"
|
|
@@ -499,6 +534,10 @@
|
|
|
499
534
|
"title": "fast plugin configuration (https://knip.dev/reference/plugins/fast)",
|
|
500
535
|
"$ref": "#/definitions/plugin"
|
|
501
536
|
},
|
|
537
|
+
"fumadocs": {
|
|
538
|
+
"title": "fumadocs plugin configuration (https://knip.dev/reference/plugins/fumadocs)",
|
|
539
|
+
"$ref": "#/definitions/plugin"
|
|
540
|
+
},
|
|
502
541
|
"gatsby": {
|
|
503
542
|
"title": "Gatsby plugin configuration (https://knip.dev/reference/plugins/gatsby)",
|
|
504
543
|
"$ref": "#/definitions/plugin"
|