/**
 * @fileoverview OrdoJS Dead Code Eliminator - Comprehensive dead code elimination and optimization
 */
import { OptimizationError, type ComponentAST, type ExpressionNode, type StatementNode } from '../types/index.js';
/**
 * Dead code elimination options
 */
export interface DeadCodeEliminatorOptions {
    /**
     * Whether to perform aggressive tree shaking
     */
    aggressiveTreeShaking?: boolean;
    /**
     * Whether to inline small functions
     */
    inlineSmallFunctions?: boolean;
    /**
     * Maximum size (in AST nodes) for function inlining
     */
    maxInlineSize?: number;
    /**
     * Whether to remove unused variables
     */
    removeUnusedVariables?: boolean;
    /**
     * Whether to remove unreachable code
     */
    removeUnreachableCode?: boolean;
    /**
     * Whether to remove unused CSS rules
     */
    removeUnusedCSS?: boolean;
    /**
     * Whether to remove unused event handlers
     */
    removeUnusedEventHandlers?: boolean;
    /**
     * Whether to remove unused server functions
     */
    removeUnusedServerFunctions?: boolean;
    /**
     * Whether to perform constant folding
     */
    constantFolding?: boolean;
    /**
     * Whether to remove empty blocks
     */
    removeEmptyBlocks?: boolean;
}
/**
 * Usage analysis result
 */
export interface UsageAnalysis {
    usedVariables: Set<string>;
    usedFunctions: Set<string>;
    usedEventHandlers: Set<string>;
    usedCSSSelectors: Set<string>;
    usedServerFunctions: Set<string>;
    reachableStatements: Set<StatementNode>;
    constantExpressions: Map<ExpressionNode, any>;
}
/**
 * Dead code elimination result
 */
export interface DeadCodeEliminationResult {
    optimizedAST: ComponentAST;
    removedVariables: string[];
    removedFunctions: string[];
    removedEventHandlers: string[];
    removedCSSRules: string[];
    removedServerFunctions: string[];
    inlinedFunctions: string[];
    foldedConstants: number;
    removedEmptyBlocks: number;
    optimizationRatio: number;
    errors: OptimizationError[];
    warnings: OptimizationError[];
}
/**
 * Comprehensive dead code eliminator for OrdoJS components
 */
export declare class DeadCodeEliminator {
    private options;
    private usageAnalysis;
    private errors;
    private warnings;
    constructor(options?: Partial<DeadCodeEliminatorOptions>);
    /**
     * Optimize a component AST by removing dead code
     */
    optimize(ast: ComponentAST): ComponentAST;
    /**
     * Get optimization errors
     */
    getErrors(): OptimizationError[];
    /**
     * Get optimization warnings
     */
    getWarnings(): OptimizationError[];
    /**
     * Reset internal state
     */
    private reset;
    /**
     * Analyze usage patterns in the component
     */
    private analyzeUsage;
    /**
     * Analyze usage in client block
     */
    private analyzeClientBlockUsage;
    /**
     * Analyze usage in server block
     */
    private analyzeServerBlockUsage;
    /**
     * Analyze usage in markup block
     */
    private analyzeMarkupBlockUsage;
    /**
     * Analyze usage in HTML element
     */
    private analyzeHTMLElementUsage;
    /**
     * Analyze usage in style block
     */
    private analyzeStyleBlockUsage;
    /**
     * Analyze expression usage
     */
    private analyzeExpressionUsage;
    /**
     * Analyze statement usage
     */
    private analyzeStatementUsage;
    /**
     * Perform constant folding
     */
    private performConstantFolding;
    /**
     * Remove unused variables
     */
    private removeUnusedVariables;
    /**
     * Remove unused functions
     */
    private removeUnusedFunctions;
    /**
     * Remove unused event handlers
     */
    private removeUnusedEventHandlers;
    /**
     * Remove unused server functions
     */
    private removeUnusedServerFunctions;
    /**
     * Remove unreachable code
     */
    private removeUnreachableCode;
    /**
     * Inline small functions
     */
    private inlineSmallFunctions;
    /**
     * Check if a function should be inlined
     */
    private shouldInlineFunction;
    /**
     * Remove empty blocks
     */
    private removeEmptyBlocks;
    /**
     * Remove unused CSS rules
     */
    private removeUnusedCSSRules;
    /**
     * Apply transformation to all expressions in the AST
     */
    private applyExpressionTransformation;
}
//# sourceMappingURL=dead-code-eliminator.d.ts.map