knip 3.13.1 → 3.13.2
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.
|
@@ -1,23 +1,29 @@
|
|
|
1
|
+
import { basename } from '../../util/path.js';
|
|
1
2
|
import { timerify } from '../../util/Performance.js';
|
|
2
3
|
import { hasDependency, load } from '../../util/plugin.js';
|
|
3
4
|
import { toEntryPattern } from '../../util/protocols.js';
|
|
4
5
|
export const NAME = 'tsup';
|
|
5
6
|
export const ENABLERS = ['tsup'];
|
|
6
7
|
export const isEnabled = ({ dependencies }) => hasDependency(dependencies, ENABLERS);
|
|
7
|
-
export const CONFIG_FILE_PATTERNS = ['tsup.config.js'];
|
|
8
|
-
const findTsupDependencies = async (configFilePath) => {
|
|
9
|
-
|
|
8
|
+
export const CONFIG_FILE_PATTERNS = ['tsup.config.{js,ts,cjs,json}', 'package.json'];
|
|
9
|
+
const findTsupDependencies = async (configFilePath, options) => {
|
|
10
|
+
const { manifest } = options;
|
|
11
|
+
let localConfig = basename(configFilePath) === 'package.json' ? manifest.tsup : await load(configFilePath);
|
|
10
12
|
if (typeof localConfig === 'function')
|
|
11
13
|
localConfig = await localConfig({});
|
|
12
14
|
if (!localConfig)
|
|
13
15
|
return [];
|
|
14
|
-
const entryPatterns = [localConfig]
|
|
16
|
+
const entryPatterns = [localConfig]
|
|
17
|
+
.flat()
|
|
18
|
+
.flatMap(config => {
|
|
15
19
|
if (!config.entry)
|
|
16
20
|
return [];
|
|
17
21
|
if (Array.isArray(config.entry))
|
|
18
|
-
return config.entry
|
|
19
|
-
return Object.values(config.entry)
|
|
20
|
-
})
|
|
22
|
+
return config.entry;
|
|
23
|
+
return Object.values(config.entry);
|
|
24
|
+
})
|
|
25
|
+
.filter(entry => !entry.startsWith('!'))
|
|
26
|
+
.map(toEntryPattern);
|
|
21
27
|
return entryPatterns;
|
|
22
28
|
};
|
|
23
29
|
export const findDependencies = timerify(findTsupDependencies);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { OwnershipEngine } from '@snyk/github-codeowners/dist/lib/ownership/index.js';
|
|
2
|
-
import
|
|
2
|
+
import picocolors from 'picocolors';
|
|
3
3
|
import { toRelative, relative, resolve } from '../util/path.js';
|
|
4
4
|
import { getTitle, logTitle, logIssueLine } from './util.js';
|
|
5
5
|
const logIssueSet = (issues) => {
|
|
6
6
|
issues
|
|
7
7
|
.sort((a, b) => (a.owner < b.owner ? -1 : 1))
|
|
8
|
-
.forEach(issue => console.log(
|
|
8
|
+
.forEach(issue => console.log(picocolors.cyan(issue.owner), toRelative(issue.symbol)));
|
|
9
9
|
};
|
|
10
10
|
const logIssueRecord = (issues) => {
|
|
11
11
|
const sortedByFilePath = issues.sort((a, b) => (a.owner < b.owner ? -1 : 1));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
1
|
import EasyTable from 'easy-table';
|
|
2
|
+
import picocolors from 'picocolors';
|
|
3
3
|
import { ROOT_WORKSPACE_NAME } from '../constants.js';
|
|
4
4
|
import { relative } from '../util/path.js';
|
|
5
5
|
import { getTitle, logTitle, logIssueSet, identity } from './util.js';
|
|
@@ -8,7 +8,7 @@ const truncate = (text) => (text.length > TRUNCATE_WIDTH ? text.slice(0, TRUNCAT
|
|
|
8
8
|
const logIssueRecord = (issues) => {
|
|
9
9
|
const table = new EasyTable();
|
|
10
10
|
issues.forEach(issue => {
|
|
11
|
-
const print = issue.severity === 'warn' ?
|
|
11
|
+
const print = issue.severity === 'warn' ? picocolors.gray : identity;
|
|
12
12
|
table.cell('symbol', print(issue.symbols ? truncate(issue.symbols.map(s => s.symbol).join(', ')) : issue.symbol));
|
|
13
13
|
issue.parentSymbol && table.cell('parentSymbol', print(issue.parentSymbol));
|
|
14
14
|
issue.symbolType && table.cell('symbolType', print(issue.symbolType));
|
|
@@ -46,7 +46,7 @@ export default ({ report, issues, configurationHints, noConfigHints, isShowProgr
|
|
|
46
46
|
const { type, workspaceName, identifier } = hint;
|
|
47
47
|
const message = `Unused item in ${type}`;
|
|
48
48
|
const workspace = workspaceName && workspaceName !== ROOT_WORKSPACE_NAME ? ` (workspace: ${workspaceName})` : ``;
|
|
49
|
-
console.warn(
|
|
49
|
+
console.warn(picocolors.gray(`${message}${workspace}:`), identifier);
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
52
|
if (totalIssues === 0 && isShowProgress) {
|
package/dist/reporters/util.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import
|
|
1
|
+
import picocolors from 'picocolors';
|
|
2
2
|
import { ISSUE_TYPE_TITLE } from '../constants.js';
|
|
3
3
|
import { toRelative, relative } from '../util/path.js';
|
|
4
4
|
export const identity = (text) => text;
|
|
5
5
|
export const getTitle = (reportType) => {
|
|
6
6
|
return ISSUE_TYPE_TITLE[reportType];
|
|
7
7
|
};
|
|
8
|
-
export const logTitle = (title, count) => console.log(`${
|
|
8
|
+
export const logTitle = (title, count) => console.log(`${picocolors.bold(picocolors.yellow(picocolors.underline(title)))} (${count})`);
|
|
9
9
|
export const logIssueLine = ({ owner, filePath, symbols, parentSymbol, severity }) => {
|
|
10
10
|
const symbol = symbols ? `: ${symbols.map(s => s.symbol).join(', ')}` : '';
|
|
11
11
|
const parent = parentSymbol ? ` (${parentSymbol})` : '';
|
|
12
|
-
const print = severity === 'warn' ?
|
|
13
|
-
console.log(`${owner ? `${
|
|
12
|
+
const print = severity === 'warn' ? picocolors.gray : identity;
|
|
13
|
+
console.log(`${owner ? `${picocolors.cyan(owner)} ` : ''}${print(`${relative(filePath)}${symbol}${parent}`)}`);
|
|
14
14
|
};
|
|
15
15
|
export const logIssueSet = (issues) => {
|
|
16
16
|
issues.sort().forEach(value => console.log(toRelative(value)));
|
package/dist/util/debug.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import util from 'node:util';
|
|
2
|
-
import
|
|
2
|
+
import picocolors from 'picocolors';
|
|
3
3
|
import parsedArgValues from './cli-arguments.js';
|
|
4
4
|
const { debug } = parsedArgValues;
|
|
5
5
|
const IS_ENABLED = debug ?? false;
|
|
6
6
|
const inspectOptions = { maxArrayLength: null, depth: null, colors: true };
|
|
7
|
-
const ctx = (text) => typeof text === 'string' ?
|
|
7
|
+
const ctx = (text) => typeof text === 'string' ? picocolors.yellow(`[${text}]`) : `${picocolors.yellow(`[${text[0]}]`)} ${picocolors.cyan(text[1])}`;
|
|
8
8
|
const logArray = (collection) => {
|
|
9
9
|
console.log(util.inspect(collection.sort(), inspectOptions));
|
|
10
10
|
};
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "3.13.
|
|
1
|
+
export declare const version = "3.13.2";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '3.13.
|
|
1
|
+
export const version = '3.13.2';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "knip",
|
|
3
|
-
"version": "3.13.
|
|
3
|
+
"version": "3.13.2",
|
|
4
4
|
"description": "Find unused files, dependencies and exports in your TypeScript and JavaScript projects",
|
|
5
5
|
"homepage": "https://knip.dev",
|
|
6
6
|
"repository": {
|
|
@@ -60,7 +60,6 @@
|
|
|
60
60
|
"@pnpm/logger": "5.0.0",
|
|
61
61
|
"@pnpm/workspace.pkgs-graph": "^2.0.13",
|
|
62
62
|
"@snyk/github-codeowners": "1.1.0",
|
|
63
|
-
"chalk": "^5.3.0",
|
|
64
63
|
"easy-table": "1.2.0",
|
|
65
64
|
"fast-glob": "3.3.2",
|
|
66
65
|
"globby": "^14.0.0",
|
|
@@ -68,6 +67,7 @@
|
|
|
68
67
|
"js-yaml": "4.1.0",
|
|
69
68
|
"micromatch": "4.0.5",
|
|
70
69
|
"minimist": "1.2.8",
|
|
70
|
+
"picocolors": "1.0.0",
|
|
71
71
|
"pretty-ms": "8.0.0",
|
|
72
72
|
"strip-json-comments": "5.0.1",
|
|
73
73
|
"summary": "2.1.0",
|
|
@@ -75,8 +75,8 @@
|
|
|
75
75
|
"zod-validation-error": "2.1.0"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
78
|
-
"
|
|
79
|
-
"
|
|
78
|
+
"@types/node": ">=18",
|
|
79
|
+
"typescript": ">=5.0.4"
|
|
80
80
|
},
|
|
81
81
|
"devDependencies": {
|
|
82
82
|
"@jest/types": "29.6.3",
|