@acot/module-loader
Version:
Load the module according to the naming rule of acot.
16 lines (15 loc) • 408 B
TypeScript
export declare type ModuleLoaderConfig = {
from: string;
cache: boolean;
};
export declare class ModuleLoader<T> {
private _prefix;
private _config;
private _cache;
constructor(prefix: string, config?: Partial<ModuleLoaderConfig>);
load(name: string): T;
tryLoad(name: string): T | null;
private _tryLoadFile;
private _tryLoadPackage;
private _setCacheIfNeeded;
}