/**
 * Module Resolver Service
 *
 * Handles ES module-style import/export resolution for BattleScript.
 * Supports:
 * - Named imports with aliasing: import {foo, bar as baz} from "./module"
 * - Named exports: export {foo, bar} and export {foo as bar}
 * - Inline exports: export int a = 1;
 * - Re-exports: export {foo, bar} from "./other"
 * - Circular dependency resolution via static hoisting
 * - Module deduplication (diamond dependency pattern)
 */
import type { AstNode, RootNode } from "@/types";
/** Information about an exported symbol */
export interface ExportedSymbol {
    /** Name used locally in the module */
    localName: string;
    /** Name exposed for import */
    exportedName: string;
    /** The AST node being exported */
    node: AstNode;
    /** File path of the module that defines this export */
    moduleId: string;
    /** Whether this is a re-export from another module */
    isReExport: boolean;
    /** For re-exports, the source module path */
    reExportSource?: string;
}
/** Information about an imported symbol */
export interface ImportedSymbol {
    /** Name used in the importing module */
    localName: string;
    /** Name as exported from the source module */
    importedName: string;
    /** File path of the source module */
    sourceModule: string;
}
/** Complete information about a parsed module */
export interface ModuleInfo {
    /** Unique identifier (absolute file path) */
    id: string;
    /** Parsed AST of the module */
    ast: RootNode;
    /** Map of exported symbol names to their info */
    exports: Map<string, ExportedSymbol>;
    /** Map of local imported names to their info */
    imports: Map<string, ImportedSymbol>;
    /** Set of module IDs this module depends on */
    dependencies: Set<string>;
    /** Whether this module has been fully processed */
    processed: boolean;
    /** Whether this module is currently being processed (for cycle detection) */
    processing: boolean;
}
/** Options for the module resolver */
export interface ModuleResolverOptions {
    /** Entry module file path */
    entryPath: string;
    /** Function to resolve source code from a file path */
    sourceResolver: (filePath: string) => string;
    /** Function to parse source code into AST */
    parseSource: (source: string, filePath: string) => RootNode;
    /** Whether to include metadata */
    includeMetaData?: boolean;
}
/** Result of module resolution */
export interface ModuleResolutionResult {
    /** Flattened body with all modules merged */
    body: AstNode[];
    /** Map of module IDs to their info */
    modules: Map<string, ModuleInfo>;
    /** Order in which modules should be processed (topological sort) */
    moduleOrder: string[];
}
/**
 * Module Resolver
 *
 * Resolves ES module imports/exports and produces a flattened AST
 * with all dependencies merged in the correct order.
 */
export declare class ModuleResolver {
    private modules;
    private options;
    private moduleOrder;
    constructor(options: ModuleResolverOptions);
    /**
     * Resolve all modules starting from the entry point
     */
    resolve(): ModuleResolutionResult;
    /**
     * Build the module dependency graph by parsing all modules
     */
    private buildModuleGraph;
    /**
     * Extract export information from a module's AST
     */
    private extractExportsFromModule;
    /**
     * Extract import information from a module's AST
     */
    private extractImportsFromModule;
    /**
     * Resolve all re-exports to their actual source declarations
     */
    private resolveAllExports;
    /**
     * Resolve a re-export to its actual source declaration
     */
    private resolveReExport;
    /**
     * Topological sort of modules for correct ordering
     */
    private topologicalSort;
    /**
     * Flatten all modules into a single body array
     */
    private flattenModules;
    /**
     * Add module metadata to a node
     */
    private addModuleMetadata;
    /**
     * Check if a node is an exportable declaration type
     */
    private isExportableDeclaration;
    /**
     * Get the name of a declaration node
     */
    private getDeclarationName;
    /**
     * Find a local declaration by name in a module's AST
     */
    private findLocalDeclaration;
    /**
     * Resolve a relative import path to an absolute path
     */
    private resolveImportPath;
    /**
     * Validate that an imported symbol is actually exported
     */
    validateImport(importingModule: string, importedName: string, sourceModule: string): void;
    /**
     * Get the exported symbols from a module
     */
    getModuleExports(moduleId: string): Map<string, ExportedSymbol> | null;
}
/**
 * Helper function to resolve modules for a given entry point
 */
export declare function resolveModules(options: ModuleResolverOptions): ModuleResolutionResult;
//# sourceMappingURL=moduleResolver.d.ts.map