@typescript-deploys/pr-build 4.8.0-pr-50007-2 → 4.8.0-pr-50085-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/tsc.js +679 -1511
- package/lib/tsserver.js +817 -1708
- package/lib/tsserverlibrary.d.ts +31 -37
- package/lib/tsserverlibrary.js +817 -1708
- package/lib/typescript.d.ts +28 -35
- package/lib/typescript.js +765 -1647
- package/lib/typescriptServices.d.ts +28 -35
- package/lib/typescriptServices.js +765 -1647
- package/lib/typingsInstaller.js +721 -1598
- package/package.json +1 -1
|
@@ -4906,15 +4906,13 @@ var ts;
|
|
|
4906
4906
|
(function (FilePreprocessingDiagnosticsKind) {
|
|
4907
4907
|
FilePreprocessingDiagnosticsKind[FilePreprocessingDiagnosticsKind["FilePreprocessingReferencedDiagnostic"] = 0] = "FilePreprocessingReferencedDiagnostic";
|
|
4908
4908
|
FilePreprocessingDiagnosticsKind[FilePreprocessingDiagnosticsKind["FilePreprocessingFileExplainingDiagnostic"] = 1] = "FilePreprocessingFileExplainingDiagnostic";
|
|
4909
|
-
FilePreprocessingDiagnosticsKind[FilePreprocessingDiagnosticsKind["ResolutionDiagnostics"] = 2] = "ResolutionDiagnostics";
|
|
4910
4909
|
})(FilePreprocessingDiagnosticsKind = ts.FilePreprocessingDiagnosticsKind || (ts.FilePreprocessingDiagnosticsKind = {}));
|
|
4911
4910
|
/* @internal */
|
|
4912
4911
|
var StructureIsReused;
|
|
4913
4912
|
(function (StructureIsReused) {
|
|
4914
4913
|
StructureIsReused[StructureIsReused["Not"] = 0] = "Not";
|
|
4915
|
-
StructureIsReused[StructureIsReused["
|
|
4916
|
-
StructureIsReused[StructureIsReused["
|
|
4917
|
-
StructureIsReused[StructureIsReused["Completely"] = 3] = "Completely";
|
|
4914
|
+
StructureIsReused[StructureIsReused["SafeModules"] = 1] = "SafeModules";
|
|
4915
|
+
StructureIsReused[StructureIsReused["Completely"] = 2] = "Completely";
|
|
4918
4916
|
})(StructureIsReused = ts.StructureIsReused || (ts.StructureIsReused = {}));
|
|
4919
4917
|
/** Return code used by getEmitOutput function to indicate status of the function */
|
|
4920
4918
|
var ExitStatus;
|
|
@@ -9849,7 +9847,6 @@ var ts;
|
|
|
9849
9847
|
Specify_how_the_TypeScript_watch_mode_works: diag(6715, ts.DiagnosticCategory.Message, "Specify_how_the_TypeScript_watch_mode_works_6715", "Specify how the TypeScript watch mode works."),
|
|
9850
9848
|
Require_undeclared_properties_from_index_signatures_to_use_element_accesses: diag(6717, ts.DiagnosticCategory.Message, "Require_undeclared_properties_from_index_signatures_to_use_element_accesses_6717", "Require undeclared properties from index signatures to use element accesses."),
|
|
9851
9849
|
Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types: diag(6718, ts.DiagnosticCategory.Message, "Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types_6718", "Specify emit/checking behavior for imports that are only used for types."),
|
|
9852
|
-
Save_resolutions_into_tsbuildinfo_file_and_use_them_for_incremental_compilation: diag(6719, ts.DiagnosticCategory.Message, "Save_resolutions_into_tsbuildinfo_file_and_use_them_for_incremental_compilation_6719", "Save resolutions into .tsbuildinfo file and use them for incremental compilation."),
|
|
9853
9850
|
Default_catch_clause_variables_as_unknown_instead_of_any: diag(6803, ts.DiagnosticCategory.Message, "Default_catch_clause_variables_as_unknown_instead_of_any_6803", "Default catch clause variables as 'unknown' instead of 'any'."),
|
|
9854
9851
|
one_of_Colon: diag(6900, ts.DiagnosticCategory.Message, "one_of_Colon_6900", "one of:"),
|
|
9855
9852
|
one_or_more_Colon: diag(6901, ts.DiagnosticCategory.Message, "one_or_more_Colon_6901", "one or more:"),
|
|
@@ -14591,8 +14588,7 @@ var ts;
|
|
|
14591
14588
|
}
|
|
14592
14589
|
ts.changesAffectModuleResolution = changesAffectModuleResolution;
|
|
14593
14590
|
function optionsHaveModuleResolutionChanges(oldOptions, newOptions) {
|
|
14594
|
-
return oldOptions
|
|
14595
|
-
optionsHaveChanges(oldOptions, newOptions, ts.moduleResolutionOptionDeclarations);
|
|
14591
|
+
return optionsHaveChanges(oldOptions, newOptions, ts.moduleResolutionOptionDeclarations);
|
|
14596
14592
|
}
|
|
14597
14593
|
ts.optionsHaveModuleResolutionChanges = optionsHaveModuleResolutionChanges;
|
|
14598
14594
|
function changesAffectingProgramStructure(oldOptions, newOptions) {
|
|
@@ -14670,20 +14666,21 @@ var ts;
|
|
|
14670
14666
|
}
|
|
14671
14667
|
ts.getFullWidth = getFullWidth;
|
|
14672
14668
|
function getResolvedModule(sourceFile, moduleNameText, mode) {
|
|
14673
|
-
|
|
14674
|
-
return (_b = (_a = sourceFile === null || sourceFile === void 0 ? void 0 : sourceFile.resolvedModules) === null || _a === void 0 ? void 0 : _a.get(moduleNameText, mode)) === null || _b === void 0 ? void 0 : _b.resolvedModule;
|
|
14669
|
+
return sourceFile && sourceFile.resolvedModules && sourceFile.resolvedModules.get(moduleNameText, mode);
|
|
14675
14670
|
}
|
|
14676
14671
|
ts.getResolvedModule = getResolvedModule;
|
|
14677
14672
|
function setResolvedModule(sourceFile, moduleNameText, resolvedModule, mode) {
|
|
14678
|
-
|
|
14679
|
-
|
|
14673
|
+
if (!sourceFile.resolvedModules) {
|
|
14674
|
+
sourceFile.resolvedModules = ts.createModeAwareCache();
|
|
14675
|
+
}
|
|
14680
14676
|
sourceFile.resolvedModules.set(moduleNameText, mode, resolvedModule);
|
|
14681
14677
|
}
|
|
14682
14678
|
ts.setResolvedModule = setResolvedModule;
|
|
14683
|
-
function setResolvedTypeReferenceDirective(sourceFile, typeReferenceDirectiveName, resolvedTypeReferenceDirective
|
|
14684
|
-
|
|
14685
|
-
|
|
14686
|
-
|
|
14679
|
+
function setResolvedTypeReferenceDirective(sourceFile, typeReferenceDirectiveName, resolvedTypeReferenceDirective) {
|
|
14680
|
+
if (!sourceFile.resolvedTypeReferenceDirectiveNames) {
|
|
14681
|
+
sourceFile.resolvedTypeReferenceDirectiveNames = ts.createModeAwareCache();
|
|
14682
|
+
}
|
|
14683
|
+
sourceFile.resolvedTypeReferenceDirectiveNames.set(typeReferenceDirectiveName, /*mode*/ undefined, resolvedTypeReferenceDirective);
|
|
14687
14684
|
}
|
|
14688
14685
|
ts.setResolvedTypeReferenceDirective = setResolvedTypeReferenceDirective;
|
|
14689
14686
|
function projectReferenceIsEqualTo(oldRef, newRef) {
|
|
@@ -14693,15 +14690,11 @@ var ts;
|
|
|
14693
14690
|
}
|
|
14694
14691
|
ts.projectReferenceIsEqualTo = projectReferenceIsEqualTo;
|
|
14695
14692
|
function moduleResolutionIsEqualTo(oldResolution, newResolution) {
|
|
14696
|
-
return oldResolution === newResolution
|
|
14697
|
-
oldResolution.
|
|
14698
|
-
|
|
14699
|
-
|
|
14700
|
-
|
|
14701
|
-
oldResolution.resolvedModule.extension === newResolution.resolvedModule.extension &&
|
|
14702
|
-
oldResolution.resolvedModule.resolvedFileName === newResolution.resolvedModule.resolvedFileName &&
|
|
14703
|
-
oldResolution.resolvedModule.originalPath === newResolution.resolvedModule.originalPath &&
|
|
14704
|
-
packageIdIsEqual(oldResolution.resolvedModule.packageId, newResolution.resolvedModule.packageId);
|
|
14693
|
+
return oldResolution.isExternalLibraryImport === newResolution.isExternalLibraryImport &&
|
|
14694
|
+
oldResolution.extension === newResolution.extension &&
|
|
14695
|
+
oldResolution.resolvedFileName === newResolution.resolvedFileName &&
|
|
14696
|
+
oldResolution.originalPath === newResolution.originalPath &&
|
|
14697
|
+
packageIdIsEqual(oldResolution.packageId, newResolution.packageId);
|
|
14705
14698
|
}
|
|
14706
14699
|
ts.moduleResolutionIsEqualTo = moduleResolutionIsEqualTo;
|
|
14707
14700
|
function packageIdIsEqual(a, b) {
|
|
@@ -14717,13 +14710,9 @@ var ts;
|
|
|
14717
14710
|
}
|
|
14718
14711
|
ts.packageIdToString = packageIdToString;
|
|
14719
14712
|
function typeDirectiveIsEqualTo(oldResolution, newResolution) {
|
|
14720
|
-
return oldResolution === newResolution
|
|
14721
|
-
oldResolution.
|
|
14722
|
-
|
|
14723
|
-
!!newResolution.resolvedTypeReferenceDirective &&
|
|
14724
|
-
oldResolution.resolvedTypeReferenceDirective.resolvedFileName === newResolution.resolvedTypeReferenceDirective.resolvedFileName &&
|
|
14725
|
-
!!oldResolution.resolvedTypeReferenceDirective.primary === !!newResolution.resolvedTypeReferenceDirective.primary &&
|
|
14726
|
-
oldResolution.resolvedTypeReferenceDirective.originalPath === newResolution.resolvedTypeReferenceDirective.originalPath;
|
|
14713
|
+
return oldResolution.resolvedFileName === newResolution.resolvedFileName
|
|
14714
|
+
&& oldResolution.primary === newResolution.primary
|
|
14715
|
+
&& oldResolution.originalPath === newResolution.originalPath;
|
|
14727
14716
|
}
|
|
14728
14717
|
ts.typeDirectiveIsEqualTo = typeDirectiveIsEqualTo;
|
|
14729
14718
|
function hasChangesInResolutions(names, newResolutions, oldResolutions, oldSourceFile, comparer) {
|
|
@@ -19580,20 +19569,23 @@ var ts;
|
|
|
19580
19569
|
return getStringFromExpandedCharCodes(expandedCharCodes);
|
|
19581
19570
|
}
|
|
19582
19571
|
ts.base64decode = base64decode;
|
|
19583
|
-
function
|
|
19584
|
-
|
|
19585
|
-
|
|
19586
|
-
|
|
19587
|
-
|
|
19588
|
-
|
|
19589
|
-
|
|
19590
|
-
|
|
19591
|
-
|
|
19572
|
+
function readJson(path, host) {
|
|
19573
|
+
try {
|
|
19574
|
+
var jsonText = host.readFile(path);
|
|
19575
|
+
if (!jsonText)
|
|
19576
|
+
return {};
|
|
19577
|
+
var result = ts.parseConfigFileTextToJson(path, jsonText);
|
|
19578
|
+
if (result.error) {
|
|
19579
|
+
return {};
|
|
19580
|
+
}
|
|
19581
|
+
return result.config;
|
|
19582
|
+
}
|
|
19583
|
+
catch (e) {
|
|
19584
|
+
// gracefully handle if readFile fails or returns not JSON
|
|
19592
19585
|
return {};
|
|
19593
19586
|
}
|
|
19594
|
-
return result.config;
|
|
19595
19587
|
}
|
|
19596
|
-
ts.
|
|
19588
|
+
ts.readJson = readJson;
|
|
19597
19589
|
function directoryProbablyExists(directoryName, host) {
|
|
19598
19590
|
// if host does not support 'directoryExists' assume that directory will exist
|
|
19599
19591
|
return !host.directoryExists || host.directoryExists(directoryName);
|
|
@@ -20675,15 +20667,14 @@ var ts;
|
|
|
20675
20667
|
},
|
|
20676
20668
|
setSymlinksFromResolutions: function (files, typeReferenceDirectives) {
|
|
20677
20669
|
var _this = this;
|
|
20678
|
-
var _a
|
|
20670
|
+
var _a;
|
|
20679
20671
|
ts.Debug.assert(!hasProcessedResolutions);
|
|
20680
20672
|
hasProcessedResolutions = true;
|
|
20681
20673
|
for (var _i = 0, files_1 = files; _i < files_1.length; _i++) {
|
|
20682
20674
|
var file = files_1[_i];
|
|
20683
|
-
(_a = file.resolvedModules) === null || _a === void 0 ? void 0 : _a.forEach(function (resolution) { return processResolution(_this, resolution
|
|
20684
|
-
(_b = file.resolvedTypeReferenceDirectiveNames) === null || _b === void 0 ? void 0 : _b.forEach(function (resolution) { return processResolution(_this, resolution === null || resolution === void 0 ? void 0 : resolution.resolvedTypeReferenceDirective); });
|
|
20675
|
+
(_a = file.resolvedModules) === null || _a === void 0 ? void 0 : _a.forEach(function (resolution) { return processResolution(_this, resolution); });
|
|
20685
20676
|
}
|
|
20686
|
-
typeReferenceDirectives.forEach(function (resolution) { return processResolution(_this, resolution
|
|
20677
|
+
typeReferenceDirectives === null || typeReferenceDirectives === void 0 ? void 0 : typeReferenceDirectives.forEach(function (resolution) { return processResolution(_this, resolution); });
|
|
20687
20678
|
},
|
|
20688
20679
|
hasProcessedResolutions: function () { return hasProcessedResolutions; },
|
|
20689
20680
|
};
|
|
@@ -39943,17 +39934,6 @@ var ts;
|
|
|
39943
39934
|
transpileOptionValue: undefined,
|
|
39944
39935
|
defaultValueDescription: ts.Diagnostics.false_unless_composite_is_set
|
|
39945
39936
|
},
|
|
39946
|
-
{
|
|
39947
|
-
name: "cacheResolutions",
|
|
39948
|
-
type: "boolean",
|
|
39949
|
-
category: ts.Diagnostics.Projects,
|
|
39950
|
-
description: ts.Diagnostics.Save_resolutions_into_tsbuildinfo_file_and_use_them_for_incremental_compilation,
|
|
39951
|
-
affectsModuleResolution: true,
|
|
39952
|
-
affectsMultiFileEmitBuildInfo: true,
|
|
39953
|
-
affectsBundleEmitBuildInfo: true,
|
|
39954
|
-
transpileOptionValue: undefined,
|
|
39955
|
-
defaultValueDescription: false,
|
|
39956
|
-
},
|
|
39957
39937
|
{
|
|
39958
39938
|
name: "assumeChangesOnlyAffectDirectDependencies",
|
|
39959
39939
|
type: "boolean",
|
|
@@ -42051,9 +42031,6 @@ var ts;
|
|
|
42051
42031
|
if (result.configFilePath) {
|
|
42052
42032
|
result.configFilePath = toAbsolutePath(result.configFilePath);
|
|
42053
42033
|
}
|
|
42054
|
-
if (result.pathsBasePath) {
|
|
42055
|
-
result.pathsBasePath = toAbsolutePath(result.pathsBasePath);
|
|
42056
|
-
}
|
|
42057
42034
|
return result;
|
|
42058
42035
|
}
|
|
42059
42036
|
ts.convertToOptionsWithAbsolutePaths = convertToOptionsWithAbsolutePaths;
|
|
@@ -43039,36 +43016,20 @@ var ts;
|
|
|
43039
43016
|
ts.Debug.assert(ts.extensionIsTS(resolved.extension));
|
|
43040
43017
|
return { fileName: resolved.path, packageId: resolved.packageId };
|
|
43041
43018
|
}
|
|
43042
|
-
function createResolvedModuleWithFailedLookupLocations(
|
|
43043
|
-
var _a;
|
|
43044
|
-
var _b;
|
|
43019
|
+
function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, resultFromCache) {
|
|
43020
|
+
var _a, _b;
|
|
43045
43021
|
if (resultFromCache) {
|
|
43046
|
-
|
|
43047
|
-
|
|
43048
|
-
resultFromCache.affectingLocations = updateResolutionField(resultFromCache.affectingLocations, affectingLocations);
|
|
43049
|
-
resultFromCache.resolutionDiagnostics = updateResolutionField(resultFromCache.resolutionDiagnostics, diagnostics);
|
|
43022
|
+
(_a = resultFromCache.failedLookupLocations).push.apply(_a, failedLookupLocations);
|
|
43023
|
+
(_b = resultFromCache.affectingLocations).push.apply(_b, affectingLocations);
|
|
43050
43024
|
return resultFromCache;
|
|
43051
43025
|
}
|
|
43052
43026
|
return {
|
|
43053
43027
|
resolvedModule: resolved && { resolvedFileName: resolved.path, originalPath: resolved.originalPath === true ? undefined : resolved.originalPath, extension: resolved.extension, isExternalLibraryImport: isExternalLibraryImport, packageId: resolved.packageId },
|
|
43054
|
-
failedLookupLocations:
|
|
43055
|
-
affectingLocations:
|
|
43056
|
-
resolutionDiagnostics:
|
|
43028
|
+
failedLookupLocations: failedLookupLocations,
|
|
43029
|
+
affectingLocations: affectingLocations,
|
|
43030
|
+
resolutionDiagnostics: diagnostics,
|
|
43057
43031
|
};
|
|
43058
43032
|
}
|
|
43059
|
-
function initializeResolutionField(value) {
|
|
43060
|
-
return value.length ? value : undefined;
|
|
43061
|
-
}
|
|
43062
|
-
/*@internal*/
|
|
43063
|
-
function updateResolutionField(to, value) {
|
|
43064
|
-
if (!(value === null || value === void 0 ? void 0 : value.length))
|
|
43065
|
-
return to;
|
|
43066
|
-
if (!(to === null || to === void 0 ? void 0 : to.length))
|
|
43067
|
-
return value;
|
|
43068
|
-
to.push.apply(to, value);
|
|
43069
|
-
return to;
|
|
43070
|
-
}
|
|
43071
|
-
ts.updateResolutionField = updateResolutionField;
|
|
43072
43033
|
function readPackageJsonField(jsonContent, fieldName, typeOfTag, state) {
|
|
43073
43034
|
if (!ts.hasProperty(jsonContent, fieldName)) {
|
|
43074
43035
|
if (state.traceEnabled) {
|
|
@@ -43220,7 +43181,8 @@ var ts;
|
|
|
43220
43181
|
options = redirectedReference.commandLine.options;
|
|
43221
43182
|
}
|
|
43222
43183
|
var containingDirectory = containingFile ? ts.getDirectoryPath(containingFile) : undefined;
|
|
43223
|
-
var
|
|
43184
|
+
var perFolderCache = containingDirectory ? cache && cache.getOrCreateCacheForDirectory(containingDirectory, redirectedReference) : undefined;
|
|
43185
|
+
var result = perFolderCache && perFolderCache.get(typeReferenceDirectiveName, /*mode*/ resolutionMode);
|
|
43224
43186
|
if (result) {
|
|
43225
43187
|
if (traceEnabled) {
|
|
43226
43188
|
trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_1, typeReferenceDirectiveName, containingFile);
|
|
@@ -43278,7 +43240,7 @@ var ts;
|
|
|
43278
43240
|
features: features,
|
|
43279
43241
|
conditions: conditions,
|
|
43280
43242
|
requestContainingDirectory: containingDirectory,
|
|
43281
|
-
|
|
43243
|
+
reportDiagnostic: function (diag) { return void diagnostics.push(diag); },
|
|
43282
43244
|
};
|
|
43283
43245
|
var resolved = primaryLookup();
|
|
43284
43246
|
var primary = true;
|
|
@@ -43298,15 +43260,8 @@ var ts;
|
|
|
43298
43260
|
isExternalLibraryImport: pathContainsNodeModules(fileName),
|
|
43299
43261
|
};
|
|
43300
43262
|
}
|
|
43301
|
-
result = {
|
|
43302
|
-
|
|
43303
|
-
failedLookupLocations: !options.cacheResolutions || !(resolvedTypeReferenceDirective === null || resolvedTypeReferenceDirective === void 0 ? void 0 : resolvedTypeReferenceDirective.resolvedFileName) ? failedLookupLocations : ts.emptyArray,
|
|
43304
|
-
affectingLocations: initializeResolutionField(affectingLocations),
|
|
43305
|
-
resolutionDiagnostics: initializeResolutionField(diagnostics),
|
|
43306
|
-
};
|
|
43307
|
-
if (containingDirectory && cache) {
|
|
43308
|
-
cache.getOrCreateCacheForDirectory(containingDirectory, redirectedReference).set(typeReferenceDirectiveName, /*mode*/ resolutionMode, result);
|
|
43309
|
-
}
|
|
43263
|
+
result = { resolvedTypeReferenceDirective: resolvedTypeReferenceDirective, failedLookupLocations: failedLookupLocations, affectingLocations: affectingLocations, resolutionDiagnostics: diagnostics };
|
|
43264
|
+
perFolderCache === null || perFolderCache === void 0 ? void 0 : perFolderCache.set(typeReferenceDirectiveName, /*mode*/ resolutionMode, result);
|
|
43310
43265
|
if (traceEnabled)
|
|
43311
43266
|
traceResult(result);
|
|
43312
43267
|
return result;
|
|
@@ -43316,10 +43271,10 @@ var ts;
|
|
|
43316
43271
|
trace(host, ts.Diagnostics.Type_reference_directive_0_was_not_resolved, typeReferenceDirectiveName);
|
|
43317
43272
|
}
|
|
43318
43273
|
else if (result.resolvedTypeReferenceDirective.packageId) {
|
|
43319
|
-
trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3, typeReferenceDirectiveName, result.resolvedTypeReferenceDirective.resolvedFileName, ts.packageIdToString(result.resolvedTypeReferenceDirective.packageId),
|
|
43274
|
+
trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3, typeReferenceDirectiveName, result.resolvedTypeReferenceDirective.resolvedFileName, ts.packageIdToString(result.resolvedTypeReferenceDirective.packageId), result.resolvedTypeReferenceDirective.primary);
|
|
43320
43275
|
}
|
|
43321
43276
|
else {
|
|
43322
|
-
trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2, typeReferenceDirectiveName, result.resolvedTypeReferenceDirective.resolvedFileName,
|
|
43277
|
+
trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2, typeReferenceDirectiveName, result.resolvedTypeReferenceDirective.resolvedFileName, result.resolvedTypeReferenceDirective.primary);
|
|
43323
43278
|
}
|
|
43324
43279
|
}
|
|
43325
43280
|
function primaryLookup() {
|
|
@@ -43418,7 +43373,7 @@ var ts;
|
|
|
43418
43373
|
// `types-publisher` sometimes creates packages with `"typings": null` for packages that don't provide their own types.
|
|
43419
43374
|
// See `createNotNeededPackageJSON` in the types-publisher` repo.
|
|
43420
43375
|
// eslint-disable-next-line no-null/no-null
|
|
43421
|
-
var isNotNeededPackage = host.fileExists(packageJsonPath) && ts.
|
|
43376
|
+
var isNotNeededPackage = host.fileExists(packageJsonPath) && ts.readJson(packageJsonPath, host).typings === null;
|
|
43422
43377
|
if (!isNotNeededPackage) {
|
|
43423
43378
|
var baseFileName = ts.getBaseFileName(normalized);
|
|
43424
43379
|
// At this stage, skip results with leading dot.
|
|
@@ -43435,143 +43390,49 @@ var ts;
|
|
|
43435
43390
|
return result;
|
|
43436
43391
|
}
|
|
43437
43392
|
ts.getAutomaticTypeDirectiveNames = getAutomaticTypeDirectiveNames;
|
|
43438
|
-
function compilerOptionValueToString(value) {
|
|
43439
|
-
var _a;
|
|
43440
|
-
if (value === null || typeof value !== "object") { // eslint-disable-line no-null/no-null
|
|
43441
|
-
return "" + value;
|
|
43442
|
-
}
|
|
43443
|
-
if (ts.isArray(value)) {
|
|
43444
|
-
return "[" + ((_a = ts.map(value, function (e) { return compilerOptionValueToString(e); })) === null || _a === void 0 ? void 0 : _a.join(",")) + "]";
|
|
43445
|
-
}
|
|
43446
|
-
var str = "{";
|
|
43447
|
-
for (var key in value) {
|
|
43448
|
-
if (ts.hasProperty(value, key)) {
|
|
43449
|
-
str += key + ": " + compilerOptionValueToString(value[key]);
|
|
43450
|
-
}
|
|
43451
|
-
}
|
|
43452
|
-
return str + "}";
|
|
43453
|
-
}
|
|
43454
|
-
/*@internal*/
|
|
43455
|
-
function getKeyForCompilationSettings(settings, options) {
|
|
43456
|
-
return options.map(function (option) { return compilerOptionValueToString(ts.getCompilerOptionValue(settings, option)); }).join("|") + ("|" + settings.pathsBasePath);
|
|
43457
|
-
}
|
|
43458
|
-
ts.getKeyForCompilationSettings = getKeyForCompilationSettings;
|
|
43459
|
-
/*@internal*/
|
|
43460
|
-
function getRedirectsCacheKey(options) {
|
|
43461
|
-
return getKeyForCompilationSettings(options, ts.moduleResolutionOptionDeclarations);
|
|
43462
|
-
}
|
|
43463
|
-
ts.getRedirectsCacheKey = getRedirectsCacheKey;
|
|
43464
43393
|
/*@internal*/
|
|
43465
|
-
function createCacheWithRedirects(
|
|
43466
|
-
var ownMap;
|
|
43467
|
-
var ownKey;
|
|
43468
|
-
var redirectsKeyToCache = new ts.Map();
|
|
43394
|
+
function createCacheWithRedirects(options) {
|
|
43395
|
+
var ownMap = new ts.Map();
|
|
43469
43396
|
var redirectsMap = new ts.Map();
|
|
43470
43397
|
return {
|
|
43471
43398
|
getOwnMap: getOwnMap,
|
|
43472
|
-
|
|
43473
|
-
createMapForCompilerOptions: createMapForCompilerOptions,
|
|
43474
|
-
getMapOfCacheRedirects: getMapOfCacheRedirects,
|
|
43399
|
+
redirectsMap: redirectsMap,
|
|
43475
43400
|
getOrCreateMapOfCacheRedirects: getOrCreateMapOfCacheRedirects,
|
|
43476
43401
|
clear: clear,
|
|
43477
|
-
|
|
43478
|
-
|
|
43402
|
+
setOwnOptions: setOwnOptions,
|
|
43403
|
+
setOwnMap: setOwnMap
|
|
43479
43404
|
};
|
|
43480
|
-
function
|
|
43481
|
-
|
|
43482
|
-
if (ownKey && !redirectsKeyToCache.has(ownKey))
|
|
43483
|
-
redirectsKeyToCache.set(ownKey, { map: ownMap !== null && ownMap !== void 0 ? ownMap : (ownMap = new ts.Map()), options: ownOptions });
|
|
43484
|
-
}
|
|
43485
|
-
function createMapForCompilerOptions(options, optionsKey) {
|
|
43486
|
-
if (options === ownOptions)
|
|
43487
|
-
return ownMap !== null && ownMap !== void 0 ? ownMap : (ownMap = new ts.Map());
|
|
43488
|
-
return getOrCreateRedirectMapAndKey(options, /*path*/ undefined, optionsKey);
|
|
43405
|
+
function getOwnMap() {
|
|
43406
|
+
return ownMap;
|
|
43489
43407
|
}
|
|
43490
|
-
function
|
|
43491
|
-
|
|
43492
|
-
if (path || options.configFile) {
|
|
43493
|
-
var redirects = redirectsMap.get(path || options.configFile.path);
|
|
43494
|
-
if (redirects)
|
|
43495
|
-
return redirects;
|
|
43496
|
-
}
|
|
43497
|
-
var key = optionsKey || getRedirectsCacheKey(options);
|
|
43498
|
-
var map = (_a = redirectsKeyToCache.get(key)) === null || _a === void 0 ? void 0 : _a.map;
|
|
43499
|
-
if (!map) {
|
|
43500
|
-
ensureOwnKeyCached();
|
|
43501
|
-
if (ownKey === key) {
|
|
43502
|
-
map = ownMap;
|
|
43503
|
-
}
|
|
43504
|
-
else {
|
|
43505
|
-
redirectsKeyToCache.set(key, { map: map = new ts.Map(), options: options });
|
|
43506
|
-
}
|
|
43507
|
-
}
|
|
43508
|
-
if (path || options.configFile)
|
|
43509
|
-
redirectsMap.set(path || options.configFile.path, map);
|
|
43510
|
-
return map;
|
|
43408
|
+
function setOwnOptions(newOptions) {
|
|
43409
|
+
options = newOptions;
|
|
43511
43410
|
}
|
|
43512
|
-
function
|
|
43513
|
-
|
|
43514
|
-
}
|
|
43515
|
-
function update(newOwnOptions) {
|
|
43516
|
-
// Store existing options:
|
|
43517
|
-
if (ownMap && (ownOptions === null || ownOptions === void 0 ? void 0 : ownOptions.configFile)) {
|
|
43518
|
-
ensureOwnKeyCached();
|
|
43519
|
-
if (!redirectsMap.has(ownOptions.configFile.path)) {
|
|
43520
|
-
redirectsMap.set(ownOptions.configFile.path, ownMap);
|
|
43521
|
-
}
|
|
43522
|
-
}
|
|
43523
|
-
// If this is already present use it
|
|
43524
|
-
if (newOwnOptions.configFile) {
|
|
43525
|
-
var existing_1 = redirectsMap.get(newOwnOptions.configFile.path);
|
|
43526
|
-
if (existing_1) {
|
|
43527
|
-
ownMap = existing_1;
|
|
43528
|
-
ownOptions = newOwnOptions;
|
|
43529
|
-
return;
|
|
43530
|
-
}
|
|
43531
|
-
}
|
|
43532
|
-
var key = getRedirectsCacheKey(newOwnOptions);
|
|
43533
|
-
var existing = redirectsKeyToCache.get(key);
|
|
43534
|
-
ownMap = (existing === null || existing === void 0 ? void 0 : existing.map) || new ts.Map();
|
|
43535
|
-
ownKey = key;
|
|
43536
|
-
ownOptions = newOwnOptions;
|
|
43537
|
-
if (newOwnOptions.configFile)
|
|
43538
|
-
redirectsMap.set(newOwnOptions.configFile.path, ownMap);
|
|
43411
|
+
function setOwnMap(newOwnMap) {
|
|
43412
|
+
ownMap = newOwnMap;
|
|
43539
43413
|
}
|
|
43540
|
-
function
|
|
43541
|
-
if (!redirectedReference)
|
|
43542
|
-
return ownMap;
|
|
43543
|
-
var directResult = redirectsMap.get(redirectedReference.sourceFile.path);
|
|
43544
|
-
if (directResult)
|
|
43545
|
-
return directResult;
|
|
43546
|
-
var key = getRedirectsCacheKey(redirectedReference.commandLine.options);
|
|
43547
|
-
var fromKey = redirectsKeyToCache.get(key);
|
|
43548
|
-
if (fromKey) {
|
|
43549
|
-
redirectsMap.set(redirectedReference.sourceFile.path, fromKey.map);
|
|
43550
|
-
return fromKey.map;
|
|
43551
|
-
}
|
|
43552
|
-
if (ownMap)
|
|
43553
|
-
ensureOwnKeyCached();
|
|
43554
|
-
if (ownKey === key) {
|
|
43555
|
-
redirectsMap.set(redirectedReference.sourceFile.path, ownMap);
|
|
43414
|
+
function getOrCreateMapOfCacheRedirects(redirectedReference) {
|
|
43415
|
+
if (!redirectedReference) {
|
|
43556
43416
|
return ownMap;
|
|
43557
43417
|
}
|
|
43558
|
-
|
|
43559
|
-
|
|
43560
|
-
|
|
43561
|
-
|
|
43562
|
-
|
|
43563
|
-
|
|
43418
|
+
var path = redirectedReference.sourceFile.path;
|
|
43419
|
+
var redirects = redirectsMap.get(path);
|
|
43420
|
+
if (!redirects) {
|
|
43421
|
+
// Reuse map if redirected reference map uses same resolution
|
|
43422
|
+
redirects = !options || ts.optionsHaveModuleResolutionChanges(options, redirectedReference.commandLine.options) ? new ts.Map() : ownMap;
|
|
43423
|
+
redirectsMap.set(path, redirects);
|
|
43424
|
+
}
|
|
43425
|
+
return redirects;
|
|
43564
43426
|
}
|
|
43565
43427
|
function clear() {
|
|
43566
|
-
|
|
43567
|
-
ownMap = undefined;
|
|
43428
|
+
ownMap.clear();
|
|
43568
43429
|
redirectsMap.clear();
|
|
43569
|
-
redirectsKeyToCache.clear();
|
|
43570
43430
|
}
|
|
43571
43431
|
}
|
|
43572
43432
|
ts.createCacheWithRedirects = createCacheWithRedirects;
|
|
43573
|
-
function createPackageJsonInfoCache(currentDirectory, getCanonicalFileName
|
|
43574
|
-
|
|
43433
|
+
function createPackageJsonInfoCache(currentDirectory, getCanonicalFileName) {
|
|
43434
|
+
var cache;
|
|
43435
|
+
return { getPackageJsonInfo: getPackageJsonInfo, setPackageJsonInfo: setPackageJsonInfo, clear: clear, entries: entries };
|
|
43575
43436
|
function getPackageJsonInfo(packageJsonPath) {
|
|
43576
43437
|
return cache === null || cache === void 0 ? void 0 : cache.get(ts.toPath(packageJsonPath, currentDirectory, getCanonicalFileName));
|
|
43577
43438
|
}
|
|
@@ -43585,9 +43446,6 @@ var ts;
|
|
|
43585
43446
|
var iter = cache === null || cache === void 0 ? void 0 : cache.entries();
|
|
43586
43447
|
return iter ? ts.arrayFrom(iter) : [];
|
|
43587
43448
|
}
|
|
43588
|
-
function clone() {
|
|
43589
|
-
return createPackageJsonInfoCache(currentDirectory, getCanonicalFileName, cache && new ts.Map(cache));
|
|
43590
|
-
}
|
|
43591
43449
|
}
|
|
43592
43450
|
function getOrCreateCache(cacheWithRedirects, redirectedReference, key, create) {
|
|
43593
43451
|
var cache = cacheWithRedirects.getOrCreateMapOfCacheRedirects(redirectedReference);
|
|
@@ -43598,43 +43456,47 @@ var ts;
|
|
|
43598
43456
|
}
|
|
43599
43457
|
return result;
|
|
43600
43458
|
}
|
|
43459
|
+
function updateRedirectsMap(options, directoryToModuleNameMap, moduleNameToDirectoryMap) {
|
|
43460
|
+
if (!options.configFile)
|
|
43461
|
+
return;
|
|
43462
|
+
if (directoryToModuleNameMap.redirectsMap.size === 0) {
|
|
43463
|
+
// The own map will be for projectCompilerOptions
|
|
43464
|
+
ts.Debug.assert(!moduleNameToDirectoryMap || moduleNameToDirectoryMap.redirectsMap.size === 0);
|
|
43465
|
+
ts.Debug.assert(directoryToModuleNameMap.getOwnMap().size === 0);
|
|
43466
|
+
ts.Debug.assert(!moduleNameToDirectoryMap || moduleNameToDirectoryMap.getOwnMap().size === 0);
|
|
43467
|
+
directoryToModuleNameMap.redirectsMap.set(options.configFile.path, directoryToModuleNameMap.getOwnMap());
|
|
43468
|
+
moduleNameToDirectoryMap === null || moduleNameToDirectoryMap === void 0 ? void 0 : moduleNameToDirectoryMap.redirectsMap.set(options.configFile.path, moduleNameToDirectoryMap.getOwnMap());
|
|
43469
|
+
}
|
|
43470
|
+
else {
|
|
43471
|
+
// Set correct own map
|
|
43472
|
+
ts.Debug.assert(!moduleNameToDirectoryMap || moduleNameToDirectoryMap.redirectsMap.size > 0);
|
|
43473
|
+
var ref = {
|
|
43474
|
+
sourceFile: options.configFile,
|
|
43475
|
+
commandLine: { options: options }
|
|
43476
|
+
};
|
|
43477
|
+
directoryToModuleNameMap.setOwnMap(directoryToModuleNameMap.getOrCreateMapOfCacheRedirects(ref));
|
|
43478
|
+
moduleNameToDirectoryMap === null || moduleNameToDirectoryMap === void 0 ? void 0 : moduleNameToDirectoryMap.setOwnMap(moduleNameToDirectoryMap.getOrCreateMapOfCacheRedirects(ref));
|
|
43479
|
+
}
|
|
43480
|
+
directoryToModuleNameMap.setOwnOptions(options);
|
|
43481
|
+
moduleNameToDirectoryMap === null || moduleNameToDirectoryMap === void 0 ? void 0 : moduleNameToDirectoryMap.setOwnOptions(options);
|
|
43482
|
+
}
|
|
43601
43483
|
function createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, directoryToModuleNameMap) {
|
|
43602
|
-
var oldResolutionCache;
|
|
43603
43484
|
return {
|
|
43604
|
-
getFromCache: getFromCache,
|
|
43605
43485
|
getOrCreateCacheForDirectory: getOrCreateCacheForDirectory,
|
|
43606
43486
|
clear: clear,
|
|
43607
43487
|
update: update,
|
|
43608
|
-
setOldResolutionCache: function (cache) { return oldResolutionCache = cache; }
|
|
43609
43488
|
};
|
|
43610
43489
|
function clear() {
|
|
43611
|
-
oldResolutionCache = undefined;
|
|
43612
43490
|
directoryToModuleNameMap.clear();
|
|
43613
43491
|
}
|
|
43614
43492
|
function update(options) {
|
|
43615
|
-
|
|
43493
|
+
updateRedirectsMap(options, directoryToModuleNameMap);
|
|
43616
43494
|
}
|
|
43617
43495
|
function getOrCreateCacheForDirectory(directoryName, redirectedReference) {
|
|
43618
43496
|
var path = ts.toPath(directoryName, currentDirectory, getCanonicalFileName);
|
|
43619
|
-
return getOrCreateCache(directoryToModuleNameMap, redirectedReference, path, createModeAwareCache);
|
|
43620
|
-
}
|
|
43621
|
-
function getFromCache(directoryName, name, mode, redirectedReference) {
|
|
43622
|
-
var _a, _b;
|
|
43623
|
-
var path = ts.toPath(directoryName, currentDirectory, getCanonicalFileName);
|
|
43624
|
-
var result = (_b = (_a = directoryToModuleNameMap.getMapOfCacheRedirects(redirectedReference)) === null || _a === void 0 ? void 0 : _a.get(path)) === null || _b === void 0 ? void 0 : _b.get(name, mode);
|
|
43625
|
-
if (result)
|
|
43626
|
-
return result;
|
|
43627
|
-
var resultFromOld = oldResolutionCache === null || oldResolutionCache === void 0 ? void 0 : oldResolutionCache.getResolved(path, name, mode, redirectedReference);
|
|
43628
|
-
if (resultFromOld)
|
|
43629
|
-
getOrCreateCacheForDirectory(directoryName, redirectedReference).set(name, mode, resultFromOld);
|
|
43630
|
-
return resultFromOld;
|
|
43497
|
+
return getOrCreateCache(directoryToModuleNameMap, redirectedReference, path, function () { return createModeAwareCache(); });
|
|
43631
43498
|
}
|
|
43632
43499
|
}
|
|
43633
|
-
/*@internal*/
|
|
43634
|
-
function getModeAwareCacheKey(specifier, mode) {
|
|
43635
|
-
return (mode === undefined ? specifier : mode + "|" + specifier);
|
|
43636
|
-
}
|
|
43637
|
-
ts.getModeAwareCacheKey = getModeAwareCacheKey;
|
|
43638
43500
|
/* @internal */
|
|
43639
43501
|
function createModeAwareCache() {
|
|
43640
43502
|
var underlying = new ts.Map();
|
|
@@ -43660,22 +43522,13 @@ var ts;
|
|
|
43660
43522
|
return cb(elem, specifier, mode);
|
|
43661
43523
|
});
|
|
43662
43524
|
},
|
|
43663
|
-
entries: function () {
|
|
43664
|
-
var keys = underlying.entries();
|
|
43665
|
-
return {
|
|
43666
|
-
next: function () {
|
|
43667
|
-
var next = keys.next();
|
|
43668
|
-
return !next.done ? { value: __spreadArray(__spreadArray([], memoizedReverseKeys.get(next.value[0]), true), [next.value[1]], false) } : next;
|
|
43669
|
-
},
|
|
43670
|
-
};
|
|
43671
|
-
},
|
|
43672
43525
|
size: function () {
|
|
43673
43526
|
return underlying.size;
|
|
43674
|
-
}
|
|
43527
|
+
}
|
|
43675
43528
|
};
|
|
43676
43529
|
return cache;
|
|
43677
43530
|
function getUnderlyingCacheKey(specifier, mode) {
|
|
43678
|
-
var result =
|
|
43531
|
+
var result = mode === undefined ? specifier : mode + "|" + specifier;
|
|
43679
43532
|
memoizedReverseKeys.set(result, [specifier, mode]);
|
|
43680
43533
|
return result;
|
|
43681
43534
|
}
|
|
@@ -43688,121 +43541,35 @@ var ts;
|
|
|
43688
43541
|
for (var i = 0; i < keys.length; ++i) {
|
|
43689
43542
|
var entry = keys[i];
|
|
43690
43543
|
// We lower-case all type references because npm automatically lowercases all packages. See GH#9824.
|
|
43691
|
-
var name = !ts.isString(entry) ?
|
|
43544
|
+
var name = !ts.isString(entry) ? entry.fileName.toLowerCase() : entry;
|
|
43692
43545
|
var mode = !ts.isString(entry) ? entry.resolutionMode || file.impliedNodeFormat : ts.getModeForResolutionAtIndex(file, i);
|
|
43693
43546
|
map.set(name, mode, values[i]);
|
|
43694
43547
|
}
|
|
43695
43548
|
return map;
|
|
43696
43549
|
}
|
|
43697
43550
|
ts.zipToModeAwareCache = zipToModeAwareCache;
|
|
43698
|
-
function
|
|
43699
|
-
var
|
|
43700
|
-
|
|
43701
|
-
var i = 0;
|
|
43702
|
-
var limit = Math.min(directory.length, resolutionDirectory.length);
|
|
43703
|
-
while (i < limit && directory.charCodeAt(i) === resolutionDirectory.charCodeAt(i)) {
|
|
43704
|
-
i++;
|
|
43705
|
-
}
|
|
43706
|
-
if (i === directory.length && (resolutionDirectory.length === i || resolutionDirectory[i] === ts.directorySeparator)) {
|
|
43707
|
-
return directory;
|
|
43708
|
-
}
|
|
43709
|
-
var rootLength = ts.getRootLength(directory);
|
|
43710
|
-
if (i < rootLength) {
|
|
43711
|
-
return undefined;
|
|
43712
|
-
}
|
|
43713
|
-
var sep = directory.lastIndexOf(ts.directorySeparator, i - 1);
|
|
43714
|
-
if (sep === -1) {
|
|
43715
|
-
return undefined;
|
|
43716
|
-
}
|
|
43717
|
-
return directory.substr(0, Math.max(sep, rootLength));
|
|
43718
|
-
}
|
|
43719
|
-
/*@internal*/
|
|
43720
|
-
function getResolvedFileNameForModuleNameToDirectorySet(result) {
|
|
43721
|
-
return result.resolvedModule &&
|
|
43722
|
-
(result.resolvedModule.originalPath || result.resolvedModule.resolvedFileName);
|
|
43723
|
-
}
|
|
43724
|
-
ts.getResolvedFileNameForModuleNameToDirectorySet = getResolvedFileNameForModuleNameToDirectorySet;
|
|
43725
|
-
/**
|
|
43726
|
-
* At first this function add entry directory -> module resolution result to the table.
|
|
43727
|
-
* Then it computes the set of parent folders for 'directory' that should have the same module resolution result
|
|
43728
|
-
* and for every parent folder in set it adds entry: parent -> module resolution. .
|
|
43729
|
-
* Lets say we first directory name: /a/b/c/d/e and resolution result is: /a/b/bar.ts.
|
|
43730
|
-
* Set of parent folders that should have the same result will be:
|
|
43731
|
-
* [
|
|
43732
|
-
* /a/b/c/d, /a/b/c, /a/b
|
|
43733
|
-
* ]
|
|
43734
|
-
* this means that request for module resolution from file in any of these folder will be immediately found in cache.
|
|
43735
|
-
*/
|
|
43736
|
-
/*@internal*/
|
|
43737
|
-
function moduleNameToDirectorySet(directoryPathMap, directory, result, getResolvedFileName, toPath, ancestoryWorker) {
|
|
43738
|
-
// if entry is already in cache do nothing
|
|
43739
|
-
if (directoryPathMap.has(directory))
|
|
43740
|
-
return;
|
|
43741
|
-
directoryPathMap.set(directory, result);
|
|
43742
|
-
var resolvedFileName = getResolvedFileName(result);
|
|
43743
|
-
// find common prefix between directory and resolved file name
|
|
43744
|
-
// this common prefix should be the shortest path that has the same resolution
|
|
43745
|
-
// directory: /a/b/c/d/e
|
|
43746
|
-
// resolvedFileName: /a/b/foo.d.ts
|
|
43747
|
-
// commonPrefix: /a/b
|
|
43748
|
-
// for failed lookups cache the result for every directory up to root
|
|
43749
|
-
var commonPrefix = resolvedFileName && getCommonPrefix(directory, resolvedFileName, toPath);
|
|
43750
|
-
var current = directory;
|
|
43751
|
-
while (current !== commonPrefix) {
|
|
43752
|
-
var parent = ts.getDirectoryPath(current);
|
|
43753
|
-
if (parent === current)
|
|
43754
|
-
break;
|
|
43755
|
-
if (directoryPathMap.has(parent)) {
|
|
43756
|
-
ancestoryWorker(parent);
|
|
43757
|
-
break;
|
|
43758
|
-
}
|
|
43759
|
-
directoryPathMap.set(parent, result);
|
|
43760
|
-
ancestoryWorker(parent);
|
|
43761
|
-
current = parent;
|
|
43762
|
-
}
|
|
43763
|
-
}
|
|
43764
|
-
ts.moduleNameToDirectorySet = moduleNameToDirectorySet;
|
|
43765
|
-
function createModuleResolutionCache(currentDirectory, getCanonicalFileName, options) {
|
|
43766
|
-
var directoryToModuleNameMap = createCacheWithRedirects(options);
|
|
43767
|
-
var moduleNameToDirectoryMap = createCacheWithRedirects(options);
|
|
43768
|
-
var perDirectoryResolutionCache = createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, directoryToModuleNameMap);
|
|
43551
|
+
function createModuleResolutionCache(currentDirectory, getCanonicalFileName, options, directoryToModuleNameMap, moduleNameToDirectoryMap) {
|
|
43552
|
+
var preDirectoryResolutionCache = createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, directoryToModuleNameMap || (directoryToModuleNameMap = createCacheWithRedirects(options)));
|
|
43553
|
+
moduleNameToDirectoryMap || (moduleNameToDirectoryMap = createCacheWithRedirects(options));
|
|
43769
43554
|
var packageJsonInfoCache = createPackageJsonInfoCache(currentDirectory, getCanonicalFileName);
|
|
43770
|
-
|
|
43771
|
-
return __assign(__assign(__assign({}, packageJsonInfoCache), perDirectoryResolutionCache), { getOrCreateCacheForModuleName: getOrCreateCacheForModuleName, getFromModuleNameCache: getFromModuleNameCache, clear: clear, update: update, getPackageJsonInfoCache: function () { return packageJsonInfoCache; }, setOldResolutionCache: setOldResolutionCache });
|
|
43555
|
+
return __assign(__assign(__assign({}, packageJsonInfoCache), preDirectoryResolutionCache), { getOrCreateCacheForModuleName: getOrCreateCacheForModuleName, clear: clear, update: update, getPackageJsonInfoCache: function () { return packageJsonInfoCache; } });
|
|
43772
43556
|
function clear() {
|
|
43773
|
-
|
|
43774
|
-
perDirectoryResolutionCache.clear();
|
|
43557
|
+
preDirectoryResolutionCache.clear();
|
|
43775
43558
|
moduleNameToDirectoryMap.clear();
|
|
43776
43559
|
packageJsonInfoCache.clear();
|
|
43777
43560
|
}
|
|
43778
43561
|
function update(options) {
|
|
43779
|
-
|
|
43780
|
-
moduleNameToDirectoryMap.update(options);
|
|
43781
|
-
}
|
|
43782
|
-
function setOldResolutionCache(cache) {
|
|
43783
|
-
oldResolutionCache = cache;
|
|
43784
|
-
perDirectoryResolutionCache.setOldResolutionCache(cache);
|
|
43785
|
-
}
|
|
43786
|
-
function getFromModuleNameCache(directoryName, nonRelativeModuleName, mode, redirectedReference) {
|
|
43787
|
-
var _a, _b;
|
|
43788
|
-
ts.Debug.assert(!ts.isExternalModuleNameRelative(nonRelativeModuleName));
|
|
43789
|
-
var result = (_b = (_a = moduleNameToDirectoryMap.getMapOfCacheRedirects(redirectedReference)) === null || _a === void 0 ? void 0 : _a.get(getModeAwareCacheKey(nonRelativeModuleName, mode))) === null || _b === void 0 ? void 0 : _b.get(directoryName);
|
|
43790
|
-
if (result)
|
|
43791
|
-
return result;
|
|
43792
|
-
var fromOld = oldResolutionCache === null || oldResolutionCache === void 0 ? void 0 : oldResolutionCache.getResolved(toPath(directoryName), nonRelativeModuleName, mode, redirectedReference);
|
|
43793
|
-
if (fromOld)
|
|
43794
|
-
getOrCreateCacheForModuleName(nonRelativeModuleName, mode, redirectedReference).set(directoryName, fromOld);
|
|
43795
|
-
return fromOld;
|
|
43562
|
+
updateRedirectsMap(options, directoryToModuleNameMap, moduleNameToDirectoryMap);
|
|
43796
43563
|
}
|
|
43797
43564
|
function getOrCreateCacheForModuleName(nonRelativeModuleName, mode, redirectedReference) {
|
|
43798
43565
|
ts.Debug.assert(!ts.isExternalModuleNameRelative(nonRelativeModuleName));
|
|
43799
|
-
return getOrCreateCache(moduleNameToDirectoryMap, redirectedReference,
|
|
43566
|
+
return getOrCreateCache(moduleNameToDirectoryMap, redirectedReference, mode === undefined ? nonRelativeModuleName : mode + "|" + nonRelativeModuleName, createPerModuleNameCache);
|
|
43800
43567
|
}
|
|
43801
43568
|
function createPerModuleNameCache() {
|
|
43802
43569
|
var directoryPathMap = new ts.Map();
|
|
43803
43570
|
return { get: get, set: set };
|
|
43804
43571
|
function get(directory) {
|
|
43805
|
-
return directoryPathMap.get(toPath(directory));
|
|
43572
|
+
return directoryPathMap.get(ts.toPath(directory, currentDirectory, getCanonicalFileName));
|
|
43806
43573
|
}
|
|
43807
43574
|
/**
|
|
43808
43575
|
* At first this function add entry directory -> module resolution result to the table.
|
|
@@ -43816,17 +43583,57 @@ var ts;
|
|
|
43816
43583
|
* this means that request for module resolution from file in any of these folder will be immediately found in cache.
|
|
43817
43584
|
*/
|
|
43818
43585
|
function set(directory, result) {
|
|
43819
|
-
|
|
43586
|
+
var path = ts.toPath(directory, currentDirectory, getCanonicalFileName);
|
|
43587
|
+
// if entry is already in cache do nothing
|
|
43588
|
+
if (directoryPathMap.has(path)) {
|
|
43589
|
+
return;
|
|
43590
|
+
}
|
|
43591
|
+
directoryPathMap.set(path, result);
|
|
43592
|
+
var resolvedFileName = result.resolvedModule &&
|
|
43593
|
+
(result.resolvedModule.originalPath || result.resolvedModule.resolvedFileName);
|
|
43594
|
+
// find common prefix between directory and resolved file name
|
|
43595
|
+
// this common prefix should be the shortest path that has the same resolution
|
|
43596
|
+
// directory: /a/b/c/d/e
|
|
43597
|
+
// resolvedFileName: /a/b/foo.d.ts
|
|
43598
|
+
// commonPrefix: /a/b
|
|
43599
|
+
// for failed lookups cache the result for every directory up to root
|
|
43600
|
+
var commonPrefix = resolvedFileName && getCommonPrefix(path, resolvedFileName);
|
|
43601
|
+
var current = path;
|
|
43602
|
+
while (current !== commonPrefix) {
|
|
43603
|
+
var parent = ts.getDirectoryPath(current);
|
|
43604
|
+
if (parent === current || directoryPathMap.has(parent)) {
|
|
43605
|
+
break;
|
|
43606
|
+
}
|
|
43607
|
+
directoryPathMap.set(parent, result);
|
|
43608
|
+
current = parent;
|
|
43609
|
+
}
|
|
43610
|
+
}
|
|
43611
|
+
function getCommonPrefix(directory, resolution) {
|
|
43612
|
+
var resolutionDirectory = ts.toPath(ts.getDirectoryPath(resolution), currentDirectory, getCanonicalFileName);
|
|
43613
|
+
// find first position where directory and resolution differs
|
|
43614
|
+
var i = 0;
|
|
43615
|
+
var limit = Math.min(directory.length, resolutionDirectory.length);
|
|
43616
|
+
while (i < limit && directory.charCodeAt(i) === resolutionDirectory.charCodeAt(i)) {
|
|
43617
|
+
i++;
|
|
43618
|
+
}
|
|
43619
|
+
if (i === directory.length && (resolutionDirectory.length === i || resolutionDirectory[i] === ts.directorySeparator)) {
|
|
43620
|
+
return directory;
|
|
43621
|
+
}
|
|
43622
|
+
var rootLength = ts.getRootLength(directory);
|
|
43623
|
+
if (i < rootLength) {
|
|
43624
|
+
return undefined;
|
|
43625
|
+
}
|
|
43626
|
+
var sep = directory.lastIndexOf(ts.directorySeparator, i - 1);
|
|
43627
|
+
if (sep === -1) {
|
|
43628
|
+
return undefined;
|
|
43629
|
+
}
|
|
43630
|
+
return directory.substr(0, Math.max(sep, rootLength));
|
|
43820
43631
|
}
|
|
43821
|
-
}
|
|
43822
|
-
function toPath(fileName) {
|
|
43823
|
-
return ts.toPath(fileName, currentDirectory, getCanonicalFileName);
|
|
43824
43632
|
}
|
|
43825
43633
|
}
|
|
43826
43634
|
ts.createModuleResolutionCache = createModuleResolutionCache;
|
|
43827
|
-
function createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, options, packageJsonInfoCache) {
|
|
43828
|
-
var directoryToModuleNameMap = createCacheWithRedirects(options);
|
|
43829
|
-
var preDirectoryResolutionCache = createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, directoryToModuleNameMap);
|
|
43635
|
+
function createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, options, packageJsonInfoCache, directoryToModuleNameMap) {
|
|
43636
|
+
var preDirectoryResolutionCache = createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, directoryToModuleNameMap || (directoryToModuleNameMap = createCacheWithRedirects(options)));
|
|
43830
43637
|
packageJsonInfoCache || (packageJsonInfoCache = createPackageJsonInfoCache(currentDirectory, getCanonicalFileName));
|
|
43831
43638
|
return __assign(__assign(__assign({}, packageJsonInfoCache), preDirectoryResolutionCache), { clear: clear });
|
|
43832
43639
|
function clear() {
|
|
@@ -43837,7 +43644,10 @@ var ts;
|
|
|
43837
43644
|
ts.createTypeReferenceDirectiveResolutionCache = createTypeReferenceDirectiveResolutionCache;
|
|
43838
43645
|
function resolveModuleNameFromCache(moduleName, containingFile, cache, mode) {
|
|
43839
43646
|
var containingDirectory = ts.getDirectoryPath(containingFile);
|
|
43840
|
-
|
|
43647
|
+
var perFolderCache = cache && cache.getOrCreateCacheForDirectory(containingDirectory);
|
|
43648
|
+
if (!perFolderCache)
|
|
43649
|
+
return undefined;
|
|
43650
|
+
return perFolderCache.get(moduleName, mode);
|
|
43841
43651
|
}
|
|
43842
43652
|
ts.resolveModuleNameFromCache = resolveModuleNameFromCache;
|
|
43843
43653
|
function resolveModuleName(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
@@ -43852,7 +43662,8 @@ var ts;
|
|
|
43852
43662
|
}
|
|
43853
43663
|
}
|
|
43854
43664
|
var containingDirectory = ts.getDirectoryPath(containingFile);
|
|
43855
|
-
var
|
|
43665
|
+
var perFolderCache = cache && cache.getOrCreateCacheForDirectory(containingDirectory, redirectedReference);
|
|
43666
|
+
var result = perFolderCache && perFolderCache.get(moduleName, resolutionMode);
|
|
43856
43667
|
if (result) {
|
|
43857
43668
|
if (traceEnabled) {
|
|
43858
43669
|
trace(host, ts.Diagnostics.Resolution_for_module_0_was_found_in_cache_from_location_1, moduleName, containingDirectory);
|
|
@@ -43904,8 +43715,8 @@ var ts;
|
|
|
43904
43715
|
if (result && result.resolvedModule)
|
|
43905
43716
|
ts.perfLogger.logInfoEvent("Module \"" + moduleName + "\" resolved to \"" + result.resolvedModule.resolvedFileName + "\"");
|
|
43906
43717
|
ts.perfLogger.logStopResolveModule((result && result.resolvedModule) ? "" + result.resolvedModule.resolvedFileName : "null");
|
|
43907
|
-
if (
|
|
43908
|
-
|
|
43718
|
+
if (perFolderCache) {
|
|
43719
|
+
perFolderCache.set(moduleName, resolutionMode, result);
|
|
43909
43720
|
if (!ts.isExternalModuleNameRelative(moduleName)) {
|
|
43910
43721
|
// put result in per-module name cache
|
|
43911
43722
|
cache.getOrCreateCacheForModuleName(moduleName, resolutionMode, redirectedReference).set(containingDirectory, result);
|
|
@@ -44191,10 +44002,10 @@ var ts;
|
|
|
44191
44002
|
features: features,
|
|
44192
44003
|
conditions: conditions,
|
|
44193
44004
|
requestContainingDirectory: containingDirectory,
|
|
44194
|
-
|
|
44005
|
+
reportDiagnostic: function (diag) { return void diagnostics.push(diag); },
|
|
44195
44006
|
};
|
|
44196
44007
|
var result = ts.forEach(extensions, function (ext) { return tryResolve(ext); });
|
|
44197
|
-
return createResolvedModuleWithFailedLookupLocations(
|
|
44008
|
+
return createResolvedModuleWithFailedLookupLocations((_a = result === null || result === void 0 ? void 0 : result.value) === null || _a === void 0 ? void 0 : _a.resolved, (_b = result === null || result === void 0 ? void 0 : result.value) === null || _b === void 0 ? void 0 : _b.isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, state.resultFromCache);
|
|
44198
44009
|
function tryResolve(extensions) {
|
|
44199
44010
|
var loader = function (extensions, candidate, onlyRecordFailures, state) { return nodeLoadModuleByRelativeName(extensions, candidate, onlyRecordFailures, state, /*considerPackageJson*/ true); };
|
|
44200
44011
|
var resolved = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loader, state);
|
|
@@ -44571,7 +44382,7 @@ var ts;
|
|
|
44571
44382
|
features: NodeResolutionFeatures.None,
|
|
44572
44383
|
conditions: ts.emptyArray,
|
|
44573
44384
|
requestContainingDirectory: undefined,
|
|
44574
|
-
|
|
44385
|
+
reportDiagnostic: ts.noop
|
|
44575
44386
|
};
|
|
44576
44387
|
}
|
|
44577
44388
|
ts.getTemporaryModuleResolutionState = getTemporaryModuleResolutionState;
|
|
@@ -44618,13 +44429,12 @@ var ts;
|
|
|
44618
44429
|
}
|
|
44619
44430
|
var directoryExists = ts.directoryProbablyExists(packageDirectory, host);
|
|
44620
44431
|
if (directoryExists && host.fileExists(packageJsonPath)) {
|
|
44621
|
-
var
|
|
44622
|
-
var packageJsonContent = ts.readJsonIgnoringErrorsFromText(packageJsonPath, packageJsonText);
|
|
44432
|
+
var packageJsonContent = ts.readJson(packageJsonPath, host);
|
|
44623
44433
|
if (traceEnabled) {
|
|
44624
44434
|
trace(host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath);
|
|
44625
44435
|
}
|
|
44626
44436
|
var versionPaths = readPackageJsonTypesVersionPaths(packageJsonContent, state);
|
|
44627
|
-
var result = { packageDirectory: packageDirectory,
|
|
44437
|
+
var result = { packageDirectory: packageDirectory, packageJsonContent: packageJsonContent, versionPaths: versionPaths, resolvedEntrypoints: undefined };
|
|
44628
44438
|
(_b = state.packageJsonInfoCache) === null || _b === void 0 ? void 0 : _b.setPackageJsonInfo(packageJsonPath, result);
|
|
44629
44439
|
state.affectingLocations.push(packageJsonPath);
|
|
44630
44440
|
return result;
|
|
@@ -45049,8 +44859,12 @@ var ts;
|
|
|
45049
44859
|
fragment = ts.ensureTrailingDirectorySeparator(commonDir_1);
|
|
45050
44860
|
}
|
|
45051
44861
|
}
|
|
45052
|
-
if (commonSourceDirGuesses.length > 1)
|
|
45053
|
-
state.
|
|
44862
|
+
if (commonSourceDirGuesses.length > 1) {
|
|
44863
|
+
state.reportDiagnostic(ts.createCompilerDiagnostic(isImports
|
|
44864
|
+
? ts.Diagnostics.The_project_root_is_ambiguous_but_is_required_to_resolve_import_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate
|
|
44865
|
+
: ts.Diagnostics.The_project_root_is_ambiguous_but_is_required_to_resolve_export_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate, entry === "" ? "." : entry, // replace empty string with `.` - the reverse of the operation done when entries are built - so main entrypoint errors don't look weird
|
|
44866
|
+
packagePath));
|
|
44867
|
+
}
|
|
45054
44868
|
for (var _i = 0, commonSourceDirGuesses_1 = commonSourceDirGuesses; _i < commonSourceDirGuesses_1.length; _i++) {
|
|
45055
44869
|
var commonSourceDirGuess = commonSourceDirGuesses_1[_i];
|
|
45056
44870
|
var candidateDirectories = getOutputDirectoriesForBaseDirectory(commonSourceDirGuess);
|
|
@@ -45120,10 +44934,10 @@ var ts;
|
|
|
45120
44934
|
return loadModuleFromNearestNodeModulesDirectoryWorker(Extensions.DtsOnly, moduleName, directory, state, /*typesScopeOnly*/ true, /*cache*/ undefined, /*redirectedReference*/ undefined);
|
|
45121
44935
|
}
|
|
45122
44936
|
function loadModuleFromNearestNodeModulesDirectoryWorker(extensions, moduleName, directory, state, typesScopeOnly, cache, redirectedReference) {
|
|
45123
|
-
var
|
|
44937
|
+
var perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName, state.features === 0 ? undefined : state.features & NodeResolutionFeatures.EsmMode ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS, redirectedReference);
|
|
45124
44938
|
return ts.forEachAncestorDirectory(ts.normalizeSlashes(directory), function (ancestorDirectory) {
|
|
45125
44939
|
if (ts.getBaseFileName(ancestorDirectory) !== "node_modules") {
|
|
45126
|
-
var resolutionFromCache = tryFindNonRelativeModuleNameInCache(
|
|
44940
|
+
var resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache, moduleName, ancestorDirectory, state);
|
|
45127
44941
|
if (resolutionFromCache) {
|
|
45128
44942
|
return resolutionFromCache;
|
|
45129
44943
|
}
|
|
@@ -45275,8 +45089,8 @@ var ts;
|
|
|
45275
45089
|
typesPackageName;
|
|
45276
45090
|
}
|
|
45277
45091
|
ts.unmangleScopedPackageName = unmangleScopedPackageName;
|
|
45278
|
-
function tryFindNonRelativeModuleNameInCache(cache, moduleName,
|
|
45279
|
-
var result = cache
|
|
45092
|
+
function tryFindNonRelativeModuleNameInCache(cache, moduleName, containingDirectory, state) {
|
|
45093
|
+
var result = cache && cache.get(containingDirectory);
|
|
45280
45094
|
if (result) {
|
|
45281
45095
|
if (state.traceEnabled) {
|
|
45282
45096
|
trace(state.host, ts.Diagnostics.Resolution_for_module_0_was_found_in_cache_from_location_1, moduleName, containingDirectory);
|
|
@@ -45301,11 +45115,11 @@ var ts;
|
|
|
45301
45115
|
features: NodeResolutionFeatures.None,
|
|
45302
45116
|
conditions: [],
|
|
45303
45117
|
requestContainingDirectory: containingDirectory,
|
|
45304
|
-
|
|
45118
|
+
reportDiagnostic: function (diag) { return void diagnostics.push(diag); },
|
|
45305
45119
|
};
|
|
45306
45120
|
var resolved = tryResolve(Extensions.TypeScript) || tryResolve(Extensions.JavaScript);
|
|
45307
45121
|
// No originalPath because classic resolution doesn't resolve realPath
|
|
45308
|
-
return createResolvedModuleWithFailedLookupLocations(
|
|
45122
|
+
return createResolvedModuleWithFailedLookupLocations(resolved && resolved.value,
|
|
45309
45123
|
/*isExternalLibraryImport*/ false, failedLookupLocations, affectingLocations, diagnostics, state.resultFromCache);
|
|
45310
45124
|
function tryResolve(extensions) {
|
|
45311
45125
|
var resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFileNoPackageId, state);
|
|
@@ -45313,9 +45127,10 @@ var ts;
|
|
|
45313
45127
|
return { value: resolvedUsingSettings };
|
|
45314
45128
|
}
|
|
45315
45129
|
if (!ts.isExternalModuleNameRelative(moduleName)) {
|
|
45130
|
+
var perModuleNameCache_1 = cache && cache.getOrCreateCacheForModuleName(moduleName, /*mode*/ undefined, redirectedReference);
|
|
45316
45131
|
// Climb up parent directories looking for a module.
|
|
45317
45132
|
var resolved_3 = ts.forEachAncestorDirectory(containingDirectory, function (directory) {
|
|
45318
|
-
var resolutionFromCache = tryFindNonRelativeModuleNameInCache(
|
|
45133
|
+
var resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache_1, moduleName, directory, state);
|
|
45319
45134
|
if (resolutionFromCache) {
|
|
45320
45135
|
return resolutionFromCache;
|
|
45321
45136
|
}
|
|
@@ -45360,10 +45175,10 @@ var ts;
|
|
|
45360
45175
|
features: NodeResolutionFeatures.None,
|
|
45361
45176
|
conditions: [],
|
|
45362
45177
|
requestContainingDirectory: undefined,
|
|
45363
|
-
|
|
45178
|
+
reportDiagnostic: function (diag) { return void diagnostics.push(diag); },
|
|
45364
45179
|
};
|
|
45365
45180
|
var resolved = loadModuleFromImmediateNodeModulesDirectory(Extensions.DtsOnly, moduleName, globalCache, state, /*typesScopeOnly*/ false, /*cache*/ undefined, /*redirectedReference*/ undefined);
|
|
45366
|
-
return createResolvedModuleWithFailedLookupLocations(
|
|
45181
|
+
return createResolvedModuleWithFailedLookupLocations(resolved,
|
|
45367
45182
|
/*isExternalLibraryImport*/ true, failedLookupLocations, affectingLocations, diagnostics, state.resultFromCache);
|
|
45368
45183
|
}
|
|
45369
45184
|
ts.loadModuleFromGlobalCache = loadModuleFromGlobalCache;
|
|
@@ -49049,10 +48864,9 @@ var ts;
|
|
|
49049
48864
|
host.getSourceFiles().forEach(function (sf) {
|
|
49050
48865
|
if (!sf.resolvedModules)
|
|
49051
48866
|
return;
|
|
49052
|
-
sf.resolvedModules.forEach(function (
|
|
49053
|
-
|
|
49054
|
-
|
|
49055
|
-
map.set(resolvedModule.packageId.name, resolvedModule.extension === ".d.ts" /* Dts */ || !!map.get(resolvedModule.packageId.name));
|
|
48867
|
+
sf.resolvedModules.forEach(function (r) {
|
|
48868
|
+
if (r && r.packageId)
|
|
48869
|
+
map.set(r.packageId.name, r.extension === ".d.ts" /* Dts */ || !!map.get(r.packageId.name));
|
|
49056
48870
|
});
|
|
49057
48871
|
});
|
|
49058
48872
|
return map;
|
|
@@ -88507,12 +88321,11 @@ var ts;
|
|
|
88507
88321
|
if (resolvedTypeReferenceDirectives) {
|
|
88508
88322
|
// populate reverse mapping: file path -> type reference directive that was resolved to this file
|
|
88509
88323
|
fileToDirective = new ts.Map();
|
|
88510
|
-
resolvedTypeReferenceDirectives.forEach(function (
|
|
88511
|
-
|
|
88512
|
-
if (!resolvedTypeReferenceDirective || !resolvedTypeReferenceDirective.resolvedFileName) {
|
|
88324
|
+
resolvedTypeReferenceDirectives.forEach(function (resolvedDirective, key, mode) {
|
|
88325
|
+
if (!resolvedDirective || !resolvedDirective.resolvedFileName) {
|
|
88513
88326
|
return;
|
|
88514
88327
|
}
|
|
88515
|
-
var file = host.getSourceFile(
|
|
88328
|
+
var file = host.getSourceFile(resolvedDirective.resolvedFileName);
|
|
88516
88329
|
if (file) {
|
|
88517
88330
|
// Add the transitive closure of path references loaded by this file (as long as they are not)
|
|
88518
88331
|
// part of an existing type reference.
|
|
@@ -111984,7 +111797,7 @@ var ts;
|
|
|
111984
111797
|
var sourceMap = sourceMapGenerator.toString();
|
|
111985
111798
|
ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap, /*writeByteOrderMark*/ false, sourceFiles);
|
|
111986
111799
|
if (printer.bundleFileInfo)
|
|
111987
|
-
printer.bundleFileInfo.mapHash = ts.computeSignature(sourceMap, host);
|
|
111800
|
+
printer.bundleFileInfo.mapHash = ts.computeSignature(sourceMap, ts.maybeBind(host, host.createHash));
|
|
111988
111801
|
}
|
|
111989
111802
|
}
|
|
111990
111803
|
else {
|
|
@@ -111996,7 +111809,7 @@ var ts;
|
|
|
111996
111809
|
// We store the hash of the text written in the buildinfo to ensure that text of the referenced d.ts file is same as whats in the buildinfo
|
|
111997
111810
|
// This is needed because incremental can be toggled between two runs and we might use stale file text to do text manipulation in prepend mode
|
|
111998
111811
|
if (printer.bundleFileInfo)
|
|
111999
|
-
printer.bundleFileInfo.hash = ts.computeSignature(text, host);
|
|
111812
|
+
printer.bundleFileInfo.hash = ts.computeSignature(text, ts.maybeBind(host, host.createHash));
|
|
112000
111813
|
// Reset state
|
|
112001
111814
|
writer.clear();
|
|
112002
111815
|
}
|
|
@@ -112139,6 +111952,7 @@ var ts;
|
|
|
112139
111952
|
}
|
|
112140
111953
|
/*@internal*/
|
|
112141
111954
|
function emitUsingBuildInfo(config, host, getCommandLine, customTransformers) {
|
|
111955
|
+
var createHash = ts.maybeBind(host, host.createHash);
|
|
112142
111956
|
var _a = getOutputPathsForBundle(config.options, /*forceDtsPaths*/ false), buildInfoPath = _a.buildInfoPath, jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath;
|
|
112143
111957
|
var buildInfo;
|
|
112144
111958
|
if (host.getBuildInfo) {
|
|
@@ -112160,25 +111974,25 @@ var ts;
|
|
|
112160
111974
|
if (!jsFileText)
|
|
112161
111975
|
return jsFilePath;
|
|
112162
111976
|
// If the jsFileText is not same has what it was created with, tsbuildinfo is stale so dont use it
|
|
112163
|
-
if (ts.computeSignature(jsFileText,
|
|
111977
|
+
if (ts.computeSignature(jsFileText, createHash) !== buildInfo.bundle.js.hash)
|
|
112164
111978
|
return jsFilePath;
|
|
112165
111979
|
var sourceMapText = sourceMapFilePath && host.readFile(sourceMapFilePath);
|
|
112166
111980
|
// error if no source map or for now if inline sourcemap
|
|
112167
111981
|
if ((sourceMapFilePath && !sourceMapText) || config.options.inlineSourceMap)
|
|
112168
111982
|
return sourceMapFilePath || "inline sourcemap decoding";
|
|
112169
|
-
if (sourceMapFilePath && ts.computeSignature(sourceMapText,
|
|
111983
|
+
if (sourceMapFilePath && ts.computeSignature(sourceMapText, createHash) !== buildInfo.bundle.js.mapHash)
|
|
112170
111984
|
return sourceMapFilePath;
|
|
112171
111985
|
// read declaration text
|
|
112172
111986
|
var declarationText = declarationFilePath && host.readFile(declarationFilePath);
|
|
112173
111987
|
if (declarationFilePath && !declarationText)
|
|
112174
111988
|
return declarationFilePath;
|
|
112175
|
-
if (declarationFilePath && ts.computeSignature(declarationText,
|
|
111989
|
+
if (declarationFilePath && ts.computeSignature(declarationText, createHash) !== buildInfo.bundle.dts.hash)
|
|
112176
111990
|
return declarationFilePath;
|
|
112177
111991
|
var declarationMapText = declarationMapPath && host.readFile(declarationMapPath);
|
|
112178
111992
|
// error if no source map or for now if inline sourcemap
|
|
112179
111993
|
if ((declarationMapPath && !declarationMapText) || config.options.inlineSourceMap)
|
|
112180
111994
|
return declarationMapPath || "inline sourcemap decoding";
|
|
112181
|
-
if (declarationMapPath && ts.computeSignature(declarationMapText,
|
|
111995
|
+
if (declarationMapPath && ts.computeSignature(declarationMapText, createHash) !== buildInfo.bundle.dts.mapHash)
|
|
112182
111996
|
return declarationMapPath;
|
|
112183
111997
|
var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
|
|
112184
111998
|
var ownPrependInput = ts.createInputFiles(jsFileText, declarationText, sourceMapFilePath, sourceMapText, declarationMapPath, declarationMapText, jsFilePath, declarationFilePath, buildInfoPath, buildInfo,
|
|
@@ -112218,7 +112032,7 @@ var ts;
|
|
|
112218
112032
|
newBuildInfo.program = buildInfo.program;
|
|
112219
112033
|
if (newBuildInfo.program && changedDtsText !== undefined && config.options.composite) {
|
|
112220
112034
|
// Update the output signature
|
|
112221
|
-
newBuildInfo.program.outSignature = ts.computeSignature(changedDtsText,
|
|
112035
|
+
newBuildInfo.program.outSignature = ts.computeSignature(changedDtsText, createHash, changedDtsData);
|
|
112222
112036
|
}
|
|
112223
112037
|
// Update sourceFileInfo
|
|
112224
112038
|
var _a = buildInfo.bundle, js = _a.js, dts = _a.dts, sourceFiles = _a.sourceFiles;
|
|
@@ -112252,7 +112066,7 @@ var ts;
|
|
|
112252
112066
|
getSourceFileFromReference: ts.returnUndefined,
|
|
112253
112067
|
redirectTargetsMap: ts.createMultiMap(),
|
|
112254
112068
|
getFileIncludeReasons: ts.notImplemented,
|
|
112255
|
-
createHash:
|
|
112069
|
+
createHash: createHash,
|
|
112256
112070
|
};
|
|
112257
112071
|
emitFiles(ts.notImplementedResolver, emitHost,
|
|
112258
112072
|
/*targetSourceFile*/ undefined, ts.getTransformers(config.options, customTransformers));
|
|
@@ -117729,7 +117543,7 @@ var ts;
|
|
|
117729
117543
|
var result = void 0;
|
|
117730
117544
|
var mode = getModeForFileReference(name, containingFileMode);
|
|
117731
117545
|
// We lower-case all type references because npm automatically lowercases all packages. See GH#9824.
|
|
117732
|
-
var strName = ts.isString(name) ? name :
|
|
117546
|
+
var strName = ts.isString(name) ? name : name.fileName.toLowerCase();
|
|
117733
117547
|
var cacheKey = mode !== undefined ? mode + "|" + strName : strName;
|
|
117734
117548
|
if (cache.has(cacheKey)) {
|
|
117735
117549
|
result = cache.get(cacheKey);
|
|
@@ -117833,22 +117647,8 @@ var ts;
|
|
|
117833
117647
|
return elem.value.text === "import" ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS;
|
|
117834
117648
|
}
|
|
117835
117649
|
ts.getResolutionModeOverrideForClause = getResolutionModeOverrideForClause;
|
|
117836
|
-
var emptyResolution = {
|
|
117837
|
-
resolvedModule: undefined,
|
|
117838
|
-
resolvedTypeReferenceDirective: undefined,
|
|
117839
|
-
failedLookupLocations: [],
|
|
117840
|
-
affectingLocations: [],
|
|
117841
|
-
resolutionDiagnostics: [],
|
|
117842
|
-
};
|
|
117843
|
-
function isResolvedModuleWithFailedLookupLocation(resolved) {
|
|
117844
|
-
return !!resolved && !!resolved.failedLookupLocations;
|
|
117845
|
-
}
|
|
117846
|
-
function isResolvedTypeReferenceDirectiveWithFailedLookupLocations(resolved) {
|
|
117847
|
-
return !!resolved && !!resolved.failedLookupLocations;
|
|
117848
|
-
}
|
|
117849
117650
|
/* @internal */
|
|
117850
|
-
function loadWithModeAwareCache(names, containingFile, containingFileName, redirectedReference,
|
|
117851
|
-
var _a;
|
|
117651
|
+
function loadWithModeAwareCache(names, containingFile, containingFileName, redirectedReference, loader) {
|
|
117852
117652
|
if (names.length === 0) {
|
|
117853
117653
|
return [];
|
|
117854
117654
|
}
|
|
@@ -117858,7 +117658,7 @@ var ts;
|
|
|
117858
117658
|
for (var _i = 0, names_3 = names; _i < names_3.length; _i++) {
|
|
117859
117659
|
var name = names_3[_i];
|
|
117860
117660
|
var result = void 0;
|
|
117861
|
-
var mode = getModeForResolutionAtIndex(containingFile,
|
|
117661
|
+
var mode = getModeForResolutionAtIndex(containingFile, i);
|
|
117862
117662
|
i++;
|
|
117863
117663
|
var cacheKey = mode !== undefined ? mode + "|" + name : name;
|
|
117864
117664
|
if (cache.has(cacheKey)) {
|
|
@@ -117923,14 +117723,14 @@ var ts;
|
|
|
117923
117723
|
/*@internal*/
|
|
117924
117724
|
function getReferencedFileLocation(getSourceFileByPath, ref) {
|
|
117925
117725
|
var _a, _b, _c;
|
|
117926
|
-
var _d, _e, _f, _g
|
|
117726
|
+
var _d, _e, _f, _g;
|
|
117927
117727
|
var file = ts.Debug.checkDefined(getSourceFileByPath(ref.file));
|
|
117928
117728
|
var kind = ref.kind, index = ref.index;
|
|
117929
117729
|
var pos, end, packageId, resolutionMode;
|
|
117930
117730
|
switch (kind) {
|
|
117931
117731
|
case ts.FileIncludeKind.Import:
|
|
117932
117732
|
var importLiteral = getModuleNameStringLiteralAt(file, index);
|
|
117933
|
-
packageId = (
|
|
117733
|
+
packageId = (_e = (_d = file.resolvedModules) === null || _d === void 0 ? void 0 : _d.get(importLiteral.text, getModeForResolutionAtIndex(file, index))) === null || _e === void 0 ? void 0 : _e.packageId;
|
|
117934
117734
|
if (importLiteral.pos === -1)
|
|
117935
117735
|
return { file: file, packageId: packageId, text: importLiteral.text };
|
|
117936
117736
|
pos = ts.skipTrivia(file.text, importLiteral.pos);
|
|
@@ -117941,7 +117741,7 @@ var ts;
|
|
|
117941
117741
|
break;
|
|
117942
117742
|
case ts.FileIncludeKind.TypeReferenceDirective:
|
|
117943
117743
|
(_b = file.typeReferenceDirectives[index], pos = _b.pos, end = _b.end, resolutionMode = _b.resolutionMode);
|
|
117944
|
-
packageId = (
|
|
117744
|
+
packageId = (_g = (_f = file.resolvedTypeReferenceDirectiveNames) === null || _f === void 0 ? void 0 : _f.get(ts.toFileNameLowerCase(file.typeReferenceDirectives[index].fileName), resolutionMode || file.impliedNodeFormat)) === null || _g === void 0 ? void 0 : _g.packageId;
|
|
117945
117745
|
break;
|
|
117946
117746
|
case ts.FileIncludeKind.LibReferenceDirective:
|
|
117947
117747
|
(_c = file.libReferenceDirectives[index], pos = _c.pos, end = _c.end);
|
|
@@ -118171,10 +117971,10 @@ var ts;
|
|
|
118171
117971
|
};
|
|
118172
117972
|
}
|
|
118173
117973
|
function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) {
|
|
118174
|
-
var _a, _b, _c, _d
|
|
117974
|
+
var _a, _b, _c, _d;
|
|
118175
117975
|
var createProgramOptions = ts.isArray(rootNamesOrOptions) ? createCreateProgramOptions(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) : rootNamesOrOptions; // TODO: GH#18217
|
|
118176
117976
|
var rootNames = createProgramOptions.rootNames, options = createProgramOptions.options, configFileParsingDiagnostics = createProgramOptions.configFileParsingDiagnostics, projectReferences = createProgramOptions.projectReferences;
|
|
118177
|
-
var
|
|
117977
|
+
var oldProgram = createProgramOptions.oldProgram;
|
|
118178
117978
|
var processingDefaultLibFiles;
|
|
118179
117979
|
var processingOtherFiles;
|
|
118180
117980
|
var files;
|
|
@@ -118188,8 +117988,6 @@ var ts;
|
|
|
118188
117988
|
var cachedDeclarationDiagnosticsForFile = {};
|
|
118189
117989
|
var resolvedTypeReferenceDirectives = ts.createModeAwareCache();
|
|
118190
117990
|
var fileProcessingDiagnostics;
|
|
118191
|
-
var automaticTypeDirectiveNames;
|
|
118192
|
-
var automaticTypeDirectiveResolutions;
|
|
118193
117991
|
// The below settings are to track if a .js file should be add to the program if loaded via searching under node_modules.
|
|
118194
117992
|
// This works as imported modules are discovered recursively in a depth first manner, specifically:
|
|
118195
117993
|
// - For each root file, findSourceFile is called.
|
|
@@ -118211,11 +118009,6 @@ var ts;
|
|
|
118211
118009
|
var skipDefaultLib = options.noLib;
|
|
118212
118010
|
var getDefaultLibraryFileName = ts.memoize(function () { return host.getDefaultLibFileName(options); });
|
|
118213
118011
|
var defaultLibraryPath = host.getDefaultLibLocation ? host.getDefaultLibLocation() : ts.getDirectoryPath(getDefaultLibraryFileName());
|
|
118214
|
-
/**
|
|
118215
|
-
* Diagnostics for the program
|
|
118216
|
-
* Only add diagnostics directly if it always would be done irrespective of program structure reuse.
|
|
118217
|
-
* Otherwise fileProcessingDiagnostics is correct locations so that the diagnostics can be reported in all structure use scenarios
|
|
118218
|
-
*/
|
|
118219
118012
|
var programDiagnostics = ts.createDiagnosticCollection();
|
|
118220
118013
|
var currentDirectory = host.getCurrentDirectory();
|
|
118221
118014
|
var supportedExtensions = ts.getSupportedExtensions(options);
|
|
@@ -118228,71 +118021,30 @@ var ts;
|
|
|
118228
118021
|
var actualResolveModuleNamesWorker;
|
|
118229
118022
|
var hasInvalidatedResolution = host.hasInvalidatedResolution || ts.returnFalse;
|
|
118230
118023
|
if (host.resolveModuleNames) {
|
|
118231
|
-
actualResolveModuleNamesWorker = function (moduleNames, containingFile, containingFileName, redirectedReference,
|
|
118232
|
-
|
|
118233
|
-
|
|
118234
|
-
|
|
118235
|
-
|
|
118236
|
-
|
|
118237
|
-
|
|
118238
|
-
|
|
118239
|
-
|
|
118240
|
-
resolved.extension !== undefined ?
|
|
118241
|
-
// An older host may have omitted extension, in which case we should infer it from the file extension of resolvedFileName.
|
|
118242
|
-
{ resolvedModule: resolved, failedLookupLocations: emptyResolution.failedLookupLocations } :
|
|
118243
|
-
{ resolvedModule: __assign(__assign({}, resolved), { extension: ts.extensionFromPath(resolved.resolvedFileName) }), failedLookupLocations: emptyResolution.failedLookupLocations } :
|
|
118244
|
-
emptyResolution; });
|
|
118245
|
-
};
|
|
118024
|
+
actualResolveModuleNamesWorker = function (moduleNames, containingFile, containingFileName, reusedNames, redirectedReference) { return host.resolveModuleNames(ts.Debug.checkEachDefined(moduleNames), containingFileName, reusedNames, redirectedReference, options, containingFile).map(function (resolved) {
|
|
118025
|
+
// An older host may have omitted extension, in which case we should infer it from the file extension of resolvedFileName.
|
|
118026
|
+
if (!resolved || resolved.extension !== undefined) {
|
|
118027
|
+
return resolved;
|
|
118028
|
+
}
|
|
118029
|
+
var withExtension = ts.clone(resolved);
|
|
118030
|
+
withExtension.extension = ts.extensionFromPath(resolved.resolvedFileName);
|
|
118031
|
+
return withExtension;
|
|
118032
|
+
}); };
|
|
118246
118033
|
moduleResolutionCache = (_a = host.getModuleResolutionCache) === null || _a === void 0 ? void 0 : _a.call(host);
|
|
118247
118034
|
}
|
|
118248
118035
|
else {
|
|
118249
118036
|
moduleResolutionCache = ts.createModuleResolutionCache(currentDirectory, getCanonicalFileName, options);
|
|
118250
|
-
var loader_1 = function (moduleName, resolverMode, containingFileName, redirectedReference) { return ts.resolveModuleName(moduleName, containingFileName, options, host, moduleResolutionCache, redirectedReference, resolverMode); };
|
|
118251
|
-
actualResolveModuleNamesWorker = function (moduleNames, containingFile, containingFileName, redirectedReference,
|
|
118252
|
-
return loadWithModeAwareCache(moduleNames, containingFile, containingFileName, redirectedReference, partialResolutionInfo, loader_1);
|
|
118253
|
-
};
|
|
118037
|
+
var loader_1 = function (moduleName, resolverMode, containingFileName, redirectedReference) { return ts.resolveModuleName(moduleName, containingFileName, options, host, moduleResolutionCache, redirectedReference, resolverMode).resolvedModule; }; // TODO: GH#18217
|
|
118038
|
+
actualResolveModuleNamesWorker = function (moduleNames, containingFile, containingFileName, _reusedNames, redirectedReference) { return loadWithModeAwareCache(ts.Debug.checkEachDefined(moduleNames), containingFile, containingFileName, redirectedReference, loader_1); };
|
|
118254
118039
|
}
|
|
118255
118040
|
var actualResolveTypeReferenceDirectiveNamesWorker;
|
|
118256
118041
|
if (host.resolveTypeReferenceDirectives) {
|
|
118257
|
-
actualResolveTypeReferenceDirectiveNamesWorker = function (typeDirectiveNames, containingFile, redirectedReference, containingFileMode,
|
|
118258
|
-
var result = host.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference, options, containingFileMode, partialResolutionInfo);
|
|
118259
|
-
return result.some(isResolvedTypeReferenceDirectiveWithFailedLookupLocations) ?
|
|
118260
|
-
result :
|
|
118261
|
-
result.map(function (resolved) { return resolved ?
|
|
118262
|
-
{ resolvedTypeReferenceDirective: resolved, failedLookupLocations: emptyResolution.failedLookupLocations } :
|
|
118263
|
-
emptyResolution; });
|
|
118264
|
-
};
|
|
118265
|
-
typeReferenceDirectiveResolutionCache = (_b = host.getTypeReferenceDirectiveResolutionCache) === null || _b === void 0 ? void 0 : _b.call(host);
|
|
118042
|
+
actualResolveTypeReferenceDirectiveNamesWorker = function (typeDirectiveNames, containingFile, redirectedReference, containingFileMode) { return host.resolveTypeReferenceDirectives(ts.Debug.checkEachDefined(typeDirectiveNames), containingFile, redirectedReference, options, containingFileMode); };
|
|
118266
118043
|
}
|
|
118267
118044
|
else {
|
|
118268
118045
|
typeReferenceDirectiveResolutionCache = ts.createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, /*options*/ undefined, moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache());
|
|
118269
|
-
var loader_2 = function (typesRef, containingFile, redirectedReference, resolutionMode) { return ts.resolveTypeReferenceDirective(typesRef, containingFile, options, host, redirectedReference, typeReferenceDirectiveResolutionCache, resolutionMode); };
|
|
118270
|
-
actualResolveTypeReferenceDirectiveNamesWorker = function (typeReferenceDirectiveNames, containingFile, redirectedReference, containingFileMode) {
|
|
118271
|
-
return loadWithTypeDirectiveCache(typeReferenceDirectiveNames, containingFile, redirectedReference, containingFileMode, loader_2);
|
|
118272
|
-
};
|
|
118273
|
-
}
|
|
118274
|
-
var oldProgram = typeof oldProgramOrOldBuildInfoProgramConstructor === "object" ? oldProgramOrOldBuildInfoProgramConstructor : undefined;
|
|
118275
|
-
var oldBuildInfoProgram;
|
|
118276
|
-
if (!oldProgram && typeof oldProgramOrOldBuildInfoProgramConstructor === "function") {
|
|
118277
|
-
var state_11 = ts.getTemporaryModuleResolutionState(moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache(), host, options);
|
|
118278
|
-
oldBuildInfoProgram = oldProgramOrOldBuildInfoProgramConstructor({
|
|
118279
|
-
fileExists: function (fileName) { return host.fileExists(fileName); },
|
|
118280
|
-
createHash: ts.maybeBind(host, host.createHash),
|
|
118281
|
-
getPackageJsonInfo: function (fileName) { return ts.getPackageJsonInfo(ts.getDirectoryPath(fileName), /*onlyRecordFailures*/ false, state_11); },
|
|
118282
|
-
});
|
|
118283
|
-
if (oldBuildInfoProgram) {
|
|
118284
|
-
// Ensure redirected references are verified before using existing cache
|
|
118285
|
-
moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.setOldResolutionCache({
|
|
118286
|
-
getResolved: function (dirPath, name, mode, redirectedReference) {
|
|
118287
|
-
return oldBuildInfoProgram === null || oldBuildInfoProgram === void 0 ? void 0 : oldBuildInfoProgram.getResolvedModule(dirPath, name, mode, redirectedReference);
|
|
118288
|
-
}
|
|
118289
|
-
});
|
|
118290
|
-
typeReferenceDirectiveResolutionCache === null || typeReferenceDirectiveResolutionCache === void 0 ? void 0 : typeReferenceDirectiveResolutionCache.setOldResolutionCache({
|
|
118291
|
-
getResolved: function (dirPath, name, mode, redirectedReference) {
|
|
118292
|
-
return oldBuildInfoProgram === null || oldBuildInfoProgram === void 0 ? void 0 : oldBuildInfoProgram.getResolvedTypeReferenceDirective(dirPath, name, mode, redirectedReference);
|
|
118293
|
-
}
|
|
118294
|
-
});
|
|
118295
|
-
}
|
|
118046
|
+
var loader_2 = function (typesRef, containingFile, redirectedReference, resolutionMode) { return ts.resolveTypeReferenceDirective(typesRef, containingFile, options, host, redirectedReference, typeReferenceDirectiveResolutionCache, resolutionMode).resolvedTypeReferenceDirective; }; // TODO: GH#18217
|
|
118047
|
+
actualResolveTypeReferenceDirectiveNamesWorker = function (typeReferenceDirectiveNames, containingFile, redirectedReference, containingFileMode) { return loadWithTypeDirectiveCache(ts.Debug.checkEachDefined(typeReferenceDirectiveNames), containingFile, redirectedReference, containingFileMode, loader_2); };
|
|
118296
118048
|
}
|
|
118297
118049
|
// Map from a stringified PackageId to the source file with that id.
|
|
118298
118050
|
// Only one source file may have a given packageId. Others become redirects (see createRedirectSourceFile).
|
|
@@ -118319,9 +118071,9 @@ var ts;
|
|
|
118319
118071
|
var projectReferenceRedirects;
|
|
118320
118072
|
var mapFromFileToProjectReferenceRedirects;
|
|
118321
118073
|
var mapFromToProjectReferenceRedirectSource;
|
|
118322
|
-
var useSourceOfProjectReferenceRedirect = !!((
|
|
118074
|
+
var useSourceOfProjectReferenceRedirect = !!((_b = host.useSourceOfProjectReferenceRedirect) === null || _b === void 0 ? void 0 : _b.call(host)) &&
|
|
118323
118075
|
!options.disableSourceOfProjectReferenceRedirect;
|
|
118324
|
-
var
|
|
118076
|
+
var _e = updateHostForUseSourceOfProjectReferenceRedirect({
|
|
118325
118077
|
compilerHost: host,
|
|
118326
118078
|
getSymlinkCache: getSymlinkCache,
|
|
118327
118079
|
useSourceOfProjectReferenceRedirect: useSourceOfProjectReferenceRedirect,
|
|
@@ -118329,7 +118081,7 @@ var ts;
|
|
|
118329
118081
|
getResolvedProjectReferences: getResolvedProjectReferences,
|
|
118330
118082
|
getSourceOfProjectReferenceRedirect: getSourceOfProjectReferenceRedirect,
|
|
118331
118083
|
forEachResolvedProjectReference: forEachResolvedProjectReference
|
|
118332
|
-
}), onProgramCreateComplete =
|
|
118084
|
+
}), onProgramCreateComplete = _e.onProgramCreateComplete, fileExists = _e.fileExists, directoryExists = _e.directoryExists;
|
|
118333
118085
|
var readFile = host.readFile.bind(host);
|
|
118334
118086
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program" /* Program */, "shouldProgramCreateNewSourceFiles", { hasOldProgram: !!oldProgram });
|
|
118335
118087
|
var shouldCreateNewSourceFile = shouldProgramCreateNewSourceFiles(oldProgram, options);
|
|
@@ -118340,7 +118092,7 @@ var ts;
|
|
|
118340
118092
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program" /* Program */, "tryReuseStructureFromOldProgram", {});
|
|
118341
118093
|
structureIsReused = tryReuseStructureFromOldProgram(); // eslint-disable-line prefer-const
|
|
118342
118094
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
118343
|
-
if (structureIsReused !==
|
|
118095
|
+
if (structureIsReused !== 2 /* Completely */) {
|
|
118344
118096
|
processingDefaultLibFiles = [];
|
|
118345
118097
|
processingOtherFiles = [];
|
|
118346
118098
|
if (projectReferences) {
|
|
@@ -118381,15 +118133,16 @@ var ts;
|
|
|
118381
118133
|
ts.forEach(rootNames, function (name, index) { return processRootFile(name, /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false, { kind: ts.FileIncludeKind.RootFile, index: index }); });
|
|
118382
118134
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
118383
118135
|
// load type declarations specified via 'types' argument or implicitly from types/ and node_modules/@types folders
|
|
118384
|
-
|
|
118385
|
-
|
|
118386
|
-
|
|
118387
|
-
|
|
118388
|
-
var
|
|
118389
|
-
|
|
118136
|
+
var typeReferences = rootNames.length ? ts.getAutomaticTypeDirectiveNames(options, host) : ts.emptyArray;
|
|
118137
|
+
if (typeReferences.length) {
|
|
118138
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program" /* Program */, "processTypeReferences", { count: typeReferences.length });
|
|
118139
|
+
// This containingFilename needs to match with the one used in managed-side
|
|
118140
|
+
var containingDirectory = options.configFilePath ? ts.getDirectoryPath(options.configFilePath) : host.getCurrentDirectory();
|
|
118141
|
+
var containingFilename = ts.combinePaths(containingDirectory, ts.inferredTypesContainingFile);
|
|
118142
|
+
var resolutions = resolveTypeReferenceDirectiveNamesWorker(typeReferences, containingFilename);
|
|
118143
|
+
for (var i = 0; i < typeReferences.length; i++) {
|
|
118390
118144
|
// under node16/nodenext module resolution, load `types`/ata include names as cjs resolution results by passing an `undefined` mode
|
|
118391
|
-
|
|
118392
|
-
processTypeReferenceDirective(automaticTypeDirectiveNames[i], /*mode*/ undefined, resolutions[i], { kind: ts.FileIncludeKind.AutomaticTypeDirectiveFile, typeReference: automaticTypeDirectiveNames[i], packageId: (_d = resolutions[i].resolvedTypeReferenceDirective) === null || _d === void 0 ? void 0 : _d.packageId });
|
|
118145
|
+
processTypeReferenceDirective(typeReferences[i], /*mode*/ undefined, resolutions[i], { kind: ts.FileIncludeKind.AutomaticTypeDirectiveFile, typeReference: typeReferences[i], packageId: (_c = resolutions[i]) === null || _c === void 0 ? void 0 : _c.packageId });
|
|
118393
118146
|
}
|
|
118394
118147
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
118395
118148
|
}
|
|
@@ -118429,13 +118182,13 @@ var ts;
|
|
|
118429
118182
|
if (shouldCreateNewSourceFile || !newFile ||
|
|
118430
118183
|
// old file wasn't redirect but new file is
|
|
118431
118184
|
(oldSourceFile.resolvedPath === oldSourceFile.path && newFile.resolvedPath !== oldSourceFile.path)) {
|
|
118432
|
-
host.onReleaseOldSourceFile(oldSourceFile, oldProgram.getCompilerOptions());
|
|
118185
|
+
host.onReleaseOldSourceFile(oldSourceFile, oldProgram.getCompilerOptions(), !!getSourceFileByPath(oldSourceFile.path));
|
|
118433
118186
|
}
|
|
118434
118187
|
}
|
|
118435
118188
|
if (!host.getParsedCommandLine) {
|
|
118436
118189
|
oldProgram.forEachResolvedProjectReference(function (resolvedProjectReference) {
|
|
118437
118190
|
if (!getResolvedProjectReferenceByPath(resolvedProjectReference.sourceFile.path)) {
|
|
118438
|
-
host.onReleaseOldSourceFile(resolvedProjectReference.sourceFile, oldProgram.getCompilerOptions());
|
|
118191
|
+
host.onReleaseOldSourceFile(resolvedProjectReference.sourceFile, oldProgram.getCompilerOptions(), /*hasSourceFileByPath*/ false);
|
|
118439
118192
|
}
|
|
118440
118193
|
});
|
|
118441
118194
|
}
|
|
@@ -118453,8 +118206,6 @@ var ts;
|
|
|
118453
118206
|
typeReferenceDirectiveResolutionCache = undefined;
|
|
118454
118207
|
// unconditionally set oldProgram to undefined to prevent it from being captured in closure
|
|
118455
118208
|
oldProgram = undefined;
|
|
118456
|
-
oldBuildInfoProgram = undefined;
|
|
118457
|
-
oldProgramOrOldBuildInfoProgramConstructor = undefined;
|
|
118458
118209
|
var program = {
|
|
118459
118210
|
getRootFileNames: function () { return rootNames; },
|
|
118460
118211
|
getSourceFile: getSourceFile,
|
|
@@ -118462,7 +118213,6 @@ var ts;
|
|
|
118462
118213
|
getSourceFiles: function () { return files; },
|
|
118463
118214
|
getMissingFilePaths: function () { return missingFilePaths; },
|
|
118464
118215
|
getModuleResolutionCache: function () { return moduleResolutionCache; },
|
|
118465
|
-
getTypeReferenceDirectiveResolutionCache: function () { return typeReferenceDirectiveResolutionCache; },
|
|
118466
118216
|
getFilesByNameMap: function () { return filesByName; },
|
|
118467
118217
|
getCompilerOptions: function () { return options; },
|
|
118468
118218
|
getSyntacticDiagnostics: getSyntacticDiagnostics,
|
|
@@ -118487,9 +118237,6 @@ var ts;
|
|
|
118487
118237
|
getRelationCacheSizes: function () { return getTypeChecker().getRelationCacheSizes(); },
|
|
118488
118238
|
getFileProcessingDiagnostics: function () { return fileProcessingDiagnostics; },
|
|
118489
118239
|
getResolvedTypeReferenceDirectives: function () { return resolvedTypeReferenceDirectives; },
|
|
118490
|
-
getAutomaticTypeDirectiveNames: function () { return automaticTypeDirectiveNames; },
|
|
118491
|
-
getAutomaticTypeDirectiveResolutions: function () { return automaticTypeDirectiveResolutions; },
|
|
118492
|
-
getAutomaticTypeDirectiveContainingFile: getAutomaticTypeDirectiveContainingFile,
|
|
118493
118240
|
isSourceFileFromExternalLibrary: isSourceFileFromExternalLibrary,
|
|
118494
118241
|
isSourceFileDefaultLibrary: isSourceFileDefaultLibrary,
|
|
118495
118242
|
getSourceFileFromReference: getSourceFileFromReference,
|
|
@@ -118499,12 +118246,12 @@ var ts;
|
|
|
118499
118246
|
usesUriStyleNodeCoreModules: usesUriStyleNodeCoreModules,
|
|
118500
118247
|
isEmittedFile: isEmittedFile,
|
|
118501
118248
|
getConfigFileParsingDiagnostics: getConfigFileParsingDiagnostics,
|
|
118249
|
+
getResolvedModuleWithFailedLookupLocationsFromCache: getResolvedModuleWithFailedLookupLocationsFromCache,
|
|
118502
118250
|
getProjectReferences: getProjectReferences,
|
|
118503
118251
|
getResolvedProjectReferences: getResolvedProjectReferences,
|
|
118504
118252
|
getProjectReferenceRedirect: getProjectReferenceRedirect,
|
|
118505
118253
|
getResolvedProjectReferenceToRedirect: getResolvedProjectReferenceToRedirect,
|
|
118506
118254
|
getResolvedProjectReferenceByPath: getResolvedProjectReferenceByPath,
|
|
118507
|
-
getRedirectReferenceForResolution: getRedirectReferenceForResolution,
|
|
118508
118255
|
forEachResolvedProjectReference: forEachResolvedProjectReference,
|
|
118509
118256
|
isSourceOfProjectReferenceRedirect: isSourceOfProjectReferenceRedirect,
|
|
118510
118257
|
emitBuildInfo: emitBuildInfo,
|
|
@@ -118512,7 +118259,7 @@ var ts;
|
|
|
118512
118259
|
readFile: readFile,
|
|
118513
118260
|
directoryExists: directoryExists,
|
|
118514
118261
|
getSymlinkCache: getSymlinkCache,
|
|
118515
|
-
realpath: (
|
|
118262
|
+
realpath: (_d = host.realpath) === null || _d === void 0 ? void 0 : _d.bind(host),
|
|
118516
118263
|
useCaseSensitiveFileNames: function () { return host.useCaseSensitiveFileNames(); },
|
|
118517
118264
|
getFileIncludeReasons: function () { return fileReasons; },
|
|
118518
118265
|
structureIsReused: structureIsReused,
|
|
@@ -118527,8 +118274,6 @@ var ts;
|
|
|
118527
118274
|
case 0 /* FilePreprocessingReferencedDiagnostic */:
|
|
118528
118275
|
var _a = getReferencedFileLocation(getSourceFileByPath, diagnostic.reason), file = _a.file, pos = _a.pos, end = _a.end;
|
|
118529
118276
|
return programDiagnostics.add(ts.createFileDiagnostic.apply(void 0, __spreadArray([file, ts.Debug.checkDefined(pos), ts.Debug.checkDefined(end) - pos, diagnostic.diagnostic], diagnostic.args || ts.emptyArray, false)));
|
|
118530
|
-
case 2 /* ResolutionDiagnostics */:
|
|
118531
|
-
return diagnostic.diagnostics.forEach(function (d) { return programDiagnostics.add(d); });
|
|
118532
118277
|
default:
|
|
118533
118278
|
ts.Debug.assertNever(diagnostic);
|
|
118534
118279
|
}
|
|
@@ -118538,46 +118283,63 @@ var ts;
|
|
|
118538
118283
|
ts.performance.measure("Program", "beforeProgram", "afterProgram");
|
|
118539
118284
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
118540
118285
|
return program;
|
|
118541
|
-
function
|
|
118542
|
-
|
|
118543
|
-
|
|
118544
|
-
|
|
118286
|
+
function addResolutionDiagnostics(list) {
|
|
118287
|
+
if (!list)
|
|
118288
|
+
return;
|
|
118289
|
+
for (var _i = 0, list_3 = list; _i < list_3.length; _i++) {
|
|
118290
|
+
var elem = list_3[_i];
|
|
118291
|
+
programDiagnostics.add(elem);
|
|
118292
|
+
}
|
|
118545
118293
|
}
|
|
118546
|
-
function
|
|
118547
|
-
|
|
118294
|
+
function pullDiagnosticsFromCache(names, containingFile) {
|
|
118295
|
+
var _a;
|
|
118296
|
+
if (!moduleResolutionCache)
|
|
118548
118297
|
return;
|
|
118549
|
-
|
|
118550
|
-
|
|
118551
|
-
|
|
118552
|
-
|
|
118553
|
-
|
|
118554
|
-
|
|
118555
|
-
|
|
118298
|
+
var containingFileName = ts.getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory);
|
|
118299
|
+
var containingFileMode = !ts.isString(containingFile) ? containingFile.impliedNodeFormat : undefined;
|
|
118300
|
+
var containingDir = ts.getDirectoryPath(containingFileName);
|
|
118301
|
+
var redirectedReference = getRedirectReferenceForResolution(containingFile);
|
|
118302
|
+
var i = 0;
|
|
118303
|
+
for (var _i = 0, names_4 = names; _i < names_4.length; _i++) {
|
|
118304
|
+
var n = names_4[_i];
|
|
118305
|
+
// mimics logic done in the resolution cache, should be resilient to upgrading it to use `FileReference`s for non-type-reference modal lookups to make it rely on the index in the list less
|
|
118306
|
+
var mode = typeof n === "string" ? getModeForResolutionAtIndex(containingFile, i) : getModeForFileReference(n, containingFileMode);
|
|
118307
|
+
var name = typeof n === "string" ? n : n.fileName;
|
|
118308
|
+
i++;
|
|
118309
|
+
// only nonrelative names hit the cache, and, at least as of right now, only nonrelative names can issue diagnostics
|
|
118310
|
+
// (Since diagnostics are only issued via import or export map lookup)
|
|
118311
|
+
// This may totally change if/when the issue of output paths not mapping to input files is fixed in a broader context
|
|
118312
|
+
// When it is, how we extract diagnostics from the module name resolver will have the be refined - the current cache
|
|
118313
|
+
// APIs wrapping the underlying resolver make it almost impossible to smuggle the diagnostics out in a generalized way
|
|
118314
|
+
if (ts.isExternalModuleNameRelative(name))
|
|
118315
|
+
continue;
|
|
118316
|
+
var diags = (_a = moduleResolutionCache.getOrCreateCacheForModuleName(name, mode, redirectedReference).get(containingDir)) === null || _a === void 0 ? void 0 : _a.resolutionDiagnostics;
|
|
118317
|
+
addResolutionDiagnostics(diags);
|
|
118318
|
+
}
|
|
118556
118319
|
}
|
|
118557
|
-
function resolveModuleNamesWorker(moduleNames, containingFile,
|
|
118320
|
+
function resolveModuleNamesWorker(moduleNames, containingFile, reusedNames) {
|
|
118558
118321
|
if (!moduleNames.length)
|
|
118559
118322
|
return ts.emptyArray;
|
|
118560
118323
|
var containingFileName = ts.getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory);
|
|
118561
|
-
|
|
118562
|
-
redirectedReference = getRedirectReferenceForResolution(containingFile);
|
|
118324
|
+
var redirectedReference = getRedirectReferenceForResolution(containingFile);
|
|
118563
118325
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program" /* Program */, "resolveModuleNamesWorker", { containingFileName: containingFileName });
|
|
118564
118326
|
ts.performance.mark("beforeResolveModule");
|
|
118565
|
-
var result = actualResolveModuleNamesWorker(moduleNames, containingFile, containingFileName,
|
|
118327
|
+
var result = actualResolveModuleNamesWorker(moduleNames, containingFile, containingFileName, reusedNames, redirectedReference);
|
|
118566
118328
|
ts.performance.mark("afterResolveModule");
|
|
118567
118329
|
ts.performance.measure("ResolveModule", "beforeResolveModule", "afterResolveModule");
|
|
118568
118330
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
118331
|
+
pullDiagnosticsFromCache(moduleNames, containingFile);
|
|
118569
118332
|
return result;
|
|
118570
118333
|
}
|
|
118571
|
-
function resolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFile
|
|
118334
|
+
function resolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFile) {
|
|
118572
118335
|
if (!typeDirectiveNames.length)
|
|
118573
118336
|
return [];
|
|
118574
118337
|
var containingFileName = !ts.isString(containingFile) ? ts.getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory) : containingFile;
|
|
118575
|
-
|
|
118576
|
-
redirectedReference = getRedirectReferenceForResolution(containingFile);
|
|
118338
|
+
var redirectedReference = !ts.isString(containingFile) ? getRedirectReferenceForResolution(containingFile) : undefined;
|
|
118577
118339
|
var containingFileMode = !ts.isString(containingFile) ? containingFile.impliedNodeFormat : undefined;
|
|
118578
118340
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program" /* Program */, "resolveTypeReferenceDirectiveNamesWorker", { containingFileName: containingFileName });
|
|
118579
118341
|
ts.performance.mark("beforeResolveTypeReference");
|
|
118580
|
-
var result = actualResolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFileName, redirectedReference
|
|
118342
|
+
var result = actualResolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFileName, redirectedReference, containingFileMode);
|
|
118581
118343
|
ts.performance.mark("afterResolveTypeReference");
|
|
118582
118344
|
ts.performance.measure("ResolveTypeReference", "beforeResolveTypeReference", "afterResolveTypeReference");
|
|
118583
118345
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
@@ -118630,6 +118392,9 @@ var ts;
|
|
|
118630
118392
|
}
|
|
118631
118393
|
return ts.libs.length + 2;
|
|
118632
118394
|
}
|
|
118395
|
+
function getResolvedModuleWithFailedLookupLocationsFromCache(moduleName, containingFile, mode) {
|
|
118396
|
+
return moduleResolutionCache && ts.resolveModuleNameFromCache(moduleName, containingFile, moduleResolutionCache, mode);
|
|
118397
|
+
}
|
|
118633
118398
|
function toPath(fileName) {
|
|
118634
118399
|
return ts.toPath(fileName, currentDirectory, getCanonicalFileName);
|
|
118635
118400
|
}
|
|
@@ -118654,11 +118419,10 @@ var ts;
|
|
|
118654
118419
|
return classifiableNames;
|
|
118655
118420
|
}
|
|
118656
118421
|
function resolveModuleNamesReusingOldState(moduleNames, file) {
|
|
118657
|
-
var _a;
|
|
118658
118422
|
if (structureIsReused === 0 /* Not */ && !file.ambientModuleNames.length) {
|
|
118659
118423
|
// If the old program state does not permit reusing resolutions and `file` does not contain locally defined ambient modules,
|
|
118660
118424
|
// the best we can do is fallback to the default logic.
|
|
118661
|
-
return resolveModuleNamesWorker(moduleNames, file, /*
|
|
118425
|
+
return resolveModuleNamesWorker(moduleNames, file, /*reusedNames*/ undefined);
|
|
118662
118426
|
}
|
|
118663
118427
|
var oldSourceFile = oldProgram && oldProgram.getSourceFile(file.fileName);
|
|
118664
118428
|
if (oldSourceFile !== file && file.resolvedModules) {
|
|
@@ -118686,8 +118450,6 @@ var ts;
|
|
|
118686
118450
|
// With this information, we can infer some module resolutions without performing resolution.
|
|
118687
118451
|
/** An ordered list of module names for which we cannot recover the resolution. */
|
|
118688
118452
|
var unknownModuleNames;
|
|
118689
|
-
var unknownModuleNamesIndex;
|
|
118690
|
-
var reusedNames;
|
|
118691
118453
|
/**
|
|
118692
118454
|
* The indexing of elements in this list matches that of `moduleNames`.
|
|
118693
118455
|
*
|
|
@@ -118698,33 +118460,22 @@ var ts;
|
|
|
118698
118460
|
* * ResolvedModuleFull instance: can be reused.
|
|
118699
118461
|
*/
|
|
118700
118462
|
var result;
|
|
118463
|
+
var reusedNames;
|
|
118701
118464
|
/** A transient placeholder used to mark predicted resolution in the result list. */
|
|
118702
|
-
var predictedToResolveToAmbientModuleMarker =
|
|
118703
|
-
var redirectedReference;
|
|
118465
|
+
var predictedToResolveToAmbientModuleMarker = {};
|
|
118704
118466
|
for (var i = 0; i < moduleNames.length; i++) {
|
|
118705
118467
|
var moduleName = moduleNames[i];
|
|
118706
118468
|
// If the source file is unchanged and doesnt have invalidated resolution, reuse the module resolutions
|
|
118707
|
-
if (
|
|
118708
|
-
var
|
|
118709
|
-
|
|
118710
|
-
(_a = oldSourceFile === null || oldSourceFile === void 0 ? void 0 : oldSourceFile.resolvedModules) === null || _a === void 0 ? void 0 : _a.get(moduleName, mode) :
|
|
118711
|
-
oldBuildInfoProgram.getResolvedModule(ts.getDirectoryPath(file.path), moduleName, mode, (redirectedReference === undefined ? (redirectedReference = getRedirectReferenceForResolution(file) || false) : redirectedReference) || undefined);
|
|
118712
|
-
if (oldResolution === null || oldResolution === void 0 ? void 0 : oldResolution.resolvedModule) {
|
|
118469
|
+
if (file === oldSourceFile && !hasInvalidatedResolution(oldSourceFile.path)) {
|
|
118470
|
+
var oldResolvedModule = ts.getResolvedModule(oldSourceFile, moduleName, getModeForResolutionAtIndex(oldSourceFile, i));
|
|
118471
|
+
if (oldResolvedModule) {
|
|
118713
118472
|
if (ts.isTraceEnabled(options, host)) {
|
|
118714
|
-
|
|
118715
|
-
|
|
118716
|
-
ts.
|
|
118717
|
-
ts.Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 :
|
|
118718
|
-
ts.Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2, moduleName, fileLocation, oldResolution.resolvedModule.resolvedFileName, oldResolution.resolvedModule.packageId && ts.packageIdToString(oldResolution.resolvedModule.packageId));
|
|
118719
|
-
}
|
|
118720
|
-
else {
|
|
118721
|
-
ts.trace(host, oldResolution.resolvedModule.packageId ?
|
|
118722
|
-
ts.Diagnostics.Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3_with_Package_ID_4 :
|
|
118723
|
-
ts.Diagnostics.Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3, moduleName, fileLocation, ts.getDirectoryPath(fileLocation), oldResolution.resolvedModule.resolvedFileName, oldResolution.resolvedModule.packageId && ts.packageIdToString(oldResolution.resolvedModule.packageId));
|
|
118724
|
-
}
|
|
118473
|
+
ts.trace(host, oldResolvedModule.packageId ?
|
|
118474
|
+
ts.Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 :
|
|
118475
|
+
ts.Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2, moduleName, ts.getNormalizedAbsolutePath(file.originalFileName, currentDirectory), oldResolvedModule.resolvedFileName, oldResolvedModule.packageId && ts.packageIdToString(oldResolvedModule.packageId));
|
|
118725
118476
|
}
|
|
118726
|
-
(result
|
|
118727
|
-
(reusedNames
|
|
118477
|
+
(result || (result = new Array(moduleNames.length)))[i] = oldResolvedModule;
|
|
118478
|
+
(reusedNames || (reusedNames = [])).push(moduleName);
|
|
118728
118479
|
continue;
|
|
118729
118480
|
}
|
|
118730
118481
|
}
|
|
@@ -118743,16 +118494,15 @@ var ts;
|
|
|
118743
118494
|
resolvesToAmbientModuleInNonModifiedFile = moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName, i);
|
|
118744
118495
|
}
|
|
118745
118496
|
if (resolvesToAmbientModuleInNonModifiedFile) {
|
|
118746
|
-
(result
|
|
118497
|
+
(result || (result = new Array(moduleNames.length)))[i] = predictedToResolveToAmbientModuleMarker;
|
|
118747
118498
|
}
|
|
118748
118499
|
else {
|
|
118749
118500
|
// Resolution failed in the old program, or resolved to an ambient module for which we can't reuse the result.
|
|
118750
|
-
(unknownModuleNames
|
|
118751
|
-
(unknownModuleNamesIndex !== null && unknownModuleNamesIndex !== void 0 ? unknownModuleNamesIndex : (unknownModuleNamesIndex = [])).push(i);
|
|
118501
|
+
(unknownModuleNames || (unknownModuleNames = [])).push(moduleName);
|
|
118752
118502
|
}
|
|
118753
118503
|
}
|
|
118754
118504
|
var resolutions = unknownModuleNames && unknownModuleNames.length
|
|
118755
|
-
? resolveModuleNamesWorker(unknownModuleNames, file,
|
|
118505
|
+
? resolveModuleNamesWorker(unknownModuleNames, file, reusedNames)
|
|
118756
118506
|
: ts.emptyArray;
|
|
118757
118507
|
// Combine results of resolutions and predicted results
|
|
118758
118508
|
if (!result) {
|
|
@@ -118766,7 +118516,7 @@ var ts;
|
|
|
118766
118516
|
// `result[i]` is either a `ResolvedModuleFull` or a marker.
|
|
118767
118517
|
// If it is the former, we can leave it as is.
|
|
118768
118518
|
if (result[i] === predictedToResolveToAmbientModuleMarker) {
|
|
118769
|
-
result[i] =
|
|
118519
|
+
result[i] = undefined;
|
|
118770
118520
|
}
|
|
118771
118521
|
}
|
|
118772
118522
|
else {
|
|
@@ -118801,96 +118551,6 @@ var ts;
|
|
|
118801
118551
|
return true;
|
|
118802
118552
|
}
|
|
118803
118553
|
}
|
|
118804
|
-
function resolveTypeReferenceDirectiveNamesReusingOldState(typeDirectiveNames, containingFile) {
|
|
118805
|
-
var _a;
|
|
118806
|
-
if (structureIsReused === 0 /* Not */) {
|
|
118807
|
-
return resolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFile, /*partialResolutionInfo*/ undefined, /*redirectedReference*/ undefined);
|
|
118808
|
-
}
|
|
118809
|
-
var containingSourceFile = !ts.isString(containingFile) ? containingFile : undefined;
|
|
118810
|
-
var inferredTypeFile = !ts.isString(containingFile) ? undefined : containingFile;
|
|
118811
|
-
var oldSourceFile = containingSourceFile && (oldProgram === null || oldProgram === void 0 ? void 0 : oldProgram.getSourceFile(containingSourceFile.fileName));
|
|
118812
|
-
if (containingSourceFile && oldSourceFile !== containingSourceFile && containingSourceFile.resolvedTypeReferenceDirectiveNames) {
|
|
118813
|
-
// `file` was created for the new program.
|
|
118814
|
-
//
|
|
118815
|
-
// We only set `file.resolvedTypeReferenceDirectiveNames` via work from the current function,
|
|
118816
|
-
// so it is defined iff we already called the current function on `file`.
|
|
118817
|
-
// That call happened no later than the creation of the `file` object,
|
|
118818
|
-
// which per above occurred during the current program creation.
|
|
118819
|
-
// Since we assume the filesystem does not change during program creation,
|
|
118820
|
-
// it is safe to reuse resolutions from the earlier call.
|
|
118821
|
-
var result_15 = [];
|
|
118822
|
-
for (var _i = 0, _b = typeDirectiveNames; _i < _b.length; _i++) {
|
|
118823
|
-
var typeDirectiveName = _b[_i];
|
|
118824
|
-
// We lower-case all type references because npm automatically lowercases all packages. See GH#9824.
|
|
118825
|
-
var resolvedTypeReferenceDirective = containingSourceFile.resolvedTypeReferenceDirectiveNames.get(ts.toFileNameLowerCase(typeDirectiveName.fileName), typeDirectiveName.resolutionMode || containingSourceFile.impliedNodeFormat);
|
|
118826
|
-
result_15.push(resolvedTypeReferenceDirective);
|
|
118827
|
-
}
|
|
118828
|
-
return result_15;
|
|
118829
|
-
}
|
|
118830
|
-
/** An ordered list of module names for which we cannot recover the resolution. */
|
|
118831
|
-
var unknownTypeReferenceDirectiveNames;
|
|
118832
|
-
var unknownTypeReferenceDirectiveNamesIndex;
|
|
118833
|
-
/**
|
|
118834
|
-
* The indexing of elements in this list matches that of `moduleNames`.
|
|
118835
|
-
*
|
|
118836
|
-
* Before combining results, result[i] is in one of the following states:
|
|
118837
|
-
* * undefined: needs to be recomputed,
|
|
118838
|
-
*/
|
|
118839
|
-
var result;
|
|
118840
|
-
var reusedNames;
|
|
118841
|
-
var canReuseResolutions = oldBuildInfoProgram || (containingSourceFile ?
|
|
118842
|
-
containingSourceFile === oldSourceFile && !hasInvalidatedResolution(oldSourceFile.path) :
|
|
118843
|
-
!hasInvalidatedResolution(toPath(inferredTypeFile)));
|
|
118844
|
-
var redirectedReference;
|
|
118845
|
-
for (var i = 0; i < typeDirectiveNames.length; i++) {
|
|
118846
|
-
var entry = typeDirectiveNames[i];
|
|
118847
|
-
// If the source file is unchanged and doesnt have invalidated resolution, reuse the module resolutions
|
|
118848
|
-
if (canReuseResolutions) {
|
|
118849
|
-
var typeDirectiveName = !ts.isString(entry) ? entry.fileName.toLowerCase() : entry;
|
|
118850
|
-
var mode = getModeForFileReference(entry, containingSourceFile === null || containingSourceFile === void 0 ? void 0 : containingSourceFile.impliedNodeFormat);
|
|
118851
|
-
var oldResolution = !oldBuildInfoProgram ?
|
|
118852
|
-
(_a = (containingSourceFile ? oldSourceFile === null || oldSourceFile === void 0 ? void 0 : oldSourceFile.resolvedTypeReferenceDirectiveNames : oldProgram === null || oldProgram === void 0 ? void 0 : oldProgram.getAutomaticTypeDirectiveResolutions())) === null || _a === void 0 ? void 0 : _a.get(typeDirectiveName, mode) :
|
|
118853
|
-
oldBuildInfoProgram.getResolvedTypeReferenceDirective(ts.getDirectoryPath(containingSourceFile ? containingSourceFile.path : toPath(inferredTypeFile)), typeDirectiveName, mode, containingSourceFile && (redirectedReference === undefined ? (redirectedReference = getRedirectReferenceForResolution(containingSourceFile) || false) : redirectedReference) || undefined);
|
|
118854
|
-
if (oldResolution === null || oldResolution === void 0 ? void 0 : oldResolution.resolvedTypeReferenceDirective) {
|
|
118855
|
-
if (ts.isTraceEnabled(options, host)) {
|
|
118856
|
-
var fileLocation = containingSourceFile ? ts.getNormalizedAbsolutePath(containingSourceFile.originalFileName, currentDirectory) : inferredTypeFile;
|
|
118857
|
-
if (!oldBuildInfoProgram) {
|
|
118858
|
-
ts.trace(host, oldResolution.resolvedTypeReferenceDirective.packageId ?
|
|
118859
|
-
ts.Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 :
|
|
118860
|
-
ts.Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved_to_2, typeDirectiveName, fileLocation, oldResolution.resolvedTypeReferenceDirective.resolvedFileName, oldResolution.resolvedTypeReferenceDirective.packageId && ts.packageIdToString(oldResolution.resolvedTypeReferenceDirective.packageId));
|
|
118861
|
-
}
|
|
118862
|
-
else {
|
|
118863
|
-
ts.trace(host, oldResolution.resolvedTypeReferenceDirective.packageId ?
|
|
118864
|
-
ts.Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3_with_Package_ID_4 :
|
|
118865
|
-
ts.Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3, typeDirectiveName, fileLocation, ts.getDirectoryPath(fileLocation), oldResolution.resolvedTypeReferenceDirective.resolvedFileName, oldResolution.resolvedTypeReferenceDirective.packageId && ts.packageIdToString(oldResolution.resolvedTypeReferenceDirective.packageId));
|
|
118866
|
-
}
|
|
118867
|
-
}
|
|
118868
|
-
(result || (result = new Array(typeDirectiveNames.length)))[i] = oldResolution;
|
|
118869
|
-
(reusedNames !== null && reusedNames !== void 0 ? reusedNames : (reusedNames = [])).push({ name: typeDirectiveName, mode: mode });
|
|
118870
|
-
continue;
|
|
118871
|
-
}
|
|
118872
|
-
}
|
|
118873
|
-
// Resolution failed in the old program, or resolved to an ambient module for which we can't reuse the result.
|
|
118874
|
-
(unknownTypeReferenceDirectiveNames !== null && unknownTypeReferenceDirectiveNames !== void 0 ? unknownTypeReferenceDirectiveNames : (unknownTypeReferenceDirectiveNames = [])).push(entry);
|
|
118875
|
-
(unknownTypeReferenceDirectiveNamesIndex !== null && unknownTypeReferenceDirectiveNamesIndex !== void 0 ? unknownTypeReferenceDirectiveNamesIndex : (unknownTypeReferenceDirectiveNamesIndex = [])).push(i);
|
|
118876
|
-
}
|
|
118877
|
-
if (!unknownTypeReferenceDirectiveNames)
|
|
118878
|
-
return result || ts.emptyArray;
|
|
118879
|
-
var resolutions = resolveTypeReferenceDirectiveNamesWorker(unknownTypeReferenceDirectiveNames, containingFile, { reusedNames: reusedNames, namesIndex: unknownTypeReferenceDirectiveNamesIndex }, redirectedReference);
|
|
118880
|
-
if (!result) {
|
|
118881
|
-
ts.Debug.assert(resolutions.length === typeDirectiveNames.length);
|
|
118882
|
-
return resolutions;
|
|
118883
|
-
}
|
|
118884
|
-
var j = 0;
|
|
118885
|
-
for (var i = 0; i < result.length; i++) {
|
|
118886
|
-
if (!result[i]) {
|
|
118887
|
-
result[i] = resolutions[j];
|
|
118888
|
-
j++;
|
|
118889
|
-
}
|
|
118890
|
-
}
|
|
118891
|
-
ts.Debug.assert(j === resolutions.length);
|
|
118892
|
-
return result;
|
|
118893
|
-
}
|
|
118894
118554
|
function canReuseProjectReferences() {
|
|
118895
118555
|
return !forEachProjectReference(oldProgram.getProjectReferences(), oldProgram.getResolvedProjectReferences(), function (oldResolvedRef, parent, index) {
|
|
118896
118556
|
var newRef = (parent ? parent.commandLine.projectReferences : projectReferences)[index];
|
|
@@ -118912,19 +118572,14 @@ var ts;
|
|
|
118912
118572
|
});
|
|
118913
118573
|
}
|
|
118914
118574
|
function tryReuseStructureFromOldProgram() {
|
|
118915
|
-
|
|
118916
|
-
|
|
118917
|
-
var oldOptions = (oldProgram === null || oldProgram === void 0 ? void 0 : oldProgram.getCompilerOptions()) || (oldBuildInfoProgram === null || oldBuildInfoProgram === void 0 ? void 0 : oldBuildInfoProgram.getCompilerOptions());
|
|
118918
|
-
if (!oldOptions || ts.changesAffectModuleResolution(oldOptions, options)) {
|
|
118575
|
+
var _a;
|
|
118576
|
+
if (!oldProgram) {
|
|
118919
118577
|
return 0 /* Not */;
|
|
118920
118578
|
}
|
|
118921
|
-
|
|
118922
|
-
|
|
118923
|
-
|
|
118924
|
-
|
|
118925
|
-
}
|
|
118926
|
-
function tryReuseStructureFromOldProgramWorker() {
|
|
118927
|
-
if (!oldProgram) {
|
|
118579
|
+
// check properties that can affect structure of the program or module resolution strategy
|
|
118580
|
+
// if any of these properties has changed - structure cannot be reused
|
|
118581
|
+
var oldOptions = oldProgram.getCompilerOptions();
|
|
118582
|
+
if (ts.changesAffectModuleResolution(oldOptions, options)) {
|
|
118928
118583
|
return 0 /* Not */;
|
|
118929
118584
|
}
|
|
118930
118585
|
// there is an old program, check if we can reuse its structure
|
|
@@ -118942,7 +118597,7 @@ var ts;
|
|
|
118942
118597
|
// check if program source files has changed in the way that can affect structure of the program
|
|
118943
118598
|
var newSourceFiles = [];
|
|
118944
118599
|
var modifiedSourceFiles = [];
|
|
118945
|
-
structureIsReused =
|
|
118600
|
+
structureIsReused = 2 /* Completely */;
|
|
118946
118601
|
// If the missing file paths are now present, it can change the progam structure,
|
|
118947
118602
|
// and hence cant reuse the structure.
|
|
118948
118603
|
// This is same as how we dont reuse the structure if one of the file from old program is now missing
|
|
@@ -119006,107 +118661,98 @@ var ts;
|
|
|
119006
118661
|
// The `newSourceFile` object was created for the new program.
|
|
119007
118662
|
if (!ts.arrayIsEqualTo(oldSourceFile.libReferenceDirectives, newSourceFile.libReferenceDirectives, fileReferenceIsEqualTo)) {
|
|
119008
118663
|
// 'lib' references has changed. Matches behavior in changesAffectModuleResolution
|
|
119009
|
-
structureIsReused =
|
|
118664
|
+
structureIsReused = 1 /* SafeModules */;
|
|
119010
118665
|
}
|
|
119011
118666
|
if (oldSourceFile.hasNoDefaultLib !== newSourceFile.hasNoDefaultLib) {
|
|
119012
118667
|
// value of no-default-lib has changed
|
|
119013
118668
|
// this will affect if default library is injected into the list of files
|
|
119014
|
-
structureIsReused =
|
|
118669
|
+
structureIsReused = 1 /* SafeModules */;
|
|
119015
118670
|
}
|
|
119016
118671
|
// check tripleslash references
|
|
119017
118672
|
if (!ts.arrayIsEqualTo(oldSourceFile.referencedFiles, newSourceFile.referencedFiles, fileReferenceIsEqualTo)) {
|
|
119018
118673
|
// tripleslash references has changed
|
|
119019
|
-
structureIsReused =
|
|
118674
|
+
structureIsReused = 1 /* SafeModules */;
|
|
119020
118675
|
}
|
|
119021
118676
|
// check imports and module augmentations
|
|
119022
118677
|
collectExternalModuleReferences(newSourceFile);
|
|
119023
118678
|
if (!ts.arrayIsEqualTo(oldSourceFile.imports, newSourceFile.imports, moduleNameIsEqualTo)) {
|
|
119024
118679
|
// imports has changed
|
|
119025
|
-
structureIsReused =
|
|
118680
|
+
structureIsReused = 1 /* SafeModules */;
|
|
119026
118681
|
}
|
|
119027
118682
|
if (!ts.arrayIsEqualTo(oldSourceFile.moduleAugmentations, newSourceFile.moduleAugmentations, moduleNameIsEqualTo)) {
|
|
119028
118683
|
// moduleAugmentations has changed
|
|
119029
|
-
structureIsReused =
|
|
118684
|
+
structureIsReused = 1 /* SafeModules */;
|
|
119030
118685
|
}
|
|
119031
118686
|
if ((oldSourceFile.flags & 6291456 /* PermanentlySetIncrementalFlags */) !== (newSourceFile.flags & 6291456 /* PermanentlySetIncrementalFlags */)) {
|
|
119032
118687
|
// dynamicImport has changed
|
|
119033
|
-
structureIsReused =
|
|
118688
|
+
structureIsReused = 1 /* SafeModules */;
|
|
119034
118689
|
}
|
|
119035
118690
|
if (!ts.arrayIsEqualTo(oldSourceFile.typeReferenceDirectives, newSourceFile.typeReferenceDirectives, fileReferenceIsEqualTo)) {
|
|
119036
118691
|
// 'types' references has changed
|
|
119037
|
-
structureIsReused =
|
|
118692
|
+
structureIsReused = 1 /* SafeModules */;
|
|
119038
118693
|
}
|
|
119039
118694
|
// tentatively approve the file
|
|
119040
118695
|
modifiedSourceFiles.push({ oldFile: oldSourceFile, newFile: newSourceFile });
|
|
119041
118696
|
}
|
|
119042
118697
|
else if (hasInvalidatedResolution(oldSourceFile.path)) {
|
|
119043
118698
|
// 'module/types' references could have changed
|
|
119044
|
-
structureIsReused =
|
|
118699
|
+
structureIsReused = 1 /* SafeModules */;
|
|
119045
118700
|
// add file to the modified list so that we will resolve it later
|
|
119046
118701
|
modifiedSourceFiles.push({ oldFile: oldSourceFile, newFile: newSourceFile });
|
|
119047
118702
|
}
|
|
119048
118703
|
// if file has passed all checks it should be safe to reuse it
|
|
119049
118704
|
newSourceFiles.push(newSourceFile);
|
|
119050
118705
|
}
|
|
119051
|
-
if (structureIsReused !==
|
|
118706
|
+
if (structureIsReused !== 2 /* Completely */) {
|
|
119052
118707
|
return structureIsReused;
|
|
119053
118708
|
}
|
|
119054
118709
|
var modifiedFiles = modifiedSourceFiles.map(function (f) { return f.oldFile; });
|
|
119055
|
-
for (var
|
|
119056
|
-
var oldFile = oldSourceFiles_3[
|
|
118710
|
+
for (var _b = 0, oldSourceFiles_3 = oldSourceFiles; _b < oldSourceFiles_3.length; _b++) {
|
|
118711
|
+
var oldFile = oldSourceFiles_3[_b];
|
|
119057
118712
|
if (!ts.contains(modifiedFiles, oldFile)) {
|
|
119058
|
-
for (var
|
|
119059
|
-
var moduleName = _c
|
|
118713
|
+
for (var _c = 0, _d = oldFile.ambientModuleNames; _c < _d.length; _c++) {
|
|
118714
|
+
var moduleName = _d[_c];
|
|
119060
118715
|
ambientModuleNameToUnmodifiedFileName.set(moduleName, oldFile.fileName);
|
|
119061
118716
|
}
|
|
119062
118717
|
}
|
|
119063
118718
|
}
|
|
119064
118719
|
// try to verify results of module resolution
|
|
119065
|
-
for (var
|
|
119066
|
-
var
|
|
118720
|
+
for (var _e = 0, modifiedSourceFiles_1 = modifiedSourceFiles; _e < modifiedSourceFiles_1.length; _e++) {
|
|
118721
|
+
var _f = modifiedSourceFiles_1[_e], oldSourceFile = _f.oldFile, newSourceFile = _f.newFile;
|
|
119067
118722
|
var moduleNames = getModuleNames(newSourceFile);
|
|
119068
118723
|
var resolutions = resolveModuleNamesReusingOldState(moduleNames, newSourceFile);
|
|
119069
118724
|
// ensure that module resolution results are still correct
|
|
119070
118725
|
var resolutionsChanged = ts.hasChangesInResolutions(moduleNames, resolutions, oldSourceFile.resolvedModules, oldSourceFile, ts.moduleResolutionIsEqualTo);
|
|
119071
118726
|
if (resolutionsChanged) {
|
|
119072
|
-
structureIsReused =
|
|
118727
|
+
structureIsReused = 1 /* SafeModules */;
|
|
119073
118728
|
newSourceFile.resolvedModules = ts.zipToModeAwareCache(newSourceFile, moduleNames, resolutions);
|
|
119074
118729
|
}
|
|
119075
118730
|
else {
|
|
119076
118731
|
newSourceFile.resolvedModules = oldSourceFile.resolvedModules;
|
|
119077
118732
|
}
|
|
119078
118733
|
var typesReferenceDirectives = newSourceFile.typeReferenceDirectives;
|
|
119079
|
-
var typeReferenceResolutions =
|
|
118734
|
+
var typeReferenceResolutions = resolveTypeReferenceDirectiveNamesWorker(typesReferenceDirectives, newSourceFile);
|
|
119080
118735
|
// ensure that types resolutions are still correct
|
|
119081
118736
|
var typeReferenceResolutionsChanged = ts.hasChangesInResolutions(typesReferenceDirectives, typeReferenceResolutions, oldSourceFile.resolvedTypeReferenceDirectiveNames, oldSourceFile, ts.typeDirectiveIsEqualTo);
|
|
119082
118737
|
if (typeReferenceResolutionsChanged) {
|
|
119083
|
-
structureIsReused =
|
|
118738
|
+
structureIsReused = 1 /* SafeModules */;
|
|
119084
118739
|
newSourceFile.resolvedTypeReferenceDirectiveNames = ts.zipToModeAwareCache(newSourceFile, typesReferenceDirectives, typeReferenceResolutions);
|
|
119085
118740
|
}
|
|
119086
118741
|
else {
|
|
119087
118742
|
newSourceFile.resolvedTypeReferenceDirectiveNames = oldSourceFile.resolvedTypeReferenceDirectiveNames;
|
|
119088
118743
|
}
|
|
119089
118744
|
}
|
|
119090
|
-
if (structureIsReused !==
|
|
118745
|
+
if (structureIsReused !== 2 /* Completely */) {
|
|
119091
118746
|
return structureIsReused;
|
|
119092
118747
|
}
|
|
119093
|
-
if (ts.changesAffectingProgramStructure(
|
|
119094
|
-
return
|
|
119095
|
-
}
|
|
119096
|
-
if (host.hasChangedAutomaticTypeDirectiveNames) {
|
|
119097
|
-
if (host.hasChangedAutomaticTypeDirectiveNames())
|
|
119098
|
-
return 2 /* SafeModules */;
|
|
119099
|
-
}
|
|
119100
|
-
else {
|
|
119101
|
-
automaticTypeDirectiveNames = ts.getAutomaticTypeDirectiveNames(options, host);
|
|
119102
|
-
if (!ts.arrayIsEqualTo(oldProgram.getAutomaticTypeDirectiveNames(), automaticTypeDirectiveNames))
|
|
119103
|
-
return 2 /* SafeModules */;
|
|
118748
|
+
if (ts.changesAffectingProgramStructure(oldOptions, options) || ((_a = host.hasChangedAutomaticTypeDirectiveNames) === null || _a === void 0 ? void 0 : _a.call(host))) {
|
|
118749
|
+
return 1 /* SafeModules */;
|
|
119104
118750
|
}
|
|
119105
118751
|
missingFilePaths = oldProgram.getMissingFilePaths();
|
|
119106
118752
|
// update fileName -> file mapping
|
|
119107
118753
|
ts.Debug.assert(newSourceFiles.length === oldProgram.getSourceFiles().length);
|
|
119108
|
-
for (var
|
|
119109
|
-
var newSourceFile = newSourceFiles_1[
|
|
118754
|
+
for (var _g = 0, newSourceFiles_1 = newSourceFiles; _g < newSourceFiles_1.length; _g++) {
|
|
118755
|
+
var newSourceFile = newSourceFiles_1[_g];
|
|
119110
118756
|
filesByName.set(newSourceFile.path, newSourceFile);
|
|
119111
118757
|
}
|
|
119112
118758
|
var oldFilesByNameMap = oldProgram.getFilesByNameMap();
|
|
@@ -119128,12 +118774,10 @@ var ts;
|
|
|
119128
118774
|
fileReasons = oldProgram.getFileIncludeReasons();
|
|
119129
118775
|
fileProcessingDiagnostics = oldProgram.getFileProcessingDiagnostics();
|
|
119130
118776
|
resolvedTypeReferenceDirectives = oldProgram.getResolvedTypeReferenceDirectives();
|
|
119131
|
-
automaticTypeDirectiveNames = oldProgram.getAutomaticTypeDirectiveNames();
|
|
119132
|
-
automaticTypeDirectiveResolutions = oldProgram.getAutomaticTypeDirectiveResolutions();
|
|
119133
118777
|
sourceFileToPackageName = oldProgram.sourceFileToPackageName;
|
|
119134
118778
|
redirectTargetsMap = oldProgram.redirectTargetsMap;
|
|
119135
118779
|
usesUriStyleNodeCoreModules = oldProgram.usesUriStyleNodeCoreModules;
|
|
119136
|
-
return
|
|
118780
|
+
return 2 /* Completely */;
|
|
119137
118781
|
}
|
|
119138
118782
|
function getEmitHost(writeFileCallback) {
|
|
119139
118783
|
return {
|
|
@@ -120175,42 +119819,35 @@ var ts;
|
|
|
120175
119819
|
}
|
|
120176
119820
|
function processTypeReferenceDirectives(file) {
|
|
120177
119821
|
var typeDirectives = file.typeReferenceDirectives;
|
|
120178
|
-
if (!typeDirectives
|
|
120179
|
-
file.resolvedTypeReferenceDirectiveNames = undefined;
|
|
119822
|
+
if (!typeDirectives) {
|
|
120180
119823
|
return;
|
|
120181
119824
|
}
|
|
120182
|
-
var resolutions =
|
|
119825
|
+
var resolutions = resolveTypeReferenceDirectiveNamesWorker(typeDirectives, file);
|
|
120183
119826
|
for (var index = 0; index < typeDirectives.length; index++) {
|
|
120184
119827
|
var ref = file.typeReferenceDirectives[index];
|
|
120185
119828
|
var resolvedTypeReferenceDirective = resolutions[index];
|
|
120186
119829
|
// store resolved type directive on the file
|
|
120187
119830
|
var fileName = ts.toFileNameLowerCase(ref.fileName);
|
|
120188
|
-
ts.setResolvedTypeReferenceDirective(file, fileName, resolvedTypeReferenceDirective
|
|
119831
|
+
ts.setResolvedTypeReferenceDirective(file, fileName, resolvedTypeReferenceDirective);
|
|
120189
119832
|
var mode = ref.resolutionMode || file.impliedNodeFormat;
|
|
120190
119833
|
if (mode && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeNext) {
|
|
120191
|
-
(
|
|
120192
|
-
kind: 2 /* ResolutionDiagnostics */,
|
|
120193
|
-
diagnostics: [ts.createDiagnosticForRange(file, ref, ts.Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext)]
|
|
120194
|
-
});
|
|
119834
|
+
programDiagnostics.add(ts.createDiagnosticForRange(file, ref, ts.Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext));
|
|
120195
119835
|
}
|
|
120196
119836
|
processTypeReferenceDirective(fileName, mode, resolvedTypeReferenceDirective, { kind: ts.FileIncludeKind.TypeReferenceDirective, file: file.path, index: index, });
|
|
120197
119837
|
}
|
|
120198
119838
|
}
|
|
120199
|
-
function processTypeReferenceDirective(typeReferenceDirective, mode,
|
|
120200
|
-
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program" /* Program */, "processTypeReferenceDirective", { directive: typeReferenceDirective, hasResolved: !!
|
|
120201
|
-
processTypeReferenceDirectiveWorker(typeReferenceDirective, mode,
|
|
119839
|
+
function processTypeReferenceDirective(typeReferenceDirective, mode, resolvedTypeReferenceDirective, reason) {
|
|
119840
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program" /* Program */, "processTypeReferenceDirective", { directive: typeReferenceDirective, hasResolved: !!resolvedTypeReferenceDirective, refKind: reason.kind, refPath: isReferencedFile(reason) ? reason.file : undefined });
|
|
119841
|
+
processTypeReferenceDirectiveWorker(typeReferenceDirective, mode, resolvedTypeReferenceDirective, reason);
|
|
120202
119842
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
120203
119843
|
}
|
|
120204
|
-
function processTypeReferenceDirectiveWorker(typeReferenceDirective, mode,
|
|
120205
|
-
var _a;
|
|
120206
|
-
addResolutionDiagnostics(resolution);
|
|
119844
|
+
function processTypeReferenceDirectiveWorker(typeReferenceDirective, mode, resolvedTypeReferenceDirective, reason) {
|
|
120207
119845
|
// If we already found this library as a primary reference - nothing to do
|
|
120208
|
-
var previousResolution =
|
|
119846
|
+
var previousResolution = resolvedTypeReferenceDirectives.get(typeReferenceDirective, mode);
|
|
120209
119847
|
if (previousResolution && previousResolution.primary) {
|
|
120210
119848
|
return;
|
|
120211
119849
|
}
|
|
120212
119850
|
var saveResolution = true;
|
|
120213
|
-
var resolvedTypeReferenceDirective = resolution.resolvedTypeReferenceDirective;
|
|
120214
119851
|
if (resolvedTypeReferenceDirective) {
|
|
120215
119852
|
if (resolvedTypeReferenceDirective.isExternalLibraryImport)
|
|
120216
119853
|
currentNodeModulesDepth++;
|
|
@@ -120245,7 +119882,7 @@ var ts;
|
|
|
120245
119882
|
addFilePreprocessingFileExplainingDiagnostic(/*file*/ undefined, reason, ts.Diagnostics.Cannot_find_type_definition_file_for_0, [typeReferenceDirective]);
|
|
120246
119883
|
}
|
|
120247
119884
|
if (saveResolution) {
|
|
120248
|
-
resolvedTypeReferenceDirectives.set(typeReferenceDirective, mode,
|
|
119885
|
+
resolvedTypeReferenceDirectives.set(typeReferenceDirective, mode, resolvedTypeReferenceDirective);
|
|
120249
119886
|
}
|
|
120250
119887
|
}
|
|
120251
119888
|
function pathForLibFile(libFileName) {
|
|
@@ -120278,7 +119915,7 @@ var ts;
|
|
|
120278
119915
|
var unqualifiedLibName = ts.removeSuffix(ts.removePrefix(libName, "lib."), ".d.ts");
|
|
120279
119916
|
var suggestion = ts.getSpellingSuggestion(unqualifiedLibName, ts.libs, ts.identity);
|
|
120280
119917
|
var diagnostic = suggestion ? ts.Diagnostics.Cannot_find_lib_definition_for_0_Did_you_mean_1 : ts.Diagnostics.Cannot_find_lib_definition_for_0;
|
|
120281
|
-
(fileProcessingDiagnostics
|
|
119918
|
+
(fileProcessingDiagnostics || (fileProcessingDiagnostics = [])).push({
|
|
120282
119919
|
kind: 0 /* FilePreprocessingReferencedDiagnostic */,
|
|
120283
119920
|
reason: { kind: ts.FileIncludeKind.LibReferenceDirective, file: file.path, index: index, },
|
|
120284
119921
|
diagnostic: diagnostic,
|
|
@@ -120302,14 +119939,13 @@ var ts;
|
|
|
120302
119939
|
for (var index = 0; index < moduleNames.length; index++) {
|
|
120303
119940
|
var resolution = resolutions[index];
|
|
120304
119941
|
ts.setResolvedModule(file, moduleNames[index], resolution, getModeForResolutionAtIndex(file, index));
|
|
120305
|
-
|
|
120306
|
-
if (!resolution.resolvedModule) {
|
|
119942
|
+
if (!resolution) {
|
|
120307
119943
|
continue;
|
|
120308
119944
|
}
|
|
120309
|
-
var isFromNodeModulesSearch = resolution.
|
|
120310
|
-
var isJsFile = !ts.resolutionExtensionIsTSOrJson(resolution.
|
|
119945
|
+
var isFromNodeModulesSearch = resolution.isExternalLibraryImport;
|
|
119946
|
+
var isJsFile = !ts.resolutionExtensionIsTSOrJson(resolution.extension);
|
|
120311
119947
|
var isJsFileFromNodeModules = isFromNodeModulesSearch && isJsFile;
|
|
120312
|
-
var resolvedFileName = resolution.
|
|
119948
|
+
var resolvedFileName = resolution.resolvedFileName;
|
|
120313
119949
|
if (isFromNodeModulesSearch) {
|
|
120314
119950
|
currentNodeModulesDepth++;
|
|
120315
119951
|
}
|
|
@@ -120322,7 +119958,7 @@ var ts;
|
|
|
120322
119958
|
// Don't add the file if it has a bad extension (e.g. 'tsx' if we don't have '--allowJs')
|
|
120323
119959
|
// This may still end up being an untyped module -- the file won't be included but imports will be allowed.
|
|
120324
119960
|
var shouldAddFile = resolvedFileName
|
|
120325
|
-
&& !getResolutionDiagnostic(optionsForFile, resolution
|
|
119961
|
+
&& !getResolutionDiagnostic(optionsForFile, resolution)
|
|
120326
119962
|
&& !optionsForFile.noResolve
|
|
120327
119963
|
&& index < file.imports.length
|
|
120328
119964
|
&& !elideImport
|
|
@@ -120334,7 +119970,7 @@ var ts;
|
|
|
120334
119970
|
else if (shouldAddFile) {
|
|
120335
119971
|
findSourceFile(resolvedFileName,
|
|
120336
119972
|
/*isDefaultLib*/ false,
|
|
120337
|
-
/*ignoreNoDefaultLib*/ false, { kind: ts.FileIncludeKind.Import, file: file.path, index: index, }, resolution.
|
|
119973
|
+
/*ignoreNoDefaultLib*/ false, { kind: ts.FileIncludeKind.Import, file: file.path, index: index, }, resolution.packageId);
|
|
120338
119974
|
}
|
|
120339
119975
|
if (isFromNodeModulesSearch) {
|
|
120340
119976
|
currentNodeModulesDepth--;
|
|
@@ -120438,9 +120074,6 @@ var ts;
|
|
|
120438
120074
|
createDiagnosticForOptionName(ts.Diagnostics.Composite_projects_may_not_disable_incremental_compilation, "declaration");
|
|
120439
120075
|
}
|
|
120440
120076
|
}
|
|
120441
|
-
if (options.cacheResolutions && !ts.isIncrementalCompilation(options)) {
|
|
120442
|
-
createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1_or_option_2, "cacheResolutions", "incremental", "composite");
|
|
120443
|
-
}
|
|
120444
120077
|
var outputFile = ts.outFile(options);
|
|
120445
120078
|
if (options.tsBuildInfoFile) {
|
|
120446
120079
|
if (!ts.isIncrementalCompilation(options)) {
|
|
@@ -120709,7 +120342,7 @@ var ts;
|
|
|
120709
120342
|
}
|
|
120710
120343
|
}
|
|
120711
120344
|
function addFilePreprocessingFileExplainingDiagnostic(file, fileProcessingReason, diagnostic, args) {
|
|
120712
|
-
(fileProcessingDiagnostics
|
|
120345
|
+
(fileProcessingDiagnostics || (fileProcessingDiagnostics = [])).push({
|
|
120713
120346
|
kind: 1 /* FilePreprocessingFileExplainingDiagnostic */,
|
|
120714
120347
|
file: file && file.path,
|
|
120715
120348
|
fileProcessingReason: fileProcessingReason,
|
|
@@ -120977,8 +120610,8 @@ var ts;
|
|
|
120977
120610
|
if (!symlinks) {
|
|
120978
120611
|
symlinks = ts.createSymlinkCache(currentDirectory, getCanonicalFileName);
|
|
120979
120612
|
}
|
|
120980
|
-
if (files &&
|
|
120981
|
-
symlinks.setSymlinksFromResolutions(files,
|
|
120613
|
+
if (files && resolvedTypeReferenceDirectives && !symlinks.hasProcessedResolutions()) {
|
|
120614
|
+
symlinks.setSymlinksFromResolutions(files, resolvedTypeReferenceDirectives);
|
|
120982
120615
|
}
|
|
120983
120616
|
return symlinks;
|
|
120984
120617
|
}
|
|
@@ -121391,8 +121024,7 @@ var ts;
|
|
|
121391
121024
|
}
|
|
121392
121025
|
// Handle type reference directives
|
|
121393
121026
|
if (sourceFile.resolvedTypeReferenceDirectiveNames) {
|
|
121394
|
-
sourceFile.resolvedTypeReferenceDirectiveNames.forEach(function (
|
|
121395
|
-
var resolvedTypeReferenceDirective = _a.resolvedTypeReferenceDirective;
|
|
121027
|
+
sourceFile.resolvedTypeReferenceDirectiveNames.forEach(function (resolvedTypeReferenceDirective) {
|
|
121396
121028
|
if (!resolvedTypeReferenceDirective) {
|
|
121397
121029
|
return;
|
|
121398
121030
|
}
|
|
@@ -121451,13 +121083,12 @@ var ts;
|
|
|
121451
121083
|
/**
|
|
121452
121084
|
* Creates the state of file references and signature for the new program from oldState if it is safe
|
|
121453
121085
|
*/
|
|
121454
|
-
function create(newProgram, oldState, disableUseFileVersionAsSignature) {
|
|
121086
|
+
function create(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature) {
|
|
121455
121087
|
var _a, _b, _c;
|
|
121456
121088
|
var fileInfos = new ts.Map();
|
|
121457
121089
|
var referencedMap = newProgram.getCompilerOptions().module !== ts.ModuleKind.None ? createManyToManyPathMap() : undefined;
|
|
121458
121090
|
var exportedModulesMap = referencedMap ? createManyToManyPathMap() : undefined;
|
|
121459
121091
|
var useOldState = canReuseOldState(referencedMap, oldState);
|
|
121460
|
-
var getCanonicalFileName = ts.createGetCanonicalFileName(newProgram.useCaseSensitiveFileNames());
|
|
121461
121092
|
// Ensure source files have parent pointers set
|
|
121462
121093
|
newProgram.getTypeChecker();
|
|
121463
121094
|
// Create the reference map, and set the file infos
|
|
@@ -121510,23 +121141,23 @@ var ts;
|
|
|
121510
121141
|
/**
|
|
121511
121142
|
* Gets the files affected by the path from the program
|
|
121512
121143
|
*/
|
|
121513
|
-
function getFilesAffectedBy(state, programOfThisState, path, cancellationToken,
|
|
121144
|
+
function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, computeHash, getCanonicalFileName) {
|
|
121514
121145
|
var _a, _b;
|
|
121515
|
-
var result = getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken,
|
|
121146
|
+
var result = getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash, getCanonicalFileName);
|
|
121516
121147
|
(_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.clear();
|
|
121517
121148
|
(_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
|
|
121518
121149
|
return result;
|
|
121519
121150
|
}
|
|
121520
121151
|
BuilderState.getFilesAffectedBy = getFilesAffectedBy;
|
|
121521
|
-
function getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken,
|
|
121152
|
+
function getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash, getCanonicalFileName) {
|
|
121522
121153
|
var sourceFile = programOfThisState.getSourceFileByPath(path);
|
|
121523
121154
|
if (!sourceFile) {
|
|
121524
121155
|
return ts.emptyArray;
|
|
121525
121156
|
}
|
|
121526
|
-
if (!updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken,
|
|
121157
|
+
if (!updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash, getCanonicalFileName)) {
|
|
121527
121158
|
return [sourceFile];
|
|
121528
121159
|
}
|
|
121529
|
-
return (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, cancellationToken,
|
|
121160
|
+
return (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, cancellationToken, computeHash, getCanonicalFileName);
|
|
121530
121161
|
}
|
|
121531
121162
|
BuilderState.getFilesAffectedByWithOldState = getFilesAffectedByWithOldState;
|
|
121532
121163
|
function updateSignatureOfFile(state, signature, path) {
|
|
@@ -121537,7 +121168,7 @@ var ts;
|
|
|
121537
121168
|
/**
|
|
121538
121169
|
* Returns if the shape of the signature has changed since last emit
|
|
121539
121170
|
*/
|
|
121540
|
-
function updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken,
|
|
121171
|
+
function updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash, getCanonicalFileName, useFileVersionAsSignature) {
|
|
121541
121172
|
var _a;
|
|
121542
121173
|
if (useFileVersionAsSignature === void 0) { useFileVersionAsSignature = state.useFileVersionAsSignature; }
|
|
121543
121174
|
// If we have cached the result for this file, that means hence forth we should assume file shape is uptodate
|
|
@@ -121549,7 +121180,7 @@ var ts;
|
|
|
121549
121180
|
if (!sourceFile.isDeclarationFile && !useFileVersionAsSignature) {
|
|
121550
121181
|
programOfThisState.emit(sourceFile, function (fileName, text, _writeByteOrderMark, _onError, sourceFiles, data) {
|
|
121551
121182
|
ts.Debug.assert(ts.isDeclarationFileName(fileName), "File extension for signature expected to be dts: Got:: " + fileName);
|
|
121552
|
-
latestSignature = ts.computeSignatureWithDiagnostics(sourceFile, text,
|
|
121183
|
+
latestSignature = ts.computeSignatureWithDiagnostics(sourceFile, text, computeHash, getCanonicalFileName, data);
|
|
121553
121184
|
if (latestSignature !== prevSignature) {
|
|
121554
121185
|
updateExportedModules(state, sourceFile, sourceFiles[0].exportedModulesFromDeclarationEmit);
|
|
121555
121186
|
}
|
|
@@ -121728,7 +121359,7 @@ var ts;
|
|
|
121728
121359
|
/**
|
|
121729
121360
|
* When program emits modular code, gets the files affected by the sourceFile whose shape has changed
|
|
121730
121361
|
*/
|
|
121731
|
-
function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cancellationToken,
|
|
121362
|
+
function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cancellationToken, computeHash, getCanonicalFileName) {
|
|
121732
121363
|
if (isFileAffectingGlobalScope(sourceFileWithUpdatedShape)) {
|
|
121733
121364
|
return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
|
|
121734
121365
|
}
|
|
@@ -121748,7 +121379,7 @@ var ts;
|
|
|
121748
121379
|
if (!seenFileNamesMap.has(currentPath)) {
|
|
121749
121380
|
var currentSourceFile = programOfThisState.getSourceFileByPath(currentPath);
|
|
121750
121381
|
seenFileNamesMap.set(currentPath, currentSourceFile);
|
|
121751
|
-
if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cancellationToken,
|
|
121382
|
+
if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cancellationToken, computeHash, getCanonicalFileName)) {
|
|
121752
121383
|
queue.push.apply(queue, getReferencedByPaths(state, currentSourceFile.resolvedPath));
|
|
121753
121384
|
}
|
|
121754
121385
|
}
|
|
@@ -121773,9 +121404,9 @@ var ts;
|
|
|
121773
121404
|
/**
|
|
121774
121405
|
* Create the state so that we can iterate on changedFiles/affected files
|
|
121775
121406
|
*/
|
|
121776
|
-
function createBuilderProgramState(newProgram, oldState, disableUseFileVersionAsSignature) {
|
|
121407
|
+
function createBuilderProgramState(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature) {
|
|
121777
121408
|
var _a, _b;
|
|
121778
|
-
var state = ts.BuilderState.create(newProgram, oldState, disableUseFileVersionAsSignature);
|
|
121409
|
+
var state = ts.BuilderState.create(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature);
|
|
121779
121410
|
state.program = newProgram;
|
|
121780
121411
|
var compilerOptions = newProgram.getCompilerOptions();
|
|
121781
121412
|
state.compilerOptions = compilerOptions;
|
|
@@ -121839,7 +121470,7 @@ var ts;
|
|
|
121839
121470
|
// Unchanged file copy diagnostics
|
|
121840
121471
|
var diagnostics = oldState.semanticDiagnosticsPerFile.get(sourceFilePath);
|
|
121841
121472
|
if (diagnostics) {
|
|
121842
|
-
state.semanticDiagnosticsPerFile.set(sourceFilePath, oldState.hasReusableDiagnostic ? convertToDiagnostics(diagnostics, newProgram) : diagnostics);
|
|
121473
|
+
state.semanticDiagnosticsPerFile.set(sourceFilePath, oldState.hasReusableDiagnostic ? convertToDiagnostics(diagnostics, newProgram, getCanonicalFileName) : diagnostics);
|
|
121843
121474
|
if (!state.semanticDiagnosticsFromOldState) {
|
|
121844
121475
|
state.semanticDiagnosticsFromOldState = new ts.Set();
|
|
121845
121476
|
}
|
|
@@ -121864,16 +121495,13 @@ var ts;
|
|
|
121864
121495
|
state.seenAffectedFiles = state.seenAffectedFiles || new ts.Set();
|
|
121865
121496
|
}
|
|
121866
121497
|
// Since old states change files set is copied, any additional change means we would need to emit build info
|
|
121867
|
-
state.buildInfoEmitPending = !useOldState ||
|
|
121868
|
-
state.changedFilesSet.size !== (((_b = oldState.changedFilesSet) === null || _b === void 0 ? void 0 : _b.size) || 0) ||
|
|
121869
|
-
state.fileInfos.size !== oldState.fileInfos.size;
|
|
121498
|
+
state.buildInfoEmitPending = !useOldState || state.changedFilesSet.size !== (((_b = oldState.changedFilesSet) === null || _b === void 0 ? void 0 : _b.size) || 0);
|
|
121870
121499
|
return state;
|
|
121871
121500
|
}
|
|
121872
|
-
function convertToDiagnostics(diagnostics, newProgram) {
|
|
121501
|
+
function convertToDiagnostics(diagnostics, newProgram, getCanonicalFileName) {
|
|
121873
121502
|
if (!diagnostics.length)
|
|
121874
121503
|
return ts.emptyArray;
|
|
121875
|
-
var buildInfoDirectory;
|
|
121876
|
-
var getCanonicalFileName;
|
|
121504
|
+
var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(ts.getTsBuildInfoEmitOutputFilePath(newProgram.getCompilerOptions()), newProgram.getCurrentDirectory()));
|
|
121877
121505
|
return diagnostics.map(function (diagnostic) {
|
|
121878
121506
|
var result = convertToDiagnosticRelatedInformation(diagnostic, newProgram, toPath);
|
|
121879
121507
|
result.reportsUnnecessary = diagnostic.reportsUnnecessary;
|
|
@@ -121889,8 +121517,7 @@ var ts;
|
|
|
121889
121517
|
return result;
|
|
121890
121518
|
});
|
|
121891
121519
|
function toPath(path) {
|
|
121892
|
-
|
|
121893
|
-
return ts.toPath(path, buildInfoDirectory, getCanonicalFileName !== null && getCanonicalFileName !== void 0 ? getCanonicalFileName : (getCanonicalFileName = ts.createGetCanonicalFileName(newProgram.useCaseSensitiveFileNames())));
|
|
121520
|
+
return ts.toPath(path, buildInfoDirectory, getCanonicalFileName);
|
|
121894
121521
|
}
|
|
121895
121522
|
}
|
|
121896
121523
|
function convertToDiagnosticRelatedInformation(diagnostic, newProgram, toPath) {
|
|
@@ -121902,9 +121529,6 @@ var ts;
|
|
|
121902
121529
|
*/
|
|
121903
121530
|
function releaseCache(state) {
|
|
121904
121531
|
ts.BuilderState.releaseCache(state);
|
|
121905
|
-
// Store the resolutions if possible
|
|
121906
|
-
if (!state.resuableCacheResolutions)
|
|
121907
|
-
getCacheResolutions(state);
|
|
121908
121532
|
state.program = undefined;
|
|
121909
121533
|
}
|
|
121910
121534
|
function backupBuilderProgramEmitState(state) {
|
|
@@ -121949,7 +121573,7 @@ var ts;
|
|
|
121949
121573
|
* This is to allow the callers to be able to actually remove affected file only when the operation is complete
|
|
121950
121574
|
* eg. if during diagnostics check cancellation token ends up cancelling the request, the affected file should be retained
|
|
121951
121575
|
*/
|
|
121952
|
-
function getNextAffectedFile(state, cancellationToken, host) {
|
|
121576
|
+
function getNextAffectedFile(state, cancellationToken, computeHash, getCanonicalFileName, host) {
|
|
121953
121577
|
var _a, _b;
|
|
121954
121578
|
while (true) {
|
|
121955
121579
|
var affectedFiles = state.affectedFiles;
|
|
@@ -121961,7 +121585,7 @@ var ts;
|
|
|
121961
121585
|
if (!seenAffectedFiles.has(affectedFile.resolvedPath)) {
|
|
121962
121586
|
// Set the next affected file as seen and remove the cached semantic diagnostics
|
|
121963
121587
|
state.affectedFilesIndex = affectedFilesIndex;
|
|
121964
|
-
handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, host);
|
|
121588
|
+
handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, getCanonicalFileName, host);
|
|
121965
121589
|
return affectedFile;
|
|
121966
121590
|
}
|
|
121967
121591
|
affectedFilesIndex++;
|
|
@@ -121989,7 +121613,7 @@ var ts;
|
|
|
121989
121613
|
return program;
|
|
121990
121614
|
}
|
|
121991
121615
|
// Get next batch of affected files
|
|
121992
|
-
state.affectedFiles = ts.BuilderState.getFilesAffectedByWithOldState(state, program, nextKey.value, cancellationToken,
|
|
121616
|
+
state.affectedFiles = ts.BuilderState.getFilesAffectedByWithOldState(state, program, nextKey.value, cancellationToken, computeHash, getCanonicalFileName);
|
|
121993
121617
|
state.currentChangedFilePath = nextKey.value;
|
|
121994
121618
|
state.affectedFilesIndex = 0;
|
|
121995
121619
|
if (!state.seenAffectedFiles)
|
|
@@ -122040,7 +121664,7 @@ var ts;
|
|
|
122040
121664
|
* Handles semantic diagnostics and dts emit for affectedFile and files, that are referencing modules that export entities from affected file
|
|
122041
121665
|
* This is because even though js emit doesnt change, dts emit / type used can change resulting in need for dts emit and js change
|
|
122042
121666
|
*/
|
|
122043
|
-
function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, host) {
|
|
121667
|
+
function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, getCanonicalFileName, host) {
|
|
122044
121668
|
removeSemanticDiagnosticsOf(state, affectedFile.resolvedPath);
|
|
122045
121669
|
// If affected files is everything except default library, then nothing more to do
|
|
122046
121670
|
if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles) {
|
|
@@ -122048,18 +121672,18 @@ var ts;
|
|
|
122048
121672
|
// When a change affects the global scope, all files are considered to be affected without updating their signature
|
|
122049
121673
|
// That means when affected file is handled, its signature can be out of date
|
|
122050
121674
|
// To avoid this, ensure that we update the signature for any affected file in this scenario.
|
|
122051
|
-
ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, cancellationToken,
|
|
121675
|
+
ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, cancellationToken, computeHash, getCanonicalFileName);
|
|
122052
121676
|
return;
|
|
122053
121677
|
}
|
|
122054
121678
|
if (state.compilerOptions.assumeChangesOnlyAffectDirectDependencies)
|
|
122055
121679
|
return;
|
|
122056
|
-
handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, host);
|
|
121680
|
+
handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, getCanonicalFileName, host);
|
|
122057
121681
|
}
|
|
122058
121682
|
/**
|
|
122059
121683
|
* Handle the dts may change, so they need to be added to pending emit if dts emit is enabled,
|
|
122060
121684
|
* Also we need to make sure signature is updated for these files
|
|
122061
121685
|
*/
|
|
122062
|
-
function handleDtsMayChangeOf(state, path, cancellationToken, host) {
|
|
121686
|
+
function handleDtsMayChangeOf(state, path, cancellationToken, computeHash, getCanonicalFileName, host) {
|
|
122063
121687
|
removeSemanticDiagnosticsOf(state, path);
|
|
122064
121688
|
if (!state.changedFilesSet.has(path)) {
|
|
122065
121689
|
var program = ts.Debug.checkDefined(state.program);
|
|
@@ -122070,7 +121694,7 @@ var ts;
|
|
|
122070
121694
|
// This ensures that we dont later during incremental builds considering wrong signature.
|
|
122071
121695
|
// Eg where this also is needed to ensure that .tsbuildinfo generated by incremental build should be same as if it was first fresh build
|
|
122072
121696
|
// But we avoid expensive full shape computation, as using file version as shape is enough for correctness.
|
|
122073
|
-
ts.BuilderState.updateShapeSignature(state, program, sourceFile, cancellationToken,
|
|
121697
|
+
ts.BuilderState.updateShapeSignature(state, program, sourceFile, cancellationToken, computeHash, getCanonicalFileName, !host.disableUseFileVersionAsSignature);
|
|
122074
121698
|
// If not dts emit, nothing more to do
|
|
122075
121699
|
if (ts.getEmitDeclarations(state.compilerOptions)) {
|
|
122076
121700
|
addToAffectedFilesPendingEmit(state, path, 0 /* DtsOnly */);
|
|
@@ -122095,20 +121719,20 @@ var ts;
|
|
|
122095
121719
|
var newSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
|
|
122096
121720
|
return newSignature !== oldSignature;
|
|
122097
121721
|
}
|
|
122098
|
-
function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, host) {
|
|
121722
|
+
function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, getCanonicalFileName, host) {
|
|
122099
121723
|
var _a;
|
|
122100
121724
|
if (!((_a = state.fileInfos.get(filePath)) === null || _a === void 0 ? void 0 : _a.affectsGlobalScope))
|
|
122101
121725
|
return false;
|
|
122102
121726
|
// Every file needs to be handled
|
|
122103
121727
|
ts.BuilderState.getAllFilesExcludingDefaultLibraryFile(state, state.program, /*firstSourceFile*/ undefined)
|
|
122104
|
-
.forEach(function (file) { return handleDtsMayChangeOf(state, file.resolvedPath, cancellationToken, host); });
|
|
121728
|
+
.forEach(function (file) { return handleDtsMayChangeOf(state, file.resolvedPath, cancellationToken, computeHash, getCanonicalFileName, host); });
|
|
122105
121729
|
removeDiagnosticsOfLibraryFiles(state);
|
|
122106
121730
|
return true;
|
|
122107
121731
|
}
|
|
122108
121732
|
/**
|
|
122109
121733
|
* Iterate on referencing modules that export entities from affected file and delete diagnostics and add pending emit
|
|
122110
121734
|
*/
|
|
122111
|
-
function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, host) {
|
|
121735
|
+
function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, getCanonicalFileName, host) {
|
|
122112
121736
|
var _a;
|
|
122113
121737
|
// If there was change in signature (dts output) for the changed file,
|
|
122114
121738
|
// then only we need to handle pending file emit
|
|
@@ -122126,9 +121750,9 @@ var ts;
|
|
|
122126
121750
|
var currentPath = queue.pop();
|
|
122127
121751
|
if (!seenFileNamesMap.has(currentPath)) {
|
|
122128
121752
|
seenFileNamesMap.set(currentPath, true);
|
|
122129
|
-
if (handleDtsMayChangeOfGlobalScope(state, currentPath, cancellationToken, host))
|
|
121753
|
+
if (handleDtsMayChangeOfGlobalScope(state, currentPath, cancellationToken, computeHash, getCanonicalFileName, host))
|
|
122130
121754
|
return;
|
|
122131
|
-
handleDtsMayChangeOf(state, currentPath, cancellationToken, host);
|
|
121755
|
+
handleDtsMayChangeOf(state, currentPath, cancellationToken, computeHash, getCanonicalFileName, host);
|
|
122132
121756
|
if (isChangedSignature(state, currentPath)) {
|
|
122133
121757
|
var currentSourceFile = ts.Debug.checkDefined(state.program).getSourceFileByPath(currentPath);
|
|
122134
121758
|
queue.push.apply(queue, ts.BuilderState.getReferencedByPaths(state, currentSourceFile.resolvedPath));
|
|
@@ -122140,11 +121764,11 @@ var ts;
|
|
|
122140
121764
|
// Go through exported modules from cache first
|
|
122141
121765
|
// If exported modules has path, all files referencing file exported from are affected
|
|
122142
121766
|
(_a = state.exportedModulesMap.getKeys(affectedFile.resolvedPath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
|
|
122143
|
-
if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, host))
|
|
121767
|
+
if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, computeHash, getCanonicalFileName, host))
|
|
122144
121768
|
return true;
|
|
122145
121769
|
var references = state.referencedMap.getKeys(exportedFromPath);
|
|
122146
121770
|
return references && ts.forEachKey(references, function (filePath) {
|
|
122147
|
-
return handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, host);
|
|
121771
|
+
return handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, getCanonicalFileName, host);
|
|
122148
121772
|
});
|
|
122149
121773
|
});
|
|
122150
121774
|
}
|
|
@@ -122152,22 +121776,22 @@ var ts;
|
|
|
122152
121776
|
* handle dts and semantic diagnostics on file and iterate on anything that exports this file
|
|
122153
121777
|
* return true when all work is done and we can exit handling dts emit and semantic diagnostics
|
|
122154
121778
|
*/
|
|
122155
|
-
function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, host) {
|
|
121779
|
+
function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, getCanonicalFileName, host) {
|
|
122156
121780
|
var _a, _b;
|
|
122157
121781
|
if (!ts.tryAddToSet(seenFileAndExportsOfFile, filePath))
|
|
122158
121782
|
return undefined;
|
|
122159
|
-
if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, host))
|
|
121783
|
+
if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, getCanonicalFileName, host))
|
|
122160
121784
|
return true;
|
|
122161
|
-
handleDtsMayChangeOf(state, filePath, cancellationToken, host);
|
|
121785
|
+
handleDtsMayChangeOf(state, filePath, cancellationToken, computeHash, getCanonicalFileName, host);
|
|
122162
121786
|
// If exported modules has path, all files referencing file exported from are affected
|
|
122163
121787
|
(_a = state.exportedModulesMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
|
|
122164
|
-
return handleDtsMayChangeOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, cancellationToken, host);
|
|
121788
|
+
return handleDtsMayChangeOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, cancellationToken, computeHash, getCanonicalFileName, host);
|
|
122165
121789
|
});
|
|
122166
121790
|
// Remove diagnostics of files that import this file (without going to exports of referencing files)
|
|
122167
121791
|
(_b = state.referencedMap.getKeys(filePath)) === null || _b === void 0 ? void 0 : _b.forEach(function (referencingFilePath) {
|
|
122168
121792
|
return !seenFileAndExportsOfFile.has(referencingFilePath) && // Not already removed diagnostic file
|
|
122169
121793
|
handleDtsMayChangeOf(// Dont add to seen since this is not yet done with the export removal
|
|
122170
|
-
state, referencingFilePath, cancellationToken, host);
|
|
121794
|
+
state, referencingFilePath, cancellationToken, computeHash, getCanonicalFileName, host);
|
|
122171
121795
|
});
|
|
122172
121796
|
return undefined;
|
|
122173
121797
|
}
|
|
@@ -122246,46 +121870,35 @@ var ts;
|
|
|
122246
121870
|
/**
|
|
122247
121871
|
* Gets the program information to be emitted in buildInfo so that we can use it to create new program
|
|
122248
121872
|
*/
|
|
122249
|
-
function getProgramBuildInfo(state,
|
|
121873
|
+
function getProgramBuildInfo(state, getCanonicalFileName) {
|
|
122250
121874
|
var outFilePath = ts.outFile(state.compilerOptions);
|
|
122251
|
-
if (outFilePath && !state.compilerOptions.composite
|
|
121875
|
+
if (outFilePath && !state.compilerOptions.composite)
|
|
122252
121876
|
return;
|
|
122253
121877
|
var currentDirectory = ts.Debug.checkDefined(state.program).getCurrentDirectory();
|
|
122254
|
-
var
|
|
122255
|
-
var buildInfoPath = ts.getNormalizedAbsolutePath(ts.getTsBuildInfoEmitOutputFilePath(state.compilerOptions), currentDirectory);
|
|
122256
|
-
var buildInfoDirectory = ts.getDirectoryPath(buildInfoPath);
|
|
121878
|
+
var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(ts.getTsBuildInfoEmitOutputFilePath(state.compilerOptions), currentDirectory));
|
|
122257
121879
|
// Convert the file name to Path here if we set the fileName instead to optimize multiple d.ts file emits and having to compute Canonical path
|
|
122258
121880
|
var latestChangedDtsFile = state.latestChangedDtsFile ? relativeToBuildInfoEnsuringAbsolutePath(state.latestChangedDtsFile) : undefined;
|
|
122259
|
-
var fileNames = [];
|
|
122260
|
-
var fileNameToFileId = new ts.Map();
|
|
122261
|
-
var resolutions;
|
|
122262
|
-
var names;
|
|
122263
|
-
var resolutionNameToResolutionNameId;
|
|
122264
|
-
var resolutionEntries;
|
|
122265
|
-
var resolutionEntryToResolutionEntryId;
|
|
122266
|
-
var affectedFilesHash;
|
|
122267
121881
|
if (outFilePath) {
|
|
122268
|
-
var
|
|
122269
|
-
|
|
122270
|
-
|
|
122271
|
-
|
|
122272
|
-
|
|
122273
|
-
|
|
122274
|
-
|
|
122275
|
-
|
|
122276
|
-
|
|
122277
|
-
|
|
122278
|
-
|
|
122279
|
-
var result_16 = {
|
|
122280
|
-
fileNames: fileNames,
|
|
121882
|
+
var fileNames_1 = [];
|
|
121883
|
+
var fileInfos_1 = [];
|
|
121884
|
+
state.program.getRootFileNames().forEach(function (f) {
|
|
121885
|
+
var sourceFile = state.program.getSourceFile(f);
|
|
121886
|
+
if (!sourceFile)
|
|
121887
|
+
return;
|
|
121888
|
+
fileNames_1.push(relativeToBuildInfo(sourceFile.resolvedPath));
|
|
121889
|
+
fileInfos_1.push(sourceFile.version);
|
|
121890
|
+
});
|
|
121891
|
+
var result_15 = {
|
|
121892
|
+
fileNames: fileNames_1,
|
|
122281
121893
|
fileInfos: fileInfos_1,
|
|
122282
|
-
options:
|
|
121894
|
+
options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsBundleEmitBuildInfo"),
|
|
122283
121895
|
outSignature: state.outSignature,
|
|
122284
121896
|
latestChangedDtsFile: latestChangedDtsFile,
|
|
122285
|
-
cacheResolutions: cacheResolutions_1,
|
|
122286
121897
|
};
|
|
122287
|
-
return
|
|
121898
|
+
return result_15;
|
|
122288
121899
|
}
|
|
121900
|
+
var fileNames = [];
|
|
121901
|
+
var fileNameToFileId = new ts.Map();
|
|
122289
121902
|
var fileIdsList;
|
|
122290
121903
|
var fileNamesToFileIdListId;
|
|
122291
121904
|
var emitSignatures;
|
|
@@ -122349,7 +121962,7 @@ var ts;
|
|
|
122349
121962
|
(semanticDiagnosticsPerFile || (semanticDiagnosticsPerFile = [])).push(value.length ?
|
|
122350
121963
|
[
|
|
122351
121964
|
toFileId(key),
|
|
122352
|
-
value
|
|
121965
|
+
convertToReusableDiagnostics(value, relativeToBuildInfo)
|
|
122353
121966
|
] :
|
|
122354
121967
|
toFileId(key));
|
|
122355
121968
|
}
|
|
@@ -122371,11 +121984,10 @@ var ts;
|
|
|
122371
121984
|
(changeFileSet || (changeFileSet = [])).push(toFileId(path));
|
|
122372
121985
|
}
|
|
122373
121986
|
}
|
|
122374
|
-
var cacheResolutions = toProgramBuildInfoCacheResolutions();
|
|
122375
121987
|
var result = {
|
|
122376
121988
|
fileNames: fileNames,
|
|
122377
121989
|
fileInfos: fileInfos,
|
|
122378
|
-
options:
|
|
121990
|
+
options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsMultiFileEmitBuildInfo"),
|
|
122379
121991
|
fileIdsList: fileIdsList,
|
|
122380
121992
|
referencedMap: referencedMap,
|
|
122381
121993
|
exportedModulesMap: exportedModulesMap,
|
|
@@ -122384,7 +121996,6 @@ var ts;
|
|
|
122384
121996
|
changeFileSet: changeFileSet,
|
|
122385
121997
|
emitSignatures: emitSignatures,
|
|
122386
121998
|
latestChangedDtsFile: latestChangedDtsFile,
|
|
122387
|
-
cacheResolutions: cacheResolutions,
|
|
122388
121999
|
};
|
|
122389
122000
|
return result;
|
|
122390
122001
|
function relativeToBuildInfoEnsuringAbsolutePath(path) {
|
|
@@ -122393,7 +122004,7 @@ var ts;
|
|
|
122393
122004
|
function relativeToBuildInfo(path) {
|
|
122394
122005
|
return ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(buildInfoDirectory, path, getCanonicalFileName));
|
|
122395
122006
|
}
|
|
122396
|
-
function
|
|
122007
|
+
function toFileId(path) {
|
|
122397
122008
|
var fileId = fileNameToFileId.get(path);
|
|
122398
122009
|
if (fileId === undefined) {
|
|
122399
122010
|
fileNames.push(relativeToBuildInfo(path));
|
|
@@ -122401,12 +122012,6 @@ var ts;
|
|
|
122401
122012
|
}
|
|
122402
122013
|
return fileId;
|
|
122403
122014
|
}
|
|
122404
|
-
function toFileId(path) {
|
|
122405
|
-
return toFileAndAbsoluteFileId(path);
|
|
122406
|
-
}
|
|
122407
|
-
function toAbsoluteFileId(path) {
|
|
122408
|
-
return toFileAndAbsoluteFileId(ts.getNormalizedAbsolutePath(path, currentDirectory));
|
|
122409
|
-
}
|
|
122410
122015
|
function toFileIdListId(set) {
|
|
122411
122016
|
var fileIds = ts.arrayFrom(set.keys(), toFileId).sort(ts.compareValues);
|
|
122412
122017
|
var key = fileIds.join();
|
|
@@ -122419,241 +122024,54 @@ var ts;
|
|
|
122419
122024
|
}
|
|
122420
122025
|
/**
|
|
122421
122026
|
* @param optionKey key of CommandLineOption to use to determine if the option should be serialized in tsbuildinfo
|
|
122422
|
-
* @param affectsModuleResolution serialize options affecting module resolution
|
|
122423
122027
|
*/
|
|
122424
|
-
function
|
|
122028
|
+
function convertToProgramBuildInfoCompilerOptions(options, optionKey) {
|
|
122425
122029
|
var result;
|
|
122426
122030
|
var optionsNameMap = ts.getOptionsNameMap().optionsNameMap;
|
|
122427
122031
|
for (var _i = 0, _a = ts.getOwnKeys(options).sort(ts.compareStringsCaseSensitive); _i < _a.length; _i++) {
|
|
122428
122032
|
var name = _a[_i];
|
|
122429
122033
|
var optionInfo = optionsNameMap.get(name.toLowerCase());
|
|
122430
|
-
if (
|
|
122431
|
-
(result
|
|
122432
|
-
}
|
|
122433
|
-
else if (affectsModuleResolution && name === "pathsBasePath") {
|
|
122434
|
-
(result !== null && result !== void 0 ? result : (result = {})).pathsBasePath = relativeToBuildInfoEnsuringAbsolutePath(options.pathsBasePath);
|
|
122435
|
-
continue;
|
|
122034
|
+
if (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo[optionKey]) {
|
|
122035
|
+
(result || (result = {}))[name] = convertToReusableCompilerOptionValue(optionInfo, options[name], relativeToBuildInfoEnsuringAbsolutePath);
|
|
122436
122036
|
}
|
|
122437
122037
|
}
|
|
122438
122038
|
return result;
|
|
122439
122039
|
}
|
|
122440
|
-
|
|
122441
|
-
|
|
122442
|
-
|
|
122443
|
-
|
|
122444
|
-
|
|
122445
|
-
|
|
122446
|
-
|
|
122447
|
-
}
|
|
122448
|
-
else if (option.isFilePath) {
|
|
122449
|
-
return relativeToBuildInfoEnsuringAbsolutePath(value);
|
|
122040
|
+
}
|
|
122041
|
+
function convertToReusableCompilerOptionValue(option, value, relativeToBuildInfo) {
|
|
122042
|
+
if (option) {
|
|
122043
|
+
if (option.type === "list") {
|
|
122044
|
+
var values = value;
|
|
122045
|
+
if (option.element.isFilePath && values.length) {
|
|
122046
|
+
return values.map(relativeToBuildInfo);
|
|
122450
122047
|
}
|
|
122451
122048
|
}
|
|
122452
|
-
|
|
122453
|
-
|
|
122454
|
-
|
|
122455
|
-
return (array === null || array === void 0 ? void 0 : array.length) ? array.map(map) : undefined;
|
|
122049
|
+
else if (option.isFilePath) {
|
|
122050
|
+
return relativeToBuildInfo(value);
|
|
122051
|
+
}
|
|
122456
122052
|
}
|
|
122457
|
-
|
|
122458
|
-
|
|
122053
|
+
return value;
|
|
122054
|
+
}
|
|
122055
|
+
function convertToReusableDiagnostics(diagnostics, relativeToBuildInfo) {
|
|
122056
|
+
ts.Debug.assert(!!diagnostics.length);
|
|
122057
|
+
return diagnostics.map(function (diagnostic) {
|
|
122058
|
+
var result = convertToReusableDiagnosticRelatedInformation(diagnostic, relativeToBuildInfo);
|
|
122459
122059
|
result.reportsUnnecessary = diagnostic.reportsUnnecessary;
|
|
122460
122060
|
result.reportDeprecated = diagnostic.reportsDeprecated;
|
|
122461
122061
|
result.source = diagnostic.source;
|
|
122462
122062
|
result.skippedOn = diagnostic.skippedOn;
|
|
122463
122063
|
var relatedInformation = diagnostic.relatedInformation;
|
|
122464
|
-
result.relatedInformation = relatedInformation
|
|
122465
|
-
|
|
122466
|
-
|
|
122467
|
-
|
|
122468
|
-
|
|
122469
|
-
return __assign(__assign({}, diagnostic), { file: file ? relativeToBuildInfo(file.resolvedPath) : undefined });
|
|
122470
|
-
}
|
|
122471
|
-
function toProgramBuildInfoCacheResolutions() {
|
|
122472
|
-
var cacheResolutions = getCacheResolutions(state);
|
|
122473
|
-
var modules = toProgramBuildInfoResolutionCacheWithRedirects(cacheResolutions === null || cacheResolutions === void 0 ? void 0 : cacheResolutions.modules);
|
|
122474
|
-
var typeRefs = toProgramBuildInfoResolutionCacheWithRedirects(cacheResolutions === null || cacheResolutions === void 0 ? void 0 : cacheResolutions.typeRefs);
|
|
122475
|
-
if (!resolutions)
|
|
122476
|
-
return;
|
|
122477
|
-
ts.Debug.assertIsDefined(names);
|
|
122478
|
-
ts.Debug.assertIsDefined(resolutionEntries);
|
|
122479
|
-
state.resuableCacheResolutions = {
|
|
122480
|
-
cache: {
|
|
122481
|
-
resolutions: resolutions.map(toProgramBuildInfoResolution),
|
|
122482
|
-
names: names,
|
|
122483
|
-
hash: toProgramBuildInfoHashes(),
|
|
122484
|
-
resolutionEntries: resolutionEntries,
|
|
122485
|
-
modules: modules,
|
|
122486
|
-
typeRefs: typeRefs,
|
|
122487
|
-
},
|
|
122488
|
-
getProgramBuildInfoFilePathDecoder: ts.memoize(function () { return getProgramBuildInfoFilePathDecoder(fileNames, buildInfoPath, currentDirectory, getCanonicalFileName); })
|
|
122489
|
-
};
|
|
122490
|
-
return state.resuableCacheResolutions.cache;
|
|
122491
|
-
}
|
|
122492
|
-
function toProgramBuildInfoResolutionCacheWithRedirects(cache) {
|
|
122493
|
-
if (!cache)
|
|
122494
|
-
return undefined;
|
|
122495
|
-
var ownMap = cache.getOwnMap();
|
|
122496
|
-
var own = toProgramBuildInfoResolutionCache(ownMap);
|
|
122497
|
-
var redirects;
|
|
122498
|
-
cache.redirectsKeyToCache.forEach(function (_a) {
|
|
122499
|
-
var map = _a.map, options = _a.options;
|
|
122500
|
-
if (map === ownMap)
|
|
122501
|
-
return;
|
|
122502
|
-
var redirectCache = toProgramBuildInfoResolutionCache(map);
|
|
122503
|
-
if (redirectCache) {
|
|
122504
|
-
(redirects !== null && redirects !== void 0 ? redirects : (redirects = [])).push({
|
|
122505
|
-
options: toProgramBuildInfoCompilerOptions(options, /*optionKey*/ undefined, /*affectsModuleResolution*/ true),
|
|
122506
|
-
cache: redirectCache
|
|
122507
|
-
});
|
|
122508
|
-
}
|
|
122509
|
-
});
|
|
122510
|
-
return !redirects ? own : { own: own, redirects: redirects };
|
|
122511
|
-
}
|
|
122512
|
-
function toProgramBuildInfoResolutionCache(cache) {
|
|
122513
|
-
var result;
|
|
122514
|
-
cache === null || cache === void 0 ? void 0 : cache.forEach(function (dirCache, dirPath) { return dirCache.size() ?
|
|
122515
|
-
(result !== null && result !== void 0 ? result : (result = [])).push([
|
|
122516
|
-
toFileId(dirPath),
|
|
122517
|
-
ts.arrayFrom(dirCache.entries()).map(toProgramBuildInfoResolutionEntryId)
|
|
122518
|
-
]) :
|
|
122519
|
-
undefined; });
|
|
122064
|
+
result.relatedInformation = relatedInformation ?
|
|
122065
|
+
relatedInformation.length ?
|
|
122066
|
+
relatedInformation.map(function (r) { return convertToReusableDiagnosticRelatedInformation(r, relativeToBuildInfo); }) :
|
|
122067
|
+
[] :
|
|
122068
|
+
undefined;
|
|
122520
122069
|
return result;
|
|
122521
|
-
}
|
|
122522
|
-
function toProgramBuildInfoResolutionEntryId(_a) {
|
|
122523
|
-
var name = _a[0], mode = _a[1], resolution = _a[2];
|
|
122524
|
-
var resolutionNameId = toProgramBuildInfoResolutionNameId(name);
|
|
122525
|
-
var resolutionId = toProgramBuildInfoResolutionId(resolution);
|
|
122526
|
-
var key = resolutionNameId + "," + mode + "," + resolutionId;
|
|
122527
|
-
var resolutionEntryId = resolutionEntryToResolutionEntryId === null || resolutionEntryToResolutionEntryId === void 0 ? void 0 : resolutionEntryToResolutionEntryId.get(key);
|
|
122528
|
-
if (resolutionEntryId === undefined) {
|
|
122529
|
-
(resolutionEntries || (resolutionEntries = [])).push(mode ? [resolutionNameId, resolutionId, mode] : [resolutionNameId, resolutionId]);
|
|
122530
|
-
(resolutionEntryToResolutionEntryId || (resolutionEntryToResolutionEntryId = new ts.Map())).set(key, resolutionEntryId = resolutionEntries.length);
|
|
122531
|
-
}
|
|
122532
|
-
return resolutionEntryId;
|
|
122533
|
-
}
|
|
122534
|
-
function toProgramBuildInfoResolutionNameId(name) {
|
|
122535
|
-
var resolutionNameId = resolutionNameToResolutionNameId === null || resolutionNameToResolutionNameId === void 0 ? void 0 : resolutionNameToResolutionNameId.get(name);
|
|
122536
|
-
if (resolutionNameId === undefined) {
|
|
122537
|
-
(names !== null && names !== void 0 ? names : (names = [])).push(name);
|
|
122538
|
-
(resolutionNameToResolutionNameId !== null && resolutionNameToResolutionNameId !== void 0 ? resolutionNameToResolutionNameId : (resolutionNameToResolutionNameId = new ts.Map())).set(name, resolutionNameId = names.length);
|
|
122539
|
-
}
|
|
122540
|
-
return resolutionNameId;
|
|
122541
|
-
}
|
|
122542
|
-
function toProgramBuildInfoResolutionId(resolution) {
|
|
122543
|
-
if (resolution.serializationIndex === undefined) {
|
|
122544
|
-
(resolutions !== null && resolutions !== void 0 ? resolutions : (resolutions = [])).push(resolution);
|
|
122545
|
-
resolution.serializationIndex = resolutions.length;
|
|
122546
|
-
}
|
|
122547
|
-
return resolution.serializationIndex;
|
|
122548
|
-
}
|
|
122549
|
-
function toProgramBuildInfoResolution(resolution) {
|
|
122550
|
-
resolution.serializationIndex = undefined;
|
|
122551
|
-
return {
|
|
122552
|
-
resolvedModule: toProgramBuildInfoResolved(resolution.resolvedModule),
|
|
122553
|
-
resolvedTypeReferenceDirective: toProgramBuildInfoResolved(resolution.resolvedTypeReferenceDirective),
|
|
122554
|
-
affectingLocations: toReadonlyArrayOrUndefined(resolution.affectingLocations, toAffectedFileId),
|
|
122555
|
-
resolutionDiagnostics: toReadonlyArrayOrUndefined(resolution.resolutionDiagnostics, toProgramBuildInfoResolutionDiagnostic),
|
|
122556
|
-
};
|
|
122557
|
-
}
|
|
122558
|
-
function toProgramBuildInfoHashes() {
|
|
122559
|
-
if (!affectedFilesHash)
|
|
122560
|
-
return undefined;
|
|
122561
|
-
var hashes = [];
|
|
122562
|
-
for (var _i = 0, _a = ts.arrayFrom(affectedFilesHash.keys()).sort(ts.compareValues); _i < _a.length; _i++) {
|
|
122563
|
-
var key = _a[_i];
|
|
122564
|
-
var value = affectedFilesHash.get(key);
|
|
122565
|
-
hashes.push(value ? [key, value] : key);
|
|
122566
|
-
}
|
|
122567
|
-
return hashes;
|
|
122568
|
-
}
|
|
122569
|
-
function toAffectedFileId(file) {
|
|
122570
|
-
var _a;
|
|
122571
|
-
var fileId = toAbsoluteFileId(file);
|
|
122572
|
-
if (!(affectedFilesHash === null || affectedFilesHash === void 0 ? void 0 : affectedFilesHash.has(fileId))) {
|
|
122573
|
-
// Store the file hash
|
|
122574
|
-
var packageJsonInfo = (_a = state.program.getModuleResolutionCache()) === null || _a === void 0 ? void 0 : _a.getPackageJsonInfo(file);
|
|
122575
|
-
var text = typeof packageJsonInfo === "object" ? packageJsonInfo.packageJsonText : undefined;
|
|
122576
|
-
(affectedFilesHash !== null && affectedFilesHash !== void 0 ? affectedFilesHash : (affectedFilesHash = new ts.Map())).set(fileId, text ? computeSignature(text, host) : undefined);
|
|
122577
|
-
}
|
|
122578
|
-
return fileId;
|
|
122579
|
-
}
|
|
122580
|
-
function toProgramBuildInfoResolved(resolved) {
|
|
122581
|
-
return resolved ? __assign(__assign({}, resolved), { resolvedFileName: toAbsoluteFileId(resolved.resolvedFileName), isExternalLibraryImport: resolved.isExternalLibraryImport ? true : undefined, originalPath: resolved.originalPath ? toAbsoluteFileId(resolved.originalPath) : undefined, primary: resolved.primary || undefined, extension: undefined }) : undefined;
|
|
122582
|
-
}
|
|
122583
|
-
function toProgramBuildInfoResolutionDiagnostic(d) {
|
|
122584
|
-
return {
|
|
122585
|
-
isImports: d.isImports || undefined,
|
|
122586
|
-
entry: d.entry || undefined,
|
|
122587
|
-
packagePath: toAbsoluteFileId(d.packagePath),
|
|
122588
|
-
};
|
|
122589
|
-
}
|
|
122590
|
-
}
|
|
122591
|
-
function getCacheResolutions(state) {
|
|
122592
|
-
var _a;
|
|
122593
|
-
if (state.cacheResolutions || !state.compilerOptions.cacheResolutions)
|
|
122594
|
-
return state.cacheResolutions;
|
|
122595
|
-
var modules;
|
|
122596
|
-
var typeRefs;
|
|
122597
|
-
var moduleNameToDirectoryMap = ts.createCacheWithRedirects(state.compilerOptions);
|
|
122598
|
-
var getCanonicalFileName = ts.createGetCanonicalFileName(state.program.useCaseSensitiveFileNames());
|
|
122599
|
-
state.program.getSourceFiles().forEach(function (f) {
|
|
122600
|
-
modules = toPerDirectoryCache(state, getCanonicalFileName, modules, f, f.resolvedModules, moduleNameToDirectoryMap);
|
|
122601
|
-
typeRefs = toPerDirectoryCache(state, getCanonicalFileName, typeRefs, f, f.resolvedTypeReferenceDirectiveNames);
|
|
122602
122070
|
});
|
|
122603
|
-
var automaticTypeDirectiveNames = state.program.getAutomaticTypeDirectiveNames();
|
|
122604
|
-
if (automaticTypeDirectiveNames.length) {
|
|
122605
|
-
var currentDirectory = state.program.getCurrentDirectory();
|
|
122606
|
-
var containingPath = ts.toPath(state.program.getAutomaticTypeDirectiveContainingFile(), currentDirectory, getCanonicalFileName);
|
|
122607
|
-
typeRefs = toPerDirectoryCache(state, getCanonicalFileName, typeRefs, containingPath, state.program.getAutomaticTypeDirectiveResolutions());
|
|
122608
|
-
}
|
|
122609
|
-
return state.cacheResolutions = {
|
|
122610
|
-
modules: modules,
|
|
122611
|
-
typeRefs: typeRefs,
|
|
122612
|
-
moduleNameToDirectoryMap: moduleNameToDirectoryMap,
|
|
122613
|
-
packageJsonCache: (_a = state.program.getModuleResolutionCache()) === null || _a === void 0 ? void 0 : _a.getPackageJsonInfoCache().clone(),
|
|
122614
|
-
};
|
|
122615
122071
|
}
|
|
122616
|
-
function
|
|
122617
|
-
|
|
122618
|
-
|
|
122619
|
-
var dirPath, redirectedReference;
|
|
122620
|
-
if (!ts.isString(fOrPath)) {
|
|
122621
|
-
redirectedReference = state.program.getRedirectReferenceForResolution(fOrPath);
|
|
122622
|
-
dirPath = ts.getDirectoryPath(fOrPath.path);
|
|
122623
|
-
}
|
|
122624
|
-
else {
|
|
122625
|
-
dirPath = ts.getDirectoryPath(fOrPath);
|
|
122626
|
-
}
|
|
122627
|
-
var perDirResolutionCache = cacheWithRedirects === null || cacheWithRedirects === void 0 ? void 0 : cacheWithRedirects.getMapOfCacheRedirects(redirectedReference);
|
|
122628
|
-
var dirCache = perDirResolutionCache === null || perDirResolutionCache === void 0 ? void 0 : perDirResolutionCache.get(dirPath);
|
|
122629
|
-
cache.forEach(function (resolution, name, mode) {
|
|
122630
|
-
var _a, _b, _c, _d;
|
|
122631
|
-
if (!((_a = resolution.resolvedModule) === null || _a === void 0 ? void 0 : _a.resolvedFileName) && !((_b = resolution.resolvedTypeReferenceDirective) === null || _b === void 0 ? void 0 : _b.resolvedFileName))
|
|
122632
|
-
return;
|
|
122633
|
-
if (dirCache === null || dirCache === void 0 ? void 0 : dirCache.has(name, mode))
|
|
122634
|
-
return;
|
|
122635
|
-
// If there was already external module resolution that is same, set for child directory, dont set resolution for this directory
|
|
122636
|
-
if (moduleNameToDirectoryMap &&
|
|
122637
|
-
!ts.isExternalModuleNameRelative(name) &&
|
|
122638
|
-
((_d = (_c = moduleNameToDirectoryMap.getMapOfCacheRedirects(redirectedReference)) === null || _c === void 0 ? void 0 : _c.get(ts.getModeAwareCacheKey(name, mode))) === null || _d === void 0 ? void 0 : _d.get(dirPath))) {
|
|
122639
|
-
return;
|
|
122640
|
-
}
|
|
122641
|
-
if (!dirCache) {
|
|
122642
|
-
perDirResolutionCache !== null && perDirResolutionCache !== void 0 ? perDirResolutionCache : (perDirResolutionCache = (cacheWithRedirects !== null && cacheWithRedirects !== void 0 ? cacheWithRedirects : (cacheWithRedirects = ts.createCacheWithRedirects(state.compilerOptions))).getOrCreateMapOfCacheRedirects(redirectedReference));
|
|
122643
|
-
perDirResolutionCache.set(dirPath, dirCache = ts.createModeAwareCache());
|
|
122644
|
-
}
|
|
122645
|
-
dirCache.set(name, mode, resolution);
|
|
122646
|
-
if (!moduleNameToDirectoryMap || ts.isExternalModuleNameRelative(name))
|
|
122647
|
-
return;
|
|
122648
|
-
// put result in per-module name cache and delete everything that is not needed
|
|
122649
|
-
var actualModuleNameToDirectoryMap = moduleNameToDirectoryMap.getOrCreateMapOfCacheRedirects(redirectedReference);
|
|
122650
|
-
var key = ts.getModeAwareCacheKey(name, mode);
|
|
122651
|
-
var directoryPathMap = actualModuleNameToDirectoryMap.get(key);
|
|
122652
|
-
if (!directoryPathMap)
|
|
122653
|
-
actualModuleNameToDirectoryMap.set(key, directoryPathMap = new ts.Map());
|
|
122654
|
-
ts.moduleNameToDirectorySet(directoryPathMap, dirPath, resolution, ts.getResolvedFileNameForModuleNameToDirectorySet, function (dir) { return ts.toPath(dir, state.program.getCurrentDirectory(), getCanonicalFileName); }, function (ancestorPath) { var _a; return (_a = perDirResolutionCache === null || perDirResolutionCache === void 0 ? void 0 : perDirResolutionCache.get(ancestorPath)) === null || _a === void 0 ? void 0 : _a.delete(name, mode); });
|
|
122655
|
-
});
|
|
122656
|
-
return cacheWithRedirects;
|
|
122072
|
+
function convertToReusableDiagnosticRelatedInformation(diagnostic, relativeToBuildInfo) {
|
|
122073
|
+
var file = diagnostic.file;
|
|
122074
|
+
return __assign(__assign({}, diagnostic), { file: file ? relativeToBuildInfo(file.resolvedPath) : undefined });
|
|
122657
122075
|
}
|
|
122658
122076
|
var BuilderProgramKind;
|
|
122659
122077
|
(function (BuilderProgramKind) {
|
|
@@ -122677,7 +122095,7 @@ var ts;
|
|
|
122677
122095
|
rootNames: newProgramOrRootNames,
|
|
122678
122096
|
options: hostOrOptions,
|
|
122679
122097
|
host: oldProgramOrHost,
|
|
122680
|
-
oldProgram: oldProgram
|
|
122098
|
+
oldProgram: oldProgram && oldProgram.getProgramOrUndefined(),
|
|
122681
122099
|
configFileParsingDiagnostics: configFileParsingDiagnostics,
|
|
122682
122100
|
projectReferences: projectReferences
|
|
122683
122101
|
});
|
|
@@ -122695,8 +122113,8 @@ var ts;
|
|
|
122695
122113
|
function getTextHandlingSourceMapForSignature(text, data) {
|
|
122696
122114
|
return (data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text;
|
|
122697
122115
|
}
|
|
122698
|
-
function computeSignatureWithDiagnostics(sourceFile, text,
|
|
122699
|
-
var _a
|
|
122116
|
+
function computeSignatureWithDiagnostics(sourceFile, text, computeHash, getCanonicalFileName, data) {
|
|
122117
|
+
var _a;
|
|
122700
122118
|
text = getTextHandlingSourceMapForSignature(text, data);
|
|
122701
122119
|
var sourceFileDirectory;
|
|
122702
122120
|
if ((_a = data === null || data === void 0 ? void 0 : data.diagnostics) === null || _a === void 0 ? void 0 : _a.length) {
|
|
@@ -122704,7 +122122,7 @@ var ts;
|
|
|
122704
122122
|
return "" + locationInfo(diagnostic) + ts.DiagnosticCategory[diagnostic.category] + diagnostic.code + ": " + flattenDiagnosticMessageText(diagnostic.messageText);
|
|
122705
122123
|
}).join("\n");
|
|
122706
122124
|
}
|
|
122707
|
-
return (
|
|
122125
|
+
return (computeHash !== null && computeHash !== void 0 ? computeHash : ts.generateDjb2Hash)(text);
|
|
122708
122126
|
function flattenDiagnosticMessageText(diagnostic) {
|
|
122709
122127
|
return ts.isString(diagnostic) ?
|
|
122710
122128
|
diagnostic :
|
|
@@ -122723,9 +122141,8 @@ var ts;
|
|
|
122723
122141
|
}
|
|
122724
122142
|
}
|
|
122725
122143
|
ts.computeSignatureWithDiagnostics = computeSignatureWithDiagnostics;
|
|
122726
|
-
function computeSignature(text,
|
|
122727
|
-
|
|
122728
|
-
return ((_a = host.createHash) !== null && _a !== void 0 ? _a : ts.generateDjb2Hash)(getTextHandlingSourceMapForSignature(text, data));
|
|
122144
|
+
function computeSignature(text, computeHash, data) {
|
|
122145
|
+
return (computeHash !== null && computeHash !== void 0 ? computeHash : ts.generateDjb2Hash)(getTextHandlingSourceMapForSignature(text, data));
|
|
122729
122146
|
}
|
|
122730
122147
|
ts.computeSignature = computeSignature;
|
|
122731
122148
|
function createBuilderProgram(kind, _a) {
|
|
@@ -122737,8 +122154,16 @@ var ts;
|
|
|
122737
122154
|
oldState = undefined;
|
|
122738
122155
|
return oldProgram;
|
|
122739
122156
|
}
|
|
122740
|
-
|
|
122741
|
-
|
|
122157
|
+
/**
|
|
122158
|
+
* Create the canonical file name for identity
|
|
122159
|
+
*/
|
|
122160
|
+
var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
|
|
122161
|
+
/**
|
|
122162
|
+
* Computing hash to for signature verification
|
|
122163
|
+
*/
|
|
122164
|
+
var computeHash = ts.maybeBind(host, host.createHash);
|
|
122165
|
+
var state = createBuilderProgramState(newProgram, getCanonicalFileName, oldState, host.disableUseFileVersionAsSignature);
|
|
122166
|
+
newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName); };
|
|
122742
122167
|
// To ensure that we arent storing any references to old program or new program without state
|
|
122743
122168
|
newProgram = undefined; // TODO: GH#18217
|
|
122744
122169
|
oldProgram = undefined;
|
|
@@ -122753,7 +122178,6 @@ var ts;
|
|
|
122753
122178
|
builderProgram.getSemanticDiagnostics = getSemanticDiagnostics;
|
|
122754
122179
|
builderProgram.emit = emit;
|
|
122755
122180
|
builderProgram.releaseProgram = function () { return releaseCache(state); };
|
|
122756
|
-
builderProgram.getProgramOrOldBuildInfoProgramUndefined = createGetProgramOrOldBuildInfoProgramUndefined(state);
|
|
122757
122181
|
if (kind === BuilderProgramKind.SemanticDiagnosticsBuilderProgram) {
|
|
122758
122182
|
builderProgram.getSemanticDiagnosticsOfNextAffectedFile = getSemanticDiagnosticsOfNextAffectedFile;
|
|
122759
122183
|
}
|
|
@@ -122780,7 +122204,7 @@ var ts;
|
|
|
122780
122204
|
* in that order would be used to write the files
|
|
122781
122205
|
*/
|
|
122782
122206
|
function emitNextAffectedFile(writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) {
|
|
122783
|
-
var affected = getNextAffectedFile(state, cancellationToken, host);
|
|
122207
|
+
var affected = getNextAffectedFile(state, cancellationToken, computeHash, getCanonicalFileName, host);
|
|
122784
122208
|
var emitKind = 1 /* Full */;
|
|
122785
122209
|
var isPendingEmitFile = false;
|
|
122786
122210
|
if (!affected) {
|
|
@@ -122826,7 +122250,7 @@ var ts;
|
|
|
122826
122250
|
var file = sourceFiles[0];
|
|
122827
122251
|
var info = state.fileInfos.get(file.resolvedPath);
|
|
122828
122252
|
if (info.signature === file.version) {
|
|
122829
|
-
var signature = computeSignatureWithDiagnostics(file, text,
|
|
122253
|
+
var signature = computeSignatureWithDiagnostics(file, text, computeHash, getCanonicalFileName, data);
|
|
122830
122254
|
// With d.ts diagnostics they are also part of the signature so emitSignature will be different from it since its just hash of d.ts
|
|
122831
122255
|
if (!((_a = data === null || data === void 0 ? void 0 : data.diagnostics) === null || _a === void 0 ? void 0 : _a.length))
|
|
122832
122256
|
emitSignature = signature;
|
|
@@ -122856,7 +122280,7 @@ var ts;
|
|
|
122856
122280
|
if (state.compilerOptions.composite) {
|
|
122857
122281
|
var filePath = sourceFiles[0].resolvedPath;
|
|
122858
122282
|
var oldSignature = (_f = state.emitSignatures) === null || _f === void 0 ? void 0 : _f.get(filePath);
|
|
122859
|
-
emitSignature !== null && emitSignature !== void 0 ? emitSignature : (emitSignature = computeSignature(text,
|
|
122283
|
+
emitSignature !== null && emitSignature !== void 0 ? emitSignature : (emitSignature = computeSignature(text, computeHash, data));
|
|
122860
122284
|
// Dont write dts files if they didn't change
|
|
122861
122285
|
if (emitSignature === oldSignature)
|
|
122862
122286
|
return;
|
|
@@ -122866,7 +122290,7 @@ var ts;
|
|
|
122866
122290
|
}
|
|
122867
122291
|
}
|
|
122868
122292
|
else if (state.compilerOptions.composite) {
|
|
122869
|
-
var newSignature = computeSignature(text,
|
|
122293
|
+
var newSignature = computeSignature(text, computeHash, data);
|
|
122870
122294
|
// Dont write dts files if they didn't change
|
|
122871
122295
|
if (newSignature === state.outSignature)
|
|
122872
122296
|
return;
|
|
@@ -122948,7 +122372,7 @@ var ts;
|
|
|
122948
122372
|
*/
|
|
122949
122373
|
function getSemanticDiagnosticsOfNextAffectedFile(cancellationToken, ignoreSourceFile) {
|
|
122950
122374
|
while (true) {
|
|
122951
|
-
var affected = getNextAffectedFile(state, cancellationToken, host);
|
|
122375
|
+
var affected = getNextAffectedFile(state, cancellationToken, computeHash, getCanonicalFileName, host);
|
|
122952
122376
|
if (!affected) {
|
|
122953
122377
|
// Done
|
|
122954
122378
|
return undefined;
|
|
@@ -123028,32 +122452,12 @@ var ts;
|
|
|
123028
122452
|
{ version: fileInfo.version, signature: fileInfo.signature === false ? undefined : fileInfo.version, affectsGlobalScope: fileInfo.affectsGlobalScope, impliedFormat: fileInfo.impliedFormat };
|
|
123029
122453
|
}
|
|
123030
122454
|
ts.toBuilderStateFileInfo = toBuilderStateFileInfo;
|
|
123031
|
-
function
|
|
123032
|
-
var
|
|
123033
|
-
var
|
|
123034
|
-
var
|
|
123035
|
-
return { toAbsolutePath: toAbsolutePath, toFilePath: toFilePath, toFileAbsolutePath: toFileAbsolutePath, currentDirectory: currentDirectory, getCanonicalFileName: getCanonicalFileName };
|
|
123036
|
-
function toPath(path) {
|
|
123037
|
-
return ts.toPath(path, buildInfoDirectory, getCanonicalFileName);
|
|
123038
|
-
}
|
|
123039
|
-
function toAbsolutePath(path) {
|
|
123040
|
-
return ts.getNormalizedAbsolutePath(path, buildInfoDirectory);
|
|
123041
|
-
}
|
|
123042
|
-
function toFilePath(fileId) {
|
|
123043
|
-
var _a;
|
|
123044
|
-
return (_a = filePaths === null || filePaths === void 0 ? void 0 : filePaths[fileId - 1]) !== null && _a !== void 0 ? _a : ((filePaths !== null && filePaths !== void 0 ? filePaths : (filePaths = new Array(fileNames.length)))[fileId - 1] = toPath(fileNames[fileId - 1]));
|
|
123045
|
-
}
|
|
123046
|
-
function toFileAbsolutePath(fileId) {
|
|
123047
|
-
var _a;
|
|
123048
|
-
return (_a = fileAbsolutePaths === null || fileAbsolutePaths === void 0 ? void 0 : fileAbsolutePaths[fileId - 1]) !== null && _a !== void 0 ? _a : ((fileAbsolutePaths !== null && fileAbsolutePaths !== void 0 ? fileAbsolutePaths : (fileAbsolutePaths = new Array(fileNames.length)))[fileId - 1] = toAbsolutePath(fileNames[fileId - 1]));
|
|
123049
|
-
}
|
|
123050
|
-
}
|
|
123051
|
-
ts.getProgramBuildInfoFilePathDecoder = getProgramBuildInfoFilePathDecoder;
|
|
123052
|
-
function createBuilderProgramUsingProgramBuildInfo(program, buildInfoPath, host, configFilePath) {
|
|
123053
|
-
var _a, _b, _c;
|
|
123054
|
-
var buildInfoFilePathDecoder = getProgramBuildInfoFilePathDecoder(program.fileNames, buildInfoPath, host.getCurrentDirectory(), ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames()));
|
|
123055
|
-
var toFilePath = buildInfoFilePathDecoder.toFilePath, toAbsolutePath = buildInfoFilePathDecoder.toAbsolutePath;
|
|
122455
|
+
function createBuilderProgramUsingProgramBuildInfo(program, buildInfoPath, host) {
|
|
122456
|
+
var _a, _b, _c, _d;
|
|
122457
|
+
var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
|
|
122458
|
+
var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
|
|
123056
122459
|
var state;
|
|
122460
|
+
var filePaths;
|
|
123057
122461
|
var filePathsSetList;
|
|
123058
122462
|
var latestChangedDtsFile = program.latestChangedDtsFile ? toAbsolutePath(program.latestChangedDtsFile) : undefined;
|
|
123059
122463
|
if (isProgramBundleEmitBuildInfo(program)) {
|
|
@@ -123062,13 +122466,13 @@ var ts;
|
|
|
123062
122466
|
compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
|
|
123063
122467
|
latestChangedDtsFile: latestChangedDtsFile,
|
|
123064
122468
|
outSignature: program.outSignature,
|
|
123065
|
-
resuableCacheResolutions: toResuableCacheResolutions(),
|
|
123066
122469
|
};
|
|
123067
122470
|
}
|
|
123068
122471
|
else {
|
|
123069
|
-
|
|
122472
|
+
filePaths = (_a = program.fileNames) === null || _a === void 0 ? void 0 : _a.map(toPath);
|
|
122473
|
+
filePathsSetList = (_b = program.fileIdsList) === null || _b === void 0 ? void 0 : _b.map(function (fileIds) { return new ts.Set(fileIds.map(toFilePath)); });
|
|
123070
122474
|
var fileInfos_2 = new ts.Map();
|
|
123071
|
-
var emitSignatures_1 = ((
|
|
122475
|
+
var emitSignatures_1 = ((_c = program.options) === null || _c === void 0 ? void 0 : _c.composite) && !ts.outFile(program.options) ? new ts.Map() : undefined;
|
|
123072
122476
|
program.fileInfos.forEach(function (fileInfo, index) {
|
|
123073
122477
|
var path = toFilePath(index + 1);
|
|
123074
122478
|
var stateFileInfo = toBuilderStateFileInfo(fileInfo);
|
|
@@ -123076,7 +122480,7 @@ var ts;
|
|
|
123076
122480
|
if (emitSignatures_1 && stateFileInfo.signature)
|
|
123077
122481
|
emitSignatures_1.set(path, stateFileInfo.signature);
|
|
123078
122482
|
});
|
|
123079
|
-
(
|
|
122483
|
+
(_d = program.emitSignatures) === null || _d === void 0 ? void 0 : _d.forEach(function (value) {
|
|
123080
122484
|
if (ts.isNumber(value))
|
|
123081
122485
|
emitSignatures_1.delete(toFilePath(value));
|
|
123082
122486
|
else
|
|
@@ -123095,17 +122499,14 @@ var ts;
|
|
|
123095
122499
|
changedFilesSet: new ts.Set(ts.map(program.changeFileSet, toFilePath)),
|
|
123096
122500
|
latestChangedDtsFile: latestChangedDtsFile,
|
|
123097
122501
|
emitSignatures: (emitSignatures_1 === null || emitSignatures_1 === void 0 ? void 0 : emitSignatures_1.size) ? emitSignatures_1 : undefined,
|
|
123098
|
-
resuableCacheResolutions: toResuableCacheResolutions(),
|
|
123099
122502
|
};
|
|
123100
122503
|
}
|
|
123101
|
-
state.compilerOptions.configFilePath = configFilePath;
|
|
123102
122504
|
return {
|
|
123103
122505
|
getState: function () { return state; },
|
|
123104
122506
|
saveEmitState: ts.noop,
|
|
123105
122507
|
restoreEmitState: ts.noop,
|
|
123106
122508
|
getProgram: ts.notImplemented,
|
|
123107
122509
|
getProgramOrUndefined: ts.returnUndefined,
|
|
123108
|
-
getProgramOrOldBuildInfoProgramUndefined: createGetProgramOrOldBuildInfoProgramUndefined(state),
|
|
123109
122510
|
releaseProgram: ts.noop,
|
|
123110
122511
|
getCompilerOptions: function () { return state.compilerOptions; },
|
|
123111
122512
|
getSourceFile: ts.notImplemented,
|
|
@@ -123125,6 +122526,15 @@ var ts;
|
|
|
123125
122526
|
close: ts.noop,
|
|
123126
122527
|
hasChangedEmitSignature: ts.returnFalse,
|
|
123127
122528
|
};
|
|
122529
|
+
function toPath(path) {
|
|
122530
|
+
return ts.toPath(path, buildInfoDirectory, getCanonicalFileName);
|
|
122531
|
+
}
|
|
122532
|
+
function toAbsolutePath(path) {
|
|
122533
|
+
return ts.getNormalizedAbsolutePath(path, buildInfoDirectory);
|
|
122534
|
+
}
|
|
122535
|
+
function toFilePath(fileId) {
|
|
122536
|
+
return filePaths[fileId - 1];
|
|
122537
|
+
}
|
|
123128
122538
|
function toFilePathsSet(fileIdsListId) {
|
|
123129
122539
|
return filePathsSetList[fileIdsListId - 1];
|
|
123130
122540
|
}
|
|
@@ -123139,194 +122549,8 @@ var ts;
|
|
|
123139
122549
|
});
|
|
123140
122550
|
return map;
|
|
123141
122551
|
}
|
|
123142
|
-
function toResuableCacheResolutions() {
|
|
123143
|
-
return program.cacheResolutions && {
|
|
123144
|
-
cache: program.cacheResolutions,
|
|
123145
|
-
getProgramBuildInfoFilePathDecoder: function () { return buildInfoFilePathDecoder; },
|
|
123146
|
-
};
|
|
123147
|
-
}
|
|
123148
122552
|
}
|
|
123149
122553
|
ts.createBuilderProgramUsingProgramBuildInfo = createBuilderProgramUsingProgramBuildInfo;
|
|
123150
|
-
function createGetProgramOrOldBuildInfoProgramUndefined(state) {
|
|
123151
|
-
return function () {
|
|
123152
|
-
var _a;
|
|
123153
|
-
return (_a = state.program) !== null && _a !== void 0 ? _a : (state.cacheResolutions || state.resuableCacheResolutions ?
|
|
123154
|
-
(function (host) { return createOldBuildInfoProgram(host, state.compilerOptions, state.cacheResolutions,
|
|
123155
|
-
// Prefer cached resolutions over serialized format
|
|
123156
|
-
!state.cacheResolutions ? state.resuableCacheResolutions : undefined); }) :
|
|
123157
|
-
undefined);
|
|
123158
|
-
};
|
|
123159
|
-
}
|
|
123160
|
-
function createOldBuildInfoProgram(host, compilerOptions, cacheResolutions, resuableCacheResolutions) {
|
|
123161
|
-
if (!cacheResolutions && !resuableCacheResolutions)
|
|
123162
|
-
return undefined;
|
|
123163
|
-
var fileExistsMap = new ts.Map();
|
|
123164
|
-
var affectingLoationsSameMap = new ts.Map();
|
|
123165
|
-
var decodedResolvedModules = ts.createCacheWithRedirects(compilerOptions);
|
|
123166
|
-
var decodedResolvedTypeRefs = ts.createCacheWithRedirects(compilerOptions);
|
|
123167
|
-
var decodedModuleNameToDirectoryMap = ts.createCacheWithRedirects(compilerOptions);
|
|
123168
|
-
var decodedHashes;
|
|
123169
|
-
var resolutions;
|
|
123170
|
-
var originalPathOrResolvedFileNames;
|
|
123171
|
-
var resolutionEntries;
|
|
123172
|
-
return {
|
|
123173
|
-
getCompilerOptions: function () { return compilerOptions; },
|
|
123174
|
-
getResolvedModule: function (dirPath, name, mode, redirectedReference) { return getResolvedFromCache(cacheResolutions === null || cacheResolutions === void 0 ? void 0 : cacheResolutions.modules, resuableCacheResolutions === null || resuableCacheResolutions === void 0 ? void 0 : resuableCacheResolutions.cache.modules, decodedResolvedModules, dirPath, name, mode, redirectedReference, cacheResolutions === null || cacheResolutions === void 0 ? void 0 : cacheResolutions.moduleNameToDirectoryMap, decodedModuleNameToDirectoryMap); },
|
|
123175
|
-
getResolvedTypeReferenceDirective: function (dirPath, name, mode, redirectedReference) { return getResolvedFromCache(cacheResolutions === null || cacheResolutions === void 0 ? void 0 : cacheResolutions.typeRefs, resuableCacheResolutions === null || resuableCacheResolutions === void 0 ? void 0 : resuableCacheResolutions.cache.typeRefs, decodedResolvedTypeRefs, dirPath, name, mode, redirectedReference,
|
|
123176
|
-
/*moduleNameToDirectoryMap*/ undefined,
|
|
123177
|
-
/*decodedModuleNameToDirectoryMap*/ undefined); },
|
|
123178
|
-
};
|
|
123179
|
-
function fileExists(fileName) {
|
|
123180
|
-
var result = fileExistsMap.get(fileName);
|
|
123181
|
-
if (result === undefined)
|
|
123182
|
-
fileExistsMap.set(fileName, result = host.fileExists(fileName));
|
|
123183
|
-
return result;
|
|
123184
|
-
}
|
|
123185
|
-
function affectingLocationsSame(fileName, expected) {
|
|
123186
|
-
var _a;
|
|
123187
|
-
var result = affectingLoationsSameMap.get(fileName);
|
|
123188
|
-
if (result !== undefined)
|
|
123189
|
-
return result;
|
|
123190
|
-
var packageJsonInfo = host.getPackageJsonInfo(fileName);
|
|
123191
|
-
var currentText = typeof packageJsonInfo === "object" ? packageJsonInfo.packageJsonText : undefined;
|
|
123192
|
-
if (ts.isString(expected)) {
|
|
123193
|
-
result = !!currentText && ((_a = host.createHash) !== null && _a !== void 0 ? _a : ts.generateDjb2Hash)(currentText) === expected;
|
|
123194
|
-
}
|
|
123195
|
-
else {
|
|
123196
|
-
var expectedText = typeof expected === "object" ? expected.packageJsonText : undefined;
|
|
123197
|
-
result = currentText === expectedText;
|
|
123198
|
-
}
|
|
123199
|
-
affectingLoationsSameMap.set(fileName, result);
|
|
123200
|
-
return result;
|
|
123201
|
-
}
|
|
123202
|
-
function getResolvedFromCache(cache, reusableCache, decodedReusableCache, dirPath, name, mode, redirectedReference, moduleNameToDirectoryMap, decodedModuleNameToDirectoryMap) {
|
|
123203
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
123204
|
-
// If we are using the cache, directly get from there
|
|
123205
|
-
var fromCache = ((_b = (_a = cache === null || cache === void 0 ? void 0 : cache.getMapOfCacheRedirects(redirectedReference)) === null || _a === void 0 ? void 0 : _a.get(dirPath)) === null || _b === void 0 ? void 0 : _b.get(name, mode)) ||
|
|
123206
|
-
((_d = (_c = moduleNameToDirectoryMap === null || moduleNameToDirectoryMap === void 0 ? void 0 : moduleNameToDirectoryMap.getMapOfCacheRedirects(redirectedReference)) === null || _c === void 0 ? void 0 : _c.get(ts.getModeAwareCacheKey(name, mode))) === null || _d === void 0 ? void 0 : _d.get(dirPath));
|
|
123207
|
-
if (fromCache) {
|
|
123208
|
-
return fileExists(((_e = fromCache.resolvedModule) === null || _e === void 0 ? void 0 : _e.resolvedFileName) ||
|
|
123209
|
-
fromCache.resolvedTypeReferenceDirective.resolvedFileName) && ts.every(fromCache.affectingLocations, function (fileName) { var _a; return affectingLocationsSame(fileName, (_a = cacheResolutions.packageJsonCache) === null || _a === void 0 ? void 0 : _a.getPackageJsonInfo(fileName)); }) ? fromCache : undefined;
|
|
123210
|
-
}
|
|
123211
|
-
if (!reusableCache)
|
|
123212
|
-
return undefined;
|
|
123213
|
-
// Decode so we have maps for directories
|
|
123214
|
-
if (!decodedReusableCache.getOwnMap().size && !decodedReusableCache.redirectsKeyToCache.size) {
|
|
123215
|
-
if (ts.isArray(reusableCache)) {
|
|
123216
|
-
setBuildInfoResolutionEntries(decodedReusableCache, compilerOptions, /*optionsKey*/ undefined, reusableCache, decodedModuleNameToDirectoryMap);
|
|
123217
|
-
}
|
|
123218
|
-
else {
|
|
123219
|
-
if (reusableCache.own)
|
|
123220
|
-
setBuildInfoResolutionEntries(decodedReusableCache, compilerOptions, /*optionsKey*/ undefined, reusableCache.own, decodedModuleNameToDirectoryMap);
|
|
123221
|
-
reusableCache.redirects.forEach(function (_a) {
|
|
123222
|
-
var options = _a.options, cache = _a.cache;
|
|
123223
|
-
var compilerOptions = options ? ts.convertToOptionsWithAbsolutePaths(options, resuableCacheResolutions.getProgramBuildInfoFilePathDecoder().toAbsolutePath) : {};
|
|
123224
|
-
setBuildInfoResolutionEntries(decodedReusableCache, compilerOptions, ts.getRedirectsCacheKey(compilerOptions), cache, decodedModuleNameToDirectoryMap);
|
|
123225
|
-
});
|
|
123226
|
-
}
|
|
123227
|
-
// Ensure redirected reference verifies options before using redirects map
|
|
123228
|
-
decodedReusableCache.clearRedirectsMap();
|
|
123229
|
-
decodedModuleNameToDirectoryMap === null || decodedModuleNameToDirectoryMap === void 0 ? void 0 : decodedModuleNameToDirectoryMap.clearRedirectsMap();
|
|
123230
|
-
}
|
|
123231
|
-
var resolutionId = ((_g = (_f = decodedReusableCache.getMapOfCacheRedirects(redirectedReference)) === null || _f === void 0 ? void 0 : _f.get(dirPath)) === null || _g === void 0 ? void 0 : _g.get(name, mode)) ||
|
|
123232
|
-
((_j = (_h = decodedModuleNameToDirectoryMap === null || decodedModuleNameToDirectoryMap === void 0 ? void 0 : decodedModuleNameToDirectoryMap.getMapOfCacheRedirects(redirectedReference)) === null || _h === void 0 ? void 0 : _h.get(ts.getModeAwareCacheKey(name, mode))) === null || _j === void 0 ? void 0 : _j.get(dirPath));
|
|
123233
|
-
return resolutionId ? toResolution(resolutionId) : undefined;
|
|
123234
|
-
}
|
|
123235
|
-
function setBuildInfoResolutionEntries(decodedReusableCache, options, optionsKey, reusableCache, decodedModuleNameToDirectoryMap) {
|
|
123236
|
-
var map = decodedReusableCache.createMapForCompilerOptions(options, optionsKey);
|
|
123237
|
-
reusableCache.forEach(function (_a) {
|
|
123238
|
-
var dirId = _a[0], entryId = _a[1];
|
|
123239
|
-
var dirPath = resuableCacheResolutions.getProgramBuildInfoFilePathDecoder().toFilePath(dirId);
|
|
123240
|
-
map.set(dirPath, toModeAwareCache(entryId, dirPath, options, optionsKey, decodedModuleNameToDirectoryMap));
|
|
123241
|
-
});
|
|
123242
|
-
}
|
|
123243
|
-
function toModeAwareCache(entries, dirPath, options, optionsKey, decodedModuleNameToDirectoryMap) {
|
|
123244
|
-
var modeAwareCache = ts.createModeAwareCache();
|
|
123245
|
-
entries.forEach(function (entryId) {
|
|
123246
|
-
var _a = toResolutionEntry(entryId), name = _a[0], resolutionId = _a[1], mode = _a[2];
|
|
123247
|
-
modeAwareCache.set(name, mode, resolutionId);
|
|
123248
|
-
if (!decodedModuleNameToDirectoryMap || ts.isExternalModuleNameRelative(name))
|
|
123249
|
-
return;
|
|
123250
|
-
var mapForOptions = decodedModuleNameToDirectoryMap.createMapForCompilerOptions(options, optionsKey);
|
|
123251
|
-
var key = ts.getModeAwareCacheKey(name, mode);
|
|
123252
|
-
var moduleNameMap = mapForOptions.get(key);
|
|
123253
|
-
;
|
|
123254
|
-
if (!moduleNameMap)
|
|
123255
|
-
mapForOptions.set(key, moduleNameMap = new ts.Map());
|
|
123256
|
-
ts.moduleNameToDirectorySet(moduleNameMap, dirPath, resolutionId, toOriginalPathOrResolvedFileName, function (fileName) { return ts.toPath(fileName, resuableCacheResolutions.getProgramBuildInfoFilePathDecoder().currentDirectory, resuableCacheResolutions.getProgramBuildInfoFilePathDecoder().getCanonicalFileName); }, ts.noop);
|
|
123257
|
-
});
|
|
123258
|
-
return modeAwareCache;
|
|
123259
|
-
}
|
|
123260
|
-
function toResolutionEntry(entryId) {
|
|
123261
|
-
var existing = resolutionEntries === null || resolutionEntries === void 0 ? void 0 : resolutionEntries[entryId - 1];
|
|
123262
|
-
if (existing)
|
|
123263
|
-
return existing;
|
|
123264
|
-
resolutionEntries !== null && resolutionEntries !== void 0 ? resolutionEntries : (resolutionEntries = new Array(resuableCacheResolutions.cache.resolutionEntries.length));
|
|
123265
|
-
var _a = resuableCacheResolutions.cache.resolutionEntries[entryId - 1], nameId = _a[0], resolutionId = _a[1], mode = _a[2];
|
|
123266
|
-
return resolutionEntries[entryId - 1] = [
|
|
123267
|
-
toName(nameId),
|
|
123268
|
-
resolutionId,
|
|
123269
|
-
mode
|
|
123270
|
-
];
|
|
123271
|
-
}
|
|
123272
|
-
function toName(nameId) {
|
|
123273
|
-
return resuableCacheResolutions.cache.names[nameId - 1];
|
|
123274
|
-
}
|
|
123275
|
-
function toOriginalPathOrResolvedFileName(resolutionId) {
|
|
123276
|
-
var _a;
|
|
123277
|
-
return (_a = originalPathOrResolvedFileNames === null || originalPathOrResolvedFileNames === void 0 ? void 0 : originalPathOrResolvedFileNames[resolutionId - 1]) !== null && _a !== void 0 ? _a : ((originalPathOrResolvedFileNames !== null && originalPathOrResolvedFileNames !== void 0 ? originalPathOrResolvedFileNames : (originalPathOrResolvedFileNames = new Array(resuableCacheResolutions.cache.resolutions.length)))[resolutionId - 1] = resuableCacheResolutions.getProgramBuildInfoFilePathDecoder().toFileAbsolutePath(resuableCacheResolutions.cache.resolutions[resolutionId - 1].resolvedModule.originalPath ||
|
|
123278
|
-
resuableCacheResolutions.cache.resolutions[resolutionId - 1].resolvedModule.resolvedFileName));
|
|
123279
|
-
}
|
|
123280
|
-
function toAffectingFileLocation(fileId) {
|
|
123281
|
-
if (!decodedHashes && resuableCacheResolutions.cache.hash) {
|
|
123282
|
-
decodedHashes = ts.arrayToMap(resuableCacheResolutions.cache.hash, function (hash) { return ts.isArray(hash) ? hash[0] : hash; }, function (hash) { return ts.isArray(hash) ? hash[1] : undefined; });
|
|
123283
|
-
}
|
|
123284
|
-
var hash = decodedHashes === null || decodedHashes === void 0 ? void 0 : decodedHashes.get(fileId);
|
|
123285
|
-
var file = resuableCacheResolutions.getProgramBuildInfoFilePathDecoder().toFileAbsolutePath(fileId);
|
|
123286
|
-
return affectingLocationsSame(file, hash) ? file : undefined;
|
|
123287
|
-
}
|
|
123288
|
-
function toResolution(resolutionId) {
|
|
123289
|
-
var _a, _b;
|
|
123290
|
-
var existing = resolutions === null || resolutions === void 0 ? void 0 : resolutions[resolutionId - 1];
|
|
123291
|
-
if (existing !== undefined)
|
|
123292
|
-
return existing || undefined;
|
|
123293
|
-
resolutions !== null && resolutions !== void 0 ? resolutions : (resolutions = new Array(resuableCacheResolutions.cache.resolutions.length));
|
|
123294
|
-
var resolution = resuableCacheResolutions.cache.resolutions[resolutionId - 1];
|
|
123295
|
-
var resolvedFileName = resuableCacheResolutions.getProgramBuildInfoFilePathDecoder().toFileAbsolutePath(((_a = resolution.resolvedModule) === null || _a === void 0 ? void 0 : _a.resolvedFileName) || resolution.resolvedTypeReferenceDirective.resolvedFileName);
|
|
123296
|
-
var affectingLocations;
|
|
123297
|
-
if (fileExists(resolvedFileName) && ts.every(resolution.affectingLocations, function (fileId) {
|
|
123298
|
-
var file = toAffectingFileLocation(fileId);
|
|
123299
|
-
if (file)
|
|
123300
|
-
(affectingLocations !== null && affectingLocations !== void 0 ? affectingLocations : (affectingLocations = [])).push(file);
|
|
123301
|
-
return !!file;
|
|
123302
|
-
})) {
|
|
123303
|
-
// Type Ref doesnt need extension
|
|
123304
|
-
var extenstion = resolution.resolvedModule ? ts.extensionFromPath(resolvedFileName) : undefined;
|
|
123305
|
-
return resolutions[resolutionId - 1] = {
|
|
123306
|
-
resolvedModule: toResolved(resolution.resolvedModule, resolvedFileName, extenstion),
|
|
123307
|
-
resolvedTypeReferenceDirective: toResolved(resolution.resolvedTypeReferenceDirective, resolvedFileName, extenstion),
|
|
123308
|
-
failedLookupLocations: ts.emptyArray,
|
|
123309
|
-
affectingLocations: affectingLocations,
|
|
123310
|
-
resolutionDiagnostics: (_b = resolution.resolutionDiagnostics) === null || _b === void 0 ? void 0 : _b.map(toResolutionDiagnostic)
|
|
123311
|
-
};
|
|
123312
|
-
}
|
|
123313
|
-
resolutions[resolutionId - 1] = false;
|
|
123314
|
-
return undefined;
|
|
123315
|
-
}
|
|
123316
|
-
function toResolved(resolved, resolvedFileName, extension) {
|
|
123317
|
-
if (!resolved)
|
|
123318
|
-
return undefined;
|
|
123319
|
-
return __assign(__assign({}, resolved), { resolvedFileName: resolvedFileName, originalPath: resolved.originalPath ? resuableCacheResolutions.getProgramBuildInfoFilePathDecoder().toFileAbsolutePath(resolved.originalPath) : undefined, extension: extension });
|
|
123320
|
-
}
|
|
123321
|
-
function toResolutionDiagnostic(d) {
|
|
123322
|
-
return {
|
|
123323
|
-
isImports: !!d.isImports,
|
|
123324
|
-
entry: d.entry || "",
|
|
123325
|
-
packagePath: resuableCacheResolutions.getProgramBuildInfoFilePathDecoder().toFileAbsolutePath(d.packagePath)
|
|
123326
|
-
};
|
|
123327
|
-
}
|
|
123328
|
-
}
|
|
123329
|
-
ts.createOldBuildInfoProgram = createOldBuildInfoProgram;
|
|
123330
122554
|
function getBuildInfoFileVersionMap(program, buildInfoPath, host) {
|
|
123331
122555
|
var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
|
|
123332
122556
|
var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
|
|
@@ -123346,7 +122570,6 @@ var ts;
|
|
|
123346
122570
|
restoreEmitState: ts.noop,
|
|
123347
122571
|
getProgram: getProgram,
|
|
123348
122572
|
getProgramOrUndefined: function () { return getState().program; },
|
|
123349
|
-
getProgramOrOldBuildInfoProgramUndefined: function () { return getState().program; },
|
|
123350
122573
|
releaseProgram: function () { return getState().program = undefined; },
|
|
123351
122574
|
getCompilerOptions: function () { return getState().compilerOptions; },
|
|
123352
122575
|
getSourceFile: function (fileName) { return getProgram().getSourceFile(fileName); },
|
|
@@ -123445,10 +122668,11 @@ var ts;
|
|
|
123445
122668
|
function createResolutionCache(resolutionHost, rootDirForResolution, logChangesWhenResolvingModule) {
|
|
123446
122669
|
var filesWithChangedSetOfUnresolvedImports;
|
|
123447
122670
|
var filesWithInvalidatedResolutions;
|
|
122671
|
+
var filesWithInvalidatedNonRelativeUnresolvedImports;
|
|
122672
|
+
var nonRelativeExternalModuleResolutions = ts.createMultiMap();
|
|
123448
122673
|
var resolutionsWithFailedLookups = [];
|
|
123449
122674
|
var resolutionsWithOnlyAffectingLocations = [];
|
|
123450
122675
|
var resolvedFileToResolution = ts.createMultiMap();
|
|
123451
|
-
var resolutionsToCloseWatcherOn;
|
|
123452
122676
|
var hasChangedAutomaticTypeDirectiveNames = false;
|
|
123453
122677
|
var affectingPathChecks;
|
|
123454
122678
|
var failedLookupChecks;
|
|
@@ -123456,15 +122680,18 @@ var ts;
|
|
|
123456
122680
|
var isInDirectoryChecks;
|
|
123457
122681
|
var getCurrentDirectory = ts.memoize(function () { return resolutionHost.getCurrentDirectory(); }); // TODO: GH#18217
|
|
123458
122682
|
var cachedDirectoryStructureHost = resolutionHost.getCachedDirectoryStructureHost();
|
|
123459
|
-
var oldModuleAndTypeRefCache;
|
|
123460
122683
|
// The resolvedModuleNames and resolvedTypeReferenceDirectives are the cache of resolutions per file.
|
|
123461
122684
|
// The key in the map is source file's path.
|
|
123462
122685
|
// The values are Map of resolutions with key being name lookedup.
|
|
123463
122686
|
var resolvedModuleNames = new ts.Map();
|
|
123464
|
-
var
|
|
122687
|
+
var perDirectoryResolvedModuleNames = ts.createCacheWithRedirects();
|
|
122688
|
+
var nonRelativeModuleNameCache = ts.createCacheWithRedirects();
|
|
122689
|
+
var moduleResolutionCache = ts.createModuleResolutionCache(getCurrentDirectory(), resolutionHost.getCanonicalFileName,
|
|
122690
|
+
/*options*/ undefined, perDirectoryResolvedModuleNames, nonRelativeModuleNameCache);
|
|
123465
122691
|
var resolvedTypeReferenceDirectives = new ts.Map();
|
|
122692
|
+
var perDirectoryResolvedTypeReferenceDirectives = ts.createCacheWithRedirects();
|
|
123466
122693
|
var typeReferenceDirectiveResolutionCache = ts.createTypeReferenceDirectiveResolutionCache(getCurrentDirectory(), resolutionHost.getCanonicalFileName,
|
|
123467
|
-
/*options*/ undefined, moduleResolutionCache.getPackageJsonInfoCache());
|
|
122694
|
+
/*options*/ undefined, moduleResolutionCache.getPackageJsonInfoCache(), perDirectoryResolvedTypeReferenceDirectives);
|
|
123468
122695
|
/**
|
|
123469
122696
|
* These are the extensions that failed lookup files will have by default,
|
|
123470
122697
|
* any other extension of failed lookup will be store that path in custom failed lookup path
|
|
@@ -123481,23 +122708,26 @@ var ts;
|
|
|
123481
122708
|
// TypeRoot watches for the types that get added as part of getAutomaticTypeDirectiveNames
|
|
123482
122709
|
var typeRootsWatches = new ts.Map();
|
|
123483
122710
|
return {
|
|
123484
|
-
resolvedModuleNames: resolvedModuleNames,
|
|
123485
|
-
resolvedTypeReferenceDirectives: resolvedTypeReferenceDirectives,
|
|
123486
122711
|
getModuleResolutionCache: function () { return moduleResolutionCache; },
|
|
123487
|
-
getTypeReferenceDirectiveResolutionCache: function () { return typeReferenceDirectiveResolutionCache; },
|
|
123488
122712
|
startRecordingFilesWithChangedResolutions: startRecordingFilesWithChangedResolutions,
|
|
123489
122713
|
finishRecordingFilesWithChangedResolutions: finishRecordingFilesWithChangedResolutions,
|
|
123490
122714
|
// perDirectoryResolvedModuleNames and perDirectoryResolvedTypeReferenceDirectives could be non empty if there was exception during program update
|
|
123491
122715
|
// (between startCachingPerDirectoryResolution and finishCachingPerDirectoryResolution)
|
|
123492
|
-
startCachingPerDirectoryResolution:
|
|
122716
|
+
startCachingPerDirectoryResolution: clearPerDirectoryResolutions,
|
|
123493
122717
|
finishCachingPerDirectoryResolution: finishCachingPerDirectoryResolution,
|
|
123494
122718
|
resolveModuleNames: resolveModuleNames,
|
|
122719
|
+
getResolvedModuleWithFailedLookupLocationsFromCache: getResolvedModuleWithFailedLookupLocationsFromCache,
|
|
123495
122720
|
resolveTypeReferenceDirectives: resolveTypeReferenceDirectives,
|
|
122721
|
+
removeResolutionsFromProjectReferenceRedirects: removeResolutionsFromProjectReferenceRedirects,
|
|
122722
|
+
removeResolutionsOfFile: removeResolutionsOfFile,
|
|
123496
122723
|
hasChangedAutomaticTypeDirectiveNames: function () { return hasChangedAutomaticTypeDirectiveNames; },
|
|
123497
122724
|
invalidateResolutionOfFile: invalidateResolutionOfFile,
|
|
123498
122725
|
invalidateResolutionsOfFailedLookupLocations: invalidateResolutionsOfFailedLookupLocations,
|
|
123499
122726
|
setFilesWithInvalidatedNonRelativeUnresolvedImports: setFilesWithInvalidatedNonRelativeUnresolvedImports,
|
|
123500
122727
|
createHasInvalidatedResolution: createHasInvalidatedResolution,
|
|
122728
|
+
isFileWithInvalidatedNonRelativeUnresolvedImports: isFileWithInvalidatedNonRelativeUnresolvedImports,
|
|
122729
|
+
updateTypeRootsWatch: updateTypeRootsWatch,
|
|
122730
|
+
closeTypeRootsWatch: closeTypeRootsWatch,
|
|
123501
122731
|
clear: clear
|
|
123502
122732
|
};
|
|
123503
122733
|
function getResolvedModule(resolution) {
|
|
@@ -123516,6 +122746,7 @@ var ts;
|
|
|
123516
122746
|
ts.clearMap(directoryWatchesOfFailedLookups, ts.closeFileWatcherOf);
|
|
123517
122747
|
ts.clearMap(fileWatchesOfAffectingLocations, ts.closeFileWatcherOf);
|
|
123518
122748
|
customFailedLookupPaths.clear();
|
|
122749
|
+
nonRelativeExternalModuleResolutions.clear();
|
|
123519
122750
|
closeTypeRootsWatch();
|
|
123520
122751
|
resolvedModuleNames.clear();
|
|
123521
122752
|
resolvedTypeReferenceDirectives.clear();
|
|
@@ -123526,12 +122757,9 @@ var ts;
|
|
|
123526
122757
|
startsWithPathChecks = undefined;
|
|
123527
122758
|
isInDirectoryChecks = undefined;
|
|
123528
122759
|
affectingPathChecks = undefined;
|
|
123529
|
-
resolutionsToCloseWatcherOn = undefined;
|
|
123530
122760
|
// perDirectoryResolvedModuleNames and perDirectoryResolvedTypeReferenceDirectives could be non empty if there was exception during program update
|
|
123531
122761
|
// (between startCachingPerDirectoryResolution and finishCachingPerDirectoryResolution)
|
|
123532
|
-
|
|
123533
|
-
typeReferenceDirectiveResolutionCache.clear();
|
|
123534
|
-
oldModuleAndTypeRefCache = undefined;
|
|
122762
|
+
clearPerDirectoryResolutions();
|
|
123535
122763
|
hasChangedAutomaticTypeDirectiveNames = false;
|
|
123536
122764
|
}
|
|
123537
122765
|
function startRecordingFilesWithChangedResolutions() {
|
|
@@ -123542,6 +122770,14 @@ var ts;
|
|
|
123542
122770
|
filesWithChangedSetOfUnresolvedImports = undefined;
|
|
123543
122771
|
return collected;
|
|
123544
122772
|
}
|
|
122773
|
+
function isFileWithInvalidatedNonRelativeUnresolvedImports(path) {
|
|
122774
|
+
if (!filesWithInvalidatedNonRelativeUnresolvedImports) {
|
|
122775
|
+
return false;
|
|
122776
|
+
}
|
|
122777
|
+
// Invalidated if file has unresolved imports
|
|
122778
|
+
var value = filesWithInvalidatedNonRelativeUnresolvedImports.get(path);
|
|
122779
|
+
return !!value && !!value.length;
|
|
122780
|
+
}
|
|
123545
122781
|
function createHasInvalidatedResolution(forceAllFilesAsInvalidated) {
|
|
123546
122782
|
// Ensure pending resolutions are applied
|
|
123547
122783
|
invalidateResolutionsOfFailedLookupLocations();
|
|
@@ -123552,155 +122788,36 @@ var ts;
|
|
|
123552
122788
|
}
|
|
123553
122789
|
var collected = filesWithInvalidatedResolutions;
|
|
123554
122790
|
filesWithInvalidatedResolutions = undefined;
|
|
123555
|
-
return function (path) { return !!
|
|
122791
|
+
return function (path) { return (!!collected && collected.has(path)) ||
|
|
122792
|
+
isFileWithInvalidatedNonRelativeUnresolvedImports(path); };
|
|
123556
122793
|
}
|
|
123557
|
-
function
|
|
122794
|
+
function clearPerDirectoryResolutions() {
|
|
123558
122795
|
moduleResolutionCache.clear();
|
|
123559
122796
|
typeReferenceDirectiveResolutionCache.clear();
|
|
123560
|
-
|
|
123561
|
-
|
|
123562
|
-
if (oldModuleAndTypeRefCache) {
|
|
123563
|
-
oldModuleAndTypeRefCache.clearRedirectsMap();
|
|
123564
|
-
moduleResolutionCache.setOldResolutionCache(oldModuleAndTypeRefCache.modules);
|
|
123565
|
-
typeReferenceDirectiveResolutionCache.setOldResolutionCache(oldModuleAndTypeRefCache.typeRefs);
|
|
123566
|
-
}
|
|
122797
|
+
nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfNonRelativeModuleResolutions);
|
|
122798
|
+
nonRelativeExternalModuleResolutions.clear();
|
|
123567
122799
|
}
|
|
123568
|
-
function finishCachingPerDirectoryResolution(
|
|
122800
|
+
function finishCachingPerDirectoryResolution() {
|
|
122801
|
+
filesWithInvalidatedNonRelativeUnresolvedImports = undefined;
|
|
122802
|
+
clearPerDirectoryResolutions();
|
|
122803
|
+
directoryWatchesOfFailedLookups.forEach(function (watcher, path) {
|
|
122804
|
+
if (watcher.refCount === 0) {
|
|
122805
|
+
directoryWatchesOfFailedLookups.delete(path);
|
|
122806
|
+
watcher.watcher.close();
|
|
122807
|
+
}
|
|
122808
|
+
});
|
|
122809
|
+
fileWatchesOfAffectingLocations.forEach(function (watcher, path) {
|
|
122810
|
+
if (watcher.refCount === 0) {
|
|
122811
|
+
fileWatchesOfAffectingLocations.delete(path);
|
|
122812
|
+
watcher.watcher.close();
|
|
122813
|
+
// Ensure when watching symlinked package.json, we can close the actual file watcher only once
|
|
122814
|
+
watcher.watcher = ts.noopFileWatcher;
|
|
122815
|
+
}
|
|
122816
|
+
});
|
|
123569
122817
|
hasChangedAutomaticTypeDirectiveNames = false;
|
|
123570
|
-
if (!newProgram) {
|
|
123571
|
-
clear();
|
|
123572
|
-
return;
|
|
123573
|
-
}
|
|
123574
|
-
if (newProgram === oldProgram || newProgram.structureIsReused === 3 /* Completely */)
|
|
123575
|
-
return;
|
|
123576
|
-
var modules;
|
|
123577
|
-
var typeRefs;
|
|
123578
|
-
var moduleNameToDirectoryMap = ts.createCacheWithRedirects(newProgram.getCompilerOptions());
|
|
123579
|
-
// Update resolution caches
|
|
123580
|
-
for (var _i = 0, _a = newProgram.getSourceFiles(); _i < _a.length; _i++) {
|
|
123581
|
-
var f = _a[_i];
|
|
123582
|
-
modules = ensureResolutionsOfFile(newProgram, resolvedModuleNames, f.resolvedModules, f, getResolvedModule, modules, moduleNameToDirectoryMap);
|
|
123583
|
-
typeRefs = ensureResolutionsOfFile(newProgram, resolvedTypeReferenceDirectives, f.resolvedTypeReferenceDirectiveNames, f, getResolvedTypeReferenceDirective, typeRefs,
|
|
123584
|
-
/*moduleNameToDirectoryMap*/ undefined);
|
|
123585
|
-
}
|
|
123586
|
-
var newProgramAutoTypeRefContainingFile = resolutionHost.toPath(newProgram.getAutomaticTypeDirectiveContainingFile());
|
|
123587
|
-
typeRefs = ensureResolutionsOfFile(newProgram, resolvedTypeReferenceDirectives, newProgram.getAutomaticTypeDirectiveResolutions(), newProgramAutoTypeRefContainingFile, getResolvedTypeReferenceDirective, typeRefs,
|
|
123588
|
-
/*moduleNameToDirectoryMap*/ undefined);
|
|
123589
|
-
if (!modules && !typeRefs) {
|
|
123590
|
-
oldModuleAndTypeRefCache = undefined;
|
|
123591
|
-
}
|
|
123592
|
-
else {
|
|
123593
|
-
oldModuleAndTypeRefCache = getOldResolutionCache(modules, typeRefs, moduleNameToDirectoryMap);
|
|
123594
|
-
}
|
|
123595
|
-
// Remove resolutions for files not in the program
|
|
123596
|
-
if (oldProgram) {
|
|
123597
|
-
for (var _b = 0, _c = oldProgram.getSourceFiles(); _b < _c.length; _b++) {
|
|
123598
|
-
var f = _c[_b];
|
|
123599
|
-
if (!newProgram.getSourceFileByPath(f.path))
|
|
123600
|
-
removeResolutionsOfFile(f.path);
|
|
123601
|
-
}
|
|
123602
|
-
var oldProgramAutoTypeRefContainingFile = resolutionHost.toPath(oldProgram.getAutomaticTypeDirectiveContainingFile());
|
|
123603
|
-
if (oldProgramAutoTypeRefContainingFile !== newProgramAutoTypeRefContainingFile) {
|
|
123604
|
-
removeResolutionsOfFile(oldProgramAutoTypeRefContainingFile);
|
|
123605
|
-
}
|
|
123606
|
-
}
|
|
123607
|
-
if (!oldProgram || newProgram.getCompilerOptions() !== oldProgram.getCompilerOptions())
|
|
123608
|
-
updateTypeRootsWatch();
|
|
123609
|
-
// Remove symlinked watchers that have zero ref count
|
|
123610
|
-
resolutionsToCloseWatcherOn === null || resolutionsToCloseWatcherOn === void 0 ? void 0 : resolutionsToCloseWatcherOn.forEach(closeWatchersOfResolution);
|
|
123611
|
-
resolutionsToCloseWatcherOn = undefined;
|
|
123612
|
-
fileWatchesOfAffectingLocations.forEach(closeAffectingFileWatcher);
|
|
123613
|
-
}
|
|
123614
|
-
function closeAffectingFileWatcher(watcher, path) {
|
|
123615
|
-
if (watcher.refCount === 0) {
|
|
123616
|
-
fileWatchesOfAffectingLocations.delete(path);
|
|
123617
|
-
watcher.watcher.close();
|
|
123618
|
-
// Ensure when watching symlinked package.json, we can close the actual file watcher only once
|
|
123619
|
-
watcher.watcher = ts.noopFileWatcher;
|
|
123620
|
-
}
|
|
123621
|
-
}
|
|
123622
|
-
function ensureResolutionsOfFile(newProgram, perFileCache, fileCacheFromProgram, sourceFileOrPath, getResolutionWithResolvedFileName, perDirCache, moduleNameToDirectoryMap) {
|
|
123623
|
-
var path = !ts.isString(sourceFileOrPath) ? sourceFileOrPath.path : sourceFileOrPath;
|
|
123624
|
-
var resolutionsInFile = perFileCache.get(path);
|
|
123625
|
-
var seenNamesInFile = ts.createModeAwareCache();
|
|
123626
|
-
if (fileCacheFromProgram === null || fileCacheFromProgram === void 0 ? void 0 : fileCacheFromProgram.size()) {
|
|
123627
|
-
// If keys dont match release existing resolutions
|
|
123628
|
-
var redirectedReference = !ts.isString(sourceFileOrPath) ? newProgram.getRedirectReferenceForResolution(sourceFileOrPath) : undefined;
|
|
123629
|
-
var options_3 = (redirectedReference === null || redirectedReference === void 0 ? void 0 : redirectedReference.commandLine.options) || newProgram.getCompilerOptions();
|
|
123630
|
-
var key_2 = ts.getRedirectsCacheKey(options_3);
|
|
123631
|
-
if (resolutionsInFile && resolutionsInFile.key !== key_2) {
|
|
123632
|
-
resolutionsInFile.cache.forEach(function (r) { return stopWatchingResolution(r, path, getResolutionWithResolvedFileName); });
|
|
123633
|
-
resolutionsInFile = undefined;
|
|
123634
|
-
}
|
|
123635
|
-
var dirPath_1 = ts.getDirectoryPath(path);
|
|
123636
|
-
var perDirResolutionCache_1 = perDirCache === null || perDirCache === void 0 ? void 0 : perDirCache.getMapOfCacheRedirects(redirectedReference);
|
|
123637
|
-
var cacheForDir_1 = perDirResolutionCache_1 === null || perDirResolutionCache_1 === void 0 ? void 0 : perDirResolutionCache_1.get(dirPath_1);
|
|
123638
|
-
fileCacheFromProgram.forEach(function (r, name, mode) {
|
|
123639
|
-
seenNamesInFile.set(name, mode, true);
|
|
123640
|
-
var existing = resolutionsInFile === null || resolutionsInFile === void 0 ? void 0 : resolutionsInFile.cache.get(name, mode);
|
|
123641
|
-
if (existing && r !== existing)
|
|
123642
|
-
stopWatchingResolution(existing, path, getResolutionWithResolvedFileName);
|
|
123643
|
-
watchResolution(newProgram, name, r, path, getResolutionWithResolvedFileName);
|
|
123644
|
-
if (!resolutionsInFile)
|
|
123645
|
-
perFileCache.set(path, resolutionsInFile = { key: key_2, cache: ts.createModeAwareCache() });
|
|
123646
|
-
resolutionsInFile.cache.set(name, mode, r);
|
|
123647
|
-
if (cacheForDir_1 === null || cacheForDir_1 === void 0 ? void 0 : cacheForDir_1.has(name, mode))
|
|
123648
|
-
return;
|
|
123649
|
-
if (!cacheForDir_1) {
|
|
123650
|
-
perDirResolutionCache_1 !== null && perDirResolutionCache_1 !== void 0 ? perDirResolutionCache_1 : (perDirResolutionCache_1 = (perDirCache !== null && perDirCache !== void 0 ? perDirCache : (perDirCache = ts.createCacheWithRedirects(newProgram.getCompilerOptions()))).createMapForCompilerOptions(options_3, key_2));
|
|
123651
|
-
perDirResolutionCache_1.set(dirPath_1, cacheForDir_1 = ts.createModeAwareCache());
|
|
123652
|
-
}
|
|
123653
|
-
cacheForDir_1.set(name, mode, r);
|
|
123654
|
-
if (!moduleNameToDirectoryMap || ts.isExternalModuleNameRelative(name))
|
|
123655
|
-
return;
|
|
123656
|
-
var actualModuleNameToDirectoryMap = moduleNameToDirectoryMap.createMapForCompilerOptions(options_3, key_2);
|
|
123657
|
-
var modeAwareCacheKey = ts.getModeAwareCacheKey(name, mode);
|
|
123658
|
-
var directoryPathMap = actualModuleNameToDirectoryMap.get(modeAwareCacheKey);
|
|
123659
|
-
if (!directoryPathMap)
|
|
123660
|
-
actualModuleNameToDirectoryMap.set(modeAwareCacheKey, directoryPathMap = new ts.Map());
|
|
123661
|
-
ts.moduleNameToDirectorySet(directoryPathMap, dirPath_1, r, ts.getResolvedFileNameForModuleNameToDirectorySet, function (dir) { return resolutionHost.toPath(dir); }, ts.noop);
|
|
123662
|
-
});
|
|
123663
|
-
}
|
|
123664
|
-
if (((resolutionsInFile === null || resolutionsInFile === void 0 ? void 0 : resolutionsInFile.cache.size()) || 0) !== seenNamesInFile.size()) {
|
|
123665
|
-
// Stop watching and remove the unused name
|
|
123666
|
-
resolutionsInFile.cache.forEach(function (resolution, name, mode) {
|
|
123667
|
-
if (!seenNamesInFile.has(name, mode)) {
|
|
123668
|
-
stopWatchingResolution(resolution, path, getResolutionWithResolvedFileName);
|
|
123669
|
-
resolutionsInFile.cache.delete(name, mode);
|
|
123670
|
-
}
|
|
123671
|
-
});
|
|
123672
|
-
if (!(resolutionsInFile === null || resolutionsInFile === void 0 ? void 0 : resolutionsInFile.cache.size))
|
|
123673
|
-
perFileCache.delete(path);
|
|
123674
|
-
}
|
|
123675
|
-
return perDirCache;
|
|
123676
|
-
}
|
|
123677
|
-
function getOldResolutionCache(modules, typeRefs, moduleNameToDirectoryMap) {
|
|
123678
|
-
if (!modules && !typeRefs)
|
|
123679
|
-
return undefined;
|
|
123680
|
-
return {
|
|
123681
|
-
modules: {
|
|
123682
|
-
getResolved: function (dirPath, name, mode, redirectedReference) { return getResolvedWithOldCache(dirPath, name, mode, redirectedReference, modules, moduleNameToDirectoryMap); }
|
|
123683
|
-
},
|
|
123684
|
-
typeRefs: {
|
|
123685
|
-
getResolved: function (dirPath, name, mode, redirectedReference) { return getResolvedWithOldCache(dirPath, name, mode, redirectedReference, typeRefs, /*moduleNameToDirectoryMap*/ undefined); }
|
|
123686
|
-
},
|
|
123687
|
-
clearRedirectsMap: function () {
|
|
123688
|
-
modules === null || modules === void 0 ? void 0 : modules.clearRedirectsMap();
|
|
123689
|
-
typeRefs === null || typeRefs === void 0 ? void 0 : typeRefs.clearRedirectsMap();
|
|
123690
|
-
moduleNameToDirectoryMap.clearRedirectsMap();
|
|
123691
|
-
},
|
|
123692
|
-
};
|
|
123693
|
-
}
|
|
123694
|
-
function getResolvedWithOldCache(dirPath, name, mode, redirectedReference, perDirCache, moduleNameToDirectoryMap) {
|
|
123695
|
-
var _a, _b, _c, _d;
|
|
123696
|
-
if (!perDirCache)
|
|
123697
|
-
return undefined;
|
|
123698
|
-
var result = ((_b = (_a = perDirCache.getMapOfCacheRedirects(redirectedReference)) === null || _a === void 0 ? void 0 : _a.get(dirPath)) === null || _b === void 0 ? void 0 : _b.get(name, mode)) ||
|
|
123699
|
-
((_d = (_c = moduleNameToDirectoryMap === null || moduleNameToDirectoryMap === void 0 ? void 0 : moduleNameToDirectoryMap.getMapOfCacheRedirects(redirectedReference)) === null || _c === void 0 ? void 0 : _c.get(ts.getModeAwareCacheKey(name, mode))) === null || _d === void 0 ? void 0 : _d.get(dirPath));
|
|
123700
|
-
return result && !result.isInvalidated ? result : undefined;
|
|
123701
122818
|
}
|
|
123702
122819
|
function resolveModuleName(moduleName, containingFile, compilerOptions, host, redirectedReference, _containingSourceFile, mode) {
|
|
123703
|
-
var _a;
|
|
122820
|
+
var _a, _b;
|
|
123704
122821
|
var primaryResult = ts.resolveModuleName(moduleName, containingFile, compilerOptions, host, moduleResolutionCache, redirectedReference, mode);
|
|
123705
122822
|
// return result immediately only if global cache support is not enabled or if it is .ts, .tsx or .d.ts
|
|
123706
122823
|
if (!resolutionHost.getGlobalCache) {
|
|
@@ -123711,16 +122828,12 @@ var ts;
|
|
|
123711
122828
|
if (globalCache !== undefined && !ts.isExternalModuleNameRelative(moduleName) && !(primaryResult.resolvedModule && ts.extensionIsTS(primaryResult.resolvedModule.extension))) {
|
|
123712
122829
|
// create different collection of failed lookup locations for second pass
|
|
123713
122830
|
// if it will fail and we've already found something during the first pass - we don't want to pollute its results
|
|
123714
|
-
var
|
|
122831
|
+
var _c = ts.loadModuleFromGlobalCache(ts.Debug.checkDefined(resolutionHost.globalCacheResolutionModuleName)(moduleName), resolutionHost.projectName, compilerOptions, host, globalCache, moduleResolutionCache), resolvedModule = _c.resolvedModule, failedLookupLocations = _c.failedLookupLocations, affectingLocations = _c.affectingLocations;
|
|
123715
122832
|
if (resolvedModule) {
|
|
123716
122833
|
// Modify existing resolution so its saved in the directory cache as well
|
|
123717
122834
|
primaryResult.resolvedModule = resolvedModule;
|
|
123718
|
-
|
|
123719
|
-
|
|
123720
|
-
else
|
|
123721
|
-
primaryResult.failedLookupLocations.length = 0;
|
|
123722
|
-
primaryResult.affectingLocations = ts.updateResolutionField(primaryResult.affectingLocations, affectingLocations);
|
|
123723
|
-
primaryResult.resolutionDiagnostics = ts.updateResolutionField(primaryResult.resolutionDiagnostics, resolutionDiagnostics);
|
|
122835
|
+
(_a = primaryResult.failedLookupLocations).push.apply(_a, failedLookupLocations);
|
|
122836
|
+
(_b = primaryResult.affectingLocations).push.apply(_b, affectingLocations);
|
|
123724
122837
|
return primaryResult;
|
|
123725
122838
|
}
|
|
123726
122839
|
}
|
|
@@ -123731,41 +122844,76 @@ var ts;
|
|
|
123731
122844
|
return ts.resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host, redirectedReference, typeReferenceDirectiveResolutionCache, resolutionMode);
|
|
123732
122845
|
}
|
|
123733
122846
|
function resolveNamesWithLocalCache(_a) {
|
|
123734
|
-
var _b, _c, _d
|
|
123735
|
-
var names = _a.names, containingFile = _a.containingFile, redirectedReference = _a.redirectedReference,
|
|
122847
|
+
var _b, _c, _d;
|
|
122848
|
+
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, containingSourceFile = _a.containingSourceFile, containingSourceFileMode = _a.containingSourceFileMode;
|
|
123736
122849
|
var path = resolutionHost.toPath(containingFile);
|
|
123737
|
-
var resolutionsInFile =
|
|
123738
|
-
var
|
|
123739
|
-
var
|
|
123740
|
-
|
|
123741
|
-
|
|
123742
|
-
|
|
122850
|
+
var resolutionsInFile = cache.get(path) || cache.set(path, ts.createModeAwareCache()).get(path);
|
|
122851
|
+
var dirPath = ts.getDirectoryPath(path);
|
|
122852
|
+
var perDirectoryCache = perDirectoryCacheWithRedirects.getOrCreateMapOfCacheRedirects(redirectedReference);
|
|
122853
|
+
var perDirectoryResolution = perDirectoryCache.get(dirPath);
|
|
122854
|
+
if (!perDirectoryResolution) {
|
|
122855
|
+
perDirectoryResolution = ts.createModeAwareCache();
|
|
122856
|
+
perDirectoryCache.set(dirPath, perDirectoryResolution);
|
|
123743
122857
|
}
|
|
123744
122858
|
var resolvedModules = [];
|
|
122859
|
+
var compilerOptions = resolutionHost.getCompilationSettings();
|
|
122860
|
+
var hasInvalidatedNonRelativeUnresolvedImport = logChanges && isFileWithInvalidatedNonRelativeUnresolvedImports(path);
|
|
122861
|
+
// All the resolutions in this file are invalidated if this file wasn't resolved using same redirect
|
|
122862
|
+
var program = resolutionHost.getCurrentProgram();
|
|
122863
|
+
var oldRedirect = program && program.getResolvedProjectReferenceToRedirect(containingFile);
|
|
122864
|
+
var unmatchedRedirects = oldRedirect ?
|
|
122865
|
+
!redirectedReference || redirectedReference.sourceFile.path !== oldRedirect.sourceFile.path :
|
|
122866
|
+
!!redirectedReference;
|
|
123745
122867
|
var seenNamesInFile = ts.createModeAwareCache();
|
|
123746
122868
|
var i = 0;
|
|
123747
|
-
for (var _i = 0,
|
|
123748
|
-
var entry =
|
|
123749
|
-
var name = ts.isString(entry) ? entry :
|
|
122869
|
+
for (var _i = 0, names_5 = names; _i < names_5.length; _i++) {
|
|
122870
|
+
var entry = names_5[_i];
|
|
122871
|
+
var name = ts.isString(entry) ? entry : entry.fileName.toLowerCase();
|
|
123750
122872
|
// Imports supply a `containingSourceFile` but no `containingSourceFileMode` - it would be redundant
|
|
123751
122873
|
// they require calculating the mode for a given import from it's position in the resolution table, since a given
|
|
123752
122874
|
// import's syntax may override the file's default mode.
|
|
123753
122875
|
// Type references instead supply a `containingSourceFileMode` and a non-string entry which contains
|
|
123754
122876
|
// a default file mode override if applicable.
|
|
123755
122877
|
var mode = !ts.isString(entry) ? ts.getModeForFileReference(entry, containingSourceFileMode) :
|
|
123756
|
-
containingSourceFile ? ts.getModeForResolutionAtIndex(containingSourceFile,
|
|
122878
|
+
containingSourceFile ? ts.getModeForResolutionAtIndex(containingSourceFile, i) : undefined;
|
|
123757
122879
|
i++;
|
|
123758
|
-
var resolution = resolutionsInFile.
|
|
122880
|
+
var resolution = resolutionsInFile.get(name, mode);
|
|
123759
122881
|
// Resolution is valid if it is present and not invalidated
|
|
123760
|
-
if (!seenNamesInFile.has(name, mode) &&
|
|
122882
|
+
if (!seenNamesInFile.has(name, mode) &&
|
|
122883
|
+
unmatchedRedirects || !resolution || resolution.isInvalidated ||
|
|
122884
|
+
// If the name is unresolved import that was invalidated, recalculate
|
|
122885
|
+
(hasInvalidatedNonRelativeUnresolvedImport && !ts.isExternalModuleNameRelative(name) && shouldRetryResolution(resolution))) {
|
|
123761
122886
|
var existingResolution = resolution;
|
|
123762
|
-
|
|
123763
|
-
if (
|
|
123764
|
-
|
|
122887
|
+
var resolutionInDirectory = perDirectoryResolution.get(name, mode);
|
|
122888
|
+
if (resolutionInDirectory) {
|
|
122889
|
+
resolution = resolutionInDirectory;
|
|
122890
|
+
var host = ((_b = resolutionHost.getCompilerHost) === null || _b === void 0 ? void 0 : _b.call(resolutionHost)) || resolutionHost;
|
|
122891
|
+
if (ts.isTraceEnabled(compilerOptions, host)) {
|
|
122892
|
+
var resolved = getResolutionWithResolvedFileName(resolution);
|
|
122893
|
+
ts.trace(host, loader === resolveModuleName ?
|
|
122894
|
+
(resolved === null || resolved === void 0 ? void 0 : resolved.resolvedFileName) ?
|
|
122895
|
+
resolved.packagetId ?
|
|
122896
|
+
ts.Diagnostics.Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3_with_Package_ID_4 :
|
|
122897
|
+
ts.Diagnostics.Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3 :
|
|
122898
|
+
ts.Diagnostics.Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_not_resolved :
|
|
122899
|
+
(resolved === null || resolved === void 0 ? void 0 : resolved.resolvedFileName) ?
|
|
122900
|
+
resolved.packagetId ?
|
|
122901
|
+
ts.Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3_with_Package_ID_4 :
|
|
122902
|
+
ts.Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3 :
|
|
122903
|
+
ts.Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_not_resolved, name, containingFile, ts.getDirectoryPath(containingFile), resolved === null || resolved === void 0 ? void 0 : resolved.resolvedFileName, (resolved === null || resolved === void 0 ? void 0 : resolved.packagetId) && ts.packageIdToString(resolved.packagetId));
|
|
122904
|
+
}
|
|
123765
122905
|
}
|
|
123766
|
-
|
|
122906
|
+
else {
|
|
122907
|
+
resolution = loader(name, containingFile, compilerOptions, ((_c = resolutionHost.getCompilerHost) === null || _c === void 0 ? void 0 : _c.call(resolutionHost)) || resolutionHost, redirectedReference, containingSourceFile, mode);
|
|
122908
|
+
perDirectoryResolution.set(name, mode, resolution);
|
|
122909
|
+
if (resolutionHost.onDiscoveredSymlink && resolutionIsSymlink(resolution)) {
|
|
122910
|
+
resolutionHost.onDiscoveredSymlink();
|
|
122911
|
+
}
|
|
122912
|
+
}
|
|
122913
|
+
resolutionsInFile.set(name, mode, resolution);
|
|
122914
|
+
watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, path, getResolutionWithResolvedFileName);
|
|
123767
122915
|
if (existingResolution) {
|
|
123768
|
-
|
|
122916
|
+
stopWatchFailedLookupLocationOfResolution(existingResolution, path, getResolutionWithResolvedFileName);
|
|
123769
122917
|
}
|
|
123770
122918
|
if (logChanges && filesWithChangedSetOfUnresolvedImports && !resolutionIsEqualTo(existingResolution, resolution)) {
|
|
123771
122919
|
filesWithChangedSetOfUnresolvedImports.push(path);
|
|
@@ -123779,34 +122927,28 @@ var ts;
|
|
|
123779
122927
|
var resolved = getResolutionWithResolvedFileName(resolution);
|
|
123780
122928
|
ts.trace(host, loader === resolveModuleName ?
|
|
123781
122929
|
(resolved === null || resolved === void 0 ? void 0 : resolved.resolvedFileName) ?
|
|
123782
|
-
resolved.
|
|
122930
|
+
resolved.packagetId ?
|
|
123783
122931
|
ts.Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 :
|
|
123784
122932
|
ts.Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2 :
|
|
123785
122933
|
ts.Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_not_resolved :
|
|
123786
122934
|
(resolved === null || resolved === void 0 ? void 0 : resolved.resolvedFileName) ?
|
|
123787
|
-
resolved.
|
|
122935
|
+
resolved.packagetId ?
|
|
123788
122936
|
ts.Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 :
|
|
123789
122937
|
ts.Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved_to_2 :
|
|
123790
|
-
ts.Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_not_resolved, name, containingFile, resolved === null || resolved === void 0 ? void 0 : resolved.resolvedFileName, (resolved === null || resolved === void 0 ? void 0 : resolved.
|
|
122938
|
+
ts.Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_not_resolved, name, containingFile, resolved === null || resolved === void 0 ? void 0 : resolved.resolvedFileName, (resolved === null || resolved === void 0 ? void 0 : resolved.packagetId) && ts.packageIdToString(resolved.packagetId));
|
|
123791
122939
|
}
|
|
123792
122940
|
}
|
|
123793
122941
|
ts.Debug.assert(resolution !== undefined && !resolution.isInvalidated);
|
|
123794
122942
|
seenNamesInFile.set(name, mode, true);
|
|
123795
|
-
resolvedModules.push(resolution);
|
|
122943
|
+
resolvedModules.push(getResolutionWithResolvedFileName(resolution));
|
|
123796
122944
|
}
|
|
123797
|
-
|
|
123798
|
-
|
|
123799
|
-
|
|
122945
|
+
// Stop watching and remove the unused name
|
|
122946
|
+
resolutionsInFile.forEach(function (resolution, name, mode) {
|
|
122947
|
+
if (!seenNamesInFile.has(name, mode) && !ts.contains(reusedNames, name)) {
|
|
122948
|
+
stopWatchFailedLookupLocationOfResolution(resolution, path, getResolutionWithResolvedFileName);
|
|
122949
|
+
resolutionsInFile.delete(name, mode);
|
|
122950
|
+
}
|
|
123800
122951
|
});
|
|
123801
|
-
if (resolutionsInFile.cache.size() !== seenNamesInFile.size()) {
|
|
123802
|
-
// Stop watching and remove the unused name
|
|
123803
|
-
resolutionsInFile.cache.forEach(function (resolution, name, mode) {
|
|
123804
|
-
if (!seenNamesInFile.has(name, mode)) {
|
|
123805
|
-
stopWatchingResolution(resolution, path, getResolutionWithResolvedFileName);
|
|
123806
|
-
resolutionsInFile.cache.delete(name, mode);
|
|
123807
|
-
}
|
|
123808
|
-
});
|
|
123809
|
-
}
|
|
123810
122952
|
return resolvedModules;
|
|
123811
122953
|
function resolutionIsEqualTo(oldResolution, newResolution) {
|
|
123812
122954
|
if (oldResolution === newResolution) {
|
|
@@ -123826,31 +122968,40 @@ var ts;
|
|
|
123826
122968
|
return oldResult.resolvedFileName === newResult.resolvedFileName;
|
|
123827
122969
|
}
|
|
123828
122970
|
}
|
|
123829
|
-
function resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference, containingFileMode
|
|
122971
|
+
function resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference, containingFileMode) {
|
|
123830
122972
|
return resolveNamesWithLocalCache({
|
|
123831
122973
|
names: typeDirectiveNames,
|
|
123832
122974
|
containingFile: containingFile,
|
|
123833
122975
|
redirectedReference: redirectedReference,
|
|
123834
|
-
|
|
122976
|
+
cache: resolvedTypeReferenceDirectives,
|
|
122977
|
+
perDirectoryCacheWithRedirects: perDirectoryResolvedTypeReferenceDirectives,
|
|
123835
122978
|
loader: resolveTypeReferenceDirective,
|
|
123836
122979
|
getResolutionWithResolvedFileName: getResolvedTypeReferenceDirective,
|
|
123837
|
-
|
|
123838
|
-
|
|
122980
|
+
shouldRetryResolution: function (resolution) { return resolution.resolvedTypeReferenceDirective === undefined; },
|
|
122981
|
+
containingSourceFileMode: containingFileMode
|
|
123839
122982
|
});
|
|
123840
122983
|
}
|
|
123841
|
-
function resolveModuleNames(moduleNames, containingFile, redirectedReference, containingSourceFile
|
|
122984
|
+
function resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference, containingSourceFile) {
|
|
123842
122985
|
return resolveNamesWithLocalCache({
|
|
123843
122986
|
names: moduleNames,
|
|
123844
122987
|
containingFile: containingFile,
|
|
123845
122988
|
redirectedReference: redirectedReference,
|
|
123846
|
-
|
|
122989
|
+
cache: resolvedModuleNames,
|
|
122990
|
+
perDirectoryCacheWithRedirects: perDirectoryResolvedModuleNames,
|
|
123847
122991
|
loader: resolveModuleName,
|
|
123848
122992
|
getResolutionWithResolvedFileName: getResolvedModule,
|
|
123849
|
-
|
|
122993
|
+
shouldRetryResolution: function (resolution) { return !resolution.resolvedModule || !ts.resolutionExtensionIsTSOrJson(resolution.resolvedModule.extension); },
|
|
122994
|
+
reusedNames: reusedNames,
|
|
123850
122995
|
logChanges: logChangesWhenResolvingModule,
|
|
123851
122996
|
containingSourceFile: containingSourceFile,
|
|
123852
122997
|
});
|
|
123853
122998
|
}
|
|
122999
|
+
function getResolvedModuleWithFailedLookupLocationsFromCache(moduleName, containingFile, resolutionMode) {
|
|
123000
|
+
var cache = resolvedModuleNames.get(resolutionHost.toPath(containingFile));
|
|
123001
|
+
if (!cache)
|
|
123002
|
+
return undefined;
|
|
123003
|
+
return cache.get(moduleName, resolutionMode);
|
|
123004
|
+
}
|
|
123854
123005
|
function isNodeModulesAtTypesDirectory(dirPath) {
|
|
123855
123006
|
return ts.endsWith(dirPath, "/node_modules/@types");
|
|
123856
123007
|
}
|
|
@@ -123910,42 +123061,37 @@ var ts;
|
|
|
123910
123061
|
function isPathWithDefaultFailedLookupExtension(path) {
|
|
123911
123062
|
return ts.fileExtensionIsOneOf(path, failedLookupDefaultExtensions);
|
|
123912
123063
|
}
|
|
123913
|
-
function
|
|
123914
|
-
if (resolution.
|
|
123915
|
-
resolution.
|
|
123916
|
-
|
|
123917
|
-
watchFailedLookupLocationOfResolution(resolution);
|
|
123918
|
-
watchAffectingLocationsOfResolution(resolution);
|
|
123919
|
-
return;
|
|
123920
|
-
}
|
|
123921
|
-
resolution.files = new ts.Set();
|
|
123922
|
-
resolution.files.add(filePath);
|
|
123923
|
-
var resolved = getResolutionWithResolvedFileName(resolution);
|
|
123924
|
-
if (resolved && resolved.resolvedFileName) {
|
|
123925
|
-
resolvedFileToResolution.add(resolutionHost.toPath(resolved.resolvedFileName), resolution);
|
|
123926
|
-
}
|
|
123927
|
-
if (ts.isExternalModuleNameRelative(name) || !newProgram.getTypeChecker().tryFindAmbientModuleWithoutAugmentations(name)) {
|
|
123928
|
-
watchFailedLookupLocationOfResolution(resolution);
|
|
123929
|
-
watchAffectingLocationsOfResolution(resolution);
|
|
123064
|
+
function watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, filePath, getResolutionWithResolvedFileName) {
|
|
123065
|
+
if (resolution.refCount) {
|
|
123066
|
+
resolution.refCount++;
|
|
123067
|
+
ts.Debug.assertIsDefined(resolution.files);
|
|
123930
123068
|
}
|
|
123931
123069
|
else {
|
|
123932
|
-
resolution.
|
|
123933
|
-
|
|
123070
|
+
resolution.refCount = 1;
|
|
123071
|
+
ts.Debug.assert(ts.length(resolution.files) === 0); // This resolution shouldnt be referenced by any file yet
|
|
123072
|
+
if (ts.isExternalModuleNameRelative(name)) {
|
|
123073
|
+
watchFailedLookupLocationOfResolution(resolution);
|
|
123074
|
+
}
|
|
123075
|
+
else {
|
|
123076
|
+
nonRelativeExternalModuleResolutions.add(name, resolution);
|
|
123077
|
+
}
|
|
123078
|
+
var resolved = getResolutionWithResolvedFileName(resolution);
|
|
123079
|
+
if (resolved && resolved.resolvedFileName) {
|
|
123080
|
+
resolvedFileToResolution.add(resolutionHost.toPath(resolved.resolvedFileName), resolution);
|
|
123081
|
+
}
|
|
123934
123082
|
}
|
|
123083
|
+
(resolution.files || (resolution.files = [])).push(filePath);
|
|
123935
123084
|
}
|
|
123936
123085
|
function watchFailedLookupLocationOfResolution(resolution) {
|
|
123937
|
-
|
|
123938
|
-
|
|
123086
|
+
ts.Debug.assert(!!resolution.refCount);
|
|
123087
|
+
var failedLookupLocations = resolution.failedLookupLocations, affectingLocations = resolution.affectingLocations;
|
|
123088
|
+
if (!failedLookupLocations.length && !affectingLocations.length)
|
|
123939
123089
|
return;
|
|
123940
|
-
if (
|
|
123090
|
+
if (failedLookupLocations.length)
|
|
123941
123091
|
resolutionsWithFailedLookups.push(resolution);
|
|
123942
|
-
|
|
123943
|
-
|
|
123944
|
-
|
|
123945
|
-
}
|
|
123946
|
-
var setAtRoot = !!resolution.setAtRoot;
|
|
123947
|
-
for (var i = resolution.watchedFailed || 0; i < failedLookupLocations.length; i++) {
|
|
123948
|
-
var failedLookupLocation = failedLookupLocations[i];
|
|
123092
|
+
var setAtRoot = false;
|
|
123093
|
+
for (var _i = 0, failedLookupLocations_1 = failedLookupLocations; _i < failedLookupLocations_1.length; _i++) {
|
|
123094
|
+
var failedLookupLocation = failedLookupLocations_1[_i];
|
|
123949
123095
|
var failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
|
|
123950
123096
|
var toWatch = getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath);
|
|
123951
123097
|
if (toWatch) {
|
|
@@ -123965,24 +123111,24 @@ var ts;
|
|
|
123965
123111
|
}
|
|
123966
123112
|
}
|
|
123967
123113
|
}
|
|
123968
|
-
if (setAtRoot
|
|
123114
|
+
if (setAtRoot) {
|
|
123969
123115
|
// This is always non recursive
|
|
123970
|
-
setDirectoryWatcher(rootDir, rootPath, /*nonRecursive*/ true);
|
|
123116
|
+
setDirectoryWatcher(rootDir, rootPath, /*nonRecursive*/ true); // TODO: GH#18217
|
|
123971
123117
|
}
|
|
123972
|
-
resolution.
|
|
123973
|
-
resolution.watchedFailed = failedLookupLocations.length;
|
|
123118
|
+
watchAffectingLocationsOfResolution(resolution, !failedLookupLocations.length);
|
|
123974
123119
|
}
|
|
123975
|
-
function watchAffectingLocationsOfResolution(resolution) {
|
|
123120
|
+
function watchAffectingLocationsOfResolution(resolution, addToResolutionsWithOnlyAffectingLocations) {
|
|
123121
|
+
ts.Debug.assert(!!resolution.refCount);
|
|
123976
123122
|
var affectingLocations = resolution.affectingLocations;
|
|
123977
|
-
if (!
|
|
123123
|
+
if (!affectingLocations.length)
|
|
123978
123124
|
return;
|
|
123979
|
-
if (
|
|
123125
|
+
if (addToResolutionsWithOnlyAffectingLocations)
|
|
123980
123126
|
resolutionsWithOnlyAffectingLocations.push(resolution);
|
|
123981
123127
|
// Watch package json
|
|
123982
|
-
for (var
|
|
123983
|
-
|
|
123128
|
+
for (var _i = 0, affectingLocations_1 = affectingLocations; _i < affectingLocations_1.length; _i++) {
|
|
123129
|
+
var affectingLocation = affectingLocations_1[_i];
|
|
123130
|
+
createFileWatcherOfAffectingLocation(affectingLocation);
|
|
123984
123131
|
}
|
|
123985
|
-
resolution.watchedAffected = affectingLocations.length;
|
|
123986
123132
|
}
|
|
123987
123133
|
function createFileWatcherOfAffectingLocation(affectingLocation) {
|
|
123988
123134
|
var path = resolutionHost.toPath(affectingLocation);
|
|
@@ -124023,6 +123169,15 @@ var ts;
|
|
|
124023
123169
|
paths.add(path);
|
|
124024
123170
|
}
|
|
124025
123171
|
}
|
|
123172
|
+
function watchFailedLookupLocationOfNonRelativeModuleResolutions(resolutions, name) {
|
|
123173
|
+
var program = resolutionHost.getCurrentProgram();
|
|
123174
|
+
if (!program || !program.getTypeChecker().tryFindAmbientModuleWithoutAugmentations(name)) {
|
|
123175
|
+
resolutions.forEach(watchFailedLookupLocationOfResolution);
|
|
123176
|
+
}
|
|
123177
|
+
else {
|
|
123178
|
+
resolutions.forEach(function (resolution) { return watchAffectingLocationsOfResolution(resolution, /*addToResolutionWithOnlyAffectingLocations*/ true); });
|
|
123179
|
+
}
|
|
123180
|
+
}
|
|
124026
123181
|
function setDirectoryWatcher(dir, dirPath, nonRecursive) {
|
|
124027
123182
|
var dirWatcher = directoryWatchesOfFailedLookups.get(dirPath);
|
|
124028
123183
|
if (dirWatcher) {
|
|
@@ -124033,28 +123188,21 @@ var ts;
|
|
|
124033
123188
|
directoryWatchesOfFailedLookups.set(dirPath, { watcher: createDirectoryWatcher(dir, dirPath, nonRecursive), refCount: 1, nonRecursive: nonRecursive });
|
|
124034
123189
|
}
|
|
124035
123190
|
}
|
|
124036
|
-
function
|
|
124037
|
-
|
|
124038
|
-
|
|
124039
|
-
if (
|
|
124040
|
-
(resolutionsToCloseWatcherOn !== null && resolutionsToCloseWatcherOn !== void 0 ? resolutionsToCloseWatcherOn : (resolutionsToCloseWatcherOn = [])).push({ resolution: resolution, getResolved: getResolutionWithResolvedFileName });
|
|
124041
|
-
}
|
|
124042
|
-
function closeWatchersOfResolution(_a) {
|
|
124043
|
-
var _b;
|
|
124044
|
-
var resolution = _a.resolution, getResolved = _a.getResolved;
|
|
124045
|
-
// If some files are using this resolution or we have already closed all watchers ignore
|
|
124046
|
-
if (((_b = resolution.files) === null || _b === void 0 ? void 0 : _b.size) || !resolution.files)
|
|
123191
|
+
function stopWatchFailedLookupLocationOfResolution(resolution, filePath, getResolutionWithResolvedFileName) {
|
|
123192
|
+
ts.unorderedRemoveItem(ts.Debug.checkDefined(resolution.files), filePath);
|
|
123193
|
+
resolution.refCount--;
|
|
123194
|
+
if (resolution.refCount) {
|
|
124047
123195
|
return;
|
|
124048
|
-
|
|
124049
|
-
var resolved =
|
|
123196
|
+
}
|
|
123197
|
+
var resolved = getResolutionWithResolvedFileName(resolution);
|
|
124050
123198
|
if (resolved && resolved.resolvedFileName) {
|
|
124051
123199
|
resolvedFileToResolution.remove(resolutionHost.toPath(resolved.resolvedFileName), resolution);
|
|
124052
123200
|
}
|
|
124053
|
-
|
|
124054
|
-
|
|
123201
|
+
var failedLookupLocations = resolution.failedLookupLocations, affectingLocations = resolution.affectingLocations;
|
|
123202
|
+
if (ts.unorderedRemoveItem(resolutionsWithFailedLookups, resolution)) {
|
|
124055
123203
|
var removeAtRoot = false;
|
|
124056
|
-
for (var
|
|
124057
|
-
var failedLookupLocation =
|
|
123204
|
+
for (var _i = 0, failedLookupLocations_2 = failedLookupLocations; _i < failedLookupLocations_2.length; _i++) {
|
|
123205
|
+
var failedLookupLocation = failedLookupLocations_2[_i];
|
|
124058
123206
|
var failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
|
|
124059
123207
|
var toWatch = getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath);
|
|
124060
123208
|
if (toWatch) {
|
|
@@ -124077,31 +123225,23 @@ var ts;
|
|
|
124077
123225
|
}
|
|
124078
123226
|
}
|
|
124079
123227
|
}
|
|
124080
|
-
ts.Debug.assert(resolution.setAtRoot === removeAtRoot);
|
|
124081
123228
|
if (removeAtRoot) {
|
|
124082
123229
|
removeDirectoryWatcher(rootPath);
|
|
124083
123230
|
}
|
|
124084
123231
|
}
|
|
124085
|
-
else if (
|
|
123232
|
+
else if (affectingLocations.length) {
|
|
124086
123233
|
ts.unorderedRemoveItem(resolutionsWithOnlyAffectingLocations, resolution);
|
|
124087
123234
|
}
|
|
124088
|
-
|
|
124089
|
-
|
|
124090
|
-
|
|
124091
|
-
|
|
124092
|
-
var watcher = fileWatchesOfAffectingLocations.get(path);
|
|
124093
|
-
watcher.refCount--;
|
|
124094
|
-
closeAffectingFileWatcher(watcher, path);
|
|
124095
|
-
}
|
|
123235
|
+
for (var _a = 0, affectingLocations_2 = affectingLocations; _a < affectingLocations_2.length; _a++) {
|
|
123236
|
+
var affectingLocation = affectingLocations_2[_a];
|
|
123237
|
+
var watcher = fileWatchesOfAffectingLocations.get(resolutionHost.toPath(affectingLocation));
|
|
123238
|
+
watcher.refCount--;
|
|
124096
123239
|
}
|
|
124097
123240
|
}
|
|
124098
123241
|
function removeDirectoryWatcher(dirPath) {
|
|
124099
123242
|
var dirWatcher = directoryWatchesOfFailedLookups.get(dirPath);
|
|
123243
|
+
// Do not close the watcher yet since it might be needed by other failed lookup locations.
|
|
124100
123244
|
dirWatcher.refCount--;
|
|
124101
|
-
if (dirWatcher.refCount === 0) {
|
|
124102
|
-
directoryWatchesOfFailedLookups.delete(dirPath);
|
|
124103
|
-
dirWatcher.watcher.close();
|
|
124104
|
-
}
|
|
124105
123245
|
}
|
|
124106
123246
|
function createDirectoryWatcher(directory, dirPath, nonRecursive) {
|
|
124107
123247
|
return resolutionHost.watchDirectoryOfFailedLookupLocation(directory, function (fileOrDirectory) {
|
|
@@ -124117,16 +123257,28 @@ var ts;
|
|
|
124117
123257
|
// Deleted file, stop watching failed lookups for all the resolutions in the file
|
|
124118
123258
|
var resolutions = cache.get(filePath);
|
|
124119
123259
|
if (resolutions) {
|
|
124120
|
-
resolutions.
|
|
123260
|
+
resolutions.forEach(function (resolution) { return stopWatchFailedLookupLocationOfResolution(resolution, filePath, getResolutionWithResolvedFileName); });
|
|
124121
123261
|
cache.delete(filePath);
|
|
124122
123262
|
}
|
|
124123
123263
|
}
|
|
123264
|
+
function removeResolutionsFromProjectReferenceRedirects(filePath) {
|
|
123265
|
+
if (!ts.fileExtensionIs(filePath, ".json" /* Json */))
|
|
123266
|
+
return;
|
|
123267
|
+
var program = resolutionHost.getCurrentProgram();
|
|
123268
|
+
if (!program)
|
|
123269
|
+
return;
|
|
123270
|
+
// If this file is input file for the referenced project, get it
|
|
123271
|
+
var resolvedProjectReference = program.getResolvedProjectReferenceByPath(filePath);
|
|
123272
|
+
if (!resolvedProjectReference)
|
|
123273
|
+
return;
|
|
123274
|
+
// filePath is for the projectReference and the containing file is from this project reference, invalidate the resolution
|
|
123275
|
+
resolvedProjectReference.commandLine.fileNames.forEach(function (f) { return removeResolutionsOfFile(resolutionHost.toPath(f)); });
|
|
123276
|
+
}
|
|
124124
123277
|
function removeResolutionsOfFile(filePath) {
|
|
124125
123278
|
removeResolutionsOfFileFromCache(resolvedModuleNames, filePath, getResolvedModule);
|
|
124126
123279
|
removeResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath, getResolvedTypeReferenceDirective);
|
|
124127
123280
|
}
|
|
124128
123281
|
function invalidateResolutions(resolutions, canInvalidate) {
|
|
124129
|
-
var _a;
|
|
124130
123282
|
if (!resolutions)
|
|
124131
123283
|
return false;
|
|
124132
123284
|
var invalidated = false;
|
|
@@ -124135,15 +123287,17 @@ var ts;
|
|
|
124135
123287
|
if (resolution.isInvalidated || !canInvalidate(resolution))
|
|
124136
123288
|
continue;
|
|
124137
123289
|
resolution.isInvalidated = invalidated = true;
|
|
124138
|
-
(_a = resolution.files)
|
|
123290
|
+
for (var _a = 0, _b = ts.Debug.checkDefined(resolution.files); _a < _b.length; _a++) {
|
|
123291
|
+
var containingFilePath = _b[_a];
|
|
124139
123292
|
(filesWithInvalidatedResolutions || (filesWithInvalidatedResolutions = new ts.Set())).add(containingFilePath);
|
|
124140
123293
|
// When its a file with inferred types resolution, invalidate type reference directive resolution
|
|
124141
123294
|
hasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames || ts.endsWith(containingFilePath, ts.inferredTypesContainingFile);
|
|
124142
|
-
}
|
|
123295
|
+
}
|
|
124143
123296
|
}
|
|
124144
123297
|
return invalidated;
|
|
124145
123298
|
}
|
|
124146
123299
|
function invalidateResolutionOfFile(filePath) {
|
|
123300
|
+
removeResolutionsOfFile(filePath);
|
|
124147
123301
|
// Resolution is invalidated if the resulting file name is same as the deleted file path
|
|
124148
123302
|
var prevHasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames;
|
|
124149
123303
|
if (invalidateResolutions(resolvedFileToResolution.get(filePath), ts.returnTrue) &&
|
|
@@ -124153,28 +123307,8 @@ var ts;
|
|
|
124153
123307
|
}
|
|
124154
123308
|
}
|
|
124155
123309
|
function setFilesWithInvalidatedNonRelativeUnresolvedImports(filesMap) {
|
|
124156
|
-
|
|
124157
|
-
|
|
124158
|
-
if (!imports.length)
|
|
124159
|
-
return;
|
|
124160
|
-
var resolvedModules = resolvedModuleNames.get(filePath);
|
|
124161
|
-
var resolvedTypeRefs = resolvedTypeReferenceDirectives.get(filePath);
|
|
124162
|
-
if (!(resolvedModules === null || resolvedModules === void 0 ? void 0 : resolvedModules.cache.size()) && !(resolvedTypeRefs === null || resolvedTypeRefs === void 0 ? void 0 : resolvedTypeRefs.cache.size()))
|
|
124163
|
-
return;
|
|
124164
|
-
imports.forEach(function (_a) {
|
|
124165
|
-
var name = _a.name, mode = _a.mode;
|
|
124166
|
-
var resolvedModule = resolvedModules === null || resolvedModules === void 0 ? void 0 : resolvedModules.cache.get(name, mode);
|
|
124167
|
-
if (resolvedModule && !resolvedModule.isInvalidated && (!resolvedModule.resolvedModule || !ts.resolutionExtensionIsTSOrJson(resolvedModule.resolvedModule.extension))) {
|
|
124168
|
-
resolvedModule.isInvalidated = true;
|
|
124169
|
-
(filesWithInvalidatedResolutions !== null && filesWithInvalidatedResolutions !== void 0 ? filesWithInvalidatedResolutions : (filesWithInvalidatedResolutions = new ts.Set())).add(filePath);
|
|
124170
|
-
}
|
|
124171
|
-
var resolvedTypeRef = resolvedTypeRefs === null || resolvedTypeRefs === void 0 ? void 0 : resolvedTypeRefs.cache.get(name, mode);
|
|
124172
|
-
if (resolvedTypeRef && !resolvedTypeRef.isInvalidated && !resolvedTypeRef.resolvedTypeReferenceDirective) {
|
|
124173
|
-
resolvedTypeRef.isInvalidated = true;
|
|
124174
|
-
(filesWithInvalidatedResolutions !== null && filesWithInvalidatedResolutions !== void 0 ? filesWithInvalidatedResolutions : (filesWithInvalidatedResolutions = new ts.Set())).add(filePath);
|
|
124175
|
-
}
|
|
124176
|
-
});
|
|
124177
|
-
});
|
|
123310
|
+
ts.Debug.assert(filesWithInvalidatedNonRelativeUnresolvedImports === filesMap || filesWithInvalidatedNonRelativeUnresolvedImports === undefined);
|
|
123311
|
+
filesWithInvalidatedNonRelativeUnresolvedImports = filesMap;
|
|
124178
123312
|
}
|
|
124179
123313
|
function scheduleInvalidateResolutionOfFailedLookupLocation(fileOrDirectoryPath, isCreatingWatchedDirectory) {
|
|
124180
123314
|
if (isCreatingWatchedDirectory) {
|
|
@@ -124246,10 +123380,9 @@ var ts;
|
|
|
124246
123380
|
});
|
|
124247
123381
|
}
|
|
124248
123382
|
function canInvalidatedFailedLookupResolutionWithAffectingLocation(resolution) {
|
|
124249
|
-
|
|
124250
|
-
return !!affectingPathChecks && !!((_a = resolution.affectingLocations) === null || _a === void 0 ? void 0 : _a.some(function (location) {
|
|
123383
|
+
return !!affectingPathChecks && resolution.affectingLocations.some(function (location) {
|
|
124251
123384
|
return affectingPathChecks.has(resolutionHost.toPath(location));
|
|
124252
|
-
})
|
|
123385
|
+
});
|
|
124253
123386
|
}
|
|
124254
123387
|
function closeTypeRootsWatch() {
|
|
124255
123388
|
ts.clearMap(typeRootsWatches, ts.closeFileWatcher);
|
|
@@ -124639,9 +123772,9 @@ var ts;
|
|
|
124639
123772
|
if (!preferSymlinks) {
|
|
124640
123773
|
// Symlinks inside ignored paths are already filtered out of the symlink cache,
|
|
124641
123774
|
// so we only need to remove them from the realpath filenames.
|
|
124642
|
-
var
|
|
124643
|
-
if (
|
|
124644
|
-
return
|
|
123775
|
+
var result_16 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
|
|
123776
|
+
if (result_16)
|
|
123777
|
+
return result_16;
|
|
124645
123778
|
}
|
|
124646
123779
|
var symlinkedDirectories = (_a = host.getSymlinkCache) === null || _a === void 0 ? void 0 : _a.call(host).getSymlinkedDirectoriesByRealpath();
|
|
124647
123780
|
var fullImportedFileName = ts.getNormalizedAbsolutePath(importedFileName, cwd);
|
|
@@ -124661,10 +123794,10 @@ var ts;
|
|
|
124661
123794
|
for (var _i = 0, symlinkDirectories_1 = symlinkDirectories; _i < symlinkDirectories_1.length; _i++) {
|
|
124662
123795
|
var symlinkDirectory = symlinkDirectories_1[_i];
|
|
124663
123796
|
var option = ts.resolvePath(symlinkDirectory, relative);
|
|
124664
|
-
var
|
|
123797
|
+
var result_17 = cb(option, target === referenceRedirect);
|
|
124665
123798
|
shouldFilterIgnoredPaths = true; // We found a non-ignored path in symlinks, so we can reject ignored-path realpaths
|
|
124666
|
-
if (
|
|
124667
|
-
return
|
|
123799
|
+
if (result_17)
|
|
123800
|
+
return result_17;
|
|
124668
123801
|
}
|
|
124669
123802
|
});
|
|
124670
123803
|
});
|
|
@@ -124730,9 +123863,9 @@ var ts;
|
|
|
124730
123863
|
};
|
|
124731
123864
|
var out_directory_1;
|
|
124732
123865
|
for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) {
|
|
124733
|
-
var
|
|
123866
|
+
var state_11 = _loop_35(directory);
|
|
124734
123867
|
directory = out_directory_1;
|
|
124735
|
-
if (
|
|
123868
|
+
if (state_11 === "break")
|
|
124736
123869
|
break;
|
|
124737
123870
|
}
|
|
124738
123871
|
if (allFileNames.size) {
|
|
@@ -125701,8 +124834,7 @@ var ts;
|
|
|
125701
124834
|
})(ts || (ts = {}));
|
|
125702
124835
|
var ts;
|
|
125703
124836
|
(function (ts) {
|
|
125704
|
-
|
|
125705
|
-
function readBuildInfoForProgram(compilerOptions, host) {
|
|
124837
|
+
function readBuilderProgram(compilerOptions, host) {
|
|
125706
124838
|
var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(compilerOptions);
|
|
125707
124839
|
if (!buildInfoPath)
|
|
125708
124840
|
return undefined;
|
|
@@ -125723,12 +124855,7 @@ var ts;
|
|
|
125723
124855
|
return undefined;
|
|
125724
124856
|
if (!buildInfo.program)
|
|
125725
124857
|
return undefined;
|
|
125726
|
-
return
|
|
125727
|
-
}
|
|
125728
|
-
ts.readBuildInfoForProgram = readBuildInfoForProgram;
|
|
125729
|
-
function readBuilderProgram(compilerOptions, host) {
|
|
125730
|
-
var result = readBuildInfoForProgram(compilerOptions, host);
|
|
125731
|
-
return result && ts.createBuilderProgramUsingProgramBuildInfo(result.buildInfo.program, result.buildInfoPath, host, compilerOptions.configFilePath);
|
|
124858
|
+
return ts.createBuilderProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host);
|
|
125732
124859
|
}
|
|
125733
124860
|
ts.readBuilderProgram = readBuilderProgram;
|
|
125734
124861
|
function createIncrementalCompilerHost(options, system) {
|
|
@@ -125867,7 +124994,7 @@ var ts;
|
|
|
125867
124994
|
}
|
|
125868
124995
|
return host.resolveModuleNames.apply(host, args);
|
|
125869
124996
|
}) :
|
|
125870
|
-
(function (moduleNames, containingFile,
|
|
124997
|
+
(function (moduleNames, containingFile, reusedNames, redirectedReference, _options, sourceFile) { return resolutionCache.resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference, sourceFile); });
|
|
125871
124998
|
compilerHost.resolveTypeReferenceDirectives = host.resolveTypeReferenceDirectives ?
|
|
125872
124999
|
(function () {
|
|
125873
125000
|
var args = [];
|
|
@@ -125876,13 +125003,7 @@ var ts;
|
|
|
125876
125003
|
}
|
|
125877
125004
|
return host.resolveTypeReferenceDirectives.apply(host, args);
|
|
125878
125005
|
}) :
|
|
125879
|
-
(function (typeDirectiveNames, containingFile, redirectedReference, _options, containingFileMode
|
|
125880
|
-
compilerHost.getModuleResolutionCache = host.resolveModuleNames ?
|
|
125881
|
-
ts.maybeBind(host, host.getModuleResolutionCache) :
|
|
125882
|
-
(function () { return resolutionCache.getModuleResolutionCache(); });
|
|
125883
|
-
compilerHost.getTypeReferenceDirectiveResolutionCache = host.resolveTypeReferenceDirectives ?
|
|
125884
|
-
ts.maybeBind(host, host.getTypeReferenceDirectiveResolutionCache) :
|
|
125885
|
-
(function () { return resolutionCache.getTypeReferenceDirectiveResolutionCache(); });
|
|
125006
|
+
(function (typeDirectiveNames, containingFile, redirectedReference, _options, containingFileMode) { return resolutionCache.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference, containingFileMode); });
|
|
125886
125007
|
var userProvidedResolution = !!host.resolveModuleNames || !!host.resolveTypeReferenceDirectives;
|
|
125887
125008
|
builderProgram = readBuilderProgram(compilerOptions, compilerHost);
|
|
125888
125009
|
synchronizeProgram();
|
|
@@ -125951,8 +125072,7 @@ var ts;
|
|
|
125951
125072
|
}
|
|
125952
125073
|
// All resolutions are invalid if user provided resolutions
|
|
125953
125074
|
var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution);
|
|
125954
|
-
|
|
125955
|
-
if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
|
|
125075
|
+
if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, fileExists, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
|
|
125956
125076
|
if (hasChangedConfigFileParsingErrors) {
|
|
125957
125077
|
if (reportFileChangeDetectedOnCreateProgram) {
|
|
125958
125078
|
reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation);
|
|
@@ -125971,11 +125091,6 @@ var ts;
|
|
|
125971
125091
|
if (host.afterProgramCreate && program !== builderProgram) {
|
|
125972
125092
|
host.afterProgramCreate(builderProgram);
|
|
125973
125093
|
}
|
|
125974
|
-
compilerHost.readFile = originalReadFile;
|
|
125975
|
-
compilerHost.fileExists = originalFileExists;
|
|
125976
|
-
compilerHost.directoryExists = originalDirectoryExists;
|
|
125977
|
-
compilerHost.createDirectory = originalCreateDirectory;
|
|
125978
|
-
compilerHost.writeFile = originalWriteFile;
|
|
125979
125094
|
return builderProgram;
|
|
125980
125095
|
}
|
|
125981
125096
|
function createNewProgram(hasInvalidatedResolution) {
|
|
@@ -125985,16 +125100,19 @@ var ts;
|
|
|
125985
125100
|
writeLog(" options: " + JSON.stringify(compilerOptions));
|
|
125986
125101
|
if (projectReferences)
|
|
125987
125102
|
writeLog(" projectReferences: " + JSON.stringify(projectReferences));
|
|
125103
|
+
var needsUpdateInTypeRootWatch = hasChangedCompilerOptions || !getCurrentProgram();
|
|
125988
125104
|
hasChangedCompilerOptions = false;
|
|
125989
125105
|
hasChangedConfigFileParsingErrors = false;
|
|
125990
125106
|
resolutionCache.startCachingPerDirectoryResolution();
|
|
125991
125107
|
compilerHost.hasInvalidatedResolution = hasInvalidatedResolution;
|
|
125992
125108
|
compilerHost.hasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames;
|
|
125993
|
-
var oldProgram = getCurrentProgram();
|
|
125994
125109
|
builderProgram = createProgram(rootFileNames, compilerOptions, compilerHost, builderProgram, configFileParsingDiagnostics, projectReferences);
|
|
125995
|
-
resolutionCache.finishCachingPerDirectoryResolution(
|
|
125110
|
+
resolutionCache.finishCachingPerDirectoryResolution();
|
|
125996
125111
|
// Update watches
|
|
125997
125112
|
ts.updateMissingFilePathsWatch(builderProgram.getProgram(), missingFilesMap || (missingFilesMap = new ts.Map()), watchMissingFilePath);
|
|
125113
|
+
if (needsUpdateInTypeRootWatch) {
|
|
125114
|
+
resolutionCache.updateTypeRootsWatch();
|
|
125115
|
+
}
|
|
125998
125116
|
if (missingFilePathsRequestedForRelease) {
|
|
125999
125117
|
// These are the paths that program creater told us as not in use any more but were missing on the disk.
|
|
126000
125118
|
// We didnt remove the entry for them from sourceFiles cache so that we dont have to do File IO,
|
|
@@ -126071,6 +125189,9 @@ var ts;
|
|
|
126071
125189
|
sourceFilesCache.set(path, false);
|
|
126072
125190
|
}
|
|
126073
125191
|
}
|
|
125192
|
+
if (sourceFile) {
|
|
125193
|
+
sourceFile.impliedNodeFormat = ts.getImpliedNodeFormatForFile(path, resolutionCache.getModuleResolutionCache().getPackageJsonInfoCache(), compilerHost, compilerHost.getCompilationSettings());
|
|
125194
|
+
}
|
|
126074
125195
|
return sourceFile;
|
|
126075
125196
|
}
|
|
126076
125197
|
return hostSourceFile.sourceFile;
|
|
@@ -126091,7 +125212,7 @@ var ts;
|
|
|
126091
125212
|
var hostSourceFile = sourceFilesCache.get(path);
|
|
126092
125213
|
return !hostSourceFile || !hostSourceFile.version ? undefined : hostSourceFile.version;
|
|
126093
125214
|
}
|
|
126094
|
-
function onReleaseOldSourceFile(oldSourceFile) {
|
|
125215
|
+
function onReleaseOldSourceFile(oldSourceFile, _oldOptions, hasSourceFileByPath) {
|
|
126095
125216
|
var hostSourceFileInfo = sourceFilesCache.get(oldSourceFile.resolvedPath);
|
|
126096
125217
|
// If this is the source file thats in the cache and new program doesnt need it,
|
|
126097
125218
|
// remove the cached entry.
|
|
@@ -126107,6 +125228,9 @@ var ts;
|
|
|
126107
125228
|
hostSourceFileInfo.fileWatcher.close();
|
|
126108
125229
|
}
|
|
126109
125230
|
sourceFilesCache.delete(oldSourceFile.resolvedPath);
|
|
125231
|
+
if (!hasSourceFileByPath) {
|
|
125232
|
+
resolutionCache.removeResolutionsOfFile(oldSourceFile.path);
|
|
125233
|
+
}
|
|
126110
125234
|
}
|
|
126111
125235
|
}
|
|
126112
125236
|
}
|
|
@@ -126363,6 +125487,7 @@ var ts;
|
|
|
126363
125487
|
var config = parsedConfigs === null || parsedConfigs === void 0 ? void 0 : parsedConfigs.get(projectPath);
|
|
126364
125488
|
if (config)
|
|
126365
125489
|
config.reloadLevel = ts.ConfigFileProgramReloadLevel.Full;
|
|
125490
|
+
resolutionCache.removeResolutionsFromProjectReferenceRedirects(projectPath);
|
|
126366
125491
|
}
|
|
126367
125492
|
scheduleProgramUpdate();
|
|
126368
125493
|
});
|
|
@@ -126376,6 +125501,7 @@ var ts;
|
|
|
126376
125501
|
var config = parsedConfigs === null || parsedConfigs === void 0 ? void 0 : parsedConfigs.get(configPath);
|
|
126377
125502
|
if (config)
|
|
126378
125503
|
config.reloadLevel = ts.ConfigFileProgramReloadLevel.Full;
|
|
125504
|
+
resolutionCache.removeResolutionsFromProjectReferenceRedirects(configPath);
|
|
126379
125505
|
scheduleProgramUpdate();
|
|
126380
125506
|
}, ts.PollingInterval.High, ((_a = commandLine.parsedCommandLine) === null || _a === void 0 ? void 0 : _a.watchOptions) || watchOptions, ts.WatchType.ConfigFileOfReferencedProject));
|
|
126381
125507
|
// Watch Wild card
|
|
@@ -126581,23 +125707,20 @@ var ts;
|
|
|
126581
125707
|
compilerHost.getParsedCommandLine = function (fileName) { return parseConfigFile(state, fileName, toResolvedConfigFilePath(state, fileName)); };
|
|
126582
125708
|
compilerHost.resolveModuleNames = ts.maybeBind(host, host.resolveModuleNames);
|
|
126583
125709
|
compilerHost.resolveTypeReferenceDirectives = ts.maybeBind(host, host.resolveTypeReferenceDirectives);
|
|
126584
|
-
compilerHost.getModuleResolutionCache = ts.maybeBind(host, host.getModuleResolutionCache);
|
|
126585
|
-
compilerHost.getTypeReferenceDirectiveResolutionCache = ts.maybeBind(host, host.getTypeReferenceDirectiveResolutionCache);
|
|
126586
125710
|
var moduleResolutionCache = !compilerHost.resolveModuleNames ? ts.createModuleResolutionCache(currentDirectory, getCanonicalFileName) : undefined;
|
|
126587
125711
|
var typeReferenceDirectiveResolutionCache = !compilerHost.resolveTypeReferenceDirectives ? ts.createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, /*options*/ undefined, moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache()) : undefined;
|
|
126588
125712
|
if (!compilerHost.resolveModuleNames) {
|
|
126589
|
-
var loader_3 = function (moduleName, resolverMode, containingFile, redirectedReference) { return ts.resolveModuleName(moduleName, containingFile, state.projectCompilerOptions, compilerHost, moduleResolutionCache, redirectedReference, resolverMode); };
|
|
126590
|
-
compilerHost.resolveModuleNames = function (moduleNames, containingFile, _reusedNames, redirectedReference, _options, containingSourceFile
|
|
126591
|
-
return ts.loadWithModeAwareCache(moduleNames, ts.Debug.checkDefined(containingSourceFile), containingFile, redirectedReference,
|
|
125713
|
+
var loader_3 = function (moduleName, resolverMode, containingFile, redirectedReference) { return ts.resolveModuleName(moduleName, containingFile, state.projectCompilerOptions, compilerHost, moduleResolutionCache, redirectedReference, resolverMode).resolvedModule; };
|
|
125714
|
+
compilerHost.resolveModuleNames = function (moduleNames, containingFile, _reusedNames, redirectedReference, _options, containingSourceFile) {
|
|
125715
|
+
return ts.loadWithModeAwareCache(ts.Debug.checkEachDefined(moduleNames), ts.Debug.checkDefined(containingSourceFile), containingFile, redirectedReference, loader_3);
|
|
126592
125716
|
};
|
|
126593
125717
|
compilerHost.getModuleResolutionCache = function () { return moduleResolutionCache; };
|
|
126594
125718
|
}
|
|
126595
125719
|
if (!compilerHost.resolveTypeReferenceDirectives) {
|
|
126596
|
-
var loader_4 = function (moduleName, containingFile, redirectedReference, containingFileMode) { return ts.resolveTypeReferenceDirective(moduleName, containingFile, state.projectCompilerOptions, compilerHost, redirectedReference, state.typeReferenceDirectiveResolutionCache, containingFileMode); };
|
|
125720
|
+
var loader_4 = function (moduleName, containingFile, redirectedReference, containingFileMode) { return ts.resolveTypeReferenceDirective(moduleName, containingFile, state.projectCompilerOptions, compilerHost, redirectedReference, state.typeReferenceDirectiveResolutionCache, containingFileMode).resolvedTypeReferenceDirective; };
|
|
126597
125721
|
compilerHost.resolveTypeReferenceDirectives = function (typeReferenceDirectiveNames, containingFile, redirectedReference, _options, containingFileMode) {
|
|
126598
|
-
return ts.loadWithTypeDirectiveCache(typeReferenceDirectiveNames, containingFile, redirectedReference, containingFileMode, loader_4);
|
|
125722
|
+
return ts.loadWithTypeDirectiveCache(ts.Debug.checkEachDefined(typeReferenceDirectiveNames), containingFile, redirectedReference, containingFileMode, loader_4);
|
|
126599
125723
|
};
|
|
126600
|
-
compilerHost.getTypeReferenceDirectiveResolutionCache = function () { return typeReferenceDirectiveResolutionCache; };
|
|
126601
125724
|
}
|
|
126602
125725
|
compilerHost.getBuildInfo = function (fileName, configFilePath) { return getBuildInfo(state, fileName, toResolvedConfigFilePath(state, configFilePath), /*modifiedTime*/ undefined); };
|
|
126603
125726
|
var _a = ts.createWatchFactory(hostWithWatch, options), watchFile = _a.watchFile, watchDirectory = _a.watchDirectory, writeLog = _a.writeLog;
|
|
@@ -127585,7 +126708,7 @@ var ts;
|
|
|
127585
126708
|
if (buildInfoTime && buildInfoTime < inputTime) {
|
|
127586
126709
|
var version_3 = void 0;
|
|
127587
126710
|
var currentVersion = void 0;
|
|
127588
|
-
if (buildInfoProgram
|
|
126711
|
+
if (buildInfoProgram) {
|
|
127589
126712
|
// Read files and see if they are same, read is anyways cached
|
|
127590
126713
|
if (!buildInfoVersionMap)
|
|
127591
126714
|
buildInfoVersionMap = ts.getBuildInfoFileVersionMap(buildInfoProgram, buildInfoPath, host);
|
|
@@ -134313,7 +133436,7 @@ var ts;
|
|
|
134313
133436
|
// check for a version redirect
|
|
134314
133437
|
var packageJsonPath = ts.findPackageJson(baseDirectory, host);
|
|
134315
133438
|
if (packageJsonPath) {
|
|
134316
|
-
var packageJson = ts.
|
|
133439
|
+
var packageJson = ts.readJson(packageJsonPath, host);
|
|
134317
133440
|
var typesVersions = packageJson.typesVersions;
|
|
134318
133441
|
if (typeof typesVersions === "object") {
|
|
134319
133442
|
var versionPaths = (_a = ts.getPackageJsonTypesVersionsPaths(typesVersions)) === null || _a === void 0 ? void 0 : _a.paths;
|
|
@@ -134492,7 +133615,7 @@ var ts;
|
|
|
134492
133615
|
var packageDirectory = ts.combinePaths(ancestor, "node_modules", packagePath);
|
|
134493
133616
|
var packageFile = ts.combinePaths(packageDirectory, "package.json");
|
|
134494
133617
|
if (ts.tryFileExists(host, packageFile)) {
|
|
134495
|
-
var packageJson = ts.
|
|
133618
|
+
var packageJson = ts.readJson(packageFile, host);
|
|
134496
133619
|
var exports_1 = packageJson.exports;
|
|
134497
133620
|
if (exports_1) {
|
|
134498
133621
|
if (typeof exports_1 !== "object" || exports_1 === null) { // eslint-disable-line no-null/no-null
|
|
@@ -134684,7 +133807,7 @@ var ts;
|
|
|
134684
133807
|
var result = [];
|
|
134685
133808
|
for (var _i = 0, _a = ts.findPackageJsons(scriptPath, host); _i < _a.length; _i++) {
|
|
134686
133809
|
var packageJson = _a[_i];
|
|
134687
|
-
var contents = ts.
|
|
133810
|
+
var contents = ts.readJson(packageJson, host); // Cast to assert that readFile is defined
|
|
134688
133811
|
// Provide completions for all non @types dependencies
|
|
134689
133812
|
for (var _b = 0, nodeModulesDependencyKeys_1 = nodeModulesDependencyKeys; _b < nodeModulesDependencyKeys_1.length; _b++) {
|
|
134690
133813
|
var key = nodeModulesDependencyKeys_1[_b];
|
|
@@ -138957,8 +138080,24 @@ var ts;
|
|
|
138957
138080
|
};
|
|
138958
138081
|
}
|
|
138959
138082
|
ts.createDocumentRegistryInternal = createDocumentRegistryInternal;
|
|
138083
|
+
function compilerOptionValueToString(value) {
|
|
138084
|
+
var _a;
|
|
138085
|
+
if (value === null || typeof value !== "object") { // eslint-disable-line no-null/no-null
|
|
138086
|
+
return "" + value;
|
|
138087
|
+
}
|
|
138088
|
+
if (ts.isArray(value)) {
|
|
138089
|
+
return "[" + ((_a = ts.map(value, function (e) { return compilerOptionValueToString(e); })) === null || _a === void 0 ? void 0 : _a.join(",")) + "]";
|
|
138090
|
+
}
|
|
138091
|
+
var str = "{";
|
|
138092
|
+
for (var key in value) {
|
|
138093
|
+
if (ts.hasProperty(value, key)) {
|
|
138094
|
+
str += key + ": " + compilerOptionValueToString(value[key]);
|
|
138095
|
+
}
|
|
138096
|
+
}
|
|
138097
|
+
return str + "}";
|
|
138098
|
+
}
|
|
138960
138099
|
function getKeyForCompilationSettings(settings) {
|
|
138961
|
-
return ts.
|
|
138100
|
+
return ts.sourceFileAffectingCompilerOptions.map(function (option) { return compilerOptionValueToString(ts.getCompilerOptionValue(settings, option)); }).join("|") + (settings.pathsBasePath ? "|" + settings.pathsBasePath : undefined);
|
|
138962
138101
|
}
|
|
138963
138102
|
})(ts || (ts = {}));
|
|
138964
138103
|
/* Code for finding imports of an exported symbol. Used only by FindAllReferences. */
|
|
@@ -139271,22 +138410,21 @@ var ts;
|
|
|
139271
138410
|
});
|
|
139272
138411
|
}
|
|
139273
138412
|
function findModuleReferences(program, sourceFiles, searchModuleSymbol) {
|
|
139274
|
-
var _a;
|
|
139275
138413
|
var refs = [];
|
|
139276
138414
|
var checker = program.getTypeChecker();
|
|
139277
138415
|
for (var _i = 0, sourceFiles_1 = sourceFiles; _i < sourceFiles_1.length; _i++) {
|
|
139278
138416
|
var referencingFile = sourceFiles_1[_i];
|
|
139279
138417
|
var searchSourceFile = searchModuleSymbol.valueDeclaration;
|
|
139280
138418
|
if ((searchSourceFile === null || searchSourceFile === void 0 ? void 0 : searchSourceFile.kind) === 305 /* SourceFile */) {
|
|
139281
|
-
for (var
|
|
139282
|
-
var ref =
|
|
138419
|
+
for (var _a = 0, _b = referencingFile.referencedFiles; _a < _b.length; _a++) {
|
|
138420
|
+
var ref = _b[_a];
|
|
139283
138421
|
if (program.getSourceFileFromReference(referencingFile, ref) === searchSourceFile) {
|
|
139284
138422
|
refs.push({ kind: "reference", referencingFile: referencingFile, ref: ref });
|
|
139285
138423
|
}
|
|
139286
138424
|
}
|
|
139287
|
-
for (var
|
|
139288
|
-
var ref =
|
|
139289
|
-
var referenced =
|
|
138425
|
+
for (var _c = 0, _d = referencingFile.typeReferenceDirectives; _c < _d.length; _c++) {
|
|
138426
|
+
var ref = _d[_c];
|
|
138427
|
+
var referenced = program.getResolvedTypeReferenceDirectives().get(ref.fileName, ref.resolutionMode || referencingFile.impliedNodeFormat);
|
|
139290
138428
|
if (referenced !== undefined && referenced.resolvedFileName === searchSourceFile.fileName) {
|
|
139291
138429
|
refs.push({ kind: "reference", referencingFile: referencingFile, ref: ref });
|
|
139292
138430
|
}
|
|
@@ -140104,7 +139242,7 @@ var ts;
|
|
|
140104
139242
|
(function (Core) {
|
|
140105
139243
|
/** Core find-all-references algorithm. Handles special cases before delegating to `getReferencedSymbolsForSymbol`. */
|
|
140106
139244
|
function getReferencedSymbolsForNode(position, node, program, sourceFiles, cancellationToken, options, sourceFilesSet) {
|
|
140107
|
-
var _a, _b
|
|
139245
|
+
var _a, _b;
|
|
140108
139246
|
if (options === void 0) { options = {}; }
|
|
140109
139247
|
if (sourceFilesSet === void 0) { sourceFilesSet = new ts.Set(sourceFiles.map(function (f) { return f.fileName; })); }
|
|
140110
139248
|
node = getAdjustedNode(node, options);
|
|
@@ -140141,7 +139279,7 @@ var ts;
|
|
|
140141
139279
|
if (!options.implementations && ts.isStringLiteralLike(node)) {
|
|
140142
139280
|
if (ts.isModuleSpecifierLike(node)) {
|
|
140143
139281
|
var fileIncludeReasons = program.getFileIncludeReasons();
|
|
140144
|
-
var referencedFileName = (
|
|
139282
|
+
var referencedFileName = (_b = (_a = node.getSourceFile().resolvedModules) === null || _a === void 0 ? void 0 : _a.get(node.text, ts.getModeForUsageLocation(node.getSourceFile(), node))) === null || _b === void 0 ? void 0 : _b.resolvedFileName;
|
|
140145
139283
|
var referencedFile = referencedFileName ? program.getSourceFile(referencedFileName) : undefined;
|
|
140146
139284
|
if (referencedFile) {
|
|
140147
139285
|
return [{ definition: { type: 4 /* String */, node: node }, references: getReferencesForNonModule(referencedFile, fileIncludeReasons, program) || ts.emptyArray }];
|
|
@@ -142335,7 +141473,7 @@ var ts;
|
|
|
142335
141473
|
// If we're at the new location (file was already renamed), need to redo module resolution starting from the old location.
|
|
142336
141474
|
// TODO:GH#18217
|
|
142337
141475
|
? getSourceFileToImportFromResolved(importLiteral, ts.resolveModuleName(importLiteral.text, oldImportFromPath, program.getCompilerOptions(), host), oldToNew, allFiles)
|
|
142338
|
-
: getSourceFileToImport(importedModuleSymbol, importLiteral, sourceFile, program, oldToNew);
|
|
141476
|
+
: getSourceFileToImport(importedModuleSymbol, importLiteral, sourceFile, program, host, oldToNew);
|
|
142339
141477
|
// Need an update if the imported file moved, or the importing file moved and was using a relative path.
|
|
142340
141478
|
return toImport !== undefined && (toImport.updated || (importingSourceFileMoved && ts.pathIsRelative(importLiteral.text)))
|
|
142341
141479
|
? ts.moduleSpecifiers.updateModuleSpecifier(program.getCompilerOptions(), sourceFile, getCanonicalFileName(newImportFromPath), toImport.newFileName, ts.createModuleSpecifierResolutionHost(program, host), importLiteral.text)
|
|
@@ -142353,8 +141491,7 @@ var ts;
|
|
|
142353
141491
|
function combinePathsSafe(pathA, pathB) {
|
|
142354
141492
|
return ts.ensurePathIsNonModuleName(combineNormal(pathA, pathB));
|
|
142355
141493
|
}
|
|
142356
|
-
function getSourceFileToImport(importedModuleSymbol, importLiteral, importingSourceFile, program, oldToNew) {
|
|
142357
|
-
var _a;
|
|
141494
|
+
function getSourceFileToImport(importedModuleSymbol, importLiteral, importingSourceFile, program, host, oldToNew) {
|
|
142358
141495
|
if (importedModuleSymbol) {
|
|
142359
141496
|
// `find` should succeed because we checked for ambient modules before calling this function.
|
|
142360
141497
|
var oldFileName = ts.find(importedModuleSymbol.declarations, ts.isSourceFile).fileName;
|
|
@@ -142363,7 +141500,9 @@ var ts;
|
|
|
142363
141500
|
}
|
|
142364
141501
|
else {
|
|
142365
141502
|
var mode = ts.getModeForUsageLocation(importingSourceFile, importLiteral);
|
|
142366
|
-
var resolved =
|
|
141503
|
+
var resolved = host.resolveModuleNames
|
|
141504
|
+
? host.getResolvedModuleWithFailedLookupLocationsFromCache && host.getResolvedModuleWithFailedLookupLocationsFromCache(importLiteral.text, importingSourceFile.fileName, mode)
|
|
141505
|
+
: program.getResolvedModuleWithFailedLookupLocationsFromCache(importLiteral.text, importingSourceFile.fileName, mode);
|
|
142367
141506
|
return getSourceFileToImportFromResolved(importLiteral, resolved, oldToNew, program.getSourceFiles());
|
|
142368
141507
|
}
|
|
142369
141508
|
}
|
|
@@ -142435,7 +141574,7 @@ var ts;
|
|
|
142435
141574
|
(function (GoToDefinition) {
|
|
142436
141575
|
function getDefinitionAtPosition(program, sourceFile, position, searchOtherFilesOnly, stopAtAlias) {
|
|
142437
141576
|
var _a;
|
|
142438
|
-
var _b
|
|
141577
|
+
var _b;
|
|
142439
141578
|
var resolvedRef = getReferenceAtPosition(sourceFile, position, program);
|
|
142440
141579
|
var fileReferenceDefinition = resolvedRef && [getDefinitionInfoForFileReference(resolvedRef.reference.fileName, resolvedRef.fileName, resolvedRef.unverified)] || ts.emptyArray;
|
|
142441
141580
|
if (resolvedRef === null || resolvedRef === void 0 ? void 0 : resolvedRef.file) {
|
|
@@ -142458,7 +141597,7 @@ var ts;
|
|
|
142458
141597
|
}
|
|
142459
141598
|
if (ts.isStaticModifier(node) && ts.isClassStaticBlockDeclaration(node.parent)) {
|
|
142460
141599
|
var classDecl = node.parent.parent;
|
|
142461
|
-
var
|
|
141600
|
+
var _c = getSymbol(classDecl, typeChecker, stopAtAlias), symbol_1 = _c.symbol, failedAliasResolution_1 = _c.failedAliasResolution;
|
|
142462
141601
|
var staticBlocks = ts.filter(classDecl.members, ts.isClassStaticBlockDeclaration);
|
|
142463
141602
|
var containerName_1 = symbol_1 ? typeChecker.symbolToString(symbol_1, classDecl) : "";
|
|
142464
141603
|
var sourceFile_1 = node.getSourceFile();
|
|
@@ -142468,7 +141607,7 @@ var ts;
|
|
|
142468
141607
|
return createDefinitionInfoFromName(typeChecker, staticBlock, "constructor" /* constructorImplementationElement */, "static {}", containerName_1, /*unverified*/ false, failedAliasResolution_1, { start: pos, length: "static".length });
|
|
142469
141608
|
});
|
|
142470
141609
|
}
|
|
142471
|
-
var
|
|
141610
|
+
var _d = getSymbol(node, typeChecker, stopAtAlias), symbol = _d.symbol, failedAliasResolution = _d.failedAliasResolution;
|
|
142472
141611
|
var fallbackNode = node;
|
|
142473
141612
|
if (searchOtherFilesOnly && failedAliasResolution) {
|
|
142474
141613
|
// We couldn't resolve the specific import, try on the module specifier.
|
|
@@ -142482,7 +141621,7 @@ var ts;
|
|
|
142482
141621
|
if (!symbol && ts.isModuleSpecifierLike(fallbackNode)) {
|
|
142483
141622
|
// We couldn't resolve the module specifier as an external module, but it could
|
|
142484
141623
|
// be that module resolution succeeded but the target was not a module.
|
|
142485
|
-
var ref = (
|
|
141624
|
+
var ref = (_b = sourceFile.resolvedModules) === null || _b === void 0 ? void 0 : _b.get(fallbackNode.text, ts.getModeForUsageLocation(sourceFile, fallbackNode));
|
|
142486
141625
|
if (ref) {
|
|
142487
141626
|
return [{
|
|
142488
141627
|
name: fallbackNode.text,
|
|
@@ -142603,7 +141742,7 @@ var ts;
|
|
|
142603
141742
|
return getDefinitionFromSymbol(typeChecker, symbol, node);
|
|
142604
141743
|
}
|
|
142605
141744
|
function getReferenceAtPosition(sourceFile, position, program) {
|
|
142606
|
-
var _a, _b
|
|
141745
|
+
var _a, _b;
|
|
142607
141746
|
var referencePath = findReferenceInPosition(sourceFile.referencedFiles, position);
|
|
142608
141747
|
if (referencePath) {
|
|
142609
141748
|
var file = program.getSourceFileFromReference(sourceFile, referencePath);
|
|
@@ -142611,7 +141750,7 @@ var ts;
|
|
|
142611
141750
|
}
|
|
142612
141751
|
var typeReferenceDirective = findReferenceInPosition(sourceFile.typeReferenceDirectives, position);
|
|
142613
141752
|
if (typeReferenceDirective) {
|
|
142614
|
-
var reference =
|
|
141753
|
+
var reference = program.getResolvedTypeReferenceDirectives().get(typeReferenceDirective.fileName, typeReferenceDirective.resolutionMode || sourceFile.impliedNodeFormat);
|
|
142615
141754
|
var file = reference && program.getSourceFile(reference.resolvedFileName); // TODO:GH#18217
|
|
142616
141755
|
return file && { reference: typeReferenceDirective, fileName: file.fileName, file: file, unverified: false };
|
|
142617
141756
|
}
|
|
@@ -142620,10 +141759,10 @@ var ts;
|
|
|
142620
141759
|
var file = program.getLibFileFromReference(libReferenceDirective);
|
|
142621
141760
|
return file && { reference: libReferenceDirective, fileName: file.fileName, file: file, unverified: false };
|
|
142622
141761
|
}
|
|
142623
|
-
if ((
|
|
141762
|
+
if ((_a = sourceFile.resolvedModules) === null || _a === void 0 ? void 0 : _a.size()) {
|
|
142624
141763
|
var node = ts.getTouchingToken(sourceFile, position);
|
|
142625
141764
|
if (ts.isModuleSpecifierLike(node) && ts.isExternalModuleNameRelative(node.text) && sourceFile.resolvedModules.has(node.text, ts.getModeForUsageLocation(sourceFile, node))) {
|
|
142626
|
-
var verifiedFileName = (
|
|
141765
|
+
var verifiedFileName = (_b = sourceFile.resolvedModules.get(node.text, ts.getModeForUsageLocation(sourceFile, node))) === null || _b === void 0 ? void 0 : _b.resolvedFileName;
|
|
142627
141766
|
var fileName = verifiedFileName || ts.resolvePath(ts.getDirectoryPath(sourceFile.fileName), node.text);
|
|
142628
141767
|
return {
|
|
142629
141768
|
file: program.getSourceFile(fileName),
|
|
@@ -168048,25 +167187,6 @@ var ts;
|
|
|
168048
167187
|
}
|
|
168049
167188
|
return sourceFile;
|
|
168050
167189
|
}
|
|
168051
|
-
function getOldProgram(options, compilerHost) {
|
|
168052
|
-
if (program)
|
|
168053
|
-
return program;
|
|
168054
|
-
if (!options.cacheResolutions)
|
|
168055
|
-
return undefined;
|
|
168056
|
-
var buildInfoResult = ts.readBuildInfoForProgram(options, compilerHost);
|
|
168057
|
-
if (!(buildInfoResult === null || buildInfoResult === void 0 ? void 0 : buildInfoResult.buildInfo.program.cacheResolutions))
|
|
168058
|
-
return undefined;
|
|
168059
|
-
var buildInfoFilePathDecoder = ts.getProgramBuildInfoFilePathDecoder(buildInfoResult.buildInfo.program.fileNames, buildInfoResult.buildInfoPath, host.getCurrentDirectory(), ts.createGetCanonicalFileName(compilerHost.useCaseSensitiveFileNames()));
|
|
168060
|
-
var compilerOptions = buildInfoResult.buildInfo.program.options ?
|
|
168061
|
-
ts.convertToOptionsWithAbsolutePaths(buildInfoResult.buildInfo.program.options, buildInfoFilePathDecoder.toAbsolutePath) :
|
|
168062
|
-
{};
|
|
168063
|
-
compilerOptions.configFilePath = options.configFilePath;
|
|
168064
|
-
return function (host) { return ts.createOldBuildInfoProgram(host, compilerOptions,
|
|
168065
|
-
/*cacheResolutions*/ undefined, {
|
|
168066
|
-
cache: buildInfoResult.buildInfo.program.cacheResolutions,
|
|
168067
|
-
getProgramBuildInfoFilePathDecoder: function () { return buildInfoFilePathDecoder; },
|
|
168068
|
-
}); };
|
|
168069
|
-
}
|
|
168070
167190
|
function synchronizeHostData() {
|
|
168071
167191
|
var _a, _b, _c;
|
|
168072
167192
|
ts.Debug.assert(languageServiceMode !== ts.LanguageServiceMode.Syntactic);
|
|
@@ -168128,8 +167248,6 @@ var ts;
|
|
|
168128
167248
|
trace: ts.maybeBind(host, host.trace),
|
|
168129
167249
|
resolveModuleNames: ts.maybeBind(host, host.resolveModuleNames),
|
|
168130
167250
|
getModuleResolutionCache: ts.maybeBind(host, host.getModuleResolutionCache),
|
|
168131
|
-
getTypeReferenceDirectiveResolutionCache: ts.maybeBind(host, host.getTypeReferenceDirectiveResolutionCache),
|
|
168132
|
-
createHash: ts.maybeBind(host, host.createHash),
|
|
168133
167251
|
resolveTypeReferenceDirectives: ts.maybeBind(host, host.resolveTypeReferenceDirectives),
|
|
168134
167252
|
useSourceOfProjectReferenceRedirect: ts.maybeBind(host, host.useSourceOfProjectReferenceRedirect),
|
|
168135
167253
|
getParsedCommandLine: getParsedCommandLine,
|
|
@@ -168170,13 +167288,14 @@ var ts;
|
|
|
168170
167288
|
// the program points to old source files that have been invalidated because of
|
|
168171
167289
|
// incremental parsing.
|
|
168172
167290
|
var documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings);
|
|
168173
|
-
|
|
167291
|
+
var options = {
|
|
168174
167292
|
rootNames: rootFileNames,
|
|
168175
167293
|
options: newSettings,
|
|
168176
167294
|
host: compilerHost,
|
|
168177
|
-
oldProgram:
|
|
167295
|
+
oldProgram: program,
|
|
168178
167296
|
projectReferences: projectReferences
|
|
168179
|
-
}
|
|
167297
|
+
};
|
|
167298
|
+
program = ts.createProgram(options);
|
|
168180
167299
|
// 'getOrCreateSourceFile' depends on caching but should be used past this point.
|
|
168181
167300
|
// After this point, the cache needs to be cleared to allow all collected snapshots to be released
|
|
168182
167301
|
compilerHost = undefined;
|
|
@@ -169277,7 +168396,6 @@ var ts;
|
|
|
169277
168396
|
getEmitOutput: getEmitOutput,
|
|
169278
168397
|
getNonBoundSourceFile: getNonBoundSourceFile,
|
|
169279
168398
|
getProgram: getProgram,
|
|
169280
|
-
getCurrentProgram: function () { return program; },
|
|
169281
168399
|
getAutoImportProvider: getAutoImportProvider,
|
|
169282
168400
|
updateIsDefinitionOfReferencedSymbols: updateIsDefinitionOfReferencedSymbols,
|
|
169283
168401
|
getApplicableRefactors: getApplicableRefactors,
|