typescript 5.6.0-dev.20240625 → 5.6.0-dev.20240627
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/tsc.js +154 -164
- package/lib/tsserver.js +31 -17
- package/lib/typescript.d.ts +14 -14
- package/lib/typescript.js +259 -290
- package/lib/typingsInstaller.js +2 -2
- package/package.json +15 -14
package/lib/tsc.js
CHANGED
|
@@ -18,7 +18,7 @@ and limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
20
|
var versionMajorMinor = "5.6";
|
|
21
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20240627`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -5924,7 +5924,7 @@ var Diagnostics = {
|
|
|
5924
5924
|
Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: diag(1321, 1 /* Error */, "Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_cal_1321", "Type of 'yield' operand in an async generator must either be a valid promise or must not contain a callable 'then' member."),
|
|
5925
5925
|
Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: diag(1322, 1 /* Error */, "Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_con_1322", "Type of iterated elements of a 'yield*' operand must either be a valid promise or must not contain a callable 'then' member."),
|
|
5926
5926
|
Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd_system_umd_node16_or_nodenext: diag(1323, 1 /* Error */, "Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd__1323", "Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'."),
|
|
5927
|
-
|
|
5927
|
+
Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_nodenext_or_preserve: diag(1324, 1 /* Error */, "Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_nodene_1324", "Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'nodenext', or 'preserve'."),
|
|
5928
5928
|
Argument_of_dynamic_import_cannot_be_spread_element: diag(1325, 1 /* Error */, "Argument_of_dynamic_import_cannot_be_spread_element_1325", "Argument of dynamic import cannot be spread element."),
|
|
5929
5929
|
This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot_have_type_arguments: diag(1326, 1 /* Error */, "This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot__1326", "This use of 'import' is invalid. 'import()' calls can be written, but they must have parentheses and cannot have type arguments."),
|
|
5930
5930
|
String_literal_with_double_quotes_expected: diag(1327, 1 /* Error */, "String_literal_with_double_quotes_expected_1327", "String literal with double quotes expected."),
|
|
@@ -12544,6 +12544,12 @@ function projectReferenceIsEqualTo(oldRef, newRef) {
|
|
|
12544
12544
|
function moduleResolutionIsEqualTo(oldResolution, newResolution) {
|
|
12545
12545
|
return oldResolution === newResolution || oldResolution.resolvedModule === newResolution.resolvedModule || !!oldResolution.resolvedModule && !!newResolution.resolvedModule && oldResolution.resolvedModule.isExternalLibraryImport === newResolution.resolvedModule.isExternalLibraryImport && oldResolution.resolvedModule.extension === newResolution.resolvedModule.extension && oldResolution.resolvedModule.resolvedFileName === newResolution.resolvedModule.resolvedFileName && oldResolution.resolvedModule.originalPath === newResolution.resolvedModule.originalPath && packageIdIsEqual(oldResolution.resolvedModule.packageId, newResolution.resolvedModule.packageId) && oldResolution.alternateResult === newResolution.alternateResult;
|
|
12546
12546
|
}
|
|
12547
|
+
function getResolvedModuleFromResolution(resolution) {
|
|
12548
|
+
return resolution.resolvedModule;
|
|
12549
|
+
}
|
|
12550
|
+
function getResolvedTypeReferenceDirectiveFromResolution(resolution) {
|
|
12551
|
+
return resolution.resolvedTypeReferenceDirective;
|
|
12552
|
+
}
|
|
12547
12553
|
function createModuleNotFoundChain(sourceFile, host, moduleReference, mode, packageName) {
|
|
12548
12554
|
var _a;
|
|
12549
12555
|
const alternateResult = (_a = host.getResolvedModule(sourceFile, moduleReference, mode)) == null ? void 0 : _a.alternateResult;
|
|
@@ -25642,17 +25648,22 @@ var disposeResourcesHelper = {
|
|
|
25642
25648
|
env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
|
|
25643
25649
|
env.hasError = true;
|
|
25644
25650
|
}
|
|
25651
|
+
var r, s = 0;
|
|
25645
25652
|
function next() {
|
|
25646
|
-
while (env.stack.
|
|
25647
|
-
var rec = env.stack.pop();
|
|
25653
|
+
while (r = env.stack.pop()) {
|
|
25648
25654
|
try {
|
|
25649
|
-
|
|
25650
|
-
if (
|
|
25655
|
+
if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
|
|
25656
|
+
if (r.dispose) {
|
|
25657
|
+
var result = r.dispose.call(r.value);
|
|
25658
|
+
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
|
|
25659
|
+
}
|
|
25660
|
+
else s |= 1;
|
|
25651
25661
|
}
|
|
25652
25662
|
catch (e) {
|
|
25653
25663
|
fail(e);
|
|
25654
25664
|
}
|
|
25655
25665
|
}
|
|
25666
|
+
if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
|
|
25656
25667
|
if (env.hasError) throw env.error;
|
|
25657
25668
|
}
|
|
25658
25669
|
return next();
|
|
@@ -86889,6 +86900,7 @@ function createTypeChecker(host) {
|
|
|
86889
86900
|
}
|
|
86890
86901
|
case 7 /* ES2022 */:
|
|
86891
86902
|
case 99 /* ESNext */:
|
|
86903
|
+
case 200 /* Preserve */:
|
|
86892
86904
|
case 4 /* System */:
|
|
86893
86905
|
if (languageVersion >= 4 /* ES2017 */) {
|
|
86894
86906
|
break;
|
|
@@ -87504,11 +87516,11 @@ function createTypeChecker(host) {
|
|
|
87504
87516
|
return grammarErrorOnNode(node, Diagnostics.This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot_have_type_arguments);
|
|
87505
87517
|
}
|
|
87506
87518
|
const nodeArguments = node.arguments;
|
|
87507
|
-
if (moduleKind !== 99 /* ESNext */ && moduleKind !== 199 /* NodeNext */ && moduleKind !== 100 /* Node16 */) {
|
|
87519
|
+
if (moduleKind !== 99 /* ESNext */ && moduleKind !== 199 /* NodeNext */ && moduleKind !== 100 /* Node16 */ && moduleKind !== 200 /* Preserve */) {
|
|
87508
87520
|
checkGrammarForDisallowedTrailingComma(nodeArguments);
|
|
87509
87521
|
if (nodeArguments.length > 1) {
|
|
87510
87522
|
const importAttributesArgument = nodeArguments[1];
|
|
87511
|
-
return grammarErrorOnNode(importAttributesArgument, Diagnostics.
|
|
87523
|
+
return grammarErrorOnNode(importAttributesArgument, Diagnostics.Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_nodenext_or_preserve);
|
|
87512
87524
|
}
|
|
87513
87525
|
}
|
|
87514
87526
|
if (nodeArguments.length === 0 || nodeArguments.length > 2) {
|
|
@@ -119669,12 +119681,18 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119669
119681
|
}
|
|
119670
119682
|
function resolveModuleNamesWorker(moduleNames, containingFile, reusedNames) {
|
|
119671
119683
|
var _a2, _b2;
|
|
119672
|
-
if (!moduleNames.length) return emptyArray;
|
|
119673
119684
|
const containingFileName = getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory);
|
|
119674
119685
|
const redirectedReference = getRedirectReferenceForResolution(containingFile);
|
|
119675
119686
|
(_a2 = tracing) == null ? void 0 : _a2.push(tracing.Phase.Program, "resolveModuleNamesWorker", { containingFileName });
|
|
119676
119687
|
mark("beforeResolveModule");
|
|
119677
|
-
const result = actualResolveModuleNamesWorker(
|
|
119688
|
+
const result = actualResolveModuleNamesWorker(
|
|
119689
|
+
moduleNames,
|
|
119690
|
+
containingFileName,
|
|
119691
|
+
redirectedReference,
|
|
119692
|
+
options,
|
|
119693
|
+
containingFile,
|
|
119694
|
+
reusedNames
|
|
119695
|
+
);
|
|
119678
119696
|
mark("afterResolveModule");
|
|
119679
119697
|
measure("ResolveModule", "beforeResolveModule", "afterResolveModule");
|
|
119680
119698
|
(_b2 = tracing) == null ? void 0 : _b2.pop();
|
|
@@ -119682,13 +119700,19 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119682
119700
|
}
|
|
119683
119701
|
function resolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFile, reusedNames) {
|
|
119684
119702
|
var _a2, _b2;
|
|
119685
|
-
if (!typeDirectiveNames.length) return [];
|
|
119686
119703
|
const containingSourceFile = !isString(containingFile) ? containingFile : void 0;
|
|
119687
119704
|
const containingFileName = !isString(containingFile) ? getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory) : containingFile;
|
|
119688
119705
|
const redirectedReference = containingSourceFile && getRedirectReferenceForResolution(containingSourceFile);
|
|
119689
119706
|
(_a2 = tracing) == null ? void 0 : _a2.push(tracing.Phase.Program, "resolveTypeReferenceDirectiveNamesWorker", { containingFileName });
|
|
119690
119707
|
mark("beforeResolveTypeReference");
|
|
119691
|
-
const result = actualResolveTypeReferenceDirectiveNamesWorker(
|
|
119708
|
+
const result = actualResolveTypeReferenceDirectiveNamesWorker(
|
|
119709
|
+
typeDirectiveNames,
|
|
119710
|
+
containingFileName,
|
|
119711
|
+
redirectedReference,
|
|
119712
|
+
options,
|
|
119713
|
+
containingSourceFile,
|
|
119714
|
+
reusedNames
|
|
119715
|
+
);
|
|
119692
119716
|
mark("afterResolveTypeReference");
|
|
119693
119717
|
measure("ResolveTypeReference", "beforeResolveTypeReference", "afterResolveTypeReference");
|
|
119694
119718
|
(_b2 = tracing) == null ? void 0 : _b2.pop();
|
|
@@ -119758,144 +119782,123 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119758
119782
|
}
|
|
119759
119783
|
return classifiableNames;
|
|
119760
119784
|
}
|
|
119761
|
-
function resolveModuleNamesReusingOldState(moduleNames,
|
|
119762
|
-
|
|
119763
|
-
|
|
119764
|
-
|
|
119765
|
-
|
|
119766
|
-
|
|
119767
|
-
|
|
119768
|
-
|
|
119769
|
-
|
|
119770
|
-
|
|
119771
|
-
|
|
119772
|
-
|
|
119773
|
-
|
|
119774
|
-
|
|
119775
|
-
|
|
119776
|
-
|
|
119777
|
-
if (
|
|
119778
|
-
|
|
119779
|
-
if (oldResolution == null ? void 0 : oldResolution.resolvedModule) {
|
|
119780
|
-
if (isTraceEnabled(options, host)) {
|
|
119781
|
-
trace(
|
|
119782
|
-
host,
|
|
119783
|
-
oldResolution.resolvedModule.packageId ? Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 : Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2,
|
|
119784
|
-
moduleName.text,
|
|
119785
|
-
getNormalizedAbsolutePath(file.originalFileName, currentDirectory),
|
|
119786
|
-
oldResolution.resolvedModule.resolvedFileName,
|
|
119787
|
-
oldResolution.resolvedModule.packageId && packageIdToString(oldResolution.resolvedModule.packageId)
|
|
119788
|
-
);
|
|
119789
|
-
}
|
|
119790
|
-
(result ?? (result = new Array(moduleNames.length)))[i] = oldResolution;
|
|
119791
|
-
(reusedNames ?? (reusedNames = [])).push(moduleName);
|
|
119792
|
-
continue;
|
|
119793
|
-
}
|
|
119794
|
-
}
|
|
119795
|
-
let resolvesToAmbientModuleInNonModifiedFile = false;
|
|
119796
|
-
if (contains(file.ambientModuleNames, moduleName.text)) {
|
|
119797
|
-
resolvesToAmbientModuleInNonModifiedFile = true;
|
|
119798
|
-
if (isTraceEnabled(options, host)) {
|
|
119799
|
-
trace(host, Diagnostics.Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1, moduleName.text, getNormalizedAbsolutePath(file.originalFileName, currentDirectory));
|
|
119800
|
-
}
|
|
119801
|
-
} else {
|
|
119802
|
-
resolvesToAmbientModuleInNonModifiedFile = moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName);
|
|
119803
|
-
}
|
|
119804
|
-
if (resolvesToAmbientModuleInNonModifiedFile) {
|
|
119805
|
-
(result || (result = new Array(moduleNames.length)))[i] = predictedToResolveToAmbientModuleMarker;
|
|
119806
|
-
} else {
|
|
119807
|
-
(unknownModuleNames ?? (unknownModuleNames = [])).push(moduleName);
|
|
119785
|
+
function resolveModuleNamesReusingOldState(moduleNames, containingFile) {
|
|
119786
|
+
return resolveNamesReusingOldState({
|
|
119787
|
+
entries: moduleNames,
|
|
119788
|
+
containingFile,
|
|
119789
|
+
containingSourceFile: containingFile,
|
|
119790
|
+
redirectedReference: getRedirectReferenceForResolution(containingFile),
|
|
119791
|
+
nameAndModeGetter: moduleResolutionNameAndModeGetter,
|
|
119792
|
+
resolutionWorker: resolveModuleNamesWorker,
|
|
119793
|
+
getResolutionFromOldProgram: (name, mode) => oldProgram == null ? void 0 : oldProgram.getResolvedModule(containingFile, name, mode),
|
|
119794
|
+
getResolved: getResolvedModuleFromResolution,
|
|
119795
|
+
canReuseResolutionsInFile: () => containingFile === (oldProgram == null ? void 0 : oldProgram.getSourceFile(containingFile.fileName)) && !hasInvalidatedResolutions(containingFile.path),
|
|
119796
|
+
isEntryResolvingToAmbientModule: moduleNameResolvesToAmbientModule
|
|
119797
|
+
});
|
|
119798
|
+
}
|
|
119799
|
+
function moduleNameResolvesToAmbientModule(moduleName, file) {
|
|
119800
|
+
if (contains(file.ambientModuleNames, moduleName.text)) {
|
|
119801
|
+
if (isTraceEnabled(options, host)) {
|
|
119802
|
+
trace(host, Diagnostics.Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1, moduleName.text, getNormalizedAbsolutePath(file.originalFileName, currentDirectory));
|
|
119808
119803
|
}
|
|
119804
|
+
return true;
|
|
119805
|
+
} else {
|
|
119806
|
+
return moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName, file);
|
|
119809
119807
|
}
|
|
119810
|
-
|
|
119811
|
-
|
|
119812
|
-
|
|
119813
|
-
|
|
119808
|
+
}
|
|
119809
|
+
function moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName, file) {
|
|
119810
|
+
var _a2;
|
|
119811
|
+
const resolutionToFile = (_a2 = oldProgram == null ? void 0 : oldProgram.getResolvedModule(file, moduleName.text, getModeForUsageLocation2(file, moduleName))) == null ? void 0 : _a2.resolvedModule;
|
|
119812
|
+
const resolvedFile = resolutionToFile && oldProgram.getSourceFile(resolutionToFile.resolvedFileName);
|
|
119813
|
+
if (resolutionToFile && resolvedFile) {
|
|
119814
|
+
return false;
|
|
119814
119815
|
}
|
|
119815
|
-
|
|
119816
|
-
|
|
119817
|
-
|
|
119818
|
-
result[i] = resolutions[j];
|
|
119819
|
-
j++;
|
|
119820
|
-
}
|
|
119816
|
+
const unmodifiedFile = ambientModuleNameToUnmodifiedFileName.get(moduleName.text);
|
|
119817
|
+
if (!unmodifiedFile) {
|
|
119818
|
+
return false;
|
|
119821
119819
|
}
|
|
119822
|
-
|
|
119823
|
-
|
|
119824
|
-
function moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName) {
|
|
119825
|
-
var _a2;
|
|
119826
|
-
const resolutionToFile = (_a2 = oldProgram == null ? void 0 : oldProgram.getResolvedModule(file, moduleName.text, getModeForUsageLocation2(file, moduleName))) == null ? void 0 : _a2.resolvedModule;
|
|
119827
|
-
const resolvedFile = resolutionToFile && oldProgram.getSourceFile(resolutionToFile.resolvedFileName);
|
|
119828
|
-
if (resolutionToFile && resolvedFile) {
|
|
119829
|
-
return false;
|
|
119830
|
-
}
|
|
119831
|
-
const unmodifiedFile = ambientModuleNameToUnmodifiedFileName.get(moduleName.text);
|
|
119832
|
-
if (!unmodifiedFile) {
|
|
119833
|
-
return false;
|
|
119834
|
-
}
|
|
119835
|
-
if (isTraceEnabled(options, host)) {
|
|
119836
|
-
trace(host, Diagnostics.Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified, moduleName.text, unmodifiedFile);
|
|
119837
|
-
}
|
|
119838
|
-
return true;
|
|
119820
|
+
if (isTraceEnabled(options, host)) {
|
|
119821
|
+
trace(host, Diagnostics.Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified, moduleName.text, unmodifiedFile);
|
|
119839
119822
|
}
|
|
119823
|
+
return true;
|
|
119840
119824
|
}
|
|
119841
119825
|
function resolveTypeReferenceDirectiveNamesReusingOldState(typeDirectiveNames, containingFile) {
|
|
119842
|
-
|
|
119843
|
-
|
|
119844
|
-
|
|
119845
|
-
|
|
119826
|
+
const containingSourceFile = !isString(containingFile) ? containingFile : void 0;
|
|
119827
|
+
return resolveNamesReusingOldState({
|
|
119828
|
+
entries: typeDirectiveNames,
|
|
119829
|
+
containingFile,
|
|
119830
|
+
containingSourceFile,
|
|
119831
|
+
redirectedReference: containingSourceFile && getRedirectReferenceForResolution(containingSourceFile),
|
|
119832
|
+
nameAndModeGetter: typeReferenceResolutionNameAndModeGetter,
|
|
119833
|
+
resolutionWorker: resolveTypeReferenceDirectiveNamesWorker,
|
|
119834
|
+
getResolutionFromOldProgram: (name, mode) => {
|
|
119835
|
+
var _a2;
|
|
119836
|
+
return containingSourceFile ? oldProgram == null ? void 0 : oldProgram.getResolvedTypeReferenceDirective(containingSourceFile, name, mode) : (_a2 = oldProgram == null ? void 0 : oldProgram.getAutomaticTypeDirectiveResolutions()) == null ? void 0 : _a2.get(name, mode);
|
|
119837
|
+
},
|
|
119838
|
+
getResolved: getResolvedTypeReferenceDirectiveFromResolution,
|
|
119839
|
+
canReuseResolutionsInFile: () => containingSourceFile ? containingSourceFile === (oldProgram == null ? void 0 : oldProgram.getSourceFile(containingSourceFile.fileName)) && !hasInvalidatedResolutions(containingSourceFile.path) : !hasInvalidatedResolutions(toPath3(containingFile))
|
|
119840
|
+
});
|
|
119841
|
+
}
|
|
119842
|
+
function resolveNamesReusingOldState({
|
|
119843
|
+
entries,
|
|
119844
|
+
containingFile,
|
|
119845
|
+
containingSourceFile,
|
|
119846
|
+
redirectedReference,
|
|
119847
|
+
nameAndModeGetter,
|
|
119848
|
+
resolutionWorker,
|
|
119849
|
+
getResolutionFromOldProgram,
|
|
119850
|
+
getResolved,
|
|
119851
|
+
canReuseResolutionsInFile,
|
|
119852
|
+
isEntryResolvingToAmbientModule
|
|
119853
|
+
}) {
|
|
119854
|
+
if (!entries.length) return emptyArray;
|
|
119855
|
+
if (structureIsReused === 0 /* Not */ && (!isEntryResolvingToAmbientModule || !containingSourceFile.ambientModuleNames.length)) {
|
|
119856
|
+
return resolutionWorker(
|
|
119857
|
+
entries,
|
|
119846
119858
|
containingFile,
|
|
119847
119859
|
/*reusedNames*/
|
|
119848
119860
|
void 0
|
|
119849
119861
|
);
|
|
119850
119862
|
}
|
|
119851
|
-
let
|
|
119863
|
+
let unknownEntries;
|
|
119864
|
+
let unknownEntryIndices;
|
|
119852
119865
|
let result;
|
|
119853
119866
|
let reusedNames;
|
|
119854
|
-
const
|
|
119855
|
-
|
|
119856
|
-
|
|
119857
|
-
|
|
119858
|
-
|
|
119859
|
-
|
|
119860
|
-
const
|
|
119861
|
-
const
|
|
119862
|
-
|
|
119863
|
-
if (oldResolution == null ? void 0 : oldResolution.resolvedTypeReferenceDirective) {
|
|
119867
|
+
const reuseResolutions = canReuseResolutionsInFile();
|
|
119868
|
+
for (let i = 0; i < entries.length; i++) {
|
|
119869
|
+
const entry = entries[i];
|
|
119870
|
+
if (reuseResolutions) {
|
|
119871
|
+
const name = nameAndModeGetter.getName(entry);
|
|
119872
|
+
const mode = nameAndModeGetter.getMode(entry, containingSourceFile, (redirectedReference == null ? void 0 : redirectedReference.commandLine.options) ?? options);
|
|
119873
|
+
const oldResolution = getResolutionFromOldProgram(name, mode);
|
|
119874
|
+
const oldResolved = oldResolution && getResolved(oldResolution);
|
|
119875
|
+
if (oldResolved) {
|
|
119864
119876
|
if (isTraceEnabled(options, host)) {
|
|
119865
119877
|
trace(
|
|
119866
119878
|
host,
|
|
119867
|
-
|
|
119868
|
-
|
|
119869
|
-
|
|
119870
|
-
|
|
119871
|
-
|
|
119879
|
+
resolutionWorker === resolveModuleNamesWorker ? oldResolved.packageId ? Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 : Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2 : oldResolved.packageId ? Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 : Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved_to_2,
|
|
119880
|
+
name,
|
|
119881
|
+
containingSourceFile ? getNormalizedAbsolutePath(containingSourceFile.originalFileName, currentDirectory) : containingFile,
|
|
119882
|
+
oldResolved.resolvedFileName,
|
|
119883
|
+
oldResolved.packageId && packageIdToString(oldResolved.packageId)
|
|
119872
119884
|
);
|
|
119873
119885
|
}
|
|
119874
|
-
(result ?? (result = new Array(
|
|
119886
|
+
(result ?? (result = new Array(entries.length)))[i] = oldResolution;
|
|
119875
119887
|
(reusedNames ?? (reusedNames = [])).push(entry);
|
|
119876
119888
|
continue;
|
|
119877
119889
|
}
|
|
119878
119890
|
}
|
|
119879
|
-
(
|
|
119880
|
-
|
|
119881
|
-
|
|
119882
|
-
|
|
119883
|
-
|
|
119884
|
-
containingFile,
|
|
119885
|
-
reusedNames
|
|
119886
|
-
);
|
|
119887
|
-
if (!result) {
|
|
119888
|
-
Debug.assert(resolutions.length === typeDirectiveNames.length);
|
|
119889
|
-
return resolutions;
|
|
119890
|
-
}
|
|
119891
|
-
let j = 0;
|
|
119892
|
-
for (let i = 0; i < result.length; i++) {
|
|
119893
|
-
if (!result[i]) {
|
|
119894
|
-
result[i] = resolutions[j];
|
|
119895
|
-
j++;
|
|
119891
|
+
if (isEntryResolvingToAmbientModule == null ? void 0 : isEntryResolvingToAmbientModule(entry, containingFile)) {
|
|
119892
|
+
(result ?? (result = new Array(entries.length)))[i] = emptyResolution;
|
|
119893
|
+
} else {
|
|
119894
|
+
(unknownEntries ?? (unknownEntries = [])).push(entry);
|
|
119895
|
+
(unknownEntryIndices ?? (unknownEntryIndices = [])).push(i);
|
|
119896
119896
|
}
|
|
119897
119897
|
}
|
|
119898
|
-
|
|
119898
|
+
if (!unknownEntries) return result;
|
|
119899
|
+
const resolutions = resolutionWorker(unknownEntries, containingFile, reusedNames);
|
|
119900
|
+
if (!result) return resolutions;
|
|
119901
|
+
resolutions.forEach((resolution, index) => result[unknownEntryIndices[index]] = resolution);
|
|
119899
119902
|
return result;
|
|
119900
119903
|
}
|
|
119901
119904
|
function canReuseProjectReferences() {
|
|
@@ -124531,12 +124534,6 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
124531
124534
|
clear: clear2,
|
|
124532
124535
|
onChangesAffectModuleResolution
|
|
124533
124536
|
};
|
|
124534
|
-
function getResolvedModule(resolution) {
|
|
124535
|
-
return resolution.resolvedModule;
|
|
124536
|
-
}
|
|
124537
|
-
function getResolvedTypeReferenceDirective(resolution) {
|
|
124538
|
-
return resolution.resolvedTypeReferenceDirective;
|
|
124539
|
-
}
|
|
124540
124537
|
function clear2() {
|
|
124541
124538
|
clearMap(directoryWatchesOfFailedLookups, closeFileWatcherOf);
|
|
124542
124539
|
clearMap(fileWatchesOfAffectingLocations, closeFileWatcherOf);
|
|
@@ -124618,7 +124615,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
124618
124615
|
stopWatchFailedLookupLocationOfResolution(
|
|
124619
124616
|
resolution,
|
|
124620
124617
|
resolutionHost.toPath(getInferredLibraryNameResolveFrom(resolutionHost.getCompilationSettings(), getCurrentDirectory(), libFileName)),
|
|
124621
|
-
|
|
124618
|
+
getResolvedModuleFromResolution
|
|
124622
124619
|
);
|
|
124623
124620
|
resolvedLibraries.delete(libFileName);
|
|
124624
124621
|
}
|
|
@@ -124798,7 +124795,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
124798
124795
|
getModuleResolutionHost(resolutionHost),
|
|
124799
124796
|
typeReferenceDirectiveResolutionCache
|
|
124800
124797
|
),
|
|
124801
|
-
getResolutionWithResolvedFileName:
|
|
124798
|
+
getResolutionWithResolvedFileName: getResolvedTypeReferenceDirectiveFromResolution,
|
|
124802
124799
|
shouldRetryResolution: (resolution) => resolution.resolvedTypeReferenceDirective === void 0,
|
|
124803
124800
|
deferWatchingNonRelativeResolution: false
|
|
124804
124801
|
});
|
|
@@ -124819,7 +124816,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
124819
124816
|
resolutionHost,
|
|
124820
124817
|
moduleResolutionCache
|
|
124821
124818
|
),
|
|
124822
|
-
getResolutionWithResolvedFileName:
|
|
124819
|
+
getResolutionWithResolvedFileName: getResolvedModuleFromResolution,
|
|
124823
124820
|
shouldRetryResolution: (resolution) => !resolution.resolvedModule || !resolutionExtensionIsTSOrJson(resolution.resolvedModule.extension),
|
|
124824
124821
|
logChanges: logChangesWhenResolvingModule,
|
|
124825
124822
|
deferWatchingNonRelativeResolution: true
|
|
@@ -124837,17 +124834,17 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
124837
124834
|
libraryName,
|
|
124838
124835
|
resolution,
|
|
124839
124836
|
path,
|
|
124840
|
-
|
|
124837
|
+
getResolvedModuleFromResolution,
|
|
124841
124838
|
/*deferWatchingNonRelativeResolution*/
|
|
124842
124839
|
false
|
|
124843
124840
|
);
|
|
124844
124841
|
resolvedLibraries.set(libFileName, resolution);
|
|
124845
124842
|
if (existingResolution) {
|
|
124846
|
-
stopWatchFailedLookupLocationOfResolution(existingResolution, path,
|
|
124843
|
+
stopWatchFailedLookupLocationOfResolution(existingResolution, path, getResolvedModuleFromResolution);
|
|
124847
124844
|
}
|
|
124848
124845
|
} else {
|
|
124849
124846
|
if (isTraceEnabled(options, host)) {
|
|
124850
|
-
const resolved =
|
|
124847
|
+
const resolved = getResolvedModuleFromResolution(resolution);
|
|
124851
124848
|
trace(
|
|
124852
124849
|
host,
|
|
124853
124850
|
(resolved == null ? void 0 : resolved.resolvedFileName) ? resolved.packageId ? Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 : Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2 : Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_not_resolved,
|
|
@@ -124886,27 +124883,20 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
124886
124883
|
return endsWith(dirPath, "/node_modules/@types");
|
|
124887
124884
|
}
|
|
124888
124885
|
function watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, filePath, getResolutionWithResolvedFileName, deferWatchingNonRelativeResolution) {
|
|
124889
|
-
|
|
124890
|
-
if (resolution.
|
|
124891
|
-
|
|
124892
|
-
|
|
124886
|
+
(resolution.files ?? (resolution.files = /* @__PURE__ */ new Set())).add(filePath);
|
|
124887
|
+
if (resolution.files.size !== 1) return;
|
|
124888
|
+
if (!deferWatchingNonRelativeResolution || isExternalModuleNameRelative(name)) {
|
|
124889
|
+
watchFailedLookupLocationOfResolution(resolution);
|
|
124893
124890
|
} else {
|
|
124894
|
-
|
|
124895
|
-
|
|
124896
|
-
|
|
124897
|
-
|
|
124898
|
-
|
|
124899
|
-
|
|
124900
|
-
|
|
124901
|
-
|
|
124902
|
-
if (resolved && resolved.resolvedFileName) {
|
|
124903
|
-
const key = resolutionHost.toPath(resolved.resolvedFileName);
|
|
124904
|
-
let resolutions = resolvedFileToResolution.get(key);
|
|
124905
|
-
if (!resolutions) resolvedFileToResolution.set(key, resolutions = /* @__PURE__ */ new Set());
|
|
124906
|
-
resolutions.add(resolution);
|
|
124907
|
-
}
|
|
124891
|
+
nonRelativeExternalModuleResolutions.add(name, resolution);
|
|
124892
|
+
}
|
|
124893
|
+
const resolved = getResolutionWithResolvedFileName(resolution);
|
|
124894
|
+
if (resolved && resolved.resolvedFileName) {
|
|
124895
|
+
const key = resolutionHost.toPath(resolved.resolvedFileName);
|
|
124896
|
+
let resolutions = resolvedFileToResolution.get(key);
|
|
124897
|
+
if (!resolutions) resolvedFileToResolution.set(key, resolutions = /* @__PURE__ */ new Set());
|
|
124898
|
+
resolutions.add(resolution);
|
|
124908
124899
|
}
|
|
124909
|
-
(resolution.files ?? (resolution.files = /* @__PURE__ */ new Set())).add(filePath);
|
|
124910
124900
|
}
|
|
124911
124901
|
function watchFailedLookupLocation(failedLookupLocation, setAtRoot) {
|
|
124912
124902
|
const failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
|
|
@@ -124931,7 +124921,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
124931
124921
|
return setAtRoot;
|
|
124932
124922
|
}
|
|
124933
124923
|
function watchFailedLookupLocationOfResolution(resolution) {
|
|
124934
|
-
|
|
124924
|
+
var _a;
|
|
124925
|
+
Debug.assert(!!((_a = resolution.files) == null ? void 0 : _a.size));
|
|
124935
124926
|
const { failedLookupLocations, affectingLocations, alternateResult } = resolution;
|
|
124936
124927
|
if (!(failedLookupLocations == null ? void 0 : failedLookupLocations.length) && !(affectingLocations == null ? void 0 : affectingLocations.length) && !alternateResult) return;
|
|
124937
124928
|
if ((failedLookupLocations == null ? void 0 : failedLookupLocations.length) || alternateResult) resolutionsWithFailedLookups.add(resolution);
|
|
@@ -124957,7 +124948,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
124957
124948
|
watchAffectingLocationsOfResolution(resolution, !(failedLookupLocations == null ? void 0 : failedLookupLocations.length) && !alternateResult);
|
|
124958
124949
|
}
|
|
124959
124950
|
function watchAffectingLocationsOfResolution(resolution, addToResolutionsWithOnlyAffectingLocations) {
|
|
124960
|
-
|
|
124951
|
+
var _a;
|
|
124952
|
+
Debug.assert(!!((_a = resolution.files) == null ? void 0 : _a.size));
|
|
124961
124953
|
const { affectingLocations } = resolution;
|
|
124962
124954
|
if (!(affectingLocations == null ? void 0 : affectingLocations.length)) return;
|
|
124963
124955
|
if (addToResolutionsWithOnlyAffectingLocations) resolutionsWithOnlyAffectingLocations.add(resolution);
|
|
@@ -125144,10 +125136,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
125144
125136
|
}
|
|
125145
125137
|
function stopWatchFailedLookupLocationOfResolution(resolution, filePath, getResolutionWithResolvedFileName, syncDirWatcherRemove) {
|
|
125146
125138
|
Debug.checkDefined(resolution.files).delete(filePath);
|
|
125147
|
-
resolution.
|
|
125148
|
-
|
|
125149
|
-
return;
|
|
125150
|
-
}
|
|
125139
|
+
if (resolution.files.size) return;
|
|
125140
|
+
resolution.files = void 0;
|
|
125151
125141
|
const resolved = getResolutionWithResolvedFileName(resolution);
|
|
125152
125142
|
if (resolved && resolved.resolvedFileName) {
|
|
125153
125143
|
const key = resolutionHost.toPath(resolved.resolvedFileName);
|
|
@@ -125212,8 +125202,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
125212
125202
|
resolvedProjectReference.commandLine.fileNames.forEach((f) => removeResolutionsOfFile(resolutionHost.toPath(f)));
|
|
125213
125203
|
}
|
|
125214
125204
|
function removeResolutionsOfFile(filePath, syncDirWatcherRemove) {
|
|
125215
|
-
removeResolutionsOfFileFromCache(resolvedModuleNames, filePath,
|
|
125216
|
-
removeResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath,
|
|
125205
|
+
removeResolutionsOfFileFromCache(resolvedModuleNames, filePath, getResolvedModuleFromResolution, syncDirWatcherRemove);
|
|
125206
|
+
removeResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath, getResolvedTypeReferenceDirectiveFromResolution, syncDirWatcherRemove);
|
|
125217
125207
|
}
|
|
125218
125208
|
function invalidateResolutions(resolutions, canInvalidate) {
|
|
125219
125209
|
if (!resolutions) return false;
|