@eljs/utils
Version:
Collection of nodejs utility.
70 lines • 1.83 kB
TypeScript
import type { TranspileOptions } from 'typescript';
/**
* 默认异步加载器
*/
export declare const fileLoaders: Readonly<{
readonly '.mjs': typeof loadJs;
readonly '.cjs': typeof loadJs;
readonly '.js': typeof loadJs;
readonly '.ts': typeof loadTs;
readonly '.json': typeof loadJson;
readonly '.yaml': typeof loadYaml;
readonly '.yml': typeof loadYaml;
}>;
/**
* 默认同步加载器
*/
export declare const fileLoadersSync: Readonly<{
readonly '.cjs': typeof loadJsSync;
readonly '.js': typeof loadJsSync;
readonly '.ts': typeof loadTsSync;
readonly '.json': typeof loadJsonSync;
readonly '.yaml': typeof loadYamlSync;
readonly '.yml': typeof loadYamlSync;
}>;
/**
* 加载 js 文件
* @param path 文件路径
*/
export declare function loadJs<T>(path: string): Promise<T>;
/**
* 加载 js 文件
* @param path 文件路径
*/
export declare function loadJsSync<T>(path: string): T;
/**
* 加载 ts 文件
* @param path 文件路径
*/
export declare function loadTs<T = any>(path: string): Promise<T>;
/**
* 加载 ts 文件
* @param path 文件路径
*/
export declare function loadTsSync<T>(path: string): T;
/**
* 加载 json 文件
* @param path 文件路径
*/
export declare function loadJson<T>(path: string): Promise<T>;
/**
* 加载 json 文件
* @param path 文件路径
*/
export declare function loadJsonSync<T>(path: string): T;
/**
* 加载 yaml 文件
* @param path 文件路径
*/
export declare function loadYaml<T>(path: string): Promise<T>;
/**
* 加载 yaml 文件
* @param path 文件路径
*/
export declare function loadYamlSync<T>(path: string): T;
/**
* 解析 tsconfig 文件
* @param dir 文件夹
*/
export declare function resolveTsConfig(dir: string): TranspileOptions;
//# sourceMappingURL=loader.d.ts.map