Update LKG

This commit is contained in:
TypeScript Bot 2020-08-13 06:22:57 +00:00
parent a1925515e2
commit f88f3065fa
6 changed files with 30 additions and 406 deletions

View File

@ -84088,7 +84088,6 @@ var ts;
var projectReferenceRedirects;
var mapFromFileToProjectReferenceRedirects;
var mapFromToProjectReferenceRedirectSource;
var skippedTrippleSlashReferences;
var useSourceOfProjectReferenceRedirect = !!((_a = host.useSourceOfProjectReferenceRedirect) === null || _a === void 0 ? void 0 : _a.call(host)) &&
!options.disableSourceOfProjectReferenceRedirect;
var _c = updateHostForUseSourceOfProjectReferenceRedirect({
@ -84194,7 +84193,6 @@ var ts;
getSourceFiles: function () { return files; },
getMissingFilePaths: function () { return missingFilePaths; },
getRefFileMap: function () { return refFileMap; },
getSkippedTrippleSlashReferences: function () { return skippedTrippleSlashReferences; },
getFilesByNameMap: function () { return filesByName; },
getCompilerOptions: function () { return options; },
getSyntacticDiagnostics: getSyntacticDiagnostics,
@ -84444,7 +84442,6 @@ var ts;
}
var oldSourceFiles = oldProgram.getSourceFiles();
var seenPackageNames = new ts.Map();
var oldSkippedTrippleSlashReferences = oldProgram.getSkippedTrippleSlashReferences();
for (var _i = 0, oldSourceFiles_2 = oldSourceFiles; _i < oldSourceFiles_2.length; _i++) {
var oldSourceFile = oldSourceFiles_2[_i];
var newSourceFile = host.getSourceFileByPath
@ -84494,9 +84491,6 @@ var ts;
if (!ts.arrayIsEqualTo(oldSourceFile.referencedFiles, newSourceFile.referencedFiles, fileReferenceIsEqualTo)) {
oldProgram.structureIsReused = 1;
}
if ((oldSkippedTrippleSlashReferences === null || oldSkippedTrippleSlashReferences === void 0 ? void 0 : oldSkippedTrippleSlashReferences.has(oldSourceFile.path)) && includeTripleslashReferencesFrom(newSourceFile)) {
oldProgram.structureIsReused = 1;
}
collectExternalModuleReferences(newSourceFile);
if (!ts.arrayIsEqualTo(oldSourceFile.imports, newSourceFile.imports, moduleNameIsEqualTo)) {
oldProgram.structureIsReused = 1;
@ -84565,7 +84559,6 @@ var ts;
}
missingFilePaths = oldProgram.getMissingFilePaths();
refFileMap = oldProgram.getRefFileMap();
skippedTrippleSlashReferences = oldSkippedTrippleSlashReferences;
ts.Debug.assert(newSourceFiles.length === oldProgram.getSourceFiles().length);
for (var _g = 0, newSourceFiles_1 = newSourceFiles; _g < newSourceFiles_1.length; _g++) {
var newSourceFile = newSourceFiles_1[_g];
@ -85488,14 +85481,7 @@ var ts;
}
return projectReferenceRedirects.get(projectReferencePath) || undefined;
}
function includeTripleslashReferencesFrom(file) {
return !host.includeTripleslashReferencesFrom || host.includeTripleslashReferencesFrom(file.originalFileName);
}
function processReferencedFiles(file, isDefaultLib) {
if (!includeTripleslashReferencesFrom(file)) {
(skippedTrippleSlashReferences || (skippedTrippleSlashReferences = new ts.Set())).add(file.path);
return;
}
ts.forEach(file.referencedFiles, function (ref, index) {
var referencedFileName = resolveTripleslashReference(ref.fileName, file.fileName);
processSourceFile(referencedFileName, isDefaultLib, false, undefined, {
@ -87552,20 +87538,7 @@ var ts;
return true;
}
ts.canWatchDirectory = canWatchDirectory;
var ResolutionKind;
(function (ResolutionKind) {
ResolutionKind[ResolutionKind["All"] = 0] = "All";
ResolutionKind[ResolutionKind["RelativeReferencesInOpenFileOnly"] = 1] = "RelativeReferencesInOpenFileOnly";
})(ResolutionKind = ts.ResolutionKind || (ts.ResolutionKind = {}));
var noResolveResolvedModule = {
resolvedModule: undefined,
failedLookupLocations: []
};
var noResolveResolvedTypeReferenceDirective = {
resolvedTypeReferenceDirective: undefined,
failedLookupLocations: []
};
function createResolutionCache(resolutionHost, rootDirForResolution, resolutionKind, logChangesWhenResolvingModule) {
function createResolutionCache(resolutionHost, rootDirForResolution, logChangesWhenResolvingModule) {
var filesWithChangedSetOfUnresolvedImports;
var filesWithInvalidatedResolutions;
var filesWithInvalidatedNonRelativeUnresolvedImports;
@ -87604,7 +87577,6 @@ var ts;
hasChangedAutomaticTypeDirectiveNames: function () { return hasChangedAutomaticTypeDirectiveNames; },
invalidateResolutionOfFile: invalidateResolutionOfFile,
invalidateResolutionsOfFailedLookupLocations: invalidateResolutionsOfFailedLookupLocations,
removeRelativeNoResolveResolutionsOfFile: removeRelativeNoResolveResolutionsOfFile,
setFilesWithInvalidatedNonRelativeUnresolvedImports: setFilesWithInvalidatedNonRelativeUnresolvedImports,
createHasInvalidatedResolution: createHasInvalidatedResolution,
updateTypeRootsWatch: updateTypeRootsWatch,
@ -87701,7 +87673,7 @@ var ts;
}
function resolveNamesWithLocalCache(_a) {
var _b;
var names = _a.names, containingFile = _a.containingFile, redirectedReference = _a.redirectedReference, cache = _a.cache, perDirectoryCacheWithRedirects = _a.perDirectoryCacheWithRedirects, loader = _a.loader, getResolutionWithResolvedFileName = _a.getResolutionWithResolvedFileName, noResolveResolution = _a.noResolveResolution, shouldRetryResolution = _a.shouldRetryResolution, reusedNames = _a.reusedNames, logChanges = _a.logChanges;
var names = _a.names, containingFile = _a.containingFile, redirectedReference = _a.redirectedReference, cache = _a.cache, perDirectoryCacheWithRedirects = _a.perDirectoryCacheWithRedirects, loader = _a.loader, getResolutionWithResolvedFileName = _a.getResolutionWithResolvedFileName, shouldRetryResolution = _a.shouldRetryResolution, reusedNames = _a.reusedNames, logChanges = _a.logChanges;
var path = resolutionHost.toPath(containingFile);
var resolutionsInFile = cache.get(path) || cache.set(path, new ts.Map()).get(path);
var dirPath = ts.getDirectoryPath(path);
@ -87732,10 +87704,7 @@ var ts;
resolution = resolutionInDirectory;
}
else {
resolution = resolutionKind === ResolutionKind.All ||
(ts.isExternalModuleNameRelative(name) && resolutionHost.fileIsOpen(path)) ?
loader(name, containingFile, compilerOptions, ((_b = resolutionHost.getCompilerHost) === null || _b === void 0 ? void 0 : _b.call(resolutionHost)) || resolutionHost, redirectedReference) :
noResolveResolution;
resolution = loader(name, containingFile, compilerOptions, ((_b = resolutionHost.getCompilerHost) === null || _b === void 0 ? void 0 : _b.call(resolutionHost)) || resolutionHost, redirectedReference);
perDirectoryResolution.set(name, resolution);
}
resolutionsInFile.set(name, resolution);
@ -87787,7 +87756,6 @@ var ts;
loader: ts.resolveTypeReferenceDirective,
getResolutionWithResolvedFileName: getResolvedTypeReferenceDirective,
shouldRetryResolution: function (resolution) { return resolution.resolvedTypeReferenceDirective === undefined; },
noResolveResolution: noResolveResolvedTypeReferenceDirective,
});
}
function resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference) {
@ -87802,7 +87770,6 @@ var ts;
shouldRetryResolution: function (resolution) { return !resolution.resolvedModule || !ts.resolutionExtensionIsTSOrJson(resolution.resolvedModule.extension); },
reusedNames: reusedNames,
logChanges: logChangesWhenResolvingModule,
noResolveResolution: noResolveResolvedModule,
});
}
function getResolvedModuleWithFailedLookupLocationsFromCache(moduleName, containingFile) {
@ -88036,25 +88003,6 @@ var ts;
resolutionHost.onChangedAutomaticTypeDirectiveNames();
}
}
function removeRelativeNoResolveResolutionsOfFileFromCache(cache, filePath, noResolveResolution) {
ts.Debug.assert(resolutionKind === ResolutionKind.RelativeReferencesInOpenFileOnly);
var resolutions = cache.get(filePath);
if (!resolutions)
return false;
var invalidated = false;
resolutions.forEach(function (resolution, name) {
if (resolution === noResolveResolution && ts.isExternalModuleNameRelative(name)) {
resolutions.delete(name);
invalidated = true;
}
});
return invalidated;
}
function removeRelativeNoResolveResolutionsOfFile(filePath) {
var invalidated = removeRelativeNoResolveResolutionsOfFileFromCache(resolvedModuleNames, filePath, noResolveResolvedModule);
invalidated = removeRelativeNoResolveResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath, noResolveResolvedTypeReferenceDirective) || invalidated;
return invalidated;
}
function setFilesWithInvalidatedNonRelativeUnresolvedImports(filesMap) {
ts.Debug.assert(filesWithInvalidatedNonRelativeUnresolvedImports === filesMap || filesWithInvalidatedNonRelativeUnresolvedImports === undefined);
filesWithInvalidatedNonRelativeUnresolvedImports = filesMap;
@ -89022,7 +88970,7 @@ var ts;
compilerHost.writeLog = writeLog;
var resolutionCache = ts.createResolutionCache(compilerHost, configFileName ?
ts.getDirectoryPath(ts.getNormalizedAbsolutePath(configFileName, currentDirectory)) :
currentDirectory, ts.ResolutionKind.All, false);
currentDirectory, false);
compilerHost.resolveModuleNames = host.resolveModuleNames ?
(function () {
var args = [];

View File

@ -102719,7 +102719,6 @@ var ts;
var projectReferenceRedirects;
var mapFromFileToProjectReferenceRedirects;
var mapFromToProjectReferenceRedirectSource;
var skippedTrippleSlashReferences;
var useSourceOfProjectReferenceRedirect = !!((_a = host.useSourceOfProjectReferenceRedirect) === null || _a === void 0 ? void 0 : _a.call(host)) &&
!options.disableSourceOfProjectReferenceRedirect;
var _c = updateHostForUseSourceOfProjectReferenceRedirect({
@ -102839,7 +102838,6 @@ var ts;
getSourceFiles: function () { return files; },
getMissingFilePaths: function () { return missingFilePaths; },
getRefFileMap: function () { return refFileMap; },
getSkippedTrippleSlashReferences: function () { return skippedTrippleSlashReferences; },
getFilesByNameMap: function () { return filesByName; },
getCompilerOptions: function () { return options; },
getSyntacticDiagnostics: getSyntacticDiagnostics,
@ -103153,7 +103151,6 @@ var ts;
SeenPackageName[SeenPackageName["Modified"] = 1] = "Modified";
})(SeenPackageName || (SeenPackageName = {}));
var seenPackageNames = new ts.Map();
var oldSkippedTrippleSlashReferences = oldProgram.getSkippedTrippleSlashReferences();
for (var _i = 0, oldSourceFiles_2 = oldSourceFiles; _i < oldSourceFiles_2.length; _i++) {
var oldSourceFile = oldSourceFiles_2[_i];
var newSourceFile = host.getSourceFileByPath
@ -103216,10 +103213,6 @@ var ts;
// tripleslash references has changed
oldProgram.structureIsReused = 1 /* SafeModules */;
}
if ((oldSkippedTrippleSlashReferences === null || oldSkippedTrippleSlashReferences === void 0 ? void 0 : oldSkippedTrippleSlashReferences.has(oldSourceFile.path)) && includeTripleslashReferencesFrom(newSourceFile)) {
// tripleslash reference resolution is now allowed
oldProgram.structureIsReused = 1 /* SafeModules */;
}
// check imports and module augmentations
collectExternalModuleReferences(newSourceFile);
if (!ts.arrayIsEqualTo(oldSourceFile.imports, newSourceFile.imports, moduleNameIsEqualTo)) {
@ -103301,7 +103294,6 @@ var ts;
}
missingFilePaths = oldProgram.getMissingFilePaths();
refFileMap = oldProgram.getRefFileMap();
skippedTrippleSlashReferences = oldSkippedTrippleSlashReferences;
// update fileName -> file mapping
ts.Debug.assert(newSourceFiles.length === oldProgram.getSourceFiles().length);
for (var _g = 0, newSourceFiles_1 = newSourceFiles; _g < newSourceFiles_1.length; _g++) {
@ -104340,14 +104332,7 @@ var ts;
}
return projectReferenceRedirects.get(projectReferencePath) || undefined;
}
function includeTripleslashReferencesFrom(file) {
return !host.includeTripleslashReferencesFrom || host.includeTripleslashReferencesFrom(file.originalFileName);
}
function processReferencedFiles(file, isDefaultLib) {
if (!includeTripleslashReferencesFrom(file)) {
(skippedTrippleSlashReferences || (skippedTrippleSlashReferences = new ts.Set())).add(file.path);
return;
}
ts.forEach(file.referencedFiles, function (ref, index) {
var referencedFileName = resolveTripleslashReference(ref.fileName, file.fileName);
processSourceFile(referencedFileName, isDefaultLib,
@ -106786,20 +106771,7 @@ var ts;
return true;
}
ts.canWatchDirectory = canWatchDirectory;
var ResolutionKind;
(function (ResolutionKind) {
ResolutionKind[ResolutionKind["All"] = 0] = "All";
ResolutionKind[ResolutionKind["RelativeReferencesInOpenFileOnly"] = 1] = "RelativeReferencesInOpenFileOnly";
})(ResolutionKind = ts.ResolutionKind || (ts.ResolutionKind = {}));
var noResolveResolvedModule = {
resolvedModule: undefined,
failedLookupLocations: []
};
var noResolveResolvedTypeReferenceDirective = {
resolvedTypeReferenceDirective: undefined,
failedLookupLocations: []
};
function createResolutionCache(resolutionHost, rootDirForResolution, resolutionKind, logChangesWhenResolvingModule) {
function createResolutionCache(resolutionHost, rootDirForResolution, logChangesWhenResolvingModule) {
var filesWithChangedSetOfUnresolvedImports;
var filesWithInvalidatedResolutions;
var filesWithInvalidatedNonRelativeUnresolvedImports;
@ -106850,7 +106822,6 @@ var ts;
hasChangedAutomaticTypeDirectiveNames: function () { return hasChangedAutomaticTypeDirectiveNames; },
invalidateResolutionOfFile: invalidateResolutionOfFile,
invalidateResolutionsOfFailedLookupLocations: invalidateResolutionsOfFailedLookupLocations,
removeRelativeNoResolveResolutionsOfFile: removeRelativeNoResolveResolutionsOfFile,
setFilesWithInvalidatedNonRelativeUnresolvedImports: setFilesWithInvalidatedNonRelativeUnresolvedImports,
createHasInvalidatedResolution: createHasInvalidatedResolution,
updateTypeRootsWatch: updateTypeRootsWatch,
@ -106958,7 +106929,7 @@ var ts;
}
function resolveNamesWithLocalCache(_a) {
var _b;
var names = _a.names, containingFile = _a.containingFile, redirectedReference = _a.redirectedReference, cache = _a.cache, perDirectoryCacheWithRedirects = _a.perDirectoryCacheWithRedirects, loader = _a.loader, getResolutionWithResolvedFileName = _a.getResolutionWithResolvedFileName, noResolveResolution = _a.noResolveResolution, shouldRetryResolution = _a.shouldRetryResolution, reusedNames = _a.reusedNames, logChanges = _a.logChanges;
var names = _a.names, containingFile = _a.containingFile, redirectedReference = _a.redirectedReference, cache = _a.cache, perDirectoryCacheWithRedirects = _a.perDirectoryCacheWithRedirects, loader = _a.loader, getResolutionWithResolvedFileName = _a.getResolutionWithResolvedFileName, shouldRetryResolution = _a.shouldRetryResolution, reusedNames = _a.reusedNames, logChanges = _a.logChanges;
var path = resolutionHost.toPath(containingFile);
var resolutionsInFile = cache.get(path) || cache.set(path, new ts.Map()).get(path);
var dirPath = ts.getDirectoryPath(path);
@ -106992,10 +106963,7 @@ var ts;
resolution = resolutionInDirectory;
}
else {
resolution = resolutionKind === ResolutionKind.All ||
(ts.isExternalModuleNameRelative(name) && resolutionHost.fileIsOpen(path)) ?
loader(name, containingFile, compilerOptions, ((_b = resolutionHost.getCompilerHost) === null || _b === void 0 ? void 0 : _b.call(resolutionHost)) || resolutionHost, redirectedReference) :
noResolveResolution;
resolution = loader(name, containingFile, compilerOptions, ((_b = resolutionHost.getCompilerHost) === null || _b === void 0 ? void 0 : _b.call(resolutionHost)) || resolutionHost, redirectedReference);
perDirectoryResolution.set(name, resolution);
}
resolutionsInFile.set(name, resolution);
@ -107049,7 +107017,6 @@ var ts;
loader: ts.resolveTypeReferenceDirective,
getResolutionWithResolvedFileName: getResolvedTypeReferenceDirective,
shouldRetryResolution: function (resolution) { return resolution.resolvedTypeReferenceDirective === undefined; },
noResolveResolution: noResolveResolvedTypeReferenceDirective,
});
}
function resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference) {
@ -107064,7 +107031,6 @@ var ts;
shouldRetryResolution: function (resolution) { return !resolution.resolvedModule || !ts.resolutionExtensionIsTSOrJson(resolution.resolvedModule.extension); },
reusedNames: reusedNames,
logChanges: logChangesWhenResolvingModule,
noResolveResolution: noResolveResolvedModule,
});
}
function getResolvedModuleWithFailedLookupLocationsFromCache(moduleName, containingFile) {
@ -107315,26 +107281,6 @@ var ts;
resolutionHost.onChangedAutomaticTypeDirectiveNames();
}
}
function removeRelativeNoResolveResolutionsOfFileFromCache(cache, filePath, noResolveResolution) {
ts.Debug.assert(resolutionKind === ResolutionKind.RelativeReferencesInOpenFileOnly);
// Deleted file, stop watching failed lookups for all the resolutions in the file
var resolutions = cache.get(filePath);
if (!resolutions)
return false;
var invalidated = false;
resolutions.forEach(function (resolution, name) {
if (resolution === noResolveResolution && ts.isExternalModuleNameRelative(name)) {
resolutions.delete(name);
invalidated = true;
}
});
return invalidated;
}
function removeRelativeNoResolveResolutionsOfFile(filePath) {
var invalidated = removeRelativeNoResolveResolutionsOfFileFromCache(resolvedModuleNames, filePath, noResolveResolvedModule);
invalidated = removeRelativeNoResolveResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath, noResolveResolvedTypeReferenceDirective) || invalidated;
return invalidated;
}
function setFilesWithInvalidatedNonRelativeUnresolvedImports(filesMap) {
ts.Debug.assert(filesWithInvalidatedNonRelativeUnresolvedImports === filesMap || filesWithInvalidatedNonRelativeUnresolvedImports === undefined);
filesWithInvalidatedNonRelativeUnresolvedImports = filesMap;
@ -108426,7 +108372,7 @@ var ts;
// Cache for the module resolution
var resolutionCache = ts.createResolutionCache(compilerHost, configFileName ?
ts.getDirectoryPath(ts.getNormalizedAbsolutePath(configFileName, currentDirectory)) :
currentDirectory, ts.ResolutionKind.All,
currentDirectory,
/*logChangesWhenResolvingModule*/ false);
// Resolve module using host module resolution strategy if provided otherwise use resolution cache to resolve module names
compilerHost.resolveModuleNames = host.resolveModuleNames ?
@ -143364,7 +143310,6 @@ var ts;
onReleaseOldSourceFile: onReleaseOldSourceFile,
hasInvalidatedResolution: hasInvalidatedResolution,
hasChangedAutomaticTypeDirectiveNames: hasChangedAutomaticTypeDirectiveNames,
includeTripleslashReferencesFrom: ts.maybeBind(host, host.includeTripleslashReferencesFrom),
trace: ts.maybeBind(host, host.trace),
resolveModuleNames: ts.maybeBind(host, host.resolveModuleNames),
resolveTypeReferenceDirectives: ts.maybeBind(host, host.resolveTypeReferenceDirectives),
@ -147620,6 +147565,7 @@ var ts;
break;
case ts.LanguageServiceMode.PartialSemantic:
this.languageServiceEnabled = true;
this.compilerOptions.noResolve = true;
this.compilerOptions.types = [];
break;
case ts.LanguageServiceMode.Syntactic:
@ -147640,7 +147586,7 @@ var ts;
}
this.realpath = ts.maybeBind(host, host.realpath);
// Use the current directory as resolution root only if the project created using current directory string
this.resolutionCache = ts.createResolutionCache(this, currentDirectory && this.currentDirectory, projectService.serverMode === ts.LanguageServiceMode.Semantic ? ts.ResolutionKind.All : ts.ResolutionKind.RelativeReferencesInOpenFileOnly,
this.resolutionCache = ts.createResolutionCache(this, currentDirectory && this.currentDirectory,
/*logChangesWhenResolvingModule*/ true);
this.languageService = ts.createLanguageService(this, this.documentRegistry, this.projectService.serverMode);
if (lastFileExceededProgramSize) {
@ -147792,19 +147738,6 @@ var ts;
Project.prototype.resolveTypeReferenceDirectives = function (typeDirectiveNames, containingFile, redirectedReference) {
return this.resolutionCache.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference);
};
/*@internal*/
Project.prototype.includeTripleslashReferencesFrom = function (containingFile) {
switch (this.projectService.serverMode) {
case ts.LanguageServiceMode.Semantic:
return true;
case ts.LanguageServiceMode.PartialSemantic:
return this.fileIsOpen(this.toPath(containingFile));
case ts.LanguageServiceMode.Syntactic:
return false;
default:
ts.Debug.assertNever(this.projectService.serverMode);
}
};
Project.prototype.directoryExists = function (path) {
return this.directoryStructureHost.directoryExists(path); // TODO: GH#18217
};
@ -151786,22 +151719,13 @@ var ts;
};
ProjectService.prototype.assignProjectToOpenedScriptInfo = function (info) {
var _this = this;
var _a;
var configFileName;
var configFileErrors;
var project = this.findExternalProjectContainingOpenScriptInfo(info);
var retainProjects;
var projectForConfigFileDiag;
var defaultConfigProjectIsCreated = false;
if (this.serverMode === ts.LanguageServiceMode.PartialSemantic) {
// Invalidate resolutions in the file since this file is now open
info.containingProjects.forEach(function (project) {
if (project.resolutionCache.removeRelativeNoResolveResolutionsOfFile(info.path)) {
project.markAsDirty();
}
});
}
else if (!project && this.serverMode === ts.LanguageServiceMode.Semantic) { // Checking semantic mode is an optimization
if (!project && this.serverMode === ts.LanguageServiceMode.Semantic) { // Checking semantic mode is an optimization
configFileName = this.getConfigFileNameForFile(info);
if (configFileName) {
project = this.findConfiguredProjectByProjectName(configFileName);
@ -151874,10 +151798,6 @@ var ts;
ts.Debug.assert(this.openFiles.has(info.path));
this.assignOrphanScriptInfoToInferredProject(info, this.openFiles.get(info.path));
}
else if (this.serverMode === ts.LanguageServiceMode.PartialSemantic && ((_a = info.cacheSourceFile) === null || _a === void 0 ? void 0 : _a.sourceFile.referencedFiles.length)) {
// This file was just opened and references in this file will previously not been resolved so schedule update
info.containingProjects.forEach(function (project) { return project.markAsDirty(); });
}
ts.Debug.assert(!info.isOrphan());
return { configFileName: configFileName, configFileErrors: configFileErrors, retainProjects: retainProjects };
};

View File

@ -102913,7 +102913,6 @@ var ts;
var projectReferenceRedirects;
var mapFromFileToProjectReferenceRedirects;
var mapFromToProjectReferenceRedirectSource;
var skippedTrippleSlashReferences;
var useSourceOfProjectReferenceRedirect = !!((_a = host.useSourceOfProjectReferenceRedirect) === null || _a === void 0 ? void 0 : _a.call(host)) &&
!options.disableSourceOfProjectReferenceRedirect;
var _c = updateHostForUseSourceOfProjectReferenceRedirect({
@ -103033,7 +103032,6 @@ var ts;
getSourceFiles: function () { return files; },
getMissingFilePaths: function () { return missingFilePaths; },
getRefFileMap: function () { return refFileMap; },
getSkippedTrippleSlashReferences: function () { return skippedTrippleSlashReferences; },
getFilesByNameMap: function () { return filesByName; },
getCompilerOptions: function () { return options; },
getSyntacticDiagnostics: getSyntacticDiagnostics,
@ -103347,7 +103345,6 @@ var ts;
SeenPackageName[SeenPackageName["Modified"] = 1] = "Modified";
})(SeenPackageName || (SeenPackageName = {}));
var seenPackageNames = new ts.Map();
var oldSkippedTrippleSlashReferences = oldProgram.getSkippedTrippleSlashReferences();
for (var _i = 0, oldSourceFiles_2 = oldSourceFiles; _i < oldSourceFiles_2.length; _i++) {
var oldSourceFile = oldSourceFiles_2[_i];
var newSourceFile = host.getSourceFileByPath
@ -103410,10 +103407,6 @@ var ts;
// tripleslash references has changed
oldProgram.structureIsReused = 1 /* SafeModules */;
}
if ((oldSkippedTrippleSlashReferences === null || oldSkippedTrippleSlashReferences === void 0 ? void 0 : oldSkippedTrippleSlashReferences.has(oldSourceFile.path)) && includeTripleslashReferencesFrom(newSourceFile)) {
// tripleslash reference resolution is now allowed
oldProgram.structureIsReused = 1 /* SafeModules */;
}
// check imports and module augmentations
collectExternalModuleReferences(newSourceFile);
if (!ts.arrayIsEqualTo(oldSourceFile.imports, newSourceFile.imports, moduleNameIsEqualTo)) {
@ -103495,7 +103488,6 @@ var ts;
}
missingFilePaths = oldProgram.getMissingFilePaths();
refFileMap = oldProgram.getRefFileMap();
skippedTrippleSlashReferences = oldSkippedTrippleSlashReferences;
// update fileName -> file mapping
ts.Debug.assert(newSourceFiles.length === oldProgram.getSourceFiles().length);
for (var _g = 0, newSourceFiles_1 = newSourceFiles; _g < newSourceFiles_1.length; _g++) {
@ -104534,14 +104526,7 @@ var ts;
}
return projectReferenceRedirects.get(projectReferencePath) || undefined;
}
function includeTripleslashReferencesFrom(file) {
return !host.includeTripleslashReferencesFrom || host.includeTripleslashReferencesFrom(file.originalFileName);
}
function processReferencedFiles(file, isDefaultLib) {
if (!includeTripleslashReferencesFrom(file)) {
(skippedTrippleSlashReferences || (skippedTrippleSlashReferences = new ts.Set())).add(file.path);
return;
}
ts.forEach(file.referencedFiles, function (ref, index) {
var referencedFileName = resolveTripleslashReference(ref.fileName, file.fileName);
processSourceFile(referencedFileName, isDefaultLib,
@ -106980,20 +106965,7 @@ var ts;
return true;
}
ts.canWatchDirectory = canWatchDirectory;
var ResolutionKind;
(function (ResolutionKind) {
ResolutionKind[ResolutionKind["All"] = 0] = "All";
ResolutionKind[ResolutionKind["RelativeReferencesInOpenFileOnly"] = 1] = "RelativeReferencesInOpenFileOnly";
})(ResolutionKind = ts.ResolutionKind || (ts.ResolutionKind = {}));
var noResolveResolvedModule = {
resolvedModule: undefined,
failedLookupLocations: []
};
var noResolveResolvedTypeReferenceDirective = {
resolvedTypeReferenceDirective: undefined,
failedLookupLocations: []
};
function createResolutionCache(resolutionHost, rootDirForResolution, resolutionKind, logChangesWhenResolvingModule) {
function createResolutionCache(resolutionHost, rootDirForResolution, logChangesWhenResolvingModule) {
var filesWithChangedSetOfUnresolvedImports;
var filesWithInvalidatedResolutions;
var filesWithInvalidatedNonRelativeUnresolvedImports;
@ -107044,7 +107016,6 @@ var ts;
hasChangedAutomaticTypeDirectiveNames: function () { return hasChangedAutomaticTypeDirectiveNames; },
invalidateResolutionOfFile: invalidateResolutionOfFile,
invalidateResolutionsOfFailedLookupLocations: invalidateResolutionsOfFailedLookupLocations,
removeRelativeNoResolveResolutionsOfFile: removeRelativeNoResolveResolutionsOfFile,
setFilesWithInvalidatedNonRelativeUnresolvedImports: setFilesWithInvalidatedNonRelativeUnresolvedImports,
createHasInvalidatedResolution: createHasInvalidatedResolution,
updateTypeRootsWatch: updateTypeRootsWatch,
@ -107152,7 +107123,7 @@ var ts;
}
function resolveNamesWithLocalCache(_a) {
var _b;
var names = _a.names, containingFile = _a.containingFile, redirectedReference = _a.redirectedReference, cache = _a.cache, perDirectoryCacheWithRedirects = _a.perDirectoryCacheWithRedirects, loader = _a.loader, getResolutionWithResolvedFileName = _a.getResolutionWithResolvedFileName, noResolveResolution = _a.noResolveResolution, shouldRetryResolution = _a.shouldRetryResolution, reusedNames = _a.reusedNames, logChanges = _a.logChanges;
var names = _a.names, containingFile = _a.containingFile, redirectedReference = _a.redirectedReference, cache = _a.cache, perDirectoryCacheWithRedirects = _a.perDirectoryCacheWithRedirects, loader = _a.loader, getResolutionWithResolvedFileName = _a.getResolutionWithResolvedFileName, shouldRetryResolution = _a.shouldRetryResolution, reusedNames = _a.reusedNames, logChanges = _a.logChanges;
var path = resolutionHost.toPath(containingFile);
var resolutionsInFile = cache.get(path) || cache.set(path, new ts.Map()).get(path);
var dirPath = ts.getDirectoryPath(path);
@ -107186,10 +107157,7 @@ var ts;
resolution = resolutionInDirectory;
}
else {
resolution = resolutionKind === ResolutionKind.All ||
(ts.isExternalModuleNameRelative(name) && resolutionHost.fileIsOpen(path)) ?
loader(name, containingFile, compilerOptions, ((_b = resolutionHost.getCompilerHost) === null || _b === void 0 ? void 0 : _b.call(resolutionHost)) || resolutionHost, redirectedReference) :
noResolveResolution;
resolution = loader(name, containingFile, compilerOptions, ((_b = resolutionHost.getCompilerHost) === null || _b === void 0 ? void 0 : _b.call(resolutionHost)) || resolutionHost, redirectedReference);
perDirectoryResolution.set(name, resolution);
}
resolutionsInFile.set(name, resolution);
@ -107243,7 +107211,6 @@ var ts;
loader: ts.resolveTypeReferenceDirective,
getResolutionWithResolvedFileName: getResolvedTypeReferenceDirective,
shouldRetryResolution: function (resolution) { return resolution.resolvedTypeReferenceDirective === undefined; },
noResolveResolution: noResolveResolvedTypeReferenceDirective,
});
}
function resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference) {
@ -107258,7 +107225,6 @@ var ts;
shouldRetryResolution: function (resolution) { return !resolution.resolvedModule || !ts.resolutionExtensionIsTSOrJson(resolution.resolvedModule.extension); },
reusedNames: reusedNames,
logChanges: logChangesWhenResolvingModule,
noResolveResolution: noResolveResolvedModule,
});
}
function getResolvedModuleWithFailedLookupLocationsFromCache(moduleName, containingFile) {
@ -107509,26 +107475,6 @@ var ts;
resolutionHost.onChangedAutomaticTypeDirectiveNames();
}
}
function removeRelativeNoResolveResolutionsOfFileFromCache(cache, filePath, noResolveResolution) {
ts.Debug.assert(resolutionKind === ResolutionKind.RelativeReferencesInOpenFileOnly);
// Deleted file, stop watching failed lookups for all the resolutions in the file
var resolutions = cache.get(filePath);
if (!resolutions)
return false;
var invalidated = false;
resolutions.forEach(function (resolution, name) {
if (resolution === noResolveResolution && ts.isExternalModuleNameRelative(name)) {
resolutions.delete(name);
invalidated = true;
}
});
return invalidated;
}
function removeRelativeNoResolveResolutionsOfFile(filePath) {
var invalidated = removeRelativeNoResolveResolutionsOfFileFromCache(resolvedModuleNames, filePath, noResolveResolvedModule);
invalidated = removeRelativeNoResolveResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath, noResolveResolvedTypeReferenceDirective) || invalidated;
return invalidated;
}
function setFilesWithInvalidatedNonRelativeUnresolvedImports(filesMap) {
ts.Debug.assert(filesWithInvalidatedNonRelativeUnresolvedImports === filesMap || filesWithInvalidatedNonRelativeUnresolvedImports === undefined);
filesWithInvalidatedNonRelativeUnresolvedImports = filesMap;
@ -108620,7 +108566,7 @@ var ts;
// Cache for the module resolution
var resolutionCache = ts.createResolutionCache(compilerHost, configFileName ?
ts.getDirectoryPath(ts.getNormalizedAbsolutePath(configFileName, currentDirectory)) :
currentDirectory, ts.ResolutionKind.All,
currentDirectory,
/*logChangesWhenResolvingModule*/ false);
// Resolve module using host module resolution strategy if provided otherwise use resolution cache to resolve module names
compilerHost.resolveModuleNames = host.resolveModuleNames ?
@ -143931,7 +143877,6 @@ var ts;
onReleaseOldSourceFile: onReleaseOldSourceFile,
hasInvalidatedResolution: hasInvalidatedResolution,
hasChangedAutomaticTypeDirectiveNames: hasChangedAutomaticTypeDirectiveNames,
includeTripleslashReferencesFrom: ts.maybeBind(host, host.includeTripleslashReferencesFrom),
trace: ts.maybeBind(host, host.trace),
resolveModuleNames: ts.maybeBind(host, host.resolveModuleNames),
resolveTypeReferenceDirectives: ts.maybeBind(host, host.resolveTypeReferenceDirectives),
@ -147814,6 +147759,7 @@ var ts;
break;
case ts.LanguageServiceMode.PartialSemantic:
this.languageServiceEnabled = true;
this.compilerOptions.noResolve = true;
this.compilerOptions.types = [];
break;
case ts.LanguageServiceMode.Syntactic:
@ -147834,7 +147780,7 @@ var ts;
}
this.realpath = ts.maybeBind(host, host.realpath);
// Use the current directory as resolution root only if the project created using current directory string
this.resolutionCache = ts.createResolutionCache(this, currentDirectory && this.currentDirectory, projectService.serverMode === ts.LanguageServiceMode.Semantic ? ts.ResolutionKind.All : ts.ResolutionKind.RelativeReferencesInOpenFileOnly,
this.resolutionCache = ts.createResolutionCache(this, currentDirectory && this.currentDirectory,
/*logChangesWhenResolvingModule*/ true);
this.languageService = ts.createLanguageService(this, this.documentRegistry, this.projectService.serverMode);
if (lastFileExceededProgramSize) {
@ -147986,19 +147932,6 @@ var ts;
Project.prototype.resolveTypeReferenceDirectives = function (typeDirectiveNames, containingFile, redirectedReference) {
return this.resolutionCache.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference);
};
/*@internal*/
Project.prototype.includeTripleslashReferencesFrom = function (containingFile) {
switch (this.projectService.serverMode) {
case ts.LanguageServiceMode.Semantic:
return true;
case ts.LanguageServiceMode.PartialSemantic:
return this.fileIsOpen(this.toPath(containingFile));
case ts.LanguageServiceMode.Syntactic:
return false;
default:
ts.Debug.assertNever(this.projectService.serverMode);
}
};
Project.prototype.directoryExists = function (path) {
return this.directoryStructureHost.directoryExists(path); // TODO: GH#18217
};
@ -151980,22 +151913,13 @@ var ts;
};
ProjectService.prototype.assignProjectToOpenedScriptInfo = function (info) {
var _this = this;
var _a;
var configFileName;
var configFileErrors;
var project = this.findExternalProjectContainingOpenScriptInfo(info);
var retainProjects;
var projectForConfigFileDiag;
var defaultConfigProjectIsCreated = false;
if (this.serverMode === ts.LanguageServiceMode.PartialSemantic) {
// Invalidate resolutions in the file since this file is now open
info.containingProjects.forEach(function (project) {
if (project.resolutionCache.removeRelativeNoResolveResolutionsOfFile(info.path)) {
project.markAsDirty();
}
});
}
else if (!project && this.serverMode === ts.LanguageServiceMode.Semantic) { // Checking semantic mode is an optimization
if (!project && this.serverMode === ts.LanguageServiceMode.Semantic) { // Checking semantic mode is an optimization
configFileName = this.getConfigFileNameForFile(info);
if (configFileName) {
project = this.findConfiguredProjectByProjectName(configFileName);
@ -152068,10 +151992,6 @@ var ts;
ts.Debug.assert(this.openFiles.has(info.path));
this.assignOrphanScriptInfoToInferredProject(info, this.openFiles.get(info.path));
}
else if (this.serverMode === ts.LanguageServiceMode.PartialSemantic && ((_a = info.cacheSourceFile) === null || _a === void 0 ? void 0 : _a.sourceFile.referencedFiles.length)) {
// This file was just opened and references in this file will previously not been resolved so schedule update
info.containingProjects.forEach(function (project) { return project.markAsDirty(); });
}
ts.Debug.assert(!info.isOrphan());
return { configFileName: configFileName, configFileErrors: configFileErrors, retainProjects: retainProjects };
};

View File

@ -102913,7 +102913,6 @@ var ts;
var projectReferenceRedirects;
var mapFromFileToProjectReferenceRedirects;
var mapFromToProjectReferenceRedirectSource;
var skippedTrippleSlashReferences;
var useSourceOfProjectReferenceRedirect = !!((_a = host.useSourceOfProjectReferenceRedirect) === null || _a === void 0 ? void 0 : _a.call(host)) &&
!options.disableSourceOfProjectReferenceRedirect;
var _c = updateHostForUseSourceOfProjectReferenceRedirect({
@ -103033,7 +103032,6 @@ var ts;
getSourceFiles: function () { return files; },
getMissingFilePaths: function () { return missingFilePaths; },
getRefFileMap: function () { return refFileMap; },
getSkippedTrippleSlashReferences: function () { return skippedTrippleSlashReferences; },
getFilesByNameMap: function () { return filesByName; },
getCompilerOptions: function () { return options; },
getSyntacticDiagnostics: getSyntacticDiagnostics,
@ -103347,7 +103345,6 @@ var ts;
SeenPackageName[SeenPackageName["Modified"] = 1] = "Modified";
})(SeenPackageName || (SeenPackageName = {}));
var seenPackageNames = new ts.Map();
var oldSkippedTrippleSlashReferences = oldProgram.getSkippedTrippleSlashReferences();
for (var _i = 0, oldSourceFiles_2 = oldSourceFiles; _i < oldSourceFiles_2.length; _i++) {
var oldSourceFile = oldSourceFiles_2[_i];
var newSourceFile = host.getSourceFileByPath
@ -103410,10 +103407,6 @@ var ts;
// tripleslash references has changed
oldProgram.structureIsReused = 1 /* SafeModules */;
}
if ((oldSkippedTrippleSlashReferences === null || oldSkippedTrippleSlashReferences === void 0 ? void 0 : oldSkippedTrippleSlashReferences.has(oldSourceFile.path)) && includeTripleslashReferencesFrom(newSourceFile)) {
// tripleslash reference resolution is now allowed
oldProgram.structureIsReused = 1 /* SafeModules */;
}
// check imports and module augmentations
collectExternalModuleReferences(newSourceFile);
if (!ts.arrayIsEqualTo(oldSourceFile.imports, newSourceFile.imports, moduleNameIsEqualTo)) {
@ -103495,7 +103488,6 @@ var ts;
}
missingFilePaths = oldProgram.getMissingFilePaths();
refFileMap = oldProgram.getRefFileMap();
skippedTrippleSlashReferences = oldSkippedTrippleSlashReferences;
// update fileName -> file mapping
ts.Debug.assert(newSourceFiles.length === oldProgram.getSourceFiles().length);
for (var _g = 0, newSourceFiles_1 = newSourceFiles; _g < newSourceFiles_1.length; _g++) {
@ -104534,14 +104526,7 @@ var ts;
}
return projectReferenceRedirects.get(projectReferencePath) || undefined;
}
function includeTripleslashReferencesFrom(file) {
return !host.includeTripleslashReferencesFrom || host.includeTripleslashReferencesFrom(file.originalFileName);
}
function processReferencedFiles(file, isDefaultLib) {
if (!includeTripleslashReferencesFrom(file)) {
(skippedTrippleSlashReferences || (skippedTrippleSlashReferences = new ts.Set())).add(file.path);
return;
}
ts.forEach(file.referencedFiles, function (ref, index) {
var referencedFileName = resolveTripleslashReference(ref.fileName, file.fileName);
processSourceFile(referencedFileName, isDefaultLib,
@ -106980,20 +106965,7 @@ var ts;
return true;
}
ts.canWatchDirectory = canWatchDirectory;
var ResolutionKind;
(function (ResolutionKind) {
ResolutionKind[ResolutionKind["All"] = 0] = "All";
ResolutionKind[ResolutionKind["RelativeReferencesInOpenFileOnly"] = 1] = "RelativeReferencesInOpenFileOnly";
})(ResolutionKind = ts.ResolutionKind || (ts.ResolutionKind = {}));
var noResolveResolvedModule = {
resolvedModule: undefined,
failedLookupLocations: []
};
var noResolveResolvedTypeReferenceDirective = {
resolvedTypeReferenceDirective: undefined,
failedLookupLocations: []
};
function createResolutionCache(resolutionHost, rootDirForResolution, resolutionKind, logChangesWhenResolvingModule) {
function createResolutionCache(resolutionHost, rootDirForResolution, logChangesWhenResolvingModule) {
var filesWithChangedSetOfUnresolvedImports;
var filesWithInvalidatedResolutions;
var filesWithInvalidatedNonRelativeUnresolvedImports;
@ -107044,7 +107016,6 @@ var ts;
hasChangedAutomaticTypeDirectiveNames: function () { return hasChangedAutomaticTypeDirectiveNames; },
invalidateResolutionOfFile: invalidateResolutionOfFile,
invalidateResolutionsOfFailedLookupLocations: invalidateResolutionsOfFailedLookupLocations,
removeRelativeNoResolveResolutionsOfFile: removeRelativeNoResolveResolutionsOfFile,
setFilesWithInvalidatedNonRelativeUnresolvedImports: setFilesWithInvalidatedNonRelativeUnresolvedImports,
createHasInvalidatedResolution: createHasInvalidatedResolution,
updateTypeRootsWatch: updateTypeRootsWatch,
@ -107152,7 +107123,7 @@ var ts;
}
function resolveNamesWithLocalCache(_a) {
var _b;
var names = _a.names, containingFile = _a.containingFile, redirectedReference = _a.redirectedReference, cache = _a.cache, perDirectoryCacheWithRedirects = _a.perDirectoryCacheWithRedirects, loader = _a.loader, getResolutionWithResolvedFileName = _a.getResolutionWithResolvedFileName, noResolveResolution = _a.noResolveResolution, shouldRetryResolution = _a.shouldRetryResolution, reusedNames = _a.reusedNames, logChanges = _a.logChanges;
var names = _a.names, containingFile = _a.containingFile, redirectedReference = _a.redirectedReference, cache = _a.cache, perDirectoryCacheWithRedirects = _a.perDirectoryCacheWithRedirects, loader = _a.loader, getResolutionWithResolvedFileName = _a.getResolutionWithResolvedFileName, shouldRetryResolution = _a.shouldRetryResolution, reusedNames = _a.reusedNames, logChanges = _a.logChanges;
var path = resolutionHost.toPath(containingFile);
var resolutionsInFile = cache.get(path) || cache.set(path, new ts.Map()).get(path);
var dirPath = ts.getDirectoryPath(path);
@ -107186,10 +107157,7 @@ var ts;
resolution = resolutionInDirectory;
}
else {
resolution = resolutionKind === ResolutionKind.All ||
(ts.isExternalModuleNameRelative(name) && resolutionHost.fileIsOpen(path)) ?
loader(name, containingFile, compilerOptions, ((_b = resolutionHost.getCompilerHost) === null || _b === void 0 ? void 0 : _b.call(resolutionHost)) || resolutionHost, redirectedReference) :
noResolveResolution;
resolution = loader(name, containingFile, compilerOptions, ((_b = resolutionHost.getCompilerHost) === null || _b === void 0 ? void 0 : _b.call(resolutionHost)) || resolutionHost, redirectedReference);
perDirectoryResolution.set(name, resolution);
}
resolutionsInFile.set(name, resolution);
@ -107243,7 +107211,6 @@ var ts;
loader: ts.resolveTypeReferenceDirective,
getResolutionWithResolvedFileName: getResolvedTypeReferenceDirective,
shouldRetryResolution: function (resolution) { return resolution.resolvedTypeReferenceDirective === undefined; },
noResolveResolution: noResolveResolvedTypeReferenceDirective,
});
}
function resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference) {
@ -107258,7 +107225,6 @@ var ts;
shouldRetryResolution: function (resolution) { return !resolution.resolvedModule || !ts.resolutionExtensionIsTSOrJson(resolution.resolvedModule.extension); },
reusedNames: reusedNames,
logChanges: logChangesWhenResolvingModule,
noResolveResolution: noResolveResolvedModule,
});
}
function getResolvedModuleWithFailedLookupLocationsFromCache(moduleName, containingFile) {
@ -107509,26 +107475,6 @@ var ts;
resolutionHost.onChangedAutomaticTypeDirectiveNames();
}
}
function removeRelativeNoResolveResolutionsOfFileFromCache(cache, filePath, noResolveResolution) {
ts.Debug.assert(resolutionKind === ResolutionKind.RelativeReferencesInOpenFileOnly);
// Deleted file, stop watching failed lookups for all the resolutions in the file
var resolutions = cache.get(filePath);
if (!resolutions)
return false;
var invalidated = false;
resolutions.forEach(function (resolution, name) {
if (resolution === noResolveResolution && ts.isExternalModuleNameRelative(name)) {
resolutions.delete(name);
invalidated = true;
}
});
return invalidated;
}
function removeRelativeNoResolveResolutionsOfFile(filePath) {
var invalidated = removeRelativeNoResolveResolutionsOfFileFromCache(resolvedModuleNames, filePath, noResolveResolvedModule);
invalidated = removeRelativeNoResolveResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath, noResolveResolvedTypeReferenceDirective) || invalidated;
return invalidated;
}
function setFilesWithInvalidatedNonRelativeUnresolvedImports(filesMap) {
ts.Debug.assert(filesWithInvalidatedNonRelativeUnresolvedImports === filesMap || filesWithInvalidatedNonRelativeUnresolvedImports === undefined);
filesWithInvalidatedNonRelativeUnresolvedImports = filesMap;
@ -108620,7 +108566,7 @@ var ts;
// Cache for the module resolution
var resolutionCache = ts.createResolutionCache(compilerHost, configFileName ?
ts.getDirectoryPath(ts.getNormalizedAbsolutePath(configFileName, currentDirectory)) :
currentDirectory, ts.ResolutionKind.All,
currentDirectory,
/*logChangesWhenResolvingModule*/ false);
// Resolve module using host module resolution strategy if provided otherwise use resolution cache to resolve module names
compilerHost.resolveModuleNames = host.resolveModuleNames ?
@ -143931,7 +143877,6 @@ var ts;
onReleaseOldSourceFile: onReleaseOldSourceFile,
hasInvalidatedResolution: hasInvalidatedResolution,
hasChangedAutomaticTypeDirectiveNames: hasChangedAutomaticTypeDirectiveNames,
includeTripleslashReferencesFrom: ts.maybeBind(host, host.includeTripleslashReferencesFrom),
trace: ts.maybeBind(host, host.trace),
resolveModuleNames: ts.maybeBind(host, host.resolveModuleNames),
resolveTypeReferenceDirectives: ts.maybeBind(host, host.resolveTypeReferenceDirectives),

View File

@ -102913,7 +102913,6 @@ var ts;
var projectReferenceRedirects;
var mapFromFileToProjectReferenceRedirects;
var mapFromToProjectReferenceRedirectSource;
var skippedTrippleSlashReferences;
var useSourceOfProjectReferenceRedirect = !!((_a = host.useSourceOfProjectReferenceRedirect) === null || _a === void 0 ? void 0 : _a.call(host)) &&
!options.disableSourceOfProjectReferenceRedirect;
var _c = updateHostForUseSourceOfProjectReferenceRedirect({
@ -103033,7 +103032,6 @@ var ts;
getSourceFiles: function () { return files; },
getMissingFilePaths: function () { return missingFilePaths; },
getRefFileMap: function () { return refFileMap; },
getSkippedTrippleSlashReferences: function () { return skippedTrippleSlashReferences; },
getFilesByNameMap: function () { return filesByName; },
getCompilerOptions: function () { return options; },
getSyntacticDiagnostics: getSyntacticDiagnostics,
@ -103347,7 +103345,6 @@ var ts;
SeenPackageName[SeenPackageName["Modified"] = 1] = "Modified";
})(SeenPackageName || (SeenPackageName = {}));
var seenPackageNames = new ts.Map();
var oldSkippedTrippleSlashReferences = oldProgram.getSkippedTrippleSlashReferences();
for (var _i = 0, oldSourceFiles_2 = oldSourceFiles; _i < oldSourceFiles_2.length; _i++) {
var oldSourceFile = oldSourceFiles_2[_i];
var newSourceFile = host.getSourceFileByPath
@ -103410,10 +103407,6 @@ var ts;
// tripleslash references has changed
oldProgram.structureIsReused = 1 /* SafeModules */;
}
if ((oldSkippedTrippleSlashReferences === null || oldSkippedTrippleSlashReferences === void 0 ? void 0 : oldSkippedTrippleSlashReferences.has(oldSourceFile.path)) && includeTripleslashReferencesFrom(newSourceFile)) {
// tripleslash reference resolution is now allowed
oldProgram.structureIsReused = 1 /* SafeModules */;
}
// check imports and module augmentations
collectExternalModuleReferences(newSourceFile);
if (!ts.arrayIsEqualTo(oldSourceFile.imports, newSourceFile.imports, moduleNameIsEqualTo)) {
@ -103495,7 +103488,6 @@ var ts;
}
missingFilePaths = oldProgram.getMissingFilePaths();
refFileMap = oldProgram.getRefFileMap();
skippedTrippleSlashReferences = oldSkippedTrippleSlashReferences;
// update fileName -> file mapping
ts.Debug.assert(newSourceFiles.length === oldProgram.getSourceFiles().length);
for (var _g = 0, newSourceFiles_1 = newSourceFiles; _g < newSourceFiles_1.length; _g++) {
@ -104534,14 +104526,7 @@ var ts;
}
return projectReferenceRedirects.get(projectReferencePath) || undefined;
}
function includeTripleslashReferencesFrom(file) {
return !host.includeTripleslashReferencesFrom || host.includeTripleslashReferencesFrom(file.originalFileName);
}
function processReferencedFiles(file, isDefaultLib) {
if (!includeTripleslashReferencesFrom(file)) {
(skippedTrippleSlashReferences || (skippedTrippleSlashReferences = new ts.Set())).add(file.path);
return;
}
ts.forEach(file.referencedFiles, function (ref, index) {
var referencedFileName = resolveTripleslashReference(ref.fileName, file.fileName);
processSourceFile(referencedFileName, isDefaultLib,
@ -106980,20 +106965,7 @@ var ts;
return true;
}
ts.canWatchDirectory = canWatchDirectory;
var ResolutionKind;
(function (ResolutionKind) {
ResolutionKind[ResolutionKind["All"] = 0] = "All";
ResolutionKind[ResolutionKind["RelativeReferencesInOpenFileOnly"] = 1] = "RelativeReferencesInOpenFileOnly";
})(ResolutionKind = ts.ResolutionKind || (ts.ResolutionKind = {}));
var noResolveResolvedModule = {
resolvedModule: undefined,
failedLookupLocations: []
};
var noResolveResolvedTypeReferenceDirective = {
resolvedTypeReferenceDirective: undefined,
failedLookupLocations: []
};
function createResolutionCache(resolutionHost, rootDirForResolution, resolutionKind, logChangesWhenResolvingModule) {
function createResolutionCache(resolutionHost, rootDirForResolution, logChangesWhenResolvingModule) {
var filesWithChangedSetOfUnresolvedImports;
var filesWithInvalidatedResolutions;
var filesWithInvalidatedNonRelativeUnresolvedImports;
@ -107044,7 +107016,6 @@ var ts;
hasChangedAutomaticTypeDirectiveNames: function () { return hasChangedAutomaticTypeDirectiveNames; },
invalidateResolutionOfFile: invalidateResolutionOfFile,
invalidateResolutionsOfFailedLookupLocations: invalidateResolutionsOfFailedLookupLocations,
removeRelativeNoResolveResolutionsOfFile: removeRelativeNoResolveResolutionsOfFile,
setFilesWithInvalidatedNonRelativeUnresolvedImports: setFilesWithInvalidatedNonRelativeUnresolvedImports,
createHasInvalidatedResolution: createHasInvalidatedResolution,
updateTypeRootsWatch: updateTypeRootsWatch,
@ -107152,7 +107123,7 @@ var ts;
}
function resolveNamesWithLocalCache(_a) {
var _b;
var names = _a.names, containingFile = _a.containingFile, redirectedReference = _a.redirectedReference, cache = _a.cache, perDirectoryCacheWithRedirects = _a.perDirectoryCacheWithRedirects, loader = _a.loader, getResolutionWithResolvedFileName = _a.getResolutionWithResolvedFileName, noResolveResolution = _a.noResolveResolution, shouldRetryResolution = _a.shouldRetryResolution, reusedNames = _a.reusedNames, logChanges = _a.logChanges;
var names = _a.names, containingFile = _a.containingFile, redirectedReference = _a.redirectedReference, cache = _a.cache, perDirectoryCacheWithRedirects = _a.perDirectoryCacheWithRedirects, loader = _a.loader, getResolutionWithResolvedFileName = _a.getResolutionWithResolvedFileName, shouldRetryResolution = _a.shouldRetryResolution, reusedNames = _a.reusedNames, logChanges = _a.logChanges;
var path = resolutionHost.toPath(containingFile);
var resolutionsInFile = cache.get(path) || cache.set(path, new ts.Map()).get(path);
var dirPath = ts.getDirectoryPath(path);
@ -107186,10 +107157,7 @@ var ts;
resolution = resolutionInDirectory;
}
else {
resolution = resolutionKind === ResolutionKind.All ||
(ts.isExternalModuleNameRelative(name) && resolutionHost.fileIsOpen(path)) ?
loader(name, containingFile, compilerOptions, ((_b = resolutionHost.getCompilerHost) === null || _b === void 0 ? void 0 : _b.call(resolutionHost)) || resolutionHost, redirectedReference) :
noResolveResolution;
resolution = loader(name, containingFile, compilerOptions, ((_b = resolutionHost.getCompilerHost) === null || _b === void 0 ? void 0 : _b.call(resolutionHost)) || resolutionHost, redirectedReference);
perDirectoryResolution.set(name, resolution);
}
resolutionsInFile.set(name, resolution);
@ -107243,7 +107211,6 @@ var ts;
loader: ts.resolveTypeReferenceDirective,
getResolutionWithResolvedFileName: getResolvedTypeReferenceDirective,
shouldRetryResolution: function (resolution) { return resolution.resolvedTypeReferenceDirective === undefined; },
noResolveResolution: noResolveResolvedTypeReferenceDirective,
});
}
function resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference) {
@ -107258,7 +107225,6 @@ var ts;
shouldRetryResolution: function (resolution) { return !resolution.resolvedModule || !ts.resolutionExtensionIsTSOrJson(resolution.resolvedModule.extension); },
reusedNames: reusedNames,
logChanges: logChangesWhenResolvingModule,
noResolveResolution: noResolveResolvedModule,
});
}
function getResolvedModuleWithFailedLookupLocationsFromCache(moduleName, containingFile) {
@ -107509,26 +107475,6 @@ var ts;
resolutionHost.onChangedAutomaticTypeDirectiveNames();
}
}
function removeRelativeNoResolveResolutionsOfFileFromCache(cache, filePath, noResolveResolution) {
ts.Debug.assert(resolutionKind === ResolutionKind.RelativeReferencesInOpenFileOnly);
// Deleted file, stop watching failed lookups for all the resolutions in the file
var resolutions = cache.get(filePath);
if (!resolutions)
return false;
var invalidated = false;
resolutions.forEach(function (resolution, name) {
if (resolution === noResolveResolution && ts.isExternalModuleNameRelative(name)) {
resolutions.delete(name);
invalidated = true;
}
});
return invalidated;
}
function removeRelativeNoResolveResolutionsOfFile(filePath) {
var invalidated = removeRelativeNoResolveResolutionsOfFileFromCache(resolvedModuleNames, filePath, noResolveResolvedModule);
invalidated = removeRelativeNoResolveResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath, noResolveResolvedTypeReferenceDirective) || invalidated;
return invalidated;
}
function setFilesWithInvalidatedNonRelativeUnresolvedImports(filesMap) {
ts.Debug.assert(filesWithInvalidatedNonRelativeUnresolvedImports === filesMap || filesWithInvalidatedNonRelativeUnresolvedImports === undefined);
filesWithInvalidatedNonRelativeUnresolvedImports = filesMap;
@ -108620,7 +108566,7 @@ var ts;
// Cache for the module resolution
var resolutionCache = ts.createResolutionCache(compilerHost, configFileName ?
ts.getDirectoryPath(ts.getNormalizedAbsolutePath(configFileName, currentDirectory)) :
currentDirectory, ts.ResolutionKind.All,
currentDirectory,
/*logChangesWhenResolvingModule*/ false);
// Resolve module using host module resolution strategy if provided otherwise use resolution cache to resolve module names
compilerHost.resolveModuleNames = host.resolveModuleNames ?
@ -143931,7 +143877,6 @@ var ts;
onReleaseOldSourceFile: onReleaseOldSourceFile,
hasInvalidatedResolution: hasInvalidatedResolution,
hasChangedAutomaticTypeDirectiveNames: hasChangedAutomaticTypeDirectiveNames,
includeTripleslashReferencesFrom: ts.maybeBind(host, host.includeTripleslashReferencesFrom),
trace: ts.maybeBind(host, host.trace),
resolveModuleNames: ts.maybeBind(host, host.resolveModuleNames),
resolveTypeReferenceDirectives: ts.maybeBind(host, host.resolveTypeReferenceDirectives),

View File

@ -102708,7 +102708,6 @@ var ts;
var projectReferenceRedirects;
var mapFromFileToProjectReferenceRedirects;
var mapFromToProjectReferenceRedirectSource;
var skippedTrippleSlashReferences;
var useSourceOfProjectReferenceRedirect = !!((_a = host.useSourceOfProjectReferenceRedirect) === null || _a === void 0 ? void 0 : _a.call(host)) &&
!options.disableSourceOfProjectReferenceRedirect;
var _c = updateHostForUseSourceOfProjectReferenceRedirect({
@ -102828,7 +102827,6 @@ var ts;
getSourceFiles: function () { return files; },
getMissingFilePaths: function () { return missingFilePaths; },
getRefFileMap: function () { return refFileMap; },
getSkippedTrippleSlashReferences: function () { return skippedTrippleSlashReferences; },
getFilesByNameMap: function () { return filesByName; },
getCompilerOptions: function () { return options; },
getSyntacticDiagnostics: getSyntacticDiagnostics,
@ -103142,7 +103140,6 @@ var ts;
SeenPackageName[SeenPackageName["Modified"] = 1] = "Modified";
})(SeenPackageName || (SeenPackageName = {}));
var seenPackageNames = new ts.Map();
var oldSkippedTrippleSlashReferences = oldProgram.getSkippedTrippleSlashReferences();
for (var _i = 0, oldSourceFiles_2 = oldSourceFiles; _i < oldSourceFiles_2.length; _i++) {
var oldSourceFile = oldSourceFiles_2[_i];
var newSourceFile = host.getSourceFileByPath
@ -103205,10 +103202,6 @@ var ts;
// tripleslash references has changed
oldProgram.structureIsReused = 1 /* SafeModules */;
}
if ((oldSkippedTrippleSlashReferences === null || oldSkippedTrippleSlashReferences === void 0 ? void 0 : oldSkippedTrippleSlashReferences.has(oldSourceFile.path)) && includeTripleslashReferencesFrom(newSourceFile)) {
// tripleslash reference resolution is now allowed
oldProgram.structureIsReused = 1 /* SafeModules */;
}
// check imports and module augmentations
collectExternalModuleReferences(newSourceFile);
if (!ts.arrayIsEqualTo(oldSourceFile.imports, newSourceFile.imports, moduleNameIsEqualTo)) {
@ -103290,7 +103283,6 @@ var ts;
}
missingFilePaths = oldProgram.getMissingFilePaths();
refFileMap = oldProgram.getRefFileMap();
skippedTrippleSlashReferences = oldSkippedTrippleSlashReferences;
// update fileName -> file mapping
ts.Debug.assert(newSourceFiles.length === oldProgram.getSourceFiles().length);
for (var _g = 0, newSourceFiles_1 = newSourceFiles; _g < newSourceFiles_1.length; _g++) {
@ -104329,14 +104321,7 @@ var ts;
}
return projectReferenceRedirects.get(projectReferencePath) || undefined;
}
function includeTripleslashReferencesFrom(file) {
return !host.includeTripleslashReferencesFrom || host.includeTripleslashReferencesFrom(file.originalFileName);
}
function processReferencedFiles(file, isDefaultLib) {
if (!includeTripleslashReferencesFrom(file)) {
(skippedTrippleSlashReferences || (skippedTrippleSlashReferences = new ts.Set())).add(file.path);
return;
}
ts.forEach(file.referencedFiles, function (ref, index) {
var referencedFileName = resolveTripleslashReference(ref.fileName, file.fileName);
processSourceFile(referencedFileName, isDefaultLib,
@ -106775,20 +106760,7 @@ var ts;
return true;
}
ts.canWatchDirectory = canWatchDirectory;
var ResolutionKind;
(function (ResolutionKind) {
ResolutionKind[ResolutionKind["All"] = 0] = "All";
ResolutionKind[ResolutionKind["RelativeReferencesInOpenFileOnly"] = 1] = "RelativeReferencesInOpenFileOnly";
})(ResolutionKind = ts.ResolutionKind || (ts.ResolutionKind = {}));
var noResolveResolvedModule = {
resolvedModule: undefined,
failedLookupLocations: []
};
var noResolveResolvedTypeReferenceDirective = {
resolvedTypeReferenceDirective: undefined,
failedLookupLocations: []
};
function createResolutionCache(resolutionHost, rootDirForResolution, resolutionKind, logChangesWhenResolvingModule) {
function createResolutionCache(resolutionHost, rootDirForResolution, logChangesWhenResolvingModule) {
var filesWithChangedSetOfUnresolvedImports;
var filesWithInvalidatedResolutions;
var filesWithInvalidatedNonRelativeUnresolvedImports;
@ -106839,7 +106811,6 @@ var ts;
hasChangedAutomaticTypeDirectiveNames: function () { return hasChangedAutomaticTypeDirectiveNames; },
invalidateResolutionOfFile: invalidateResolutionOfFile,
invalidateResolutionsOfFailedLookupLocations: invalidateResolutionsOfFailedLookupLocations,
removeRelativeNoResolveResolutionsOfFile: removeRelativeNoResolveResolutionsOfFile,
setFilesWithInvalidatedNonRelativeUnresolvedImports: setFilesWithInvalidatedNonRelativeUnresolvedImports,
createHasInvalidatedResolution: createHasInvalidatedResolution,
updateTypeRootsWatch: updateTypeRootsWatch,
@ -106947,7 +106918,7 @@ var ts;
}
function resolveNamesWithLocalCache(_a) {
var _b;
var names = _a.names, containingFile = _a.containingFile, redirectedReference = _a.redirectedReference, cache = _a.cache, perDirectoryCacheWithRedirects = _a.perDirectoryCacheWithRedirects, loader = _a.loader, getResolutionWithResolvedFileName = _a.getResolutionWithResolvedFileName, noResolveResolution = _a.noResolveResolution, shouldRetryResolution = _a.shouldRetryResolution, reusedNames = _a.reusedNames, logChanges = _a.logChanges;
var names = _a.names, containingFile = _a.containingFile, redirectedReference = _a.redirectedReference, cache = _a.cache, perDirectoryCacheWithRedirects = _a.perDirectoryCacheWithRedirects, loader = _a.loader, getResolutionWithResolvedFileName = _a.getResolutionWithResolvedFileName, shouldRetryResolution = _a.shouldRetryResolution, reusedNames = _a.reusedNames, logChanges = _a.logChanges;
var path = resolutionHost.toPath(containingFile);
var resolutionsInFile = cache.get(path) || cache.set(path, new ts.Map()).get(path);
var dirPath = ts.getDirectoryPath(path);
@ -106981,10 +106952,7 @@ var ts;
resolution = resolutionInDirectory;
}
else {
resolution = resolutionKind === ResolutionKind.All ||
(ts.isExternalModuleNameRelative(name) && resolutionHost.fileIsOpen(path)) ?
loader(name, containingFile, compilerOptions, ((_b = resolutionHost.getCompilerHost) === null || _b === void 0 ? void 0 : _b.call(resolutionHost)) || resolutionHost, redirectedReference) :
noResolveResolution;
resolution = loader(name, containingFile, compilerOptions, ((_b = resolutionHost.getCompilerHost) === null || _b === void 0 ? void 0 : _b.call(resolutionHost)) || resolutionHost, redirectedReference);
perDirectoryResolution.set(name, resolution);
}
resolutionsInFile.set(name, resolution);
@ -107038,7 +107006,6 @@ var ts;
loader: ts.resolveTypeReferenceDirective,
getResolutionWithResolvedFileName: getResolvedTypeReferenceDirective,
shouldRetryResolution: function (resolution) { return resolution.resolvedTypeReferenceDirective === undefined; },
noResolveResolution: noResolveResolvedTypeReferenceDirective,
});
}
function resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference) {
@ -107053,7 +107020,6 @@ var ts;
shouldRetryResolution: function (resolution) { return !resolution.resolvedModule || !ts.resolutionExtensionIsTSOrJson(resolution.resolvedModule.extension); },
reusedNames: reusedNames,
logChanges: logChangesWhenResolvingModule,
noResolveResolution: noResolveResolvedModule,
});
}
function getResolvedModuleWithFailedLookupLocationsFromCache(moduleName, containingFile) {
@ -107304,26 +107270,6 @@ var ts;
resolutionHost.onChangedAutomaticTypeDirectiveNames();
}
}
function removeRelativeNoResolveResolutionsOfFileFromCache(cache, filePath, noResolveResolution) {
ts.Debug.assert(resolutionKind === ResolutionKind.RelativeReferencesInOpenFileOnly);
// Deleted file, stop watching failed lookups for all the resolutions in the file
var resolutions = cache.get(filePath);
if (!resolutions)
return false;
var invalidated = false;
resolutions.forEach(function (resolution, name) {
if (resolution === noResolveResolution && ts.isExternalModuleNameRelative(name)) {
resolutions.delete(name);
invalidated = true;
}
});
return invalidated;
}
function removeRelativeNoResolveResolutionsOfFile(filePath) {
var invalidated = removeRelativeNoResolveResolutionsOfFileFromCache(resolvedModuleNames, filePath, noResolveResolvedModule);
invalidated = removeRelativeNoResolveResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath, noResolveResolvedTypeReferenceDirective) || invalidated;
return invalidated;
}
function setFilesWithInvalidatedNonRelativeUnresolvedImports(filesMap) {
ts.Debug.assert(filesWithInvalidatedNonRelativeUnresolvedImports === filesMap || filesWithInvalidatedNonRelativeUnresolvedImports === undefined);
filesWithInvalidatedNonRelativeUnresolvedImports = filesMap;
@ -108415,7 +108361,7 @@ var ts;
// Cache for the module resolution
var resolutionCache = ts.createResolutionCache(compilerHost, configFileName ?
ts.getDirectoryPath(ts.getNormalizedAbsolutePath(configFileName, currentDirectory)) :
currentDirectory, ts.ResolutionKind.All,
currentDirectory,
/*logChangesWhenResolvingModule*/ false);
// Resolve module using host module resolution strategy if provided otherwise use resolution cache to resolve module names
compilerHost.resolveModuleNames = host.resolveModuleNames ?