knip 5.27.2 → 5.27.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 +8 -4
- package/dist/DependencyDeputy.js +7 -4
- package/dist/WorkspaceWorker.d.ts +2 -2
- package/dist/plugins/postcss/index.js +2 -1
- package/dist/util/cli-arguments.d.ts +1 -1
- package/dist/util/cli-arguments.js +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -19,7 +19,6 @@ Knip finds **unused files, dependencies and exports** in your JavaScript and
|
|
|
19
19
|
TypeScript projects. Less code and dependencies lead to improved performance,
|
|
20
20
|
less maintenance and easier refactorings.
|
|
21
21
|
|
|
22
|
-
|
|
23
22
|
- Website: [knip.dev][3]
|
|
24
23
|
- GitHub repo: [webpro-nl/knip][2]
|
|
25
24
|
- npm package: [knip][1]
|
|
@@ -31,7 +30,11 @@ less maintenance and easier refactorings.
|
|
|
31
30
|
|
|
32
31
|
Special thanks to the wonderful people who have contributed to this project:
|
|
33
32
|
|
|
34
|
-
[![Contributors][
|
|
33
|
+
[![Contributors][9]][8]
|
|
34
|
+
|
|
35
|
+
## Knip
|
|
36
|
+
|
|
37
|
+
/'knɪp/ means "(to) cut" and is [pronounced with a hard "K"][7] 🇳🇱
|
|
35
38
|
|
|
36
39
|
[1]: https://www.npmjs.com/package/knip
|
|
37
40
|
[2]: https://github.com/webpro-nl/knip
|
|
@@ -39,5 +42,6 @@ Special thanks to the wonderful people who have contributed to this project:
|
|
|
39
42
|
[4]: https://discord.gg/r5uXTtbTpc
|
|
40
43
|
[5]: https://github.com/webpro-nl/knip/blob/main/.github/CONTRIBUTING.md
|
|
41
44
|
[6]: https://knip.dev/sponsors
|
|
42
|
-
[7]: https://
|
|
43
|
-
[8]: https://
|
|
45
|
+
[7]: https://en.wiktionary.org/wiki/knip#Dutch
|
|
46
|
+
[8]: https://github.com/webpro-nl/knip/graphs/contributors
|
|
47
|
+
[9]: https://contrib.rocks/image?repo=webpro-nl/knip
|
package/dist/DependencyDeputy.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isBuiltin } from 'node:module';
|
|
2
2
|
import { DT_SCOPE, IGNORED_DEPENDENCIES, IGNORED_GLOBAL_BINARIES, IGNORED_RUNTIME_DEPENDENCIES, IGNORE_DEFINITELY_TYPED, ROOT_WORKSPACE_NAME, } from './constants.js';
|
|
3
3
|
import { getDependencyMetaData } from './manifest/index.js';
|
|
4
|
-
import { getDefinitelyTypedFor, getPackageFromDefinitelyTyped, isDefinitelyTyped } from './util/modules.js';
|
|
4
|
+
import { getDefinitelyTypedFor, getPackageFromDefinitelyTyped, getPackageNameFromModuleSpecifier, isDefinitelyTyped, } from './util/modules.js';
|
|
5
5
|
import { findMatch, toRegexOrString } from './util/regex.js';
|
|
6
6
|
export class DependencyDeputy {
|
|
7
7
|
isProduction;
|
|
@@ -217,14 +217,17 @@ export class DependencyDeputy {
|
|
|
217
217
|
const issueSet = issues[type][key];
|
|
218
218
|
for (const issueKey in issueSet) {
|
|
219
219
|
const issue = issueSet[issueKey];
|
|
220
|
-
|
|
220
|
+
const packageName = getPackageNameFromModuleSpecifier(issue.symbol);
|
|
221
|
+
if (!packageName)
|
|
222
|
+
continue;
|
|
223
|
+
if (IGNORED_DEPENDENCIES.has(packageName)) {
|
|
221
224
|
delete issueSet[issueKey];
|
|
222
225
|
counters[type]--;
|
|
223
226
|
}
|
|
224
227
|
else {
|
|
225
228
|
const manifest = this.getWorkspaceManifest(issue.workspace);
|
|
226
229
|
if (manifest) {
|
|
227
|
-
const ignoreItem = findMatch(manifest.ignoreDependencies,
|
|
230
|
+
const ignoreItem = findMatch(manifest.ignoreDependencies, packageName);
|
|
228
231
|
if (ignoreItem) {
|
|
229
232
|
delete issueSet[issueKey];
|
|
230
233
|
counters[type]--;
|
|
@@ -233,7 +236,7 @@ export class DependencyDeputy {
|
|
|
233
236
|
else if (issue.workspace !== ROOT_WORKSPACE_NAME) {
|
|
234
237
|
const manifest = this.getWorkspaceManifest(ROOT_WORKSPACE_NAME);
|
|
235
238
|
if (manifest) {
|
|
236
|
-
const ignoreItem = findMatch(manifest.ignoreDependencies,
|
|
239
|
+
const ignoreItem = findMatch(manifest.ignoreDependencies, packageName);
|
|
237
240
|
if (ignoreItem) {
|
|
238
241
|
delete issueSet[issueKey];
|
|
239
242
|
counters[type]--;
|
|
@@ -34,7 +34,7 @@ export declare class WorkspaceWorker {
|
|
|
34
34
|
isStrict: boolean;
|
|
35
35
|
rootIgnore: Configuration['ignore'];
|
|
36
36
|
negatedWorkspacePatterns: string[];
|
|
37
|
-
enabledPluginsMap: Record<"
|
|
37
|
+
enabledPluginsMap: Record<"astro" | "angular" | "ava" | "babel" | "capacitor" | "changesets" | "commitizen" | "commitlint" | "cspell" | "cucumber" | "cypress" | "eleventy" | "eslint" | "gatsby" | "husky" | "jest" | "ladle" | "lefthook" | "linthtml" | "markdownlint" | "mocha" | "moonrepo" | "msw" | "netlify" | "next" | "nx" | "nyc" | "oclif" | "playwright" | "postcss" | "prettier" | "remark" | "remix" | "rollup" | "rsbuild" | "rspack" | "sentry" | "storybook" | "stryker" | "stylelint" | "svelte" | "syncpack" | "tailwind" | "tsup" | "typedoc" | "typescript" | "unbuild" | "unocss" | "vue" | "vite" | "vitest" | "webpack" | "wireit" | "wrangler" | "xo" | "yorkie" | "drizzle" | "githubActions" | "graphqlCodegen" | "lintStaged" | "lockfileLint" | "lostPixel" | "nodeTestRunner" | "npmPackageJsonLint" | "playwrightCt" | "reactCosmos" | "releaseIt" | "semanticRelease" | "simpleGitHooks" | "sizeLimit" | "vercelOg" | "webdriverIo", boolean>;
|
|
38
38
|
enabledPlugins: PluginName[];
|
|
39
39
|
enabledPluginsInAncestors: string[];
|
|
40
40
|
cache: CacheConsultant<CacheItem>;
|
|
@@ -54,7 +54,7 @@ export declare class WorkspaceWorker {
|
|
|
54
54
|
entryFilePatterns: Set<string>;
|
|
55
55
|
productionEntryFilePatterns: Set<string>;
|
|
56
56
|
referencedDependencies: ReferencedDependencies;
|
|
57
|
-
enabledPlugins: ("
|
|
57
|
+
enabledPlugins: ("astro" | "angular" | "ava" | "babel" | "capacitor" | "changesets" | "commitizen" | "commitlint" | "cspell" | "cucumber" | "cypress" | "eleventy" | "eslint" | "gatsby" | "husky" | "jest" | "ladle" | "lefthook" | "linthtml" | "markdownlint" | "mocha" | "moonrepo" | "msw" | "netlify" | "next" | "nx" | "nyc" | "oclif" | "playwright" | "postcss" | "prettier" | "remark" | "remix" | "rollup" | "rsbuild" | "rspack" | "sentry" | "storybook" | "stryker" | "stylelint" | "svelte" | "syncpack" | "tailwind" | "tsup" | "typedoc" | "typescript" | "unbuild" | "unocss" | "vue" | "vite" | "vitest" | "webpack" | "wireit" | "wrangler" | "xo" | "yorkie" | "drizzle" | "githubActions" | "graphqlCodegen" | "lintStaged" | "lockfileLint" | "lostPixel" | "nodeTestRunner" | "npmPackageJsonLint" | "playwrightCt" | "reactCosmos" | "releaseIt" | "semanticRelease" | "simpleGitHooks" | "sizeLimit" | "vercelOg" | "webdriverIo")[];
|
|
58
58
|
}>;
|
|
59
59
|
onDispose(): void;
|
|
60
60
|
}
|
|
@@ -8,7 +8,7 @@ const config = [
|
|
|
8
8
|
...toLilconfig('postcss', { configDir: false, additionalExtensions: ['ts', 'mts', 'cts', 'yaml', 'yml'] }),
|
|
9
9
|
];
|
|
10
10
|
const resolveConfig = config => {
|
|
11
|
-
|
|
11
|
+
const plugins = config.plugins
|
|
12
12
|
? (Array.isArray(config.plugins) ? config.plugins : Object.keys(config.plugins)).flatMap(plugin => {
|
|
13
13
|
if (typeof plugin === 'string')
|
|
14
14
|
return plugin;
|
|
@@ -17,6 +17,7 @@ const resolveConfig = config => {
|
|
|
17
17
|
return [];
|
|
18
18
|
})
|
|
19
19
|
: [];
|
|
20
|
+
return plugins.includes('tailwindcss') ? [...plugins, 'postcss'] : plugins;
|
|
20
21
|
};
|
|
21
22
|
export default {
|
|
22
23
|
title,
|
|
@@ -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 test files, devDependencies)\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 --cache Enable caching\n --cache-location Change cache location (default: node_modules/.cache/knip)\n --watch Watch mode\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 --files Shortcut for --include files\n --fix Fix issues\n --fix-type Fix only issues of type, can be comma-separated or repeated (2)\n --allow-remove-files Allow Knip to remove files (with --fix)\n --include-libs Include type definitions from dependencies (default: false
|
|
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 test files, devDependencies)\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 --cache Enable caching\n --cache-location Change cache location (default: node_modules/.cache/knip)\n --watch Watch mode\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 --files Shortcut for --include files\n --fix Fix issues\n --fix-type Fix only issues of type, can be comma-separated or repeated (2)\n --allow-remove-files Allow Knip to remove files (with --fix)\n --include-libs Include type definitions from external dependencies (default: false)\n --include-entry-exports Include entry files when reporting unused exports\n --isolate-workspaces Isolate workspaces into separate programs\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
|
cache: boolean | undefined;
|
|
4
4
|
'cache-location': string | undefined;
|
|
@@ -22,7 +22,7 @@ Options:
|
|
|
22
22
|
--fix Fix issues
|
|
23
23
|
--fix-type Fix only issues of type, can be comma-separated or repeated (2)
|
|
24
24
|
--allow-remove-files Allow Knip to remove files (with --fix)
|
|
25
|
-
--include-libs Include type definitions from dependencies (default: false
|
|
25
|
+
--include-libs Include type definitions from external dependencies (default: false)
|
|
26
26
|
--include-entry-exports Include entry files when reporting unused exports
|
|
27
27
|
--isolate-workspaces Isolate workspaces into separate programs
|
|
28
28
|
-n, --no-progress Don't show dynamic progress updates (automatically enabled in CI environments)
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "5.27.
|
|
1
|
+
export declare const version = "5.27.4";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '5.27.
|
|
1
|
+
export const version = '5.27.4';
|