knip 5.1.5 → 5.1.6
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/cli.js +6 -2
- package/dist/util/cli-arguments.d.ts +2 -1
- package/dist/util/cli-arguments.js +3 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import './util/register.js';
|
|
2
|
+
import picocolors from 'picocolors';
|
|
2
3
|
import prettyMilliseconds from 'pretty-ms';
|
|
3
4
|
import parsedArgValues, { helpText } from './util/cli-arguments.js';
|
|
4
5
|
import { isKnownError, getKnownError, isConfigurationError, hasCause } from './util/errors.js';
|
|
@@ -8,7 +9,7 @@ import { runPreprocessors, runReporters } from './util/reporter.js';
|
|
|
8
9
|
import { splitTags } from './util/tag.js';
|
|
9
10
|
import { version } from './version.js';
|
|
10
11
|
import { main } from './index.js';
|
|
11
|
-
const { debug: isDebug = false, trace: isTrace = false, help: isHelp, 'max-issues': maxIssues = '0', 'no-config-hints': noConfigHints = false, 'no-exit-code': noExitCode = false, 'no-gitignore': isNoGitIgnore = false, 'no-progress': isNoProgress = isDebug || isTrace || false, 'include-entry-exports': isIncludeEntryExports = false, 'isolate-workspaces': isIsolateWorkspaces = false, performance: isObservePerf = false, production: isProduction = false, 'reporter-options': reporterOptions = '', 'preprocessor-options': preprocessorOptions = '', strict: isStrict = false, fix: isFix = false, 'fix-type': fixTypes = [], tsConfig, version: isVersion, 'experimental-tags': tags = [], } = parsedArgValues;
|
|
12
|
+
const { debug: isDebug = false, trace: isTrace = false, help: isHelp, 'max-issues': maxIssues = '0', 'no-config-hints': noConfigHints = false, 'no-exit-code': noExitCode = false, 'no-gitignore': isNoGitIgnore = false, 'no-progress': isNoProgress = isDebug || isTrace || false, 'include-entry-exports': isIncludeEntryExports = false, 'isolate-workspaces': isIsolateWorkspaces = false, performance: isObservePerf = false, production: isProduction = false, 'reporter-options': reporterOptions = '', 'preprocessor-options': preprocessorOptions = '', strict: isStrict = false, fix: isFix = false, 'fix-type': fixTypes = [], tsConfig, version: isVersion, 'experimental-tags': experimentalTags = [], tags = [], } = parsedArgValues;
|
|
12
13
|
if (isHelp) {
|
|
13
14
|
console.log(helpText);
|
|
14
15
|
process.exit(0);
|
|
@@ -30,7 +31,7 @@ const run = async () => {
|
|
|
30
31
|
isShowProgress,
|
|
31
32
|
isIncludeEntryExports,
|
|
32
33
|
isIsolateWorkspaces,
|
|
33
|
-
tags: splitTags(tags),
|
|
34
|
+
tags: tags.length > 0 ? splitTags(tags) : splitTags(experimentalTags),
|
|
34
35
|
isFix: isFix || fixTypes.length > 0,
|
|
35
36
|
fixTypes: fixTypes.flatMap(type => type.split(',')),
|
|
36
37
|
});
|
|
@@ -58,6 +59,9 @@ const run = async () => {
|
|
|
58
59
|
console.log('\nTotal running time:', prettyMilliseconds(perfObserver.getTotalTime()), `(mem: ${mem}MB)`);
|
|
59
60
|
perfObserver.reset();
|
|
60
61
|
}
|
|
62
|
+
if (experimentalTags.length > 0) {
|
|
63
|
+
console.warn(`\n${picocolors.yellow('DEPRECATION WARNING:')} --experimental-tags is deprecated, please start using --tags instead`);
|
|
64
|
+
}
|
|
61
65
|
if (!noExitCode && totalErrorCount > Number(maxIssues)) {
|
|
62
66
|
process.exit(1);
|
|
63
67
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const helpText = "\u2702\uFE0F Find unused files, dependencies and exports in your JavaScript and TypeScript projects\n\nUsage: knip [options]\n\nOptions:\n -c, --config [file] Configuration file path (default: [.]knip.json[c], knip.js, knip.ts or package.json#knip)\n -t, --tsConfig [file] TypeScript configuration path (default: tsconfig.json)\n --production Analyze only production source files (e.g. no tests, devDependencies, exported types)\n --strict Consider only direct dependencies of workspace (not devDependencies, not other workspaces)\n -W, --workspace [dir] Analyze a single workspace (default: analyze all configured workspaces)\n --directory [dir] Run process from a different directory (default: cwd)\n --no-gitignore Don't use .gitignore\n --include Report only provided issue type(s), can be comma-separated or repeated (1)\n --exclude Exclude provided issue type(s) from report, can be comma-separated or repeated (1)\n --dependencies Shortcut for --include dependencies,unlisted,binaries,unresolved\n --exports Shortcut for --include exports,nsExports,classMembers,types,nsTypes,enumMembers,duplicates\n --fix Fix issues\n --fix-type Fix only issues of type, can be comma-separated or repeated (2)\n --include-entry-exports Include entry files when reporting unused exports\n --isolate-workspaces Isolate workspaces into separate programs (default: false)\n -n, --no-progress Don't show dynamic progress updates (automatically enabled in CI environments)\n --preprocessor Preprocess the results before providing it to the reporter(s), can be repeated\n --preprocessor-options Pass extra options to the preprocessor (as JSON string, see --reporter-options example)\n --reporter Select reporter: symbols, compact, codeowners, json, can be repeated (default: symbols)\n --reporter-options Pass extra options to the reporter (as JSON string, see example)\n --no-config-hints Suppress configuration hints\n --no-exit-code Always exit with code zero (0)\n --max-issues Maximum number of issues before non-zero exit code (default: 0)\n -d, --debug Show debug output\n --performance Measure count and running time of expensive functions and display stats table\n -h, --help Print this help text\n -V, --version Print version\n\n(1) Issue types: files, dependencies, unlisted, unresolved, exports, nsExports, classMembers, types, nsTypes, enumMembers, duplicates\n(2) Fixable issue types: dependencies, exports, types\n\nExamples:\n\n$ knip\n$ knip --production\n$ knip --workspace packages/client --include files,dependencies\n$ knip -c ./config/knip.json --reporter compact\n$ knip --reporter codeowners --reporter-options '{\"path\":\".github/CODEOWNERS\"}'\n\nWebsite: https://knip.dev";
|
|
1
|
+
export declare const helpText = "\u2702\uFE0F Find unused files, dependencies and exports in your JavaScript and TypeScript projects\n\nUsage: knip [options]\n\nOptions:\n -c, --config [file] Configuration file path (default: [.]knip.json[c], knip.js, knip.ts or package.json#knip)\n -t, --tsConfig [file] TypeScript configuration path (default: tsconfig.json)\n --production Analyze only production source files (e.g. no tests, devDependencies, exported types)\n --strict Consider only direct dependencies of workspace (not devDependencies, not other workspaces)\n -W, --workspace [dir] Analyze a single workspace (default: analyze all configured workspaces)\n --directory [dir] Run process from a different directory (default: cwd)\n --no-gitignore Don't use .gitignore\n --include Report only provided issue type(s), can be comma-separated or repeated (1)\n --exclude Exclude provided issue type(s) from report, can be comma-separated or repeated (1)\n --dependencies Shortcut for --include dependencies,unlisted,binaries,unresolved\n --exports Shortcut for --include exports,nsExports,classMembers,types,nsTypes,enumMembers,duplicates\n --fix Fix issues\n --fix-type Fix only issues of type, can be comma-separated or repeated (2)\n --include-entry-exports Include entry files when reporting unused exports\n --isolate-workspaces Isolate workspaces into separate programs (default: false)\n -n, --no-progress Don't show dynamic progress updates (automatically enabled in CI environments)\n --preprocessor Preprocess the results before providing it to the reporter(s), can be repeated\n --preprocessor-options Pass extra options to the preprocessor (as JSON string, see --reporter-options example)\n --reporter Select reporter: symbols, compact, codeowners, json, can be repeated (default: symbols)\n --reporter-options Pass extra options to the reporter (as JSON string, see example)\n --tags Include or exclude tagged exports\n --no-config-hints Suppress configuration hints\n --no-exit-code Always exit with code zero (0)\n --max-issues Maximum number of issues before non-zero exit code (default: 0)\n -d, --debug Show debug output\n --performance Measure count and running time of expensive functions and display stats table\n -h, --help Print this help text\n -V, --version Print version\n\n(1) Issue types: files, dependencies, unlisted, unresolved, exports, nsExports, classMembers, types, nsTypes, enumMembers, duplicates\n(2) Fixable issue types: dependencies, exports, types\n\nExamples:\n\n$ knip\n$ knip --production\n$ knip --workspace packages/client --include files,dependencies\n$ knip -c ./config/knip.json --reporter compact\n$ knip --reporter codeowners --reporter-options '{\"path\":\".github/CODEOWNERS\"}'\n$ knip --tags=-knipignore\n\nWebsite: https://knip.dev";
|
|
2
2
|
declare const _default: {
|
|
3
3
|
config: string | undefined;
|
|
4
4
|
debug: boolean | undefined;
|
|
@@ -6,6 +6,7 @@ declare const _default: {
|
|
|
6
6
|
directory: string | undefined;
|
|
7
7
|
exclude: string[] | undefined;
|
|
8
8
|
exports: boolean | undefined;
|
|
9
|
+
tags: string[] | undefined;
|
|
9
10
|
'experimental-tags': string[] | undefined;
|
|
10
11
|
fix: boolean | undefined;
|
|
11
12
|
'fix-type': string[] | undefined;
|
|
@@ -24,6 +24,7 @@ Options:
|
|
|
24
24
|
--preprocessor-options Pass extra options to the preprocessor (as JSON string, see --reporter-options example)
|
|
25
25
|
--reporter Select reporter: symbols, compact, codeowners, json, can be repeated (default: symbols)
|
|
26
26
|
--reporter-options Pass extra options to the reporter (as JSON string, see example)
|
|
27
|
+
--tags Include or exclude tagged exports
|
|
27
28
|
--no-config-hints Suppress configuration hints
|
|
28
29
|
--no-exit-code Always exit with code zero (0)
|
|
29
30
|
--max-issues Maximum number of issues before non-zero exit code (default: 0)
|
|
@@ -42,6 +43,7 @@ $ knip --production
|
|
|
42
43
|
$ knip --workspace packages/client --include files,dependencies
|
|
43
44
|
$ knip -c ./config/knip.json --reporter compact
|
|
44
45
|
$ knip --reporter codeowners --reporter-options '{"path":".github/CODEOWNERS"}'
|
|
46
|
+
$ knip --tags=-knipignore
|
|
45
47
|
|
|
46
48
|
Website: https://knip.dev`;
|
|
47
49
|
let parsedArgs;
|
|
@@ -54,6 +56,7 @@ try {
|
|
|
54
56
|
directory: { type: 'string' },
|
|
55
57
|
exclude: { type: 'string', multiple: true },
|
|
56
58
|
exports: { type: 'boolean' },
|
|
59
|
+
tags: { type: 'string', multiple: true },
|
|
57
60
|
'experimental-tags': { type: 'string', multiple: true },
|
|
58
61
|
fix: { type: 'boolean' },
|
|
59
62
|
'fix-type': { type: 'string', multiple: true },
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "5.1.
|
|
1
|
+
export declare const version = "5.1.6";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '5.1.
|
|
1
|
+
export const version = '5.1.6';
|