knip 6.17.0 → 6.17.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.
- package/dist/IssueCollector.d.ts +2 -0
- package/dist/IssueCollector.js +10 -0
- package/dist/plugins/jest/index.js +3 -2
- package/dist/plugins/react-email/index.js +1 -1
- package/dist/plugins/vitest/index.js +3 -0
- package/dist/run.js +1 -0
- package/dist/util/create-options.js +1 -1
- package/dist/util/map-workspaces.js +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +10 -10
package/dist/IssueCollector.d.ts
CHANGED
|
@@ -20,8 +20,10 @@ export declare class IssueCollector {
|
|
|
20
20
|
private isTrackUnusedIgnorePatterns;
|
|
21
21
|
private unusedIgnorePatterns;
|
|
22
22
|
private unusedIgnoreFilesPatterns;
|
|
23
|
+
private selectedWorkspaces;
|
|
23
24
|
constructor(options: MainOptions);
|
|
24
25
|
setWorkspaceFilter(workspaceFilePathFilter: WorkspaceFilePathFilter | undefined): void;
|
|
26
|
+
setSelectedWorkspaces(selectedWorkspaces: Set<string> | undefined): void;
|
|
25
27
|
private collectIgnorePatterns;
|
|
26
28
|
addIgnorePatterns(entries: {
|
|
27
29
|
pattern: string;
|
package/dist/IssueCollector.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import picomatch from 'picomatch';
|
|
2
|
+
import { ROOT_WORKSPACE_NAME } from './constants.js';
|
|
2
3
|
import { partition } from './util/array.js';
|
|
3
4
|
import { prependDirToPattern } from './util/glob.js';
|
|
4
5
|
import { initCounters, initIssues } from './util/issue-initializers.js';
|
|
@@ -29,6 +30,7 @@ export class IssueCollector {
|
|
|
29
30
|
isTrackUnusedIgnorePatterns;
|
|
30
31
|
unusedIgnorePatterns = new Map();
|
|
31
32
|
unusedIgnoreFilesPatterns = new Map();
|
|
33
|
+
selectedWorkspaces;
|
|
32
34
|
constructor(options) {
|
|
33
35
|
this.cwd = options.cwd;
|
|
34
36
|
this.rules = options.rules;
|
|
@@ -41,6 +43,9 @@ export class IssueCollector {
|
|
|
41
43
|
if (workspaceFilePathFilter)
|
|
42
44
|
this.workspaceFilter = workspaceFilePathFilter;
|
|
43
45
|
}
|
|
46
|
+
setSelectedWorkspaces(selectedWorkspaces) {
|
|
47
|
+
this.selectedWorkspaces = selectedWorkspaces;
|
|
48
|
+
}
|
|
44
49
|
collectIgnorePatterns(entries, patterns, unused, type) {
|
|
45
50
|
for (const entry of entries) {
|
|
46
51
|
patterns.add(entry.pattern);
|
|
@@ -145,6 +150,11 @@ export class IssueCollector {
|
|
|
145
150
|
return true;
|
|
146
151
|
}
|
|
147
152
|
addConfigurationHint(issue) {
|
|
153
|
+
if (this.selectedWorkspaces) {
|
|
154
|
+
const workspaceName = issue.workspaceName ?? ROOT_WORKSPACE_NAME;
|
|
155
|
+
if (workspaceName === ROOT_WORKSPACE_NAME || !this.selectedWorkspaces.has(workspaceName))
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
148
158
|
const key = `${issue.workspaceName}::${issue.type}::${issue.identifier}`;
|
|
149
159
|
if (!this.configurationHints.has(key))
|
|
150
160
|
this.configurationHints.set(key, issue);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { arrayify } from '../../util/array.js';
|
|
1
2
|
import { _glob, _dirGlob } from '../../util/glob.js';
|
|
2
3
|
import { toDeferResolve, toEntry } from '../../util/input.js';
|
|
3
4
|
import { isInternal, join, normalize, toAbsolute } from '../../util/path.js';
|
|
@@ -35,7 +36,7 @@ const resolveDependencies = async (config, rootDir, options) => {
|
|
|
35
36
|
projects.push(dependency);
|
|
36
37
|
}
|
|
37
38
|
}
|
|
38
|
-
const runner = config.runner ? [config.runner] : [];
|
|
39
|
+
const runner = config.runner ? [typeof config.runner === 'string' ? config.runner : config.runner[0]] : [];
|
|
39
40
|
const runtime = config.runtime && config.runtime !== 'jest-circus' ? [config.runtime] : [];
|
|
40
41
|
const environments = config.testEnvironment === 'jsdom'
|
|
41
42
|
? ['jest-environment-jsdom']
|
|
@@ -88,7 +89,7 @@ const resolveConfig = async (localConfig, options) => {
|
|
|
88
89
|
const replaceRootDir = (name) => name.replace(rootDirRe, rootDir);
|
|
89
90
|
const inputs = await resolveDependencies(localConfig, rootDir, options);
|
|
90
91
|
const entries = localConfig.testMatch
|
|
91
|
-
? localConfig.testMatch.map(replaceRootDir).map(id => toEntry(id))
|
|
92
|
+
? arrayify(localConfig.testMatch).map(replaceRootDir).map(id => toEntry(id))
|
|
92
93
|
: entry.map(id => toEntry(id));
|
|
93
94
|
if (localConfig.testMatch && !options.config.entry)
|
|
94
95
|
entries.push(...mocks.map(id => toEntry(id)));
|
|
@@ -10,7 +10,7 @@ const args = {
|
|
|
10
10
|
resolveInputs: (parsed, { manifest }) => {
|
|
11
11
|
const inputs = [];
|
|
12
12
|
if (previewCommands.has(parsed._[0])) {
|
|
13
|
-
const dep = (manifest.getMajor('react-email') ??
|
|
13
|
+
const dep = (manifest.getMajor('react-email') ?? 6) >= 6 ? '@react-email/ui' : '@react-email/preview-server';
|
|
14
14
|
inputs.push(toDependency(dep));
|
|
15
15
|
}
|
|
16
16
|
if (parsed.dir)
|
|
@@ -162,6 +162,9 @@ const args = {
|
|
|
162
162
|
if (typeof parsed['coverage'] === 'object' && parsed['coverage'].provider) {
|
|
163
163
|
inputs.push(toDependency(`@vitest/coverage-${parsed['coverage'].provider}`));
|
|
164
164
|
}
|
|
165
|
+
else if (parsed['coverage']) {
|
|
166
|
+
inputs.push(toDependency('@vitest/coverage-v8', { optional: true }));
|
|
167
|
+
}
|
|
165
168
|
if (parsed['reporter']) {
|
|
166
169
|
for (const reporter of getExternalReporters([parsed['reporter']].flat())) {
|
|
167
170
|
inputs.push(toDependency(reporter));
|
package/dist/run.js
CHANGED
|
@@ -33,6 +33,7 @@ export const run = async (options) => {
|
|
|
33
33
|
const findWorkspaceManifestImports = getWorkspaceManifestHandler(chief);
|
|
34
34
|
const principal = new ProjectPrincipal(options, toSourceFilePath, findWorkspaceManifestImports);
|
|
35
35
|
collector.setWorkspaceFilter(chief.workspaceFilePathFilter);
|
|
36
|
+
collector.setSelectedWorkspaces(chief.selectedWorkspaces);
|
|
36
37
|
collector.setIgnoreIssues(chief.getIgnoreIssues());
|
|
37
38
|
debugLogObject('*', 'Included workspaces', () => workspaces.map(w => w.pkgName));
|
|
38
39
|
debugLogObject('*', 'Included workspace configs', () => workspaces.map(w => ({ pkgName: w.pkgName, name: w.name, config: w.config, ancestors: w.ancestors })));
|
|
@@ -106,7 +106,7 @@ export const createOptions = async (options) => {
|
|
|
106
106
|
includedIssueTypes,
|
|
107
107
|
isCache: args.cache ?? false,
|
|
108
108
|
isDebug,
|
|
109
|
-
isDisableConfigHints: args['no-config-hints'] || isProduction
|
|
109
|
+
isDisableConfigHints: args['no-config-hints'] || isProduction,
|
|
110
110
|
isDisableTagHints: Boolean(args['no-tag-hints']),
|
|
111
111
|
isFix: args.fix ?? options.isFix ?? isFixFiles ?? fixTypes.length > 0,
|
|
112
112
|
isFixCatalog: fixTypes.length === 0 || fixTypes.includes('catalog'),
|
|
@@ -15,7 +15,7 @@ export default async function mapWorkspaces(cwd, workspaces) {
|
|
|
15
15
|
const manifestPatterns = patterns.map(p => join(p, 'package.json'));
|
|
16
16
|
const matches = await glob(manifestPatterns, {
|
|
17
17
|
cwd,
|
|
18
|
-
ignore: ['**/node_modules/**', ...negatedPatterns.map(p => p.slice(1))],
|
|
18
|
+
ignore: ['**/node_modules/**', ...negatedPatterns.map(p => join(p.slice(1), 'package.json'))],
|
|
19
19
|
});
|
|
20
20
|
for (const match of matches.sort()) {
|
|
21
21
|
const name = match === 'package.json' ? '.' : match.replace(/\/package\.json$/, '');
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "6.17.
|
|
1
|
+
export declare const version = "6.17.2";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '6.17.
|
|
1
|
+
export const version = '6.17.2';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "knip",
|
|
3
|
-
"version": "6.17.
|
|
3
|
+
"version": "6.17.2",
|
|
4
4
|
"description": "Find and fix unused dependencies, exports and files in your TypeScript and JavaScript projects",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"analysis",
|
|
@@ -81,25 +81,25 @@
|
|
|
81
81
|
"formatly": "^0.3.0",
|
|
82
82
|
"get-tsconfig": "4.14.0",
|
|
83
83
|
"jiti": "^2.7.0",
|
|
84
|
-
"oxc-parser": "^0.
|
|
84
|
+
"oxc-parser": "^0.135.0",
|
|
85
85
|
"oxc-resolver": "^11.20.0",
|
|
86
86
|
"picomatch": "^4.0.4",
|
|
87
87
|
"smol-toml": "^1.6.1",
|
|
88
88
|
"strip-json-comments": "5.0.3",
|
|
89
|
-
"tinyglobby": "^0.2.
|
|
90
|
-
"unbash": "^
|
|
89
|
+
"tinyglobby": "^0.2.17",
|
|
90
|
+
"unbash": "^4.0.1",
|
|
91
91
|
"yaml": "^2.9.0",
|
|
92
92
|
"zod": "^4.1.11"
|
|
93
93
|
},
|
|
94
94
|
"devDependencies": {
|
|
95
|
-
"@jest/types": "^
|
|
96
|
-
"@types/bun": "^1.3.
|
|
97
|
-
"@types/picomatch": "^4.0.
|
|
95
|
+
"@jest/types": "^30.4.1",
|
|
96
|
+
"@types/bun": "^1.3.14",
|
|
97
|
+
"@types/picomatch": "^4.0.3",
|
|
98
98
|
"@types/webpack": "^5.28.5",
|
|
99
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
99
|
+
"@typescript/native-preview": "7.0.0-dev.20260612.1",
|
|
100
100
|
"codeclimate-types": "^0.3.1",
|
|
101
|
-
"prettier": "^3.8.
|
|
102
|
-
"tsx": "^4.
|
|
101
|
+
"prettier": "^3.8.4",
|
|
102
|
+
"tsx": "^4.22.4"
|
|
103
103
|
},
|
|
104
104
|
"engines": {
|
|
105
105
|
"node": "^20.19.0 || >=22.12.0"
|