knip 5.30.2 → 5.30.4
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/README.md +1 -1
- package/dist/ConfigurationChief.js +1 -1
- package/dist/ConfigurationValidator.d.ts +6 -6
- package/dist/DependencyDeputy.js +3 -3
- package/dist/IssueFixer.js +2 -2
- package/dist/compilers/index.d.ts +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +5 -1
- package/dist/plugins/eslint/index.js +1 -1
- package/dist/plugins/vitest/index.js +1 -1
- package/dist/util/to-source-path.js +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -42,6 +42,6 @@ Special thanks to the wonderful people who have contributed to this project:
|
|
|
42
42
|
[4]: https://discord.gg/r5uXTtbTpc
|
|
43
43
|
[5]: https://github.com/webpro-nl/knip/blob/main/.github/CONTRIBUTING.md
|
|
44
44
|
[6]: https://knip.dev/sponsors
|
|
45
|
-
[7]: https://
|
|
45
|
+
[7]: https://www.youtube.com/watch?v=PE7h7KvQoUI&t=9s
|
|
46
46
|
[8]: https://github.com/webpro-nl/knip/graphs/contributors
|
|
47
47
|
[9]: https://contrib.rocks/image?repo=webpro-nl/knip
|
|
@@ -185,7 +185,7 @@ export class ConfigurationChief {
|
|
|
185
185
|
const workspaces = this.manifest?.workspaces
|
|
186
186
|
? Array.isArray(this.manifest.workspaces)
|
|
187
187
|
? this.manifest.workspaces
|
|
188
|
-
: this.manifest.workspaces.packages ?? []
|
|
188
|
+
: (this.manifest.workspaces.packages ?? [])
|
|
189
189
|
: [];
|
|
190
190
|
return workspaces.map(pattern => pattern.replace(/(?<=!?)\.\//, ''));
|
|
191
191
|
}
|
|
@@ -2775,9 +2775,9 @@ export declare const ConfigurationValidator: z.ZodObject<z.objectUtil.extendShap
|
|
|
2775
2775
|
ignoreExportsUsedInFile?: boolean | Partial<Record<"function" | "type" | "enum" | "class" | "interface" | "member", boolean>> | undefined;
|
|
2776
2776
|
ignoreWorkspaces?: string[] | undefined;
|
|
2777
2777
|
includeEntryExports?: boolean | undefined;
|
|
2778
|
-
compilers?: Record<string, ((args_0: string, args_1: string, ...
|
|
2779
|
-
syncCompilers?: Record<string, (args_0: string, args_1: string, ...
|
|
2780
|
-
asyncCompilers?: Record<string, (args_0: string, args_1: string, ...
|
|
2778
|
+
compilers?: Record<string, ((args_0: string, args_1: string, ...args: unknown[]) => string) | ((args_0: string, args_1: string, ...args: unknown[]) => Promise<string>)> | undefined;
|
|
2779
|
+
syncCompilers?: Record<string, (args_0: string, args_1: string, ...args: unknown[]) => string> | undefined;
|
|
2780
|
+
asyncCompilers?: Record<string, (args_0: string, args_1: string, ...args: unknown[]) => Promise<string>> | undefined;
|
|
2781
2781
|
astro?: string | boolean | string[] | {
|
|
2782
2782
|
config?: string | string[] | undefined;
|
|
2783
2783
|
entry?: string | string[] | undefined;
|
|
@@ -3552,9 +3552,9 @@ export declare const ConfigurationValidator: z.ZodObject<z.objectUtil.extendShap
|
|
|
3552
3552
|
ignoreExportsUsedInFile?: boolean | Partial<Record<"function" | "type" | "enum" | "class" | "interface" | "member", boolean>> | undefined;
|
|
3553
3553
|
ignoreWorkspaces?: string[] | undefined;
|
|
3554
3554
|
includeEntryExports?: boolean | undefined;
|
|
3555
|
-
compilers?: Record<string, ((args_0: string, args_1: string, ...
|
|
3556
|
-
syncCompilers?: Record<string, (args_0: string, args_1: string, ...
|
|
3557
|
-
asyncCompilers?: Record<string, (args_0: string, args_1: string, ...
|
|
3555
|
+
compilers?: Record<string, ((args_0: string, args_1: string, ...args: unknown[]) => string) | ((args_0: string, args_1: string, ...args: unknown[]) => Promise<string>)> | undefined;
|
|
3556
|
+
syncCompilers?: Record<string, (args_0: string, args_1: string, ...args: unknown[]) => string> | undefined;
|
|
3557
|
+
asyncCompilers?: Record<string, (args_0: string, args_1: string, ...args: unknown[]) => Promise<string>> | undefined;
|
|
3558
3558
|
astro?: string | boolean | string[] | {
|
|
3559
3559
|
config?: string | string[] | undefined;
|
|
3560
3560
|
entry?: string | string[] | undefined;
|
package/dist/DependencyDeputy.js
CHANGED
|
@@ -175,11 +175,11 @@ export class DependencyDeputy {
|
|
|
175
175
|
return false;
|
|
176
176
|
const [scope, typedDependency] = dependency.split('/');
|
|
177
177
|
if (scope === DT_SCOPE) {
|
|
178
|
-
if (hasTypesIncluded?.has(typedDependency))
|
|
179
|
-
return false;
|
|
180
178
|
const typedPackageName = getPackageFromDefinitelyTyped(typedDependency);
|
|
181
|
-
if (IGNORE_DEFINITELY_TYPED.
|
|
179
|
+
if (IGNORE_DEFINITELY_TYPED.has(typedPackageName))
|
|
182
180
|
return true;
|
|
181
|
+
if (hasTypesIncluded?.has(typedDependency))
|
|
182
|
+
return false;
|
|
183
183
|
const hostDependencies = [
|
|
184
184
|
...this.getHostDependenciesFor(workspace, dependency),
|
|
185
185
|
...this.getHostDependenciesFor(workspace, typedPackageName),
|
package/dist/IssueFixer.js
CHANGED
|
@@ -65,8 +65,8 @@ export class IssueFixer {
|
|
|
65
65
|
const filePaths = new Set([...this.unusedTypeNodes.keys(), ...this.unusedExportNodes.keys()]);
|
|
66
66
|
for (const filePath of filePaths) {
|
|
67
67
|
const exportPositions = [
|
|
68
|
-
...(this.isFixUnusedTypes ? this.unusedTypeNodes.get(filePath) ?? [] : []),
|
|
69
|
-
...(this.isFixUnusedExports ? this.unusedExportNodes.get(filePath) ?? [] : []),
|
|
68
|
+
...(this.isFixUnusedTypes ? (this.unusedTypeNodes.get(filePath) ?? []) : []),
|
|
69
|
+
...(this.isFixUnusedExports ? (this.unusedExportNodes.get(filePath) ?? []) : []),
|
|
70
70
|
].sort((a, b) => b[0] - a[0]);
|
|
71
71
|
if (exportPositions.length > 0) {
|
|
72
72
|
const sourceFileText = exportPositions.reduce((text, [start, end]) => text.substring(0, start) + text.substring(end), await readFile(filePath, 'utf-8'));
|
|
@@ -17,7 +17,7 @@ export declare const partitionCompilers: (rawLocalConfig: RawConfiguration) => {
|
|
|
17
17
|
ignoreExportsUsedInFile?: boolean | Partial<Record<"function" | "type" | "enum" | "class" | "interface" | "member", boolean>> | undefined;
|
|
18
18
|
ignoreWorkspaces?: string[] | undefined;
|
|
19
19
|
includeEntryExports?: boolean | undefined;
|
|
20
|
-
compilers?: Record<string, ((args_0: string, args_1: string, ...
|
|
20
|
+
compilers?: Record<string, ((args_0: string, args_1: string, ...args: unknown[]) => string) | ((args_0: string, args_1: string, ...args: unknown[]) => Promise<string>)> | undefined;
|
|
21
21
|
astro?: string | boolean | string[] | {
|
|
22
22
|
config?: string | string[] | undefined;
|
|
23
23
|
entry?: string | string[] | undefined;
|
package/dist/constants.d.ts
CHANGED
|
@@ -14,6 +14,6 @@ export declare const IGNORED_GLOBAL_BINARIES: Set<string>;
|
|
|
14
14
|
export declare const IGNORED_DEPENDENCIES: Set<string>;
|
|
15
15
|
export declare const IGNORED_RUNTIME_DEPENDENCIES: Set<string>;
|
|
16
16
|
export declare const FOREIGN_FILE_EXTENSIONS: Set<string>;
|
|
17
|
-
export declare const IGNORE_DEFINITELY_TYPED: string
|
|
17
|
+
export declare const IGNORE_DEFINITELY_TYPED: Set<string>;
|
|
18
18
|
export declare const ISSUE_TYPES: IssueType[];
|
|
19
19
|
export declare const ISSUE_TYPE_TITLE: Record<IssueType, string>;
|
package/dist/constants.js
CHANGED
|
@@ -142,7 +142,11 @@ export const FOREIGN_FILE_EXTENSIONS = new Set([
|
|
|
142
142
|
'.yaml',
|
|
143
143
|
'.yml',
|
|
144
144
|
]);
|
|
145
|
-
export const IGNORE_DEFINITELY_TYPED = [
|
|
145
|
+
export const IGNORE_DEFINITELY_TYPED = new Set([
|
|
146
|
+
'node',
|
|
147
|
+
'bun',
|
|
148
|
+
'jest',
|
|
149
|
+
]);
|
|
146
150
|
export const ISSUE_TYPES = [
|
|
147
151
|
'files',
|
|
148
152
|
'dependencies',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { hasDependency } from '#p/util/plugin.js';
|
|
2
2
|
import { getDependenciesDeep } from './helpers.js';
|
|
3
3
|
const title = 'ESLint';
|
|
4
|
-
const enablers = ['eslint'];
|
|
4
|
+
const enablers = ['eslint', '@eslint/js'];
|
|
5
5
|
const isEnabled = ({ dependencies, manifest, config }) => hasDependency(dependencies, enablers) ||
|
|
6
6
|
'eslint' in config ||
|
|
7
7
|
Boolean(manifest.name && /(^eslint-config|\/eslint-config)/.test(manifest.name));
|
|
@@ -5,7 +5,7 @@ import { getEnvPackageName, getExternalReporters } from './helpers.js';
|
|
|
5
5
|
const title = 'Vitest';
|
|
6
6
|
const enablers = ['vitest'];
|
|
7
7
|
const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
8
|
-
const config = ['vitest*.config.{js,mjs,ts,cjs,mts,cts}', 'vitest.{workspace,projects}.{ts,
|
|
8
|
+
const config = ['vitest*.config.{js,mjs,ts,cjs,mts,cts}', 'vitest.{workspace,projects}.{js,mjs,ts,cjs,mts,cts,json}'];
|
|
9
9
|
const entry = ['**/*.{bench,test,test-d,spec}.?(c|m)[jt]s?(x)'];
|
|
10
10
|
const isVitestCoverageCommand = /vitest(.+)--coverage(?:\.enabled(?:=true)?)?/;
|
|
11
11
|
const hasScriptWithCoverage = (scripts) => scripts
|
|
@@ -9,7 +9,7 @@ const hasTSExt = /(?<!\.d)\.(m|c)?tsx?$/;
|
|
|
9
9
|
const matchExt = /(\.d)?\.(m|c)?(j|t)s$/;
|
|
10
10
|
export const augmentWorkspace = (workspace, dir, compilerOptions) => {
|
|
11
11
|
const srcDir = join(dir, 'src');
|
|
12
|
-
workspace.srcDir = compilerOptions.rootDir ?? isDirectory(srcDir) ? srcDir : dir;
|
|
12
|
+
workspace.srcDir = (compilerOptions.rootDir ?? isDirectory(srcDir)) ? srcDir : dir;
|
|
13
13
|
workspace.outDir = compilerOptions.outDir || workspace.srcDir;
|
|
14
14
|
};
|
|
15
15
|
export const getToSourcePathHandler = (chief) => {
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "5.30.
|
|
1
|
+
export declare const version = "5.30.4";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '5.30.
|
|
1
|
+
export const version = '5.30.4';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "knip",
|
|
3
|
-
"version": "5.30.
|
|
3
|
+
"version": "5.30.4",
|
|
4
4
|
"description": "Find unused files, dependencies and exports in your TypeScript and JavaScript projects",
|
|
5
5
|
"homepage": "https://knip.dev",
|
|
6
6
|
"repository": {
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"picocolors": "^1.0.0",
|
|
73
73
|
"picomatch": "^4.0.1",
|
|
74
74
|
"pretty-ms": "^9.0.0",
|
|
75
|
-
"smol-toml": "^1.
|
|
75
|
+
"smol-toml": "^1.3.0",
|
|
76
76
|
"strip-json-comments": "5.0.1",
|
|
77
77
|
"summary": "2.1.0",
|
|
78
78
|
"zod": "^3.22.4",
|
|
@@ -85,14 +85,14 @@
|
|
|
85
85
|
"devDependencies": {
|
|
86
86
|
"@jest/types": "^29.6.3",
|
|
87
87
|
"@release-it/bumper": "^6.0.1",
|
|
88
|
-
"@types/bun": "^1.1.
|
|
88
|
+
"@types/bun": "^1.1.10",
|
|
89
89
|
"@types/js-yaml": "^4.0.9",
|
|
90
90
|
"@types/minimist": "^1.2.5",
|
|
91
|
-
"@types/picomatch": "
|
|
91
|
+
"@types/picomatch": "3.0.1",
|
|
92
92
|
"@types/webpack": "^5.28.5",
|
|
93
|
-
"@wdio/types": "^
|
|
93
|
+
"@wdio/types": "^9.0.8",
|
|
94
94
|
"glob": "^10.4.2",
|
|
95
|
-
"release-it": "^17.
|
|
95
|
+
"release-it": "^17.6.0",
|
|
96
96
|
"type-fest": "^4.20.0",
|
|
97
97
|
"typescript": "^5.5.2"
|
|
98
98
|
},
|