@typescript-deploys/pr-build 5.6.0-pr-59003-10 → 5.6.0-pr-59048-8
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 +208 -182
- package/lib/tsserver.js +31 -17
- package/lib/typescript.d.ts +14 -14
- package/lib/typescript.js +313 -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,65 @@ var emptyFileSystemEntries = {
|
|
|
18299
18304
|
files: emptyArray,
|
|
18300
18305
|
directories: emptyArray
|
|
18301
18306
|
};
|
|
18307
|
+
var patternOrStringsCache = /* @__PURE__ */ new WeakMap();
|
|
18302
18308
|
function matchPatternOrExact(patternOrStrings, candidate) {
|
|
18303
|
-
|
|
18304
|
-
|
|
18305
|
-
|
|
18306
|
-
|
|
18309
|
+
let matchableStringSet;
|
|
18310
|
+
let sortedPatterns;
|
|
18311
|
+
const cacheEntry = patternOrStringsCache.get(patternOrStrings);
|
|
18312
|
+
if (cacheEntry !== void 0) {
|
|
18313
|
+
({ matchableStringSet, sortedPatterns } = cacheEntry);
|
|
18314
|
+
} else {
|
|
18315
|
+
matchableStringSet = /* @__PURE__ */ new Set();
|
|
18316
|
+
sortedPatterns = [];
|
|
18317
|
+
for (const patternOrString of patternOrStrings) {
|
|
18318
|
+
if (typeof patternOrString === "string") {
|
|
18319
|
+
matchableStringSet.add(patternOrString);
|
|
18320
|
+
} else {
|
|
18321
|
+
sortedPatterns.push(patternOrString);
|
|
18322
|
+
}
|
|
18307
18323
|
}
|
|
18308
|
-
|
|
18309
|
-
|
|
18324
|
+
sortedPatterns.sort((a, b) => compareStringsCaseSensitive(a.prefix, b.prefix));
|
|
18325
|
+
patternOrStringsCache.set(patternOrStrings, {
|
|
18326
|
+
matchableStringSet,
|
|
18327
|
+
sortedPatterns
|
|
18328
|
+
});
|
|
18329
|
+
}
|
|
18330
|
+
if (matchableStringSet.has(candidate)) {
|
|
18331
|
+
return candidate;
|
|
18332
|
+
}
|
|
18333
|
+
if (sortedPatterns.length === 0) {
|
|
18334
|
+
return void 0;
|
|
18335
|
+
}
|
|
18336
|
+
let index = binarySearchKey(sortedPatterns, candidate, getPatternPrefix, compareStringsCaseSensitive);
|
|
18337
|
+
if (index < 0) {
|
|
18338
|
+
index = ~index;
|
|
18339
|
+
}
|
|
18340
|
+
if (index >= sortedPatterns.length) {
|
|
18341
|
+
index--;
|
|
18342
|
+
}
|
|
18343
|
+
const groupPrefix = sortedPatterns[index].prefix;
|
|
18344
|
+
while (index > 0 && groupPrefix === sortedPatterns[index - 1].prefix) {
|
|
18345
|
+
index--;
|
|
18346
|
+
}
|
|
18347
|
+
for (let i = index; i < sortedPatterns.length; i++) {
|
|
18348
|
+
const currentPattern = sortedPatterns[i];
|
|
18349
|
+
if (currentPattern.prefix !== groupPrefix) {
|
|
18350
|
+
break;
|
|
18351
|
+
}
|
|
18352
|
+
if (isPatternMatch(currentPattern, candidate)) {
|
|
18353
|
+
return currentPattern;
|
|
18310
18354
|
}
|
|
18311
18355
|
}
|
|
18312
|
-
return findBestPatternMatch(
|
|
18356
|
+
return findBestPatternMatch(
|
|
18357
|
+
sortedPatterns,
|
|
18358
|
+
(_) => _,
|
|
18359
|
+
candidate,
|
|
18360
|
+
/*endIndex*/
|
|
18361
|
+
index
|
|
18362
|
+
);
|
|
18363
|
+
}
|
|
18364
|
+
function getPatternPrefix(pattern) {
|
|
18365
|
+
return pattern.prefix;
|
|
18313
18366
|
}
|
|
18314
18367
|
function sliceAfter(arr, value) {
|
|
18315
18368
|
const index = arr.indexOf(value);
|
|
@@ -25643,17 +25696,22 @@ var disposeResourcesHelper = {
|
|
|
25643
25696
|
env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
|
|
25644
25697
|
env.hasError = true;
|
|
25645
25698
|
}
|
|
25699
|
+
var r, s = 0;
|
|
25646
25700
|
function next() {
|
|
25647
|
-
while (env.stack.
|
|
25648
|
-
var rec = env.stack.pop();
|
|
25701
|
+
while (r = env.stack.pop()) {
|
|
25649
25702
|
try {
|
|
25650
|
-
|
|
25651
|
-
if (
|
|
25703
|
+
if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
|
|
25704
|
+
if (r.dispose) {
|
|
25705
|
+
var result = r.dispose.call(r.value);
|
|
25706
|
+
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
|
|
25707
|
+
}
|
|
25708
|
+
else s |= 1;
|
|
25652
25709
|
}
|
|
25653
25710
|
catch (e) {
|
|
25654
25711
|
fail(e);
|
|
25655
25712
|
}
|
|
25656
25713
|
}
|
|
25714
|
+
if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
|
|
25657
25715
|
if (env.hasError) throw env.error;
|
|
25658
25716
|
}
|
|
25659
25717
|
return next();
|
|
@@ -81045,17 +81103,6 @@ function createTypeChecker(host) {
|
|
|
81045
81103
|
}
|
|
81046
81104
|
function helper(condExpr2, body2) {
|
|
81047
81105
|
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
81106
|
if (isModuleExportsAccessExpression(location)) {
|
|
81060
81107
|
return;
|
|
81061
81108
|
}
|
|
@@ -86901,6 +86948,7 @@ function createTypeChecker(host) {
|
|
|
86901
86948
|
}
|
|
86902
86949
|
case 7 /* ES2022 */:
|
|
86903
86950
|
case 99 /* ESNext */:
|
|
86951
|
+
case 200 /* Preserve */:
|
|
86904
86952
|
case 4 /* System */:
|
|
86905
86953
|
if (languageVersion >= 4 /* ES2017 */) {
|
|
86906
86954
|
break;
|
|
@@ -119681,12 +119729,18 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119681
119729
|
}
|
|
119682
119730
|
function resolveModuleNamesWorker(moduleNames, containingFile, reusedNames) {
|
|
119683
119731
|
var _a2, _b2;
|
|
119684
|
-
if (!moduleNames.length) return emptyArray;
|
|
119685
119732
|
const containingFileName = getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory);
|
|
119686
119733
|
const redirectedReference = getRedirectReferenceForResolution(containingFile);
|
|
119687
119734
|
(_a2 = tracing) == null ? void 0 : _a2.push(tracing.Phase.Program, "resolveModuleNamesWorker", { containingFileName });
|
|
119688
119735
|
mark("beforeResolveModule");
|
|
119689
|
-
const result = actualResolveModuleNamesWorker(
|
|
119736
|
+
const result = actualResolveModuleNamesWorker(
|
|
119737
|
+
moduleNames,
|
|
119738
|
+
containingFileName,
|
|
119739
|
+
redirectedReference,
|
|
119740
|
+
options,
|
|
119741
|
+
containingFile,
|
|
119742
|
+
reusedNames
|
|
119743
|
+
);
|
|
119690
119744
|
mark("afterResolveModule");
|
|
119691
119745
|
measure("ResolveModule", "beforeResolveModule", "afterResolveModule");
|
|
119692
119746
|
(_b2 = tracing) == null ? void 0 : _b2.pop();
|
|
@@ -119694,13 +119748,19 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119694
119748
|
}
|
|
119695
119749
|
function resolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFile, reusedNames) {
|
|
119696
119750
|
var _a2, _b2;
|
|
119697
|
-
if (!typeDirectiveNames.length) return [];
|
|
119698
119751
|
const containingSourceFile = !isString(containingFile) ? containingFile : void 0;
|
|
119699
119752
|
const containingFileName = !isString(containingFile) ? getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory) : containingFile;
|
|
119700
119753
|
const redirectedReference = containingSourceFile && getRedirectReferenceForResolution(containingSourceFile);
|
|
119701
119754
|
(_a2 = tracing) == null ? void 0 : _a2.push(tracing.Phase.Program, "resolveTypeReferenceDirectiveNamesWorker", { containingFileName });
|
|
119702
119755
|
mark("beforeResolveTypeReference");
|
|
119703
|
-
const result = actualResolveTypeReferenceDirectiveNamesWorker(
|
|
119756
|
+
const result = actualResolveTypeReferenceDirectiveNamesWorker(
|
|
119757
|
+
typeDirectiveNames,
|
|
119758
|
+
containingFileName,
|
|
119759
|
+
redirectedReference,
|
|
119760
|
+
options,
|
|
119761
|
+
containingSourceFile,
|
|
119762
|
+
reusedNames
|
|
119763
|
+
);
|
|
119704
119764
|
mark("afterResolveTypeReference");
|
|
119705
119765
|
measure("ResolveTypeReference", "beforeResolveTypeReference", "afterResolveTypeReference");
|
|
119706
119766
|
(_b2 = tracing) == null ? void 0 : _b2.pop();
|
|
@@ -119770,144 +119830,123 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119770
119830
|
}
|
|
119771
119831
|
return classifiableNames;
|
|
119772
119832
|
}
|
|
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);
|
|
119833
|
+
function resolveModuleNamesReusingOldState(moduleNames, containingFile) {
|
|
119834
|
+
return resolveNamesReusingOldState({
|
|
119835
|
+
entries: moduleNames,
|
|
119836
|
+
containingFile,
|
|
119837
|
+
containingSourceFile: containingFile,
|
|
119838
|
+
redirectedReference: getRedirectReferenceForResolution(containingFile),
|
|
119839
|
+
nameAndModeGetter: moduleResolutionNameAndModeGetter,
|
|
119840
|
+
resolutionWorker: resolveModuleNamesWorker,
|
|
119841
|
+
getResolutionFromOldProgram: (name, mode) => oldProgram == null ? void 0 : oldProgram.getResolvedModule(containingFile, name, mode),
|
|
119842
|
+
getResolved: getResolvedModuleFromResolution,
|
|
119843
|
+
canReuseResolutionsInFile: () => containingFile === (oldProgram == null ? void 0 : oldProgram.getSourceFile(containingFile.fileName)) && !hasInvalidatedResolutions(containingFile.path),
|
|
119844
|
+
isEntryResolvingToAmbientModule: moduleNameResolvesToAmbientModule
|
|
119845
|
+
});
|
|
119846
|
+
}
|
|
119847
|
+
function moduleNameResolvesToAmbientModule(moduleName, file) {
|
|
119848
|
+
if (contains(file.ambientModuleNames, moduleName.text)) {
|
|
119849
|
+
if (isTraceEnabled(options, host)) {
|
|
119850
|
+
trace(host, Diagnostics.Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1, moduleName.text, getNormalizedAbsolutePath(file.originalFileName, currentDirectory));
|
|
119820
119851
|
}
|
|
119852
|
+
return true;
|
|
119853
|
+
} else {
|
|
119854
|
+
return moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName, file);
|
|
119821
119855
|
}
|
|
119822
|
-
|
|
119823
|
-
|
|
119824
|
-
|
|
119825
|
-
|
|
119856
|
+
}
|
|
119857
|
+
function moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName, file) {
|
|
119858
|
+
var _a2;
|
|
119859
|
+
const resolutionToFile = (_a2 = oldProgram == null ? void 0 : oldProgram.getResolvedModule(file, moduleName.text, getModeForUsageLocation2(file, moduleName))) == null ? void 0 : _a2.resolvedModule;
|
|
119860
|
+
const resolvedFile = resolutionToFile && oldProgram.getSourceFile(resolutionToFile.resolvedFileName);
|
|
119861
|
+
if (resolutionToFile && resolvedFile) {
|
|
119862
|
+
return false;
|
|
119826
119863
|
}
|
|
119827
|
-
|
|
119828
|
-
|
|
119829
|
-
|
|
119830
|
-
result[i] = resolutions[j];
|
|
119831
|
-
j++;
|
|
119832
|
-
}
|
|
119864
|
+
const unmodifiedFile = ambientModuleNameToUnmodifiedFileName.get(moduleName.text);
|
|
119865
|
+
if (!unmodifiedFile) {
|
|
119866
|
+
return false;
|
|
119833
119867
|
}
|
|
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;
|
|
119868
|
+
if (isTraceEnabled(options, host)) {
|
|
119869
|
+
trace(host, Diagnostics.Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified, moduleName.text, unmodifiedFile);
|
|
119851
119870
|
}
|
|
119871
|
+
return true;
|
|
119852
119872
|
}
|
|
119853
119873
|
function resolveTypeReferenceDirectiveNamesReusingOldState(typeDirectiveNames, containingFile) {
|
|
119854
|
-
|
|
119855
|
-
|
|
119856
|
-
|
|
119857
|
-
|
|
119874
|
+
const containingSourceFile = !isString(containingFile) ? containingFile : void 0;
|
|
119875
|
+
return resolveNamesReusingOldState({
|
|
119876
|
+
entries: typeDirectiveNames,
|
|
119877
|
+
containingFile,
|
|
119878
|
+
containingSourceFile,
|
|
119879
|
+
redirectedReference: containingSourceFile && getRedirectReferenceForResolution(containingSourceFile),
|
|
119880
|
+
nameAndModeGetter: typeReferenceResolutionNameAndModeGetter,
|
|
119881
|
+
resolutionWorker: resolveTypeReferenceDirectiveNamesWorker,
|
|
119882
|
+
getResolutionFromOldProgram: (name, mode) => {
|
|
119883
|
+
var _a2;
|
|
119884
|
+
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);
|
|
119885
|
+
},
|
|
119886
|
+
getResolved: getResolvedTypeReferenceDirectiveFromResolution,
|
|
119887
|
+
canReuseResolutionsInFile: () => containingSourceFile ? containingSourceFile === (oldProgram == null ? void 0 : oldProgram.getSourceFile(containingSourceFile.fileName)) && !hasInvalidatedResolutions(containingSourceFile.path) : !hasInvalidatedResolutions(toPath3(containingFile))
|
|
119888
|
+
});
|
|
119889
|
+
}
|
|
119890
|
+
function resolveNamesReusingOldState({
|
|
119891
|
+
entries,
|
|
119892
|
+
containingFile,
|
|
119893
|
+
containingSourceFile,
|
|
119894
|
+
redirectedReference,
|
|
119895
|
+
nameAndModeGetter,
|
|
119896
|
+
resolutionWorker,
|
|
119897
|
+
getResolutionFromOldProgram,
|
|
119898
|
+
getResolved,
|
|
119899
|
+
canReuseResolutionsInFile,
|
|
119900
|
+
isEntryResolvingToAmbientModule
|
|
119901
|
+
}) {
|
|
119902
|
+
if (!entries.length) return emptyArray;
|
|
119903
|
+
if (structureIsReused === 0 /* Not */ && (!isEntryResolvingToAmbientModule || !containingSourceFile.ambientModuleNames.length)) {
|
|
119904
|
+
return resolutionWorker(
|
|
119905
|
+
entries,
|
|
119858
119906
|
containingFile,
|
|
119859
119907
|
/*reusedNames*/
|
|
119860
119908
|
void 0
|
|
119861
119909
|
);
|
|
119862
119910
|
}
|
|
119863
|
-
let
|
|
119911
|
+
let unknownEntries;
|
|
119912
|
+
let unknownEntryIndices;
|
|
119864
119913
|
let result;
|
|
119865
119914
|
let reusedNames;
|
|
119866
|
-
const
|
|
119867
|
-
|
|
119868
|
-
|
|
119869
|
-
|
|
119870
|
-
|
|
119871
|
-
|
|
119872
|
-
const
|
|
119873
|
-
const
|
|
119874
|
-
|
|
119875
|
-
if (oldResolution == null ? void 0 : oldResolution.resolvedTypeReferenceDirective) {
|
|
119915
|
+
const reuseResolutions = canReuseResolutionsInFile();
|
|
119916
|
+
for (let i = 0; i < entries.length; i++) {
|
|
119917
|
+
const entry = entries[i];
|
|
119918
|
+
if (reuseResolutions) {
|
|
119919
|
+
const name = nameAndModeGetter.getName(entry);
|
|
119920
|
+
const mode = nameAndModeGetter.getMode(entry, containingSourceFile, (redirectedReference == null ? void 0 : redirectedReference.commandLine.options) ?? options);
|
|
119921
|
+
const oldResolution = getResolutionFromOldProgram(name, mode);
|
|
119922
|
+
const oldResolved = oldResolution && getResolved(oldResolution);
|
|
119923
|
+
if (oldResolved) {
|
|
119876
119924
|
if (isTraceEnabled(options, host)) {
|
|
119877
119925
|
trace(
|
|
119878
119926
|
host,
|
|
119879
|
-
|
|
119880
|
-
|
|
119881
|
-
|
|
119882
|
-
|
|
119883
|
-
|
|
119927
|
+
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,
|
|
119928
|
+
name,
|
|
119929
|
+
containingSourceFile ? getNormalizedAbsolutePath(containingSourceFile.originalFileName, currentDirectory) : containingFile,
|
|
119930
|
+
oldResolved.resolvedFileName,
|
|
119931
|
+
oldResolved.packageId && packageIdToString(oldResolved.packageId)
|
|
119884
119932
|
);
|
|
119885
119933
|
}
|
|
119886
|
-
(result ?? (result = new Array(
|
|
119934
|
+
(result ?? (result = new Array(entries.length)))[i] = oldResolution;
|
|
119887
119935
|
(reusedNames ?? (reusedNames = [])).push(entry);
|
|
119888
119936
|
continue;
|
|
119889
119937
|
}
|
|
119890
119938
|
}
|
|
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++;
|
|
119939
|
+
if (isEntryResolvingToAmbientModule == null ? void 0 : isEntryResolvingToAmbientModule(entry, containingFile)) {
|
|
119940
|
+
(result ?? (result = new Array(entries.length)))[i] = emptyResolution;
|
|
119941
|
+
} else {
|
|
119942
|
+
(unknownEntries ?? (unknownEntries = [])).push(entry);
|
|
119943
|
+
(unknownEntryIndices ?? (unknownEntryIndices = [])).push(i);
|
|
119908
119944
|
}
|
|
119909
119945
|
}
|
|
119910
|
-
|
|
119946
|
+
if (!unknownEntries) return result;
|
|
119947
|
+
const resolutions = resolutionWorker(unknownEntries, containingFile, reusedNames);
|
|
119948
|
+
if (!result) return resolutions;
|
|
119949
|
+
resolutions.forEach((resolution, index) => result[unknownEntryIndices[index]] = resolution);
|
|
119911
119950
|
return result;
|
|
119912
119951
|
}
|
|
119913
119952
|
function canReuseProjectReferences() {
|
|
@@ -124543,12 +124582,6 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
124543
124582
|
clear: clear2,
|
|
124544
124583
|
onChangesAffectModuleResolution
|
|
124545
124584
|
};
|
|
124546
|
-
function getResolvedModule(resolution) {
|
|
124547
|
-
return resolution.resolvedModule;
|
|
124548
|
-
}
|
|
124549
|
-
function getResolvedTypeReferenceDirective(resolution) {
|
|
124550
|
-
return resolution.resolvedTypeReferenceDirective;
|
|
124551
|
-
}
|
|
124552
124585
|
function clear2() {
|
|
124553
124586
|
clearMap(directoryWatchesOfFailedLookups, closeFileWatcherOf);
|
|
124554
124587
|
clearMap(fileWatchesOfAffectingLocations, closeFileWatcherOf);
|
|
@@ -124630,7 +124663,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
124630
124663
|
stopWatchFailedLookupLocationOfResolution(
|
|
124631
124664
|
resolution,
|
|
124632
124665
|
resolutionHost.toPath(getInferredLibraryNameResolveFrom(resolutionHost.getCompilationSettings(), getCurrentDirectory(), libFileName)),
|
|
124633
|
-
|
|
124666
|
+
getResolvedModuleFromResolution
|
|
124634
124667
|
);
|
|
124635
124668
|
resolvedLibraries.delete(libFileName);
|
|
124636
124669
|
}
|
|
@@ -124810,7 +124843,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
124810
124843
|
getModuleResolutionHost(resolutionHost),
|
|
124811
124844
|
typeReferenceDirectiveResolutionCache
|
|
124812
124845
|
),
|
|
124813
|
-
getResolutionWithResolvedFileName:
|
|
124846
|
+
getResolutionWithResolvedFileName: getResolvedTypeReferenceDirectiveFromResolution,
|
|
124814
124847
|
shouldRetryResolution: (resolution) => resolution.resolvedTypeReferenceDirective === void 0,
|
|
124815
124848
|
deferWatchingNonRelativeResolution: false
|
|
124816
124849
|
});
|
|
@@ -124831,7 +124864,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
124831
124864
|
resolutionHost,
|
|
124832
124865
|
moduleResolutionCache
|
|
124833
124866
|
),
|
|
124834
|
-
getResolutionWithResolvedFileName:
|
|
124867
|
+
getResolutionWithResolvedFileName: getResolvedModuleFromResolution,
|
|
124835
124868
|
shouldRetryResolution: (resolution) => !resolution.resolvedModule || !resolutionExtensionIsTSOrJson(resolution.resolvedModule.extension),
|
|
124836
124869
|
logChanges: logChangesWhenResolvingModule,
|
|
124837
124870
|
deferWatchingNonRelativeResolution: true
|
|
@@ -124849,17 +124882,17 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
124849
124882
|
libraryName,
|
|
124850
124883
|
resolution,
|
|
124851
124884
|
path,
|
|
124852
|
-
|
|
124885
|
+
getResolvedModuleFromResolution,
|
|
124853
124886
|
/*deferWatchingNonRelativeResolution*/
|
|
124854
124887
|
false
|
|
124855
124888
|
);
|
|
124856
124889
|
resolvedLibraries.set(libFileName, resolution);
|
|
124857
124890
|
if (existingResolution) {
|
|
124858
|
-
stopWatchFailedLookupLocationOfResolution(existingResolution, path,
|
|
124891
|
+
stopWatchFailedLookupLocationOfResolution(existingResolution, path, getResolvedModuleFromResolution);
|
|
124859
124892
|
}
|
|
124860
124893
|
} else {
|
|
124861
124894
|
if (isTraceEnabled(options, host)) {
|
|
124862
|
-
const resolved =
|
|
124895
|
+
const resolved = getResolvedModuleFromResolution(resolution);
|
|
124863
124896
|
trace(
|
|
124864
124897
|
host,
|
|
124865
124898
|
(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 +124931,20 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
124898
124931
|
return endsWith(dirPath, "/node_modules/@types");
|
|
124899
124932
|
}
|
|
124900
124933
|
function watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, filePath, getResolutionWithResolvedFileName, deferWatchingNonRelativeResolution) {
|
|
124901
|
-
|
|
124902
|
-
if (resolution.
|
|
124903
|
-
|
|
124904
|
-
|
|
124934
|
+
(resolution.files ?? (resolution.files = /* @__PURE__ */ new Set())).add(filePath);
|
|
124935
|
+
if (resolution.files.size !== 1) return;
|
|
124936
|
+
if (!deferWatchingNonRelativeResolution || isExternalModuleNameRelative(name)) {
|
|
124937
|
+
watchFailedLookupLocationOfResolution(resolution);
|
|
124905
124938
|
} 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
|
-
}
|
|
124939
|
+
nonRelativeExternalModuleResolutions.add(name, resolution);
|
|
124940
|
+
}
|
|
124941
|
+
const resolved = getResolutionWithResolvedFileName(resolution);
|
|
124942
|
+
if (resolved && resolved.resolvedFileName) {
|
|
124943
|
+
const key = resolutionHost.toPath(resolved.resolvedFileName);
|
|
124944
|
+
let resolutions = resolvedFileToResolution.get(key);
|
|
124945
|
+
if (!resolutions) resolvedFileToResolution.set(key, resolutions = /* @__PURE__ */ new Set());
|
|
124946
|
+
resolutions.add(resolution);
|
|
124920
124947
|
}
|
|
124921
|
-
(resolution.files ?? (resolution.files = /* @__PURE__ */ new Set())).add(filePath);
|
|
124922
124948
|
}
|
|
124923
124949
|
function watchFailedLookupLocation(failedLookupLocation, setAtRoot) {
|
|
124924
124950
|
const failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
|
|
@@ -124943,7 +124969,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
124943
124969
|
return setAtRoot;
|
|
124944
124970
|
}
|
|
124945
124971
|
function watchFailedLookupLocationOfResolution(resolution) {
|
|
124946
|
-
|
|
124972
|
+
var _a;
|
|
124973
|
+
Debug.assert(!!((_a = resolution.files) == null ? void 0 : _a.size));
|
|
124947
124974
|
const { failedLookupLocations, affectingLocations, alternateResult } = resolution;
|
|
124948
124975
|
if (!(failedLookupLocations == null ? void 0 : failedLookupLocations.length) && !(affectingLocations == null ? void 0 : affectingLocations.length) && !alternateResult) return;
|
|
124949
124976
|
if ((failedLookupLocations == null ? void 0 : failedLookupLocations.length) || alternateResult) resolutionsWithFailedLookups.add(resolution);
|
|
@@ -124969,7 +124996,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
124969
124996
|
watchAffectingLocationsOfResolution(resolution, !(failedLookupLocations == null ? void 0 : failedLookupLocations.length) && !alternateResult);
|
|
124970
124997
|
}
|
|
124971
124998
|
function watchAffectingLocationsOfResolution(resolution, addToResolutionsWithOnlyAffectingLocations) {
|
|
124972
|
-
|
|
124999
|
+
var _a;
|
|
125000
|
+
Debug.assert(!!((_a = resolution.files) == null ? void 0 : _a.size));
|
|
124973
125001
|
const { affectingLocations } = resolution;
|
|
124974
125002
|
if (!(affectingLocations == null ? void 0 : affectingLocations.length)) return;
|
|
124975
125003
|
if (addToResolutionsWithOnlyAffectingLocations) resolutionsWithOnlyAffectingLocations.add(resolution);
|
|
@@ -125156,10 +125184,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
125156
125184
|
}
|
|
125157
125185
|
function stopWatchFailedLookupLocationOfResolution(resolution, filePath, getResolutionWithResolvedFileName, syncDirWatcherRemove) {
|
|
125158
125186
|
Debug.checkDefined(resolution.files).delete(filePath);
|
|
125159
|
-
resolution.
|
|
125160
|
-
|
|
125161
|
-
return;
|
|
125162
|
-
}
|
|
125187
|
+
if (resolution.files.size) return;
|
|
125188
|
+
resolution.files = void 0;
|
|
125163
125189
|
const resolved = getResolutionWithResolvedFileName(resolution);
|
|
125164
125190
|
if (resolved && resolved.resolvedFileName) {
|
|
125165
125191
|
const key = resolutionHost.toPath(resolved.resolvedFileName);
|
|
@@ -125224,8 +125250,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
125224
125250
|
resolvedProjectReference.commandLine.fileNames.forEach((f) => removeResolutionsOfFile(resolutionHost.toPath(f)));
|
|
125225
125251
|
}
|
|
125226
125252
|
function removeResolutionsOfFile(filePath, syncDirWatcherRemove) {
|
|
125227
|
-
removeResolutionsOfFileFromCache(resolvedModuleNames, filePath,
|
|
125228
|
-
removeResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath,
|
|
125253
|
+
removeResolutionsOfFileFromCache(resolvedModuleNames, filePath, getResolvedModuleFromResolution, syncDirWatcherRemove);
|
|
125254
|
+
removeResolutionsOfFileFromCache(resolvedTypeReferenceDirectives, filePath, getResolvedTypeReferenceDirectiveFromResolution, syncDirWatcherRemove);
|
|
125229
125255
|
}
|
|
125230
125256
|
function invalidateResolutions(resolutions, canInvalidate) {
|
|
125231
125257
|
if (!resolutions) return false;
|