UNPKG

@boost/config

Version:

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

36 lines 1.55 kB
import { Contract, Path, type PortablePath } from '@boost/common'; import { type Debugger } from '@boost/debug'; import { Cache } from './Cache'; import type { BaseFinderOptions, File } from './types'; export declare abstract class Finder<T extends File, Options extends BaseFinderOptions> extends Contract<Options> { protected readonly debug: Debugger; protected readonly cache: Cache; constructor(options: Options, cache: Cache); /** * Find the root directory by searching for a `.config` folder, * or a `*.config.*` file. Throw an error if none found. */ findRootDir(fromDir: PortablePath): Promise<Path>; /** * Traverse upwards from the branch directory, until the root directory is found, * or we reach to top of the file system. While traversing, find all files. */ loadFromBranchToRoot(dir: PortablePath): Promise<T[]>; /** * Load files from the root, determined by a relative `.config` folder * and `package.json` file. */ loadFromRoot(dir?: PortablePath): Promise<T[]>; /** * Return true if the path represents the root of the file system. */ protected isFileSystemRoot(path: Path): boolean; /** * Return true if the provided dir matches the root dir. */ protected isRootDir(dir: Path): boolean; abstract findFilesInDir(dir: Path): Promise<Path[]>; abstract getFileName(...args: unknown[]): string; abstract resolveFiles(basePath: Path, foundFiles: Path[]): Promise<T[]>; } //# sourceMappingURL=Finder.d.ts.map