UNPKG

@nexe/config-manager

Version:

Nexe Config Manager - A flexible configuration management solution with multiple sources and hot reload support

57 lines 1.29 kB
import type { IConfigSource } from '../interfaces'; /** * JSON配置文件源 */ export declare class JsonConfigSource implements IConfigSource { private watchChanges; private filePath; private cache; private watcher; private callbacks; /** * @param filePath 配置文件路径 * @param watchChanges 是否监听文件变化 */ constructor(filePath: string, watchChanges?: boolean); /** * 从JSON文件加载配置 */ load(key?: string, _pathPrefix?: string): Promise<unknown>; /** * 获取配置源名称 */ getName(): string; /** * 是否支持热更新 */ supportsHotReload(): boolean; /** * 订阅配置变更 */ subscribe(key: string, callback: (value: unknown) => void): void; /** * 取消订阅配置变更 */ unsubscribe(key: string): void; /** * 设置文件变更监听器 */ private setupWatcher; /** * 处理文件变更 */ private handleFileChange; /** * 加载文件到缓存 */ private loadFile; /** * 获取嵌套对象的属性值 */ private getNestedValue; /** * 关闭资源 */ dispose(): void; } //# sourceMappingURL=json-config-source.d.ts.map