Skip to content

ConfigFileSourceOptions

ConfigFileSourceOptions = object

Defined in: sources.ts:189

Options for configFileSource.

optional cwd?: string

Defined in: sources.ts:196

Directory to start the search from. Defaults to process.cwd().


optional extensions?: string[]

Defined in: sources.ts:201

Extensions to try, in priority order — first match wins. Defaults to ["ts", "js", "mjs", "cjs", "json"].


optional load?: ConfigFileLoader

Defined in: sources.ts:219

Custom loader for the discovered file. Receives the absolute path and returns the evaluated module (or its default export). Supply this to compile TypeScript/ESM on the fly (esbuild, jiti, …) so config-kit doesn’t hard-depend on a compiler. If it returns a module namespace, the default export is unwrapped automatically.

When omitted, the file is loaded with a native dynamic import() (and .json is read + parsed directly). That handles .js/.mjs/.cjs/ .json on any modern runtime; .ts needs a custom loader unless your runtime imports TypeScript natively.


name: string

Defined in: sources.ts:194

Base name of the config file. name: "app" looks for app.config.<ext>. Also used (prefixed) as the source’s diagnostic name.


optional searchParents?: boolean

Defined in: sources.ts:206

Walk up parent directories until a match is found (like how tools locate a config from a nested working directory). Defaults to true.