///
import * as fs from 'fs';
import { loader } from 'herb-build-shared';
export declare const promisifyReadFile: typeof fs.readFile.__promisify__;
export declare const promisifyExists: typeof fs.exists.__promisify__;
export declare const promisifyStat: typeof fs.stat.__promisify__;
export declare const promisifyUnlink: typeof fs.unlink.__promisify__;
/**
* @description 替换文件名称的后缀
* @param filename 文件名
* @param ext 后缀, 默认为空 (即删除后缀)
*
* @example
* replaceExt('herb.html', 'js') // herb.js
* replaceExt('herb.html', '') // herb
*/
export declare const replaceExt: (filename: string, ext?: string) => string;
/**
* @description 判断多个路径的文件是否存在
* @param {string[]} paths
*/
export declare const filesExists: (paths: string[]) => Promise;
/**
* @description 根据后缀名 查找文件路径
* @param {string} path
* @param {string[]} exts
*/
export declare const getFilePathByExts: (context: loader.LoaderContext, filepath: string, exts: string[]) => Promise;
/**
* @description 判断 ts/js 文件是否存在
* @param context
* @param filename
* @returns 存在则返回文件路径, 否则返回 undefined
*/
export declare function getScriptFile(context: loader.LoaderContext, filename: string): Promise;
/**
* @description 加载 json 文件
* @param filename
* @returns 存在则返回文件路径, 否则返回 undefined
*/
export declare function getJsonFile(context: loader.LoaderContext, filename: string): Promise;
/**
* @description 获取入口文件
* @param context
* @param filename
*/
export declare function getEntryFile(context: loader.LoaderContext, filename: string): Promise;
/**
* @description 该文件是否存在以下后缀
* @param filename 文件名/文件完整路径
* @param exts 后缀列表
* @returns true/false
*/
export declare function oneOfExts(filename: string, exts: string[]): boolean;
/**
* @description 判断该文件路径是否属于文件夹
* @param filepath
* @returns true/false
*/
export declare function isDir(filepath: string): Promise;
export declare const addRequestQuery: (request: string, query: string) => string;
export declare const isRequestInProject: (request: string, rootdir: string) => boolean;
export declare const getPathSep: () => string;
export declare const getRelativePath: (from: string, to: string) => string;
export declare const formatRelativePath: (src: string) => string;
export declare const normalizePath: (filepath: string, dirname: string, rootdir: string, query?: string) => string;
export declare function replaceWin32Sep2PosixSep(str: string): string;
export declare const parsePathInJson: (context: loader.LoaderContext, filepath: string, rootdir: string, query?: string) => string;
export declare const parsePath2PackageInfo: (context: loader.LoaderContext, filepath: string, rootDir: string, ignoreNodeModules?: boolean) => Promise<{
isNpmPackage: boolean;
absPath?: undefined;
dirname?: undefined;
basename?: undefined;
} | {
absPath: string;
dirname: string;
basename: string;
isNpmPackage: boolean;
}>;
//# sourceMappingURL=file.d.ts.map