/** * Config env-key detection via AST. The value-based config type generator * (`appTypes.ts`) renders each config's *runtime* shape — which is accurate for * everything that has a value at gen time, but a key read straight from the * environment with **no default** (`saltSecret: process.env.AUTH_SALT`) is * `undefined` then, so it gets dropped from the generated type and every read * needs an `as` cast. * * This module recovers exactly those keys by reading the config SOURCE: a bare * `process.env.X` is always `string | undefined` regardless of whether the var * happens to be set during codegen, so we can type it correctly without ever * importing the value. Keys that DO have a value at gen time (a literal, or * `process.env.X || default`) are left to the value-based pass — it already * types them, including the default's contribution. * * No runtime import (Mongoose/secrets never load); parsed with `oxc-parser`, * the same front-end the rest of codegen uses. * * Scope: only `process.env` reads written INLINE in a config's own default- * exported object literal are recovered. A key whose env read lives in a spread- * in base (`export default { ...frameworkConfig, … }`) or behind an indirection * (`const x = process.env.Y; export default { x }`) is not followed across that * boundary — it falls back to the value-based pass (i.e. dropped if `undefined` * at gen time, as before this feature). Inline reads cover the common case (a * project's own `apiKey: process.env.X`); cross-module spread resolution is * deliberately out of scope. */ /** * Env-derived key types for one config, mirroring its nesting. A string leaf is * the TypeScript type for that key (e.g. `'string | undefined'`); a nested * object is a sub-shape. */ export type EnvShape = { [key: string]: string | EnvShape; }; /** Extract the env-only key types from one config source file. Any read/parse * problem yields an empty shape — codegen then just falls back to value-based. */ export declare function extractConfigEnvShape(srcPath: string): Promise; /** Deep-merge the env shapes from a config's contributing files (default + * NODE_ENV override) with `deepmerge`: later sources win, nested shapes merge * key-wise — mirroring how the loader merges the values themselves. (Env shapes * only ever hold string leaves and nested objects, never arrays, so the loader's * array-replace option has nothing to apply to here.) */ export declare function mergeEnvShapes(shapes: EnvShape[]): EnvShape; /** Render an {@link EnvShape} as a standalone TS type — used when a whole * sub-object is env-only and absent from the runtime value. */ export declare function envShapeToType(shape: EnvShape): string;