UNPKG

@mondaydotcomorg/atp-compiler

Version:

Production-ready compiler for transforming async iteration patterns into resumable operations with checkpoint-based state management

61 lines 1.67 kB
/** * Core compiler interface for ATP * All ATP compilers must implement this interface to ensure consistency */ import type { DetectionResult, TransformResult } from '../types.js'; /** * ICompiler - The core interface that all ATP compilers must implement * * This interface defines the contract for any compiler in the ATP system, * enabling dependency injection and easy extensibility. * * @example * ```typescript * class MyCustomCompiler implements ICompiler { * detect(code: string): DetectionResult { * // Detection logic * } * * transform(code: string): TransformResult { * // Transformation logic * } * * getType(): string { * return 'MyCustomCompiler'; * } * } * ``` */ export interface ICompiler { /** * Detect if code needs transformation and what patterns it contains * Can be synchronous or asynchronous */ detect(code: string): DetectionResult | Promise<DetectionResult>; /** * Transform the code based on detected patterns * Can be synchronous or asynchronous */ transform(code: string): TransformResult | Promise<TransformResult>; /** * Get the compiler type identifier */ getType(): string; /** * Get cache statistics (optional) * Useful for performance monitoring and debugging */ getCacheStats?(): CacheStats | null; } /** * Cache statistics structure */ export interface CacheStats { size: number; enabled: boolean; } /** * Type guard to check if an object implements ICompiler */ export declare function isCompiler(obj: unknown): obj is ICompiler; //# sourceMappingURL=compiler-interface.d.ts.map