@layerfig/config
Version:
Layer and runtime-validate type-safe configs for JavaScript apps.
42 lines (41 loc) • 1.28 kB
TypeScript
import { ConfigParser, Source$1 as Source, defineConfigParser } from "./source-CJDueGqx.js";
import { z, z as z$1 } from "zod/v4";
//#region src/config-builder.d.ts
interface ConfigBuilderOptions<T extends object = Record<string, unknown>> {
/**
* A function to validate the configuration object.
* @param config - The configuration object to be validated
* @param z - The zod 4 instance
*/
validate: (config: Record<string, unknown>, z: typeof z$1) => T;
/**
* The folder where the configuration files are located.
* @default "./config"
*/
configFolder?: string;
/**
* Load source from different source types
*/
parser?: ConfigParser;
/**
* Prefix used to search for slotted values
* @default "$"
*/
slotPrefix?: string;
/**
* The runtime environment variables to use (e.g., process.env, import.env, etc.)
* @default process.env
*/
runtimeEnv?: {
[key: string]: string | undefined;
};
}
declare class ConfigBuilder<T extends object = Record<string, unknown>> {
#private;
constructor(options: ConfigBuilderOptions<T>);
build(): T;
addSource(source: Source): this;
}
//#endregion
export { ConfigBuilder, ConfigBuilderOptions, ConfigParser, defineConfigParser, z };
//# sourceMappingURL=index.d.ts.map