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/tsserver.js
CHANGED
|
@@ -96,11 +96,11 @@ var ts;
|
|
|
96
96
|
(function (ts) {
|
|
97
97
|
// WARNING: The script `configurePrerelease.ts` uses a regexp to parse out these values.
|
|
98
98
|
// If changing the text in this section, be sure to test `configurePrerelease` too.
|
|
99
|
-
ts.versionMajorMinor = "4.
|
|
99
|
+
ts.versionMajorMinor = "4.8";
|
|
100
100
|
// The following is baselined as a literal template type without intervention
|
|
101
101
|
/** The version of the TypeScript compiler release */
|
|
102
102
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
103
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
103
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220507";
|
|
104
104
|
/* @internal */
|
|
105
105
|
var Comparison;
|
|
106
106
|
(function (Comparison) {
|
|
@@ -8409,6 +8409,8 @@ var ts;
|
|
|
8409
8409
|
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),
|
|
8410
8410
|
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."),
|
|
8411
8411
|
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."),
|
|
8412
|
+
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."),
|
|
8413
|
+
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."),
|
|
8412
8414
|
Duplicate_identifier_0: diag(2300, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_2300", "Duplicate identifier '{0}'."),
|
|
8413
8415
|
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."),
|
|
8414
8416
|
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."),
|
|
@@ -8998,6 +9000,7 @@ var ts;
|
|
|
8998
9000
|
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}'."),
|
|
8999
9001
|
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}'?"),
|
|
9000
9002
|
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'."),
|
|
9003
|
+
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'."),
|
|
9001
9004
|
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."),
|
|
9002
9005
|
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."),
|
|
9003
9006
|
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}'."),
|
|
@@ -18004,6 +18007,10 @@ var ts;
|
|
|
18004
18007
|
return indentStrings[1].length;
|
|
18005
18008
|
}
|
|
18006
18009
|
ts.getIndentSize = getIndentSize;
|
|
18010
|
+
function isNightly() {
|
|
18011
|
+
return ts.stringContains(ts.version, "-dev") || ts.stringContains(ts.version, "-insiders");
|
|
18012
|
+
}
|
|
18013
|
+
ts.isNightly = isNightly;
|
|
18007
18014
|
function createTextWriter(newLine) {
|
|
18008
18015
|
var output;
|
|
18009
18016
|
var indent;
|
|
@@ -18234,6 +18241,16 @@ var ts;
|
|
|
18234
18241
|
".d.ts" /* Dts */;
|
|
18235
18242
|
}
|
|
18236
18243
|
ts.getDeclarationEmitExtensionForPath = getDeclarationEmitExtensionForPath;
|
|
18244
|
+
/**
|
|
18245
|
+
* This function is an inverse of `getDeclarationEmitExtensionForPath`.
|
|
18246
|
+
*/
|
|
18247
|
+
function getPossibleOriginalInputExtensionForExtension(path) {
|
|
18248
|
+
return ts.fileExtensionIsOneOf(path, [".d.mts" /* Dmts */, ".mjs" /* Mjs */, ".mts" /* Mts */]) ? [".mts" /* Mts */, ".mjs" /* Mjs */] :
|
|
18249
|
+
ts.fileExtensionIsOneOf(path, [".d.cts" /* Dcts */, ".cjs" /* Cjs */, ".cts" /* Cts */]) ? [".cts" /* Cts */, ".cjs" /* Cjs */] :
|
|
18250
|
+
ts.fileExtensionIsOneOf(path, [".json.d.ts"]) ? [".json" /* Json */] :
|
|
18251
|
+
[".tsx" /* Tsx */, ".ts" /* Ts */, ".jsx" /* Jsx */, ".js" /* Js */];
|
|
18252
|
+
}
|
|
18253
|
+
ts.getPossibleOriginalInputExtensionForExtension = getPossibleOriginalInputExtensionForExtension;
|
|
18237
18254
|
function outFile(options) {
|
|
18238
18255
|
return options.outFile || options.out;
|
|
18239
18256
|
}
|
|
@@ -26183,7 +26200,7 @@ var ts;
|
|
|
26183
26200
|
return node;
|
|
26184
26201
|
}
|
|
26185
26202
|
function cloneSourceFileWithChanges(source, statements, isDeclarationFile, referencedFiles, typeReferences, hasNoDefaultLib, libReferences) {
|
|
26186
|
-
var node = baseFactory.createBaseSourceFileNode(305 /* SourceFile */);
|
|
26203
|
+
var node = (source.redirectInfo ? Object.create(source.redirectInfo.redirectTarget) : baseFactory.createBaseSourceFileNode(305 /* SourceFile */));
|
|
26187
26204
|
for (var p in source) {
|
|
26188
26205
|
if (p === "emitNode" || ts.hasProperty(node, p) || !ts.hasProperty(source, p))
|
|
26189
26206
|
continue;
|
|
@@ -31308,7 +31325,7 @@ var ts;
|
|
|
31308
31325
|
initializeState("", content, languageVersion, /*syntaxCursor*/ undefined, 1 /* JS */);
|
|
31309
31326
|
// Prime the scanner.
|
|
31310
31327
|
nextToken();
|
|
31311
|
-
var entityName = parseEntityName(/*allowReservedWords*/ true
|
|
31328
|
+
var entityName = parseEntityName(/*allowReservedWords*/ true);
|
|
31312
31329
|
var isInvalid = token() === 1 /* EndOfFileToken */ && !parseDiagnostics.length;
|
|
31313
31330
|
clearState();
|
|
31314
31331
|
return isInvalid ? entityName : undefined;
|
|
@@ -32841,6 +32858,7 @@ var ts;
|
|
|
32841
32858
|
var startPos = scanner.getStartPos();
|
|
32842
32859
|
var result = parseListElement(kind, parseElement);
|
|
32843
32860
|
if (!result) {
|
|
32861
|
+
parsingContext = saveParsingContext;
|
|
32844
32862
|
return undefined;
|
|
32845
32863
|
}
|
|
32846
32864
|
list.push(result);
|
|
@@ -32908,7 +32926,7 @@ var ts;
|
|
|
32908
32926
|
}
|
|
32909
32927
|
return createMissingList();
|
|
32910
32928
|
}
|
|
32911
|
-
function parseEntityName(allowReservedWords,
|
|
32929
|
+
function parseEntityName(allowReservedWords, diagnosticMessage) {
|
|
32912
32930
|
var pos = getNodePos();
|
|
32913
32931
|
var entity = allowReservedWords ? parseIdentifierName(diagnosticMessage) : parseIdentifier(diagnosticMessage);
|
|
32914
32932
|
var dotPos = getNodePos();
|
|
@@ -32919,7 +32937,7 @@ var ts;
|
|
|
32919
32937
|
break;
|
|
32920
32938
|
}
|
|
32921
32939
|
dotPos = getNodePos();
|
|
32922
|
-
entity = finishNode(factory.createQualifiedName(entity, parseRightSideOfDot(allowReservedWords, allowPrivateIdentifiers)), pos);
|
|
32940
|
+
entity = finishNode(factory.createQualifiedName(entity, parseRightSideOfDot(allowReservedWords, /* allowPrivateIdentifiers */ false)), pos);
|
|
32923
32941
|
}
|
|
32924
32942
|
return entity;
|
|
32925
32943
|
}
|
|
@@ -33052,7 +33070,7 @@ var ts;
|
|
|
33052
33070
|
}
|
|
33053
33071
|
// TYPES
|
|
33054
33072
|
function parseEntityNameOfTypeReference() {
|
|
33055
|
-
return parseEntityName(/*allowReservedWords*/ true,
|
|
33073
|
+
return parseEntityName(/*allowReservedWords*/ true, ts.Diagnostics.Type_expected);
|
|
33056
33074
|
}
|
|
33057
33075
|
function parseTypeArgumentsOfTypeReference() {
|
|
33058
33076
|
if (!scanner.hasPrecedingLineBreak() && reScanLessThanToken() === 29 /* LessThanToken */) {
|
|
@@ -33185,7 +33203,7 @@ var ts;
|
|
|
33185
33203
|
function parseTypeQuery() {
|
|
33186
33204
|
var pos = getNodePos();
|
|
33187
33205
|
parseExpected(112 /* TypeOfKeyword */);
|
|
33188
|
-
var entityName = parseEntityName(/*allowReservedWords*/ true
|
|
33206
|
+
var entityName = parseEntityName(/*allowReservedWords*/ true);
|
|
33189
33207
|
// Make sure we perform ASI to prevent parsing the next line's type arguments as part of an instantiation expression.
|
|
33190
33208
|
var typeArguments = !scanner.hasPrecedingLineBreak() ? tryParseTypeArguments() : undefined;
|
|
33191
33209
|
return finishNode(factory.createTypeQueryNode(entityName, typeArguments), pos);
|
|
@@ -34153,10 +34171,10 @@ var ts;
|
|
|
34153
34171
|
setDecoratorContext(/*val*/ false);
|
|
34154
34172
|
}
|
|
34155
34173
|
var pos = getNodePos();
|
|
34156
|
-
var expr = parseAssignmentExpressionOrHigher(
|
|
34174
|
+
var expr = parseAssignmentExpressionOrHigher();
|
|
34157
34175
|
var operatorToken;
|
|
34158
34176
|
while ((operatorToken = parseOptionalToken(27 /* CommaToken */))) {
|
|
34159
|
-
expr = makeBinaryExpression(expr, operatorToken, parseAssignmentExpressionOrHigher(
|
|
34177
|
+
expr = makeBinaryExpression(expr, operatorToken, parseAssignmentExpressionOrHigher(), pos);
|
|
34160
34178
|
}
|
|
34161
34179
|
if (saveDecoratorContext) {
|
|
34162
34180
|
setDecoratorContext(/*val*/ true);
|
|
@@ -34164,9 +34182,9 @@ var ts;
|
|
|
34164
34182
|
return expr;
|
|
34165
34183
|
}
|
|
34166
34184
|
function parseInitializer() {
|
|
34167
|
-
return parseOptional(63 /* EqualsToken */) ? parseAssignmentExpressionOrHigher(
|
|
34185
|
+
return parseOptional(63 /* EqualsToken */) ? parseAssignmentExpressionOrHigher() : undefined;
|
|
34168
34186
|
}
|
|
34169
|
-
function parseAssignmentExpressionOrHigher(
|
|
34187
|
+
function parseAssignmentExpressionOrHigher() {
|
|
34170
34188
|
// AssignmentExpression[in,yield]:
|
|
34171
34189
|
// 1) ConditionalExpression[?in,?yield]
|
|
34172
34190
|
// 2) LeftHandSideExpression = AssignmentExpression[?in,?yield]
|
|
@@ -34192,7 +34210,7 @@ var ts;
|
|
|
34192
34210
|
// If we do successfully parse arrow-function, we must *not* recurse for productions 1, 2 or 3. An ArrowFunction is
|
|
34193
34211
|
// not a LeftHandSideExpression, nor does it start a ConditionalExpression. So we are done
|
|
34194
34212
|
// with AssignmentExpression if we see one.
|
|
34195
|
-
var arrowExpression = tryParseParenthesizedArrowFunctionExpression(
|
|
34213
|
+
var arrowExpression = tryParseParenthesizedArrowFunctionExpression() || tryParseAsyncSimpleArrowFunctionExpression();
|
|
34196
34214
|
if (arrowExpression) {
|
|
34197
34215
|
return arrowExpression;
|
|
34198
34216
|
}
|
|
@@ -34211,7 +34229,7 @@ var ts;
|
|
|
34211
34229
|
// parameter ('x => ...') above. We handle it here by checking if the parsed expression was a single
|
|
34212
34230
|
// identifier and the current token is an arrow.
|
|
34213
34231
|
if (expr.kind === 79 /* Identifier */ && token() === 38 /* EqualsGreaterThanToken */) {
|
|
34214
|
-
return parseSimpleArrowFunctionExpression(pos, expr,
|
|
34232
|
+
return parseSimpleArrowFunctionExpression(pos, expr, /*asyncModifier*/ undefined);
|
|
34215
34233
|
}
|
|
34216
34234
|
// Now see if we might be in cases '2' or '3'.
|
|
34217
34235
|
// If the expression was a LHS expression, and we have an assignment operator, then
|
|
@@ -34220,7 +34238,7 @@ var ts;
|
|
|
34220
34238
|
// Note: we call reScanGreaterToken so that we get an appropriately merged token
|
|
34221
34239
|
// for cases like `> > =` becoming `>>=`
|
|
34222
34240
|
if (ts.isLeftHandSideExpression(expr) && ts.isAssignmentOperator(reScanGreaterToken())) {
|
|
34223
|
-
return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher(
|
|
34241
|
+
return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher(), pos);
|
|
34224
34242
|
}
|
|
34225
34243
|
// It wasn't an assignment or a lambda. This is a conditional expression:
|
|
34226
34244
|
return parseConditionalExpressionRest(expr, pos);
|
|
@@ -34263,7 +34281,7 @@ var ts;
|
|
|
34263
34281
|
nextToken();
|
|
34264
34282
|
if (!scanner.hasPrecedingLineBreak() &&
|
|
34265
34283
|
(token() === 41 /* AsteriskToken */ || isStartOfExpression())) {
|
|
34266
|
-
return finishNode(factory.createYieldExpression(parseOptionalToken(41 /* AsteriskToken */), parseAssignmentExpressionOrHigher(
|
|
34284
|
+
return finishNode(factory.createYieldExpression(parseOptionalToken(41 /* AsteriskToken */), parseAssignmentExpressionOrHigher()), pos);
|
|
34267
34285
|
}
|
|
34268
34286
|
else {
|
|
34269
34287
|
// if the next token is not on the same line as yield. or we don't have an '*' or
|
|
@@ -34271,7 +34289,7 @@ var ts;
|
|
|
34271
34289
|
return finishNode(factory.createYieldExpression(/*asteriskToken*/ undefined, /*expression*/ undefined), pos);
|
|
34272
34290
|
}
|
|
34273
34291
|
}
|
|
34274
|
-
function parseSimpleArrowFunctionExpression(pos, identifier,
|
|
34292
|
+
function parseSimpleArrowFunctionExpression(pos, identifier, asyncModifier) {
|
|
34275
34293
|
ts.Debug.assert(token() === 38 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>");
|
|
34276
34294
|
var parameter = factory.createParameterDeclaration(
|
|
34277
34295
|
/*decorators*/ undefined,
|
|
@@ -34283,11 +34301,11 @@ var ts;
|
|
|
34283
34301
|
finishNode(parameter, identifier.pos);
|
|
34284
34302
|
var parameters = createNodeArray([parameter], parameter.pos, parameter.end);
|
|
34285
34303
|
var equalsGreaterThanToken = parseExpectedToken(38 /* EqualsGreaterThanToken */);
|
|
34286
|
-
var body = parseArrowFunctionExpressionBody(/*isAsync*/ !!asyncModifier
|
|
34304
|
+
var body = parseArrowFunctionExpressionBody(/*isAsync*/ !!asyncModifier);
|
|
34287
34305
|
var node = factory.createArrowFunction(asyncModifier, /*typeParameters*/ undefined, parameters, /*type*/ undefined, equalsGreaterThanToken, body);
|
|
34288
34306
|
return addJSDocComment(finishNode(node, pos));
|
|
34289
34307
|
}
|
|
34290
|
-
function tryParseParenthesizedArrowFunctionExpression(
|
|
34308
|
+
function tryParseParenthesizedArrowFunctionExpression() {
|
|
34291
34309
|
var triState = isParenthesizedArrowFunctionExpression();
|
|
34292
34310
|
if (triState === 0 /* False */) {
|
|
34293
34311
|
// It's definitely not a parenthesized arrow function expression.
|
|
@@ -34298,8 +34316,8 @@ var ts;
|
|
|
34298
34316
|
// it out, but don't allow any ambiguity, and return 'undefined' if this could be an
|
|
34299
34317
|
// expression instead.
|
|
34300
34318
|
return triState === 1 /* True */ ?
|
|
34301
|
-
parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true
|
|
34302
|
-
tryParse(
|
|
34319
|
+
parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true) :
|
|
34320
|
+
tryParse(parsePossibleParenthesizedArrowFunctionExpression);
|
|
34303
34321
|
}
|
|
34304
34322
|
// True -> We definitely expect a parenthesized arrow function here.
|
|
34305
34323
|
// False -> There *cannot* be a parenthesized arrow function here.
|
|
@@ -34429,25 +34447,25 @@ var ts;
|
|
|
34429
34447
|
return 2 /* Unknown */;
|
|
34430
34448
|
}
|
|
34431
34449
|
}
|
|
34432
|
-
function parsePossibleParenthesizedArrowFunctionExpression(
|
|
34450
|
+
function parsePossibleParenthesizedArrowFunctionExpression() {
|
|
34433
34451
|
var tokenPos = scanner.getTokenPos();
|
|
34434
34452
|
if (notParenthesizedArrow === null || notParenthesizedArrow === void 0 ? void 0 : notParenthesizedArrow.has(tokenPos)) {
|
|
34435
34453
|
return undefined;
|
|
34436
34454
|
}
|
|
34437
|
-
var result = parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ false
|
|
34455
|
+
var result = parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ false);
|
|
34438
34456
|
if (!result) {
|
|
34439
34457
|
(notParenthesizedArrow || (notParenthesizedArrow = new ts.Set())).add(tokenPos);
|
|
34440
34458
|
}
|
|
34441
34459
|
return result;
|
|
34442
34460
|
}
|
|
34443
|
-
function tryParseAsyncSimpleArrowFunctionExpression(
|
|
34461
|
+
function tryParseAsyncSimpleArrowFunctionExpression() {
|
|
34444
34462
|
// We do a check here so that we won't be doing unnecessarily call to "lookAhead"
|
|
34445
34463
|
if (token() === 131 /* AsyncKeyword */) {
|
|
34446
34464
|
if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === 1 /* True */) {
|
|
34447
34465
|
var pos = getNodePos();
|
|
34448
34466
|
var asyncModifier = parseModifiersForArrowFunction();
|
|
34449
34467
|
var expr = parseBinaryExpressionOrHigher(0 /* Lowest */);
|
|
34450
|
-
return parseSimpleArrowFunctionExpression(pos, expr,
|
|
34468
|
+
return parseSimpleArrowFunctionExpression(pos, expr, asyncModifier);
|
|
34451
34469
|
}
|
|
34452
34470
|
}
|
|
34453
34471
|
return undefined;
|
|
@@ -34471,7 +34489,7 @@ var ts;
|
|
|
34471
34489
|
}
|
|
34472
34490
|
return 0 /* False */;
|
|
34473
34491
|
}
|
|
34474
|
-
function parseParenthesizedArrowFunctionExpression(allowAmbiguity
|
|
34492
|
+
function parseParenthesizedArrowFunctionExpression(allowAmbiguity) {
|
|
34475
34493
|
var pos = getNodePos();
|
|
34476
34494
|
var hasJSDoc = hasPrecedingJSDocComment();
|
|
34477
34495
|
var modifiers = parseModifiersForArrowFunction();
|
|
@@ -34506,23 +34524,6 @@ var ts;
|
|
|
34506
34524
|
return undefined;
|
|
34507
34525
|
}
|
|
34508
34526
|
}
|
|
34509
|
-
// Given:
|
|
34510
|
-
// x ? y => ({ y }) : z => ({ z })
|
|
34511
|
-
// We try to parse the body of the first arrow function by looking at:
|
|
34512
|
-
// ({ y }) : z => ({ z })
|
|
34513
|
-
// This is a valid arrow function with "z" as the return type.
|
|
34514
|
-
//
|
|
34515
|
-
// But, if we're in the true side of a conditional expression, this colon
|
|
34516
|
-
// terminates the expression, so we cannot allow a return type if we aren't
|
|
34517
|
-
// certain whether or not the preceding text was parsed as a parameter list.
|
|
34518
|
-
//
|
|
34519
|
-
// For example,
|
|
34520
|
-
// a() ? (b: number, c?: string): void => d() : e
|
|
34521
|
-
// is determined by isParenthesizedArrowFunctionExpression to unambiguously
|
|
34522
|
-
// be an arrow expression, so we allow a return type.
|
|
34523
|
-
if (disallowReturnTypeInArrowFunction && token() === 58 /* ColonToken */) {
|
|
34524
|
-
return undefined;
|
|
34525
|
-
}
|
|
34526
34527
|
var type = parseReturnType(58 /* ColonToken */, /*isType*/ false);
|
|
34527
34528
|
if (type && !allowAmbiguity && typeHasArrowFunctionBlockingParseError(type)) {
|
|
34528
34529
|
return undefined;
|
|
@@ -34551,12 +34552,12 @@ var ts;
|
|
|
34551
34552
|
var lastToken = token();
|
|
34552
34553
|
var equalsGreaterThanToken = parseExpectedToken(38 /* EqualsGreaterThanToken */);
|
|
34553
34554
|
var body = (lastToken === 38 /* EqualsGreaterThanToken */ || lastToken === 18 /* OpenBraceToken */)
|
|
34554
|
-
? parseArrowFunctionExpressionBody(ts.some(modifiers, ts.isAsyncModifier)
|
|
34555
|
+
? parseArrowFunctionExpressionBody(ts.some(modifiers, ts.isAsyncModifier))
|
|
34555
34556
|
: parseIdentifier();
|
|
34556
34557
|
var node = factory.createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body);
|
|
34557
34558
|
return withJSDoc(finishNode(node, pos), hasJSDoc);
|
|
34558
34559
|
}
|
|
34559
|
-
function parseArrowFunctionExpressionBody(isAsync
|
|
34560
|
+
function parseArrowFunctionExpressionBody(isAsync) {
|
|
34560
34561
|
if (token() === 18 /* OpenBraceToken */) {
|
|
34561
34562
|
return parseFunctionBlock(isAsync ? 2 /* Await */ : 0 /* None */);
|
|
34562
34563
|
}
|
|
@@ -34584,8 +34585,8 @@ var ts;
|
|
|
34584
34585
|
var savedTopLevel = topLevel;
|
|
34585
34586
|
topLevel = false;
|
|
34586
34587
|
var node = isAsync
|
|
34587
|
-
? doInAwaitContext(
|
|
34588
|
-
: doOutsideOfAwaitContext(
|
|
34588
|
+
? doInAwaitContext(parseAssignmentExpressionOrHigher)
|
|
34589
|
+
: doOutsideOfAwaitContext(parseAssignmentExpressionOrHigher);
|
|
34589
34590
|
topLevel = savedTopLevel;
|
|
34590
34591
|
return node;
|
|
34591
34592
|
}
|
|
@@ -34598,8 +34599,8 @@ var ts;
|
|
|
34598
34599
|
// Note: we explicitly 'allowIn' in the whenTrue part of the condition expression, and
|
|
34599
34600
|
// we do not that for the 'whenFalse' part.
|
|
34600
34601
|
var colonToken;
|
|
34601
|
-
return finishNode(factory.createConditionalExpression(leftOperand, questionToken, doOutsideOfContext(disallowInAndDecoratorContext,
|
|
34602
|
-
? parseAssignmentExpressionOrHigher(
|
|
34602
|
+
return finishNode(factory.createConditionalExpression(leftOperand, questionToken, doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher), colonToken = parseExpectedToken(58 /* ColonToken */), ts.nodeIsPresent(colonToken)
|
|
34603
|
+
? parseAssignmentExpressionOrHigher()
|
|
34603
34604
|
: createMissingNode(79 /* Identifier */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(58 /* ColonToken */))), pos);
|
|
34604
34605
|
}
|
|
34605
34606
|
function parseBinaryExpressionOrHigher(precedence) {
|
|
@@ -35491,13 +35492,13 @@ var ts;
|
|
|
35491
35492
|
function parseSpreadElement() {
|
|
35492
35493
|
var pos = getNodePos();
|
|
35493
35494
|
parseExpected(25 /* DotDotDotToken */);
|
|
35494
|
-
var expression = parseAssignmentExpressionOrHigher(
|
|
35495
|
+
var expression = parseAssignmentExpressionOrHigher();
|
|
35495
35496
|
return finishNode(factory.createSpreadElement(expression), pos);
|
|
35496
35497
|
}
|
|
35497
35498
|
function parseArgumentOrArrayLiteralElement() {
|
|
35498
35499
|
return token() === 25 /* DotDotDotToken */ ? parseSpreadElement() :
|
|
35499
35500
|
token() === 27 /* CommaToken */ ? finishNode(factory.createOmittedExpression(), getNodePos()) :
|
|
35500
|
-
parseAssignmentExpressionOrHigher(
|
|
35501
|
+
parseAssignmentExpressionOrHigher();
|
|
35501
35502
|
}
|
|
35502
35503
|
function parseArgumentExpression() {
|
|
35503
35504
|
return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement);
|
|
@@ -35515,7 +35516,7 @@ var ts;
|
|
|
35515
35516
|
var pos = getNodePos();
|
|
35516
35517
|
var hasJSDoc = hasPrecedingJSDocComment();
|
|
35517
35518
|
if (parseOptionalToken(25 /* DotDotDotToken */)) {
|
|
35518
|
-
var expression = parseAssignmentExpressionOrHigher(
|
|
35519
|
+
var expression = parseAssignmentExpressionOrHigher();
|
|
35519
35520
|
return withJSDoc(finishNode(factory.createSpreadAssignment(expression), pos), hasJSDoc);
|
|
35520
35521
|
}
|
|
35521
35522
|
var decorators = parseDecorators();
|
|
@@ -35544,7 +35545,7 @@ var ts;
|
|
|
35544
35545
|
var isShorthandPropertyAssignment = tokenIsIdentifier && (token() !== 58 /* ColonToken */);
|
|
35545
35546
|
if (isShorthandPropertyAssignment) {
|
|
35546
35547
|
var equalsToken = parseOptionalToken(63 /* EqualsToken */);
|
|
35547
|
-
var objectAssignmentInitializer = equalsToken ? allowInAnd(
|
|
35548
|
+
var objectAssignmentInitializer = equalsToken ? allowInAnd(parseAssignmentExpressionOrHigher) : undefined;
|
|
35548
35549
|
node = factory.createShorthandPropertyAssignment(name, objectAssignmentInitializer);
|
|
35549
35550
|
// Save equals token for error reporting.
|
|
35550
35551
|
// TODO(rbuckton): Consider manufacturing this when we need to report an error as it is otherwise not useful.
|
|
@@ -35552,7 +35553,7 @@ var ts;
|
|
|
35552
35553
|
}
|
|
35553
35554
|
else {
|
|
35554
35555
|
parseExpected(58 /* ColonToken */);
|
|
35555
|
-
var initializer = allowInAnd(
|
|
35556
|
+
var initializer = allowInAnd(parseAssignmentExpressionOrHigher);
|
|
35556
35557
|
node = factory.createPropertyAssignment(name, initializer);
|
|
35557
35558
|
}
|
|
35558
35559
|
// Decorators, Modifiers, questionToken, and exclamationToken are not supported by property assignments and are reported in the grammar checker
|
|
@@ -35726,7 +35727,7 @@ var ts;
|
|
|
35726
35727
|
}
|
|
35727
35728
|
var node;
|
|
35728
35729
|
if (awaitToken ? parseExpected(160 /* OfKeyword */) : parseOptional(160 /* OfKeyword */)) {
|
|
35729
|
-
var expression = allowInAnd(
|
|
35730
|
+
var expression = allowInAnd(parseAssignmentExpressionOrHigher);
|
|
35730
35731
|
parseExpected(21 /* CloseParenToken */);
|
|
35731
35732
|
node = factory.createForOfStatement(awaitToken, initializer, expression, parseStatement());
|
|
35732
35733
|
}
|
|
@@ -36894,7 +36895,7 @@ var ts;
|
|
|
36894
36895
|
var pos = getNodePos();
|
|
36895
36896
|
var name = ts.tokenIsIdentifierOrKeyword(token()) ? parseIdentifierName() : parseLiteralLikeNode(10 /* StringLiteral */);
|
|
36896
36897
|
parseExpected(58 /* ColonToken */);
|
|
36897
|
-
var value = parseAssignmentExpressionOrHigher(
|
|
36898
|
+
var value = parseAssignmentExpressionOrHigher();
|
|
36898
36899
|
return finishNode(factory.createAssertEntry(name, value), pos);
|
|
36899
36900
|
}
|
|
36900
36901
|
function parseAssertClause(skipAssertKeyword) {
|
|
@@ -36954,7 +36955,7 @@ var ts;
|
|
|
36954
36955
|
function parseModuleReference() {
|
|
36955
36956
|
return isExternalModuleReference()
|
|
36956
36957
|
? parseExternalModuleReference()
|
|
36957
|
-
: parseEntityName(/*allowReservedWords*/ false
|
|
36958
|
+
: parseEntityName(/*allowReservedWords*/ false);
|
|
36958
36959
|
}
|
|
36959
36960
|
function parseExternalModuleReference() {
|
|
36960
36961
|
var pos = getNodePos();
|
|
@@ -37133,7 +37134,7 @@ var ts;
|
|
|
37133
37134
|
else {
|
|
37134
37135
|
parseExpected(88 /* DefaultKeyword */);
|
|
37135
37136
|
}
|
|
37136
|
-
var expression = parseAssignmentExpressionOrHigher(
|
|
37137
|
+
var expression = parseAssignmentExpressionOrHigher();
|
|
37137
37138
|
parseSemicolon();
|
|
37138
37139
|
setAwaitContext(savedAwaitContext);
|
|
37139
37140
|
var node = factory.createExportAssignment(decorators, modifiers, isExportEquals, expression);
|
|
@@ -37207,7 +37208,7 @@ var ts;
|
|
|
37207
37208
|
var pos = getNodePos();
|
|
37208
37209
|
var hasBrace = parseOptional(18 /* OpenBraceToken */);
|
|
37209
37210
|
var p2 = getNodePos();
|
|
37210
|
-
var entityName = parseEntityName(/* allowReservedWords*/ false
|
|
37211
|
+
var entityName = parseEntityName(/* allowReservedWords*/ false);
|
|
37211
37212
|
while (token() === 80 /* PrivateIdentifier */) {
|
|
37212
37213
|
reScanHashToken(); // rescan #id as # id
|
|
37213
37214
|
nextTokenJSDoc(); // then skip the #
|
|
@@ -37650,7 +37651,7 @@ var ts;
|
|
|
37650
37651
|
// parseEntityName logs an error for non-identifier, so create a MissingNode ourselves to avoid the error
|
|
37651
37652
|
var p2 = getNodePos();
|
|
37652
37653
|
var name = ts.tokenIsIdentifierOrKeyword(token())
|
|
37653
|
-
? parseEntityName(/*allowReservedWords*/ true
|
|
37654
|
+
? parseEntityName(/*allowReservedWords*/ true)
|
|
37654
37655
|
: undefined;
|
|
37655
37656
|
if (name) {
|
|
37656
37657
|
while (token() === 80 /* PrivateIdentifier */) {
|
|
@@ -38972,6 +38973,7 @@ var ts;
|
|
|
38972
38973
|
["es2021.intl", "lib.es2021.intl.d.ts"],
|
|
38973
38974
|
["es2022.array", "lib.es2022.array.d.ts"],
|
|
38974
38975
|
["es2022.error", "lib.es2022.error.d.ts"],
|
|
38976
|
+
["es2022.intl", "lib.es2022.intl.d.ts"],
|
|
38975
38977
|
["es2022.object", "lib.es2022.object.d.ts"],
|
|
38976
38978
|
["es2022.string", "lib.es2022.string.d.ts"],
|
|
38977
38979
|
["esnext.array", "lib.es2022.array.d.ts"],
|
|
@@ -42170,7 +42172,7 @@ var ts;
|
|
|
42170
42172
|
ts.Debug.assert(ts.extensionIsTS(resolved.extension));
|
|
42171
42173
|
return { fileName: resolved.path, packageId: resolved.packageId };
|
|
42172
42174
|
}
|
|
42173
|
-
function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, resultFromCache) {
|
|
42175
|
+
function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, diagnostics, resultFromCache) {
|
|
42174
42176
|
var _a;
|
|
42175
42177
|
if (resultFromCache) {
|
|
42176
42178
|
(_a = resultFromCache.failedLookupLocations).push.apply(_a, failedLookupLocations);
|
|
@@ -42178,7 +42180,8 @@ var ts;
|
|
|
42178
42180
|
}
|
|
42179
42181
|
return {
|
|
42180
42182
|
resolvedModule: resolved && { resolvedFileName: resolved.path, originalPath: resolved.originalPath === true ? undefined : resolved.originalPath, extension: resolved.extension, isExternalLibraryImport: isExternalLibraryImport, packageId: resolved.packageId },
|
|
42181
|
-
failedLookupLocations: failedLookupLocations
|
|
42183
|
+
failedLookupLocations: failedLookupLocations,
|
|
42184
|
+
resolutionDiagnostics: diagnostics
|
|
42182
42185
|
};
|
|
42183
42186
|
}
|
|
42184
42187
|
function readPackageJsonField(jsonContent, fieldName, typeOfTag, state) {
|
|
@@ -42379,7 +42382,18 @@ var ts;
|
|
|
42379
42382
|
features |= NodeResolutionFeatures.EsmMode;
|
|
42380
42383
|
}
|
|
42381
42384
|
var conditions = features & NodeResolutionFeatures.Exports ? features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"] : [];
|
|
42382
|
-
var
|
|
42385
|
+
var diagnostics = [];
|
|
42386
|
+
var moduleResolutionState = {
|
|
42387
|
+
compilerOptions: options,
|
|
42388
|
+
host: host,
|
|
42389
|
+
traceEnabled: traceEnabled,
|
|
42390
|
+
failedLookupLocations: failedLookupLocations,
|
|
42391
|
+
packageJsonInfoCache: cache,
|
|
42392
|
+
features: features,
|
|
42393
|
+
conditions: conditions,
|
|
42394
|
+
requestContainingDirectory: containingDirectory,
|
|
42395
|
+
reportDiagnostic: function (diag) { return void diagnostics.push(diag); },
|
|
42396
|
+
};
|
|
42383
42397
|
var resolved = primaryLookup();
|
|
42384
42398
|
var primary = true;
|
|
42385
42399
|
if (!resolved) {
|
|
@@ -42398,7 +42412,7 @@ var ts;
|
|
|
42398
42412
|
isExternalLibraryImport: pathContainsNodeModules(fileName),
|
|
42399
42413
|
};
|
|
42400
42414
|
}
|
|
42401
|
-
result = { resolvedTypeReferenceDirective: resolvedTypeReferenceDirective, failedLookupLocations: failedLookupLocations };
|
|
42415
|
+
result = { resolvedTypeReferenceDirective: resolvedTypeReferenceDirective, failedLookupLocations: failedLookupLocations, resolutionDiagnostics: diagnostics };
|
|
42402
42416
|
perFolderCache === null || perFolderCache === void 0 ? void 0 : perFolderCache.set(typeReferenceDirectiveName, /*mode*/ resolutionMode, result);
|
|
42403
42417
|
if (traceEnabled)
|
|
42404
42418
|
traceResult(result);
|
|
@@ -42481,6 +42495,8 @@ var ts;
|
|
|
42481
42495
|
packageJsonInfoCache: cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(),
|
|
42482
42496
|
conditions: ts.emptyArray,
|
|
42483
42497
|
features: NodeResolutionFeatures.None,
|
|
42498
|
+
requestContainingDirectory: containingDirectory,
|
|
42499
|
+
reportDiagnostic: ts.noop
|
|
42484
42500
|
};
|
|
42485
42501
|
return ts.forEachAncestorDirectory(containingDirectory, function (ancestorDirectory) {
|
|
42486
42502
|
if (ts.getBaseFileName(ancestorDirectory) !== "node_modules") {
|
|
@@ -43132,6 +43148,7 @@ var ts;
|
|
|
43132
43148
|
if (compilerOptions.noDtsResolution) {
|
|
43133
43149
|
conditions.pop();
|
|
43134
43150
|
}
|
|
43151
|
+
var diagnostics = [];
|
|
43135
43152
|
var state = {
|
|
43136
43153
|
compilerOptions: compilerOptions,
|
|
43137
43154
|
host: host,
|
|
@@ -43140,9 +43157,11 @@ var ts;
|
|
|
43140
43157
|
packageJsonInfoCache: cache,
|
|
43141
43158
|
features: features,
|
|
43142
43159
|
conditions: conditions,
|
|
43160
|
+
requestContainingDirectory: containingDirectory,
|
|
43161
|
+
reportDiagnostic: function (diag) { return void diagnostics.push(diag); },
|
|
43143
43162
|
};
|
|
43144
43163
|
var result = ts.forEach(extensions, function (ext) { return tryResolve(ext); });
|
|
43145
|
-
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);
|
|
43164
|
+
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);
|
|
43146
43165
|
function tryResolve(extensions) {
|
|
43147
43166
|
var loader = function (extensions, candidate, onlyRecordFailures, state) { return nodeLoadModuleByRelativeName(extensions, candidate, onlyRecordFailures, state, /*considerPackageJson*/ true); };
|
|
43148
43167
|
var resolved = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loader, state);
|
|
@@ -43315,9 +43334,9 @@ var ts;
|
|
|
43315
43334
|
}
|
|
43316
43335
|
}
|
|
43317
43336
|
function loadJSOrExactTSFileName(extensions, candidate, onlyRecordFailures, state) {
|
|
43318
|
-
if ((extensions === Extensions.TypeScript || extensions === Extensions.DtsOnly) && ts.
|
|
43337
|
+
if ((extensions === Extensions.TypeScript || extensions === Extensions.DtsOnly) && ts.fileExtensionIsOneOf(candidate, ts.supportedTSExtensionsFlat)) {
|
|
43319
43338
|
var result = tryFile(candidate, onlyRecordFailures, state);
|
|
43320
|
-
return result !== undefined ? { path: candidate, ext: ts.
|
|
43339
|
+
return result !== undefined ? { path: candidate, ext: ts.tryExtractTSExtension(candidate) } : undefined;
|
|
43321
43340
|
}
|
|
43322
43341
|
return loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecordFailures, state);
|
|
43323
43342
|
}
|
|
@@ -43440,6 +43459,8 @@ var ts;
|
|
|
43440
43459
|
packageJsonInfoCache: cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(),
|
|
43441
43460
|
conditions: ["node", "require", "types"],
|
|
43442
43461
|
features: features,
|
|
43462
|
+
requestContainingDirectory: packageJsonInfo.packageDirectory,
|
|
43463
|
+
reportDiagnostic: ts.noop
|
|
43443
43464
|
};
|
|
43444
43465
|
var requireResolution = loadNodeModuleFromDirectoryWorker(extensions, packageJsonInfo.packageDirectory,
|
|
43445
43466
|
/*onlyRecordFailures*/ false, requireState, packageJsonInfo.packageJsonContent, packageJsonInfo.versionPaths);
|
|
@@ -43526,6 +43547,8 @@ var ts;
|
|
|
43526
43547
|
packageJsonInfoCache: packageJsonInfoCache,
|
|
43527
43548
|
features: 0,
|
|
43528
43549
|
conditions: [],
|
|
43550
|
+
requestContainingDirectory: undefined,
|
|
43551
|
+
reportDiagnostic: ts.noop
|
|
43529
43552
|
};
|
|
43530
43553
|
var parts = ts.getPathComponents(fileName);
|
|
43531
43554
|
parts.pop();
|
|
@@ -43817,7 +43840,6 @@ var ts;
|
|
|
43817
43840
|
function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports) {
|
|
43818
43841
|
return loadModuleFromTargetImportOrExport;
|
|
43819
43842
|
function loadModuleFromTargetImportOrExport(target, subpath, pattern) {
|
|
43820
|
-
var _a, _b;
|
|
43821
43843
|
if (typeof target === "string") {
|
|
43822
43844
|
if (!pattern && subpath.length > 0 && !ts.endsWith(target, "/")) {
|
|
43823
43845
|
if (state.traceEnabled) {
|
|
@@ -43854,13 +43876,16 @@ var ts;
|
|
|
43854
43876
|
}
|
|
43855
43877
|
return toSearchResult(/*value*/ undefined);
|
|
43856
43878
|
}
|
|
43857
|
-
var finalPath =
|
|
43879
|
+
var finalPath = toAbsolutePath(pattern ? resolvedTarget.replace(/\*/g, subpath) : resolvedTarget + subpath);
|
|
43880
|
+
var inputLink = tryLoadInputFileForPath(finalPath, subpath, ts.combinePaths(scope.packageDirectory, "package.json"), isImports);
|
|
43881
|
+
if (inputLink)
|
|
43882
|
+
return inputLink;
|
|
43858
43883
|
return toSearchResult(withPackageId(scope, loadJSOrExactTSFileName(extensions, finalPath, /*onlyRecordFailures*/ false, state)));
|
|
43859
43884
|
}
|
|
43860
43885
|
else if (typeof target === "object" && target !== null) { // eslint-disable-line no-null/no-null
|
|
43861
43886
|
if (!Array.isArray(target)) {
|
|
43862
|
-
for (var _i = 0,
|
|
43863
|
-
var key =
|
|
43887
|
+
for (var _i = 0, _a = ts.getOwnKeys(target); _i < _a.length; _i++) {
|
|
43888
|
+
var key = _a[_i];
|
|
43864
43889
|
if (key === "default" || state.conditions.indexOf(key) >= 0 || isApplicableVersionedTypesKey(state.conditions, key)) {
|
|
43865
43890
|
var subTarget = target[key];
|
|
43866
43891
|
var result = loadModuleFromTargetImportOrExport(subTarget, subpath, pattern);
|
|
@@ -43878,8 +43903,8 @@ var ts;
|
|
|
43878
43903
|
}
|
|
43879
43904
|
return toSearchResult(/*value*/ undefined);
|
|
43880
43905
|
}
|
|
43881
|
-
for (var
|
|
43882
|
-
var elem = target_2[
|
|
43906
|
+
for (var _b = 0, target_2 = target; _b < target_2.length; _b++) {
|
|
43907
|
+
var elem = target_2[_b];
|
|
43883
43908
|
var result = loadModuleFromTargetImportOrExport(elem, subpath, pattern);
|
|
43884
43909
|
if (result) {
|
|
43885
43910
|
return result;
|
|
@@ -43897,6 +43922,128 @@ var ts;
|
|
|
43897
43922
|
trace(state.host, ts.Diagnostics.package_json_scope_0_has_invalid_type_for_target_of_specifier_1, scope.packageDirectory, moduleName);
|
|
43898
43923
|
}
|
|
43899
43924
|
return toSearchResult(/*value*/ undefined);
|
|
43925
|
+
function toAbsolutePath(path) {
|
|
43926
|
+
var _a, _b;
|
|
43927
|
+
if (path === undefined)
|
|
43928
|
+
return path;
|
|
43929
|
+
return ts.hostGetCanonicalFileName({ useCaseSensitiveFileNames: useCaseSensitiveFileNames })(ts.getNormalizedAbsolutePath(path, (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a)));
|
|
43930
|
+
}
|
|
43931
|
+
function combineDirectoryPath(root, dir) {
|
|
43932
|
+
return ts.ensureTrailingDirectorySeparator(ts.combinePaths(root, dir));
|
|
43933
|
+
}
|
|
43934
|
+
function useCaseSensitiveFileNames() {
|
|
43935
|
+
return !state.host.useCaseSensitiveFileNames ? true :
|
|
43936
|
+
typeof state.host.useCaseSensitiveFileNames === "boolean" ? state.host.useCaseSensitiveFileNames :
|
|
43937
|
+
state.host.useCaseSensitiveFileNames();
|
|
43938
|
+
}
|
|
43939
|
+
function tryLoadInputFileForPath(finalPath, entry, packagePath, isImports) {
|
|
43940
|
+
var _a, _b, _c, _d;
|
|
43941
|
+
// Replace any references to outputs for files in the program with the input files to support package self-names used with outDir
|
|
43942
|
+
// 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
|
|
43943
|
+
// 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!
|
|
43944
|
+
// _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!).
|
|
43945
|
+
// 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.
|
|
43946
|
+
if ((extensions === Extensions.TypeScript || extensions === Extensions.JavaScript || extensions === Extensions.Json)
|
|
43947
|
+
&& (state.compilerOptions.declarationDir || state.compilerOptions.outDir)
|
|
43948
|
+
&& finalPath.indexOf("/node_modules/") === -1
|
|
43949
|
+
&& (state.compilerOptions.configFile ? ts.startsWith(toAbsolutePath(state.compilerOptions.configFile.fileName), scope.packageDirectory) : true)) {
|
|
43950
|
+
// 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.
|
|
43951
|
+
// Even with all that, we still don't know if the root of the output file structure will be (relative to the package file)
|
|
43952
|
+
// `.`, `./src` or any other deeper directory structure. (If project references are used, it's definitely `.` by fiat, so that should be pretty common.)
|
|
43953
|
+
var getCanonicalFileName = ts.hostGetCanonicalFileName({ useCaseSensitiveFileNames: useCaseSensitiveFileNames });
|
|
43954
|
+
var commonSourceDirGuesses = [];
|
|
43955
|
+
// A `rootDir` compiler option strongly indicates the root location
|
|
43956
|
+
// 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
|
|
43957
|
+
if (state.compilerOptions.rootDir || (state.compilerOptions.composite && state.compilerOptions.configFilePath)) {
|
|
43958
|
+
var commonDir = toAbsolutePath(ts.getCommonSourceDirectory(state.compilerOptions, function () { return []; }, ((_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a)) || "", getCanonicalFileName));
|
|
43959
|
+
commonSourceDirGuesses.push(commonDir);
|
|
43960
|
+
}
|
|
43961
|
+
else if (state.requestContainingDirectory) {
|
|
43962
|
+
// However without either of those set we're in the dark. Let's say you have
|
|
43963
|
+
//
|
|
43964
|
+
// ./tools/index.ts
|
|
43965
|
+
// ./src/index.ts
|
|
43966
|
+
// ./dist/index.js
|
|
43967
|
+
// ./package.json <-- references ./dist/index.js
|
|
43968
|
+
// ./tsconfig.json <-- loads ./src/index.ts
|
|
43969
|
+
//
|
|
43970
|
+
// How do we know `./src` is the common src dir, and not `./tools`, given only the `./dist` out dir and `./dist/index.js` filename?
|
|
43971
|
+
// 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
|
|
43972
|
+
// without more context.
|
|
43973
|
+
// 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
|
|
43974
|
+
// must be inside the common source directory! So we propagate that tidbit of info all the way to here via state.requestContainingDirectory
|
|
43975
|
+
var requestingFile_1 = toAbsolutePath(ts.combinePaths(state.requestContainingDirectory, "index.ts"));
|
|
43976
|
+
// And we can try every folder above the common folder for the request folder and the config/package base directory
|
|
43977
|
+
// This technically can be wrong - we may load ./src/index.ts when ./src/sub/index.ts was right because we don't
|
|
43978
|
+
// know if only `./src/sub` files were loaded by the program; but this has the best chance to be right of just about anything
|
|
43979
|
+
// else we have. And, given that we're about to load `./src/index.ts` because we choose it as likely correct, there will then
|
|
43980
|
+
// be a file outside of `./src/sub` in the program (the file we resolved to), making us de-facto right. So this fallback lookup
|
|
43981
|
+
// logic may influence what files are pulled in by self-names, which in turn influences the output path shape, but it's all
|
|
43982
|
+
// internally consistent so the paths should be stable so long as we prefer the "most general" (meaning: top-most-level directory) possible results first.
|
|
43983
|
+
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));
|
|
43984
|
+
commonSourceDirGuesses.push(commonDir);
|
|
43985
|
+
var fragment = ts.ensureTrailingDirectorySeparator(commonDir);
|
|
43986
|
+
while (fragment && fragment.length > 1) {
|
|
43987
|
+
var parts = ts.getPathComponents(fragment);
|
|
43988
|
+
parts.pop(); // remove a directory
|
|
43989
|
+
var commonDir_1 = ts.getPathFromPathComponents(parts);
|
|
43990
|
+
commonSourceDirGuesses.unshift(commonDir_1);
|
|
43991
|
+
fragment = ts.ensureTrailingDirectorySeparator(commonDir_1);
|
|
43992
|
+
}
|
|
43993
|
+
}
|
|
43994
|
+
if (commonSourceDirGuesses.length > 1) {
|
|
43995
|
+
state.reportDiagnostic(ts.createCompilerDiagnostic(isImports
|
|
43996
|
+
? 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
|
|
43997
|
+
: 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
|
|
43998
|
+
packagePath));
|
|
43999
|
+
}
|
|
44000
|
+
for (var _i = 0, commonSourceDirGuesses_1 = commonSourceDirGuesses; _i < commonSourceDirGuesses_1.length; _i++) {
|
|
44001
|
+
var commonSourceDirGuess = commonSourceDirGuesses_1[_i];
|
|
44002
|
+
var candidateDirectories = getOutputDirectoriesForBaseDirectory(commonSourceDirGuess);
|
|
44003
|
+
for (var _e = 0, candidateDirectories_1 = candidateDirectories; _e < candidateDirectories_1.length; _e++) {
|
|
44004
|
+
var candidateDir = candidateDirectories_1[_e];
|
|
44005
|
+
if (ts.startsWith(finalPath, candidateDir)) {
|
|
44006
|
+
// 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
|
|
44007
|
+
var pathFragment = finalPath.slice(candidateDir.length + 1); // +1 to also remove directory seperator
|
|
44008
|
+
var possibleInputBase = ts.combinePaths(commonSourceDirGuess, pathFragment);
|
|
44009
|
+
var jsAndDtsExtensions = [".mjs" /* Mjs */, ".cjs" /* Cjs */, ".js" /* Js */, ".json" /* Json */, ".d.mts" /* Dmts */, ".d.cts" /* Dcts */, ".d.ts" /* Dts */];
|
|
44010
|
+
for (var _f = 0, jsAndDtsExtensions_1 = jsAndDtsExtensions; _f < jsAndDtsExtensions_1.length; _f++) {
|
|
44011
|
+
var ext = jsAndDtsExtensions_1[_f];
|
|
44012
|
+
if (ts.fileExtensionIs(possibleInputBase, ext)) {
|
|
44013
|
+
var inputExts = ts.getPossibleOriginalInputExtensionForExtension(possibleInputBase);
|
|
44014
|
+
for (var _g = 0, inputExts_1 = inputExts; _g < inputExts_1.length; _g++) {
|
|
44015
|
+
var possibleExt = inputExts_1[_g];
|
|
44016
|
+
var possibleInputWithInputExtension = ts.changeAnyExtension(possibleInputBase, possibleExt, ext, !useCaseSensitiveFileNames());
|
|
44017
|
+
if ((extensions === Extensions.TypeScript && ts.hasJSFileExtension(possibleInputWithInputExtension)) ||
|
|
44018
|
+
(extensions === Extensions.JavaScript && ts.hasTSFileExtension(possibleInputWithInputExtension))) {
|
|
44019
|
+
continue;
|
|
44020
|
+
}
|
|
44021
|
+
if (state.host.fileExists(possibleInputWithInputExtension)) {
|
|
44022
|
+
return toSearchResult(withPackageId(scope, loadJSOrExactTSFileName(extensions, possibleInputWithInputExtension, /*onlyRecordFailures*/ false, state)));
|
|
44023
|
+
}
|
|
44024
|
+
}
|
|
44025
|
+
}
|
|
44026
|
+
}
|
|
44027
|
+
}
|
|
44028
|
+
}
|
|
44029
|
+
}
|
|
44030
|
+
}
|
|
44031
|
+
return undefined;
|
|
44032
|
+
function getOutputDirectoriesForBaseDirectory(commonSourceDirGuess) {
|
|
44033
|
+
var _a, _b;
|
|
44034
|
+
// Config file ouput paths are processed to be relative to the host's current directory, while
|
|
44035
|
+
// otherwise the paths are resolved relative to the common source dir the compiler puts together
|
|
44036
|
+
var currentDir = state.compilerOptions.configFile ? ((_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a)) || "" : commonSourceDirGuess;
|
|
44037
|
+
var candidateDirectories = [];
|
|
44038
|
+
if (state.compilerOptions.declarationDir) {
|
|
44039
|
+
candidateDirectories.push(toAbsolutePath(combineDirectoryPath(currentDir, state.compilerOptions.declarationDir)));
|
|
44040
|
+
}
|
|
44041
|
+
if (state.compilerOptions.outDir && state.compilerOptions.outDir !== state.compilerOptions.declarationDir) {
|
|
44042
|
+
candidateDirectories.push(toAbsolutePath(combineDirectoryPath(currentDir, state.compilerOptions.outDir)));
|
|
44043
|
+
}
|
|
44044
|
+
return candidateDirectories;
|
|
44045
|
+
}
|
|
44046
|
+
}
|
|
43900
44047
|
}
|
|
43901
44048
|
}
|
|
43902
44049
|
/* @internal */
|
|
@@ -44087,11 +44234,12 @@ var ts;
|
|
|
44087
44234
|
function classicNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference) {
|
|
44088
44235
|
var traceEnabled = isTraceEnabled(compilerOptions, host);
|
|
44089
44236
|
var failedLookupLocations = [];
|
|
44090
|
-
var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled, failedLookupLocations: failedLookupLocations, packageJsonInfoCache: cache, features: NodeResolutionFeatures.None, conditions: [] };
|
|
44091
44237
|
var containingDirectory = ts.getDirectoryPath(containingFile);
|
|
44238
|
+
var diagnostics = [];
|
|
44239
|
+
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); } };
|
|
44092
44240
|
var resolved = tryResolve(Extensions.TypeScript) || tryResolve(Extensions.JavaScript);
|
|
44093
44241
|
// No originalPath because classic resolution doesn't resolve realPath
|
|
44094
|
-
return createResolvedModuleWithFailedLookupLocations(resolved && resolved.value, /*isExternalLibraryImport*/ false, failedLookupLocations, state.resultFromCache);
|
|
44242
|
+
return createResolvedModuleWithFailedLookupLocations(resolved && resolved.value, /*isExternalLibraryImport*/ false, failedLookupLocations, diagnostics, state.resultFromCache);
|
|
44095
44243
|
function tryResolve(extensions) {
|
|
44096
44244
|
var resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFileNoPackageId, state);
|
|
44097
44245
|
if (resolvedUsingSettings) {
|
|
@@ -44134,9 +44282,10 @@ var ts;
|
|
|
44134
44282
|
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);
|
|
44135
44283
|
}
|
|
44136
44284
|
var failedLookupLocations = [];
|
|
44137
|
-
var
|
|
44285
|
+
var diagnostics = [];
|
|
44286
|
+
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); } };
|
|
44138
44287
|
var resolved = loadModuleFromImmediateNodeModulesDirectory(Extensions.DtsOnly, moduleName, globalCache, state, /*typesScopeOnly*/ false, /*cache*/ undefined, /*redirectedReference*/ undefined);
|
|
44139
|
-
return createResolvedModuleWithFailedLookupLocations(resolved, /*isExternalLibraryImport*/ true, failedLookupLocations, state.resultFromCache);
|
|
44288
|
+
return createResolvedModuleWithFailedLookupLocations(resolved, /*isExternalLibraryImport*/ true, failedLookupLocations, diagnostics, state.resultFromCache);
|
|
44140
44289
|
}
|
|
44141
44290
|
ts.loadModuleFromGlobalCache = loadModuleFromGlobalCache;
|
|
44142
44291
|
/**
|
|
@@ -58000,7 +58149,8 @@ var ts;
|
|
|
58000
58149
|
if (symbol === globalThisSymbol) {
|
|
58001
58150
|
var varsOnly_1 = new ts.Map();
|
|
58002
58151
|
members.forEach(function (p) {
|
|
58003
|
-
|
|
58152
|
+
var _a;
|
|
58153
|
+
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))) {
|
|
58004
58154
|
varsOnly_1.set(p.escapedName, p);
|
|
58005
58155
|
}
|
|
58006
58156
|
});
|
|
@@ -84851,6 +85001,9 @@ var ts;
|
|
|
84851
85001
|
var validForTypeAssertions = ts.isExclusivelyTypeOnlyImportOrExport(declaration);
|
|
84852
85002
|
var override = ts.getResolutionModeOverrideForClause(declaration.assertClause, validForTypeAssertions ? grammarErrorOnNode : undefined);
|
|
84853
85003
|
if (validForTypeAssertions && override) {
|
|
85004
|
+
if (!ts.isNightly()) {
|
|
85005
|
+
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);
|
|
85006
|
+
}
|
|
84854
85007
|
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
|
|
84855
85008
|
return grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.Resolution_modes_are_only_supported_when_moduleResolution_is_node16_or_nodenext);
|
|
84856
85009
|
}
|
|
@@ -86191,7 +86344,7 @@ var ts;
|
|
|
86191
86344
|
if (ts.isDeclaration(node)) {
|
|
86192
86345
|
// In this case, we call getSymbolOfNode instead of getSymbolAtLocation because it is a declaration
|
|
86193
86346
|
var symbol = getSymbolOfNode(node);
|
|
86194
|
-
return getTypeOfSymbol(symbol);
|
|
86347
|
+
return symbol ? getTypeOfSymbol(symbol) : errorType;
|
|
86195
86348
|
}
|
|
86196
86349
|
if (isDeclarationNameOrImportPropertyName(node)) {
|
|
86197
86350
|
var symbol = getSymbolAtLocation(node);
|
|
@@ -108249,34 +108402,44 @@ var ts;
|
|
|
108249
108402
|
if (!decl.importClause) {
|
|
108250
108403
|
// import "mod" - possibly needed for side effects? (global interface patches, module augmentations, etc)
|
|
108251
108404
|
return factory.updateImportDeclaration(decl,
|
|
108252
|
-
/*decorators*/ undefined, decl.modifiers, decl.importClause, rewriteModuleSpecifier(decl, decl.moduleSpecifier),
|
|
108405
|
+
/*decorators*/ undefined, decl.modifiers, decl.importClause, rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause));
|
|
108253
108406
|
}
|
|
108254
108407
|
// The `importClause` visibility corresponds to the default's visibility.
|
|
108255
108408
|
var visibleDefaultBinding = decl.importClause && decl.importClause.name && resolver.isDeclarationVisible(decl.importClause) ? decl.importClause.name : undefined;
|
|
108256
108409
|
if (!decl.importClause.namedBindings) {
|
|
108257
108410
|
// No named bindings (either namespace or list), meaning the import is just default or should be elided
|
|
108258
108411
|
return visibleDefaultBinding && factory.updateImportDeclaration(decl, /*decorators*/ undefined, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding,
|
|
108259
|
-
/*namedBindings*/ undefined), rewriteModuleSpecifier(decl, decl.moduleSpecifier),
|
|
108412
|
+
/*namedBindings*/ undefined), rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause));
|
|
108260
108413
|
}
|
|
108261
108414
|
if (decl.importClause.namedBindings.kind === 268 /* NamespaceImport */) {
|
|
108262
108415
|
// Namespace import (optionally with visible default)
|
|
108263
108416
|
var namedBindings = resolver.isDeclarationVisible(decl.importClause.namedBindings) ? decl.importClause.namedBindings : /*namedBindings*/ undefined;
|
|
108264
|
-
return visibleDefaultBinding || namedBindings ? factory.updateImportDeclaration(decl, /*decorators*/ undefined, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, namedBindings), rewriteModuleSpecifier(decl, decl.moduleSpecifier),
|
|
108417
|
+
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;
|
|
108265
108418
|
}
|
|
108266
108419
|
// Named imports (optionally with visible default)
|
|
108267
108420
|
var bindingList = ts.mapDefined(decl.importClause.namedBindings.elements, function (b) { return resolver.isDeclarationVisible(b) ? b : undefined; });
|
|
108268
108421
|
if ((bindingList && bindingList.length) || visibleDefaultBinding) {
|
|
108269
108422
|
return factory.updateImportDeclaration(decl,
|
|
108270
|
-
/*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),
|
|
108423
|
+
/*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));
|
|
108271
108424
|
}
|
|
108272
108425
|
// Augmentation of export depends on import
|
|
108273
108426
|
if (resolver.isImportRequiredByAugmentation(decl)) {
|
|
108274
108427
|
return factory.updateImportDeclaration(decl,
|
|
108275
108428
|
/*decorators*/ undefined, decl.modifiers,
|
|
108276
|
-
/*importClause*/ undefined, rewriteModuleSpecifier(decl, decl.moduleSpecifier),
|
|
108429
|
+
/*importClause*/ undefined, rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause));
|
|
108277
108430
|
}
|
|
108278
108431
|
// Nothing visible
|
|
108279
108432
|
}
|
|
108433
|
+
function getResolutionModeOverrideForClauseInNightly(assertClause) {
|
|
108434
|
+
var mode = ts.getResolutionModeOverrideForClause(assertClause);
|
|
108435
|
+
if (mode !== undefined) {
|
|
108436
|
+
if (!ts.isNightly()) {
|
|
108437
|
+
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));
|
|
108438
|
+
}
|
|
108439
|
+
return assertClause;
|
|
108440
|
+
}
|
|
108441
|
+
return undefined;
|
|
108442
|
+
}
|
|
108280
108443
|
function transformAndReplaceLatePaintedStatements(statements) {
|
|
108281
108444
|
// This is a `while` loop because `handleSymbolAccessibilityError` can see additional import aliases marked as visible during
|
|
108282
108445
|
// error handling which must now be included in the output and themselves checked for errors.
|
|
@@ -116105,7 +116268,6 @@ var ts;
|
|
|
116105
116268
|
ts.Diagnostics.A_rest_parameter_cannot_have_an_initializer.code,
|
|
116106
116269
|
ts.Diagnostics.A_rest_parameter_must_be_last_in_a_parameter_list.code,
|
|
116107
116270
|
ts.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma.code,
|
|
116108
|
-
ts.Diagnostics.A_return_statement_can_only_be_used_within_a_function_body.code,
|
|
116109
116271
|
ts.Diagnostics.A_return_statement_cannot_be_used_inside_a_class_static_block.code,
|
|
116110
116272
|
ts.Diagnostics.A_set_accessor_cannot_have_rest_parameter.code,
|
|
116111
116273
|
ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter.code,
|
|
@@ -116492,6 +116654,40 @@ var ts;
|
|
|
116492
116654
|
ts.performance.measure("Program", "beforeProgram", "afterProgram");
|
|
116493
116655
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
116494
116656
|
return program;
|
|
116657
|
+
function addResolutionDiagnostics(list) {
|
|
116658
|
+
if (!list)
|
|
116659
|
+
return;
|
|
116660
|
+
for (var _i = 0, list_3 = list; _i < list_3.length; _i++) {
|
|
116661
|
+
var elem = list_3[_i];
|
|
116662
|
+
programDiagnostics.add(elem);
|
|
116663
|
+
}
|
|
116664
|
+
}
|
|
116665
|
+
function pullDiagnosticsFromCache(names, containingFile) {
|
|
116666
|
+
var _a;
|
|
116667
|
+
if (!moduleResolutionCache)
|
|
116668
|
+
return;
|
|
116669
|
+
var containingFileName = ts.getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory);
|
|
116670
|
+
var containingFileMode = !ts.isString(containingFile) ? containingFile.impliedNodeFormat : undefined;
|
|
116671
|
+
var containingDir = ts.getDirectoryPath(containingFileName);
|
|
116672
|
+
var redirectedReference = getRedirectReferenceForResolution(containingFile);
|
|
116673
|
+
var i = 0;
|
|
116674
|
+
for (var _i = 0, names_4 = names; _i < names_4.length; _i++) {
|
|
116675
|
+
var n = names_4[_i];
|
|
116676
|
+
// 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
|
|
116677
|
+
var mode = typeof n === "string" ? getModeForResolutionAtIndex(containingFile, i) : getModeForFileReference(n, containingFileMode);
|
|
116678
|
+
var name = typeof n === "string" ? n : n.fileName;
|
|
116679
|
+
i++;
|
|
116680
|
+
// only nonrelative names hit the cache, and, at least as of right now, only nonrelative names can issue diagnostics
|
|
116681
|
+
// (Since diagnostics are only issued via import or export map lookup)
|
|
116682
|
+
// This may totally change if/when the issue of output paths not mapping to input files is fixed in a broader context
|
|
116683
|
+
// When it is, how we extract diagnostics from the module name resolver will have the be refined - the current cache
|
|
116684
|
+
// APIs wrapping the underlying resolver make it almost impossible to smuggle the diagnostics out in a generalized way
|
|
116685
|
+
if (ts.isExternalModuleNameRelative(name))
|
|
116686
|
+
continue;
|
|
116687
|
+
var diags = (_a = moduleResolutionCache.getOrCreateCacheForModuleName(name, mode, redirectedReference).get(containingDir)) === null || _a === void 0 ? void 0 : _a.resolutionDiagnostics;
|
|
116688
|
+
addResolutionDiagnostics(diags);
|
|
116689
|
+
}
|
|
116690
|
+
}
|
|
116495
116691
|
function resolveModuleNamesWorker(moduleNames, containingFile, reusedNames) {
|
|
116496
116692
|
if (!moduleNames.length)
|
|
116497
116693
|
return ts.emptyArray;
|
|
@@ -116503,6 +116699,7 @@ var ts;
|
|
|
116503
116699
|
ts.performance.mark("afterResolveModule");
|
|
116504
116700
|
ts.performance.measure("ResolveModule", "beforeResolveModule", "afterResolveModule");
|
|
116505
116701
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
116702
|
+
pullDiagnosticsFromCache(moduleNames, containingFile);
|
|
116506
116703
|
return result;
|
|
116507
116704
|
}
|
|
116508
116705
|
function resolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFile) {
|
|
@@ -120939,8 +121136,8 @@ var ts;
|
|
|
120939
121136
|
!!redirectedReference;
|
|
120940
121137
|
var seenNamesInFile = ts.createModeAwareCache();
|
|
120941
121138
|
var i = 0;
|
|
120942
|
-
for (var _i = 0,
|
|
120943
|
-
var entry =
|
|
121139
|
+
for (var _i = 0, names_5 = names; _i < names_5.length; _i++) {
|
|
121140
|
+
var entry = names_5[_i];
|
|
120944
121141
|
var name = ts.isString(entry) ? entry : entry.fileName.toLowerCase();
|
|
120945
121142
|
// Imports supply a `containingSourceFile` but no `containingSourceFileMode` - it would be redundant
|
|
120946
121143
|
// they require calculating the mode for a given import from it's position in the resolution table, since a given
|
|
@@ -121550,14 +121747,14 @@ var ts;
|
|
|
121550
121747
|
if (options === void 0) { options = {}; }
|
|
121551
121748
|
var info = getInfo(importingSourceFile.path, host);
|
|
121552
121749
|
var modulePaths = getAllModulePaths(importingSourceFile.path, nodeModulesFileName, host, preferences, options);
|
|
121553
|
-
return ts.firstDefined(modulePaths, function (modulePath) { return tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, /*packageNameOnly*/ true, options.overrideImportMode); });
|
|
121750
|
+
return ts.firstDefined(modulePaths, function (modulePath) { return tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, preferences, /*packageNameOnly*/ true, options.overrideImportMode); });
|
|
121554
121751
|
}
|
|
121555
121752
|
moduleSpecifiers_1.getNodeModulesPackageName = getNodeModulesPackageName;
|
|
121556
121753
|
function getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName, host, preferences, userPreferences, options) {
|
|
121557
121754
|
if (options === void 0) { options = {}; }
|
|
121558
121755
|
var info = getInfo(importingSourceFileName, host);
|
|
121559
121756
|
var modulePaths = getAllModulePaths(importingSourceFileName, toFileName, host, userPreferences, options);
|
|
121560
|
-
return ts.firstDefined(modulePaths, function (modulePath) { return tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, /*packageNameOnly*/ undefined, options.overrideImportMode); }) ||
|
|
121757
|
+
return ts.firstDefined(modulePaths, function (modulePath) { return tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, userPreferences, /*packageNameOnly*/ undefined, options.overrideImportMode); }) ||
|
|
121561
121758
|
getLocalModuleSpecifier(toFileName, info, compilerOptions, host, preferences);
|
|
121562
121759
|
}
|
|
121563
121760
|
function tryGetModuleSpecifiersFromCache(moduleSymbol, importingSourceFile, host, userPreferences, options) {
|
|
@@ -121633,7 +121830,7 @@ var ts;
|
|
|
121633
121830
|
var relativeSpecifiers;
|
|
121634
121831
|
for (var _i = 0, modulePaths_1 = modulePaths; _i < modulePaths_1.length; _i++) {
|
|
121635
121832
|
var modulePath = modulePaths_1[_i];
|
|
121636
|
-
var specifier = tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, /*packageNameOnly*/ undefined, options.overrideImportMode);
|
|
121833
|
+
var specifier = tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, userPreferences, /*packageNameOnly*/ undefined, options.overrideImportMode);
|
|
121637
121834
|
nodeModulesSpecifiers = ts.append(nodeModulesSpecifiers, specifier);
|
|
121638
121835
|
if (specifier && modulePath.isRedirect) {
|
|
121639
121836
|
// If we got a specifier for a redirect, it was a bare package specifier (e.g. "@foo/bar",
|
|
@@ -122026,7 +122223,7 @@ var ts;
|
|
|
122026
122223
|
? removeExtensionAndIndexPostFix(relativePath, ending, compilerOptions)
|
|
122027
122224
|
: ts.removeFileExtension(relativePath);
|
|
122028
122225
|
}
|
|
122029
|
-
function tryGetModuleNameAsNodeModule(_a, _b, importingSourceFile, host, options, packageNameOnly, overrideMode) {
|
|
122226
|
+
function tryGetModuleNameAsNodeModule(_a, _b, importingSourceFile, host, options, userPreferences, packageNameOnly, overrideMode) {
|
|
122030
122227
|
var path = _a.path, isRedirect = _a.isRedirect;
|
|
122031
122228
|
var getCanonicalFileName = _b.getCanonicalFileName, sourceDirectory = _b.sourceDirectory;
|
|
122032
122229
|
if (!host.fileExists || !host.readFile) {
|
|
@@ -122040,8 +122237,9 @@ var ts;
|
|
|
122040
122237
|
var moduleSpecifier = path;
|
|
122041
122238
|
var isPackageRootPath = false;
|
|
122042
122239
|
if (!packageNameOnly) {
|
|
122240
|
+
var preferences = getPreferences(host, userPreferences, options, importingSourceFile);
|
|
122043
122241
|
var packageRootIndex = parts.packageRootIndex;
|
|
122044
|
-
var
|
|
122242
|
+
var moduleFileName = void 0;
|
|
122045
122243
|
while (true) {
|
|
122046
122244
|
// If the module could be imported by a directory name, use that directory's name
|
|
122047
122245
|
var _c = tryDirectoryWithPackageJson(packageRootIndex), moduleFileToTry = _c.moduleFileToTry, packageRootPath = _c.packageRootPath, blockedByExports = _c.blockedByExports, verbatimFromExports = _c.verbatimFromExports;
|
|
@@ -122058,12 +122256,12 @@ var ts;
|
|
|
122058
122256
|
isPackageRootPath = true;
|
|
122059
122257
|
break;
|
|
122060
122258
|
}
|
|
122061
|
-
if (!
|
|
122062
|
-
|
|
122259
|
+
if (!moduleFileName)
|
|
122260
|
+
moduleFileName = moduleFileToTry;
|
|
122063
122261
|
// try with next level of directory
|
|
122064
122262
|
packageRootIndex = path.indexOf(ts.directorySeparator, packageRootIndex + 1);
|
|
122065
122263
|
if (packageRootIndex === -1) {
|
|
122066
|
-
moduleSpecifier =
|
|
122264
|
+
moduleSpecifier = removeExtensionAndIndexPostFix(moduleFileName, preferences.ending, options, host);
|
|
122067
122265
|
break;
|
|
122068
122266
|
}
|
|
122069
122267
|
}
|
|
@@ -122121,7 +122319,7 @@ var ts;
|
|
|
122121
122319
|
}
|
|
122122
122320
|
}
|
|
122123
122321
|
// If the file is the main module, it can be imported by the package name
|
|
122124
|
-
var mainFileRelative = packageJsonContent.typings || packageJsonContent.types || packageJsonContent.main;
|
|
122322
|
+
var mainFileRelative = packageJsonContent.typings || packageJsonContent.types || packageJsonContent.main || "index.js";
|
|
122125
122323
|
if (ts.isString(mainFileRelative)) {
|
|
122126
122324
|
var mainExportFile = ts.toPath(mainFileRelative, packageRootPath, getCanonicalFileName);
|
|
122127
122325
|
if (ts.removeFileExtension(mainExportFile) === ts.removeFileExtension(getCanonicalFileName(moduleFileToTry))) {
|
|
@@ -122129,17 +122327,14 @@ var ts;
|
|
|
122129
122327
|
}
|
|
122130
122328
|
}
|
|
122131
122329
|
}
|
|
122132
|
-
|
|
122133
|
-
|
|
122134
|
-
|
|
122135
|
-
|
|
122136
|
-
|
|
122137
|
-
|
|
122138
|
-
// IFF there is not _also_ a file by the same name
|
|
122139
|
-
if (getCanonicalFileName(fullModulePathWithoutExtension.substring(parts.fileNameIndex)) === "/index" && !tryGetAnyFileFromPath(host, fullModulePathWithoutExtension.substring(0, parts.fileNameIndex))) {
|
|
122140
|
-
return fullModulePathWithoutExtension.substring(0, parts.fileNameIndex);
|
|
122330
|
+
else {
|
|
122331
|
+
// No package.json exists; an index.js will still resolve as the package name
|
|
122332
|
+
var fileName = getCanonicalFileName(moduleFileToTry.substring(parts.packageRootIndex + 1));
|
|
122333
|
+
if (fileName === "index.d.ts" || fileName === "index.js" || fileName === "index.ts" || fileName === "index.tsx") {
|
|
122334
|
+
return { moduleFileToTry: moduleFileToTry, packageRootPath: packageRootPath };
|
|
122335
|
+
}
|
|
122141
122336
|
}
|
|
122142
|
-
return
|
|
122337
|
+
return { moduleFileToTry: moduleFileToTry };
|
|
122143
122338
|
}
|
|
122144
122339
|
}
|
|
122145
122340
|
function tryGetAnyFileFromPath(host, path) {
|
|
@@ -122161,7 +122356,7 @@ var ts;
|
|
|
122161
122356
|
return relativePath !== undefined && isPathRelativeToParent(relativePath) ? undefined : relativePath;
|
|
122162
122357
|
});
|
|
122163
122358
|
}
|
|
122164
|
-
function removeExtensionAndIndexPostFix(fileName, ending, options) {
|
|
122359
|
+
function removeExtensionAndIndexPostFix(fileName, ending, options, host) {
|
|
122165
122360
|
if (ts.fileExtensionIsOneOf(fileName, [".json" /* Json */, ".mjs" /* Mjs */, ".cjs" /* Cjs */]))
|
|
122166
122361
|
return fileName;
|
|
122167
122362
|
var noExtension = ts.removeFileExtension(fileName);
|
|
@@ -122169,7 +122364,13 @@ var ts;
|
|
|
122169
122364
|
return noExtension + getJSExtensionForFile(fileName, options);
|
|
122170
122365
|
switch (ending) {
|
|
122171
122366
|
case 0 /* Minimal */:
|
|
122172
|
-
|
|
122367
|
+
var withoutIndex = ts.removeSuffix(noExtension, "/index");
|
|
122368
|
+
if (host && withoutIndex !== noExtension && tryGetAnyFileFromPath(host, withoutIndex)) {
|
|
122369
|
+
// Can't remove index if there's a file by the same name as the directory.
|
|
122370
|
+
// Probably more callers should pass `host` so we can determine this?
|
|
122371
|
+
return noExtension;
|
|
122372
|
+
}
|
|
122373
|
+
return withoutIndex;
|
|
122173
122374
|
case 1 /* Index */:
|
|
122174
122375
|
return noExtension;
|
|
122175
122376
|
case 2 /* JsExtension */:
|
|
@@ -128975,23 +129176,30 @@ var ts;
|
|
|
128975
129176
|
(_d = host.log) === null || _d === void 0 ? void 0 : _d.call(host, "getExportInfoMap: cache miss or empty; calculating new results");
|
|
128976
129177
|
var compilerOptions = program.getCompilerOptions();
|
|
128977
129178
|
var moduleCount = 0;
|
|
128978
|
-
|
|
128979
|
-
|
|
128980
|
-
|
|
128981
|
-
|
|
128982
|
-
|
|
128983
|
-
|
|
128984
|
-
|
|
128985
|
-
|
|
128986
|
-
|
|
128987
|
-
|
|
128988
|
-
|
|
128989
|
-
checker.forEachExportAndPropertyOfModule(moduleSymbol, function (exported, key) {
|
|
128990
|
-
if (exported !== (defaultInfo === null || defaultInfo === void 0 ? void 0 : defaultInfo.symbol) && isImportableSymbol(exported, checker) && ts.addToSeen(seenExports, key)) {
|
|
128991
|
-
cache.add(importingFile.path, exported, key, moduleSymbol, moduleFile, 0 /* Named */, isFromPackageJson, checker);
|
|
129179
|
+
try {
|
|
129180
|
+
forEachExternalModuleToImportFrom(program, host, /*useAutoImportProvider*/ true, function (moduleSymbol, moduleFile, program, isFromPackageJson) {
|
|
129181
|
+
if (++moduleCount % 100 === 0)
|
|
129182
|
+
cancellationToken === null || cancellationToken === void 0 ? void 0 : cancellationToken.throwIfCancellationRequested();
|
|
129183
|
+
var seenExports = new ts.Map();
|
|
129184
|
+
var checker = program.getTypeChecker();
|
|
129185
|
+
var defaultInfo = getDefaultLikeExportInfo(moduleSymbol, checker, compilerOptions);
|
|
129186
|
+
// Note: I think we shouldn't actually see resolved module symbols here, but weird merges
|
|
129187
|
+
// can cause it to happen: see 'completionsImport_mergedReExport.ts'
|
|
129188
|
+
if (defaultInfo && isImportableSymbol(defaultInfo.symbol, checker)) {
|
|
129189
|
+
cache.add(importingFile.path, defaultInfo.symbol, defaultInfo.exportKind === 1 /* Default */ ? "default" /* Default */ : "export=" /* ExportEquals */, moduleSymbol, moduleFile, defaultInfo.exportKind, isFromPackageJson, checker);
|
|
128992
129190
|
}
|
|
129191
|
+
checker.forEachExportAndPropertyOfModule(moduleSymbol, function (exported, key) {
|
|
129192
|
+
if (exported !== (defaultInfo === null || defaultInfo === void 0 ? void 0 : defaultInfo.symbol) && isImportableSymbol(exported, checker) && ts.addToSeen(seenExports, key)) {
|
|
129193
|
+
cache.add(importingFile.path, exported, key, moduleSymbol, moduleFile, 0 /* Named */, isFromPackageJson, checker);
|
|
129194
|
+
}
|
|
129195
|
+
});
|
|
128993
129196
|
});
|
|
128994
|
-
}
|
|
129197
|
+
}
|
|
129198
|
+
catch (err) {
|
|
129199
|
+
// Ensure cache is reset if operation is cancelled
|
|
129200
|
+
cache.clear();
|
|
129201
|
+
throw err;
|
|
129202
|
+
}
|
|
128995
129203
|
(_e = host.log) === null || _e === void 0 ? void 0 : _e.call(host, "getExportInfoMap: done in " + (ts.timestamp() - start) + " ms");
|
|
128996
129204
|
return cache;
|
|
128997
129205
|
}
|
|
@@ -131180,7 +131388,7 @@ var ts;
|
|
|
131180
131388
|
KeywordCompletionFilters[KeywordCompletionFilters["TypeAssertionKeywords"] = 6] = "TypeAssertionKeywords";
|
|
131181
131389
|
KeywordCompletionFilters[KeywordCompletionFilters["TypeKeywords"] = 7] = "TypeKeywords";
|
|
131182
131390
|
KeywordCompletionFilters[KeywordCompletionFilters["TypeKeyword"] = 8] = "TypeKeyword";
|
|
131183
|
-
KeywordCompletionFilters[KeywordCompletionFilters["Last"] =
|
|
131391
|
+
KeywordCompletionFilters[KeywordCompletionFilters["Last"] = 8] = "Last";
|
|
131184
131392
|
})(KeywordCompletionFilters || (KeywordCompletionFilters = {}));
|
|
131185
131393
|
var GlobalsSearch;
|
|
131186
131394
|
(function (GlobalsSearch) {
|
|
@@ -131430,7 +131638,7 @@ var ts;
|
|
|
131430
131638
|
var entryNames_1 = new ts.Set(entries.map(function (e) { return e.name; }));
|
|
131431
131639
|
for (var _i = 0, _a = getKeywordCompletions(keywordFilters, !insideJsDocTagTypeExpression && ts.isSourceFileJS(sourceFile)); _i < _a.length; _i++) {
|
|
131432
131640
|
var keywordEntry = _a[_i];
|
|
131433
|
-
if (!entryNames_1.has(keywordEntry.name)) {
|
|
131641
|
+
if (isTypeOnlyLocation && ts.isTypeKeyword(ts.stringToToken(keywordEntry.name)) || !entryNames_1.has(keywordEntry.name)) {
|
|
131434
131642
|
ts.insertSorted(entries, keywordEntry, compareCompletionEntries, /*allowDuplicates*/ true);
|
|
131435
131643
|
}
|
|
131436
131644
|
}
|
|
@@ -134149,7 +134357,7 @@ var ts;
|
|
|
134149
134357
|
function getKeywordCompletions(keywordFilter, filterOutTsOnlyKeywords) {
|
|
134150
134358
|
if (!filterOutTsOnlyKeywords)
|
|
134151
134359
|
return getTypescriptKeywordCompletions(keywordFilter);
|
|
134152
|
-
var index = keywordFilter +
|
|
134360
|
+
var index = keywordFilter + 8 /* Last */ + 1;
|
|
134153
134361
|
return _keywordCompletions[index] ||
|
|
134154
134362
|
(_keywordCompletions[index] = getTypescriptKeywordCompletions(keywordFilter)
|
|
134155
134363
|
.filter(function (entry) { return !isTypeScriptOnlyKeyword(ts.stringToToken(entry.name)); }));
|
|
@@ -146574,6 +146782,9 @@ var ts;
|
|
|
146574
146782
|
consumeTokenAndAdvanceScanner(tokenInfo, node, nodeDynamicIndentation, node);
|
|
146575
146783
|
}
|
|
146576
146784
|
function processChildNode(child, inheritedIndentation, parent, parentDynamicIndentation, parentStartLine, undecoratedParentStartLine, isListItem, isFirstListItem) {
|
|
146785
|
+
if (ts.nodeIsMissing(child)) {
|
|
146786
|
+
return inheritedIndentation;
|
|
146787
|
+
}
|
|
146577
146788
|
var childStartPos = child.getStart(sourceFile);
|
|
146578
146789
|
var childStartLine = sourceFile.getLineAndCharacterOfPosition(childStartPos).line;
|
|
146579
146790
|
var undecoratedChildStartLine = childStartLine;
|
|
@@ -174412,10 +174623,11 @@ var ts;
|
|
|
174412
174623
|
var outputs = [];
|
|
174413
174624
|
combineProjectOutputWorker(projects, defaultProject, initialLocation,
|
|
174414
174625
|
/*isForRename*/ false, function (project, location, getMappedLocation) {
|
|
174626
|
+
var _a, _b;
|
|
174415
174627
|
logger.info("Finding references to " + location.fileName + " position " + location.pos + " in project " + project.getProjectName());
|
|
174416
174628
|
var projectOutputs = project.getLanguageService().findReferences(location.fileName, location.pos);
|
|
174417
174629
|
if (projectOutputs) {
|
|
174418
|
-
var clearIsDefinition = projectOutputs[0].references[0].isDefinition === undefined;
|
|
174630
|
+
var clearIsDefinition = ((_b = (_a = projectOutputs[0]) === null || _a === void 0 ? void 0 : _a.references[0]) === null || _b === void 0 ? void 0 : _b.isDefinition) === undefined;
|
|
174419
174631
|
var _loop_9 = function (referencedSymbol) {
|
|
174420
174632
|
var mappedDefinitionFile = getMappedLocation(project, documentSpanLocation(referencedSymbol.definition));
|
|
174421
174633
|
var definition = mappedDefinitionFile === undefined ?
|
|
@@ -174425,8 +174637,8 @@ var ts;
|
|
|
174425
174637
|
symbolToAddTo = { definition: definition, references: [] };
|
|
174426
174638
|
outputs.push(symbolToAddTo);
|
|
174427
174639
|
}
|
|
174428
|
-
for (var
|
|
174429
|
-
var ref =
|
|
174640
|
+
for (var _c = 0, _d = referencedSymbol.references; _c < _d.length; _c++) {
|
|
174641
|
+
var ref = _d[_c];
|
|
174430
174642
|
// If it's in a mapped file, that is added to the todo list by `getMappedLocation`.
|
|
174431
174643
|
if (!ts.contains(symbolToAddTo.references, ref, ts.documentSpansEqual) && !getMappedLocation(project, documentSpanLocation(ref))) {
|
|
174432
174644
|
if (clearIsDefinition) {
|