import { IStyleNode } from '@aiot-toolkit/parser'; import { ILog } from '@aiot-toolkit/shared-utils'; import { IFileLaneContext, IFileParam } from 'file-lane'; import { SourceFile } from 'ts-morph'; import IJavascriptCompileOption from '../../compiler/javascript/interface/IJavascriptCompileOption'; /** * UxLoaderUtils */ declare class UxLoaderUtils { static contenAccess: string; /** * 转换单个ux文件为js文件 * @param file ux文件内容 * @param context 文件所在项目上下文 * @param project * @returns */ static compileUxToJavascript(file: IFileParam, context: IFileLaneContext, isAppUx: boolean, compilerOption: IJavascriptCompileOption): Promise<{ files: IFileParam[]; logs: ILog[]; }>; /** * 转换app.ux文件为js文件 * @param file * @param resultFiles * @param context */ static compileAppUxToJavascript(file: IFileParam, context: IFileLaneContext, compileOption: IJavascriptCompileOption): Promise<{ files: IFileParam[]; logs: ILog[]; }>; /** * 判断是否为src/app.ux * @param filePath * @returns */ static isAppUx(filePath: string): boolean; /** * 判断是否为页面组件 * @param context * @param filePath * @returns */ static isPageUx(context: IFileLaneContext, filePath: string): boolean; /** * 获取app.ux的内容,且只返回script和style内容 * @param fileContent * @returns */ static getAppUxContent(fileContent: string): string; private static addTemplateProtobuf; /** * 给template增加外层包裹内容 * @param templateTree * @returns */ static wrapTempalte(templateTree: SourceFile, file: IFileParam, compilerOption: IJavascriptCompileOption): string; static wrapStyle(styleNodes: IStyleNode[], file: IFileParam, compilerOption: IJavascriptCompileOption): string; /** * 给script增加外层包裹内容 * @param isPageUx * @param appScriptTree * @returns */ static wrapScript(isPageUx: boolean, appScriptTree: SourceFile): string; static getReturnType(isPageUx: boolean): "$app_exports$['entry'] =" | "module.exports = "; } export default UxLoaderUtils;