t-comm
Version:
专业、稳定、纯粹的工具库
44 lines (43 loc) • 1.06 kB
TypeScript
/**
* 从 HTML 内容中提取入口 script/css 文件路径
* @param content HTML 文本内容
* @param domain 域名(如 https://cdn.example.com)
* @returns 入口文件路径列表
* @example
* ```ts
* const html = '<script src="https://cdn.example.com/static/js/app.js"></script>';
* getEntryFiles(html, 'https://cdn.example.com');
* // [
* // 'static/js/chunk-vendors.59912eed.js',
* // 'static/js/index.8ec239e5.js',
* // 'static/index.b0707a6a.css',
* // ]
* ```
* @ignore
*/
export declare function getEntryFiles(content: string, domain: string): string[];
/**
* 分析首页Bundle信息
*
* @export
* @param config 配置
* @param {string} config.domain 域名
* @param {string} config.buildPath 打包路径
* @returns {*}
*
* @example
* ```ts
* analyzeIndexBundle({
* domain: '',
* buildPath: '',
* })
* ```
*/
export declare function analyzeIndexBundle({ domain, buildPath }: {
domain: string;
buildPath: string;
}): ({
file: string;
size: number;
time: number;
} | undefined)[];