import { type z } from '@frontmcp/lazy-zod'; /** * Parse a .env file content into key-value pairs. * Follows dotenv parsing rules: * - Supports KEY=value format * - Supports quoted values (single and double quotes) * - Supports # comments * - Trims whitespace * - Expands escape sequences in double-quoted values (\n, \r, \t) * * @param content - Raw content of a .env file * @returns Record of key-value pairs */ export declare function parseEnvContent(content: string): Record; /** * Load environment variables from .env files. * Follows NestJS-style priority: .env.local overrides .env * * @param basePath - Base directory to resolve files from * @param envPath - Path to base .env file (relative to basePath) * @param localEnvPath - Path to local override file (relative to basePath) * @returns Record of merged environment variables */ export declare function loadEnvFiles(basePath?: string, envPath?: string, localEnvPath?: string): Promise>; /** * Synchronously parse environment content. * Use this for CLI where async is not needed. */ export declare function parseEnvContentSync(content: string): Record; /** * Populate process.env with loaded values. * By default, does not override existing values. * * @param env - Environment variables to populate * @param override - Whether to override existing values (default: false) */ export declare function populateProcessEnv(env: Record, override?: boolean): void; /** * Convert a schema path to environment variable name. * Example: 'database.url' -> 'DATABASE_URL' */ export declare function pathToEnvKey(path: string): string; /** * Set a value at a nested path in an object. * Example: setNestedValue({}, 'database.url', 'x') -> { database: { url: 'x' } } * * @security Validates keys to prevent prototype pollution attacks. * Paths containing __proto__, constructor, or prototype are silently ignored. * Uses Object.create(null) for new nested objects to avoid prototype chain. */ export declare function setNestedValue(obj: Record, path: string, value: unknown): void; /** * Get a value from a nested path in an object. * Example: getNestedValue({ database: { url: 'x' } }, 'database.url') -> 'x' * * @security Validates keys to prevent prototype pollution attacks. * Paths containing __proto__, constructor, or prototype return undefined. */ export declare function getNestedValue(obj: Record, path: string): unknown; /** * Extract all leaf paths from a Zod schema. * Handles ZodDefault, ZodOptional, and other wrapper types. * * Example: z.object({ database: z.object({ url: z.string() }) }) -> ['database.url'] */ export declare function extractSchemaPaths(schema: z.ZodType, prefix?: string): string[]; /** * Map flat environment variables to nested config object. * Uses schema paths to determine which env vars to look for. * * @param env - Flat environment variables (e.g., { DATABASE_URL: '...' }) * @param paths - Schema paths to look for (e.g., ['database.url', 'database.port']) * @returns Nested config object */ export declare function mapEnvToNestedConfig(env: Record, paths: string[]): Record; //# sourceMappingURL=env-loader.d.ts.map