knip 5.66.2 → 5.66.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/dist/graph/analyze.js +1 -1
- package/dist/index.d.ts +0 -2
- package/dist/plugins/next/index.js +3 -3
- package/dist/plugins/vitest/helpers.js +2 -0
- package/dist/reporters/index.d.ts +8 -8
- package/dist/types.d.ts +2 -0
- package/dist/types.js +1 -0
- package/dist/typescript/visitors/exports/exportKeyword.js +1 -1
- package/dist/typescript/visitors/imports/importDeclaration.js +1 -1
- package/dist/util/create-options.js +5 -1
- package/dist/util/module-graph.js +2 -3
- package/dist/util/remove-export.js +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -3
package/dist/graph/analyze.js
CHANGED
|
@@ -163,7 +163,7 @@ export const analyze = async ({ analyzedFiles, chief, collector, deputy, entryPa
|
|
|
163
163
|
for (const [filePath, file] of graph.entries()) {
|
|
164
164
|
const ws = chief.findWorkspaceByFilePath(filePath);
|
|
165
165
|
if (ws) {
|
|
166
|
-
if (file.duplicates) {
|
|
166
|
+
if (file.duplicates && options.includedIssueTypes.duplicates) {
|
|
167
167
|
for (const symbols of file.duplicates) {
|
|
168
168
|
if (symbols.length > 1) {
|
|
169
169
|
const symbol = symbols.map(s => s.symbol).join('|');
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import type { MainOptions } from './util/create-options.js';
|
|
2
|
-
export type { RawConfiguration as KnipConfig } from './types/config.js';
|
|
3
|
-
export type { Preprocessor, Reporter, ReporterOptions } from './types/issues.js';
|
|
4
2
|
export declare const main: (options: MainOptions) => Promise<{
|
|
5
3
|
issues: import("./types/issues.js").Issues;
|
|
6
4
|
counters: import("./types/issues.js").Counters;
|
|
@@ -7,9 +7,9 @@ const isEnabled = ({ dependencies }) => hasDependency(dependencies, enablers);
|
|
|
7
7
|
const config = ['next.config.{js,ts,cjs,mjs}'];
|
|
8
8
|
const defaultPageExtensions = ['{js,jsx,ts,tsx}'];
|
|
9
9
|
const productionEntryFilePatterns = [
|
|
10
|
-
'{instrumentation,instrumentation-client,middleware}.{js,ts}',
|
|
11
|
-
'app/global-error.{js,jsx,ts,tsx}',
|
|
12
|
-
'app/**/{error,layout,loading,not-found,page,template,default}.{js,jsx,ts,tsx}',
|
|
10
|
+
'{instrumentation,instrumentation-client,middleware,proxy}.{js,ts}',
|
|
11
|
+
'app/global-{error,not-found}.{js,jsx,ts,tsx}',
|
|
12
|
+
'app/**/{error,layout,loading,not-found,page,template,default,forbidden,unauthorized}.{js,jsx,ts,tsx}',
|
|
13
13
|
'app/**/route.{js,jsx,ts,tsx}',
|
|
14
14
|
'app/{manifest,robots}.{js,ts}',
|
|
15
15
|
'app/**/sitemap.{js,ts}',
|
|
@@ -16,6 +16,7 @@ export const getEnvPackageName = (env) => {
|
|
|
16
16
|
};
|
|
17
17
|
const builtInReporters = [
|
|
18
18
|
'basic',
|
|
19
|
+
'blob',
|
|
19
20
|
'default',
|
|
20
21
|
'dot',
|
|
21
22
|
'github-actions',
|
|
@@ -25,6 +26,7 @@ const builtInReporters = [
|
|
|
25
26
|
'junit',
|
|
26
27
|
'tap',
|
|
27
28
|
'tap-flat',
|
|
29
|
+
'tree',
|
|
28
30
|
'verbose',
|
|
29
31
|
];
|
|
30
32
|
export const getExternalReporters = (reporters) => reporters
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
|
-
symbols: (options: import("../
|
|
3
|
-
compact: ({ report, issues, isShowProgress, cwd }: import("../
|
|
4
|
-
codeowners: ({ report, issues, isShowProgress, options, cwd }: import("../
|
|
5
|
-
disclosure: ({ report, issues, cwd }: import("../
|
|
6
|
-
codeclimate: ({ report, issues, cwd }: import("../
|
|
7
|
-
json: ({ report, issues, options, cwd }: import("../
|
|
8
|
-
markdown: ({ report, issues, cwd }: import("../
|
|
9
|
-
'github-actions': ({ report, issues, cwd, configurationHints, isDisableConfigHints, isTreatConfigHintsAsErrors, configFilePath, }: import("../
|
|
2
|
+
symbols: (options: import("../types.js").ReporterOptions) => void;
|
|
3
|
+
compact: ({ report, issues, isShowProgress, cwd }: import("../types.js").ReporterOptions) => void;
|
|
4
|
+
codeowners: ({ report, issues, isShowProgress, options, cwd }: import("../types.js").ReporterOptions) => void;
|
|
5
|
+
disclosure: ({ report, issues, cwd }: import("../types.js").ReporterOptions) => void;
|
|
6
|
+
codeclimate: ({ report, issues, cwd }: import("../types.js").ReporterOptions) => Promise<void>;
|
|
7
|
+
json: ({ report, issues, options, cwd }: import("../types.js").ReporterOptions) => Promise<void>;
|
|
8
|
+
markdown: ({ report, issues, cwd }: import("../types.js").ReporterOptions) => void;
|
|
9
|
+
'github-actions': ({ report, issues, cwd, configurationHints, isDisableConfigHints, isTreatConfigHintsAsErrors, configFilePath, }: import("../types.js").ReporterOptions) => void;
|
|
10
10
|
};
|
|
11
11
|
export default _default;
|
package/dist/types.d.ts
ADDED
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -33,7 +33,7 @@ export default visit(isModule, (node, { isFixExports, isFixTypes, isReportClassM
|
|
|
33
33
|
return {
|
|
34
34
|
node: element,
|
|
35
35
|
symbol: element.symbol,
|
|
36
|
-
identifier: element.getText(),
|
|
36
|
+
identifier: element.name.getText(),
|
|
37
37
|
type: SYMBOL_TYPE.UNKNOWN,
|
|
38
38
|
pos: element.getStart(),
|
|
39
39
|
fix,
|
|
@@ -58,6 +58,10 @@ export const createOptions = async (options) => {
|
|
|
58
58
|
...(parsedCLIArgs.files ? shorthandFiles : []),
|
|
59
59
|
],
|
|
60
60
|
});
|
|
61
|
+
for (const [key, value] of Object.entries(includedIssueTypes)) {
|
|
62
|
+
if (!value)
|
|
63
|
+
rules[key] = 'off';
|
|
64
|
+
}
|
|
61
65
|
const fixTypes = rest.fixTypes ?? parsedCLIArgs['fix-type'] ?? [];
|
|
62
66
|
const isFixFiles = parsedCLIArgs['allow-remove-files'] && (fixTypes.length === 0 || fixTypes.includes('files'));
|
|
63
67
|
const isIncludeLibs = parsedCLIArgs['include-libs'] ?? rest.isIncludeLibs ?? false;
|
|
@@ -78,7 +82,7 @@ export const createOptions = async (options) => {
|
|
|
78
82
|
isCache: parsedCLIArgs.cache ?? false,
|
|
79
83
|
isDebug: parsedCLIArgs.debug ?? false,
|
|
80
84
|
isDisableConfigHints: parsedCLIArgs['no-config-hints'] || isProduction || Boolean(parsedCLIArgs.workspace),
|
|
81
|
-
isFix: parsedCLIArgs.fix ?? rest.isFix ??
|
|
85
|
+
isFix: parsedCLIArgs.fix ?? rest.isFix ?? isFixFiles ?? fixTypes.length > 0,
|
|
82
86
|
isFixDependencies: fixTypes.length === 0 || fixTypes.includes('dependencies'),
|
|
83
87
|
isFixFiles,
|
|
84
88
|
isFixUnusedExports: fixTypes.length === 0 || fixTypes.includes('exports'),
|
|
@@ -24,9 +24,8 @@ export const updateImportMap = (file, importMap, graph) => {
|
|
|
24
24
|
updateImportDetails(importedFileImports, importDetails);
|
|
25
25
|
const importedFile = getOrCreateFileNode(graph, importedFilePath);
|
|
26
26
|
if (!importedFile.imported)
|
|
27
|
-
importedFile.imported =
|
|
28
|
-
|
|
29
|
-
updateImportDetails(importedFile.imported, importDetails);
|
|
27
|
+
importedFile.imported = createImports();
|
|
28
|
+
updateImportDetails(importedFile.imported, importDetails);
|
|
30
29
|
graph.set(importedFilePath, importedFile);
|
|
31
30
|
}
|
|
32
31
|
};
|
|
@@ -57,7 +57,7 @@ export const removeExport = ({ text, start, end, flags }) => {
|
|
|
57
57
|
const openingBracketIndex = getOpeningBracketIndex(beforeStart);
|
|
58
58
|
if (closingBracketOffset !== -1 && openingBracketIndex !== -1) {
|
|
59
59
|
const beforeBracket = beforeStart.substring(0, openingBracketIndex).trim();
|
|
60
|
-
const exportLength = beforeBracket.endsWith('export') ? 6 : beforeBracket.endsWith('export type') ?
|
|
60
|
+
const exportLength = beforeBracket.endsWith('export') ? 6 : beforeBracket.endsWith('export type') ? 11 : 0;
|
|
61
61
|
const exportKeywordOffset = beforeBracket.length - exportLength;
|
|
62
62
|
if (exportLength) {
|
|
63
63
|
const fromBracket = afterEnd.substring(closingBracketOffset).trim();
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "5.66.
|
|
1
|
+
export declare const version = "5.66.4";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '5.66.
|
|
1
|
+
export const version = '5.66.4';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "knip",
|
|
3
|
-
"version": "5.66.
|
|
3
|
+
"version": "5.66.4",
|
|
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": {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"knip-bun": "bin/knip-bun.js"
|
|
31
31
|
},
|
|
32
32
|
"type": "module",
|
|
33
|
-
"types": "./dist/
|
|
33
|
+
"types": "./dist/types.d.ts",
|
|
34
34
|
"scripts": {
|
|
35
35
|
"knip": "node ./dist/cli.js --directory ../..",
|
|
36
36
|
"knip:production": "node ./dist/cli.js --directory ../.. --production --strict",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
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.12.0",
|
|
67
67
|
"picocolors": "^1.1.1",
|
|
68
68
|
"picomatch": "^4.0.1",
|
|
69
69
|
"smol-toml": "^1.4.1",
|