typescript 4.8.0-dev.20220802 → 4.8.0-dev.20220805
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/cs/diagnosticMessages.generated.json +4 -0
- package/lib/de/diagnosticMessages.generated.json +4 -0
- package/lib/es/diagnosticMessages.generated.json +4 -0
- package/lib/fr/diagnosticMessages.generated.json +4 -0
- package/lib/it/diagnosticMessages.generated.json +4 -0
- package/lib/ja/diagnosticMessages.generated.json +4 -0
- package/lib/ko/diagnosticMessages.generated.json +4 -0
- package/lib/lib.es2015.promise.d.ts +9 -4
- package/lib/lib.es5.d.ts +2 -2
- package/lib/pl/diagnosticMessages.generated.json +4 -0
- package/lib/pt-br/diagnosticMessages.generated.json +4 -0
- package/lib/ru/diagnosticMessages.generated.json +4 -0
- package/lib/tr/diagnosticMessages.generated.json +4 -0
- package/lib/tsc.js +231 -111
- package/lib/tsserver.js +320 -132
- package/lib/tsserverlibrary.js +320 -132
- package/lib/typescript.js +320 -132
- package/lib/typescriptServices.js +320 -132
- package/lib/typingsInstaller.js +316 -131
- package/lib/zh-cn/diagnosticMessages.generated.json +4 -0
- package/lib/zh-tw/diagnosticMessages.generated.json +4 -0
- 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.20220805";
|
|
73
73
|
var NativeCollections;
|
|
74
74
|
(function (NativeCollections) {
|
|
75
75
|
var globals = typeof globalThis !== "undefined" ? globalThis :
|
|
@@ -5732,7 +5732,7 @@ var ts;
|
|
|
5732
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
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"),
|
|
5734
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."),
|
|
5735
|
-
|
|
5735
|
+
Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_with_require_Use_an_ECMAScript_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 with 'require'. Use an ECMAScript import instead."),
|
|
5736
5736
|
catch_or_finally_expected: diag(1472, ts.DiagnosticCategory.Error, "catch_or_finally_expected_1472", "'catch' or 'finally' expected."),
|
|
5737
5737
|
An_import_declaration_can_only_be_used_at_the_top_level_of_a_module: diag(1473, ts.DiagnosticCategory.Error, "An_import_declaration_can_only_be_used_at_the_top_level_of_a_module_1473", "An import declaration can only be used at the top level of a module."),
|
|
5738
5738
|
An_export_declaration_can_only_be_used_at_the_top_level_of_a_module: diag(1474, ts.DiagnosticCategory.Error, "An_export_declaration_can_only_be_used_at_the_top_level_of_a_module_1474", "An export declaration can only be used at the top level of a module."),
|
|
@@ -5740,6 +5740,11 @@ var ts;
|
|
|
5740
5740
|
auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_with_module_Colon_node16_as_modules: diag(1476, ts.DiagnosticCategory.Message, "auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_w_1476", "\"auto\": Treat files with imports, exports, import.meta, jsx (with jsx: react-jsx), or esm format (with module: node16+) as modules."),
|
|
5741
5741
|
An_instantiation_expression_cannot_be_followed_by_a_property_access: diag(1477, ts.DiagnosticCategory.Error, "An_instantiation_expression_cannot_be_followed_by_a_property_access_1477", "An instantiation expression cannot be followed by a property access."),
|
|
5742
5742
|
Identifier_or_string_literal_expected: diag(1478, ts.DiagnosticCategory.Error, "Identifier_or_string_literal_expected_1478", "Identifier or string literal expected."),
|
|
5743
|
+
The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_referenced_file_is_an_ECMAScript_module_and_cannot_be_imported_with_require_Consider_writing_a_dynamic_import_0_call_instead: diag(1479, ts.DiagnosticCategory.Error, "The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_reference_1479", "The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import(\"{0}\")' call instead."),
|
|
5744
|
+
To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_package_json_file_with_type_Colon_module: diag(1480, ts.DiagnosticCategory.Message, "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_packag_1480", "To convert this file to an ECMAScript module, change its file extension to '{0}' or create a local package.json file with `{ \"type\": \"module\" }`."),
|
|
5745
|
+
To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Colon_module_to_1: diag(1481, ts.DiagnosticCategory.Message, "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Co_1481", "To convert this file to an ECMAScript module, change its file extension to '{0}', or add the field `\"type\": \"module\"` to '{1}'."),
|
|
5746
|
+
To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0: diag(1482, ts.DiagnosticCategory.Message, "To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0_1482", "To convert this file to an ECMAScript module, add the field `\"type\": \"module\"` to '{0}'."),
|
|
5747
|
+
To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module: diag(1483, ts.DiagnosticCategory.Message, "To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module_1483", "To convert this file to an ECMAScript module, create a local package.json file with `{ \"type\": \"module\" }`."),
|
|
5743
5748
|
The_types_of_0_are_incompatible_between_these_types: diag(2200, ts.DiagnosticCategory.Error, "The_types_of_0_are_incompatible_between_these_types_2200", "The types of '{0}' are incompatible between these types."),
|
|
5744
5749
|
The_types_returned_by_0_are_incompatible_between_these_types: diag(2201, ts.DiagnosticCategory.Error, "The_types_returned_by_0_are_incompatible_between_these_types_2201", "The types returned by '{0}' are incompatible between these types."),
|
|
5745
5750
|
Call_signature_return_types_0_and_1_are_incompatible: diag(2202, ts.DiagnosticCategory.Error, "Call_signature_return_types_0_and_1_are_incompatible_2202", "Call signature return types '{0}' and '{1}' are incompatible.", undefined, true),
|
|
@@ -17383,10 +17388,11 @@ var ts;
|
|
|
17383
17388
|
}
|
|
17384
17389
|
return parenthesizeLeftSideOfAccess(expression);
|
|
17385
17390
|
}
|
|
17386
|
-
function parenthesizeLeftSideOfAccess(expression) {
|
|
17391
|
+
function parenthesizeLeftSideOfAccess(expression, optionalChain) {
|
|
17387
17392
|
var emittedExpression = ts.skipPartiallyEmittedExpressions(expression);
|
|
17388
17393
|
if (ts.isLeftHandSideExpression(emittedExpression)
|
|
17389
|
-
&& (emittedExpression.kind !== 209 || emittedExpression.arguments)
|
|
17394
|
+
&& (emittedExpression.kind !== 209 || emittedExpression.arguments)
|
|
17395
|
+
&& (optionalChain || !ts.isOptionalChain(emittedExpression))) {
|
|
17390
17396
|
return expression;
|
|
17391
17397
|
}
|
|
17392
17398
|
return ts.setTextRange(factory.createParenthesizedExpression(expression), expression);
|
|
@@ -18596,7 +18602,7 @@ var ts;
|
|
|
18596
18602
|
}
|
|
18597
18603
|
function createDecorator(expression) {
|
|
18598
18604
|
var node = createBaseNode(165);
|
|
18599
|
-
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression);
|
|
18605
|
+
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, false);
|
|
18600
18606
|
node.transformFlags |=
|
|
18601
18607
|
propagateChildFlags(node.expression) |
|
|
18602
18608
|
1 |
|
|
@@ -19270,7 +19276,7 @@ var ts;
|
|
|
19270
19276
|
}
|
|
19271
19277
|
function createPropertyAccessExpression(expression, name) {
|
|
19272
19278
|
var node = createBaseExpression(206);
|
|
19273
|
-
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression);
|
|
19279
|
+
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, false);
|
|
19274
19280
|
node.name = asName(name);
|
|
19275
19281
|
node.transformFlags =
|
|
19276
19282
|
propagateChildFlags(node.expression) |
|
|
@@ -19296,7 +19302,7 @@ var ts;
|
|
|
19296
19302
|
function createPropertyAccessChain(expression, questionDotToken, name) {
|
|
19297
19303
|
var node = createBaseExpression(206);
|
|
19298
19304
|
node.flags |= 32;
|
|
19299
|
-
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression);
|
|
19305
|
+
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, true);
|
|
19300
19306
|
node.questionDotToken = questionDotToken;
|
|
19301
19307
|
node.name = asName(name);
|
|
19302
19308
|
node.transformFlags |=
|
|
@@ -19318,7 +19324,7 @@ var ts;
|
|
|
19318
19324
|
}
|
|
19319
19325
|
function createElementAccessExpression(expression, index) {
|
|
19320
19326
|
var node = createBaseExpression(207);
|
|
19321
|
-
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression);
|
|
19327
|
+
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, false);
|
|
19322
19328
|
node.argumentExpression = asExpression(index);
|
|
19323
19329
|
node.transformFlags |=
|
|
19324
19330
|
propagateChildFlags(node.expression) |
|
|
@@ -19342,7 +19348,7 @@ var ts;
|
|
|
19342
19348
|
function createElementAccessChain(expression, questionDotToken, index) {
|
|
19343
19349
|
var node = createBaseExpression(207);
|
|
19344
19350
|
node.flags |= 32;
|
|
19345
|
-
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression);
|
|
19351
|
+
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, true);
|
|
19346
19352
|
node.questionDotToken = questionDotToken;
|
|
19347
19353
|
node.argumentExpression = asExpression(index);
|
|
19348
19354
|
node.transformFlags |=
|
|
@@ -19362,7 +19368,7 @@ var ts;
|
|
|
19362
19368
|
}
|
|
19363
19369
|
function createCallExpression(expression, typeArguments, argumentsArray) {
|
|
19364
19370
|
var node = createBaseExpression(208);
|
|
19365
|
-
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression);
|
|
19371
|
+
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, false);
|
|
19366
19372
|
node.typeArguments = asNodeArray(typeArguments);
|
|
19367
19373
|
node.arguments = parenthesizerRules().parenthesizeExpressionsOfCommaDelimitedList(createNodeArray(argumentsArray));
|
|
19368
19374
|
node.transformFlags |=
|
|
@@ -19393,7 +19399,7 @@ var ts;
|
|
|
19393
19399
|
function createCallChain(expression, questionDotToken, typeArguments, argumentsArray) {
|
|
19394
19400
|
var node = createBaseExpression(208);
|
|
19395
19401
|
node.flags |= 32;
|
|
19396
|
-
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression);
|
|
19402
|
+
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, true);
|
|
19397
19403
|
node.questionDotToken = questionDotToken;
|
|
19398
19404
|
node.typeArguments = asNodeArray(typeArguments);
|
|
19399
19405
|
node.arguments = parenthesizerRules().parenthesizeExpressionsOfCommaDelimitedList(createNodeArray(argumentsArray));
|
|
@@ -19444,7 +19450,7 @@ var ts;
|
|
|
19444
19450
|
}
|
|
19445
19451
|
function createTaggedTemplateExpression(tag, typeArguments, template) {
|
|
19446
19452
|
var node = createBaseExpression(210);
|
|
19447
|
-
node.tag = parenthesizerRules().parenthesizeLeftSideOfAccess(tag);
|
|
19453
|
+
node.tag = parenthesizerRules().parenthesizeLeftSideOfAccess(tag, false);
|
|
19448
19454
|
node.typeArguments = asNodeArray(typeArguments);
|
|
19449
19455
|
node.template = template;
|
|
19450
19456
|
node.transformFlags |=
|
|
@@ -19833,7 +19839,7 @@ var ts;
|
|
|
19833
19839
|
}
|
|
19834
19840
|
function createExpressionWithTypeArguments(expression, typeArguments) {
|
|
19835
19841
|
var node = createBaseNode(228);
|
|
19836
|
-
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression);
|
|
19842
|
+
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, false);
|
|
19837
19843
|
node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(typeArguments);
|
|
19838
19844
|
node.transformFlags |=
|
|
19839
19845
|
propagateChildFlags(node.expression) |
|
|
@@ -19865,7 +19871,7 @@ var ts;
|
|
|
19865
19871
|
}
|
|
19866
19872
|
function createNonNullExpression(expression) {
|
|
19867
19873
|
var node = createBaseExpression(230);
|
|
19868
|
-
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression);
|
|
19874
|
+
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, false);
|
|
19869
19875
|
node.transformFlags |=
|
|
19870
19876
|
propagateChildFlags(node.expression) |
|
|
19871
19877
|
1;
|
|
@@ -19882,7 +19888,7 @@ var ts;
|
|
|
19882
19888
|
function createNonNullChain(expression) {
|
|
19883
19889
|
var node = createBaseExpression(230);
|
|
19884
19890
|
node.flags |= 32;
|
|
19885
|
-
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression);
|
|
19891
|
+
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, true);
|
|
19886
19892
|
node.transformFlags |=
|
|
19887
19893
|
propagateChildFlags(node.expression) |
|
|
19888
19894
|
1;
|
|
@@ -21725,7 +21731,7 @@ var ts;
|
|
|
21725
21731
|
}
|
|
21726
21732
|
else if (ts.getEmitFlags(callee) & 4096) {
|
|
21727
21733
|
thisArg = createVoidZero();
|
|
21728
|
-
target = parenthesizerRules().parenthesizeLeftSideOfAccess(callee);
|
|
21734
|
+
target = parenthesizerRules().parenthesizeLeftSideOfAccess(callee, false);
|
|
21729
21735
|
}
|
|
21730
21736
|
else if (ts.isPropertyAccessExpression(callee)) {
|
|
21731
21737
|
if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) {
|
|
@@ -21751,7 +21757,7 @@ var ts;
|
|
|
21751
21757
|
}
|
|
21752
21758
|
else {
|
|
21753
21759
|
thisArg = createVoidZero();
|
|
21754
|
-
target = parenthesizerRules().parenthesizeLeftSideOfAccess(expression);
|
|
21760
|
+
target = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, false);
|
|
21755
21761
|
}
|
|
21756
21762
|
return { target: target, thisArg: thisArg };
|
|
21757
21763
|
}
|
|
@@ -42487,7 +42493,34 @@ var ts;
|
|
|
42487
42493
|
var overrideClauseHost = ts.findAncestor(location, function (l) { return ts.isImportTypeNode(l) || ts.isExportDeclaration(l) || ts.isImportDeclaration(l); });
|
|
42488
42494
|
var overrideClause = overrideClauseHost && ts.isImportTypeNode(overrideClauseHost) ? (_g = overrideClauseHost.assertions) === null || _g === void 0 ? void 0 : _g.assertClause : overrideClauseHost === null || overrideClauseHost === void 0 ? void 0 : overrideClauseHost.assertClause;
|
|
42489
42495
|
if (isSyncImport && sourceFile.impliedNodeFormat === ts.ModuleKind.ESNext && !ts.getResolutionModeOverrideForClause(overrideClause)) {
|
|
42490
|
-
|
|
42496
|
+
if (ts.findAncestor(location, ts.isImportEqualsDeclaration)) {
|
|
42497
|
+
error(errorNode, ts.Diagnostics.Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_with_require_Use_an_ECMAScript_import_instead, moduleReference);
|
|
42498
|
+
}
|
|
42499
|
+
else {
|
|
42500
|
+
var diagnosticDetails = void 0;
|
|
42501
|
+
var ext = ts.tryGetExtensionFromPath(currentSourceFile.fileName);
|
|
42502
|
+
if (ext === ".ts" || ext === ".js" || ext === ".tsx" || ext === ".jsx") {
|
|
42503
|
+
var scope = currentSourceFile.packageJsonScope;
|
|
42504
|
+
var targetExt = ext === ".ts" ? ".mts" : ext === ".js" ? ".mjs" : undefined;
|
|
42505
|
+
if (scope && !scope.packageJsonContent.type) {
|
|
42506
|
+
if (targetExt) {
|
|
42507
|
+
diagnosticDetails = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Colon_module_to_1, targetExt, ts.combinePaths(scope.packageDirectory, "package.json"));
|
|
42508
|
+
}
|
|
42509
|
+
else {
|
|
42510
|
+
diagnosticDetails = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0, ts.combinePaths(scope.packageDirectory, "package.json"));
|
|
42511
|
+
}
|
|
42512
|
+
}
|
|
42513
|
+
else {
|
|
42514
|
+
if (targetExt) {
|
|
42515
|
+
diagnosticDetails = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_package_json_file_with_type_Colon_module, targetExt);
|
|
42516
|
+
}
|
|
42517
|
+
else {
|
|
42518
|
+
diagnosticDetails = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module);
|
|
42519
|
+
}
|
|
42520
|
+
}
|
|
42521
|
+
}
|
|
42522
|
+
diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(errorNode, ts.chainDiagnosticMessages(diagnosticDetails, ts.Diagnostics.The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_referenced_file_is_an_ECMAScript_module_and_cannot_be_imported_with_require_Consider_writing_a_dynamic_import_0_call_instead, moduleReference)));
|
|
42523
|
+
}
|
|
42491
42524
|
}
|
|
42492
42525
|
}
|
|
42493
42526
|
return getMergedSymbol(sourceFile.symbol);
|
|
@@ -55226,6 +55259,12 @@ var ts;
|
|
|
55226
55259
|
function structuredTypeRelatedTo(source, target, reportErrors, intersectionState) {
|
|
55227
55260
|
var saveErrorInfo = captureErrorCalculationState();
|
|
55228
55261
|
var result = structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState, saveErrorInfo);
|
|
55262
|
+
if (!result && (source.flags & 2097152 || source.flags & 262144 && target.flags & 1048576)) {
|
|
55263
|
+
var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 ? source.types : [source], !!(target.flags & 1048576));
|
|
55264
|
+
if (constraint && everyType(constraint, function (c) { return c !== source; })) {
|
|
55265
|
+
result = isRelatedTo(constraint, target, 1, false, undefined, intersectionState);
|
|
55266
|
+
}
|
|
55267
|
+
}
|
|
55229
55268
|
if (result) {
|
|
55230
55269
|
resetErrorInfo(saveErrorInfo);
|
|
55231
55270
|
}
|
|
@@ -55282,14 +55321,6 @@ var ts;
|
|
|
55282
55321
|
if (result = unionOrIntersectionRelatedTo(source, target, reportErrors, intersectionState)) {
|
|
55283
55322
|
return result;
|
|
55284
55323
|
}
|
|
55285
|
-
if (source.flags & 2097152 || source.flags & 262144 && target.flags & 1048576) {
|
|
55286
|
-
var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 ? source.types : [source], !!(target.flags & 1048576));
|
|
55287
|
-
if (constraint && everyType(constraint, function (c) { return c !== source; })) {
|
|
55288
|
-
if (result = isRelatedTo(constraint, target, 1, false, undefined, intersectionState)) {
|
|
55289
|
-
return result;
|
|
55290
|
-
}
|
|
55291
|
-
}
|
|
55292
|
-
}
|
|
55293
55324
|
if (!(sourceFlags & 465829888 ||
|
|
55294
55325
|
sourceFlags & 524288 && targetFlags & 1048576 ||
|
|
55295
55326
|
sourceFlags & 2097152 && targetFlags & (524288 | 1048576 | 465829888))) {
|
|
@@ -70473,17 +70504,28 @@ var ts;
|
|
|
70473
70504
|
return type[cacheKey] = cachedTypes;
|
|
70474
70505
|
}
|
|
70475
70506
|
function getIterationTypesOfIterable(type, use, errorNode) {
|
|
70507
|
+
var _a, _b;
|
|
70476
70508
|
if (isTypeAny(type)) {
|
|
70477
70509
|
return anyIterationTypes;
|
|
70478
70510
|
}
|
|
70479
70511
|
if (!(type.flags & 1048576)) {
|
|
70480
|
-
var
|
|
70512
|
+
var errorOutputContainer = errorNode ? { errors: undefined } : undefined;
|
|
70513
|
+
var iterationTypes_1 = getIterationTypesOfIterableWorker(type, use, errorNode, errorOutputContainer);
|
|
70481
70514
|
if (iterationTypes_1 === noIterationTypes) {
|
|
70482
70515
|
if (errorNode) {
|
|
70483
|
-
reportTypeNotIterableError(errorNode, type, !!(use & 2));
|
|
70516
|
+
var rootDiag = reportTypeNotIterableError(errorNode, type, !!(use & 2));
|
|
70517
|
+
if (errorOutputContainer === null || errorOutputContainer === void 0 ? void 0 : errorOutputContainer.errors) {
|
|
70518
|
+
ts.addRelatedInfo.apply(void 0, __spreadArray([rootDiag], errorOutputContainer.errors, false));
|
|
70519
|
+
}
|
|
70484
70520
|
}
|
|
70485
70521
|
return undefined;
|
|
70486
70522
|
}
|
|
70523
|
+
else if ((_a = errorOutputContainer === null || errorOutputContainer === void 0 ? void 0 : errorOutputContainer.errors) === null || _a === void 0 ? void 0 : _a.length) {
|
|
70524
|
+
for (var _i = 0, _c = errorOutputContainer.errors; _i < _c.length; _i++) {
|
|
70525
|
+
var diag = _c[_i];
|
|
70526
|
+
diagnostics.add(diag);
|
|
70527
|
+
}
|
|
70528
|
+
}
|
|
70487
70529
|
return iterationTypes_1;
|
|
70488
70530
|
}
|
|
70489
70531
|
var cacheKey = use & 2 ? "iterationTypesOfAsyncIterable" : "iterationTypesOfIterable";
|
|
@@ -70491,19 +70533,27 @@ var ts;
|
|
|
70491
70533
|
if (cachedTypes)
|
|
70492
70534
|
return cachedTypes === noIterationTypes ? undefined : cachedTypes;
|
|
70493
70535
|
var allIterationTypes;
|
|
70494
|
-
for (var
|
|
70495
|
-
var constituent =
|
|
70496
|
-
var
|
|
70536
|
+
for (var _d = 0, _e = type.types; _d < _e.length; _d++) {
|
|
70537
|
+
var constituent = _e[_d];
|
|
70538
|
+
var errorOutputContainer = errorNode ? { errors: undefined } : undefined;
|
|
70539
|
+
var iterationTypes_2 = getIterationTypesOfIterableWorker(constituent, use, errorNode, errorOutputContainer);
|
|
70497
70540
|
if (iterationTypes_2 === noIterationTypes) {
|
|
70498
70541
|
if (errorNode) {
|
|
70499
|
-
reportTypeNotIterableError(errorNode, type, !!(use & 2));
|
|
70542
|
+
var rootDiag = reportTypeNotIterableError(errorNode, type, !!(use & 2));
|
|
70543
|
+
if (errorOutputContainer === null || errorOutputContainer === void 0 ? void 0 : errorOutputContainer.errors) {
|
|
70544
|
+
ts.addRelatedInfo.apply(void 0, __spreadArray([rootDiag], errorOutputContainer.errors, false));
|
|
70545
|
+
}
|
|
70500
70546
|
}
|
|
70501
70547
|
setCachedIterationTypes(type, cacheKey, noIterationTypes);
|
|
70502
70548
|
return undefined;
|
|
70503
70549
|
}
|
|
70504
|
-
else {
|
|
70505
|
-
|
|
70550
|
+
else if ((_b = errorOutputContainer === null || errorOutputContainer === void 0 ? void 0 : errorOutputContainer.errors) === null || _b === void 0 ? void 0 : _b.length) {
|
|
70551
|
+
for (var _f = 0, _g = errorOutputContainer.errors; _f < _g.length; _f++) {
|
|
70552
|
+
var diag = _g[_f];
|
|
70553
|
+
diagnostics.add(diag);
|
|
70554
|
+
}
|
|
70506
70555
|
}
|
|
70556
|
+
allIterationTypes = ts.append(allIterationTypes, iterationTypes_2);
|
|
70507
70557
|
}
|
|
70508
70558
|
var iterationTypes = allIterationTypes ? combineIterationTypes(allIterationTypes) : noIterationTypes;
|
|
70509
70559
|
setCachedIterationTypes(type, cacheKey, iterationTypes);
|
|
@@ -70520,46 +70570,57 @@ var ts;
|
|
|
70520
70570
|
}
|
|
70521
70571
|
return createIterationTypes(getAwaitedType(yieldType, errorNode) || anyType, getAwaitedType(returnType, errorNode) || anyType, nextType);
|
|
70522
70572
|
}
|
|
70523
|
-
function getIterationTypesOfIterableWorker(type, use, errorNode) {
|
|
70573
|
+
function getIterationTypesOfIterableWorker(type, use, errorNode, errorOutputContainer) {
|
|
70524
70574
|
if (isTypeAny(type)) {
|
|
70525
70575
|
return anyIterationTypes;
|
|
70526
70576
|
}
|
|
70577
|
+
var noCache = false;
|
|
70527
70578
|
if (use & 2) {
|
|
70528
70579
|
var iterationTypes = getIterationTypesOfIterableCached(type, asyncIterationTypesResolver) ||
|
|
70529
70580
|
getIterationTypesOfIterableFast(type, asyncIterationTypesResolver);
|
|
70530
70581
|
if (iterationTypes) {
|
|
70531
|
-
|
|
70532
|
-
|
|
70533
|
-
|
|
70582
|
+
if (iterationTypes === noIterationTypes && errorNode) {
|
|
70583
|
+
noCache = true;
|
|
70584
|
+
}
|
|
70585
|
+
else {
|
|
70586
|
+
return use & 8 ?
|
|
70587
|
+
getAsyncFromSyncIterationTypes(iterationTypes, errorNode) :
|
|
70588
|
+
iterationTypes;
|
|
70589
|
+
}
|
|
70534
70590
|
}
|
|
70535
70591
|
}
|
|
70536
70592
|
if (use & 1) {
|
|
70537
70593
|
var iterationTypes = getIterationTypesOfIterableCached(type, syncIterationTypesResolver) ||
|
|
70538
70594
|
getIterationTypesOfIterableFast(type, syncIterationTypesResolver);
|
|
70539
70595
|
if (iterationTypes) {
|
|
70540
|
-
if (
|
|
70541
|
-
|
|
70542
|
-
return setCachedIterationTypes(type, "iterationTypesOfAsyncIterable", getAsyncFromSyncIterationTypes(iterationTypes, errorNode));
|
|
70543
|
-
}
|
|
70596
|
+
if (iterationTypes === noIterationTypes && errorNode) {
|
|
70597
|
+
noCache = true;
|
|
70544
70598
|
}
|
|
70545
70599
|
else {
|
|
70546
|
-
|
|
70600
|
+
if (use & 2) {
|
|
70601
|
+
if (iterationTypes !== noIterationTypes) {
|
|
70602
|
+
iterationTypes = getAsyncFromSyncIterationTypes(iterationTypes, errorNode);
|
|
70603
|
+
return noCache ? iterationTypes : setCachedIterationTypes(type, "iterationTypesOfAsyncIterable", iterationTypes);
|
|
70604
|
+
}
|
|
70605
|
+
}
|
|
70606
|
+
else {
|
|
70607
|
+
return iterationTypes;
|
|
70608
|
+
}
|
|
70547
70609
|
}
|
|
70548
70610
|
}
|
|
70549
70611
|
}
|
|
70550
70612
|
if (use & 2) {
|
|
70551
|
-
var iterationTypes = getIterationTypesOfIterableSlow(type, asyncIterationTypesResolver, errorNode);
|
|
70613
|
+
var iterationTypes = getIterationTypesOfIterableSlow(type, asyncIterationTypesResolver, errorNode, errorOutputContainer, noCache);
|
|
70552
70614
|
if (iterationTypes !== noIterationTypes) {
|
|
70553
70615
|
return iterationTypes;
|
|
70554
70616
|
}
|
|
70555
70617
|
}
|
|
70556
70618
|
if (use & 1) {
|
|
70557
|
-
var iterationTypes = getIterationTypesOfIterableSlow(type, syncIterationTypesResolver, errorNode);
|
|
70619
|
+
var iterationTypes = getIterationTypesOfIterableSlow(type, syncIterationTypesResolver, errorNode, errorOutputContainer, noCache);
|
|
70558
70620
|
if (iterationTypes !== noIterationTypes) {
|
|
70559
70621
|
if (use & 2) {
|
|
70560
|
-
|
|
70561
|
-
|
|
70562
|
-
: noIterationTypes);
|
|
70622
|
+
iterationTypes = getAsyncFromSyncIterationTypes(iterationTypes, errorNode);
|
|
70623
|
+
return noCache ? iterationTypes : setCachedIterationTypes(type, "iterationTypesOfAsyncIterable", iterationTypes);
|
|
70563
70624
|
}
|
|
70564
70625
|
else {
|
|
70565
70626
|
return iterationTypes;
|
|
@@ -70573,7 +70634,7 @@ var ts;
|
|
|
70573
70634
|
}
|
|
70574
70635
|
function getIterationTypesOfGlobalIterableType(globalType, resolver) {
|
|
70575
70636
|
var globalIterationTypes = getIterationTypesOfIterableCached(globalType, resolver) ||
|
|
70576
|
-
getIterationTypesOfIterableSlow(globalType, resolver, undefined);
|
|
70637
|
+
getIterationTypesOfIterableSlow(globalType, resolver, undefined, undefined, false);
|
|
70577
70638
|
return globalIterationTypes === noIterationTypes ? defaultIterationTypes : globalIterationTypes;
|
|
70578
70639
|
}
|
|
70579
70640
|
function getIterationTypesOfIterableFast(type, resolver) {
|
|
@@ -70594,34 +70655,41 @@ var ts;
|
|
|
70594
70655
|
var uniqueType = ctorType && getTypeOfPropertyOfType(getTypeOfSymbol(ctorType), ts.escapeLeadingUnderscores(symbolName));
|
|
70595
70656
|
return uniqueType && isTypeUsableAsPropertyName(uniqueType) ? getPropertyNameFromType(uniqueType) : "__@" + symbolName;
|
|
70596
70657
|
}
|
|
70597
|
-
function getIterationTypesOfIterableSlow(type, resolver, errorNode) {
|
|
70658
|
+
function getIterationTypesOfIterableSlow(type, resolver, errorNode, errorOutputContainer, noCache) {
|
|
70598
70659
|
var _a;
|
|
70599
70660
|
var method = getPropertyOfType(type, getPropertyNameForKnownSymbolName(resolver.iteratorSymbolName));
|
|
70600
70661
|
var methodType = method && !(method.flags & 16777216) ? getTypeOfSymbol(method) : undefined;
|
|
70601
70662
|
if (isTypeAny(methodType)) {
|
|
70602
|
-
return setCachedIterationTypes(type, resolver.iterableCacheKey, anyIterationTypes);
|
|
70663
|
+
return noCache ? anyIterationTypes : setCachedIterationTypes(type, resolver.iterableCacheKey, anyIterationTypes);
|
|
70603
70664
|
}
|
|
70604
70665
|
var signatures = methodType ? getSignaturesOfType(methodType, 0) : undefined;
|
|
70605
70666
|
if (!ts.some(signatures)) {
|
|
70606
|
-
return setCachedIterationTypes(type, resolver.iterableCacheKey, noIterationTypes);
|
|
70667
|
+
return noCache ? noIterationTypes : setCachedIterationTypes(type, resolver.iterableCacheKey, noIterationTypes);
|
|
70607
70668
|
}
|
|
70608
70669
|
var iteratorType = getIntersectionType(ts.map(signatures, getReturnTypeOfSignature));
|
|
70609
|
-
var iterationTypes = (_a =
|
|
70610
|
-
return setCachedIterationTypes(type, resolver.iterableCacheKey, iterationTypes);
|
|
70670
|
+
var iterationTypes = (_a = getIterationTypesOfIteratorWorker(iteratorType, resolver, errorNode, errorOutputContainer, noCache)) !== null && _a !== void 0 ? _a : noIterationTypes;
|
|
70671
|
+
return noCache ? iterationTypes : setCachedIterationTypes(type, resolver.iterableCacheKey, iterationTypes);
|
|
70611
70672
|
}
|
|
70612
70673
|
function reportTypeNotIterableError(errorNode, type, allowAsyncIterables) {
|
|
70613
70674
|
var message = allowAsyncIterables
|
|
70614
70675
|
? ts.Diagnostics.Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator
|
|
70615
70676
|
: ts.Diagnostics.Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator;
|
|
70616
|
-
errorAndMaybeSuggestAwait(errorNode, !!getAwaitedTypeOfPromise(type), message, typeToString(type));
|
|
70677
|
+
return errorAndMaybeSuggestAwait(errorNode, !!getAwaitedTypeOfPromise(type), message, typeToString(type));
|
|
70678
|
+
}
|
|
70679
|
+
function getIterationTypesOfIterator(type, resolver, errorNode, errorOutputContainer) {
|
|
70680
|
+
return getIterationTypesOfIteratorWorker(type, resolver, errorNode, errorOutputContainer, false);
|
|
70617
70681
|
}
|
|
70618
|
-
function
|
|
70682
|
+
function getIterationTypesOfIteratorWorker(type, resolver, errorNode, errorOutputContainer, noCache) {
|
|
70619
70683
|
if (isTypeAny(type)) {
|
|
70620
70684
|
return anyIterationTypes;
|
|
70621
70685
|
}
|
|
70622
70686
|
var iterationTypes = getIterationTypesOfIteratorCached(type, resolver) ||
|
|
70623
|
-
getIterationTypesOfIteratorFast(type, resolver)
|
|
70624
|
-
|
|
70687
|
+
getIterationTypesOfIteratorFast(type, resolver);
|
|
70688
|
+
if (iterationTypes === noIterationTypes && errorNode) {
|
|
70689
|
+
iterationTypes = undefined;
|
|
70690
|
+
noCache = true;
|
|
70691
|
+
}
|
|
70692
|
+
iterationTypes !== null && iterationTypes !== void 0 ? iterationTypes : (iterationTypes = getIterationTypesOfIteratorSlow(type, resolver, errorNode, errorOutputContainer, noCache));
|
|
70625
70693
|
return iterationTypes === noIterationTypes ? undefined : iterationTypes;
|
|
70626
70694
|
}
|
|
70627
70695
|
function getIterationTypesOfIteratorCached(type, resolver) {
|
|
@@ -70632,7 +70700,7 @@ var ts;
|
|
|
70632
70700
|
if (isReferenceToType(type, globalType)) {
|
|
70633
70701
|
var yieldType = getTypeArguments(type)[0];
|
|
70634
70702
|
var globalIterationTypes = getIterationTypesOfIteratorCached(globalType, resolver) ||
|
|
70635
|
-
getIterationTypesOfIteratorSlow(globalType, resolver, undefined);
|
|
70703
|
+
getIterationTypesOfIteratorSlow(globalType, resolver, undefined, undefined, false);
|
|
70636
70704
|
var _a = globalIterationTypes === noIterationTypes ? defaultIterationTypes : globalIterationTypes, returnType = _a.returnType, nextType = _a.nextType;
|
|
70637
70705
|
return setCachedIterationTypes(type, resolver.iteratorCacheKey, createIterationTypes(yieldType, returnType, nextType));
|
|
70638
70706
|
}
|
|
@@ -70677,8 +70745,8 @@ var ts;
|
|
|
70677
70745
|
}
|
|
70678
70746
|
return setCachedIterationTypes(type, "iterationTypesOfIteratorResult", createIterationTypes(yieldType, returnType || voidType, undefined));
|
|
70679
70747
|
}
|
|
70680
|
-
function getIterationTypesOfMethod(type, resolver, methodName, errorNode) {
|
|
70681
|
-
var _a, _b, _c, _d;
|
|
70748
|
+
function getIterationTypesOfMethod(type, resolver, methodName, errorNode, errorOutputContainer) {
|
|
70749
|
+
var _a, _b, _c, _d, _e, _f;
|
|
70682
70750
|
var method = getPropertyOfType(type, methodName);
|
|
70683
70751
|
if (!method && methodName !== "next") {
|
|
70684
70752
|
return undefined;
|
|
@@ -70695,15 +70763,21 @@ var ts;
|
|
|
70695
70763
|
var diagnostic = methodName === "next"
|
|
70696
70764
|
? resolver.mustHaveANextMethodDiagnostic
|
|
70697
70765
|
: resolver.mustBeAMethodDiagnostic;
|
|
70698
|
-
|
|
70766
|
+
if (errorOutputContainer) {
|
|
70767
|
+
(_a = errorOutputContainer.errors) !== null && _a !== void 0 ? _a : (errorOutputContainer.errors = []);
|
|
70768
|
+
errorOutputContainer.errors.push(ts.createDiagnosticForNode(errorNode, diagnostic, methodName));
|
|
70769
|
+
}
|
|
70770
|
+
else {
|
|
70771
|
+
error(errorNode, diagnostic, methodName);
|
|
70772
|
+
}
|
|
70699
70773
|
}
|
|
70700
|
-
return methodName === "next" ?
|
|
70774
|
+
return methodName === "next" ? noIterationTypes : undefined;
|
|
70701
70775
|
}
|
|
70702
70776
|
if ((methodType === null || methodType === void 0 ? void 0 : methodType.symbol) && methodSignatures.length === 1) {
|
|
70703
70777
|
var globalGeneratorType = resolver.getGlobalGeneratorType(false);
|
|
70704
70778
|
var globalIteratorType = resolver.getGlobalIteratorType(false);
|
|
70705
|
-
var isGeneratorMethod = ((
|
|
70706
|
-
var isIteratorMethod = !isGeneratorMethod && ((
|
|
70779
|
+
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;
|
|
70780
|
+
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;
|
|
70707
70781
|
if (isGeneratorMethod || isIteratorMethod) {
|
|
70708
70782
|
var globalType = isGeneratorMethod ? globalGeneratorType : globalIteratorType;
|
|
70709
70783
|
var mapper = methodType.mapper;
|
|
@@ -70737,7 +70811,13 @@ var ts;
|
|
|
70737
70811
|
var iterationTypes = getIterationTypesOfIteratorResult(resolvedMethodReturnType);
|
|
70738
70812
|
if (iterationTypes === noIterationTypes) {
|
|
70739
70813
|
if (errorNode) {
|
|
70740
|
-
|
|
70814
|
+
if (errorOutputContainer) {
|
|
70815
|
+
(_f = errorOutputContainer.errors) !== null && _f !== void 0 ? _f : (errorOutputContainer.errors = []);
|
|
70816
|
+
errorOutputContainer.errors.push(ts.createDiagnosticForNode(errorNode, resolver.mustHaveAValueDiagnostic, methodName));
|
|
70817
|
+
}
|
|
70818
|
+
else {
|
|
70819
|
+
error(errorNode, resolver.mustHaveAValueDiagnostic, methodName);
|
|
70820
|
+
}
|
|
70741
70821
|
}
|
|
70742
70822
|
yieldType = anyType;
|
|
70743
70823
|
returnTypes = ts.append(returnTypes, anyType);
|
|
@@ -70748,13 +70828,13 @@ var ts;
|
|
|
70748
70828
|
}
|
|
70749
70829
|
return createIterationTypes(yieldType, getUnionType(returnTypes), nextType);
|
|
70750
70830
|
}
|
|
70751
|
-
function getIterationTypesOfIteratorSlow(type, resolver, errorNode) {
|
|
70831
|
+
function getIterationTypesOfIteratorSlow(type, resolver, errorNode, errorOutputContainer, noCache) {
|
|
70752
70832
|
var iterationTypes = combineIterationTypes([
|
|
70753
|
-
getIterationTypesOfMethod(type, resolver, "next", errorNode),
|
|
70754
|
-
getIterationTypesOfMethod(type, resolver, "return", errorNode),
|
|
70755
|
-
getIterationTypesOfMethod(type, resolver, "throw", errorNode),
|
|
70833
|
+
getIterationTypesOfMethod(type, resolver, "next", errorNode, errorOutputContainer),
|
|
70834
|
+
getIterationTypesOfMethod(type, resolver, "return", errorNode, errorOutputContainer),
|
|
70835
|
+
getIterationTypesOfMethod(type, resolver, "throw", errorNode, errorOutputContainer),
|
|
70756
70836
|
]);
|
|
70757
|
-
return setCachedIterationTypes(type, resolver.iteratorCacheKey, iterationTypes);
|
|
70837
|
+
return noCache ? iterationTypes : setCachedIterationTypes(type, resolver.iteratorCacheKey, iterationTypes);
|
|
70758
70838
|
}
|
|
70759
70839
|
function getIterationTypeOfGeneratorFunctionReturnType(kind, returnType, isAsyncGenerator) {
|
|
70760
70840
|
if (isTypeAny(returnType)) {
|
|
@@ -70770,7 +70850,7 @@ var ts;
|
|
|
70770
70850
|
var use = isAsyncGenerator ? 2 : 1;
|
|
70771
70851
|
var resolver = isAsyncGenerator ? asyncIterationTypesResolver : syncIterationTypesResolver;
|
|
70772
70852
|
return getIterationTypesOfIterable(type, use, undefined) ||
|
|
70773
|
-
getIterationTypesOfIterator(type, resolver, undefined);
|
|
70853
|
+
getIterationTypesOfIterator(type, resolver, undefined, undefined);
|
|
70774
70854
|
}
|
|
70775
70855
|
function checkBreakOrContinueStatement(node) {
|
|
70776
70856
|
if (!checkGrammarStatementInAmbientContext(node))
|
|
@@ -101693,7 +101773,6 @@ var ts;
|
|
|
101693
101773
|
if (watcher.files === 0 && watcher.resolutions === 0) {
|
|
101694
101774
|
fileWatchesOfAffectingLocations.delete(path);
|
|
101695
101775
|
watcher.watcher.close();
|
|
101696
|
-
watcher.watcher = ts.noopFileWatcher;
|
|
101697
101776
|
}
|
|
101698
101777
|
});
|
|
101699
101778
|
hasChangedAutomaticTypeDirectiveNames = false;
|
|
@@ -102013,20 +102092,26 @@ var ts;
|
|
|
102013
102092
|
}
|
|
102014
102093
|
var paths = new ts.Set();
|
|
102015
102094
|
paths.add(locationToWatch);
|
|
102095
|
+
var actualWatcher = canWatchDirectoryOrFile(resolutionHost.toPath(locationToWatch)) ?
|
|
102096
|
+
resolutionHost.watchAffectingFileLocation(locationToWatch, function (fileName, eventKind) {
|
|
102097
|
+
cachedDirectoryStructureHost === null || cachedDirectoryStructureHost === void 0 ? void 0 : cachedDirectoryStructureHost.addOrDeleteFile(fileName, resolutionHost.toPath(locationToWatch), eventKind);
|
|
102098
|
+
var packageJsonMap = moduleResolutionCache.getPackageJsonInfoCache().getInternalMap();
|
|
102099
|
+
paths.forEach(function (path) {
|
|
102100
|
+
if (watcher.resolutions)
|
|
102101
|
+
(affectingPathChecks !== null && affectingPathChecks !== void 0 ? affectingPathChecks : (affectingPathChecks = new ts.Set())).add(path);
|
|
102102
|
+
if (watcher.files)
|
|
102103
|
+
(affectingPathChecksForFile !== null && affectingPathChecksForFile !== void 0 ? affectingPathChecksForFile : (affectingPathChecksForFile = new ts.Set())).add(path);
|
|
102104
|
+
packageJsonMap === null || packageJsonMap === void 0 ? void 0 : packageJsonMap.delete(resolutionHost.toPath(path));
|
|
102105
|
+
});
|
|
102106
|
+
resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations();
|
|
102107
|
+
}) : ts.noopFileWatcher;
|
|
102016
102108
|
var watcher = {
|
|
102017
|
-
watcher:
|
|
102018
|
-
|
|
102019
|
-
|
|
102020
|
-
|
|
102021
|
-
|
|
102022
|
-
|
|
102023
|
-
(affectingPathChecks !== null && affectingPathChecks !== void 0 ? affectingPathChecks : (affectingPathChecks = new ts.Set())).add(path);
|
|
102024
|
-
if (watcher.files)
|
|
102025
|
-
(affectingPathChecksForFile !== null && affectingPathChecksForFile !== void 0 ? affectingPathChecksForFile : (affectingPathChecksForFile = new ts.Set())).add(path);
|
|
102026
|
-
(_a = moduleResolutionCache.getPackageJsonInfoCache().getInternalMap()) === null || _a === void 0 ? void 0 : _a.delete(resolutionHost.toPath(path));
|
|
102027
|
-
});
|
|
102028
|
-
resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations();
|
|
102029
|
-
}) : ts.noopFileWatcher,
|
|
102109
|
+
watcher: actualWatcher !== ts.noopFileWatcher ? {
|
|
102110
|
+
close: function () {
|
|
102111
|
+
actualWatcher.close();
|
|
102112
|
+
actualWatcher = ts.noopFileWatcher;
|
|
102113
|
+
}
|
|
102114
|
+
} : actualWatcher,
|
|
102030
102115
|
resolutions: forResolution ? 1 : 0,
|
|
102031
102116
|
files: forResolution ? 0 : 1,
|
|
102032
102117
|
paths: paths,
|
|
@@ -102375,7 +102460,7 @@ var ts;
|
|
|
102375
102460
|
var info = getInfo(importingSourceFileName, host);
|
|
102376
102461
|
var modulePaths = getAllModulePaths(importingSourceFileName, toFileName, host, userPreferences, options);
|
|
102377
102462
|
return ts.firstDefined(modulePaths, function (modulePath) { return tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, userPreferences, undefined, options.overrideImportMode); }) ||
|
|
102378
|
-
getLocalModuleSpecifier(toFileName, info, compilerOptions, host, preferences);
|
|
102463
|
+
getLocalModuleSpecifier(toFileName, info, compilerOptions, host, options.overrideImportMode || importingSourceFile.impliedNodeFormat, preferences);
|
|
102379
102464
|
}
|
|
102380
102465
|
function tryGetModuleSpecifiersFromCache(moduleSymbol, importingSourceFile, host, userPreferences, options) {
|
|
102381
102466
|
if (options === void 0) { options = {}; }
|
|
@@ -102446,7 +102531,7 @@ var ts;
|
|
|
102446
102531
|
return nodeModulesSpecifiers;
|
|
102447
102532
|
}
|
|
102448
102533
|
if (!specifier && !modulePath.isRedirect) {
|
|
102449
|
-
var local = getLocalModuleSpecifier(modulePath.path, info, compilerOptions, host, preferences);
|
|
102534
|
+
var local = getLocalModuleSpecifier(modulePath.path, info, compilerOptions, host, options.overrideImportMode || importingSourceFile.impliedNodeFormat, preferences);
|
|
102450
102535
|
if (ts.pathIsBareSpecifier(local)) {
|
|
102451
102536
|
pathsSpecifiers = ts.append(pathsSpecifiers, local);
|
|
102452
102537
|
}
|
|
@@ -102464,7 +102549,7 @@ var ts;
|
|
|
102464
102549
|
var sourceDirectory = ts.getDirectoryPath(importingSourceFileName);
|
|
102465
102550
|
return { getCanonicalFileName: getCanonicalFileName, importingSourceFileName: importingSourceFileName, sourceDirectory: sourceDirectory };
|
|
102466
102551
|
}
|
|
102467
|
-
function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, _a) {
|
|
102552
|
+
function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, importMode, _a) {
|
|
102468
102553
|
var ending = _a.ending, relativePreference = _a.relativePreference;
|
|
102469
102554
|
var baseUrl = compilerOptions.baseUrl, paths = compilerOptions.paths, rootDirs = compilerOptions.rootDirs;
|
|
102470
102555
|
var sourceDirectory = info.sourceDirectory, getCanonicalFileName = info.getCanonicalFileName;
|
|
@@ -102478,9 +102563,8 @@ var ts;
|
|
|
102478
102563
|
if (!relativeToBaseUrl) {
|
|
102479
102564
|
return relativePath;
|
|
102480
102565
|
}
|
|
102481
|
-
var
|
|
102482
|
-
var
|
|
102483
|
-
var nonRelative = fromPaths === undefined && baseUrl !== undefined ? importRelativeToBaseUrl : fromPaths;
|
|
102566
|
+
var fromPaths = paths && tryGetModuleNameFromPaths(relativeToBaseUrl, paths, getAllowedEndings(ending, compilerOptions, importMode), host, compilerOptions);
|
|
102567
|
+
var nonRelative = fromPaths === undefined && baseUrl !== undefined ? removeExtensionAndIndexPostFix(relativeToBaseUrl, ending, compilerOptions) : fromPaths;
|
|
102484
102568
|
if (!nonRelative) {
|
|
102485
102569
|
return relativePath;
|
|
102486
102570
|
}
|
|
@@ -102677,28 +102761,59 @@ var ts;
|
|
|
102677
102761
|
return ambientModuleDeclare.name.text;
|
|
102678
102762
|
}
|
|
102679
102763
|
}
|
|
102680
|
-
function
|
|
102764
|
+
function getAllowedEndings(preferredEnding, compilerOptions, importMode) {
|
|
102765
|
+
if (ts.getEmitModuleResolutionKind(compilerOptions) >= ts.ModuleResolutionKind.Node16 && importMode === ts.ModuleKind.ESNext) {
|
|
102766
|
+
return [2];
|
|
102767
|
+
}
|
|
102768
|
+
switch (preferredEnding) {
|
|
102769
|
+
case 2: return [2, 0, 1];
|
|
102770
|
+
case 1: return [1, 0, 2];
|
|
102771
|
+
case 0: return [0, 1, 2];
|
|
102772
|
+
default: ts.Debug.assertNever(preferredEnding);
|
|
102773
|
+
}
|
|
102774
|
+
}
|
|
102775
|
+
function tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, host, compilerOptions) {
|
|
102681
102776
|
for (var key in paths) {
|
|
102682
|
-
|
|
102683
|
-
var
|
|
102684
|
-
var pattern = ts.removeFileExtension(ts.normalizePath(patternText_1));
|
|
102777
|
+
var _loop_36 = function (patternText_1) {
|
|
102778
|
+
var pattern = ts.normalizePath(patternText_1);
|
|
102685
102779
|
var indexOfStar = pattern.indexOf("*");
|
|
102780
|
+
var candidates = allowedEndings.map(function (ending) { return ({
|
|
102781
|
+
ending: ending,
|
|
102782
|
+
value: removeExtensionAndIndexPostFix(relativeToBaseUrl, ending, compilerOptions)
|
|
102783
|
+
}); });
|
|
102784
|
+
if (ts.tryGetExtensionFromPath(pattern)) {
|
|
102785
|
+
candidates.push({ ending: undefined, value: relativeToBaseUrl });
|
|
102786
|
+
}
|
|
102686
102787
|
if (indexOfStar !== -1) {
|
|
102687
|
-
var prefix = pattern.
|
|
102688
|
-
var suffix = pattern.
|
|
102689
|
-
|
|
102690
|
-
|
|
102691
|
-
|
|
102692
|
-
|
|
102693
|
-
|
|
102694
|
-
|
|
102788
|
+
var prefix = pattern.substring(0, indexOfStar);
|
|
102789
|
+
var suffix = pattern.substring(indexOfStar + 1);
|
|
102790
|
+
for (var _b = 0, candidates_3 = candidates; _b < candidates_3.length; _b++) {
|
|
102791
|
+
var _c = candidates_3[_b], ending = _c.ending, value = _c.value;
|
|
102792
|
+
if (value.length >= prefix.length + suffix.length &&
|
|
102793
|
+
ts.startsWith(value, prefix) &&
|
|
102794
|
+
ts.endsWith(value, suffix) &&
|
|
102795
|
+
validateEnding({ ending: ending, value: value })) {
|
|
102796
|
+
var matchedStar = value.substring(prefix.length, value.length - suffix.length);
|
|
102797
|
+
return { value: key.replace("*", matchedStar) };
|
|
102798
|
+
}
|
|
102695
102799
|
}
|
|
102696
102800
|
}
|
|
102697
|
-
else if (
|
|
102698
|
-
return
|
|
102801
|
+
else if (ts.some(candidates, function (c) { return c.ending !== 0 && pattern === c.value; }) ||
|
|
102802
|
+
ts.some(candidates, function (c) { return c.ending === 0 && pattern === c.value && validateEnding(c); })) {
|
|
102803
|
+
return { value: key };
|
|
102699
102804
|
}
|
|
102805
|
+
};
|
|
102806
|
+
for (var _i = 0, _a = paths[key]; _i < _a.length; _i++) {
|
|
102807
|
+
var patternText_1 = _a[_i];
|
|
102808
|
+
var state_12 = _loop_36(patternText_1);
|
|
102809
|
+
if (typeof state_12 === "object")
|
|
102810
|
+
return state_12.value;
|
|
102700
102811
|
}
|
|
102701
102812
|
}
|
|
102813
|
+
function validateEnding(_a) {
|
|
102814
|
+
var ending = _a.ending, value = _a.value;
|
|
102815
|
+
return ending !== 0 || value === removeExtensionAndIndexPostFix(relativeToBaseUrl, ending, compilerOptions, host);
|
|
102816
|
+
}
|
|
102702
102817
|
}
|
|
102703
102818
|
function tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, packageName, exports, conditions, mode) {
|
|
102704
102819
|
if (mode === void 0) { mode = 0; }
|
|
@@ -102781,10 +102896,10 @@ var ts;
|
|
|
102781
102896
|
if (!parts) {
|
|
102782
102897
|
return undefined;
|
|
102783
102898
|
}
|
|
102899
|
+
var preferences = getPreferences(host, userPreferences, options, importingSourceFile);
|
|
102784
102900
|
var moduleSpecifier = path;
|
|
102785
102901
|
var isPackageRootPath = false;
|
|
102786
102902
|
if (!packageNameOnly) {
|
|
102787
|
-
var preferences = getPreferences(host, userPreferences, options, importingSourceFile);
|
|
102788
102903
|
var packageRootIndex = parts.packageRootIndex;
|
|
102789
102904
|
var moduleFileName = void 0;
|
|
102790
102905
|
while (true) {
|
|
@@ -102827,11 +102942,13 @@ var ts;
|
|
|
102827
102942
|
var packageRootPath = path.substring(0, packageRootIndex);
|
|
102828
102943
|
var packageJsonPath = ts.combinePaths(packageRootPath, "package.json");
|
|
102829
102944
|
var moduleFileToTry = path;
|
|
102945
|
+
var maybeBlockedByTypesVersions = false;
|
|
102830
102946
|
var cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) === null || _a === void 0 ? void 0 : _a.call(host)) === null || _b === void 0 ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
|
|
102831
102947
|
if (typeof cachedPackageJson === "object" || cachedPackageJson === undefined && host.fileExists(packageJsonPath)) {
|
|
102832
102948
|
var packageJsonContent = (cachedPackageJson === null || cachedPackageJson === void 0 ? void 0 : cachedPackageJson.packageJsonContent) || JSON.parse(host.readFile(packageJsonPath));
|
|
102949
|
+
var importMode = overrideMode || importingSourceFile.impliedNodeFormat;
|
|
102833
102950
|
if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext) {
|
|
102834
|
-
var conditions = ["node",
|
|
102951
|
+
var conditions = ["node", importMode === ts.ModuleKind.ESNext ? "import" : "require", "types"];
|
|
102835
102952
|
var fromExports = packageJsonContent.exports && typeof packageJsonContent.name === "string"
|
|
102836
102953
|
? tryGetModuleNameFromExports(options, path, packageRootPath, ts.getPackageNameFromTypesPackageName(packageJsonContent.name), packageJsonContent.exports, conditions)
|
|
102837
102954
|
: undefined;
|
|
@@ -102850,13 +102967,16 @@ var ts;
|
|
|
102850
102967
|
: undefined;
|
|
102851
102968
|
if (versionPaths) {
|
|
102852
102969
|
var subModuleName = path.slice(packageRootPath.length + 1);
|
|
102853
|
-
var fromPaths = tryGetModuleNameFromPaths(
|
|
102854
|
-
if (fromPaths
|
|
102970
|
+
var fromPaths = tryGetModuleNameFromPaths(subModuleName, versionPaths.paths, getAllowedEndings(preferences.ending, options, importMode), host, options);
|
|
102971
|
+
if (fromPaths === undefined) {
|
|
102972
|
+
maybeBlockedByTypesVersions = true;
|
|
102973
|
+
}
|
|
102974
|
+
else {
|
|
102855
102975
|
moduleFileToTry = ts.combinePaths(packageRootPath, fromPaths);
|
|
102856
102976
|
}
|
|
102857
102977
|
}
|
|
102858
102978
|
var mainFileRelative = packageJsonContent.typings || packageJsonContent.types || packageJsonContent.main || "index.js";
|
|
102859
|
-
if (ts.isString(mainFileRelative)) {
|
|
102979
|
+
if (ts.isString(mainFileRelative) && !(maybeBlockedByTypesVersions && ts.matchPatternOrExact(ts.tryParsePatterns(versionPaths.paths), mainFileRelative))) {
|
|
102860
102980
|
var mainExportFile = ts.toPath(mainFileRelative, packageRootPath, getCanonicalFileName);
|
|
102861
102981
|
if (ts.removeFileExtension(mainExportFile) === ts.removeFileExtension(getCanonicalFileName(moduleFileToTry))) {
|
|
102862
102982
|
return { packageRootPath: packageRootPath, moduleFileToTry: moduleFileToTry };
|