/**
 * ATP Compiler Plugin API
 *
 * Extensible plugin system for custom transformations and detections
 */
import type { NodePath } from '@babel/traverse';
import type * as t from '@babel/types';
import type { CompilerConfig, DetectionResult, TransformMetadata, AsyncPattern } from '../types.js';
/**
 * Base plugin interface
 */
export interface CompilerPlugin {
    /**
     * Unique plugin name
     */
    name: string;
    /**
     * Plugin version (semver)
     */
    version: string;
    /**
     * Plugin priority (higher = runs first)
     * Built-in plugins: 100
     * User plugins: 50 (default)
     * Low priority: 10
     */
    priority?: number;
    /**
     * Plugin initialization (optional)
     * Called once when plugin is registered
     */
    initialize?(config: CompilerConfig): void | Promise<void>;
    /**
     * Plugin cleanup (optional)
     * Called when compiler is disposed
     */
    dispose?(): void | Promise<void>;
}
/**
 * Detection plugin - detects patterns that need transformation
 */
export interface DetectionPlugin extends CompilerPlugin {
    /**
     * Detect patterns in code
     */
    detect(code: string, ast: t.File): DetectionResult | Promise<DetectionResult>;
    /**
     * Custom async patterns this plugin can detect
     */
    patterns: AsyncPattern[];
}
/**
 * Transformation plugin - transforms AST nodes
 */
export interface TransformationPlugin extends CompilerPlugin {
    /**
     * Visitor pattern for AST traversal
     * Return visitor object compatible with @babel/traverse
     */
    getVisitor(config: CompilerConfig): BabelVisitor;
    /**
     * Get transformation metadata after transform
     */
    getMetadata(): Partial<TransformMetadata>;
    /**
     * Reset plugin state (called before each transform)
     */
    reset(): void;
}
/**
 * Optimizer plugin - optimizes transformed code
 */
export interface OptimizerPlugin extends CompilerPlugin {
    /**
     * Optimize AST after all transformations
     */
    optimize(ast: t.File, config: CompilerConfig): t.File | Promise<t.File>;
}
/**
 * Validator plugin - validates code before/after transformation
 */
export interface ValidatorPlugin extends CompilerPlugin {
    /**
     * Validate code (throw error if invalid)
     */
    validate(code: string, ast: t.File, phase: 'pre' | 'post'): void | Promise<void>;
}
/**
 * Babel visitor type (simplified)
 */
export interface BabelVisitor {
    [key: string]: (path: NodePath<any>) => void;
}
/**
 * Plugin context - shared state during transformation
 */
export interface PluginContext {
    config: CompilerConfig;
    executionId?: string;
    metadata: TransformMetadata;
    patterns: Set<AsyncPattern>;
}
/**
 * Plugin registry for managing plugins
 */
export declare class PluginRegistry {
    private detectors;
    private transformers;
    private optimizers;
    private validators;
    /**
     * Register a plugin
     */
    register(plugin: CompilerPlugin): void;
    /**
     * Find a plugin by name
     */
    findPlugin(name: string): CompilerPlugin | undefined;
    /**
     * Unregister a plugin by name
     */
    unregister(name: string): boolean;
    /**
     * Get all detection plugins
     */
    getDetectors(): DetectionPlugin[];
    /**
     * Get all transformation plugins
     */
    getTransformers(): TransformationPlugin[];
    /**
     * Get all optimizer plugins
     */
    getOptimizers(): OptimizerPlugin[];
    /**
     * Get all validator plugins
     */
    getValidators(): ValidatorPlugin[];
    /**
     * Initialize all plugins
     */
    initializeAll(config: CompilerConfig): Promise<void>;
    /**
     * Dispose all plugins
     */
    disposeAll(): Promise<void>;
    /**
     * Type guards
     */
    private isDetectionPlugin;
    private isTransformationPlugin;
    private isOptimizerPlugin;
    private isValidatorPlugin;
}
/**
 * Utility function to create a simple transformation plugin
 */
export declare function createTransformPlugin(config: {
    name: string;
    version: string;
    priority?: number;
    visitor: BabelVisitor;
    getMetadata?: () => Partial<TransformMetadata>;
}): TransformationPlugin;
//# sourceMappingURL=plugin-api.d.ts.map