knip 2.14.2 → 2.14.3
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/ProjectPrincipal.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
2
|
import { DEFAULT_EXTENSIONS } from './constants.js';
|
|
3
3
|
import { IGNORED_FILE_EXTENSIONS } from './constants.js';
|
|
4
|
+
import { isInModuleBlock } from './typescript/ast-helpers.js';
|
|
4
5
|
import { createHosts } from './typescript/createHosts.js';
|
|
5
6
|
import { getImportsAndExports } from './typescript/getImportsAndExports.js';
|
|
6
7
|
import { isMaybePackageName } from './util/modules.js';
|
|
@@ -162,6 +163,9 @@ export class ProjectPrincipal {
|
|
|
162
163
|
hasReferences.external = true;
|
|
163
164
|
}
|
|
164
165
|
}
|
|
166
|
+
if (!hasReferences.external && hasReferences.internal) {
|
|
167
|
+
hasReferences.external = isInModuleBlock(exportedItem.node);
|
|
168
|
+
}
|
|
165
169
|
return hasReferences;
|
|
166
170
|
}
|
|
167
171
|
findUnusedMembers(filePath, members) {
|
|
@@ -23,4 +23,5 @@ export declare function stripQuotes(name: string): string;
|
|
|
23
23
|
export declare function findAncestor<T>(node: ts.Node | undefined, callback: (element: ts.Node) => boolean | 'STOP'): T | undefined;
|
|
24
24
|
export declare function findDescendants<T>(node: ts.Node | undefined, callback: (element: ts.Node) => boolean | 'STOP'): T[];
|
|
25
25
|
export declare const isDeclarationFileExtension: (extension: string) => boolean;
|
|
26
|
+
export declare const isInModuleBlock: (node: ts.Node) => boolean;
|
|
26
27
|
export {};
|
|
@@ -92,3 +92,12 @@ export function findDescendants(node, callback) {
|
|
|
92
92
|
return results;
|
|
93
93
|
}
|
|
94
94
|
export const isDeclarationFileExtension = (extension) => extension === '.d.ts' || extension === '.d.mts' || extension === '.d.cts';
|
|
95
|
+
export const isInModuleBlock = (node) => {
|
|
96
|
+
node = node?.parent;
|
|
97
|
+
while (node) {
|
|
98
|
+
if (ts.isModuleBlock(node))
|
|
99
|
+
return true;
|
|
100
|
+
node = node.parent;
|
|
101
|
+
}
|
|
102
|
+
return false;
|
|
103
|
+
};
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "2.14.
|
|
1
|
+
export declare const version = "2.14.3";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '2.14.
|
|
1
|
+
export const version = '2.14.3';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "knip",
|
|
3
|
-
"version": "2.14.
|
|
3
|
+
"version": "2.14.3",
|
|
4
4
|
"description": "Find unused files, dependencies and exports in your TypeScript and JavaScript projects",
|
|
5
5
|
"homepage": "https://github.com/webpro/knip",
|
|
6
6
|
"repository": "github:webpro/knip",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"summary": "^2.1.0",
|
|
58
58
|
"typescript": "^5.0.2",
|
|
59
59
|
"zod": "^3.20.6",
|
|
60
|
-
"zod-validation-error": "1.3.
|
|
60
|
+
"zod-validation-error": "1.3.1"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@jest/types": "29.5.0",
|
|
@@ -70,14 +70,14 @@
|
|
|
70
70
|
"@types/node": "20.3.1",
|
|
71
71
|
"@types/npmcli__map-workspaces": "3.0.1",
|
|
72
72
|
"@types/webpack": "5.28.1",
|
|
73
|
-
"@typescript-eslint/eslint-plugin": "5.
|
|
74
|
-
"@typescript-eslint/parser": "5.
|
|
73
|
+
"@typescript-eslint/eslint-plugin": "5.60.0",
|
|
74
|
+
"@typescript-eslint/parser": "5.60.0",
|
|
75
75
|
"c8": "8.0.0",
|
|
76
76
|
"eslint": "8.42.0",
|
|
77
77
|
"eslint-import-resolver-typescript": "3.5.5",
|
|
78
78
|
"eslint-plugin-import": "2.27.5",
|
|
79
|
-
"eslint-plugin-n": "16.0.
|
|
80
|
-
"glob": "10.
|
|
79
|
+
"eslint-plugin-n": "16.0.1",
|
|
80
|
+
"glob": "10.3.0",
|
|
81
81
|
"prettier": "2.8.8",
|
|
82
82
|
"release-it": "15.11.0",
|
|
83
83
|
"remark-cli": "11.0.0",
|