/** * Import/Export Parser * * Parses source files to extract imports and exports. * Uses regex-based parsing for speed and simplicity. * Supports JavaScript/TypeScript, Python, and Java. */ /** * Information about an import statement */ export interface ImportInfo { source: string; isRelative: boolean; isPackage: boolean; isBuiltin: boolean; importedNames: string[]; hasDefault: boolean; hasNamespace: boolean; isTypeOnly: boolean; isDynamic: boolean; line: number; } /** * Information about an export statement */ export interface ExportInfo { name: string; isDefault: boolean; isType: boolean; isReExport: boolean; reExportSource?: string; kind: 'function' | 'class' | 'variable' | 'type' | 'interface' | 'enum' | 'unknown'; line: number; } /** * Complete analysis of a file's imports and exports */ export interface FileAnalysis { filePath: string; imports: ImportInfo[]; exports: ExportInfo[]; localImports: string[]; externalImports: string[]; parseErrors: string[]; /** Java package declaration (e.g. "com.example.service"), if this is a .java file */ javaPackage?: string; } /** * Options for import resolution */ export interface ResolveOptions { /** Base directory for resolving relative imports */ baseDir: string; /** TypeScript paths aliases (from tsconfig) */ pathAliases?: Record; /** File extensions to try when resolving */ extensions?: string[]; /** Java package declaration of the source file (used to locate source root) */ sourcePackage?: string; } /** * Parse imports from JavaScript/TypeScript content */ export declare function parseJSImports(content: string): ImportInfo[]; /** * Parse imports from Python content */ export declare function parsePythonImports(content: string): ImportInfo[]; /** * Extract the package declaration from Java source content. * Returns undefined for files without a package declaration (default package). */ export declare function parseJavaPackage(content: string): string | undefined; /** * Resolve a relative import to an absolute file path */ export declare function resolveImport(importSource: string, fromFile: string, options: ResolveOptions): Promise; /** * Import/Export Parser */ export declare class ImportExportParser { private cache; /** * Clear the parse cache */ clearCache(): void; /** * Get file extension type */ private getFileType; /** * Parse a file and extract imports/exports */ parseFile(filePath: string): Promise; /** * Parse multiple files */ parseFiles(filePaths: string[]): Promise>; } /** * Convenience function to parse a single file */ export declare function parseFile(filePath: string): Promise; /** * Convenience function to parse multiple files */ export declare function parseFiles(filePaths: string[]): Promise>; //# sourceMappingURL=import-parser.d.ts.map