@typescript-deploys/pr-build 4.7.0-pr-48581-7 → 4.7.0-pr-48788-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cs/diagnosticMessages.generated.json +2 -0
- package/lib/de/diagnosticMessages.generated.json +2 -0
- package/lib/es/diagnosticMessages.generated.json +2 -0
- package/lib/fr/diagnosticMessages.generated.json +2 -0
- package/lib/it/diagnosticMessages.generated.json +2 -0
- package/lib/ja/diagnosticMessages.generated.json +2 -0
- package/lib/ko/diagnosticMessages.generated.json +2 -0
- package/lib/pl/diagnosticMessages.generated.json +2 -0
- package/lib/protocol.d.ts +4 -0
- package/lib/pt-br/diagnosticMessages.generated.json +2 -0
- package/lib/ru/diagnosticMessages.generated.json +2 -0
- package/lib/tr/diagnosticMessages.generated.json +2 -0
- package/lib/tsc.js +297 -240
- package/lib/tsserver.js +782 -382
- package/lib/tsserverlibrary.d.ts +7 -2
- package/lib/tsserverlibrary.js +782 -382
- package/lib/typescript.d.ts +0 -1
- package/lib/typescript.js +541 -362
- package/lib/typescriptServices.d.ts +0 -1
- package/lib/typescriptServices.js +541 -362
- package/lib/typingsInstaller.js +364 -279
- package/lib/zh-cn/diagnosticMessages.generated.json +2 -0
- package/lib/zh-tw/diagnosticMessages.generated.json +2 -0
- package/package.json +1 -1
package/lib/typingsInstaller.js
CHANGED
|
@@ -89,7 +89,7 @@ var ts;
|
|
|
89
89
|
// The following is baselined as a literal template type without intervention
|
|
90
90
|
/** The version of the TypeScript compiler release */
|
|
91
91
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
92
|
-
ts.version = ts.versionMajorMinor + ".0-insiders.
|
|
92
|
+
ts.version = ts.versionMajorMinor + ".0-insiders.20220420";
|
|
93
93
|
/* @internal */
|
|
94
94
|
var Comparison;
|
|
95
95
|
(function (Comparison) {
|
|
@@ -4649,7 +4649,6 @@ var ts;
|
|
|
4649
4649
|
NodeBuilderFlags[NodeBuilderFlags["UseAliasDefinedOutsideCurrentScope"] = 16384] = "UseAliasDefinedOutsideCurrentScope";
|
|
4650
4650
|
NodeBuilderFlags[NodeBuilderFlags["UseSingleQuotesForStringLiteralType"] = 268435456] = "UseSingleQuotesForStringLiteralType";
|
|
4651
4651
|
NodeBuilderFlags[NodeBuilderFlags["NoTypeReduction"] = 536870912] = "NoTypeReduction";
|
|
4652
|
-
NodeBuilderFlags[NodeBuilderFlags["NoUndefinedOptionalParameterType"] = 1073741824] = "NoUndefinedOptionalParameterType";
|
|
4653
4652
|
// Error handling
|
|
4654
4653
|
NodeBuilderFlags[NodeBuilderFlags["AllowThisInObjectLiteral"] = 32768] = "AllowThisInObjectLiteral";
|
|
4655
4654
|
NodeBuilderFlags[NodeBuilderFlags["AllowQualifiedNameInPlaceOfIdentifier"] = 65536] = "AllowQualifiedNameInPlaceOfIdentifier";
|
|
@@ -8706,6 +8705,7 @@ var ts;
|
|
|
8706
8705
|
_0_index_signatures_are_incompatible: diag(2634, ts.DiagnosticCategory.Error, "_0_index_signatures_are_incompatible_2634", "'{0}' index signatures are incompatible."),
|
|
8707
8706
|
Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable: diag(2635, ts.DiagnosticCategory.Error, "Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable_2635", "Type '{0}' has no signatures for which the type argument list is applicable."),
|
|
8708
8707
|
Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation: diag(2636, ts.DiagnosticCategory.Error, "Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation_2636", "Type '{0}' is not assignable to type '{1}' as implied by variance annotation."),
|
|
8708
|
+
Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types: diag(2637, ts.DiagnosticCategory.Error, "Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_t_2637", "Variance annotations are only supported in type aliases for object, function, constructor, and mapped types."),
|
|
8709
8709
|
Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity: diag(2649, ts.DiagnosticCategory.Error, "Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity_2649", "Cannot augment module '{0}' with value exports because it resolves to a non-module entity."),
|
|
8710
8710
|
A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: diag(2651, ts.DiagnosticCategory.Error, "A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651", "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums."),
|
|
8711
8711
|
Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: diag(2652, ts.DiagnosticCategory.Error, "Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_d_2652", "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead."),
|
|
@@ -14954,6 +14954,10 @@ var ts;
|
|
|
14954
14954
|
}
|
|
14955
14955
|
}
|
|
14956
14956
|
ts.isAnyImportSyntax = isAnyImportSyntax;
|
|
14957
|
+
function isAnyImportOrBareOrAccessedRequire(node) {
|
|
14958
|
+
return isAnyImportSyntax(node) || isVariableDeclarationInitializedToBareOrAccessedRequire(node);
|
|
14959
|
+
}
|
|
14960
|
+
ts.isAnyImportOrBareOrAccessedRequire = isAnyImportOrBareOrAccessedRequire;
|
|
14957
14961
|
function isLateVisibilityPaintedStatement(node) {
|
|
14958
14962
|
switch (node.kind) {
|
|
14959
14963
|
case 266 /* ImportDeclaration */:
|
|
@@ -16314,17 +16318,13 @@ var ts;
|
|
|
16314
16318
|
if (isPropertyNameLiteral(name) && isPropertyNameLiteral(initializer)) {
|
|
16315
16319
|
return getTextOfIdentifierOrLiteral(name) === getTextOfIdentifierOrLiteral(initializer);
|
|
16316
16320
|
}
|
|
16317
|
-
if (ts.
|
|
16321
|
+
if (ts.isMemberName(name) && isLiteralLikeAccess(initializer) &&
|
|
16318
16322
|
(initializer.expression.kind === 108 /* ThisKeyword */ ||
|
|
16319
16323
|
ts.isIdentifier(initializer.expression) &&
|
|
16320
16324
|
(initializer.expression.escapedText === "window" ||
|
|
16321
16325
|
initializer.expression.escapedText === "self" ||
|
|
16322
16326
|
initializer.expression.escapedText === "global"))) {
|
|
16323
|
-
|
|
16324
|
-
if (ts.isPrivateIdentifier(nameOrArgument)) {
|
|
16325
|
-
ts.Debug.fail("Unexpected PrivateIdentifier in name expression with literal-like access.");
|
|
16326
|
-
}
|
|
16327
|
-
return isSameEntityName(name, nameOrArgument);
|
|
16327
|
+
return isSameEntityName(name, getNameOrArgument(initializer));
|
|
16328
16328
|
}
|
|
16329
16329
|
if (isLiteralLikeAccess(name) && isLiteralLikeAccess(initializer)) {
|
|
16330
16330
|
return getElementOrPropertyAccessName(name) === getElementOrPropertyAccessName(initializer)
|
|
@@ -16532,14 +16532,14 @@ var ts;
|
|
|
16532
16532
|
}
|
|
16533
16533
|
ts.isFunctionSymbol = isFunctionSymbol;
|
|
16534
16534
|
function tryGetModuleSpecifierFromDeclaration(node) {
|
|
16535
|
-
var _a, _b
|
|
16535
|
+
var _a, _b;
|
|
16536
16536
|
switch (node.kind) {
|
|
16537
16537
|
case 254 /* VariableDeclaration */:
|
|
16538
|
-
return node.initializer.arguments[0]
|
|
16538
|
+
return (_a = ts.findAncestor(node.initializer, function (node) { return isRequireCall(node, /*requireStringLiteralLikeArgument*/ true); })) === null || _a === void 0 ? void 0 : _a.arguments[0];
|
|
16539
16539
|
case 266 /* ImportDeclaration */:
|
|
16540
|
-
return
|
|
16540
|
+
return ts.tryCast(node.moduleSpecifier, ts.isStringLiteralLike);
|
|
16541
16541
|
case 265 /* ImportEqualsDeclaration */:
|
|
16542
|
-
return
|
|
16542
|
+
return ts.tryCast((_b = ts.tryCast(node.moduleReference, ts.isExternalModuleReference)) === null || _b === void 0 ? void 0 : _b.expression, ts.isStringLiteralLike);
|
|
16543
16543
|
default:
|
|
16544
16544
|
ts.Debug.assertNever(node);
|
|
16545
16545
|
}
|
|
@@ -17054,7 +17054,10 @@ var ts;
|
|
|
17054
17054
|
return parent.propertyName === node;
|
|
17055
17055
|
case 275 /* ExportSpecifier */:
|
|
17056
17056
|
case 285 /* JsxAttribute */:
|
|
17057
|
-
|
|
17057
|
+
case 279 /* JsxSelfClosingElement */:
|
|
17058
|
+
case 280 /* JsxOpeningElement */:
|
|
17059
|
+
case 281 /* JsxClosingElement */:
|
|
17060
|
+
// Any name in an export specifier or JSX Attribute or Jsx Element
|
|
17058
17061
|
return true;
|
|
17059
17062
|
}
|
|
17060
17063
|
return false;
|
|
@@ -17070,21 +17073,28 @@ var ts;
|
|
|
17070
17073
|
// export = <EntityNameExpression>
|
|
17071
17074
|
// export default <EntityNameExpression>
|
|
17072
17075
|
// module.exports = <EntityNameExpression>
|
|
17073
|
-
//
|
|
17074
|
-
//
|
|
17076
|
+
// module.exports.x = <EntityNameExpression>
|
|
17077
|
+
// const x = require("...")
|
|
17078
|
+
// const { x } = require("...")
|
|
17079
|
+
// const x = require("...").y
|
|
17080
|
+
// const { x } = require("...").y
|
|
17075
17081
|
function isAliasSymbolDeclaration(node) {
|
|
17076
|
-
|
|
17082
|
+
if (node.kind === 265 /* ImportEqualsDeclaration */ ||
|
|
17077
17083
|
node.kind === 264 /* NamespaceExportDeclaration */ ||
|
|
17078
17084
|
node.kind === 267 /* ImportClause */ && !!node.name ||
|
|
17079
17085
|
node.kind === 268 /* NamespaceImport */ ||
|
|
17080
17086
|
node.kind === 274 /* NamespaceExport */ ||
|
|
17081
17087
|
node.kind === 270 /* ImportSpecifier */ ||
|
|
17082
17088
|
node.kind === 275 /* ExportSpecifier */ ||
|
|
17083
|
-
node.kind === 271 /* ExportAssignment */ && exportAssignmentIsAlias(node)
|
|
17084
|
-
|
|
17085
|
-
|
|
17086
|
-
|
|
17087
|
-
|
|
17089
|
+
node.kind === 271 /* ExportAssignment */ && exportAssignmentIsAlias(node)) {
|
|
17090
|
+
return true;
|
|
17091
|
+
}
|
|
17092
|
+
return isInJSFile(node) && (ts.isBinaryExpression(node) && getAssignmentDeclarationKind(node) === 2 /* ModuleExports */ && exportAssignmentIsAlias(node) ||
|
|
17093
|
+
ts.isPropertyAccessExpression(node)
|
|
17094
|
+
&& ts.isBinaryExpression(node.parent)
|
|
17095
|
+
&& node.parent.left === node
|
|
17096
|
+
&& node.parent.operatorToken.kind === 63 /* EqualsToken */
|
|
17097
|
+
&& isAliasableExpression(node.parent.right));
|
|
17088
17098
|
}
|
|
17089
17099
|
ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration;
|
|
17090
17100
|
function getAliasDeclarationFromName(node) {
|
|
@@ -17095,6 +17105,7 @@ var ts;
|
|
|
17095
17105
|
case 275 /* ExportSpecifier */:
|
|
17096
17106
|
case 271 /* ExportAssignment */:
|
|
17097
17107
|
case 265 /* ImportEqualsDeclaration */:
|
|
17108
|
+
case 274 /* NamespaceExport */:
|
|
17098
17109
|
return node.parent;
|
|
17099
17110
|
case 161 /* QualifiedName */:
|
|
17100
17111
|
do {
|
|
@@ -18921,6 +18932,11 @@ var ts;
|
|
|
18921
18932
|
(node.parent.kind === 206 /* PropertyAccessExpression */ && node.parent.name === node);
|
|
18922
18933
|
}
|
|
18923
18934
|
ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess;
|
|
18935
|
+
function isRightSideOfAccessExpression(node) {
|
|
18936
|
+
return ts.isPropertyAccessExpression(node.parent) && node.parent.name === node
|
|
18937
|
+
|| ts.isElementAccessExpression(node.parent) && node.parent.argumentExpression === node;
|
|
18938
|
+
}
|
|
18939
|
+
ts.isRightSideOfAccessExpression = isRightSideOfAccessExpression;
|
|
18924
18940
|
function isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName(node) {
|
|
18925
18941
|
return ts.isQualifiedName(node.parent) && node.parent.right === node
|
|
18926
18942
|
|| ts.isPropertyAccessExpression(node.parent) && node.parent.name === node
|
|
@@ -19572,6 +19588,41 @@ var ts;
|
|
|
19572
19588
|
return expr;
|
|
19573
19589
|
}
|
|
19574
19590
|
ts.getLeftmostAccessExpression = getLeftmostAccessExpression;
|
|
19591
|
+
function forEachNameInAccessChainWalkingLeft(name, action) {
|
|
19592
|
+
if (isAccessExpression(name.parent) && isRightSideOfAccessExpression(name)) {
|
|
19593
|
+
return walkAccessExpression(name.parent);
|
|
19594
|
+
}
|
|
19595
|
+
function walkAccessExpression(access) {
|
|
19596
|
+
if (access.kind === 206 /* PropertyAccessExpression */) {
|
|
19597
|
+
var res = action(access.name);
|
|
19598
|
+
if (res !== undefined) {
|
|
19599
|
+
return res;
|
|
19600
|
+
}
|
|
19601
|
+
}
|
|
19602
|
+
else if (access.kind === 207 /* ElementAccessExpression */) {
|
|
19603
|
+
if (ts.isIdentifier(access.argumentExpression) || ts.isStringLiteralLike(access.argumentExpression)) {
|
|
19604
|
+
var res = action(access.argumentExpression);
|
|
19605
|
+
if (res !== undefined) {
|
|
19606
|
+
return res;
|
|
19607
|
+
}
|
|
19608
|
+
}
|
|
19609
|
+
else {
|
|
19610
|
+
// Chain interrupted by non-static-name access 'x[expr()].y.z'
|
|
19611
|
+
return undefined;
|
|
19612
|
+
}
|
|
19613
|
+
}
|
|
19614
|
+
if (isAccessExpression(access.expression)) {
|
|
19615
|
+
return walkAccessExpression(access.expression);
|
|
19616
|
+
}
|
|
19617
|
+
if (ts.isIdentifier(access.expression)) {
|
|
19618
|
+
// End of chain at Identifier 'x.y.z'
|
|
19619
|
+
return action(access.expression);
|
|
19620
|
+
}
|
|
19621
|
+
// End of chain at non-Identifier 'x().y.z'
|
|
19622
|
+
return undefined;
|
|
19623
|
+
}
|
|
19624
|
+
}
|
|
19625
|
+
ts.forEachNameInAccessChainWalkingLeft = forEachNameInAccessChainWalkingLeft;
|
|
19575
19626
|
function getLeftmostExpression(node, stopAtCallExpressions) {
|
|
19576
19627
|
while (true) {
|
|
19577
19628
|
switch (node.kind) {
|
|
@@ -20519,6 +20570,7 @@ var ts;
|
|
|
20519
20570
|
ts.supportedJSExtensionsFlat = ts.flatten(ts.supportedJSExtensions);
|
|
20520
20571
|
var allSupportedExtensions = [[".ts" /* Ts */, ".tsx" /* Tsx */, ".d.ts" /* Dts */, ".js" /* Js */, ".jsx" /* Jsx */], [".cts" /* Cts */, ".d.cts" /* Dcts */, ".cjs" /* Cjs */], [".mts" /* Mts */, ".d.mts" /* Dmts */, ".mjs" /* Mjs */]];
|
|
20521
20572
|
var allSupportedExtensionsWithJson = __spreadArray(__spreadArray([], allSupportedExtensions, true), [[".json" /* Json */]], false);
|
|
20573
|
+
ts.supportedDeclarationExtensions = [".d.ts" /* Dts */, ".d.cts" /* Dcts */, ".d.mts" /* Dmts */];
|
|
20522
20574
|
function getSupportedExtensions(options, extraFileExtensions) {
|
|
20523
20575
|
var needJsExtensions = options && getAllowJSCompilerOption(options);
|
|
20524
20576
|
if (!extraFileExtensions || extraFileExtensions.length === 0) {
|
|
@@ -21207,6 +21259,11 @@ var ts;
|
|
|
21207
21259
|
return state > 1 /* NodeModules */ ? { topLevelNodeModulesIndex: topLevelNodeModulesIndex, topLevelPackageNameIndex: topLevelPackageNameIndex, packageRootIndex: packageRootIndex, fileNameIndex: fileNameIndex } : undefined;
|
|
21208
21260
|
}
|
|
21209
21261
|
ts.getNodeModulePathParts = getNodeModulePathParts;
|
|
21262
|
+
function getParameterTypeNode(parameter) {
|
|
21263
|
+
var _a;
|
|
21264
|
+
return parameter.kind === 340 /* JSDocParameterTag */ ? (_a = parameter.typeExpression) === null || _a === void 0 ? void 0 : _a.type : parameter.type;
|
|
21265
|
+
}
|
|
21266
|
+
ts.getParameterTypeNode = getParameterTypeNode;
|
|
21210
21267
|
})(ts || (ts = {}));
|
|
21211
21268
|
/* @internal */
|
|
21212
21269
|
var ts;
|
|
@@ -33118,7 +33175,8 @@ var ts;
|
|
|
33118
33175
|
var pos = getNodePos();
|
|
33119
33176
|
parseExpected(112 /* TypeOfKeyword */);
|
|
33120
33177
|
var entityName = parseEntityName(/*allowReservedWords*/ true, /*allowPrivateIdentifiers*/ true);
|
|
33121
|
-
|
|
33178
|
+
// Make sure we perform ASI to prevent parsing the next line's type arguments as part of an instantiation expression.
|
|
33179
|
+
var typeArguments = !scanner.hasPrecedingLineBreak() ? tryParseTypeArguments() : undefined;
|
|
33122
33180
|
return finishNode(factory.createTypeQueryNode(entityName, typeArguments), pos);
|
|
33123
33181
|
}
|
|
33124
33182
|
function parseTypeParameter() {
|
|
@@ -34437,23 +34495,7 @@ var ts;
|
|
|
34437
34495
|
return undefined;
|
|
34438
34496
|
}
|
|
34439
34497
|
}
|
|
34440
|
-
|
|
34441
|
-
// x ? y => ({ y }) : z => ({ z })
|
|
34442
|
-
// We try to parse the body of the first arrow function by looking at:
|
|
34443
|
-
// ({ y }) : z => ({ z })
|
|
34444
|
-
// This is a valid arrow function with "z" as the return type.
|
|
34445
|
-
//
|
|
34446
|
-
// But, if we're in the true side of a conditional expression, this colon
|
|
34447
|
-
// terminates the expression, so we cannot allow a return type if we aren't
|
|
34448
|
-
// certain whether or not the preceding text was parsed as a parameter list.
|
|
34449
|
-
//
|
|
34450
|
-
// For example,
|
|
34451
|
-
// a() ? (b: number, c?: string): void => d() : e
|
|
34452
|
-
// is determined by isParenthesizedArrowFunctionExpression to unambiguously
|
|
34453
|
-
// be an arrow expression, so we allow a return type.
|
|
34454
|
-
if (disallowReturnTypeInArrowFunction && token() === 58 /* ColonToken */) {
|
|
34455
|
-
return undefined;
|
|
34456
|
-
}
|
|
34498
|
+
var hasReturnColon = token() === 58 /* ColonToken */;
|
|
34457
34499
|
var type = parseReturnType(58 /* ColonToken */, /*isType*/ false);
|
|
34458
34500
|
if (type && !allowAmbiguity && typeHasArrowFunctionBlockingParseError(type)) {
|
|
34459
34501
|
return undefined;
|
|
@@ -34484,6 +34526,30 @@ var ts;
|
|
|
34484
34526
|
var body = (lastToken === 38 /* EqualsGreaterThanToken */ || lastToken === 18 /* OpenBraceToken */)
|
|
34485
34527
|
? parseArrowFunctionExpressionBody(ts.some(modifiers, ts.isAsyncModifier), disallowReturnTypeInArrowFunction)
|
|
34486
34528
|
: parseIdentifier();
|
|
34529
|
+
// Given:
|
|
34530
|
+
// x ? y => ({ y }) : z => ({ z })
|
|
34531
|
+
// We try to parse the body of the first arrow function by looking at:
|
|
34532
|
+
// ({ y }) : z => ({ z })
|
|
34533
|
+
// This is a valid arrow function with "z" as the return type.
|
|
34534
|
+
//
|
|
34535
|
+
// But, if we're in the true side of a conditional expression, this colon
|
|
34536
|
+
// terminates the expression, so we cannot allow a return type if we aren't
|
|
34537
|
+
// certain whether or not the preceding text was parsed as a parameter list.
|
|
34538
|
+
//
|
|
34539
|
+
// For example,
|
|
34540
|
+
// a() ? (b: number, c?: string): void => d() : e
|
|
34541
|
+
// is determined by isParenthesizedArrowFunctionExpression to unambiguously
|
|
34542
|
+
// be an arrow expression, so we allow a return type.
|
|
34543
|
+
if (disallowReturnTypeInArrowFunction && hasReturnColon) {
|
|
34544
|
+
// However, if the arrow function we were able to parse is followed by another colon
|
|
34545
|
+
// as in:
|
|
34546
|
+
// a ? (x): string => x : null
|
|
34547
|
+
// Then allow the arrow function, and treat the second colon as terminating
|
|
34548
|
+
// the conditional expression.
|
|
34549
|
+
if (token() !== 58 /* ColonToken */) {
|
|
34550
|
+
return undefined;
|
|
34551
|
+
}
|
|
34552
|
+
}
|
|
34487
34553
|
var node = factory.createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body);
|
|
34488
34554
|
return withJSDoc(finishNode(node, pos), hasJSDoc);
|
|
34489
34555
|
}
|
|
@@ -35360,34 +35426,10 @@ var ts;
|
|
|
35360
35426
|
case 20 /* OpenParenToken */: // foo<x>(
|
|
35361
35427
|
case 14 /* NoSubstitutionTemplateLiteral */: // foo<T> `...`
|
|
35362
35428
|
case 15 /* TemplateHead */: // foo<T> `...${100}...`
|
|
35363
|
-
// These tokens can't follow in a call expression, nor can they start an
|
|
35364
|
-
// expression. So, consider the type argument list part of an instantiation
|
|
35365
|
-
// expression.
|
|
35366
|
-
// falls through
|
|
35367
|
-
case 27 /* CommaToken */: // foo<x>,
|
|
35368
|
-
case 24 /* DotToken */: // foo<x>.
|
|
35369
|
-
case 28 /* QuestionDotToken */: // foo<x>?.
|
|
35370
|
-
case 21 /* CloseParenToken */: // foo<x>)
|
|
35371
|
-
case 23 /* CloseBracketToken */: // foo<x>]
|
|
35372
|
-
case 58 /* ColonToken */: // foo<x>:
|
|
35373
|
-
case 26 /* SemicolonToken */: // foo<x>;
|
|
35374
|
-
case 57 /* QuestionToken */: // foo<x>?
|
|
35375
|
-
case 34 /* EqualsEqualsToken */: // foo<x> ==
|
|
35376
|
-
case 36 /* EqualsEqualsEqualsToken */: // foo<x> ===
|
|
35377
|
-
case 35 /* ExclamationEqualsToken */: // foo<x> !=
|
|
35378
|
-
case 37 /* ExclamationEqualsEqualsToken */: // foo<x> !==
|
|
35379
|
-
case 55 /* AmpersandAmpersandToken */: // foo<x> &&
|
|
35380
|
-
case 56 /* BarBarToken */: // foo<x> ||
|
|
35381
|
-
case 60 /* QuestionQuestionToken */: // foo<x> ??
|
|
35382
|
-
case 52 /* CaretToken */: // foo<x> ^
|
|
35383
|
-
case 50 /* AmpersandToken */: // foo<x> &
|
|
35384
|
-
case 51 /* BarToken */: // foo<x> |
|
|
35385
|
-
case 19 /* CloseBraceToken */: // foo<x> }
|
|
35386
|
-
case 1 /* EndOfFileToken */: // foo<x>
|
|
35387
35429
|
return true;
|
|
35388
35430
|
}
|
|
35389
|
-
//
|
|
35390
|
-
return
|
|
35431
|
+
// Consider something a type argument list only if the following token can't start an expression.
|
|
35432
|
+
return !isStartOfExpression();
|
|
35391
35433
|
}
|
|
35392
35434
|
function parsePrimaryExpression() {
|
|
35393
35435
|
switch (token()) {
|
|
@@ -38605,7 +38647,7 @@ var ts;
|
|
|
38605
38647
|
})(IncrementalParser || (IncrementalParser = {}));
|
|
38606
38648
|
/** @internal */
|
|
38607
38649
|
function isDeclarationFileName(fileName) {
|
|
38608
|
-
return ts.fileExtensionIsOneOf(fileName,
|
|
38650
|
+
return ts.fileExtensionIsOneOf(fileName, ts.supportedDeclarationExtensions);
|
|
38609
38651
|
}
|
|
38610
38652
|
ts.isDeclarationFileName = isDeclarationFileName;
|
|
38611
38653
|
function parseResolutionMode(mode, pos, end, reportDiagnostic) {
|
|
@@ -42113,7 +42155,8 @@ var ts;
|
|
|
42113
42155
|
Extensions[Extensions["JavaScript"] = 1] = "JavaScript";
|
|
42114
42156
|
Extensions[Extensions["Json"] = 2] = "Json";
|
|
42115
42157
|
Extensions[Extensions["TSConfig"] = 3] = "TSConfig";
|
|
42116
|
-
Extensions[Extensions["DtsOnly"] = 4] = "DtsOnly";
|
|
42158
|
+
Extensions[Extensions["DtsOnly"] = 4] = "DtsOnly";
|
|
42159
|
+
Extensions[Extensions["TsOnly"] = 5] = "TsOnly";
|
|
42117
42160
|
})(Extensions || (Extensions = {}));
|
|
42118
42161
|
/** Used with `Extensions.DtsOnly` to extract the path from TypeScript results. */
|
|
42119
42162
|
function resolvedTypeScriptOnly(resolved) {
|
|
@@ -43058,7 +43101,21 @@ var ts;
|
|
|
43058
43101
|
return nodeModuleNameResolverWorker(NodeResolutionFeatures.None, moduleName, initialDir, { moduleResolution: ts.ModuleResolutionKind.NodeJs, allowJs: true }, host, /*cache*/ undefined, jsOnlyExtensions, /*redirectedReferences*/ undefined);
|
|
43059
43102
|
}
|
|
43060
43103
|
function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, lookupConfig) {
|
|
43061
|
-
|
|
43104
|
+
var extensions;
|
|
43105
|
+
if (lookupConfig) {
|
|
43106
|
+
extensions = tsconfigExtensions;
|
|
43107
|
+
}
|
|
43108
|
+
else if (compilerOptions.noDtsResolution) {
|
|
43109
|
+
extensions = [Extensions.TsOnly];
|
|
43110
|
+
if (compilerOptions.allowJs)
|
|
43111
|
+
extensions.push(Extensions.JavaScript);
|
|
43112
|
+
if (compilerOptions.resolveJsonModule)
|
|
43113
|
+
extensions.push(Extensions.Json);
|
|
43114
|
+
}
|
|
43115
|
+
else {
|
|
43116
|
+
extensions = compilerOptions.resolveJsonModule ? tsPlusJsonExtensions : tsExtensions;
|
|
43117
|
+
}
|
|
43118
|
+
return nodeModuleNameResolverWorker(NodeResolutionFeatures.None, moduleName, ts.getDirectoryPath(containingFile), compilerOptions, host, cache, extensions, redirectedReference);
|
|
43062
43119
|
}
|
|
43063
43120
|
ts.nodeModuleNameResolver = nodeModuleNameResolver;
|
|
43064
43121
|
function nodeModuleNameResolverWorker(features, moduleName, containingDirectory, compilerOptions, host, cache, extensions, redirectedReference) {
|
|
@@ -43067,6 +43124,10 @@ var ts;
|
|
|
43067
43124
|
var failedLookupLocations = [];
|
|
43068
43125
|
// conditions are only used by the node12/nodenext resolver - there's no priority order in the list,
|
|
43069
43126
|
//it's essentially a set (priority is determined by object insertion order in the object we look at).
|
|
43127
|
+
var conditions = features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"];
|
|
43128
|
+
if (compilerOptions.noDtsResolution) {
|
|
43129
|
+
conditions.pop();
|
|
43130
|
+
}
|
|
43070
43131
|
var state = {
|
|
43071
43132
|
compilerOptions: compilerOptions,
|
|
43072
43133
|
host: host,
|
|
@@ -43074,7 +43135,7 @@ var ts;
|
|
|
43074
43135
|
failedLookupLocations: failedLookupLocations,
|
|
43075
43136
|
packageJsonInfoCache: cache,
|
|
43076
43137
|
features: features,
|
|
43077
|
-
conditions:
|
|
43138
|
+
conditions: conditions,
|
|
43078
43139
|
};
|
|
43079
43140
|
var result = ts.forEach(extensions, function (ext) { return tryResolve(ext); });
|
|
43080
43141
|
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);
|
|
@@ -43250,9 +43311,9 @@ var ts;
|
|
|
43250
43311
|
}
|
|
43251
43312
|
}
|
|
43252
43313
|
function loadJSOrExactTSFileName(extensions, candidate, onlyRecordFailures, state) {
|
|
43253
|
-
if ((extensions === Extensions.TypeScript || extensions === Extensions.DtsOnly) && ts.
|
|
43314
|
+
if ((extensions === Extensions.TypeScript || extensions === Extensions.DtsOnly) && ts.isDeclarationFileName(candidate)) {
|
|
43254
43315
|
var result = tryFile(candidate, onlyRecordFailures, state);
|
|
43255
|
-
return result !== undefined ? { path: candidate, ext: ts.forEach(
|
|
43316
|
+
return result !== undefined ? { path: candidate, ext: ts.forEach(ts.supportedDeclarationExtensions, function (e) { return ts.fileExtensionIs(candidate, e) ? e : undefined; }) } : undefined;
|
|
43256
43317
|
}
|
|
43257
43318
|
return loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecordFailures, state);
|
|
43258
43319
|
}
|
|
@@ -43282,20 +43343,22 @@ var ts;
|
|
|
43282
43343
|
default: return tryExtension(".d.ts" /* Dts */);
|
|
43283
43344
|
}
|
|
43284
43345
|
case Extensions.TypeScript:
|
|
43346
|
+
case Extensions.TsOnly:
|
|
43347
|
+
var useDts = extensions === Extensions.TypeScript;
|
|
43285
43348
|
switch (originalExtension) {
|
|
43286
43349
|
case ".mjs" /* Mjs */:
|
|
43287
43350
|
case ".mts" /* Mts */:
|
|
43288
43351
|
case ".d.mts" /* Dmts */:
|
|
43289
|
-
return tryExtension(".mts" /* Mts */) || tryExtension(".d.mts" /* Dmts */);
|
|
43352
|
+
return tryExtension(".mts" /* Mts */) || (useDts ? tryExtension(".d.mts" /* Dmts */) : undefined);
|
|
43290
43353
|
case ".cjs" /* Cjs */:
|
|
43291
43354
|
case ".cts" /* Cts */:
|
|
43292
43355
|
case ".d.cts" /* Dcts */:
|
|
43293
|
-
return tryExtension(".cts" /* Cts */) || tryExtension(".d.cts" /* Dcts */);
|
|
43356
|
+
return tryExtension(".cts" /* Cts */) || (useDts ? tryExtension(".d.cts" /* Dcts */) : undefined);
|
|
43294
43357
|
case ".json" /* Json */:
|
|
43295
43358
|
candidate += ".json" /* Json */;
|
|
43296
|
-
return tryExtension(".d.ts" /* Dts */);
|
|
43359
|
+
return useDts ? tryExtension(".d.ts" /* Dts */) : undefined;
|
|
43297
43360
|
default:
|
|
43298
|
-
return tryExtension(".ts" /* Ts */) || tryExtension(".tsx" /* Tsx */) || tryExtension(".d.ts" /* Dts */);
|
|
43361
|
+
return tryExtension(".ts" /* Ts */) || tryExtension(".tsx" /* Tsx */) || (useDts ? tryExtension(".d.ts" /* Dts */) : undefined);
|
|
43299
43362
|
}
|
|
43300
43363
|
case Extensions.JavaScript:
|
|
43301
43364
|
switch (originalExtension) {
|
|
@@ -43522,6 +43585,7 @@ var ts;
|
|
|
43522
43585
|
switch (extensions) {
|
|
43523
43586
|
case Extensions.JavaScript:
|
|
43524
43587
|
case Extensions.Json:
|
|
43588
|
+
case Extensions.TsOnly:
|
|
43525
43589
|
packageFile = readPackageJsonMainField(jsonContent, candidate, state);
|
|
43526
43590
|
break;
|
|
43527
43591
|
case Extensions.TypeScript:
|
|
@@ -43594,14 +43658,16 @@ var ts;
|
|
|
43594
43658
|
function extensionIsOk(extensions, extension) {
|
|
43595
43659
|
switch (extensions) {
|
|
43596
43660
|
case Extensions.JavaScript:
|
|
43597
|
-
return extension === ".js" /* Js */ || extension === ".jsx" /* Jsx */;
|
|
43661
|
+
return extension === ".js" /* Js */ || extension === ".jsx" /* Jsx */ || extension === ".mjs" /* Mjs */ || extension === ".cjs" /* Cjs */;
|
|
43598
43662
|
case Extensions.TSConfig:
|
|
43599
43663
|
case Extensions.Json:
|
|
43600
43664
|
return extension === ".json" /* Json */;
|
|
43601
43665
|
case Extensions.TypeScript:
|
|
43602
|
-
return extension === ".ts" /* Ts */ || extension === ".tsx" /* Tsx */ || extension === ".d.ts" /* Dts */;
|
|
43666
|
+
return extension === ".ts" /* Ts */ || extension === ".tsx" /* Tsx */ || extension === ".mts" /* Mts */ || extension === ".cts" /* Cts */ || extension === ".d.ts" /* Dts */ || extension === ".d.mts" /* Dmts */ || extension === ".d.cts" /* Dcts */;
|
|
43667
|
+
case Extensions.TsOnly:
|
|
43668
|
+
return extension === ".ts" /* Ts */ || extension === ".tsx" /* Tsx */ || extension === ".mts" /* Mts */ || extension === ".cts" /* Cts */;
|
|
43603
43669
|
case Extensions.DtsOnly:
|
|
43604
|
-
return extension === ".d.ts" /* Dts */;
|
|
43670
|
+
return extension === ".d.ts" /* Dts */ || extension === ".d.mts" /* Dmts */ || extension === ".d.cts" /* Dcts */;
|
|
43605
43671
|
}
|
|
43606
43672
|
}
|
|
43607
43673
|
/* @internal */
|
|
@@ -45761,6 +45827,7 @@ var ts;
|
|
|
45761
45827
|
case 261 /* ModuleDeclaration */:
|
|
45762
45828
|
case 259 /* TypeAliasDeclaration */:
|
|
45763
45829
|
case 195 /* MappedType */:
|
|
45830
|
+
case 176 /* IndexSignature */:
|
|
45764
45831
|
return 1 /* IsContainer */ | 32 /* HasLocals */;
|
|
45765
45832
|
case 305 /* SourceFile */:
|
|
45766
45833
|
return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */;
|
|
@@ -45779,7 +45846,6 @@ var ts;
|
|
|
45779
45846
|
case 317 /* JSDocFunctionType */:
|
|
45780
45847
|
case 179 /* FunctionType */:
|
|
45781
45848
|
case 175 /* ConstructSignature */:
|
|
45782
|
-
case 176 /* IndexSignature */:
|
|
45783
45849
|
case 180 /* ConstructorType */:
|
|
45784
45850
|
case 170 /* ClassStaticBlockDeclaration */:
|
|
45785
45851
|
return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */;
|
|
@@ -50357,27 +50423,27 @@ var ts;
|
|
|
50357
50423
|
function resolveAlias(symbol) {
|
|
50358
50424
|
ts.Debug.assert((symbol.flags & 2097152 /* Alias */) !== 0, "Should only get Alias here.");
|
|
50359
50425
|
var links = getSymbolLinks(symbol);
|
|
50360
|
-
if (!links.
|
|
50361
|
-
links.
|
|
50426
|
+
if (!links.aliasTarget) {
|
|
50427
|
+
links.aliasTarget = resolvingSymbol;
|
|
50362
50428
|
var node = getDeclarationOfAliasSymbol(symbol);
|
|
50363
50429
|
if (!node)
|
|
50364
50430
|
return ts.Debug.fail();
|
|
50365
50431
|
var target = getTargetOfAliasDeclaration(node);
|
|
50366
|
-
if (links.
|
|
50367
|
-
links.
|
|
50432
|
+
if (links.aliasTarget === resolvingSymbol) {
|
|
50433
|
+
links.aliasTarget = target || unknownSymbol;
|
|
50368
50434
|
}
|
|
50369
50435
|
else {
|
|
50370
50436
|
error(node, ts.Diagnostics.Circular_definition_of_import_alias_0, symbolToString(symbol));
|
|
50371
50437
|
}
|
|
50372
50438
|
}
|
|
50373
|
-
else if (links.
|
|
50374
|
-
links.
|
|
50439
|
+
else if (links.aliasTarget === resolvingSymbol) {
|
|
50440
|
+
links.aliasTarget = unknownSymbol;
|
|
50375
50441
|
}
|
|
50376
|
-
return links.
|
|
50442
|
+
return links.aliasTarget;
|
|
50377
50443
|
}
|
|
50378
50444
|
function tryResolveAlias(symbol) {
|
|
50379
50445
|
var links = getSymbolLinks(symbol);
|
|
50380
|
-
if (links.
|
|
50446
|
+
if (links.aliasTarget !== resolvingSymbol) {
|
|
50381
50447
|
return resolveAlias(symbol);
|
|
50382
50448
|
}
|
|
50383
50449
|
return undefined;
|
|
@@ -52174,13 +52240,37 @@ var ts;
|
|
|
52174
52240
|
return ts.Debug.fail("Should be unreachable.");
|
|
52175
52241
|
function conditionalTypeToTypeNode(type) {
|
|
52176
52242
|
var checkTypeNode = typeToTypeNodeHelper(type.checkType, context);
|
|
52243
|
+
context.approximateLength += 15;
|
|
52244
|
+
if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ && type.root.isDistributive && !(type.checkType.flags & 262144 /* TypeParameter */)) {
|
|
52245
|
+
var newParam = createTypeParameter(createSymbol(262144 /* TypeParameter */, "T"));
|
|
52246
|
+
var name = typeParameterToName(newParam, context);
|
|
52247
|
+
var newTypeVariable = ts.factory.createTypeReferenceNode(name);
|
|
52248
|
+
context.approximateLength += 37; // 15 each for two added conditionals, 7 for an added infer type
|
|
52249
|
+
var newMapper = prependTypeMapping(type.root.checkType, newParam, type.combinedMapper || type.mapper);
|
|
52250
|
+
var saveInferTypeParameters_1 = context.inferTypeParameters;
|
|
52251
|
+
context.inferTypeParameters = type.root.inferTypeParameters;
|
|
52252
|
+
var extendsTypeNode_1 = typeToTypeNodeHelper(instantiateType(type.root.extendsType, newMapper), context);
|
|
52253
|
+
context.inferTypeParameters = saveInferTypeParameters_1;
|
|
52254
|
+
var trueTypeNode_1 = typeToTypeNodeOrCircularityElision(instantiateType(getTypeFromTypeNode(type.root.node.trueType), newMapper));
|
|
52255
|
+
var falseTypeNode_1 = typeToTypeNodeOrCircularityElision(instantiateType(getTypeFromTypeNode(type.root.node.falseType), newMapper));
|
|
52256
|
+
// outermost conditional makes `T` a type parameter, allowing the inner conditionals to be distributive
|
|
52257
|
+
// second conditional makes `T` have `T & checkType` substitution, so it is correctly usable as the checkType
|
|
52258
|
+
// inner conditional runs the check the user provided on the check type (distributively) and returns the result
|
|
52259
|
+
// checkType extends infer T ? T extends checkType ? T extends extendsType<T> ? trueType<T> : falseType<T> : never : never;
|
|
52260
|
+
// this is potentially simplifiable to
|
|
52261
|
+
// checkType extends infer T ? T extends checkType & extendsType<T> ? trueType<T> : falseType<T> : never;
|
|
52262
|
+
// but that may confuse users who read the output more.
|
|
52263
|
+
// On the other hand,
|
|
52264
|
+
// checkType extends infer T extends checkType ? T extends extendsType<T> ? trueType<T> : falseType<T> : never;
|
|
52265
|
+
// may also work with `infer ... extends ...` in, but would produce declarations only compatible with the latest TS.
|
|
52266
|
+
return ts.factory.createConditionalTypeNode(checkTypeNode, ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(/*modifiers*/ undefined, ts.factory.cloneNode(newTypeVariable.typeName))), ts.factory.createConditionalTypeNode(ts.factory.createTypeReferenceNode(ts.factory.cloneNode(name)), typeToTypeNodeHelper(type.checkType, context), ts.factory.createConditionalTypeNode(newTypeVariable, extendsTypeNode_1, trueTypeNode_1, falseTypeNode_1), ts.factory.createKeywordTypeNode(143 /* NeverKeyword */)), ts.factory.createKeywordTypeNode(143 /* NeverKeyword */));
|
|
52267
|
+
}
|
|
52177
52268
|
var saveInferTypeParameters = context.inferTypeParameters;
|
|
52178
52269
|
context.inferTypeParameters = type.root.inferTypeParameters;
|
|
52179
52270
|
var extendsTypeNode = typeToTypeNodeHelper(type.extendsType, context);
|
|
52180
52271
|
context.inferTypeParameters = saveInferTypeParameters;
|
|
52181
52272
|
var trueTypeNode = typeToTypeNodeOrCircularityElision(getTrueTypeFromConditionalType(type));
|
|
52182
52273
|
var falseTypeNode = typeToTypeNodeOrCircularityElision(getFalseTypeFromConditionalType(type));
|
|
52183
|
-
context.approximateLength += 15;
|
|
52184
52274
|
return ts.factory.createConditionalTypeNode(checkTypeNode, extendsTypeNode, trueTypeNode, falseTypeNode);
|
|
52185
52275
|
}
|
|
52186
52276
|
function typeToTypeNodeOrCircularityElision(type) {
|
|
@@ -52294,7 +52384,7 @@ var ts;
|
|
|
52294
52384
|
// Since instantiations of the same anonymous type have the same symbol, tracking symbols instead
|
|
52295
52385
|
// of types allows us to catch circular references to instantiations of the same anonymous type
|
|
52296
52386
|
if (!context.visitedTypes) {
|
|
52297
|
-
context.visitedTypes = new ts.
|
|
52387
|
+
context.visitedTypes = new ts.Set();
|
|
52298
52388
|
}
|
|
52299
52389
|
if (id && !context.symbolDepth) {
|
|
52300
52390
|
context.symbolDepth = new ts.Map();
|
|
@@ -52312,22 +52402,15 @@ var ts;
|
|
|
52312
52402
|
context.approximateLength += cachedResult.addedLength;
|
|
52313
52403
|
return deepCloneOrReuseNode(cachedResult);
|
|
52314
52404
|
}
|
|
52315
|
-
var
|
|
52316
|
-
var symbolDepth = id ? context.symbolDepth.get(id) : undefined;
|
|
52317
|
-
if (symbolDepth) {
|
|
52318
|
-
totalDepth += symbolDepth;
|
|
52319
|
-
}
|
|
52320
|
-
var visitedTypeDepth = context.visitedTypes.get(typeId);
|
|
52321
|
-
if (visitedTypeDepth) {
|
|
52322
|
-
totalDepth += visitedTypeDepth;
|
|
52323
|
-
}
|
|
52324
|
-
if (totalDepth > 10) {
|
|
52325
|
-
return createElidedInformationPlaceholder(context);
|
|
52326
|
-
}
|
|
52405
|
+
var depth;
|
|
52327
52406
|
if (id) {
|
|
52328
|
-
context.symbolDepth.
|
|
52407
|
+
depth = context.symbolDepth.get(id) || 0;
|
|
52408
|
+
if (depth > 10) {
|
|
52409
|
+
return createElidedInformationPlaceholder(context);
|
|
52410
|
+
}
|
|
52411
|
+
context.symbolDepth.set(id, depth + 1);
|
|
52329
52412
|
}
|
|
52330
|
-
context.visitedTypes.
|
|
52413
|
+
context.visitedTypes.add(typeId);
|
|
52331
52414
|
var startLength = context.approximateLength;
|
|
52332
52415
|
var result = transform(type);
|
|
52333
52416
|
var addedLength = context.approximateLength - startLength;
|
|
@@ -52338,19 +52421,9 @@ var ts;
|
|
|
52338
52421
|
result.addedLength = addedLength;
|
|
52339
52422
|
(_b = links === null || links === void 0 ? void 0 : links.serializedTypes) === null || _b === void 0 ? void 0 : _b.set(key, result);
|
|
52340
52423
|
}
|
|
52341
|
-
|
|
52342
|
-
context.visitedTypes.set(typeId, visitedTypeDepth);
|
|
52343
|
-
}
|
|
52344
|
-
else {
|
|
52345
|
-
context.visitedTypes.delete(typeId);
|
|
52346
|
-
}
|
|
52424
|
+
context.visitedTypes.delete(typeId);
|
|
52347
52425
|
if (id) {
|
|
52348
|
-
|
|
52349
|
-
context.symbolDepth.set(id, symbolDepth);
|
|
52350
|
-
}
|
|
52351
|
-
else {
|
|
52352
|
-
context.symbolDepth.delete(id);
|
|
52353
|
-
}
|
|
52426
|
+
context.symbolDepth.set(id, depth);
|
|
52354
52427
|
}
|
|
52355
52428
|
return result;
|
|
52356
52429
|
function deepCloneOrReuseNode(node) {
|
|
@@ -52896,9 +52969,6 @@ var ts;
|
|
|
52896
52969
|
if (parameterDeclaration && isRequiredInitializedParameter(parameterDeclaration)) {
|
|
52897
52970
|
parameterType = getOptionalType(parameterType);
|
|
52898
52971
|
}
|
|
52899
|
-
if ((context.flags & 1073741824 /* NoUndefinedOptionalParameterType */) && parameterDeclaration && !ts.isJSDocParameterTag(parameterDeclaration) && isOptionalUninitializedParameter(parameterDeclaration)) {
|
|
52900
|
-
parameterType = getTypeWithFacts(parameterType, 524288 /* NEUndefined */);
|
|
52901
|
-
}
|
|
52902
52972
|
var parameterTypeNode = serializeTypeForDeclaration(context, parameterType, parameterSymbol, context.enclosingDeclaration, privateSymbolVisitor, bundledImports);
|
|
52903
52973
|
var modifiers = !(context.flags & 8192 /* OmitParameterModifiers */) && preserveModifierFlags && parameterDeclaration && parameterDeclaration.modifiers ? parameterDeclaration.modifiers.map(ts.factory.cloneNode) : undefined;
|
|
52904
52974
|
var isRest = parameterDeclaration && ts.isRestParameter(parameterDeclaration) || ts.getCheckFlags(parameterSymbol) & 32768 /* RestParameter */;
|
|
@@ -53457,7 +53527,7 @@ var ts;
|
|
|
53457
53527
|
if (declWithExistingAnnotation && !ts.isFunctionLikeDeclaration(declWithExistingAnnotation) && !ts.isGetAccessorDeclaration(declWithExistingAnnotation)) {
|
|
53458
53528
|
// try to reuse the existing annotation
|
|
53459
53529
|
var existing = ts.getEffectiveTypeAnnotationNode(declWithExistingAnnotation);
|
|
53460
|
-
if (
|
|
53530
|
+
if (typeNodeIsEquivalentToType(existing, declWithExistingAnnotation, type) && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type)) {
|
|
53461
53531
|
var result_6 = serializeExistingTypeNode(context, existing, includePrivateSymbol, bundled);
|
|
53462
53532
|
if (result_6) {
|
|
53463
53533
|
return result_6;
|
|
@@ -53474,6 +53544,16 @@ var ts;
|
|
|
53474
53544
|
context.flags = oldFlags;
|
|
53475
53545
|
return result;
|
|
53476
53546
|
}
|
|
53547
|
+
function typeNodeIsEquivalentToType(typeNode, annotatedDeclaration, type) {
|
|
53548
|
+
var typeFromTypeNode = getTypeFromTypeNode(typeNode);
|
|
53549
|
+
if (typeFromTypeNode === type) {
|
|
53550
|
+
return true;
|
|
53551
|
+
}
|
|
53552
|
+
if (ts.isParameter(annotatedDeclaration) && annotatedDeclaration.questionToken) {
|
|
53553
|
+
return getTypeWithFacts(type, 524288 /* NEUndefined */) === typeFromTypeNode;
|
|
53554
|
+
}
|
|
53555
|
+
return false;
|
|
53556
|
+
}
|
|
53477
53557
|
function serializeReturnTypeForSignature(context, type, signature, includePrivateSymbol, bundled) {
|
|
53478
53558
|
if (!isErrorType(type) && context.enclosingDeclaration) {
|
|
53479
53559
|
var annotation = signature.declaration && ts.getEffectiveReturnTypeNode(signature.declaration);
|
|
@@ -55745,7 +55825,7 @@ var ts;
|
|
|
55745
55825
|
}
|
|
55746
55826
|
}
|
|
55747
55827
|
var sourceTypes = ts.some(constructorTypes, function (t) { return !!(t.flags & ~98304 /* Nullable */); }) ? constructorTypes : types; // TODO: GH#18217
|
|
55748
|
-
type = getUnionType(sourceTypes
|
|
55828
|
+
type = getUnionType(sourceTypes);
|
|
55749
55829
|
}
|
|
55750
55830
|
}
|
|
55751
55831
|
var widened = getWidenedType(addOptionality(type, /*isProperty*/ false, definedInMethod && !definedInConstructor));
|
|
@@ -58494,8 +58574,9 @@ var ts;
|
|
|
58494
58574
|
// levels of nesting, we are presumably exploring a repeating pattern with a long cycle that hasn't
|
|
58495
58575
|
// yet triggered the deeply nested limiter. We have no test cases that actually get to 50 levels of
|
|
58496
58576
|
// nesting, so it is effectively just a safety stop.
|
|
58497
|
-
|
|
58498
|
-
|
|
58577
|
+
var identity_1 = getRecursionIdentity(t);
|
|
58578
|
+
if (stack.length < 10 || stack.length < 50 && !ts.contains(stack, identity_1)) {
|
|
58579
|
+
stack.push(identity_1);
|
|
58499
58580
|
result = computeBaseConstraint(getSimplifiedType(t, /*writing*/ false));
|
|
58500
58581
|
stack.pop();
|
|
58501
58582
|
}
|
|
@@ -61851,11 +61932,14 @@ var ts;
|
|
|
61851
61932
|
return type[cache] = elementType;
|
|
61852
61933
|
}
|
|
61853
61934
|
}
|
|
61854
|
-
// If the object type is a mapped type { [P in K]: E }, where K is generic,
|
|
61855
|
-
//
|
|
61856
|
-
// construct the type Box<T[X]>.
|
|
61857
|
-
if (isGenericMappedType(objectType)
|
|
61858
|
-
|
|
61935
|
+
// If the object type is a mapped type { [P in K]: E }, where K is generic, or { [P in K as N]: E }, where
|
|
61936
|
+
// K is generic and N is assignable to P, instantiate E using a mapper that substitutes the index type for P.
|
|
61937
|
+
// For example, for an index access { [P in K]: Box<T[P]> }[X], we construct the type Box<T[X]>.
|
|
61938
|
+
if (isGenericMappedType(objectType)) {
|
|
61939
|
+
var nameType = getNameTypeFromMappedType(objectType);
|
|
61940
|
+
if (!nameType || isTypeAssignableTo(nameType, getTypeParameterFromMappedType(objectType))) {
|
|
61941
|
+
return type[cache] = mapType(substituteIndexedMappedType(objectType, type.indexType), function (t) { return getSimplifiedType(t, writing); });
|
|
61942
|
+
}
|
|
61859
61943
|
}
|
|
61860
61944
|
return type[cache] = type;
|
|
61861
61945
|
}
|
|
@@ -66693,12 +66777,12 @@ var ts;
|
|
|
66693
66777
|
function isDeeplyNestedType(type, stack, depth, maxDepth) {
|
|
66694
66778
|
if (maxDepth === void 0) { maxDepth = 3; }
|
|
66695
66779
|
if (depth >= maxDepth) {
|
|
66696
|
-
var
|
|
66780
|
+
var identity_2 = getRecursionIdentity(type);
|
|
66697
66781
|
var count = 0;
|
|
66698
66782
|
var lastTypeId = 0;
|
|
66699
66783
|
for (var i = 0; i < depth; i++) {
|
|
66700
66784
|
var t = stack[i];
|
|
66701
|
-
if (getRecursionIdentity(t) ===
|
|
66785
|
+
if (getRecursionIdentity(t) === identity_2) {
|
|
66702
66786
|
// We only count occurrences with a higher type id than the previous occurrence, since higher
|
|
66703
66787
|
// type ids are an indicator of newer instantiations caused by recursion.
|
|
66704
66788
|
if (t.id >= lastTypeId) {
|
|
@@ -74175,10 +74259,15 @@ var ts;
|
|
|
74175
74259
|
prop = getPropertyOfType(apparentType, right.escapedText);
|
|
74176
74260
|
}
|
|
74177
74261
|
// In `Foo.Bar.Baz`, 'Foo' is not referenced if 'Bar' is a const enum or a module containing only const enums.
|
|
74262
|
+
// `Foo` is also not referenced in `enum FooCopy { Bar = Foo.Bar }`, because the enum member value gets inlined
|
|
74263
|
+
// here even if `Foo` is not a const enum.
|
|
74264
|
+
//
|
|
74178
74265
|
// The exceptions are:
|
|
74179
74266
|
// 1. if 'isolatedModules' is enabled, because the const enum value will not be inlined, and
|
|
74180
74267
|
// 2. if 'preserveConstEnums' is enabled and the expression is itself an export, e.g. `export = Foo.Bar.Baz`.
|
|
74181
|
-
if (ts.isIdentifier(left) && parentSymbol && (compilerOptions.isolatedModules ||
|
|
74268
|
+
if (ts.isIdentifier(left) && parentSymbol && (compilerOptions.isolatedModules ||
|
|
74269
|
+
!(prop && (isConstEnumOrConstEnumOnlyModule(prop) || prop.flags & 8 /* EnumMember */ && node.parent.kind === 299 /* EnumMember */)) ||
|
|
74270
|
+
ts.shouldPreserveConstEnums(compilerOptions) && isExportOrExportExpression(node))) {
|
|
74182
74271
|
markAliasReferenced(parentSymbol, node);
|
|
74183
74272
|
}
|
|
74184
74273
|
var propType;
|
|
@@ -76700,7 +76789,7 @@ var ts;
|
|
|
76700
76789
|
var newSymbol = createSymbol(2097152 /* Alias */, "default" /* Default */);
|
|
76701
76790
|
newSymbol.parent = originalSymbol;
|
|
76702
76791
|
newSymbol.nameType = getStringLiteralType("default");
|
|
76703
|
-
newSymbol.
|
|
76792
|
+
newSymbol.aliasTarget = resolveSymbol(symbol);
|
|
76704
76793
|
memberTable.set("default" /* Default */, newSymbol);
|
|
76705
76794
|
return createAnonymousType(anonymousSymbol, memberTable, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
76706
76795
|
}
|
|
@@ -79512,19 +79601,28 @@ var ts;
|
|
|
79512
79601
|
if (constraintType && defaultType) {
|
|
79513
79602
|
checkTypeAssignableTo(defaultType, getTypeWithThisArgument(instantiateType(constraintType, makeUnaryTypeMapper(typeParameter, defaultType)), defaultType), node.default, ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1);
|
|
79514
79603
|
}
|
|
79515
|
-
|
|
79604
|
+
checkNodeDeferred(node);
|
|
79605
|
+
addLazyDiagnostic(function () { return checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_parameter_name_cannot_be_0); });
|
|
79606
|
+
}
|
|
79607
|
+
function checkTypeParameterDeferred(node) {
|
|
79608
|
+
if (ts.isInterfaceDeclaration(node.parent) || ts.isClassLike(node.parent) || ts.isTypeAliasDeclaration(node.parent)) {
|
|
79609
|
+
var typeParameter = getDeclaredTypeOfTypeParameter(getSymbolOfNode(node));
|
|
79516
79610
|
var modifiers = getVarianceModifiers(typeParameter);
|
|
79517
|
-
if (modifiers
|
|
79611
|
+
if (modifiers) {
|
|
79518
79612
|
var symbol = getSymbolOfNode(node.parent);
|
|
79519
|
-
|
|
79520
|
-
|
|
79521
|
-
|
|
79522
|
-
|
|
79523
|
-
|
|
79524
|
-
|
|
79613
|
+
if (ts.isTypeAliasDeclaration(node.parent) && !(ts.getObjectFlags(getDeclaredTypeOfSymbol(symbol)) & (16 /* Anonymous */ | 32 /* Mapped */))) {
|
|
79614
|
+
error(node, ts.Diagnostics.Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types);
|
|
79615
|
+
}
|
|
79616
|
+
else if (modifiers === 32768 /* In */ || modifiers === 65536 /* Out */) {
|
|
79617
|
+
var source = createMarkerType(symbol, typeParameter, modifiers === 65536 /* Out */ ? markerSubType : markerSuperType);
|
|
79618
|
+
var target = createMarkerType(symbol, typeParameter, modifiers === 65536 /* Out */ ? markerSuperType : markerSubType);
|
|
79619
|
+
var saveVarianceTypeParameter = typeParameter;
|
|
79620
|
+
varianceTypeParameter = typeParameter;
|
|
79621
|
+
checkTypeAssignableTo(source, target, node, ts.Diagnostics.Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation);
|
|
79622
|
+
varianceTypeParameter = saveVarianceTypeParameter;
|
|
79623
|
+
}
|
|
79525
79624
|
}
|
|
79526
79625
|
}
|
|
79527
|
-
addLazyDiagnostic(function () { return checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_parameter_name_cannot_be_0); });
|
|
79528
79626
|
}
|
|
79529
79627
|
function checkParameter(node) {
|
|
79530
79628
|
// Grammar checking
|
|
@@ -80014,7 +80112,7 @@ var ts;
|
|
|
80014
80112
|
superCallStatement = statement;
|
|
80015
80113
|
break;
|
|
80016
80114
|
}
|
|
80017
|
-
if (
|
|
80115
|
+
if (nodeImmediatelyReferencesSuperOrThis(statement)) {
|
|
80018
80116
|
break;
|
|
80019
80117
|
}
|
|
80020
80118
|
}
|
|
@@ -85367,6 +85465,9 @@ var ts;
|
|
|
85367
85465
|
case 226 /* ClassExpression */:
|
|
85368
85466
|
checkClassExpressionDeferred(node);
|
|
85369
85467
|
break;
|
|
85468
|
+
case 163 /* TypeParameter */:
|
|
85469
|
+
checkTypeParameterDeferred(node);
|
|
85470
|
+
break;
|
|
85370
85471
|
case 279 /* JsxSelfClosingElement */:
|
|
85371
85472
|
checkJsxSelfClosingElementDeferred(node);
|
|
85372
85473
|
break;
|
|
@@ -85901,15 +86002,20 @@ var ts;
|
|
|
85901
86002
|
return propertyDeclaration;
|
|
85902
86003
|
}
|
|
85903
86004
|
}
|
|
85904
|
-
else if (ts.isMetaProperty(parent)) {
|
|
85905
|
-
|
|
85906
|
-
|
|
85907
|
-
if (propertyDeclaration) {
|
|
85908
|
-
return propertyDeclaration;
|
|
85909
|
-
}
|
|
85910
|
-
if (parent.keywordToken === 103 /* NewKeyword */) {
|
|
86005
|
+
else if (ts.isMetaProperty(parent) && parent.name === node) {
|
|
86006
|
+
if (parent.keywordToken === 103 /* NewKeyword */ && ts.idText(node) === "target") {
|
|
86007
|
+
// `target` in `new.target`
|
|
85911
86008
|
return checkNewTargetMetaProperty(parent).symbol;
|
|
85912
86009
|
}
|
|
86010
|
+
// The `meta` in `import.meta` could be given `getTypeOfNode(parent).symbol` (the `ImportMeta` interface symbol), but
|
|
86011
|
+
// we have a fake expression type made for other reasons already, whose transient `meta`
|
|
86012
|
+
// member should more exactly be the kind of (declarationless) symbol we want.
|
|
86013
|
+
// (See #44364 and #45031 for relevant implementation PRs)
|
|
86014
|
+
if (parent.keywordToken === 100 /* ImportKeyword */ && ts.idText(node) === "meta") {
|
|
86015
|
+
return getGlobalImportMetaExpressionType().members.get("meta");
|
|
86016
|
+
}
|
|
86017
|
+
// no other meta properties are valid syntax, thus no others should have symbols
|
|
86018
|
+
return undefined;
|
|
85913
86019
|
}
|
|
85914
86020
|
}
|
|
85915
86021
|
switch (node.kind) {
|
|
@@ -86181,11 +86287,11 @@ var ts;
|
|
|
86181
86287
|
var _a = symbol, leftSpread = _a.leftSpread, rightSpread = _a.rightSpread, syntheticOrigin = _a.syntheticOrigin;
|
|
86182
86288
|
return leftSpread ? [leftSpread, rightSpread]
|
|
86183
86289
|
: syntheticOrigin ? [syntheticOrigin]
|
|
86184
|
-
: ts.singleElementArray(
|
|
86290
|
+
: ts.singleElementArray(tryGetTarget(symbol));
|
|
86185
86291
|
}
|
|
86186
86292
|
return undefined;
|
|
86187
86293
|
}
|
|
86188
|
-
function
|
|
86294
|
+
function tryGetTarget(symbol) {
|
|
86189
86295
|
var target;
|
|
86190
86296
|
var next = symbol;
|
|
86191
86297
|
while (next = getSymbolLinks(next).target) {
|
|
@@ -86415,7 +86521,7 @@ var ts;
|
|
|
86415
86521
|
if (links === null || links === void 0 ? void 0 : links.referenced) {
|
|
86416
86522
|
return true;
|
|
86417
86523
|
}
|
|
86418
|
-
var target = getSymbolLinks(symbol).
|
|
86524
|
+
var target = getSymbolLinks(symbol).aliasTarget; // TODO: GH#18217
|
|
86419
86525
|
if (target && ts.getEffectiveModifierFlags(node) & 1 /* Export */ &&
|
|
86420
86526
|
target.flags & 111551 /* Value */ &&
|
|
86421
86527
|
(ts.shouldPreserveConstEnums(compilerOptions) || !isConstEnumOrConstEnumOnlyModule(target))) {
|
|
@@ -86463,11 +86569,6 @@ var ts;
|
|
|
86463
86569
|
!parameter.initializer &&
|
|
86464
86570
|
ts.hasSyntacticModifier(parameter, 16476 /* ParameterPropertyModifier */);
|
|
86465
86571
|
}
|
|
86466
|
-
function isOptionalUninitializedParameter(parameter) {
|
|
86467
|
-
return !!strictNullChecks &&
|
|
86468
|
-
isOptionalParameter(parameter) &&
|
|
86469
|
-
!parameter.initializer;
|
|
86470
|
-
}
|
|
86471
86572
|
function isExpandoFunctionDeclaration(node) {
|
|
86472
86573
|
var declaration = ts.getParseTreeNode(node, ts.isFunctionDeclaration);
|
|
86473
86574
|
if (!declaration) {
|
|
@@ -87384,8 +87485,7 @@ var ts;
|
|
|
87384
87485
|
case 144 /* OutKeyword */:
|
|
87385
87486
|
var inOutFlag = modifier.kind === 101 /* InKeyword */ ? 32768 /* In */ : 65536 /* Out */;
|
|
87386
87487
|
var inOutText = modifier.kind === 101 /* InKeyword */ ? "in" : "out";
|
|
87387
|
-
if (node.kind !== 163 /* TypeParameter */ || (node.parent
|
|
87388
|
-
node.parent.kind !== 257 /* ClassDeclaration */ && node.parent.kind !== 259 /* TypeAliasDeclaration */)) {
|
|
87488
|
+
if (node.kind !== 163 /* TypeParameter */ || !(ts.isInterfaceDeclaration(node.parent) || ts.isClassLike(node.parent) || ts.isTypeAliasDeclaration(node.parent))) {
|
|
87389
87489
|
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias, inOutText);
|
|
87390
87490
|
}
|
|
87391
87491
|
if (flags & inOutFlag) {
|
|
@@ -92619,11 +92719,11 @@ var ts;
|
|
|
92619
92719
|
}
|
|
92620
92720
|
var statements = [];
|
|
92621
92721
|
resumeLexicalEnvironment();
|
|
92622
|
-
var
|
|
92623
|
-
var superStatementIndex = ts.findSuperStatementIndex(body.statements,
|
|
92722
|
+
var prologueStatementCount = factory.copyPrologue(body.statements, statements, /*ensureUseStrict*/ false, visitor);
|
|
92723
|
+
var superStatementIndex = ts.findSuperStatementIndex(body.statements, prologueStatementCount);
|
|
92624
92724
|
// If there was a super call, visit existing statements up to and including it
|
|
92625
92725
|
if (superStatementIndex >= 0) {
|
|
92626
|
-
ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement,
|
|
92726
|
+
ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, prologueStatementCount, superStatementIndex + 1 - prologueStatementCount));
|
|
92627
92727
|
}
|
|
92628
92728
|
// Transform parameters into property assignments. Transforms this:
|
|
92629
92729
|
//
|
|
@@ -92642,12 +92742,12 @@ var ts;
|
|
|
92642
92742
|
if (superStatementIndex >= 0) {
|
|
92643
92743
|
ts.addRange(statements, parameterPropertyAssignments);
|
|
92644
92744
|
}
|
|
92645
|
-
// Since there was no super() call, parameter properties are the first statements in the constructor
|
|
92745
|
+
// Since there was no super() call, parameter properties are the first statements in the constructor after any prologue statements
|
|
92646
92746
|
else {
|
|
92647
|
-
statements =
|
|
92747
|
+
statements = __spreadArray(__spreadArray(__spreadArray([], statements.slice(0, prologueStatementCount), true), parameterPropertyAssignments, true), statements.slice(prologueStatementCount), true);
|
|
92648
92748
|
}
|
|
92649
|
-
// Add remaining statements from the body, skipping the super() call if it was found
|
|
92650
|
-
ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, superStatementIndex + 1));
|
|
92749
|
+
// Add remaining statements from the body, skipping the super() call if it was found and any (already added) prologue statements
|
|
92750
|
+
ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, superStatementIndex + 1 + prologueStatementCount));
|
|
92651
92751
|
// End the lexical environment.
|
|
92652
92752
|
statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment());
|
|
92653
92753
|
var block = factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), body.statements), /*multiLine*/ true);
|
|
@@ -94593,7 +94693,7 @@ var ts;
|
|
|
94593
94693
|
}
|
|
94594
94694
|
resumeLexicalEnvironment();
|
|
94595
94695
|
var needsSyntheticConstructor = !constructor && isDerivedClass;
|
|
94596
|
-
var
|
|
94696
|
+
var indexOfFirstStatementAfterSuperAndPrologue = 0;
|
|
94597
94697
|
var prologueStatementCount = 0;
|
|
94598
94698
|
var superStatementIndex = -1;
|
|
94599
94699
|
var statements = [];
|
|
@@ -94602,8 +94702,11 @@ var ts;
|
|
|
94602
94702
|
superStatementIndex = ts.findSuperStatementIndex(constructor.body.statements, prologueStatementCount);
|
|
94603
94703
|
// If there was a super call, visit existing statements up to and including it
|
|
94604
94704
|
if (superStatementIndex >= 0) {
|
|
94605
|
-
|
|
94606
|
-
statements = __spreadArray(__spreadArray(__spreadArray([], statements.slice(0, prologueStatementCount), true), ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, prologueStatementCount,
|
|
94705
|
+
indexOfFirstStatementAfterSuperAndPrologue = superStatementIndex + 1;
|
|
94706
|
+
statements = __spreadArray(__spreadArray(__spreadArray([], statements.slice(0, prologueStatementCount), true), ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, prologueStatementCount, indexOfFirstStatementAfterSuperAndPrologue - prologueStatementCount), true), statements.slice(prologueStatementCount), true);
|
|
94707
|
+
}
|
|
94708
|
+
else if (prologueStatementCount >= 0) {
|
|
94709
|
+
indexOfFirstStatementAfterSuperAndPrologue = prologueStatementCount;
|
|
94607
94710
|
}
|
|
94608
94711
|
}
|
|
94609
94712
|
if (needsSyntheticConstructor) {
|
|
@@ -94639,22 +94742,20 @@ var ts;
|
|
|
94639
94742
|
}
|
|
94640
94743
|
}
|
|
94641
94744
|
if (parameterPropertyDeclarationCount > 0) {
|
|
94642
|
-
var parameterProperties = ts.visitNodes(constructor.body.statements, visitor, ts.isStatement,
|
|
94745
|
+
var parameterProperties = ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, indexOfFirstStatementAfterSuperAndPrologue, parameterPropertyDeclarationCount);
|
|
94643
94746
|
// If there was a super() call found, add parameter properties immediately after it
|
|
94644
94747
|
if (superStatementIndex >= 0) {
|
|
94645
94748
|
ts.addRange(statements, parameterProperties);
|
|
94646
94749
|
}
|
|
94647
|
-
// If a synthetic super() call was added, add them just after it
|
|
94648
|
-
else if (needsSyntheticConstructor) {
|
|
94649
|
-
statements = __spreadArray(__spreadArray([
|
|
94650
|
-
statements[0]
|
|
94651
|
-
], parameterProperties, true), statements.slice(1), true);
|
|
94652
|
-
}
|
|
94653
|
-
// Since there wasn't a super() call, add them to the top of the constructor
|
|
94654
94750
|
else {
|
|
94655
|
-
|
|
94751
|
+
// Add add parameter properties to the top of the constructor after the prologue
|
|
94752
|
+
var superAndPrologueStatementCount = prologueStatementCount;
|
|
94753
|
+
// If a synthetic super() call was added, need to account for that
|
|
94754
|
+
if (needsSyntheticConstructor)
|
|
94755
|
+
superAndPrologueStatementCount++;
|
|
94756
|
+
statements = __spreadArray(__spreadArray(__spreadArray([], statements.slice(0, superAndPrologueStatementCount), true), parameterProperties, true), statements.slice(superAndPrologueStatementCount), true);
|
|
94656
94757
|
}
|
|
94657
|
-
|
|
94758
|
+
indexOfFirstStatementAfterSuperAndPrologue += parameterPropertyDeclarationCount;
|
|
94658
94759
|
}
|
|
94659
94760
|
}
|
|
94660
94761
|
}
|
|
@@ -94664,7 +94765,7 @@ var ts;
|
|
|
94664
94765
|
addPropertyOrClassStaticBlockStatements(statements, properties, receiver);
|
|
94665
94766
|
// Add existing statements after the initial prologues and super call
|
|
94666
94767
|
if (constructor) {
|
|
94667
|
-
ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitBodyStatement, ts.isStatement,
|
|
94768
|
+
ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitBodyStatement, ts.isStatement, indexOfFirstStatementAfterSuperAndPrologue));
|
|
94668
94769
|
}
|
|
94669
94770
|
statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment());
|
|
94670
94771
|
return ts.setTextRange(factory.createBlock(ts.setTextRange(factory.createNodeArray(statements),
|
|
@@ -98705,7 +98806,7 @@ var ts;
|
|
|
98705
98806
|
// ```
|
|
98706
98807
|
insertCaptureThisForNodeIfNeeded(prologue, constructor);
|
|
98707
98808
|
}
|
|
98708
|
-
var body = factory.createBlock(ts.setTextRange(factory.createNodeArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], existingPrologue, true), prologue, true), (superStatementIndex <= existingPrologue.length ? ts.emptyArray : ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, existingPrologue.length, superStatementIndex)), true), statements, true)),
|
|
98809
|
+
var body = factory.createBlock(ts.setTextRange(factory.createNodeArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], existingPrologue, true), prologue, true), (superStatementIndex <= existingPrologue.length ? ts.emptyArray : ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, existingPrologue.length, superStatementIndex - existingPrologue.length)), true), statements, true)),
|
|
98709
98810
|
/*location*/ constructor.body.statements),
|
|
98710
98811
|
/*multiLine*/ true);
|
|
98711
98812
|
ts.setTextRange(body, constructor.body);
|
|
@@ -108411,6 +108512,10 @@ var ts;
|
|
|
108411
108512
|
return factory.updateModifiers(statement, modifiers);
|
|
108412
108513
|
}
|
|
108413
108514
|
function transformTopLevelDeclaration(input) {
|
|
108515
|
+
if (lateMarkedStatements) {
|
|
108516
|
+
while (ts.orderedRemoveItem(lateMarkedStatements, input))
|
|
108517
|
+
;
|
|
108518
|
+
}
|
|
108414
108519
|
if (shouldStripInternal(input))
|
|
108415
108520
|
return;
|
|
108416
108521
|
switch (input.kind) {
|
|
@@ -109542,7 +109647,7 @@ var ts;
|
|
|
109542
109647
|
addOutput(buildInfoPath);
|
|
109543
109648
|
}
|
|
109544
109649
|
function getOwnOutputFileNames(configFile, inputFileName, ignoreCase, addOutput, getCommonSourceDirectory) {
|
|
109545
|
-
if (ts.
|
|
109650
|
+
if (ts.isDeclarationFileName(inputFileName))
|
|
109546
109651
|
return;
|
|
109547
109652
|
var js = getOutputJSFileName(inputFileName, configFile, ignoreCase, getCommonSourceDirectory);
|
|
109548
109653
|
addOutput(js);
|
|
@@ -109587,7 +109692,7 @@ var ts;
|
|
|
109587
109692
|
/*@internal*/
|
|
109588
109693
|
function getCommonSourceDirectoryOfConfig(_a, ignoreCase) {
|
|
109589
109694
|
var options = _a.options, fileNames = _a.fileNames;
|
|
109590
|
-
return getCommonSourceDirectory(options, function () { return ts.filter(fileNames, function (file) { return !(options.noEmitForJsFiles && ts.fileExtensionIsOneOf(file, ts.supportedJSExtensionsFlat)) && !ts.
|
|
109695
|
+
return getCommonSourceDirectory(options, function () { return ts.filter(fileNames, function (file) { return !(options.noEmitForJsFiles && ts.fileExtensionIsOneOf(file, ts.supportedJSExtensionsFlat)) && !ts.isDeclarationFileName(file); }); }, ts.getDirectoryPath(ts.normalizeSlashes(ts.Debug.checkDefined(options.configFilePath))), ts.createGetCanonicalFileName(!ignoreCase));
|
|
109591
109696
|
}
|
|
109592
109697
|
ts.getCommonSourceDirectoryOfConfig = getCommonSourceDirectoryOfConfig;
|
|
109593
109698
|
/*@internal*/
|
|
@@ -109629,7 +109734,7 @@ var ts;
|
|
|
109629
109734
|
var getCommonSourceDirectory = ts.memoize(function () { return getCommonSourceDirectoryOfConfig(configFile, ignoreCase); });
|
|
109630
109735
|
for (var _a = 0, _b = configFile.fileNames; _a < _b.length; _a++) {
|
|
109631
109736
|
var inputFileName = _b[_a];
|
|
109632
|
-
if (ts.
|
|
109737
|
+
if (ts.isDeclarationFileName(inputFileName))
|
|
109633
109738
|
continue;
|
|
109634
109739
|
var jsFilePath = getOutputJSFileName(inputFileName, configFile, ignoreCase, getCommonSourceDirectory);
|
|
109635
109740
|
if (jsFilePath)
|
|
@@ -114979,7 +115084,7 @@ var ts;
|
|
|
114979
115084
|
if (ts.outFile(options) || options.outDir)
|
|
114980
115085
|
return false;
|
|
114981
115086
|
// File if emitted next to input needs to be ignored
|
|
114982
|
-
if (ts.
|
|
115087
|
+
if (ts.isDeclarationFileName(fileOrDirectoryPath)) {
|
|
114983
115088
|
// If its declaration directory: its not ignored if not excluded by config
|
|
114984
115089
|
if (options.declarationDir)
|
|
114985
115090
|
return false;
|
|
@@ -116152,7 +116257,7 @@ var ts;
|
|
|
116152
116257
|
var getCommonSourceDirectory_2 = ts.memoize(function () { return ts.getCommonSourceDirectoryOfConfig(parsedRef.commandLine, !host.useCaseSensitiveFileNames()); });
|
|
116153
116258
|
for (var _b = 0, _c = parsedRef.commandLine.fileNames; _b < _c.length; _b++) {
|
|
116154
116259
|
var fileName = _c[_b];
|
|
116155
|
-
if (!ts.
|
|
116260
|
+
if (!ts.isDeclarationFileName(fileName) && !ts.fileExtensionIs(fileName, ".json" /* Json */)) {
|
|
116156
116261
|
processProjectReferenceFile(ts.getOutputDeclarationFileName(fileName, parsedRef.commandLine, !host.useCaseSensitiveFileNames(), getCommonSourceDirectory_2), { kind: ts.FileIncludeKind.OutputFromProjectReference, index: index });
|
|
116157
116262
|
}
|
|
116158
116263
|
}
|
|
@@ -116343,7 +116448,7 @@ var ts;
|
|
|
116343
116448
|
}
|
|
116344
116449
|
function getRedirectReferenceForResolution(file) {
|
|
116345
116450
|
var redirect = getResolvedProjectReferenceToRedirect(file.originalFileName);
|
|
116346
|
-
if (redirect || !ts.
|
|
116451
|
+
if (redirect || !ts.isDeclarationFileName(file.originalFileName))
|
|
116347
116452
|
return redirect;
|
|
116348
116453
|
// The originalFileName could not be actual source file name if file found was d.ts from referecned project
|
|
116349
116454
|
// So in this case try to look up if this is output from referenced project, if it is use the redirected project in that case
|
|
@@ -117734,7 +117839,7 @@ var ts;
|
|
|
117734
117839
|
}
|
|
117735
117840
|
function getProjectReferenceRedirectProject(fileName) {
|
|
117736
117841
|
// Ignore dts or any json files
|
|
117737
|
-
if (!resolvedProjectReferences || !resolvedProjectReferences.length || ts.
|
|
117842
|
+
if (!resolvedProjectReferences || !resolvedProjectReferences.length || ts.isDeclarationFileName(fileName) || ts.fileExtensionIs(fileName, ".json" /* Json */)) {
|
|
117738
117843
|
return undefined;
|
|
117739
117844
|
}
|
|
117740
117845
|
// If this file is produced by a referenced project, we need to rewrite it to
|
|
@@ -117783,7 +117888,7 @@ var ts;
|
|
|
117783
117888
|
else {
|
|
117784
117889
|
var getCommonSourceDirectory_3 = ts.memoize(function () { return ts.getCommonSourceDirectoryOfConfig(resolvedRef.commandLine, !host.useCaseSensitiveFileNames()); });
|
|
117785
117890
|
ts.forEach(resolvedRef.commandLine.fileNames, function (fileName) {
|
|
117786
|
-
if (!ts.
|
|
117891
|
+
if (!ts.isDeclarationFileName(fileName) && !ts.fileExtensionIs(fileName, ".json" /* Json */)) {
|
|
117787
117892
|
var outputDts = ts.getOutputDeclarationFileName(fileName, resolvedRef.commandLine, !host.useCaseSensitiveFileNames(), getCommonSourceDirectory_3);
|
|
117788
117893
|
mapFromToProjectReferenceRedirectSource.set(toPath(outputDts), fileName);
|
|
117789
117894
|
}
|
|
@@ -118584,7 +118689,7 @@ var ts;
|
|
|
118584
118689
|
if (options.outDir) {
|
|
118585
118690
|
return ts.containsPath(options.outDir, filePath, currentDirectory, !host.useCaseSensitiveFileNames());
|
|
118586
118691
|
}
|
|
118587
|
-
if (ts.fileExtensionIsOneOf(filePath, ts.supportedJSExtensionsFlat) || ts.
|
|
118692
|
+
if (ts.fileExtensionIsOneOf(filePath, ts.supportedJSExtensionsFlat) || ts.isDeclarationFileName(filePath)) {
|
|
118588
118693
|
// Otherwise just check if sourceFile with the name exists
|
|
118589
118694
|
var filePathWithoutExtension = ts.removeFileExtension(filePath);
|
|
118590
118695
|
return !!getSourceFileByPath((filePathWithoutExtension + ".ts" /* Ts */)) ||
|
|
@@ -118917,13 +119022,9 @@ var ts;
|
|
|
118917
119022
|
ts.getFileEmitOutput = getFileEmitOutput;
|
|
118918
119023
|
var BuilderState;
|
|
118919
119024
|
(function (BuilderState) {
|
|
118920
|
-
var manyToManyPathMapCount = 0;
|
|
118921
119025
|
function createManyToManyPathMap() {
|
|
118922
119026
|
function create(forward, reverse, deleted) {
|
|
118923
|
-
var version = 0;
|
|
118924
119027
|
var map = {
|
|
118925
|
-
id: manyToManyPathMapCount++,
|
|
118926
|
-
version: function () { return version; },
|
|
118927
119028
|
clone: function () { return create(new ts.Map(forward), new ts.Map(reverse), deleted && new ts.Set(deleted)); },
|
|
118928
119029
|
forEach: function (fn) { return forward.forEach(fn); },
|
|
118929
119030
|
getKeys: function (v) { return reverse.get(v); },
|
|
@@ -118939,30 +119040,29 @@ var ts;
|
|
|
118939
119040
|
}
|
|
118940
119041
|
set.forEach(function (v) { return deleteFromMultimap(reverse, v, k); });
|
|
118941
119042
|
forward.delete(k);
|
|
118942
|
-
version++;
|
|
118943
119043
|
return true;
|
|
118944
119044
|
},
|
|
118945
119045
|
set: function (k, vSet) {
|
|
118946
|
-
|
|
119046
|
+
deleted === null || deleted === void 0 ? void 0 : deleted.delete(k);
|
|
118947
119047
|
var existingVSet = forward.get(k);
|
|
118948
119048
|
forward.set(k, vSet);
|
|
118949
119049
|
existingVSet === null || existingVSet === void 0 ? void 0 : existingVSet.forEach(function (v) {
|
|
118950
119050
|
if (!vSet.has(v)) {
|
|
118951
|
-
changed = true;
|
|
118952
119051
|
deleteFromMultimap(reverse, v, k);
|
|
118953
119052
|
}
|
|
118954
119053
|
});
|
|
118955
119054
|
vSet.forEach(function (v) {
|
|
118956
119055
|
if (!(existingVSet === null || existingVSet === void 0 ? void 0 : existingVSet.has(v))) {
|
|
118957
|
-
changed = true;
|
|
118958
119056
|
addToMultimap(reverse, v, k);
|
|
118959
119057
|
}
|
|
118960
119058
|
});
|
|
118961
|
-
if (changed) {
|
|
118962
|
-
version++;
|
|
118963
|
-
}
|
|
118964
119059
|
return map;
|
|
118965
119060
|
},
|
|
119061
|
+
clear: function () {
|
|
119062
|
+
forward.clear();
|
|
119063
|
+
reverse.clear();
|
|
119064
|
+
deleted === null || deleted === void 0 ? void 0 : deleted.clear();
|
|
119065
|
+
}
|
|
118966
119066
|
};
|
|
118967
119067
|
return map;
|
|
118968
119068
|
}
|
|
@@ -118977,11 +119077,10 @@ var ts;
|
|
|
118977
119077
|
}
|
|
118978
119078
|
set.add(v);
|
|
118979
119079
|
}
|
|
118980
|
-
function deleteFromMultimap(map, k, v
|
|
118981
|
-
if (removeEmpty === void 0) { removeEmpty = true; }
|
|
119080
|
+
function deleteFromMultimap(map, k, v) {
|
|
118982
119081
|
var set = map.get(k);
|
|
118983
119082
|
if (set === null || set === void 0 ? void 0 : set.delete(v)) {
|
|
118984
|
-
if (
|
|
119083
|
+
if (!set.size) {
|
|
118985
119084
|
map.delete(k);
|
|
118986
119085
|
}
|
|
118987
119086
|
return true;
|
|
@@ -119210,7 +119309,7 @@ var ts;
|
|
|
119210
119309
|
/*forceDtsEmit*/ true);
|
|
119211
119310
|
var firstDts_1 = ts.firstOrUndefined(emitOutput_1.outputFiles);
|
|
119212
119311
|
if (firstDts_1) {
|
|
119213
|
-
ts.Debug.assert(ts.
|
|
119312
|
+
ts.Debug.assert(ts.isDeclarationFileName(firstDts_1.name), "File extension for signature expected to be dts", function () { return "Found: " + ts.getAnyExtensionFromPath(firstDts_1.name) + " for " + firstDts_1.name + ":: All output files: " + JSON.stringify(emitOutput_1.outputFiles.map(function (f) { return f.name; })); });
|
|
119214
119313
|
latestSignature = (computeHash || ts.generateDjb2Hash)(firstDts_1.text);
|
|
119215
119314
|
if (exportedModulesMapCache && latestSignature !== prevSignature) {
|
|
119216
119315
|
updateExportedModules(sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit, exportedModulesMapCache);
|
|
@@ -119268,20 +119367,6 @@ var ts;
|
|
|
119268
119367
|
var _a;
|
|
119269
119368
|
if (exportedModulesMapCache) {
|
|
119270
119369
|
ts.Debug.assert(!!state.exportedModulesMap);
|
|
119271
|
-
var cacheId = exportedModulesMapCache.id;
|
|
119272
|
-
var cacheVersion = exportedModulesMapCache.version();
|
|
119273
|
-
if (state.previousCache) {
|
|
119274
|
-
if (state.previousCache.id === cacheId && state.previousCache.version === cacheVersion) {
|
|
119275
|
-
// If this is the same cache at the same version as last time this BuilderState
|
|
119276
|
-
// was updated, there's no need to update again
|
|
119277
|
-
return;
|
|
119278
|
-
}
|
|
119279
|
-
state.previousCache.id = cacheId;
|
|
119280
|
-
state.previousCache.version = cacheVersion;
|
|
119281
|
-
}
|
|
119282
|
-
else {
|
|
119283
|
-
state.previousCache = { id: cacheId, version: cacheVersion };
|
|
119284
|
-
}
|
|
119285
119370
|
(_a = exportedModulesMapCache.deletedKeys()) === null || _a === void 0 ? void 0 : _a.forEach(function (path) { return state.exportedModulesMap.deleteKey(path); });
|
|
119286
119371
|
exportedModulesMapCache.forEach(function (exportedModules, path) { return state.exportedModulesMap.set(path, exportedModules); });
|
|
119287
119372
|
}
|
|
@@ -119615,7 +119700,8 @@ var ts;
|
|
|
119615
119700
|
* This is to allow the callers to be able to actually remove affected file only when the operation is complete
|
|
119616
119701
|
* eg. if during diagnostics check cancellation token ends up cancelling the request, the affected file should be retained
|
|
119617
119702
|
*/
|
|
119618
|
-
function getNextAffectedFile(state, cancellationToken, computeHash) {
|
|
119703
|
+
function getNextAffectedFile(state, cancellationToken, computeHash, host) {
|
|
119704
|
+
var _a;
|
|
119619
119705
|
while (true) {
|
|
119620
119706
|
var affectedFiles = state.affectedFiles;
|
|
119621
119707
|
if (affectedFiles) {
|
|
@@ -119626,7 +119712,7 @@ var ts;
|
|
|
119626
119712
|
if (!seenAffectedFiles.has(affectedFile.resolvedPath)) {
|
|
119627
119713
|
// Set the next affected file as seen and remove the cached semantic diagnostics
|
|
119628
119714
|
state.affectedFilesIndex = affectedFilesIndex;
|
|
119629
|
-
handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash);
|
|
119715
|
+
handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host);
|
|
119630
119716
|
return affectedFile;
|
|
119631
119717
|
}
|
|
119632
119718
|
affectedFilesIndex++;
|
|
@@ -119638,6 +119724,7 @@ var ts;
|
|
|
119638
119724
|
ts.BuilderState.updateSignaturesFromCache(state, state.currentAffectedFilesSignatures);
|
|
119639
119725
|
state.currentAffectedFilesSignatures.clear();
|
|
119640
119726
|
ts.BuilderState.updateExportedFilesMapFromCache(state, state.currentAffectedFilesExportedModulesMap);
|
|
119727
|
+
(_a = state.currentAffectedFilesExportedModulesMap) === null || _a === void 0 ? void 0 : _a.clear();
|
|
119641
119728
|
state.affectedFiles = undefined;
|
|
119642
119729
|
}
|
|
119643
119730
|
// Get next changed file
|
|
@@ -119667,6 +119754,11 @@ var ts;
|
|
|
119667
119754
|
state.seenAffectedFiles = new ts.Set();
|
|
119668
119755
|
}
|
|
119669
119756
|
}
|
|
119757
|
+
function clearAffectedFilesPendingEmit(state) {
|
|
119758
|
+
state.affectedFilesPendingEmit = undefined;
|
|
119759
|
+
state.affectedFilesPendingEmitKind = undefined;
|
|
119760
|
+
state.affectedFilesPendingEmitIndex = undefined;
|
|
119761
|
+
}
|
|
119670
119762
|
/**
|
|
119671
119763
|
* Returns next file to be emitted from files that retrieved semantic diagnostics but did not emit yet
|
|
119672
119764
|
*/
|
|
@@ -119686,9 +119778,7 @@ var ts;
|
|
|
119686
119778
|
}
|
|
119687
119779
|
}
|
|
119688
119780
|
}
|
|
119689
|
-
state
|
|
119690
|
-
state.affectedFilesPendingEmitKind = undefined;
|
|
119691
|
-
state.affectedFilesPendingEmitIndex = undefined;
|
|
119781
|
+
clearAffectedFilesPendingEmit(state);
|
|
119692
119782
|
}
|
|
119693
119783
|
return undefined;
|
|
119694
119784
|
}
|
|
@@ -119696,7 +119786,7 @@ var ts;
|
|
|
119696
119786
|
* Handles semantic diagnostics and dts emit for affectedFile and files, that are referencing modules that export entities from affected file
|
|
119697
119787
|
* This is because even though js emit doesnt change, dts emit / type used can change resulting in need for dts emit and js change
|
|
119698
119788
|
*/
|
|
119699
|
-
function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash) {
|
|
119789
|
+
function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
|
|
119700
119790
|
var _a;
|
|
119701
119791
|
removeSemanticDiagnosticsOf(state, affectedFile.resolvedPath);
|
|
119702
119792
|
// If affected files is everything except default library, then nothing more to do
|
|
@@ -119721,14 +119811,14 @@ var ts;
|
|
|
119721
119811
|
ts.Debug.assert(state.hasCalledUpdateShapeSignature.has(affectedFile.resolvedPath) || ((_a = state.currentAffectedFilesSignatures) === null || _a === void 0 ? void 0 : _a.has(affectedFile.resolvedPath)), "Signature not updated for affected file: " + affectedFile.fileName);
|
|
119722
119812
|
}
|
|
119723
119813
|
if (!state.compilerOptions.assumeChangesOnlyAffectDirectDependencies) {
|
|
119724
|
-
forEachReferencingModulesOfExportOfAffectedFile(state, affectedFile, function (state, path) { return handleDtsMayChangeOf(state, path, cancellationToken, computeHash); });
|
|
119814
|
+
forEachReferencingModulesOfExportOfAffectedFile(state, affectedFile, function (state, path) { return handleDtsMayChangeOf(state, path, cancellationToken, computeHash, host); });
|
|
119725
119815
|
}
|
|
119726
119816
|
}
|
|
119727
119817
|
/**
|
|
119728
119818
|
* Handle the dts may change, so they need to be added to pending emit if dts emit is enabled,
|
|
119729
119819
|
* Also we need to make sure signature is updated for these files
|
|
119730
119820
|
*/
|
|
119731
|
-
function handleDtsMayChangeOf(state, path, cancellationToken, computeHash) {
|
|
119821
|
+
function handleDtsMayChangeOf(state, path, cancellationToken, computeHash, host) {
|
|
119732
119822
|
removeSemanticDiagnosticsOf(state, path);
|
|
119733
119823
|
if (!state.changedFilesSet.has(path)) {
|
|
119734
119824
|
var program = ts.Debug.checkDefined(state.program);
|
|
@@ -119739,8 +119829,7 @@ var ts;
|
|
|
119739
119829
|
// This ensures that we dont later during incremental builds considering wrong signature.
|
|
119740
119830
|
// Eg where this also is needed to ensure that .tsbuildinfo generated by incremental build should be same as if it was first fresh build
|
|
119741
119831
|
// But we avoid expensive full shape computation, as using file version as shape is enough for correctness.
|
|
119742
|
-
ts.BuilderState.updateShapeSignature(state, program, sourceFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap,
|
|
119743
|
-
/* useFileVersionAsSignature */ true);
|
|
119832
|
+
ts.BuilderState.updateShapeSignature(state, program, sourceFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap, !host.disableUseFileVersionAsSignature);
|
|
119744
119833
|
// If not dts emit, nothing more to do
|
|
119745
119834
|
if (ts.getEmitDeclarations(state.compilerOptions)) {
|
|
119746
119835
|
addToAffectedFilesPendingEmit(state, path, 0 /* DtsOnly */);
|
|
@@ -119937,13 +120026,18 @@ var ts;
|
|
|
119937
120026
|
var signature = state.currentAffectedFilesSignatures && state.currentAffectedFilesSignatures.get(key);
|
|
119938
120027
|
var actualSignature = signature !== null && signature !== void 0 ? signature : value.signature;
|
|
119939
120028
|
return value.version === actualSignature ?
|
|
119940
|
-
value.affectsGlobalScope ?
|
|
119941
|
-
|
|
120029
|
+
value.affectsGlobalScope || value.impliedFormat ?
|
|
120030
|
+
// If file version is same as signature, dont serialize signature
|
|
120031
|
+
{ version: value.version, signature: undefined, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
|
|
120032
|
+
// If file info only contains version and signature and both are same we can just write string
|
|
119942
120033
|
value.version :
|
|
119943
|
-
actualSignature !== undefined ?
|
|
120034
|
+
actualSignature !== undefined ? // If signature is not same as version, encode signature in the fileInfo
|
|
119944
120035
|
signature === undefined ?
|
|
120036
|
+
// If we havent computed signature, use fileInfo as is
|
|
119945
120037
|
value :
|
|
120038
|
+
// Serialize fileInfo with new updated signature
|
|
119946
120039
|
{ version: value.version, signature: signature, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
|
|
120040
|
+
// Signature of the FileInfo is undefined, serialize it as false
|
|
119947
120041
|
{ version: value.version, signature: false, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat };
|
|
119948
120042
|
});
|
|
119949
120043
|
var referencedMap;
|
|
@@ -120188,7 +120282,7 @@ var ts;
|
|
|
120188
120282
|
* in that order would be used to write the files
|
|
120189
120283
|
*/
|
|
120190
120284
|
function emitNextAffectedFile(writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) {
|
|
120191
|
-
var affected = getNextAffectedFile(state, cancellationToken, computeHash);
|
|
120285
|
+
var affected = getNextAffectedFile(state, cancellationToken, computeHash, host);
|
|
120192
120286
|
var emitKind = 1 /* Full */;
|
|
120193
120287
|
var isPendingEmitFile = false;
|
|
120194
120288
|
if (!affected) {
|
|
@@ -120233,54 +120327,48 @@ var ts;
|
|
|
120233
120327
|
* in that order would be used to write the files
|
|
120234
120328
|
*/
|
|
120235
120329
|
function emit(targetSourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) {
|
|
120236
|
-
var
|
|
120237
|
-
var savedAffectedFilesPendingEmit;
|
|
120238
|
-
var savedAffectedFilesPendingEmitKind;
|
|
120239
|
-
var savedAffectedFilesPendingEmitIndex;
|
|
120240
|
-
// Backup and restore affected pendings emit state for non emit Builder if noEmitOnError is enabled and emitBuildInfo could be written in case there are errors
|
|
120241
|
-
// This ensures pending files to emit is updated in tsbuildinfo
|
|
120242
|
-
// Note that when there are no errors, emit proceeds as if everything is emitted as it is callers reponsibility to write the files to disk if at all (because its builder that doesnt track files to emit)
|
|
120243
|
-
if (kind !== BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram &&
|
|
120244
|
-
!targetSourceFile &&
|
|
120245
|
-
!ts.outFile(state.compilerOptions) &&
|
|
120246
|
-
!state.compilerOptions.noEmit &&
|
|
120247
|
-
state.compilerOptions.noEmitOnError) {
|
|
120248
|
-
restorePendingEmitOnHandlingNoEmitSuccess = true;
|
|
120249
|
-
savedAffectedFilesPendingEmit = state.affectedFilesPendingEmit && state.affectedFilesPendingEmit.slice();
|
|
120250
|
-
savedAffectedFilesPendingEmitKind = state.affectedFilesPendingEmitKind && new ts.Map(state.affectedFilesPendingEmitKind);
|
|
120251
|
-
savedAffectedFilesPendingEmitIndex = state.affectedFilesPendingEmitIndex;
|
|
120252
|
-
}
|
|
120330
|
+
var _a;
|
|
120253
120331
|
if (kind === BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram) {
|
|
120254
120332
|
assertSourceFileOkWithoutNextAffectedCall(state, targetSourceFile);
|
|
120255
120333
|
}
|
|
120256
120334
|
var result = ts.handleNoEmitOptions(builderProgram, targetSourceFile, writeFile, cancellationToken);
|
|
120257
120335
|
if (result)
|
|
120258
120336
|
return result;
|
|
120259
|
-
if (restorePendingEmitOnHandlingNoEmitSuccess) {
|
|
120260
|
-
state.affectedFilesPendingEmit = savedAffectedFilesPendingEmit;
|
|
120261
|
-
state.affectedFilesPendingEmitKind = savedAffectedFilesPendingEmitKind;
|
|
120262
|
-
state.affectedFilesPendingEmitIndex = savedAffectedFilesPendingEmitIndex;
|
|
120263
|
-
}
|
|
120264
120337
|
// Emit only affected files if using builder for emit
|
|
120265
|
-
if (!targetSourceFile
|
|
120266
|
-
|
|
120267
|
-
|
|
120268
|
-
|
|
120269
|
-
|
|
120270
|
-
|
|
120271
|
-
|
|
120272
|
-
|
|
120273
|
-
|
|
120274
|
-
|
|
120275
|
-
|
|
120276
|
-
|
|
120338
|
+
if (!targetSourceFile) {
|
|
120339
|
+
if (kind === BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram) {
|
|
120340
|
+
// Emit and report any errors we ran into.
|
|
120341
|
+
var sourceMaps = [];
|
|
120342
|
+
var emitSkipped = false;
|
|
120343
|
+
var diagnostics = void 0;
|
|
120344
|
+
var emittedFiles = [];
|
|
120345
|
+
var affectedEmitResult = void 0;
|
|
120346
|
+
while (affectedEmitResult = emitNextAffectedFile(writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers)) {
|
|
120347
|
+
emitSkipped = emitSkipped || affectedEmitResult.result.emitSkipped;
|
|
120348
|
+
diagnostics = ts.addRange(diagnostics, affectedEmitResult.result.diagnostics);
|
|
120349
|
+
emittedFiles = ts.addRange(emittedFiles, affectedEmitResult.result.emittedFiles);
|
|
120350
|
+
sourceMaps = ts.addRange(sourceMaps, affectedEmitResult.result.sourceMaps);
|
|
120351
|
+
}
|
|
120352
|
+
return {
|
|
120353
|
+
emitSkipped: emitSkipped,
|
|
120354
|
+
diagnostics: diagnostics || ts.emptyArray,
|
|
120355
|
+
emittedFiles: emittedFiles,
|
|
120356
|
+
sourceMaps: sourceMaps
|
|
120357
|
+
};
|
|
120358
|
+
}
|
|
120359
|
+
// In non Emit builder, clear affected files pending emit
|
|
120360
|
+
else if ((_a = state.affectedFilesPendingEmitKind) === null || _a === void 0 ? void 0 : _a.size) {
|
|
120361
|
+
ts.Debug.assert(kind === BuilderProgramKind.SemanticDiagnosticsBuilderProgram);
|
|
120362
|
+
// State can clear affected files pending emit if
|
|
120363
|
+
if (!emitOnlyDtsFiles // If we are doing complete emit, affected files pending emit can be cleared
|
|
120364
|
+
// If every file pending emit is pending on only dts emit
|
|
120365
|
+
|| ts.every(state.affectedFilesPendingEmit, function (path, index) {
|
|
120366
|
+
return index < state.affectedFilesPendingEmitIndex ||
|
|
120367
|
+
state.affectedFilesPendingEmitKind.get(path) === 0 /* DtsOnly */;
|
|
120368
|
+
})) {
|
|
120369
|
+
clearAffectedFilesPendingEmit(state);
|
|
120370
|
+
}
|
|
120277
120371
|
}
|
|
120278
|
-
return {
|
|
120279
|
-
emitSkipped: emitSkipped,
|
|
120280
|
-
diagnostics: diagnostics || ts.emptyArray,
|
|
120281
|
-
emittedFiles: emittedFiles,
|
|
120282
|
-
sourceMaps: sourceMaps
|
|
120283
|
-
};
|
|
120284
120372
|
}
|
|
120285
120373
|
return ts.Debug.checkDefined(state.program).emit(targetSourceFile, writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers);
|
|
120286
120374
|
}
|
|
@@ -120290,7 +120378,7 @@ var ts;
|
|
|
120290
120378
|
*/
|
|
120291
120379
|
function getSemanticDiagnosticsOfNextAffectedFile(cancellationToken, ignoreSourceFile) {
|
|
120292
120380
|
while (true) {
|
|
120293
|
-
var affected = getNextAffectedFile(state, cancellationToken, computeHash);
|
|
120381
|
+
var affected = getNextAffectedFile(state, cancellationToken, computeHash, host);
|
|
120294
120382
|
if (!affected) {
|
|
120295
120383
|
// Done
|
|
120296
120384
|
return undefined;
|
|
@@ -123410,9 +123498,6 @@ var ts;
|
|
|
123410
123498
|
function newer(date1, date2) {
|
|
123411
123499
|
return date2 > date1 ? date2 : date1;
|
|
123412
123500
|
}
|
|
123413
|
-
function isDeclarationFile(fileName) {
|
|
123414
|
-
return ts.fileExtensionIs(fileName, ".d.ts" /* Dts */);
|
|
123415
|
-
}
|
|
123416
123501
|
/*@internal*/
|
|
123417
123502
|
function isCircularBuildOrder(buildOrder) {
|
|
123418
123503
|
return !!buildOrder && !!buildOrder.buildOrder;
|
|
@@ -123975,7 +124060,7 @@ var ts;
|
|
|
123975
124060
|
outputFiles.forEach(function (_a) {
|
|
123976
124061
|
var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
|
|
123977
124062
|
var priorChangeTime;
|
|
123978
|
-
if (!anyDtsChanged &&
|
|
124063
|
+
if (!anyDtsChanged && ts.isDeclarationFileName(name)) {
|
|
123979
124064
|
// Check for unchanged .d.ts files
|
|
123980
124065
|
if (host.fileExists(name) && state.readFileWithCache(name) === text) {
|
|
123981
124066
|
priorChangeTime = host.getModifiedTime(name);
|
|
@@ -124316,7 +124401,7 @@ var ts;
|
|
|
124316
124401
|
// In addition to file timestamps, we also keep track of when a .d.ts file
|
|
124317
124402
|
// had its file touched but not had its contents changed - this allows us
|
|
124318
124403
|
// to skip a downstream typecheck
|
|
124319
|
-
if (
|
|
124404
|
+
if (ts.isDeclarationFileName(output)) {
|
|
124320
124405
|
var outputModifiedTime = ts.getModifiedTime(host, output);
|
|
124321
124406
|
newestDeclarationFileContentChangedTime = newer(newestDeclarationFileContentChangedTime, outputModifiedTime);
|
|
124322
124407
|
}
|
|
@@ -124470,7 +124555,7 @@ var ts;
|
|
|
124470
124555
|
reportVerbose = false;
|
|
124471
124556
|
reportStatus(state, verboseMessage, proj.options.configFilePath);
|
|
124472
124557
|
}
|
|
124473
|
-
if (
|
|
124558
|
+
if (ts.isDeclarationFileName(file)) {
|
|
124474
124559
|
priorNewestUpdateTime = newer(priorNewestUpdateTime, ts.getModifiedTime(host, file));
|
|
124475
124560
|
}
|
|
124476
124561
|
host.setModifiedTime(file, now);
|