sicua
Version:
A tool for analyzing project structure and dependencies
66 lines (65 loc) • 2.23 kB
TypeScript
/**
* Helper class to distinguish between internal project components and external node_modules dependencies
*/
export declare class NodeModuleDetector {
private projectRoot;
private srcDirectory;
private packageJsonDependencies;
constructor(projectRoot: string, srcDirectory: string);
/**
* Determines if a component import is external (from node_modules) or internal - FIXED VERSION
*/
isExternalComponent(importPath: string, currentFilePath: string): boolean;
/**
* Checks if import path looks like an internal project path - UPDATED
*/
private looksLikeInternalPath;
/**
* Checks if an import is a Next.js built-in component - NEW METHOD
*/
private isNextJSBuiltIn;
/**
* Checks if an import is a React built-in import - NEW METHOD
*/
private isReactBuiltInImport;
/**
* Extracts the package name from an import path
*/
getPackageName(importPath: string): string;
/**
* Checks if a component reference is a native HTML element
*/
isNativeHTMLElement(componentName: string): boolean;
/**
* Checks if a component reference is a React built-in (Fragment, Suspense, etc.) - UPDATED
*/
isReactBuiltIn(componentName: string): boolean;
/**
* Determines if an import should be considered internal to the project
*/
isInternalImport(importPath: string, currentFilePath: string): boolean;
/**
* Resolves the full file path for an internal component
*/
resolveInternalComponentPath(importPath: string, currentFilePath: string): string | null;
/**
* Gets real external dependencies from import paths - NEW METHOD
*/
getRealExternalDependencies(importPaths: string[]): string[];
/**
* Private method to load dependencies from package.json
*/
private loadDependencies;
/**
* Private method to check if a package is listed in dependencies
*/
private isPackageDependency;
/**
* Private method to resolve import paths - ENHANCED
*/
private resolveImportPath;
/**
* Private method to check if a path is within the project source directory
*/
private isWithinProjectSource;
}