UNPKG

@paulohenriquevn/m2js

Version:

Transform TypeScript/JavaScript code into LLM-friendly Markdown summaries + Smart Dead Code Detection + Graph-Deep Diff Analysis. Extract exported functions, classes, and JSDoc comments for better AI context with 60%+ token reduction. Intelligent dead cod

82 lines (81 loc) 2.19 kB
/** * Performance Optimizer for M2JS Dead Code Analysis * Provides caching, parallelization, and memory optimization */ import { ExportInfo, ImportInfo } from './dead-code-types'; /** * Performance optimization options */ export interface PerformanceOptions { enableCache: boolean; maxCacheSize: number; chunkSize: number; showProgress: boolean; } /** * Progress callback function */ export type ProgressCallback = (processed: number, total: number, currentFile: string) => void; /** * Performance-optimized file processor */ export declare class OptimizedFileProcessor { private cache; private options; private cacheHits; private cacheMisses; constructor(options?: Partial<PerformanceOptions>); /** * Process files with optimization */ processFiles(files: string[], parseFunction: (filePath: string, content: string) => { exports: ExportInfo[]; imports: ImportInfo[]; }, progressCallback?: ProgressCallback): Promise<{ allExports: ExportInfo[]; allImports: ImportInfo[]; }>; /** * Get performance statistics */ getPerformanceStats(): { cacheHits: number; cacheMisses: number; hitRate: number; cacheSize: number; }; /** * Clear all caches */ clearCache(): void; } /** * Memory-optimized data structures */ export declare class OptimizedDataStructures { /** * Create efficient lookup map for imports */ static createImportLookupMap(imports: ImportInfo[]): Map<string, Set<string>>; /** * Efficient import path resolution with caching */ private static pathCache; private static resolveImportPath; /** * Batch process exports for dead code detection */ static findDeadExportsBatch(exports: ExportInfo[], importMap: Map<string, Set<string>>, batchSize?: number): ExportInfo[]; } /** * Progress indicator for CLI */ export declare class ProgressIndicator { private startTime; private lastUpdate; constructor(); /** * Update progress with throttling */ update(processed: number, total: number, currentFile: string): void; }