@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
package/lib/tsserver.js
CHANGED
|
@@ -4721,15 +4721,13 @@ var ts;
|
|
|
4721
4721
|
(function (FilePreprocessingDiagnosticsKind) {
|
|
4722
4722
|
FilePreprocessingDiagnosticsKind[FilePreprocessingDiagnosticsKind["FilePreprocessingReferencedDiagnostic"] = 0] = "FilePreprocessingReferencedDiagnostic";
|
|
4723
4723
|
FilePreprocessingDiagnosticsKind[FilePreprocessingDiagnosticsKind["FilePreprocessingFileExplainingDiagnostic"] = 1] = "FilePreprocessingFileExplainingDiagnostic";
|
|
4724
|
-
FilePreprocessingDiagnosticsKind[FilePreprocessingDiagnosticsKind["ResolutionDiagnostics"] = 2] = "ResolutionDiagnostics";
|
|
4725
4724
|
})(FilePreprocessingDiagnosticsKind = ts.FilePreprocessingDiagnosticsKind || (ts.FilePreprocessingDiagnosticsKind = {}));
|
|
4726
4725
|
/* @internal */
|
|
4727
4726
|
var StructureIsReused;
|
|
4728
4727
|
(function (StructureIsReused) {
|
|
4729
4728
|
StructureIsReused[StructureIsReused["Not"] = 0] = "Not";
|
|
4730
|
-
StructureIsReused[StructureIsReused["
|
|
4731
|
-
StructureIsReused[StructureIsReused["
|
|
4732
|
-
StructureIsReused[StructureIsReused["Completely"] = 3] = "Completely";
|
|
4729
|
+
StructureIsReused[StructureIsReused["SafeModules"] = 1] = "SafeModules";
|
|
4730
|
+
StructureIsReused[StructureIsReused["Completely"] = 2] = "Completely";
|
|
4733
4731
|
})(StructureIsReused = ts.StructureIsReused || (ts.StructureIsReused = {}));
|
|
4734
4732
|
/** Return code used by getEmitOutput function to indicate status of the function */
|
|
4735
4733
|
var ExitStatus;
|
|
@@ -9664,7 +9662,6 @@ var ts;
|
|
|
9664
9662
|
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."),
|
|
9665
9663
|
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."),
|
|
9666
9664
|
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."),
|
|
9667
|
-
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."),
|
|
9668
9665
|
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'."),
|
|
9669
9666
|
one_of_Colon: diag(6900, ts.DiagnosticCategory.Message, "one_of_Colon_6900", "one of:"),
|
|
9670
9667
|
one_or_more_Colon: diag(6901, ts.DiagnosticCategory.Message, "one_or_more_Colon_6901", "one or more:"),
|
|
@@ -14406,8 +14403,7 @@ var ts;
|
|
|
14406
14403
|
}
|
|
14407
14404
|
ts.changesAffectModuleResolution = changesAffectModuleResolution;
|
|
14408
14405
|
function optionsHaveModuleResolutionChanges(oldOptions, newOptions) {
|
|
14409
|
-
return oldOptions
|
|
14410
|
-
optionsHaveChanges(oldOptions, newOptions, ts.moduleResolutionOptionDeclarations);
|
|
14406
|
+
return optionsHaveChanges(oldOptions, newOptions, ts.moduleResolutionOptionDeclarations);
|
|
14411
14407
|
}
|
|
14412
14408
|
ts.optionsHaveModuleResolutionChanges = optionsHaveModuleResolutionChanges;
|
|
14413
14409
|
function changesAffectingProgramStructure(oldOptions, newOptions) {
|
|
@@ -14485,20 +14481,21 @@ var ts;
|
|
|
14485
14481
|
}
|
|
14486
14482
|
ts.getFullWidth = getFullWidth;
|
|
14487
14483
|
function getResolvedModule(sourceFile, moduleNameText, mode) {
|
|
14488
|
-
|
|
14489
|
-
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;
|
|
14484
|
+
return sourceFile && sourceFile.resolvedModules && sourceFile.resolvedModules.get(moduleNameText, mode);
|
|
14490
14485
|
}
|
|
14491
14486
|
ts.getResolvedModule = getResolvedModule;
|
|
14492
14487
|
function setResolvedModule(sourceFile, moduleNameText, resolvedModule, mode) {
|
|
14493
|
-
|
|
14494
|
-
|
|
14488
|
+
if (!sourceFile.resolvedModules) {
|
|
14489
|
+
sourceFile.resolvedModules = ts.createModeAwareCache();
|
|
14490
|
+
}
|
|
14495
14491
|
sourceFile.resolvedModules.set(moduleNameText, mode, resolvedModule);
|
|
14496
14492
|
}
|
|
14497
14493
|
ts.setResolvedModule = setResolvedModule;
|
|
14498
|
-
function setResolvedTypeReferenceDirective(sourceFile, typeReferenceDirectiveName, resolvedTypeReferenceDirective
|
|
14499
|
-
|
|
14500
|
-
|
|
14501
|
-
|
|
14494
|
+
function setResolvedTypeReferenceDirective(sourceFile, typeReferenceDirectiveName, resolvedTypeReferenceDirective) {
|
|
14495
|
+
if (!sourceFile.resolvedTypeReferenceDirectiveNames) {
|
|
14496
|
+
sourceFile.resolvedTypeReferenceDirectiveNames = ts.createModeAwareCache();
|
|
14497
|
+
}
|
|
14498
|
+
sourceFile.resolvedTypeReferenceDirectiveNames.set(typeReferenceDirectiveName, /*mode*/ undefined, resolvedTypeReferenceDirective);
|
|
14502
14499
|
}
|
|
14503
14500
|
ts.setResolvedTypeReferenceDirective = setResolvedTypeReferenceDirective;
|
|
14504
14501
|
function projectReferenceIsEqualTo(oldRef, newRef) {
|
|
@@ -14508,15 +14505,11 @@ var ts;
|
|
|
14508
14505
|
}
|
|
14509
14506
|
ts.projectReferenceIsEqualTo = projectReferenceIsEqualTo;
|
|
14510
14507
|
function moduleResolutionIsEqualTo(oldResolution, newResolution) {
|
|
14511
|
-
return oldResolution === newResolution
|
|
14512
|
-
oldResolution.
|
|
14513
|
-
|
|
14514
|
-
|
|
14515
|
-
|
|
14516
|
-
oldResolution.resolvedModule.extension === newResolution.resolvedModule.extension &&
|
|
14517
|
-
oldResolution.resolvedModule.resolvedFileName === newResolution.resolvedModule.resolvedFileName &&
|
|
14518
|
-
oldResolution.resolvedModule.originalPath === newResolution.resolvedModule.originalPath &&
|
|
14519
|
-
packageIdIsEqual(oldResolution.resolvedModule.packageId, newResolution.resolvedModule.packageId);
|
|
14508
|
+
return oldResolution.isExternalLibraryImport === newResolution.isExternalLibraryImport &&
|
|
14509
|
+
oldResolution.extension === newResolution.extension &&
|
|
14510
|
+
oldResolution.resolvedFileName === newResolution.resolvedFileName &&
|
|
14511
|
+
oldResolution.originalPath === newResolution.originalPath &&
|
|
14512
|
+
packageIdIsEqual(oldResolution.packageId, newResolution.packageId);
|
|
14520
14513
|
}
|
|
14521
14514
|
ts.moduleResolutionIsEqualTo = moduleResolutionIsEqualTo;
|
|
14522
14515
|
function packageIdIsEqual(a, b) {
|
|
@@ -14532,13 +14525,9 @@ var ts;
|
|
|
14532
14525
|
}
|
|
14533
14526
|
ts.packageIdToString = packageIdToString;
|
|
14534
14527
|
function typeDirectiveIsEqualTo(oldResolution, newResolution) {
|
|
14535
|
-
return oldResolution === newResolution
|
|
14536
|
-
oldResolution.
|
|
14537
|
-
|
|
14538
|
-
!!newResolution.resolvedTypeReferenceDirective &&
|
|
14539
|
-
oldResolution.resolvedTypeReferenceDirective.resolvedFileName === newResolution.resolvedTypeReferenceDirective.resolvedFileName &&
|
|
14540
|
-
!!oldResolution.resolvedTypeReferenceDirective.primary === !!newResolution.resolvedTypeReferenceDirective.primary &&
|
|
14541
|
-
oldResolution.resolvedTypeReferenceDirective.originalPath === newResolution.resolvedTypeReferenceDirective.originalPath;
|
|
14528
|
+
return oldResolution.resolvedFileName === newResolution.resolvedFileName
|
|
14529
|
+
&& oldResolution.primary === newResolution.primary
|
|
14530
|
+
&& oldResolution.originalPath === newResolution.originalPath;
|
|
14542
14531
|
}
|
|
14543
14532
|
ts.typeDirectiveIsEqualTo = typeDirectiveIsEqualTo;
|
|
14544
14533
|
function hasChangesInResolutions(names, newResolutions, oldResolutions, oldSourceFile, comparer) {
|
|
@@ -19395,20 +19384,23 @@ var ts;
|
|
|
19395
19384
|
return getStringFromExpandedCharCodes(expandedCharCodes);
|
|
19396
19385
|
}
|
|
19397
19386
|
ts.base64decode = base64decode;
|
|
19398
|
-
function
|
|
19399
|
-
|
|
19400
|
-
|
|
19401
|
-
|
|
19402
|
-
|
|
19403
|
-
|
|
19404
|
-
|
|
19405
|
-
|
|
19406
|
-
|
|
19387
|
+
function readJson(path, host) {
|
|
19388
|
+
try {
|
|
19389
|
+
var jsonText = host.readFile(path);
|
|
19390
|
+
if (!jsonText)
|
|
19391
|
+
return {};
|
|
19392
|
+
var result = ts.parseConfigFileTextToJson(path, jsonText);
|
|
19393
|
+
if (result.error) {
|
|
19394
|
+
return {};
|
|
19395
|
+
}
|
|
19396
|
+
return result.config;
|
|
19397
|
+
}
|
|
19398
|
+
catch (e) {
|
|
19399
|
+
// gracefully handle if readFile fails or returns not JSON
|
|
19407
19400
|
return {};
|
|
19408
19401
|
}
|
|
19409
|
-
return result.config;
|
|
19410
19402
|
}
|
|
19411
|
-
ts.
|
|
19403
|
+
ts.readJson = readJson;
|
|
19412
19404
|
function directoryProbablyExists(directoryName, host) {
|
|
19413
19405
|
// if host does not support 'directoryExists' assume that directory will exist
|
|
19414
19406
|
return !host.directoryExists || host.directoryExists(directoryName);
|
|
@@ -20490,15 +20482,14 @@ var ts;
|
|
|
20490
20482
|
},
|
|
20491
20483
|
setSymlinksFromResolutions: function (files, typeReferenceDirectives) {
|
|
20492
20484
|
var _this = this;
|
|
20493
|
-
var _a
|
|
20485
|
+
var _a;
|
|
20494
20486
|
ts.Debug.assert(!hasProcessedResolutions);
|
|
20495
20487
|
hasProcessedResolutions = true;
|
|
20496
20488
|
for (var _i = 0, files_1 = files; _i < files_1.length; _i++) {
|
|
20497
20489
|
var file = files_1[_i];
|
|
20498
|
-
(_a = file.resolvedModules) === null || _a === void 0 ? void 0 : _a.forEach(function (resolution) { return processResolution(_this, resolution
|
|
20499
|
-
(_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); });
|
|
20490
|
+
(_a = file.resolvedModules) === null || _a === void 0 ? void 0 : _a.forEach(function (resolution) { return processResolution(_this, resolution); });
|
|
20500
20491
|
}
|
|
20501
|
-
typeReferenceDirectives.forEach(function (resolution) { return processResolution(_this, resolution
|
|
20492
|
+
typeReferenceDirectives === null || typeReferenceDirectives === void 0 ? void 0 : typeReferenceDirectives.forEach(function (resolution) { return processResolution(_this, resolution); });
|
|
20502
20493
|
},
|
|
20503
20494
|
hasProcessedResolutions: function () { return hasProcessedResolutions; },
|
|
20504
20495
|
};
|
|
@@ -39758,17 +39749,6 @@ var ts;
|
|
|
39758
39749
|
transpileOptionValue: undefined,
|
|
39759
39750
|
defaultValueDescription: ts.Diagnostics.false_unless_composite_is_set
|
|
39760
39751
|
},
|
|
39761
|
-
{
|
|
39762
|
-
name: "cacheResolutions",
|
|
39763
|
-
type: "boolean",
|
|
39764
|
-
category: ts.Diagnostics.Projects,
|
|
39765
|
-
description: ts.Diagnostics.Save_resolutions_into_tsbuildinfo_file_and_use_them_for_incremental_compilation,
|
|
39766
|
-
affectsModuleResolution: true,
|
|
39767
|
-
affectsMultiFileEmitBuildInfo: true,
|
|
39768
|
-
affectsBundleEmitBuildInfo: true,
|
|
39769
|
-
transpileOptionValue: undefined,
|
|
39770
|
-
defaultValueDescription: false,
|
|
39771
|
-
},
|
|
39772
39752
|
{
|
|
39773
39753
|
name: "assumeChangesOnlyAffectDirectDependencies",
|
|
39774
39754
|
type: "boolean",
|
|
@@ -41866,9 +41846,6 @@ var ts;
|
|
|
41866
41846
|
if (result.configFilePath) {
|
|
41867
41847
|
result.configFilePath = toAbsolutePath(result.configFilePath);
|
|
41868
41848
|
}
|
|
41869
|
-
if (result.pathsBasePath) {
|
|
41870
|
-
result.pathsBasePath = toAbsolutePath(result.pathsBasePath);
|
|
41871
|
-
}
|
|
41872
41849
|
return result;
|
|
41873
41850
|
}
|
|
41874
41851
|
ts.convertToOptionsWithAbsolutePaths = convertToOptionsWithAbsolutePaths;
|
|
@@ -42854,36 +42831,20 @@ var ts;
|
|
|
42854
42831
|
ts.Debug.assert(ts.extensionIsTS(resolved.extension));
|
|
42855
42832
|
return { fileName: resolved.path, packageId: resolved.packageId };
|
|
42856
42833
|
}
|
|
42857
|
-
function createResolvedModuleWithFailedLookupLocations(
|
|
42858
|
-
var _a;
|
|
42859
|
-
var _b;
|
|
42834
|
+
function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, resultFromCache) {
|
|
42835
|
+
var _a, _b;
|
|
42860
42836
|
if (resultFromCache) {
|
|
42861
|
-
|
|
42862
|
-
|
|
42863
|
-
resultFromCache.affectingLocations = updateResolutionField(resultFromCache.affectingLocations, affectingLocations);
|
|
42864
|
-
resultFromCache.resolutionDiagnostics = updateResolutionField(resultFromCache.resolutionDiagnostics, diagnostics);
|
|
42837
|
+
(_a = resultFromCache.failedLookupLocations).push.apply(_a, failedLookupLocations);
|
|
42838
|
+
(_b = resultFromCache.affectingLocations).push.apply(_b, affectingLocations);
|
|
42865
42839
|
return resultFromCache;
|
|
42866
42840
|
}
|
|
42867
42841
|
return {
|
|
42868
42842
|
resolvedModule: resolved && { resolvedFileName: resolved.path, originalPath: resolved.originalPath === true ? undefined : resolved.originalPath, extension: resolved.extension, isExternalLibraryImport: isExternalLibraryImport, packageId: resolved.packageId },
|
|
42869
|
-
failedLookupLocations:
|
|
42870
|
-
affectingLocations:
|
|
42871
|
-
resolutionDiagnostics:
|
|
42843
|
+
failedLookupLocations: failedLookupLocations,
|
|
42844
|
+
affectingLocations: affectingLocations,
|
|
42845
|
+
resolutionDiagnostics: diagnostics,
|
|
42872
42846
|
};
|
|
42873
42847
|
}
|
|
42874
|
-
function initializeResolutionField(value) {
|
|
42875
|
-
return value.length ? value : undefined;
|
|
42876
|
-
}
|
|
42877
|
-
/*@internal*/
|
|
42878
|
-
function updateResolutionField(to, value) {
|
|
42879
|
-
if (!(value === null || value === void 0 ? void 0 : value.length))
|
|
42880
|
-
return to;
|
|
42881
|
-
if (!(to === null || to === void 0 ? void 0 : to.length))
|
|
42882
|
-
return value;
|
|
42883
|
-
to.push.apply(to, value);
|
|
42884
|
-
return to;
|
|
42885
|
-
}
|
|
42886
|
-
ts.updateResolutionField = updateResolutionField;
|
|
42887
42848
|
function readPackageJsonField(jsonContent, fieldName, typeOfTag, state) {
|
|
42888
42849
|
if (!ts.hasProperty(jsonContent, fieldName)) {
|
|
42889
42850
|
if (state.traceEnabled) {
|
|
@@ -43035,7 +42996,8 @@ var ts;
|
|
|
43035
42996
|
options = redirectedReference.commandLine.options;
|
|
43036
42997
|
}
|
|
43037
42998
|
var containingDirectory = containingFile ? ts.getDirectoryPath(containingFile) : undefined;
|
|
43038
|
-
var
|
|
42999
|
+
var perFolderCache = containingDirectory ? cache && cache.getOrCreateCacheForDirectory(containingDirectory, redirectedReference) : undefined;
|
|
43000
|
+
var result = perFolderCache && perFolderCache.get(typeReferenceDirectiveName, /*mode*/ resolutionMode);
|
|
43039
43001
|
if (result) {
|
|
43040
43002
|
if (traceEnabled) {
|
|
43041
43003
|
trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_1, typeReferenceDirectiveName, containingFile);
|
|
@@ -43093,7 +43055,7 @@ var ts;
|
|
|
43093
43055
|
features: features,
|
|
43094
43056
|
conditions: conditions,
|
|
43095
43057
|
requestContainingDirectory: containingDirectory,
|
|
43096
|
-
|
|
43058
|
+
reportDiagnostic: function (diag) { return void diagnostics.push(diag); },
|
|
43097
43059
|
};
|
|
43098
43060
|
var resolved = primaryLookup();
|
|
43099
43061
|
var primary = true;
|
|
@@ -43113,15 +43075,8 @@ var ts;
|
|
|
43113
43075
|
isExternalLibraryImport: pathContainsNodeModules(fileName),
|
|
43114
43076
|
};
|
|
43115
43077
|
}
|
|
43116
|
-
result = {
|
|
43117
|
-
|
|
43118
|
-
failedLookupLocations: !options.cacheResolutions || !(resolvedTypeReferenceDirective === null || resolvedTypeReferenceDirective === void 0 ? void 0 : resolvedTypeReferenceDirective.resolvedFileName) ? failedLookupLocations : ts.emptyArray,
|
|
43119
|
-
affectingLocations: initializeResolutionField(affectingLocations),
|
|
43120
|
-
resolutionDiagnostics: initializeResolutionField(diagnostics),
|
|
43121
|
-
};
|
|
43122
|
-
if (containingDirectory && cache) {
|
|
43123
|
-
cache.getOrCreateCacheForDirectory(containingDirectory, redirectedReference).set(typeReferenceDirectiveName, /*mode*/ resolutionMode, result);
|
|
43124
|
-
}
|
|
43078
|
+
result = { resolvedTypeReferenceDirective: resolvedTypeReferenceDirective, failedLookupLocations: failedLookupLocations, affectingLocations: affectingLocations, resolutionDiagnostics: diagnostics };
|
|
43079
|
+
perFolderCache === null || perFolderCache === void 0 ? void 0 : perFolderCache.set(typeReferenceDirectiveName, /*mode*/ resolutionMode, result);
|
|
43125
43080
|
if (traceEnabled)
|
|
43126
43081
|
traceResult(result);
|
|
43127
43082
|
return result;
|
|
@@ -43131,10 +43086,10 @@ var ts;
|
|
|
43131
43086
|
trace(host, ts.Diagnostics.Type_reference_directive_0_was_not_resolved, typeReferenceDirectiveName);
|
|
43132
43087
|
}
|
|
43133
43088
|
else if (result.resolvedTypeReferenceDirective.packageId) {
|
|
43134
|
-
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),
|
|
43089
|
+
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);
|
|
43135
43090
|
}
|
|
43136
43091
|
else {
|
|
43137
|
-
trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2, typeReferenceDirectiveName, result.resolvedTypeReferenceDirective.resolvedFileName,
|
|
43092
|
+
trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2, typeReferenceDirectiveName, result.resolvedTypeReferenceDirective.resolvedFileName, result.resolvedTypeReferenceDirective.primary);
|
|
43138
43093
|
}
|
|
43139
43094
|
}
|
|
43140
43095
|
function primaryLookup() {
|
|
@@ -43233,7 +43188,7 @@ var ts;
|
|
|
43233
43188
|
// `types-publisher` sometimes creates packages with `"typings": null` for packages that don't provide their own types.
|
|
43234
43189
|
// See `createNotNeededPackageJSON` in the types-publisher` repo.
|
|
43235
43190
|
// eslint-disable-next-line no-null/no-null
|
|
43236
|
-
var isNotNeededPackage = host.fileExists(packageJsonPath) && ts.
|
|
43191
|
+
var isNotNeededPackage = host.fileExists(packageJsonPath) && ts.readJson(packageJsonPath, host).typings === null;
|
|
43237
43192
|
if (!isNotNeededPackage) {
|
|
43238
43193
|
var baseFileName = ts.getBaseFileName(normalized);
|
|
43239
43194
|
// At this stage, skip results with leading dot.
|
|
@@ -43250,143 +43205,49 @@ var ts;
|
|
|
43250
43205
|
return result;
|
|
43251
43206
|
}
|
|
43252
43207
|
ts.getAutomaticTypeDirectiveNames = getAutomaticTypeDirectiveNames;
|
|
43253
|
-
function compilerOptionValueToString(value) {
|
|
43254
|
-
var _a;
|
|
43255
|
-
if (value === null || typeof value !== "object") { // eslint-disable-line no-null/no-null
|
|
43256
|
-
return "" + value;
|
|
43257
|
-
}
|
|
43258
|
-
if (ts.isArray(value)) {
|
|
43259
|
-
return "[" + ((_a = ts.map(value, function (e) { return compilerOptionValueToString(e); })) === null || _a === void 0 ? void 0 : _a.join(",")) + "]";
|
|
43260
|
-
}
|
|
43261
|
-
var str = "{";
|
|
43262
|
-
for (var key in value) {
|
|
43263
|
-
if (ts.hasProperty(value, key)) {
|
|
43264
|
-
str += key + ": " + compilerOptionValueToString(value[key]);
|
|
43265
|
-
}
|
|
43266
|
-
}
|
|
43267
|
-
return str + "}";
|
|
43268
|
-
}
|
|
43269
|
-
/*@internal*/
|
|
43270
|
-
function getKeyForCompilationSettings(settings, options) {
|
|
43271
|
-
return options.map(function (option) { return compilerOptionValueToString(ts.getCompilerOptionValue(settings, option)); }).join("|") + ("|" + settings.pathsBasePath);
|
|
43272
|
-
}
|
|
43273
|
-
ts.getKeyForCompilationSettings = getKeyForCompilationSettings;
|
|
43274
|
-
/*@internal*/
|
|
43275
|
-
function getRedirectsCacheKey(options) {
|
|
43276
|
-
return getKeyForCompilationSettings(options, ts.moduleResolutionOptionDeclarations);
|
|
43277
|
-
}
|
|
43278
|
-
ts.getRedirectsCacheKey = getRedirectsCacheKey;
|
|
43279
43208
|
/*@internal*/
|
|
43280
|
-
function createCacheWithRedirects(
|
|
43281
|
-
var ownMap;
|
|
43282
|
-
var ownKey;
|
|
43283
|
-
var redirectsKeyToCache = new ts.Map();
|
|
43209
|
+
function createCacheWithRedirects(options) {
|
|
43210
|
+
var ownMap = new ts.Map();
|
|
43284
43211
|
var redirectsMap = new ts.Map();
|
|
43285
43212
|
return {
|
|
43286
43213
|
getOwnMap: getOwnMap,
|
|
43287
|
-
|
|
43288
|
-
createMapForCompilerOptions: createMapForCompilerOptions,
|
|
43289
|
-
getMapOfCacheRedirects: getMapOfCacheRedirects,
|
|
43214
|
+
redirectsMap: redirectsMap,
|
|
43290
43215
|
getOrCreateMapOfCacheRedirects: getOrCreateMapOfCacheRedirects,
|
|
43291
43216
|
clear: clear,
|
|
43292
|
-
|
|
43293
|
-
|
|
43217
|
+
setOwnOptions: setOwnOptions,
|
|
43218
|
+
setOwnMap: setOwnMap
|
|
43294
43219
|
};
|
|
43295
|
-
function
|
|
43296
|
-
|
|
43297
|
-
if (ownKey && !redirectsKeyToCache.has(ownKey))
|
|
43298
|
-
redirectsKeyToCache.set(ownKey, { map: ownMap !== null && ownMap !== void 0 ? ownMap : (ownMap = new ts.Map()), options: ownOptions });
|
|
43299
|
-
}
|
|
43300
|
-
function createMapForCompilerOptions(options, optionsKey) {
|
|
43301
|
-
if (options === ownOptions)
|
|
43302
|
-
return ownMap !== null && ownMap !== void 0 ? ownMap : (ownMap = new ts.Map());
|
|
43303
|
-
return getOrCreateRedirectMapAndKey(options, /*path*/ undefined, optionsKey);
|
|
43220
|
+
function getOwnMap() {
|
|
43221
|
+
return ownMap;
|
|
43304
43222
|
}
|
|
43305
|
-
function
|
|
43306
|
-
|
|
43307
|
-
if (path || options.configFile) {
|
|
43308
|
-
var redirects = redirectsMap.get(path || options.configFile.path);
|
|
43309
|
-
if (redirects)
|
|
43310
|
-
return redirects;
|
|
43311
|
-
}
|
|
43312
|
-
var key = optionsKey || getRedirectsCacheKey(options);
|
|
43313
|
-
var map = (_a = redirectsKeyToCache.get(key)) === null || _a === void 0 ? void 0 : _a.map;
|
|
43314
|
-
if (!map) {
|
|
43315
|
-
ensureOwnKeyCached();
|
|
43316
|
-
if (ownKey === key) {
|
|
43317
|
-
map = ownMap;
|
|
43318
|
-
}
|
|
43319
|
-
else {
|
|
43320
|
-
redirectsKeyToCache.set(key, { map: map = new ts.Map(), options: options });
|
|
43321
|
-
}
|
|
43322
|
-
}
|
|
43323
|
-
if (path || options.configFile)
|
|
43324
|
-
redirectsMap.set(path || options.configFile.path, map);
|
|
43325
|
-
return map;
|
|
43223
|
+
function setOwnOptions(newOptions) {
|
|
43224
|
+
options = newOptions;
|
|
43326
43225
|
}
|
|
43327
|
-
function
|
|
43328
|
-
|
|
43329
|
-
}
|
|
43330
|
-
function update(newOwnOptions) {
|
|
43331
|
-
// Store existing options:
|
|
43332
|
-
if (ownMap && (ownOptions === null || ownOptions === void 0 ? void 0 : ownOptions.configFile)) {
|
|
43333
|
-
ensureOwnKeyCached();
|
|
43334
|
-
if (!redirectsMap.has(ownOptions.configFile.path)) {
|
|
43335
|
-
redirectsMap.set(ownOptions.configFile.path, ownMap);
|
|
43336
|
-
}
|
|
43337
|
-
}
|
|
43338
|
-
// If this is already present use it
|
|
43339
|
-
if (newOwnOptions.configFile) {
|
|
43340
|
-
var existing_1 = redirectsMap.get(newOwnOptions.configFile.path);
|
|
43341
|
-
if (existing_1) {
|
|
43342
|
-
ownMap = existing_1;
|
|
43343
|
-
ownOptions = newOwnOptions;
|
|
43344
|
-
return;
|
|
43345
|
-
}
|
|
43346
|
-
}
|
|
43347
|
-
var key = getRedirectsCacheKey(newOwnOptions);
|
|
43348
|
-
var existing = redirectsKeyToCache.get(key);
|
|
43349
|
-
ownMap = (existing === null || existing === void 0 ? void 0 : existing.map) || new ts.Map();
|
|
43350
|
-
ownKey = key;
|
|
43351
|
-
ownOptions = newOwnOptions;
|
|
43352
|
-
if (newOwnOptions.configFile)
|
|
43353
|
-
redirectsMap.set(newOwnOptions.configFile.path, ownMap);
|
|
43226
|
+
function setOwnMap(newOwnMap) {
|
|
43227
|
+
ownMap = newOwnMap;
|
|
43354
43228
|
}
|
|
43355
|
-
function
|
|
43356
|
-
if (!redirectedReference)
|
|
43357
|
-
return ownMap;
|
|
43358
|
-
var directResult = redirectsMap.get(redirectedReference.sourceFile.path);
|
|
43359
|
-
if (directResult)
|
|
43360
|
-
return directResult;
|
|
43361
|
-
var key = getRedirectsCacheKey(redirectedReference.commandLine.options);
|
|
43362
|
-
var fromKey = redirectsKeyToCache.get(key);
|
|
43363
|
-
if (fromKey) {
|
|
43364
|
-
redirectsMap.set(redirectedReference.sourceFile.path, fromKey.map);
|
|
43365
|
-
return fromKey.map;
|
|
43366
|
-
}
|
|
43367
|
-
if (ownMap)
|
|
43368
|
-
ensureOwnKeyCached();
|
|
43369
|
-
if (ownKey === key) {
|
|
43370
|
-
redirectsMap.set(redirectedReference.sourceFile.path, ownMap);
|
|
43229
|
+
function getOrCreateMapOfCacheRedirects(redirectedReference) {
|
|
43230
|
+
if (!redirectedReference) {
|
|
43371
43231
|
return ownMap;
|
|
43372
43232
|
}
|
|
43373
|
-
|
|
43374
|
-
|
|
43375
|
-
|
|
43376
|
-
|
|
43377
|
-
|
|
43378
|
-
|
|
43233
|
+
var path = redirectedReference.sourceFile.path;
|
|
43234
|
+
var redirects = redirectsMap.get(path);
|
|
43235
|
+
if (!redirects) {
|
|
43236
|
+
// Reuse map if redirected reference map uses same resolution
|
|
43237
|
+
redirects = !options || ts.optionsHaveModuleResolutionChanges(options, redirectedReference.commandLine.options) ? new ts.Map() : ownMap;
|
|
43238
|
+
redirectsMap.set(path, redirects);
|
|
43239
|
+
}
|
|
43240
|
+
return redirects;
|
|
43379
43241
|
}
|
|
43380
43242
|
function clear() {
|
|
43381
|
-
|
|
43382
|
-
ownMap = undefined;
|
|
43243
|
+
ownMap.clear();
|
|
43383
43244
|
redirectsMap.clear();
|
|
43384
|
-
redirectsKeyToCache.clear();
|
|
43385
43245
|
}
|
|
43386
43246
|
}
|
|
43387
43247
|
ts.createCacheWithRedirects = createCacheWithRedirects;
|
|
43388
|
-
function createPackageJsonInfoCache(currentDirectory, getCanonicalFileName
|
|
43389
|
-
|
|
43248
|
+
function createPackageJsonInfoCache(currentDirectory, getCanonicalFileName) {
|
|
43249
|
+
var cache;
|
|
43250
|
+
return { getPackageJsonInfo: getPackageJsonInfo, setPackageJsonInfo: setPackageJsonInfo, clear: clear, entries: entries };
|
|
43390
43251
|
function getPackageJsonInfo(packageJsonPath) {
|
|
43391
43252
|
return cache === null || cache === void 0 ? void 0 : cache.get(ts.toPath(packageJsonPath, currentDirectory, getCanonicalFileName));
|
|
43392
43253
|
}
|
|
@@ -43400,9 +43261,6 @@ var ts;
|
|
|
43400
43261
|
var iter = cache === null || cache === void 0 ? void 0 : cache.entries();
|
|
43401
43262
|
return iter ? ts.arrayFrom(iter) : [];
|
|
43402
43263
|
}
|
|
43403
|
-
function clone() {
|
|
43404
|
-
return createPackageJsonInfoCache(currentDirectory, getCanonicalFileName, cache && new ts.Map(cache));
|
|
43405
|
-
}
|
|
43406
43264
|
}
|
|
43407
43265
|
function getOrCreateCache(cacheWithRedirects, redirectedReference, key, create) {
|
|
43408
43266
|
var cache = cacheWithRedirects.getOrCreateMapOfCacheRedirects(redirectedReference);
|
|
@@ -43413,43 +43271,47 @@ var ts;
|
|
|
43413
43271
|
}
|
|
43414
43272
|
return result;
|
|
43415
43273
|
}
|
|
43274
|
+
function updateRedirectsMap(options, directoryToModuleNameMap, moduleNameToDirectoryMap) {
|
|
43275
|
+
if (!options.configFile)
|
|
43276
|
+
return;
|
|
43277
|
+
if (directoryToModuleNameMap.redirectsMap.size === 0) {
|
|
43278
|
+
// The own map will be for projectCompilerOptions
|
|
43279
|
+
ts.Debug.assert(!moduleNameToDirectoryMap || moduleNameToDirectoryMap.redirectsMap.size === 0);
|
|
43280
|
+
ts.Debug.assert(directoryToModuleNameMap.getOwnMap().size === 0);
|
|
43281
|
+
ts.Debug.assert(!moduleNameToDirectoryMap || moduleNameToDirectoryMap.getOwnMap().size === 0);
|
|
43282
|
+
directoryToModuleNameMap.redirectsMap.set(options.configFile.path, directoryToModuleNameMap.getOwnMap());
|
|
43283
|
+
moduleNameToDirectoryMap === null || moduleNameToDirectoryMap === void 0 ? void 0 : moduleNameToDirectoryMap.redirectsMap.set(options.configFile.path, moduleNameToDirectoryMap.getOwnMap());
|
|
43284
|
+
}
|
|
43285
|
+
else {
|
|
43286
|
+
// Set correct own map
|
|
43287
|
+
ts.Debug.assert(!moduleNameToDirectoryMap || moduleNameToDirectoryMap.redirectsMap.size > 0);
|
|
43288
|
+
var ref = {
|
|
43289
|
+
sourceFile: options.configFile,
|
|
43290
|
+
commandLine: { options: options }
|
|
43291
|
+
};
|
|
43292
|
+
directoryToModuleNameMap.setOwnMap(directoryToModuleNameMap.getOrCreateMapOfCacheRedirects(ref));
|
|
43293
|
+
moduleNameToDirectoryMap === null || moduleNameToDirectoryMap === void 0 ? void 0 : moduleNameToDirectoryMap.setOwnMap(moduleNameToDirectoryMap.getOrCreateMapOfCacheRedirects(ref));
|
|
43294
|
+
}
|
|
43295
|
+
directoryToModuleNameMap.setOwnOptions(options);
|
|
43296
|
+
moduleNameToDirectoryMap === null || moduleNameToDirectoryMap === void 0 ? void 0 : moduleNameToDirectoryMap.setOwnOptions(options);
|
|
43297
|
+
}
|
|
43416
43298
|
function createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, directoryToModuleNameMap) {
|
|
43417
|
-
var oldResolutionCache;
|
|
43418
43299
|
return {
|
|
43419
|
-
getFromCache: getFromCache,
|
|
43420
43300
|
getOrCreateCacheForDirectory: getOrCreateCacheForDirectory,
|
|
43421
43301
|
clear: clear,
|
|
43422
43302
|
update: update,
|
|
43423
|
-
setOldResolutionCache: function (cache) { return oldResolutionCache = cache; }
|
|
43424
43303
|
};
|
|
43425
43304
|
function clear() {
|
|
43426
|
-
oldResolutionCache = undefined;
|
|
43427
43305
|
directoryToModuleNameMap.clear();
|
|
43428
43306
|
}
|
|
43429
43307
|
function update(options) {
|
|
43430
|
-
|
|
43308
|
+
updateRedirectsMap(options, directoryToModuleNameMap);
|
|
43431
43309
|
}
|
|
43432
43310
|
function getOrCreateCacheForDirectory(directoryName, redirectedReference) {
|
|
43433
43311
|
var path = ts.toPath(directoryName, currentDirectory, getCanonicalFileName);
|
|
43434
|
-
return getOrCreateCache(directoryToModuleNameMap, redirectedReference, path, createModeAwareCache);
|
|
43435
|
-
}
|
|
43436
|
-
function getFromCache(directoryName, name, mode, redirectedReference) {
|
|
43437
|
-
var _a, _b;
|
|
43438
|
-
var path = ts.toPath(directoryName, currentDirectory, getCanonicalFileName);
|
|
43439
|
-
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);
|
|
43440
|
-
if (result)
|
|
43441
|
-
return result;
|
|
43442
|
-
var resultFromOld = oldResolutionCache === null || oldResolutionCache === void 0 ? void 0 : oldResolutionCache.getResolved(path, name, mode, redirectedReference);
|
|
43443
|
-
if (resultFromOld)
|
|
43444
|
-
getOrCreateCacheForDirectory(directoryName, redirectedReference).set(name, mode, resultFromOld);
|
|
43445
|
-
return resultFromOld;
|
|
43312
|
+
return getOrCreateCache(directoryToModuleNameMap, redirectedReference, path, function () { return createModeAwareCache(); });
|
|
43446
43313
|
}
|
|
43447
43314
|
}
|
|
43448
|
-
/*@internal*/
|
|
43449
|
-
function getModeAwareCacheKey(specifier, mode) {
|
|
43450
|
-
return (mode === undefined ? specifier : mode + "|" + specifier);
|
|
43451
|
-
}
|
|
43452
|
-
ts.getModeAwareCacheKey = getModeAwareCacheKey;
|
|
43453
43315
|
/* @internal */
|
|
43454
43316
|
function createModeAwareCache() {
|
|
43455
43317
|
var underlying = new ts.Map();
|
|
@@ -43475,22 +43337,13 @@ var ts;
|
|
|
43475
43337
|
return cb(elem, specifier, mode);
|
|
43476
43338
|
});
|
|
43477
43339
|
},
|
|
43478
|
-
entries: function () {
|
|
43479
|
-
var keys = underlying.entries();
|
|
43480
|
-
return {
|
|
43481
|
-
next: function () {
|
|
43482
|
-
var next = keys.next();
|
|
43483
|
-
return !next.done ? { value: __spreadArray(__spreadArray([], memoizedReverseKeys.get(next.value[0]), true), [next.value[1]], false) } : next;
|
|
43484
|
-
},
|
|
43485
|
-
};
|
|
43486
|
-
},
|
|
43487
43340
|
size: function () {
|
|
43488
43341
|
return underlying.size;
|
|
43489
|
-
}
|
|
43342
|
+
}
|
|
43490
43343
|
};
|
|
43491
43344
|
return cache;
|
|
43492
43345
|
function getUnderlyingCacheKey(specifier, mode) {
|
|
43493
|
-
var result =
|
|
43346
|
+
var result = mode === undefined ? specifier : mode + "|" + specifier;
|
|
43494
43347
|
memoizedReverseKeys.set(result, [specifier, mode]);
|
|
43495
43348
|
return result;
|
|
43496
43349
|
}
|
|
@@ -43503,121 +43356,35 @@ var ts;
|
|
|
43503
43356
|
for (var i = 0; i < keys.length; ++i) {
|
|
43504
43357
|
var entry = keys[i];
|
|
43505
43358
|
// We lower-case all type references because npm automatically lowercases all packages. See GH#9824.
|
|
43506
|
-
var name = !ts.isString(entry) ?
|
|
43359
|
+
var name = !ts.isString(entry) ? entry.fileName.toLowerCase() : entry;
|
|
43507
43360
|
var mode = !ts.isString(entry) ? entry.resolutionMode || file.impliedNodeFormat : ts.getModeForResolutionAtIndex(file, i);
|
|
43508
43361
|
map.set(name, mode, values[i]);
|
|
43509
43362
|
}
|
|
43510
43363
|
return map;
|
|
43511
43364
|
}
|
|
43512
43365
|
ts.zipToModeAwareCache = zipToModeAwareCache;
|
|
43513
|
-
function
|
|
43514
|
-
var
|
|
43515
|
-
|
|
43516
|
-
var i = 0;
|
|
43517
|
-
var limit = Math.min(directory.length, resolutionDirectory.length);
|
|
43518
|
-
while (i < limit && directory.charCodeAt(i) === resolutionDirectory.charCodeAt(i)) {
|
|
43519
|
-
i++;
|
|
43520
|
-
}
|
|
43521
|
-
if (i === directory.length && (resolutionDirectory.length === i || resolutionDirectory[i] === ts.directorySeparator)) {
|
|
43522
|
-
return directory;
|
|
43523
|
-
}
|
|
43524
|
-
var rootLength = ts.getRootLength(directory);
|
|
43525
|
-
if (i < rootLength) {
|
|
43526
|
-
return undefined;
|
|
43527
|
-
}
|
|
43528
|
-
var sep = directory.lastIndexOf(ts.directorySeparator, i - 1);
|
|
43529
|
-
if (sep === -1) {
|
|
43530
|
-
return undefined;
|
|
43531
|
-
}
|
|
43532
|
-
return directory.substr(0, Math.max(sep, rootLength));
|
|
43533
|
-
}
|
|
43534
|
-
/*@internal*/
|
|
43535
|
-
function getResolvedFileNameForModuleNameToDirectorySet(result) {
|
|
43536
|
-
return result.resolvedModule &&
|
|
43537
|
-
(result.resolvedModule.originalPath || result.resolvedModule.resolvedFileName);
|
|
43538
|
-
}
|
|
43539
|
-
ts.getResolvedFileNameForModuleNameToDirectorySet = getResolvedFileNameForModuleNameToDirectorySet;
|
|
43540
|
-
/**
|
|
43541
|
-
* At first this function add entry directory -> module resolution result to the table.
|
|
43542
|
-
* Then it computes the set of parent folders for 'directory' that should have the same module resolution result
|
|
43543
|
-
* and for every parent folder in set it adds entry: parent -> module resolution. .
|
|
43544
|
-
* Lets say we first directory name: /a/b/c/d/e and resolution result is: /a/b/bar.ts.
|
|
43545
|
-
* Set of parent folders that should have the same result will be:
|
|
43546
|
-
* [
|
|
43547
|
-
* /a/b/c/d, /a/b/c, /a/b
|
|
43548
|
-
* ]
|
|
43549
|
-
* this means that request for module resolution from file in any of these folder will be immediately found in cache.
|
|
43550
|
-
*/
|
|
43551
|
-
/*@internal*/
|
|
43552
|
-
function moduleNameToDirectorySet(directoryPathMap, directory, result, getResolvedFileName, toPath, ancestoryWorker) {
|
|
43553
|
-
// if entry is already in cache do nothing
|
|
43554
|
-
if (directoryPathMap.has(directory))
|
|
43555
|
-
return;
|
|
43556
|
-
directoryPathMap.set(directory, result);
|
|
43557
|
-
var resolvedFileName = getResolvedFileName(result);
|
|
43558
|
-
// find common prefix between directory and resolved file name
|
|
43559
|
-
// this common prefix should be the shortest path that has the same resolution
|
|
43560
|
-
// directory: /a/b/c/d/e
|
|
43561
|
-
// resolvedFileName: /a/b/foo.d.ts
|
|
43562
|
-
// commonPrefix: /a/b
|
|
43563
|
-
// for failed lookups cache the result for every directory up to root
|
|
43564
|
-
var commonPrefix = resolvedFileName && getCommonPrefix(directory, resolvedFileName, toPath);
|
|
43565
|
-
var current = directory;
|
|
43566
|
-
while (current !== commonPrefix) {
|
|
43567
|
-
var parent = ts.getDirectoryPath(current);
|
|
43568
|
-
if (parent === current)
|
|
43569
|
-
break;
|
|
43570
|
-
if (directoryPathMap.has(parent)) {
|
|
43571
|
-
ancestoryWorker(parent);
|
|
43572
|
-
break;
|
|
43573
|
-
}
|
|
43574
|
-
directoryPathMap.set(parent, result);
|
|
43575
|
-
ancestoryWorker(parent);
|
|
43576
|
-
current = parent;
|
|
43577
|
-
}
|
|
43578
|
-
}
|
|
43579
|
-
ts.moduleNameToDirectorySet = moduleNameToDirectorySet;
|
|
43580
|
-
function createModuleResolutionCache(currentDirectory, getCanonicalFileName, options) {
|
|
43581
|
-
var directoryToModuleNameMap = createCacheWithRedirects(options);
|
|
43582
|
-
var moduleNameToDirectoryMap = createCacheWithRedirects(options);
|
|
43583
|
-
var perDirectoryResolutionCache = createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, directoryToModuleNameMap);
|
|
43366
|
+
function createModuleResolutionCache(currentDirectory, getCanonicalFileName, options, directoryToModuleNameMap, moduleNameToDirectoryMap) {
|
|
43367
|
+
var preDirectoryResolutionCache = createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, directoryToModuleNameMap || (directoryToModuleNameMap = createCacheWithRedirects(options)));
|
|
43368
|
+
moduleNameToDirectoryMap || (moduleNameToDirectoryMap = createCacheWithRedirects(options));
|
|
43584
43369
|
var packageJsonInfoCache = createPackageJsonInfoCache(currentDirectory, getCanonicalFileName);
|
|
43585
|
-
|
|
43586
|
-
return __assign(__assign(__assign({}, packageJsonInfoCache), perDirectoryResolutionCache), { getOrCreateCacheForModuleName: getOrCreateCacheForModuleName, getFromModuleNameCache: getFromModuleNameCache, clear: clear, update: update, getPackageJsonInfoCache: function () { return packageJsonInfoCache; }, setOldResolutionCache: setOldResolutionCache });
|
|
43370
|
+
return __assign(__assign(__assign({}, packageJsonInfoCache), preDirectoryResolutionCache), { getOrCreateCacheForModuleName: getOrCreateCacheForModuleName, clear: clear, update: update, getPackageJsonInfoCache: function () { return packageJsonInfoCache; } });
|
|
43587
43371
|
function clear() {
|
|
43588
|
-
|
|
43589
|
-
perDirectoryResolutionCache.clear();
|
|
43372
|
+
preDirectoryResolutionCache.clear();
|
|
43590
43373
|
moduleNameToDirectoryMap.clear();
|
|
43591
43374
|
packageJsonInfoCache.clear();
|
|
43592
43375
|
}
|
|
43593
43376
|
function update(options) {
|
|
43594
|
-
|
|
43595
|
-
moduleNameToDirectoryMap.update(options);
|
|
43596
|
-
}
|
|
43597
|
-
function setOldResolutionCache(cache) {
|
|
43598
|
-
oldResolutionCache = cache;
|
|
43599
|
-
perDirectoryResolutionCache.setOldResolutionCache(cache);
|
|
43600
|
-
}
|
|
43601
|
-
function getFromModuleNameCache(directoryName, nonRelativeModuleName, mode, redirectedReference) {
|
|
43602
|
-
var _a, _b;
|
|
43603
|
-
ts.Debug.assert(!ts.isExternalModuleNameRelative(nonRelativeModuleName));
|
|
43604
|
-
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);
|
|
43605
|
-
if (result)
|
|
43606
|
-
return result;
|
|
43607
|
-
var fromOld = oldResolutionCache === null || oldResolutionCache === void 0 ? void 0 : oldResolutionCache.getResolved(toPath(directoryName), nonRelativeModuleName, mode, redirectedReference);
|
|
43608
|
-
if (fromOld)
|
|
43609
|
-
getOrCreateCacheForModuleName(nonRelativeModuleName, mode, redirectedReference).set(directoryName, fromOld);
|
|
43610
|
-
return fromOld;
|
|
43377
|
+
updateRedirectsMap(options, directoryToModuleNameMap, moduleNameToDirectoryMap);
|
|
43611
43378
|
}
|
|
43612
43379
|
function getOrCreateCacheForModuleName(nonRelativeModuleName, mode, redirectedReference) {
|
|
43613
43380
|
ts.Debug.assert(!ts.isExternalModuleNameRelative(nonRelativeModuleName));
|
|
43614
|
-
return getOrCreateCache(moduleNameToDirectoryMap, redirectedReference,
|
|
43381
|
+
return getOrCreateCache(moduleNameToDirectoryMap, redirectedReference, mode === undefined ? nonRelativeModuleName : mode + "|" + nonRelativeModuleName, createPerModuleNameCache);
|
|
43615
43382
|
}
|
|
43616
43383
|
function createPerModuleNameCache() {
|
|
43617
43384
|
var directoryPathMap = new ts.Map();
|
|
43618
43385
|
return { get: get, set: set };
|
|
43619
43386
|
function get(directory) {
|
|
43620
|
-
return directoryPathMap.get(toPath(directory));
|
|
43387
|
+
return directoryPathMap.get(ts.toPath(directory, currentDirectory, getCanonicalFileName));
|
|
43621
43388
|
}
|
|
43622
43389
|
/**
|
|
43623
43390
|
* At first this function add entry directory -> module resolution result to the table.
|
|
@@ -43631,17 +43398,57 @@ var ts;
|
|
|
43631
43398
|
* this means that request for module resolution from file in any of these folder will be immediately found in cache.
|
|
43632
43399
|
*/
|
|
43633
43400
|
function set(directory, result) {
|
|
43634
|
-
|
|
43401
|
+
var path = ts.toPath(directory, currentDirectory, getCanonicalFileName);
|
|
43402
|
+
// if entry is already in cache do nothing
|
|
43403
|
+
if (directoryPathMap.has(path)) {
|
|
43404
|
+
return;
|
|
43405
|
+
}
|
|
43406
|
+
directoryPathMap.set(path, result);
|
|
43407
|
+
var resolvedFileName = result.resolvedModule &&
|
|
43408
|
+
(result.resolvedModule.originalPath || result.resolvedModule.resolvedFileName);
|
|
43409
|
+
// find common prefix between directory and resolved file name
|
|
43410
|
+
// this common prefix should be the shortest path that has the same resolution
|
|
43411
|
+
// directory: /a/b/c/d/e
|
|
43412
|
+
// resolvedFileName: /a/b/foo.d.ts
|
|
43413
|
+
// commonPrefix: /a/b
|
|
43414
|
+
// for failed lookups cache the result for every directory up to root
|
|
43415
|
+
var commonPrefix = resolvedFileName && getCommonPrefix(path, resolvedFileName);
|
|
43416
|
+
var current = path;
|
|
43417
|
+
while (current !== commonPrefix) {
|
|
43418
|
+
var parent = ts.getDirectoryPath(current);
|
|
43419
|
+
if (parent === current || directoryPathMap.has(parent)) {
|
|
43420
|
+
break;
|
|
43421
|
+
}
|
|
43422
|
+
directoryPathMap.set(parent, result);
|
|
43423
|
+
current = parent;
|
|
43424
|
+
}
|
|
43425
|
+
}
|
|
43426
|
+
function getCommonPrefix(directory, resolution) {
|
|
43427
|
+
var resolutionDirectory = ts.toPath(ts.getDirectoryPath(resolution), currentDirectory, getCanonicalFileName);
|
|
43428
|
+
// find first position where directory and resolution differs
|
|
43429
|
+
var i = 0;
|
|
43430
|
+
var limit = Math.min(directory.length, resolutionDirectory.length);
|
|
43431
|
+
while (i < limit && directory.charCodeAt(i) === resolutionDirectory.charCodeAt(i)) {
|
|
43432
|
+
i++;
|
|
43433
|
+
}
|
|
43434
|
+
if (i === directory.length && (resolutionDirectory.length === i || resolutionDirectory[i] === ts.directorySeparator)) {
|
|
43435
|
+
return directory;
|
|
43436
|
+
}
|
|
43437
|
+
var rootLength = ts.getRootLength(directory);
|
|
43438
|
+
if (i < rootLength) {
|
|
43439
|
+
return undefined;
|
|
43440
|
+
}
|
|
43441
|
+
var sep = directory.lastIndexOf(ts.directorySeparator, i - 1);
|
|
43442
|
+
if (sep === -1) {
|
|
43443
|
+
return undefined;
|
|
43444
|
+
}
|
|
43445
|
+
return directory.substr(0, Math.max(sep, rootLength));
|
|
43635
43446
|
}
|
|
43636
|
-
}
|
|
43637
|
-
function toPath(fileName) {
|
|
43638
|
-
return ts.toPath(fileName, currentDirectory, getCanonicalFileName);
|
|
43639
43447
|
}
|
|
43640
43448
|
}
|
|
43641
43449
|
ts.createModuleResolutionCache = createModuleResolutionCache;
|
|
43642
|
-
function createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, options, packageJsonInfoCache) {
|
|
43643
|
-
var directoryToModuleNameMap = createCacheWithRedirects(options);
|
|
43644
|
-
var preDirectoryResolutionCache = createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, directoryToModuleNameMap);
|
|
43450
|
+
function createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, options, packageJsonInfoCache, directoryToModuleNameMap) {
|
|
43451
|
+
var preDirectoryResolutionCache = createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, directoryToModuleNameMap || (directoryToModuleNameMap = createCacheWithRedirects(options)));
|
|
43645
43452
|
packageJsonInfoCache || (packageJsonInfoCache = createPackageJsonInfoCache(currentDirectory, getCanonicalFileName));
|
|
43646
43453
|
return __assign(__assign(__assign({}, packageJsonInfoCache), preDirectoryResolutionCache), { clear: clear });
|
|
43647
43454
|
function clear() {
|
|
@@ -43652,7 +43459,10 @@ var ts;
|
|
|
43652
43459
|
ts.createTypeReferenceDirectiveResolutionCache = createTypeReferenceDirectiveResolutionCache;
|
|
43653
43460
|
function resolveModuleNameFromCache(moduleName, containingFile, cache, mode) {
|
|
43654
43461
|
var containingDirectory = ts.getDirectoryPath(containingFile);
|
|
43655
|
-
|
|
43462
|
+
var perFolderCache = cache && cache.getOrCreateCacheForDirectory(containingDirectory);
|
|
43463
|
+
if (!perFolderCache)
|
|
43464
|
+
return undefined;
|
|
43465
|
+
return perFolderCache.get(moduleName, mode);
|
|
43656
43466
|
}
|
|
43657
43467
|
ts.resolveModuleNameFromCache = resolveModuleNameFromCache;
|
|
43658
43468
|
function resolveModuleName(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
@@ -43667,7 +43477,8 @@ var ts;
|
|
|
43667
43477
|
}
|
|
43668
43478
|
}
|
|
43669
43479
|
var containingDirectory = ts.getDirectoryPath(containingFile);
|
|
43670
|
-
var
|
|
43480
|
+
var perFolderCache = cache && cache.getOrCreateCacheForDirectory(containingDirectory, redirectedReference);
|
|
43481
|
+
var result = perFolderCache && perFolderCache.get(moduleName, resolutionMode);
|
|
43671
43482
|
if (result) {
|
|
43672
43483
|
if (traceEnabled) {
|
|
43673
43484
|
trace(host, ts.Diagnostics.Resolution_for_module_0_was_found_in_cache_from_location_1, moduleName, containingDirectory);
|
|
@@ -43719,8 +43530,8 @@ var ts;
|
|
|
43719
43530
|
if (result && result.resolvedModule)
|
|
43720
43531
|
ts.perfLogger.logInfoEvent("Module \"" + moduleName + "\" resolved to \"" + result.resolvedModule.resolvedFileName + "\"");
|
|
43721
43532
|
ts.perfLogger.logStopResolveModule((result && result.resolvedModule) ? "" + result.resolvedModule.resolvedFileName : "null");
|
|
43722
|
-
if (
|
|
43723
|
-
|
|
43533
|
+
if (perFolderCache) {
|
|
43534
|
+
perFolderCache.set(moduleName, resolutionMode, result);
|
|
43724
43535
|
if (!ts.isExternalModuleNameRelative(moduleName)) {
|
|
43725
43536
|
// put result in per-module name cache
|
|
43726
43537
|
cache.getOrCreateCacheForModuleName(moduleName, resolutionMode, redirectedReference).set(containingDirectory, result);
|
|
@@ -44006,10 +43817,10 @@ var ts;
|
|
|
44006
43817
|
features: features,
|
|
44007
43818
|
conditions: conditions,
|
|
44008
43819
|
requestContainingDirectory: containingDirectory,
|
|
44009
|
-
|
|
43820
|
+
reportDiagnostic: function (diag) { return void diagnostics.push(diag); },
|
|
44010
43821
|
};
|
|
44011
43822
|
var result = ts.forEach(extensions, function (ext) { return tryResolve(ext); });
|
|
44012
|
-
return createResolvedModuleWithFailedLookupLocations(
|
|
43823
|
+
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);
|
|
44013
43824
|
function tryResolve(extensions) {
|
|
44014
43825
|
var loader = function (extensions, candidate, onlyRecordFailures, state) { return nodeLoadModuleByRelativeName(extensions, candidate, onlyRecordFailures, state, /*considerPackageJson*/ true); };
|
|
44015
43826
|
var resolved = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loader, state);
|
|
@@ -44386,7 +44197,7 @@ var ts;
|
|
|
44386
44197
|
features: NodeResolutionFeatures.None,
|
|
44387
44198
|
conditions: ts.emptyArray,
|
|
44388
44199
|
requestContainingDirectory: undefined,
|
|
44389
|
-
|
|
44200
|
+
reportDiagnostic: ts.noop
|
|
44390
44201
|
};
|
|
44391
44202
|
}
|
|
44392
44203
|
ts.getTemporaryModuleResolutionState = getTemporaryModuleResolutionState;
|
|
@@ -44433,13 +44244,12 @@ var ts;
|
|
|
44433
44244
|
}
|
|
44434
44245
|
var directoryExists = ts.directoryProbablyExists(packageDirectory, host);
|
|
44435
44246
|
if (directoryExists && host.fileExists(packageJsonPath)) {
|
|
44436
|
-
var
|
|
44437
|
-
var packageJsonContent = ts.readJsonIgnoringErrorsFromText(packageJsonPath, packageJsonText);
|
|
44247
|
+
var packageJsonContent = ts.readJson(packageJsonPath, host);
|
|
44438
44248
|
if (traceEnabled) {
|
|
44439
44249
|
trace(host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath);
|
|
44440
44250
|
}
|
|
44441
44251
|
var versionPaths = readPackageJsonTypesVersionPaths(packageJsonContent, state);
|
|
44442
|
-
var result = { packageDirectory: packageDirectory,
|
|
44252
|
+
var result = { packageDirectory: packageDirectory, packageJsonContent: packageJsonContent, versionPaths: versionPaths, resolvedEntrypoints: undefined };
|
|
44443
44253
|
(_b = state.packageJsonInfoCache) === null || _b === void 0 ? void 0 : _b.setPackageJsonInfo(packageJsonPath, result);
|
|
44444
44254
|
state.affectingLocations.push(packageJsonPath);
|
|
44445
44255
|
return result;
|
|
@@ -44864,8 +44674,12 @@ var ts;
|
|
|
44864
44674
|
fragment = ts.ensureTrailingDirectorySeparator(commonDir_1);
|
|
44865
44675
|
}
|
|
44866
44676
|
}
|
|
44867
|
-
if (commonSourceDirGuesses.length > 1)
|
|
44868
|
-
state.
|
|
44677
|
+
if (commonSourceDirGuesses.length > 1) {
|
|
44678
|
+
state.reportDiagnostic(ts.createCompilerDiagnostic(isImports
|
|
44679
|
+
? 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
|
|
44680
|
+
: 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
|
|
44681
|
+
packagePath));
|
|
44682
|
+
}
|
|
44869
44683
|
for (var _i = 0, commonSourceDirGuesses_1 = commonSourceDirGuesses; _i < commonSourceDirGuesses_1.length; _i++) {
|
|
44870
44684
|
var commonSourceDirGuess = commonSourceDirGuesses_1[_i];
|
|
44871
44685
|
var candidateDirectories = getOutputDirectoriesForBaseDirectory(commonSourceDirGuess);
|
|
@@ -44935,10 +44749,10 @@ var ts;
|
|
|
44935
44749
|
return loadModuleFromNearestNodeModulesDirectoryWorker(Extensions.DtsOnly, moduleName, directory, state, /*typesScopeOnly*/ true, /*cache*/ undefined, /*redirectedReference*/ undefined);
|
|
44936
44750
|
}
|
|
44937
44751
|
function loadModuleFromNearestNodeModulesDirectoryWorker(extensions, moduleName, directory, state, typesScopeOnly, cache, redirectedReference) {
|
|
44938
|
-
var
|
|
44752
|
+
var perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName, state.features === 0 ? undefined : state.features & NodeResolutionFeatures.EsmMode ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS, redirectedReference);
|
|
44939
44753
|
return ts.forEachAncestorDirectory(ts.normalizeSlashes(directory), function (ancestorDirectory) {
|
|
44940
44754
|
if (ts.getBaseFileName(ancestorDirectory) !== "node_modules") {
|
|
44941
|
-
var resolutionFromCache = tryFindNonRelativeModuleNameInCache(
|
|
44755
|
+
var resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache, moduleName, ancestorDirectory, state);
|
|
44942
44756
|
if (resolutionFromCache) {
|
|
44943
44757
|
return resolutionFromCache;
|
|
44944
44758
|
}
|
|
@@ -45090,8 +44904,8 @@ var ts;
|
|
|
45090
44904
|
typesPackageName;
|
|
45091
44905
|
}
|
|
45092
44906
|
ts.unmangleScopedPackageName = unmangleScopedPackageName;
|
|
45093
|
-
function tryFindNonRelativeModuleNameInCache(cache, moduleName,
|
|
45094
|
-
var result = cache
|
|
44907
|
+
function tryFindNonRelativeModuleNameInCache(cache, moduleName, containingDirectory, state) {
|
|
44908
|
+
var result = cache && cache.get(containingDirectory);
|
|
45095
44909
|
if (result) {
|
|
45096
44910
|
if (state.traceEnabled) {
|
|
45097
44911
|
trace(state.host, ts.Diagnostics.Resolution_for_module_0_was_found_in_cache_from_location_1, moduleName, containingDirectory);
|
|
@@ -45116,11 +44930,11 @@ var ts;
|
|
|
45116
44930
|
features: NodeResolutionFeatures.None,
|
|
45117
44931
|
conditions: [],
|
|
45118
44932
|
requestContainingDirectory: containingDirectory,
|
|
45119
|
-
|
|
44933
|
+
reportDiagnostic: function (diag) { return void diagnostics.push(diag); },
|
|
45120
44934
|
};
|
|
45121
44935
|
var resolved = tryResolve(Extensions.TypeScript) || tryResolve(Extensions.JavaScript);
|
|
45122
44936
|
// No originalPath because classic resolution doesn't resolve realPath
|
|
45123
|
-
return createResolvedModuleWithFailedLookupLocations(
|
|
44937
|
+
return createResolvedModuleWithFailedLookupLocations(resolved && resolved.value,
|
|
45124
44938
|
/*isExternalLibraryImport*/ false, failedLookupLocations, affectingLocations, diagnostics, state.resultFromCache);
|
|
45125
44939
|
function tryResolve(extensions) {
|
|
45126
44940
|
var resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFileNoPackageId, state);
|
|
@@ -45128,9 +44942,10 @@ var ts;
|
|
|
45128
44942
|
return { value: resolvedUsingSettings };
|
|
45129
44943
|
}
|
|
45130
44944
|
if (!ts.isExternalModuleNameRelative(moduleName)) {
|
|
44945
|
+
var perModuleNameCache_1 = cache && cache.getOrCreateCacheForModuleName(moduleName, /*mode*/ undefined, redirectedReference);
|
|
45131
44946
|
// Climb up parent directories looking for a module.
|
|
45132
44947
|
var resolved_3 = ts.forEachAncestorDirectory(containingDirectory, function (directory) {
|
|
45133
|
-
var resolutionFromCache = tryFindNonRelativeModuleNameInCache(
|
|
44948
|
+
var resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache_1, moduleName, directory, state);
|
|
45134
44949
|
if (resolutionFromCache) {
|
|
45135
44950
|
return resolutionFromCache;
|
|
45136
44951
|
}
|
|
@@ -45175,10 +44990,10 @@ var ts;
|
|
|
45175
44990
|
features: NodeResolutionFeatures.None,
|
|
45176
44991
|
conditions: [],
|
|
45177
44992
|
requestContainingDirectory: undefined,
|
|
45178
|
-
|
|
44993
|
+
reportDiagnostic: function (diag) { return void diagnostics.push(diag); },
|
|
45179
44994
|
};
|
|
45180
44995
|
var resolved = loadModuleFromImmediateNodeModulesDirectory(Extensions.DtsOnly, moduleName, globalCache, state, /*typesScopeOnly*/ false, /*cache*/ undefined, /*redirectedReference*/ undefined);
|
|
45181
|
-
return createResolvedModuleWithFailedLookupLocations(
|
|
44996
|
+
return createResolvedModuleWithFailedLookupLocations(resolved,
|
|
45182
44997
|
/*isExternalLibraryImport*/ true, failedLookupLocations, affectingLocations, diagnostics, state.resultFromCache);
|
|
45183
44998
|
}
|
|
45184
44999
|
ts.loadModuleFromGlobalCache = loadModuleFromGlobalCache;
|
|
@@ -48864,10 +48679,9 @@ var ts;
|
|
|
48864
48679
|
host.getSourceFiles().forEach(function (sf) {
|
|
48865
48680
|
if (!sf.resolvedModules)
|
|
48866
48681
|
return;
|
|
48867
|
-
sf.resolvedModules.forEach(function (
|
|
48868
|
-
|
|
48869
|
-
|
|
48870
|
-
map.set(resolvedModule.packageId.name, resolvedModule.extension === ".d.ts" /* Dts */ || !!map.get(resolvedModule.packageId.name));
|
|
48682
|
+
sf.resolvedModules.forEach(function (r) {
|
|
48683
|
+
if (r && r.packageId)
|
|
48684
|
+
map.set(r.packageId.name, r.extension === ".d.ts" /* Dts */ || !!map.get(r.packageId.name));
|
|
48871
48685
|
});
|
|
48872
48686
|
});
|
|
48873
48687
|
return map;
|
|
@@ -88322,12 +88136,11 @@ var ts;
|
|
|
88322
88136
|
if (resolvedTypeReferenceDirectives) {
|
|
88323
88137
|
// populate reverse mapping: file path -> type reference directive that was resolved to this file
|
|
88324
88138
|
fileToDirective = new ts.Map();
|
|
88325
|
-
resolvedTypeReferenceDirectives.forEach(function (
|
|
88326
|
-
|
|
88327
|
-
if (!resolvedTypeReferenceDirective || !resolvedTypeReferenceDirective.resolvedFileName) {
|
|
88139
|
+
resolvedTypeReferenceDirectives.forEach(function (resolvedDirective, key, mode) {
|
|
88140
|
+
if (!resolvedDirective || !resolvedDirective.resolvedFileName) {
|
|
88328
88141
|
return;
|
|
88329
88142
|
}
|
|
88330
|
-
var file = host.getSourceFile(
|
|
88143
|
+
var file = host.getSourceFile(resolvedDirective.resolvedFileName);
|
|
88331
88144
|
if (file) {
|
|
88332
88145
|
// Add the transitive closure of path references loaded by this file (as long as they are not)
|
|
88333
88146
|
// part of an existing type reference.
|
|
@@ -111799,7 +111612,7 @@ var ts;
|
|
|
111799
111612
|
var sourceMap = sourceMapGenerator.toString();
|
|
111800
111613
|
ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap, /*writeByteOrderMark*/ false, sourceFiles);
|
|
111801
111614
|
if (printer.bundleFileInfo)
|
|
111802
|
-
printer.bundleFileInfo.mapHash = ts.computeSignature(sourceMap, host);
|
|
111615
|
+
printer.bundleFileInfo.mapHash = ts.computeSignature(sourceMap, ts.maybeBind(host, host.createHash));
|
|
111803
111616
|
}
|
|
111804
111617
|
}
|
|
111805
111618
|
else {
|
|
@@ -111811,7 +111624,7 @@ var ts;
|
|
|
111811
111624
|
// 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
|
|
111812
111625
|
// 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
|
|
111813
111626
|
if (printer.bundleFileInfo)
|
|
111814
|
-
printer.bundleFileInfo.hash = ts.computeSignature(text, host);
|
|
111627
|
+
printer.bundleFileInfo.hash = ts.computeSignature(text, ts.maybeBind(host, host.createHash));
|
|
111815
111628
|
// Reset state
|
|
111816
111629
|
writer.clear();
|
|
111817
111630
|
}
|
|
@@ -111954,6 +111767,7 @@ var ts;
|
|
|
111954
111767
|
}
|
|
111955
111768
|
/*@internal*/
|
|
111956
111769
|
function emitUsingBuildInfo(config, host, getCommandLine, customTransformers) {
|
|
111770
|
+
var createHash = ts.maybeBind(host, host.createHash);
|
|
111957
111771
|
var _a = getOutputPathsForBundle(config.options, /*forceDtsPaths*/ false), buildInfoPath = _a.buildInfoPath, jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath;
|
|
111958
111772
|
var buildInfo;
|
|
111959
111773
|
if (host.getBuildInfo) {
|
|
@@ -111975,25 +111789,25 @@ var ts;
|
|
|
111975
111789
|
if (!jsFileText)
|
|
111976
111790
|
return jsFilePath;
|
|
111977
111791
|
// If the jsFileText is not same has what it was created with, tsbuildinfo is stale so dont use it
|
|
111978
|
-
if (ts.computeSignature(jsFileText,
|
|
111792
|
+
if (ts.computeSignature(jsFileText, createHash) !== buildInfo.bundle.js.hash)
|
|
111979
111793
|
return jsFilePath;
|
|
111980
111794
|
var sourceMapText = sourceMapFilePath && host.readFile(sourceMapFilePath);
|
|
111981
111795
|
// error if no source map or for now if inline sourcemap
|
|
111982
111796
|
if ((sourceMapFilePath && !sourceMapText) || config.options.inlineSourceMap)
|
|
111983
111797
|
return sourceMapFilePath || "inline sourcemap decoding";
|
|
111984
|
-
if (sourceMapFilePath && ts.computeSignature(sourceMapText,
|
|
111798
|
+
if (sourceMapFilePath && ts.computeSignature(sourceMapText, createHash) !== buildInfo.bundle.js.mapHash)
|
|
111985
111799
|
return sourceMapFilePath;
|
|
111986
111800
|
// read declaration text
|
|
111987
111801
|
var declarationText = declarationFilePath && host.readFile(declarationFilePath);
|
|
111988
111802
|
if (declarationFilePath && !declarationText)
|
|
111989
111803
|
return declarationFilePath;
|
|
111990
|
-
if (declarationFilePath && ts.computeSignature(declarationText,
|
|
111804
|
+
if (declarationFilePath && ts.computeSignature(declarationText, createHash) !== buildInfo.bundle.dts.hash)
|
|
111991
111805
|
return declarationFilePath;
|
|
111992
111806
|
var declarationMapText = declarationMapPath && host.readFile(declarationMapPath);
|
|
111993
111807
|
// error if no source map or for now if inline sourcemap
|
|
111994
111808
|
if ((declarationMapPath && !declarationMapText) || config.options.inlineSourceMap)
|
|
111995
111809
|
return declarationMapPath || "inline sourcemap decoding";
|
|
111996
|
-
if (declarationMapPath && ts.computeSignature(declarationMapText,
|
|
111810
|
+
if (declarationMapPath && ts.computeSignature(declarationMapText, createHash) !== buildInfo.bundle.dts.mapHash)
|
|
111997
111811
|
return declarationMapPath;
|
|
111998
111812
|
var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
|
|
111999
111813
|
var ownPrependInput = ts.createInputFiles(jsFileText, declarationText, sourceMapFilePath, sourceMapText, declarationMapPath, declarationMapText, jsFilePath, declarationFilePath, buildInfoPath, buildInfo,
|
|
@@ -112033,7 +111847,7 @@ var ts;
|
|
|
112033
111847
|
newBuildInfo.program = buildInfo.program;
|
|
112034
111848
|
if (newBuildInfo.program && changedDtsText !== undefined && config.options.composite) {
|
|
112035
111849
|
// Update the output signature
|
|
112036
|
-
newBuildInfo.program.outSignature = ts.computeSignature(changedDtsText,
|
|
111850
|
+
newBuildInfo.program.outSignature = ts.computeSignature(changedDtsText, createHash, changedDtsData);
|
|
112037
111851
|
}
|
|
112038
111852
|
// Update sourceFileInfo
|
|
112039
111853
|
var _a = buildInfo.bundle, js = _a.js, dts = _a.dts, sourceFiles = _a.sourceFiles;
|
|
@@ -112067,7 +111881,7 @@ var ts;
|
|
|
112067
111881
|
getSourceFileFromReference: ts.returnUndefined,
|
|
112068
111882
|
redirectTargetsMap: ts.createMultiMap(),
|
|
112069
111883
|
getFileIncludeReasons: ts.notImplemented,
|
|
112070
|
-
createHash:
|
|
111884
|
+
createHash: createHash,
|
|
112071
111885
|
};
|
|
112072
111886
|
emitFiles(ts.notImplementedResolver, emitHost,
|
|
112073
111887
|
/*targetSourceFile*/ undefined, ts.getTransformers(config.options, customTransformers));
|
|
@@ -117544,7 +117358,7 @@ var ts;
|
|
|
117544
117358
|
var result = void 0;
|
|
117545
117359
|
var mode = getModeForFileReference(name, containingFileMode);
|
|
117546
117360
|
// We lower-case all type references because npm automatically lowercases all packages. See GH#9824.
|
|
117547
|
-
var strName = ts.isString(name) ? name :
|
|
117361
|
+
var strName = ts.isString(name) ? name : name.fileName.toLowerCase();
|
|
117548
117362
|
var cacheKey = mode !== undefined ? mode + "|" + strName : strName;
|
|
117549
117363
|
if (cache.has(cacheKey)) {
|
|
117550
117364
|
result = cache.get(cacheKey);
|
|
@@ -117648,22 +117462,8 @@ var ts;
|
|
|
117648
117462
|
return elem.value.text === "import" ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS;
|
|
117649
117463
|
}
|
|
117650
117464
|
ts.getResolutionModeOverrideForClause = getResolutionModeOverrideForClause;
|
|
117651
|
-
var emptyResolution = {
|
|
117652
|
-
resolvedModule: undefined,
|
|
117653
|
-
resolvedTypeReferenceDirective: undefined,
|
|
117654
|
-
failedLookupLocations: [],
|
|
117655
|
-
affectingLocations: [],
|
|
117656
|
-
resolutionDiagnostics: [],
|
|
117657
|
-
};
|
|
117658
|
-
function isResolvedModuleWithFailedLookupLocation(resolved) {
|
|
117659
|
-
return !!resolved && !!resolved.failedLookupLocations;
|
|
117660
|
-
}
|
|
117661
|
-
function isResolvedTypeReferenceDirectiveWithFailedLookupLocations(resolved) {
|
|
117662
|
-
return !!resolved && !!resolved.failedLookupLocations;
|
|
117663
|
-
}
|
|
117664
117465
|
/* @internal */
|
|
117665
|
-
function loadWithModeAwareCache(names, containingFile, containingFileName, redirectedReference,
|
|
117666
|
-
var _a;
|
|
117466
|
+
function loadWithModeAwareCache(names, containingFile, containingFileName, redirectedReference, loader) {
|
|
117667
117467
|
if (names.length === 0) {
|
|
117668
117468
|
return [];
|
|
117669
117469
|
}
|
|
@@ -117673,7 +117473,7 @@ var ts;
|
|
|
117673
117473
|
for (var _i = 0, names_3 = names; _i < names_3.length; _i++) {
|
|
117674
117474
|
var name = names_3[_i];
|
|
117675
117475
|
var result = void 0;
|
|
117676
|
-
var mode = getModeForResolutionAtIndex(containingFile,
|
|
117476
|
+
var mode = getModeForResolutionAtIndex(containingFile, i);
|
|
117677
117477
|
i++;
|
|
117678
117478
|
var cacheKey = mode !== undefined ? mode + "|" + name : name;
|
|
117679
117479
|
if (cache.has(cacheKey)) {
|
|
@@ -117738,14 +117538,14 @@ var ts;
|
|
|
117738
117538
|
/*@internal*/
|
|
117739
117539
|
function getReferencedFileLocation(getSourceFileByPath, ref) {
|
|
117740
117540
|
var _a, _b, _c;
|
|
117741
|
-
var _d, _e, _f, _g
|
|
117541
|
+
var _d, _e, _f, _g;
|
|
117742
117542
|
var file = ts.Debug.checkDefined(getSourceFileByPath(ref.file));
|
|
117743
117543
|
var kind = ref.kind, index = ref.index;
|
|
117744
117544
|
var pos, end, packageId, resolutionMode;
|
|
117745
117545
|
switch (kind) {
|
|
117746
117546
|
case ts.FileIncludeKind.Import:
|
|
117747
117547
|
var importLiteral = getModuleNameStringLiteralAt(file, index);
|
|
117748
|
-
packageId = (
|
|
117548
|
+
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;
|
|
117749
117549
|
if (importLiteral.pos === -1)
|
|
117750
117550
|
return { file: file, packageId: packageId, text: importLiteral.text };
|
|
117751
117551
|
pos = ts.skipTrivia(file.text, importLiteral.pos);
|
|
@@ -117756,7 +117556,7 @@ var ts;
|
|
|
117756
117556
|
break;
|
|
117757
117557
|
case ts.FileIncludeKind.TypeReferenceDirective:
|
|
117758
117558
|
(_b = file.typeReferenceDirectives[index], pos = _b.pos, end = _b.end, resolutionMode = _b.resolutionMode);
|
|
117759
|
-
packageId = (
|
|
117559
|
+
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;
|
|
117760
117560
|
break;
|
|
117761
117561
|
case ts.FileIncludeKind.LibReferenceDirective:
|
|
117762
117562
|
(_c = file.libReferenceDirectives[index], pos = _c.pos, end = _c.end);
|
|
@@ -117986,10 +117786,10 @@ var ts;
|
|
|
117986
117786
|
};
|
|
117987
117787
|
}
|
|
117988
117788
|
function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) {
|
|
117989
|
-
var _a, _b, _c, _d
|
|
117789
|
+
var _a, _b, _c, _d;
|
|
117990
117790
|
var createProgramOptions = ts.isArray(rootNamesOrOptions) ? createCreateProgramOptions(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) : rootNamesOrOptions; // TODO: GH#18217
|
|
117991
117791
|
var rootNames = createProgramOptions.rootNames, options = createProgramOptions.options, configFileParsingDiagnostics = createProgramOptions.configFileParsingDiagnostics, projectReferences = createProgramOptions.projectReferences;
|
|
117992
|
-
var
|
|
117792
|
+
var oldProgram = createProgramOptions.oldProgram;
|
|
117993
117793
|
var processingDefaultLibFiles;
|
|
117994
117794
|
var processingOtherFiles;
|
|
117995
117795
|
var files;
|
|
@@ -118003,8 +117803,6 @@ var ts;
|
|
|
118003
117803
|
var cachedDeclarationDiagnosticsForFile = {};
|
|
118004
117804
|
var resolvedTypeReferenceDirectives = ts.createModeAwareCache();
|
|
118005
117805
|
var fileProcessingDiagnostics;
|
|
118006
|
-
var automaticTypeDirectiveNames;
|
|
118007
|
-
var automaticTypeDirectiveResolutions;
|
|
118008
117806
|
// The below settings are to track if a .js file should be add to the program if loaded via searching under node_modules.
|
|
118009
117807
|
// This works as imported modules are discovered recursively in a depth first manner, specifically:
|
|
118010
117808
|
// - For each root file, findSourceFile is called.
|
|
@@ -118026,11 +117824,6 @@ var ts;
|
|
|
118026
117824
|
var skipDefaultLib = options.noLib;
|
|
118027
117825
|
var getDefaultLibraryFileName = ts.memoize(function () { return host.getDefaultLibFileName(options); });
|
|
118028
117826
|
var defaultLibraryPath = host.getDefaultLibLocation ? host.getDefaultLibLocation() : ts.getDirectoryPath(getDefaultLibraryFileName());
|
|
118029
|
-
/**
|
|
118030
|
-
* Diagnostics for the program
|
|
118031
|
-
* Only add diagnostics directly if it always would be done irrespective of program structure reuse.
|
|
118032
|
-
* Otherwise fileProcessingDiagnostics is correct locations so that the diagnostics can be reported in all structure use scenarios
|
|
118033
|
-
*/
|
|
118034
117827
|
var programDiagnostics = ts.createDiagnosticCollection();
|
|
118035
117828
|
var currentDirectory = host.getCurrentDirectory();
|
|
118036
117829
|
var supportedExtensions = ts.getSupportedExtensions(options);
|
|
@@ -118043,71 +117836,30 @@ var ts;
|
|
|
118043
117836
|
var actualResolveModuleNamesWorker;
|
|
118044
117837
|
var hasInvalidatedResolution = host.hasInvalidatedResolution || ts.returnFalse;
|
|
118045
117838
|
if (host.resolveModuleNames) {
|
|
118046
|
-
actualResolveModuleNamesWorker = function (moduleNames, containingFile, containingFileName, redirectedReference,
|
|
118047
|
-
|
|
118048
|
-
|
|
118049
|
-
|
|
118050
|
-
|
|
118051
|
-
|
|
118052
|
-
|
|
118053
|
-
|
|
118054
|
-
|
|
118055
|
-
resolved.extension !== undefined ?
|
|
118056
|
-
// An older host may have omitted extension, in which case we should infer it from the file extension of resolvedFileName.
|
|
118057
|
-
{ resolvedModule: resolved, failedLookupLocations: emptyResolution.failedLookupLocations } :
|
|
118058
|
-
{ resolvedModule: __assign(__assign({}, resolved), { extension: ts.extensionFromPath(resolved.resolvedFileName) }), failedLookupLocations: emptyResolution.failedLookupLocations } :
|
|
118059
|
-
emptyResolution; });
|
|
118060
|
-
};
|
|
117839
|
+
actualResolveModuleNamesWorker = function (moduleNames, containingFile, containingFileName, reusedNames, redirectedReference) { return host.resolveModuleNames(ts.Debug.checkEachDefined(moduleNames), containingFileName, reusedNames, redirectedReference, options, containingFile).map(function (resolved) {
|
|
117840
|
+
// An older host may have omitted extension, in which case we should infer it from the file extension of resolvedFileName.
|
|
117841
|
+
if (!resolved || resolved.extension !== undefined) {
|
|
117842
|
+
return resolved;
|
|
117843
|
+
}
|
|
117844
|
+
var withExtension = ts.clone(resolved);
|
|
117845
|
+
withExtension.extension = ts.extensionFromPath(resolved.resolvedFileName);
|
|
117846
|
+
return withExtension;
|
|
117847
|
+
}); };
|
|
118061
117848
|
moduleResolutionCache = (_a = host.getModuleResolutionCache) === null || _a === void 0 ? void 0 : _a.call(host);
|
|
118062
117849
|
}
|
|
118063
117850
|
else {
|
|
118064
117851
|
moduleResolutionCache = ts.createModuleResolutionCache(currentDirectory, getCanonicalFileName, options);
|
|
118065
|
-
var loader_1 = function (moduleName, resolverMode, containingFileName, redirectedReference) { return ts.resolveModuleName(moduleName, containingFileName, options, host, moduleResolutionCache, redirectedReference, resolverMode); };
|
|
118066
|
-
actualResolveModuleNamesWorker = function (moduleNames, containingFile, containingFileName, redirectedReference,
|
|
118067
|
-
return loadWithModeAwareCache(moduleNames, containingFile, containingFileName, redirectedReference, partialResolutionInfo, loader_1);
|
|
118068
|
-
};
|
|
117852
|
+
var loader_1 = function (moduleName, resolverMode, containingFileName, redirectedReference) { return ts.resolveModuleName(moduleName, containingFileName, options, host, moduleResolutionCache, redirectedReference, resolverMode).resolvedModule; }; // TODO: GH#18217
|
|
117853
|
+
actualResolveModuleNamesWorker = function (moduleNames, containingFile, containingFileName, _reusedNames, redirectedReference) { return loadWithModeAwareCache(ts.Debug.checkEachDefined(moduleNames), containingFile, containingFileName, redirectedReference, loader_1); };
|
|
118069
117854
|
}
|
|
118070
117855
|
var actualResolveTypeReferenceDirectiveNamesWorker;
|
|
118071
117856
|
if (host.resolveTypeReferenceDirectives) {
|
|
118072
|
-
actualResolveTypeReferenceDirectiveNamesWorker = function (typeDirectiveNames, containingFile, redirectedReference, containingFileMode,
|
|
118073
|
-
var result = host.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference, options, containingFileMode, partialResolutionInfo);
|
|
118074
|
-
return result.some(isResolvedTypeReferenceDirectiveWithFailedLookupLocations) ?
|
|
118075
|
-
result :
|
|
118076
|
-
result.map(function (resolved) { return resolved ?
|
|
118077
|
-
{ resolvedTypeReferenceDirective: resolved, failedLookupLocations: emptyResolution.failedLookupLocations } :
|
|
118078
|
-
emptyResolution; });
|
|
118079
|
-
};
|
|
118080
|
-
typeReferenceDirectiveResolutionCache = (_b = host.getTypeReferenceDirectiveResolutionCache) === null || _b === void 0 ? void 0 : _b.call(host);
|
|
117857
|
+
actualResolveTypeReferenceDirectiveNamesWorker = function (typeDirectiveNames, containingFile, redirectedReference, containingFileMode) { return host.resolveTypeReferenceDirectives(ts.Debug.checkEachDefined(typeDirectiveNames), containingFile, redirectedReference, options, containingFileMode); };
|
|
118081
117858
|
}
|
|
118082
117859
|
else {
|
|
118083
117860
|
typeReferenceDirectiveResolutionCache = ts.createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, /*options*/ undefined, moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache());
|
|
118084
|
-
var loader_2 = function (typesRef, containingFile, redirectedReference, resolutionMode) { return ts.resolveTypeReferenceDirective(typesRef, containingFile, options, host, redirectedReference, typeReferenceDirectiveResolutionCache, resolutionMode); };
|
|
118085
|
-
actualResolveTypeReferenceDirectiveNamesWorker = function (typeReferenceDirectiveNames, containingFile, redirectedReference, containingFileMode) {
|
|
118086
|
-
return loadWithTypeDirectiveCache(typeReferenceDirectiveNames, containingFile, redirectedReference, containingFileMode, loader_2);
|
|
118087
|
-
};
|
|
118088
|
-
}
|
|
118089
|
-
var oldProgram = typeof oldProgramOrOldBuildInfoProgramConstructor === "object" ? oldProgramOrOldBuildInfoProgramConstructor : undefined;
|
|
118090
|
-
var oldBuildInfoProgram;
|
|
118091
|
-
if (!oldProgram && typeof oldProgramOrOldBuildInfoProgramConstructor === "function") {
|
|
118092
|
-
var state_11 = ts.getTemporaryModuleResolutionState(moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache(), host, options);
|
|
118093
|
-
oldBuildInfoProgram = oldProgramOrOldBuildInfoProgramConstructor({
|
|
118094
|
-
fileExists: function (fileName) { return host.fileExists(fileName); },
|
|
118095
|
-
createHash: ts.maybeBind(host, host.createHash),
|
|
118096
|
-
getPackageJsonInfo: function (fileName) { return ts.getPackageJsonInfo(ts.getDirectoryPath(fileName), /*onlyRecordFailures*/ false, state_11); },
|
|
118097
|
-
});
|
|
118098
|
-
if (oldBuildInfoProgram) {
|
|
118099
|
-
// Ensure redirected references are verified before using existing cache
|
|
118100
|
-
moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.setOldResolutionCache({
|
|
118101
|
-
getResolved: function (dirPath, name, mode, redirectedReference) {
|
|
118102
|
-
return oldBuildInfoProgram === null || oldBuildInfoProgram === void 0 ? void 0 : oldBuildInfoProgram.getResolvedModule(dirPath, name, mode, redirectedReference);
|
|
118103
|
-
}
|
|
118104
|
-
});
|
|
118105
|
-
typeReferenceDirectiveResolutionCache === null || typeReferenceDirectiveResolutionCache === void 0 ? void 0 : typeReferenceDirectiveResolutionCache.setOldResolutionCache({
|
|
118106
|
-
getResolved: function (dirPath, name, mode, redirectedReference) {
|
|
118107
|
-
return oldBuildInfoProgram === null || oldBuildInfoProgram === void 0 ? void 0 : oldBuildInfoProgram.getResolvedTypeReferenceDirective(dirPath, name, mode, redirectedReference);
|
|
118108
|
-
}
|
|
118109
|
-
});
|
|
118110
|
-
}
|
|
117861
|
+
var loader_2 = function (typesRef, containingFile, redirectedReference, resolutionMode) { return ts.resolveTypeReferenceDirective(typesRef, containingFile, options, host, redirectedReference, typeReferenceDirectiveResolutionCache, resolutionMode).resolvedTypeReferenceDirective; }; // TODO: GH#18217
|
|
117862
|
+
actualResolveTypeReferenceDirectiveNamesWorker = function (typeReferenceDirectiveNames, containingFile, redirectedReference, containingFileMode) { return loadWithTypeDirectiveCache(ts.Debug.checkEachDefined(typeReferenceDirectiveNames), containingFile, redirectedReference, containingFileMode, loader_2); };
|
|
118111
117863
|
}
|
|
118112
117864
|
// Map from a stringified PackageId to the source file with that id.
|
|
118113
117865
|
// Only one source file may have a given packageId. Others become redirects (see createRedirectSourceFile).
|
|
@@ -118134,9 +117886,9 @@ var ts;
|
|
|
118134
117886
|
var projectReferenceRedirects;
|
|
118135
117887
|
var mapFromFileToProjectReferenceRedirects;
|
|
118136
117888
|
var mapFromToProjectReferenceRedirectSource;
|
|
118137
|
-
var useSourceOfProjectReferenceRedirect = !!((
|
|
117889
|
+
var useSourceOfProjectReferenceRedirect = !!((_b = host.useSourceOfProjectReferenceRedirect) === null || _b === void 0 ? void 0 : _b.call(host)) &&
|
|
118138
117890
|
!options.disableSourceOfProjectReferenceRedirect;
|
|
118139
|
-
var
|
|
117891
|
+
var _e = updateHostForUseSourceOfProjectReferenceRedirect({
|
|
118140
117892
|
compilerHost: host,
|
|
118141
117893
|
getSymlinkCache: getSymlinkCache,
|
|
118142
117894
|
useSourceOfProjectReferenceRedirect: useSourceOfProjectReferenceRedirect,
|
|
@@ -118144,7 +117896,7 @@ var ts;
|
|
|
118144
117896
|
getResolvedProjectReferences: getResolvedProjectReferences,
|
|
118145
117897
|
getSourceOfProjectReferenceRedirect: getSourceOfProjectReferenceRedirect,
|
|
118146
117898
|
forEachResolvedProjectReference: forEachResolvedProjectReference
|
|
118147
|
-
}), onProgramCreateComplete =
|
|
117899
|
+
}), onProgramCreateComplete = _e.onProgramCreateComplete, fileExists = _e.fileExists, directoryExists = _e.directoryExists;
|
|
118148
117900
|
var readFile = host.readFile.bind(host);
|
|
118149
117901
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program" /* Program */, "shouldProgramCreateNewSourceFiles", { hasOldProgram: !!oldProgram });
|
|
118150
117902
|
var shouldCreateNewSourceFile = shouldProgramCreateNewSourceFiles(oldProgram, options);
|
|
@@ -118155,7 +117907,7 @@ var ts;
|
|
|
118155
117907
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program" /* Program */, "tryReuseStructureFromOldProgram", {});
|
|
118156
117908
|
structureIsReused = tryReuseStructureFromOldProgram(); // eslint-disable-line prefer-const
|
|
118157
117909
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
118158
|
-
if (structureIsReused !==
|
|
117910
|
+
if (structureIsReused !== 2 /* Completely */) {
|
|
118159
117911
|
processingDefaultLibFiles = [];
|
|
118160
117912
|
processingOtherFiles = [];
|
|
118161
117913
|
if (projectReferences) {
|
|
@@ -118196,15 +117948,16 @@ var ts;
|
|
|
118196
117948
|
ts.forEach(rootNames, function (name, index) { return processRootFile(name, /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false, { kind: ts.FileIncludeKind.RootFile, index: index }); });
|
|
118197
117949
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
118198
117950
|
// load type declarations specified via 'types' argument or implicitly from types/ and node_modules/@types folders
|
|
118199
|
-
|
|
118200
|
-
|
|
118201
|
-
|
|
118202
|
-
|
|
118203
|
-
var
|
|
118204
|
-
|
|
117951
|
+
var typeReferences = rootNames.length ? ts.getAutomaticTypeDirectiveNames(options, host) : ts.emptyArray;
|
|
117952
|
+
if (typeReferences.length) {
|
|
117953
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program" /* Program */, "processTypeReferences", { count: typeReferences.length });
|
|
117954
|
+
// This containingFilename needs to match with the one used in managed-side
|
|
117955
|
+
var containingDirectory = options.configFilePath ? ts.getDirectoryPath(options.configFilePath) : host.getCurrentDirectory();
|
|
117956
|
+
var containingFilename = ts.combinePaths(containingDirectory, ts.inferredTypesContainingFile);
|
|
117957
|
+
var resolutions = resolveTypeReferenceDirectiveNamesWorker(typeReferences, containingFilename);
|
|
117958
|
+
for (var i = 0; i < typeReferences.length; i++) {
|
|
118205
117959
|
// under node16/nodenext module resolution, load `types`/ata include names as cjs resolution results by passing an `undefined` mode
|
|
118206
|
-
|
|
118207
|
-
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 });
|
|
117960
|
+
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 });
|
|
118208
117961
|
}
|
|
118209
117962
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
118210
117963
|
}
|
|
@@ -118244,13 +117997,13 @@ var ts;
|
|
|
118244
117997
|
if (shouldCreateNewSourceFile || !newFile ||
|
|
118245
117998
|
// old file wasn't redirect but new file is
|
|
118246
117999
|
(oldSourceFile.resolvedPath === oldSourceFile.path && newFile.resolvedPath !== oldSourceFile.path)) {
|
|
118247
|
-
host.onReleaseOldSourceFile(oldSourceFile, oldProgram.getCompilerOptions());
|
|
118000
|
+
host.onReleaseOldSourceFile(oldSourceFile, oldProgram.getCompilerOptions(), !!getSourceFileByPath(oldSourceFile.path));
|
|
118248
118001
|
}
|
|
118249
118002
|
}
|
|
118250
118003
|
if (!host.getParsedCommandLine) {
|
|
118251
118004
|
oldProgram.forEachResolvedProjectReference(function (resolvedProjectReference) {
|
|
118252
118005
|
if (!getResolvedProjectReferenceByPath(resolvedProjectReference.sourceFile.path)) {
|
|
118253
|
-
host.onReleaseOldSourceFile(resolvedProjectReference.sourceFile, oldProgram.getCompilerOptions());
|
|
118006
|
+
host.onReleaseOldSourceFile(resolvedProjectReference.sourceFile, oldProgram.getCompilerOptions(), /*hasSourceFileByPath*/ false);
|
|
118254
118007
|
}
|
|
118255
118008
|
});
|
|
118256
118009
|
}
|
|
@@ -118268,8 +118021,6 @@ var ts;
|
|
|
118268
118021
|
typeReferenceDirectiveResolutionCache = undefined;
|
|
118269
118022
|
// unconditionally set oldProgram to undefined to prevent it from being captured in closure
|
|
118270
118023
|
oldProgram = undefined;
|
|
118271
|
-
oldBuildInfoProgram = undefined;
|
|
118272
|
-
oldProgramOrOldBuildInfoProgramConstructor = undefined;
|
|
118273
118024
|
var program = {
|
|
118274
118025
|
getRootFileNames: function () { return rootNames; },
|
|
118275
118026
|
getSourceFile: getSourceFile,
|
|
@@ -118277,7 +118028,6 @@ var ts;
|
|
|
118277
118028
|
getSourceFiles: function () { return files; },
|
|
118278
118029
|
getMissingFilePaths: function () { return missingFilePaths; },
|
|
118279
118030
|
getModuleResolutionCache: function () { return moduleResolutionCache; },
|
|
118280
|
-
getTypeReferenceDirectiveResolutionCache: function () { return typeReferenceDirectiveResolutionCache; },
|
|
118281
118031
|
getFilesByNameMap: function () { return filesByName; },
|
|
118282
118032
|
getCompilerOptions: function () { return options; },
|
|
118283
118033
|
getSyntacticDiagnostics: getSyntacticDiagnostics,
|
|
@@ -118302,9 +118052,6 @@ var ts;
|
|
|
118302
118052
|
getRelationCacheSizes: function () { return getTypeChecker().getRelationCacheSizes(); },
|
|
118303
118053
|
getFileProcessingDiagnostics: function () { return fileProcessingDiagnostics; },
|
|
118304
118054
|
getResolvedTypeReferenceDirectives: function () { return resolvedTypeReferenceDirectives; },
|
|
118305
|
-
getAutomaticTypeDirectiveNames: function () { return automaticTypeDirectiveNames; },
|
|
118306
|
-
getAutomaticTypeDirectiveResolutions: function () { return automaticTypeDirectiveResolutions; },
|
|
118307
|
-
getAutomaticTypeDirectiveContainingFile: getAutomaticTypeDirectiveContainingFile,
|
|
118308
118055
|
isSourceFileFromExternalLibrary: isSourceFileFromExternalLibrary,
|
|
118309
118056
|
isSourceFileDefaultLibrary: isSourceFileDefaultLibrary,
|
|
118310
118057
|
getSourceFileFromReference: getSourceFileFromReference,
|
|
@@ -118314,12 +118061,12 @@ var ts;
|
|
|
118314
118061
|
usesUriStyleNodeCoreModules: usesUriStyleNodeCoreModules,
|
|
118315
118062
|
isEmittedFile: isEmittedFile,
|
|
118316
118063
|
getConfigFileParsingDiagnostics: getConfigFileParsingDiagnostics,
|
|
118064
|
+
getResolvedModuleWithFailedLookupLocationsFromCache: getResolvedModuleWithFailedLookupLocationsFromCache,
|
|
118317
118065
|
getProjectReferences: getProjectReferences,
|
|
118318
118066
|
getResolvedProjectReferences: getResolvedProjectReferences,
|
|
118319
118067
|
getProjectReferenceRedirect: getProjectReferenceRedirect,
|
|
118320
118068
|
getResolvedProjectReferenceToRedirect: getResolvedProjectReferenceToRedirect,
|
|
118321
118069
|
getResolvedProjectReferenceByPath: getResolvedProjectReferenceByPath,
|
|
118322
|
-
getRedirectReferenceForResolution: getRedirectReferenceForResolution,
|
|
118323
118070
|
forEachResolvedProjectReference: forEachResolvedProjectReference,
|
|
118324
118071
|
isSourceOfProjectReferenceRedirect: isSourceOfProjectReferenceRedirect,
|
|
118325
118072
|
emitBuildInfo: emitBuildInfo,
|
|
@@ -118327,7 +118074,7 @@ var ts;
|
|
|
118327
118074
|
readFile: readFile,
|
|
118328
118075
|
directoryExists: directoryExists,
|
|
118329
118076
|
getSymlinkCache: getSymlinkCache,
|
|
118330
|
-
realpath: (
|
|
118077
|
+
realpath: (_d = host.realpath) === null || _d === void 0 ? void 0 : _d.bind(host),
|
|
118331
118078
|
useCaseSensitiveFileNames: function () { return host.useCaseSensitiveFileNames(); },
|
|
118332
118079
|
getFileIncludeReasons: function () { return fileReasons; },
|
|
118333
118080
|
structureIsReused: structureIsReused,
|
|
@@ -118342,8 +118089,6 @@ var ts;
|
|
|
118342
118089
|
case 0 /* FilePreprocessingReferencedDiagnostic */:
|
|
118343
118090
|
var _a = getReferencedFileLocation(getSourceFileByPath, diagnostic.reason), file = _a.file, pos = _a.pos, end = _a.end;
|
|
118344
118091
|
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)));
|
|
118345
|
-
case 2 /* ResolutionDiagnostics */:
|
|
118346
|
-
return diagnostic.diagnostics.forEach(function (d) { return programDiagnostics.add(d); });
|
|
118347
118092
|
default:
|
|
118348
118093
|
ts.Debug.assertNever(diagnostic);
|
|
118349
118094
|
}
|
|
@@ -118353,46 +118098,63 @@ var ts;
|
|
|
118353
118098
|
ts.performance.measure("Program", "beforeProgram", "afterProgram");
|
|
118354
118099
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
118355
118100
|
return program;
|
|
118356
|
-
function
|
|
118357
|
-
|
|
118358
|
-
|
|
118359
|
-
|
|
118101
|
+
function addResolutionDiagnostics(list) {
|
|
118102
|
+
if (!list)
|
|
118103
|
+
return;
|
|
118104
|
+
for (var _i = 0, list_3 = list; _i < list_3.length; _i++) {
|
|
118105
|
+
var elem = list_3[_i];
|
|
118106
|
+
programDiagnostics.add(elem);
|
|
118107
|
+
}
|
|
118360
118108
|
}
|
|
118361
|
-
function
|
|
118362
|
-
|
|
118109
|
+
function pullDiagnosticsFromCache(names, containingFile) {
|
|
118110
|
+
var _a;
|
|
118111
|
+
if (!moduleResolutionCache)
|
|
118363
118112
|
return;
|
|
118364
|
-
|
|
118365
|
-
|
|
118366
|
-
|
|
118367
|
-
|
|
118368
|
-
|
|
118369
|
-
|
|
118370
|
-
|
|
118113
|
+
var containingFileName = ts.getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory);
|
|
118114
|
+
var containingFileMode = !ts.isString(containingFile) ? containingFile.impliedNodeFormat : undefined;
|
|
118115
|
+
var containingDir = ts.getDirectoryPath(containingFileName);
|
|
118116
|
+
var redirectedReference = getRedirectReferenceForResolution(containingFile);
|
|
118117
|
+
var i = 0;
|
|
118118
|
+
for (var _i = 0, names_4 = names; _i < names_4.length; _i++) {
|
|
118119
|
+
var n = names_4[_i];
|
|
118120
|
+
// 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
|
|
118121
|
+
var mode = typeof n === "string" ? getModeForResolutionAtIndex(containingFile, i) : getModeForFileReference(n, containingFileMode);
|
|
118122
|
+
var name = typeof n === "string" ? n : n.fileName;
|
|
118123
|
+
i++;
|
|
118124
|
+
// only nonrelative names hit the cache, and, at least as of right now, only nonrelative names can issue diagnostics
|
|
118125
|
+
// (Since diagnostics are only issued via import or export map lookup)
|
|
118126
|
+
// This may totally change if/when the issue of output paths not mapping to input files is fixed in a broader context
|
|
118127
|
+
// When it is, how we extract diagnostics from the module name resolver will have the be refined - the current cache
|
|
118128
|
+
// APIs wrapping the underlying resolver make it almost impossible to smuggle the diagnostics out in a generalized way
|
|
118129
|
+
if (ts.isExternalModuleNameRelative(name))
|
|
118130
|
+
continue;
|
|
118131
|
+
var diags = (_a = moduleResolutionCache.getOrCreateCacheForModuleName(name, mode, redirectedReference).get(containingDir)) === null || _a === void 0 ? void 0 : _a.resolutionDiagnostics;
|
|
118132
|
+
addResolutionDiagnostics(diags);
|
|
118133
|
+
}
|
|
118371
118134
|
}
|
|
118372
|
-
function resolveModuleNamesWorker(moduleNames, containingFile,
|
|
118135
|
+
function resolveModuleNamesWorker(moduleNames, containingFile, reusedNames) {
|
|
118373
118136
|
if (!moduleNames.length)
|
|
118374
118137
|
return ts.emptyArray;
|
|
118375
118138
|
var containingFileName = ts.getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory);
|
|
118376
|
-
|
|
118377
|
-
redirectedReference = getRedirectReferenceForResolution(containingFile);
|
|
118139
|
+
var redirectedReference = getRedirectReferenceForResolution(containingFile);
|
|
118378
118140
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program" /* Program */, "resolveModuleNamesWorker", { containingFileName: containingFileName });
|
|
118379
118141
|
ts.performance.mark("beforeResolveModule");
|
|
118380
|
-
var result = actualResolveModuleNamesWorker(moduleNames, containingFile, containingFileName,
|
|
118142
|
+
var result = actualResolveModuleNamesWorker(moduleNames, containingFile, containingFileName, reusedNames, redirectedReference);
|
|
118381
118143
|
ts.performance.mark("afterResolveModule");
|
|
118382
118144
|
ts.performance.measure("ResolveModule", "beforeResolveModule", "afterResolveModule");
|
|
118383
118145
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
118146
|
+
pullDiagnosticsFromCache(moduleNames, containingFile);
|
|
118384
118147
|
return result;
|
|
118385
118148
|
}
|
|
118386
|
-
function resolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFile
|
|
118149
|
+
function resolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFile) {
|
|
118387
118150
|
if (!typeDirectiveNames.length)
|
|
118388
118151
|
return [];
|
|
118389
118152
|
var containingFileName = !ts.isString(containingFile) ? ts.getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory) : containingFile;
|
|
118390
|
-
|
|
118391
|
-
redirectedReference = getRedirectReferenceForResolution(containingFile);
|
|
118153
|
+
var redirectedReference = !ts.isString(containingFile) ? getRedirectReferenceForResolution(containingFile) : undefined;
|
|
118392
118154
|
var containingFileMode = !ts.isString(containingFile) ? containingFile.impliedNodeFormat : undefined;
|
|
118393
118155
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program" /* Program */, "resolveTypeReferenceDirectiveNamesWorker", { containingFileName: containingFileName });
|
|
118394
118156
|
ts.performance.mark("beforeResolveTypeReference");
|
|
118395
|
-
var result = actualResolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFileName, redirectedReference
|
|
118157
|
+
var result = actualResolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFileName, redirectedReference, containingFileMode);
|
|
118396
118158
|
ts.performance.mark("afterResolveTypeReference");
|
|
118397
118159
|
ts.performance.measure("ResolveTypeReference", "beforeResolveTypeReference", "afterResolveTypeReference");
|
|
118398
118160
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
@@ -118445,6 +118207,9 @@ var ts;
|
|
|
118445
118207
|
}
|
|
118446
118208
|
return ts.libs.length + 2;
|
|
118447
118209
|
}
|
|
118210
|
+
function getResolvedModuleWithFailedLookupLocationsFromCache(moduleName, containingFile, mode) {
|
|
118211
|
+
return moduleResolutionCache && ts.resolveModuleNameFromCache(moduleName, containingFile, moduleResolutionCache, mode);
|
|
118212
|
+
}
|
|
118448
118213
|
function toPath(fileName) {
|
|
118449
118214
|
return ts.toPath(fileName, currentDirectory, getCanonicalFileName);
|
|
118450
118215
|
}
|
|
@@ -118469,11 +118234,10 @@ var ts;
|
|
|
118469
118234
|
return classifiableNames;
|
|
118470
118235
|
}
|
|
118471
118236
|
function resolveModuleNamesReusingOldState(moduleNames, file) {
|
|
118472
|
-
var _a;
|
|
118473
118237
|
if (structureIsReused === 0 /* Not */ && !file.ambientModuleNames.length) {
|
|
118474
118238
|
// If the old program state does not permit reusing resolutions and `file` does not contain locally defined ambient modules,
|
|
118475
118239
|
// the best we can do is fallback to the default logic.
|
|
118476
|
-
return resolveModuleNamesWorker(moduleNames, file, /*
|
|
118240
|
+
return resolveModuleNamesWorker(moduleNames, file, /*reusedNames*/ undefined);
|
|
118477
118241
|
}
|
|
118478
118242
|
var oldSourceFile = oldProgram && oldProgram.getSourceFile(file.fileName);
|
|
118479
118243
|
if (oldSourceFile !== file && file.resolvedModules) {
|
|
@@ -118501,8 +118265,6 @@ var ts;
|
|
|
118501
118265
|
// With this information, we can infer some module resolutions without performing resolution.
|
|
118502
118266
|
/** An ordered list of module names for which we cannot recover the resolution. */
|
|
118503
118267
|
var unknownModuleNames;
|
|
118504
|
-
var unknownModuleNamesIndex;
|
|
118505
|
-
var reusedNames;
|
|
118506
118268
|
/**
|
|
118507
118269
|
* The indexing of elements in this list matches that of `moduleNames`.
|
|
118508
118270
|
*
|
|
@@ -118513,33 +118275,22 @@ var ts;
|
|
|
118513
118275
|
* * ResolvedModuleFull instance: can be reused.
|
|
118514
118276
|
*/
|
|
118515
118277
|
var result;
|
|
118278
|
+
var reusedNames;
|
|
118516
118279
|
/** A transient placeholder used to mark predicted resolution in the result list. */
|
|
118517
|
-
var predictedToResolveToAmbientModuleMarker =
|
|
118518
|
-
var redirectedReference;
|
|
118280
|
+
var predictedToResolveToAmbientModuleMarker = {};
|
|
118519
118281
|
for (var i = 0; i < moduleNames.length; i++) {
|
|
118520
118282
|
var moduleName = moduleNames[i];
|
|
118521
118283
|
// If the source file is unchanged and doesnt have invalidated resolution, reuse the module resolutions
|
|
118522
|
-
if (
|
|
118523
|
-
var
|
|
118524
|
-
|
|
118525
|
-
(_a = oldSourceFile === null || oldSourceFile === void 0 ? void 0 : oldSourceFile.resolvedModules) === null || _a === void 0 ? void 0 : _a.get(moduleName, mode) :
|
|
118526
|
-
oldBuildInfoProgram.getResolvedModule(ts.getDirectoryPath(file.path), moduleName, mode, (redirectedReference === undefined ? (redirectedReference = getRedirectReferenceForResolution(file) || false) : redirectedReference) || undefined);
|
|
118527
|
-
if (oldResolution === null || oldResolution === void 0 ? void 0 : oldResolution.resolvedModule) {
|
|
118284
|
+
if (file === oldSourceFile && !hasInvalidatedResolution(oldSourceFile.path)) {
|
|
118285
|
+
var oldResolvedModule = ts.getResolvedModule(oldSourceFile, moduleName, getModeForResolutionAtIndex(oldSourceFile, i));
|
|
118286
|
+
if (oldResolvedModule) {
|
|
118528
118287
|
if (ts.isTraceEnabled(options, host)) {
|
|
118529
|
-
|
|
118530
|
-
|
|
118531
|
-
ts.
|
|
118532
|
-
ts.Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 :
|
|
118533
|
-
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));
|
|
118534
|
-
}
|
|
118535
|
-
else {
|
|
118536
|
-
ts.trace(host, oldResolution.resolvedModule.packageId ?
|
|
118537
|
-
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 :
|
|
118538
|
-
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));
|
|
118539
|
-
}
|
|
118288
|
+
ts.trace(host, oldResolvedModule.packageId ?
|
|
118289
|
+
ts.Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 :
|
|
118290
|
+
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));
|
|
118540
118291
|
}
|
|
118541
|
-
(result
|
|
118542
|
-
(reusedNames
|
|
118292
|
+
(result || (result = new Array(moduleNames.length)))[i] = oldResolvedModule;
|
|
118293
|
+
(reusedNames || (reusedNames = [])).push(moduleName);
|
|
118543
118294
|
continue;
|
|
118544
118295
|
}
|
|
118545
118296
|
}
|
|
@@ -118558,16 +118309,15 @@ var ts;
|
|
|
118558
118309
|
resolvesToAmbientModuleInNonModifiedFile = moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName, i);
|
|
118559
118310
|
}
|
|
118560
118311
|
if (resolvesToAmbientModuleInNonModifiedFile) {
|
|
118561
|
-
(result
|
|
118312
|
+
(result || (result = new Array(moduleNames.length)))[i] = predictedToResolveToAmbientModuleMarker;
|
|
118562
118313
|
}
|
|
118563
118314
|
else {
|
|
118564
118315
|
// Resolution failed in the old program, or resolved to an ambient module for which we can't reuse the result.
|
|
118565
|
-
(unknownModuleNames
|
|
118566
|
-
(unknownModuleNamesIndex !== null && unknownModuleNamesIndex !== void 0 ? unknownModuleNamesIndex : (unknownModuleNamesIndex = [])).push(i);
|
|
118316
|
+
(unknownModuleNames || (unknownModuleNames = [])).push(moduleName);
|
|
118567
118317
|
}
|
|
118568
118318
|
}
|
|
118569
118319
|
var resolutions = unknownModuleNames && unknownModuleNames.length
|
|
118570
|
-
? resolveModuleNamesWorker(unknownModuleNames, file,
|
|
118320
|
+
? resolveModuleNamesWorker(unknownModuleNames, file, reusedNames)
|
|
118571
118321
|
: ts.emptyArray;
|
|
118572
118322
|
// Combine results of resolutions and predicted results
|
|
118573
118323
|
if (!result) {
|
|
@@ -118581,7 +118331,7 @@ var ts;
|
|
|
118581
118331
|
// `result[i]` is either a `ResolvedModuleFull` or a marker.
|
|
118582
118332
|
// If it is the former, we can leave it as is.
|
|
118583
118333
|
if (result[i] === predictedToResolveToAmbientModuleMarker) {
|
|
118584
|
-
result[i] =
|
|
118334
|
+
result[i] = undefined;
|
|
118585
118335
|
}
|
|
118586
118336
|
}
|
|
118587
118337
|
else {
|
|
@@ -118616,96 +118366,6 @@ var ts;
|
|
|
118616
118366
|
return true;
|
|
118617
118367
|
}
|
|
118618
118368
|
}
|
|
118619
|
-
function resolveTypeReferenceDirectiveNamesReusingOldState(typeDirectiveNames, containingFile) {
|
|
118620
|
-
var _a;
|
|
118621
|
-
if (structureIsReused === 0 /* Not */) {
|
|
118622
|
-
return resolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFile, /*partialResolutionInfo*/ undefined, /*redirectedReference*/ undefined);
|
|
118623
|
-
}
|
|
118624
|
-
var containingSourceFile = !ts.isString(containingFile) ? containingFile : undefined;
|
|
118625
|
-
var inferredTypeFile = !ts.isString(containingFile) ? undefined : containingFile;
|
|
118626
|
-
var oldSourceFile = containingSourceFile && (oldProgram === null || oldProgram === void 0 ? void 0 : oldProgram.getSourceFile(containingSourceFile.fileName));
|
|
118627
|
-
if (containingSourceFile && oldSourceFile !== containingSourceFile && containingSourceFile.resolvedTypeReferenceDirectiveNames) {
|
|
118628
|
-
// `file` was created for the new program.
|
|
118629
|
-
//
|
|
118630
|
-
// We only set `file.resolvedTypeReferenceDirectiveNames` via work from the current function,
|
|
118631
|
-
// so it is defined iff we already called the current function on `file`.
|
|
118632
|
-
// That call happened no later than the creation of the `file` object,
|
|
118633
|
-
// which per above occurred during the current program creation.
|
|
118634
|
-
// Since we assume the filesystem does not change during program creation,
|
|
118635
|
-
// it is safe to reuse resolutions from the earlier call.
|
|
118636
|
-
var result_15 = [];
|
|
118637
|
-
for (var _i = 0, _b = typeDirectiveNames; _i < _b.length; _i++) {
|
|
118638
|
-
var typeDirectiveName = _b[_i];
|
|
118639
|
-
// We lower-case all type references because npm automatically lowercases all packages. See GH#9824.
|
|
118640
|
-
var resolvedTypeReferenceDirective = containingSourceFile.resolvedTypeReferenceDirectiveNames.get(ts.toFileNameLowerCase(typeDirectiveName.fileName), typeDirectiveName.resolutionMode || containingSourceFile.impliedNodeFormat);
|
|
118641
|
-
result_15.push(resolvedTypeReferenceDirective);
|
|
118642
|
-
}
|
|
118643
|
-
return result_15;
|
|
118644
|
-
}
|
|
118645
|
-
/** An ordered list of module names for which we cannot recover the resolution. */
|
|
118646
|
-
var unknownTypeReferenceDirectiveNames;
|
|
118647
|
-
var unknownTypeReferenceDirectiveNamesIndex;
|
|
118648
|
-
/**
|
|
118649
|
-
* The indexing of elements in this list matches that of `moduleNames`.
|
|
118650
|
-
*
|
|
118651
|
-
* Before combining results, result[i] is in one of the following states:
|
|
118652
|
-
* * undefined: needs to be recomputed,
|
|
118653
|
-
*/
|
|
118654
|
-
var result;
|
|
118655
|
-
var reusedNames;
|
|
118656
|
-
var canReuseResolutions = oldBuildInfoProgram || (containingSourceFile ?
|
|
118657
|
-
containingSourceFile === oldSourceFile && !hasInvalidatedResolution(oldSourceFile.path) :
|
|
118658
|
-
!hasInvalidatedResolution(toPath(inferredTypeFile)));
|
|
118659
|
-
var redirectedReference;
|
|
118660
|
-
for (var i = 0; i < typeDirectiveNames.length; i++) {
|
|
118661
|
-
var entry = typeDirectiveNames[i];
|
|
118662
|
-
// If the source file is unchanged and doesnt have invalidated resolution, reuse the module resolutions
|
|
118663
|
-
if (canReuseResolutions) {
|
|
118664
|
-
var typeDirectiveName = !ts.isString(entry) ? entry.fileName.toLowerCase() : entry;
|
|
118665
|
-
var mode = getModeForFileReference(entry, containingSourceFile === null || containingSourceFile === void 0 ? void 0 : containingSourceFile.impliedNodeFormat);
|
|
118666
|
-
var oldResolution = !oldBuildInfoProgram ?
|
|
118667
|
-
(_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) :
|
|
118668
|
-
oldBuildInfoProgram.getResolvedTypeReferenceDirective(ts.getDirectoryPath(containingSourceFile ? containingSourceFile.path : toPath(inferredTypeFile)), typeDirectiveName, mode, containingSourceFile && (redirectedReference === undefined ? (redirectedReference = getRedirectReferenceForResolution(containingSourceFile) || false) : redirectedReference) || undefined);
|
|
118669
|
-
if (oldResolution === null || oldResolution === void 0 ? void 0 : oldResolution.resolvedTypeReferenceDirective) {
|
|
118670
|
-
if (ts.isTraceEnabled(options, host)) {
|
|
118671
|
-
var fileLocation = containingSourceFile ? ts.getNormalizedAbsolutePath(containingSourceFile.originalFileName, currentDirectory) : inferredTypeFile;
|
|
118672
|
-
if (!oldBuildInfoProgram) {
|
|
118673
|
-
ts.trace(host, oldResolution.resolvedTypeReferenceDirective.packageId ?
|
|
118674
|
-
ts.Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 :
|
|
118675
|
-
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));
|
|
118676
|
-
}
|
|
118677
|
-
else {
|
|
118678
|
-
ts.trace(host, oldResolution.resolvedTypeReferenceDirective.packageId ?
|
|
118679
|
-
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 :
|
|
118680
|
-
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));
|
|
118681
|
-
}
|
|
118682
|
-
}
|
|
118683
|
-
(result || (result = new Array(typeDirectiveNames.length)))[i] = oldResolution;
|
|
118684
|
-
(reusedNames !== null && reusedNames !== void 0 ? reusedNames : (reusedNames = [])).push({ name: typeDirectiveName, mode: mode });
|
|
118685
|
-
continue;
|
|
118686
|
-
}
|
|
118687
|
-
}
|
|
118688
|
-
// Resolution failed in the old program, or resolved to an ambient module for which we can't reuse the result.
|
|
118689
|
-
(unknownTypeReferenceDirectiveNames !== null && unknownTypeReferenceDirectiveNames !== void 0 ? unknownTypeReferenceDirectiveNames : (unknownTypeReferenceDirectiveNames = [])).push(entry);
|
|
118690
|
-
(unknownTypeReferenceDirectiveNamesIndex !== null && unknownTypeReferenceDirectiveNamesIndex !== void 0 ? unknownTypeReferenceDirectiveNamesIndex : (unknownTypeReferenceDirectiveNamesIndex = [])).push(i);
|
|
118691
|
-
}
|
|
118692
|
-
if (!unknownTypeReferenceDirectiveNames)
|
|
118693
|
-
return result || ts.emptyArray;
|
|
118694
|
-
var resolutions = resolveTypeReferenceDirectiveNamesWorker(unknownTypeReferenceDirectiveNames, containingFile, { reusedNames: reusedNames, namesIndex: unknownTypeReferenceDirectiveNamesIndex }, redirectedReference);
|
|
118695
|
-
if (!result) {
|
|
118696
|
-
ts.Debug.assert(resolutions.length === typeDirectiveNames.length);
|
|
118697
|
-
return resolutions;
|
|
118698
|
-
}
|
|
118699
|
-
var j = 0;
|
|
118700
|
-
for (var i = 0; i < result.length; i++) {
|
|
118701
|
-
if (!result[i]) {
|
|
118702
|
-
result[i] = resolutions[j];
|
|
118703
|
-
j++;
|
|
118704
|
-
}
|
|
118705
|
-
}
|
|
118706
|
-
ts.Debug.assert(j === resolutions.length);
|
|
118707
|
-
return result;
|
|
118708
|
-
}
|
|
118709
118369
|
function canReuseProjectReferences() {
|
|
118710
118370
|
return !forEachProjectReference(oldProgram.getProjectReferences(), oldProgram.getResolvedProjectReferences(), function (oldResolvedRef, parent, index) {
|
|
118711
118371
|
var newRef = (parent ? parent.commandLine.projectReferences : projectReferences)[index];
|
|
@@ -118727,19 +118387,14 @@ var ts;
|
|
|
118727
118387
|
});
|
|
118728
118388
|
}
|
|
118729
118389
|
function tryReuseStructureFromOldProgram() {
|
|
118730
|
-
|
|
118731
|
-
|
|
118732
|
-
var oldOptions = (oldProgram === null || oldProgram === void 0 ? void 0 : oldProgram.getCompilerOptions()) || (oldBuildInfoProgram === null || oldBuildInfoProgram === void 0 ? void 0 : oldBuildInfoProgram.getCompilerOptions());
|
|
118733
|
-
if (!oldOptions || ts.changesAffectModuleResolution(oldOptions, options)) {
|
|
118390
|
+
var _a;
|
|
118391
|
+
if (!oldProgram) {
|
|
118734
118392
|
return 0 /* Not */;
|
|
118735
118393
|
}
|
|
118736
|
-
|
|
118737
|
-
|
|
118738
|
-
|
|
118739
|
-
|
|
118740
|
-
}
|
|
118741
|
-
function tryReuseStructureFromOldProgramWorker() {
|
|
118742
|
-
if (!oldProgram) {
|
|
118394
|
+
// check properties that can affect structure of the program or module resolution strategy
|
|
118395
|
+
// if any of these properties has changed - structure cannot be reused
|
|
118396
|
+
var oldOptions = oldProgram.getCompilerOptions();
|
|
118397
|
+
if (ts.changesAffectModuleResolution(oldOptions, options)) {
|
|
118743
118398
|
return 0 /* Not */;
|
|
118744
118399
|
}
|
|
118745
118400
|
// there is an old program, check if we can reuse its structure
|
|
@@ -118757,7 +118412,7 @@ var ts;
|
|
|
118757
118412
|
// check if program source files has changed in the way that can affect structure of the program
|
|
118758
118413
|
var newSourceFiles = [];
|
|
118759
118414
|
var modifiedSourceFiles = [];
|
|
118760
|
-
structureIsReused =
|
|
118415
|
+
structureIsReused = 2 /* Completely */;
|
|
118761
118416
|
// If the missing file paths are now present, it can change the progam structure,
|
|
118762
118417
|
// and hence cant reuse the structure.
|
|
118763
118418
|
// This is same as how we dont reuse the structure if one of the file from old program is now missing
|
|
@@ -118821,107 +118476,98 @@ var ts;
|
|
|
118821
118476
|
// The `newSourceFile` object was created for the new program.
|
|
118822
118477
|
if (!ts.arrayIsEqualTo(oldSourceFile.libReferenceDirectives, newSourceFile.libReferenceDirectives, fileReferenceIsEqualTo)) {
|
|
118823
118478
|
// 'lib' references has changed. Matches behavior in changesAffectModuleResolution
|
|
118824
|
-
structureIsReused =
|
|
118479
|
+
structureIsReused = 1 /* SafeModules */;
|
|
118825
118480
|
}
|
|
118826
118481
|
if (oldSourceFile.hasNoDefaultLib !== newSourceFile.hasNoDefaultLib) {
|
|
118827
118482
|
// value of no-default-lib has changed
|
|
118828
118483
|
// this will affect if default library is injected into the list of files
|
|
118829
|
-
structureIsReused =
|
|
118484
|
+
structureIsReused = 1 /* SafeModules */;
|
|
118830
118485
|
}
|
|
118831
118486
|
// check tripleslash references
|
|
118832
118487
|
if (!ts.arrayIsEqualTo(oldSourceFile.referencedFiles, newSourceFile.referencedFiles, fileReferenceIsEqualTo)) {
|
|
118833
118488
|
// tripleslash references has changed
|
|
118834
|
-
structureIsReused =
|
|
118489
|
+
structureIsReused = 1 /* SafeModules */;
|
|
118835
118490
|
}
|
|
118836
118491
|
// check imports and module augmentations
|
|
118837
118492
|
collectExternalModuleReferences(newSourceFile);
|
|
118838
118493
|
if (!ts.arrayIsEqualTo(oldSourceFile.imports, newSourceFile.imports, moduleNameIsEqualTo)) {
|
|
118839
118494
|
// imports has changed
|
|
118840
|
-
structureIsReused =
|
|
118495
|
+
structureIsReused = 1 /* SafeModules */;
|
|
118841
118496
|
}
|
|
118842
118497
|
if (!ts.arrayIsEqualTo(oldSourceFile.moduleAugmentations, newSourceFile.moduleAugmentations, moduleNameIsEqualTo)) {
|
|
118843
118498
|
// moduleAugmentations has changed
|
|
118844
|
-
structureIsReused =
|
|
118499
|
+
structureIsReused = 1 /* SafeModules */;
|
|
118845
118500
|
}
|
|
118846
118501
|
if ((oldSourceFile.flags & 6291456 /* PermanentlySetIncrementalFlags */) !== (newSourceFile.flags & 6291456 /* PermanentlySetIncrementalFlags */)) {
|
|
118847
118502
|
// dynamicImport has changed
|
|
118848
|
-
structureIsReused =
|
|
118503
|
+
structureIsReused = 1 /* SafeModules */;
|
|
118849
118504
|
}
|
|
118850
118505
|
if (!ts.arrayIsEqualTo(oldSourceFile.typeReferenceDirectives, newSourceFile.typeReferenceDirectives, fileReferenceIsEqualTo)) {
|
|
118851
118506
|
// 'types' references has changed
|
|
118852
|
-
structureIsReused =
|
|
118507
|
+
structureIsReused = 1 /* SafeModules */;
|
|
118853
118508
|
}
|
|
118854
118509
|
// tentatively approve the file
|
|
118855
118510
|
modifiedSourceFiles.push({ oldFile: oldSourceFile, newFile: newSourceFile });
|
|
118856
118511
|
}
|
|
118857
118512
|
else if (hasInvalidatedResolution(oldSourceFile.path)) {
|
|
118858
118513
|
// 'module/types' references could have changed
|
|
118859
|
-
structureIsReused =
|
|
118514
|
+
structureIsReused = 1 /* SafeModules */;
|
|
118860
118515
|
// add file to the modified list so that we will resolve it later
|
|
118861
118516
|
modifiedSourceFiles.push({ oldFile: oldSourceFile, newFile: newSourceFile });
|
|
118862
118517
|
}
|
|
118863
118518
|
// if file has passed all checks it should be safe to reuse it
|
|
118864
118519
|
newSourceFiles.push(newSourceFile);
|
|
118865
118520
|
}
|
|
118866
|
-
if (structureIsReused !==
|
|
118521
|
+
if (structureIsReused !== 2 /* Completely */) {
|
|
118867
118522
|
return structureIsReused;
|
|
118868
118523
|
}
|
|
118869
118524
|
var modifiedFiles = modifiedSourceFiles.map(function (f) { return f.oldFile; });
|
|
118870
|
-
for (var
|
|
118871
|
-
var oldFile = oldSourceFiles_3[
|
|
118525
|
+
for (var _b = 0, oldSourceFiles_3 = oldSourceFiles; _b < oldSourceFiles_3.length; _b++) {
|
|
118526
|
+
var oldFile = oldSourceFiles_3[_b];
|
|
118872
118527
|
if (!ts.contains(modifiedFiles, oldFile)) {
|
|
118873
|
-
for (var
|
|
118874
|
-
var moduleName = _c
|
|
118528
|
+
for (var _c = 0, _d = oldFile.ambientModuleNames; _c < _d.length; _c++) {
|
|
118529
|
+
var moduleName = _d[_c];
|
|
118875
118530
|
ambientModuleNameToUnmodifiedFileName.set(moduleName, oldFile.fileName);
|
|
118876
118531
|
}
|
|
118877
118532
|
}
|
|
118878
118533
|
}
|
|
118879
118534
|
// try to verify results of module resolution
|
|
118880
|
-
for (var
|
|
118881
|
-
var
|
|
118535
|
+
for (var _e = 0, modifiedSourceFiles_1 = modifiedSourceFiles; _e < modifiedSourceFiles_1.length; _e++) {
|
|
118536
|
+
var _f = modifiedSourceFiles_1[_e], oldSourceFile = _f.oldFile, newSourceFile = _f.newFile;
|
|
118882
118537
|
var moduleNames = getModuleNames(newSourceFile);
|
|
118883
118538
|
var resolutions = resolveModuleNamesReusingOldState(moduleNames, newSourceFile);
|
|
118884
118539
|
// ensure that module resolution results are still correct
|
|
118885
118540
|
var resolutionsChanged = ts.hasChangesInResolutions(moduleNames, resolutions, oldSourceFile.resolvedModules, oldSourceFile, ts.moduleResolutionIsEqualTo);
|
|
118886
118541
|
if (resolutionsChanged) {
|
|
118887
|
-
structureIsReused =
|
|
118542
|
+
structureIsReused = 1 /* SafeModules */;
|
|
118888
118543
|
newSourceFile.resolvedModules = ts.zipToModeAwareCache(newSourceFile, moduleNames, resolutions);
|
|
118889
118544
|
}
|
|
118890
118545
|
else {
|
|
118891
118546
|
newSourceFile.resolvedModules = oldSourceFile.resolvedModules;
|
|
118892
118547
|
}
|
|
118893
118548
|
var typesReferenceDirectives = newSourceFile.typeReferenceDirectives;
|
|
118894
|
-
var typeReferenceResolutions =
|
|
118549
|
+
var typeReferenceResolutions = resolveTypeReferenceDirectiveNamesWorker(typesReferenceDirectives, newSourceFile);
|
|
118895
118550
|
// ensure that types resolutions are still correct
|
|
118896
118551
|
var typeReferenceResolutionsChanged = ts.hasChangesInResolutions(typesReferenceDirectives, typeReferenceResolutions, oldSourceFile.resolvedTypeReferenceDirectiveNames, oldSourceFile, ts.typeDirectiveIsEqualTo);
|
|
118897
118552
|
if (typeReferenceResolutionsChanged) {
|
|
118898
|
-
structureIsReused =
|
|
118553
|
+
structureIsReused = 1 /* SafeModules */;
|
|
118899
118554
|
newSourceFile.resolvedTypeReferenceDirectiveNames = ts.zipToModeAwareCache(newSourceFile, typesReferenceDirectives, typeReferenceResolutions);
|
|
118900
118555
|
}
|
|
118901
118556
|
else {
|
|
118902
118557
|
newSourceFile.resolvedTypeReferenceDirectiveNames = oldSourceFile.resolvedTypeReferenceDirectiveNames;
|
|
118903
118558
|
}
|
|
118904
118559
|
}
|
|
118905
|
-
if (structureIsReused !==
|
|
118560
|
+
if (structureIsReused !== 2 /* Completely */) {
|
|
118906
118561
|
return structureIsReused;
|
|
118907
118562
|
}
|
|
118908
|
-
if (ts.changesAffectingProgramStructure(
|
|
118909
|
-
return
|
|
118910
|
-
}
|
|
118911
|
-
if (host.hasChangedAutomaticTypeDirectiveNames) {
|
|
118912
|
-
if (host.hasChangedAutomaticTypeDirectiveNames())
|
|
118913
|
-
return 2 /* SafeModules */;
|
|
118914
|
-
}
|
|
118915
|
-
else {
|
|
118916
|
-
automaticTypeDirectiveNames = ts.getAutomaticTypeDirectiveNames(options, host);
|
|
118917
|
-
if (!ts.arrayIsEqualTo(oldProgram.getAutomaticTypeDirectiveNames(), automaticTypeDirectiveNames))
|
|
118918
|
-
return 2 /* SafeModules */;
|
|
118563
|
+
if (ts.changesAffectingProgramStructure(oldOptions, options) || ((_a = host.hasChangedAutomaticTypeDirectiveNames) === null || _a === void 0 ? void 0 : _a.call(host))) {
|
|
118564
|
+
return 1 /* SafeModules */;
|
|
118919
118565
|
}
|
|
118920
118566
|
missingFilePaths = oldProgram.getMissingFilePaths();
|
|
118921
118567
|
// update fileName -> file mapping
|
|
118922
118568
|
ts.Debug.assert(newSourceFiles.length === oldProgram.getSourceFiles().length);
|
|
118923
|
-
for (var
|
|
118924
|
-
var newSourceFile = newSourceFiles_1[
|
|
118569
|
+
for (var _g = 0, newSourceFiles_1 = newSourceFiles; _g < newSourceFiles_1.length; _g++) {
|
|
118570
|
+
var newSourceFile = newSourceFiles_1[_g];
|
|
118925
118571
|
filesByName.set(newSourceFile.path, newSourceFile);
|
|
118926
118572
|
}
|
|
118927
118573
|
var oldFilesByNameMap = oldProgram.getFilesByNameMap();
|
|
@@ -118943,12 +118589,10 @@ var ts;
|
|
|
118943
118589
|
fileReasons = oldProgram.getFileIncludeReasons();
|
|
118944
118590
|
fileProcessingDiagnostics = oldProgram.getFileProcessingDiagnostics();
|
|
118945
118591
|
resolvedTypeReferenceDirectives = oldProgram.getResolvedTypeReferenceDirectives();
|
|
118946
|
-
automaticTypeDirectiveNames = oldProgram.getAutomaticTypeDirectiveNames();
|
|
118947
|
-
automaticTypeDirectiveResolutions = oldProgram.getAutomaticTypeDirectiveResolutions();
|
|
118948
118592
|
sourceFileToPackageName = oldProgram.sourceFileToPackageName;
|
|
118949
118593
|
redirectTargetsMap = oldProgram.redirectTargetsMap;
|
|
118950
118594
|
usesUriStyleNodeCoreModules = oldProgram.usesUriStyleNodeCoreModules;
|
|
118951
|
-
return
|
|
118595
|
+
return 2 /* Completely */;
|
|
118952
118596
|
}
|
|
118953
118597
|
function getEmitHost(writeFileCallback) {
|
|
118954
118598
|
return {
|
|
@@ -119990,42 +119634,35 @@ var ts;
|
|
|
119990
119634
|
}
|
|
119991
119635
|
function processTypeReferenceDirectives(file) {
|
|
119992
119636
|
var typeDirectives = file.typeReferenceDirectives;
|
|
119993
|
-
if (!typeDirectives
|
|
119994
|
-
file.resolvedTypeReferenceDirectiveNames = undefined;
|
|
119637
|
+
if (!typeDirectives) {
|
|
119995
119638
|
return;
|
|
119996
119639
|
}
|
|
119997
|
-
var resolutions =
|
|
119640
|
+
var resolutions = resolveTypeReferenceDirectiveNamesWorker(typeDirectives, file);
|
|
119998
119641
|
for (var index = 0; index < typeDirectives.length; index++) {
|
|
119999
119642
|
var ref = file.typeReferenceDirectives[index];
|
|
120000
119643
|
var resolvedTypeReferenceDirective = resolutions[index];
|
|
120001
119644
|
// store resolved type directive on the file
|
|
120002
119645
|
var fileName = ts.toFileNameLowerCase(ref.fileName);
|
|
120003
|
-
ts.setResolvedTypeReferenceDirective(file, fileName, resolvedTypeReferenceDirective
|
|
119646
|
+
ts.setResolvedTypeReferenceDirective(file, fileName, resolvedTypeReferenceDirective);
|
|
120004
119647
|
var mode = ref.resolutionMode || file.impliedNodeFormat;
|
|
120005
119648
|
if (mode && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeNext) {
|
|
120006
|
-
(
|
|
120007
|
-
kind: 2 /* ResolutionDiagnostics */,
|
|
120008
|
-
diagnostics: [ts.createDiagnosticForRange(file, ref, ts.Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext)]
|
|
120009
|
-
});
|
|
119649
|
+
programDiagnostics.add(ts.createDiagnosticForRange(file, ref, ts.Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext));
|
|
120010
119650
|
}
|
|
120011
119651
|
processTypeReferenceDirective(fileName, mode, resolvedTypeReferenceDirective, { kind: ts.FileIncludeKind.TypeReferenceDirective, file: file.path, index: index, });
|
|
120012
119652
|
}
|
|
120013
119653
|
}
|
|
120014
|
-
function processTypeReferenceDirective(typeReferenceDirective, mode,
|
|
120015
|
-
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program" /* Program */, "processTypeReferenceDirective", { directive: typeReferenceDirective, hasResolved: !!
|
|
120016
|
-
processTypeReferenceDirectiveWorker(typeReferenceDirective, mode,
|
|
119654
|
+
function processTypeReferenceDirective(typeReferenceDirective, mode, resolvedTypeReferenceDirective, reason) {
|
|
119655
|
+
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 });
|
|
119656
|
+
processTypeReferenceDirectiveWorker(typeReferenceDirective, mode, resolvedTypeReferenceDirective, reason);
|
|
120017
119657
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
120018
119658
|
}
|
|
120019
|
-
function processTypeReferenceDirectiveWorker(typeReferenceDirective, mode,
|
|
120020
|
-
var _a;
|
|
120021
|
-
addResolutionDiagnostics(resolution);
|
|
119659
|
+
function processTypeReferenceDirectiveWorker(typeReferenceDirective, mode, resolvedTypeReferenceDirective, reason) {
|
|
120022
119660
|
// If we already found this library as a primary reference - nothing to do
|
|
120023
|
-
var previousResolution =
|
|
119661
|
+
var previousResolution = resolvedTypeReferenceDirectives.get(typeReferenceDirective, mode);
|
|
120024
119662
|
if (previousResolution && previousResolution.primary) {
|
|
120025
119663
|
return;
|
|
120026
119664
|
}
|
|
120027
119665
|
var saveResolution = true;
|
|
120028
|
-
var resolvedTypeReferenceDirective = resolution.resolvedTypeReferenceDirective;
|
|
120029
119666
|
if (resolvedTypeReferenceDirective) {
|
|
120030
119667
|
if (resolvedTypeReferenceDirective.isExternalLibraryImport)
|
|
120031
119668
|
currentNodeModulesDepth++;
|
|
@@ -120060,7 +119697,7 @@ var ts;
|
|
|
120060
119697
|
addFilePreprocessingFileExplainingDiagnostic(/*file*/ undefined, reason, ts.Diagnostics.Cannot_find_type_definition_file_for_0, [typeReferenceDirective]);
|
|
120061
119698
|
}
|
|
120062
119699
|
if (saveResolution) {
|
|
120063
|
-
resolvedTypeReferenceDirectives.set(typeReferenceDirective, mode,
|
|
119700
|
+
resolvedTypeReferenceDirectives.set(typeReferenceDirective, mode, resolvedTypeReferenceDirective);
|
|
120064
119701
|
}
|
|
120065
119702
|
}
|
|
120066
119703
|
function pathForLibFile(libFileName) {
|
|
@@ -120093,7 +119730,7 @@ var ts;
|
|
|
120093
119730
|
var unqualifiedLibName = ts.removeSuffix(ts.removePrefix(libName, "lib."), ".d.ts");
|
|
120094
119731
|
var suggestion = ts.getSpellingSuggestion(unqualifiedLibName, ts.libs, ts.identity);
|
|
120095
119732
|
var diagnostic = suggestion ? ts.Diagnostics.Cannot_find_lib_definition_for_0_Did_you_mean_1 : ts.Diagnostics.Cannot_find_lib_definition_for_0;
|
|
120096
|
-
(fileProcessingDiagnostics
|
|
119733
|
+
(fileProcessingDiagnostics || (fileProcessingDiagnostics = [])).push({
|
|
120097
119734
|
kind: 0 /* FilePreprocessingReferencedDiagnostic */,
|
|
120098
119735
|
reason: { kind: ts.FileIncludeKind.LibReferenceDirective, file: file.path, index: index, },
|
|
120099
119736
|
diagnostic: diagnostic,
|
|
@@ -120117,14 +119754,13 @@ var ts;
|
|
|
120117
119754
|
for (var index = 0; index < moduleNames.length; index++) {
|
|
120118
119755
|
var resolution = resolutions[index];
|
|
120119
119756
|
ts.setResolvedModule(file, moduleNames[index], resolution, getModeForResolutionAtIndex(file, index));
|
|
120120
|
-
|
|
120121
|
-
if (!resolution.resolvedModule) {
|
|
119757
|
+
if (!resolution) {
|
|
120122
119758
|
continue;
|
|
120123
119759
|
}
|
|
120124
|
-
var isFromNodeModulesSearch = resolution.
|
|
120125
|
-
var isJsFile = !ts.resolutionExtensionIsTSOrJson(resolution.
|
|
119760
|
+
var isFromNodeModulesSearch = resolution.isExternalLibraryImport;
|
|
119761
|
+
var isJsFile = !ts.resolutionExtensionIsTSOrJson(resolution.extension);
|
|
120126
119762
|
var isJsFileFromNodeModules = isFromNodeModulesSearch && isJsFile;
|
|
120127
|
-
var resolvedFileName = resolution.
|
|
119763
|
+
var resolvedFileName = resolution.resolvedFileName;
|
|
120128
119764
|
if (isFromNodeModulesSearch) {
|
|
120129
119765
|
currentNodeModulesDepth++;
|
|
120130
119766
|
}
|
|
@@ -120137,7 +119773,7 @@ var ts;
|
|
|
120137
119773
|
// Don't add the file if it has a bad extension (e.g. 'tsx' if we don't have '--allowJs')
|
|
120138
119774
|
// This may still end up being an untyped module -- the file won't be included but imports will be allowed.
|
|
120139
119775
|
var shouldAddFile = resolvedFileName
|
|
120140
|
-
&& !getResolutionDiagnostic(optionsForFile, resolution
|
|
119776
|
+
&& !getResolutionDiagnostic(optionsForFile, resolution)
|
|
120141
119777
|
&& !optionsForFile.noResolve
|
|
120142
119778
|
&& index < file.imports.length
|
|
120143
119779
|
&& !elideImport
|
|
@@ -120149,7 +119785,7 @@ var ts;
|
|
|
120149
119785
|
else if (shouldAddFile) {
|
|
120150
119786
|
findSourceFile(resolvedFileName,
|
|
120151
119787
|
/*isDefaultLib*/ false,
|
|
120152
|
-
/*ignoreNoDefaultLib*/ false, { kind: ts.FileIncludeKind.Import, file: file.path, index: index, }, resolution.
|
|
119788
|
+
/*ignoreNoDefaultLib*/ false, { kind: ts.FileIncludeKind.Import, file: file.path, index: index, }, resolution.packageId);
|
|
120153
119789
|
}
|
|
120154
119790
|
if (isFromNodeModulesSearch) {
|
|
120155
119791
|
currentNodeModulesDepth--;
|
|
@@ -120253,9 +119889,6 @@ var ts;
|
|
|
120253
119889
|
createDiagnosticForOptionName(ts.Diagnostics.Composite_projects_may_not_disable_incremental_compilation, "declaration");
|
|
120254
119890
|
}
|
|
120255
119891
|
}
|
|
120256
|
-
if (options.cacheResolutions && !ts.isIncrementalCompilation(options)) {
|
|
120257
|
-
createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1_or_option_2, "cacheResolutions", "incremental", "composite");
|
|
120258
|
-
}
|
|
120259
119892
|
var outputFile = ts.outFile(options);
|
|
120260
119893
|
if (options.tsBuildInfoFile) {
|
|
120261
119894
|
if (!ts.isIncrementalCompilation(options)) {
|
|
@@ -120524,7 +120157,7 @@ var ts;
|
|
|
120524
120157
|
}
|
|
120525
120158
|
}
|
|
120526
120159
|
function addFilePreprocessingFileExplainingDiagnostic(file, fileProcessingReason, diagnostic, args) {
|
|
120527
|
-
(fileProcessingDiagnostics
|
|
120160
|
+
(fileProcessingDiagnostics || (fileProcessingDiagnostics = [])).push({
|
|
120528
120161
|
kind: 1 /* FilePreprocessingFileExplainingDiagnostic */,
|
|
120529
120162
|
file: file && file.path,
|
|
120530
120163
|
fileProcessingReason: fileProcessingReason,
|
|
@@ -120792,8 +120425,8 @@ var ts;
|
|
|
120792
120425
|
if (!symlinks) {
|
|
120793
120426
|
symlinks = ts.createSymlinkCache(currentDirectory, getCanonicalFileName);
|
|
120794
120427
|
}
|
|
120795
|
-
if (files &&
|
|
120796
|
-
symlinks.setSymlinksFromResolutions(files,
|
|
120428
|
+
if (files && resolvedTypeReferenceDirectives && !symlinks.hasProcessedResolutions()) {
|
|
120429
|
+
symlinks.setSymlinksFromResolutions(files, resolvedTypeReferenceDirectives);
|
|
120797
120430
|
}
|
|
120798
120431
|
return symlinks;
|
|
120799
120432
|
}
|
|
@@ -121206,8 +120839,7 @@ var ts;
|
|
|
121206
120839
|
}
|
|
121207
120840
|
// Handle type reference directives
|
|
121208
120841
|
if (sourceFile.resolvedTypeReferenceDirectiveNames) {
|
|
121209
|
-
sourceFile.resolvedTypeReferenceDirectiveNames.forEach(function (
|
|
121210
|
-
var resolvedTypeReferenceDirective = _a.resolvedTypeReferenceDirective;
|
|
120842
|
+
sourceFile.resolvedTypeReferenceDirectiveNames.forEach(function (resolvedTypeReferenceDirective) {
|
|
121211
120843
|
if (!resolvedTypeReferenceDirective) {
|
|
121212
120844
|
return;
|
|
121213
120845
|
}
|
|
@@ -121266,13 +120898,12 @@ var ts;
|
|
|
121266
120898
|
/**
|
|
121267
120899
|
* Creates the state of file references and signature for the new program from oldState if it is safe
|
|
121268
120900
|
*/
|
|
121269
|
-
function create(newProgram, oldState, disableUseFileVersionAsSignature) {
|
|
120901
|
+
function create(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature) {
|
|
121270
120902
|
var _a, _b, _c;
|
|
121271
120903
|
var fileInfos = new ts.Map();
|
|
121272
120904
|
var referencedMap = newProgram.getCompilerOptions().module !== ts.ModuleKind.None ? createManyToManyPathMap() : undefined;
|
|
121273
120905
|
var exportedModulesMap = referencedMap ? createManyToManyPathMap() : undefined;
|
|
121274
120906
|
var useOldState = canReuseOldState(referencedMap, oldState);
|
|
121275
|
-
var getCanonicalFileName = ts.createGetCanonicalFileName(newProgram.useCaseSensitiveFileNames());
|
|
121276
120907
|
// Ensure source files have parent pointers set
|
|
121277
120908
|
newProgram.getTypeChecker();
|
|
121278
120909
|
// Create the reference map, and set the file infos
|
|
@@ -121325,23 +120956,23 @@ var ts;
|
|
|
121325
120956
|
/**
|
|
121326
120957
|
* Gets the files affected by the path from the program
|
|
121327
120958
|
*/
|
|
121328
|
-
function getFilesAffectedBy(state, programOfThisState, path, cancellationToken,
|
|
120959
|
+
function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, computeHash, getCanonicalFileName) {
|
|
121329
120960
|
var _a, _b;
|
|
121330
|
-
var result = getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken,
|
|
120961
|
+
var result = getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash, getCanonicalFileName);
|
|
121331
120962
|
(_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.clear();
|
|
121332
120963
|
(_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
|
|
121333
120964
|
return result;
|
|
121334
120965
|
}
|
|
121335
120966
|
BuilderState.getFilesAffectedBy = getFilesAffectedBy;
|
|
121336
|
-
function getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken,
|
|
120967
|
+
function getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash, getCanonicalFileName) {
|
|
121337
120968
|
var sourceFile = programOfThisState.getSourceFileByPath(path);
|
|
121338
120969
|
if (!sourceFile) {
|
|
121339
120970
|
return ts.emptyArray;
|
|
121340
120971
|
}
|
|
121341
|
-
if (!updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken,
|
|
120972
|
+
if (!updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash, getCanonicalFileName)) {
|
|
121342
120973
|
return [sourceFile];
|
|
121343
120974
|
}
|
|
121344
|
-
return (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, cancellationToken,
|
|
120975
|
+
return (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, cancellationToken, computeHash, getCanonicalFileName);
|
|
121345
120976
|
}
|
|
121346
120977
|
BuilderState.getFilesAffectedByWithOldState = getFilesAffectedByWithOldState;
|
|
121347
120978
|
function updateSignatureOfFile(state, signature, path) {
|
|
@@ -121352,7 +120983,7 @@ var ts;
|
|
|
121352
120983
|
/**
|
|
121353
120984
|
* Returns if the shape of the signature has changed since last emit
|
|
121354
120985
|
*/
|
|
121355
|
-
function updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken,
|
|
120986
|
+
function updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash, getCanonicalFileName, useFileVersionAsSignature) {
|
|
121356
120987
|
var _a;
|
|
121357
120988
|
if (useFileVersionAsSignature === void 0) { useFileVersionAsSignature = state.useFileVersionAsSignature; }
|
|
121358
120989
|
// If we have cached the result for this file, that means hence forth we should assume file shape is uptodate
|
|
@@ -121364,7 +120995,7 @@ var ts;
|
|
|
121364
120995
|
if (!sourceFile.isDeclarationFile && !useFileVersionAsSignature) {
|
|
121365
120996
|
programOfThisState.emit(sourceFile, function (fileName, text, _writeByteOrderMark, _onError, sourceFiles, data) {
|
|
121366
120997
|
ts.Debug.assert(ts.isDeclarationFileName(fileName), "File extension for signature expected to be dts: Got:: " + fileName);
|
|
121367
|
-
latestSignature = ts.computeSignatureWithDiagnostics(sourceFile, text,
|
|
120998
|
+
latestSignature = ts.computeSignatureWithDiagnostics(sourceFile, text, computeHash, getCanonicalFileName, data);
|
|
121368
120999
|
if (latestSignature !== prevSignature) {
|
|
121369
121000
|
updateExportedModules(state, sourceFile, sourceFiles[0].exportedModulesFromDeclarationEmit);
|
|
121370
121001
|
}
|
|
@@ -121543,7 +121174,7 @@ var ts;
|
|
|
121543
121174
|
/**
|
|
121544
121175
|
* When program emits modular code, gets the files affected by the sourceFile whose shape has changed
|
|
121545
121176
|
*/
|
|
121546
|
-
function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cancellationToken,
|
|
121177
|
+
function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cancellationToken, computeHash, getCanonicalFileName) {
|
|
121547
121178
|
if (isFileAffectingGlobalScope(sourceFileWithUpdatedShape)) {
|
|
121548
121179
|
return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
|
|
121549
121180
|
}
|
|
@@ -121563,7 +121194,7 @@ var ts;
|
|
|
121563
121194
|
if (!seenFileNamesMap.has(currentPath)) {
|
|
121564
121195
|
var currentSourceFile = programOfThisState.getSourceFileByPath(currentPath);
|
|
121565
121196
|
seenFileNamesMap.set(currentPath, currentSourceFile);
|
|
121566
|
-
if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cancellationToken,
|
|
121197
|
+
if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cancellationToken, computeHash, getCanonicalFileName)) {
|
|
121567
121198
|
queue.push.apply(queue, getReferencedByPaths(state, currentSourceFile.resolvedPath));
|
|
121568
121199
|
}
|
|
121569
121200
|
}
|
|
@@ -121588,9 +121219,9 @@ var ts;
|
|
|
121588
121219
|
/**
|
|
121589
121220
|
* Create the state so that we can iterate on changedFiles/affected files
|
|
121590
121221
|
*/
|
|
121591
|
-
function createBuilderProgramState(newProgram, oldState, disableUseFileVersionAsSignature) {
|
|
121222
|
+
function createBuilderProgramState(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature) {
|
|
121592
121223
|
var _a, _b;
|
|
121593
|
-
var state = ts.BuilderState.create(newProgram, oldState, disableUseFileVersionAsSignature);
|
|
121224
|
+
var state = ts.BuilderState.create(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature);
|
|
121594
121225
|
state.program = newProgram;
|
|
121595
121226
|
var compilerOptions = newProgram.getCompilerOptions();
|
|
121596
121227
|
state.compilerOptions = compilerOptions;
|
|
@@ -121654,7 +121285,7 @@ var ts;
|
|
|
121654
121285
|
// Unchanged file copy diagnostics
|
|
121655
121286
|
var diagnostics = oldState.semanticDiagnosticsPerFile.get(sourceFilePath);
|
|
121656
121287
|
if (diagnostics) {
|
|
121657
|
-
state.semanticDiagnosticsPerFile.set(sourceFilePath, oldState.hasReusableDiagnostic ? convertToDiagnostics(diagnostics, newProgram) : diagnostics);
|
|
121288
|
+
state.semanticDiagnosticsPerFile.set(sourceFilePath, oldState.hasReusableDiagnostic ? convertToDiagnostics(diagnostics, newProgram, getCanonicalFileName) : diagnostics);
|
|
121658
121289
|
if (!state.semanticDiagnosticsFromOldState) {
|
|
121659
121290
|
state.semanticDiagnosticsFromOldState = new ts.Set();
|
|
121660
121291
|
}
|
|
@@ -121679,16 +121310,13 @@ var ts;
|
|
|
121679
121310
|
state.seenAffectedFiles = state.seenAffectedFiles || new ts.Set();
|
|
121680
121311
|
}
|
|
121681
121312
|
// Since old states change files set is copied, any additional change means we would need to emit build info
|
|
121682
|
-
state.buildInfoEmitPending = !useOldState ||
|
|
121683
|
-
state.changedFilesSet.size !== (((_b = oldState.changedFilesSet) === null || _b === void 0 ? void 0 : _b.size) || 0) ||
|
|
121684
|
-
state.fileInfos.size !== oldState.fileInfos.size;
|
|
121313
|
+
state.buildInfoEmitPending = !useOldState || state.changedFilesSet.size !== (((_b = oldState.changedFilesSet) === null || _b === void 0 ? void 0 : _b.size) || 0);
|
|
121685
121314
|
return state;
|
|
121686
121315
|
}
|
|
121687
|
-
function convertToDiagnostics(diagnostics, newProgram) {
|
|
121316
|
+
function convertToDiagnostics(diagnostics, newProgram, getCanonicalFileName) {
|
|
121688
121317
|
if (!diagnostics.length)
|
|
121689
121318
|
return ts.emptyArray;
|
|
121690
|
-
var buildInfoDirectory;
|
|
121691
|
-
var getCanonicalFileName;
|
|
121319
|
+
var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(ts.getTsBuildInfoEmitOutputFilePath(newProgram.getCompilerOptions()), newProgram.getCurrentDirectory()));
|
|
121692
121320
|
return diagnostics.map(function (diagnostic) {
|
|
121693
121321
|
var result = convertToDiagnosticRelatedInformation(diagnostic, newProgram, toPath);
|
|
121694
121322
|
result.reportsUnnecessary = diagnostic.reportsUnnecessary;
|
|
@@ -121704,8 +121332,7 @@ var ts;
|
|
|
121704
121332
|
return result;
|
|
121705
121333
|
});
|
|
121706
121334
|
function toPath(path) {
|
|
121707
|
-
|
|
121708
|
-
return ts.toPath(path, buildInfoDirectory, getCanonicalFileName !== null && getCanonicalFileName !== void 0 ? getCanonicalFileName : (getCanonicalFileName = ts.createGetCanonicalFileName(newProgram.useCaseSensitiveFileNames())));
|
|
121335
|
+
return ts.toPath(path, buildInfoDirectory, getCanonicalFileName);
|
|
121709
121336
|
}
|
|
121710
121337
|
}
|
|
121711
121338
|
function convertToDiagnosticRelatedInformation(diagnostic, newProgram, toPath) {
|
|
@@ -121717,9 +121344,6 @@ var ts;
|
|
|
121717
121344
|
*/
|
|
121718
121345
|
function releaseCache(state) {
|
|
121719
121346
|
ts.BuilderState.releaseCache(state);
|
|
121720
|
-
// Store the resolutions if possible
|
|
121721
|
-
if (!state.resuableCacheResolutions)
|
|
121722
|
-
getCacheResolutions(state);
|
|
121723
121347
|
state.program = undefined;
|
|
121724
121348
|
}
|
|
121725
121349
|
function backupBuilderProgramEmitState(state) {
|
|
@@ -121764,7 +121388,7 @@ var ts;
|
|
|
121764
121388
|
* This is to allow the callers to be able to actually remove affected file only when the operation is complete
|
|
121765
121389
|
* eg. if during diagnostics check cancellation token ends up cancelling the request, the affected file should be retained
|
|
121766
121390
|
*/
|
|
121767
|
-
function getNextAffectedFile(state, cancellationToken, host) {
|
|
121391
|
+
function getNextAffectedFile(state, cancellationToken, computeHash, getCanonicalFileName, host) {
|
|
121768
121392
|
var _a, _b;
|
|
121769
121393
|
while (true) {
|
|
121770
121394
|
var affectedFiles = state.affectedFiles;
|
|
@@ -121776,7 +121400,7 @@ var ts;
|
|
|
121776
121400
|
if (!seenAffectedFiles.has(affectedFile.resolvedPath)) {
|
|
121777
121401
|
// Set the next affected file as seen and remove the cached semantic diagnostics
|
|
121778
121402
|
state.affectedFilesIndex = affectedFilesIndex;
|
|
121779
|
-
handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, host);
|
|
121403
|
+
handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, getCanonicalFileName, host);
|
|
121780
121404
|
return affectedFile;
|
|
121781
121405
|
}
|
|
121782
121406
|
affectedFilesIndex++;
|
|
@@ -121804,7 +121428,7 @@ var ts;
|
|
|
121804
121428
|
return program;
|
|
121805
121429
|
}
|
|
121806
121430
|
// Get next batch of affected files
|
|
121807
|
-
state.affectedFiles = ts.BuilderState.getFilesAffectedByWithOldState(state, program, nextKey.value, cancellationToken,
|
|
121431
|
+
state.affectedFiles = ts.BuilderState.getFilesAffectedByWithOldState(state, program, nextKey.value, cancellationToken, computeHash, getCanonicalFileName);
|
|
121808
121432
|
state.currentChangedFilePath = nextKey.value;
|
|
121809
121433
|
state.affectedFilesIndex = 0;
|
|
121810
121434
|
if (!state.seenAffectedFiles)
|
|
@@ -121855,7 +121479,7 @@ var ts;
|
|
|
121855
121479
|
* Handles semantic diagnostics and dts emit for affectedFile and files, that are referencing modules that export entities from affected file
|
|
121856
121480
|
* This is because even though js emit doesnt change, dts emit / type used can change resulting in need for dts emit and js change
|
|
121857
121481
|
*/
|
|
121858
|
-
function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, host) {
|
|
121482
|
+
function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, getCanonicalFileName, host) {
|
|
121859
121483
|
removeSemanticDiagnosticsOf(state, affectedFile.resolvedPath);
|
|
121860
121484
|
// If affected files is everything except default library, then nothing more to do
|
|
121861
121485
|
if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles) {
|
|
@@ -121863,18 +121487,18 @@ var ts;
|
|
|
121863
121487
|
// When a change affects the global scope, all files are considered to be affected without updating their signature
|
|
121864
121488
|
// That means when affected file is handled, its signature can be out of date
|
|
121865
121489
|
// To avoid this, ensure that we update the signature for any affected file in this scenario.
|
|
121866
|
-
ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, cancellationToken,
|
|
121490
|
+
ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, cancellationToken, computeHash, getCanonicalFileName);
|
|
121867
121491
|
return;
|
|
121868
121492
|
}
|
|
121869
121493
|
if (state.compilerOptions.assumeChangesOnlyAffectDirectDependencies)
|
|
121870
121494
|
return;
|
|
121871
|
-
handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, host);
|
|
121495
|
+
handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, getCanonicalFileName, host);
|
|
121872
121496
|
}
|
|
121873
121497
|
/**
|
|
121874
121498
|
* Handle the dts may change, so they need to be added to pending emit if dts emit is enabled,
|
|
121875
121499
|
* Also we need to make sure signature is updated for these files
|
|
121876
121500
|
*/
|
|
121877
|
-
function handleDtsMayChangeOf(state, path, cancellationToken, host) {
|
|
121501
|
+
function handleDtsMayChangeOf(state, path, cancellationToken, computeHash, getCanonicalFileName, host) {
|
|
121878
121502
|
removeSemanticDiagnosticsOf(state, path);
|
|
121879
121503
|
if (!state.changedFilesSet.has(path)) {
|
|
121880
121504
|
var program = ts.Debug.checkDefined(state.program);
|
|
@@ -121885,7 +121509,7 @@ var ts;
|
|
|
121885
121509
|
// This ensures that we dont later during incremental builds considering wrong signature.
|
|
121886
121510
|
// Eg where this also is needed to ensure that .tsbuildinfo generated by incremental build should be same as if it was first fresh build
|
|
121887
121511
|
// But we avoid expensive full shape computation, as using file version as shape is enough for correctness.
|
|
121888
|
-
ts.BuilderState.updateShapeSignature(state, program, sourceFile, cancellationToken,
|
|
121512
|
+
ts.BuilderState.updateShapeSignature(state, program, sourceFile, cancellationToken, computeHash, getCanonicalFileName, !host.disableUseFileVersionAsSignature);
|
|
121889
121513
|
// If not dts emit, nothing more to do
|
|
121890
121514
|
if (ts.getEmitDeclarations(state.compilerOptions)) {
|
|
121891
121515
|
addToAffectedFilesPendingEmit(state, path, 0 /* DtsOnly */);
|
|
@@ -121910,20 +121534,20 @@ var ts;
|
|
|
121910
121534
|
var newSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
|
|
121911
121535
|
return newSignature !== oldSignature;
|
|
121912
121536
|
}
|
|
121913
|
-
function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, host) {
|
|
121537
|
+
function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, getCanonicalFileName, host) {
|
|
121914
121538
|
var _a;
|
|
121915
121539
|
if (!((_a = state.fileInfos.get(filePath)) === null || _a === void 0 ? void 0 : _a.affectsGlobalScope))
|
|
121916
121540
|
return false;
|
|
121917
121541
|
// Every file needs to be handled
|
|
121918
121542
|
ts.BuilderState.getAllFilesExcludingDefaultLibraryFile(state, state.program, /*firstSourceFile*/ undefined)
|
|
121919
|
-
.forEach(function (file) { return handleDtsMayChangeOf(state, file.resolvedPath, cancellationToken, host); });
|
|
121543
|
+
.forEach(function (file) { return handleDtsMayChangeOf(state, file.resolvedPath, cancellationToken, computeHash, getCanonicalFileName, host); });
|
|
121920
121544
|
removeDiagnosticsOfLibraryFiles(state);
|
|
121921
121545
|
return true;
|
|
121922
121546
|
}
|
|
121923
121547
|
/**
|
|
121924
121548
|
* Iterate on referencing modules that export entities from affected file and delete diagnostics and add pending emit
|
|
121925
121549
|
*/
|
|
121926
|
-
function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, host) {
|
|
121550
|
+
function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, getCanonicalFileName, host) {
|
|
121927
121551
|
var _a;
|
|
121928
121552
|
// If there was change in signature (dts output) for the changed file,
|
|
121929
121553
|
// then only we need to handle pending file emit
|
|
@@ -121941,9 +121565,9 @@ var ts;
|
|
|
121941
121565
|
var currentPath = queue.pop();
|
|
121942
121566
|
if (!seenFileNamesMap.has(currentPath)) {
|
|
121943
121567
|
seenFileNamesMap.set(currentPath, true);
|
|
121944
|
-
if (handleDtsMayChangeOfGlobalScope(state, currentPath, cancellationToken, host))
|
|
121568
|
+
if (handleDtsMayChangeOfGlobalScope(state, currentPath, cancellationToken, computeHash, getCanonicalFileName, host))
|
|
121945
121569
|
return;
|
|
121946
|
-
handleDtsMayChangeOf(state, currentPath, cancellationToken, host);
|
|
121570
|
+
handleDtsMayChangeOf(state, currentPath, cancellationToken, computeHash, getCanonicalFileName, host);
|
|
121947
121571
|
if (isChangedSignature(state, currentPath)) {
|
|
121948
121572
|
var currentSourceFile = ts.Debug.checkDefined(state.program).getSourceFileByPath(currentPath);
|
|
121949
121573
|
queue.push.apply(queue, ts.BuilderState.getReferencedByPaths(state, currentSourceFile.resolvedPath));
|
|
@@ -121955,11 +121579,11 @@ var ts;
|
|
|
121955
121579
|
// Go through exported modules from cache first
|
|
121956
121580
|
// If exported modules has path, all files referencing file exported from are affected
|
|
121957
121581
|
(_a = state.exportedModulesMap.getKeys(affectedFile.resolvedPath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
|
|
121958
|
-
if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, host))
|
|
121582
|
+
if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, computeHash, getCanonicalFileName, host))
|
|
121959
121583
|
return true;
|
|
121960
121584
|
var references = state.referencedMap.getKeys(exportedFromPath);
|
|
121961
121585
|
return references && ts.forEachKey(references, function (filePath) {
|
|
121962
|
-
return handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, host);
|
|
121586
|
+
return handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, getCanonicalFileName, host);
|
|
121963
121587
|
});
|
|
121964
121588
|
});
|
|
121965
121589
|
}
|
|
@@ -121967,22 +121591,22 @@ var ts;
|
|
|
121967
121591
|
* handle dts and semantic diagnostics on file and iterate on anything that exports this file
|
|
121968
121592
|
* return true when all work is done and we can exit handling dts emit and semantic diagnostics
|
|
121969
121593
|
*/
|
|
121970
|
-
function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, host) {
|
|
121594
|
+
function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, getCanonicalFileName, host) {
|
|
121971
121595
|
var _a, _b;
|
|
121972
121596
|
if (!ts.tryAddToSet(seenFileAndExportsOfFile, filePath))
|
|
121973
121597
|
return undefined;
|
|
121974
|
-
if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, host))
|
|
121598
|
+
if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, getCanonicalFileName, host))
|
|
121975
121599
|
return true;
|
|
121976
|
-
handleDtsMayChangeOf(state, filePath, cancellationToken, host);
|
|
121600
|
+
handleDtsMayChangeOf(state, filePath, cancellationToken, computeHash, getCanonicalFileName, host);
|
|
121977
121601
|
// If exported modules has path, all files referencing file exported from are affected
|
|
121978
121602
|
(_a = state.exportedModulesMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
|
|
121979
|
-
return handleDtsMayChangeOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, cancellationToken, host);
|
|
121603
|
+
return handleDtsMayChangeOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, cancellationToken, computeHash, getCanonicalFileName, host);
|
|
121980
121604
|
});
|
|
121981
121605
|
// Remove diagnostics of files that import this file (without going to exports of referencing files)
|
|
121982
121606
|
(_b = state.referencedMap.getKeys(filePath)) === null || _b === void 0 ? void 0 : _b.forEach(function (referencingFilePath) {
|
|
121983
121607
|
return !seenFileAndExportsOfFile.has(referencingFilePath) && // Not already removed diagnostic file
|
|
121984
121608
|
handleDtsMayChangeOf(// Dont add to seen since this is not yet done with the export removal
|
|
121985
|
-
state, referencingFilePath, cancellationToken, host);
|
|
121609
|
+
state, referencingFilePath, cancellationToken, computeHash, getCanonicalFileName, host);
|
|
121986
121610
|
});
|
|
121987
121611
|
return undefined;
|
|
121988
121612
|
}
|
|
@@ -122061,46 +121685,35 @@ var ts;
|
|
|
122061
121685
|
/**
|
|
122062
121686
|
* Gets the program information to be emitted in buildInfo so that we can use it to create new program
|
|
122063
121687
|
*/
|
|
122064
|
-
function getProgramBuildInfo(state,
|
|
121688
|
+
function getProgramBuildInfo(state, getCanonicalFileName) {
|
|
122065
121689
|
var outFilePath = ts.outFile(state.compilerOptions);
|
|
122066
|
-
if (outFilePath && !state.compilerOptions.composite
|
|
121690
|
+
if (outFilePath && !state.compilerOptions.composite)
|
|
122067
121691
|
return;
|
|
122068
121692
|
var currentDirectory = ts.Debug.checkDefined(state.program).getCurrentDirectory();
|
|
122069
|
-
var
|
|
122070
|
-
var buildInfoPath = ts.getNormalizedAbsolutePath(ts.getTsBuildInfoEmitOutputFilePath(state.compilerOptions), currentDirectory);
|
|
122071
|
-
var buildInfoDirectory = ts.getDirectoryPath(buildInfoPath);
|
|
121693
|
+
var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(ts.getTsBuildInfoEmitOutputFilePath(state.compilerOptions), currentDirectory));
|
|
122072
121694
|
// 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
|
|
122073
121695
|
var latestChangedDtsFile = state.latestChangedDtsFile ? relativeToBuildInfoEnsuringAbsolutePath(state.latestChangedDtsFile) : undefined;
|
|
122074
|
-
var fileNames = [];
|
|
122075
|
-
var fileNameToFileId = new ts.Map();
|
|
122076
|
-
var resolutions;
|
|
122077
|
-
var names;
|
|
122078
|
-
var resolutionNameToResolutionNameId;
|
|
122079
|
-
var resolutionEntries;
|
|
122080
|
-
var resolutionEntryToResolutionEntryId;
|
|
122081
|
-
var affectedFilesHash;
|
|
122082
121696
|
if (outFilePath) {
|
|
122083
|
-
var
|
|
122084
|
-
|
|
122085
|
-
|
|
122086
|
-
|
|
122087
|
-
|
|
122088
|
-
|
|
122089
|
-
|
|
122090
|
-
|
|
122091
|
-
|
|
122092
|
-
|
|
122093
|
-
|
|
122094
|
-
var result_16 = {
|
|
122095
|
-
fileNames: fileNames,
|
|
121697
|
+
var fileNames_1 = [];
|
|
121698
|
+
var fileInfos_1 = [];
|
|
121699
|
+
state.program.getRootFileNames().forEach(function (f) {
|
|
121700
|
+
var sourceFile = state.program.getSourceFile(f);
|
|
121701
|
+
if (!sourceFile)
|
|
121702
|
+
return;
|
|
121703
|
+
fileNames_1.push(relativeToBuildInfo(sourceFile.resolvedPath));
|
|
121704
|
+
fileInfos_1.push(sourceFile.version);
|
|
121705
|
+
});
|
|
121706
|
+
var result_15 = {
|
|
121707
|
+
fileNames: fileNames_1,
|
|
122096
121708
|
fileInfos: fileInfos_1,
|
|
122097
|
-
options:
|
|
121709
|
+
options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsBundleEmitBuildInfo"),
|
|
122098
121710
|
outSignature: state.outSignature,
|
|
122099
121711
|
latestChangedDtsFile: latestChangedDtsFile,
|
|
122100
|
-
cacheResolutions: cacheResolutions_1,
|
|
122101
121712
|
};
|
|
122102
|
-
return
|
|
121713
|
+
return result_15;
|
|
122103
121714
|
}
|
|
121715
|
+
var fileNames = [];
|
|
121716
|
+
var fileNameToFileId = new ts.Map();
|
|
122104
121717
|
var fileIdsList;
|
|
122105
121718
|
var fileNamesToFileIdListId;
|
|
122106
121719
|
var emitSignatures;
|
|
@@ -122164,7 +121777,7 @@ var ts;
|
|
|
122164
121777
|
(semanticDiagnosticsPerFile || (semanticDiagnosticsPerFile = [])).push(value.length ?
|
|
122165
121778
|
[
|
|
122166
121779
|
toFileId(key),
|
|
122167
|
-
value
|
|
121780
|
+
convertToReusableDiagnostics(value, relativeToBuildInfo)
|
|
122168
121781
|
] :
|
|
122169
121782
|
toFileId(key));
|
|
122170
121783
|
}
|
|
@@ -122186,11 +121799,10 @@ var ts;
|
|
|
122186
121799
|
(changeFileSet || (changeFileSet = [])).push(toFileId(path));
|
|
122187
121800
|
}
|
|
122188
121801
|
}
|
|
122189
|
-
var cacheResolutions = toProgramBuildInfoCacheResolutions();
|
|
122190
121802
|
var result = {
|
|
122191
121803
|
fileNames: fileNames,
|
|
122192
121804
|
fileInfos: fileInfos,
|
|
122193
|
-
options:
|
|
121805
|
+
options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsMultiFileEmitBuildInfo"),
|
|
122194
121806
|
fileIdsList: fileIdsList,
|
|
122195
121807
|
referencedMap: referencedMap,
|
|
122196
121808
|
exportedModulesMap: exportedModulesMap,
|
|
@@ -122199,7 +121811,6 @@ var ts;
|
|
|
122199
121811
|
changeFileSet: changeFileSet,
|
|
122200
121812
|
emitSignatures: emitSignatures,
|
|
122201
121813
|
latestChangedDtsFile: latestChangedDtsFile,
|
|
122202
|
-
cacheResolutions: cacheResolutions,
|
|
122203
121814
|
};
|
|
122204
121815
|
return result;
|
|
122205
121816
|
function relativeToBuildInfoEnsuringAbsolutePath(path) {
|
|
@@ -122208,7 +121819,7 @@ var ts;
|
|
|
122208
121819
|
function relativeToBuildInfo(path) {
|
|
122209
121820
|
return ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(buildInfoDirectory, path, getCanonicalFileName));
|
|
122210
121821
|
}
|
|
122211
|
-
function
|
|
121822
|
+
function toFileId(path) {
|
|
122212
121823
|
var fileId = fileNameToFileId.get(path);
|
|
122213
121824
|
if (fileId === undefined) {
|
|
122214
121825
|
fileNames.push(relativeToBuildInfo(path));
|
|
@@ -122216,12 +121827,6 @@ var ts;
|
|
|
122216
121827
|
}
|
|
122217
121828
|
return fileId;
|
|
122218
121829
|
}
|
|
122219
|
-
function toFileId(path) {
|
|
122220
|
-
return toFileAndAbsoluteFileId(path);
|
|
122221
|
-
}
|
|
122222
|
-
function toAbsoluteFileId(path) {
|
|
122223
|
-
return toFileAndAbsoluteFileId(ts.getNormalizedAbsolutePath(path, currentDirectory));
|
|
122224
|
-
}
|
|
122225
121830
|
function toFileIdListId(set) {
|
|
122226
121831
|
var fileIds = ts.arrayFrom(set.keys(), toFileId).sort(ts.compareValues);
|
|
122227
121832
|
var key = fileIds.join();
|
|
@@ -122234,241 +121839,54 @@ var ts;
|
|
|
122234
121839
|
}
|
|
122235
121840
|
/**
|
|
122236
121841
|
* @param optionKey key of CommandLineOption to use to determine if the option should be serialized in tsbuildinfo
|
|
122237
|
-
* @param affectsModuleResolution serialize options affecting module resolution
|
|
122238
121842
|
*/
|
|
122239
|
-
function
|
|
121843
|
+
function convertToProgramBuildInfoCompilerOptions(options, optionKey) {
|
|
122240
121844
|
var result;
|
|
122241
121845
|
var optionsNameMap = ts.getOptionsNameMap().optionsNameMap;
|
|
122242
121846
|
for (var _i = 0, _a = ts.getOwnKeys(options).sort(ts.compareStringsCaseSensitive); _i < _a.length; _i++) {
|
|
122243
121847
|
var name = _a[_i];
|
|
122244
121848
|
var optionInfo = optionsNameMap.get(name.toLowerCase());
|
|
122245
|
-
if (
|
|
122246
|
-
(result
|
|
122247
|
-
}
|
|
122248
|
-
else if (affectsModuleResolution && name === "pathsBasePath") {
|
|
122249
|
-
(result !== null && result !== void 0 ? result : (result = {})).pathsBasePath = relativeToBuildInfoEnsuringAbsolutePath(options.pathsBasePath);
|
|
122250
|
-
continue;
|
|
121849
|
+
if (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo[optionKey]) {
|
|
121850
|
+
(result || (result = {}))[name] = convertToReusableCompilerOptionValue(optionInfo, options[name], relativeToBuildInfoEnsuringAbsolutePath);
|
|
122251
121851
|
}
|
|
122252
121852
|
}
|
|
122253
121853
|
return result;
|
|
122254
121854
|
}
|
|
122255
|
-
|
|
122256
|
-
|
|
122257
|
-
|
|
122258
|
-
|
|
122259
|
-
|
|
122260
|
-
|
|
122261
|
-
|
|
122262
|
-
}
|
|
122263
|
-
else if (option.isFilePath) {
|
|
122264
|
-
return relativeToBuildInfoEnsuringAbsolutePath(value);
|
|
121855
|
+
}
|
|
121856
|
+
function convertToReusableCompilerOptionValue(option, value, relativeToBuildInfo) {
|
|
121857
|
+
if (option) {
|
|
121858
|
+
if (option.type === "list") {
|
|
121859
|
+
var values = value;
|
|
121860
|
+
if (option.element.isFilePath && values.length) {
|
|
121861
|
+
return values.map(relativeToBuildInfo);
|
|
122265
121862
|
}
|
|
122266
121863
|
}
|
|
122267
|
-
|
|
122268
|
-
|
|
122269
|
-
|
|
122270
|
-
return (array === null || array === void 0 ? void 0 : array.length) ? array.map(map) : undefined;
|
|
121864
|
+
else if (option.isFilePath) {
|
|
121865
|
+
return relativeToBuildInfo(value);
|
|
121866
|
+
}
|
|
122271
121867
|
}
|
|
122272
|
-
|
|
122273
|
-
|
|
121868
|
+
return value;
|
|
121869
|
+
}
|
|
121870
|
+
function convertToReusableDiagnostics(diagnostics, relativeToBuildInfo) {
|
|
121871
|
+
ts.Debug.assert(!!diagnostics.length);
|
|
121872
|
+
return diagnostics.map(function (diagnostic) {
|
|
121873
|
+
var result = convertToReusableDiagnosticRelatedInformation(diagnostic, relativeToBuildInfo);
|
|
122274
121874
|
result.reportsUnnecessary = diagnostic.reportsUnnecessary;
|
|
122275
121875
|
result.reportDeprecated = diagnostic.reportsDeprecated;
|
|
122276
121876
|
result.source = diagnostic.source;
|
|
122277
121877
|
result.skippedOn = diagnostic.skippedOn;
|
|
122278
121878
|
var relatedInformation = diagnostic.relatedInformation;
|
|
122279
|
-
result.relatedInformation = relatedInformation
|
|
122280
|
-
|
|
122281
|
-
|
|
122282
|
-
|
|
122283
|
-
|
|
122284
|
-
return __assign(__assign({}, diagnostic), { file: file ? relativeToBuildInfo(file.resolvedPath) : undefined });
|
|
122285
|
-
}
|
|
122286
|
-
function toProgramBuildInfoCacheResolutions() {
|
|
122287
|
-
var cacheResolutions = getCacheResolutions(state);
|
|
122288
|
-
var modules = toProgramBuildInfoResolutionCacheWithRedirects(cacheResolutions === null || cacheResolutions === void 0 ? void 0 : cacheResolutions.modules);
|
|
122289
|
-
var typeRefs = toProgramBuildInfoResolutionCacheWithRedirects(cacheResolutions === null || cacheResolutions === void 0 ? void 0 : cacheResolutions.typeRefs);
|
|
122290
|
-
if (!resolutions)
|
|
122291
|
-
return;
|
|
122292
|
-
ts.Debug.assertIsDefined(names);
|
|
122293
|
-
ts.Debug.assertIsDefined(resolutionEntries);
|
|
122294
|
-
state.resuableCacheResolutions = {
|
|
122295
|
-
cache: {
|
|
122296
|
-
resolutions: resolutions.map(toProgramBuildInfoResolution),
|
|
122297
|
-
names: names,
|
|
122298
|
-
hash: toProgramBuildInfoHashes(),
|
|
122299
|
-
resolutionEntries: resolutionEntries,
|
|
122300
|
-
modules: modules,
|
|
122301
|
-
typeRefs: typeRefs,
|
|
122302
|
-
},
|
|
122303
|
-
getProgramBuildInfoFilePathDecoder: ts.memoize(function () { return getProgramBuildInfoFilePathDecoder(fileNames, buildInfoPath, currentDirectory, getCanonicalFileName); })
|
|
122304
|
-
};
|
|
122305
|
-
return state.resuableCacheResolutions.cache;
|
|
122306
|
-
}
|
|
122307
|
-
function toProgramBuildInfoResolutionCacheWithRedirects(cache) {
|
|
122308
|
-
if (!cache)
|
|
122309
|
-
return undefined;
|
|
122310
|
-
var ownMap = cache.getOwnMap();
|
|
122311
|
-
var own = toProgramBuildInfoResolutionCache(ownMap);
|
|
122312
|
-
var redirects;
|
|
122313
|
-
cache.redirectsKeyToCache.forEach(function (_a) {
|
|
122314
|
-
var map = _a.map, options = _a.options;
|
|
122315
|
-
if (map === ownMap)
|
|
122316
|
-
return;
|
|
122317
|
-
var redirectCache = toProgramBuildInfoResolutionCache(map);
|
|
122318
|
-
if (redirectCache) {
|
|
122319
|
-
(redirects !== null && redirects !== void 0 ? redirects : (redirects = [])).push({
|
|
122320
|
-
options: toProgramBuildInfoCompilerOptions(options, /*optionKey*/ undefined, /*affectsModuleResolution*/ true),
|
|
122321
|
-
cache: redirectCache
|
|
122322
|
-
});
|
|
122323
|
-
}
|
|
122324
|
-
});
|
|
122325
|
-
return !redirects ? own : { own: own, redirects: redirects };
|
|
122326
|
-
}
|
|
122327
|
-
function toProgramBuildInfoResolutionCache(cache) {
|
|
122328
|
-
var result;
|
|
122329
|
-
cache === null || cache === void 0 ? void 0 : cache.forEach(function (dirCache, dirPath) { return dirCache.size() ?
|
|
122330
|
-
(result !== null && result !== void 0 ? result : (result = [])).push([
|
|
122331
|
-
toFileId(dirPath),
|
|
122332
|
-
ts.arrayFrom(dirCache.entries()).map(toProgramBuildInfoResolutionEntryId)
|
|
122333
|
-
]) :
|
|
122334
|
-
undefined; });
|
|
121879
|
+
result.relatedInformation = relatedInformation ?
|
|
121880
|
+
relatedInformation.length ?
|
|
121881
|
+
relatedInformation.map(function (r) { return convertToReusableDiagnosticRelatedInformation(r, relativeToBuildInfo); }) :
|
|
121882
|
+
[] :
|
|
121883
|
+
undefined;
|
|
122335
121884
|
return result;
|
|
122336
|
-
}
|
|
122337
|
-
function toProgramBuildInfoResolutionEntryId(_a) {
|
|
122338
|
-
var name = _a[0], mode = _a[1], resolution = _a[2];
|
|
122339
|
-
var resolutionNameId = toProgramBuildInfoResolutionNameId(name);
|
|
122340
|
-
var resolutionId = toProgramBuildInfoResolutionId(resolution);
|
|
122341
|
-
var key = resolutionNameId + "," + mode + "," + resolutionId;
|
|
122342
|
-
var resolutionEntryId = resolutionEntryToResolutionEntryId === null || resolutionEntryToResolutionEntryId === void 0 ? void 0 : resolutionEntryToResolutionEntryId.get(key);
|
|
122343
|
-
if (resolutionEntryId === undefined) {
|
|
122344
|
-
(resolutionEntries || (resolutionEntries = [])).push(mode ? [resolutionNameId, resolutionId, mode] : [resolutionNameId, resolutionId]);
|
|
122345
|
-
(resolutionEntryToResolutionEntryId || (resolutionEntryToResolutionEntryId = new ts.Map())).set(key, resolutionEntryId = resolutionEntries.length);
|
|
122346
|
-
}
|
|
122347
|
-
return resolutionEntryId;
|
|
122348
|
-
}
|
|
122349
|
-
function toProgramBuildInfoResolutionNameId(name) {
|
|
122350
|
-
var resolutionNameId = resolutionNameToResolutionNameId === null || resolutionNameToResolutionNameId === void 0 ? void 0 : resolutionNameToResolutionNameId.get(name);
|
|
122351
|
-
if (resolutionNameId === undefined) {
|
|
122352
|
-
(names !== null && names !== void 0 ? names : (names = [])).push(name);
|
|
122353
|
-
(resolutionNameToResolutionNameId !== null && resolutionNameToResolutionNameId !== void 0 ? resolutionNameToResolutionNameId : (resolutionNameToResolutionNameId = new ts.Map())).set(name, resolutionNameId = names.length);
|
|
122354
|
-
}
|
|
122355
|
-
return resolutionNameId;
|
|
122356
|
-
}
|
|
122357
|
-
function toProgramBuildInfoResolutionId(resolution) {
|
|
122358
|
-
if (resolution.serializationIndex === undefined) {
|
|
122359
|
-
(resolutions !== null && resolutions !== void 0 ? resolutions : (resolutions = [])).push(resolution);
|
|
122360
|
-
resolution.serializationIndex = resolutions.length;
|
|
122361
|
-
}
|
|
122362
|
-
return resolution.serializationIndex;
|
|
122363
|
-
}
|
|
122364
|
-
function toProgramBuildInfoResolution(resolution) {
|
|
122365
|
-
resolution.serializationIndex = undefined;
|
|
122366
|
-
return {
|
|
122367
|
-
resolvedModule: toProgramBuildInfoResolved(resolution.resolvedModule),
|
|
122368
|
-
resolvedTypeReferenceDirective: toProgramBuildInfoResolved(resolution.resolvedTypeReferenceDirective),
|
|
122369
|
-
affectingLocations: toReadonlyArrayOrUndefined(resolution.affectingLocations, toAffectedFileId),
|
|
122370
|
-
resolutionDiagnostics: toReadonlyArrayOrUndefined(resolution.resolutionDiagnostics, toProgramBuildInfoResolutionDiagnostic),
|
|
122371
|
-
};
|
|
122372
|
-
}
|
|
122373
|
-
function toProgramBuildInfoHashes() {
|
|
122374
|
-
if (!affectedFilesHash)
|
|
122375
|
-
return undefined;
|
|
122376
|
-
var hashes = [];
|
|
122377
|
-
for (var _i = 0, _a = ts.arrayFrom(affectedFilesHash.keys()).sort(ts.compareValues); _i < _a.length; _i++) {
|
|
122378
|
-
var key = _a[_i];
|
|
122379
|
-
var value = affectedFilesHash.get(key);
|
|
122380
|
-
hashes.push(value ? [key, value] : key);
|
|
122381
|
-
}
|
|
122382
|
-
return hashes;
|
|
122383
|
-
}
|
|
122384
|
-
function toAffectedFileId(file) {
|
|
122385
|
-
var _a;
|
|
122386
|
-
var fileId = toAbsoluteFileId(file);
|
|
122387
|
-
if (!(affectedFilesHash === null || affectedFilesHash === void 0 ? void 0 : affectedFilesHash.has(fileId))) {
|
|
122388
|
-
// Store the file hash
|
|
122389
|
-
var packageJsonInfo = (_a = state.program.getModuleResolutionCache()) === null || _a === void 0 ? void 0 : _a.getPackageJsonInfo(file);
|
|
122390
|
-
var text = typeof packageJsonInfo === "object" ? packageJsonInfo.packageJsonText : undefined;
|
|
122391
|
-
(affectedFilesHash !== null && affectedFilesHash !== void 0 ? affectedFilesHash : (affectedFilesHash = new ts.Map())).set(fileId, text ? computeSignature(text, host) : undefined);
|
|
122392
|
-
}
|
|
122393
|
-
return fileId;
|
|
122394
|
-
}
|
|
122395
|
-
function toProgramBuildInfoResolved(resolved) {
|
|
122396
|
-
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;
|
|
122397
|
-
}
|
|
122398
|
-
function toProgramBuildInfoResolutionDiagnostic(d) {
|
|
122399
|
-
return {
|
|
122400
|
-
isImports: d.isImports || undefined,
|
|
122401
|
-
entry: d.entry || undefined,
|
|
122402
|
-
packagePath: toAbsoluteFileId(d.packagePath),
|
|
122403
|
-
};
|
|
122404
|
-
}
|
|
122405
|
-
}
|
|
122406
|
-
function getCacheResolutions(state) {
|
|
122407
|
-
var _a;
|
|
122408
|
-
if (state.cacheResolutions || !state.compilerOptions.cacheResolutions)
|
|
122409
|
-
return state.cacheResolutions;
|
|
122410
|
-
var modules;
|
|
122411
|
-
var typeRefs;
|
|
122412
|
-
var moduleNameToDirectoryMap = ts.createCacheWithRedirects(state.compilerOptions);
|
|
122413
|
-
var getCanonicalFileName = ts.createGetCanonicalFileName(state.program.useCaseSensitiveFileNames());
|
|
122414
|
-
state.program.getSourceFiles().forEach(function (f) {
|
|
122415
|
-
modules = toPerDirectoryCache(state, getCanonicalFileName, modules, f, f.resolvedModules, moduleNameToDirectoryMap);
|
|
122416
|
-
typeRefs = toPerDirectoryCache(state, getCanonicalFileName, typeRefs, f, f.resolvedTypeReferenceDirectiveNames);
|
|
122417
121885
|
});
|
|
122418
|
-
var automaticTypeDirectiveNames = state.program.getAutomaticTypeDirectiveNames();
|
|
122419
|
-
if (automaticTypeDirectiveNames.length) {
|
|
122420
|
-
var currentDirectory = state.program.getCurrentDirectory();
|
|
122421
|
-
var containingPath = ts.toPath(state.program.getAutomaticTypeDirectiveContainingFile(), currentDirectory, getCanonicalFileName);
|
|
122422
|
-
typeRefs = toPerDirectoryCache(state, getCanonicalFileName, typeRefs, containingPath, state.program.getAutomaticTypeDirectiveResolutions());
|
|
122423
|
-
}
|
|
122424
|
-
return state.cacheResolutions = {
|
|
122425
|
-
modules: modules,
|
|
122426
|
-
typeRefs: typeRefs,
|
|
122427
|
-
moduleNameToDirectoryMap: moduleNameToDirectoryMap,
|
|
122428
|
-
packageJsonCache: (_a = state.program.getModuleResolutionCache()) === null || _a === void 0 ? void 0 : _a.getPackageJsonInfoCache().clone(),
|
|
122429
|
-
};
|
|
122430
121886
|
}
|
|
122431
|
-
function
|
|
122432
|
-
|
|
122433
|
-
|
|
122434
|
-
var dirPath, redirectedReference;
|
|
122435
|
-
if (!ts.isString(fOrPath)) {
|
|
122436
|
-
redirectedReference = state.program.getRedirectReferenceForResolution(fOrPath);
|
|
122437
|
-
dirPath = ts.getDirectoryPath(fOrPath.path);
|
|
122438
|
-
}
|
|
122439
|
-
else {
|
|
122440
|
-
dirPath = ts.getDirectoryPath(fOrPath);
|
|
122441
|
-
}
|
|
122442
|
-
var perDirResolutionCache = cacheWithRedirects === null || cacheWithRedirects === void 0 ? void 0 : cacheWithRedirects.getMapOfCacheRedirects(redirectedReference);
|
|
122443
|
-
var dirCache = perDirResolutionCache === null || perDirResolutionCache === void 0 ? void 0 : perDirResolutionCache.get(dirPath);
|
|
122444
|
-
cache.forEach(function (resolution, name, mode) {
|
|
122445
|
-
var _a, _b, _c, _d;
|
|
122446
|
-
if (!((_a = resolution.resolvedModule) === null || _a === void 0 ? void 0 : _a.resolvedFileName) && !((_b = resolution.resolvedTypeReferenceDirective) === null || _b === void 0 ? void 0 : _b.resolvedFileName))
|
|
122447
|
-
return;
|
|
122448
|
-
if (dirCache === null || dirCache === void 0 ? void 0 : dirCache.has(name, mode))
|
|
122449
|
-
return;
|
|
122450
|
-
// If there was already external module resolution that is same, set for child directory, dont set resolution for this directory
|
|
122451
|
-
if (moduleNameToDirectoryMap &&
|
|
122452
|
-
!ts.isExternalModuleNameRelative(name) &&
|
|
122453
|
-
((_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))) {
|
|
122454
|
-
return;
|
|
122455
|
-
}
|
|
122456
|
-
if (!dirCache) {
|
|
122457
|
-
perDirResolutionCache !== null && perDirResolutionCache !== void 0 ? perDirResolutionCache : (perDirResolutionCache = (cacheWithRedirects !== null && cacheWithRedirects !== void 0 ? cacheWithRedirects : (cacheWithRedirects = ts.createCacheWithRedirects(state.compilerOptions))).getOrCreateMapOfCacheRedirects(redirectedReference));
|
|
122458
|
-
perDirResolutionCache.set(dirPath, dirCache = ts.createModeAwareCache());
|
|
122459
|
-
}
|
|
122460
|
-
dirCache.set(name, mode, resolution);
|
|
122461
|
-
if (!moduleNameToDirectoryMap || ts.isExternalModuleNameRelative(name))
|
|
122462
|
-
return;
|
|
122463
|
-
// put result in per-module name cache and delete everything that is not needed
|
|
122464
|
-
var actualModuleNameToDirectoryMap = moduleNameToDirectoryMap.getOrCreateMapOfCacheRedirects(redirectedReference);
|
|
122465
|
-
var key = ts.getModeAwareCacheKey(name, mode);
|
|
122466
|
-
var directoryPathMap = actualModuleNameToDirectoryMap.get(key);
|
|
122467
|
-
if (!directoryPathMap)
|
|
122468
|
-
actualModuleNameToDirectoryMap.set(key, directoryPathMap = new ts.Map());
|
|
122469
|
-
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); });
|
|
122470
|
-
});
|
|
122471
|
-
return cacheWithRedirects;
|
|
121887
|
+
function convertToReusableDiagnosticRelatedInformation(diagnostic, relativeToBuildInfo) {
|
|
121888
|
+
var file = diagnostic.file;
|
|
121889
|
+
return __assign(__assign({}, diagnostic), { file: file ? relativeToBuildInfo(file.resolvedPath) : undefined });
|
|
122472
121890
|
}
|
|
122473
121891
|
var BuilderProgramKind;
|
|
122474
121892
|
(function (BuilderProgramKind) {
|
|
@@ -122492,7 +121910,7 @@ var ts;
|
|
|
122492
121910
|
rootNames: newProgramOrRootNames,
|
|
122493
121911
|
options: hostOrOptions,
|
|
122494
121912
|
host: oldProgramOrHost,
|
|
122495
|
-
oldProgram: oldProgram
|
|
121913
|
+
oldProgram: oldProgram && oldProgram.getProgramOrUndefined(),
|
|
122496
121914
|
configFileParsingDiagnostics: configFileParsingDiagnostics,
|
|
122497
121915
|
projectReferences: projectReferences
|
|
122498
121916
|
});
|
|
@@ -122510,8 +121928,8 @@ var ts;
|
|
|
122510
121928
|
function getTextHandlingSourceMapForSignature(text, data) {
|
|
122511
121929
|
return (data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text;
|
|
122512
121930
|
}
|
|
122513
|
-
function computeSignatureWithDiagnostics(sourceFile, text,
|
|
122514
|
-
var _a
|
|
121931
|
+
function computeSignatureWithDiagnostics(sourceFile, text, computeHash, getCanonicalFileName, data) {
|
|
121932
|
+
var _a;
|
|
122515
121933
|
text = getTextHandlingSourceMapForSignature(text, data);
|
|
122516
121934
|
var sourceFileDirectory;
|
|
122517
121935
|
if ((_a = data === null || data === void 0 ? void 0 : data.diagnostics) === null || _a === void 0 ? void 0 : _a.length) {
|
|
@@ -122519,7 +121937,7 @@ var ts;
|
|
|
122519
121937
|
return "" + locationInfo(diagnostic) + ts.DiagnosticCategory[diagnostic.category] + diagnostic.code + ": " + flattenDiagnosticMessageText(diagnostic.messageText);
|
|
122520
121938
|
}).join("\n");
|
|
122521
121939
|
}
|
|
122522
|
-
return (
|
|
121940
|
+
return (computeHash !== null && computeHash !== void 0 ? computeHash : ts.generateDjb2Hash)(text);
|
|
122523
121941
|
function flattenDiagnosticMessageText(diagnostic) {
|
|
122524
121942
|
return ts.isString(diagnostic) ?
|
|
122525
121943
|
diagnostic :
|
|
@@ -122538,9 +121956,8 @@ var ts;
|
|
|
122538
121956
|
}
|
|
122539
121957
|
}
|
|
122540
121958
|
ts.computeSignatureWithDiagnostics = computeSignatureWithDiagnostics;
|
|
122541
|
-
function computeSignature(text,
|
|
122542
|
-
|
|
122543
|
-
return ((_a = host.createHash) !== null && _a !== void 0 ? _a : ts.generateDjb2Hash)(getTextHandlingSourceMapForSignature(text, data));
|
|
121959
|
+
function computeSignature(text, computeHash, data) {
|
|
121960
|
+
return (computeHash !== null && computeHash !== void 0 ? computeHash : ts.generateDjb2Hash)(getTextHandlingSourceMapForSignature(text, data));
|
|
122544
121961
|
}
|
|
122545
121962
|
ts.computeSignature = computeSignature;
|
|
122546
121963
|
function createBuilderProgram(kind, _a) {
|
|
@@ -122552,8 +121969,16 @@ var ts;
|
|
|
122552
121969
|
oldState = undefined;
|
|
122553
121970
|
return oldProgram;
|
|
122554
121971
|
}
|
|
122555
|
-
|
|
122556
|
-
|
|
121972
|
+
/**
|
|
121973
|
+
* Create the canonical file name for identity
|
|
121974
|
+
*/
|
|
121975
|
+
var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
|
|
121976
|
+
/**
|
|
121977
|
+
* Computing hash to for signature verification
|
|
121978
|
+
*/
|
|
121979
|
+
var computeHash = ts.maybeBind(host, host.createHash);
|
|
121980
|
+
var state = createBuilderProgramState(newProgram, getCanonicalFileName, oldState, host.disableUseFileVersionAsSignature);
|
|
121981
|
+
newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName); };
|
|
122557
121982
|
// To ensure that we arent storing any references to old program or new program without state
|
|
122558
121983
|
newProgram = undefined; // TODO: GH#18217
|
|
122559
121984
|
oldProgram = undefined;
|
|
@@ -122568,7 +121993,6 @@ var ts;
|
|
|
122568
121993
|
builderProgram.getSemanticDiagnostics = getSemanticDiagnostics;
|
|
122569
121994
|
builderProgram.emit = emit;
|
|
122570
121995
|
builderProgram.releaseProgram = function () { return releaseCache(state); };
|
|
122571
|
-
builderProgram.getProgramOrOldBuildInfoProgramUndefined = createGetProgramOrOldBuildInfoProgramUndefined(state);
|
|
122572
121996
|
if (kind === BuilderProgramKind.SemanticDiagnosticsBuilderProgram) {
|
|
122573
121997
|
builderProgram.getSemanticDiagnosticsOfNextAffectedFile = getSemanticDiagnosticsOfNextAffectedFile;
|
|
122574
121998
|
}
|
|
@@ -122595,7 +122019,7 @@ var ts;
|
|
|
122595
122019
|
* in that order would be used to write the files
|
|
122596
122020
|
*/
|
|
122597
122021
|
function emitNextAffectedFile(writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) {
|
|
122598
|
-
var affected = getNextAffectedFile(state, cancellationToken, host);
|
|
122022
|
+
var affected = getNextAffectedFile(state, cancellationToken, computeHash, getCanonicalFileName, host);
|
|
122599
122023
|
var emitKind = 1 /* Full */;
|
|
122600
122024
|
var isPendingEmitFile = false;
|
|
122601
122025
|
if (!affected) {
|
|
@@ -122641,7 +122065,7 @@ var ts;
|
|
|
122641
122065
|
var file = sourceFiles[0];
|
|
122642
122066
|
var info = state.fileInfos.get(file.resolvedPath);
|
|
122643
122067
|
if (info.signature === file.version) {
|
|
122644
|
-
var signature = computeSignatureWithDiagnostics(file, text,
|
|
122068
|
+
var signature = computeSignatureWithDiagnostics(file, text, computeHash, getCanonicalFileName, data);
|
|
122645
122069
|
// 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
|
|
122646
122070
|
if (!((_a = data === null || data === void 0 ? void 0 : data.diagnostics) === null || _a === void 0 ? void 0 : _a.length))
|
|
122647
122071
|
emitSignature = signature;
|
|
@@ -122671,7 +122095,7 @@ var ts;
|
|
|
122671
122095
|
if (state.compilerOptions.composite) {
|
|
122672
122096
|
var filePath = sourceFiles[0].resolvedPath;
|
|
122673
122097
|
var oldSignature = (_f = state.emitSignatures) === null || _f === void 0 ? void 0 : _f.get(filePath);
|
|
122674
|
-
emitSignature !== null && emitSignature !== void 0 ? emitSignature : (emitSignature = computeSignature(text,
|
|
122098
|
+
emitSignature !== null && emitSignature !== void 0 ? emitSignature : (emitSignature = computeSignature(text, computeHash, data));
|
|
122675
122099
|
// Dont write dts files if they didn't change
|
|
122676
122100
|
if (emitSignature === oldSignature)
|
|
122677
122101
|
return;
|
|
@@ -122681,7 +122105,7 @@ var ts;
|
|
|
122681
122105
|
}
|
|
122682
122106
|
}
|
|
122683
122107
|
else if (state.compilerOptions.composite) {
|
|
122684
|
-
var newSignature = computeSignature(text,
|
|
122108
|
+
var newSignature = computeSignature(text, computeHash, data);
|
|
122685
122109
|
// Dont write dts files if they didn't change
|
|
122686
122110
|
if (newSignature === state.outSignature)
|
|
122687
122111
|
return;
|
|
@@ -122763,7 +122187,7 @@ var ts;
|
|
|
122763
122187
|
*/
|
|
122764
122188
|
function getSemanticDiagnosticsOfNextAffectedFile(cancellationToken, ignoreSourceFile) {
|
|
122765
122189
|
while (true) {
|
|
122766
|
-
var affected = getNextAffectedFile(state, cancellationToken, host);
|
|
122190
|
+
var affected = getNextAffectedFile(state, cancellationToken, computeHash, getCanonicalFileName, host);
|
|
122767
122191
|
if (!affected) {
|
|
122768
122192
|
// Done
|
|
122769
122193
|
return undefined;
|
|
@@ -122843,32 +122267,12 @@ var ts;
|
|
|
122843
122267
|
{ version: fileInfo.version, signature: fileInfo.signature === false ? undefined : fileInfo.version, affectsGlobalScope: fileInfo.affectsGlobalScope, impliedFormat: fileInfo.impliedFormat };
|
|
122844
122268
|
}
|
|
122845
122269
|
ts.toBuilderStateFileInfo = toBuilderStateFileInfo;
|
|
122846
|
-
function
|
|
122847
|
-
var
|
|
122848
|
-
var
|
|
122849
|
-
var
|
|
122850
|
-
return { toAbsolutePath: toAbsolutePath, toFilePath: toFilePath, toFileAbsolutePath: toFileAbsolutePath, currentDirectory: currentDirectory, getCanonicalFileName: getCanonicalFileName };
|
|
122851
|
-
function toPath(path) {
|
|
122852
|
-
return ts.toPath(path, buildInfoDirectory, getCanonicalFileName);
|
|
122853
|
-
}
|
|
122854
|
-
function toAbsolutePath(path) {
|
|
122855
|
-
return ts.getNormalizedAbsolutePath(path, buildInfoDirectory);
|
|
122856
|
-
}
|
|
122857
|
-
function toFilePath(fileId) {
|
|
122858
|
-
var _a;
|
|
122859
|
-
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]));
|
|
122860
|
-
}
|
|
122861
|
-
function toFileAbsolutePath(fileId) {
|
|
122862
|
-
var _a;
|
|
122863
|
-
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]));
|
|
122864
|
-
}
|
|
122865
|
-
}
|
|
122866
|
-
ts.getProgramBuildInfoFilePathDecoder = getProgramBuildInfoFilePathDecoder;
|
|
122867
|
-
function createBuilderProgramUsingProgramBuildInfo(program, buildInfoPath, host, configFilePath) {
|
|
122868
|
-
var _a, _b, _c;
|
|
122869
|
-
var buildInfoFilePathDecoder = getProgramBuildInfoFilePathDecoder(program.fileNames, buildInfoPath, host.getCurrentDirectory(), ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames()));
|
|
122870
|
-
var toFilePath = buildInfoFilePathDecoder.toFilePath, toAbsolutePath = buildInfoFilePathDecoder.toAbsolutePath;
|
|
122270
|
+
function createBuilderProgramUsingProgramBuildInfo(program, buildInfoPath, host) {
|
|
122271
|
+
var _a, _b, _c, _d;
|
|
122272
|
+
var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
|
|
122273
|
+
var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
|
|
122871
122274
|
var state;
|
|
122275
|
+
var filePaths;
|
|
122872
122276
|
var filePathsSetList;
|
|
122873
122277
|
var latestChangedDtsFile = program.latestChangedDtsFile ? toAbsolutePath(program.latestChangedDtsFile) : undefined;
|
|
122874
122278
|
if (isProgramBundleEmitBuildInfo(program)) {
|
|
@@ -122877,13 +122281,13 @@ var ts;
|
|
|
122877
122281
|
compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
|
|
122878
122282
|
latestChangedDtsFile: latestChangedDtsFile,
|
|
122879
122283
|
outSignature: program.outSignature,
|
|
122880
|
-
resuableCacheResolutions: toResuableCacheResolutions(),
|
|
122881
122284
|
};
|
|
122882
122285
|
}
|
|
122883
122286
|
else {
|
|
122884
|
-
|
|
122287
|
+
filePaths = (_a = program.fileNames) === null || _a === void 0 ? void 0 : _a.map(toPath);
|
|
122288
|
+
filePathsSetList = (_b = program.fileIdsList) === null || _b === void 0 ? void 0 : _b.map(function (fileIds) { return new ts.Set(fileIds.map(toFilePath)); });
|
|
122885
122289
|
var fileInfos_2 = new ts.Map();
|
|
122886
|
-
var emitSignatures_1 = ((
|
|
122290
|
+
var emitSignatures_1 = ((_c = program.options) === null || _c === void 0 ? void 0 : _c.composite) && !ts.outFile(program.options) ? new ts.Map() : undefined;
|
|
122887
122291
|
program.fileInfos.forEach(function (fileInfo, index) {
|
|
122888
122292
|
var path = toFilePath(index + 1);
|
|
122889
122293
|
var stateFileInfo = toBuilderStateFileInfo(fileInfo);
|
|
@@ -122891,7 +122295,7 @@ var ts;
|
|
|
122891
122295
|
if (emitSignatures_1 && stateFileInfo.signature)
|
|
122892
122296
|
emitSignatures_1.set(path, stateFileInfo.signature);
|
|
122893
122297
|
});
|
|
122894
|
-
(
|
|
122298
|
+
(_d = program.emitSignatures) === null || _d === void 0 ? void 0 : _d.forEach(function (value) {
|
|
122895
122299
|
if (ts.isNumber(value))
|
|
122896
122300
|
emitSignatures_1.delete(toFilePath(value));
|
|
122897
122301
|
else
|
|
@@ -122910,17 +122314,14 @@ var ts;
|
|
|
122910
122314
|
changedFilesSet: new ts.Set(ts.map(program.changeFileSet, toFilePath)),
|
|
122911
122315
|
latestChangedDtsFile: latestChangedDtsFile,
|
|
122912
122316
|
emitSignatures: (emitSignatures_1 === null || emitSignatures_1 === void 0 ? void 0 : emitSignatures_1.size) ? emitSignatures_1 : undefined,
|
|
122913
|
-
resuableCacheResolutions: toResuableCacheResolutions(),
|
|
122914
122317
|
};
|
|
122915
122318
|
}
|
|
122916
|
-
state.compilerOptions.configFilePath = configFilePath;
|
|
122917
122319
|
return {
|
|
122918
122320
|
getState: function () { return state; },
|
|
122919
122321
|
saveEmitState: ts.noop,
|
|
122920
122322
|
restoreEmitState: ts.noop,
|
|
122921
122323
|
getProgram: ts.notImplemented,
|
|
122922
122324
|
getProgramOrUndefined: ts.returnUndefined,
|
|
122923
|
-
getProgramOrOldBuildInfoProgramUndefined: createGetProgramOrOldBuildInfoProgramUndefined(state),
|
|
122924
122325
|
releaseProgram: ts.noop,
|
|
122925
122326
|
getCompilerOptions: function () { return state.compilerOptions; },
|
|
122926
122327
|
getSourceFile: ts.notImplemented,
|
|
@@ -122940,6 +122341,15 @@ var ts;
|
|
|
122940
122341
|
close: ts.noop,
|
|
122941
122342
|
hasChangedEmitSignature: ts.returnFalse,
|
|
122942
122343
|
};
|
|
122344
|
+
function toPath(path) {
|
|
122345
|
+
return ts.toPath(path, buildInfoDirectory, getCanonicalFileName);
|
|
122346
|
+
}
|
|
122347
|
+
function toAbsolutePath(path) {
|
|
122348
|
+
return ts.getNormalizedAbsolutePath(path, buildInfoDirectory);
|
|
122349
|
+
}
|
|
122350
|
+
function toFilePath(fileId) {
|
|
122351
|
+
return filePaths[fileId - 1];
|
|
122352
|
+
}
|
|
122943
122353
|
function toFilePathsSet(fileIdsListId) {
|
|
122944
122354
|
return filePathsSetList[fileIdsListId - 1];
|
|
122945
122355
|
}
|
|
@@ -122954,194 +122364,8 @@ var ts;
|
|
|
122954
122364
|
});
|
|
122955
122365
|
return map;
|
|
122956
122366
|
}
|
|
122957
|
-
function toResuableCacheResolutions() {
|
|
122958
|
-
return program.cacheResolutions && {
|
|
122959
|
-
cache: program.cacheResolutions,
|
|
122960
|
-
getProgramBuildInfoFilePathDecoder: function () { return buildInfoFilePathDecoder; },
|
|
122961
|
-
};
|
|
122962
|
-
}
|
|
122963
122367
|
}
|
|
122964
122368
|
ts.createBuilderProgramUsingProgramBuildInfo = createBuilderProgramUsingProgramBuildInfo;
|
|
122965
|
-
function createGetProgramOrOldBuildInfoProgramUndefined(state) {
|
|
122966
|
-
return function () {
|
|
122967
|
-
var _a;
|
|
122968
|
-
return (_a = state.program) !== null && _a !== void 0 ? _a : (state.cacheResolutions || state.resuableCacheResolutions ?
|
|
122969
|
-
(function (host) { return createOldBuildInfoProgram(host, state.compilerOptions, state.cacheResolutions,
|
|
122970
|
-
// Prefer cached resolutions over serialized format
|
|
122971
|
-
!state.cacheResolutions ? state.resuableCacheResolutions : undefined); }) :
|
|
122972
|
-
undefined);
|
|
122973
|
-
};
|
|
122974
|
-
}
|
|
122975
|
-
function createOldBuildInfoProgram(host, compilerOptions, cacheResolutions, resuableCacheResolutions) {
|
|
122976
|
-
if (!cacheResolutions && !resuableCacheResolutions)
|
|
122977
|
-
return undefined;
|
|
122978
|
-
var fileExistsMap = new ts.Map();
|
|
122979
|
-
var affectingLoationsSameMap = new ts.Map();
|
|
122980
|
-
var decodedResolvedModules = ts.createCacheWithRedirects(compilerOptions);
|
|
122981
|
-
var decodedResolvedTypeRefs = ts.createCacheWithRedirects(compilerOptions);
|
|
122982
|
-
var decodedModuleNameToDirectoryMap = ts.createCacheWithRedirects(compilerOptions);
|
|
122983
|
-
var decodedHashes;
|
|
122984
|
-
var resolutions;
|
|
122985
|
-
var originalPathOrResolvedFileNames;
|
|
122986
|
-
var resolutionEntries;
|
|
122987
|
-
return {
|
|
122988
|
-
getCompilerOptions: function () { return compilerOptions; },
|
|
122989
|
-
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); },
|
|
122990
|
-
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,
|
|
122991
|
-
/*moduleNameToDirectoryMap*/ undefined,
|
|
122992
|
-
/*decodedModuleNameToDirectoryMap*/ undefined); },
|
|
122993
|
-
};
|
|
122994
|
-
function fileExists(fileName) {
|
|
122995
|
-
var result = fileExistsMap.get(fileName);
|
|
122996
|
-
if (result === undefined)
|
|
122997
|
-
fileExistsMap.set(fileName, result = host.fileExists(fileName));
|
|
122998
|
-
return result;
|
|
122999
|
-
}
|
|
123000
|
-
function affectingLocationsSame(fileName, expected) {
|
|
123001
|
-
var _a;
|
|
123002
|
-
var result = affectingLoationsSameMap.get(fileName);
|
|
123003
|
-
if (result !== undefined)
|
|
123004
|
-
return result;
|
|
123005
|
-
var packageJsonInfo = host.getPackageJsonInfo(fileName);
|
|
123006
|
-
var currentText = typeof packageJsonInfo === "object" ? packageJsonInfo.packageJsonText : undefined;
|
|
123007
|
-
if (ts.isString(expected)) {
|
|
123008
|
-
result = !!currentText && ((_a = host.createHash) !== null && _a !== void 0 ? _a : ts.generateDjb2Hash)(currentText) === expected;
|
|
123009
|
-
}
|
|
123010
|
-
else {
|
|
123011
|
-
var expectedText = typeof expected === "object" ? expected.packageJsonText : undefined;
|
|
123012
|
-
result = currentText === expectedText;
|
|
123013
|
-
}
|
|
123014
|
-
affectingLoationsSameMap.set(fileName, result);
|
|
123015
|
-
return result;
|
|
123016
|
-
}
|
|
123017
|
-
function getResolvedFromCache(cache, reusableCache, decodedReusableCache, dirPath, name, mode, redirectedReference, moduleNameToDirectoryMap, decodedModuleNameToDirectoryMap) {
|
|
123018
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
123019
|
-
// If we are using the cache, directly get from there
|
|
123020
|
-
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)) ||
|
|
123021
|
-
((_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));
|
|
123022
|
-
if (fromCache) {
|
|
123023
|
-
return fileExists(((_e = fromCache.resolvedModule) === null || _e === void 0 ? void 0 : _e.resolvedFileName) ||
|
|
123024
|
-
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;
|
|
123025
|
-
}
|
|
123026
|
-
if (!reusableCache)
|
|
123027
|
-
return undefined;
|
|
123028
|
-
// Decode so we have maps for directories
|
|
123029
|
-
if (!decodedReusableCache.getOwnMap().size && !decodedReusableCache.redirectsKeyToCache.size) {
|
|
123030
|
-
if (ts.isArray(reusableCache)) {
|
|
123031
|
-
setBuildInfoResolutionEntries(decodedReusableCache, compilerOptions, /*optionsKey*/ undefined, reusableCache, decodedModuleNameToDirectoryMap);
|
|
123032
|
-
}
|
|
123033
|
-
else {
|
|
123034
|
-
if (reusableCache.own)
|
|
123035
|
-
setBuildInfoResolutionEntries(decodedReusableCache, compilerOptions, /*optionsKey*/ undefined, reusableCache.own, decodedModuleNameToDirectoryMap);
|
|
123036
|
-
reusableCache.redirects.forEach(function (_a) {
|
|
123037
|
-
var options = _a.options, cache = _a.cache;
|
|
123038
|
-
var compilerOptions = options ? ts.convertToOptionsWithAbsolutePaths(options, resuableCacheResolutions.getProgramBuildInfoFilePathDecoder().toAbsolutePath) : {};
|
|
123039
|
-
setBuildInfoResolutionEntries(decodedReusableCache, compilerOptions, ts.getRedirectsCacheKey(compilerOptions), cache, decodedModuleNameToDirectoryMap);
|
|
123040
|
-
});
|
|
123041
|
-
}
|
|
123042
|
-
// Ensure redirected reference verifies options before using redirects map
|
|
123043
|
-
decodedReusableCache.clearRedirectsMap();
|
|
123044
|
-
decodedModuleNameToDirectoryMap === null || decodedModuleNameToDirectoryMap === void 0 ? void 0 : decodedModuleNameToDirectoryMap.clearRedirectsMap();
|
|
123045
|
-
}
|
|
123046
|
-
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)) ||
|
|
123047
|
-
((_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));
|
|
123048
|
-
return resolutionId ? toResolution(resolutionId) : undefined;
|
|
123049
|
-
}
|
|
123050
|
-
function setBuildInfoResolutionEntries(decodedReusableCache, options, optionsKey, reusableCache, decodedModuleNameToDirectoryMap) {
|
|
123051
|
-
var map = decodedReusableCache.createMapForCompilerOptions(options, optionsKey);
|
|
123052
|
-
reusableCache.forEach(function (_a) {
|
|
123053
|
-
var dirId = _a[0], entryId = _a[1];
|
|
123054
|
-
var dirPath = resuableCacheResolutions.getProgramBuildInfoFilePathDecoder().toFilePath(dirId);
|
|
123055
|
-
map.set(dirPath, toModeAwareCache(entryId, dirPath, options, optionsKey, decodedModuleNameToDirectoryMap));
|
|
123056
|
-
});
|
|
123057
|
-
}
|
|
123058
|
-
function toModeAwareCache(entries, dirPath, options, optionsKey, decodedModuleNameToDirectoryMap) {
|
|
123059
|
-
var modeAwareCache = ts.createModeAwareCache();
|
|
123060
|
-
entries.forEach(function (entryId) {
|
|
123061
|
-
var _a = toResolutionEntry(entryId), name = _a[0], resolutionId = _a[1], mode = _a[2];
|
|
123062
|
-
modeAwareCache.set(name, mode, resolutionId);
|
|
123063
|
-
if (!decodedModuleNameToDirectoryMap || ts.isExternalModuleNameRelative(name))
|
|
123064
|
-
return;
|
|
123065
|
-
var mapForOptions = decodedModuleNameToDirectoryMap.createMapForCompilerOptions(options, optionsKey);
|
|
123066
|
-
var key = ts.getModeAwareCacheKey(name, mode);
|
|
123067
|
-
var moduleNameMap = mapForOptions.get(key);
|
|
123068
|
-
;
|
|
123069
|
-
if (!moduleNameMap)
|
|
123070
|
-
mapForOptions.set(key, moduleNameMap = new ts.Map());
|
|
123071
|
-
ts.moduleNameToDirectorySet(moduleNameMap, dirPath, resolutionId, toOriginalPathOrResolvedFileName, function (fileName) { return ts.toPath(fileName, resuableCacheResolutions.getProgramBuildInfoFilePathDecoder().currentDirectory, resuableCacheResolutions.getProgramBuildInfoFilePathDecoder().getCanonicalFileName); }, ts.noop);
|
|
123072
|
-
});
|
|
123073
|
-
return modeAwareCache;
|
|
123074
|
-
}
|
|
123075
|
-
function toResolutionEntry(entryId) {
|
|
123076
|
-
var existing = resolutionEntries === null || resolutionEntries === void 0 ? void 0 : resolutionEntries[entryId - 1];
|
|
123077
|
-
if (existing)
|
|
123078
|
-
return existing;
|
|
123079
|
-
resolutionEntries !== null && resolutionEntries !== void 0 ? resolutionEntries : (resolutionEntries = new Array(resuableCacheResolutions.cache.resolutionEntries.length));
|
|
123080
|
-
var _a = resuableCacheResolutions.cache.resolutionEntries[entryId - 1], nameId = _a[0], resolutionId = _a[1], mode = _a[2];
|
|
123081
|
-
return resolutionEntries[entryId - 1] = [
|
|
123082
|
-
toName(nameId),
|
|
123083
|
-
resolutionId,
|
|
123084
|
-
mode
|
|
123085
|
-
];
|
|
123086
|
-
}
|
|
123087
|
-
function toName(nameId) {
|
|
123088
|
-
return resuableCacheResolutions.cache.names[nameId - 1];
|
|
123089
|
-
}
|
|
123090
|
-
function toOriginalPathOrResolvedFileName(resolutionId) {
|
|
123091
|
-
var _a;
|
|
123092
|
-
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 ||
|
|
123093
|
-
resuableCacheResolutions.cache.resolutions[resolutionId - 1].resolvedModule.resolvedFileName));
|
|
123094
|
-
}
|
|
123095
|
-
function toAffectingFileLocation(fileId) {
|
|
123096
|
-
if (!decodedHashes && resuableCacheResolutions.cache.hash) {
|
|
123097
|
-
decodedHashes = ts.arrayToMap(resuableCacheResolutions.cache.hash, function (hash) { return ts.isArray(hash) ? hash[0] : hash; }, function (hash) { return ts.isArray(hash) ? hash[1] : undefined; });
|
|
123098
|
-
}
|
|
123099
|
-
var hash = decodedHashes === null || decodedHashes === void 0 ? void 0 : decodedHashes.get(fileId);
|
|
123100
|
-
var file = resuableCacheResolutions.getProgramBuildInfoFilePathDecoder().toFileAbsolutePath(fileId);
|
|
123101
|
-
return affectingLocationsSame(file, hash) ? file : undefined;
|
|
123102
|
-
}
|
|
123103
|
-
function toResolution(resolutionId) {
|
|
123104
|
-
var _a, _b;
|
|
123105
|
-
var existing = resolutions === null || resolutions === void 0 ? void 0 : resolutions[resolutionId - 1];
|
|
123106
|
-
if (existing !== undefined)
|
|
123107
|
-
return existing || undefined;
|
|
123108
|
-
resolutions !== null && resolutions !== void 0 ? resolutions : (resolutions = new Array(resuableCacheResolutions.cache.resolutions.length));
|
|
123109
|
-
var resolution = resuableCacheResolutions.cache.resolutions[resolutionId - 1];
|
|
123110
|
-
var resolvedFileName = resuableCacheResolutions.getProgramBuildInfoFilePathDecoder().toFileAbsolutePath(((_a = resolution.resolvedModule) === null || _a === void 0 ? void 0 : _a.resolvedFileName) || resolution.resolvedTypeReferenceDirective.resolvedFileName);
|
|
123111
|
-
var affectingLocations;
|
|
123112
|
-
if (fileExists(resolvedFileName) && ts.every(resolution.affectingLocations, function (fileId) {
|
|
123113
|
-
var file = toAffectingFileLocation(fileId);
|
|
123114
|
-
if (file)
|
|
123115
|
-
(affectingLocations !== null && affectingLocations !== void 0 ? affectingLocations : (affectingLocations = [])).push(file);
|
|
123116
|
-
return !!file;
|
|
123117
|
-
})) {
|
|
123118
|
-
// Type Ref doesnt need extension
|
|
123119
|
-
var extenstion = resolution.resolvedModule ? ts.extensionFromPath(resolvedFileName) : undefined;
|
|
123120
|
-
return resolutions[resolutionId - 1] = {
|
|
123121
|
-
resolvedModule: toResolved(resolution.resolvedModule, resolvedFileName, extenstion),
|
|
123122
|
-
resolvedTypeReferenceDirective: toResolved(resolution.resolvedTypeReferenceDirective, resolvedFileName, extenstion),
|
|
123123
|
-
failedLookupLocations: ts.emptyArray,
|
|
123124
|
-
affectingLocations: affectingLocations,
|
|
123125
|
-
resolutionDiagnostics: (_b = resolution.resolutionDiagnostics) === null || _b === void 0 ? void 0 : _b.map(toResolutionDiagnostic)
|
|
123126
|
-
};
|
|
123127
|
-
}
|
|
123128
|
-
resolutions[resolutionId - 1] = false;
|
|
123129
|
-
return undefined;
|
|
123130
|
-
}
|
|
123131
|
-
function toResolved(resolved, resolvedFileName, extension) {
|
|
123132
|
-
if (!resolved)
|
|
123133
|
-
return undefined;
|
|
123134
|
-
return __assign(__assign({}, resolved), { resolvedFileName: resolvedFileName, originalPath: resolved.originalPath ? resuableCacheResolutions.getProgramBuildInfoFilePathDecoder().toFileAbsolutePath(resolved.originalPath) : undefined, extension: extension });
|
|
123135
|
-
}
|
|
123136
|
-
function toResolutionDiagnostic(d) {
|
|
123137
|
-
return {
|
|
123138
|
-
isImports: !!d.isImports,
|
|
123139
|
-
entry: d.entry || "",
|
|
123140
|
-
packagePath: resuableCacheResolutions.getProgramBuildInfoFilePathDecoder().toFileAbsolutePath(d.packagePath)
|
|
123141
|
-
};
|
|
123142
|
-
}
|
|
123143
|
-
}
|
|
123144
|
-
ts.createOldBuildInfoProgram = createOldBuildInfoProgram;
|
|
123145
122369
|
function getBuildInfoFileVersionMap(program, buildInfoPath, host) {
|
|
123146
122370
|
var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
|
|
123147
122371
|
var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
|
|
@@ -123161,7 +122385,6 @@ var ts;
|
|
|
123161
122385
|
restoreEmitState: ts.noop,
|
|
123162
122386
|
getProgram: getProgram,
|
|
123163
122387
|
getProgramOrUndefined: function () { return getState().program; },
|
|
123164
|
-
getProgramOrOldBuildInfoProgramUndefined: function () { return getState().program; },
|
|
123165
122388
|
releaseProgram: function () { return getState().program = undefined; },
|
|
123166
122389
|
getCompilerOptions: function () { return getState().compilerOptions; },
|
|
123167
122390
|
getSourceFile: function (fileName) { return getProgram().getSourceFile(fileName); },
|
|
@@ -123260,10 +122483,11 @@ var ts;
|
|
|
123260
122483
|
function createResolutionCache(resolutionHost, rootDirForResolution, logChangesWhenResolvingModule) {
|
|
123261
122484
|
var filesWithChangedSetOfUnresolvedImports;
|
|
123262
122485
|
var filesWithInvalidatedResolutions;
|
|
122486
|
+
var filesWithInvalidatedNonRelativeUnresolvedImports;
|
|
122487
|
+
var nonRelativeExternalModuleResolutions = ts.createMultiMap();
|
|
123263
122488
|
var resolutionsWithFailedLookups = [];
|
|
123264
122489
|
var resolutionsWithOnlyAffectingLocations = [];
|
|
123265
122490
|
var resolvedFileToResolution = ts.createMultiMap();
|
|
123266
|
-
var resolutionsToCloseWatcherOn;
|
|
123267
122491
|
var hasChangedAutomaticTypeDirectiveNames = false;
|
|
123268
122492
|
var affectingPathChecks;
|
|
123269
122493
|
var failedLookupChecks;
|
|
@@ -123271,15 +122495,18 @@ var ts;
|
|
|
123271
122495
|
var isInDirectoryChecks;
|
|
123272
122496
|
var getCurrentDirectory = ts.memoize(function () { return resolutionHost.getCurrentDirectory(); }); // TODO: GH#18217
|
|
123273
122497
|
var cachedDirectoryStructureHost = resolutionHost.getCachedDirectoryStructureHost();
|
|
123274
|
-
var oldModuleAndTypeRefCache;
|
|
123275
122498
|
// The resolvedModuleNames and resolvedTypeReferenceDirectives are the cache of resolutions per file.
|
|
123276
122499
|
// The key in the map is source file's path.
|
|
123277
122500
|
// The values are Map of resolutions with key being name lookedup.
|
|
123278
122501
|
var resolvedModuleNames = new ts.Map();
|
|
123279
|
-
var
|
|
122502
|
+
var perDirectoryResolvedModuleNames = ts.createCacheWithRedirects();
|
|
122503
|
+
var nonRelativeModuleNameCache = ts.createCacheWithRedirects();
|
|
122504
|
+
var moduleResolutionCache = ts.createModuleResolutionCache(getCurrentDirectory(), resolutionHost.getCanonicalFileName,
|
|
122505
|
+
/*options*/ undefined, perDirectoryResolvedModuleNames, nonRelativeModuleNameCache);
|
|
123280
122506
|
var resolvedTypeReferenceDirectives = new ts.Map();
|
|
122507
|
+
var perDirectoryResolvedTypeReferenceDirectives = ts.createCacheWithRedirects();
|
|
123281
122508
|
var typeReferenceDirectiveResolutionCache = ts.createTypeReferenceDirectiveResolutionCache(getCurrentDirectory(), resolutionHost.getCanonicalFileName,
|
|
123282
|
-
/*options*/ undefined, moduleResolutionCache.getPackageJsonInfoCache());
|
|
122509
|
+
/*options*/ undefined, moduleResolutionCache.getPackageJsonInfoCache(), perDirectoryResolvedTypeReferenceDirectives);
|
|
123283
122510
|
/**
|
|
123284
122511
|
* These are the extensions that failed lookup files will have by default,
|
|
123285
122512
|
* any other extension of failed lookup will be store that path in custom failed lookup path
|
|
@@ -123296,23 +122523,26 @@ var ts;
|
|
|
123296
122523
|
// TypeRoot watches for the types that get added as part of getAutomaticTypeDirectiveNames
|
|
123297
122524
|
var typeRootsWatches = new ts.Map();
|
|
123298
122525
|
return {
|
|
123299
|
-
resolvedModuleNames: resolvedModuleNames,
|
|
123300
|
-
resolvedTypeReferenceDirectives: resolvedTypeReferenceDirectives,
|
|
123301
122526
|
getModuleResolutionCache: function () { return moduleResolutionCache; },
|
|
123302
|
-
getTypeReferenceDirectiveResolutionCache: function () { return typeReferenceDirectiveResolutionCache; },
|
|
123303
122527
|
startRecordingFilesWithChangedResolutions: startRecordingFilesWithChangedResolutions,
|
|
123304
122528
|
finishRecordingFilesWithChangedResolutions: finishRecordingFilesWithChangedResolutions,
|
|
123305
122529
|
// perDirectoryResolvedModuleNames and perDirectoryResolvedTypeReferenceDirectives could be non empty if there was exception during program update
|
|
123306
122530
|
// (between startCachingPerDirectoryResolution and finishCachingPerDirectoryResolution)
|
|
123307
|
-
startCachingPerDirectoryResolution:
|
|
122531
|
+
startCachingPerDirectoryResolution: clearPerDirectoryResolutions,
|
|
123308
122532
|
finishCachingPerDirectoryResolution: finishCachingPerDirectoryResolution,
|
|
123309
122533
|
resolveModuleNames: resolveModuleNames,
|
|
122534
|
+
getResolvedModuleWithFailedLookupLocationsFromCache: getResolvedModuleWithFailedLookupLocationsFromCache,
|
|
123310
122535
|
resolveTypeReferenceDirectives: resolveTypeReferenceDirectives,
|
|
122536
|
+
removeResolutionsFromProjectReferenceRedirects: removeResolutionsFromProjectReferenceRedirects,
|
|
122537
|
+
removeResolutionsOfFile: removeResolutionsOfFile,
|
|
123311
122538
|
hasChangedAutomaticTypeDirectiveNames: function () { return hasChangedAutomaticTypeDirectiveNames; },
|
|
123312
122539
|
invalidateResolutionOfFile: invalidateResolutionOfFile,
|
|
123313
122540
|
invalidateResolutionsOfFailedLookupLocations: invalidateResolutionsOfFailedLookupLocations,
|
|
123314
122541
|
setFilesWithInvalidatedNonRelativeUnresolvedImports: setFilesWithInvalidatedNonRelativeUnresolvedImports,
|
|
123315
122542
|
createHasInvalidatedResolution: createHasInvalidatedResolution,
|
|
122543
|
+
isFileWithInvalidatedNonRelativeUnresolvedImports: isFileWithInvalidatedNonRelativeUnresolvedImports,
|
|
122544
|
+
updateTypeRootsWatch: updateTypeRootsWatch,
|
|
122545
|
+
closeTypeRootsWatch: closeTypeRootsWatch,
|
|
123316
122546
|
clear: clear
|
|
123317
122547
|
};
|
|
123318
122548
|
function getResolvedModule(resolution) {
|
|
@@ -123331,6 +122561,7 @@ var ts;
|
|
|
123331
122561
|
ts.clearMap(directoryWatchesOfFailedLookups, ts.closeFileWatcherOf);
|
|
123332
122562
|
ts.clearMap(fileWatchesOfAffectingLocations, ts.closeFileWatcherOf);
|
|
123333
122563
|
customFailedLookupPaths.clear();
|
|
122564
|
+
nonRelativeExternalModuleResolutions.clear();
|
|
123334
122565
|
closeTypeRootsWatch();
|
|
123335
122566
|
resolvedModuleNames.clear();
|
|
123336
122567
|
resolvedTypeReferenceDirectives.clear();
|
|
@@ -123341,12 +122572,9 @@ var ts;
|
|
|
123341
122572
|
startsWithPathChecks = undefined;
|
|
123342
122573
|
isInDirectoryChecks = undefined;
|
|
123343
122574
|
affectingPathChecks = undefined;
|
|
123344
|
-
resolutionsToCloseWatcherOn = undefined;
|
|
123345
122575
|
// perDirectoryResolvedModuleNames and perDirectoryResolvedTypeReferenceDirectives could be non empty if there was exception during program update
|
|
123346
122576
|
// (between startCachingPerDirectoryResolution and finishCachingPerDirectoryResolution)
|
|
123347
|
-
|
|
123348
|
-
typeReferenceDirectiveResolutionCache.clear();
|
|
123349
|
-
oldModuleAndTypeRefCache = undefined;
|
|
122577
|
+
clearPerDirectoryResolutions();
|
|
123350
122578
|
hasChangedAutomaticTypeDirectiveNames = false;
|
|
123351
122579
|
}
|
|
123352
122580
|
function startRecordingFilesWithChangedResolutions() {
|
|
@@ -123357,6 +122585,14 @@ var ts;
|
|
|
123357
122585
|
filesWithChangedSetOfUnresolvedImports = undefined;
|
|
123358
122586
|
return collected;
|
|
123359
122587
|
}
|
|
122588
|
+
function isFileWithInvalidatedNonRelativeUnresolvedImports(path) {
|
|
122589
|
+
if (!filesWithInvalidatedNonRelativeUnresolvedImports) {
|
|
122590
|
+
return false;
|
|
122591
|
+
}
|
|
122592
|
+
// Invalidated if file has unresolved imports
|
|
122593
|
+
var value = filesWithInvalidatedNonRelativeUnresolvedImports.get(path);
|
|
122594
|
+
return !!value && !!value.length;
|
|
122595
|
+
}
|
|
123360
122596
|
function createHasInvalidatedResolution(forceAllFilesAsInvalidated) {
|
|
123361
122597
|
// Ensure pending resolutions are applied
|
|
123362
122598
|
invalidateResolutionsOfFailedLookupLocations();
|
|
@@ -123367,155 +122603,36 @@ var ts;
|
|
|
123367
122603
|
}
|
|
123368
122604
|
var collected = filesWithInvalidatedResolutions;
|
|
123369
122605
|
filesWithInvalidatedResolutions = undefined;
|
|
123370
|
-
return function (path) { return !!
|
|
122606
|
+
return function (path) { return (!!collected && collected.has(path)) ||
|
|
122607
|
+
isFileWithInvalidatedNonRelativeUnresolvedImports(path); };
|
|
123371
122608
|
}
|
|
123372
|
-
function
|
|
122609
|
+
function clearPerDirectoryResolutions() {
|
|
123373
122610
|
moduleResolutionCache.clear();
|
|
123374
122611
|
typeReferenceDirectiveResolutionCache.clear();
|
|
123375
|
-
|
|
123376
|
-
|
|
123377
|
-
if (oldModuleAndTypeRefCache) {
|
|
123378
|
-
oldModuleAndTypeRefCache.clearRedirectsMap();
|
|
123379
|
-
moduleResolutionCache.setOldResolutionCache(oldModuleAndTypeRefCache.modules);
|
|
123380
|
-
typeReferenceDirectiveResolutionCache.setOldResolutionCache(oldModuleAndTypeRefCache.typeRefs);
|
|
123381
|
-
}
|
|
122612
|
+
nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfNonRelativeModuleResolutions);
|
|
122613
|
+
nonRelativeExternalModuleResolutions.clear();
|
|
123382
122614
|
}
|
|
123383
|
-
function finishCachingPerDirectoryResolution(
|
|
122615
|
+
function finishCachingPerDirectoryResolution() {
|
|
122616
|
+
filesWithInvalidatedNonRelativeUnresolvedImports = undefined;
|
|
122617
|
+
clearPerDirectoryResolutions();
|
|
122618
|
+
directoryWatchesOfFailedLookups.forEach(function (watcher, path) {
|
|
122619
|
+
if (watcher.refCount === 0) {
|
|
122620
|
+
directoryWatchesOfFailedLookups.delete(path);
|
|
122621
|
+
watcher.watcher.close();
|
|
122622
|
+
}
|
|
122623
|
+
});
|
|
122624
|
+
fileWatchesOfAffectingLocations.forEach(function (watcher, path) {
|
|
122625
|
+
if (watcher.refCount === 0) {
|
|
122626
|
+
fileWatchesOfAffectingLocations.delete(path);
|
|
122627
|
+
watcher.watcher.close();
|
|
122628
|
+
// Ensure when watching symlinked package.json, we can close the actual file watcher only once
|
|
122629
|
+
watcher.watcher = ts.noopFileWatcher;
|
|
122630
|
+
}
|
|
122631
|
+
});
|
|
123384
122632
|
hasChangedAutomaticTypeDirectiveNames = false;
|
|
123385
|
-
if (!newProgram) {
|
|
123386
|
-
clear();
|
|
123387
|
-
return;
|
|
123388
|
-
}
|
|
123389
|
-
if (newProgram === oldProgram || newProgram.structureIsReused === 3 /* Completely */)
|
|
123390
|
-
return;
|
|
123391
|
-
var modules;
|
|
123392
|
-
var typeRefs;
|
|
123393
|
-
var moduleNameToDirectoryMap = ts.createCacheWithRedirects(newProgram.getCompilerOptions());
|
|
123394
|
-
// Update resolution caches
|
|
123395
|
-
for (var _i = 0, _a = newProgram.getSourceFiles(); _i < _a.length; _i++) {
|
|
123396
|
-
var f = _a[_i];
|
|
123397
|
-
modules = ensureResolutionsOfFile(newProgram, resolvedModuleNames, f.resolvedModules, f, getResolvedModule, modules, moduleNameToDirectoryMap);
|
|
123398
|
-
typeRefs = ensureResolutionsOfFile(newProgram, resolvedTypeReferenceDirectives, f.resolvedTypeReferenceDirectiveNames, f, getResolvedTypeReferenceDirective, typeRefs,
|
|
123399
|
-
/*moduleNameToDirectoryMap*/ undefined);
|
|
123400
|
-
}
|
|
123401
|
-
var newProgramAutoTypeRefContainingFile = resolutionHost.toPath(newProgram.getAutomaticTypeDirectiveContainingFile());
|
|
123402
|
-
typeRefs = ensureResolutionsOfFile(newProgram, resolvedTypeReferenceDirectives, newProgram.getAutomaticTypeDirectiveResolutions(), newProgramAutoTypeRefContainingFile, getResolvedTypeReferenceDirective, typeRefs,
|
|
123403
|
-
/*moduleNameToDirectoryMap*/ undefined);
|
|
123404
|
-
if (!modules && !typeRefs) {
|
|
123405
|
-
oldModuleAndTypeRefCache = undefined;
|
|
123406
|
-
}
|
|
123407
|
-
else {
|
|
123408
|
-
oldModuleAndTypeRefCache = getOldResolutionCache(modules, typeRefs, moduleNameToDirectoryMap);
|
|
123409
|
-
}
|
|
123410
|
-
// Remove resolutions for files not in the program
|
|
123411
|
-
if (oldProgram) {
|
|
123412
|
-
for (var _b = 0, _c = oldProgram.getSourceFiles(); _b < _c.length; _b++) {
|
|
123413
|
-
var f = _c[_b];
|
|
123414
|
-
if (!newProgram.getSourceFileByPath(f.path))
|
|
123415
|
-
removeResolutionsOfFile(f.path);
|
|
123416
|
-
}
|
|
123417
|
-
var oldProgramAutoTypeRefContainingFile = resolutionHost.toPath(oldProgram.getAutomaticTypeDirectiveContainingFile());
|
|
123418
|
-
if (oldProgramAutoTypeRefContainingFile !== newProgramAutoTypeRefContainingFile) {
|
|
123419
|
-
removeResolutionsOfFile(oldProgramAutoTypeRefContainingFile);
|
|
123420
|
-
}
|
|
123421
|
-
}
|
|
123422
|
-
if (!oldProgram || newProgram.getCompilerOptions() !== oldProgram.getCompilerOptions())
|
|
123423
|
-
updateTypeRootsWatch();
|
|
123424
|
-
// Remove symlinked watchers that have zero ref count
|
|
123425
|
-
resolutionsToCloseWatcherOn === null || resolutionsToCloseWatcherOn === void 0 ? void 0 : resolutionsToCloseWatcherOn.forEach(closeWatchersOfResolution);
|
|
123426
|
-
resolutionsToCloseWatcherOn = undefined;
|
|
123427
|
-
fileWatchesOfAffectingLocations.forEach(closeAffectingFileWatcher);
|
|
123428
|
-
}
|
|
123429
|
-
function closeAffectingFileWatcher(watcher, path) {
|
|
123430
|
-
if (watcher.refCount === 0) {
|
|
123431
|
-
fileWatchesOfAffectingLocations.delete(path);
|
|
123432
|
-
watcher.watcher.close();
|
|
123433
|
-
// Ensure when watching symlinked package.json, we can close the actual file watcher only once
|
|
123434
|
-
watcher.watcher = ts.noopFileWatcher;
|
|
123435
|
-
}
|
|
123436
|
-
}
|
|
123437
|
-
function ensureResolutionsOfFile(newProgram, perFileCache, fileCacheFromProgram, sourceFileOrPath, getResolutionWithResolvedFileName, perDirCache, moduleNameToDirectoryMap) {
|
|
123438
|
-
var path = !ts.isString(sourceFileOrPath) ? sourceFileOrPath.path : sourceFileOrPath;
|
|
123439
|
-
var resolutionsInFile = perFileCache.get(path);
|
|
123440
|
-
var seenNamesInFile = ts.createModeAwareCache();
|
|
123441
|
-
if (fileCacheFromProgram === null || fileCacheFromProgram === void 0 ? void 0 : fileCacheFromProgram.size()) {
|
|
123442
|
-
// If keys dont match release existing resolutions
|
|
123443
|
-
var redirectedReference = !ts.isString(sourceFileOrPath) ? newProgram.getRedirectReferenceForResolution(sourceFileOrPath) : undefined;
|
|
123444
|
-
var options_3 = (redirectedReference === null || redirectedReference === void 0 ? void 0 : redirectedReference.commandLine.options) || newProgram.getCompilerOptions();
|
|
123445
|
-
var key_2 = ts.getRedirectsCacheKey(options_3);
|
|
123446
|
-
if (resolutionsInFile && resolutionsInFile.key !== key_2) {
|
|
123447
|
-
resolutionsInFile.cache.forEach(function (r) { return stopWatchingResolution(r, path, getResolutionWithResolvedFileName); });
|
|
123448
|
-
resolutionsInFile = undefined;
|
|
123449
|
-
}
|
|
123450
|
-
var dirPath_1 = ts.getDirectoryPath(path);
|
|
123451
|
-
var perDirResolutionCache_1 = perDirCache === null || perDirCache === void 0 ? void 0 : perDirCache.getMapOfCacheRedirects(redirectedReference);
|
|
123452
|
-
var cacheForDir_1 = perDirResolutionCache_1 === null || perDirResolutionCache_1 === void 0 ? void 0 : perDirResolutionCache_1.get(dirPath_1);
|
|
123453
|
-
fileCacheFromProgram.forEach(function (r, name, mode) {
|
|
123454
|
-
seenNamesInFile.set(name, mode, true);
|
|
123455
|
-
var existing = resolutionsInFile === null || resolutionsInFile === void 0 ? void 0 : resolutionsInFile.cache.get(name, mode);
|
|
123456
|
-
if (existing && r !== existing)
|
|
123457
|
-
stopWatchingResolution(existing, path, getResolutionWithResolvedFileName);
|
|
123458
|
-
watchResolution(newProgram, name, r, path, getResolutionWithResolvedFileName);
|
|
123459
|
-
if (!resolutionsInFile)
|
|
123460
|
-
perFileCache.set(path, resolutionsInFile = { key: key_2, cache: ts.createModeAwareCache() });
|
|
123461
|
-
resolutionsInFile.cache.set(name, mode, r);
|
|
123462
|
-
if (cacheForDir_1 === null || cacheForDir_1 === void 0 ? void 0 : cacheForDir_1.has(name, mode))
|
|
123463
|
-
return;
|
|
123464
|
-
if (!cacheForDir_1) {
|
|
123465
|
-
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));
|
|
123466
|
-
perDirResolutionCache_1.set(dirPath_1, cacheForDir_1 = ts.createModeAwareCache());
|
|
123467
|
-
}
|
|
123468
|
-
cacheForDir_1.set(name, mode, r);
|
|
123469
|
-
if (!moduleNameToDirectoryMap || ts.isExternalModuleNameRelative(name))
|
|
123470
|
-
return;
|
|
123471
|
-
var actualModuleNameToDirectoryMap = moduleNameToDirectoryMap.createMapForCompilerOptions(options_3, key_2);
|
|
123472
|
-
var modeAwareCacheKey = ts.getModeAwareCacheKey(name, mode);
|
|
123473
|
-
var directoryPathMap = actualModuleNameToDirectoryMap.get(modeAwareCacheKey);
|
|
123474
|
-
if (!directoryPathMap)
|
|
123475
|
-
actualModuleNameToDirectoryMap.set(modeAwareCacheKey, directoryPathMap = new ts.Map());
|
|
123476
|
-
ts.moduleNameToDirectorySet(directoryPathMap, dirPath_1, r, ts.getResolvedFileNameForModuleNameToDirectorySet, function (dir) { return resolutionHost.toPath(dir); }, ts.noop);
|
|
123477
|
-
});
|
|
123478
|
-
}
|
|
123479
|
-
if (((resolutionsInFile === null || resolutionsInFile === void 0 ? void 0 : resolutionsInFile.cache.size()) || 0) !== seenNamesInFile.size()) {
|
|
123480
|
-
// Stop watching and remove the unused name
|
|
123481
|
-
resolutionsInFile.cache.forEach(function (resolution, name, mode) {
|
|
123482
|
-
if (!seenNamesInFile.has(name, mode)) {
|
|
123483
|
-
stopWatchingResolution(resolution, path, getResolutionWithResolvedFileName);
|
|
123484
|
-
resolutionsInFile.cache.delete(name, mode);
|
|
123485
|
-
}
|
|
123486
|
-
});
|
|
123487
|
-
if (!(resolutionsInFile === null || resolutionsInFile === void 0 ? void 0 : resolutionsInFile.cache.size))
|
|
123488
|
-
perFileCache.delete(path);
|
|
123489
|
-
}
|
|
123490
|
-
return perDirCache;
|
|
123491
|
-
}
|
|
123492
|
-
function getOldResolutionCache(modules, typeRefs, moduleNameToDirectoryMap) {
|
|
123493
|
-
if (!modules && !typeRefs)
|
|
123494
|
-
return undefined;
|
|
123495
|
-
return {
|
|
123496
|
-
modules: {
|
|
123497
|
-
getResolved: function (dirPath, name, mode, redirectedReference) { return getResolvedWithOldCache(dirPath, name, mode, redirectedReference, modules, moduleNameToDirectoryMap); }
|
|
123498
|
-
},
|
|
123499
|
-
typeRefs: {
|
|
123500
|
-
getResolved: function (dirPath, name, mode, redirectedReference) { return getResolvedWithOldCache(dirPath, name, mode, redirectedReference, typeRefs, /*moduleNameToDirectoryMap*/ undefined); }
|
|
123501
|
-
},
|
|
123502
|
-
clearRedirectsMap: function () {
|
|
123503
|
-
modules === null || modules === void 0 ? void 0 : modules.clearRedirectsMap();
|
|
123504
|
-
typeRefs === null || typeRefs === void 0 ? void 0 : typeRefs.clearRedirectsMap();
|
|
123505
|
-
moduleNameToDirectoryMap.clearRedirectsMap();
|
|
123506
|
-
},
|
|
123507
|
-
};
|
|
123508
|
-
}
|
|
123509
|
-
function getResolvedWithOldCache(dirPath, name, mode, redirectedReference, perDirCache, moduleNameToDirectoryMap) {
|
|
123510
|
-
var _a, _b, _c, _d;
|
|
123511
|
-
if (!perDirCache)
|
|
123512
|
-
return undefined;
|
|
123513
|
-
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)) ||
|
|
123514
|
-
((_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));
|
|
123515
|
-
return result && !result.isInvalidated ? result : undefined;
|
|
123516
122633
|
}
|
|
123517
122634
|
function resolveModuleName(moduleName, containingFile, compilerOptions, host, redirectedReference, _containingSourceFile, mode) {
|
|
123518
|
-
var _a;
|
|
122635
|
+
var _a, _b;
|
|
123519
122636
|
var primaryResult = ts.resolveModuleName(moduleName, containingFile, compilerOptions, host, moduleResolutionCache, redirectedReference, mode);
|
|
123520
122637
|
// return result immediately only if global cache support is not enabled or if it is .ts, .tsx or .d.ts
|
|
123521
122638
|
if (!resolutionHost.getGlobalCache) {
|
|
@@ -123526,16 +122643,12 @@ var ts;
|
|
|
123526
122643
|
if (globalCache !== undefined && !ts.isExternalModuleNameRelative(moduleName) && !(primaryResult.resolvedModule && ts.extensionIsTS(primaryResult.resolvedModule.extension))) {
|
|
123527
122644
|
// create different collection of failed lookup locations for second pass
|
|
123528
122645
|
// if it will fail and we've already found something during the first pass - we don't want to pollute its results
|
|
123529
|
-
var
|
|
122646
|
+
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;
|
|
123530
122647
|
if (resolvedModule) {
|
|
123531
122648
|
// Modify existing resolution so its saved in the directory cache as well
|
|
123532
122649
|
primaryResult.resolvedModule = resolvedModule;
|
|
123533
|
-
|
|
123534
|
-
|
|
123535
|
-
else
|
|
123536
|
-
primaryResult.failedLookupLocations.length = 0;
|
|
123537
|
-
primaryResult.affectingLocations = ts.updateResolutionField(primaryResult.affectingLocations, affectingLocations);
|
|
123538
|
-
primaryResult.resolutionDiagnostics = ts.updateResolutionField(primaryResult.resolutionDiagnostics, resolutionDiagnostics);
|
|
122650
|
+
(_a = primaryResult.failedLookupLocations).push.apply(_a, failedLookupLocations);
|
|
122651
|
+
(_b = primaryResult.affectingLocations).push.apply(_b, affectingLocations);
|
|
123539
122652
|
return primaryResult;
|
|
123540
122653
|
}
|
|
123541
122654
|
}
|
|
@@ -123546,41 +122659,76 @@ var ts;
|
|
|
123546
122659
|
return ts.resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host, redirectedReference, typeReferenceDirectiveResolutionCache, resolutionMode);
|
|
123547
122660
|
}
|
|
123548
122661
|
function resolveNamesWithLocalCache(_a) {
|
|
123549
|
-
var _b, _c, _d
|
|
123550
|
-
var names = _a.names, containingFile = _a.containingFile, redirectedReference = _a.redirectedReference,
|
|
122662
|
+
var _b, _c, _d;
|
|
122663
|
+
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;
|
|
123551
122664
|
var path = resolutionHost.toPath(containingFile);
|
|
123552
|
-
var resolutionsInFile =
|
|
123553
|
-
var
|
|
123554
|
-
var
|
|
123555
|
-
|
|
123556
|
-
|
|
123557
|
-
|
|
122665
|
+
var resolutionsInFile = cache.get(path) || cache.set(path, ts.createModeAwareCache()).get(path);
|
|
122666
|
+
var dirPath = ts.getDirectoryPath(path);
|
|
122667
|
+
var perDirectoryCache = perDirectoryCacheWithRedirects.getOrCreateMapOfCacheRedirects(redirectedReference);
|
|
122668
|
+
var perDirectoryResolution = perDirectoryCache.get(dirPath);
|
|
122669
|
+
if (!perDirectoryResolution) {
|
|
122670
|
+
perDirectoryResolution = ts.createModeAwareCache();
|
|
122671
|
+
perDirectoryCache.set(dirPath, perDirectoryResolution);
|
|
123558
122672
|
}
|
|
123559
122673
|
var resolvedModules = [];
|
|
122674
|
+
var compilerOptions = resolutionHost.getCompilationSettings();
|
|
122675
|
+
var hasInvalidatedNonRelativeUnresolvedImport = logChanges && isFileWithInvalidatedNonRelativeUnresolvedImports(path);
|
|
122676
|
+
// All the resolutions in this file are invalidated if this file wasn't resolved using same redirect
|
|
122677
|
+
var program = resolutionHost.getCurrentProgram();
|
|
122678
|
+
var oldRedirect = program && program.getResolvedProjectReferenceToRedirect(containingFile);
|
|
122679
|
+
var unmatchedRedirects = oldRedirect ?
|
|
122680
|
+
!redirectedReference || redirectedReference.sourceFile.path !== oldRedirect.sourceFile.path :
|
|
122681
|
+
!!redirectedReference;
|
|
123560
122682
|
var seenNamesInFile = ts.createModeAwareCache();
|
|
123561
122683
|
var i = 0;
|
|
123562
|
-
for (var _i = 0,
|
|
123563
|
-
var entry =
|
|
123564
|
-
var name = ts.isString(entry) ? entry :
|
|
122684
|
+
for (var _i = 0, names_5 = names; _i < names_5.length; _i++) {
|
|
122685
|
+
var entry = names_5[_i];
|
|
122686
|
+
var name = ts.isString(entry) ? entry : entry.fileName.toLowerCase();
|
|
123565
122687
|
// Imports supply a `containingSourceFile` but no `containingSourceFileMode` - it would be redundant
|
|
123566
122688
|
// they require calculating the mode for a given import from it's position in the resolution table, since a given
|
|
123567
122689
|
// import's syntax may override the file's default mode.
|
|
123568
122690
|
// Type references instead supply a `containingSourceFileMode` and a non-string entry which contains
|
|
123569
122691
|
// a default file mode override if applicable.
|
|
123570
122692
|
var mode = !ts.isString(entry) ? ts.getModeForFileReference(entry, containingSourceFileMode) :
|
|
123571
|
-
containingSourceFile ? ts.getModeForResolutionAtIndex(containingSourceFile,
|
|
122693
|
+
containingSourceFile ? ts.getModeForResolutionAtIndex(containingSourceFile, i) : undefined;
|
|
123572
122694
|
i++;
|
|
123573
|
-
var resolution = resolutionsInFile.
|
|
122695
|
+
var resolution = resolutionsInFile.get(name, mode);
|
|
123574
122696
|
// Resolution is valid if it is present and not invalidated
|
|
123575
|
-
if (!seenNamesInFile.has(name, mode) &&
|
|
122697
|
+
if (!seenNamesInFile.has(name, mode) &&
|
|
122698
|
+
unmatchedRedirects || !resolution || resolution.isInvalidated ||
|
|
122699
|
+
// If the name is unresolved import that was invalidated, recalculate
|
|
122700
|
+
(hasInvalidatedNonRelativeUnresolvedImport && !ts.isExternalModuleNameRelative(name) && shouldRetryResolution(resolution))) {
|
|
123576
122701
|
var existingResolution = resolution;
|
|
123577
|
-
|
|
123578
|
-
if (
|
|
123579
|
-
|
|
122702
|
+
var resolutionInDirectory = perDirectoryResolution.get(name, mode);
|
|
122703
|
+
if (resolutionInDirectory) {
|
|
122704
|
+
resolution = resolutionInDirectory;
|
|
122705
|
+
var host = ((_b = resolutionHost.getCompilerHost) === null || _b === void 0 ? void 0 : _b.call(resolutionHost)) || resolutionHost;
|
|
122706
|
+
if (ts.isTraceEnabled(compilerOptions, host)) {
|
|
122707
|
+
var resolved = getResolutionWithResolvedFileName(resolution);
|
|
122708
|
+
ts.trace(host, loader === resolveModuleName ?
|
|
122709
|
+
(resolved === null || resolved === void 0 ? void 0 : resolved.resolvedFileName) ?
|
|
122710
|
+
resolved.packagetId ?
|
|
122711
|
+
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 :
|
|
122712
|
+
ts.Diagnostics.Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3 :
|
|
122713
|
+
ts.Diagnostics.Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_not_resolved :
|
|
122714
|
+
(resolved === null || resolved === void 0 ? void 0 : resolved.resolvedFileName) ?
|
|
122715
|
+
resolved.packagetId ?
|
|
122716
|
+
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 :
|
|
122717
|
+
ts.Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3 :
|
|
122718
|
+
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));
|
|
122719
|
+
}
|
|
122720
|
+
}
|
|
122721
|
+
else {
|
|
122722
|
+
resolution = loader(name, containingFile, compilerOptions, ((_c = resolutionHost.getCompilerHost) === null || _c === void 0 ? void 0 : _c.call(resolutionHost)) || resolutionHost, redirectedReference, containingSourceFile, mode);
|
|
122723
|
+
perDirectoryResolution.set(name, mode, resolution);
|
|
122724
|
+
if (resolutionHost.onDiscoveredSymlink && resolutionIsSymlink(resolution)) {
|
|
122725
|
+
resolutionHost.onDiscoveredSymlink();
|
|
122726
|
+
}
|
|
123580
122727
|
}
|
|
123581
|
-
resolutionsInFile.
|
|
122728
|
+
resolutionsInFile.set(name, mode, resolution);
|
|
122729
|
+
watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, path, getResolutionWithResolvedFileName);
|
|
123582
122730
|
if (existingResolution) {
|
|
123583
|
-
|
|
122731
|
+
stopWatchFailedLookupLocationOfResolution(existingResolution, path, getResolutionWithResolvedFileName);
|
|
123584
122732
|
}
|
|
123585
122733
|
if (logChanges && filesWithChangedSetOfUnresolvedImports && !resolutionIsEqualTo(existingResolution, resolution)) {
|
|
123586
122734
|
filesWithChangedSetOfUnresolvedImports.push(path);
|
|
@@ -123594,34 +122742,28 @@ var ts;
|
|
|
123594
122742
|
var resolved = getResolutionWithResolvedFileName(resolution);
|
|
123595
122743
|
ts.trace(host, loader === resolveModuleName ?
|
|
123596
122744
|
(resolved === null || resolved === void 0 ? void 0 : resolved.resolvedFileName) ?
|
|
123597
|
-
resolved.
|
|
122745
|
+
resolved.packagetId ?
|
|
123598
122746
|
ts.Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 :
|
|
123599
122747
|
ts.Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2 :
|
|
123600
122748
|
ts.Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_not_resolved :
|
|
123601
122749
|
(resolved === null || resolved === void 0 ? void 0 : resolved.resolvedFileName) ?
|
|
123602
|
-
resolved.
|
|
122750
|
+
resolved.packagetId ?
|
|
123603
122751
|
ts.Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 :
|
|
123604
122752
|
ts.Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved_to_2 :
|
|
123605
|
-
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.
|
|
122753
|
+
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));
|
|
123606
122754
|
}
|
|
123607
122755
|
}
|
|
123608
122756
|
ts.Debug.assert(resolution !== undefined && !resolution.isInvalidated);
|
|
123609
122757
|
seenNamesInFile.set(name, mode, true);
|
|
123610
|
-
resolvedModules.push(resolution);
|
|
122758
|
+
resolvedModules.push(getResolutionWithResolvedFileName(resolution));
|
|
123611
122759
|
}
|
|
123612
|
-
|
|
123613
|
-
|
|
123614
|
-
|
|
122760
|
+
// Stop watching and remove the unused name
|
|
122761
|
+
resolutionsInFile.forEach(function (resolution, name, mode) {
|
|
122762
|
+
if (!seenNamesInFile.has(name, mode) && !ts.contains(reusedNames, name)) {
|
|
122763
|
+
stopWatchFailedLookupLocationOfResolution(resolution, path, getResolutionWithResolvedFileName);
|
|
122764
|
+
resolutionsInFile.delete(name, mode);
|
|
122765
|
+
}
|
|
123615
122766
|
});
|
|
123616
|
-
if (resolutionsInFile.cache.size() !== seenNamesInFile.size()) {
|
|
123617
|
-
// Stop watching and remove the unused name
|
|
123618
|
-
resolutionsInFile.cache.forEach(function (resolution, name, mode) {
|
|
123619
|
-
if (!seenNamesInFile.has(name, mode)) {
|
|
123620
|
-
stopWatchingResolution(resolution, path, getResolutionWithResolvedFileName);
|
|
123621
|
-
resolutionsInFile.cache.delete(name, mode);
|
|
123622
|
-
}
|
|
123623
|
-
});
|
|
123624
|
-
}
|
|
123625
122767
|
return resolvedModules;
|
|
123626
122768
|
function resolutionIsEqualTo(oldResolution, newResolution) {
|
|
123627
122769
|
if (oldResolution === newResolution) {
|
|
@@ -123641,31 +122783,40 @@ var ts;
|
|
|
123641
122783
|
return oldResult.resolvedFileName === newResult.resolvedFileName;
|
|
123642
122784
|
}
|
|
123643
122785
|
}
|
|
123644
|
-
function resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference, containingFileMode
|
|
122786
|
+
function resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference, containingFileMode) {
|
|
123645
122787
|
return resolveNamesWithLocalCache({
|
|
123646
122788
|
names: typeDirectiveNames,
|
|
123647
122789
|
containingFile: containingFile,
|
|
123648
122790
|
redirectedReference: redirectedReference,
|
|
123649
|
-
|
|
122791
|
+
cache: resolvedTypeReferenceDirectives,
|
|
122792
|
+
perDirectoryCacheWithRedirects: perDirectoryResolvedTypeReferenceDirectives,
|
|
123650
122793
|
loader: resolveTypeReferenceDirective,
|
|
123651
122794
|
getResolutionWithResolvedFileName: getResolvedTypeReferenceDirective,
|
|
123652
|
-
|
|
123653
|
-
|
|
122795
|
+
shouldRetryResolution: function (resolution) { return resolution.resolvedTypeReferenceDirective === undefined; },
|
|
122796
|
+
containingSourceFileMode: containingFileMode
|
|
123654
122797
|
});
|
|
123655
122798
|
}
|
|
123656
|
-
function resolveModuleNames(moduleNames, containingFile, redirectedReference, containingSourceFile
|
|
122799
|
+
function resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference, containingSourceFile) {
|
|
123657
122800
|
return resolveNamesWithLocalCache({
|
|
123658
122801
|
names: moduleNames,
|
|
123659
122802
|
containingFile: containingFile,
|
|
123660
122803
|
redirectedReference: redirectedReference,
|
|
123661
|
-
|
|
122804
|
+
cache: resolvedModuleNames,
|
|
122805
|
+
perDirectoryCacheWithRedirects: perDirectoryResolvedModuleNames,
|
|
123662
122806
|
loader: resolveModuleName,
|
|
123663
122807
|
getResolutionWithResolvedFileName: getResolvedModule,
|
|
123664
|
-
|
|
122808
|
+
shouldRetryResolution: function (resolution) { return !resolution.resolvedModule || !ts.resolutionExtensionIsTSOrJson(resolution.resolvedModule.extension); },
|
|
122809
|
+
reusedNames: reusedNames,
|
|
123665
122810
|
logChanges: logChangesWhenResolvingModule,
|
|
123666
122811
|
containingSourceFile: containingSourceFile,
|
|
123667
122812
|
});
|
|
123668
122813
|
}
|
|
122814
|
+
function getResolvedModuleWithFailedLookupLocationsFromCache(moduleName, containingFile, resolutionMode) {
|
|
122815
|
+
var cache = resolvedModuleNames.get(resolutionHost.toPath(containingFile));
|
|
122816
|
+
if (!cache)
|
|
122817
|
+
return undefined;
|
|
122818
|
+
return cache.get(moduleName, resolutionMode);
|
|
122819
|
+
}
|
|
123669
122820
|
function isNodeModulesAtTypesDirectory(dirPath) {
|
|
123670
122821
|
return ts.endsWith(dirPath, "/node_modules/@types");
|
|
123671
122822
|
}
|
|
@@ -123725,42 +122876,37 @@ var ts;
|
|
|
123725
122876
|
function isPathWithDefaultFailedLookupExtension(path) {
|
|
123726
122877
|
return ts.fileExtensionIsOneOf(path, failedLookupDefaultExtensions);
|
|
123727
122878
|
}
|
|
123728
|
-
function
|
|
123729
|
-
if (resolution.
|
|
123730
|
-
resolution.
|
|
123731
|
-
|
|
123732
|
-
watchFailedLookupLocationOfResolution(resolution);
|
|
123733
|
-
watchAffectingLocationsOfResolution(resolution);
|
|
123734
|
-
return;
|
|
123735
|
-
}
|
|
123736
|
-
resolution.files = new ts.Set();
|
|
123737
|
-
resolution.files.add(filePath);
|
|
123738
|
-
var resolved = getResolutionWithResolvedFileName(resolution);
|
|
123739
|
-
if (resolved && resolved.resolvedFileName) {
|
|
123740
|
-
resolvedFileToResolution.add(resolutionHost.toPath(resolved.resolvedFileName), resolution);
|
|
123741
|
-
}
|
|
123742
|
-
if (ts.isExternalModuleNameRelative(name) || !newProgram.getTypeChecker().tryFindAmbientModuleWithoutAugmentations(name)) {
|
|
123743
|
-
watchFailedLookupLocationOfResolution(resolution);
|
|
123744
|
-
watchAffectingLocationsOfResolution(resolution);
|
|
122879
|
+
function watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, filePath, getResolutionWithResolvedFileName) {
|
|
122880
|
+
if (resolution.refCount) {
|
|
122881
|
+
resolution.refCount++;
|
|
122882
|
+
ts.Debug.assertIsDefined(resolution.files);
|
|
123745
122883
|
}
|
|
123746
122884
|
else {
|
|
123747
|
-
resolution.
|
|
123748
|
-
|
|
122885
|
+
resolution.refCount = 1;
|
|
122886
|
+
ts.Debug.assert(ts.length(resolution.files) === 0); // This resolution shouldnt be referenced by any file yet
|
|
122887
|
+
if (ts.isExternalModuleNameRelative(name)) {
|
|
122888
|
+
watchFailedLookupLocationOfResolution(resolution);
|
|
122889
|
+
}
|
|
122890
|
+
else {
|
|
122891
|
+
nonRelativeExternalModuleResolutions.add(name, resolution);
|
|
122892
|
+
}
|
|
122893
|
+
var resolved = getResolutionWithResolvedFileName(resolution);
|
|
122894
|
+
if (resolved && resolved.resolvedFileName) {
|
|
122895
|
+
resolvedFileToResolution.add(resolutionHost.toPath(resolved.resolvedFileName), resolution);
|
|
122896
|
+
}
|
|
123749
122897
|
}
|
|
122898
|
+
(resolution.files || (resolution.files = [])).push(filePath);
|
|
123750
122899
|
}
|
|
123751
122900
|
function watchFailedLookupLocationOfResolution(resolution) {
|
|
123752
|
-
|
|
123753
|
-
|
|
122901
|
+
ts.Debug.assert(!!resolution.refCount);
|
|
122902
|
+
var failedLookupLocations = resolution.failedLookupLocations, affectingLocations = resolution.affectingLocations;
|
|
122903
|
+
if (!failedLookupLocations.length && !affectingLocations.length)
|
|
123754
122904
|
return;
|
|
123755
|
-
if (
|
|
122905
|
+
if (failedLookupLocations.length)
|
|
123756
122906
|
resolutionsWithFailedLookups.push(resolution);
|
|
123757
|
-
|
|
123758
|
-
|
|
123759
|
-
|
|
123760
|
-
}
|
|
123761
|
-
var setAtRoot = !!resolution.setAtRoot;
|
|
123762
|
-
for (var i = resolution.watchedFailed || 0; i < failedLookupLocations.length; i++) {
|
|
123763
|
-
var failedLookupLocation = failedLookupLocations[i];
|
|
122907
|
+
var setAtRoot = false;
|
|
122908
|
+
for (var _i = 0, failedLookupLocations_1 = failedLookupLocations; _i < failedLookupLocations_1.length; _i++) {
|
|
122909
|
+
var failedLookupLocation = failedLookupLocations_1[_i];
|
|
123764
122910
|
var failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
|
|
123765
122911
|
var toWatch = getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath);
|
|
123766
122912
|
if (toWatch) {
|
|
@@ -123780,24 +122926,24 @@ var ts;
|
|
|
123780
122926
|
}
|
|
123781
122927
|
}
|
|
123782
122928
|
}
|
|
123783
|
-
if (setAtRoot
|
|
122929
|
+
if (setAtRoot) {
|
|
123784
122930
|
// This is always non recursive
|
|
123785
|
-
setDirectoryWatcher(rootDir, rootPath, /*nonRecursive*/ true);
|
|
122931
|
+
setDirectoryWatcher(rootDir, rootPath, /*nonRecursive*/ true); // TODO: GH#18217
|
|
123786
122932
|
}
|
|
123787
|
-
resolution.
|
|
123788
|
-
resolution.watchedFailed = failedLookupLocations.length;
|
|
122933
|
+
watchAffectingLocationsOfResolution(resolution, !failedLookupLocations.length);
|
|
123789
122934
|
}
|
|
123790
|
-
function watchAffectingLocationsOfResolution(resolution) {
|
|
122935
|
+
function watchAffectingLocationsOfResolution(resolution, addToResolutionsWithOnlyAffectingLocations) {
|
|
122936
|
+
ts.Debug.assert(!!resolution.refCount);
|
|
123791
122937
|
var affectingLocations = resolution.affectingLocations;
|
|
123792
|
-
if (!
|
|
122938
|
+
if (!affectingLocations.length)
|
|
123793
122939
|
return;
|
|
123794
|
-
if (
|
|
122940
|
+
if (addToResolutionsWithOnlyAffectingLocations)
|
|
123795
122941
|
resolutionsWithOnlyAffectingLocations.push(resolution);
|
|
123796
122942
|
// Watch package json
|
|
123797
|
-
for (var
|
|
123798
|
-
|
|
122943
|
+
for (var _i = 0, affectingLocations_1 = affectingLocations; _i < affectingLocations_1.length; _i++) {
|
|
122944
|
+
var affectingLocation = affectingLocations_1[_i];
|
|
122945
|
+
createFileWatcherOfAffectingLocation(affectingLocation);
|
|
123799
122946
|
}
|
|
123800
|
-
resolution.watchedAffected = affectingLocations.length;
|
|
123801
122947
|
}
|
|
123802
122948
|
function createFileWatcherOfAffectingLocation(affectingLocation) {
|
|
123803
122949
|
var path = resolutionHost.toPath(affectingLocation);
|
|
@@ -123838,6 +122984,15 @@ var ts;
|
|
|
123838
122984
|
paths.add(path);
|
|
123839
122985
|
}
|
|
123840
122986
|
}
|
|
122987
|
+
function watchFailedLookupLocationOfNonRelativeModuleResolutions(resolutions, name) {
|
|
122988
|
+
var program = resolutionHost.getCurrentProgram();
|
|
122989
|
+
if (!program || !program.getTypeChecker().tryFindAmbientModuleWithoutAugmentations(name)) {
|
|
122990
|
+
resolutions.forEach(watchFailedLookupLocationOfResolution);
|
|
122991
|
+
}
|
|
122992
|
+
else {
|
|
122993
|
+
resolutions.forEach(function (resolution) { return watchAffectingLocationsOfResolution(resolution, /*addToResolutionWithOnlyAffectingLocations*/ true); });
|
|
122994
|
+
}
|
|
122995
|
+
}
|
|
123841
122996
|
function setDirectoryWatcher(dir, dirPath, nonRecursive) {
|
|
123842
122997
|
var dirWatcher = directoryWatchesOfFailedLookups.get(dirPath);
|
|
123843
122998
|
if (dirWatcher) {
|
|
@@ -123848,28 +123003,21 @@ var ts;
|
|
|
123848
123003
|
directoryWatchesOfFailedLookups.set(dirPath, { watcher: createDirectoryWatcher(dir, dirPath, nonRecursive), refCount: 1, nonRecursive: nonRecursive });
|
|
123849
123004
|
}
|
|
123850
123005
|
}
|
|
123851
|
-
function
|
|
123852
|
-
|
|
123853
|
-
|
|
123854
|
-
if (
|
|
123855
|
-
(resolutionsToCloseWatcherOn !== null && resolutionsToCloseWatcherOn !== void 0 ? resolutionsToCloseWatcherOn : (resolutionsToCloseWatcherOn = [])).push({ resolution: resolution, getResolved: getResolutionWithResolvedFileName });
|
|
123856
|
-
}
|
|
123857
|
-
function closeWatchersOfResolution(_a) {
|
|
123858
|
-
var _b;
|
|
123859
|
-
var resolution = _a.resolution, getResolved = _a.getResolved;
|
|
123860
|
-
// If some files are using this resolution or we have already closed all watchers ignore
|
|
123861
|
-
if (((_b = resolution.files) === null || _b === void 0 ? void 0 : _b.size) || !resolution.files)
|
|
123006
|
+
function stopWatchFailedLookupLocationOfResolution(resolution, filePath, getResolutionWithResolvedFileName) {
|
|
123007
|
+
ts.unorderedRemoveItem(ts.Debug.checkDefined(resolution.files), filePath);
|
|
123008
|
+
resolution.refCount--;
|
|
123009
|
+
if (resolution.refCount) {
|
|
123862
123010
|
return;
|
|
123863
|
-
|
|
123864
|
-
var resolved =
|
|
123011
|
+
}
|
|
123012
|
+
var resolved = getResolutionWithResolvedFileName(resolution);
|
|
123865
123013
|
if (resolved && resolved.resolvedFileName) {
|
|
123866
123014
|
resolvedFileToResolution.remove(resolutionHost.toPath(resolved.resolvedFileName), resolution);
|
|
123867
123015
|
}
|
|
123868
|
-
|
|
123869
|
-
|
|
123016
|
+
var failedLookupLocations = resolution.failedLookupLocations, affectingLocations = resolution.affectingLocations;
|
|
123017
|
+
if (ts.unorderedRemoveItem(resolutionsWithFailedLookups, resolution)) {
|
|
123870
123018
|
var removeAtRoot = false;
|
|
123871
|
-
for (var
|
|
123872
|
-
var failedLookupLocation =
|
|
123019
|
+
for (var _i = 0, failedLookupLocations_2 = failedLookupLocations; _i < failedLookupLocations_2.length; _i++) {
|
|
123020
|
+
var failedLookupLocation = failedLookupLocations_2[_i];
|
|
123873
123021
|
var failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
|
|
123874
123022
|
var toWatch = getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath);
|
|
123875
123023
|
if (toWatch) {
|
|
@@ -123892,31 +123040,23 @@ var ts;
|
|
|
123892
123040
|
}
|
|
123893
123041
|
}
|
|
123894
123042
|
}
|
|
123895
|
-
ts.Debug.assert(resolution.setAtRoot === removeAtRoot);
|
|
123896
123043
|
if (removeAtRoot) {
|
|
123897
123044
|
removeDirectoryWatcher(rootPath);
|
|
123898
123045
|
}
|
|
123899
123046
|
}
|
|
123900
|
-
else if (
|
|
123047
|
+
else if (affectingLocations.length) {
|
|
123901
123048
|
ts.unorderedRemoveItem(resolutionsWithOnlyAffectingLocations, resolution);
|
|
123902
123049
|
}
|
|
123903
|
-
|
|
123904
|
-
|
|
123905
|
-
|
|
123906
|
-
|
|
123907
|
-
var watcher = fileWatchesOfAffectingLocations.get(path);
|
|
123908
|
-
watcher.refCount--;
|
|
123909
|
-
closeAffectingFileWatcher(watcher, path);
|
|
123910
|
-
}
|
|
123050
|
+
for (var _a = 0, affectingLocations_2 = affectingLocations; _a < affectingLocations_2.length; _a++) {
|
|
123051
|
+
var affectingLocation = affectingLocations_2[_a];
|
|
123052
|
+
var watcher = fileWatchesOfAffectingLocations.get(resolutionHost.toPath(affectingLocation));
|
|
123053
|
+
watcher.refCount--;
|
|
123911
123054
|
}
|
|
123912
123055
|
}
|
|
123913
123056
|
function removeDirectoryWatcher(dirPath) {
|
|
123914
123057
|
var dirWatcher = directoryWatchesOfFailedLookups.get(dirPath);
|
|
123058
|
+
// Do not close the watcher yet since it might be needed by other failed lookup locations.
|
|
123915
123059
|
dirWatcher.refCount--;
|
|
123916
|
-
if (dirWatcher.refCount === 0) {
|
|
123917
|
-
directoryWatchesOfFailedLookups.delete(dirPath);
|
|
123918
|
-
dirWatcher.watcher.close();
|
|
123919
|
-
}
|
|
123920
123060
|
}
|
|
123921
123061
|
function createDirectoryWatcher(directory, dirPath, nonRecursive) {
|
|
123922
123062
|
return resolutionHost.watchDirectoryOfFailedLookupLocation(directory, function (fileOrDirectory) {
|
|
@@ -123932,16 +123072,28 @@ var ts;
|
|
|
123932
123072
|
// Deleted file, stop watching failed lookups for all the resolutions in the file
|
|
123933
123073
|
var resolutions = cache.get(filePath);
|
|
123934
123074
|
if (resolutions) {
|
|
123935
|
-
resolutions.
|
|
123075
|
+
resolutions.forEach(function (resolution) { return stopWatchFailedLookupLocationOfResolution(resolution, filePath, getResolutionWithResolvedFileName); });
|
|
123936
123076
|
cache.delete(filePath);
|
|
123937
123077
|
}
|
|
123938
123078
|
}
|
|
123079
|
+
function removeResolutionsFromProjectReferenceRedirects(filePath) {
|
|
123080
|
+
if (!ts.fileExtensionIs(filePath, ".json" /* Json */))
|
|
123081
|
+
return;
|
|
123082
|
+
var program = resolutionHost.getCurrentProgram();
|
|
123083
|
+
if (!program)
|
|
123084
|
+
return;
|
|
123085
|
+
// If this file is input file for the referenced project, get it
|
|
123086
|
+
var resolvedProjectReference = program.getResolvedProjectReferenceByPath(filePath);
|
|
123087
|
+
if (!resolvedProjectReference)
|
|
123088
|
+
return;
|
|
123089
|
+
// filePath is for the projectReference and the containing file is from this project reference, invalidate the resolution
|
|
123090
|
+
resolvedProjectReference.commandLine.fileNames.forEach(function (f) { return removeResolutionsOfFile(resolutionHost.toPath(f)); });
|
|
123091
|
+
}
|
|
123939
123092
|
function removeResolutionsOfFile(filePath) {
|
|
123940
123093
|
removeResolutionsOfFileFromCache(resolvedModuleNames, filePath, getResolvedModule);
|
|
123941
123094
|
removeResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath, getResolvedTypeReferenceDirective);
|
|
123942
123095
|
}
|
|
123943
123096
|
function invalidateResolutions(resolutions, canInvalidate) {
|
|
123944
|
-
var _a;
|
|
123945
123097
|
if (!resolutions)
|
|
123946
123098
|
return false;
|
|
123947
123099
|
var invalidated = false;
|
|
@@ -123950,15 +123102,17 @@ var ts;
|
|
|
123950
123102
|
if (resolution.isInvalidated || !canInvalidate(resolution))
|
|
123951
123103
|
continue;
|
|
123952
123104
|
resolution.isInvalidated = invalidated = true;
|
|
123953
|
-
(_a = resolution.files)
|
|
123105
|
+
for (var _a = 0, _b = ts.Debug.checkDefined(resolution.files); _a < _b.length; _a++) {
|
|
123106
|
+
var containingFilePath = _b[_a];
|
|
123954
123107
|
(filesWithInvalidatedResolutions || (filesWithInvalidatedResolutions = new ts.Set())).add(containingFilePath);
|
|
123955
123108
|
// When its a file with inferred types resolution, invalidate type reference directive resolution
|
|
123956
123109
|
hasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames || ts.endsWith(containingFilePath, ts.inferredTypesContainingFile);
|
|
123957
|
-
}
|
|
123110
|
+
}
|
|
123958
123111
|
}
|
|
123959
123112
|
return invalidated;
|
|
123960
123113
|
}
|
|
123961
123114
|
function invalidateResolutionOfFile(filePath) {
|
|
123115
|
+
removeResolutionsOfFile(filePath);
|
|
123962
123116
|
// Resolution is invalidated if the resulting file name is same as the deleted file path
|
|
123963
123117
|
var prevHasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames;
|
|
123964
123118
|
if (invalidateResolutions(resolvedFileToResolution.get(filePath), ts.returnTrue) &&
|
|
@@ -123968,28 +123122,8 @@ var ts;
|
|
|
123968
123122
|
}
|
|
123969
123123
|
}
|
|
123970
123124
|
function setFilesWithInvalidatedNonRelativeUnresolvedImports(filesMap) {
|
|
123971
|
-
|
|
123972
|
-
|
|
123973
|
-
if (!imports.length)
|
|
123974
|
-
return;
|
|
123975
|
-
var resolvedModules = resolvedModuleNames.get(filePath);
|
|
123976
|
-
var resolvedTypeRefs = resolvedTypeReferenceDirectives.get(filePath);
|
|
123977
|
-
if (!(resolvedModules === null || resolvedModules === void 0 ? void 0 : resolvedModules.cache.size()) && !(resolvedTypeRefs === null || resolvedTypeRefs === void 0 ? void 0 : resolvedTypeRefs.cache.size()))
|
|
123978
|
-
return;
|
|
123979
|
-
imports.forEach(function (_a) {
|
|
123980
|
-
var name = _a.name, mode = _a.mode;
|
|
123981
|
-
var resolvedModule = resolvedModules === null || resolvedModules === void 0 ? void 0 : resolvedModules.cache.get(name, mode);
|
|
123982
|
-
if (resolvedModule && !resolvedModule.isInvalidated && (!resolvedModule.resolvedModule || !ts.resolutionExtensionIsTSOrJson(resolvedModule.resolvedModule.extension))) {
|
|
123983
|
-
resolvedModule.isInvalidated = true;
|
|
123984
|
-
(filesWithInvalidatedResolutions !== null && filesWithInvalidatedResolutions !== void 0 ? filesWithInvalidatedResolutions : (filesWithInvalidatedResolutions = new ts.Set())).add(filePath);
|
|
123985
|
-
}
|
|
123986
|
-
var resolvedTypeRef = resolvedTypeRefs === null || resolvedTypeRefs === void 0 ? void 0 : resolvedTypeRefs.cache.get(name, mode);
|
|
123987
|
-
if (resolvedTypeRef && !resolvedTypeRef.isInvalidated && !resolvedTypeRef.resolvedTypeReferenceDirective) {
|
|
123988
|
-
resolvedTypeRef.isInvalidated = true;
|
|
123989
|
-
(filesWithInvalidatedResolutions !== null && filesWithInvalidatedResolutions !== void 0 ? filesWithInvalidatedResolutions : (filesWithInvalidatedResolutions = new ts.Set())).add(filePath);
|
|
123990
|
-
}
|
|
123991
|
-
});
|
|
123992
|
-
});
|
|
123125
|
+
ts.Debug.assert(filesWithInvalidatedNonRelativeUnresolvedImports === filesMap || filesWithInvalidatedNonRelativeUnresolvedImports === undefined);
|
|
123126
|
+
filesWithInvalidatedNonRelativeUnresolvedImports = filesMap;
|
|
123993
123127
|
}
|
|
123994
123128
|
function scheduleInvalidateResolutionOfFailedLookupLocation(fileOrDirectoryPath, isCreatingWatchedDirectory) {
|
|
123995
123129
|
if (isCreatingWatchedDirectory) {
|
|
@@ -124061,10 +123195,9 @@ var ts;
|
|
|
124061
123195
|
});
|
|
124062
123196
|
}
|
|
124063
123197
|
function canInvalidatedFailedLookupResolutionWithAffectingLocation(resolution) {
|
|
124064
|
-
|
|
124065
|
-
return !!affectingPathChecks && !!((_a = resolution.affectingLocations) === null || _a === void 0 ? void 0 : _a.some(function (location) {
|
|
123198
|
+
return !!affectingPathChecks && resolution.affectingLocations.some(function (location) {
|
|
124066
123199
|
return affectingPathChecks.has(resolutionHost.toPath(location));
|
|
124067
|
-
})
|
|
123200
|
+
});
|
|
124068
123201
|
}
|
|
124069
123202
|
function closeTypeRootsWatch() {
|
|
124070
123203
|
ts.clearMap(typeRootsWatches, ts.closeFileWatcher);
|
|
@@ -124454,9 +123587,9 @@ var ts;
|
|
|
124454
123587
|
if (!preferSymlinks) {
|
|
124455
123588
|
// Symlinks inside ignored paths are already filtered out of the symlink cache,
|
|
124456
123589
|
// so we only need to remove them from the realpath filenames.
|
|
124457
|
-
var
|
|
124458
|
-
if (
|
|
124459
|
-
return
|
|
123590
|
+
var result_16 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
|
|
123591
|
+
if (result_16)
|
|
123592
|
+
return result_16;
|
|
124460
123593
|
}
|
|
124461
123594
|
var symlinkedDirectories = (_a = host.getSymlinkCache) === null || _a === void 0 ? void 0 : _a.call(host).getSymlinkedDirectoriesByRealpath();
|
|
124462
123595
|
var fullImportedFileName = ts.getNormalizedAbsolutePath(importedFileName, cwd);
|
|
@@ -124476,10 +123609,10 @@ var ts;
|
|
|
124476
123609
|
for (var _i = 0, symlinkDirectories_1 = symlinkDirectories; _i < symlinkDirectories_1.length; _i++) {
|
|
124477
123610
|
var symlinkDirectory = symlinkDirectories_1[_i];
|
|
124478
123611
|
var option = ts.resolvePath(symlinkDirectory, relative);
|
|
124479
|
-
var
|
|
123612
|
+
var result_17 = cb(option, target === referenceRedirect);
|
|
124480
123613
|
shouldFilterIgnoredPaths = true; // We found a non-ignored path in symlinks, so we can reject ignored-path realpaths
|
|
124481
|
-
if (
|
|
124482
|
-
return
|
|
123614
|
+
if (result_17)
|
|
123615
|
+
return result_17;
|
|
124483
123616
|
}
|
|
124484
123617
|
});
|
|
124485
123618
|
});
|
|
@@ -124545,9 +123678,9 @@ var ts;
|
|
|
124545
123678
|
};
|
|
124546
123679
|
var out_directory_1;
|
|
124547
123680
|
for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) {
|
|
124548
|
-
var
|
|
123681
|
+
var state_11 = _loop_35(directory);
|
|
124549
123682
|
directory = out_directory_1;
|
|
124550
|
-
if (
|
|
123683
|
+
if (state_11 === "break")
|
|
124551
123684
|
break;
|
|
124552
123685
|
}
|
|
124553
123686
|
if (allFileNames.size) {
|
|
@@ -125516,8 +124649,7 @@ var ts;
|
|
|
125516
124649
|
})(ts || (ts = {}));
|
|
125517
124650
|
var ts;
|
|
125518
124651
|
(function (ts) {
|
|
125519
|
-
|
|
125520
|
-
function readBuildInfoForProgram(compilerOptions, host) {
|
|
124652
|
+
function readBuilderProgram(compilerOptions, host) {
|
|
125521
124653
|
var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(compilerOptions);
|
|
125522
124654
|
if (!buildInfoPath)
|
|
125523
124655
|
return undefined;
|
|
@@ -125538,12 +124670,7 @@ var ts;
|
|
|
125538
124670
|
return undefined;
|
|
125539
124671
|
if (!buildInfo.program)
|
|
125540
124672
|
return undefined;
|
|
125541
|
-
return
|
|
125542
|
-
}
|
|
125543
|
-
ts.readBuildInfoForProgram = readBuildInfoForProgram;
|
|
125544
|
-
function readBuilderProgram(compilerOptions, host) {
|
|
125545
|
-
var result = readBuildInfoForProgram(compilerOptions, host);
|
|
125546
|
-
return result && ts.createBuilderProgramUsingProgramBuildInfo(result.buildInfo.program, result.buildInfoPath, host, compilerOptions.configFilePath);
|
|
124673
|
+
return ts.createBuilderProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host);
|
|
125547
124674
|
}
|
|
125548
124675
|
ts.readBuilderProgram = readBuilderProgram;
|
|
125549
124676
|
function createIncrementalCompilerHost(options, system) {
|
|
@@ -125682,7 +124809,7 @@ var ts;
|
|
|
125682
124809
|
}
|
|
125683
124810
|
return host.resolveModuleNames.apply(host, args);
|
|
125684
124811
|
}) :
|
|
125685
|
-
(function (moduleNames, containingFile,
|
|
124812
|
+
(function (moduleNames, containingFile, reusedNames, redirectedReference, _options, sourceFile) { return resolutionCache.resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference, sourceFile); });
|
|
125686
124813
|
compilerHost.resolveTypeReferenceDirectives = host.resolveTypeReferenceDirectives ?
|
|
125687
124814
|
(function () {
|
|
125688
124815
|
var args = [];
|
|
@@ -125691,13 +124818,7 @@ var ts;
|
|
|
125691
124818
|
}
|
|
125692
124819
|
return host.resolveTypeReferenceDirectives.apply(host, args);
|
|
125693
124820
|
}) :
|
|
125694
|
-
(function (typeDirectiveNames, containingFile, redirectedReference, _options, containingFileMode
|
|
125695
|
-
compilerHost.getModuleResolutionCache = host.resolveModuleNames ?
|
|
125696
|
-
ts.maybeBind(host, host.getModuleResolutionCache) :
|
|
125697
|
-
(function () { return resolutionCache.getModuleResolutionCache(); });
|
|
125698
|
-
compilerHost.getTypeReferenceDirectiveResolutionCache = host.resolveTypeReferenceDirectives ?
|
|
125699
|
-
ts.maybeBind(host, host.getTypeReferenceDirectiveResolutionCache) :
|
|
125700
|
-
(function () { return resolutionCache.getTypeReferenceDirectiveResolutionCache(); });
|
|
124821
|
+
(function (typeDirectiveNames, containingFile, redirectedReference, _options, containingFileMode) { return resolutionCache.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference, containingFileMode); });
|
|
125701
124822
|
var userProvidedResolution = !!host.resolveModuleNames || !!host.resolveTypeReferenceDirectives;
|
|
125702
124823
|
builderProgram = readBuilderProgram(compilerOptions, compilerHost);
|
|
125703
124824
|
synchronizeProgram();
|
|
@@ -125766,8 +124887,7 @@ var ts;
|
|
|
125766
124887
|
}
|
|
125767
124888
|
// All resolutions are invalid if user provided resolutions
|
|
125768
124889
|
var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution);
|
|
125769
|
-
|
|
125770
|
-
if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
|
|
124890
|
+
if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, fileExists, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
|
|
125771
124891
|
if (hasChangedConfigFileParsingErrors) {
|
|
125772
124892
|
if (reportFileChangeDetectedOnCreateProgram) {
|
|
125773
124893
|
reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation);
|
|
@@ -125786,11 +124906,6 @@ var ts;
|
|
|
125786
124906
|
if (host.afterProgramCreate && program !== builderProgram) {
|
|
125787
124907
|
host.afterProgramCreate(builderProgram);
|
|
125788
124908
|
}
|
|
125789
|
-
compilerHost.readFile = originalReadFile;
|
|
125790
|
-
compilerHost.fileExists = originalFileExists;
|
|
125791
|
-
compilerHost.directoryExists = originalDirectoryExists;
|
|
125792
|
-
compilerHost.createDirectory = originalCreateDirectory;
|
|
125793
|
-
compilerHost.writeFile = originalWriteFile;
|
|
125794
124909
|
return builderProgram;
|
|
125795
124910
|
}
|
|
125796
124911
|
function createNewProgram(hasInvalidatedResolution) {
|
|
@@ -125800,16 +124915,19 @@ var ts;
|
|
|
125800
124915
|
writeLog(" options: " + JSON.stringify(compilerOptions));
|
|
125801
124916
|
if (projectReferences)
|
|
125802
124917
|
writeLog(" projectReferences: " + JSON.stringify(projectReferences));
|
|
124918
|
+
var needsUpdateInTypeRootWatch = hasChangedCompilerOptions || !getCurrentProgram();
|
|
125803
124919
|
hasChangedCompilerOptions = false;
|
|
125804
124920
|
hasChangedConfigFileParsingErrors = false;
|
|
125805
124921
|
resolutionCache.startCachingPerDirectoryResolution();
|
|
125806
124922
|
compilerHost.hasInvalidatedResolution = hasInvalidatedResolution;
|
|
125807
124923
|
compilerHost.hasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames;
|
|
125808
|
-
var oldProgram = getCurrentProgram();
|
|
125809
124924
|
builderProgram = createProgram(rootFileNames, compilerOptions, compilerHost, builderProgram, configFileParsingDiagnostics, projectReferences);
|
|
125810
|
-
resolutionCache.finishCachingPerDirectoryResolution(
|
|
124925
|
+
resolutionCache.finishCachingPerDirectoryResolution();
|
|
125811
124926
|
// Update watches
|
|
125812
124927
|
ts.updateMissingFilePathsWatch(builderProgram.getProgram(), missingFilesMap || (missingFilesMap = new ts.Map()), watchMissingFilePath);
|
|
124928
|
+
if (needsUpdateInTypeRootWatch) {
|
|
124929
|
+
resolutionCache.updateTypeRootsWatch();
|
|
124930
|
+
}
|
|
125813
124931
|
if (missingFilePathsRequestedForRelease) {
|
|
125814
124932
|
// These are the paths that program creater told us as not in use any more but were missing on the disk.
|
|
125815
124933
|
// We didnt remove the entry for them from sourceFiles cache so that we dont have to do File IO,
|
|
@@ -125886,6 +125004,9 @@ var ts;
|
|
|
125886
125004
|
sourceFilesCache.set(path, false);
|
|
125887
125005
|
}
|
|
125888
125006
|
}
|
|
125007
|
+
if (sourceFile) {
|
|
125008
|
+
sourceFile.impliedNodeFormat = ts.getImpliedNodeFormatForFile(path, resolutionCache.getModuleResolutionCache().getPackageJsonInfoCache(), compilerHost, compilerHost.getCompilationSettings());
|
|
125009
|
+
}
|
|
125889
125010
|
return sourceFile;
|
|
125890
125011
|
}
|
|
125891
125012
|
return hostSourceFile.sourceFile;
|
|
@@ -125906,7 +125027,7 @@ var ts;
|
|
|
125906
125027
|
var hostSourceFile = sourceFilesCache.get(path);
|
|
125907
125028
|
return !hostSourceFile || !hostSourceFile.version ? undefined : hostSourceFile.version;
|
|
125908
125029
|
}
|
|
125909
|
-
function onReleaseOldSourceFile(oldSourceFile) {
|
|
125030
|
+
function onReleaseOldSourceFile(oldSourceFile, _oldOptions, hasSourceFileByPath) {
|
|
125910
125031
|
var hostSourceFileInfo = sourceFilesCache.get(oldSourceFile.resolvedPath);
|
|
125911
125032
|
// If this is the source file thats in the cache and new program doesnt need it,
|
|
125912
125033
|
// remove the cached entry.
|
|
@@ -125922,6 +125043,9 @@ var ts;
|
|
|
125922
125043
|
hostSourceFileInfo.fileWatcher.close();
|
|
125923
125044
|
}
|
|
125924
125045
|
sourceFilesCache.delete(oldSourceFile.resolvedPath);
|
|
125046
|
+
if (!hasSourceFileByPath) {
|
|
125047
|
+
resolutionCache.removeResolutionsOfFile(oldSourceFile.path);
|
|
125048
|
+
}
|
|
125925
125049
|
}
|
|
125926
125050
|
}
|
|
125927
125051
|
}
|
|
@@ -126178,6 +125302,7 @@ var ts;
|
|
|
126178
125302
|
var config = parsedConfigs === null || parsedConfigs === void 0 ? void 0 : parsedConfigs.get(projectPath);
|
|
126179
125303
|
if (config)
|
|
126180
125304
|
config.reloadLevel = ts.ConfigFileProgramReloadLevel.Full;
|
|
125305
|
+
resolutionCache.removeResolutionsFromProjectReferenceRedirects(projectPath);
|
|
126181
125306
|
}
|
|
126182
125307
|
scheduleProgramUpdate();
|
|
126183
125308
|
});
|
|
@@ -126191,6 +125316,7 @@ var ts;
|
|
|
126191
125316
|
var config = parsedConfigs === null || parsedConfigs === void 0 ? void 0 : parsedConfigs.get(configPath);
|
|
126192
125317
|
if (config)
|
|
126193
125318
|
config.reloadLevel = ts.ConfigFileProgramReloadLevel.Full;
|
|
125319
|
+
resolutionCache.removeResolutionsFromProjectReferenceRedirects(configPath);
|
|
126194
125320
|
scheduleProgramUpdate();
|
|
126195
125321
|
}, ts.PollingInterval.High, ((_a = commandLine.parsedCommandLine) === null || _a === void 0 ? void 0 : _a.watchOptions) || watchOptions, ts.WatchType.ConfigFileOfReferencedProject));
|
|
126196
125322
|
// Watch Wild card
|
|
@@ -126396,23 +125522,20 @@ var ts;
|
|
|
126396
125522
|
compilerHost.getParsedCommandLine = function (fileName) { return parseConfigFile(state, fileName, toResolvedConfigFilePath(state, fileName)); };
|
|
126397
125523
|
compilerHost.resolveModuleNames = ts.maybeBind(host, host.resolveModuleNames);
|
|
126398
125524
|
compilerHost.resolveTypeReferenceDirectives = ts.maybeBind(host, host.resolveTypeReferenceDirectives);
|
|
126399
|
-
compilerHost.getModuleResolutionCache = ts.maybeBind(host, host.getModuleResolutionCache);
|
|
126400
|
-
compilerHost.getTypeReferenceDirectiveResolutionCache = ts.maybeBind(host, host.getTypeReferenceDirectiveResolutionCache);
|
|
126401
125525
|
var moduleResolutionCache = !compilerHost.resolveModuleNames ? ts.createModuleResolutionCache(currentDirectory, getCanonicalFileName) : undefined;
|
|
126402
125526
|
var typeReferenceDirectiveResolutionCache = !compilerHost.resolveTypeReferenceDirectives ? ts.createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, /*options*/ undefined, moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache()) : undefined;
|
|
126403
125527
|
if (!compilerHost.resolveModuleNames) {
|
|
126404
|
-
var loader_3 = function (moduleName, resolverMode, containingFile, redirectedReference) { return ts.resolveModuleName(moduleName, containingFile, state.projectCompilerOptions, compilerHost, moduleResolutionCache, redirectedReference, resolverMode); };
|
|
126405
|
-
compilerHost.resolveModuleNames = function (moduleNames, containingFile, _reusedNames, redirectedReference, _options, containingSourceFile
|
|
126406
|
-
return ts.loadWithModeAwareCache(moduleNames, ts.Debug.checkDefined(containingSourceFile), containingFile, redirectedReference,
|
|
125528
|
+
var loader_3 = function (moduleName, resolverMode, containingFile, redirectedReference) { return ts.resolveModuleName(moduleName, containingFile, state.projectCompilerOptions, compilerHost, moduleResolutionCache, redirectedReference, resolverMode).resolvedModule; };
|
|
125529
|
+
compilerHost.resolveModuleNames = function (moduleNames, containingFile, _reusedNames, redirectedReference, _options, containingSourceFile) {
|
|
125530
|
+
return ts.loadWithModeAwareCache(ts.Debug.checkEachDefined(moduleNames), ts.Debug.checkDefined(containingSourceFile), containingFile, redirectedReference, loader_3);
|
|
126407
125531
|
};
|
|
126408
125532
|
compilerHost.getModuleResolutionCache = function () { return moduleResolutionCache; };
|
|
126409
125533
|
}
|
|
126410
125534
|
if (!compilerHost.resolveTypeReferenceDirectives) {
|
|
126411
|
-
var loader_4 = function (moduleName, containingFile, redirectedReference, containingFileMode) { return ts.resolveTypeReferenceDirective(moduleName, containingFile, state.projectCompilerOptions, compilerHost, redirectedReference, state.typeReferenceDirectiveResolutionCache, containingFileMode); };
|
|
125535
|
+
var loader_4 = function (moduleName, containingFile, redirectedReference, containingFileMode) { return ts.resolveTypeReferenceDirective(moduleName, containingFile, state.projectCompilerOptions, compilerHost, redirectedReference, state.typeReferenceDirectiveResolutionCache, containingFileMode).resolvedTypeReferenceDirective; };
|
|
126412
125536
|
compilerHost.resolveTypeReferenceDirectives = function (typeReferenceDirectiveNames, containingFile, redirectedReference, _options, containingFileMode) {
|
|
126413
|
-
return ts.loadWithTypeDirectiveCache(typeReferenceDirectiveNames, containingFile, redirectedReference, containingFileMode, loader_4);
|
|
125537
|
+
return ts.loadWithTypeDirectiveCache(ts.Debug.checkEachDefined(typeReferenceDirectiveNames), containingFile, redirectedReference, containingFileMode, loader_4);
|
|
126414
125538
|
};
|
|
126415
|
-
compilerHost.getTypeReferenceDirectiveResolutionCache = function () { return typeReferenceDirectiveResolutionCache; };
|
|
126416
125539
|
}
|
|
126417
125540
|
compilerHost.getBuildInfo = function (fileName, configFilePath) { return getBuildInfo(state, fileName, toResolvedConfigFilePath(state, configFilePath), /*modifiedTime*/ undefined); };
|
|
126418
125541
|
var _a = ts.createWatchFactory(hostWithWatch, options), watchFile = _a.watchFile, watchDirectory = _a.watchDirectory, writeLog = _a.writeLog;
|
|
@@ -127400,7 +126523,7 @@ var ts;
|
|
|
127400
126523
|
if (buildInfoTime && buildInfoTime < inputTime) {
|
|
127401
126524
|
var version_3 = void 0;
|
|
127402
126525
|
var currentVersion = void 0;
|
|
127403
|
-
if (buildInfoProgram
|
|
126526
|
+
if (buildInfoProgram) {
|
|
127404
126527
|
// Read files and see if they are same, read is anyways cached
|
|
127405
126528
|
if (!buildInfoVersionMap)
|
|
127406
126529
|
buildInfoVersionMap = ts.getBuildInfoFileVersionMap(buildInfoProgram, buildInfoPath, host);
|
|
@@ -133709,7 +132832,7 @@ var ts;
|
|
|
133709
132832
|
// check for a version redirect
|
|
133710
132833
|
var packageJsonPath = ts.findPackageJson(baseDirectory, host);
|
|
133711
132834
|
if (packageJsonPath) {
|
|
133712
|
-
var packageJson = ts.
|
|
132835
|
+
var packageJson = ts.readJson(packageJsonPath, host);
|
|
133713
132836
|
var typesVersions = packageJson.typesVersions;
|
|
133714
132837
|
if (typeof typesVersions === "object") {
|
|
133715
132838
|
var versionPaths = (_a = ts.getPackageJsonTypesVersionsPaths(typesVersions)) === null || _a === void 0 ? void 0 : _a.paths;
|
|
@@ -133888,7 +133011,7 @@ var ts;
|
|
|
133888
133011
|
var packageDirectory = ts.combinePaths(ancestor, "node_modules", packagePath);
|
|
133889
133012
|
var packageFile = ts.combinePaths(packageDirectory, "package.json");
|
|
133890
133013
|
if (ts.tryFileExists(host, packageFile)) {
|
|
133891
|
-
var packageJson = ts.
|
|
133014
|
+
var packageJson = ts.readJson(packageFile, host);
|
|
133892
133015
|
var exports_1 = packageJson.exports;
|
|
133893
133016
|
if (exports_1) {
|
|
133894
133017
|
if (typeof exports_1 !== "object" || exports_1 === null) { // eslint-disable-line no-null/no-null
|
|
@@ -134080,7 +133203,7 @@ var ts;
|
|
|
134080
133203
|
var result = [];
|
|
134081
133204
|
for (var _i = 0, _a = ts.findPackageJsons(scriptPath, host); _i < _a.length; _i++) {
|
|
134082
133205
|
var packageJson = _a[_i];
|
|
134083
|
-
var contents = ts.
|
|
133206
|
+
var contents = ts.readJson(packageJson, host); // Cast to assert that readFile is defined
|
|
134084
133207
|
// Provide completions for all non @types dependencies
|
|
134085
133208
|
for (var _b = 0, nodeModulesDependencyKeys_1 = nodeModulesDependencyKeys; _b < nodeModulesDependencyKeys_1.length; _b++) {
|
|
134086
133209
|
var key = nodeModulesDependencyKeys_1[_b];
|
|
@@ -138353,8 +137476,24 @@ var ts;
|
|
|
138353
137476
|
};
|
|
138354
137477
|
}
|
|
138355
137478
|
ts.createDocumentRegistryInternal = createDocumentRegistryInternal;
|
|
137479
|
+
function compilerOptionValueToString(value) {
|
|
137480
|
+
var _a;
|
|
137481
|
+
if (value === null || typeof value !== "object") { // eslint-disable-line no-null/no-null
|
|
137482
|
+
return "" + value;
|
|
137483
|
+
}
|
|
137484
|
+
if (ts.isArray(value)) {
|
|
137485
|
+
return "[" + ((_a = ts.map(value, function (e) { return compilerOptionValueToString(e); })) === null || _a === void 0 ? void 0 : _a.join(",")) + "]";
|
|
137486
|
+
}
|
|
137487
|
+
var str = "{";
|
|
137488
|
+
for (var key in value) {
|
|
137489
|
+
if (ts.hasProperty(value, key)) {
|
|
137490
|
+
str += key + ": " + compilerOptionValueToString(value[key]);
|
|
137491
|
+
}
|
|
137492
|
+
}
|
|
137493
|
+
return str + "}";
|
|
137494
|
+
}
|
|
138356
137495
|
function getKeyForCompilationSettings(settings) {
|
|
138357
|
-
return ts.
|
|
137496
|
+
return ts.sourceFileAffectingCompilerOptions.map(function (option) { return compilerOptionValueToString(ts.getCompilerOptionValue(settings, option)); }).join("|") + (settings.pathsBasePath ? "|" + settings.pathsBasePath : undefined);
|
|
138358
137497
|
}
|
|
138359
137498
|
})(ts || (ts = {}));
|
|
138360
137499
|
/* Code for finding imports of an exported symbol. Used only by FindAllReferences. */
|
|
@@ -138667,22 +137806,21 @@ var ts;
|
|
|
138667
137806
|
});
|
|
138668
137807
|
}
|
|
138669
137808
|
function findModuleReferences(program, sourceFiles, searchModuleSymbol) {
|
|
138670
|
-
var _a;
|
|
138671
137809
|
var refs = [];
|
|
138672
137810
|
var checker = program.getTypeChecker();
|
|
138673
137811
|
for (var _i = 0, sourceFiles_1 = sourceFiles; _i < sourceFiles_1.length; _i++) {
|
|
138674
137812
|
var referencingFile = sourceFiles_1[_i];
|
|
138675
137813
|
var searchSourceFile = searchModuleSymbol.valueDeclaration;
|
|
138676
137814
|
if ((searchSourceFile === null || searchSourceFile === void 0 ? void 0 : searchSourceFile.kind) === 305 /* SourceFile */) {
|
|
138677
|
-
for (var
|
|
138678
|
-
var ref =
|
|
137815
|
+
for (var _a = 0, _b = referencingFile.referencedFiles; _a < _b.length; _a++) {
|
|
137816
|
+
var ref = _b[_a];
|
|
138679
137817
|
if (program.getSourceFileFromReference(referencingFile, ref) === searchSourceFile) {
|
|
138680
137818
|
refs.push({ kind: "reference", referencingFile: referencingFile, ref: ref });
|
|
138681
137819
|
}
|
|
138682
137820
|
}
|
|
138683
|
-
for (var
|
|
138684
|
-
var ref =
|
|
138685
|
-
var referenced =
|
|
137821
|
+
for (var _c = 0, _d = referencingFile.typeReferenceDirectives; _c < _d.length; _c++) {
|
|
137822
|
+
var ref = _d[_c];
|
|
137823
|
+
var referenced = program.getResolvedTypeReferenceDirectives().get(ref.fileName, ref.resolutionMode || referencingFile.impliedNodeFormat);
|
|
138686
137824
|
if (referenced !== undefined && referenced.resolvedFileName === searchSourceFile.fileName) {
|
|
138687
137825
|
refs.push({ kind: "reference", referencingFile: referencingFile, ref: ref });
|
|
138688
137826
|
}
|
|
@@ -139500,7 +138638,7 @@ var ts;
|
|
|
139500
138638
|
(function (Core) {
|
|
139501
138639
|
/** Core find-all-references algorithm. Handles special cases before delegating to `getReferencedSymbolsForSymbol`. */
|
|
139502
138640
|
function getReferencedSymbolsForNode(position, node, program, sourceFiles, cancellationToken, options, sourceFilesSet) {
|
|
139503
|
-
var _a, _b
|
|
138641
|
+
var _a, _b;
|
|
139504
138642
|
if (options === void 0) { options = {}; }
|
|
139505
138643
|
if (sourceFilesSet === void 0) { sourceFilesSet = new ts.Set(sourceFiles.map(function (f) { return f.fileName; })); }
|
|
139506
138644
|
node = getAdjustedNode(node, options);
|
|
@@ -139537,7 +138675,7 @@ var ts;
|
|
|
139537
138675
|
if (!options.implementations && ts.isStringLiteralLike(node)) {
|
|
139538
138676
|
if (ts.isModuleSpecifierLike(node)) {
|
|
139539
138677
|
var fileIncludeReasons = program.getFileIncludeReasons();
|
|
139540
|
-
var referencedFileName = (
|
|
138678
|
+
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;
|
|
139541
138679
|
var referencedFile = referencedFileName ? program.getSourceFile(referencedFileName) : undefined;
|
|
139542
138680
|
if (referencedFile) {
|
|
139543
138681
|
return [{ definition: { type: 4 /* String */, node: node }, references: getReferencesForNonModule(referencedFile, fileIncludeReasons, program) || ts.emptyArray }];
|
|
@@ -141731,7 +140869,7 @@ var ts;
|
|
|
141731
140869
|
// If we're at the new location (file was already renamed), need to redo module resolution starting from the old location.
|
|
141732
140870
|
// TODO:GH#18217
|
|
141733
140871
|
? getSourceFileToImportFromResolved(importLiteral, ts.resolveModuleName(importLiteral.text, oldImportFromPath, program.getCompilerOptions(), host), oldToNew, allFiles)
|
|
141734
|
-
: getSourceFileToImport(importedModuleSymbol, importLiteral, sourceFile, program, oldToNew);
|
|
140872
|
+
: getSourceFileToImport(importedModuleSymbol, importLiteral, sourceFile, program, host, oldToNew);
|
|
141735
140873
|
// Need an update if the imported file moved, or the importing file moved and was using a relative path.
|
|
141736
140874
|
return toImport !== undefined && (toImport.updated || (importingSourceFileMoved && ts.pathIsRelative(importLiteral.text)))
|
|
141737
140875
|
? ts.moduleSpecifiers.updateModuleSpecifier(program.getCompilerOptions(), sourceFile, getCanonicalFileName(newImportFromPath), toImport.newFileName, ts.createModuleSpecifierResolutionHost(program, host), importLiteral.text)
|
|
@@ -141749,8 +140887,7 @@ var ts;
|
|
|
141749
140887
|
function combinePathsSafe(pathA, pathB) {
|
|
141750
140888
|
return ts.ensurePathIsNonModuleName(combineNormal(pathA, pathB));
|
|
141751
140889
|
}
|
|
141752
|
-
function getSourceFileToImport(importedModuleSymbol, importLiteral, importingSourceFile, program, oldToNew) {
|
|
141753
|
-
var _a;
|
|
140890
|
+
function getSourceFileToImport(importedModuleSymbol, importLiteral, importingSourceFile, program, host, oldToNew) {
|
|
141754
140891
|
if (importedModuleSymbol) {
|
|
141755
140892
|
// `find` should succeed because we checked for ambient modules before calling this function.
|
|
141756
140893
|
var oldFileName = ts.find(importedModuleSymbol.declarations, ts.isSourceFile).fileName;
|
|
@@ -141759,7 +140896,9 @@ var ts;
|
|
|
141759
140896
|
}
|
|
141760
140897
|
else {
|
|
141761
140898
|
var mode = ts.getModeForUsageLocation(importingSourceFile, importLiteral);
|
|
141762
|
-
var resolved =
|
|
140899
|
+
var resolved = host.resolveModuleNames
|
|
140900
|
+
? host.getResolvedModuleWithFailedLookupLocationsFromCache && host.getResolvedModuleWithFailedLookupLocationsFromCache(importLiteral.text, importingSourceFile.fileName, mode)
|
|
140901
|
+
: program.getResolvedModuleWithFailedLookupLocationsFromCache(importLiteral.text, importingSourceFile.fileName, mode);
|
|
141763
140902
|
return getSourceFileToImportFromResolved(importLiteral, resolved, oldToNew, program.getSourceFiles());
|
|
141764
140903
|
}
|
|
141765
140904
|
}
|
|
@@ -141831,7 +140970,7 @@ var ts;
|
|
|
141831
140970
|
(function (GoToDefinition) {
|
|
141832
140971
|
function getDefinitionAtPosition(program, sourceFile, position, searchOtherFilesOnly, stopAtAlias) {
|
|
141833
140972
|
var _a;
|
|
141834
|
-
var _b
|
|
140973
|
+
var _b;
|
|
141835
140974
|
var resolvedRef = getReferenceAtPosition(sourceFile, position, program);
|
|
141836
140975
|
var fileReferenceDefinition = resolvedRef && [getDefinitionInfoForFileReference(resolvedRef.reference.fileName, resolvedRef.fileName, resolvedRef.unverified)] || ts.emptyArray;
|
|
141837
140976
|
if (resolvedRef === null || resolvedRef === void 0 ? void 0 : resolvedRef.file) {
|
|
@@ -141854,7 +140993,7 @@ var ts;
|
|
|
141854
140993
|
}
|
|
141855
140994
|
if (ts.isStaticModifier(node) && ts.isClassStaticBlockDeclaration(node.parent)) {
|
|
141856
140995
|
var classDecl = node.parent.parent;
|
|
141857
|
-
var
|
|
140996
|
+
var _c = getSymbol(classDecl, typeChecker, stopAtAlias), symbol_1 = _c.symbol, failedAliasResolution_1 = _c.failedAliasResolution;
|
|
141858
140997
|
var staticBlocks = ts.filter(classDecl.members, ts.isClassStaticBlockDeclaration);
|
|
141859
140998
|
var containerName_1 = symbol_1 ? typeChecker.symbolToString(symbol_1, classDecl) : "";
|
|
141860
140999
|
var sourceFile_1 = node.getSourceFile();
|
|
@@ -141864,7 +141003,7 @@ var ts;
|
|
|
141864
141003
|
return createDefinitionInfoFromName(typeChecker, staticBlock, "constructor" /* constructorImplementationElement */, "static {}", containerName_1, /*unverified*/ false, failedAliasResolution_1, { start: pos, length: "static".length });
|
|
141865
141004
|
});
|
|
141866
141005
|
}
|
|
141867
|
-
var
|
|
141006
|
+
var _d = getSymbol(node, typeChecker, stopAtAlias), symbol = _d.symbol, failedAliasResolution = _d.failedAliasResolution;
|
|
141868
141007
|
var fallbackNode = node;
|
|
141869
141008
|
if (searchOtherFilesOnly && failedAliasResolution) {
|
|
141870
141009
|
// We couldn't resolve the specific import, try on the module specifier.
|
|
@@ -141878,7 +141017,7 @@ var ts;
|
|
|
141878
141017
|
if (!symbol && ts.isModuleSpecifierLike(fallbackNode)) {
|
|
141879
141018
|
// We couldn't resolve the module specifier as an external module, but it could
|
|
141880
141019
|
// be that module resolution succeeded but the target was not a module.
|
|
141881
|
-
var ref = (
|
|
141020
|
+
var ref = (_b = sourceFile.resolvedModules) === null || _b === void 0 ? void 0 : _b.get(fallbackNode.text, ts.getModeForUsageLocation(sourceFile, fallbackNode));
|
|
141882
141021
|
if (ref) {
|
|
141883
141022
|
return [{
|
|
141884
141023
|
name: fallbackNode.text,
|
|
@@ -141999,7 +141138,7 @@ var ts;
|
|
|
141999
141138
|
return getDefinitionFromSymbol(typeChecker, symbol, node);
|
|
142000
141139
|
}
|
|
142001
141140
|
function getReferenceAtPosition(sourceFile, position, program) {
|
|
142002
|
-
var _a, _b
|
|
141141
|
+
var _a, _b;
|
|
142003
141142
|
var referencePath = findReferenceInPosition(sourceFile.referencedFiles, position);
|
|
142004
141143
|
if (referencePath) {
|
|
142005
141144
|
var file = program.getSourceFileFromReference(sourceFile, referencePath);
|
|
@@ -142007,7 +141146,7 @@ var ts;
|
|
|
142007
141146
|
}
|
|
142008
141147
|
var typeReferenceDirective = findReferenceInPosition(sourceFile.typeReferenceDirectives, position);
|
|
142009
141148
|
if (typeReferenceDirective) {
|
|
142010
|
-
var reference =
|
|
141149
|
+
var reference = program.getResolvedTypeReferenceDirectives().get(typeReferenceDirective.fileName, typeReferenceDirective.resolutionMode || sourceFile.impliedNodeFormat);
|
|
142011
141150
|
var file = reference && program.getSourceFile(reference.resolvedFileName); // TODO:GH#18217
|
|
142012
141151
|
return file && { reference: typeReferenceDirective, fileName: file.fileName, file: file, unverified: false };
|
|
142013
141152
|
}
|
|
@@ -142016,10 +141155,10 @@ var ts;
|
|
|
142016
141155
|
var file = program.getLibFileFromReference(libReferenceDirective);
|
|
142017
141156
|
return file && { reference: libReferenceDirective, fileName: file.fileName, file: file, unverified: false };
|
|
142018
141157
|
}
|
|
142019
|
-
if ((
|
|
141158
|
+
if ((_a = sourceFile.resolvedModules) === null || _a === void 0 ? void 0 : _a.size()) {
|
|
142020
141159
|
var node = ts.getTouchingToken(sourceFile, position);
|
|
142021
141160
|
if (ts.isModuleSpecifierLike(node) && ts.isExternalModuleNameRelative(node.text) && sourceFile.resolvedModules.has(node.text, ts.getModeForUsageLocation(sourceFile, node))) {
|
|
142022
|
-
var verifiedFileName = (
|
|
141161
|
+
var verifiedFileName = (_b = sourceFile.resolvedModules.get(node.text, ts.getModeForUsageLocation(sourceFile, node))) === null || _b === void 0 ? void 0 : _b.resolvedFileName;
|
|
142023
141162
|
var fileName = verifiedFileName || ts.resolvePath(ts.getDirectoryPath(sourceFile.fileName), node.text);
|
|
142024
141163
|
return {
|
|
142025
141164
|
file: program.getSourceFile(fileName),
|
|
@@ -167444,25 +166583,6 @@ var ts;
|
|
|
167444
166583
|
}
|
|
167445
166584
|
return sourceFile;
|
|
167446
166585
|
}
|
|
167447
|
-
function getOldProgram(options, compilerHost) {
|
|
167448
|
-
if (program)
|
|
167449
|
-
return program;
|
|
167450
|
-
if (!options.cacheResolutions)
|
|
167451
|
-
return undefined;
|
|
167452
|
-
var buildInfoResult = ts.readBuildInfoForProgram(options, compilerHost);
|
|
167453
|
-
if (!(buildInfoResult === null || buildInfoResult === void 0 ? void 0 : buildInfoResult.buildInfo.program.cacheResolutions))
|
|
167454
|
-
return undefined;
|
|
167455
|
-
var buildInfoFilePathDecoder = ts.getProgramBuildInfoFilePathDecoder(buildInfoResult.buildInfo.program.fileNames, buildInfoResult.buildInfoPath, host.getCurrentDirectory(), ts.createGetCanonicalFileName(compilerHost.useCaseSensitiveFileNames()));
|
|
167456
|
-
var compilerOptions = buildInfoResult.buildInfo.program.options ?
|
|
167457
|
-
ts.convertToOptionsWithAbsolutePaths(buildInfoResult.buildInfo.program.options, buildInfoFilePathDecoder.toAbsolutePath) :
|
|
167458
|
-
{};
|
|
167459
|
-
compilerOptions.configFilePath = options.configFilePath;
|
|
167460
|
-
return function (host) { return ts.createOldBuildInfoProgram(host, compilerOptions,
|
|
167461
|
-
/*cacheResolutions*/ undefined, {
|
|
167462
|
-
cache: buildInfoResult.buildInfo.program.cacheResolutions,
|
|
167463
|
-
getProgramBuildInfoFilePathDecoder: function () { return buildInfoFilePathDecoder; },
|
|
167464
|
-
}); };
|
|
167465
|
-
}
|
|
167466
166586
|
function synchronizeHostData() {
|
|
167467
166587
|
var _a, _b, _c;
|
|
167468
166588
|
ts.Debug.assert(languageServiceMode !== ts.LanguageServiceMode.Syntactic);
|
|
@@ -167524,8 +166644,6 @@ var ts;
|
|
|
167524
166644
|
trace: ts.maybeBind(host, host.trace),
|
|
167525
166645
|
resolveModuleNames: ts.maybeBind(host, host.resolveModuleNames),
|
|
167526
166646
|
getModuleResolutionCache: ts.maybeBind(host, host.getModuleResolutionCache),
|
|
167527
|
-
getTypeReferenceDirectiveResolutionCache: ts.maybeBind(host, host.getTypeReferenceDirectiveResolutionCache),
|
|
167528
|
-
createHash: ts.maybeBind(host, host.createHash),
|
|
167529
166647
|
resolveTypeReferenceDirectives: ts.maybeBind(host, host.resolveTypeReferenceDirectives),
|
|
167530
166648
|
useSourceOfProjectReferenceRedirect: ts.maybeBind(host, host.useSourceOfProjectReferenceRedirect),
|
|
167531
166649
|
getParsedCommandLine: getParsedCommandLine,
|
|
@@ -167566,13 +166684,14 @@ var ts;
|
|
|
167566
166684
|
// the program points to old source files that have been invalidated because of
|
|
167567
166685
|
// incremental parsing.
|
|
167568
166686
|
var documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings);
|
|
167569
|
-
|
|
166687
|
+
var options = {
|
|
167570
166688
|
rootNames: rootFileNames,
|
|
167571
166689
|
options: newSettings,
|
|
167572
166690
|
host: compilerHost,
|
|
167573
|
-
oldProgram:
|
|
166691
|
+
oldProgram: program,
|
|
167574
166692
|
projectReferences: projectReferences
|
|
167575
|
-
}
|
|
166693
|
+
};
|
|
166694
|
+
program = ts.createProgram(options);
|
|
167576
166695
|
// 'getOrCreateSourceFile' depends on caching but should be used past this point.
|
|
167577
166696
|
// After this point, the cache needs to be cleared to allow all collected snapshots to be released
|
|
167578
166697
|
compilerHost = undefined;
|
|
@@ -168673,7 +167792,6 @@ var ts;
|
|
|
168673
167792
|
getEmitOutput: getEmitOutput,
|
|
168674
167793
|
getNonBoundSourceFile: getNonBoundSourceFile,
|
|
168675
167794
|
getProgram: getProgram,
|
|
168676
|
-
getCurrentProgram: function () { return program; },
|
|
168677
167795
|
getAutoImportProvider: getAutoImportProvider,
|
|
168678
167796
|
updateIsDefinitionOfReferencedSymbols: updateIsDefinitionOfReferencedSymbols,
|
|
168679
167797
|
getApplicableRefactors: getApplicableRefactors,
|
|
@@ -172025,6 +171143,8 @@ var ts;
|
|
|
172025
171143
|
/*@internal*/
|
|
172026
171144
|
/**
|
|
172027
171145
|
* This is map from files to unresolved imports in it
|
|
171146
|
+
* Maop does not contain entries for files that do not have unresolved imports
|
|
171147
|
+
* This helps in containing the set of files to invalidate
|
|
172028
171148
|
*/
|
|
172029
171149
|
this.cachedUnresolvedImportsPerFile = new ts.Map();
|
|
172030
171150
|
/*@internal*/
|
|
@@ -172055,8 +171175,6 @@ var ts;
|
|
|
172055
171175
|
/*@internal*/
|
|
172056
171176
|
this.moduleSpecifierCache = server.createModuleSpecifierCache(this);
|
|
172057
171177
|
/*@internal*/
|
|
172058
|
-
this.createHash = ts.maybeBind(this.projectService.host, this.projectService.host.createHash);
|
|
172059
|
-
/*@internal*/
|
|
172060
171178
|
this.globalCacheResolutionModuleName = ts.JsTyping.nonRelativeModuleNameForTypingCache;
|
|
172061
171179
|
this.directoryStructureHost = directoryStructureHost;
|
|
172062
171180
|
this.currentDirectory = this.projectService.getNormalizedAbsolutePath(currentDirectory || "");
|
|
@@ -172187,7 +171305,7 @@ var ts;
|
|
|
172187
171305
|
this.symlinks = ts.createSymlinkCache(this.getCurrentDirectory(), this.getCanonicalFileName);
|
|
172188
171306
|
}
|
|
172189
171307
|
if (this.program && !this.symlinks.hasProcessedResolutions()) {
|
|
172190
|
-
this.symlinks.setSymlinksFromResolutions(this.program.getSourceFiles(), this.program.
|
|
171308
|
+
this.symlinks.setSymlinksFromResolutions(this.program.getSourceFiles(), this.program.getResolvedTypeReferenceDirectives());
|
|
172191
171309
|
}
|
|
172192
171310
|
return this.symlinks;
|
|
172193
171311
|
};
|
|
@@ -172278,18 +171396,17 @@ var ts;
|
|
|
172278
171396
|
var path = this.toPath(file);
|
|
172279
171397
|
return !this.isWatchedMissingFile(path) && this.directoryStructureHost.fileExists(file);
|
|
172280
171398
|
};
|
|
172281
|
-
Project.prototype.resolveModuleNames = function (moduleNames, containingFile,
|
|
172282
|
-
return this.resolutionCache.resolveModuleNames(moduleNames, containingFile, redirectedReference, containingSourceFile
|
|
171399
|
+
Project.prototype.resolveModuleNames = function (moduleNames, containingFile, reusedNames, redirectedReference, _options, containingSourceFile) {
|
|
171400
|
+
return this.resolutionCache.resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference, containingSourceFile);
|
|
172283
171401
|
};
|
|
172284
171402
|
Project.prototype.getModuleResolutionCache = function () {
|
|
172285
171403
|
return this.resolutionCache.getModuleResolutionCache();
|
|
172286
171404
|
};
|
|
172287
|
-
|
|
172288
|
-
|
|
172289
|
-
return this.resolutionCache.getTypeReferenceDirectiveResolutionCache();
|
|
171405
|
+
Project.prototype.getResolvedModuleWithFailedLookupLocationsFromCache = function (moduleName, containingFile, resolutionMode) {
|
|
171406
|
+
return this.resolutionCache.getResolvedModuleWithFailedLookupLocationsFromCache(moduleName, containingFile, resolutionMode);
|
|
172290
171407
|
};
|
|
172291
|
-
Project.prototype.resolveTypeReferenceDirectives = function (typeDirectiveNames, containingFile, redirectedReference, _options, containingFileMode
|
|
172292
|
-
return this.resolutionCache.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference, containingFileMode
|
|
171408
|
+
Project.prototype.resolveTypeReferenceDirectives = function (typeDirectiveNames, containingFile, redirectedReference, _options, containingFileMode) {
|
|
171409
|
+
return this.resolutionCache.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference, containingFileMode);
|
|
172293
171410
|
};
|
|
172294
171411
|
Project.prototype.directoryExists = function (path) {
|
|
172295
171412
|
return this.directoryStructureHost.directoryExists(path); // TODO: GH#18217
|
|
@@ -172423,8 +171540,8 @@ var ts;
|
|
|
172423
171540
|
return [];
|
|
172424
171541
|
}
|
|
172425
171542
|
server.updateProjectIfDirty(this);
|
|
172426
|
-
this.builderState = ts.BuilderState.create(this.program, this.builderState, /*disableUseFileVersionAsSignature*/ true);
|
|
172427
|
-
return ts.mapDefined(ts.BuilderState.getFilesAffectedBy(this.builderState, this.program, scriptInfo.path, this.cancellationToken, this.projectService.host), function (sourceFile) { return _this.shouldEmitFile(_this.projectService.getScriptInfoForPath(sourceFile.path)) ? sourceFile.fileName : undefined; });
|
|
171543
|
+
this.builderState = ts.BuilderState.create(this.program, this.projectService.toCanonicalFileName, this.builderState, /*disableUseFileVersionAsSignature*/ true);
|
|
171544
|
+
return ts.mapDefined(ts.BuilderState.getFilesAffectedBy(this.builderState, this.program, scriptInfo.path, this.cancellationToken, ts.maybeBind(this.projectService.host, this.projectService.host.createHash), this.getCanonicalFileName), function (sourceFile) { return _this.shouldEmitFile(_this.projectService.getScriptInfoForPath(sourceFile.path)) ? sourceFile.fileName : undefined; });
|
|
172428
171545
|
};
|
|
172429
171546
|
/**
|
|
172430
171547
|
* Returns true if emit was conducted
|
|
@@ -172468,7 +171585,6 @@ var ts;
|
|
|
172468
171585
|
}
|
|
172469
171586
|
ts.Debug.assert(this.projectService.serverMode !== ts.LanguageServiceMode.Syntactic);
|
|
172470
171587
|
this.languageService.cleanupSemanticCache();
|
|
172471
|
-
this.resolutionCache.clear();
|
|
172472
171588
|
this.languageServiceEnabled = false;
|
|
172473
171589
|
this.lastFileExceededProgramSize = lastFileExceededProgramSize;
|
|
172474
171590
|
this.builderState = undefined;
|
|
@@ -172476,6 +171592,7 @@ var ts;
|
|
|
172476
171592
|
this.autoImportProviderHost.close();
|
|
172477
171593
|
}
|
|
172478
171594
|
this.autoImportProviderHost = undefined;
|
|
171595
|
+
this.resolutionCache.closeTypeRootsWatch();
|
|
172479
171596
|
this.clearGeneratedFileWatch();
|
|
172480
171597
|
this.projectService.onUpdateLanguageServiceStateForProject(this, /*languageServiceEnabled*/ false);
|
|
172481
171598
|
};
|
|
@@ -172713,9 +171830,14 @@ var ts;
|
|
|
172713
171830
|
if (this.isRoot(info)) {
|
|
172714
171831
|
this.removeRoot(info);
|
|
172715
171832
|
}
|
|
172716
|
-
if (
|
|
171833
|
+
if (fileExists) {
|
|
171834
|
+
// If file is present, just remove the resolutions for the file
|
|
171835
|
+
this.resolutionCache.removeResolutionsOfFile(info.path);
|
|
171836
|
+
}
|
|
171837
|
+
else {
|
|
172717
171838
|
this.resolutionCache.invalidateResolutionOfFile(info.path);
|
|
172718
171839
|
}
|
|
171840
|
+
this.cachedUnresolvedImportsPerFile.delete(info.path);
|
|
172719
171841
|
if (detachFromProject) {
|
|
172720
171842
|
info.detachFromProject(this);
|
|
172721
171843
|
}
|
|
@@ -172843,7 +171965,7 @@ var ts;
|
|
|
172843
171965
|
};
|
|
172844
171966
|
Project.prototype.updateGraphWorker = function () {
|
|
172845
171967
|
var _this = this;
|
|
172846
|
-
var oldProgram = this.
|
|
171968
|
+
var oldProgram = this.program;
|
|
172847
171969
|
ts.Debug.assert(!this.isClosed(), "Called update graph worker of closed project");
|
|
172848
171970
|
this.writeLog("Starting updateGraphWorker: Project: " + this.getProjectName());
|
|
172849
171971
|
var start = ts.timestamp();
|
|
@@ -172852,14 +171974,14 @@ var ts;
|
|
|
172852
171974
|
this.program = this.languageService.getProgram(); // TODO: GH#18217
|
|
172853
171975
|
this.dirty = false;
|
|
172854
171976
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("session" /* Session */, "finishCachingPerDirectoryResolution");
|
|
172855
|
-
this.resolutionCache.finishCachingPerDirectoryResolution(
|
|
171977
|
+
this.resolutionCache.finishCachingPerDirectoryResolution();
|
|
172856
171978
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
172857
171979
|
ts.Debug.assert(oldProgram === undefined || this.program !== undefined);
|
|
172858
171980
|
// bump up the version if
|
|
172859
171981
|
// - oldProgram is not set - this is a first time updateGraph is called
|
|
172860
171982
|
// - newProgram is different from the old program and structure of the old program was not reused.
|
|
172861
171983
|
var hasNewProgram = false;
|
|
172862
|
-
if (this.program && (!oldProgram || (this.program !== oldProgram && this.program.structureIsReused !==
|
|
171984
|
+
if (this.program && (!oldProgram || (this.program !== oldProgram && this.program.structureIsReused !== 2 /* Completely */))) {
|
|
172863
171985
|
hasNewProgram = true;
|
|
172864
171986
|
if (oldProgram) {
|
|
172865
171987
|
for (var _i = 0, _a = oldProgram.getSourceFiles(); _i < _a.length; _i++) {
|
|
@@ -172867,7 +171989,8 @@ var ts;
|
|
|
172867
171989
|
var newFile = this.program.getSourceFileByPath(f.resolvedPath);
|
|
172868
171990
|
if (!newFile || (f.resolvedPath === f.path && newFile.resolvedPath !== f.path)) {
|
|
172869
171991
|
// new program does not contain this file - detach it from the project
|
|
172870
|
-
|
|
171992
|
+
// - remove resolutions only if the new program doesnt contain source file by the path (not resolvedPath since path is used for resolution)
|
|
171993
|
+
this.detachScriptInfoFromProject(f.fileName, !!this.program.getSourceFileByPath(f.path));
|
|
172871
171994
|
}
|
|
172872
171995
|
}
|
|
172873
171996
|
oldProgram.forEachResolvedProjectReference(function (resolvedProjectReference) {
|
|
@@ -172906,6 +172029,10 @@ var ts;
|
|
|
172906
172029
|
}
|
|
172907
172030
|
}
|
|
172908
172031
|
}
|
|
172032
|
+
// Watch the type locations that would be added to program as part of automatic type resolutions
|
|
172033
|
+
if (this.languageServiceEnabled && this.projectService.serverMode === ts.LanguageServiceMode.Semantic) {
|
|
172034
|
+
this.resolutionCache.updateTypeRootsWatch();
|
|
172035
|
+
}
|
|
172909
172036
|
}
|
|
172910
172037
|
if (this.exportMapCache && !this.exportMapCache.isEmpty()) {
|
|
172911
172038
|
this.exportMapCache.releaseSymbols();
|
|
@@ -172957,9 +172084,14 @@ var ts;
|
|
|
172957
172084
|
Project.prototype.sendPerformanceEvent = function (kind, durationMs) {
|
|
172958
172085
|
this.projectService.sendPerformanceEvent(kind, durationMs);
|
|
172959
172086
|
};
|
|
172960
|
-
Project.prototype.detachScriptInfoFromProject = function (uncheckedFileName) {
|
|
172961
|
-
var
|
|
172962
|
-
|
|
172087
|
+
Project.prototype.detachScriptInfoFromProject = function (uncheckedFileName, noRemoveResolution) {
|
|
172088
|
+
var scriptInfoToDetach = this.projectService.getScriptInfo(uncheckedFileName);
|
|
172089
|
+
if (scriptInfoToDetach) {
|
|
172090
|
+
scriptInfoToDetach.detachFromProject(this);
|
|
172091
|
+
if (!noRemoveResolution) {
|
|
172092
|
+
this.resolutionCache.removeResolutionsOfFile(scriptInfoToDetach.path);
|
|
172093
|
+
}
|
|
172094
|
+
}
|
|
172963
172095
|
};
|
|
172964
172096
|
Project.prototype.addMissingFileWatcher = function (missingFilePath) {
|
|
172965
172097
|
var _this = this;
|
|
@@ -173501,43 +172633,24 @@ var ts;
|
|
|
173501
172633
|
var result = ts.sortAndDeduplicate(ts.flatMap(sourceFiles, function (sourceFile) {
|
|
173502
172634
|
return extractUnresolvedImportsFromSourceFile(sourceFile, ambientModules, cachedUnresolvedImportsPerFile);
|
|
173503
172635
|
}));
|
|
173504
|
-
// Remove files from the cache if they arent in program
|
|
173505
|
-
if (cachedUnresolvedImportsPerFile.size !== program.getSourceFiles().length) {
|
|
173506
|
-
cachedUnresolvedImportsPerFile.forEach(function (_value, key) {
|
|
173507
|
-
if (!program.getSourceFileByPath(key))
|
|
173508
|
-
cachedUnresolvedImportsPerFile.delete(key);
|
|
173509
|
-
});
|
|
173510
|
-
}
|
|
173511
172636
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
173512
172637
|
return result;
|
|
173513
172638
|
}
|
|
173514
|
-
var emptyUnresolvedImports = {
|
|
173515
|
-
packages: server.emptyArray,
|
|
173516
|
-
imports: server.emptyArray,
|
|
173517
|
-
};
|
|
173518
172639
|
function extractUnresolvedImportsFromSourceFile(file, ambientModules, cachedUnresolvedImportsPerFile) {
|
|
173519
|
-
|
|
173520
|
-
|
|
173521
|
-
|
|
173522
|
-
|
|
173523
|
-
|
|
173524
|
-
|
|
173525
|
-
|
|
173526
|
-
|
|
173527
|
-
|
|
173528
|
-
|
|
173529
|
-
|
|
173530
|
-
|
|
173531
|
-
|
|
173532
|
-
if ((!resolvedModule || !ts.resolutionExtensionIsTSOrJson(resolvedModule.extension)) &&
|
|
173533
|
-
!ts.isExternalModuleNameRelative(name) &&
|
|
173534
|
-
!ambientModules.some(function (m) { return m === name; })) {
|
|
173535
|
-
packages = ts.append(packages, ts.parsePackageName(name).packageName);
|
|
173536
|
-
imports = ts.append(imports, { name: name, mode: mode });
|
|
173537
|
-
}
|
|
172640
|
+
return ts.getOrUpdate(cachedUnresolvedImportsPerFile, file.path, function () {
|
|
172641
|
+
if (!file.resolvedModules)
|
|
172642
|
+
return server.emptyArray;
|
|
172643
|
+
var unresolvedImports;
|
|
172644
|
+
file.resolvedModules.forEach(function (resolvedModule, name) {
|
|
172645
|
+
// pick unresolved non-relative names
|
|
172646
|
+
if ((!resolvedModule || !ts.resolutionExtensionIsTSOrJson(resolvedModule.extension)) &&
|
|
172647
|
+
!ts.isExternalModuleNameRelative(name) &&
|
|
172648
|
+
!ambientModules.some(function (m) { return m === name; })) {
|
|
172649
|
+
unresolvedImports = ts.append(unresolvedImports, ts.parsePackageName(name).packageName);
|
|
172650
|
+
}
|
|
172651
|
+
});
|
|
172652
|
+
return unresolvedImports || server.emptyArray;
|
|
173538
172653
|
});
|
|
173539
|
-
cachedUnresolvedImportsPerFile.set(file.path, result = packages ? { packages: packages, imports: imports } : emptyUnresolvedImports);
|
|
173540
|
-
return result.packages;
|
|
173541
172654
|
}
|
|
173542
172655
|
/**
|
|
173543
172656
|
* If a file is opened and no tsconfig (or jsconfig) is found,
|
|
@@ -173846,11 +172959,6 @@ var ts;
|
|
|
173846
172959
|
return (_a = this.hostProject.getCurrentProgram()) === null || _a === void 0 ? void 0 : _a.getModuleResolutionCache();
|
|
173847
172960
|
};
|
|
173848
172961
|
/*@internal*/
|
|
173849
|
-
AutoImportProviderProject.prototype.getTypeReferenceDirectiveResolutionCache = function () {
|
|
173850
|
-
var _a;
|
|
173851
|
-
return (_a = this.hostProject.getCurrentProgram()) === null || _a === void 0 ? void 0 : _a.getTypeReferenceDirectiveResolutionCache();
|
|
173852
|
-
};
|
|
173853
|
-
/*@internal*/
|
|
173854
172962
|
AutoImportProviderProject.maxDependencies = 10;
|
|
173855
172963
|
/*@internal*/
|
|
173856
172964
|
AutoImportProviderProject.compilerOptionsOverrides = {
|
|
@@ -175051,6 +174159,7 @@ var ts;
|
|
|
175051
174159
|
}
|
|
175052
174160
|
else {
|
|
175053
174161
|
// Change in referenced project config file
|
|
174162
|
+
project.resolutionCache.removeResolutionsFromProjectReferenceRedirects(_this.toPath(canonicalConfigFilePath));
|
|
175054
174163
|
_this.delayUpdateProjectGraph(project);
|
|
175055
174164
|
}
|
|
175056
174165
|
});
|
|
@@ -179343,7 +178452,7 @@ var ts;
|
|
|
179343
178452
|
definitions = definitions.filter(function (d) { return !d.isAmbient && !d.failedAliasResolution; });
|
|
179344
178453
|
return this.mapDefinitionInfo(definitions, project);
|
|
179345
178454
|
function findImplementationFileFromDtsFileName(fileName, resolveFromFile, auxiliaryProject) {
|
|
179346
|
-
var _a
|
|
178455
|
+
var _a;
|
|
179347
178456
|
var nodeModulesPathParts = ts.getNodeModulePathParts(fileName);
|
|
179348
178457
|
if (nodeModulesPathParts && fileName.lastIndexOf(ts.nodeModulesPathPart) === nodeModulesPathParts.topLevelNodeModulesIndex) {
|
|
179349
178458
|
// Second check ensures the fileName only contains one `/node_modules/`. If there's more than one I give up.
|
|
@@ -179365,14 +178474,14 @@ var ts;
|
|
|
179365
178474
|
// This file was the main entrypoint of a package. Try to resolve that same package name with
|
|
179366
178475
|
// the auxiliary project that only resolves to implementation files.
|
|
179367
178476
|
var implementationResolution = auxiliaryProject.resolveModuleNames([packageName], resolveFromFile)[0];
|
|
179368
|
-
return
|
|
178477
|
+
return implementationResolution === null || implementationResolution === void 0 ? void 0 : implementationResolution.resolvedFileName;
|
|
179369
178478
|
}
|
|
179370
178479
|
else {
|
|
179371
178480
|
// It wasn't the main entrypoint but we are in node_modules. Try a subpath into the package.
|
|
179372
178481
|
var pathToFileInPackage = fileName.substring(nodeModulesPathParts.packageRootIndex + 1);
|
|
179373
178482
|
var specifier = packageName + "/" + ts.removeFileExtension(pathToFileInPackage);
|
|
179374
178483
|
var implementationResolution = auxiliaryProject.resolveModuleNames([specifier], resolveFromFile)[0];
|
|
179375
|
-
return
|
|
178484
|
+
return implementationResolution === null || implementationResolution === void 0 ? void 0 : implementationResolution.resolvedFileName;
|
|
179376
178485
|
}
|
|
179377
178486
|
}
|
|
179378
178487
|
// We're not in node_modules, and we only get to this function if non-dts module resolution failed.
|