@typescript-deploys/pr-build 4.9.0-pr-50248-5 → 4.9.0-pr-50007-10
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 +1781 -766
- package/lib/tsserver.js +1979 -907
- package/lib/tsserverlibrary.d.ts +39 -33
- package/lib/tsserverlibrary.js +1979 -907
- package/lib/typescript.d.ts +37 -30
- package/lib/typescript.js +1919 -856
- package/lib/typescriptServices.d.ts +37 -30
- package/lib/typescriptServices.js +1919 -856
- package/lib/typingsInstaller.js +1871 -812
- package/package.json +1 -1
package/lib/tsc.js
CHANGED
|
@@ -6645,6 +6645,8 @@ var ts;
|
|
|
6645
6645
|
Found_1_error_in_1: diag(6259, ts.DiagnosticCategory.Message, "Found_1_error_in_1_6259", "Found 1 error in {1}"),
|
|
6646
6646
|
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}"),
|
|
6647
6647
|
Found_0_errors_in_1_files: diag(6261, ts.DiagnosticCategory.Message, "Found_0_errors_in_1_files_6261", "Found {0} errors in {1} files."),
|
|
6648
|
+
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."),
|
|
6649
|
+
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."),
|
|
6648
6650
|
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."),
|
|
6649
6651
|
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}'."),
|
|
6650
6652
|
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."),
|
|
@@ -6828,6 +6830,7 @@ var ts;
|
|
|
6828
6830
|
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."),
|
|
6829
6831
|
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."),
|
|
6830
6832
|
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."),
|
|
6833
|
+
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."),
|
|
6831
6834
|
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'."),
|
|
6832
6835
|
one_of_Colon: diag(6900, ts.DiagnosticCategory.Message, "one_of_Colon_6900", "one of:"),
|
|
6833
6836
|
one_or_more_Colon: diag(6901, ts.DiagnosticCategory.Message, "one_or_more_Colon_6901", "one or more:"),
|
|
@@ -10965,7 +10968,8 @@ var ts;
|
|
|
10965
10968
|
}
|
|
10966
10969
|
ts.changesAffectModuleResolution = changesAffectModuleResolution;
|
|
10967
10970
|
function optionsHaveModuleResolutionChanges(oldOptions, newOptions) {
|
|
10968
|
-
return
|
|
10971
|
+
return oldOptions.pathsBasePath !== newOptions.pathsBasePath ||
|
|
10972
|
+
optionsHaveChanges(oldOptions, newOptions, ts.moduleResolutionOptionDeclarations);
|
|
10969
10973
|
}
|
|
10970
10974
|
ts.optionsHaveModuleResolutionChanges = optionsHaveModuleResolutionChanges;
|
|
10971
10975
|
function changesAffectingProgramStructure(oldOptions, newOptions) {
|
|
@@ -11037,21 +11041,20 @@ var ts;
|
|
|
11037
11041
|
}
|
|
11038
11042
|
ts.getFullWidth = getFullWidth;
|
|
11039
11043
|
function getResolvedModule(sourceFile, moduleNameText, mode) {
|
|
11040
|
-
|
|
11044
|
+
var _a, _b;
|
|
11045
|
+
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;
|
|
11041
11046
|
}
|
|
11042
11047
|
ts.getResolvedModule = getResolvedModule;
|
|
11043
11048
|
function setResolvedModule(sourceFile, moduleNameText, resolvedModule, mode) {
|
|
11044
|
-
|
|
11045
|
-
|
|
11046
|
-
}
|
|
11049
|
+
var _a;
|
|
11050
|
+
(_a = sourceFile.resolvedModules) !== null && _a !== void 0 ? _a : (sourceFile.resolvedModules = ts.createModeAwareCache());
|
|
11047
11051
|
sourceFile.resolvedModules.set(moduleNameText, mode, resolvedModule);
|
|
11048
11052
|
}
|
|
11049
11053
|
ts.setResolvedModule = setResolvedModule;
|
|
11050
|
-
function setResolvedTypeReferenceDirective(sourceFile, typeReferenceDirectiveName, resolvedTypeReferenceDirective) {
|
|
11051
|
-
|
|
11052
|
-
|
|
11053
|
-
|
|
11054
|
-
sourceFile.resolvedTypeReferenceDirectiveNames.set(typeReferenceDirectiveName, undefined, resolvedTypeReferenceDirective);
|
|
11054
|
+
function setResolvedTypeReferenceDirective(sourceFile, typeReferenceDirectiveName, resolvedTypeReferenceDirective, mode) {
|
|
11055
|
+
var _a;
|
|
11056
|
+
(_a = sourceFile.resolvedTypeReferenceDirectiveNames) !== null && _a !== void 0 ? _a : (sourceFile.resolvedTypeReferenceDirectiveNames = ts.createModeAwareCache());
|
|
11057
|
+
sourceFile.resolvedTypeReferenceDirectiveNames.set(typeReferenceDirectiveName, mode, resolvedTypeReferenceDirective);
|
|
11055
11058
|
}
|
|
11056
11059
|
ts.setResolvedTypeReferenceDirective = setResolvedTypeReferenceDirective;
|
|
11057
11060
|
function projectReferenceIsEqualTo(oldRef, newRef) {
|
|
@@ -11061,11 +11064,15 @@ var ts;
|
|
|
11061
11064
|
}
|
|
11062
11065
|
ts.projectReferenceIsEqualTo = projectReferenceIsEqualTo;
|
|
11063
11066
|
function moduleResolutionIsEqualTo(oldResolution, newResolution) {
|
|
11064
|
-
return oldResolution
|
|
11065
|
-
oldResolution.
|
|
11066
|
-
oldResolution.
|
|
11067
|
-
|
|
11068
|
-
|
|
11067
|
+
return oldResolution === newResolution ||
|
|
11068
|
+
oldResolution.resolvedModule === newResolution.resolvedModule ||
|
|
11069
|
+
!!oldResolution.resolvedModule &&
|
|
11070
|
+
!!newResolution.resolvedModule &&
|
|
11071
|
+
oldResolution.resolvedModule.isExternalLibraryImport === newResolution.resolvedModule.isExternalLibraryImport &&
|
|
11072
|
+
oldResolution.resolvedModule.extension === newResolution.resolvedModule.extension &&
|
|
11073
|
+
oldResolution.resolvedModule.resolvedFileName === newResolution.resolvedModule.resolvedFileName &&
|
|
11074
|
+
oldResolution.resolvedModule.originalPath === newResolution.resolvedModule.originalPath &&
|
|
11075
|
+
packageIdIsEqual(oldResolution.resolvedModule.packageId, newResolution.resolvedModule.packageId);
|
|
11069
11076
|
}
|
|
11070
11077
|
ts.moduleResolutionIsEqualTo = moduleResolutionIsEqualTo;
|
|
11071
11078
|
function packageIdIsEqual(a, b) {
|
|
@@ -11081,9 +11088,13 @@ var ts;
|
|
|
11081
11088
|
}
|
|
11082
11089
|
ts.packageIdToString = packageIdToString;
|
|
11083
11090
|
function typeDirectiveIsEqualTo(oldResolution, newResolution) {
|
|
11084
|
-
return oldResolution
|
|
11085
|
-
|
|
11086
|
-
|
|
11091
|
+
return oldResolution === newResolution ||
|
|
11092
|
+
oldResolution.resolvedTypeReferenceDirective === newResolution.resolvedTypeReferenceDirective ||
|
|
11093
|
+
!!oldResolution.resolvedTypeReferenceDirective &&
|
|
11094
|
+
!!newResolution.resolvedTypeReferenceDirective &&
|
|
11095
|
+
oldResolution.resolvedTypeReferenceDirective.resolvedFileName === newResolution.resolvedTypeReferenceDirective.resolvedFileName &&
|
|
11096
|
+
!!oldResolution.resolvedTypeReferenceDirective.primary === !!newResolution.resolvedTypeReferenceDirective.primary &&
|
|
11097
|
+
oldResolution.resolvedTypeReferenceDirective.originalPath === newResolution.resolvedTypeReferenceDirective.originalPath;
|
|
11087
11098
|
}
|
|
11088
11099
|
ts.typeDirectiveIsEqualTo = typeDirectiveIsEqualTo;
|
|
11089
11100
|
function hasChangesInResolutions(names, newResolutions, oldResolutions, oldSourceFile, comparer) {
|
|
@@ -15282,22 +15293,20 @@ var ts;
|
|
|
15282
15293
|
return getStringFromExpandedCharCodes(expandedCharCodes);
|
|
15283
15294
|
}
|
|
15284
15295
|
ts.base64decode = base64decode;
|
|
15285
|
-
function
|
|
15286
|
-
|
|
15287
|
-
|
|
15288
|
-
|
|
15289
|
-
|
|
15290
|
-
|
|
15291
|
-
|
|
15292
|
-
|
|
15293
|
-
|
|
15294
|
-
return result.config;
|
|
15295
|
-
}
|
|
15296
|
-
catch (e) {
|
|
15296
|
+
function readJsonIgnoringErrors(path, host) {
|
|
15297
|
+
return readJsonIgnoringErrorsFromText(path, host.readFile(path));
|
|
15298
|
+
}
|
|
15299
|
+
ts.readJsonIgnoringErrors = readJsonIgnoringErrors;
|
|
15300
|
+
function readJsonIgnoringErrorsFromText(path, jsonText) {
|
|
15301
|
+
if (!jsonText)
|
|
15302
|
+
return {};
|
|
15303
|
+
var result = ts.parseConfigFileTextToJson(path, jsonText);
|
|
15304
|
+
if (result.error) {
|
|
15297
15305
|
return {};
|
|
15298
15306
|
}
|
|
15307
|
+
return result.config;
|
|
15299
15308
|
}
|
|
15300
|
-
ts.
|
|
15309
|
+
ts.readJsonIgnoringErrorsFromText = readJsonIgnoringErrorsFromText;
|
|
15301
15310
|
function directoryProbablyExists(directoryName, host) {
|
|
15302
15311
|
return !host.directoryExists || host.directoryExists(directoryName);
|
|
15303
15312
|
}
|
|
@@ -16275,14 +16284,15 @@ var ts;
|
|
|
16275
16284
|
},
|
|
16276
16285
|
setSymlinksFromResolutions: function (files, typeReferenceDirectives) {
|
|
16277
16286
|
var _this = this;
|
|
16278
|
-
var _a;
|
|
16287
|
+
var _a, _b;
|
|
16279
16288
|
ts.Debug.assert(!hasProcessedResolutions);
|
|
16280
16289
|
hasProcessedResolutions = true;
|
|
16281
16290
|
for (var _i = 0, files_1 = files; _i < files_1.length; _i++) {
|
|
16282
16291
|
var file = files_1[_i];
|
|
16283
|
-
(_a = file.resolvedModules) === null || _a === void 0 ? void 0 : _a.forEach(function (resolution) { return processResolution(_this, resolution); });
|
|
16292
|
+
(_a = file.resolvedModules) === null || _a === void 0 ? void 0 : _a.forEach(function (resolution) { return processResolution(_this, resolution === null || resolution === void 0 ? void 0 : resolution.resolvedModule); });
|
|
16293
|
+
(_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); });
|
|
16284
16294
|
}
|
|
16285
|
-
typeReferenceDirectives
|
|
16295
|
+
typeReferenceDirectives.forEach(function (resolution) { return processResolution(_this, resolution.resolvedTypeReferenceDirective); });
|
|
16286
16296
|
},
|
|
16287
16297
|
hasProcessedResolutions: function () { return hasProcessedResolutions; },
|
|
16288
16298
|
};
|
|
@@ -32193,6 +32203,17 @@ var ts;
|
|
|
32193
32203
|
transpileOptionValue: undefined,
|
|
32194
32204
|
defaultValueDescription: ts.Diagnostics.false_unless_composite_is_set
|
|
32195
32205
|
},
|
|
32206
|
+
{
|
|
32207
|
+
name: "cacheResolutions",
|
|
32208
|
+
type: "boolean",
|
|
32209
|
+
category: ts.Diagnostics.Projects,
|
|
32210
|
+
description: ts.Diagnostics.Save_resolutions_into_tsbuildinfo_file_and_use_them_for_incremental_compilation,
|
|
32211
|
+
affectsModuleResolution: true,
|
|
32212
|
+
affectsMultiFileEmitBuildInfo: true,
|
|
32213
|
+
affectsBundleEmitBuildInfo: true,
|
|
32214
|
+
transpileOptionValue: undefined,
|
|
32215
|
+
defaultValueDescription: false,
|
|
32216
|
+
},
|
|
32196
32217
|
{
|
|
32197
32218
|
name: "assumeChangesOnlyAffectDirectDependencies",
|
|
32198
32219
|
type: "boolean",
|
|
@@ -34149,6 +34170,9 @@ var ts;
|
|
|
34149
34170
|
if (result.configFilePath) {
|
|
34150
34171
|
result.configFilePath = toAbsolutePath(result.configFilePath);
|
|
34151
34172
|
}
|
|
34173
|
+
if (result.pathsBasePath) {
|
|
34174
|
+
result.pathsBasePath = toAbsolutePath(result.pathsBasePath);
|
|
34175
|
+
}
|
|
34152
34176
|
return result;
|
|
34153
34177
|
}
|
|
34154
34178
|
ts.convertToOptionsWithAbsolutePaths = convertToOptionsWithAbsolutePaths;
|
|
@@ -34974,20 +34998,35 @@ var ts;
|
|
|
34974
34998
|
ts.Debug.assert(ts.extensionIsTS(resolved.extension));
|
|
34975
34999
|
return { fileName: resolved.path, packageId: resolved.packageId };
|
|
34976
35000
|
}
|
|
34977
|
-
function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, resultFromCache) {
|
|
34978
|
-
var _a
|
|
35001
|
+
function createResolvedModuleWithFailedLookupLocations(compilerOptions, resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, resultFromCache) {
|
|
35002
|
+
var _a;
|
|
35003
|
+
var _b;
|
|
34979
35004
|
if (resultFromCache) {
|
|
34980
|
-
(
|
|
34981
|
-
|
|
35005
|
+
if ((!compilerOptions.cacheResolutions || !((_b = resultFromCache.resolvedModule) === null || _b === void 0 ? void 0 : _b.resolvedFileName)) && failedLookupLocations.length)
|
|
35006
|
+
(_a = resultFromCache.failedLookupLocations).push.apply(_a, failedLookupLocations);
|
|
35007
|
+
resultFromCache.affectingLocations = updateResolutionField(resultFromCache.affectingLocations, affectingLocations);
|
|
35008
|
+
resultFromCache.resolutionDiagnostics = updateResolutionField(resultFromCache.resolutionDiagnostics, diagnostics);
|
|
34982
35009
|
return resultFromCache;
|
|
34983
35010
|
}
|
|
34984
35011
|
return {
|
|
34985
35012
|
resolvedModule: resolved && { resolvedFileName: resolved.path, originalPath: resolved.originalPath === true ? undefined : resolved.originalPath, extension: resolved.extension, isExternalLibraryImport: isExternalLibraryImport, packageId: resolved.packageId },
|
|
34986
|
-
failedLookupLocations: failedLookupLocations,
|
|
34987
|
-
affectingLocations: affectingLocations,
|
|
34988
|
-
resolutionDiagnostics: diagnostics,
|
|
35013
|
+
failedLookupLocations: !compilerOptions.cacheResolutions || !(resolved === null || resolved === void 0 ? void 0 : resolved.path) ? failedLookupLocations : ts.emptyArray,
|
|
35014
|
+
affectingLocations: initializeResolutionField(affectingLocations),
|
|
35015
|
+
resolutionDiagnostics: initializeResolutionField(diagnostics),
|
|
34989
35016
|
};
|
|
34990
35017
|
}
|
|
35018
|
+
function initializeResolutionField(value) {
|
|
35019
|
+
return value.length ? value : undefined;
|
|
35020
|
+
}
|
|
35021
|
+
function updateResolutionField(to, value) {
|
|
35022
|
+
if (!(value === null || value === void 0 ? void 0 : value.length))
|
|
35023
|
+
return to;
|
|
35024
|
+
if (!(to === null || to === void 0 ? void 0 : to.length))
|
|
35025
|
+
return value;
|
|
35026
|
+
to.push.apply(to, value);
|
|
35027
|
+
return to;
|
|
35028
|
+
}
|
|
35029
|
+
ts.updateResolutionField = updateResolutionField;
|
|
34991
35030
|
function readPackageJsonField(jsonContent, fieldName, typeOfTag, state) {
|
|
34992
35031
|
if (!ts.hasProperty(jsonContent, fieldName)) {
|
|
34993
35032
|
if (state.traceEnabled) {
|
|
@@ -35126,8 +35165,7 @@ var ts;
|
|
|
35126
35165
|
options = redirectedReference.commandLine.options;
|
|
35127
35166
|
}
|
|
35128
35167
|
var containingDirectory = containingFile ? ts.getDirectoryPath(containingFile) : undefined;
|
|
35129
|
-
var
|
|
35130
|
-
var result = perFolderCache && perFolderCache.get(typeReferenceDirectiveName, resolutionMode);
|
|
35168
|
+
var result = containingDirectory ? cache === null || cache === void 0 ? void 0 : cache.getFromCache(containingDirectory, typeReferenceDirectiveName, resolutionMode, redirectedReference) : undefined;
|
|
35131
35169
|
if (result) {
|
|
35132
35170
|
if (traceEnabled) {
|
|
35133
35171
|
trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_1, typeReferenceDirectiveName, containingFile);
|
|
@@ -35178,7 +35216,7 @@ var ts;
|
|
|
35178
35216
|
features: features,
|
|
35179
35217
|
conditions: conditions,
|
|
35180
35218
|
requestContainingDirectory: containingDirectory,
|
|
35181
|
-
|
|
35219
|
+
reportResolutionDiagnostic: function (diag) { return void diagnostics.push(diag); },
|
|
35182
35220
|
};
|
|
35183
35221
|
var resolved = primaryLookup();
|
|
35184
35222
|
var primary = true;
|
|
@@ -35198,8 +35236,15 @@ var ts;
|
|
|
35198
35236
|
isExternalLibraryImport: pathContainsNodeModules(fileName),
|
|
35199
35237
|
};
|
|
35200
35238
|
}
|
|
35201
|
-
result = {
|
|
35202
|
-
|
|
35239
|
+
result = {
|
|
35240
|
+
resolvedTypeReferenceDirective: resolvedTypeReferenceDirective,
|
|
35241
|
+
failedLookupLocations: !options.cacheResolutions || !(resolvedTypeReferenceDirective === null || resolvedTypeReferenceDirective === void 0 ? void 0 : resolvedTypeReferenceDirective.resolvedFileName) ? failedLookupLocations : ts.emptyArray,
|
|
35242
|
+
affectingLocations: initializeResolutionField(affectingLocations),
|
|
35243
|
+
resolutionDiagnostics: initializeResolutionField(diagnostics),
|
|
35244
|
+
};
|
|
35245
|
+
if (containingDirectory && cache) {
|
|
35246
|
+
cache.getOrCreateCacheForDirectory(containingDirectory, redirectedReference).set(typeReferenceDirectiveName, resolutionMode, result);
|
|
35247
|
+
}
|
|
35203
35248
|
if (traceEnabled)
|
|
35204
35249
|
traceResult(result);
|
|
35205
35250
|
return result;
|
|
@@ -35209,10 +35254,10 @@ var ts;
|
|
|
35209
35254
|
trace(host, ts.Diagnostics.Type_reference_directive_0_was_not_resolved, typeReferenceDirectiveName);
|
|
35210
35255
|
}
|
|
35211
35256
|
else if (result.resolvedTypeReferenceDirective.packageId) {
|
|
35212
|
-
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);
|
|
35257
|
+
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);
|
|
35213
35258
|
}
|
|
35214
35259
|
else {
|
|
35215
|
-
trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2, typeReferenceDirectiveName, result.resolvedTypeReferenceDirective.resolvedFileName, result.resolvedTypeReferenceDirective.primary);
|
|
35260
|
+
trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2, typeReferenceDirectiveName, result.resolvedTypeReferenceDirective.resolvedFileName, !!result.resolvedTypeReferenceDirective.primary);
|
|
35216
35261
|
}
|
|
35217
35262
|
}
|
|
35218
35263
|
function primaryLookup() {
|
|
@@ -35292,7 +35337,7 @@ var ts;
|
|
|
35292
35337
|
var typeDirectivePath = _b[_a];
|
|
35293
35338
|
var normalized = ts.normalizePath(typeDirectivePath);
|
|
35294
35339
|
var packageJsonPath = ts.combinePaths(root, normalized, "package.json");
|
|
35295
|
-
var isNotNeededPackage = host.fileExists(packageJsonPath) && ts.
|
|
35340
|
+
var isNotNeededPackage = host.fileExists(packageJsonPath) && ts.readJsonIgnoringErrors(packageJsonPath, host).typings === null;
|
|
35296
35341
|
if (!isNotNeededPackage) {
|
|
35297
35342
|
var baseFileName = ts.getBaseFileName(normalized);
|
|
35298
35343
|
if (baseFileName.charCodeAt(0) !== 46) {
|
|
@@ -35307,62 +35352,181 @@ var ts;
|
|
|
35307
35352
|
return result;
|
|
35308
35353
|
}
|
|
35309
35354
|
ts.getAutomaticTypeDirectiveNames = getAutomaticTypeDirectiveNames;
|
|
35310
|
-
function
|
|
35311
|
-
|
|
35355
|
+
function getPackageJsconLocationFromScope(scope) {
|
|
35356
|
+
return ts.lastOrUndefined(scope.affectingLocations);
|
|
35357
|
+
}
|
|
35358
|
+
ts.getPackageJsconLocationFromScope = getPackageJsconLocationFromScope;
|
|
35359
|
+
function compilerOptionValueToString(value) {
|
|
35360
|
+
var _a;
|
|
35361
|
+
if (value === null || typeof value !== "object") {
|
|
35362
|
+
return "" + value;
|
|
35363
|
+
}
|
|
35364
|
+
if (ts.isArray(value)) {
|
|
35365
|
+
return "[" + ((_a = ts.map(value, function (e) { return compilerOptionValueToString(e); })) === null || _a === void 0 ? void 0 : _a.join(",")) + "]";
|
|
35366
|
+
}
|
|
35367
|
+
var str = "{";
|
|
35368
|
+
for (var key in value) {
|
|
35369
|
+
if (ts.hasProperty(value, key)) {
|
|
35370
|
+
str += key + ": " + compilerOptionValueToString(value[key]);
|
|
35371
|
+
}
|
|
35372
|
+
}
|
|
35373
|
+
return str + "}";
|
|
35374
|
+
}
|
|
35375
|
+
function getKeyForCompilationSettings(settings, options) {
|
|
35376
|
+
return options.map(function (option) { return compilerOptionValueToString(ts.getCompilerOptionValue(settings, option)); }).join("|") + ("|" + settings.pathsBasePath);
|
|
35377
|
+
}
|
|
35378
|
+
ts.getKeyForCompilationSettings = getKeyForCompilationSettings;
|
|
35379
|
+
function getRedirectsCacheKey(options) {
|
|
35380
|
+
return getKeyForCompilationSettings(options, ts.moduleResolutionOptionDeclarations);
|
|
35381
|
+
}
|
|
35382
|
+
ts.getRedirectsCacheKey = getRedirectsCacheKey;
|
|
35383
|
+
function createCacheWithRedirects(ownOptions) {
|
|
35384
|
+
var ownMap;
|
|
35385
|
+
var ownKey;
|
|
35386
|
+
var redirectsKeyToCache = new ts.Map();
|
|
35312
35387
|
var redirectsMap = new ts.Map();
|
|
35313
35388
|
return {
|
|
35314
35389
|
getOwnMap: getOwnMap,
|
|
35315
|
-
|
|
35390
|
+
redirectsKeyToCache: redirectsKeyToCache,
|
|
35391
|
+
createMapForCompilerOptions: createMapForCompilerOptions,
|
|
35392
|
+
getMapOfCacheRedirects: getMapOfCacheRedirects,
|
|
35316
35393
|
getOrCreateMapOfCacheRedirects: getOrCreateMapOfCacheRedirects,
|
|
35317
35394
|
clear: clear,
|
|
35318
|
-
|
|
35319
|
-
|
|
35395
|
+
update: update,
|
|
35396
|
+
clearRedirectsMap: function () { return redirectsMap.clear(); },
|
|
35320
35397
|
};
|
|
35321
|
-
function
|
|
35322
|
-
|
|
35398
|
+
function ensureOwnKeyCached() {
|
|
35399
|
+
ownKey !== null && ownKey !== void 0 ? ownKey : (ownKey = ownOptions && getRedirectsCacheKey(ownOptions));
|
|
35400
|
+
if (ownKey && !redirectsKeyToCache.has(ownKey))
|
|
35401
|
+
redirectsKeyToCache.set(ownKey, { map: ownMap !== null && ownMap !== void 0 ? ownMap : (ownMap = new ts.Map()), options: ownOptions });
|
|
35323
35402
|
}
|
|
35324
|
-
function
|
|
35325
|
-
options
|
|
35403
|
+
function createMapForCompilerOptions(options, optionsKey) {
|
|
35404
|
+
if (options === ownOptions)
|
|
35405
|
+
return ownMap !== null && ownMap !== void 0 ? ownMap : (ownMap = new ts.Map());
|
|
35406
|
+
return getOrCreateRedirectMapAndKey(options, undefined, optionsKey);
|
|
35326
35407
|
}
|
|
35327
|
-
function
|
|
35328
|
-
|
|
35408
|
+
function getOrCreateRedirectMapAndKey(options, path, optionsKey) {
|
|
35409
|
+
var _a;
|
|
35410
|
+
if (path || options.configFile) {
|
|
35411
|
+
var redirects = redirectsMap.get(path || options.configFile.path);
|
|
35412
|
+
if (redirects)
|
|
35413
|
+
return redirects;
|
|
35414
|
+
}
|
|
35415
|
+
var key = optionsKey || getRedirectsCacheKey(options);
|
|
35416
|
+
var map = (_a = redirectsKeyToCache.get(key)) === null || _a === void 0 ? void 0 : _a.map;
|
|
35417
|
+
if (!map) {
|
|
35418
|
+
ensureOwnKeyCached();
|
|
35419
|
+
if (ownKey === key) {
|
|
35420
|
+
map = ownMap;
|
|
35421
|
+
}
|
|
35422
|
+
else {
|
|
35423
|
+
redirectsKeyToCache.set(key, { map: map = new ts.Map(), options: options });
|
|
35424
|
+
}
|
|
35425
|
+
}
|
|
35426
|
+
if (path || options.configFile)
|
|
35427
|
+
redirectsMap.set(path || options.configFile.path, map);
|
|
35428
|
+
return map;
|
|
35329
35429
|
}
|
|
35330
|
-
function
|
|
35331
|
-
|
|
35332
|
-
|
|
35430
|
+
function getOwnMap() {
|
|
35431
|
+
return ownMap !== null && ownMap !== void 0 ? ownMap : (ownMap = new ts.Map());
|
|
35432
|
+
}
|
|
35433
|
+
function update(newOwnOptions) {
|
|
35434
|
+
if (ownMap && (ownOptions === null || ownOptions === void 0 ? void 0 : ownOptions.configFile)) {
|
|
35435
|
+
ensureOwnKeyCached();
|
|
35436
|
+
if (!redirectsMap.has(ownOptions.configFile.path)) {
|
|
35437
|
+
redirectsMap.set(ownOptions.configFile.path, ownMap);
|
|
35438
|
+
}
|
|
35333
35439
|
}
|
|
35334
|
-
|
|
35335
|
-
|
|
35336
|
-
|
|
35337
|
-
|
|
35338
|
-
|
|
35440
|
+
if (newOwnOptions.configFile) {
|
|
35441
|
+
var existing_1 = redirectsMap.get(newOwnOptions.configFile.path);
|
|
35442
|
+
if (existing_1) {
|
|
35443
|
+
ownMap = existing_1;
|
|
35444
|
+
ownOptions = newOwnOptions;
|
|
35445
|
+
return;
|
|
35446
|
+
}
|
|
35339
35447
|
}
|
|
35340
|
-
|
|
35448
|
+
var key = getRedirectsCacheKey(newOwnOptions);
|
|
35449
|
+
var existing = redirectsKeyToCache.get(key);
|
|
35450
|
+
ownMap = (existing === null || existing === void 0 ? void 0 : existing.map) || new ts.Map();
|
|
35451
|
+
ownKey = key;
|
|
35452
|
+
ownOptions = newOwnOptions;
|
|
35453
|
+
if (newOwnOptions.configFile)
|
|
35454
|
+
redirectsMap.set(newOwnOptions.configFile.path, ownMap);
|
|
35455
|
+
}
|
|
35456
|
+
function getMapOfCacheRedirects(redirectedReference) {
|
|
35457
|
+
if (!redirectedReference)
|
|
35458
|
+
return ownMap;
|
|
35459
|
+
var directResult = redirectsMap.get(redirectedReference.sourceFile.path);
|
|
35460
|
+
if (directResult)
|
|
35461
|
+
return directResult;
|
|
35462
|
+
var key = getRedirectsCacheKey(redirectedReference.commandLine.options);
|
|
35463
|
+
var fromKey = redirectsKeyToCache.get(key);
|
|
35464
|
+
if (fromKey) {
|
|
35465
|
+
redirectsMap.set(redirectedReference.sourceFile.path, fromKey.map);
|
|
35466
|
+
return fromKey.map;
|
|
35467
|
+
}
|
|
35468
|
+
if (ownMap)
|
|
35469
|
+
ensureOwnKeyCached();
|
|
35470
|
+
if (ownKey === key) {
|
|
35471
|
+
redirectsMap.set(redirectedReference.sourceFile.path, ownMap);
|
|
35472
|
+
return ownMap;
|
|
35473
|
+
}
|
|
35474
|
+
return undefined;
|
|
35475
|
+
}
|
|
35476
|
+
function getOrCreateMapOfCacheRedirects(redirectedReference) {
|
|
35477
|
+
return !redirectedReference || redirectedReference.commandLine.options === ownOptions ?
|
|
35478
|
+
getOwnMap() :
|
|
35479
|
+
getOrCreateRedirectMapAndKey(redirectedReference.commandLine.options, redirectedReference.sourceFile.path, undefined);
|
|
35341
35480
|
}
|
|
35342
35481
|
function clear() {
|
|
35343
|
-
|
|
35482
|
+
ownKey = undefined;
|
|
35483
|
+
ownMap = undefined;
|
|
35344
35484
|
redirectsMap.clear();
|
|
35485
|
+
redirectsKeyToCache.clear();
|
|
35345
35486
|
}
|
|
35346
35487
|
}
|
|
35347
35488
|
ts.createCacheWithRedirects = createCacheWithRedirects;
|
|
35348
|
-
function createPackageJsonInfoCache(currentDirectory, getCanonicalFileName) {
|
|
35349
|
-
var
|
|
35350
|
-
|
|
35489
|
+
function createPackageJsonInfoCache(currentDirectory, getCanonicalFileName, cache) {
|
|
35490
|
+
var dirToPackageJsonScope = new ts.Map();
|
|
35491
|
+
var oldPackageJsonInfoCache;
|
|
35492
|
+
return {
|
|
35493
|
+
getPackageJsonInfo: getPackageJsonInfo,
|
|
35494
|
+
setPackageJsonInfo: setPackageJsonInfo,
|
|
35495
|
+
clear: clear,
|
|
35496
|
+
entries: entries,
|
|
35497
|
+
getInternalMap: function () { return cache; },
|
|
35498
|
+
setInternalMap: function (value) { return cache = value; },
|
|
35499
|
+
clone: clone,
|
|
35500
|
+
getPackageJsonScope: getPackageJsonScope,
|
|
35501
|
+
setPackageJsonScope: setPackageJsonScope,
|
|
35502
|
+
setOldPackageJsonScopeCache: function (cache) { return oldPackageJsonInfoCache = cache; },
|
|
35503
|
+
};
|
|
35351
35504
|
function getPackageJsonInfo(packageJsonPath) {
|
|
35352
|
-
return cache === null || cache === void 0 ? void 0 : cache.get(
|
|
35505
|
+
return cache === null || cache === void 0 ? void 0 : cache.get(toPath(packageJsonPath));
|
|
35353
35506
|
}
|
|
35354
35507
|
function setPackageJsonInfo(packageJsonPath, info) {
|
|
35355
|
-
(cache || (cache = new ts.Map())).set(
|
|
35508
|
+
(cache || (cache = new ts.Map())).set(toPath(packageJsonPath), info);
|
|
35356
35509
|
}
|
|
35357
35510
|
function clear() {
|
|
35511
|
+
oldPackageJsonInfoCache = undefined;
|
|
35358
35512
|
cache = undefined;
|
|
35513
|
+
dirToPackageJsonScope.clear();
|
|
35359
35514
|
}
|
|
35360
35515
|
function entries() {
|
|
35361
35516
|
var iter = cache === null || cache === void 0 ? void 0 : cache.entries();
|
|
35362
35517
|
return iter ? ts.arrayFrom(iter) : [];
|
|
35363
35518
|
}
|
|
35364
|
-
function
|
|
35365
|
-
return cache;
|
|
35519
|
+
function clone() {
|
|
35520
|
+
return createPackageJsonInfoCache(currentDirectory, getCanonicalFileName, cache && new ts.Map(cache));
|
|
35521
|
+
}
|
|
35522
|
+
function getPackageJsonScope(dir) {
|
|
35523
|
+
return dirToPackageJsonScope.get(dir) || (oldPackageJsonInfoCache === null || oldPackageJsonInfoCache === void 0 ? void 0 : oldPackageJsonInfoCache.getPackageJsonScope(dir));
|
|
35524
|
+
}
|
|
35525
|
+
function setPackageJsonScope(dir, scope) {
|
|
35526
|
+
moduleNameToDirectorySet(dirToPackageJsonScope, dir, scope, getPackageJsconLocationFromScope, toPath, ts.noop);
|
|
35527
|
+
}
|
|
35528
|
+
function toPath(file) {
|
|
35529
|
+
return ts.toPath(file, currentDirectory, getCanonicalFileName);
|
|
35366
35530
|
}
|
|
35367
35531
|
}
|
|
35368
35532
|
function getOrCreateCache(cacheWithRedirects, redirectedReference, key, create) {
|
|
@@ -35374,45 +35538,43 @@ var ts;
|
|
|
35374
35538
|
}
|
|
35375
35539
|
return result;
|
|
35376
35540
|
}
|
|
35377
|
-
function
|
|
35378
|
-
|
|
35379
|
-
|
|
35380
|
-
if (directoryToModuleNameMap.redirectsMap.size === 0) {
|
|
35381
|
-
ts.Debug.assert(!moduleNameToDirectoryMap || moduleNameToDirectoryMap.redirectsMap.size === 0);
|
|
35382
|
-
ts.Debug.assert(directoryToModuleNameMap.getOwnMap().size === 0);
|
|
35383
|
-
ts.Debug.assert(!moduleNameToDirectoryMap || moduleNameToDirectoryMap.getOwnMap().size === 0);
|
|
35384
|
-
directoryToModuleNameMap.redirectsMap.set(options.configFile.path, directoryToModuleNameMap.getOwnMap());
|
|
35385
|
-
moduleNameToDirectoryMap === null || moduleNameToDirectoryMap === void 0 ? void 0 : moduleNameToDirectoryMap.redirectsMap.set(options.configFile.path, moduleNameToDirectoryMap.getOwnMap());
|
|
35386
|
-
}
|
|
35387
|
-
else {
|
|
35388
|
-
ts.Debug.assert(!moduleNameToDirectoryMap || moduleNameToDirectoryMap.redirectsMap.size > 0);
|
|
35389
|
-
var ref = {
|
|
35390
|
-
sourceFile: options.configFile,
|
|
35391
|
-
commandLine: { options: options }
|
|
35392
|
-
};
|
|
35393
|
-
directoryToModuleNameMap.setOwnMap(directoryToModuleNameMap.getOrCreateMapOfCacheRedirects(ref));
|
|
35394
|
-
moduleNameToDirectoryMap === null || moduleNameToDirectoryMap === void 0 ? void 0 : moduleNameToDirectoryMap.setOwnMap(moduleNameToDirectoryMap.getOrCreateMapOfCacheRedirects(ref));
|
|
35395
|
-
}
|
|
35396
|
-
directoryToModuleNameMap.setOwnOptions(options);
|
|
35397
|
-
moduleNameToDirectoryMap === null || moduleNameToDirectoryMap === void 0 ? void 0 : moduleNameToDirectoryMap.setOwnOptions(options);
|
|
35398
|
-
}
|
|
35399
|
-
function createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, directoryToModuleNameMap) {
|
|
35541
|
+
function createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, options) {
|
|
35542
|
+
var directoryToModuleNameMap = createCacheWithRedirects(options);
|
|
35543
|
+
var oldResolutionCache;
|
|
35400
35544
|
return {
|
|
35545
|
+
getFromCache: getFromCache,
|
|
35401
35546
|
getOrCreateCacheForDirectory: getOrCreateCacheForDirectory,
|
|
35402
35547
|
clear: clear,
|
|
35403
35548
|
update: update,
|
|
35549
|
+
setOldResolutionCache: function (cache) { return oldResolutionCache = cache; }
|
|
35404
35550
|
};
|
|
35405
35551
|
function clear() {
|
|
35552
|
+
oldResolutionCache = undefined;
|
|
35406
35553
|
directoryToModuleNameMap.clear();
|
|
35407
35554
|
}
|
|
35408
35555
|
function update(options) {
|
|
35409
|
-
|
|
35556
|
+
directoryToModuleNameMap.update(options);
|
|
35410
35557
|
}
|
|
35411
35558
|
function getOrCreateCacheForDirectory(directoryName, redirectedReference) {
|
|
35412
35559
|
var path = ts.toPath(directoryName, currentDirectory, getCanonicalFileName);
|
|
35413
|
-
return getOrCreateCache(directoryToModuleNameMap, redirectedReference, path,
|
|
35560
|
+
return getOrCreateCache(directoryToModuleNameMap, redirectedReference, path, createModeAwareCache);
|
|
35561
|
+
}
|
|
35562
|
+
function getFromCache(directoryName, name, mode, redirectedReference) {
|
|
35563
|
+
var _a, _b;
|
|
35564
|
+
var path = ts.toPath(directoryName, currentDirectory, getCanonicalFileName);
|
|
35565
|
+
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);
|
|
35566
|
+
if (result)
|
|
35567
|
+
return result;
|
|
35568
|
+
var resultFromOld = oldResolutionCache === null || oldResolutionCache === void 0 ? void 0 : oldResolutionCache.getResolved(path, name, mode, redirectedReference);
|
|
35569
|
+
if (resultFromOld)
|
|
35570
|
+
getOrCreateCacheForDirectory(directoryName, redirectedReference).set(name, mode, resultFromOld);
|
|
35571
|
+
return resultFromOld;
|
|
35414
35572
|
}
|
|
35415
35573
|
}
|
|
35574
|
+
function getModeAwareCacheKey(specifier, mode) {
|
|
35575
|
+
return (mode === undefined ? specifier : mode + "|" + specifier);
|
|
35576
|
+
}
|
|
35577
|
+
ts.getModeAwareCacheKey = getModeAwareCacheKey;
|
|
35416
35578
|
function createModeAwareCache() {
|
|
35417
35579
|
var underlying = new ts.Map();
|
|
35418
35580
|
var memoizedReverseKeys = new ts.Map();
|
|
@@ -35437,13 +35599,22 @@ var ts;
|
|
|
35437
35599
|
return cb(elem, specifier, mode);
|
|
35438
35600
|
});
|
|
35439
35601
|
},
|
|
35602
|
+
entries: function () {
|
|
35603
|
+
var keys = underlying.entries();
|
|
35604
|
+
return {
|
|
35605
|
+
next: function () {
|
|
35606
|
+
var next = keys.next();
|
|
35607
|
+
return !next.done ? { value: __spreadArray(__spreadArray([], memoizedReverseKeys.get(next.value[0]), true), [next.value[1]], false) } : next;
|
|
35608
|
+
},
|
|
35609
|
+
};
|
|
35610
|
+
},
|
|
35440
35611
|
size: function () {
|
|
35441
35612
|
return underlying.size;
|
|
35442
|
-
}
|
|
35613
|
+
},
|
|
35443
35614
|
};
|
|
35444
35615
|
return cache;
|
|
35445
35616
|
function getUnderlyingCacheKey(specifier, mode) {
|
|
35446
|
-
var result =
|
|
35617
|
+
var result = getModeAwareCacheKey(specifier, mode);
|
|
35447
35618
|
memoizedReverseKeys.set(result, [specifier, mode]);
|
|
35448
35619
|
return result;
|
|
35449
35620
|
}
|
|
@@ -35454,100 +35625,122 @@ var ts;
|
|
|
35454
35625
|
var map = createModeAwareCache();
|
|
35455
35626
|
for (var i = 0; i < keys.length; ++i) {
|
|
35456
35627
|
var entry = keys[i];
|
|
35457
|
-
var name = !ts.isString(entry) ? entry.fileName
|
|
35628
|
+
var name = !ts.isString(entry) ? ts.toFileNameLowerCase(entry.fileName) : entry;
|
|
35458
35629
|
var mode = !ts.isString(entry) ? entry.resolutionMode || file.impliedNodeFormat : ts.getModeForResolutionAtIndex(file, i);
|
|
35459
35630
|
map.set(name, mode, values[i]);
|
|
35460
35631
|
}
|
|
35461
35632
|
return map;
|
|
35462
35633
|
}
|
|
35463
35634
|
ts.zipToModeAwareCache = zipToModeAwareCache;
|
|
35464
|
-
function
|
|
35465
|
-
var
|
|
35466
|
-
|
|
35635
|
+
function getCommonPrefix(directory, resolution, toPath) {
|
|
35636
|
+
var resolutionDirectory = toPath(ts.getDirectoryPath(resolution));
|
|
35637
|
+
var i = 0;
|
|
35638
|
+
var limit = Math.min(directory.length, resolutionDirectory.length);
|
|
35639
|
+
while (i < limit && directory.charCodeAt(i) === resolutionDirectory.charCodeAt(i)) {
|
|
35640
|
+
i++;
|
|
35641
|
+
}
|
|
35642
|
+
if (i === directory.length && (resolutionDirectory.length === i || resolutionDirectory[i] === ts.directorySeparator)) {
|
|
35643
|
+
return directory;
|
|
35644
|
+
}
|
|
35645
|
+
var rootLength = ts.getRootLength(directory);
|
|
35646
|
+
if (i < rootLength) {
|
|
35647
|
+
return undefined;
|
|
35648
|
+
}
|
|
35649
|
+
var sep = directory.lastIndexOf(ts.directorySeparator, i - 1);
|
|
35650
|
+
if (sep === -1) {
|
|
35651
|
+
return undefined;
|
|
35652
|
+
}
|
|
35653
|
+
return directory.substr(0, Math.max(sep, rootLength));
|
|
35654
|
+
}
|
|
35655
|
+
function getResolvedFileNameForModuleNameToDirectorySet(result) {
|
|
35656
|
+
return result.resolvedModule &&
|
|
35657
|
+
(result.resolvedModule.originalPath || result.resolvedModule.resolvedFileName);
|
|
35658
|
+
}
|
|
35659
|
+
ts.getResolvedFileNameForModuleNameToDirectorySet = getResolvedFileNameForModuleNameToDirectorySet;
|
|
35660
|
+
function moduleNameToDirectorySet(directoryPathMap, directory, result, getResolvedFileName, toPath, ancestoryWorker) {
|
|
35661
|
+
if (directoryPathMap.has(directory))
|
|
35662
|
+
return;
|
|
35663
|
+
directoryPathMap.set(directory, result);
|
|
35664
|
+
var resolvedFileName = getResolvedFileName(result);
|
|
35665
|
+
var commonPrefix = resolvedFileName && getCommonPrefix(directory, resolvedFileName, toPath);
|
|
35666
|
+
var current = directory;
|
|
35667
|
+
while (current !== commonPrefix) {
|
|
35668
|
+
var parent = ts.getDirectoryPath(current);
|
|
35669
|
+
if (parent === current)
|
|
35670
|
+
break;
|
|
35671
|
+
if (directoryPathMap.has(parent)) {
|
|
35672
|
+
ancestoryWorker(parent);
|
|
35673
|
+
break;
|
|
35674
|
+
}
|
|
35675
|
+
directoryPathMap.set(parent, result);
|
|
35676
|
+
ancestoryWorker(parent);
|
|
35677
|
+
current = parent;
|
|
35678
|
+
}
|
|
35679
|
+
}
|
|
35680
|
+
ts.moduleNameToDirectorySet = moduleNameToDirectorySet;
|
|
35681
|
+
function createModuleResolutionCache(currentDirectory, getCanonicalFileName, options) {
|
|
35682
|
+
var moduleNameToDirectoryMap = createCacheWithRedirects(options);
|
|
35683
|
+
var perDirectoryResolutionCache = createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, options);
|
|
35467
35684
|
var packageJsonInfoCache = createPackageJsonInfoCache(currentDirectory, getCanonicalFileName);
|
|
35468
|
-
|
|
35685
|
+
var oldResolutionCache;
|
|
35686
|
+
return __assign(__assign(__assign({}, packageJsonInfoCache), perDirectoryResolutionCache), { getOrCreateCacheForModuleName: getOrCreateCacheForModuleName, getFromModuleNameCache: getFromModuleNameCache, clear: clear, update: update, getPackageJsonInfoCache: function () { return packageJsonInfoCache; }, setOldResolutionCache: setOldResolutionCache });
|
|
35469
35687
|
function clear() {
|
|
35470
|
-
|
|
35471
|
-
packageJsonInfoCache.clear();
|
|
35472
|
-
}
|
|
35473
|
-
function clearAllExceptPackageJsonInfoCache() {
|
|
35688
|
+
oldResolutionCache = undefined;
|
|
35474
35689
|
perDirectoryResolutionCache.clear();
|
|
35475
35690
|
moduleNameToDirectoryMap.clear();
|
|
35691
|
+
packageJsonInfoCache.clear();
|
|
35476
35692
|
}
|
|
35477
35693
|
function update(options) {
|
|
35478
|
-
|
|
35694
|
+
perDirectoryResolutionCache.update(options);
|
|
35695
|
+
moduleNameToDirectoryMap.update(options);
|
|
35696
|
+
}
|
|
35697
|
+
function setOldResolutionCache(cache) {
|
|
35698
|
+
oldResolutionCache = cache;
|
|
35699
|
+
perDirectoryResolutionCache.setOldResolutionCache(cache);
|
|
35700
|
+
}
|
|
35701
|
+
function getFromModuleNameCache(directoryName, nonRelativeModuleName, mode, redirectedReference) {
|
|
35702
|
+
var _a, _b;
|
|
35703
|
+
ts.Debug.assert(!ts.isExternalModuleNameRelative(nonRelativeModuleName));
|
|
35704
|
+
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);
|
|
35705
|
+
if (result)
|
|
35706
|
+
return result;
|
|
35707
|
+
var fromOld = oldResolutionCache === null || oldResolutionCache === void 0 ? void 0 : oldResolutionCache.getResolved(toPath(directoryName), nonRelativeModuleName, mode, redirectedReference);
|
|
35708
|
+
if (fromOld)
|
|
35709
|
+
getOrCreateCacheForModuleName(nonRelativeModuleName, mode, redirectedReference).set(directoryName, fromOld);
|
|
35710
|
+
return fromOld;
|
|
35479
35711
|
}
|
|
35480
35712
|
function getOrCreateCacheForModuleName(nonRelativeModuleName, mode, redirectedReference) {
|
|
35481
35713
|
ts.Debug.assert(!ts.isExternalModuleNameRelative(nonRelativeModuleName));
|
|
35482
|
-
return getOrCreateCache(moduleNameToDirectoryMap, redirectedReference,
|
|
35714
|
+
return getOrCreateCache(moduleNameToDirectoryMap, redirectedReference, getModeAwareCacheKey(nonRelativeModuleName, mode), createPerModuleNameCache);
|
|
35483
35715
|
}
|
|
35484
35716
|
function createPerModuleNameCache() {
|
|
35485
35717
|
var directoryPathMap = new ts.Map();
|
|
35486
35718
|
return { get: get, set: set };
|
|
35487
35719
|
function get(directory) {
|
|
35488
|
-
return directoryPathMap.get(
|
|
35720
|
+
return directoryPathMap.get(toPath(directory));
|
|
35489
35721
|
}
|
|
35490
35722
|
function set(directory, result) {
|
|
35491
|
-
|
|
35492
|
-
if (directoryPathMap.has(path)) {
|
|
35493
|
-
return;
|
|
35494
|
-
}
|
|
35495
|
-
directoryPathMap.set(path, result);
|
|
35496
|
-
var resolvedFileName = result.resolvedModule &&
|
|
35497
|
-
(result.resolvedModule.originalPath || result.resolvedModule.resolvedFileName);
|
|
35498
|
-
var commonPrefix = resolvedFileName && getCommonPrefix(path, resolvedFileName);
|
|
35499
|
-
var current = path;
|
|
35500
|
-
while (current !== commonPrefix) {
|
|
35501
|
-
var parent = ts.getDirectoryPath(current);
|
|
35502
|
-
if (parent === current || directoryPathMap.has(parent)) {
|
|
35503
|
-
break;
|
|
35504
|
-
}
|
|
35505
|
-
directoryPathMap.set(parent, result);
|
|
35506
|
-
current = parent;
|
|
35507
|
-
}
|
|
35508
|
-
}
|
|
35509
|
-
function getCommonPrefix(directory, resolution) {
|
|
35510
|
-
var resolutionDirectory = ts.toPath(ts.getDirectoryPath(resolution), currentDirectory, getCanonicalFileName);
|
|
35511
|
-
var i = 0;
|
|
35512
|
-
var limit = Math.min(directory.length, resolutionDirectory.length);
|
|
35513
|
-
while (i < limit && directory.charCodeAt(i) === resolutionDirectory.charCodeAt(i)) {
|
|
35514
|
-
i++;
|
|
35515
|
-
}
|
|
35516
|
-
if (i === directory.length && (resolutionDirectory.length === i || resolutionDirectory[i] === ts.directorySeparator)) {
|
|
35517
|
-
return directory;
|
|
35518
|
-
}
|
|
35519
|
-
var rootLength = ts.getRootLength(directory);
|
|
35520
|
-
if (i < rootLength) {
|
|
35521
|
-
return undefined;
|
|
35522
|
-
}
|
|
35523
|
-
var sep = directory.lastIndexOf(ts.directorySeparator, i - 1);
|
|
35524
|
-
if (sep === -1) {
|
|
35525
|
-
return undefined;
|
|
35526
|
-
}
|
|
35527
|
-
return directory.substr(0, Math.max(sep, rootLength));
|
|
35723
|
+
return moduleNameToDirectorySet(directoryPathMap, toPath(directory), result, getResolvedFileNameForModuleNameToDirectorySet, toPath, ts.noop);
|
|
35528
35724
|
}
|
|
35529
35725
|
}
|
|
35726
|
+
function toPath(fileName) {
|
|
35727
|
+
return ts.toPath(fileName, currentDirectory, getCanonicalFileName);
|
|
35728
|
+
}
|
|
35530
35729
|
}
|
|
35531
35730
|
ts.createModuleResolutionCache = createModuleResolutionCache;
|
|
35532
|
-
function createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, options, packageJsonInfoCache
|
|
35533
|
-
var perDirectoryResolutionCache = createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName,
|
|
35731
|
+
function createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, options, packageJsonInfoCache) {
|
|
35732
|
+
var perDirectoryResolutionCache = createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, options);
|
|
35534
35733
|
packageJsonInfoCache || (packageJsonInfoCache = createPackageJsonInfoCache(currentDirectory, getCanonicalFileName));
|
|
35535
|
-
return __assign(__assign(__assign({}, packageJsonInfoCache), perDirectoryResolutionCache), { clear: clear
|
|
35734
|
+
return __assign(__assign(__assign({}, packageJsonInfoCache), perDirectoryResolutionCache), { clear: clear });
|
|
35536
35735
|
function clear() {
|
|
35537
|
-
clearAllExceptPackageJsonInfoCache();
|
|
35538
|
-
packageJsonInfoCache.clear();
|
|
35539
|
-
}
|
|
35540
|
-
function clearAllExceptPackageJsonInfoCache() {
|
|
35541
35736
|
perDirectoryResolutionCache.clear();
|
|
35737
|
+
packageJsonInfoCache.clear();
|
|
35542
35738
|
}
|
|
35543
35739
|
}
|
|
35544
35740
|
ts.createTypeReferenceDirectiveResolutionCache = createTypeReferenceDirectiveResolutionCache;
|
|
35545
35741
|
function resolveModuleNameFromCache(moduleName, containingFile, cache, mode) {
|
|
35546
35742
|
var containingDirectory = ts.getDirectoryPath(containingFile);
|
|
35547
|
-
|
|
35548
|
-
if (!perFolderCache)
|
|
35549
|
-
return undefined;
|
|
35550
|
-
return perFolderCache.get(moduleName, mode);
|
|
35743
|
+
return cache === null || cache === void 0 ? void 0 : cache.getFromCache(containingDirectory, moduleName, mode);
|
|
35551
35744
|
}
|
|
35552
35745
|
ts.resolveModuleNameFromCache = resolveModuleNameFromCache;
|
|
35553
35746
|
function resolveModuleName(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
@@ -35562,8 +35755,7 @@ var ts;
|
|
|
35562
35755
|
}
|
|
35563
35756
|
}
|
|
35564
35757
|
var containingDirectory = ts.getDirectoryPath(containingFile);
|
|
35565
|
-
var
|
|
35566
|
-
var result = perFolderCache && perFolderCache.get(moduleName, resolutionMode);
|
|
35758
|
+
var result = cache === null || cache === void 0 ? void 0 : cache.getFromCache(containingDirectory, moduleName, resolutionMode, redirectedReference);
|
|
35567
35759
|
if (result) {
|
|
35568
35760
|
if (traceEnabled) {
|
|
35569
35761
|
trace(host, ts.Diagnostics.Resolution_for_module_0_was_found_in_cache_from_location_1, moduleName, containingDirectory);
|
|
@@ -35615,8 +35807,8 @@ var ts;
|
|
|
35615
35807
|
if (result && result.resolvedModule)
|
|
35616
35808
|
ts.perfLogger.logInfoEvent("Module \"" + moduleName + "\" resolved to \"" + result.resolvedModule.resolvedFileName + "\"");
|
|
35617
35809
|
ts.perfLogger.logStopResolveModule((result && result.resolvedModule) ? "" + result.resolvedModule.resolvedFileName : "null");
|
|
35618
|
-
if (
|
|
35619
|
-
|
|
35810
|
+
if (cache) {
|
|
35811
|
+
cache.getOrCreateCacheForDirectory(containingDirectory, redirectedReference).set(moduleName, resolutionMode, result);
|
|
35620
35812
|
if (!ts.isExternalModuleNameRelative(moduleName)) {
|
|
35621
35813
|
cache.getOrCreateCacheForModuleName(moduleName, resolutionMode, redirectedReference).set(containingDirectory, result);
|
|
35622
35814
|
}
|
|
@@ -35820,10 +36012,10 @@ var ts;
|
|
|
35820
36012
|
features: features,
|
|
35821
36013
|
conditions: conditions,
|
|
35822
36014
|
requestContainingDirectory: containingDirectory,
|
|
35823
|
-
|
|
36015
|
+
reportResolutionDiagnostic: function (diag) { return void diagnostics.push(diag); },
|
|
35824
36016
|
};
|
|
35825
36017
|
var result = ts.forEach(extensions, function (ext) { return tryResolve(ext); });
|
|
35826
|
-
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);
|
|
36018
|
+
return createResolvedModuleWithFailedLookupLocations(compilerOptions, (_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);
|
|
35827
36019
|
function tryResolve(extensions) {
|
|
35828
36020
|
var loader = function (extensions, candidate, onlyRecordFailures, state) { return nodeLoadModuleByRelativeName(extensions, candidate, onlyRecordFailures, state, true); };
|
|
35829
36021
|
var resolved = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loader, state);
|
|
@@ -36159,21 +36351,42 @@ var ts;
|
|
|
36159
36351
|
features: NodeResolutionFeatures.None,
|
|
36160
36352
|
conditions: ts.emptyArray,
|
|
36161
36353
|
requestContainingDirectory: undefined,
|
|
36162
|
-
|
|
36354
|
+
reportResolutionDiagnostic: ts.noop
|
|
36163
36355
|
};
|
|
36164
36356
|
}
|
|
36165
36357
|
ts.getTemporaryModuleResolutionState = getTemporaryModuleResolutionState;
|
|
36166
|
-
function
|
|
36167
|
-
var
|
|
36168
|
-
|
|
36169
|
-
|
|
36170
|
-
|
|
36171
|
-
|
|
36172
|
-
|
|
36173
|
-
|
|
36174
|
-
|
|
36175
|
-
|
|
36176
|
-
|
|
36358
|
+
function getPackageScope(dir, packageJsonInfoCache, host, options) {
|
|
36359
|
+
var state = getTemporaryModuleResolutionState(packageJsonInfoCache, host, options);
|
|
36360
|
+
var failedLookupLocations = [];
|
|
36361
|
+
var affectingLocations = [];
|
|
36362
|
+
state.failedLookupLocations = failedLookupLocations;
|
|
36363
|
+
state.affectingLocations = affectingLocations;
|
|
36364
|
+
var result = ts.forEachAncestorDirectory(dir, function (directory) {
|
|
36365
|
+
var _a;
|
|
36366
|
+
var fromCache = (_a = state.packageJsonInfoCache) === null || _a === void 0 ? void 0 : _a.getPackageJsonScope(directory);
|
|
36367
|
+
if (fromCache) {
|
|
36368
|
+
var host_1 = state.host, traceEnabled = state.traceEnabled;
|
|
36369
|
+
if (traceEnabled) {
|
|
36370
|
+
trace(host_1, fromCache.info ?
|
|
36371
|
+
ts.Diagnostics.Directory_0_resolves_to_1_scope_according_to_cache :
|
|
36372
|
+
ts.Diagnostics.Directory_0_has_no_containing_package_json_scope_according_to_cache, directory, getPackageJsconLocationFromScope(fromCache));
|
|
36373
|
+
}
|
|
36374
|
+
return fromCache;
|
|
36375
|
+
}
|
|
36376
|
+
var info = getPackageJsonInfo(directory, false, state);
|
|
36377
|
+
if (info)
|
|
36378
|
+
return { info: info };
|
|
36379
|
+
}) || { info: undefined };
|
|
36380
|
+
result.failedLookupLocations = updateResolutionField(result.failedLookupLocations, !options.cacheResolutions || !result.info ? failedLookupLocations : undefined);
|
|
36381
|
+
result.affectingLocations = updateResolutionField(result.affectingLocations, affectingLocations);
|
|
36382
|
+
packageJsonInfoCache === null || packageJsonInfoCache === void 0 ? void 0 : packageJsonInfoCache.setPackageJsonScope(dir, result);
|
|
36383
|
+
return result;
|
|
36384
|
+
}
|
|
36385
|
+
ts.getPackageScope = getPackageScope;
|
|
36386
|
+
function getPackageScopeForPath(dir, state) {
|
|
36387
|
+
return ts.forEachAncestorDirectory(dir, function (directory) {
|
|
36388
|
+
return getPackageJsonInfo(directory, false, state);
|
|
36389
|
+
});
|
|
36177
36390
|
}
|
|
36178
36391
|
ts.getPackageScopeForPath = getPackageScopeForPath;
|
|
36179
36392
|
function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
|
|
@@ -36201,12 +36414,13 @@ var ts;
|
|
|
36201
36414
|
}
|
|
36202
36415
|
var directoryExists = ts.directoryProbablyExists(packageDirectory, host);
|
|
36203
36416
|
if (directoryExists && host.fileExists(packageJsonPath)) {
|
|
36204
|
-
var
|
|
36417
|
+
var packageJsonText = host.readFile(packageJsonPath);
|
|
36418
|
+
var packageJsonContent = ts.readJsonIgnoringErrorsFromText(packageJsonPath, packageJsonText);
|
|
36205
36419
|
if (traceEnabled) {
|
|
36206
36420
|
trace(host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath);
|
|
36207
36421
|
}
|
|
36208
36422
|
var versionPaths = readPackageJsonTypesVersionPaths(packageJsonContent, state);
|
|
36209
|
-
var result = { packageDirectory: packageDirectory, packageJsonContent: packageJsonContent, versionPaths: versionPaths, resolvedEntrypoints: undefined };
|
|
36423
|
+
var result = { packageDirectory: packageDirectory, packageJsonText: packageJsonText, packageJsonContent: packageJsonContent, versionPaths: versionPaths, resolvedEntrypoints: undefined };
|
|
36210
36424
|
(_b = state.packageJsonInfoCache) === null || _b === void 0 ? void 0 : _b.setPackageJsonInfo(packageJsonPath, result);
|
|
36211
36425
|
state.affectingLocations.push(packageJsonPath);
|
|
36212
36426
|
return result;
|
|
@@ -36319,7 +36533,7 @@ var ts;
|
|
|
36319
36533
|
function loadModuleFromSelfNameReference(extensions, moduleName, directory, state, cache, redirectedReference) {
|
|
36320
36534
|
var _a, _b;
|
|
36321
36535
|
var useCaseSensitiveFileNames = typeof state.host.useCaseSensitiveFileNames === "function" ? state.host.useCaseSensitiveFileNames() : state.host.useCaseSensitiveFileNames;
|
|
36322
|
-
var directoryPath = ts.toPath(
|
|
36536
|
+
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));
|
|
36323
36537
|
var scope = getPackageScopeForPath(directoryPath, state);
|
|
36324
36538
|
if (!scope || !scope.packageJsonContent.exports) {
|
|
36325
36539
|
return undefined;
|
|
@@ -36378,7 +36592,7 @@ var ts;
|
|
|
36378
36592
|
return toSearchResult(undefined);
|
|
36379
36593
|
}
|
|
36380
36594
|
var useCaseSensitiveFileNames = typeof state.host.useCaseSensitiveFileNames === "function" ? state.host.useCaseSensitiveFileNames() : state.host.useCaseSensitiveFileNames;
|
|
36381
|
-
var directoryPath = ts.toPath(
|
|
36595
|
+
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));
|
|
36382
36596
|
var scope = getPackageScopeForPath(directoryPath, state);
|
|
36383
36597
|
if (!scope) {
|
|
36384
36598
|
if (state.traceEnabled) {
|
|
@@ -36578,11 +36792,8 @@ var ts;
|
|
|
36578
36792
|
fragment = ts.ensureTrailingDirectorySeparator(commonDir_1);
|
|
36579
36793
|
}
|
|
36580
36794
|
}
|
|
36581
|
-
if (commonSourceDirGuesses.length > 1)
|
|
36582
|
-
state.
|
|
36583
|
-
? 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
|
|
36584
|
-
: 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, packagePath));
|
|
36585
|
-
}
|
|
36795
|
+
if (commonSourceDirGuesses.length > 1)
|
|
36796
|
+
state.reportResolutionDiagnostic({ isImports: isImports, entry: entry, packagePath: packagePath });
|
|
36586
36797
|
for (var _i = 0, commonSourceDirGuesses_1 = commonSourceDirGuesses; _i < commonSourceDirGuesses_1.length; _i++) {
|
|
36587
36798
|
var commonSourceDirGuess = commonSourceDirGuesses_1[_i];
|
|
36588
36799
|
var candidateDirectories = getOutputDirectoriesForBaseDirectory(commonSourceDirGuess);
|
|
@@ -36647,10 +36858,10 @@ var ts;
|
|
|
36647
36858
|
return loadModuleFromNearestNodeModulesDirectoryWorker(Extensions.DtsOnly, moduleName, directory, state, true, undefined, undefined);
|
|
36648
36859
|
}
|
|
36649
36860
|
function loadModuleFromNearestNodeModulesDirectoryWorker(extensions, moduleName, directory, state, typesScopeOnly, cache, redirectedReference) {
|
|
36650
|
-
var
|
|
36861
|
+
var mode = state.features === 0 ? undefined : state.features & NodeResolutionFeatures.EsmMode ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS;
|
|
36651
36862
|
return ts.forEachAncestorDirectory(ts.normalizeSlashes(directory), function (ancestorDirectory) {
|
|
36652
36863
|
if (ts.getBaseFileName(ancestorDirectory) !== "node_modules") {
|
|
36653
|
-
var resolutionFromCache = tryFindNonRelativeModuleNameInCache(
|
|
36864
|
+
var resolutionFromCache = tryFindNonRelativeModuleNameInCache(cache, moduleName, mode, ancestorDirectory, redirectedReference, state);
|
|
36654
36865
|
if (resolutionFromCache) {
|
|
36655
36866
|
return resolutionFromCache;
|
|
36656
36867
|
}
|
|
@@ -36787,8 +36998,8 @@ var ts;
|
|
|
36787
36998
|
typesPackageName;
|
|
36788
36999
|
}
|
|
36789
37000
|
ts.unmangleScopedPackageName = unmangleScopedPackageName;
|
|
36790
|
-
function tryFindNonRelativeModuleNameInCache(cache, moduleName, containingDirectory, state) {
|
|
36791
|
-
var result = cache
|
|
37001
|
+
function tryFindNonRelativeModuleNameInCache(cache, moduleName, mode, containingDirectory, redirectedReference, state) {
|
|
37002
|
+
var result = cache === null || cache === void 0 ? void 0 : cache.getFromModuleNameCache(containingDirectory, moduleName, mode, redirectedReference);
|
|
36792
37003
|
if (result) {
|
|
36793
37004
|
if (state.traceEnabled) {
|
|
36794
37005
|
trace(state.host, ts.Diagnostics.Resolution_for_module_0_was_found_in_cache_from_location_1, moduleName, containingDirectory);
|
|
@@ -36813,19 +37024,18 @@ var ts;
|
|
|
36813
37024
|
features: NodeResolutionFeatures.None,
|
|
36814
37025
|
conditions: [],
|
|
36815
37026
|
requestContainingDirectory: containingDirectory,
|
|
36816
|
-
|
|
37027
|
+
reportResolutionDiagnostic: function (diag) { return void diagnostics.push(diag); },
|
|
36817
37028
|
};
|
|
36818
37029
|
var resolved = tryResolve(Extensions.TypeScript) || tryResolve(Extensions.JavaScript);
|
|
36819
|
-
return createResolvedModuleWithFailedLookupLocations(resolved && resolved.value, false, failedLookupLocations, affectingLocations, diagnostics, state.resultFromCache);
|
|
37030
|
+
return createResolvedModuleWithFailedLookupLocations(compilerOptions, resolved && resolved.value, false, failedLookupLocations, affectingLocations, diagnostics, state.resultFromCache);
|
|
36820
37031
|
function tryResolve(extensions) {
|
|
36821
37032
|
var resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFileNoPackageId, state);
|
|
36822
37033
|
if (resolvedUsingSettings) {
|
|
36823
37034
|
return { value: resolvedUsingSettings };
|
|
36824
37035
|
}
|
|
36825
37036
|
if (!ts.isExternalModuleNameRelative(moduleName)) {
|
|
36826
|
-
var perModuleNameCache_1 = cache && cache.getOrCreateCacheForModuleName(moduleName, undefined, redirectedReference);
|
|
36827
37037
|
var resolved_3 = ts.forEachAncestorDirectory(containingDirectory, function (directory) {
|
|
36828
|
-
var resolutionFromCache = tryFindNonRelativeModuleNameInCache(
|
|
37038
|
+
var resolutionFromCache = tryFindNonRelativeModuleNameInCache(cache, moduleName, undefined, directory, redirectedReference, state);
|
|
36829
37039
|
if (resolutionFromCache) {
|
|
36830
37040
|
return resolutionFromCache;
|
|
36831
37041
|
}
|
|
@@ -36864,10 +37074,10 @@ var ts;
|
|
|
36864
37074
|
features: NodeResolutionFeatures.None,
|
|
36865
37075
|
conditions: [],
|
|
36866
37076
|
requestContainingDirectory: undefined,
|
|
36867
|
-
|
|
37077
|
+
reportResolutionDiagnostic: function (diag) { return void diagnostics.push(diag); },
|
|
36868
37078
|
};
|
|
36869
37079
|
var resolved = loadModuleFromImmediateNodeModulesDirectory(Extensions.DtsOnly, moduleName, globalCache, state, false, undefined, undefined);
|
|
36870
|
-
return createResolvedModuleWithFailedLookupLocations(resolved, true, failedLookupLocations, affectingLocations, diagnostics, state.resultFromCache);
|
|
37080
|
+
return createResolvedModuleWithFailedLookupLocations(compilerOptions, resolved, true, failedLookupLocations, affectingLocations, diagnostics, state.resultFromCache);
|
|
36871
37081
|
}
|
|
36872
37082
|
ts.loadModuleFromGlobalCache = loadModuleFromGlobalCache;
|
|
36873
37083
|
function toSearchResult(value) {
|
|
@@ -39880,9 +40090,10 @@ var ts;
|
|
|
39880
40090
|
host.getSourceFiles().forEach(function (sf) {
|
|
39881
40091
|
if (!sf.resolvedModules)
|
|
39882
40092
|
return;
|
|
39883
|
-
sf.resolvedModules.forEach(function (
|
|
39884
|
-
|
|
39885
|
-
|
|
40093
|
+
sf.resolvedModules.forEach(function (_a) {
|
|
40094
|
+
var resolvedModule = _a.resolvedModule;
|
|
40095
|
+
if (resolvedModule === null || resolvedModule === void 0 ? void 0 : resolvedModule.packageId)
|
|
40096
|
+
map.set(resolvedModule.packageId.name, resolvedModule.extension === ".d.ts" || !!map.get(resolvedModule.packageId.name));
|
|
39886
40097
|
});
|
|
39887
40098
|
});
|
|
39888
40099
|
return map;
|
|
@@ -42477,7 +42688,7 @@ var ts;
|
|
|
42477
42688
|
: undefined;
|
|
42478
42689
|
}
|
|
42479
42690
|
function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation) {
|
|
42480
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
42691
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
42481
42692
|
if (isForAugmentation === void 0) { isForAugmentation = false; }
|
|
42482
42693
|
if (ts.startsWith(moduleReference, "@types/")) {
|
|
42483
42694
|
var diag = ts.Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1;
|
|
@@ -42523,7 +42734,7 @@ var ts;
|
|
|
42523
42734
|
var diagnosticDetails = void 0;
|
|
42524
42735
|
var ext = ts.tryGetExtensionFromPath(currentSourceFile.fileName);
|
|
42525
42736
|
if (ext === ".ts" || ext === ".js" || ext === ".tsx" || ext === ".jsx") {
|
|
42526
|
-
var scope = currentSourceFile.packageJsonScope;
|
|
42737
|
+
var scope = (_h = currentSourceFile.packageJsonScope) === null || _h === void 0 ? void 0 : _h.info;
|
|
42527
42738
|
var targetExt = ext === ".ts" ? ".mts" : ext === ".js" ? ".mjs" : undefined;
|
|
42528
42739
|
if (scope && !scope.packageJsonContent.type) {
|
|
42529
42740
|
if (targetExt) {
|
|
@@ -42607,10 +42818,10 @@ var ts;
|
|
|
42607
42818
|
}
|
|
42608
42819
|
else if (mode === ts.ModuleKind.ESNext && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) {
|
|
42609
42820
|
var absoluteRef_1 = ts.getNormalizedAbsolutePath(moduleReference, ts.getDirectoryPath(currentSourceFile.path));
|
|
42610
|
-
var suggestedExt = (
|
|
42821
|
+
var suggestedExt = (_j = suggestedExtensions.find(function (_a) {
|
|
42611
42822
|
var actualExt = _a[0], _importExt = _a[1];
|
|
42612
42823
|
return host.fileExists(absoluteRef_1 + actualExt);
|
|
42613
|
-
})) === null ||
|
|
42824
|
+
})) === null || _j === void 0 ? void 0 : _j[1];
|
|
42614
42825
|
if (suggestedExt) {
|
|
42615
42826
|
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);
|
|
42616
42827
|
}
|
|
@@ -72974,12 +73185,12 @@ var ts;
|
|
|
72974
73185
|
var parent = node.parent;
|
|
72975
73186
|
var paramTag = node.parent.parent;
|
|
72976
73187
|
if (ts.isJSDocTypeExpression(node.parent) && ts.isJSDocParameterTag(paramTag)) {
|
|
72977
|
-
var
|
|
73188
|
+
var host_2 = ts.getHostSignatureFromJSDoc(paramTag);
|
|
72978
73189
|
var isCallbackTag = ts.isJSDocCallbackTag(paramTag.parent.parent);
|
|
72979
|
-
if (
|
|
73190
|
+
if (host_2 || isCallbackTag) {
|
|
72980
73191
|
var lastParamDeclaration = isCallbackTag
|
|
72981
73192
|
? ts.lastOrUndefined(paramTag.parent.parent.typeExpression.parameters)
|
|
72982
|
-
: ts.lastOrUndefined(
|
|
73193
|
+
: ts.lastOrUndefined(host_2.parameters);
|
|
72983
73194
|
var symbol = ts.getParameterSymbolFromJSDoc(paramTag);
|
|
72984
73195
|
if (!lastParamDeclaration ||
|
|
72985
73196
|
symbol && lastParamDeclaration.symbol === symbol && ts.isRestParameter(lastParamDeclaration)) {
|
|
@@ -74214,11 +74425,12 @@ var ts;
|
|
|
74214
74425
|
var fileToDirective;
|
|
74215
74426
|
if (resolvedTypeReferenceDirectives) {
|
|
74216
74427
|
fileToDirective = new ts.Map();
|
|
74217
|
-
resolvedTypeReferenceDirectives.forEach(function (
|
|
74218
|
-
|
|
74428
|
+
resolvedTypeReferenceDirectives.forEach(function (_a, key, mode) {
|
|
74429
|
+
var resolvedTypeReferenceDirective = _a.resolvedTypeReferenceDirective;
|
|
74430
|
+
if (!resolvedTypeReferenceDirective || !resolvedTypeReferenceDirective.resolvedFileName) {
|
|
74219
74431
|
return;
|
|
74220
74432
|
}
|
|
74221
|
-
var file = host.getSourceFile(
|
|
74433
|
+
var file = host.getSourceFile(resolvedTypeReferenceDirective.resolvedFileName);
|
|
74222
74434
|
if (file) {
|
|
74223
74435
|
addReferencedFilesToTypeDirective(file, key, mode);
|
|
74224
74436
|
}
|
|
@@ -75495,9 +75707,9 @@ var ts;
|
|
|
75495
75707
|
}
|
|
75496
75708
|
var parent = ts.walkUpParenthesizedTypes(node.parent);
|
|
75497
75709
|
if (ts.isInJSFile(parent) && ts.isJSDocTypeExpression(parent)) {
|
|
75498
|
-
var
|
|
75499
|
-
if (
|
|
75500
|
-
parent = ts.getSingleVariableOfVariableStatement(
|
|
75710
|
+
var host_3 = ts.getJSDocHost(parent);
|
|
75711
|
+
if (host_3) {
|
|
75712
|
+
parent = ts.getSingleVariableOfVariableStatement(host_3) || host_3;
|
|
75501
75713
|
}
|
|
75502
75714
|
}
|
|
75503
75715
|
switch (parent.kind) {
|
|
@@ -92014,7 +92226,7 @@ var ts;
|
|
|
92014
92226
|
var sourceMap = sourceMapGenerator.toString();
|
|
92015
92227
|
ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap, false, sourceFiles);
|
|
92016
92228
|
if (printer.bundleFileInfo)
|
|
92017
|
-
printer.bundleFileInfo.mapHash = ts.computeSignature(sourceMap,
|
|
92229
|
+
printer.bundleFileInfo.mapHash = ts.computeSignature(sourceMap, host);
|
|
92018
92230
|
}
|
|
92019
92231
|
}
|
|
92020
92232
|
else {
|
|
@@ -92023,7 +92235,7 @@ var ts;
|
|
|
92023
92235
|
var text = writer.getText();
|
|
92024
92236
|
ts.writeFile(host, emitterDiagnostics, jsFilePath, text, !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos, diagnostics: transform.diagnostics });
|
|
92025
92237
|
if (printer.bundleFileInfo)
|
|
92026
|
-
printer.bundleFileInfo.hash = ts.computeSignature(text,
|
|
92238
|
+
printer.bundleFileInfo.hash = ts.computeSignature(text, host);
|
|
92027
92239
|
writer.clear();
|
|
92028
92240
|
}
|
|
92029
92241
|
function shouldEmitSourceMaps(mapOptions, sourceFileOrBundle) {
|
|
@@ -92148,7 +92360,6 @@ var ts;
|
|
|
92148
92360
|
});
|
|
92149
92361
|
}
|
|
92150
92362
|
function emitUsingBuildInfo(config, host, getCommandLine, customTransformers) {
|
|
92151
|
-
var createHash = ts.maybeBind(host, host.createHash);
|
|
92152
92363
|
var _a = getOutputPathsForBundle(config.options, false), buildInfoPath = _a.buildInfoPath, jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath;
|
|
92153
92364
|
var buildInfo;
|
|
92154
92365
|
if (host.getBuildInfo) {
|
|
@@ -92168,22 +92379,22 @@ var ts;
|
|
|
92168
92379
|
var jsFileText = host.readFile(ts.Debug.checkDefined(jsFilePath));
|
|
92169
92380
|
if (!jsFileText)
|
|
92170
92381
|
return jsFilePath;
|
|
92171
|
-
if (ts.computeSignature(jsFileText,
|
|
92382
|
+
if (ts.computeSignature(jsFileText, host) !== buildInfo.bundle.js.hash)
|
|
92172
92383
|
return jsFilePath;
|
|
92173
92384
|
var sourceMapText = sourceMapFilePath && host.readFile(sourceMapFilePath);
|
|
92174
92385
|
if ((sourceMapFilePath && !sourceMapText) || config.options.inlineSourceMap)
|
|
92175
92386
|
return sourceMapFilePath || "inline sourcemap decoding";
|
|
92176
|
-
if (sourceMapFilePath && ts.computeSignature(sourceMapText,
|
|
92387
|
+
if (sourceMapFilePath && ts.computeSignature(sourceMapText, host) !== buildInfo.bundle.js.mapHash)
|
|
92177
92388
|
return sourceMapFilePath;
|
|
92178
92389
|
var declarationText = declarationFilePath && host.readFile(declarationFilePath);
|
|
92179
92390
|
if (declarationFilePath && !declarationText)
|
|
92180
92391
|
return declarationFilePath;
|
|
92181
|
-
if (declarationFilePath && ts.computeSignature(declarationText,
|
|
92392
|
+
if (declarationFilePath && ts.computeSignature(declarationText, host) !== buildInfo.bundle.dts.hash)
|
|
92182
92393
|
return declarationFilePath;
|
|
92183
92394
|
var declarationMapText = declarationMapPath && host.readFile(declarationMapPath);
|
|
92184
92395
|
if ((declarationMapPath && !declarationMapText) || config.options.inlineSourceMap)
|
|
92185
92396
|
return declarationMapPath || "inline sourcemap decoding";
|
|
92186
|
-
if (declarationMapPath && ts.computeSignature(declarationMapText,
|
|
92397
|
+
if (declarationMapPath && ts.computeSignature(declarationMapText, host) !== buildInfo.bundle.dts.mapHash)
|
|
92187
92398
|
return declarationMapPath;
|
|
92188
92399
|
var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
|
|
92189
92400
|
var ownPrependInput = ts.createInputFiles(jsFileText, declarationText, sourceMapFilePath, sourceMapText, declarationMapPath, declarationMapText, jsFilePath, declarationFilePath, buildInfoPath, buildInfo, true);
|
|
@@ -92221,7 +92432,7 @@ var ts;
|
|
|
92221
92432
|
var newBuildInfo = data.buildInfo;
|
|
92222
92433
|
newBuildInfo.program = buildInfo.program;
|
|
92223
92434
|
if (newBuildInfo.program && changedDtsText !== undefined && config.options.composite) {
|
|
92224
|
-
newBuildInfo.program.outSignature = ts.computeSignature(changedDtsText,
|
|
92435
|
+
newBuildInfo.program.outSignature = ts.computeSignature(changedDtsText, host, changedDtsData);
|
|
92225
92436
|
}
|
|
92226
92437
|
var _a = buildInfo.bundle, js = _a.js, dts = _a.dts, sourceFiles = _a.sourceFiles;
|
|
92227
92438
|
newBuildInfo.bundle.js.sources = js.sources;
|
|
@@ -92254,7 +92465,7 @@ var ts;
|
|
|
92254
92465
|
getSourceFileFromReference: ts.returnUndefined,
|
|
92255
92466
|
redirectTargetsMap: ts.createMultiMap(),
|
|
92256
92467
|
getFileIncludeReasons: ts.notImplemented,
|
|
92257
|
-
createHash: createHash,
|
|
92468
|
+
createHash: ts.maybeBind(host, host.createHash),
|
|
92258
92469
|
};
|
|
92259
92470
|
emitFiles(ts.notImplementedResolver, emitHost, undefined, ts.getTransformers(config.options, customTransformers));
|
|
92260
92471
|
return outputFiles;
|
|
@@ -97252,7 +97463,7 @@ var ts;
|
|
|
97252
97463
|
var name = names_2[_i];
|
|
97253
97464
|
var result = void 0;
|
|
97254
97465
|
var mode = getModeForFileReference(name, containingFileMode);
|
|
97255
|
-
var strName = ts.isString(name) ? name : name.fileName
|
|
97466
|
+
var strName = ts.isString(name) ? name : ts.toFileNameLowerCase(name.fileName);
|
|
97256
97467
|
var cacheKey = mode !== undefined ? mode + "|" + strName : strName;
|
|
97257
97468
|
if (cache.has(cacheKey)) {
|
|
97258
97469
|
result = cache.get(cacheKey);
|
|
@@ -97336,7 +97547,21 @@ var ts;
|
|
|
97336
97547
|
return elem.value.text === "import" ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS;
|
|
97337
97548
|
}
|
|
97338
97549
|
ts.getResolutionModeOverrideForClause = getResolutionModeOverrideForClause;
|
|
97339
|
-
|
|
97550
|
+
var emptyResolution = {
|
|
97551
|
+
resolvedModule: undefined,
|
|
97552
|
+
resolvedTypeReferenceDirective: undefined,
|
|
97553
|
+
failedLookupLocations: [],
|
|
97554
|
+
affectingLocations: [],
|
|
97555
|
+
resolutionDiagnostics: [],
|
|
97556
|
+
};
|
|
97557
|
+
function isResolvedModuleWithFailedLookupLocation(resolved) {
|
|
97558
|
+
return !!resolved && !!resolved.failedLookupLocations;
|
|
97559
|
+
}
|
|
97560
|
+
function isResolvedTypeReferenceDirectiveWithFailedLookupLocations(resolved) {
|
|
97561
|
+
return !!resolved && !!resolved.failedLookupLocations;
|
|
97562
|
+
}
|
|
97563
|
+
function loadWithModeAwareCache(names, containingFile, containingFileName, redirectedReference, partialResolutionInfo, loader) {
|
|
97564
|
+
var _a;
|
|
97340
97565
|
if (names.length === 0) {
|
|
97341
97566
|
return [];
|
|
97342
97567
|
}
|
|
@@ -97346,7 +97571,7 @@ var ts;
|
|
|
97346
97571
|
for (var _i = 0, names_3 = names; _i < names_3.length; _i++) {
|
|
97347
97572
|
var name = names_3[_i];
|
|
97348
97573
|
var result = void 0;
|
|
97349
|
-
var mode = getModeForResolutionAtIndex(containingFile, i);
|
|
97574
|
+
var mode = getModeForResolutionAtIndex(containingFile, (_a = partialResolutionInfo === null || partialResolutionInfo === void 0 ? void 0 : partialResolutionInfo.namesIndex[i]) !== null && _a !== void 0 ? _a : i);
|
|
97350
97575
|
i++;
|
|
97351
97576
|
var cacheKey = mode !== undefined ? mode + "|" + name : name;
|
|
97352
97577
|
if (cache.has(cacheKey)) {
|
|
@@ -97404,14 +97629,14 @@ var ts;
|
|
|
97404
97629
|
ts.isReferenceFileLocation = isReferenceFileLocation;
|
|
97405
97630
|
function getReferencedFileLocation(getSourceFileByPath, ref) {
|
|
97406
97631
|
var _a, _b, _c;
|
|
97407
|
-
var _d, _e, _f, _g;
|
|
97632
|
+
var _d, _e, _f, _g, _h, _j;
|
|
97408
97633
|
var file = ts.Debug.checkDefined(getSourceFileByPath(ref.file));
|
|
97409
97634
|
var kind = ref.kind, index = ref.index;
|
|
97410
97635
|
var pos, end, packageId, resolutionMode;
|
|
97411
97636
|
switch (kind) {
|
|
97412
97637
|
case ts.FileIncludeKind.Import:
|
|
97413
97638
|
var importLiteral = getModuleNameStringLiteralAt(file, index);
|
|
97414
|
-
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;
|
|
97639
|
+
packageId = (_f = (_e = (_d = file.resolvedModules) === null || _d === void 0 ? void 0 : _d.get(importLiteral.text, getModeForResolutionAtIndex(file, index))) === null || _e === void 0 ? void 0 : _e.resolvedModule) === null || _f === void 0 ? void 0 : _f.packageId;
|
|
97415
97640
|
if (importLiteral.pos === -1)
|
|
97416
97641
|
return { file: file, packageId: packageId, text: importLiteral.text };
|
|
97417
97642
|
pos = ts.skipTrivia(file.text, importLiteral.pos);
|
|
@@ -97422,7 +97647,7 @@ var ts;
|
|
|
97422
97647
|
break;
|
|
97423
97648
|
case ts.FileIncludeKind.TypeReferenceDirective:
|
|
97424
97649
|
(_b = file.typeReferenceDirectives[index], pos = _b.pos, end = _b.end, resolutionMode = _b.resolutionMode);
|
|
97425
|
-
packageId = (
|
|
97650
|
+
packageId = (_j = (_h = (_g = file.resolvedTypeReferenceDirectiveNames) === null || _g === void 0 ? void 0 : _g.get(ts.toFileNameLowerCase(file.typeReferenceDirectives[index].fileName), resolutionMode || file.impliedNodeFormat)) === null || _h === void 0 ? void 0 : _h.resolvedTypeReferenceDirective) === null || _j === void 0 ? void 0 : _j.packageId;
|
|
97426
97651
|
break;
|
|
97427
97652
|
case ts.FileIncludeKind.LibReferenceDirective:
|
|
97428
97653
|
(_c = file.libReferenceDirectives[index], pos = _c.pos, end = _c.end);
|
|
@@ -97506,13 +97731,13 @@ var ts;
|
|
|
97506
97731
|
return undefined;
|
|
97507
97732
|
}
|
|
97508
97733
|
function lookupFromPackageJson() {
|
|
97509
|
-
var
|
|
97510
|
-
var
|
|
97511
|
-
|
|
97512
|
-
|
|
97513
|
-
|
|
97514
|
-
|
|
97515
|
-
|
|
97734
|
+
var _a;
|
|
97735
|
+
var packageJsonScope = ts.getPackageScope(ts.getDirectoryPath(fileName), packageJsonInfoCache, host, options);
|
|
97736
|
+
var impliedNodeFormat = ((_a = packageJsonScope.info) === null || _a === void 0 ? void 0 : _a.packageJsonContent.type) === "module" ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS;
|
|
97737
|
+
return {
|
|
97738
|
+
impliedNodeFormat: impliedNodeFormat,
|
|
97739
|
+
packageJsonScope: packageJsonScope,
|
|
97740
|
+
};
|
|
97516
97741
|
}
|
|
97517
97742
|
}
|
|
97518
97743
|
ts.getImpliedNodeFormatForFileWorker = getImpliedNodeFormatForFileWorker;
|
|
@@ -97624,10 +97849,10 @@ var ts;
|
|
|
97624
97849
|
};
|
|
97625
97850
|
}
|
|
97626
97851
|
function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) {
|
|
97627
|
-
var _a, _b, _c, _d;
|
|
97852
|
+
var _a, _b, _c, _d, _e;
|
|
97628
97853
|
var createProgramOptions = ts.isArray(rootNamesOrOptions) ? createCreateProgramOptions(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) : rootNamesOrOptions;
|
|
97629
97854
|
var rootNames = createProgramOptions.rootNames, options = createProgramOptions.options, configFileParsingDiagnostics = createProgramOptions.configFileParsingDiagnostics, projectReferences = createProgramOptions.projectReferences;
|
|
97630
|
-
var
|
|
97855
|
+
var oldProgramOrOldBuildInfoProgramConstructor = createProgramOptions.oldProgram;
|
|
97631
97856
|
var processingDefaultLibFiles;
|
|
97632
97857
|
var processingOtherFiles;
|
|
97633
97858
|
var files;
|
|
@@ -97641,6 +97866,8 @@ var ts;
|
|
|
97641
97866
|
var cachedDeclarationDiagnosticsForFile = {};
|
|
97642
97867
|
var resolvedTypeReferenceDirectives = ts.createModeAwareCache();
|
|
97643
97868
|
var fileProcessingDiagnostics;
|
|
97869
|
+
var automaticTypeDirectiveNames;
|
|
97870
|
+
var automaticTypeDirectiveResolutions;
|
|
97644
97871
|
var maxNodeModuleJsDepth = typeof options.maxNodeModuleJsDepth === "number" ? options.maxNodeModuleJsDepth : 0;
|
|
97645
97872
|
var currentNodeModulesDepth = 0;
|
|
97646
97873
|
var modulesWithElidedImports = new ts.Map();
|
|
@@ -97663,29 +97890,72 @@ var ts;
|
|
|
97663
97890
|
var actualResolveModuleNamesWorker;
|
|
97664
97891
|
var hasInvalidatedResolution = host.hasInvalidatedResolution || ts.returnFalse;
|
|
97665
97892
|
if (host.resolveModuleNames) {
|
|
97666
|
-
actualResolveModuleNamesWorker = function (moduleNames, containingFile, containingFileName,
|
|
97667
|
-
|
|
97668
|
-
|
|
97669
|
-
|
|
97670
|
-
|
|
97671
|
-
|
|
97672
|
-
return
|
|
97673
|
-
|
|
97893
|
+
actualResolveModuleNamesWorker = function (moduleNames, containingFile, containingFileName, redirectedReference, partialResolutionInfo) {
|
|
97894
|
+
var _a;
|
|
97895
|
+
var result = host.resolveModuleNames(moduleNames, containingFileName, (_a = partialResolutionInfo === null || partialResolutionInfo === void 0 ? void 0 : partialResolutionInfo.reusedNames) === null || _a === void 0 ? void 0 : _a.map(function (_a) {
|
|
97896
|
+
var name = _a.name;
|
|
97897
|
+
return name;
|
|
97898
|
+
}), redirectedReference, options, containingFile, partialResolutionInfo);
|
|
97899
|
+
return result.some(isResolvedModuleWithFailedLookupLocation) ?
|
|
97900
|
+
result :
|
|
97901
|
+
result.map(function (resolved) { return resolved ?
|
|
97902
|
+
resolved.extension !== undefined ?
|
|
97903
|
+
{ resolvedModule: resolved, failedLookupLocations: emptyResolution.failedLookupLocations } :
|
|
97904
|
+
{ resolvedModule: __assign(__assign({}, resolved), { extension: ts.extensionFromPath(resolved.resolvedFileName) }), failedLookupLocations: emptyResolution.failedLookupLocations } :
|
|
97905
|
+
emptyResolution; });
|
|
97906
|
+
};
|
|
97674
97907
|
moduleResolutionCache = (_a = host.getModuleResolutionCache) === null || _a === void 0 ? void 0 : _a.call(host);
|
|
97675
97908
|
}
|
|
97676
97909
|
else {
|
|
97677
97910
|
moduleResolutionCache = ts.createModuleResolutionCache(currentDirectory, getCanonicalFileName, options);
|
|
97678
|
-
var loader_1 = function (moduleName, resolverMode, containingFileName, redirectedReference) { return ts.resolveModuleName(moduleName, containingFileName, options, host, moduleResolutionCache, redirectedReference, resolverMode)
|
|
97679
|
-
actualResolveModuleNamesWorker = function (moduleNames, containingFile, containingFileName,
|
|
97911
|
+
var loader_1 = function (moduleName, resolverMode, containingFileName, redirectedReference) { return ts.resolveModuleName(moduleName, containingFileName, options, host, moduleResolutionCache, redirectedReference, resolverMode); };
|
|
97912
|
+
actualResolveModuleNamesWorker = function (moduleNames, containingFile, containingFileName, redirectedReference, partialResolutionInfo) {
|
|
97913
|
+
return loadWithModeAwareCache(moduleNames, containingFile, containingFileName, redirectedReference, partialResolutionInfo, loader_1);
|
|
97914
|
+
};
|
|
97680
97915
|
}
|
|
97681
97916
|
var actualResolveTypeReferenceDirectiveNamesWorker;
|
|
97682
97917
|
if (host.resolveTypeReferenceDirectives) {
|
|
97683
|
-
actualResolveTypeReferenceDirectiveNamesWorker = function (typeDirectiveNames, containingFile, redirectedReference, containingFileMode
|
|
97918
|
+
actualResolveTypeReferenceDirectiveNamesWorker = function (typeDirectiveNames, containingFile, redirectedReference, containingFileMode, partialResolutionInfo) {
|
|
97919
|
+
var result = host.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference, options, containingFileMode, partialResolutionInfo);
|
|
97920
|
+
return result.some(isResolvedTypeReferenceDirectiveWithFailedLookupLocations) ?
|
|
97921
|
+
result :
|
|
97922
|
+
result.map(function (resolved) { return resolved ?
|
|
97923
|
+
{ resolvedTypeReferenceDirective: resolved, failedLookupLocations: emptyResolution.failedLookupLocations } :
|
|
97924
|
+
emptyResolution; });
|
|
97925
|
+
};
|
|
97926
|
+
typeReferenceDirectiveResolutionCache = (_b = host.getTypeReferenceDirectiveResolutionCache) === null || _b === void 0 ? void 0 : _b.call(host);
|
|
97684
97927
|
}
|
|
97685
97928
|
else {
|
|
97686
97929
|
typeReferenceDirectiveResolutionCache = ts.createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, undefined, moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache());
|
|
97687
|
-
var loader_2 = function (typesRef, containingFile, redirectedReference, resolutionMode) { return ts.resolveTypeReferenceDirective(typesRef, containingFile, options, host, redirectedReference, typeReferenceDirectiveResolutionCache, resolutionMode)
|
|
97688
|
-
actualResolveTypeReferenceDirectiveNamesWorker = function (typeReferenceDirectiveNames, containingFile, redirectedReference, containingFileMode) {
|
|
97930
|
+
var loader_2 = function (typesRef, containingFile, redirectedReference, resolutionMode) { return ts.resolveTypeReferenceDirective(typesRef, containingFile, options, host, redirectedReference, typeReferenceDirectiveResolutionCache, resolutionMode); };
|
|
97931
|
+
actualResolveTypeReferenceDirectiveNamesWorker = function (typeReferenceDirectiveNames, containingFile, redirectedReference, containingFileMode) {
|
|
97932
|
+
return loadWithTypeDirectiveCache(typeReferenceDirectiveNames, containingFile, redirectedReference, containingFileMode, loader_2);
|
|
97933
|
+
};
|
|
97934
|
+
}
|
|
97935
|
+
var oldProgram = typeof oldProgramOrOldBuildInfoProgramConstructor === "object" ? oldProgramOrOldBuildInfoProgramConstructor : undefined;
|
|
97936
|
+
var oldBuildInfoProgram;
|
|
97937
|
+
if (!oldProgram && typeof oldProgramOrOldBuildInfoProgramConstructor === "function") {
|
|
97938
|
+
var state_11 = ts.getTemporaryModuleResolutionState(moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache(), host, options);
|
|
97939
|
+
oldBuildInfoProgram = oldProgramOrOldBuildInfoProgramConstructor({
|
|
97940
|
+
fileExists: function (fileName) { return host.fileExists(fileName); },
|
|
97941
|
+
createHash: ts.maybeBind(host, host.createHash),
|
|
97942
|
+
getPackageJsonInfo: function (fileName) { return ts.getPackageJsonInfo(ts.getDirectoryPath(fileName), false, state_11); },
|
|
97943
|
+
});
|
|
97944
|
+
if (oldBuildInfoProgram) {
|
|
97945
|
+
moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.setOldResolutionCache({
|
|
97946
|
+
getResolved: function (dirPath, name, mode, redirectedReference) {
|
|
97947
|
+
return oldBuildInfoProgram === null || oldBuildInfoProgram === void 0 ? void 0 : oldBuildInfoProgram.getResolvedModule(dirPath, name, mode, redirectedReference);
|
|
97948
|
+
}
|
|
97949
|
+
});
|
|
97950
|
+
typeReferenceDirectiveResolutionCache === null || typeReferenceDirectiveResolutionCache === void 0 ? void 0 : typeReferenceDirectiveResolutionCache.setOldResolutionCache({
|
|
97951
|
+
getResolved: function (dirPath, name, mode, redirectedReference) {
|
|
97952
|
+
return oldBuildInfoProgram === null || oldBuildInfoProgram === void 0 ? void 0 : oldBuildInfoProgram.getResolvedTypeReferenceDirective(dirPath, name, mode, redirectedReference);
|
|
97953
|
+
}
|
|
97954
|
+
});
|
|
97955
|
+
moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache().setOldPackageJsonScopeCache({
|
|
97956
|
+
getPackageJsonScope: function (dirPath) { return oldBuildInfoProgram === null || oldBuildInfoProgram === void 0 ? void 0 : oldBuildInfoProgram.getPackageJsonScope(dirPath); }
|
|
97957
|
+
});
|
|
97958
|
+
}
|
|
97689
97959
|
}
|
|
97690
97960
|
var packageIdToSourceFile = new ts.Map();
|
|
97691
97961
|
var sourceFileToPackageName = new ts.Map();
|
|
@@ -97698,9 +97968,9 @@ var ts;
|
|
|
97698
97968
|
var projectReferenceRedirects;
|
|
97699
97969
|
var mapFromFileToProjectReferenceRedirects;
|
|
97700
97970
|
var mapFromToProjectReferenceRedirectSource;
|
|
97701
|
-
var useSourceOfProjectReferenceRedirect = !!((
|
|
97971
|
+
var useSourceOfProjectReferenceRedirect = !!((_c = host.useSourceOfProjectReferenceRedirect) === null || _c === void 0 ? void 0 : _c.call(host)) &&
|
|
97702
97972
|
!options.disableSourceOfProjectReferenceRedirect;
|
|
97703
|
-
var
|
|
97973
|
+
var _f = updateHostForUseSourceOfProjectReferenceRedirect({
|
|
97704
97974
|
compilerHost: host,
|
|
97705
97975
|
getSymlinkCache: getSymlinkCache,
|
|
97706
97976
|
useSourceOfProjectReferenceRedirect: useSourceOfProjectReferenceRedirect,
|
|
@@ -97708,7 +97978,7 @@ var ts;
|
|
|
97708
97978
|
getResolvedProjectReferences: getResolvedProjectReferences,
|
|
97709
97979
|
getSourceOfProjectReferenceRedirect: getSourceOfProjectReferenceRedirect,
|
|
97710
97980
|
forEachResolvedProjectReference: forEachResolvedProjectReference
|
|
97711
|
-
}), onProgramCreateComplete =
|
|
97981
|
+
}), onProgramCreateComplete = _f.onProgramCreateComplete, fileExists = _f.fileExists, directoryExists = _f.directoryExists;
|
|
97712
97982
|
var readFile = host.readFile.bind(host);
|
|
97713
97983
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program", "shouldProgramCreateNewSourceFiles", { hasOldProgram: !!oldProgram });
|
|
97714
97984
|
var shouldCreateNewSourceFile = shouldProgramCreateNewSourceFiles(oldProgram, options);
|
|
@@ -97717,7 +97987,7 @@ var ts;
|
|
|
97717
97987
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program", "tryReuseStructureFromOldProgram", {});
|
|
97718
97988
|
structureIsReused = tryReuseStructureFromOldProgram();
|
|
97719
97989
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
97720
|
-
if (structureIsReused !==
|
|
97990
|
+
if (structureIsReused !== 3) {
|
|
97721
97991
|
processingDefaultLibFiles = [];
|
|
97722
97992
|
processingOtherFiles = [];
|
|
97723
97993
|
if (projectReferences) {
|
|
@@ -97757,14 +98027,14 @@ var ts;
|
|
|
97757
98027
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program", "processRootFiles", { count: rootNames.length });
|
|
97758
98028
|
ts.forEach(rootNames, function (name, index) { return processRootFile(name, false, false, { kind: ts.FileIncludeKind.RootFile, index: index }); });
|
|
97759
98029
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
97760
|
-
|
|
97761
|
-
|
|
97762
|
-
|
|
97763
|
-
|
|
97764
|
-
var
|
|
97765
|
-
var
|
|
97766
|
-
|
|
97767
|
-
processTypeReferenceDirective(
|
|
98030
|
+
automaticTypeDirectiveNames !== null && automaticTypeDirectiveNames !== void 0 ? automaticTypeDirectiveNames : (automaticTypeDirectiveNames = rootNames.length ? ts.getAutomaticTypeDirectiveNames(options, host) : ts.emptyArray);
|
|
98031
|
+
automaticTypeDirectiveResolutions = ts.createModeAwareCache();
|
|
98032
|
+
if (automaticTypeDirectiveNames.length) {
|
|
98033
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program", "processTypeReferences", { count: automaticTypeDirectiveNames.length });
|
|
98034
|
+
var resolutions = resolveTypeReferenceDirectiveNamesReusingOldState(automaticTypeDirectiveNames, getAutomaticTypeDirectiveContainingFile());
|
|
98035
|
+
for (var i = 0; i < automaticTypeDirectiveNames.length; i++) {
|
|
98036
|
+
automaticTypeDirectiveResolutions.set(automaticTypeDirectiveNames[i], undefined, resolutions[i]);
|
|
98037
|
+
processTypeReferenceDirective(automaticTypeDirectiveNames[i], undefined, resolutions[i], { kind: ts.FileIncludeKind.AutomaticTypeDirectiveFile, typeReference: automaticTypeDirectiveNames[i], packageId: (_d = resolutions[i].resolvedTypeReferenceDirective) === null || _d === void 0 ? void 0 : _d.packageId });
|
|
97768
98038
|
}
|
|
97769
98039
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
97770
98040
|
}
|
|
@@ -97795,13 +98065,13 @@ var ts;
|
|
|
97795
98065
|
var newFile = getSourceFileByPath(oldSourceFile.resolvedPath);
|
|
97796
98066
|
if (shouldCreateNewSourceFile || !newFile || newFile.impliedNodeFormat !== oldSourceFile.impliedNodeFormat ||
|
|
97797
98067
|
(oldSourceFile.resolvedPath === oldSourceFile.path && newFile.resolvedPath !== oldSourceFile.path)) {
|
|
97798
|
-
host.onReleaseOldSourceFile(oldSourceFile, oldProgram.getCompilerOptions()
|
|
98068
|
+
host.onReleaseOldSourceFile(oldSourceFile, oldProgram.getCompilerOptions());
|
|
97799
98069
|
}
|
|
97800
98070
|
}
|
|
97801
98071
|
if (!host.getParsedCommandLine) {
|
|
97802
98072
|
oldProgram.forEachResolvedProjectReference(function (resolvedProjectReference) {
|
|
97803
98073
|
if (!getResolvedProjectReferenceByPath(resolvedProjectReference.sourceFile.path)) {
|
|
97804
|
-
host.onReleaseOldSourceFile(resolvedProjectReference.sourceFile, oldProgram.getCompilerOptions()
|
|
98074
|
+
host.onReleaseOldSourceFile(resolvedProjectReference.sourceFile, oldProgram.getCompilerOptions());
|
|
97805
98075
|
}
|
|
97806
98076
|
});
|
|
97807
98077
|
}
|
|
@@ -97817,6 +98087,8 @@ var ts;
|
|
|
97817
98087
|
}
|
|
97818
98088
|
typeReferenceDirectiveResolutionCache = undefined;
|
|
97819
98089
|
oldProgram = undefined;
|
|
98090
|
+
oldBuildInfoProgram = undefined;
|
|
98091
|
+
oldProgramOrOldBuildInfoProgramConstructor = undefined;
|
|
97820
98092
|
var program = {
|
|
97821
98093
|
getRootFileNames: function () { return rootNames; },
|
|
97822
98094
|
getSourceFile: getSourceFile,
|
|
@@ -97824,6 +98096,7 @@ var ts;
|
|
|
97824
98096
|
getSourceFiles: function () { return files; },
|
|
97825
98097
|
getMissingFilePaths: function () { return missingFilePaths; },
|
|
97826
98098
|
getModuleResolutionCache: function () { return moduleResolutionCache; },
|
|
98099
|
+
getTypeReferenceDirectiveResolutionCache: function () { return typeReferenceDirectiveResolutionCache; },
|
|
97827
98100
|
getFilesByNameMap: function () { return filesByName; },
|
|
97828
98101
|
getCompilerOptions: function () { return options; },
|
|
97829
98102
|
getSyntacticDiagnostics: getSyntacticDiagnostics,
|
|
@@ -97848,6 +98121,9 @@ var ts;
|
|
|
97848
98121
|
getRelationCacheSizes: function () { return getTypeChecker().getRelationCacheSizes(); },
|
|
97849
98122
|
getFileProcessingDiagnostics: function () { return fileProcessingDiagnostics; },
|
|
97850
98123
|
getResolvedTypeReferenceDirectives: function () { return resolvedTypeReferenceDirectives; },
|
|
98124
|
+
getAutomaticTypeDirectiveNames: function () { return automaticTypeDirectiveNames; },
|
|
98125
|
+
getAutomaticTypeDirectiveResolutions: function () { return automaticTypeDirectiveResolutions; },
|
|
98126
|
+
getAutomaticTypeDirectiveContainingFile: getAutomaticTypeDirectiveContainingFile,
|
|
97851
98127
|
isSourceFileFromExternalLibrary: isSourceFileFromExternalLibrary,
|
|
97852
98128
|
isSourceFileDefaultLibrary: isSourceFileDefaultLibrary,
|
|
97853
98129
|
getSourceFileFromReference: getSourceFileFromReference,
|
|
@@ -97857,12 +98133,12 @@ var ts;
|
|
|
97857
98133
|
usesUriStyleNodeCoreModules: usesUriStyleNodeCoreModules,
|
|
97858
98134
|
isEmittedFile: isEmittedFile,
|
|
97859
98135
|
getConfigFileParsingDiagnostics: getConfigFileParsingDiagnostics,
|
|
97860
|
-
getResolvedModuleWithFailedLookupLocationsFromCache: getResolvedModuleWithFailedLookupLocationsFromCache,
|
|
97861
98136
|
getProjectReferences: getProjectReferences,
|
|
97862
98137
|
getResolvedProjectReferences: getResolvedProjectReferences,
|
|
97863
98138
|
getProjectReferenceRedirect: getProjectReferenceRedirect,
|
|
97864
98139
|
getResolvedProjectReferenceToRedirect: getResolvedProjectReferenceToRedirect,
|
|
97865
98140
|
getResolvedProjectReferenceByPath: getResolvedProjectReferenceByPath,
|
|
98141
|
+
getRedirectReferenceForResolution: getRedirectReferenceForResolution,
|
|
97866
98142
|
forEachResolvedProjectReference: forEachResolvedProjectReference,
|
|
97867
98143
|
isSourceOfProjectReferenceRedirect: isSourceOfProjectReferenceRedirect,
|
|
97868
98144
|
emitBuildInfo: emitBuildInfo,
|
|
@@ -97870,7 +98146,7 @@ var ts;
|
|
|
97870
98146
|
readFile: readFile,
|
|
97871
98147
|
directoryExists: directoryExists,
|
|
97872
98148
|
getSymlinkCache: getSymlinkCache,
|
|
97873
|
-
realpath: (
|
|
98149
|
+
realpath: (_e = host.realpath) === null || _e === void 0 ? void 0 : _e.bind(host),
|
|
97874
98150
|
useCaseSensitiveFileNames: function () { return host.useCaseSensitiveFileNames(); },
|
|
97875
98151
|
getFileIncludeReasons: function () { return fileReasons; },
|
|
97876
98152
|
structureIsReused: structureIsReused,
|
|
@@ -97884,6 +98160,8 @@ var ts;
|
|
|
97884
98160
|
case 0:
|
|
97885
98161
|
var _a = getReferencedFileLocation(getSourceFileByPath, diagnostic.reason), file = _a.file, pos = _a.pos, end = _a.end;
|
|
97886
98162
|
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)));
|
|
98163
|
+
case 2:
|
|
98164
|
+
return diagnostic.diagnostics.forEach(function (d) { return programDiagnostics.add(d); });
|
|
97887
98165
|
default:
|
|
97888
98166
|
ts.Debug.assertNever(diagnostic);
|
|
97889
98167
|
}
|
|
@@ -97893,57 +98171,44 @@ var ts;
|
|
|
97893
98171
|
ts.performance.measure("Program", "beforeProgram", "afterProgram");
|
|
97894
98172
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
97895
98173
|
return program;
|
|
97896
|
-
function
|
|
97897
|
-
|
|
97898
|
-
|
|
97899
|
-
for (var _i = 0, list_3 = list; _i < list_3.length; _i++) {
|
|
97900
|
-
var elem = list_3[_i];
|
|
97901
|
-
programDiagnostics.add(elem);
|
|
97902
|
-
}
|
|
98174
|
+
function getAutomaticTypeDirectiveContainingFile() {
|
|
98175
|
+
var containingDirectory = options.configFilePath ? ts.getDirectoryPath(options.configFilePath) : host.getCurrentDirectory();
|
|
98176
|
+
return ts.combinePaths(containingDirectory, ts.inferredTypesContainingFile);
|
|
97903
98177
|
}
|
|
97904
|
-
function
|
|
97905
|
-
|
|
97906
|
-
if (!moduleResolutionCache)
|
|
98178
|
+
function addResolutionDiagnostics(resolution) {
|
|
98179
|
+
if (!resolution.resolutionDiagnostics)
|
|
97907
98180
|
return;
|
|
97908
|
-
|
|
97909
|
-
|
|
97910
|
-
|
|
97911
|
-
|
|
97912
|
-
|
|
97913
|
-
|
|
97914
|
-
var n = names_4[_i];
|
|
97915
|
-
var mode = typeof n === "string" ? getModeForResolutionAtIndex(containingFile, i) : getModeForFileReference(n, containingFileMode);
|
|
97916
|
-
var name = typeof n === "string" ? n : n.fileName;
|
|
97917
|
-
i++;
|
|
97918
|
-
if (ts.isExternalModuleNameRelative(name))
|
|
97919
|
-
continue;
|
|
97920
|
-
var diags = (_a = moduleResolutionCache.getOrCreateCacheForModuleName(name, mode, redirectedReference).get(containingDir)) === null || _a === void 0 ? void 0 : _a.resolutionDiagnostics;
|
|
97921
|
-
addResolutionDiagnostics(diags);
|
|
97922
|
-
}
|
|
98181
|
+
(fileProcessingDiagnostics !== null && fileProcessingDiagnostics !== void 0 ? fileProcessingDiagnostics : (fileProcessingDiagnostics = [])).push({
|
|
98182
|
+
kind: 2,
|
|
98183
|
+
diagnostics: resolution.resolutionDiagnostics.map(function (d) { return ts.createCompilerDiagnostic(d.isImports
|
|
98184
|
+
? 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
|
|
98185
|
+
: 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, d.entry === "" ? "." : d.entry, d.packagePath); })
|
|
98186
|
+
});
|
|
97923
98187
|
}
|
|
97924
|
-
function resolveModuleNamesWorker(moduleNames, containingFile,
|
|
98188
|
+
function resolveModuleNamesWorker(moduleNames, containingFile, partialResolutionInfo, redirectedReference) {
|
|
97925
98189
|
if (!moduleNames.length)
|
|
97926
98190
|
return ts.emptyArray;
|
|
97927
98191
|
var containingFileName = ts.getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory);
|
|
97928
|
-
|
|
98192
|
+
if (redirectedReference === undefined)
|
|
98193
|
+
redirectedReference = getRedirectReferenceForResolution(containingFile);
|
|
97929
98194
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program", "resolveModuleNamesWorker", { containingFileName: containingFileName });
|
|
97930
98195
|
ts.performance.mark("beforeResolveModule");
|
|
97931
|
-
var result = actualResolveModuleNamesWorker(moduleNames, containingFile, containingFileName,
|
|
98196
|
+
var result = actualResolveModuleNamesWorker(moduleNames, containingFile, containingFileName, redirectedReference || undefined, partialResolutionInfo);
|
|
97932
98197
|
ts.performance.mark("afterResolveModule");
|
|
97933
98198
|
ts.performance.measure("ResolveModule", "beforeResolveModule", "afterResolveModule");
|
|
97934
98199
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
97935
|
-
pullDiagnosticsFromCache(moduleNames, containingFile);
|
|
97936
98200
|
return result;
|
|
97937
98201
|
}
|
|
97938
|
-
function resolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFile) {
|
|
98202
|
+
function resolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFile, partialResolutionInfo, redirectedReference) {
|
|
97939
98203
|
if (!typeDirectiveNames.length)
|
|
97940
98204
|
return [];
|
|
97941
98205
|
var containingFileName = !ts.isString(containingFile) ? ts.getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory) : containingFile;
|
|
97942
|
-
|
|
98206
|
+
if (redirectedReference === undefined && !ts.isString(containingFile))
|
|
98207
|
+
redirectedReference = getRedirectReferenceForResolution(containingFile);
|
|
97943
98208
|
var containingFileMode = !ts.isString(containingFile) ? containingFile.impliedNodeFormat : undefined;
|
|
97944
98209
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program", "resolveTypeReferenceDirectiveNamesWorker", { containingFileName: containingFileName });
|
|
97945
98210
|
ts.performance.mark("beforeResolveTypeReference");
|
|
97946
|
-
var result = actualResolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFileName, redirectedReference, containingFileMode);
|
|
98211
|
+
var result = actualResolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFileName, redirectedReference || undefined, containingFileMode, partialResolutionInfo);
|
|
97947
98212
|
ts.performance.mark("afterResolveTypeReference");
|
|
97948
98213
|
ts.performance.measure("ResolveTypeReference", "beforeResolveTypeReference", "afterResolveTypeReference");
|
|
97949
98214
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
@@ -97989,9 +98254,6 @@ var ts;
|
|
|
97989
98254
|
}
|
|
97990
98255
|
return ts.libs.length + 2;
|
|
97991
98256
|
}
|
|
97992
|
-
function getResolvedModuleWithFailedLookupLocationsFromCache(moduleName, containingFile, mode) {
|
|
97993
|
-
return moduleResolutionCache && ts.resolveModuleNameFromCache(moduleName, containingFile, moduleResolutionCache, mode);
|
|
97994
|
-
}
|
|
97995
98257
|
function toPath(fileName) {
|
|
97996
98258
|
return ts.toPath(fileName, currentDirectory, getCanonicalFileName);
|
|
97997
98259
|
}
|
|
@@ -98015,8 +98277,9 @@ var ts;
|
|
|
98015
98277
|
return classifiableNames;
|
|
98016
98278
|
}
|
|
98017
98279
|
function resolveModuleNamesReusingOldState(moduleNames, file) {
|
|
98280
|
+
var _a;
|
|
98018
98281
|
if (structureIsReused === 0 && !file.ambientModuleNames.length) {
|
|
98019
|
-
return resolveModuleNamesWorker(moduleNames, file, undefined);
|
|
98282
|
+
return resolveModuleNamesWorker(moduleNames, file, undefined, undefined);
|
|
98020
98283
|
}
|
|
98021
98284
|
var oldSourceFile = oldProgram && oldProgram.getSourceFile(file.fileName);
|
|
98022
98285
|
if (oldSourceFile !== file && file.resolvedModules) {
|
|
@@ -98031,21 +98294,34 @@ var ts;
|
|
|
98031
98294
|
return result_14;
|
|
98032
98295
|
}
|
|
98033
98296
|
var unknownModuleNames;
|
|
98034
|
-
var
|
|
98297
|
+
var unknownModuleNamesIndex;
|
|
98035
98298
|
var reusedNames;
|
|
98036
|
-
var
|
|
98299
|
+
var result;
|
|
98300
|
+
var predictedToResolveToAmbientModuleMarker = true;
|
|
98301
|
+
var redirectedReference;
|
|
98037
98302
|
for (var i = 0; i < moduleNames.length; i++) {
|
|
98038
98303
|
var moduleName = moduleNames[i];
|
|
98039
|
-
if (file === oldSourceFile && !hasInvalidatedResolution(oldSourceFile.path)) {
|
|
98040
|
-
var
|
|
98041
|
-
|
|
98304
|
+
if (oldBuildInfoProgram || file === oldSourceFile && !hasInvalidatedResolution(oldSourceFile.path)) {
|
|
98305
|
+
var mode = getModeForResolutionAtIndex(file, i);
|
|
98306
|
+
var oldResolution = !oldBuildInfoProgram ?
|
|
98307
|
+
(_a = oldSourceFile === null || oldSourceFile === void 0 ? void 0 : oldSourceFile.resolvedModules) === null || _a === void 0 ? void 0 : _a.get(moduleName, mode) :
|
|
98308
|
+
oldBuildInfoProgram.getResolvedModule(ts.getDirectoryPath(file.path), moduleName, mode, (redirectedReference === undefined ? (redirectedReference = getRedirectReferenceForResolution(file) || false) : redirectedReference) || undefined);
|
|
98309
|
+
if (oldResolution === null || oldResolution === void 0 ? void 0 : oldResolution.resolvedModule) {
|
|
98042
98310
|
if (ts.isTraceEnabled(options, host)) {
|
|
98043
|
-
ts.
|
|
98044
|
-
|
|
98045
|
-
ts.
|
|
98311
|
+
var fileLocation = ts.getNormalizedAbsolutePath(file.originalFileName, currentDirectory);
|
|
98312
|
+
if (!oldBuildInfoProgram) {
|
|
98313
|
+
ts.trace(host, oldResolution.resolvedModule.packageId ?
|
|
98314
|
+
ts.Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 :
|
|
98315
|
+
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));
|
|
98316
|
+
}
|
|
98317
|
+
else {
|
|
98318
|
+
ts.trace(host, oldResolution.resolvedModule.packageId ?
|
|
98319
|
+
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 :
|
|
98320
|
+
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));
|
|
98321
|
+
}
|
|
98046
98322
|
}
|
|
98047
|
-
(result
|
|
98048
|
-
(reusedNames
|
|
98323
|
+
(result !== null && result !== void 0 ? result : (result = new Array(moduleNames.length)))[i] = oldResolution;
|
|
98324
|
+
(reusedNames !== null && reusedNames !== void 0 ? reusedNames : (reusedNames = [])).push({ name: moduleName, mode: mode });
|
|
98049
98325
|
continue;
|
|
98050
98326
|
}
|
|
98051
98327
|
}
|
|
@@ -98060,14 +98336,15 @@ var ts;
|
|
|
98060
98336
|
resolvesToAmbientModuleInNonModifiedFile = moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName, i);
|
|
98061
98337
|
}
|
|
98062
98338
|
if (resolvesToAmbientModuleInNonModifiedFile) {
|
|
98063
|
-
(result
|
|
98339
|
+
(result !== null && result !== void 0 ? result : (result = new Array(moduleNames.length)))[i] = predictedToResolveToAmbientModuleMarker;
|
|
98064
98340
|
}
|
|
98065
98341
|
else {
|
|
98066
|
-
(unknownModuleNames
|
|
98342
|
+
(unknownModuleNames !== null && unknownModuleNames !== void 0 ? unknownModuleNames : (unknownModuleNames = [])).push(moduleName);
|
|
98343
|
+
(unknownModuleNamesIndex !== null && unknownModuleNamesIndex !== void 0 ? unknownModuleNamesIndex : (unknownModuleNamesIndex = [])).push(i);
|
|
98067
98344
|
}
|
|
98068
98345
|
}
|
|
98069
98346
|
var resolutions = unknownModuleNames && unknownModuleNames.length
|
|
98070
|
-
? resolveModuleNamesWorker(unknownModuleNames, file, reusedNames)
|
|
98347
|
+
? resolveModuleNamesWorker(unknownModuleNames, file, { reusedNames: reusedNames, namesIndex: unknownModuleNamesIndex }, redirectedReference)
|
|
98071
98348
|
: ts.emptyArray;
|
|
98072
98349
|
if (!result) {
|
|
98073
98350
|
ts.Debug.assert(resolutions.length === moduleNames.length);
|
|
@@ -98077,7 +98354,7 @@ var ts;
|
|
|
98077
98354
|
for (var i = 0; i < result.length; i++) {
|
|
98078
98355
|
if (result[i]) {
|
|
98079
98356
|
if (result[i] === predictedToResolveToAmbientModuleMarker) {
|
|
98080
|
-
result[i] =
|
|
98357
|
+
result[i] = emptyResolution;
|
|
98081
98358
|
}
|
|
98082
98359
|
}
|
|
98083
98360
|
else {
|
|
@@ -98105,6 +98382,78 @@ var ts;
|
|
|
98105
98382
|
return true;
|
|
98106
98383
|
}
|
|
98107
98384
|
}
|
|
98385
|
+
function resolveTypeReferenceDirectiveNamesReusingOldState(typeDirectiveNames, containingFile) {
|
|
98386
|
+
var _a;
|
|
98387
|
+
if (structureIsReused === 0) {
|
|
98388
|
+
return resolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFile, undefined, undefined);
|
|
98389
|
+
}
|
|
98390
|
+
var containingSourceFile = !ts.isString(containingFile) ? containingFile : undefined;
|
|
98391
|
+
var inferredTypeFile = !ts.isString(containingFile) ? undefined : containingFile;
|
|
98392
|
+
var oldSourceFile = containingSourceFile && (oldProgram === null || oldProgram === void 0 ? void 0 : oldProgram.getSourceFile(containingSourceFile.fileName));
|
|
98393
|
+
if (containingSourceFile && oldSourceFile !== containingSourceFile && containingSourceFile.resolvedTypeReferenceDirectiveNames) {
|
|
98394
|
+
var result_15 = [];
|
|
98395
|
+
for (var _i = 0, _b = typeDirectiveNames; _i < _b.length; _i++) {
|
|
98396
|
+
var typeDirectiveName = _b[_i];
|
|
98397
|
+
var resolvedTypeReferenceDirective = containingSourceFile.resolvedTypeReferenceDirectiveNames.get(ts.toFileNameLowerCase(typeDirectiveName.fileName), typeDirectiveName.resolutionMode || containingSourceFile.impliedNodeFormat);
|
|
98398
|
+
result_15.push(resolvedTypeReferenceDirective);
|
|
98399
|
+
}
|
|
98400
|
+
return result_15;
|
|
98401
|
+
}
|
|
98402
|
+
var unknownTypeReferenceDirectiveNames;
|
|
98403
|
+
var unknownTypeReferenceDirectiveNamesIndex;
|
|
98404
|
+
var result;
|
|
98405
|
+
var reusedNames;
|
|
98406
|
+
var canReuseResolutions = oldBuildInfoProgram || (containingSourceFile ?
|
|
98407
|
+
containingSourceFile === oldSourceFile && !hasInvalidatedResolution(oldSourceFile.path) :
|
|
98408
|
+
!hasInvalidatedResolution(toPath(inferredTypeFile)));
|
|
98409
|
+
var redirectedReference;
|
|
98410
|
+
for (var i = 0; i < typeDirectiveNames.length; i++) {
|
|
98411
|
+
var entry = typeDirectiveNames[i];
|
|
98412
|
+
if (canReuseResolutions) {
|
|
98413
|
+
var typeDirectiveName = !ts.isString(entry) ? entry.fileName.toLowerCase() : entry;
|
|
98414
|
+
var mode = getModeForFileReference(entry, containingSourceFile === null || containingSourceFile === void 0 ? void 0 : containingSourceFile.impliedNodeFormat);
|
|
98415
|
+
var oldResolution = !oldBuildInfoProgram ?
|
|
98416
|
+
(_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) :
|
|
98417
|
+
oldBuildInfoProgram.getResolvedTypeReferenceDirective(ts.getDirectoryPath(containingSourceFile ? containingSourceFile.path : toPath(inferredTypeFile)), typeDirectiveName, mode, containingSourceFile && (redirectedReference === undefined ? (redirectedReference = getRedirectReferenceForResolution(containingSourceFile) || false) : redirectedReference) || undefined);
|
|
98418
|
+
if (oldResolution === null || oldResolution === void 0 ? void 0 : oldResolution.resolvedTypeReferenceDirective) {
|
|
98419
|
+
if (ts.isTraceEnabled(options, host)) {
|
|
98420
|
+
var fileLocation = containingSourceFile ? ts.getNormalizedAbsolutePath(containingSourceFile.originalFileName, currentDirectory) : inferredTypeFile;
|
|
98421
|
+
if (!oldBuildInfoProgram) {
|
|
98422
|
+
ts.trace(host, oldResolution.resolvedTypeReferenceDirective.packageId ?
|
|
98423
|
+
ts.Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 :
|
|
98424
|
+
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));
|
|
98425
|
+
}
|
|
98426
|
+
else {
|
|
98427
|
+
ts.trace(host, oldResolution.resolvedTypeReferenceDirective.packageId ?
|
|
98428
|
+
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 :
|
|
98429
|
+
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));
|
|
98430
|
+
}
|
|
98431
|
+
}
|
|
98432
|
+
(result || (result = new Array(typeDirectiveNames.length)))[i] = oldResolution;
|
|
98433
|
+
(reusedNames !== null && reusedNames !== void 0 ? reusedNames : (reusedNames = [])).push({ name: typeDirectiveName, mode: mode });
|
|
98434
|
+
continue;
|
|
98435
|
+
}
|
|
98436
|
+
}
|
|
98437
|
+
(unknownTypeReferenceDirectiveNames !== null && unknownTypeReferenceDirectiveNames !== void 0 ? unknownTypeReferenceDirectiveNames : (unknownTypeReferenceDirectiveNames = [])).push(entry);
|
|
98438
|
+
(unknownTypeReferenceDirectiveNamesIndex !== null && unknownTypeReferenceDirectiveNamesIndex !== void 0 ? unknownTypeReferenceDirectiveNamesIndex : (unknownTypeReferenceDirectiveNamesIndex = [])).push(i);
|
|
98439
|
+
}
|
|
98440
|
+
if (!unknownTypeReferenceDirectiveNames)
|
|
98441
|
+
return result || ts.emptyArray;
|
|
98442
|
+
var resolutions = resolveTypeReferenceDirectiveNamesWorker(unknownTypeReferenceDirectiveNames, containingFile, { reusedNames: reusedNames, namesIndex: unknownTypeReferenceDirectiveNamesIndex }, redirectedReference);
|
|
98443
|
+
if (!result) {
|
|
98444
|
+
ts.Debug.assert(resolutions.length === typeDirectiveNames.length);
|
|
98445
|
+
return resolutions;
|
|
98446
|
+
}
|
|
98447
|
+
var j = 0;
|
|
98448
|
+
for (var i = 0; i < result.length; i++) {
|
|
98449
|
+
if (!result[i]) {
|
|
98450
|
+
result[i] = resolutions[j];
|
|
98451
|
+
j++;
|
|
98452
|
+
}
|
|
98453
|
+
}
|
|
98454
|
+
ts.Debug.assert(j === resolutions.length);
|
|
98455
|
+
return result;
|
|
98456
|
+
}
|
|
98108
98457
|
function canReuseProjectReferences() {
|
|
98109
98458
|
return !forEachProjectReference(oldProgram.getProjectReferences(), oldProgram.getResolvedProjectReferences(), function (oldResolvedRef, parent, index) {
|
|
98110
98459
|
var newRef = (parent ? parent.commandLine.projectReferences : projectReferences)[index];
|
|
@@ -98123,12 +98472,17 @@ var ts;
|
|
|
98123
98472
|
});
|
|
98124
98473
|
}
|
|
98125
98474
|
function tryReuseStructureFromOldProgram() {
|
|
98126
|
-
var
|
|
98127
|
-
if (!
|
|
98475
|
+
var oldOptions = (oldProgram === null || oldProgram === void 0 ? void 0 : oldProgram.getCompilerOptions()) || (oldBuildInfoProgram === null || oldBuildInfoProgram === void 0 ? void 0 : oldBuildInfoProgram.getCompilerOptions());
|
|
98476
|
+
if (!oldOptions || ts.changesAffectModuleResolution(oldOptions, options)) {
|
|
98128
98477
|
return 0;
|
|
98129
98478
|
}
|
|
98130
|
-
var
|
|
98131
|
-
|
|
98479
|
+
var result = tryReuseStructureFromOldProgramWorker();
|
|
98480
|
+
return options.cacheResolutions && (oldProgram || oldBuildInfoProgram) && result === 0 ?
|
|
98481
|
+
1 :
|
|
98482
|
+
result;
|
|
98483
|
+
}
|
|
98484
|
+
function tryReuseStructureFromOldProgramWorker() {
|
|
98485
|
+
if (!oldProgram) {
|
|
98132
98486
|
return 0;
|
|
98133
98487
|
}
|
|
98134
98488
|
var oldRootNames = oldProgram.getRootFileNames();
|
|
@@ -98143,7 +98497,7 @@ var ts;
|
|
|
98143
98497
|
}
|
|
98144
98498
|
var newSourceFiles = [];
|
|
98145
98499
|
var modifiedSourceFiles = [];
|
|
98146
|
-
structureIsReused =
|
|
98500
|
+
structureIsReused = 3;
|
|
98147
98501
|
if (oldProgram.getMissingFilePaths().some(function (missingFilePath) { return host.fileExists(missingFilePath); })) {
|
|
98148
98502
|
return 0;
|
|
98149
98503
|
}
|
|
@@ -98151,14 +98505,13 @@ var ts;
|
|
|
98151
98505
|
var seenPackageNames = new ts.Map();
|
|
98152
98506
|
for (var _i = 0, oldSourceFiles_2 = oldSourceFiles; _i < oldSourceFiles_2.length; _i++) {
|
|
98153
98507
|
var oldSourceFile = oldSourceFiles_2[_i];
|
|
98154
|
-
var sourceFileOptions = getCreateSourceFileOptions(oldSourceFile.fileName
|
|
98508
|
+
var sourceFileOptions = getCreateSourceFileOptions(oldSourceFile.fileName);
|
|
98155
98509
|
var newSourceFile = host.getSourceFileByPath
|
|
98156
98510
|
? host.getSourceFileByPath(oldSourceFile.fileName, oldSourceFile.resolvedPath, sourceFileOptions, undefined, shouldCreateNewSourceFile || sourceFileOptions.impliedNodeFormat !== oldSourceFile.impliedNodeFormat)
|
|
98157
98511
|
: host.getSourceFile(oldSourceFile.fileName, sourceFileOptions, undefined, shouldCreateNewSourceFile || sourceFileOptions.impliedNodeFormat !== oldSourceFile.impliedNodeFormat);
|
|
98158
98512
|
if (!newSourceFile) {
|
|
98159
98513
|
return 0;
|
|
98160
98514
|
}
|
|
98161
|
-
newSourceFile.packageJsonLocations = ((_a = sourceFileOptions.packageJsonLocations) === null || _a === void 0 ? void 0 : _a.length) ? sourceFileOptions.packageJsonLocations : undefined;
|
|
98162
98515
|
newSourceFile.packageJsonScope = sourceFileOptions.packageJsonScope;
|
|
98163
98516
|
ts.Debug.assert(!newSourceFile.redirectInfo, "Host should not return a redirect source file from `getSourceFile`");
|
|
98164
98517
|
var fileChanged = void 0;
|
|
@@ -98193,86 +98546,95 @@ var ts;
|
|
|
98193
98546
|
}
|
|
98194
98547
|
if (fileChanged) {
|
|
98195
98548
|
if (oldSourceFile.impliedNodeFormat !== newSourceFile.impliedNodeFormat) {
|
|
98196
|
-
structureIsReused =
|
|
98549
|
+
structureIsReused = 2;
|
|
98197
98550
|
}
|
|
98198
98551
|
else if (!ts.arrayIsEqualTo(oldSourceFile.libReferenceDirectives, newSourceFile.libReferenceDirectives, fileReferenceIsEqualTo)) {
|
|
98199
|
-
structureIsReused =
|
|
98552
|
+
structureIsReused = 2;
|
|
98200
98553
|
}
|
|
98201
98554
|
else if (oldSourceFile.hasNoDefaultLib !== newSourceFile.hasNoDefaultLib) {
|
|
98202
|
-
structureIsReused =
|
|
98555
|
+
structureIsReused = 2;
|
|
98203
98556
|
}
|
|
98204
98557
|
else if (!ts.arrayIsEqualTo(oldSourceFile.referencedFiles, newSourceFile.referencedFiles, fileReferenceIsEqualTo)) {
|
|
98205
|
-
structureIsReused =
|
|
98558
|
+
structureIsReused = 2;
|
|
98206
98559
|
}
|
|
98207
98560
|
else {
|
|
98208
98561
|
collectExternalModuleReferences(newSourceFile);
|
|
98209
98562
|
if (!ts.arrayIsEqualTo(oldSourceFile.imports, newSourceFile.imports, moduleNameIsEqualTo)) {
|
|
98210
|
-
structureIsReused =
|
|
98563
|
+
structureIsReused = 2;
|
|
98211
98564
|
}
|
|
98212
98565
|
else if (!ts.arrayIsEqualTo(oldSourceFile.moduleAugmentations, newSourceFile.moduleAugmentations, moduleNameIsEqualTo)) {
|
|
98213
|
-
structureIsReused =
|
|
98566
|
+
structureIsReused = 2;
|
|
98214
98567
|
}
|
|
98215
98568
|
else if ((oldSourceFile.flags & 6291456) !== (newSourceFile.flags & 6291456)) {
|
|
98216
|
-
structureIsReused =
|
|
98569
|
+
structureIsReused = 2;
|
|
98217
98570
|
}
|
|
98218
98571
|
else if (!ts.arrayIsEqualTo(oldSourceFile.typeReferenceDirectives, newSourceFile.typeReferenceDirectives, fileReferenceIsEqualTo)) {
|
|
98219
|
-
structureIsReused =
|
|
98572
|
+
structureIsReused = 2;
|
|
98220
98573
|
}
|
|
98221
98574
|
}
|
|
98222
98575
|
modifiedSourceFiles.push({ oldFile: oldSourceFile, newFile: newSourceFile });
|
|
98223
98576
|
}
|
|
98224
98577
|
else if (hasInvalidatedResolution(oldSourceFile.path)) {
|
|
98225
|
-
structureIsReused =
|
|
98578
|
+
structureIsReused = 2;
|
|
98226
98579
|
modifiedSourceFiles.push({ oldFile: oldSourceFile, newFile: newSourceFile });
|
|
98227
98580
|
}
|
|
98228
98581
|
newSourceFiles.push(newSourceFile);
|
|
98229
98582
|
}
|
|
98230
|
-
if (structureIsReused !==
|
|
98583
|
+
if (structureIsReused !== 3) {
|
|
98231
98584
|
return structureIsReused;
|
|
98232
98585
|
}
|
|
98233
98586
|
var modifiedFiles = modifiedSourceFiles.map(function (f) { return f.oldFile; });
|
|
98234
|
-
for (var
|
|
98235
|
-
var oldFile = oldSourceFiles_3[
|
|
98587
|
+
for (var _a = 0, oldSourceFiles_3 = oldSourceFiles; _a < oldSourceFiles_3.length; _a++) {
|
|
98588
|
+
var oldFile = oldSourceFiles_3[_a];
|
|
98236
98589
|
if (!ts.contains(modifiedFiles, oldFile)) {
|
|
98237
|
-
for (var
|
|
98238
|
-
var moduleName =
|
|
98590
|
+
for (var _b = 0, _c = oldFile.ambientModuleNames; _b < _c.length; _b++) {
|
|
98591
|
+
var moduleName = _c[_b];
|
|
98239
98592
|
ambientModuleNameToUnmodifiedFileName.set(moduleName, oldFile.fileName);
|
|
98240
98593
|
}
|
|
98241
98594
|
}
|
|
98242
98595
|
}
|
|
98243
|
-
for (var
|
|
98244
|
-
var
|
|
98596
|
+
for (var _d = 0, modifiedSourceFiles_1 = modifiedSourceFiles; _d < modifiedSourceFiles_1.length; _d++) {
|
|
98597
|
+
var _e = modifiedSourceFiles_1[_d], oldSourceFile = _e.oldFile, newSourceFile = _e.newFile;
|
|
98245
98598
|
var moduleNames = getModuleNames(newSourceFile);
|
|
98246
98599
|
var resolutions = resolveModuleNamesReusingOldState(moduleNames, newSourceFile);
|
|
98247
98600
|
var resolutionsChanged = ts.hasChangesInResolutions(moduleNames, resolutions, oldSourceFile.resolvedModules, oldSourceFile, ts.moduleResolutionIsEqualTo);
|
|
98248
98601
|
if (resolutionsChanged) {
|
|
98249
|
-
structureIsReused =
|
|
98602
|
+
structureIsReused = 2;
|
|
98250
98603
|
newSourceFile.resolvedModules = ts.zipToModeAwareCache(newSourceFile, moduleNames, resolutions);
|
|
98251
98604
|
}
|
|
98252
98605
|
else {
|
|
98253
98606
|
newSourceFile.resolvedModules = oldSourceFile.resolvedModules;
|
|
98254
98607
|
}
|
|
98255
98608
|
var typesReferenceDirectives = newSourceFile.typeReferenceDirectives;
|
|
98256
|
-
var typeReferenceResolutions =
|
|
98609
|
+
var typeReferenceResolutions = resolveTypeReferenceDirectiveNamesReusingOldState(typesReferenceDirectives, newSourceFile);
|
|
98257
98610
|
var typeReferenceResolutionsChanged = ts.hasChangesInResolutions(typesReferenceDirectives, typeReferenceResolutions, oldSourceFile.resolvedTypeReferenceDirectiveNames, oldSourceFile, ts.typeDirectiveIsEqualTo);
|
|
98258
98611
|
if (typeReferenceResolutionsChanged) {
|
|
98259
|
-
structureIsReused =
|
|
98612
|
+
structureIsReused = 2;
|
|
98260
98613
|
newSourceFile.resolvedTypeReferenceDirectiveNames = ts.zipToModeAwareCache(newSourceFile, typesReferenceDirectives, typeReferenceResolutions);
|
|
98261
98614
|
}
|
|
98262
98615
|
else {
|
|
98263
98616
|
newSourceFile.resolvedTypeReferenceDirectiveNames = oldSourceFile.resolvedTypeReferenceDirectiveNames;
|
|
98264
98617
|
}
|
|
98265
98618
|
}
|
|
98266
|
-
if (structureIsReused !==
|
|
98619
|
+
if (structureIsReused !== 3) {
|
|
98267
98620
|
return structureIsReused;
|
|
98268
98621
|
}
|
|
98269
|
-
if (ts.changesAffectingProgramStructure(
|
|
98270
|
-
return
|
|
98622
|
+
if (ts.changesAffectingProgramStructure(oldProgram.getCompilerOptions(), options)) {
|
|
98623
|
+
return 2;
|
|
98624
|
+
}
|
|
98625
|
+
if (host.hasChangedAutomaticTypeDirectiveNames) {
|
|
98626
|
+
if (host.hasChangedAutomaticTypeDirectiveNames())
|
|
98627
|
+
return 2;
|
|
98628
|
+
}
|
|
98629
|
+
else {
|
|
98630
|
+
automaticTypeDirectiveNames = ts.getAutomaticTypeDirectiveNames(options, host);
|
|
98631
|
+
if (!ts.arrayIsEqualTo(oldProgram.getAutomaticTypeDirectiveNames(), automaticTypeDirectiveNames))
|
|
98632
|
+
return 2;
|
|
98271
98633
|
}
|
|
98272
98634
|
missingFilePaths = oldProgram.getMissingFilePaths();
|
|
98273
98635
|
ts.Debug.assert(newSourceFiles.length === oldProgram.getSourceFiles().length);
|
|
98274
|
-
for (var
|
|
98275
|
-
var newSourceFile = newSourceFiles_1[
|
|
98636
|
+
for (var _f = 0, newSourceFiles_1 = newSourceFiles; _f < newSourceFiles_1.length; _f++) {
|
|
98637
|
+
var newSourceFile = newSourceFiles_1[_f];
|
|
98276
98638
|
filesByName.set(newSourceFile.path, newSourceFile);
|
|
98277
98639
|
}
|
|
98278
98640
|
var oldFilesByNameMap = oldProgram.getFilesByNameMap();
|
|
@@ -98293,10 +98655,12 @@ var ts;
|
|
|
98293
98655
|
fileReasons = oldProgram.getFileIncludeReasons();
|
|
98294
98656
|
fileProcessingDiagnostics = oldProgram.getFileProcessingDiagnostics();
|
|
98295
98657
|
resolvedTypeReferenceDirectives = oldProgram.getResolvedTypeReferenceDirectives();
|
|
98658
|
+
automaticTypeDirectiveNames = oldProgram.getAutomaticTypeDirectiveNames();
|
|
98659
|
+
automaticTypeDirectiveResolutions = oldProgram.getAutomaticTypeDirectiveResolutions();
|
|
98296
98660
|
sourceFileToPackageName = oldProgram.sourceFileToPackageName;
|
|
98297
98661
|
redirectTargetsMap = oldProgram.redirectTargetsMap;
|
|
98298
98662
|
usesUriStyleNodeCoreModules = oldProgram.usesUriStyleNodeCoreModules;
|
|
98299
|
-
return
|
|
98663
|
+
return 3;
|
|
98300
98664
|
}
|
|
98301
98665
|
function getEmitHost(writeFileCallback) {
|
|
98302
98666
|
return {
|
|
@@ -98973,14 +99337,12 @@ var ts;
|
|
|
98973
99337
|
}
|
|
98974
99338
|
}
|
|
98975
99339
|
function createRedirectSourceFile(redirectTarget, unredirected, fileName, path, resolvedPath, originalFileName, sourceFileOptions) {
|
|
98976
|
-
var _a;
|
|
98977
99340
|
var redirect = Object.create(redirectTarget);
|
|
98978
99341
|
redirect.fileName = fileName;
|
|
98979
99342
|
redirect.path = path;
|
|
98980
99343
|
redirect.resolvedPath = resolvedPath;
|
|
98981
99344
|
redirect.originalFileName = originalFileName;
|
|
98982
99345
|
redirect.redirectInfo = { redirectTarget: redirectTarget, unredirected: unredirected };
|
|
98983
|
-
redirect.packageJsonLocations = ((_a = sourceFileOptions.packageJsonLocations) === null || _a === void 0 ? void 0 : _a.length) ? sourceFileOptions.packageJsonLocations : undefined;
|
|
98984
99346
|
redirect.packageJsonScope = sourceFileOptions.packageJsonScope;
|
|
98985
99347
|
sourceFilesFoundSearchingNodeModules.set(path, currentNodeModulesDepth > 0);
|
|
98986
99348
|
Object.defineProperties(redirect, {
|
|
@@ -99005,7 +99367,7 @@ var ts;
|
|
|
99005
99367
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
99006
99368
|
return result;
|
|
99007
99369
|
}
|
|
99008
|
-
function getCreateSourceFileOptions(fileName
|
|
99370
|
+
function getCreateSourceFileOptions(fileName) {
|
|
99009
99371
|
var result = getImpliedNodeFormatForFileWorker(toPath(fileName), moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache(), host, options);
|
|
99010
99372
|
var languageVersion = ts.getEmitScriptTarget(options);
|
|
99011
99373
|
var setExternalModuleIndicator = ts.getSetExternalModuleIndicator(options);
|
|
@@ -99013,7 +99375,7 @@ var ts;
|
|
|
99013
99375
|
{ languageVersion: languageVersion, impliedNodeFormat: result, setExternalModuleIndicator: setExternalModuleIndicator };
|
|
99014
99376
|
}
|
|
99015
99377
|
function findSourceFileWorker(fileName, isDefaultLib, ignoreNoDefaultLib, reason, packageId) {
|
|
99016
|
-
var _a
|
|
99378
|
+
var _a;
|
|
99017
99379
|
var path = toPath(fileName);
|
|
99018
99380
|
if (useSourceOfProjectReferenceRedirect) {
|
|
99019
99381
|
var source = getSourceOfProjectReferenceRedirect(path);
|
|
@@ -99083,7 +99445,7 @@ var ts;
|
|
|
99083
99445
|
redirectedPath = toPath(redirect);
|
|
99084
99446
|
}
|
|
99085
99447
|
}
|
|
99086
|
-
var sourceFileOptions = getCreateSourceFileOptions(fileName
|
|
99448
|
+
var sourceFileOptions = getCreateSourceFileOptions(fileName);
|
|
99087
99449
|
var file = host.getSourceFile(fileName, sourceFileOptions, function (hostErrorMessage) { return addFilePreprocessingFileExplainingDiagnostic(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));
|
|
99088
99450
|
if (packageId) {
|
|
99089
99451
|
var packageIdKey = ts.packageIdToString(packageId);
|
|
@@ -99109,7 +99471,6 @@ var ts;
|
|
|
99109
99471
|
file.path = path;
|
|
99110
99472
|
file.resolvedPath = toPath(fileName);
|
|
99111
99473
|
file.originalFileName = originalFileName;
|
|
99112
|
-
file.packageJsonLocations = ((_b = sourceFileOptions.packageJsonLocations) === null || _b === void 0 ? void 0 : _b.length) ? sourceFileOptions.packageJsonLocations : undefined;
|
|
99113
99474
|
file.packageJsonScope = sourceFileOptions.packageJsonScope;
|
|
99114
99475
|
addFileIncludeReason(file, reason);
|
|
99115
99476
|
if (host.useCaseSensitiveFileNames()) {
|
|
@@ -99226,33 +99587,40 @@ var ts;
|
|
|
99226
99587
|
}
|
|
99227
99588
|
function processTypeReferenceDirectives(file) {
|
|
99228
99589
|
var typeDirectives = file.typeReferenceDirectives;
|
|
99229
|
-
if (!typeDirectives) {
|
|
99590
|
+
if (!typeDirectives.length) {
|
|
99591
|
+
file.resolvedTypeReferenceDirectiveNames = undefined;
|
|
99230
99592
|
return;
|
|
99231
99593
|
}
|
|
99232
|
-
var resolutions =
|
|
99594
|
+
var resolutions = resolveTypeReferenceDirectiveNamesReusingOldState(typeDirectives, file);
|
|
99233
99595
|
for (var index = 0; index < typeDirectives.length; index++) {
|
|
99234
99596
|
var ref = file.typeReferenceDirectives[index];
|
|
99235
99597
|
var resolvedTypeReferenceDirective = resolutions[index];
|
|
99236
99598
|
var fileName = ts.toFileNameLowerCase(ref.fileName);
|
|
99237
|
-
ts.setResolvedTypeReferenceDirective(file, fileName, resolvedTypeReferenceDirective);
|
|
99599
|
+
ts.setResolvedTypeReferenceDirective(file, fileName, resolvedTypeReferenceDirective, getModeForFileReference(ref, file.impliedNodeFormat));
|
|
99238
99600
|
var mode = ref.resolutionMode || file.impliedNodeFormat;
|
|
99239
99601
|
if (mode && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeNext) {
|
|
99240
|
-
|
|
99602
|
+
(fileProcessingDiagnostics !== null && fileProcessingDiagnostics !== void 0 ? fileProcessingDiagnostics : (fileProcessingDiagnostics = [])).push({
|
|
99603
|
+
kind: 2,
|
|
99604
|
+
diagnostics: [ts.createDiagnosticForRange(file, ref, ts.Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext)]
|
|
99605
|
+
});
|
|
99241
99606
|
}
|
|
99242
99607
|
processTypeReferenceDirective(fileName, mode, resolvedTypeReferenceDirective, { kind: ts.FileIncludeKind.TypeReferenceDirective, file: file.path, index: index, });
|
|
99243
99608
|
}
|
|
99244
99609
|
}
|
|
99245
|
-
function processTypeReferenceDirective(typeReferenceDirective, mode,
|
|
99246
|
-
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program", "processTypeReferenceDirective", { directive: typeReferenceDirective, hasResolved: !!resolvedTypeReferenceDirective, refKind: reason.kind, refPath: isReferencedFile(reason) ? reason.file : undefined });
|
|
99247
|
-
processTypeReferenceDirectiveWorker(typeReferenceDirective, mode,
|
|
99610
|
+
function processTypeReferenceDirective(typeReferenceDirective, mode, resolution, reason) {
|
|
99611
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program", "processTypeReferenceDirective", { directive: typeReferenceDirective, hasResolved: !!resolution.resolvedTypeReferenceDirective, refKind: reason.kind, refPath: isReferencedFile(reason) ? reason.file : undefined });
|
|
99612
|
+
processTypeReferenceDirectiveWorker(typeReferenceDirective, mode, resolution, reason);
|
|
99248
99613
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
99249
99614
|
}
|
|
99250
|
-
function processTypeReferenceDirectiveWorker(typeReferenceDirective, mode,
|
|
99251
|
-
var
|
|
99615
|
+
function processTypeReferenceDirectiveWorker(typeReferenceDirective, mode, resolution, reason) {
|
|
99616
|
+
var _a;
|
|
99617
|
+
addResolutionDiagnostics(resolution);
|
|
99618
|
+
var previousResolution = (_a = resolvedTypeReferenceDirectives.get(typeReferenceDirective, mode)) === null || _a === void 0 ? void 0 : _a.resolvedTypeReferenceDirective;
|
|
99252
99619
|
if (previousResolution && previousResolution.primary) {
|
|
99253
99620
|
return;
|
|
99254
99621
|
}
|
|
99255
99622
|
var saveResolution = true;
|
|
99623
|
+
var resolvedTypeReferenceDirective = resolution.resolvedTypeReferenceDirective;
|
|
99256
99624
|
if (resolvedTypeReferenceDirective) {
|
|
99257
99625
|
if (resolvedTypeReferenceDirective.isExternalLibraryImport)
|
|
99258
99626
|
currentNodeModulesDepth++;
|
|
@@ -99281,7 +99649,7 @@ var ts;
|
|
|
99281
99649
|
addFilePreprocessingFileExplainingDiagnostic(undefined, reason, ts.Diagnostics.Cannot_find_type_definition_file_for_0, [typeReferenceDirective]);
|
|
99282
99650
|
}
|
|
99283
99651
|
if (saveResolution) {
|
|
99284
|
-
resolvedTypeReferenceDirectives.set(typeReferenceDirective, mode,
|
|
99652
|
+
resolvedTypeReferenceDirectives.set(typeReferenceDirective, mode, resolution);
|
|
99285
99653
|
}
|
|
99286
99654
|
}
|
|
99287
99655
|
function pathForLibFile(libFileName) {
|
|
@@ -99310,7 +99678,7 @@ var ts;
|
|
|
99310
99678
|
var unqualifiedLibName = ts.removeSuffix(ts.removePrefix(libName, "lib."), ".d.ts");
|
|
99311
99679
|
var suggestion = ts.getSpellingSuggestion(unqualifiedLibName, ts.libs, ts.identity);
|
|
99312
99680
|
var diagnostic = suggestion ? ts.Diagnostics.Cannot_find_lib_definition_for_0_Did_you_mean_1 : ts.Diagnostics.Cannot_find_lib_definition_for_0;
|
|
99313
|
-
(fileProcessingDiagnostics
|
|
99681
|
+
(fileProcessingDiagnostics !== null && fileProcessingDiagnostics !== void 0 ? fileProcessingDiagnostics : (fileProcessingDiagnostics = [])).push({
|
|
99314
99682
|
kind: 0,
|
|
99315
99683
|
reason: { kind: ts.FileIncludeKind.LibReferenceDirective, file: file.path, index: index, },
|
|
99316
99684
|
diagnostic: diagnostic,
|
|
@@ -99333,19 +99701,20 @@ var ts;
|
|
|
99333
99701
|
for (var index = 0; index < moduleNames.length; index++) {
|
|
99334
99702
|
var resolution = resolutions[index];
|
|
99335
99703
|
ts.setResolvedModule(file, moduleNames[index], resolution, getModeForResolutionAtIndex(file, index));
|
|
99336
|
-
|
|
99704
|
+
addResolutionDiagnostics(resolution);
|
|
99705
|
+
if (!resolution.resolvedModule) {
|
|
99337
99706
|
continue;
|
|
99338
99707
|
}
|
|
99339
|
-
var isFromNodeModulesSearch = resolution.isExternalLibraryImport;
|
|
99340
|
-
var isJsFile = !ts.resolutionExtensionIsTSOrJson(resolution.extension);
|
|
99708
|
+
var isFromNodeModulesSearch = resolution.resolvedModule.isExternalLibraryImport;
|
|
99709
|
+
var isJsFile = !ts.resolutionExtensionIsTSOrJson(resolution.resolvedModule.extension);
|
|
99341
99710
|
var isJsFileFromNodeModules = isFromNodeModulesSearch && isJsFile;
|
|
99342
|
-
var resolvedFileName = resolution.resolvedFileName;
|
|
99711
|
+
var resolvedFileName = resolution.resolvedModule.resolvedFileName;
|
|
99343
99712
|
if (isFromNodeModulesSearch) {
|
|
99344
99713
|
currentNodeModulesDepth++;
|
|
99345
99714
|
}
|
|
99346
99715
|
var elideImport = isJsFileFromNodeModules && currentNodeModulesDepth > maxNodeModuleJsDepth;
|
|
99347
99716
|
var shouldAddFile = resolvedFileName
|
|
99348
|
-
&& !getResolutionDiagnostic(optionsForFile, resolution)
|
|
99717
|
+
&& !getResolutionDiagnostic(optionsForFile, resolution.resolvedModule)
|
|
99349
99718
|
&& !optionsForFile.noResolve
|
|
99350
99719
|
&& index < file.imports.length
|
|
99351
99720
|
&& !elideImport
|
|
@@ -99355,7 +99724,7 @@ var ts;
|
|
|
99355
99724
|
modulesWithElidedImports.set(file.path, true);
|
|
99356
99725
|
}
|
|
99357
99726
|
else if (shouldAddFile) {
|
|
99358
|
-
findSourceFile(resolvedFileName, false, false, { kind: ts.FileIncludeKind.Import, file: file.path, index: index, }, resolution.packageId);
|
|
99727
|
+
findSourceFile(resolvedFileName, false, false, { kind: ts.FileIncludeKind.Import, file: file.path, index: index, }, resolution.resolvedModule.packageId);
|
|
99359
99728
|
}
|
|
99360
99729
|
if (isFromNodeModulesSearch) {
|
|
99361
99730
|
currentNodeModulesDepth--;
|
|
@@ -99456,6 +99825,9 @@ var ts;
|
|
|
99456
99825
|
createDiagnosticForOptionName(ts.Diagnostics.Composite_projects_may_not_disable_incremental_compilation, "declaration");
|
|
99457
99826
|
}
|
|
99458
99827
|
}
|
|
99828
|
+
if (options.cacheResolutions && !ts.isIncrementalCompilation(options)) {
|
|
99829
|
+
createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1_or_option_2, "cacheResolutions", "incremental", "composite");
|
|
99830
|
+
}
|
|
99459
99831
|
var outputFile = ts.outFile(options);
|
|
99460
99832
|
if (options.tsBuildInfoFile) {
|
|
99461
99833
|
if (!ts.isIncrementalCompilation(options)) {
|
|
@@ -99705,7 +100077,7 @@ var ts;
|
|
|
99705
100077
|
}
|
|
99706
100078
|
}
|
|
99707
100079
|
function addFilePreprocessingFileExplainingDiagnostic(file, fileProcessingReason, diagnostic, args) {
|
|
99708
|
-
(fileProcessingDiagnostics
|
|
100080
|
+
(fileProcessingDiagnostics !== null && fileProcessingDiagnostics !== void 0 ? fileProcessingDiagnostics : (fileProcessingDiagnostics = [])).push({
|
|
99709
100081
|
kind: 1,
|
|
99710
100082
|
file: file && file.path,
|
|
99711
100083
|
fileProcessingReason: fileProcessingReason,
|
|
@@ -99966,8 +100338,8 @@ var ts;
|
|
|
99966
100338
|
if (!symlinks) {
|
|
99967
100339
|
symlinks = ts.createSymlinkCache(currentDirectory, getCanonicalFileName);
|
|
99968
100340
|
}
|
|
99969
|
-
if (files &&
|
|
99970
|
-
symlinks.setSymlinksFromResolutions(files,
|
|
100341
|
+
if (files && automaticTypeDirectiveResolutions && !symlinks.hasProcessedResolutions()) {
|
|
100342
|
+
symlinks.setSymlinksFromResolutions(files, automaticTypeDirectiveResolutions);
|
|
99971
100343
|
}
|
|
99972
100344
|
return symlinks;
|
|
99973
100345
|
}
|
|
@@ -100326,7 +100698,8 @@ var ts;
|
|
|
100326
100698
|
}
|
|
100327
100699
|
}
|
|
100328
100700
|
if (sourceFile.resolvedTypeReferenceDirectiveNames) {
|
|
100329
|
-
sourceFile.resolvedTypeReferenceDirectiveNames.forEach(function (
|
|
100701
|
+
sourceFile.resolvedTypeReferenceDirectiveNames.forEach(function (_a) {
|
|
100702
|
+
var resolvedTypeReferenceDirective = _a.resolvedTypeReferenceDirective;
|
|
100330
100703
|
if (!resolvedTypeReferenceDirective) {
|
|
100331
100704
|
return;
|
|
100332
100705
|
}
|
|
@@ -100375,12 +100748,13 @@ var ts;
|
|
|
100375
100748
|
return oldState && !oldState.referencedMap === !newReferencedMap;
|
|
100376
100749
|
}
|
|
100377
100750
|
BuilderState.canReuseOldState = canReuseOldState;
|
|
100378
|
-
function create(newProgram,
|
|
100751
|
+
function create(newProgram, oldState, disableUseFileVersionAsSignature) {
|
|
100379
100752
|
var _a, _b, _c;
|
|
100380
100753
|
var fileInfos = new ts.Map();
|
|
100381
100754
|
var referencedMap = newProgram.getCompilerOptions().module !== ts.ModuleKind.None ? createManyToManyPathMap() : undefined;
|
|
100382
100755
|
var exportedModulesMap = referencedMap ? createManyToManyPathMap() : undefined;
|
|
100383
100756
|
var useOldState = canReuseOldState(referencedMap, oldState);
|
|
100757
|
+
var getCanonicalFileName = ts.createGetCanonicalFileName(newProgram.useCaseSensitiveFileNames());
|
|
100384
100758
|
newProgram.getTypeChecker();
|
|
100385
100759
|
for (var _i = 0, _d = newProgram.getSourceFiles(); _i < _d.length; _i++) {
|
|
100386
100760
|
var sourceFile = _d[_i];
|
|
@@ -100424,23 +100798,23 @@ var ts;
|
|
|
100424
100798
|
state.allFileNames = undefined;
|
|
100425
100799
|
}
|
|
100426
100800
|
BuilderState.releaseCache = releaseCache;
|
|
100427
|
-
function getFilesAffectedBy(state, programOfThisState, path, cancellationToken,
|
|
100801
|
+
function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, host) {
|
|
100428
100802
|
var _a, _b;
|
|
100429
|
-
var result = getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken,
|
|
100803
|
+
var result = getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, host);
|
|
100430
100804
|
(_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.clear();
|
|
100431
100805
|
(_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
|
|
100432
100806
|
return result;
|
|
100433
100807
|
}
|
|
100434
100808
|
BuilderState.getFilesAffectedBy = getFilesAffectedBy;
|
|
100435
|
-
function getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken,
|
|
100809
|
+
function getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, host) {
|
|
100436
100810
|
var sourceFile = programOfThisState.getSourceFileByPath(path);
|
|
100437
100811
|
if (!sourceFile) {
|
|
100438
100812
|
return ts.emptyArray;
|
|
100439
100813
|
}
|
|
100440
|
-
if (!updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken,
|
|
100814
|
+
if (!updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, host)) {
|
|
100441
100815
|
return [sourceFile];
|
|
100442
100816
|
}
|
|
100443
|
-
return (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, cancellationToken,
|
|
100817
|
+
return (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, cancellationToken, host);
|
|
100444
100818
|
}
|
|
100445
100819
|
BuilderState.getFilesAffectedByWithOldState = getFilesAffectedByWithOldState;
|
|
100446
100820
|
function updateSignatureOfFile(state, signature, path) {
|
|
@@ -100448,7 +100822,7 @@ var ts;
|
|
|
100448
100822
|
(state.hasCalledUpdateShapeSignature || (state.hasCalledUpdateShapeSignature = new ts.Set())).add(path);
|
|
100449
100823
|
}
|
|
100450
100824
|
BuilderState.updateSignatureOfFile = updateSignatureOfFile;
|
|
100451
|
-
function updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken,
|
|
100825
|
+
function updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, host, useFileVersionAsSignature) {
|
|
100452
100826
|
var _a;
|
|
100453
100827
|
if (useFileVersionAsSignature === void 0) { useFileVersionAsSignature = state.useFileVersionAsSignature; }
|
|
100454
100828
|
if ((_a = state.hasCalledUpdateShapeSignature) === null || _a === void 0 ? void 0 : _a.has(sourceFile.resolvedPath))
|
|
@@ -100459,7 +100833,7 @@ var ts;
|
|
|
100459
100833
|
if (!sourceFile.isDeclarationFile && !useFileVersionAsSignature) {
|
|
100460
100834
|
programOfThisState.emit(sourceFile, function (fileName, text, _writeByteOrderMark, _onError, sourceFiles, data) {
|
|
100461
100835
|
ts.Debug.assert(ts.isDeclarationFileName(fileName), "File extension for signature expected to be dts: Got:: " + fileName);
|
|
100462
|
-
latestSignature = ts.computeSignatureWithDiagnostics(sourceFile, text,
|
|
100836
|
+
latestSignature = ts.computeSignatureWithDiagnostics(sourceFile, text, host, ts.createGetCanonicalFileName(programOfThisState.useCaseSensitiveFileNames()), data);
|
|
100463
100837
|
if (latestSignature !== prevSignature) {
|
|
100464
100838
|
updateExportedModules(state, sourceFile, sourceFiles[0].exportedModulesFromDeclarationEmit);
|
|
100465
100839
|
}
|
|
@@ -100593,7 +100967,7 @@ var ts;
|
|
|
100593
100967
|
}
|
|
100594
100968
|
return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
|
|
100595
100969
|
}
|
|
100596
|
-
function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cancellationToken,
|
|
100970
|
+
function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cancellationToken, host) {
|
|
100597
100971
|
if (isFileAffectingGlobalScope(sourceFileWithUpdatedShape)) {
|
|
100598
100972
|
return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
|
|
100599
100973
|
}
|
|
@@ -100609,7 +100983,7 @@ var ts;
|
|
|
100609
100983
|
if (!seenFileNamesMap.has(currentPath)) {
|
|
100610
100984
|
var currentSourceFile = programOfThisState.getSourceFileByPath(currentPath);
|
|
100611
100985
|
seenFileNamesMap.set(currentPath, currentSourceFile);
|
|
100612
|
-
if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cancellationToken,
|
|
100986
|
+
if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cancellationToken, host)) {
|
|
100613
100987
|
queue.push.apply(queue, getReferencedByPaths(state, currentSourceFile.resolvedPath));
|
|
100614
100988
|
}
|
|
100615
100989
|
}
|
|
@@ -100623,9 +100997,9 @@ var ts;
|
|
|
100623
100997
|
function hasSameKeys(map1, map2) {
|
|
100624
100998
|
return map1 === map2 || map1 !== undefined && map2 !== undefined && map1.size === map2.size && !ts.forEachKey(map1, function (key) { return !map2.has(key); });
|
|
100625
100999
|
}
|
|
100626
|
-
function createBuilderProgramState(newProgram,
|
|
101000
|
+
function createBuilderProgramState(newProgram, oldState, disableUseFileVersionAsSignature) {
|
|
100627
101001
|
var _a, _b;
|
|
100628
|
-
var state = ts.BuilderState.create(newProgram,
|
|
101002
|
+
var state = ts.BuilderState.create(newProgram, oldState, disableUseFileVersionAsSignature);
|
|
100629
101003
|
state.program = newProgram;
|
|
100630
101004
|
var compilerOptions = newProgram.getCompilerOptions();
|
|
100631
101005
|
state.compilerOptions = compilerOptions;
|
|
@@ -100678,7 +101052,7 @@ var ts;
|
|
|
100678
101052
|
return;
|
|
100679
101053
|
var diagnostics = oldState.semanticDiagnosticsPerFile.get(sourceFilePath);
|
|
100680
101054
|
if (diagnostics) {
|
|
100681
|
-
state.semanticDiagnosticsPerFile.set(sourceFilePath, oldState.hasReusableDiagnostic ? convertToDiagnostics(diagnostics, newProgram
|
|
101055
|
+
state.semanticDiagnosticsPerFile.set(sourceFilePath, oldState.hasReusableDiagnostic ? convertToDiagnostics(diagnostics, newProgram) : diagnostics);
|
|
100682
101056
|
if (!state.semanticDiagnosticsFromOldState) {
|
|
100683
101057
|
state.semanticDiagnosticsFromOldState = new ts.Set();
|
|
100684
101058
|
}
|
|
@@ -100700,13 +101074,16 @@ var ts;
|
|
|
100700
101074
|
ts.Debug.assert(!state.seenAffectedFiles || !state.seenAffectedFiles.size);
|
|
100701
101075
|
state.seenAffectedFiles = state.seenAffectedFiles || new ts.Set();
|
|
100702
101076
|
}
|
|
100703
|
-
state.buildInfoEmitPending = !useOldState ||
|
|
101077
|
+
state.buildInfoEmitPending = !useOldState ||
|
|
101078
|
+
state.changedFilesSet.size !== (((_b = oldState.changedFilesSet) === null || _b === void 0 ? void 0 : _b.size) || 0) ||
|
|
101079
|
+
state.fileInfos.size !== oldState.fileInfos.size;
|
|
100704
101080
|
return state;
|
|
100705
101081
|
}
|
|
100706
|
-
function convertToDiagnostics(diagnostics, newProgram
|
|
101082
|
+
function convertToDiagnostics(diagnostics, newProgram) {
|
|
100707
101083
|
if (!diagnostics.length)
|
|
100708
101084
|
return ts.emptyArray;
|
|
100709
|
-
var buildInfoDirectory
|
|
101085
|
+
var buildInfoDirectory;
|
|
101086
|
+
var getCanonicalFileName;
|
|
100710
101087
|
return diagnostics.map(function (diagnostic) {
|
|
100711
101088
|
var result = convertToDiagnosticRelatedInformation(diagnostic, newProgram, toPath);
|
|
100712
101089
|
result.reportsUnnecessary = diagnostic.reportsUnnecessary;
|
|
@@ -100722,7 +101099,8 @@ var ts;
|
|
|
100722
101099
|
return result;
|
|
100723
101100
|
});
|
|
100724
101101
|
function toPath(path) {
|
|
100725
|
-
|
|
101102
|
+
buildInfoDirectory !== null && buildInfoDirectory !== void 0 ? buildInfoDirectory : (buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(ts.getTsBuildInfoEmitOutputFilePath(newProgram.getCompilerOptions()), newProgram.getCurrentDirectory())));
|
|
101103
|
+
return ts.toPath(path, buildInfoDirectory, getCanonicalFileName !== null && getCanonicalFileName !== void 0 ? getCanonicalFileName : (getCanonicalFileName = ts.createGetCanonicalFileName(newProgram.useCaseSensitiveFileNames())));
|
|
100726
101104
|
}
|
|
100727
101105
|
}
|
|
100728
101106
|
function convertToDiagnosticRelatedInformation(diagnostic, newProgram, toPath) {
|
|
@@ -100731,6 +101109,8 @@ var ts;
|
|
|
100731
101109
|
}
|
|
100732
101110
|
function releaseCache(state) {
|
|
100733
101111
|
ts.BuilderState.releaseCache(state);
|
|
101112
|
+
if (!state.resuableCacheResolutions)
|
|
101113
|
+
getCacheResolutions(state);
|
|
100734
101114
|
state.program = undefined;
|
|
100735
101115
|
}
|
|
100736
101116
|
function backupBuilderProgramEmitState(state) {
|
|
@@ -100765,7 +101145,7 @@ var ts;
|
|
|
100765
101145
|
function assertSourceFileOkWithoutNextAffectedCall(state, sourceFile) {
|
|
100766
101146
|
ts.Debug.assert(!sourceFile || !state.affectedFiles || state.affectedFiles[state.affectedFilesIndex - 1] !== sourceFile || !state.semanticDiagnosticsPerFile.has(sourceFile.resolvedPath));
|
|
100767
101147
|
}
|
|
100768
|
-
function getNextAffectedFile(state, cancellationToken,
|
|
101148
|
+
function getNextAffectedFile(state, cancellationToken, host) {
|
|
100769
101149
|
var _a, _b;
|
|
100770
101150
|
while (true) {
|
|
100771
101151
|
var affectedFiles = state.affectedFiles;
|
|
@@ -100776,7 +101156,7 @@ var ts;
|
|
|
100776
101156
|
var affectedFile = affectedFiles[affectedFilesIndex];
|
|
100777
101157
|
if (!seenAffectedFiles.has(affectedFile.resolvedPath)) {
|
|
100778
101158
|
state.affectedFilesIndex = affectedFilesIndex;
|
|
100779
|
-
handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken,
|
|
101159
|
+
handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, host);
|
|
100780
101160
|
return affectedFile;
|
|
100781
101161
|
}
|
|
100782
101162
|
affectedFilesIndex++;
|
|
@@ -100797,7 +101177,7 @@ var ts;
|
|
|
100797
101177
|
ts.Debug.assert(!state.semanticDiagnosticsPerFile);
|
|
100798
101178
|
return program;
|
|
100799
101179
|
}
|
|
100800
|
-
state.affectedFiles = ts.BuilderState.getFilesAffectedByWithOldState(state, program, nextKey.value, cancellationToken,
|
|
101180
|
+
state.affectedFiles = ts.BuilderState.getFilesAffectedByWithOldState(state, program, nextKey.value, cancellationToken, host);
|
|
100801
101181
|
state.currentChangedFilePath = nextKey.value;
|
|
100802
101182
|
state.affectedFilesIndex = 0;
|
|
100803
101183
|
if (!state.seenAffectedFiles)
|
|
@@ -100840,24 +101220,24 @@ var ts;
|
|
|
100840
101220
|
});
|
|
100841
101221
|
}
|
|
100842
101222
|
}
|
|
100843
|
-
function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken,
|
|
101223
|
+
function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, host) {
|
|
100844
101224
|
removeSemanticDiagnosticsOf(state, affectedFile.resolvedPath);
|
|
100845
101225
|
if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles) {
|
|
100846
101226
|
removeDiagnosticsOfLibraryFiles(state);
|
|
100847
|
-
ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, cancellationToken,
|
|
101227
|
+
ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, cancellationToken, host);
|
|
100848
101228
|
return;
|
|
100849
101229
|
}
|
|
100850
101230
|
if (state.compilerOptions.assumeChangesOnlyAffectDirectDependencies)
|
|
100851
101231
|
return;
|
|
100852
|
-
handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken,
|
|
101232
|
+
handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, host);
|
|
100853
101233
|
}
|
|
100854
|
-
function handleDtsMayChangeOf(state, path, cancellationToken,
|
|
101234
|
+
function handleDtsMayChangeOf(state, path, cancellationToken, host) {
|
|
100855
101235
|
removeSemanticDiagnosticsOf(state, path);
|
|
100856
101236
|
if (!state.changedFilesSet.has(path)) {
|
|
100857
101237
|
var program = ts.Debug.checkDefined(state.program);
|
|
100858
101238
|
var sourceFile = program.getSourceFileByPath(path);
|
|
100859
101239
|
if (sourceFile) {
|
|
100860
|
-
ts.BuilderState.updateShapeSignature(state, program, sourceFile, cancellationToken,
|
|
101240
|
+
ts.BuilderState.updateShapeSignature(state, program, sourceFile, cancellationToken, host, !host.disableUseFileVersionAsSignature);
|
|
100861
101241
|
if (ts.getEmitDeclarations(state.compilerOptions)) {
|
|
100862
101242
|
addToAffectedFilesPendingEmit(state, path, 0);
|
|
100863
101243
|
}
|
|
@@ -100877,16 +101257,16 @@ var ts;
|
|
|
100877
101257
|
var newSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
|
|
100878
101258
|
return newSignature !== oldSignature;
|
|
100879
101259
|
}
|
|
100880
|
-
function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken,
|
|
101260
|
+
function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, host) {
|
|
100881
101261
|
var _a;
|
|
100882
101262
|
if (!((_a = state.fileInfos.get(filePath)) === null || _a === void 0 ? void 0 : _a.affectsGlobalScope))
|
|
100883
101263
|
return false;
|
|
100884
101264
|
ts.BuilderState.getAllFilesExcludingDefaultLibraryFile(state, state.program, undefined)
|
|
100885
|
-
.forEach(function (file) { return handleDtsMayChangeOf(state, file.resolvedPath, cancellationToken,
|
|
101265
|
+
.forEach(function (file) { return handleDtsMayChangeOf(state, file.resolvedPath, cancellationToken, host); });
|
|
100886
101266
|
removeDiagnosticsOfLibraryFiles(state);
|
|
100887
101267
|
return true;
|
|
100888
101268
|
}
|
|
100889
|
-
function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken,
|
|
101269
|
+
function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, host) {
|
|
100890
101270
|
var _a;
|
|
100891
101271
|
if (!state.exportedModulesMap || !state.changedFilesSet.has(affectedFile.resolvedPath))
|
|
100892
101272
|
return;
|
|
@@ -100900,9 +101280,9 @@ var ts;
|
|
|
100900
101280
|
var currentPath = queue.pop();
|
|
100901
101281
|
if (!seenFileNamesMap.has(currentPath)) {
|
|
100902
101282
|
seenFileNamesMap.set(currentPath, true);
|
|
100903
|
-
if (handleDtsMayChangeOfGlobalScope(state, currentPath, cancellationToken,
|
|
101283
|
+
if (handleDtsMayChangeOfGlobalScope(state, currentPath, cancellationToken, host))
|
|
100904
101284
|
return;
|
|
100905
|
-
handleDtsMayChangeOf(state, currentPath, cancellationToken,
|
|
101285
|
+
handleDtsMayChangeOf(state, currentPath, cancellationToken, host);
|
|
100906
101286
|
if (isChangedSignature(state, currentPath)) {
|
|
100907
101287
|
var currentSourceFile = ts.Debug.checkDefined(state.program).getSourceFileByPath(currentPath);
|
|
100908
101288
|
queue.push.apply(queue, ts.BuilderState.getReferencedByPaths(state, currentSourceFile.resolvedPath));
|
|
@@ -100912,27 +101292,27 @@ var ts;
|
|
|
100912
101292
|
}
|
|
100913
101293
|
var seenFileAndExportsOfFile = new ts.Set();
|
|
100914
101294
|
(_a = state.exportedModulesMap.getKeys(affectedFile.resolvedPath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
|
|
100915
|
-
if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken,
|
|
101295
|
+
if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, host))
|
|
100916
101296
|
return true;
|
|
100917
101297
|
var references = state.referencedMap.getKeys(exportedFromPath);
|
|
100918
101298
|
return references && ts.forEachKey(references, function (filePath) {
|
|
100919
|
-
return handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken,
|
|
101299
|
+
return handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, host);
|
|
100920
101300
|
});
|
|
100921
101301
|
});
|
|
100922
101302
|
}
|
|
100923
|
-
function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken,
|
|
101303
|
+
function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, host) {
|
|
100924
101304
|
var _a, _b;
|
|
100925
101305
|
if (!ts.tryAddToSet(seenFileAndExportsOfFile, filePath))
|
|
100926
101306
|
return undefined;
|
|
100927
|
-
if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken,
|
|
101307
|
+
if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, host))
|
|
100928
101308
|
return true;
|
|
100929
|
-
handleDtsMayChangeOf(state, filePath, cancellationToken,
|
|
101309
|
+
handleDtsMayChangeOf(state, filePath, cancellationToken, host);
|
|
100930
101310
|
(_a = state.exportedModulesMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
|
|
100931
|
-
return handleDtsMayChangeOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, cancellationToken,
|
|
101311
|
+
return handleDtsMayChangeOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, cancellationToken, host);
|
|
100932
101312
|
});
|
|
100933
101313
|
(_b = state.referencedMap.getKeys(filePath)) === null || _b === void 0 ? void 0 : _b.forEach(function (referencingFilePath) {
|
|
100934
101314
|
return !seenFileAndExportsOfFile.has(referencingFilePath) &&
|
|
100935
|
-
handleDtsMayChangeOf(state, referencingFilePath, cancellationToken,
|
|
101315
|
+
handleDtsMayChangeOf(state, referencingFilePath, cancellationToken, host);
|
|
100936
101316
|
});
|
|
100937
101317
|
return undefined;
|
|
100938
101318
|
}
|
|
@@ -100987,34 +101367,45 @@ var ts;
|
|
|
100987
101367
|
return !!ts.outFile(info.options || {});
|
|
100988
101368
|
}
|
|
100989
101369
|
ts.isProgramBundleEmitBuildInfo = isProgramBundleEmitBuildInfo;
|
|
100990
|
-
function getProgramBuildInfo(state,
|
|
101370
|
+
function getProgramBuildInfo(state, host) {
|
|
100991
101371
|
var outFilePath = ts.outFile(state.compilerOptions);
|
|
100992
|
-
if (outFilePath && !state.compilerOptions.composite)
|
|
101372
|
+
if (outFilePath && !state.compilerOptions.composite && !state.compilerOptions.cacheResolutions)
|
|
100993
101373
|
return;
|
|
100994
101374
|
var currentDirectory = ts.Debug.checkDefined(state.program).getCurrentDirectory();
|
|
100995
|
-
var
|
|
101375
|
+
var getCanonicalFileName = ts.createGetCanonicalFileName(state.program.useCaseSensitiveFileNames());
|
|
101376
|
+
var buildInfoPath = ts.getNormalizedAbsolutePath(ts.getTsBuildInfoEmitOutputFilePath(state.compilerOptions), currentDirectory);
|
|
101377
|
+
var buildInfoDirectory = ts.getDirectoryPath(buildInfoPath);
|
|
100996
101378
|
var latestChangedDtsFile = state.latestChangedDtsFile ? relativeToBuildInfoEnsuringAbsolutePath(state.latestChangedDtsFile) : undefined;
|
|
101379
|
+
var fileNames = [];
|
|
101380
|
+
var fileNameToFileId = new ts.Map();
|
|
101381
|
+
var resolutions;
|
|
101382
|
+
var names;
|
|
101383
|
+
var resolutionNameToResolutionNameId;
|
|
101384
|
+
var resolutionEntries;
|
|
101385
|
+
var resolutionEntryToResolutionEntryId;
|
|
101386
|
+
var affectedFilesHash;
|
|
100997
101387
|
if (outFilePath) {
|
|
100998
|
-
var
|
|
100999
|
-
|
|
101000
|
-
|
|
101001
|
-
|
|
101002
|
-
|
|
101003
|
-
|
|
101004
|
-
|
|
101005
|
-
|
|
101006
|
-
|
|
101007
|
-
|
|
101008
|
-
|
|
101388
|
+
var fileInfos_1;
|
|
101389
|
+
if (state.compilerOptions.composite) {
|
|
101390
|
+
state.program.getRootFileNames().forEach(function (f) {
|
|
101391
|
+
var sourceFile = state.program.getSourceFile(f);
|
|
101392
|
+
if (!sourceFile)
|
|
101393
|
+
return;
|
|
101394
|
+
var fileId = toFileId(sourceFile.resolvedPath);
|
|
101395
|
+
(fileInfos_1 !== null && fileInfos_1 !== void 0 ? fileInfos_1 : (fileInfos_1 = []))[fileId - 1] = sourceFile.version;
|
|
101396
|
+
});
|
|
101397
|
+
}
|
|
101398
|
+
var cacheResolutions_1 = toProgramBuildInfoCacheResolutions();
|
|
101399
|
+
var result_16 = {
|
|
101400
|
+
fileNames: fileNames,
|
|
101009
101401
|
fileInfos: fileInfos_1,
|
|
101010
|
-
options:
|
|
101402
|
+
options: toProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsBundleEmitBuildInfo", !!state.compilerOptions.cacheResolutions),
|
|
101011
101403
|
outSignature: state.outSignature,
|
|
101012
101404
|
latestChangedDtsFile: latestChangedDtsFile,
|
|
101405
|
+
cacheResolutions: cacheResolutions_1,
|
|
101013
101406
|
};
|
|
101014
|
-
return
|
|
101407
|
+
return result_16;
|
|
101015
101408
|
}
|
|
101016
|
-
var fileNames = [];
|
|
101017
|
-
var fileNameToFileId = new ts.Map();
|
|
101018
101409
|
var fileIdsList;
|
|
101019
101410
|
var fileNamesToFileIdListId;
|
|
101020
101411
|
var emitSignatures;
|
|
@@ -101071,7 +101462,7 @@ var ts;
|
|
|
101071
101462
|
(semanticDiagnosticsPerFile || (semanticDiagnosticsPerFile = [])).push(value.length ?
|
|
101072
101463
|
[
|
|
101073
101464
|
toFileId(key),
|
|
101074
|
-
|
|
101465
|
+
value.map(toReusableDiagnostic)
|
|
101075
101466
|
] :
|
|
101076
101467
|
toFileId(key));
|
|
101077
101468
|
}
|
|
@@ -101093,10 +101484,11 @@ var ts;
|
|
|
101093
101484
|
(changeFileSet || (changeFileSet = [])).push(toFileId(path));
|
|
101094
101485
|
}
|
|
101095
101486
|
}
|
|
101487
|
+
var cacheResolutions = toProgramBuildInfoCacheResolutions();
|
|
101096
101488
|
var result = {
|
|
101097
101489
|
fileNames: fileNames,
|
|
101098
101490
|
fileInfos: fileInfos,
|
|
101099
|
-
options:
|
|
101491
|
+
options: toProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsMultiFileEmitBuildInfo", !!state.compilerOptions.cacheResolutions),
|
|
101100
101492
|
fileIdsList: fileIdsList,
|
|
101101
101493
|
referencedMap: referencedMap,
|
|
101102
101494
|
exportedModulesMap: exportedModulesMap,
|
|
@@ -101105,6 +101497,7 @@ var ts;
|
|
|
101105
101497
|
changeFileSet: changeFileSet,
|
|
101106
101498
|
emitSignatures: emitSignatures,
|
|
101107
101499
|
latestChangedDtsFile: latestChangedDtsFile,
|
|
101500
|
+
cacheResolutions: cacheResolutions,
|
|
101108
101501
|
};
|
|
101109
101502
|
return result;
|
|
101110
101503
|
function relativeToBuildInfoEnsuringAbsolutePath(path) {
|
|
@@ -101113,7 +101506,7 @@ var ts;
|
|
|
101113
101506
|
function relativeToBuildInfo(path) {
|
|
101114
101507
|
return ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(buildInfoDirectory, path, getCanonicalFileName));
|
|
101115
101508
|
}
|
|
101116
|
-
function
|
|
101509
|
+
function toFileAndAbsoluteFileId(path) {
|
|
101117
101510
|
var fileId = fileNameToFileId.get(path);
|
|
101118
101511
|
if (fileId === undefined) {
|
|
101119
101512
|
fileNames.push(relativeToBuildInfo(path));
|
|
@@ -101121,6 +101514,12 @@ var ts;
|
|
|
101121
101514
|
}
|
|
101122
101515
|
return fileId;
|
|
101123
101516
|
}
|
|
101517
|
+
function toFileId(path) {
|
|
101518
|
+
return toFileAndAbsoluteFileId(path);
|
|
101519
|
+
}
|
|
101520
|
+
function toAbsoluteFileId(path) {
|
|
101521
|
+
return toFileAndAbsoluteFileId(ts.getNormalizedAbsolutePath(path, currentDirectory));
|
|
101522
|
+
}
|
|
101124
101523
|
function toFileIdListId(set) {
|
|
101125
101524
|
var fileIds = ts.arrayFrom(set.keys(), toFileId).sort(ts.compareValues);
|
|
101126
101525
|
var key = fileIds.join();
|
|
@@ -101131,53 +101530,232 @@ var ts;
|
|
|
101131
101530
|
}
|
|
101132
101531
|
return fileIdListId;
|
|
101133
101532
|
}
|
|
101134
|
-
function
|
|
101533
|
+
function toProgramBuildInfoCompilerOptions(options, optionKey, affectsModuleResolution) {
|
|
101135
101534
|
var result;
|
|
101136
101535
|
var optionsNameMap = ts.getOptionsNameMap().optionsNameMap;
|
|
101137
101536
|
for (var _i = 0, _a = ts.getOwnKeys(options).sort(ts.compareStringsCaseSensitive); _i < _a.length; _i++) {
|
|
101138
101537
|
var name = _a[_i];
|
|
101139
101538
|
var optionInfo = optionsNameMap.get(name.toLowerCase());
|
|
101140
|
-
if (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo[optionKey]) {
|
|
101141
|
-
(result
|
|
101539
|
+
if ((optionKey && (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo[optionKey])) || (affectsModuleResolution && (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo.affectsModuleResolution))) {
|
|
101540
|
+
(result !== null && result !== void 0 ? result : (result = {}))[name] = toReusableCompilerOptionValue(optionInfo, options[name]);
|
|
101541
|
+
}
|
|
101542
|
+
else if (affectsModuleResolution && name === "pathsBasePath") {
|
|
101543
|
+
(result !== null && result !== void 0 ? result : (result = {})).pathsBasePath = relativeToBuildInfoEnsuringAbsolutePath(options.pathsBasePath);
|
|
101544
|
+
continue;
|
|
101142
101545
|
}
|
|
101143
101546
|
}
|
|
101144
101547
|
return result;
|
|
101145
101548
|
}
|
|
101146
|
-
|
|
101147
|
-
|
|
101148
|
-
|
|
101149
|
-
|
|
101150
|
-
|
|
101151
|
-
|
|
101152
|
-
|
|
101549
|
+
function toReusableCompilerOptionValue(option, value) {
|
|
101550
|
+
if (option) {
|
|
101551
|
+
if (option.type === "list") {
|
|
101552
|
+
var values = value;
|
|
101553
|
+
if (option.element.isFilePath && values.length) {
|
|
101554
|
+
return values.map(relativeToBuildInfoEnsuringAbsolutePath);
|
|
101555
|
+
}
|
|
101556
|
+
}
|
|
101557
|
+
else if (option.isFilePath) {
|
|
101558
|
+
return relativeToBuildInfoEnsuringAbsolutePath(value);
|
|
101153
101559
|
}
|
|
101154
101560
|
}
|
|
101155
|
-
|
|
101156
|
-
return relativeToBuildInfo(value);
|
|
101157
|
-
}
|
|
101561
|
+
return value;
|
|
101158
101562
|
}
|
|
101159
|
-
|
|
101160
|
-
|
|
101161
|
-
|
|
101162
|
-
|
|
101163
|
-
|
|
101164
|
-
var result = convertToReusableDiagnosticRelatedInformation(diagnostic, relativeToBuildInfo);
|
|
101563
|
+
function toReadonlyArrayOrUndefined(array, map) {
|
|
101564
|
+
return (array === null || array === void 0 ? void 0 : array.length) ? array.map(map) : undefined;
|
|
101565
|
+
}
|
|
101566
|
+
function toReusableDiagnostic(diagnostic) {
|
|
101567
|
+
var result = toReusableDiagnosticRelatedInformation(diagnostic);
|
|
101165
101568
|
result.reportsUnnecessary = diagnostic.reportsUnnecessary;
|
|
101166
101569
|
result.reportDeprecated = diagnostic.reportsDeprecated;
|
|
101167
101570
|
result.source = diagnostic.source;
|
|
101168
101571
|
result.skippedOn = diagnostic.skippedOn;
|
|
101169
101572
|
var relatedInformation = diagnostic.relatedInformation;
|
|
101170
|
-
result.relatedInformation = relatedInformation ?
|
|
101171
|
-
relatedInformation.length ?
|
|
101172
|
-
relatedInformation.map(function (r) { return convertToReusableDiagnosticRelatedInformation(r, relativeToBuildInfo); }) :
|
|
101173
|
-
[] :
|
|
101174
|
-
undefined;
|
|
101573
|
+
result.relatedInformation = relatedInformation === null || relatedInformation === void 0 ? void 0 : relatedInformation.map(toReusableDiagnosticRelatedInformation);
|
|
101175
101574
|
return result;
|
|
101575
|
+
}
|
|
101576
|
+
function toReusableDiagnosticRelatedInformation(diagnostic) {
|
|
101577
|
+
var file = diagnostic.file;
|
|
101578
|
+
return __assign(__assign({}, diagnostic), { file: file ? relativeToBuildInfo(file.resolvedPath) : undefined });
|
|
101579
|
+
}
|
|
101580
|
+
function toProgramBuildInfoCacheResolutions() {
|
|
101581
|
+
var cacheResolutions = getCacheResolutions(state);
|
|
101582
|
+
var modules = toProgramBuildInfoResolutionCacheWithRedirects(cacheResolutions === null || cacheResolutions === void 0 ? void 0 : cacheResolutions.modules);
|
|
101583
|
+
var typeRefs = toProgramBuildInfoResolutionCacheWithRedirects(cacheResolutions === null || cacheResolutions === void 0 ? void 0 : cacheResolutions.typeRefs);
|
|
101584
|
+
var packageJsons = toProgramBuildInfoPackageJsons(cacheResolutions === null || cacheResolutions === void 0 ? void 0 : cacheResolutions.perDirPackageJsonMap);
|
|
101585
|
+
if (!resolutions)
|
|
101586
|
+
return;
|
|
101587
|
+
ts.Debug.assertIsDefined(names);
|
|
101588
|
+
ts.Debug.assertIsDefined(resolutionEntries);
|
|
101589
|
+
state.resuableCacheResolutions = {
|
|
101590
|
+
cache: {
|
|
101591
|
+
resolutions: resolutions.map(toProgramBuildInfoResolution),
|
|
101592
|
+
names: names,
|
|
101593
|
+
hash: toProgramBuildInfoHashes(),
|
|
101594
|
+
resolutionEntries: resolutionEntries,
|
|
101595
|
+
modules: modules,
|
|
101596
|
+
typeRefs: typeRefs,
|
|
101597
|
+
packageJsons: packageJsons,
|
|
101598
|
+
},
|
|
101599
|
+
getProgramBuildInfoFilePathDecoder: ts.memoize(function () { return getProgramBuildInfoFilePathDecoder(fileNames, buildInfoPath, currentDirectory, getCanonicalFileName); })
|
|
101600
|
+
};
|
|
101601
|
+
return state.resuableCacheResolutions.cache;
|
|
101602
|
+
}
|
|
101603
|
+
function toProgramBuildInfoPackageJsons(cache) {
|
|
101604
|
+
var result;
|
|
101605
|
+
cache === null || cache === void 0 ? void 0 : cache.forEach(function (packageJson, dirPath) {
|
|
101606
|
+
var packageJsonDirPath = ts.getDirectoryPath(ts.toPath(packageJson, currentDirectory, getCanonicalFileName));
|
|
101607
|
+
if (packageJsonDirPath !== dirPath) {
|
|
101608
|
+
(result !== null && result !== void 0 ? result : (result = [])).push([
|
|
101609
|
+
toFileId(dirPath),
|
|
101610
|
+
toAbsoluteFileId(packageJson),
|
|
101611
|
+
]);
|
|
101612
|
+
}
|
|
101613
|
+
});
|
|
101614
|
+
return result;
|
|
101615
|
+
}
|
|
101616
|
+
function toProgramBuildInfoResolutionCacheWithRedirects(cache) {
|
|
101617
|
+
if (!cache)
|
|
101618
|
+
return undefined;
|
|
101619
|
+
var ownMap = cache.getOwnMap();
|
|
101620
|
+
var own = toProgramBuildInfoResolutionCache(ownMap);
|
|
101621
|
+
var redirects;
|
|
101622
|
+
cache.redirectsKeyToCache.forEach(function (_a) {
|
|
101623
|
+
var map = _a.map, options = _a.options;
|
|
101624
|
+
if (map === ownMap)
|
|
101625
|
+
return;
|
|
101626
|
+
var redirectCache = toProgramBuildInfoResolutionCache(map);
|
|
101627
|
+
if (redirectCache) {
|
|
101628
|
+
(redirects !== null && redirects !== void 0 ? redirects : (redirects = [])).push({
|
|
101629
|
+
options: toProgramBuildInfoCompilerOptions(options, undefined, true),
|
|
101630
|
+
cache: redirectCache
|
|
101631
|
+
});
|
|
101632
|
+
}
|
|
101633
|
+
});
|
|
101634
|
+
return !redirects ? own : { own: own, redirects: redirects };
|
|
101635
|
+
}
|
|
101636
|
+
function toProgramBuildInfoResolutionCache(cache) {
|
|
101637
|
+
var result;
|
|
101638
|
+
cache === null || cache === void 0 ? void 0 : cache.forEach(function (dirCache, dirPath) { return dirCache.size() ?
|
|
101639
|
+
(result !== null && result !== void 0 ? result : (result = [])).push([
|
|
101640
|
+
toFileId(dirPath),
|
|
101641
|
+
ts.arrayFrom(dirCache.entries()).map(toProgramBuildInfoResolutionEntryId)
|
|
101642
|
+
]) :
|
|
101643
|
+
undefined; });
|
|
101644
|
+
return result;
|
|
101645
|
+
}
|
|
101646
|
+
function toProgramBuildInfoResolutionEntryId(_a) {
|
|
101647
|
+
var name = _a[0], mode = _a[1], resolution = _a[2];
|
|
101648
|
+
var resolutionNameId = toProgramBuildInfoResolutionNameId(name);
|
|
101649
|
+
var resolutionId = toProgramBuildInfoResolutionId(resolution);
|
|
101650
|
+
var key = resolutionNameId + "," + mode + "," + resolutionId;
|
|
101651
|
+
var resolutionEntryId = resolutionEntryToResolutionEntryId === null || resolutionEntryToResolutionEntryId === void 0 ? void 0 : resolutionEntryToResolutionEntryId.get(key);
|
|
101652
|
+
if (resolutionEntryId === undefined) {
|
|
101653
|
+
(resolutionEntries || (resolutionEntries = [])).push(mode ? [resolutionNameId, resolutionId, mode] : [resolutionNameId, resolutionId]);
|
|
101654
|
+
(resolutionEntryToResolutionEntryId || (resolutionEntryToResolutionEntryId = new ts.Map())).set(key, resolutionEntryId = resolutionEntries.length);
|
|
101655
|
+
}
|
|
101656
|
+
return resolutionEntryId;
|
|
101657
|
+
}
|
|
101658
|
+
function toProgramBuildInfoResolutionNameId(name) {
|
|
101659
|
+
var resolutionNameId = resolutionNameToResolutionNameId === null || resolutionNameToResolutionNameId === void 0 ? void 0 : resolutionNameToResolutionNameId.get(name);
|
|
101660
|
+
if (resolutionNameId === undefined) {
|
|
101661
|
+
(names !== null && names !== void 0 ? names : (names = [])).push(name);
|
|
101662
|
+
(resolutionNameToResolutionNameId !== null && resolutionNameToResolutionNameId !== void 0 ? resolutionNameToResolutionNameId : (resolutionNameToResolutionNameId = new ts.Map())).set(name, resolutionNameId = names.length);
|
|
101663
|
+
}
|
|
101664
|
+
return resolutionNameId;
|
|
101665
|
+
}
|
|
101666
|
+
function toProgramBuildInfoResolutionId(resolution) {
|
|
101667
|
+
if (resolution.serializationIndex === undefined) {
|
|
101668
|
+
(resolutions !== null && resolutions !== void 0 ? resolutions : (resolutions = [])).push(resolution);
|
|
101669
|
+
resolution.serializationIndex = resolutions.length;
|
|
101670
|
+
}
|
|
101671
|
+
return resolution.serializationIndex;
|
|
101672
|
+
}
|
|
101673
|
+
function toProgramBuildInfoResolution(resolution) {
|
|
101674
|
+
resolution.serializationIndex = undefined;
|
|
101675
|
+
return {
|
|
101676
|
+
resolvedModule: toProgramBuildInfoResolved(resolution.resolvedModule),
|
|
101677
|
+
resolvedTypeReferenceDirective: toProgramBuildInfoResolved(resolution.resolvedTypeReferenceDirective),
|
|
101678
|
+
affectingLocations: toReadonlyArrayOrUndefined(resolution.affectingLocations, toAffectedFileId),
|
|
101679
|
+
resolutionDiagnostics: toReadonlyArrayOrUndefined(resolution.resolutionDiagnostics, toProgramBuildInfoResolutionDiagnostic),
|
|
101680
|
+
};
|
|
101681
|
+
}
|
|
101682
|
+
function toProgramBuildInfoHashes() {
|
|
101683
|
+
if (!affectedFilesHash)
|
|
101684
|
+
return undefined;
|
|
101685
|
+
var hashes = [];
|
|
101686
|
+
for (var _i = 0, _a = ts.arrayFrom(affectedFilesHash.keys()).sort(ts.compareValues); _i < _a.length; _i++) {
|
|
101687
|
+
var key = _a[_i];
|
|
101688
|
+
var value = affectedFilesHash.get(key);
|
|
101689
|
+
hashes.push(value ? [key, value] : key);
|
|
101690
|
+
}
|
|
101691
|
+
return hashes;
|
|
101692
|
+
}
|
|
101693
|
+
function toAffectedFileId(file) {
|
|
101694
|
+
var _a;
|
|
101695
|
+
var fileId = toAbsoluteFileId(file);
|
|
101696
|
+
if (!(affectedFilesHash === null || affectedFilesHash === void 0 ? void 0 : affectedFilesHash.has(fileId))) {
|
|
101697
|
+
var packageJsonInfo = (_a = state.program.getModuleResolutionCache()) === null || _a === void 0 ? void 0 : _a.getPackageJsonInfo(file);
|
|
101698
|
+
var text = typeof packageJsonInfo === "object" ? packageJsonInfo.packageJsonText : undefined;
|
|
101699
|
+
(affectedFilesHash !== null && affectedFilesHash !== void 0 ? affectedFilesHash : (affectedFilesHash = new ts.Map())).set(fileId, text ? computeSignature(text, host) : undefined);
|
|
101700
|
+
}
|
|
101701
|
+
return fileId;
|
|
101702
|
+
}
|
|
101703
|
+
function toProgramBuildInfoResolved(resolved) {
|
|
101704
|
+
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;
|
|
101705
|
+
}
|
|
101706
|
+
function toProgramBuildInfoResolutionDiagnostic(d) {
|
|
101707
|
+
return {
|
|
101708
|
+
isImports: d.isImports || undefined,
|
|
101709
|
+
entry: d.entry || undefined,
|
|
101710
|
+
packagePath: toAbsoluteFileId(d.packagePath),
|
|
101711
|
+
};
|
|
101712
|
+
}
|
|
101713
|
+
}
|
|
101714
|
+
function getCacheResolutions(state) {
|
|
101715
|
+
var _a;
|
|
101716
|
+
if (state.cacheResolutions || !state.compilerOptions.cacheResolutions)
|
|
101717
|
+
return state.cacheResolutions;
|
|
101718
|
+
var modules;
|
|
101719
|
+
var typeRefs;
|
|
101720
|
+
var moduleNameToDirectoryMap = ts.createCacheWithRedirects(state.compilerOptions);
|
|
101721
|
+
var dirToPackageJsonScope = new ts.Map();
|
|
101722
|
+
var perDirPackageJsonMap;
|
|
101723
|
+
var getCanonicalFileName = ts.createGetCanonicalFileName(state.program.useCaseSensitiveFileNames());
|
|
101724
|
+
state.program.getSourceFiles().forEach(function (f) {
|
|
101725
|
+
var _a;
|
|
101726
|
+
modules = toPerDirectoryCache(state, getCanonicalFileName, modules, ts.getResolvedModuleOfResolution, f, f.resolvedModules, moduleNameToDirectoryMap);
|
|
101727
|
+
typeRefs = toPerDirectoryCache(state, getCanonicalFileName, typeRefs, ts.getResolvedTypeReferenceDirectiveOfResolution, f, f.resolvedTypeReferenceDirectiveNames);
|
|
101728
|
+
if ((_a = f.packageJsonScope) === null || _a === void 0 ? void 0 : _a.info) {
|
|
101729
|
+
var dirPath = ts.getDirectoryPath(f.resolvedPath);
|
|
101730
|
+
if (!(dirToPackageJsonScope === null || dirToPackageJsonScope === void 0 ? void 0 : dirToPackageJsonScope.has(dirPath))) {
|
|
101731
|
+
(perDirPackageJsonMap !== null && perDirPackageJsonMap !== void 0 ? perDirPackageJsonMap : (perDirPackageJsonMap = new ts.Map())).set(dirPath, ts.getPackageJsconLocationFromScope(f.packageJsonScope));
|
|
101732
|
+
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); });
|
|
101733
|
+
}
|
|
101734
|
+
}
|
|
101176
101735
|
});
|
|
101736
|
+
var automaticTypeDirectiveNames = state.program.getAutomaticTypeDirectiveNames();
|
|
101737
|
+
if (automaticTypeDirectiveNames.length) {
|
|
101738
|
+
var currentDirectory = state.program.getCurrentDirectory();
|
|
101739
|
+
var containingPath = ts.toPath(state.program.getAutomaticTypeDirectiveContainingFile(), currentDirectory, getCanonicalFileName);
|
|
101740
|
+
typeRefs = toPerDirectoryCache(state, getCanonicalFileName, typeRefs, ts.getResolvedTypeReferenceDirectiveOfResolution, containingPath, state.program.getAutomaticTypeDirectiveResolutions());
|
|
101741
|
+
}
|
|
101742
|
+
return state.cacheResolutions = {
|
|
101743
|
+
modules: modules,
|
|
101744
|
+
typeRefs: typeRefs,
|
|
101745
|
+
moduleNameToDirectoryMap: moduleNameToDirectoryMap,
|
|
101746
|
+
dirToPackageJsonScope: dirToPackageJsonScope,
|
|
101747
|
+
perDirPackageJsonMap: perDirPackageJsonMap,
|
|
101748
|
+
packageJsonCache: (_a = state.program.getModuleResolutionCache()) === null || _a === void 0 ? void 0 : _a.getPackageJsonInfoCache().clone(),
|
|
101749
|
+
};
|
|
101177
101750
|
}
|
|
101178
|
-
function
|
|
101179
|
-
|
|
101180
|
-
|
|
101751
|
+
function toPerDirectoryCache(state, getCanonicalFileName, perDirCache, getResolutionWithResolvedFileName, sourceFileOrPath, fileCacheFromProgram, moduleNameToDirectoryMap) {
|
|
101752
|
+
return ts.toPerDirectoryResolution(state.program, fileCacheFromProgram, sourceFileOrPath, perDirCache, moduleNameToDirectoryMap, ts.noop, function (r, name, mode, _key, redirectedReference, dirPath) {
|
|
101753
|
+
var _a, _b, _c;
|
|
101754
|
+
return !((_a = getResolutionWithResolvedFileName(r)) === null || _a === void 0 ? void 0 : _a.resolvedFileName) ||
|
|
101755
|
+
(moduleNameToDirectoryMap &&
|
|
101756
|
+
!ts.isExternalModuleNameRelative(name) &&
|
|
101757
|
+
((_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)));
|
|
101758
|
+
}, 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); });
|
|
101181
101759
|
}
|
|
101182
101760
|
var BuilderProgramKind;
|
|
101183
101761
|
(function (BuilderProgramKind) {
|
|
@@ -101201,7 +101779,7 @@ var ts;
|
|
|
101201
101779
|
rootNames: newProgramOrRootNames,
|
|
101202
101780
|
options: hostOrOptions,
|
|
101203
101781
|
host: oldProgramOrHost,
|
|
101204
|
-
oldProgram: oldProgram
|
|
101782
|
+
oldProgram: oldProgram === null || oldProgram === void 0 ? void 0 : oldProgram.getProgramOrOldBuildInfoProgramUndefined(),
|
|
101205
101783
|
configFileParsingDiagnostics: configFileParsingDiagnostics,
|
|
101206
101784
|
projectReferences: projectReferences
|
|
101207
101785
|
});
|
|
@@ -101219,8 +101797,8 @@ var ts;
|
|
|
101219
101797
|
function getTextHandlingSourceMapForSignature(text, data) {
|
|
101220
101798
|
return (data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text;
|
|
101221
101799
|
}
|
|
101222
|
-
function computeSignatureWithDiagnostics(sourceFile, text,
|
|
101223
|
-
var _a;
|
|
101800
|
+
function computeSignatureWithDiagnostics(sourceFile, text, host, getCanonicalFileName, data) {
|
|
101801
|
+
var _a, _b;
|
|
101224
101802
|
text = getTextHandlingSourceMapForSignature(text, data);
|
|
101225
101803
|
var sourceFileDirectory;
|
|
101226
101804
|
if ((_a = data === null || data === void 0 ? void 0 : data.diagnostics) === null || _a === void 0 ? void 0 : _a.length) {
|
|
@@ -101228,7 +101806,7 @@ var ts;
|
|
|
101228
101806
|
return "" + locationInfo(diagnostic) + ts.DiagnosticCategory[diagnostic.category] + diagnostic.code + ": " + flattenDiagnosticMessageText(diagnostic.messageText);
|
|
101229
101807
|
}).join("\n");
|
|
101230
101808
|
}
|
|
101231
|
-
return (
|
|
101809
|
+
return ((_b = host.createHash) !== null && _b !== void 0 ? _b : ts.generateDjb2Hash)(text);
|
|
101232
101810
|
function flattenDiagnosticMessageText(diagnostic) {
|
|
101233
101811
|
return ts.isString(diagnostic) ?
|
|
101234
101812
|
diagnostic :
|
|
@@ -101247,8 +101825,9 @@ var ts;
|
|
|
101247
101825
|
}
|
|
101248
101826
|
}
|
|
101249
101827
|
ts.computeSignatureWithDiagnostics = computeSignatureWithDiagnostics;
|
|
101250
|
-
function computeSignature(text,
|
|
101251
|
-
|
|
101828
|
+
function computeSignature(text, host, data) {
|
|
101829
|
+
var _a;
|
|
101830
|
+
return ((_a = host.createHash) !== null && _a !== void 0 ? _a : ts.generateDjb2Hash)(getTextHandlingSourceMapForSignature(text, data));
|
|
101252
101831
|
}
|
|
101253
101832
|
ts.computeSignature = computeSignature;
|
|
101254
101833
|
function createBuilderProgram(kind, _a) {
|
|
@@ -101259,10 +101838,8 @@ var ts;
|
|
|
101259
101838
|
oldState = undefined;
|
|
101260
101839
|
return oldProgram;
|
|
101261
101840
|
}
|
|
101262
|
-
var
|
|
101263
|
-
|
|
101264
|
-
var state = createBuilderProgramState(newProgram, getCanonicalFileName, oldState, host.disableUseFileVersionAsSignature);
|
|
101265
|
-
newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName); };
|
|
101841
|
+
var state = createBuilderProgramState(newProgram, oldState, host.disableUseFileVersionAsSignature);
|
|
101842
|
+
newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, host); };
|
|
101266
101843
|
newProgram = undefined;
|
|
101267
101844
|
oldProgram = undefined;
|
|
101268
101845
|
oldState = undefined;
|
|
@@ -101276,6 +101853,7 @@ var ts;
|
|
|
101276
101853
|
builderProgram.getSemanticDiagnostics = getSemanticDiagnostics;
|
|
101277
101854
|
builderProgram.emit = emit;
|
|
101278
101855
|
builderProgram.releaseProgram = function () { return releaseCache(state); };
|
|
101856
|
+
builderProgram.getProgramOrOldBuildInfoProgramUndefined = createGetProgramOrOldBuildInfoProgramUndefined(state);
|
|
101279
101857
|
if (kind === BuilderProgramKind.SemanticDiagnosticsBuilderProgram) {
|
|
101280
101858
|
builderProgram.getSemanticDiagnosticsOfNextAffectedFile = getSemanticDiagnosticsOfNextAffectedFile;
|
|
101281
101859
|
}
|
|
@@ -101297,7 +101875,7 @@ var ts;
|
|
|
101297
101875
|
return ts.emitSkippedWithNoDiagnostics;
|
|
101298
101876
|
}
|
|
101299
101877
|
function emitNextAffectedFile(writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) {
|
|
101300
|
-
var affected = getNextAffectedFile(state, cancellationToken,
|
|
101878
|
+
var affected = getNextAffectedFile(state, cancellationToken, host);
|
|
101301
101879
|
var emitKind = 1;
|
|
101302
101880
|
var isPendingEmitFile = false;
|
|
101303
101881
|
if (!affected) {
|
|
@@ -101335,7 +101913,7 @@ var ts;
|
|
|
101335
101913
|
var file = sourceFiles[0];
|
|
101336
101914
|
var info = state.fileInfos.get(file.resolvedPath);
|
|
101337
101915
|
if (info.signature === file.version) {
|
|
101338
|
-
var signature = computeSignatureWithDiagnostics(file, text,
|
|
101916
|
+
var signature = computeSignatureWithDiagnostics(file, text, host, ts.createGetCanonicalFileName(state.program.useCaseSensitiveFileNames()), data);
|
|
101339
101917
|
if (!((_a = data === null || data === void 0 ? void 0 : data.diagnostics) === null || _a === void 0 ? void 0 : _a.length))
|
|
101340
101918
|
emitSignature = signature;
|
|
101341
101919
|
if (signature !== file.version) {
|
|
@@ -101359,7 +101937,7 @@ var ts;
|
|
|
101359
101937
|
if (state.compilerOptions.composite) {
|
|
101360
101938
|
var filePath = sourceFiles[0].resolvedPath;
|
|
101361
101939
|
var oldSignature = (_f = state.emitSignatures) === null || _f === void 0 ? void 0 : _f.get(filePath);
|
|
101362
|
-
emitSignature !== null && emitSignature !== void 0 ? emitSignature : (emitSignature = computeSignature(text,
|
|
101940
|
+
emitSignature !== null && emitSignature !== void 0 ? emitSignature : (emitSignature = computeSignature(text, host, data));
|
|
101363
101941
|
if (emitSignature === oldSignature)
|
|
101364
101942
|
return;
|
|
101365
101943
|
((_g = state.emitSignatures) !== null && _g !== void 0 ? _g : (state.emitSignatures = new ts.Map())).set(filePath, emitSignature);
|
|
@@ -101368,7 +101946,7 @@ var ts;
|
|
|
101368
101946
|
}
|
|
101369
101947
|
}
|
|
101370
101948
|
else if (state.compilerOptions.composite) {
|
|
101371
|
-
var newSignature = computeSignature(text,
|
|
101949
|
+
var newSignature = computeSignature(text, host, data);
|
|
101372
101950
|
if (newSignature === state.outSignature)
|
|
101373
101951
|
return;
|
|
101374
101952
|
state.outSignature = newSignature;
|
|
@@ -101429,7 +102007,7 @@ var ts;
|
|
|
101429
102007
|
}
|
|
101430
102008
|
function getSemanticDiagnosticsOfNextAffectedFile(cancellationToken, ignoreSourceFile) {
|
|
101431
102009
|
while (true) {
|
|
101432
|
-
var affected = getNextAffectedFile(state, cancellationToken,
|
|
102010
|
+
var affected = getNextAffectedFile(state, cancellationToken, host);
|
|
101433
102011
|
if (!affected) {
|
|
101434
102012
|
return undefined;
|
|
101435
102013
|
}
|
|
@@ -101487,12 +102065,32 @@ var ts;
|
|
|
101487
102065
|
{ version: fileInfo.version, signature: fileInfo.signature === false ? undefined : fileInfo.version, affectsGlobalScope: fileInfo.affectsGlobalScope, impliedFormat: fileInfo.impliedFormat };
|
|
101488
102066
|
}
|
|
101489
102067
|
ts.toBuilderStateFileInfo = toBuilderStateFileInfo;
|
|
101490
|
-
function
|
|
101491
|
-
var
|
|
101492
|
-
var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
|
|
101493
|
-
var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
|
|
101494
|
-
var state;
|
|
102068
|
+
function getProgramBuildInfoFilePathDecoder(fileNames, buildInfoPath, currentDirectory, getCanonicalFileName) {
|
|
102069
|
+
var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, currentDirectory));
|
|
101495
102070
|
var filePaths;
|
|
102071
|
+
var fileAbsolutePaths;
|
|
102072
|
+
return { toAbsolutePath: toAbsolutePath, toFilePath: toFilePath, toFileAbsolutePath: toFileAbsolutePath, currentDirectory: currentDirectory, getCanonicalFileName: getCanonicalFileName };
|
|
102073
|
+
function toPath(path) {
|
|
102074
|
+
return ts.toPath(path, buildInfoDirectory, getCanonicalFileName);
|
|
102075
|
+
}
|
|
102076
|
+
function toAbsolutePath(path) {
|
|
102077
|
+
return ts.getNormalizedAbsolutePath(path, buildInfoDirectory);
|
|
102078
|
+
}
|
|
102079
|
+
function toFilePath(fileId) {
|
|
102080
|
+
var _a;
|
|
102081
|
+
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]));
|
|
102082
|
+
}
|
|
102083
|
+
function toFileAbsolutePath(fileId) {
|
|
102084
|
+
var _a;
|
|
102085
|
+
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]));
|
|
102086
|
+
}
|
|
102087
|
+
}
|
|
102088
|
+
ts.getProgramBuildInfoFilePathDecoder = getProgramBuildInfoFilePathDecoder;
|
|
102089
|
+
function createBuilderProgramUsingProgramBuildInfo(program, buildInfoPath, host, configFilePath) {
|
|
102090
|
+
var _a, _b, _c;
|
|
102091
|
+
var buildInfoFilePathDecoder = getProgramBuildInfoFilePathDecoder(program.fileNames, buildInfoPath, host.getCurrentDirectory(), ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames()));
|
|
102092
|
+
var toFilePath = buildInfoFilePathDecoder.toFilePath, toAbsolutePath = buildInfoFilePathDecoder.toAbsolutePath;
|
|
102093
|
+
var state;
|
|
101496
102094
|
var filePathsSetList;
|
|
101497
102095
|
var latestChangedDtsFile = program.latestChangedDtsFile ? toAbsolutePath(program.latestChangedDtsFile) : undefined;
|
|
101498
102096
|
if (isProgramBundleEmitBuildInfo(program)) {
|
|
@@ -101501,13 +102099,13 @@ var ts;
|
|
|
101501
102099
|
compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
|
|
101502
102100
|
latestChangedDtsFile: latestChangedDtsFile,
|
|
101503
102101
|
outSignature: program.outSignature,
|
|
102102
|
+
resuableCacheResolutions: toResuableCacheResolutions(),
|
|
101504
102103
|
};
|
|
101505
102104
|
}
|
|
101506
102105
|
else {
|
|
101507
|
-
|
|
101508
|
-
filePathsSetList = (_b = program.fileIdsList) === null || _b === void 0 ? void 0 : _b.map(function (fileIds) { return new ts.Set(fileIds.map(toFilePath)); });
|
|
102106
|
+
filePathsSetList = (_a = program.fileIdsList) === null || _a === void 0 ? void 0 : _a.map(function (fileIds) { return new ts.Set(fileIds.map(toFilePath)); });
|
|
101509
102107
|
var fileInfos_2 = new ts.Map();
|
|
101510
|
-
var emitSignatures_1 = ((
|
|
102108
|
+
var emitSignatures_1 = ((_b = program.options) === null || _b === void 0 ? void 0 : _b.composite) && !ts.outFile(program.options) ? new ts.Map() : undefined;
|
|
101511
102109
|
program.fileInfos.forEach(function (fileInfo, index) {
|
|
101512
102110
|
var path = toFilePath(index + 1);
|
|
101513
102111
|
var stateFileInfo = toBuilderStateFileInfo(fileInfo);
|
|
@@ -101515,7 +102113,7 @@ var ts;
|
|
|
101515
102113
|
if (emitSignatures_1 && stateFileInfo.signature)
|
|
101516
102114
|
emitSignatures_1.set(path, stateFileInfo.signature);
|
|
101517
102115
|
});
|
|
101518
|
-
(
|
|
102116
|
+
(_c = program.emitSignatures) === null || _c === void 0 ? void 0 : _c.forEach(function (value) {
|
|
101519
102117
|
if (ts.isNumber(value))
|
|
101520
102118
|
emitSignatures_1.delete(toFilePath(value));
|
|
101521
102119
|
else
|
|
@@ -101534,14 +102132,17 @@ var ts;
|
|
|
101534
102132
|
changedFilesSet: new ts.Set(ts.map(program.changeFileSet, toFilePath)),
|
|
101535
102133
|
latestChangedDtsFile: latestChangedDtsFile,
|
|
101536
102134
|
emitSignatures: (emitSignatures_1 === null || emitSignatures_1 === void 0 ? void 0 : emitSignatures_1.size) ? emitSignatures_1 : undefined,
|
|
102135
|
+
resuableCacheResolutions: toResuableCacheResolutions(),
|
|
101537
102136
|
};
|
|
101538
102137
|
}
|
|
102138
|
+
state.compilerOptions.configFilePath = configFilePath;
|
|
101539
102139
|
return {
|
|
101540
102140
|
getState: function () { return state; },
|
|
101541
102141
|
saveEmitState: ts.noop,
|
|
101542
102142
|
restoreEmitState: ts.noop,
|
|
101543
102143
|
getProgram: ts.notImplemented,
|
|
101544
102144
|
getProgramOrUndefined: ts.returnUndefined,
|
|
102145
|
+
getProgramOrOldBuildInfoProgramUndefined: createGetProgramOrOldBuildInfoProgramUndefined(state),
|
|
101545
102146
|
releaseProgram: ts.noop,
|
|
101546
102147
|
getCompilerOptions: function () { return state.compilerOptions; },
|
|
101547
102148
|
getSourceFile: ts.notImplemented,
|
|
@@ -101561,15 +102162,6 @@ var ts;
|
|
|
101561
102162
|
close: ts.noop,
|
|
101562
102163
|
hasChangedEmitSignature: ts.returnFalse,
|
|
101563
102164
|
};
|
|
101564
|
-
function toPath(path) {
|
|
101565
|
-
return ts.toPath(path, buildInfoDirectory, getCanonicalFileName);
|
|
101566
|
-
}
|
|
101567
|
-
function toAbsolutePath(path) {
|
|
101568
|
-
return ts.getNormalizedAbsolutePath(path, buildInfoDirectory);
|
|
101569
|
-
}
|
|
101570
|
-
function toFilePath(fileId) {
|
|
101571
|
-
return filePaths[fileId - 1];
|
|
101572
|
-
}
|
|
101573
102165
|
function toFilePathsSet(fileIdsListId) {
|
|
101574
102166
|
return filePathsSetList[fileIdsListId - 1];
|
|
101575
102167
|
}
|
|
@@ -101584,8 +102176,241 @@ var ts;
|
|
|
101584
102176
|
});
|
|
101585
102177
|
return map;
|
|
101586
102178
|
}
|
|
102179
|
+
function toResuableCacheResolutions() {
|
|
102180
|
+
return program.cacheResolutions && {
|
|
102181
|
+
cache: program.cacheResolutions,
|
|
102182
|
+
getProgramBuildInfoFilePathDecoder: function () { return buildInfoFilePathDecoder; },
|
|
102183
|
+
};
|
|
102184
|
+
}
|
|
101587
102185
|
}
|
|
101588
102186
|
ts.createBuilderProgramUsingProgramBuildInfo = createBuilderProgramUsingProgramBuildInfo;
|
|
102187
|
+
function createGetProgramOrOldBuildInfoProgramUndefined(state) {
|
|
102188
|
+
return function () {
|
|
102189
|
+
var _a;
|
|
102190
|
+
return (_a = state.program) !== null && _a !== void 0 ? _a : (state.cacheResolutions || state.resuableCacheResolutions ?
|
|
102191
|
+
(function (host) { return createOldBuildInfoProgram(host, state.compilerOptions, state.cacheResolutions, !state.cacheResolutions ? state.resuableCacheResolutions : undefined); }) :
|
|
102192
|
+
undefined);
|
|
102193
|
+
};
|
|
102194
|
+
}
|
|
102195
|
+
function createOldBuildInfoProgram(host, compilerOptions, cacheResolutions, resuableCacheResolutions) {
|
|
102196
|
+
if (!cacheResolutions && !resuableCacheResolutions)
|
|
102197
|
+
return undefined;
|
|
102198
|
+
var fileExistsMap = new ts.Map();
|
|
102199
|
+
var packageJsonInfoMap = new ts.Map();
|
|
102200
|
+
var affectingLoationsSameMap = new ts.Map();
|
|
102201
|
+
var decodedResolvedModules = ts.createCacheWithRedirects(compilerOptions);
|
|
102202
|
+
var decodedResolvedTypeRefs = ts.createCacheWithRedirects(compilerOptions);
|
|
102203
|
+
var decodedModuleNameToDirectoryMap = ts.createCacheWithRedirects(compilerOptions);
|
|
102204
|
+
var decodedPackageJsonMap;
|
|
102205
|
+
var packageJsonScopes;
|
|
102206
|
+
var decodedHashes;
|
|
102207
|
+
var resolutions;
|
|
102208
|
+
var originalPathOrResolvedFileNames;
|
|
102209
|
+
var resolutionEntries;
|
|
102210
|
+
return {
|
|
102211
|
+
getCompilerOptions: function () { return compilerOptions; },
|
|
102212
|
+
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); },
|
|
102213
|
+
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, undefined, undefined); },
|
|
102214
|
+
getPackageJsonScope: getPackageJsonScope,
|
|
102215
|
+
};
|
|
102216
|
+
function fileExists(fileName) {
|
|
102217
|
+
var result = fileExistsMap.get(fileName);
|
|
102218
|
+
if (result === undefined)
|
|
102219
|
+
fileExistsMap.set(fileName, result = host.fileExists(fileName));
|
|
102220
|
+
return result;
|
|
102221
|
+
}
|
|
102222
|
+
function getPackageJsonInfo(fileName) {
|
|
102223
|
+
var result = packageJsonInfoMap.get(fileName);
|
|
102224
|
+
if (result === undefined)
|
|
102225
|
+
packageJsonInfoMap.set(fileName, result = host.getPackageJsonInfo(fileName) || false);
|
|
102226
|
+
return result || undefined;
|
|
102227
|
+
}
|
|
102228
|
+
function affectingLocationsSame(fileName, expected) {
|
|
102229
|
+
var _a;
|
|
102230
|
+
var result = affectingLoationsSameMap.get(fileName);
|
|
102231
|
+
if (result !== undefined)
|
|
102232
|
+
return result;
|
|
102233
|
+
var packageJsonInfo = getPackageJsonInfo(fileName);
|
|
102234
|
+
var currentText = typeof packageJsonInfo === "object" ? packageJsonInfo.packageJsonText : undefined;
|
|
102235
|
+
if (ts.isString(expected)) {
|
|
102236
|
+
result = !!currentText && ((_a = host.createHash) !== null && _a !== void 0 ? _a : ts.generateDjb2Hash)(currentText) === expected;
|
|
102237
|
+
}
|
|
102238
|
+
else {
|
|
102239
|
+
var expectedText = typeof expected === "object" ? expected.packageJsonText : undefined;
|
|
102240
|
+
result = currentText === expectedText;
|
|
102241
|
+
}
|
|
102242
|
+
affectingLoationsSameMap.set(fileName, result);
|
|
102243
|
+
return result;
|
|
102244
|
+
}
|
|
102245
|
+
function getPackageJsonScope(dirPath) {
|
|
102246
|
+
var _a;
|
|
102247
|
+
var fromCache = (_a = cacheResolutions === null || cacheResolutions === void 0 ? void 0 : cacheResolutions.dirToPackageJsonScope) === null || _a === void 0 ? void 0 : _a.get(dirPath);
|
|
102248
|
+
if (fromCache) {
|
|
102249
|
+
var packageJson = ts.getPackageJsconLocationFromScope(fromCache);
|
|
102250
|
+
var result = packageJsonScopes === null || packageJsonScopes === void 0 ? void 0 : packageJsonScopes.get(packageJson);
|
|
102251
|
+
if (result === undefined) {
|
|
102252
|
+
(packageJsonScopes !== null && packageJsonScopes !== void 0 ? packageJsonScopes : (packageJsonScopes = new ts.Map())).set(packageJson, result = affectingLocationsSame(packageJson, fromCache.info) ?
|
|
102253
|
+
fromCache :
|
|
102254
|
+
fileExists(packageJson) ?
|
|
102255
|
+
{ info: getPackageJsonInfo(packageJson), affectingLocations: [packageJson] } :
|
|
102256
|
+
false);
|
|
102257
|
+
}
|
|
102258
|
+
return result || undefined;
|
|
102259
|
+
}
|
|
102260
|
+
if (!(resuableCacheResolutions === null || resuableCacheResolutions === void 0 ? void 0 : resuableCacheResolutions.cache.packageJsons))
|
|
102261
|
+
return;
|
|
102262
|
+
if (!decodedPackageJsonMap) {
|
|
102263
|
+
decodedPackageJsonMap = new ts.Map();
|
|
102264
|
+
var filePathDecoder_1 = resuableCacheResolutions.getProgramBuildInfoFilePathDecoder();
|
|
102265
|
+
for (var _i = 0, _b = resuableCacheResolutions.cache.packageJsons; _i < _b.length; _i++) {
|
|
102266
|
+
var dirIdOrDirAndPackageJson = _b[_i];
|
|
102267
|
+
var dirPath_1 = filePathDecoder_1.toFilePath(dirIdOrDirAndPackageJson[0]);
|
|
102268
|
+
var packageJson = filePathDecoder_1.toFileAbsolutePath(dirIdOrDirAndPackageJson[1]);
|
|
102269
|
+
ts.moduleNameToDirectorySet(decodedPackageJsonMap, dirPath_1, packageJson, ts.identity, function (fileName) { return ts.toPath(fileName, filePathDecoder_1.currentDirectory, filePathDecoder_1.getCanonicalFileName); }, ts.noop);
|
|
102270
|
+
}
|
|
102271
|
+
}
|
|
102272
|
+
return toPackageJsonScope(decodedPackageJsonMap.get(dirPath));
|
|
102273
|
+
}
|
|
102274
|
+
function toPackageJsonScope(file) {
|
|
102275
|
+
if (!file)
|
|
102276
|
+
return undefined;
|
|
102277
|
+
var result = packageJsonScopes === null || packageJsonScopes === void 0 ? void 0 : packageJsonScopes.get(file);
|
|
102278
|
+
if (result !== undefined)
|
|
102279
|
+
return result || undefined;
|
|
102280
|
+
(packageJsonScopes !== null && packageJsonScopes !== void 0 ? packageJsonScopes : (packageJsonScopes = new ts.Map()));
|
|
102281
|
+
if (fileExists(file)) {
|
|
102282
|
+
result = {
|
|
102283
|
+
info: getPackageJsonInfo(file),
|
|
102284
|
+
affectingLocations: [file]
|
|
102285
|
+
};
|
|
102286
|
+
}
|
|
102287
|
+
packageJsonScopes.set(file, result || false);
|
|
102288
|
+
return result;
|
|
102289
|
+
}
|
|
102290
|
+
function getResolvedFromCache(cache, reusableCache, decodedReusableCache, dirPath, name, mode, redirectedReference, moduleNameToDirectoryMap, decodedModuleNameToDirectoryMap) {
|
|
102291
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
102292
|
+
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)) ||
|
|
102293
|
+
((_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));
|
|
102294
|
+
if (fromCache) {
|
|
102295
|
+
return fileExists(((_e = fromCache.resolvedModule) === null || _e === void 0 ? void 0 : _e.resolvedFileName) ||
|
|
102296
|
+
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;
|
|
102297
|
+
}
|
|
102298
|
+
if (!reusableCache)
|
|
102299
|
+
return undefined;
|
|
102300
|
+
if (!decodedReusableCache.getOwnMap().size && !decodedReusableCache.redirectsKeyToCache.size) {
|
|
102301
|
+
if (ts.isArray(reusableCache)) {
|
|
102302
|
+
setBuildInfoResolutionEntries(decodedReusableCache, compilerOptions, undefined, reusableCache, decodedModuleNameToDirectoryMap);
|
|
102303
|
+
}
|
|
102304
|
+
else {
|
|
102305
|
+
if (reusableCache.own)
|
|
102306
|
+
setBuildInfoResolutionEntries(decodedReusableCache, compilerOptions, undefined, reusableCache.own, decodedModuleNameToDirectoryMap);
|
|
102307
|
+
reusableCache.redirects.forEach(function (_a) {
|
|
102308
|
+
var options = _a.options, cache = _a.cache;
|
|
102309
|
+
var compilerOptions = options ? ts.convertToOptionsWithAbsolutePaths(options, resuableCacheResolutions.getProgramBuildInfoFilePathDecoder().toAbsolutePath) : {};
|
|
102310
|
+
setBuildInfoResolutionEntries(decodedReusableCache, compilerOptions, ts.getRedirectsCacheKey(compilerOptions), cache, decodedModuleNameToDirectoryMap);
|
|
102311
|
+
});
|
|
102312
|
+
}
|
|
102313
|
+
decodedReusableCache.clearRedirectsMap();
|
|
102314
|
+
decodedModuleNameToDirectoryMap === null || decodedModuleNameToDirectoryMap === void 0 ? void 0 : decodedModuleNameToDirectoryMap.clearRedirectsMap();
|
|
102315
|
+
}
|
|
102316
|
+
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)) ||
|
|
102317
|
+
((_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));
|
|
102318
|
+
return resolutionId ? toResolution(resolutionId) : undefined;
|
|
102319
|
+
}
|
|
102320
|
+
function setBuildInfoResolutionEntries(decodedReusableCache, options, optionsKey, reusableCache, decodedModuleNameToDirectoryMap) {
|
|
102321
|
+
var map = decodedReusableCache.createMapForCompilerOptions(options, optionsKey);
|
|
102322
|
+
reusableCache.forEach(function (_a) {
|
|
102323
|
+
var dirId = _a[0], entryId = _a[1];
|
|
102324
|
+
var dirPath = resuableCacheResolutions.getProgramBuildInfoFilePathDecoder().toFilePath(dirId);
|
|
102325
|
+
map.set(dirPath, toModeAwareCache(entryId, dirPath, options, optionsKey, decodedModuleNameToDirectoryMap));
|
|
102326
|
+
});
|
|
102327
|
+
}
|
|
102328
|
+
function toModeAwareCache(entries, dirPath, options, optionsKey, decodedModuleNameToDirectoryMap) {
|
|
102329
|
+
var modeAwareCache = ts.createModeAwareCache();
|
|
102330
|
+
entries.forEach(function (entryId) {
|
|
102331
|
+
var _a = toResolutionEntry(entryId), name = _a[0], resolutionId = _a[1], mode = _a[2];
|
|
102332
|
+
modeAwareCache.set(name, mode, resolutionId);
|
|
102333
|
+
if (!decodedModuleNameToDirectoryMap || ts.isExternalModuleNameRelative(name))
|
|
102334
|
+
return;
|
|
102335
|
+
var mapForOptions = decodedModuleNameToDirectoryMap.createMapForCompilerOptions(options, optionsKey);
|
|
102336
|
+
var key = ts.getModeAwareCacheKey(name, mode);
|
|
102337
|
+
var moduleNameMap = mapForOptions.get(key);
|
|
102338
|
+
;
|
|
102339
|
+
if (!moduleNameMap)
|
|
102340
|
+
mapForOptions.set(key, moduleNameMap = new ts.Map());
|
|
102341
|
+
ts.moduleNameToDirectorySet(moduleNameMap, dirPath, resolutionId, toOriginalPathOrResolvedFileName, function (fileName) { return ts.toPath(fileName, resuableCacheResolutions.getProgramBuildInfoFilePathDecoder().currentDirectory, resuableCacheResolutions.getProgramBuildInfoFilePathDecoder().getCanonicalFileName); }, ts.noop);
|
|
102342
|
+
});
|
|
102343
|
+
return modeAwareCache;
|
|
102344
|
+
}
|
|
102345
|
+
function toResolutionEntry(entryId) {
|
|
102346
|
+
var existing = resolutionEntries === null || resolutionEntries === void 0 ? void 0 : resolutionEntries[entryId - 1];
|
|
102347
|
+
if (existing)
|
|
102348
|
+
return existing;
|
|
102349
|
+
resolutionEntries !== null && resolutionEntries !== void 0 ? resolutionEntries : (resolutionEntries = new Array(resuableCacheResolutions.cache.resolutionEntries.length));
|
|
102350
|
+
var _a = resuableCacheResolutions.cache.resolutionEntries[entryId - 1], nameId = _a[0], resolutionId = _a[1], mode = _a[2];
|
|
102351
|
+
return resolutionEntries[entryId - 1] = [
|
|
102352
|
+
toName(nameId),
|
|
102353
|
+
resolutionId,
|
|
102354
|
+
mode
|
|
102355
|
+
];
|
|
102356
|
+
}
|
|
102357
|
+
function toName(nameId) {
|
|
102358
|
+
return resuableCacheResolutions.cache.names[nameId - 1];
|
|
102359
|
+
}
|
|
102360
|
+
function toOriginalPathOrResolvedFileName(resolutionId) {
|
|
102361
|
+
var _a;
|
|
102362
|
+
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 ||
|
|
102363
|
+
resuableCacheResolutions.cache.resolutions[resolutionId - 1].resolvedModule.resolvedFileName));
|
|
102364
|
+
}
|
|
102365
|
+
function toAffectingFileLocation(fileId) {
|
|
102366
|
+
if (!decodedHashes && resuableCacheResolutions.cache.hash) {
|
|
102367
|
+
decodedHashes = ts.arrayToMap(resuableCacheResolutions.cache.hash, function (hash) { return ts.isArray(hash) ? hash[0] : hash; }, function (hash) { return ts.isArray(hash) ? hash[1] : undefined; });
|
|
102368
|
+
}
|
|
102369
|
+
var hash = decodedHashes === null || decodedHashes === void 0 ? void 0 : decodedHashes.get(fileId);
|
|
102370
|
+
var file = resuableCacheResolutions.getProgramBuildInfoFilePathDecoder().toFileAbsolutePath(fileId);
|
|
102371
|
+
return affectingLocationsSame(file, hash) ? file : undefined;
|
|
102372
|
+
}
|
|
102373
|
+
function toResolution(resolutionId) {
|
|
102374
|
+
var _a, _b;
|
|
102375
|
+
var existing = resolutions === null || resolutions === void 0 ? void 0 : resolutions[resolutionId - 1];
|
|
102376
|
+
if (existing !== undefined)
|
|
102377
|
+
return existing || undefined;
|
|
102378
|
+
resolutions !== null && resolutions !== void 0 ? resolutions : (resolutions = new Array(resuableCacheResolutions.cache.resolutions.length));
|
|
102379
|
+
var resolution = resuableCacheResolutions.cache.resolutions[resolutionId - 1];
|
|
102380
|
+
var resolvedFileName = resuableCacheResolutions.getProgramBuildInfoFilePathDecoder().toFileAbsolutePath(((_a = resolution.resolvedModule) === null || _a === void 0 ? void 0 : _a.resolvedFileName) || resolution.resolvedTypeReferenceDirective.resolvedFileName);
|
|
102381
|
+
var affectingLocations;
|
|
102382
|
+
if (fileExists(resolvedFileName) && ts.every(resolution.affectingLocations, function (fileId) {
|
|
102383
|
+
var file = toAffectingFileLocation(fileId);
|
|
102384
|
+
if (file)
|
|
102385
|
+
(affectingLocations !== null && affectingLocations !== void 0 ? affectingLocations : (affectingLocations = [])).push(file);
|
|
102386
|
+
return !!file;
|
|
102387
|
+
})) {
|
|
102388
|
+
var extenstion = resolution.resolvedModule ? ts.extensionFromPath(resolvedFileName) : undefined;
|
|
102389
|
+
return resolutions[resolutionId - 1] = {
|
|
102390
|
+
resolvedModule: toResolved(resolution.resolvedModule, resolvedFileName, extenstion),
|
|
102391
|
+
resolvedTypeReferenceDirective: toResolved(resolution.resolvedTypeReferenceDirective, resolvedFileName, extenstion),
|
|
102392
|
+
failedLookupLocations: ts.emptyArray,
|
|
102393
|
+
affectingLocations: affectingLocations,
|
|
102394
|
+
resolutionDiagnostics: (_b = resolution.resolutionDiagnostics) === null || _b === void 0 ? void 0 : _b.map(toResolutionDiagnostic)
|
|
102395
|
+
};
|
|
102396
|
+
}
|
|
102397
|
+
resolutions[resolutionId - 1] = false;
|
|
102398
|
+
return undefined;
|
|
102399
|
+
}
|
|
102400
|
+
function toResolved(resolved, resolvedFileName, extension) {
|
|
102401
|
+
if (!resolved)
|
|
102402
|
+
return undefined;
|
|
102403
|
+
return __assign(__assign({}, resolved), { resolvedFileName: resolvedFileName, originalPath: resolved.originalPath ? resuableCacheResolutions.getProgramBuildInfoFilePathDecoder().toFileAbsolutePath(resolved.originalPath) : undefined, extension: extension });
|
|
102404
|
+
}
|
|
102405
|
+
function toResolutionDiagnostic(d) {
|
|
102406
|
+
return {
|
|
102407
|
+
isImports: !!d.isImports,
|
|
102408
|
+
entry: d.entry || "",
|
|
102409
|
+
packagePath: resuableCacheResolutions.getProgramBuildInfoFilePathDecoder().toFileAbsolutePath(d.packagePath)
|
|
102410
|
+
};
|
|
102411
|
+
}
|
|
102412
|
+
}
|
|
102413
|
+
ts.createOldBuildInfoProgram = createOldBuildInfoProgram;
|
|
101589
102414
|
function getBuildInfoFileVersionMap(program, buildInfoPath, host) {
|
|
101590
102415
|
var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
|
|
101591
102416
|
var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
|
|
@@ -101605,6 +102430,7 @@ var ts;
|
|
|
101605
102430
|
restoreEmitState: ts.noop,
|
|
101606
102431
|
getProgram: getProgram,
|
|
101607
102432
|
getProgramOrUndefined: function () { return getState().program; },
|
|
102433
|
+
getProgramOrOldBuildInfoProgramUndefined: function () { return getState().program; },
|
|
101608
102434
|
releaseProgram: function () { return getState().program = undefined; },
|
|
101609
102435
|
getCompilerOptions: function () { return getState().compilerOptions; },
|
|
101610
102436
|
getSourceFile: function (fileName) { return getProgram().getSourceFile(fileName); },
|
|
@@ -101687,15 +102513,57 @@ var ts;
|
|
|
101687
102513
|
return true;
|
|
101688
102514
|
}
|
|
101689
102515
|
ts.canWatchDirectoryOrFile = canWatchDirectoryOrFile;
|
|
102516
|
+
function getResolvedModuleOfResolution(resolution) {
|
|
102517
|
+
return resolution.resolvedModule;
|
|
102518
|
+
}
|
|
102519
|
+
ts.getResolvedModuleOfResolution = getResolvedModuleOfResolution;
|
|
102520
|
+
function getResolvedTypeReferenceDirectiveOfResolution(resolution) {
|
|
102521
|
+
return resolution.resolvedTypeReferenceDirective;
|
|
102522
|
+
}
|
|
102523
|
+
ts.getResolvedTypeReferenceDirectiveOfResolution = getResolvedTypeReferenceDirectiveOfResolution;
|
|
102524
|
+
function toPerDirectoryResolution(newProgram, fileCacheFromProgram, sourceFileOrPath, perDirCache, moduleNameToDirectoryMap, onRedirectedReferenceKey, forEachResolution, toPath, ancestoryWorker) {
|
|
102525
|
+
if (!(fileCacheFromProgram === null || fileCacheFromProgram === void 0 ? void 0 : fileCacheFromProgram.size()))
|
|
102526
|
+
return perDirCache;
|
|
102527
|
+
var path = !ts.isString(sourceFileOrPath) ? sourceFileOrPath.path : sourceFileOrPath;
|
|
102528
|
+
var redirectedReference = !ts.isString(sourceFileOrPath) ? newProgram.getRedirectReferenceForResolution(sourceFileOrPath) : undefined;
|
|
102529
|
+
var options = (redirectedReference === null || redirectedReference === void 0 ? void 0 : redirectedReference.commandLine.options) || newProgram.getCompilerOptions();
|
|
102530
|
+
var key = ts.getRedirectsCacheKey(options);
|
|
102531
|
+
onRedirectedReferenceKey(key);
|
|
102532
|
+
var dirPath = ts.getDirectoryPath(path);
|
|
102533
|
+
var perDirResolutionCache = perDirCache === null || perDirCache === void 0 ? void 0 : perDirCache.getMapOfCacheRedirects(redirectedReference);
|
|
102534
|
+
var cacheForDir = perDirResolutionCache === null || perDirResolutionCache === void 0 ? void 0 : perDirResolutionCache.get(dirPath);
|
|
102535
|
+
fileCacheFromProgram.forEach(function (r, name, mode) {
|
|
102536
|
+
if (forEachResolution(r, name, mode, key, redirectedReference, dirPath))
|
|
102537
|
+
return;
|
|
102538
|
+
if (cacheForDir === null || cacheForDir === void 0 ? void 0 : cacheForDir.has(name, mode))
|
|
102539
|
+
return;
|
|
102540
|
+
if (!cacheForDir) {
|
|
102541
|
+
perDirResolutionCache !== null && perDirResolutionCache !== void 0 ? perDirResolutionCache : (perDirResolutionCache = (perDirCache !== null && perDirCache !== void 0 ? perDirCache : (perDirCache = ts.createCacheWithRedirects(newProgram.getCompilerOptions()))).createMapForCompilerOptions(options, key));
|
|
102542
|
+
perDirResolutionCache.set(dirPath, cacheForDir = ts.createModeAwareCache());
|
|
102543
|
+
}
|
|
102544
|
+
cacheForDir.set(name, mode, r);
|
|
102545
|
+
if (!moduleNameToDirectoryMap || ts.isExternalModuleNameRelative(name))
|
|
102546
|
+
return;
|
|
102547
|
+
var actualModuleNameToDirectoryMap = moduleNameToDirectoryMap.createMapForCompilerOptions(options, key);
|
|
102548
|
+
var modeAwareCacheKey = ts.getModeAwareCacheKey(name, mode);
|
|
102549
|
+
var directoryPathMap = actualModuleNameToDirectoryMap.get(modeAwareCacheKey);
|
|
102550
|
+
if (!directoryPathMap)
|
|
102551
|
+
actualModuleNameToDirectoryMap.set(modeAwareCacheKey, directoryPathMap = new ts.Map());
|
|
102552
|
+
ts.moduleNameToDirectorySet(directoryPathMap, dirPath, r, ts.getResolvedFileNameForModuleNameToDirectorySet, toPath, function (ancestorPath) { return ancestoryWorker(ancestorPath, name, mode, perDirResolutionCache); });
|
|
102553
|
+
});
|
|
102554
|
+
return perDirCache;
|
|
102555
|
+
}
|
|
102556
|
+
ts.toPerDirectoryResolution = toPerDirectoryResolution;
|
|
101690
102557
|
function createResolutionCache(resolutionHost, rootDirForResolution, logChangesWhenResolvingModule) {
|
|
101691
102558
|
var filesWithChangedSetOfUnresolvedImports;
|
|
101692
102559
|
var filesWithInvalidatedResolutions;
|
|
101693
|
-
var filesWithInvalidatedNonRelativeUnresolvedImports;
|
|
101694
|
-
var nonRelativeExternalModuleResolutions = ts.createMultiMap();
|
|
101695
102560
|
var resolutionsWithFailedLookups = [];
|
|
101696
102561
|
var resolutionsWithOnlyAffectingLocations = [];
|
|
101697
102562
|
var resolvedFileToResolution = ts.createMultiMap();
|
|
101698
|
-
var
|
|
102563
|
+
var perFilePackageJsonScope = new ts.Map();
|
|
102564
|
+
var watchedPackageJsonScopes = [];
|
|
102565
|
+
var packageJsonsToCloseWatcherOn;
|
|
102566
|
+
var resolutionsToCloseWatcherOn;
|
|
101699
102567
|
var hasChangedAutomaticTypeDirectiveNames = false;
|
|
101700
102568
|
var affectingPathChecksForFile;
|
|
101701
102569
|
var affectingPathChecks;
|
|
@@ -101704,13 +102572,12 @@ var ts;
|
|
|
101704
102572
|
var isInDirectoryChecks;
|
|
101705
102573
|
var getCurrentDirectory = ts.memoize(function () { return resolutionHost.getCurrentDirectory(); });
|
|
101706
102574
|
var cachedDirectoryStructureHost = resolutionHost.getCachedDirectoryStructureHost();
|
|
102575
|
+
var oldModuleAndTypeRefCache;
|
|
102576
|
+
var oldPackageJsonInfoCache;
|
|
101707
102577
|
var resolvedModuleNames = new ts.Map();
|
|
101708
|
-
var
|
|
101709
|
-
var nonRelativeModuleNameCache = ts.createCacheWithRedirects();
|
|
101710
|
-
var moduleResolutionCache = ts.createModuleResolutionCache(getCurrentDirectory(), resolutionHost.getCanonicalFileName, undefined, perDirectoryResolvedModuleNames, nonRelativeModuleNameCache);
|
|
102578
|
+
var moduleResolutionCache = ts.createModuleResolutionCache(getCurrentDirectory(), resolutionHost.getCanonicalFileName);
|
|
101711
102579
|
var resolvedTypeReferenceDirectives = new ts.Map();
|
|
101712
|
-
var
|
|
101713
|
-
var typeReferenceDirectiveResolutionCache = ts.createTypeReferenceDirectiveResolutionCache(getCurrentDirectory(), resolutionHost.getCanonicalFileName, undefined, moduleResolutionCache.getPackageJsonInfoCache(), perDirectoryResolvedTypeReferenceDirectives);
|
|
102580
|
+
var typeReferenceDirectiveResolutionCache = ts.createTypeReferenceDirectiveResolutionCache(getCurrentDirectory(), resolutionHost.getCanonicalFileName, undefined, moduleResolutionCache.getPackageJsonInfoCache());
|
|
101714
102581
|
var failedLookupDefaultExtensions = [".ts", ".tsx", ".js", ".jsx", ".json"];
|
|
101715
102582
|
var customFailedLookupPaths = new ts.Map();
|
|
101716
102583
|
var directoryWatchesOfFailedLookups = new ts.Map();
|
|
@@ -101720,32 +102587,23 @@ var ts;
|
|
|
101720
102587
|
var rootSplitLength = rootPath !== undefined ? rootPath.split(ts.directorySeparator).length : 0;
|
|
101721
102588
|
var typeRootsWatches = new ts.Map();
|
|
101722
102589
|
return {
|
|
102590
|
+
resolvedModuleNames: resolvedModuleNames,
|
|
102591
|
+
resolvedTypeReferenceDirectives: resolvedTypeReferenceDirectives,
|
|
101723
102592
|
getModuleResolutionCache: function () { return moduleResolutionCache; },
|
|
102593
|
+
getTypeReferenceDirectiveResolutionCache: function () { return typeReferenceDirectiveResolutionCache; },
|
|
101724
102594
|
startRecordingFilesWithChangedResolutions: startRecordingFilesWithChangedResolutions,
|
|
101725
102595
|
finishRecordingFilesWithChangedResolutions: finishRecordingFilesWithChangedResolutions,
|
|
101726
102596
|
startCachingPerDirectoryResolution: startCachingPerDirectoryResolution,
|
|
101727
102597
|
finishCachingPerDirectoryResolution: finishCachingPerDirectoryResolution,
|
|
101728
102598
|
resolveModuleNames: resolveModuleNames,
|
|
101729
|
-
getResolvedModuleWithFailedLookupLocationsFromCache: getResolvedModuleWithFailedLookupLocationsFromCache,
|
|
101730
102599
|
resolveTypeReferenceDirectives: resolveTypeReferenceDirectives,
|
|
101731
|
-
removeResolutionsFromProjectReferenceRedirects: removeResolutionsFromProjectReferenceRedirects,
|
|
101732
|
-
removeResolutionsOfFile: removeResolutionsOfFile,
|
|
101733
102600
|
hasChangedAutomaticTypeDirectiveNames: function () { return hasChangedAutomaticTypeDirectiveNames; },
|
|
101734
102601
|
invalidateResolutionOfFile: invalidateResolutionOfFile,
|
|
101735
102602
|
invalidateResolutionsOfFailedLookupLocations: invalidateResolutionsOfFailedLookupLocations,
|
|
101736
102603
|
setFilesWithInvalidatedNonRelativeUnresolvedImports: setFilesWithInvalidatedNonRelativeUnresolvedImports,
|
|
101737
102604
|
createHasInvalidatedResolution: createHasInvalidatedResolution,
|
|
101738
|
-
isFileWithInvalidatedNonRelativeUnresolvedImports: isFileWithInvalidatedNonRelativeUnresolvedImports,
|
|
101739
|
-
updateTypeRootsWatch: updateTypeRootsWatch,
|
|
101740
|
-
closeTypeRootsWatch: closeTypeRootsWatch,
|
|
101741
102605
|
clear: clear
|
|
101742
102606
|
};
|
|
101743
|
-
function getResolvedModule(resolution) {
|
|
101744
|
-
return resolution.resolvedModule;
|
|
101745
|
-
}
|
|
101746
|
-
function getResolvedTypeReferenceDirective(resolution) {
|
|
101747
|
-
return resolution.resolvedTypeReferenceDirective;
|
|
101748
|
-
}
|
|
101749
102607
|
function isInDirectoryPath(dir, file) {
|
|
101750
102608
|
if (dir === undefined || file.length <= dir.length) {
|
|
101751
102609
|
return false;
|
|
@@ -101756,21 +102614,25 @@ var ts;
|
|
|
101756
102614
|
ts.clearMap(directoryWatchesOfFailedLookups, ts.closeFileWatcherOf);
|
|
101757
102615
|
ts.clearMap(fileWatchesOfAffectingLocations, ts.closeFileWatcherOf);
|
|
101758
102616
|
customFailedLookupPaths.clear();
|
|
101759
|
-
nonRelativeExternalModuleResolutions.clear();
|
|
101760
102617
|
closeTypeRootsWatch();
|
|
101761
102618
|
resolvedModuleNames.clear();
|
|
101762
102619
|
resolvedTypeReferenceDirectives.clear();
|
|
101763
102620
|
resolvedFileToResolution.clear();
|
|
101764
102621
|
resolutionsWithFailedLookups.length = 0;
|
|
101765
102622
|
resolutionsWithOnlyAffectingLocations.length = 0;
|
|
102623
|
+
watchedPackageJsonScopes.length = 0;
|
|
101766
102624
|
failedLookupChecks = undefined;
|
|
101767
102625
|
startsWithPathChecks = undefined;
|
|
101768
102626
|
isInDirectoryChecks = undefined;
|
|
101769
102627
|
affectingPathChecks = undefined;
|
|
101770
102628
|
affectingPathChecksForFile = undefined;
|
|
102629
|
+
resolutionsToCloseWatcherOn = undefined;
|
|
102630
|
+
packageJsonsToCloseWatcherOn = undefined;
|
|
102631
|
+
oldModuleAndTypeRefCache = undefined;
|
|
102632
|
+
oldPackageJsonInfoCache = undefined;
|
|
101771
102633
|
moduleResolutionCache.clear();
|
|
101772
102634
|
typeReferenceDirectiveResolutionCache.clear();
|
|
101773
|
-
|
|
102635
|
+
perFilePackageJsonScope.clear();
|
|
101774
102636
|
hasChangedAutomaticTypeDirectiveNames = false;
|
|
101775
102637
|
}
|
|
101776
102638
|
function startRecordingFilesWithChangedResolutions() {
|
|
@@ -101781,13 +102643,6 @@ var ts;
|
|
|
101781
102643
|
filesWithChangedSetOfUnresolvedImports = undefined;
|
|
101782
102644
|
return collected;
|
|
101783
102645
|
}
|
|
101784
|
-
function isFileWithInvalidatedNonRelativeUnresolvedImports(path) {
|
|
101785
|
-
if (!filesWithInvalidatedNonRelativeUnresolvedImports) {
|
|
101786
|
-
return false;
|
|
101787
|
-
}
|
|
101788
|
-
var value = filesWithInvalidatedNonRelativeUnresolvedImports.get(path);
|
|
101789
|
-
return !!value && !!value.length;
|
|
101790
|
-
}
|
|
101791
102646
|
function createHasInvalidatedResolution(forceAllFilesAsInvalidated) {
|
|
101792
102647
|
invalidateResolutionsOfFailedLookupLocations();
|
|
101793
102648
|
if (forceAllFilesAsInvalidated) {
|
|
@@ -101796,71 +102651,239 @@ var ts;
|
|
|
101796
102651
|
}
|
|
101797
102652
|
var collected = filesWithInvalidatedResolutions;
|
|
101798
102653
|
filesWithInvalidatedResolutions = undefined;
|
|
101799
|
-
return function (path) { return (
|
|
101800
|
-
isFileWithInvalidatedNonRelativeUnresolvedImports(path); };
|
|
102654
|
+
return function (path) { return !!(collected === null || collected === void 0 ? void 0 : collected.has(path)); };
|
|
101801
102655
|
}
|
|
101802
102656
|
function startCachingPerDirectoryResolution() {
|
|
101803
|
-
moduleResolutionCache.
|
|
101804
|
-
|
|
101805
|
-
|
|
101806
|
-
|
|
102657
|
+
var packageJsonInfoCache = moduleResolutionCache.getPackageJsonInfoCache();
|
|
102658
|
+
var internalCache = packageJsonInfoCache.getInternalMap();
|
|
102659
|
+
moduleResolutionCache.clear();
|
|
102660
|
+
typeReferenceDirectiveResolutionCache.clear();
|
|
102661
|
+
moduleResolutionCache.update(resolutionHost.getCompilationSettings());
|
|
102662
|
+
typeReferenceDirectiveResolutionCache.update(resolutionHost.getCompilationSettings());
|
|
102663
|
+
if (oldModuleAndTypeRefCache) {
|
|
102664
|
+
oldModuleAndTypeRefCache.clearRedirectsMap();
|
|
102665
|
+
moduleResolutionCache.setOldResolutionCache(oldModuleAndTypeRefCache.modules);
|
|
102666
|
+
typeReferenceDirectiveResolutionCache.setOldResolutionCache(oldModuleAndTypeRefCache.typeRefs);
|
|
102667
|
+
}
|
|
102668
|
+
packageJsonInfoCache.setInternalMap(internalCache);
|
|
102669
|
+
packageJsonInfoCache.setOldPackageJsonScopeCache(oldPackageJsonInfoCache);
|
|
101807
102670
|
}
|
|
101808
102671
|
function finishCachingPerDirectoryResolution(newProgram, oldProgram) {
|
|
101809
|
-
|
|
101810
|
-
|
|
101811
|
-
|
|
101812
|
-
|
|
101813
|
-
|
|
101814
|
-
|
|
101815
|
-
|
|
101816
|
-
|
|
101817
|
-
|
|
101818
|
-
|
|
102672
|
+
hasChangedAutomaticTypeDirectiveNames = false;
|
|
102673
|
+
if (!newProgram) {
|
|
102674
|
+
clear();
|
|
102675
|
+
return;
|
|
102676
|
+
}
|
|
102677
|
+
if (newProgram === oldProgram)
|
|
102678
|
+
return;
|
|
102679
|
+
var needsResolutionUpdate = newProgram.structureIsReused !== 3;
|
|
102680
|
+
var modules;
|
|
102681
|
+
var typeRefs;
|
|
102682
|
+
var moduleNameToDirectoryMap = ts.createCacheWithRedirects(newProgram.getCompilerOptions());
|
|
102683
|
+
var dirToPackageJsonScope = new ts.Map();
|
|
102684
|
+
for (var _i = 0, _a = newProgram.getSourceFiles(); _i < _a.length; _i++) {
|
|
102685
|
+
var newFile = _a[_i];
|
|
102686
|
+
if (needsResolutionUpdate) {
|
|
102687
|
+
modules = ensureResolutionsOfFile(newProgram, resolvedModuleNames, newFile.resolvedModules, newFile, getResolvedModuleOfResolution, modules, moduleNameToDirectoryMap);
|
|
102688
|
+
typeRefs = ensureResolutionsOfFile(newProgram, resolvedTypeReferenceDirectives, newFile.resolvedTypeReferenceDirectiveNames, newFile, getResolvedTypeReferenceDirectiveOfResolution, typeRefs, undefined);
|
|
102689
|
+
}
|
|
102690
|
+
ensurePackageJsonWatchesForFile(newFile, dirToPackageJsonScope);
|
|
102691
|
+
}
|
|
102692
|
+
if (needsResolutionUpdate) {
|
|
102693
|
+
var newProgramAutoTypeRefContainingFile = resolutionHost.toPath(newProgram.getAutomaticTypeDirectiveContainingFile());
|
|
102694
|
+
typeRefs = ensureResolutionsOfFile(newProgram, resolvedTypeReferenceDirectives, newProgram.getAutomaticTypeDirectiveResolutions(), newProgramAutoTypeRefContainingFile, getResolvedTypeReferenceDirectiveOfResolution, typeRefs, undefined);
|
|
102695
|
+
if (!modules && !typeRefs) {
|
|
102696
|
+
oldModuleAndTypeRefCache = undefined;
|
|
102697
|
+
}
|
|
102698
|
+
else {
|
|
102699
|
+
oldModuleAndTypeRefCache = getOldResolutionCache(modules, typeRefs, moduleNameToDirectoryMap);
|
|
102700
|
+
}
|
|
102701
|
+
if (oldProgram) {
|
|
102702
|
+
for (var _b = 0, _c = oldProgram.getSourceFiles(); _b < _c.length; _b++) {
|
|
102703
|
+
var f = _c[_b];
|
|
102704
|
+
if (!newProgram.getSourceFileByPath(f.path))
|
|
102705
|
+
removeResolutionsOfFile(f.path);
|
|
101819
102706
|
}
|
|
101820
|
-
|
|
101821
|
-
|
|
101822
|
-
|
|
101823
|
-
}
|
|
102707
|
+
var oldProgramAutoTypeRefContainingFile = resolutionHost.toPath(oldProgram.getAutomaticTypeDirectiveContainingFile());
|
|
102708
|
+
if (oldProgramAutoTypeRefContainingFile !== newProgramAutoTypeRefContainingFile) {
|
|
102709
|
+
removeResolutionsOfFile(oldProgramAutoTypeRefContainingFile);
|
|
101824
102710
|
}
|
|
101825
|
-
|
|
101826
|
-
impliedFormatPackageJsons.set(newFile.path, newFile.packageJsonLocations);
|
|
101827
|
-
else
|
|
101828
|
-
impliedFormatPackageJsons.delete(newFile.path);
|
|
101829
|
-
});
|
|
101830
|
-
impliedFormatPackageJsons.forEach(function (existing, path) {
|
|
101831
|
-
if (!(newProgram === null || newProgram === void 0 ? void 0 : newProgram.getSourceFileByPath(path))) {
|
|
101832
|
-
existing.forEach(function (location) { return fileWatchesOfAffectingLocations.get(location).files--; });
|
|
101833
|
-
impliedFormatPackageJsons.delete(path);
|
|
101834
|
-
}
|
|
101835
|
-
});
|
|
102711
|
+
}
|
|
101836
102712
|
}
|
|
101837
|
-
|
|
101838
|
-
if (
|
|
101839
|
-
|
|
101840
|
-
|
|
102713
|
+
perFilePackageJsonScope.forEach(function (existing, path) {
|
|
102714
|
+
if (!(newProgram === null || newProgram === void 0 ? void 0 : newProgram.getSourceFileByPath(path))) {
|
|
102715
|
+
stopWatchingPackageJsonScope(existing, path);
|
|
102716
|
+
perFilePackageJsonScope.delete(path);
|
|
101841
102717
|
}
|
|
101842
102718
|
});
|
|
102719
|
+
if (dirToPackageJsonScope.size) {
|
|
102720
|
+
oldPackageJsonInfoCache = getOldPackageJsonInfoCache(dirToPackageJsonScope);
|
|
102721
|
+
}
|
|
102722
|
+
else {
|
|
102723
|
+
oldPackageJsonInfoCache = undefined;
|
|
102724
|
+
}
|
|
102725
|
+
if (needsResolutionUpdate && (!oldProgram || newProgram.getCompilerOptions() !== oldProgram.getCompilerOptions()))
|
|
102726
|
+
updateTypeRootsWatch();
|
|
102727
|
+
resolutionsToCloseWatcherOn === null || resolutionsToCloseWatcherOn === void 0 ? void 0 : resolutionsToCloseWatcherOn.forEach(closeWatchersOfResolution);
|
|
102728
|
+
resolutionsToCloseWatcherOn = undefined;
|
|
102729
|
+
packageJsonsToCloseWatcherOn === null || packageJsonsToCloseWatcherOn === void 0 ? void 0 : packageJsonsToCloseWatcherOn.forEach(closeWatchersOfPackageJsonScope);
|
|
102730
|
+
packageJsonsToCloseWatcherOn = undefined;
|
|
101843
102731
|
fileWatchesOfAffectingLocations.forEach(function (watcher, path) {
|
|
101844
102732
|
if (watcher.files === 0 && watcher.resolutions === 0) {
|
|
101845
102733
|
fileWatchesOfAffectingLocations.delete(path);
|
|
101846
102734
|
watcher.watcher.close();
|
|
101847
102735
|
}
|
|
101848
102736
|
});
|
|
101849
|
-
hasChangedAutomaticTypeDirectiveNames = false;
|
|
101850
102737
|
}
|
|
101851
|
-
function
|
|
102738
|
+
function ensurePackageJsonWatchesForFile(newFile, dirToPackageJsonScope) {
|
|
102739
|
+
var _a;
|
|
102740
|
+
var existing = perFilePackageJsonScope.get(newFile.path);
|
|
102741
|
+
var scope = ts.isExternalOrCommonJsModule(newFile) ? newFile.packageJsonScope : undefined;
|
|
102742
|
+
if (scope) {
|
|
102743
|
+
((_a = scope.files) !== null && _a !== void 0 ? _a : (scope.files = new ts.Set())).add(newFile.path);
|
|
102744
|
+
watchPackageJsonScopeLocations(scope, scope.failedLookupLocations, "watchedFailed");
|
|
102745
|
+
watchPackageJsonScopeLocations(scope, scope.affectingLocations, "watchedAffected");
|
|
102746
|
+
perFilePackageJsonScope.set(newFile.path, scope);
|
|
102747
|
+
ts.moduleNameToDirectorySet(dirToPackageJsonScope, ts.getDirectoryPath(newFile.resolvedPath), scope, ts.getPackageJsconLocationFromScope, function (dir) { return resolutionHost.toPath(dir); }, ts.noop);
|
|
102748
|
+
}
|
|
102749
|
+
if (existing && scope !== existing)
|
|
102750
|
+
stopWatchingPackageJsonScope(existing, newFile.path);
|
|
102751
|
+
}
|
|
102752
|
+
function stopWatchingPackageJsonScope(scope, path) {
|
|
101852
102753
|
var _a, _b;
|
|
102754
|
+
(_a = scope.files) === null || _a === void 0 ? void 0 : _a.delete(path);
|
|
102755
|
+
if (!((_b = scope.files) === null || _b === void 0 ? void 0 : _b.size))
|
|
102756
|
+
(packageJsonsToCloseWatcherOn !== null && packageJsonsToCloseWatcherOn !== void 0 ? packageJsonsToCloseWatcherOn : (packageJsonsToCloseWatcherOn = [])).push(scope);
|
|
102757
|
+
}
|
|
102758
|
+
function watchPackageJsonScopeLocations(scope, locations, field) {
|
|
102759
|
+
var _a, _b;
|
|
102760
|
+
var locationsLength = (_a = locations === null || locations === void 0 ? void 0 : locations.length) !== null && _a !== void 0 ? _a : 0;
|
|
102761
|
+
if (!locationsLength || scope[field] === locationsLength)
|
|
102762
|
+
return;
|
|
102763
|
+
if (!scope.watchedFailed && !scope.watchedAffected)
|
|
102764
|
+
watchedPackageJsonScopes.push(scope);
|
|
102765
|
+
for (var i = (_b = scope[field]) !== null && _b !== void 0 ? _b : 0; i < locationsLength; i++) {
|
|
102766
|
+
createFileWatcherOfAffectingLocation(locations[i], false);
|
|
102767
|
+
}
|
|
102768
|
+
scope[field] = locationsLength;
|
|
102769
|
+
}
|
|
102770
|
+
function closeWatchersOfPackageJsonScope(scope) {
|
|
102771
|
+
var _a;
|
|
102772
|
+
if (((_a = scope.files) === null || _a === void 0 ? void 0 : _a.size) || !scope.files)
|
|
102773
|
+
return;
|
|
102774
|
+
scope.files = undefined;
|
|
102775
|
+
ts.unorderedRemoveItem(watchedPackageJsonScopes, scope);
|
|
102776
|
+
stopWatchingPackageJsonScopeLocations(scope, scope.failedLookupLocations, "watchedFailed");
|
|
102777
|
+
stopWatchingPackageJsonScopeLocations(scope, scope.affectingLocations, "watchedAffected");
|
|
102778
|
+
}
|
|
102779
|
+
function stopWatchingPackageJsonScopeLocations(scope, locations, field) {
|
|
102780
|
+
if (!scope[field])
|
|
102781
|
+
return;
|
|
102782
|
+
for (var i = 0; i < scope[field]; i++) {
|
|
102783
|
+
fileWatchesOfAffectingLocations.get(locations[i]).files--;
|
|
102784
|
+
}
|
|
102785
|
+
scope[field] = undefined;
|
|
102786
|
+
}
|
|
102787
|
+
function getOldPackageJsonInfoCache(dirToPackageJsonScope) {
|
|
102788
|
+
var packageJsons;
|
|
102789
|
+
return {
|
|
102790
|
+
getPackageJsonScope: function (dir) {
|
|
102791
|
+
var _a;
|
|
102792
|
+
var scope = dirToPackageJsonScope.get(dir);
|
|
102793
|
+
if (!scope)
|
|
102794
|
+
return undefined;
|
|
102795
|
+
if (!scope.isInvalidated)
|
|
102796
|
+
return scope;
|
|
102797
|
+
if (!resolutionHost.getCompilationSettings().cacheResolutions || !scope.info)
|
|
102798
|
+
return undefined;
|
|
102799
|
+
var packageJson = ts.getPackageJsconLocationFromScope(scope);
|
|
102800
|
+
var result = packageJsons === null || packageJsons === void 0 ? void 0 : packageJsons.get(packageJson);
|
|
102801
|
+
if (result !== undefined)
|
|
102802
|
+
return result || undefined;
|
|
102803
|
+
if (resolutionHost.fileExists(packageJson)) {
|
|
102804
|
+
result = {
|
|
102805
|
+
info: ts.getPackageJsonInfo(ts.getDirectoryPath(packageJson), false, ts.getTemporaryModuleResolutionState(moduleResolutionCache.getPackageJsonInfoCache(), ((_a = resolutionHost.getCompilerHost) === null || _a === void 0 ? void 0 : _a.call(resolutionHost)) || resolutionHost, resolutionHost.getCompilationSettings())),
|
|
102806
|
+
affectingLocations: [packageJson],
|
|
102807
|
+
};
|
|
102808
|
+
}
|
|
102809
|
+
(packageJsons !== null && packageJsons !== void 0 ? packageJsons : (packageJsons = new ts.Map())).set(packageJson, result || false);
|
|
102810
|
+
return result;
|
|
102811
|
+
}
|
|
102812
|
+
};
|
|
102813
|
+
}
|
|
102814
|
+
function ensureResolutionsOfFile(newProgram, perFileCache, fileCacheFromProgram, sourceFileOrPath, getResolutionWithResolvedFileName, perDirCache, moduleNameToDirectoryMap) {
|
|
102815
|
+
var path = !ts.isString(sourceFileOrPath) ? sourceFileOrPath.path : sourceFileOrPath;
|
|
102816
|
+
var resolutionsInFile = perFileCache.get(path);
|
|
102817
|
+
var seenNamesInFile = ts.createModeAwareCache();
|
|
102818
|
+
perDirCache = toPerDirectoryResolution(newProgram, fileCacheFromProgram, sourceFileOrPath, perDirCache, moduleNameToDirectoryMap, function (key) {
|
|
102819
|
+
if (resolutionsInFile && resolutionsInFile.key !== key) {
|
|
102820
|
+
resolutionsInFile.cache.forEach(function (r) { return stopWatchingResolution(r, path, getResolutionWithResolvedFileName); });
|
|
102821
|
+
resolutionsInFile = undefined;
|
|
102822
|
+
}
|
|
102823
|
+
}, function (r, name, mode, key) {
|
|
102824
|
+
seenNamesInFile.set(name, mode, true);
|
|
102825
|
+
var existing = resolutionsInFile === null || resolutionsInFile === void 0 ? void 0 : resolutionsInFile.cache.get(name, mode);
|
|
102826
|
+
if (existing && r !== existing)
|
|
102827
|
+
stopWatchingResolution(existing, path, getResolutionWithResolvedFileName);
|
|
102828
|
+
watchResolution(newProgram, name, r, path, getResolutionWithResolvedFileName);
|
|
102829
|
+
if (!resolutionsInFile)
|
|
102830
|
+
perFileCache.set(path, resolutionsInFile = { key: key, cache: ts.createModeAwareCache() });
|
|
102831
|
+
resolutionsInFile.cache.set(name, mode, r);
|
|
102832
|
+
}, function (dir) { return resolutionHost.toPath(dir); }, ts.noop);
|
|
102833
|
+
if (((resolutionsInFile === null || resolutionsInFile === void 0 ? void 0 : resolutionsInFile.cache.size()) || 0) !== seenNamesInFile.size()) {
|
|
102834
|
+
resolutionsInFile.cache.forEach(function (resolution, name, mode) {
|
|
102835
|
+
if (!seenNamesInFile.has(name, mode)) {
|
|
102836
|
+
stopWatchingResolution(resolution, path, getResolutionWithResolvedFileName);
|
|
102837
|
+
resolutionsInFile.cache.delete(name, mode);
|
|
102838
|
+
}
|
|
102839
|
+
});
|
|
102840
|
+
if (!(resolutionsInFile === null || resolutionsInFile === void 0 ? void 0 : resolutionsInFile.cache.size))
|
|
102841
|
+
perFileCache.delete(path);
|
|
102842
|
+
}
|
|
102843
|
+
return perDirCache;
|
|
102844
|
+
}
|
|
102845
|
+
function getOldResolutionCache(modules, typeRefs, moduleNameToDirectoryMap) {
|
|
102846
|
+
if (!modules && !typeRefs)
|
|
102847
|
+
return undefined;
|
|
102848
|
+
return {
|
|
102849
|
+
modules: {
|
|
102850
|
+
getResolved: function (dirPath, name, mode, redirectedReference) { return getResolvedWithOldCache(dirPath, name, mode, redirectedReference, modules, moduleNameToDirectoryMap); }
|
|
102851
|
+
},
|
|
102852
|
+
typeRefs: {
|
|
102853
|
+
getResolved: function (dirPath, name, mode, redirectedReference) { return getResolvedWithOldCache(dirPath, name, mode, redirectedReference, typeRefs, undefined); }
|
|
102854
|
+
},
|
|
102855
|
+
clearRedirectsMap: function () {
|
|
102856
|
+
modules === null || modules === void 0 ? void 0 : modules.clearRedirectsMap();
|
|
102857
|
+
typeRefs === null || typeRefs === void 0 ? void 0 : typeRefs.clearRedirectsMap();
|
|
102858
|
+
moduleNameToDirectoryMap.clearRedirectsMap();
|
|
102859
|
+
},
|
|
102860
|
+
};
|
|
102861
|
+
}
|
|
102862
|
+
function getResolvedWithOldCache(dirPath, name, mode, redirectedReference, perDirCache, moduleNameToDirectoryMap) {
|
|
102863
|
+
var _a, _b, _c, _d;
|
|
102864
|
+
if (!perDirCache)
|
|
102865
|
+
return undefined;
|
|
102866
|
+
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)) ||
|
|
102867
|
+
((_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));
|
|
102868
|
+
return result && !result.isInvalidated ? result : undefined;
|
|
102869
|
+
}
|
|
102870
|
+
function resolveModuleName(moduleName, containingFile, compilerOptions, host, redirectedReference, _containingSourceFile, mode) {
|
|
102871
|
+
var _a;
|
|
101853
102872
|
var primaryResult = ts.resolveModuleName(moduleName, containingFile, compilerOptions, host, moduleResolutionCache, redirectedReference, mode);
|
|
101854
102873
|
if (!resolutionHost.getGlobalCache) {
|
|
101855
102874
|
return primaryResult;
|
|
101856
102875
|
}
|
|
101857
102876
|
var globalCache = resolutionHost.getGlobalCache();
|
|
101858
102877
|
if (globalCache !== undefined && !ts.isExternalModuleNameRelative(moduleName) && !(primaryResult.resolvedModule && ts.extensionIsTS(primaryResult.resolvedModule.extension))) {
|
|
101859
|
-
var
|
|
102878
|
+
var _b = ts.loadModuleFromGlobalCache(ts.Debug.checkDefined(resolutionHost.globalCacheResolutionModuleName)(moduleName), resolutionHost.projectName, compilerOptions, host, globalCache, moduleResolutionCache), resolvedModule = _b.resolvedModule, failedLookupLocations = _b.failedLookupLocations, affectingLocations = _b.affectingLocations, resolutionDiagnostics = _b.resolutionDiagnostics;
|
|
101860
102879
|
if (resolvedModule) {
|
|
101861
102880
|
primaryResult.resolvedModule = resolvedModule;
|
|
101862
|
-
(
|
|
101863
|
-
|
|
102881
|
+
if (!compilerOptions.cacheResolutions)
|
|
102882
|
+
(_a = primaryResult.failedLookupLocations).push.apply(_a, failedLookupLocations);
|
|
102883
|
+
else
|
|
102884
|
+
primaryResult.failedLookupLocations.length = 0;
|
|
102885
|
+
primaryResult.affectingLocations = ts.updateResolutionField(primaryResult.affectingLocations, affectingLocations);
|
|
102886
|
+
primaryResult.resolutionDiagnostics = ts.updateResolutionField(primaryResult.resolutionDiagnostics, resolutionDiagnostics);
|
|
101864
102887
|
return primaryResult;
|
|
101865
102888
|
}
|
|
101866
102889
|
}
|
|
@@ -101870,68 +102893,35 @@ var ts;
|
|
|
101870
102893
|
return ts.resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host, redirectedReference, typeReferenceDirectiveResolutionCache, resolutionMode);
|
|
101871
102894
|
}
|
|
101872
102895
|
function resolveNamesWithLocalCache(_a) {
|
|
101873
|
-
var _b, _c, _d;
|
|
101874
|
-
var names = _a.names, containingFile = _a.containingFile, redirectedReference = _a.redirectedReference,
|
|
102896
|
+
var _b, _c, _d, _e;
|
|
102897
|
+
var names = _a.names, containingFile = _a.containingFile, redirectedReference = _a.redirectedReference, perFileCache = _a.perFileCache, loader = _a.loader, getResolutionWithResolvedFileName = _a.getResolutionWithResolvedFileName, partialResolutionInfo = _a.partialResolutionInfo, logChanges = _a.logChanges, containingSourceFile = _a.containingSourceFile, containingSourceFileMode = _a.containingSourceFileMode;
|
|
101875
102898
|
var path = resolutionHost.toPath(containingFile);
|
|
101876
|
-
var resolutionsInFile =
|
|
101877
|
-
var
|
|
101878
|
-
var
|
|
101879
|
-
|
|
101880
|
-
|
|
101881
|
-
|
|
101882
|
-
perDirectoryCache.set(dirPath, perDirectoryResolution);
|
|
102899
|
+
var resolutionsInFile = perFileCache.get(path);
|
|
102900
|
+
var compilerOptions = resolutionHost.getCompilationSettings();
|
|
102901
|
+
var key = ts.getRedirectsCacheKey((redirectedReference === null || redirectedReference === void 0 ? void 0 : redirectedReference.commandLine.options) || compilerOptions);
|
|
102902
|
+
if (!resolutionsInFile || resolutionsInFile.key !== key) {
|
|
102903
|
+
resolutionsInFile === null || resolutionsInFile === void 0 ? void 0 : resolutionsInFile.cache.forEach(function (r) { return stopWatchingResolution(r, path, getResolutionWithResolvedFileName); });
|
|
102904
|
+
perFileCache.set(path, resolutionsInFile = { key: key, cache: ts.createModeAwareCache() });
|
|
101883
102905
|
}
|
|
101884
102906
|
var resolvedModules = [];
|
|
101885
|
-
var compilerOptions = resolutionHost.getCompilationSettings();
|
|
101886
|
-
var hasInvalidatedNonRelativeUnresolvedImport = logChanges && isFileWithInvalidatedNonRelativeUnresolvedImports(path);
|
|
101887
|
-
var program = resolutionHost.getCurrentProgram();
|
|
101888
|
-
var oldRedirect = program && program.getResolvedProjectReferenceToRedirect(containingFile);
|
|
101889
|
-
var unmatchedRedirects = oldRedirect ?
|
|
101890
|
-
!redirectedReference || redirectedReference.sourceFile.path !== oldRedirect.sourceFile.path :
|
|
101891
|
-
!!redirectedReference;
|
|
101892
102907
|
var seenNamesInFile = ts.createModeAwareCache();
|
|
101893
102908
|
var i = 0;
|
|
101894
|
-
for (var _i = 0,
|
|
101895
|
-
var entry =
|
|
101896
|
-
var name = ts.isString(entry) ? entry : entry.fileName
|
|
102909
|
+
for (var _i = 0, names_4 = names; _i < names_4.length; _i++) {
|
|
102910
|
+
var entry = names_4[_i];
|
|
102911
|
+
var name = ts.isString(entry) ? entry : ts.toFileNameLowerCase(entry.fileName);
|
|
101897
102912
|
var mode = !ts.isString(entry) ? ts.getModeForFileReference(entry, containingSourceFileMode) :
|
|
101898
|
-
containingSourceFile ? ts.getModeForResolutionAtIndex(containingSourceFile, i) : undefined;
|
|
102913
|
+
containingSourceFile ? ts.getModeForResolutionAtIndex(containingSourceFile, (_b = partialResolutionInfo === null || partialResolutionInfo === void 0 ? void 0 : partialResolutionInfo.namesIndex[i]) !== null && _b !== void 0 ? _b : i) : undefined;
|
|
101899
102914
|
i++;
|
|
101900
|
-
var resolution = resolutionsInFile.get(name, mode);
|
|
101901
|
-
if (!seenNamesInFile.has(name, mode) &&
|
|
101902
|
-
unmatchedRedirects || !resolution || resolution.isInvalidated ||
|
|
101903
|
-
(hasInvalidatedNonRelativeUnresolvedImport && !ts.isExternalModuleNameRelative(name) && shouldRetryResolution(resolution))) {
|
|
102915
|
+
var resolution = resolutionsInFile.cache.get(name, mode);
|
|
102916
|
+
if (!seenNamesInFile.has(name, mode) && (!resolution || resolution.isInvalidated)) {
|
|
101904
102917
|
var existingResolution = resolution;
|
|
101905
|
-
|
|
101906
|
-
if (
|
|
101907
|
-
|
|
101908
|
-
var host = ((_b = resolutionHost.getCompilerHost) === null || _b === void 0 ? void 0 : _b.call(resolutionHost)) || resolutionHost;
|
|
101909
|
-
if (ts.isTraceEnabled(compilerOptions, host)) {
|
|
101910
|
-
var resolved = getResolutionWithResolvedFileName(resolution);
|
|
101911
|
-
ts.trace(host, loader === resolveModuleName ?
|
|
101912
|
-
(resolved === null || resolved === void 0 ? void 0 : resolved.resolvedFileName) ?
|
|
101913
|
-
resolved.packagetId ?
|
|
101914
|
-
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 :
|
|
101915
|
-
ts.Diagnostics.Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3 :
|
|
101916
|
-
ts.Diagnostics.Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_not_resolved :
|
|
101917
|
-
(resolved === null || resolved === void 0 ? void 0 : resolved.resolvedFileName) ?
|
|
101918
|
-
resolved.packagetId ?
|
|
101919
|
-
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 :
|
|
101920
|
-
ts.Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3 :
|
|
101921
|
-
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));
|
|
101922
|
-
}
|
|
102918
|
+
resolution = loader(name, containingFile, compilerOptions, ((_c = resolutionHost.getCompilerHost) === null || _c === void 0 ? void 0 : _c.call(resolutionHost)) || resolutionHost, redirectedReference, containingSourceFile, mode);
|
|
102919
|
+
if (resolutionHost.onDiscoveredSymlink && resolutionIsSymlink(resolution)) {
|
|
102920
|
+
resolutionHost.onDiscoveredSymlink();
|
|
101923
102921
|
}
|
|
101924
|
-
|
|
101925
|
-
resolution = loader(name, containingFile, compilerOptions, ((_c = resolutionHost.getCompilerHost) === null || _c === void 0 ? void 0 : _c.call(resolutionHost)) || resolutionHost, redirectedReference, containingSourceFile, mode);
|
|
101926
|
-
perDirectoryResolution.set(name, mode, resolution);
|
|
101927
|
-
if (resolutionHost.onDiscoveredSymlink && resolutionIsSymlink(resolution)) {
|
|
101928
|
-
resolutionHost.onDiscoveredSymlink();
|
|
101929
|
-
}
|
|
101930
|
-
}
|
|
101931
|
-
resolutionsInFile.set(name, mode, resolution);
|
|
101932
|
-
watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, path, getResolutionWithResolvedFileName);
|
|
102922
|
+
resolutionsInFile.cache.set(name, mode, resolution);
|
|
101933
102923
|
if (existingResolution) {
|
|
101934
|
-
|
|
102924
|
+
stopWatchingResolution(existingResolution, path, getResolutionWithResolvedFileName);
|
|
101935
102925
|
}
|
|
101936
102926
|
if (logChanges && filesWithChangedSetOfUnresolvedImports && !resolutionIsEqualTo(existingResolution, resolution)) {
|
|
101937
102927
|
filesWithChangedSetOfUnresolvedImports.push(path);
|
|
@@ -101944,27 +102934,33 @@ var ts;
|
|
|
101944
102934
|
var resolved = getResolutionWithResolvedFileName(resolution);
|
|
101945
102935
|
ts.trace(host, loader === resolveModuleName ?
|
|
101946
102936
|
(resolved === null || resolved === void 0 ? void 0 : resolved.resolvedFileName) ?
|
|
101947
|
-
resolved.
|
|
102937
|
+
resolved.packageId ?
|
|
101948
102938
|
ts.Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 :
|
|
101949
102939
|
ts.Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2 :
|
|
101950
102940
|
ts.Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_not_resolved :
|
|
101951
102941
|
(resolved === null || resolved === void 0 ? void 0 : resolved.resolvedFileName) ?
|
|
101952
|
-
resolved.
|
|
102942
|
+
resolved.packageId ?
|
|
101953
102943
|
ts.Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 :
|
|
101954
102944
|
ts.Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved_to_2 :
|
|
101955
|
-
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.
|
|
102945
|
+
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.packageId) && ts.packageIdToString(resolved.packageId));
|
|
101956
102946
|
}
|
|
101957
102947
|
}
|
|
101958
102948
|
ts.Debug.assert(resolution !== undefined && !resolution.isInvalidated);
|
|
101959
102949
|
seenNamesInFile.set(name, mode, true);
|
|
101960
|
-
resolvedModules.push(
|
|
102950
|
+
resolvedModules.push(resolution);
|
|
101961
102951
|
}
|
|
101962
|
-
|
|
101963
|
-
|
|
101964
|
-
|
|
101965
|
-
resolutionsInFile.delete(name, mode);
|
|
101966
|
-
}
|
|
102952
|
+
(_e = partialResolutionInfo === null || partialResolutionInfo === void 0 ? void 0 : partialResolutionInfo.reusedNames) === null || _e === void 0 ? void 0 : _e.forEach(function (_a) {
|
|
102953
|
+
var name = _a.name, mode = _a.mode;
|
|
102954
|
+
return seenNamesInFile.set(name, mode, true);
|
|
101967
102955
|
});
|
|
102956
|
+
if (resolutionsInFile.cache.size() !== seenNamesInFile.size()) {
|
|
102957
|
+
resolutionsInFile.cache.forEach(function (resolution, name, mode) {
|
|
102958
|
+
if (!seenNamesInFile.has(name, mode)) {
|
|
102959
|
+
stopWatchingResolution(resolution, path, getResolutionWithResolvedFileName);
|
|
102960
|
+
resolutionsInFile.cache.delete(name, mode);
|
|
102961
|
+
}
|
|
102962
|
+
});
|
|
102963
|
+
}
|
|
101968
102964
|
return resolvedModules;
|
|
101969
102965
|
function resolutionIsEqualTo(oldResolution, newResolution) {
|
|
101970
102966
|
if (oldResolution === newResolution) {
|
|
@@ -101984,40 +102980,31 @@ var ts;
|
|
|
101984
102980
|
return oldResult.resolvedFileName === newResult.resolvedFileName;
|
|
101985
102981
|
}
|
|
101986
102982
|
}
|
|
101987
|
-
function resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference, containingFileMode) {
|
|
102983
|
+
function resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference, containingFileMode, partialResolutionInfo) {
|
|
101988
102984
|
return resolveNamesWithLocalCache({
|
|
101989
102985
|
names: typeDirectiveNames,
|
|
101990
102986
|
containingFile: containingFile,
|
|
101991
102987
|
redirectedReference: redirectedReference,
|
|
101992
|
-
|
|
101993
|
-
perDirectoryCacheWithRedirects: perDirectoryResolvedTypeReferenceDirectives,
|
|
102988
|
+
perFileCache: resolvedTypeReferenceDirectives,
|
|
101994
102989
|
loader: resolveTypeReferenceDirective,
|
|
101995
|
-
getResolutionWithResolvedFileName:
|
|
101996
|
-
|
|
101997
|
-
|
|
102990
|
+
getResolutionWithResolvedFileName: getResolvedTypeReferenceDirectiveOfResolution,
|
|
102991
|
+
containingSourceFileMode: containingFileMode,
|
|
102992
|
+
partialResolutionInfo: partialResolutionInfo,
|
|
101998
102993
|
});
|
|
101999
102994
|
}
|
|
102000
|
-
function resolveModuleNames(moduleNames, containingFile,
|
|
102995
|
+
function resolveModuleNames(moduleNames, containingFile, redirectedReference, containingSourceFile, partialResolutionInfo) {
|
|
102001
102996
|
return resolveNamesWithLocalCache({
|
|
102002
102997
|
names: moduleNames,
|
|
102003
102998
|
containingFile: containingFile,
|
|
102004
102999
|
redirectedReference: redirectedReference,
|
|
102005
|
-
|
|
102006
|
-
perDirectoryCacheWithRedirects: perDirectoryResolvedModuleNames,
|
|
103000
|
+
perFileCache: resolvedModuleNames,
|
|
102007
103001
|
loader: resolveModuleName,
|
|
102008
|
-
getResolutionWithResolvedFileName:
|
|
102009
|
-
|
|
102010
|
-
reusedNames: reusedNames,
|
|
103002
|
+
getResolutionWithResolvedFileName: getResolvedModuleOfResolution,
|
|
103003
|
+
partialResolutionInfo: partialResolutionInfo,
|
|
102011
103004
|
logChanges: logChangesWhenResolvingModule,
|
|
102012
103005
|
containingSourceFile: containingSourceFile,
|
|
102013
103006
|
});
|
|
102014
103007
|
}
|
|
102015
|
-
function getResolvedModuleWithFailedLookupLocationsFromCache(moduleName, containingFile, resolutionMode) {
|
|
102016
|
-
var cache = resolvedModuleNames.get(resolutionHost.toPath(containingFile));
|
|
102017
|
-
if (!cache)
|
|
102018
|
-
return undefined;
|
|
102019
|
-
return cache.get(moduleName, resolutionMode);
|
|
102020
|
-
}
|
|
102021
103008
|
function isNodeModulesAtTypesDirectory(dirPath) {
|
|
102022
103009
|
return ts.endsWith(dirPath, "/node_modules/@types");
|
|
102023
103010
|
}
|
|
@@ -102071,37 +103058,41 @@ var ts;
|
|
|
102071
103058
|
function isPathWithDefaultFailedLookupExtension(path) {
|
|
102072
103059
|
return ts.fileExtensionIsOneOf(path, failedLookupDefaultExtensions);
|
|
102073
103060
|
}
|
|
102074
|
-
function
|
|
102075
|
-
if (resolution.
|
|
102076
|
-
resolution.
|
|
102077
|
-
|
|
103061
|
+
function watchResolution(newProgram, name, resolution, filePath, getResolutionWithResolvedFileName) {
|
|
103062
|
+
if (resolution.files) {
|
|
103063
|
+
resolution.files.add(filePath);
|
|
103064
|
+
if (resolution.watchedFailed !== false)
|
|
103065
|
+
watchFailedLookupLocationOfResolution(resolution);
|
|
103066
|
+
watchAffectingLocationsOfResolution(resolution);
|
|
103067
|
+
return;
|
|
103068
|
+
}
|
|
103069
|
+
resolution.files = new ts.Set();
|
|
103070
|
+
resolution.files.add(filePath);
|
|
103071
|
+
var resolved = getResolutionWithResolvedFileName(resolution);
|
|
103072
|
+
if (resolved && resolved.resolvedFileName) {
|
|
103073
|
+
resolvedFileToResolution.add(resolutionHost.toPath(resolved.resolvedFileName), resolution);
|
|
103074
|
+
}
|
|
103075
|
+
if (ts.isExternalModuleNameRelative(name) || !newProgram.getTypeChecker().tryFindAmbientModuleWithoutAugmentations(name)) {
|
|
103076
|
+
watchFailedLookupLocationOfResolution(resolution);
|
|
103077
|
+
watchAffectingLocationsOfResolution(resolution);
|
|
102078
103078
|
}
|
|
102079
103079
|
else {
|
|
102080
|
-
resolution.
|
|
102081
|
-
|
|
102082
|
-
if (ts.isExternalModuleNameRelative(name)) {
|
|
102083
|
-
watchFailedLookupLocationOfResolution(resolution);
|
|
102084
|
-
}
|
|
102085
|
-
else {
|
|
102086
|
-
nonRelativeExternalModuleResolutions.add(name, resolution);
|
|
102087
|
-
}
|
|
102088
|
-
var resolved = getResolutionWithResolvedFileName(resolution);
|
|
102089
|
-
if (resolved && resolved.resolvedFileName) {
|
|
102090
|
-
resolvedFileToResolution.add(resolutionHost.toPath(resolved.resolvedFileName), resolution);
|
|
102091
|
-
}
|
|
103080
|
+
resolution.watchedFailed = false;
|
|
103081
|
+
watchAffectingLocationsOfResolution(resolution);
|
|
102092
103082
|
}
|
|
102093
|
-
(resolution.files || (resolution.files = [])).push(filePath);
|
|
102094
103083
|
}
|
|
102095
103084
|
function watchFailedLookupLocationOfResolution(resolution) {
|
|
102096
|
-
|
|
102097
|
-
|
|
102098
|
-
if (!failedLookupLocations.length && !affectingLocations.length)
|
|
103085
|
+
var failedLookupLocations = resolution.failedLookupLocations;
|
|
103086
|
+
if (!failedLookupLocations.length || resolution.watchedFailed === failedLookupLocations.length)
|
|
102099
103087
|
return;
|
|
102100
|
-
if (
|
|
103088
|
+
if (!resolution.watchedFailed) {
|
|
102101
103089
|
resolutionsWithFailedLookups.push(resolution);
|
|
102102
|
-
|
|
102103
|
-
|
|
102104
|
-
|
|
103090
|
+
if (resolution.watchedAffected)
|
|
103091
|
+
ts.unorderedRemoveItem(resolutionsWithOnlyAffectingLocations, resolution);
|
|
103092
|
+
}
|
|
103093
|
+
var setAtRoot = !!resolution.setAtRoot;
|
|
103094
|
+
for (var i = resolution.watchedFailed || 0; i < failedLookupLocations.length; i++) {
|
|
103095
|
+
var failedLookupLocation = failedLookupLocations[i];
|
|
102105
103096
|
var failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
|
|
102106
103097
|
var toWatch = getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath);
|
|
102107
103098
|
if (toWatch) {
|
|
@@ -102119,22 +103110,22 @@ var ts;
|
|
|
102119
103110
|
}
|
|
102120
103111
|
}
|
|
102121
103112
|
}
|
|
102122
|
-
if (setAtRoot) {
|
|
103113
|
+
if (setAtRoot && !resolution.setAtRoot) {
|
|
102123
103114
|
setDirectoryWatcher(rootDir, rootPath, true);
|
|
102124
103115
|
}
|
|
102125
|
-
|
|
103116
|
+
resolution.setAtRoot = setAtRoot;
|
|
103117
|
+
resolution.watchedFailed = failedLookupLocations.length;
|
|
102126
103118
|
}
|
|
102127
|
-
function watchAffectingLocationsOfResolution(resolution
|
|
102128
|
-
ts.Debug.assert(!!resolution.refCount);
|
|
103119
|
+
function watchAffectingLocationsOfResolution(resolution) {
|
|
102129
103120
|
var affectingLocations = resolution.affectingLocations;
|
|
102130
|
-
if (!affectingLocations.length)
|
|
103121
|
+
if (!(affectingLocations === null || affectingLocations === void 0 ? void 0 : affectingLocations.length) || resolution.watchedAffected === affectingLocations.length)
|
|
102131
103122
|
return;
|
|
102132
|
-
if (
|
|
103123
|
+
if (!resolution.watchedFailed && !resolution.watchedAffected)
|
|
102133
103124
|
resolutionsWithOnlyAffectingLocations.push(resolution);
|
|
102134
|
-
for (var
|
|
102135
|
-
|
|
102136
|
-
createFileWatcherOfAffectingLocation(affectingLocation, true);
|
|
103125
|
+
for (var i = resolution.watchedAffected || 0; i < affectingLocations.length; i++) {
|
|
103126
|
+
createFileWatcherOfAffectingLocation(affectingLocations[i], true);
|
|
102137
103127
|
}
|
|
103128
|
+
resolution.watchedAffected = affectingLocations.length;
|
|
102138
103129
|
}
|
|
102139
103130
|
function createFileWatcherOfAffectingLocation(affectingLocation, forResolution) {
|
|
102140
103131
|
var fileWatcher = fileWatchesOfAffectingLocations.get(affectingLocation);
|
|
@@ -102193,15 +103184,6 @@ var ts;
|
|
|
102193
103184
|
paths.add(affectingLocation);
|
|
102194
103185
|
}
|
|
102195
103186
|
}
|
|
102196
|
-
function watchFailedLookupLocationOfNonRelativeModuleResolutions(resolutions, name) {
|
|
102197
|
-
var program = resolutionHost.getCurrentProgram();
|
|
102198
|
-
if (!program || !program.getTypeChecker().tryFindAmbientModuleWithoutAugmentations(name)) {
|
|
102199
|
-
resolutions.forEach(watchFailedLookupLocationOfResolution);
|
|
102200
|
-
}
|
|
102201
|
-
else {
|
|
102202
|
-
resolutions.forEach(function (resolution) { return watchAffectingLocationsOfResolution(resolution, true); });
|
|
102203
|
-
}
|
|
102204
|
-
}
|
|
102205
103187
|
function setDirectoryWatcher(dir, dirPath, nonRecursive) {
|
|
102206
103188
|
var dirWatcher = directoryWatchesOfFailedLookups.get(dirPath);
|
|
102207
103189
|
if (dirWatcher) {
|
|
@@ -102212,21 +103194,27 @@ var ts;
|
|
|
102212
103194
|
directoryWatchesOfFailedLookups.set(dirPath, { watcher: createDirectoryWatcher(dir, dirPath, nonRecursive), refCount: 1, nonRecursive: nonRecursive });
|
|
102213
103195
|
}
|
|
102214
103196
|
}
|
|
102215
|
-
function
|
|
102216
|
-
|
|
102217
|
-
resolution.
|
|
102218
|
-
if (resolution.
|
|
103197
|
+
function stopWatchingResolution(resolution, filePath, getResolutionWithResolvedFileName) {
|
|
103198
|
+
var _a, _b;
|
|
103199
|
+
(_a = resolution.files) === null || _a === void 0 ? void 0 : _a.delete(filePath);
|
|
103200
|
+
if (!((_b = resolution.files) === null || _b === void 0 ? void 0 : _b.size))
|
|
103201
|
+
(resolutionsToCloseWatcherOn !== null && resolutionsToCloseWatcherOn !== void 0 ? resolutionsToCloseWatcherOn : (resolutionsToCloseWatcherOn = [])).push({ resolution: resolution, getResolved: getResolutionWithResolvedFileName });
|
|
103202
|
+
}
|
|
103203
|
+
function closeWatchersOfResolution(_a) {
|
|
103204
|
+
var _b;
|
|
103205
|
+
var resolution = _a.resolution, getResolved = _a.getResolved;
|
|
103206
|
+
if (((_b = resolution.files) === null || _b === void 0 ? void 0 : _b.size) || !resolution.files)
|
|
102219
103207
|
return;
|
|
102220
|
-
|
|
102221
|
-
var resolved =
|
|
103208
|
+
resolution.files = undefined;
|
|
103209
|
+
var resolved = getResolved(resolution);
|
|
102222
103210
|
if (resolved && resolved.resolvedFileName) {
|
|
102223
103211
|
resolvedFileToResolution.remove(resolutionHost.toPath(resolved.resolvedFileName), resolution);
|
|
102224
103212
|
}
|
|
102225
|
-
|
|
102226
|
-
|
|
103213
|
+
if (resolution.watchedFailed) {
|
|
103214
|
+
ts.unorderedRemoveItem(resolutionsWithFailedLookups, resolution);
|
|
102227
103215
|
var removeAtRoot = false;
|
|
102228
|
-
for (var
|
|
102229
|
-
var failedLookupLocation =
|
|
103216
|
+
for (var i = 0; i < resolution.watchedFailed; i++) {
|
|
103217
|
+
var failedLookupLocation = resolution.failedLookupLocations[i];
|
|
102230
103218
|
var failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
|
|
102231
103219
|
var toWatch = getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath);
|
|
102232
103220
|
if (toWatch) {
|
|
@@ -102249,22 +103237,28 @@ var ts;
|
|
|
102249
103237
|
}
|
|
102250
103238
|
}
|
|
102251
103239
|
}
|
|
103240
|
+
ts.Debug.assert(resolution.setAtRoot === removeAtRoot);
|
|
102252
103241
|
if (removeAtRoot) {
|
|
102253
103242
|
removeDirectoryWatcher(rootPath);
|
|
102254
103243
|
}
|
|
102255
103244
|
}
|
|
102256
|
-
else if (
|
|
103245
|
+
else if (resolution.watchedAffected) {
|
|
102257
103246
|
ts.unorderedRemoveItem(resolutionsWithOnlyAffectingLocations, resolution);
|
|
102258
103247
|
}
|
|
102259
|
-
|
|
102260
|
-
var
|
|
102261
|
-
|
|
102262
|
-
|
|
103248
|
+
if (resolution.watchedAffected) {
|
|
103249
|
+
for (var i = 0; i < resolution.watchedAffected; i++) {
|
|
103250
|
+
var watcher = fileWatchesOfAffectingLocations.get(resolution.affectingLocations[i]);
|
|
103251
|
+
watcher.resolutions--;
|
|
103252
|
+
}
|
|
102263
103253
|
}
|
|
102264
103254
|
}
|
|
102265
103255
|
function removeDirectoryWatcher(dirPath) {
|
|
102266
103256
|
var dirWatcher = directoryWatchesOfFailedLookups.get(dirPath);
|
|
102267
103257
|
dirWatcher.refCount--;
|
|
103258
|
+
if (dirWatcher.refCount === 0) {
|
|
103259
|
+
directoryWatchesOfFailedLookups.delete(dirPath);
|
|
103260
|
+
dirWatcher.watcher.close();
|
|
103261
|
+
}
|
|
102268
103262
|
}
|
|
102269
103263
|
function createDirectoryWatcher(directory, dirPath, nonRecursive) {
|
|
102270
103264
|
return resolutionHost.watchDirectoryOfFailedLookupLocation(directory, function (fileOrDirectory) {
|
|
@@ -102278,26 +103272,16 @@ var ts;
|
|
|
102278
103272
|
function removeResolutionsOfFileFromCache(cache, filePath, getResolutionWithResolvedFileName) {
|
|
102279
103273
|
var resolutions = cache.get(filePath);
|
|
102280
103274
|
if (resolutions) {
|
|
102281
|
-
resolutions.forEach(function (resolution) { return
|
|
103275
|
+
resolutions.cache.forEach(function (resolution) { return stopWatchingResolution(resolution, filePath, getResolutionWithResolvedFileName); });
|
|
102282
103276
|
cache.delete(filePath);
|
|
102283
103277
|
}
|
|
102284
103278
|
}
|
|
102285
|
-
function removeResolutionsFromProjectReferenceRedirects(filePath) {
|
|
102286
|
-
if (!ts.fileExtensionIs(filePath, ".json"))
|
|
102287
|
-
return;
|
|
102288
|
-
var program = resolutionHost.getCurrentProgram();
|
|
102289
|
-
if (!program)
|
|
102290
|
-
return;
|
|
102291
|
-
var resolvedProjectReference = program.getResolvedProjectReferenceByPath(filePath);
|
|
102292
|
-
if (!resolvedProjectReference)
|
|
102293
|
-
return;
|
|
102294
|
-
resolvedProjectReference.commandLine.fileNames.forEach(function (f) { return removeResolutionsOfFile(resolutionHost.toPath(f)); });
|
|
102295
|
-
}
|
|
102296
103279
|
function removeResolutionsOfFile(filePath) {
|
|
102297
|
-
removeResolutionsOfFileFromCache(resolvedModuleNames, filePath,
|
|
102298
|
-
removeResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath,
|
|
103280
|
+
removeResolutionsOfFileFromCache(resolvedModuleNames, filePath, getResolvedModuleOfResolution);
|
|
103281
|
+
removeResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath, getResolvedTypeReferenceDirectiveOfResolution);
|
|
102299
103282
|
}
|
|
102300
103283
|
function invalidateResolutions(resolutions, canInvalidate) {
|
|
103284
|
+
var _a;
|
|
102301
103285
|
if (!resolutions)
|
|
102302
103286
|
return false;
|
|
102303
103287
|
var invalidated = false;
|
|
@@ -102306,16 +103290,14 @@ var ts;
|
|
|
102306
103290
|
if (resolution.isInvalidated || !canInvalidate(resolution))
|
|
102307
103291
|
continue;
|
|
102308
103292
|
resolution.isInvalidated = invalidated = true;
|
|
102309
|
-
|
|
102310
|
-
var containingFilePath = _b[_a];
|
|
103293
|
+
(_a = resolution.files) === null || _a === void 0 ? void 0 : _a.forEach(function (containingFilePath) {
|
|
102311
103294
|
(filesWithInvalidatedResolutions !== null && filesWithInvalidatedResolutions !== void 0 ? filesWithInvalidatedResolutions : (filesWithInvalidatedResolutions = new ts.Set())).add(containingFilePath);
|
|
102312
103295
|
hasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames || ts.endsWith(containingFilePath, ts.inferredTypesContainingFile);
|
|
102313
|
-
}
|
|
103296
|
+
});
|
|
102314
103297
|
}
|
|
102315
103298
|
return invalidated;
|
|
102316
103299
|
}
|
|
102317
103300
|
function invalidateResolutionOfFile(filePath) {
|
|
102318
|
-
removeResolutionsOfFile(filePath);
|
|
102319
103301
|
var prevHasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames;
|
|
102320
103302
|
if (invalidateResolutions(resolvedFileToResolution.get(filePath), ts.returnTrue) &&
|
|
102321
103303
|
hasChangedAutomaticTypeDirectiveNames &&
|
|
@@ -102324,8 +103306,28 @@ var ts;
|
|
|
102324
103306
|
}
|
|
102325
103307
|
}
|
|
102326
103308
|
function setFilesWithInvalidatedNonRelativeUnresolvedImports(filesMap) {
|
|
102327
|
-
|
|
102328
|
-
|
|
103309
|
+
filesMap.forEach(function (_a, filePath) {
|
|
103310
|
+
var imports = _a.imports;
|
|
103311
|
+
if (!imports.length)
|
|
103312
|
+
return;
|
|
103313
|
+
var resolvedModules = resolvedModuleNames.get(filePath);
|
|
103314
|
+
var resolvedTypeRefs = resolvedTypeReferenceDirectives.get(filePath);
|
|
103315
|
+
if (!(resolvedModules === null || resolvedModules === void 0 ? void 0 : resolvedModules.cache.size()) && !(resolvedTypeRefs === null || resolvedTypeRefs === void 0 ? void 0 : resolvedTypeRefs.cache.size()))
|
|
103316
|
+
return;
|
|
103317
|
+
imports.forEach(function (_a) {
|
|
103318
|
+
var name = _a.name, mode = _a.mode;
|
|
103319
|
+
var resolvedModule = resolvedModules === null || resolvedModules === void 0 ? void 0 : resolvedModules.cache.get(name, mode);
|
|
103320
|
+
if (resolvedModule && !resolvedModule.isInvalidated && (!resolvedModule.resolvedModule || !ts.resolutionExtensionIsTSOrJson(resolvedModule.resolvedModule.extension))) {
|
|
103321
|
+
resolvedModule.isInvalidated = true;
|
|
103322
|
+
(filesWithInvalidatedResolutions !== null && filesWithInvalidatedResolutions !== void 0 ? filesWithInvalidatedResolutions : (filesWithInvalidatedResolutions = new ts.Set())).add(filePath);
|
|
103323
|
+
}
|
|
103324
|
+
var resolvedTypeRef = resolvedTypeRefs === null || resolvedTypeRefs === void 0 ? void 0 : resolvedTypeRefs.cache.get(name, mode);
|
|
103325
|
+
if (resolvedTypeRef && !resolvedTypeRef.isInvalidated && !resolvedTypeRef.resolvedTypeReferenceDirective) {
|
|
103326
|
+
resolvedTypeRef.isInvalidated = true;
|
|
103327
|
+
(filesWithInvalidatedResolutions !== null && filesWithInvalidatedResolutions !== void 0 ? filesWithInvalidatedResolutions : (filesWithInvalidatedResolutions = new ts.Set())).add(filePath);
|
|
103328
|
+
}
|
|
103329
|
+
});
|
|
103330
|
+
});
|
|
102329
103331
|
}
|
|
102330
103332
|
function scheduleInvalidateResolutionOfFailedLookupLocation(fileOrDirectoryPath, isCreatingWatchedDirectory) {
|
|
102331
103333
|
if (isCreatingWatchedDirectory) {
|
|
@@ -102364,12 +103366,17 @@ var ts;
|
|
|
102364
103366
|
var _a;
|
|
102365
103367
|
var invalidated = false;
|
|
102366
103368
|
if (affectingPathChecksForFile) {
|
|
102367
|
-
|
|
102368
|
-
|
|
102369
|
-
|
|
103369
|
+
for (var _i = 0, watchedPackageJsonScopes_1 = watchedPackageJsonScopes; _i < watchedPackageJsonScopes_1.length; _i++) {
|
|
103370
|
+
var scope = watchedPackageJsonScopes_1[_i];
|
|
103371
|
+
if (scope.isInvalidated)
|
|
103372
|
+
continue;
|
|
103373
|
+
if (ts.some(scope.failedLookupLocations, function (location) { return affectingPathChecksForFile.has(location); }) ||
|
|
103374
|
+
ts.some(scope.affectingLocations, function (location) { return affectingPathChecksForFile.has(location); })) {
|
|
103375
|
+
scope.isInvalidated = true;
|
|
102370
103376
|
invalidated = true;
|
|
103377
|
+
(_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); });
|
|
102371
103378
|
}
|
|
102372
|
-
}
|
|
103379
|
+
}
|
|
102373
103380
|
affectingPathChecksForFile = undefined;
|
|
102374
103381
|
}
|
|
102375
103382
|
if (!failedLookupChecks && !startsWithPathChecks && !isInDirectoryChecks && !affectingPathChecks) {
|
|
@@ -102400,7 +103407,8 @@ var ts;
|
|
|
102400
103407
|
ts.firstDefinedIterator((isInDirectoryChecks === null || isInDirectoryChecks === void 0 ? void 0 : isInDirectoryChecks.keys()) || ts.emptyIterator, function (fileOrDirectoryPath) { return isInDirectoryPath(fileOrDirectoryPath, locationPath) ? true : undefined; });
|
|
102401
103408
|
}
|
|
102402
103409
|
function canInvalidatedFailedLookupResolutionWithAffectingLocation(resolution) {
|
|
102403
|
-
|
|
103410
|
+
var _a;
|
|
103411
|
+
return !!affectingPathChecks && !!((_a = resolution.affectingLocations) === null || _a === void 0 ? void 0 : _a.some(function (location) { return affectingPathChecks.has(location); }));
|
|
102404
103412
|
}
|
|
102405
103413
|
function closeTypeRootsWatch() {
|
|
102406
103414
|
ts.clearMap(typeRootsWatches, ts.closeFileWatcher);
|
|
@@ -102701,9 +103709,9 @@ var ts;
|
|
|
102701
103709
|
var targets = importedFileNames.map(function (f) { return ts.getNormalizedAbsolutePath(f, cwd); });
|
|
102702
103710
|
var shouldFilterIgnoredPaths = !ts.every(targets, ts.containsIgnoredPath);
|
|
102703
103711
|
if (!preferSymlinks) {
|
|
102704
|
-
var
|
|
102705
|
-
if (
|
|
102706
|
-
return
|
|
103712
|
+
var result_17 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
|
|
103713
|
+
if (result_17)
|
|
103714
|
+
return result_17;
|
|
102707
103715
|
}
|
|
102708
103716
|
var symlinkedDirectories = (_a = host.getSymlinkCache) === null || _a === void 0 ? void 0 : _a.call(host).getSymlinkedDirectoriesByRealpath();
|
|
102709
103717
|
var fullImportedFileName = ts.getNormalizedAbsolutePath(importedFileName, cwd);
|
|
@@ -102722,10 +103730,10 @@ var ts;
|
|
|
102722
103730
|
for (var _i = 0, symlinkDirectories_1 = symlinkDirectories; _i < symlinkDirectories_1.length; _i++) {
|
|
102723
103731
|
var symlinkDirectory = symlinkDirectories_1[_i];
|
|
102724
103732
|
var option = ts.resolvePath(symlinkDirectory, relative);
|
|
102725
|
-
var
|
|
103733
|
+
var result_18 = cb(option, target === referenceRedirect);
|
|
102726
103734
|
shouldFilterIgnoredPaths = true;
|
|
102727
|
-
if (
|
|
102728
|
-
return
|
|
103735
|
+
if (result_18)
|
|
103736
|
+
return result_18;
|
|
102729
103737
|
}
|
|
102730
103738
|
});
|
|
102731
103739
|
});
|
|
@@ -102784,9 +103792,9 @@ var ts;
|
|
|
102784
103792
|
};
|
|
102785
103793
|
var out_directory_1;
|
|
102786
103794
|
for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) {
|
|
102787
|
-
var
|
|
103795
|
+
var state_12 = _loop_35(directory);
|
|
102788
103796
|
directory = out_directory_1;
|
|
102789
|
-
if (
|
|
103797
|
+
if (state_12 === "break")
|
|
102790
103798
|
break;
|
|
102791
103799
|
}
|
|
102792
103800
|
if (allFileNames.size) {
|
|
@@ -102876,9 +103884,9 @@ var ts;
|
|
|
102876
103884
|
};
|
|
102877
103885
|
for (var _i = 0, _a = paths[key]; _i < _a.length; _i++) {
|
|
102878
103886
|
var patternText_1 = _a[_i];
|
|
102879
|
-
var
|
|
102880
|
-
if (typeof
|
|
102881
|
-
return
|
|
103887
|
+
var state_13 = _loop_36(patternText_1);
|
|
103888
|
+
if (typeof state_13 === "object")
|
|
103889
|
+
return state_13.value;
|
|
102882
103890
|
}
|
|
102883
103891
|
}
|
|
102884
103892
|
function validateEnding(_a) {
|
|
@@ -103331,7 +104339,7 @@ var ts;
|
|
|
103331
104339
|
}
|
|
103332
104340
|
ts.explainFiles = explainFiles;
|
|
103333
104341
|
function explainIfFileIsRedirectAndImpliedFormat(file, fileNameConvertor) {
|
|
103334
|
-
var _a;
|
|
104342
|
+
var _a, _b;
|
|
103335
104343
|
var result;
|
|
103336
104344
|
if (file.path !== file.resolvedPath) {
|
|
103337
104345
|
(result !== null && result !== void 0 ? result : (result = [])).push(ts.chainDiagnosticMessages(undefined, ts.Diagnostics.File_is_output_of_project_reference_source_0, toFileName(file.originalFileName, fileNameConvertor)));
|
|
@@ -103342,17 +104350,17 @@ var ts;
|
|
|
103342
104350
|
if (ts.isExternalOrCommonJsModule(file)) {
|
|
103343
104351
|
switch (file.impliedNodeFormat) {
|
|
103344
104352
|
case ts.ModuleKind.ESNext:
|
|
103345
|
-
if (file.packageJsonScope) {
|
|
103346
|
-
(result !== null && result !== void 0 ? result : (result = [])).push(ts.chainDiagnosticMessages(undefined, ts.Diagnostics.File_is_ECMAScript_module_because_0_has_field_type_with_value_module, toFileName(ts.
|
|
104353
|
+
if ((_a = file.packageJsonScope) === null || _a === void 0 ? void 0 : _a.info) {
|
|
104354
|
+
(result !== null && result !== void 0 ? result : (result = [])).push(ts.chainDiagnosticMessages(undefined, ts.Diagnostics.File_is_ECMAScript_module_because_0_has_field_type_with_value_module, toFileName(ts.getPackageJsconLocationFromScope(file.packageJsonScope), fileNameConvertor)));
|
|
103347
104355
|
}
|
|
103348
104356
|
break;
|
|
103349
104357
|
case ts.ModuleKind.CommonJS:
|
|
103350
|
-
if (file.packageJsonScope) {
|
|
103351
|
-
(result !== null && result !== void 0 ? result : (result = [])).push(ts.chainDiagnosticMessages(undefined, file.packageJsonScope.packageJsonContent.type ?
|
|
104358
|
+
if ((_b = file.packageJsonScope) === null || _b === void 0 ? void 0 : _b.info) {
|
|
104359
|
+
(result !== null && result !== void 0 ? result : (result = [])).push(ts.chainDiagnosticMessages(undefined, file.packageJsonScope.info.packageJsonContent.type ?
|
|
103352
104360
|
ts.Diagnostics.File_is_CommonJS_module_because_0_has_field_type_whose_value_is_not_module :
|
|
103353
|
-
ts.Diagnostics.File_is_CommonJS_module_because_0_does_not_have_field_type, toFileName(ts.
|
|
104361
|
+
ts.Diagnostics.File_is_CommonJS_module_because_0_does_not_have_field_type, toFileName(ts.getPackageJsconLocationFromScope(file.packageJsonScope), fileNameConvertor)));
|
|
103354
104362
|
}
|
|
103355
|
-
else if (
|
|
104363
|
+
else if (file.packageJsonScope) {
|
|
103356
104364
|
(result !== null && result !== void 0 ? result : (result = [])).push(ts.chainDiagnosticMessages(undefined, ts.Diagnostics.File_is_CommonJS_module_because_package_json_was_not_found));
|
|
103357
104365
|
}
|
|
103358
104366
|
break;
|
|
@@ -103723,7 +104731,7 @@ var ts;
|
|
|
103723
104731
|
})(ts || (ts = {}));
|
|
103724
104732
|
var ts;
|
|
103725
104733
|
(function (ts) {
|
|
103726
|
-
function
|
|
104734
|
+
function readBuildInfoForProgram(compilerOptions, host) {
|
|
103727
104735
|
var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(compilerOptions);
|
|
103728
104736
|
if (!buildInfoPath)
|
|
103729
104737
|
return undefined;
|
|
@@ -103743,7 +104751,12 @@ var ts;
|
|
|
103743
104751
|
return undefined;
|
|
103744
104752
|
if (!buildInfo.program)
|
|
103745
104753
|
return undefined;
|
|
103746
|
-
return
|
|
104754
|
+
return { buildInfo: buildInfo, buildInfoPath: buildInfoPath };
|
|
104755
|
+
}
|
|
104756
|
+
ts.readBuildInfoForProgram = readBuildInfoForProgram;
|
|
104757
|
+
function readBuilderProgram(compilerOptions, host) {
|
|
104758
|
+
var result = readBuildInfoForProgram(compilerOptions, host);
|
|
104759
|
+
return result && ts.createBuilderProgramUsingProgramBuildInfo(result.buildInfo.program, result.buildInfoPath, host, compilerOptions.configFilePath);
|
|
103747
104760
|
}
|
|
103748
104761
|
ts.readBuilderProgram = readBuilderProgram;
|
|
103749
104762
|
function createIncrementalCompilerHost(options, system) {
|
|
@@ -103876,7 +104889,7 @@ var ts;
|
|
|
103876
104889
|
}
|
|
103877
104890
|
return host.resolveModuleNames.apply(host, args);
|
|
103878
104891
|
}) :
|
|
103879
|
-
(function (moduleNames, containingFile,
|
|
104892
|
+
(function (moduleNames, containingFile, _reusedNames, redirectedReference, _options, sourceFile, partialResolutionInfo) { return resolutionCache.resolveModuleNames(moduleNames, containingFile, redirectedReference, sourceFile, partialResolutionInfo); });
|
|
103880
104893
|
compilerHost.resolveTypeReferenceDirectives = host.resolveTypeReferenceDirectives ?
|
|
103881
104894
|
(function () {
|
|
103882
104895
|
var args = [];
|
|
@@ -103885,10 +104898,13 @@ var ts;
|
|
|
103885
104898
|
}
|
|
103886
104899
|
return host.resolveTypeReferenceDirectives.apply(host, args);
|
|
103887
104900
|
}) :
|
|
103888
|
-
(function (typeDirectiveNames, containingFile, redirectedReference, _options, containingFileMode) { return resolutionCache.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference, containingFileMode); });
|
|
104901
|
+
(function (typeDirectiveNames, containingFile, redirectedReference, _options, containingFileMode, partialResolutionInfo) { return resolutionCache.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference, containingFileMode, partialResolutionInfo); });
|
|
103889
104902
|
compilerHost.getModuleResolutionCache = host.resolveModuleNames ?
|
|
103890
104903
|
ts.maybeBind(host, host.getModuleResolutionCache) :
|
|
103891
104904
|
(function () { return resolutionCache.getModuleResolutionCache(); });
|
|
104905
|
+
compilerHost.getTypeReferenceDirectiveResolutionCache = host.resolveTypeReferenceDirectives ?
|
|
104906
|
+
ts.maybeBind(host, host.getTypeReferenceDirectiveResolutionCache) :
|
|
104907
|
+
(function () { return resolutionCache.getTypeReferenceDirectiveResolutionCache(); });
|
|
103892
104908
|
var userProvidedResolution = !!host.resolveModuleNames || !!host.resolveTypeReferenceDirectives;
|
|
103893
104909
|
builderProgram = readBuilderProgram(compilerOptions, compilerHost);
|
|
103894
104910
|
synchronizeProgram();
|
|
@@ -103954,7 +104970,8 @@ var ts;
|
|
|
103954
104970
|
}
|
|
103955
104971
|
}
|
|
103956
104972
|
var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution);
|
|
103957
|
-
|
|
104973
|
+
var _a = ts.changeCompilerHostLikeToUseCache(compilerHost, toPath), originalReadFile = _a.originalReadFile, originalFileExists = _a.originalFileExists, originalDirectoryExists = _a.originalDirectoryExists, originalCreateDirectory = _a.originalCreateDirectory, originalWriteFile = _a.originalWriteFile;
|
|
104974
|
+
if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
|
|
103958
104975
|
if (hasChangedConfigFileParsingErrors) {
|
|
103959
104976
|
if (reportFileChangeDetectedOnCreateProgram) {
|
|
103960
104977
|
reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation);
|
|
@@ -103973,6 +104990,11 @@ var ts;
|
|
|
103973
104990
|
if (host.afterProgramCreate && program !== builderProgram) {
|
|
103974
104991
|
host.afterProgramCreate(builderProgram);
|
|
103975
104992
|
}
|
|
104993
|
+
compilerHost.readFile = originalReadFile;
|
|
104994
|
+
compilerHost.fileExists = originalFileExists;
|
|
104995
|
+
compilerHost.directoryExists = originalDirectoryExists;
|
|
104996
|
+
compilerHost.createDirectory = originalCreateDirectory;
|
|
104997
|
+
compilerHost.writeFile = originalWriteFile;
|
|
103976
104998
|
return builderProgram;
|
|
103977
104999
|
}
|
|
103978
105000
|
function createNewProgram(hasInvalidatedResolution) {
|
|
@@ -103981,7 +105003,6 @@ var ts;
|
|
|
103981
105003
|
writeLog(" options: " + JSON.stringify(compilerOptions));
|
|
103982
105004
|
if (projectReferences)
|
|
103983
105005
|
writeLog(" projectReferences: " + JSON.stringify(projectReferences));
|
|
103984
|
-
var needsUpdateInTypeRootWatch = hasChangedCompilerOptions || !getCurrentProgram();
|
|
103985
105006
|
hasChangedCompilerOptions = false;
|
|
103986
105007
|
hasChangedConfigFileParsingErrors = false;
|
|
103987
105008
|
resolutionCache.startCachingPerDirectoryResolution();
|
|
@@ -103991,9 +105012,6 @@ var ts;
|
|
|
103991
105012
|
builderProgram = createProgram(rootFileNames, compilerOptions, compilerHost, builderProgram, configFileParsingDiagnostics, projectReferences);
|
|
103992
105013
|
resolutionCache.finishCachingPerDirectoryResolution(builderProgram.getProgram(), oldProgram);
|
|
103993
105014
|
ts.updateMissingFilePathsWatch(builderProgram.getProgram(), missingFilesMap || (missingFilesMap = new ts.Map()), watchMissingFilePath);
|
|
103994
|
-
if (needsUpdateInTypeRootWatch) {
|
|
103995
|
-
resolutionCache.updateTypeRootsWatch();
|
|
103996
|
-
}
|
|
103997
105015
|
if (missingFilePathsRequestedForRelease) {
|
|
103998
105016
|
for (var _i = 0, missingFilePathsRequestedForRelease_1 = missingFilePathsRequestedForRelease; _i < missingFilePathsRequestedForRelease_1.length; _i++) {
|
|
103999
105017
|
var missingFilePath = missingFilePathsRequestedForRelease_1[_i];
|
|
@@ -104078,7 +105096,7 @@ var ts;
|
|
|
104078
105096
|
var hostSourceFile = sourceFilesCache.get(path);
|
|
104079
105097
|
return !hostSourceFile || !hostSourceFile.version ? undefined : hostSourceFile.version;
|
|
104080
105098
|
}
|
|
104081
|
-
function onReleaseOldSourceFile(oldSourceFile
|
|
105099
|
+
function onReleaseOldSourceFile(oldSourceFile) {
|
|
104082
105100
|
var hostSourceFileInfo = sourceFilesCache.get(oldSourceFile.resolvedPath);
|
|
104083
105101
|
if (hostSourceFileInfo !== undefined) {
|
|
104084
105102
|
if (isFileMissingOnHost(hostSourceFileInfo)) {
|
|
@@ -104089,9 +105107,6 @@ var ts;
|
|
|
104089
105107
|
hostSourceFileInfo.fileWatcher.close();
|
|
104090
105108
|
}
|
|
104091
105109
|
sourceFilesCache.delete(oldSourceFile.resolvedPath);
|
|
104092
|
-
if (!hasSourceFileByPath) {
|
|
104093
|
-
resolutionCache.removeResolutionsOfFile(oldSourceFile.path);
|
|
104094
|
-
}
|
|
104095
105110
|
}
|
|
104096
105111
|
}
|
|
104097
105112
|
}
|
|
@@ -104326,7 +105341,6 @@ var ts;
|
|
|
104326
105341
|
var config = parsedConfigs === null || parsedConfigs === void 0 ? void 0 : parsedConfigs.get(projectPath);
|
|
104327
105342
|
if (config)
|
|
104328
105343
|
config.reloadLevel = ts.ConfigFileProgramReloadLevel.Full;
|
|
104329
|
-
resolutionCache.removeResolutionsFromProjectReferenceRedirects(projectPath);
|
|
104330
105344
|
}
|
|
104331
105345
|
scheduleProgramUpdate();
|
|
104332
105346
|
});
|
|
@@ -104339,7 +105353,6 @@ var ts;
|
|
|
104339
105353
|
var config = parsedConfigs === null || parsedConfigs === void 0 ? void 0 : parsedConfigs.get(configPath);
|
|
104340
105354
|
if (config)
|
|
104341
105355
|
config.reloadLevel = ts.ConfigFileProgramReloadLevel.Full;
|
|
104342
|
-
resolutionCache.removeResolutionsFromProjectReferenceRedirects(configPath);
|
|
104343
105356
|
scheduleProgramUpdate();
|
|
104344
105357
|
}, ts.PollingInterval.High, ((_a = commandLine.parsedCommandLine) === null || _a === void 0 ? void 0 : _a.watchOptions) || watchOptions, ts.WatchType.ConfigFileOfReferencedProject));
|
|
104345
105358
|
if ((_b = commandLine.parsedCommandLine) === null || _b === void 0 ? void 0 : _b.wildcardDirectories) {
|
|
@@ -104512,20 +105525,22 @@ var ts;
|
|
|
104512
105525
|
compilerHost.resolveModuleNames = ts.maybeBind(host, host.resolveModuleNames);
|
|
104513
105526
|
compilerHost.resolveTypeReferenceDirectives = ts.maybeBind(host, host.resolveTypeReferenceDirectives);
|
|
104514
105527
|
compilerHost.getModuleResolutionCache = ts.maybeBind(host, host.getModuleResolutionCache);
|
|
105528
|
+
compilerHost.getTypeReferenceDirectiveResolutionCache = ts.maybeBind(host, host.getTypeReferenceDirectiveResolutionCache);
|
|
104515
105529
|
var moduleResolutionCache = !compilerHost.resolveModuleNames ? ts.createModuleResolutionCache(currentDirectory, getCanonicalFileName) : undefined;
|
|
104516
105530
|
var typeReferenceDirectiveResolutionCache = !compilerHost.resolveTypeReferenceDirectives ? ts.createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, undefined, moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache()) : undefined;
|
|
104517
105531
|
if (!compilerHost.resolveModuleNames) {
|
|
104518
|
-
var loader_3 = function (moduleName, resolverMode, containingFile, redirectedReference) { return ts.resolveModuleName(moduleName, containingFile, state.projectCompilerOptions, compilerHost, moduleResolutionCache, redirectedReference, resolverMode)
|
|
104519
|
-
compilerHost.resolveModuleNames = function (moduleNames, containingFile, _reusedNames, redirectedReference, _options, containingSourceFile) {
|
|
104520
|
-
return ts.loadWithModeAwareCache(
|
|
105532
|
+
var loader_3 = function (moduleName, resolverMode, containingFile, redirectedReference) { return ts.resolveModuleName(moduleName, containingFile, state.projectCompilerOptions, compilerHost, moduleResolutionCache, redirectedReference, resolverMode); };
|
|
105533
|
+
compilerHost.resolveModuleNames = function (moduleNames, containingFile, _reusedNames, redirectedReference, _options, containingSourceFile, partialResolutionInfo) {
|
|
105534
|
+
return ts.loadWithModeAwareCache(moduleNames, ts.Debug.checkDefined(containingSourceFile), containingFile, redirectedReference, partialResolutionInfo, loader_3);
|
|
104521
105535
|
};
|
|
104522
105536
|
compilerHost.getModuleResolutionCache = function () { return moduleResolutionCache; };
|
|
104523
105537
|
}
|
|
104524
105538
|
if (!compilerHost.resolveTypeReferenceDirectives) {
|
|
104525
|
-
var loader_4 = function (moduleName, containingFile, redirectedReference, containingFileMode) { return ts.resolveTypeReferenceDirective(moduleName, containingFile, state.projectCompilerOptions, compilerHost, redirectedReference, state.typeReferenceDirectiveResolutionCache, containingFileMode)
|
|
105539
|
+
var loader_4 = function (moduleName, containingFile, redirectedReference, containingFileMode) { return ts.resolveTypeReferenceDirective(moduleName, containingFile, state.projectCompilerOptions, compilerHost, redirectedReference, state.typeReferenceDirectiveResolutionCache, containingFileMode); };
|
|
104526
105540
|
compilerHost.resolveTypeReferenceDirectives = function (typeReferenceDirectiveNames, containingFile, redirectedReference, _options, containingFileMode) {
|
|
104527
|
-
return ts.loadWithTypeDirectiveCache(
|
|
105541
|
+
return ts.loadWithTypeDirectiveCache(typeReferenceDirectiveNames, containingFile, redirectedReference, containingFileMode, loader_4);
|
|
104528
105542
|
};
|
|
105543
|
+
compilerHost.getTypeReferenceDirectiveResolutionCache = function () { return typeReferenceDirectiveResolutionCache; };
|
|
104529
105544
|
}
|
|
104530
105545
|
compilerHost.getBuildInfo = function (fileName, configFilePath) { return getBuildInfo(state, fileName, toResolvedConfigFilePath(state, configFilePath), undefined); };
|
|
104531
105546
|
var _a = ts.createWatchFactory(hostWithWatch, options), watchFile = _a.watchFile, watchDirectory = _a.watchDirectory, writeLog = _a.writeLog;
|
|
@@ -105469,7 +106484,7 @@ var ts;
|
|
|
105469
106484
|
if (buildInfoTime && buildInfoTime < inputTime) {
|
|
105470
106485
|
var version_3 = void 0;
|
|
105471
106486
|
var currentVersion = void 0;
|
|
105472
|
-
if (buildInfoProgram) {
|
|
106487
|
+
if (buildInfoProgram === null || buildInfoProgram === void 0 ? void 0 : buildInfoProgram.fileInfos) {
|
|
105473
106488
|
if (!buildInfoVersionMap)
|
|
105474
106489
|
buildInfoVersionMap = ts.getBuildInfoFileVersionMap(buildInfoProgram, buildInfoPath, host);
|
|
105475
106490
|
version_3 = buildInfoVersionMap.get(toPath(state, inputFile));
|