diff --git a/compiler/src/process_component_constructor.ts b/compiler/src/process_component_constructor.ts index 9555249a29e3fbd7e48d779fa925473c6a557f44..d168aab370e949bd1a5ad20a6fc8306dabc9502f 100644 --- a/compiler/src/process_component_constructor.ts +++ b/compiler/src/process_component_constructor.ts @@ -114,7 +114,7 @@ function addParamsType(ctorNode: ts.ConstructorDeclaration, modifyPara: ts.Param break; } newTSPara.push(parameter); - }) + }); return newTSPara; } diff --git a/compiler/src/validate_ui_syntax.ts b/compiler/src/validate_ui_syntax.ts index 6a326f3e7c7ed66a6048b8784e45e487d1acecd1..6297738d0f417cba68e6d8a9976b716b2e9f9ff9 100644 --- a/compiler/src/validate_ui_syntax.ts +++ b/compiler/src/validate_ui_syntax.ts @@ -61,7 +61,7 @@ import { } from './utils'; import { projectConfig } from '../main'; import { collectExtend } from './process_ui_syntax'; -import { importModuleCollection } from "./ets_checker"; +import { importModuleCollection } from './ets_checker'; export interface ComponentCollection { entryComponent: string; @@ -704,12 +704,13 @@ export interface ReplaceResult { log: LogInfo[] } -export function sourceReplace(source: string, sourcePath: string): ReplaceResult { +export function sourceReplace(source: string, sourcePath: string, isUt:boolean = false +): ReplaceResult { let content: string = source; const log: LogInfo[] = []; content = preprocessExtend(content); // process @system. - content = processSystemApi(content); + content = processSystemApi(content, false, isUt); return { content: content, @@ -729,7 +730,8 @@ export function preprocessExtend(content: string, extendCollection?: Set }); } -export function processSystemApi(content: string, isProcessWhiteList: boolean = false): string { +export function processSystemApi(content: string, isProcessWhiteList: boolean = false, isUt:boolean = false +): string { let REG_SYSTEM: RegExp; if (isProcessWhiteList) { REG_SYSTEM = @@ -749,10 +751,10 @@ export function processSystemApi(content: string, isProcessWhiteList: boolean = let moduleType: string = item2 || item5; let systemKey: string = item3 || item6; let systemValue: string = item1 || item4; - if (!VALIDATE_MODULE.includes(systemValue)){ + if (!VALIDATE_MODULE.includes(systemValue)) { importModuleCollection.add(systemValue); } - if (!isProcessWhiteList) { + if (!isProcessWhiteList && !isUt) { return item; } else if (isProcessWhiteList) { systemValue = item2; diff --git a/compiler/test/test.js b/compiler/test/test.js index 99f5e2417daef7c30dfdfd472f52f1b23821834a..e0d910da8a20cd092719b4cb26ec961ea3b6892e 100644 --- a/compiler/test/test.js +++ b/compiler/test/test.js @@ -36,7 +36,7 @@ function expectActual(name, filePath) { const content = require(filePath); const source = content.source; process.env.compiler = BUILD_ON; - const afterProcess = sourceReplace(source); + const afterProcess = sourceReplace(source, filePath, true); validateUISyntax(source, afterProcess.content, `${name}.ts`); const compilerOptions = ts.readConfigFile( path.resolve(__dirname, '../tsconfig.json'), ts.sys.readFile).config.compilerOptions;