import { Runner, typescript as ts, UniversalifiedInputFileSystem } from '@morjs/utils'; import { CompilerUserConfig } from './constants'; /** * 获取用户 cwd 下的 tsconifg 文件地址 */ export declare function getTsConfigFile(): string | undefined; /** * 获取 ts 配置的 compilerOptions * @returns ts 配置的 compilerOptions */ export declare function loadUserTsCompilerOptions(): ts.CompilerOptions; export declare function extsToGlobPatterns(exts: string[] | readonly string[]): string; /** * 获取不包含后缀名的文件路径 * @param filePath - 文件路径 * @returns 不包含后缀名的文件路径 */ export declare function pathWithoutExtname(filePath: string): string; /** * 读取类 JSON 文件 * 支持 json、 jsonc、json5 三种格式 * @param fs - fs 实例 * @param filePath - 类 json 文件 * @returns json 文件内容 */ export declare function readJsonLike(fs: UniversalifiedInputFileSystem, filePath: string): Promise; /** * 解析类 JSON 内容 * 支持 json、 jsonc、json5 三种格式 * @param content - 文件内容 * @param extname - 后缀名 * @returns JSON 对象 */ export declare function parseJsonLike(content: string, extname: string): any; /** * 获取相对于 srcPaths 的路径 * - 优先匹配 包含 srcPath 的相对路径 * - 如果没有包含的,则使用第一个 srcPath 计算 相对路径 * @param filePath - 文件完整路径 * @param srcPaths - 自定义 srcPaths 目录 * @param showWarning - 是否显示告警信息 * @returns 相对路径 */ export declare function getRelativePathToSrcPaths(filePath: string, srcPaths: string[], showWarning?: boolean): string; /** * 判断是否需要插件处理文件,用于 loader 中的逻辑判断 * 1. 非 node_modules 文件总是处理 * 2. node_modules 文件基于逻辑判断是否处理 * @param filePath - 文件路径 * @param processNodeModules - 强制处理 * @param byDefault - 默认操作, 默认为 false */ export declare function shouldProcessFileByPlugins(filePath: string, processNodeModules: CompilerUserConfig['processNodeModules'], byDefault?: boolean): boolean; /** * 判断当前 runner 是否为 编译子 runner * @param runner - Runner 实例 * @returns `true` or `false` */ export declare function isChildCompilerRunner(runner: Runner): boolean; /** * 基于用户配置生成缓存文件 hash * @param userConfig - 用户配置 * @param prefixKeys - 缓存 key 前缀 * @returns 生成的 cache hash */ export declare function generateCacheFileHash(userConfig: Record, prefixKeys?: string[]): string;