diff --git a/compiler/src/ets_checker.ts b/compiler/src/ets_checker.ts index a776891aff0647f992ca7f399558ea377c7a73eb..b1954455dbd2a44f86eec18a561108962f9c772e 100644 --- a/compiler/src/ets_checker.ts +++ b/compiler/src/ets_checker.ts @@ -46,7 +46,6 @@ import { ESMODULE, EXTNAME_D_ETS, EXTNAME_JS, - EXTNAME_ETS, FOREACH_LAZYFOREACH, COMPONENT_IF, TS_WATCH_END_MSG, @@ -110,7 +109,8 @@ import { } from './fast_build/ark_compiler/interop/process_arkts_evolution'; import { generateDeclarationFileForSTS, - isMixCompile, isRemoteModule + isMixCompile, + isRemoteModule } from './fast_build/ark_compiler/interop/interop_manager'; export interface LanguageServiceCache { @@ -148,6 +148,7 @@ const buildInfoWriteFile: ts.WriteFileCallback = (fileName: string, data: string fs.closeSync(fd); } }; + // The collection records the file name and the corresponding version, where the version is the hash value of the text in last compilation. const filesBuildInfo: Map = new Map(); @@ -357,7 +358,7 @@ let setHashValueByFilePath: Function | undefined = undefined; let getHashByFilePath: Function | undefined = undefined; export function createLanguageService(rootFileNames: string[], resolveModulePaths: string[], - parentEvent?: CompileEvent, rollupShareObject?: any): ts.LanguageService { + parentEvent?: CompileEvent, rollupShareObject?: Object): ts.LanguageService { setHashValueByFilePath = rollupShareObject?.setHashValueByFilePath; getHashByFilePath = rollupShareObject?.getHashByFilePath; setCompilerOptions(resolveModulePaths); @@ -370,12 +371,12 @@ export function createLanguageService(rootFileNames: string[], resolveModulePath } let fileContent: string = getFileContentWithHash(fileName); if (/(? = new Map(); export function resolveModuleNames(moduleNames: string[], containingFile: string): ts.ResolvedModuleFull[] { - ts.PerformanceDotting.startAdvanced('resolveModuleNames'); + ts.PerformanceDotting?.startAdvanced('resolveModuleNames'); const resolvedModules: ts.ResolvedModuleFull[] = []; const cacheFileContent: ts.ResolvedModuleFull[] = resolvedModulesCache.get(path.resolve(containingFile)); if (![...shouldResolvedFiles].length || shouldResolvedFiles.has(path.resolve(containingFile)) || @@ -1216,7 +1217,7 @@ export function resolveModuleNames(moduleNames: string[], containingFile: string const DETSModulePath: string = path.resolve(path.dirname(containingFile), /\.d\.ets$/.test(moduleName) ? moduleName : moduleName + EXTNAME_D_ETS); const arktsEvoDeclFilePath: string = isMixCompile() ? - getArkTSEvoDeclFilePath({ moduleRequest: moduleName, resolvedFileName: '' }) : ''; + getArkTSEvoDeclFilePath({ moduleRequest: moduleName, resolvedFileName: '' }) : ''; if (ts.sys.fileExists(modulePath)) { resolvedModules.push(getResolveModule(modulePath, '.d.ts')); } else if (ts.sys.fileExists(systemDETSModulePath)) { @@ -1264,10 +1265,10 @@ export function resolveModuleNames(moduleNames: string[], containingFile: string createOrUpdateCache(resolvedModules, path.resolve(containingFile)); } resolvedModulesCache.set(path.resolve(containingFile), resolvedModules); - ts.PerformanceDotting.stopAdvanced('resolveModuleNames'); + ts.PerformanceDotting?.stopAdvanced('resolveModuleNames'); return resolvedModules; } - ts.PerformanceDotting.stopAdvanced('resolveModuleNames'); + ts.PerformanceDotting?.stopAdvanced('resolveModuleNames'); return resolvedModulesCache.get(path.resolve(containingFile)); } @@ -1693,14 +1694,14 @@ export function runArkTSLinter(errorCodeLogger?: Object | undefined, parentEvent buildInfoWriteFile, errorCodeLogger); - ts.PerformanceDotting.startAdvanced('updateErrorFile'); + ts.PerformanceDotting?.startAdvanced('updateErrorFile'); if (process.env.watchMode !== 'true' && !projectConfig.xtsMode) { arkTSLinterDiagnostics.forEach((diagnostic: ts.Diagnostic) => { updateErrorFileCache(diagnostic); }); timePrinterInstance.appendTime(ts.TimePhase.UPDATE_ERROR_FILE); } - ts.PerformanceDotting.stopAdvanced('updateErrorFile'); + ts.PerformanceDotting?.stopAdvanced('updateErrorFile'); timePrinterInstance.printTimes(); ts.ArkTSLinterTimePrinter.destroyInstance(); } diff --git a/compiler/src/fast_build/ets_ui/rollup-plugin-ets-checker.ts b/compiler/src/fast_build/ets_ui/rollup-plugin-ets-checker.ts index e3f33e78d0528cba175108f60de6fa246d5a1a0e..031fce3a5830eeae23bd79504ce1dc70854bbbac 100644 --- a/compiler/src/fast_build/ets_ui/rollup-plugin-ets-checker.ts +++ b/compiler/src/fast_build/ets_ui/rollup-plugin-ets-checker.ts @@ -31,13 +31,11 @@ import { targetESVersionChanged, collectFileToIgnoreDiagnostics, TSC_SYSTEM_CODE, - traverseProgramSourceFiles, - arkTsEvolutionModuleMap, - cleanUpArkTsEvolutionModuleMap, + traverseProgramSourceFiles } from '../../ets_checker'; import { TS_WATCH_END_MSG } from '../../pre_define'; import { - setChecker, + setChecker } from '../../utils'; import { configureSyscapInfo, @@ -117,7 +115,7 @@ export function etsChecker() { } if (process.env.watchMode === 'true') { !executedOnce && serviceChecker(rootFileNames, logger, resolveModulePaths, eventServiceChecker, this.share); - ts.PerformanceDotting.startAdvanced('diagnostic'); + ts.PerformanceDotting?.startAdvanced('diagnostic'); if (executedOnce) { const timePrinterInstance = ts.ArkTSLinterTimePrinter.getInstance(); timePrinterInstance.setArkTSTimePrintSwitch(false); @@ -137,7 +135,7 @@ export function etsChecker() { const allDiagnostics: ts.Diagnostic[] = globalProgram.builderProgram .getSyntacticDiagnostics() .concat(globalProgram.builderProgram.getSemanticDiagnostics()); - ts.PerformanceDotting.stopAdvanced('diagnostic'); + ts.PerformanceDotting?.stopAdvanced('diagnostic'); emitBuildInfo(); let errorCodeLogger: Object | undefined = this.share?.getHvigorConsoleLogger ? this.share?.getHvigorConsoleLogger(TSC_SYSTEM_CODE) : undefined;