UNPKG

@boost/config

Version:

Powerful convention based finder, loader, and manager of both configuration and ignore files.

46 lines 2.38 kB
import { type PackageStructure, Path } from '@boost/common'; import type { Blueprint, Schemas } from '@boost/common/optimal'; import { Finder } from './Finder'; import type { ConfigFile, ConfigFinderOptions, FileSource, FileType } from './types'; export declare class ConfigFinder<T extends object> extends Finder<ConfigFile<T>, ConfigFinderOptions<T>> { blueprint(schemas: Schemas): Blueprint<ConfigFinderOptions<T>>; /** * Determine a files package scope by finding the first parent `package.json` * when traversing up directories. We will leverage the cache as much as * possible for performance. * * @see https://nodejs.org/api/esm.html#esm_package_scope_and_file_extensions */ determinePackageScope(dir: Path): Promise<PackageStructure>; /** * Find all configuration and environment specific files in a directory * by looping through all the defined extension options. * Will only search until the first file is found, and will not return multiple extensions. */ findFilesInDir(dir: Path): Promise<Path[]>; /** * Create and return a config file name, with optional branch and environment variants. */ getFileName(type: FileType, ext: string, isEnv: boolean): string; /** * Load file and package contents from a list of file paths. * Extract and apply extended and override configs based on the base path. */ resolveFiles(basePath: Path, foundFiles: Path[]): Promise<ConfigFile<T>[]>; /** * Extract a list of config files to extend, in order, from the list of previously loaded * config files, which is typically from the root. The list to extract can be located within * a property that matches the `extendsSetting` option. */ protected extractExtendedConfigs(configs: ConfigFile<T>[]): Promise<ConfigFile<T>[]>; /** * Extract all root config overrides that match the current path used to load with. * Overrides are located within a property that matches the `overridesSetting` option. */ protected extractOverriddenConfigs(basePath: Path, configs: ConfigFile<T>[]): ConfigFile<T>[]; /** * Load config contents from the provided file path using one of the defined loaders. */ protected loadConfig(path: Path, source?: FileSource): Promise<ConfigFile<T>>; } //# sourceMappingURL=ConfigFinder.d.ts.map