typescript 4.8.0-dev.20220801 → 4.8.0-dev.20220804
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/lib.es2015.promise.d.ts +9 -4
- package/lib/lib.es5.d.ts +2 -2
- package/lib/tsc.js +433 -226
- package/lib/tsserver.js +576 -294
- package/lib/tsserverlibrary.d.ts +16 -10
- package/lib/tsserverlibrary.js +576 -294
- package/lib/typescript.d.ts +16 -10
- package/lib/typescript.js +571 -289
- package/lib/typescriptServices.d.ts +16 -10
- package/lib/typescriptServices.js +571 -289
- package/lib/typingsInstaller.js +527 -256
- package/package.json +4 -1
package/lib/tsc.js
CHANGED
|
@@ -69,7 +69,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
69
69
|
var ts;
|
|
70
70
|
(function (ts) {
|
|
71
71
|
ts.versionMajorMinor = "4.8";
|
|
72
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
72
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220804";
|
|
73
73
|
var NativeCollections;
|
|
74
74
|
(function (NativeCollections) {
|
|
75
75
|
var globals = typeof globalThis !== "undefined" ? globalThis :
|
|
@@ -5727,6 +5727,10 @@ var ts;
|
|
|
5727
5727
|
resolution_mode_is_the_only_valid_key_for_type_import_assertions: diag(1455, ts.DiagnosticCategory.Error, "resolution_mode_is_the_only_valid_key_for_type_import_assertions_1455", "`resolution-mode` is the only valid key for type import assertions."),
|
|
5728
5728
|
Type_import_assertions_should_have_exactly_one_key_resolution_mode_with_value_import_or_require: diag(1456, ts.DiagnosticCategory.Error, "Type_import_assertions_should_have_exactly_one_key_resolution_mode_with_value_import_or_require_1456", "Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`."),
|
|
5729
5729
|
Matched_by_default_include_pattern_Asterisk_Asterisk_Slash_Asterisk: diag(1457, ts.DiagnosticCategory.Message, "Matched_by_default_include_pattern_Asterisk_Asterisk_Slash_Asterisk_1457", "Matched by default include pattern '**/*'"),
|
|
5730
|
+
File_is_ECMAScript_module_because_0_has_field_type_with_value_module: diag(1458, ts.DiagnosticCategory.Message, "File_is_ECMAScript_module_because_0_has_field_type_with_value_module_1458", "File is ECMAScript module because '{0}' has field \"type\" with value \"module\""),
|
|
5731
|
+
File_is_CommonJS_module_because_0_has_field_type_whose_value_is_not_module: diag(1459, ts.DiagnosticCategory.Message, "File_is_CommonJS_module_because_0_has_field_type_whose_value_is_not_module_1459", "File is CommonJS module because '{0}' has field \"type\" whose value is not \"module\""),
|
|
5732
|
+
File_is_CommonJS_module_because_0_does_not_have_field_type: diag(1460, ts.DiagnosticCategory.Message, "File_is_CommonJS_module_because_0_does_not_have_field_type_1460", "File is CommonJS module because '{0}' does not have field \"type\""),
|
|
5733
|
+
File_is_CommonJS_module_because_package_json_was_not_found: diag(1461, ts.DiagnosticCategory.Message, "File_is_CommonJS_module_because_package_json_was_not_found_1461", "File is CommonJS module because 'package.json' was not found"),
|
|
5730
5734
|
The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output: diag(1470, ts.DiagnosticCategory.Error, "The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output_1470", "The 'import.meta' meta-property is not allowed in files which will build into CommonJS output."),
|
|
5731
5735
|
Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_synchronously_Use_dynamic_import_instead: diag(1471, ts.DiagnosticCategory.Error, "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471", "Module '{0}' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported synchronously. Use dynamic import instead."),
|
|
5732
5736
|
catch_or_finally_expected: diag(1472, ts.DiagnosticCategory.Error, "catch_or_finally_expected_1472", "'catch' or 'finally' expected."),
|
|
@@ -17379,10 +17383,11 @@ var ts;
|
|
|
17379
17383
|
}
|
|
17380
17384
|
return parenthesizeLeftSideOfAccess(expression);
|
|
17381
17385
|
}
|
|
17382
|
-
function parenthesizeLeftSideOfAccess(expression) {
|
|
17386
|
+
function parenthesizeLeftSideOfAccess(expression, optionalChain) {
|
|
17383
17387
|
var emittedExpression = ts.skipPartiallyEmittedExpressions(expression);
|
|
17384
17388
|
if (ts.isLeftHandSideExpression(emittedExpression)
|
|
17385
|
-
&& (emittedExpression.kind !== 209 || emittedExpression.arguments)
|
|
17389
|
+
&& (emittedExpression.kind !== 209 || emittedExpression.arguments)
|
|
17390
|
+
&& (optionalChain || !ts.isOptionalChain(emittedExpression))) {
|
|
17386
17391
|
return expression;
|
|
17387
17392
|
}
|
|
17388
17393
|
return ts.setTextRange(factory.createParenthesizedExpression(expression), expression);
|
|
@@ -18592,7 +18597,7 @@ var ts;
|
|
|
18592
18597
|
}
|
|
18593
18598
|
function createDecorator(expression) {
|
|
18594
18599
|
var node = createBaseNode(165);
|
|
18595
|
-
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression);
|
|
18600
|
+
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, false);
|
|
18596
18601
|
node.transformFlags |=
|
|
18597
18602
|
propagateChildFlags(node.expression) |
|
|
18598
18603
|
1 |
|
|
@@ -19266,7 +19271,7 @@ var ts;
|
|
|
19266
19271
|
}
|
|
19267
19272
|
function createPropertyAccessExpression(expression, name) {
|
|
19268
19273
|
var node = createBaseExpression(206);
|
|
19269
|
-
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression);
|
|
19274
|
+
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, false);
|
|
19270
19275
|
node.name = asName(name);
|
|
19271
19276
|
node.transformFlags =
|
|
19272
19277
|
propagateChildFlags(node.expression) |
|
|
@@ -19292,7 +19297,7 @@ var ts;
|
|
|
19292
19297
|
function createPropertyAccessChain(expression, questionDotToken, name) {
|
|
19293
19298
|
var node = createBaseExpression(206);
|
|
19294
19299
|
node.flags |= 32;
|
|
19295
|
-
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression);
|
|
19300
|
+
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, true);
|
|
19296
19301
|
node.questionDotToken = questionDotToken;
|
|
19297
19302
|
node.name = asName(name);
|
|
19298
19303
|
node.transformFlags |=
|
|
@@ -19314,7 +19319,7 @@ var ts;
|
|
|
19314
19319
|
}
|
|
19315
19320
|
function createElementAccessExpression(expression, index) {
|
|
19316
19321
|
var node = createBaseExpression(207);
|
|
19317
|
-
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression);
|
|
19322
|
+
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, false);
|
|
19318
19323
|
node.argumentExpression = asExpression(index);
|
|
19319
19324
|
node.transformFlags |=
|
|
19320
19325
|
propagateChildFlags(node.expression) |
|
|
@@ -19338,7 +19343,7 @@ var ts;
|
|
|
19338
19343
|
function createElementAccessChain(expression, questionDotToken, index) {
|
|
19339
19344
|
var node = createBaseExpression(207);
|
|
19340
19345
|
node.flags |= 32;
|
|
19341
|
-
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression);
|
|
19346
|
+
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, true);
|
|
19342
19347
|
node.questionDotToken = questionDotToken;
|
|
19343
19348
|
node.argumentExpression = asExpression(index);
|
|
19344
19349
|
node.transformFlags |=
|
|
@@ -19358,7 +19363,7 @@ var ts;
|
|
|
19358
19363
|
}
|
|
19359
19364
|
function createCallExpression(expression, typeArguments, argumentsArray) {
|
|
19360
19365
|
var node = createBaseExpression(208);
|
|
19361
|
-
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression);
|
|
19366
|
+
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, false);
|
|
19362
19367
|
node.typeArguments = asNodeArray(typeArguments);
|
|
19363
19368
|
node.arguments = parenthesizerRules().parenthesizeExpressionsOfCommaDelimitedList(createNodeArray(argumentsArray));
|
|
19364
19369
|
node.transformFlags |=
|
|
@@ -19389,7 +19394,7 @@ var ts;
|
|
|
19389
19394
|
function createCallChain(expression, questionDotToken, typeArguments, argumentsArray) {
|
|
19390
19395
|
var node = createBaseExpression(208);
|
|
19391
19396
|
node.flags |= 32;
|
|
19392
|
-
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression);
|
|
19397
|
+
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, true);
|
|
19393
19398
|
node.questionDotToken = questionDotToken;
|
|
19394
19399
|
node.typeArguments = asNodeArray(typeArguments);
|
|
19395
19400
|
node.arguments = parenthesizerRules().parenthesizeExpressionsOfCommaDelimitedList(createNodeArray(argumentsArray));
|
|
@@ -19440,7 +19445,7 @@ var ts;
|
|
|
19440
19445
|
}
|
|
19441
19446
|
function createTaggedTemplateExpression(tag, typeArguments, template) {
|
|
19442
19447
|
var node = createBaseExpression(210);
|
|
19443
|
-
node.tag = parenthesizerRules().parenthesizeLeftSideOfAccess(tag);
|
|
19448
|
+
node.tag = parenthesizerRules().parenthesizeLeftSideOfAccess(tag, false);
|
|
19444
19449
|
node.typeArguments = asNodeArray(typeArguments);
|
|
19445
19450
|
node.template = template;
|
|
19446
19451
|
node.transformFlags |=
|
|
@@ -19829,7 +19834,7 @@ var ts;
|
|
|
19829
19834
|
}
|
|
19830
19835
|
function createExpressionWithTypeArguments(expression, typeArguments) {
|
|
19831
19836
|
var node = createBaseNode(228);
|
|
19832
|
-
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression);
|
|
19837
|
+
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, false);
|
|
19833
19838
|
node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(typeArguments);
|
|
19834
19839
|
node.transformFlags |=
|
|
19835
19840
|
propagateChildFlags(node.expression) |
|
|
@@ -19861,7 +19866,7 @@ var ts;
|
|
|
19861
19866
|
}
|
|
19862
19867
|
function createNonNullExpression(expression) {
|
|
19863
19868
|
var node = createBaseExpression(230);
|
|
19864
|
-
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression);
|
|
19869
|
+
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, false);
|
|
19865
19870
|
node.transformFlags |=
|
|
19866
19871
|
propagateChildFlags(node.expression) |
|
|
19867
19872
|
1;
|
|
@@ -19878,7 +19883,7 @@ var ts;
|
|
|
19878
19883
|
function createNonNullChain(expression) {
|
|
19879
19884
|
var node = createBaseExpression(230);
|
|
19880
19885
|
node.flags |= 32;
|
|
19881
|
-
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression);
|
|
19886
|
+
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, true);
|
|
19882
19887
|
node.transformFlags |=
|
|
19883
19888
|
propagateChildFlags(node.expression) |
|
|
19884
19889
|
1;
|
|
@@ -21721,7 +21726,7 @@ var ts;
|
|
|
21721
21726
|
}
|
|
21722
21727
|
else if (ts.getEmitFlags(callee) & 4096) {
|
|
21723
21728
|
thisArg = createVoidZero();
|
|
21724
|
-
target = parenthesizerRules().parenthesizeLeftSideOfAccess(callee);
|
|
21729
|
+
target = parenthesizerRules().parenthesizeLeftSideOfAccess(callee, false);
|
|
21725
21730
|
}
|
|
21726
21731
|
else if (ts.isPropertyAccessExpression(callee)) {
|
|
21727
21732
|
if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) {
|
|
@@ -21747,7 +21752,7 @@ var ts;
|
|
|
21747
21752
|
}
|
|
21748
21753
|
else {
|
|
21749
21754
|
thisArg = createVoidZero();
|
|
21750
|
-
target = parenthesizerRules().parenthesizeLeftSideOfAccess(expression);
|
|
21755
|
+
target = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, false);
|
|
21751
21756
|
}
|
|
21752
21757
|
return { target: target, thisArg: thisArg };
|
|
21753
21758
|
}
|
|
@@ -35334,7 +35339,7 @@ var ts;
|
|
|
35334
35339
|
ts.createCacheWithRedirects = createCacheWithRedirects;
|
|
35335
35340
|
function createPackageJsonInfoCache(currentDirectory, getCanonicalFileName) {
|
|
35336
35341
|
var cache;
|
|
35337
|
-
return { getPackageJsonInfo: getPackageJsonInfo, setPackageJsonInfo: setPackageJsonInfo, clear: clear, entries: entries };
|
|
35342
|
+
return { getPackageJsonInfo: getPackageJsonInfo, setPackageJsonInfo: setPackageJsonInfo, clear: clear, entries: entries, getInternalMap: getInternalMap };
|
|
35338
35343
|
function getPackageJsonInfo(packageJsonPath) {
|
|
35339
35344
|
return cache === null || cache === void 0 ? void 0 : cache.get(ts.toPath(packageJsonPath, currentDirectory, getCanonicalFileName));
|
|
35340
35345
|
}
|
|
@@ -35348,6 +35353,9 @@ var ts;
|
|
|
35348
35353
|
var iter = cache === null || cache === void 0 ? void 0 : cache.entries();
|
|
35349
35354
|
return iter ? ts.arrayFrom(iter) : [];
|
|
35350
35355
|
}
|
|
35356
|
+
function getInternalMap() {
|
|
35357
|
+
return cache;
|
|
35358
|
+
}
|
|
35351
35359
|
}
|
|
35352
35360
|
function getOrCreateCache(cacheWithRedirects, redirectedReference, key, create) {
|
|
35353
35361
|
var cache = cacheWithRedirects.getOrCreateMapOfCacheRedirects(redirectedReference);
|
|
@@ -35446,15 +35454,18 @@ var ts;
|
|
|
35446
35454
|
}
|
|
35447
35455
|
ts.zipToModeAwareCache = zipToModeAwareCache;
|
|
35448
35456
|
function createModuleResolutionCache(currentDirectory, getCanonicalFileName, options, directoryToModuleNameMap, moduleNameToDirectoryMap) {
|
|
35449
|
-
var
|
|
35457
|
+
var perDirectoryResolutionCache = createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, directoryToModuleNameMap || (directoryToModuleNameMap = createCacheWithRedirects(options)));
|
|
35450
35458
|
moduleNameToDirectoryMap || (moduleNameToDirectoryMap = createCacheWithRedirects(options));
|
|
35451
35459
|
var packageJsonInfoCache = createPackageJsonInfoCache(currentDirectory, getCanonicalFileName);
|
|
35452
|
-
return __assign(__assign(__assign({}, packageJsonInfoCache),
|
|
35460
|
+
return __assign(__assign(__assign({}, packageJsonInfoCache), perDirectoryResolutionCache), { getOrCreateCacheForModuleName: getOrCreateCacheForModuleName, clear: clear, update: update, getPackageJsonInfoCache: function () { return packageJsonInfoCache; }, clearAllExceptPackageJsonInfoCache: clearAllExceptPackageJsonInfoCache });
|
|
35453
35461
|
function clear() {
|
|
35454
|
-
|
|
35455
|
-
moduleNameToDirectoryMap.clear();
|
|
35462
|
+
clearAllExceptPackageJsonInfoCache();
|
|
35456
35463
|
packageJsonInfoCache.clear();
|
|
35457
35464
|
}
|
|
35465
|
+
function clearAllExceptPackageJsonInfoCache() {
|
|
35466
|
+
perDirectoryResolutionCache.clear();
|
|
35467
|
+
moduleNameToDirectoryMap.clear();
|
|
35468
|
+
}
|
|
35458
35469
|
function update(options) {
|
|
35459
35470
|
updateRedirectsMap(options, directoryToModuleNameMap, moduleNameToDirectoryMap);
|
|
35460
35471
|
}
|
|
@@ -35511,13 +35522,16 @@ var ts;
|
|
|
35511
35522
|
}
|
|
35512
35523
|
ts.createModuleResolutionCache = createModuleResolutionCache;
|
|
35513
35524
|
function createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, options, packageJsonInfoCache, directoryToModuleNameMap) {
|
|
35514
|
-
var
|
|
35525
|
+
var perDirectoryResolutionCache = createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, directoryToModuleNameMap || (directoryToModuleNameMap = createCacheWithRedirects(options)));
|
|
35515
35526
|
packageJsonInfoCache || (packageJsonInfoCache = createPackageJsonInfoCache(currentDirectory, getCanonicalFileName));
|
|
35516
|
-
return __assign(__assign(__assign({}, packageJsonInfoCache),
|
|
35527
|
+
return __assign(__assign(__assign({}, packageJsonInfoCache), perDirectoryResolutionCache), { clear: clear, clearAllExceptPackageJsonInfoCache: clearAllExceptPackageJsonInfoCache });
|
|
35517
35528
|
function clear() {
|
|
35518
|
-
|
|
35529
|
+
clearAllExceptPackageJsonInfoCache();
|
|
35519
35530
|
packageJsonInfoCache.clear();
|
|
35520
35531
|
}
|
|
35532
|
+
function clearAllExceptPackageJsonInfoCache() {
|
|
35533
|
+
perDirectoryResolutionCache.clear();
|
|
35534
|
+
}
|
|
35521
35535
|
}
|
|
35522
35536
|
ts.createTypeReferenceDirectiveResolutionCache = createTypeReferenceDirectiveResolutionCache;
|
|
35523
35537
|
function resolveModuleNameFromCache(moduleName, containingFile, cache, mode) {
|
|
@@ -42105,10 +42119,6 @@ var ts;
|
|
|
42105
42119
|
checkExpressionCached(expression);
|
|
42106
42120
|
return getNodeLinks(expression).resolvedSymbol;
|
|
42107
42121
|
}
|
|
42108
|
-
function getTargetOfPropertyAssignment(node, dontRecursivelyResolve) {
|
|
42109
|
-
var expression = node.initializer;
|
|
42110
|
-
return getTargetOfAliasLikeExpression(expression, dontRecursivelyResolve);
|
|
42111
|
-
}
|
|
42112
42122
|
function getTargetOfAccessExpression(node, dontRecursivelyResolve) {
|
|
42113
42123
|
if (!(ts.isBinaryExpression(node.parent) && node.parent.left === node && node.parent.operatorToken.kind === 63)) {
|
|
42114
42124
|
return undefined;
|
|
@@ -42140,7 +42150,7 @@ var ts;
|
|
|
42140
42150
|
case 297:
|
|
42141
42151
|
return resolveEntityName(node.name, 111551 | 788968 | 1920, true, dontRecursivelyResolve);
|
|
42142
42152
|
case 296:
|
|
42143
|
-
return
|
|
42153
|
+
return getTargetOfAliasLikeExpression(node.initializer, dontRecursivelyResolve);
|
|
42144
42154
|
case 207:
|
|
42145
42155
|
case 206:
|
|
42146
42156
|
return getTargetOfAccessExpression(node, dontRecursivelyResolve);
|
|
@@ -46951,7 +46961,7 @@ var ts;
|
|
|
46951
46961
|
(resolvedSymbol || symbol).exports.forEach(function (s, name) {
|
|
46952
46962
|
var _a;
|
|
46953
46963
|
var exportedMember = members_4.get(name);
|
|
46954
|
-
if (exportedMember && exportedMember !== s) {
|
|
46964
|
+
if (exportedMember && exportedMember !== s && !(s.flags & 2097152)) {
|
|
46955
46965
|
if (s.flags & 111551 && exportedMember.flags & 111551) {
|
|
46956
46966
|
if (s.valueDeclaration && exportedMember.valueDeclaration && ts.getSourceFileOfNode(s.valueDeclaration) !== ts.getSourceFileOfNode(exportedMember.valueDeclaration)) {
|
|
46957
46967
|
var unescapedName = ts.unescapeLeadingUnderscores(s.escapedName);
|
|
@@ -52630,6 +52640,7 @@ var ts;
|
|
|
52630
52640
|
}
|
|
52631
52641
|
}
|
|
52632
52642
|
function getTypeFromImportTypeNode(node) {
|
|
52643
|
+
var _a;
|
|
52633
52644
|
var links = getNodeLinks(node);
|
|
52634
52645
|
if (!links.resolvedType) {
|
|
52635
52646
|
if (node.isTypeOf && node.typeArguments) {
|
|
@@ -52648,6 +52659,7 @@ var ts;
|
|
|
52648
52659
|
links.resolvedSymbol = unknownSymbol;
|
|
52649
52660
|
return links.resolvedType = errorType;
|
|
52650
52661
|
}
|
|
52662
|
+
var isExportEquals = !!((_a = innerModuleSymbol.exports) === null || _a === void 0 ? void 0 : _a.get("export="));
|
|
52651
52663
|
var moduleSymbol = resolveExternalModuleSymbol(innerModuleSymbol, false);
|
|
52652
52664
|
if (!ts.nodeIsMissing(node.qualifier)) {
|
|
52653
52665
|
var nameStack = getIdentifierChain(node.qualifier);
|
|
@@ -52656,9 +52668,11 @@ var ts;
|
|
|
52656
52668
|
while (current = nameStack.shift()) {
|
|
52657
52669
|
var meaning = nameStack.length ? 1920 : targetMeaning;
|
|
52658
52670
|
var mergedResolvedSymbol = getMergedSymbol(resolveSymbol(currentNamespace));
|
|
52659
|
-
var
|
|
52671
|
+
var symbolFromVariable = node.isTypeOf || ts.isInJSFile(node) && isExportEquals
|
|
52660
52672
|
? getPropertyOfType(getTypeOfSymbol(mergedResolvedSymbol), current.escapedText, false, true)
|
|
52661
|
-
:
|
|
52673
|
+
: undefined;
|
|
52674
|
+
var symbolFromModule = node.isTypeOf ? undefined : getSymbol(getExportsOfSymbol(mergedResolvedSymbol), current.escapedText, meaning);
|
|
52675
|
+
var next = symbolFromModule !== null && symbolFromModule !== void 0 ? symbolFromModule : symbolFromVariable;
|
|
52662
52676
|
if (!next) {
|
|
52663
52677
|
error(current, ts.Diagnostics.Namespace_0_has_no_exported_member_1, getFullyQualifiedName(currentNamespace), ts.declarationNameToString(current));
|
|
52664
52678
|
return links.resolvedType = errorType;
|
|
@@ -55213,6 +55227,12 @@ var ts;
|
|
|
55213
55227
|
function structuredTypeRelatedTo(source, target, reportErrors, intersectionState) {
|
|
55214
55228
|
var saveErrorInfo = captureErrorCalculationState();
|
|
55215
55229
|
var result = structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState, saveErrorInfo);
|
|
55230
|
+
if (!result && (source.flags & 2097152 || source.flags & 262144 && target.flags & 1048576)) {
|
|
55231
|
+
var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 ? source.types : [source], !!(target.flags & 1048576));
|
|
55232
|
+
if (constraint && everyType(constraint, function (c) { return c !== source; })) {
|
|
55233
|
+
result = isRelatedTo(constraint, target, 1, false, undefined, intersectionState);
|
|
55234
|
+
}
|
|
55235
|
+
}
|
|
55216
55236
|
if (result) {
|
|
55217
55237
|
resetErrorInfo(saveErrorInfo);
|
|
55218
55238
|
}
|
|
@@ -55269,14 +55289,6 @@ var ts;
|
|
|
55269
55289
|
if (result = unionOrIntersectionRelatedTo(source, target, reportErrors, intersectionState)) {
|
|
55270
55290
|
return result;
|
|
55271
55291
|
}
|
|
55272
|
-
if (source.flags & 2097152 || source.flags & 262144 && target.flags & 1048576) {
|
|
55273
|
-
var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 ? source.types : [source], !!(target.flags & 1048576));
|
|
55274
|
-
if (constraint && everyType(constraint, function (c) { return c !== source; })) {
|
|
55275
|
-
if (result = isRelatedTo(constraint, target, 1, false, undefined, intersectionState)) {
|
|
55276
|
-
return result;
|
|
55277
|
-
}
|
|
55278
|
-
}
|
|
55279
|
-
}
|
|
55280
55292
|
if (!(sourceFlags & 465829888 ||
|
|
55281
55293
|
sourceFlags & 524288 && targetFlags & 1048576 ||
|
|
55282
55294
|
sourceFlags & 2097152 && targetFlags & (524288 | 1048576 | 465829888))) {
|
|
@@ -68947,7 +68959,9 @@ var ts;
|
|
|
68947
68959
|
}
|
|
68948
68960
|
if (isGenericObjectType(type)) {
|
|
68949
68961
|
var baseConstraint = getBaseConstraintOfType(type);
|
|
68950
|
-
if (
|
|
68962
|
+
if (baseConstraint ?
|
|
68963
|
+
baseConstraint.flags & 3 || isEmptyObjectType(baseConstraint) || isThenableType(baseConstraint) :
|
|
68964
|
+
maybeTypeOfKind(type, 8650752)) {
|
|
68951
68965
|
return true;
|
|
68952
68966
|
}
|
|
68953
68967
|
}
|
|
@@ -70458,17 +70472,28 @@ var ts;
|
|
|
70458
70472
|
return type[cacheKey] = cachedTypes;
|
|
70459
70473
|
}
|
|
70460
70474
|
function getIterationTypesOfIterable(type, use, errorNode) {
|
|
70475
|
+
var _a, _b;
|
|
70461
70476
|
if (isTypeAny(type)) {
|
|
70462
70477
|
return anyIterationTypes;
|
|
70463
70478
|
}
|
|
70464
70479
|
if (!(type.flags & 1048576)) {
|
|
70465
|
-
var
|
|
70480
|
+
var errorOutputContainer = errorNode ? { errors: undefined } : undefined;
|
|
70481
|
+
var iterationTypes_1 = getIterationTypesOfIterableWorker(type, use, errorNode, errorOutputContainer);
|
|
70466
70482
|
if (iterationTypes_1 === noIterationTypes) {
|
|
70467
70483
|
if (errorNode) {
|
|
70468
|
-
reportTypeNotIterableError(errorNode, type, !!(use & 2));
|
|
70484
|
+
var rootDiag = reportTypeNotIterableError(errorNode, type, !!(use & 2));
|
|
70485
|
+
if (errorOutputContainer === null || errorOutputContainer === void 0 ? void 0 : errorOutputContainer.errors) {
|
|
70486
|
+
ts.addRelatedInfo.apply(void 0, __spreadArray([rootDiag], errorOutputContainer.errors, false));
|
|
70487
|
+
}
|
|
70469
70488
|
}
|
|
70470
70489
|
return undefined;
|
|
70471
70490
|
}
|
|
70491
|
+
else if ((_a = errorOutputContainer === null || errorOutputContainer === void 0 ? void 0 : errorOutputContainer.errors) === null || _a === void 0 ? void 0 : _a.length) {
|
|
70492
|
+
for (var _i = 0, _c = errorOutputContainer.errors; _i < _c.length; _i++) {
|
|
70493
|
+
var diag = _c[_i];
|
|
70494
|
+
diagnostics.add(diag);
|
|
70495
|
+
}
|
|
70496
|
+
}
|
|
70472
70497
|
return iterationTypes_1;
|
|
70473
70498
|
}
|
|
70474
70499
|
var cacheKey = use & 2 ? "iterationTypesOfAsyncIterable" : "iterationTypesOfIterable";
|
|
@@ -70476,19 +70501,27 @@ var ts;
|
|
|
70476
70501
|
if (cachedTypes)
|
|
70477
70502
|
return cachedTypes === noIterationTypes ? undefined : cachedTypes;
|
|
70478
70503
|
var allIterationTypes;
|
|
70479
|
-
for (var
|
|
70480
|
-
var constituent =
|
|
70481
|
-
var
|
|
70504
|
+
for (var _d = 0, _e = type.types; _d < _e.length; _d++) {
|
|
70505
|
+
var constituent = _e[_d];
|
|
70506
|
+
var errorOutputContainer = errorNode ? { errors: undefined } : undefined;
|
|
70507
|
+
var iterationTypes_2 = getIterationTypesOfIterableWorker(constituent, use, errorNode, errorOutputContainer);
|
|
70482
70508
|
if (iterationTypes_2 === noIterationTypes) {
|
|
70483
70509
|
if (errorNode) {
|
|
70484
|
-
reportTypeNotIterableError(errorNode, type, !!(use & 2));
|
|
70510
|
+
var rootDiag = reportTypeNotIterableError(errorNode, type, !!(use & 2));
|
|
70511
|
+
if (errorOutputContainer === null || errorOutputContainer === void 0 ? void 0 : errorOutputContainer.errors) {
|
|
70512
|
+
ts.addRelatedInfo.apply(void 0, __spreadArray([rootDiag], errorOutputContainer.errors, false));
|
|
70513
|
+
}
|
|
70485
70514
|
}
|
|
70486
70515
|
setCachedIterationTypes(type, cacheKey, noIterationTypes);
|
|
70487
70516
|
return undefined;
|
|
70488
70517
|
}
|
|
70489
|
-
else {
|
|
70490
|
-
|
|
70518
|
+
else if ((_b = errorOutputContainer === null || errorOutputContainer === void 0 ? void 0 : errorOutputContainer.errors) === null || _b === void 0 ? void 0 : _b.length) {
|
|
70519
|
+
for (var _f = 0, _g = errorOutputContainer.errors; _f < _g.length; _f++) {
|
|
70520
|
+
var diag = _g[_f];
|
|
70521
|
+
diagnostics.add(diag);
|
|
70522
|
+
}
|
|
70491
70523
|
}
|
|
70524
|
+
allIterationTypes = ts.append(allIterationTypes, iterationTypes_2);
|
|
70492
70525
|
}
|
|
70493
70526
|
var iterationTypes = allIterationTypes ? combineIterationTypes(allIterationTypes) : noIterationTypes;
|
|
70494
70527
|
setCachedIterationTypes(type, cacheKey, iterationTypes);
|
|
@@ -70505,46 +70538,57 @@ var ts;
|
|
|
70505
70538
|
}
|
|
70506
70539
|
return createIterationTypes(getAwaitedType(yieldType, errorNode) || anyType, getAwaitedType(returnType, errorNode) || anyType, nextType);
|
|
70507
70540
|
}
|
|
70508
|
-
function getIterationTypesOfIterableWorker(type, use, errorNode) {
|
|
70541
|
+
function getIterationTypesOfIterableWorker(type, use, errorNode, errorOutputContainer) {
|
|
70509
70542
|
if (isTypeAny(type)) {
|
|
70510
70543
|
return anyIterationTypes;
|
|
70511
70544
|
}
|
|
70545
|
+
var noCache = false;
|
|
70512
70546
|
if (use & 2) {
|
|
70513
70547
|
var iterationTypes = getIterationTypesOfIterableCached(type, asyncIterationTypesResolver) ||
|
|
70514
70548
|
getIterationTypesOfIterableFast(type, asyncIterationTypesResolver);
|
|
70515
70549
|
if (iterationTypes) {
|
|
70516
|
-
|
|
70517
|
-
|
|
70518
|
-
|
|
70550
|
+
if (iterationTypes === noIterationTypes && errorNode) {
|
|
70551
|
+
noCache = true;
|
|
70552
|
+
}
|
|
70553
|
+
else {
|
|
70554
|
+
return use & 8 ?
|
|
70555
|
+
getAsyncFromSyncIterationTypes(iterationTypes, errorNode) :
|
|
70556
|
+
iterationTypes;
|
|
70557
|
+
}
|
|
70519
70558
|
}
|
|
70520
70559
|
}
|
|
70521
70560
|
if (use & 1) {
|
|
70522
70561
|
var iterationTypes = getIterationTypesOfIterableCached(type, syncIterationTypesResolver) ||
|
|
70523
70562
|
getIterationTypesOfIterableFast(type, syncIterationTypesResolver);
|
|
70524
70563
|
if (iterationTypes) {
|
|
70525
|
-
if (
|
|
70526
|
-
|
|
70527
|
-
return setCachedIterationTypes(type, "iterationTypesOfAsyncIterable", getAsyncFromSyncIterationTypes(iterationTypes, errorNode));
|
|
70528
|
-
}
|
|
70564
|
+
if (iterationTypes === noIterationTypes && errorNode) {
|
|
70565
|
+
noCache = true;
|
|
70529
70566
|
}
|
|
70530
70567
|
else {
|
|
70531
|
-
|
|
70568
|
+
if (use & 2) {
|
|
70569
|
+
if (iterationTypes !== noIterationTypes) {
|
|
70570
|
+
iterationTypes = getAsyncFromSyncIterationTypes(iterationTypes, errorNode);
|
|
70571
|
+
return noCache ? iterationTypes : setCachedIterationTypes(type, "iterationTypesOfAsyncIterable", iterationTypes);
|
|
70572
|
+
}
|
|
70573
|
+
}
|
|
70574
|
+
else {
|
|
70575
|
+
return iterationTypes;
|
|
70576
|
+
}
|
|
70532
70577
|
}
|
|
70533
70578
|
}
|
|
70534
70579
|
}
|
|
70535
70580
|
if (use & 2) {
|
|
70536
|
-
var iterationTypes = getIterationTypesOfIterableSlow(type, asyncIterationTypesResolver, errorNode);
|
|
70581
|
+
var iterationTypes = getIterationTypesOfIterableSlow(type, asyncIterationTypesResolver, errorNode, errorOutputContainer, noCache);
|
|
70537
70582
|
if (iterationTypes !== noIterationTypes) {
|
|
70538
70583
|
return iterationTypes;
|
|
70539
70584
|
}
|
|
70540
70585
|
}
|
|
70541
70586
|
if (use & 1) {
|
|
70542
|
-
var iterationTypes = getIterationTypesOfIterableSlow(type, syncIterationTypesResolver, errorNode);
|
|
70587
|
+
var iterationTypes = getIterationTypesOfIterableSlow(type, syncIterationTypesResolver, errorNode, errorOutputContainer, noCache);
|
|
70543
70588
|
if (iterationTypes !== noIterationTypes) {
|
|
70544
70589
|
if (use & 2) {
|
|
70545
|
-
|
|
70546
|
-
|
|
70547
|
-
: noIterationTypes);
|
|
70590
|
+
iterationTypes = getAsyncFromSyncIterationTypes(iterationTypes, errorNode);
|
|
70591
|
+
return noCache ? iterationTypes : setCachedIterationTypes(type, "iterationTypesOfAsyncIterable", iterationTypes);
|
|
70548
70592
|
}
|
|
70549
70593
|
else {
|
|
70550
70594
|
return iterationTypes;
|
|
@@ -70558,7 +70602,7 @@ var ts;
|
|
|
70558
70602
|
}
|
|
70559
70603
|
function getIterationTypesOfGlobalIterableType(globalType, resolver) {
|
|
70560
70604
|
var globalIterationTypes = getIterationTypesOfIterableCached(globalType, resolver) ||
|
|
70561
|
-
getIterationTypesOfIterableSlow(globalType, resolver, undefined);
|
|
70605
|
+
getIterationTypesOfIterableSlow(globalType, resolver, undefined, undefined, false);
|
|
70562
70606
|
return globalIterationTypes === noIterationTypes ? defaultIterationTypes : globalIterationTypes;
|
|
70563
70607
|
}
|
|
70564
70608
|
function getIterationTypesOfIterableFast(type, resolver) {
|
|
@@ -70579,34 +70623,41 @@ var ts;
|
|
|
70579
70623
|
var uniqueType = ctorType && getTypeOfPropertyOfType(getTypeOfSymbol(ctorType), ts.escapeLeadingUnderscores(symbolName));
|
|
70580
70624
|
return uniqueType && isTypeUsableAsPropertyName(uniqueType) ? getPropertyNameFromType(uniqueType) : "__@" + symbolName;
|
|
70581
70625
|
}
|
|
70582
|
-
function getIterationTypesOfIterableSlow(type, resolver, errorNode) {
|
|
70626
|
+
function getIterationTypesOfIterableSlow(type, resolver, errorNode, errorOutputContainer, noCache) {
|
|
70583
70627
|
var _a;
|
|
70584
70628
|
var method = getPropertyOfType(type, getPropertyNameForKnownSymbolName(resolver.iteratorSymbolName));
|
|
70585
70629
|
var methodType = method && !(method.flags & 16777216) ? getTypeOfSymbol(method) : undefined;
|
|
70586
70630
|
if (isTypeAny(methodType)) {
|
|
70587
|
-
return setCachedIterationTypes(type, resolver.iterableCacheKey, anyIterationTypes);
|
|
70631
|
+
return noCache ? anyIterationTypes : setCachedIterationTypes(type, resolver.iterableCacheKey, anyIterationTypes);
|
|
70588
70632
|
}
|
|
70589
70633
|
var signatures = methodType ? getSignaturesOfType(methodType, 0) : undefined;
|
|
70590
70634
|
if (!ts.some(signatures)) {
|
|
70591
|
-
return setCachedIterationTypes(type, resolver.iterableCacheKey, noIterationTypes);
|
|
70635
|
+
return noCache ? noIterationTypes : setCachedIterationTypes(type, resolver.iterableCacheKey, noIterationTypes);
|
|
70592
70636
|
}
|
|
70593
70637
|
var iteratorType = getIntersectionType(ts.map(signatures, getReturnTypeOfSignature));
|
|
70594
|
-
var iterationTypes = (_a =
|
|
70595
|
-
return setCachedIterationTypes(type, resolver.iterableCacheKey, iterationTypes);
|
|
70638
|
+
var iterationTypes = (_a = getIterationTypesOfIteratorWorker(iteratorType, resolver, errorNode, errorOutputContainer, noCache)) !== null && _a !== void 0 ? _a : noIterationTypes;
|
|
70639
|
+
return noCache ? iterationTypes : setCachedIterationTypes(type, resolver.iterableCacheKey, iterationTypes);
|
|
70596
70640
|
}
|
|
70597
70641
|
function reportTypeNotIterableError(errorNode, type, allowAsyncIterables) {
|
|
70598
70642
|
var message = allowAsyncIterables
|
|
70599
70643
|
? ts.Diagnostics.Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator
|
|
70600
70644
|
: ts.Diagnostics.Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator;
|
|
70601
|
-
errorAndMaybeSuggestAwait(errorNode, !!getAwaitedTypeOfPromise(type), message, typeToString(type));
|
|
70645
|
+
return errorAndMaybeSuggestAwait(errorNode, !!getAwaitedTypeOfPromise(type), message, typeToString(type));
|
|
70602
70646
|
}
|
|
70603
|
-
function getIterationTypesOfIterator(type, resolver, errorNode) {
|
|
70647
|
+
function getIterationTypesOfIterator(type, resolver, errorNode, errorOutputContainer) {
|
|
70648
|
+
return getIterationTypesOfIteratorWorker(type, resolver, errorNode, errorOutputContainer, false);
|
|
70649
|
+
}
|
|
70650
|
+
function getIterationTypesOfIteratorWorker(type, resolver, errorNode, errorOutputContainer, noCache) {
|
|
70604
70651
|
if (isTypeAny(type)) {
|
|
70605
70652
|
return anyIterationTypes;
|
|
70606
70653
|
}
|
|
70607
70654
|
var iterationTypes = getIterationTypesOfIteratorCached(type, resolver) ||
|
|
70608
|
-
getIterationTypesOfIteratorFast(type, resolver)
|
|
70609
|
-
|
|
70655
|
+
getIterationTypesOfIteratorFast(type, resolver);
|
|
70656
|
+
if (iterationTypes === noIterationTypes && errorNode) {
|
|
70657
|
+
iterationTypes = undefined;
|
|
70658
|
+
noCache = true;
|
|
70659
|
+
}
|
|
70660
|
+
iterationTypes !== null && iterationTypes !== void 0 ? iterationTypes : (iterationTypes = getIterationTypesOfIteratorSlow(type, resolver, errorNode, errorOutputContainer, noCache));
|
|
70610
70661
|
return iterationTypes === noIterationTypes ? undefined : iterationTypes;
|
|
70611
70662
|
}
|
|
70612
70663
|
function getIterationTypesOfIteratorCached(type, resolver) {
|
|
@@ -70617,7 +70668,7 @@ var ts;
|
|
|
70617
70668
|
if (isReferenceToType(type, globalType)) {
|
|
70618
70669
|
var yieldType = getTypeArguments(type)[0];
|
|
70619
70670
|
var globalIterationTypes = getIterationTypesOfIteratorCached(globalType, resolver) ||
|
|
70620
|
-
getIterationTypesOfIteratorSlow(globalType, resolver, undefined);
|
|
70671
|
+
getIterationTypesOfIteratorSlow(globalType, resolver, undefined, undefined, false);
|
|
70621
70672
|
var _a = globalIterationTypes === noIterationTypes ? defaultIterationTypes : globalIterationTypes, returnType = _a.returnType, nextType = _a.nextType;
|
|
70622
70673
|
return setCachedIterationTypes(type, resolver.iteratorCacheKey, createIterationTypes(yieldType, returnType, nextType));
|
|
70623
70674
|
}
|
|
@@ -70662,8 +70713,8 @@ var ts;
|
|
|
70662
70713
|
}
|
|
70663
70714
|
return setCachedIterationTypes(type, "iterationTypesOfIteratorResult", createIterationTypes(yieldType, returnType || voidType, undefined));
|
|
70664
70715
|
}
|
|
70665
|
-
function getIterationTypesOfMethod(type, resolver, methodName, errorNode) {
|
|
70666
|
-
var _a, _b, _c, _d;
|
|
70716
|
+
function getIterationTypesOfMethod(type, resolver, methodName, errorNode, errorOutputContainer) {
|
|
70717
|
+
var _a, _b, _c, _d, _e, _f;
|
|
70667
70718
|
var method = getPropertyOfType(type, methodName);
|
|
70668
70719
|
if (!method && methodName !== "next") {
|
|
70669
70720
|
return undefined;
|
|
@@ -70680,15 +70731,21 @@ var ts;
|
|
|
70680
70731
|
var diagnostic = methodName === "next"
|
|
70681
70732
|
? resolver.mustHaveANextMethodDiagnostic
|
|
70682
70733
|
: resolver.mustBeAMethodDiagnostic;
|
|
70683
|
-
|
|
70734
|
+
if (errorOutputContainer) {
|
|
70735
|
+
(_a = errorOutputContainer.errors) !== null && _a !== void 0 ? _a : (errorOutputContainer.errors = []);
|
|
70736
|
+
errorOutputContainer.errors.push(ts.createDiagnosticForNode(errorNode, diagnostic, methodName));
|
|
70737
|
+
}
|
|
70738
|
+
else {
|
|
70739
|
+
error(errorNode, diagnostic, methodName);
|
|
70740
|
+
}
|
|
70684
70741
|
}
|
|
70685
|
-
return methodName === "next" ?
|
|
70742
|
+
return methodName === "next" ? noIterationTypes : undefined;
|
|
70686
70743
|
}
|
|
70687
70744
|
if ((methodType === null || methodType === void 0 ? void 0 : methodType.symbol) && methodSignatures.length === 1) {
|
|
70688
70745
|
var globalGeneratorType = resolver.getGlobalGeneratorType(false);
|
|
70689
70746
|
var globalIteratorType = resolver.getGlobalIteratorType(false);
|
|
70690
|
-
var isGeneratorMethod = ((
|
|
70691
|
-
var isIteratorMethod = !isGeneratorMethod && ((
|
|
70747
|
+
var isGeneratorMethod = ((_c = (_b = globalGeneratorType.symbol) === null || _b === void 0 ? void 0 : _b.members) === null || _c === void 0 ? void 0 : _c.get(methodName)) === methodType.symbol;
|
|
70748
|
+
var isIteratorMethod = !isGeneratorMethod && ((_e = (_d = globalIteratorType.symbol) === null || _d === void 0 ? void 0 : _d.members) === null || _e === void 0 ? void 0 : _e.get(methodName)) === methodType.symbol;
|
|
70692
70749
|
if (isGeneratorMethod || isIteratorMethod) {
|
|
70693
70750
|
var globalType = isGeneratorMethod ? globalGeneratorType : globalIteratorType;
|
|
70694
70751
|
var mapper = methodType.mapper;
|
|
@@ -70722,7 +70779,13 @@ var ts;
|
|
|
70722
70779
|
var iterationTypes = getIterationTypesOfIteratorResult(resolvedMethodReturnType);
|
|
70723
70780
|
if (iterationTypes === noIterationTypes) {
|
|
70724
70781
|
if (errorNode) {
|
|
70725
|
-
|
|
70782
|
+
if (errorOutputContainer) {
|
|
70783
|
+
(_f = errorOutputContainer.errors) !== null && _f !== void 0 ? _f : (errorOutputContainer.errors = []);
|
|
70784
|
+
errorOutputContainer.errors.push(ts.createDiagnosticForNode(errorNode, resolver.mustHaveAValueDiagnostic, methodName));
|
|
70785
|
+
}
|
|
70786
|
+
else {
|
|
70787
|
+
error(errorNode, resolver.mustHaveAValueDiagnostic, methodName);
|
|
70788
|
+
}
|
|
70726
70789
|
}
|
|
70727
70790
|
yieldType = anyType;
|
|
70728
70791
|
returnTypes = ts.append(returnTypes, anyType);
|
|
@@ -70733,13 +70796,13 @@ var ts;
|
|
|
70733
70796
|
}
|
|
70734
70797
|
return createIterationTypes(yieldType, getUnionType(returnTypes), nextType);
|
|
70735
70798
|
}
|
|
70736
|
-
function getIterationTypesOfIteratorSlow(type, resolver, errorNode) {
|
|
70799
|
+
function getIterationTypesOfIteratorSlow(type, resolver, errorNode, errorOutputContainer, noCache) {
|
|
70737
70800
|
var iterationTypes = combineIterationTypes([
|
|
70738
|
-
getIterationTypesOfMethod(type, resolver, "next", errorNode),
|
|
70739
|
-
getIterationTypesOfMethod(type, resolver, "return", errorNode),
|
|
70740
|
-
getIterationTypesOfMethod(type, resolver, "throw", errorNode),
|
|
70801
|
+
getIterationTypesOfMethod(type, resolver, "next", errorNode, errorOutputContainer),
|
|
70802
|
+
getIterationTypesOfMethod(type, resolver, "return", errorNode, errorOutputContainer),
|
|
70803
|
+
getIterationTypesOfMethod(type, resolver, "throw", errorNode, errorOutputContainer),
|
|
70741
70804
|
]);
|
|
70742
|
-
return setCachedIterationTypes(type, resolver.iteratorCacheKey, iterationTypes);
|
|
70805
|
+
return noCache ? iterationTypes : setCachedIterationTypes(type, resolver.iteratorCacheKey, iterationTypes);
|
|
70743
70806
|
}
|
|
70744
70807
|
function getIterationTypeOfGeneratorFunctionReturnType(kind, returnType, isAsyncGenerator) {
|
|
70745
70808
|
if (isTypeAny(returnType)) {
|
|
@@ -70755,7 +70818,7 @@ var ts;
|
|
|
70755
70818
|
var use = isAsyncGenerator ? 2 : 1;
|
|
70756
70819
|
var resolver = isAsyncGenerator ? asyncIterationTypesResolver : syncIterationTypesResolver;
|
|
70757
70820
|
return getIterationTypesOfIterable(type, use, undefined) ||
|
|
70758
|
-
getIterationTypesOfIterator(type, resolver, undefined);
|
|
70821
|
+
getIterationTypesOfIterator(type, resolver, undefined, undefined);
|
|
70759
70822
|
}
|
|
70760
70823
|
function checkBreakOrContinueStatement(node) {
|
|
70761
70824
|
if (!checkGrammarStatementInAmbientContext(node))
|
|
@@ -79586,10 +79649,11 @@ var ts;
|
|
|
79586
79649
|
}
|
|
79587
79650
|
function visitPreOrPostfixUnaryExpression(node, valueIsDiscarded) {
|
|
79588
79651
|
if (node.operator === 45 || node.operator === 46) {
|
|
79589
|
-
|
|
79652
|
+
var operand = ts.skipParentheses(node.operand);
|
|
79653
|
+
if (shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierPropertyAccessExpression(operand)) {
|
|
79590
79654
|
var info = void 0;
|
|
79591
|
-
if (info = accessPrivateIdentifier(
|
|
79592
|
-
var receiver = ts.visitNode(
|
|
79655
|
+
if (info = accessPrivateIdentifier(operand.name)) {
|
|
79656
|
+
var receiver = ts.visitNode(operand.expression, visitor, ts.isExpression);
|
|
79593
79657
|
var _a = createCopiableReceiverExpr(receiver), readExpression = _a.readExpression, initializeExpression = _a.initializeExpression;
|
|
79594
79658
|
var expression = createPrivateIdentifierAccess(info, readExpression);
|
|
79595
79659
|
var temp = ts.isPrefixUnaryExpression(node) || valueIsDiscarded ? undefined : factory.createTempVariable(hoistVariableDeclaration);
|
|
@@ -79605,36 +79669,36 @@ var ts;
|
|
|
79605
79669
|
}
|
|
79606
79670
|
}
|
|
79607
79671
|
else if (shouldTransformSuperInStaticInitializers &&
|
|
79608
|
-
ts.isSuperProperty(
|
|
79672
|
+
ts.isSuperProperty(operand) &&
|
|
79609
79673
|
currentStaticPropertyDeclarationOrStaticBlock &&
|
|
79610
79674
|
currentClassLexicalEnvironment) {
|
|
79611
79675
|
var classConstructor = currentClassLexicalEnvironment.classConstructor, superClassReference = currentClassLexicalEnvironment.superClassReference, facts = currentClassLexicalEnvironment.facts;
|
|
79612
79676
|
if (facts & 1) {
|
|
79613
|
-
var
|
|
79677
|
+
var expression = visitInvalidSuperProperty(operand);
|
|
79614
79678
|
return ts.isPrefixUnaryExpression(node) ?
|
|
79615
|
-
factory.updatePrefixUnaryExpression(node,
|
|
79616
|
-
factory.updatePostfixUnaryExpression(node,
|
|
79679
|
+
factory.updatePrefixUnaryExpression(node, expression) :
|
|
79680
|
+
factory.updatePostfixUnaryExpression(node, expression);
|
|
79617
79681
|
}
|
|
79618
79682
|
if (classConstructor && superClassReference) {
|
|
79619
79683
|
var setterName = void 0;
|
|
79620
79684
|
var getterName = void 0;
|
|
79621
|
-
if (ts.isPropertyAccessExpression(
|
|
79622
|
-
if (ts.isIdentifier(
|
|
79623
|
-
getterName = setterName = factory.createStringLiteralFromNode(
|
|
79685
|
+
if (ts.isPropertyAccessExpression(operand)) {
|
|
79686
|
+
if (ts.isIdentifier(operand.name)) {
|
|
79687
|
+
getterName = setterName = factory.createStringLiteralFromNode(operand.name);
|
|
79624
79688
|
}
|
|
79625
79689
|
}
|
|
79626
79690
|
else {
|
|
79627
|
-
if (ts.isSimpleInlineableExpression(
|
|
79628
|
-
getterName = setterName =
|
|
79691
|
+
if (ts.isSimpleInlineableExpression(operand.argumentExpression)) {
|
|
79692
|
+
getterName = setterName = operand.argumentExpression;
|
|
79629
79693
|
}
|
|
79630
79694
|
else {
|
|
79631
79695
|
getterName = factory.createTempVariable(hoistVariableDeclaration);
|
|
79632
|
-
setterName = factory.createAssignment(getterName, ts.visitNode(
|
|
79696
|
+
setterName = factory.createAssignment(getterName, ts.visitNode(operand.argumentExpression, visitor, ts.isExpression));
|
|
79633
79697
|
}
|
|
79634
79698
|
}
|
|
79635
79699
|
if (setterName && getterName) {
|
|
79636
79700
|
var expression = factory.createReflectGetCall(superClassReference, getterName, classConstructor);
|
|
79637
|
-
ts.setTextRange(expression,
|
|
79701
|
+
ts.setTextRange(expression, operand);
|
|
79638
79702
|
var temp = valueIsDiscarded ? undefined : factory.createTempVariable(hoistVariableDeclaration);
|
|
79639
79703
|
expression = ts.expandPreOrPostfixIncrementOrDecrementExpression(factory, node, expression, hoistVariableDeclaration, temp);
|
|
79640
79704
|
expression = factory.createReflectSetCall(superClassReference, setterName, expression, classConstructor);
|
|
@@ -97323,6 +97387,11 @@ var ts;
|
|
|
97323
97387
|
}
|
|
97324
97388
|
ts.getConfigFileParsingDiagnostics = getConfigFileParsingDiagnostics;
|
|
97325
97389
|
function getImpliedNodeFormatForFile(fileName, packageJsonInfoCache, host, options) {
|
|
97390
|
+
var result = getImpliedNodeFormatForFileWorker(fileName, packageJsonInfoCache, host, options);
|
|
97391
|
+
return typeof result === "object" ? result.impliedNodeFormat : result;
|
|
97392
|
+
}
|
|
97393
|
+
ts.getImpliedNodeFormatForFile = getImpliedNodeFormatForFile;
|
|
97394
|
+
function getImpliedNodeFormatForFileWorker(fileName, packageJsonInfoCache, host, options) {
|
|
97326
97395
|
switch (ts.getEmitModuleResolutionKind(options)) {
|
|
97327
97396
|
case ts.ModuleResolutionKind.Node16:
|
|
97328
97397
|
case ts.ModuleResolutionKind.NodeNext:
|
|
@@ -97334,11 +97403,16 @@ var ts;
|
|
|
97334
97403
|
return undefined;
|
|
97335
97404
|
}
|
|
97336
97405
|
function lookupFromPackageJson() {
|
|
97337
|
-
var
|
|
97338
|
-
|
|
97406
|
+
var state = ts.getTemporaryModuleResolutionState(packageJsonInfoCache, host, options);
|
|
97407
|
+
var packageJsonLocations = [];
|
|
97408
|
+
state.failedLookupLocations = packageJsonLocations;
|
|
97409
|
+
state.affectingLocations = packageJsonLocations;
|
|
97410
|
+
var packageJsonScope = ts.getPackageScopeForPath(fileName, state);
|
|
97411
|
+
var impliedNodeFormat = (packageJsonScope === null || packageJsonScope === void 0 ? void 0 : packageJsonScope.packageJsonContent.type) === "module" ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS;
|
|
97412
|
+
return { impliedNodeFormat: impliedNodeFormat, packageJsonLocations: packageJsonLocations, packageJsonScope: packageJsonScope };
|
|
97339
97413
|
}
|
|
97340
97414
|
}
|
|
97341
|
-
ts.
|
|
97415
|
+
ts.getImpliedNodeFormatForFileWorker = getImpliedNodeFormatForFileWorker;
|
|
97342
97416
|
ts.plainJSErrors = new ts.Set([
|
|
97343
97417
|
ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0.code,
|
|
97344
97418
|
ts.Diagnostics.A_module_cannot_have_multiple_default_exports.code,
|
|
@@ -97616,7 +97690,7 @@ var ts;
|
|
|
97616
97690
|
for (var _i = 0, oldSourceFiles_1 = oldSourceFiles; _i < oldSourceFiles_1.length; _i++) {
|
|
97617
97691
|
var oldSourceFile = oldSourceFiles_1[_i];
|
|
97618
97692
|
var newFile = getSourceFileByPath(oldSourceFile.resolvedPath);
|
|
97619
|
-
if (shouldCreateNewSourceFile || !newFile ||
|
|
97693
|
+
if (shouldCreateNewSourceFile || !newFile || newFile.impliedNodeFormat !== oldSourceFile.impliedNodeFormat ||
|
|
97620
97694
|
(oldSourceFile.resolvedPath === oldSourceFile.path && newFile.resolvedPath !== oldSourceFile.path)) {
|
|
97621
97695
|
host.onReleaseOldSourceFile(oldSourceFile, oldProgram.getCompilerOptions(), !!getSourceFileByPath(oldSourceFile.path));
|
|
97622
97696
|
}
|
|
@@ -97946,7 +98020,7 @@ var ts;
|
|
|
97946
98020
|
});
|
|
97947
98021
|
}
|
|
97948
98022
|
function tryReuseStructureFromOldProgram() {
|
|
97949
|
-
var _a;
|
|
98023
|
+
var _a, _b;
|
|
97950
98024
|
if (!oldProgram) {
|
|
97951
98025
|
return 0;
|
|
97952
98026
|
}
|
|
@@ -97974,12 +98048,15 @@ var ts;
|
|
|
97974
98048
|
var seenPackageNames = new ts.Map();
|
|
97975
98049
|
for (var _i = 0, oldSourceFiles_2 = oldSourceFiles; _i < oldSourceFiles_2.length; _i++) {
|
|
97976
98050
|
var oldSourceFile = oldSourceFiles_2[_i];
|
|
98051
|
+
var sourceFileOptions = getCreateSourceFileOptions(oldSourceFile.fileName, moduleResolutionCache, host, options);
|
|
97977
98052
|
var newSourceFile = host.getSourceFileByPath
|
|
97978
|
-
? host.getSourceFileByPath(oldSourceFile.fileName, oldSourceFile.resolvedPath,
|
|
97979
|
-
: host.getSourceFile(oldSourceFile.fileName,
|
|
98053
|
+
? host.getSourceFileByPath(oldSourceFile.fileName, oldSourceFile.resolvedPath, sourceFileOptions, undefined, shouldCreateNewSourceFile || sourceFileOptions.impliedNodeFormat !== oldSourceFile.impliedNodeFormat)
|
|
98054
|
+
: host.getSourceFile(oldSourceFile.fileName, sourceFileOptions, undefined, shouldCreateNewSourceFile || sourceFileOptions.impliedNodeFormat !== oldSourceFile.impliedNodeFormat);
|
|
97980
98055
|
if (!newSourceFile) {
|
|
97981
98056
|
return 0;
|
|
97982
98057
|
}
|
|
98058
|
+
newSourceFile.packageJsonLocations = ((_a = sourceFileOptions.packageJsonLocations) === null || _a === void 0 ? void 0 : _a.length) ? sourceFileOptions.packageJsonLocations : undefined;
|
|
98059
|
+
newSourceFile.packageJsonScope = sourceFileOptions.packageJsonScope;
|
|
97983
98060
|
ts.Debug.assert(!newSourceFile.redirectInfo, "Host should not return a redirect source file from `getSourceFile`");
|
|
97984
98061
|
var fileChanged = void 0;
|
|
97985
98062
|
if (oldSourceFile.redirectInfo) {
|
|
@@ -98012,27 +98089,32 @@ var ts;
|
|
|
98012
98089
|
seenPackageNames.set(packageName, newKind);
|
|
98013
98090
|
}
|
|
98014
98091
|
if (fileChanged) {
|
|
98015
|
-
if (
|
|
98016
|
-
structureIsReused = 1;
|
|
98017
|
-
}
|
|
98018
|
-
if (oldSourceFile.hasNoDefaultLib !== newSourceFile.hasNoDefaultLib) {
|
|
98019
|
-
structureIsReused = 1;
|
|
98020
|
-
}
|
|
98021
|
-
if (!ts.arrayIsEqualTo(oldSourceFile.referencedFiles, newSourceFile.referencedFiles, fileReferenceIsEqualTo)) {
|
|
98092
|
+
if (oldSourceFile.impliedNodeFormat !== newSourceFile.impliedNodeFormat) {
|
|
98022
98093
|
structureIsReused = 1;
|
|
98023
98094
|
}
|
|
98024
|
-
|
|
98025
|
-
if (!ts.arrayIsEqualTo(oldSourceFile.imports, newSourceFile.imports, moduleNameIsEqualTo)) {
|
|
98095
|
+
else if (!ts.arrayIsEqualTo(oldSourceFile.libReferenceDirectives, newSourceFile.libReferenceDirectives, fileReferenceIsEqualTo)) {
|
|
98026
98096
|
structureIsReused = 1;
|
|
98027
98097
|
}
|
|
98028
|
-
if (
|
|
98098
|
+
else if (oldSourceFile.hasNoDefaultLib !== newSourceFile.hasNoDefaultLib) {
|
|
98029
98099
|
structureIsReused = 1;
|
|
98030
98100
|
}
|
|
98031
|
-
if ((oldSourceFile.
|
|
98101
|
+
else if (!ts.arrayIsEqualTo(oldSourceFile.referencedFiles, newSourceFile.referencedFiles, fileReferenceIsEqualTo)) {
|
|
98032
98102
|
structureIsReused = 1;
|
|
98033
98103
|
}
|
|
98034
|
-
|
|
98035
|
-
|
|
98104
|
+
else {
|
|
98105
|
+
collectExternalModuleReferences(newSourceFile);
|
|
98106
|
+
if (!ts.arrayIsEqualTo(oldSourceFile.imports, newSourceFile.imports, moduleNameIsEqualTo)) {
|
|
98107
|
+
structureIsReused = 1;
|
|
98108
|
+
}
|
|
98109
|
+
else if (!ts.arrayIsEqualTo(oldSourceFile.moduleAugmentations, newSourceFile.moduleAugmentations, moduleNameIsEqualTo)) {
|
|
98110
|
+
structureIsReused = 1;
|
|
98111
|
+
}
|
|
98112
|
+
else if ((oldSourceFile.flags & 6291456) !== (newSourceFile.flags & 6291456)) {
|
|
98113
|
+
structureIsReused = 1;
|
|
98114
|
+
}
|
|
98115
|
+
else if (!ts.arrayIsEqualTo(oldSourceFile.typeReferenceDirectives, newSourceFile.typeReferenceDirectives, fileReferenceIsEqualTo)) {
|
|
98116
|
+
structureIsReused = 1;
|
|
98117
|
+
}
|
|
98036
98118
|
}
|
|
98037
98119
|
modifiedSourceFiles.push({ oldFile: oldSourceFile, newFile: newSourceFile });
|
|
98038
98120
|
}
|
|
@@ -98046,17 +98128,17 @@ var ts;
|
|
|
98046
98128
|
return structureIsReused;
|
|
98047
98129
|
}
|
|
98048
98130
|
var modifiedFiles = modifiedSourceFiles.map(function (f) { return f.oldFile; });
|
|
98049
|
-
for (var
|
|
98050
|
-
var oldFile = oldSourceFiles_3[
|
|
98131
|
+
for (var _c = 0, oldSourceFiles_3 = oldSourceFiles; _c < oldSourceFiles_3.length; _c++) {
|
|
98132
|
+
var oldFile = oldSourceFiles_3[_c];
|
|
98051
98133
|
if (!ts.contains(modifiedFiles, oldFile)) {
|
|
98052
|
-
for (var
|
|
98053
|
-
var moduleName = _d
|
|
98134
|
+
for (var _d = 0, _e = oldFile.ambientModuleNames; _d < _e.length; _d++) {
|
|
98135
|
+
var moduleName = _e[_d];
|
|
98054
98136
|
ambientModuleNameToUnmodifiedFileName.set(moduleName, oldFile.fileName);
|
|
98055
98137
|
}
|
|
98056
98138
|
}
|
|
98057
98139
|
}
|
|
98058
|
-
for (var
|
|
98059
|
-
var
|
|
98140
|
+
for (var _f = 0, modifiedSourceFiles_1 = modifiedSourceFiles; _f < modifiedSourceFiles_1.length; _f++) {
|
|
98141
|
+
var _g = modifiedSourceFiles_1[_f], oldSourceFile = _g.oldFile, newSourceFile = _g.newFile;
|
|
98060
98142
|
var moduleNames = getModuleNames(newSourceFile);
|
|
98061
98143
|
var resolutions = resolveModuleNamesReusingOldState(moduleNames, newSourceFile);
|
|
98062
98144
|
var resolutionsChanged = ts.hasChangesInResolutions(moduleNames, resolutions, oldSourceFile.resolvedModules, oldSourceFile, ts.moduleResolutionIsEqualTo);
|
|
@@ -98081,13 +98163,13 @@ var ts;
|
|
|
98081
98163
|
if (structureIsReused !== 2) {
|
|
98082
98164
|
return structureIsReused;
|
|
98083
98165
|
}
|
|
98084
|
-
if (ts.changesAffectingProgramStructure(oldOptions, options) || ((
|
|
98166
|
+
if (ts.changesAffectingProgramStructure(oldOptions, options) || ((_b = host.hasChangedAutomaticTypeDirectiveNames) === null || _b === void 0 ? void 0 : _b.call(host))) {
|
|
98085
98167
|
return 1;
|
|
98086
98168
|
}
|
|
98087
98169
|
missingFilePaths = oldProgram.getMissingFilePaths();
|
|
98088
98170
|
ts.Debug.assert(newSourceFiles.length === oldProgram.getSourceFiles().length);
|
|
98089
|
-
for (var
|
|
98090
|
-
var newSourceFile = newSourceFiles_1[
|
|
98171
|
+
for (var _h = 0, newSourceFiles_1 = newSourceFiles; _h < newSourceFiles_1.length; _h++) {
|
|
98172
|
+
var newSourceFile = newSourceFiles_1[_h];
|
|
98091
98173
|
filesByName.set(newSourceFile.path, newSourceFile);
|
|
98092
98174
|
}
|
|
98093
98175
|
var oldFilesByNameMap = oldProgram.getFilesByNameMap();
|
|
@@ -98787,13 +98869,16 @@ var ts;
|
|
|
98787
98869
|
addFilePreprocessingFileExplainingDiagnostic(existingFile, reason, ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, [fileName, existingFile.fileName]);
|
|
98788
98870
|
}
|
|
98789
98871
|
}
|
|
98790
|
-
function createRedirectSourceFile(redirectTarget, unredirected, fileName, path, resolvedPath, originalFileName) {
|
|
98872
|
+
function createRedirectSourceFile(redirectTarget, unredirected, fileName, path, resolvedPath, originalFileName, sourceFileOptions) {
|
|
98873
|
+
var _a;
|
|
98791
98874
|
var redirect = Object.create(redirectTarget);
|
|
98792
98875
|
redirect.fileName = fileName;
|
|
98793
98876
|
redirect.path = path;
|
|
98794
98877
|
redirect.resolvedPath = resolvedPath;
|
|
98795
98878
|
redirect.originalFileName = originalFileName;
|
|
98796
98879
|
redirect.redirectInfo = { redirectTarget: redirectTarget, unredirected: unredirected };
|
|
98880
|
+
redirect.packageJsonLocations = ((_a = sourceFileOptions.packageJsonLocations) === null || _a === void 0 ? void 0 : _a.length) ? sourceFileOptions.packageJsonLocations : undefined;
|
|
98881
|
+
redirect.packageJsonScope = sourceFileOptions.packageJsonScope;
|
|
98797
98882
|
sourceFilesFoundSearchingNodeModules.set(path, currentNodeModulesDepth > 0);
|
|
98798
98883
|
Object.defineProperties(redirect, {
|
|
98799
98884
|
id: {
|
|
@@ -98818,14 +98903,14 @@ var ts;
|
|
|
98818
98903
|
return result;
|
|
98819
98904
|
}
|
|
98820
98905
|
function getCreateSourceFileOptions(fileName, moduleResolutionCache, host, options) {
|
|
98821
|
-
var
|
|
98822
|
-
|
|
98823
|
-
|
|
98824
|
-
|
|
98825
|
-
setExternalModuleIndicator:
|
|
98826
|
-
};
|
|
98906
|
+
var result = getImpliedNodeFormatForFileWorker(toPath(fileName), moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache(), host, options);
|
|
98907
|
+
var languageVersion = ts.getEmitScriptTarget(options);
|
|
98908
|
+
var setExternalModuleIndicator = ts.getSetExternalModuleIndicator(options);
|
|
98909
|
+
return typeof result === "object" ? __assign(__assign({}, result), { languageVersion: languageVersion, setExternalModuleIndicator: setExternalModuleIndicator }) :
|
|
98910
|
+
{ languageVersion: languageVersion, impliedNodeFormat: result, setExternalModuleIndicator: setExternalModuleIndicator };
|
|
98827
98911
|
}
|
|
98828
98912
|
function findSourceFileWorker(fileName, isDefaultLib, ignoreNoDefaultLib, reason, packageId) {
|
|
98913
|
+
var _a, _b;
|
|
98829
98914
|
var path = toPath(fileName);
|
|
98830
98915
|
if (useSourceOfProjectReferenceRedirect) {
|
|
98831
98916
|
var source = getSourceOfProjectReferenceRedirect(path);
|
|
@@ -98895,12 +98980,13 @@ var ts;
|
|
|
98895
98980
|
redirectedPath = toPath(redirect);
|
|
98896
98981
|
}
|
|
98897
98982
|
}
|
|
98898
|
-
var
|
|
98983
|
+
var sourceFileOptions = getCreateSourceFileOptions(fileName, moduleResolutionCache, host, options);
|
|
98984
|
+
var file = host.getSourceFile(fileName, sourceFileOptions, function (hostErrorMessage) { return addFilePreprocessingFileExplainingDiagnostic(undefined, reason, ts.Diagnostics.Cannot_read_file_0_Colon_1, [fileName, hostErrorMessage]); }, shouldCreateNewSourceFile || (((_a = oldProgram === null || oldProgram === void 0 ? void 0 : oldProgram.getSourceFileByPath(toPath(fileName))) === null || _a === void 0 ? void 0 : _a.impliedNodeFormat) !== sourceFileOptions.impliedNodeFormat));
|
|
98899
98985
|
if (packageId) {
|
|
98900
98986
|
var packageIdKey = ts.packageIdToString(packageId);
|
|
98901
98987
|
var fileFromPackageId = packageIdToSourceFile.get(packageIdKey);
|
|
98902
98988
|
if (fileFromPackageId) {
|
|
98903
|
-
var dupFile = createRedirectSourceFile(fileFromPackageId, file, fileName, path, toPath(fileName), originalFileName);
|
|
98989
|
+
var dupFile = createRedirectSourceFile(fileFromPackageId, file, fileName, path, toPath(fileName), originalFileName, sourceFileOptions);
|
|
98904
98990
|
redirectTargetsMap.add(fileFromPackageId.path, fileName);
|
|
98905
98991
|
addFileToFilesByName(dupFile, path, redirectedPath);
|
|
98906
98992
|
addFileIncludeReason(dupFile, reason);
|
|
@@ -98920,6 +99006,8 @@ var ts;
|
|
|
98920
99006
|
file.path = path;
|
|
98921
99007
|
file.resolvedPath = toPath(fileName);
|
|
98922
99008
|
file.originalFileName = originalFileName;
|
|
99009
|
+
file.packageJsonLocations = ((_b = sourceFileOptions.packageJsonLocations) === null || _b === void 0 ? void 0 : _b.length) ? sourceFileOptions.packageJsonLocations : undefined;
|
|
99010
|
+
file.packageJsonScope = sourceFileOptions.packageJsonScope;
|
|
98923
99011
|
addFileIncludeReason(file, reason);
|
|
98924
99012
|
if (host.useCaseSensitiveFileNames()) {
|
|
98925
99013
|
var pathLowerCase = ts.toFileNameLowerCase(path);
|
|
@@ -99496,7 +99584,7 @@ var ts;
|
|
|
99496
99584
|
fileIncludeReasons = undefined;
|
|
99497
99585
|
var location = locationReason && getReferencedFileLocation(getSourceFileByPath, locationReason);
|
|
99498
99586
|
var fileIncludeReasonDetails = fileIncludeReasons && ts.chainDiagnosticMessages(fileIncludeReasons, ts.Diagnostics.The_file_is_in_the_program_because_Colon);
|
|
99499
|
-
var redirectInfo = file && ts.
|
|
99587
|
+
var redirectInfo = file && ts.explainIfFileIsRedirectAndImpliedFormat(file);
|
|
99500
99588
|
var chain = ts.chainDiagnosticMessages.apply(void 0, __spreadArray([redirectInfo ? fileIncludeReasonDetails ? __spreadArray([fileIncludeReasonDetails], redirectInfo, true) : redirectInfo : fileIncludeReasonDetails, diagnostic], args || ts.emptyArray, false));
|
|
99501
99589
|
return location && isReferenceFileLocation(location) ?
|
|
99502
99590
|
ts.createFileDiagnosticFromMessageChain(location.file, location.pos, location.end - location.pos, chain, relatedInfo) :
|
|
@@ -101463,7 +101551,7 @@ var ts;
|
|
|
101463
101551
|
path;
|
|
101464
101552
|
}
|
|
101465
101553
|
ts.removeIgnoredPath = removeIgnoredPath;
|
|
101466
|
-
function
|
|
101554
|
+
function canWatchDirectoryOrFile(dirPath) {
|
|
101467
101555
|
var rootLength = ts.getRootLength(dirPath);
|
|
101468
101556
|
if (dirPath.length === rootLength) {
|
|
101469
101557
|
return false;
|
|
@@ -101495,7 +101583,7 @@ var ts;
|
|
|
101495
101583
|
}
|
|
101496
101584
|
return true;
|
|
101497
101585
|
}
|
|
101498
|
-
ts.
|
|
101586
|
+
ts.canWatchDirectoryOrFile = canWatchDirectoryOrFile;
|
|
101499
101587
|
function createResolutionCache(resolutionHost, rootDirForResolution, logChangesWhenResolvingModule) {
|
|
101500
101588
|
var filesWithChangedSetOfUnresolvedImports;
|
|
101501
101589
|
var filesWithInvalidatedResolutions;
|
|
@@ -101504,7 +101592,9 @@ var ts;
|
|
|
101504
101592
|
var resolutionsWithFailedLookups = [];
|
|
101505
101593
|
var resolutionsWithOnlyAffectingLocations = [];
|
|
101506
101594
|
var resolvedFileToResolution = ts.createMultiMap();
|
|
101595
|
+
var impliedFormatPackageJsons = new ts.Map();
|
|
101507
101596
|
var hasChangedAutomaticTypeDirectiveNames = false;
|
|
101597
|
+
var affectingPathChecksForFile;
|
|
101508
101598
|
var affectingPathChecks;
|
|
101509
101599
|
var failedLookupChecks;
|
|
101510
101600
|
var startsWithPathChecks;
|
|
@@ -101530,7 +101620,7 @@ var ts;
|
|
|
101530
101620
|
getModuleResolutionCache: function () { return moduleResolutionCache; },
|
|
101531
101621
|
startRecordingFilesWithChangedResolutions: startRecordingFilesWithChangedResolutions,
|
|
101532
101622
|
finishRecordingFilesWithChangedResolutions: finishRecordingFilesWithChangedResolutions,
|
|
101533
|
-
startCachingPerDirectoryResolution:
|
|
101623
|
+
startCachingPerDirectoryResolution: startCachingPerDirectoryResolution,
|
|
101534
101624
|
finishCachingPerDirectoryResolution: finishCachingPerDirectoryResolution,
|
|
101535
101625
|
resolveModuleNames: resolveModuleNames,
|
|
101536
101626
|
getResolvedModuleWithFailedLookupLocationsFromCache: getResolvedModuleWithFailedLookupLocationsFromCache,
|
|
@@ -101574,7 +101664,10 @@ var ts;
|
|
|
101574
101664
|
startsWithPathChecks = undefined;
|
|
101575
101665
|
isInDirectoryChecks = undefined;
|
|
101576
101666
|
affectingPathChecks = undefined;
|
|
101577
|
-
|
|
101667
|
+
affectingPathChecksForFile = undefined;
|
|
101668
|
+
moduleResolutionCache.clear();
|
|
101669
|
+
typeReferenceDirectiveResolutionCache.clear();
|
|
101670
|
+
impliedFormatPackageJsons.clear();
|
|
101578
101671
|
hasChangedAutomaticTypeDirectiveNames = false;
|
|
101579
101672
|
}
|
|
101580
101673
|
function startRecordingFilesWithChangedResolutions() {
|
|
@@ -101603,15 +101696,41 @@ var ts;
|
|
|
101603
101696
|
return function (path) { return (!!collected && collected.has(path)) ||
|
|
101604
101697
|
isFileWithInvalidatedNonRelativeUnresolvedImports(path); };
|
|
101605
101698
|
}
|
|
101606
|
-
function
|
|
101607
|
-
moduleResolutionCache.
|
|
101608
|
-
typeReferenceDirectiveResolutionCache.
|
|
101699
|
+
function startCachingPerDirectoryResolution() {
|
|
101700
|
+
moduleResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
101701
|
+
typeReferenceDirectiveResolutionCache.clearAllExceptPackageJsonInfoCache();
|
|
101609
101702
|
nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfNonRelativeModuleResolutions);
|
|
101610
101703
|
nonRelativeExternalModuleResolutions.clear();
|
|
101611
101704
|
}
|
|
101612
|
-
function finishCachingPerDirectoryResolution() {
|
|
101705
|
+
function finishCachingPerDirectoryResolution(newProgram, oldProgram) {
|
|
101613
101706
|
filesWithInvalidatedNonRelativeUnresolvedImports = undefined;
|
|
101614
|
-
|
|
101707
|
+
nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfNonRelativeModuleResolutions);
|
|
101708
|
+
nonRelativeExternalModuleResolutions.clear();
|
|
101709
|
+
if (newProgram !== oldProgram) {
|
|
101710
|
+
newProgram === null || newProgram === void 0 ? void 0 : newProgram.getSourceFiles().forEach(function (newFile) {
|
|
101711
|
+
var _a, _b, _c;
|
|
101712
|
+
var expected = ts.isExternalOrCommonJsModule(newFile) ? (_b = (_a = newFile.packageJsonLocations) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0 : 0;
|
|
101713
|
+
var existing = (_c = impliedFormatPackageJsons.get(newFile.path)) !== null && _c !== void 0 ? _c : ts.emptyArray;
|
|
101714
|
+
for (var i = existing.length; i < expected; i++) {
|
|
101715
|
+
createFileWatcherOfAffectingLocation(newFile.packageJsonLocations[i], false);
|
|
101716
|
+
}
|
|
101717
|
+
if (existing.length > expected) {
|
|
101718
|
+
for (var i = expected; i < existing.length; i++) {
|
|
101719
|
+
fileWatchesOfAffectingLocations.get(existing[i]).files--;
|
|
101720
|
+
}
|
|
101721
|
+
}
|
|
101722
|
+
if (expected)
|
|
101723
|
+
impliedFormatPackageJsons.set(newFile.path, newFile.packageJsonLocations);
|
|
101724
|
+
else
|
|
101725
|
+
impliedFormatPackageJsons.delete(newFile.path);
|
|
101726
|
+
});
|
|
101727
|
+
impliedFormatPackageJsons.forEach(function (existing, path) {
|
|
101728
|
+
if (!(newProgram === null || newProgram === void 0 ? void 0 : newProgram.getSourceFileByPath(path))) {
|
|
101729
|
+
existing.forEach(function (location) { return fileWatchesOfAffectingLocations.get(location).files--; });
|
|
101730
|
+
impliedFormatPackageJsons.delete(path);
|
|
101731
|
+
}
|
|
101732
|
+
});
|
|
101733
|
+
}
|
|
101615
101734
|
directoryWatchesOfFailedLookups.forEach(function (watcher, path) {
|
|
101616
101735
|
if (watcher.refCount === 0) {
|
|
101617
101736
|
directoryWatchesOfFailedLookups.delete(path);
|
|
@@ -101619,10 +101738,9 @@ var ts;
|
|
|
101619
101738
|
}
|
|
101620
101739
|
});
|
|
101621
101740
|
fileWatchesOfAffectingLocations.forEach(function (watcher, path) {
|
|
101622
|
-
if (watcher.
|
|
101741
|
+
if (watcher.files === 0 && watcher.resolutions === 0) {
|
|
101623
101742
|
fileWatchesOfAffectingLocations.delete(path);
|
|
101624
101743
|
watcher.watcher.close();
|
|
101625
|
-
watcher.watcher = ts.noopFileWatcher;
|
|
101626
101744
|
}
|
|
101627
101745
|
});
|
|
101628
101746
|
hasChangedAutomaticTypeDirectiveNames = false;
|
|
@@ -101828,7 +101946,7 @@ var ts;
|
|
|
101828
101946
|
dirPath = ts.getDirectoryPath(dirPath);
|
|
101829
101947
|
}
|
|
101830
101948
|
if (ts.isNodeModulesDirectory(dirPath)) {
|
|
101831
|
-
return
|
|
101949
|
+
return canWatchDirectoryOrFile(ts.getDirectoryPath(dirPath)) ? { dir: dir, dirPath: dirPath } : undefined;
|
|
101832
101950
|
}
|
|
101833
101951
|
var nonRecursive = true;
|
|
101834
101952
|
var subDirectoryPath, subDirectory;
|
|
@@ -101845,7 +101963,7 @@ var ts;
|
|
|
101845
101963
|
dir = ts.getDirectoryPath(dir);
|
|
101846
101964
|
}
|
|
101847
101965
|
}
|
|
101848
|
-
return
|
|
101966
|
+
return canWatchDirectoryOrFile(dirPath) ? { dir: subDirectory || dir, dirPath: subDirectoryPath || dirPath, nonRecursive: nonRecursive } : undefined;
|
|
101849
101967
|
}
|
|
101850
101968
|
function isPathWithDefaultFailedLookupExtension(path) {
|
|
101851
101969
|
return ts.fileExtensionIsOneOf(path, failedLookupDefaultExtensions);
|
|
@@ -101912,46 +102030,64 @@ var ts;
|
|
|
101912
102030
|
resolutionsWithOnlyAffectingLocations.push(resolution);
|
|
101913
102031
|
for (var _i = 0, affectingLocations_1 = affectingLocations; _i < affectingLocations_1.length; _i++) {
|
|
101914
102032
|
var affectingLocation = affectingLocations_1[_i];
|
|
101915
|
-
createFileWatcherOfAffectingLocation(affectingLocation);
|
|
102033
|
+
createFileWatcherOfAffectingLocation(affectingLocation, true);
|
|
101916
102034
|
}
|
|
101917
102035
|
}
|
|
101918
|
-
function createFileWatcherOfAffectingLocation(affectingLocation) {
|
|
101919
|
-
var
|
|
101920
|
-
var fileWatcher = fileWatchesOfAffectingLocations.get(path);
|
|
102036
|
+
function createFileWatcherOfAffectingLocation(affectingLocation, forResolution) {
|
|
102037
|
+
var fileWatcher = fileWatchesOfAffectingLocations.get(affectingLocation);
|
|
101921
102038
|
if (fileWatcher) {
|
|
101922
|
-
|
|
102039
|
+
if (forResolution)
|
|
102040
|
+
fileWatcher.resolutions++;
|
|
102041
|
+
else
|
|
102042
|
+
fileWatcher.files++;
|
|
101923
102043
|
return;
|
|
101924
102044
|
}
|
|
101925
102045
|
var locationToWatch = affectingLocation;
|
|
101926
|
-
var locationToWatchPath = path;
|
|
101927
102046
|
if (resolutionHost.realpath) {
|
|
101928
102047
|
locationToWatch = resolutionHost.realpath(affectingLocation);
|
|
101929
|
-
|
|
101930
|
-
|
|
101931
|
-
var fileWatcher_1 = fileWatchesOfAffectingLocations.get(locationToWatchPath);
|
|
102048
|
+
if (affectingLocation !== locationToWatch) {
|
|
102049
|
+
var fileWatcher_1 = fileWatchesOfAffectingLocations.get(locationToWatch);
|
|
101932
102050
|
if (fileWatcher_1) {
|
|
101933
|
-
|
|
101934
|
-
|
|
101935
|
-
|
|
102051
|
+
if (forResolution)
|
|
102052
|
+
fileWatcher_1.resolutions++;
|
|
102053
|
+
else
|
|
102054
|
+
fileWatcher_1.files++;
|
|
102055
|
+
fileWatcher_1.paths.add(affectingLocation);
|
|
102056
|
+
fileWatchesOfAffectingLocations.set(affectingLocation, fileWatcher_1);
|
|
101936
102057
|
return;
|
|
101937
102058
|
}
|
|
101938
102059
|
}
|
|
101939
102060
|
}
|
|
101940
102061
|
var paths = new ts.Set();
|
|
101941
|
-
paths.add(
|
|
101942
|
-
var
|
|
101943
|
-
|
|
101944
|
-
cachedDirectoryStructureHost === null || cachedDirectoryStructureHost === void 0 ? void 0 : cachedDirectoryStructureHost.addOrDeleteFile(fileName,
|
|
101945
|
-
|
|
102062
|
+
paths.add(locationToWatch);
|
|
102063
|
+
var actualWatcher = canWatchDirectoryOrFile(resolutionHost.toPath(locationToWatch)) ?
|
|
102064
|
+
resolutionHost.watchAffectingFileLocation(locationToWatch, function (fileName, eventKind) {
|
|
102065
|
+
cachedDirectoryStructureHost === null || cachedDirectoryStructureHost === void 0 ? void 0 : cachedDirectoryStructureHost.addOrDeleteFile(fileName, resolutionHost.toPath(locationToWatch), eventKind);
|
|
102066
|
+
var packageJsonMap = moduleResolutionCache.getPackageJsonInfoCache().getInternalMap();
|
|
102067
|
+
paths.forEach(function (path) {
|
|
102068
|
+
if (watcher.resolutions)
|
|
102069
|
+
(affectingPathChecks !== null && affectingPathChecks !== void 0 ? affectingPathChecks : (affectingPathChecks = new ts.Set())).add(path);
|
|
102070
|
+
if (watcher.files)
|
|
102071
|
+
(affectingPathChecksForFile !== null && affectingPathChecksForFile !== void 0 ? affectingPathChecksForFile : (affectingPathChecksForFile = new ts.Set())).add(path);
|
|
102072
|
+
packageJsonMap === null || packageJsonMap === void 0 ? void 0 : packageJsonMap.delete(resolutionHost.toPath(path));
|
|
102073
|
+
});
|
|
101946
102074
|
resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations();
|
|
101947
|
-
})
|
|
101948
|
-
|
|
102075
|
+
}) : ts.noopFileWatcher;
|
|
102076
|
+
var watcher = {
|
|
102077
|
+
watcher: actualWatcher !== ts.noopFileWatcher ? {
|
|
102078
|
+
close: function () {
|
|
102079
|
+
actualWatcher.close();
|
|
102080
|
+
actualWatcher = ts.noopFileWatcher;
|
|
102081
|
+
}
|
|
102082
|
+
} : actualWatcher,
|
|
102083
|
+
resolutions: forResolution ? 1 : 0,
|
|
102084
|
+
files: forResolution ? 0 : 1,
|
|
101949
102085
|
paths: paths,
|
|
101950
102086
|
};
|
|
101951
|
-
fileWatchesOfAffectingLocations.set(
|
|
101952
|
-
if (
|
|
101953
|
-
fileWatchesOfAffectingLocations.set(
|
|
101954
|
-
paths.add(
|
|
102087
|
+
fileWatchesOfAffectingLocations.set(locationToWatch, watcher);
|
|
102088
|
+
if (affectingLocation !== locationToWatch) {
|
|
102089
|
+
fileWatchesOfAffectingLocations.set(affectingLocation, watcher);
|
|
102090
|
+
paths.add(affectingLocation);
|
|
101955
102091
|
}
|
|
101956
102092
|
}
|
|
101957
102093
|
function watchFailedLookupLocationOfNonRelativeModuleResolutions(resolutions, name) {
|
|
@@ -102019,8 +102155,8 @@ var ts;
|
|
|
102019
102155
|
}
|
|
102020
102156
|
for (var _a = 0, affectingLocations_2 = affectingLocations; _a < affectingLocations_2.length; _a++) {
|
|
102021
102157
|
var affectingLocation = affectingLocations_2[_a];
|
|
102022
|
-
var watcher = fileWatchesOfAffectingLocations.get(
|
|
102023
|
-
watcher.
|
|
102158
|
+
var watcher = fileWatchesOfAffectingLocations.get(affectingLocation);
|
|
102159
|
+
watcher.resolutions--;
|
|
102024
102160
|
}
|
|
102025
102161
|
}
|
|
102026
102162
|
function removeDirectoryWatcher(dirPath) {
|
|
@@ -102069,7 +102205,7 @@ var ts;
|
|
|
102069
102205
|
resolution.isInvalidated = invalidated = true;
|
|
102070
102206
|
for (var _a = 0, _b = ts.Debug.checkDefined(resolution.files); _a < _b.length; _a++) {
|
|
102071
102207
|
var containingFilePath = _b[_a];
|
|
102072
|
-
(filesWithInvalidatedResolutions
|
|
102208
|
+
(filesWithInvalidatedResolutions !== null && filesWithInvalidatedResolutions !== void 0 ? filesWithInvalidatedResolutions : (filesWithInvalidatedResolutions = new ts.Set())).add(containingFilePath);
|
|
102073
102209
|
hasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames || ts.endsWith(containingFilePath, ts.inferredTypesContainingFile);
|
|
102074
102210
|
}
|
|
102075
102211
|
}
|
|
@@ -102122,10 +102258,25 @@ var ts;
|
|
|
102122
102258
|
resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations();
|
|
102123
102259
|
}
|
|
102124
102260
|
function invalidateResolutionsOfFailedLookupLocations() {
|
|
102261
|
+
var _a;
|
|
102262
|
+
var invalidated = false;
|
|
102263
|
+
if (affectingPathChecksForFile) {
|
|
102264
|
+
(_a = resolutionHost.getCurrentProgram()) === null || _a === void 0 ? void 0 : _a.getSourceFiles().forEach(function (f) {
|
|
102265
|
+
if (ts.some(f.packageJsonLocations, function (location) { return affectingPathChecksForFile.has(location); })) {
|
|
102266
|
+
(filesWithInvalidatedResolutions !== null && filesWithInvalidatedResolutions !== void 0 ? filesWithInvalidatedResolutions : (filesWithInvalidatedResolutions = new ts.Set())).add(f.path);
|
|
102267
|
+
invalidated = true;
|
|
102268
|
+
}
|
|
102269
|
+
});
|
|
102270
|
+
affectingPathChecksForFile = undefined;
|
|
102271
|
+
}
|
|
102125
102272
|
if (!failedLookupChecks && !startsWithPathChecks && !isInDirectoryChecks && !affectingPathChecks) {
|
|
102126
|
-
return
|
|
102273
|
+
return invalidated;
|
|
102274
|
+
}
|
|
102275
|
+
invalidated = invalidateResolutions(resolutionsWithFailedLookups, canInvalidateFailedLookupResolution) || invalidated;
|
|
102276
|
+
var packageJsonMap = moduleResolutionCache.getPackageJsonInfoCache().getInternalMap();
|
|
102277
|
+
if (packageJsonMap && (failedLookupChecks || startsWithPathChecks || isInDirectoryChecks)) {
|
|
102278
|
+
packageJsonMap.forEach(function (_value, path) { return isInvalidatedFailedLookup(path) ? packageJsonMap.delete(path) : undefined; });
|
|
102127
102279
|
}
|
|
102128
|
-
var invalidated = invalidateResolutions(resolutionsWithFailedLookups, canInvalidateFailedLookupResolution);
|
|
102129
102280
|
failedLookupChecks = undefined;
|
|
102130
102281
|
startsWithPathChecks = undefined;
|
|
102131
102282
|
isInDirectoryChecks = undefined;
|
|
@@ -102138,17 +102289,15 @@ var ts;
|
|
|
102138
102289
|
return true;
|
|
102139
102290
|
if (!failedLookupChecks && !startsWithPathChecks && !isInDirectoryChecks)
|
|
102140
102291
|
return false;
|
|
102141
|
-
return resolution.failedLookupLocations.some(function (location) {
|
|
102142
|
-
|
|
102143
|
-
|
|
102144
|
-
|
|
102145
|
-
|
|
102146
|
-
|
|
102292
|
+
return resolution.failedLookupLocations.some(function (location) { return isInvalidatedFailedLookup(resolutionHost.toPath(location)); });
|
|
102293
|
+
}
|
|
102294
|
+
function isInvalidatedFailedLookup(locationPath) {
|
|
102295
|
+
return (failedLookupChecks === null || failedLookupChecks === void 0 ? void 0 : failedLookupChecks.has(locationPath)) ||
|
|
102296
|
+
ts.firstDefinedIterator((startsWithPathChecks === null || startsWithPathChecks === void 0 ? void 0 : startsWithPathChecks.keys()) || ts.emptyIterator, function (fileOrDirectoryPath) { return ts.startsWith(locationPath, fileOrDirectoryPath) ? true : undefined; }) ||
|
|
102297
|
+
ts.firstDefinedIterator((isInDirectoryChecks === null || isInDirectoryChecks === void 0 ? void 0 : isInDirectoryChecks.keys()) || ts.emptyIterator, function (fileOrDirectoryPath) { return isInDirectoryPath(fileOrDirectoryPath, locationPath) ? true : undefined; });
|
|
102147
102298
|
}
|
|
102148
102299
|
function canInvalidatedFailedLookupResolutionWithAffectingLocation(resolution) {
|
|
102149
|
-
return !!affectingPathChecks && resolution.affectingLocations.some(function (location) {
|
|
102150
|
-
return affectingPathChecks.has(resolutionHost.toPath(location));
|
|
102151
|
-
});
|
|
102300
|
+
return !!affectingPathChecks && resolution.affectingLocations.some(function (location) { return affectingPathChecks.has(location); });
|
|
102152
102301
|
}
|
|
102153
102302
|
function closeTypeRootsWatch() {
|
|
102154
102303
|
ts.clearMap(typeRootsWatches, ts.closeFileWatcher);
|
|
@@ -102194,7 +102343,7 @@ var ts;
|
|
|
102194
102343
|
function directoryExistsForTypeRootWatch(nodeTypesDirectory) {
|
|
102195
102344
|
var dir = ts.getDirectoryPath(ts.getDirectoryPath(nodeTypesDirectory));
|
|
102196
102345
|
var dirPath = resolutionHost.toPath(dir);
|
|
102197
|
-
return dirPath === rootPath ||
|
|
102346
|
+
return dirPath === rootPath || canWatchDirectoryOrFile(dirPath);
|
|
102198
102347
|
}
|
|
102199
102348
|
}
|
|
102200
102349
|
ts.createResolutionCache = createResolutionCache;
|
|
@@ -102279,7 +102428,7 @@ var ts;
|
|
|
102279
102428
|
var info = getInfo(importingSourceFileName, host);
|
|
102280
102429
|
var modulePaths = getAllModulePaths(importingSourceFileName, toFileName, host, userPreferences, options);
|
|
102281
102430
|
return ts.firstDefined(modulePaths, function (modulePath) { return tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, userPreferences, undefined, options.overrideImportMode); }) ||
|
|
102282
|
-
getLocalModuleSpecifier(toFileName, info, compilerOptions, host, preferences);
|
|
102431
|
+
getLocalModuleSpecifier(toFileName, info, compilerOptions, host, options.overrideImportMode || importingSourceFile.impliedNodeFormat, preferences);
|
|
102283
102432
|
}
|
|
102284
102433
|
function tryGetModuleSpecifiersFromCache(moduleSymbol, importingSourceFile, host, userPreferences, options) {
|
|
102285
102434
|
if (options === void 0) { options = {}; }
|
|
@@ -102350,7 +102499,7 @@ var ts;
|
|
|
102350
102499
|
return nodeModulesSpecifiers;
|
|
102351
102500
|
}
|
|
102352
102501
|
if (!specifier && !modulePath.isRedirect) {
|
|
102353
|
-
var local = getLocalModuleSpecifier(modulePath.path, info, compilerOptions, host, preferences);
|
|
102502
|
+
var local = getLocalModuleSpecifier(modulePath.path, info, compilerOptions, host, options.overrideImportMode || importingSourceFile.impliedNodeFormat, preferences);
|
|
102354
102503
|
if (ts.pathIsBareSpecifier(local)) {
|
|
102355
102504
|
pathsSpecifiers = ts.append(pathsSpecifiers, local);
|
|
102356
102505
|
}
|
|
@@ -102368,7 +102517,7 @@ var ts;
|
|
|
102368
102517
|
var sourceDirectory = ts.getDirectoryPath(importingSourceFileName);
|
|
102369
102518
|
return { getCanonicalFileName: getCanonicalFileName, importingSourceFileName: importingSourceFileName, sourceDirectory: sourceDirectory };
|
|
102370
102519
|
}
|
|
102371
|
-
function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, _a) {
|
|
102520
|
+
function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, importMode, _a) {
|
|
102372
102521
|
var ending = _a.ending, relativePreference = _a.relativePreference;
|
|
102373
102522
|
var baseUrl = compilerOptions.baseUrl, paths = compilerOptions.paths, rootDirs = compilerOptions.rootDirs;
|
|
102374
102523
|
var sourceDirectory = info.sourceDirectory, getCanonicalFileName = info.getCanonicalFileName;
|
|
@@ -102382,9 +102531,8 @@ var ts;
|
|
|
102382
102531
|
if (!relativeToBaseUrl) {
|
|
102383
102532
|
return relativePath;
|
|
102384
102533
|
}
|
|
102385
|
-
var
|
|
102386
|
-
var
|
|
102387
|
-
var nonRelative = fromPaths === undefined && baseUrl !== undefined ? importRelativeToBaseUrl : fromPaths;
|
|
102534
|
+
var fromPaths = paths && tryGetModuleNameFromPaths(relativeToBaseUrl, paths, getAllowedEndings(ending, compilerOptions, importMode), host, compilerOptions);
|
|
102535
|
+
var nonRelative = fromPaths === undefined && baseUrl !== undefined ? removeExtensionAndIndexPostFix(relativeToBaseUrl, ending, compilerOptions) : fromPaths;
|
|
102388
102536
|
if (!nonRelative) {
|
|
102389
102537
|
return relativePath;
|
|
102390
102538
|
}
|
|
@@ -102581,28 +102729,59 @@ var ts;
|
|
|
102581
102729
|
return ambientModuleDeclare.name.text;
|
|
102582
102730
|
}
|
|
102583
102731
|
}
|
|
102584
|
-
function
|
|
102732
|
+
function getAllowedEndings(preferredEnding, compilerOptions, importMode) {
|
|
102733
|
+
if (ts.getEmitModuleResolutionKind(compilerOptions) >= ts.ModuleResolutionKind.Node16 && importMode === ts.ModuleKind.ESNext) {
|
|
102734
|
+
return [2];
|
|
102735
|
+
}
|
|
102736
|
+
switch (preferredEnding) {
|
|
102737
|
+
case 2: return [2, 0, 1];
|
|
102738
|
+
case 1: return [1, 0, 2];
|
|
102739
|
+
case 0: return [0, 1, 2];
|
|
102740
|
+
default: ts.Debug.assertNever(preferredEnding);
|
|
102741
|
+
}
|
|
102742
|
+
}
|
|
102743
|
+
function tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, host, compilerOptions) {
|
|
102585
102744
|
for (var key in paths) {
|
|
102586
|
-
|
|
102587
|
-
var
|
|
102588
|
-
var pattern = ts.removeFileExtension(ts.normalizePath(patternText_1));
|
|
102745
|
+
var _loop_36 = function (patternText_1) {
|
|
102746
|
+
var pattern = ts.normalizePath(patternText_1);
|
|
102589
102747
|
var indexOfStar = pattern.indexOf("*");
|
|
102748
|
+
var candidates = allowedEndings.map(function (ending) { return ({
|
|
102749
|
+
ending: ending,
|
|
102750
|
+
value: removeExtensionAndIndexPostFix(relativeToBaseUrl, ending, compilerOptions)
|
|
102751
|
+
}); });
|
|
102752
|
+
if (ts.tryGetExtensionFromPath(pattern)) {
|
|
102753
|
+
candidates.push({ ending: undefined, value: relativeToBaseUrl });
|
|
102754
|
+
}
|
|
102590
102755
|
if (indexOfStar !== -1) {
|
|
102591
|
-
var prefix = pattern.
|
|
102592
|
-
var suffix = pattern.
|
|
102593
|
-
|
|
102594
|
-
|
|
102595
|
-
|
|
102596
|
-
|
|
102597
|
-
|
|
102598
|
-
|
|
102756
|
+
var prefix = pattern.substring(0, indexOfStar);
|
|
102757
|
+
var suffix = pattern.substring(indexOfStar + 1);
|
|
102758
|
+
for (var _b = 0, candidates_3 = candidates; _b < candidates_3.length; _b++) {
|
|
102759
|
+
var _c = candidates_3[_b], ending = _c.ending, value = _c.value;
|
|
102760
|
+
if (value.length >= prefix.length + suffix.length &&
|
|
102761
|
+
ts.startsWith(value, prefix) &&
|
|
102762
|
+
ts.endsWith(value, suffix) &&
|
|
102763
|
+
validateEnding({ ending: ending, value: value })) {
|
|
102764
|
+
var matchedStar = value.substring(prefix.length, value.length - suffix.length);
|
|
102765
|
+
return { value: key.replace("*", matchedStar) };
|
|
102766
|
+
}
|
|
102599
102767
|
}
|
|
102600
102768
|
}
|
|
102601
|
-
else if (
|
|
102602
|
-
return
|
|
102769
|
+
else if (ts.some(candidates, function (c) { return c.ending !== 0 && pattern === c.value; }) ||
|
|
102770
|
+
ts.some(candidates, function (c) { return c.ending === 0 && pattern === c.value && validateEnding(c); })) {
|
|
102771
|
+
return { value: key };
|
|
102603
102772
|
}
|
|
102773
|
+
};
|
|
102774
|
+
for (var _i = 0, _a = paths[key]; _i < _a.length; _i++) {
|
|
102775
|
+
var patternText_1 = _a[_i];
|
|
102776
|
+
var state_12 = _loop_36(patternText_1);
|
|
102777
|
+
if (typeof state_12 === "object")
|
|
102778
|
+
return state_12.value;
|
|
102604
102779
|
}
|
|
102605
102780
|
}
|
|
102781
|
+
function validateEnding(_a) {
|
|
102782
|
+
var ending = _a.ending, value = _a.value;
|
|
102783
|
+
return ending !== 0 || value === removeExtensionAndIndexPostFix(relativeToBaseUrl, ending, compilerOptions, host);
|
|
102784
|
+
}
|
|
102606
102785
|
}
|
|
102607
102786
|
function tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, packageName, exports, conditions, mode) {
|
|
102608
102787
|
if (mode === void 0) { mode = 0; }
|
|
@@ -102685,10 +102864,10 @@ var ts;
|
|
|
102685
102864
|
if (!parts) {
|
|
102686
102865
|
return undefined;
|
|
102687
102866
|
}
|
|
102867
|
+
var preferences = getPreferences(host, userPreferences, options, importingSourceFile);
|
|
102688
102868
|
var moduleSpecifier = path;
|
|
102689
102869
|
var isPackageRootPath = false;
|
|
102690
102870
|
if (!packageNameOnly) {
|
|
102691
|
-
var preferences = getPreferences(host, userPreferences, options, importingSourceFile);
|
|
102692
102871
|
var packageRootIndex = parts.packageRootIndex;
|
|
102693
102872
|
var moduleFileName = void 0;
|
|
102694
102873
|
while (true) {
|
|
@@ -102731,11 +102910,13 @@ var ts;
|
|
|
102731
102910
|
var packageRootPath = path.substring(0, packageRootIndex);
|
|
102732
102911
|
var packageJsonPath = ts.combinePaths(packageRootPath, "package.json");
|
|
102733
102912
|
var moduleFileToTry = path;
|
|
102913
|
+
var maybeBlockedByTypesVersions = false;
|
|
102734
102914
|
var cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) === null || _a === void 0 ? void 0 : _a.call(host)) === null || _b === void 0 ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
|
|
102735
102915
|
if (typeof cachedPackageJson === "object" || cachedPackageJson === undefined && host.fileExists(packageJsonPath)) {
|
|
102736
102916
|
var packageJsonContent = (cachedPackageJson === null || cachedPackageJson === void 0 ? void 0 : cachedPackageJson.packageJsonContent) || JSON.parse(host.readFile(packageJsonPath));
|
|
102917
|
+
var importMode = overrideMode || importingSourceFile.impliedNodeFormat;
|
|
102737
102918
|
if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext) {
|
|
102738
|
-
var conditions = ["node",
|
|
102919
|
+
var conditions = ["node", importMode === ts.ModuleKind.ESNext ? "import" : "require", "types"];
|
|
102739
102920
|
var fromExports = packageJsonContent.exports && typeof packageJsonContent.name === "string"
|
|
102740
102921
|
? tryGetModuleNameFromExports(options, path, packageRootPath, ts.getPackageNameFromTypesPackageName(packageJsonContent.name), packageJsonContent.exports, conditions)
|
|
102741
102922
|
: undefined;
|
|
@@ -102754,13 +102935,16 @@ var ts;
|
|
|
102754
102935
|
: undefined;
|
|
102755
102936
|
if (versionPaths) {
|
|
102756
102937
|
var subModuleName = path.slice(packageRootPath.length + 1);
|
|
102757
|
-
var fromPaths = tryGetModuleNameFromPaths(
|
|
102758
|
-
if (fromPaths
|
|
102938
|
+
var fromPaths = tryGetModuleNameFromPaths(subModuleName, versionPaths.paths, getAllowedEndings(preferences.ending, options, importMode), host, options);
|
|
102939
|
+
if (fromPaths === undefined) {
|
|
102940
|
+
maybeBlockedByTypesVersions = true;
|
|
102941
|
+
}
|
|
102942
|
+
else {
|
|
102759
102943
|
moduleFileToTry = ts.combinePaths(packageRootPath, fromPaths);
|
|
102760
102944
|
}
|
|
102761
102945
|
}
|
|
102762
102946
|
var mainFileRelative = packageJsonContent.typings || packageJsonContent.types || packageJsonContent.main || "index.js";
|
|
102763
|
-
if (ts.isString(mainFileRelative)) {
|
|
102947
|
+
if (ts.isString(mainFileRelative) && !(maybeBlockedByTypesVersions && ts.matchPatternOrExact(ts.tryParsePatterns(versionPaths.paths), mainFileRelative))) {
|
|
102764
102948
|
var mainExportFile = ts.toPath(mainFileRelative, packageRootPath, getCanonicalFileName);
|
|
102765
102949
|
if (ts.removeFileExtension(mainExportFile) === ts.removeFileExtension(getCanonicalFileName(moduleFileToTry))) {
|
|
102766
102950
|
return { packageRootPath: packageRootPath, moduleFileToTry: moduleFileToTry };
|
|
@@ -103039,21 +103223,41 @@ var ts;
|
|
|
103039
103223
|
var file = _c[_i];
|
|
103040
103224
|
write("" + toFileName(file, relativeFileName));
|
|
103041
103225
|
(_a = reasons.get(file.path)) === null || _a === void 0 ? void 0 : _a.forEach(function (reason) { return write(" " + fileIncludeReasonToDiagnostics(program, reason, relativeFileName).messageText); });
|
|
103042
|
-
(_b =
|
|
103226
|
+
(_b = explainIfFileIsRedirectAndImpliedFormat(file, relativeFileName)) === null || _b === void 0 ? void 0 : _b.forEach(function (d) { return write(" " + d.messageText); });
|
|
103043
103227
|
}
|
|
103044
103228
|
}
|
|
103045
103229
|
ts.explainFiles = explainFiles;
|
|
103046
|
-
function
|
|
103230
|
+
function explainIfFileIsRedirectAndImpliedFormat(file, fileNameConvertor) {
|
|
103231
|
+
var _a;
|
|
103047
103232
|
var result;
|
|
103048
103233
|
if (file.path !== file.resolvedPath) {
|
|
103049
|
-
(result
|
|
103234
|
+
(result !== null && result !== void 0 ? result : (result = [])).push(ts.chainDiagnosticMessages(undefined, ts.Diagnostics.File_is_output_of_project_reference_source_0, toFileName(file.originalFileName, fileNameConvertor)));
|
|
103050
103235
|
}
|
|
103051
103236
|
if (file.redirectInfo) {
|
|
103052
|
-
(result
|
|
103237
|
+
(result !== null && result !== void 0 ? result : (result = [])).push(ts.chainDiagnosticMessages(undefined, ts.Diagnostics.File_redirects_to_file_0, toFileName(file.redirectInfo.redirectTarget, fileNameConvertor)));
|
|
103238
|
+
}
|
|
103239
|
+
if (ts.isExternalOrCommonJsModule(file)) {
|
|
103240
|
+
switch (file.impliedNodeFormat) {
|
|
103241
|
+
case ts.ModuleKind.ESNext:
|
|
103242
|
+
if (file.packageJsonScope) {
|
|
103243
|
+
(result !== null && result !== void 0 ? result : (result = [])).push(ts.chainDiagnosticMessages(undefined, ts.Diagnostics.File_is_ECMAScript_module_because_0_has_field_type_with_value_module, toFileName(ts.last(file.packageJsonLocations), fileNameConvertor)));
|
|
103244
|
+
}
|
|
103245
|
+
break;
|
|
103246
|
+
case ts.ModuleKind.CommonJS:
|
|
103247
|
+
if (file.packageJsonScope) {
|
|
103248
|
+
(result !== null && result !== void 0 ? result : (result = [])).push(ts.chainDiagnosticMessages(undefined, file.packageJsonScope.packageJsonContent.type ?
|
|
103249
|
+
ts.Diagnostics.File_is_CommonJS_module_because_0_has_field_type_whose_value_is_not_module :
|
|
103250
|
+
ts.Diagnostics.File_is_CommonJS_module_because_0_does_not_have_field_type, toFileName(ts.last(file.packageJsonLocations), fileNameConvertor)));
|
|
103251
|
+
}
|
|
103252
|
+
else if ((_a = file.packageJsonLocations) === null || _a === void 0 ? void 0 : _a.length) {
|
|
103253
|
+
(result !== null && result !== void 0 ? result : (result = [])).push(ts.chainDiagnosticMessages(undefined, ts.Diagnostics.File_is_CommonJS_module_because_package_json_was_not_found));
|
|
103254
|
+
}
|
|
103255
|
+
break;
|
|
103256
|
+
}
|
|
103053
103257
|
}
|
|
103054
103258
|
return result;
|
|
103055
103259
|
}
|
|
103056
|
-
ts.
|
|
103260
|
+
ts.explainIfFileIsRedirectAndImpliedFormat = explainIfFileIsRedirectAndImpliedFormat;
|
|
103057
103261
|
function getMatchedFileSpec(program, fileName) {
|
|
103058
103262
|
var _a;
|
|
103059
103263
|
var configFile = program.getCompilerOptions().configFile;
|
|
@@ -103246,6 +103450,7 @@ var ts;
|
|
|
103246
103450
|
MissingFile: "Missing file",
|
|
103247
103451
|
WildcardDirectory: "Wild card directory",
|
|
103248
103452
|
FailedLookupLocations: "Failed Lookup Locations",
|
|
103453
|
+
AffectingFileLocation: "File location affecting resolution",
|
|
103249
103454
|
TypeRoots: "Type roots",
|
|
103250
103455
|
ConfigFileOfReferencedProject: "Config file of referened project",
|
|
103251
103456
|
ExtendedConfigOfReferencedProject: "Extended config file of referenced project",
|
|
@@ -103547,7 +103752,7 @@ var ts;
|
|
|
103547
103752
|
compilerHost.getCompilationSettings = function () { return compilerOptions; };
|
|
103548
103753
|
compilerHost.useSourceOfProjectReferenceRedirect = ts.maybeBind(host, host.useSourceOfProjectReferenceRedirect);
|
|
103549
103754
|
compilerHost.watchDirectoryOfFailedLookupLocation = function (dir, cb, flags) { return watchDirectory(dir, cb, flags, watchOptions, ts.WatchType.FailedLookupLocations); };
|
|
103550
|
-
compilerHost.watchAffectingFileLocation = function (file, cb) { return watchFile(file, cb, ts.PollingInterval.High, watchOptions, ts.WatchType.
|
|
103755
|
+
compilerHost.watchAffectingFileLocation = function (file, cb) { return watchFile(file, cb, ts.PollingInterval.High, watchOptions, ts.WatchType.AffectingFileLocation); };
|
|
103551
103756
|
compilerHost.watchTypeRootsDirectory = function (dir, cb, flags) { return watchDirectory(dir, cb, flags, watchOptions, ts.WatchType.TypeRoots); };
|
|
103552
103757
|
compilerHost.getCachedDirectoryStructureHost = function () { return cachedDirectoryStructureHost; };
|
|
103553
103758
|
compilerHost.scheduleInvalidateResolutionsOfFailedLookupLocations = scheduleInvalidateResolutionsOfFailedLookupLocations;
|
|
@@ -103578,6 +103783,9 @@ var ts;
|
|
|
103578
103783
|
return host.resolveTypeReferenceDirectives.apply(host, args);
|
|
103579
103784
|
}) :
|
|
103580
103785
|
(function (typeDirectiveNames, containingFile, redirectedReference, _options, containingFileMode) { return resolutionCache.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference, containingFileMode); });
|
|
103786
|
+
compilerHost.getModuleResolutionCache = host.resolveModuleNames ?
|
|
103787
|
+
ts.maybeBind(host, host.getModuleResolutionCache) :
|
|
103788
|
+
(function () { return resolutionCache.getModuleResolutionCache(); });
|
|
103581
103789
|
var userProvidedResolution = !!host.resolveModuleNames || !!host.resolveTypeReferenceDirectives;
|
|
103582
103790
|
builderProgram = readBuilderProgram(compilerOptions, compilerHost);
|
|
103583
103791
|
synchronizeProgram();
|
|
@@ -103676,8 +103884,9 @@ var ts;
|
|
|
103676
103884
|
resolutionCache.startCachingPerDirectoryResolution();
|
|
103677
103885
|
compilerHost.hasInvalidatedResolution = hasInvalidatedResolution;
|
|
103678
103886
|
compilerHost.hasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames;
|
|
103887
|
+
var oldProgram = getCurrentProgram();
|
|
103679
103888
|
builderProgram = createProgram(rootFileNames, compilerOptions, compilerHost, builderProgram, configFileParsingDiagnostics, projectReferences);
|
|
103680
|
-
resolutionCache.finishCachingPerDirectoryResolution();
|
|
103889
|
+
resolutionCache.finishCachingPerDirectoryResolution(builderProgram.getProgram(), oldProgram);
|
|
103681
103890
|
ts.updateMissingFilePathsWatch(builderProgram.getProgram(), missingFilesMap || (missingFilesMap = new ts.Map()), watchMissingFilePath);
|
|
103682
103891
|
if (needsUpdateInTypeRootWatch) {
|
|
103683
103892
|
resolutionCache.updateTypeRootsWatch();
|
|
@@ -103747,9 +103956,6 @@ var ts;
|
|
|
103747
103956
|
sourceFilesCache.set(path, false);
|
|
103748
103957
|
}
|
|
103749
103958
|
}
|
|
103750
|
-
if (sourceFile) {
|
|
103751
|
-
sourceFile.impliedNodeFormat = ts.getImpliedNodeFormatForFile(path, resolutionCache.getModuleResolutionCache().getPackageJsonInfoCache(), compilerHost, compilerHost.getCompilationSettings());
|
|
103752
|
-
}
|
|
103753
103959
|
return sourceFile;
|
|
103754
103960
|
}
|
|
103755
103961
|
return hostSourceFile.sourceFile;
|
|
@@ -104202,6 +104408,7 @@ var ts;
|
|
|
104202
104408
|
compilerHost.getParsedCommandLine = function (fileName) { return parseConfigFile(state, fileName, toResolvedConfigFilePath(state, fileName)); };
|
|
104203
104409
|
compilerHost.resolveModuleNames = ts.maybeBind(host, host.resolveModuleNames);
|
|
104204
104410
|
compilerHost.resolveTypeReferenceDirectives = ts.maybeBind(host, host.resolveTypeReferenceDirectives);
|
|
104411
|
+
compilerHost.getModuleResolutionCache = ts.maybeBind(host, host.getModuleResolutionCache);
|
|
104205
104412
|
var moduleResolutionCache = !compilerHost.resolveModuleNames ? ts.createModuleResolutionCache(currentDirectory, getCanonicalFileName) : undefined;
|
|
104206
104413
|
var typeReferenceDirectiveResolutionCache = !compilerHost.resolveTypeReferenceDirectives ? ts.createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, undefined, moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache()) : undefined;
|
|
104207
104414
|
if (!compilerHost.resolveModuleNames) {
|