UNPKG

1.95 kBTypeScriptView Raw
1import { Configuration, CacheFactory, ReducedConfiguration, Settings, DirectoryService, ConfigurationProvider } from '@fimbul/ymir';
2import { CachedFileSystem } from './cached-file-system';
3export declare class ConfigurationManager {
4 private directories;
5 private configProvider;
6 private fs;
7 private configCache;
8 constructor(directories: DirectoryService, configProvider: ConfigurationProvider, fs: CachedFileSystem, cache: CacheFactory);
9 /** Look up the location of the configuration file for the specified file name. */
10 findPath(file: string): string | undefined;
11 /** Load the configuration for the specified file. */
12 find(file: string): Configuration | undefined;
13 /** Load the given config from a local file if it exists or from the resolved path otherwise */
14 loadLocalOrResolved(pathOrName: string, basedir?: string): Configuration;
15 /**
16 * Resolve a configuration name to it's absolute path.
17 *
18 * @param name
19 * - name of a builtin config
20 * - package name in `node_modules` or a submodule thereof
21 * - absolute path
22 * - relative path starting with `./` or `../`
23 */
24 resolve(name: string, basedir: string): string;
25 /**
26 * Collects all matching configuration options for the given file. Flattens all base configs and matches overrides.
27 * Returns `undefined` if the file is excluded in one of the configuraton files.
28 */
29 reduce(config: Configuration, file: string): ReducedConfiguration | undefined;
30 /** Get the processor configuration for a given file. */
31 getProcessor(config: Configuration, fileName: string): string | undefined;
32 /** Get the settings for a given file. */
33 getSettings(config: Configuration, fileName: string): Settings;
34 /** Load a configuration from a resolved path using the ConfigurationProvider, recursively resolving and loading base configs. */
35 load(fileName: string): Configuration;
36}