@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/typingsInstaller.js
CHANGED
|
@@ -4701,15 +4701,13 @@ var ts;
|
|
|
4701
4701
|
(function (FilePreprocessingDiagnosticsKind) {
|
|
4702
4702
|
FilePreprocessingDiagnosticsKind[FilePreprocessingDiagnosticsKind["FilePreprocessingReferencedDiagnostic"] = 0] = "FilePreprocessingReferencedDiagnostic";
|
|
4703
4703
|
FilePreprocessingDiagnosticsKind[FilePreprocessingDiagnosticsKind["FilePreprocessingFileExplainingDiagnostic"] = 1] = "FilePreprocessingFileExplainingDiagnostic";
|
|
4704
|
-
FilePreprocessingDiagnosticsKind[FilePreprocessingDiagnosticsKind["ResolutionDiagnostics"] = 2] = "ResolutionDiagnostics";
|
|
4705
4704
|
})(FilePreprocessingDiagnosticsKind = ts.FilePreprocessingDiagnosticsKind || (ts.FilePreprocessingDiagnosticsKind = {}));
|
|
4706
4705
|
/* @internal */
|
|
4707
4706
|
var StructureIsReused;
|
|
4708
4707
|
(function (StructureIsReused) {
|
|
4709
4708
|
StructureIsReused[StructureIsReused["Not"] = 0] = "Not";
|
|
4710
|
-
StructureIsReused[StructureIsReused["
|
|
4711
|
-
StructureIsReused[StructureIsReused["
|
|
4712
|
-
StructureIsReused[StructureIsReused["Completely"] = 3] = "Completely";
|
|
4709
|
+
StructureIsReused[StructureIsReused["SafeModules"] = 1] = "SafeModules";
|
|
4710
|
+
StructureIsReused[StructureIsReused["Completely"] = 2] = "Completely";
|
|
4713
4711
|
})(StructureIsReused = ts.StructureIsReused || (ts.StructureIsReused = {}));
|
|
4714
4712
|
/** Return code used by getEmitOutput function to indicate status of the function */
|
|
4715
4713
|
var ExitStatus;
|
|
@@ -9644,7 +9642,6 @@ var ts;
|
|
|
9644
9642
|
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."),
|
|
9645
9643
|
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."),
|
|
9646
9644
|
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."),
|
|
9647
|
-
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."),
|
|
9648
9645
|
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'."),
|
|
9649
9646
|
one_of_Colon: diag(6900, ts.DiagnosticCategory.Message, "one_of_Colon_6900", "one of:"),
|
|
9650
9647
|
one_or_more_Colon: diag(6901, ts.DiagnosticCategory.Message, "one_or_more_Colon_6901", "one or more:"),
|
|
@@ -14386,8 +14383,7 @@ var ts;
|
|
|
14386
14383
|
}
|
|
14387
14384
|
ts.changesAffectModuleResolution = changesAffectModuleResolution;
|
|
14388
14385
|
function optionsHaveModuleResolutionChanges(oldOptions, newOptions) {
|
|
14389
|
-
return oldOptions
|
|
14390
|
-
optionsHaveChanges(oldOptions, newOptions, ts.moduleResolutionOptionDeclarations);
|
|
14386
|
+
return optionsHaveChanges(oldOptions, newOptions, ts.moduleResolutionOptionDeclarations);
|
|
14391
14387
|
}
|
|
14392
14388
|
ts.optionsHaveModuleResolutionChanges = optionsHaveModuleResolutionChanges;
|
|
14393
14389
|
function changesAffectingProgramStructure(oldOptions, newOptions) {
|
|
@@ -14465,20 +14461,21 @@ var ts;
|
|
|
14465
14461
|
}
|
|
14466
14462
|
ts.getFullWidth = getFullWidth;
|
|
14467
14463
|
function getResolvedModule(sourceFile, moduleNameText, mode) {
|
|
14468
|
-
|
|
14469
|
-
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;
|
|
14464
|
+
return sourceFile && sourceFile.resolvedModules && sourceFile.resolvedModules.get(moduleNameText, mode);
|
|
14470
14465
|
}
|
|
14471
14466
|
ts.getResolvedModule = getResolvedModule;
|
|
14472
14467
|
function setResolvedModule(sourceFile, moduleNameText, resolvedModule, mode) {
|
|
14473
|
-
|
|
14474
|
-
|
|
14468
|
+
if (!sourceFile.resolvedModules) {
|
|
14469
|
+
sourceFile.resolvedModules = ts.createModeAwareCache();
|
|
14470
|
+
}
|
|
14475
14471
|
sourceFile.resolvedModules.set(moduleNameText, mode, resolvedModule);
|
|
14476
14472
|
}
|
|
14477
14473
|
ts.setResolvedModule = setResolvedModule;
|
|
14478
|
-
function setResolvedTypeReferenceDirective(sourceFile, typeReferenceDirectiveName, resolvedTypeReferenceDirective
|
|
14479
|
-
|
|
14480
|
-
|
|
14481
|
-
|
|
14474
|
+
function setResolvedTypeReferenceDirective(sourceFile, typeReferenceDirectiveName, resolvedTypeReferenceDirective) {
|
|
14475
|
+
if (!sourceFile.resolvedTypeReferenceDirectiveNames) {
|
|
14476
|
+
sourceFile.resolvedTypeReferenceDirectiveNames = ts.createModeAwareCache();
|
|
14477
|
+
}
|
|
14478
|
+
sourceFile.resolvedTypeReferenceDirectiveNames.set(typeReferenceDirectiveName, /*mode*/ undefined, resolvedTypeReferenceDirective);
|
|
14482
14479
|
}
|
|
14483
14480
|
ts.setResolvedTypeReferenceDirective = setResolvedTypeReferenceDirective;
|
|
14484
14481
|
function projectReferenceIsEqualTo(oldRef, newRef) {
|
|
@@ -14488,15 +14485,11 @@ var ts;
|
|
|
14488
14485
|
}
|
|
14489
14486
|
ts.projectReferenceIsEqualTo = projectReferenceIsEqualTo;
|
|
14490
14487
|
function moduleResolutionIsEqualTo(oldResolution, newResolution) {
|
|
14491
|
-
return oldResolution === newResolution
|
|
14492
|
-
oldResolution.
|
|
14493
|
-
|
|
14494
|
-
|
|
14495
|
-
|
|
14496
|
-
oldResolution.resolvedModule.extension === newResolution.resolvedModule.extension &&
|
|
14497
|
-
oldResolution.resolvedModule.resolvedFileName === newResolution.resolvedModule.resolvedFileName &&
|
|
14498
|
-
oldResolution.resolvedModule.originalPath === newResolution.resolvedModule.originalPath &&
|
|
14499
|
-
packageIdIsEqual(oldResolution.resolvedModule.packageId, newResolution.resolvedModule.packageId);
|
|
14488
|
+
return oldResolution.isExternalLibraryImport === newResolution.isExternalLibraryImport &&
|
|
14489
|
+
oldResolution.extension === newResolution.extension &&
|
|
14490
|
+
oldResolution.resolvedFileName === newResolution.resolvedFileName &&
|
|
14491
|
+
oldResolution.originalPath === newResolution.originalPath &&
|
|
14492
|
+
packageIdIsEqual(oldResolution.packageId, newResolution.packageId);
|
|
14500
14493
|
}
|
|
14501
14494
|
ts.moduleResolutionIsEqualTo = moduleResolutionIsEqualTo;
|
|
14502
14495
|
function packageIdIsEqual(a, b) {
|
|
@@ -14512,13 +14505,9 @@ var ts;
|
|
|
14512
14505
|
}
|
|
14513
14506
|
ts.packageIdToString = packageIdToString;
|
|
14514
14507
|
function typeDirectiveIsEqualTo(oldResolution, newResolution) {
|
|
14515
|
-
return oldResolution === newResolution
|
|
14516
|
-
oldResolution.
|
|
14517
|
-
|
|
14518
|
-
!!newResolution.resolvedTypeReferenceDirective &&
|
|
14519
|
-
oldResolution.resolvedTypeReferenceDirective.resolvedFileName === newResolution.resolvedTypeReferenceDirective.resolvedFileName &&
|
|
14520
|
-
!!oldResolution.resolvedTypeReferenceDirective.primary === !!newResolution.resolvedTypeReferenceDirective.primary &&
|
|
14521
|
-
oldResolution.resolvedTypeReferenceDirective.originalPath === newResolution.resolvedTypeReferenceDirective.originalPath;
|
|
14508
|
+
return oldResolution.resolvedFileName === newResolution.resolvedFileName
|
|
14509
|
+
&& oldResolution.primary === newResolution.primary
|
|
14510
|
+
&& oldResolution.originalPath === newResolution.originalPath;
|
|
14522
14511
|
}
|
|
14523
14512
|
ts.typeDirectiveIsEqualTo = typeDirectiveIsEqualTo;
|
|
14524
14513
|
function hasChangesInResolutions(names, newResolutions, oldResolutions, oldSourceFile, comparer) {
|
|
@@ -19375,20 +19364,23 @@ var ts;
|
|
|
19375
19364
|
return getStringFromExpandedCharCodes(expandedCharCodes);
|
|
19376
19365
|
}
|
|
19377
19366
|
ts.base64decode = base64decode;
|
|
19378
|
-
function
|
|
19379
|
-
|
|
19380
|
-
|
|
19381
|
-
|
|
19382
|
-
|
|
19383
|
-
|
|
19384
|
-
|
|
19385
|
-
|
|
19386
|
-
|
|
19367
|
+
function readJson(path, host) {
|
|
19368
|
+
try {
|
|
19369
|
+
var jsonText = host.readFile(path);
|
|
19370
|
+
if (!jsonText)
|
|
19371
|
+
return {};
|
|
19372
|
+
var result = ts.parseConfigFileTextToJson(path, jsonText);
|
|
19373
|
+
if (result.error) {
|
|
19374
|
+
return {};
|
|
19375
|
+
}
|
|
19376
|
+
return result.config;
|
|
19377
|
+
}
|
|
19378
|
+
catch (e) {
|
|
19379
|
+
// gracefully handle if readFile fails or returns not JSON
|
|
19387
19380
|
return {};
|
|
19388
19381
|
}
|
|
19389
|
-
return result.config;
|
|
19390
19382
|
}
|
|
19391
|
-
ts.
|
|
19383
|
+
ts.readJson = readJson;
|
|
19392
19384
|
function directoryProbablyExists(directoryName, host) {
|
|
19393
19385
|
// if host does not support 'directoryExists' assume that directory will exist
|
|
19394
19386
|
return !host.directoryExists || host.directoryExists(directoryName);
|
|
@@ -20470,15 +20462,14 @@ var ts;
|
|
|
20470
20462
|
},
|
|
20471
20463
|
setSymlinksFromResolutions: function (files, typeReferenceDirectives) {
|
|
20472
20464
|
var _this = this;
|
|
20473
|
-
var _a
|
|
20465
|
+
var _a;
|
|
20474
20466
|
ts.Debug.assert(!hasProcessedResolutions);
|
|
20475
20467
|
hasProcessedResolutions = true;
|
|
20476
20468
|
for (var _i = 0, files_1 = files; _i < files_1.length; _i++) {
|
|
20477
20469
|
var file = files_1[_i];
|
|
20478
|
-
(_a = file.resolvedModules) === null || _a === void 0 ? void 0 : _a.forEach(function (resolution) { return processResolution(_this, resolution
|
|
20479
|
-
(_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); });
|
|
20470
|
+
(_a = file.resolvedModules) === null || _a === void 0 ? void 0 : _a.forEach(function (resolution) { return processResolution(_this, resolution); });
|
|
20480
20471
|
}
|
|
20481
|
-
typeReferenceDirectives.forEach(function (resolution) { return processResolution(_this, resolution
|
|
20472
|
+
typeReferenceDirectives === null || typeReferenceDirectives === void 0 ? void 0 : typeReferenceDirectives.forEach(function (resolution) { return processResolution(_this, resolution); });
|
|
20482
20473
|
},
|
|
20483
20474
|
hasProcessedResolutions: function () { return hasProcessedResolutions; },
|
|
20484
20475
|
};
|
|
@@ -39738,17 +39729,6 @@ var ts;
|
|
|
39738
39729
|
transpileOptionValue: undefined,
|
|
39739
39730
|
defaultValueDescription: ts.Diagnostics.false_unless_composite_is_set
|
|
39740
39731
|
},
|
|
39741
|
-
{
|
|
39742
|
-
name: "cacheResolutions",
|
|
39743
|
-
type: "boolean",
|
|
39744
|
-
category: ts.Diagnostics.Projects,
|
|
39745
|
-
description: ts.Diagnostics.Save_resolutions_into_tsbuildinfo_file_and_use_them_for_incremental_compilation,
|
|
39746
|
-
affectsModuleResolution: true,
|
|
39747
|
-
affectsMultiFileEmitBuildInfo: true,
|
|
39748
|
-
affectsBundleEmitBuildInfo: true,
|
|
39749
|
-
transpileOptionValue: undefined,
|
|
39750
|
-
defaultValueDescription: false,
|
|
39751
|
-
},
|
|
39752
39732
|
{
|
|
39753
39733
|
name: "assumeChangesOnlyAffectDirectDependencies",
|
|
39754
39734
|
type: "boolean",
|
|
@@ -41846,9 +41826,6 @@ var ts;
|
|
|
41846
41826
|
if (result.configFilePath) {
|
|
41847
41827
|
result.configFilePath = toAbsolutePath(result.configFilePath);
|
|
41848
41828
|
}
|
|
41849
|
-
if (result.pathsBasePath) {
|
|
41850
|
-
result.pathsBasePath = toAbsolutePath(result.pathsBasePath);
|
|
41851
|
-
}
|
|
41852
41829
|
return result;
|
|
41853
41830
|
}
|
|
41854
41831
|
ts.convertToOptionsWithAbsolutePaths = convertToOptionsWithAbsolutePaths;
|
|
@@ -42834,36 +42811,20 @@ var ts;
|
|
|
42834
42811
|
ts.Debug.assert(ts.extensionIsTS(resolved.extension));
|
|
42835
42812
|
return { fileName: resolved.path, packageId: resolved.packageId };
|
|
42836
42813
|
}
|
|
42837
|
-
function createResolvedModuleWithFailedLookupLocations(
|
|
42838
|
-
var _a;
|
|
42839
|
-
var _b;
|
|
42814
|
+
function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, resultFromCache) {
|
|
42815
|
+
var _a, _b;
|
|
42840
42816
|
if (resultFromCache) {
|
|
42841
|
-
|
|
42842
|
-
|
|
42843
|
-
resultFromCache.affectingLocations = updateResolutionField(resultFromCache.affectingLocations, affectingLocations);
|
|
42844
|
-
resultFromCache.resolutionDiagnostics = updateResolutionField(resultFromCache.resolutionDiagnostics, diagnostics);
|
|
42817
|
+
(_a = resultFromCache.failedLookupLocations).push.apply(_a, failedLookupLocations);
|
|
42818
|
+
(_b = resultFromCache.affectingLocations).push.apply(_b, affectingLocations);
|
|
42845
42819
|
return resultFromCache;
|
|
42846
42820
|
}
|
|
42847
42821
|
return {
|
|
42848
42822
|
resolvedModule: resolved && { resolvedFileName: resolved.path, originalPath: resolved.originalPath === true ? undefined : resolved.originalPath, extension: resolved.extension, isExternalLibraryImport: isExternalLibraryImport, packageId: resolved.packageId },
|
|
42849
|
-
failedLookupLocations:
|
|
42850
|
-
affectingLocations:
|
|
42851
|
-
resolutionDiagnostics:
|
|
42823
|
+
failedLookupLocations: failedLookupLocations,
|
|
42824
|
+
affectingLocations: affectingLocations,
|
|
42825
|
+
resolutionDiagnostics: diagnostics,
|
|
42852
42826
|
};
|
|
42853
42827
|
}
|
|
42854
|
-
function initializeResolutionField(value) {
|
|
42855
|
-
return value.length ? value : undefined;
|
|
42856
|
-
}
|
|
42857
|
-
/*@internal*/
|
|
42858
|
-
function updateResolutionField(to, value) {
|
|
42859
|
-
if (!(value === null || value === void 0 ? void 0 : value.length))
|
|
42860
|
-
return to;
|
|
42861
|
-
if (!(to === null || to === void 0 ? void 0 : to.length))
|
|
42862
|
-
return value;
|
|
42863
|
-
to.push.apply(to, value);
|
|
42864
|
-
return to;
|
|
42865
|
-
}
|
|
42866
|
-
ts.updateResolutionField = updateResolutionField;
|
|
42867
42828
|
function readPackageJsonField(jsonContent, fieldName, typeOfTag, state) {
|
|
42868
42829
|
if (!ts.hasProperty(jsonContent, fieldName)) {
|
|
42869
42830
|
if (state.traceEnabled) {
|
|
@@ -43015,7 +42976,8 @@ var ts;
|
|
|
43015
42976
|
options = redirectedReference.commandLine.options;
|
|
43016
42977
|
}
|
|
43017
42978
|
var containingDirectory = containingFile ? ts.getDirectoryPath(containingFile) : undefined;
|
|
43018
|
-
var
|
|
42979
|
+
var perFolderCache = containingDirectory ? cache && cache.getOrCreateCacheForDirectory(containingDirectory, redirectedReference) : undefined;
|
|
42980
|
+
var result = perFolderCache && perFolderCache.get(typeReferenceDirectiveName, /*mode*/ resolutionMode);
|
|
43019
42981
|
if (result) {
|
|
43020
42982
|
if (traceEnabled) {
|
|
43021
42983
|
trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_1, typeReferenceDirectiveName, containingFile);
|
|
@@ -43073,7 +43035,7 @@ var ts;
|
|
|
43073
43035
|
features: features,
|
|
43074
43036
|
conditions: conditions,
|
|
43075
43037
|
requestContainingDirectory: containingDirectory,
|
|
43076
|
-
|
|
43038
|
+
reportDiagnostic: function (diag) { return void diagnostics.push(diag); },
|
|
43077
43039
|
};
|
|
43078
43040
|
var resolved = primaryLookup();
|
|
43079
43041
|
var primary = true;
|
|
@@ -43093,15 +43055,8 @@ var ts;
|
|
|
43093
43055
|
isExternalLibraryImport: pathContainsNodeModules(fileName),
|
|
43094
43056
|
};
|
|
43095
43057
|
}
|
|
43096
|
-
result = {
|
|
43097
|
-
|
|
43098
|
-
failedLookupLocations: !options.cacheResolutions || !(resolvedTypeReferenceDirective === null || resolvedTypeReferenceDirective === void 0 ? void 0 : resolvedTypeReferenceDirective.resolvedFileName) ? failedLookupLocations : ts.emptyArray,
|
|
43099
|
-
affectingLocations: initializeResolutionField(affectingLocations),
|
|
43100
|
-
resolutionDiagnostics: initializeResolutionField(diagnostics),
|
|
43101
|
-
};
|
|
43102
|
-
if (containingDirectory && cache) {
|
|
43103
|
-
cache.getOrCreateCacheForDirectory(containingDirectory, redirectedReference).set(typeReferenceDirectiveName, /*mode*/ resolutionMode, result);
|
|
43104
|
-
}
|
|
43058
|
+
result = { resolvedTypeReferenceDirective: resolvedTypeReferenceDirective, failedLookupLocations: failedLookupLocations, affectingLocations: affectingLocations, resolutionDiagnostics: diagnostics };
|
|
43059
|
+
perFolderCache === null || perFolderCache === void 0 ? void 0 : perFolderCache.set(typeReferenceDirectiveName, /*mode*/ resolutionMode, result);
|
|
43105
43060
|
if (traceEnabled)
|
|
43106
43061
|
traceResult(result);
|
|
43107
43062
|
return result;
|
|
@@ -43111,10 +43066,10 @@ var ts;
|
|
|
43111
43066
|
trace(host, ts.Diagnostics.Type_reference_directive_0_was_not_resolved, typeReferenceDirectiveName);
|
|
43112
43067
|
}
|
|
43113
43068
|
else if (result.resolvedTypeReferenceDirective.packageId) {
|
|
43114
|
-
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),
|
|
43069
|
+
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);
|
|
43115
43070
|
}
|
|
43116
43071
|
else {
|
|
43117
|
-
trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2, typeReferenceDirectiveName, result.resolvedTypeReferenceDirective.resolvedFileName,
|
|
43072
|
+
trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2, typeReferenceDirectiveName, result.resolvedTypeReferenceDirective.resolvedFileName, result.resolvedTypeReferenceDirective.primary);
|
|
43118
43073
|
}
|
|
43119
43074
|
}
|
|
43120
43075
|
function primaryLookup() {
|
|
@@ -43213,7 +43168,7 @@ var ts;
|
|
|
43213
43168
|
// `types-publisher` sometimes creates packages with `"typings": null` for packages that don't provide their own types.
|
|
43214
43169
|
// See `createNotNeededPackageJSON` in the types-publisher` repo.
|
|
43215
43170
|
// eslint-disable-next-line no-null/no-null
|
|
43216
|
-
var isNotNeededPackage = host.fileExists(packageJsonPath) && ts.
|
|
43171
|
+
var isNotNeededPackage = host.fileExists(packageJsonPath) && ts.readJson(packageJsonPath, host).typings === null;
|
|
43217
43172
|
if (!isNotNeededPackage) {
|
|
43218
43173
|
var baseFileName = ts.getBaseFileName(normalized);
|
|
43219
43174
|
// At this stage, skip results with leading dot.
|
|
@@ -43230,143 +43185,49 @@ var ts;
|
|
|
43230
43185
|
return result;
|
|
43231
43186
|
}
|
|
43232
43187
|
ts.getAutomaticTypeDirectiveNames = getAutomaticTypeDirectiveNames;
|
|
43233
|
-
function compilerOptionValueToString(value) {
|
|
43234
|
-
var _a;
|
|
43235
|
-
if (value === null || typeof value !== "object") { // eslint-disable-line no-null/no-null
|
|
43236
|
-
return "" + value;
|
|
43237
|
-
}
|
|
43238
|
-
if (ts.isArray(value)) {
|
|
43239
|
-
return "[" + ((_a = ts.map(value, function (e) { return compilerOptionValueToString(e); })) === null || _a === void 0 ? void 0 : _a.join(",")) + "]";
|
|
43240
|
-
}
|
|
43241
|
-
var str = "{";
|
|
43242
|
-
for (var key in value) {
|
|
43243
|
-
if (ts.hasProperty(value, key)) {
|
|
43244
|
-
str += key + ": " + compilerOptionValueToString(value[key]);
|
|
43245
|
-
}
|
|
43246
|
-
}
|
|
43247
|
-
return str + "}";
|
|
43248
|
-
}
|
|
43249
|
-
/*@internal*/
|
|
43250
|
-
function getKeyForCompilationSettings(settings, options) {
|
|
43251
|
-
return options.map(function (option) { return compilerOptionValueToString(ts.getCompilerOptionValue(settings, option)); }).join("|") + ("|" + settings.pathsBasePath);
|
|
43252
|
-
}
|
|
43253
|
-
ts.getKeyForCompilationSettings = getKeyForCompilationSettings;
|
|
43254
|
-
/*@internal*/
|
|
43255
|
-
function getRedirectsCacheKey(options) {
|
|
43256
|
-
return getKeyForCompilationSettings(options, ts.moduleResolutionOptionDeclarations);
|
|
43257
|
-
}
|
|
43258
|
-
ts.getRedirectsCacheKey = getRedirectsCacheKey;
|
|
43259
43188
|
/*@internal*/
|
|
43260
|
-
function createCacheWithRedirects(
|
|
43261
|
-
var ownMap;
|
|
43262
|
-
var ownKey;
|
|
43263
|
-
var redirectsKeyToCache = new ts.Map();
|
|
43189
|
+
function createCacheWithRedirects(options) {
|
|
43190
|
+
var ownMap = new ts.Map();
|
|
43264
43191
|
var redirectsMap = new ts.Map();
|
|
43265
43192
|
return {
|
|
43266
43193
|
getOwnMap: getOwnMap,
|
|
43267
|
-
|
|
43268
|
-
createMapForCompilerOptions: createMapForCompilerOptions,
|
|
43269
|
-
getMapOfCacheRedirects: getMapOfCacheRedirects,
|
|
43194
|
+
redirectsMap: redirectsMap,
|
|
43270
43195
|
getOrCreateMapOfCacheRedirects: getOrCreateMapOfCacheRedirects,
|
|
43271
43196
|
clear: clear,
|
|
43272
|
-
|
|
43273
|
-
|
|
43197
|
+
setOwnOptions: setOwnOptions,
|
|
43198
|
+
setOwnMap: setOwnMap
|
|
43274
43199
|
};
|
|
43275
|
-
function
|
|
43276
|
-
|
|
43277
|
-
if (ownKey && !redirectsKeyToCache.has(ownKey))
|
|
43278
|
-
redirectsKeyToCache.set(ownKey, { map: ownMap !== null && ownMap !== void 0 ? ownMap : (ownMap = new ts.Map()), options: ownOptions });
|
|
43279
|
-
}
|
|
43280
|
-
function createMapForCompilerOptions(options, optionsKey) {
|
|
43281
|
-
if (options === ownOptions)
|
|
43282
|
-
return ownMap !== null && ownMap !== void 0 ? ownMap : (ownMap = new ts.Map());
|
|
43283
|
-
return getOrCreateRedirectMapAndKey(options, /*path*/ undefined, optionsKey);
|
|
43200
|
+
function getOwnMap() {
|
|
43201
|
+
return ownMap;
|
|
43284
43202
|
}
|
|
43285
|
-
function
|
|
43286
|
-
|
|
43287
|
-
if (path || options.configFile) {
|
|
43288
|
-
var redirects = redirectsMap.get(path || options.configFile.path);
|
|
43289
|
-
if (redirects)
|
|
43290
|
-
return redirects;
|
|
43291
|
-
}
|
|
43292
|
-
var key = optionsKey || getRedirectsCacheKey(options);
|
|
43293
|
-
var map = (_a = redirectsKeyToCache.get(key)) === null || _a === void 0 ? void 0 : _a.map;
|
|
43294
|
-
if (!map) {
|
|
43295
|
-
ensureOwnKeyCached();
|
|
43296
|
-
if (ownKey === key) {
|
|
43297
|
-
map = ownMap;
|
|
43298
|
-
}
|
|
43299
|
-
else {
|
|
43300
|
-
redirectsKeyToCache.set(key, { map: map = new ts.Map(), options: options });
|
|
43301
|
-
}
|
|
43302
|
-
}
|
|
43303
|
-
if (path || options.configFile)
|
|
43304
|
-
redirectsMap.set(path || options.configFile.path, map);
|
|
43305
|
-
return map;
|
|
43203
|
+
function setOwnOptions(newOptions) {
|
|
43204
|
+
options = newOptions;
|
|
43306
43205
|
}
|
|
43307
|
-
function
|
|
43308
|
-
|
|
43309
|
-
}
|
|
43310
|
-
function update(newOwnOptions) {
|
|
43311
|
-
// Store existing options:
|
|
43312
|
-
if (ownMap && (ownOptions === null || ownOptions === void 0 ? void 0 : ownOptions.configFile)) {
|
|
43313
|
-
ensureOwnKeyCached();
|
|
43314
|
-
if (!redirectsMap.has(ownOptions.configFile.path)) {
|
|
43315
|
-
redirectsMap.set(ownOptions.configFile.path, ownMap);
|
|
43316
|
-
}
|
|
43317
|
-
}
|
|
43318
|
-
// If this is already present use it
|
|
43319
|
-
if (newOwnOptions.configFile) {
|
|
43320
|
-
var existing_1 = redirectsMap.get(newOwnOptions.configFile.path);
|
|
43321
|
-
if (existing_1) {
|
|
43322
|
-
ownMap = existing_1;
|
|
43323
|
-
ownOptions = newOwnOptions;
|
|
43324
|
-
return;
|
|
43325
|
-
}
|
|
43326
|
-
}
|
|
43327
|
-
var key = getRedirectsCacheKey(newOwnOptions);
|
|
43328
|
-
var existing = redirectsKeyToCache.get(key);
|
|
43329
|
-
ownMap = (existing === null || existing === void 0 ? void 0 : existing.map) || new ts.Map();
|
|
43330
|
-
ownKey = key;
|
|
43331
|
-
ownOptions = newOwnOptions;
|
|
43332
|
-
if (newOwnOptions.configFile)
|
|
43333
|
-
redirectsMap.set(newOwnOptions.configFile.path, ownMap);
|
|
43206
|
+
function setOwnMap(newOwnMap) {
|
|
43207
|
+
ownMap = newOwnMap;
|
|
43334
43208
|
}
|
|
43335
|
-
function
|
|
43336
|
-
if (!redirectedReference)
|
|
43337
|
-
return ownMap;
|
|
43338
|
-
var directResult = redirectsMap.get(redirectedReference.sourceFile.path);
|
|
43339
|
-
if (directResult)
|
|
43340
|
-
return directResult;
|
|
43341
|
-
var key = getRedirectsCacheKey(redirectedReference.commandLine.options);
|
|
43342
|
-
var fromKey = redirectsKeyToCache.get(key);
|
|
43343
|
-
if (fromKey) {
|
|
43344
|
-
redirectsMap.set(redirectedReference.sourceFile.path, fromKey.map);
|
|
43345
|
-
return fromKey.map;
|
|
43346
|
-
}
|
|
43347
|
-
if (ownMap)
|
|
43348
|
-
ensureOwnKeyCached();
|
|
43349
|
-
if (ownKey === key) {
|
|
43350
|
-
redirectsMap.set(redirectedReference.sourceFile.path, ownMap);
|
|
43209
|
+
function getOrCreateMapOfCacheRedirects(redirectedReference) {
|
|
43210
|
+
if (!redirectedReference) {
|
|
43351
43211
|
return ownMap;
|
|
43352
43212
|
}
|
|
43353
|
-
|
|
43354
|
-
|
|
43355
|
-
|
|
43356
|
-
|
|
43357
|
-
|
|
43358
|
-
|
|
43213
|
+
var path = redirectedReference.sourceFile.path;
|
|
43214
|
+
var redirects = redirectsMap.get(path);
|
|
43215
|
+
if (!redirects) {
|
|
43216
|
+
// Reuse map if redirected reference map uses same resolution
|
|
43217
|
+
redirects = !options || ts.optionsHaveModuleResolutionChanges(options, redirectedReference.commandLine.options) ? new ts.Map() : ownMap;
|
|
43218
|
+
redirectsMap.set(path, redirects);
|
|
43219
|
+
}
|
|
43220
|
+
return redirects;
|
|
43359
43221
|
}
|
|
43360
43222
|
function clear() {
|
|
43361
|
-
|
|
43362
|
-
ownMap = undefined;
|
|
43223
|
+
ownMap.clear();
|
|
43363
43224
|
redirectsMap.clear();
|
|
43364
|
-
redirectsKeyToCache.clear();
|
|
43365
43225
|
}
|
|
43366
43226
|
}
|
|
43367
43227
|
ts.createCacheWithRedirects = createCacheWithRedirects;
|
|
43368
|
-
function createPackageJsonInfoCache(currentDirectory, getCanonicalFileName
|
|
43369
|
-
|
|
43228
|
+
function createPackageJsonInfoCache(currentDirectory, getCanonicalFileName) {
|
|
43229
|
+
var cache;
|
|
43230
|
+
return { getPackageJsonInfo: getPackageJsonInfo, setPackageJsonInfo: setPackageJsonInfo, clear: clear, entries: entries };
|
|
43370
43231
|
function getPackageJsonInfo(packageJsonPath) {
|
|
43371
43232
|
return cache === null || cache === void 0 ? void 0 : cache.get(ts.toPath(packageJsonPath, currentDirectory, getCanonicalFileName));
|
|
43372
43233
|
}
|
|
@@ -43380,9 +43241,6 @@ var ts;
|
|
|
43380
43241
|
var iter = cache === null || cache === void 0 ? void 0 : cache.entries();
|
|
43381
43242
|
return iter ? ts.arrayFrom(iter) : [];
|
|
43382
43243
|
}
|
|
43383
|
-
function clone() {
|
|
43384
|
-
return createPackageJsonInfoCache(currentDirectory, getCanonicalFileName, cache && new ts.Map(cache));
|
|
43385
|
-
}
|
|
43386
43244
|
}
|
|
43387
43245
|
function getOrCreateCache(cacheWithRedirects, redirectedReference, key, create) {
|
|
43388
43246
|
var cache = cacheWithRedirects.getOrCreateMapOfCacheRedirects(redirectedReference);
|
|
@@ -43393,43 +43251,47 @@ var ts;
|
|
|
43393
43251
|
}
|
|
43394
43252
|
return result;
|
|
43395
43253
|
}
|
|
43254
|
+
function updateRedirectsMap(options, directoryToModuleNameMap, moduleNameToDirectoryMap) {
|
|
43255
|
+
if (!options.configFile)
|
|
43256
|
+
return;
|
|
43257
|
+
if (directoryToModuleNameMap.redirectsMap.size === 0) {
|
|
43258
|
+
// The own map will be for projectCompilerOptions
|
|
43259
|
+
ts.Debug.assert(!moduleNameToDirectoryMap || moduleNameToDirectoryMap.redirectsMap.size === 0);
|
|
43260
|
+
ts.Debug.assert(directoryToModuleNameMap.getOwnMap().size === 0);
|
|
43261
|
+
ts.Debug.assert(!moduleNameToDirectoryMap || moduleNameToDirectoryMap.getOwnMap().size === 0);
|
|
43262
|
+
directoryToModuleNameMap.redirectsMap.set(options.configFile.path, directoryToModuleNameMap.getOwnMap());
|
|
43263
|
+
moduleNameToDirectoryMap === null || moduleNameToDirectoryMap === void 0 ? void 0 : moduleNameToDirectoryMap.redirectsMap.set(options.configFile.path, moduleNameToDirectoryMap.getOwnMap());
|
|
43264
|
+
}
|
|
43265
|
+
else {
|
|
43266
|
+
// Set correct own map
|
|
43267
|
+
ts.Debug.assert(!moduleNameToDirectoryMap || moduleNameToDirectoryMap.redirectsMap.size > 0);
|
|
43268
|
+
var ref = {
|
|
43269
|
+
sourceFile: options.configFile,
|
|
43270
|
+
commandLine: { options: options }
|
|
43271
|
+
};
|
|
43272
|
+
directoryToModuleNameMap.setOwnMap(directoryToModuleNameMap.getOrCreateMapOfCacheRedirects(ref));
|
|
43273
|
+
moduleNameToDirectoryMap === null || moduleNameToDirectoryMap === void 0 ? void 0 : moduleNameToDirectoryMap.setOwnMap(moduleNameToDirectoryMap.getOrCreateMapOfCacheRedirects(ref));
|
|
43274
|
+
}
|
|
43275
|
+
directoryToModuleNameMap.setOwnOptions(options);
|
|
43276
|
+
moduleNameToDirectoryMap === null || moduleNameToDirectoryMap === void 0 ? void 0 : moduleNameToDirectoryMap.setOwnOptions(options);
|
|
43277
|
+
}
|
|
43396
43278
|
function createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, directoryToModuleNameMap) {
|
|
43397
|
-
var oldResolutionCache;
|
|
43398
43279
|
return {
|
|
43399
|
-
getFromCache: getFromCache,
|
|
43400
43280
|
getOrCreateCacheForDirectory: getOrCreateCacheForDirectory,
|
|
43401
43281
|
clear: clear,
|
|
43402
43282
|
update: update,
|
|
43403
|
-
setOldResolutionCache: function (cache) { return oldResolutionCache = cache; }
|
|
43404
43283
|
};
|
|
43405
43284
|
function clear() {
|
|
43406
|
-
oldResolutionCache = undefined;
|
|
43407
43285
|
directoryToModuleNameMap.clear();
|
|
43408
43286
|
}
|
|
43409
43287
|
function update(options) {
|
|
43410
|
-
|
|
43288
|
+
updateRedirectsMap(options, directoryToModuleNameMap);
|
|
43411
43289
|
}
|
|
43412
43290
|
function getOrCreateCacheForDirectory(directoryName, redirectedReference) {
|
|
43413
43291
|
var path = ts.toPath(directoryName, currentDirectory, getCanonicalFileName);
|
|
43414
|
-
return getOrCreateCache(directoryToModuleNameMap, redirectedReference, path, createModeAwareCache);
|
|
43415
|
-
}
|
|
43416
|
-
function getFromCache(directoryName, name, mode, redirectedReference) {
|
|
43417
|
-
var _a, _b;
|
|
43418
|
-
var path = ts.toPath(directoryName, currentDirectory, getCanonicalFileName);
|
|
43419
|
-
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);
|
|
43420
|
-
if (result)
|
|
43421
|
-
return result;
|
|
43422
|
-
var resultFromOld = oldResolutionCache === null || oldResolutionCache === void 0 ? void 0 : oldResolutionCache.getResolved(path, name, mode, redirectedReference);
|
|
43423
|
-
if (resultFromOld)
|
|
43424
|
-
getOrCreateCacheForDirectory(directoryName, redirectedReference).set(name, mode, resultFromOld);
|
|
43425
|
-
return resultFromOld;
|
|
43292
|
+
return getOrCreateCache(directoryToModuleNameMap, redirectedReference, path, function () { return createModeAwareCache(); });
|
|
43426
43293
|
}
|
|
43427
43294
|
}
|
|
43428
|
-
/*@internal*/
|
|
43429
|
-
function getModeAwareCacheKey(specifier, mode) {
|
|
43430
|
-
return (mode === undefined ? specifier : mode + "|" + specifier);
|
|
43431
|
-
}
|
|
43432
|
-
ts.getModeAwareCacheKey = getModeAwareCacheKey;
|
|
43433
43295
|
/* @internal */
|
|
43434
43296
|
function createModeAwareCache() {
|
|
43435
43297
|
var underlying = new ts.Map();
|
|
@@ -43455,22 +43317,13 @@ var ts;
|
|
|
43455
43317
|
return cb(elem, specifier, mode);
|
|
43456
43318
|
});
|
|
43457
43319
|
},
|
|
43458
|
-
entries: function () {
|
|
43459
|
-
var keys = underlying.entries();
|
|
43460
|
-
return {
|
|
43461
|
-
next: function () {
|
|
43462
|
-
var next = keys.next();
|
|
43463
|
-
return !next.done ? { value: __spreadArray(__spreadArray([], memoizedReverseKeys.get(next.value[0]), true), [next.value[1]], false) } : next;
|
|
43464
|
-
},
|
|
43465
|
-
};
|
|
43466
|
-
},
|
|
43467
43320
|
size: function () {
|
|
43468
43321
|
return underlying.size;
|
|
43469
|
-
}
|
|
43322
|
+
}
|
|
43470
43323
|
};
|
|
43471
43324
|
return cache;
|
|
43472
43325
|
function getUnderlyingCacheKey(specifier, mode) {
|
|
43473
|
-
var result =
|
|
43326
|
+
var result = mode === undefined ? specifier : mode + "|" + specifier;
|
|
43474
43327
|
memoizedReverseKeys.set(result, [specifier, mode]);
|
|
43475
43328
|
return result;
|
|
43476
43329
|
}
|
|
@@ -43483,121 +43336,35 @@ var ts;
|
|
|
43483
43336
|
for (var i = 0; i < keys.length; ++i) {
|
|
43484
43337
|
var entry = keys[i];
|
|
43485
43338
|
// We lower-case all type references because npm automatically lowercases all packages. See GH#9824.
|
|
43486
|
-
var name = !ts.isString(entry) ?
|
|
43339
|
+
var name = !ts.isString(entry) ? entry.fileName.toLowerCase() : entry;
|
|
43487
43340
|
var mode = !ts.isString(entry) ? entry.resolutionMode || file.impliedNodeFormat : ts.getModeForResolutionAtIndex(file, i);
|
|
43488
43341
|
map.set(name, mode, values[i]);
|
|
43489
43342
|
}
|
|
43490
43343
|
return map;
|
|
43491
43344
|
}
|
|
43492
43345
|
ts.zipToModeAwareCache = zipToModeAwareCache;
|
|
43493
|
-
function
|
|
43494
|
-
var
|
|
43495
|
-
|
|
43496
|
-
var i = 0;
|
|
43497
|
-
var limit = Math.min(directory.length, resolutionDirectory.length);
|
|
43498
|
-
while (i < limit && directory.charCodeAt(i) === resolutionDirectory.charCodeAt(i)) {
|
|
43499
|
-
i++;
|
|
43500
|
-
}
|
|
43501
|
-
if (i === directory.length && (resolutionDirectory.length === i || resolutionDirectory[i] === ts.directorySeparator)) {
|
|
43502
|
-
return directory;
|
|
43503
|
-
}
|
|
43504
|
-
var rootLength = ts.getRootLength(directory);
|
|
43505
|
-
if (i < rootLength) {
|
|
43506
|
-
return undefined;
|
|
43507
|
-
}
|
|
43508
|
-
var sep = directory.lastIndexOf(ts.directorySeparator, i - 1);
|
|
43509
|
-
if (sep === -1) {
|
|
43510
|
-
return undefined;
|
|
43511
|
-
}
|
|
43512
|
-
return directory.substr(0, Math.max(sep, rootLength));
|
|
43513
|
-
}
|
|
43514
|
-
/*@internal*/
|
|
43515
|
-
function getResolvedFileNameForModuleNameToDirectorySet(result) {
|
|
43516
|
-
return result.resolvedModule &&
|
|
43517
|
-
(result.resolvedModule.originalPath || result.resolvedModule.resolvedFileName);
|
|
43518
|
-
}
|
|
43519
|
-
ts.getResolvedFileNameForModuleNameToDirectorySet = getResolvedFileNameForModuleNameToDirectorySet;
|
|
43520
|
-
/**
|
|
43521
|
-
* At first this function add entry directory -> module resolution result to the table.
|
|
43522
|
-
* Then it computes the set of parent folders for 'directory' that should have the same module resolution result
|
|
43523
|
-
* and for every parent folder in set it adds entry: parent -> module resolution. .
|
|
43524
|
-
* Lets say we first directory name: /a/b/c/d/e and resolution result is: /a/b/bar.ts.
|
|
43525
|
-
* Set of parent folders that should have the same result will be:
|
|
43526
|
-
* [
|
|
43527
|
-
* /a/b/c/d, /a/b/c, /a/b
|
|
43528
|
-
* ]
|
|
43529
|
-
* this means that request for module resolution from file in any of these folder will be immediately found in cache.
|
|
43530
|
-
*/
|
|
43531
|
-
/*@internal*/
|
|
43532
|
-
function moduleNameToDirectorySet(directoryPathMap, directory, result, getResolvedFileName, toPath, ancestoryWorker) {
|
|
43533
|
-
// if entry is already in cache do nothing
|
|
43534
|
-
if (directoryPathMap.has(directory))
|
|
43535
|
-
return;
|
|
43536
|
-
directoryPathMap.set(directory, result);
|
|
43537
|
-
var resolvedFileName = getResolvedFileName(result);
|
|
43538
|
-
// find common prefix between directory and resolved file name
|
|
43539
|
-
// this common prefix should be the shortest path that has the same resolution
|
|
43540
|
-
// directory: /a/b/c/d/e
|
|
43541
|
-
// resolvedFileName: /a/b/foo.d.ts
|
|
43542
|
-
// commonPrefix: /a/b
|
|
43543
|
-
// for failed lookups cache the result for every directory up to root
|
|
43544
|
-
var commonPrefix = resolvedFileName && getCommonPrefix(directory, resolvedFileName, toPath);
|
|
43545
|
-
var current = directory;
|
|
43546
|
-
while (current !== commonPrefix) {
|
|
43547
|
-
var parent = ts.getDirectoryPath(current);
|
|
43548
|
-
if (parent === current)
|
|
43549
|
-
break;
|
|
43550
|
-
if (directoryPathMap.has(parent)) {
|
|
43551
|
-
ancestoryWorker(parent);
|
|
43552
|
-
break;
|
|
43553
|
-
}
|
|
43554
|
-
directoryPathMap.set(parent, result);
|
|
43555
|
-
ancestoryWorker(parent);
|
|
43556
|
-
current = parent;
|
|
43557
|
-
}
|
|
43558
|
-
}
|
|
43559
|
-
ts.moduleNameToDirectorySet = moduleNameToDirectorySet;
|
|
43560
|
-
function createModuleResolutionCache(currentDirectory, getCanonicalFileName, options) {
|
|
43561
|
-
var directoryToModuleNameMap = createCacheWithRedirects(options);
|
|
43562
|
-
var moduleNameToDirectoryMap = createCacheWithRedirects(options);
|
|
43563
|
-
var perDirectoryResolutionCache = createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, directoryToModuleNameMap);
|
|
43346
|
+
function createModuleResolutionCache(currentDirectory, getCanonicalFileName, options, directoryToModuleNameMap, moduleNameToDirectoryMap) {
|
|
43347
|
+
var preDirectoryResolutionCache = createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, directoryToModuleNameMap || (directoryToModuleNameMap = createCacheWithRedirects(options)));
|
|
43348
|
+
moduleNameToDirectoryMap || (moduleNameToDirectoryMap = createCacheWithRedirects(options));
|
|
43564
43349
|
var packageJsonInfoCache = createPackageJsonInfoCache(currentDirectory, getCanonicalFileName);
|
|
43565
|
-
|
|
43566
|
-
return __assign(__assign(__assign({}, packageJsonInfoCache), perDirectoryResolutionCache), { getOrCreateCacheForModuleName: getOrCreateCacheForModuleName, getFromModuleNameCache: getFromModuleNameCache, clear: clear, update: update, getPackageJsonInfoCache: function () { return packageJsonInfoCache; }, setOldResolutionCache: setOldResolutionCache });
|
|
43350
|
+
return __assign(__assign(__assign({}, packageJsonInfoCache), preDirectoryResolutionCache), { getOrCreateCacheForModuleName: getOrCreateCacheForModuleName, clear: clear, update: update, getPackageJsonInfoCache: function () { return packageJsonInfoCache; } });
|
|
43567
43351
|
function clear() {
|
|
43568
|
-
|
|
43569
|
-
perDirectoryResolutionCache.clear();
|
|
43352
|
+
preDirectoryResolutionCache.clear();
|
|
43570
43353
|
moduleNameToDirectoryMap.clear();
|
|
43571
43354
|
packageJsonInfoCache.clear();
|
|
43572
43355
|
}
|
|
43573
43356
|
function update(options) {
|
|
43574
|
-
|
|
43575
|
-
moduleNameToDirectoryMap.update(options);
|
|
43576
|
-
}
|
|
43577
|
-
function setOldResolutionCache(cache) {
|
|
43578
|
-
oldResolutionCache = cache;
|
|
43579
|
-
perDirectoryResolutionCache.setOldResolutionCache(cache);
|
|
43580
|
-
}
|
|
43581
|
-
function getFromModuleNameCache(directoryName, nonRelativeModuleName, mode, redirectedReference) {
|
|
43582
|
-
var _a, _b;
|
|
43583
|
-
ts.Debug.assert(!ts.isExternalModuleNameRelative(nonRelativeModuleName));
|
|
43584
|
-
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);
|
|
43585
|
-
if (result)
|
|
43586
|
-
return result;
|
|
43587
|
-
var fromOld = oldResolutionCache === null || oldResolutionCache === void 0 ? void 0 : oldResolutionCache.getResolved(toPath(directoryName), nonRelativeModuleName, mode, redirectedReference);
|
|
43588
|
-
if (fromOld)
|
|
43589
|
-
getOrCreateCacheForModuleName(nonRelativeModuleName, mode, redirectedReference).set(directoryName, fromOld);
|
|
43590
|
-
return fromOld;
|
|
43357
|
+
updateRedirectsMap(options, directoryToModuleNameMap, moduleNameToDirectoryMap);
|
|
43591
43358
|
}
|
|
43592
43359
|
function getOrCreateCacheForModuleName(nonRelativeModuleName, mode, redirectedReference) {
|
|
43593
43360
|
ts.Debug.assert(!ts.isExternalModuleNameRelative(nonRelativeModuleName));
|
|
43594
|
-
return getOrCreateCache(moduleNameToDirectoryMap, redirectedReference,
|
|
43361
|
+
return getOrCreateCache(moduleNameToDirectoryMap, redirectedReference, mode === undefined ? nonRelativeModuleName : mode + "|" + nonRelativeModuleName, createPerModuleNameCache);
|
|
43595
43362
|
}
|
|
43596
43363
|
function createPerModuleNameCache() {
|
|
43597
43364
|
var directoryPathMap = new ts.Map();
|
|
43598
43365
|
return { get: get, set: set };
|
|
43599
43366
|
function get(directory) {
|
|
43600
|
-
return directoryPathMap.get(toPath(directory));
|
|
43367
|
+
return directoryPathMap.get(ts.toPath(directory, currentDirectory, getCanonicalFileName));
|
|
43601
43368
|
}
|
|
43602
43369
|
/**
|
|
43603
43370
|
* At first this function add entry directory -> module resolution result to the table.
|
|
@@ -43611,17 +43378,57 @@ var ts;
|
|
|
43611
43378
|
* this means that request for module resolution from file in any of these folder will be immediately found in cache.
|
|
43612
43379
|
*/
|
|
43613
43380
|
function set(directory, result) {
|
|
43614
|
-
|
|
43381
|
+
var path = ts.toPath(directory, currentDirectory, getCanonicalFileName);
|
|
43382
|
+
// if entry is already in cache do nothing
|
|
43383
|
+
if (directoryPathMap.has(path)) {
|
|
43384
|
+
return;
|
|
43385
|
+
}
|
|
43386
|
+
directoryPathMap.set(path, result);
|
|
43387
|
+
var resolvedFileName = result.resolvedModule &&
|
|
43388
|
+
(result.resolvedModule.originalPath || result.resolvedModule.resolvedFileName);
|
|
43389
|
+
// find common prefix between directory and resolved file name
|
|
43390
|
+
// this common prefix should be the shortest path that has the same resolution
|
|
43391
|
+
// directory: /a/b/c/d/e
|
|
43392
|
+
// resolvedFileName: /a/b/foo.d.ts
|
|
43393
|
+
// commonPrefix: /a/b
|
|
43394
|
+
// for failed lookups cache the result for every directory up to root
|
|
43395
|
+
var commonPrefix = resolvedFileName && getCommonPrefix(path, resolvedFileName);
|
|
43396
|
+
var current = path;
|
|
43397
|
+
while (current !== commonPrefix) {
|
|
43398
|
+
var parent = ts.getDirectoryPath(current);
|
|
43399
|
+
if (parent === current || directoryPathMap.has(parent)) {
|
|
43400
|
+
break;
|
|
43401
|
+
}
|
|
43402
|
+
directoryPathMap.set(parent, result);
|
|
43403
|
+
current = parent;
|
|
43404
|
+
}
|
|
43405
|
+
}
|
|
43406
|
+
function getCommonPrefix(directory, resolution) {
|
|
43407
|
+
var resolutionDirectory = ts.toPath(ts.getDirectoryPath(resolution), currentDirectory, getCanonicalFileName);
|
|
43408
|
+
// find first position where directory and resolution differs
|
|
43409
|
+
var i = 0;
|
|
43410
|
+
var limit = Math.min(directory.length, resolutionDirectory.length);
|
|
43411
|
+
while (i < limit && directory.charCodeAt(i) === resolutionDirectory.charCodeAt(i)) {
|
|
43412
|
+
i++;
|
|
43413
|
+
}
|
|
43414
|
+
if (i === directory.length && (resolutionDirectory.length === i || resolutionDirectory[i] === ts.directorySeparator)) {
|
|
43415
|
+
return directory;
|
|
43416
|
+
}
|
|
43417
|
+
var rootLength = ts.getRootLength(directory);
|
|
43418
|
+
if (i < rootLength) {
|
|
43419
|
+
return undefined;
|
|
43420
|
+
}
|
|
43421
|
+
var sep = directory.lastIndexOf(ts.directorySeparator, i - 1);
|
|
43422
|
+
if (sep === -1) {
|
|
43423
|
+
return undefined;
|
|
43424
|
+
}
|
|
43425
|
+
return directory.substr(0, Math.max(sep, rootLength));
|
|
43615
43426
|
}
|
|
43616
|
-
}
|
|
43617
|
-
function toPath(fileName) {
|
|
43618
|
-
return ts.toPath(fileName, currentDirectory, getCanonicalFileName);
|
|
43619
43427
|
}
|
|
43620
43428
|
}
|
|
43621
43429
|
ts.createModuleResolutionCache = createModuleResolutionCache;
|
|
43622
|
-
function createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, options, packageJsonInfoCache) {
|
|
43623
|
-
var directoryToModuleNameMap = createCacheWithRedirects(options);
|
|
43624
|
-
var preDirectoryResolutionCache = createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, directoryToModuleNameMap);
|
|
43430
|
+
function createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, options, packageJsonInfoCache, directoryToModuleNameMap) {
|
|
43431
|
+
var preDirectoryResolutionCache = createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, directoryToModuleNameMap || (directoryToModuleNameMap = createCacheWithRedirects(options)));
|
|
43625
43432
|
packageJsonInfoCache || (packageJsonInfoCache = createPackageJsonInfoCache(currentDirectory, getCanonicalFileName));
|
|
43626
43433
|
return __assign(__assign(__assign({}, packageJsonInfoCache), preDirectoryResolutionCache), { clear: clear });
|
|
43627
43434
|
function clear() {
|
|
@@ -43632,7 +43439,10 @@ var ts;
|
|
|
43632
43439
|
ts.createTypeReferenceDirectiveResolutionCache = createTypeReferenceDirectiveResolutionCache;
|
|
43633
43440
|
function resolveModuleNameFromCache(moduleName, containingFile, cache, mode) {
|
|
43634
43441
|
var containingDirectory = ts.getDirectoryPath(containingFile);
|
|
43635
|
-
|
|
43442
|
+
var perFolderCache = cache && cache.getOrCreateCacheForDirectory(containingDirectory);
|
|
43443
|
+
if (!perFolderCache)
|
|
43444
|
+
return undefined;
|
|
43445
|
+
return perFolderCache.get(moduleName, mode);
|
|
43636
43446
|
}
|
|
43637
43447
|
ts.resolveModuleNameFromCache = resolveModuleNameFromCache;
|
|
43638
43448
|
function resolveModuleName(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
@@ -43647,7 +43457,8 @@ var ts;
|
|
|
43647
43457
|
}
|
|
43648
43458
|
}
|
|
43649
43459
|
var containingDirectory = ts.getDirectoryPath(containingFile);
|
|
43650
|
-
var
|
|
43460
|
+
var perFolderCache = cache && cache.getOrCreateCacheForDirectory(containingDirectory, redirectedReference);
|
|
43461
|
+
var result = perFolderCache && perFolderCache.get(moduleName, resolutionMode);
|
|
43651
43462
|
if (result) {
|
|
43652
43463
|
if (traceEnabled) {
|
|
43653
43464
|
trace(host, ts.Diagnostics.Resolution_for_module_0_was_found_in_cache_from_location_1, moduleName, containingDirectory);
|
|
@@ -43699,8 +43510,8 @@ var ts;
|
|
|
43699
43510
|
if (result && result.resolvedModule)
|
|
43700
43511
|
ts.perfLogger.logInfoEvent("Module \"" + moduleName + "\" resolved to \"" + result.resolvedModule.resolvedFileName + "\"");
|
|
43701
43512
|
ts.perfLogger.logStopResolveModule((result && result.resolvedModule) ? "" + result.resolvedModule.resolvedFileName : "null");
|
|
43702
|
-
if (
|
|
43703
|
-
|
|
43513
|
+
if (perFolderCache) {
|
|
43514
|
+
perFolderCache.set(moduleName, resolutionMode, result);
|
|
43704
43515
|
if (!ts.isExternalModuleNameRelative(moduleName)) {
|
|
43705
43516
|
// put result in per-module name cache
|
|
43706
43517
|
cache.getOrCreateCacheForModuleName(moduleName, resolutionMode, redirectedReference).set(containingDirectory, result);
|
|
@@ -43986,10 +43797,10 @@ var ts;
|
|
|
43986
43797
|
features: features,
|
|
43987
43798
|
conditions: conditions,
|
|
43988
43799
|
requestContainingDirectory: containingDirectory,
|
|
43989
|
-
|
|
43800
|
+
reportDiagnostic: function (diag) { return void diagnostics.push(diag); },
|
|
43990
43801
|
};
|
|
43991
43802
|
var result = ts.forEach(extensions, function (ext) { return tryResolve(ext); });
|
|
43992
|
-
return createResolvedModuleWithFailedLookupLocations(
|
|
43803
|
+
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);
|
|
43993
43804
|
function tryResolve(extensions) {
|
|
43994
43805
|
var loader = function (extensions, candidate, onlyRecordFailures, state) { return nodeLoadModuleByRelativeName(extensions, candidate, onlyRecordFailures, state, /*considerPackageJson*/ true); };
|
|
43995
43806
|
var resolved = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loader, state);
|
|
@@ -44366,7 +44177,7 @@ var ts;
|
|
|
44366
44177
|
features: NodeResolutionFeatures.None,
|
|
44367
44178
|
conditions: ts.emptyArray,
|
|
44368
44179
|
requestContainingDirectory: undefined,
|
|
44369
|
-
|
|
44180
|
+
reportDiagnostic: ts.noop
|
|
44370
44181
|
};
|
|
44371
44182
|
}
|
|
44372
44183
|
ts.getTemporaryModuleResolutionState = getTemporaryModuleResolutionState;
|
|
@@ -44413,13 +44224,12 @@ var ts;
|
|
|
44413
44224
|
}
|
|
44414
44225
|
var directoryExists = ts.directoryProbablyExists(packageDirectory, host);
|
|
44415
44226
|
if (directoryExists && host.fileExists(packageJsonPath)) {
|
|
44416
|
-
var
|
|
44417
|
-
var packageJsonContent = ts.readJsonIgnoringErrorsFromText(packageJsonPath, packageJsonText);
|
|
44227
|
+
var packageJsonContent = ts.readJson(packageJsonPath, host);
|
|
44418
44228
|
if (traceEnabled) {
|
|
44419
44229
|
trace(host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath);
|
|
44420
44230
|
}
|
|
44421
44231
|
var versionPaths = readPackageJsonTypesVersionPaths(packageJsonContent, state);
|
|
44422
|
-
var result = { packageDirectory: packageDirectory,
|
|
44232
|
+
var result = { packageDirectory: packageDirectory, packageJsonContent: packageJsonContent, versionPaths: versionPaths, resolvedEntrypoints: undefined };
|
|
44423
44233
|
(_b = state.packageJsonInfoCache) === null || _b === void 0 ? void 0 : _b.setPackageJsonInfo(packageJsonPath, result);
|
|
44424
44234
|
state.affectingLocations.push(packageJsonPath);
|
|
44425
44235
|
return result;
|
|
@@ -44844,8 +44654,12 @@ var ts;
|
|
|
44844
44654
|
fragment = ts.ensureTrailingDirectorySeparator(commonDir_1);
|
|
44845
44655
|
}
|
|
44846
44656
|
}
|
|
44847
|
-
if (commonSourceDirGuesses.length > 1)
|
|
44848
|
-
state.
|
|
44657
|
+
if (commonSourceDirGuesses.length > 1) {
|
|
44658
|
+
state.reportDiagnostic(ts.createCompilerDiagnostic(isImports
|
|
44659
|
+
? 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
|
|
44660
|
+
: 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
|
|
44661
|
+
packagePath));
|
|
44662
|
+
}
|
|
44849
44663
|
for (var _i = 0, commonSourceDirGuesses_1 = commonSourceDirGuesses; _i < commonSourceDirGuesses_1.length; _i++) {
|
|
44850
44664
|
var commonSourceDirGuess = commonSourceDirGuesses_1[_i];
|
|
44851
44665
|
var candidateDirectories = getOutputDirectoriesForBaseDirectory(commonSourceDirGuess);
|
|
@@ -44915,10 +44729,10 @@ var ts;
|
|
|
44915
44729
|
return loadModuleFromNearestNodeModulesDirectoryWorker(Extensions.DtsOnly, moduleName, directory, state, /*typesScopeOnly*/ true, /*cache*/ undefined, /*redirectedReference*/ undefined);
|
|
44916
44730
|
}
|
|
44917
44731
|
function loadModuleFromNearestNodeModulesDirectoryWorker(extensions, moduleName, directory, state, typesScopeOnly, cache, redirectedReference) {
|
|
44918
|
-
var
|
|
44732
|
+
var perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName, state.features === 0 ? undefined : state.features & NodeResolutionFeatures.EsmMode ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS, redirectedReference);
|
|
44919
44733
|
return ts.forEachAncestorDirectory(ts.normalizeSlashes(directory), function (ancestorDirectory) {
|
|
44920
44734
|
if (ts.getBaseFileName(ancestorDirectory) !== "node_modules") {
|
|
44921
|
-
var resolutionFromCache = tryFindNonRelativeModuleNameInCache(
|
|
44735
|
+
var resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache, moduleName, ancestorDirectory, state);
|
|
44922
44736
|
if (resolutionFromCache) {
|
|
44923
44737
|
return resolutionFromCache;
|
|
44924
44738
|
}
|
|
@@ -45070,8 +44884,8 @@ var ts;
|
|
|
45070
44884
|
typesPackageName;
|
|
45071
44885
|
}
|
|
45072
44886
|
ts.unmangleScopedPackageName = unmangleScopedPackageName;
|
|
45073
|
-
function tryFindNonRelativeModuleNameInCache(cache, moduleName,
|
|
45074
|
-
var result = cache
|
|
44887
|
+
function tryFindNonRelativeModuleNameInCache(cache, moduleName, containingDirectory, state) {
|
|
44888
|
+
var result = cache && cache.get(containingDirectory);
|
|
45075
44889
|
if (result) {
|
|
45076
44890
|
if (state.traceEnabled) {
|
|
45077
44891
|
trace(state.host, ts.Diagnostics.Resolution_for_module_0_was_found_in_cache_from_location_1, moduleName, containingDirectory);
|
|
@@ -45096,11 +44910,11 @@ var ts;
|
|
|
45096
44910
|
features: NodeResolutionFeatures.None,
|
|
45097
44911
|
conditions: [],
|
|
45098
44912
|
requestContainingDirectory: containingDirectory,
|
|
45099
|
-
|
|
44913
|
+
reportDiagnostic: function (diag) { return void diagnostics.push(diag); },
|
|
45100
44914
|
};
|
|
45101
44915
|
var resolved = tryResolve(Extensions.TypeScript) || tryResolve(Extensions.JavaScript);
|
|
45102
44916
|
// No originalPath because classic resolution doesn't resolve realPath
|
|
45103
|
-
return createResolvedModuleWithFailedLookupLocations(
|
|
44917
|
+
return createResolvedModuleWithFailedLookupLocations(resolved && resolved.value,
|
|
45104
44918
|
/*isExternalLibraryImport*/ false, failedLookupLocations, affectingLocations, diagnostics, state.resultFromCache);
|
|
45105
44919
|
function tryResolve(extensions) {
|
|
45106
44920
|
var resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFileNoPackageId, state);
|
|
@@ -45108,9 +44922,10 @@ var ts;
|
|
|
45108
44922
|
return { value: resolvedUsingSettings };
|
|
45109
44923
|
}
|
|
45110
44924
|
if (!ts.isExternalModuleNameRelative(moduleName)) {
|
|
44925
|
+
var perModuleNameCache_1 = cache && cache.getOrCreateCacheForModuleName(moduleName, /*mode*/ undefined, redirectedReference);
|
|
45111
44926
|
// Climb up parent directories looking for a module.
|
|
45112
44927
|
var resolved_3 = ts.forEachAncestorDirectory(containingDirectory, function (directory) {
|
|
45113
|
-
var resolutionFromCache = tryFindNonRelativeModuleNameInCache(
|
|
44928
|
+
var resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache_1, moduleName, directory, state);
|
|
45114
44929
|
if (resolutionFromCache) {
|
|
45115
44930
|
return resolutionFromCache;
|
|
45116
44931
|
}
|
|
@@ -45155,10 +44970,10 @@ var ts;
|
|
|
45155
44970
|
features: NodeResolutionFeatures.None,
|
|
45156
44971
|
conditions: [],
|
|
45157
44972
|
requestContainingDirectory: undefined,
|
|
45158
|
-
|
|
44973
|
+
reportDiagnostic: function (diag) { return void diagnostics.push(diag); },
|
|
45159
44974
|
};
|
|
45160
44975
|
var resolved = loadModuleFromImmediateNodeModulesDirectory(Extensions.DtsOnly, moduleName, globalCache, state, /*typesScopeOnly*/ false, /*cache*/ undefined, /*redirectedReference*/ undefined);
|
|
45161
|
-
return createResolvedModuleWithFailedLookupLocations(
|
|
44976
|
+
return createResolvedModuleWithFailedLookupLocations(resolved,
|
|
45162
44977
|
/*isExternalLibraryImport*/ true, failedLookupLocations, affectingLocations, diagnostics, state.resultFromCache);
|
|
45163
44978
|
}
|
|
45164
44979
|
ts.loadModuleFromGlobalCache = loadModuleFromGlobalCache;
|
|
@@ -48844,10 +48659,9 @@ var ts;
|
|
|
48844
48659
|
host.getSourceFiles().forEach(function (sf) {
|
|
48845
48660
|
if (!sf.resolvedModules)
|
|
48846
48661
|
return;
|
|
48847
|
-
sf.resolvedModules.forEach(function (
|
|
48848
|
-
|
|
48849
|
-
|
|
48850
|
-
map.set(resolvedModule.packageId.name, resolvedModule.extension === ".d.ts" /* Dts */ || !!map.get(resolvedModule.packageId.name));
|
|
48662
|
+
sf.resolvedModules.forEach(function (r) {
|
|
48663
|
+
if (r && r.packageId)
|
|
48664
|
+
map.set(r.packageId.name, r.extension === ".d.ts" /* Dts */ || !!map.get(r.packageId.name));
|
|
48851
48665
|
});
|
|
48852
48666
|
});
|
|
48853
48667
|
return map;
|
|
@@ -88302,12 +88116,11 @@ var ts;
|
|
|
88302
88116
|
if (resolvedTypeReferenceDirectives) {
|
|
88303
88117
|
// populate reverse mapping: file path -> type reference directive that was resolved to this file
|
|
88304
88118
|
fileToDirective = new ts.Map();
|
|
88305
|
-
resolvedTypeReferenceDirectives.forEach(function (
|
|
88306
|
-
|
|
88307
|
-
if (!resolvedTypeReferenceDirective || !resolvedTypeReferenceDirective.resolvedFileName) {
|
|
88119
|
+
resolvedTypeReferenceDirectives.forEach(function (resolvedDirective, key, mode) {
|
|
88120
|
+
if (!resolvedDirective || !resolvedDirective.resolvedFileName) {
|
|
88308
88121
|
return;
|
|
88309
88122
|
}
|
|
88310
|
-
var file = host.getSourceFile(
|
|
88123
|
+
var file = host.getSourceFile(resolvedDirective.resolvedFileName);
|
|
88311
88124
|
if (file) {
|
|
88312
88125
|
// Add the transitive closure of path references loaded by this file (as long as they are not)
|
|
88313
88126
|
// part of an existing type reference.
|
|
@@ -111779,7 +111592,7 @@ var ts;
|
|
|
111779
111592
|
var sourceMap = sourceMapGenerator.toString();
|
|
111780
111593
|
ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap, /*writeByteOrderMark*/ false, sourceFiles);
|
|
111781
111594
|
if (printer.bundleFileInfo)
|
|
111782
|
-
printer.bundleFileInfo.mapHash = ts.computeSignature(sourceMap, host);
|
|
111595
|
+
printer.bundleFileInfo.mapHash = ts.computeSignature(sourceMap, ts.maybeBind(host, host.createHash));
|
|
111783
111596
|
}
|
|
111784
111597
|
}
|
|
111785
111598
|
else {
|
|
@@ -111791,7 +111604,7 @@ var ts;
|
|
|
111791
111604
|
// 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
|
|
111792
111605
|
// 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
|
|
111793
111606
|
if (printer.bundleFileInfo)
|
|
111794
|
-
printer.bundleFileInfo.hash = ts.computeSignature(text, host);
|
|
111607
|
+
printer.bundleFileInfo.hash = ts.computeSignature(text, ts.maybeBind(host, host.createHash));
|
|
111795
111608
|
// Reset state
|
|
111796
111609
|
writer.clear();
|
|
111797
111610
|
}
|
|
@@ -111934,6 +111747,7 @@ var ts;
|
|
|
111934
111747
|
}
|
|
111935
111748
|
/*@internal*/
|
|
111936
111749
|
function emitUsingBuildInfo(config, host, getCommandLine, customTransformers) {
|
|
111750
|
+
var createHash = ts.maybeBind(host, host.createHash);
|
|
111937
111751
|
var _a = getOutputPathsForBundle(config.options, /*forceDtsPaths*/ false), buildInfoPath = _a.buildInfoPath, jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath;
|
|
111938
111752
|
var buildInfo;
|
|
111939
111753
|
if (host.getBuildInfo) {
|
|
@@ -111955,25 +111769,25 @@ var ts;
|
|
|
111955
111769
|
if (!jsFileText)
|
|
111956
111770
|
return jsFilePath;
|
|
111957
111771
|
// If the jsFileText is not same has what it was created with, tsbuildinfo is stale so dont use it
|
|
111958
|
-
if (ts.computeSignature(jsFileText,
|
|
111772
|
+
if (ts.computeSignature(jsFileText, createHash) !== buildInfo.bundle.js.hash)
|
|
111959
111773
|
return jsFilePath;
|
|
111960
111774
|
var sourceMapText = sourceMapFilePath && host.readFile(sourceMapFilePath);
|
|
111961
111775
|
// error if no source map or for now if inline sourcemap
|
|
111962
111776
|
if ((sourceMapFilePath && !sourceMapText) || config.options.inlineSourceMap)
|
|
111963
111777
|
return sourceMapFilePath || "inline sourcemap decoding";
|
|
111964
|
-
if (sourceMapFilePath && ts.computeSignature(sourceMapText,
|
|
111778
|
+
if (sourceMapFilePath && ts.computeSignature(sourceMapText, createHash) !== buildInfo.bundle.js.mapHash)
|
|
111965
111779
|
return sourceMapFilePath;
|
|
111966
111780
|
// read declaration text
|
|
111967
111781
|
var declarationText = declarationFilePath && host.readFile(declarationFilePath);
|
|
111968
111782
|
if (declarationFilePath && !declarationText)
|
|
111969
111783
|
return declarationFilePath;
|
|
111970
|
-
if (declarationFilePath && ts.computeSignature(declarationText,
|
|
111784
|
+
if (declarationFilePath && ts.computeSignature(declarationText, createHash) !== buildInfo.bundle.dts.hash)
|
|
111971
111785
|
return declarationFilePath;
|
|
111972
111786
|
var declarationMapText = declarationMapPath && host.readFile(declarationMapPath);
|
|
111973
111787
|
// error if no source map or for now if inline sourcemap
|
|
111974
111788
|
if ((declarationMapPath && !declarationMapText) || config.options.inlineSourceMap)
|
|
111975
111789
|
return declarationMapPath || "inline sourcemap decoding";
|
|
111976
|
-
if (declarationMapPath && ts.computeSignature(declarationMapText,
|
|
111790
|
+
if (declarationMapPath && ts.computeSignature(declarationMapText, createHash) !== buildInfo.bundle.dts.mapHash)
|
|
111977
111791
|
return declarationMapPath;
|
|
111978
111792
|
var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
|
|
111979
111793
|
var ownPrependInput = ts.createInputFiles(jsFileText, declarationText, sourceMapFilePath, sourceMapText, declarationMapPath, declarationMapText, jsFilePath, declarationFilePath, buildInfoPath, buildInfo,
|
|
@@ -112013,7 +111827,7 @@ var ts;
|
|
|
112013
111827
|
newBuildInfo.program = buildInfo.program;
|
|
112014
111828
|
if (newBuildInfo.program && changedDtsText !== undefined && config.options.composite) {
|
|
112015
111829
|
// Update the output signature
|
|
112016
|
-
newBuildInfo.program.outSignature = ts.computeSignature(changedDtsText,
|
|
111830
|
+
newBuildInfo.program.outSignature = ts.computeSignature(changedDtsText, createHash, changedDtsData);
|
|
112017
111831
|
}
|
|
112018
111832
|
// Update sourceFileInfo
|
|
112019
111833
|
var _a = buildInfo.bundle, js = _a.js, dts = _a.dts, sourceFiles = _a.sourceFiles;
|
|
@@ -112047,7 +111861,7 @@ var ts;
|
|
|
112047
111861
|
getSourceFileFromReference: ts.returnUndefined,
|
|
112048
111862
|
redirectTargetsMap: ts.createMultiMap(),
|
|
112049
111863
|
getFileIncludeReasons: ts.notImplemented,
|
|
112050
|
-
createHash:
|
|
111864
|
+
createHash: createHash,
|
|
112051
111865
|
};
|
|
112052
111866
|
emitFiles(ts.notImplementedResolver, emitHost,
|
|
112053
111867
|
/*targetSourceFile*/ undefined, ts.getTransformers(config.options, customTransformers));
|
|
@@ -117524,7 +117338,7 @@ var ts;
|
|
|
117524
117338
|
var result = void 0;
|
|
117525
117339
|
var mode = getModeForFileReference(name, containingFileMode);
|
|
117526
117340
|
// We lower-case all type references because npm automatically lowercases all packages. See GH#9824.
|
|
117527
|
-
var strName = ts.isString(name) ? name :
|
|
117341
|
+
var strName = ts.isString(name) ? name : name.fileName.toLowerCase();
|
|
117528
117342
|
var cacheKey = mode !== undefined ? mode + "|" + strName : strName;
|
|
117529
117343
|
if (cache.has(cacheKey)) {
|
|
117530
117344
|
result = cache.get(cacheKey);
|
|
@@ -117628,22 +117442,8 @@ var ts;
|
|
|
117628
117442
|
return elem.value.text === "import" ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS;
|
|
117629
117443
|
}
|
|
117630
117444
|
ts.getResolutionModeOverrideForClause = getResolutionModeOverrideForClause;
|
|
117631
|
-
var emptyResolution = {
|
|
117632
|
-
resolvedModule: undefined,
|
|
117633
|
-
resolvedTypeReferenceDirective: undefined,
|
|
117634
|
-
failedLookupLocations: [],
|
|
117635
|
-
affectingLocations: [],
|
|
117636
|
-
resolutionDiagnostics: [],
|
|
117637
|
-
};
|
|
117638
|
-
function isResolvedModuleWithFailedLookupLocation(resolved) {
|
|
117639
|
-
return !!resolved && !!resolved.failedLookupLocations;
|
|
117640
|
-
}
|
|
117641
|
-
function isResolvedTypeReferenceDirectiveWithFailedLookupLocations(resolved) {
|
|
117642
|
-
return !!resolved && !!resolved.failedLookupLocations;
|
|
117643
|
-
}
|
|
117644
117445
|
/* @internal */
|
|
117645
|
-
function loadWithModeAwareCache(names, containingFile, containingFileName, redirectedReference,
|
|
117646
|
-
var _a;
|
|
117446
|
+
function loadWithModeAwareCache(names, containingFile, containingFileName, redirectedReference, loader) {
|
|
117647
117447
|
if (names.length === 0) {
|
|
117648
117448
|
return [];
|
|
117649
117449
|
}
|
|
@@ -117653,7 +117453,7 @@ var ts;
|
|
|
117653
117453
|
for (var _i = 0, names_3 = names; _i < names_3.length; _i++) {
|
|
117654
117454
|
var name = names_3[_i];
|
|
117655
117455
|
var result = void 0;
|
|
117656
|
-
var mode = getModeForResolutionAtIndex(containingFile,
|
|
117456
|
+
var mode = getModeForResolutionAtIndex(containingFile, i);
|
|
117657
117457
|
i++;
|
|
117658
117458
|
var cacheKey = mode !== undefined ? mode + "|" + name : name;
|
|
117659
117459
|
if (cache.has(cacheKey)) {
|
|
@@ -117718,14 +117518,14 @@ var ts;
|
|
|
117718
117518
|
/*@internal*/
|
|
117719
117519
|
function getReferencedFileLocation(getSourceFileByPath, ref) {
|
|
117720
117520
|
var _a, _b, _c;
|
|
117721
|
-
var _d, _e, _f, _g
|
|
117521
|
+
var _d, _e, _f, _g;
|
|
117722
117522
|
var file = ts.Debug.checkDefined(getSourceFileByPath(ref.file));
|
|
117723
117523
|
var kind = ref.kind, index = ref.index;
|
|
117724
117524
|
var pos, end, packageId, resolutionMode;
|
|
117725
117525
|
switch (kind) {
|
|
117726
117526
|
case ts.FileIncludeKind.Import:
|
|
117727
117527
|
var importLiteral = getModuleNameStringLiteralAt(file, index);
|
|
117728
|
-
packageId = (
|
|
117528
|
+
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;
|
|
117729
117529
|
if (importLiteral.pos === -1)
|
|
117730
117530
|
return { file: file, packageId: packageId, text: importLiteral.text };
|
|
117731
117531
|
pos = ts.skipTrivia(file.text, importLiteral.pos);
|
|
@@ -117736,7 +117536,7 @@ var ts;
|
|
|
117736
117536
|
break;
|
|
117737
117537
|
case ts.FileIncludeKind.TypeReferenceDirective:
|
|
117738
117538
|
(_b = file.typeReferenceDirectives[index], pos = _b.pos, end = _b.end, resolutionMode = _b.resolutionMode);
|
|
117739
|
-
packageId = (
|
|
117539
|
+
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;
|
|
117740
117540
|
break;
|
|
117741
117541
|
case ts.FileIncludeKind.LibReferenceDirective:
|
|
117742
117542
|
(_c = file.libReferenceDirectives[index], pos = _c.pos, end = _c.end);
|
|
@@ -117966,10 +117766,10 @@ var ts;
|
|
|
117966
117766
|
};
|
|
117967
117767
|
}
|
|
117968
117768
|
function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) {
|
|
117969
|
-
var _a, _b, _c, _d
|
|
117769
|
+
var _a, _b, _c, _d;
|
|
117970
117770
|
var createProgramOptions = ts.isArray(rootNamesOrOptions) ? createCreateProgramOptions(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) : rootNamesOrOptions; // TODO: GH#18217
|
|
117971
117771
|
var rootNames = createProgramOptions.rootNames, options = createProgramOptions.options, configFileParsingDiagnostics = createProgramOptions.configFileParsingDiagnostics, projectReferences = createProgramOptions.projectReferences;
|
|
117972
|
-
var
|
|
117772
|
+
var oldProgram = createProgramOptions.oldProgram;
|
|
117973
117773
|
var processingDefaultLibFiles;
|
|
117974
117774
|
var processingOtherFiles;
|
|
117975
117775
|
var files;
|
|
@@ -117983,8 +117783,6 @@ var ts;
|
|
|
117983
117783
|
var cachedDeclarationDiagnosticsForFile = {};
|
|
117984
117784
|
var resolvedTypeReferenceDirectives = ts.createModeAwareCache();
|
|
117985
117785
|
var fileProcessingDiagnostics;
|
|
117986
|
-
var automaticTypeDirectiveNames;
|
|
117987
|
-
var automaticTypeDirectiveResolutions;
|
|
117988
117786
|
// The below settings are to track if a .js file should be add to the program if loaded via searching under node_modules.
|
|
117989
117787
|
// This works as imported modules are discovered recursively in a depth first manner, specifically:
|
|
117990
117788
|
// - For each root file, findSourceFile is called.
|
|
@@ -118006,11 +117804,6 @@ var ts;
|
|
|
118006
117804
|
var skipDefaultLib = options.noLib;
|
|
118007
117805
|
var getDefaultLibraryFileName = ts.memoize(function () { return host.getDefaultLibFileName(options); });
|
|
118008
117806
|
var defaultLibraryPath = host.getDefaultLibLocation ? host.getDefaultLibLocation() : ts.getDirectoryPath(getDefaultLibraryFileName());
|
|
118009
|
-
/**
|
|
118010
|
-
* Diagnostics for the program
|
|
118011
|
-
* Only add diagnostics directly if it always would be done irrespective of program structure reuse.
|
|
118012
|
-
* Otherwise fileProcessingDiagnostics is correct locations so that the diagnostics can be reported in all structure use scenarios
|
|
118013
|
-
*/
|
|
118014
117807
|
var programDiagnostics = ts.createDiagnosticCollection();
|
|
118015
117808
|
var currentDirectory = host.getCurrentDirectory();
|
|
118016
117809
|
var supportedExtensions = ts.getSupportedExtensions(options);
|
|
@@ -118023,71 +117816,30 @@ var ts;
|
|
|
118023
117816
|
var actualResolveModuleNamesWorker;
|
|
118024
117817
|
var hasInvalidatedResolution = host.hasInvalidatedResolution || ts.returnFalse;
|
|
118025
117818
|
if (host.resolveModuleNames) {
|
|
118026
|
-
actualResolveModuleNamesWorker = function (moduleNames, containingFile, containingFileName, redirectedReference,
|
|
118027
|
-
|
|
118028
|
-
|
|
118029
|
-
|
|
118030
|
-
|
|
118031
|
-
|
|
118032
|
-
|
|
118033
|
-
|
|
118034
|
-
|
|
118035
|
-
resolved.extension !== undefined ?
|
|
118036
|
-
// An older host may have omitted extension, in which case we should infer it from the file extension of resolvedFileName.
|
|
118037
|
-
{ resolvedModule: resolved, failedLookupLocations: emptyResolution.failedLookupLocations } :
|
|
118038
|
-
{ resolvedModule: __assign(__assign({}, resolved), { extension: ts.extensionFromPath(resolved.resolvedFileName) }), failedLookupLocations: emptyResolution.failedLookupLocations } :
|
|
118039
|
-
emptyResolution; });
|
|
118040
|
-
};
|
|
117819
|
+
actualResolveModuleNamesWorker = function (moduleNames, containingFile, containingFileName, reusedNames, redirectedReference) { return host.resolveModuleNames(ts.Debug.checkEachDefined(moduleNames), containingFileName, reusedNames, redirectedReference, options, containingFile).map(function (resolved) {
|
|
117820
|
+
// An older host may have omitted extension, in which case we should infer it from the file extension of resolvedFileName.
|
|
117821
|
+
if (!resolved || resolved.extension !== undefined) {
|
|
117822
|
+
return resolved;
|
|
117823
|
+
}
|
|
117824
|
+
var withExtension = ts.clone(resolved);
|
|
117825
|
+
withExtension.extension = ts.extensionFromPath(resolved.resolvedFileName);
|
|
117826
|
+
return withExtension;
|
|
117827
|
+
}); };
|
|
118041
117828
|
moduleResolutionCache = (_a = host.getModuleResolutionCache) === null || _a === void 0 ? void 0 : _a.call(host);
|
|
118042
117829
|
}
|
|
118043
117830
|
else {
|
|
118044
117831
|
moduleResolutionCache = ts.createModuleResolutionCache(currentDirectory, getCanonicalFileName, options);
|
|
118045
|
-
var loader_1 = function (moduleName, resolverMode, containingFileName, redirectedReference) { return ts.resolveModuleName(moduleName, containingFileName, options, host, moduleResolutionCache, redirectedReference, resolverMode); };
|
|
118046
|
-
actualResolveModuleNamesWorker = function (moduleNames, containingFile, containingFileName, redirectedReference,
|
|
118047
|
-
return loadWithModeAwareCache(moduleNames, containingFile, containingFileName, redirectedReference, partialResolutionInfo, loader_1);
|
|
118048
|
-
};
|
|
117832
|
+
var loader_1 = function (moduleName, resolverMode, containingFileName, redirectedReference) { return ts.resolveModuleName(moduleName, containingFileName, options, host, moduleResolutionCache, redirectedReference, resolverMode).resolvedModule; }; // TODO: GH#18217
|
|
117833
|
+
actualResolveModuleNamesWorker = function (moduleNames, containingFile, containingFileName, _reusedNames, redirectedReference) { return loadWithModeAwareCache(ts.Debug.checkEachDefined(moduleNames), containingFile, containingFileName, redirectedReference, loader_1); };
|
|
118049
117834
|
}
|
|
118050
117835
|
var actualResolveTypeReferenceDirectiveNamesWorker;
|
|
118051
117836
|
if (host.resolveTypeReferenceDirectives) {
|
|
118052
|
-
actualResolveTypeReferenceDirectiveNamesWorker = function (typeDirectiveNames, containingFile, redirectedReference, containingFileMode,
|
|
118053
|
-
var result = host.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference, options, containingFileMode, partialResolutionInfo);
|
|
118054
|
-
return result.some(isResolvedTypeReferenceDirectiveWithFailedLookupLocations) ?
|
|
118055
|
-
result :
|
|
118056
|
-
result.map(function (resolved) { return resolved ?
|
|
118057
|
-
{ resolvedTypeReferenceDirective: resolved, failedLookupLocations: emptyResolution.failedLookupLocations } :
|
|
118058
|
-
emptyResolution; });
|
|
118059
|
-
};
|
|
118060
|
-
typeReferenceDirectiveResolutionCache = (_b = host.getTypeReferenceDirectiveResolutionCache) === null || _b === void 0 ? void 0 : _b.call(host);
|
|
117837
|
+
actualResolveTypeReferenceDirectiveNamesWorker = function (typeDirectiveNames, containingFile, redirectedReference, containingFileMode) { return host.resolveTypeReferenceDirectives(ts.Debug.checkEachDefined(typeDirectiveNames), containingFile, redirectedReference, options, containingFileMode); };
|
|
118061
117838
|
}
|
|
118062
117839
|
else {
|
|
118063
117840
|
typeReferenceDirectiveResolutionCache = ts.createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, /*options*/ undefined, moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache());
|
|
118064
|
-
var loader_2 = function (typesRef, containingFile, redirectedReference, resolutionMode) { return ts.resolveTypeReferenceDirective(typesRef, containingFile, options, host, redirectedReference, typeReferenceDirectiveResolutionCache, resolutionMode); };
|
|
118065
|
-
actualResolveTypeReferenceDirectiveNamesWorker = function (typeReferenceDirectiveNames, containingFile, redirectedReference, containingFileMode) {
|
|
118066
|
-
return loadWithTypeDirectiveCache(typeReferenceDirectiveNames, containingFile, redirectedReference, containingFileMode, loader_2);
|
|
118067
|
-
};
|
|
118068
|
-
}
|
|
118069
|
-
var oldProgram = typeof oldProgramOrOldBuildInfoProgramConstructor === "object" ? oldProgramOrOldBuildInfoProgramConstructor : undefined;
|
|
118070
|
-
var oldBuildInfoProgram;
|
|
118071
|
-
if (!oldProgram && typeof oldProgramOrOldBuildInfoProgramConstructor === "function") {
|
|
118072
|
-
var state_11 = ts.getTemporaryModuleResolutionState(moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache(), host, options);
|
|
118073
|
-
oldBuildInfoProgram = oldProgramOrOldBuildInfoProgramConstructor({
|
|
118074
|
-
fileExists: function (fileName) { return host.fileExists(fileName); },
|
|
118075
|
-
createHash: ts.maybeBind(host, host.createHash),
|
|
118076
|
-
getPackageJsonInfo: function (fileName) { return ts.getPackageJsonInfo(ts.getDirectoryPath(fileName), /*onlyRecordFailures*/ false, state_11); },
|
|
118077
|
-
});
|
|
118078
|
-
if (oldBuildInfoProgram) {
|
|
118079
|
-
// Ensure redirected references are verified before using existing cache
|
|
118080
|
-
moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.setOldResolutionCache({
|
|
118081
|
-
getResolved: function (dirPath, name, mode, redirectedReference) {
|
|
118082
|
-
return oldBuildInfoProgram === null || oldBuildInfoProgram === void 0 ? void 0 : oldBuildInfoProgram.getResolvedModule(dirPath, name, mode, redirectedReference);
|
|
118083
|
-
}
|
|
118084
|
-
});
|
|
118085
|
-
typeReferenceDirectiveResolutionCache === null || typeReferenceDirectiveResolutionCache === void 0 ? void 0 : typeReferenceDirectiveResolutionCache.setOldResolutionCache({
|
|
118086
|
-
getResolved: function (dirPath, name, mode, redirectedReference) {
|
|
118087
|
-
return oldBuildInfoProgram === null || oldBuildInfoProgram === void 0 ? void 0 : oldBuildInfoProgram.getResolvedTypeReferenceDirective(dirPath, name, mode, redirectedReference);
|
|
118088
|
-
}
|
|
118089
|
-
});
|
|
118090
|
-
}
|
|
117841
|
+
var loader_2 = function (typesRef, containingFile, redirectedReference, resolutionMode) { return ts.resolveTypeReferenceDirective(typesRef, containingFile, options, host, redirectedReference, typeReferenceDirectiveResolutionCache, resolutionMode).resolvedTypeReferenceDirective; }; // TODO: GH#18217
|
|
117842
|
+
actualResolveTypeReferenceDirectiveNamesWorker = function (typeReferenceDirectiveNames, containingFile, redirectedReference, containingFileMode) { return loadWithTypeDirectiveCache(ts.Debug.checkEachDefined(typeReferenceDirectiveNames), containingFile, redirectedReference, containingFileMode, loader_2); };
|
|
118091
117843
|
}
|
|
118092
117844
|
// Map from a stringified PackageId to the source file with that id.
|
|
118093
117845
|
// Only one source file may have a given packageId. Others become redirects (see createRedirectSourceFile).
|
|
@@ -118114,9 +117866,9 @@ var ts;
|
|
|
118114
117866
|
var projectReferenceRedirects;
|
|
118115
117867
|
var mapFromFileToProjectReferenceRedirects;
|
|
118116
117868
|
var mapFromToProjectReferenceRedirectSource;
|
|
118117
|
-
var useSourceOfProjectReferenceRedirect = !!((
|
|
117869
|
+
var useSourceOfProjectReferenceRedirect = !!((_b = host.useSourceOfProjectReferenceRedirect) === null || _b === void 0 ? void 0 : _b.call(host)) &&
|
|
118118
117870
|
!options.disableSourceOfProjectReferenceRedirect;
|
|
118119
|
-
var
|
|
117871
|
+
var _e = updateHostForUseSourceOfProjectReferenceRedirect({
|
|
118120
117872
|
compilerHost: host,
|
|
118121
117873
|
getSymlinkCache: getSymlinkCache,
|
|
118122
117874
|
useSourceOfProjectReferenceRedirect: useSourceOfProjectReferenceRedirect,
|
|
@@ -118124,7 +117876,7 @@ var ts;
|
|
|
118124
117876
|
getResolvedProjectReferences: getResolvedProjectReferences,
|
|
118125
117877
|
getSourceOfProjectReferenceRedirect: getSourceOfProjectReferenceRedirect,
|
|
118126
117878
|
forEachResolvedProjectReference: forEachResolvedProjectReference
|
|
118127
|
-
}), onProgramCreateComplete =
|
|
117879
|
+
}), onProgramCreateComplete = _e.onProgramCreateComplete, fileExists = _e.fileExists, directoryExists = _e.directoryExists;
|
|
118128
117880
|
var readFile = host.readFile.bind(host);
|
|
118129
117881
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program" /* Program */, "shouldProgramCreateNewSourceFiles", { hasOldProgram: !!oldProgram });
|
|
118130
117882
|
var shouldCreateNewSourceFile = shouldProgramCreateNewSourceFiles(oldProgram, options);
|
|
@@ -118135,7 +117887,7 @@ var ts;
|
|
|
118135
117887
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program" /* Program */, "tryReuseStructureFromOldProgram", {});
|
|
118136
117888
|
structureIsReused = tryReuseStructureFromOldProgram(); // eslint-disable-line prefer-const
|
|
118137
117889
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
118138
|
-
if (structureIsReused !==
|
|
117890
|
+
if (structureIsReused !== 2 /* Completely */) {
|
|
118139
117891
|
processingDefaultLibFiles = [];
|
|
118140
117892
|
processingOtherFiles = [];
|
|
118141
117893
|
if (projectReferences) {
|
|
@@ -118176,15 +117928,16 @@ var ts;
|
|
|
118176
117928
|
ts.forEach(rootNames, function (name, index) { return processRootFile(name, /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false, { kind: ts.FileIncludeKind.RootFile, index: index }); });
|
|
118177
117929
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
118178
117930
|
// load type declarations specified via 'types' argument or implicitly from types/ and node_modules/@types folders
|
|
118179
|
-
|
|
118180
|
-
|
|
118181
|
-
|
|
118182
|
-
|
|
118183
|
-
var
|
|
118184
|
-
|
|
117931
|
+
var typeReferences = rootNames.length ? ts.getAutomaticTypeDirectiveNames(options, host) : ts.emptyArray;
|
|
117932
|
+
if (typeReferences.length) {
|
|
117933
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program" /* Program */, "processTypeReferences", { count: typeReferences.length });
|
|
117934
|
+
// This containingFilename needs to match with the one used in managed-side
|
|
117935
|
+
var containingDirectory = options.configFilePath ? ts.getDirectoryPath(options.configFilePath) : host.getCurrentDirectory();
|
|
117936
|
+
var containingFilename = ts.combinePaths(containingDirectory, ts.inferredTypesContainingFile);
|
|
117937
|
+
var resolutions = resolveTypeReferenceDirectiveNamesWorker(typeReferences, containingFilename);
|
|
117938
|
+
for (var i = 0; i < typeReferences.length; i++) {
|
|
118185
117939
|
// under node16/nodenext module resolution, load `types`/ata include names as cjs resolution results by passing an `undefined` mode
|
|
118186
|
-
|
|
118187
|
-
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 });
|
|
117940
|
+
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 });
|
|
118188
117941
|
}
|
|
118189
117942
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
118190
117943
|
}
|
|
@@ -118224,13 +117977,13 @@ var ts;
|
|
|
118224
117977
|
if (shouldCreateNewSourceFile || !newFile ||
|
|
118225
117978
|
// old file wasn't redirect but new file is
|
|
118226
117979
|
(oldSourceFile.resolvedPath === oldSourceFile.path && newFile.resolvedPath !== oldSourceFile.path)) {
|
|
118227
|
-
host.onReleaseOldSourceFile(oldSourceFile, oldProgram.getCompilerOptions());
|
|
117980
|
+
host.onReleaseOldSourceFile(oldSourceFile, oldProgram.getCompilerOptions(), !!getSourceFileByPath(oldSourceFile.path));
|
|
118228
117981
|
}
|
|
118229
117982
|
}
|
|
118230
117983
|
if (!host.getParsedCommandLine) {
|
|
118231
117984
|
oldProgram.forEachResolvedProjectReference(function (resolvedProjectReference) {
|
|
118232
117985
|
if (!getResolvedProjectReferenceByPath(resolvedProjectReference.sourceFile.path)) {
|
|
118233
|
-
host.onReleaseOldSourceFile(resolvedProjectReference.sourceFile, oldProgram.getCompilerOptions());
|
|
117986
|
+
host.onReleaseOldSourceFile(resolvedProjectReference.sourceFile, oldProgram.getCompilerOptions(), /*hasSourceFileByPath*/ false);
|
|
118234
117987
|
}
|
|
118235
117988
|
});
|
|
118236
117989
|
}
|
|
@@ -118248,8 +118001,6 @@ var ts;
|
|
|
118248
118001
|
typeReferenceDirectiveResolutionCache = undefined;
|
|
118249
118002
|
// unconditionally set oldProgram to undefined to prevent it from being captured in closure
|
|
118250
118003
|
oldProgram = undefined;
|
|
118251
|
-
oldBuildInfoProgram = undefined;
|
|
118252
|
-
oldProgramOrOldBuildInfoProgramConstructor = undefined;
|
|
118253
118004
|
var program = {
|
|
118254
118005
|
getRootFileNames: function () { return rootNames; },
|
|
118255
118006
|
getSourceFile: getSourceFile,
|
|
@@ -118257,7 +118008,6 @@ var ts;
|
|
|
118257
118008
|
getSourceFiles: function () { return files; },
|
|
118258
118009
|
getMissingFilePaths: function () { return missingFilePaths; },
|
|
118259
118010
|
getModuleResolutionCache: function () { return moduleResolutionCache; },
|
|
118260
|
-
getTypeReferenceDirectiveResolutionCache: function () { return typeReferenceDirectiveResolutionCache; },
|
|
118261
118011
|
getFilesByNameMap: function () { return filesByName; },
|
|
118262
118012
|
getCompilerOptions: function () { return options; },
|
|
118263
118013
|
getSyntacticDiagnostics: getSyntacticDiagnostics,
|
|
@@ -118282,9 +118032,6 @@ var ts;
|
|
|
118282
118032
|
getRelationCacheSizes: function () { return getTypeChecker().getRelationCacheSizes(); },
|
|
118283
118033
|
getFileProcessingDiagnostics: function () { return fileProcessingDiagnostics; },
|
|
118284
118034
|
getResolvedTypeReferenceDirectives: function () { return resolvedTypeReferenceDirectives; },
|
|
118285
|
-
getAutomaticTypeDirectiveNames: function () { return automaticTypeDirectiveNames; },
|
|
118286
|
-
getAutomaticTypeDirectiveResolutions: function () { return automaticTypeDirectiveResolutions; },
|
|
118287
|
-
getAutomaticTypeDirectiveContainingFile: getAutomaticTypeDirectiveContainingFile,
|
|
118288
118035
|
isSourceFileFromExternalLibrary: isSourceFileFromExternalLibrary,
|
|
118289
118036
|
isSourceFileDefaultLibrary: isSourceFileDefaultLibrary,
|
|
118290
118037
|
getSourceFileFromReference: getSourceFileFromReference,
|
|
@@ -118294,12 +118041,12 @@ var ts;
|
|
|
118294
118041
|
usesUriStyleNodeCoreModules: usesUriStyleNodeCoreModules,
|
|
118295
118042
|
isEmittedFile: isEmittedFile,
|
|
118296
118043
|
getConfigFileParsingDiagnostics: getConfigFileParsingDiagnostics,
|
|
118044
|
+
getResolvedModuleWithFailedLookupLocationsFromCache: getResolvedModuleWithFailedLookupLocationsFromCache,
|
|
118297
118045
|
getProjectReferences: getProjectReferences,
|
|
118298
118046
|
getResolvedProjectReferences: getResolvedProjectReferences,
|
|
118299
118047
|
getProjectReferenceRedirect: getProjectReferenceRedirect,
|
|
118300
118048
|
getResolvedProjectReferenceToRedirect: getResolvedProjectReferenceToRedirect,
|
|
118301
118049
|
getResolvedProjectReferenceByPath: getResolvedProjectReferenceByPath,
|
|
118302
|
-
getRedirectReferenceForResolution: getRedirectReferenceForResolution,
|
|
118303
118050
|
forEachResolvedProjectReference: forEachResolvedProjectReference,
|
|
118304
118051
|
isSourceOfProjectReferenceRedirect: isSourceOfProjectReferenceRedirect,
|
|
118305
118052
|
emitBuildInfo: emitBuildInfo,
|
|
@@ -118307,7 +118054,7 @@ var ts;
|
|
|
118307
118054
|
readFile: readFile,
|
|
118308
118055
|
directoryExists: directoryExists,
|
|
118309
118056
|
getSymlinkCache: getSymlinkCache,
|
|
118310
|
-
realpath: (
|
|
118057
|
+
realpath: (_d = host.realpath) === null || _d === void 0 ? void 0 : _d.bind(host),
|
|
118311
118058
|
useCaseSensitiveFileNames: function () { return host.useCaseSensitiveFileNames(); },
|
|
118312
118059
|
getFileIncludeReasons: function () { return fileReasons; },
|
|
118313
118060
|
structureIsReused: structureIsReused,
|
|
@@ -118322,8 +118069,6 @@ var ts;
|
|
|
118322
118069
|
case 0 /* FilePreprocessingReferencedDiagnostic */:
|
|
118323
118070
|
var _a = getReferencedFileLocation(getSourceFileByPath, diagnostic.reason), file = _a.file, pos = _a.pos, end = _a.end;
|
|
118324
118071
|
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)));
|
|
118325
|
-
case 2 /* ResolutionDiagnostics */:
|
|
118326
|
-
return diagnostic.diagnostics.forEach(function (d) { return programDiagnostics.add(d); });
|
|
118327
118072
|
default:
|
|
118328
118073
|
ts.Debug.assertNever(diagnostic);
|
|
118329
118074
|
}
|
|
@@ -118333,46 +118078,63 @@ var ts;
|
|
|
118333
118078
|
ts.performance.measure("Program", "beforeProgram", "afterProgram");
|
|
118334
118079
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
118335
118080
|
return program;
|
|
118336
|
-
function
|
|
118337
|
-
|
|
118338
|
-
|
|
118339
|
-
|
|
118081
|
+
function addResolutionDiagnostics(list) {
|
|
118082
|
+
if (!list)
|
|
118083
|
+
return;
|
|
118084
|
+
for (var _i = 0, list_3 = list; _i < list_3.length; _i++) {
|
|
118085
|
+
var elem = list_3[_i];
|
|
118086
|
+
programDiagnostics.add(elem);
|
|
118087
|
+
}
|
|
118340
118088
|
}
|
|
118341
|
-
function
|
|
118342
|
-
|
|
118089
|
+
function pullDiagnosticsFromCache(names, containingFile) {
|
|
118090
|
+
var _a;
|
|
118091
|
+
if (!moduleResolutionCache)
|
|
118343
118092
|
return;
|
|
118344
|
-
|
|
118345
|
-
|
|
118346
|
-
|
|
118347
|
-
|
|
118348
|
-
|
|
118349
|
-
|
|
118350
|
-
|
|
118093
|
+
var containingFileName = ts.getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory);
|
|
118094
|
+
var containingFileMode = !ts.isString(containingFile) ? containingFile.impliedNodeFormat : undefined;
|
|
118095
|
+
var containingDir = ts.getDirectoryPath(containingFileName);
|
|
118096
|
+
var redirectedReference = getRedirectReferenceForResolution(containingFile);
|
|
118097
|
+
var i = 0;
|
|
118098
|
+
for (var _i = 0, names_4 = names; _i < names_4.length; _i++) {
|
|
118099
|
+
var n = names_4[_i];
|
|
118100
|
+
// 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
|
|
118101
|
+
var mode = typeof n === "string" ? getModeForResolutionAtIndex(containingFile, i) : getModeForFileReference(n, containingFileMode);
|
|
118102
|
+
var name = typeof n === "string" ? n : n.fileName;
|
|
118103
|
+
i++;
|
|
118104
|
+
// only nonrelative names hit the cache, and, at least as of right now, only nonrelative names can issue diagnostics
|
|
118105
|
+
// (Since diagnostics are only issued via import or export map lookup)
|
|
118106
|
+
// This may totally change if/when the issue of output paths not mapping to input files is fixed in a broader context
|
|
118107
|
+
// When it is, how we extract diagnostics from the module name resolver will have the be refined - the current cache
|
|
118108
|
+
// APIs wrapping the underlying resolver make it almost impossible to smuggle the diagnostics out in a generalized way
|
|
118109
|
+
if (ts.isExternalModuleNameRelative(name))
|
|
118110
|
+
continue;
|
|
118111
|
+
var diags = (_a = moduleResolutionCache.getOrCreateCacheForModuleName(name, mode, redirectedReference).get(containingDir)) === null || _a === void 0 ? void 0 : _a.resolutionDiagnostics;
|
|
118112
|
+
addResolutionDiagnostics(diags);
|
|
118113
|
+
}
|
|
118351
118114
|
}
|
|
118352
|
-
function resolveModuleNamesWorker(moduleNames, containingFile,
|
|
118115
|
+
function resolveModuleNamesWorker(moduleNames, containingFile, reusedNames) {
|
|
118353
118116
|
if (!moduleNames.length)
|
|
118354
118117
|
return ts.emptyArray;
|
|
118355
118118
|
var containingFileName = ts.getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory);
|
|
118356
|
-
|
|
118357
|
-
redirectedReference = getRedirectReferenceForResolution(containingFile);
|
|
118119
|
+
var redirectedReference = getRedirectReferenceForResolution(containingFile);
|
|
118358
118120
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program" /* Program */, "resolveModuleNamesWorker", { containingFileName: containingFileName });
|
|
118359
118121
|
ts.performance.mark("beforeResolveModule");
|
|
118360
|
-
var result = actualResolveModuleNamesWorker(moduleNames, containingFile, containingFileName,
|
|
118122
|
+
var result = actualResolveModuleNamesWorker(moduleNames, containingFile, containingFileName, reusedNames, redirectedReference);
|
|
118361
118123
|
ts.performance.mark("afterResolveModule");
|
|
118362
118124
|
ts.performance.measure("ResolveModule", "beforeResolveModule", "afterResolveModule");
|
|
118363
118125
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
118126
|
+
pullDiagnosticsFromCache(moduleNames, containingFile);
|
|
118364
118127
|
return result;
|
|
118365
118128
|
}
|
|
118366
|
-
function resolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFile
|
|
118129
|
+
function resolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFile) {
|
|
118367
118130
|
if (!typeDirectiveNames.length)
|
|
118368
118131
|
return [];
|
|
118369
118132
|
var containingFileName = !ts.isString(containingFile) ? ts.getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory) : containingFile;
|
|
118370
|
-
|
|
118371
|
-
redirectedReference = getRedirectReferenceForResolution(containingFile);
|
|
118133
|
+
var redirectedReference = !ts.isString(containingFile) ? getRedirectReferenceForResolution(containingFile) : undefined;
|
|
118372
118134
|
var containingFileMode = !ts.isString(containingFile) ? containingFile.impliedNodeFormat : undefined;
|
|
118373
118135
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program" /* Program */, "resolveTypeReferenceDirectiveNamesWorker", { containingFileName: containingFileName });
|
|
118374
118136
|
ts.performance.mark("beforeResolveTypeReference");
|
|
118375
|
-
var result = actualResolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFileName, redirectedReference
|
|
118137
|
+
var result = actualResolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFileName, redirectedReference, containingFileMode);
|
|
118376
118138
|
ts.performance.mark("afterResolveTypeReference");
|
|
118377
118139
|
ts.performance.measure("ResolveTypeReference", "beforeResolveTypeReference", "afterResolveTypeReference");
|
|
118378
118140
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
@@ -118425,6 +118187,9 @@ var ts;
|
|
|
118425
118187
|
}
|
|
118426
118188
|
return ts.libs.length + 2;
|
|
118427
118189
|
}
|
|
118190
|
+
function getResolvedModuleWithFailedLookupLocationsFromCache(moduleName, containingFile, mode) {
|
|
118191
|
+
return moduleResolutionCache && ts.resolveModuleNameFromCache(moduleName, containingFile, moduleResolutionCache, mode);
|
|
118192
|
+
}
|
|
118428
118193
|
function toPath(fileName) {
|
|
118429
118194
|
return ts.toPath(fileName, currentDirectory, getCanonicalFileName);
|
|
118430
118195
|
}
|
|
@@ -118449,11 +118214,10 @@ var ts;
|
|
|
118449
118214
|
return classifiableNames;
|
|
118450
118215
|
}
|
|
118451
118216
|
function resolveModuleNamesReusingOldState(moduleNames, file) {
|
|
118452
|
-
var _a;
|
|
118453
118217
|
if (structureIsReused === 0 /* Not */ && !file.ambientModuleNames.length) {
|
|
118454
118218
|
// If the old program state does not permit reusing resolutions and `file` does not contain locally defined ambient modules,
|
|
118455
118219
|
// the best we can do is fallback to the default logic.
|
|
118456
|
-
return resolveModuleNamesWorker(moduleNames, file, /*
|
|
118220
|
+
return resolveModuleNamesWorker(moduleNames, file, /*reusedNames*/ undefined);
|
|
118457
118221
|
}
|
|
118458
118222
|
var oldSourceFile = oldProgram && oldProgram.getSourceFile(file.fileName);
|
|
118459
118223
|
if (oldSourceFile !== file && file.resolvedModules) {
|
|
@@ -118481,8 +118245,6 @@ var ts;
|
|
|
118481
118245
|
// With this information, we can infer some module resolutions without performing resolution.
|
|
118482
118246
|
/** An ordered list of module names for which we cannot recover the resolution. */
|
|
118483
118247
|
var unknownModuleNames;
|
|
118484
|
-
var unknownModuleNamesIndex;
|
|
118485
|
-
var reusedNames;
|
|
118486
118248
|
/**
|
|
118487
118249
|
* The indexing of elements in this list matches that of `moduleNames`.
|
|
118488
118250
|
*
|
|
@@ -118493,33 +118255,22 @@ var ts;
|
|
|
118493
118255
|
* * ResolvedModuleFull instance: can be reused.
|
|
118494
118256
|
*/
|
|
118495
118257
|
var result;
|
|
118258
|
+
var reusedNames;
|
|
118496
118259
|
/** A transient placeholder used to mark predicted resolution in the result list. */
|
|
118497
|
-
var predictedToResolveToAmbientModuleMarker =
|
|
118498
|
-
var redirectedReference;
|
|
118260
|
+
var predictedToResolveToAmbientModuleMarker = {};
|
|
118499
118261
|
for (var i = 0; i < moduleNames.length; i++) {
|
|
118500
118262
|
var moduleName = moduleNames[i];
|
|
118501
118263
|
// If the source file is unchanged and doesnt have invalidated resolution, reuse the module resolutions
|
|
118502
|
-
if (
|
|
118503
|
-
var
|
|
118504
|
-
|
|
118505
|
-
(_a = oldSourceFile === null || oldSourceFile === void 0 ? void 0 : oldSourceFile.resolvedModules) === null || _a === void 0 ? void 0 : _a.get(moduleName, mode) :
|
|
118506
|
-
oldBuildInfoProgram.getResolvedModule(ts.getDirectoryPath(file.path), moduleName, mode, (redirectedReference === undefined ? (redirectedReference = getRedirectReferenceForResolution(file) || false) : redirectedReference) || undefined);
|
|
118507
|
-
if (oldResolution === null || oldResolution === void 0 ? void 0 : oldResolution.resolvedModule) {
|
|
118264
|
+
if (file === oldSourceFile && !hasInvalidatedResolution(oldSourceFile.path)) {
|
|
118265
|
+
var oldResolvedModule = ts.getResolvedModule(oldSourceFile, moduleName, getModeForResolutionAtIndex(oldSourceFile, i));
|
|
118266
|
+
if (oldResolvedModule) {
|
|
118508
118267
|
if (ts.isTraceEnabled(options, host)) {
|
|
118509
|
-
|
|
118510
|
-
|
|
118511
|
-
ts.
|
|
118512
|
-
ts.Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 :
|
|
118513
|
-
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));
|
|
118514
|
-
}
|
|
118515
|
-
else {
|
|
118516
|
-
ts.trace(host, oldResolution.resolvedModule.packageId ?
|
|
118517
|
-
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 :
|
|
118518
|
-
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));
|
|
118519
|
-
}
|
|
118268
|
+
ts.trace(host, oldResolvedModule.packageId ?
|
|
118269
|
+
ts.Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 :
|
|
118270
|
+
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));
|
|
118520
118271
|
}
|
|
118521
|
-
(result
|
|
118522
|
-
(reusedNames
|
|
118272
|
+
(result || (result = new Array(moduleNames.length)))[i] = oldResolvedModule;
|
|
118273
|
+
(reusedNames || (reusedNames = [])).push(moduleName);
|
|
118523
118274
|
continue;
|
|
118524
118275
|
}
|
|
118525
118276
|
}
|
|
@@ -118538,16 +118289,15 @@ var ts;
|
|
|
118538
118289
|
resolvesToAmbientModuleInNonModifiedFile = moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName, i);
|
|
118539
118290
|
}
|
|
118540
118291
|
if (resolvesToAmbientModuleInNonModifiedFile) {
|
|
118541
|
-
(result
|
|
118292
|
+
(result || (result = new Array(moduleNames.length)))[i] = predictedToResolveToAmbientModuleMarker;
|
|
118542
118293
|
}
|
|
118543
118294
|
else {
|
|
118544
118295
|
// Resolution failed in the old program, or resolved to an ambient module for which we can't reuse the result.
|
|
118545
|
-
(unknownModuleNames
|
|
118546
|
-
(unknownModuleNamesIndex !== null && unknownModuleNamesIndex !== void 0 ? unknownModuleNamesIndex : (unknownModuleNamesIndex = [])).push(i);
|
|
118296
|
+
(unknownModuleNames || (unknownModuleNames = [])).push(moduleName);
|
|
118547
118297
|
}
|
|
118548
118298
|
}
|
|
118549
118299
|
var resolutions = unknownModuleNames && unknownModuleNames.length
|
|
118550
|
-
? resolveModuleNamesWorker(unknownModuleNames, file,
|
|
118300
|
+
? resolveModuleNamesWorker(unknownModuleNames, file, reusedNames)
|
|
118551
118301
|
: ts.emptyArray;
|
|
118552
118302
|
// Combine results of resolutions and predicted results
|
|
118553
118303
|
if (!result) {
|
|
@@ -118561,7 +118311,7 @@ var ts;
|
|
|
118561
118311
|
// `result[i]` is either a `ResolvedModuleFull` or a marker.
|
|
118562
118312
|
// If it is the former, we can leave it as is.
|
|
118563
118313
|
if (result[i] === predictedToResolveToAmbientModuleMarker) {
|
|
118564
|
-
result[i] =
|
|
118314
|
+
result[i] = undefined;
|
|
118565
118315
|
}
|
|
118566
118316
|
}
|
|
118567
118317
|
else {
|
|
@@ -118596,96 +118346,6 @@ var ts;
|
|
|
118596
118346
|
return true;
|
|
118597
118347
|
}
|
|
118598
118348
|
}
|
|
118599
|
-
function resolveTypeReferenceDirectiveNamesReusingOldState(typeDirectiveNames, containingFile) {
|
|
118600
|
-
var _a;
|
|
118601
|
-
if (structureIsReused === 0 /* Not */) {
|
|
118602
|
-
return resolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFile, /*partialResolutionInfo*/ undefined, /*redirectedReference*/ undefined);
|
|
118603
|
-
}
|
|
118604
|
-
var containingSourceFile = !ts.isString(containingFile) ? containingFile : undefined;
|
|
118605
|
-
var inferredTypeFile = !ts.isString(containingFile) ? undefined : containingFile;
|
|
118606
|
-
var oldSourceFile = containingSourceFile && (oldProgram === null || oldProgram === void 0 ? void 0 : oldProgram.getSourceFile(containingSourceFile.fileName));
|
|
118607
|
-
if (containingSourceFile && oldSourceFile !== containingSourceFile && containingSourceFile.resolvedTypeReferenceDirectiveNames) {
|
|
118608
|
-
// `file` was created for the new program.
|
|
118609
|
-
//
|
|
118610
|
-
// We only set `file.resolvedTypeReferenceDirectiveNames` via work from the current function,
|
|
118611
|
-
// so it is defined iff we already called the current function on `file`.
|
|
118612
|
-
// That call happened no later than the creation of the `file` object,
|
|
118613
|
-
// which per above occurred during the current program creation.
|
|
118614
|
-
// Since we assume the filesystem does not change during program creation,
|
|
118615
|
-
// it is safe to reuse resolutions from the earlier call.
|
|
118616
|
-
var result_15 = [];
|
|
118617
|
-
for (var _i = 0, _b = typeDirectiveNames; _i < _b.length; _i++) {
|
|
118618
|
-
var typeDirectiveName = _b[_i];
|
|
118619
|
-
// We lower-case all type references because npm automatically lowercases all packages. See GH#9824.
|
|
118620
|
-
var resolvedTypeReferenceDirective = containingSourceFile.resolvedTypeReferenceDirectiveNames.get(ts.toFileNameLowerCase(typeDirectiveName.fileName), typeDirectiveName.resolutionMode || containingSourceFile.impliedNodeFormat);
|
|
118621
|
-
result_15.push(resolvedTypeReferenceDirective);
|
|
118622
|
-
}
|
|
118623
|
-
return result_15;
|
|
118624
|
-
}
|
|
118625
|
-
/** An ordered list of module names for which we cannot recover the resolution. */
|
|
118626
|
-
var unknownTypeReferenceDirectiveNames;
|
|
118627
|
-
var unknownTypeReferenceDirectiveNamesIndex;
|
|
118628
|
-
/**
|
|
118629
|
-
* The indexing of elements in this list matches that of `moduleNames`.
|
|
118630
|
-
*
|
|
118631
|
-
* Before combining results, result[i] is in one of the following states:
|
|
118632
|
-
* * undefined: needs to be recomputed,
|
|
118633
|
-
*/
|
|
118634
|
-
var result;
|
|
118635
|
-
var reusedNames;
|
|
118636
|
-
var canReuseResolutions = oldBuildInfoProgram || (containingSourceFile ?
|
|
118637
|
-
containingSourceFile === oldSourceFile && !hasInvalidatedResolution(oldSourceFile.path) :
|
|
118638
|
-
!hasInvalidatedResolution(toPath(inferredTypeFile)));
|
|
118639
|
-
var redirectedReference;
|
|
118640
|
-
for (var i = 0; i < typeDirectiveNames.length; i++) {
|
|
118641
|
-
var entry = typeDirectiveNames[i];
|
|
118642
|
-
// If the source file is unchanged and doesnt have invalidated resolution, reuse the module resolutions
|
|
118643
|
-
if (canReuseResolutions) {
|
|
118644
|
-
var typeDirectiveName = !ts.isString(entry) ? entry.fileName.toLowerCase() : entry;
|
|
118645
|
-
var mode = getModeForFileReference(entry, containingSourceFile === null || containingSourceFile === void 0 ? void 0 : containingSourceFile.impliedNodeFormat);
|
|
118646
|
-
var oldResolution = !oldBuildInfoProgram ?
|
|
118647
|
-
(_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) :
|
|
118648
|
-
oldBuildInfoProgram.getResolvedTypeReferenceDirective(ts.getDirectoryPath(containingSourceFile ? containingSourceFile.path : toPath(inferredTypeFile)), typeDirectiveName, mode, containingSourceFile && (redirectedReference === undefined ? (redirectedReference = getRedirectReferenceForResolution(containingSourceFile) || false) : redirectedReference) || undefined);
|
|
118649
|
-
if (oldResolution === null || oldResolution === void 0 ? void 0 : oldResolution.resolvedTypeReferenceDirective) {
|
|
118650
|
-
if (ts.isTraceEnabled(options, host)) {
|
|
118651
|
-
var fileLocation = containingSourceFile ? ts.getNormalizedAbsolutePath(containingSourceFile.originalFileName, currentDirectory) : inferredTypeFile;
|
|
118652
|
-
if (!oldBuildInfoProgram) {
|
|
118653
|
-
ts.trace(host, oldResolution.resolvedTypeReferenceDirective.packageId ?
|
|
118654
|
-
ts.Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 :
|
|
118655
|
-
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));
|
|
118656
|
-
}
|
|
118657
|
-
else {
|
|
118658
|
-
ts.trace(host, oldResolution.resolvedTypeReferenceDirective.packageId ?
|
|
118659
|
-
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 :
|
|
118660
|
-
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));
|
|
118661
|
-
}
|
|
118662
|
-
}
|
|
118663
|
-
(result || (result = new Array(typeDirectiveNames.length)))[i] = oldResolution;
|
|
118664
|
-
(reusedNames !== null && reusedNames !== void 0 ? reusedNames : (reusedNames = [])).push({ name: typeDirectiveName, mode: mode });
|
|
118665
|
-
continue;
|
|
118666
|
-
}
|
|
118667
|
-
}
|
|
118668
|
-
// Resolution failed in the old program, or resolved to an ambient module for which we can't reuse the result.
|
|
118669
|
-
(unknownTypeReferenceDirectiveNames !== null && unknownTypeReferenceDirectiveNames !== void 0 ? unknownTypeReferenceDirectiveNames : (unknownTypeReferenceDirectiveNames = [])).push(entry);
|
|
118670
|
-
(unknownTypeReferenceDirectiveNamesIndex !== null && unknownTypeReferenceDirectiveNamesIndex !== void 0 ? unknownTypeReferenceDirectiveNamesIndex : (unknownTypeReferenceDirectiveNamesIndex = [])).push(i);
|
|
118671
|
-
}
|
|
118672
|
-
if (!unknownTypeReferenceDirectiveNames)
|
|
118673
|
-
return result || ts.emptyArray;
|
|
118674
|
-
var resolutions = resolveTypeReferenceDirectiveNamesWorker(unknownTypeReferenceDirectiveNames, containingFile, { reusedNames: reusedNames, namesIndex: unknownTypeReferenceDirectiveNamesIndex }, redirectedReference);
|
|
118675
|
-
if (!result) {
|
|
118676
|
-
ts.Debug.assert(resolutions.length === typeDirectiveNames.length);
|
|
118677
|
-
return resolutions;
|
|
118678
|
-
}
|
|
118679
|
-
var j = 0;
|
|
118680
|
-
for (var i = 0; i < result.length; i++) {
|
|
118681
|
-
if (!result[i]) {
|
|
118682
|
-
result[i] = resolutions[j];
|
|
118683
|
-
j++;
|
|
118684
|
-
}
|
|
118685
|
-
}
|
|
118686
|
-
ts.Debug.assert(j === resolutions.length);
|
|
118687
|
-
return result;
|
|
118688
|
-
}
|
|
118689
118349
|
function canReuseProjectReferences() {
|
|
118690
118350
|
return !forEachProjectReference(oldProgram.getProjectReferences(), oldProgram.getResolvedProjectReferences(), function (oldResolvedRef, parent, index) {
|
|
118691
118351
|
var newRef = (parent ? parent.commandLine.projectReferences : projectReferences)[index];
|
|
@@ -118707,19 +118367,14 @@ var ts;
|
|
|
118707
118367
|
});
|
|
118708
118368
|
}
|
|
118709
118369
|
function tryReuseStructureFromOldProgram() {
|
|
118710
|
-
|
|
118711
|
-
|
|
118712
|
-
var oldOptions = (oldProgram === null || oldProgram === void 0 ? void 0 : oldProgram.getCompilerOptions()) || (oldBuildInfoProgram === null || oldBuildInfoProgram === void 0 ? void 0 : oldBuildInfoProgram.getCompilerOptions());
|
|
118713
|
-
if (!oldOptions || ts.changesAffectModuleResolution(oldOptions, options)) {
|
|
118370
|
+
var _a;
|
|
118371
|
+
if (!oldProgram) {
|
|
118714
118372
|
return 0 /* Not */;
|
|
118715
118373
|
}
|
|
118716
|
-
|
|
118717
|
-
|
|
118718
|
-
|
|
118719
|
-
|
|
118720
|
-
}
|
|
118721
|
-
function tryReuseStructureFromOldProgramWorker() {
|
|
118722
|
-
if (!oldProgram) {
|
|
118374
|
+
// check properties that can affect structure of the program or module resolution strategy
|
|
118375
|
+
// if any of these properties has changed - structure cannot be reused
|
|
118376
|
+
var oldOptions = oldProgram.getCompilerOptions();
|
|
118377
|
+
if (ts.changesAffectModuleResolution(oldOptions, options)) {
|
|
118723
118378
|
return 0 /* Not */;
|
|
118724
118379
|
}
|
|
118725
118380
|
// there is an old program, check if we can reuse its structure
|
|
@@ -118737,7 +118392,7 @@ var ts;
|
|
|
118737
118392
|
// check if program source files has changed in the way that can affect structure of the program
|
|
118738
118393
|
var newSourceFiles = [];
|
|
118739
118394
|
var modifiedSourceFiles = [];
|
|
118740
|
-
structureIsReused =
|
|
118395
|
+
structureIsReused = 2 /* Completely */;
|
|
118741
118396
|
// If the missing file paths are now present, it can change the progam structure,
|
|
118742
118397
|
// and hence cant reuse the structure.
|
|
118743
118398
|
// This is same as how we dont reuse the structure if one of the file from old program is now missing
|
|
@@ -118801,107 +118456,98 @@ var ts;
|
|
|
118801
118456
|
// The `newSourceFile` object was created for the new program.
|
|
118802
118457
|
if (!ts.arrayIsEqualTo(oldSourceFile.libReferenceDirectives, newSourceFile.libReferenceDirectives, fileReferenceIsEqualTo)) {
|
|
118803
118458
|
// 'lib' references has changed. Matches behavior in changesAffectModuleResolution
|
|
118804
|
-
structureIsReused =
|
|
118459
|
+
structureIsReused = 1 /* SafeModules */;
|
|
118805
118460
|
}
|
|
118806
118461
|
if (oldSourceFile.hasNoDefaultLib !== newSourceFile.hasNoDefaultLib) {
|
|
118807
118462
|
// value of no-default-lib has changed
|
|
118808
118463
|
// this will affect if default library is injected into the list of files
|
|
118809
|
-
structureIsReused =
|
|
118464
|
+
structureIsReused = 1 /* SafeModules */;
|
|
118810
118465
|
}
|
|
118811
118466
|
// check tripleslash references
|
|
118812
118467
|
if (!ts.arrayIsEqualTo(oldSourceFile.referencedFiles, newSourceFile.referencedFiles, fileReferenceIsEqualTo)) {
|
|
118813
118468
|
// tripleslash references has changed
|
|
118814
|
-
structureIsReused =
|
|
118469
|
+
structureIsReused = 1 /* SafeModules */;
|
|
118815
118470
|
}
|
|
118816
118471
|
// check imports and module augmentations
|
|
118817
118472
|
collectExternalModuleReferences(newSourceFile);
|
|
118818
118473
|
if (!ts.arrayIsEqualTo(oldSourceFile.imports, newSourceFile.imports, moduleNameIsEqualTo)) {
|
|
118819
118474
|
// imports has changed
|
|
118820
|
-
structureIsReused =
|
|
118475
|
+
structureIsReused = 1 /* SafeModules */;
|
|
118821
118476
|
}
|
|
118822
118477
|
if (!ts.arrayIsEqualTo(oldSourceFile.moduleAugmentations, newSourceFile.moduleAugmentations, moduleNameIsEqualTo)) {
|
|
118823
118478
|
// moduleAugmentations has changed
|
|
118824
|
-
structureIsReused =
|
|
118479
|
+
structureIsReused = 1 /* SafeModules */;
|
|
118825
118480
|
}
|
|
118826
118481
|
if ((oldSourceFile.flags & 6291456 /* PermanentlySetIncrementalFlags */) !== (newSourceFile.flags & 6291456 /* PermanentlySetIncrementalFlags */)) {
|
|
118827
118482
|
// dynamicImport has changed
|
|
118828
|
-
structureIsReused =
|
|
118483
|
+
structureIsReused = 1 /* SafeModules */;
|
|
118829
118484
|
}
|
|
118830
118485
|
if (!ts.arrayIsEqualTo(oldSourceFile.typeReferenceDirectives, newSourceFile.typeReferenceDirectives, fileReferenceIsEqualTo)) {
|
|
118831
118486
|
// 'types' references has changed
|
|
118832
|
-
structureIsReused =
|
|
118487
|
+
structureIsReused = 1 /* SafeModules */;
|
|
118833
118488
|
}
|
|
118834
118489
|
// tentatively approve the file
|
|
118835
118490
|
modifiedSourceFiles.push({ oldFile: oldSourceFile, newFile: newSourceFile });
|
|
118836
118491
|
}
|
|
118837
118492
|
else if (hasInvalidatedResolution(oldSourceFile.path)) {
|
|
118838
118493
|
// 'module/types' references could have changed
|
|
118839
|
-
structureIsReused =
|
|
118494
|
+
structureIsReused = 1 /* SafeModules */;
|
|
118840
118495
|
// add file to the modified list so that we will resolve it later
|
|
118841
118496
|
modifiedSourceFiles.push({ oldFile: oldSourceFile, newFile: newSourceFile });
|
|
118842
118497
|
}
|
|
118843
118498
|
// if file has passed all checks it should be safe to reuse it
|
|
118844
118499
|
newSourceFiles.push(newSourceFile);
|
|
118845
118500
|
}
|
|
118846
|
-
if (structureIsReused !==
|
|
118501
|
+
if (structureIsReused !== 2 /* Completely */) {
|
|
118847
118502
|
return structureIsReused;
|
|
118848
118503
|
}
|
|
118849
118504
|
var modifiedFiles = modifiedSourceFiles.map(function (f) { return f.oldFile; });
|
|
118850
|
-
for (var
|
|
118851
|
-
var oldFile = oldSourceFiles_3[
|
|
118505
|
+
for (var _b = 0, oldSourceFiles_3 = oldSourceFiles; _b < oldSourceFiles_3.length; _b++) {
|
|
118506
|
+
var oldFile = oldSourceFiles_3[_b];
|
|
118852
118507
|
if (!ts.contains(modifiedFiles, oldFile)) {
|
|
118853
|
-
for (var
|
|
118854
|
-
var moduleName = _c
|
|
118508
|
+
for (var _c = 0, _d = oldFile.ambientModuleNames; _c < _d.length; _c++) {
|
|
118509
|
+
var moduleName = _d[_c];
|
|
118855
118510
|
ambientModuleNameToUnmodifiedFileName.set(moduleName, oldFile.fileName);
|
|
118856
118511
|
}
|
|
118857
118512
|
}
|
|
118858
118513
|
}
|
|
118859
118514
|
// try to verify results of module resolution
|
|
118860
|
-
for (var
|
|
118861
|
-
var
|
|
118515
|
+
for (var _e = 0, modifiedSourceFiles_1 = modifiedSourceFiles; _e < modifiedSourceFiles_1.length; _e++) {
|
|
118516
|
+
var _f = modifiedSourceFiles_1[_e], oldSourceFile = _f.oldFile, newSourceFile = _f.newFile;
|
|
118862
118517
|
var moduleNames = getModuleNames(newSourceFile);
|
|
118863
118518
|
var resolutions = resolveModuleNamesReusingOldState(moduleNames, newSourceFile);
|
|
118864
118519
|
// ensure that module resolution results are still correct
|
|
118865
118520
|
var resolutionsChanged = ts.hasChangesInResolutions(moduleNames, resolutions, oldSourceFile.resolvedModules, oldSourceFile, ts.moduleResolutionIsEqualTo);
|
|
118866
118521
|
if (resolutionsChanged) {
|
|
118867
|
-
structureIsReused =
|
|
118522
|
+
structureIsReused = 1 /* SafeModules */;
|
|
118868
118523
|
newSourceFile.resolvedModules = ts.zipToModeAwareCache(newSourceFile, moduleNames, resolutions);
|
|
118869
118524
|
}
|
|
118870
118525
|
else {
|
|
118871
118526
|
newSourceFile.resolvedModules = oldSourceFile.resolvedModules;
|
|
118872
118527
|
}
|
|
118873
118528
|
var typesReferenceDirectives = newSourceFile.typeReferenceDirectives;
|
|
118874
|
-
var typeReferenceResolutions =
|
|
118529
|
+
var typeReferenceResolutions = resolveTypeReferenceDirectiveNamesWorker(typesReferenceDirectives, newSourceFile);
|
|
118875
118530
|
// ensure that types resolutions are still correct
|
|
118876
118531
|
var typeReferenceResolutionsChanged = ts.hasChangesInResolutions(typesReferenceDirectives, typeReferenceResolutions, oldSourceFile.resolvedTypeReferenceDirectiveNames, oldSourceFile, ts.typeDirectiveIsEqualTo);
|
|
118877
118532
|
if (typeReferenceResolutionsChanged) {
|
|
118878
|
-
structureIsReused =
|
|
118533
|
+
structureIsReused = 1 /* SafeModules */;
|
|
118879
118534
|
newSourceFile.resolvedTypeReferenceDirectiveNames = ts.zipToModeAwareCache(newSourceFile, typesReferenceDirectives, typeReferenceResolutions);
|
|
118880
118535
|
}
|
|
118881
118536
|
else {
|
|
118882
118537
|
newSourceFile.resolvedTypeReferenceDirectiveNames = oldSourceFile.resolvedTypeReferenceDirectiveNames;
|
|
118883
118538
|
}
|
|
118884
118539
|
}
|
|
118885
|
-
if (structureIsReused !==
|
|
118540
|
+
if (structureIsReused !== 2 /* Completely */) {
|
|
118886
118541
|
return structureIsReused;
|
|
118887
118542
|
}
|
|
118888
|
-
if (ts.changesAffectingProgramStructure(
|
|
118889
|
-
return
|
|
118890
|
-
}
|
|
118891
|
-
if (host.hasChangedAutomaticTypeDirectiveNames) {
|
|
118892
|
-
if (host.hasChangedAutomaticTypeDirectiveNames())
|
|
118893
|
-
return 2 /* SafeModules */;
|
|
118894
|
-
}
|
|
118895
|
-
else {
|
|
118896
|
-
automaticTypeDirectiveNames = ts.getAutomaticTypeDirectiveNames(options, host);
|
|
118897
|
-
if (!ts.arrayIsEqualTo(oldProgram.getAutomaticTypeDirectiveNames(), automaticTypeDirectiveNames))
|
|
118898
|
-
return 2 /* SafeModules */;
|
|
118543
|
+
if (ts.changesAffectingProgramStructure(oldOptions, options) || ((_a = host.hasChangedAutomaticTypeDirectiveNames) === null || _a === void 0 ? void 0 : _a.call(host))) {
|
|
118544
|
+
return 1 /* SafeModules */;
|
|
118899
118545
|
}
|
|
118900
118546
|
missingFilePaths = oldProgram.getMissingFilePaths();
|
|
118901
118547
|
// update fileName -> file mapping
|
|
118902
118548
|
ts.Debug.assert(newSourceFiles.length === oldProgram.getSourceFiles().length);
|
|
118903
|
-
for (var
|
|
118904
|
-
var newSourceFile = newSourceFiles_1[
|
|
118549
|
+
for (var _g = 0, newSourceFiles_1 = newSourceFiles; _g < newSourceFiles_1.length; _g++) {
|
|
118550
|
+
var newSourceFile = newSourceFiles_1[_g];
|
|
118905
118551
|
filesByName.set(newSourceFile.path, newSourceFile);
|
|
118906
118552
|
}
|
|
118907
118553
|
var oldFilesByNameMap = oldProgram.getFilesByNameMap();
|
|
@@ -118923,12 +118569,10 @@ var ts;
|
|
|
118923
118569
|
fileReasons = oldProgram.getFileIncludeReasons();
|
|
118924
118570
|
fileProcessingDiagnostics = oldProgram.getFileProcessingDiagnostics();
|
|
118925
118571
|
resolvedTypeReferenceDirectives = oldProgram.getResolvedTypeReferenceDirectives();
|
|
118926
|
-
automaticTypeDirectiveNames = oldProgram.getAutomaticTypeDirectiveNames();
|
|
118927
|
-
automaticTypeDirectiveResolutions = oldProgram.getAutomaticTypeDirectiveResolutions();
|
|
118928
118572
|
sourceFileToPackageName = oldProgram.sourceFileToPackageName;
|
|
118929
118573
|
redirectTargetsMap = oldProgram.redirectTargetsMap;
|
|
118930
118574
|
usesUriStyleNodeCoreModules = oldProgram.usesUriStyleNodeCoreModules;
|
|
118931
|
-
return
|
|
118575
|
+
return 2 /* Completely */;
|
|
118932
118576
|
}
|
|
118933
118577
|
function getEmitHost(writeFileCallback) {
|
|
118934
118578
|
return {
|
|
@@ -119970,42 +119614,35 @@ var ts;
|
|
|
119970
119614
|
}
|
|
119971
119615
|
function processTypeReferenceDirectives(file) {
|
|
119972
119616
|
var typeDirectives = file.typeReferenceDirectives;
|
|
119973
|
-
if (!typeDirectives
|
|
119974
|
-
file.resolvedTypeReferenceDirectiveNames = undefined;
|
|
119617
|
+
if (!typeDirectives) {
|
|
119975
119618
|
return;
|
|
119976
119619
|
}
|
|
119977
|
-
var resolutions =
|
|
119620
|
+
var resolutions = resolveTypeReferenceDirectiveNamesWorker(typeDirectives, file);
|
|
119978
119621
|
for (var index = 0; index < typeDirectives.length; index++) {
|
|
119979
119622
|
var ref = file.typeReferenceDirectives[index];
|
|
119980
119623
|
var resolvedTypeReferenceDirective = resolutions[index];
|
|
119981
119624
|
// store resolved type directive on the file
|
|
119982
119625
|
var fileName = ts.toFileNameLowerCase(ref.fileName);
|
|
119983
|
-
ts.setResolvedTypeReferenceDirective(file, fileName, resolvedTypeReferenceDirective
|
|
119626
|
+
ts.setResolvedTypeReferenceDirective(file, fileName, resolvedTypeReferenceDirective);
|
|
119984
119627
|
var mode = ref.resolutionMode || file.impliedNodeFormat;
|
|
119985
119628
|
if (mode && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeNext) {
|
|
119986
|
-
(
|
|
119987
|
-
kind: 2 /* ResolutionDiagnostics */,
|
|
119988
|
-
diagnostics: [ts.createDiagnosticForRange(file, ref, ts.Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext)]
|
|
119989
|
-
});
|
|
119629
|
+
programDiagnostics.add(ts.createDiagnosticForRange(file, ref, ts.Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext));
|
|
119990
119630
|
}
|
|
119991
119631
|
processTypeReferenceDirective(fileName, mode, resolvedTypeReferenceDirective, { kind: ts.FileIncludeKind.TypeReferenceDirective, file: file.path, index: index, });
|
|
119992
119632
|
}
|
|
119993
119633
|
}
|
|
119994
|
-
function processTypeReferenceDirective(typeReferenceDirective, mode,
|
|
119995
|
-
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program" /* Program */, "processTypeReferenceDirective", { directive: typeReferenceDirective, hasResolved: !!
|
|
119996
|
-
processTypeReferenceDirectiveWorker(typeReferenceDirective, mode,
|
|
119634
|
+
function processTypeReferenceDirective(typeReferenceDirective, mode, resolvedTypeReferenceDirective, reason) {
|
|
119635
|
+
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 });
|
|
119636
|
+
processTypeReferenceDirectiveWorker(typeReferenceDirective, mode, resolvedTypeReferenceDirective, reason);
|
|
119997
119637
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
119998
119638
|
}
|
|
119999
|
-
function processTypeReferenceDirectiveWorker(typeReferenceDirective, mode,
|
|
120000
|
-
var _a;
|
|
120001
|
-
addResolutionDiagnostics(resolution);
|
|
119639
|
+
function processTypeReferenceDirectiveWorker(typeReferenceDirective, mode, resolvedTypeReferenceDirective, reason) {
|
|
120002
119640
|
// If we already found this library as a primary reference - nothing to do
|
|
120003
|
-
var previousResolution =
|
|
119641
|
+
var previousResolution = resolvedTypeReferenceDirectives.get(typeReferenceDirective, mode);
|
|
120004
119642
|
if (previousResolution && previousResolution.primary) {
|
|
120005
119643
|
return;
|
|
120006
119644
|
}
|
|
120007
119645
|
var saveResolution = true;
|
|
120008
|
-
var resolvedTypeReferenceDirective = resolution.resolvedTypeReferenceDirective;
|
|
120009
119646
|
if (resolvedTypeReferenceDirective) {
|
|
120010
119647
|
if (resolvedTypeReferenceDirective.isExternalLibraryImport)
|
|
120011
119648
|
currentNodeModulesDepth++;
|
|
@@ -120040,7 +119677,7 @@ var ts;
|
|
|
120040
119677
|
addFilePreprocessingFileExplainingDiagnostic(/*file*/ undefined, reason, ts.Diagnostics.Cannot_find_type_definition_file_for_0, [typeReferenceDirective]);
|
|
120041
119678
|
}
|
|
120042
119679
|
if (saveResolution) {
|
|
120043
|
-
resolvedTypeReferenceDirectives.set(typeReferenceDirective, mode,
|
|
119680
|
+
resolvedTypeReferenceDirectives.set(typeReferenceDirective, mode, resolvedTypeReferenceDirective);
|
|
120044
119681
|
}
|
|
120045
119682
|
}
|
|
120046
119683
|
function pathForLibFile(libFileName) {
|
|
@@ -120073,7 +119710,7 @@ var ts;
|
|
|
120073
119710
|
var unqualifiedLibName = ts.removeSuffix(ts.removePrefix(libName, "lib."), ".d.ts");
|
|
120074
119711
|
var suggestion = ts.getSpellingSuggestion(unqualifiedLibName, ts.libs, ts.identity);
|
|
120075
119712
|
var diagnostic = suggestion ? ts.Diagnostics.Cannot_find_lib_definition_for_0_Did_you_mean_1 : ts.Diagnostics.Cannot_find_lib_definition_for_0;
|
|
120076
|
-
(fileProcessingDiagnostics
|
|
119713
|
+
(fileProcessingDiagnostics || (fileProcessingDiagnostics = [])).push({
|
|
120077
119714
|
kind: 0 /* FilePreprocessingReferencedDiagnostic */,
|
|
120078
119715
|
reason: { kind: ts.FileIncludeKind.LibReferenceDirective, file: file.path, index: index, },
|
|
120079
119716
|
diagnostic: diagnostic,
|
|
@@ -120097,14 +119734,13 @@ var ts;
|
|
|
120097
119734
|
for (var index = 0; index < moduleNames.length; index++) {
|
|
120098
119735
|
var resolution = resolutions[index];
|
|
120099
119736
|
ts.setResolvedModule(file, moduleNames[index], resolution, getModeForResolutionAtIndex(file, index));
|
|
120100
|
-
|
|
120101
|
-
if (!resolution.resolvedModule) {
|
|
119737
|
+
if (!resolution) {
|
|
120102
119738
|
continue;
|
|
120103
119739
|
}
|
|
120104
|
-
var isFromNodeModulesSearch = resolution.
|
|
120105
|
-
var isJsFile = !ts.resolutionExtensionIsTSOrJson(resolution.
|
|
119740
|
+
var isFromNodeModulesSearch = resolution.isExternalLibraryImport;
|
|
119741
|
+
var isJsFile = !ts.resolutionExtensionIsTSOrJson(resolution.extension);
|
|
120106
119742
|
var isJsFileFromNodeModules = isFromNodeModulesSearch && isJsFile;
|
|
120107
|
-
var resolvedFileName = resolution.
|
|
119743
|
+
var resolvedFileName = resolution.resolvedFileName;
|
|
120108
119744
|
if (isFromNodeModulesSearch) {
|
|
120109
119745
|
currentNodeModulesDepth++;
|
|
120110
119746
|
}
|
|
@@ -120117,7 +119753,7 @@ var ts;
|
|
|
120117
119753
|
// Don't add the file if it has a bad extension (e.g. 'tsx' if we don't have '--allowJs')
|
|
120118
119754
|
// This may still end up being an untyped module -- the file won't be included but imports will be allowed.
|
|
120119
119755
|
var shouldAddFile = resolvedFileName
|
|
120120
|
-
&& !getResolutionDiagnostic(optionsForFile, resolution
|
|
119756
|
+
&& !getResolutionDiagnostic(optionsForFile, resolution)
|
|
120121
119757
|
&& !optionsForFile.noResolve
|
|
120122
119758
|
&& index < file.imports.length
|
|
120123
119759
|
&& !elideImport
|
|
@@ -120129,7 +119765,7 @@ var ts;
|
|
|
120129
119765
|
else if (shouldAddFile) {
|
|
120130
119766
|
findSourceFile(resolvedFileName,
|
|
120131
119767
|
/*isDefaultLib*/ false,
|
|
120132
|
-
/*ignoreNoDefaultLib*/ false, { kind: ts.FileIncludeKind.Import, file: file.path, index: index, }, resolution.
|
|
119768
|
+
/*ignoreNoDefaultLib*/ false, { kind: ts.FileIncludeKind.Import, file: file.path, index: index, }, resolution.packageId);
|
|
120133
119769
|
}
|
|
120134
119770
|
if (isFromNodeModulesSearch) {
|
|
120135
119771
|
currentNodeModulesDepth--;
|
|
@@ -120233,9 +119869,6 @@ var ts;
|
|
|
120233
119869
|
createDiagnosticForOptionName(ts.Diagnostics.Composite_projects_may_not_disable_incremental_compilation, "declaration");
|
|
120234
119870
|
}
|
|
120235
119871
|
}
|
|
120236
|
-
if (options.cacheResolutions && !ts.isIncrementalCompilation(options)) {
|
|
120237
|
-
createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1_or_option_2, "cacheResolutions", "incremental", "composite");
|
|
120238
|
-
}
|
|
120239
119872
|
var outputFile = ts.outFile(options);
|
|
120240
119873
|
if (options.tsBuildInfoFile) {
|
|
120241
119874
|
if (!ts.isIncrementalCompilation(options)) {
|
|
@@ -120504,7 +120137,7 @@ var ts;
|
|
|
120504
120137
|
}
|
|
120505
120138
|
}
|
|
120506
120139
|
function addFilePreprocessingFileExplainingDiagnostic(file, fileProcessingReason, diagnostic, args) {
|
|
120507
|
-
(fileProcessingDiagnostics
|
|
120140
|
+
(fileProcessingDiagnostics || (fileProcessingDiagnostics = [])).push({
|
|
120508
120141
|
kind: 1 /* FilePreprocessingFileExplainingDiagnostic */,
|
|
120509
120142
|
file: file && file.path,
|
|
120510
120143
|
fileProcessingReason: fileProcessingReason,
|
|
@@ -120772,8 +120405,8 @@ var ts;
|
|
|
120772
120405
|
if (!symlinks) {
|
|
120773
120406
|
symlinks = ts.createSymlinkCache(currentDirectory, getCanonicalFileName);
|
|
120774
120407
|
}
|
|
120775
|
-
if (files &&
|
|
120776
|
-
symlinks.setSymlinksFromResolutions(files,
|
|
120408
|
+
if (files && resolvedTypeReferenceDirectives && !symlinks.hasProcessedResolutions()) {
|
|
120409
|
+
symlinks.setSymlinksFromResolutions(files, resolvedTypeReferenceDirectives);
|
|
120777
120410
|
}
|
|
120778
120411
|
return symlinks;
|
|
120779
120412
|
}
|
|
@@ -121186,8 +120819,7 @@ var ts;
|
|
|
121186
120819
|
}
|
|
121187
120820
|
// Handle type reference directives
|
|
121188
120821
|
if (sourceFile.resolvedTypeReferenceDirectiveNames) {
|
|
121189
|
-
sourceFile.resolvedTypeReferenceDirectiveNames.forEach(function (
|
|
121190
|
-
var resolvedTypeReferenceDirective = _a.resolvedTypeReferenceDirective;
|
|
120822
|
+
sourceFile.resolvedTypeReferenceDirectiveNames.forEach(function (resolvedTypeReferenceDirective) {
|
|
121191
120823
|
if (!resolvedTypeReferenceDirective) {
|
|
121192
120824
|
return;
|
|
121193
120825
|
}
|
|
@@ -121246,13 +120878,12 @@ var ts;
|
|
|
121246
120878
|
/**
|
|
121247
120879
|
* Creates the state of file references and signature for the new program from oldState if it is safe
|
|
121248
120880
|
*/
|
|
121249
|
-
function create(newProgram, oldState, disableUseFileVersionAsSignature) {
|
|
120881
|
+
function create(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature) {
|
|
121250
120882
|
var _a, _b, _c;
|
|
121251
120883
|
var fileInfos = new ts.Map();
|
|
121252
120884
|
var referencedMap = newProgram.getCompilerOptions().module !== ts.ModuleKind.None ? createManyToManyPathMap() : undefined;
|
|
121253
120885
|
var exportedModulesMap = referencedMap ? createManyToManyPathMap() : undefined;
|
|
121254
120886
|
var useOldState = canReuseOldState(referencedMap, oldState);
|
|
121255
|
-
var getCanonicalFileName = ts.createGetCanonicalFileName(newProgram.useCaseSensitiveFileNames());
|
|
121256
120887
|
// Ensure source files have parent pointers set
|
|
121257
120888
|
newProgram.getTypeChecker();
|
|
121258
120889
|
// Create the reference map, and set the file infos
|
|
@@ -121305,23 +120936,23 @@ var ts;
|
|
|
121305
120936
|
/**
|
|
121306
120937
|
* Gets the files affected by the path from the program
|
|
121307
120938
|
*/
|
|
121308
|
-
function getFilesAffectedBy(state, programOfThisState, path, cancellationToken,
|
|
120939
|
+
function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, computeHash, getCanonicalFileName) {
|
|
121309
120940
|
var _a, _b;
|
|
121310
|
-
var result = getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken,
|
|
120941
|
+
var result = getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash, getCanonicalFileName);
|
|
121311
120942
|
(_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.clear();
|
|
121312
120943
|
(_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
|
|
121313
120944
|
return result;
|
|
121314
120945
|
}
|
|
121315
120946
|
BuilderState.getFilesAffectedBy = getFilesAffectedBy;
|
|
121316
|
-
function getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken,
|
|
120947
|
+
function getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash, getCanonicalFileName) {
|
|
121317
120948
|
var sourceFile = programOfThisState.getSourceFileByPath(path);
|
|
121318
120949
|
if (!sourceFile) {
|
|
121319
120950
|
return ts.emptyArray;
|
|
121320
120951
|
}
|
|
121321
|
-
if (!updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken,
|
|
120952
|
+
if (!updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash, getCanonicalFileName)) {
|
|
121322
120953
|
return [sourceFile];
|
|
121323
120954
|
}
|
|
121324
|
-
return (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, cancellationToken,
|
|
120955
|
+
return (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, cancellationToken, computeHash, getCanonicalFileName);
|
|
121325
120956
|
}
|
|
121326
120957
|
BuilderState.getFilesAffectedByWithOldState = getFilesAffectedByWithOldState;
|
|
121327
120958
|
function updateSignatureOfFile(state, signature, path) {
|
|
@@ -121332,7 +120963,7 @@ var ts;
|
|
|
121332
120963
|
/**
|
|
121333
120964
|
* Returns if the shape of the signature has changed since last emit
|
|
121334
120965
|
*/
|
|
121335
|
-
function updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken,
|
|
120966
|
+
function updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash, getCanonicalFileName, useFileVersionAsSignature) {
|
|
121336
120967
|
var _a;
|
|
121337
120968
|
if (useFileVersionAsSignature === void 0) { useFileVersionAsSignature = state.useFileVersionAsSignature; }
|
|
121338
120969
|
// If we have cached the result for this file, that means hence forth we should assume file shape is uptodate
|
|
@@ -121344,7 +120975,7 @@ var ts;
|
|
|
121344
120975
|
if (!sourceFile.isDeclarationFile && !useFileVersionAsSignature) {
|
|
121345
120976
|
programOfThisState.emit(sourceFile, function (fileName, text, _writeByteOrderMark, _onError, sourceFiles, data) {
|
|
121346
120977
|
ts.Debug.assert(ts.isDeclarationFileName(fileName), "File extension for signature expected to be dts: Got:: " + fileName);
|
|
121347
|
-
latestSignature = ts.computeSignatureWithDiagnostics(sourceFile, text,
|
|
120978
|
+
latestSignature = ts.computeSignatureWithDiagnostics(sourceFile, text, computeHash, getCanonicalFileName, data);
|
|
121348
120979
|
if (latestSignature !== prevSignature) {
|
|
121349
120980
|
updateExportedModules(state, sourceFile, sourceFiles[0].exportedModulesFromDeclarationEmit);
|
|
121350
120981
|
}
|
|
@@ -121523,7 +121154,7 @@ var ts;
|
|
|
121523
121154
|
/**
|
|
121524
121155
|
* When program emits modular code, gets the files affected by the sourceFile whose shape has changed
|
|
121525
121156
|
*/
|
|
121526
|
-
function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cancellationToken,
|
|
121157
|
+
function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cancellationToken, computeHash, getCanonicalFileName) {
|
|
121527
121158
|
if (isFileAffectingGlobalScope(sourceFileWithUpdatedShape)) {
|
|
121528
121159
|
return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
|
|
121529
121160
|
}
|
|
@@ -121543,7 +121174,7 @@ var ts;
|
|
|
121543
121174
|
if (!seenFileNamesMap.has(currentPath)) {
|
|
121544
121175
|
var currentSourceFile = programOfThisState.getSourceFileByPath(currentPath);
|
|
121545
121176
|
seenFileNamesMap.set(currentPath, currentSourceFile);
|
|
121546
|
-
if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cancellationToken,
|
|
121177
|
+
if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cancellationToken, computeHash, getCanonicalFileName)) {
|
|
121547
121178
|
queue.push.apply(queue, getReferencedByPaths(state, currentSourceFile.resolvedPath));
|
|
121548
121179
|
}
|
|
121549
121180
|
}
|
|
@@ -121568,9 +121199,9 @@ var ts;
|
|
|
121568
121199
|
/**
|
|
121569
121200
|
* Create the state so that we can iterate on changedFiles/affected files
|
|
121570
121201
|
*/
|
|
121571
|
-
function createBuilderProgramState(newProgram, oldState, disableUseFileVersionAsSignature) {
|
|
121202
|
+
function createBuilderProgramState(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature) {
|
|
121572
121203
|
var _a, _b;
|
|
121573
|
-
var state = ts.BuilderState.create(newProgram, oldState, disableUseFileVersionAsSignature);
|
|
121204
|
+
var state = ts.BuilderState.create(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature);
|
|
121574
121205
|
state.program = newProgram;
|
|
121575
121206
|
var compilerOptions = newProgram.getCompilerOptions();
|
|
121576
121207
|
state.compilerOptions = compilerOptions;
|
|
@@ -121634,7 +121265,7 @@ var ts;
|
|
|
121634
121265
|
// Unchanged file copy diagnostics
|
|
121635
121266
|
var diagnostics = oldState.semanticDiagnosticsPerFile.get(sourceFilePath);
|
|
121636
121267
|
if (diagnostics) {
|
|
121637
|
-
state.semanticDiagnosticsPerFile.set(sourceFilePath, oldState.hasReusableDiagnostic ? convertToDiagnostics(diagnostics, newProgram) : diagnostics);
|
|
121268
|
+
state.semanticDiagnosticsPerFile.set(sourceFilePath, oldState.hasReusableDiagnostic ? convertToDiagnostics(diagnostics, newProgram, getCanonicalFileName) : diagnostics);
|
|
121638
121269
|
if (!state.semanticDiagnosticsFromOldState) {
|
|
121639
121270
|
state.semanticDiagnosticsFromOldState = new ts.Set();
|
|
121640
121271
|
}
|
|
@@ -121659,16 +121290,13 @@ var ts;
|
|
|
121659
121290
|
state.seenAffectedFiles = state.seenAffectedFiles || new ts.Set();
|
|
121660
121291
|
}
|
|
121661
121292
|
// Since old states change files set is copied, any additional change means we would need to emit build info
|
|
121662
|
-
state.buildInfoEmitPending = !useOldState ||
|
|
121663
|
-
state.changedFilesSet.size !== (((_b = oldState.changedFilesSet) === null || _b === void 0 ? void 0 : _b.size) || 0) ||
|
|
121664
|
-
state.fileInfos.size !== oldState.fileInfos.size;
|
|
121293
|
+
state.buildInfoEmitPending = !useOldState || state.changedFilesSet.size !== (((_b = oldState.changedFilesSet) === null || _b === void 0 ? void 0 : _b.size) || 0);
|
|
121665
121294
|
return state;
|
|
121666
121295
|
}
|
|
121667
|
-
function convertToDiagnostics(diagnostics, newProgram) {
|
|
121296
|
+
function convertToDiagnostics(diagnostics, newProgram, getCanonicalFileName) {
|
|
121668
121297
|
if (!diagnostics.length)
|
|
121669
121298
|
return ts.emptyArray;
|
|
121670
|
-
var buildInfoDirectory;
|
|
121671
|
-
var getCanonicalFileName;
|
|
121299
|
+
var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(ts.getTsBuildInfoEmitOutputFilePath(newProgram.getCompilerOptions()), newProgram.getCurrentDirectory()));
|
|
121672
121300
|
return diagnostics.map(function (diagnostic) {
|
|
121673
121301
|
var result = convertToDiagnosticRelatedInformation(diagnostic, newProgram, toPath);
|
|
121674
121302
|
result.reportsUnnecessary = diagnostic.reportsUnnecessary;
|
|
@@ -121684,8 +121312,7 @@ var ts;
|
|
|
121684
121312
|
return result;
|
|
121685
121313
|
});
|
|
121686
121314
|
function toPath(path) {
|
|
121687
|
-
|
|
121688
|
-
return ts.toPath(path, buildInfoDirectory, getCanonicalFileName !== null && getCanonicalFileName !== void 0 ? getCanonicalFileName : (getCanonicalFileName = ts.createGetCanonicalFileName(newProgram.useCaseSensitiveFileNames())));
|
|
121315
|
+
return ts.toPath(path, buildInfoDirectory, getCanonicalFileName);
|
|
121689
121316
|
}
|
|
121690
121317
|
}
|
|
121691
121318
|
function convertToDiagnosticRelatedInformation(diagnostic, newProgram, toPath) {
|
|
@@ -121697,9 +121324,6 @@ var ts;
|
|
|
121697
121324
|
*/
|
|
121698
121325
|
function releaseCache(state) {
|
|
121699
121326
|
ts.BuilderState.releaseCache(state);
|
|
121700
|
-
// Store the resolutions if possible
|
|
121701
|
-
if (!state.resuableCacheResolutions)
|
|
121702
|
-
getCacheResolutions(state);
|
|
121703
121327
|
state.program = undefined;
|
|
121704
121328
|
}
|
|
121705
121329
|
function backupBuilderProgramEmitState(state) {
|
|
@@ -121744,7 +121368,7 @@ var ts;
|
|
|
121744
121368
|
* This is to allow the callers to be able to actually remove affected file only when the operation is complete
|
|
121745
121369
|
* eg. if during diagnostics check cancellation token ends up cancelling the request, the affected file should be retained
|
|
121746
121370
|
*/
|
|
121747
|
-
function getNextAffectedFile(state, cancellationToken, host) {
|
|
121371
|
+
function getNextAffectedFile(state, cancellationToken, computeHash, getCanonicalFileName, host) {
|
|
121748
121372
|
var _a, _b;
|
|
121749
121373
|
while (true) {
|
|
121750
121374
|
var affectedFiles = state.affectedFiles;
|
|
@@ -121756,7 +121380,7 @@ var ts;
|
|
|
121756
121380
|
if (!seenAffectedFiles.has(affectedFile.resolvedPath)) {
|
|
121757
121381
|
// Set the next affected file as seen and remove the cached semantic diagnostics
|
|
121758
121382
|
state.affectedFilesIndex = affectedFilesIndex;
|
|
121759
|
-
handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, host);
|
|
121383
|
+
handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, getCanonicalFileName, host);
|
|
121760
121384
|
return affectedFile;
|
|
121761
121385
|
}
|
|
121762
121386
|
affectedFilesIndex++;
|
|
@@ -121784,7 +121408,7 @@ var ts;
|
|
|
121784
121408
|
return program;
|
|
121785
121409
|
}
|
|
121786
121410
|
// Get next batch of affected files
|
|
121787
|
-
state.affectedFiles = ts.BuilderState.getFilesAffectedByWithOldState(state, program, nextKey.value, cancellationToken,
|
|
121411
|
+
state.affectedFiles = ts.BuilderState.getFilesAffectedByWithOldState(state, program, nextKey.value, cancellationToken, computeHash, getCanonicalFileName);
|
|
121788
121412
|
state.currentChangedFilePath = nextKey.value;
|
|
121789
121413
|
state.affectedFilesIndex = 0;
|
|
121790
121414
|
if (!state.seenAffectedFiles)
|
|
@@ -121835,7 +121459,7 @@ var ts;
|
|
|
121835
121459
|
* Handles semantic diagnostics and dts emit for affectedFile and files, that are referencing modules that export entities from affected file
|
|
121836
121460
|
* This is because even though js emit doesnt change, dts emit / type used can change resulting in need for dts emit and js change
|
|
121837
121461
|
*/
|
|
121838
|
-
function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, host) {
|
|
121462
|
+
function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, getCanonicalFileName, host) {
|
|
121839
121463
|
removeSemanticDiagnosticsOf(state, affectedFile.resolvedPath);
|
|
121840
121464
|
// If affected files is everything except default library, then nothing more to do
|
|
121841
121465
|
if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles) {
|
|
@@ -121843,18 +121467,18 @@ var ts;
|
|
|
121843
121467
|
// When a change affects the global scope, all files are considered to be affected without updating their signature
|
|
121844
121468
|
// That means when affected file is handled, its signature can be out of date
|
|
121845
121469
|
// To avoid this, ensure that we update the signature for any affected file in this scenario.
|
|
121846
|
-
ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, cancellationToken,
|
|
121470
|
+
ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, cancellationToken, computeHash, getCanonicalFileName);
|
|
121847
121471
|
return;
|
|
121848
121472
|
}
|
|
121849
121473
|
if (state.compilerOptions.assumeChangesOnlyAffectDirectDependencies)
|
|
121850
121474
|
return;
|
|
121851
|
-
handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, host);
|
|
121475
|
+
handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, getCanonicalFileName, host);
|
|
121852
121476
|
}
|
|
121853
121477
|
/**
|
|
121854
121478
|
* Handle the dts may change, so they need to be added to pending emit if dts emit is enabled,
|
|
121855
121479
|
* Also we need to make sure signature is updated for these files
|
|
121856
121480
|
*/
|
|
121857
|
-
function handleDtsMayChangeOf(state, path, cancellationToken, host) {
|
|
121481
|
+
function handleDtsMayChangeOf(state, path, cancellationToken, computeHash, getCanonicalFileName, host) {
|
|
121858
121482
|
removeSemanticDiagnosticsOf(state, path);
|
|
121859
121483
|
if (!state.changedFilesSet.has(path)) {
|
|
121860
121484
|
var program = ts.Debug.checkDefined(state.program);
|
|
@@ -121865,7 +121489,7 @@ var ts;
|
|
|
121865
121489
|
// This ensures that we dont later during incremental builds considering wrong signature.
|
|
121866
121490
|
// Eg where this also is needed to ensure that .tsbuildinfo generated by incremental build should be same as if it was first fresh build
|
|
121867
121491
|
// But we avoid expensive full shape computation, as using file version as shape is enough for correctness.
|
|
121868
|
-
ts.BuilderState.updateShapeSignature(state, program, sourceFile, cancellationToken,
|
|
121492
|
+
ts.BuilderState.updateShapeSignature(state, program, sourceFile, cancellationToken, computeHash, getCanonicalFileName, !host.disableUseFileVersionAsSignature);
|
|
121869
121493
|
// If not dts emit, nothing more to do
|
|
121870
121494
|
if (ts.getEmitDeclarations(state.compilerOptions)) {
|
|
121871
121495
|
addToAffectedFilesPendingEmit(state, path, 0 /* DtsOnly */);
|
|
@@ -121890,20 +121514,20 @@ var ts;
|
|
|
121890
121514
|
var newSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
|
|
121891
121515
|
return newSignature !== oldSignature;
|
|
121892
121516
|
}
|
|
121893
|
-
function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, host) {
|
|
121517
|
+
function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, getCanonicalFileName, host) {
|
|
121894
121518
|
var _a;
|
|
121895
121519
|
if (!((_a = state.fileInfos.get(filePath)) === null || _a === void 0 ? void 0 : _a.affectsGlobalScope))
|
|
121896
121520
|
return false;
|
|
121897
121521
|
// Every file needs to be handled
|
|
121898
121522
|
ts.BuilderState.getAllFilesExcludingDefaultLibraryFile(state, state.program, /*firstSourceFile*/ undefined)
|
|
121899
|
-
.forEach(function (file) { return handleDtsMayChangeOf(state, file.resolvedPath, cancellationToken, host); });
|
|
121523
|
+
.forEach(function (file) { return handleDtsMayChangeOf(state, file.resolvedPath, cancellationToken, computeHash, getCanonicalFileName, host); });
|
|
121900
121524
|
removeDiagnosticsOfLibraryFiles(state);
|
|
121901
121525
|
return true;
|
|
121902
121526
|
}
|
|
121903
121527
|
/**
|
|
121904
121528
|
* Iterate on referencing modules that export entities from affected file and delete diagnostics and add pending emit
|
|
121905
121529
|
*/
|
|
121906
|
-
function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, host) {
|
|
121530
|
+
function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, getCanonicalFileName, host) {
|
|
121907
121531
|
var _a;
|
|
121908
121532
|
// If there was change in signature (dts output) for the changed file,
|
|
121909
121533
|
// then only we need to handle pending file emit
|
|
@@ -121921,9 +121545,9 @@ var ts;
|
|
|
121921
121545
|
var currentPath = queue.pop();
|
|
121922
121546
|
if (!seenFileNamesMap.has(currentPath)) {
|
|
121923
121547
|
seenFileNamesMap.set(currentPath, true);
|
|
121924
|
-
if (handleDtsMayChangeOfGlobalScope(state, currentPath, cancellationToken, host))
|
|
121548
|
+
if (handleDtsMayChangeOfGlobalScope(state, currentPath, cancellationToken, computeHash, getCanonicalFileName, host))
|
|
121925
121549
|
return;
|
|
121926
|
-
handleDtsMayChangeOf(state, currentPath, cancellationToken, host);
|
|
121550
|
+
handleDtsMayChangeOf(state, currentPath, cancellationToken, computeHash, getCanonicalFileName, host);
|
|
121927
121551
|
if (isChangedSignature(state, currentPath)) {
|
|
121928
121552
|
var currentSourceFile = ts.Debug.checkDefined(state.program).getSourceFileByPath(currentPath);
|
|
121929
121553
|
queue.push.apply(queue, ts.BuilderState.getReferencedByPaths(state, currentSourceFile.resolvedPath));
|
|
@@ -121935,11 +121559,11 @@ var ts;
|
|
|
121935
121559
|
// Go through exported modules from cache first
|
|
121936
121560
|
// If exported modules has path, all files referencing file exported from are affected
|
|
121937
121561
|
(_a = state.exportedModulesMap.getKeys(affectedFile.resolvedPath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
|
|
121938
|
-
if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, host))
|
|
121562
|
+
if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, computeHash, getCanonicalFileName, host))
|
|
121939
121563
|
return true;
|
|
121940
121564
|
var references = state.referencedMap.getKeys(exportedFromPath);
|
|
121941
121565
|
return references && ts.forEachKey(references, function (filePath) {
|
|
121942
|
-
return handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, host);
|
|
121566
|
+
return handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, getCanonicalFileName, host);
|
|
121943
121567
|
});
|
|
121944
121568
|
});
|
|
121945
121569
|
}
|
|
@@ -121947,22 +121571,22 @@ var ts;
|
|
|
121947
121571
|
* handle dts and semantic diagnostics on file and iterate on anything that exports this file
|
|
121948
121572
|
* return true when all work is done and we can exit handling dts emit and semantic diagnostics
|
|
121949
121573
|
*/
|
|
121950
|
-
function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, host) {
|
|
121574
|
+
function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, getCanonicalFileName, host) {
|
|
121951
121575
|
var _a, _b;
|
|
121952
121576
|
if (!ts.tryAddToSet(seenFileAndExportsOfFile, filePath))
|
|
121953
121577
|
return undefined;
|
|
121954
|
-
if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, host))
|
|
121578
|
+
if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, getCanonicalFileName, host))
|
|
121955
121579
|
return true;
|
|
121956
|
-
handleDtsMayChangeOf(state, filePath, cancellationToken, host);
|
|
121580
|
+
handleDtsMayChangeOf(state, filePath, cancellationToken, computeHash, getCanonicalFileName, host);
|
|
121957
121581
|
// If exported modules has path, all files referencing file exported from are affected
|
|
121958
121582
|
(_a = state.exportedModulesMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
|
|
121959
|
-
return handleDtsMayChangeOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, cancellationToken, host);
|
|
121583
|
+
return handleDtsMayChangeOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, cancellationToken, computeHash, getCanonicalFileName, host);
|
|
121960
121584
|
});
|
|
121961
121585
|
// Remove diagnostics of files that import this file (without going to exports of referencing files)
|
|
121962
121586
|
(_b = state.referencedMap.getKeys(filePath)) === null || _b === void 0 ? void 0 : _b.forEach(function (referencingFilePath) {
|
|
121963
121587
|
return !seenFileAndExportsOfFile.has(referencingFilePath) && // Not already removed diagnostic file
|
|
121964
121588
|
handleDtsMayChangeOf(// Dont add to seen since this is not yet done with the export removal
|
|
121965
|
-
state, referencingFilePath, cancellationToken, host);
|
|
121589
|
+
state, referencingFilePath, cancellationToken, computeHash, getCanonicalFileName, host);
|
|
121966
121590
|
});
|
|
121967
121591
|
return undefined;
|
|
121968
121592
|
}
|
|
@@ -122041,46 +121665,35 @@ var ts;
|
|
|
122041
121665
|
/**
|
|
122042
121666
|
* Gets the program information to be emitted in buildInfo so that we can use it to create new program
|
|
122043
121667
|
*/
|
|
122044
|
-
function getProgramBuildInfo(state,
|
|
121668
|
+
function getProgramBuildInfo(state, getCanonicalFileName) {
|
|
122045
121669
|
var outFilePath = ts.outFile(state.compilerOptions);
|
|
122046
|
-
if (outFilePath && !state.compilerOptions.composite
|
|
121670
|
+
if (outFilePath && !state.compilerOptions.composite)
|
|
122047
121671
|
return;
|
|
122048
121672
|
var currentDirectory = ts.Debug.checkDefined(state.program).getCurrentDirectory();
|
|
122049
|
-
var
|
|
122050
|
-
var buildInfoPath = ts.getNormalizedAbsolutePath(ts.getTsBuildInfoEmitOutputFilePath(state.compilerOptions), currentDirectory);
|
|
122051
|
-
var buildInfoDirectory = ts.getDirectoryPath(buildInfoPath);
|
|
121673
|
+
var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(ts.getTsBuildInfoEmitOutputFilePath(state.compilerOptions), currentDirectory));
|
|
122052
121674
|
// 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
|
|
122053
121675
|
var latestChangedDtsFile = state.latestChangedDtsFile ? relativeToBuildInfoEnsuringAbsolutePath(state.latestChangedDtsFile) : undefined;
|
|
122054
|
-
var fileNames = [];
|
|
122055
|
-
var fileNameToFileId = new ts.Map();
|
|
122056
|
-
var resolutions;
|
|
122057
|
-
var names;
|
|
122058
|
-
var resolutionNameToResolutionNameId;
|
|
122059
|
-
var resolutionEntries;
|
|
122060
|
-
var resolutionEntryToResolutionEntryId;
|
|
122061
|
-
var affectedFilesHash;
|
|
122062
121676
|
if (outFilePath) {
|
|
122063
|
-
var
|
|
122064
|
-
|
|
122065
|
-
|
|
122066
|
-
|
|
122067
|
-
|
|
122068
|
-
|
|
122069
|
-
|
|
122070
|
-
|
|
122071
|
-
|
|
122072
|
-
|
|
122073
|
-
|
|
122074
|
-
var result_16 = {
|
|
122075
|
-
fileNames: fileNames,
|
|
121677
|
+
var fileNames_1 = [];
|
|
121678
|
+
var fileInfos_1 = [];
|
|
121679
|
+
state.program.getRootFileNames().forEach(function (f) {
|
|
121680
|
+
var sourceFile = state.program.getSourceFile(f);
|
|
121681
|
+
if (!sourceFile)
|
|
121682
|
+
return;
|
|
121683
|
+
fileNames_1.push(relativeToBuildInfo(sourceFile.resolvedPath));
|
|
121684
|
+
fileInfos_1.push(sourceFile.version);
|
|
121685
|
+
});
|
|
121686
|
+
var result_15 = {
|
|
121687
|
+
fileNames: fileNames_1,
|
|
122076
121688
|
fileInfos: fileInfos_1,
|
|
122077
|
-
options:
|
|
121689
|
+
options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsBundleEmitBuildInfo"),
|
|
122078
121690
|
outSignature: state.outSignature,
|
|
122079
121691
|
latestChangedDtsFile: latestChangedDtsFile,
|
|
122080
|
-
cacheResolutions: cacheResolutions_1,
|
|
122081
121692
|
};
|
|
122082
|
-
return
|
|
121693
|
+
return result_15;
|
|
122083
121694
|
}
|
|
121695
|
+
var fileNames = [];
|
|
121696
|
+
var fileNameToFileId = new ts.Map();
|
|
122084
121697
|
var fileIdsList;
|
|
122085
121698
|
var fileNamesToFileIdListId;
|
|
122086
121699
|
var emitSignatures;
|
|
@@ -122144,7 +121757,7 @@ var ts;
|
|
|
122144
121757
|
(semanticDiagnosticsPerFile || (semanticDiagnosticsPerFile = [])).push(value.length ?
|
|
122145
121758
|
[
|
|
122146
121759
|
toFileId(key),
|
|
122147
|
-
value
|
|
121760
|
+
convertToReusableDiagnostics(value, relativeToBuildInfo)
|
|
122148
121761
|
] :
|
|
122149
121762
|
toFileId(key));
|
|
122150
121763
|
}
|
|
@@ -122166,11 +121779,10 @@ var ts;
|
|
|
122166
121779
|
(changeFileSet || (changeFileSet = [])).push(toFileId(path));
|
|
122167
121780
|
}
|
|
122168
121781
|
}
|
|
122169
|
-
var cacheResolutions = toProgramBuildInfoCacheResolutions();
|
|
122170
121782
|
var result = {
|
|
122171
121783
|
fileNames: fileNames,
|
|
122172
121784
|
fileInfos: fileInfos,
|
|
122173
|
-
options:
|
|
121785
|
+
options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsMultiFileEmitBuildInfo"),
|
|
122174
121786
|
fileIdsList: fileIdsList,
|
|
122175
121787
|
referencedMap: referencedMap,
|
|
122176
121788
|
exportedModulesMap: exportedModulesMap,
|
|
@@ -122179,7 +121791,6 @@ var ts;
|
|
|
122179
121791
|
changeFileSet: changeFileSet,
|
|
122180
121792
|
emitSignatures: emitSignatures,
|
|
122181
121793
|
latestChangedDtsFile: latestChangedDtsFile,
|
|
122182
|
-
cacheResolutions: cacheResolutions,
|
|
122183
121794
|
};
|
|
122184
121795
|
return result;
|
|
122185
121796
|
function relativeToBuildInfoEnsuringAbsolutePath(path) {
|
|
@@ -122188,7 +121799,7 @@ var ts;
|
|
|
122188
121799
|
function relativeToBuildInfo(path) {
|
|
122189
121800
|
return ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(buildInfoDirectory, path, getCanonicalFileName));
|
|
122190
121801
|
}
|
|
122191
|
-
function
|
|
121802
|
+
function toFileId(path) {
|
|
122192
121803
|
var fileId = fileNameToFileId.get(path);
|
|
122193
121804
|
if (fileId === undefined) {
|
|
122194
121805
|
fileNames.push(relativeToBuildInfo(path));
|
|
@@ -122196,12 +121807,6 @@ var ts;
|
|
|
122196
121807
|
}
|
|
122197
121808
|
return fileId;
|
|
122198
121809
|
}
|
|
122199
|
-
function toFileId(path) {
|
|
122200
|
-
return toFileAndAbsoluteFileId(path);
|
|
122201
|
-
}
|
|
122202
|
-
function toAbsoluteFileId(path) {
|
|
122203
|
-
return toFileAndAbsoluteFileId(ts.getNormalizedAbsolutePath(path, currentDirectory));
|
|
122204
|
-
}
|
|
122205
121810
|
function toFileIdListId(set) {
|
|
122206
121811
|
var fileIds = ts.arrayFrom(set.keys(), toFileId).sort(ts.compareValues);
|
|
122207
121812
|
var key = fileIds.join();
|
|
@@ -122214,241 +121819,54 @@ var ts;
|
|
|
122214
121819
|
}
|
|
122215
121820
|
/**
|
|
122216
121821
|
* @param optionKey key of CommandLineOption to use to determine if the option should be serialized in tsbuildinfo
|
|
122217
|
-
* @param affectsModuleResolution serialize options affecting module resolution
|
|
122218
121822
|
*/
|
|
122219
|
-
function
|
|
121823
|
+
function convertToProgramBuildInfoCompilerOptions(options, optionKey) {
|
|
122220
121824
|
var result;
|
|
122221
121825
|
var optionsNameMap = ts.getOptionsNameMap().optionsNameMap;
|
|
122222
121826
|
for (var _i = 0, _a = ts.getOwnKeys(options).sort(ts.compareStringsCaseSensitive); _i < _a.length; _i++) {
|
|
122223
121827
|
var name = _a[_i];
|
|
122224
121828
|
var optionInfo = optionsNameMap.get(name.toLowerCase());
|
|
122225
|
-
if (
|
|
122226
|
-
(result
|
|
122227
|
-
}
|
|
122228
|
-
else if (affectsModuleResolution && name === "pathsBasePath") {
|
|
122229
|
-
(result !== null && result !== void 0 ? result : (result = {})).pathsBasePath = relativeToBuildInfoEnsuringAbsolutePath(options.pathsBasePath);
|
|
122230
|
-
continue;
|
|
121829
|
+
if (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo[optionKey]) {
|
|
121830
|
+
(result || (result = {}))[name] = convertToReusableCompilerOptionValue(optionInfo, options[name], relativeToBuildInfoEnsuringAbsolutePath);
|
|
122231
121831
|
}
|
|
122232
121832
|
}
|
|
122233
121833
|
return result;
|
|
122234
121834
|
}
|
|
122235
|
-
|
|
122236
|
-
|
|
122237
|
-
|
|
122238
|
-
|
|
122239
|
-
|
|
122240
|
-
|
|
122241
|
-
|
|
122242
|
-
}
|
|
122243
|
-
else if (option.isFilePath) {
|
|
122244
|
-
return relativeToBuildInfoEnsuringAbsolutePath(value);
|
|
121835
|
+
}
|
|
121836
|
+
function convertToReusableCompilerOptionValue(option, value, relativeToBuildInfo) {
|
|
121837
|
+
if (option) {
|
|
121838
|
+
if (option.type === "list") {
|
|
121839
|
+
var values = value;
|
|
121840
|
+
if (option.element.isFilePath && values.length) {
|
|
121841
|
+
return values.map(relativeToBuildInfo);
|
|
122245
121842
|
}
|
|
122246
121843
|
}
|
|
122247
|
-
|
|
122248
|
-
|
|
122249
|
-
|
|
122250
|
-
return (array === null || array === void 0 ? void 0 : array.length) ? array.map(map) : undefined;
|
|
121844
|
+
else if (option.isFilePath) {
|
|
121845
|
+
return relativeToBuildInfo(value);
|
|
121846
|
+
}
|
|
122251
121847
|
}
|
|
122252
|
-
|
|
122253
|
-
|
|
121848
|
+
return value;
|
|
121849
|
+
}
|
|
121850
|
+
function convertToReusableDiagnostics(diagnostics, relativeToBuildInfo) {
|
|
121851
|
+
ts.Debug.assert(!!diagnostics.length);
|
|
121852
|
+
return diagnostics.map(function (diagnostic) {
|
|
121853
|
+
var result = convertToReusableDiagnosticRelatedInformation(diagnostic, relativeToBuildInfo);
|
|
122254
121854
|
result.reportsUnnecessary = diagnostic.reportsUnnecessary;
|
|
122255
121855
|
result.reportDeprecated = diagnostic.reportsDeprecated;
|
|
122256
121856
|
result.source = diagnostic.source;
|
|
122257
121857
|
result.skippedOn = diagnostic.skippedOn;
|
|
122258
121858
|
var relatedInformation = diagnostic.relatedInformation;
|
|
122259
|
-
result.relatedInformation = relatedInformation
|
|
122260
|
-
|
|
122261
|
-
|
|
122262
|
-
|
|
122263
|
-
|
|
122264
|
-
return __assign(__assign({}, diagnostic), { file: file ? relativeToBuildInfo(file.resolvedPath) : undefined });
|
|
122265
|
-
}
|
|
122266
|
-
function toProgramBuildInfoCacheResolutions() {
|
|
122267
|
-
var cacheResolutions = getCacheResolutions(state);
|
|
122268
|
-
var modules = toProgramBuildInfoResolutionCacheWithRedirects(cacheResolutions === null || cacheResolutions === void 0 ? void 0 : cacheResolutions.modules);
|
|
122269
|
-
var typeRefs = toProgramBuildInfoResolutionCacheWithRedirects(cacheResolutions === null || cacheResolutions === void 0 ? void 0 : cacheResolutions.typeRefs);
|
|
122270
|
-
if (!resolutions)
|
|
122271
|
-
return;
|
|
122272
|
-
ts.Debug.assertIsDefined(names);
|
|
122273
|
-
ts.Debug.assertIsDefined(resolutionEntries);
|
|
122274
|
-
state.resuableCacheResolutions = {
|
|
122275
|
-
cache: {
|
|
122276
|
-
resolutions: resolutions.map(toProgramBuildInfoResolution),
|
|
122277
|
-
names: names,
|
|
122278
|
-
hash: toProgramBuildInfoHashes(),
|
|
122279
|
-
resolutionEntries: resolutionEntries,
|
|
122280
|
-
modules: modules,
|
|
122281
|
-
typeRefs: typeRefs,
|
|
122282
|
-
},
|
|
122283
|
-
getProgramBuildInfoFilePathDecoder: ts.memoize(function () { return getProgramBuildInfoFilePathDecoder(fileNames, buildInfoPath, currentDirectory, getCanonicalFileName); })
|
|
122284
|
-
};
|
|
122285
|
-
return state.resuableCacheResolutions.cache;
|
|
122286
|
-
}
|
|
122287
|
-
function toProgramBuildInfoResolutionCacheWithRedirects(cache) {
|
|
122288
|
-
if (!cache)
|
|
122289
|
-
return undefined;
|
|
122290
|
-
var ownMap = cache.getOwnMap();
|
|
122291
|
-
var own = toProgramBuildInfoResolutionCache(ownMap);
|
|
122292
|
-
var redirects;
|
|
122293
|
-
cache.redirectsKeyToCache.forEach(function (_a) {
|
|
122294
|
-
var map = _a.map, options = _a.options;
|
|
122295
|
-
if (map === ownMap)
|
|
122296
|
-
return;
|
|
122297
|
-
var redirectCache = toProgramBuildInfoResolutionCache(map);
|
|
122298
|
-
if (redirectCache) {
|
|
122299
|
-
(redirects !== null && redirects !== void 0 ? redirects : (redirects = [])).push({
|
|
122300
|
-
options: toProgramBuildInfoCompilerOptions(options, /*optionKey*/ undefined, /*affectsModuleResolution*/ true),
|
|
122301
|
-
cache: redirectCache
|
|
122302
|
-
});
|
|
122303
|
-
}
|
|
122304
|
-
});
|
|
122305
|
-
return !redirects ? own : { own: own, redirects: redirects };
|
|
122306
|
-
}
|
|
122307
|
-
function toProgramBuildInfoResolutionCache(cache) {
|
|
122308
|
-
var result;
|
|
122309
|
-
cache === null || cache === void 0 ? void 0 : cache.forEach(function (dirCache, dirPath) { return dirCache.size() ?
|
|
122310
|
-
(result !== null && result !== void 0 ? result : (result = [])).push([
|
|
122311
|
-
toFileId(dirPath),
|
|
122312
|
-
ts.arrayFrom(dirCache.entries()).map(toProgramBuildInfoResolutionEntryId)
|
|
122313
|
-
]) :
|
|
122314
|
-
undefined; });
|
|
121859
|
+
result.relatedInformation = relatedInformation ?
|
|
121860
|
+
relatedInformation.length ?
|
|
121861
|
+
relatedInformation.map(function (r) { return convertToReusableDiagnosticRelatedInformation(r, relativeToBuildInfo); }) :
|
|
121862
|
+
[] :
|
|
121863
|
+
undefined;
|
|
122315
121864
|
return result;
|
|
122316
|
-
}
|
|
122317
|
-
function toProgramBuildInfoResolutionEntryId(_a) {
|
|
122318
|
-
var name = _a[0], mode = _a[1], resolution = _a[2];
|
|
122319
|
-
var resolutionNameId = toProgramBuildInfoResolutionNameId(name);
|
|
122320
|
-
var resolutionId = toProgramBuildInfoResolutionId(resolution);
|
|
122321
|
-
var key = resolutionNameId + "," + mode + "," + resolutionId;
|
|
122322
|
-
var resolutionEntryId = resolutionEntryToResolutionEntryId === null || resolutionEntryToResolutionEntryId === void 0 ? void 0 : resolutionEntryToResolutionEntryId.get(key);
|
|
122323
|
-
if (resolutionEntryId === undefined) {
|
|
122324
|
-
(resolutionEntries || (resolutionEntries = [])).push(mode ? [resolutionNameId, resolutionId, mode] : [resolutionNameId, resolutionId]);
|
|
122325
|
-
(resolutionEntryToResolutionEntryId || (resolutionEntryToResolutionEntryId = new ts.Map())).set(key, resolutionEntryId = resolutionEntries.length);
|
|
122326
|
-
}
|
|
122327
|
-
return resolutionEntryId;
|
|
122328
|
-
}
|
|
122329
|
-
function toProgramBuildInfoResolutionNameId(name) {
|
|
122330
|
-
var resolutionNameId = resolutionNameToResolutionNameId === null || resolutionNameToResolutionNameId === void 0 ? void 0 : resolutionNameToResolutionNameId.get(name);
|
|
122331
|
-
if (resolutionNameId === undefined) {
|
|
122332
|
-
(names !== null && names !== void 0 ? names : (names = [])).push(name);
|
|
122333
|
-
(resolutionNameToResolutionNameId !== null && resolutionNameToResolutionNameId !== void 0 ? resolutionNameToResolutionNameId : (resolutionNameToResolutionNameId = new ts.Map())).set(name, resolutionNameId = names.length);
|
|
122334
|
-
}
|
|
122335
|
-
return resolutionNameId;
|
|
122336
|
-
}
|
|
122337
|
-
function toProgramBuildInfoResolutionId(resolution) {
|
|
122338
|
-
if (resolution.serializationIndex === undefined) {
|
|
122339
|
-
(resolutions !== null && resolutions !== void 0 ? resolutions : (resolutions = [])).push(resolution);
|
|
122340
|
-
resolution.serializationIndex = resolutions.length;
|
|
122341
|
-
}
|
|
122342
|
-
return resolution.serializationIndex;
|
|
122343
|
-
}
|
|
122344
|
-
function toProgramBuildInfoResolution(resolution) {
|
|
122345
|
-
resolution.serializationIndex = undefined;
|
|
122346
|
-
return {
|
|
122347
|
-
resolvedModule: toProgramBuildInfoResolved(resolution.resolvedModule),
|
|
122348
|
-
resolvedTypeReferenceDirective: toProgramBuildInfoResolved(resolution.resolvedTypeReferenceDirective),
|
|
122349
|
-
affectingLocations: toReadonlyArrayOrUndefined(resolution.affectingLocations, toAffectedFileId),
|
|
122350
|
-
resolutionDiagnostics: toReadonlyArrayOrUndefined(resolution.resolutionDiagnostics, toProgramBuildInfoResolutionDiagnostic),
|
|
122351
|
-
};
|
|
122352
|
-
}
|
|
122353
|
-
function toProgramBuildInfoHashes() {
|
|
122354
|
-
if (!affectedFilesHash)
|
|
122355
|
-
return undefined;
|
|
122356
|
-
var hashes = [];
|
|
122357
|
-
for (var _i = 0, _a = ts.arrayFrom(affectedFilesHash.keys()).sort(ts.compareValues); _i < _a.length; _i++) {
|
|
122358
|
-
var key = _a[_i];
|
|
122359
|
-
var value = affectedFilesHash.get(key);
|
|
122360
|
-
hashes.push(value ? [key, value] : key);
|
|
122361
|
-
}
|
|
122362
|
-
return hashes;
|
|
122363
|
-
}
|
|
122364
|
-
function toAffectedFileId(file) {
|
|
122365
|
-
var _a;
|
|
122366
|
-
var fileId = toAbsoluteFileId(file);
|
|
122367
|
-
if (!(affectedFilesHash === null || affectedFilesHash === void 0 ? void 0 : affectedFilesHash.has(fileId))) {
|
|
122368
|
-
// Store the file hash
|
|
122369
|
-
var packageJsonInfo = (_a = state.program.getModuleResolutionCache()) === null || _a === void 0 ? void 0 : _a.getPackageJsonInfo(file);
|
|
122370
|
-
var text = typeof packageJsonInfo === "object" ? packageJsonInfo.packageJsonText : undefined;
|
|
122371
|
-
(affectedFilesHash !== null && affectedFilesHash !== void 0 ? affectedFilesHash : (affectedFilesHash = new ts.Map())).set(fileId, text ? computeSignature(text, host) : undefined);
|
|
122372
|
-
}
|
|
122373
|
-
return fileId;
|
|
122374
|
-
}
|
|
122375
|
-
function toProgramBuildInfoResolved(resolved) {
|
|
122376
|
-
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;
|
|
122377
|
-
}
|
|
122378
|
-
function toProgramBuildInfoResolutionDiagnostic(d) {
|
|
122379
|
-
return {
|
|
122380
|
-
isImports: d.isImports || undefined,
|
|
122381
|
-
entry: d.entry || undefined,
|
|
122382
|
-
packagePath: toAbsoluteFileId(d.packagePath),
|
|
122383
|
-
};
|
|
122384
|
-
}
|
|
122385
|
-
}
|
|
122386
|
-
function getCacheResolutions(state) {
|
|
122387
|
-
var _a;
|
|
122388
|
-
if (state.cacheResolutions || !state.compilerOptions.cacheResolutions)
|
|
122389
|
-
return state.cacheResolutions;
|
|
122390
|
-
var modules;
|
|
122391
|
-
var typeRefs;
|
|
122392
|
-
var moduleNameToDirectoryMap = ts.createCacheWithRedirects(state.compilerOptions);
|
|
122393
|
-
var getCanonicalFileName = ts.createGetCanonicalFileName(state.program.useCaseSensitiveFileNames());
|
|
122394
|
-
state.program.getSourceFiles().forEach(function (f) {
|
|
122395
|
-
modules = toPerDirectoryCache(state, getCanonicalFileName, modules, f, f.resolvedModules, moduleNameToDirectoryMap);
|
|
122396
|
-
typeRefs = toPerDirectoryCache(state, getCanonicalFileName, typeRefs, f, f.resolvedTypeReferenceDirectiveNames);
|
|
122397
121865
|
});
|
|
122398
|
-
var automaticTypeDirectiveNames = state.program.getAutomaticTypeDirectiveNames();
|
|
122399
|
-
if (automaticTypeDirectiveNames.length) {
|
|
122400
|
-
var currentDirectory = state.program.getCurrentDirectory();
|
|
122401
|
-
var containingPath = ts.toPath(state.program.getAutomaticTypeDirectiveContainingFile(), currentDirectory, getCanonicalFileName);
|
|
122402
|
-
typeRefs = toPerDirectoryCache(state, getCanonicalFileName, typeRefs, containingPath, state.program.getAutomaticTypeDirectiveResolutions());
|
|
122403
|
-
}
|
|
122404
|
-
return state.cacheResolutions = {
|
|
122405
|
-
modules: modules,
|
|
122406
|
-
typeRefs: typeRefs,
|
|
122407
|
-
moduleNameToDirectoryMap: moduleNameToDirectoryMap,
|
|
122408
|
-
packageJsonCache: (_a = state.program.getModuleResolutionCache()) === null || _a === void 0 ? void 0 : _a.getPackageJsonInfoCache().clone(),
|
|
122409
|
-
};
|
|
122410
121866
|
}
|
|
122411
|
-
function
|
|
122412
|
-
|
|
122413
|
-
|
|
122414
|
-
var dirPath, redirectedReference;
|
|
122415
|
-
if (!ts.isString(fOrPath)) {
|
|
122416
|
-
redirectedReference = state.program.getRedirectReferenceForResolution(fOrPath);
|
|
122417
|
-
dirPath = ts.getDirectoryPath(fOrPath.path);
|
|
122418
|
-
}
|
|
122419
|
-
else {
|
|
122420
|
-
dirPath = ts.getDirectoryPath(fOrPath);
|
|
122421
|
-
}
|
|
122422
|
-
var perDirResolutionCache = cacheWithRedirects === null || cacheWithRedirects === void 0 ? void 0 : cacheWithRedirects.getMapOfCacheRedirects(redirectedReference);
|
|
122423
|
-
var dirCache = perDirResolutionCache === null || perDirResolutionCache === void 0 ? void 0 : perDirResolutionCache.get(dirPath);
|
|
122424
|
-
cache.forEach(function (resolution, name, mode) {
|
|
122425
|
-
var _a, _b, _c, _d;
|
|
122426
|
-
if (!((_a = resolution.resolvedModule) === null || _a === void 0 ? void 0 : _a.resolvedFileName) && !((_b = resolution.resolvedTypeReferenceDirective) === null || _b === void 0 ? void 0 : _b.resolvedFileName))
|
|
122427
|
-
return;
|
|
122428
|
-
if (dirCache === null || dirCache === void 0 ? void 0 : dirCache.has(name, mode))
|
|
122429
|
-
return;
|
|
122430
|
-
// If there was already external module resolution that is same, set for child directory, dont set resolution for this directory
|
|
122431
|
-
if (moduleNameToDirectoryMap &&
|
|
122432
|
-
!ts.isExternalModuleNameRelative(name) &&
|
|
122433
|
-
((_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))) {
|
|
122434
|
-
return;
|
|
122435
|
-
}
|
|
122436
|
-
if (!dirCache) {
|
|
122437
|
-
perDirResolutionCache !== null && perDirResolutionCache !== void 0 ? perDirResolutionCache : (perDirResolutionCache = (cacheWithRedirects !== null && cacheWithRedirects !== void 0 ? cacheWithRedirects : (cacheWithRedirects = ts.createCacheWithRedirects(state.compilerOptions))).getOrCreateMapOfCacheRedirects(redirectedReference));
|
|
122438
|
-
perDirResolutionCache.set(dirPath, dirCache = ts.createModeAwareCache());
|
|
122439
|
-
}
|
|
122440
|
-
dirCache.set(name, mode, resolution);
|
|
122441
|
-
if (!moduleNameToDirectoryMap || ts.isExternalModuleNameRelative(name))
|
|
122442
|
-
return;
|
|
122443
|
-
// put result in per-module name cache and delete everything that is not needed
|
|
122444
|
-
var actualModuleNameToDirectoryMap = moduleNameToDirectoryMap.getOrCreateMapOfCacheRedirects(redirectedReference);
|
|
122445
|
-
var key = ts.getModeAwareCacheKey(name, mode);
|
|
122446
|
-
var directoryPathMap = actualModuleNameToDirectoryMap.get(key);
|
|
122447
|
-
if (!directoryPathMap)
|
|
122448
|
-
actualModuleNameToDirectoryMap.set(key, directoryPathMap = new ts.Map());
|
|
122449
|
-
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); });
|
|
122450
|
-
});
|
|
122451
|
-
return cacheWithRedirects;
|
|
121867
|
+
function convertToReusableDiagnosticRelatedInformation(diagnostic, relativeToBuildInfo) {
|
|
121868
|
+
var file = diagnostic.file;
|
|
121869
|
+
return __assign(__assign({}, diagnostic), { file: file ? relativeToBuildInfo(file.resolvedPath) : undefined });
|
|
122452
121870
|
}
|
|
122453
121871
|
var BuilderProgramKind;
|
|
122454
121872
|
(function (BuilderProgramKind) {
|
|
@@ -122472,7 +121890,7 @@ var ts;
|
|
|
122472
121890
|
rootNames: newProgramOrRootNames,
|
|
122473
121891
|
options: hostOrOptions,
|
|
122474
121892
|
host: oldProgramOrHost,
|
|
122475
|
-
oldProgram: oldProgram
|
|
121893
|
+
oldProgram: oldProgram && oldProgram.getProgramOrUndefined(),
|
|
122476
121894
|
configFileParsingDiagnostics: configFileParsingDiagnostics,
|
|
122477
121895
|
projectReferences: projectReferences
|
|
122478
121896
|
});
|
|
@@ -122490,8 +121908,8 @@ var ts;
|
|
|
122490
121908
|
function getTextHandlingSourceMapForSignature(text, data) {
|
|
122491
121909
|
return (data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text;
|
|
122492
121910
|
}
|
|
122493
|
-
function computeSignatureWithDiagnostics(sourceFile, text,
|
|
122494
|
-
var _a
|
|
121911
|
+
function computeSignatureWithDiagnostics(sourceFile, text, computeHash, getCanonicalFileName, data) {
|
|
121912
|
+
var _a;
|
|
122495
121913
|
text = getTextHandlingSourceMapForSignature(text, data);
|
|
122496
121914
|
var sourceFileDirectory;
|
|
122497
121915
|
if ((_a = data === null || data === void 0 ? void 0 : data.diagnostics) === null || _a === void 0 ? void 0 : _a.length) {
|
|
@@ -122499,7 +121917,7 @@ var ts;
|
|
|
122499
121917
|
return "" + locationInfo(diagnostic) + ts.DiagnosticCategory[diagnostic.category] + diagnostic.code + ": " + flattenDiagnosticMessageText(diagnostic.messageText);
|
|
122500
121918
|
}).join("\n");
|
|
122501
121919
|
}
|
|
122502
|
-
return (
|
|
121920
|
+
return (computeHash !== null && computeHash !== void 0 ? computeHash : ts.generateDjb2Hash)(text);
|
|
122503
121921
|
function flattenDiagnosticMessageText(diagnostic) {
|
|
122504
121922
|
return ts.isString(diagnostic) ?
|
|
122505
121923
|
diagnostic :
|
|
@@ -122518,9 +121936,8 @@ var ts;
|
|
|
122518
121936
|
}
|
|
122519
121937
|
}
|
|
122520
121938
|
ts.computeSignatureWithDiagnostics = computeSignatureWithDiagnostics;
|
|
122521
|
-
function computeSignature(text,
|
|
122522
|
-
|
|
122523
|
-
return ((_a = host.createHash) !== null && _a !== void 0 ? _a : ts.generateDjb2Hash)(getTextHandlingSourceMapForSignature(text, data));
|
|
121939
|
+
function computeSignature(text, computeHash, data) {
|
|
121940
|
+
return (computeHash !== null && computeHash !== void 0 ? computeHash : ts.generateDjb2Hash)(getTextHandlingSourceMapForSignature(text, data));
|
|
122524
121941
|
}
|
|
122525
121942
|
ts.computeSignature = computeSignature;
|
|
122526
121943
|
function createBuilderProgram(kind, _a) {
|
|
@@ -122532,8 +121949,16 @@ var ts;
|
|
|
122532
121949
|
oldState = undefined;
|
|
122533
121950
|
return oldProgram;
|
|
122534
121951
|
}
|
|
122535
|
-
|
|
122536
|
-
|
|
121952
|
+
/**
|
|
121953
|
+
* Create the canonical file name for identity
|
|
121954
|
+
*/
|
|
121955
|
+
var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
|
|
121956
|
+
/**
|
|
121957
|
+
* Computing hash to for signature verification
|
|
121958
|
+
*/
|
|
121959
|
+
var computeHash = ts.maybeBind(host, host.createHash);
|
|
121960
|
+
var state = createBuilderProgramState(newProgram, getCanonicalFileName, oldState, host.disableUseFileVersionAsSignature);
|
|
121961
|
+
newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName); };
|
|
122537
121962
|
// To ensure that we arent storing any references to old program or new program without state
|
|
122538
121963
|
newProgram = undefined; // TODO: GH#18217
|
|
122539
121964
|
oldProgram = undefined;
|
|
@@ -122548,7 +121973,6 @@ var ts;
|
|
|
122548
121973
|
builderProgram.getSemanticDiagnostics = getSemanticDiagnostics;
|
|
122549
121974
|
builderProgram.emit = emit;
|
|
122550
121975
|
builderProgram.releaseProgram = function () { return releaseCache(state); };
|
|
122551
|
-
builderProgram.getProgramOrOldBuildInfoProgramUndefined = createGetProgramOrOldBuildInfoProgramUndefined(state);
|
|
122552
121976
|
if (kind === BuilderProgramKind.SemanticDiagnosticsBuilderProgram) {
|
|
122553
121977
|
builderProgram.getSemanticDiagnosticsOfNextAffectedFile = getSemanticDiagnosticsOfNextAffectedFile;
|
|
122554
121978
|
}
|
|
@@ -122575,7 +121999,7 @@ var ts;
|
|
|
122575
121999
|
* in that order would be used to write the files
|
|
122576
122000
|
*/
|
|
122577
122001
|
function emitNextAffectedFile(writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) {
|
|
122578
|
-
var affected = getNextAffectedFile(state, cancellationToken, host);
|
|
122002
|
+
var affected = getNextAffectedFile(state, cancellationToken, computeHash, getCanonicalFileName, host);
|
|
122579
122003
|
var emitKind = 1 /* Full */;
|
|
122580
122004
|
var isPendingEmitFile = false;
|
|
122581
122005
|
if (!affected) {
|
|
@@ -122621,7 +122045,7 @@ var ts;
|
|
|
122621
122045
|
var file = sourceFiles[0];
|
|
122622
122046
|
var info = state.fileInfos.get(file.resolvedPath);
|
|
122623
122047
|
if (info.signature === file.version) {
|
|
122624
|
-
var signature = computeSignatureWithDiagnostics(file, text,
|
|
122048
|
+
var signature = computeSignatureWithDiagnostics(file, text, computeHash, getCanonicalFileName, data);
|
|
122625
122049
|
// 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
|
|
122626
122050
|
if (!((_a = data === null || data === void 0 ? void 0 : data.diagnostics) === null || _a === void 0 ? void 0 : _a.length))
|
|
122627
122051
|
emitSignature = signature;
|
|
@@ -122651,7 +122075,7 @@ var ts;
|
|
|
122651
122075
|
if (state.compilerOptions.composite) {
|
|
122652
122076
|
var filePath = sourceFiles[0].resolvedPath;
|
|
122653
122077
|
var oldSignature = (_f = state.emitSignatures) === null || _f === void 0 ? void 0 : _f.get(filePath);
|
|
122654
|
-
emitSignature !== null && emitSignature !== void 0 ? emitSignature : (emitSignature = computeSignature(text,
|
|
122078
|
+
emitSignature !== null && emitSignature !== void 0 ? emitSignature : (emitSignature = computeSignature(text, computeHash, data));
|
|
122655
122079
|
// Dont write dts files if they didn't change
|
|
122656
122080
|
if (emitSignature === oldSignature)
|
|
122657
122081
|
return;
|
|
@@ -122661,7 +122085,7 @@ var ts;
|
|
|
122661
122085
|
}
|
|
122662
122086
|
}
|
|
122663
122087
|
else if (state.compilerOptions.composite) {
|
|
122664
|
-
var newSignature = computeSignature(text,
|
|
122088
|
+
var newSignature = computeSignature(text, computeHash, data);
|
|
122665
122089
|
// Dont write dts files if they didn't change
|
|
122666
122090
|
if (newSignature === state.outSignature)
|
|
122667
122091
|
return;
|
|
@@ -122743,7 +122167,7 @@ var ts;
|
|
|
122743
122167
|
*/
|
|
122744
122168
|
function getSemanticDiagnosticsOfNextAffectedFile(cancellationToken, ignoreSourceFile) {
|
|
122745
122169
|
while (true) {
|
|
122746
|
-
var affected = getNextAffectedFile(state, cancellationToken, host);
|
|
122170
|
+
var affected = getNextAffectedFile(state, cancellationToken, computeHash, getCanonicalFileName, host);
|
|
122747
122171
|
if (!affected) {
|
|
122748
122172
|
// Done
|
|
122749
122173
|
return undefined;
|
|
@@ -122823,32 +122247,12 @@ var ts;
|
|
|
122823
122247
|
{ version: fileInfo.version, signature: fileInfo.signature === false ? undefined : fileInfo.version, affectsGlobalScope: fileInfo.affectsGlobalScope, impliedFormat: fileInfo.impliedFormat };
|
|
122824
122248
|
}
|
|
122825
122249
|
ts.toBuilderStateFileInfo = toBuilderStateFileInfo;
|
|
122826
|
-
function
|
|
122827
|
-
var
|
|
122828
|
-
var
|
|
122829
|
-
var
|
|
122830
|
-
return { toAbsolutePath: toAbsolutePath, toFilePath: toFilePath, toFileAbsolutePath: toFileAbsolutePath, currentDirectory: currentDirectory, getCanonicalFileName: getCanonicalFileName };
|
|
122831
|
-
function toPath(path) {
|
|
122832
|
-
return ts.toPath(path, buildInfoDirectory, getCanonicalFileName);
|
|
122833
|
-
}
|
|
122834
|
-
function toAbsolutePath(path) {
|
|
122835
|
-
return ts.getNormalizedAbsolutePath(path, buildInfoDirectory);
|
|
122836
|
-
}
|
|
122837
|
-
function toFilePath(fileId) {
|
|
122838
|
-
var _a;
|
|
122839
|
-
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]));
|
|
122840
|
-
}
|
|
122841
|
-
function toFileAbsolutePath(fileId) {
|
|
122842
|
-
var _a;
|
|
122843
|
-
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]));
|
|
122844
|
-
}
|
|
122845
|
-
}
|
|
122846
|
-
ts.getProgramBuildInfoFilePathDecoder = getProgramBuildInfoFilePathDecoder;
|
|
122847
|
-
function createBuilderProgramUsingProgramBuildInfo(program, buildInfoPath, host, configFilePath) {
|
|
122848
|
-
var _a, _b, _c;
|
|
122849
|
-
var buildInfoFilePathDecoder = getProgramBuildInfoFilePathDecoder(program.fileNames, buildInfoPath, host.getCurrentDirectory(), ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames()));
|
|
122850
|
-
var toFilePath = buildInfoFilePathDecoder.toFilePath, toAbsolutePath = buildInfoFilePathDecoder.toAbsolutePath;
|
|
122250
|
+
function createBuilderProgramUsingProgramBuildInfo(program, buildInfoPath, host) {
|
|
122251
|
+
var _a, _b, _c, _d;
|
|
122252
|
+
var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
|
|
122253
|
+
var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
|
|
122851
122254
|
var state;
|
|
122255
|
+
var filePaths;
|
|
122852
122256
|
var filePathsSetList;
|
|
122853
122257
|
var latestChangedDtsFile = program.latestChangedDtsFile ? toAbsolutePath(program.latestChangedDtsFile) : undefined;
|
|
122854
122258
|
if (isProgramBundleEmitBuildInfo(program)) {
|
|
@@ -122857,13 +122261,13 @@ var ts;
|
|
|
122857
122261
|
compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
|
|
122858
122262
|
latestChangedDtsFile: latestChangedDtsFile,
|
|
122859
122263
|
outSignature: program.outSignature,
|
|
122860
|
-
resuableCacheResolutions: toResuableCacheResolutions(),
|
|
122861
122264
|
};
|
|
122862
122265
|
}
|
|
122863
122266
|
else {
|
|
122864
|
-
|
|
122267
|
+
filePaths = (_a = program.fileNames) === null || _a === void 0 ? void 0 : _a.map(toPath);
|
|
122268
|
+
filePathsSetList = (_b = program.fileIdsList) === null || _b === void 0 ? void 0 : _b.map(function (fileIds) { return new ts.Set(fileIds.map(toFilePath)); });
|
|
122865
122269
|
var fileInfos_2 = new ts.Map();
|
|
122866
|
-
var emitSignatures_1 = ((
|
|
122270
|
+
var emitSignatures_1 = ((_c = program.options) === null || _c === void 0 ? void 0 : _c.composite) && !ts.outFile(program.options) ? new ts.Map() : undefined;
|
|
122867
122271
|
program.fileInfos.forEach(function (fileInfo, index) {
|
|
122868
122272
|
var path = toFilePath(index + 1);
|
|
122869
122273
|
var stateFileInfo = toBuilderStateFileInfo(fileInfo);
|
|
@@ -122871,7 +122275,7 @@ var ts;
|
|
|
122871
122275
|
if (emitSignatures_1 && stateFileInfo.signature)
|
|
122872
122276
|
emitSignatures_1.set(path, stateFileInfo.signature);
|
|
122873
122277
|
});
|
|
122874
|
-
(
|
|
122278
|
+
(_d = program.emitSignatures) === null || _d === void 0 ? void 0 : _d.forEach(function (value) {
|
|
122875
122279
|
if (ts.isNumber(value))
|
|
122876
122280
|
emitSignatures_1.delete(toFilePath(value));
|
|
122877
122281
|
else
|
|
@@ -122890,17 +122294,14 @@ var ts;
|
|
|
122890
122294
|
changedFilesSet: new ts.Set(ts.map(program.changeFileSet, toFilePath)),
|
|
122891
122295
|
latestChangedDtsFile: latestChangedDtsFile,
|
|
122892
122296
|
emitSignatures: (emitSignatures_1 === null || emitSignatures_1 === void 0 ? void 0 : emitSignatures_1.size) ? emitSignatures_1 : undefined,
|
|
122893
|
-
resuableCacheResolutions: toResuableCacheResolutions(),
|
|
122894
122297
|
};
|
|
122895
122298
|
}
|
|
122896
|
-
state.compilerOptions.configFilePath = configFilePath;
|
|
122897
122299
|
return {
|
|
122898
122300
|
getState: function () { return state; },
|
|
122899
122301
|
saveEmitState: ts.noop,
|
|
122900
122302
|
restoreEmitState: ts.noop,
|
|
122901
122303
|
getProgram: ts.notImplemented,
|
|
122902
122304
|
getProgramOrUndefined: ts.returnUndefined,
|
|
122903
|
-
getProgramOrOldBuildInfoProgramUndefined: createGetProgramOrOldBuildInfoProgramUndefined(state),
|
|
122904
122305
|
releaseProgram: ts.noop,
|
|
122905
122306
|
getCompilerOptions: function () { return state.compilerOptions; },
|
|
122906
122307
|
getSourceFile: ts.notImplemented,
|
|
@@ -122920,6 +122321,15 @@ var ts;
|
|
|
122920
122321
|
close: ts.noop,
|
|
122921
122322
|
hasChangedEmitSignature: ts.returnFalse,
|
|
122922
122323
|
};
|
|
122324
|
+
function toPath(path) {
|
|
122325
|
+
return ts.toPath(path, buildInfoDirectory, getCanonicalFileName);
|
|
122326
|
+
}
|
|
122327
|
+
function toAbsolutePath(path) {
|
|
122328
|
+
return ts.getNormalizedAbsolutePath(path, buildInfoDirectory);
|
|
122329
|
+
}
|
|
122330
|
+
function toFilePath(fileId) {
|
|
122331
|
+
return filePaths[fileId - 1];
|
|
122332
|
+
}
|
|
122923
122333
|
function toFilePathsSet(fileIdsListId) {
|
|
122924
122334
|
return filePathsSetList[fileIdsListId - 1];
|
|
122925
122335
|
}
|
|
@@ -122934,194 +122344,8 @@ var ts;
|
|
|
122934
122344
|
});
|
|
122935
122345
|
return map;
|
|
122936
122346
|
}
|
|
122937
|
-
function toResuableCacheResolutions() {
|
|
122938
|
-
return program.cacheResolutions && {
|
|
122939
|
-
cache: program.cacheResolutions,
|
|
122940
|
-
getProgramBuildInfoFilePathDecoder: function () { return buildInfoFilePathDecoder; },
|
|
122941
|
-
};
|
|
122942
|
-
}
|
|
122943
122347
|
}
|
|
122944
122348
|
ts.createBuilderProgramUsingProgramBuildInfo = createBuilderProgramUsingProgramBuildInfo;
|
|
122945
|
-
function createGetProgramOrOldBuildInfoProgramUndefined(state) {
|
|
122946
|
-
return function () {
|
|
122947
|
-
var _a;
|
|
122948
|
-
return (_a = state.program) !== null && _a !== void 0 ? _a : (state.cacheResolutions || state.resuableCacheResolutions ?
|
|
122949
|
-
(function (host) { return createOldBuildInfoProgram(host, state.compilerOptions, state.cacheResolutions,
|
|
122950
|
-
// Prefer cached resolutions over serialized format
|
|
122951
|
-
!state.cacheResolutions ? state.resuableCacheResolutions : undefined); }) :
|
|
122952
|
-
undefined);
|
|
122953
|
-
};
|
|
122954
|
-
}
|
|
122955
|
-
function createOldBuildInfoProgram(host, compilerOptions, cacheResolutions, resuableCacheResolutions) {
|
|
122956
|
-
if (!cacheResolutions && !resuableCacheResolutions)
|
|
122957
|
-
return undefined;
|
|
122958
|
-
var fileExistsMap = new ts.Map();
|
|
122959
|
-
var affectingLoationsSameMap = new ts.Map();
|
|
122960
|
-
var decodedResolvedModules = ts.createCacheWithRedirects(compilerOptions);
|
|
122961
|
-
var decodedResolvedTypeRefs = ts.createCacheWithRedirects(compilerOptions);
|
|
122962
|
-
var decodedModuleNameToDirectoryMap = ts.createCacheWithRedirects(compilerOptions);
|
|
122963
|
-
var decodedHashes;
|
|
122964
|
-
var resolutions;
|
|
122965
|
-
var originalPathOrResolvedFileNames;
|
|
122966
|
-
var resolutionEntries;
|
|
122967
|
-
return {
|
|
122968
|
-
getCompilerOptions: function () { return compilerOptions; },
|
|
122969
|
-
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); },
|
|
122970
|
-
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,
|
|
122971
|
-
/*moduleNameToDirectoryMap*/ undefined,
|
|
122972
|
-
/*decodedModuleNameToDirectoryMap*/ undefined); },
|
|
122973
|
-
};
|
|
122974
|
-
function fileExists(fileName) {
|
|
122975
|
-
var result = fileExistsMap.get(fileName);
|
|
122976
|
-
if (result === undefined)
|
|
122977
|
-
fileExistsMap.set(fileName, result = host.fileExists(fileName));
|
|
122978
|
-
return result;
|
|
122979
|
-
}
|
|
122980
|
-
function affectingLocationsSame(fileName, expected) {
|
|
122981
|
-
var _a;
|
|
122982
|
-
var result = affectingLoationsSameMap.get(fileName);
|
|
122983
|
-
if (result !== undefined)
|
|
122984
|
-
return result;
|
|
122985
|
-
var packageJsonInfo = host.getPackageJsonInfo(fileName);
|
|
122986
|
-
var currentText = typeof packageJsonInfo === "object" ? packageJsonInfo.packageJsonText : undefined;
|
|
122987
|
-
if (ts.isString(expected)) {
|
|
122988
|
-
result = !!currentText && ((_a = host.createHash) !== null && _a !== void 0 ? _a : ts.generateDjb2Hash)(currentText) === expected;
|
|
122989
|
-
}
|
|
122990
|
-
else {
|
|
122991
|
-
var expectedText = typeof expected === "object" ? expected.packageJsonText : undefined;
|
|
122992
|
-
result = currentText === expectedText;
|
|
122993
|
-
}
|
|
122994
|
-
affectingLoationsSameMap.set(fileName, result);
|
|
122995
|
-
return result;
|
|
122996
|
-
}
|
|
122997
|
-
function getResolvedFromCache(cache, reusableCache, decodedReusableCache, dirPath, name, mode, redirectedReference, moduleNameToDirectoryMap, decodedModuleNameToDirectoryMap) {
|
|
122998
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
122999
|
-
// If we are using the cache, directly get from there
|
|
123000
|
-
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)) ||
|
|
123001
|
-
((_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));
|
|
123002
|
-
if (fromCache) {
|
|
123003
|
-
return fileExists(((_e = fromCache.resolvedModule) === null || _e === void 0 ? void 0 : _e.resolvedFileName) ||
|
|
123004
|
-
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;
|
|
123005
|
-
}
|
|
123006
|
-
if (!reusableCache)
|
|
123007
|
-
return undefined;
|
|
123008
|
-
// Decode so we have maps for directories
|
|
123009
|
-
if (!decodedReusableCache.getOwnMap().size && !decodedReusableCache.redirectsKeyToCache.size) {
|
|
123010
|
-
if (ts.isArray(reusableCache)) {
|
|
123011
|
-
setBuildInfoResolutionEntries(decodedReusableCache, compilerOptions, /*optionsKey*/ undefined, reusableCache, decodedModuleNameToDirectoryMap);
|
|
123012
|
-
}
|
|
123013
|
-
else {
|
|
123014
|
-
if (reusableCache.own)
|
|
123015
|
-
setBuildInfoResolutionEntries(decodedReusableCache, compilerOptions, /*optionsKey*/ undefined, reusableCache.own, decodedModuleNameToDirectoryMap);
|
|
123016
|
-
reusableCache.redirects.forEach(function (_a) {
|
|
123017
|
-
var options = _a.options, cache = _a.cache;
|
|
123018
|
-
var compilerOptions = options ? ts.convertToOptionsWithAbsolutePaths(options, resuableCacheResolutions.getProgramBuildInfoFilePathDecoder().toAbsolutePath) : {};
|
|
123019
|
-
setBuildInfoResolutionEntries(decodedReusableCache, compilerOptions, ts.getRedirectsCacheKey(compilerOptions), cache, decodedModuleNameToDirectoryMap);
|
|
123020
|
-
});
|
|
123021
|
-
}
|
|
123022
|
-
// Ensure redirected reference verifies options before using redirects map
|
|
123023
|
-
decodedReusableCache.clearRedirectsMap();
|
|
123024
|
-
decodedModuleNameToDirectoryMap === null || decodedModuleNameToDirectoryMap === void 0 ? void 0 : decodedModuleNameToDirectoryMap.clearRedirectsMap();
|
|
123025
|
-
}
|
|
123026
|
-
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)) ||
|
|
123027
|
-
((_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));
|
|
123028
|
-
return resolutionId ? toResolution(resolutionId) : undefined;
|
|
123029
|
-
}
|
|
123030
|
-
function setBuildInfoResolutionEntries(decodedReusableCache, options, optionsKey, reusableCache, decodedModuleNameToDirectoryMap) {
|
|
123031
|
-
var map = decodedReusableCache.createMapForCompilerOptions(options, optionsKey);
|
|
123032
|
-
reusableCache.forEach(function (_a) {
|
|
123033
|
-
var dirId = _a[0], entryId = _a[1];
|
|
123034
|
-
var dirPath = resuableCacheResolutions.getProgramBuildInfoFilePathDecoder().toFilePath(dirId);
|
|
123035
|
-
map.set(dirPath, toModeAwareCache(entryId, dirPath, options, optionsKey, decodedModuleNameToDirectoryMap));
|
|
123036
|
-
});
|
|
123037
|
-
}
|
|
123038
|
-
function toModeAwareCache(entries, dirPath, options, optionsKey, decodedModuleNameToDirectoryMap) {
|
|
123039
|
-
var modeAwareCache = ts.createModeAwareCache();
|
|
123040
|
-
entries.forEach(function (entryId) {
|
|
123041
|
-
var _a = toResolutionEntry(entryId), name = _a[0], resolutionId = _a[1], mode = _a[2];
|
|
123042
|
-
modeAwareCache.set(name, mode, resolutionId);
|
|
123043
|
-
if (!decodedModuleNameToDirectoryMap || ts.isExternalModuleNameRelative(name))
|
|
123044
|
-
return;
|
|
123045
|
-
var mapForOptions = decodedModuleNameToDirectoryMap.createMapForCompilerOptions(options, optionsKey);
|
|
123046
|
-
var key = ts.getModeAwareCacheKey(name, mode);
|
|
123047
|
-
var moduleNameMap = mapForOptions.get(key);
|
|
123048
|
-
;
|
|
123049
|
-
if (!moduleNameMap)
|
|
123050
|
-
mapForOptions.set(key, moduleNameMap = new ts.Map());
|
|
123051
|
-
ts.moduleNameToDirectorySet(moduleNameMap, dirPath, resolutionId, toOriginalPathOrResolvedFileName, function (fileName) { return ts.toPath(fileName, resuableCacheResolutions.getProgramBuildInfoFilePathDecoder().currentDirectory, resuableCacheResolutions.getProgramBuildInfoFilePathDecoder().getCanonicalFileName); }, ts.noop);
|
|
123052
|
-
});
|
|
123053
|
-
return modeAwareCache;
|
|
123054
|
-
}
|
|
123055
|
-
function toResolutionEntry(entryId) {
|
|
123056
|
-
var existing = resolutionEntries === null || resolutionEntries === void 0 ? void 0 : resolutionEntries[entryId - 1];
|
|
123057
|
-
if (existing)
|
|
123058
|
-
return existing;
|
|
123059
|
-
resolutionEntries !== null && resolutionEntries !== void 0 ? resolutionEntries : (resolutionEntries = new Array(resuableCacheResolutions.cache.resolutionEntries.length));
|
|
123060
|
-
var _a = resuableCacheResolutions.cache.resolutionEntries[entryId - 1], nameId = _a[0], resolutionId = _a[1], mode = _a[2];
|
|
123061
|
-
return resolutionEntries[entryId - 1] = [
|
|
123062
|
-
toName(nameId),
|
|
123063
|
-
resolutionId,
|
|
123064
|
-
mode
|
|
123065
|
-
];
|
|
123066
|
-
}
|
|
123067
|
-
function toName(nameId) {
|
|
123068
|
-
return resuableCacheResolutions.cache.names[nameId - 1];
|
|
123069
|
-
}
|
|
123070
|
-
function toOriginalPathOrResolvedFileName(resolutionId) {
|
|
123071
|
-
var _a;
|
|
123072
|
-
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 ||
|
|
123073
|
-
resuableCacheResolutions.cache.resolutions[resolutionId - 1].resolvedModule.resolvedFileName));
|
|
123074
|
-
}
|
|
123075
|
-
function toAffectingFileLocation(fileId) {
|
|
123076
|
-
if (!decodedHashes && resuableCacheResolutions.cache.hash) {
|
|
123077
|
-
decodedHashes = ts.arrayToMap(resuableCacheResolutions.cache.hash, function (hash) { return ts.isArray(hash) ? hash[0] : hash; }, function (hash) { return ts.isArray(hash) ? hash[1] : undefined; });
|
|
123078
|
-
}
|
|
123079
|
-
var hash = decodedHashes === null || decodedHashes === void 0 ? void 0 : decodedHashes.get(fileId);
|
|
123080
|
-
var file = resuableCacheResolutions.getProgramBuildInfoFilePathDecoder().toFileAbsolutePath(fileId);
|
|
123081
|
-
return affectingLocationsSame(file, hash) ? file : undefined;
|
|
123082
|
-
}
|
|
123083
|
-
function toResolution(resolutionId) {
|
|
123084
|
-
var _a, _b;
|
|
123085
|
-
var existing = resolutions === null || resolutions === void 0 ? void 0 : resolutions[resolutionId - 1];
|
|
123086
|
-
if (existing !== undefined)
|
|
123087
|
-
return existing || undefined;
|
|
123088
|
-
resolutions !== null && resolutions !== void 0 ? resolutions : (resolutions = new Array(resuableCacheResolutions.cache.resolutions.length));
|
|
123089
|
-
var resolution = resuableCacheResolutions.cache.resolutions[resolutionId - 1];
|
|
123090
|
-
var resolvedFileName = resuableCacheResolutions.getProgramBuildInfoFilePathDecoder().toFileAbsolutePath(((_a = resolution.resolvedModule) === null || _a === void 0 ? void 0 : _a.resolvedFileName) || resolution.resolvedTypeReferenceDirective.resolvedFileName);
|
|
123091
|
-
var affectingLocations;
|
|
123092
|
-
if (fileExists(resolvedFileName) && ts.every(resolution.affectingLocations, function (fileId) {
|
|
123093
|
-
var file = toAffectingFileLocation(fileId);
|
|
123094
|
-
if (file)
|
|
123095
|
-
(affectingLocations !== null && affectingLocations !== void 0 ? affectingLocations : (affectingLocations = [])).push(file);
|
|
123096
|
-
return !!file;
|
|
123097
|
-
})) {
|
|
123098
|
-
// Type Ref doesnt need extension
|
|
123099
|
-
var extenstion = resolution.resolvedModule ? ts.extensionFromPath(resolvedFileName) : undefined;
|
|
123100
|
-
return resolutions[resolutionId - 1] = {
|
|
123101
|
-
resolvedModule: toResolved(resolution.resolvedModule, resolvedFileName, extenstion),
|
|
123102
|
-
resolvedTypeReferenceDirective: toResolved(resolution.resolvedTypeReferenceDirective, resolvedFileName, extenstion),
|
|
123103
|
-
failedLookupLocations: ts.emptyArray,
|
|
123104
|
-
affectingLocations: affectingLocations,
|
|
123105
|
-
resolutionDiagnostics: (_b = resolution.resolutionDiagnostics) === null || _b === void 0 ? void 0 : _b.map(toResolutionDiagnostic)
|
|
123106
|
-
};
|
|
123107
|
-
}
|
|
123108
|
-
resolutions[resolutionId - 1] = false;
|
|
123109
|
-
return undefined;
|
|
123110
|
-
}
|
|
123111
|
-
function toResolved(resolved, resolvedFileName, extension) {
|
|
123112
|
-
if (!resolved)
|
|
123113
|
-
return undefined;
|
|
123114
|
-
return __assign(__assign({}, resolved), { resolvedFileName: resolvedFileName, originalPath: resolved.originalPath ? resuableCacheResolutions.getProgramBuildInfoFilePathDecoder().toFileAbsolutePath(resolved.originalPath) : undefined, extension: extension });
|
|
123115
|
-
}
|
|
123116
|
-
function toResolutionDiagnostic(d) {
|
|
123117
|
-
return {
|
|
123118
|
-
isImports: !!d.isImports,
|
|
123119
|
-
entry: d.entry || "",
|
|
123120
|
-
packagePath: resuableCacheResolutions.getProgramBuildInfoFilePathDecoder().toFileAbsolutePath(d.packagePath)
|
|
123121
|
-
};
|
|
123122
|
-
}
|
|
123123
|
-
}
|
|
123124
|
-
ts.createOldBuildInfoProgram = createOldBuildInfoProgram;
|
|
123125
122349
|
function getBuildInfoFileVersionMap(program, buildInfoPath, host) {
|
|
123126
122350
|
var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
|
|
123127
122351
|
var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
|
|
@@ -123141,7 +122365,6 @@ var ts;
|
|
|
123141
122365
|
restoreEmitState: ts.noop,
|
|
123142
122366
|
getProgram: getProgram,
|
|
123143
122367
|
getProgramOrUndefined: function () { return getState().program; },
|
|
123144
|
-
getProgramOrOldBuildInfoProgramUndefined: function () { return getState().program; },
|
|
123145
122368
|
releaseProgram: function () { return getState().program = undefined; },
|
|
123146
122369
|
getCompilerOptions: function () { return getState().compilerOptions; },
|
|
123147
122370
|
getSourceFile: function (fileName) { return getProgram().getSourceFile(fileName); },
|
|
@@ -123240,10 +122463,11 @@ var ts;
|
|
|
123240
122463
|
function createResolutionCache(resolutionHost, rootDirForResolution, logChangesWhenResolvingModule) {
|
|
123241
122464
|
var filesWithChangedSetOfUnresolvedImports;
|
|
123242
122465
|
var filesWithInvalidatedResolutions;
|
|
122466
|
+
var filesWithInvalidatedNonRelativeUnresolvedImports;
|
|
122467
|
+
var nonRelativeExternalModuleResolutions = ts.createMultiMap();
|
|
123243
122468
|
var resolutionsWithFailedLookups = [];
|
|
123244
122469
|
var resolutionsWithOnlyAffectingLocations = [];
|
|
123245
122470
|
var resolvedFileToResolution = ts.createMultiMap();
|
|
123246
|
-
var resolutionsToCloseWatcherOn;
|
|
123247
122471
|
var hasChangedAutomaticTypeDirectiveNames = false;
|
|
123248
122472
|
var affectingPathChecks;
|
|
123249
122473
|
var failedLookupChecks;
|
|
@@ -123251,15 +122475,18 @@ var ts;
|
|
|
123251
122475
|
var isInDirectoryChecks;
|
|
123252
122476
|
var getCurrentDirectory = ts.memoize(function () { return resolutionHost.getCurrentDirectory(); }); // TODO: GH#18217
|
|
123253
122477
|
var cachedDirectoryStructureHost = resolutionHost.getCachedDirectoryStructureHost();
|
|
123254
|
-
var oldModuleAndTypeRefCache;
|
|
123255
122478
|
// The resolvedModuleNames and resolvedTypeReferenceDirectives are the cache of resolutions per file.
|
|
123256
122479
|
// The key in the map is source file's path.
|
|
123257
122480
|
// The values are Map of resolutions with key being name lookedup.
|
|
123258
122481
|
var resolvedModuleNames = new ts.Map();
|
|
123259
|
-
var
|
|
122482
|
+
var perDirectoryResolvedModuleNames = ts.createCacheWithRedirects();
|
|
122483
|
+
var nonRelativeModuleNameCache = ts.createCacheWithRedirects();
|
|
122484
|
+
var moduleResolutionCache = ts.createModuleResolutionCache(getCurrentDirectory(), resolutionHost.getCanonicalFileName,
|
|
122485
|
+
/*options*/ undefined, perDirectoryResolvedModuleNames, nonRelativeModuleNameCache);
|
|
123260
122486
|
var resolvedTypeReferenceDirectives = new ts.Map();
|
|
122487
|
+
var perDirectoryResolvedTypeReferenceDirectives = ts.createCacheWithRedirects();
|
|
123261
122488
|
var typeReferenceDirectiveResolutionCache = ts.createTypeReferenceDirectiveResolutionCache(getCurrentDirectory(), resolutionHost.getCanonicalFileName,
|
|
123262
|
-
/*options*/ undefined, moduleResolutionCache.getPackageJsonInfoCache());
|
|
122489
|
+
/*options*/ undefined, moduleResolutionCache.getPackageJsonInfoCache(), perDirectoryResolvedTypeReferenceDirectives);
|
|
123263
122490
|
/**
|
|
123264
122491
|
* These are the extensions that failed lookup files will have by default,
|
|
123265
122492
|
* any other extension of failed lookup will be store that path in custom failed lookup path
|
|
@@ -123276,23 +122503,26 @@ var ts;
|
|
|
123276
122503
|
// TypeRoot watches for the types that get added as part of getAutomaticTypeDirectiveNames
|
|
123277
122504
|
var typeRootsWatches = new ts.Map();
|
|
123278
122505
|
return {
|
|
123279
|
-
resolvedModuleNames: resolvedModuleNames,
|
|
123280
|
-
resolvedTypeReferenceDirectives: resolvedTypeReferenceDirectives,
|
|
123281
122506
|
getModuleResolutionCache: function () { return moduleResolutionCache; },
|
|
123282
|
-
getTypeReferenceDirectiveResolutionCache: function () { return typeReferenceDirectiveResolutionCache; },
|
|
123283
122507
|
startRecordingFilesWithChangedResolutions: startRecordingFilesWithChangedResolutions,
|
|
123284
122508
|
finishRecordingFilesWithChangedResolutions: finishRecordingFilesWithChangedResolutions,
|
|
123285
122509
|
// perDirectoryResolvedModuleNames and perDirectoryResolvedTypeReferenceDirectives could be non empty if there was exception during program update
|
|
123286
122510
|
// (between startCachingPerDirectoryResolution and finishCachingPerDirectoryResolution)
|
|
123287
|
-
startCachingPerDirectoryResolution:
|
|
122511
|
+
startCachingPerDirectoryResolution: clearPerDirectoryResolutions,
|
|
123288
122512
|
finishCachingPerDirectoryResolution: finishCachingPerDirectoryResolution,
|
|
123289
122513
|
resolveModuleNames: resolveModuleNames,
|
|
122514
|
+
getResolvedModuleWithFailedLookupLocationsFromCache: getResolvedModuleWithFailedLookupLocationsFromCache,
|
|
123290
122515
|
resolveTypeReferenceDirectives: resolveTypeReferenceDirectives,
|
|
122516
|
+
removeResolutionsFromProjectReferenceRedirects: removeResolutionsFromProjectReferenceRedirects,
|
|
122517
|
+
removeResolutionsOfFile: removeResolutionsOfFile,
|
|
123291
122518
|
hasChangedAutomaticTypeDirectiveNames: function () { return hasChangedAutomaticTypeDirectiveNames; },
|
|
123292
122519
|
invalidateResolutionOfFile: invalidateResolutionOfFile,
|
|
123293
122520
|
invalidateResolutionsOfFailedLookupLocations: invalidateResolutionsOfFailedLookupLocations,
|
|
123294
122521
|
setFilesWithInvalidatedNonRelativeUnresolvedImports: setFilesWithInvalidatedNonRelativeUnresolvedImports,
|
|
123295
122522
|
createHasInvalidatedResolution: createHasInvalidatedResolution,
|
|
122523
|
+
isFileWithInvalidatedNonRelativeUnresolvedImports: isFileWithInvalidatedNonRelativeUnresolvedImports,
|
|
122524
|
+
updateTypeRootsWatch: updateTypeRootsWatch,
|
|
122525
|
+
closeTypeRootsWatch: closeTypeRootsWatch,
|
|
123296
122526
|
clear: clear
|
|
123297
122527
|
};
|
|
123298
122528
|
function getResolvedModule(resolution) {
|
|
@@ -123311,6 +122541,7 @@ var ts;
|
|
|
123311
122541
|
ts.clearMap(directoryWatchesOfFailedLookups, ts.closeFileWatcherOf);
|
|
123312
122542
|
ts.clearMap(fileWatchesOfAffectingLocations, ts.closeFileWatcherOf);
|
|
123313
122543
|
customFailedLookupPaths.clear();
|
|
122544
|
+
nonRelativeExternalModuleResolutions.clear();
|
|
123314
122545
|
closeTypeRootsWatch();
|
|
123315
122546
|
resolvedModuleNames.clear();
|
|
123316
122547
|
resolvedTypeReferenceDirectives.clear();
|
|
@@ -123321,12 +122552,9 @@ var ts;
|
|
|
123321
122552
|
startsWithPathChecks = undefined;
|
|
123322
122553
|
isInDirectoryChecks = undefined;
|
|
123323
122554
|
affectingPathChecks = undefined;
|
|
123324
|
-
resolutionsToCloseWatcherOn = undefined;
|
|
123325
122555
|
// perDirectoryResolvedModuleNames and perDirectoryResolvedTypeReferenceDirectives could be non empty if there was exception during program update
|
|
123326
122556
|
// (between startCachingPerDirectoryResolution and finishCachingPerDirectoryResolution)
|
|
123327
|
-
|
|
123328
|
-
typeReferenceDirectiveResolutionCache.clear();
|
|
123329
|
-
oldModuleAndTypeRefCache = undefined;
|
|
122557
|
+
clearPerDirectoryResolutions();
|
|
123330
122558
|
hasChangedAutomaticTypeDirectiveNames = false;
|
|
123331
122559
|
}
|
|
123332
122560
|
function startRecordingFilesWithChangedResolutions() {
|
|
@@ -123337,6 +122565,14 @@ var ts;
|
|
|
123337
122565
|
filesWithChangedSetOfUnresolvedImports = undefined;
|
|
123338
122566
|
return collected;
|
|
123339
122567
|
}
|
|
122568
|
+
function isFileWithInvalidatedNonRelativeUnresolvedImports(path) {
|
|
122569
|
+
if (!filesWithInvalidatedNonRelativeUnresolvedImports) {
|
|
122570
|
+
return false;
|
|
122571
|
+
}
|
|
122572
|
+
// Invalidated if file has unresolved imports
|
|
122573
|
+
var value = filesWithInvalidatedNonRelativeUnresolvedImports.get(path);
|
|
122574
|
+
return !!value && !!value.length;
|
|
122575
|
+
}
|
|
123340
122576
|
function createHasInvalidatedResolution(forceAllFilesAsInvalidated) {
|
|
123341
122577
|
// Ensure pending resolutions are applied
|
|
123342
122578
|
invalidateResolutionsOfFailedLookupLocations();
|
|
@@ -123347,155 +122583,36 @@ var ts;
|
|
|
123347
122583
|
}
|
|
123348
122584
|
var collected = filesWithInvalidatedResolutions;
|
|
123349
122585
|
filesWithInvalidatedResolutions = undefined;
|
|
123350
|
-
return function (path) { return !!
|
|
122586
|
+
return function (path) { return (!!collected && collected.has(path)) ||
|
|
122587
|
+
isFileWithInvalidatedNonRelativeUnresolvedImports(path); };
|
|
123351
122588
|
}
|
|
123352
|
-
function
|
|
122589
|
+
function clearPerDirectoryResolutions() {
|
|
123353
122590
|
moduleResolutionCache.clear();
|
|
123354
122591
|
typeReferenceDirectiveResolutionCache.clear();
|
|
123355
|
-
|
|
123356
|
-
|
|
123357
|
-
if (oldModuleAndTypeRefCache) {
|
|
123358
|
-
oldModuleAndTypeRefCache.clearRedirectsMap();
|
|
123359
|
-
moduleResolutionCache.setOldResolutionCache(oldModuleAndTypeRefCache.modules);
|
|
123360
|
-
typeReferenceDirectiveResolutionCache.setOldResolutionCache(oldModuleAndTypeRefCache.typeRefs);
|
|
123361
|
-
}
|
|
122592
|
+
nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfNonRelativeModuleResolutions);
|
|
122593
|
+
nonRelativeExternalModuleResolutions.clear();
|
|
123362
122594
|
}
|
|
123363
|
-
function finishCachingPerDirectoryResolution(
|
|
122595
|
+
function finishCachingPerDirectoryResolution() {
|
|
122596
|
+
filesWithInvalidatedNonRelativeUnresolvedImports = undefined;
|
|
122597
|
+
clearPerDirectoryResolutions();
|
|
122598
|
+
directoryWatchesOfFailedLookups.forEach(function (watcher, path) {
|
|
122599
|
+
if (watcher.refCount === 0) {
|
|
122600
|
+
directoryWatchesOfFailedLookups.delete(path);
|
|
122601
|
+
watcher.watcher.close();
|
|
122602
|
+
}
|
|
122603
|
+
});
|
|
122604
|
+
fileWatchesOfAffectingLocations.forEach(function (watcher, path) {
|
|
122605
|
+
if (watcher.refCount === 0) {
|
|
122606
|
+
fileWatchesOfAffectingLocations.delete(path);
|
|
122607
|
+
watcher.watcher.close();
|
|
122608
|
+
// Ensure when watching symlinked package.json, we can close the actual file watcher only once
|
|
122609
|
+
watcher.watcher = ts.noopFileWatcher;
|
|
122610
|
+
}
|
|
122611
|
+
});
|
|
123364
122612
|
hasChangedAutomaticTypeDirectiveNames = false;
|
|
123365
|
-
if (!newProgram) {
|
|
123366
|
-
clear();
|
|
123367
|
-
return;
|
|
123368
|
-
}
|
|
123369
|
-
if (newProgram === oldProgram || newProgram.structureIsReused === 3 /* Completely */)
|
|
123370
|
-
return;
|
|
123371
|
-
var modules;
|
|
123372
|
-
var typeRefs;
|
|
123373
|
-
var moduleNameToDirectoryMap = ts.createCacheWithRedirects(newProgram.getCompilerOptions());
|
|
123374
|
-
// Update resolution caches
|
|
123375
|
-
for (var _i = 0, _a = newProgram.getSourceFiles(); _i < _a.length; _i++) {
|
|
123376
|
-
var f = _a[_i];
|
|
123377
|
-
modules = ensureResolutionsOfFile(newProgram, resolvedModuleNames, f.resolvedModules, f, getResolvedModule, modules, moduleNameToDirectoryMap);
|
|
123378
|
-
typeRefs = ensureResolutionsOfFile(newProgram, resolvedTypeReferenceDirectives, f.resolvedTypeReferenceDirectiveNames, f, getResolvedTypeReferenceDirective, typeRefs,
|
|
123379
|
-
/*moduleNameToDirectoryMap*/ undefined);
|
|
123380
|
-
}
|
|
123381
|
-
var newProgramAutoTypeRefContainingFile = resolutionHost.toPath(newProgram.getAutomaticTypeDirectiveContainingFile());
|
|
123382
|
-
typeRefs = ensureResolutionsOfFile(newProgram, resolvedTypeReferenceDirectives, newProgram.getAutomaticTypeDirectiveResolutions(), newProgramAutoTypeRefContainingFile, getResolvedTypeReferenceDirective, typeRefs,
|
|
123383
|
-
/*moduleNameToDirectoryMap*/ undefined);
|
|
123384
|
-
if (!modules && !typeRefs) {
|
|
123385
|
-
oldModuleAndTypeRefCache = undefined;
|
|
123386
|
-
}
|
|
123387
|
-
else {
|
|
123388
|
-
oldModuleAndTypeRefCache = getOldResolutionCache(modules, typeRefs, moduleNameToDirectoryMap);
|
|
123389
|
-
}
|
|
123390
|
-
// Remove resolutions for files not in the program
|
|
123391
|
-
if (oldProgram) {
|
|
123392
|
-
for (var _b = 0, _c = oldProgram.getSourceFiles(); _b < _c.length; _b++) {
|
|
123393
|
-
var f = _c[_b];
|
|
123394
|
-
if (!newProgram.getSourceFileByPath(f.path))
|
|
123395
|
-
removeResolutionsOfFile(f.path);
|
|
123396
|
-
}
|
|
123397
|
-
var oldProgramAutoTypeRefContainingFile = resolutionHost.toPath(oldProgram.getAutomaticTypeDirectiveContainingFile());
|
|
123398
|
-
if (oldProgramAutoTypeRefContainingFile !== newProgramAutoTypeRefContainingFile) {
|
|
123399
|
-
removeResolutionsOfFile(oldProgramAutoTypeRefContainingFile);
|
|
123400
|
-
}
|
|
123401
|
-
}
|
|
123402
|
-
if (!oldProgram || newProgram.getCompilerOptions() !== oldProgram.getCompilerOptions())
|
|
123403
|
-
updateTypeRootsWatch();
|
|
123404
|
-
// Remove symlinked watchers that have zero ref count
|
|
123405
|
-
resolutionsToCloseWatcherOn === null || resolutionsToCloseWatcherOn === void 0 ? void 0 : resolutionsToCloseWatcherOn.forEach(closeWatchersOfResolution);
|
|
123406
|
-
resolutionsToCloseWatcherOn = undefined;
|
|
123407
|
-
fileWatchesOfAffectingLocations.forEach(closeAffectingFileWatcher);
|
|
123408
|
-
}
|
|
123409
|
-
function closeAffectingFileWatcher(watcher, path) {
|
|
123410
|
-
if (watcher.refCount === 0) {
|
|
123411
|
-
fileWatchesOfAffectingLocations.delete(path);
|
|
123412
|
-
watcher.watcher.close();
|
|
123413
|
-
// Ensure when watching symlinked package.json, we can close the actual file watcher only once
|
|
123414
|
-
watcher.watcher = ts.noopFileWatcher;
|
|
123415
|
-
}
|
|
123416
|
-
}
|
|
123417
|
-
function ensureResolutionsOfFile(newProgram, perFileCache, fileCacheFromProgram, sourceFileOrPath, getResolutionWithResolvedFileName, perDirCache, moduleNameToDirectoryMap) {
|
|
123418
|
-
var path = !ts.isString(sourceFileOrPath) ? sourceFileOrPath.path : sourceFileOrPath;
|
|
123419
|
-
var resolutionsInFile = perFileCache.get(path);
|
|
123420
|
-
var seenNamesInFile = ts.createModeAwareCache();
|
|
123421
|
-
if (fileCacheFromProgram === null || fileCacheFromProgram === void 0 ? void 0 : fileCacheFromProgram.size()) {
|
|
123422
|
-
// If keys dont match release existing resolutions
|
|
123423
|
-
var redirectedReference = !ts.isString(sourceFileOrPath) ? newProgram.getRedirectReferenceForResolution(sourceFileOrPath) : undefined;
|
|
123424
|
-
var options_3 = (redirectedReference === null || redirectedReference === void 0 ? void 0 : redirectedReference.commandLine.options) || newProgram.getCompilerOptions();
|
|
123425
|
-
var key_2 = ts.getRedirectsCacheKey(options_3);
|
|
123426
|
-
if (resolutionsInFile && resolutionsInFile.key !== key_2) {
|
|
123427
|
-
resolutionsInFile.cache.forEach(function (r) { return stopWatchingResolution(r, path, getResolutionWithResolvedFileName); });
|
|
123428
|
-
resolutionsInFile = undefined;
|
|
123429
|
-
}
|
|
123430
|
-
var dirPath_1 = ts.getDirectoryPath(path);
|
|
123431
|
-
var perDirResolutionCache_1 = perDirCache === null || perDirCache === void 0 ? void 0 : perDirCache.getMapOfCacheRedirects(redirectedReference);
|
|
123432
|
-
var cacheForDir_1 = perDirResolutionCache_1 === null || perDirResolutionCache_1 === void 0 ? void 0 : perDirResolutionCache_1.get(dirPath_1);
|
|
123433
|
-
fileCacheFromProgram.forEach(function (r, name, mode) {
|
|
123434
|
-
seenNamesInFile.set(name, mode, true);
|
|
123435
|
-
var existing = resolutionsInFile === null || resolutionsInFile === void 0 ? void 0 : resolutionsInFile.cache.get(name, mode);
|
|
123436
|
-
if (existing && r !== existing)
|
|
123437
|
-
stopWatchingResolution(existing, path, getResolutionWithResolvedFileName);
|
|
123438
|
-
watchResolution(newProgram, name, r, path, getResolutionWithResolvedFileName);
|
|
123439
|
-
if (!resolutionsInFile)
|
|
123440
|
-
perFileCache.set(path, resolutionsInFile = { key: key_2, cache: ts.createModeAwareCache() });
|
|
123441
|
-
resolutionsInFile.cache.set(name, mode, r);
|
|
123442
|
-
if (cacheForDir_1 === null || cacheForDir_1 === void 0 ? void 0 : cacheForDir_1.has(name, mode))
|
|
123443
|
-
return;
|
|
123444
|
-
if (!cacheForDir_1) {
|
|
123445
|
-
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));
|
|
123446
|
-
perDirResolutionCache_1.set(dirPath_1, cacheForDir_1 = ts.createModeAwareCache());
|
|
123447
|
-
}
|
|
123448
|
-
cacheForDir_1.set(name, mode, r);
|
|
123449
|
-
if (!moduleNameToDirectoryMap || ts.isExternalModuleNameRelative(name))
|
|
123450
|
-
return;
|
|
123451
|
-
var actualModuleNameToDirectoryMap = moduleNameToDirectoryMap.createMapForCompilerOptions(options_3, key_2);
|
|
123452
|
-
var modeAwareCacheKey = ts.getModeAwareCacheKey(name, mode);
|
|
123453
|
-
var directoryPathMap = actualModuleNameToDirectoryMap.get(modeAwareCacheKey);
|
|
123454
|
-
if (!directoryPathMap)
|
|
123455
|
-
actualModuleNameToDirectoryMap.set(modeAwareCacheKey, directoryPathMap = new ts.Map());
|
|
123456
|
-
ts.moduleNameToDirectorySet(directoryPathMap, dirPath_1, r, ts.getResolvedFileNameForModuleNameToDirectorySet, function (dir) { return resolutionHost.toPath(dir); }, ts.noop);
|
|
123457
|
-
});
|
|
123458
|
-
}
|
|
123459
|
-
if (((resolutionsInFile === null || resolutionsInFile === void 0 ? void 0 : resolutionsInFile.cache.size()) || 0) !== seenNamesInFile.size()) {
|
|
123460
|
-
// Stop watching and remove the unused name
|
|
123461
|
-
resolutionsInFile.cache.forEach(function (resolution, name, mode) {
|
|
123462
|
-
if (!seenNamesInFile.has(name, mode)) {
|
|
123463
|
-
stopWatchingResolution(resolution, path, getResolutionWithResolvedFileName);
|
|
123464
|
-
resolutionsInFile.cache.delete(name, mode);
|
|
123465
|
-
}
|
|
123466
|
-
});
|
|
123467
|
-
if (!(resolutionsInFile === null || resolutionsInFile === void 0 ? void 0 : resolutionsInFile.cache.size))
|
|
123468
|
-
perFileCache.delete(path);
|
|
123469
|
-
}
|
|
123470
|
-
return perDirCache;
|
|
123471
|
-
}
|
|
123472
|
-
function getOldResolutionCache(modules, typeRefs, moduleNameToDirectoryMap) {
|
|
123473
|
-
if (!modules && !typeRefs)
|
|
123474
|
-
return undefined;
|
|
123475
|
-
return {
|
|
123476
|
-
modules: {
|
|
123477
|
-
getResolved: function (dirPath, name, mode, redirectedReference) { return getResolvedWithOldCache(dirPath, name, mode, redirectedReference, modules, moduleNameToDirectoryMap); }
|
|
123478
|
-
},
|
|
123479
|
-
typeRefs: {
|
|
123480
|
-
getResolved: function (dirPath, name, mode, redirectedReference) { return getResolvedWithOldCache(dirPath, name, mode, redirectedReference, typeRefs, /*moduleNameToDirectoryMap*/ undefined); }
|
|
123481
|
-
},
|
|
123482
|
-
clearRedirectsMap: function () {
|
|
123483
|
-
modules === null || modules === void 0 ? void 0 : modules.clearRedirectsMap();
|
|
123484
|
-
typeRefs === null || typeRefs === void 0 ? void 0 : typeRefs.clearRedirectsMap();
|
|
123485
|
-
moduleNameToDirectoryMap.clearRedirectsMap();
|
|
123486
|
-
},
|
|
123487
|
-
};
|
|
123488
|
-
}
|
|
123489
|
-
function getResolvedWithOldCache(dirPath, name, mode, redirectedReference, perDirCache, moduleNameToDirectoryMap) {
|
|
123490
|
-
var _a, _b, _c, _d;
|
|
123491
|
-
if (!perDirCache)
|
|
123492
|
-
return undefined;
|
|
123493
|
-
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)) ||
|
|
123494
|
-
((_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));
|
|
123495
|
-
return result && !result.isInvalidated ? result : undefined;
|
|
123496
122613
|
}
|
|
123497
122614
|
function resolveModuleName(moduleName, containingFile, compilerOptions, host, redirectedReference, _containingSourceFile, mode) {
|
|
123498
|
-
var _a;
|
|
122615
|
+
var _a, _b;
|
|
123499
122616
|
var primaryResult = ts.resolveModuleName(moduleName, containingFile, compilerOptions, host, moduleResolutionCache, redirectedReference, mode);
|
|
123500
122617
|
// return result immediately only if global cache support is not enabled or if it is .ts, .tsx or .d.ts
|
|
123501
122618
|
if (!resolutionHost.getGlobalCache) {
|
|
@@ -123506,16 +122623,12 @@ var ts;
|
|
|
123506
122623
|
if (globalCache !== undefined && !ts.isExternalModuleNameRelative(moduleName) && !(primaryResult.resolvedModule && ts.extensionIsTS(primaryResult.resolvedModule.extension))) {
|
|
123507
122624
|
// create different collection of failed lookup locations for second pass
|
|
123508
122625
|
// if it will fail and we've already found something during the first pass - we don't want to pollute its results
|
|
123509
|
-
var
|
|
122626
|
+
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;
|
|
123510
122627
|
if (resolvedModule) {
|
|
123511
122628
|
// Modify existing resolution so its saved in the directory cache as well
|
|
123512
122629
|
primaryResult.resolvedModule = resolvedModule;
|
|
123513
|
-
|
|
123514
|
-
|
|
123515
|
-
else
|
|
123516
|
-
primaryResult.failedLookupLocations.length = 0;
|
|
123517
|
-
primaryResult.affectingLocations = ts.updateResolutionField(primaryResult.affectingLocations, affectingLocations);
|
|
123518
|
-
primaryResult.resolutionDiagnostics = ts.updateResolutionField(primaryResult.resolutionDiagnostics, resolutionDiagnostics);
|
|
122630
|
+
(_a = primaryResult.failedLookupLocations).push.apply(_a, failedLookupLocations);
|
|
122631
|
+
(_b = primaryResult.affectingLocations).push.apply(_b, affectingLocations);
|
|
123519
122632
|
return primaryResult;
|
|
123520
122633
|
}
|
|
123521
122634
|
}
|
|
@@ -123526,41 +122639,76 @@ var ts;
|
|
|
123526
122639
|
return ts.resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host, redirectedReference, typeReferenceDirectiveResolutionCache, resolutionMode);
|
|
123527
122640
|
}
|
|
123528
122641
|
function resolveNamesWithLocalCache(_a) {
|
|
123529
|
-
var _b, _c, _d
|
|
123530
|
-
var names = _a.names, containingFile = _a.containingFile, redirectedReference = _a.redirectedReference,
|
|
122642
|
+
var _b, _c, _d;
|
|
122643
|
+
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;
|
|
123531
122644
|
var path = resolutionHost.toPath(containingFile);
|
|
123532
|
-
var resolutionsInFile =
|
|
123533
|
-
var
|
|
123534
|
-
var
|
|
123535
|
-
|
|
123536
|
-
|
|
123537
|
-
|
|
122645
|
+
var resolutionsInFile = cache.get(path) || cache.set(path, ts.createModeAwareCache()).get(path);
|
|
122646
|
+
var dirPath = ts.getDirectoryPath(path);
|
|
122647
|
+
var perDirectoryCache = perDirectoryCacheWithRedirects.getOrCreateMapOfCacheRedirects(redirectedReference);
|
|
122648
|
+
var perDirectoryResolution = perDirectoryCache.get(dirPath);
|
|
122649
|
+
if (!perDirectoryResolution) {
|
|
122650
|
+
perDirectoryResolution = ts.createModeAwareCache();
|
|
122651
|
+
perDirectoryCache.set(dirPath, perDirectoryResolution);
|
|
123538
122652
|
}
|
|
123539
122653
|
var resolvedModules = [];
|
|
122654
|
+
var compilerOptions = resolutionHost.getCompilationSettings();
|
|
122655
|
+
var hasInvalidatedNonRelativeUnresolvedImport = logChanges && isFileWithInvalidatedNonRelativeUnresolvedImports(path);
|
|
122656
|
+
// All the resolutions in this file are invalidated if this file wasn't resolved using same redirect
|
|
122657
|
+
var program = resolutionHost.getCurrentProgram();
|
|
122658
|
+
var oldRedirect = program && program.getResolvedProjectReferenceToRedirect(containingFile);
|
|
122659
|
+
var unmatchedRedirects = oldRedirect ?
|
|
122660
|
+
!redirectedReference || redirectedReference.sourceFile.path !== oldRedirect.sourceFile.path :
|
|
122661
|
+
!!redirectedReference;
|
|
123540
122662
|
var seenNamesInFile = ts.createModeAwareCache();
|
|
123541
122663
|
var i = 0;
|
|
123542
|
-
for (var _i = 0,
|
|
123543
|
-
var entry =
|
|
123544
|
-
var name = ts.isString(entry) ? entry :
|
|
122664
|
+
for (var _i = 0, names_5 = names; _i < names_5.length; _i++) {
|
|
122665
|
+
var entry = names_5[_i];
|
|
122666
|
+
var name = ts.isString(entry) ? entry : entry.fileName.toLowerCase();
|
|
123545
122667
|
// Imports supply a `containingSourceFile` but no `containingSourceFileMode` - it would be redundant
|
|
123546
122668
|
// they require calculating the mode for a given import from it's position in the resolution table, since a given
|
|
123547
122669
|
// import's syntax may override the file's default mode.
|
|
123548
122670
|
// Type references instead supply a `containingSourceFileMode` and a non-string entry which contains
|
|
123549
122671
|
// a default file mode override if applicable.
|
|
123550
122672
|
var mode = !ts.isString(entry) ? ts.getModeForFileReference(entry, containingSourceFileMode) :
|
|
123551
|
-
containingSourceFile ? ts.getModeForResolutionAtIndex(containingSourceFile,
|
|
122673
|
+
containingSourceFile ? ts.getModeForResolutionAtIndex(containingSourceFile, i) : undefined;
|
|
123552
122674
|
i++;
|
|
123553
|
-
var resolution = resolutionsInFile.
|
|
122675
|
+
var resolution = resolutionsInFile.get(name, mode);
|
|
123554
122676
|
// Resolution is valid if it is present and not invalidated
|
|
123555
|
-
if (!seenNamesInFile.has(name, mode) &&
|
|
122677
|
+
if (!seenNamesInFile.has(name, mode) &&
|
|
122678
|
+
unmatchedRedirects || !resolution || resolution.isInvalidated ||
|
|
122679
|
+
// If the name is unresolved import that was invalidated, recalculate
|
|
122680
|
+
(hasInvalidatedNonRelativeUnresolvedImport && !ts.isExternalModuleNameRelative(name) && shouldRetryResolution(resolution))) {
|
|
123556
122681
|
var existingResolution = resolution;
|
|
123557
|
-
|
|
123558
|
-
if (
|
|
123559
|
-
|
|
122682
|
+
var resolutionInDirectory = perDirectoryResolution.get(name, mode);
|
|
122683
|
+
if (resolutionInDirectory) {
|
|
122684
|
+
resolution = resolutionInDirectory;
|
|
122685
|
+
var host = ((_b = resolutionHost.getCompilerHost) === null || _b === void 0 ? void 0 : _b.call(resolutionHost)) || resolutionHost;
|
|
122686
|
+
if (ts.isTraceEnabled(compilerOptions, host)) {
|
|
122687
|
+
var resolved = getResolutionWithResolvedFileName(resolution);
|
|
122688
|
+
ts.trace(host, loader === resolveModuleName ?
|
|
122689
|
+
(resolved === null || resolved === void 0 ? void 0 : resolved.resolvedFileName) ?
|
|
122690
|
+
resolved.packagetId ?
|
|
122691
|
+
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 :
|
|
122692
|
+
ts.Diagnostics.Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3 :
|
|
122693
|
+
ts.Diagnostics.Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_not_resolved :
|
|
122694
|
+
(resolved === null || resolved === void 0 ? void 0 : resolved.resolvedFileName) ?
|
|
122695
|
+
resolved.packagetId ?
|
|
122696
|
+
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 :
|
|
122697
|
+
ts.Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3 :
|
|
122698
|
+
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));
|
|
122699
|
+
}
|
|
122700
|
+
}
|
|
122701
|
+
else {
|
|
122702
|
+
resolution = loader(name, containingFile, compilerOptions, ((_c = resolutionHost.getCompilerHost) === null || _c === void 0 ? void 0 : _c.call(resolutionHost)) || resolutionHost, redirectedReference, containingSourceFile, mode);
|
|
122703
|
+
perDirectoryResolution.set(name, mode, resolution);
|
|
122704
|
+
if (resolutionHost.onDiscoveredSymlink && resolutionIsSymlink(resolution)) {
|
|
122705
|
+
resolutionHost.onDiscoveredSymlink();
|
|
122706
|
+
}
|
|
123560
122707
|
}
|
|
123561
|
-
resolutionsInFile.
|
|
122708
|
+
resolutionsInFile.set(name, mode, resolution);
|
|
122709
|
+
watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, path, getResolutionWithResolvedFileName);
|
|
123562
122710
|
if (existingResolution) {
|
|
123563
|
-
|
|
122711
|
+
stopWatchFailedLookupLocationOfResolution(existingResolution, path, getResolutionWithResolvedFileName);
|
|
123564
122712
|
}
|
|
123565
122713
|
if (logChanges && filesWithChangedSetOfUnresolvedImports && !resolutionIsEqualTo(existingResolution, resolution)) {
|
|
123566
122714
|
filesWithChangedSetOfUnresolvedImports.push(path);
|
|
@@ -123574,34 +122722,28 @@ var ts;
|
|
|
123574
122722
|
var resolved = getResolutionWithResolvedFileName(resolution);
|
|
123575
122723
|
ts.trace(host, loader === resolveModuleName ?
|
|
123576
122724
|
(resolved === null || resolved === void 0 ? void 0 : resolved.resolvedFileName) ?
|
|
123577
|
-
resolved.
|
|
122725
|
+
resolved.packagetId ?
|
|
123578
122726
|
ts.Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 :
|
|
123579
122727
|
ts.Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2 :
|
|
123580
122728
|
ts.Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_not_resolved :
|
|
123581
122729
|
(resolved === null || resolved === void 0 ? void 0 : resolved.resolvedFileName) ?
|
|
123582
|
-
resolved.
|
|
122730
|
+
resolved.packagetId ?
|
|
123583
122731
|
ts.Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 :
|
|
123584
122732
|
ts.Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved_to_2 :
|
|
123585
|
-
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.
|
|
122733
|
+
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));
|
|
123586
122734
|
}
|
|
123587
122735
|
}
|
|
123588
122736
|
ts.Debug.assert(resolution !== undefined && !resolution.isInvalidated);
|
|
123589
122737
|
seenNamesInFile.set(name, mode, true);
|
|
123590
|
-
resolvedModules.push(resolution);
|
|
122738
|
+
resolvedModules.push(getResolutionWithResolvedFileName(resolution));
|
|
123591
122739
|
}
|
|
123592
|
-
|
|
123593
|
-
|
|
123594
|
-
|
|
122740
|
+
// Stop watching and remove the unused name
|
|
122741
|
+
resolutionsInFile.forEach(function (resolution, name, mode) {
|
|
122742
|
+
if (!seenNamesInFile.has(name, mode) && !ts.contains(reusedNames, name)) {
|
|
122743
|
+
stopWatchFailedLookupLocationOfResolution(resolution, path, getResolutionWithResolvedFileName);
|
|
122744
|
+
resolutionsInFile.delete(name, mode);
|
|
122745
|
+
}
|
|
123595
122746
|
});
|
|
123596
|
-
if (resolutionsInFile.cache.size() !== seenNamesInFile.size()) {
|
|
123597
|
-
// Stop watching and remove the unused name
|
|
123598
|
-
resolutionsInFile.cache.forEach(function (resolution, name, mode) {
|
|
123599
|
-
if (!seenNamesInFile.has(name, mode)) {
|
|
123600
|
-
stopWatchingResolution(resolution, path, getResolutionWithResolvedFileName);
|
|
123601
|
-
resolutionsInFile.cache.delete(name, mode);
|
|
123602
|
-
}
|
|
123603
|
-
});
|
|
123604
|
-
}
|
|
123605
122747
|
return resolvedModules;
|
|
123606
122748
|
function resolutionIsEqualTo(oldResolution, newResolution) {
|
|
123607
122749
|
if (oldResolution === newResolution) {
|
|
@@ -123621,31 +122763,40 @@ var ts;
|
|
|
123621
122763
|
return oldResult.resolvedFileName === newResult.resolvedFileName;
|
|
123622
122764
|
}
|
|
123623
122765
|
}
|
|
123624
|
-
function resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference, containingFileMode
|
|
122766
|
+
function resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference, containingFileMode) {
|
|
123625
122767
|
return resolveNamesWithLocalCache({
|
|
123626
122768
|
names: typeDirectiveNames,
|
|
123627
122769
|
containingFile: containingFile,
|
|
123628
122770
|
redirectedReference: redirectedReference,
|
|
123629
|
-
|
|
122771
|
+
cache: resolvedTypeReferenceDirectives,
|
|
122772
|
+
perDirectoryCacheWithRedirects: perDirectoryResolvedTypeReferenceDirectives,
|
|
123630
122773
|
loader: resolveTypeReferenceDirective,
|
|
123631
122774
|
getResolutionWithResolvedFileName: getResolvedTypeReferenceDirective,
|
|
123632
|
-
|
|
123633
|
-
|
|
122775
|
+
shouldRetryResolution: function (resolution) { return resolution.resolvedTypeReferenceDirective === undefined; },
|
|
122776
|
+
containingSourceFileMode: containingFileMode
|
|
123634
122777
|
});
|
|
123635
122778
|
}
|
|
123636
|
-
function resolveModuleNames(moduleNames, containingFile, redirectedReference, containingSourceFile
|
|
122779
|
+
function resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference, containingSourceFile) {
|
|
123637
122780
|
return resolveNamesWithLocalCache({
|
|
123638
122781
|
names: moduleNames,
|
|
123639
122782
|
containingFile: containingFile,
|
|
123640
122783
|
redirectedReference: redirectedReference,
|
|
123641
|
-
|
|
122784
|
+
cache: resolvedModuleNames,
|
|
122785
|
+
perDirectoryCacheWithRedirects: perDirectoryResolvedModuleNames,
|
|
123642
122786
|
loader: resolveModuleName,
|
|
123643
122787
|
getResolutionWithResolvedFileName: getResolvedModule,
|
|
123644
|
-
|
|
122788
|
+
shouldRetryResolution: function (resolution) { return !resolution.resolvedModule || !ts.resolutionExtensionIsTSOrJson(resolution.resolvedModule.extension); },
|
|
122789
|
+
reusedNames: reusedNames,
|
|
123645
122790
|
logChanges: logChangesWhenResolvingModule,
|
|
123646
122791
|
containingSourceFile: containingSourceFile,
|
|
123647
122792
|
});
|
|
123648
122793
|
}
|
|
122794
|
+
function getResolvedModuleWithFailedLookupLocationsFromCache(moduleName, containingFile, resolutionMode) {
|
|
122795
|
+
var cache = resolvedModuleNames.get(resolutionHost.toPath(containingFile));
|
|
122796
|
+
if (!cache)
|
|
122797
|
+
return undefined;
|
|
122798
|
+
return cache.get(moduleName, resolutionMode);
|
|
122799
|
+
}
|
|
123649
122800
|
function isNodeModulesAtTypesDirectory(dirPath) {
|
|
123650
122801
|
return ts.endsWith(dirPath, "/node_modules/@types");
|
|
123651
122802
|
}
|
|
@@ -123705,42 +122856,37 @@ var ts;
|
|
|
123705
122856
|
function isPathWithDefaultFailedLookupExtension(path) {
|
|
123706
122857
|
return ts.fileExtensionIsOneOf(path, failedLookupDefaultExtensions);
|
|
123707
122858
|
}
|
|
123708
|
-
function
|
|
123709
|
-
if (resolution.
|
|
123710
|
-
resolution.
|
|
123711
|
-
|
|
123712
|
-
watchFailedLookupLocationOfResolution(resolution);
|
|
123713
|
-
watchAffectingLocationsOfResolution(resolution);
|
|
123714
|
-
return;
|
|
123715
|
-
}
|
|
123716
|
-
resolution.files = new ts.Set();
|
|
123717
|
-
resolution.files.add(filePath);
|
|
123718
|
-
var resolved = getResolutionWithResolvedFileName(resolution);
|
|
123719
|
-
if (resolved && resolved.resolvedFileName) {
|
|
123720
|
-
resolvedFileToResolution.add(resolutionHost.toPath(resolved.resolvedFileName), resolution);
|
|
123721
|
-
}
|
|
123722
|
-
if (ts.isExternalModuleNameRelative(name) || !newProgram.getTypeChecker().tryFindAmbientModuleWithoutAugmentations(name)) {
|
|
123723
|
-
watchFailedLookupLocationOfResolution(resolution);
|
|
123724
|
-
watchAffectingLocationsOfResolution(resolution);
|
|
122859
|
+
function watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, filePath, getResolutionWithResolvedFileName) {
|
|
122860
|
+
if (resolution.refCount) {
|
|
122861
|
+
resolution.refCount++;
|
|
122862
|
+
ts.Debug.assertIsDefined(resolution.files);
|
|
123725
122863
|
}
|
|
123726
122864
|
else {
|
|
123727
|
-
resolution.
|
|
123728
|
-
|
|
122865
|
+
resolution.refCount = 1;
|
|
122866
|
+
ts.Debug.assert(ts.length(resolution.files) === 0); // This resolution shouldnt be referenced by any file yet
|
|
122867
|
+
if (ts.isExternalModuleNameRelative(name)) {
|
|
122868
|
+
watchFailedLookupLocationOfResolution(resolution);
|
|
122869
|
+
}
|
|
122870
|
+
else {
|
|
122871
|
+
nonRelativeExternalModuleResolutions.add(name, resolution);
|
|
122872
|
+
}
|
|
122873
|
+
var resolved = getResolutionWithResolvedFileName(resolution);
|
|
122874
|
+
if (resolved && resolved.resolvedFileName) {
|
|
122875
|
+
resolvedFileToResolution.add(resolutionHost.toPath(resolved.resolvedFileName), resolution);
|
|
122876
|
+
}
|
|
123729
122877
|
}
|
|
122878
|
+
(resolution.files || (resolution.files = [])).push(filePath);
|
|
123730
122879
|
}
|
|
123731
122880
|
function watchFailedLookupLocationOfResolution(resolution) {
|
|
123732
|
-
|
|
123733
|
-
|
|
122881
|
+
ts.Debug.assert(!!resolution.refCount);
|
|
122882
|
+
var failedLookupLocations = resolution.failedLookupLocations, affectingLocations = resolution.affectingLocations;
|
|
122883
|
+
if (!failedLookupLocations.length && !affectingLocations.length)
|
|
123734
122884
|
return;
|
|
123735
|
-
if (
|
|
122885
|
+
if (failedLookupLocations.length)
|
|
123736
122886
|
resolutionsWithFailedLookups.push(resolution);
|
|
123737
|
-
|
|
123738
|
-
|
|
123739
|
-
|
|
123740
|
-
}
|
|
123741
|
-
var setAtRoot = !!resolution.setAtRoot;
|
|
123742
|
-
for (var i = resolution.watchedFailed || 0; i < failedLookupLocations.length; i++) {
|
|
123743
|
-
var failedLookupLocation = failedLookupLocations[i];
|
|
122887
|
+
var setAtRoot = false;
|
|
122888
|
+
for (var _i = 0, failedLookupLocations_1 = failedLookupLocations; _i < failedLookupLocations_1.length; _i++) {
|
|
122889
|
+
var failedLookupLocation = failedLookupLocations_1[_i];
|
|
123744
122890
|
var failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
|
|
123745
122891
|
var toWatch = getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath);
|
|
123746
122892
|
if (toWatch) {
|
|
@@ -123760,24 +122906,24 @@ var ts;
|
|
|
123760
122906
|
}
|
|
123761
122907
|
}
|
|
123762
122908
|
}
|
|
123763
|
-
if (setAtRoot
|
|
122909
|
+
if (setAtRoot) {
|
|
123764
122910
|
// This is always non recursive
|
|
123765
|
-
setDirectoryWatcher(rootDir, rootPath, /*nonRecursive*/ true);
|
|
122911
|
+
setDirectoryWatcher(rootDir, rootPath, /*nonRecursive*/ true); // TODO: GH#18217
|
|
123766
122912
|
}
|
|
123767
|
-
resolution.
|
|
123768
|
-
resolution.watchedFailed = failedLookupLocations.length;
|
|
122913
|
+
watchAffectingLocationsOfResolution(resolution, !failedLookupLocations.length);
|
|
123769
122914
|
}
|
|
123770
|
-
function watchAffectingLocationsOfResolution(resolution) {
|
|
122915
|
+
function watchAffectingLocationsOfResolution(resolution, addToResolutionsWithOnlyAffectingLocations) {
|
|
122916
|
+
ts.Debug.assert(!!resolution.refCount);
|
|
123771
122917
|
var affectingLocations = resolution.affectingLocations;
|
|
123772
|
-
if (!
|
|
122918
|
+
if (!affectingLocations.length)
|
|
123773
122919
|
return;
|
|
123774
|
-
if (
|
|
122920
|
+
if (addToResolutionsWithOnlyAffectingLocations)
|
|
123775
122921
|
resolutionsWithOnlyAffectingLocations.push(resolution);
|
|
123776
122922
|
// Watch package json
|
|
123777
|
-
for (var
|
|
123778
|
-
|
|
122923
|
+
for (var _i = 0, affectingLocations_1 = affectingLocations; _i < affectingLocations_1.length; _i++) {
|
|
122924
|
+
var affectingLocation = affectingLocations_1[_i];
|
|
122925
|
+
createFileWatcherOfAffectingLocation(affectingLocation);
|
|
123779
122926
|
}
|
|
123780
|
-
resolution.watchedAffected = affectingLocations.length;
|
|
123781
122927
|
}
|
|
123782
122928
|
function createFileWatcherOfAffectingLocation(affectingLocation) {
|
|
123783
122929
|
var path = resolutionHost.toPath(affectingLocation);
|
|
@@ -123818,6 +122964,15 @@ var ts;
|
|
|
123818
122964
|
paths.add(path);
|
|
123819
122965
|
}
|
|
123820
122966
|
}
|
|
122967
|
+
function watchFailedLookupLocationOfNonRelativeModuleResolutions(resolutions, name) {
|
|
122968
|
+
var program = resolutionHost.getCurrentProgram();
|
|
122969
|
+
if (!program || !program.getTypeChecker().tryFindAmbientModuleWithoutAugmentations(name)) {
|
|
122970
|
+
resolutions.forEach(watchFailedLookupLocationOfResolution);
|
|
122971
|
+
}
|
|
122972
|
+
else {
|
|
122973
|
+
resolutions.forEach(function (resolution) { return watchAffectingLocationsOfResolution(resolution, /*addToResolutionWithOnlyAffectingLocations*/ true); });
|
|
122974
|
+
}
|
|
122975
|
+
}
|
|
123821
122976
|
function setDirectoryWatcher(dir, dirPath, nonRecursive) {
|
|
123822
122977
|
var dirWatcher = directoryWatchesOfFailedLookups.get(dirPath);
|
|
123823
122978
|
if (dirWatcher) {
|
|
@@ -123828,28 +122983,21 @@ var ts;
|
|
|
123828
122983
|
directoryWatchesOfFailedLookups.set(dirPath, { watcher: createDirectoryWatcher(dir, dirPath, nonRecursive), refCount: 1, nonRecursive: nonRecursive });
|
|
123829
122984
|
}
|
|
123830
122985
|
}
|
|
123831
|
-
function
|
|
123832
|
-
|
|
123833
|
-
|
|
123834
|
-
if (
|
|
123835
|
-
(resolutionsToCloseWatcherOn !== null && resolutionsToCloseWatcherOn !== void 0 ? resolutionsToCloseWatcherOn : (resolutionsToCloseWatcherOn = [])).push({ resolution: resolution, getResolved: getResolutionWithResolvedFileName });
|
|
123836
|
-
}
|
|
123837
|
-
function closeWatchersOfResolution(_a) {
|
|
123838
|
-
var _b;
|
|
123839
|
-
var resolution = _a.resolution, getResolved = _a.getResolved;
|
|
123840
|
-
// If some files are using this resolution or we have already closed all watchers ignore
|
|
123841
|
-
if (((_b = resolution.files) === null || _b === void 0 ? void 0 : _b.size) || !resolution.files)
|
|
122986
|
+
function stopWatchFailedLookupLocationOfResolution(resolution, filePath, getResolutionWithResolvedFileName) {
|
|
122987
|
+
ts.unorderedRemoveItem(ts.Debug.checkDefined(resolution.files), filePath);
|
|
122988
|
+
resolution.refCount--;
|
|
122989
|
+
if (resolution.refCount) {
|
|
123842
122990
|
return;
|
|
123843
|
-
|
|
123844
|
-
var resolved =
|
|
122991
|
+
}
|
|
122992
|
+
var resolved = getResolutionWithResolvedFileName(resolution);
|
|
123845
122993
|
if (resolved && resolved.resolvedFileName) {
|
|
123846
122994
|
resolvedFileToResolution.remove(resolutionHost.toPath(resolved.resolvedFileName), resolution);
|
|
123847
122995
|
}
|
|
123848
|
-
|
|
123849
|
-
|
|
122996
|
+
var failedLookupLocations = resolution.failedLookupLocations, affectingLocations = resolution.affectingLocations;
|
|
122997
|
+
if (ts.unorderedRemoveItem(resolutionsWithFailedLookups, resolution)) {
|
|
123850
122998
|
var removeAtRoot = false;
|
|
123851
|
-
for (var
|
|
123852
|
-
var failedLookupLocation =
|
|
122999
|
+
for (var _i = 0, failedLookupLocations_2 = failedLookupLocations; _i < failedLookupLocations_2.length; _i++) {
|
|
123000
|
+
var failedLookupLocation = failedLookupLocations_2[_i];
|
|
123853
123001
|
var failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
|
|
123854
123002
|
var toWatch = getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath);
|
|
123855
123003
|
if (toWatch) {
|
|
@@ -123872,31 +123020,23 @@ var ts;
|
|
|
123872
123020
|
}
|
|
123873
123021
|
}
|
|
123874
123022
|
}
|
|
123875
|
-
ts.Debug.assert(resolution.setAtRoot === removeAtRoot);
|
|
123876
123023
|
if (removeAtRoot) {
|
|
123877
123024
|
removeDirectoryWatcher(rootPath);
|
|
123878
123025
|
}
|
|
123879
123026
|
}
|
|
123880
|
-
else if (
|
|
123027
|
+
else if (affectingLocations.length) {
|
|
123881
123028
|
ts.unorderedRemoveItem(resolutionsWithOnlyAffectingLocations, resolution);
|
|
123882
123029
|
}
|
|
123883
|
-
|
|
123884
|
-
|
|
123885
|
-
|
|
123886
|
-
|
|
123887
|
-
var watcher = fileWatchesOfAffectingLocations.get(path);
|
|
123888
|
-
watcher.refCount--;
|
|
123889
|
-
closeAffectingFileWatcher(watcher, path);
|
|
123890
|
-
}
|
|
123030
|
+
for (var _a = 0, affectingLocations_2 = affectingLocations; _a < affectingLocations_2.length; _a++) {
|
|
123031
|
+
var affectingLocation = affectingLocations_2[_a];
|
|
123032
|
+
var watcher = fileWatchesOfAffectingLocations.get(resolutionHost.toPath(affectingLocation));
|
|
123033
|
+
watcher.refCount--;
|
|
123891
123034
|
}
|
|
123892
123035
|
}
|
|
123893
123036
|
function removeDirectoryWatcher(dirPath) {
|
|
123894
123037
|
var dirWatcher = directoryWatchesOfFailedLookups.get(dirPath);
|
|
123038
|
+
// Do not close the watcher yet since it might be needed by other failed lookup locations.
|
|
123895
123039
|
dirWatcher.refCount--;
|
|
123896
|
-
if (dirWatcher.refCount === 0) {
|
|
123897
|
-
directoryWatchesOfFailedLookups.delete(dirPath);
|
|
123898
|
-
dirWatcher.watcher.close();
|
|
123899
|
-
}
|
|
123900
123040
|
}
|
|
123901
123041
|
function createDirectoryWatcher(directory, dirPath, nonRecursive) {
|
|
123902
123042
|
return resolutionHost.watchDirectoryOfFailedLookupLocation(directory, function (fileOrDirectory) {
|
|
@@ -123912,16 +123052,28 @@ var ts;
|
|
|
123912
123052
|
// Deleted file, stop watching failed lookups for all the resolutions in the file
|
|
123913
123053
|
var resolutions = cache.get(filePath);
|
|
123914
123054
|
if (resolutions) {
|
|
123915
|
-
resolutions.
|
|
123055
|
+
resolutions.forEach(function (resolution) { return stopWatchFailedLookupLocationOfResolution(resolution, filePath, getResolutionWithResolvedFileName); });
|
|
123916
123056
|
cache.delete(filePath);
|
|
123917
123057
|
}
|
|
123918
123058
|
}
|
|
123059
|
+
function removeResolutionsFromProjectReferenceRedirects(filePath) {
|
|
123060
|
+
if (!ts.fileExtensionIs(filePath, ".json" /* Json */))
|
|
123061
|
+
return;
|
|
123062
|
+
var program = resolutionHost.getCurrentProgram();
|
|
123063
|
+
if (!program)
|
|
123064
|
+
return;
|
|
123065
|
+
// If this file is input file for the referenced project, get it
|
|
123066
|
+
var resolvedProjectReference = program.getResolvedProjectReferenceByPath(filePath);
|
|
123067
|
+
if (!resolvedProjectReference)
|
|
123068
|
+
return;
|
|
123069
|
+
// filePath is for the projectReference and the containing file is from this project reference, invalidate the resolution
|
|
123070
|
+
resolvedProjectReference.commandLine.fileNames.forEach(function (f) { return removeResolutionsOfFile(resolutionHost.toPath(f)); });
|
|
123071
|
+
}
|
|
123919
123072
|
function removeResolutionsOfFile(filePath) {
|
|
123920
123073
|
removeResolutionsOfFileFromCache(resolvedModuleNames, filePath, getResolvedModule);
|
|
123921
123074
|
removeResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath, getResolvedTypeReferenceDirective);
|
|
123922
123075
|
}
|
|
123923
123076
|
function invalidateResolutions(resolutions, canInvalidate) {
|
|
123924
|
-
var _a;
|
|
123925
123077
|
if (!resolutions)
|
|
123926
123078
|
return false;
|
|
123927
123079
|
var invalidated = false;
|
|
@@ -123930,15 +123082,17 @@ var ts;
|
|
|
123930
123082
|
if (resolution.isInvalidated || !canInvalidate(resolution))
|
|
123931
123083
|
continue;
|
|
123932
123084
|
resolution.isInvalidated = invalidated = true;
|
|
123933
|
-
(_a = resolution.files)
|
|
123085
|
+
for (var _a = 0, _b = ts.Debug.checkDefined(resolution.files); _a < _b.length; _a++) {
|
|
123086
|
+
var containingFilePath = _b[_a];
|
|
123934
123087
|
(filesWithInvalidatedResolutions || (filesWithInvalidatedResolutions = new ts.Set())).add(containingFilePath);
|
|
123935
123088
|
// When its a file with inferred types resolution, invalidate type reference directive resolution
|
|
123936
123089
|
hasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames || ts.endsWith(containingFilePath, ts.inferredTypesContainingFile);
|
|
123937
|
-
}
|
|
123090
|
+
}
|
|
123938
123091
|
}
|
|
123939
123092
|
return invalidated;
|
|
123940
123093
|
}
|
|
123941
123094
|
function invalidateResolutionOfFile(filePath) {
|
|
123095
|
+
removeResolutionsOfFile(filePath);
|
|
123942
123096
|
// Resolution is invalidated if the resulting file name is same as the deleted file path
|
|
123943
123097
|
var prevHasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames;
|
|
123944
123098
|
if (invalidateResolutions(resolvedFileToResolution.get(filePath), ts.returnTrue) &&
|
|
@@ -123948,28 +123102,8 @@ var ts;
|
|
|
123948
123102
|
}
|
|
123949
123103
|
}
|
|
123950
123104
|
function setFilesWithInvalidatedNonRelativeUnresolvedImports(filesMap) {
|
|
123951
|
-
|
|
123952
|
-
|
|
123953
|
-
if (!imports.length)
|
|
123954
|
-
return;
|
|
123955
|
-
var resolvedModules = resolvedModuleNames.get(filePath);
|
|
123956
|
-
var resolvedTypeRefs = resolvedTypeReferenceDirectives.get(filePath);
|
|
123957
|
-
if (!(resolvedModules === null || resolvedModules === void 0 ? void 0 : resolvedModules.cache.size()) && !(resolvedTypeRefs === null || resolvedTypeRefs === void 0 ? void 0 : resolvedTypeRefs.cache.size()))
|
|
123958
|
-
return;
|
|
123959
|
-
imports.forEach(function (_a) {
|
|
123960
|
-
var name = _a.name, mode = _a.mode;
|
|
123961
|
-
var resolvedModule = resolvedModules === null || resolvedModules === void 0 ? void 0 : resolvedModules.cache.get(name, mode);
|
|
123962
|
-
if (resolvedModule && !resolvedModule.isInvalidated && (!resolvedModule.resolvedModule || !ts.resolutionExtensionIsTSOrJson(resolvedModule.resolvedModule.extension))) {
|
|
123963
|
-
resolvedModule.isInvalidated = true;
|
|
123964
|
-
(filesWithInvalidatedResolutions !== null && filesWithInvalidatedResolutions !== void 0 ? filesWithInvalidatedResolutions : (filesWithInvalidatedResolutions = new ts.Set())).add(filePath);
|
|
123965
|
-
}
|
|
123966
|
-
var resolvedTypeRef = resolvedTypeRefs === null || resolvedTypeRefs === void 0 ? void 0 : resolvedTypeRefs.cache.get(name, mode);
|
|
123967
|
-
if (resolvedTypeRef && !resolvedTypeRef.isInvalidated && !resolvedTypeRef.resolvedTypeReferenceDirective) {
|
|
123968
|
-
resolvedTypeRef.isInvalidated = true;
|
|
123969
|
-
(filesWithInvalidatedResolutions !== null && filesWithInvalidatedResolutions !== void 0 ? filesWithInvalidatedResolutions : (filesWithInvalidatedResolutions = new ts.Set())).add(filePath);
|
|
123970
|
-
}
|
|
123971
|
-
});
|
|
123972
|
-
});
|
|
123105
|
+
ts.Debug.assert(filesWithInvalidatedNonRelativeUnresolvedImports === filesMap || filesWithInvalidatedNonRelativeUnresolvedImports === undefined);
|
|
123106
|
+
filesWithInvalidatedNonRelativeUnresolvedImports = filesMap;
|
|
123973
123107
|
}
|
|
123974
123108
|
function scheduleInvalidateResolutionOfFailedLookupLocation(fileOrDirectoryPath, isCreatingWatchedDirectory) {
|
|
123975
123109
|
if (isCreatingWatchedDirectory) {
|
|
@@ -124041,10 +123175,9 @@ var ts;
|
|
|
124041
123175
|
});
|
|
124042
123176
|
}
|
|
124043
123177
|
function canInvalidatedFailedLookupResolutionWithAffectingLocation(resolution) {
|
|
124044
|
-
|
|
124045
|
-
return !!affectingPathChecks && !!((_a = resolution.affectingLocations) === null || _a === void 0 ? void 0 : _a.some(function (location) {
|
|
123178
|
+
return !!affectingPathChecks && resolution.affectingLocations.some(function (location) {
|
|
124046
123179
|
return affectingPathChecks.has(resolutionHost.toPath(location));
|
|
124047
|
-
})
|
|
123180
|
+
});
|
|
124048
123181
|
}
|
|
124049
123182
|
function closeTypeRootsWatch() {
|
|
124050
123183
|
ts.clearMap(typeRootsWatches, ts.closeFileWatcher);
|
|
@@ -124434,9 +123567,9 @@ var ts;
|
|
|
124434
123567
|
if (!preferSymlinks) {
|
|
124435
123568
|
// Symlinks inside ignored paths are already filtered out of the symlink cache,
|
|
124436
123569
|
// so we only need to remove them from the realpath filenames.
|
|
124437
|
-
var
|
|
124438
|
-
if (
|
|
124439
|
-
return
|
|
123570
|
+
var result_16 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
|
|
123571
|
+
if (result_16)
|
|
123572
|
+
return result_16;
|
|
124440
123573
|
}
|
|
124441
123574
|
var symlinkedDirectories = (_a = host.getSymlinkCache) === null || _a === void 0 ? void 0 : _a.call(host).getSymlinkedDirectoriesByRealpath();
|
|
124442
123575
|
var fullImportedFileName = ts.getNormalizedAbsolutePath(importedFileName, cwd);
|
|
@@ -124456,10 +123589,10 @@ var ts;
|
|
|
124456
123589
|
for (var _i = 0, symlinkDirectories_1 = symlinkDirectories; _i < symlinkDirectories_1.length; _i++) {
|
|
124457
123590
|
var symlinkDirectory = symlinkDirectories_1[_i];
|
|
124458
123591
|
var option = ts.resolvePath(symlinkDirectory, relative);
|
|
124459
|
-
var
|
|
123592
|
+
var result_17 = cb(option, target === referenceRedirect);
|
|
124460
123593
|
shouldFilterIgnoredPaths = true; // We found a non-ignored path in symlinks, so we can reject ignored-path realpaths
|
|
124461
|
-
if (
|
|
124462
|
-
return
|
|
123594
|
+
if (result_17)
|
|
123595
|
+
return result_17;
|
|
124463
123596
|
}
|
|
124464
123597
|
});
|
|
124465
123598
|
});
|
|
@@ -124525,9 +123658,9 @@ var ts;
|
|
|
124525
123658
|
};
|
|
124526
123659
|
var out_directory_1;
|
|
124527
123660
|
for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) {
|
|
124528
|
-
var
|
|
123661
|
+
var state_11 = _loop_35(directory);
|
|
124529
123662
|
directory = out_directory_1;
|
|
124530
|
-
if (
|
|
123663
|
+
if (state_11 === "break")
|
|
124531
123664
|
break;
|
|
124532
123665
|
}
|
|
124533
123666
|
if (allFileNames.size) {
|
|
@@ -125496,8 +124629,7 @@ var ts;
|
|
|
125496
124629
|
})(ts || (ts = {}));
|
|
125497
124630
|
var ts;
|
|
125498
124631
|
(function (ts) {
|
|
125499
|
-
|
|
125500
|
-
function readBuildInfoForProgram(compilerOptions, host) {
|
|
124632
|
+
function readBuilderProgram(compilerOptions, host) {
|
|
125501
124633
|
var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(compilerOptions);
|
|
125502
124634
|
if (!buildInfoPath)
|
|
125503
124635
|
return undefined;
|
|
@@ -125518,12 +124650,7 @@ var ts;
|
|
|
125518
124650
|
return undefined;
|
|
125519
124651
|
if (!buildInfo.program)
|
|
125520
124652
|
return undefined;
|
|
125521
|
-
return
|
|
125522
|
-
}
|
|
125523
|
-
ts.readBuildInfoForProgram = readBuildInfoForProgram;
|
|
125524
|
-
function readBuilderProgram(compilerOptions, host) {
|
|
125525
|
-
var result = readBuildInfoForProgram(compilerOptions, host);
|
|
125526
|
-
return result && ts.createBuilderProgramUsingProgramBuildInfo(result.buildInfo.program, result.buildInfoPath, host, compilerOptions.configFilePath);
|
|
124653
|
+
return ts.createBuilderProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host);
|
|
125527
124654
|
}
|
|
125528
124655
|
ts.readBuilderProgram = readBuilderProgram;
|
|
125529
124656
|
function createIncrementalCompilerHost(options, system) {
|
|
@@ -125662,7 +124789,7 @@ var ts;
|
|
|
125662
124789
|
}
|
|
125663
124790
|
return host.resolveModuleNames.apply(host, args);
|
|
125664
124791
|
}) :
|
|
125665
|
-
(function (moduleNames, containingFile,
|
|
124792
|
+
(function (moduleNames, containingFile, reusedNames, redirectedReference, _options, sourceFile) { return resolutionCache.resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference, sourceFile); });
|
|
125666
124793
|
compilerHost.resolveTypeReferenceDirectives = host.resolveTypeReferenceDirectives ?
|
|
125667
124794
|
(function () {
|
|
125668
124795
|
var args = [];
|
|
@@ -125671,13 +124798,7 @@ var ts;
|
|
|
125671
124798
|
}
|
|
125672
124799
|
return host.resolveTypeReferenceDirectives.apply(host, args);
|
|
125673
124800
|
}) :
|
|
125674
|
-
(function (typeDirectiveNames, containingFile, redirectedReference, _options, containingFileMode
|
|
125675
|
-
compilerHost.getModuleResolutionCache = host.resolveModuleNames ?
|
|
125676
|
-
ts.maybeBind(host, host.getModuleResolutionCache) :
|
|
125677
|
-
(function () { return resolutionCache.getModuleResolutionCache(); });
|
|
125678
|
-
compilerHost.getTypeReferenceDirectiveResolutionCache = host.resolveTypeReferenceDirectives ?
|
|
125679
|
-
ts.maybeBind(host, host.getTypeReferenceDirectiveResolutionCache) :
|
|
125680
|
-
(function () { return resolutionCache.getTypeReferenceDirectiveResolutionCache(); });
|
|
124801
|
+
(function (typeDirectiveNames, containingFile, redirectedReference, _options, containingFileMode) { return resolutionCache.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference, containingFileMode); });
|
|
125681
124802
|
var userProvidedResolution = !!host.resolveModuleNames || !!host.resolveTypeReferenceDirectives;
|
|
125682
124803
|
builderProgram = readBuilderProgram(compilerOptions, compilerHost);
|
|
125683
124804
|
synchronizeProgram();
|
|
@@ -125746,8 +124867,7 @@ var ts;
|
|
|
125746
124867
|
}
|
|
125747
124868
|
// All resolutions are invalid if user provided resolutions
|
|
125748
124869
|
var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution);
|
|
125749
|
-
|
|
125750
|
-
if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
|
|
124870
|
+
if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, fileExists, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
|
|
125751
124871
|
if (hasChangedConfigFileParsingErrors) {
|
|
125752
124872
|
if (reportFileChangeDetectedOnCreateProgram) {
|
|
125753
124873
|
reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation);
|
|
@@ -125766,11 +124886,6 @@ var ts;
|
|
|
125766
124886
|
if (host.afterProgramCreate && program !== builderProgram) {
|
|
125767
124887
|
host.afterProgramCreate(builderProgram);
|
|
125768
124888
|
}
|
|
125769
|
-
compilerHost.readFile = originalReadFile;
|
|
125770
|
-
compilerHost.fileExists = originalFileExists;
|
|
125771
|
-
compilerHost.directoryExists = originalDirectoryExists;
|
|
125772
|
-
compilerHost.createDirectory = originalCreateDirectory;
|
|
125773
|
-
compilerHost.writeFile = originalWriteFile;
|
|
125774
124889
|
return builderProgram;
|
|
125775
124890
|
}
|
|
125776
124891
|
function createNewProgram(hasInvalidatedResolution) {
|
|
@@ -125780,16 +124895,19 @@ var ts;
|
|
|
125780
124895
|
writeLog(" options: " + JSON.stringify(compilerOptions));
|
|
125781
124896
|
if (projectReferences)
|
|
125782
124897
|
writeLog(" projectReferences: " + JSON.stringify(projectReferences));
|
|
124898
|
+
var needsUpdateInTypeRootWatch = hasChangedCompilerOptions || !getCurrentProgram();
|
|
125783
124899
|
hasChangedCompilerOptions = false;
|
|
125784
124900
|
hasChangedConfigFileParsingErrors = false;
|
|
125785
124901
|
resolutionCache.startCachingPerDirectoryResolution();
|
|
125786
124902
|
compilerHost.hasInvalidatedResolution = hasInvalidatedResolution;
|
|
125787
124903
|
compilerHost.hasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames;
|
|
125788
|
-
var oldProgram = getCurrentProgram();
|
|
125789
124904
|
builderProgram = createProgram(rootFileNames, compilerOptions, compilerHost, builderProgram, configFileParsingDiagnostics, projectReferences);
|
|
125790
|
-
resolutionCache.finishCachingPerDirectoryResolution(
|
|
124905
|
+
resolutionCache.finishCachingPerDirectoryResolution();
|
|
125791
124906
|
// Update watches
|
|
125792
124907
|
ts.updateMissingFilePathsWatch(builderProgram.getProgram(), missingFilesMap || (missingFilesMap = new ts.Map()), watchMissingFilePath);
|
|
124908
|
+
if (needsUpdateInTypeRootWatch) {
|
|
124909
|
+
resolutionCache.updateTypeRootsWatch();
|
|
124910
|
+
}
|
|
125793
124911
|
if (missingFilePathsRequestedForRelease) {
|
|
125794
124912
|
// These are the paths that program creater told us as not in use any more but were missing on the disk.
|
|
125795
124913
|
// We didnt remove the entry for them from sourceFiles cache so that we dont have to do File IO,
|
|
@@ -125866,6 +124984,9 @@ var ts;
|
|
|
125866
124984
|
sourceFilesCache.set(path, false);
|
|
125867
124985
|
}
|
|
125868
124986
|
}
|
|
124987
|
+
if (sourceFile) {
|
|
124988
|
+
sourceFile.impliedNodeFormat = ts.getImpliedNodeFormatForFile(path, resolutionCache.getModuleResolutionCache().getPackageJsonInfoCache(), compilerHost, compilerHost.getCompilationSettings());
|
|
124989
|
+
}
|
|
125869
124990
|
return sourceFile;
|
|
125870
124991
|
}
|
|
125871
124992
|
return hostSourceFile.sourceFile;
|
|
@@ -125886,7 +125007,7 @@ var ts;
|
|
|
125886
125007
|
var hostSourceFile = sourceFilesCache.get(path);
|
|
125887
125008
|
return !hostSourceFile || !hostSourceFile.version ? undefined : hostSourceFile.version;
|
|
125888
125009
|
}
|
|
125889
|
-
function onReleaseOldSourceFile(oldSourceFile) {
|
|
125010
|
+
function onReleaseOldSourceFile(oldSourceFile, _oldOptions, hasSourceFileByPath) {
|
|
125890
125011
|
var hostSourceFileInfo = sourceFilesCache.get(oldSourceFile.resolvedPath);
|
|
125891
125012
|
// If this is the source file thats in the cache and new program doesnt need it,
|
|
125892
125013
|
// remove the cached entry.
|
|
@@ -125902,6 +125023,9 @@ var ts;
|
|
|
125902
125023
|
hostSourceFileInfo.fileWatcher.close();
|
|
125903
125024
|
}
|
|
125904
125025
|
sourceFilesCache.delete(oldSourceFile.resolvedPath);
|
|
125026
|
+
if (!hasSourceFileByPath) {
|
|
125027
|
+
resolutionCache.removeResolutionsOfFile(oldSourceFile.path);
|
|
125028
|
+
}
|
|
125905
125029
|
}
|
|
125906
125030
|
}
|
|
125907
125031
|
}
|
|
@@ -126158,6 +125282,7 @@ var ts;
|
|
|
126158
125282
|
var config = parsedConfigs === null || parsedConfigs === void 0 ? void 0 : parsedConfigs.get(projectPath);
|
|
126159
125283
|
if (config)
|
|
126160
125284
|
config.reloadLevel = ts.ConfigFileProgramReloadLevel.Full;
|
|
125285
|
+
resolutionCache.removeResolutionsFromProjectReferenceRedirects(projectPath);
|
|
126161
125286
|
}
|
|
126162
125287
|
scheduleProgramUpdate();
|
|
126163
125288
|
});
|
|
@@ -126171,6 +125296,7 @@ var ts;
|
|
|
126171
125296
|
var config = parsedConfigs === null || parsedConfigs === void 0 ? void 0 : parsedConfigs.get(configPath);
|
|
126172
125297
|
if (config)
|
|
126173
125298
|
config.reloadLevel = ts.ConfigFileProgramReloadLevel.Full;
|
|
125299
|
+
resolutionCache.removeResolutionsFromProjectReferenceRedirects(configPath);
|
|
126174
125300
|
scheduleProgramUpdate();
|
|
126175
125301
|
}, ts.PollingInterval.High, ((_a = commandLine.parsedCommandLine) === null || _a === void 0 ? void 0 : _a.watchOptions) || watchOptions, ts.WatchType.ConfigFileOfReferencedProject));
|
|
126176
125302
|
// Watch Wild card
|
|
@@ -126376,23 +125502,20 @@ var ts;
|
|
|
126376
125502
|
compilerHost.getParsedCommandLine = function (fileName) { return parseConfigFile(state, fileName, toResolvedConfigFilePath(state, fileName)); };
|
|
126377
125503
|
compilerHost.resolveModuleNames = ts.maybeBind(host, host.resolveModuleNames);
|
|
126378
125504
|
compilerHost.resolveTypeReferenceDirectives = ts.maybeBind(host, host.resolveTypeReferenceDirectives);
|
|
126379
|
-
compilerHost.getModuleResolutionCache = ts.maybeBind(host, host.getModuleResolutionCache);
|
|
126380
|
-
compilerHost.getTypeReferenceDirectiveResolutionCache = ts.maybeBind(host, host.getTypeReferenceDirectiveResolutionCache);
|
|
126381
125505
|
var moduleResolutionCache = !compilerHost.resolveModuleNames ? ts.createModuleResolutionCache(currentDirectory, getCanonicalFileName) : undefined;
|
|
126382
125506
|
var typeReferenceDirectiveResolutionCache = !compilerHost.resolveTypeReferenceDirectives ? ts.createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, /*options*/ undefined, moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache()) : undefined;
|
|
126383
125507
|
if (!compilerHost.resolveModuleNames) {
|
|
126384
|
-
var loader_3 = function (moduleName, resolverMode, containingFile, redirectedReference) { return ts.resolveModuleName(moduleName, containingFile, state.projectCompilerOptions, compilerHost, moduleResolutionCache, redirectedReference, resolverMode); };
|
|
126385
|
-
compilerHost.resolveModuleNames = function (moduleNames, containingFile, _reusedNames, redirectedReference, _options, containingSourceFile
|
|
126386
|
-
return ts.loadWithModeAwareCache(moduleNames, ts.Debug.checkDefined(containingSourceFile), containingFile, redirectedReference,
|
|
125508
|
+
var loader_3 = function (moduleName, resolverMode, containingFile, redirectedReference) { return ts.resolveModuleName(moduleName, containingFile, state.projectCompilerOptions, compilerHost, moduleResolutionCache, redirectedReference, resolverMode).resolvedModule; };
|
|
125509
|
+
compilerHost.resolveModuleNames = function (moduleNames, containingFile, _reusedNames, redirectedReference, _options, containingSourceFile) {
|
|
125510
|
+
return ts.loadWithModeAwareCache(ts.Debug.checkEachDefined(moduleNames), ts.Debug.checkDefined(containingSourceFile), containingFile, redirectedReference, loader_3);
|
|
126387
125511
|
};
|
|
126388
125512
|
compilerHost.getModuleResolutionCache = function () { return moduleResolutionCache; };
|
|
126389
125513
|
}
|
|
126390
125514
|
if (!compilerHost.resolveTypeReferenceDirectives) {
|
|
126391
|
-
var loader_4 = function (moduleName, containingFile, redirectedReference, containingFileMode) { return ts.resolveTypeReferenceDirective(moduleName, containingFile, state.projectCompilerOptions, compilerHost, redirectedReference, state.typeReferenceDirectiveResolutionCache, containingFileMode); };
|
|
125515
|
+
var loader_4 = function (moduleName, containingFile, redirectedReference, containingFileMode) { return ts.resolveTypeReferenceDirective(moduleName, containingFile, state.projectCompilerOptions, compilerHost, redirectedReference, state.typeReferenceDirectiveResolutionCache, containingFileMode).resolvedTypeReferenceDirective; };
|
|
126392
125516
|
compilerHost.resolveTypeReferenceDirectives = function (typeReferenceDirectiveNames, containingFile, redirectedReference, _options, containingFileMode) {
|
|
126393
|
-
return ts.loadWithTypeDirectiveCache(typeReferenceDirectiveNames, containingFile, redirectedReference, containingFileMode, loader_4);
|
|
125517
|
+
return ts.loadWithTypeDirectiveCache(ts.Debug.checkEachDefined(typeReferenceDirectiveNames), containingFile, redirectedReference, containingFileMode, loader_4);
|
|
126394
125518
|
};
|
|
126395
|
-
compilerHost.getTypeReferenceDirectiveResolutionCache = function () { return typeReferenceDirectiveResolutionCache; };
|
|
126396
125519
|
}
|
|
126397
125520
|
compilerHost.getBuildInfo = function (fileName, configFilePath) { return getBuildInfo(state, fileName, toResolvedConfigFilePath(state, configFilePath), /*modifiedTime*/ undefined); };
|
|
126398
125521
|
var _a = ts.createWatchFactory(hostWithWatch, options), watchFile = _a.watchFile, watchDirectory = _a.watchDirectory, writeLog = _a.writeLog;
|
|
@@ -127380,7 +126503,7 @@ var ts;
|
|
|
127380
126503
|
if (buildInfoTime && buildInfoTime < inputTime) {
|
|
127381
126504
|
var version_3 = void 0;
|
|
127382
126505
|
var currentVersion = void 0;
|
|
127383
|
-
if (buildInfoProgram
|
|
126506
|
+
if (buildInfoProgram) {
|
|
127384
126507
|
// Read files and see if they are same, read is anyways cached
|
|
127385
126508
|
if (!buildInfoVersionMap)
|
|
127386
126509
|
buildInfoVersionMap = ts.getBuildInfoFileVersionMap(buildInfoProgram, buildInfoPath, host);
|