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/typescript.js
CHANGED
|
@@ -290,11 +290,11 @@ var ts;
|
|
|
290
290
|
(function (ts) {
|
|
291
291
|
// WARNING: The script `configurePrerelease.ts` uses a regexp to parse out these values.
|
|
292
292
|
// If changing the text in this section, be sure to test `configurePrerelease` too.
|
|
293
|
-
ts.versionMajorMinor = "4.
|
|
293
|
+
ts.versionMajorMinor = "4.8";
|
|
294
294
|
// The following is baselined as a literal template type without intervention
|
|
295
295
|
/** The version of the TypeScript compiler release */
|
|
296
296
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
297
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
297
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220507";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -8603,6 +8603,8 @@ var ts;
|
|
|
8603
8603
|
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}'.", /*reportsUnnecessary*/ undefined, /*elidedInCompatabilityPyramid*/ true),
|
|
8604
8604
|
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."),
|
|
8605
8605
|
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."),
|
|
8606
|
+
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."),
|
|
8607
|
+
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."),
|
|
8606
8608
|
Duplicate_identifier_0: diag(2300, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_2300", "Duplicate identifier '{0}'."),
|
|
8607
8609
|
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."),
|
|
8608
8610
|
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."),
|
|
@@ -9192,6 +9194,7 @@ var ts;
|
|
|
9192
9194
|
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}'."),
|
|
9193
9195
|
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}'?"),
|
|
9194
9196
|
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'."),
|
|
9197
|
+
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'."),
|
|
9195
9198
|
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."),
|
|
9196
9199
|
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."),
|
|
9197
9200
|
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}'."),
|
|
@@ -18198,6 +18201,10 @@ var ts;
|
|
|
18198
18201
|
return indentStrings[1].length;
|
|
18199
18202
|
}
|
|
18200
18203
|
ts.getIndentSize = getIndentSize;
|
|
18204
|
+
function isNightly() {
|
|
18205
|
+
return ts.stringContains(ts.version, "-dev") || ts.stringContains(ts.version, "-insiders");
|
|
18206
|
+
}
|
|
18207
|
+
ts.isNightly = isNightly;
|
|
18201
18208
|
function createTextWriter(newLine) {
|
|
18202
18209
|
var output;
|
|
18203
18210
|
var indent;
|
|
@@ -18428,6 +18435,16 @@ var ts;
|
|
|
18428
18435
|
".d.ts" /* Dts */;
|
|
18429
18436
|
}
|
|
18430
18437
|
ts.getDeclarationEmitExtensionForPath = getDeclarationEmitExtensionForPath;
|
|
18438
|
+
/**
|
|
18439
|
+
* This function is an inverse of `getDeclarationEmitExtensionForPath`.
|
|
18440
|
+
*/
|
|
18441
|
+
function getPossibleOriginalInputExtensionForExtension(path) {
|
|
18442
|
+
return ts.fileExtensionIsOneOf(path, [".d.mts" /* Dmts */, ".mjs" /* Mjs */, ".mts" /* Mts */]) ? [".mts" /* Mts */, ".mjs" /* Mjs */] :
|
|
18443
|
+
ts.fileExtensionIsOneOf(path, [".d.cts" /* Dcts */, ".cjs" /* Cjs */, ".cts" /* Cts */]) ? [".cts" /* Cts */, ".cjs" /* Cjs */] :
|
|
18444
|
+
ts.fileExtensionIsOneOf(path, [".json.d.ts"]) ? [".json" /* Json */] :
|
|
18445
|
+
[".tsx" /* Tsx */, ".ts" /* Ts */, ".jsx" /* Jsx */, ".js" /* Js */];
|
|
18446
|
+
}
|
|
18447
|
+
ts.getPossibleOriginalInputExtensionForExtension = getPossibleOriginalInputExtensionForExtension;
|
|
18431
18448
|
function outFile(options) {
|
|
18432
18449
|
return options.outFile || options.out;
|
|
18433
18450
|
}
|
|
@@ -26377,7 +26394,7 @@ var ts;
|
|
|
26377
26394
|
return node;
|
|
26378
26395
|
}
|
|
26379
26396
|
function cloneSourceFileWithChanges(source, statements, isDeclarationFile, referencedFiles, typeReferences, hasNoDefaultLib, libReferences) {
|
|
26380
|
-
var node = baseFactory.createBaseSourceFileNode(305 /* SourceFile */);
|
|
26397
|
+
var node = (source.redirectInfo ? Object.create(source.redirectInfo.redirectTarget) : baseFactory.createBaseSourceFileNode(305 /* SourceFile */));
|
|
26381
26398
|
for (var p in source) {
|
|
26382
26399
|
if (p === "emitNode" || ts.hasProperty(node, p) || !ts.hasProperty(source, p))
|
|
26383
26400
|
continue;
|
|
@@ -31502,7 +31519,7 @@ var ts;
|
|
|
31502
31519
|
initializeState("", content, languageVersion, /*syntaxCursor*/ undefined, 1 /* JS */);
|
|
31503
31520
|
// Prime the scanner.
|
|
31504
31521
|
nextToken();
|
|
31505
|
-
var entityName = parseEntityName(/*allowReservedWords*/ true
|
|
31522
|
+
var entityName = parseEntityName(/*allowReservedWords*/ true);
|
|
31506
31523
|
var isInvalid = token() === 1 /* EndOfFileToken */ && !parseDiagnostics.length;
|
|
31507
31524
|
clearState();
|
|
31508
31525
|
return isInvalid ? entityName : undefined;
|
|
@@ -33035,6 +33052,7 @@ var ts;
|
|
|
33035
33052
|
var startPos = scanner.getStartPos();
|
|
33036
33053
|
var result = parseListElement(kind, parseElement);
|
|
33037
33054
|
if (!result) {
|
|
33055
|
+
parsingContext = saveParsingContext;
|
|
33038
33056
|
return undefined;
|
|
33039
33057
|
}
|
|
33040
33058
|
list.push(result);
|
|
@@ -33102,7 +33120,7 @@ var ts;
|
|
|
33102
33120
|
}
|
|
33103
33121
|
return createMissingList();
|
|
33104
33122
|
}
|
|
33105
|
-
function parseEntityName(allowReservedWords,
|
|
33123
|
+
function parseEntityName(allowReservedWords, diagnosticMessage) {
|
|
33106
33124
|
var pos = getNodePos();
|
|
33107
33125
|
var entity = allowReservedWords ? parseIdentifierName(diagnosticMessage) : parseIdentifier(diagnosticMessage);
|
|
33108
33126
|
var dotPos = getNodePos();
|
|
@@ -33113,7 +33131,7 @@ var ts;
|
|
|
33113
33131
|
break;
|
|
33114
33132
|
}
|
|
33115
33133
|
dotPos = getNodePos();
|
|
33116
|
-
entity = finishNode(factory.createQualifiedName(entity, parseRightSideOfDot(allowReservedWords, allowPrivateIdentifiers)), pos);
|
|
33134
|
+
entity = finishNode(factory.createQualifiedName(entity, parseRightSideOfDot(allowReservedWords, /* allowPrivateIdentifiers */ false)), pos);
|
|
33117
33135
|
}
|
|
33118
33136
|
return entity;
|
|
33119
33137
|
}
|
|
@@ -33246,7 +33264,7 @@ var ts;
|
|
|
33246
33264
|
}
|
|
33247
33265
|
// TYPES
|
|
33248
33266
|
function parseEntityNameOfTypeReference() {
|
|
33249
|
-
return parseEntityName(/*allowReservedWords*/ true,
|
|
33267
|
+
return parseEntityName(/*allowReservedWords*/ true, ts.Diagnostics.Type_expected);
|
|
33250
33268
|
}
|
|
33251
33269
|
function parseTypeArgumentsOfTypeReference() {
|
|
33252
33270
|
if (!scanner.hasPrecedingLineBreak() && reScanLessThanToken() === 29 /* LessThanToken */) {
|
|
@@ -33379,7 +33397,7 @@ var ts;
|
|
|
33379
33397
|
function parseTypeQuery() {
|
|
33380
33398
|
var pos = getNodePos();
|
|
33381
33399
|
parseExpected(112 /* TypeOfKeyword */);
|
|
33382
|
-
var entityName = parseEntityName(/*allowReservedWords*/ true
|
|
33400
|
+
var entityName = parseEntityName(/*allowReservedWords*/ true);
|
|
33383
33401
|
// Make sure we perform ASI to prevent parsing the next line's type arguments as part of an instantiation expression.
|
|
33384
33402
|
var typeArguments = !scanner.hasPrecedingLineBreak() ? tryParseTypeArguments() : undefined;
|
|
33385
33403
|
return finishNode(factory.createTypeQueryNode(entityName, typeArguments), pos);
|
|
@@ -34347,10 +34365,10 @@ var ts;
|
|
|
34347
34365
|
setDecoratorContext(/*val*/ false);
|
|
34348
34366
|
}
|
|
34349
34367
|
var pos = getNodePos();
|
|
34350
|
-
var expr = parseAssignmentExpressionOrHigher(
|
|
34368
|
+
var expr = parseAssignmentExpressionOrHigher();
|
|
34351
34369
|
var operatorToken;
|
|
34352
34370
|
while ((operatorToken = parseOptionalToken(27 /* CommaToken */))) {
|
|
34353
|
-
expr = makeBinaryExpression(expr, operatorToken, parseAssignmentExpressionOrHigher(
|
|
34371
|
+
expr = makeBinaryExpression(expr, operatorToken, parseAssignmentExpressionOrHigher(), pos);
|
|
34354
34372
|
}
|
|
34355
34373
|
if (saveDecoratorContext) {
|
|
34356
34374
|
setDecoratorContext(/*val*/ true);
|
|
@@ -34358,9 +34376,9 @@ var ts;
|
|
|
34358
34376
|
return expr;
|
|
34359
34377
|
}
|
|
34360
34378
|
function parseInitializer() {
|
|
34361
|
-
return parseOptional(63 /* EqualsToken */) ? parseAssignmentExpressionOrHigher(
|
|
34379
|
+
return parseOptional(63 /* EqualsToken */) ? parseAssignmentExpressionOrHigher() : undefined;
|
|
34362
34380
|
}
|
|
34363
|
-
function parseAssignmentExpressionOrHigher(
|
|
34381
|
+
function parseAssignmentExpressionOrHigher() {
|
|
34364
34382
|
// AssignmentExpression[in,yield]:
|
|
34365
34383
|
// 1) ConditionalExpression[?in,?yield]
|
|
34366
34384
|
// 2) LeftHandSideExpression = AssignmentExpression[?in,?yield]
|
|
@@ -34386,7 +34404,7 @@ var ts;
|
|
|
34386
34404
|
// If we do successfully parse arrow-function, we must *not* recurse for productions 1, 2 or 3. An ArrowFunction is
|
|
34387
34405
|
// not a LeftHandSideExpression, nor does it start a ConditionalExpression. So we are done
|
|
34388
34406
|
// with AssignmentExpression if we see one.
|
|
34389
|
-
var arrowExpression = tryParseParenthesizedArrowFunctionExpression(
|
|
34407
|
+
var arrowExpression = tryParseParenthesizedArrowFunctionExpression() || tryParseAsyncSimpleArrowFunctionExpression();
|
|
34390
34408
|
if (arrowExpression) {
|
|
34391
34409
|
return arrowExpression;
|
|
34392
34410
|
}
|
|
@@ -34405,7 +34423,7 @@ var ts;
|
|
|
34405
34423
|
// parameter ('x => ...') above. We handle it here by checking if the parsed expression was a single
|
|
34406
34424
|
// identifier and the current token is an arrow.
|
|
34407
34425
|
if (expr.kind === 79 /* Identifier */ && token() === 38 /* EqualsGreaterThanToken */) {
|
|
34408
|
-
return parseSimpleArrowFunctionExpression(pos, expr,
|
|
34426
|
+
return parseSimpleArrowFunctionExpression(pos, expr, /*asyncModifier*/ undefined);
|
|
34409
34427
|
}
|
|
34410
34428
|
// Now see if we might be in cases '2' or '3'.
|
|
34411
34429
|
// If the expression was a LHS expression, and we have an assignment operator, then
|
|
@@ -34414,7 +34432,7 @@ var ts;
|
|
|
34414
34432
|
// Note: we call reScanGreaterToken so that we get an appropriately merged token
|
|
34415
34433
|
// for cases like `> > =` becoming `>>=`
|
|
34416
34434
|
if (ts.isLeftHandSideExpression(expr) && ts.isAssignmentOperator(reScanGreaterToken())) {
|
|
34417
|
-
return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher(
|
|
34435
|
+
return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher(), pos);
|
|
34418
34436
|
}
|
|
34419
34437
|
// It wasn't an assignment or a lambda. This is a conditional expression:
|
|
34420
34438
|
return parseConditionalExpressionRest(expr, pos);
|
|
@@ -34457,7 +34475,7 @@ var ts;
|
|
|
34457
34475
|
nextToken();
|
|
34458
34476
|
if (!scanner.hasPrecedingLineBreak() &&
|
|
34459
34477
|
(token() === 41 /* AsteriskToken */ || isStartOfExpression())) {
|
|
34460
|
-
return finishNode(factory.createYieldExpression(parseOptionalToken(41 /* AsteriskToken */), parseAssignmentExpressionOrHigher(
|
|
34478
|
+
return finishNode(factory.createYieldExpression(parseOptionalToken(41 /* AsteriskToken */), parseAssignmentExpressionOrHigher()), pos);
|
|
34461
34479
|
}
|
|
34462
34480
|
else {
|
|
34463
34481
|
// if the next token is not on the same line as yield. or we don't have an '*' or
|
|
@@ -34465,7 +34483,7 @@ var ts;
|
|
|
34465
34483
|
return finishNode(factory.createYieldExpression(/*asteriskToken*/ undefined, /*expression*/ undefined), pos);
|
|
34466
34484
|
}
|
|
34467
34485
|
}
|
|
34468
|
-
function parseSimpleArrowFunctionExpression(pos, identifier,
|
|
34486
|
+
function parseSimpleArrowFunctionExpression(pos, identifier, asyncModifier) {
|
|
34469
34487
|
ts.Debug.assert(token() === 38 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>");
|
|
34470
34488
|
var parameter = factory.createParameterDeclaration(
|
|
34471
34489
|
/*decorators*/ undefined,
|
|
@@ -34477,11 +34495,11 @@ var ts;
|
|
|
34477
34495
|
finishNode(parameter, identifier.pos);
|
|
34478
34496
|
var parameters = createNodeArray([parameter], parameter.pos, parameter.end);
|
|
34479
34497
|
var equalsGreaterThanToken = parseExpectedToken(38 /* EqualsGreaterThanToken */);
|
|
34480
|
-
var body = parseArrowFunctionExpressionBody(/*isAsync*/ !!asyncModifier
|
|
34498
|
+
var body = parseArrowFunctionExpressionBody(/*isAsync*/ !!asyncModifier);
|
|
34481
34499
|
var node = factory.createArrowFunction(asyncModifier, /*typeParameters*/ undefined, parameters, /*type*/ undefined, equalsGreaterThanToken, body);
|
|
34482
34500
|
return addJSDocComment(finishNode(node, pos));
|
|
34483
34501
|
}
|
|
34484
|
-
function tryParseParenthesizedArrowFunctionExpression(
|
|
34502
|
+
function tryParseParenthesizedArrowFunctionExpression() {
|
|
34485
34503
|
var triState = isParenthesizedArrowFunctionExpression();
|
|
34486
34504
|
if (triState === 0 /* False */) {
|
|
34487
34505
|
// It's definitely not a parenthesized arrow function expression.
|
|
@@ -34492,8 +34510,8 @@ var ts;
|
|
|
34492
34510
|
// it out, but don't allow any ambiguity, and return 'undefined' if this could be an
|
|
34493
34511
|
// expression instead.
|
|
34494
34512
|
return triState === 1 /* True */ ?
|
|
34495
|
-
parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true
|
|
34496
|
-
tryParse(
|
|
34513
|
+
parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true) :
|
|
34514
|
+
tryParse(parsePossibleParenthesizedArrowFunctionExpression);
|
|
34497
34515
|
}
|
|
34498
34516
|
// True -> We definitely expect a parenthesized arrow function here.
|
|
34499
34517
|
// False -> There *cannot* be a parenthesized arrow function here.
|
|
@@ -34623,25 +34641,25 @@ var ts;
|
|
|
34623
34641
|
return 2 /* Unknown */;
|
|
34624
34642
|
}
|
|
34625
34643
|
}
|
|
34626
|
-
function parsePossibleParenthesizedArrowFunctionExpression(
|
|
34644
|
+
function parsePossibleParenthesizedArrowFunctionExpression() {
|
|
34627
34645
|
var tokenPos = scanner.getTokenPos();
|
|
34628
34646
|
if (notParenthesizedArrow === null || notParenthesizedArrow === void 0 ? void 0 : notParenthesizedArrow.has(tokenPos)) {
|
|
34629
34647
|
return undefined;
|
|
34630
34648
|
}
|
|
34631
|
-
var result = parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ false
|
|
34649
|
+
var result = parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ false);
|
|
34632
34650
|
if (!result) {
|
|
34633
34651
|
(notParenthesizedArrow || (notParenthesizedArrow = new ts.Set())).add(tokenPos);
|
|
34634
34652
|
}
|
|
34635
34653
|
return result;
|
|
34636
34654
|
}
|
|
34637
|
-
function tryParseAsyncSimpleArrowFunctionExpression(
|
|
34655
|
+
function tryParseAsyncSimpleArrowFunctionExpression() {
|
|
34638
34656
|
// We do a check here so that we won't be doing unnecessarily call to "lookAhead"
|
|
34639
34657
|
if (token() === 131 /* AsyncKeyword */) {
|
|
34640
34658
|
if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === 1 /* True */) {
|
|
34641
34659
|
var pos = getNodePos();
|
|
34642
34660
|
var asyncModifier = parseModifiersForArrowFunction();
|
|
34643
34661
|
var expr = parseBinaryExpressionOrHigher(0 /* Lowest */);
|
|
34644
|
-
return parseSimpleArrowFunctionExpression(pos, expr,
|
|
34662
|
+
return parseSimpleArrowFunctionExpression(pos, expr, asyncModifier);
|
|
34645
34663
|
}
|
|
34646
34664
|
}
|
|
34647
34665
|
return undefined;
|
|
@@ -34665,7 +34683,7 @@ var ts;
|
|
|
34665
34683
|
}
|
|
34666
34684
|
return 0 /* False */;
|
|
34667
34685
|
}
|
|
34668
|
-
function parseParenthesizedArrowFunctionExpression(allowAmbiguity
|
|
34686
|
+
function parseParenthesizedArrowFunctionExpression(allowAmbiguity) {
|
|
34669
34687
|
var pos = getNodePos();
|
|
34670
34688
|
var hasJSDoc = hasPrecedingJSDocComment();
|
|
34671
34689
|
var modifiers = parseModifiersForArrowFunction();
|
|
@@ -34700,23 +34718,6 @@ var ts;
|
|
|
34700
34718
|
return undefined;
|
|
34701
34719
|
}
|
|
34702
34720
|
}
|
|
34703
|
-
// Given:
|
|
34704
|
-
// x ? y => ({ y }) : z => ({ z })
|
|
34705
|
-
// We try to parse the body of the first arrow function by looking at:
|
|
34706
|
-
// ({ y }) : z => ({ z })
|
|
34707
|
-
// This is a valid arrow function with "z" as the return type.
|
|
34708
|
-
//
|
|
34709
|
-
// But, if we're in the true side of a conditional expression, this colon
|
|
34710
|
-
// terminates the expression, so we cannot allow a return type if we aren't
|
|
34711
|
-
// certain whether or not the preceding text was parsed as a parameter list.
|
|
34712
|
-
//
|
|
34713
|
-
// For example,
|
|
34714
|
-
// a() ? (b: number, c?: string): void => d() : e
|
|
34715
|
-
// is determined by isParenthesizedArrowFunctionExpression to unambiguously
|
|
34716
|
-
// be an arrow expression, so we allow a return type.
|
|
34717
|
-
if (disallowReturnTypeInArrowFunction && token() === 58 /* ColonToken */) {
|
|
34718
|
-
return undefined;
|
|
34719
|
-
}
|
|
34720
34721
|
var type = parseReturnType(58 /* ColonToken */, /*isType*/ false);
|
|
34721
34722
|
if (type && !allowAmbiguity && typeHasArrowFunctionBlockingParseError(type)) {
|
|
34722
34723
|
return undefined;
|
|
@@ -34745,12 +34746,12 @@ var ts;
|
|
|
34745
34746
|
var lastToken = token();
|
|
34746
34747
|
var equalsGreaterThanToken = parseExpectedToken(38 /* EqualsGreaterThanToken */);
|
|
34747
34748
|
var body = (lastToken === 38 /* EqualsGreaterThanToken */ || lastToken === 18 /* OpenBraceToken */)
|
|
34748
|
-
? parseArrowFunctionExpressionBody(ts.some(modifiers, ts.isAsyncModifier)
|
|
34749
|
+
? parseArrowFunctionExpressionBody(ts.some(modifiers, ts.isAsyncModifier))
|
|
34749
34750
|
: parseIdentifier();
|
|
34750
34751
|
var node = factory.createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body);
|
|
34751
34752
|
return withJSDoc(finishNode(node, pos), hasJSDoc);
|
|
34752
34753
|
}
|
|
34753
|
-
function parseArrowFunctionExpressionBody(isAsync
|
|
34754
|
+
function parseArrowFunctionExpressionBody(isAsync) {
|
|
34754
34755
|
if (token() === 18 /* OpenBraceToken */) {
|
|
34755
34756
|
return parseFunctionBlock(isAsync ? 2 /* Await */ : 0 /* None */);
|
|
34756
34757
|
}
|
|
@@ -34778,8 +34779,8 @@ var ts;
|
|
|
34778
34779
|
var savedTopLevel = topLevel;
|
|
34779
34780
|
topLevel = false;
|
|
34780
34781
|
var node = isAsync
|
|
34781
|
-
? doInAwaitContext(
|
|
34782
|
-
: doOutsideOfAwaitContext(
|
|
34782
|
+
? doInAwaitContext(parseAssignmentExpressionOrHigher)
|
|
34783
|
+
: doOutsideOfAwaitContext(parseAssignmentExpressionOrHigher);
|
|
34783
34784
|
topLevel = savedTopLevel;
|
|
34784
34785
|
return node;
|
|
34785
34786
|
}
|
|
@@ -34792,8 +34793,8 @@ var ts;
|
|
|
34792
34793
|
// Note: we explicitly 'allowIn' in the whenTrue part of the condition expression, and
|
|
34793
34794
|
// we do not that for the 'whenFalse' part.
|
|
34794
34795
|
var colonToken;
|
|
34795
|
-
return finishNode(factory.createConditionalExpression(leftOperand, questionToken, doOutsideOfContext(disallowInAndDecoratorContext,
|
|
34796
|
-
? parseAssignmentExpressionOrHigher(
|
|
34796
|
+
return finishNode(factory.createConditionalExpression(leftOperand, questionToken, doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher), colonToken = parseExpectedToken(58 /* ColonToken */), ts.nodeIsPresent(colonToken)
|
|
34797
|
+
? parseAssignmentExpressionOrHigher()
|
|
34797
34798
|
: createMissingNode(79 /* Identifier */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(58 /* ColonToken */))), pos);
|
|
34798
34799
|
}
|
|
34799
34800
|
function parseBinaryExpressionOrHigher(precedence) {
|
|
@@ -35685,13 +35686,13 @@ var ts;
|
|
|
35685
35686
|
function parseSpreadElement() {
|
|
35686
35687
|
var pos = getNodePos();
|
|
35687
35688
|
parseExpected(25 /* DotDotDotToken */);
|
|
35688
|
-
var expression = parseAssignmentExpressionOrHigher(
|
|
35689
|
+
var expression = parseAssignmentExpressionOrHigher();
|
|
35689
35690
|
return finishNode(factory.createSpreadElement(expression), pos);
|
|
35690
35691
|
}
|
|
35691
35692
|
function parseArgumentOrArrayLiteralElement() {
|
|
35692
35693
|
return token() === 25 /* DotDotDotToken */ ? parseSpreadElement() :
|
|
35693
35694
|
token() === 27 /* CommaToken */ ? finishNode(factory.createOmittedExpression(), getNodePos()) :
|
|
35694
|
-
parseAssignmentExpressionOrHigher(
|
|
35695
|
+
parseAssignmentExpressionOrHigher();
|
|
35695
35696
|
}
|
|
35696
35697
|
function parseArgumentExpression() {
|
|
35697
35698
|
return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement);
|
|
@@ -35709,7 +35710,7 @@ var ts;
|
|
|
35709
35710
|
var pos = getNodePos();
|
|
35710
35711
|
var hasJSDoc = hasPrecedingJSDocComment();
|
|
35711
35712
|
if (parseOptionalToken(25 /* DotDotDotToken */)) {
|
|
35712
|
-
var expression = parseAssignmentExpressionOrHigher(
|
|
35713
|
+
var expression = parseAssignmentExpressionOrHigher();
|
|
35713
35714
|
return withJSDoc(finishNode(factory.createSpreadAssignment(expression), pos), hasJSDoc);
|
|
35714
35715
|
}
|
|
35715
35716
|
var decorators = parseDecorators();
|
|
@@ -35738,7 +35739,7 @@ var ts;
|
|
|
35738
35739
|
var isShorthandPropertyAssignment = tokenIsIdentifier && (token() !== 58 /* ColonToken */);
|
|
35739
35740
|
if (isShorthandPropertyAssignment) {
|
|
35740
35741
|
var equalsToken = parseOptionalToken(63 /* EqualsToken */);
|
|
35741
|
-
var objectAssignmentInitializer = equalsToken ? allowInAnd(
|
|
35742
|
+
var objectAssignmentInitializer = equalsToken ? allowInAnd(parseAssignmentExpressionOrHigher) : undefined;
|
|
35742
35743
|
node = factory.createShorthandPropertyAssignment(name, objectAssignmentInitializer);
|
|
35743
35744
|
// Save equals token for error reporting.
|
|
35744
35745
|
// TODO(rbuckton): Consider manufacturing this when we need to report an error as it is otherwise not useful.
|
|
@@ -35746,7 +35747,7 @@ var ts;
|
|
|
35746
35747
|
}
|
|
35747
35748
|
else {
|
|
35748
35749
|
parseExpected(58 /* ColonToken */);
|
|
35749
|
-
var initializer = allowInAnd(
|
|
35750
|
+
var initializer = allowInAnd(parseAssignmentExpressionOrHigher);
|
|
35750
35751
|
node = factory.createPropertyAssignment(name, initializer);
|
|
35751
35752
|
}
|
|
35752
35753
|
// Decorators, Modifiers, questionToken, and exclamationToken are not supported by property assignments and are reported in the grammar checker
|
|
@@ -35920,7 +35921,7 @@ var ts;
|
|
|
35920
35921
|
}
|
|
35921
35922
|
var node;
|
|
35922
35923
|
if (awaitToken ? parseExpected(160 /* OfKeyword */) : parseOptional(160 /* OfKeyword */)) {
|
|
35923
|
-
var expression = allowInAnd(
|
|
35924
|
+
var expression = allowInAnd(parseAssignmentExpressionOrHigher);
|
|
35924
35925
|
parseExpected(21 /* CloseParenToken */);
|
|
35925
35926
|
node = factory.createForOfStatement(awaitToken, initializer, expression, parseStatement());
|
|
35926
35927
|
}
|
|
@@ -37088,7 +37089,7 @@ var ts;
|
|
|
37088
37089
|
var pos = getNodePos();
|
|
37089
37090
|
var name = ts.tokenIsIdentifierOrKeyword(token()) ? parseIdentifierName() : parseLiteralLikeNode(10 /* StringLiteral */);
|
|
37090
37091
|
parseExpected(58 /* ColonToken */);
|
|
37091
|
-
var value = parseAssignmentExpressionOrHigher(
|
|
37092
|
+
var value = parseAssignmentExpressionOrHigher();
|
|
37092
37093
|
return finishNode(factory.createAssertEntry(name, value), pos);
|
|
37093
37094
|
}
|
|
37094
37095
|
function parseAssertClause(skipAssertKeyword) {
|
|
@@ -37148,7 +37149,7 @@ var ts;
|
|
|
37148
37149
|
function parseModuleReference() {
|
|
37149
37150
|
return isExternalModuleReference()
|
|
37150
37151
|
? parseExternalModuleReference()
|
|
37151
|
-
: parseEntityName(/*allowReservedWords*/ false
|
|
37152
|
+
: parseEntityName(/*allowReservedWords*/ false);
|
|
37152
37153
|
}
|
|
37153
37154
|
function parseExternalModuleReference() {
|
|
37154
37155
|
var pos = getNodePos();
|
|
@@ -37327,7 +37328,7 @@ var ts;
|
|
|
37327
37328
|
else {
|
|
37328
37329
|
parseExpected(88 /* DefaultKeyword */);
|
|
37329
37330
|
}
|
|
37330
|
-
var expression = parseAssignmentExpressionOrHigher(
|
|
37331
|
+
var expression = parseAssignmentExpressionOrHigher();
|
|
37331
37332
|
parseSemicolon();
|
|
37332
37333
|
setAwaitContext(savedAwaitContext);
|
|
37333
37334
|
var node = factory.createExportAssignment(decorators, modifiers, isExportEquals, expression);
|
|
@@ -37401,7 +37402,7 @@ var ts;
|
|
|
37401
37402
|
var pos = getNodePos();
|
|
37402
37403
|
var hasBrace = parseOptional(18 /* OpenBraceToken */);
|
|
37403
37404
|
var p2 = getNodePos();
|
|
37404
|
-
var entityName = parseEntityName(/* allowReservedWords*/ false
|
|
37405
|
+
var entityName = parseEntityName(/* allowReservedWords*/ false);
|
|
37405
37406
|
while (token() === 80 /* PrivateIdentifier */) {
|
|
37406
37407
|
reScanHashToken(); // rescan #id as # id
|
|
37407
37408
|
nextTokenJSDoc(); // then skip the #
|
|
@@ -37844,7 +37845,7 @@ var ts;
|
|
|
37844
37845
|
// parseEntityName logs an error for non-identifier, so create a MissingNode ourselves to avoid the error
|
|
37845
37846
|
var p2 = getNodePos();
|
|
37846
37847
|
var name = ts.tokenIsIdentifierOrKeyword(token())
|
|
37847
|
-
? parseEntityName(/*allowReservedWords*/ true
|
|
37848
|
+
? parseEntityName(/*allowReservedWords*/ true)
|
|
37848
37849
|
: undefined;
|
|
37849
37850
|
if (name) {
|
|
37850
37851
|
while (token() === 80 /* PrivateIdentifier */) {
|
|
@@ -39166,6 +39167,7 @@ var ts;
|
|
|
39166
39167
|
["es2021.intl", "lib.es2021.intl.d.ts"],
|
|
39167
39168
|
["es2022.array", "lib.es2022.array.d.ts"],
|
|
39168
39169
|
["es2022.error", "lib.es2022.error.d.ts"],
|
|
39170
|
+
["es2022.intl", "lib.es2022.intl.d.ts"],
|
|
39169
39171
|
["es2022.object", "lib.es2022.object.d.ts"],
|
|
39170
39172
|
["es2022.string", "lib.es2022.string.d.ts"],
|
|
39171
39173
|
["esnext.array", "lib.es2022.array.d.ts"],
|
|
@@ -42364,7 +42366,7 @@ var ts;
|
|
|
42364
42366
|
ts.Debug.assert(ts.extensionIsTS(resolved.extension));
|
|
42365
42367
|
return { fileName: resolved.path, packageId: resolved.packageId };
|
|
42366
42368
|
}
|
|
42367
|
-
function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, resultFromCache) {
|
|
42369
|
+
function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, diagnostics, resultFromCache) {
|
|
42368
42370
|
var _a;
|
|
42369
42371
|
if (resultFromCache) {
|
|
42370
42372
|
(_a = resultFromCache.failedLookupLocations).push.apply(_a, failedLookupLocations);
|
|
@@ -42372,7 +42374,8 @@ var ts;
|
|
|
42372
42374
|
}
|
|
42373
42375
|
return {
|
|
42374
42376
|
resolvedModule: resolved && { resolvedFileName: resolved.path, originalPath: resolved.originalPath === true ? undefined : resolved.originalPath, extension: resolved.extension, isExternalLibraryImport: isExternalLibraryImport, packageId: resolved.packageId },
|
|
42375
|
-
failedLookupLocations: failedLookupLocations
|
|
42377
|
+
failedLookupLocations: failedLookupLocations,
|
|
42378
|
+
resolutionDiagnostics: diagnostics
|
|
42376
42379
|
};
|
|
42377
42380
|
}
|
|
42378
42381
|
function readPackageJsonField(jsonContent, fieldName, typeOfTag, state) {
|
|
@@ -42573,7 +42576,18 @@ var ts;
|
|
|
42573
42576
|
features |= NodeResolutionFeatures.EsmMode;
|
|
42574
42577
|
}
|
|
42575
42578
|
var conditions = features & NodeResolutionFeatures.Exports ? features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"] : [];
|
|
42576
|
-
var
|
|
42579
|
+
var diagnostics = [];
|
|
42580
|
+
var moduleResolutionState = {
|
|
42581
|
+
compilerOptions: options,
|
|
42582
|
+
host: host,
|
|
42583
|
+
traceEnabled: traceEnabled,
|
|
42584
|
+
failedLookupLocations: failedLookupLocations,
|
|
42585
|
+
packageJsonInfoCache: cache,
|
|
42586
|
+
features: features,
|
|
42587
|
+
conditions: conditions,
|
|
42588
|
+
requestContainingDirectory: containingDirectory,
|
|
42589
|
+
reportDiagnostic: function (diag) { return void diagnostics.push(diag); },
|
|
42590
|
+
};
|
|
42577
42591
|
var resolved = primaryLookup();
|
|
42578
42592
|
var primary = true;
|
|
42579
42593
|
if (!resolved) {
|
|
@@ -42592,7 +42606,7 @@ var ts;
|
|
|
42592
42606
|
isExternalLibraryImport: pathContainsNodeModules(fileName),
|
|
42593
42607
|
};
|
|
42594
42608
|
}
|
|
42595
|
-
result = { resolvedTypeReferenceDirective: resolvedTypeReferenceDirective, failedLookupLocations: failedLookupLocations };
|
|
42609
|
+
result = { resolvedTypeReferenceDirective: resolvedTypeReferenceDirective, failedLookupLocations: failedLookupLocations, resolutionDiagnostics: diagnostics };
|
|
42596
42610
|
perFolderCache === null || perFolderCache === void 0 ? void 0 : perFolderCache.set(typeReferenceDirectiveName, /*mode*/ resolutionMode, result);
|
|
42597
42611
|
if (traceEnabled)
|
|
42598
42612
|
traceResult(result);
|
|
@@ -42675,6 +42689,8 @@ var ts;
|
|
|
42675
42689
|
packageJsonInfoCache: cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(),
|
|
42676
42690
|
conditions: ts.emptyArray,
|
|
42677
42691
|
features: NodeResolutionFeatures.None,
|
|
42692
|
+
requestContainingDirectory: containingDirectory,
|
|
42693
|
+
reportDiagnostic: ts.noop
|
|
42678
42694
|
};
|
|
42679
42695
|
return ts.forEachAncestorDirectory(containingDirectory, function (ancestorDirectory) {
|
|
42680
42696
|
if (ts.getBaseFileName(ancestorDirectory) !== "node_modules") {
|
|
@@ -43326,6 +43342,7 @@ var ts;
|
|
|
43326
43342
|
if (compilerOptions.noDtsResolution) {
|
|
43327
43343
|
conditions.pop();
|
|
43328
43344
|
}
|
|
43345
|
+
var diagnostics = [];
|
|
43329
43346
|
var state = {
|
|
43330
43347
|
compilerOptions: compilerOptions,
|
|
43331
43348
|
host: host,
|
|
@@ -43334,9 +43351,11 @@ var ts;
|
|
|
43334
43351
|
packageJsonInfoCache: cache,
|
|
43335
43352
|
features: features,
|
|
43336
43353
|
conditions: conditions,
|
|
43354
|
+
requestContainingDirectory: containingDirectory,
|
|
43355
|
+
reportDiagnostic: function (diag) { return void diagnostics.push(diag); },
|
|
43337
43356
|
};
|
|
43338
43357
|
var result = ts.forEach(extensions, function (ext) { return tryResolve(ext); });
|
|
43339
|
-
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);
|
|
43358
|
+
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);
|
|
43340
43359
|
function tryResolve(extensions) {
|
|
43341
43360
|
var loader = function (extensions, candidate, onlyRecordFailures, state) { return nodeLoadModuleByRelativeName(extensions, candidate, onlyRecordFailures, state, /*considerPackageJson*/ true); };
|
|
43342
43361
|
var resolved = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loader, state);
|
|
@@ -43509,9 +43528,9 @@ var ts;
|
|
|
43509
43528
|
}
|
|
43510
43529
|
}
|
|
43511
43530
|
function loadJSOrExactTSFileName(extensions, candidate, onlyRecordFailures, state) {
|
|
43512
|
-
if ((extensions === Extensions.TypeScript || extensions === Extensions.DtsOnly) && ts.
|
|
43531
|
+
if ((extensions === Extensions.TypeScript || extensions === Extensions.DtsOnly) && ts.fileExtensionIsOneOf(candidate, ts.supportedTSExtensionsFlat)) {
|
|
43513
43532
|
var result = tryFile(candidate, onlyRecordFailures, state);
|
|
43514
|
-
return result !== undefined ? { path: candidate, ext: ts.
|
|
43533
|
+
return result !== undefined ? { path: candidate, ext: ts.tryExtractTSExtension(candidate) } : undefined;
|
|
43515
43534
|
}
|
|
43516
43535
|
return loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecordFailures, state);
|
|
43517
43536
|
}
|
|
@@ -43634,6 +43653,8 @@ var ts;
|
|
|
43634
43653
|
packageJsonInfoCache: cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(),
|
|
43635
43654
|
conditions: ["node", "require", "types"],
|
|
43636
43655
|
features: features,
|
|
43656
|
+
requestContainingDirectory: packageJsonInfo.packageDirectory,
|
|
43657
|
+
reportDiagnostic: ts.noop
|
|
43637
43658
|
};
|
|
43638
43659
|
var requireResolution = loadNodeModuleFromDirectoryWorker(extensions, packageJsonInfo.packageDirectory,
|
|
43639
43660
|
/*onlyRecordFailures*/ false, requireState, packageJsonInfo.packageJsonContent, packageJsonInfo.versionPaths);
|
|
@@ -43720,6 +43741,8 @@ var ts;
|
|
|
43720
43741
|
packageJsonInfoCache: packageJsonInfoCache,
|
|
43721
43742
|
features: 0,
|
|
43722
43743
|
conditions: [],
|
|
43744
|
+
requestContainingDirectory: undefined,
|
|
43745
|
+
reportDiagnostic: ts.noop
|
|
43723
43746
|
};
|
|
43724
43747
|
var parts = ts.getPathComponents(fileName);
|
|
43725
43748
|
parts.pop();
|
|
@@ -44011,7 +44034,6 @@ var ts;
|
|
|
44011
44034
|
function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports) {
|
|
44012
44035
|
return loadModuleFromTargetImportOrExport;
|
|
44013
44036
|
function loadModuleFromTargetImportOrExport(target, subpath, pattern) {
|
|
44014
|
-
var _a, _b;
|
|
44015
44037
|
if (typeof target === "string") {
|
|
44016
44038
|
if (!pattern && subpath.length > 0 && !ts.endsWith(target, "/")) {
|
|
44017
44039
|
if (state.traceEnabled) {
|
|
@@ -44048,13 +44070,16 @@ var ts;
|
|
|
44048
44070
|
}
|
|
44049
44071
|
return toSearchResult(/*value*/ undefined);
|
|
44050
44072
|
}
|
|
44051
|
-
var finalPath =
|
|
44073
|
+
var finalPath = toAbsolutePath(pattern ? resolvedTarget.replace(/\*/g, subpath) : resolvedTarget + subpath);
|
|
44074
|
+
var inputLink = tryLoadInputFileForPath(finalPath, subpath, ts.combinePaths(scope.packageDirectory, "package.json"), isImports);
|
|
44075
|
+
if (inputLink)
|
|
44076
|
+
return inputLink;
|
|
44052
44077
|
return toSearchResult(withPackageId(scope, loadJSOrExactTSFileName(extensions, finalPath, /*onlyRecordFailures*/ false, state)));
|
|
44053
44078
|
}
|
|
44054
44079
|
else if (typeof target === "object" && target !== null) { // eslint-disable-line no-null/no-null
|
|
44055
44080
|
if (!Array.isArray(target)) {
|
|
44056
|
-
for (var _i = 0,
|
|
44057
|
-
var key =
|
|
44081
|
+
for (var _i = 0, _a = ts.getOwnKeys(target); _i < _a.length; _i++) {
|
|
44082
|
+
var key = _a[_i];
|
|
44058
44083
|
if (key === "default" || state.conditions.indexOf(key) >= 0 || isApplicableVersionedTypesKey(state.conditions, key)) {
|
|
44059
44084
|
var subTarget = target[key];
|
|
44060
44085
|
var result = loadModuleFromTargetImportOrExport(subTarget, subpath, pattern);
|
|
@@ -44072,8 +44097,8 @@ var ts;
|
|
|
44072
44097
|
}
|
|
44073
44098
|
return toSearchResult(/*value*/ undefined);
|
|
44074
44099
|
}
|
|
44075
|
-
for (var
|
|
44076
|
-
var elem = target_2[
|
|
44100
|
+
for (var _b = 0, target_2 = target; _b < target_2.length; _b++) {
|
|
44101
|
+
var elem = target_2[_b];
|
|
44077
44102
|
var result = loadModuleFromTargetImportOrExport(elem, subpath, pattern);
|
|
44078
44103
|
if (result) {
|
|
44079
44104
|
return result;
|
|
@@ -44091,6 +44116,128 @@ var ts;
|
|
|
44091
44116
|
trace(state.host, ts.Diagnostics.package_json_scope_0_has_invalid_type_for_target_of_specifier_1, scope.packageDirectory, moduleName);
|
|
44092
44117
|
}
|
|
44093
44118
|
return toSearchResult(/*value*/ undefined);
|
|
44119
|
+
function toAbsolutePath(path) {
|
|
44120
|
+
var _a, _b;
|
|
44121
|
+
if (path === undefined)
|
|
44122
|
+
return path;
|
|
44123
|
+
return ts.hostGetCanonicalFileName({ useCaseSensitiveFileNames: useCaseSensitiveFileNames })(ts.getNormalizedAbsolutePath(path, (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a)));
|
|
44124
|
+
}
|
|
44125
|
+
function combineDirectoryPath(root, dir) {
|
|
44126
|
+
return ts.ensureTrailingDirectorySeparator(ts.combinePaths(root, dir));
|
|
44127
|
+
}
|
|
44128
|
+
function useCaseSensitiveFileNames() {
|
|
44129
|
+
return !state.host.useCaseSensitiveFileNames ? true :
|
|
44130
|
+
typeof state.host.useCaseSensitiveFileNames === "boolean" ? state.host.useCaseSensitiveFileNames :
|
|
44131
|
+
state.host.useCaseSensitiveFileNames();
|
|
44132
|
+
}
|
|
44133
|
+
function tryLoadInputFileForPath(finalPath, entry, packagePath, isImports) {
|
|
44134
|
+
var _a, _b, _c, _d;
|
|
44135
|
+
// Replace any references to outputs for files in the program with the input files to support package self-names used with outDir
|
|
44136
|
+
// PROBLEM: We don't know how to calculate the output paths yet, because the "common source directory" we use as the base of the file structure
|
|
44137
|
+
// we reproduce into the output directory is based on the set of input files, which we're still in the process of traversing and resolving!
|
|
44138
|
+
// _Given that_, we have to guess what the base of the output directory is (obviously the user wrote the export map, so has some idea what it is!).
|
|
44139
|
+
// We are going to probe _so many_ possible paths. We limit where we'll do this to try to reduce the possibilities of false positive lookups.
|
|
44140
|
+
if ((extensions === Extensions.TypeScript || extensions === Extensions.JavaScript || extensions === Extensions.Json)
|
|
44141
|
+
&& (state.compilerOptions.declarationDir || state.compilerOptions.outDir)
|
|
44142
|
+
&& finalPath.indexOf("/node_modules/") === -1
|
|
44143
|
+
&& (state.compilerOptions.configFile ? ts.startsWith(toAbsolutePath(state.compilerOptions.configFile.fileName), scope.packageDirectory) : true)) {
|
|
44144
|
+
// So that all means we'll only try these guesses for files outside `node_modules` in a directory where the `package.json` and `tsconfig.json` are siblings.
|
|
44145
|
+
// Even with all that, we still don't know if the root of the output file structure will be (relative to the package file)
|
|
44146
|
+
// `.`, `./src` or any other deeper directory structure. (If project references are used, it's definitely `.` by fiat, so that should be pretty common.)
|
|
44147
|
+
var getCanonicalFileName = ts.hostGetCanonicalFileName({ useCaseSensitiveFileNames: useCaseSensitiveFileNames });
|
|
44148
|
+
var commonSourceDirGuesses = [];
|
|
44149
|
+
// A `rootDir` compiler option strongly indicates the root location
|
|
44150
|
+
// A `composite` project is using project references and has it's common src dir set to `.`, so it shouldn't need to check any other locations
|
|
44151
|
+
if (state.compilerOptions.rootDir || (state.compilerOptions.composite && state.compilerOptions.configFilePath)) {
|
|
44152
|
+
var commonDir = toAbsolutePath(ts.getCommonSourceDirectory(state.compilerOptions, function () { return []; }, ((_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a)) || "", getCanonicalFileName));
|
|
44153
|
+
commonSourceDirGuesses.push(commonDir);
|
|
44154
|
+
}
|
|
44155
|
+
else if (state.requestContainingDirectory) {
|
|
44156
|
+
// However without either of those set we're in the dark. Let's say you have
|
|
44157
|
+
//
|
|
44158
|
+
// ./tools/index.ts
|
|
44159
|
+
// ./src/index.ts
|
|
44160
|
+
// ./dist/index.js
|
|
44161
|
+
// ./package.json <-- references ./dist/index.js
|
|
44162
|
+
// ./tsconfig.json <-- loads ./src/index.ts
|
|
44163
|
+
//
|
|
44164
|
+
// How do we know `./src` is the common src dir, and not `./tools`, given only the `./dist` out dir and `./dist/index.js` filename?
|
|
44165
|
+
// Answer: We... don't. We know we're looking for an `index.ts` input file, but we have _no clue_ which subfolder it's supposed to be loaded from
|
|
44166
|
+
// without more context.
|
|
44167
|
+
// But we do have more context! Just a tiny bit more! We're resolving an import _for some other input file_! And that input file, too
|
|
44168
|
+
// must be inside the common source directory! So we propagate that tidbit of info all the way to here via state.requestContainingDirectory
|
|
44169
|
+
var requestingFile_1 = toAbsolutePath(ts.combinePaths(state.requestContainingDirectory, "index.ts"));
|
|
44170
|
+
// And we can try every folder above the common folder for the request folder and the config/package base directory
|
|
44171
|
+
// This technically can be wrong - we may load ./src/index.ts when ./src/sub/index.ts was right because we don't
|
|
44172
|
+
// know if only `./src/sub` files were loaded by the program; but this has the best chance to be right of just about anything
|
|
44173
|
+
// else we have. And, given that we're about to load `./src/index.ts` because we choose it as likely correct, there will then
|
|
44174
|
+
// be a file outside of `./src/sub` in the program (the file we resolved to), making us de-facto right. So this fallback lookup
|
|
44175
|
+
// logic may influence what files are pulled in by self-names, which in turn influences the output path shape, but it's all
|
|
44176
|
+
// internally consistent so the paths should be stable so long as we prefer the "most general" (meaning: top-most-level directory) possible results first.
|
|
44177
|
+
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));
|
|
44178
|
+
commonSourceDirGuesses.push(commonDir);
|
|
44179
|
+
var fragment = ts.ensureTrailingDirectorySeparator(commonDir);
|
|
44180
|
+
while (fragment && fragment.length > 1) {
|
|
44181
|
+
var parts = ts.getPathComponents(fragment);
|
|
44182
|
+
parts.pop(); // remove a directory
|
|
44183
|
+
var commonDir_1 = ts.getPathFromPathComponents(parts);
|
|
44184
|
+
commonSourceDirGuesses.unshift(commonDir_1);
|
|
44185
|
+
fragment = ts.ensureTrailingDirectorySeparator(commonDir_1);
|
|
44186
|
+
}
|
|
44187
|
+
}
|
|
44188
|
+
if (commonSourceDirGuesses.length > 1) {
|
|
44189
|
+
state.reportDiagnostic(ts.createCompilerDiagnostic(isImports
|
|
44190
|
+
? 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
|
|
44191
|
+
: 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, // replace empty string with `.` - the reverse of the operation done when entries are built - so main entrypoint errors don't look weird
|
|
44192
|
+
packagePath));
|
|
44193
|
+
}
|
|
44194
|
+
for (var _i = 0, commonSourceDirGuesses_1 = commonSourceDirGuesses; _i < commonSourceDirGuesses_1.length; _i++) {
|
|
44195
|
+
var commonSourceDirGuess = commonSourceDirGuesses_1[_i];
|
|
44196
|
+
var candidateDirectories = getOutputDirectoriesForBaseDirectory(commonSourceDirGuess);
|
|
44197
|
+
for (var _e = 0, candidateDirectories_1 = candidateDirectories; _e < candidateDirectories_1.length; _e++) {
|
|
44198
|
+
var candidateDir = candidateDirectories_1[_e];
|
|
44199
|
+
if (ts.startsWith(finalPath, candidateDir)) {
|
|
44200
|
+
// The matched export is looking up something in either the out declaration or js dir, now map the written path back into the source dir and source extension
|
|
44201
|
+
var pathFragment = finalPath.slice(candidateDir.length + 1); // +1 to also remove directory seperator
|
|
44202
|
+
var possibleInputBase = ts.combinePaths(commonSourceDirGuess, pathFragment);
|
|
44203
|
+
var jsAndDtsExtensions = [".mjs" /* Mjs */, ".cjs" /* Cjs */, ".js" /* Js */, ".json" /* Json */, ".d.mts" /* Dmts */, ".d.cts" /* Dcts */, ".d.ts" /* Dts */];
|
|
44204
|
+
for (var _f = 0, jsAndDtsExtensions_1 = jsAndDtsExtensions; _f < jsAndDtsExtensions_1.length; _f++) {
|
|
44205
|
+
var ext = jsAndDtsExtensions_1[_f];
|
|
44206
|
+
if (ts.fileExtensionIs(possibleInputBase, ext)) {
|
|
44207
|
+
var inputExts = ts.getPossibleOriginalInputExtensionForExtension(possibleInputBase);
|
|
44208
|
+
for (var _g = 0, inputExts_1 = inputExts; _g < inputExts_1.length; _g++) {
|
|
44209
|
+
var possibleExt = inputExts_1[_g];
|
|
44210
|
+
var possibleInputWithInputExtension = ts.changeAnyExtension(possibleInputBase, possibleExt, ext, !useCaseSensitiveFileNames());
|
|
44211
|
+
if ((extensions === Extensions.TypeScript && ts.hasJSFileExtension(possibleInputWithInputExtension)) ||
|
|
44212
|
+
(extensions === Extensions.JavaScript && ts.hasTSFileExtension(possibleInputWithInputExtension))) {
|
|
44213
|
+
continue;
|
|
44214
|
+
}
|
|
44215
|
+
if (state.host.fileExists(possibleInputWithInputExtension)) {
|
|
44216
|
+
return toSearchResult(withPackageId(scope, loadJSOrExactTSFileName(extensions, possibleInputWithInputExtension, /*onlyRecordFailures*/ false, state)));
|
|
44217
|
+
}
|
|
44218
|
+
}
|
|
44219
|
+
}
|
|
44220
|
+
}
|
|
44221
|
+
}
|
|
44222
|
+
}
|
|
44223
|
+
}
|
|
44224
|
+
}
|
|
44225
|
+
return undefined;
|
|
44226
|
+
function getOutputDirectoriesForBaseDirectory(commonSourceDirGuess) {
|
|
44227
|
+
var _a, _b;
|
|
44228
|
+
// Config file ouput paths are processed to be relative to the host's current directory, while
|
|
44229
|
+
// otherwise the paths are resolved relative to the common source dir the compiler puts together
|
|
44230
|
+
var currentDir = state.compilerOptions.configFile ? ((_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a)) || "" : commonSourceDirGuess;
|
|
44231
|
+
var candidateDirectories = [];
|
|
44232
|
+
if (state.compilerOptions.declarationDir) {
|
|
44233
|
+
candidateDirectories.push(toAbsolutePath(combineDirectoryPath(currentDir, state.compilerOptions.declarationDir)));
|
|
44234
|
+
}
|
|
44235
|
+
if (state.compilerOptions.outDir && state.compilerOptions.outDir !== state.compilerOptions.declarationDir) {
|
|
44236
|
+
candidateDirectories.push(toAbsolutePath(combineDirectoryPath(currentDir, state.compilerOptions.outDir)));
|
|
44237
|
+
}
|
|
44238
|
+
return candidateDirectories;
|
|
44239
|
+
}
|
|
44240
|
+
}
|
|
44094
44241
|
}
|
|
44095
44242
|
}
|
|
44096
44243
|
/* @internal */
|
|
@@ -44281,11 +44428,12 @@ var ts;
|
|
|
44281
44428
|
function classicNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference) {
|
|
44282
44429
|
var traceEnabled = isTraceEnabled(compilerOptions, host);
|
|
44283
44430
|
var failedLookupLocations = [];
|
|
44284
|
-
var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled, failedLookupLocations: failedLookupLocations, packageJsonInfoCache: cache, features: NodeResolutionFeatures.None, conditions: [] };
|
|
44285
44431
|
var containingDirectory = ts.getDirectoryPath(containingFile);
|
|
44432
|
+
var diagnostics = [];
|
|
44433
|
+
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); } };
|
|
44286
44434
|
var resolved = tryResolve(Extensions.TypeScript) || tryResolve(Extensions.JavaScript);
|
|
44287
44435
|
// No originalPath because classic resolution doesn't resolve realPath
|
|
44288
|
-
return createResolvedModuleWithFailedLookupLocations(resolved && resolved.value, /*isExternalLibraryImport*/ false, failedLookupLocations, state.resultFromCache);
|
|
44436
|
+
return createResolvedModuleWithFailedLookupLocations(resolved && resolved.value, /*isExternalLibraryImport*/ false, failedLookupLocations, diagnostics, state.resultFromCache);
|
|
44289
44437
|
function tryResolve(extensions) {
|
|
44290
44438
|
var resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFileNoPackageId, state);
|
|
44291
44439
|
if (resolvedUsingSettings) {
|
|
@@ -44328,9 +44476,10 @@ var ts;
|
|
|
44328
44476
|
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);
|
|
44329
44477
|
}
|
|
44330
44478
|
var failedLookupLocations = [];
|
|
44331
|
-
var
|
|
44479
|
+
var diagnostics = [];
|
|
44480
|
+
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); } };
|
|
44332
44481
|
var resolved = loadModuleFromImmediateNodeModulesDirectory(Extensions.DtsOnly, moduleName, globalCache, state, /*typesScopeOnly*/ false, /*cache*/ undefined, /*redirectedReference*/ undefined);
|
|
44333
|
-
return createResolvedModuleWithFailedLookupLocations(resolved, /*isExternalLibraryImport*/ true, failedLookupLocations, state.resultFromCache);
|
|
44482
|
+
return createResolvedModuleWithFailedLookupLocations(resolved, /*isExternalLibraryImport*/ true, failedLookupLocations, diagnostics, state.resultFromCache);
|
|
44334
44483
|
}
|
|
44335
44484
|
ts.loadModuleFromGlobalCache = loadModuleFromGlobalCache;
|
|
44336
44485
|
/**
|
|
@@ -58194,7 +58343,8 @@ var ts;
|
|
|
58194
58343
|
if (symbol === globalThisSymbol) {
|
|
58195
58344
|
var varsOnly_1 = new ts.Map();
|
|
58196
58345
|
members.forEach(function (p) {
|
|
58197
|
-
|
|
58346
|
+
var _a;
|
|
58347
|
+
if (!(p.flags & 418 /* BlockScoped */) && !(p.flags & 512 /* ValueModule */ && ((_a = p.declarations) === null || _a === void 0 ? void 0 : _a.length) && ts.every(p.declarations, ts.isAmbientModule))) {
|
|
58198
58348
|
varsOnly_1.set(p.escapedName, p);
|
|
58199
58349
|
}
|
|
58200
58350
|
});
|
|
@@ -85045,6 +85195,9 @@ var ts;
|
|
|
85045
85195
|
var validForTypeAssertions = ts.isExclusivelyTypeOnlyImportOrExport(declaration);
|
|
85046
85196
|
var override = ts.getResolutionModeOverrideForClause(declaration.assertClause, validForTypeAssertions ? grammarErrorOnNode : undefined);
|
|
85047
85197
|
if (validForTypeAssertions && override) {
|
|
85198
|
+
if (!ts.isNightly()) {
|
|
85199
|
+
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);
|
|
85200
|
+
}
|
|
85048
85201
|
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
|
|
85049
85202
|
return grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.Resolution_modes_are_only_supported_when_moduleResolution_is_node16_or_nodenext);
|
|
85050
85203
|
}
|
|
@@ -86385,7 +86538,7 @@ var ts;
|
|
|
86385
86538
|
if (ts.isDeclaration(node)) {
|
|
86386
86539
|
// In this case, we call getSymbolOfNode instead of getSymbolAtLocation because it is a declaration
|
|
86387
86540
|
var symbol = getSymbolOfNode(node);
|
|
86388
|
-
return getTypeOfSymbol(symbol);
|
|
86541
|
+
return symbol ? getTypeOfSymbol(symbol) : errorType;
|
|
86389
86542
|
}
|
|
86390
86543
|
if (isDeclarationNameOrImportPropertyName(node)) {
|
|
86391
86544
|
var symbol = getSymbolAtLocation(node);
|
|
@@ -108443,34 +108596,44 @@ var ts;
|
|
|
108443
108596
|
if (!decl.importClause) {
|
|
108444
108597
|
// import "mod" - possibly needed for side effects? (global interface patches, module augmentations, etc)
|
|
108445
108598
|
return factory.updateImportDeclaration(decl,
|
|
108446
|
-
/*decorators*/ undefined, decl.modifiers, decl.importClause, rewriteModuleSpecifier(decl, decl.moduleSpecifier),
|
|
108599
|
+
/*decorators*/ undefined, decl.modifiers, decl.importClause, rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause));
|
|
108447
108600
|
}
|
|
108448
108601
|
// The `importClause` visibility corresponds to the default's visibility.
|
|
108449
108602
|
var visibleDefaultBinding = decl.importClause && decl.importClause.name && resolver.isDeclarationVisible(decl.importClause) ? decl.importClause.name : undefined;
|
|
108450
108603
|
if (!decl.importClause.namedBindings) {
|
|
108451
108604
|
// No named bindings (either namespace or list), meaning the import is just default or should be elided
|
|
108452
108605
|
return visibleDefaultBinding && factory.updateImportDeclaration(decl, /*decorators*/ undefined, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding,
|
|
108453
|
-
/*namedBindings*/ undefined), rewriteModuleSpecifier(decl, decl.moduleSpecifier),
|
|
108606
|
+
/*namedBindings*/ undefined), rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause));
|
|
108454
108607
|
}
|
|
108455
108608
|
if (decl.importClause.namedBindings.kind === 268 /* NamespaceImport */) {
|
|
108456
108609
|
// Namespace import (optionally with visible default)
|
|
108457
108610
|
var namedBindings = resolver.isDeclarationVisible(decl.importClause.namedBindings) ? decl.importClause.namedBindings : /*namedBindings*/ undefined;
|
|
108458
|
-
return visibleDefaultBinding || namedBindings ? factory.updateImportDeclaration(decl, /*decorators*/ undefined, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, namedBindings), rewriteModuleSpecifier(decl, decl.moduleSpecifier),
|
|
108611
|
+
return visibleDefaultBinding || namedBindings ? factory.updateImportDeclaration(decl, /*decorators*/ undefined, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, namedBindings), rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause)) : undefined;
|
|
108459
108612
|
}
|
|
108460
108613
|
// Named imports (optionally with visible default)
|
|
108461
108614
|
var bindingList = ts.mapDefined(decl.importClause.namedBindings.elements, function (b) { return resolver.isDeclarationVisible(b) ? b : undefined; });
|
|
108462
108615
|
if ((bindingList && bindingList.length) || visibleDefaultBinding) {
|
|
108463
108616
|
return factory.updateImportDeclaration(decl,
|
|
108464
|
-
/*decorators*/ 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),
|
|
108617
|
+
/*decorators*/ 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));
|
|
108465
108618
|
}
|
|
108466
108619
|
// Augmentation of export depends on import
|
|
108467
108620
|
if (resolver.isImportRequiredByAugmentation(decl)) {
|
|
108468
108621
|
return factory.updateImportDeclaration(decl,
|
|
108469
108622
|
/*decorators*/ undefined, decl.modifiers,
|
|
108470
|
-
/*importClause*/ undefined, rewriteModuleSpecifier(decl, decl.moduleSpecifier),
|
|
108623
|
+
/*importClause*/ undefined, rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause));
|
|
108471
108624
|
}
|
|
108472
108625
|
// Nothing visible
|
|
108473
108626
|
}
|
|
108627
|
+
function getResolutionModeOverrideForClauseInNightly(assertClause) {
|
|
108628
|
+
var mode = ts.getResolutionModeOverrideForClause(assertClause);
|
|
108629
|
+
if (mode !== undefined) {
|
|
108630
|
+
if (!ts.isNightly()) {
|
|
108631
|
+
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));
|
|
108632
|
+
}
|
|
108633
|
+
return assertClause;
|
|
108634
|
+
}
|
|
108635
|
+
return undefined;
|
|
108636
|
+
}
|
|
108474
108637
|
function transformAndReplaceLatePaintedStatements(statements) {
|
|
108475
108638
|
// This is a `while` loop because `handleSymbolAccessibilityError` can see additional import aliases marked as visible during
|
|
108476
108639
|
// error handling which must now be included in the output and themselves checked for errors.
|
|
@@ -116299,7 +116462,6 @@ var ts;
|
|
|
116299
116462
|
ts.Diagnostics.A_rest_parameter_cannot_have_an_initializer.code,
|
|
116300
116463
|
ts.Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list.code,
|
|
116301
116464
|
ts.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma.code,
|
|
116302
|
-
ts.Diagnostics.A_return_statement_can_only_be_used_within_a_function_body.code,
|
|
116303
116465
|
ts.Diagnostics.A_return_statement_cannot_be_used_inside_a_class_static_block.code,
|
|
116304
116466
|
ts.Diagnostics.A_set_accessor_cannot_have_rest_parameter.code,
|
|
116305
116467
|
ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter.code,
|
|
@@ -116686,6 +116848,40 @@ var ts;
|
|
|
116686
116848
|
ts.performance.measure("Program", "beforeProgram", "afterProgram");
|
|
116687
116849
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
116688
116850
|
return program;
|
|
116851
|
+
function addResolutionDiagnostics(list) {
|
|
116852
|
+
if (!list)
|
|
116853
|
+
return;
|
|
116854
|
+
for (var _i = 0, list_3 = list; _i < list_3.length; _i++) {
|
|
116855
|
+
var elem = list_3[_i];
|
|
116856
|
+
programDiagnostics.add(elem);
|
|
116857
|
+
}
|
|
116858
|
+
}
|
|
116859
|
+
function pullDiagnosticsFromCache(names, containingFile) {
|
|
116860
|
+
var _a;
|
|
116861
|
+
if (!moduleResolutionCache)
|
|
116862
|
+
return;
|
|
116863
|
+
var containingFileName = ts.getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory);
|
|
116864
|
+
var containingFileMode = !ts.isString(containingFile) ? containingFile.impliedNodeFormat : undefined;
|
|
116865
|
+
var containingDir = ts.getDirectoryPath(containingFileName);
|
|
116866
|
+
var redirectedReference = getRedirectReferenceForResolution(containingFile);
|
|
116867
|
+
var i = 0;
|
|
116868
|
+
for (var _i = 0, names_4 = names; _i < names_4.length; _i++) {
|
|
116869
|
+
var n = names_4[_i];
|
|
116870
|
+
// mimics logic done in the resolution cache, should be resilient to upgrading it to use `FileReference`s for non-type-reference modal lookups to make it rely on the index in the list less
|
|
116871
|
+
var mode = typeof n === "string" ? getModeForResolutionAtIndex(containingFile, i) : getModeForFileReference(n, containingFileMode);
|
|
116872
|
+
var name = typeof n === "string" ? n : n.fileName;
|
|
116873
|
+
i++;
|
|
116874
|
+
// only nonrelative names hit the cache, and, at least as of right now, only nonrelative names can issue diagnostics
|
|
116875
|
+
// (Since diagnostics are only issued via import or export map lookup)
|
|
116876
|
+
// This may totally change if/when the issue of output paths not mapping to input files is fixed in a broader context
|
|
116877
|
+
// When it is, how we extract diagnostics from the module name resolver will have the be refined - the current cache
|
|
116878
|
+
// APIs wrapping the underlying resolver make it almost impossible to smuggle the diagnostics out in a generalized way
|
|
116879
|
+
if (ts.isExternalModuleNameRelative(name))
|
|
116880
|
+
continue;
|
|
116881
|
+
var diags = (_a = moduleResolutionCache.getOrCreateCacheForModuleName(name, mode, redirectedReference).get(containingDir)) === null || _a === void 0 ? void 0 : _a.resolutionDiagnostics;
|
|
116882
|
+
addResolutionDiagnostics(diags);
|
|
116883
|
+
}
|
|
116884
|
+
}
|
|
116689
116885
|
function resolveModuleNamesWorker(moduleNames, containingFile, reusedNames) {
|
|
116690
116886
|
if (!moduleNames.length)
|
|
116691
116887
|
return ts.emptyArray;
|
|
@@ -116697,6 +116893,7 @@ var ts;
|
|
|
116697
116893
|
ts.performance.mark("afterResolveModule");
|
|
116698
116894
|
ts.performance.measure("ResolveModule", "beforeResolveModule", "afterResolveModule");
|
|
116699
116895
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
116896
|
+
pullDiagnosticsFromCache(moduleNames, containingFile);
|
|
116700
116897
|
return result;
|
|
116701
116898
|
}
|
|
116702
116899
|
function resolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFile) {
|
|
@@ -121133,8 +121330,8 @@ var ts;
|
|
|
121133
121330
|
!!redirectedReference;
|
|
121134
121331
|
var seenNamesInFile = ts.createModeAwareCache();
|
|
121135
121332
|
var i = 0;
|
|
121136
|
-
for (var _i = 0,
|
|
121137
|
-
var entry =
|
|
121333
|
+
for (var _i = 0, names_5 = names; _i < names_5.length; _i++) {
|
|
121334
|
+
var entry = names_5[_i];
|
|
121138
121335
|
var name = ts.isString(entry) ? entry : entry.fileName.toLowerCase();
|
|
121139
121336
|
// Imports supply a `containingSourceFile` but no `containingSourceFileMode` - it would be redundant
|
|
121140
121337
|
// they require calculating the mode for a given import from it's position in the resolution table, since a given
|
|
@@ -121744,14 +121941,14 @@ var ts;
|
|
|
121744
121941
|
if (options === void 0) { options = {}; }
|
|
121745
121942
|
var info = getInfo(importingSourceFile.path, host);
|
|
121746
121943
|
var modulePaths = getAllModulePaths(importingSourceFile.path, nodeModulesFileName, host, preferences, options);
|
|
121747
|
-
return ts.firstDefined(modulePaths, function (modulePath) { return tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, /*packageNameOnly*/ true, options.overrideImportMode); });
|
|
121944
|
+
return ts.firstDefined(modulePaths, function (modulePath) { return tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, preferences, /*packageNameOnly*/ true, options.overrideImportMode); });
|
|
121748
121945
|
}
|
|
121749
121946
|
moduleSpecifiers_1.getNodeModulesPackageName = getNodeModulesPackageName;
|
|
121750
121947
|
function getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName, host, preferences, userPreferences, options) {
|
|
121751
121948
|
if (options === void 0) { options = {}; }
|
|
121752
121949
|
var info = getInfo(importingSourceFileName, host);
|
|
121753
121950
|
var modulePaths = getAllModulePaths(importingSourceFileName, toFileName, host, userPreferences, options);
|
|
121754
|
-
return ts.firstDefined(modulePaths, function (modulePath) { return tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, /*packageNameOnly*/ undefined, options.overrideImportMode); }) ||
|
|
121951
|
+
return ts.firstDefined(modulePaths, function (modulePath) { return tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, userPreferences, /*packageNameOnly*/ undefined, options.overrideImportMode); }) ||
|
|
121755
121952
|
getLocalModuleSpecifier(toFileName, info, compilerOptions, host, preferences);
|
|
121756
121953
|
}
|
|
121757
121954
|
function tryGetModuleSpecifiersFromCache(moduleSymbol, importingSourceFile, host, userPreferences, options) {
|
|
@@ -121827,7 +122024,7 @@ var ts;
|
|
|
121827
122024
|
var relativeSpecifiers;
|
|
121828
122025
|
for (var _i = 0, modulePaths_1 = modulePaths; _i < modulePaths_1.length; _i++) {
|
|
121829
122026
|
var modulePath = modulePaths_1[_i];
|
|
121830
|
-
var specifier = tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, /*packageNameOnly*/ undefined, options.overrideImportMode);
|
|
122027
|
+
var specifier = tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, userPreferences, /*packageNameOnly*/ undefined, options.overrideImportMode);
|
|
121831
122028
|
nodeModulesSpecifiers = ts.append(nodeModulesSpecifiers, specifier);
|
|
121832
122029
|
if (specifier && modulePath.isRedirect) {
|
|
121833
122030
|
// If we got a specifier for a redirect, it was a bare package specifier (e.g. "@foo/bar",
|
|
@@ -122220,7 +122417,7 @@ var ts;
|
|
|
122220
122417
|
? removeExtensionAndIndexPostFix(relativePath, ending, compilerOptions)
|
|
122221
122418
|
: ts.removeFileExtension(relativePath);
|
|
122222
122419
|
}
|
|
122223
|
-
function tryGetModuleNameAsNodeModule(_a, _b, importingSourceFile, host, options, packageNameOnly, overrideMode) {
|
|
122420
|
+
function tryGetModuleNameAsNodeModule(_a, _b, importingSourceFile, host, options, userPreferences, packageNameOnly, overrideMode) {
|
|
122224
122421
|
var path = _a.path, isRedirect = _a.isRedirect;
|
|
122225
122422
|
var getCanonicalFileName = _b.getCanonicalFileName, sourceDirectory = _b.sourceDirectory;
|
|
122226
122423
|
if (!host.fileExists || !host.readFile) {
|
|
@@ -122234,8 +122431,9 @@ var ts;
|
|
|
122234
122431
|
var moduleSpecifier = path;
|
|
122235
122432
|
var isPackageRootPath = false;
|
|
122236
122433
|
if (!packageNameOnly) {
|
|
122434
|
+
var preferences = getPreferences(host, userPreferences, options, importingSourceFile);
|
|
122237
122435
|
var packageRootIndex = parts.packageRootIndex;
|
|
122238
|
-
var
|
|
122436
|
+
var moduleFileName = void 0;
|
|
122239
122437
|
while (true) {
|
|
122240
122438
|
// If the module could be imported by a directory name, use that directory's name
|
|
122241
122439
|
var _c = tryDirectoryWithPackageJson(packageRootIndex), moduleFileToTry = _c.moduleFileToTry, packageRootPath = _c.packageRootPath, blockedByExports = _c.blockedByExports, verbatimFromExports = _c.verbatimFromExports;
|
|
@@ -122252,12 +122450,12 @@ var ts;
|
|
|
122252
122450
|
isPackageRootPath = true;
|
|
122253
122451
|
break;
|
|
122254
122452
|
}
|
|
122255
|
-
if (!
|
|
122256
|
-
|
|
122453
|
+
if (!moduleFileName)
|
|
122454
|
+
moduleFileName = moduleFileToTry;
|
|
122257
122455
|
// try with next level of directory
|
|
122258
122456
|
packageRootIndex = path.indexOf(ts.directorySeparator, packageRootIndex + 1);
|
|
122259
122457
|
if (packageRootIndex === -1) {
|
|
122260
|
-
moduleSpecifier =
|
|
122458
|
+
moduleSpecifier = removeExtensionAndIndexPostFix(moduleFileName, preferences.ending, options, host);
|
|
122261
122459
|
break;
|
|
122262
122460
|
}
|
|
122263
122461
|
}
|
|
@@ -122315,7 +122513,7 @@ var ts;
|
|
|
122315
122513
|
}
|
|
122316
122514
|
}
|
|
122317
122515
|
// If the file is the main module, it can be imported by the package name
|
|
122318
|
-
var mainFileRelative = packageJsonContent.typings || packageJsonContent.types || packageJsonContent.main;
|
|
122516
|
+
var mainFileRelative = packageJsonContent.typings || packageJsonContent.types || packageJsonContent.main || "index.js";
|
|
122319
122517
|
if (ts.isString(mainFileRelative)) {
|
|
122320
122518
|
var mainExportFile = ts.toPath(mainFileRelative, packageRootPath, getCanonicalFileName);
|
|
122321
122519
|
if (ts.removeFileExtension(mainExportFile) === ts.removeFileExtension(getCanonicalFileName(moduleFileToTry))) {
|
|
@@ -122323,17 +122521,14 @@ var ts;
|
|
|
122323
122521
|
}
|
|
122324
122522
|
}
|
|
122325
122523
|
}
|
|
122326
|
-
|
|
122327
|
-
|
|
122328
|
-
|
|
122329
|
-
|
|
122330
|
-
|
|
122331
|
-
|
|
122332
|
-
// IFF there is not _also_ a file by the same name
|
|
122333
|
-
if (getCanonicalFileName(fullModulePathWithoutExtension.substring(parts.fileNameIndex)) === "/index" && !tryGetAnyFileFromPath(host, fullModulePathWithoutExtension.substring(0, parts.fileNameIndex))) {
|
|
122334
|
-
return fullModulePathWithoutExtension.substring(0, parts.fileNameIndex);
|
|
122524
|
+
else {
|
|
122525
|
+
// No package.json exists; an index.js will still resolve as the package name
|
|
122526
|
+
var fileName = getCanonicalFileName(moduleFileToTry.substring(parts.packageRootIndex + 1));
|
|
122527
|
+
if (fileName === "index.d.ts" || fileName === "index.js" || fileName === "index.ts" || fileName === "index.tsx") {
|
|
122528
|
+
return { moduleFileToTry: moduleFileToTry, packageRootPath: packageRootPath };
|
|
122529
|
+
}
|
|
122335
122530
|
}
|
|
122336
|
-
return
|
|
122531
|
+
return { moduleFileToTry: moduleFileToTry };
|
|
122337
122532
|
}
|
|
122338
122533
|
}
|
|
122339
122534
|
function tryGetAnyFileFromPath(host, path) {
|
|
@@ -122355,7 +122550,7 @@ var ts;
|
|
|
122355
122550
|
return relativePath !== undefined && isPathRelativeToParent(relativePath) ? undefined : relativePath;
|
|
122356
122551
|
});
|
|
122357
122552
|
}
|
|
122358
|
-
function removeExtensionAndIndexPostFix(fileName, ending, options) {
|
|
122553
|
+
function removeExtensionAndIndexPostFix(fileName, ending, options, host) {
|
|
122359
122554
|
if (ts.fileExtensionIsOneOf(fileName, [".json" /* Json */, ".mjs" /* Mjs */, ".cjs" /* Cjs */]))
|
|
122360
122555
|
return fileName;
|
|
122361
122556
|
var noExtension = ts.removeFileExtension(fileName);
|
|
@@ -122363,7 +122558,13 @@ var ts;
|
|
|
122363
122558
|
return noExtension + getJSExtensionForFile(fileName, options);
|
|
122364
122559
|
switch (ending) {
|
|
122365
122560
|
case 0 /* Minimal */:
|
|
122366
|
-
|
|
122561
|
+
var withoutIndex = ts.removeSuffix(noExtension, "/index");
|
|
122562
|
+
if (host && withoutIndex !== noExtension && tryGetAnyFileFromPath(host, withoutIndex)) {
|
|
122563
|
+
// Can't remove index if there's a file by the same name as the directory.
|
|
122564
|
+
// Probably more callers should pass `host` so we can determine this?
|
|
122565
|
+
return noExtension;
|
|
122566
|
+
}
|
|
122567
|
+
return withoutIndex;
|
|
122367
122568
|
case 1 /* Index */:
|
|
122368
122569
|
return noExtension;
|
|
122369
122570
|
case 2 /* JsExtension */:
|
|
@@ -129586,23 +129787,30 @@ var ts;
|
|
|
129586
129787
|
(_d = host.log) === null || _d === void 0 ? void 0 : _d.call(host, "getExportInfoMap: cache miss or empty; calculating new results");
|
|
129587
129788
|
var compilerOptions = program.getCompilerOptions();
|
|
129588
129789
|
var moduleCount = 0;
|
|
129589
|
-
|
|
129590
|
-
|
|
129591
|
-
|
|
129592
|
-
|
|
129593
|
-
|
|
129594
|
-
|
|
129595
|
-
|
|
129596
|
-
|
|
129597
|
-
|
|
129598
|
-
|
|
129599
|
-
|
|
129600
|
-
checker.forEachExportAndPropertyOfModule(moduleSymbol, function (exported, key) {
|
|
129601
|
-
if (exported !== (defaultInfo === null || defaultInfo === void 0 ? void 0 : defaultInfo.symbol) && isImportableSymbol(exported, checker) && ts.addToSeen(seenExports, key)) {
|
|
129602
|
-
cache.add(importingFile.path, exported, key, moduleSymbol, moduleFile, 0 /* Named */, isFromPackageJson, checker);
|
|
129790
|
+
try {
|
|
129791
|
+
forEachExternalModuleToImportFrom(program, host, /*useAutoImportProvider*/ true, function (moduleSymbol, moduleFile, program, isFromPackageJson) {
|
|
129792
|
+
if (++moduleCount % 100 === 0)
|
|
129793
|
+
cancellationToken === null || cancellationToken === void 0 ? void 0 : cancellationToken.throwIfCancellationRequested();
|
|
129794
|
+
var seenExports = new ts.Map();
|
|
129795
|
+
var checker = program.getTypeChecker();
|
|
129796
|
+
var defaultInfo = getDefaultLikeExportInfo(moduleSymbol, checker, compilerOptions);
|
|
129797
|
+
// Note: I think we shouldn't actually see resolved module symbols here, but weird merges
|
|
129798
|
+
// can cause it to happen: see 'completionsImport_mergedReExport.ts'
|
|
129799
|
+
if (defaultInfo && isImportableSymbol(defaultInfo.symbol, checker)) {
|
|
129800
|
+
cache.add(importingFile.path, defaultInfo.symbol, defaultInfo.exportKind === 1 /* Default */ ? "default" /* Default */ : "export=" /* ExportEquals */, moduleSymbol, moduleFile, defaultInfo.exportKind, isFromPackageJson, checker);
|
|
129603
129801
|
}
|
|
129802
|
+
checker.forEachExportAndPropertyOfModule(moduleSymbol, function (exported, key) {
|
|
129803
|
+
if (exported !== (defaultInfo === null || defaultInfo === void 0 ? void 0 : defaultInfo.symbol) && isImportableSymbol(exported, checker) && ts.addToSeen(seenExports, key)) {
|
|
129804
|
+
cache.add(importingFile.path, exported, key, moduleSymbol, moduleFile, 0 /* Named */, isFromPackageJson, checker);
|
|
129805
|
+
}
|
|
129806
|
+
});
|
|
129604
129807
|
});
|
|
129605
|
-
}
|
|
129808
|
+
}
|
|
129809
|
+
catch (err) {
|
|
129810
|
+
// Ensure cache is reset if operation is cancelled
|
|
129811
|
+
cache.clear();
|
|
129812
|
+
throw err;
|
|
129813
|
+
}
|
|
129606
129814
|
(_e = host.log) === null || _e === void 0 ? void 0 : _e.call(host, "getExportInfoMap: done in " + (ts.timestamp() - start) + " ms");
|
|
129607
129815
|
return cache;
|
|
129608
129816
|
}
|
|
@@ -131791,7 +131999,7 @@ var ts;
|
|
|
131791
131999
|
KeywordCompletionFilters[KeywordCompletionFilters["TypeAssertionKeywords"] = 6] = "TypeAssertionKeywords";
|
|
131792
132000
|
KeywordCompletionFilters[KeywordCompletionFilters["TypeKeywords"] = 7] = "TypeKeywords";
|
|
131793
132001
|
KeywordCompletionFilters[KeywordCompletionFilters["TypeKeyword"] = 8] = "TypeKeyword";
|
|
131794
|
-
KeywordCompletionFilters[KeywordCompletionFilters["Last"] =
|
|
132002
|
+
KeywordCompletionFilters[KeywordCompletionFilters["Last"] = 8] = "Last";
|
|
131795
132003
|
})(KeywordCompletionFilters || (KeywordCompletionFilters = {}));
|
|
131796
132004
|
var GlobalsSearch;
|
|
131797
132005
|
(function (GlobalsSearch) {
|
|
@@ -132041,7 +132249,7 @@ var ts;
|
|
|
132041
132249
|
var entryNames_1 = new ts.Set(entries.map(function (e) { return e.name; }));
|
|
132042
132250
|
for (var _i = 0, _a = getKeywordCompletions(keywordFilters, !insideJsDocTagTypeExpression && ts.isSourceFileJS(sourceFile)); _i < _a.length; _i++) {
|
|
132043
132251
|
var keywordEntry = _a[_i];
|
|
132044
|
-
if (!entryNames_1.has(keywordEntry.name)) {
|
|
132252
|
+
if (isTypeOnlyLocation && ts.isTypeKeyword(ts.stringToToken(keywordEntry.name)) || !entryNames_1.has(keywordEntry.name)) {
|
|
132045
132253
|
ts.insertSorted(entries, keywordEntry, compareCompletionEntries, /*allowDuplicates*/ true);
|
|
132046
132254
|
}
|
|
132047
132255
|
}
|
|
@@ -134760,7 +134968,7 @@ var ts;
|
|
|
134760
134968
|
function getKeywordCompletions(keywordFilter, filterOutTsOnlyKeywords) {
|
|
134761
134969
|
if (!filterOutTsOnlyKeywords)
|
|
134762
134970
|
return getTypescriptKeywordCompletions(keywordFilter);
|
|
134763
|
-
var index = keywordFilter +
|
|
134971
|
+
var index = keywordFilter + 8 /* Last */ + 1;
|
|
134764
134972
|
return _keywordCompletions[index] ||
|
|
134765
134973
|
(_keywordCompletions[index] = getTypescriptKeywordCompletions(keywordFilter)
|
|
134766
134974
|
.filter(function (entry) { return !isTypeScriptOnlyKeyword(ts.stringToToken(entry.name)); }));
|
|
@@ -147185,6 +147393,9 @@ var ts;
|
|
|
147185
147393
|
consumeTokenAndAdvanceScanner(tokenInfo, node, nodeDynamicIndentation, node);
|
|
147186
147394
|
}
|
|
147187
147395
|
function processChildNode(child, inheritedIndentation, parent, parentDynamicIndentation, parentStartLine, undecoratedParentStartLine, isListItem, isFirstListItem) {
|
|
147396
|
+
if (ts.nodeIsMissing(child)) {
|
|
147397
|
+
return inheritedIndentation;
|
|
147398
|
+
}
|
|
147188
147399
|
var childStartPos = child.getStart(sourceFile);
|
|
147189
147400
|
var childStartLine = sourceFile.getLineAndCharacterOfPosition(childStartPos).line;
|
|
147190
147401
|
var undecoratedChildStartLine = childStartLine;
|