diff --git a/compiler/src/ets_checker.ts b/compiler/src/ets_checker.ts index a56cd183dfe26c695fc50a7f6c6cfcc859218070..71becdf93ad24b21c2668930c8330e98356253a2 100644 --- a/compiler/src/ets_checker.ts +++ b/compiler/src/ets_checker.ts @@ -772,7 +772,7 @@ function processBuildHap(cacheFile: string, rootFileNames: string[], parentEvent if ((/\.d\.e?ts$/).test(moduleFile)) { generateSourceFilesInHar(moduleFile, fs.readFileSync(moduleFile, 'utf-8'), path.extname(moduleFile), projectConfig, projectConfig.modulePathMap); - } else if ((/\.e?ts$/).test(moduleFile)) { + } else if ((/\.e?ts$/).test(moduleFile) && !toUnixPath(moduleFile).includes('/oh_modules/')) { emit = undefined; let sourcefile = globalProgram.program.getSourceFile(moduleFile); if (sourcefile) { @@ -790,8 +790,16 @@ function processBuildHap(cacheFile: string, rootFileNames: string[], parentEvent } function printDeclarationDiagnostics(errorCodeLogger?: Object | undefined): void { - globalProgram.builderProgram.getDeclarationDiagnostics().forEach((diagnostic: ts.Diagnostic) => { - printDiagnostic(diagnostic, ErrorCodeModule.TSC, errorCodeLogger); + globalProgram.program.getSourceFiles().forEach((sourceFile: ts.SourceFile) => { + if ((/\.d\.e?ts$/).test(sourceFile.fileName) || (/\.js$/).test(sourceFile.fileName)) { + return; + } + if (toUnixPath(sourceFile.fileName).includes('/oh_modules/')) { + return; + } + globalProgram.builderProgram.getDeclarationDiagnostics(sourceFile).forEach((diagnostic: ts.Diagnostic) => { + printDiagnostic(diagnostic, ErrorCodeModule.TSC, errorCodeLogger); + }); }); } diff --git a/compiler/src/interop/src/ets_checker.ts b/compiler/src/interop/src/ets_checker.ts index cf94e38281031a819f50d13aa3254f285718d9d6..9ac1b9d94ccf81af493bbce468d7046104051bc3 100644 --- a/compiler/src/interop/src/ets_checker.ts +++ b/compiler/src/interop/src/ets_checker.ts @@ -792,7 +792,7 @@ function processBuildHap(cacheFile: string, rootFileNames: string[], parentEvent if ((/\.d\.e?ts$/).test(moduleFile)) { generateSourceFilesInHar(moduleFile, fs.readFileSync(moduleFile, 'utf-8'), path.extname(moduleFile), projectConfig, projectConfig.modulePathMap); - } else if ((/\.e?ts$/).test(moduleFile)) { + } else if ((/\.e?ts$/).test(moduleFile) && !toUnixPath(moduleFile).includes('/oh_modules/')) { emit = undefined; let sourcefile = globalProgram.program.getSourceFile(moduleFile); if (sourcefile) { @@ -810,8 +810,16 @@ function processBuildHap(cacheFile: string, rootFileNames: string[], parentEvent } function printDeclarationDiagnostics(errorCodeLogger?: Object | undefined): void { - globalProgram.builderProgram.getDeclarationDiagnostics().forEach((diagnostic: ts.Diagnostic) => { - printDiagnostic(diagnostic, ErrorCodeModule.TSC, errorCodeLogger); + globalProgram.program.getSourceFiles().forEach((sourceFile: ts.SourceFile) => { + if ((/\.d\.e?ts$/).test(sourceFile.fileName) || (/\.js$/).test(sourceFile.fileName)) { + return; + } + if (toUnixPath(sourceFile.fileName).includes('/oh_modules/')) { + return; + } + globalProgram.builderProgram.getDeclarationDiagnostics(sourceFile).forEach((diagnostic: ts.Diagnostic) => { + printDiagnostic(diagnostic, ErrorCodeModule.TSC, errorCodeLogger); + }); }); }