@typescript-deploys/pr-build 5.6.0-pr-59003-10 → 5.6.0-pr-59048-4
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 +202 -182
- package/lib/tsserver.js +31 -17
- package/lib/typescript.d.ts +14 -14
- package/lib/typescript.js +307 -308
- package/lib/typingsInstaller.js +2 -2
- package/package.json +12 -11
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-insiders.
|
|
21
|
+
var version = `${versionMajorMinor}.0-insiders.20240627`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -1078,10 +1078,10 @@ function matchedText(pattern, candidate) {
|
|
|
1078
1078
|
Debug.assert(isPatternMatch(pattern, candidate));
|
|
1079
1079
|
return candidate.substring(pattern.prefix.length, candidate.length - pattern.suffix.length);
|
|
1080
1080
|
}
|
|
1081
|
-
function findBestPatternMatch(values, getPattern, candidate) {
|
|
1081
|
+
function findBestPatternMatch(values, getPattern, candidate, endIndex = values.length) {
|
|
1082
1082
|
let matchedValue;
|
|
1083
1083
|
let longestMatchPrefixLength = -1;
|
|
1084
|
-
for (let i = 0; i <
|
|
1084
|
+
for (let i = 0; i < endIndex; i++) {
|
|
1085
1085
|
const v = values[i];
|
|
1086
1086
|
const pattern = getPattern(v);
|
|
1087
1087
|
if (isPatternMatch(pattern, candidate) && pattern.prefix.length > longestMatchPrefixLength) {
|
|
@@ -6684,7 +6684,6 @@ var Diagnostics = {
|
|
|
6684
6684
|
Import_0_conflicts_with_global_value_used_in_this_file_so_must_be_declared_with_a_type_only_import_when_isolatedModules_is_enabled: diag(2866, 1 /* Error */, "Import_0_conflicts_with_global_value_used_in_this_file_so_must_be_declared_with_a_type_only_import_w_2866", "Import '{0}' conflicts with global value used in this file, so must be declared with a type-only import when 'isolatedModules' is enabled."),
|
|
6685
6685
|
Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_Bun_Try_npm_i_save_dev_types_Slashbun: diag(2867, 1 /* Error */, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_Bun_Try_npm_i_save_dev_types_Slashbun_2867", "Cannot find name '{0}'. Do you need to install type definitions for Bun? Try `npm i --save-dev @types/bun`."),
|
|
6686
6686
|
Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_Bun_Try_npm_i_save_dev_types_Slashbun_and_then_add_bun_to_the_types_field_in_your_tsconfig: diag(2868, 1 /* Error */, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_Bun_Try_npm_i_save_dev_types_Slashbun_2868", "Cannot find name '{0}'. Do you need to install type definitions for Bun? Try `npm i --save-dev @types/bun` and then add 'bun' to the types field in your tsconfig."),
|
|
6687
|
-
Truthiness_test_of_this_kind_of_expression_appears_unintentional: diag(2869, 1 /* Error */, "Truthiness_test_of_this_kind_of_expression_appears_unintentional_2869", "Truthiness test of this kind of expression appears unintentional"),
|
|
6688
6687
|
Import_declaration_0_is_using_private_name_1: diag(4e3, 1 /* Error */, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
|
|
6689
6688
|
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, 1 /* Error */, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
|
|
6690
6689
|
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, 1 /* Error */, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
|
|
@@ -12545,6 +12544,12 @@ function projectReferenceIsEqualTo(oldRef, newRef) {
|
|
|
12545
12544
|
function moduleResolutionIsEqualTo(oldResolution, newResolution) {
|
|
12546
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;
|
|
12547
12546
|
}
|
|
12547
|
+
function getResolvedModuleFromResolution(resolution) {
|
|
12548
|
+
return resolution.resolvedModule;
|
|
12549
|
+
}
|
|
12550
|
+
function getResolvedTypeReferenceDirectiveFromResolution(resolution) {
|
|
12551
|
+
return resolution.resolvedTypeReferenceDirective;
|
|
12552
|
+
}
|
|
12548
12553
|
function createModuleNotFoundChain(sourceFile, host, moduleReference, mode, packageName) {
|
|
12549
12554
|
var _a;
|
|
12550
12555
|
const alternateResult = (_a = host.getResolvedModule(sourceFile, moduleReference, mode)) == null ? void 0 : _a.alternateResult;
|
|
@@ -18299,17 +18304,59 @@ var emptyFileSystemEntries = {
|
|
|
18299
18304
|
files: emptyArray,
|
|
18300
18305
|
directories: emptyArray
|
|
18301
18306
|
};
|
|
18307
|
+
var lastPatternOrStringsArray;
|
|
18308
|
+
var matchableStringSet;
|
|
18309
|
+
var sortedPatterns;
|
|
18302
18310
|
function matchPatternOrExact(patternOrStrings, candidate) {
|
|
18303
|
-
|
|
18304
|
-
|
|
18305
|
-
|
|
18306
|
-
|
|
18311
|
+
if (patternOrStrings !== lastPatternOrStringsArray) {
|
|
18312
|
+
lastPatternOrStringsArray = patternOrStrings;
|
|
18313
|
+
matchableStringSet = /* @__PURE__ */ new Set();
|
|
18314
|
+
sortedPatterns = [];
|
|
18315
|
+
for (const patternOrString of patternOrStrings) {
|
|
18316
|
+
if (typeof patternOrString === "string") {
|
|
18317
|
+
matchableStringSet.add(patternOrString);
|
|
18318
|
+
} else {
|
|
18319
|
+
sortedPatterns.push(patternOrString);
|
|
18320
|
+
}
|
|
18321
|
+
}
|
|
18322
|
+
sortedPatterns.sort((a, b) => compareStringsCaseSensitive(a.prefix, b.prefix));
|
|
18323
|
+
}
|
|
18324
|
+
if (matchableStringSet.has(candidate)) {
|
|
18325
|
+
return candidate;
|
|
18326
|
+
}
|
|
18327
|
+
if (sortedPatterns.length === 0) {
|
|
18328
|
+
return void 0;
|
|
18329
|
+
}
|
|
18330
|
+
let index = binarySearchKey(sortedPatterns, candidate, getPatternPrefix, compareStringsCaseSensitive);
|
|
18331
|
+
if (index < 0) {
|
|
18332
|
+
index = ~index;
|
|
18333
|
+
}
|
|
18334
|
+
if (index >= sortedPatterns.length) {
|
|
18335
|
+
index--;
|
|
18336
|
+
}
|
|
18337
|
+
const groupPrefix = sortedPatterns[index].prefix;
|
|
18338
|
+
while (index > 0 && groupPrefix === sortedPatterns[index - 1].prefix) {
|
|
18339
|
+
index--;
|
|
18340
|
+
}
|
|
18341
|
+
for (let i = index; i < sortedPatterns.length; i++) {
|
|
18342
|
+
const currentPattern = sortedPatterns[i];
|
|
18343
|
+
if (currentPattern.prefix !== groupPrefix) {
|
|
18344
|
+
break;
|
|
18307
18345
|
}
|
|
18308
|
-
if (
|
|
18309
|
-
|
|
18346
|
+
if (isPatternMatch(currentPattern, candidate)) {
|
|
18347
|
+
return currentPattern;
|
|
18310
18348
|
}
|
|
18311
18349
|
}
|
|
18312
|
-
return findBestPatternMatch(
|
|
18350
|
+
return findBestPatternMatch(
|
|
18351
|
+
sortedPatterns,
|
|
18352
|
+
(_) => _,
|
|
18353
|
+
candidate,
|
|
18354
|
+
/*endIndex*/
|
|
18355
|
+
index
|
|
18356
|
+
);
|
|
18357
|
+
}
|
|
18358
|
+
function getPatternPrefix(pattern) {
|
|
18359
|
+
return pattern.prefix;
|
|
18313
18360
|
}
|
|
18314
18361
|
function sliceAfter(arr, value) {
|
|
18315
18362
|
const index = arr.indexOf(value);
|
|
@@ -25643,17 +25690,22 @@ var disposeResourcesHelper = {
|
|
|
25643
25690
|
env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
|
|
25644
25691
|
env.hasError = true;
|
|
25645
25692
|
}
|
|
25693
|
+
var r, s = 0;
|
|
25646
25694
|
function next() {
|
|
25647
|
-
while (env.stack.
|
|
25648
|
-
var rec = env.stack.pop();
|
|
25695
|
+
while (r = env.stack.pop()) {
|
|
25649
25696
|
try {
|
|
25650
|
-
|
|
25651
|
-
if (
|
|
25697
|
+
if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
|
|
25698
|
+
if (r.dispose) {
|
|
25699
|
+
var result = r.dispose.call(r.value);
|
|
25700
|
+
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
|
|
25701
|
+
}
|
|
25702
|
+
else s |= 1;
|
|
25652
25703
|
}
|
|
25653
25704
|
catch (e) {
|
|
25654
25705
|
fail(e);
|
|
25655
25706
|
}
|
|
25656
25707
|
}
|
|
25708
|
+
if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
|
|
25657
25709
|
if (env.hasError) throw env.error;
|
|
25658
25710
|
}
|
|
25659
25711
|
return next();
|
|
@@ -81045,17 +81097,6 @@ function createTypeChecker(host) {
|
|
|
81045
81097
|
}
|
|
81046
81098
|
function helper(condExpr2, body2) {
|
|
81047
81099
|
const location = isLogicalOrCoalescingBinaryExpression(condExpr2) ? skipParentheses(condExpr2.right) : condExpr2;
|
|
81048
|
-
switch (condExpr2.kind) {
|
|
81049
|
-
case 14 /* RegularExpressionLiteral */:
|
|
81050
|
-
case 218 /* FunctionExpression */:
|
|
81051
|
-
case 210 /* ObjectLiteralExpression */:
|
|
81052
|
-
case 231 /* ClassExpression */:
|
|
81053
|
-
case 209 /* ArrayLiteralExpression */:
|
|
81054
|
-
case 284 /* JsxElement */:
|
|
81055
|
-
case 285 /* JsxSelfClosingElement */:
|
|
81056
|
-
error(location, Diagnostics.Truthiness_test_of_this_kind_of_expression_appears_unintentional);
|
|
81057
|
-
return;
|
|
81058
|
-
}
|
|
81059
81100
|
if (isModuleExportsAccessExpression(location)) {
|
|
81060
81101
|
return;
|
|
81061
81102
|
}
|
|
@@ -86901,6 +86942,7 @@ function createTypeChecker(host) {
|
|
|
86901
86942
|
}
|
|
86902
86943
|
case 7 /* ES2022 */:
|
|
86903
86944
|
case 99 /* ESNext */:
|
|
86945
|
+
case 200 /* Preserve */:
|
|
86904
86946
|
case 4 /* System */:
|
|
86905
86947
|
if (languageVersion >= 4 /* ES2017 */) {
|
|
86906
86948
|
break;
|
|
@@ -119681,12 +119723,18 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119681
119723
|
}
|
|
119682
119724
|
function resolveModuleNamesWorker(moduleNames, containingFile, reusedNames) {
|
|
119683
119725
|
var _a2, _b2;
|
|
119684
|
-
if (!moduleNames.length) return emptyArray;
|
|
119685
119726
|
const containingFileName = getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory);
|
|
119686
119727
|
const redirectedReference = getRedirectReferenceForResolution(containingFile);
|
|
119687
119728
|
(_a2 = tracing) == null ? void 0 : _a2.push(tracing.Phase.Program, "resolveModuleNamesWorker", { containingFileName });
|
|
119688
119729
|
mark("beforeResolveModule");
|
|
119689
|
-
const result = actualResolveModuleNamesWorker(
|
|
119730
|
+
const result = actualResolveModuleNamesWorker(
|
|
119731
|
+
moduleNames,
|
|
119732
|
+
containingFileName,
|
|
119733
|
+
redirectedReference,
|
|
119734
|
+
options,
|
|
119735
|
+
containingFile,
|
|
119736
|
+
reusedNames
|
|
119737
|
+
);
|
|
119690
119738
|
mark("afterResolveModule");
|
|
119691
119739
|
measure("ResolveModule", "beforeResolveModule", "afterResolveModule");
|
|
119692
119740
|
(_b2 = tracing) == null ? void 0 : _b2.pop();
|
|
@@ -119694,13 +119742,19 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119694
119742
|
}
|
|
119695
119743
|
function resolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFile, reusedNames) {
|
|
119696
119744
|
var _a2, _b2;
|
|
119697
|
-
if (!typeDirectiveNames.length) return [];
|
|
119698
119745
|
const containingSourceFile = !isString(containingFile) ? containingFile : void 0;
|
|
119699
119746
|
const containingFileName = !isString(containingFile) ? getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory) : containingFile;
|
|
119700
119747
|
const redirectedReference = containingSourceFile && getRedirectReferenceForResolution(containingSourceFile);
|
|
119701
119748
|
(_a2 = tracing) == null ? void 0 : _a2.push(tracing.Phase.Program, "resolveTypeReferenceDirectiveNamesWorker", { containingFileName });
|
|
119702
119749
|
mark("beforeResolveTypeReference");
|
|
119703
|
-
const result = actualResolveTypeReferenceDirectiveNamesWorker(
|
|
119750
|
+
const result = actualResolveTypeReferenceDirectiveNamesWorker(
|
|
119751
|
+
typeDirectiveNames,
|
|
119752
|
+
containingFileName,
|
|
119753
|
+
redirectedReference,
|
|
119754
|
+
options,
|
|
119755
|
+
containingSourceFile,
|
|
119756
|
+
reusedNames
|
|
119757
|
+
);
|
|
119704
119758
|
mark("afterResolveTypeReference");
|
|
119705
119759
|
measure("ResolveTypeReference", "beforeResolveTypeReference", "afterResolveTypeReference");
|
|
119706
119760
|
(_b2 = tracing) == null ? void 0 : _b2.pop();
|
|
@@ -119770,144 +119824,123 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119770
119824
|
}
|
|
119771
119825
|
return classifiableNames;
|
|
119772
119826
|
}
|
|
119773
|
-
function resolveModuleNamesReusingOldState(moduleNames,
|
|
119774
|
-
|
|
119775
|
-
|
|
119776
|
-
|
|
119777
|
-
|
|
119778
|
-
|
|
119779
|
-
|
|
119780
|
-
|
|
119781
|
-
|
|
119782
|
-
|
|
119783
|
-
|
|
119784
|
-
|
|
119785
|
-
|
|
119786
|
-
|
|
119787
|
-
|
|
119788
|
-
|
|
119789
|
-
if (
|
|
119790
|
-
|
|
119791
|
-
if (oldResolution == null ? void 0 : oldResolution.resolvedModule) {
|
|
119792
|
-
if (isTraceEnabled(options, host)) {
|
|
119793
|
-
trace(
|
|
119794
|
-
host,
|
|
119795
|
-
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,
|
|
119796
|
-
moduleName.text,
|
|
119797
|
-
getNormalizedAbsolutePath(file.originalFileName, currentDirectory),
|
|
119798
|
-
oldResolution.resolvedModule.resolvedFileName,
|
|
119799
|
-
oldResolution.resolvedModule.packageId && packageIdToString(oldResolution.resolvedModule.packageId)
|
|
119800
|
-
);
|
|
119801
|
-
}
|
|
119802
|
-
(result ?? (result = new Array(moduleNames.length)))[i] = oldResolution;
|
|
119803
|
-
(reusedNames ?? (reusedNames = [])).push(moduleName);
|
|
119804
|
-
continue;
|
|
119805
|
-
}
|
|
119806
|
-
}
|
|
119807
|
-
let resolvesToAmbientModuleInNonModifiedFile = false;
|
|
119808
|
-
if (contains(file.ambientModuleNames, moduleName.text)) {
|
|
119809
|
-
resolvesToAmbientModuleInNonModifiedFile = true;
|
|
119810
|
-
if (isTraceEnabled(options, host)) {
|
|
119811
|
-
trace(host, Diagnostics.Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1, moduleName.text, getNormalizedAbsolutePath(file.originalFileName, currentDirectory));
|
|
119812
|
-
}
|
|
119813
|
-
} else {
|
|
119814
|
-
resolvesToAmbientModuleInNonModifiedFile = moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName);
|
|
119815
|
-
}
|
|
119816
|
-
if (resolvesToAmbientModuleInNonModifiedFile) {
|
|
119817
|
-
(result || (result = new Array(moduleNames.length)))[i] = predictedToResolveToAmbientModuleMarker;
|
|
119818
|
-
} else {
|
|
119819
|
-
(unknownModuleNames ?? (unknownModuleNames = [])).push(moduleName);
|
|
119827
|
+
function resolveModuleNamesReusingOldState(moduleNames, containingFile) {
|
|
119828
|
+
return resolveNamesReusingOldState({
|
|
119829
|
+
entries: moduleNames,
|
|
119830
|
+
containingFile,
|
|
119831
|
+
containingSourceFile: containingFile,
|
|
119832
|
+
redirectedReference: getRedirectReferenceForResolution(containingFile),
|
|
119833
|
+
nameAndModeGetter: moduleResolutionNameAndModeGetter,
|
|
119834
|
+
resolutionWorker: resolveModuleNamesWorker,
|
|
119835
|
+
getResolutionFromOldProgram: (name, mode) => oldProgram == null ? void 0 : oldProgram.getResolvedModule(containingFile, name, mode),
|
|
119836
|
+
getResolved: getResolvedModuleFromResolution,
|
|
119837
|
+
canReuseResolutionsInFile: () => containingFile === (oldProgram == null ? void 0 : oldProgram.getSourceFile(containingFile.fileName)) && !hasInvalidatedResolutions(containingFile.path),
|
|
119838
|
+
isEntryResolvingToAmbientModule: moduleNameResolvesToAmbientModule
|
|
119839
|
+
});
|
|
119840
|
+
}
|
|
119841
|
+
function moduleNameResolvesToAmbientModule(moduleName, file) {
|
|
119842
|
+
if (contains(file.ambientModuleNames, moduleName.text)) {
|
|
119843
|
+
if (isTraceEnabled(options, host)) {
|
|
119844
|
+
trace(host, Diagnostics.Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1, moduleName.text, getNormalizedAbsolutePath(file.originalFileName, currentDirectory));
|
|
119820
119845
|
}
|
|
119846
|
+
return true;
|
|
119847
|
+
} else {
|
|
119848
|
+
return moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName, file);
|
|
119821
119849
|
}
|
|
119822
|
-
|
|
119823
|
-
|
|
119824
|
-
|
|
119825
|
-
|
|
119850
|
+
}
|
|
119851
|
+
function moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName, file) {
|
|
119852
|
+
var _a2;
|
|
119853
|
+
const resolutionToFile = (_a2 = oldProgram == null ? void 0 : oldProgram.getResolvedModule(file, moduleName.text, getModeForUsageLocation2(file, moduleName))) == null ? void 0 : _a2.resolvedModule;
|
|
119854
|
+
const resolvedFile = resolutionToFile && oldProgram.getSourceFile(resolutionToFile.resolvedFileName);
|
|
119855
|
+
if (resolutionToFile && resolvedFile) {
|
|
119856
|
+
return false;
|
|
119826
119857
|
}
|
|
119827
|
-
|
|
119828
|
-
|
|
119829
|
-
|
|
119830
|
-
result[i] = resolutions[j];
|
|
119831
|
-
j++;
|
|
119832
|
-
}
|
|
119858
|
+
const unmodifiedFile = ambientModuleNameToUnmodifiedFileName.get(moduleName.text);
|
|
119859
|
+
if (!unmodifiedFile) {
|
|
119860
|
+
return false;
|
|
119833
119861
|
}
|
|
119834
|
-
|
|
119835
|
-
|
|
119836
|
-
function moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName) {
|
|
119837
|
-
var _a2;
|
|
119838
|
-
const resolutionToFile = (_a2 = oldProgram == null ? void 0 : oldProgram.getResolvedModule(file, moduleName.text, getModeForUsageLocation2(file, moduleName))) == null ? void 0 : _a2.resolvedModule;
|
|
119839
|
-
const resolvedFile = resolutionToFile && oldProgram.getSourceFile(resolutionToFile.resolvedFileName);
|
|
119840
|
-
if (resolutionToFile && resolvedFile) {
|
|
119841
|
-
return false;
|
|
119842
|
-
}
|
|
119843
|
-
const unmodifiedFile = ambientModuleNameToUnmodifiedFileName.get(moduleName.text);
|
|
119844
|
-
if (!unmodifiedFile) {
|
|
119845
|
-
return false;
|
|
119846
|
-
}
|
|
119847
|
-
if (isTraceEnabled(options, host)) {
|
|
119848
|
-
trace(host, Diagnostics.Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified, moduleName.text, unmodifiedFile);
|
|
119849
|
-
}
|
|
119850
|
-
return true;
|
|
119862
|
+
if (isTraceEnabled(options, host)) {
|
|
119863
|
+
trace(host, Diagnostics.Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified, moduleName.text, unmodifiedFile);
|
|
119851
119864
|
}
|
|
119865
|
+
return true;
|
|
119852
119866
|
}
|
|
119853
119867
|
function resolveTypeReferenceDirectiveNamesReusingOldState(typeDirectiveNames, containingFile) {
|
|
119854
|
-
|
|
119855
|
-
|
|
119856
|
-
|
|
119857
|
-
|
|
119868
|
+
const containingSourceFile = !isString(containingFile) ? containingFile : void 0;
|
|
119869
|
+
return resolveNamesReusingOldState({
|
|
119870
|
+
entries: typeDirectiveNames,
|
|
119871
|
+
containingFile,
|
|
119872
|
+
containingSourceFile,
|
|
119873
|
+
redirectedReference: containingSourceFile && getRedirectReferenceForResolution(containingSourceFile),
|
|
119874
|
+
nameAndModeGetter: typeReferenceResolutionNameAndModeGetter,
|
|
119875
|
+
resolutionWorker: resolveTypeReferenceDirectiveNamesWorker,
|
|
119876
|
+
getResolutionFromOldProgram: (name, mode) => {
|
|
119877
|
+
var _a2;
|
|
119878
|
+
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);
|
|
119879
|
+
},
|
|
119880
|
+
getResolved: getResolvedTypeReferenceDirectiveFromResolution,
|
|
119881
|
+
canReuseResolutionsInFile: () => containingSourceFile ? containingSourceFile === (oldProgram == null ? void 0 : oldProgram.getSourceFile(containingSourceFile.fileName)) && !hasInvalidatedResolutions(containingSourceFile.path) : !hasInvalidatedResolutions(toPath3(containingFile))
|
|
119882
|
+
});
|
|
119883
|
+
}
|
|
119884
|
+
function resolveNamesReusingOldState({
|
|
119885
|
+
entries,
|
|
119886
|
+
containingFile,
|
|
119887
|
+
containingSourceFile,
|
|
119888
|
+
redirectedReference,
|
|
119889
|
+
nameAndModeGetter,
|
|
119890
|
+
resolutionWorker,
|
|
119891
|
+
getResolutionFromOldProgram,
|
|
119892
|
+
getResolved,
|
|
119893
|
+
canReuseResolutionsInFile,
|
|
119894
|
+
isEntryResolvingToAmbientModule
|
|
119895
|
+
}) {
|
|
119896
|
+
if (!entries.length) return emptyArray;
|
|
119897
|
+
if (structureIsReused === 0 /* Not */ && (!isEntryResolvingToAmbientModule || !containingSourceFile.ambientModuleNames.length)) {
|
|
119898
|
+
return resolutionWorker(
|
|
119899
|
+
entries,
|
|
119858
119900
|
containingFile,
|
|
119859
119901
|
/*reusedNames*/
|
|
119860
119902
|
void 0
|
|
119861
119903
|
);
|
|
119862
119904
|
}
|
|
119863
|
-
let
|
|
119905
|
+
let unknownEntries;
|
|
119906
|
+
let unknownEntryIndices;
|
|
119864
119907
|
let result;
|
|
119865
119908
|
let reusedNames;
|
|
119866
|
-
const
|
|
119867
|
-
|
|
119868
|
-
|
|
119869
|
-
|
|
119870
|
-
|
|
119871
|
-
|
|
119872
|
-
const
|
|
119873
|
-
const
|
|
119874
|
-
|
|
119875
|
-
if (oldResolution == null ? void 0 : oldResolution.resolvedTypeReferenceDirective) {
|
|
119909
|
+
const reuseResolutions = canReuseResolutionsInFile();
|
|
119910
|
+
for (let i = 0; i < entries.length; i++) {
|
|
119911
|
+
const entry = entries[i];
|
|
119912
|
+
if (reuseResolutions) {
|
|
119913
|
+
const name = nameAndModeGetter.getName(entry);
|
|
119914
|
+
const mode = nameAndModeGetter.getMode(entry, containingSourceFile, (redirectedReference == null ? void 0 : redirectedReference.commandLine.options) ?? options);
|
|
119915
|
+
const oldResolution = getResolutionFromOldProgram(name, mode);
|
|
119916
|
+
const oldResolved = oldResolution && getResolved(oldResolution);
|
|
119917
|
+
if (oldResolved) {
|
|
119876
119918
|
if (isTraceEnabled(options, host)) {
|
|
119877
119919
|
trace(
|
|
119878
119920
|
host,
|
|
119879
|
-
|
|
119880
|
-
|
|
119881
|
-
|
|
119882
|
-
|
|
119883
|
-
|
|
119921
|
+
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,
|
|
119922
|
+
name,
|
|
119923
|
+
containingSourceFile ? getNormalizedAbsolutePath(containingSourceFile.originalFileName, currentDirectory) : containingFile,
|
|
119924
|
+
oldResolved.resolvedFileName,
|
|
119925
|
+
oldResolved.packageId && packageIdToString(oldResolved.packageId)
|
|
119884
119926
|
);
|
|
119885
119927
|
}
|
|
119886
|
-
(result ?? (result = new Array(
|
|
119928
|
+
(result ?? (result = new Array(entries.length)))[i] = oldResolution;
|
|
119887
119929
|
(reusedNames ?? (reusedNames = [])).push(entry);
|
|
119888
119930
|
continue;
|
|
119889
119931
|
}
|
|
119890
119932
|
}
|
|
119891
|
-
(
|
|
119892
|
-
|
|
119893
|
-
|
|
119894
|
-
|
|
119895
|
-
|
|
119896
|
-
containingFile,
|
|
119897
|
-
reusedNames
|
|
119898
|
-
);
|
|
119899
|
-
if (!result) {
|
|
119900
|
-
Debug.assert(resolutions.length === typeDirectiveNames.length);
|
|
119901
|
-
return resolutions;
|
|
119902
|
-
}
|
|
119903
|
-
let j = 0;
|
|
119904
|
-
for (let i = 0; i < result.length; i++) {
|
|
119905
|
-
if (!result[i]) {
|
|
119906
|
-
result[i] = resolutions[j];
|
|
119907
|
-
j++;
|
|
119933
|
+
if (isEntryResolvingToAmbientModule == null ? void 0 : isEntryResolvingToAmbientModule(entry, containingFile)) {
|
|
119934
|
+
(result ?? (result = new Array(entries.length)))[i] = emptyResolution;
|
|
119935
|
+
} else {
|
|
119936
|
+
(unknownEntries ?? (unknownEntries = [])).push(entry);
|
|
119937
|
+
(unknownEntryIndices ?? (unknownEntryIndices = [])).push(i);
|
|
119908
119938
|
}
|
|
119909
119939
|
}
|
|
119910
|
-
|
|
119940
|
+
if (!unknownEntries) return result;
|
|
119941
|
+
const resolutions = resolutionWorker(unknownEntries, containingFile, reusedNames);
|
|
119942
|
+
if (!result) return resolutions;
|
|
119943
|
+
resolutions.forEach((resolution, index) => result[unknownEntryIndices[index]] = resolution);
|
|
119911
119944
|
return result;
|
|
119912
119945
|
}
|
|
119913
119946
|
function canReuseProjectReferences() {
|
|
@@ -124543,12 +124576,6 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
124543
124576
|
clear: clear2,
|
|
124544
124577
|
onChangesAffectModuleResolution
|
|
124545
124578
|
};
|
|
124546
|
-
function getResolvedModule(resolution) {
|
|
124547
|
-
return resolution.resolvedModule;
|
|
124548
|
-
}
|
|
124549
|
-
function getResolvedTypeReferenceDirective(resolution) {
|
|
124550
|
-
return resolution.resolvedTypeReferenceDirective;
|
|
124551
|
-
}
|
|
124552
124579
|
function clear2() {
|
|
124553
124580
|
clearMap(directoryWatchesOfFailedLookups, closeFileWatcherOf);
|
|
124554
124581
|
clearMap(fileWatchesOfAffectingLocations, closeFileWatcherOf);
|
|
@@ -124630,7 +124657,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
124630
124657
|
stopWatchFailedLookupLocationOfResolution(
|
|
124631
124658
|
resolution,
|
|
124632
124659
|
resolutionHost.toPath(getInferredLibraryNameResolveFrom(resolutionHost.getCompilationSettings(), getCurrentDirectory(), libFileName)),
|
|
124633
|
-
|
|
124660
|
+
getResolvedModuleFromResolution
|
|
124634
124661
|
);
|
|
124635
124662
|
resolvedLibraries.delete(libFileName);
|
|
124636
124663
|
}
|
|
@@ -124810,7 +124837,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
124810
124837
|
getModuleResolutionHost(resolutionHost),
|
|
124811
124838
|
typeReferenceDirectiveResolutionCache
|
|
124812
124839
|
),
|
|
124813
|
-
getResolutionWithResolvedFileName:
|
|
124840
|
+
getResolutionWithResolvedFileName: getResolvedTypeReferenceDirectiveFromResolution,
|
|
124814
124841
|
shouldRetryResolution: (resolution) => resolution.resolvedTypeReferenceDirective === void 0,
|
|
124815
124842
|
deferWatchingNonRelativeResolution: false
|
|
124816
124843
|
});
|
|
@@ -124831,7 +124858,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
124831
124858
|
resolutionHost,
|
|
124832
124859
|
moduleResolutionCache
|
|
124833
124860
|
),
|
|
124834
|
-
getResolutionWithResolvedFileName:
|
|
124861
|
+
getResolutionWithResolvedFileName: getResolvedModuleFromResolution,
|
|
124835
124862
|
shouldRetryResolution: (resolution) => !resolution.resolvedModule || !resolutionExtensionIsTSOrJson(resolution.resolvedModule.extension),
|
|
124836
124863
|
logChanges: logChangesWhenResolvingModule,
|
|
124837
124864
|
deferWatchingNonRelativeResolution: true
|
|
@@ -124849,17 +124876,17 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
124849
124876
|
libraryName,
|
|
124850
124877
|
resolution,
|
|
124851
124878
|
path,
|
|
124852
|
-
|
|
124879
|
+
getResolvedModuleFromResolution,
|
|
124853
124880
|
/*deferWatchingNonRelativeResolution*/
|
|
124854
124881
|
false
|
|
124855
124882
|
);
|
|
124856
124883
|
resolvedLibraries.set(libFileName, resolution);
|
|
124857
124884
|
if (existingResolution) {
|
|
124858
|
-
stopWatchFailedLookupLocationOfResolution(existingResolution, path,
|
|
124885
|
+
stopWatchFailedLookupLocationOfResolution(existingResolution, path, getResolvedModuleFromResolution);
|
|
124859
124886
|
}
|
|
124860
124887
|
} else {
|
|
124861
124888
|
if (isTraceEnabled(options, host)) {
|
|
124862
|
-
const resolved =
|
|
124889
|
+
const resolved = getResolvedModuleFromResolution(resolution);
|
|
124863
124890
|
trace(
|
|
124864
124891
|
host,
|
|
124865
124892
|
(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,
|
|
@@ -124898,27 +124925,20 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
124898
124925
|
return endsWith(dirPath, "/node_modules/@types");
|
|
124899
124926
|
}
|
|
124900
124927
|
function watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, filePath, getResolutionWithResolvedFileName, deferWatchingNonRelativeResolution) {
|
|
124901
|
-
|
|
124902
|
-
if (resolution.
|
|
124903
|
-
|
|
124904
|
-
|
|
124928
|
+
(resolution.files ?? (resolution.files = /* @__PURE__ */ new Set())).add(filePath);
|
|
124929
|
+
if (resolution.files.size !== 1) return;
|
|
124930
|
+
if (!deferWatchingNonRelativeResolution || isExternalModuleNameRelative(name)) {
|
|
124931
|
+
watchFailedLookupLocationOfResolution(resolution);
|
|
124905
124932
|
} else {
|
|
124906
|
-
|
|
124907
|
-
|
|
124908
|
-
|
|
124909
|
-
|
|
124910
|
-
|
|
124911
|
-
|
|
124912
|
-
|
|
124913
|
-
|
|
124914
|
-
if (resolved && resolved.resolvedFileName) {
|
|
124915
|
-
const key = resolutionHost.toPath(resolved.resolvedFileName);
|
|
124916
|
-
let resolutions = resolvedFileToResolution.get(key);
|
|
124917
|
-
if (!resolutions) resolvedFileToResolution.set(key, resolutions = /* @__PURE__ */ new Set());
|
|
124918
|
-
resolutions.add(resolution);
|
|
124919
|
-
}
|
|
124933
|
+
nonRelativeExternalModuleResolutions.add(name, resolution);
|
|
124934
|
+
}
|
|
124935
|
+
const resolved = getResolutionWithResolvedFileName(resolution);
|
|
124936
|
+
if (resolved && resolved.resolvedFileName) {
|
|
124937
|
+
const key = resolutionHost.toPath(resolved.resolvedFileName);
|
|
124938
|
+
let resolutions = resolvedFileToResolution.get(key);
|
|
124939
|
+
if (!resolutions) resolvedFileToResolution.set(key, resolutions = /* @__PURE__ */ new Set());
|
|
124940
|
+
resolutions.add(resolution);
|
|
124920
124941
|
}
|
|
124921
|
-
(resolution.files ?? (resolution.files = /* @__PURE__ */ new Set())).add(filePath);
|
|
124922
124942
|
}
|
|
124923
124943
|
function watchFailedLookupLocation(failedLookupLocation, setAtRoot) {
|
|
124924
124944
|
const failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
|
|
@@ -124943,7 +124963,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
124943
124963
|
return setAtRoot;
|
|
124944
124964
|
}
|
|
124945
124965
|
function watchFailedLookupLocationOfResolution(resolution) {
|
|
124946
|
-
|
|
124966
|
+
var _a;
|
|
124967
|
+
Debug.assert(!!((_a = resolution.files) == null ? void 0 : _a.size));
|
|
124947
124968
|
const { failedLookupLocations, affectingLocations, alternateResult } = resolution;
|
|
124948
124969
|
if (!(failedLookupLocations == null ? void 0 : failedLookupLocations.length) && !(affectingLocations == null ? void 0 : affectingLocations.length) && !alternateResult) return;
|
|
124949
124970
|
if ((failedLookupLocations == null ? void 0 : failedLookupLocations.length) || alternateResult) resolutionsWithFailedLookups.add(resolution);
|
|
@@ -124969,7 +124990,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
124969
124990
|
watchAffectingLocationsOfResolution(resolution, !(failedLookupLocations == null ? void 0 : failedLookupLocations.length) && !alternateResult);
|
|
124970
124991
|
}
|
|
124971
124992
|
function watchAffectingLocationsOfResolution(resolution, addToResolutionsWithOnlyAffectingLocations) {
|
|
124972
|
-
|
|
124993
|
+
var _a;
|
|
124994
|
+
Debug.assert(!!((_a = resolution.files) == null ? void 0 : _a.size));
|
|
124973
124995
|
const { affectingLocations } = resolution;
|
|
124974
124996
|
if (!(affectingLocations == null ? void 0 : affectingLocations.length)) return;
|
|
124975
124997
|
if (addToResolutionsWithOnlyAffectingLocations) resolutionsWithOnlyAffectingLocations.add(resolution);
|
|
@@ -125156,10 +125178,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
125156
125178
|
}
|
|
125157
125179
|
function stopWatchFailedLookupLocationOfResolution(resolution, filePath, getResolutionWithResolvedFileName, syncDirWatcherRemove) {
|
|
125158
125180
|
Debug.checkDefined(resolution.files).delete(filePath);
|
|
125159
|
-
resolution.
|
|
125160
|
-
|
|
125161
|
-
return;
|
|
125162
|
-
}
|
|
125181
|
+
if (resolution.files.size) return;
|
|
125182
|
+
resolution.files = void 0;
|
|
125163
125183
|
const resolved = getResolutionWithResolvedFileName(resolution);
|
|
125164
125184
|
if (resolved && resolved.resolvedFileName) {
|
|
125165
125185
|
const key = resolutionHost.toPath(resolved.resolvedFileName);
|
|
@@ -125224,8 +125244,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
125224
125244
|
resolvedProjectReference.commandLine.fileNames.forEach((f) => removeResolutionsOfFile(resolutionHost.toPath(f)));
|
|
125225
125245
|
}
|
|
125226
125246
|
function removeResolutionsOfFile(filePath, syncDirWatcherRemove) {
|
|
125227
|
-
removeResolutionsOfFileFromCache(resolvedModuleNames, filePath,
|
|
125228
|
-
removeResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath,
|
|
125247
|
+
removeResolutionsOfFileFromCache(resolvedModuleNames, filePath, getResolvedModuleFromResolution, syncDirWatcherRemove);
|
|
125248
|
+
removeResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath, getResolvedTypeReferenceDirectiveFromResolution, syncDirWatcherRemove);
|
|
125229
125249
|
}
|
|
125230
125250
|
function invalidateResolutions(resolutions, canInvalidate) {
|
|
125231
125251
|
if (!resolutions) return false;
|