@typescript-deploys/pr-build 4.8.0-pr-49956-24 → 4.8.0-pr-50007-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/lib.es2015.proxy.d.ts +91 -2
- package/lib/tsc.js +1561 -724
- package/lib/tsserver.js +1911 -885
- package/lib/tsserverlibrary.d.ts +37 -31
- package/lib/tsserverlibrary.js +1911 -885
- package/lib/typescript.d.ts +35 -28
- package/lib/typescript.js +1849 -832
- package/lib/typescriptServices.d.ts +35 -28
- package/lib/typescriptServices.js +1849 -832
- package/lib/typingsInstaller.js +1657 -771
- package/package.json +4 -3
package/lib/tsc.js
CHANGED
|
@@ -69,7 +69,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
69
69
|
var ts;
|
|
70
70
|
(function (ts) {
|
|
71
71
|
ts.versionMajorMinor = "4.8";
|
|
72
|
-
ts.version = ts.versionMajorMinor + ".0-insiders.
|
|
72
|
+
ts.version = ts.versionMajorMinor + ".0-insiders.20220728";
|
|
73
73
|
var NativeCollections;
|
|
74
74
|
(function (NativeCollections) {
|
|
75
75
|
var globals = typeof globalThis !== "undefined" ? globalThis :
|
|
@@ -1484,6 +1484,10 @@ var ts;
|
|
|
1484
1484
|
ts.cast = cast;
|
|
1485
1485
|
function noop(_) { }
|
|
1486
1486
|
ts.noop = noop;
|
|
1487
|
+
ts.noopPush = {
|
|
1488
|
+
push: noop,
|
|
1489
|
+
length: 0
|
|
1490
|
+
};
|
|
1487
1491
|
function returnFalse() {
|
|
1488
1492
|
return false;
|
|
1489
1493
|
}
|
|
@@ -5731,6 +5735,7 @@ var ts;
|
|
|
5731
5735
|
Control_what_method_is_used_to_detect_module_format_JS_files: diag(1475, ts.DiagnosticCategory.Message, "Control_what_method_is_used_to_detect_module_format_JS_files_1475", "Control what method is used to detect module-format JS files."),
|
|
5732
5736
|
auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_with_module_Colon_node16_as_modules: diag(1476, ts.DiagnosticCategory.Message, "auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_w_1476", "\"auto\": Treat files with imports, exports, import.meta, jsx (with jsx: react-jsx), or esm format (with module: node16+) as modules."),
|
|
5733
5737
|
An_instantiation_expression_cannot_be_followed_by_a_property_access: diag(1477, ts.DiagnosticCategory.Error, "An_instantiation_expression_cannot_be_followed_by_a_property_access_1477", "An instantiation expression cannot be followed by a property access."),
|
|
5738
|
+
Identifier_or_string_literal_expected: diag(1478, ts.DiagnosticCategory.Error, "Identifier_or_string_literal_expected_1478", "Identifier or string literal expected."),
|
|
5734
5739
|
The_types_of_0_are_incompatible_between_these_types: diag(2200, ts.DiagnosticCategory.Error, "The_types_of_0_are_incompatible_between_these_types_2200", "The types of '{0}' are incompatible between these types."),
|
|
5735
5740
|
The_types_returned_by_0_are_incompatible_between_these_types: diag(2201, ts.DiagnosticCategory.Error, "The_types_returned_by_0_are_incompatible_between_these_types_2201", "The types returned by '{0}' are incompatible between these types."),
|
|
5736
5741
|
Call_signature_return_types_0_and_1_are_incompatible: diag(2202, ts.DiagnosticCategory.Error, "Call_signature_return_types_0_and_1_are_incompatible_2202", "Call signature return types '{0}' and '{1}' are incompatible.", undefined, true),
|
|
@@ -5944,6 +5949,7 @@ var ts;
|
|
|
5944
5949
|
Cannot_create_an_instance_of_an_abstract_class: diag(2511, ts.DiagnosticCategory.Error, "Cannot_create_an_instance_of_an_abstract_class_2511", "Cannot create an instance of an abstract class."),
|
|
5945
5950
|
Overload_signatures_must_all_be_abstract_or_non_abstract: diag(2512, ts.DiagnosticCategory.Error, "Overload_signatures_must_all_be_abstract_or_non_abstract_2512", "Overload signatures must all be abstract or non-abstract."),
|
|
5946
5951
|
Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression: diag(2513, ts.DiagnosticCategory.Error, "Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression_2513", "Abstract method '{0}' in class '{1}' cannot be accessed via super expression."),
|
|
5952
|
+
A_tuple_type_cannot_be_indexed_with_a_negative_value: diag(2514, ts.DiagnosticCategory.Error, "A_tuple_type_cannot_be_indexed_with_a_negative_value_2514", "A tuple type cannot be indexed with a negative value."),
|
|
5947
5953
|
Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2: diag(2515, ts.DiagnosticCategory.Error, "Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2_2515", "Non-abstract class '{0}' does not implement inherited abstract member '{1}' from class '{2}'."),
|
|
5948
5954
|
All_declarations_of_an_abstract_method_must_be_consecutive: diag(2516, ts.DiagnosticCategory.Error, "All_declarations_of_an_abstract_method_must_be_consecutive_2516", "All declarations of an abstract method must be consecutive."),
|
|
5949
5955
|
Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type: diag(2517, ts.DiagnosticCategory.Error, "Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type_2517", "Cannot assign an abstract constructor type to a non-abstract constructor type."),
|
|
@@ -6810,6 +6816,7 @@ var ts;
|
|
|
6810
6816
|
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."),
|
|
6811
6817
|
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."),
|
|
6812
6818
|
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."),
|
|
6819
|
+
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."),
|
|
6813
6820
|
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'."),
|
|
6814
6821
|
one_of_Colon: diag(6900, ts.DiagnosticCategory.Message, "one_of_Colon_6900", "one of:"),
|
|
6815
6822
|
one_or_more_Colon: diag(6901, ts.DiagnosticCategory.Message, "one_or_more_Colon_6901", "one or more:"),
|
|
@@ -10947,7 +10954,8 @@ var ts;
|
|
|
10947
10954
|
}
|
|
10948
10955
|
ts.changesAffectModuleResolution = changesAffectModuleResolution;
|
|
10949
10956
|
function optionsHaveModuleResolutionChanges(oldOptions, newOptions) {
|
|
10950
|
-
return
|
|
10957
|
+
return oldOptions.pathsBasePath !== newOptions.pathsBasePath ||
|
|
10958
|
+
optionsHaveChanges(oldOptions, newOptions, ts.moduleResolutionOptionDeclarations);
|
|
10951
10959
|
}
|
|
10952
10960
|
ts.optionsHaveModuleResolutionChanges = optionsHaveModuleResolutionChanges;
|
|
10953
10961
|
function changesAffectingProgramStructure(oldOptions, newOptions) {
|
|
@@ -11019,21 +11027,20 @@ var ts;
|
|
|
11019
11027
|
}
|
|
11020
11028
|
ts.getFullWidth = getFullWidth;
|
|
11021
11029
|
function getResolvedModule(sourceFile, moduleNameText, mode) {
|
|
11022
|
-
|
|
11030
|
+
var _a, _b;
|
|
11031
|
+
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;
|
|
11023
11032
|
}
|
|
11024
11033
|
ts.getResolvedModule = getResolvedModule;
|
|
11025
11034
|
function setResolvedModule(sourceFile, moduleNameText, resolvedModule, mode) {
|
|
11026
|
-
|
|
11027
|
-
|
|
11028
|
-
}
|
|
11035
|
+
var _a;
|
|
11036
|
+
(_a = sourceFile.resolvedModules) !== null && _a !== void 0 ? _a : (sourceFile.resolvedModules = ts.createModeAwareCache());
|
|
11029
11037
|
sourceFile.resolvedModules.set(moduleNameText, mode, resolvedModule);
|
|
11030
11038
|
}
|
|
11031
11039
|
ts.setResolvedModule = setResolvedModule;
|
|
11032
|
-
function setResolvedTypeReferenceDirective(sourceFile, typeReferenceDirectiveName, resolvedTypeReferenceDirective) {
|
|
11033
|
-
|
|
11034
|
-
|
|
11035
|
-
|
|
11036
|
-
sourceFile.resolvedTypeReferenceDirectiveNames.set(typeReferenceDirectiveName, undefined, resolvedTypeReferenceDirective);
|
|
11040
|
+
function setResolvedTypeReferenceDirective(sourceFile, typeReferenceDirectiveName, resolvedTypeReferenceDirective, mode) {
|
|
11041
|
+
var _a;
|
|
11042
|
+
(_a = sourceFile.resolvedTypeReferenceDirectiveNames) !== null && _a !== void 0 ? _a : (sourceFile.resolvedTypeReferenceDirectiveNames = ts.createModeAwareCache());
|
|
11043
|
+
sourceFile.resolvedTypeReferenceDirectiveNames.set(typeReferenceDirectiveName, mode, resolvedTypeReferenceDirective);
|
|
11037
11044
|
}
|
|
11038
11045
|
ts.setResolvedTypeReferenceDirective = setResolvedTypeReferenceDirective;
|
|
11039
11046
|
function projectReferenceIsEqualTo(oldRef, newRef) {
|
|
@@ -11043,11 +11050,15 @@ var ts;
|
|
|
11043
11050
|
}
|
|
11044
11051
|
ts.projectReferenceIsEqualTo = projectReferenceIsEqualTo;
|
|
11045
11052
|
function moduleResolutionIsEqualTo(oldResolution, newResolution) {
|
|
11046
|
-
return oldResolution
|
|
11047
|
-
oldResolution.
|
|
11048
|
-
oldResolution.
|
|
11049
|
-
|
|
11050
|
-
|
|
11053
|
+
return oldResolution === newResolution ||
|
|
11054
|
+
oldResolution.resolvedModule === newResolution.resolvedModule ||
|
|
11055
|
+
!!oldResolution.resolvedModule &&
|
|
11056
|
+
!!newResolution.resolvedModule &&
|
|
11057
|
+
oldResolution.resolvedModule.isExternalLibraryImport === newResolution.resolvedModule.isExternalLibraryImport &&
|
|
11058
|
+
oldResolution.resolvedModule.extension === newResolution.resolvedModule.extension &&
|
|
11059
|
+
oldResolution.resolvedModule.resolvedFileName === newResolution.resolvedModule.resolvedFileName &&
|
|
11060
|
+
oldResolution.resolvedModule.originalPath === newResolution.resolvedModule.originalPath &&
|
|
11061
|
+
packageIdIsEqual(oldResolution.resolvedModule.packageId, newResolution.resolvedModule.packageId);
|
|
11051
11062
|
}
|
|
11052
11063
|
ts.moduleResolutionIsEqualTo = moduleResolutionIsEqualTo;
|
|
11053
11064
|
function packageIdIsEqual(a, b) {
|
|
@@ -11063,9 +11074,13 @@ var ts;
|
|
|
11063
11074
|
}
|
|
11064
11075
|
ts.packageIdToString = packageIdToString;
|
|
11065
11076
|
function typeDirectiveIsEqualTo(oldResolution, newResolution) {
|
|
11066
|
-
return oldResolution
|
|
11067
|
-
|
|
11068
|
-
|
|
11077
|
+
return oldResolution === newResolution ||
|
|
11078
|
+
oldResolution.resolvedTypeReferenceDirective === newResolution.resolvedTypeReferenceDirective ||
|
|
11079
|
+
!!oldResolution.resolvedTypeReferenceDirective &&
|
|
11080
|
+
!!newResolution.resolvedTypeReferenceDirective &&
|
|
11081
|
+
oldResolution.resolvedTypeReferenceDirective.resolvedFileName === newResolution.resolvedTypeReferenceDirective.resolvedFileName &&
|
|
11082
|
+
!!oldResolution.resolvedTypeReferenceDirective.primary === !!newResolution.resolvedTypeReferenceDirective.primary &&
|
|
11083
|
+
oldResolution.resolvedTypeReferenceDirective.originalPath === newResolution.resolvedTypeReferenceDirective.originalPath;
|
|
11069
11084
|
}
|
|
11070
11085
|
ts.typeDirectiveIsEqualTo = typeDirectiveIsEqualTo;
|
|
11071
11086
|
function hasChangesInResolutions(names, newResolutions, oldResolutions, oldSourceFile, comparer) {
|
|
@@ -15264,22 +15279,20 @@ var ts;
|
|
|
15264
15279
|
return getStringFromExpandedCharCodes(expandedCharCodes);
|
|
15265
15280
|
}
|
|
15266
15281
|
ts.base64decode = base64decode;
|
|
15267
|
-
function
|
|
15268
|
-
|
|
15269
|
-
|
|
15270
|
-
|
|
15271
|
-
|
|
15272
|
-
|
|
15273
|
-
|
|
15274
|
-
|
|
15275
|
-
|
|
15276
|
-
return result.config;
|
|
15277
|
-
}
|
|
15278
|
-
catch (e) {
|
|
15282
|
+
function readJsonIgnoringErrors(path, host) {
|
|
15283
|
+
return readJsonIgnoringErrorsFromText(path, host.readFile(path));
|
|
15284
|
+
}
|
|
15285
|
+
ts.readJsonIgnoringErrors = readJsonIgnoringErrors;
|
|
15286
|
+
function readJsonIgnoringErrorsFromText(path, jsonText) {
|
|
15287
|
+
if (!jsonText)
|
|
15288
|
+
return {};
|
|
15289
|
+
var result = ts.parseConfigFileTextToJson(path, jsonText);
|
|
15290
|
+
if (result.error) {
|
|
15279
15291
|
return {};
|
|
15280
15292
|
}
|
|
15293
|
+
return result.config;
|
|
15281
15294
|
}
|
|
15282
|
-
ts.
|
|
15295
|
+
ts.readJsonIgnoringErrorsFromText = readJsonIgnoringErrorsFromText;
|
|
15283
15296
|
function directoryProbablyExists(directoryName, host) {
|
|
15284
15297
|
return !host.directoryExists || host.directoryExists(directoryName);
|
|
15285
15298
|
}
|
|
@@ -16257,14 +16270,15 @@ var ts;
|
|
|
16257
16270
|
},
|
|
16258
16271
|
setSymlinksFromResolutions: function (files, typeReferenceDirectives) {
|
|
16259
16272
|
var _this = this;
|
|
16260
|
-
var _a;
|
|
16273
|
+
var _a, _b;
|
|
16261
16274
|
ts.Debug.assert(!hasProcessedResolutions);
|
|
16262
16275
|
hasProcessedResolutions = true;
|
|
16263
16276
|
for (var _i = 0, files_1 = files; _i < files_1.length; _i++) {
|
|
16264
16277
|
var file = files_1[_i];
|
|
16265
|
-
(_a = file.resolvedModules) === null || _a === void 0 ? void 0 : _a.forEach(function (resolution) { return processResolution(_this, resolution); });
|
|
16278
|
+
(_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); });
|
|
16279
|
+
(_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); });
|
|
16266
16280
|
}
|
|
16267
|
-
typeReferenceDirectives
|
|
16281
|
+
typeReferenceDirectives.forEach(function (resolution) { return processResolution(_this, resolution.resolvedTypeReferenceDirective); });
|
|
16268
16282
|
},
|
|
16269
16283
|
hasProcessedResolutions: function () { return hasProcessedResolutions; },
|
|
16270
16284
|
};
|
|
@@ -26880,7 +26894,9 @@ var ts;
|
|
|
26880
26894
|
case 23: return parseErrorAtCurrentToken(ts.Diagnostics.Identifier_expected);
|
|
26881
26895
|
case 13: return parseErrorAtCurrentToken(ts.Diagnostics.Identifier_expected);
|
|
26882
26896
|
case 14: return parseErrorAtCurrentToken(ts.Diagnostics.Identifier_expected);
|
|
26883
|
-
|
|
26897
|
+
case 24: return parseErrorAtCurrentToken(ts.Diagnostics.Identifier_or_string_literal_expected);
|
|
26898
|
+
case 25: return ts.Debug.fail("ParsingContext.Count used as a context");
|
|
26899
|
+
default: ts.Debug.assertNever(context);
|
|
26884
26900
|
}
|
|
26885
26901
|
}
|
|
26886
26902
|
function parseDelimitedList(kind, parseElement, considerSemicolonAsDelimiter) {
|
|
@@ -32169,6 +32185,17 @@ var ts;
|
|
|
32169
32185
|
transpileOptionValue: undefined,
|
|
32170
32186
|
defaultValueDescription: ts.Diagnostics.false_unless_composite_is_set
|
|
32171
32187
|
},
|
|
32188
|
+
{
|
|
32189
|
+
name: "cacheResolutions",
|
|
32190
|
+
type: "boolean",
|
|
32191
|
+
category: ts.Diagnostics.Projects,
|
|
32192
|
+
description: ts.Diagnostics.Save_resolutions_into_tsbuildinfo_file_and_use_them_for_incremental_compilation,
|
|
32193
|
+
affectsModuleResolution: true,
|
|
32194
|
+
affectsMultiFileEmitBuildInfo: true,
|
|
32195
|
+
affectsBundleEmitBuildInfo: true,
|
|
32196
|
+
transpileOptionValue: undefined,
|
|
32197
|
+
defaultValueDescription: false,
|
|
32198
|
+
},
|
|
32172
32199
|
{
|
|
32173
32200
|
name: "assumeChangesOnlyAffectDirectDependencies",
|
|
32174
32201
|
type: "boolean",
|
|
@@ -34125,6 +34152,9 @@ var ts;
|
|
|
34125
34152
|
if (result.configFilePath) {
|
|
34126
34153
|
result.configFilePath = toAbsolutePath(result.configFilePath);
|
|
34127
34154
|
}
|
|
34155
|
+
if (result.pathsBasePath) {
|
|
34156
|
+
result.pathsBasePath = toAbsolutePath(result.pathsBasePath);
|
|
34157
|
+
}
|
|
34128
34158
|
return result;
|
|
34129
34159
|
}
|
|
34130
34160
|
ts.convertToOptionsWithAbsolutePaths = convertToOptionsWithAbsolutePaths;
|
|
@@ -34950,20 +34980,35 @@ var ts;
|
|
|
34950
34980
|
ts.Debug.assert(ts.extensionIsTS(resolved.extension));
|
|
34951
34981
|
return { fileName: resolved.path, packageId: resolved.packageId };
|
|
34952
34982
|
}
|
|
34953
|
-
function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, resultFromCache) {
|
|
34954
|
-
var _a
|
|
34983
|
+
function createResolvedModuleWithFailedLookupLocations(compilerOptions, resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, resultFromCache) {
|
|
34984
|
+
var _a;
|
|
34985
|
+
var _b;
|
|
34955
34986
|
if (resultFromCache) {
|
|
34956
|
-
(
|
|
34957
|
-
|
|
34987
|
+
if ((!compilerOptions.cacheResolutions || !((_b = resultFromCache.resolvedModule) === null || _b === void 0 ? void 0 : _b.resolvedFileName)) && failedLookupLocations.length)
|
|
34988
|
+
(_a = resultFromCache.failedLookupLocations).push.apply(_a, failedLookupLocations);
|
|
34989
|
+
resultFromCache.affectingLocations = updateResolutionField(resultFromCache.affectingLocations, affectingLocations);
|
|
34990
|
+
resultFromCache.resolutionDiagnostics = updateResolutionField(resultFromCache.resolutionDiagnostics, diagnostics);
|
|
34958
34991
|
return resultFromCache;
|
|
34959
34992
|
}
|
|
34960
34993
|
return {
|
|
34961
34994
|
resolvedModule: resolved && { resolvedFileName: resolved.path, originalPath: resolved.originalPath === true ? undefined : resolved.originalPath, extension: resolved.extension, isExternalLibraryImport: isExternalLibraryImport, packageId: resolved.packageId },
|
|
34962
|
-
failedLookupLocations: failedLookupLocations,
|
|
34963
|
-
affectingLocations: affectingLocations,
|
|
34964
|
-
resolutionDiagnostics: diagnostics,
|
|
34995
|
+
failedLookupLocations: !compilerOptions.cacheResolutions || !(resolved === null || resolved === void 0 ? void 0 : resolved.path) ? failedLookupLocations : ts.emptyArray,
|
|
34996
|
+
affectingLocations: initializeResolutionField(affectingLocations),
|
|
34997
|
+
resolutionDiagnostics: initializeResolutionField(diagnostics),
|
|
34965
34998
|
};
|
|
34966
34999
|
}
|
|
35000
|
+
function initializeResolutionField(value) {
|
|
35001
|
+
return value.length ? value : undefined;
|
|
35002
|
+
}
|
|
35003
|
+
function updateResolutionField(to, value) {
|
|
35004
|
+
if (!(value === null || value === void 0 ? void 0 : value.length))
|
|
35005
|
+
return to;
|
|
35006
|
+
if (!(to === null || to === void 0 ? void 0 : to.length))
|
|
35007
|
+
return value;
|
|
35008
|
+
to.push.apply(to, value);
|
|
35009
|
+
return to;
|
|
35010
|
+
}
|
|
35011
|
+
ts.updateResolutionField = updateResolutionField;
|
|
34967
35012
|
function readPackageJsonField(jsonContent, fieldName, typeOfTag, state) {
|
|
34968
35013
|
if (!ts.hasProperty(jsonContent, fieldName)) {
|
|
34969
35014
|
if (state.traceEnabled) {
|
|
@@ -35102,8 +35147,7 @@ var ts;
|
|
|
35102
35147
|
options = redirectedReference.commandLine.options;
|
|
35103
35148
|
}
|
|
35104
35149
|
var containingDirectory = containingFile ? ts.getDirectoryPath(containingFile) : undefined;
|
|
35105
|
-
var
|
|
35106
|
-
var result = perFolderCache && perFolderCache.get(typeReferenceDirectiveName, resolutionMode);
|
|
35150
|
+
var result = containingDirectory ? cache === null || cache === void 0 ? void 0 : cache.getFromCache(containingDirectory, typeReferenceDirectiveName, resolutionMode, redirectedReference) : undefined;
|
|
35107
35151
|
if (result) {
|
|
35108
35152
|
if (traceEnabled) {
|
|
35109
35153
|
trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_1, typeReferenceDirectiveName, containingFile);
|
|
@@ -35154,7 +35198,7 @@ var ts;
|
|
|
35154
35198
|
features: features,
|
|
35155
35199
|
conditions: conditions,
|
|
35156
35200
|
requestContainingDirectory: containingDirectory,
|
|
35157
|
-
|
|
35201
|
+
reportResolutionDiagnostic: function (diag) { return void diagnostics.push(diag); },
|
|
35158
35202
|
};
|
|
35159
35203
|
var resolved = primaryLookup();
|
|
35160
35204
|
var primary = true;
|
|
@@ -35174,8 +35218,15 @@ var ts;
|
|
|
35174
35218
|
isExternalLibraryImport: pathContainsNodeModules(fileName),
|
|
35175
35219
|
};
|
|
35176
35220
|
}
|
|
35177
|
-
result = {
|
|
35178
|
-
|
|
35221
|
+
result = {
|
|
35222
|
+
resolvedTypeReferenceDirective: resolvedTypeReferenceDirective,
|
|
35223
|
+
failedLookupLocations: !options.cacheResolutions || !(resolvedTypeReferenceDirective === null || resolvedTypeReferenceDirective === void 0 ? void 0 : resolvedTypeReferenceDirective.resolvedFileName) ? failedLookupLocations : ts.emptyArray,
|
|
35224
|
+
affectingLocations: initializeResolutionField(affectingLocations),
|
|
35225
|
+
resolutionDiagnostics: initializeResolutionField(diagnostics),
|
|
35226
|
+
};
|
|
35227
|
+
if (containingDirectory && cache) {
|
|
35228
|
+
cache.getOrCreateCacheForDirectory(containingDirectory, redirectedReference).set(typeReferenceDirectiveName, resolutionMode, result);
|
|
35229
|
+
}
|
|
35179
35230
|
if (traceEnabled)
|
|
35180
35231
|
traceResult(result);
|
|
35181
35232
|
return result;
|
|
@@ -35185,10 +35236,10 @@ var ts;
|
|
|
35185
35236
|
trace(host, ts.Diagnostics.Type_reference_directive_0_was_not_resolved, typeReferenceDirectiveName);
|
|
35186
35237
|
}
|
|
35187
35238
|
else if (result.resolvedTypeReferenceDirective.packageId) {
|
|
35188
|
-
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);
|
|
35239
|
+
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);
|
|
35189
35240
|
}
|
|
35190
35241
|
else {
|
|
35191
|
-
trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2, typeReferenceDirectiveName, result.resolvedTypeReferenceDirective.resolvedFileName, result.resolvedTypeReferenceDirective.primary);
|
|
35242
|
+
trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2, typeReferenceDirectiveName, result.resolvedTypeReferenceDirective.resolvedFileName, !!result.resolvedTypeReferenceDirective.primary);
|
|
35192
35243
|
}
|
|
35193
35244
|
}
|
|
35194
35245
|
function primaryLookup() {
|
|
@@ -35243,18 +35294,7 @@ var ts;
|
|
|
35243
35294
|
NodeResolutionFeatures.None;
|
|
35244
35295
|
}
|
|
35245
35296
|
function resolvePackageNameToPackageJson(packageName, containingDirectory, options, host, cache) {
|
|
35246
|
-
var moduleResolutionState =
|
|
35247
|
-
compilerOptions: options,
|
|
35248
|
-
host: host,
|
|
35249
|
-
traceEnabled: isTraceEnabled(options, host),
|
|
35250
|
-
failedLookupLocations: [],
|
|
35251
|
-
affectingLocations: [],
|
|
35252
|
-
packageJsonInfoCache: cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(),
|
|
35253
|
-
conditions: ts.emptyArray,
|
|
35254
|
-
features: NodeResolutionFeatures.None,
|
|
35255
|
-
requestContainingDirectory: containingDirectory,
|
|
35256
|
-
reportDiagnostic: ts.noop
|
|
35257
|
-
};
|
|
35297
|
+
var moduleResolutionState = getTemporaryModuleResolutionState(cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(), host, options);
|
|
35258
35298
|
return ts.forEachAncestorDirectory(containingDirectory, function (ancestorDirectory) {
|
|
35259
35299
|
if (ts.getBaseFileName(ancestorDirectory) !== "node_modules") {
|
|
35260
35300
|
var nodeModulesFolder = ts.combinePaths(ancestorDirectory, "node_modules");
|
|
@@ -35279,7 +35319,7 @@ var ts;
|
|
|
35279
35319
|
var typeDirectivePath = _b[_a];
|
|
35280
35320
|
var normalized = ts.normalizePath(typeDirectivePath);
|
|
35281
35321
|
var packageJsonPath = ts.combinePaths(root, normalized, "package.json");
|
|
35282
|
-
var isNotNeededPackage = host.fileExists(packageJsonPath) && ts.
|
|
35322
|
+
var isNotNeededPackage = host.fileExists(packageJsonPath) && ts.readJsonIgnoringErrors(packageJsonPath, host).typings === null;
|
|
35283
35323
|
if (!isNotNeededPackage) {
|
|
35284
35324
|
var baseFileName = ts.getBaseFileName(normalized);
|
|
35285
35325
|
if (baseFileName.charCodeAt(0) !== 46) {
|
|
@@ -35294,47 +35334,138 @@ var ts;
|
|
|
35294
35334
|
return result;
|
|
35295
35335
|
}
|
|
35296
35336
|
ts.getAutomaticTypeDirectiveNames = getAutomaticTypeDirectiveNames;
|
|
35297
|
-
function
|
|
35298
|
-
var
|
|
35337
|
+
function compilerOptionValueToString(value) {
|
|
35338
|
+
var _a;
|
|
35339
|
+
if (value === null || typeof value !== "object") {
|
|
35340
|
+
return "" + value;
|
|
35341
|
+
}
|
|
35342
|
+
if (ts.isArray(value)) {
|
|
35343
|
+
return "[" + ((_a = ts.map(value, function (e) { return compilerOptionValueToString(e); })) === null || _a === void 0 ? void 0 : _a.join(",")) + "]";
|
|
35344
|
+
}
|
|
35345
|
+
var str = "{";
|
|
35346
|
+
for (var key in value) {
|
|
35347
|
+
if (ts.hasProperty(value, key)) {
|
|
35348
|
+
str += key + ": " + compilerOptionValueToString(value[key]);
|
|
35349
|
+
}
|
|
35350
|
+
}
|
|
35351
|
+
return str + "}";
|
|
35352
|
+
}
|
|
35353
|
+
function getKeyForCompilationSettings(settings, options) {
|
|
35354
|
+
return options.map(function (option) { return compilerOptionValueToString(ts.getCompilerOptionValue(settings, option)); }).join("|") + ("|" + settings.pathsBasePath);
|
|
35355
|
+
}
|
|
35356
|
+
ts.getKeyForCompilationSettings = getKeyForCompilationSettings;
|
|
35357
|
+
function getRedirectsCacheKey(options) {
|
|
35358
|
+
return getKeyForCompilationSettings(options, ts.moduleResolutionOptionDeclarations);
|
|
35359
|
+
}
|
|
35360
|
+
ts.getRedirectsCacheKey = getRedirectsCacheKey;
|
|
35361
|
+
function createCacheWithRedirects(ownOptions) {
|
|
35362
|
+
var ownMap;
|
|
35363
|
+
var ownKey;
|
|
35364
|
+
var redirectsKeyToCache = new ts.Map();
|
|
35299
35365
|
var redirectsMap = new ts.Map();
|
|
35300
35366
|
return {
|
|
35301
35367
|
getOwnMap: getOwnMap,
|
|
35302
|
-
|
|
35368
|
+
redirectsKeyToCache: redirectsKeyToCache,
|
|
35369
|
+
createMapForCompilerOptions: createMapForCompilerOptions,
|
|
35370
|
+
getMapOfCacheRedirects: getMapOfCacheRedirects,
|
|
35303
35371
|
getOrCreateMapOfCacheRedirects: getOrCreateMapOfCacheRedirects,
|
|
35304
35372
|
clear: clear,
|
|
35305
|
-
|
|
35306
|
-
|
|
35373
|
+
update: update,
|
|
35374
|
+
clearRedirectsMap: function () { return redirectsMap.clear(); },
|
|
35307
35375
|
};
|
|
35308
|
-
function
|
|
35309
|
-
|
|
35376
|
+
function ensureOwnKeyCached() {
|
|
35377
|
+
ownKey !== null && ownKey !== void 0 ? ownKey : (ownKey = ownOptions && getRedirectsCacheKey(ownOptions));
|
|
35378
|
+
if (ownKey && !redirectsKeyToCache.has(ownKey))
|
|
35379
|
+
redirectsKeyToCache.set(ownKey, { map: ownMap !== null && ownMap !== void 0 ? ownMap : (ownMap = new ts.Map()), options: ownOptions });
|
|
35310
35380
|
}
|
|
35311
|
-
function
|
|
35312
|
-
options
|
|
35381
|
+
function createMapForCompilerOptions(options, optionsKey) {
|
|
35382
|
+
if (options === ownOptions)
|
|
35383
|
+
return ownMap !== null && ownMap !== void 0 ? ownMap : (ownMap = new ts.Map());
|
|
35384
|
+
return getOrCreateRedirectMapAndKey(options, undefined, optionsKey);
|
|
35385
|
+
}
|
|
35386
|
+
function getOrCreateRedirectMapAndKey(options, path, optionsKey) {
|
|
35387
|
+
var _a;
|
|
35388
|
+
if (path || options.configFile) {
|
|
35389
|
+
var redirects = redirectsMap.get(path || options.configFile.path);
|
|
35390
|
+
if (redirects)
|
|
35391
|
+
return redirects;
|
|
35392
|
+
}
|
|
35393
|
+
var key = optionsKey || getRedirectsCacheKey(options);
|
|
35394
|
+
var map = (_a = redirectsKeyToCache.get(key)) === null || _a === void 0 ? void 0 : _a.map;
|
|
35395
|
+
if (!map) {
|
|
35396
|
+
ensureOwnKeyCached();
|
|
35397
|
+
if (ownKey === key) {
|
|
35398
|
+
map = ownMap;
|
|
35399
|
+
}
|
|
35400
|
+
else {
|
|
35401
|
+
redirectsKeyToCache.set(key, { map: map = new ts.Map(), options: options });
|
|
35402
|
+
}
|
|
35403
|
+
}
|
|
35404
|
+
if (path || options.configFile)
|
|
35405
|
+
redirectsMap.set(path || options.configFile.path, map);
|
|
35406
|
+
return map;
|
|
35313
35407
|
}
|
|
35314
|
-
function
|
|
35315
|
-
ownMap =
|
|
35408
|
+
function getOwnMap() {
|
|
35409
|
+
return ownMap !== null && ownMap !== void 0 ? ownMap : (ownMap = new ts.Map());
|
|
35316
35410
|
}
|
|
35317
|
-
function
|
|
35318
|
-
if (
|
|
35319
|
-
|
|
35411
|
+
function update(newOwnOptions) {
|
|
35412
|
+
if (ownMap && (ownOptions === null || ownOptions === void 0 ? void 0 : ownOptions.configFile)) {
|
|
35413
|
+
ensureOwnKeyCached();
|
|
35414
|
+
if (!redirectsMap.has(ownOptions.configFile.path)) {
|
|
35415
|
+
redirectsMap.set(ownOptions.configFile.path, ownMap);
|
|
35416
|
+
}
|
|
35417
|
+
}
|
|
35418
|
+
if (newOwnOptions.configFile) {
|
|
35419
|
+
var existing_1 = redirectsMap.get(newOwnOptions.configFile.path);
|
|
35420
|
+
if (existing_1) {
|
|
35421
|
+
ownMap = existing_1;
|
|
35422
|
+
ownOptions = newOwnOptions;
|
|
35423
|
+
return;
|
|
35424
|
+
}
|
|
35320
35425
|
}
|
|
35321
|
-
var
|
|
35322
|
-
var
|
|
35323
|
-
|
|
35324
|
-
|
|
35325
|
-
|
|
35426
|
+
var key = getRedirectsCacheKey(newOwnOptions);
|
|
35427
|
+
var existing = redirectsKeyToCache.get(key);
|
|
35428
|
+
ownMap = (existing === null || existing === void 0 ? void 0 : existing.map) || new ts.Map();
|
|
35429
|
+
ownKey = key;
|
|
35430
|
+
ownOptions = newOwnOptions;
|
|
35431
|
+
if (newOwnOptions.configFile)
|
|
35432
|
+
redirectsMap.set(newOwnOptions.configFile.path, ownMap);
|
|
35433
|
+
}
|
|
35434
|
+
function getMapOfCacheRedirects(redirectedReference) {
|
|
35435
|
+
if (!redirectedReference)
|
|
35436
|
+
return ownMap;
|
|
35437
|
+
var directResult = redirectsMap.get(redirectedReference.sourceFile.path);
|
|
35438
|
+
if (directResult)
|
|
35439
|
+
return directResult;
|
|
35440
|
+
var key = getRedirectsCacheKey(redirectedReference.commandLine.options);
|
|
35441
|
+
var fromKey = redirectsKeyToCache.get(key);
|
|
35442
|
+
if (fromKey) {
|
|
35443
|
+
redirectsMap.set(redirectedReference.sourceFile.path, fromKey.map);
|
|
35444
|
+
return fromKey.map;
|
|
35445
|
+
}
|
|
35446
|
+
if (ownMap)
|
|
35447
|
+
ensureOwnKeyCached();
|
|
35448
|
+
if (ownKey === key) {
|
|
35449
|
+
redirectsMap.set(redirectedReference.sourceFile.path, ownMap);
|
|
35450
|
+
return ownMap;
|
|
35326
35451
|
}
|
|
35327
|
-
return
|
|
35452
|
+
return undefined;
|
|
35453
|
+
}
|
|
35454
|
+
function getOrCreateMapOfCacheRedirects(redirectedReference) {
|
|
35455
|
+
return !redirectedReference || redirectedReference.commandLine.options === ownOptions ?
|
|
35456
|
+
getOwnMap() :
|
|
35457
|
+
getOrCreateRedirectMapAndKey(redirectedReference.commandLine.options, redirectedReference.sourceFile.path, undefined);
|
|
35328
35458
|
}
|
|
35329
35459
|
function clear() {
|
|
35330
|
-
|
|
35460
|
+
ownKey = undefined;
|
|
35461
|
+
ownMap = undefined;
|
|
35331
35462
|
redirectsMap.clear();
|
|
35463
|
+
redirectsKeyToCache.clear();
|
|
35332
35464
|
}
|
|
35333
35465
|
}
|
|
35334
35466
|
ts.createCacheWithRedirects = createCacheWithRedirects;
|
|
35335
|
-
function createPackageJsonInfoCache(currentDirectory, getCanonicalFileName) {
|
|
35336
|
-
|
|
35337
|
-
return { getPackageJsonInfo: getPackageJsonInfo, setPackageJsonInfo: setPackageJsonInfo, clear: clear, entries: entries };
|
|
35467
|
+
function createPackageJsonInfoCache(currentDirectory, getCanonicalFileName, cache) {
|
|
35468
|
+
return { getPackageJsonInfo: getPackageJsonInfo, setPackageJsonInfo: setPackageJsonInfo, clear: clear, entries: entries, clone: clone };
|
|
35338
35469
|
function getPackageJsonInfo(packageJsonPath) {
|
|
35339
35470
|
return cache === null || cache === void 0 ? void 0 : cache.get(ts.toPath(packageJsonPath, currentDirectory, getCanonicalFileName));
|
|
35340
35471
|
}
|
|
@@ -35348,6 +35479,9 @@ var ts;
|
|
|
35348
35479
|
var iter = cache === null || cache === void 0 ? void 0 : cache.entries();
|
|
35349
35480
|
return iter ? ts.arrayFrom(iter) : [];
|
|
35350
35481
|
}
|
|
35482
|
+
function clone() {
|
|
35483
|
+
return createPackageJsonInfoCache(currentDirectory, getCanonicalFileName, cache && new ts.Map(cache));
|
|
35484
|
+
}
|
|
35351
35485
|
}
|
|
35352
35486
|
function getOrCreateCache(cacheWithRedirects, redirectedReference, key, create) {
|
|
35353
35487
|
var cache = cacheWithRedirects.getOrCreateMapOfCacheRedirects(redirectedReference);
|
|
@@ -35358,45 +35492,42 @@ var ts;
|
|
|
35358
35492
|
}
|
|
35359
35493
|
return result;
|
|
35360
35494
|
}
|
|
35361
|
-
function updateRedirectsMap(options, directoryToModuleNameMap, moduleNameToDirectoryMap) {
|
|
35362
|
-
if (!options.configFile)
|
|
35363
|
-
return;
|
|
35364
|
-
if (directoryToModuleNameMap.redirectsMap.size === 0) {
|
|
35365
|
-
ts.Debug.assert(!moduleNameToDirectoryMap || moduleNameToDirectoryMap.redirectsMap.size === 0);
|
|
35366
|
-
ts.Debug.assert(directoryToModuleNameMap.getOwnMap().size === 0);
|
|
35367
|
-
ts.Debug.assert(!moduleNameToDirectoryMap || moduleNameToDirectoryMap.getOwnMap().size === 0);
|
|
35368
|
-
directoryToModuleNameMap.redirectsMap.set(options.configFile.path, directoryToModuleNameMap.getOwnMap());
|
|
35369
|
-
moduleNameToDirectoryMap === null || moduleNameToDirectoryMap === void 0 ? void 0 : moduleNameToDirectoryMap.redirectsMap.set(options.configFile.path, moduleNameToDirectoryMap.getOwnMap());
|
|
35370
|
-
}
|
|
35371
|
-
else {
|
|
35372
|
-
ts.Debug.assert(!moduleNameToDirectoryMap || moduleNameToDirectoryMap.redirectsMap.size > 0);
|
|
35373
|
-
var ref = {
|
|
35374
|
-
sourceFile: options.configFile,
|
|
35375
|
-
commandLine: { options: options }
|
|
35376
|
-
};
|
|
35377
|
-
directoryToModuleNameMap.setOwnMap(directoryToModuleNameMap.getOrCreateMapOfCacheRedirects(ref));
|
|
35378
|
-
moduleNameToDirectoryMap === null || moduleNameToDirectoryMap === void 0 ? void 0 : moduleNameToDirectoryMap.setOwnMap(moduleNameToDirectoryMap.getOrCreateMapOfCacheRedirects(ref));
|
|
35379
|
-
}
|
|
35380
|
-
directoryToModuleNameMap.setOwnOptions(options);
|
|
35381
|
-
moduleNameToDirectoryMap === null || moduleNameToDirectoryMap === void 0 ? void 0 : moduleNameToDirectoryMap.setOwnOptions(options);
|
|
35382
|
-
}
|
|
35383
35495
|
function createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, directoryToModuleNameMap) {
|
|
35496
|
+
var oldResolutionCache;
|
|
35384
35497
|
return {
|
|
35498
|
+
getFromCache: getFromCache,
|
|
35385
35499
|
getOrCreateCacheForDirectory: getOrCreateCacheForDirectory,
|
|
35386
35500
|
clear: clear,
|
|
35387
35501
|
update: update,
|
|
35502
|
+
setOldResolutionCache: function (cache) { return oldResolutionCache = cache; }
|
|
35388
35503
|
};
|
|
35389
35504
|
function clear() {
|
|
35505
|
+
oldResolutionCache = undefined;
|
|
35390
35506
|
directoryToModuleNameMap.clear();
|
|
35391
35507
|
}
|
|
35392
35508
|
function update(options) {
|
|
35393
|
-
|
|
35509
|
+
directoryToModuleNameMap.update(options);
|
|
35394
35510
|
}
|
|
35395
35511
|
function getOrCreateCacheForDirectory(directoryName, redirectedReference) {
|
|
35396
35512
|
var path = ts.toPath(directoryName, currentDirectory, getCanonicalFileName);
|
|
35397
|
-
return getOrCreateCache(directoryToModuleNameMap, redirectedReference, path,
|
|
35513
|
+
return getOrCreateCache(directoryToModuleNameMap, redirectedReference, path, createModeAwareCache);
|
|
35514
|
+
}
|
|
35515
|
+
function getFromCache(directoryName, name, mode, redirectedReference) {
|
|
35516
|
+
var _a, _b;
|
|
35517
|
+
var path = ts.toPath(directoryName, currentDirectory, getCanonicalFileName);
|
|
35518
|
+
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);
|
|
35519
|
+
if (result)
|
|
35520
|
+
return result;
|
|
35521
|
+
var resultFromOld = oldResolutionCache === null || oldResolutionCache === void 0 ? void 0 : oldResolutionCache.getResolved(path, name, mode, redirectedReference);
|
|
35522
|
+
if (resultFromOld)
|
|
35523
|
+
getOrCreateCacheForDirectory(directoryName, redirectedReference).set(name, mode, resultFromOld);
|
|
35524
|
+
return resultFromOld;
|
|
35398
35525
|
}
|
|
35399
35526
|
}
|
|
35527
|
+
function getModeAwareCacheKey(specifier, mode) {
|
|
35528
|
+
return (mode === undefined ? specifier : mode + "|" + specifier);
|
|
35529
|
+
}
|
|
35530
|
+
ts.getModeAwareCacheKey = getModeAwareCacheKey;
|
|
35400
35531
|
function createModeAwareCache() {
|
|
35401
35532
|
var underlying = new ts.Map();
|
|
35402
35533
|
var memoizedReverseKeys = new ts.Map();
|
|
@@ -35421,13 +35552,22 @@ var ts;
|
|
|
35421
35552
|
return cb(elem, specifier, mode);
|
|
35422
35553
|
});
|
|
35423
35554
|
},
|
|
35555
|
+
entries: function () {
|
|
35556
|
+
var keys = underlying.entries();
|
|
35557
|
+
return {
|
|
35558
|
+
next: function () {
|
|
35559
|
+
var next = keys.next();
|
|
35560
|
+
return !next.done ? { value: __spreadArray(__spreadArray([], memoizedReverseKeys.get(next.value[0]), true), [next.value[1]], false) } : next;
|
|
35561
|
+
},
|
|
35562
|
+
};
|
|
35563
|
+
},
|
|
35424
35564
|
size: function () {
|
|
35425
35565
|
return underlying.size;
|
|
35426
|
-
}
|
|
35566
|
+
},
|
|
35427
35567
|
};
|
|
35428
35568
|
return cache;
|
|
35429
35569
|
function getUnderlyingCacheKey(specifier, mode) {
|
|
35430
|
-
var result =
|
|
35570
|
+
var result = getModeAwareCacheKey(specifier, mode);
|
|
35431
35571
|
memoizedReverseKeys.set(result, [specifier, mode]);
|
|
35432
35572
|
return result;
|
|
35433
35573
|
}
|
|
@@ -35438,80 +35578,113 @@ var ts;
|
|
|
35438
35578
|
var map = createModeAwareCache();
|
|
35439
35579
|
for (var i = 0; i < keys.length; ++i) {
|
|
35440
35580
|
var entry = keys[i];
|
|
35441
|
-
var name = !ts.isString(entry) ? entry.fileName
|
|
35581
|
+
var name = !ts.isString(entry) ? ts.toFileNameLowerCase(entry.fileName) : entry;
|
|
35442
35582
|
var mode = !ts.isString(entry) ? entry.resolutionMode || file.impliedNodeFormat : ts.getModeForResolutionAtIndex(file, i);
|
|
35443
35583
|
map.set(name, mode, values[i]);
|
|
35444
35584
|
}
|
|
35445
35585
|
return map;
|
|
35446
35586
|
}
|
|
35447
35587
|
ts.zipToModeAwareCache = zipToModeAwareCache;
|
|
35448
|
-
function
|
|
35449
|
-
var
|
|
35450
|
-
|
|
35588
|
+
function getCommonPrefix(directory, resolution, toPath) {
|
|
35589
|
+
var resolutionDirectory = toPath(ts.getDirectoryPath(resolution));
|
|
35590
|
+
var i = 0;
|
|
35591
|
+
var limit = Math.min(directory.length, resolutionDirectory.length);
|
|
35592
|
+
while (i < limit && directory.charCodeAt(i) === resolutionDirectory.charCodeAt(i)) {
|
|
35593
|
+
i++;
|
|
35594
|
+
}
|
|
35595
|
+
if (i === directory.length && (resolutionDirectory.length === i || resolutionDirectory[i] === ts.directorySeparator)) {
|
|
35596
|
+
return directory;
|
|
35597
|
+
}
|
|
35598
|
+
var rootLength = ts.getRootLength(directory);
|
|
35599
|
+
if (i < rootLength) {
|
|
35600
|
+
return undefined;
|
|
35601
|
+
}
|
|
35602
|
+
var sep = directory.lastIndexOf(ts.directorySeparator, i - 1);
|
|
35603
|
+
if (sep === -1) {
|
|
35604
|
+
return undefined;
|
|
35605
|
+
}
|
|
35606
|
+
return directory.substr(0, Math.max(sep, rootLength));
|
|
35607
|
+
}
|
|
35608
|
+
function getResolvedFileNameForModuleNameToDirectorySet(result) {
|
|
35609
|
+
return result.resolvedModule &&
|
|
35610
|
+
(result.resolvedModule.originalPath || result.resolvedModule.resolvedFileName);
|
|
35611
|
+
}
|
|
35612
|
+
ts.getResolvedFileNameForModuleNameToDirectorySet = getResolvedFileNameForModuleNameToDirectorySet;
|
|
35613
|
+
function moduleNameToDirectorySet(directoryPathMap, directory, result, getResolvedFileName, toPath, ancestoryWorker) {
|
|
35614
|
+
if (directoryPathMap.has(directory))
|
|
35615
|
+
return;
|
|
35616
|
+
directoryPathMap.set(directory, result);
|
|
35617
|
+
var resolvedFileName = getResolvedFileName(result);
|
|
35618
|
+
var commonPrefix = resolvedFileName && getCommonPrefix(directory, resolvedFileName, toPath);
|
|
35619
|
+
var current = directory;
|
|
35620
|
+
while (current !== commonPrefix) {
|
|
35621
|
+
var parent = ts.getDirectoryPath(current);
|
|
35622
|
+
if (parent === current)
|
|
35623
|
+
break;
|
|
35624
|
+
if (directoryPathMap.has(parent)) {
|
|
35625
|
+
ancestoryWorker(parent);
|
|
35626
|
+
break;
|
|
35627
|
+
}
|
|
35628
|
+
directoryPathMap.set(parent, result);
|
|
35629
|
+
ancestoryWorker(parent);
|
|
35630
|
+
current = parent;
|
|
35631
|
+
}
|
|
35632
|
+
}
|
|
35633
|
+
ts.moduleNameToDirectorySet = moduleNameToDirectorySet;
|
|
35634
|
+
function createModuleResolutionCache(currentDirectory, getCanonicalFileName, options) {
|
|
35635
|
+
var directoryToModuleNameMap = createCacheWithRedirects(options);
|
|
35636
|
+
var moduleNameToDirectoryMap = createCacheWithRedirects(options);
|
|
35637
|
+
var perDirectoryResolutionCache = createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, directoryToModuleNameMap);
|
|
35451
35638
|
var packageJsonInfoCache = createPackageJsonInfoCache(currentDirectory, getCanonicalFileName);
|
|
35452
|
-
|
|
35639
|
+
var oldResolutionCache;
|
|
35640
|
+
return __assign(__assign(__assign({}, packageJsonInfoCache), perDirectoryResolutionCache), { getOrCreateCacheForModuleName: getOrCreateCacheForModuleName, getFromModuleNameCache: getFromModuleNameCache, clear: clear, update: update, getPackageJsonInfoCache: function () { return packageJsonInfoCache; }, setOldResolutionCache: setOldResolutionCache });
|
|
35453
35641
|
function clear() {
|
|
35454
|
-
|
|
35642
|
+
oldResolutionCache = undefined;
|
|
35643
|
+
perDirectoryResolutionCache.clear();
|
|
35455
35644
|
moduleNameToDirectoryMap.clear();
|
|
35456
35645
|
packageJsonInfoCache.clear();
|
|
35457
35646
|
}
|
|
35458
35647
|
function update(options) {
|
|
35459
|
-
|
|
35648
|
+
directoryToModuleNameMap.update(options);
|
|
35649
|
+
moduleNameToDirectoryMap.update(options);
|
|
35650
|
+
}
|
|
35651
|
+
function setOldResolutionCache(cache) {
|
|
35652
|
+
oldResolutionCache = cache;
|
|
35653
|
+
perDirectoryResolutionCache.setOldResolutionCache(cache);
|
|
35654
|
+
}
|
|
35655
|
+
function getFromModuleNameCache(directoryName, nonRelativeModuleName, mode, redirectedReference) {
|
|
35656
|
+
var _a, _b;
|
|
35657
|
+
ts.Debug.assert(!ts.isExternalModuleNameRelative(nonRelativeModuleName));
|
|
35658
|
+
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);
|
|
35659
|
+
if (result)
|
|
35660
|
+
return result;
|
|
35661
|
+
var fromOld = oldResolutionCache === null || oldResolutionCache === void 0 ? void 0 : oldResolutionCache.getResolved(toPath(directoryName), nonRelativeModuleName, mode, redirectedReference);
|
|
35662
|
+
if (fromOld)
|
|
35663
|
+
getOrCreateCacheForModuleName(nonRelativeModuleName, mode, redirectedReference).set(directoryName, fromOld);
|
|
35664
|
+
return fromOld;
|
|
35460
35665
|
}
|
|
35461
35666
|
function getOrCreateCacheForModuleName(nonRelativeModuleName, mode, redirectedReference) {
|
|
35462
35667
|
ts.Debug.assert(!ts.isExternalModuleNameRelative(nonRelativeModuleName));
|
|
35463
|
-
return getOrCreateCache(moduleNameToDirectoryMap, redirectedReference,
|
|
35668
|
+
return getOrCreateCache(moduleNameToDirectoryMap, redirectedReference, getModeAwareCacheKey(nonRelativeModuleName, mode), createPerModuleNameCache);
|
|
35464
35669
|
}
|
|
35465
35670
|
function createPerModuleNameCache() {
|
|
35466
35671
|
var directoryPathMap = new ts.Map();
|
|
35467
35672
|
return { get: get, set: set };
|
|
35468
35673
|
function get(directory) {
|
|
35469
|
-
return directoryPathMap.get(
|
|
35674
|
+
return directoryPathMap.get(toPath(directory));
|
|
35470
35675
|
}
|
|
35471
35676
|
function set(directory, result) {
|
|
35472
|
-
|
|
35473
|
-
if (directoryPathMap.has(path)) {
|
|
35474
|
-
return;
|
|
35475
|
-
}
|
|
35476
|
-
directoryPathMap.set(path, result);
|
|
35477
|
-
var resolvedFileName = result.resolvedModule &&
|
|
35478
|
-
(result.resolvedModule.originalPath || result.resolvedModule.resolvedFileName);
|
|
35479
|
-
var commonPrefix = resolvedFileName && getCommonPrefix(path, resolvedFileName);
|
|
35480
|
-
var current = path;
|
|
35481
|
-
while (current !== commonPrefix) {
|
|
35482
|
-
var parent = ts.getDirectoryPath(current);
|
|
35483
|
-
if (parent === current || directoryPathMap.has(parent)) {
|
|
35484
|
-
break;
|
|
35485
|
-
}
|
|
35486
|
-
directoryPathMap.set(parent, result);
|
|
35487
|
-
current = parent;
|
|
35488
|
-
}
|
|
35489
|
-
}
|
|
35490
|
-
function getCommonPrefix(directory, resolution) {
|
|
35491
|
-
var resolutionDirectory = ts.toPath(ts.getDirectoryPath(resolution), currentDirectory, getCanonicalFileName);
|
|
35492
|
-
var i = 0;
|
|
35493
|
-
var limit = Math.min(directory.length, resolutionDirectory.length);
|
|
35494
|
-
while (i < limit && directory.charCodeAt(i) === resolutionDirectory.charCodeAt(i)) {
|
|
35495
|
-
i++;
|
|
35496
|
-
}
|
|
35497
|
-
if (i === directory.length && (resolutionDirectory.length === i || resolutionDirectory[i] === ts.directorySeparator)) {
|
|
35498
|
-
return directory;
|
|
35499
|
-
}
|
|
35500
|
-
var rootLength = ts.getRootLength(directory);
|
|
35501
|
-
if (i < rootLength) {
|
|
35502
|
-
return undefined;
|
|
35503
|
-
}
|
|
35504
|
-
var sep = directory.lastIndexOf(ts.directorySeparator, i - 1);
|
|
35505
|
-
if (sep === -1) {
|
|
35506
|
-
return undefined;
|
|
35507
|
-
}
|
|
35508
|
-
return directory.substr(0, Math.max(sep, rootLength));
|
|
35677
|
+
return moduleNameToDirectorySet(directoryPathMap, toPath(directory), result, getResolvedFileNameForModuleNameToDirectorySet, toPath, ts.noop);
|
|
35509
35678
|
}
|
|
35510
35679
|
}
|
|
35680
|
+
function toPath(fileName) {
|
|
35681
|
+
return ts.toPath(fileName, currentDirectory, getCanonicalFileName);
|
|
35682
|
+
}
|
|
35511
35683
|
}
|
|
35512
35684
|
ts.createModuleResolutionCache = createModuleResolutionCache;
|
|
35513
|
-
function createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, options, packageJsonInfoCache
|
|
35514
|
-
var
|
|
35685
|
+
function createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, options, packageJsonInfoCache) {
|
|
35686
|
+
var directoryToModuleNameMap = createCacheWithRedirects(options);
|
|
35687
|
+
var preDirectoryResolutionCache = createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, directoryToModuleNameMap);
|
|
35515
35688
|
packageJsonInfoCache || (packageJsonInfoCache = createPackageJsonInfoCache(currentDirectory, getCanonicalFileName));
|
|
35516
35689
|
return __assign(__assign(__assign({}, packageJsonInfoCache), preDirectoryResolutionCache), { clear: clear });
|
|
35517
35690
|
function clear() {
|
|
@@ -35522,10 +35695,7 @@ var ts;
|
|
|
35522
35695
|
ts.createTypeReferenceDirectiveResolutionCache = createTypeReferenceDirectiveResolutionCache;
|
|
35523
35696
|
function resolveModuleNameFromCache(moduleName, containingFile, cache, mode) {
|
|
35524
35697
|
var containingDirectory = ts.getDirectoryPath(containingFile);
|
|
35525
|
-
|
|
35526
|
-
if (!perFolderCache)
|
|
35527
|
-
return undefined;
|
|
35528
|
-
return perFolderCache.get(moduleName, mode);
|
|
35698
|
+
return cache === null || cache === void 0 ? void 0 : cache.getFromCache(containingDirectory, moduleName, mode);
|
|
35529
35699
|
}
|
|
35530
35700
|
ts.resolveModuleNameFromCache = resolveModuleNameFromCache;
|
|
35531
35701
|
function resolveModuleName(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
@@ -35540,8 +35710,7 @@ var ts;
|
|
|
35540
35710
|
}
|
|
35541
35711
|
}
|
|
35542
35712
|
var containingDirectory = ts.getDirectoryPath(containingFile);
|
|
35543
|
-
var
|
|
35544
|
-
var result = perFolderCache && perFolderCache.get(moduleName, resolutionMode);
|
|
35713
|
+
var result = cache === null || cache === void 0 ? void 0 : cache.getFromCache(containingDirectory, moduleName, resolutionMode, redirectedReference);
|
|
35545
35714
|
if (result) {
|
|
35546
35715
|
if (traceEnabled) {
|
|
35547
35716
|
trace(host, ts.Diagnostics.Resolution_for_module_0_was_found_in_cache_from_location_1, moduleName, containingDirectory);
|
|
@@ -35593,8 +35762,8 @@ var ts;
|
|
|
35593
35762
|
if (result && result.resolvedModule)
|
|
35594
35763
|
ts.perfLogger.logInfoEvent("Module \"" + moduleName + "\" resolved to \"" + result.resolvedModule.resolvedFileName + "\"");
|
|
35595
35764
|
ts.perfLogger.logStopResolveModule((result && result.resolvedModule) ? "" + result.resolvedModule.resolvedFileName : "null");
|
|
35596
|
-
if (
|
|
35597
|
-
|
|
35765
|
+
if (cache) {
|
|
35766
|
+
cache.getOrCreateCacheForDirectory(containingDirectory, redirectedReference).set(moduleName, resolutionMode, result);
|
|
35598
35767
|
if (!ts.isExternalModuleNameRelative(moduleName)) {
|
|
35599
35768
|
cache.getOrCreateCacheForModuleName(moduleName, resolutionMode, redirectedReference).set(containingDirectory, result);
|
|
35600
35769
|
}
|
|
@@ -35798,10 +35967,10 @@ var ts;
|
|
|
35798
35967
|
features: features,
|
|
35799
35968
|
conditions: conditions,
|
|
35800
35969
|
requestContainingDirectory: containingDirectory,
|
|
35801
|
-
|
|
35970
|
+
reportResolutionDiagnostic: function (diag) { return void diagnostics.push(diag); },
|
|
35802
35971
|
};
|
|
35803
35972
|
var result = ts.forEach(extensions, function (ext) { return tryResolve(ext); });
|
|
35804
|
-
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);
|
|
35973
|
+
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);
|
|
35805
35974
|
function tryResolve(extensions) {
|
|
35806
35975
|
var loader = function (extensions, candidate, onlyRecordFailures, state) { return nodeLoadModuleByRelativeName(extensions, candidate, onlyRecordFailures, state, true); };
|
|
35807
35976
|
var resolved = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loader, state);
|
|
@@ -36054,18 +36223,9 @@ var ts;
|
|
|
36054
36223
|
var entrypoints;
|
|
36055
36224
|
var extensions = resolveJs ? Extensions.JavaScript : Extensions.TypeScript;
|
|
36056
36225
|
var features = getDefaultNodeResolutionFeatures(options);
|
|
36057
|
-
var requireState =
|
|
36058
|
-
|
|
36059
|
-
|
|
36060
|
-
traceEnabled: isTraceEnabled(options, host),
|
|
36061
|
-
failedLookupLocations: [],
|
|
36062
|
-
affectingLocations: [],
|
|
36063
|
-
packageJsonInfoCache: cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(),
|
|
36064
|
-
conditions: ["node", "require", "types"],
|
|
36065
|
-
features: features,
|
|
36066
|
-
requestContainingDirectory: packageJsonInfo.packageDirectory,
|
|
36067
|
-
reportDiagnostic: ts.noop
|
|
36068
|
-
};
|
|
36226
|
+
var requireState = getTemporaryModuleResolutionState(cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(), host, options);
|
|
36227
|
+
requireState.conditions = ["node", "require", "types"];
|
|
36228
|
+
requireState.requestContainingDirectory = packageJsonInfo.packageDirectory;
|
|
36069
36229
|
var requireResolution = loadNodeModuleFromDirectoryWorker(extensions, packageJsonInfo.packageDirectory, false, requireState, packageJsonInfo.packageJsonContent, packageJsonInfo.versionPaths);
|
|
36070
36230
|
entrypoints = ts.append(entrypoints, requireResolution === null || requireResolution === void 0 ? void 0 : requireResolution.path);
|
|
36071
36231
|
if (features & NodeResolutionFeatures.Exports && packageJsonInfo.packageJsonContent.exports) {
|
|
@@ -36135,19 +36295,22 @@ var ts;
|
|
|
36135
36295
|
}
|
|
36136
36296
|
}
|
|
36137
36297
|
}
|
|
36138
|
-
function
|
|
36139
|
-
|
|
36298
|
+
function getTemporaryModuleResolutionState(packageJsonInfoCache, host, options) {
|
|
36299
|
+
return {
|
|
36140
36300
|
host: host,
|
|
36141
36301
|
compilerOptions: options,
|
|
36142
36302
|
traceEnabled: isTraceEnabled(options, host),
|
|
36143
|
-
failedLookupLocations:
|
|
36144
|
-
affectingLocations:
|
|
36303
|
+
failedLookupLocations: ts.noopPush,
|
|
36304
|
+
affectingLocations: ts.noopPush,
|
|
36145
36305
|
packageJsonInfoCache: packageJsonInfoCache,
|
|
36146
|
-
features:
|
|
36147
|
-
conditions:
|
|
36306
|
+
features: NodeResolutionFeatures.None,
|
|
36307
|
+
conditions: ts.emptyArray,
|
|
36148
36308
|
requestContainingDirectory: undefined,
|
|
36149
|
-
|
|
36309
|
+
reportResolutionDiagnostic: ts.noop
|
|
36150
36310
|
};
|
|
36311
|
+
}
|
|
36312
|
+
ts.getTemporaryModuleResolutionState = getTemporaryModuleResolutionState;
|
|
36313
|
+
function getPackageScopeForPath(fileName, state) {
|
|
36151
36314
|
var parts = ts.getPathComponents(fileName);
|
|
36152
36315
|
parts.pop();
|
|
36153
36316
|
while (parts.length > 0) {
|
|
@@ -36185,12 +36348,13 @@ var ts;
|
|
|
36185
36348
|
}
|
|
36186
36349
|
var directoryExists = ts.directoryProbablyExists(packageDirectory, host);
|
|
36187
36350
|
if (directoryExists && host.fileExists(packageJsonPath)) {
|
|
36188
|
-
var
|
|
36351
|
+
var packageJsonText = host.readFile(packageJsonPath);
|
|
36352
|
+
var packageJsonContent = ts.readJsonIgnoringErrorsFromText(packageJsonPath, packageJsonText);
|
|
36189
36353
|
if (traceEnabled) {
|
|
36190
36354
|
trace(host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath);
|
|
36191
36355
|
}
|
|
36192
36356
|
var versionPaths = readPackageJsonTypesVersionPaths(packageJsonContent, state);
|
|
36193
|
-
var result = { packageDirectory: packageDirectory, packageJsonContent: packageJsonContent, versionPaths: versionPaths, resolvedEntrypoints: undefined };
|
|
36357
|
+
var result = { packageDirectory: packageDirectory, packageJsonText: packageJsonText, packageJsonContent: packageJsonContent, versionPaths: versionPaths, resolvedEntrypoints: undefined };
|
|
36194
36358
|
(_b = state.packageJsonInfoCache) === null || _b === void 0 ? void 0 : _b.setPackageJsonInfo(packageJsonPath, result);
|
|
36195
36359
|
state.affectingLocations.push(packageJsonPath);
|
|
36196
36360
|
return result;
|
|
@@ -36304,7 +36468,7 @@ var ts;
|
|
|
36304
36468
|
var _a, _b;
|
|
36305
36469
|
var useCaseSensitiveFileNames = typeof state.host.useCaseSensitiveFileNames === "function" ? state.host.useCaseSensitiveFileNames() : state.host.useCaseSensitiveFileNames;
|
|
36306
36470
|
var directoryPath = ts.toPath(ts.combinePaths(directory, "dummy"), (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a), ts.createGetCanonicalFileName(useCaseSensitiveFileNames === undefined ? true : useCaseSensitiveFileNames));
|
|
36307
|
-
var scope = getPackageScopeForPath(directoryPath, state
|
|
36471
|
+
var scope = getPackageScopeForPath(directoryPath, state);
|
|
36308
36472
|
if (!scope || !scope.packageJsonContent.exports) {
|
|
36309
36473
|
return undefined;
|
|
36310
36474
|
}
|
|
@@ -36363,7 +36527,7 @@ var ts;
|
|
|
36363
36527
|
}
|
|
36364
36528
|
var useCaseSensitiveFileNames = typeof state.host.useCaseSensitiveFileNames === "function" ? state.host.useCaseSensitiveFileNames() : state.host.useCaseSensitiveFileNames;
|
|
36365
36529
|
var directoryPath = ts.toPath(ts.combinePaths(directory, "dummy"), (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a), ts.createGetCanonicalFileName(useCaseSensitiveFileNames === undefined ? true : useCaseSensitiveFileNames));
|
|
36366
|
-
var scope = getPackageScopeForPath(directoryPath, state
|
|
36530
|
+
var scope = getPackageScopeForPath(directoryPath, state);
|
|
36367
36531
|
if (!scope) {
|
|
36368
36532
|
if (state.traceEnabled) {
|
|
36369
36533
|
trace(state.host, ts.Diagnostics.Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve, directoryPath);
|
|
@@ -36562,11 +36726,8 @@ var ts;
|
|
|
36562
36726
|
fragment = ts.ensureTrailingDirectorySeparator(commonDir_1);
|
|
36563
36727
|
}
|
|
36564
36728
|
}
|
|
36565
|
-
if (commonSourceDirGuesses.length > 1)
|
|
36566
|
-
state.
|
|
36567
|
-
? 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
|
|
36568
|
-
: 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));
|
|
36569
|
-
}
|
|
36729
|
+
if (commonSourceDirGuesses.length > 1)
|
|
36730
|
+
state.reportResolutionDiagnostic({ isImports: isImports, entry: entry, packagePath: packagePath });
|
|
36570
36731
|
for (var _i = 0, commonSourceDirGuesses_1 = commonSourceDirGuesses; _i < commonSourceDirGuesses_1.length; _i++) {
|
|
36571
36732
|
var commonSourceDirGuess = commonSourceDirGuesses_1[_i];
|
|
36572
36733
|
var candidateDirectories = getOutputDirectoriesForBaseDirectory(commonSourceDirGuess);
|
|
@@ -36631,10 +36792,10 @@ var ts;
|
|
|
36631
36792
|
return loadModuleFromNearestNodeModulesDirectoryWorker(Extensions.DtsOnly, moduleName, directory, state, true, undefined, undefined);
|
|
36632
36793
|
}
|
|
36633
36794
|
function loadModuleFromNearestNodeModulesDirectoryWorker(extensions, moduleName, directory, state, typesScopeOnly, cache, redirectedReference) {
|
|
36634
|
-
var
|
|
36795
|
+
var mode = state.features === 0 ? undefined : state.features & NodeResolutionFeatures.EsmMode ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS;
|
|
36635
36796
|
return ts.forEachAncestorDirectory(ts.normalizeSlashes(directory), function (ancestorDirectory) {
|
|
36636
36797
|
if (ts.getBaseFileName(ancestorDirectory) !== "node_modules") {
|
|
36637
|
-
var resolutionFromCache = tryFindNonRelativeModuleNameInCache(
|
|
36798
|
+
var resolutionFromCache = tryFindNonRelativeModuleNameInCache(cache, moduleName, mode, ancestorDirectory, redirectedReference, state);
|
|
36638
36799
|
if (resolutionFromCache) {
|
|
36639
36800
|
return resolutionFromCache;
|
|
36640
36801
|
}
|
|
@@ -36771,8 +36932,8 @@ var ts;
|
|
|
36771
36932
|
typesPackageName;
|
|
36772
36933
|
}
|
|
36773
36934
|
ts.unmangleScopedPackageName = unmangleScopedPackageName;
|
|
36774
|
-
function tryFindNonRelativeModuleNameInCache(cache, moduleName, containingDirectory, state) {
|
|
36775
|
-
var result = cache
|
|
36935
|
+
function tryFindNonRelativeModuleNameInCache(cache, moduleName, mode, containingDirectory, redirectedReference, state) {
|
|
36936
|
+
var result = cache === null || cache === void 0 ? void 0 : cache.getFromModuleNameCache(containingDirectory, moduleName, mode, redirectedReference);
|
|
36776
36937
|
if (result) {
|
|
36777
36938
|
if (state.traceEnabled) {
|
|
36778
36939
|
trace(state.host, ts.Diagnostics.Resolution_for_module_0_was_found_in_cache_from_location_1, moduleName, containingDirectory);
|
|
@@ -36797,19 +36958,18 @@ var ts;
|
|
|
36797
36958
|
features: NodeResolutionFeatures.None,
|
|
36798
36959
|
conditions: [],
|
|
36799
36960
|
requestContainingDirectory: containingDirectory,
|
|
36800
|
-
|
|
36961
|
+
reportResolutionDiagnostic: function (diag) { return void diagnostics.push(diag); },
|
|
36801
36962
|
};
|
|
36802
36963
|
var resolved = tryResolve(Extensions.TypeScript) || tryResolve(Extensions.JavaScript);
|
|
36803
|
-
return createResolvedModuleWithFailedLookupLocations(resolved && resolved.value, false, failedLookupLocations, affectingLocations, diagnostics, state.resultFromCache);
|
|
36964
|
+
return createResolvedModuleWithFailedLookupLocations(compilerOptions, resolved && resolved.value, false, failedLookupLocations, affectingLocations, diagnostics, state.resultFromCache);
|
|
36804
36965
|
function tryResolve(extensions) {
|
|
36805
36966
|
var resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFileNoPackageId, state);
|
|
36806
36967
|
if (resolvedUsingSettings) {
|
|
36807
36968
|
return { value: resolvedUsingSettings };
|
|
36808
36969
|
}
|
|
36809
36970
|
if (!ts.isExternalModuleNameRelative(moduleName)) {
|
|
36810
|
-
var perModuleNameCache_1 = cache && cache.getOrCreateCacheForModuleName(moduleName, undefined, redirectedReference);
|
|
36811
36971
|
var resolved_3 = ts.forEachAncestorDirectory(containingDirectory, function (directory) {
|
|
36812
|
-
var resolutionFromCache = tryFindNonRelativeModuleNameInCache(
|
|
36972
|
+
var resolutionFromCache = tryFindNonRelativeModuleNameInCache(cache, moduleName, undefined, directory, redirectedReference, state);
|
|
36813
36973
|
if (resolutionFromCache) {
|
|
36814
36974
|
return resolutionFromCache;
|
|
36815
36975
|
}
|
|
@@ -36848,10 +37008,10 @@ var ts;
|
|
|
36848
37008
|
features: NodeResolutionFeatures.None,
|
|
36849
37009
|
conditions: [],
|
|
36850
37010
|
requestContainingDirectory: undefined,
|
|
36851
|
-
|
|
37011
|
+
reportResolutionDiagnostic: function (diag) { return void diagnostics.push(diag); },
|
|
36852
37012
|
};
|
|
36853
37013
|
var resolved = loadModuleFromImmediateNodeModulesDirectory(Extensions.DtsOnly, moduleName, globalCache, state, false, undefined, undefined);
|
|
36854
|
-
return createResolvedModuleWithFailedLookupLocations(resolved, true, failedLookupLocations, affectingLocations, diagnostics, state.resultFromCache);
|
|
37014
|
+
return createResolvedModuleWithFailedLookupLocations(compilerOptions, resolved, true, failedLookupLocations, affectingLocations, diagnostics, state.resultFromCache);
|
|
36855
37015
|
}
|
|
36856
37016
|
ts.loadModuleFromGlobalCache = loadModuleFromGlobalCache;
|
|
36857
37017
|
function toSearchResult(value) {
|
|
@@ -39844,9 +40004,10 @@ var ts;
|
|
|
39844
40004
|
host.getSourceFiles().forEach(function (sf) {
|
|
39845
40005
|
if (!sf.resolvedModules)
|
|
39846
40006
|
return;
|
|
39847
|
-
sf.resolvedModules.forEach(function (
|
|
39848
|
-
|
|
39849
|
-
|
|
40007
|
+
sf.resolvedModules.forEach(function (_a) {
|
|
40008
|
+
var resolvedModule = _a.resolvedModule;
|
|
40009
|
+
if (resolvedModule === null || resolvedModule === void 0 ? void 0 : resolvedModule.packageId)
|
|
40010
|
+
map.set(resolvedModule.packageId.name, resolvedModule.extension === ".d.ts" || !!map.get(resolvedModule.packageId.name));
|
|
39850
40011
|
});
|
|
39851
40012
|
});
|
|
39852
40013
|
return map;
|
|
@@ -52079,21 +52240,28 @@ var ts;
|
|
|
52079
52240
|
getFlowTypeOfReference(accessExpression, propType) :
|
|
52080
52241
|
propType;
|
|
52081
52242
|
}
|
|
52082
|
-
if (everyType(objectType, isTupleType) && ts.isNumericLiteralName(propName)
|
|
52243
|
+
if (everyType(objectType, isTupleType) && ts.isNumericLiteralName(propName)) {
|
|
52244
|
+
var index = +propName;
|
|
52083
52245
|
if (accessNode && everyType(objectType, function (t) { return !t.target.hasRestElement; }) && !(accessFlags & 16)) {
|
|
52084
52246
|
var indexNode = getIndexNodeForAccessExpression(accessNode);
|
|
52085
52247
|
if (isTupleType(objectType)) {
|
|
52248
|
+
if (index < 0) {
|
|
52249
|
+
error(indexNode, ts.Diagnostics.A_tuple_type_cannot_be_indexed_with_a_negative_value);
|
|
52250
|
+
return undefinedType;
|
|
52251
|
+
}
|
|
52086
52252
|
error(indexNode, ts.Diagnostics.Tuple_type_0_of_length_1_has_no_element_at_index_2, typeToString(objectType), getTypeReferenceArity(objectType), ts.unescapeLeadingUnderscores(propName));
|
|
52087
52253
|
}
|
|
52088
52254
|
else {
|
|
52089
52255
|
error(indexNode, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.unescapeLeadingUnderscores(propName), typeToString(objectType));
|
|
52090
52256
|
}
|
|
52091
52257
|
}
|
|
52092
|
-
|
|
52093
|
-
|
|
52094
|
-
|
|
52095
|
-
|
|
52096
|
-
|
|
52258
|
+
if (index >= 0) {
|
|
52259
|
+
errorIfWritingToReadonlyIndex(getIndexInfoOfType(objectType, numberType));
|
|
52260
|
+
return mapType(objectType, function (t) {
|
|
52261
|
+
var restType = getRestTypeOfTupleType(t) || undefinedType;
|
|
52262
|
+
return accessFlags & 1 ? getUnionType([restType, undefinedType]) : restType;
|
|
52263
|
+
});
|
|
52264
|
+
}
|
|
52097
52265
|
}
|
|
52098
52266
|
}
|
|
52099
52267
|
if (!(indexType.flags & 98304) && isTypeAssignableToKind(indexType, 402653316 | 296 | 12288)) {
|
|
@@ -60178,7 +60346,9 @@ var ts;
|
|
|
60178
60346
|
var narrowedType = mapType(candidate, function (c) {
|
|
60179
60347
|
var discriminant = keyPropertyName && getTypeOfPropertyOfType(c, keyPropertyName);
|
|
60180
60348
|
var matching = discriminant && getConstituentTypeForKeyType(type, discriminant);
|
|
60181
|
-
var directlyRelated = mapType(matching || type,
|
|
60349
|
+
var directlyRelated = mapType(matching || type, checkDerived ?
|
|
60350
|
+
function (t) { return isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType; } :
|
|
60351
|
+
function (t) { return isTypeSubtypeOf(c, t) ? c : isTypeSubtypeOf(t, c) ? t : neverType; });
|
|
60182
60352
|
return directlyRelated.flags & 131072 ?
|
|
60183
60353
|
mapType(type, function (t) { return maybeTypeOfKind(t, 465829888) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType; }) :
|
|
60184
60354
|
directlyRelated;
|
|
@@ -70963,14 +71133,19 @@ var ts;
|
|
|
70963
71133
|
}
|
|
70964
71134
|
var indexInfos = getApplicableIndexInfos(type, propNameType);
|
|
70965
71135
|
var interfaceDeclaration = ts.getObjectFlags(type) & 2 ? ts.getDeclarationOfKind(type.symbol, 258) : undefined;
|
|
70966
|
-
var
|
|
70967
|
-
name && name.kind === 162
|
|
71136
|
+
var propDeclaration = declaration && declaration.kind === 221 ||
|
|
71137
|
+
name && name.kind === 162 ? declaration : undefined;
|
|
71138
|
+
var localPropDeclaration = getParentOfSymbol(prop) === type.symbol ? declaration : undefined;
|
|
70968
71139
|
var _loop_30 = function (info) {
|
|
70969
71140
|
var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
|
|
70970
71141
|
var errorNode = localPropDeclaration || localIndexDeclaration ||
|
|
70971
71142
|
(interfaceDeclaration && !ts.some(getBaseTypes(type), function (base) { return !!getPropertyOfObjectType(base, prop.escapedName) && !!getIndexTypeOfType(base, info.keyType); }) ? interfaceDeclaration : undefined);
|
|
70972
71143
|
if (errorNode && !isTypeAssignableTo(propType, info.type)) {
|
|
70973
|
-
|
|
71144
|
+
var diagnostic = createError(errorNode, ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_2_index_type_3, symbolToString(prop), typeToString(propType), typeToString(info.keyType), typeToString(info.type));
|
|
71145
|
+
if (propDeclaration && errorNode !== propDeclaration) {
|
|
71146
|
+
ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(propDeclaration, ts.Diagnostics._0_is_declared_here, symbolToString(prop)));
|
|
71147
|
+
}
|
|
71148
|
+
diagnostics.add(diagnostic);
|
|
70974
71149
|
}
|
|
70975
71150
|
};
|
|
70976
71151
|
for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) {
|
|
@@ -74058,11 +74233,12 @@ var ts;
|
|
|
74058
74233
|
var fileToDirective;
|
|
74059
74234
|
if (resolvedTypeReferenceDirectives) {
|
|
74060
74235
|
fileToDirective = new ts.Map();
|
|
74061
|
-
resolvedTypeReferenceDirectives.forEach(function (
|
|
74062
|
-
|
|
74236
|
+
resolvedTypeReferenceDirectives.forEach(function (_a, key, mode) {
|
|
74237
|
+
var resolvedTypeReferenceDirective = _a.resolvedTypeReferenceDirective;
|
|
74238
|
+
if (!resolvedTypeReferenceDirective || !resolvedTypeReferenceDirective.resolvedFileName) {
|
|
74063
74239
|
return;
|
|
74064
74240
|
}
|
|
74065
|
-
var file = host.getSourceFile(
|
|
74241
|
+
var file = host.getSourceFile(resolvedTypeReferenceDirective.resolvedFileName);
|
|
74066
74242
|
if (file) {
|
|
74067
74243
|
addReferencedFilesToTypeDirective(file, key, mode);
|
|
74068
74244
|
}
|
|
@@ -91807,7 +91983,7 @@ var ts;
|
|
|
91807
91983
|
var sourceMap = sourceMapGenerator.toString();
|
|
91808
91984
|
ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap, false, sourceFiles);
|
|
91809
91985
|
if (printer.bundleFileInfo)
|
|
91810
|
-
printer.bundleFileInfo.mapHash = ts.computeSignature(sourceMap,
|
|
91986
|
+
printer.bundleFileInfo.mapHash = ts.computeSignature(sourceMap, host);
|
|
91811
91987
|
}
|
|
91812
91988
|
}
|
|
91813
91989
|
else {
|
|
@@ -91816,7 +91992,7 @@ var ts;
|
|
|
91816
91992
|
var text = writer.getText();
|
|
91817
91993
|
ts.writeFile(host, emitterDiagnostics, jsFilePath, text, !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos, diagnostics: transform.diagnostics });
|
|
91818
91994
|
if (printer.bundleFileInfo)
|
|
91819
|
-
printer.bundleFileInfo.hash = ts.computeSignature(text,
|
|
91995
|
+
printer.bundleFileInfo.hash = ts.computeSignature(text, host);
|
|
91820
91996
|
writer.clear();
|
|
91821
91997
|
}
|
|
91822
91998
|
function shouldEmitSourceMaps(mapOptions, sourceFileOrBundle) {
|
|
@@ -91941,7 +92117,6 @@ var ts;
|
|
|
91941
92117
|
});
|
|
91942
92118
|
}
|
|
91943
92119
|
function emitUsingBuildInfo(config, host, getCommandLine, customTransformers) {
|
|
91944
|
-
var createHash = ts.maybeBind(host, host.createHash);
|
|
91945
92120
|
var _a = getOutputPathsForBundle(config.options, false), buildInfoPath = _a.buildInfoPath, jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath;
|
|
91946
92121
|
var buildInfo;
|
|
91947
92122
|
if (host.getBuildInfo) {
|
|
@@ -91961,22 +92136,22 @@ var ts;
|
|
|
91961
92136
|
var jsFileText = host.readFile(ts.Debug.checkDefined(jsFilePath));
|
|
91962
92137
|
if (!jsFileText)
|
|
91963
92138
|
return jsFilePath;
|
|
91964
|
-
if (ts.computeSignature(jsFileText,
|
|
92139
|
+
if (ts.computeSignature(jsFileText, host) !== buildInfo.bundle.js.hash)
|
|
91965
92140
|
return jsFilePath;
|
|
91966
92141
|
var sourceMapText = sourceMapFilePath && host.readFile(sourceMapFilePath);
|
|
91967
92142
|
if ((sourceMapFilePath && !sourceMapText) || config.options.inlineSourceMap)
|
|
91968
92143
|
return sourceMapFilePath || "inline sourcemap decoding";
|
|
91969
|
-
if (sourceMapFilePath && ts.computeSignature(sourceMapText,
|
|
92144
|
+
if (sourceMapFilePath && ts.computeSignature(sourceMapText, host) !== buildInfo.bundle.js.mapHash)
|
|
91970
92145
|
return sourceMapFilePath;
|
|
91971
92146
|
var declarationText = declarationFilePath && host.readFile(declarationFilePath);
|
|
91972
92147
|
if (declarationFilePath && !declarationText)
|
|
91973
92148
|
return declarationFilePath;
|
|
91974
|
-
if (declarationFilePath && ts.computeSignature(declarationText,
|
|
92149
|
+
if (declarationFilePath && ts.computeSignature(declarationText, host) !== buildInfo.bundle.dts.hash)
|
|
91975
92150
|
return declarationFilePath;
|
|
91976
92151
|
var declarationMapText = declarationMapPath && host.readFile(declarationMapPath);
|
|
91977
92152
|
if ((declarationMapPath && !declarationMapText) || config.options.inlineSourceMap)
|
|
91978
92153
|
return declarationMapPath || "inline sourcemap decoding";
|
|
91979
|
-
if (declarationMapPath && ts.computeSignature(declarationMapText,
|
|
92154
|
+
if (declarationMapPath && ts.computeSignature(declarationMapText, host) !== buildInfo.bundle.dts.mapHash)
|
|
91980
92155
|
return declarationMapPath;
|
|
91981
92156
|
var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
|
|
91982
92157
|
var ownPrependInput = ts.createInputFiles(jsFileText, declarationText, sourceMapFilePath, sourceMapText, declarationMapPath, declarationMapText, jsFilePath, declarationFilePath, buildInfoPath, buildInfo, true);
|
|
@@ -92014,7 +92189,7 @@ var ts;
|
|
|
92014
92189
|
var newBuildInfo = data.buildInfo;
|
|
92015
92190
|
newBuildInfo.program = buildInfo.program;
|
|
92016
92191
|
if (newBuildInfo.program && changedDtsText !== undefined && config.options.composite) {
|
|
92017
|
-
newBuildInfo.program.outSignature = ts.computeSignature(changedDtsText,
|
|
92192
|
+
newBuildInfo.program.outSignature = ts.computeSignature(changedDtsText, host, changedDtsData);
|
|
92018
92193
|
}
|
|
92019
92194
|
var _a = buildInfo.bundle, js = _a.js, dts = _a.dts, sourceFiles = _a.sourceFiles;
|
|
92020
92195
|
newBuildInfo.bundle.js.sources = js.sources;
|
|
@@ -92047,7 +92222,7 @@ var ts;
|
|
|
92047
92222
|
getSourceFileFromReference: ts.returnUndefined,
|
|
92048
92223
|
redirectTargetsMap: ts.createMultiMap(),
|
|
92049
92224
|
getFileIncludeReasons: ts.notImplemented,
|
|
92050
|
-
createHash: createHash,
|
|
92225
|
+
createHash: ts.maybeBind(host, host.createHash),
|
|
92051
92226
|
};
|
|
92052
92227
|
emitFiles(ts.notImplementedResolver, emitHost, undefined, ts.getTransformers(config.options, customTransformers));
|
|
92053
92228
|
return outputFiles;
|
|
@@ -97031,7 +97206,7 @@ var ts;
|
|
|
97031
97206
|
var name = names_2[_i];
|
|
97032
97207
|
var result = void 0;
|
|
97033
97208
|
var mode = getModeForFileReference(name, containingFileMode);
|
|
97034
|
-
var strName = ts.isString(name) ? name : name.fileName
|
|
97209
|
+
var strName = ts.isString(name) ? name : ts.toFileNameLowerCase(name.fileName);
|
|
97035
97210
|
var cacheKey = mode !== undefined ? mode + "|" + strName : strName;
|
|
97036
97211
|
if (cache.has(cacheKey)) {
|
|
97037
97212
|
result = cache.get(cacheKey);
|
|
@@ -97115,7 +97290,21 @@ var ts;
|
|
|
97115
97290
|
return elem.value.text === "import" ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS;
|
|
97116
97291
|
}
|
|
97117
97292
|
ts.getResolutionModeOverrideForClause = getResolutionModeOverrideForClause;
|
|
97118
|
-
|
|
97293
|
+
var emptyResolution = {
|
|
97294
|
+
resolvedModule: undefined,
|
|
97295
|
+
resolvedTypeReferenceDirective: undefined,
|
|
97296
|
+
failedLookupLocations: [],
|
|
97297
|
+
affectingLocations: [],
|
|
97298
|
+
resolutionDiagnostics: [],
|
|
97299
|
+
};
|
|
97300
|
+
function isResolvedModuleWithFailedLookupLocation(resolved) {
|
|
97301
|
+
return !!resolved && !!resolved.failedLookupLocations;
|
|
97302
|
+
}
|
|
97303
|
+
function isResolvedTypeReferenceDirectiveWithFailedLookupLocations(resolved) {
|
|
97304
|
+
return !!resolved && !!resolved.failedLookupLocations;
|
|
97305
|
+
}
|
|
97306
|
+
function loadWithModeAwareCache(names, containingFile, containingFileName, redirectedReference, partialResolutionInfo, loader) {
|
|
97307
|
+
var _a;
|
|
97119
97308
|
if (names.length === 0) {
|
|
97120
97309
|
return [];
|
|
97121
97310
|
}
|
|
@@ -97125,7 +97314,7 @@ var ts;
|
|
|
97125
97314
|
for (var _i = 0, names_3 = names; _i < names_3.length; _i++) {
|
|
97126
97315
|
var name = names_3[_i];
|
|
97127
97316
|
var result = void 0;
|
|
97128
|
-
var mode = getModeForResolutionAtIndex(containingFile, i);
|
|
97317
|
+
var mode = getModeForResolutionAtIndex(containingFile, (_a = partialResolutionInfo === null || partialResolutionInfo === void 0 ? void 0 : partialResolutionInfo.namesIndex[i]) !== null && _a !== void 0 ? _a : i);
|
|
97129
97318
|
i++;
|
|
97130
97319
|
var cacheKey = mode !== undefined ? mode + "|" + name : name;
|
|
97131
97320
|
if (cache.has(cacheKey)) {
|
|
@@ -97183,14 +97372,14 @@ var ts;
|
|
|
97183
97372
|
ts.isReferenceFileLocation = isReferenceFileLocation;
|
|
97184
97373
|
function getReferencedFileLocation(getSourceFileByPath, ref) {
|
|
97185
97374
|
var _a, _b, _c;
|
|
97186
|
-
var _d, _e, _f, _g;
|
|
97375
|
+
var _d, _e, _f, _g, _h, _j;
|
|
97187
97376
|
var file = ts.Debug.checkDefined(getSourceFileByPath(ref.file));
|
|
97188
97377
|
var kind = ref.kind, index = ref.index;
|
|
97189
97378
|
var pos, end, packageId, resolutionMode;
|
|
97190
97379
|
switch (kind) {
|
|
97191
97380
|
case ts.FileIncludeKind.Import:
|
|
97192
97381
|
var importLiteral = getModuleNameStringLiteralAt(file, index);
|
|
97193
|
-
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;
|
|
97382
|
+
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;
|
|
97194
97383
|
if (importLiteral.pos === -1)
|
|
97195
97384
|
return { file: file, packageId: packageId, text: importLiteral.text };
|
|
97196
97385
|
pos = ts.skipTrivia(file.text, importLiteral.pos);
|
|
@@ -97201,7 +97390,7 @@ var ts;
|
|
|
97201
97390
|
break;
|
|
97202
97391
|
case ts.FileIncludeKind.TypeReferenceDirective:
|
|
97203
97392
|
(_b = file.typeReferenceDirectives[index], pos = _b.pos, end = _b.end, resolutionMode = _b.resolutionMode);
|
|
97204
|
-
packageId = (
|
|
97393
|
+
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;
|
|
97205
97394
|
break;
|
|
97206
97395
|
case ts.FileIncludeKind.LibReferenceDirective:
|
|
97207
97396
|
(_c = file.libReferenceDirectives[index], pos = _c.pos, end = _c.end);
|
|
@@ -97280,7 +97469,7 @@ var ts;
|
|
|
97280
97469
|
return undefined;
|
|
97281
97470
|
}
|
|
97282
97471
|
function lookupFromPackageJson() {
|
|
97283
|
-
var scope = ts.getPackageScopeForPath(fileName, packageJsonInfoCache, host, options);
|
|
97472
|
+
var scope = ts.getPackageScopeForPath(fileName, ts.getTemporaryModuleResolutionState(packageJsonInfoCache, host, options));
|
|
97284
97473
|
return (scope === null || scope === void 0 ? void 0 : scope.packageJsonContent.type) === "module" ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS;
|
|
97285
97474
|
}
|
|
97286
97475
|
}
|
|
@@ -97393,10 +97582,10 @@ var ts;
|
|
|
97393
97582
|
};
|
|
97394
97583
|
}
|
|
97395
97584
|
function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) {
|
|
97396
|
-
var _a, _b, _c, _d;
|
|
97585
|
+
var _a, _b, _c, _d, _e;
|
|
97397
97586
|
var createProgramOptions = ts.isArray(rootNamesOrOptions) ? createCreateProgramOptions(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) : rootNamesOrOptions;
|
|
97398
97587
|
var rootNames = createProgramOptions.rootNames, options = createProgramOptions.options, configFileParsingDiagnostics = createProgramOptions.configFileParsingDiagnostics, projectReferences = createProgramOptions.projectReferences;
|
|
97399
|
-
var
|
|
97588
|
+
var oldProgramOrOldBuildInfoProgramConstructor = createProgramOptions.oldProgram;
|
|
97400
97589
|
var processingDefaultLibFiles;
|
|
97401
97590
|
var processingOtherFiles;
|
|
97402
97591
|
var files;
|
|
@@ -97410,6 +97599,8 @@ var ts;
|
|
|
97410
97599
|
var cachedDeclarationDiagnosticsForFile = {};
|
|
97411
97600
|
var resolvedTypeReferenceDirectives = ts.createModeAwareCache();
|
|
97412
97601
|
var fileProcessingDiagnostics;
|
|
97602
|
+
var automaticTypeDirectiveNames;
|
|
97603
|
+
var automaticTypeDirectiveResolutions;
|
|
97413
97604
|
var maxNodeModuleJsDepth = typeof options.maxNodeModuleJsDepth === "number" ? options.maxNodeModuleJsDepth : 0;
|
|
97414
97605
|
var currentNodeModulesDepth = 0;
|
|
97415
97606
|
var modulesWithElidedImports = new ts.Map();
|
|
@@ -97432,29 +97623,69 @@ var ts;
|
|
|
97432
97623
|
var actualResolveModuleNamesWorker;
|
|
97433
97624
|
var hasInvalidatedResolution = host.hasInvalidatedResolution || ts.returnFalse;
|
|
97434
97625
|
if (host.resolveModuleNames) {
|
|
97435
|
-
actualResolveModuleNamesWorker = function (moduleNames, containingFile, containingFileName,
|
|
97436
|
-
|
|
97437
|
-
|
|
97438
|
-
|
|
97439
|
-
|
|
97440
|
-
|
|
97441
|
-
return
|
|
97442
|
-
|
|
97626
|
+
actualResolveModuleNamesWorker = function (moduleNames, containingFile, containingFileName, redirectedReference, partialResolutionInfo) {
|
|
97627
|
+
var _a;
|
|
97628
|
+
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) {
|
|
97629
|
+
var name = _a.name;
|
|
97630
|
+
return name;
|
|
97631
|
+
}), redirectedReference, options, containingFile, partialResolutionInfo);
|
|
97632
|
+
return result.some(isResolvedModuleWithFailedLookupLocation) ?
|
|
97633
|
+
result :
|
|
97634
|
+
result.map(function (resolved) { return resolved ?
|
|
97635
|
+
resolved.extension !== undefined ?
|
|
97636
|
+
{ resolvedModule: resolved, failedLookupLocations: emptyResolution.failedLookupLocations } :
|
|
97637
|
+
{ resolvedModule: __assign(__assign({}, resolved), { extension: ts.extensionFromPath(resolved.resolvedFileName) }), failedLookupLocations: emptyResolution.failedLookupLocations } :
|
|
97638
|
+
emptyResolution; });
|
|
97639
|
+
};
|
|
97443
97640
|
moduleResolutionCache = (_a = host.getModuleResolutionCache) === null || _a === void 0 ? void 0 : _a.call(host);
|
|
97444
97641
|
}
|
|
97445
97642
|
else {
|
|
97446
97643
|
moduleResolutionCache = ts.createModuleResolutionCache(currentDirectory, getCanonicalFileName, options);
|
|
97447
|
-
var loader_1 = function (moduleName, resolverMode, containingFileName, redirectedReference) { return ts.resolveModuleName(moduleName, containingFileName, options, host, moduleResolutionCache, redirectedReference, resolverMode)
|
|
97448
|
-
actualResolveModuleNamesWorker = function (moduleNames, containingFile, containingFileName,
|
|
97644
|
+
var loader_1 = function (moduleName, resolverMode, containingFileName, redirectedReference) { return ts.resolveModuleName(moduleName, containingFileName, options, host, moduleResolutionCache, redirectedReference, resolverMode); };
|
|
97645
|
+
actualResolveModuleNamesWorker = function (moduleNames, containingFile, containingFileName, redirectedReference, partialResolutionInfo) {
|
|
97646
|
+
return loadWithModeAwareCache(moduleNames, containingFile, containingFileName, redirectedReference, partialResolutionInfo, loader_1);
|
|
97647
|
+
};
|
|
97449
97648
|
}
|
|
97450
97649
|
var actualResolveTypeReferenceDirectiveNamesWorker;
|
|
97451
97650
|
if (host.resolveTypeReferenceDirectives) {
|
|
97452
|
-
actualResolveTypeReferenceDirectiveNamesWorker = function (typeDirectiveNames, containingFile, redirectedReference, containingFileMode
|
|
97651
|
+
actualResolveTypeReferenceDirectiveNamesWorker = function (typeDirectiveNames, containingFile, redirectedReference, containingFileMode, partialResolutionInfo) {
|
|
97652
|
+
var result = host.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference, options, containingFileMode, partialResolutionInfo);
|
|
97653
|
+
return result.some(isResolvedTypeReferenceDirectiveWithFailedLookupLocations) ?
|
|
97654
|
+
result :
|
|
97655
|
+
result.map(function (resolved) { return resolved ?
|
|
97656
|
+
{ resolvedTypeReferenceDirective: resolved, failedLookupLocations: emptyResolution.failedLookupLocations } :
|
|
97657
|
+
emptyResolution; });
|
|
97658
|
+
};
|
|
97659
|
+
typeReferenceDirectiveResolutionCache = (_b = host.getTypeReferenceDirectiveResolutionCache) === null || _b === void 0 ? void 0 : _b.call(host);
|
|
97453
97660
|
}
|
|
97454
97661
|
else {
|
|
97455
97662
|
typeReferenceDirectiveResolutionCache = ts.createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, undefined, moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache());
|
|
97456
|
-
var loader_2 = function (typesRef, containingFile, redirectedReference, resolutionMode) { return ts.resolveTypeReferenceDirective(typesRef, containingFile, options, host, redirectedReference, typeReferenceDirectiveResolutionCache, resolutionMode)
|
|
97457
|
-
actualResolveTypeReferenceDirectiveNamesWorker = function (typeReferenceDirectiveNames, containingFile, redirectedReference, containingFileMode) {
|
|
97663
|
+
var loader_2 = function (typesRef, containingFile, redirectedReference, resolutionMode) { return ts.resolveTypeReferenceDirective(typesRef, containingFile, options, host, redirectedReference, typeReferenceDirectiveResolutionCache, resolutionMode); };
|
|
97664
|
+
actualResolveTypeReferenceDirectiveNamesWorker = function (typeReferenceDirectiveNames, containingFile, redirectedReference, containingFileMode) {
|
|
97665
|
+
return loadWithTypeDirectiveCache(typeReferenceDirectiveNames, containingFile, redirectedReference, containingFileMode, loader_2);
|
|
97666
|
+
};
|
|
97667
|
+
}
|
|
97668
|
+
var oldProgram = typeof oldProgramOrOldBuildInfoProgramConstructor === "object" ? oldProgramOrOldBuildInfoProgramConstructor : undefined;
|
|
97669
|
+
var oldBuildInfoProgram;
|
|
97670
|
+
if (!oldProgram && typeof oldProgramOrOldBuildInfoProgramConstructor === "function") {
|
|
97671
|
+
var state_11 = ts.getTemporaryModuleResolutionState(moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache(), host, options);
|
|
97672
|
+
oldBuildInfoProgram = oldProgramOrOldBuildInfoProgramConstructor({
|
|
97673
|
+
fileExists: function (fileName) { return host.fileExists(fileName); },
|
|
97674
|
+
createHash: ts.maybeBind(host, host.createHash),
|
|
97675
|
+
getPackageJsonInfo: function (fileName) { return ts.getPackageJsonInfo(ts.getDirectoryPath(fileName), false, state_11); },
|
|
97676
|
+
});
|
|
97677
|
+
if (oldBuildInfoProgram) {
|
|
97678
|
+
moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.setOldResolutionCache({
|
|
97679
|
+
getResolved: function (dirPath, name, mode, redirectedReference) {
|
|
97680
|
+
return oldBuildInfoProgram === null || oldBuildInfoProgram === void 0 ? void 0 : oldBuildInfoProgram.getResolvedModule(dirPath, name, mode, redirectedReference);
|
|
97681
|
+
}
|
|
97682
|
+
});
|
|
97683
|
+
typeReferenceDirectiveResolutionCache === null || typeReferenceDirectiveResolutionCache === void 0 ? void 0 : typeReferenceDirectiveResolutionCache.setOldResolutionCache({
|
|
97684
|
+
getResolved: function (dirPath, name, mode, redirectedReference) {
|
|
97685
|
+
return oldBuildInfoProgram === null || oldBuildInfoProgram === void 0 ? void 0 : oldBuildInfoProgram.getResolvedTypeReferenceDirective(dirPath, name, mode, redirectedReference);
|
|
97686
|
+
}
|
|
97687
|
+
});
|
|
97688
|
+
}
|
|
97458
97689
|
}
|
|
97459
97690
|
var packageIdToSourceFile = new ts.Map();
|
|
97460
97691
|
var sourceFileToPackageName = new ts.Map();
|
|
@@ -97467,9 +97698,9 @@ var ts;
|
|
|
97467
97698
|
var projectReferenceRedirects;
|
|
97468
97699
|
var mapFromFileToProjectReferenceRedirects;
|
|
97469
97700
|
var mapFromToProjectReferenceRedirectSource;
|
|
97470
|
-
var useSourceOfProjectReferenceRedirect = !!((
|
|
97701
|
+
var useSourceOfProjectReferenceRedirect = !!((_c = host.useSourceOfProjectReferenceRedirect) === null || _c === void 0 ? void 0 : _c.call(host)) &&
|
|
97471
97702
|
!options.disableSourceOfProjectReferenceRedirect;
|
|
97472
|
-
var
|
|
97703
|
+
var _f = updateHostForUseSourceOfProjectReferenceRedirect({
|
|
97473
97704
|
compilerHost: host,
|
|
97474
97705
|
getSymlinkCache: getSymlinkCache,
|
|
97475
97706
|
useSourceOfProjectReferenceRedirect: useSourceOfProjectReferenceRedirect,
|
|
@@ -97477,7 +97708,7 @@ var ts;
|
|
|
97477
97708
|
getResolvedProjectReferences: getResolvedProjectReferences,
|
|
97478
97709
|
getSourceOfProjectReferenceRedirect: getSourceOfProjectReferenceRedirect,
|
|
97479
97710
|
forEachResolvedProjectReference: forEachResolvedProjectReference
|
|
97480
|
-
}), onProgramCreateComplete =
|
|
97711
|
+
}), onProgramCreateComplete = _f.onProgramCreateComplete, fileExists = _f.fileExists, directoryExists = _f.directoryExists;
|
|
97481
97712
|
var readFile = host.readFile.bind(host);
|
|
97482
97713
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program", "shouldProgramCreateNewSourceFiles", { hasOldProgram: !!oldProgram });
|
|
97483
97714
|
var shouldCreateNewSourceFile = shouldProgramCreateNewSourceFiles(oldProgram, options);
|
|
@@ -97486,7 +97717,7 @@ var ts;
|
|
|
97486
97717
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program", "tryReuseStructureFromOldProgram", {});
|
|
97487
97718
|
structureIsReused = tryReuseStructureFromOldProgram();
|
|
97488
97719
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
97489
|
-
if (structureIsReused !==
|
|
97720
|
+
if (structureIsReused !== 3) {
|
|
97490
97721
|
processingDefaultLibFiles = [];
|
|
97491
97722
|
processingOtherFiles = [];
|
|
97492
97723
|
if (projectReferences) {
|
|
@@ -97526,14 +97757,14 @@ var ts;
|
|
|
97526
97757
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program", "processRootFiles", { count: rootNames.length });
|
|
97527
97758
|
ts.forEach(rootNames, function (name, index) { return processRootFile(name, false, false, { kind: ts.FileIncludeKind.RootFile, index: index }); });
|
|
97528
97759
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
97529
|
-
|
|
97530
|
-
|
|
97531
|
-
|
|
97532
|
-
|
|
97533
|
-
var
|
|
97534
|
-
var
|
|
97535
|
-
|
|
97536
|
-
processTypeReferenceDirective(
|
|
97760
|
+
automaticTypeDirectiveNames !== null && automaticTypeDirectiveNames !== void 0 ? automaticTypeDirectiveNames : (automaticTypeDirectiveNames = rootNames.length ? ts.getAutomaticTypeDirectiveNames(options, host) : ts.emptyArray);
|
|
97761
|
+
automaticTypeDirectiveResolutions = ts.createModeAwareCache();
|
|
97762
|
+
if (automaticTypeDirectiveNames.length) {
|
|
97763
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program", "processTypeReferences", { count: automaticTypeDirectiveNames.length });
|
|
97764
|
+
var resolutions = resolveTypeReferenceDirectiveNamesReusingOldState(automaticTypeDirectiveNames, getAutomaticTypeDirectiveContainingFile());
|
|
97765
|
+
for (var i = 0; i < automaticTypeDirectiveNames.length; i++) {
|
|
97766
|
+
automaticTypeDirectiveResolutions.set(automaticTypeDirectiveNames[i], undefined, resolutions[i]);
|
|
97767
|
+
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 });
|
|
97537
97768
|
}
|
|
97538
97769
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
97539
97770
|
}
|
|
@@ -97564,13 +97795,13 @@ var ts;
|
|
|
97564
97795
|
var newFile = getSourceFileByPath(oldSourceFile.resolvedPath);
|
|
97565
97796
|
if (shouldCreateNewSourceFile || !newFile ||
|
|
97566
97797
|
(oldSourceFile.resolvedPath === oldSourceFile.path && newFile.resolvedPath !== oldSourceFile.path)) {
|
|
97567
|
-
host.onReleaseOldSourceFile(oldSourceFile, oldProgram.getCompilerOptions()
|
|
97798
|
+
host.onReleaseOldSourceFile(oldSourceFile, oldProgram.getCompilerOptions());
|
|
97568
97799
|
}
|
|
97569
97800
|
}
|
|
97570
97801
|
if (!host.getParsedCommandLine) {
|
|
97571
97802
|
oldProgram.forEachResolvedProjectReference(function (resolvedProjectReference) {
|
|
97572
97803
|
if (!getResolvedProjectReferenceByPath(resolvedProjectReference.sourceFile.path)) {
|
|
97573
|
-
host.onReleaseOldSourceFile(resolvedProjectReference.sourceFile, oldProgram.getCompilerOptions()
|
|
97804
|
+
host.onReleaseOldSourceFile(resolvedProjectReference.sourceFile, oldProgram.getCompilerOptions());
|
|
97574
97805
|
}
|
|
97575
97806
|
});
|
|
97576
97807
|
}
|
|
@@ -97586,6 +97817,8 @@ var ts;
|
|
|
97586
97817
|
}
|
|
97587
97818
|
typeReferenceDirectiveResolutionCache = undefined;
|
|
97588
97819
|
oldProgram = undefined;
|
|
97820
|
+
oldBuildInfoProgram = undefined;
|
|
97821
|
+
oldProgramOrOldBuildInfoProgramConstructor = undefined;
|
|
97589
97822
|
var program = {
|
|
97590
97823
|
getRootFileNames: function () { return rootNames; },
|
|
97591
97824
|
getSourceFile: getSourceFile,
|
|
@@ -97593,6 +97826,7 @@ var ts;
|
|
|
97593
97826
|
getSourceFiles: function () { return files; },
|
|
97594
97827
|
getMissingFilePaths: function () { return missingFilePaths; },
|
|
97595
97828
|
getModuleResolutionCache: function () { return moduleResolutionCache; },
|
|
97829
|
+
getTypeReferenceDirectiveResolutionCache: function () { return typeReferenceDirectiveResolutionCache; },
|
|
97596
97830
|
getFilesByNameMap: function () { return filesByName; },
|
|
97597
97831
|
getCompilerOptions: function () { return options; },
|
|
97598
97832
|
getSyntacticDiagnostics: getSyntacticDiagnostics,
|
|
@@ -97617,6 +97851,9 @@ var ts;
|
|
|
97617
97851
|
getRelationCacheSizes: function () { return getTypeChecker().getRelationCacheSizes(); },
|
|
97618
97852
|
getFileProcessingDiagnostics: function () { return fileProcessingDiagnostics; },
|
|
97619
97853
|
getResolvedTypeReferenceDirectives: function () { return resolvedTypeReferenceDirectives; },
|
|
97854
|
+
getAutomaticTypeDirectiveNames: function () { return automaticTypeDirectiveNames; },
|
|
97855
|
+
getAutomaticTypeDirectiveResolutions: function () { return automaticTypeDirectiveResolutions; },
|
|
97856
|
+
getAutomaticTypeDirectiveContainingFile: getAutomaticTypeDirectiveContainingFile,
|
|
97620
97857
|
isSourceFileFromExternalLibrary: isSourceFileFromExternalLibrary,
|
|
97621
97858
|
isSourceFileDefaultLibrary: isSourceFileDefaultLibrary,
|
|
97622
97859
|
getSourceFileFromReference: getSourceFileFromReference,
|
|
@@ -97626,12 +97863,12 @@ var ts;
|
|
|
97626
97863
|
usesUriStyleNodeCoreModules: usesUriStyleNodeCoreModules,
|
|
97627
97864
|
isEmittedFile: isEmittedFile,
|
|
97628
97865
|
getConfigFileParsingDiagnostics: getConfigFileParsingDiagnostics,
|
|
97629
|
-
getResolvedModuleWithFailedLookupLocationsFromCache: getResolvedModuleWithFailedLookupLocationsFromCache,
|
|
97630
97866
|
getProjectReferences: getProjectReferences,
|
|
97631
97867
|
getResolvedProjectReferences: getResolvedProjectReferences,
|
|
97632
97868
|
getProjectReferenceRedirect: getProjectReferenceRedirect,
|
|
97633
97869
|
getResolvedProjectReferenceToRedirect: getResolvedProjectReferenceToRedirect,
|
|
97634
97870
|
getResolvedProjectReferenceByPath: getResolvedProjectReferenceByPath,
|
|
97871
|
+
getRedirectReferenceForResolution: getRedirectReferenceForResolution,
|
|
97635
97872
|
forEachResolvedProjectReference: forEachResolvedProjectReference,
|
|
97636
97873
|
isSourceOfProjectReferenceRedirect: isSourceOfProjectReferenceRedirect,
|
|
97637
97874
|
emitBuildInfo: emitBuildInfo,
|
|
@@ -97639,7 +97876,7 @@ var ts;
|
|
|
97639
97876
|
readFile: readFile,
|
|
97640
97877
|
directoryExists: directoryExists,
|
|
97641
97878
|
getSymlinkCache: getSymlinkCache,
|
|
97642
|
-
realpath: (
|
|
97879
|
+
realpath: (_e = host.realpath) === null || _e === void 0 ? void 0 : _e.bind(host),
|
|
97643
97880
|
useCaseSensitiveFileNames: function () { return host.useCaseSensitiveFileNames(); },
|
|
97644
97881
|
getFileIncludeReasons: function () { return fileReasons; },
|
|
97645
97882
|
structureIsReused: structureIsReused,
|
|
@@ -97653,6 +97890,8 @@ var ts;
|
|
|
97653
97890
|
case 0:
|
|
97654
97891
|
var _a = getReferencedFileLocation(getSourceFileByPath, diagnostic.reason), file = _a.file, pos = _a.pos, end = _a.end;
|
|
97655
97892
|
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)));
|
|
97893
|
+
case 2:
|
|
97894
|
+
return diagnostic.diagnostics.forEach(function (d) { return programDiagnostics.add(d); });
|
|
97656
97895
|
default:
|
|
97657
97896
|
ts.Debug.assertNever(diagnostic);
|
|
97658
97897
|
}
|
|
@@ -97662,57 +97901,44 @@ var ts;
|
|
|
97662
97901
|
ts.performance.measure("Program", "beforeProgram", "afterProgram");
|
|
97663
97902
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
97664
97903
|
return program;
|
|
97665
|
-
function
|
|
97666
|
-
|
|
97667
|
-
|
|
97668
|
-
for (var _i = 0, list_3 = list; _i < list_3.length; _i++) {
|
|
97669
|
-
var elem = list_3[_i];
|
|
97670
|
-
programDiagnostics.add(elem);
|
|
97671
|
-
}
|
|
97904
|
+
function getAutomaticTypeDirectiveContainingFile() {
|
|
97905
|
+
var containingDirectory = options.configFilePath ? ts.getDirectoryPath(options.configFilePath) : host.getCurrentDirectory();
|
|
97906
|
+
return ts.combinePaths(containingDirectory, ts.inferredTypesContainingFile);
|
|
97672
97907
|
}
|
|
97673
|
-
function
|
|
97674
|
-
|
|
97675
|
-
if (!moduleResolutionCache)
|
|
97908
|
+
function addResolutionDiagnostics(resolution) {
|
|
97909
|
+
if (!resolution.resolutionDiagnostics)
|
|
97676
97910
|
return;
|
|
97677
|
-
|
|
97678
|
-
|
|
97679
|
-
|
|
97680
|
-
|
|
97681
|
-
|
|
97682
|
-
|
|
97683
|
-
var n = names_4[_i];
|
|
97684
|
-
var mode = typeof n === "string" ? getModeForResolutionAtIndex(containingFile, i) : getModeForFileReference(n, containingFileMode);
|
|
97685
|
-
var name = typeof n === "string" ? n : n.fileName;
|
|
97686
|
-
i++;
|
|
97687
|
-
if (ts.isExternalModuleNameRelative(name))
|
|
97688
|
-
continue;
|
|
97689
|
-
var diags = (_a = moduleResolutionCache.getOrCreateCacheForModuleName(name, mode, redirectedReference).get(containingDir)) === null || _a === void 0 ? void 0 : _a.resolutionDiagnostics;
|
|
97690
|
-
addResolutionDiagnostics(diags);
|
|
97691
|
-
}
|
|
97911
|
+
(fileProcessingDiagnostics !== null && fileProcessingDiagnostics !== void 0 ? fileProcessingDiagnostics : (fileProcessingDiagnostics = [])).push({
|
|
97912
|
+
kind: 2,
|
|
97913
|
+
diagnostics: resolution.resolutionDiagnostics.map(function (d) { return ts.createCompilerDiagnostic(d.isImports
|
|
97914
|
+
? 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
|
|
97915
|
+
: 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); })
|
|
97916
|
+
});
|
|
97692
97917
|
}
|
|
97693
|
-
function resolveModuleNamesWorker(moduleNames, containingFile,
|
|
97918
|
+
function resolveModuleNamesWorker(moduleNames, containingFile, partialResolutionInfo, redirectedReference) {
|
|
97694
97919
|
if (!moduleNames.length)
|
|
97695
97920
|
return ts.emptyArray;
|
|
97696
97921
|
var containingFileName = ts.getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory);
|
|
97697
|
-
|
|
97922
|
+
if (redirectedReference === undefined)
|
|
97923
|
+
redirectedReference = getRedirectReferenceForResolution(containingFile);
|
|
97698
97924
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program", "resolveModuleNamesWorker", { containingFileName: containingFileName });
|
|
97699
97925
|
ts.performance.mark("beforeResolveModule");
|
|
97700
|
-
var result = actualResolveModuleNamesWorker(moduleNames, containingFile, containingFileName,
|
|
97926
|
+
var result = actualResolveModuleNamesWorker(moduleNames, containingFile, containingFileName, redirectedReference || undefined, partialResolutionInfo);
|
|
97701
97927
|
ts.performance.mark("afterResolveModule");
|
|
97702
97928
|
ts.performance.measure("ResolveModule", "beforeResolveModule", "afterResolveModule");
|
|
97703
97929
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
97704
|
-
pullDiagnosticsFromCache(moduleNames, containingFile);
|
|
97705
97930
|
return result;
|
|
97706
97931
|
}
|
|
97707
|
-
function resolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFile) {
|
|
97932
|
+
function resolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFile, partialResolutionInfo, redirectedReference) {
|
|
97708
97933
|
if (!typeDirectiveNames.length)
|
|
97709
97934
|
return [];
|
|
97710
97935
|
var containingFileName = !ts.isString(containingFile) ? ts.getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory) : containingFile;
|
|
97711
|
-
|
|
97936
|
+
if (redirectedReference === undefined && !ts.isString(containingFile))
|
|
97937
|
+
redirectedReference = getRedirectReferenceForResolution(containingFile);
|
|
97712
97938
|
var containingFileMode = !ts.isString(containingFile) ? containingFile.impliedNodeFormat : undefined;
|
|
97713
97939
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program", "resolveTypeReferenceDirectiveNamesWorker", { containingFileName: containingFileName });
|
|
97714
97940
|
ts.performance.mark("beforeResolveTypeReference");
|
|
97715
|
-
var result = actualResolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFileName, redirectedReference, containingFileMode);
|
|
97941
|
+
var result = actualResolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFileName, redirectedReference || undefined, containingFileMode, partialResolutionInfo);
|
|
97716
97942
|
ts.performance.mark("afterResolveTypeReference");
|
|
97717
97943
|
ts.performance.measure("ResolveTypeReference", "beforeResolveTypeReference", "afterResolveTypeReference");
|
|
97718
97944
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
@@ -97758,9 +97984,6 @@ var ts;
|
|
|
97758
97984
|
}
|
|
97759
97985
|
return ts.libs.length + 2;
|
|
97760
97986
|
}
|
|
97761
|
-
function getResolvedModuleWithFailedLookupLocationsFromCache(moduleName, containingFile, mode) {
|
|
97762
|
-
return moduleResolutionCache && ts.resolveModuleNameFromCache(moduleName, containingFile, moduleResolutionCache, mode);
|
|
97763
|
-
}
|
|
97764
97987
|
function toPath(fileName) {
|
|
97765
97988
|
return ts.toPath(fileName, currentDirectory, getCanonicalFileName);
|
|
97766
97989
|
}
|
|
@@ -97784,8 +98007,9 @@ var ts;
|
|
|
97784
98007
|
return classifiableNames;
|
|
97785
98008
|
}
|
|
97786
98009
|
function resolveModuleNamesReusingOldState(moduleNames, file) {
|
|
98010
|
+
var _a;
|
|
97787
98011
|
if (structureIsReused === 0 && !file.ambientModuleNames.length) {
|
|
97788
|
-
return resolveModuleNamesWorker(moduleNames, file, undefined);
|
|
98012
|
+
return resolveModuleNamesWorker(moduleNames, file, undefined, undefined);
|
|
97789
98013
|
}
|
|
97790
98014
|
var oldSourceFile = oldProgram && oldProgram.getSourceFile(file.fileName);
|
|
97791
98015
|
if (oldSourceFile !== file && file.resolvedModules) {
|
|
@@ -97800,21 +98024,34 @@ var ts;
|
|
|
97800
98024
|
return result_14;
|
|
97801
98025
|
}
|
|
97802
98026
|
var unknownModuleNames;
|
|
97803
|
-
var
|
|
98027
|
+
var unknownModuleNamesIndex;
|
|
97804
98028
|
var reusedNames;
|
|
97805
|
-
var
|
|
98029
|
+
var result;
|
|
98030
|
+
var predictedToResolveToAmbientModuleMarker = true;
|
|
98031
|
+
var redirectedReference;
|
|
97806
98032
|
for (var i = 0; i < moduleNames.length; i++) {
|
|
97807
98033
|
var moduleName = moduleNames[i];
|
|
97808
|
-
if (file === oldSourceFile && !hasInvalidatedResolution(oldSourceFile.path)) {
|
|
97809
|
-
var
|
|
97810
|
-
|
|
98034
|
+
if (oldBuildInfoProgram || file === oldSourceFile && !hasInvalidatedResolution(oldSourceFile.path)) {
|
|
98035
|
+
var mode = getModeForResolutionAtIndex(file, i);
|
|
98036
|
+
var oldResolution = !oldBuildInfoProgram ?
|
|
98037
|
+
(_a = oldSourceFile === null || oldSourceFile === void 0 ? void 0 : oldSourceFile.resolvedModules) === null || _a === void 0 ? void 0 : _a.get(moduleName, mode) :
|
|
98038
|
+
oldBuildInfoProgram.getResolvedModule(ts.getDirectoryPath(file.path), moduleName, mode, (redirectedReference === undefined ? (redirectedReference = getRedirectReferenceForResolution(file) || false) : redirectedReference) || undefined);
|
|
98039
|
+
if (oldResolution === null || oldResolution === void 0 ? void 0 : oldResolution.resolvedModule) {
|
|
97811
98040
|
if (ts.isTraceEnabled(options, host)) {
|
|
97812
|
-
ts.
|
|
97813
|
-
|
|
97814
|
-
ts.
|
|
98041
|
+
var fileLocation = ts.getNormalizedAbsolutePath(file.originalFileName, currentDirectory);
|
|
98042
|
+
if (!oldBuildInfoProgram) {
|
|
98043
|
+
ts.trace(host, oldResolution.resolvedModule.packageId ?
|
|
98044
|
+
ts.Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 :
|
|
98045
|
+
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));
|
|
98046
|
+
}
|
|
98047
|
+
else {
|
|
98048
|
+
ts.trace(host, oldResolution.resolvedModule.packageId ?
|
|
98049
|
+
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 :
|
|
98050
|
+
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));
|
|
98051
|
+
}
|
|
97815
98052
|
}
|
|
97816
|
-
(result
|
|
97817
|
-
(reusedNames
|
|
98053
|
+
(result !== null && result !== void 0 ? result : (result = new Array(moduleNames.length)))[i] = oldResolution;
|
|
98054
|
+
(reusedNames !== null && reusedNames !== void 0 ? reusedNames : (reusedNames = [])).push({ name: moduleName, mode: mode });
|
|
97818
98055
|
continue;
|
|
97819
98056
|
}
|
|
97820
98057
|
}
|
|
@@ -97829,14 +98066,15 @@ var ts;
|
|
|
97829
98066
|
resolvesToAmbientModuleInNonModifiedFile = moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName, i);
|
|
97830
98067
|
}
|
|
97831
98068
|
if (resolvesToAmbientModuleInNonModifiedFile) {
|
|
97832
|
-
(result
|
|
98069
|
+
(result !== null && result !== void 0 ? result : (result = new Array(moduleNames.length)))[i] = predictedToResolveToAmbientModuleMarker;
|
|
97833
98070
|
}
|
|
97834
98071
|
else {
|
|
97835
|
-
(unknownModuleNames
|
|
98072
|
+
(unknownModuleNames !== null && unknownModuleNames !== void 0 ? unknownModuleNames : (unknownModuleNames = [])).push(moduleName);
|
|
98073
|
+
(unknownModuleNamesIndex !== null && unknownModuleNamesIndex !== void 0 ? unknownModuleNamesIndex : (unknownModuleNamesIndex = [])).push(i);
|
|
97836
98074
|
}
|
|
97837
98075
|
}
|
|
97838
98076
|
var resolutions = unknownModuleNames && unknownModuleNames.length
|
|
97839
|
-
? resolveModuleNamesWorker(unknownModuleNames, file, reusedNames)
|
|
98077
|
+
? resolveModuleNamesWorker(unknownModuleNames, file, { reusedNames: reusedNames, namesIndex: unknownModuleNamesIndex }, redirectedReference)
|
|
97840
98078
|
: ts.emptyArray;
|
|
97841
98079
|
if (!result) {
|
|
97842
98080
|
ts.Debug.assert(resolutions.length === moduleNames.length);
|
|
@@ -97846,7 +98084,7 @@ var ts;
|
|
|
97846
98084
|
for (var i = 0; i < result.length; i++) {
|
|
97847
98085
|
if (result[i]) {
|
|
97848
98086
|
if (result[i] === predictedToResolveToAmbientModuleMarker) {
|
|
97849
|
-
result[i] =
|
|
98087
|
+
result[i] = emptyResolution;
|
|
97850
98088
|
}
|
|
97851
98089
|
}
|
|
97852
98090
|
else {
|
|
@@ -97874,6 +98112,78 @@ var ts;
|
|
|
97874
98112
|
return true;
|
|
97875
98113
|
}
|
|
97876
98114
|
}
|
|
98115
|
+
function resolveTypeReferenceDirectiveNamesReusingOldState(typeDirectiveNames, containingFile) {
|
|
98116
|
+
var _a;
|
|
98117
|
+
if (structureIsReused === 0) {
|
|
98118
|
+
return resolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFile, undefined, undefined);
|
|
98119
|
+
}
|
|
98120
|
+
var containingSourceFile = !ts.isString(containingFile) ? containingFile : undefined;
|
|
98121
|
+
var inferredTypeFile = !ts.isString(containingFile) ? undefined : containingFile;
|
|
98122
|
+
var oldSourceFile = containingSourceFile && (oldProgram === null || oldProgram === void 0 ? void 0 : oldProgram.getSourceFile(containingSourceFile.fileName));
|
|
98123
|
+
if (containingSourceFile && oldSourceFile !== containingSourceFile && containingSourceFile.resolvedTypeReferenceDirectiveNames) {
|
|
98124
|
+
var result_15 = [];
|
|
98125
|
+
for (var _i = 0, _b = typeDirectiveNames; _i < _b.length; _i++) {
|
|
98126
|
+
var typeDirectiveName = _b[_i];
|
|
98127
|
+
var resolvedTypeReferenceDirective = containingSourceFile.resolvedTypeReferenceDirectiveNames.get(ts.toFileNameLowerCase(typeDirectiveName.fileName), typeDirectiveName.resolutionMode || containingSourceFile.impliedNodeFormat);
|
|
98128
|
+
result_15.push(resolvedTypeReferenceDirective);
|
|
98129
|
+
}
|
|
98130
|
+
return result_15;
|
|
98131
|
+
}
|
|
98132
|
+
var unknownTypeReferenceDirectiveNames;
|
|
98133
|
+
var unknownTypeReferenceDirectiveNamesIndex;
|
|
98134
|
+
var result;
|
|
98135
|
+
var reusedNames;
|
|
98136
|
+
var canReuseResolutions = oldBuildInfoProgram || (containingSourceFile ?
|
|
98137
|
+
containingSourceFile === oldSourceFile && !hasInvalidatedResolution(oldSourceFile.path) :
|
|
98138
|
+
!hasInvalidatedResolution(toPath(inferredTypeFile)));
|
|
98139
|
+
var redirectedReference;
|
|
98140
|
+
for (var i = 0; i < typeDirectiveNames.length; i++) {
|
|
98141
|
+
var entry = typeDirectiveNames[i];
|
|
98142
|
+
if (canReuseResolutions) {
|
|
98143
|
+
var typeDirectiveName = !ts.isString(entry) ? entry.fileName.toLowerCase() : entry;
|
|
98144
|
+
var mode = getModeForFileReference(entry, containingSourceFile === null || containingSourceFile === void 0 ? void 0 : containingSourceFile.impliedNodeFormat);
|
|
98145
|
+
var oldResolution = !oldBuildInfoProgram ?
|
|
98146
|
+
(_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) :
|
|
98147
|
+
oldBuildInfoProgram.getResolvedTypeReferenceDirective(ts.getDirectoryPath(containingSourceFile ? containingSourceFile.path : toPath(inferredTypeFile)), typeDirectiveName, mode, containingSourceFile && (redirectedReference === undefined ? (redirectedReference = getRedirectReferenceForResolution(containingSourceFile) || false) : redirectedReference) || undefined);
|
|
98148
|
+
if (oldResolution === null || oldResolution === void 0 ? void 0 : oldResolution.resolvedTypeReferenceDirective) {
|
|
98149
|
+
if (ts.isTraceEnabled(options, host)) {
|
|
98150
|
+
var fileLocation = containingSourceFile ? ts.getNormalizedAbsolutePath(containingSourceFile.originalFileName, currentDirectory) : inferredTypeFile;
|
|
98151
|
+
if (!oldBuildInfoProgram) {
|
|
98152
|
+
ts.trace(host, oldResolution.resolvedTypeReferenceDirective.packageId ?
|
|
98153
|
+
ts.Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 :
|
|
98154
|
+
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));
|
|
98155
|
+
}
|
|
98156
|
+
else {
|
|
98157
|
+
ts.trace(host, oldResolution.resolvedTypeReferenceDirective.packageId ?
|
|
98158
|
+
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 :
|
|
98159
|
+
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));
|
|
98160
|
+
}
|
|
98161
|
+
}
|
|
98162
|
+
(result || (result = new Array(typeDirectiveNames.length)))[i] = oldResolution;
|
|
98163
|
+
(reusedNames !== null && reusedNames !== void 0 ? reusedNames : (reusedNames = [])).push({ name: typeDirectiveName, mode: mode });
|
|
98164
|
+
continue;
|
|
98165
|
+
}
|
|
98166
|
+
}
|
|
98167
|
+
(unknownTypeReferenceDirectiveNames !== null && unknownTypeReferenceDirectiveNames !== void 0 ? unknownTypeReferenceDirectiveNames : (unknownTypeReferenceDirectiveNames = [])).push(entry);
|
|
98168
|
+
(unknownTypeReferenceDirectiveNamesIndex !== null && unknownTypeReferenceDirectiveNamesIndex !== void 0 ? unknownTypeReferenceDirectiveNamesIndex : (unknownTypeReferenceDirectiveNamesIndex = [])).push(i);
|
|
98169
|
+
}
|
|
98170
|
+
if (!unknownTypeReferenceDirectiveNames)
|
|
98171
|
+
return result || ts.emptyArray;
|
|
98172
|
+
var resolutions = resolveTypeReferenceDirectiveNamesWorker(unknownTypeReferenceDirectiveNames, containingFile, { reusedNames: reusedNames, namesIndex: unknownTypeReferenceDirectiveNamesIndex }, redirectedReference);
|
|
98173
|
+
if (!result) {
|
|
98174
|
+
ts.Debug.assert(resolutions.length === typeDirectiveNames.length);
|
|
98175
|
+
return resolutions;
|
|
98176
|
+
}
|
|
98177
|
+
var j = 0;
|
|
98178
|
+
for (var i = 0; i < result.length; i++) {
|
|
98179
|
+
if (!result[i]) {
|
|
98180
|
+
result[i] = resolutions[j];
|
|
98181
|
+
j++;
|
|
98182
|
+
}
|
|
98183
|
+
}
|
|
98184
|
+
ts.Debug.assert(j === resolutions.length);
|
|
98185
|
+
return result;
|
|
98186
|
+
}
|
|
97877
98187
|
function canReuseProjectReferences() {
|
|
97878
98188
|
return !forEachProjectReference(oldProgram.getProjectReferences(), oldProgram.getResolvedProjectReferences(), function (oldResolvedRef, parent, index) {
|
|
97879
98189
|
var newRef = (parent ? parent.commandLine.projectReferences : projectReferences)[index];
|
|
@@ -97892,12 +98202,17 @@ var ts;
|
|
|
97892
98202
|
});
|
|
97893
98203
|
}
|
|
97894
98204
|
function tryReuseStructureFromOldProgram() {
|
|
97895
|
-
var
|
|
97896
|
-
if (!
|
|
98205
|
+
var oldOptions = (oldProgram === null || oldProgram === void 0 ? void 0 : oldProgram.getCompilerOptions()) || (oldBuildInfoProgram === null || oldBuildInfoProgram === void 0 ? void 0 : oldBuildInfoProgram.getCompilerOptions());
|
|
98206
|
+
if (!oldOptions || ts.changesAffectModuleResolution(oldOptions, options)) {
|
|
97897
98207
|
return 0;
|
|
97898
98208
|
}
|
|
97899
|
-
var
|
|
97900
|
-
|
|
98209
|
+
var result = tryReuseStructureFromOldProgramWorker();
|
|
98210
|
+
return options.cacheResolutions && (oldProgram || oldBuildInfoProgram) && result === 0 ?
|
|
98211
|
+
1 :
|
|
98212
|
+
result;
|
|
98213
|
+
}
|
|
98214
|
+
function tryReuseStructureFromOldProgramWorker() {
|
|
98215
|
+
if (!oldProgram) {
|
|
97901
98216
|
return 0;
|
|
97902
98217
|
}
|
|
97903
98218
|
var oldRootNames = oldProgram.getRootFileNames();
|
|
@@ -97912,7 +98227,7 @@ var ts;
|
|
|
97912
98227
|
}
|
|
97913
98228
|
var newSourceFiles = [];
|
|
97914
98229
|
var modifiedSourceFiles = [];
|
|
97915
|
-
structureIsReused =
|
|
98230
|
+
structureIsReused = 3;
|
|
97916
98231
|
if (oldProgram.getMissingFilePaths().some(function (missingFilePath) { return host.fileExists(missingFilePath); })) {
|
|
97917
98232
|
return 0;
|
|
97918
98233
|
}
|
|
@@ -97959,81 +98274,90 @@ var ts;
|
|
|
97959
98274
|
}
|
|
97960
98275
|
if (fileChanged) {
|
|
97961
98276
|
if (!ts.arrayIsEqualTo(oldSourceFile.libReferenceDirectives, newSourceFile.libReferenceDirectives, fileReferenceIsEqualTo)) {
|
|
97962
|
-
structureIsReused =
|
|
98277
|
+
structureIsReused = 2;
|
|
97963
98278
|
}
|
|
97964
98279
|
if (oldSourceFile.hasNoDefaultLib !== newSourceFile.hasNoDefaultLib) {
|
|
97965
|
-
structureIsReused =
|
|
98280
|
+
structureIsReused = 2;
|
|
97966
98281
|
}
|
|
97967
98282
|
if (!ts.arrayIsEqualTo(oldSourceFile.referencedFiles, newSourceFile.referencedFiles, fileReferenceIsEqualTo)) {
|
|
97968
|
-
structureIsReused =
|
|
98283
|
+
structureIsReused = 2;
|
|
97969
98284
|
}
|
|
97970
98285
|
collectExternalModuleReferences(newSourceFile);
|
|
97971
98286
|
if (!ts.arrayIsEqualTo(oldSourceFile.imports, newSourceFile.imports, moduleNameIsEqualTo)) {
|
|
97972
|
-
structureIsReused =
|
|
98287
|
+
structureIsReused = 2;
|
|
97973
98288
|
}
|
|
97974
98289
|
if (!ts.arrayIsEqualTo(oldSourceFile.moduleAugmentations, newSourceFile.moduleAugmentations, moduleNameIsEqualTo)) {
|
|
97975
|
-
structureIsReused =
|
|
98290
|
+
structureIsReused = 2;
|
|
97976
98291
|
}
|
|
97977
98292
|
if ((oldSourceFile.flags & 6291456) !== (newSourceFile.flags & 6291456)) {
|
|
97978
|
-
structureIsReused =
|
|
98293
|
+
structureIsReused = 2;
|
|
97979
98294
|
}
|
|
97980
98295
|
if (!ts.arrayIsEqualTo(oldSourceFile.typeReferenceDirectives, newSourceFile.typeReferenceDirectives, fileReferenceIsEqualTo)) {
|
|
97981
|
-
structureIsReused =
|
|
98296
|
+
structureIsReused = 2;
|
|
97982
98297
|
}
|
|
97983
98298
|
modifiedSourceFiles.push({ oldFile: oldSourceFile, newFile: newSourceFile });
|
|
97984
98299
|
}
|
|
97985
98300
|
else if (hasInvalidatedResolution(oldSourceFile.path)) {
|
|
97986
|
-
structureIsReused =
|
|
98301
|
+
structureIsReused = 2;
|
|
97987
98302
|
modifiedSourceFiles.push({ oldFile: oldSourceFile, newFile: newSourceFile });
|
|
97988
98303
|
}
|
|
97989
98304
|
newSourceFiles.push(newSourceFile);
|
|
97990
98305
|
}
|
|
97991
|
-
if (structureIsReused !==
|
|
98306
|
+
if (structureIsReused !== 3) {
|
|
97992
98307
|
return structureIsReused;
|
|
97993
98308
|
}
|
|
97994
98309
|
var modifiedFiles = modifiedSourceFiles.map(function (f) { return f.oldFile; });
|
|
97995
|
-
for (var
|
|
97996
|
-
var oldFile = oldSourceFiles_3[
|
|
98310
|
+
for (var _a = 0, oldSourceFiles_3 = oldSourceFiles; _a < oldSourceFiles_3.length; _a++) {
|
|
98311
|
+
var oldFile = oldSourceFiles_3[_a];
|
|
97997
98312
|
if (!ts.contains(modifiedFiles, oldFile)) {
|
|
97998
|
-
for (var
|
|
97999
|
-
var moduleName =
|
|
98313
|
+
for (var _b = 0, _c = oldFile.ambientModuleNames; _b < _c.length; _b++) {
|
|
98314
|
+
var moduleName = _c[_b];
|
|
98000
98315
|
ambientModuleNameToUnmodifiedFileName.set(moduleName, oldFile.fileName);
|
|
98001
98316
|
}
|
|
98002
98317
|
}
|
|
98003
98318
|
}
|
|
98004
|
-
for (var
|
|
98005
|
-
var
|
|
98319
|
+
for (var _d = 0, modifiedSourceFiles_1 = modifiedSourceFiles; _d < modifiedSourceFiles_1.length; _d++) {
|
|
98320
|
+
var _e = modifiedSourceFiles_1[_d], oldSourceFile = _e.oldFile, newSourceFile = _e.newFile;
|
|
98006
98321
|
var moduleNames = getModuleNames(newSourceFile);
|
|
98007
98322
|
var resolutions = resolveModuleNamesReusingOldState(moduleNames, newSourceFile);
|
|
98008
98323
|
var resolutionsChanged = ts.hasChangesInResolutions(moduleNames, resolutions, oldSourceFile.resolvedModules, oldSourceFile, ts.moduleResolutionIsEqualTo);
|
|
98009
98324
|
if (resolutionsChanged) {
|
|
98010
|
-
structureIsReused =
|
|
98325
|
+
structureIsReused = 2;
|
|
98011
98326
|
newSourceFile.resolvedModules = ts.zipToModeAwareCache(newSourceFile, moduleNames, resolutions);
|
|
98012
98327
|
}
|
|
98013
98328
|
else {
|
|
98014
98329
|
newSourceFile.resolvedModules = oldSourceFile.resolvedModules;
|
|
98015
98330
|
}
|
|
98016
98331
|
var typesReferenceDirectives = newSourceFile.typeReferenceDirectives;
|
|
98017
|
-
var typeReferenceResolutions =
|
|
98332
|
+
var typeReferenceResolutions = resolveTypeReferenceDirectiveNamesReusingOldState(typesReferenceDirectives, newSourceFile);
|
|
98018
98333
|
var typeReferenceResolutionsChanged = ts.hasChangesInResolutions(typesReferenceDirectives, typeReferenceResolutions, oldSourceFile.resolvedTypeReferenceDirectiveNames, oldSourceFile, ts.typeDirectiveIsEqualTo);
|
|
98019
98334
|
if (typeReferenceResolutionsChanged) {
|
|
98020
|
-
structureIsReused =
|
|
98335
|
+
structureIsReused = 2;
|
|
98021
98336
|
newSourceFile.resolvedTypeReferenceDirectiveNames = ts.zipToModeAwareCache(newSourceFile, typesReferenceDirectives, typeReferenceResolutions);
|
|
98022
98337
|
}
|
|
98023
98338
|
else {
|
|
98024
98339
|
newSourceFile.resolvedTypeReferenceDirectiveNames = oldSourceFile.resolvedTypeReferenceDirectiveNames;
|
|
98025
98340
|
}
|
|
98026
98341
|
}
|
|
98027
|
-
if (structureIsReused !==
|
|
98342
|
+
if (structureIsReused !== 3) {
|
|
98028
98343
|
return structureIsReused;
|
|
98029
98344
|
}
|
|
98030
|
-
if (ts.changesAffectingProgramStructure(
|
|
98031
|
-
return
|
|
98345
|
+
if (ts.changesAffectingProgramStructure(oldProgram.getCompilerOptions(), options)) {
|
|
98346
|
+
return 2;
|
|
98347
|
+
}
|
|
98348
|
+
if (host.hasChangedAutomaticTypeDirectiveNames) {
|
|
98349
|
+
if (host.hasChangedAutomaticTypeDirectiveNames())
|
|
98350
|
+
return 2;
|
|
98351
|
+
}
|
|
98352
|
+
else {
|
|
98353
|
+
automaticTypeDirectiveNames = ts.getAutomaticTypeDirectiveNames(options, host);
|
|
98354
|
+
if (!ts.arrayIsEqualTo(oldProgram.getAutomaticTypeDirectiveNames(), automaticTypeDirectiveNames))
|
|
98355
|
+
return 2;
|
|
98032
98356
|
}
|
|
98033
98357
|
missingFilePaths = oldProgram.getMissingFilePaths();
|
|
98034
98358
|
ts.Debug.assert(newSourceFiles.length === oldProgram.getSourceFiles().length);
|
|
98035
|
-
for (var
|
|
98036
|
-
var newSourceFile = newSourceFiles_1[
|
|
98359
|
+
for (var _f = 0, newSourceFiles_1 = newSourceFiles; _f < newSourceFiles_1.length; _f++) {
|
|
98360
|
+
var newSourceFile = newSourceFiles_1[_f];
|
|
98037
98361
|
filesByName.set(newSourceFile.path, newSourceFile);
|
|
98038
98362
|
}
|
|
98039
98363
|
var oldFilesByNameMap = oldProgram.getFilesByNameMap();
|
|
@@ -98054,10 +98378,12 @@ var ts;
|
|
|
98054
98378
|
fileReasons = oldProgram.getFileIncludeReasons();
|
|
98055
98379
|
fileProcessingDiagnostics = oldProgram.getFileProcessingDiagnostics();
|
|
98056
98380
|
resolvedTypeReferenceDirectives = oldProgram.getResolvedTypeReferenceDirectives();
|
|
98381
|
+
automaticTypeDirectiveNames = oldProgram.getAutomaticTypeDirectiveNames();
|
|
98382
|
+
automaticTypeDirectiveResolutions = oldProgram.getAutomaticTypeDirectiveResolutions();
|
|
98057
98383
|
sourceFileToPackageName = oldProgram.sourceFileToPackageName;
|
|
98058
98384
|
redirectTargetsMap = oldProgram.redirectTargetsMap;
|
|
98059
98385
|
usesUriStyleNodeCoreModules = oldProgram.usesUriStyleNodeCoreModules;
|
|
98060
|
-
return
|
|
98386
|
+
return 3;
|
|
98061
98387
|
}
|
|
98062
98388
|
function getEmitHost(writeFileCallback) {
|
|
98063
98389
|
return {
|
|
@@ -98981,33 +99307,40 @@ var ts;
|
|
|
98981
99307
|
}
|
|
98982
99308
|
function processTypeReferenceDirectives(file) {
|
|
98983
99309
|
var typeDirectives = file.typeReferenceDirectives;
|
|
98984
|
-
if (!typeDirectives) {
|
|
99310
|
+
if (!typeDirectives.length) {
|
|
99311
|
+
file.resolvedTypeReferenceDirectiveNames = undefined;
|
|
98985
99312
|
return;
|
|
98986
99313
|
}
|
|
98987
|
-
var resolutions =
|
|
99314
|
+
var resolutions = resolveTypeReferenceDirectiveNamesReusingOldState(typeDirectives, file);
|
|
98988
99315
|
for (var index = 0; index < typeDirectives.length; index++) {
|
|
98989
99316
|
var ref = file.typeReferenceDirectives[index];
|
|
98990
99317
|
var resolvedTypeReferenceDirective = resolutions[index];
|
|
98991
99318
|
var fileName = ts.toFileNameLowerCase(ref.fileName);
|
|
98992
|
-
ts.setResolvedTypeReferenceDirective(file, fileName, resolvedTypeReferenceDirective);
|
|
99319
|
+
ts.setResolvedTypeReferenceDirective(file, fileName, resolvedTypeReferenceDirective, getModeForFileReference(ref, file.impliedNodeFormat));
|
|
98993
99320
|
var mode = ref.resolutionMode || file.impliedNodeFormat;
|
|
98994
99321
|
if (mode && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeNext) {
|
|
98995
|
-
|
|
99322
|
+
(fileProcessingDiagnostics !== null && fileProcessingDiagnostics !== void 0 ? fileProcessingDiagnostics : (fileProcessingDiagnostics = [])).push({
|
|
99323
|
+
kind: 2,
|
|
99324
|
+
diagnostics: [ts.createDiagnosticForRange(file, ref, ts.Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext)]
|
|
99325
|
+
});
|
|
98996
99326
|
}
|
|
98997
99327
|
processTypeReferenceDirective(fileName, mode, resolvedTypeReferenceDirective, { kind: ts.FileIncludeKind.TypeReferenceDirective, file: file.path, index: index, });
|
|
98998
99328
|
}
|
|
98999
99329
|
}
|
|
99000
|
-
function processTypeReferenceDirective(typeReferenceDirective, mode,
|
|
99001
|
-
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 });
|
|
99002
|
-
processTypeReferenceDirectiveWorker(typeReferenceDirective, mode,
|
|
99330
|
+
function processTypeReferenceDirective(typeReferenceDirective, mode, resolution, reason) {
|
|
99331
|
+
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 });
|
|
99332
|
+
processTypeReferenceDirectiveWorker(typeReferenceDirective, mode, resolution, reason);
|
|
99003
99333
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
99004
99334
|
}
|
|
99005
|
-
function processTypeReferenceDirectiveWorker(typeReferenceDirective, mode,
|
|
99006
|
-
var
|
|
99335
|
+
function processTypeReferenceDirectiveWorker(typeReferenceDirective, mode, resolution, reason) {
|
|
99336
|
+
var _a;
|
|
99337
|
+
addResolutionDiagnostics(resolution);
|
|
99338
|
+
var previousResolution = (_a = resolvedTypeReferenceDirectives.get(typeReferenceDirective, mode)) === null || _a === void 0 ? void 0 : _a.resolvedTypeReferenceDirective;
|
|
99007
99339
|
if (previousResolution && previousResolution.primary) {
|
|
99008
99340
|
return;
|
|
99009
99341
|
}
|
|
99010
99342
|
var saveResolution = true;
|
|
99343
|
+
var resolvedTypeReferenceDirective = resolution.resolvedTypeReferenceDirective;
|
|
99011
99344
|
if (resolvedTypeReferenceDirective) {
|
|
99012
99345
|
if (resolvedTypeReferenceDirective.isExternalLibraryImport)
|
|
99013
99346
|
currentNodeModulesDepth++;
|
|
@@ -99036,7 +99369,7 @@ var ts;
|
|
|
99036
99369
|
addFilePreprocessingFileExplainingDiagnostic(undefined, reason, ts.Diagnostics.Cannot_find_type_definition_file_for_0, [typeReferenceDirective]);
|
|
99037
99370
|
}
|
|
99038
99371
|
if (saveResolution) {
|
|
99039
|
-
resolvedTypeReferenceDirectives.set(typeReferenceDirective, mode,
|
|
99372
|
+
resolvedTypeReferenceDirectives.set(typeReferenceDirective, mode, resolution);
|
|
99040
99373
|
}
|
|
99041
99374
|
}
|
|
99042
99375
|
function pathForLibFile(libFileName) {
|
|
@@ -99065,7 +99398,7 @@ var ts;
|
|
|
99065
99398
|
var unqualifiedLibName = ts.removeSuffix(ts.removePrefix(libName, "lib."), ".d.ts");
|
|
99066
99399
|
var suggestion = ts.getSpellingSuggestion(unqualifiedLibName, ts.libs, ts.identity);
|
|
99067
99400
|
var diagnostic = suggestion ? ts.Diagnostics.Cannot_find_lib_definition_for_0_Did_you_mean_1 : ts.Diagnostics.Cannot_find_lib_definition_for_0;
|
|
99068
|
-
(fileProcessingDiagnostics
|
|
99401
|
+
(fileProcessingDiagnostics !== null && fileProcessingDiagnostics !== void 0 ? fileProcessingDiagnostics : (fileProcessingDiagnostics = [])).push({
|
|
99069
99402
|
kind: 0,
|
|
99070
99403
|
reason: { kind: ts.FileIncludeKind.LibReferenceDirective, file: file.path, index: index, },
|
|
99071
99404
|
diagnostic: diagnostic,
|
|
@@ -99088,19 +99421,20 @@ var ts;
|
|
|
99088
99421
|
for (var index = 0; index < moduleNames.length; index++) {
|
|
99089
99422
|
var resolution = resolutions[index];
|
|
99090
99423
|
ts.setResolvedModule(file, moduleNames[index], resolution, getModeForResolutionAtIndex(file, index));
|
|
99091
|
-
|
|
99424
|
+
addResolutionDiagnostics(resolution);
|
|
99425
|
+
if (!resolution.resolvedModule) {
|
|
99092
99426
|
continue;
|
|
99093
99427
|
}
|
|
99094
|
-
var isFromNodeModulesSearch = resolution.isExternalLibraryImport;
|
|
99095
|
-
var isJsFile = !ts.resolutionExtensionIsTSOrJson(resolution.extension);
|
|
99428
|
+
var isFromNodeModulesSearch = resolution.resolvedModule.isExternalLibraryImport;
|
|
99429
|
+
var isJsFile = !ts.resolutionExtensionIsTSOrJson(resolution.resolvedModule.extension);
|
|
99096
99430
|
var isJsFileFromNodeModules = isFromNodeModulesSearch && isJsFile;
|
|
99097
|
-
var resolvedFileName = resolution.resolvedFileName;
|
|
99431
|
+
var resolvedFileName = resolution.resolvedModule.resolvedFileName;
|
|
99098
99432
|
if (isFromNodeModulesSearch) {
|
|
99099
99433
|
currentNodeModulesDepth++;
|
|
99100
99434
|
}
|
|
99101
99435
|
var elideImport = isJsFileFromNodeModules && currentNodeModulesDepth > maxNodeModuleJsDepth;
|
|
99102
99436
|
var shouldAddFile = resolvedFileName
|
|
99103
|
-
&& !getResolutionDiagnostic(optionsForFile, resolution)
|
|
99437
|
+
&& !getResolutionDiagnostic(optionsForFile, resolution.resolvedModule)
|
|
99104
99438
|
&& !optionsForFile.noResolve
|
|
99105
99439
|
&& index < file.imports.length
|
|
99106
99440
|
&& !elideImport
|
|
@@ -99110,7 +99444,7 @@ var ts;
|
|
|
99110
99444
|
modulesWithElidedImports.set(file.path, true);
|
|
99111
99445
|
}
|
|
99112
99446
|
else if (shouldAddFile) {
|
|
99113
|
-
findSourceFile(resolvedFileName, false, false, { kind: ts.FileIncludeKind.Import, file: file.path, index: index, }, resolution.packageId);
|
|
99447
|
+
findSourceFile(resolvedFileName, false, false, { kind: ts.FileIncludeKind.Import, file: file.path, index: index, }, resolution.resolvedModule.packageId);
|
|
99114
99448
|
}
|
|
99115
99449
|
if (isFromNodeModulesSearch) {
|
|
99116
99450
|
currentNodeModulesDepth--;
|
|
@@ -99211,6 +99545,9 @@ var ts;
|
|
|
99211
99545
|
createDiagnosticForOptionName(ts.Diagnostics.Composite_projects_may_not_disable_incremental_compilation, "declaration");
|
|
99212
99546
|
}
|
|
99213
99547
|
}
|
|
99548
|
+
if (options.cacheResolutions && !ts.isIncrementalCompilation(options)) {
|
|
99549
|
+
createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1_or_option_2, "cacheResolutions", "incremental", "composite");
|
|
99550
|
+
}
|
|
99214
99551
|
var outputFile = ts.outFile(options);
|
|
99215
99552
|
if (options.tsBuildInfoFile) {
|
|
99216
99553
|
if (!ts.isIncrementalCompilation(options)) {
|
|
@@ -99460,7 +99797,7 @@ var ts;
|
|
|
99460
99797
|
}
|
|
99461
99798
|
}
|
|
99462
99799
|
function addFilePreprocessingFileExplainingDiagnostic(file, fileProcessingReason, diagnostic, args) {
|
|
99463
|
-
(fileProcessingDiagnostics
|
|
99800
|
+
(fileProcessingDiagnostics !== null && fileProcessingDiagnostics !== void 0 ? fileProcessingDiagnostics : (fileProcessingDiagnostics = [])).push({
|
|
99464
99801
|
kind: 1,
|
|
99465
99802
|
file: file && file.path,
|
|
99466
99803
|
fileProcessingReason: fileProcessingReason,
|
|
@@ -99721,8 +100058,8 @@ var ts;
|
|
|
99721
100058
|
if (!symlinks) {
|
|
99722
100059
|
symlinks = ts.createSymlinkCache(currentDirectory, getCanonicalFileName);
|
|
99723
100060
|
}
|
|
99724
|
-
if (files &&
|
|
99725
|
-
symlinks.setSymlinksFromResolutions(files,
|
|
100061
|
+
if (files && automaticTypeDirectiveResolutions && !symlinks.hasProcessedResolutions()) {
|
|
100062
|
+
symlinks.setSymlinksFromResolutions(files, automaticTypeDirectiveResolutions);
|
|
99726
100063
|
}
|
|
99727
100064
|
return symlinks;
|
|
99728
100065
|
}
|
|
@@ -100081,7 +100418,8 @@ var ts;
|
|
|
100081
100418
|
}
|
|
100082
100419
|
}
|
|
100083
100420
|
if (sourceFile.resolvedTypeReferenceDirectiveNames) {
|
|
100084
|
-
sourceFile.resolvedTypeReferenceDirectiveNames.forEach(function (
|
|
100421
|
+
sourceFile.resolvedTypeReferenceDirectiveNames.forEach(function (_a) {
|
|
100422
|
+
var resolvedTypeReferenceDirective = _a.resolvedTypeReferenceDirective;
|
|
100085
100423
|
if (!resolvedTypeReferenceDirective) {
|
|
100086
100424
|
return;
|
|
100087
100425
|
}
|
|
@@ -100130,12 +100468,13 @@ var ts;
|
|
|
100130
100468
|
return oldState && !oldState.referencedMap === !newReferencedMap;
|
|
100131
100469
|
}
|
|
100132
100470
|
BuilderState.canReuseOldState = canReuseOldState;
|
|
100133
|
-
function create(newProgram,
|
|
100471
|
+
function create(newProgram, oldState, disableUseFileVersionAsSignature) {
|
|
100134
100472
|
var _a, _b, _c;
|
|
100135
100473
|
var fileInfos = new ts.Map();
|
|
100136
100474
|
var referencedMap = newProgram.getCompilerOptions().module !== ts.ModuleKind.None ? createManyToManyPathMap() : undefined;
|
|
100137
100475
|
var exportedModulesMap = referencedMap ? createManyToManyPathMap() : undefined;
|
|
100138
100476
|
var useOldState = canReuseOldState(referencedMap, oldState);
|
|
100477
|
+
var getCanonicalFileName = ts.createGetCanonicalFileName(newProgram.useCaseSensitiveFileNames());
|
|
100139
100478
|
newProgram.getTypeChecker();
|
|
100140
100479
|
for (var _i = 0, _d = newProgram.getSourceFiles(); _i < _d.length; _i++) {
|
|
100141
100480
|
var sourceFile = _d[_i];
|
|
@@ -100179,23 +100518,23 @@ var ts;
|
|
|
100179
100518
|
state.allFileNames = undefined;
|
|
100180
100519
|
}
|
|
100181
100520
|
BuilderState.releaseCache = releaseCache;
|
|
100182
|
-
function getFilesAffectedBy(state, programOfThisState, path, cancellationToken,
|
|
100521
|
+
function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, host) {
|
|
100183
100522
|
var _a, _b;
|
|
100184
|
-
var result = getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken,
|
|
100523
|
+
var result = getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, host);
|
|
100185
100524
|
(_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.clear();
|
|
100186
100525
|
(_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
|
|
100187
100526
|
return result;
|
|
100188
100527
|
}
|
|
100189
100528
|
BuilderState.getFilesAffectedBy = getFilesAffectedBy;
|
|
100190
|
-
function getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken,
|
|
100529
|
+
function getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, host) {
|
|
100191
100530
|
var sourceFile = programOfThisState.getSourceFileByPath(path);
|
|
100192
100531
|
if (!sourceFile) {
|
|
100193
100532
|
return ts.emptyArray;
|
|
100194
100533
|
}
|
|
100195
|
-
if (!updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken,
|
|
100534
|
+
if (!updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, host)) {
|
|
100196
100535
|
return [sourceFile];
|
|
100197
100536
|
}
|
|
100198
|
-
return (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, cancellationToken,
|
|
100537
|
+
return (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, cancellationToken, host);
|
|
100199
100538
|
}
|
|
100200
100539
|
BuilderState.getFilesAffectedByWithOldState = getFilesAffectedByWithOldState;
|
|
100201
100540
|
function updateSignatureOfFile(state, signature, path) {
|
|
@@ -100203,7 +100542,7 @@ var ts;
|
|
|
100203
100542
|
(state.hasCalledUpdateShapeSignature || (state.hasCalledUpdateShapeSignature = new ts.Set())).add(path);
|
|
100204
100543
|
}
|
|
100205
100544
|
BuilderState.updateSignatureOfFile = updateSignatureOfFile;
|
|
100206
|
-
function updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken,
|
|
100545
|
+
function updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, host, useFileVersionAsSignature) {
|
|
100207
100546
|
var _a;
|
|
100208
100547
|
if (useFileVersionAsSignature === void 0) { useFileVersionAsSignature = state.useFileVersionAsSignature; }
|
|
100209
100548
|
if ((_a = state.hasCalledUpdateShapeSignature) === null || _a === void 0 ? void 0 : _a.has(sourceFile.resolvedPath))
|
|
@@ -100214,7 +100553,7 @@ var ts;
|
|
|
100214
100553
|
if (!sourceFile.isDeclarationFile && !useFileVersionAsSignature) {
|
|
100215
100554
|
programOfThisState.emit(sourceFile, function (fileName, text, _writeByteOrderMark, _onError, sourceFiles, data) {
|
|
100216
100555
|
ts.Debug.assert(ts.isDeclarationFileName(fileName), "File extension for signature expected to be dts: Got:: " + fileName);
|
|
100217
|
-
latestSignature = ts.computeSignatureWithDiagnostics(sourceFile, text,
|
|
100556
|
+
latestSignature = ts.computeSignatureWithDiagnostics(sourceFile, text, host, ts.createGetCanonicalFileName(programOfThisState.useCaseSensitiveFileNames()), data);
|
|
100218
100557
|
if (latestSignature !== prevSignature) {
|
|
100219
100558
|
updateExportedModules(state, sourceFile, sourceFiles[0].exportedModulesFromDeclarationEmit);
|
|
100220
100559
|
}
|
|
@@ -100348,7 +100687,7 @@ var ts;
|
|
|
100348
100687
|
}
|
|
100349
100688
|
return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
|
|
100350
100689
|
}
|
|
100351
|
-
function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cancellationToken,
|
|
100690
|
+
function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cancellationToken, host) {
|
|
100352
100691
|
if (isFileAffectingGlobalScope(sourceFileWithUpdatedShape)) {
|
|
100353
100692
|
return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
|
|
100354
100693
|
}
|
|
@@ -100364,7 +100703,7 @@ var ts;
|
|
|
100364
100703
|
if (!seenFileNamesMap.has(currentPath)) {
|
|
100365
100704
|
var currentSourceFile = programOfThisState.getSourceFileByPath(currentPath);
|
|
100366
100705
|
seenFileNamesMap.set(currentPath, currentSourceFile);
|
|
100367
|
-
if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cancellationToken,
|
|
100706
|
+
if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cancellationToken, host)) {
|
|
100368
100707
|
queue.push.apply(queue, getReferencedByPaths(state, currentSourceFile.resolvedPath));
|
|
100369
100708
|
}
|
|
100370
100709
|
}
|
|
@@ -100378,9 +100717,9 @@ var ts;
|
|
|
100378
100717
|
function hasSameKeys(map1, map2) {
|
|
100379
100718
|
return map1 === map2 || map1 !== undefined && map2 !== undefined && map1.size === map2.size && !ts.forEachKey(map1, function (key) { return !map2.has(key); });
|
|
100380
100719
|
}
|
|
100381
|
-
function createBuilderProgramState(newProgram,
|
|
100720
|
+
function createBuilderProgramState(newProgram, oldState, disableUseFileVersionAsSignature) {
|
|
100382
100721
|
var _a, _b;
|
|
100383
|
-
var state = ts.BuilderState.create(newProgram,
|
|
100722
|
+
var state = ts.BuilderState.create(newProgram, oldState, disableUseFileVersionAsSignature);
|
|
100384
100723
|
state.program = newProgram;
|
|
100385
100724
|
var compilerOptions = newProgram.getCompilerOptions();
|
|
100386
100725
|
state.compilerOptions = compilerOptions;
|
|
@@ -100433,7 +100772,7 @@ var ts;
|
|
|
100433
100772
|
return;
|
|
100434
100773
|
var diagnostics = oldState.semanticDiagnosticsPerFile.get(sourceFilePath);
|
|
100435
100774
|
if (diagnostics) {
|
|
100436
|
-
state.semanticDiagnosticsPerFile.set(sourceFilePath, oldState.hasReusableDiagnostic ? convertToDiagnostics(diagnostics, newProgram
|
|
100775
|
+
state.semanticDiagnosticsPerFile.set(sourceFilePath, oldState.hasReusableDiagnostic ? convertToDiagnostics(diagnostics, newProgram) : diagnostics);
|
|
100437
100776
|
if (!state.semanticDiagnosticsFromOldState) {
|
|
100438
100777
|
state.semanticDiagnosticsFromOldState = new ts.Set();
|
|
100439
100778
|
}
|
|
@@ -100455,13 +100794,16 @@ var ts;
|
|
|
100455
100794
|
ts.Debug.assert(!state.seenAffectedFiles || !state.seenAffectedFiles.size);
|
|
100456
100795
|
state.seenAffectedFiles = state.seenAffectedFiles || new ts.Set();
|
|
100457
100796
|
}
|
|
100458
|
-
state.buildInfoEmitPending = !useOldState ||
|
|
100797
|
+
state.buildInfoEmitPending = !useOldState ||
|
|
100798
|
+
state.changedFilesSet.size !== (((_b = oldState.changedFilesSet) === null || _b === void 0 ? void 0 : _b.size) || 0) ||
|
|
100799
|
+
state.fileInfos.size !== oldState.fileInfos.size;
|
|
100459
100800
|
return state;
|
|
100460
100801
|
}
|
|
100461
|
-
function convertToDiagnostics(diagnostics, newProgram
|
|
100802
|
+
function convertToDiagnostics(diagnostics, newProgram) {
|
|
100462
100803
|
if (!diagnostics.length)
|
|
100463
100804
|
return ts.emptyArray;
|
|
100464
|
-
var buildInfoDirectory
|
|
100805
|
+
var buildInfoDirectory;
|
|
100806
|
+
var getCanonicalFileName;
|
|
100465
100807
|
return diagnostics.map(function (diagnostic) {
|
|
100466
100808
|
var result = convertToDiagnosticRelatedInformation(diagnostic, newProgram, toPath);
|
|
100467
100809
|
result.reportsUnnecessary = diagnostic.reportsUnnecessary;
|
|
@@ -100477,7 +100819,8 @@ var ts;
|
|
|
100477
100819
|
return result;
|
|
100478
100820
|
});
|
|
100479
100821
|
function toPath(path) {
|
|
100480
|
-
|
|
100822
|
+
buildInfoDirectory !== null && buildInfoDirectory !== void 0 ? buildInfoDirectory : (buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(ts.getTsBuildInfoEmitOutputFilePath(newProgram.getCompilerOptions()), newProgram.getCurrentDirectory())));
|
|
100823
|
+
return ts.toPath(path, buildInfoDirectory, getCanonicalFileName !== null && getCanonicalFileName !== void 0 ? getCanonicalFileName : (getCanonicalFileName = ts.createGetCanonicalFileName(newProgram.useCaseSensitiveFileNames())));
|
|
100481
100824
|
}
|
|
100482
100825
|
}
|
|
100483
100826
|
function convertToDiagnosticRelatedInformation(diagnostic, newProgram, toPath) {
|
|
@@ -100486,6 +100829,8 @@ var ts;
|
|
|
100486
100829
|
}
|
|
100487
100830
|
function releaseCache(state) {
|
|
100488
100831
|
ts.BuilderState.releaseCache(state);
|
|
100832
|
+
if (!state.resuableCacheResolutions)
|
|
100833
|
+
getCacheResolutions(state);
|
|
100489
100834
|
state.program = undefined;
|
|
100490
100835
|
}
|
|
100491
100836
|
function backupBuilderProgramEmitState(state) {
|
|
@@ -100520,7 +100865,7 @@ var ts;
|
|
|
100520
100865
|
function assertSourceFileOkWithoutNextAffectedCall(state, sourceFile) {
|
|
100521
100866
|
ts.Debug.assert(!sourceFile || !state.affectedFiles || state.affectedFiles[state.affectedFilesIndex - 1] !== sourceFile || !state.semanticDiagnosticsPerFile.has(sourceFile.resolvedPath));
|
|
100522
100867
|
}
|
|
100523
|
-
function getNextAffectedFile(state, cancellationToken,
|
|
100868
|
+
function getNextAffectedFile(state, cancellationToken, host) {
|
|
100524
100869
|
var _a, _b;
|
|
100525
100870
|
while (true) {
|
|
100526
100871
|
var affectedFiles = state.affectedFiles;
|
|
@@ -100531,7 +100876,7 @@ var ts;
|
|
|
100531
100876
|
var affectedFile = affectedFiles[affectedFilesIndex];
|
|
100532
100877
|
if (!seenAffectedFiles.has(affectedFile.resolvedPath)) {
|
|
100533
100878
|
state.affectedFilesIndex = affectedFilesIndex;
|
|
100534
|
-
handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken,
|
|
100879
|
+
handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, host);
|
|
100535
100880
|
return affectedFile;
|
|
100536
100881
|
}
|
|
100537
100882
|
affectedFilesIndex++;
|
|
@@ -100552,7 +100897,7 @@ var ts;
|
|
|
100552
100897
|
ts.Debug.assert(!state.semanticDiagnosticsPerFile);
|
|
100553
100898
|
return program;
|
|
100554
100899
|
}
|
|
100555
|
-
state.affectedFiles = ts.BuilderState.getFilesAffectedByWithOldState(state, program, nextKey.value, cancellationToken,
|
|
100900
|
+
state.affectedFiles = ts.BuilderState.getFilesAffectedByWithOldState(state, program, nextKey.value, cancellationToken, host);
|
|
100556
100901
|
state.currentChangedFilePath = nextKey.value;
|
|
100557
100902
|
state.affectedFilesIndex = 0;
|
|
100558
100903
|
if (!state.seenAffectedFiles)
|
|
@@ -100595,24 +100940,24 @@ var ts;
|
|
|
100595
100940
|
});
|
|
100596
100941
|
}
|
|
100597
100942
|
}
|
|
100598
|
-
function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken,
|
|
100943
|
+
function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, host) {
|
|
100599
100944
|
removeSemanticDiagnosticsOf(state, affectedFile.resolvedPath);
|
|
100600
100945
|
if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles) {
|
|
100601
100946
|
removeDiagnosticsOfLibraryFiles(state);
|
|
100602
|
-
ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, cancellationToken,
|
|
100947
|
+
ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, cancellationToken, host);
|
|
100603
100948
|
return;
|
|
100604
100949
|
}
|
|
100605
100950
|
if (state.compilerOptions.assumeChangesOnlyAffectDirectDependencies)
|
|
100606
100951
|
return;
|
|
100607
|
-
handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken,
|
|
100952
|
+
handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, host);
|
|
100608
100953
|
}
|
|
100609
|
-
function handleDtsMayChangeOf(state, path, cancellationToken,
|
|
100954
|
+
function handleDtsMayChangeOf(state, path, cancellationToken, host) {
|
|
100610
100955
|
removeSemanticDiagnosticsOf(state, path);
|
|
100611
100956
|
if (!state.changedFilesSet.has(path)) {
|
|
100612
100957
|
var program = ts.Debug.checkDefined(state.program);
|
|
100613
100958
|
var sourceFile = program.getSourceFileByPath(path);
|
|
100614
100959
|
if (sourceFile) {
|
|
100615
|
-
ts.BuilderState.updateShapeSignature(state, program, sourceFile, cancellationToken,
|
|
100960
|
+
ts.BuilderState.updateShapeSignature(state, program, sourceFile, cancellationToken, host, !host.disableUseFileVersionAsSignature);
|
|
100616
100961
|
if (ts.getEmitDeclarations(state.compilerOptions)) {
|
|
100617
100962
|
addToAffectedFilesPendingEmit(state, path, 0);
|
|
100618
100963
|
}
|
|
@@ -100632,16 +100977,16 @@ var ts;
|
|
|
100632
100977
|
var newSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
|
|
100633
100978
|
return newSignature !== oldSignature;
|
|
100634
100979
|
}
|
|
100635
|
-
function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken,
|
|
100980
|
+
function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, host) {
|
|
100636
100981
|
var _a;
|
|
100637
100982
|
if (!((_a = state.fileInfos.get(filePath)) === null || _a === void 0 ? void 0 : _a.affectsGlobalScope))
|
|
100638
100983
|
return false;
|
|
100639
100984
|
ts.BuilderState.getAllFilesExcludingDefaultLibraryFile(state, state.program, undefined)
|
|
100640
|
-
.forEach(function (file) { return handleDtsMayChangeOf(state, file.resolvedPath, cancellationToken,
|
|
100985
|
+
.forEach(function (file) { return handleDtsMayChangeOf(state, file.resolvedPath, cancellationToken, host); });
|
|
100641
100986
|
removeDiagnosticsOfLibraryFiles(state);
|
|
100642
100987
|
return true;
|
|
100643
100988
|
}
|
|
100644
|
-
function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken,
|
|
100989
|
+
function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, host) {
|
|
100645
100990
|
var _a;
|
|
100646
100991
|
if (!state.exportedModulesMap || !state.changedFilesSet.has(affectedFile.resolvedPath))
|
|
100647
100992
|
return;
|
|
@@ -100655,9 +101000,9 @@ var ts;
|
|
|
100655
101000
|
var currentPath = queue.pop();
|
|
100656
101001
|
if (!seenFileNamesMap.has(currentPath)) {
|
|
100657
101002
|
seenFileNamesMap.set(currentPath, true);
|
|
100658
|
-
if (handleDtsMayChangeOfGlobalScope(state, currentPath, cancellationToken,
|
|
101003
|
+
if (handleDtsMayChangeOfGlobalScope(state, currentPath, cancellationToken, host))
|
|
100659
101004
|
return;
|
|
100660
|
-
handleDtsMayChangeOf(state, currentPath, cancellationToken,
|
|
101005
|
+
handleDtsMayChangeOf(state, currentPath, cancellationToken, host);
|
|
100661
101006
|
if (isChangedSignature(state, currentPath)) {
|
|
100662
101007
|
var currentSourceFile = ts.Debug.checkDefined(state.program).getSourceFileByPath(currentPath);
|
|
100663
101008
|
queue.push.apply(queue, ts.BuilderState.getReferencedByPaths(state, currentSourceFile.resolvedPath));
|
|
@@ -100667,27 +101012,27 @@ var ts;
|
|
|
100667
101012
|
}
|
|
100668
101013
|
var seenFileAndExportsOfFile = new ts.Set();
|
|
100669
101014
|
(_a = state.exportedModulesMap.getKeys(affectedFile.resolvedPath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
|
|
100670
|
-
if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken,
|
|
101015
|
+
if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, host))
|
|
100671
101016
|
return true;
|
|
100672
101017
|
var references = state.referencedMap.getKeys(exportedFromPath);
|
|
100673
101018
|
return references && ts.forEachKey(references, function (filePath) {
|
|
100674
|
-
return handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken,
|
|
101019
|
+
return handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, host);
|
|
100675
101020
|
});
|
|
100676
101021
|
});
|
|
100677
101022
|
}
|
|
100678
|
-
function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken,
|
|
101023
|
+
function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, host) {
|
|
100679
101024
|
var _a, _b;
|
|
100680
101025
|
if (!ts.tryAddToSet(seenFileAndExportsOfFile, filePath))
|
|
100681
101026
|
return undefined;
|
|
100682
|
-
if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken,
|
|
101027
|
+
if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, host))
|
|
100683
101028
|
return true;
|
|
100684
|
-
handleDtsMayChangeOf(state, filePath, cancellationToken,
|
|
101029
|
+
handleDtsMayChangeOf(state, filePath, cancellationToken, host);
|
|
100685
101030
|
(_a = state.exportedModulesMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
|
|
100686
|
-
return handleDtsMayChangeOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, cancellationToken,
|
|
101031
|
+
return handleDtsMayChangeOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, cancellationToken, host);
|
|
100687
101032
|
});
|
|
100688
101033
|
(_b = state.referencedMap.getKeys(filePath)) === null || _b === void 0 ? void 0 : _b.forEach(function (referencingFilePath) {
|
|
100689
101034
|
return !seenFileAndExportsOfFile.has(referencingFilePath) &&
|
|
100690
|
-
handleDtsMayChangeOf(state, referencingFilePath, cancellationToken,
|
|
101035
|
+
handleDtsMayChangeOf(state, referencingFilePath, cancellationToken, host);
|
|
100691
101036
|
});
|
|
100692
101037
|
return undefined;
|
|
100693
101038
|
}
|
|
@@ -100742,34 +101087,45 @@ var ts;
|
|
|
100742
101087
|
return !!ts.outFile(info.options || {});
|
|
100743
101088
|
}
|
|
100744
101089
|
ts.isProgramBundleEmitBuildInfo = isProgramBundleEmitBuildInfo;
|
|
100745
|
-
function getProgramBuildInfo(state,
|
|
101090
|
+
function getProgramBuildInfo(state, host) {
|
|
100746
101091
|
var outFilePath = ts.outFile(state.compilerOptions);
|
|
100747
|
-
if (outFilePath && !state.compilerOptions.composite)
|
|
101092
|
+
if (outFilePath && !state.compilerOptions.composite && !state.compilerOptions.cacheResolutions)
|
|
100748
101093
|
return;
|
|
100749
101094
|
var currentDirectory = ts.Debug.checkDefined(state.program).getCurrentDirectory();
|
|
100750
|
-
var
|
|
101095
|
+
var getCanonicalFileName = ts.createGetCanonicalFileName(state.program.useCaseSensitiveFileNames());
|
|
101096
|
+
var buildInfoPath = ts.getNormalizedAbsolutePath(ts.getTsBuildInfoEmitOutputFilePath(state.compilerOptions), currentDirectory);
|
|
101097
|
+
var buildInfoDirectory = ts.getDirectoryPath(buildInfoPath);
|
|
100751
101098
|
var latestChangedDtsFile = state.latestChangedDtsFile ? relativeToBuildInfoEnsuringAbsolutePath(state.latestChangedDtsFile) : undefined;
|
|
101099
|
+
var fileNames = [];
|
|
101100
|
+
var fileNameToFileId = new ts.Map();
|
|
101101
|
+
var resolutions;
|
|
101102
|
+
var names;
|
|
101103
|
+
var resolutionNameToResolutionNameId;
|
|
101104
|
+
var resolutionEntries;
|
|
101105
|
+
var resolutionEntryToResolutionEntryId;
|
|
101106
|
+
var affectedFilesHash;
|
|
100752
101107
|
if (outFilePath) {
|
|
100753
|
-
var
|
|
100754
|
-
|
|
100755
|
-
|
|
100756
|
-
|
|
100757
|
-
|
|
100758
|
-
|
|
100759
|
-
|
|
100760
|
-
|
|
100761
|
-
|
|
100762
|
-
|
|
100763
|
-
|
|
101108
|
+
var fileInfos_1;
|
|
101109
|
+
if (state.compilerOptions.composite) {
|
|
101110
|
+
state.program.getRootFileNames().forEach(function (f) {
|
|
101111
|
+
var sourceFile = state.program.getSourceFile(f);
|
|
101112
|
+
if (!sourceFile)
|
|
101113
|
+
return;
|
|
101114
|
+
var fileId = toFileId(sourceFile.resolvedPath);
|
|
101115
|
+
(fileInfos_1 !== null && fileInfos_1 !== void 0 ? fileInfos_1 : (fileInfos_1 = []))[fileId - 1] = sourceFile.version;
|
|
101116
|
+
});
|
|
101117
|
+
}
|
|
101118
|
+
var cacheResolutions_1 = toProgramBuildInfoCacheResolutions();
|
|
101119
|
+
var result_16 = {
|
|
101120
|
+
fileNames: fileNames,
|
|
100764
101121
|
fileInfos: fileInfos_1,
|
|
100765
|
-
options:
|
|
101122
|
+
options: toProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsBundleEmitBuildInfo", !!state.compilerOptions.cacheResolutions),
|
|
100766
101123
|
outSignature: state.outSignature,
|
|
100767
101124
|
latestChangedDtsFile: latestChangedDtsFile,
|
|
101125
|
+
cacheResolutions: cacheResolutions_1,
|
|
100768
101126
|
};
|
|
100769
|
-
return
|
|
101127
|
+
return result_16;
|
|
100770
101128
|
}
|
|
100771
|
-
var fileNames = [];
|
|
100772
|
-
var fileNameToFileId = new ts.Map();
|
|
100773
101129
|
var fileIdsList;
|
|
100774
101130
|
var fileNamesToFileIdListId;
|
|
100775
101131
|
var emitSignatures;
|
|
@@ -100826,7 +101182,7 @@ var ts;
|
|
|
100826
101182
|
(semanticDiagnosticsPerFile || (semanticDiagnosticsPerFile = [])).push(value.length ?
|
|
100827
101183
|
[
|
|
100828
101184
|
toFileId(key),
|
|
100829
|
-
|
|
101185
|
+
value.map(toReusableDiagnostic)
|
|
100830
101186
|
] :
|
|
100831
101187
|
toFileId(key));
|
|
100832
101188
|
}
|
|
@@ -100848,10 +101204,11 @@ var ts;
|
|
|
100848
101204
|
(changeFileSet || (changeFileSet = [])).push(toFileId(path));
|
|
100849
101205
|
}
|
|
100850
101206
|
}
|
|
101207
|
+
var cacheResolutions = toProgramBuildInfoCacheResolutions();
|
|
100851
101208
|
var result = {
|
|
100852
101209
|
fileNames: fileNames,
|
|
100853
101210
|
fileInfos: fileInfos,
|
|
100854
|
-
options:
|
|
101211
|
+
options: toProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsMultiFileEmitBuildInfo", !!state.compilerOptions.cacheResolutions),
|
|
100855
101212
|
fileIdsList: fileIdsList,
|
|
100856
101213
|
referencedMap: referencedMap,
|
|
100857
101214
|
exportedModulesMap: exportedModulesMap,
|
|
@@ -100860,6 +101217,7 @@ var ts;
|
|
|
100860
101217
|
changeFileSet: changeFileSet,
|
|
100861
101218
|
emitSignatures: emitSignatures,
|
|
100862
101219
|
latestChangedDtsFile: latestChangedDtsFile,
|
|
101220
|
+
cacheResolutions: cacheResolutions,
|
|
100863
101221
|
};
|
|
100864
101222
|
return result;
|
|
100865
101223
|
function relativeToBuildInfoEnsuringAbsolutePath(path) {
|
|
@@ -100868,7 +101226,7 @@ var ts;
|
|
|
100868
101226
|
function relativeToBuildInfo(path) {
|
|
100869
101227
|
return ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(buildInfoDirectory, path, getCanonicalFileName));
|
|
100870
101228
|
}
|
|
100871
|
-
function
|
|
101229
|
+
function toFileAndAbsoluteFileId(path) {
|
|
100872
101230
|
var fileId = fileNameToFileId.get(path);
|
|
100873
101231
|
if (fileId === undefined) {
|
|
100874
101232
|
fileNames.push(relativeToBuildInfo(path));
|
|
@@ -100876,6 +101234,12 @@ var ts;
|
|
|
100876
101234
|
}
|
|
100877
101235
|
return fileId;
|
|
100878
101236
|
}
|
|
101237
|
+
function toFileId(path) {
|
|
101238
|
+
return toFileAndAbsoluteFileId(path);
|
|
101239
|
+
}
|
|
101240
|
+
function toAbsoluteFileId(path) {
|
|
101241
|
+
return toFileAndAbsoluteFileId(ts.getNormalizedAbsolutePath(path, currentDirectory));
|
|
101242
|
+
}
|
|
100879
101243
|
function toFileIdListId(set) {
|
|
100880
101244
|
var fileIds = ts.arrayFrom(set.keys(), toFileId).sort(ts.compareValues);
|
|
100881
101245
|
var key = fileIds.join();
|
|
@@ -100886,53 +101250,236 @@ var ts;
|
|
|
100886
101250
|
}
|
|
100887
101251
|
return fileIdListId;
|
|
100888
101252
|
}
|
|
100889
|
-
function
|
|
101253
|
+
function toProgramBuildInfoCompilerOptions(options, optionKey, affectsModuleResolution) {
|
|
100890
101254
|
var result;
|
|
100891
101255
|
var optionsNameMap = ts.getOptionsNameMap().optionsNameMap;
|
|
100892
101256
|
for (var _i = 0, _a = ts.getOwnKeys(options).sort(ts.compareStringsCaseSensitive); _i < _a.length; _i++) {
|
|
100893
101257
|
var name = _a[_i];
|
|
100894
101258
|
var optionInfo = optionsNameMap.get(name.toLowerCase());
|
|
100895
|
-
if (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo[optionKey]) {
|
|
100896
|
-
(result
|
|
101259
|
+
if ((optionKey && (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo[optionKey])) || (affectsModuleResolution && (optionInfo === null || optionInfo === void 0 ? void 0 : optionInfo.affectsModuleResolution))) {
|
|
101260
|
+
(result !== null && result !== void 0 ? result : (result = {}))[name] = toReusableCompilerOptionValue(optionInfo, options[name]);
|
|
101261
|
+
}
|
|
101262
|
+
else if (affectsModuleResolution && name === "pathsBasePath") {
|
|
101263
|
+
(result !== null && result !== void 0 ? result : (result = {})).pathsBasePath = relativeToBuildInfoEnsuringAbsolutePath(options.pathsBasePath);
|
|
101264
|
+
continue;
|
|
100897
101265
|
}
|
|
100898
101266
|
}
|
|
100899
101267
|
return result;
|
|
100900
101268
|
}
|
|
100901
|
-
|
|
100902
|
-
|
|
100903
|
-
|
|
100904
|
-
|
|
100905
|
-
|
|
100906
|
-
|
|
100907
|
-
|
|
101269
|
+
function toReusableCompilerOptionValue(option, value) {
|
|
101270
|
+
if (option) {
|
|
101271
|
+
if (option.type === "list") {
|
|
101272
|
+
var values = value;
|
|
101273
|
+
if (option.element.isFilePath && values.length) {
|
|
101274
|
+
return values.map(relativeToBuildInfoEnsuringAbsolutePath);
|
|
101275
|
+
}
|
|
101276
|
+
}
|
|
101277
|
+
else if (option.isFilePath) {
|
|
101278
|
+
return relativeToBuildInfoEnsuringAbsolutePath(value);
|
|
100908
101279
|
}
|
|
100909
101280
|
}
|
|
100910
|
-
|
|
100911
|
-
return relativeToBuildInfo(value);
|
|
100912
|
-
}
|
|
101281
|
+
return value;
|
|
100913
101282
|
}
|
|
100914
|
-
|
|
100915
|
-
|
|
100916
|
-
|
|
100917
|
-
|
|
100918
|
-
|
|
100919
|
-
var result = convertToReusableDiagnosticRelatedInformation(diagnostic, relativeToBuildInfo);
|
|
101283
|
+
function toReadonlyArrayOrUndefined(array, map) {
|
|
101284
|
+
return (array === null || array === void 0 ? void 0 : array.length) ? array.map(map) : undefined;
|
|
101285
|
+
}
|
|
101286
|
+
function toReusableDiagnostic(diagnostic) {
|
|
101287
|
+
var result = toReusableDiagnosticRelatedInformation(diagnostic);
|
|
100920
101288
|
result.reportsUnnecessary = diagnostic.reportsUnnecessary;
|
|
100921
101289
|
result.reportDeprecated = diagnostic.reportsDeprecated;
|
|
100922
101290
|
result.source = diagnostic.source;
|
|
100923
101291
|
result.skippedOn = diagnostic.skippedOn;
|
|
100924
101292
|
var relatedInformation = diagnostic.relatedInformation;
|
|
100925
|
-
result.relatedInformation = relatedInformation ?
|
|
100926
|
-
relatedInformation.length ?
|
|
100927
|
-
relatedInformation.map(function (r) { return convertToReusableDiagnosticRelatedInformation(r, relativeToBuildInfo); }) :
|
|
100928
|
-
[] :
|
|
100929
|
-
undefined;
|
|
101293
|
+
result.relatedInformation = relatedInformation === null || relatedInformation === void 0 ? void 0 : relatedInformation.map(toReusableDiagnosticRelatedInformation);
|
|
100930
101294
|
return result;
|
|
101295
|
+
}
|
|
101296
|
+
function toReusableDiagnosticRelatedInformation(diagnostic) {
|
|
101297
|
+
var file = diagnostic.file;
|
|
101298
|
+
return __assign(__assign({}, diagnostic), { file: file ? relativeToBuildInfo(file.resolvedPath) : undefined });
|
|
101299
|
+
}
|
|
101300
|
+
function toProgramBuildInfoCacheResolutions() {
|
|
101301
|
+
var cacheResolutions = getCacheResolutions(state);
|
|
101302
|
+
var modules = toProgramBuildInfoResolutionCacheWithRedirects(cacheResolutions === null || cacheResolutions === void 0 ? void 0 : cacheResolutions.modules);
|
|
101303
|
+
var typeRefs = toProgramBuildInfoResolutionCacheWithRedirects(cacheResolutions === null || cacheResolutions === void 0 ? void 0 : cacheResolutions.typeRefs);
|
|
101304
|
+
if (!resolutions)
|
|
101305
|
+
return;
|
|
101306
|
+
ts.Debug.assertIsDefined(names);
|
|
101307
|
+
ts.Debug.assertIsDefined(resolutionEntries);
|
|
101308
|
+
state.resuableCacheResolutions = {
|
|
101309
|
+
cache: {
|
|
101310
|
+
resolutions: resolutions.map(toProgramBuildInfoResolution),
|
|
101311
|
+
names: names,
|
|
101312
|
+
hash: toProgramBuildInfoHashes(),
|
|
101313
|
+
resolutionEntries: resolutionEntries,
|
|
101314
|
+
modules: modules,
|
|
101315
|
+
typeRefs: typeRefs,
|
|
101316
|
+
},
|
|
101317
|
+
getProgramBuildInfoFilePathDecoder: ts.memoize(function () { return getProgramBuildInfoFilePathDecoder(fileNames, buildInfoPath, currentDirectory, getCanonicalFileName); })
|
|
101318
|
+
};
|
|
101319
|
+
return state.resuableCacheResolutions.cache;
|
|
101320
|
+
}
|
|
101321
|
+
function toProgramBuildInfoResolutionCacheWithRedirects(cache) {
|
|
101322
|
+
if (!cache)
|
|
101323
|
+
return undefined;
|
|
101324
|
+
var ownMap = cache.getOwnMap();
|
|
101325
|
+
var own = toProgramBuildInfoResolutionCache(ownMap);
|
|
101326
|
+
var redirects;
|
|
101327
|
+
cache.redirectsKeyToCache.forEach(function (_a) {
|
|
101328
|
+
var map = _a.map, options = _a.options;
|
|
101329
|
+
if (map === ownMap)
|
|
101330
|
+
return;
|
|
101331
|
+
var redirectCache = toProgramBuildInfoResolutionCache(map);
|
|
101332
|
+
if (redirectCache) {
|
|
101333
|
+
(redirects !== null && redirects !== void 0 ? redirects : (redirects = [])).push({
|
|
101334
|
+
options: toProgramBuildInfoCompilerOptions(options, undefined, true),
|
|
101335
|
+
cache: redirectCache
|
|
101336
|
+
});
|
|
101337
|
+
}
|
|
101338
|
+
});
|
|
101339
|
+
return !redirects ? own : { own: own, redirects: redirects };
|
|
101340
|
+
}
|
|
101341
|
+
function toProgramBuildInfoResolutionCache(cache) {
|
|
101342
|
+
var result;
|
|
101343
|
+
cache === null || cache === void 0 ? void 0 : cache.forEach(function (dirCache, dirPath) { return dirCache.size() ?
|
|
101344
|
+
(result !== null && result !== void 0 ? result : (result = [])).push([
|
|
101345
|
+
toFileId(dirPath),
|
|
101346
|
+
ts.arrayFrom(dirCache.entries()).map(toProgramBuildInfoResolutionEntryId)
|
|
101347
|
+
]) :
|
|
101348
|
+
undefined; });
|
|
101349
|
+
return result;
|
|
101350
|
+
}
|
|
101351
|
+
function toProgramBuildInfoResolutionEntryId(_a) {
|
|
101352
|
+
var name = _a[0], mode = _a[1], resolution = _a[2];
|
|
101353
|
+
var resolutionNameId = toProgramBuildInfoResolutionNameId(name);
|
|
101354
|
+
var resolutionId = toProgramBuildInfoResolutionId(resolution);
|
|
101355
|
+
var key = resolutionNameId + "," + mode + "," + resolutionId;
|
|
101356
|
+
var resolutionEntryId = resolutionEntryToResolutionEntryId === null || resolutionEntryToResolutionEntryId === void 0 ? void 0 : resolutionEntryToResolutionEntryId.get(key);
|
|
101357
|
+
if (resolutionEntryId === undefined) {
|
|
101358
|
+
(resolutionEntries || (resolutionEntries = [])).push(mode ? [resolutionNameId, resolutionId, mode] : [resolutionNameId, resolutionId]);
|
|
101359
|
+
(resolutionEntryToResolutionEntryId || (resolutionEntryToResolutionEntryId = new ts.Map())).set(key, resolutionEntryId = resolutionEntries.length);
|
|
101360
|
+
}
|
|
101361
|
+
return resolutionEntryId;
|
|
101362
|
+
}
|
|
101363
|
+
function toProgramBuildInfoResolutionNameId(name) {
|
|
101364
|
+
var resolutionNameId = resolutionNameToResolutionNameId === null || resolutionNameToResolutionNameId === void 0 ? void 0 : resolutionNameToResolutionNameId.get(name);
|
|
101365
|
+
if (resolutionNameId === undefined) {
|
|
101366
|
+
(names !== null && names !== void 0 ? names : (names = [])).push(name);
|
|
101367
|
+
(resolutionNameToResolutionNameId !== null && resolutionNameToResolutionNameId !== void 0 ? resolutionNameToResolutionNameId : (resolutionNameToResolutionNameId = new ts.Map())).set(name, resolutionNameId = names.length);
|
|
101368
|
+
}
|
|
101369
|
+
return resolutionNameId;
|
|
101370
|
+
}
|
|
101371
|
+
function toProgramBuildInfoResolutionId(resolution) {
|
|
101372
|
+
if (resolution.serializationIndex === undefined) {
|
|
101373
|
+
(resolutions !== null && resolutions !== void 0 ? resolutions : (resolutions = [])).push(resolution);
|
|
101374
|
+
resolution.serializationIndex = resolutions.length;
|
|
101375
|
+
}
|
|
101376
|
+
return resolution.serializationIndex;
|
|
101377
|
+
}
|
|
101378
|
+
function toProgramBuildInfoResolution(resolution) {
|
|
101379
|
+
resolution.serializationIndex = undefined;
|
|
101380
|
+
return {
|
|
101381
|
+
resolvedModule: toProgramBuildInfoResolved(resolution.resolvedModule),
|
|
101382
|
+
resolvedTypeReferenceDirective: toProgramBuildInfoResolved(resolution.resolvedTypeReferenceDirective),
|
|
101383
|
+
affectingLocations: toReadonlyArrayOrUndefined(resolution.affectingLocations, toAffectedFileId),
|
|
101384
|
+
resolutionDiagnostics: toReadonlyArrayOrUndefined(resolution.resolutionDiagnostics, toProgramBuildInfoResolutionDiagnostic),
|
|
101385
|
+
};
|
|
101386
|
+
}
|
|
101387
|
+
function toProgramBuildInfoHashes() {
|
|
101388
|
+
if (!affectedFilesHash)
|
|
101389
|
+
return undefined;
|
|
101390
|
+
var hashes = [];
|
|
101391
|
+
for (var _i = 0, _a = ts.arrayFrom(affectedFilesHash.keys()).sort(ts.compareValues); _i < _a.length; _i++) {
|
|
101392
|
+
var key = _a[_i];
|
|
101393
|
+
var value = affectedFilesHash.get(key);
|
|
101394
|
+
hashes.push(value ? [key, value] : key);
|
|
101395
|
+
}
|
|
101396
|
+
return hashes;
|
|
101397
|
+
}
|
|
101398
|
+
function toAffectedFileId(file) {
|
|
101399
|
+
var _a;
|
|
101400
|
+
var fileId = toAbsoluteFileId(file);
|
|
101401
|
+
if (!(affectedFilesHash === null || affectedFilesHash === void 0 ? void 0 : affectedFilesHash.has(fileId))) {
|
|
101402
|
+
var packageJsonInfo = (_a = state.program.getModuleResolutionCache()) === null || _a === void 0 ? void 0 : _a.getPackageJsonInfo(file);
|
|
101403
|
+
var text = typeof packageJsonInfo === "object" ? packageJsonInfo.packageJsonText : undefined;
|
|
101404
|
+
(affectedFilesHash !== null && affectedFilesHash !== void 0 ? affectedFilesHash : (affectedFilesHash = new ts.Map())).set(fileId, text ? computeSignature(text, host) : undefined);
|
|
101405
|
+
}
|
|
101406
|
+
return fileId;
|
|
101407
|
+
}
|
|
101408
|
+
function toProgramBuildInfoResolved(resolved) {
|
|
101409
|
+
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;
|
|
101410
|
+
}
|
|
101411
|
+
function toProgramBuildInfoResolutionDiagnostic(d) {
|
|
101412
|
+
return {
|
|
101413
|
+
isImports: d.isImports || undefined,
|
|
101414
|
+
entry: d.entry || undefined,
|
|
101415
|
+
packagePath: toAbsoluteFileId(d.packagePath),
|
|
101416
|
+
};
|
|
101417
|
+
}
|
|
101418
|
+
}
|
|
101419
|
+
function getCacheResolutions(state) {
|
|
101420
|
+
var _a;
|
|
101421
|
+
if (state.cacheResolutions || !state.compilerOptions.cacheResolutions)
|
|
101422
|
+
return state.cacheResolutions;
|
|
101423
|
+
var modules;
|
|
101424
|
+
var typeRefs;
|
|
101425
|
+
var moduleNameToDirectoryMap = ts.createCacheWithRedirects(state.compilerOptions);
|
|
101426
|
+
var getCanonicalFileName = ts.createGetCanonicalFileName(state.program.useCaseSensitiveFileNames());
|
|
101427
|
+
state.program.getSourceFiles().forEach(function (f) {
|
|
101428
|
+
modules = toPerDirectoryCache(state, getCanonicalFileName, modules, f, f.resolvedModules, moduleNameToDirectoryMap);
|
|
101429
|
+
typeRefs = toPerDirectoryCache(state, getCanonicalFileName, typeRefs, f, f.resolvedTypeReferenceDirectiveNames);
|
|
100931
101430
|
});
|
|
101431
|
+
var automaticTypeDirectiveNames = state.program.getAutomaticTypeDirectiveNames();
|
|
101432
|
+
if (automaticTypeDirectiveNames.length) {
|
|
101433
|
+
var currentDirectory = state.program.getCurrentDirectory();
|
|
101434
|
+
var containingPath = ts.toPath(state.program.getAutomaticTypeDirectiveContainingFile(), currentDirectory, getCanonicalFileName);
|
|
101435
|
+
typeRefs = toPerDirectoryCache(state, getCanonicalFileName, typeRefs, containingPath, state.program.getAutomaticTypeDirectiveResolutions());
|
|
101436
|
+
}
|
|
101437
|
+
return state.cacheResolutions = {
|
|
101438
|
+
modules: modules,
|
|
101439
|
+
typeRefs: typeRefs,
|
|
101440
|
+
moduleNameToDirectoryMap: moduleNameToDirectoryMap,
|
|
101441
|
+
packageJsonCache: (_a = state.program.getModuleResolutionCache()) === null || _a === void 0 ? void 0 : _a.getPackageJsonInfoCache().clone(),
|
|
101442
|
+
};
|
|
100932
101443
|
}
|
|
100933
|
-
function
|
|
100934
|
-
|
|
100935
|
-
|
|
101444
|
+
function toPerDirectoryCache(state, getCanonicalFileName, cacheWithRedirects, fOrPath, cache, moduleNameToDirectoryMap) {
|
|
101445
|
+
if (!(cache === null || cache === void 0 ? void 0 : cache.size()))
|
|
101446
|
+
return cacheWithRedirects;
|
|
101447
|
+
var dirPath, redirectedReference;
|
|
101448
|
+
if (!ts.isString(fOrPath)) {
|
|
101449
|
+
redirectedReference = state.program.getRedirectReferenceForResolution(fOrPath);
|
|
101450
|
+
dirPath = ts.getDirectoryPath(fOrPath.path);
|
|
101451
|
+
}
|
|
101452
|
+
else {
|
|
101453
|
+
dirPath = ts.getDirectoryPath(fOrPath);
|
|
101454
|
+
}
|
|
101455
|
+
var perDirResolutionCache = cacheWithRedirects === null || cacheWithRedirects === void 0 ? void 0 : cacheWithRedirects.getMapOfCacheRedirects(redirectedReference);
|
|
101456
|
+
var dirCache = perDirResolutionCache === null || perDirResolutionCache === void 0 ? void 0 : perDirResolutionCache.get(dirPath);
|
|
101457
|
+
cache.forEach(function (resolution, name, mode) {
|
|
101458
|
+
var _a, _b, _c, _d;
|
|
101459
|
+
if (!((_a = resolution.resolvedModule) === null || _a === void 0 ? void 0 : _a.resolvedFileName) && !((_b = resolution.resolvedTypeReferenceDirective) === null || _b === void 0 ? void 0 : _b.resolvedFileName))
|
|
101460
|
+
return;
|
|
101461
|
+
if (dirCache === null || dirCache === void 0 ? void 0 : dirCache.has(name, mode))
|
|
101462
|
+
return;
|
|
101463
|
+
if (moduleNameToDirectoryMap &&
|
|
101464
|
+
!ts.isExternalModuleNameRelative(name) &&
|
|
101465
|
+
((_d = (_c = moduleNameToDirectoryMap.getMapOfCacheRedirects(redirectedReference)) === null || _c === void 0 ? void 0 : _c.get(ts.getModeAwareCacheKey(name, mode))) === null || _d === void 0 ? void 0 : _d.get(dirPath))) {
|
|
101466
|
+
return;
|
|
101467
|
+
}
|
|
101468
|
+
if (!dirCache) {
|
|
101469
|
+
perDirResolutionCache !== null && perDirResolutionCache !== void 0 ? perDirResolutionCache : (perDirResolutionCache = (cacheWithRedirects !== null && cacheWithRedirects !== void 0 ? cacheWithRedirects : (cacheWithRedirects = ts.createCacheWithRedirects(state.compilerOptions))).getOrCreateMapOfCacheRedirects(redirectedReference));
|
|
101470
|
+
perDirResolutionCache.set(dirPath, dirCache = ts.createModeAwareCache());
|
|
101471
|
+
}
|
|
101472
|
+
dirCache.set(name, mode, resolution);
|
|
101473
|
+
if (!moduleNameToDirectoryMap || ts.isExternalModuleNameRelative(name))
|
|
101474
|
+
return;
|
|
101475
|
+
var actualModuleNameToDirectoryMap = moduleNameToDirectoryMap.getOrCreateMapOfCacheRedirects(redirectedReference);
|
|
101476
|
+
var key = ts.getModeAwareCacheKey(name, mode);
|
|
101477
|
+
var directoryPathMap = actualModuleNameToDirectoryMap.get(key);
|
|
101478
|
+
if (!directoryPathMap)
|
|
101479
|
+
actualModuleNameToDirectoryMap.set(key, directoryPathMap = new ts.Map());
|
|
101480
|
+
ts.moduleNameToDirectorySet(directoryPathMap, dirPath, resolution, ts.getResolvedFileNameForModuleNameToDirectorySet, function (dir) { return ts.toPath(dir, state.program.getCurrentDirectory(), getCanonicalFileName); }, function (ancestorPath) { var _a; return (_a = perDirResolutionCache === null || perDirResolutionCache === void 0 ? void 0 : perDirResolutionCache.get(ancestorPath)) === null || _a === void 0 ? void 0 : _a.delete(name, mode); });
|
|
101481
|
+
});
|
|
101482
|
+
return cacheWithRedirects;
|
|
100936
101483
|
}
|
|
100937
101484
|
var BuilderProgramKind;
|
|
100938
101485
|
(function (BuilderProgramKind) {
|
|
@@ -100956,7 +101503,7 @@ var ts;
|
|
|
100956
101503
|
rootNames: newProgramOrRootNames,
|
|
100957
101504
|
options: hostOrOptions,
|
|
100958
101505
|
host: oldProgramOrHost,
|
|
100959
|
-
oldProgram: oldProgram
|
|
101506
|
+
oldProgram: oldProgram === null || oldProgram === void 0 ? void 0 : oldProgram.getProgramOrOldBuildInfoProgramUndefined(),
|
|
100960
101507
|
configFileParsingDiagnostics: configFileParsingDiagnostics,
|
|
100961
101508
|
projectReferences: projectReferences
|
|
100962
101509
|
});
|
|
@@ -100974,8 +101521,8 @@ var ts;
|
|
|
100974
101521
|
function getTextHandlingSourceMapForSignature(text, data) {
|
|
100975
101522
|
return (data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text;
|
|
100976
101523
|
}
|
|
100977
|
-
function computeSignatureWithDiagnostics(sourceFile, text,
|
|
100978
|
-
var _a;
|
|
101524
|
+
function computeSignatureWithDiagnostics(sourceFile, text, host, getCanonicalFileName, data) {
|
|
101525
|
+
var _a, _b;
|
|
100979
101526
|
text = getTextHandlingSourceMapForSignature(text, data);
|
|
100980
101527
|
var sourceFileDirectory;
|
|
100981
101528
|
if ((_a = data === null || data === void 0 ? void 0 : data.diagnostics) === null || _a === void 0 ? void 0 : _a.length) {
|
|
@@ -100983,7 +101530,7 @@ var ts;
|
|
|
100983
101530
|
return "" + locationInfo(diagnostic) + ts.DiagnosticCategory[diagnostic.category] + diagnostic.code + ": " + flattenDiagnosticMessageText(diagnostic.messageText);
|
|
100984
101531
|
}).join("\n");
|
|
100985
101532
|
}
|
|
100986
|
-
return (
|
|
101533
|
+
return ((_b = host.createHash) !== null && _b !== void 0 ? _b : ts.generateDjb2Hash)(text);
|
|
100987
101534
|
function flattenDiagnosticMessageText(diagnostic) {
|
|
100988
101535
|
return ts.isString(diagnostic) ?
|
|
100989
101536
|
diagnostic :
|
|
@@ -101002,8 +101549,9 @@ var ts;
|
|
|
101002
101549
|
}
|
|
101003
101550
|
}
|
|
101004
101551
|
ts.computeSignatureWithDiagnostics = computeSignatureWithDiagnostics;
|
|
101005
|
-
function computeSignature(text,
|
|
101006
|
-
|
|
101552
|
+
function computeSignature(text, host, data) {
|
|
101553
|
+
var _a;
|
|
101554
|
+
return ((_a = host.createHash) !== null && _a !== void 0 ? _a : ts.generateDjb2Hash)(getTextHandlingSourceMapForSignature(text, data));
|
|
101007
101555
|
}
|
|
101008
101556
|
ts.computeSignature = computeSignature;
|
|
101009
101557
|
function createBuilderProgram(kind, _a) {
|
|
@@ -101014,10 +101562,8 @@ var ts;
|
|
|
101014
101562
|
oldState = undefined;
|
|
101015
101563
|
return oldProgram;
|
|
101016
101564
|
}
|
|
101017
|
-
var
|
|
101018
|
-
|
|
101019
|
-
var state = createBuilderProgramState(newProgram, getCanonicalFileName, oldState, host.disableUseFileVersionAsSignature);
|
|
101020
|
-
newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName); };
|
|
101565
|
+
var state = createBuilderProgramState(newProgram, oldState, host.disableUseFileVersionAsSignature);
|
|
101566
|
+
newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, host); };
|
|
101021
101567
|
newProgram = undefined;
|
|
101022
101568
|
oldProgram = undefined;
|
|
101023
101569
|
oldState = undefined;
|
|
@@ -101031,6 +101577,7 @@ var ts;
|
|
|
101031
101577
|
builderProgram.getSemanticDiagnostics = getSemanticDiagnostics;
|
|
101032
101578
|
builderProgram.emit = emit;
|
|
101033
101579
|
builderProgram.releaseProgram = function () { return releaseCache(state); };
|
|
101580
|
+
builderProgram.getProgramOrOldBuildInfoProgramUndefined = createGetProgramOrOldBuildInfoProgramUndefined(state);
|
|
101034
101581
|
if (kind === BuilderProgramKind.SemanticDiagnosticsBuilderProgram) {
|
|
101035
101582
|
builderProgram.getSemanticDiagnosticsOfNextAffectedFile = getSemanticDiagnosticsOfNextAffectedFile;
|
|
101036
101583
|
}
|
|
@@ -101052,7 +101599,7 @@ var ts;
|
|
|
101052
101599
|
return ts.emitSkippedWithNoDiagnostics;
|
|
101053
101600
|
}
|
|
101054
101601
|
function emitNextAffectedFile(writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) {
|
|
101055
|
-
var affected = getNextAffectedFile(state, cancellationToken,
|
|
101602
|
+
var affected = getNextAffectedFile(state, cancellationToken, host);
|
|
101056
101603
|
var emitKind = 1;
|
|
101057
101604
|
var isPendingEmitFile = false;
|
|
101058
101605
|
if (!affected) {
|
|
@@ -101090,7 +101637,7 @@ var ts;
|
|
|
101090
101637
|
var file = sourceFiles[0];
|
|
101091
101638
|
var info = state.fileInfos.get(file.resolvedPath);
|
|
101092
101639
|
if (info.signature === file.version) {
|
|
101093
|
-
var signature = computeSignatureWithDiagnostics(file, text,
|
|
101640
|
+
var signature = computeSignatureWithDiagnostics(file, text, host, ts.createGetCanonicalFileName(state.program.useCaseSensitiveFileNames()), data);
|
|
101094
101641
|
if (!((_a = data === null || data === void 0 ? void 0 : data.diagnostics) === null || _a === void 0 ? void 0 : _a.length))
|
|
101095
101642
|
emitSignature = signature;
|
|
101096
101643
|
if (signature !== file.version) {
|
|
@@ -101114,7 +101661,7 @@ var ts;
|
|
|
101114
101661
|
if (state.compilerOptions.composite) {
|
|
101115
101662
|
var filePath = sourceFiles[0].resolvedPath;
|
|
101116
101663
|
var oldSignature = (_f = state.emitSignatures) === null || _f === void 0 ? void 0 : _f.get(filePath);
|
|
101117
|
-
emitSignature !== null && emitSignature !== void 0 ? emitSignature : (emitSignature = computeSignature(text,
|
|
101664
|
+
emitSignature !== null && emitSignature !== void 0 ? emitSignature : (emitSignature = computeSignature(text, host, data));
|
|
101118
101665
|
if (emitSignature === oldSignature)
|
|
101119
101666
|
return;
|
|
101120
101667
|
((_g = state.emitSignatures) !== null && _g !== void 0 ? _g : (state.emitSignatures = new ts.Map())).set(filePath, emitSignature);
|
|
@@ -101123,7 +101670,7 @@ var ts;
|
|
|
101123
101670
|
}
|
|
101124
101671
|
}
|
|
101125
101672
|
else if (state.compilerOptions.composite) {
|
|
101126
|
-
var newSignature = computeSignature(text,
|
|
101673
|
+
var newSignature = computeSignature(text, host, data);
|
|
101127
101674
|
if (newSignature === state.outSignature)
|
|
101128
101675
|
return;
|
|
101129
101676
|
state.outSignature = newSignature;
|
|
@@ -101184,7 +101731,7 @@ var ts;
|
|
|
101184
101731
|
}
|
|
101185
101732
|
function getSemanticDiagnosticsOfNextAffectedFile(cancellationToken, ignoreSourceFile) {
|
|
101186
101733
|
while (true) {
|
|
101187
|
-
var affected = getNextAffectedFile(state, cancellationToken,
|
|
101734
|
+
var affected = getNextAffectedFile(state, cancellationToken, host);
|
|
101188
101735
|
if (!affected) {
|
|
101189
101736
|
return undefined;
|
|
101190
101737
|
}
|
|
@@ -101242,12 +101789,32 @@ var ts;
|
|
|
101242
101789
|
{ version: fileInfo.version, signature: fileInfo.signature === false ? undefined : fileInfo.version, affectsGlobalScope: fileInfo.affectsGlobalScope, impliedFormat: fileInfo.impliedFormat };
|
|
101243
101790
|
}
|
|
101244
101791
|
ts.toBuilderStateFileInfo = toBuilderStateFileInfo;
|
|
101245
|
-
function
|
|
101246
|
-
var
|
|
101247
|
-
var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
|
|
101248
|
-
var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
|
|
101249
|
-
var state;
|
|
101792
|
+
function getProgramBuildInfoFilePathDecoder(fileNames, buildInfoPath, currentDirectory, getCanonicalFileName) {
|
|
101793
|
+
var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, currentDirectory));
|
|
101250
101794
|
var filePaths;
|
|
101795
|
+
var fileAbsolutePaths;
|
|
101796
|
+
return { toAbsolutePath: toAbsolutePath, toFilePath: toFilePath, toFileAbsolutePath: toFileAbsolutePath, currentDirectory: currentDirectory, getCanonicalFileName: getCanonicalFileName };
|
|
101797
|
+
function toPath(path) {
|
|
101798
|
+
return ts.toPath(path, buildInfoDirectory, getCanonicalFileName);
|
|
101799
|
+
}
|
|
101800
|
+
function toAbsolutePath(path) {
|
|
101801
|
+
return ts.getNormalizedAbsolutePath(path, buildInfoDirectory);
|
|
101802
|
+
}
|
|
101803
|
+
function toFilePath(fileId) {
|
|
101804
|
+
var _a;
|
|
101805
|
+
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]));
|
|
101806
|
+
}
|
|
101807
|
+
function toFileAbsolutePath(fileId) {
|
|
101808
|
+
var _a;
|
|
101809
|
+
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]));
|
|
101810
|
+
}
|
|
101811
|
+
}
|
|
101812
|
+
ts.getProgramBuildInfoFilePathDecoder = getProgramBuildInfoFilePathDecoder;
|
|
101813
|
+
function createBuilderProgramUsingProgramBuildInfo(program, buildInfoPath, host, configFilePath) {
|
|
101814
|
+
var _a, _b, _c;
|
|
101815
|
+
var buildInfoFilePathDecoder = getProgramBuildInfoFilePathDecoder(program.fileNames, buildInfoPath, host.getCurrentDirectory(), ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames()));
|
|
101816
|
+
var toFilePath = buildInfoFilePathDecoder.toFilePath, toAbsolutePath = buildInfoFilePathDecoder.toAbsolutePath;
|
|
101817
|
+
var state;
|
|
101251
101818
|
var filePathsSetList;
|
|
101252
101819
|
var latestChangedDtsFile = program.latestChangedDtsFile ? toAbsolutePath(program.latestChangedDtsFile) : undefined;
|
|
101253
101820
|
if (isProgramBundleEmitBuildInfo(program)) {
|
|
@@ -101256,13 +101823,13 @@ var ts;
|
|
|
101256
101823
|
compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
|
|
101257
101824
|
latestChangedDtsFile: latestChangedDtsFile,
|
|
101258
101825
|
outSignature: program.outSignature,
|
|
101826
|
+
resuableCacheResolutions: toResuableCacheResolutions(),
|
|
101259
101827
|
};
|
|
101260
101828
|
}
|
|
101261
101829
|
else {
|
|
101262
|
-
|
|
101263
|
-
filePathsSetList = (_b = program.fileIdsList) === null || _b === void 0 ? void 0 : _b.map(function (fileIds) { return new ts.Set(fileIds.map(toFilePath)); });
|
|
101830
|
+
filePathsSetList = (_a = program.fileIdsList) === null || _a === void 0 ? void 0 : _a.map(function (fileIds) { return new ts.Set(fileIds.map(toFilePath)); });
|
|
101264
101831
|
var fileInfos_2 = new ts.Map();
|
|
101265
|
-
var emitSignatures_1 = ((
|
|
101832
|
+
var emitSignatures_1 = ((_b = program.options) === null || _b === void 0 ? void 0 : _b.composite) && !ts.outFile(program.options) ? new ts.Map() : undefined;
|
|
101266
101833
|
program.fileInfos.forEach(function (fileInfo, index) {
|
|
101267
101834
|
var path = toFilePath(index + 1);
|
|
101268
101835
|
var stateFileInfo = toBuilderStateFileInfo(fileInfo);
|
|
@@ -101270,7 +101837,7 @@ var ts;
|
|
|
101270
101837
|
if (emitSignatures_1 && stateFileInfo.signature)
|
|
101271
101838
|
emitSignatures_1.set(path, stateFileInfo.signature);
|
|
101272
101839
|
});
|
|
101273
|
-
(
|
|
101840
|
+
(_c = program.emitSignatures) === null || _c === void 0 ? void 0 : _c.forEach(function (value) {
|
|
101274
101841
|
if (ts.isNumber(value))
|
|
101275
101842
|
emitSignatures_1.delete(toFilePath(value));
|
|
101276
101843
|
else
|
|
@@ -101289,14 +101856,17 @@ var ts;
|
|
|
101289
101856
|
changedFilesSet: new ts.Set(ts.map(program.changeFileSet, toFilePath)),
|
|
101290
101857
|
latestChangedDtsFile: latestChangedDtsFile,
|
|
101291
101858
|
emitSignatures: (emitSignatures_1 === null || emitSignatures_1 === void 0 ? void 0 : emitSignatures_1.size) ? emitSignatures_1 : undefined,
|
|
101859
|
+
resuableCacheResolutions: toResuableCacheResolutions(),
|
|
101292
101860
|
};
|
|
101293
101861
|
}
|
|
101862
|
+
state.compilerOptions.configFilePath = configFilePath;
|
|
101294
101863
|
return {
|
|
101295
101864
|
getState: function () { return state; },
|
|
101296
101865
|
saveEmitState: ts.noop,
|
|
101297
101866
|
restoreEmitState: ts.noop,
|
|
101298
101867
|
getProgram: ts.notImplemented,
|
|
101299
101868
|
getProgramOrUndefined: ts.returnUndefined,
|
|
101869
|
+
getProgramOrOldBuildInfoProgramUndefined: createGetProgramOrOldBuildInfoProgramUndefined(state),
|
|
101300
101870
|
releaseProgram: ts.noop,
|
|
101301
101871
|
getCompilerOptions: function () { return state.compilerOptions; },
|
|
101302
101872
|
getSourceFile: ts.notImplemented,
|
|
@@ -101316,15 +101886,6 @@ var ts;
|
|
|
101316
101886
|
close: ts.noop,
|
|
101317
101887
|
hasChangedEmitSignature: ts.returnFalse,
|
|
101318
101888
|
};
|
|
101319
|
-
function toPath(path) {
|
|
101320
|
-
return ts.toPath(path, buildInfoDirectory, getCanonicalFileName);
|
|
101321
|
-
}
|
|
101322
|
-
function toAbsolutePath(path) {
|
|
101323
|
-
return ts.getNormalizedAbsolutePath(path, buildInfoDirectory);
|
|
101324
|
-
}
|
|
101325
|
-
function toFilePath(fileId) {
|
|
101326
|
-
return filePaths[fileId - 1];
|
|
101327
|
-
}
|
|
101328
101889
|
function toFilePathsSet(fileIdsListId) {
|
|
101329
101890
|
return filePathsSetList[fileIdsListId - 1];
|
|
101330
101891
|
}
|
|
@@ -101339,8 +101900,186 @@ var ts;
|
|
|
101339
101900
|
});
|
|
101340
101901
|
return map;
|
|
101341
101902
|
}
|
|
101903
|
+
function toResuableCacheResolutions() {
|
|
101904
|
+
return program.cacheResolutions && {
|
|
101905
|
+
cache: program.cacheResolutions,
|
|
101906
|
+
getProgramBuildInfoFilePathDecoder: function () { return buildInfoFilePathDecoder; },
|
|
101907
|
+
};
|
|
101908
|
+
}
|
|
101342
101909
|
}
|
|
101343
101910
|
ts.createBuilderProgramUsingProgramBuildInfo = createBuilderProgramUsingProgramBuildInfo;
|
|
101911
|
+
function createGetProgramOrOldBuildInfoProgramUndefined(state) {
|
|
101912
|
+
return function () {
|
|
101913
|
+
var _a;
|
|
101914
|
+
return (_a = state.program) !== null && _a !== void 0 ? _a : (state.cacheResolutions || state.resuableCacheResolutions ?
|
|
101915
|
+
(function (host) { return createOldBuildInfoProgram(host, state.compilerOptions, state.cacheResolutions, !state.cacheResolutions ? state.resuableCacheResolutions : undefined); }) :
|
|
101916
|
+
undefined);
|
|
101917
|
+
};
|
|
101918
|
+
}
|
|
101919
|
+
function createOldBuildInfoProgram(host, compilerOptions, cacheResolutions, resuableCacheResolutions) {
|
|
101920
|
+
if (!cacheResolutions && !resuableCacheResolutions)
|
|
101921
|
+
return undefined;
|
|
101922
|
+
var fileExistsMap = new ts.Map();
|
|
101923
|
+
var affectingLoationsSameMap = new ts.Map();
|
|
101924
|
+
var decodedResolvedModules = ts.createCacheWithRedirects(compilerOptions);
|
|
101925
|
+
var decodedResolvedTypeRefs = ts.createCacheWithRedirects(compilerOptions);
|
|
101926
|
+
var decodedModuleNameToDirectoryMap = ts.createCacheWithRedirects(compilerOptions);
|
|
101927
|
+
var decodedHashes;
|
|
101928
|
+
var resolutions;
|
|
101929
|
+
var originalPathOrResolvedFileNames;
|
|
101930
|
+
var resolutionEntries;
|
|
101931
|
+
return {
|
|
101932
|
+
getCompilerOptions: function () { return compilerOptions; },
|
|
101933
|
+
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); },
|
|
101934
|
+
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); },
|
|
101935
|
+
};
|
|
101936
|
+
function fileExists(fileName) {
|
|
101937
|
+
var result = fileExistsMap.get(fileName);
|
|
101938
|
+
if (result === undefined)
|
|
101939
|
+
fileExistsMap.set(fileName, result = host.fileExists(fileName));
|
|
101940
|
+
return result;
|
|
101941
|
+
}
|
|
101942
|
+
function affectingLocationsSame(fileName, expected) {
|
|
101943
|
+
var _a;
|
|
101944
|
+
var result = affectingLoationsSameMap.get(fileName);
|
|
101945
|
+
if (result !== undefined)
|
|
101946
|
+
return result;
|
|
101947
|
+
var packageJsonInfo = host.getPackageJsonInfo(fileName);
|
|
101948
|
+
var currentText = typeof packageJsonInfo === "object" ? packageJsonInfo.packageJsonText : undefined;
|
|
101949
|
+
if (ts.isString(expected)) {
|
|
101950
|
+
result = !!currentText && ((_a = host.createHash) !== null && _a !== void 0 ? _a : ts.generateDjb2Hash)(currentText) === expected;
|
|
101951
|
+
}
|
|
101952
|
+
else {
|
|
101953
|
+
var expectedText = typeof expected === "object" ? expected.packageJsonText : undefined;
|
|
101954
|
+
result = currentText === expectedText;
|
|
101955
|
+
}
|
|
101956
|
+
affectingLoationsSameMap.set(fileName, result);
|
|
101957
|
+
return result;
|
|
101958
|
+
}
|
|
101959
|
+
function getResolvedFromCache(cache, reusableCache, decodedReusableCache, dirPath, name, mode, redirectedReference, moduleNameToDirectoryMap, decodedModuleNameToDirectoryMap) {
|
|
101960
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
101961
|
+
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)) ||
|
|
101962
|
+
((_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));
|
|
101963
|
+
if (fromCache) {
|
|
101964
|
+
return fileExists(((_e = fromCache.resolvedModule) === null || _e === void 0 ? void 0 : _e.resolvedFileName) ||
|
|
101965
|
+
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;
|
|
101966
|
+
}
|
|
101967
|
+
if (!reusableCache)
|
|
101968
|
+
return undefined;
|
|
101969
|
+
if (!decodedReusableCache.getOwnMap().size && !decodedReusableCache.redirectsKeyToCache.size) {
|
|
101970
|
+
if (ts.isArray(reusableCache)) {
|
|
101971
|
+
setBuildInfoResolutionEntries(decodedReusableCache, compilerOptions, undefined, reusableCache, decodedModuleNameToDirectoryMap);
|
|
101972
|
+
}
|
|
101973
|
+
else {
|
|
101974
|
+
if (reusableCache.own)
|
|
101975
|
+
setBuildInfoResolutionEntries(decodedReusableCache, compilerOptions, undefined, reusableCache.own, decodedModuleNameToDirectoryMap);
|
|
101976
|
+
reusableCache.redirects.forEach(function (_a) {
|
|
101977
|
+
var options = _a.options, cache = _a.cache;
|
|
101978
|
+
var compilerOptions = options ? ts.convertToOptionsWithAbsolutePaths(options, resuableCacheResolutions.getProgramBuildInfoFilePathDecoder().toAbsolutePath) : {};
|
|
101979
|
+
setBuildInfoResolutionEntries(decodedReusableCache, compilerOptions, ts.getRedirectsCacheKey(compilerOptions), cache, decodedModuleNameToDirectoryMap);
|
|
101980
|
+
});
|
|
101981
|
+
}
|
|
101982
|
+
decodedReusableCache.clearRedirectsMap();
|
|
101983
|
+
decodedModuleNameToDirectoryMap === null || decodedModuleNameToDirectoryMap === void 0 ? void 0 : decodedModuleNameToDirectoryMap.clearRedirectsMap();
|
|
101984
|
+
}
|
|
101985
|
+
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)) ||
|
|
101986
|
+
((_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));
|
|
101987
|
+
return resolutionId ? toResolution(resolutionId) : undefined;
|
|
101988
|
+
}
|
|
101989
|
+
function setBuildInfoResolutionEntries(decodedReusableCache, options, optionsKey, reusableCache, decodedModuleNameToDirectoryMap) {
|
|
101990
|
+
var map = decodedReusableCache.createMapForCompilerOptions(options, optionsKey);
|
|
101991
|
+
reusableCache.forEach(function (_a) {
|
|
101992
|
+
var dirId = _a[0], entryId = _a[1];
|
|
101993
|
+
var dirPath = resuableCacheResolutions.getProgramBuildInfoFilePathDecoder().toFilePath(dirId);
|
|
101994
|
+
map.set(dirPath, toModeAwareCache(entryId, dirPath, options, optionsKey, decodedModuleNameToDirectoryMap));
|
|
101995
|
+
});
|
|
101996
|
+
}
|
|
101997
|
+
function toModeAwareCache(entries, dirPath, options, optionsKey, decodedModuleNameToDirectoryMap) {
|
|
101998
|
+
var modeAwareCache = ts.createModeAwareCache();
|
|
101999
|
+
entries.forEach(function (entryId) {
|
|
102000
|
+
var _a = toResolutionEntry(entryId), name = _a[0], resolutionId = _a[1], mode = _a[2];
|
|
102001
|
+
modeAwareCache.set(name, mode, resolutionId);
|
|
102002
|
+
if (!decodedModuleNameToDirectoryMap || ts.isExternalModuleNameRelative(name))
|
|
102003
|
+
return;
|
|
102004
|
+
var mapForOptions = decodedModuleNameToDirectoryMap.createMapForCompilerOptions(options, optionsKey);
|
|
102005
|
+
var key = ts.getModeAwareCacheKey(name, mode);
|
|
102006
|
+
var moduleNameMap = mapForOptions.get(key);
|
|
102007
|
+
;
|
|
102008
|
+
if (!moduleNameMap)
|
|
102009
|
+
mapForOptions.set(key, moduleNameMap = new ts.Map());
|
|
102010
|
+
ts.moduleNameToDirectorySet(moduleNameMap, dirPath, resolutionId, toOriginalPathOrResolvedFileName, function (fileName) { return ts.toPath(fileName, resuableCacheResolutions.getProgramBuildInfoFilePathDecoder().currentDirectory, resuableCacheResolutions.getProgramBuildInfoFilePathDecoder().getCanonicalFileName); }, ts.noop);
|
|
102011
|
+
});
|
|
102012
|
+
return modeAwareCache;
|
|
102013
|
+
}
|
|
102014
|
+
function toResolutionEntry(entryId) {
|
|
102015
|
+
var existing = resolutionEntries === null || resolutionEntries === void 0 ? void 0 : resolutionEntries[entryId - 1];
|
|
102016
|
+
if (existing)
|
|
102017
|
+
return existing;
|
|
102018
|
+
resolutionEntries !== null && resolutionEntries !== void 0 ? resolutionEntries : (resolutionEntries = new Array(resuableCacheResolutions.cache.resolutionEntries.length));
|
|
102019
|
+
var _a = resuableCacheResolutions.cache.resolutionEntries[entryId - 1], nameId = _a[0], resolutionId = _a[1], mode = _a[2];
|
|
102020
|
+
return resolutionEntries[entryId - 1] = [
|
|
102021
|
+
toName(nameId),
|
|
102022
|
+
resolutionId,
|
|
102023
|
+
mode
|
|
102024
|
+
];
|
|
102025
|
+
}
|
|
102026
|
+
function toName(nameId) {
|
|
102027
|
+
return resuableCacheResolutions.cache.names[nameId - 1];
|
|
102028
|
+
}
|
|
102029
|
+
function toOriginalPathOrResolvedFileName(resolutionId) {
|
|
102030
|
+
var _a;
|
|
102031
|
+
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 ||
|
|
102032
|
+
resuableCacheResolutions.cache.resolutions[resolutionId - 1].resolvedModule.resolvedFileName));
|
|
102033
|
+
}
|
|
102034
|
+
function toAffectingFileLocation(fileId) {
|
|
102035
|
+
if (!decodedHashes && resuableCacheResolutions.cache.hash) {
|
|
102036
|
+
decodedHashes = ts.arrayToMap(resuableCacheResolutions.cache.hash, function (hash) { return ts.isArray(hash) ? hash[0] : hash; }, function (hash) { return ts.isArray(hash) ? hash[1] : undefined; });
|
|
102037
|
+
}
|
|
102038
|
+
var hash = decodedHashes === null || decodedHashes === void 0 ? void 0 : decodedHashes.get(fileId);
|
|
102039
|
+
var file = resuableCacheResolutions.getProgramBuildInfoFilePathDecoder().toFileAbsolutePath(fileId);
|
|
102040
|
+
return affectingLocationsSame(file, hash) ? file : undefined;
|
|
102041
|
+
}
|
|
102042
|
+
function toResolution(resolutionId) {
|
|
102043
|
+
var _a, _b;
|
|
102044
|
+
var existing = resolutions === null || resolutions === void 0 ? void 0 : resolutions[resolutionId - 1];
|
|
102045
|
+
if (existing !== undefined)
|
|
102046
|
+
return existing || undefined;
|
|
102047
|
+
resolutions !== null && resolutions !== void 0 ? resolutions : (resolutions = new Array(resuableCacheResolutions.cache.resolutions.length));
|
|
102048
|
+
var resolution = resuableCacheResolutions.cache.resolutions[resolutionId - 1];
|
|
102049
|
+
var resolvedFileName = resuableCacheResolutions.getProgramBuildInfoFilePathDecoder().toFileAbsolutePath(((_a = resolution.resolvedModule) === null || _a === void 0 ? void 0 : _a.resolvedFileName) || resolution.resolvedTypeReferenceDirective.resolvedFileName);
|
|
102050
|
+
var affectingLocations;
|
|
102051
|
+
if (fileExists(resolvedFileName) && ts.every(resolution.affectingLocations, function (fileId) {
|
|
102052
|
+
var file = toAffectingFileLocation(fileId);
|
|
102053
|
+
if (file)
|
|
102054
|
+
(affectingLocations !== null && affectingLocations !== void 0 ? affectingLocations : (affectingLocations = [])).push(file);
|
|
102055
|
+
return !!file;
|
|
102056
|
+
})) {
|
|
102057
|
+
var extenstion = resolution.resolvedModule ? ts.extensionFromPath(resolvedFileName) : undefined;
|
|
102058
|
+
return resolutions[resolutionId - 1] = {
|
|
102059
|
+
resolvedModule: toResolved(resolution.resolvedModule, resolvedFileName, extenstion),
|
|
102060
|
+
resolvedTypeReferenceDirective: toResolved(resolution.resolvedTypeReferenceDirective, resolvedFileName, extenstion),
|
|
102061
|
+
failedLookupLocations: ts.emptyArray,
|
|
102062
|
+
affectingLocations: affectingLocations,
|
|
102063
|
+
resolutionDiagnostics: (_b = resolution.resolutionDiagnostics) === null || _b === void 0 ? void 0 : _b.map(toResolutionDiagnostic)
|
|
102064
|
+
};
|
|
102065
|
+
}
|
|
102066
|
+
resolutions[resolutionId - 1] = false;
|
|
102067
|
+
return undefined;
|
|
102068
|
+
}
|
|
102069
|
+
function toResolved(resolved, resolvedFileName, extension) {
|
|
102070
|
+
if (!resolved)
|
|
102071
|
+
return undefined;
|
|
102072
|
+
return __assign(__assign({}, resolved), { resolvedFileName: resolvedFileName, originalPath: resolved.originalPath ? resuableCacheResolutions.getProgramBuildInfoFilePathDecoder().toFileAbsolutePath(resolved.originalPath) : undefined, extension: extension });
|
|
102073
|
+
}
|
|
102074
|
+
function toResolutionDiagnostic(d) {
|
|
102075
|
+
return {
|
|
102076
|
+
isImports: !!d.isImports,
|
|
102077
|
+
entry: d.entry || "",
|
|
102078
|
+
packagePath: resuableCacheResolutions.getProgramBuildInfoFilePathDecoder().toFileAbsolutePath(d.packagePath)
|
|
102079
|
+
};
|
|
102080
|
+
}
|
|
102081
|
+
}
|
|
102082
|
+
ts.createOldBuildInfoProgram = createOldBuildInfoProgram;
|
|
101344
102083
|
function getBuildInfoFileVersionMap(program, buildInfoPath, host) {
|
|
101345
102084
|
var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
|
|
101346
102085
|
var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
|
|
@@ -101360,6 +102099,7 @@ var ts;
|
|
|
101360
102099
|
restoreEmitState: ts.noop,
|
|
101361
102100
|
getProgram: getProgram,
|
|
101362
102101
|
getProgramOrUndefined: function () { return getState().program; },
|
|
102102
|
+
getProgramOrOldBuildInfoProgramUndefined: function () { return getState().program; },
|
|
101363
102103
|
releaseProgram: function () { return getState().program = undefined; },
|
|
101364
102104
|
getCompilerOptions: function () { return getState().compilerOptions; },
|
|
101365
102105
|
getSourceFile: function (fileName) { return getProgram().getSourceFile(fileName); },
|
|
@@ -101445,11 +102185,10 @@ var ts;
|
|
|
101445
102185
|
function createResolutionCache(resolutionHost, rootDirForResolution, logChangesWhenResolvingModule) {
|
|
101446
102186
|
var filesWithChangedSetOfUnresolvedImports;
|
|
101447
102187
|
var filesWithInvalidatedResolutions;
|
|
101448
|
-
var filesWithInvalidatedNonRelativeUnresolvedImports;
|
|
101449
|
-
var nonRelativeExternalModuleResolutions = ts.createMultiMap();
|
|
101450
102188
|
var resolutionsWithFailedLookups = [];
|
|
101451
102189
|
var resolutionsWithOnlyAffectingLocations = [];
|
|
101452
102190
|
var resolvedFileToResolution = ts.createMultiMap();
|
|
102191
|
+
var resolutionsToCloseWatcherOn;
|
|
101453
102192
|
var hasChangedAutomaticTypeDirectiveNames = false;
|
|
101454
102193
|
var affectingPathChecks;
|
|
101455
102194
|
var failedLookupChecks;
|
|
@@ -101457,13 +102196,11 @@ var ts;
|
|
|
101457
102196
|
var isInDirectoryChecks;
|
|
101458
102197
|
var getCurrentDirectory = ts.memoize(function () { return resolutionHost.getCurrentDirectory(); });
|
|
101459
102198
|
var cachedDirectoryStructureHost = resolutionHost.getCachedDirectoryStructureHost();
|
|
102199
|
+
var oldModuleAndTypeRefCache;
|
|
101460
102200
|
var resolvedModuleNames = new ts.Map();
|
|
101461
|
-
var
|
|
101462
|
-
var nonRelativeModuleNameCache = ts.createCacheWithRedirects();
|
|
101463
|
-
var moduleResolutionCache = ts.createModuleResolutionCache(getCurrentDirectory(), resolutionHost.getCanonicalFileName, undefined, perDirectoryResolvedModuleNames, nonRelativeModuleNameCache);
|
|
102201
|
+
var moduleResolutionCache = ts.createModuleResolutionCache(getCurrentDirectory(), resolutionHost.getCanonicalFileName);
|
|
101464
102202
|
var resolvedTypeReferenceDirectives = new ts.Map();
|
|
101465
|
-
var
|
|
101466
|
-
var typeReferenceDirectiveResolutionCache = ts.createTypeReferenceDirectiveResolutionCache(getCurrentDirectory(), resolutionHost.getCanonicalFileName, undefined, moduleResolutionCache.getPackageJsonInfoCache(), perDirectoryResolvedTypeReferenceDirectives);
|
|
102203
|
+
var typeReferenceDirectiveResolutionCache = ts.createTypeReferenceDirectiveResolutionCache(getCurrentDirectory(), resolutionHost.getCanonicalFileName, undefined, moduleResolutionCache.getPackageJsonInfoCache());
|
|
101467
102204
|
var failedLookupDefaultExtensions = [".ts", ".tsx", ".js", ".jsx", ".json"];
|
|
101468
102205
|
var customFailedLookupPaths = new ts.Map();
|
|
101469
102206
|
var directoryWatchesOfFailedLookups = new ts.Map();
|
|
@@ -101473,24 +102210,21 @@ var ts;
|
|
|
101473
102210
|
var rootSplitLength = rootPath !== undefined ? rootPath.split(ts.directorySeparator).length : 0;
|
|
101474
102211
|
var typeRootsWatches = new ts.Map();
|
|
101475
102212
|
return {
|
|
102213
|
+
resolvedModuleNames: resolvedModuleNames,
|
|
102214
|
+
resolvedTypeReferenceDirectives: resolvedTypeReferenceDirectives,
|
|
101476
102215
|
getModuleResolutionCache: function () { return moduleResolutionCache; },
|
|
102216
|
+
getTypeReferenceDirectiveResolutionCache: function () { return typeReferenceDirectiveResolutionCache; },
|
|
101477
102217
|
startRecordingFilesWithChangedResolutions: startRecordingFilesWithChangedResolutions,
|
|
101478
102218
|
finishRecordingFilesWithChangedResolutions: finishRecordingFilesWithChangedResolutions,
|
|
101479
|
-
startCachingPerDirectoryResolution:
|
|
102219
|
+
startCachingPerDirectoryResolution: startCachingPerDirectoryResolution,
|
|
101480
102220
|
finishCachingPerDirectoryResolution: finishCachingPerDirectoryResolution,
|
|
101481
102221
|
resolveModuleNames: resolveModuleNames,
|
|
101482
|
-
getResolvedModuleWithFailedLookupLocationsFromCache: getResolvedModuleWithFailedLookupLocationsFromCache,
|
|
101483
102222
|
resolveTypeReferenceDirectives: resolveTypeReferenceDirectives,
|
|
101484
|
-
removeResolutionsFromProjectReferenceRedirects: removeResolutionsFromProjectReferenceRedirects,
|
|
101485
|
-
removeResolutionsOfFile: removeResolutionsOfFile,
|
|
101486
102223
|
hasChangedAutomaticTypeDirectiveNames: function () { return hasChangedAutomaticTypeDirectiveNames; },
|
|
101487
102224
|
invalidateResolutionOfFile: invalidateResolutionOfFile,
|
|
101488
102225
|
invalidateResolutionsOfFailedLookupLocations: invalidateResolutionsOfFailedLookupLocations,
|
|
101489
102226
|
setFilesWithInvalidatedNonRelativeUnresolvedImports: setFilesWithInvalidatedNonRelativeUnresolvedImports,
|
|
101490
102227
|
createHasInvalidatedResolution: createHasInvalidatedResolution,
|
|
101491
|
-
isFileWithInvalidatedNonRelativeUnresolvedImports: isFileWithInvalidatedNonRelativeUnresolvedImports,
|
|
101492
|
-
updateTypeRootsWatch: updateTypeRootsWatch,
|
|
101493
|
-
closeTypeRootsWatch: closeTypeRootsWatch,
|
|
101494
102228
|
clear: clear
|
|
101495
102229
|
};
|
|
101496
102230
|
function getResolvedModule(resolution) {
|
|
@@ -101509,7 +102243,6 @@ var ts;
|
|
|
101509
102243
|
ts.clearMap(directoryWatchesOfFailedLookups, ts.closeFileWatcherOf);
|
|
101510
102244
|
ts.clearMap(fileWatchesOfAffectingLocations, ts.closeFileWatcherOf);
|
|
101511
102245
|
customFailedLookupPaths.clear();
|
|
101512
|
-
nonRelativeExternalModuleResolutions.clear();
|
|
101513
102246
|
closeTypeRootsWatch();
|
|
101514
102247
|
resolvedModuleNames.clear();
|
|
101515
102248
|
resolvedTypeReferenceDirectives.clear();
|
|
@@ -101520,7 +102253,10 @@ var ts;
|
|
|
101520
102253
|
startsWithPathChecks = undefined;
|
|
101521
102254
|
isInDirectoryChecks = undefined;
|
|
101522
102255
|
affectingPathChecks = undefined;
|
|
101523
|
-
|
|
102256
|
+
resolutionsToCloseWatcherOn = undefined;
|
|
102257
|
+
moduleResolutionCache.clear();
|
|
102258
|
+
typeReferenceDirectiveResolutionCache.clear();
|
|
102259
|
+
oldModuleAndTypeRefCache = undefined;
|
|
101524
102260
|
hasChangedAutomaticTypeDirectiveNames = false;
|
|
101525
102261
|
}
|
|
101526
102262
|
function startRecordingFilesWithChangedResolutions() {
|
|
@@ -101531,13 +102267,6 @@ var ts;
|
|
|
101531
102267
|
filesWithChangedSetOfUnresolvedImports = undefined;
|
|
101532
102268
|
return collected;
|
|
101533
102269
|
}
|
|
101534
|
-
function isFileWithInvalidatedNonRelativeUnresolvedImports(path) {
|
|
101535
|
-
if (!filesWithInvalidatedNonRelativeUnresolvedImports) {
|
|
101536
|
-
return false;
|
|
101537
|
-
}
|
|
101538
|
-
var value = filesWithInvalidatedNonRelativeUnresolvedImports.get(path);
|
|
101539
|
-
return !!value && !!value.length;
|
|
101540
|
-
}
|
|
101541
102270
|
function createHasInvalidatedResolution(forceAllFilesAsInvalidated) {
|
|
101542
102271
|
invalidateResolutionsOfFailedLookupLocations();
|
|
101543
102272
|
if (forceAllFilesAsInvalidated) {
|
|
@@ -101546,46 +102275,162 @@ var ts;
|
|
|
101546
102275
|
}
|
|
101547
102276
|
var collected = filesWithInvalidatedResolutions;
|
|
101548
102277
|
filesWithInvalidatedResolutions = undefined;
|
|
101549
|
-
return function (path) { return (
|
|
101550
|
-
isFileWithInvalidatedNonRelativeUnresolvedImports(path); };
|
|
102278
|
+
return function (path) { return !!(collected === null || collected === void 0 ? void 0 : collected.has(path)); };
|
|
101551
102279
|
}
|
|
101552
|
-
function
|
|
102280
|
+
function startCachingPerDirectoryResolution() {
|
|
101553
102281
|
moduleResolutionCache.clear();
|
|
101554
102282
|
typeReferenceDirectiveResolutionCache.clear();
|
|
101555
|
-
|
|
101556
|
-
|
|
102283
|
+
moduleResolutionCache.update(resolutionHost.getCompilationSettings());
|
|
102284
|
+
typeReferenceDirectiveResolutionCache.update(resolutionHost.getCompilationSettings());
|
|
102285
|
+
if (oldModuleAndTypeRefCache) {
|
|
102286
|
+
oldModuleAndTypeRefCache.clearRedirectsMap();
|
|
102287
|
+
moduleResolutionCache.setOldResolutionCache(oldModuleAndTypeRefCache.modules);
|
|
102288
|
+
typeReferenceDirectiveResolutionCache.setOldResolutionCache(oldModuleAndTypeRefCache.typeRefs);
|
|
102289
|
+
}
|
|
101557
102290
|
}
|
|
101558
|
-
function finishCachingPerDirectoryResolution() {
|
|
101559
|
-
|
|
101560
|
-
|
|
101561
|
-
|
|
101562
|
-
|
|
101563
|
-
|
|
101564
|
-
|
|
102291
|
+
function finishCachingPerDirectoryResolution(newProgram, oldProgram) {
|
|
102292
|
+
hasChangedAutomaticTypeDirectiveNames = false;
|
|
102293
|
+
if (!newProgram) {
|
|
102294
|
+
clear();
|
|
102295
|
+
return;
|
|
102296
|
+
}
|
|
102297
|
+
if (newProgram === oldProgram || newProgram.structureIsReused === 3)
|
|
102298
|
+
return;
|
|
102299
|
+
var modules;
|
|
102300
|
+
var typeRefs;
|
|
102301
|
+
var moduleNameToDirectoryMap = ts.createCacheWithRedirects(newProgram.getCompilerOptions());
|
|
102302
|
+
for (var _i = 0, _a = newProgram.getSourceFiles(); _i < _a.length; _i++) {
|
|
102303
|
+
var f = _a[_i];
|
|
102304
|
+
modules = ensureResolutionsOfFile(newProgram, resolvedModuleNames, f.resolvedModules, f, getResolvedModule, modules, moduleNameToDirectoryMap);
|
|
102305
|
+
typeRefs = ensureResolutionsOfFile(newProgram, resolvedTypeReferenceDirectives, f.resolvedTypeReferenceDirectiveNames, f, getResolvedTypeReferenceDirective, typeRefs, undefined);
|
|
102306
|
+
}
|
|
102307
|
+
var newProgramAutoTypeRefContainingFile = resolutionHost.toPath(newProgram.getAutomaticTypeDirectiveContainingFile());
|
|
102308
|
+
typeRefs = ensureResolutionsOfFile(newProgram, resolvedTypeReferenceDirectives, newProgram.getAutomaticTypeDirectiveResolutions(), newProgramAutoTypeRefContainingFile, getResolvedTypeReferenceDirective, typeRefs, undefined);
|
|
102309
|
+
if (!modules && !typeRefs) {
|
|
102310
|
+
oldModuleAndTypeRefCache = undefined;
|
|
102311
|
+
}
|
|
102312
|
+
else {
|
|
102313
|
+
oldModuleAndTypeRefCache = getOldResolutionCache(modules, typeRefs, moduleNameToDirectoryMap);
|
|
102314
|
+
}
|
|
102315
|
+
if (oldProgram) {
|
|
102316
|
+
for (var _b = 0, _c = oldProgram.getSourceFiles(); _b < _c.length; _b++) {
|
|
102317
|
+
var f = _c[_b];
|
|
102318
|
+
if (!newProgram.getSourceFileByPath(f.path))
|
|
102319
|
+
removeResolutionsOfFile(f.path);
|
|
101565
102320
|
}
|
|
101566
|
-
|
|
101567
|
-
|
|
101568
|
-
|
|
101569
|
-
fileWatchesOfAffectingLocations.delete(path);
|
|
101570
|
-
watcher.watcher.close();
|
|
101571
|
-
watcher.watcher = ts.noopFileWatcher;
|
|
102321
|
+
var oldProgramAutoTypeRefContainingFile = resolutionHost.toPath(oldProgram.getAutomaticTypeDirectiveContainingFile());
|
|
102322
|
+
if (oldProgramAutoTypeRefContainingFile !== newProgramAutoTypeRefContainingFile) {
|
|
102323
|
+
removeResolutionsOfFile(oldProgramAutoTypeRefContainingFile);
|
|
101572
102324
|
}
|
|
101573
|
-
}
|
|
101574
|
-
|
|
102325
|
+
}
|
|
102326
|
+
if (!oldProgram || newProgram.getCompilerOptions() !== oldProgram.getCompilerOptions())
|
|
102327
|
+
updateTypeRootsWatch();
|
|
102328
|
+
resolutionsToCloseWatcherOn === null || resolutionsToCloseWatcherOn === void 0 ? void 0 : resolutionsToCloseWatcherOn.forEach(closeWatchersOfResolution);
|
|
102329
|
+
resolutionsToCloseWatcherOn = undefined;
|
|
102330
|
+
fileWatchesOfAffectingLocations.forEach(closeAffectingFileWatcher);
|
|
102331
|
+
}
|
|
102332
|
+
function closeAffectingFileWatcher(watcher, path) {
|
|
102333
|
+
if (watcher.refCount === 0) {
|
|
102334
|
+
fileWatchesOfAffectingLocations.delete(path);
|
|
102335
|
+
watcher.watcher.close();
|
|
102336
|
+
watcher.watcher = ts.noopFileWatcher;
|
|
102337
|
+
}
|
|
102338
|
+
}
|
|
102339
|
+
function ensureResolutionsOfFile(newProgram, perFileCache, fileCacheFromProgram, sourceFileOrPath, getResolutionWithResolvedFileName, perDirCache, moduleNameToDirectoryMap) {
|
|
102340
|
+
var path = !ts.isString(sourceFileOrPath) ? sourceFileOrPath.path : sourceFileOrPath;
|
|
102341
|
+
var resolutionsInFile = perFileCache.get(path);
|
|
102342
|
+
var seenNamesInFile = ts.createModeAwareCache();
|
|
102343
|
+
if (fileCacheFromProgram === null || fileCacheFromProgram === void 0 ? void 0 : fileCacheFromProgram.size()) {
|
|
102344
|
+
var redirectedReference = !ts.isString(sourceFileOrPath) ? newProgram.getRedirectReferenceForResolution(sourceFileOrPath) : undefined;
|
|
102345
|
+
var options_3 = (redirectedReference === null || redirectedReference === void 0 ? void 0 : redirectedReference.commandLine.options) || newProgram.getCompilerOptions();
|
|
102346
|
+
var key_2 = ts.getRedirectsCacheKey(options_3);
|
|
102347
|
+
if (resolutionsInFile && resolutionsInFile.key !== key_2) {
|
|
102348
|
+
resolutionsInFile.cache.forEach(function (r) { return stopWatchingResolution(r, path, getResolutionWithResolvedFileName); });
|
|
102349
|
+
resolutionsInFile = undefined;
|
|
102350
|
+
}
|
|
102351
|
+
var dirPath_1 = ts.getDirectoryPath(path);
|
|
102352
|
+
var perDirResolutionCache_1 = perDirCache === null || perDirCache === void 0 ? void 0 : perDirCache.getMapOfCacheRedirects(redirectedReference);
|
|
102353
|
+
var cacheForDir_1 = perDirResolutionCache_1 === null || perDirResolutionCache_1 === void 0 ? void 0 : perDirResolutionCache_1.get(dirPath_1);
|
|
102354
|
+
fileCacheFromProgram.forEach(function (r, name, mode) {
|
|
102355
|
+
seenNamesInFile.set(name, mode, true);
|
|
102356
|
+
var existing = resolutionsInFile === null || resolutionsInFile === void 0 ? void 0 : resolutionsInFile.cache.get(name, mode);
|
|
102357
|
+
if (existing && r !== existing)
|
|
102358
|
+
stopWatchingResolution(existing, path, getResolutionWithResolvedFileName);
|
|
102359
|
+
watchResolution(newProgram, name, r, path, getResolutionWithResolvedFileName);
|
|
102360
|
+
if (!resolutionsInFile)
|
|
102361
|
+
perFileCache.set(path, resolutionsInFile = { key: key_2, cache: ts.createModeAwareCache() });
|
|
102362
|
+
resolutionsInFile.cache.set(name, mode, r);
|
|
102363
|
+
if (cacheForDir_1 === null || cacheForDir_1 === void 0 ? void 0 : cacheForDir_1.has(name, mode))
|
|
102364
|
+
return;
|
|
102365
|
+
if (!cacheForDir_1) {
|
|
102366
|
+
perDirResolutionCache_1 !== null && perDirResolutionCache_1 !== void 0 ? perDirResolutionCache_1 : (perDirResolutionCache_1 = (perDirCache !== null && perDirCache !== void 0 ? perDirCache : (perDirCache = ts.createCacheWithRedirects(newProgram.getCompilerOptions()))).createMapForCompilerOptions(options_3, key_2));
|
|
102367
|
+
perDirResolutionCache_1.set(dirPath_1, cacheForDir_1 = ts.createModeAwareCache());
|
|
102368
|
+
}
|
|
102369
|
+
cacheForDir_1.set(name, mode, r);
|
|
102370
|
+
if (!moduleNameToDirectoryMap || ts.isExternalModuleNameRelative(name))
|
|
102371
|
+
return;
|
|
102372
|
+
var actualModuleNameToDirectoryMap = moduleNameToDirectoryMap.createMapForCompilerOptions(options_3, key_2);
|
|
102373
|
+
var modeAwareCacheKey = ts.getModeAwareCacheKey(name, mode);
|
|
102374
|
+
var directoryPathMap = actualModuleNameToDirectoryMap.get(modeAwareCacheKey);
|
|
102375
|
+
if (!directoryPathMap)
|
|
102376
|
+
actualModuleNameToDirectoryMap.set(modeAwareCacheKey, directoryPathMap = new ts.Map());
|
|
102377
|
+
ts.moduleNameToDirectorySet(directoryPathMap, dirPath_1, r, ts.getResolvedFileNameForModuleNameToDirectorySet, function (dir) { return resolutionHost.toPath(dir); }, ts.noop);
|
|
102378
|
+
});
|
|
102379
|
+
}
|
|
102380
|
+
if (((resolutionsInFile === null || resolutionsInFile === void 0 ? void 0 : resolutionsInFile.cache.size()) || 0) !== seenNamesInFile.size()) {
|
|
102381
|
+
resolutionsInFile.cache.forEach(function (resolution, name, mode) {
|
|
102382
|
+
if (!seenNamesInFile.has(name, mode)) {
|
|
102383
|
+
stopWatchingResolution(resolution, path, getResolutionWithResolvedFileName);
|
|
102384
|
+
resolutionsInFile.cache.delete(name, mode);
|
|
102385
|
+
}
|
|
102386
|
+
});
|
|
102387
|
+
if (!(resolutionsInFile === null || resolutionsInFile === void 0 ? void 0 : resolutionsInFile.cache.size))
|
|
102388
|
+
perFileCache.delete(path);
|
|
102389
|
+
}
|
|
102390
|
+
return perDirCache;
|
|
102391
|
+
}
|
|
102392
|
+
function getOldResolutionCache(modules, typeRefs, moduleNameToDirectoryMap) {
|
|
102393
|
+
if (!modules && !typeRefs)
|
|
102394
|
+
return undefined;
|
|
102395
|
+
return {
|
|
102396
|
+
modules: {
|
|
102397
|
+
getResolved: function (dirPath, name, mode, redirectedReference) { return getResolvedWithOldCache(dirPath, name, mode, redirectedReference, modules, moduleNameToDirectoryMap); }
|
|
102398
|
+
},
|
|
102399
|
+
typeRefs: {
|
|
102400
|
+
getResolved: function (dirPath, name, mode, redirectedReference) { return getResolvedWithOldCache(dirPath, name, mode, redirectedReference, typeRefs, undefined); }
|
|
102401
|
+
},
|
|
102402
|
+
clearRedirectsMap: function () {
|
|
102403
|
+
modules === null || modules === void 0 ? void 0 : modules.clearRedirectsMap();
|
|
102404
|
+
typeRefs === null || typeRefs === void 0 ? void 0 : typeRefs.clearRedirectsMap();
|
|
102405
|
+
moduleNameToDirectoryMap.clearRedirectsMap();
|
|
102406
|
+
},
|
|
102407
|
+
};
|
|
102408
|
+
}
|
|
102409
|
+
function getResolvedWithOldCache(dirPath, name, mode, redirectedReference, perDirCache, moduleNameToDirectoryMap) {
|
|
102410
|
+
var _a, _b, _c, _d;
|
|
102411
|
+
if (!perDirCache)
|
|
102412
|
+
return undefined;
|
|
102413
|
+
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)) ||
|
|
102414
|
+
((_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));
|
|
102415
|
+
return result && !result.isInvalidated ? result : undefined;
|
|
101575
102416
|
}
|
|
101576
102417
|
function resolveModuleName(moduleName, containingFile, compilerOptions, host, redirectedReference, _containingSourceFile, mode) {
|
|
101577
|
-
var _a
|
|
102418
|
+
var _a;
|
|
101578
102419
|
var primaryResult = ts.resolveModuleName(moduleName, containingFile, compilerOptions, host, moduleResolutionCache, redirectedReference, mode);
|
|
101579
102420
|
if (!resolutionHost.getGlobalCache) {
|
|
101580
102421
|
return primaryResult;
|
|
101581
102422
|
}
|
|
101582
102423
|
var globalCache = resolutionHost.getGlobalCache();
|
|
101583
102424
|
if (globalCache !== undefined && !ts.isExternalModuleNameRelative(moduleName) && !(primaryResult.resolvedModule && ts.extensionIsTS(primaryResult.resolvedModule.extension))) {
|
|
101584
|
-
var
|
|
102425
|
+
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;
|
|
101585
102426
|
if (resolvedModule) {
|
|
101586
102427
|
primaryResult.resolvedModule = resolvedModule;
|
|
101587
|
-
(
|
|
101588
|
-
|
|
102428
|
+
if (!compilerOptions.cacheResolutions)
|
|
102429
|
+
(_a = primaryResult.failedLookupLocations).push.apply(_a, failedLookupLocations);
|
|
102430
|
+
else
|
|
102431
|
+
primaryResult.failedLookupLocations.length = 0;
|
|
102432
|
+
primaryResult.affectingLocations = ts.updateResolutionField(primaryResult.affectingLocations, affectingLocations);
|
|
102433
|
+
primaryResult.resolutionDiagnostics = ts.updateResolutionField(primaryResult.resolutionDiagnostics, resolutionDiagnostics);
|
|
101589
102434
|
return primaryResult;
|
|
101590
102435
|
}
|
|
101591
102436
|
}
|
|
@@ -101595,68 +102440,35 @@ var ts;
|
|
|
101595
102440
|
return ts.resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host, redirectedReference, typeReferenceDirectiveResolutionCache, resolutionMode);
|
|
101596
102441
|
}
|
|
101597
102442
|
function resolveNamesWithLocalCache(_a) {
|
|
101598
|
-
var _b, _c, _d;
|
|
101599
|
-
var names = _a.names, containingFile = _a.containingFile, redirectedReference = _a.redirectedReference,
|
|
102443
|
+
var _b, _c, _d, _e;
|
|
102444
|
+
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;
|
|
101600
102445
|
var path = resolutionHost.toPath(containingFile);
|
|
101601
|
-
var resolutionsInFile =
|
|
101602
|
-
var
|
|
101603
|
-
var
|
|
101604
|
-
|
|
101605
|
-
|
|
101606
|
-
|
|
101607
|
-
perDirectoryCache.set(dirPath, perDirectoryResolution);
|
|
102446
|
+
var resolutionsInFile = perFileCache.get(path);
|
|
102447
|
+
var compilerOptions = resolutionHost.getCompilationSettings();
|
|
102448
|
+
var key = ts.getRedirectsCacheKey((redirectedReference === null || redirectedReference === void 0 ? void 0 : redirectedReference.commandLine.options) || compilerOptions);
|
|
102449
|
+
if (!resolutionsInFile || resolutionsInFile.key !== key) {
|
|
102450
|
+
resolutionsInFile === null || resolutionsInFile === void 0 ? void 0 : resolutionsInFile.cache.forEach(function (r) { return stopWatchingResolution(r, path, getResolutionWithResolvedFileName); });
|
|
102451
|
+
perFileCache.set(path, resolutionsInFile = { key: key, cache: ts.createModeAwareCache() });
|
|
101608
102452
|
}
|
|
101609
102453
|
var resolvedModules = [];
|
|
101610
|
-
var compilerOptions = resolutionHost.getCompilationSettings();
|
|
101611
|
-
var hasInvalidatedNonRelativeUnresolvedImport = logChanges && isFileWithInvalidatedNonRelativeUnresolvedImports(path);
|
|
101612
|
-
var program = resolutionHost.getCurrentProgram();
|
|
101613
|
-
var oldRedirect = program && program.getResolvedProjectReferenceToRedirect(containingFile);
|
|
101614
|
-
var unmatchedRedirects = oldRedirect ?
|
|
101615
|
-
!redirectedReference || redirectedReference.sourceFile.path !== oldRedirect.sourceFile.path :
|
|
101616
|
-
!!redirectedReference;
|
|
101617
102454
|
var seenNamesInFile = ts.createModeAwareCache();
|
|
101618
102455
|
var i = 0;
|
|
101619
|
-
for (var _i = 0,
|
|
101620
|
-
var entry =
|
|
101621
|
-
var name = ts.isString(entry) ? entry : entry.fileName
|
|
102456
|
+
for (var _i = 0, names_4 = names; _i < names_4.length; _i++) {
|
|
102457
|
+
var entry = names_4[_i];
|
|
102458
|
+
var name = ts.isString(entry) ? entry : ts.toFileNameLowerCase(entry.fileName);
|
|
101622
102459
|
var mode = !ts.isString(entry) ? ts.getModeForFileReference(entry, containingSourceFileMode) :
|
|
101623
|
-
containingSourceFile ? ts.getModeForResolutionAtIndex(containingSourceFile, i) : undefined;
|
|
102460
|
+
containingSourceFile ? ts.getModeForResolutionAtIndex(containingSourceFile, (_b = partialResolutionInfo === null || partialResolutionInfo === void 0 ? void 0 : partialResolutionInfo.namesIndex[i]) !== null && _b !== void 0 ? _b : i) : undefined;
|
|
101624
102461
|
i++;
|
|
101625
|
-
var resolution = resolutionsInFile.get(name, mode);
|
|
101626
|
-
if (!seenNamesInFile.has(name, mode) &&
|
|
101627
|
-
unmatchedRedirects || !resolution || resolution.isInvalidated ||
|
|
101628
|
-
(hasInvalidatedNonRelativeUnresolvedImport && !ts.isExternalModuleNameRelative(name) && shouldRetryResolution(resolution))) {
|
|
102462
|
+
var resolution = resolutionsInFile.cache.get(name, mode);
|
|
102463
|
+
if (!seenNamesInFile.has(name, mode) && (!resolution || resolution.isInvalidated)) {
|
|
101629
102464
|
var existingResolution = resolution;
|
|
101630
|
-
|
|
101631
|
-
if (
|
|
101632
|
-
|
|
101633
|
-
var host = ((_b = resolutionHost.getCompilerHost) === null || _b === void 0 ? void 0 : _b.call(resolutionHost)) || resolutionHost;
|
|
101634
|
-
if (ts.isTraceEnabled(compilerOptions, host)) {
|
|
101635
|
-
var resolved = getResolutionWithResolvedFileName(resolution);
|
|
101636
|
-
ts.trace(host, loader === resolveModuleName ?
|
|
101637
|
-
(resolved === null || resolved === void 0 ? void 0 : resolved.resolvedFileName) ?
|
|
101638
|
-
resolved.packagetId ?
|
|
101639
|
-
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 :
|
|
101640
|
-
ts.Diagnostics.Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3 :
|
|
101641
|
-
ts.Diagnostics.Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_not_resolved :
|
|
101642
|
-
(resolved === null || resolved === void 0 ? void 0 : resolved.resolvedFileName) ?
|
|
101643
|
-
resolved.packagetId ?
|
|
101644
|
-
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 :
|
|
101645
|
-
ts.Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3 :
|
|
101646
|
-
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));
|
|
101647
|
-
}
|
|
102465
|
+
resolution = loader(name, containingFile, compilerOptions, ((_c = resolutionHost.getCompilerHost) === null || _c === void 0 ? void 0 : _c.call(resolutionHost)) || resolutionHost, redirectedReference, containingSourceFile, mode);
|
|
102466
|
+
if (resolutionHost.onDiscoveredSymlink && resolutionIsSymlink(resolution)) {
|
|
102467
|
+
resolutionHost.onDiscoveredSymlink();
|
|
101648
102468
|
}
|
|
101649
|
-
|
|
101650
|
-
resolution = loader(name, containingFile, compilerOptions, ((_c = resolutionHost.getCompilerHost) === null || _c === void 0 ? void 0 : _c.call(resolutionHost)) || resolutionHost, redirectedReference, containingSourceFile, mode);
|
|
101651
|
-
perDirectoryResolution.set(name, mode, resolution);
|
|
101652
|
-
if (resolutionHost.onDiscoveredSymlink && resolutionIsSymlink(resolution)) {
|
|
101653
|
-
resolutionHost.onDiscoveredSymlink();
|
|
101654
|
-
}
|
|
101655
|
-
}
|
|
101656
|
-
resolutionsInFile.set(name, mode, resolution);
|
|
101657
|
-
watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, path, getResolutionWithResolvedFileName);
|
|
102469
|
+
resolutionsInFile.cache.set(name, mode, resolution);
|
|
101658
102470
|
if (existingResolution) {
|
|
101659
|
-
|
|
102471
|
+
stopWatchingResolution(existingResolution, path, getResolutionWithResolvedFileName);
|
|
101660
102472
|
}
|
|
101661
102473
|
if (logChanges && filesWithChangedSetOfUnresolvedImports && !resolutionIsEqualTo(existingResolution, resolution)) {
|
|
101662
102474
|
filesWithChangedSetOfUnresolvedImports.push(path);
|
|
@@ -101669,27 +102481,33 @@ var ts;
|
|
|
101669
102481
|
var resolved = getResolutionWithResolvedFileName(resolution);
|
|
101670
102482
|
ts.trace(host, loader === resolveModuleName ?
|
|
101671
102483
|
(resolved === null || resolved === void 0 ? void 0 : resolved.resolvedFileName) ?
|
|
101672
|
-
resolved.
|
|
102484
|
+
resolved.packageId ?
|
|
101673
102485
|
ts.Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 :
|
|
101674
102486
|
ts.Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2 :
|
|
101675
102487
|
ts.Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_not_resolved :
|
|
101676
102488
|
(resolved === null || resolved === void 0 ? void 0 : resolved.resolvedFileName) ?
|
|
101677
|
-
resolved.
|
|
102489
|
+
resolved.packageId ?
|
|
101678
102490
|
ts.Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 :
|
|
101679
102491
|
ts.Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved_to_2 :
|
|
101680
|
-
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.
|
|
102492
|
+
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));
|
|
101681
102493
|
}
|
|
101682
102494
|
}
|
|
101683
102495
|
ts.Debug.assert(resolution !== undefined && !resolution.isInvalidated);
|
|
101684
102496
|
seenNamesInFile.set(name, mode, true);
|
|
101685
|
-
resolvedModules.push(
|
|
102497
|
+
resolvedModules.push(resolution);
|
|
101686
102498
|
}
|
|
101687
|
-
|
|
101688
|
-
|
|
101689
|
-
|
|
101690
|
-
resolutionsInFile.delete(name, mode);
|
|
101691
|
-
}
|
|
102499
|
+
(_e = partialResolutionInfo === null || partialResolutionInfo === void 0 ? void 0 : partialResolutionInfo.reusedNames) === null || _e === void 0 ? void 0 : _e.forEach(function (_a) {
|
|
102500
|
+
var name = _a.name, mode = _a.mode;
|
|
102501
|
+
return seenNamesInFile.set(name, mode, true);
|
|
101692
102502
|
});
|
|
102503
|
+
if (resolutionsInFile.cache.size() !== seenNamesInFile.size()) {
|
|
102504
|
+
resolutionsInFile.cache.forEach(function (resolution, name, mode) {
|
|
102505
|
+
if (!seenNamesInFile.has(name, mode)) {
|
|
102506
|
+
stopWatchingResolution(resolution, path, getResolutionWithResolvedFileName);
|
|
102507
|
+
resolutionsInFile.cache.delete(name, mode);
|
|
102508
|
+
}
|
|
102509
|
+
});
|
|
102510
|
+
}
|
|
101693
102511
|
return resolvedModules;
|
|
101694
102512
|
function resolutionIsEqualTo(oldResolution, newResolution) {
|
|
101695
102513
|
if (oldResolution === newResolution) {
|
|
@@ -101709,40 +102527,31 @@ var ts;
|
|
|
101709
102527
|
return oldResult.resolvedFileName === newResult.resolvedFileName;
|
|
101710
102528
|
}
|
|
101711
102529
|
}
|
|
101712
|
-
function resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference, containingFileMode) {
|
|
102530
|
+
function resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference, containingFileMode, partialResolutionInfo) {
|
|
101713
102531
|
return resolveNamesWithLocalCache({
|
|
101714
102532
|
names: typeDirectiveNames,
|
|
101715
102533
|
containingFile: containingFile,
|
|
101716
102534
|
redirectedReference: redirectedReference,
|
|
101717
|
-
|
|
101718
|
-
perDirectoryCacheWithRedirects: perDirectoryResolvedTypeReferenceDirectives,
|
|
102535
|
+
perFileCache: resolvedTypeReferenceDirectives,
|
|
101719
102536
|
loader: resolveTypeReferenceDirective,
|
|
101720
102537
|
getResolutionWithResolvedFileName: getResolvedTypeReferenceDirective,
|
|
101721
|
-
|
|
101722
|
-
|
|
102538
|
+
containingSourceFileMode: containingFileMode,
|
|
102539
|
+
partialResolutionInfo: partialResolutionInfo,
|
|
101723
102540
|
});
|
|
101724
102541
|
}
|
|
101725
|
-
function resolveModuleNames(moduleNames, containingFile,
|
|
102542
|
+
function resolveModuleNames(moduleNames, containingFile, redirectedReference, containingSourceFile, partialResolutionInfo) {
|
|
101726
102543
|
return resolveNamesWithLocalCache({
|
|
101727
102544
|
names: moduleNames,
|
|
101728
102545
|
containingFile: containingFile,
|
|
101729
102546
|
redirectedReference: redirectedReference,
|
|
101730
|
-
|
|
101731
|
-
perDirectoryCacheWithRedirects: perDirectoryResolvedModuleNames,
|
|
102547
|
+
perFileCache: resolvedModuleNames,
|
|
101732
102548
|
loader: resolveModuleName,
|
|
101733
102549
|
getResolutionWithResolvedFileName: getResolvedModule,
|
|
101734
|
-
|
|
101735
|
-
reusedNames: reusedNames,
|
|
102550
|
+
partialResolutionInfo: partialResolutionInfo,
|
|
101736
102551
|
logChanges: logChangesWhenResolvingModule,
|
|
101737
102552
|
containingSourceFile: containingSourceFile,
|
|
101738
102553
|
});
|
|
101739
102554
|
}
|
|
101740
|
-
function getResolvedModuleWithFailedLookupLocationsFromCache(moduleName, containingFile, resolutionMode) {
|
|
101741
|
-
var cache = resolvedModuleNames.get(resolutionHost.toPath(containingFile));
|
|
101742
|
-
if (!cache)
|
|
101743
|
-
return undefined;
|
|
101744
|
-
return cache.get(moduleName, resolutionMode);
|
|
101745
|
-
}
|
|
101746
102555
|
function isNodeModulesAtTypesDirectory(dirPath) {
|
|
101747
102556
|
return ts.endsWith(dirPath, "/node_modules/@types");
|
|
101748
102557
|
}
|
|
@@ -101796,37 +102605,41 @@ var ts;
|
|
|
101796
102605
|
function isPathWithDefaultFailedLookupExtension(path) {
|
|
101797
102606
|
return ts.fileExtensionIsOneOf(path, failedLookupDefaultExtensions);
|
|
101798
102607
|
}
|
|
101799
|
-
function
|
|
101800
|
-
if (resolution.
|
|
101801
|
-
resolution.
|
|
101802
|
-
|
|
102608
|
+
function watchResolution(newProgram, name, resolution, filePath, getResolutionWithResolvedFileName) {
|
|
102609
|
+
if (resolution.files) {
|
|
102610
|
+
resolution.files.add(filePath);
|
|
102611
|
+
if (resolution.watchedFailed !== false)
|
|
102612
|
+
watchFailedLookupLocationOfResolution(resolution);
|
|
102613
|
+
watchAffectingLocationsOfResolution(resolution);
|
|
102614
|
+
return;
|
|
102615
|
+
}
|
|
102616
|
+
resolution.files = new ts.Set();
|
|
102617
|
+
resolution.files.add(filePath);
|
|
102618
|
+
var resolved = getResolutionWithResolvedFileName(resolution);
|
|
102619
|
+
if (resolved && resolved.resolvedFileName) {
|
|
102620
|
+
resolvedFileToResolution.add(resolutionHost.toPath(resolved.resolvedFileName), resolution);
|
|
102621
|
+
}
|
|
102622
|
+
if (ts.isExternalModuleNameRelative(name) || !newProgram.getTypeChecker().tryFindAmbientModuleWithoutAugmentations(name)) {
|
|
102623
|
+
watchFailedLookupLocationOfResolution(resolution);
|
|
102624
|
+
watchAffectingLocationsOfResolution(resolution);
|
|
101803
102625
|
}
|
|
101804
102626
|
else {
|
|
101805
|
-
resolution.
|
|
101806
|
-
|
|
101807
|
-
if (ts.isExternalModuleNameRelative(name)) {
|
|
101808
|
-
watchFailedLookupLocationOfResolution(resolution);
|
|
101809
|
-
}
|
|
101810
|
-
else {
|
|
101811
|
-
nonRelativeExternalModuleResolutions.add(name, resolution);
|
|
101812
|
-
}
|
|
101813
|
-
var resolved = getResolutionWithResolvedFileName(resolution);
|
|
101814
|
-
if (resolved && resolved.resolvedFileName) {
|
|
101815
|
-
resolvedFileToResolution.add(resolutionHost.toPath(resolved.resolvedFileName), resolution);
|
|
101816
|
-
}
|
|
102627
|
+
resolution.watchedFailed = false;
|
|
102628
|
+
watchAffectingLocationsOfResolution(resolution);
|
|
101817
102629
|
}
|
|
101818
|
-
(resolution.files || (resolution.files = [])).push(filePath);
|
|
101819
102630
|
}
|
|
101820
102631
|
function watchFailedLookupLocationOfResolution(resolution) {
|
|
101821
|
-
|
|
101822
|
-
|
|
101823
|
-
if (!failedLookupLocations.length && !affectingLocations.length)
|
|
102632
|
+
var failedLookupLocations = resolution.failedLookupLocations;
|
|
102633
|
+
if (!failedLookupLocations.length || resolution.watchedFailed === failedLookupLocations.length)
|
|
101824
102634
|
return;
|
|
101825
|
-
if (
|
|
102635
|
+
if (!resolution.watchedFailed) {
|
|
101826
102636
|
resolutionsWithFailedLookups.push(resolution);
|
|
101827
|
-
|
|
101828
|
-
|
|
101829
|
-
|
|
102637
|
+
if (resolution.watchedAffected)
|
|
102638
|
+
ts.unorderedRemoveItem(resolutionsWithOnlyAffectingLocations, resolution);
|
|
102639
|
+
}
|
|
102640
|
+
var setAtRoot = !!resolution.setAtRoot;
|
|
102641
|
+
for (var i = resolution.watchedFailed || 0; i < failedLookupLocations.length; i++) {
|
|
102642
|
+
var failedLookupLocation = failedLookupLocations[i];
|
|
101830
102643
|
var failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
|
|
101831
102644
|
var toWatch = getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath);
|
|
101832
102645
|
if (toWatch) {
|
|
@@ -101844,22 +102657,22 @@ var ts;
|
|
|
101844
102657
|
}
|
|
101845
102658
|
}
|
|
101846
102659
|
}
|
|
101847
|
-
if (setAtRoot) {
|
|
102660
|
+
if (setAtRoot && !resolution.setAtRoot) {
|
|
101848
102661
|
setDirectoryWatcher(rootDir, rootPath, true);
|
|
101849
102662
|
}
|
|
101850
|
-
|
|
102663
|
+
resolution.setAtRoot = setAtRoot;
|
|
102664
|
+
resolution.watchedFailed = failedLookupLocations.length;
|
|
101851
102665
|
}
|
|
101852
|
-
function watchAffectingLocationsOfResolution(resolution
|
|
101853
|
-
ts.Debug.assert(!!resolution.refCount);
|
|
102666
|
+
function watchAffectingLocationsOfResolution(resolution) {
|
|
101854
102667
|
var affectingLocations = resolution.affectingLocations;
|
|
101855
|
-
if (!affectingLocations.length)
|
|
102668
|
+
if (!(affectingLocations === null || affectingLocations === void 0 ? void 0 : affectingLocations.length) || resolution.watchedAffected === affectingLocations.length)
|
|
101856
102669
|
return;
|
|
101857
|
-
if (
|
|
102670
|
+
if (!resolution.watchedFailed && !resolution.watchedAffected)
|
|
101858
102671
|
resolutionsWithOnlyAffectingLocations.push(resolution);
|
|
101859
|
-
for (var
|
|
101860
|
-
|
|
101861
|
-
createFileWatcherOfAffectingLocation(affectingLocation);
|
|
102672
|
+
for (var i = resolution.watchedAffected || 0; i < affectingLocations.length; i++) {
|
|
102673
|
+
createFileWatcherOfAffectingLocation(affectingLocations[i]);
|
|
101862
102674
|
}
|
|
102675
|
+
resolution.watchedAffected = affectingLocations.length;
|
|
101863
102676
|
}
|
|
101864
102677
|
function createFileWatcherOfAffectingLocation(affectingLocation) {
|
|
101865
102678
|
var path = resolutionHost.toPath(affectingLocation);
|
|
@@ -101900,15 +102713,6 @@ var ts;
|
|
|
101900
102713
|
paths.add(path);
|
|
101901
102714
|
}
|
|
101902
102715
|
}
|
|
101903
|
-
function watchFailedLookupLocationOfNonRelativeModuleResolutions(resolutions, name) {
|
|
101904
|
-
var program = resolutionHost.getCurrentProgram();
|
|
101905
|
-
if (!program || !program.getTypeChecker().tryFindAmbientModuleWithoutAugmentations(name)) {
|
|
101906
|
-
resolutions.forEach(watchFailedLookupLocationOfResolution);
|
|
101907
|
-
}
|
|
101908
|
-
else {
|
|
101909
|
-
resolutions.forEach(function (resolution) { return watchAffectingLocationsOfResolution(resolution, true); });
|
|
101910
|
-
}
|
|
101911
|
-
}
|
|
101912
102716
|
function setDirectoryWatcher(dir, dirPath, nonRecursive) {
|
|
101913
102717
|
var dirWatcher = directoryWatchesOfFailedLookups.get(dirPath);
|
|
101914
102718
|
if (dirWatcher) {
|
|
@@ -101919,21 +102723,27 @@ var ts;
|
|
|
101919
102723
|
directoryWatchesOfFailedLookups.set(dirPath, { watcher: createDirectoryWatcher(dir, dirPath, nonRecursive), refCount: 1, nonRecursive: nonRecursive });
|
|
101920
102724
|
}
|
|
101921
102725
|
}
|
|
101922
|
-
function
|
|
101923
|
-
|
|
101924
|
-
resolution.
|
|
101925
|
-
if (resolution.
|
|
102726
|
+
function stopWatchingResolution(resolution, filePath, getResolutionWithResolvedFileName) {
|
|
102727
|
+
var _a, _b;
|
|
102728
|
+
(_a = resolution.files) === null || _a === void 0 ? void 0 : _a.delete(filePath);
|
|
102729
|
+
if (!((_b = resolution.files) === null || _b === void 0 ? void 0 : _b.size))
|
|
102730
|
+
(resolutionsToCloseWatcherOn !== null && resolutionsToCloseWatcherOn !== void 0 ? resolutionsToCloseWatcherOn : (resolutionsToCloseWatcherOn = [])).push({ resolution: resolution, getResolved: getResolutionWithResolvedFileName });
|
|
102731
|
+
}
|
|
102732
|
+
function closeWatchersOfResolution(_a) {
|
|
102733
|
+
var _b;
|
|
102734
|
+
var resolution = _a.resolution, getResolved = _a.getResolved;
|
|
102735
|
+
if (((_b = resolution.files) === null || _b === void 0 ? void 0 : _b.size) || !resolution.files)
|
|
101926
102736
|
return;
|
|
101927
|
-
|
|
101928
|
-
var resolved =
|
|
102737
|
+
resolution.files = undefined;
|
|
102738
|
+
var resolved = getResolved(resolution);
|
|
101929
102739
|
if (resolved && resolved.resolvedFileName) {
|
|
101930
102740
|
resolvedFileToResolution.remove(resolutionHost.toPath(resolved.resolvedFileName), resolution);
|
|
101931
102741
|
}
|
|
101932
|
-
|
|
101933
|
-
|
|
102742
|
+
if (resolution.watchedFailed) {
|
|
102743
|
+
ts.unorderedRemoveItem(resolutionsWithFailedLookups, resolution);
|
|
101934
102744
|
var removeAtRoot = false;
|
|
101935
|
-
for (var
|
|
101936
|
-
var failedLookupLocation =
|
|
102745
|
+
for (var i = 0; i < resolution.watchedFailed; i++) {
|
|
102746
|
+
var failedLookupLocation = resolution.failedLookupLocations[i];
|
|
101937
102747
|
var failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
|
|
101938
102748
|
var toWatch = getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath);
|
|
101939
102749
|
if (toWatch) {
|
|
@@ -101956,22 +102766,31 @@ var ts;
|
|
|
101956
102766
|
}
|
|
101957
102767
|
}
|
|
101958
102768
|
}
|
|
102769
|
+
ts.Debug.assert(resolution.setAtRoot === removeAtRoot);
|
|
101959
102770
|
if (removeAtRoot) {
|
|
101960
102771
|
removeDirectoryWatcher(rootPath);
|
|
101961
102772
|
}
|
|
101962
102773
|
}
|
|
101963
|
-
else if (
|
|
102774
|
+
else if (resolution.watchedAffected) {
|
|
101964
102775
|
ts.unorderedRemoveItem(resolutionsWithOnlyAffectingLocations, resolution);
|
|
101965
102776
|
}
|
|
101966
|
-
|
|
101967
|
-
var
|
|
101968
|
-
|
|
101969
|
-
|
|
102777
|
+
if (resolution.watchedAffected) {
|
|
102778
|
+
for (var i = 0; i < resolution.watchedAffected; i++) {
|
|
102779
|
+
var affectingLocation = resolution.affectingLocations[i];
|
|
102780
|
+
var path = resolutionHost.toPath(affectingLocation);
|
|
102781
|
+
var watcher = fileWatchesOfAffectingLocations.get(path);
|
|
102782
|
+
watcher.refCount--;
|
|
102783
|
+
closeAffectingFileWatcher(watcher, path);
|
|
102784
|
+
}
|
|
101970
102785
|
}
|
|
101971
102786
|
}
|
|
101972
102787
|
function removeDirectoryWatcher(dirPath) {
|
|
101973
102788
|
var dirWatcher = directoryWatchesOfFailedLookups.get(dirPath);
|
|
101974
102789
|
dirWatcher.refCount--;
|
|
102790
|
+
if (dirWatcher.refCount === 0) {
|
|
102791
|
+
directoryWatchesOfFailedLookups.delete(dirPath);
|
|
102792
|
+
dirWatcher.watcher.close();
|
|
102793
|
+
}
|
|
101975
102794
|
}
|
|
101976
102795
|
function createDirectoryWatcher(directory, dirPath, nonRecursive) {
|
|
101977
102796
|
return resolutionHost.watchDirectoryOfFailedLookupLocation(directory, function (fileOrDirectory) {
|
|
@@ -101985,26 +102804,16 @@ var ts;
|
|
|
101985
102804
|
function removeResolutionsOfFileFromCache(cache, filePath, getResolutionWithResolvedFileName) {
|
|
101986
102805
|
var resolutions = cache.get(filePath);
|
|
101987
102806
|
if (resolutions) {
|
|
101988
|
-
resolutions.forEach(function (resolution) { return
|
|
102807
|
+
resolutions.cache.forEach(function (resolution) { return stopWatchingResolution(resolution, filePath, getResolutionWithResolvedFileName); });
|
|
101989
102808
|
cache.delete(filePath);
|
|
101990
102809
|
}
|
|
101991
102810
|
}
|
|
101992
|
-
function removeResolutionsFromProjectReferenceRedirects(filePath) {
|
|
101993
|
-
if (!ts.fileExtensionIs(filePath, ".json"))
|
|
101994
|
-
return;
|
|
101995
|
-
var program = resolutionHost.getCurrentProgram();
|
|
101996
|
-
if (!program)
|
|
101997
|
-
return;
|
|
101998
|
-
var resolvedProjectReference = program.getResolvedProjectReferenceByPath(filePath);
|
|
101999
|
-
if (!resolvedProjectReference)
|
|
102000
|
-
return;
|
|
102001
|
-
resolvedProjectReference.commandLine.fileNames.forEach(function (f) { return removeResolutionsOfFile(resolutionHost.toPath(f)); });
|
|
102002
|
-
}
|
|
102003
102811
|
function removeResolutionsOfFile(filePath) {
|
|
102004
102812
|
removeResolutionsOfFileFromCache(resolvedModuleNames, filePath, getResolvedModule);
|
|
102005
102813
|
removeResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath, getResolvedTypeReferenceDirective);
|
|
102006
102814
|
}
|
|
102007
102815
|
function invalidateResolutions(resolutions, canInvalidate) {
|
|
102816
|
+
var _a;
|
|
102008
102817
|
if (!resolutions)
|
|
102009
102818
|
return false;
|
|
102010
102819
|
var invalidated = false;
|
|
@@ -102013,16 +102822,14 @@ var ts;
|
|
|
102013
102822
|
if (resolution.isInvalidated || !canInvalidate(resolution))
|
|
102014
102823
|
continue;
|
|
102015
102824
|
resolution.isInvalidated = invalidated = true;
|
|
102016
|
-
|
|
102017
|
-
var containingFilePath = _b[_a];
|
|
102825
|
+
(_a = resolution.files) === null || _a === void 0 ? void 0 : _a.forEach(function (containingFilePath) {
|
|
102018
102826
|
(filesWithInvalidatedResolutions || (filesWithInvalidatedResolutions = new ts.Set())).add(containingFilePath);
|
|
102019
102827
|
hasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames || ts.endsWith(containingFilePath, ts.inferredTypesContainingFile);
|
|
102020
|
-
}
|
|
102828
|
+
});
|
|
102021
102829
|
}
|
|
102022
102830
|
return invalidated;
|
|
102023
102831
|
}
|
|
102024
102832
|
function invalidateResolutionOfFile(filePath) {
|
|
102025
|
-
removeResolutionsOfFile(filePath);
|
|
102026
102833
|
var prevHasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames;
|
|
102027
102834
|
if (invalidateResolutions(resolvedFileToResolution.get(filePath), ts.returnTrue) &&
|
|
102028
102835
|
hasChangedAutomaticTypeDirectiveNames &&
|
|
@@ -102031,8 +102838,28 @@ var ts;
|
|
|
102031
102838
|
}
|
|
102032
102839
|
}
|
|
102033
102840
|
function setFilesWithInvalidatedNonRelativeUnresolvedImports(filesMap) {
|
|
102034
|
-
|
|
102035
|
-
|
|
102841
|
+
filesMap.forEach(function (_a, filePath) {
|
|
102842
|
+
var imports = _a.imports;
|
|
102843
|
+
if (!imports.length)
|
|
102844
|
+
return;
|
|
102845
|
+
var resolvedModules = resolvedModuleNames.get(filePath);
|
|
102846
|
+
var resolvedTypeRefs = resolvedTypeReferenceDirectives.get(filePath);
|
|
102847
|
+
if (!(resolvedModules === null || resolvedModules === void 0 ? void 0 : resolvedModules.cache.size()) && !(resolvedTypeRefs === null || resolvedTypeRefs === void 0 ? void 0 : resolvedTypeRefs.cache.size()))
|
|
102848
|
+
return;
|
|
102849
|
+
imports.forEach(function (_a) {
|
|
102850
|
+
var name = _a.name, mode = _a.mode;
|
|
102851
|
+
var resolvedModule = resolvedModules === null || resolvedModules === void 0 ? void 0 : resolvedModules.cache.get(name, mode);
|
|
102852
|
+
if (resolvedModule && !resolvedModule.isInvalidated && (!resolvedModule.resolvedModule || !ts.resolutionExtensionIsTSOrJson(resolvedModule.resolvedModule.extension))) {
|
|
102853
|
+
resolvedModule.isInvalidated = true;
|
|
102854
|
+
(filesWithInvalidatedResolutions !== null && filesWithInvalidatedResolutions !== void 0 ? filesWithInvalidatedResolutions : (filesWithInvalidatedResolutions = new ts.Set())).add(filePath);
|
|
102855
|
+
}
|
|
102856
|
+
var resolvedTypeRef = resolvedTypeRefs === null || resolvedTypeRefs === void 0 ? void 0 : resolvedTypeRefs.cache.get(name, mode);
|
|
102857
|
+
if (resolvedTypeRef && !resolvedTypeRef.isInvalidated && !resolvedTypeRef.resolvedTypeReferenceDirective) {
|
|
102858
|
+
resolvedTypeRef.isInvalidated = true;
|
|
102859
|
+
(filesWithInvalidatedResolutions !== null && filesWithInvalidatedResolutions !== void 0 ? filesWithInvalidatedResolutions : (filesWithInvalidatedResolutions = new ts.Set())).add(filePath);
|
|
102860
|
+
}
|
|
102861
|
+
});
|
|
102862
|
+
});
|
|
102036
102863
|
}
|
|
102037
102864
|
function scheduleInvalidateResolutionOfFailedLookupLocation(fileOrDirectoryPath, isCreatingWatchedDirectory) {
|
|
102038
102865
|
if (isCreatingWatchedDirectory) {
|
|
@@ -102092,9 +102919,10 @@ var ts;
|
|
|
102092
102919
|
});
|
|
102093
102920
|
}
|
|
102094
102921
|
function canInvalidatedFailedLookupResolutionWithAffectingLocation(resolution) {
|
|
102095
|
-
|
|
102922
|
+
var _a;
|
|
102923
|
+
return !!affectingPathChecks && !!((_a = resolution.affectingLocations) === null || _a === void 0 ? void 0 : _a.some(function (location) {
|
|
102096
102924
|
return affectingPathChecks.has(resolutionHost.toPath(location));
|
|
102097
|
-
});
|
|
102925
|
+
}));
|
|
102098
102926
|
}
|
|
102099
102927
|
function closeTypeRootsWatch() {
|
|
102100
102928
|
ts.clearMap(typeRootsWatches, ts.closeFileWatcher);
|
|
@@ -102396,9 +103224,9 @@ var ts;
|
|
|
102396
103224
|
var targets = importedFileNames.map(function (f) { return ts.getNormalizedAbsolutePath(f, cwd); });
|
|
102397
103225
|
var shouldFilterIgnoredPaths = !ts.every(targets, ts.containsIgnoredPath);
|
|
102398
103226
|
if (!preferSymlinks) {
|
|
102399
|
-
var
|
|
102400
|
-
if (
|
|
102401
|
-
return
|
|
103227
|
+
var result_17 = ts.forEach(targets, function (p) { return !(shouldFilterIgnoredPaths && ts.containsIgnoredPath(p)) && cb(p, referenceRedirect === p); });
|
|
103228
|
+
if (result_17)
|
|
103229
|
+
return result_17;
|
|
102402
103230
|
}
|
|
102403
103231
|
var symlinkedDirectories = (_a = host.getSymlinkCache) === null || _a === void 0 ? void 0 : _a.call(host).getSymlinkedDirectoriesByRealpath();
|
|
102404
103232
|
var fullImportedFileName = ts.getNormalizedAbsolutePath(importedFileName, cwd);
|
|
@@ -102417,10 +103245,10 @@ var ts;
|
|
|
102417
103245
|
for (var _i = 0, symlinkDirectories_1 = symlinkDirectories; _i < symlinkDirectories_1.length; _i++) {
|
|
102418
103246
|
var symlinkDirectory = symlinkDirectories_1[_i];
|
|
102419
103247
|
var option = ts.resolvePath(symlinkDirectory, relative);
|
|
102420
|
-
var
|
|
103248
|
+
var result_18 = cb(option, target === referenceRedirect);
|
|
102421
103249
|
shouldFilterIgnoredPaths = true;
|
|
102422
|
-
if (
|
|
102423
|
-
return
|
|
103250
|
+
if (result_18)
|
|
103251
|
+
return result_18;
|
|
102424
103252
|
}
|
|
102425
103253
|
});
|
|
102426
103254
|
});
|
|
@@ -102479,9 +103307,9 @@ var ts;
|
|
|
102479
103307
|
};
|
|
102480
103308
|
var out_directory_1;
|
|
102481
103309
|
for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) {
|
|
102482
|
-
var
|
|
103310
|
+
var state_12 = _loop_35(directory);
|
|
102483
103311
|
directory = out_directory_1;
|
|
102484
|
-
if (
|
|
103312
|
+
if (state_12 === "break")
|
|
102485
103313
|
break;
|
|
102486
103314
|
}
|
|
102487
103315
|
if (allFileNames.size) {
|
|
@@ -103361,7 +104189,7 @@ var ts;
|
|
|
103361
104189
|
})(ts || (ts = {}));
|
|
103362
104190
|
var ts;
|
|
103363
104191
|
(function (ts) {
|
|
103364
|
-
function
|
|
104192
|
+
function readBuildInfoForProgram(compilerOptions, host) {
|
|
103365
104193
|
var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(compilerOptions);
|
|
103366
104194
|
if (!buildInfoPath)
|
|
103367
104195
|
return undefined;
|
|
@@ -103381,7 +104209,12 @@ var ts;
|
|
|
103381
104209
|
return undefined;
|
|
103382
104210
|
if (!buildInfo.program)
|
|
103383
104211
|
return undefined;
|
|
103384
|
-
return
|
|
104212
|
+
return { buildInfo: buildInfo, buildInfoPath: buildInfoPath };
|
|
104213
|
+
}
|
|
104214
|
+
ts.readBuildInfoForProgram = readBuildInfoForProgram;
|
|
104215
|
+
function readBuilderProgram(compilerOptions, host) {
|
|
104216
|
+
var result = readBuildInfoForProgram(compilerOptions, host);
|
|
104217
|
+
return result && ts.createBuilderProgramUsingProgramBuildInfo(result.buildInfo.program, result.buildInfoPath, host, compilerOptions.configFilePath);
|
|
103385
104218
|
}
|
|
103386
104219
|
ts.readBuilderProgram = readBuilderProgram;
|
|
103387
104220
|
function createIncrementalCompilerHost(options, system) {
|
|
@@ -103514,7 +104347,7 @@ var ts;
|
|
|
103514
104347
|
}
|
|
103515
104348
|
return host.resolveModuleNames.apply(host, args);
|
|
103516
104349
|
}) :
|
|
103517
|
-
(function (moduleNames, containingFile,
|
|
104350
|
+
(function (moduleNames, containingFile, _reusedNames, redirectedReference, _options, sourceFile, partialResolutionInfo) { return resolutionCache.resolveModuleNames(moduleNames, containingFile, redirectedReference, sourceFile, partialResolutionInfo); });
|
|
103518
104351
|
compilerHost.resolveTypeReferenceDirectives = host.resolveTypeReferenceDirectives ?
|
|
103519
104352
|
(function () {
|
|
103520
104353
|
var args = [];
|
|
@@ -103523,7 +104356,13 @@ var ts;
|
|
|
103523
104356
|
}
|
|
103524
104357
|
return host.resolveTypeReferenceDirectives.apply(host, args);
|
|
103525
104358
|
}) :
|
|
103526
|
-
(function (typeDirectiveNames, containingFile, redirectedReference, _options, containingFileMode) { return resolutionCache.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference, containingFileMode); });
|
|
104359
|
+
(function (typeDirectiveNames, containingFile, redirectedReference, _options, containingFileMode, partialResolutionInfo) { return resolutionCache.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference, containingFileMode, partialResolutionInfo); });
|
|
104360
|
+
compilerHost.getModuleResolutionCache = host.resolveModuleNames ?
|
|
104361
|
+
ts.maybeBind(host, host.getModuleResolutionCache) :
|
|
104362
|
+
(function () { return resolutionCache.getModuleResolutionCache(); });
|
|
104363
|
+
compilerHost.getTypeReferenceDirectiveResolutionCache = host.resolveTypeReferenceDirectives ?
|
|
104364
|
+
ts.maybeBind(host, host.getTypeReferenceDirectiveResolutionCache) :
|
|
104365
|
+
(function () { return resolutionCache.getTypeReferenceDirectiveResolutionCache(); });
|
|
103527
104366
|
var userProvidedResolution = !!host.resolveModuleNames || !!host.resolveTypeReferenceDirectives;
|
|
103528
104367
|
builderProgram = readBuilderProgram(compilerOptions, compilerHost);
|
|
103529
104368
|
synchronizeProgram();
|
|
@@ -103589,7 +104428,8 @@ var ts;
|
|
|
103589
104428
|
}
|
|
103590
104429
|
}
|
|
103591
104430
|
var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution);
|
|
103592
|
-
|
|
104431
|
+
var _a = ts.changeCompilerHostLikeToUseCache(compilerHost, toPath), originalReadFile = _a.originalReadFile, originalFileExists = _a.originalFileExists, originalDirectoryExists = _a.originalDirectoryExists, originalCreateDirectory = _a.originalCreateDirectory, originalWriteFile = _a.originalWriteFile;
|
|
104432
|
+
if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
|
|
103593
104433
|
if (hasChangedConfigFileParsingErrors) {
|
|
103594
104434
|
if (reportFileChangeDetectedOnCreateProgram) {
|
|
103595
104435
|
reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation);
|
|
@@ -103608,6 +104448,11 @@ var ts;
|
|
|
103608
104448
|
if (host.afterProgramCreate && program !== builderProgram) {
|
|
103609
104449
|
host.afterProgramCreate(builderProgram);
|
|
103610
104450
|
}
|
|
104451
|
+
compilerHost.readFile = originalReadFile;
|
|
104452
|
+
compilerHost.fileExists = originalFileExists;
|
|
104453
|
+
compilerHost.directoryExists = originalDirectoryExists;
|
|
104454
|
+
compilerHost.createDirectory = originalCreateDirectory;
|
|
104455
|
+
compilerHost.writeFile = originalWriteFile;
|
|
103611
104456
|
return builderProgram;
|
|
103612
104457
|
}
|
|
103613
104458
|
function createNewProgram(hasInvalidatedResolution) {
|
|
@@ -103616,18 +104461,15 @@ var ts;
|
|
|
103616
104461
|
writeLog(" options: " + JSON.stringify(compilerOptions));
|
|
103617
104462
|
if (projectReferences)
|
|
103618
104463
|
writeLog(" projectReferences: " + JSON.stringify(projectReferences));
|
|
103619
|
-
var needsUpdateInTypeRootWatch = hasChangedCompilerOptions || !getCurrentProgram();
|
|
103620
104464
|
hasChangedCompilerOptions = false;
|
|
103621
104465
|
hasChangedConfigFileParsingErrors = false;
|
|
103622
104466
|
resolutionCache.startCachingPerDirectoryResolution();
|
|
103623
104467
|
compilerHost.hasInvalidatedResolution = hasInvalidatedResolution;
|
|
103624
104468
|
compilerHost.hasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames;
|
|
104469
|
+
var oldProgram = getCurrentProgram();
|
|
103625
104470
|
builderProgram = createProgram(rootFileNames, compilerOptions, compilerHost, builderProgram, configFileParsingDiagnostics, projectReferences);
|
|
103626
|
-
resolutionCache.finishCachingPerDirectoryResolution();
|
|
104471
|
+
resolutionCache.finishCachingPerDirectoryResolution(builderProgram.getProgram(), oldProgram);
|
|
103627
104472
|
ts.updateMissingFilePathsWatch(builderProgram.getProgram(), missingFilesMap || (missingFilesMap = new ts.Map()), watchMissingFilePath);
|
|
103628
|
-
if (needsUpdateInTypeRootWatch) {
|
|
103629
|
-
resolutionCache.updateTypeRootsWatch();
|
|
103630
|
-
}
|
|
103631
104473
|
if (missingFilePathsRequestedForRelease) {
|
|
103632
104474
|
for (var _i = 0, missingFilePathsRequestedForRelease_1 = missingFilePathsRequestedForRelease; _i < missingFilePathsRequestedForRelease_1.length; _i++) {
|
|
103633
104475
|
var missingFilePath = missingFilePathsRequestedForRelease_1[_i];
|
|
@@ -103693,9 +104535,6 @@ var ts;
|
|
|
103693
104535
|
sourceFilesCache.set(path, false);
|
|
103694
104536
|
}
|
|
103695
104537
|
}
|
|
103696
|
-
if (sourceFile) {
|
|
103697
|
-
sourceFile.impliedNodeFormat = ts.getImpliedNodeFormatForFile(path, resolutionCache.getModuleResolutionCache().getPackageJsonInfoCache(), compilerHost, compilerHost.getCompilationSettings());
|
|
103698
|
-
}
|
|
103699
104538
|
return sourceFile;
|
|
103700
104539
|
}
|
|
103701
104540
|
return hostSourceFile.sourceFile;
|
|
@@ -103715,7 +104554,7 @@ var ts;
|
|
|
103715
104554
|
var hostSourceFile = sourceFilesCache.get(path);
|
|
103716
104555
|
return !hostSourceFile || !hostSourceFile.version ? undefined : hostSourceFile.version;
|
|
103717
104556
|
}
|
|
103718
|
-
function onReleaseOldSourceFile(oldSourceFile
|
|
104557
|
+
function onReleaseOldSourceFile(oldSourceFile) {
|
|
103719
104558
|
var hostSourceFileInfo = sourceFilesCache.get(oldSourceFile.resolvedPath);
|
|
103720
104559
|
if (hostSourceFileInfo !== undefined) {
|
|
103721
104560
|
if (isFileMissingOnHost(hostSourceFileInfo)) {
|
|
@@ -103726,9 +104565,6 @@ var ts;
|
|
|
103726
104565
|
hostSourceFileInfo.fileWatcher.close();
|
|
103727
104566
|
}
|
|
103728
104567
|
sourceFilesCache.delete(oldSourceFile.resolvedPath);
|
|
103729
|
-
if (!hasSourceFileByPath) {
|
|
103730
|
-
resolutionCache.removeResolutionsOfFile(oldSourceFile.path);
|
|
103731
|
-
}
|
|
103732
104568
|
}
|
|
103733
104569
|
}
|
|
103734
104570
|
}
|
|
@@ -103963,7 +104799,6 @@ var ts;
|
|
|
103963
104799
|
var config = parsedConfigs === null || parsedConfigs === void 0 ? void 0 : parsedConfigs.get(projectPath);
|
|
103964
104800
|
if (config)
|
|
103965
104801
|
config.reloadLevel = ts.ConfigFileProgramReloadLevel.Full;
|
|
103966
|
-
resolutionCache.removeResolutionsFromProjectReferenceRedirects(projectPath);
|
|
103967
104802
|
}
|
|
103968
104803
|
scheduleProgramUpdate();
|
|
103969
104804
|
});
|
|
@@ -103976,7 +104811,6 @@ var ts;
|
|
|
103976
104811
|
var config = parsedConfigs === null || parsedConfigs === void 0 ? void 0 : parsedConfigs.get(configPath);
|
|
103977
104812
|
if (config)
|
|
103978
104813
|
config.reloadLevel = ts.ConfigFileProgramReloadLevel.Full;
|
|
103979
|
-
resolutionCache.removeResolutionsFromProjectReferenceRedirects(configPath);
|
|
103980
104814
|
scheduleProgramUpdate();
|
|
103981
104815
|
}, ts.PollingInterval.High, ((_a = commandLine.parsedCommandLine) === null || _a === void 0 ? void 0 : _a.watchOptions) || watchOptions, ts.WatchType.ConfigFileOfReferencedProject));
|
|
103982
104816
|
if ((_b = commandLine.parsedCommandLine) === null || _b === void 0 ? void 0 : _b.wildcardDirectories) {
|
|
@@ -104148,20 +104982,23 @@ var ts;
|
|
|
104148
104982
|
compilerHost.getParsedCommandLine = function (fileName) { return parseConfigFile(state, fileName, toResolvedConfigFilePath(state, fileName)); };
|
|
104149
104983
|
compilerHost.resolveModuleNames = ts.maybeBind(host, host.resolveModuleNames);
|
|
104150
104984
|
compilerHost.resolveTypeReferenceDirectives = ts.maybeBind(host, host.resolveTypeReferenceDirectives);
|
|
104985
|
+
compilerHost.getModuleResolutionCache = ts.maybeBind(host, host.getModuleResolutionCache);
|
|
104986
|
+
compilerHost.getTypeReferenceDirectiveResolutionCache = ts.maybeBind(host, host.getTypeReferenceDirectiveResolutionCache);
|
|
104151
104987
|
var moduleResolutionCache = !compilerHost.resolveModuleNames ? ts.createModuleResolutionCache(currentDirectory, getCanonicalFileName) : undefined;
|
|
104152
104988
|
var typeReferenceDirectiveResolutionCache = !compilerHost.resolveTypeReferenceDirectives ? ts.createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, undefined, moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache()) : undefined;
|
|
104153
104989
|
if (!compilerHost.resolveModuleNames) {
|
|
104154
|
-
var loader_3 = function (moduleName, resolverMode, containingFile, redirectedReference) { return ts.resolveModuleName(moduleName, containingFile, state.projectCompilerOptions, compilerHost, moduleResolutionCache, redirectedReference, resolverMode)
|
|
104155
|
-
compilerHost.resolveModuleNames = function (moduleNames, containingFile, _reusedNames, redirectedReference, _options, containingSourceFile) {
|
|
104156
|
-
return ts.loadWithModeAwareCache(
|
|
104990
|
+
var loader_3 = function (moduleName, resolverMode, containingFile, redirectedReference) { return ts.resolveModuleName(moduleName, containingFile, state.projectCompilerOptions, compilerHost, moduleResolutionCache, redirectedReference, resolverMode); };
|
|
104991
|
+
compilerHost.resolveModuleNames = function (moduleNames, containingFile, _reusedNames, redirectedReference, _options, containingSourceFile, partialResolutionInfo) {
|
|
104992
|
+
return ts.loadWithModeAwareCache(moduleNames, ts.Debug.checkDefined(containingSourceFile), containingFile, redirectedReference, partialResolutionInfo, loader_3);
|
|
104157
104993
|
};
|
|
104158
104994
|
compilerHost.getModuleResolutionCache = function () { return moduleResolutionCache; };
|
|
104159
104995
|
}
|
|
104160
104996
|
if (!compilerHost.resolveTypeReferenceDirectives) {
|
|
104161
|
-
var loader_4 = function (moduleName, containingFile, redirectedReference, containingFileMode) { return ts.resolveTypeReferenceDirective(moduleName, containingFile, state.projectCompilerOptions, compilerHost, redirectedReference, state.typeReferenceDirectiveResolutionCache, containingFileMode)
|
|
104997
|
+
var loader_4 = function (moduleName, containingFile, redirectedReference, containingFileMode) { return ts.resolveTypeReferenceDirective(moduleName, containingFile, state.projectCompilerOptions, compilerHost, redirectedReference, state.typeReferenceDirectiveResolutionCache, containingFileMode); };
|
|
104162
104998
|
compilerHost.resolveTypeReferenceDirectives = function (typeReferenceDirectiveNames, containingFile, redirectedReference, _options, containingFileMode) {
|
|
104163
|
-
return ts.loadWithTypeDirectiveCache(
|
|
104999
|
+
return ts.loadWithTypeDirectiveCache(typeReferenceDirectiveNames, containingFile, redirectedReference, containingFileMode, loader_4);
|
|
104164
105000
|
};
|
|
105001
|
+
compilerHost.getTypeReferenceDirectiveResolutionCache = function () { return typeReferenceDirectiveResolutionCache; };
|
|
104165
105002
|
}
|
|
104166
105003
|
compilerHost.getBuildInfo = function (fileName, configFilePath) { return getBuildInfo(state, fileName, toResolvedConfigFilePath(state, configFilePath), undefined); };
|
|
104167
105004
|
var _a = ts.createWatchFactory(hostWithWatch, options), watchFile = _a.watchFile, watchDirectory = _a.watchDirectory, writeLog = _a.writeLog;
|
|
@@ -105105,7 +105942,7 @@ var ts;
|
|
|
105105
105942
|
if (buildInfoTime && buildInfoTime < inputTime) {
|
|
105106
105943
|
var version_3 = void 0;
|
|
105107
105944
|
var currentVersion = void 0;
|
|
105108
|
-
if (buildInfoProgram) {
|
|
105945
|
+
if (buildInfoProgram === null || buildInfoProgram === void 0 ? void 0 : buildInfoProgram.fileInfos) {
|
|
105109
105946
|
if (!buildInfoVersionMap)
|
|
105110
105947
|
buildInfoVersionMap = ts.getBuildInfoFileVersionMap(buildInfoProgram, buildInfoPath, host);
|
|
105111
105948
|
version_3 = buildInfoVersionMap.get(toPath(state, inputFile));
|