/**
 * Configuration Parser
 *
 * Parsing and normalization logic for configurations.
 */
import type { Flow } from '@walkeros/core';
import type { BuildOptions, EnvironmentConfig } from '../types/bundle.js';
/**
 * Result of parsing bundle configuration.
 */
export interface ParsedConfig {
    flowConfig: Flow.Config;
    buildOptions: BuildOptions;
}
/**
 * Result of config structure parsing (before validation).
 */
export interface ParsedStructure {
    /** Raw flow config (not yet validated) */
    flowConfig: unknown;
    /** Raw build options (not yet validated) */
    buildOptions: unknown;
    /** Metadata about the config */
    metadata: {
        /** Selected environment name */
        environment: string;
        /** Whether this is a multi-environment setup */
        isMultiEnvironment: boolean;
        /** All available environment names (for multi-env setups) */
        availableEnvironments?: string[];
    };
}
/**
 * Options for parsing config structure.
 */
export interface ParseStructureOptions {
    /** Config file path (for error messages) */
    configPath?: string;
    /** Environment to select (for multi-env configs) */
    environment?: string;
}
/**
 * Parse config structure and extract environment-specific configuration.
 *
 * @param rawConfig - Raw configuration object
 * @param options - Parsing options
 * @returns Extracted flow config, build options, and metadata
 * @throws Error if config format is invalid or environment is missing
 *
 * @remarks
 * **Level 1 of 3-level config loading**:
 * - Detects multi-env vs single-env format
 * - Extracts the appropriate environment config
 * - No validation performed (happens in normalizeAndValidate)
 */
export declare function parseConfigStructure(rawConfig: unknown, options?: ParseStructureOptions): ParsedStructure;
/**
 * Normalize and validate flow and build configurations.
 *
 * @param flowConfig - Raw flow configuration
 * @param buildOptions - Raw build options
 * @param configPath - Path to config file (for relative template resolution)
 * @returns Validated and normalized configuration
 * @throws Error if validation fails
 *
 * @remarks
 * **Level 2 of 3-level config loading**:
 * - Validates platform (once!)
 * - Applies platform-specific defaults (single pass)
 * - Resolves relative template paths
 * - Ensures all required fields are present
 */
export declare function normalizeAndValidate(flowConfig: unknown, buildOptions: unknown, configPath?: string): ParsedConfig;
/**
 * Parse and normalize bundle configuration.
 *
 * @param data - Raw configuration data (EnvironmentConfig format: { flow, build })
 * @returns Normalized flowConfig and buildOptions with platform-specific defaults
 * @throws Error if validation fails
 *
 * @example
 * ```typescript
 * const { flowConfig, buildOptions } = parseBundleConfig({
 *   flow: {
 *     platform: 'web',
 *     sources: { browser: {...} },
 *     destinations: { gtag: {...} }
 *   },
 *   build: {
 *     packages: { '@walkeros/core': {...} },
 *     code: '...',
 *     output: './dist/bundle.js'
 *   }
 * });
 * ```
 */
export declare function parseBundleConfig(data: unknown): ParsedConfig;
/**
 * Safely parse bundle configuration without throwing.
 *
 * @param data - Raw configuration data
 * @returns Success result with normalized configs or error result
 */
export declare function safeParseBundleConfig(data: unknown): {
    success: boolean;
    data?: ParsedConfig;
    error?: Error;
};
/**
 * Normalize flow and build configurations with platform-specific defaults.
 *
 * @param config - Environment configuration or flow+build object
 * @param configPath - Path to config file (for relative template resolution)
 * @returns Normalized flow and build configurations
 *
 * @deprecated Use normalizeAndValidate() instead (simpler, single-pass validation)
 *
 * @remarks
 * Kept for backward compatibility. Internally delegates to normalizeAndValidate().
 */
export declare function normalizeConfigs(config: EnvironmentConfig | {
    flow: Flow.Config;
    build: Partial<BuildOptions>;
}, configPath?: string): {
    flowConfig: Flow.Config;
    buildOptions: BuildOptions;
};
//# sourceMappingURL=parser.d.ts.map