From 3b26bb41b2f1576055be4592fbbcf54608aa5f98 Mon Sep 17 00:00:00 2001 From: xucheng46 Date: Fri, 12 Jan 2024 19:13:48 +0800 Subject: [PATCH] add flag skip tsc oh_modules check Issue: https://gitee.com/openharmony/third_party_typescript/issues/I8VRMZ Test: tsc test Signed-off-by: xucheng46 Change-Id: I67bec385d128187942f4bb70b898b0c767053c79 --- compiler/main.js | 7 ++++++- compiler/src/ets_checker.ts | 9 +++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/compiler/main.js b/compiler/main.js index 1eb5424a..a7aed22f 100644 --- a/compiler/main.js +++ b/compiler/main.js @@ -840,10 +840,14 @@ function isPartialUpdate(metadata) { if (item.name === 'OPTLazyForEach' && item.value === 'true') { projectConfig.optLazyForEach = true; } + if (item.name === 'SkipTscOhModuleCheck' && item.value === 'true') { + partialUpdateConfig.skipTscOhModuleCheck = true; + } } return !partialUpdateConfig.partialUpdateMode && !partialUpdateConfig.builderCheck && !partialUpdateConfig.executeArkTSLinter && !partialUpdateConfig.standardArkTSLinter && - partialUpdateConfig.arkTSVersion !== undefined && projectConfig.optLazyForEach; + partialUpdateConfig.arkTSVersion !== undefined && projectConfig.optLazyForEach && + partialUpdateConfig.skipTscOhModuleCheck; }); } @@ -895,6 +899,7 @@ const partialUpdateConfig = { standardArkTSLinter: true, optimizeComponent: true, arkTSVersion: undefined, + skipTscOhModuleCheck: false, }; function resetMain() { diff --git a/compiler/src/ets_checker.ts b/compiler/src/ets_checker.ts index 5431ab4c..666733d4 100644 --- a/compiler/src/ets_checker.ts +++ b/compiler/src/ets_checker.ts @@ -134,9 +134,7 @@ const buildInfoWriteFile: ts.WriteFileCallback = (fileName: string, data: string export const compilerOptions: ts.CompilerOptions = ts.readConfigFile( path.resolve(__dirname, '../tsconfig.json'), ts.sys.readFile).config.compilerOptions; function setCompilerOptions(resolveModulePaths: string[]): void { - const allPath: Array = [ - '*' - ]; + const allPath: Array = ['*']; const basePath: string = path.resolve(projectConfig.projectPath); if (process.env.compileTool === 'rollup' && resolveModulePaths && resolveModulePaths.length) { resolveModulePaths.forEach((item: string) => { @@ -165,13 +163,12 @@ function setCompilerOptions(resolveModulePaths: string[]): void { 'paths': { '*': allPath }, - 'lib': [ - 'lib.es2020.d.ts' - ], + 'lib': ['lib.es2020.d.ts'], 'types': projectConfig.compilerTypes, 'etsLoaderPath': projectConfig.etsLoaderPath, 'needDoArkTsLinter': getArkTSLinterMode() !== ArkTSLinterMode.NOT_USE, 'isCompatibleVersion': getArkTSLinterMode() === ArkTSLinterMode.COMPATIBLE_MODE, + 'skipTscOhModuleCheck': partialUpdateConfig.skipTscOhModuleCheck, // options incremental && tsBuildInfoFile are required for applying incremental ability of typescript 'incremental': true, 'tsBuildInfoFile': path.resolve(projectConfig.cachePath, '..', TS_BUILD_INFO_SUFFIX) -- Gitee