mirror of
https://gitee.com/openharmony/developtools_ace_ets2bundle
synced 2024-11-27 18:50:57 +00:00
Signed-off-by: BoJiang <jiangbo91@huawei.com> Change-Id: I87eef7daa836007a169a94914627e5a8288815fc
This commit is contained in:
parent
c220935126
commit
e187c10281
@ -631,8 +631,8 @@ export function collectFileToIgnoreDiagnostics(rootFileNames: string[]): void {
|
||||
// In watch mode, the `beforeBuild` phase will clear the parent and children fields in the cache. For files that have
|
||||
// not been modified, the information needs to be restored using the `resolvedModuleNames` variable.
|
||||
if (process.env.watchMode === 'true') {
|
||||
for (let file of Object.keys(resolvedModulesCache)) {
|
||||
createOrUpdateCache(resolvedModulesCache[file], file);
|
||||
for (let [file, resolvedModules] of resolvedModulesCache) {
|
||||
createOrUpdateCache(resolvedModules, file);
|
||||
}
|
||||
}
|
||||
|
||||
@ -848,9 +848,9 @@ export const resolvedModulesCache: Map<string, ts.ResolvedModuleFull[]> = new Ma
|
||||
export function resolveModuleNames(moduleNames: string[], containingFile: string): ts.ResolvedModuleFull[] {
|
||||
startTimeStatisticsLocation(resolveModuleNamesTime);
|
||||
const resolvedModules: ts.ResolvedModuleFull[] = [];
|
||||
const cacheFileContent: ts.ResolvedModuleFull[] = resolvedModulesCache.get(path.resolve(containingFile));
|
||||
if (![...shouldResolvedFiles].length || shouldResolvedFiles.has(path.resolve(containingFile)) ||
|
||||
!(resolvedModulesCache[path.resolve(containingFile)] &&
|
||||
resolvedModulesCache[path.resolve(containingFile)].length === moduleNames.length)) {
|
||||
!(cacheFileContent && cacheFileContent.length === moduleNames.length)) {
|
||||
for (const moduleName of moduleNames) {
|
||||
const result = ts.resolveModuleName(moduleName, containingFile, compilerOptions, moduleResolutionHost);
|
||||
if (result.resolvedModule) {
|
||||
@ -948,12 +948,12 @@ export function resolveModuleNames(moduleNames: string[], containingFile: string
|
||||
if (!projectConfig.xtsMode) {
|
||||
createOrUpdateCache(resolvedModules, path.resolve(containingFile));
|
||||
}
|
||||
resolvedModulesCache[path.resolve(containingFile)] = resolvedModules;
|
||||
resolvedModulesCache.set(path.resolve(containingFile), resolvedModules);
|
||||
stopTimeStatisticsLocation(resolveModuleNamesTime);
|
||||
return resolvedModules;
|
||||
}
|
||||
stopTimeStatisticsLocation(resolveModuleNamesTime);
|
||||
return resolvedModulesCache[path.resolve(containingFile)];
|
||||
return resolvedModulesCache.get(path.resolve(containingFile));
|
||||
}
|
||||
|
||||
export interface ResolveModuleInfo {
|
||||
|
@ -921,7 +921,7 @@ function getFileNamesForScanningWhitelist(resolvedModulesCache: Map<string, ts.R
|
||||
}
|
||||
|
||||
keepFilesAndDependencies.add(filePath);
|
||||
const resolvedModules = resolvedModulesCache[path.resolve(filePath)];
|
||||
const resolvedModules = resolvedModulesCache.get(path.resolve(filePath));
|
||||
if (!resolvedModules) {
|
||||
continue;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user