@typescript-deploys/pr-build 4.9.0-pr-50247-13 → 4.9.0-pr-50293-5
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 +757 -1765
- package/lib/tsserver.js +894 -1963
- package/lib/tsserverlibrary.d.ts +33 -39
- package/lib/tsserverlibrary.js +894 -1963
- package/lib/typescript.d.ts +30 -37
- package/lib/typescript.js +843 -1903
- package/lib/typescriptServices.d.ts +30 -37
- package/lib/typescriptServices.js +843 -1903
- package/lib/typingsInstaller.js +802 -1858
- package/package.json +1 -1
package/lib/typingsInstaller.js
CHANGED
|
@@ -4739,15 +4739,13 @@ var ts;
|
|
|
4739
4739
|
(function (FilePreprocessingDiagnosticsKind) {
|
|
4740
4740
|
FilePreprocessingDiagnosticsKind[FilePreprocessingDiagnosticsKind["FilePreprocessingReferencedDiagnostic"] = 0] = "FilePreprocessingReferencedDiagnostic";
|
|
4741
4741
|
FilePreprocessingDiagnosticsKind[FilePreprocessingDiagnosticsKind["FilePreprocessingFileExplainingDiagnostic"] = 1] = "FilePreprocessingFileExplainingDiagnostic";
|
|
4742
|
-
FilePreprocessingDiagnosticsKind[FilePreprocessingDiagnosticsKind["ResolutionDiagnostics"] = 2] = "ResolutionDiagnostics";
|
|
4743
4742
|
})(FilePreprocessingDiagnosticsKind = ts.FilePreprocessingDiagnosticsKind || (ts.FilePreprocessingDiagnosticsKind = {}));
|
|
4744
4743
|
/* @internal */
|
|
4745
4744
|
var StructureIsReused;
|
|
4746
4745
|
(function (StructureIsReused) {
|
|
4747
4746
|
StructureIsReused[StructureIsReused["Not"] = 0] = "Not";
|
|
4748
|
-
StructureIsReused[StructureIsReused["
|
|
4749
|
-
StructureIsReused[StructureIsReused["
|
|
4750
|
-
StructureIsReused[StructureIsReused["Completely"] = 3] = "Completely";
|
|
4747
|
+
StructureIsReused[StructureIsReused["SafeModules"] = 1] = "SafeModules";
|
|
4748
|
+
StructureIsReused[StructureIsReused["Completely"] = 2] = "Completely";
|
|
4751
4749
|
})(StructureIsReused = ts.StructureIsReused || (ts.StructureIsReused = {}));
|
|
4752
4750
|
/** Return code used by getEmitOutput function to indicate status of the function */
|
|
4753
4751
|
var ExitStatus;
|
|
@@ -9505,8 +9503,6 @@ var ts;
|
|
|
9505
9503
|
Found_1_error_in_1: diag(6259, ts.DiagnosticCategory.Message, "Found_1_error_in_1_6259", "Found 1 error in {1}"),
|
|
9506
9504
|
Found_0_errors_in_the_same_file_starting_at_Colon_1: diag(6260, ts.DiagnosticCategory.Message, "Found_0_errors_in_the_same_file_starting_at_Colon_1_6260", "Found {0} errors in the same file, starting at: {1}"),
|
|
9507
9505
|
Found_0_errors_in_1_files: diag(6261, ts.DiagnosticCategory.Message, "Found_0_errors_in_1_files_6261", "Found {0} errors in {1} files."),
|
|
9508
|
-
Directory_0_resolves_to_1_scope_according_to_cache: diag(6263, ts.DiagnosticCategory.Message, "Directory_0_resolves_to_1_scope_according_to_cache_6263", "Directory '{0}' resolves to '{1}' scope according to cache."),
|
|
9509
|
-
Directory_0_has_no_containing_package_json_scope_according_to_cache: diag(6264, ts.DiagnosticCategory.Message, "Directory_0_has_no_containing_package_json_scope_according_to_cache_6264", "Directory '{0}' has no containing package.json scope according to cache."),
|
|
9510
9506
|
Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve: diag(6270, ts.DiagnosticCategory.Message, "Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve_6270", "Directory '{0}' has no containing package.json scope. Imports will not resolve."),
|
|
9511
9507
|
Import_specifier_0_does_not_exist_in_package_json_scope_at_path_1: diag(6271, ts.DiagnosticCategory.Message, "Import_specifier_0_does_not_exist_in_package_json_scope_at_path_1_6271", "Import specifier '{0}' does not exist in package.json scope at path '{1}'."),
|
|
9512
9508
|
Invalid_import_specifier_0_has_no_possible_resolutions: diag(6272, ts.DiagnosticCategory.Message, "Invalid_import_specifier_0_has_no_possible_resolutions_6272", "Invalid import specifier '{0}' has no possible resolutions."),
|
|
@@ -9691,7 +9687,6 @@ var ts;
|
|
|
9691
9687
|
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."),
|
|
9692
9688
|
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."),
|
|
9693
9689
|
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."),
|
|
9694
|
-
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."),
|
|
9695
9690
|
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'."),
|
|
9696
9691
|
one_of_Colon: diag(6900, ts.DiagnosticCategory.Message, "one_of_Colon_6900", "one of:"),
|
|
9697
9692
|
one_or_more_Colon: diag(6901, ts.DiagnosticCategory.Message, "one_or_more_Colon_6901", "one or more:"),
|
|
@@ -14433,8 +14428,7 @@ var ts;
|
|
|
14433
14428
|
}
|
|
14434
14429
|
ts.changesAffectModuleResolution = changesAffectModuleResolution;
|
|
14435
14430
|
function optionsHaveModuleResolutionChanges(oldOptions, newOptions) {
|
|
14436
|
-
return oldOptions
|
|
14437
|
-
optionsHaveChanges(oldOptions, newOptions, ts.moduleResolutionOptionDeclarations);
|
|
14431
|
+
return optionsHaveChanges(oldOptions, newOptions, ts.moduleResolutionOptionDeclarations);
|
|
14438
14432
|
}
|
|
14439
14433
|
ts.optionsHaveModuleResolutionChanges = optionsHaveModuleResolutionChanges;
|
|
14440
14434
|
function changesAffectingProgramStructure(oldOptions, newOptions) {
|
|
@@ -14512,20 +14506,21 @@ var ts;
|
|
|
14512
14506
|
}
|
|
14513
14507
|
ts.getFullWidth = getFullWidth;
|
|
14514
14508
|
function getResolvedModule(sourceFile, moduleNameText, mode) {
|
|
14515
|
-
|
|
14516
|
-
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;
|
|
14509
|
+
return sourceFile && sourceFile.resolvedModules && sourceFile.resolvedModules.get(moduleNameText, mode);
|
|
14517
14510
|
}
|
|
14518
14511
|
ts.getResolvedModule = getResolvedModule;
|
|
14519
14512
|
function setResolvedModule(sourceFile, moduleNameText, resolvedModule, mode) {
|
|
14520
|
-
|
|
14521
|
-
|
|
14513
|
+
if (!sourceFile.resolvedModules) {
|
|
14514
|
+
sourceFile.resolvedModules = ts.createModeAwareCache();
|
|
14515
|
+
}
|
|
14522
14516
|
sourceFile.resolvedModules.set(moduleNameText, mode, resolvedModule);
|
|
14523
14517
|
}
|
|
14524
14518
|
ts.setResolvedModule = setResolvedModule;
|
|
14525
|
-
function setResolvedTypeReferenceDirective(sourceFile, typeReferenceDirectiveName, resolvedTypeReferenceDirective
|
|
14526
|
-
|
|
14527
|
-
|
|
14528
|
-
|
|
14519
|
+
function setResolvedTypeReferenceDirective(sourceFile, typeReferenceDirectiveName, resolvedTypeReferenceDirective) {
|
|
14520
|
+
if (!sourceFile.resolvedTypeReferenceDirectiveNames) {
|
|
14521
|
+
sourceFile.resolvedTypeReferenceDirectiveNames = ts.createModeAwareCache();
|
|
14522
|
+
}
|
|
14523
|
+
sourceFile.resolvedTypeReferenceDirectiveNames.set(typeReferenceDirectiveName, /*mode*/ undefined, resolvedTypeReferenceDirective);
|
|
14529
14524
|
}
|
|
14530
14525
|
ts.setResolvedTypeReferenceDirective = setResolvedTypeReferenceDirective;
|
|
14531
14526
|
function projectReferenceIsEqualTo(oldRef, newRef) {
|
|
@@ -14535,15 +14530,11 @@ var ts;
|
|
|
14535
14530
|
}
|
|
14536
14531
|
ts.projectReferenceIsEqualTo = projectReferenceIsEqualTo;
|
|
14537
14532
|
function moduleResolutionIsEqualTo(oldResolution, newResolution) {
|
|
14538
|
-
return oldResolution === newResolution
|
|
14539
|
-
oldResolution.
|
|
14540
|
-
|
|
14541
|
-
|
|
14542
|
-
|
|
14543
|
-
oldResolution.resolvedModule.extension === newResolution.resolvedModule.extension &&
|
|
14544
|
-
oldResolution.resolvedModule.resolvedFileName === newResolution.resolvedModule.resolvedFileName &&
|
|
14545
|
-
oldResolution.resolvedModule.originalPath === newResolution.resolvedModule.originalPath &&
|
|
14546
|
-
packageIdIsEqual(oldResolution.resolvedModule.packageId, newResolution.resolvedModule.packageId);
|
|
14533
|
+
return oldResolution.isExternalLibraryImport === newResolution.isExternalLibraryImport &&
|
|
14534
|
+
oldResolution.extension === newResolution.extension &&
|
|
14535
|
+
oldResolution.resolvedFileName === newResolution.resolvedFileName &&
|
|
14536
|
+
oldResolution.originalPath === newResolution.originalPath &&
|
|
14537
|
+
packageIdIsEqual(oldResolution.packageId, newResolution.packageId);
|
|
14547
14538
|
}
|
|
14548
14539
|
ts.moduleResolutionIsEqualTo = moduleResolutionIsEqualTo;
|
|
14549
14540
|
function packageIdIsEqual(a, b) {
|
|
@@ -14559,13 +14550,9 @@ var ts;
|
|
|
14559
14550
|
}
|
|
14560
14551
|
ts.packageIdToString = packageIdToString;
|
|
14561
14552
|
function typeDirectiveIsEqualTo(oldResolution, newResolution) {
|
|
14562
|
-
return oldResolution === newResolution
|
|
14563
|
-
oldResolution.
|
|
14564
|
-
|
|
14565
|
-
!!newResolution.resolvedTypeReferenceDirective &&
|
|
14566
|
-
oldResolution.resolvedTypeReferenceDirective.resolvedFileName === newResolution.resolvedTypeReferenceDirective.resolvedFileName &&
|
|
14567
|
-
!!oldResolution.resolvedTypeReferenceDirective.primary === !!newResolution.resolvedTypeReferenceDirective.primary &&
|
|
14568
|
-
oldResolution.resolvedTypeReferenceDirective.originalPath === newResolution.resolvedTypeReferenceDirective.originalPath;
|
|
14553
|
+
return oldResolution.resolvedFileName === newResolution.resolvedFileName
|
|
14554
|
+
&& oldResolution.primary === newResolution.primary
|
|
14555
|
+
&& oldResolution.originalPath === newResolution.originalPath;
|
|
14569
14556
|
}
|
|
14570
14557
|
ts.typeDirectiveIsEqualTo = typeDirectiveIsEqualTo;
|
|
14571
14558
|
function hasChangesInResolutions(names, newResolutions, oldResolutions, oldSourceFile, comparer) {
|
|
@@ -19423,7 +19410,7 @@ var ts;
|
|
|
19423
19410
|
}
|
|
19424
19411
|
ts.base64decode = base64decode;
|
|
19425
19412
|
function readJsonOrUndefined(path, hostOrText) {
|
|
19426
|
-
var jsonText = ts.isString(hostOrText)
|
|
19413
|
+
var jsonText = ts.isString(hostOrText) ? hostOrText : hostOrText.readFile(path);
|
|
19427
19414
|
if (!jsonText)
|
|
19428
19415
|
return undefined;
|
|
19429
19416
|
// gracefully handle if readFile fails or returns not JSON
|
|
@@ -19431,8 +19418,8 @@ var ts;
|
|
|
19431
19418
|
return !result.error ? result.config : undefined;
|
|
19432
19419
|
}
|
|
19433
19420
|
ts.readJsonOrUndefined = readJsonOrUndefined;
|
|
19434
|
-
function readJson(path,
|
|
19435
|
-
return readJsonOrUndefined(path,
|
|
19421
|
+
function readJson(path, host) {
|
|
19422
|
+
return readJsonOrUndefined(path, host) || {};
|
|
19436
19423
|
}
|
|
19437
19424
|
ts.readJson = readJson;
|
|
19438
19425
|
function directoryProbablyExists(directoryName, host) {
|
|
@@ -20516,15 +20503,14 @@ var ts;
|
|
|
20516
20503
|
},
|
|
20517
20504
|
setSymlinksFromResolutions: function (files, typeReferenceDirectives) {
|
|
20518
20505
|
var _this = this;
|
|
20519
|
-
var _a
|
|
20506
|
+
var _a;
|
|
20520
20507
|
ts.Debug.assert(!hasProcessedResolutions);
|
|
20521
20508
|
hasProcessedResolutions = true;
|
|
20522
20509
|
for (var _i = 0, files_1 = files; _i < files_1.length; _i++) {
|
|
20523
20510
|
var file = files_1[_i];
|
|
20524
|
-
(_a = file.resolvedModules) === null || _a === void 0 ? void 0 : _a.forEach(function (resolution) { return processResolution(_this, resolution
|
|
20525
|
-
(_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); });
|
|
20511
|
+
(_a = file.resolvedModules) === null || _a === void 0 ? void 0 : _a.forEach(function (resolution) { return processResolution(_this, resolution); });
|
|
20526
20512
|
}
|
|
20527
|
-
typeReferenceDirectives.forEach(function (resolution) { return processResolution(_this, resolution
|
|
20513
|
+
typeReferenceDirectives === null || typeReferenceDirectives === void 0 ? void 0 : typeReferenceDirectives.forEach(function (resolution) { return processResolution(_this, resolution); });
|
|
20528
20514
|
},
|
|
20529
20515
|
hasProcessedResolutions: function () { return hasProcessedResolutions; },
|
|
20530
20516
|
};
|
|
@@ -39958,17 +39944,6 @@ var ts;
|
|
|
39958
39944
|
transpileOptionValue: undefined,
|
|
39959
39945
|
defaultValueDescription: ts.Diagnostics.false_unless_composite_is_set
|
|
39960
39946
|
},
|
|
39961
|
-
{
|
|
39962
|
-
name: "cacheResolutions",
|
|
39963
|
-
type: "boolean",
|
|
39964
|
-
category: ts.Diagnostics.Projects,
|
|
39965
|
-
description: ts.Diagnostics.Save_resolutions_into_tsbuildinfo_file_and_use_them_for_incremental_compilation,
|
|
39966
|
-
affectsModuleResolution: true,
|
|
39967
|
-
affectsMultiFileEmitBuildInfo: true,
|
|
39968
|
-
affectsBundleEmitBuildInfo: true,
|
|
39969
|
-
transpileOptionValue: undefined,
|
|
39970
|
-
defaultValueDescription: false,
|
|
39971
|
-
},
|
|
39972
39947
|
{
|
|
39973
39948
|
name: "assumeChangesOnlyAffectDirectDependencies",
|
|
39974
39949
|
type: "boolean",
|
|
@@ -42066,9 +42041,6 @@ var ts;
|
|
|
42066
42041
|
if (result.configFilePath) {
|
|
42067
42042
|
result.configFilePath = toAbsolutePath(result.configFilePath);
|
|
42068
42043
|
}
|
|
42069
|
-
if (result.pathsBasePath) {
|
|
42070
|
-
result.pathsBasePath = toAbsolutePath(result.pathsBasePath);
|
|
42071
|
-
}
|
|
42072
42044
|
return result;
|
|
42073
42045
|
}
|
|
42074
42046
|
ts.convertToOptionsWithAbsolutePaths = convertToOptionsWithAbsolutePaths;
|
|
@@ -42524,7 +42496,7 @@ var ts;
|
|
|
42524
42496
|
function getDefaultCompilerOptions(configFileName) {
|
|
42525
42497
|
var options = configFileName && ts.getBaseFileName(configFileName) === "jsconfig.json"
|
|
42526
42498
|
? { allowJs: true, maxNodeModuleJsDepth: 2, allowSyntheticDefaultImports: true, skipLibCheck: true, noEmit: true }
|
|
42527
|
-
: {
|
|
42499
|
+
: {};
|
|
42528
42500
|
return options;
|
|
42529
42501
|
}
|
|
42530
42502
|
function convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) {
|
|
@@ -43054,36 +43026,20 @@ var ts;
|
|
|
43054
43026
|
ts.Debug.assert(ts.extensionIsTS(resolved.extension));
|
|
43055
43027
|
return { fileName: resolved.path, packageId: resolved.packageId };
|
|
43056
43028
|
}
|
|
43057
|
-
function createResolvedModuleWithFailedLookupLocations(
|
|
43058
|
-
var _a;
|
|
43059
|
-
var _b;
|
|
43029
|
+
function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, resultFromCache) {
|
|
43030
|
+
var _a, _b;
|
|
43060
43031
|
if (resultFromCache) {
|
|
43061
|
-
|
|
43062
|
-
|
|
43063
|
-
resultFromCache.affectingLocations = updateResolutionField(resultFromCache.affectingLocations, affectingLocations);
|
|
43064
|
-
resultFromCache.resolutionDiagnostics = updateResolutionField(resultFromCache.resolutionDiagnostics, diagnostics);
|
|
43032
|
+
(_a = resultFromCache.failedLookupLocations).push.apply(_a, failedLookupLocations);
|
|
43033
|
+
(_b = resultFromCache.affectingLocations).push.apply(_b, affectingLocations);
|
|
43065
43034
|
return resultFromCache;
|
|
43066
43035
|
}
|
|
43067
43036
|
return {
|
|
43068
43037
|
resolvedModule: resolved && { resolvedFileName: resolved.path, originalPath: resolved.originalPath === true ? undefined : resolved.originalPath, extension: resolved.extension, isExternalLibraryImport: isExternalLibraryImport, packageId: resolved.packageId },
|
|
43069
|
-
failedLookupLocations:
|
|
43070
|
-
affectingLocations:
|
|
43071
|
-
resolutionDiagnostics:
|
|
43038
|
+
failedLookupLocations: failedLookupLocations,
|
|
43039
|
+
affectingLocations: affectingLocations,
|
|
43040
|
+
resolutionDiagnostics: diagnostics,
|
|
43072
43041
|
};
|
|
43073
43042
|
}
|
|
43074
|
-
function initializeResolutionField(value) {
|
|
43075
|
-
return value.length ? value : undefined;
|
|
43076
|
-
}
|
|
43077
|
-
/*@internal*/
|
|
43078
|
-
function updateResolutionField(to, value) {
|
|
43079
|
-
if (!(value === null || value === void 0 ? void 0 : value.length))
|
|
43080
|
-
return to;
|
|
43081
|
-
if (!(to === null || to === void 0 ? void 0 : to.length))
|
|
43082
|
-
return value;
|
|
43083
|
-
to.push.apply(to, value);
|
|
43084
|
-
return to;
|
|
43085
|
-
}
|
|
43086
|
-
ts.updateResolutionField = updateResolutionField;
|
|
43087
43043
|
function readPackageJsonField(jsonContent, fieldName, typeOfTag, state) {
|
|
43088
43044
|
if (!ts.hasProperty(jsonContent, fieldName)) {
|
|
43089
43045
|
if (state.traceEnabled) {
|
|
@@ -43235,7 +43191,8 @@ var ts;
|
|
|
43235
43191
|
options = redirectedReference.commandLine.options;
|
|
43236
43192
|
}
|
|
43237
43193
|
var containingDirectory = containingFile ? ts.getDirectoryPath(containingFile) : undefined;
|
|
43238
|
-
var
|
|
43194
|
+
var perFolderCache = containingDirectory ? cache && cache.getOrCreateCacheForDirectory(containingDirectory, redirectedReference) : undefined;
|
|
43195
|
+
var result = perFolderCache && perFolderCache.get(typeReferenceDirectiveName, /*mode*/ resolutionMode);
|
|
43239
43196
|
if (result) {
|
|
43240
43197
|
if (traceEnabled) {
|
|
43241
43198
|
trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_1, typeReferenceDirectiveName, containingFile);
|
|
@@ -43293,7 +43250,7 @@ var ts;
|
|
|
43293
43250
|
features: features,
|
|
43294
43251
|
conditions: conditions,
|
|
43295
43252
|
requestContainingDirectory: containingDirectory,
|
|
43296
|
-
|
|
43253
|
+
reportDiagnostic: function (diag) { return void diagnostics.push(diag); },
|
|
43297
43254
|
};
|
|
43298
43255
|
var resolved = primaryLookup();
|
|
43299
43256
|
var primary = true;
|
|
@@ -43315,15 +43272,8 @@ var ts;
|
|
|
43315
43272
|
isExternalLibraryImport: pathContainsNodeModules(fileName),
|
|
43316
43273
|
};
|
|
43317
43274
|
}
|
|
43318
|
-
result = {
|
|
43319
|
-
|
|
43320
|
-
failedLookupLocations: !options.cacheResolutions || !(resolvedTypeReferenceDirective === null || resolvedTypeReferenceDirective === void 0 ? void 0 : resolvedTypeReferenceDirective.resolvedFileName) ? failedLookupLocations : ts.emptyArray,
|
|
43321
|
-
affectingLocations: initializeResolutionField(affectingLocations),
|
|
43322
|
-
resolutionDiagnostics: initializeResolutionField(diagnostics),
|
|
43323
|
-
};
|
|
43324
|
-
if (containingDirectory && cache) {
|
|
43325
|
-
cache.getOrCreateCacheForDirectory(containingDirectory, redirectedReference).set(typeReferenceDirectiveName, /*mode*/ resolutionMode, result);
|
|
43326
|
-
}
|
|
43275
|
+
result = { resolvedTypeReferenceDirective: resolvedTypeReferenceDirective, failedLookupLocations: failedLookupLocations, affectingLocations: affectingLocations, resolutionDiagnostics: diagnostics };
|
|
43276
|
+
perFolderCache === null || perFolderCache === void 0 ? void 0 : perFolderCache.set(typeReferenceDirectiveName, /*mode*/ resolutionMode, result);
|
|
43327
43277
|
if (traceEnabled)
|
|
43328
43278
|
traceResult(result);
|
|
43329
43279
|
return result;
|
|
@@ -43333,10 +43283,10 @@ var ts;
|
|
|
43333
43283
|
trace(host, ts.Diagnostics.Type_reference_directive_0_was_not_resolved, typeReferenceDirectiveName);
|
|
43334
43284
|
}
|
|
43335
43285
|
else if (result.resolvedTypeReferenceDirective.packageId) {
|
|
43336
|
-
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),
|
|
43286
|
+
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);
|
|
43337
43287
|
}
|
|
43338
43288
|
else {
|
|
43339
|
-
trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2, typeReferenceDirectiveName, result.resolvedTypeReferenceDirective.resolvedFileName,
|
|
43289
|
+
trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2, typeReferenceDirectiveName, result.resolvedTypeReferenceDirective.resolvedFileName, result.resolvedTypeReferenceDirective.primary);
|
|
43340
43290
|
}
|
|
43341
43291
|
}
|
|
43342
43292
|
function primaryLookup() {
|
|
@@ -43453,186 +43403,63 @@ var ts;
|
|
|
43453
43403
|
}
|
|
43454
43404
|
ts.getAutomaticTypeDirectiveNames = getAutomaticTypeDirectiveNames;
|
|
43455
43405
|
/*@internal*/
|
|
43456
|
-
function
|
|
43457
|
-
|
|
43458
|
-
}
|
|
43459
|
-
ts.getPackageJsconLocationFromScope = getPackageJsconLocationFromScope;
|
|
43460
|
-
function compilerOptionValueToString(value) {
|
|
43461
|
-
var _a;
|
|
43462
|
-
if (value === null || typeof value !== "object") { // eslint-disable-line no-null/no-null
|
|
43463
|
-
return "" + value;
|
|
43464
|
-
}
|
|
43465
|
-
if (ts.isArray(value)) {
|
|
43466
|
-
return "[" + ((_a = ts.map(value, function (e) { return compilerOptionValueToString(e); })) === null || _a === void 0 ? void 0 : _a.join(",")) + "]";
|
|
43467
|
-
}
|
|
43468
|
-
var str = "{";
|
|
43469
|
-
for (var key in value) {
|
|
43470
|
-
if (ts.hasProperty(value, key)) {
|
|
43471
|
-
str += key + ": " + compilerOptionValueToString(value[key]);
|
|
43472
|
-
}
|
|
43473
|
-
}
|
|
43474
|
-
return str + "}";
|
|
43475
|
-
}
|
|
43476
|
-
/*@internal*/
|
|
43477
|
-
function getKeyForCompilationSettings(settings, options) {
|
|
43478
|
-
return options.map(function (option) { return compilerOptionValueToString(ts.getCompilerOptionValue(settings, option)); }).join("|") + ("|" + settings.pathsBasePath);
|
|
43479
|
-
}
|
|
43480
|
-
ts.getKeyForCompilationSettings = getKeyForCompilationSettings;
|
|
43481
|
-
/*@internal*/
|
|
43482
|
-
function getRedirectsCacheKey(options) {
|
|
43483
|
-
return getKeyForCompilationSettings(options, ts.moduleResolutionOptionDeclarations);
|
|
43484
|
-
}
|
|
43485
|
-
ts.getRedirectsCacheKey = getRedirectsCacheKey;
|
|
43486
|
-
/*@internal*/
|
|
43487
|
-
function createCacheWithRedirects(ownOptions) {
|
|
43488
|
-
var ownMap;
|
|
43489
|
-
var ownKey;
|
|
43490
|
-
var redirectsKeyToCache = new ts.Map();
|
|
43406
|
+
function createCacheWithRedirects(options) {
|
|
43407
|
+
var ownMap = new ts.Map();
|
|
43491
43408
|
var redirectsMap = new ts.Map();
|
|
43492
43409
|
return {
|
|
43493
43410
|
getOwnMap: getOwnMap,
|
|
43494
|
-
|
|
43495
|
-
createMapForCompilerOptions: createMapForCompilerOptions,
|
|
43496
|
-
getMapOfCacheRedirects: getMapOfCacheRedirects,
|
|
43411
|
+
redirectsMap: redirectsMap,
|
|
43497
43412
|
getOrCreateMapOfCacheRedirects: getOrCreateMapOfCacheRedirects,
|
|
43498
43413
|
clear: clear,
|
|
43499
|
-
|
|
43500
|
-
|
|
43414
|
+
setOwnOptions: setOwnOptions,
|
|
43415
|
+
setOwnMap: setOwnMap
|
|
43501
43416
|
};
|
|
43502
|
-
function
|
|
43503
|
-
|
|
43504
|
-
if (ownKey && !redirectsKeyToCache.has(ownKey))
|
|
43505
|
-
redirectsKeyToCache.set(ownKey, { map: ownMap !== null && ownMap !== void 0 ? ownMap : (ownMap = new ts.Map()), options: ownOptions });
|
|
43506
|
-
}
|
|
43507
|
-
function createMapForCompilerOptions(options, optionsKey) {
|
|
43508
|
-
if (options === ownOptions)
|
|
43509
|
-
return ownMap !== null && ownMap !== void 0 ? ownMap : (ownMap = new ts.Map());
|
|
43510
|
-
return getOrCreateRedirectMapAndKey(options, /*path*/ undefined, optionsKey);
|
|
43417
|
+
function getOwnMap() {
|
|
43418
|
+
return ownMap;
|
|
43511
43419
|
}
|
|
43512
|
-
function
|
|
43513
|
-
|
|
43514
|
-
if (path || options.configFile) {
|
|
43515
|
-
var redirects = redirectsMap.get(path || options.configFile.path);
|
|
43516
|
-
if (redirects)
|
|
43517
|
-
return redirects;
|
|
43518
|
-
}
|
|
43519
|
-
var key = optionsKey || getRedirectsCacheKey(options);
|
|
43520
|
-
var map = (_a = redirectsKeyToCache.get(key)) === null || _a === void 0 ? void 0 : _a.map;
|
|
43521
|
-
if (!map) {
|
|
43522
|
-
ensureOwnKeyCached();
|
|
43523
|
-
if (ownKey === key) {
|
|
43524
|
-
map = ownMap;
|
|
43525
|
-
}
|
|
43526
|
-
else {
|
|
43527
|
-
redirectsKeyToCache.set(key, { map: map = new ts.Map(), options: options });
|
|
43528
|
-
}
|
|
43529
|
-
}
|
|
43530
|
-
if (path || options.configFile)
|
|
43531
|
-
redirectsMap.set(path || options.configFile.path, map);
|
|
43532
|
-
return map;
|
|
43420
|
+
function setOwnOptions(newOptions) {
|
|
43421
|
+
options = newOptions;
|
|
43533
43422
|
}
|
|
43534
|
-
function
|
|
43535
|
-
|
|
43536
|
-
}
|
|
43537
|
-
function update(newOwnOptions) {
|
|
43538
|
-
// Store existing options:
|
|
43539
|
-
if (ownMap && (ownOptions === null || ownOptions === void 0 ? void 0 : ownOptions.configFile)) {
|
|
43540
|
-
ensureOwnKeyCached();
|
|
43541
|
-
if (!redirectsMap.has(ownOptions.configFile.path)) {
|
|
43542
|
-
redirectsMap.set(ownOptions.configFile.path, ownMap);
|
|
43543
|
-
}
|
|
43544
|
-
}
|
|
43545
|
-
// If this is already present use it
|
|
43546
|
-
if (newOwnOptions.configFile) {
|
|
43547
|
-
var existing_1 = redirectsMap.get(newOwnOptions.configFile.path);
|
|
43548
|
-
if (existing_1) {
|
|
43549
|
-
ownMap = existing_1;
|
|
43550
|
-
ownOptions = newOwnOptions;
|
|
43551
|
-
return;
|
|
43552
|
-
}
|
|
43553
|
-
}
|
|
43554
|
-
var key = getRedirectsCacheKey(newOwnOptions);
|
|
43555
|
-
var existing = redirectsKeyToCache.get(key);
|
|
43556
|
-
ownMap = (existing === null || existing === void 0 ? void 0 : existing.map) || new ts.Map();
|
|
43557
|
-
ownKey = key;
|
|
43558
|
-
ownOptions = newOwnOptions;
|
|
43559
|
-
if (newOwnOptions.configFile)
|
|
43560
|
-
redirectsMap.set(newOwnOptions.configFile.path, ownMap);
|
|
43423
|
+
function setOwnMap(newOwnMap) {
|
|
43424
|
+
ownMap = newOwnMap;
|
|
43561
43425
|
}
|
|
43562
|
-
function
|
|
43563
|
-
if (!redirectedReference)
|
|
43564
|
-
return ownMap;
|
|
43565
|
-
var directResult = redirectsMap.get(redirectedReference.sourceFile.path);
|
|
43566
|
-
if (directResult)
|
|
43567
|
-
return directResult;
|
|
43568
|
-
var key = getRedirectsCacheKey(redirectedReference.commandLine.options);
|
|
43569
|
-
var fromKey = redirectsKeyToCache.get(key);
|
|
43570
|
-
if (fromKey) {
|
|
43571
|
-
redirectsMap.set(redirectedReference.sourceFile.path, fromKey.map);
|
|
43572
|
-
return fromKey.map;
|
|
43573
|
-
}
|
|
43574
|
-
if (ownMap)
|
|
43575
|
-
ensureOwnKeyCached();
|
|
43576
|
-
if (ownKey === key) {
|
|
43577
|
-
redirectsMap.set(redirectedReference.sourceFile.path, ownMap);
|
|
43426
|
+
function getOrCreateMapOfCacheRedirects(redirectedReference) {
|
|
43427
|
+
if (!redirectedReference) {
|
|
43578
43428
|
return ownMap;
|
|
43579
43429
|
}
|
|
43580
|
-
|
|
43581
|
-
|
|
43582
|
-
|
|
43583
|
-
|
|
43584
|
-
|
|
43585
|
-
|
|
43430
|
+
var path = redirectedReference.sourceFile.path;
|
|
43431
|
+
var redirects = redirectsMap.get(path);
|
|
43432
|
+
if (!redirects) {
|
|
43433
|
+
// Reuse map if redirected reference map uses same resolution
|
|
43434
|
+
redirects = !options || ts.optionsHaveModuleResolutionChanges(options, redirectedReference.commandLine.options) ? new ts.Map() : ownMap;
|
|
43435
|
+
redirectsMap.set(path, redirects);
|
|
43436
|
+
}
|
|
43437
|
+
return redirects;
|
|
43586
43438
|
}
|
|
43587
43439
|
function clear() {
|
|
43588
|
-
|
|
43589
|
-
ownMap = undefined;
|
|
43440
|
+
ownMap.clear();
|
|
43590
43441
|
redirectsMap.clear();
|
|
43591
|
-
redirectsKeyToCache.clear();
|
|
43592
43442
|
}
|
|
43593
43443
|
}
|
|
43594
43444
|
ts.createCacheWithRedirects = createCacheWithRedirects;
|
|
43595
|
-
function createPackageJsonInfoCache(currentDirectory, getCanonicalFileName
|
|
43596
|
-
var
|
|
43597
|
-
|
|
43598
|
-
return {
|
|
43599
|
-
getPackageJsonInfo: getPackageJsonInfo,
|
|
43600
|
-
setPackageJsonInfo: setPackageJsonInfo,
|
|
43601
|
-
clear: clear,
|
|
43602
|
-
entries: entries,
|
|
43603
|
-
getInternalMap: function () { return cache; },
|
|
43604
|
-
setInternalMap: function (value) { return cache = value; },
|
|
43605
|
-
clone: clone,
|
|
43606
|
-
getPackageJsonScope: getPackageJsonScope,
|
|
43607
|
-
setPackageJsonScope: setPackageJsonScope,
|
|
43608
|
-
setOldPackageJsonScopeCache: function (cache) { return oldPackageJsonInfoCache = cache; },
|
|
43609
|
-
};
|
|
43445
|
+
function createPackageJsonInfoCache(currentDirectory, getCanonicalFileName) {
|
|
43446
|
+
var cache;
|
|
43447
|
+
return { getPackageJsonInfo: getPackageJsonInfo, setPackageJsonInfo: setPackageJsonInfo, clear: clear, entries: entries, getInternalMap: getInternalMap };
|
|
43610
43448
|
function getPackageJsonInfo(packageJsonPath) {
|
|
43611
|
-
return cache === null || cache === void 0 ? void 0 : cache.get(toPath(packageJsonPath));
|
|
43449
|
+
return cache === null || cache === void 0 ? void 0 : cache.get(ts.toPath(packageJsonPath, currentDirectory, getCanonicalFileName));
|
|
43612
43450
|
}
|
|
43613
43451
|
function setPackageJsonInfo(packageJsonPath, info) {
|
|
43614
|
-
(cache || (cache = new ts.Map())).set(toPath(packageJsonPath), info);
|
|
43452
|
+
(cache || (cache = new ts.Map())).set(ts.toPath(packageJsonPath, currentDirectory, getCanonicalFileName), info);
|
|
43615
43453
|
}
|
|
43616
43454
|
function clear() {
|
|
43617
|
-
oldPackageJsonInfoCache = undefined;
|
|
43618
43455
|
cache = undefined;
|
|
43619
|
-
dirToPackageJsonScope.clear();
|
|
43620
43456
|
}
|
|
43621
43457
|
function entries() {
|
|
43622
43458
|
var iter = cache === null || cache === void 0 ? void 0 : cache.entries();
|
|
43623
43459
|
return iter ? ts.arrayFrom(iter) : [];
|
|
43624
43460
|
}
|
|
43625
|
-
function
|
|
43626
|
-
return
|
|
43627
|
-
}
|
|
43628
|
-
function getPackageJsonScope(dir) {
|
|
43629
|
-
return dirToPackageJsonScope.get(dir) || (oldPackageJsonInfoCache === null || oldPackageJsonInfoCache === void 0 ? void 0 : oldPackageJsonInfoCache.getPackageJsonScope(dir));
|
|
43630
|
-
}
|
|
43631
|
-
function setPackageJsonScope(dir, scope) {
|
|
43632
|
-
moduleNameToDirectorySet(dirToPackageJsonScope, dir, scope, getPackageJsconLocationFromScope, toPath, ts.noop);
|
|
43633
|
-
}
|
|
43634
|
-
function toPath(file) {
|
|
43635
|
-
return ts.toPath(file, currentDirectory, getCanonicalFileName);
|
|
43461
|
+
function getInternalMap() {
|
|
43462
|
+
return cache;
|
|
43636
43463
|
}
|
|
43637
43464
|
}
|
|
43638
43465
|
function getOrCreateCache(cacheWithRedirects, redirectedReference, key, create) {
|
|
@@ -43644,44 +43471,47 @@ var ts;
|
|
|
43644
43471
|
}
|
|
43645
43472
|
return result;
|
|
43646
43473
|
}
|
|
43647
|
-
function
|
|
43648
|
-
|
|
43649
|
-
|
|
43474
|
+
function updateRedirectsMap(options, directoryToModuleNameMap, moduleNameToDirectoryMap) {
|
|
43475
|
+
if (!options.configFile)
|
|
43476
|
+
return;
|
|
43477
|
+
if (directoryToModuleNameMap.redirectsMap.size === 0) {
|
|
43478
|
+
// The own map will be for projectCompilerOptions
|
|
43479
|
+
ts.Debug.assert(!moduleNameToDirectoryMap || moduleNameToDirectoryMap.redirectsMap.size === 0);
|
|
43480
|
+
ts.Debug.assert(directoryToModuleNameMap.getOwnMap().size === 0);
|
|
43481
|
+
ts.Debug.assert(!moduleNameToDirectoryMap || moduleNameToDirectoryMap.getOwnMap().size === 0);
|
|
43482
|
+
directoryToModuleNameMap.redirectsMap.set(options.configFile.path, directoryToModuleNameMap.getOwnMap());
|
|
43483
|
+
moduleNameToDirectoryMap === null || moduleNameToDirectoryMap === void 0 ? void 0 : moduleNameToDirectoryMap.redirectsMap.set(options.configFile.path, moduleNameToDirectoryMap.getOwnMap());
|
|
43484
|
+
}
|
|
43485
|
+
else {
|
|
43486
|
+
// Set correct own map
|
|
43487
|
+
ts.Debug.assert(!moduleNameToDirectoryMap || moduleNameToDirectoryMap.redirectsMap.size > 0);
|
|
43488
|
+
var ref = {
|
|
43489
|
+
sourceFile: options.configFile,
|
|
43490
|
+
commandLine: { options: options }
|
|
43491
|
+
};
|
|
43492
|
+
directoryToModuleNameMap.setOwnMap(directoryToModuleNameMap.getOrCreateMapOfCacheRedirects(ref));
|
|
43493
|
+
moduleNameToDirectoryMap === null || moduleNameToDirectoryMap === void 0 ? void 0 : moduleNameToDirectoryMap.setOwnMap(moduleNameToDirectoryMap.getOrCreateMapOfCacheRedirects(ref));
|
|
43494
|
+
}
|
|
43495
|
+
directoryToModuleNameMap.setOwnOptions(options);
|
|
43496
|
+
moduleNameToDirectoryMap === null || moduleNameToDirectoryMap === void 0 ? void 0 : moduleNameToDirectoryMap.setOwnOptions(options);
|
|
43497
|
+
}
|
|
43498
|
+
function createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, directoryToModuleNameMap) {
|
|
43650
43499
|
return {
|
|
43651
|
-
getFromCache: getFromCache,
|
|
43652
43500
|
getOrCreateCacheForDirectory: getOrCreateCacheForDirectory,
|
|
43653
43501
|
clear: clear,
|
|
43654
43502
|
update: update,
|
|
43655
|
-
setOldResolutionCache: function (cache) { return oldResolutionCache = cache; }
|
|
43656
43503
|
};
|
|
43657
43504
|
function clear() {
|
|
43658
|
-
oldResolutionCache = undefined;
|
|
43659
43505
|
directoryToModuleNameMap.clear();
|
|
43660
43506
|
}
|
|
43661
43507
|
function update(options) {
|
|
43662
|
-
|
|
43508
|
+
updateRedirectsMap(options, directoryToModuleNameMap);
|
|
43663
43509
|
}
|
|
43664
43510
|
function getOrCreateCacheForDirectory(directoryName, redirectedReference) {
|
|
43665
43511
|
var path = ts.toPath(directoryName, currentDirectory, getCanonicalFileName);
|
|
43666
|
-
return getOrCreateCache(directoryToModuleNameMap, redirectedReference, path, createModeAwareCache);
|
|
43667
|
-
}
|
|
43668
|
-
function getFromCache(directoryName, name, mode, redirectedReference) {
|
|
43669
|
-
var _a, _b;
|
|
43670
|
-
var path = ts.toPath(directoryName, currentDirectory, getCanonicalFileName);
|
|
43671
|
-
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);
|
|
43672
|
-
if (result)
|
|
43673
|
-
return result;
|
|
43674
|
-
var resultFromOld = oldResolutionCache === null || oldResolutionCache === void 0 ? void 0 : oldResolutionCache.getResolved(path, name, mode, redirectedReference);
|
|
43675
|
-
if (resultFromOld)
|
|
43676
|
-
getOrCreateCacheForDirectory(directoryName, redirectedReference).set(name, mode, resultFromOld);
|
|
43677
|
-
return resultFromOld;
|
|
43512
|
+
return getOrCreateCache(directoryToModuleNameMap, redirectedReference, path, function () { return createModeAwareCache(); });
|
|
43678
43513
|
}
|
|
43679
43514
|
}
|
|
43680
|
-
/*@internal*/
|
|
43681
|
-
function getModeAwareCacheKey(specifier, mode) {
|
|
43682
|
-
return (mode === undefined ? specifier : mode + "|" + specifier);
|
|
43683
|
-
}
|
|
43684
|
-
ts.getModeAwareCacheKey = getModeAwareCacheKey;
|
|
43685
43515
|
/* @internal */
|
|
43686
43516
|
function createModeAwareCache() {
|
|
43687
43517
|
var underlying = new ts.Map();
|
|
@@ -43707,22 +43537,13 @@ var ts;
|
|
|
43707
43537
|
return cb(elem, specifier, mode);
|
|
43708
43538
|
});
|
|
43709
43539
|
},
|
|
43710
|
-
entries: function () {
|
|
43711
|
-
var keys = underlying.entries();
|
|
43712
|
-
return {
|
|
43713
|
-
next: function () {
|
|
43714
|
-
var next = keys.next();
|
|
43715
|
-
return !next.done ? { value: __spreadArray(__spreadArray([], memoizedReverseKeys.get(next.value[0]), true), [next.value[1]], false) } : next;
|
|
43716
|
-
},
|
|
43717
|
-
};
|
|
43718
|
-
},
|
|
43719
43540
|
size: function () {
|
|
43720
43541
|
return underlying.size;
|
|
43721
|
-
}
|
|
43542
|
+
}
|
|
43722
43543
|
};
|
|
43723
43544
|
return cache;
|
|
43724
43545
|
function getUnderlyingCacheKey(specifier, mode) {
|
|
43725
|
-
var result =
|
|
43546
|
+
var result = mode === undefined ? specifier : mode + "|" + specifier;
|
|
43726
43547
|
memoizedReverseKeys.set(result, [specifier, mode]);
|
|
43727
43548
|
return result;
|
|
43728
43549
|
}
|
|
@@ -43735,120 +43556,38 @@ var ts;
|
|
|
43735
43556
|
for (var i = 0; i < keys.length; ++i) {
|
|
43736
43557
|
var entry = keys[i];
|
|
43737
43558
|
// We lower-case all type references because npm automatically lowercases all packages. See GH#9824.
|
|
43738
|
-
var name = !ts.isString(entry) ?
|
|
43559
|
+
var name = !ts.isString(entry) ? entry.fileName.toLowerCase() : entry;
|
|
43739
43560
|
var mode = !ts.isString(entry) ? entry.resolutionMode || file.impliedNodeFormat : ts.getModeForResolutionAtIndex(file, i);
|
|
43740
43561
|
map.set(name, mode, values[i]);
|
|
43741
43562
|
}
|
|
43742
43563
|
return map;
|
|
43743
43564
|
}
|
|
43744
43565
|
ts.zipToModeAwareCache = zipToModeAwareCache;
|
|
43745
|
-
function
|
|
43746
|
-
var
|
|
43747
|
-
|
|
43748
|
-
var i = 0;
|
|
43749
|
-
var limit = Math.min(directory.length, resolutionDirectory.length);
|
|
43750
|
-
while (i < limit && directory.charCodeAt(i) === resolutionDirectory.charCodeAt(i)) {
|
|
43751
|
-
i++;
|
|
43752
|
-
}
|
|
43753
|
-
if (i === directory.length && (resolutionDirectory.length === i || resolutionDirectory[i] === ts.directorySeparator)) {
|
|
43754
|
-
return directory;
|
|
43755
|
-
}
|
|
43756
|
-
var rootLength = ts.getRootLength(directory);
|
|
43757
|
-
if (i < rootLength) {
|
|
43758
|
-
return undefined;
|
|
43759
|
-
}
|
|
43760
|
-
var sep = directory.lastIndexOf(ts.directorySeparator, i - 1);
|
|
43761
|
-
if (sep === -1) {
|
|
43762
|
-
return undefined;
|
|
43763
|
-
}
|
|
43764
|
-
return directory.substr(0, Math.max(sep, rootLength));
|
|
43765
|
-
}
|
|
43766
|
-
/*@internal*/
|
|
43767
|
-
function getResolvedFileNameForModuleNameToDirectorySet(result) {
|
|
43768
|
-
return result.resolvedModule &&
|
|
43769
|
-
(result.resolvedModule.originalPath || result.resolvedModule.resolvedFileName);
|
|
43770
|
-
}
|
|
43771
|
-
ts.getResolvedFileNameForModuleNameToDirectorySet = getResolvedFileNameForModuleNameToDirectorySet;
|
|
43772
|
-
/**
|
|
43773
|
-
* At first this function add entry directory -> module resolution result to the table.
|
|
43774
|
-
* Then it computes the set of parent folders for 'directory' that should have the same module resolution result
|
|
43775
|
-
* and for every parent folder in set it adds entry: parent -> module resolution. .
|
|
43776
|
-
* Lets say we first directory name: /a/b/c/d/e and resolution result is: /a/b/bar.ts.
|
|
43777
|
-
* Set of parent folders that should have the same result will be:
|
|
43778
|
-
* [
|
|
43779
|
-
* /a/b/c/d, /a/b/c, /a/b
|
|
43780
|
-
* ]
|
|
43781
|
-
* this means that request for module resolution from file in any of these folder will be immediately found in cache.
|
|
43782
|
-
*/
|
|
43783
|
-
/*@internal*/
|
|
43784
|
-
function moduleNameToDirectorySet(directoryPathMap, directory, result, getResolvedFileName, toPath, ancestoryWorker) {
|
|
43785
|
-
// if entry is already in cache do nothing
|
|
43786
|
-
if (directoryPathMap.has(directory))
|
|
43787
|
-
return;
|
|
43788
|
-
directoryPathMap.set(directory, result);
|
|
43789
|
-
var resolvedFileName = getResolvedFileName(result);
|
|
43790
|
-
// find common prefix between directory and resolved file name
|
|
43791
|
-
// this common prefix should be the shortest path that has the same resolution
|
|
43792
|
-
// directory: /a/b/c/d/e
|
|
43793
|
-
// resolvedFileName: /a/b/foo.d.ts
|
|
43794
|
-
// commonPrefix: /a/b
|
|
43795
|
-
// for failed lookups cache the result for every directory up to root
|
|
43796
|
-
var commonPrefix = resolvedFileName && getCommonPrefix(directory, resolvedFileName, toPath);
|
|
43797
|
-
var current = directory;
|
|
43798
|
-
while (current !== commonPrefix) {
|
|
43799
|
-
var parent = ts.getDirectoryPath(current);
|
|
43800
|
-
if (parent === current)
|
|
43801
|
-
break;
|
|
43802
|
-
if (directoryPathMap.has(parent)) {
|
|
43803
|
-
ancestoryWorker(parent);
|
|
43804
|
-
break;
|
|
43805
|
-
}
|
|
43806
|
-
directoryPathMap.set(parent, result);
|
|
43807
|
-
ancestoryWorker(parent);
|
|
43808
|
-
current = parent;
|
|
43809
|
-
}
|
|
43810
|
-
}
|
|
43811
|
-
ts.moduleNameToDirectorySet = moduleNameToDirectorySet;
|
|
43812
|
-
function createModuleResolutionCache(currentDirectory, getCanonicalFileName, options) {
|
|
43813
|
-
var moduleNameToDirectoryMap = createCacheWithRedirects(options);
|
|
43814
|
-
var perDirectoryResolutionCache = createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, options);
|
|
43566
|
+
function createModuleResolutionCache(currentDirectory, getCanonicalFileName, options, directoryToModuleNameMap, moduleNameToDirectoryMap) {
|
|
43567
|
+
var perDirectoryResolutionCache = createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, directoryToModuleNameMap || (directoryToModuleNameMap = createCacheWithRedirects(options)));
|
|
43568
|
+
moduleNameToDirectoryMap || (moduleNameToDirectoryMap = createCacheWithRedirects(options));
|
|
43815
43569
|
var packageJsonInfoCache = createPackageJsonInfoCache(currentDirectory, getCanonicalFileName);
|
|
43816
|
-
|
|
43817
|
-
return __assign(__assign(__assign({}, packageJsonInfoCache), perDirectoryResolutionCache), { getOrCreateCacheForModuleName: getOrCreateCacheForModuleName, getFromModuleNameCache: getFromModuleNameCache, clear: clear, update: update, getPackageJsonInfoCache: function () { return packageJsonInfoCache; }, setOldResolutionCache: setOldResolutionCache });
|
|
43570
|
+
return __assign(__assign(__assign({}, packageJsonInfoCache), perDirectoryResolutionCache), { getOrCreateCacheForModuleName: getOrCreateCacheForModuleName, clear: clear, update: update, getPackageJsonInfoCache: function () { return packageJsonInfoCache; }, clearAllExceptPackageJsonInfoCache: clearAllExceptPackageJsonInfoCache });
|
|
43818
43571
|
function clear() {
|
|
43819
|
-
|
|
43572
|
+
clearAllExceptPackageJsonInfoCache();
|
|
43573
|
+
packageJsonInfoCache.clear();
|
|
43574
|
+
}
|
|
43575
|
+
function clearAllExceptPackageJsonInfoCache() {
|
|
43820
43576
|
perDirectoryResolutionCache.clear();
|
|
43821
43577
|
moduleNameToDirectoryMap.clear();
|
|
43822
|
-
packageJsonInfoCache.clear();
|
|
43823
43578
|
}
|
|
43824
43579
|
function update(options) {
|
|
43825
|
-
|
|
43826
|
-
moduleNameToDirectoryMap.update(options);
|
|
43827
|
-
}
|
|
43828
|
-
function setOldResolutionCache(cache) {
|
|
43829
|
-
oldResolutionCache = cache;
|
|
43830
|
-
perDirectoryResolutionCache.setOldResolutionCache(cache);
|
|
43831
|
-
}
|
|
43832
|
-
function getFromModuleNameCache(directoryName, nonRelativeModuleName, mode, redirectedReference) {
|
|
43833
|
-
var _a, _b;
|
|
43834
|
-
ts.Debug.assert(!ts.isExternalModuleNameRelative(nonRelativeModuleName));
|
|
43835
|
-
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);
|
|
43836
|
-
if (result)
|
|
43837
|
-
return result;
|
|
43838
|
-
var fromOld = oldResolutionCache === null || oldResolutionCache === void 0 ? void 0 : oldResolutionCache.getResolved(toPath(directoryName), nonRelativeModuleName, mode, redirectedReference);
|
|
43839
|
-
if (fromOld)
|
|
43840
|
-
getOrCreateCacheForModuleName(nonRelativeModuleName, mode, redirectedReference).set(directoryName, fromOld);
|
|
43841
|
-
return fromOld;
|
|
43580
|
+
updateRedirectsMap(options, directoryToModuleNameMap, moduleNameToDirectoryMap);
|
|
43842
43581
|
}
|
|
43843
43582
|
function getOrCreateCacheForModuleName(nonRelativeModuleName, mode, redirectedReference) {
|
|
43844
43583
|
ts.Debug.assert(!ts.isExternalModuleNameRelative(nonRelativeModuleName));
|
|
43845
|
-
return getOrCreateCache(moduleNameToDirectoryMap, redirectedReference,
|
|
43584
|
+
return getOrCreateCache(moduleNameToDirectoryMap, redirectedReference, mode === undefined ? nonRelativeModuleName : mode + "|" + nonRelativeModuleName, createPerModuleNameCache);
|
|
43846
43585
|
}
|
|
43847
43586
|
function createPerModuleNameCache() {
|
|
43848
43587
|
var directoryPathMap = new ts.Map();
|
|
43849
43588
|
return { get: get, set: set };
|
|
43850
43589
|
function get(directory) {
|
|
43851
|
-
return directoryPathMap.get(toPath(directory));
|
|
43590
|
+
return directoryPathMap.get(ts.toPath(directory, currentDirectory, getCanonicalFileName));
|
|
43852
43591
|
}
|
|
43853
43592
|
/**
|
|
43854
43593
|
* At first this function add entry directory -> module resolution result to the table.
|
|
@@ -43862,27 +43601,74 @@ var ts;
|
|
|
43862
43601
|
* this means that request for module resolution from file in any of these folder will be immediately found in cache.
|
|
43863
43602
|
*/
|
|
43864
43603
|
function set(directory, result) {
|
|
43865
|
-
|
|
43604
|
+
var path = ts.toPath(directory, currentDirectory, getCanonicalFileName);
|
|
43605
|
+
// if entry is already in cache do nothing
|
|
43606
|
+
if (directoryPathMap.has(path)) {
|
|
43607
|
+
return;
|
|
43608
|
+
}
|
|
43609
|
+
directoryPathMap.set(path, result);
|
|
43610
|
+
var resolvedFileName = result.resolvedModule &&
|
|
43611
|
+
(result.resolvedModule.originalPath || result.resolvedModule.resolvedFileName);
|
|
43612
|
+
// find common prefix between directory and resolved file name
|
|
43613
|
+
// this common prefix should be the shortest path that has the same resolution
|
|
43614
|
+
// directory: /a/b/c/d/e
|
|
43615
|
+
// resolvedFileName: /a/b/foo.d.ts
|
|
43616
|
+
// commonPrefix: /a/b
|
|
43617
|
+
// for failed lookups cache the result for every directory up to root
|
|
43618
|
+
var commonPrefix = resolvedFileName && getCommonPrefix(path, resolvedFileName);
|
|
43619
|
+
var current = path;
|
|
43620
|
+
while (current !== commonPrefix) {
|
|
43621
|
+
var parent = ts.getDirectoryPath(current);
|
|
43622
|
+
if (parent === current || directoryPathMap.has(parent)) {
|
|
43623
|
+
break;
|
|
43624
|
+
}
|
|
43625
|
+
directoryPathMap.set(parent, result);
|
|
43626
|
+
current = parent;
|
|
43627
|
+
}
|
|
43628
|
+
}
|
|
43629
|
+
function getCommonPrefix(directory, resolution) {
|
|
43630
|
+
var resolutionDirectory = ts.toPath(ts.getDirectoryPath(resolution), currentDirectory, getCanonicalFileName);
|
|
43631
|
+
// find first position where directory and resolution differs
|
|
43632
|
+
var i = 0;
|
|
43633
|
+
var limit = Math.min(directory.length, resolutionDirectory.length);
|
|
43634
|
+
while (i < limit && directory.charCodeAt(i) === resolutionDirectory.charCodeAt(i)) {
|
|
43635
|
+
i++;
|
|
43636
|
+
}
|
|
43637
|
+
if (i === directory.length && (resolutionDirectory.length === i || resolutionDirectory[i] === ts.directorySeparator)) {
|
|
43638
|
+
return directory;
|
|
43639
|
+
}
|
|
43640
|
+
var rootLength = ts.getRootLength(directory);
|
|
43641
|
+
if (i < rootLength) {
|
|
43642
|
+
return undefined;
|
|
43643
|
+
}
|
|
43644
|
+
var sep = directory.lastIndexOf(ts.directorySeparator, i - 1);
|
|
43645
|
+
if (sep === -1) {
|
|
43646
|
+
return undefined;
|
|
43647
|
+
}
|
|
43648
|
+
return directory.substr(0, Math.max(sep, rootLength));
|
|
43866
43649
|
}
|
|
43867
|
-
}
|
|
43868
|
-
function toPath(fileName) {
|
|
43869
|
-
return ts.toPath(fileName, currentDirectory, getCanonicalFileName);
|
|
43870
43650
|
}
|
|
43871
43651
|
}
|
|
43872
43652
|
ts.createModuleResolutionCache = createModuleResolutionCache;
|
|
43873
|
-
function createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, options, packageJsonInfoCache) {
|
|
43874
|
-
var perDirectoryResolutionCache = createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, options);
|
|
43653
|
+
function createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, options, packageJsonInfoCache, directoryToModuleNameMap) {
|
|
43654
|
+
var perDirectoryResolutionCache = createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, directoryToModuleNameMap || (directoryToModuleNameMap = createCacheWithRedirects(options)));
|
|
43875
43655
|
packageJsonInfoCache || (packageJsonInfoCache = createPackageJsonInfoCache(currentDirectory, getCanonicalFileName));
|
|
43876
|
-
return __assign(__assign(__assign({}, packageJsonInfoCache), perDirectoryResolutionCache), { clear: clear });
|
|
43656
|
+
return __assign(__assign(__assign({}, packageJsonInfoCache), perDirectoryResolutionCache), { clear: clear, clearAllExceptPackageJsonInfoCache: clearAllExceptPackageJsonInfoCache });
|
|
43877
43657
|
function clear() {
|
|
43878
|
-
|
|
43658
|
+
clearAllExceptPackageJsonInfoCache();
|
|
43879
43659
|
packageJsonInfoCache.clear();
|
|
43880
43660
|
}
|
|
43661
|
+
function clearAllExceptPackageJsonInfoCache() {
|
|
43662
|
+
perDirectoryResolutionCache.clear();
|
|
43663
|
+
}
|
|
43881
43664
|
}
|
|
43882
43665
|
ts.createTypeReferenceDirectiveResolutionCache = createTypeReferenceDirectiveResolutionCache;
|
|
43883
43666
|
function resolveModuleNameFromCache(moduleName, containingFile, cache, mode) {
|
|
43884
43667
|
var containingDirectory = ts.getDirectoryPath(containingFile);
|
|
43885
|
-
|
|
43668
|
+
var perFolderCache = cache && cache.getOrCreateCacheForDirectory(containingDirectory);
|
|
43669
|
+
if (!perFolderCache)
|
|
43670
|
+
return undefined;
|
|
43671
|
+
return perFolderCache.get(moduleName, mode);
|
|
43886
43672
|
}
|
|
43887
43673
|
ts.resolveModuleNameFromCache = resolveModuleNameFromCache;
|
|
43888
43674
|
function resolveModuleName(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
@@ -43897,7 +43683,8 @@ var ts;
|
|
|
43897
43683
|
}
|
|
43898
43684
|
}
|
|
43899
43685
|
var containingDirectory = ts.getDirectoryPath(containingFile);
|
|
43900
|
-
var
|
|
43686
|
+
var perFolderCache = cache && cache.getOrCreateCacheForDirectory(containingDirectory, redirectedReference);
|
|
43687
|
+
var result = perFolderCache && perFolderCache.get(moduleName, resolutionMode);
|
|
43901
43688
|
if (result) {
|
|
43902
43689
|
if (traceEnabled) {
|
|
43903
43690
|
trace(host, ts.Diagnostics.Resolution_for_module_0_was_found_in_cache_from_location_1, moduleName, containingDirectory);
|
|
@@ -43949,8 +43736,8 @@ var ts;
|
|
|
43949
43736
|
if (result && result.resolvedModule)
|
|
43950
43737
|
ts.perfLogger.logInfoEvent("Module \"" + moduleName + "\" resolved to \"" + result.resolvedModule.resolvedFileName + "\"");
|
|
43951
43738
|
ts.perfLogger.logStopResolveModule((result && result.resolvedModule) ? "" + result.resolvedModule.resolvedFileName : "null");
|
|
43952
|
-
if (
|
|
43953
|
-
|
|
43739
|
+
if (perFolderCache) {
|
|
43740
|
+
perFolderCache.set(moduleName, resolutionMode, result);
|
|
43954
43741
|
if (!ts.isExternalModuleNameRelative(moduleName)) {
|
|
43955
43742
|
// put result in per-module name cache
|
|
43956
43743
|
cache.getOrCreateCacheForModuleName(moduleName, resolutionMode, redirectedReference).set(containingDirectory, result);
|
|
@@ -44236,10 +44023,10 @@ var ts;
|
|
|
44236
44023
|
features: features,
|
|
44237
44024
|
conditions: conditions,
|
|
44238
44025
|
requestContainingDirectory: containingDirectory,
|
|
44239
|
-
|
|
44026
|
+
reportDiagnostic: function (diag) { return void diagnostics.push(diag); },
|
|
44240
44027
|
};
|
|
44241
44028
|
var result = ts.forEach(extensions, function (ext) { return tryResolve(ext); });
|
|
44242
|
-
return createResolvedModuleWithFailedLookupLocations(
|
|
44029
|
+
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);
|
|
44243
44030
|
function tryResolve(extensions) {
|
|
44244
44031
|
var loader = function (extensions, candidate, onlyRecordFailures, state) { return nodeLoadModuleByRelativeName(extensions, candidate, onlyRecordFailures, state, /*considerPackageJson*/ true); };
|
|
44245
44032
|
var resolved = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loader, state);
|
|
@@ -44618,47 +44405,25 @@ var ts;
|
|
|
44618
44405
|
features: NodeResolutionFeatures.None,
|
|
44619
44406
|
conditions: ts.emptyArray,
|
|
44620
44407
|
requestContainingDirectory: undefined,
|
|
44621
|
-
|
|
44408
|
+
reportDiagnostic: ts.noop
|
|
44622
44409
|
};
|
|
44623
44410
|
}
|
|
44624
44411
|
ts.getTemporaryModuleResolutionState = getTemporaryModuleResolutionState;
|
|
44625
|
-
/*@internal*/
|
|
44626
|
-
function getPackageScope(dir, packageJsonInfoCache, host, options) {
|
|
44627
|
-
var state = getTemporaryModuleResolutionState(packageJsonInfoCache, host, options);
|
|
44628
|
-
var failedLookupLocations = [];
|
|
44629
|
-
var affectingLocations = [];
|
|
44630
|
-
state.failedLookupLocations = failedLookupLocations;
|
|
44631
|
-
state.affectingLocations = affectingLocations;
|
|
44632
|
-
var result = ts.forEachAncestorDirectory(dir, function (directory) {
|
|
44633
|
-
var _a;
|
|
44634
|
-
var fromCache = (_a = state.packageJsonInfoCache) === null || _a === void 0 ? void 0 : _a.getPackageJsonScope(directory);
|
|
44635
|
-
if (fromCache) {
|
|
44636
|
-
var host_2 = state.host, traceEnabled = state.traceEnabled;
|
|
44637
|
-
if (traceEnabled) {
|
|
44638
|
-
trace(host_2, fromCache.info ?
|
|
44639
|
-
ts.Diagnostics.Directory_0_resolves_to_1_scope_according_to_cache :
|
|
44640
|
-
ts.Diagnostics.Directory_0_has_no_containing_package_json_scope_according_to_cache, directory, getPackageJsconLocationFromScope(fromCache));
|
|
44641
|
-
}
|
|
44642
|
-
return fromCache;
|
|
44643
|
-
}
|
|
44644
|
-
var info = getPackageJsonInfo(directory, /*onlyRecordFailures*/ false, state);
|
|
44645
|
-
if (info)
|
|
44646
|
-
return { info: info };
|
|
44647
|
-
}) || { info: undefined };
|
|
44648
|
-
result.failedLookupLocations = updateResolutionField(result.failedLookupLocations, !options.cacheResolutions || !result.info ? failedLookupLocations : undefined);
|
|
44649
|
-
result.affectingLocations = updateResolutionField(result.affectingLocations, affectingLocations);
|
|
44650
|
-
packageJsonInfoCache === null || packageJsonInfoCache === void 0 ? void 0 : packageJsonInfoCache.setPackageJsonScope(dir, result);
|
|
44651
|
-
return result;
|
|
44652
|
-
}
|
|
44653
|
-
ts.getPackageScope = getPackageScope;
|
|
44654
44412
|
/**
|
|
44655
|
-
* A function for locating the package.json scope
|
|
44413
|
+
* A function for locating the package.json scope for a given path
|
|
44656
44414
|
*/
|
|
44657
44415
|
/*@internal*/
|
|
44658
|
-
function getPackageScopeForPath(
|
|
44659
|
-
|
|
44660
|
-
|
|
44661
|
-
|
|
44416
|
+
function getPackageScopeForPath(fileName, state) {
|
|
44417
|
+
var parts = ts.getPathComponents(fileName);
|
|
44418
|
+
parts.pop();
|
|
44419
|
+
while (parts.length > 0) {
|
|
44420
|
+
var pkg = getPackageJsonInfo(ts.getPathFromPathComponents(parts), /*onlyRecordFailures*/ false, state);
|
|
44421
|
+
if (pkg) {
|
|
44422
|
+
return pkg;
|
|
44423
|
+
}
|
|
44424
|
+
parts.pop();
|
|
44425
|
+
}
|
|
44426
|
+
return undefined;
|
|
44662
44427
|
}
|
|
44663
44428
|
ts.getPackageScopeForPath = getPackageScopeForPath;
|
|
44664
44429
|
/*@internal*/
|
|
@@ -44687,13 +44452,12 @@ var ts;
|
|
|
44687
44452
|
}
|
|
44688
44453
|
var directoryExists = ts.directoryProbablyExists(packageDirectory, host);
|
|
44689
44454
|
if (directoryExists && host.fileExists(packageJsonPath)) {
|
|
44690
|
-
var
|
|
44691
|
-
var packageJsonContent = ts.readJson(packageJsonPath, packageJsonText);
|
|
44455
|
+
var packageJsonContent = ts.readJson(packageJsonPath, host);
|
|
44692
44456
|
if (traceEnabled) {
|
|
44693
44457
|
trace(host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath);
|
|
44694
44458
|
}
|
|
44695
44459
|
var versionPaths = readPackageJsonTypesVersionPaths(packageJsonContent, state);
|
|
44696
|
-
var result = { packageDirectory: packageDirectory,
|
|
44460
|
+
var result = { packageDirectory: packageDirectory, packageJsonContent: packageJsonContent, versionPaths: versionPaths, resolvedEntrypoints: undefined };
|
|
44697
44461
|
(_b = state.packageJsonInfoCache) === null || _b === void 0 ? void 0 : _b.setPackageJsonInfo(packageJsonPath, result);
|
|
44698
44462
|
state.affectingLocations.push(packageJsonPath);
|
|
44699
44463
|
return result;
|
|
@@ -44819,7 +44583,7 @@ var ts;
|
|
|
44819
44583
|
function loadModuleFromSelfNameReference(extensions, moduleName, directory, state, cache, redirectedReference) {
|
|
44820
44584
|
var _a, _b;
|
|
44821
44585
|
var useCaseSensitiveFileNames = typeof state.host.useCaseSensitiveFileNames === "function" ? state.host.useCaseSensitiveFileNames() : state.host.useCaseSensitiveFileNames;
|
|
44822
|
-
var directoryPath = ts.toPath(directory, (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a), ts.createGetCanonicalFileName(useCaseSensitiveFileNames === undefined ? true : useCaseSensitiveFileNames));
|
|
44586
|
+
var directoryPath = ts.toPath(ts.combinePaths(directory, "dummy"), (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a), ts.createGetCanonicalFileName(useCaseSensitiveFileNames === undefined ? true : useCaseSensitiveFileNames));
|
|
44823
44587
|
var scope = getPackageScopeForPath(directoryPath, state);
|
|
44824
44588
|
if (!scope || !scope.packageJsonContent.exports) {
|
|
44825
44589
|
return undefined;
|
|
@@ -44878,7 +44642,7 @@ var ts;
|
|
|
44878
44642
|
return toSearchResult(/*value*/ undefined);
|
|
44879
44643
|
}
|
|
44880
44644
|
var useCaseSensitiveFileNames = typeof state.host.useCaseSensitiveFileNames === "function" ? state.host.useCaseSensitiveFileNames() : state.host.useCaseSensitiveFileNames;
|
|
44881
|
-
var directoryPath = ts.toPath(directory, (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a), ts.createGetCanonicalFileName(useCaseSensitiveFileNames === undefined ? true : useCaseSensitiveFileNames));
|
|
44645
|
+
var directoryPath = ts.toPath(ts.combinePaths(directory, "dummy"), (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a), ts.createGetCanonicalFileName(useCaseSensitiveFileNames === undefined ? true : useCaseSensitiveFileNames));
|
|
44882
44646
|
var scope = getPackageScopeForPath(directoryPath, state);
|
|
44883
44647
|
if (!scope) {
|
|
44884
44648
|
if (state.traceEnabled) {
|
|
@@ -45118,8 +44882,12 @@ var ts;
|
|
|
45118
44882
|
fragment = ts.ensureTrailingDirectorySeparator(commonDir_1);
|
|
45119
44883
|
}
|
|
45120
44884
|
}
|
|
45121
|
-
if (commonSourceDirGuesses.length > 1)
|
|
45122
|
-
state.
|
|
44885
|
+
if (commonSourceDirGuesses.length > 1) {
|
|
44886
|
+
state.reportDiagnostic(ts.createCompilerDiagnostic(isImports
|
|
44887
|
+
? 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
|
|
44888
|
+
: 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
|
|
44889
|
+
packagePath));
|
|
44890
|
+
}
|
|
45123
44891
|
for (var _i = 0, commonSourceDirGuesses_1 = commonSourceDirGuesses; _i < commonSourceDirGuesses_1.length; _i++) {
|
|
45124
44892
|
var commonSourceDirGuess = commonSourceDirGuesses_1[_i];
|
|
45125
44893
|
var candidateDirectories = getOutputDirectoriesForBaseDirectory(commonSourceDirGuess);
|
|
@@ -45189,10 +44957,10 @@ var ts;
|
|
|
45189
44957
|
return loadModuleFromNearestNodeModulesDirectoryWorker(Extensions.DtsOnly, moduleName, directory, state, /*typesScopeOnly*/ true, /*cache*/ undefined, /*redirectedReference*/ undefined);
|
|
45190
44958
|
}
|
|
45191
44959
|
function loadModuleFromNearestNodeModulesDirectoryWorker(extensions, moduleName, directory, state, typesScopeOnly, cache, redirectedReference) {
|
|
45192
|
-
var
|
|
44960
|
+
var perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName, state.features === 0 ? undefined : state.features & NodeResolutionFeatures.EsmMode ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS, redirectedReference);
|
|
45193
44961
|
return ts.forEachAncestorDirectory(ts.normalizeSlashes(directory), function (ancestorDirectory) {
|
|
45194
44962
|
if (ts.getBaseFileName(ancestorDirectory) !== "node_modules") {
|
|
45195
|
-
var resolutionFromCache = tryFindNonRelativeModuleNameInCache(
|
|
44963
|
+
var resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache, moduleName, ancestorDirectory, state);
|
|
45196
44964
|
if (resolutionFromCache) {
|
|
45197
44965
|
return resolutionFromCache;
|
|
45198
44966
|
}
|
|
@@ -45344,8 +45112,8 @@ var ts;
|
|
|
45344
45112
|
typesPackageName;
|
|
45345
45113
|
}
|
|
45346
45114
|
ts.unmangleScopedPackageName = unmangleScopedPackageName;
|
|
45347
|
-
function tryFindNonRelativeModuleNameInCache(cache, moduleName,
|
|
45348
|
-
var result = cache
|
|
45115
|
+
function tryFindNonRelativeModuleNameInCache(cache, moduleName, containingDirectory, state) {
|
|
45116
|
+
var result = cache && cache.get(containingDirectory);
|
|
45349
45117
|
if (result) {
|
|
45350
45118
|
if (state.traceEnabled) {
|
|
45351
45119
|
trace(state.host, ts.Diagnostics.Resolution_for_module_0_was_found_in_cache_from_location_1, moduleName, containingDirectory);
|
|
@@ -45370,11 +45138,11 @@ var ts;
|
|
|
45370
45138
|
features: NodeResolutionFeatures.None,
|
|
45371
45139
|
conditions: [],
|
|
45372
45140
|
requestContainingDirectory: containingDirectory,
|
|
45373
|
-
|
|
45141
|
+
reportDiagnostic: function (diag) { return void diagnostics.push(diag); },
|
|
45374
45142
|
};
|
|
45375
45143
|
var resolved = tryResolve(Extensions.TypeScript) || tryResolve(Extensions.JavaScript);
|
|
45376
45144
|
// No originalPath because classic resolution doesn't resolve realPath
|
|
45377
|
-
return createResolvedModuleWithFailedLookupLocations(
|
|
45145
|
+
return createResolvedModuleWithFailedLookupLocations(resolved && resolved.value,
|
|
45378
45146
|
/*isExternalLibraryImport*/ false, failedLookupLocations, affectingLocations, diagnostics, state.resultFromCache);
|
|
45379
45147
|
function tryResolve(extensions) {
|
|
45380
45148
|
var resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFileNoPackageId, state);
|
|
@@ -45382,9 +45150,10 @@ var ts;
|
|
|
45382
45150
|
return { value: resolvedUsingSettings };
|
|
45383
45151
|
}
|
|
45384
45152
|
if (!ts.isExternalModuleNameRelative(moduleName)) {
|
|
45153
|
+
var perModuleNameCache_1 = cache && cache.getOrCreateCacheForModuleName(moduleName, /*mode*/ undefined, redirectedReference);
|
|
45385
45154
|
// Climb up parent directories looking for a module.
|
|
45386
45155
|
var resolved_3 = ts.forEachAncestorDirectory(containingDirectory, function (directory) {
|
|
45387
|
-
var resolutionFromCache = tryFindNonRelativeModuleNameInCache(
|
|
45156
|
+
var resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache_1, moduleName, directory, state);
|
|
45388
45157
|
if (resolutionFromCache) {
|
|
45389
45158
|
return resolutionFromCache;
|
|
45390
45159
|
}
|
|
@@ -45429,10 +45198,10 @@ var ts;
|
|
|
45429
45198
|
features: NodeResolutionFeatures.None,
|
|
45430
45199
|
conditions: [],
|
|
45431
45200
|
requestContainingDirectory: undefined,
|
|
45432
|
-
|
|
45201
|
+
reportDiagnostic: function (diag) { return void diagnostics.push(diag); },
|
|
45433
45202
|
};
|
|
45434
45203
|
var resolved = loadModuleFromImmediateNodeModulesDirectory(Extensions.DtsOnly, moduleName, globalCache, state, /*typesScopeOnly*/ false, /*cache*/ undefined, /*redirectedReference*/ undefined);
|
|
45435
|
-
return createResolvedModuleWithFailedLookupLocations(
|
|
45204
|
+
return createResolvedModuleWithFailedLookupLocations(resolved,
|
|
45436
45205
|
/*isExternalLibraryImport*/ true, failedLookupLocations, affectingLocations, diagnostics, state.resultFromCache);
|
|
45437
45206
|
}
|
|
45438
45207
|
ts.loadModuleFromGlobalCache = loadModuleFromGlobalCache;
|
|
@@ -49139,10 +48908,9 @@ var ts;
|
|
|
49139
48908
|
host.getSourceFiles().forEach(function (sf) {
|
|
49140
48909
|
if (!sf.resolvedModules)
|
|
49141
48910
|
return;
|
|
49142
|
-
sf.resolvedModules.forEach(function (
|
|
49143
|
-
|
|
49144
|
-
|
|
49145
|
-
map.set(resolvedModule.packageId.name, resolvedModule.extension === ".d.ts" /* Dts */ || !!map.get(resolvedModule.packageId.name));
|
|
48911
|
+
sf.resolvedModules.forEach(function (r) {
|
|
48912
|
+
if (r && r.packageId)
|
|
48913
|
+
map.set(r.packageId.name, r.extension === ".d.ts" /* Dts */ || !!map.get(r.packageId.name));
|
|
49146
48914
|
});
|
|
49147
48915
|
});
|
|
49148
48916
|
return map;
|
|
@@ -52135,7 +51903,7 @@ var ts;
|
|
|
52135
51903
|
: undefined;
|
|
52136
51904
|
}
|
|
52137
51905
|
function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation) {
|
|
52138
|
-
var _a, _b, _c, _d, _e, _f, _g, _h
|
|
51906
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
52139
51907
|
if (isForAugmentation === void 0) { isForAugmentation = false; }
|
|
52140
51908
|
if (ts.startsWith(moduleReference, "@types/")) {
|
|
52141
51909
|
var diag = ts.Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1;
|
|
@@ -52186,7 +51954,7 @@ var ts;
|
|
|
52186
51954
|
var diagnosticDetails = void 0;
|
|
52187
51955
|
var ext = ts.tryGetExtensionFromPath(currentSourceFile.fileName);
|
|
52188
51956
|
if (ext === ".ts" /* Ts */ || ext === ".js" /* Js */ || ext === ".tsx" /* Tsx */ || ext === ".jsx" /* Jsx */) {
|
|
52189
|
-
var scope =
|
|
51957
|
+
var scope = currentSourceFile.packageJsonScope;
|
|
52190
51958
|
var targetExt = ext === ".ts" /* Ts */ ? ".mts" /* Mts */ : ext === ".js" /* Js */ ? ".mjs" /* Mjs */ : undefined;
|
|
52191
51959
|
if (scope && !scope.packageJsonContent.type) {
|
|
52192
51960
|
if (targetExt) {
|
|
@@ -52287,10 +52055,10 @@ var ts;
|
|
|
52287
52055
|
}
|
|
52288
52056
|
else if (mode === ts.ModuleKind.ESNext && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) {
|
|
52289
52057
|
var absoluteRef_1 = ts.getNormalizedAbsolutePath(moduleReference, ts.getDirectoryPath(currentSourceFile.path));
|
|
52290
|
-
var suggestedExt = (
|
|
52058
|
+
var suggestedExt = (_h = suggestedExtensions.find(function (_a) {
|
|
52291
52059
|
var actualExt = _a[0], _importExt = _a[1];
|
|
52292
52060
|
return host.fileExists(absoluteRef_1 + actualExt);
|
|
52293
|
-
})) === null ||
|
|
52061
|
+
})) === null || _h === void 0 ? void 0 : _h[1];
|
|
52294
52062
|
if (suggestedExt) {
|
|
52295
52063
|
error(errorNode, ts.Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node16_or_nodenext_Did_you_mean_0, moduleReference + suggestedExt);
|
|
52296
52064
|
}
|
|
@@ -87316,9 +87084,9 @@ var ts;
|
|
|
87316
87084
|
var paramTag = node.parent.parent;
|
|
87317
87085
|
if (ts.isJSDocTypeExpression(node.parent) && ts.isJSDocParameterTag(paramTag)) {
|
|
87318
87086
|
// Else we will add a diagnostic, see `checkJSDocVariadicType`.
|
|
87319
|
-
var
|
|
87087
|
+
var host_2 = ts.getHostSignatureFromJSDoc(paramTag);
|
|
87320
87088
|
var isCallbackTag = ts.isJSDocCallbackTag(paramTag.parent.parent);
|
|
87321
|
-
if (
|
|
87089
|
+
if (host_2 || isCallbackTag) {
|
|
87322
87090
|
/*
|
|
87323
87091
|
Only return an array type if the corresponding parameter is marked as a rest parameter, or if there are no parameters.
|
|
87324
87092
|
So in the following situation we will not create an array type:
|
|
@@ -87328,7 +87096,7 @@ var ts;
|
|
|
87328
87096
|
*/
|
|
87329
87097
|
var lastParamDeclaration = isCallbackTag
|
|
87330
87098
|
? ts.lastOrUndefined(paramTag.parent.parent.typeExpression.parameters)
|
|
87331
|
-
: ts.lastOrUndefined(
|
|
87099
|
+
: ts.lastOrUndefined(host_2.parameters);
|
|
87332
87100
|
var symbol = ts.getParameterSymbolFromJSDoc(paramTag);
|
|
87333
87101
|
if (!lastParamDeclaration ||
|
|
87334
87102
|
symbol && lastParamDeclaration.symbol === symbol && ts.isRestParameter(lastParamDeclaration)) {
|
|
@@ -88753,12 +88521,11 @@ var ts;
|
|
|
88753
88521
|
if (resolvedTypeReferenceDirectives) {
|
|
88754
88522
|
// populate reverse mapping: file path -> type reference directive that was resolved to this file
|
|
88755
88523
|
fileToDirective = new ts.Map();
|
|
88756
|
-
resolvedTypeReferenceDirectives.forEach(function (
|
|
88757
|
-
|
|
88758
|
-
if (!resolvedTypeReferenceDirective || !resolvedTypeReferenceDirective.resolvedFileName) {
|
|
88524
|
+
resolvedTypeReferenceDirectives.forEach(function (resolvedDirective, key, mode) {
|
|
88525
|
+
if (!resolvedDirective || !resolvedDirective.resolvedFileName) {
|
|
88759
88526
|
return;
|
|
88760
88527
|
}
|
|
88761
|
-
var file = host.getSourceFile(
|
|
88528
|
+
var file = host.getSourceFile(resolvedDirective.resolvedFileName);
|
|
88762
88529
|
if (file) {
|
|
88763
88530
|
// Add the transitive closure of path references loaded by this file (as long as they are not)
|
|
88764
88531
|
// part of an existing type reference.
|
|
@@ -90114,9 +89881,9 @@ var ts;
|
|
|
90114
89881
|
}
|
|
90115
89882
|
var parent = ts.walkUpParenthesizedTypes(node.parent);
|
|
90116
89883
|
if (ts.isInJSFile(parent) && ts.isJSDocTypeExpression(parent)) {
|
|
90117
|
-
var
|
|
90118
|
-
if (
|
|
90119
|
-
parent = ts.getSingleVariableOfVariableStatement(
|
|
89884
|
+
var host_3 = ts.getJSDocHost(parent);
|
|
89885
|
+
if (host_3) {
|
|
89886
|
+
parent = ts.getSingleVariableOfVariableStatement(host_3) || host_3;
|
|
90120
89887
|
}
|
|
90121
89888
|
}
|
|
90122
89889
|
switch (parent.kind) {
|
|
@@ -112275,7 +112042,7 @@ var ts;
|
|
|
112275
112042
|
var sourceMap = sourceMapGenerator.toString();
|
|
112276
112043
|
ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap, /*writeByteOrderMark*/ false, sourceFiles);
|
|
112277
112044
|
if (printer.bundleFileInfo)
|
|
112278
|
-
printer.bundleFileInfo.mapHash = ts.computeSignature(sourceMap, host);
|
|
112045
|
+
printer.bundleFileInfo.mapHash = ts.computeSignature(sourceMap, ts.maybeBind(host, host.createHash));
|
|
112279
112046
|
}
|
|
112280
112047
|
}
|
|
112281
112048
|
else {
|
|
@@ -112287,7 +112054,7 @@ var ts;
|
|
|
112287
112054
|
// 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
|
|
112288
112055
|
// 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
|
|
112289
112056
|
if (printer.bundleFileInfo)
|
|
112290
|
-
printer.bundleFileInfo.hash = ts.computeSignature(text, host);
|
|
112057
|
+
printer.bundleFileInfo.hash = ts.computeSignature(text, ts.maybeBind(host, host.createHash));
|
|
112291
112058
|
// Reset state
|
|
112292
112059
|
writer.clear();
|
|
112293
112060
|
}
|
|
@@ -112440,6 +112207,7 @@ var ts;
|
|
|
112440
112207
|
}
|
|
112441
112208
|
ts.emitUsingBuildInfo = emitUsingBuildInfo;
|
|
112442
112209
|
function emitUsingBuildInfoWorker(config, host, getCommandLine, customTransformers) {
|
|
112210
|
+
var createHash = ts.maybeBind(host, host.createHash);
|
|
112443
112211
|
var _a = getOutputPathsForBundle(config.options, /*forceDtsPaths*/ false), buildInfoPath = _a.buildInfoPath, jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath;
|
|
112444
112212
|
// If host directly provides buildinfo we can get it directly. This allows host to cache the buildinfo
|
|
112445
112213
|
var buildInfo = host.getBuildInfo(buildInfoPath, config.options);
|
|
@@ -112451,25 +112219,25 @@ var ts;
|
|
|
112451
112219
|
if (!jsFileText)
|
|
112452
112220
|
return jsFilePath;
|
|
112453
112221
|
// If the jsFileText is not same has what it was created with, tsbuildinfo is stale so dont use it
|
|
112454
|
-
if (ts.computeSignature(jsFileText,
|
|
112222
|
+
if (ts.computeSignature(jsFileText, createHash) !== buildInfo.bundle.js.hash)
|
|
112455
112223
|
return jsFilePath;
|
|
112456
112224
|
var sourceMapText = sourceMapFilePath && host.readFile(sourceMapFilePath);
|
|
112457
112225
|
// error if no source map or for now if inline sourcemap
|
|
112458
112226
|
if ((sourceMapFilePath && !sourceMapText) || config.options.inlineSourceMap)
|
|
112459
112227
|
return sourceMapFilePath || "inline sourcemap decoding";
|
|
112460
|
-
if (sourceMapFilePath && ts.computeSignature(sourceMapText,
|
|
112228
|
+
if (sourceMapFilePath && ts.computeSignature(sourceMapText, createHash) !== buildInfo.bundle.js.mapHash)
|
|
112461
112229
|
return sourceMapFilePath;
|
|
112462
112230
|
// read declaration text
|
|
112463
112231
|
var declarationText = declarationFilePath && host.readFile(declarationFilePath);
|
|
112464
112232
|
if (declarationFilePath && !declarationText)
|
|
112465
112233
|
return declarationFilePath;
|
|
112466
|
-
if (declarationFilePath && ts.computeSignature(declarationText,
|
|
112234
|
+
if (declarationFilePath && ts.computeSignature(declarationText, createHash) !== buildInfo.bundle.dts.hash)
|
|
112467
112235
|
return declarationFilePath;
|
|
112468
112236
|
var declarationMapText = declarationMapPath && host.readFile(declarationMapPath);
|
|
112469
112237
|
// error if no source map or for now if inline sourcemap
|
|
112470
112238
|
if ((declarationMapPath && !declarationMapText) || config.options.inlineSourceMap)
|
|
112471
112239
|
return declarationMapPath || "inline sourcemap decoding";
|
|
112472
|
-
if (declarationMapPath && ts.computeSignature(declarationMapText,
|
|
112240
|
+
if (declarationMapPath && ts.computeSignature(declarationMapText, createHash) !== buildInfo.bundle.dts.mapHash)
|
|
112473
112241
|
return declarationMapPath;
|
|
112474
112242
|
var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
|
|
112475
112243
|
var ownPrependInput = ts.createInputFiles(jsFileText, declarationText, sourceMapFilePath, sourceMapText, declarationMapPath, declarationMapText, jsFilePath, declarationFilePath, buildInfoPath, buildInfo,
|
|
@@ -112509,7 +112277,7 @@ var ts;
|
|
|
112509
112277
|
newBuildInfo.program = buildInfo.program;
|
|
112510
112278
|
if (newBuildInfo.program && changedDtsText !== undefined && config.options.composite) {
|
|
112511
112279
|
// Update the output signature
|
|
112512
|
-
newBuildInfo.program.outSignature = ts.computeSignature(changedDtsText,
|
|
112280
|
+
newBuildInfo.program.outSignature = ts.computeSignature(changedDtsText, createHash, changedDtsData);
|
|
112513
112281
|
}
|
|
112514
112282
|
// Update sourceFileInfo
|
|
112515
112283
|
var _a = buildInfo.bundle, js = _a.js, dts = _a.dts, sourceFiles = _a.sourceFiles;
|
|
@@ -112544,7 +112312,7 @@ var ts;
|
|
|
112544
112312
|
getSourceFileFromReference: ts.returnUndefined,
|
|
112545
112313
|
redirectTargetsMap: ts.createMultiMap(),
|
|
112546
112314
|
getFileIncludeReasons: ts.notImplemented,
|
|
112547
|
-
createHash:
|
|
112315
|
+
createHash: createHash,
|
|
112548
112316
|
buildInfoCallbacks: host.buildInfoCallbacks,
|
|
112549
112317
|
};
|
|
112550
112318
|
emitFiles(ts.notImplementedResolver, emitHost,
|
|
@@ -118048,7 +117816,7 @@ var ts;
|
|
|
118048
117816
|
var result = void 0;
|
|
118049
117817
|
var mode = getModeForFileReference(name, containingFileMode);
|
|
118050
117818
|
// We lower-case all type references because npm automatically lowercases all packages. See GH#9824.
|
|
118051
|
-
var strName = ts.isString(name) ? name :
|
|
117819
|
+
var strName = ts.isString(name) ? name : name.fileName.toLowerCase();
|
|
118052
117820
|
var cacheKey = mode !== undefined ? mode + "|" + strName : strName;
|
|
118053
117821
|
if (cache.has(cacheKey)) {
|
|
118054
117822
|
result = cache.get(cacheKey);
|
|
@@ -118152,22 +117920,8 @@ var ts;
|
|
|
118152
117920
|
return elem.value.text === "import" ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS;
|
|
118153
117921
|
}
|
|
118154
117922
|
ts.getResolutionModeOverrideForClause = getResolutionModeOverrideForClause;
|
|
118155
|
-
var emptyResolution = {
|
|
118156
|
-
resolvedModule: undefined,
|
|
118157
|
-
resolvedTypeReferenceDirective: undefined,
|
|
118158
|
-
failedLookupLocations: [],
|
|
118159
|
-
affectingLocations: [],
|
|
118160
|
-
resolutionDiagnostics: [],
|
|
118161
|
-
};
|
|
118162
|
-
function isResolvedModuleWithFailedLookupLocation(resolved) {
|
|
118163
|
-
return !!resolved && !!resolved.failedLookupLocations;
|
|
118164
|
-
}
|
|
118165
|
-
function isResolvedTypeReferenceDirectiveWithFailedLookupLocations(resolved) {
|
|
118166
|
-
return !!resolved && !!resolved.failedLookupLocations;
|
|
118167
|
-
}
|
|
118168
117923
|
/* @internal */
|
|
118169
|
-
function loadWithModeAwareCache(names, containingFile, containingFileName, redirectedReference,
|
|
118170
|
-
var _a;
|
|
117924
|
+
function loadWithModeAwareCache(names, containingFile, containingFileName, redirectedReference, loader) {
|
|
118171
117925
|
if (names.length === 0) {
|
|
118172
117926
|
return [];
|
|
118173
117927
|
}
|
|
@@ -118177,7 +117931,7 @@ var ts;
|
|
|
118177
117931
|
for (var _i = 0, names_3 = names; _i < names_3.length; _i++) {
|
|
118178
117932
|
var name = names_3[_i];
|
|
118179
117933
|
var result = void 0;
|
|
118180
|
-
var mode = getModeForResolutionAtIndex(containingFile,
|
|
117934
|
+
var mode = getModeForResolutionAtIndex(containingFile, i);
|
|
118181
117935
|
i++;
|
|
118182
117936
|
var cacheKey = mode !== undefined ? mode + "|" + name : name;
|
|
118183
117937
|
if (cache.has(cacheKey)) {
|
|
@@ -118242,14 +117996,14 @@ var ts;
|
|
|
118242
117996
|
/*@internal*/
|
|
118243
117997
|
function getReferencedFileLocation(getSourceFileByPath, ref) {
|
|
118244
117998
|
var _a, _b, _c;
|
|
118245
|
-
var _d, _e, _f, _g
|
|
117999
|
+
var _d, _e, _f, _g;
|
|
118246
118000
|
var file = ts.Debug.checkDefined(getSourceFileByPath(ref.file));
|
|
118247
118001
|
var kind = ref.kind, index = ref.index;
|
|
118248
118002
|
var pos, end, packageId, resolutionMode;
|
|
118249
118003
|
switch (kind) {
|
|
118250
118004
|
case ts.FileIncludeKind.Import:
|
|
118251
118005
|
var importLiteral = getModuleNameStringLiteralAt(file, index);
|
|
118252
|
-
packageId = (
|
|
118006
|
+
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;
|
|
118253
118007
|
if (importLiteral.pos === -1)
|
|
118254
118008
|
return { file: file, packageId: packageId, text: importLiteral.text };
|
|
118255
118009
|
pos = ts.skipTrivia(file.text, importLiteral.pos);
|
|
@@ -118260,7 +118014,7 @@ var ts;
|
|
|
118260
118014
|
break;
|
|
118261
118015
|
case ts.FileIncludeKind.TypeReferenceDirective:
|
|
118262
118016
|
(_b = file.typeReferenceDirectives[index], pos = _b.pos, end = _b.end, resolutionMode = _b.resolutionMode);
|
|
118263
|
-
packageId = (
|
|
118017
|
+
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;
|
|
118264
118018
|
break;
|
|
118265
118019
|
case ts.FileIncludeKind.LibReferenceDirective:
|
|
118266
118020
|
(_c = file.libReferenceDirectives[index], pos = _c.pos, end = _c.end);
|
|
@@ -118375,13 +118129,13 @@ var ts;
|
|
|
118375
118129
|
return undefined;
|
|
118376
118130
|
}
|
|
118377
118131
|
function lookupFromPackageJson() {
|
|
118378
|
-
var
|
|
118379
|
-
var
|
|
118380
|
-
|
|
118381
|
-
|
|
118382
|
-
|
|
118383
|
-
|
|
118384
|
-
};
|
|
118132
|
+
var state = ts.getTemporaryModuleResolutionState(packageJsonInfoCache, host, options);
|
|
118133
|
+
var packageJsonLocations = [];
|
|
118134
|
+
state.failedLookupLocations = packageJsonLocations;
|
|
118135
|
+
state.affectingLocations = packageJsonLocations;
|
|
118136
|
+
var packageJsonScope = ts.getPackageScopeForPath(fileName, state);
|
|
118137
|
+
var impliedNodeFormat = (packageJsonScope === null || packageJsonScope === void 0 ? void 0 : packageJsonScope.packageJsonContent.type) === "module" ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS;
|
|
118138
|
+
return { impliedNodeFormat: impliedNodeFormat, packageJsonLocations: packageJsonLocations, packageJsonScope: packageJsonScope };
|
|
118385
118139
|
}
|
|
118386
118140
|
}
|
|
118387
118141
|
ts.getImpliedNodeFormatForFileWorker = getImpliedNodeFormatForFileWorker;
|
|
@@ -118501,10 +118255,10 @@ var ts;
|
|
|
118501
118255
|
};
|
|
118502
118256
|
}
|
|
118503
118257
|
function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) {
|
|
118504
|
-
var _a, _b, _c, _d
|
|
118258
|
+
var _a, _b, _c, _d;
|
|
118505
118259
|
var createProgramOptions = ts.isArray(rootNamesOrOptions) ? createCreateProgramOptions(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) : rootNamesOrOptions; // TODO: GH#18217
|
|
118506
118260
|
var rootNames = createProgramOptions.rootNames, options = createProgramOptions.options, configFileParsingDiagnostics = createProgramOptions.configFileParsingDiagnostics, projectReferences = createProgramOptions.projectReferences;
|
|
118507
|
-
var
|
|
118261
|
+
var oldProgram = createProgramOptions.oldProgram;
|
|
118508
118262
|
var processingDefaultLibFiles;
|
|
118509
118263
|
var processingOtherFiles;
|
|
118510
118264
|
var files;
|
|
@@ -118518,8 +118272,6 @@ var ts;
|
|
|
118518
118272
|
var cachedDeclarationDiagnosticsForFile = {};
|
|
118519
118273
|
var resolvedTypeReferenceDirectives = ts.createModeAwareCache();
|
|
118520
118274
|
var fileProcessingDiagnostics;
|
|
118521
|
-
var automaticTypeDirectiveNames;
|
|
118522
|
-
var automaticTypeDirectiveResolutions;
|
|
118523
118275
|
// The below settings are to track if a .js file should be add to the program if loaded via searching under node_modules.
|
|
118524
118276
|
// This works as imported modules are discovered recursively in a depth first manner, specifically:
|
|
118525
118277
|
// - For each root file, findSourceFile is called.
|
|
@@ -118541,11 +118293,6 @@ var ts;
|
|
|
118541
118293
|
var skipDefaultLib = options.noLib;
|
|
118542
118294
|
var getDefaultLibraryFileName = ts.memoize(function () { return host.getDefaultLibFileName(options); });
|
|
118543
118295
|
var defaultLibraryPath = host.getDefaultLibLocation ? host.getDefaultLibLocation() : ts.getDirectoryPath(getDefaultLibraryFileName());
|
|
118544
|
-
/**
|
|
118545
|
-
* Diagnostics for the program
|
|
118546
|
-
* Only add diagnostics directly if it always would be done irrespective of program structure reuse.
|
|
118547
|
-
* Otherwise fileProcessingDiagnostics is correct locations so that the diagnostics can be reported in all structure use scenarios
|
|
118548
|
-
*/
|
|
118549
118296
|
var programDiagnostics = ts.createDiagnosticCollection();
|
|
118550
118297
|
var currentDirectory = host.getCurrentDirectory();
|
|
118551
118298
|
var supportedExtensions = ts.getSupportedExtensions(options);
|
|
@@ -118558,74 +118305,30 @@ var ts;
|
|
|
118558
118305
|
var actualResolveModuleNamesWorker;
|
|
118559
118306
|
var hasInvalidatedResolution = host.hasInvalidatedResolution || ts.returnFalse;
|
|
118560
118307
|
if (host.resolveModuleNames) {
|
|
118561
|
-
actualResolveModuleNamesWorker = function (moduleNames, containingFile, containingFileName, redirectedReference,
|
|
118562
|
-
|
|
118563
|
-
|
|
118564
|
-
|
|
118565
|
-
|
|
118566
|
-
|
|
118567
|
-
|
|
118568
|
-
|
|
118569
|
-
|
|
118570
|
-
resolved.extension !== undefined ?
|
|
118571
|
-
// An older host may have omitted extension, in which case we should infer it from the file extension of resolvedFileName.
|
|
118572
|
-
{ resolvedModule: resolved, failedLookupLocations: emptyResolution.failedLookupLocations } :
|
|
118573
|
-
{ resolvedModule: __assign(__assign({}, resolved), { extension: ts.extensionFromPath(resolved.resolvedFileName) }), failedLookupLocations: emptyResolution.failedLookupLocations } :
|
|
118574
|
-
emptyResolution; });
|
|
118575
|
-
};
|
|
118308
|
+
actualResolveModuleNamesWorker = function (moduleNames, containingFile, containingFileName, reusedNames, redirectedReference) { return host.resolveModuleNames(ts.Debug.checkEachDefined(moduleNames), containingFileName, reusedNames, redirectedReference, options, containingFile).map(function (resolved) {
|
|
118309
|
+
// An older host may have omitted extension, in which case we should infer it from the file extension of resolvedFileName.
|
|
118310
|
+
if (!resolved || resolved.extension !== undefined) {
|
|
118311
|
+
return resolved;
|
|
118312
|
+
}
|
|
118313
|
+
var withExtension = ts.clone(resolved);
|
|
118314
|
+
withExtension.extension = ts.extensionFromPath(resolved.resolvedFileName);
|
|
118315
|
+
return withExtension;
|
|
118316
|
+
}); };
|
|
118576
118317
|
moduleResolutionCache = (_a = host.getModuleResolutionCache) === null || _a === void 0 ? void 0 : _a.call(host);
|
|
118577
118318
|
}
|
|
118578
118319
|
else {
|
|
118579
118320
|
moduleResolutionCache = ts.createModuleResolutionCache(currentDirectory, getCanonicalFileName, options);
|
|
118580
|
-
var loader_1 = function (moduleName, resolverMode, containingFileName, redirectedReference) { return ts.resolveModuleName(moduleName, containingFileName, options, host, moduleResolutionCache, redirectedReference, resolverMode); };
|
|
118581
|
-
actualResolveModuleNamesWorker = function (moduleNames, containingFile, containingFileName, redirectedReference,
|
|
118582
|
-
return loadWithModeAwareCache(moduleNames, containingFile, containingFileName, redirectedReference, partialResolutionInfo, loader_1);
|
|
118583
|
-
};
|
|
118321
|
+
var loader_1 = function (moduleName, resolverMode, containingFileName, redirectedReference) { return ts.resolveModuleName(moduleName, containingFileName, options, host, moduleResolutionCache, redirectedReference, resolverMode).resolvedModule; }; // TODO: GH#18217
|
|
118322
|
+
actualResolveModuleNamesWorker = function (moduleNames, containingFile, containingFileName, _reusedNames, redirectedReference) { return loadWithModeAwareCache(ts.Debug.checkEachDefined(moduleNames), containingFile, containingFileName, redirectedReference, loader_1); };
|
|
118584
118323
|
}
|
|
118585
118324
|
var actualResolveTypeReferenceDirectiveNamesWorker;
|
|
118586
118325
|
if (host.resolveTypeReferenceDirectives) {
|
|
118587
|
-
actualResolveTypeReferenceDirectiveNamesWorker = function (typeDirectiveNames, containingFile, redirectedReference, containingFileMode,
|
|
118588
|
-
var result = host.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference, options, containingFileMode, partialResolutionInfo);
|
|
118589
|
-
return result.some(isResolvedTypeReferenceDirectiveWithFailedLookupLocations) ?
|
|
118590
|
-
result :
|
|
118591
|
-
result.map(function (resolved) { return resolved ?
|
|
118592
|
-
{ resolvedTypeReferenceDirective: resolved, failedLookupLocations: emptyResolution.failedLookupLocations } :
|
|
118593
|
-
emptyResolution; });
|
|
118594
|
-
};
|
|
118595
|
-
typeReferenceDirectiveResolutionCache = (_b = host.getTypeReferenceDirectiveResolutionCache) === null || _b === void 0 ? void 0 : _b.call(host);
|
|
118326
|
+
actualResolveTypeReferenceDirectiveNamesWorker = function (typeDirectiveNames, containingFile, redirectedReference, containingFileMode) { return host.resolveTypeReferenceDirectives(ts.Debug.checkEachDefined(typeDirectiveNames), containingFile, redirectedReference, options, containingFileMode); };
|
|
118596
118327
|
}
|
|
118597
118328
|
else {
|
|
118598
118329
|
typeReferenceDirectiveResolutionCache = ts.createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, /*options*/ undefined, moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache());
|
|
118599
|
-
var loader_2 = function (typesRef, containingFile, redirectedReference, resolutionMode) { return ts.resolveTypeReferenceDirective(typesRef, containingFile, options, host, redirectedReference, typeReferenceDirectiveResolutionCache, resolutionMode); };
|
|
118600
|
-
actualResolveTypeReferenceDirectiveNamesWorker = function (typeReferenceDirectiveNames, containingFile, redirectedReference, containingFileMode) {
|
|
118601
|
-
return loadWithTypeDirectiveCache(typeReferenceDirectiveNames, containingFile, redirectedReference, containingFileMode, loader_2);
|
|
118602
|
-
};
|
|
118603
|
-
}
|
|
118604
|
-
var oldProgram = typeof oldProgramOrOldBuildInfoProgramConstructor === "object" ? oldProgramOrOldBuildInfoProgramConstructor : undefined;
|
|
118605
|
-
var oldBuildInfoProgram;
|
|
118606
|
-
if (!oldProgram && typeof oldProgramOrOldBuildInfoProgramConstructor === "function") {
|
|
118607
|
-
var state_11 = ts.getTemporaryModuleResolutionState(moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache(), host, options);
|
|
118608
|
-
oldBuildInfoProgram = oldProgramOrOldBuildInfoProgramConstructor({
|
|
118609
|
-
fileExists: function (fileName) { return host.fileExists(fileName); },
|
|
118610
|
-
createHash: ts.maybeBind(host, host.createHash),
|
|
118611
|
-
getPackageJsonInfo: function (fileName) { return ts.getPackageJsonInfo(ts.getDirectoryPath(fileName), /*onlyRecordFailures*/ false, state_11); },
|
|
118612
|
-
});
|
|
118613
|
-
if (oldBuildInfoProgram) {
|
|
118614
|
-
// Ensure redirected references are verified before using existing cache
|
|
118615
|
-
moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.setOldResolutionCache({
|
|
118616
|
-
getResolved: function (dirPath, name, mode, redirectedReference) {
|
|
118617
|
-
return oldBuildInfoProgram === null || oldBuildInfoProgram === void 0 ? void 0 : oldBuildInfoProgram.getResolvedModule(dirPath, name, mode, redirectedReference);
|
|
118618
|
-
}
|
|
118619
|
-
});
|
|
118620
|
-
typeReferenceDirectiveResolutionCache === null || typeReferenceDirectiveResolutionCache === void 0 ? void 0 : typeReferenceDirectiveResolutionCache.setOldResolutionCache({
|
|
118621
|
-
getResolved: function (dirPath, name, mode, redirectedReference) {
|
|
118622
|
-
return oldBuildInfoProgram === null || oldBuildInfoProgram === void 0 ? void 0 : oldBuildInfoProgram.getResolvedTypeReferenceDirective(dirPath, name, mode, redirectedReference);
|
|
118623
|
-
}
|
|
118624
|
-
});
|
|
118625
|
-
moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache().setOldPackageJsonScopeCache({
|
|
118626
|
-
getPackageJsonScope: function (dirPath) { return oldBuildInfoProgram === null || oldBuildInfoProgram === void 0 ? void 0 : oldBuildInfoProgram.getPackageJsonScope(dirPath); }
|
|
118627
|
-
});
|
|
118628
|
-
}
|
|
118330
|
+
var loader_2 = function (typesRef, containingFile, redirectedReference, resolutionMode) { return ts.resolveTypeReferenceDirective(typesRef, containingFile, options, host, redirectedReference, typeReferenceDirectiveResolutionCache, resolutionMode).resolvedTypeReferenceDirective; }; // TODO: GH#18217
|
|
118331
|
+
actualResolveTypeReferenceDirectiveNamesWorker = function (typeReferenceDirectiveNames, containingFile, redirectedReference, containingFileMode) { return loadWithTypeDirectiveCache(ts.Debug.checkEachDefined(typeReferenceDirectiveNames), containingFile, redirectedReference, containingFileMode, loader_2); };
|
|
118629
118332
|
}
|
|
118630
118333
|
// Map from a stringified PackageId to the source file with that id.
|
|
118631
118334
|
// Only one source file may have a given packageId. Others become redirects (see createRedirectSourceFile).
|
|
@@ -118652,9 +118355,9 @@ var ts;
|
|
|
118652
118355
|
var projectReferenceRedirects;
|
|
118653
118356
|
var mapFromFileToProjectReferenceRedirects;
|
|
118654
118357
|
var mapFromToProjectReferenceRedirectSource;
|
|
118655
|
-
var useSourceOfProjectReferenceRedirect = !!((
|
|
118358
|
+
var useSourceOfProjectReferenceRedirect = !!((_b = host.useSourceOfProjectReferenceRedirect) === null || _b === void 0 ? void 0 : _b.call(host)) &&
|
|
118656
118359
|
!options.disableSourceOfProjectReferenceRedirect;
|
|
118657
|
-
var
|
|
118360
|
+
var _e = updateHostForUseSourceOfProjectReferenceRedirect({
|
|
118658
118361
|
compilerHost: host,
|
|
118659
118362
|
getSymlinkCache: getSymlinkCache,
|
|
118660
118363
|
useSourceOfProjectReferenceRedirect: useSourceOfProjectReferenceRedirect,
|
|
@@ -118662,7 +118365,7 @@ var ts;
|
|
|
118662
118365
|
getResolvedProjectReferences: getResolvedProjectReferences,
|
|
118663
118366
|
getSourceOfProjectReferenceRedirect: getSourceOfProjectReferenceRedirect,
|
|
118664
118367
|
forEachResolvedProjectReference: forEachResolvedProjectReference
|
|
118665
|
-
}), onProgramCreateComplete =
|
|
118368
|
+
}), onProgramCreateComplete = _e.onProgramCreateComplete, fileExists = _e.fileExists, directoryExists = _e.directoryExists;
|
|
118666
118369
|
var readFile = host.readFile.bind(host);
|
|
118667
118370
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program" /* Program */, "shouldProgramCreateNewSourceFiles", { hasOldProgram: !!oldProgram });
|
|
118668
118371
|
var shouldCreateNewSourceFile = shouldProgramCreateNewSourceFiles(oldProgram, options);
|
|
@@ -118673,7 +118376,7 @@ var ts;
|
|
|
118673
118376
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program" /* Program */, "tryReuseStructureFromOldProgram", {});
|
|
118674
118377
|
structureIsReused = tryReuseStructureFromOldProgram(); // eslint-disable-line prefer-const
|
|
118675
118378
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
118676
|
-
if (structureIsReused !==
|
|
118379
|
+
if (structureIsReused !== 2 /* Completely */) {
|
|
118677
118380
|
processingDefaultLibFiles = [];
|
|
118678
118381
|
processingOtherFiles = [];
|
|
118679
118382
|
if (projectReferences) {
|
|
@@ -118714,15 +118417,16 @@ var ts;
|
|
|
118714
118417
|
ts.forEach(rootNames, function (name, index) { return processRootFile(name, /*isDefaultLib*/ false, /*ignoreNoDefaultLib*/ false, { kind: ts.FileIncludeKind.RootFile, index: index }); });
|
|
118715
118418
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
118716
118419
|
// load type declarations specified via 'types' argument or implicitly from types/ and node_modules/@types folders
|
|
118717
|
-
|
|
118718
|
-
|
|
118719
|
-
|
|
118720
|
-
|
|
118721
|
-
var
|
|
118722
|
-
|
|
118420
|
+
var typeReferences = rootNames.length ? ts.getAutomaticTypeDirectiveNames(options, host) : ts.emptyArray;
|
|
118421
|
+
if (typeReferences.length) {
|
|
118422
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program" /* Program */, "processTypeReferences", { count: typeReferences.length });
|
|
118423
|
+
// This containingFilename needs to match with the one used in managed-side
|
|
118424
|
+
var containingDirectory = options.configFilePath ? ts.getDirectoryPath(options.configFilePath) : host.getCurrentDirectory();
|
|
118425
|
+
var containingFilename = ts.combinePaths(containingDirectory, ts.inferredTypesContainingFile);
|
|
118426
|
+
var resolutions = resolveTypeReferenceDirectiveNamesWorker(typeReferences, containingFilename);
|
|
118427
|
+
for (var i = 0; i < typeReferences.length; i++) {
|
|
118723
118428
|
// under node16/nodenext module resolution, load `types`/ata include names as cjs resolution results by passing an `undefined` mode
|
|
118724
|
-
|
|
118725
|
-
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 });
|
|
118429
|
+
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 });
|
|
118726
118430
|
}
|
|
118727
118431
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
118728
118432
|
}
|
|
@@ -118762,13 +118466,13 @@ var ts;
|
|
|
118762
118466
|
if (shouldCreateNewSourceFile || !newFile || newFile.impliedNodeFormat !== oldSourceFile.impliedNodeFormat ||
|
|
118763
118467
|
// old file wasn't redirect but new file is
|
|
118764
118468
|
(oldSourceFile.resolvedPath === oldSourceFile.path && newFile.resolvedPath !== oldSourceFile.path)) {
|
|
118765
|
-
host.onReleaseOldSourceFile(oldSourceFile, oldProgram.getCompilerOptions());
|
|
118469
|
+
host.onReleaseOldSourceFile(oldSourceFile, oldProgram.getCompilerOptions(), !!getSourceFileByPath(oldSourceFile.path));
|
|
118766
118470
|
}
|
|
118767
118471
|
}
|
|
118768
118472
|
if (!host.getParsedCommandLine) {
|
|
118769
118473
|
oldProgram.forEachResolvedProjectReference(function (resolvedProjectReference) {
|
|
118770
118474
|
if (!getResolvedProjectReferenceByPath(resolvedProjectReference.sourceFile.path)) {
|
|
118771
|
-
host.onReleaseOldSourceFile(resolvedProjectReference.sourceFile, oldProgram.getCompilerOptions());
|
|
118475
|
+
host.onReleaseOldSourceFile(resolvedProjectReference.sourceFile, oldProgram.getCompilerOptions(), /*hasSourceFileByPath*/ false);
|
|
118772
118476
|
}
|
|
118773
118477
|
});
|
|
118774
118478
|
}
|
|
@@ -118786,8 +118490,6 @@ var ts;
|
|
|
118786
118490
|
typeReferenceDirectiveResolutionCache = undefined;
|
|
118787
118491
|
// unconditionally set oldProgram to undefined to prevent it from being captured in closure
|
|
118788
118492
|
oldProgram = undefined;
|
|
118789
|
-
oldBuildInfoProgram = undefined;
|
|
118790
|
-
oldProgramOrOldBuildInfoProgramConstructor = undefined;
|
|
118791
118493
|
var program = {
|
|
118792
118494
|
getRootFileNames: function () { return rootNames; },
|
|
118793
118495
|
getSourceFile: getSourceFile,
|
|
@@ -118795,7 +118497,6 @@ var ts;
|
|
|
118795
118497
|
getSourceFiles: function () { return files; },
|
|
118796
118498
|
getMissingFilePaths: function () { return missingFilePaths; },
|
|
118797
118499
|
getModuleResolutionCache: function () { return moduleResolutionCache; },
|
|
118798
|
-
getTypeReferenceDirectiveResolutionCache: function () { return typeReferenceDirectiveResolutionCache; },
|
|
118799
118500
|
getFilesByNameMap: function () { return filesByName; },
|
|
118800
118501
|
getCompilerOptions: function () { return options; },
|
|
118801
118502
|
getSyntacticDiagnostics: getSyntacticDiagnostics,
|
|
@@ -118820,9 +118521,6 @@ var ts;
|
|
|
118820
118521
|
getRelationCacheSizes: function () { return getTypeChecker().getRelationCacheSizes(); },
|
|
118821
118522
|
getFileProcessingDiagnostics: function () { return fileProcessingDiagnostics; },
|
|
118822
118523
|
getResolvedTypeReferenceDirectives: function () { return resolvedTypeReferenceDirectives; },
|
|
118823
|
-
getAutomaticTypeDirectiveNames: function () { return automaticTypeDirectiveNames; },
|
|
118824
|
-
getAutomaticTypeDirectiveResolutions: function () { return automaticTypeDirectiveResolutions; },
|
|
118825
|
-
getAutomaticTypeDirectiveContainingFile: getAutomaticTypeDirectiveContainingFile,
|
|
118826
118524
|
isSourceFileFromExternalLibrary: isSourceFileFromExternalLibrary,
|
|
118827
118525
|
isSourceFileDefaultLibrary: isSourceFileDefaultLibrary,
|
|
118828
118526
|
getSourceFileFromReference: getSourceFileFromReference,
|
|
@@ -118832,12 +118530,12 @@ var ts;
|
|
|
118832
118530
|
usesUriStyleNodeCoreModules: usesUriStyleNodeCoreModules,
|
|
118833
118531
|
isEmittedFile: isEmittedFile,
|
|
118834
118532
|
getConfigFileParsingDiagnostics: getConfigFileParsingDiagnostics,
|
|
118533
|
+
getResolvedModuleWithFailedLookupLocationsFromCache: getResolvedModuleWithFailedLookupLocationsFromCache,
|
|
118835
118534
|
getProjectReferences: getProjectReferences,
|
|
118836
118535
|
getResolvedProjectReferences: getResolvedProjectReferences,
|
|
118837
118536
|
getProjectReferenceRedirect: getProjectReferenceRedirect,
|
|
118838
118537
|
getResolvedProjectReferenceToRedirect: getResolvedProjectReferenceToRedirect,
|
|
118839
118538
|
getResolvedProjectReferenceByPath: getResolvedProjectReferenceByPath,
|
|
118840
|
-
getRedirectReferenceForResolution: getRedirectReferenceForResolution,
|
|
118841
118539
|
forEachResolvedProjectReference: forEachResolvedProjectReference,
|
|
118842
118540
|
isSourceOfProjectReferenceRedirect: isSourceOfProjectReferenceRedirect,
|
|
118843
118541
|
emitBuildInfo: emitBuildInfo,
|
|
@@ -118845,7 +118543,7 @@ var ts;
|
|
|
118845
118543
|
readFile: readFile,
|
|
118846
118544
|
directoryExists: directoryExists,
|
|
118847
118545
|
getSymlinkCache: getSymlinkCache,
|
|
118848
|
-
realpath: (
|
|
118546
|
+
realpath: (_d = host.realpath) === null || _d === void 0 ? void 0 : _d.bind(host),
|
|
118849
118547
|
useCaseSensitiveFileNames: function () { return host.useCaseSensitiveFileNames(); },
|
|
118850
118548
|
getFileIncludeReasons: function () { return fileReasons; },
|
|
118851
118549
|
structureIsReused: structureIsReused,
|
|
@@ -118860,8 +118558,6 @@ var ts;
|
|
|
118860
118558
|
case 0 /* FilePreprocessingReferencedDiagnostic */:
|
|
118861
118559
|
var _a = getReferencedFileLocation(getSourceFileByPath, diagnostic.reason), file = _a.file, pos = _a.pos, end = _a.end;
|
|
118862
118560
|
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)));
|
|
118863
|
-
case 2 /* ResolutionDiagnostics */:
|
|
118864
|
-
return diagnostic.diagnostics.forEach(function (d) { return programDiagnostics.add(d); });
|
|
118865
118561
|
default:
|
|
118866
118562
|
ts.Debug.assertNever(diagnostic);
|
|
118867
118563
|
}
|
|
@@ -118871,46 +118567,63 @@ var ts;
|
|
|
118871
118567
|
ts.performance.measure("Program", "beforeProgram", "afterProgram");
|
|
118872
118568
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
118873
118569
|
return program;
|
|
118874
|
-
function
|
|
118875
|
-
|
|
118876
|
-
|
|
118877
|
-
|
|
118570
|
+
function addResolutionDiagnostics(list) {
|
|
118571
|
+
if (!list)
|
|
118572
|
+
return;
|
|
118573
|
+
for (var _i = 0, list_3 = list; _i < list_3.length; _i++) {
|
|
118574
|
+
var elem = list_3[_i];
|
|
118575
|
+
programDiagnostics.add(elem);
|
|
118576
|
+
}
|
|
118878
118577
|
}
|
|
118879
|
-
function
|
|
118880
|
-
|
|
118578
|
+
function pullDiagnosticsFromCache(names, containingFile) {
|
|
118579
|
+
var _a;
|
|
118580
|
+
if (!moduleResolutionCache)
|
|
118881
118581
|
return;
|
|
118882
|
-
|
|
118883
|
-
|
|
118884
|
-
|
|
118885
|
-
|
|
118886
|
-
|
|
118887
|
-
|
|
118888
|
-
|
|
118582
|
+
var containingFileName = ts.getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory);
|
|
118583
|
+
var containingFileMode = !ts.isString(containingFile) ? containingFile.impliedNodeFormat : undefined;
|
|
118584
|
+
var containingDir = ts.getDirectoryPath(containingFileName);
|
|
118585
|
+
var redirectedReference = getRedirectReferenceForResolution(containingFile);
|
|
118586
|
+
var i = 0;
|
|
118587
|
+
for (var _i = 0, names_4 = names; _i < names_4.length; _i++) {
|
|
118588
|
+
var n = names_4[_i];
|
|
118589
|
+
// 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
|
|
118590
|
+
var mode = typeof n === "string" ? getModeForResolutionAtIndex(containingFile, i) : getModeForFileReference(n, containingFileMode);
|
|
118591
|
+
var name = typeof n === "string" ? n : n.fileName;
|
|
118592
|
+
i++;
|
|
118593
|
+
// only nonrelative names hit the cache, and, at least as of right now, only nonrelative names can issue diagnostics
|
|
118594
|
+
// (Since diagnostics are only issued via import or export map lookup)
|
|
118595
|
+
// This may totally change if/when the issue of output paths not mapping to input files is fixed in a broader context
|
|
118596
|
+
// When it is, how we extract diagnostics from the module name resolver will have the be refined - the current cache
|
|
118597
|
+
// APIs wrapping the underlying resolver make it almost impossible to smuggle the diagnostics out in a generalized way
|
|
118598
|
+
if (ts.isExternalModuleNameRelative(name))
|
|
118599
|
+
continue;
|
|
118600
|
+
var diags = (_a = moduleResolutionCache.getOrCreateCacheForModuleName(name, mode, redirectedReference).get(containingDir)) === null || _a === void 0 ? void 0 : _a.resolutionDiagnostics;
|
|
118601
|
+
addResolutionDiagnostics(diags);
|
|
118602
|
+
}
|
|
118889
118603
|
}
|
|
118890
|
-
function resolveModuleNamesWorker(moduleNames, containingFile,
|
|
118604
|
+
function resolveModuleNamesWorker(moduleNames, containingFile, reusedNames) {
|
|
118891
118605
|
if (!moduleNames.length)
|
|
118892
118606
|
return ts.emptyArray;
|
|
118893
118607
|
var containingFileName = ts.getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory);
|
|
118894
|
-
|
|
118895
|
-
redirectedReference = getRedirectReferenceForResolution(containingFile);
|
|
118608
|
+
var redirectedReference = getRedirectReferenceForResolution(containingFile);
|
|
118896
118609
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program" /* Program */, "resolveModuleNamesWorker", { containingFileName: containingFileName });
|
|
118897
118610
|
ts.performance.mark("beforeResolveModule");
|
|
118898
|
-
var result = actualResolveModuleNamesWorker(moduleNames, containingFile, containingFileName,
|
|
118611
|
+
var result = actualResolveModuleNamesWorker(moduleNames, containingFile, containingFileName, reusedNames, redirectedReference);
|
|
118899
118612
|
ts.performance.mark("afterResolveModule");
|
|
118900
118613
|
ts.performance.measure("ResolveModule", "beforeResolveModule", "afterResolveModule");
|
|
118901
118614
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
118615
|
+
pullDiagnosticsFromCache(moduleNames, containingFile);
|
|
118902
118616
|
return result;
|
|
118903
118617
|
}
|
|
118904
|
-
function resolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFile
|
|
118618
|
+
function resolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFile) {
|
|
118905
118619
|
if (!typeDirectiveNames.length)
|
|
118906
118620
|
return [];
|
|
118907
118621
|
var containingFileName = !ts.isString(containingFile) ? ts.getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory) : containingFile;
|
|
118908
|
-
|
|
118909
|
-
redirectedReference = getRedirectReferenceForResolution(containingFile);
|
|
118622
|
+
var redirectedReference = !ts.isString(containingFile) ? getRedirectReferenceForResolution(containingFile) : undefined;
|
|
118910
118623
|
var containingFileMode = !ts.isString(containingFile) ? containingFile.impliedNodeFormat : undefined;
|
|
118911
118624
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program" /* Program */, "resolveTypeReferenceDirectiveNamesWorker", { containingFileName: containingFileName });
|
|
118912
118625
|
ts.performance.mark("beforeResolveTypeReference");
|
|
118913
|
-
var result = actualResolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFileName, redirectedReference
|
|
118626
|
+
var result = actualResolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFileName, redirectedReference, containingFileMode);
|
|
118914
118627
|
ts.performance.mark("afterResolveTypeReference");
|
|
118915
118628
|
ts.performance.measure("ResolveTypeReference", "beforeResolveTypeReference", "afterResolveTypeReference");
|
|
118916
118629
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
@@ -118963,6 +118676,9 @@ var ts;
|
|
|
118963
118676
|
}
|
|
118964
118677
|
return ts.libs.length + 2;
|
|
118965
118678
|
}
|
|
118679
|
+
function getResolvedModuleWithFailedLookupLocationsFromCache(moduleName, containingFile, mode) {
|
|
118680
|
+
return moduleResolutionCache && ts.resolveModuleNameFromCache(moduleName, containingFile, moduleResolutionCache, mode);
|
|
118681
|
+
}
|
|
118966
118682
|
function toPath(fileName) {
|
|
118967
118683
|
return ts.toPath(fileName, currentDirectory, getCanonicalFileName);
|
|
118968
118684
|
}
|
|
@@ -118987,11 +118703,10 @@ var ts;
|
|
|
118987
118703
|
return classifiableNames;
|
|
118988
118704
|
}
|
|
118989
118705
|
function resolveModuleNamesReusingOldState(moduleNames, file) {
|
|
118990
|
-
var _a;
|
|
118991
118706
|
if (structureIsReused === 0 /* Not */ && !file.ambientModuleNames.length) {
|
|
118992
118707
|
// If the old program state does not permit reusing resolutions and `file` does not contain locally defined ambient modules,
|
|
118993
118708
|
// the best we can do is fallback to the default logic.
|
|
118994
|
-
return resolveModuleNamesWorker(moduleNames, file, /*
|
|
118709
|
+
return resolveModuleNamesWorker(moduleNames, file, /*reusedNames*/ undefined);
|
|
118995
118710
|
}
|
|
118996
118711
|
var oldSourceFile = oldProgram && oldProgram.getSourceFile(file.fileName);
|
|
118997
118712
|
if (oldSourceFile !== file && file.resolvedModules) {
|
|
@@ -119019,8 +118734,6 @@ var ts;
|
|
|
119019
118734
|
// With this information, we can infer some module resolutions without performing resolution.
|
|
119020
118735
|
/** An ordered list of module names for which we cannot recover the resolution. */
|
|
119021
118736
|
var unknownModuleNames;
|
|
119022
|
-
var unknownModuleNamesIndex;
|
|
119023
|
-
var reusedNames;
|
|
119024
118737
|
/**
|
|
119025
118738
|
* The indexing of elements in this list matches that of `moduleNames`.
|
|
119026
118739
|
*
|
|
@@ -119031,33 +118744,22 @@ var ts;
|
|
|
119031
118744
|
* * ResolvedModuleFull instance: can be reused.
|
|
119032
118745
|
*/
|
|
119033
118746
|
var result;
|
|
118747
|
+
var reusedNames;
|
|
119034
118748
|
/** A transient placeholder used to mark predicted resolution in the result list. */
|
|
119035
|
-
var predictedToResolveToAmbientModuleMarker =
|
|
119036
|
-
var redirectedReference;
|
|
118749
|
+
var predictedToResolveToAmbientModuleMarker = {};
|
|
119037
118750
|
for (var i = 0; i < moduleNames.length; i++) {
|
|
119038
118751
|
var moduleName = moduleNames[i];
|
|
119039
118752
|
// If the source file is unchanged and doesnt have invalidated resolution, reuse the module resolutions
|
|
119040
|
-
if (
|
|
119041
|
-
var
|
|
119042
|
-
|
|
119043
|
-
(_a = oldSourceFile === null || oldSourceFile === void 0 ? void 0 : oldSourceFile.resolvedModules) === null || _a === void 0 ? void 0 : _a.get(moduleName, mode) :
|
|
119044
|
-
oldBuildInfoProgram.getResolvedModule(ts.getDirectoryPath(file.path), moduleName, mode, (redirectedReference === undefined ? (redirectedReference = getRedirectReferenceForResolution(file) || false) : redirectedReference) || undefined);
|
|
119045
|
-
if (oldResolution === null || oldResolution === void 0 ? void 0 : oldResolution.resolvedModule) {
|
|
118753
|
+
if (file === oldSourceFile && !hasInvalidatedResolution(oldSourceFile.path)) {
|
|
118754
|
+
var oldResolvedModule = ts.getResolvedModule(oldSourceFile, moduleName, getModeForResolutionAtIndex(oldSourceFile, i));
|
|
118755
|
+
if (oldResolvedModule) {
|
|
119046
118756
|
if (ts.isTraceEnabled(options, host)) {
|
|
119047
|
-
|
|
119048
|
-
|
|
119049
|
-
ts.
|
|
119050
|
-
ts.Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 :
|
|
119051
|
-
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));
|
|
119052
|
-
}
|
|
119053
|
-
else {
|
|
119054
|
-
ts.trace(host, oldResolution.resolvedModule.packageId ?
|
|
119055
|
-
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 :
|
|
119056
|
-
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));
|
|
119057
|
-
}
|
|
118757
|
+
ts.trace(host, oldResolvedModule.packageId ?
|
|
118758
|
+
ts.Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 :
|
|
118759
|
+
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));
|
|
119058
118760
|
}
|
|
119059
|
-
(result
|
|
119060
|
-
(reusedNames
|
|
118761
|
+
(result || (result = new Array(moduleNames.length)))[i] = oldResolvedModule;
|
|
118762
|
+
(reusedNames || (reusedNames = [])).push(moduleName);
|
|
119061
118763
|
continue;
|
|
119062
118764
|
}
|
|
119063
118765
|
}
|
|
@@ -119076,16 +118778,15 @@ var ts;
|
|
|
119076
118778
|
resolvesToAmbientModuleInNonModifiedFile = moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName, i);
|
|
119077
118779
|
}
|
|
119078
118780
|
if (resolvesToAmbientModuleInNonModifiedFile) {
|
|
119079
|
-
(result
|
|
118781
|
+
(result || (result = new Array(moduleNames.length)))[i] = predictedToResolveToAmbientModuleMarker;
|
|
119080
118782
|
}
|
|
119081
118783
|
else {
|
|
119082
118784
|
// Resolution failed in the old program, or resolved to an ambient module for which we can't reuse the result.
|
|
119083
|
-
(unknownModuleNames
|
|
119084
|
-
(unknownModuleNamesIndex !== null && unknownModuleNamesIndex !== void 0 ? unknownModuleNamesIndex : (unknownModuleNamesIndex = [])).push(i);
|
|
118785
|
+
(unknownModuleNames || (unknownModuleNames = [])).push(moduleName);
|
|
119085
118786
|
}
|
|
119086
118787
|
}
|
|
119087
118788
|
var resolutions = unknownModuleNames && unknownModuleNames.length
|
|
119088
|
-
? resolveModuleNamesWorker(unknownModuleNames, file,
|
|
118789
|
+
? resolveModuleNamesWorker(unknownModuleNames, file, reusedNames)
|
|
119089
118790
|
: ts.emptyArray;
|
|
119090
118791
|
// Combine results of resolutions and predicted results
|
|
119091
118792
|
if (!result) {
|
|
@@ -119099,7 +118800,7 @@ var ts;
|
|
|
119099
118800
|
// `result[i]` is either a `ResolvedModuleFull` or a marker.
|
|
119100
118801
|
// If it is the former, we can leave it as is.
|
|
119101
118802
|
if (result[i] === predictedToResolveToAmbientModuleMarker) {
|
|
119102
|
-
result[i] =
|
|
118803
|
+
result[i] = undefined;
|
|
119103
118804
|
}
|
|
119104
118805
|
}
|
|
119105
118806
|
else {
|
|
@@ -119134,96 +118835,6 @@ var ts;
|
|
|
119134
118835
|
return true;
|
|
119135
118836
|
}
|
|
119136
118837
|
}
|
|
119137
|
-
function resolveTypeReferenceDirectiveNamesReusingOldState(typeDirectiveNames, containingFile) {
|
|
119138
|
-
var _a;
|
|
119139
|
-
if (structureIsReused === 0 /* Not */) {
|
|
119140
|
-
return resolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFile, /*partialResolutionInfo*/ undefined, /*redirectedReference*/ undefined);
|
|
119141
|
-
}
|
|
119142
|
-
var containingSourceFile = !ts.isString(containingFile) ? containingFile : undefined;
|
|
119143
|
-
var inferredTypeFile = !ts.isString(containingFile) ? undefined : containingFile;
|
|
119144
|
-
var oldSourceFile = containingSourceFile && (oldProgram === null || oldProgram === void 0 ? void 0 : oldProgram.getSourceFile(containingSourceFile.fileName));
|
|
119145
|
-
if (containingSourceFile && oldSourceFile !== containingSourceFile && containingSourceFile.resolvedTypeReferenceDirectiveNames) {
|
|
119146
|
-
// `file` was created for the new program.
|
|
119147
|
-
//
|
|
119148
|
-
// We only set `file.resolvedTypeReferenceDirectiveNames` via work from the current function,
|
|
119149
|
-
// so it is defined iff we already called the current function on `file`.
|
|
119150
|
-
// That call happened no later than the creation of the `file` object,
|
|
119151
|
-
// which per above occurred during the current program creation.
|
|
119152
|
-
// Since we assume the filesystem does not change during program creation,
|
|
119153
|
-
// it is safe to reuse resolutions from the earlier call.
|
|
119154
|
-
var result_15 = [];
|
|
119155
|
-
for (var _i = 0, _b = typeDirectiveNames; _i < _b.length; _i++) {
|
|
119156
|
-
var typeDirectiveName = _b[_i];
|
|
119157
|
-
// We lower-case all type references because npm automatically lowercases all packages. See GH#9824.
|
|
119158
|
-
var resolvedTypeReferenceDirective = containingSourceFile.resolvedTypeReferenceDirectiveNames.get(ts.toFileNameLowerCase(typeDirectiveName.fileName), typeDirectiveName.resolutionMode || containingSourceFile.impliedNodeFormat);
|
|
119159
|
-
result_15.push(resolvedTypeReferenceDirective);
|
|
119160
|
-
}
|
|
119161
|
-
return result_15;
|
|
119162
|
-
}
|
|
119163
|
-
/** An ordered list of module names for which we cannot recover the resolution. */
|
|
119164
|
-
var unknownTypeReferenceDirectiveNames;
|
|
119165
|
-
var unknownTypeReferenceDirectiveNamesIndex;
|
|
119166
|
-
/**
|
|
119167
|
-
* The indexing of elements in this list matches that of `moduleNames`.
|
|
119168
|
-
*
|
|
119169
|
-
* Before combining results, result[i] is in one of the following states:
|
|
119170
|
-
* * undefined: needs to be recomputed,
|
|
119171
|
-
*/
|
|
119172
|
-
var result;
|
|
119173
|
-
var reusedNames;
|
|
119174
|
-
var canReuseResolutions = oldBuildInfoProgram || (containingSourceFile ?
|
|
119175
|
-
containingSourceFile === oldSourceFile && !hasInvalidatedResolution(oldSourceFile.path) :
|
|
119176
|
-
!hasInvalidatedResolution(toPath(inferredTypeFile)));
|
|
119177
|
-
var redirectedReference;
|
|
119178
|
-
for (var i = 0; i < typeDirectiveNames.length; i++) {
|
|
119179
|
-
var entry = typeDirectiveNames[i];
|
|
119180
|
-
// If the source file is unchanged and doesnt have invalidated resolution, reuse the module resolutions
|
|
119181
|
-
if (canReuseResolutions) {
|
|
119182
|
-
var typeDirectiveName = !ts.isString(entry) ? entry.fileName.toLowerCase() : entry;
|
|
119183
|
-
var mode = getModeForFileReference(entry, containingSourceFile === null || containingSourceFile === void 0 ? void 0 : containingSourceFile.impliedNodeFormat);
|
|
119184
|
-
var oldResolution = !oldBuildInfoProgram ?
|
|
119185
|
-
(_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) :
|
|
119186
|
-
oldBuildInfoProgram.getResolvedTypeReferenceDirective(ts.getDirectoryPath(containingSourceFile ? containingSourceFile.path : toPath(inferredTypeFile)), typeDirectiveName, mode, containingSourceFile && (redirectedReference === undefined ? (redirectedReference = getRedirectReferenceForResolution(containingSourceFile) || false) : redirectedReference) || undefined);
|
|
119187
|
-
if (oldResolution === null || oldResolution === void 0 ? void 0 : oldResolution.resolvedTypeReferenceDirective) {
|
|
119188
|
-
if (ts.isTraceEnabled(options, host)) {
|
|
119189
|
-
var fileLocation = containingSourceFile ? ts.getNormalizedAbsolutePath(containingSourceFile.originalFileName, currentDirectory) : inferredTypeFile;
|
|
119190
|
-
if (!oldBuildInfoProgram) {
|
|
119191
|
-
ts.trace(host, oldResolution.resolvedTypeReferenceDirective.packageId ?
|
|
119192
|
-
ts.Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 :
|
|
119193
|
-
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));
|
|
119194
|
-
}
|
|
119195
|
-
else {
|
|
119196
|
-
ts.trace(host, oldResolution.resolvedTypeReferenceDirective.packageId ?
|
|
119197
|
-
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 :
|
|
119198
|
-
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));
|
|
119199
|
-
}
|
|
119200
|
-
}
|
|
119201
|
-
(result || (result = new Array(typeDirectiveNames.length)))[i] = oldResolution;
|
|
119202
|
-
(reusedNames !== null && reusedNames !== void 0 ? reusedNames : (reusedNames = [])).push({ name: typeDirectiveName, mode: mode });
|
|
119203
|
-
continue;
|
|
119204
|
-
}
|
|
119205
|
-
}
|
|
119206
|
-
// Resolution failed in the old program, or resolved to an ambient module for which we can't reuse the result.
|
|
119207
|
-
(unknownTypeReferenceDirectiveNames !== null && unknownTypeReferenceDirectiveNames !== void 0 ? unknownTypeReferenceDirectiveNames : (unknownTypeReferenceDirectiveNames = [])).push(entry);
|
|
119208
|
-
(unknownTypeReferenceDirectiveNamesIndex !== null && unknownTypeReferenceDirectiveNamesIndex !== void 0 ? unknownTypeReferenceDirectiveNamesIndex : (unknownTypeReferenceDirectiveNamesIndex = [])).push(i);
|
|
119209
|
-
}
|
|
119210
|
-
if (!unknownTypeReferenceDirectiveNames)
|
|
119211
|
-
return result || ts.emptyArray;
|
|
119212
|
-
var resolutions = resolveTypeReferenceDirectiveNamesWorker(unknownTypeReferenceDirectiveNames, containingFile, { reusedNames: reusedNames, namesIndex: unknownTypeReferenceDirectiveNamesIndex }, redirectedReference);
|
|
119213
|
-
if (!result) {
|
|
119214
|
-
ts.Debug.assert(resolutions.length === typeDirectiveNames.length);
|
|
119215
|
-
return resolutions;
|
|
119216
|
-
}
|
|
119217
|
-
var j = 0;
|
|
119218
|
-
for (var i = 0; i < result.length; i++) {
|
|
119219
|
-
if (!result[i]) {
|
|
119220
|
-
result[i] = resolutions[j];
|
|
119221
|
-
j++;
|
|
119222
|
-
}
|
|
119223
|
-
}
|
|
119224
|
-
ts.Debug.assert(j === resolutions.length);
|
|
119225
|
-
return result;
|
|
119226
|
-
}
|
|
119227
118838
|
function canReuseProjectReferences() {
|
|
119228
118839
|
return !forEachProjectReference(oldProgram.getProjectReferences(), oldProgram.getResolvedProjectReferences(), function (oldResolvedRef, parent, index) {
|
|
119229
118840
|
var newRef = (parent ? parent.commandLine.projectReferences : projectReferences)[index];
|
|
@@ -119245,19 +118856,14 @@ var ts;
|
|
|
119245
118856
|
});
|
|
119246
118857
|
}
|
|
119247
118858
|
function tryReuseStructureFromOldProgram() {
|
|
119248
|
-
|
|
119249
|
-
|
|
119250
|
-
var oldOptions = (oldProgram === null || oldProgram === void 0 ? void 0 : oldProgram.getCompilerOptions()) || (oldBuildInfoProgram === null || oldBuildInfoProgram === void 0 ? void 0 : oldBuildInfoProgram.getCompilerOptions());
|
|
119251
|
-
if (!oldOptions || ts.changesAffectModuleResolution(oldOptions, options)) {
|
|
118859
|
+
var _a, _b;
|
|
118860
|
+
if (!oldProgram) {
|
|
119252
118861
|
return 0 /* Not */;
|
|
119253
118862
|
}
|
|
119254
|
-
|
|
119255
|
-
|
|
119256
|
-
|
|
119257
|
-
|
|
119258
|
-
}
|
|
119259
|
-
function tryReuseStructureFromOldProgramWorker() {
|
|
119260
|
-
if (!oldProgram) {
|
|
118863
|
+
// check properties that can affect structure of the program or module resolution strategy
|
|
118864
|
+
// if any of these properties has changed - structure cannot be reused
|
|
118865
|
+
var oldOptions = oldProgram.getCompilerOptions();
|
|
118866
|
+
if (ts.changesAffectModuleResolution(oldOptions, options)) {
|
|
119261
118867
|
return 0 /* Not */;
|
|
119262
118868
|
}
|
|
119263
118869
|
// there is an old program, check if we can reuse its structure
|
|
@@ -119275,7 +118881,7 @@ var ts;
|
|
|
119275
118881
|
// check if program source files has changed in the way that can affect structure of the program
|
|
119276
118882
|
var newSourceFiles = [];
|
|
119277
118883
|
var modifiedSourceFiles = [];
|
|
119278
|
-
structureIsReused =
|
|
118884
|
+
structureIsReused = 2 /* Completely */;
|
|
119279
118885
|
// If the missing file paths are now present, it can change the progam structure,
|
|
119280
118886
|
// and hence cant reuse the structure.
|
|
119281
118887
|
// This is same as how we dont reuse the structure if one of the file from old program is now missing
|
|
@@ -119291,13 +118897,14 @@ var ts;
|
|
|
119291
118897
|
var seenPackageNames = new ts.Map();
|
|
119292
118898
|
for (var _i = 0, oldSourceFiles_2 = oldSourceFiles; _i < oldSourceFiles_2.length; _i++) {
|
|
119293
118899
|
var oldSourceFile = oldSourceFiles_2[_i];
|
|
119294
|
-
var sourceFileOptions = getCreateSourceFileOptions(oldSourceFile.fileName);
|
|
118900
|
+
var sourceFileOptions = getCreateSourceFileOptions(oldSourceFile.fileName, moduleResolutionCache, host, options);
|
|
119295
118901
|
var newSourceFile = host.getSourceFileByPath
|
|
119296
118902
|
? host.getSourceFileByPath(oldSourceFile.fileName, oldSourceFile.resolvedPath, sourceFileOptions, /*onError*/ undefined, shouldCreateNewSourceFile || sourceFileOptions.impliedNodeFormat !== oldSourceFile.impliedNodeFormat)
|
|
119297
118903
|
: host.getSourceFile(oldSourceFile.fileName, sourceFileOptions, /*onError*/ undefined, shouldCreateNewSourceFile || sourceFileOptions.impliedNodeFormat !== oldSourceFile.impliedNodeFormat); // TODO: GH#18217
|
|
119298
118904
|
if (!newSourceFile) {
|
|
119299
118905
|
return 0 /* Not */;
|
|
119300
118906
|
}
|
|
118907
|
+
newSourceFile.packageJsonLocations = ((_a = sourceFileOptions.packageJsonLocations) === null || _a === void 0 ? void 0 : _a.length) ? sourceFileOptions.packageJsonLocations : undefined;
|
|
119301
118908
|
newSourceFile.packageJsonScope = sourceFileOptions.packageJsonScope;
|
|
119302
118909
|
ts.Debug.assert(!newSourceFile.redirectInfo, "Host should not return a redirect source file from `getSourceFile`");
|
|
119303
118910
|
var fileChanged = void 0;
|
|
@@ -119339,41 +118946,41 @@ var ts;
|
|
|
119339
118946
|
}
|
|
119340
118947
|
if (fileChanged) {
|
|
119341
118948
|
if (oldSourceFile.impliedNodeFormat !== newSourceFile.impliedNodeFormat) {
|
|
119342
|
-
structureIsReused =
|
|
118949
|
+
structureIsReused = 1 /* SafeModules */;
|
|
119343
118950
|
}
|
|
119344
118951
|
// The `newSourceFile` object was created for the new program.
|
|
119345
118952
|
else if (!ts.arrayIsEqualTo(oldSourceFile.libReferenceDirectives, newSourceFile.libReferenceDirectives, fileReferenceIsEqualTo)) {
|
|
119346
118953
|
// 'lib' references has changed. Matches behavior in changesAffectModuleResolution
|
|
119347
|
-
structureIsReused =
|
|
118954
|
+
structureIsReused = 1 /* SafeModules */;
|
|
119348
118955
|
}
|
|
119349
118956
|
else if (oldSourceFile.hasNoDefaultLib !== newSourceFile.hasNoDefaultLib) {
|
|
119350
118957
|
// value of no-default-lib has changed
|
|
119351
118958
|
// this will affect if default library is injected into the list of files
|
|
119352
|
-
structureIsReused =
|
|
118959
|
+
structureIsReused = 1 /* SafeModules */;
|
|
119353
118960
|
}
|
|
119354
118961
|
// check tripleslash references
|
|
119355
118962
|
else if (!ts.arrayIsEqualTo(oldSourceFile.referencedFiles, newSourceFile.referencedFiles, fileReferenceIsEqualTo)) {
|
|
119356
118963
|
// tripleslash references has changed
|
|
119357
|
-
structureIsReused =
|
|
118964
|
+
structureIsReused = 1 /* SafeModules */;
|
|
119358
118965
|
}
|
|
119359
118966
|
else {
|
|
119360
118967
|
// check imports and module augmentations
|
|
119361
118968
|
collectExternalModuleReferences(newSourceFile);
|
|
119362
118969
|
if (!ts.arrayIsEqualTo(oldSourceFile.imports, newSourceFile.imports, moduleNameIsEqualTo)) {
|
|
119363
118970
|
// imports has changed
|
|
119364
|
-
structureIsReused =
|
|
118971
|
+
structureIsReused = 1 /* SafeModules */;
|
|
119365
118972
|
}
|
|
119366
118973
|
else if (!ts.arrayIsEqualTo(oldSourceFile.moduleAugmentations, newSourceFile.moduleAugmentations, moduleNameIsEqualTo)) {
|
|
119367
118974
|
// moduleAugmentations has changed
|
|
119368
|
-
structureIsReused =
|
|
118975
|
+
structureIsReused = 1 /* SafeModules */;
|
|
119369
118976
|
}
|
|
119370
118977
|
else if ((oldSourceFile.flags & 6291456 /* PermanentlySetIncrementalFlags */) !== (newSourceFile.flags & 6291456 /* PermanentlySetIncrementalFlags */)) {
|
|
119371
118978
|
// dynamicImport has changed
|
|
119372
|
-
structureIsReused =
|
|
118979
|
+
structureIsReused = 1 /* SafeModules */;
|
|
119373
118980
|
}
|
|
119374
118981
|
else if (!ts.arrayIsEqualTo(oldSourceFile.typeReferenceDirectives, newSourceFile.typeReferenceDirectives, fileReferenceIsEqualTo)) {
|
|
119375
118982
|
// 'types' references has changed
|
|
119376
|
-
structureIsReused =
|
|
118983
|
+
structureIsReused = 1 /* SafeModules */;
|
|
119377
118984
|
}
|
|
119378
118985
|
}
|
|
119379
118986
|
// tentatively approve the file
|
|
@@ -119381,72 +118988,63 @@ var ts;
|
|
|
119381
118988
|
}
|
|
119382
118989
|
else if (hasInvalidatedResolution(oldSourceFile.path)) {
|
|
119383
118990
|
// 'module/types' references could have changed
|
|
119384
|
-
structureIsReused =
|
|
118991
|
+
structureIsReused = 1 /* SafeModules */;
|
|
119385
118992
|
// add file to the modified list so that we will resolve it later
|
|
119386
118993
|
modifiedSourceFiles.push({ oldFile: oldSourceFile, newFile: newSourceFile });
|
|
119387
118994
|
}
|
|
119388
118995
|
// if file has passed all checks it should be safe to reuse it
|
|
119389
118996
|
newSourceFiles.push(newSourceFile);
|
|
119390
118997
|
}
|
|
119391
|
-
if (structureIsReused !==
|
|
118998
|
+
if (structureIsReused !== 2 /* Completely */) {
|
|
119392
118999
|
return structureIsReused;
|
|
119393
119000
|
}
|
|
119394
119001
|
var modifiedFiles = modifiedSourceFiles.map(function (f) { return f.oldFile; });
|
|
119395
|
-
for (var
|
|
119396
|
-
var oldFile = oldSourceFiles_3[
|
|
119002
|
+
for (var _c = 0, oldSourceFiles_3 = oldSourceFiles; _c < oldSourceFiles_3.length; _c++) {
|
|
119003
|
+
var oldFile = oldSourceFiles_3[_c];
|
|
119397
119004
|
if (!ts.contains(modifiedFiles, oldFile)) {
|
|
119398
|
-
for (var
|
|
119399
|
-
var moduleName =
|
|
119005
|
+
for (var _d = 0, _e = oldFile.ambientModuleNames; _d < _e.length; _d++) {
|
|
119006
|
+
var moduleName = _e[_d];
|
|
119400
119007
|
ambientModuleNameToUnmodifiedFileName.set(moduleName, oldFile.fileName);
|
|
119401
119008
|
}
|
|
119402
119009
|
}
|
|
119403
119010
|
}
|
|
119404
119011
|
// try to verify results of module resolution
|
|
119405
|
-
for (var
|
|
119406
|
-
var
|
|
119012
|
+
for (var _f = 0, modifiedSourceFiles_1 = modifiedSourceFiles; _f < modifiedSourceFiles_1.length; _f++) {
|
|
119013
|
+
var _g = modifiedSourceFiles_1[_f], oldSourceFile = _g.oldFile, newSourceFile = _g.newFile;
|
|
119407
119014
|
var moduleNames = getModuleNames(newSourceFile);
|
|
119408
119015
|
var resolutions = resolveModuleNamesReusingOldState(moduleNames, newSourceFile);
|
|
119409
119016
|
// ensure that module resolution results are still correct
|
|
119410
119017
|
var resolutionsChanged = ts.hasChangesInResolutions(moduleNames, resolutions, oldSourceFile.resolvedModules, oldSourceFile, ts.moduleResolutionIsEqualTo);
|
|
119411
119018
|
if (resolutionsChanged) {
|
|
119412
|
-
structureIsReused =
|
|
119019
|
+
structureIsReused = 1 /* SafeModules */;
|
|
119413
119020
|
newSourceFile.resolvedModules = ts.zipToModeAwareCache(newSourceFile, moduleNames, resolutions);
|
|
119414
119021
|
}
|
|
119415
119022
|
else {
|
|
119416
119023
|
newSourceFile.resolvedModules = oldSourceFile.resolvedModules;
|
|
119417
119024
|
}
|
|
119418
119025
|
var typesReferenceDirectives = newSourceFile.typeReferenceDirectives;
|
|
119419
|
-
var typeReferenceResolutions =
|
|
119026
|
+
var typeReferenceResolutions = resolveTypeReferenceDirectiveNamesWorker(typesReferenceDirectives, newSourceFile);
|
|
119420
119027
|
// ensure that types resolutions are still correct
|
|
119421
119028
|
var typeReferenceResolutionsChanged = ts.hasChangesInResolutions(typesReferenceDirectives, typeReferenceResolutions, oldSourceFile.resolvedTypeReferenceDirectiveNames, oldSourceFile, ts.typeDirectiveIsEqualTo);
|
|
119422
119029
|
if (typeReferenceResolutionsChanged) {
|
|
119423
|
-
structureIsReused =
|
|
119030
|
+
structureIsReused = 1 /* SafeModules */;
|
|
119424
119031
|
newSourceFile.resolvedTypeReferenceDirectiveNames = ts.zipToModeAwareCache(newSourceFile, typesReferenceDirectives, typeReferenceResolutions);
|
|
119425
119032
|
}
|
|
119426
119033
|
else {
|
|
119427
119034
|
newSourceFile.resolvedTypeReferenceDirectiveNames = oldSourceFile.resolvedTypeReferenceDirectiveNames;
|
|
119428
119035
|
}
|
|
119429
119036
|
}
|
|
119430
|
-
if (structureIsReused !==
|
|
119037
|
+
if (structureIsReused !== 2 /* Completely */) {
|
|
119431
119038
|
return structureIsReused;
|
|
119432
119039
|
}
|
|
119433
|
-
if (ts.changesAffectingProgramStructure(
|
|
119434
|
-
return
|
|
119435
|
-
}
|
|
119436
|
-
if (host.hasChangedAutomaticTypeDirectiveNames) {
|
|
119437
|
-
if (host.hasChangedAutomaticTypeDirectiveNames())
|
|
119438
|
-
return 2 /* SafeModules */;
|
|
119439
|
-
}
|
|
119440
|
-
else {
|
|
119441
|
-
automaticTypeDirectiveNames = ts.getAutomaticTypeDirectiveNames(options, host);
|
|
119442
|
-
if (!ts.arrayIsEqualTo(oldProgram.getAutomaticTypeDirectiveNames(), automaticTypeDirectiveNames))
|
|
119443
|
-
return 2 /* SafeModules */;
|
|
119040
|
+
if (ts.changesAffectingProgramStructure(oldOptions, options) || ((_b = host.hasChangedAutomaticTypeDirectiveNames) === null || _b === void 0 ? void 0 : _b.call(host))) {
|
|
119041
|
+
return 1 /* SafeModules */;
|
|
119444
119042
|
}
|
|
119445
119043
|
missingFilePaths = oldProgram.getMissingFilePaths();
|
|
119446
119044
|
// update fileName -> file mapping
|
|
119447
119045
|
ts.Debug.assert(newSourceFiles.length === oldProgram.getSourceFiles().length);
|
|
119448
|
-
for (var
|
|
119449
|
-
var newSourceFile = newSourceFiles_1[
|
|
119046
|
+
for (var _h = 0, newSourceFiles_1 = newSourceFiles; _h < newSourceFiles_1.length; _h++) {
|
|
119047
|
+
var newSourceFile = newSourceFiles_1[_h];
|
|
119450
119048
|
filesByName.set(newSourceFile.path, newSourceFile);
|
|
119451
119049
|
}
|
|
119452
119050
|
var oldFilesByNameMap = oldProgram.getFilesByNameMap();
|
|
@@ -119468,12 +119066,10 @@ var ts;
|
|
|
119468
119066
|
fileReasons = oldProgram.getFileIncludeReasons();
|
|
119469
119067
|
fileProcessingDiagnostics = oldProgram.getFileProcessingDiagnostics();
|
|
119470
119068
|
resolvedTypeReferenceDirectives = oldProgram.getResolvedTypeReferenceDirectives();
|
|
119471
|
-
automaticTypeDirectiveNames = oldProgram.getAutomaticTypeDirectiveNames();
|
|
119472
|
-
automaticTypeDirectiveResolutions = oldProgram.getAutomaticTypeDirectiveResolutions();
|
|
119473
119069
|
sourceFileToPackageName = oldProgram.sourceFileToPackageName;
|
|
119474
119070
|
redirectTargetsMap = oldProgram.redirectTargetsMap;
|
|
119475
119071
|
usesUriStyleNodeCoreModules = oldProgram.usesUriStyleNodeCoreModules;
|
|
119476
|
-
return
|
|
119072
|
+
return 2 /* Completely */;
|
|
119477
119073
|
}
|
|
119478
119074
|
function getEmitHost(writeFileCallback) {
|
|
119479
119075
|
return {
|
|
@@ -120233,12 +119829,14 @@ var ts;
|
|
|
120233
119829
|
}
|
|
120234
119830
|
}
|
|
120235
119831
|
function createRedirectSourceFile(redirectTarget, unredirected, fileName, path, resolvedPath, originalFileName, sourceFileOptions) {
|
|
119832
|
+
var _a;
|
|
120236
119833
|
var redirect = Object.create(redirectTarget);
|
|
120237
119834
|
redirect.fileName = fileName;
|
|
120238
119835
|
redirect.path = path;
|
|
120239
119836
|
redirect.resolvedPath = resolvedPath;
|
|
120240
119837
|
redirect.originalFileName = originalFileName;
|
|
120241
119838
|
redirect.redirectInfo = { redirectTarget: redirectTarget, unredirected: unredirected };
|
|
119839
|
+
redirect.packageJsonLocations = ((_a = sourceFileOptions.packageJsonLocations) === null || _a === void 0 ? void 0 : _a.length) ? sourceFileOptions.packageJsonLocations : undefined;
|
|
120242
119840
|
redirect.packageJsonScope = sourceFileOptions.packageJsonScope;
|
|
120243
119841
|
sourceFilesFoundSearchingNodeModules.set(path, currentNodeModulesDepth > 0);
|
|
120244
119842
|
Object.defineProperties(redirect, {
|
|
@@ -120264,7 +119862,7 @@ var ts;
|
|
|
120264
119862
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
120265
119863
|
return result;
|
|
120266
119864
|
}
|
|
120267
|
-
function getCreateSourceFileOptions(fileName) {
|
|
119865
|
+
function getCreateSourceFileOptions(fileName, moduleResolutionCache, host, options) {
|
|
120268
119866
|
// It's a _little odd_ that we can't set `impliedNodeFormat` until the program step - but it's the first and only time we have a resolution cache
|
|
120269
119867
|
// and a freshly made source file node on hand at the same time, and we need both to set the field. Persisting the resolution cache all the way
|
|
120270
119868
|
// to the check and emit steps would be bad - so we much prefer detecting and storing the format information on the source file node upfront.
|
|
@@ -120275,7 +119873,7 @@ var ts;
|
|
|
120275
119873
|
{ languageVersion: languageVersion, impliedNodeFormat: result, setExternalModuleIndicator: setExternalModuleIndicator };
|
|
120276
119874
|
}
|
|
120277
119875
|
function findSourceFileWorker(fileName, isDefaultLib, ignoreNoDefaultLib, reason, packageId) {
|
|
120278
|
-
var _a;
|
|
119876
|
+
var _a, _b;
|
|
120279
119877
|
var path = toPath(fileName);
|
|
120280
119878
|
if (useSourceOfProjectReferenceRedirect) {
|
|
120281
119879
|
var source = getSourceOfProjectReferenceRedirect(path);
|
|
@@ -120362,7 +119960,7 @@ var ts;
|
|
|
120362
119960
|
}
|
|
120363
119961
|
}
|
|
120364
119962
|
// We haven't looked for this file, do so now and cache result
|
|
120365
|
-
var sourceFileOptions = getCreateSourceFileOptions(fileName);
|
|
119963
|
+
var sourceFileOptions = getCreateSourceFileOptions(fileName, moduleResolutionCache, host, options);
|
|
120366
119964
|
var file = host.getSourceFile(fileName, sourceFileOptions, function (hostErrorMessage) { return addFilePreprocessingFileExplainingDiagnostic(/*file*/ undefined, reason, ts.Diagnostics.Cannot_read_file_0_Colon_1, [fileName, hostErrorMessage]); }, shouldCreateNewSourceFile || (((_a = oldProgram === null || oldProgram === void 0 ? void 0 : oldProgram.getSourceFileByPath(toPath(fileName))) === null || _a === void 0 ? void 0 : _a.impliedNodeFormat) !== sourceFileOptions.impliedNodeFormat));
|
|
120367
119965
|
if (packageId) {
|
|
120368
119966
|
var packageIdKey = ts.packageIdToString(packageId);
|
|
@@ -120391,6 +119989,7 @@ var ts;
|
|
|
120391
119989
|
file.path = path;
|
|
120392
119990
|
file.resolvedPath = toPath(fileName);
|
|
120393
119991
|
file.originalFileName = originalFileName;
|
|
119992
|
+
file.packageJsonLocations = ((_b = sourceFileOptions.packageJsonLocations) === null || _b === void 0 ? void 0 : _b.length) ? sourceFileOptions.packageJsonLocations : undefined;
|
|
120394
119993
|
file.packageJsonScope = sourceFileOptions.packageJsonScope;
|
|
120395
119994
|
addFileIncludeReason(file, reason);
|
|
120396
119995
|
if (host.useCaseSensitiveFileNames()) {
|
|
@@ -120519,42 +120118,35 @@ var ts;
|
|
|
120519
120118
|
}
|
|
120520
120119
|
function processTypeReferenceDirectives(file) {
|
|
120521
120120
|
var typeDirectives = file.typeReferenceDirectives;
|
|
120522
|
-
if (!typeDirectives
|
|
120523
|
-
file.resolvedTypeReferenceDirectiveNames = undefined;
|
|
120121
|
+
if (!typeDirectives) {
|
|
120524
120122
|
return;
|
|
120525
120123
|
}
|
|
120526
|
-
var resolutions =
|
|
120124
|
+
var resolutions = resolveTypeReferenceDirectiveNamesWorker(typeDirectives, file);
|
|
120527
120125
|
for (var index = 0; index < typeDirectives.length; index++) {
|
|
120528
120126
|
var ref = file.typeReferenceDirectives[index];
|
|
120529
120127
|
var resolvedTypeReferenceDirective = resolutions[index];
|
|
120530
120128
|
// store resolved type directive on the file
|
|
120531
120129
|
var fileName = ts.toFileNameLowerCase(ref.fileName);
|
|
120532
|
-
ts.setResolvedTypeReferenceDirective(file, fileName, resolvedTypeReferenceDirective
|
|
120130
|
+
ts.setResolvedTypeReferenceDirective(file, fileName, resolvedTypeReferenceDirective);
|
|
120533
120131
|
var mode = ref.resolutionMode || file.impliedNodeFormat;
|
|
120534
120132
|
if (mode && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeNext) {
|
|
120535
|
-
(
|
|
120536
|
-
kind: 2 /* ResolutionDiagnostics */,
|
|
120537
|
-
diagnostics: [ts.createDiagnosticForRange(file, ref, ts.Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext)]
|
|
120538
|
-
});
|
|
120133
|
+
programDiagnostics.add(ts.createDiagnosticForRange(file, ref, ts.Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext));
|
|
120539
120134
|
}
|
|
120540
120135
|
processTypeReferenceDirective(fileName, mode, resolvedTypeReferenceDirective, { kind: ts.FileIncludeKind.TypeReferenceDirective, file: file.path, index: index, });
|
|
120541
120136
|
}
|
|
120542
120137
|
}
|
|
120543
|
-
function processTypeReferenceDirective(typeReferenceDirective, mode,
|
|
120544
|
-
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program" /* Program */, "processTypeReferenceDirective", { directive: typeReferenceDirective, hasResolved: !!
|
|
120545
|
-
processTypeReferenceDirectiveWorker(typeReferenceDirective, mode,
|
|
120138
|
+
function processTypeReferenceDirective(typeReferenceDirective, mode, resolvedTypeReferenceDirective, reason) {
|
|
120139
|
+
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 });
|
|
120140
|
+
processTypeReferenceDirectiveWorker(typeReferenceDirective, mode, resolvedTypeReferenceDirective, reason);
|
|
120546
120141
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
120547
120142
|
}
|
|
120548
|
-
function processTypeReferenceDirectiveWorker(typeReferenceDirective, mode,
|
|
120549
|
-
var _a;
|
|
120550
|
-
addResolutionDiagnostics(resolution);
|
|
120143
|
+
function processTypeReferenceDirectiveWorker(typeReferenceDirective, mode, resolvedTypeReferenceDirective, reason) {
|
|
120551
120144
|
// If we already found this library as a primary reference - nothing to do
|
|
120552
|
-
var previousResolution =
|
|
120145
|
+
var previousResolution = resolvedTypeReferenceDirectives.get(typeReferenceDirective, mode);
|
|
120553
120146
|
if (previousResolution && previousResolution.primary) {
|
|
120554
120147
|
return;
|
|
120555
120148
|
}
|
|
120556
120149
|
var saveResolution = true;
|
|
120557
|
-
var resolvedTypeReferenceDirective = resolution.resolvedTypeReferenceDirective;
|
|
120558
120150
|
if (resolvedTypeReferenceDirective) {
|
|
120559
120151
|
if (resolvedTypeReferenceDirective.isExternalLibraryImport)
|
|
120560
120152
|
currentNodeModulesDepth++;
|
|
@@ -120589,7 +120181,7 @@ var ts;
|
|
|
120589
120181
|
addFilePreprocessingFileExplainingDiagnostic(/*file*/ undefined, reason, ts.Diagnostics.Cannot_find_type_definition_file_for_0, [typeReferenceDirective]);
|
|
120590
120182
|
}
|
|
120591
120183
|
if (saveResolution) {
|
|
120592
|
-
resolvedTypeReferenceDirectives.set(typeReferenceDirective, mode,
|
|
120184
|
+
resolvedTypeReferenceDirectives.set(typeReferenceDirective, mode, resolvedTypeReferenceDirective);
|
|
120593
120185
|
}
|
|
120594
120186
|
}
|
|
120595
120187
|
function pathForLibFile(libFileName) {
|
|
@@ -120622,7 +120214,7 @@ var ts;
|
|
|
120622
120214
|
var unqualifiedLibName = ts.removeSuffix(ts.removePrefix(libName, "lib."), ".d.ts");
|
|
120623
120215
|
var suggestion = ts.getSpellingSuggestion(unqualifiedLibName, ts.libs, ts.identity);
|
|
120624
120216
|
var diagnostic = suggestion ? ts.Diagnostics.Cannot_find_lib_definition_for_0_Did_you_mean_1 : ts.Diagnostics.Cannot_find_lib_definition_for_0;
|
|
120625
|
-
(fileProcessingDiagnostics
|
|
120217
|
+
(fileProcessingDiagnostics || (fileProcessingDiagnostics = [])).push({
|
|
120626
120218
|
kind: 0 /* FilePreprocessingReferencedDiagnostic */,
|
|
120627
120219
|
reason: { kind: ts.FileIncludeKind.LibReferenceDirective, file: file.path, index: index, },
|
|
120628
120220
|
diagnostic: diagnostic,
|
|
@@ -120646,14 +120238,13 @@ var ts;
|
|
|
120646
120238
|
for (var index = 0; index < moduleNames.length; index++) {
|
|
120647
120239
|
var resolution = resolutions[index];
|
|
120648
120240
|
ts.setResolvedModule(file, moduleNames[index], resolution, getModeForResolutionAtIndex(file, index));
|
|
120649
|
-
|
|
120650
|
-
if (!resolution.resolvedModule) {
|
|
120241
|
+
if (!resolution) {
|
|
120651
120242
|
continue;
|
|
120652
120243
|
}
|
|
120653
|
-
var isFromNodeModulesSearch = resolution.
|
|
120654
|
-
var isJsFile = !ts.resolutionExtensionIsTSOrJson(resolution.
|
|
120244
|
+
var isFromNodeModulesSearch = resolution.isExternalLibraryImport;
|
|
120245
|
+
var isJsFile = !ts.resolutionExtensionIsTSOrJson(resolution.extension);
|
|
120655
120246
|
var isJsFileFromNodeModules = isFromNodeModulesSearch && isJsFile;
|
|
120656
|
-
var resolvedFileName = resolution.
|
|
120247
|
+
var resolvedFileName = resolution.resolvedFileName;
|
|
120657
120248
|
if (isFromNodeModulesSearch) {
|
|
120658
120249
|
currentNodeModulesDepth++;
|
|
120659
120250
|
}
|
|
@@ -120666,7 +120257,7 @@ var ts;
|
|
|
120666
120257
|
// Don't add the file if it has a bad extension (e.g. 'tsx' if we don't have '--allowJs')
|
|
120667
120258
|
// This may still end up being an untyped module -- the file won't be included but imports will be allowed.
|
|
120668
120259
|
var shouldAddFile = resolvedFileName
|
|
120669
|
-
&& !getResolutionDiagnostic(optionsForFile, resolution
|
|
120260
|
+
&& !getResolutionDiagnostic(optionsForFile, resolution)
|
|
120670
120261
|
&& !optionsForFile.noResolve
|
|
120671
120262
|
&& index < file.imports.length
|
|
120672
120263
|
&& !elideImport
|
|
@@ -120678,7 +120269,7 @@ var ts;
|
|
|
120678
120269
|
else if (shouldAddFile) {
|
|
120679
120270
|
findSourceFile(resolvedFileName,
|
|
120680
120271
|
/*isDefaultLib*/ false,
|
|
120681
|
-
/*ignoreNoDefaultLib*/ false, { kind: ts.FileIncludeKind.Import, file: file.path, index: index, }, resolution.
|
|
120272
|
+
/*ignoreNoDefaultLib*/ false, { kind: ts.FileIncludeKind.Import, file: file.path, index: index, }, resolution.packageId);
|
|
120682
120273
|
}
|
|
120683
120274
|
if (isFromNodeModulesSearch) {
|
|
120684
120275
|
currentNodeModulesDepth--;
|
|
@@ -120782,9 +120373,6 @@ var ts;
|
|
|
120782
120373
|
createDiagnosticForOptionName(ts.Diagnostics.Composite_projects_may_not_disable_incremental_compilation, "declaration");
|
|
120783
120374
|
}
|
|
120784
120375
|
}
|
|
120785
|
-
// if (options.cacheResolutions && !isIncrementalCompilation(options)) {
|
|
120786
|
-
// createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1_or_option_2, "cacheResolutions", "incremental", "composite");
|
|
120787
|
-
// }
|
|
120788
120376
|
var outputFile = ts.outFile(options);
|
|
120789
120377
|
if (options.tsBuildInfoFile) {
|
|
120790
120378
|
if (!ts.isIncrementalCompilation(options)) {
|
|
@@ -121053,7 +120641,7 @@ var ts;
|
|
|
121053
120641
|
}
|
|
121054
120642
|
}
|
|
121055
120643
|
function addFilePreprocessingFileExplainingDiagnostic(file, fileProcessingReason, diagnostic, args) {
|
|
121056
|
-
(fileProcessingDiagnostics
|
|
120644
|
+
(fileProcessingDiagnostics || (fileProcessingDiagnostics = [])).push({
|
|
121057
120645
|
kind: 1 /* FilePreprocessingFileExplainingDiagnostic */,
|
|
121058
120646
|
file: file && file.path,
|
|
121059
120647
|
fileProcessingReason: fileProcessingReason,
|
|
@@ -121321,8 +120909,8 @@ var ts;
|
|
|
121321
120909
|
if (!symlinks) {
|
|
121322
120910
|
symlinks = ts.createSymlinkCache(currentDirectory, getCanonicalFileName);
|
|
121323
120911
|
}
|
|
121324
|
-
if (files &&
|
|
121325
|
-
symlinks.setSymlinksFromResolutions(files,
|
|
120912
|
+
if (files && resolvedTypeReferenceDirectives && !symlinks.hasProcessedResolutions()) {
|
|
120913
|
+
symlinks.setSymlinksFromResolutions(files, resolvedTypeReferenceDirectives);
|
|
121326
120914
|
}
|
|
121327
120915
|
return symlinks;
|
|
121328
120916
|
}
|
|
@@ -121735,8 +121323,7 @@ var ts;
|
|
|
121735
121323
|
}
|
|
121736
121324
|
// Handle type reference directives
|
|
121737
121325
|
if (sourceFile.resolvedTypeReferenceDirectiveNames) {
|
|
121738
|
-
sourceFile.resolvedTypeReferenceDirectiveNames.forEach(function (
|
|
121739
|
-
var resolvedTypeReferenceDirective = _a.resolvedTypeReferenceDirective;
|
|
121326
|
+
sourceFile.resolvedTypeReferenceDirectiveNames.forEach(function (resolvedTypeReferenceDirective) {
|
|
121740
121327
|
if (!resolvedTypeReferenceDirective) {
|
|
121741
121328
|
return;
|
|
121742
121329
|
}
|
|
@@ -121795,13 +121382,12 @@ var ts;
|
|
|
121795
121382
|
/**
|
|
121796
121383
|
* Creates the state of file references and signature for the new program from oldState if it is safe
|
|
121797
121384
|
*/
|
|
121798
|
-
function create(newProgram, oldState, disableUseFileVersionAsSignature) {
|
|
121385
|
+
function create(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature) {
|
|
121799
121386
|
var _a, _b, _c;
|
|
121800
121387
|
var fileInfos = new ts.Map();
|
|
121801
121388
|
var referencedMap = newProgram.getCompilerOptions().module !== ts.ModuleKind.None ? createManyToManyPathMap() : undefined;
|
|
121802
121389
|
var exportedModulesMap = referencedMap ? createManyToManyPathMap() : undefined;
|
|
121803
121390
|
var useOldState = canReuseOldState(referencedMap, oldState);
|
|
121804
|
-
var getCanonicalFileName = ts.createGetCanonicalFileName(newProgram.useCaseSensitiveFileNames());
|
|
121805
121391
|
// Ensure source files have parent pointers set
|
|
121806
121392
|
newProgram.getTypeChecker();
|
|
121807
121393
|
// Create the reference map, and set the file infos
|
|
@@ -121854,23 +121440,23 @@ var ts;
|
|
|
121854
121440
|
/**
|
|
121855
121441
|
* Gets the files affected by the path from the program
|
|
121856
121442
|
*/
|
|
121857
|
-
function getFilesAffectedBy(state, programOfThisState, path, cancellationToken,
|
|
121443
|
+
function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, computeHash, getCanonicalFileName) {
|
|
121858
121444
|
var _a, _b;
|
|
121859
|
-
var result = getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken,
|
|
121445
|
+
var result = getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash, getCanonicalFileName);
|
|
121860
121446
|
(_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.clear();
|
|
121861
121447
|
(_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
|
|
121862
121448
|
return result;
|
|
121863
121449
|
}
|
|
121864
121450
|
BuilderState.getFilesAffectedBy = getFilesAffectedBy;
|
|
121865
|
-
function getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken,
|
|
121451
|
+
function getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash, getCanonicalFileName) {
|
|
121866
121452
|
var sourceFile = programOfThisState.getSourceFileByPath(path);
|
|
121867
121453
|
if (!sourceFile) {
|
|
121868
121454
|
return ts.emptyArray;
|
|
121869
121455
|
}
|
|
121870
|
-
if (!updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken,
|
|
121456
|
+
if (!updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash, getCanonicalFileName)) {
|
|
121871
121457
|
return [sourceFile];
|
|
121872
121458
|
}
|
|
121873
|
-
return (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, cancellationToken,
|
|
121459
|
+
return (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, cancellationToken, computeHash, getCanonicalFileName);
|
|
121874
121460
|
}
|
|
121875
121461
|
BuilderState.getFilesAffectedByWithOldState = getFilesAffectedByWithOldState;
|
|
121876
121462
|
function updateSignatureOfFile(state, signature, path) {
|
|
@@ -121881,7 +121467,7 @@ var ts;
|
|
|
121881
121467
|
/**
|
|
121882
121468
|
* Returns if the shape of the signature has changed since last emit
|
|
121883
121469
|
*/
|
|
121884
|
-
function updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken,
|
|
121470
|
+
function updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash, getCanonicalFileName, useFileVersionAsSignature) {
|
|
121885
121471
|
var _a;
|
|
121886
121472
|
if (useFileVersionAsSignature === void 0) { useFileVersionAsSignature = state.useFileVersionAsSignature; }
|
|
121887
121473
|
// If we have cached the result for this file, that means hence forth we should assume file shape is uptodate
|
|
@@ -121893,7 +121479,7 @@ var ts;
|
|
|
121893
121479
|
if (!sourceFile.isDeclarationFile && !useFileVersionAsSignature) {
|
|
121894
121480
|
programOfThisState.emit(sourceFile, function (fileName, text, _writeByteOrderMark, _onError, sourceFiles, data) {
|
|
121895
121481
|
ts.Debug.assert(ts.isDeclarationFileName(fileName), "File extension for signature expected to be dts: Got:: " + fileName);
|
|
121896
|
-
latestSignature = ts.computeSignatureWithDiagnostics(sourceFile, text,
|
|
121482
|
+
latestSignature = ts.computeSignatureWithDiagnostics(sourceFile, text, computeHash, getCanonicalFileName, data);
|
|
121897
121483
|
if (latestSignature !== prevSignature) {
|
|
121898
121484
|
updateExportedModules(state, sourceFile, sourceFiles[0].exportedModulesFromDeclarationEmit);
|
|
121899
121485
|
}
|
|
@@ -122072,7 +121658,7 @@ var ts;
|
|
|
122072
121658
|
/**
|
|
122073
121659
|
* When program emits modular code, gets the files affected by the sourceFile whose shape has changed
|
|
122074
121660
|
*/
|
|
122075
|
-
function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cancellationToken,
|
|
121661
|
+
function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cancellationToken, computeHash, getCanonicalFileName) {
|
|
122076
121662
|
if (isFileAffectingGlobalScope(sourceFileWithUpdatedShape)) {
|
|
122077
121663
|
return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
|
|
122078
121664
|
}
|
|
@@ -122092,7 +121678,7 @@ var ts;
|
|
|
122092
121678
|
if (!seenFileNamesMap.has(currentPath)) {
|
|
122093
121679
|
var currentSourceFile = programOfThisState.getSourceFileByPath(currentPath);
|
|
122094
121680
|
seenFileNamesMap.set(currentPath, currentSourceFile);
|
|
122095
|
-
if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cancellationToken,
|
|
121681
|
+
if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cancellationToken, computeHash, getCanonicalFileName)) {
|
|
122096
121682
|
queue.push.apply(queue, getReferencedByPaths(state, currentSourceFile.resolvedPath));
|
|
122097
121683
|
}
|
|
122098
121684
|
}
|
|
@@ -122117,9 +121703,9 @@ var ts;
|
|
|
122117
121703
|
/**
|
|
122118
121704
|
* Create the state so that we can iterate on changedFiles/affected files
|
|
122119
121705
|
*/
|
|
122120
|
-
function createBuilderProgramState(newProgram, oldState, disableUseFileVersionAsSignature) {
|
|
121706
|
+
function createBuilderProgramState(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature) {
|
|
122121
121707
|
var _a, _b;
|
|
122122
|
-
var state = ts.BuilderState.create(newProgram, oldState, disableUseFileVersionAsSignature);
|
|
121708
|
+
var state = ts.BuilderState.create(newProgram, getCanonicalFileName, oldState, disableUseFileVersionAsSignature);
|
|
122123
121709
|
state.program = newProgram;
|
|
122124
121710
|
var compilerOptions = newProgram.getCompilerOptions();
|
|
122125
121711
|
state.compilerOptions = compilerOptions;
|
|
@@ -122183,7 +121769,7 @@ var ts;
|
|
|
122183
121769
|
// Unchanged file copy diagnostics
|
|
122184
121770
|
var diagnostics = oldState.semanticDiagnosticsPerFile.get(sourceFilePath);
|
|
122185
121771
|
if (diagnostics) {
|
|
122186
|
-
state.semanticDiagnosticsPerFile.set(sourceFilePath, oldState.hasReusableDiagnostic ? convertToDiagnostics(diagnostics, newProgram) : diagnostics);
|
|
121772
|
+
state.semanticDiagnosticsPerFile.set(sourceFilePath, oldState.hasReusableDiagnostic ? convertToDiagnostics(diagnostics, newProgram, getCanonicalFileName) : diagnostics);
|
|
122187
121773
|
if (!state.semanticDiagnosticsFromOldState) {
|
|
122188
121774
|
state.semanticDiagnosticsFromOldState = new ts.Set();
|
|
122189
121775
|
}
|
|
@@ -122208,16 +121794,13 @@ var ts;
|
|
|
122208
121794
|
state.seenAffectedFiles = state.seenAffectedFiles || new ts.Set();
|
|
122209
121795
|
}
|
|
122210
121796
|
// Since old states change files set is copied, any additional change means we would need to emit build info
|
|
122211
|
-
state.buildInfoEmitPending = !useOldState ||
|
|
122212
|
-
state.changedFilesSet.size !== (((_b = oldState.changedFilesSet) === null || _b === void 0 ? void 0 : _b.size) || 0) ||
|
|
122213
|
-
state.fileInfos.size !== oldState.fileInfos.size;
|
|
121797
|
+
state.buildInfoEmitPending = !useOldState || state.changedFilesSet.size !== (((_b = oldState.changedFilesSet) === null || _b === void 0 ? void 0 : _b.size) || 0);
|
|
122214
121798
|
return state;
|
|
122215
121799
|
}
|
|
122216
|
-
function convertToDiagnostics(diagnostics, newProgram) {
|
|
121800
|
+
function convertToDiagnostics(diagnostics, newProgram, getCanonicalFileName) {
|
|
122217
121801
|
if (!diagnostics.length)
|
|
122218
121802
|
return ts.emptyArray;
|
|
122219
|
-
var buildInfoDirectory;
|
|
122220
|
-
var getCanonicalFileName;
|
|
121803
|
+
var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(ts.getTsBuildInfoEmitOutputFilePath(newProgram.getCompilerOptions()), newProgram.getCurrentDirectory()));
|
|
122221
121804
|
return diagnostics.map(function (diagnostic) {
|
|
122222
121805
|
var result = convertToDiagnosticRelatedInformation(diagnostic, newProgram, toPath);
|
|
122223
121806
|
result.reportsUnnecessary = diagnostic.reportsUnnecessary;
|
|
@@ -122233,8 +121816,7 @@ var ts;
|
|
|
122233
121816
|
return result;
|
|
122234
121817
|
});
|
|
122235
121818
|
function toPath(path) {
|
|
122236
|
-
|
|
122237
|
-
return ts.toPath(path, buildInfoDirectory, getCanonicalFileName !== null && getCanonicalFileName !== void 0 ? getCanonicalFileName : (getCanonicalFileName = ts.createGetCanonicalFileName(newProgram.useCaseSensitiveFileNames())));
|
|
121819
|
+
return ts.toPath(path, buildInfoDirectory, getCanonicalFileName);
|
|
122238
121820
|
}
|
|
122239
121821
|
}
|
|
122240
121822
|
function convertToDiagnosticRelatedInformation(diagnostic, newProgram, toPath) {
|
|
@@ -122246,9 +121828,6 @@ var ts;
|
|
|
122246
121828
|
*/
|
|
122247
121829
|
function releaseCache(state) {
|
|
122248
121830
|
ts.BuilderState.releaseCache(state);
|
|
122249
|
-
// Store the resolutions if possible
|
|
122250
|
-
if (!state.resuableCacheResolutions)
|
|
122251
|
-
getCacheResolutions(state);
|
|
122252
121831
|
state.program = undefined;
|
|
122253
121832
|
}
|
|
122254
121833
|
function backupBuilderProgramEmitState(state) {
|
|
@@ -122293,7 +121872,7 @@ var ts;
|
|
|
122293
121872
|
* This is to allow the callers to be able to actually remove affected file only when the operation is complete
|
|
122294
121873
|
* eg. if during diagnostics check cancellation token ends up cancelling the request, the affected file should be retained
|
|
122295
121874
|
*/
|
|
122296
|
-
function getNextAffectedFile(state, cancellationToken, host) {
|
|
121875
|
+
function getNextAffectedFile(state, cancellationToken, computeHash, getCanonicalFileName, host) {
|
|
122297
121876
|
var _a, _b;
|
|
122298
121877
|
while (true) {
|
|
122299
121878
|
var affectedFiles = state.affectedFiles;
|
|
@@ -122305,7 +121884,7 @@ var ts;
|
|
|
122305
121884
|
if (!seenAffectedFiles.has(affectedFile.resolvedPath)) {
|
|
122306
121885
|
// Set the next affected file as seen and remove the cached semantic diagnostics
|
|
122307
121886
|
state.affectedFilesIndex = affectedFilesIndex;
|
|
122308
|
-
handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, host);
|
|
121887
|
+
handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, getCanonicalFileName, host);
|
|
122309
121888
|
return affectedFile;
|
|
122310
121889
|
}
|
|
122311
121890
|
affectedFilesIndex++;
|
|
@@ -122333,7 +121912,7 @@ var ts;
|
|
|
122333
121912
|
return program;
|
|
122334
121913
|
}
|
|
122335
121914
|
// Get next batch of affected files
|
|
122336
|
-
state.affectedFiles = ts.BuilderState.getFilesAffectedByWithOldState(state, program, nextKey.value, cancellationToken,
|
|
121915
|
+
state.affectedFiles = ts.BuilderState.getFilesAffectedByWithOldState(state, program, nextKey.value, cancellationToken, computeHash, getCanonicalFileName);
|
|
122337
121916
|
state.currentChangedFilePath = nextKey.value;
|
|
122338
121917
|
state.affectedFilesIndex = 0;
|
|
122339
121918
|
if (!state.seenAffectedFiles)
|
|
@@ -122384,7 +121963,7 @@ var ts;
|
|
|
122384
121963
|
* Handles semantic diagnostics and dts emit for affectedFile and files, that are referencing modules that export entities from affected file
|
|
122385
121964
|
* This is because even though js emit doesnt change, dts emit / type used can change resulting in need for dts emit and js change
|
|
122386
121965
|
*/
|
|
122387
|
-
function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, host) {
|
|
121966
|
+
function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, getCanonicalFileName, host) {
|
|
122388
121967
|
removeSemanticDiagnosticsOf(state, affectedFile.resolvedPath);
|
|
122389
121968
|
// If affected files is everything except default library, then nothing more to do
|
|
122390
121969
|
if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles) {
|
|
@@ -122392,18 +121971,18 @@ var ts;
|
|
|
122392
121971
|
// When a change affects the global scope, all files are considered to be affected without updating their signature
|
|
122393
121972
|
// That means when affected file is handled, its signature can be out of date
|
|
122394
121973
|
// To avoid this, ensure that we update the signature for any affected file in this scenario.
|
|
122395
|
-
ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, cancellationToken,
|
|
121974
|
+
ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, cancellationToken, computeHash, getCanonicalFileName);
|
|
122396
121975
|
return;
|
|
122397
121976
|
}
|
|
122398
121977
|
if (state.compilerOptions.assumeChangesOnlyAffectDirectDependencies)
|
|
122399
121978
|
return;
|
|
122400
|
-
handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, host);
|
|
121979
|
+
handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, getCanonicalFileName, host);
|
|
122401
121980
|
}
|
|
122402
121981
|
/**
|
|
122403
121982
|
* Handle the dts may change, so they need to be added to pending emit if dts emit is enabled,
|
|
122404
121983
|
* Also we need to make sure signature is updated for these files
|
|
122405
121984
|
*/
|
|
122406
|
-
function handleDtsMayChangeOf(state, path, cancellationToken, host) {
|
|
121985
|
+
function handleDtsMayChangeOf(state, path, cancellationToken, computeHash, getCanonicalFileName, host) {
|
|
122407
121986
|
removeSemanticDiagnosticsOf(state, path);
|
|
122408
121987
|
if (!state.changedFilesSet.has(path)) {
|
|
122409
121988
|
var program = ts.Debug.checkDefined(state.program);
|
|
@@ -122414,7 +121993,7 @@ var ts;
|
|
|
122414
121993
|
// This ensures that we dont later during incremental builds considering wrong signature.
|
|
122415
121994
|
// Eg where this also is needed to ensure that .tsbuildinfo generated by incremental build should be same as if it was first fresh build
|
|
122416
121995
|
// But we avoid expensive full shape computation, as using file version as shape is enough for correctness.
|
|
122417
|
-
ts.BuilderState.updateShapeSignature(state, program, sourceFile, cancellationToken,
|
|
121996
|
+
ts.BuilderState.updateShapeSignature(state, program, sourceFile, cancellationToken, computeHash, getCanonicalFileName, !host.disableUseFileVersionAsSignature);
|
|
122418
121997
|
// If not dts emit, nothing more to do
|
|
122419
121998
|
if (ts.getEmitDeclarations(state.compilerOptions)) {
|
|
122420
121999
|
addToAffectedFilesPendingEmit(state, path, 0 /* DtsOnly */);
|
|
@@ -122439,20 +122018,20 @@ var ts;
|
|
|
122439
122018
|
var newSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
|
|
122440
122019
|
return newSignature !== oldSignature;
|
|
122441
122020
|
}
|
|
122442
|
-
function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, host) {
|
|
122021
|
+
function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, getCanonicalFileName, host) {
|
|
122443
122022
|
var _a;
|
|
122444
122023
|
if (!((_a = state.fileInfos.get(filePath)) === null || _a === void 0 ? void 0 : _a.affectsGlobalScope))
|
|
122445
122024
|
return false;
|
|
122446
122025
|
// Every file needs to be handled
|
|
122447
122026
|
ts.BuilderState.getAllFilesExcludingDefaultLibraryFile(state, state.program, /*firstSourceFile*/ undefined)
|
|
122448
|
-
.forEach(function (file) { return handleDtsMayChangeOf(state, file.resolvedPath, cancellationToken, host); });
|
|
122027
|
+
.forEach(function (file) { return handleDtsMayChangeOf(state, file.resolvedPath, cancellationToken, computeHash, getCanonicalFileName, host); });
|
|
122449
122028
|
removeDiagnosticsOfLibraryFiles(state);
|
|
122450
122029
|
return true;
|
|
122451
122030
|
}
|
|
122452
122031
|
/**
|
|
122453
122032
|
* Iterate on referencing modules that export entities from affected file and delete diagnostics and add pending emit
|
|
122454
122033
|
*/
|
|
122455
|
-
function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, host) {
|
|
122034
|
+
function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, getCanonicalFileName, host) {
|
|
122456
122035
|
var _a;
|
|
122457
122036
|
// If there was change in signature (dts output) for the changed file,
|
|
122458
122037
|
// then only we need to handle pending file emit
|
|
@@ -122470,9 +122049,9 @@ var ts;
|
|
|
122470
122049
|
var currentPath = queue.pop();
|
|
122471
122050
|
if (!seenFileNamesMap.has(currentPath)) {
|
|
122472
122051
|
seenFileNamesMap.set(currentPath, true);
|
|
122473
|
-
if (handleDtsMayChangeOfGlobalScope(state, currentPath, cancellationToken, host))
|
|
122052
|
+
if (handleDtsMayChangeOfGlobalScope(state, currentPath, cancellationToken, computeHash, getCanonicalFileName, host))
|
|
122474
122053
|
return;
|
|
122475
|
-
handleDtsMayChangeOf(state, currentPath, cancellationToken, host);
|
|
122054
|
+
handleDtsMayChangeOf(state, currentPath, cancellationToken, computeHash, getCanonicalFileName, host);
|
|
122476
122055
|
if (isChangedSignature(state, currentPath)) {
|
|
122477
122056
|
var currentSourceFile = ts.Debug.checkDefined(state.program).getSourceFileByPath(currentPath);
|
|
122478
122057
|
queue.push.apply(queue, ts.BuilderState.getReferencedByPaths(state, currentSourceFile.resolvedPath));
|
|
@@ -122484,11 +122063,11 @@ var ts;
|
|
|
122484
122063
|
// Go through exported modules from cache first
|
|
122485
122064
|
// If exported modules has path, all files referencing file exported from are affected
|
|
122486
122065
|
(_a = state.exportedModulesMap.getKeys(affectedFile.resolvedPath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
|
|
122487
|
-
if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, host))
|
|
122066
|
+
if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, computeHash, getCanonicalFileName, host))
|
|
122488
122067
|
return true;
|
|
122489
122068
|
var references = state.referencedMap.getKeys(exportedFromPath);
|
|
122490
122069
|
return references && ts.forEachKey(references, function (filePath) {
|
|
122491
|
-
return handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, host);
|
|
122070
|
+
return handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, getCanonicalFileName, host);
|
|
122492
122071
|
});
|
|
122493
122072
|
});
|
|
122494
122073
|
}
|
|
@@ -122496,22 +122075,22 @@ var ts;
|
|
|
122496
122075
|
* handle dts and semantic diagnostics on file and iterate on anything that exports this file
|
|
122497
122076
|
* return true when all work is done and we can exit handling dts emit and semantic diagnostics
|
|
122498
122077
|
*/
|
|
122499
|
-
function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, host) {
|
|
122078
|
+
function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, getCanonicalFileName, host) {
|
|
122500
122079
|
var _a, _b;
|
|
122501
122080
|
if (!ts.tryAddToSet(seenFileAndExportsOfFile, filePath))
|
|
122502
122081
|
return undefined;
|
|
122503
|
-
if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, host))
|
|
122082
|
+
if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, getCanonicalFileName, host))
|
|
122504
122083
|
return true;
|
|
122505
|
-
handleDtsMayChangeOf(state, filePath, cancellationToken, host);
|
|
122084
|
+
handleDtsMayChangeOf(state, filePath, cancellationToken, computeHash, getCanonicalFileName, host);
|
|
122506
122085
|
// If exported modules has path, all files referencing file exported from are affected
|
|
122507
122086
|
(_a = state.exportedModulesMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
|
|
122508
|
-
return handleDtsMayChangeOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, cancellationToken, host);
|
|
122087
|
+
return handleDtsMayChangeOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, cancellationToken, computeHash, getCanonicalFileName, host);
|
|
122509
122088
|
});
|
|
122510
122089
|
// Remove diagnostics of files that import this file (without going to exports of referencing files)
|
|
122511
122090
|
(_b = state.referencedMap.getKeys(filePath)) === null || _b === void 0 ? void 0 : _b.forEach(function (referencingFilePath) {
|
|
122512
122091
|
return !seenFileAndExportsOfFile.has(referencingFilePath) && // Not already removed diagnostic file
|
|
122513
122092
|
handleDtsMayChangeOf(// Dont add to seen since this is not yet done with the export removal
|
|
122514
|
-
state, referencingFilePath, cancellationToken, host);
|
|
122093
|
+
state, referencingFilePath, cancellationToken, computeHash, getCanonicalFileName, host);
|
|
122515
122094
|
});
|
|
122516
122095
|
return undefined;
|
|
122517
122096
|
}
|
|
@@ -122587,11 +122166,11 @@ var ts;
|
|
|
122587
122166
|
return !!ts.outFile(info.options || {});
|
|
122588
122167
|
}
|
|
122589
122168
|
ts.isProgramBundleEmitBuildInfo = isProgramBundleEmitBuildInfo;
|
|
122590
|
-
function getProgramBuildInfo(state,
|
|
122591
|
-
if (ts.outFile(state.compilerOptions) && !state.compilerOptions.composite
|
|
122169
|
+
function getProgramBuildInfo(state, getCanonicalFileName) {
|
|
122170
|
+
if (ts.outFile(state.compilerOptions) && !state.compilerOptions.composite)
|
|
122592
122171
|
return;
|
|
122593
122172
|
ts.performance.mark("beforeGetProgramBuildInfo");
|
|
122594
|
-
var result = getProgramBuildInfoWorker(state,
|
|
122173
|
+
var result = getProgramBuildInfoWorker(state, getCanonicalFileName);
|
|
122595
122174
|
ts.performance.mark("afterGetProgramBuildInfo");
|
|
122596
122175
|
ts.performance.measure("BuildInfo generation", "beforeGetProgramBuildInfo", "afterGetProgramBuildInfo");
|
|
122597
122176
|
return result;
|
|
@@ -122599,43 +122178,32 @@ var ts;
|
|
|
122599
122178
|
/**
|
|
122600
122179
|
* Gets the program information to be emitted in buildInfo so that we can use it to create new program
|
|
122601
122180
|
*/
|
|
122602
|
-
function getProgramBuildInfoWorker(state,
|
|
122181
|
+
function getProgramBuildInfoWorker(state, getCanonicalFileName) {
|
|
122603
122182
|
var currentDirectory = ts.Debug.checkDefined(state.program).getCurrentDirectory();
|
|
122604
|
-
var
|
|
122605
|
-
var buildInfoPath = ts.getNormalizedAbsolutePath(ts.getTsBuildInfoEmitOutputFilePath(state.compilerOptions), currentDirectory);
|
|
122606
|
-
var buildInfoDirectory = ts.getDirectoryPath(buildInfoPath);
|
|
122183
|
+
var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(ts.getTsBuildInfoEmitOutputFilePath(state.compilerOptions), currentDirectory));
|
|
122607
122184
|
// 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
|
|
122608
122185
|
var latestChangedDtsFile = state.latestChangedDtsFile ? relativeToBuildInfoEnsuringAbsolutePath(state.latestChangedDtsFile) : undefined;
|
|
122609
|
-
var fileNames = [];
|
|
122610
|
-
var fileNameToFileId = new ts.Map();
|
|
122611
|
-
var resolutions;
|
|
122612
|
-
var names;
|
|
122613
|
-
var resolutionNameToResolutionNameId;
|
|
122614
|
-
var resolutionEntries;
|
|
122615
|
-
var resolutionEntryToResolutionEntryId;
|
|
122616
|
-
var affectedFilesHash;
|
|
122617
122186
|
if (ts.outFile(state.compilerOptions)) {
|
|
122618
|
-
var
|
|
122619
|
-
|
|
122620
|
-
|
|
122621
|
-
|
|
122622
|
-
|
|
122623
|
-
|
|
122624
|
-
|
|
122625
|
-
|
|
122626
|
-
|
|
122627
|
-
|
|
122628
|
-
|
|
122629
|
-
var result_16 = {
|
|
122630
|
-
fileNames: fileNames,
|
|
122187
|
+
var fileNames_1 = [];
|
|
122188
|
+
var fileInfos_1 = [];
|
|
122189
|
+
state.program.getRootFileNames().forEach(function (f) {
|
|
122190
|
+
var sourceFile = state.program.getSourceFile(f);
|
|
122191
|
+
if (!sourceFile)
|
|
122192
|
+
return;
|
|
122193
|
+
fileNames_1.push(relativeToBuildInfo(sourceFile.resolvedPath));
|
|
122194
|
+
fileInfos_1.push(sourceFile.version);
|
|
122195
|
+
});
|
|
122196
|
+
var result_15 = {
|
|
122197
|
+
fileNames: fileNames_1,
|
|
122631
122198
|
fileInfos: fileInfos_1,
|
|
122632
|
-
options:
|
|
122199
|
+
options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsBundleEmitBuildInfo"),
|
|
122633
122200
|
outSignature: state.outSignature,
|
|
122634
122201
|
latestChangedDtsFile: latestChangedDtsFile,
|
|
122635
|
-
cacheResolutions: cacheResolutions_1,
|
|
122636
122202
|
};
|
|
122637
|
-
return
|
|
122203
|
+
return result_15;
|
|
122638
122204
|
}
|
|
122205
|
+
var fileNames = [];
|
|
122206
|
+
var fileNameToFileId = new ts.Map();
|
|
122639
122207
|
var fileIdsList;
|
|
122640
122208
|
var fileNamesToFileIdListId;
|
|
122641
122209
|
var emitSignatures;
|
|
@@ -122699,7 +122267,7 @@ var ts;
|
|
|
122699
122267
|
(semanticDiagnosticsPerFile || (semanticDiagnosticsPerFile = [])).push(value.length ?
|
|
122700
122268
|
[
|
|
122701
122269
|
toFileId(key),
|
|
122702
|
-
value
|
|
122270
|
+
convertToReusableDiagnostics(value, relativeToBuildInfo)
|
|
122703
122271
|
] :
|
|
122704
122272
|
toFileId(key));
|
|
122705
122273
|
}
|
|
@@ -122721,11 +122289,10 @@ var ts;
|
|
|
122721
122289
|
(changeFileSet || (changeFileSet = [])).push(toFileId(path));
|
|
122722
122290
|
}
|
|
122723
122291
|
}
|
|
122724
|
-
var cacheResolutions = toProgramBuildInfoCacheResolutions();
|
|
122725
122292
|
var result = {
|
|
122726
122293
|
fileNames: fileNames,
|
|
122727
122294
|
fileInfos: fileInfos,
|
|
122728
|
-
options:
|
|
122295
|
+
options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsMultiFileEmitBuildInfo"),
|
|
122729
122296
|
fileIdsList: fileIdsList,
|
|
122730
122297
|
referencedMap: referencedMap,
|
|
122731
122298
|
exportedModulesMap: exportedModulesMap,
|
|
@@ -122734,7 +122301,6 @@ var ts;
|
|
|
122734
122301
|
changeFileSet: changeFileSet,
|
|
122735
122302
|
emitSignatures: emitSignatures,
|
|
122736
122303
|
latestChangedDtsFile: latestChangedDtsFile,
|
|
122737
|
-
cacheResolutions: cacheResolutions,
|
|
122738
122304
|
};
|
|
122739
122305
|
return result;
|
|
122740
122306
|
function relativeToBuildInfoEnsuringAbsolutePath(path) {
|
|
@@ -122743,7 +122309,7 @@ var ts;
|
|
|
122743
122309
|
function relativeToBuildInfo(path) {
|
|
122744
122310
|
return ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(buildInfoDirectory, path, getCanonicalFileName));
|
|
122745
122311
|
}
|
|
122746
|
-
function
|
|
122312
|
+
function toFileId(path) {
|
|
122747
122313
|
var fileId = fileNameToFileId.get(path);
|
|
122748
122314
|
if (fileId === undefined) {
|
|
122749
122315
|
fileNames.push(relativeToBuildInfo(path));
|
|
@@ -122751,12 +122317,6 @@ var ts;
|
|
|
122751
122317
|
}
|
|
122752
122318
|
return fileId;
|
|
122753
122319
|
}
|
|
122754
|
-
function toFileId(path) {
|
|
122755
|
-
return toFileAndAbsoluteFileId(path);
|
|
122756
|
-
}
|
|
122757
|
-
function toAbsoluteFileId(path) {
|
|
122758
|
-
return toFileAndAbsoluteFileId(ts.getNormalizedAbsolutePath(path, currentDirectory));
|
|
122759
|
-
}
|
|
122760
122320
|
function toFileIdListId(set) {
|
|
122761
122321
|
var fileIds = ts.arrayFrom(set.keys(), toFileId).sort(ts.compareValues);
|
|
122762
122322
|
var key = fileIds.join();
|
|
@@ -122769,238 +122329,54 @@ var ts;
|
|
|
122769
122329
|
}
|
|
122770
122330
|
/**
|
|
122771
122331
|
* @param optionKey key of CommandLineOption to use to determine if the option should be serialized in tsbuildinfo
|
|
122772
|
-
* @param affectsModuleResolution serialize options affecting module resolution
|
|
122773
122332
|
*/
|
|
122774
|
-
function
|
|
122333
|
+
function convertToProgramBuildInfoCompilerOptions(options, optionKey) {
|
|
122775
122334
|
var result;
|
|
122776
122335
|
var optionsNameMap = ts.getOptionsNameMap().optionsNameMap;
|
|
122777
122336
|
for (var _i = 0, _a = ts.getOwnKeys(options).sort(ts.compareStringsCaseSensitive); _i < _a.length; _i++) {
|
|
122778
122337
|
var name = _a[_i];
|
|
122779
122338
|
var optionInfo = optionsNameMap.get(name.toLowerCase());
|
|
122780
|
-
if (
|
|
122781
|
-
(result
|
|
122782
|
-
}
|
|
122783
|
-
else if (affectsModuleResolution && name === "pathsBasePath") {
|
|
122784
|
-
(result !== null && result !== void 0 ? result : (result = {})).pathsBasePath = relativeToBuildInfoEnsuringAbsolutePath(options.pathsBasePath);
|
|
122785
|
-
continue;
|
|
122339
|
+
if (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo[optionKey]) {
|
|
122340
|
+
(result || (result = {}))[name] = convertToReusableCompilerOptionValue(optionInfo, options[name], relativeToBuildInfoEnsuringAbsolutePath);
|
|
122786
122341
|
}
|
|
122787
122342
|
}
|
|
122788
122343
|
return result;
|
|
122789
122344
|
}
|
|
122790
|
-
|
|
122791
|
-
|
|
122792
|
-
|
|
122793
|
-
|
|
122794
|
-
|
|
122795
|
-
|
|
122796
|
-
|
|
122797
|
-
}
|
|
122798
|
-
else if (option.isFilePath) {
|
|
122799
|
-
return relativeToBuildInfoEnsuringAbsolutePath(value);
|
|
122345
|
+
}
|
|
122346
|
+
function convertToReusableCompilerOptionValue(option, value, relativeToBuildInfo) {
|
|
122347
|
+
if (option) {
|
|
122348
|
+
if (option.type === "list") {
|
|
122349
|
+
var values = value;
|
|
122350
|
+
if (option.element.isFilePath && values.length) {
|
|
122351
|
+
return values.map(relativeToBuildInfo);
|
|
122800
122352
|
}
|
|
122801
122353
|
}
|
|
122802
|
-
|
|
122803
|
-
|
|
122804
|
-
|
|
122805
|
-
return (array === null || array === void 0 ? void 0 : array.length) ? array.map(map) : undefined;
|
|
122354
|
+
else if (option.isFilePath) {
|
|
122355
|
+
return relativeToBuildInfo(value);
|
|
122356
|
+
}
|
|
122806
122357
|
}
|
|
122807
|
-
|
|
122808
|
-
|
|
122358
|
+
return value;
|
|
122359
|
+
}
|
|
122360
|
+
function convertToReusableDiagnostics(diagnostics, relativeToBuildInfo) {
|
|
122361
|
+
ts.Debug.assert(!!diagnostics.length);
|
|
122362
|
+
return diagnostics.map(function (diagnostic) {
|
|
122363
|
+
var result = convertToReusableDiagnosticRelatedInformation(diagnostic, relativeToBuildInfo);
|
|
122809
122364
|
result.reportsUnnecessary = diagnostic.reportsUnnecessary;
|
|
122810
122365
|
result.reportDeprecated = diagnostic.reportsDeprecated;
|
|
122811
122366
|
result.source = diagnostic.source;
|
|
122812
122367
|
result.skippedOn = diagnostic.skippedOn;
|
|
122813
122368
|
var relatedInformation = diagnostic.relatedInformation;
|
|
122814
|
-
result.relatedInformation = relatedInformation
|
|
122815
|
-
|
|
122816
|
-
|
|
122817
|
-
|
|
122818
|
-
|
|
122819
|
-
return __assign(__assign({}, diagnostic), { file: file ? relativeToBuildInfo(file.resolvedPath) : undefined });
|
|
122820
|
-
}
|
|
122821
|
-
function toProgramBuildInfoCacheResolutions() {
|
|
122822
|
-
var cacheResolutions = getCacheResolutions(state);
|
|
122823
|
-
var modules = toProgramBuildInfoResolutionCacheWithRedirects(cacheResolutions === null || cacheResolutions === void 0 ? void 0 : cacheResolutions.modules);
|
|
122824
|
-
var typeRefs = toProgramBuildInfoResolutionCacheWithRedirects(cacheResolutions === null || cacheResolutions === void 0 ? void 0 : cacheResolutions.typeRefs);
|
|
122825
|
-
var packageJsons = toProgramBuildInfoPackageJsons(cacheResolutions === null || cacheResolutions === void 0 ? void 0 : cacheResolutions.perDirPackageJsonMap);
|
|
122826
|
-
if (!resolutions)
|
|
122827
|
-
return;
|
|
122828
|
-
ts.Debug.assertIsDefined(names);
|
|
122829
|
-
ts.Debug.assertIsDefined(resolutionEntries);
|
|
122830
|
-
state.resuableCacheResolutions = {
|
|
122831
|
-
cache: {
|
|
122832
|
-
resolutions: resolutions.map(toProgramBuildInfoResolution),
|
|
122833
|
-
names: names,
|
|
122834
|
-
hash: toProgramBuildInfoHashes(),
|
|
122835
|
-
resolutionEntries: resolutionEntries,
|
|
122836
|
-
modules: modules,
|
|
122837
|
-
typeRefs: typeRefs,
|
|
122838
|
-
packageJsons: packageJsons,
|
|
122839
|
-
},
|
|
122840
|
-
getProgramBuildInfoFilePathDecoder: ts.memoize(function () { return getProgramBuildInfoFilePathDecoder(fileNames, buildInfoPath, currentDirectory, getCanonicalFileName); })
|
|
122841
|
-
};
|
|
122842
|
-
return state.resuableCacheResolutions.cache;
|
|
122843
|
-
}
|
|
122844
|
-
function toProgramBuildInfoPackageJsons(cache) {
|
|
122845
|
-
var result;
|
|
122846
|
-
cache === null || cache === void 0 ? void 0 : cache.forEach(function (packageJson, dirPath) {
|
|
122847
|
-
var packageJsonDirPath = ts.getDirectoryPath(ts.toPath(packageJson, currentDirectory, getCanonicalFileName));
|
|
122848
|
-
// Dont need to store package json found in same directory
|
|
122849
|
-
if (packageJsonDirPath !== dirPath) {
|
|
122850
|
-
(result !== null && result !== void 0 ? result : (result = [])).push([
|
|
122851
|
-
toFileId(dirPath),
|
|
122852
|
-
toAbsoluteFileId(packageJson),
|
|
122853
|
-
]);
|
|
122854
|
-
}
|
|
122855
|
-
});
|
|
122856
|
-
return result;
|
|
122857
|
-
}
|
|
122858
|
-
function toProgramBuildInfoResolutionCacheWithRedirects(cache) {
|
|
122859
|
-
if (!cache)
|
|
122860
|
-
return undefined;
|
|
122861
|
-
var ownMap = cache.getOwnMap();
|
|
122862
|
-
var own = toProgramBuildInfoResolutionCache(ownMap);
|
|
122863
|
-
var redirects;
|
|
122864
|
-
cache.redirectsKeyToCache.forEach(function (_a) {
|
|
122865
|
-
var map = _a.map, options = _a.options;
|
|
122866
|
-
if (map === ownMap)
|
|
122867
|
-
return;
|
|
122868
|
-
var redirectCache = toProgramBuildInfoResolutionCache(map);
|
|
122869
|
-
if (redirectCache) {
|
|
122870
|
-
(redirects !== null && redirects !== void 0 ? redirects : (redirects = [])).push({
|
|
122871
|
-
options: toProgramBuildInfoCompilerOptions(options, /*optionKey*/ undefined, /*affectsModuleResolution*/ true),
|
|
122872
|
-
cache: redirectCache
|
|
122873
|
-
});
|
|
122874
|
-
}
|
|
122875
|
-
});
|
|
122876
|
-
return !redirects ? own : { own: own, redirects: redirects };
|
|
122877
|
-
}
|
|
122878
|
-
function toProgramBuildInfoResolutionCache(cache) {
|
|
122879
|
-
var result;
|
|
122880
|
-
cache === null || cache === void 0 ? void 0 : cache.forEach(function (dirCache, dirPath) { return dirCache.size() ?
|
|
122881
|
-
(result !== null && result !== void 0 ? result : (result = [])).push([
|
|
122882
|
-
toFileId(dirPath),
|
|
122883
|
-
ts.arrayFrom(dirCache.entries()).map(toProgramBuildInfoResolutionEntryId)
|
|
122884
|
-
]) :
|
|
122885
|
-
undefined; });
|
|
122369
|
+
result.relatedInformation = relatedInformation ?
|
|
122370
|
+
relatedInformation.length ?
|
|
122371
|
+
relatedInformation.map(function (r) { return convertToReusableDiagnosticRelatedInformation(r, relativeToBuildInfo); }) :
|
|
122372
|
+
[] :
|
|
122373
|
+
undefined;
|
|
122886
122374
|
return result;
|
|
122887
|
-
}
|
|
122888
|
-
function toProgramBuildInfoResolutionEntryId(_a) {
|
|
122889
|
-
var name = _a[0], mode = _a[1], resolution = _a[2];
|
|
122890
|
-
var resolutionNameId = toProgramBuildInfoResolutionNameId(name);
|
|
122891
|
-
var resolutionId = toProgramBuildInfoResolutionId(resolution);
|
|
122892
|
-
var key = resolutionNameId + "," + mode + "," + resolutionId;
|
|
122893
|
-
var resolutionEntryId = resolutionEntryToResolutionEntryId === null || resolutionEntryToResolutionEntryId === void 0 ? void 0 : resolutionEntryToResolutionEntryId.get(key);
|
|
122894
|
-
if (resolutionEntryId === undefined) {
|
|
122895
|
-
(resolutionEntries || (resolutionEntries = [])).push(mode ? [resolutionNameId, resolutionId, mode] : [resolutionNameId, resolutionId]);
|
|
122896
|
-
(resolutionEntryToResolutionEntryId || (resolutionEntryToResolutionEntryId = new ts.Map())).set(key, resolutionEntryId = resolutionEntries.length);
|
|
122897
|
-
}
|
|
122898
|
-
return resolutionEntryId;
|
|
122899
|
-
}
|
|
122900
|
-
function toProgramBuildInfoResolutionNameId(name) {
|
|
122901
|
-
var resolutionNameId = resolutionNameToResolutionNameId === null || resolutionNameToResolutionNameId === void 0 ? void 0 : resolutionNameToResolutionNameId.get(name);
|
|
122902
|
-
if (resolutionNameId === undefined) {
|
|
122903
|
-
(names !== null && names !== void 0 ? names : (names = [])).push(name);
|
|
122904
|
-
(resolutionNameToResolutionNameId !== null && resolutionNameToResolutionNameId !== void 0 ? resolutionNameToResolutionNameId : (resolutionNameToResolutionNameId = new ts.Map())).set(name, resolutionNameId = names.length);
|
|
122905
|
-
}
|
|
122906
|
-
return resolutionNameId;
|
|
122907
|
-
}
|
|
122908
|
-
function toProgramBuildInfoResolutionId(resolution) {
|
|
122909
|
-
if (resolution.serializationIndex === undefined) {
|
|
122910
|
-
(resolutions !== null && resolutions !== void 0 ? resolutions : (resolutions = [])).push(resolution);
|
|
122911
|
-
resolution.serializationIndex = resolutions.length;
|
|
122912
|
-
}
|
|
122913
|
-
return resolution.serializationIndex;
|
|
122914
|
-
}
|
|
122915
|
-
function toProgramBuildInfoResolution(resolution) {
|
|
122916
|
-
resolution.serializationIndex = undefined;
|
|
122917
|
-
return {
|
|
122918
|
-
resolvedModule: toProgramBuildInfoResolved(resolution.resolvedModule),
|
|
122919
|
-
resolvedTypeReferenceDirective: toProgramBuildInfoResolved(resolution.resolvedTypeReferenceDirective),
|
|
122920
|
-
affectingLocations: toReadonlyArrayOrUndefined(resolution.affectingLocations, toAffectedFileId),
|
|
122921
|
-
resolutionDiagnostics: toReadonlyArrayOrUndefined(resolution.resolutionDiagnostics, toProgramBuildInfoResolutionDiagnostic),
|
|
122922
|
-
};
|
|
122923
|
-
}
|
|
122924
|
-
function toProgramBuildInfoHashes() {
|
|
122925
|
-
if (!affectedFilesHash)
|
|
122926
|
-
return undefined;
|
|
122927
|
-
var hashes = [];
|
|
122928
|
-
for (var _i = 0, _a = ts.arrayFrom(affectedFilesHash.keys()).sort(ts.compareValues); _i < _a.length; _i++) {
|
|
122929
|
-
var key = _a[_i];
|
|
122930
|
-
var value = affectedFilesHash.get(key);
|
|
122931
|
-
hashes.push(value ? [key, value] : key);
|
|
122932
|
-
}
|
|
122933
|
-
return hashes;
|
|
122934
|
-
}
|
|
122935
|
-
function toAffectedFileId(file) {
|
|
122936
|
-
var _a;
|
|
122937
|
-
var fileId = toAbsoluteFileId(file);
|
|
122938
|
-
if (!(affectedFilesHash === null || affectedFilesHash === void 0 ? void 0 : affectedFilesHash.has(fileId))) {
|
|
122939
|
-
// Store the file hash
|
|
122940
|
-
var packageJsonInfo = (_a = state.program.getModuleResolutionCache()) === null || _a === void 0 ? void 0 : _a.getPackageJsonInfo(file);
|
|
122941
|
-
var text = typeof packageJsonInfo === "object" ? packageJsonInfo.packageJsonText : undefined;
|
|
122942
|
-
(affectedFilesHash !== null && affectedFilesHash !== void 0 ? affectedFilesHash : (affectedFilesHash = new ts.Map())).set(fileId, text ? computeSignature(text, host) : undefined);
|
|
122943
|
-
}
|
|
122944
|
-
return fileId;
|
|
122945
|
-
}
|
|
122946
|
-
function toProgramBuildInfoResolved(resolved) {
|
|
122947
|
-
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;
|
|
122948
|
-
}
|
|
122949
|
-
function toProgramBuildInfoResolutionDiagnostic(d) {
|
|
122950
|
-
return {
|
|
122951
|
-
isImports: d.isImports || undefined,
|
|
122952
|
-
entry: d.entry || undefined,
|
|
122953
|
-
packagePath: toAbsoluteFileId(d.packagePath),
|
|
122954
|
-
};
|
|
122955
|
-
}
|
|
122956
|
-
}
|
|
122957
|
-
function getCacheResolutions(state) {
|
|
122958
|
-
var _a;
|
|
122959
|
-
if (state.cacheResolutions || !state.compilerOptions.cacheResolutions)
|
|
122960
|
-
return state.cacheResolutions;
|
|
122961
|
-
var modules;
|
|
122962
|
-
var typeRefs;
|
|
122963
|
-
var moduleNameToDirectoryMap = ts.createCacheWithRedirects(state.compilerOptions);
|
|
122964
|
-
var dirToPackageJsonScope = new ts.Map();
|
|
122965
|
-
var perDirPackageJsonMap;
|
|
122966
|
-
var getCanonicalFileName = ts.createGetCanonicalFileName(state.program.useCaseSensitiveFileNames());
|
|
122967
|
-
state.program.getSourceFiles().forEach(function (f) {
|
|
122968
|
-
var _a;
|
|
122969
|
-
modules = toPerDirectoryCache(state, getCanonicalFileName, modules, ts.getResolvedModuleOfResolution, f, f.resolvedModules, moduleNameToDirectoryMap);
|
|
122970
|
-
typeRefs = toPerDirectoryCache(state, getCanonicalFileName, typeRefs, ts.getResolvedTypeReferenceDirectiveOfResolution, f, f.resolvedTypeReferenceDirectiveNames);
|
|
122971
|
-
if ((_a = f.packageJsonScope) === null || _a === void 0 ? void 0 : _a.info) {
|
|
122972
|
-
var dirPath = ts.getDirectoryPath(f.resolvedPath);
|
|
122973
|
-
if (!(dirToPackageJsonScope === null || dirToPackageJsonScope === void 0 ? void 0 : dirToPackageJsonScope.has(dirPath))) {
|
|
122974
|
-
(perDirPackageJsonMap !== null && perDirPackageJsonMap !== void 0 ? perDirPackageJsonMap : (perDirPackageJsonMap = new ts.Map())).set(dirPath, ts.getPackageJsconLocationFromScope(f.packageJsonScope));
|
|
122975
|
-
ts.moduleNameToDirectorySet(dirToPackageJsonScope, dirPath, f.packageJsonScope, ts.getPackageJsconLocationFromScope, function (dir) { return ts.toPath(dir, state.program.getCurrentDirectory(), getCanonicalFileName); }, function (ancestorPath) { return perDirPackageJsonMap === null || perDirPackageJsonMap === void 0 ? void 0 : perDirPackageJsonMap.delete(ancestorPath); });
|
|
122976
|
-
}
|
|
122977
|
-
}
|
|
122978
122375
|
});
|
|
122979
|
-
var automaticTypeDirectiveNames = state.program.getAutomaticTypeDirectiveNames();
|
|
122980
|
-
if (automaticTypeDirectiveNames.length) {
|
|
122981
|
-
var currentDirectory = state.program.getCurrentDirectory();
|
|
122982
|
-
var containingPath = ts.toPath(state.program.getAutomaticTypeDirectiveContainingFile(), currentDirectory, getCanonicalFileName);
|
|
122983
|
-
typeRefs = toPerDirectoryCache(state, getCanonicalFileName, typeRefs, ts.getResolvedTypeReferenceDirectiveOfResolution, containingPath, state.program.getAutomaticTypeDirectiveResolutions());
|
|
122984
|
-
}
|
|
122985
|
-
return state.cacheResolutions = {
|
|
122986
|
-
modules: modules,
|
|
122987
|
-
typeRefs: typeRefs,
|
|
122988
|
-
moduleNameToDirectoryMap: moduleNameToDirectoryMap,
|
|
122989
|
-
dirToPackageJsonScope: dirToPackageJsonScope,
|
|
122990
|
-
perDirPackageJsonMap: perDirPackageJsonMap,
|
|
122991
|
-
packageJsonCache: (_a = state.program.getModuleResolutionCache()) === null || _a === void 0 ? void 0 : _a.getPackageJsonInfoCache().clone(),
|
|
122992
|
-
};
|
|
122993
122376
|
}
|
|
122994
|
-
function
|
|
122995
|
-
|
|
122996
|
-
|
|
122997
|
-
// If this is not resolved, dont put in per dir Cache
|
|
122998
|
-
return !((_a = getResolutionWithResolvedFileName(r)) === null || _a === void 0 ? void 0 : _a.resolvedFileName) ||
|
|
122999
|
-
// If there was already external module resolution that is same, set for child directory, dont set resolution for this directory
|
|
123000
|
-
(moduleNameToDirectoryMap &&
|
|
123001
|
-
!ts.isExternalModuleNameRelative(name) &&
|
|
123002
|
-
((_c = (_b = moduleNameToDirectoryMap.getMapOfCacheRedirects(redirectedReference)) === null || _b === void 0 ? void 0 : _b.get(ts.getModeAwareCacheKey(name, mode))) === null || _c === void 0 ? void 0 : _c.get(dirPath)));
|
|
123003
|
-
}, function (dir) { return ts.toPath(dir, state.program.getCurrentDirectory(), getCanonicalFileName); }, function (ancestorPath, name, mode, perDirResolutionCache) { var _a; return (_a = perDirResolutionCache === null || perDirResolutionCache === void 0 ? void 0 : perDirResolutionCache.get(ancestorPath)) === null || _a === void 0 ? void 0 : _a.delete(name, mode); });
|
|
122377
|
+
function convertToReusableDiagnosticRelatedInformation(diagnostic, relativeToBuildInfo) {
|
|
122378
|
+
var file = diagnostic.file;
|
|
122379
|
+
return __assign(__assign({}, diagnostic), { file: file ? relativeToBuildInfo(file.resolvedPath) : undefined });
|
|
123004
122380
|
}
|
|
123005
122381
|
var BuilderProgramKind;
|
|
123006
122382
|
(function (BuilderProgramKind) {
|
|
@@ -123024,7 +122400,7 @@ var ts;
|
|
|
123024
122400
|
rootNames: newProgramOrRootNames,
|
|
123025
122401
|
options: hostOrOptions,
|
|
123026
122402
|
host: oldProgramOrHost,
|
|
123027
|
-
oldProgram: oldProgram
|
|
122403
|
+
oldProgram: oldProgram && oldProgram.getProgramOrUndefined(),
|
|
123028
122404
|
configFileParsingDiagnostics: configFileParsingDiagnostics,
|
|
123029
122405
|
projectReferences: projectReferences
|
|
123030
122406
|
});
|
|
@@ -123042,8 +122418,8 @@ var ts;
|
|
|
123042
122418
|
function getTextHandlingSourceMapForSignature(text, data) {
|
|
123043
122419
|
return (data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text;
|
|
123044
122420
|
}
|
|
123045
|
-
function computeSignatureWithDiagnostics(sourceFile, text,
|
|
123046
|
-
var _a
|
|
122421
|
+
function computeSignatureWithDiagnostics(sourceFile, text, computeHash, getCanonicalFileName, data) {
|
|
122422
|
+
var _a;
|
|
123047
122423
|
text = getTextHandlingSourceMapForSignature(text, data);
|
|
123048
122424
|
var sourceFileDirectory;
|
|
123049
122425
|
if ((_a = data === null || data === void 0 ? void 0 : data.diagnostics) === null || _a === void 0 ? void 0 : _a.length) {
|
|
@@ -123051,7 +122427,7 @@ var ts;
|
|
|
123051
122427
|
return "" + locationInfo(diagnostic) + ts.DiagnosticCategory[diagnostic.category] + diagnostic.code + ": " + flattenDiagnosticMessageText(diagnostic.messageText);
|
|
123052
122428
|
}).join("\n");
|
|
123053
122429
|
}
|
|
123054
|
-
return (
|
|
122430
|
+
return (computeHash !== null && computeHash !== void 0 ? computeHash : ts.generateDjb2Hash)(text);
|
|
123055
122431
|
function flattenDiagnosticMessageText(diagnostic) {
|
|
123056
122432
|
return ts.isString(diagnostic) ?
|
|
123057
122433
|
diagnostic :
|
|
@@ -123070,9 +122446,8 @@ var ts;
|
|
|
123070
122446
|
}
|
|
123071
122447
|
}
|
|
123072
122448
|
ts.computeSignatureWithDiagnostics = computeSignatureWithDiagnostics;
|
|
123073
|
-
function computeSignature(text,
|
|
123074
|
-
|
|
123075
|
-
return ((_a = host.createHash) !== null && _a !== void 0 ? _a : ts.generateDjb2Hash)(getTextHandlingSourceMapForSignature(text, data));
|
|
122449
|
+
function computeSignature(text, computeHash, data) {
|
|
122450
|
+
return (computeHash !== null && computeHash !== void 0 ? computeHash : ts.generateDjb2Hash)(getTextHandlingSourceMapForSignature(text, data));
|
|
123076
122451
|
}
|
|
123077
122452
|
ts.computeSignature = computeSignature;
|
|
123078
122453
|
function createBuilderProgram(kind, _a) {
|
|
@@ -123084,8 +122459,16 @@ var ts;
|
|
|
123084
122459
|
oldState = undefined;
|
|
123085
122460
|
return oldProgram;
|
|
123086
122461
|
}
|
|
123087
|
-
|
|
123088
|
-
|
|
122462
|
+
/**
|
|
122463
|
+
* Create the canonical file name for identity
|
|
122464
|
+
*/
|
|
122465
|
+
var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
|
|
122466
|
+
/**
|
|
122467
|
+
* Computing hash to for signature verification
|
|
122468
|
+
*/
|
|
122469
|
+
var computeHash = ts.maybeBind(host, host.createHash);
|
|
122470
|
+
var state = createBuilderProgramState(newProgram, getCanonicalFileName, oldState, host.disableUseFileVersionAsSignature);
|
|
122471
|
+
newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName); };
|
|
123089
122472
|
// To ensure that we arent storing any references to old program or new program without state
|
|
123090
122473
|
newProgram = undefined; // TODO: GH#18217
|
|
123091
122474
|
oldProgram = undefined;
|
|
@@ -123100,7 +122483,6 @@ var ts;
|
|
|
123100
122483
|
builderProgram.getSemanticDiagnostics = getSemanticDiagnostics;
|
|
123101
122484
|
builderProgram.emit = emit;
|
|
123102
122485
|
builderProgram.releaseProgram = function () { return releaseCache(state); };
|
|
123103
|
-
builderProgram.getProgramOrOldBuildInfoProgramUndefined = createGetProgramOrOldBuildInfoProgramUndefined(state);
|
|
123104
122486
|
if (kind === BuilderProgramKind.SemanticDiagnosticsBuilderProgram) {
|
|
123105
122487
|
builderProgram.getSemanticDiagnosticsOfNextAffectedFile = getSemanticDiagnosticsOfNextAffectedFile;
|
|
123106
122488
|
}
|
|
@@ -123127,7 +122509,7 @@ var ts;
|
|
|
123127
122509
|
* in that order would be used to write the files
|
|
123128
122510
|
*/
|
|
123129
122511
|
function emitNextAffectedFile(writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) {
|
|
123130
|
-
var affected = getNextAffectedFile(state, cancellationToken, host);
|
|
122512
|
+
var affected = getNextAffectedFile(state, cancellationToken, computeHash, getCanonicalFileName, host);
|
|
123131
122513
|
var emitKind = 1 /* Full */;
|
|
123132
122514
|
var isPendingEmitFile = false;
|
|
123133
122515
|
if (!affected) {
|
|
@@ -123173,7 +122555,7 @@ var ts;
|
|
|
123173
122555
|
var file = sourceFiles[0];
|
|
123174
122556
|
var info = state.fileInfos.get(file.resolvedPath);
|
|
123175
122557
|
if (info.signature === file.version) {
|
|
123176
|
-
var signature = computeSignatureWithDiagnostics(file, text,
|
|
122558
|
+
var signature = computeSignatureWithDiagnostics(file, text, computeHash, getCanonicalFileName, data);
|
|
123177
122559
|
// 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
|
|
123178
122560
|
if (!((_a = data === null || data === void 0 ? void 0 : data.diagnostics) === null || _a === void 0 ? void 0 : _a.length))
|
|
123179
122561
|
emitSignature = signature;
|
|
@@ -123203,7 +122585,7 @@ var ts;
|
|
|
123203
122585
|
if (state.compilerOptions.composite) {
|
|
123204
122586
|
var filePath = sourceFiles[0].resolvedPath;
|
|
123205
122587
|
var oldSignature = (_f = state.emitSignatures) === null || _f === void 0 ? void 0 : _f.get(filePath);
|
|
123206
|
-
emitSignature !== null && emitSignature !== void 0 ? emitSignature : (emitSignature = computeSignature(text,
|
|
122588
|
+
emitSignature !== null && emitSignature !== void 0 ? emitSignature : (emitSignature = computeSignature(text, computeHash, data));
|
|
123207
122589
|
// Dont write dts files if they didn't change
|
|
123208
122590
|
if (emitSignature === oldSignature)
|
|
123209
122591
|
return;
|
|
@@ -123213,7 +122595,7 @@ var ts;
|
|
|
123213
122595
|
}
|
|
123214
122596
|
}
|
|
123215
122597
|
else if (state.compilerOptions.composite) {
|
|
123216
|
-
var newSignature = computeSignature(text,
|
|
122598
|
+
var newSignature = computeSignature(text, computeHash, data);
|
|
123217
122599
|
// Dont write dts files if they didn't change
|
|
123218
122600
|
if (newSignature === state.outSignature)
|
|
123219
122601
|
return;
|
|
@@ -123295,7 +122677,7 @@ var ts;
|
|
|
123295
122677
|
*/
|
|
123296
122678
|
function getSemanticDiagnosticsOfNextAffectedFile(cancellationToken, ignoreSourceFile) {
|
|
123297
122679
|
while (true) {
|
|
123298
|
-
var affected = getNextAffectedFile(state, cancellationToken, host);
|
|
122680
|
+
var affected = getNextAffectedFile(state, cancellationToken, computeHash, getCanonicalFileName, host);
|
|
123299
122681
|
if (!affected) {
|
|
123300
122682
|
// Done
|
|
123301
122683
|
return undefined;
|
|
@@ -123375,32 +122757,12 @@ var ts;
|
|
|
123375
122757
|
{ version: fileInfo.version, signature: fileInfo.signature === false ? undefined : fileInfo.version, affectsGlobalScope: fileInfo.affectsGlobalScope, impliedFormat: fileInfo.impliedFormat };
|
|
123376
122758
|
}
|
|
123377
122759
|
ts.toBuilderStateFileInfo = toBuilderStateFileInfo;
|
|
123378
|
-
function
|
|
123379
|
-
var
|
|
123380
|
-
var
|
|
123381
|
-
var
|
|
123382
|
-
return { toAbsolutePath: toAbsolutePath, toFilePath: toFilePath, toFileAbsolutePath: toFileAbsolutePath, currentDirectory: currentDirectory, getCanonicalFileName: getCanonicalFileName };
|
|
123383
|
-
function toPath(path) {
|
|
123384
|
-
return ts.toPath(path, buildInfoDirectory, getCanonicalFileName);
|
|
123385
|
-
}
|
|
123386
|
-
function toAbsolutePath(path) {
|
|
123387
|
-
return ts.getNormalizedAbsolutePath(path, buildInfoDirectory);
|
|
123388
|
-
}
|
|
123389
|
-
function toFilePath(fileId) {
|
|
123390
|
-
var _a;
|
|
123391
|
-
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]));
|
|
123392
|
-
}
|
|
123393
|
-
function toFileAbsolutePath(fileId) {
|
|
123394
|
-
var _a;
|
|
123395
|
-
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]));
|
|
123396
|
-
}
|
|
123397
|
-
}
|
|
123398
|
-
ts.getProgramBuildInfoFilePathDecoder = getProgramBuildInfoFilePathDecoder;
|
|
123399
|
-
function createBuilderProgramUsingProgramBuildInfo(program, buildInfoPath, host, configFilePath) {
|
|
123400
|
-
var _a, _b, _c;
|
|
123401
|
-
var buildInfoFilePathDecoder = getProgramBuildInfoFilePathDecoder(program.fileNames, buildInfoPath, host.getCurrentDirectory(), ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames()));
|
|
123402
|
-
var toFilePath = buildInfoFilePathDecoder.toFilePath, toAbsolutePath = buildInfoFilePathDecoder.toAbsolutePath;
|
|
122760
|
+
function createBuilderProgramUsingProgramBuildInfo(program, buildInfoPath, host) {
|
|
122761
|
+
var _a, _b, _c, _d;
|
|
122762
|
+
var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
|
|
122763
|
+
var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
|
|
123403
122764
|
var state;
|
|
122765
|
+
var filePaths;
|
|
123404
122766
|
var filePathsSetList;
|
|
123405
122767
|
var latestChangedDtsFile = program.latestChangedDtsFile ? toAbsolutePath(program.latestChangedDtsFile) : undefined;
|
|
123406
122768
|
if (isProgramBundleEmitBuildInfo(program)) {
|
|
@@ -123409,13 +122771,13 @@ var ts;
|
|
|
123409
122771
|
compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
|
|
123410
122772
|
latestChangedDtsFile: latestChangedDtsFile,
|
|
123411
122773
|
outSignature: program.outSignature,
|
|
123412
|
-
resuableCacheResolutions: toResuableCacheResolutions(),
|
|
123413
122774
|
};
|
|
123414
122775
|
}
|
|
123415
122776
|
else {
|
|
123416
|
-
|
|
122777
|
+
filePaths = (_a = program.fileNames) === null || _a === void 0 ? void 0 : _a.map(toPath);
|
|
122778
|
+
filePathsSetList = (_b = program.fileIdsList) === null || _b === void 0 ? void 0 : _b.map(function (fileIds) { return new ts.Set(fileIds.map(toFilePath)); });
|
|
123417
122779
|
var fileInfos_2 = new ts.Map();
|
|
123418
|
-
var emitSignatures_1 = ((
|
|
122780
|
+
var emitSignatures_1 = ((_c = program.options) === null || _c === void 0 ? void 0 : _c.composite) && !ts.outFile(program.options) ? new ts.Map() : undefined;
|
|
123419
122781
|
program.fileInfos.forEach(function (fileInfo, index) {
|
|
123420
122782
|
var path = toFilePath(index + 1);
|
|
123421
122783
|
var stateFileInfo = toBuilderStateFileInfo(fileInfo);
|
|
@@ -123423,7 +122785,7 @@ var ts;
|
|
|
123423
122785
|
if (emitSignatures_1 && stateFileInfo.signature)
|
|
123424
122786
|
emitSignatures_1.set(path, stateFileInfo.signature);
|
|
123425
122787
|
});
|
|
123426
|
-
(
|
|
122788
|
+
(_d = program.emitSignatures) === null || _d === void 0 ? void 0 : _d.forEach(function (value) {
|
|
123427
122789
|
if (ts.isNumber(value))
|
|
123428
122790
|
emitSignatures_1.delete(toFilePath(value));
|
|
123429
122791
|
else
|
|
@@ -123442,17 +122804,14 @@ var ts;
|
|
|
123442
122804
|
changedFilesSet: new ts.Set(ts.map(program.changeFileSet, toFilePath)),
|
|
123443
122805
|
latestChangedDtsFile: latestChangedDtsFile,
|
|
123444
122806
|
emitSignatures: (emitSignatures_1 === null || emitSignatures_1 === void 0 ? void 0 : emitSignatures_1.size) ? emitSignatures_1 : undefined,
|
|
123445
|
-
resuableCacheResolutions: toResuableCacheResolutions(),
|
|
123446
122807
|
};
|
|
123447
122808
|
}
|
|
123448
|
-
state.compilerOptions.configFilePath = configFilePath;
|
|
123449
122809
|
return {
|
|
123450
122810
|
getState: function () { return state; },
|
|
123451
122811
|
saveEmitState: ts.noop,
|
|
123452
122812
|
restoreEmitState: ts.noop,
|
|
123453
122813
|
getProgram: ts.notImplemented,
|
|
123454
122814
|
getProgramOrUndefined: ts.returnUndefined,
|
|
123455
|
-
getProgramOrOldBuildInfoProgramUndefined: createGetProgramOrOldBuildInfoProgramUndefined(state),
|
|
123456
122815
|
releaseProgram: ts.noop,
|
|
123457
122816
|
getCompilerOptions: function () { return state.compilerOptions; },
|
|
123458
122817
|
getSourceFile: ts.notImplemented,
|
|
@@ -123472,6 +122831,15 @@ var ts;
|
|
|
123472
122831
|
close: ts.noop,
|
|
123473
122832
|
hasChangedEmitSignature: ts.returnFalse,
|
|
123474
122833
|
};
|
|
122834
|
+
function toPath(path) {
|
|
122835
|
+
return ts.toPath(path, buildInfoDirectory, getCanonicalFileName);
|
|
122836
|
+
}
|
|
122837
|
+
function toAbsolutePath(path) {
|
|
122838
|
+
return ts.getNormalizedAbsolutePath(path, buildInfoDirectory);
|
|
122839
|
+
}
|
|
122840
|
+
function toFilePath(fileId) {
|
|
122841
|
+
return filePaths[fileId - 1];
|
|
122842
|
+
}
|
|
123475
122843
|
function toFilePathsSet(fileIdsListId) {
|
|
123476
122844
|
return filePathsSetList[fileIdsListId - 1];
|
|
123477
122845
|
}
|
|
@@ -123486,249 +122854,8 @@ var ts;
|
|
|
123486
122854
|
});
|
|
123487
122855
|
return map;
|
|
123488
122856
|
}
|
|
123489
|
-
function toResuableCacheResolutions() {
|
|
123490
|
-
return program.cacheResolutions && {
|
|
123491
|
-
cache: program.cacheResolutions,
|
|
123492
|
-
getProgramBuildInfoFilePathDecoder: function () { return buildInfoFilePathDecoder; },
|
|
123493
|
-
};
|
|
123494
|
-
}
|
|
123495
122857
|
}
|
|
123496
122858
|
ts.createBuilderProgramUsingProgramBuildInfo = createBuilderProgramUsingProgramBuildInfo;
|
|
123497
|
-
function createGetProgramOrOldBuildInfoProgramUndefined(state) {
|
|
123498
|
-
return function () {
|
|
123499
|
-
var _a;
|
|
123500
|
-
return (_a = state.program) !== null && _a !== void 0 ? _a : (state.cacheResolutions || state.resuableCacheResolutions ?
|
|
123501
|
-
(function (host) { return createOldBuildInfoProgram(host, state.compilerOptions, state.cacheResolutions,
|
|
123502
|
-
// Prefer cached resolutions over serialized format
|
|
123503
|
-
!state.cacheResolutions ? state.resuableCacheResolutions : undefined); }) :
|
|
123504
|
-
undefined);
|
|
123505
|
-
};
|
|
123506
|
-
}
|
|
123507
|
-
function createOldBuildInfoProgram(host, compilerOptions, cacheResolutions, resuableCacheResolutions) {
|
|
123508
|
-
if (!cacheResolutions && !resuableCacheResolutions)
|
|
123509
|
-
return undefined;
|
|
123510
|
-
var fileExistsMap = new ts.Map();
|
|
123511
|
-
var packageJsonInfoMap = new ts.Map();
|
|
123512
|
-
var affectingLoationsSameMap = new ts.Map();
|
|
123513
|
-
var decodedResolvedModules = ts.createCacheWithRedirects(compilerOptions);
|
|
123514
|
-
var decodedResolvedTypeRefs = ts.createCacheWithRedirects(compilerOptions);
|
|
123515
|
-
var decodedModuleNameToDirectoryMap = ts.createCacheWithRedirects(compilerOptions);
|
|
123516
|
-
var decodedPackageJsonMap;
|
|
123517
|
-
var packageJsonScopes;
|
|
123518
|
-
var decodedHashes;
|
|
123519
|
-
var resolutions;
|
|
123520
|
-
var originalPathOrResolvedFileNames;
|
|
123521
|
-
var resolutionEntries;
|
|
123522
|
-
return {
|
|
123523
|
-
getCompilerOptions: function () { return compilerOptions; },
|
|
123524
|
-
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); },
|
|
123525
|
-
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,
|
|
123526
|
-
/*moduleNameToDirectoryMap*/ undefined,
|
|
123527
|
-
/*decodedModuleNameToDirectoryMap*/ undefined); },
|
|
123528
|
-
getPackageJsonScope: getPackageJsonScope,
|
|
123529
|
-
};
|
|
123530
|
-
function fileExists(fileName) {
|
|
123531
|
-
var result = fileExistsMap.get(fileName);
|
|
123532
|
-
if (result === undefined)
|
|
123533
|
-
fileExistsMap.set(fileName, result = host.fileExists(fileName));
|
|
123534
|
-
return result;
|
|
123535
|
-
}
|
|
123536
|
-
function getPackageJsonInfo(fileName) {
|
|
123537
|
-
var result = packageJsonInfoMap.get(fileName);
|
|
123538
|
-
if (result === undefined)
|
|
123539
|
-
packageJsonInfoMap.set(fileName, result = host.getPackageJsonInfo(fileName) || false);
|
|
123540
|
-
return result || undefined;
|
|
123541
|
-
}
|
|
123542
|
-
function affectingLocationsSame(fileName, expected) {
|
|
123543
|
-
var _a;
|
|
123544
|
-
var result = affectingLoationsSameMap.get(fileName);
|
|
123545
|
-
if (result !== undefined)
|
|
123546
|
-
return result;
|
|
123547
|
-
var packageJsonInfo = getPackageJsonInfo(fileName);
|
|
123548
|
-
var currentText = typeof packageJsonInfo === "object" ? packageJsonInfo.packageJsonText : undefined;
|
|
123549
|
-
if (ts.isString(expected)) {
|
|
123550
|
-
result = !!currentText && ((_a = host.createHash) !== null && _a !== void 0 ? _a : ts.generateDjb2Hash)(currentText) === expected;
|
|
123551
|
-
}
|
|
123552
|
-
else {
|
|
123553
|
-
var expectedText = typeof expected === "object" ? expected.packageJsonText : undefined;
|
|
123554
|
-
result = currentText === expectedText;
|
|
123555
|
-
}
|
|
123556
|
-
affectingLoationsSameMap.set(fileName, result);
|
|
123557
|
-
return result;
|
|
123558
|
-
}
|
|
123559
|
-
function getPackageJsonScope(dirPath) {
|
|
123560
|
-
var _a;
|
|
123561
|
-
var fromCache = (_a = cacheResolutions === null || cacheResolutions === void 0 ? void 0 : cacheResolutions.dirToPackageJsonScope) === null || _a === void 0 ? void 0 : _a.get(dirPath);
|
|
123562
|
-
if (fromCache) {
|
|
123563
|
-
var packageJson = ts.getPackageJsconLocationFromScope(fromCache);
|
|
123564
|
-
var result = packageJsonScopes === null || packageJsonScopes === void 0 ? void 0 : packageJsonScopes.get(packageJson);
|
|
123565
|
-
if (result === undefined) {
|
|
123566
|
-
(packageJsonScopes !== null && packageJsonScopes !== void 0 ? packageJsonScopes : (packageJsonScopes = new ts.Map())).set(packageJson, result = affectingLocationsSame(packageJson, fromCache.info) ?
|
|
123567
|
-
fromCache :
|
|
123568
|
-
fileExists(packageJson) ?
|
|
123569
|
-
{ info: getPackageJsonInfo(packageJson), affectingLocations: [packageJson] } :
|
|
123570
|
-
false);
|
|
123571
|
-
}
|
|
123572
|
-
return result || undefined;
|
|
123573
|
-
}
|
|
123574
|
-
if (!(resuableCacheResolutions === null || resuableCacheResolutions === void 0 ? void 0 : resuableCacheResolutions.cache.packageJsons))
|
|
123575
|
-
return;
|
|
123576
|
-
if (!decodedPackageJsonMap) {
|
|
123577
|
-
decodedPackageJsonMap = new ts.Map();
|
|
123578
|
-
var filePathDecoder_1 = resuableCacheResolutions.getProgramBuildInfoFilePathDecoder();
|
|
123579
|
-
for (var _i = 0, _b = resuableCacheResolutions.cache.packageJsons; _i < _b.length; _i++) {
|
|
123580
|
-
var dirIdOrDirAndPackageJson = _b[_i];
|
|
123581
|
-
var dirPath_1 = filePathDecoder_1.toFilePath(dirIdOrDirAndPackageJson[0]);
|
|
123582
|
-
var packageJson = filePathDecoder_1.toFileAbsolutePath(dirIdOrDirAndPackageJson[1]);
|
|
123583
|
-
ts.moduleNameToDirectorySet(decodedPackageJsonMap, dirPath_1, packageJson, ts.identity, function (fileName) { return ts.toPath(fileName, filePathDecoder_1.currentDirectory, filePathDecoder_1.getCanonicalFileName); }, ts.noop);
|
|
123584
|
-
}
|
|
123585
|
-
}
|
|
123586
|
-
return toPackageJsonScope(decodedPackageJsonMap.get(dirPath));
|
|
123587
|
-
}
|
|
123588
|
-
function toPackageJsonScope(file) {
|
|
123589
|
-
if (!file)
|
|
123590
|
-
return undefined;
|
|
123591
|
-
var result = packageJsonScopes === null || packageJsonScopes === void 0 ? void 0 : packageJsonScopes.get(file);
|
|
123592
|
-
if (result !== undefined)
|
|
123593
|
-
return result || undefined;
|
|
123594
|
-
(packageJsonScopes !== null && packageJsonScopes !== void 0 ? packageJsonScopes : (packageJsonScopes = new ts.Map()));
|
|
123595
|
-
if (fileExists(file)) {
|
|
123596
|
-
result = {
|
|
123597
|
-
info: getPackageJsonInfo(file),
|
|
123598
|
-
affectingLocations: [file]
|
|
123599
|
-
};
|
|
123600
|
-
}
|
|
123601
|
-
packageJsonScopes.set(file, result || false);
|
|
123602
|
-
return result;
|
|
123603
|
-
}
|
|
123604
|
-
function getResolvedFromCache(cache, reusableCache, decodedReusableCache, dirPath, name, mode, redirectedReference, moduleNameToDirectoryMap, decodedModuleNameToDirectoryMap) {
|
|
123605
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
123606
|
-
// If we are using the cache, directly get from there
|
|
123607
|
-
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)) ||
|
|
123608
|
-
((_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));
|
|
123609
|
-
if (fromCache) {
|
|
123610
|
-
return fileExists(((_e = fromCache.resolvedModule) === null || _e === void 0 ? void 0 : _e.resolvedFileName) ||
|
|
123611
|
-
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;
|
|
123612
|
-
}
|
|
123613
|
-
if (!reusableCache)
|
|
123614
|
-
return undefined;
|
|
123615
|
-
// Decode so we have maps for directories
|
|
123616
|
-
if (!decodedReusableCache.getOwnMap().size && !decodedReusableCache.redirectsKeyToCache.size) {
|
|
123617
|
-
if (ts.isArray(reusableCache)) {
|
|
123618
|
-
setBuildInfoResolutionEntries(decodedReusableCache, compilerOptions, /*optionsKey*/ undefined, reusableCache, decodedModuleNameToDirectoryMap);
|
|
123619
|
-
}
|
|
123620
|
-
else {
|
|
123621
|
-
if (reusableCache.own)
|
|
123622
|
-
setBuildInfoResolutionEntries(decodedReusableCache, compilerOptions, /*optionsKey*/ undefined, reusableCache.own, decodedModuleNameToDirectoryMap);
|
|
123623
|
-
reusableCache.redirects.forEach(function (_a) {
|
|
123624
|
-
var options = _a.options, cache = _a.cache;
|
|
123625
|
-
var compilerOptions = options ? ts.convertToOptionsWithAbsolutePaths(options, resuableCacheResolutions.getProgramBuildInfoFilePathDecoder().toAbsolutePath) : {};
|
|
123626
|
-
setBuildInfoResolutionEntries(decodedReusableCache, compilerOptions, ts.getRedirectsCacheKey(compilerOptions), cache, decodedModuleNameToDirectoryMap);
|
|
123627
|
-
});
|
|
123628
|
-
}
|
|
123629
|
-
// Ensure redirected reference verifies options before using redirects map
|
|
123630
|
-
decodedReusableCache.clearRedirectsMap();
|
|
123631
|
-
decodedModuleNameToDirectoryMap === null || decodedModuleNameToDirectoryMap === void 0 ? void 0 : decodedModuleNameToDirectoryMap.clearRedirectsMap();
|
|
123632
|
-
}
|
|
123633
|
-
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)) ||
|
|
123634
|
-
((_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));
|
|
123635
|
-
return resolutionId ? toResolution(resolutionId) : undefined;
|
|
123636
|
-
}
|
|
123637
|
-
function setBuildInfoResolutionEntries(decodedReusableCache, options, optionsKey, reusableCache, decodedModuleNameToDirectoryMap) {
|
|
123638
|
-
var map = decodedReusableCache.createMapForCompilerOptions(options, optionsKey);
|
|
123639
|
-
reusableCache.forEach(function (_a) {
|
|
123640
|
-
var dirId = _a[0], entryId = _a[1];
|
|
123641
|
-
var dirPath = resuableCacheResolutions.getProgramBuildInfoFilePathDecoder().toFilePath(dirId);
|
|
123642
|
-
map.set(dirPath, toModeAwareCache(entryId, dirPath, options, optionsKey, decodedModuleNameToDirectoryMap));
|
|
123643
|
-
});
|
|
123644
|
-
}
|
|
123645
|
-
function toModeAwareCache(entries, dirPath, options, optionsKey, decodedModuleNameToDirectoryMap) {
|
|
123646
|
-
var modeAwareCache = ts.createModeAwareCache();
|
|
123647
|
-
entries.forEach(function (entryId) {
|
|
123648
|
-
var _a = toResolutionEntry(entryId), name = _a[0], resolutionId = _a[1], mode = _a[2];
|
|
123649
|
-
modeAwareCache.set(name, mode, resolutionId);
|
|
123650
|
-
if (!decodedModuleNameToDirectoryMap || ts.isExternalModuleNameRelative(name))
|
|
123651
|
-
return;
|
|
123652
|
-
var mapForOptions = decodedModuleNameToDirectoryMap.createMapForCompilerOptions(options, optionsKey);
|
|
123653
|
-
var key = ts.getModeAwareCacheKey(name, mode);
|
|
123654
|
-
var moduleNameMap = mapForOptions.get(key);
|
|
123655
|
-
;
|
|
123656
|
-
if (!moduleNameMap)
|
|
123657
|
-
mapForOptions.set(key, moduleNameMap = new ts.Map());
|
|
123658
|
-
ts.moduleNameToDirectorySet(moduleNameMap, dirPath, resolutionId, toOriginalPathOrResolvedFileName, function (fileName) { return ts.toPath(fileName, resuableCacheResolutions.getProgramBuildInfoFilePathDecoder().currentDirectory, resuableCacheResolutions.getProgramBuildInfoFilePathDecoder().getCanonicalFileName); }, ts.noop);
|
|
123659
|
-
});
|
|
123660
|
-
return modeAwareCache;
|
|
123661
|
-
}
|
|
123662
|
-
function toResolutionEntry(entryId) {
|
|
123663
|
-
var existing = resolutionEntries === null || resolutionEntries === void 0 ? void 0 : resolutionEntries[entryId - 1];
|
|
123664
|
-
if (existing)
|
|
123665
|
-
return existing;
|
|
123666
|
-
resolutionEntries !== null && resolutionEntries !== void 0 ? resolutionEntries : (resolutionEntries = new Array(resuableCacheResolutions.cache.resolutionEntries.length));
|
|
123667
|
-
var _a = resuableCacheResolutions.cache.resolutionEntries[entryId - 1], nameId = _a[0], resolutionId = _a[1], mode = _a[2];
|
|
123668
|
-
return resolutionEntries[entryId - 1] = [
|
|
123669
|
-
toName(nameId),
|
|
123670
|
-
resolutionId,
|
|
123671
|
-
mode
|
|
123672
|
-
];
|
|
123673
|
-
}
|
|
123674
|
-
function toName(nameId) {
|
|
123675
|
-
return resuableCacheResolutions.cache.names[nameId - 1];
|
|
123676
|
-
}
|
|
123677
|
-
function toOriginalPathOrResolvedFileName(resolutionId) {
|
|
123678
|
-
var _a;
|
|
123679
|
-
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 ||
|
|
123680
|
-
resuableCacheResolutions.cache.resolutions[resolutionId - 1].resolvedModule.resolvedFileName));
|
|
123681
|
-
}
|
|
123682
|
-
function toAffectingFileLocation(fileId) {
|
|
123683
|
-
if (!decodedHashes && resuableCacheResolutions.cache.hash) {
|
|
123684
|
-
decodedHashes = ts.arrayToMap(resuableCacheResolutions.cache.hash, function (hash) { return ts.isArray(hash) ? hash[0] : hash; }, function (hash) { return ts.isArray(hash) ? hash[1] : undefined; });
|
|
123685
|
-
}
|
|
123686
|
-
var hash = decodedHashes === null || decodedHashes === void 0 ? void 0 : decodedHashes.get(fileId);
|
|
123687
|
-
var file = resuableCacheResolutions.getProgramBuildInfoFilePathDecoder().toFileAbsolutePath(fileId);
|
|
123688
|
-
return affectingLocationsSame(file, hash) ? file : undefined;
|
|
123689
|
-
}
|
|
123690
|
-
function toResolution(resolutionId) {
|
|
123691
|
-
var _a, _b;
|
|
123692
|
-
var existing = resolutions === null || resolutions === void 0 ? void 0 : resolutions[resolutionId - 1];
|
|
123693
|
-
if (existing !== undefined)
|
|
123694
|
-
return existing || undefined;
|
|
123695
|
-
resolutions !== null && resolutions !== void 0 ? resolutions : (resolutions = new Array(resuableCacheResolutions.cache.resolutions.length));
|
|
123696
|
-
var resolution = resuableCacheResolutions.cache.resolutions[resolutionId - 1];
|
|
123697
|
-
var resolvedFileName = resuableCacheResolutions.getProgramBuildInfoFilePathDecoder().toFileAbsolutePath(((_a = resolution.resolvedModule) === null || _a === void 0 ? void 0 : _a.resolvedFileName) || resolution.resolvedTypeReferenceDirective.resolvedFileName);
|
|
123698
|
-
var affectingLocations;
|
|
123699
|
-
if (fileExists(resolvedFileName) && ts.every(resolution.affectingLocations, function (fileId) {
|
|
123700
|
-
var file = toAffectingFileLocation(fileId);
|
|
123701
|
-
if (file)
|
|
123702
|
-
(affectingLocations !== null && affectingLocations !== void 0 ? affectingLocations : (affectingLocations = [])).push(file);
|
|
123703
|
-
return !!file;
|
|
123704
|
-
})) {
|
|
123705
|
-
// Type Ref doesnt need extension
|
|
123706
|
-
var extenstion = resolution.resolvedModule ? ts.extensionFromPath(resolvedFileName) : undefined;
|
|
123707
|
-
return resolutions[resolutionId - 1] = {
|
|
123708
|
-
resolvedModule: toResolved(resolution.resolvedModule, resolvedFileName, extenstion),
|
|
123709
|
-
resolvedTypeReferenceDirective: toResolved(resolution.resolvedTypeReferenceDirective, resolvedFileName, extenstion),
|
|
123710
|
-
failedLookupLocations: ts.emptyArray,
|
|
123711
|
-
affectingLocations: affectingLocations,
|
|
123712
|
-
resolutionDiagnostics: (_b = resolution.resolutionDiagnostics) === null || _b === void 0 ? void 0 : _b.map(toResolutionDiagnostic)
|
|
123713
|
-
};
|
|
123714
|
-
}
|
|
123715
|
-
resolutions[resolutionId - 1] = false;
|
|
123716
|
-
return undefined;
|
|
123717
|
-
}
|
|
123718
|
-
function toResolved(resolved, resolvedFileName, extension) {
|
|
123719
|
-
if (!resolved)
|
|
123720
|
-
return undefined;
|
|
123721
|
-
return __assign(__assign({}, resolved), { resolvedFileName: resolvedFileName, originalPath: resolved.originalPath ? resuableCacheResolutions.getProgramBuildInfoFilePathDecoder().toFileAbsolutePath(resolved.originalPath) : undefined, extension: extension });
|
|
123722
|
-
}
|
|
123723
|
-
function toResolutionDiagnostic(d) {
|
|
123724
|
-
return {
|
|
123725
|
-
isImports: !!d.isImports,
|
|
123726
|
-
entry: d.entry || "",
|
|
123727
|
-
packagePath: resuableCacheResolutions.getProgramBuildInfoFilePathDecoder().toFileAbsolutePath(d.packagePath)
|
|
123728
|
-
};
|
|
123729
|
-
}
|
|
123730
|
-
}
|
|
123731
|
-
ts.createOldBuildInfoProgram = createOldBuildInfoProgram;
|
|
123732
122859
|
function getBuildInfoFileVersionMap(program, buildInfoPath, host) {
|
|
123733
122860
|
var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
|
|
123734
122861
|
var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
|
|
@@ -123748,7 +122875,6 @@ var ts;
|
|
|
123748
122875
|
restoreEmitState: ts.noop,
|
|
123749
122876
|
getProgram: getProgram,
|
|
123750
122877
|
getProgramOrUndefined: function () { return getState().program; },
|
|
123751
|
-
getProgramOrOldBuildInfoProgramUndefined: function () { return getState().program; },
|
|
123752
122878
|
releaseProgram: function () { return getState().program = undefined; },
|
|
123753
122879
|
getCompilerOptions: function () { return getState().compilerOptions; },
|
|
123754
122880
|
getSourceFile: function (fileName) { return getProgram().getSourceFile(fileName); },
|
|
@@ -123844,57 +122970,15 @@ var ts;
|
|
|
123844
122970
|
return true;
|
|
123845
122971
|
}
|
|
123846
122972
|
ts.canWatchDirectoryOrFile = canWatchDirectoryOrFile;
|
|
123847
|
-
function getResolvedModuleOfResolution(resolution) {
|
|
123848
|
-
return resolution.resolvedModule;
|
|
123849
|
-
}
|
|
123850
|
-
ts.getResolvedModuleOfResolution = getResolvedModuleOfResolution;
|
|
123851
|
-
function getResolvedTypeReferenceDirectiveOfResolution(resolution) {
|
|
123852
|
-
return resolution.resolvedTypeReferenceDirective;
|
|
123853
|
-
}
|
|
123854
|
-
ts.getResolvedTypeReferenceDirectiveOfResolution = getResolvedTypeReferenceDirectiveOfResolution;
|
|
123855
|
-
function toPerDirectoryResolution(newProgram, fileCacheFromProgram, sourceFileOrPath, perDirCache, moduleNameToDirectoryMap, onRedirectedReferenceKey, forEachResolution, toPath, ancestoryWorker) {
|
|
123856
|
-
if (!(fileCacheFromProgram === null || fileCacheFromProgram === void 0 ? void 0 : fileCacheFromProgram.size()))
|
|
123857
|
-
return perDirCache;
|
|
123858
|
-
var path = !ts.isString(sourceFileOrPath) ? sourceFileOrPath.path : sourceFileOrPath;
|
|
123859
|
-
var redirectedReference = !ts.isString(sourceFileOrPath) ? newProgram.getRedirectReferenceForResolution(sourceFileOrPath) : undefined;
|
|
123860
|
-
var options = (redirectedReference === null || redirectedReference === void 0 ? void 0 : redirectedReference.commandLine.options) || newProgram.getCompilerOptions();
|
|
123861
|
-
var key = ts.getRedirectsCacheKey(options);
|
|
123862
|
-
onRedirectedReferenceKey(key);
|
|
123863
|
-
var dirPath = ts.getDirectoryPath(path);
|
|
123864
|
-
var perDirResolutionCache = perDirCache === null || perDirCache === void 0 ? void 0 : perDirCache.getMapOfCacheRedirects(redirectedReference);
|
|
123865
|
-
var cacheForDir = perDirResolutionCache === null || perDirResolutionCache === void 0 ? void 0 : perDirResolutionCache.get(dirPath);
|
|
123866
|
-
fileCacheFromProgram.forEach(function (r, name, mode) {
|
|
123867
|
-
if (forEachResolution(r, name, mode, key, redirectedReference, dirPath))
|
|
123868
|
-
return;
|
|
123869
|
-
if (cacheForDir === null || cacheForDir === void 0 ? void 0 : cacheForDir.has(name, mode))
|
|
123870
|
-
return;
|
|
123871
|
-
if (!cacheForDir) {
|
|
123872
|
-
perDirResolutionCache !== null && perDirResolutionCache !== void 0 ? perDirResolutionCache : (perDirResolutionCache = (perDirCache !== null && perDirCache !== void 0 ? perDirCache : (perDirCache = ts.createCacheWithRedirects(newProgram.getCompilerOptions()))).createMapForCompilerOptions(options, key));
|
|
123873
|
-
perDirResolutionCache.set(dirPath, cacheForDir = ts.createModeAwareCache());
|
|
123874
|
-
}
|
|
123875
|
-
cacheForDir.set(name, mode, r);
|
|
123876
|
-
if (!moduleNameToDirectoryMap || ts.isExternalModuleNameRelative(name))
|
|
123877
|
-
return;
|
|
123878
|
-
var actualModuleNameToDirectoryMap = moduleNameToDirectoryMap.createMapForCompilerOptions(options, key);
|
|
123879
|
-
var modeAwareCacheKey = ts.getModeAwareCacheKey(name, mode);
|
|
123880
|
-
var directoryPathMap = actualModuleNameToDirectoryMap.get(modeAwareCacheKey);
|
|
123881
|
-
if (!directoryPathMap)
|
|
123882
|
-
actualModuleNameToDirectoryMap.set(modeAwareCacheKey, directoryPathMap = new ts.Map());
|
|
123883
|
-
ts.moduleNameToDirectorySet(directoryPathMap, dirPath, r, ts.getResolvedFileNameForModuleNameToDirectorySet, toPath, function (ancestorPath) { return ancestoryWorker(ancestorPath, name, mode, perDirResolutionCache); });
|
|
123884
|
-
});
|
|
123885
|
-
return perDirCache;
|
|
123886
|
-
}
|
|
123887
|
-
ts.toPerDirectoryResolution = toPerDirectoryResolution;
|
|
123888
122973
|
function createResolutionCache(resolutionHost, rootDirForResolution, logChangesWhenResolvingModule) {
|
|
123889
122974
|
var filesWithChangedSetOfUnresolvedImports;
|
|
123890
122975
|
var filesWithInvalidatedResolutions;
|
|
122976
|
+
var filesWithInvalidatedNonRelativeUnresolvedImports;
|
|
122977
|
+
var nonRelativeExternalModuleResolutions = ts.createMultiMap();
|
|
123891
122978
|
var resolutionsWithFailedLookups = [];
|
|
123892
122979
|
var resolutionsWithOnlyAffectingLocations = [];
|
|
123893
122980
|
var resolvedFileToResolution = ts.createMultiMap();
|
|
123894
|
-
var
|
|
123895
|
-
var watchedPackageJsonScopes = [];
|
|
123896
|
-
var packageJsonsToCloseWatcherOn;
|
|
123897
|
-
var resolutionsToCloseWatcherOn;
|
|
122981
|
+
var impliedFormatPackageJsons = new ts.Map();
|
|
123898
122982
|
var hasChangedAutomaticTypeDirectiveNames = false;
|
|
123899
122983
|
var affectingPathChecksForFile;
|
|
123900
122984
|
var affectingPathChecks;
|
|
@@ -123903,16 +122987,18 @@ var ts;
|
|
|
123903
122987
|
var isInDirectoryChecks;
|
|
123904
122988
|
var getCurrentDirectory = ts.memoize(function () { return resolutionHost.getCurrentDirectory(); }); // TODO: GH#18217
|
|
123905
122989
|
var cachedDirectoryStructureHost = resolutionHost.getCachedDirectoryStructureHost();
|
|
123906
|
-
var oldModuleAndTypeRefCache;
|
|
123907
|
-
var oldPackageJsonInfoCache;
|
|
123908
122990
|
// The resolvedModuleNames and resolvedTypeReferenceDirectives are the cache of resolutions per file.
|
|
123909
122991
|
// The key in the map is source file's path.
|
|
123910
122992
|
// The values are Map of resolutions with key being name lookedup.
|
|
123911
122993
|
var resolvedModuleNames = new ts.Map();
|
|
123912
|
-
var
|
|
122994
|
+
var perDirectoryResolvedModuleNames = ts.createCacheWithRedirects();
|
|
122995
|
+
var nonRelativeModuleNameCache = ts.createCacheWithRedirects();
|
|
122996
|
+
var moduleResolutionCache = ts.createModuleResolutionCache(getCurrentDirectory(), resolutionHost.getCanonicalFileName,
|
|
122997
|
+
/*options*/ undefined, perDirectoryResolvedModuleNames, nonRelativeModuleNameCache);
|
|
123913
122998
|
var resolvedTypeReferenceDirectives = new ts.Map();
|
|
122999
|
+
var perDirectoryResolvedTypeReferenceDirectives = ts.createCacheWithRedirects();
|
|
123914
123000
|
var typeReferenceDirectiveResolutionCache = ts.createTypeReferenceDirectiveResolutionCache(getCurrentDirectory(), resolutionHost.getCanonicalFileName,
|
|
123915
|
-
/*options*/ undefined, moduleResolutionCache.getPackageJsonInfoCache());
|
|
123001
|
+
/*options*/ undefined, moduleResolutionCache.getPackageJsonInfoCache(), perDirectoryResolvedTypeReferenceDirectives);
|
|
123916
123002
|
/**
|
|
123917
123003
|
* These are the extensions that failed lookup files will have by default,
|
|
123918
123004
|
* any other extension of failed lookup will be store that path in custom failed lookup path
|
|
@@ -123929,23 +123015,34 @@ var ts;
|
|
|
123929
123015
|
// TypeRoot watches for the types that get added as part of getAutomaticTypeDirectiveNames
|
|
123930
123016
|
var typeRootsWatches = new ts.Map();
|
|
123931
123017
|
return {
|
|
123932
|
-
resolvedModuleNames: resolvedModuleNames,
|
|
123933
|
-
resolvedTypeReferenceDirectives: resolvedTypeReferenceDirectives,
|
|
123934
123018
|
getModuleResolutionCache: function () { return moduleResolutionCache; },
|
|
123935
|
-
getTypeReferenceDirectiveResolutionCache: function () { return typeReferenceDirectiveResolutionCache; },
|
|
123936
123019
|
startRecordingFilesWithChangedResolutions: startRecordingFilesWithChangedResolutions,
|
|
123937
123020
|
finishRecordingFilesWithChangedResolutions: finishRecordingFilesWithChangedResolutions,
|
|
123021
|
+
// perDirectoryResolvedModuleNames and perDirectoryResolvedTypeReferenceDirectives could be non empty if there was exception during program update
|
|
123022
|
+
// (between startCachingPerDirectoryResolution and finishCachingPerDirectoryResolution)
|
|
123938
123023
|
startCachingPerDirectoryResolution: startCachingPerDirectoryResolution,
|
|
123939
123024
|
finishCachingPerDirectoryResolution: finishCachingPerDirectoryResolution,
|
|
123940
123025
|
resolveModuleNames: resolveModuleNames,
|
|
123026
|
+
getResolvedModuleWithFailedLookupLocationsFromCache: getResolvedModuleWithFailedLookupLocationsFromCache,
|
|
123941
123027
|
resolveTypeReferenceDirectives: resolveTypeReferenceDirectives,
|
|
123028
|
+
removeResolutionsFromProjectReferenceRedirects: removeResolutionsFromProjectReferenceRedirects,
|
|
123029
|
+
removeResolutionsOfFile: removeResolutionsOfFile,
|
|
123942
123030
|
hasChangedAutomaticTypeDirectiveNames: function () { return hasChangedAutomaticTypeDirectiveNames; },
|
|
123943
123031
|
invalidateResolutionOfFile: invalidateResolutionOfFile,
|
|
123944
123032
|
invalidateResolutionsOfFailedLookupLocations: invalidateResolutionsOfFailedLookupLocations,
|
|
123945
123033
|
setFilesWithInvalidatedNonRelativeUnresolvedImports: setFilesWithInvalidatedNonRelativeUnresolvedImports,
|
|
123946
123034
|
createHasInvalidatedResolution: createHasInvalidatedResolution,
|
|
123035
|
+
isFileWithInvalidatedNonRelativeUnresolvedImports: isFileWithInvalidatedNonRelativeUnresolvedImports,
|
|
123036
|
+
updateTypeRootsWatch: updateTypeRootsWatch,
|
|
123037
|
+
closeTypeRootsWatch: closeTypeRootsWatch,
|
|
123947
123038
|
clear: clear
|
|
123948
123039
|
};
|
|
123040
|
+
function getResolvedModule(resolution) {
|
|
123041
|
+
return resolution.resolvedModule;
|
|
123042
|
+
}
|
|
123043
|
+
function getResolvedTypeReferenceDirective(resolution) {
|
|
123044
|
+
return resolution.resolvedTypeReferenceDirective;
|
|
123045
|
+
}
|
|
123949
123046
|
function isInDirectoryPath(dir, file) {
|
|
123950
123047
|
if (dir === undefined || file.length <= dir.length) {
|
|
123951
123048
|
return false;
|
|
@@ -123956,25 +123053,21 @@ var ts;
|
|
|
123956
123053
|
ts.clearMap(directoryWatchesOfFailedLookups, ts.closeFileWatcherOf);
|
|
123957
123054
|
ts.clearMap(fileWatchesOfAffectingLocations, ts.closeFileWatcherOf);
|
|
123958
123055
|
customFailedLookupPaths.clear();
|
|
123056
|
+
nonRelativeExternalModuleResolutions.clear();
|
|
123959
123057
|
closeTypeRootsWatch();
|
|
123960
123058
|
resolvedModuleNames.clear();
|
|
123961
123059
|
resolvedTypeReferenceDirectives.clear();
|
|
123962
123060
|
resolvedFileToResolution.clear();
|
|
123963
123061
|
resolutionsWithFailedLookups.length = 0;
|
|
123964
123062
|
resolutionsWithOnlyAffectingLocations.length = 0;
|
|
123965
|
-
watchedPackageJsonScopes.length = 0;
|
|
123966
123063
|
failedLookupChecks = undefined;
|
|
123967
123064
|
startsWithPathChecks = undefined;
|
|
123968
123065
|
isInDirectoryChecks = undefined;
|
|
123969
123066
|
affectingPathChecks = undefined;
|
|
123970
123067
|
affectingPathChecksForFile = undefined;
|
|
123971
|
-
resolutionsToCloseWatcherOn = undefined;
|
|
123972
|
-
packageJsonsToCloseWatcherOn = undefined;
|
|
123973
|
-
oldModuleAndTypeRefCache = undefined;
|
|
123974
|
-
oldPackageJsonInfoCache = undefined;
|
|
123975
123068
|
moduleResolutionCache.clear();
|
|
123976
123069
|
typeReferenceDirectiveResolutionCache.clear();
|
|
123977
|
-
|
|
123070
|
+
impliedFormatPackageJsons.clear();
|
|
123978
123071
|
hasChangedAutomaticTypeDirectiveNames = false;
|
|
123979
123072
|
}
|
|
123980
123073
|
function startRecordingFilesWithChangedResolutions() {
|
|
@@ -123985,6 +123078,14 @@ var ts;
|
|
|
123985
123078
|
filesWithChangedSetOfUnresolvedImports = undefined;
|
|
123986
123079
|
return collected;
|
|
123987
123080
|
}
|
|
123081
|
+
function isFileWithInvalidatedNonRelativeUnresolvedImports(path) {
|
|
123082
|
+
if (!filesWithInvalidatedNonRelativeUnresolvedImports) {
|
|
123083
|
+
return false;
|
|
123084
|
+
}
|
|
123085
|
+
// Invalidated if file has unresolved imports
|
|
123086
|
+
var value = filesWithInvalidatedNonRelativeUnresolvedImports.get(path);
|
|
123087
|
+
return !!value && !!value.length;
|
|
123088
|
+
}
|
|
123988
123089
|
function createHasInvalidatedResolution(forceAllFilesAsInvalidated) {
|
|
123989
123090
|
// Ensure pending resolutions are applied
|
|
123990
123091
|
invalidateResolutionsOfFailedLookupLocations();
|
|
@@ -123995,232 +123096,63 @@ var ts;
|
|
|
123995
123096
|
}
|
|
123996
123097
|
var collected = filesWithInvalidatedResolutions;
|
|
123997
123098
|
filesWithInvalidatedResolutions = undefined;
|
|
123998
|
-
return function (path) { return !!
|
|
123099
|
+
return function (path) { return (!!collected && collected.has(path)) ||
|
|
123100
|
+
isFileWithInvalidatedNonRelativeUnresolvedImports(path); };
|
|
123999
123101
|
}
|
|
124000
123102
|
function startCachingPerDirectoryResolution() {
|
|
124001
|
-
|
|
124002
|
-
|
|
124003
|
-
|
|
124004
|
-
|
|
124005
|
-
|
|
124006
|
-
|
|
124007
|
-
if (oldModuleAndTypeRefCache) {
|
|
124008
|
-
oldModuleAndTypeRefCache.clearRedirectsMap();
|
|
124009
|
-
moduleResolutionCache.setOldResolutionCache(oldModuleAndTypeRefCache.modules);
|
|
124010
|
-
typeReferenceDirectiveResolutionCache.setOldResolutionCache(oldModuleAndTypeRefCache.typeRefs);
|
|
124011
|
-
}
|
|
124012
|
-
packageJsonInfoCache.setInternalMap(internalCache);
|
|
124013
|
-
packageJsonInfoCache.setOldPackageJsonScopeCache(oldPackageJsonInfoCache);
|
|
123103
|
+
moduleResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
123104
|
+
typeReferenceDirectiveResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
123105
|
+
// perDirectoryResolvedModuleNames and perDirectoryResolvedTypeReferenceDirectives could be non empty if there was exception during program update
|
|
123106
|
+
// (between startCachingPerDirectoryResolution and finishCachingPerDirectoryResolution)
|
|
123107
|
+
nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfNonRelativeModuleResolutions);
|
|
123108
|
+
nonRelativeExternalModuleResolutions.clear();
|
|
124014
123109
|
}
|
|
124015
123110
|
function finishCachingPerDirectoryResolution(newProgram, oldProgram) {
|
|
124016
|
-
|
|
124017
|
-
|
|
124018
|
-
|
|
124019
|
-
|
|
124020
|
-
|
|
124021
|
-
|
|
124022
|
-
|
|
124023
|
-
|
|
124024
|
-
|
|
124025
|
-
|
|
124026
|
-
|
|
124027
|
-
var dirToPackageJsonScope = new ts.Map();
|
|
124028
|
-
for (var _i = 0, _a = newProgram.getSourceFiles(); _i < _a.length; _i++) {
|
|
124029
|
-
var newFile = _a[_i];
|
|
124030
|
-
if (needsResolutionUpdate) {
|
|
124031
|
-
modules = ensureResolutionsOfFile(newProgram, resolvedModuleNames, newFile.resolvedModules, newFile, getResolvedModuleOfResolution, modules, moduleNameToDirectoryMap);
|
|
124032
|
-
typeRefs = ensureResolutionsOfFile(newProgram, resolvedTypeReferenceDirectives, newFile.resolvedTypeReferenceDirectiveNames, newFile, getResolvedTypeReferenceDirectiveOfResolution, typeRefs,
|
|
124033
|
-
/*moduleNameToDirectoryMap*/ undefined);
|
|
124034
|
-
}
|
|
124035
|
-
ensurePackageJsonWatchesForFile(newFile, dirToPackageJsonScope);
|
|
124036
|
-
}
|
|
124037
|
-
if (needsResolutionUpdate) {
|
|
124038
|
-
var newProgramAutoTypeRefContainingFile = resolutionHost.toPath(newProgram.getAutomaticTypeDirectiveContainingFile());
|
|
124039
|
-
typeRefs = ensureResolutionsOfFile(newProgram, resolvedTypeReferenceDirectives, newProgram.getAutomaticTypeDirectiveResolutions(), newProgramAutoTypeRefContainingFile, getResolvedTypeReferenceDirectiveOfResolution, typeRefs,
|
|
124040
|
-
/*moduleNameToDirectoryMap*/ undefined);
|
|
124041
|
-
if (!modules && !typeRefs) {
|
|
124042
|
-
oldModuleAndTypeRefCache = undefined;
|
|
124043
|
-
}
|
|
124044
|
-
else {
|
|
124045
|
-
oldModuleAndTypeRefCache = getOldResolutionCache(modules, typeRefs, moduleNameToDirectoryMap);
|
|
124046
|
-
}
|
|
124047
|
-
// Remove resolutions for files not in the program
|
|
124048
|
-
if (oldProgram) {
|
|
124049
|
-
for (var _b = 0, _c = oldProgram.getSourceFiles(); _b < _c.length; _b++) {
|
|
124050
|
-
var f = _c[_b];
|
|
124051
|
-
if (!newProgram.getSourceFileByPath(f.path))
|
|
124052
|
-
removeResolutionsOfFile(f.path);
|
|
123111
|
+
filesWithInvalidatedNonRelativeUnresolvedImports = undefined;
|
|
123112
|
+
nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfNonRelativeModuleResolutions);
|
|
123113
|
+
nonRelativeExternalModuleResolutions.clear();
|
|
123114
|
+
// Update file watches
|
|
123115
|
+
if (newProgram !== oldProgram) {
|
|
123116
|
+
newProgram === null || newProgram === void 0 ? void 0 : newProgram.getSourceFiles().forEach(function (newFile) {
|
|
123117
|
+
var _a, _b, _c;
|
|
123118
|
+
var expected = ts.isExternalOrCommonJsModule(newFile) ? (_b = (_a = newFile.packageJsonLocations) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0 : 0;
|
|
123119
|
+
var existing = (_c = impliedFormatPackageJsons.get(newFile.path)) !== null && _c !== void 0 ? _c : ts.emptyArray;
|
|
123120
|
+
for (var i = existing.length; i < expected; i++) {
|
|
123121
|
+
createFileWatcherOfAffectingLocation(newFile.packageJsonLocations[i], /*forResolution*/ false);
|
|
124053
123122
|
}
|
|
124054
|
-
|
|
124055
|
-
|
|
124056
|
-
|
|
123123
|
+
if (existing.length > expected) {
|
|
123124
|
+
for (var i = expected; i < existing.length; i++) {
|
|
123125
|
+
fileWatchesOfAffectingLocations.get(existing[i]).files--;
|
|
123126
|
+
}
|
|
124057
123127
|
}
|
|
124058
|
-
|
|
123128
|
+
if (expected)
|
|
123129
|
+
impliedFormatPackageJsons.set(newFile.path, newFile.packageJsonLocations);
|
|
123130
|
+
else
|
|
123131
|
+
impliedFormatPackageJsons.delete(newFile.path);
|
|
123132
|
+
});
|
|
123133
|
+
impliedFormatPackageJsons.forEach(function (existing, path) {
|
|
123134
|
+
if (!(newProgram === null || newProgram === void 0 ? void 0 : newProgram.getSourceFileByPath(path))) {
|
|
123135
|
+
existing.forEach(function (location) { return fileWatchesOfAffectingLocations.get(location).files--; });
|
|
123136
|
+
impliedFormatPackageJsons.delete(path);
|
|
123137
|
+
}
|
|
123138
|
+
});
|
|
124059
123139
|
}
|
|
124060
|
-
|
|
124061
|
-
if (
|
|
124062
|
-
|
|
124063
|
-
|
|
123140
|
+
directoryWatchesOfFailedLookups.forEach(function (watcher, path) {
|
|
123141
|
+
if (watcher.refCount === 0) {
|
|
123142
|
+
directoryWatchesOfFailedLookups.delete(path);
|
|
123143
|
+
watcher.watcher.close();
|
|
124064
123144
|
}
|
|
124065
123145
|
});
|
|
124066
|
-
if (dirToPackageJsonScope.size) {
|
|
124067
|
-
oldPackageJsonInfoCache = getOldPackageJsonInfoCache(dirToPackageJsonScope);
|
|
124068
|
-
}
|
|
124069
|
-
else {
|
|
124070
|
-
oldPackageJsonInfoCache = undefined;
|
|
124071
|
-
}
|
|
124072
|
-
if (needsResolutionUpdate && (!oldProgram || newProgram.getCompilerOptions() !== oldProgram.getCompilerOptions()))
|
|
124073
|
-
updateTypeRootsWatch();
|
|
124074
|
-
// Remove symlinked watchers that have zero ref count
|
|
124075
|
-
resolutionsToCloseWatcherOn === null || resolutionsToCloseWatcherOn === void 0 ? void 0 : resolutionsToCloseWatcherOn.forEach(closeWatchersOfResolution);
|
|
124076
|
-
resolutionsToCloseWatcherOn = undefined;
|
|
124077
|
-
packageJsonsToCloseWatcherOn === null || packageJsonsToCloseWatcherOn === void 0 ? void 0 : packageJsonsToCloseWatcherOn.forEach(closeWatchersOfPackageJsonScope);
|
|
124078
|
-
packageJsonsToCloseWatcherOn = undefined;
|
|
124079
123146
|
fileWatchesOfAffectingLocations.forEach(function (watcher, path) {
|
|
124080
123147
|
if (watcher.files === 0 && watcher.resolutions === 0) {
|
|
124081
123148
|
fileWatchesOfAffectingLocations.delete(path);
|
|
124082
123149
|
watcher.watcher.close();
|
|
124083
123150
|
}
|
|
124084
123151
|
});
|
|
124085
|
-
|
|
124086
|
-
function ensurePackageJsonWatchesForFile(newFile, dirToPackageJsonScope) {
|
|
124087
|
-
var _a;
|
|
124088
|
-
var existing = perFilePackageJsonScope.get(newFile.path);
|
|
124089
|
-
var scope = ts.isExternalOrCommonJsModule(newFile) ? newFile.packageJsonScope : undefined;
|
|
124090
|
-
if (scope) {
|
|
124091
|
-
((_a = scope.files) !== null && _a !== void 0 ? _a : (scope.files = new ts.Set())).add(newFile.path);
|
|
124092
|
-
watchPackageJsonScopeLocations(scope, scope.failedLookupLocations, "watchedFailed");
|
|
124093
|
-
watchPackageJsonScopeLocations(scope, scope.affectingLocations, "watchedAffected");
|
|
124094
|
-
perFilePackageJsonScope.set(newFile.path, scope);
|
|
124095
|
-
ts.moduleNameToDirectorySet(dirToPackageJsonScope, ts.getDirectoryPath(newFile.resolvedPath), scope, ts.getPackageJsconLocationFromScope, function (dir) { return resolutionHost.toPath(dir); }, ts.noop);
|
|
124096
|
-
}
|
|
124097
|
-
if (existing && scope !== existing)
|
|
124098
|
-
stopWatchingPackageJsonScope(existing, newFile.path);
|
|
124099
|
-
}
|
|
124100
|
-
function stopWatchingPackageJsonScope(scope, path) {
|
|
124101
|
-
var _a, _b;
|
|
124102
|
-
(_a = scope.files) === null || _a === void 0 ? void 0 : _a.delete(path);
|
|
124103
|
-
if (!((_b = scope.files) === null || _b === void 0 ? void 0 : _b.size))
|
|
124104
|
-
(packageJsonsToCloseWatcherOn !== null && packageJsonsToCloseWatcherOn !== void 0 ? packageJsonsToCloseWatcherOn : (packageJsonsToCloseWatcherOn = [])).push(scope);
|
|
124105
|
-
}
|
|
124106
|
-
function watchPackageJsonScopeLocations(scope, locations, field) {
|
|
124107
|
-
var _a, _b;
|
|
124108
|
-
var locationsLength = (_a = locations === null || locations === void 0 ? void 0 : locations.length) !== null && _a !== void 0 ? _a : 0;
|
|
124109
|
-
if (!locationsLength || scope[field] === locationsLength)
|
|
124110
|
-
return;
|
|
124111
|
-
if (!scope.watchedFailed && !scope.watchedAffected)
|
|
124112
|
-
watchedPackageJsonScopes.push(scope);
|
|
124113
|
-
for (var i = (_b = scope[field]) !== null && _b !== void 0 ? _b : 0; i < locationsLength; i++) {
|
|
124114
|
-
createFileWatcherOfAffectingLocation(locations[i], /*forResolution*/ false);
|
|
124115
|
-
}
|
|
124116
|
-
scope[field] = locationsLength;
|
|
124117
|
-
}
|
|
124118
|
-
function closeWatchersOfPackageJsonScope(scope) {
|
|
124119
|
-
var _a;
|
|
124120
|
-
// Either in use or already closed, skip
|
|
124121
|
-
if (((_a = scope.files) === null || _a === void 0 ? void 0 : _a.size) || !scope.files)
|
|
124122
|
-
return;
|
|
124123
|
-
scope.files = undefined;
|
|
124124
|
-
ts.unorderedRemoveItem(watchedPackageJsonScopes, scope);
|
|
124125
|
-
stopWatchingPackageJsonScopeLocations(scope, scope.failedLookupLocations, "watchedFailed");
|
|
124126
|
-
stopWatchingPackageJsonScopeLocations(scope, scope.affectingLocations, "watchedAffected");
|
|
124127
|
-
}
|
|
124128
|
-
function stopWatchingPackageJsonScopeLocations(scope, locations, field) {
|
|
124129
|
-
if (!scope[field])
|
|
124130
|
-
return;
|
|
124131
|
-
for (var i = 0; i < scope[field]; i++) {
|
|
124132
|
-
fileWatchesOfAffectingLocations.get(locations[i]).files--;
|
|
124133
|
-
}
|
|
124134
|
-
scope[field] = undefined;
|
|
124135
|
-
}
|
|
124136
|
-
function getOldPackageJsonInfoCache(dirToPackageJsonScope) {
|
|
124137
|
-
var packageJsons;
|
|
124138
|
-
return {
|
|
124139
|
-
getPackageJsonScope: function (dir) {
|
|
124140
|
-
var _a;
|
|
124141
|
-
var scope = dirToPackageJsonScope.get(dir);
|
|
124142
|
-
if (!scope)
|
|
124143
|
-
return undefined;
|
|
124144
|
-
if (!scope.isInvalidated)
|
|
124145
|
-
return scope;
|
|
124146
|
-
if (!resolutionHost.getCompilationSettings().cacheResolutions || !scope.info)
|
|
124147
|
-
return undefined;
|
|
124148
|
-
var packageJson = ts.getPackageJsconLocationFromScope(scope);
|
|
124149
|
-
var result = packageJsons === null || packageJsons === void 0 ? void 0 : packageJsons.get(packageJson);
|
|
124150
|
-
if (result !== undefined)
|
|
124151
|
-
return result || undefined;
|
|
124152
|
-
if (resolutionHost.fileExists(packageJson)) {
|
|
124153
|
-
result = {
|
|
124154
|
-
info: ts.getPackageJsonInfo(ts.getDirectoryPath(packageJson),
|
|
124155
|
-
/*onlyRecordFailures*/ false, ts.getTemporaryModuleResolutionState(moduleResolutionCache.getPackageJsonInfoCache(), ((_a = resolutionHost.getCompilerHost) === null || _a === void 0 ? void 0 : _a.call(resolutionHost)) || resolutionHost, resolutionHost.getCompilationSettings())),
|
|
124156
|
-
affectingLocations: [packageJson],
|
|
124157
|
-
};
|
|
124158
|
-
}
|
|
124159
|
-
(packageJsons !== null && packageJsons !== void 0 ? packageJsons : (packageJsons = new ts.Map())).set(packageJson, result || false);
|
|
124160
|
-
return result;
|
|
124161
|
-
}
|
|
124162
|
-
};
|
|
124163
|
-
}
|
|
124164
|
-
function ensureResolutionsOfFile(newProgram, perFileCache, fileCacheFromProgram, sourceFileOrPath, getResolutionWithResolvedFileName, perDirCache, moduleNameToDirectoryMap) {
|
|
124165
|
-
var path = !ts.isString(sourceFileOrPath) ? sourceFileOrPath.path : sourceFileOrPath;
|
|
124166
|
-
var resolutionsInFile = perFileCache.get(path);
|
|
124167
|
-
var seenNamesInFile = ts.createModeAwareCache();
|
|
124168
|
-
perDirCache = toPerDirectoryResolution(newProgram, fileCacheFromProgram, sourceFileOrPath, perDirCache, moduleNameToDirectoryMap, function (key) {
|
|
124169
|
-
// If keys dont match release existing resolutions
|
|
124170
|
-
if (resolutionsInFile && resolutionsInFile.key !== key) {
|
|
124171
|
-
resolutionsInFile.cache.forEach(function (r) { return stopWatchingResolution(r, path, getResolutionWithResolvedFileName); });
|
|
124172
|
-
resolutionsInFile = undefined;
|
|
124173
|
-
}
|
|
124174
|
-
}, function (r, name, mode, key) {
|
|
124175
|
-
seenNamesInFile.set(name, mode, true);
|
|
124176
|
-
var existing = resolutionsInFile === null || resolutionsInFile === void 0 ? void 0 : resolutionsInFile.cache.get(name, mode);
|
|
124177
|
-
if (existing && r !== existing)
|
|
124178
|
-
stopWatchingResolution(existing, path, getResolutionWithResolvedFileName);
|
|
124179
|
-
watchResolution(newProgram, name, r, path, getResolutionWithResolvedFileName);
|
|
124180
|
-
if (!resolutionsInFile)
|
|
124181
|
-
perFileCache.set(path, resolutionsInFile = { key: key, cache: ts.createModeAwareCache() });
|
|
124182
|
-
resolutionsInFile.cache.set(name, mode, r);
|
|
124183
|
-
}, function (dir) { return resolutionHost.toPath(dir); }, ts.noop);
|
|
124184
|
-
if (((resolutionsInFile === null || resolutionsInFile === void 0 ? void 0 : resolutionsInFile.cache.size()) || 0) !== seenNamesInFile.size()) {
|
|
124185
|
-
// Stop watching and remove the unused name
|
|
124186
|
-
resolutionsInFile.cache.forEach(function (resolution, name, mode) {
|
|
124187
|
-
if (!seenNamesInFile.has(name, mode)) {
|
|
124188
|
-
stopWatchingResolution(resolution, path, getResolutionWithResolvedFileName);
|
|
124189
|
-
resolutionsInFile.cache.delete(name, mode);
|
|
124190
|
-
}
|
|
124191
|
-
});
|
|
124192
|
-
if (!(resolutionsInFile === null || resolutionsInFile === void 0 ? void 0 : resolutionsInFile.cache.size))
|
|
124193
|
-
perFileCache.delete(path);
|
|
124194
|
-
}
|
|
124195
|
-
return perDirCache;
|
|
124196
|
-
}
|
|
124197
|
-
function getOldResolutionCache(modules, typeRefs, moduleNameToDirectoryMap) {
|
|
124198
|
-
if (!modules && !typeRefs)
|
|
124199
|
-
return undefined;
|
|
124200
|
-
return {
|
|
124201
|
-
modules: {
|
|
124202
|
-
getResolved: function (dirPath, name, mode, redirectedReference) { return getResolvedWithOldCache(dirPath, name, mode, redirectedReference, modules, moduleNameToDirectoryMap); }
|
|
124203
|
-
},
|
|
124204
|
-
typeRefs: {
|
|
124205
|
-
getResolved: function (dirPath, name, mode, redirectedReference) { return getResolvedWithOldCache(dirPath, name, mode, redirectedReference, typeRefs, /*moduleNameToDirectoryMap*/ undefined); }
|
|
124206
|
-
},
|
|
124207
|
-
clearRedirectsMap: function () {
|
|
124208
|
-
modules === null || modules === void 0 ? void 0 : modules.clearRedirectsMap();
|
|
124209
|
-
typeRefs === null || typeRefs === void 0 ? void 0 : typeRefs.clearRedirectsMap();
|
|
124210
|
-
moduleNameToDirectoryMap.clearRedirectsMap();
|
|
124211
|
-
},
|
|
124212
|
-
};
|
|
124213
|
-
}
|
|
124214
|
-
function getResolvedWithOldCache(dirPath, name, mode, redirectedReference, perDirCache, moduleNameToDirectoryMap) {
|
|
124215
|
-
var _a, _b, _c, _d;
|
|
124216
|
-
if (!perDirCache)
|
|
124217
|
-
return undefined;
|
|
124218
|
-
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)) ||
|
|
124219
|
-
((_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));
|
|
124220
|
-
return result && !result.isInvalidated ? result : undefined;
|
|
123152
|
+
hasChangedAutomaticTypeDirectiveNames = false;
|
|
124221
123153
|
}
|
|
124222
123154
|
function resolveModuleName(moduleName, containingFile, compilerOptions, host, redirectedReference, _containingSourceFile, mode) {
|
|
124223
|
-
var _a;
|
|
123155
|
+
var _a, _b;
|
|
124224
123156
|
var primaryResult = ts.resolveModuleName(moduleName, containingFile, compilerOptions, host, moduleResolutionCache, redirectedReference, mode);
|
|
124225
123157
|
// return result immediately only if global cache support is not enabled or if it is .ts, .tsx or .d.ts
|
|
124226
123158
|
if (!resolutionHost.getGlobalCache) {
|
|
@@ -124231,16 +123163,12 @@ var ts;
|
|
|
124231
123163
|
if (globalCache !== undefined && !ts.isExternalModuleNameRelative(moduleName) && !(primaryResult.resolvedModule && ts.extensionIsTS(primaryResult.resolvedModule.extension))) {
|
|
124232
123164
|
// create different collection of failed lookup locations for second pass
|
|
124233
123165
|
// if it will fail and we've already found something during the first pass - we don't want to pollute its results
|
|
124234
|
-
var
|
|
123166
|
+
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;
|
|
124235
123167
|
if (resolvedModule) {
|
|
124236
123168
|
// Modify existing resolution so its saved in the directory cache as well
|
|
124237
123169
|
primaryResult.resolvedModule = resolvedModule;
|
|
124238
|
-
|
|
124239
|
-
|
|
124240
|
-
else
|
|
124241
|
-
primaryResult.failedLookupLocations.length = 0;
|
|
124242
|
-
primaryResult.affectingLocations = ts.updateResolutionField(primaryResult.affectingLocations, affectingLocations);
|
|
124243
|
-
primaryResult.resolutionDiagnostics = ts.updateResolutionField(primaryResult.resolutionDiagnostics, resolutionDiagnostics);
|
|
123170
|
+
(_a = primaryResult.failedLookupLocations).push.apply(_a, failedLookupLocations);
|
|
123171
|
+
(_b = primaryResult.affectingLocations).push.apply(_b, affectingLocations);
|
|
124244
123172
|
return primaryResult;
|
|
124245
123173
|
}
|
|
124246
123174
|
}
|
|
@@ -124251,41 +123179,76 @@ var ts;
|
|
|
124251
123179
|
return ts.resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host, redirectedReference, typeReferenceDirectiveResolutionCache, resolutionMode);
|
|
124252
123180
|
}
|
|
124253
123181
|
function resolveNamesWithLocalCache(_a) {
|
|
124254
|
-
var _b, _c, _d
|
|
124255
|
-
var names = _a.names, containingFile = _a.containingFile, redirectedReference = _a.redirectedReference,
|
|
123182
|
+
var _b, _c, _d;
|
|
123183
|
+
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;
|
|
124256
123184
|
var path = resolutionHost.toPath(containingFile);
|
|
124257
|
-
var resolutionsInFile =
|
|
124258
|
-
var
|
|
124259
|
-
var
|
|
124260
|
-
|
|
124261
|
-
|
|
124262
|
-
|
|
123185
|
+
var resolutionsInFile = cache.get(path) || cache.set(path, ts.createModeAwareCache()).get(path);
|
|
123186
|
+
var dirPath = ts.getDirectoryPath(path);
|
|
123187
|
+
var perDirectoryCache = perDirectoryCacheWithRedirects.getOrCreateMapOfCacheRedirects(redirectedReference);
|
|
123188
|
+
var perDirectoryResolution = perDirectoryCache.get(dirPath);
|
|
123189
|
+
if (!perDirectoryResolution) {
|
|
123190
|
+
perDirectoryResolution = ts.createModeAwareCache();
|
|
123191
|
+
perDirectoryCache.set(dirPath, perDirectoryResolution);
|
|
124263
123192
|
}
|
|
124264
123193
|
var resolvedModules = [];
|
|
123194
|
+
var compilerOptions = resolutionHost.getCompilationSettings();
|
|
123195
|
+
var hasInvalidatedNonRelativeUnresolvedImport = logChanges && isFileWithInvalidatedNonRelativeUnresolvedImports(path);
|
|
123196
|
+
// All the resolutions in this file are invalidated if this file wasn't resolved using same redirect
|
|
123197
|
+
var program = resolutionHost.getCurrentProgram();
|
|
123198
|
+
var oldRedirect = program && program.getResolvedProjectReferenceToRedirect(containingFile);
|
|
123199
|
+
var unmatchedRedirects = oldRedirect ?
|
|
123200
|
+
!redirectedReference || redirectedReference.sourceFile.path !== oldRedirect.sourceFile.path :
|
|
123201
|
+
!!redirectedReference;
|
|
124265
123202
|
var seenNamesInFile = ts.createModeAwareCache();
|
|
124266
123203
|
var i = 0;
|
|
124267
|
-
for (var _i = 0,
|
|
124268
|
-
var entry =
|
|
124269
|
-
var name = ts.isString(entry) ? entry :
|
|
123204
|
+
for (var _i = 0, names_5 = names; _i < names_5.length; _i++) {
|
|
123205
|
+
var entry = names_5[_i];
|
|
123206
|
+
var name = ts.isString(entry) ? entry : entry.fileName.toLowerCase();
|
|
124270
123207
|
// Imports supply a `containingSourceFile` but no `containingSourceFileMode` - it would be redundant
|
|
124271
123208
|
// they require calculating the mode for a given import from it's position in the resolution table, since a given
|
|
124272
123209
|
// import's syntax may override the file's default mode.
|
|
124273
123210
|
// Type references instead supply a `containingSourceFileMode` and a non-string entry which contains
|
|
124274
123211
|
// a default file mode override if applicable.
|
|
124275
123212
|
var mode = !ts.isString(entry) ? ts.getModeForFileReference(entry, containingSourceFileMode) :
|
|
124276
|
-
containingSourceFile ? ts.getModeForResolutionAtIndex(containingSourceFile,
|
|
123213
|
+
containingSourceFile ? ts.getModeForResolutionAtIndex(containingSourceFile, i) : undefined;
|
|
124277
123214
|
i++;
|
|
124278
|
-
var resolution = resolutionsInFile.
|
|
123215
|
+
var resolution = resolutionsInFile.get(name, mode);
|
|
124279
123216
|
// Resolution is valid if it is present and not invalidated
|
|
124280
|
-
if (!seenNamesInFile.has(name, mode) &&
|
|
123217
|
+
if (!seenNamesInFile.has(name, mode) &&
|
|
123218
|
+
unmatchedRedirects || !resolution || resolution.isInvalidated ||
|
|
123219
|
+
// If the name is unresolved import that was invalidated, recalculate
|
|
123220
|
+
(hasInvalidatedNonRelativeUnresolvedImport && !ts.isExternalModuleNameRelative(name) && shouldRetryResolution(resolution))) {
|
|
124281
123221
|
var existingResolution = resolution;
|
|
124282
|
-
|
|
124283
|
-
if (
|
|
124284
|
-
|
|
123222
|
+
var resolutionInDirectory = perDirectoryResolution.get(name, mode);
|
|
123223
|
+
if (resolutionInDirectory) {
|
|
123224
|
+
resolution = resolutionInDirectory;
|
|
123225
|
+
var host = ((_b = resolutionHost.getCompilerHost) === null || _b === void 0 ? void 0 : _b.call(resolutionHost)) || resolutionHost;
|
|
123226
|
+
if (ts.isTraceEnabled(compilerOptions, host)) {
|
|
123227
|
+
var resolved = getResolutionWithResolvedFileName(resolution);
|
|
123228
|
+
ts.trace(host, loader === resolveModuleName ?
|
|
123229
|
+
(resolved === null || resolved === void 0 ? void 0 : resolved.resolvedFileName) ?
|
|
123230
|
+
resolved.packagetId ?
|
|
123231
|
+
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 :
|
|
123232
|
+
ts.Diagnostics.Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3 :
|
|
123233
|
+
ts.Diagnostics.Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_not_resolved :
|
|
123234
|
+
(resolved === null || resolved === void 0 ? void 0 : resolved.resolvedFileName) ?
|
|
123235
|
+
resolved.packagetId ?
|
|
123236
|
+
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 :
|
|
123237
|
+
ts.Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3 :
|
|
123238
|
+
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));
|
|
123239
|
+
}
|
|
123240
|
+
}
|
|
123241
|
+
else {
|
|
123242
|
+
resolution = loader(name, containingFile, compilerOptions, ((_c = resolutionHost.getCompilerHost) === null || _c === void 0 ? void 0 : _c.call(resolutionHost)) || resolutionHost, redirectedReference, containingSourceFile, mode);
|
|
123243
|
+
perDirectoryResolution.set(name, mode, resolution);
|
|
123244
|
+
if (resolutionHost.onDiscoveredSymlink && resolutionIsSymlink(resolution)) {
|
|
123245
|
+
resolutionHost.onDiscoveredSymlink();
|
|
123246
|
+
}
|
|
124285
123247
|
}
|
|
124286
|
-
resolutionsInFile.
|
|
123248
|
+
resolutionsInFile.set(name, mode, resolution);
|
|
123249
|
+
watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, path, getResolutionWithResolvedFileName);
|
|
124287
123250
|
if (existingResolution) {
|
|
124288
|
-
|
|
123251
|
+
stopWatchFailedLookupLocationOfResolution(existingResolution, path, getResolutionWithResolvedFileName);
|
|
124289
123252
|
}
|
|
124290
123253
|
if (logChanges && filesWithChangedSetOfUnresolvedImports && !resolutionIsEqualTo(existingResolution, resolution)) {
|
|
124291
123254
|
filesWithChangedSetOfUnresolvedImports.push(path);
|
|
@@ -124299,34 +123262,28 @@ var ts;
|
|
|
124299
123262
|
var resolved = getResolutionWithResolvedFileName(resolution);
|
|
124300
123263
|
ts.trace(host, loader === resolveModuleName ?
|
|
124301
123264
|
(resolved === null || resolved === void 0 ? void 0 : resolved.resolvedFileName) ?
|
|
124302
|
-
resolved.
|
|
123265
|
+
resolved.packagetId ?
|
|
124303
123266
|
ts.Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 :
|
|
124304
123267
|
ts.Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2 :
|
|
124305
123268
|
ts.Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_not_resolved :
|
|
124306
123269
|
(resolved === null || resolved === void 0 ? void 0 : resolved.resolvedFileName) ?
|
|
124307
|
-
resolved.
|
|
123270
|
+
resolved.packagetId ?
|
|
124308
123271
|
ts.Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 :
|
|
124309
123272
|
ts.Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved_to_2 :
|
|
124310
|
-
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.
|
|
123273
|
+
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));
|
|
124311
123274
|
}
|
|
124312
123275
|
}
|
|
124313
123276
|
ts.Debug.assert(resolution !== undefined && !resolution.isInvalidated);
|
|
124314
123277
|
seenNamesInFile.set(name, mode, true);
|
|
124315
|
-
resolvedModules.push(resolution);
|
|
123278
|
+
resolvedModules.push(getResolutionWithResolvedFileName(resolution));
|
|
124316
123279
|
}
|
|
124317
|
-
|
|
124318
|
-
|
|
124319
|
-
|
|
123280
|
+
// Stop watching and remove the unused name
|
|
123281
|
+
resolutionsInFile.forEach(function (resolution, name, mode) {
|
|
123282
|
+
if (!seenNamesInFile.has(name, mode) && !ts.contains(reusedNames, name)) {
|
|
123283
|
+
stopWatchFailedLookupLocationOfResolution(resolution, path, getResolutionWithResolvedFileName);
|
|
123284
|
+
resolutionsInFile.delete(name, mode);
|
|
123285
|
+
}
|
|
124320
123286
|
});
|
|
124321
|
-
if (resolutionsInFile.cache.size() !== seenNamesInFile.size()) {
|
|
124322
|
-
// Stop watching and remove the unused name
|
|
124323
|
-
resolutionsInFile.cache.forEach(function (resolution, name, mode) {
|
|
124324
|
-
if (!seenNamesInFile.has(name, mode)) {
|
|
124325
|
-
stopWatchingResolution(resolution, path, getResolutionWithResolvedFileName);
|
|
124326
|
-
resolutionsInFile.cache.delete(name, mode);
|
|
124327
|
-
}
|
|
124328
|
-
});
|
|
124329
|
-
}
|
|
124330
123287
|
return resolvedModules;
|
|
124331
123288
|
function resolutionIsEqualTo(oldResolution, newResolution) {
|
|
124332
123289
|
if (oldResolution === newResolution) {
|
|
@@ -124346,31 +123303,40 @@ var ts;
|
|
|
124346
123303
|
return oldResult.resolvedFileName === newResult.resolvedFileName;
|
|
124347
123304
|
}
|
|
124348
123305
|
}
|
|
124349
|
-
function resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference, containingFileMode
|
|
123306
|
+
function resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference, containingFileMode) {
|
|
124350
123307
|
return resolveNamesWithLocalCache({
|
|
124351
123308
|
names: typeDirectiveNames,
|
|
124352
123309
|
containingFile: containingFile,
|
|
124353
123310
|
redirectedReference: redirectedReference,
|
|
124354
|
-
|
|
123311
|
+
cache: resolvedTypeReferenceDirectives,
|
|
123312
|
+
perDirectoryCacheWithRedirects: perDirectoryResolvedTypeReferenceDirectives,
|
|
124355
123313
|
loader: resolveTypeReferenceDirective,
|
|
124356
|
-
getResolutionWithResolvedFileName:
|
|
124357
|
-
|
|
124358
|
-
|
|
123314
|
+
getResolutionWithResolvedFileName: getResolvedTypeReferenceDirective,
|
|
123315
|
+
shouldRetryResolution: function (resolution) { return resolution.resolvedTypeReferenceDirective === undefined; },
|
|
123316
|
+
containingSourceFileMode: containingFileMode
|
|
124359
123317
|
});
|
|
124360
123318
|
}
|
|
124361
|
-
function resolveModuleNames(moduleNames, containingFile, redirectedReference, containingSourceFile
|
|
123319
|
+
function resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference, containingSourceFile) {
|
|
124362
123320
|
return resolveNamesWithLocalCache({
|
|
124363
123321
|
names: moduleNames,
|
|
124364
123322
|
containingFile: containingFile,
|
|
124365
123323
|
redirectedReference: redirectedReference,
|
|
124366
|
-
|
|
123324
|
+
cache: resolvedModuleNames,
|
|
123325
|
+
perDirectoryCacheWithRedirects: perDirectoryResolvedModuleNames,
|
|
124367
123326
|
loader: resolveModuleName,
|
|
124368
|
-
getResolutionWithResolvedFileName:
|
|
124369
|
-
|
|
123327
|
+
getResolutionWithResolvedFileName: getResolvedModule,
|
|
123328
|
+
shouldRetryResolution: function (resolution) { return !resolution.resolvedModule || !ts.resolutionExtensionIsTSOrJson(resolution.resolvedModule.extension); },
|
|
123329
|
+
reusedNames: reusedNames,
|
|
124370
123330
|
logChanges: logChangesWhenResolvingModule,
|
|
124371
123331
|
containingSourceFile: containingSourceFile,
|
|
124372
123332
|
});
|
|
124373
123333
|
}
|
|
123334
|
+
function getResolvedModuleWithFailedLookupLocationsFromCache(moduleName, containingFile, resolutionMode) {
|
|
123335
|
+
var cache = resolvedModuleNames.get(resolutionHost.toPath(containingFile));
|
|
123336
|
+
if (!cache)
|
|
123337
|
+
return undefined;
|
|
123338
|
+
return cache.get(moduleName, resolutionMode);
|
|
123339
|
+
}
|
|
124374
123340
|
function isNodeModulesAtTypesDirectory(dirPath) {
|
|
124375
123341
|
return ts.endsWith(dirPath, "/node_modules/@types");
|
|
124376
123342
|
}
|
|
@@ -124430,42 +123396,37 @@ var ts;
|
|
|
124430
123396
|
function isPathWithDefaultFailedLookupExtension(path) {
|
|
124431
123397
|
return ts.fileExtensionIsOneOf(path, failedLookupDefaultExtensions);
|
|
124432
123398
|
}
|
|
124433
|
-
function
|
|
124434
|
-
if (resolution.
|
|
124435
|
-
resolution.
|
|
124436
|
-
|
|
124437
|
-
watchFailedLookupLocationOfResolution(resolution);
|
|
124438
|
-
watchAffectingLocationsOfResolution(resolution);
|
|
124439
|
-
return;
|
|
124440
|
-
}
|
|
124441
|
-
resolution.files = new ts.Set();
|
|
124442
|
-
resolution.files.add(filePath);
|
|
124443
|
-
var resolved = getResolutionWithResolvedFileName(resolution);
|
|
124444
|
-
if (resolved && resolved.resolvedFileName) {
|
|
124445
|
-
resolvedFileToResolution.add(resolutionHost.toPath(resolved.resolvedFileName), resolution);
|
|
124446
|
-
}
|
|
124447
|
-
if (ts.isExternalModuleNameRelative(name) || !newProgram.getTypeChecker().tryFindAmbientModuleWithoutAugmentations(name)) {
|
|
124448
|
-
watchFailedLookupLocationOfResolution(resolution);
|
|
124449
|
-
watchAffectingLocationsOfResolution(resolution);
|
|
123399
|
+
function watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, filePath, getResolutionWithResolvedFileName) {
|
|
123400
|
+
if (resolution.refCount) {
|
|
123401
|
+
resolution.refCount++;
|
|
123402
|
+
ts.Debug.assertIsDefined(resolution.files);
|
|
124450
123403
|
}
|
|
124451
123404
|
else {
|
|
124452
|
-
resolution.
|
|
124453
|
-
|
|
123405
|
+
resolution.refCount = 1;
|
|
123406
|
+
ts.Debug.assert(ts.length(resolution.files) === 0); // This resolution shouldnt be referenced by any file yet
|
|
123407
|
+
if (ts.isExternalModuleNameRelative(name)) {
|
|
123408
|
+
watchFailedLookupLocationOfResolution(resolution);
|
|
123409
|
+
}
|
|
123410
|
+
else {
|
|
123411
|
+
nonRelativeExternalModuleResolutions.add(name, resolution);
|
|
123412
|
+
}
|
|
123413
|
+
var resolved = getResolutionWithResolvedFileName(resolution);
|
|
123414
|
+
if (resolved && resolved.resolvedFileName) {
|
|
123415
|
+
resolvedFileToResolution.add(resolutionHost.toPath(resolved.resolvedFileName), resolution);
|
|
123416
|
+
}
|
|
124454
123417
|
}
|
|
123418
|
+
(resolution.files || (resolution.files = [])).push(filePath);
|
|
124455
123419
|
}
|
|
124456
123420
|
function watchFailedLookupLocationOfResolution(resolution) {
|
|
124457
|
-
|
|
124458
|
-
|
|
123421
|
+
ts.Debug.assert(!!resolution.refCount);
|
|
123422
|
+
var failedLookupLocations = resolution.failedLookupLocations, affectingLocations = resolution.affectingLocations;
|
|
123423
|
+
if (!failedLookupLocations.length && !affectingLocations.length)
|
|
124459
123424
|
return;
|
|
124460
|
-
if (
|
|
123425
|
+
if (failedLookupLocations.length)
|
|
124461
123426
|
resolutionsWithFailedLookups.push(resolution);
|
|
124462
|
-
|
|
124463
|
-
|
|
124464
|
-
|
|
124465
|
-
}
|
|
124466
|
-
var setAtRoot = !!resolution.setAtRoot;
|
|
124467
|
-
for (var i = resolution.watchedFailed || 0; i < failedLookupLocations.length; i++) {
|
|
124468
|
-
var failedLookupLocation = failedLookupLocations[i];
|
|
123427
|
+
var setAtRoot = false;
|
|
123428
|
+
for (var _i = 0, failedLookupLocations_1 = failedLookupLocations; _i < failedLookupLocations_1.length; _i++) {
|
|
123429
|
+
var failedLookupLocation = failedLookupLocations_1[_i];
|
|
124469
123430
|
var failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
|
|
124470
123431
|
var toWatch = getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath);
|
|
124471
123432
|
if (toWatch) {
|
|
@@ -124485,24 +123446,24 @@ var ts;
|
|
|
124485
123446
|
}
|
|
124486
123447
|
}
|
|
124487
123448
|
}
|
|
124488
|
-
if (setAtRoot
|
|
123449
|
+
if (setAtRoot) {
|
|
124489
123450
|
// This is always non recursive
|
|
124490
|
-
setDirectoryWatcher(rootDir, rootPath, /*nonRecursive*/ true);
|
|
123451
|
+
setDirectoryWatcher(rootDir, rootPath, /*nonRecursive*/ true); // TODO: GH#18217
|
|
124491
123452
|
}
|
|
124492
|
-
resolution.
|
|
124493
|
-
resolution.watchedFailed = failedLookupLocations.length;
|
|
123453
|
+
watchAffectingLocationsOfResolution(resolution, !failedLookupLocations.length);
|
|
124494
123454
|
}
|
|
124495
|
-
function watchAffectingLocationsOfResolution(resolution) {
|
|
123455
|
+
function watchAffectingLocationsOfResolution(resolution, addToResolutionsWithOnlyAffectingLocations) {
|
|
123456
|
+
ts.Debug.assert(!!resolution.refCount);
|
|
124496
123457
|
var affectingLocations = resolution.affectingLocations;
|
|
124497
|
-
if (!
|
|
123458
|
+
if (!affectingLocations.length)
|
|
124498
123459
|
return;
|
|
124499
|
-
if (
|
|
123460
|
+
if (addToResolutionsWithOnlyAffectingLocations)
|
|
124500
123461
|
resolutionsWithOnlyAffectingLocations.push(resolution);
|
|
124501
123462
|
// Watch package json
|
|
124502
|
-
for (var
|
|
124503
|
-
|
|
123463
|
+
for (var _i = 0, affectingLocations_1 = affectingLocations; _i < affectingLocations_1.length; _i++) {
|
|
123464
|
+
var affectingLocation = affectingLocations_1[_i];
|
|
123465
|
+
createFileWatcherOfAffectingLocation(affectingLocation, /*forResolution*/ true);
|
|
124504
123466
|
}
|
|
124505
|
-
resolution.watchedAffected = affectingLocations.length;
|
|
124506
123467
|
}
|
|
124507
123468
|
function createFileWatcherOfAffectingLocation(affectingLocation, forResolution) {
|
|
124508
123469
|
var fileWatcher = fileWatchesOfAffectingLocations.get(affectingLocation);
|
|
@@ -124562,6 +123523,15 @@ var ts;
|
|
|
124562
123523
|
paths.add(affectingLocation);
|
|
124563
123524
|
}
|
|
124564
123525
|
}
|
|
123526
|
+
function watchFailedLookupLocationOfNonRelativeModuleResolutions(resolutions, name) {
|
|
123527
|
+
var program = resolutionHost.getCurrentProgram();
|
|
123528
|
+
if (!program || !program.getTypeChecker().tryFindAmbientModuleWithoutAugmentations(name)) {
|
|
123529
|
+
resolutions.forEach(watchFailedLookupLocationOfResolution);
|
|
123530
|
+
}
|
|
123531
|
+
else {
|
|
123532
|
+
resolutions.forEach(function (resolution) { return watchAffectingLocationsOfResolution(resolution, /*addToResolutionWithOnlyAffectingLocations*/ true); });
|
|
123533
|
+
}
|
|
123534
|
+
}
|
|
124565
123535
|
function setDirectoryWatcher(dir, dirPath, nonRecursive) {
|
|
124566
123536
|
var dirWatcher = directoryWatchesOfFailedLookups.get(dirPath);
|
|
124567
123537
|
if (dirWatcher) {
|
|
@@ -124572,28 +123542,21 @@ var ts;
|
|
|
124572
123542
|
directoryWatchesOfFailedLookups.set(dirPath, { watcher: createDirectoryWatcher(dir, dirPath, nonRecursive), refCount: 1, nonRecursive: nonRecursive });
|
|
124573
123543
|
}
|
|
124574
123544
|
}
|
|
124575
|
-
function
|
|
124576
|
-
|
|
124577
|
-
|
|
124578
|
-
if (
|
|
124579
|
-
(resolutionsToCloseWatcherOn !== null && resolutionsToCloseWatcherOn !== void 0 ? resolutionsToCloseWatcherOn : (resolutionsToCloseWatcherOn = [])).push({ resolution: resolution, getResolved: getResolutionWithResolvedFileName });
|
|
124580
|
-
}
|
|
124581
|
-
function closeWatchersOfResolution(_a) {
|
|
124582
|
-
var _b;
|
|
124583
|
-
var resolution = _a.resolution, getResolved = _a.getResolved;
|
|
124584
|
-
// If some files are using this resolution or we have already closed all watchers ignore
|
|
124585
|
-
if (((_b = resolution.files) === null || _b === void 0 ? void 0 : _b.size) || !resolution.files)
|
|
123545
|
+
function stopWatchFailedLookupLocationOfResolution(resolution, filePath, getResolutionWithResolvedFileName) {
|
|
123546
|
+
ts.unorderedRemoveItem(ts.Debug.checkDefined(resolution.files), filePath);
|
|
123547
|
+
resolution.refCount--;
|
|
123548
|
+
if (resolution.refCount) {
|
|
124586
123549
|
return;
|
|
124587
|
-
|
|
124588
|
-
var resolved =
|
|
123550
|
+
}
|
|
123551
|
+
var resolved = getResolutionWithResolvedFileName(resolution);
|
|
124589
123552
|
if (resolved && resolved.resolvedFileName) {
|
|
124590
123553
|
resolvedFileToResolution.remove(resolutionHost.toPath(resolved.resolvedFileName), resolution);
|
|
124591
123554
|
}
|
|
124592
|
-
|
|
124593
|
-
|
|
123555
|
+
var failedLookupLocations = resolution.failedLookupLocations, affectingLocations = resolution.affectingLocations;
|
|
123556
|
+
if (ts.unorderedRemoveItem(resolutionsWithFailedLookups, resolution)) {
|
|
124594
123557
|
var removeAtRoot = false;
|
|
124595
|
-
for (var
|
|
124596
|
-
var failedLookupLocation =
|
|
123558
|
+
for (var _i = 0, failedLookupLocations_2 = failedLookupLocations; _i < failedLookupLocations_2.length; _i++) {
|
|
123559
|
+
var failedLookupLocation = failedLookupLocations_2[_i];
|
|
124597
123560
|
var failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
|
|
124598
123561
|
var toWatch = getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath);
|
|
124599
123562
|
if (toWatch) {
|
|
@@ -124616,28 +123579,23 @@ var ts;
|
|
|
124616
123579
|
}
|
|
124617
123580
|
}
|
|
124618
123581
|
}
|
|
124619
|
-
ts.Debug.assert(resolution.setAtRoot === removeAtRoot);
|
|
124620
123582
|
if (removeAtRoot) {
|
|
124621
123583
|
removeDirectoryWatcher(rootPath);
|
|
124622
123584
|
}
|
|
124623
123585
|
}
|
|
124624
|
-
else if (
|
|
123586
|
+
else if (affectingLocations.length) {
|
|
124625
123587
|
ts.unorderedRemoveItem(resolutionsWithOnlyAffectingLocations, resolution);
|
|
124626
123588
|
}
|
|
124627
|
-
|
|
124628
|
-
|
|
124629
|
-
|
|
124630
|
-
|
|
124631
|
-
}
|
|
123589
|
+
for (var _a = 0, affectingLocations_2 = affectingLocations; _a < affectingLocations_2.length; _a++) {
|
|
123590
|
+
var affectingLocation = affectingLocations_2[_a];
|
|
123591
|
+
var watcher = fileWatchesOfAffectingLocations.get(affectingLocation);
|
|
123592
|
+
watcher.resolutions--;
|
|
124632
123593
|
}
|
|
124633
123594
|
}
|
|
124634
123595
|
function removeDirectoryWatcher(dirPath) {
|
|
124635
123596
|
var dirWatcher = directoryWatchesOfFailedLookups.get(dirPath);
|
|
123597
|
+
// Do not close the watcher yet since it might be needed by other failed lookup locations.
|
|
124636
123598
|
dirWatcher.refCount--;
|
|
124637
|
-
if (dirWatcher.refCount === 0) {
|
|
124638
|
-
directoryWatchesOfFailedLookups.delete(dirPath);
|
|
124639
|
-
dirWatcher.watcher.close();
|
|
124640
|
-
}
|
|
124641
123599
|
}
|
|
124642
123600
|
function createDirectoryWatcher(directory, dirPath, nonRecursive) {
|
|
124643
123601
|
return resolutionHost.watchDirectoryOfFailedLookupLocation(directory, function (fileOrDirectory) {
|
|
@@ -124653,16 +123611,28 @@ var ts;
|
|
|
124653
123611
|
// Deleted file, stop watching failed lookups for all the resolutions in the file
|
|
124654
123612
|
var resolutions = cache.get(filePath);
|
|
124655
123613
|
if (resolutions) {
|
|
124656
|
-
resolutions.
|
|
123614
|
+
resolutions.forEach(function (resolution) { return stopWatchFailedLookupLocationOfResolution(resolution, filePath, getResolutionWithResolvedFileName); });
|
|
124657
123615
|
cache.delete(filePath);
|
|
124658
123616
|
}
|
|
124659
123617
|
}
|
|
123618
|
+
function removeResolutionsFromProjectReferenceRedirects(filePath) {
|
|
123619
|
+
if (!ts.fileExtensionIs(filePath, ".json" /* Json */))
|
|
123620
|
+
return;
|
|
123621
|
+
var program = resolutionHost.getCurrentProgram();
|
|
123622
|
+
if (!program)
|
|
123623
|
+
return;
|
|
123624
|
+
// If this file is input file for the referenced project, get it
|
|
123625
|
+
var resolvedProjectReference = program.getResolvedProjectReferenceByPath(filePath);
|
|
123626
|
+
if (!resolvedProjectReference)
|
|
123627
|
+
return;
|
|
123628
|
+
// filePath is for the projectReference and the containing file is from this project reference, invalidate the resolution
|
|
123629
|
+
resolvedProjectReference.commandLine.fileNames.forEach(function (f) { return removeResolutionsOfFile(resolutionHost.toPath(f)); });
|
|
123630
|
+
}
|
|
124660
123631
|
function removeResolutionsOfFile(filePath) {
|
|
124661
|
-
removeResolutionsOfFileFromCache(resolvedModuleNames, filePath,
|
|
124662
|
-
removeResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath,
|
|
123632
|
+
removeResolutionsOfFileFromCache(resolvedModuleNames, filePath, getResolvedModule);
|
|
123633
|
+
removeResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath, getResolvedTypeReferenceDirective);
|
|
124663
123634
|
}
|
|
124664
123635
|
function invalidateResolutions(resolutions, canInvalidate) {
|
|
124665
|
-
var _a;
|
|
124666
123636
|
if (!resolutions)
|
|
124667
123637
|
return false;
|
|
124668
123638
|
var invalidated = false;
|
|
@@ -124671,15 +123641,17 @@ var ts;
|
|
|
124671
123641
|
if (resolution.isInvalidated || !canInvalidate(resolution))
|
|
124672
123642
|
continue;
|
|
124673
123643
|
resolution.isInvalidated = invalidated = true;
|
|
124674
|
-
(_a = resolution.files)
|
|
123644
|
+
for (var _a = 0, _b = ts.Debug.checkDefined(resolution.files); _a < _b.length; _a++) {
|
|
123645
|
+
var containingFilePath = _b[_a];
|
|
124675
123646
|
(filesWithInvalidatedResolutions !== null && filesWithInvalidatedResolutions !== void 0 ? filesWithInvalidatedResolutions : (filesWithInvalidatedResolutions = new ts.Set())).add(containingFilePath);
|
|
124676
123647
|
// When its a file with inferred types resolution, invalidate type reference directive resolution
|
|
124677
123648
|
hasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames || ts.endsWith(containingFilePath, ts.inferredTypesContainingFile);
|
|
124678
|
-
}
|
|
123649
|
+
}
|
|
124679
123650
|
}
|
|
124680
123651
|
return invalidated;
|
|
124681
123652
|
}
|
|
124682
123653
|
function invalidateResolutionOfFile(filePath) {
|
|
123654
|
+
removeResolutionsOfFile(filePath);
|
|
124683
123655
|
// Resolution is invalidated if the resulting file name is same as the deleted file path
|
|
124684
123656
|
var prevHasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames;
|
|
124685
123657
|
if (invalidateResolutions(resolvedFileToResolution.get(filePath), ts.returnTrue) &&
|
|
@@ -124689,28 +123661,8 @@ var ts;
|
|
|
124689
123661
|
}
|
|
124690
123662
|
}
|
|
124691
123663
|
function setFilesWithInvalidatedNonRelativeUnresolvedImports(filesMap) {
|
|
124692
|
-
|
|
124693
|
-
|
|
124694
|
-
if (!imports.length)
|
|
124695
|
-
return;
|
|
124696
|
-
var resolvedModules = resolvedModuleNames.get(filePath);
|
|
124697
|
-
var resolvedTypeRefs = resolvedTypeReferenceDirectives.get(filePath);
|
|
124698
|
-
if (!(resolvedModules === null || resolvedModules === void 0 ? void 0 : resolvedModules.cache.size()) && !(resolvedTypeRefs === null || resolvedTypeRefs === void 0 ? void 0 : resolvedTypeRefs.cache.size()))
|
|
124699
|
-
return;
|
|
124700
|
-
imports.forEach(function (_a) {
|
|
124701
|
-
var name = _a.name, mode = _a.mode;
|
|
124702
|
-
var resolvedModule = resolvedModules === null || resolvedModules === void 0 ? void 0 : resolvedModules.cache.get(name, mode);
|
|
124703
|
-
if (resolvedModule && !resolvedModule.isInvalidated && (!resolvedModule.resolvedModule || !ts.resolutionExtensionIsTSOrJson(resolvedModule.resolvedModule.extension))) {
|
|
124704
|
-
resolvedModule.isInvalidated = true;
|
|
124705
|
-
(filesWithInvalidatedResolutions !== null && filesWithInvalidatedResolutions !== void 0 ? filesWithInvalidatedResolutions : (filesWithInvalidatedResolutions = new ts.Set())).add(filePath);
|
|
124706
|
-
}
|
|
124707
|
-
var resolvedTypeRef = resolvedTypeRefs === null || resolvedTypeRefs === void 0 ? void 0 : resolvedTypeRefs.cache.get(name, mode);
|
|
124708
|
-
if (resolvedTypeRef && !resolvedTypeRef.isInvalidated && !resolvedTypeRef.resolvedTypeReferenceDirective) {
|
|
124709
|
-
resolvedTypeRef.isInvalidated = true;
|
|
124710
|
-
(filesWithInvalidatedResolutions !== null && filesWithInvalidatedResolutions !== void 0 ? filesWithInvalidatedResolutions : (filesWithInvalidatedResolutions = new ts.Set())).add(filePath);
|
|
124711
|
-
}
|
|
124712
|
-
});
|
|
124713
|
-
});
|
|
123664
|
+
ts.Debug.assert(filesWithInvalidatedNonRelativeUnresolvedImports === filesMap || filesWithInvalidatedNonRelativeUnresolvedImports === undefined);
|
|
123665
|
+
filesWithInvalidatedNonRelativeUnresolvedImports = filesMap;
|
|
124714
123666
|
}
|
|
124715
123667
|
function scheduleInvalidateResolutionOfFailedLookupLocation(fileOrDirectoryPath, isCreatingWatchedDirectory) {
|
|
124716
123668
|
if (isCreatingWatchedDirectory) {
|
|
@@ -124761,17 +123713,12 @@ var ts;
|
|
|
124761
123713
|
var _a;
|
|
124762
123714
|
var invalidated = false;
|
|
124763
123715
|
if (affectingPathChecksForFile) {
|
|
124764
|
-
|
|
124765
|
-
|
|
124766
|
-
|
|
124767
|
-
continue;
|
|
124768
|
-
if (ts.some(scope.failedLookupLocations, function (location) { return affectingPathChecksForFile.has(location); }) ||
|
|
124769
|
-
ts.some(scope.affectingLocations, function (location) { return affectingPathChecksForFile.has(location); })) {
|
|
124770
|
-
scope.isInvalidated = true;
|
|
123716
|
+
(_a = resolutionHost.getCurrentProgram()) === null || _a === void 0 ? void 0 : _a.getSourceFiles().forEach(function (f) {
|
|
123717
|
+
if (ts.some(f.packageJsonLocations, function (location) { return affectingPathChecksForFile.has(location); })) {
|
|
123718
|
+
(filesWithInvalidatedResolutions !== null && filesWithInvalidatedResolutions !== void 0 ? filesWithInvalidatedResolutions : (filesWithInvalidatedResolutions = new ts.Set())).add(f.path);
|
|
124771
123719
|
invalidated = true;
|
|
124772
|
-
(_a = scope.files) === null || _a === void 0 ? void 0 : _a.forEach(function (path) { return (filesWithInvalidatedResolutions !== null && filesWithInvalidatedResolutions !== void 0 ? filesWithInvalidatedResolutions : (filesWithInvalidatedResolutions = new ts.Set())).add(path); });
|
|
124773
123720
|
}
|
|
124774
|
-
}
|
|
123721
|
+
});
|
|
124775
123722
|
affectingPathChecksForFile = undefined;
|
|
124776
123723
|
}
|
|
124777
123724
|
if (!failedLookupChecks && !startsWithPathChecks && !isInDirectoryChecks && !affectingPathChecks) {
|
|
@@ -124802,8 +123749,7 @@ var ts;
|
|
|
124802
123749
|
ts.firstDefinedIterator((isInDirectoryChecks === null || isInDirectoryChecks === void 0 ? void 0 : isInDirectoryChecks.keys()) || ts.emptyIterator, function (fileOrDirectoryPath) { return isInDirectoryPath(fileOrDirectoryPath, locationPath) ? true : undefined; });
|
|
124803
123750
|
}
|
|
124804
123751
|
function canInvalidatedFailedLookupResolutionWithAffectingLocation(resolution) {
|
|
124805
|
-
|
|
124806
|
-
return !!affectingPathChecks && !!((_a = resolution.affectingLocations) === null || _a === void 0 ? void 0 : _a.some(function (location) { return affectingPathChecks.has(location); }));
|
|
123752
|
+
return !!affectingPathChecks && resolution.affectingLocations.some(function (location) { return affectingPathChecks.has(location); });
|
|
124807
123753
|
}
|
|
124808
123754
|
function closeTypeRootsWatch() {
|
|
124809
123755
|
ts.clearMap(typeRootsWatches, ts.closeFileWatcher);
|
|
@@ -125192,9 +124138,9 @@ var ts;
|
|
|
125192
124138
|
if (!preferSymlinks) {
|
|
125193
124139
|
// Symlinks inside ignored paths are already filtered out of the symlink cache,
|
|
125194
124140
|
// so we only need to remove them from the realpath filenames.
|
|
125195
|
-
var
|
|
125196
|
-
if (
|
|
125197
|
-
return
|
|
124141
|
+
var result_16 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
|
|
124142
|
+
if (result_16)
|
|
124143
|
+
return result_16;
|
|
125198
124144
|
}
|
|
125199
124145
|
var symlinkedDirectories = (_a = host.getSymlinkCache) === null || _a === void 0 ? void 0 : _a.call(host).getSymlinkedDirectoriesByRealpath();
|
|
125200
124146
|
var fullImportedFileName = ts.getNormalizedAbsolutePath(importedFileName, cwd);
|
|
@@ -125214,10 +124160,10 @@ var ts;
|
|
|
125214
124160
|
for (var _i = 0, symlinkDirectories_1 = symlinkDirectories; _i < symlinkDirectories_1.length; _i++) {
|
|
125215
124161
|
var symlinkDirectory = symlinkDirectories_1[_i];
|
|
125216
124162
|
var option = ts.resolvePath(symlinkDirectory, relative);
|
|
125217
|
-
var
|
|
124163
|
+
var result_17 = cb(option, target === referenceRedirect);
|
|
125218
124164
|
shouldFilterIgnoredPaths = true; // We found a non-ignored path in symlinks, so we can reject ignored-path realpaths
|
|
125219
|
-
if (
|
|
125220
|
-
return
|
|
124165
|
+
if (result_17)
|
|
124166
|
+
return result_17;
|
|
125221
124167
|
}
|
|
125222
124168
|
});
|
|
125223
124169
|
});
|
|
@@ -125283,9 +124229,9 @@ var ts;
|
|
|
125283
124229
|
};
|
|
125284
124230
|
var out_directory_1;
|
|
125285
124231
|
for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) {
|
|
125286
|
-
var
|
|
124232
|
+
var state_11 = _loop_35(directory);
|
|
125287
124233
|
directory = out_directory_1;
|
|
125288
|
-
if (
|
|
124234
|
+
if (state_11 === "break")
|
|
125289
124235
|
break;
|
|
125290
124236
|
}
|
|
125291
124237
|
if (allFileNames.size) {
|
|
@@ -125421,9 +124367,9 @@ var ts;
|
|
|
125421
124367
|
};
|
|
125422
124368
|
for (var _i = 0, _a = paths[key]; _i < _a.length; _i++) {
|
|
125423
124369
|
var patternText_1 = _a[_i];
|
|
125424
|
-
var
|
|
125425
|
-
if (typeof
|
|
125426
|
-
return
|
|
124370
|
+
var state_12 = _loop_36(patternText_1);
|
|
124371
|
+
if (typeof state_12 === "object")
|
|
124372
|
+
return state_12.value;
|
|
125427
124373
|
}
|
|
125428
124374
|
}
|
|
125429
124375
|
function validateEnding(_a) {
|
|
@@ -125928,7 +124874,7 @@ var ts;
|
|
|
125928
124874
|
}
|
|
125929
124875
|
ts.explainFiles = explainFiles;
|
|
125930
124876
|
function explainIfFileIsRedirectAndImpliedFormat(file, fileNameConvertor) {
|
|
125931
|
-
var _a
|
|
124877
|
+
var _a;
|
|
125932
124878
|
var result;
|
|
125933
124879
|
if (file.path !== file.resolvedPath) {
|
|
125934
124880
|
(result !== null && result !== void 0 ? result : (result = [])).push(ts.chainDiagnosticMessages(
|
|
@@ -125941,19 +124887,19 @@ var ts;
|
|
|
125941
124887
|
if (ts.isExternalOrCommonJsModule(file)) {
|
|
125942
124888
|
switch (file.impliedNodeFormat) {
|
|
125943
124889
|
case ts.ModuleKind.ESNext:
|
|
125944
|
-
if (
|
|
124890
|
+
if (file.packageJsonScope) {
|
|
125945
124891
|
(result !== null && result !== void 0 ? result : (result = [])).push(ts.chainDiagnosticMessages(
|
|
125946
|
-
/*details*/ undefined, ts.Diagnostics.File_is_ECMAScript_module_because_0_has_field_type_with_value_module, toFileName(ts.
|
|
124892
|
+
/*details*/ undefined, ts.Diagnostics.File_is_ECMAScript_module_because_0_has_field_type_with_value_module, toFileName(ts.last(file.packageJsonLocations), fileNameConvertor)));
|
|
125947
124893
|
}
|
|
125948
124894
|
break;
|
|
125949
124895
|
case ts.ModuleKind.CommonJS:
|
|
125950
|
-
if (
|
|
124896
|
+
if (file.packageJsonScope) {
|
|
125951
124897
|
(result !== null && result !== void 0 ? result : (result = [])).push(ts.chainDiagnosticMessages(
|
|
125952
|
-
/*details*/ undefined, file.packageJsonScope.
|
|
124898
|
+
/*details*/ undefined, file.packageJsonScope.packageJsonContent.type ?
|
|
125953
124899
|
ts.Diagnostics.File_is_CommonJS_module_because_0_has_field_type_whose_value_is_not_module :
|
|
125954
|
-
ts.Diagnostics.File_is_CommonJS_module_because_0_does_not_have_field_type, toFileName(ts.
|
|
124900
|
+
ts.Diagnostics.File_is_CommonJS_module_because_0_does_not_have_field_type, toFileName(ts.last(file.packageJsonLocations), fileNameConvertor)));
|
|
125955
124901
|
}
|
|
125956
|
-
else if (file.
|
|
124902
|
+
else if ((_a = file.packageJsonLocations) === null || _a === void 0 ? void 0 : _a.length) {
|
|
125957
124903
|
(result !== null && result !== void 0 ? result : (result = [])).push(ts.chainDiagnosticMessages(
|
|
125958
124904
|
/*details*/ undefined, ts.Diagnostics.File_is_CommonJS_module_because_package_json_was_not_found));
|
|
125959
124905
|
}
|
|
@@ -126331,8 +125277,7 @@ var ts;
|
|
|
126331
125277
|
})(ts || (ts = {}));
|
|
126332
125278
|
var ts;
|
|
126333
125279
|
(function (ts) {
|
|
126334
|
-
|
|
126335
|
-
function readBuildInfoForProgram(compilerOptions, host) {
|
|
125280
|
+
function readBuilderProgram(compilerOptions, host) {
|
|
126336
125281
|
var _a, _b, _c;
|
|
126337
125282
|
var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(compilerOptions);
|
|
126338
125283
|
if (!buildInfoPath)
|
|
@@ -126351,12 +125296,7 @@ var ts;
|
|
|
126351
125296
|
}
|
|
126352
125297
|
if (!buildInfo || buildInfo.version !== ts.version || !buildInfo.program)
|
|
126353
125298
|
return undefined;
|
|
126354
|
-
return
|
|
126355
|
-
}
|
|
126356
|
-
ts.readBuildInfoForProgram = readBuildInfoForProgram;
|
|
126357
|
-
function readBuilderProgram(compilerOptions, host) {
|
|
126358
|
-
var result = readBuildInfoForProgram(compilerOptions, host);
|
|
126359
|
-
return result && ts.createBuilderProgramUsingProgramBuildInfo(result.buildInfo.program, result.buildInfoPath, host, compilerOptions.configFilePath);
|
|
125299
|
+
return ts.createBuilderProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host);
|
|
126360
125300
|
}
|
|
126361
125301
|
ts.readBuilderProgram = readBuilderProgram;
|
|
126362
125302
|
function createIncrementalCompilerHost(options, system) {
|
|
@@ -126495,7 +125435,7 @@ var ts;
|
|
|
126495
125435
|
}
|
|
126496
125436
|
return host.resolveModuleNames.apply(host, args);
|
|
126497
125437
|
}) :
|
|
126498
|
-
(function (moduleNames, containingFile,
|
|
125438
|
+
(function (moduleNames, containingFile, reusedNames, redirectedReference, _options, sourceFile) { return resolutionCache.resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference, sourceFile); });
|
|
126499
125439
|
compilerHost.resolveTypeReferenceDirectives = host.resolveTypeReferenceDirectives ?
|
|
126500
125440
|
(function () {
|
|
126501
125441
|
var args = [];
|
|
@@ -126504,13 +125444,10 @@ var ts;
|
|
|
126504
125444
|
}
|
|
126505
125445
|
return host.resolveTypeReferenceDirectives.apply(host, args);
|
|
126506
125446
|
}) :
|
|
126507
|
-
(function (typeDirectiveNames, containingFile, redirectedReference, _options, containingFileMode
|
|
125447
|
+
(function (typeDirectiveNames, containingFile, redirectedReference, _options, containingFileMode) { return resolutionCache.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference, containingFileMode); });
|
|
126508
125448
|
compilerHost.getModuleResolutionCache = host.resolveModuleNames ?
|
|
126509
125449
|
ts.maybeBind(host, host.getModuleResolutionCache) :
|
|
126510
125450
|
(function () { return resolutionCache.getModuleResolutionCache(); });
|
|
126511
|
-
compilerHost.getTypeReferenceDirectiveResolutionCache = host.resolveTypeReferenceDirectives ?
|
|
126512
|
-
ts.maybeBind(host, host.getTypeReferenceDirectiveResolutionCache) :
|
|
126513
|
-
(function () { return resolutionCache.getTypeReferenceDirectiveResolutionCache(); });
|
|
126514
125451
|
var userProvidedResolution = !!host.resolveModuleNames || !!host.resolveTypeReferenceDirectives;
|
|
126515
125452
|
builderProgram = readBuilderProgram(compilerOptions, compilerHost);
|
|
126516
125453
|
synchronizeProgram();
|
|
@@ -126613,6 +125550,7 @@ var ts;
|
|
|
126613
125550
|
writeLog(" options: " + JSON.stringify(compilerOptions));
|
|
126614
125551
|
if (projectReferences)
|
|
126615
125552
|
writeLog(" projectReferences: " + JSON.stringify(projectReferences));
|
|
125553
|
+
var needsUpdateInTypeRootWatch = hasChangedCompilerOptions || !getCurrentProgram();
|
|
126616
125554
|
hasChangedCompilerOptions = false;
|
|
126617
125555
|
hasChangedConfigFileParsingErrors = false;
|
|
126618
125556
|
resolutionCache.startCachingPerDirectoryResolution();
|
|
@@ -126623,6 +125561,9 @@ var ts;
|
|
|
126623
125561
|
resolutionCache.finishCachingPerDirectoryResolution(builderProgram.getProgram(), oldProgram);
|
|
126624
125562
|
// Update watches
|
|
126625
125563
|
ts.updateMissingFilePathsWatch(builderProgram.getProgram(), missingFilesMap || (missingFilesMap = new ts.Map()), watchMissingFilePath);
|
|
125564
|
+
if (needsUpdateInTypeRootWatch) {
|
|
125565
|
+
resolutionCache.updateTypeRootsWatch();
|
|
125566
|
+
}
|
|
126626
125567
|
if (missingFilePathsRequestedForRelease) {
|
|
126627
125568
|
// These are the paths that program creater told us as not in use any more but were missing on the disk.
|
|
126628
125569
|
// We didnt remove the entry for them from sourceFiles cache so that we dont have to do File IO,
|
|
@@ -126719,7 +125660,7 @@ var ts;
|
|
|
126719
125660
|
var hostSourceFile = sourceFilesCache.get(path);
|
|
126720
125661
|
return !hostSourceFile || !hostSourceFile.version ? undefined : hostSourceFile.version;
|
|
126721
125662
|
}
|
|
126722
|
-
function onReleaseOldSourceFile(oldSourceFile) {
|
|
125663
|
+
function onReleaseOldSourceFile(oldSourceFile, _oldOptions, hasSourceFileByPath) {
|
|
126723
125664
|
var hostSourceFileInfo = sourceFilesCache.get(oldSourceFile.resolvedPath);
|
|
126724
125665
|
// If this is the source file thats in the cache and new program doesnt need it,
|
|
126725
125666
|
// remove the cached entry.
|
|
@@ -126735,6 +125676,9 @@ var ts;
|
|
|
126735
125676
|
hostSourceFileInfo.fileWatcher.close();
|
|
126736
125677
|
}
|
|
126737
125678
|
sourceFilesCache.delete(oldSourceFile.resolvedPath);
|
|
125679
|
+
if (!hasSourceFileByPath) {
|
|
125680
|
+
resolutionCache.removeResolutionsOfFile(oldSourceFile.path);
|
|
125681
|
+
}
|
|
126738
125682
|
}
|
|
126739
125683
|
}
|
|
126740
125684
|
}
|
|
@@ -126991,6 +125935,7 @@ var ts;
|
|
|
126991
125935
|
var config = parsedConfigs === null || parsedConfigs === void 0 ? void 0 : parsedConfigs.get(projectPath);
|
|
126992
125936
|
if (config)
|
|
126993
125937
|
config.reloadLevel = ts.ConfigFileProgramReloadLevel.Full;
|
|
125938
|
+
resolutionCache.removeResolutionsFromProjectReferenceRedirects(projectPath);
|
|
126994
125939
|
}
|
|
126995
125940
|
scheduleProgramUpdate();
|
|
126996
125941
|
});
|
|
@@ -127004,6 +125949,7 @@ var ts;
|
|
|
127004
125949
|
var config = parsedConfigs === null || parsedConfigs === void 0 ? void 0 : parsedConfigs.get(configPath);
|
|
127005
125950
|
if (config)
|
|
127006
125951
|
config.reloadLevel = ts.ConfigFileProgramReloadLevel.Full;
|
|
125952
|
+
resolutionCache.removeResolutionsFromProjectReferenceRedirects(configPath);
|
|
127007
125953
|
scheduleProgramUpdate();
|
|
127008
125954
|
}, ts.PollingInterval.High, ((_a = commandLine.parsedCommandLine) === null || _a === void 0 ? void 0 : _a.watchOptions) || watchOptions, ts.WatchType.ConfigFileOfReferencedProject));
|
|
127009
125955
|
// Watch Wild card
|
|
@@ -127211,22 +126157,20 @@ var ts;
|
|
|
127211
126157
|
compilerHost.resolveModuleNames = ts.maybeBind(host, host.resolveModuleNames);
|
|
127212
126158
|
compilerHost.resolveTypeReferenceDirectives = ts.maybeBind(host, host.resolveTypeReferenceDirectives);
|
|
127213
126159
|
compilerHost.getModuleResolutionCache = ts.maybeBind(host, host.getModuleResolutionCache);
|
|
127214
|
-
compilerHost.getTypeReferenceDirectiveResolutionCache = ts.maybeBind(host, host.getTypeReferenceDirectiveResolutionCache);
|
|
127215
126160
|
var moduleResolutionCache = !compilerHost.resolveModuleNames ? ts.createModuleResolutionCache(currentDirectory, getCanonicalFileName) : undefined;
|
|
127216
126161
|
var typeReferenceDirectiveResolutionCache = !compilerHost.resolveTypeReferenceDirectives ? ts.createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, /*options*/ undefined, moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache()) : undefined;
|
|
127217
126162
|
if (!compilerHost.resolveModuleNames) {
|
|
127218
|
-
var loader_3 = function (moduleName, resolverMode, containingFile, redirectedReference) { return ts.resolveModuleName(moduleName, containingFile, state.projectCompilerOptions, compilerHost, moduleResolutionCache, redirectedReference, resolverMode); };
|
|
127219
|
-
compilerHost.resolveModuleNames = function (moduleNames, containingFile, _reusedNames, redirectedReference, _options, containingSourceFile
|
|
127220
|
-
return ts.loadWithModeAwareCache(moduleNames, ts.Debug.checkDefined(containingSourceFile), containingFile, redirectedReference,
|
|
126163
|
+
var loader_3 = function (moduleName, resolverMode, containingFile, redirectedReference) { return ts.resolveModuleName(moduleName, containingFile, state.projectCompilerOptions, compilerHost, moduleResolutionCache, redirectedReference, resolverMode).resolvedModule; };
|
|
126164
|
+
compilerHost.resolveModuleNames = function (moduleNames, containingFile, _reusedNames, redirectedReference, _options, containingSourceFile) {
|
|
126165
|
+
return ts.loadWithModeAwareCache(ts.Debug.checkEachDefined(moduleNames), ts.Debug.checkDefined(containingSourceFile), containingFile, redirectedReference, loader_3);
|
|
127221
126166
|
};
|
|
127222
126167
|
compilerHost.getModuleResolutionCache = function () { return moduleResolutionCache; };
|
|
127223
126168
|
}
|
|
127224
126169
|
if (!compilerHost.resolveTypeReferenceDirectives) {
|
|
127225
|
-
var loader_4 = function (moduleName, containingFile, redirectedReference, containingFileMode) { return ts.resolveTypeReferenceDirective(moduleName, containingFile, state.projectCompilerOptions, compilerHost, redirectedReference, state.typeReferenceDirectiveResolutionCache, containingFileMode); };
|
|
126170
|
+
var loader_4 = function (moduleName, containingFile, redirectedReference, containingFileMode) { return ts.resolveTypeReferenceDirective(moduleName, containingFile, state.projectCompilerOptions, compilerHost, redirectedReference, state.typeReferenceDirectiveResolutionCache, containingFileMode).resolvedTypeReferenceDirective; };
|
|
127226
126171
|
compilerHost.resolveTypeReferenceDirectives = function (typeReferenceDirectiveNames, containingFile, redirectedReference, _options, containingFileMode) {
|
|
127227
|
-
return ts.loadWithTypeDirectiveCache(typeReferenceDirectiveNames, containingFile, redirectedReference, containingFileMode, loader_4);
|
|
126172
|
+
return ts.loadWithTypeDirectiveCache(ts.Debug.checkEachDefined(typeReferenceDirectiveNames), containingFile, redirectedReference, containingFileMode, loader_4);
|
|
127228
126173
|
};
|
|
127229
|
-
compilerHost.getTypeReferenceDirectiveResolutionCache = function () { return typeReferenceDirectiveResolutionCache; };
|
|
127230
126174
|
}
|
|
127231
126175
|
compilerHost.getBuildInfo = function (fileName, options) { return getBuildInfo(state, fileName, options, toResolvedConfigFilePath(state, options.configFilePath), /*modifiedTime*/ undefined); };
|
|
127232
126176
|
var _a = ts.createWatchFactory(hostWithWatch, options), watchFile = _a.watchFile, watchDirectory = _a.watchDirectory, writeLog = _a.writeLog;
|
|
@@ -128237,7 +127181,7 @@ var ts;
|
|
|
128237
127181
|
if (buildInfoTime && buildInfoTime < inputTime) {
|
|
128238
127182
|
var version_3 = void 0;
|
|
128239
127183
|
var currentVersion = void 0;
|
|
128240
|
-
if (buildInfoProgram
|
|
127184
|
+
if (buildInfoProgram) {
|
|
128241
127185
|
// Read files and see if they are same, read is anyways cached
|
|
128242
127186
|
if (!buildInfoVersionMap)
|
|
128243
127187
|
buildInfoVersionMap = ts.getBuildInfoFileVersionMap(buildInfoProgram, buildInfoPath, host);
|