typescript 4.7.0-dev.20220504 → 4.8.0-dev.20220507
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.es2022.d.ts +1 -0
- package/lib/lib.es2022.intl.d.ts +111 -0
- package/lib/lib.es5.d.ts +2 -2
- package/lib/tsc.js +263 -91
- package/lib/tsserver.js +341 -129
- package/lib/tsserverlibrary.d.ts +1 -1
- package/lib/tsserverlibrary.js +341 -129
- package/lib/typescript.d.ts +1 -1
- package/lib/typescript.js +337 -126
- package/lib/typescriptServices.d.ts +1 -1
- package/lib/typescriptServices.js +337 -126
- package/lib/typingsInstaller.js +309 -108
- package/package.json +1 -1
package/lib/tsc.js
CHANGED
|
@@ -68,8 +68,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
68
68
|
};
|
|
69
69
|
var ts;
|
|
70
70
|
(function (ts) {
|
|
71
|
-
ts.versionMajorMinor = "4.
|
|
72
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
71
|
+
ts.versionMajorMinor = "4.8";
|
|
72
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220507";
|
|
73
73
|
var NativeCollections;
|
|
74
74
|
(function (NativeCollections) {
|
|
75
75
|
var globals = typeof globalThis !== "undefined" ? globalThis :
|
|
@@ -5593,6 +5593,8 @@ var ts;
|
|
|
5593
5593
|
Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1: diag(2205, ts.DiagnosticCategory.Error, "Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1_2205", "Construct signatures with no arguments have incompatible return types '{0}' and '{1}'.", undefined, true),
|
|
5594
5594
|
The_type_modifier_cannot_be_used_on_a_named_import_when_import_type_is_used_on_its_import_statement: diag(2206, ts.DiagnosticCategory.Error, "The_type_modifier_cannot_be_used_on_a_named_import_when_import_type_is_used_on_its_import_statement_2206", "The 'type' modifier cannot be used on a named import when 'import type' is used on its import statement."),
|
|
5595
5595
|
The_type_modifier_cannot_be_used_on_a_named_export_when_export_type_is_used_on_its_export_statement: diag(2207, ts.DiagnosticCategory.Error, "The_type_modifier_cannot_be_used_on_a_named_export_when_export_type_is_used_on_its_export_statement_2207", "The 'type' modifier cannot be used on a named export when 'export type' is used on its export statement."),
|
|
5596
|
+
The_project_root_is_ambiguous_but_is_required_to_resolve_export_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate: diag(2209, ts.DiagnosticCategory.Error, "The_project_root_is_ambiguous_but_is_required_to_resolve_export_map_entry_0_in_file_1_Supply_the_roo_2209", "The project root is ambiguous, but is required to resolve export map entry '{0}' in file '{1}'. Supply the `rootDir` compiler option to disambiguate."),
|
|
5597
|
+
The_project_root_is_ambiguous_but_is_required_to_resolve_import_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate: diag(2210, ts.DiagnosticCategory.Error, "The_project_root_is_ambiguous_but_is_required_to_resolve_import_map_entry_0_in_file_1_Supply_the_roo_2210", "The project root is ambiguous, but is required to resolve import map entry '{0}' in file '{1}'. Supply the `rootDir` compiler option to disambiguate."),
|
|
5596
5598
|
Duplicate_identifier_0: diag(2300, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_2300", "Duplicate identifier '{0}'."),
|
|
5597
5599
|
Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2301, ts.DiagnosticCategory.Error, "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."),
|
|
5598
5600
|
Static_members_cannot_reference_class_type_parameters: diag(2302, ts.DiagnosticCategory.Error, "Static_members_cannot_reference_class_type_parameters_2302", "Static members cannot reference class type parameters."),
|
|
@@ -6182,6 +6184,7 @@ var ts;
|
|
|
6182
6184
|
This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0: diag(4122, ts.DiagnosticCategory.Error, "This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base__4122", "This member cannot have a JSDoc comment with an '@override' tag because it is not declared in the base class '{0}'."),
|
|
6183
6185
|
This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1: diag(4123, ts.DiagnosticCategory.Error, "This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base__4123", "This member cannot have a JSDoc comment with an 'override' tag because it is not declared in the base class '{0}'. Did you mean '{1}'?"),
|
|
6184
6186
|
Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next: diag(4124, ts.DiagnosticCategory.Error, "Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_w_4124", "Compiler option '{0}' of value '{1}' is unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'."),
|
|
6187
|
+
Resolution_mode_assertions_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next: diag(4125, ts.DiagnosticCategory.Error, "Resolution_mode_assertions_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_wi_4125", "Resolution mode assertions are unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'."),
|
|
6185
6188
|
The_current_host_does_not_support_the_0_option: diag(5001, ts.DiagnosticCategory.Error, "The_current_host_does_not_support_the_0_option_5001", "The current host does not support the '{0}' option."),
|
|
6186
6189
|
Cannot_find_the_common_subdirectory_path_for_the_input_files: diag(5009, ts.DiagnosticCategory.Error, "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", "Cannot find the common subdirectory path for the input files."),
|
|
6187
6190
|
File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: diag(5010, ts.DiagnosticCategory.Error, "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010", "File specification cannot end in a recursive directory wildcard ('**'): '{0}'."),
|
|
@@ -14050,6 +14053,10 @@ var ts;
|
|
|
14050
14053
|
return indentStrings[1].length;
|
|
14051
14054
|
}
|
|
14052
14055
|
ts.getIndentSize = getIndentSize;
|
|
14056
|
+
function isNightly() {
|
|
14057
|
+
return ts.stringContains(ts.version, "-dev") || ts.stringContains(ts.version, "-insiders");
|
|
14058
|
+
}
|
|
14059
|
+
ts.isNightly = isNightly;
|
|
14053
14060
|
function createTextWriter(newLine) {
|
|
14054
14061
|
var output;
|
|
14055
14062
|
var indent;
|
|
@@ -14276,6 +14283,13 @@ var ts;
|
|
|
14276
14283
|
".d.ts";
|
|
14277
14284
|
}
|
|
14278
14285
|
ts.getDeclarationEmitExtensionForPath = getDeclarationEmitExtensionForPath;
|
|
14286
|
+
function getPossibleOriginalInputExtensionForExtension(path) {
|
|
14287
|
+
return ts.fileExtensionIsOneOf(path, [".d.mts", ".mjs", ".mts"]) ? [".mts", ".mjs"] :
|
|
14288
|
+
ts.fileExtensionIsOneOf(path, [".d.cts", ".cjs", ".cts"]) ? [".cts", ".cjs"] :
|
|
14289
|
+
ts.fileExtensionIsOneOf(path, [".json.d.ts"]) ? [".json"] :
|
|
14290
|
+
[".tsx", ".ts", ".jsx", ".js"];
|
|
14291
|
+
}
|
|
14292
|
+
ts.getPossibleOriginalInputExtensionForExtension = getPossibleOriginalInputExtensionForExtension;
|
|
14279
14293
|
function outFile(options) {
|
|
14280
14294
|
return options.outFile || options.out;
|
|
14281
14295
|
}
|
|
@@ -21062,7 +21076,7 @@ var ts;
|
|
|
21062
21076
|
return node;
|
|
21063
21077
|
}
|
|
21064
21078
|
function cloneSourceFileWithChanges(source, statements, isDeclarationFile, referencedFiles, typeReferences, hasNoDefaultLib, libReferences) {
|
|
21065
|
-
var node = baseFactory.createBaseSourceFileNode(305);
|
|
21079
|
+
var node = (source.redirectInfo ? Object.create(source.redirectInfo.redirectTarget) : baseFactory.createBaseSourceFileNode(305));
|
|
21066
21080
|
for (var p in source) {
|
|
21067
21081
|
if (p === "emitNode" || ts.hasProperty(node, p) || !ts.hasProperty(source, p))
|
|
21068
21082
|
continue;
|
|
@@ -25174,7 +25188,7 @@ var ts;
|
|
|
25174
25188
|
function parseIsolatedEntityName(content, languageVersion) {
|
|
25175
25189
|
initializeState("", content, languageVersion, undefined, 1);
|
|
25176
25190
|
nextToken();
|
|
25177
|
-
var entityName = parseEntityName(true
|
|
25191
|
+
var entityName = parseEntityName(true);
|
|
25178
25192
|
var isInvalid = token() === 1 && !parseDiagnostics.length;
|
|
25179
25193
|
clearState();
|
|
25180
25194
|
return isInvalid ? entityName : undefined;
|
|
@@ -26455,6 +26469,7 @@ var ts;
|
|
|
26455
26469
|
var startPos = scanner.getStartPos();
|
|
26456
26470
|
var result = parseListElement(kind, parseElement);
|
|
26457
26471
|
if (!result) {
|
|
26472
|
+
parsingContext = saveParsingContext;
|
|
26458
26473
|
return undefined;
|
|
26459
26474
|
}
|
|
26460
26475
|
list.push(result);
|
|
@@ -26504,7 +26519,7 @@ var ts;
|
|
|
26504
26519
|
}
|
|
26505
26520
|
return createMissingList();
|
|
26506
26521
|
}
|
|
26507
|
-
function parseEntityName(allowReservedWords,
|
|
26522
|
+
function parseEntityName(allowReservedWords, diagnosticMessage) {
|
|
26508
26523
|
var pos = getNodePos();
|
|
26509
26524
|
var entity = allowReservedWords ? parseIdentifierName(diagnosticMessage) : parseIdentifier(diagnosticMessage);
|
|
26510
26525
|
var dotPos = getNodePos();
|
|
@@ -26514,7 +26529,7 @@ var ts;
|
|
|
26514
26529
|
break;
|
|
26515
26530
|
}
|
|
26516
26531
|
dotPos = getNodePos();
|
|
26517
|
-
entity = finishNode(factory.createQualifiedName(entity, parseRightSideOfDot(allowReservedWords,
|
|
26532
|
+
entity = finishNode(factory.createQualifiedName(entity, parseRightSideOfDot(allowReservedWords, false)), pos);
|
|
26518
26533
|
}
|
|
26519
26534
|
return entity;
|
|
26520
26535
|
}
|
|
@@ -26617,7 +26632,7 @@ var ts;
|
|
|
26617
26632
|
return finishNode(node, pos);
|
|
26618
26633
|
}
|
|
26619
26634
|
function parseEntityNameOfTypeReference() {
|
|
26620
|
-
return parseEntityName(true,
|
|
26635
|
+
return parseEntityName(true, ts.Diagnostics.Type_expected);
|
|
26621
26636
|
}
|
|
26622
26637
|
function parseTypeArgumentsOfTypeReference() {
|
|
26623
26638
|
if (!scanner.hasPrecedingLineBreak() && reScanLessThanToken() === 29) {
|
|
@@ -26731,7 +26746,7 @@ var ts;
|
|
|
26731
26746
|
function parseTypeQuery() {
|
|
26732
26747
|
var pos = getNodePos();
|
|
26733
26748
|
parseExpected(112);
|
|
26734
|
-
var entityName = parseEntityName(true
|
|
26749
|
+
var entityName = parseEntityName(true);
|
|
26735
26750
|
var typeArguments = !scanner.hasPrecedingLineBreak() ? tryParseTypeArguments() : undefined;
|
|
26736
26751
|
return finishNode(factory.createTypeQueryNode(entityName, typeArguments), pos);
|
|
26737
26752
|
}
|
|
@@ -27566,10 +27581,10 @@ var ts;
|
|
|
27566
27581
|
setDecoratorContext(false);
|
|
27567
27582
|
}
|
|
27568
27583
|
var pos = getNodePos();
|
|
27569
|
-
var expr = parseAssignmentExpressionOrHigher(
|
|
27584
|
+
var expr = parseAssignmentExpressionOrHigher();
|
|
27570
27585
|
var operatorToken;
|
|
27571
27586
|
while ((operatorToken = parseOptionalToken(27))) {
|
|
27572
|
-
expr = makeBinaryExpression(expr, operatorToken, parseAssignmentExpressionOrHigher(
|
|
27587
|
+
expr = makeBinaryExpression(expr, operatorToken, parseAssignmentExpressionOrHigher(), pos);
|
|
27573
27588
|
}
|
|
27574
27589
|
if (saveDecoratorContext) {
|
|
27575
27590
|
setDecoratorContext(true);
|
|
@@ -27577,23 +27592,23 @@ var ts;
|
|
|
27577
27592
|
return expr;
|
|
27578
27593
|
}
|
|
27579
27594
|
function parseInitializer() {
|
|
27580
|
-
return parseOptional(63) ? parseAssignmentExpressionOrHigher(
|
|
27595
|
+
return parseOptional(63) ? parseAssignmentExpressionOrHigher() : undefined;
|
|
27581
27596
|
}
|
|
27582
|
-
function parseAssignmentExpressionOrHigher(
|
|
27597
|
+
function parseAssignmentExpressionOrHigher() {
|
|
27583
27598
|
if (isYieldExpression()) {
|
|
27584
27599
|
return parseYieldExpression();
|
|
27585
27600
|
}
|
|
27586
|
-
var arrowExpression = tryParseParenthesizedArrowFunctionExpression(
|
|
27601
|
+
var arrowExpression = tryParseParenthesizedArrowFunctionExpression() || tryParseAsyncSimpleArrowFunctionExpression();
|
|
27587
27602
|
if (arrowExpression) {
|
|
27588
27603
|
return arrowExpression;
|
|
27589
27604
|
}
|
|
27590
27605
|
var pos = getNodePos();
|
|
27591
27606
|
var expr = parseBinaryExpressionOrHigher(0);
|
|
27592
27607
|
if (expr.kind === 79 && token() === 38) {
|
|
27593
|
-
return parseSimpleArrowFunctionExpression(pos, expr,
|
|
27608
|
+
return parseSimpleArrowFunctionExpression(pos, expr, undefined);
|
|
27594
27609
|
}
|
|
27595
27610
|
if (ts.isLeftHandSideExpression(expr) && ts.isAssignmentOperator(reScanGreaterToken())) {
|
|
27596
|
-
return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher(
|
|
27611
|
+
return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher(), pos);
|
|
27597
27612
|
}
|
|
27598
27613
|
return parseConditionalExpressionRest(expr, pos);
|
|
27599
27614
|
}
|
|
@@ -27615,30 +27630,30 @@ var ts;
|
|
|
27615
27630
|
nextToken();
|
|
27616
27631
|
if (!scanner.hasPrecedingLineBreak() &&
|
|
27617
27632
|
(token() === 41 || isStartOfExpression())) {
|
|
27618
|
-
return finishNode(factory.createYieldExpression(parseOptionalToken(41), parseAssignmentExpressionOrHigher(
|
|
27633
|
+
return finishNode(factory.createYieldExpression(parseOptionalToken(41), parseAssignmentExpressionOrHigher()), pos);
|
|
27619
27634
|
}
|
|
27620
27635
|
else {
|
|
27621
27636
|
return finishNode(factory.createYieldExpression(undefined, undefined), pos);
|
|
27622
27637
|
}
|
|
27623
27638
|
}
|
|
27624
|
-
function parseSimpleArrowFunctionExpression(pos, identifier,
|
|
27639
|
+
function parseSimpleArrowFunctionExpression(pos, identifier, asyncModifier) {
|
|
27625
27640
|
ts.Debug.assert(token() === 38, "parseSimpleArrowFunctionExpression should only have been called if we had a =>");
|
|
27626
27641
|
var parameter = factory.createParameterDeclaration(undefined, undefined, undefined, identifier, undefined, undefined, undefined);
|
|
27627
27642
|
finishNode(parameter, identifier.pos);
|
|
27628
27643
|
var parameters = createNodeArray([parameter], parameter.pos, parameter.end);
|
|
27629
27644
|
var equalsGreaterThanToken = parseExpectedToken(38);
|
|
27630
|
-
var body = parseArrowFunctionExpressionBody(!!asyncModifier
|
|
27645
|
+
var body = parseArrowFunctionExpressionBody(!!asyncModifier);
|
|
27631
27646
|
var node = factory.createArrowFunction(asyncModifier, undefined, parameters, undefined, equalsGreaterThanToken, body);
|
|
27632
27647
|
return addJSDocComment(finishNode(node, pos));
|
|
27633
27648
|
}
|
|
27634
|
-
function tryParseParenthesizedArrowFunctionExpression(
|
|
27649
|
+
function tryParseParenthesizedArrowFunctionExpression() {
|
|
27635
27650
|
var triState = isParenthesizedArrowFunctionExpression();
|
|
27636
27651
|
if (triState === 0) {
|
|
27637
27652
|
return undefined;
|
|
27638
27653
|
}
|
|
27639
27654
|
return triState === 1 ?
|
|
27640
|
-
parseParenthesizedArrowFunctionExpression(true
|
|
27641
|
-
tryParse(
|
|
27655
|
+
parseParenthesizedArrowFunctionExpression(true) :
|
|
27656
|
+
tryParse(parsePossibleParenthesizedArrowFunctionExpression);
|
|
27642
27657
|
}
|
|
27643
27658
|
function isParenthesizedArrowFunctionExpression() {
|
|
27644
27659
|
if (token() === 20 || token() === 29 || token() === 131) {
|
|
@@ -27732,24 +27747,24 @@ var ts;
|
|
|
27732
27747
|
return 2;
|
|
27733
27748
|
}
|
|
27734
27749
|
}
|
|
27735
|
-
function parsePossibleParenthesizedArrowFunctionExpression(
|
|
27750
|
+
function parsePossibleParenthesizedArrowFunctionExpression() {
|
|
27736
27751
|
var tokenPos = scanner.getTokenPos();
|
|
27737
27752
|
if (notParenthesizedArrow === null || notParenthesizedArrow === void 0 ? void 0 : notParenthesizedArrow.has(tokenPos)) {
|
|
27738
27753
|
return undefined;
|
|
27739
27754
|
}
|
|
27740
|
-
var result = parseParenthesizedArrowFunctionExpression(false
|
|
27755
|
+
var result = parseParenthesizedArrowFunctionExpression(false);
|
|
27741
27756
|
if (!result) {
|
|
27742
27757
|
(notParenthesizedArrow || (notParenthesizedArrow = new ts.Set())).add(tokenPos);
|
|
27743
27758
|
}
|
|
27744
27759
|
return result;
|
|
27745
27760
|
}
|
|
27746
|
-
function tryParseAsyncSimpleArrowFunctionExpression(
|
|
27761
|
+
function tryParseAsyncSimpleArrowFunctionExpression() {
|
|
27747
27762
|
if (token() === 131) {
|
|
27748
27763
|
if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === 1) {
|
|
27749
27764
|
var pos = getNodePos();
|
|
27750
27765
|
var asyncModifier = parseModifiersForArrowFunction();
|
|
27751
27766
|
var expr = parseBinaryExpressionOrHigher(0);
|
|
27752
|
-
return parseSimpleArrowFunctionExpression(pos, expr,
|
|
27767
|
+
return parseSimpleArrowFunctionExpression(pos, expr, asyncModifier);
|
|
27753
27768
|
}
|
|
27754
27769
|
}
|
|
27755
27770
|
return undefined;
|
|
@@ -27767,7 +27782,7 @@ var ts;
|
|
|
27767
27782
|
}
|
|
27768
27783
|
return 0;
|
|
27769
27784
|
}
|
|
27770
|
-
function parseParenthesizedArrowFunctionExpression(allowAmbiguity
|
|
27785
|
+
function parseParenthesizedArrowFunctionExpression(allowAmbiguity) {
|
|
27771
27786
|
var pos = getNodePos();
|
|
27772
27787
|
var hasJSDoc = hasPrecedingJSDocComment();
|
|
27773
27788
|
var modifiers = parseModifiersForArrowFunction();
|
|
@@ -27795,9 +27810,6 @@ var ts;
|
|
|
27795
27810
|
return undefined;
|
|
27796
27811
|
}
|
|
27797
27812
|
}
|
|
27798
|
-
if (disallowReturnTypeInArrowFunction && token() === 58) {
|
|
27799
|
-
return undefined;
|
|
27800
|
-
}
|
|
27801
27813
|
var type = parseReturnType(58, false);
|
|
27802
27814
|
if (type && !allowAmbiguity && typeHasArrowFunctionBlockingParseError(type)) {
|
|
27803
27815
|
return undefined;
|
|
@@ -27813,12 +27825,12 @@ var ts;
|
|
|
27813
27825
|
var lastToken = token();
|
|
27814
27826
|
var equalsGreaterThanToken = parseExpectedToken(38);
|
|
27815
27827
|
var body = (lastToken === 38 || lastToken === 18)
|
|
27816
|
-
? parseArrowFunctionExpressionBody(ts.some(modifiers, ts.isAsyncModifier)
|
|
27828
|
+
? parseArrowFunctionExpressionBody(ts.some(modifiers, ts.isAsyncModifier))
|
|
27817
27829
|
: parseIdentifier();
|
|
27818
27830
|
var node = factory.createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body);
|
|
27819
27831
|
return withJSDoc(finishNode(node, pos), hasJSDoc);
|
|
27820
27832
|
}
|
|
27821
|
-
function parseArrowFunctionExpressionBody(isAsync
|
|
27833
|
+
function parseArrowFunctionExpressionBody(isAsync) {
|
|
27822
27834
|
if (token() === 18) {
|
|
27823
27835
|
return parseFunctionBlock(isAsync ? 2 : 0);
|
|
27824
27836
|
}
|
|
@@ -27832,8 +27844,8 @@ var ts;
|
|
|
27832
27844
|
var savedTopLevel = topLevel;
|
|
27833
27845
|
topLevel = false;
|
|
27834
27846
|
var node = isAsync
|
|
27835
|
-
? doInAwaitContext(
|
|
27836
|
-
: doOutsideOfAwaitContext(
|
|
27847
|
+
? doInAwaitContext(parseAssignmentExpressionOrHigher)
|
|
27848
|
+
: doOutsideOfAwaitContext(parseAssignmentExpressionOrHigher);
|
|
27837
27849
|
topLevel = savedTopLevel;
|
|
27838
27850
|
return node;
|
|
27839
27851
|
}
|
|
@@ -27843,8 +27855,8 @@ var ts;
|
|
|
27843
27855
|
return leftOperand;
|
|
27844
27856
|
}
|
|
27845
27857
|
var colonToken;
|
|
27846
|
-
return finishNode(factory.createConditionalExpression(leftOperand, questionToken, doOutsideOfContext(disallowInAndDecoratorContext,
|
|
27847
|
-
? parseAssignmentExpressionOrHigher(
|
|
27858
|
+
return finishNode(factory.createConditionalExpression(leftOperand, questionToken, doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher), colonToken = parseExpectedToken(58), ts.nodeIsPresent(colonToken)
|
|
27859
|
+
? parseAssignmentExpressionOrHigher()
|
|
27848
27860
|
: createMissingNode(79, false, ts.Diagnostics._0_expected, ts.tokenToString(58))), pos);
|
|
27849
27861
|
}
|
|
27850
27862
|
function parseBinaryExpressionOrHigher(precedence) {
|
|
@@ -28495,13 +28507,13 @@ var ts;
|
|
|
28495
28507
|
function parseSpreadElement() {
|
|
28496
28508
|
var pos = getNodePos();
|
|
28497
28509
|
parseExpected(25);
|
|
28498
|
-
var expression = parseAssignmentExpressionOrHigher(
|
|
28510
|
+
var expression = parseAssignmentExpressionOrHigher();
|
|
28499
28511
|
return finishNode(factory.createSpreadElement(expression), pos);
|
|
28500
28512
|
}
|
|
28501
28513
|
function parseArgumentOrArrayLiteralElement() {
|
|
28502
28514
|
return token() === 25 ? parseSpreadElement() :
|
|
28503
28515
|
token() === 27 ? finishNode(factory.createOmittedExpression(), getNodePos()) :
|
|
28504
|
-
parseAssignmentExpressionOrHigher(
|
|
28516
|
+
parseAssignmentExpressionOrHigher();
|
|
28505
28517
|
}
|
|
28506
28518
|
function parseArgumentExpression() {
|
|
28507
28519
|
return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement);
|
|
@@ -28519,7 +28531,7 @@ var ts;
|
|
|
28519
28531
|
var pos = getNodePos();
|
|
28520
28532
|
var hasJSDoc = hasPrecedingJSDocComment();
|
|
28521
28533
|
if (parseOptionalToken(25)) {
|
|
28522
|
-
var expression = parseAssignmentExpressionOrHigher(
|
|
28534
|
+
var expression = parseAssignmentExpressionOrHigher();
|
|
28523
28535
|
return withJSDoc(finishNode(factory.createSpreadAssignment(expression), pos), hasJSDoc);
|
|
28524
28536
|
}
|
|
28525
28537
|
var decorators = parseDecorators();
|
|
@@ -28542,13 +28554,13 @@ var ts;
|
|
|
28542
28554
|
var isShorthandPropertyAssignment = tokenIsIdentifier && (token() !== 58);
|
|
28543
28555
|
if (isShorthandPropertyAssignment) {
|
|
28544
28556
|
var equalsToken = parseOptionalToken(63);
|
|
28545
|
-
var objectAssignmentInitializer = equalsToken ? allowInAnd(
|
|
28557
|
+
var objectAssignmentInitializer = equalsToken ? allowInAnd(parseAssignmentExpressionOrHigher) : undefined;
|
|
28546
28558
|
node = factory.createShorthandPropertyAssignment(name, objectAssignmentInitializer);
|
|
28547
28559
|
node.equalsToken = equalsToken;
|
|
28548
28560
|
}
|
|
28549
28561
|
else {
|
|
28550
28562
|
parseExpected(58);
|
|
28551
|
-
var initializer = allowInAnd(
|
|
28563
|
+
var initializer = allowInAnd(parseAssignmentExpressionOrHigher);
|
|
28552
28564
|
node = factory.createPropertyAssignment(name, initializer);
|
|
28553
28565
|
}
|
|
28554
28566
|
node.decorators = decorators;
|
|
@@ -28708,7 +28720,7 @@ var ts;
|
|
|
28708
28720
|
}
|
|
28709
28721
|
var node;
|
|
28710
28722
|
if (awaitToken ? parseExpected(160) : parseOptional(160)) {
|
|
28711
|
-
var expression = allowInAnd(
|
|
28723
|
+
var expression = allowInAnd(parseAssignmentExpressionOrHigher);
|
|
28712
28724
|
parseExpected(21);
|
|
28713
28725
|
node = factory.createForOfStatement(awaitToken, initializer, expression, parseStatement());
|
|
28714
28726
|
}
|
|
@@ -29746,7 +29758,7 @@ var ts;
|
|
|
29746
29758
|
var pos = getNodePos();
|
|
29747
29759
|
var name = ts.tokenIsIdentifierOrKeyword(token()) ? parseIdentifierName() : parseLiteralLikeNode(10);
|
|
29748
29760
|
parseExpected(58);
|
|
29749
|
-
var value = parseAssignmentExpressionOrHigher(
|
|
29761
|
+
var value = parseAssignmentExpressionOrHigher();
|
|
29750
29762
|
return finishNode(factory.createAssertEntry(name, value), pos);
|
|
29751
29763
|
}
|
|
29752
29764
|
function parseAssertClause(skipAssertKeyword) {
|
|
@@ -29796,7 +29808,7 @@ var ts;
|
|
|
29796
29808
|
function parseModuleReference() {
|
|
29797
29809
|
return isExternalModuleReference()
|
|
29798
29810
|
? parseExternalModuleReference()
|
|
29799
|
-
: parseEntityName(false
|
|
29811
|
+
: parseEntityName(false);
|
|
29800
29812
|
}
|
|
29801
29813
|
function parseExternalModuleReference() {
|
|
29802
29814
|
var pos = getNodePos();
|
|
@@ -29940,7 +29952,7 @@ var ts;
|
|
|
29940
29952
|
else {
|
|
29941
29953
|
parseExpected(88);
|
|
29942
29954
|
}
|
|
29943
|
-
var expression = parseAssignmentExpressionOrHigher(
|
|
29955
|
+
var expression = parseAssignmentExpressionOrHigher();
|
|
29944
29956
|
parseSemicolon();
|
|
29945
29957
|
setAwaitContext(savedAwaitContext);
|
|
29946
29958
|
var node = factory.createExportAssignment(decorators, modifiers, isExportEquals, expression);
|
|
@@ -29978,7 +29990,7 @@ var ts;
|
|
|
29978
29990
|
var pos = getNodePos();
|
|
29979
29991
|
var hasBrace = parseOptional(18);
|
|
29980
29992
|
var p2 = getNodePos();
|
|
29981
|
-
var entityName = parseEntityName(false
|
|
29993
|
+
var entityName = parseEntityName(false);
|
|
29982
29994
|
while (token() === 80) {
|
|
29983
29995
|
reScanHashToken();
|
|
29984
29996
|
nextTokenJSDoc();
|
|
@@ -30380,7 +30392,7 @@ var ts;
|
|
|
30380
30392
|
skipWhitespace();
|
|
30381
30393
|
var p2 = getNodePos();
|
|
30382
30394
|
var name = ts.tokenIsIdentifierOrKeyword(token())
|
|
30383
|
-
? parseEntityName(true
|
|
30395
|
+
? parseEntityName(true)
|
|
30384
30396
|
: undefined;
|
|
30385
30397
|
if (name) {
|
|
30386
30398
|
while (token() === 80) {
|
|
@@ -31468,6 +31480,7 @@ var ts;
|
|
|
31468
31480
|
["es2021.intl", "lib.es2021.intl.d.ts"],
|
|
31469
31481
|
["es2022.array", "lib.es2022.array.d.ts"],
|
|
31470
31482
|
["es2022.error", "lib.es2022.error.d.ts"],
|
|
31483
|
+
["es2022.intl", "lib.es2022.intl.d.ts"],
|
|
31471
31484
|
["es2022.object", "lib.es2022.object.d.ts"],
|
|
31472
31485
|
["es2022.string", "lib.es2022.string.d.ts"],
|
|
31473
31486
|
["esnext.array", "lib.es2022.array.d.ts"],
|
|
@@ -34359,7 +34372,7 @@ var ts;
|
|
|
34359
34372
|
ts.Debug.assert(ts.extensionIsTS(resolved.extension));
|
|
34360
34373
|
return { fileName: resolved.path, packageId: resolved.packageId };
|
|
34361
34374
|
}
|
|
34362
|
-
function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, resultFromCache) {
|
|
34375
|
+
function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, diagnostics, resultFromCache) {
|
|
34363
34376
|
var _a;
|
|
34364
34377
|
if (resultFromCache) {
|
|
34365
34378
|
(_a = resultFromCache.failedLookupLocations).push.apply(_a, failedLookupLocations);
|
|
@@ -34367,7 +34380,8 @@ var ts;
|
|
|
34367
34380
|
}
|
|
34368
34381
|
return {
|
|
34369
34382
|
resolvedModule: resolved && { resolvedFileName: resolved.path, originalPath: resolved.originalPath === true ? undefined : resolved.originalPath, extension: resolved.extension, isExternalLibraryImport: isExternalLibraryImport, packageId: resolved.packageId },
|
|
34370
|
-
failedLookupLocations: failedLookupLocations
|
|
34383
|
+
failedLookupLocations: failedLookupLocations,
|
|
34384
|
+
resolutionDiagnostics: diagnostics
|
|
34371
34385
|
};
|
|
34372
34386
|
}
|
|
34373
34387
|
function readPackageJsonField(jsonContent, fieldName, typeOfTag, state) {
|
|
@@ -34548,7 +34562,18 @@ var ts;
|
|
|
34548
34562
|
features |= NodeResolutionFeatures.EsmMode;
|
|
34549
34563
|
}
|
|
34550
34564
|
var conditions = features & NodeResolutionFeatures.Exports ? features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"] : [];
|
|
34551
|
-
var
|
|
34565
|
+
var diagnostics = [];
|
|
34566
|
+
var moduleResolutionState = {
|
|
34567
|
+
compilerOptions: options,
|
|
34568
|
+
host: host,
|
|
34569
|
+
traceEnabled: traceEnabled,
|
|
34570
|
+
failedLookupLocations: failedLookupLocations,
|
|
34571
|
+
packageJsonInfoCache: cache,
|
|
34572
|
+
features: features,
|
|
34573
|
+
conditions: conditions,
|
|
34574
|
+
requestContainingDirectory: containingDirectory,
|
|
34575
|
+
reportDiagnostic: function (diag) { return void diagnostics.push(diag); },
|
|
34576
|
+
};
|
|
34552
34577
|
var resolved = primaryLookup();
|
|
34553
34578
|
var primary = true;
|
|
34554
34579
|
if (!resolved) {
|
|
@@ -34567,7 +34592,7 @@ var ts;
|
|
|
34567
34592
|
isExternalLibraryImport: pathContainsNodeModules(fileName),
|
|
34568
34593
|
};
|
|
34569
34594
|
}
|
|
34570
|
-
result = { resolvedTypeReferenceDirective: resolvedTypeReferenceDirective, failedLookupLocations: failedLookupLocations };
|
|
34595
|
+
result = { resolvedTypeReferenceDirective: resolvedTypeReferenceDirective, failedLookupLocations: failedLookupLocations, resolutionDiagnostics: diagnostics };
|
|
34571
34596
|
perFolderCache === null || perFolderCache === void 0 ? void 0 : perFolderCache.set(typeReferenceDirectiveName, resolutionMode, result);
|
|
34572
34597
|
if (traceEnabled)
|
|
34573
34598
|
traceResult(result);
|
|
@@ -34644,6 +34669,8 @@ var ts;
|
|
|
34644
34669
|
packageJsonInfoCache: cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(),
|
|
34645
34670
|
conditions: ts.emptyArray,
|
|
34646
34671
|
features: NodeResolutionFeatures.None,
|
|
34672
|
+
requestContainingDirectory: containingDirectory,
|
|
34673
|
+
reportDiagnostic: ts.noop
|
|
34647
34674
|
};
|
|
34648
34675
|
return ts.forEachAncestorDirectory(containingDirectory, function (ancestorDirectory) {
|
|
34649
34676
|
if (ts.getBaseFileName(ancestorDirectory) !== "node_modules") {
|
|
@@ -35172,6 +35199,7 @@ var ts;
|
|
|
35172
35199
|
if (compilerOptions.noDtsResolution) {
|
|
35173
35200
|
conditions.pop();
|
|
35174
35201
|
}
|
|
35202
|
+
var diagnostics = [];
|
|
35175
35203
|
var state = {
|
|
35176
35204
|
compilerOptions: compilerOptions,
|
|
35177
35205
|
host: host,
|
|
@@ -35180,9 +35208,11 @@ var ts;
|
|
|
35180
35208
|
packageJsonInfoCache: cache,
|
|
35181
35209
|
features: features,
|
|
35182
35210
|
conditions: conditions,
|
|
35211
|
+
requestContainingDirectory: containingDirectory,
|
|
35212
|
+
reportDiagnostic: function (diag) { return void diagnostics.push(diag); },
|
|
35183
35213
|
};
|
|
35184
35214
|
var result = ts.forEach(extensions, function (ext) { return tryResolve(ext); });
|
|
35185
|
-
return createResolvedModuleWithFailedLookupLocations((_a = result === null || result === void 0 ? void 0 : result.value) === null || _a === void 0 ? void 0 : _a.resolved, (_b = result === null || result === void 0 ? void 0 : result.value) === null || _b === void 0 ? void 0 : _b.isExternalLibraryImport, failedLookupLocations, state.resultFromCache);
|
|
35215
|
+
return createResolvedModuleWithFailedLookupLocations((_a = result === null || result === void 0 ? void 0 : result.value) === null || _a === void 0 ? void 0 : _a.resolved, (_b = result === null || result === void 0 ? void 0 : result.value) === null || _b === void 0 ? void 0 : _b.isExternalLibraryImport, failedLookupLocations, diagnostics, state.resultFromCache);
|
|
35186
35216
|
function tryResolve(extensions) {
|
|
35187
35217
|
var loader = function (extensions, candidate, onlyRecordFailures, state) { return nodeLoadModuleByRelativeName(extensions, candidate, onlyRecordFailures, state, true); };
|
|
35188
35218
|
var resolved = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loader, state);
|
|
@@ -35324,9 +35354,9 @@ var ts;
|
|
|
35324
35354
|
}
|
|
35325
35355
|
}
|
|
35326
35356
|
function loadJSOrExactTSFileName(extensions, candidate, onlyRecordFailures, state) {
|
|
35327
|
-
if ((extensions === Extensions.TypeScript || extensions === Extensions.DtsOnly) && ts.
|
|
35357
|
+
if ((extensions === Extensions.TypeScript || extensions === Extensions.DtsOnly) && ts.fileExtensionIsOneOf(candidate, ts.supportedTSExtensionsFlat)) {
|
|
35328
35358
|
var result = tryFile(candidate, onlyRecordFailures, state);
|
|
35329
|
-
return result !== undefined ? { path: candidate, ext: ts.
|
|
35359
|
+
return result !== undefined ? { path: candidate, ext: ts.tryExtractTSExtension(candidate) } : undefined;
|
|
35330
35360
|
}
|
|
35331
35361
|
return loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecordFailures, state);
|
|
35332
35362
|
}
|
|
@@ -35443,6 +35473,8 @@ var ts;
|
|
|
35443
35473
|
packageJsonInfoCache: cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(),
|
|
35444
35474
|
conditions: ["node", "require", "types"],
|
|
35445
35475
|
features: features,
|
|
35476
|
+
requestContainingDirectory: packageJsonInfo.packageDirectory,
|
|
35477
|
+
reportDiagnostic: ts.noop
|
|
35446
35478
|
};
|
|
35447
35479
|
var requireResolution = loadNodeModuleFromDirectoryWorker(extensions, packageJsonInfo.packageDirectory, false, requireState, packageJsonInfo.packageJsonContent, packageJsonInfo.versionPaths);
|
|
35448
35480
|
entrypoints = ts.append(entrypoints, requireResolution === null || requireResolution === void 0 ? void 0 : requireResolution.path);
|
|
@@ -35522,6 +35554,8 @@ var ts;
|
|
|
35522
35554
|
packageJsonInfoCache: packageJsonInfoCache,
|
|
35523
35555
|
features: 0,
|
|
35524
35556
|
conditions: [],
|
|
35557
|
+
requestContainingDirectory: undefined,
|
|
35558
|
+
reportDiagnostic: ts.noop
|
|
35525
35559
|
};
|
|
35526
35560
|
var parts = ts.getPathComponents(fileName);
|
|
35527
35561
|
parts.pop();
|
|
@@ -35796,7 +35830,6 @@ var ts;
|
|
|
35796
35830
|
function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports) {
|
|
35797
35831
|
return loadModuleFromTargetImportOrExport;
|
|
35798
35832
|
function loadModuleFromTargetImportOrExport(target, subpath, pattern) {
|
|
35799
|
-
var _a, _b;
|
|
35800
35833
|
if (typeof target === "string") {
|
|
35801
35834
|
if (!pattern && subpath.length > 0 && !ts.endsWith(target, "/")) {
|
|
35802
35835
|
if (state.traceEnabled) {
|
|
@@ -35831,13 +35864,16 @@ var ts;
|
|
|
35831
35864
|
}
|
|
35832
35865
|
return toSearchResult(undefined);
|
|
35833
35866
|
}
|
|
35834
|
-
var finalPath =
|
|
35867
|
+
var finalPath = toAbsolutePath(pattern ? resolvedTarget.replace(/\*/g, subpath) : resolvedTarget + subpath);
|
|
35868
|
+
var inputLink = tryLoadInputFileForPath(finalPath, subpath, ts.combinePaths(scope.packageDirectory, "package.json"), isImports);
|
|
35869
|
+
if (inputLink)
|
|
35870
|
+
return inputLink;
|
|
35835
35871
|
return toSearchResult(withPackageId(scope, loadJSOrExactTSFileName(extensions, finalPath, false, state)));
|
|
35836
35872
|
}
|
|
35837
35873
|
else if (typeof target === "object" && target !== null) {
|
|
35838
35874
|
if (!Array.isArray(target)) {
|
|
35839
|
-
for (var _i = 0,
|
|
35840
|
-
var key =
|
|
35875
|
+
for (var _i = 0, _a = ts.getOwnKeys(target); _i < _a.length; _i++) {
|
|
35876
|
+
var key = _a[_i];
|
|
35841
35877
|
if (key === "default" || state.conditions.indexOf(key) >= 0 || isApplicableVersionedTypesKey(state.conditions, key)) {
|
|
35842
35878
|
var subTarget = target[key];
|
|
35843
35879
|
var result = loadModuleFromTargetImportOrExport(subTarget, subpath, pattern);
|
|
@@ -35855,8 +35891,8 @@ var ts;
|
|
|
35855
35891
|
}
|
|
35856
35892
|
return toSearchResult(undefined);
|
|
35857
35893
|
}
|
|
35858
|
-
for (var
|
|
35859
|
-
var elem = target_2[
|
|
35894
|
+
for (var _b = 0, target_2 = target; _b < target_2.length; _b++) {
|
|
35895
|
+
var elem = target_2[_b];
|
|
35860
35896
|
var result = loadModuleFromTargetImportOrExport(elem, subpath, pattern);
|
|
35861
35897
|
if (result) {
|
|
35862
35898
|
return result;
|
|
@@ -35874,6 +35910,94 @@ var ts;
|
|
|
35874
35910
|
trace(state.host, ts.Diagnostics.package_json_scope_0_has_invalid_type_for_target_of_specifier_1, scope.packageDirectory, moduleName);
|
|
35875
35911
|
}
|
|
35876
35912
|
return toSearchResult(undefined);
|
|
35913
|
+
function toAbsolutePath(path) {
|
|
35914
|
+
var _a, _b;
|
|
35915
|
+
if (path === undefined)
|
|
35916
|
+
return path;
|
|
35917
|
+
return ts.hostGetCanonicalFileName({ useCaseSensitiveFileNames: useCaseSensitiveFileNames })(ts.getNormalizedAbsolutePath(path, (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a)));
|
|
35918
|
+
}
|
|
35919
|
+
function combineDirectoryPath(root, dir) {
|
|
35920
|
+
return ts.ensureTrailingDirectorySeparator(ts.combinePaths(root, dir));
|
|
35921
|
+
}
|
|
35922
|
+
function useCaseSensitiveFileNames() {
|
|
35923
|
+
return !state.host.useCaseSensitiveFileNames ? true :
|
|
35924
|
+
typeof state.host.useCaseSensitiveFileNames === "boolean" ? state.host.useCaseSensitiveFileNames :
|
|
35925
|
+
state.host.useCaseSensitiveFileNames();
|
|
35926
|
+
}
|
|
35927
|
+
function tryLoadInputFileForPath(finalPath, entry, packagePath, isImports) {
|
|
35928
|
+
var _a, _b, _c, _d;
|
|
35929
|
+
if ((extensions === Extensions.TypeScript || extensions === Extensions.JavaScript || extensions === Extensions.Json)
|
|
35930
|
+
&& (state.compilerOptions.declarationDir || state.compilerOptions.outDir)
|
|
35931
|
+
&& finalPath.indexOf("/node_modules/") === -1
|
|
35932
|
+
&& (state.compilerOptions.configFile ? ts.startsWith(toAbsolutePath(state.compilerOptions.configFile.fileName), scope.packageDirectory) : true)) {
|
|
35933
|
+
var getCanonicalFileName = ts.hostGetCanonicalFileName({ useCaseSensitiveFileNames: useCaseSensitiveFileNames });
|
|
35934
|
+
var commonSourceDirGuesses = [];
|
|
35935
|
+
if (state.compilerOptions.rootDir || (state.compilerOptions.composite && state.compilerOptions.configFilePath)) {
|
|
35936
|
+
var commonDir = toAbsolutePath(ts.getCommonSourceDirectory(state.compilerOptions, function () { return []; }, ((_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a)) || "", getCanonicalFileName));
|
|
35937
|
+
commonSourceDirGuesses.push(commonDir);
|
|
35938
|
+
}
|
|
35939
|
+
else if (state.requestContainingDirectory) {
|
|
35940
|
+
var requestingFile_1 = toAbsolutePath(ts.combinePaths(state.requestContainingDirectory, "index.ts"));
|
|
35941
|
+
var commonDir = toAbsolutePath(ts.getCommonSourceDirectory(state.compilerOptions, function () { return [requestingFile_1, toAbsolutePath(packagePath)]; }, ((_d = (_c = state.host).getCurrentDirectory) === null || _d === void 0 ? void 0 : _d.call(_c)) || "", getCanonicalFileName));
|
|
35942
|
+
commonSourceDirGuesses.push(commonDir);
|
|
35943
|
+
var fragment = ts.ensureTrailingDirectorySeparator(commonDir);
|
|
35944
|
+
while (fragment && fragment.length > 1) {
|
|
35945
|
+
var parts = ts.getPathComponents(fragment);
|
|
35946
|
+
parts.pop();
|
|
35947
|
+
var commonDir_1 = ts.getPathFromPathComponents(parts);
|
|
35948
|
+
commonSourceDirGuesses.unshift(commonDir_1);
|
|
35949
|
+
fragment = ts.ensureTrailingDirectorySeparator(commonDir_1);
|
|
35950
|
+
}
|
|
35951
|
+
}
|
|
35952
|
+
if (commonSourceDirGuesses.length > 1) {
|
|
35953
|
+
state.reportDiagnostic(ts.createCompilerDiagnostic(isImports
|
|
35954
|
+
? ts.Diagnostics.The_project_root_is_ambiguous_but_is_required_to_resolve_import_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate
|
|
35955
|
+
: ts.Diagnostics.The_project_root_is_ambiguous_but_is_required_to_resolve_export_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate, entry === "" ? "." : entry, packagePath));
|
|
35956
|
+
}
|
|
35957
|
+
for (var _i = 0, commonSourceDirGuesses_1 = commonSourceDirGuesses; _i < commonSourceDirGuesses_1.length; _i++) {
|
|
35958
|
+
var commonSourceDirGuess = commonSourceDirGuesses_1[_i];
|
|
35959
|
+
var candidateDirectories = getOutputDirectoriesForBaseDirectory(commonSourceDirGuess);
|
|
35960
|
+
for (var _e = 0, candidateDirectories_1 = candidateDirectories; _e < candidateDirectories_1.length; _e++) {
|
|
35961
|
+
var candidateDir = candidateDirectories_1[_e];
|
|
35962
|
+
if (ts.startsWith(finalPath, candidateDir)) {
|
|
35963
|
+
var pathFragment = finalPath.slice(candidateDir.length + 1);
|
|
35964
|
+
var possibleInputBase = ts.combinePaths(commonSourceDirGuess, pathFragment);
|
|
35965
|
+
var jsAndDtsExtensions = [".mjs", ".cjs", ".js", ".json", ".d.mts", ".d.cts", ".d.ts"];
|
|
35966
|
+
for (var _f = 0, jsAndDtsExtensions_1 = jsAndDtsExtensions; _f < jsAndDtsExtensions_1.length; _f++) {
|
|
35967
|
+
var ext = jsAndDtsExtensions_1[_f];
|
|
35968
|
+
if (ts.fileExtensionIs(possibleInputBase, ext)) {
|
|
35969
|
+
var inputExts = ts.getPossibleOriginalInputExtensionForExtension(possibleInputBase);
|
|
35970
|
+
for (var _g = 0, inputExts_1 = inputExts; _g < inputExts_1.length; _g++) {
|
|
35971
|
+
var possibleExt = inputExts_1[_g];
|
|
35972
|
+
var possibleInputWithInputExtension = ts.changeAnyExtension(possibleInputBase, possibleExt, ext, !useCaseSensitiveFileNames());
|
|
35973
|
+
if ((extensions === Extensions.TypeScript && ts.hasJSFileExtension(possibleInputWithInputExtension)) ||
|
|
35974
|
+
(extensions === Extensions.JavaScript && ts.hasTSFileExtension(possibleInputWithInputExtension))) {
|
|
35975
|
+
continue;
|
|
35976
|
+
}
|
|
35977
|
+
if (state.host.fileExists(possibleInputWithInputExtension)) {
|
|
35978
|
+
return toSearchResult(withPackageId(scope, loadJSOrExactTSFileName(extensions, possibleInputWithInputExtension, false, state)));
|
|
35979
|
+
}
|
|
35980
|
+
}
|
|
35981
|
+
}
|
|
35982
|
+
}
|
|
35983
|
+
}
|
|
35984
|
+
}
|
|
35985
|
+
}
|
|
35986
|
+
}
|
|
35987
|
+
return undefined;
|
|
35988
|
+
function getOutputDirectoriesForBaseDirectory(commonSourceDirGuess) {
|
|
35989
|
+
var _a, _b;
|
|
35990
|
+
var currentDir = state.compilerOptions.configFile ? ((_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a)) || "" : commonSourceDirGuess;
|
|
35991
|
+
var candidateDirectories = [];
|
|
35992
|
+
if (state.compilerOptions.declarationDir) {
|
|
35993
|
+
candidateDirectories.push(toAbsolutePath(combineDirectoryPath(currentDir, state.compilerOptions.declarationDir)));
|
|
35994
|
+
}
|
|
35995
|
+
if (state.compilerOptions.outDir && state.compilerOptions.outDir !== state.compilerOptions.declarationDir) {
|
|
35996
|
+
candidateDirectories.push(toAbsolutePath(combineDirectoryPath(currentDir, state.compilerOptions.outDir)));
|
|
35997
|
+
}
|
|
35998
|
+
return candidateDirectories;
|
|
35999
|
+
}
|
|
36000
|
+
}
|
|
35877
36001
|
}
|
|
35878
36002
|
}
|
|
35879
36003
|
function isApplicableVersionedTypesKey(conditions, key) {
|
|
@@ -36048,10 +36172,11 @@ var ts;
|
|
|
36048
36172
|
function classicNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference) {
|
|
36049
36173
|
var traceEnabled = isTraceEnabled(compilerOptions, host);
|
|
36050
36174
|
var failedLookupLocations = [];
|
|
36051
|
-
var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled, failedLookupLocations: failedLookupLocations, packageJsonInfoCache: cache, features: NodeResolutionFeatures.None, conditions: [] };
|
|
36052
36175
|
var containingDirectory = ts.getDirectoryPath(containingFile);
|
|
36176
|
+
var diagnostics = [];
|
|
36177
|
+
var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled, failedLookupLocations: failedLookupLocations, packageJsonInfoCache: cache, features: NodeResolutionFeatures.None, conditions: [], requestContainingDirectory: containingDirectory, reportDiagnostic: function (diag) { return void diagnostics.push(diag); } };
|
|
36053
36178
|
var resolved = tryResolve(Extensions.TypeScript) || tryResolve(Extensions.JavaScript);
|
|
36054
|
-
return createResolvedModuleWithFailedLookupLocations(resolved && resolved.value, false, failedLookupLocations, state.resultFromCache);
|
|
36179
|
+
return createResolvedModuleWithFailedLookupLocations(resolved && resolved.value, false, failedLookupLocations, diagnostics, state.resultFromCache);
|
|
36055
36180
|
function tryResolve(extensions) {
|
|
36056
36181
|
var resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFileNoPackageId, state);
|
|
36057
36182
|
if (resolvedUsingSettings) {
|
|
@@ -36087,9 +36212,10 @@ var ts;
|
|
|
36087
36212
|
trace(host, ts.Diagnostics.Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using_cache_location_2, projectName, moduleName, globalCache);
|
|
36088
36213
|
}
|
|
36089
36214
|
var failedLookupLocations = [];
|
|
36090
|
-
var
|
|
36215
|
+
var diagnostics = [];
|
|
36216
|
+
var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled, failedLookupLocations: failedLookupLocations, packageJsonInfoCache: packageJsonInfoCache, features: NodeResolutionFeatures.None, conditions: [], requestContainingDirectory: undefined, reportDiagnostic: function (diag) { return void diagnostics.push(diag); } };
|
|
36091
36217
|
var resolved = loadModuleFromImmediateNodeModulesDirectory(Extensions.DtsOnly, moduleName, globalCache, state, false, undefined, undefined);
|
|
36092
|
-
return createResolvedModuleWithFailedLookupLocations(resolved, true, failedLookupLocations, state.resultFromCache);
|
|
36218
|
+
return createResolvedModuleWithFailedLookupLocations(resolved, true, failedLookupLocations, diagnostics, state.resultFromCache);
|
|
36093
36219
|
}
|
|
36094
36220
|
ts.loadModuleFromGlobalCache = loadModuleFromGlobalCache;
|
|
36095
36221
|
function toSearchResult(value) {
|
|
@@ -47931,7 +48057,8 @@ var ts;
|
|
|
47931
48057
|
if (symbol === globalThisSymbol) {
|
|
47932
48058
|
var varsOnly_1 = new ts.Map();
|
|
47933
48059
|
members.forEach(function (p) {
|
|
47934
|
-
|
|
48060
|
+
var _a;
|
|
48061
|
+
if (!(p.flags & 418) && !(p.flags & 512 && ((_a = p.declarations) === null || _a === void 0 ? void 0 : _a.length) && ts.every(p.declarations, ts.isAmbientModule))) {
|
|
47935
48062
|
varsOnly_1.set(p.escapedName, p);
|
|
47936
48063
|
}
|
|
47937
48064
|
});
|
|
@@ -71086,6 +71213,9 @@ var ts;
|
|
|
71086
71213
|
var validForTypeAssertions = ts.isExclusivelyTypeOnlyImportOrExport(declaration);
|
|
71087
71214
|
var override = ts.getResolutionModeOverrideForClause(declaration.assertClause, validForTypeAssertions ? grammarErrorOnNode : undefined);
|
|
71088
71215
|
if (validForTypeAssertions && override) {
|
|
71216
|
+
if (!ts.isNightly()) {
|
|
71217
|
+
grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.Resolution_mode_assertions_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next);
|
|
71218
|
+
}
|
|
71089
71219
|
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
|
|
71090
71220
|
return grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.Resolution_modes_are_only_supported_when_moduleResolution_is_node16_or_nodenext);
|
|
71091
71221
|
}
|
|
@@ -72292,7 +72422,7 @@ var ts;
|
|
|
72292
72422
|
}
|
|
72293
72423
|
if (ts.isDeclaration(node)) {
|
|
72294
72424
|
var symbol = getSymbolOfNode(node);
|
|
72295
|
-
return getTypeOfSymbol(symbol);
|
|
72425
|
+
return symbol ? getTypeOfSymbol(symbol) : errorType;
|
|
72296
72426
|
}
|
|
72297
72427
|
if (isDeclarationNameOrImportPropertyName(node)) {
|
|
72298
72428
|
var symbol = getSymbolAtLocation(node);
|
|
@@ -88735,24 +88865,34 @@ var ts;
|
|
|
88735
88865
|
}
|
|
88736
88866
|
function transformImportDeclaration(decl) {
|
|
88737
88867
|
if (!decl.importClause) {
|
|
88738
|
-
return factory.updateImportDeclaration(decl, undefined, decl.modifiers, decl.importClause, rewriteModuleSpecifier(decl, decl.moduleSpecifier),
|
|
88868
|
+
return factory.updateImportDeclaration(decl, undefined, decl.modifiers, decl.importClause, rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause));
|
|
88739
88869
|
}
|
|
88740
88870
|
var visibleDefaultBinding = decl.importClause && decl.importClause.name && resolver.isDeclarationVisible(decl.importClause) ? decl.importClause.name : undefined;
|
|
88741
88871
|
if (!decl.importClause.namedBindings) {
|
|
88742
|
-
return visibleDefaultBinding && factory.updateImportDeclaration(decl, undefined, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, undefined), rewriteModuleSpecifier(decl, decl.moduleSpecifier),
|
|
88872
|
+
return visibleDefaultBinding && factory.updateImportDeclaration(decl, undefined, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, undefined), rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause));
|
|
88743
88873
|
}
|
|
88744
88874
|
if (decl.importClause.namedBindings.kind === 268) {
|
|
88745
88875
|
var namedBindings = resolver.isDeclarationVisible(decl.importClause.namedBindings) ? decl.importClause.namedBindings : undefined;
|
|
88746
|
-
return visibleDefaultBinding || namedBindings ? factory.updateImportDeclaration(decl, undefined, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, namedBindings), rewriteModuleSpecifier(decl, decl.moduleSpecifier),
|
|
88876
|
+
return visibleDefaultBinding || namedBindings ? factory.updateImportDeclaration(decl, undefined, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, namedBindings), rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause)) : undefined;
|
|
88747
88877
|
}
|
|
88748
88878
|
var bindingList = ts.mapDefined(decl.importClause.namedBindings.elements, function (b) { return resolver.isDeclarationVisible(b) ? b : undefined; });
|
|
88749
88879
|
if ((bindingList && bindingList.length) || visibleDefaultBinding) {
|
|
88750
|
-
return factory.updateImportDeclaration(decl, undefined, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, bindingList && bindingList.length ? factory.updateNamedImports(decl.importClause.namedBindings, bindingList) : undefined), rewriteModuleSpecifier(decl, decl.moduleSpecifier),
|
|
88880
|
+
return factory.updateImportDeclaration(decl, undefined, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, bindingList && bindingList.length ? factory.updateNamedImports(decl.importClause.namedBindings, bindingList) : undefined), rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause));
|
|
88751
88881
|
}
|
|
88752
88882
|
if (resolver.isImportRequiredByAugmentation(decl)) {
|
|
88753
|
-
return factory.updateImportDeclaration(decl, undefined, decl.modifiers, undefined, rewriteModuleSpecifier(decl, decl.moduleSpecifier),
|
|
88883
|
+
return factory.updateImportDeclaration(decl, undefined, decl.modifiers, undefined, rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause));
|
|
88754
88884
|
}
|
|
88755
88885
|
}
|
|
88886
|
+
function getResolutionModeOverrideForClauseInNightly(assertClause) {
|
|
88887
|
+
var mode = ts.getResolutionModeOverrideForClause(assertClause);
|
|
88888
|
+
if (mode !== undefined) {
|
|
88889
|
+
if (!ts.isNightly()) {
|
|
88890
|
+
context.addDiagnostic(ts.createDiagnosticForNode(assertClause, ts.Diagnostics.Resolution_mode_assertions_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next));
|
|
88891
|
+
}
|
|
88892
|
+
return assertClause;
|
|
88893
|
+
}
|
|
88894
|
+
return undefined;
|
|
88895
|
+
}
|
|
88756
88896
|
function transformAndReplaceLatePaintedStatements(statements) {
|
|
88757
88897
|
while (ts.length(lateMarkedStatements)) {
|
|
88758
88898
|
var i = lateMarkedStatements.shift();
|
|
@@ -95784,7 +95924,6 @@ var ts;
|
|
|
95784
95924
|
ts.Diagnostics.A_rest_parameter_cannot_have_an_initializer.code,
|
|
95785
95925
|
ts.Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list.code,
|
|
95786
95926
|
ts.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma.code,
|
|
95787
|
-
ts.Diagnostics.A_return_statement_can_only_be_used_within_a_function_body.code,
|
|
95788
95927
|
ts.Diagnostics.A_return_statement_cannot_be_used_inside_a_class_static_block.code,
|
|
95789
95928
|
ts.Diagnostics.A_set_accessor_cannot_have_rest_parameter.code,
|
|
95790
95929
|
ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter.code,
|
|
@@ -96123,6 +96262,34 @@ var ts;
|
|
|
96123
96262
|
ts.performance.measure("Program", "beforeProgram", "afterProgram");
|
|
96124
96263
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
96125
96264
|
return program;
|
|
96265
|
+
function addResolutionDiagnostics(list) {
|
|
96266
|
+
if (!list)
|
|
96267
|
+
return;
|
|
96268
|
+
for (var _i = 0, list_3 = list; _i < list_3.length; _i++) {
|
|
96269
|
+
var elem = list_3[_i];
|
|
96270
|
+
programDiagnostics.add(elem);
|
|
96271
|
+
}
|
|
96272
|
+
}
|
|
96273
|
+
function pullDiagnosticsFromCache(names, containingFile) {
|
|
96274
|
+
var _a;
|
|
96275
|
+
if (!moduleResolutionCache)
|
|
96276
|
+
return;
|
|
96277
|
+
var containingFileName = ts.getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory);
|
|
96278
|
+
var containingFileMode = !ts.isString(containingFile) ? containingFile.impliedNodeFormat : undefined;
|
|
96279
|
+
var containingDir = ts.getDirectoryPath(containingFileName);
|
|
96280
|
+
var redirectedReference = getRedirectReferenceForResolution(containingFile);
|
|
96281
|
+
var i = 0;
|
|
96282
|
+
for (var _i = 0, names_4 = names; _i < names_4.length; _i++) {
|
|
96283
|
+
var n = names_4[_i];
|
|
96284
|
+
var mode = typeof n === "string" ? getModeForResolutionAtIndex(containingFile, i) : getModeForFileReference(n, containingFileMode);
|
|
96285
|
+
var name = typeof n === "string" ? n : n.fileName;
|
|
96286
|
+
i++;
|
|
96287
|
+
if (ts.isExternalModuleNameRelative(name))
|
|
96288
|
+
continue;
|
|
96289
|
+
var diags = (_a = moduleResolutionCache.getOrCreateCacheForModuleName(name, mode, redirectedReference).get(containingDir)) === null || _a === void 0 ? void 0 : _a.resolutionDiagnostics;
|
|
96290
|
+
addResolutionDiagnostics(diags);
|
|
96291
|
+
}
|
|
96292
|
+
}
|
|
96126
96293
|
function resolveModuleNamesWorker(moduleNames, containingFile, reusedNames) {
|
|
96127
96294
|
if (!moduleNames.length)
|
|
96128
96295
|
return ts.emptyArray;
|
|
@@ -96134,6 +96301,7 @@ var ts;
|
|
|
96134
96301
|
ts.performance.mark("afterResolveModule");
|
|
96135
96302
|
ts.performance.measure("ResolveModule", "beforeResolveModule", "afterResolveModule");
|
|
96136
96303
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
96304
|
+
pullDiagnosticsFromCache(moduleNames, containingFile);
|
|
96137
96305
|
return result;
|
|
96138
96306
|
}
|
|
96139
96307
|
function resolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFile) {
|
|
@@ -99936,8 +100104,8 @@ var ts;
|
|
|
99936
100104
|
!!redirectedReference;
|
|
99937
100105
|
var seenNamesInFile = ts.createModeAwareCache();
|
|
99938
100106
|
var i = 0;
|
|
99939
|
-
for (var _i = 0,
|
|
99940
|
-
var entry =
|
|
100107
|
+
for (var _i = 0, names_5 = names; _i < names_5.length; _i++) {
|
|
100108
|
+
var entry = names_5[_i];
|
|
99941
100109
|
var name = ts.isString(entry) ? entry : entry.fileName.toLowerCase();
|
|
99942
100110
|
var mode = !ts.isString(entry) ? ts.getModeForFileReference(entry, containingSourceFileMode) :
|
|
99943
100111
|
containingSourceFile ? ts.getModeForResolutionAtIndex(containingSourceFile, i) : undefined;
|
|
@@ -100463,14 +100631,14 @@ var ts;
|
|
|
100463
100631
|
if (options === void 0) { options = {}; }
|
|
100464
100632
|
var info = getInfo(importingSourceFile.path, host);
|
|
100465
100633
|
var modulePaths = getAllModulePaths(importingSourceFile.path, nodeModulesFileName, host, preferences, options);
|
|
100466
|
-
return ts.firstDefined(modulePaths, function (modulePath) { return tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, true, options.overrideImportMode); });
|
|
100634
|
+
return ts.firstDefined(modulePaths, function (modulePath) { return tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, preferences, true, options.overrideImportMode); });
|
|
100467
100635
|
}
|
|
100468
100636
|
moduleSpecifiers_1.getNodeModulesPackageName = getNodeModulesPackageName;
|
|
100469
100637
|
function getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName, host, preferences, userPreferences, options) {
|
|
100470
100638
|
if (options === void 0) { options = {}; }
|
|
100471
100639
|
var info = getInfo(importingSourceFileName, host);
|
|
100472
100640
|
var modulePaths = getAllModulePaths(importingSourceFileName, toFileName, host, userPreferences, options);
|
|
100473
|
-
return ts.firstDefined(modulePaths, function (modulePath) { return tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, undefined, options.overrideImportMode); }) ||
|
|
100641
|
+
return ts.firstDefined(modulePaths, function (modulePath) { return tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, userPreferences, undefined, options.overrideImportMode); }) ||
|
|
100474
100642
|
getLocalModuleSpecifier(toFileName, info, compilerOptions, host, preferences);
|
|
100475
100643
|
}
|
|
100476
100644
|
function tryGetModuleSpecifiersFromCache(moduleSymbol, importingSourceFile, host, userPreferences, options) {
|
|
@@ -100536,7 +100704,7 @@ var ts;
|
|
|
100536
100704
|
var relativeSpecifiers;
|
|
100537
100705
|
for (var _i = 0, modulePaths_1 = modulePaths; _i < modulePaths_1.length; _i++) {
|
|
100538
100706
|
var modulePath = modulePaths_1[_i];
|
|
100539
|
-
var specifier = tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, undefined, options.overrideImportMode);
|
|
100707
|
+
var specifier = tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, userPreferences, undefined, options.overrideImportMode);
|
|
100540
100708
|
nodeModulesSpecifiers = ts.append(nodeModulesSpecifiers, specifier);
|
|
100541
100709
|
if (specifier && modulePath.isRedirect) {
|
|
100542
100710
|
return nodeModulesSpecifiers;
|
|
@@ -100867,7 +101035,7 @@ var ts;
|
|
|
100867
101035
|
? removeExtensionAndIndexPostFix(relativePath, ending, compilerOptions)
|
|
100868
101036
|
: ts.removeFileExtension(relativePath);
|
|
100869
101037
|
}
|
|
100870
|
-
function tryGetModuleNameAsNodeModule(_a, _b, importingSourceFile, host, options, packageNameOnly, overrideMode) {
|
|
101038
|
+
function tryGetModuleNameAsNodeModule(_a, _b, importingSourceFile, host, options, userPreferences, packageNameOnly, overrideMode) {
|
|
100871
101039
|
var path = _a.path, isRedirect = _a.isRedirect;
|
|
100872
101040
|
var getCanonicalFileName = _b.getCanonicalFileName, sourceDirectory = _b.sourceDirectory;
|
|
100873
101041
|
if (!host.fileExists || !host.readFile) {
|
|
@@ -100880,8 +101048,9 @@ var ts;
|
|
|
100880
101048
|
var moduleSpecifier = path;
|
|
100881
101049
|
var isPackageRootPath = false;
|
|
100882
101050
|
if (!packageNameOnly) {
|
|
101051
|
+
var preferences = getPreferences(host, userPreferences, options, importingSourceFile);
|
|
100883
101052
|
var packageRootIndex = parts.packageRootIndex;
|
|
100884
|
-
var
|
|
101053
|
+
var moduleFileName = void 0;
|
|
100885
101054
|
while (true) {
|
|
100886
101055
|
var _c = tryDirectoryWithPackageJson(packageRootIndex), moduleFileToTry = _c.moduleFileToTry, packageRootPath = _c.packageRootPath, blockedByExports = _c.blockedByExports, verbatimFromExports = _c.verbatimFromExports;
|
|
100887
101056
|
if (ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.Classic) {
|
|
@@ -100897,11 +101066,11 @@ var ts;
|
|
|
100897
101066
|
isPackageRootPath = true;
|
|
100898
101067
|
break;
|
|
100899
101068
|
}
|
|
100900
|
-
if (!
|
|
100901
|
-
|
|
101069
|
+
if (!moduleFileName)
|
|
101070
|
+
moduleFileName = moduleFileToTry;
|
|
100902
101071
|
packageRootIndex = path.indexOf(ts.directorySeparator, packageRootIndex + 1);
|
|
100903
101072
|
if (packageRootIndex === -1) {
|
|
100904
|
-
moduleSpecifier =
|
|
101073
|
+
moduleSpecifier = removeExtensionAndIndexPostFix(moduleFileName, preferences.ending, options, host);
|
|
100905
101074
|
break;
|
|
100906
101075
|
}
|
|
100907
101076
|
}
|
|
@@ -100950,7 +101119,7 @@ var ts;
|
|
|
100950
101119
|
moduleFileToTry = ts.combinePaths(packageRootPath, fromPaths);
|
|
100951
101120
|
}
|
|
100952
101121
|
}
|
|
100953
|
-
var mainFileRelative = packageJsonContent.typings || packageJsonContent.types || packageJsonContent.main;
|
|
101122
|
+
var mainFileRelative = packageJsonContent.typings || packageJsonContent.types || packageJsonContent.main || "index.js";
|
|
100954
101123
|
if (ts.isString(mainFileRelative)) {
|
|
100955
101124
|
var mainExportFile = ts.toPath(mainFileRelative, packageRootPath, getCanonicalFileName);
|
|
100956
101125
|
if (ts.removeFileExtension(mainExportFile) === ts.removeFileExtension(getCanonicalFileName(moduleFileToTry))) {
|
|
@@ -100958,14 +101127,13 @@ var ts;
|
|
|
100958
101127
|
}
|
|
100959
101128
|
}
|
|
100960
101129
|
}
|
|
100961
|
-
|
|
100962
|
-
|
|
100963
|
-
|
|
100964
|
-
|
|
100965
|
-
|
|
100966
|
-
return fullModulePathWithoutExtension.substring(0, parts.fileNameIndex);
|
|
101130
|
+
else {
|
|
101131
|
+
var fileName = getCanonicalFileName(moduleFileToTry.substring(parts.packageRootIndex + 1));
|
|
101132
|
+
if (fileName === "index.d.ts" || fileName === "index.js" || fileName === "index.ts" || fileName === "index.tsx") {
|
|
101133
|
+
return { moduleFileToTry: moduleFileToTry, packageRootPath: packageRootPath };
|
|
101134
|
+
}
|
|
100967
101135
|
}
|
|
100968
|
-
return
|
|
101136
|
+
return { moduleFileToTry: moduleFileToTry };
|
|
100969
101137
|
}
|
|
100970
101138
|
}
|
|
100971
101139
|
function tryGetAnyFileFromPath(host, path) {
|
|
@@ -100986,7 +101154,7 @@ var ts;
|
|
|
100986
101154
|
return relativePath !== undefined && isPathRelativeToParent(relativePath) ? undefined : relativePath;
|
|
100987
101155
|
});
|
|
100988
101156
|
}
|
|
100989
|
-
function removeExtensionAndIndexPostFix(fileName, ending, options) {
|
|
101157
|
+
function removeExtensionAndIndexPostFix(fileName, ending, options, host) {
|
|
100990
101158
|
if (ts.fileExtensionIsOneOf(fileName, [".json", ".mjs", ".cjs"]))
|
|
100991
101159
|
return fileName;
|
|
100992
101160
|
var noExtension = ts.removeFileExtension(fileName);
|
|
@@ -100994,7 +101162,11 @@ var ts;
|
|
|
100994
101162
|
return noExtension + getJSExtensionForFile(fileName, options);
|
|
100995
101163
|
switch (ending) {
|
|
100996
101164
|
case 0:
|
|
100997
|
-
|
|
101165
|
+
var withoutIndex = ts.removeSuffix(noExtension, "/index");
|
|
101166
|
+
if (host && withoutIndex !== noExtension && tryGetAnyFileFromPath(host, withoutIndex)) {
|
|
101167
|
+
return noExtension;
|
|
101168
|
+
}
|
|
101169
|
+
return withoutIndex;
|
|
100998
101170
|
case 1:
|
|
100999
101171
|
return noExtension;
|
|
101000
101172
|
case 2:
|