knip 5.63.1 → 5.64.1
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/dist/CacheConsultant.js +1 -1
- package/dist/ConfigurationChief.d.ts +20 -8
- package/dist/DependencyDeputy.js +5 -4
- package/dist/IssueCollector.js +1 -1
- package/dist/IssueFixer.js +3 -1
- package/dist/ProjectPrincipal.d.ts +1 -1
- package/dist/ProjectPrincipal.js +2 -2
- package/dist/WorkspaceWorker.d.ts +1 -1
- package/dist/WorkspaceWorker.js +2 -2
- package/dist/binaries/bash-parser.d.ts +1 -0
- package/dist/binaries/bash-parser.js +3 -0
- package/dist/binaries/fallback.js +3 -2
- package/dist/binaries/index.js +1 -1
- package/dist/binaries/package-manager/bun.js +1 -0
- package/dist/binaries/plugins.js +3 -1
- package/dist/cli.js +9 -9
- package/dist/compilers/index.d.ts +57 -30
- package/dist/compilers/index.js +1 -1
- package/dist/constants.js +2 -0
- package/dist/graph/analyze.js +7 -4
- package/dist/graph/build.js +9 -9
- package/dist/index.js +2 -2
- package/dist/manifest/index.js +1 -1
- package/dist/plugins/angular/index.js +2 -3
- package/dist/plugins/bumpp/index.d.ts +8 -0
- package/dist/plugins/bumpp/index.js +11 -0
- package/dist/plugins/changelogen/index.js +1 -1
- package/dist/plugins/changelogithub/index.js +1 -1
- package/dist/plugins/commitlint/index.js +1 -1
- package/dist/plugins/eslint/index.d.ts +7 -0
- package/dist/plugins/eslint/index.js +12 -0
- package/dist/plugins/glob/index.d.ts +0 -1
- package/dist/plugins/glob/index.js +0 -1
- package/dist/plugins/index.d.ts +19 -7
- package/dist/plugins/index.js +6 -2
- package/dist/plugins/karma/helpers.js +1 -1
- package/dist/plugins/lint-staged/index.js +1 -1
- package/dist/plugins/linthtml/index.js +1 -1
- package/dist/plugins/lockfile-lint/index.js +1 -1
- package/dist/plugins/node-modules-inspector/index.d.ts +0 -1
- package/dist/plugins/node-modules-inspector/index.js +1 -2
- package/dist/plugins/npm-package-json-lint/index.js +1 -1
- package/dist/plugins/nuxt/index.js +7 -1
- package/dist/plugins/nuxt/types.d.ts +1 -1
- package/dist/plugins/oxlint/index.d.ts +0 -1
- package/dist/plugins/oxlint/index.js +0 -1
- package/dist/plugins/playwright/index.d.ts +0 -1
- package/dist/plugins/playwright/index.js +0 -1
- package/dist/plugins/playwright-test/index.d.ts +0 -1
- package/dist/plugins/playwright-test/index.js +0 -1
- package/dist/plugins/pnpm/index.d.ts +1 -0
- package/dist/plugins/pnpm/index.js +5 -1
- package/dist/plugins/postcss/index.js +1 -1
- package/dist/plugins/prisma/index.d.ts +0 -1
- package/dist/plugins/prisma/index.js +0 -1
- package/dist/plugins/react-router/index.js +1 -1
- package/dist/plugins/rslib/index.js +1 -1
- package/dist/plugins/rstest/index.d.ts +10 -0
- package/dist/plugins/rstest/index.js +29 -0
- package/dist/plugins/rstest/types.d.ts +6 -0
- package/dist/plugins/rstest/types.js +1 -0
- package/dist/plugins/semantic-release/index.js +1 -1
- package/dist/plugins/size-limit/index.js +1 -1
- package/dist/plugins/stylelint/index.js +1 -1
- package/dist/plugins/syncpack/index.js +1 -1
- package/dist/plugins/ts-node/index.d.ts +0 -1
- package/dist/plugins/ts-node/index.js +0 -1
- package/dist/plugins/unocss/index.js +1 -1
- package/dist/plugins.d.ts +1 -1
- package/dist/reporters/githubActions.d.ts +3 -0
- package/dist/reporters/githubActions.js +94 -0
- package/dist/reporters/index.d.ts +1 -0
- package/dist/reporters/index.js +2 -0
- package/dist/reporters/json.js +1 -1
- package/dist/reporters/util/configuration-hints.d.ts +13 -1
- package/dist/reporters/util/configuration-hints.js +1 -0
- package/dist/schema/configuration.d.ts +1187 -6393
- package/dist/schema/configuration.js +54 -51
- package/dist/schema/plugins.d.ts +579 -2595
- package/dist/schema/plugins.js +6 -4
- package/dist/types/PluginNames.d.ts +2 -2
- package/dist/types/PluginNames.js +2 -0
- package/dist/types/args.d.ts +2 -0
- package/dist/types/config.d.ts +2 -2
- package/dist/types/exports.d.ts +1 -1
- package/dist/types/imports.d.ts +1 -1
- package/dist/types/module-graph.d.ts +5 -4
- package/dist/typescript/SourceFile.d.ts +2 -2
- package/dist/typescript/ast-helpers.d.ts +4 -0
- package/dist/typescript/ast-helpers.js +29 -0
- package/dist/typescript/find-internal-references.js +10 -1
- package/dist/typescript/get-imports-and-exports.js +28 -18
- package/dist/typescript/resolve-module-names.js +1 -1
- package/dist/typescript/visitors/dynamic-imports/importCall.js +6 -1
- package/dist/util/cli-arguments.d.ts +3 -2
- package/dist/util/cli-arguments.js +2 -2
- package/dist/util/create-options.d.ts +61 -35
- package/dist/util/create-options.js +1 -1
- package/dist/util/errors.d.ts +4 -4
- package/dist/util/errors.js +8 -8
- package/dist/util/file-entry-cache.js +1 -1
- package/dist/util/glob-core.js +1 -1
- package/dist/util/glob.js +1 -1
- package/dist/util/input.d.ts +1 -1
- package/dist/util/load-config.d.ts +2 -1
- package/dist/util/load-config.js +4 -4
- package/dist/util/loader.js +1 -1
- package/dist/util/modules.js +18 -7
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +18 -19
- package/schema.json +8 -0
package/dist/util/glob-core.js
CHANGED
|
@@ -4,10 +4,10 @@ import { walk as _walk } from '@nodelib/fs.walk';
|
|
|
4
4
|
import fg, {} from 'fast-glob';
|
|
5
5
|
import picomatch from 'picomatch';
|
|
6
6
|
import { GLOBAL_IGNORE_PATTERNS, ROOT_WORKSPACE_NAME } from '../constants.js';
|
|
7
|
-
import { timerify } from './Performance.js';
|
|
8
7
|
import { compact, partition } from './array.js';
|
|
9
8
|
import { debugLogObject } from './debug.js';
|
|
10
9
|
import { isDirectory, isFile } from './fs.js';
|
|
10
|
+
import { timerify } from './Performance.js';
|
|
11
11
|
import { parseAndConvertGitignorePatterns } from './parse-and-convert-gitignores.js';
|
|
12
12
|
import { dirname, join, relative, toPosix } from './path.js';
|
|
13
13
|
const walk = promisify(_walk);
|
package/dist/util/glob.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import fg from 'fast-glob';
|
|
2
2
|
import { GLOBAL_IGNORE_PATTERNS } from '../constants.js';
|
|
3
|
-
import { timerify } from './Performance.js';
|
|
4
3
|
import { compact } from './array.js';
|
|
5
4
|
import { glob } from './glob-core.js';
|
|
5
|
+
import { timerify } from './Performance.js';
|
|
6
6
|
import { isAbsolute, join, relative } from './path.js';
|
|
7
7
|
const prepend = (pattern, relativePath) => isAbsolute(pattern.replace(/^!/, '')) ? pattern : prependDirToPattern(relativePath, pattern);
|
|
8
8
|
const prependDirToPatterns = (cwd, dir, patterns) => {
|
package/dist/util/input.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { PluginName } from '../types/PluginNames.js';
|
|
2
1
|
import type { IssueType } from '../types/issues.js';
|
|
2
|
+
import type { PluginName } from '../types/PluginNames.js';
|
|
3
3
|
type InputType = 'binary' | 'entry' | 'project' | 'config' | 'dependency' | 'deferResolve' | 'deferResolveEntry' | 'alias' | 'ignore';
|
|
4
4
|
export interface Input {
|
|
5
5
|
type: InputType;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import type { ParsedCLIArgs } from './cli-arguments.js';
|
|
2
|
+
export declare function loadResolvedConfigFile(configPath: string, options: ParsedCLIArgs): Promise<any>;
|
package/dist/util/load-config.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { debugLogObject } from './debug.js';
|
|
2
2
|
import { ConfigurationError } from './errors.js';
|
|
3
3
|
import { _load } from './loader.js';
|
|
4
|
-
const unwrapFunction = async (maybeFunction) => {
|
|
4
|
+
const unwrapFunction = async (maybeFunction, options) => {
|
|
5
5
|
if (typeof maybeFunction === 'function') {
|
|
6
6
|
try {
|
|
7
|
-
return await maybeFunction();
|
|
7
|
+
return await maybeFunction(options);
|
|
8
8
|
}
|
|
9
9
|
catch (error) {
|
|
10
10
|
debugLogObject('*', 'Error executing function:', error);
|
|
@@ -13,10 +13,10 @@ const unwrapFunction = async (maybeFunction) => {
|
|
|
13
13
|
}
|
|
14
14
|
return maybeFunction;
|
|
15
15
|
};
|
|
16
|
-
export async function loadResolvedConfigFile(configPath) {
|
|
16
|
+
export async function loadResolvedConfigFile(configPath, options) {
|
|
17
17
|
const loadedValue = await _load(configPath);
|
|
18
18
|
try {
|
|
19
|
-
return await unwrapFunction(loadedValue);
|
|
19
|
+
return await unwrapFunction(loadedValue, options);
|
|
20
20
|
}
|
|
21
21
|
catch (_error) {
|
|
22
22
|
throw new ConfigurationError(`Error running the function from ${configPath}`);
|
package/dist/util/loader.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { timerify } from './Performance.js';
|
|
2
1
|
import { LoaderError } from './errors.js';
|
|
3
2
|
import { loadFile, loadJSON, loadTOML, loadYAML, parseJSON, parseYAML } from './fs.js';
|
|
4
3
|
import { jiti } from './jiti.js';
|
|
4
|
+
import { timerify } from './Performance.js';
|
|
5
5
|
import { extname, isInternal } from './path.js';
|
|
6
6
|
const load = async (filePath) => {
|
|
7
7
|
try {
|
package/dist/util/modules.js
CHANGED
|
@@ -38,13 +38,24 @@ export const getPackageFromDefinitelyTyped = (typedDependency) => {
|
|
|
38
38
|
}
|
|
39
39
|
return typedDependency;
|
|
40
40
|
};
|
|
41
|
-
const matchDirectives = /^([?!|-]+)?([^!?:]+).*/;
|
|
42
41
|
export const sanitizeSpecifier = (specifier) => {
|
|
43
|
-
if (isBuiltin(specifier))
|
|
42
|
+
if (isBuiltin(specifier) || isAbsolute(specifier) || specifier.startsWith(PROTOCOL_VIRTUAL))
|
|
44
43
|
return specifier;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
44
|
+
let s = specifier;
|
|
45
|
+
let end = s.length;
|
|
46
|
+
let i = 0;
|
|
47
|
+
while (i < s.length && (s[i] === '!' || s[i] === '-'))
|
|
48
|
+
i++;
|
|
49
|
+
s = s.substring(i);
|
|
50
|
+
for (let j = 0; j < s.length; j++) {
|
|
51
|
+
const char = s[j];
|
|
52
|
+
if (char === '!' || char === '?' || (char === '#' && j > 0)) {
|
|
53
|
+
end = j;
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
s = s.substring(0, end);
|
|
58
|
+
if (s.includes(':') && !s.includes('/'))
|
|
59
|
+
s = s.split(':')[0];
|
|
60
|
+
return s;
|
|
50
61
|
};
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "5.
|
|
1
|
+
export declare const version = "5.64.1";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '5.
|
|
1
|
+
export const version = '5.64.1';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "knip",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.64.1",
|
|
4
4
|
"description": "Find and fix unused dependencies, exports and files in your TypeScript and JavaScript projects",
|
|
5
5
|
"homepage": "https://knip.dev",
|
|
6
6
|
"repository": {
|
|
@@ -34,20 +34,20 @@
|
|
|
34
34
|
"scripts": {
|
|
35
35
|
"knip": "node ./dist/cli.js --directory ../..",
|
|
36
36
|
"knip:production": "node ./dist/cli.js --directory ../.. --production --strict",
|
|
37
|
-
"lint": "biome lint
|
|
38
|
-
"format": "biome format --write
|
|
39
|
-
"test": "
|
|
40
|
-
"test:
|
|
41
|
-
"test:
|
|
42
|
-
"test:
|
|
43
|
-
"test:
|
|
37
|
+
"lint": "biome lint",
|
|
38
|
+
"format": "biome format --write",
|
|
39
|
+
"test": "node scripts/run-test.ts",
|
|
40
|
+
"test:node": "tsx --test test/*.test.ts test/**/*.test.ts",
|
|
41
|
+
"test:bun": "bun test test/*.test.ts test/**/*.test.ts",
|
|
42
|
+
"test:smoke": "glob -c \"tsx --test\" \"test/*.test.ts\" && glob -c \"tsx --test\" \"test/{plugins,util}/*.test.ts\"",
|
|
43
|
+
"test:bun:smoke": "bun test test/*.test.ts test/{plugins,util}/*.test.ts",
|
|
44
44
|
"watch": "npm link && tsc --watch",
|
|
45
|
-
"prebuild": "
|
|
45
|
+
"prebuild": "pnpm run generate-plugin-defs && node rmdir.js dist",
|
|
46
46
|
"build": "tsc",
|
|
47
|
-
"qa": "
|
|
47
|
+
"qa": "pnpm lint && pnpm build && pnpm knip && pnpm knip:production && pnpm run test",
|
|
48
48
|
"release": "release-it",
|
|
49
|
-
"create-plugin": "
|
|
50
|
-
"postcreate-plugin": "
|
|
49
|
+
"create-plugin": "node ./scripts/create-new-plugin.ts",
|
|
50
|
+
"postcreate-plugin": "pnpm run build && biome format --write schema.json schema-jsonc.json src/schema/plugins.ts",
|
|
51
51
|
"generate-plugin-defs": "node ./scripts/generate-plugin-defs.js && biome check --write src/plugins/index.ts src/types/PluginNames.ts src/schema/plugins.ts"
|
|
52
52
|
},
|
|
53
53
|
"files": [
|
|
@@ -60,25 +60,24 @@
|
|
|
60
60
|
"@nodelib/fs.walk": "^1.2.3",
|
|
61
61
|
"fast-glob": "^3.3.3",
|
|
62
62
|
"formatly": "^0.3.0",
|
|
63
|
-
"jiti": "^2.
|
|
63
|
+
"jiti": "^2.6.0",
|
|
64
64
|
"js-yaml": "^4.1.0",
|
|
65
65
|
"minimist": "^1.2.8",
|
|
66
|
-
"oxc-resolver": "^11.
|
|
66
|
+
"oxc-resolver": "^11.8.3",
|
|
67
67
|
"picocolors": "^1.1.1",
|
|
68
68
|
"picomatch": "^4.0.1",
|
|
69
69
|
"smol-toml": "^1.4.1",
|
|
70
70
|
"strip-json-comments": "5.0.2",
|
|
71
|
-
"zod": "^
|
|
72
|
-
"zod-validation-error": "^3.0.3"
|
|
71
|
+
"zod": "^4.1.11"
|
|
73
72
|
},
|
|
74
73
|
"peerDependencies": {
|
|
75
74
|
"@types/node": ">=18",
|
|
76
|
-
"typescript": ">=5.0.4"
|
|
75
|
+
"typescript": ">=5.0.4 <7"
|
|
77
76
|
},
|
|
78
77
|
"devDependencies": {
|
|
79
78
|
"@jest/types": "^29.6.3",
|
|
80
79
|
"@release-it/bumper": "^7.0.5",
|
|
81
|
-
"@types/bun": "1.2.
|
|
80
|
+
"@types/bun": "1.2.22",
|
|
82
81
|
"@types/js-yaml": "^4.0.9",
|
|
83
82
|
"@types/minimist": "^1.2.5",
|
|
84
83
|
"@types/picomatch": "3.0.1",
|
|
@@ -86,7 +85,7 @@
|
|
|
86
85
|
"@wdio/types": "^9.16.2",
|
|
87
86
|
"codeclimate-types": "^0.3.1",
|
|
88
87
|
"glob": "^11.0.2",
|
|
89
|
-
"release-it": "^19.0.
|
|
88
|
+
"release-it": "^19.0.5",
|
|
90
89
|
"tsx": "^4.20.3",
|
|
91
90
|
"typescript": "^5.5.2"
|
|
92
91
|
},
|
package/schema.json
CHANGED
|
@@ -319,6 +319,10 @@
|
|
|
319
319
|
"title": "biome plugin configuration (https://knip.dev/reference/plugins/biome)",
|
|
320
320
|
"$ref": "#/definitions/plugin"
|
|
321
321
|
},
|
|
322
|
+
"bumpp": {
|
|
323
|
+
"title": "bumpp plugin configuration (https://knip.dev/reference/plugins/bumpp)",
|
|
324
|
+
"$ref": "#/definitions/plugin"
|
|
325
|
+
},
|
|
322
326
|
"bun": {
|
|
323
327
|
"title": "bun plugin configuration (https://knip.dev/reference/plugins/bun)",
|
|
324
328
|
"$ref": "#/definitions/plugin"
|
|
@@ -607,6 +611,10 @@
|
|
|
607
611
|
"title": "rspack plugin configuration (https://knip.dev/reference/plugins/rspack)",
|
|
608
612
|
"$ref": "#/definitions/plugin"
|
|
609
613
|
},
|
|
614
|
+
"rstest": {
|
|
615
|
+
"title": "rstest plugin configuration (https://knip.dev/reference/plugins/rstest)",
|
|
616
|
+
"$ref": "#/definitions/plugin"
|
|
617
|
+
},
|
|
610
618
|
"semantic-release": {
|
|
611
619
|
"title": "semantic-release plugin configuration (https://knip.dev/reference/plugins/semantic-release)",
|
|
612
620
|
"$ref": "#/definitions/plugin"
|