entkapp 5.2.0 → 5.2.1
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/package.json +1 -1
- package/src/EngineContext.js +19 -5
- package/src/index.js +3 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
3
|
"name": "entkapp",
|
|
4
|
-
"version": "5.2.
|
|
4
|
+
"version": "5.2.1",
|
|
5
5
|
"description": "The Ultimate Enterprise Codebase Janitor. Faster than Knip with OXC integration, type-aware analysis, and automated structural healing. Fully standalone - solving what Knip cannot.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "index.js",
|
package/src/EngineContext.js
CHANGED
|
@@ -86,10 +86,16 @@ export class GraphNode {
|
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
// Fuzzy / Dynamic usage (Identifiers, Strings, JSX, Decorators)
|
|
89
|
-
if
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
89
|
+
// UPGRADE: Only check for fuzzy matches if we have a reason to believe it might be used.
|
|
90
|
+
// We skip global names like 'toLowerCase' unless they are explicitly imported.
|
|
91
|
+
const isGlobalName = ['toLowerCase', 'toUpperCase', 'toString', 'valueOf', 'hasOwnProperty', 'constructor'].includes(symbolName);
|
|
92
|
+
|
|
93
|
+
if (!isGlobalName) {
|
|
94
|
+
if (parentNode.instantiatedIdentifiers.has(symbolName)) return true;
|
|
95
|
+
if (parentNode.rawStringReferences.has(symbolName)) return true;
|
|
96
|
+
if (parentNode.jsxComponents.has(symbolName)) return true;
|
|
97
|
+
if (parentNode.decorators.has(symbolName)) return true;
|
|
98
|
+
}
|
|
93
99
|
|
|
94
100
|
for (const accessChain of parentNode.propertyAccessChains) {
|
|
95
101
|
if (accessChain.endsWith(`.${symbolName}`) || accessChain.includes(`.${symbolName}.`)) return true;
|
|
@@ -390,7 +396,15 @@ export class EngineContext {
|
|
|
390
396
|
continue;
|
|
391
397
|
}
|
|
392
398
|
|
|
393
|
-
|
|
399
|
+
// UPGRADE: Be more aggressive in detecting unused dependencies.
|
|
400
|
+
// Check both externalPackageUsage and rawStringReferences.
|
|
401
|
+
const isUsed = usedByReachableFiles.has(dep) ||
|
|
402
|
+
Array.from(reachableFiles).some(f => {
|
|
403
|
+
const node = this.projectGraph.get(f);
|
|
404
|
+
return node && (node.externalPackageUsage.has(dep) || node.rawStringReferences.has(dep));
|
|
405
|
+
});
|
|
406
|
+
|
|
407
|
+
if (!isUsed) {
|
|
394
408
|
report.unusedDependencies.push({
|
|
395
409
|
package: dep,
|
|
396
410
|
type: deps.dependencies.includes(dep) ? 'dependency' : 'devDependency',
|
package/src/index.js
CHANGED
|
@@ -940,7 +940,9 @@ export class RefactoringEngine {
|
|
|
940
940
|
if (isProtected || isExplicitlyDeclared) {
|
|
941
941
|
finalIsEntry = true;
|
|
942
942
|
} else if (!hasManifestEntries && hasNoIncoming && hasOutgoing && !isLikelyBarrel) {
|
|
943
|
-
|
|
943
|
+
// UPGRADE: Orphan files with imports are NOT entry points by default.
|
|
944
|
+
// They must have side effects (detected in AST pass) to be entries.
|
|
945
|
+
finalIsEntry = node.isEntry;
|
|
944
946
|
}
|
|
945
947
|
|
|
946
948
|
node.isEntry = finalIsEntry;
|