import type { MicroserviceDefinition } from '../../../lib/runtime-web/types/microservice.types';
/**
 * Error class for microservice loading failures.
 */
export declare class MicroserviceLoadError extends Error {
    readonly cause?: Error | undefined;
    readonly hint?: string | undefined;
    constructor(message: string, cause?: Error | undefined, hint?: string | undefined);
}
/**
 * Configuration for MicroserviceLoader.
 */
export interface MicroserviceLoaderConfig {
    /** Path to the React entry point (e.g., 'src/index.tsx') */
    readonly reactEntry: string;
    /** Project root directory */
    readonly projectRoot: string;
    /** Enable verbose logging */
    readonly verbose?: boolean;
    /** Minify the bundle (default: true for hash consistency) */
    readonly minify?: boolean;
}
/**
 * Result of loading microservices.
 */
export interface MicroserviceLoadResult {
    /** Loaded microservice definitions */
    readonly microservices: Record<string, MicroserviceDefinition>;
    /** Number of microservices loaded */
    readonly count: number;
    /** Names of loaded microservices */
    readonly names: string[];
    /** Source file path */
    readonly sourcePath: string;
    /** Bundle file path (for debugging) */
    readonly bundlePath: string;
}
/**
 * Microservice Loader for Awake Lambda Development.
 *
 * Loads microservice definitions from the user's application entry point
 * by building it through esbuild with the SAME configuration as Lambda builds.
 * This ensures handler.toString() returns identical code, producing identical
 * hash keys for handler resolution.
 *
 * CRITICAL: The hash key is computed via hash32Base64Url(handler.toString()).
 * If the code is transpiled differently (tsx vs esbuild), the hash will differ.
 * This loader ensures consistency by using esbuild for both CDK/Lambda and Live Dev.
 *
 * @example
 * ```typescript
 * const loader = new MicroserviceLoader({
 *   reactEntry: 'src/index.tsx',
 *   projectRoot: process.cwd(),
 * });
 *
 * const result = await loader.load();
 * console.log('Loaded microservices:', result.names);
 * // Hash keys will match CDK/Lambda computed values
 * ```
 */
export declare class MicroserviceLoader {
    private readonly config;
    private bundleDir;
    constructor(config: MicroserviceLoaderConfig);
    /**
     * Load microservice definitions from the user's entry point.
     *
     * Builds the entry point through esbuild with Lambda-compatible settings,
     * then loads the bundle to extract microservice definitions.
     *
     * @returns Loaded microservice definitions
     * @throws MicroserviceLoadError if loading fails
     */
    load(): Promise<MicroserviceLoadResult>;
    /**
     * Build entry point through esbuild with Lambda-compatible settings.
     *
     * CRITICAL: Uses the SAME esbuild configuration as Lambda builds to ensure
     * handler.toString() returns identical code, producing identical hash keys.
     *
     * @param entryPath - Absolute path to entry point
     * @returns Path to the built bundle
     * @private
     */
    private buildEntryPoint;
    /**
     * Get external dependencies for esbuild.
     *
     * CRITICAL: @worktif/runtime is NOT externalized because we need runtimeThreads
     * to be populated inside the bundle when runtime({...}) is called.
     *
     * These are dependencies that should NOT be bundled because they:
     * - Are available in node_modules at runtime
     * - Contain native binaries (aws-crt)
     * - Are Node.js built-ins
     *
     * @returns Array of external package patterns
     * @private
     */
    private getExternals;
    /**
     * Clear require cache for the bundle.
     *
     * @param bundlePath - Path to the bundle file
     * @private
     */
    private clearRequireCache;
    /**
     * Clean up temporary bundle files.
     */
    cleanup(): void;
    /**
     * Log message if verbose mode is enabled.
     */
    private log;
}
/**
 * Load microservices from the user's entry point.
 *
 * Convenience function for loading microservices without creating a loader instance.
 * Uses esbuild bundling to ensure hash key consistency with Lambda/CDK.
 *
 * @param reactEntry - Path to the React entry point
 * @param projectRoot - Project root directory
 * @param verbose - Enable verbose logging
 * @returns Loaded microservice definitions
 */
export declare function loadMicroservices(reactEntry: string, projectRoot: string, verbose?: boolean): Promise<MicroserviceLoadResult>;
