UNPKG

@context-sync/server

Version:

MCP server for AI context sync with persistent memory, workspace file access, and intelligent code operations

90 lines 2.36 kB
export interface ImportInfo { source: string; importedNames: string[]; defaultImport?: string; namespaceImport?: string; isExternal: boolean; line: number; rawStatement: string; } export interface ExportInfo { exportedNames: string[]; hasDefaultExport: boolean; line: number; rawStatement: string; } export interface DependencyGraph { filePath: string; imports: ImportInfo[]; exports: ExportInfo[]; importers: string[]; dependencies: string[]; circularDeps: CircularDependency[]; } export interface CircularDependency { cycle: string[]; description: string; } export interface DependencyTree { file: string; depth: number; imports: DependencyTree[]; isExternal: boolean; isCyclic?: boolean; } export declare class DependencyAnalyzer { private workspacePath; private fileCache; private dependencyCache; private fileWatcher; private readonly MAX_FILE_SIZE; private readonly WARN_FILE_SIZE; constructor(workspacePath: string); /** * Set up file watcher for cache invalidation */ private setupFileWatcher; /** * Invalidate caches for a specific file */ private invalidateCache; /** * Main method: Analyze all dependencies for a file */ analyzeDependencies(filePath: string): DependencyGraph; /** * Get all imports from a file */ getImports(filePath: string): ImportInfo[]; /** * Get all exports from a file */ getExports(filePath: string): ExportInfo[]; /** * Find all files that import the given file */ findImporters(filePath: string, maxFiles?: number): string[]; /** * Detect circular dependencies */ detectCircularDependencies(filePath: string): CircularDependency[]; /** * Get dependency tree with depth */ getDependencyTree(filePath: string, maxDepth?: number): DependencyTree; private readFile; private resolveFilePath; private getRelativePath; private isExternalModule; private resolveImportPath; private getAllProjectFiles; /** * Clear caches (useful for testing or when files change) */ clearCache(): void; /** * Dispose resources (cleanup file watcher) */ dispose(): void; } //# sourceMappingURL=dependency-analyzer.d.ts.map