typescript 4.7.0-dev.20220408 → 4.7.0-dev.20220415
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 +198 -140
- package/lib/tsserver.js +604 -256
- package/lib/tsserverlibrary.d.ts +7 -2
- package/lib/tsserverlibrary.js +604 -256
- package/lib/typescript.d.ts +0 -1
- package/lib/typescript.js +363 -236
- package/lib/typescriptServices.d.ts +0 -1
- package/lib/typescriptServices.js +363 -236
- package/lib/typingsInstaller.js +221 -158
- 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-dev.
|
|
92
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220415";
|
|
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";
|
|
@@ -14955,6 +14954,10 @@ var ts;
|
|
|
14955
14954
|
}
|
|
14956
14955
|
}
|
|
14957
14956
|
ts.isAnyImportSyntax = isAnyImportSyntax;
|
|
14957
|
+
function isAnyImportOrBareOrAccessedRequire(node) {
|
|
14958
|
+
return isAnyImportSyntax(node) || isVariableDeclarationInitializedToBareOrAccessedRequire(node);
|
|
14959
|
+
}
|
|
14960
|
+
ts.isAnyImportOrBareOrAccessedRequire = isAnyImportOrBareOrAccessedRequire;
|
|
14958
14961
|
function isLateVisibilityPaintedStatement(node) {
|
|
14959
14962
|
switch (node.kind) {
|
|
14960
14963
|
case 266 /* ImportDeclaration */:
|
|
@@ -16315,17 +16318,13 @@ var ts;
|
|
|
16315
16318
|
if (isPropertyNameLiteral(name) && isPropertyNameLiteral(initializer)) {
|
|
16316
16319
|
return getTextOfIdentifierOrLiteral(name) === getTextOfIdentifierOrLiteral(initializer);
|
|
16317
16320
|
}
|
|
16318
|
-
if (ts.
|
|
16321
|
+
if (ts.isMemberName(name) && isLiteralLikeAccess(initializer) &&
|
|
16319
16322
|
(initializer.expression.kind === 108 /* ThisKeyword */ ||
|
|
16320
16323
|
ts.isIdentifier(initializer.expression) &&
|
|
16321
16324
|
(initializer.expression.escapedText === "window" ||
|
|
16322
16325
|
initializer.expression.escapedText === "self" ||
|
|
16323
16326
|
initializer.expression.escapedText === "global"))) {
|
|
16324
|
-
|
|
16325
|
-
if (ts.isPrivateIdentifier(nameOrArgument)) {
|
|
16326
|
-
ts.Debug.fail("Unexpected PrivateIdentifier in name expression with literal-like access.");
|
|
16327
|
-
}
|
|
16328
|
-
return isSameEntityName(name, nameOrArgument);
|
|
16327
|
+
return isSameEntityName(name, getNameOrArgument(initializer));
|
|
16329
16328
|
}
|
|
16330
16329
|
if (isLiteralLikeAccess(name) && isLiteralLikeAccess(initializer)) {
|
|
16331
16330
|
return getElementOrPropertyAccessName(name) === getElementOrPropertyAccessName(initializer)
|
|
@@ -16533,14 +16532,14 @@ var ts;
|
|
|
16533
16532
|
}
|
|
16534
16533
|
ts.isFunctionSymbol = isFunctionSymbol;
|
|
16535
16534
|
function tryGetModuleSpecifierFromDeclaration(node) {
|
|
16536
|
-
var _a, _b
|
|
16535
|
+
var _a, _b;
|
|
16537
16536
|
switch (node.kind) {
|
|
16538
16537
|
case 254 /* VariableDeclaration */:
|
|
16539
|
-
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];
|
|
16540
16539
|
case 266 /* ImportDeclaration */:
|
|
16541
|
-
return
|
|
16540
|
+
return ts.tryCast(node.moduleSpecifier, ts.isStringLiteralLike);
|
|
16542
16541
|
case 265 /* ImportEqualsDeclaration */:
|
|
16543
|
-
return
|
|
16542
|
+
return ts.tryCast((_b = ts.tryCast(node.moduleReference, ts.isExternalModuleReference)) === null || _b === void 0 ? void 0 : _b.expression, ts.isStringLiteralLike);
|
|
16544
16543
|
default:
|
|
16545
16544
|
ts.Debug.assertNever(node);
|
|
16546
16545
|
}
|
|
@@ -17055,7 +17054,10 @@ var ts;
|
|
|
17055
17054
|
return parent.propertyName === node;
|
|
17056
17055
|
case 275 /* ExportSpecifier */:
|
|
17057
17056
|
case 285 /* JsxAttribute */:
|
|
17058
|
-
|
|
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
|
|
17059
17061
|
return true;
|
|
17060
17062
|
}
|
|
17061
17063
|
return false;
|
|
@@ -17071,21 +17073,28 @@ var ts;
|
|
|
17071
17073
|
// export = <EntityNameExpression>
|
|
17072
17074
|
// export default <EntityNameExpression>
|
|
17073
17075
|
// module.exports = <EntityNameExpression>
|
|
17074
|
-
//
|
|
17075
|
-
//
|
|
17076
|
+
// module.exports.x = <EntityNameExpression>
|
|
17077
|
+
// const x = require("...")
|
|
17078
|
+
// const { x } = require("...")
|
|
17079
|
+
// const x = require("...").y
|
|
17080
|
+
// const { x } = require("...").y
|
|
17076
17081
|
function isAliasSymbolDeclaration(node) {
|
|
17077
|
-
|
|
17082
|
+
if (node.kind === 265 /* ImportEqualsDeclaration */ ||
|
|
17078
17083
|
node.kind === 264 /* NamespaceExportDeclaration */ ||
|
|
17079
17084
|
node.kind === 267 /* ImportClause */ && !!node.name ||
|
|
17080
17085
|
node.kind === 268 /* NamespaceImport */ ||
|
|
17081
17086
|
node.kind === 274 /* NamespaceExport */ ||
|
|
17082
17087
|
node.kind === 270 /* ImportSpecifier */ ||
|
|
17083
17088
|
node.kind === 275 /* ExportSpecifier */ ||
|
|
17084
|
-
node.kind === 271 /* ExportAssignment */ && exportAssignmentIsAlias(node)
|
|
17085
|
-
|
|
17086
|
-
|
|
17087
|
-
|
|
17088
|
-
|
|
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));
|
|
17089
17098
|
}
|
|
17090
17099
|
ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration;
|
|
17091
17100
|
function getAliasDeclarationFromName(node) {
|
|
@@ -17096,6 +17105,7 @@ var ts;
|
|
|
17096
17105
|
case 275 /* ExportSpecifier */:
|
|
17097
17106
|
case 271 /* ExportAssignment */:
|
|
17098
17107
|
case 265 /* ImportEqualsDeclaration */:
|
|
17108
|
+
case 274 /* NamespaceExport */:
|
|
17099
17109
|
return node.parent;
|
|
17100
17110
|
case 161 /* QualifiedName */:
|
|
17101
17111
|
do {
|
|
@@ -18922,6 +18932,11 @@ var ts;
|
|
|
18922
18932
|
(node.parent.kind === 206 /* PropertyAccessExpression */ && node.parent.name === node);
|
|
18923
18933
|
}
|
|
18924
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;
|
|
18925
18940
|
function isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName(node) {
|
|
18926
18941
|
return ts.isQualifiedName(node.parent) && node.parent.right === node
|
|
18927
18942
|
|| ts.isPropertyAccessExpression(node.parent) && node.parent.name === node
|
|
@@ -19573,6 +19588,41 @@ var ts;
|
|
|
19573
19588
|
return expr;
|
|
19574
19589
|
}
|
|
19575
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;
|
|
19576
19626
|
function getLeftmostExpression(node, stopAtCallExpressions) {
|
|
19577
19627
|
while (true) {
|
|
19578
19628
|
switch (node.kind) {
|
|
@@ -20520,6 +20570,7 @@ var ts;
|
|
|
20520
20570
|
ts.supportedJSExtensionsFlat = ts.flatten(ts.supportedJSExtensions);
|
|
20521
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 */]];
|
|
20522
20572
|
var allSupportedExtensionsWithJson = __spreadArray(__spreadArray([], allSupportedExtensions, true), [[".json" /* Json */]], false);
|
|
20573
|
+
ts.supportedDeclarationExtensions = [".d.ts" /* Dts */, ".d.cts" /* Dcts */, ".d.mts" /* Dmts */];
|
|
20523
20574
|
function getSupportedExtensions(options, extraFileExtensions) {
|
|
20524
20575
|
var needJsExtensions = options && getAllowJSCompilerOption(options);
|
|
20525
20576
|
if (!extraFileExtensions || extraFileExtensions.length === 0) {
|
|
@@ -21208,6 +21259,11 @@ var ts;
|
|
|
21208
21259
|
return state > 1 /* NodeModules */ ? { topLevelNodeModulesIndex: topLevelNodeModulesIndex, topLevelPackageNameIndex: topLevelPackageNameIndex, packageRootIndex: packageRootIndex, fileNameIndex: fileNameIndex } : undefined;
|
|
21209
21260
|
}
|
|
21210
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;
|
|
21211
21267
|
})(ts || (ts = {}));
|
|
21212
21268
|
/* @internal */
|
|
21213
21269
|
var ts;
|
|
@@ -35361,34 +35417,10 @@ var ts;
|
|
|
35361
35417
|
case 20 /* OpenParenToken */: // foo<x>(
|
|
35362
35418
|
case 14 /* NoSubstitutionTemplateLiteral */: // foo<T> `...`
|
|
35363
35419
|
case 15 /* TemplateHead */: // foo<T> `...${100}...`
|
|
35364
|
-
// These tokens can't follow in a call expression, nor can they start an
|
|
35365
|
-
// expression. So, consider the type argument list part of an instantiation
|
|
35366
|
-
// expression.
|
|
35367
|
-
// falls through
|
|
35368
|
-
case 27 /* CommaToken */: // foo<x>,
|
|
35369
|
-
case 24 /* DotToken */: // foo<x>.
|
|
35370
|
-
case 28 /* QuestionDotToken */: // foo<x>?.
|
|
35371
|
-
case 21 /* CloseParenToken */: // foo<x>)
|
|
35372
|
-
case 23 /* CloseBracketToken */: // foo<x>]
|
|
35373
|
-
case 58 /* ColonToken */: // foo<x>:
|
|
35374
|
-
case 26 /* SemicolonToken */: // foo<x>;
|
|
35375
|
-
case 57 /* QuestionToken */: // foo<x>?
|
|
35376
|
-
case 34 /* EqualsEqualsToken */: // foo<x> ==
|
|
35377
|
-
case 36 /* EqualsEqualsEqualsToken */: // foo<x> ===
|
|
35378
|
-
case 35 /* ExclamationEqualsToken */: // foo<x> !=
|
|
35379
|
-
case 37 /* ExclamationEqualsEqualsToken */: // foo<x> !==
|
|
35380
|
-
case 55 /* AmpersandAmpersandToken */: // foo<x> &&
|
|
35381
|
-
case 56 /* BarBarToken */: // foo<x> ||
|
|
35382
|
-
case 60 /* QuestionQuestionToken */: // foo<x> ??
|
|
35383
|
-
case 52 /* CaretToken */: // foo<x> ^
|
|
35384
|
-
case 50 /* AmpersandToken */: // foo<x> &
|
|
35385
|
-
case 51 /* BarToken */: // foo<x> |
|
|
35386
|
-
case 19 /* CloseBraceToken */: // foo<x> }
|
|
35387
|
-
case 1 /* EndOfFileToken */: // foo<x>
|
|
35388
35420
|
return true;
|
|
35389
35421
|
}
|
|
35390
|
-
//
|
|
35391
|
-
return
|
|
35422
|
+
// Consider something a type argument list only if the following token can't start an expression.
|
|
35423
|
+
return !isStartOfExpression();
|
|
35392
35424
|
}
|
|
35393
35425
|
function parsePrimaryExpression() {
|
|
35394
35426
|
switch (token()) {
|
|
@@ -38606,7 +38638,7 @@ var ts;
|
|
|
38606
38638
|
})(IncrementalParser || (IncrementalParser = {}));
|
|
38607
38639
|
/** @internal */
|
|
38608
38640
|
function isDeclarationFileName(fileName) {
|
|
38609
|
-
return ts.fileExtensionIsOneOf(fileName,
|
|
38641
|
+
return ts.fileExtensionIsOneOf(fileName, ts.supportedDeclarationExtensions);
|
|
38610
38642
|
}
|
|
38611
38643
|
ts.isDeclarationFileName = isDeclarationFileName;
|
|
38612
38644
|
function parseResolutionMode(mode, pos, end, reportDiagnostic) {
|
|
@@ -42114,7 +42146,8 @@ var ts;
|
|
|
42114
42146
|
Extensions[Extensions["JavaScript"] = 1] = "JavaScript";
|
|
42115
42147
|
Extensions[Extensions["Json"] = 2] = "Json";
|
|
42116
42148
|
Extensions[Extensions["TSConfig"] = 3] = "TSConfig";
|
|
42117
|
-
Extensions[Extensions["DtsOnly"] = 4] = "DtsOnly";
|
|
42149
|
+
Extensions[Extensions["DtsOnly"] = 4] = "DtsOnly";
|
|
42150
|
+
Extensions[Extensions["TsOnly"] = 5] = "TsOnly";
|
|
42118
42151
|
})(Extensions || (Extensions = {}));
|
|
42119
42152
|
/** Used with `Extensions.DtsOnly` to extract the path from TypeScript results. */
|
|
42120
42153
|
function resolvedTypeScriptOnly(resolved) {
|
|
@@ -43059,7 +43092,21 @@ var ts;
|
|
|
43059
43092
|
return nodeModuleNameResolverWorker(NodeResolutionFeatures.None, moduleName, initialDir, { moduleResolution: ts.ModuleResolutionKind.NodeJs, allowJs: true }, host, /*cache*/ undefined, jsOnlyExtensions, /*redirectedReferences*/ undefined);
|
|
43060
43093
|
}
|
|
43061
43094
|
function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, lookupConfig) {
|
|
43062
|
-
|
|
43095
|
+
var extensions;
|
|
43096
|
+
if (lookupConfig) {
|
|
43097
|
+
extensions = tsconfigExtensions;
|
|
43098
|
+
}
|
|
43099
|
+
else if (compilerOptions.noDtsResolution) {
|
|
43100
|
+
extensions = [Extensions.TsOnly];
|
|
43101
|
+
if (compilerOptions.allowJs)
|
|
43102
|
+
extensions.push(Extensions.JavaScript);
|
|
43103
|
+
if (compilerOptions.resolveJsonModule)
|
|
43104
|
+
extensions.push(Extensions.Json);
|
|
43105
|
+
}
|
|
43106
|
+
else {
|
|
43107
|
+
extensions = compilerOptions.resolveJsonModule ? tsPlusJsonExtensions : tsExtensions;
|
|
43108
|
+
}
|
|
43109
|
+
return nodeModuleNameResolverWorker(NodeResolutionFeatures.None, moduleName, ts.getDirectoryPath(containingFile), compilerOptions, host, cache, extensions, redirectedReference);
|
|
43063
43110
|
}
|
|
43064
43111
|
ts.nodeModuleNameResolver = nodeModuleNameResolver;
|
|
43065
43112
|
function nodeModuleNameResolverWorker(features, moduleName, containingDirectory, compilerOptions, host, cache, extensions, redirectedReference) {
|
|
@@ -43068,6 +43115,10 @@ var ts;
|
|
|
43068
43115
|
var failedLookupLocations = [];
|
|
43069
43116
|
// conditions are only used by the node12/nodenext resolver - there's no priority order in the list,
|
|
43070
43117
|
//it's essentially a set (priority is determined by object insertion order in the object we look at).
|
|
43118
|
+
var conditions = features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"];
|
|
43119
|
+
if (compilerOptions.noDtsResolution) {
|
|
43120
|
+
conditions.pop();
|
|
43121
|
+
}
|
|
43071
43122
|
var state = {
|
|
43072
43123
|
compilerOptions: compilerOptions,
|
|
43073
43124
|
host: host,
|
|
@@ -43075,7 +43126,7 @@ var ts;
|
|
|
43075
43126
|
failedLookupLocations: failedLookupLocations,
|
|
43076
43127
|
packageJsonInfoCache: cache,
|
|
43077
43128
|
features: features,
|
|
43078
|
-
conditions:
|
|
43129
|
+
conditions: conditions,
|
|
43079
43130
|
};
|
|
43080
43131
|
var result = ts.forEach(extensions, function (ext) { return tryResolve(ext); });
|
|
43081
43132
|
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);
|
|
@@ -43251,9 +43302,9 @@ var ts;
|
|
|
43251
43302
|
}
|
|
43252
43303
|
}
|
|
43253
43304
|
function loadJSOrExactTSFileName(extensions, candidate, onlyRecordFailures, state) {
|
|
43254
|
-
if ((extensions === Extensions.TypeScript || extensions === Extensions.DtsOnly) && ts.
|
|
43305
|
+
if ((extensions === Extensions.TypeScript || extensions === Extensions.DtsOnly) && ts.isDeclarationFileName(candidate)) {
|
|
43255
43306
|
var result = tryFile(candidate, onlyRecordFailures, state);
|
|
43256
|
-
return result !== undefined ? { path: candidate, ext: ts.forEach(
|
|
43307
|
+
return result !== undefined ? { path: candidate, ext: ts.forEach(ts.supportedDeclarationExtensions, function (e) { return ts.fileExtensionIs(candidate, e) ? e : undefined; }) } : undefined;
|
|
43257
43308
|
}
|
|
43258
43309
|
return loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecordFailures, state);
|
|
43259
43310
|
}
|
|
@@ -43283,20 +43334,22 @@ var ts;
|
|
|
43283
43334
|
default: return tryExtension(".d.ts" /* Dts */);
|
|
43284
43335
|
}
|
|
43285
43336
|
case Extensions.TypeScript:
|
|
43337
|
+
case Extensions.TsOnly:
|
|
43338
|
+
var useDts = extensions === Extensions.TypeScript;
|
|
43286
43339
|
switch (originalExtension) {
|
|
43287
43340
|
case ".mjs" /* Mjs */:
|
|
43288
43341
|
case ".mts" /* Mts */:
|
|
43289
43342
|
case ".d.mts" /* Dmts */:
|
|
43290
|
-
return tryExtension(".mts" /* Mts */) || tryExtension(".d.mts" /* Dmts */);
|
|
43343
|
+
return tryExtension(".mts" /* Mts */) || (useDts ? tryExtension(".d.mts" /* Dmts */) : undefined);
|
|
43291
43344
|
case ".cjs" /* Cjs */:
|
|
43292
43345
|
case ".cts" /* Cts */:
|
|
43293
43346
|
case ".d.cts" /* Dcts */:
|
|
43294
|
-
return tryExtension(".cts" /* Cts */) || tryExtension(".d.cts" /* Dcts */);
|
|
43347
|
+
return tryExtension(".cts" /* Cts */) || (useDts ? tryExtension(".d.cts" /* Dcts */) : undefined);
|
|
43295
43348
|
case ".json" /* Json */:
|
|
43296
43349
|
candidate += ".json" /* Json */;
|
|
43297
|
-
return tryExtension(".d.ts" /* Dts */);
|
|
43350
|
+
return useDts ? tryExtension(".d.ts" /* Dts */) : undefined;
|
|
43298
43351
|
default:
|
|
43299
|
-
return tryExtension(".ts" /* Ts */) || tryExtension(".tsx" /* Tsx */) || tryExtension(".d.ts" /* Dts */);
|
|
43352
|
+
return tryExtension(".ts" /* Ts */) || tryExtension(".tsx" /* Tsx */) || (useDts ? tryExtension(".d.ts" /* Dts */) : undefined);
|
|
43300
43353
|
}
|
|
43301
43354
|
case Extensions.JavaScript:
|
|
43302
43355
|
switch (originalExtension) {
|
|
@@ -43523,6 +43576,7 @@ var ts;
|
|
|
43523
43576
|
switch (extensions) {
|
|
43524
43577
|
case Extensions.JavaScript:
|
|
43525
43578
|
case Extensions.Json:
|
|
43579
|
+
case Extensions.TsOnly:
|
|
43526
43580
|
packageFile = readPackageJsonMainField(jsonContent, candidate, state);
|
|
43527
43581
|
break;
|
|
43528
43582
|
case Extensions.TypeScript:
|
|
@@ -43595,14 +43649,16 @@ var ts;
|
|
|
43595
43649
|
function extensionIsOk(extensions, extension) {
|
|
43596
43650
|
switch (extensions) {
|
|
43597
43651
|
case Extensions.JavaScript:
|
|
43598
|
-
return extension === ".js" /* Js */ || extension === ".jsx" /* Jsx */;
|
|
43652
|
+
return extension === ".js" /* Js */ || extension === ".jsx" /* Jsx */ || extension === ".mjs" /* Mjs */ || extension === ".cjs" /* Cjs */;
|
|
43599
43653
|
case Extensions.TSConfig:
|
|
43600
43654
|
case Extensions.Json:
|
|
43601
43655
|
return extension === ".json" /* Json */;
|
|
43602
43656
|
case Extensions.TypeScript:
|
|
43603
|
-
return extension === ".ts" /* Ts */ || extension === ".tsx" /* Tsx */ || extension === ".d.ts" /* Dts */;
|
|
43657
|
+
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 */;
|
|
43658
|
+
case Extensions.TsOnly:
|
|
43659
|
+
return extension === ".ts" /* Ts */ || extension === ".tsx" /* Tsx */ || extension === ".mts" /* Mts */ || extension === ".cts" /* Cts */;
|
|
43604
43660
|
case Extensions.DtsOnly:
|
|
43605
|
-
return extension === ".d.ts" /* Dts */;
|
|
43661
|
+
return extension === ".d.ts" /* Dts */ || extension === ".d.mts" /* Dmts */ || extension === ".d.cts" /* Dcts */;
|
|
43606
43662
|
}
|
|
43607
43663
|
}
|
|
43608
43664
|
/* @internal */
|
|
@@ -52904,9 +52960,6 @@ var ts;
|
|
|
52904
52960
|
if (parameterDeclaration && isRequiredInitializedParameter(parameterDeclaration)) {
|
|
52905
52961
|
parameterType = getOptionalType(parameterType);
|
|
52906
52962
|
}
|
|
52907
|
-
if ((context.flags & 1073741824 /* NoUndefinedOptionalParameterType */) && parameterDeclaration && !ts.isJSDocParameterTag(parameterDeclaration) && isOptionalUninitializedParameter(parameterDeclaration)) {
|
|
52908
|
-
parameterType = getTypeWithFacts(parameterType, 524288 /* NEUndefined */);
|
|
52909
|
-
}
|
|
52910
52963
|
var parameterTypeNode = serializeTypeForDeclaration(context, parameterType, parameterSymbol, context.enclosingDeclaration, privateSymbolVisitor, bundledImports);
|
|
52911
52964
|
var modifiers = !(context.flags & 8192 /* OmitParameterModifiers */) && preserveModifierFlags && parameterDeclaration && parameterDeclaration.modifiers ? parameterDeclaration.modifiers.map(ts.factory.cloneNode) : undefined;
|
|
52912
52965
|
var isRest = parameterDeclaration && ts.isRestParameter(parameterDeclaration) || ts.getCheckFlags(parameterSymbol) & 32768 /* RestParameter */;
|
|
@@ -53465,7 +53518,7 @@ var ts;
|
|
|
53465
53518
|
if (declWithExistingAnnotation && !ts.isFunctionLikeDeclaration(declWithExistingAnnotation) && !ts.isGetAccessorDeclaration(declWithExistingAnnotation)) {
|
|
53466
53519
|
// try to reuse the existing annotation
|
|
53467
53520
|
var existing = ts.getEffectiveTypeAnnotationNode(declWithExistingAnnotation);
|
|
53468
|
-
if (
|
|
53521
|
+
if (typeNodeIsEquivalentToType(existing, declWithExistingAnnotation, type) && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type)) {
|
|
53469
53522
|
var result_6 = serializeExistingTypeNode(context, existing, includePrivateSymbol, bundled);
|
|
53470
53523
|
if (result_6) {
|
|
53471
53524
|
return result_6;
|
|
@@ -53482,6 +53535,16 @@ var ts;
|
|
|
53482
53535
|
context.flags = oldFlags;
|
|
53483
53536
|
return result;
|
|
53484
53537
|
}
|
|
53538
|
+
function typeNodeIsEquivalentToType(typeNode, annotatedDeclaration, type) {
|
|
53539
|
+
var typeFromTypeNode = getTypeFromTypeNode(typeNode);
|
|
53540
|
+
if (typeFromTypeNode === type) {
|
|
53541
|
+
return true;
|
|
53542
|
+
}
|
|
53543
|
+
if (ts.isParameter(annotatedDeclaration) && annotatedDeclaration.questionToken) {
|
|
53544
|
+
return getTypeWithFacts(type, 524288 /* NEUndefined */) === typeFromTypeNode;
|
|
53545
|
+
}
|
|
53546
|
+
return false;
|
|
53547
|
+
}
|
|
53485
53548
|
function serializeReturnTypeForSignature(context, type, signature, includePrivateSymbol, bundled) {
|
|
53486
53549
|
if (!isErrorType(type) && context.enclosingDeclaration) {
|
|
53487
53550
|
var annotation = signature.declaration && ts.getEffectiveReturnTypeNode(signature.declaration);
|
|
@@ -55753,7 +55816,7 @@ var ts;
|
|
|
55753
55816
|
}
|
|
55754
55817
|
}
|
|
55755
55818
|
var sourceTypes = ts.some(constructorTypes, function (t) { return !!(t.flags & ~98304 /* Nullable */); }) ? constructorTypes : types; // TODO: GH#18217
|
|
55756
|
-
type = getUnionType(sourceTypes
|
|
55819
|
+
type = getUnionType(sourceTypes);
|
|
55757
55820
|
}
|
|
55758
55821
|
}
|
|
55759
55822
|
var widened = getWidenedType(addOptionality(type, /*isProperty*/ false, definedInMethod && !definedInConstructor));
|
|
@@ -58502,8 +58565,9 @@ var ts;
|
|
|
58502
58565
|
// levels of nesting, we are presumably exploring a repeating pattern with a long cycle that hasn't
|
|
58503
58566
|
// yet triggered the deeply nested limiter. We have no test cases that actually get to 50 levels of
|
|
58504
58567
|
// nesting, so it is effectively just a safety stop.
|
|
58505
|
-
|
|
58506
|
-
|
|
58568
|
+
var identity_1 = getRecursionIdentity(t);
|
|
58569
|
+
if (stack.length < 10 || stack.length < 50 && !ts.contains(stack, identity_1)) {
|
|
58570
|
+
stack.push(identity_1);
|
|
58507
58571
|
result = computeBaseConstraint(getSimplifiedType(t, /*writing*/ false));
|
|
58508
58572
|
stack.pop();
|
|
58509
58573
|
}
|
|
@@ -66701,12 +66765,12 @@ var ts;
|
|
|
66701
66765
|
function isDeeplyNestedType(type, stack, depth, maxDepth) {
|
|
66702
66766
|
if (maxDepth === void 0) { maxDepth = 3; }
|
|
66703
66767
|
if (depth >= maxDepth) {
|
|
66704
|
-
var
|
|
66768
|
+
var identity_2 = getRecursionIdentity(type);
|
|
66705
66769
|
var count = 0;
|
|
66706
66770
|
var lastTypeId = 0;
|
|
66707
66771
|
for (var i = 0; i < depth; i++) {
|
|
66708
66772
|
var t = stack[i];
|
|
66709
|
-
if (getRecursionIdentity(t) ===
|
|
66773
|
+
if (getRecursionIdentity(t) === identity_2) {
|
|
66710
66774
|
// We only count occurrences with a higher type id than the previous occurrence, since higher
|
|
66711
66775
|
// type ids are an indicator of newer instantiations caused by recursion.
|
|
66712
66776
|
if (t.id >= lastTypeId) {
|
|
@@ -79520,11 +79584,16 @@ var ts;
|
|
|
79520
79584
|
if (constraintType && defaultType) {
|
|
79521
79585
|
checkTypeAssignableTo(defaultType, getTypeWithThisArgument(instantiateType(constraintType, makeUnaryTypeMapper(typeParameter, defaultType)), defaultType), node.default, ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1);
|
|
79522
79586
|
}
|
|
79523
|
-
|
|
79587
|
+
checkNodeDeferred(node);
|
|
79588
|
+
addLazyDiagnostic(function () { return checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_parameter_name_cannot_be_0); });
|
|
79589
|
+
}
|
|
79590
|
+
function checkTypeParameterDeferred(node) {
|
|
79591
|
+
if (ts.isInterfaceDeclaration(node.parent) || ts.isClassLike(node.parent) || ts.isTypeAliasDeclaration(node.parent)) {
|
|
79592
|
+
var typeParameter = getDeclaredTypeOfTypeParameter(getSymbolOfNode(node));
|
|
79524
79593
|
var modifiers = getVarianceModifiers(typeParameter);
|
|
79525
79594
|
if (modifiers) {
|
|
79526
79595
|
var symbol = getSymbolOfNode(node.parent);
|
|
79527
|
-
if (node.parent
|
|
79596
|
+
if (ts.isTypeAliasDeclaration(node.parent) && !(ts.getObjectFlags(getDeclaredTypeOfSymbol(symbol)) & (16 /* Anonymous */ | 32 /* Mapped */))) {
|
|
79528
79597
|
error(node, ts.Diagnostics.Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types);
|
|
79529
79598
|
}
|
|
79530
79599
|
else if (modifiers === 32768 /* In */ || modifiers === 65536 /* Out */) {
|
|
@@ -79537,7 +79606,6 @@ var ts;
|
|
|
79537
79606
|
}
|
|
79538
79607
|
}
|
|
79539
79608
|
}
|
|
79540
|
-
addLazyDiagnostic(function () { return checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_parameter_name_cannot_be_0); });
|
|
79541
79609
|
}
|
|
79542
79610
|
function checkParameter(node) {
|
|
79543
79611
|
// Grammar checking
|
|
@@ -80027,7 +80095,7 @@ var ts;
|
|
|
80027
80095
|
superCallStatement = statement;
|
|
80028
80096
|
break;
|
|
80029
80097
|
}
|
|
80030
|
-
if (
|
|
80098
|
+
if (nodeImmediatelyReferencesSuperOrThis(statement)) {
|
|
80031
80099
|
break;
|
|
80032
80100
|
}
|
|
80033
80101
|
}
|
|
@@ -85380,6 +85448,9 @@ var ts;
|
|
|
85380
85448
|
case 226 /* ClassExpression */:
|
|
85381
85449
|
checkClassExpressionDeferred(node);
|
|
85382
85450
|
break;
|
|
85451
|
+
case 163 /* TypeParameter */:
|
|
85452
|
+
checkTypeParameterDeferred(node);
|
|
85453
|
+
break;
|
|
85383
85454
|
case 279 /* JsxSelfClosingElement */:
|
|
85384
85455
|
checkJsxSelfClosingElementDeferred(node);
|
|
85385
85456
|
break;
|
|
@@ -86476,11 +86547,6 @@ var ts;
|
|
|
86476
86547
|
!parameter.initializer &&
|
|
86477
86548
|
ts.hasSyntacticModifier(parameter, 16476 /* ParameterPropertyModifier */);
|
|
86478
86549
|
}
|
|
86479
|
-
function isOptionalUninitializedParameter(parameter) {
|
|
86480
|
-
return !!strictNullChecks &&
|
|
86481
|
-
isOptionalParameter(parameter) &&
|
|
86482
|
-
!parameter.initializer;
|
|
86483
|
-
}
|
|
86484
86550
|
function isExpandoFunctionDeclaration(node) {
|
|
86485
86551
|
var declaration = ts.getParseTreeNode(node, ts.isFunctionDeclaration);
|
|
86486
86552
|
if (!declaration) {
|
|
@@ -87397,8 +87463,7 @@ var ts;
|
|
|
87397
87463
|
case 144 /* OutKeyword */:
|
|
87398
87464
|
var inOutFlag = modifier.kind === 101 /* InKeyword */ ? 32768 /* In */ : 65536 /* Out */;
|
|
87399
87465
|
var inOutText = modifier.kind === 101 /* InKeyword */ ? "in" : "out";
|
|
87400
|
-
if (node.kind !== 163 /* TypeParameter */ || (node.parent
|
|
87401
|
-
node.parent.kind !== 257 /* ClassDeclaration */ && node.parent.kind !== 259 /* TypeAliasDeclaration */)) {
|
|
87466
|
+
if (node.kind !== 163 /* TypeParameter */ || !(ts.isInterfaceDeclaration(node.parent) || ts.isClassLike(node.parent) || ts.isTypeAliasDeclaration(node.parent))) {
|
|
87402
87467
|
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias, inOutText);
|
|
87403
87468
|
}
|
|
87404
87469
|
if (flags & inOutFlag) {
|
|
@@ -92632,11 +92697,11 @@ var ts;
|
|
|
92632
92697
|
}
|
|
92633
92698
|
var statements = [];
|
|
92634
92699
|
resumeLexicalEnvironment();
|
|
92635
|
-
var
|
|
92636
|
-
var superStatementIndex = ts.findSuperStatementIndex(body.statements,
|
|
92700
|
+
var prologueStatementCount = factory.copyPrologue(body.statements, statements, /*ensureUseStrict*/ false, visitor);
|
|
92701
|
+
var superStatementIndex = ts.findSuperStatementIndex(body.statements, prologueStatementCount);
|
|
92637
92702
|
// If there was a super call, visit existing statements up to and including it
|
|
92638
92703
|
if (superStatementIndex >= 0) {
|
|
92639
|
-
ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement,
|
|
92704
|
+
ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, prologueStatementCount, superStatementIndex + 1 - prologueStatementCount));
|
|
92640
92705
|
}
|
|
92641
92706
|
// Transform parameters into property assignments. Transforms this:
|
|
92642
92707
|
//
|
|
@@ -92655,12 +92720,12 @@ var ts;
|
|
|
92655
92720
|
if (superStatementIndex >= 0) {
|
|
92656
92721
|
ts.addRange(statements, parameterPropertyAssignments);
|
|
92657
92722
|
}
|
|
92658
|
-
// Since there was no super() call, parameter properties are the first statements in the constructor
|
|
92723
|
+
// Since there was no super() call, parameter properties are the first statements in the constructor after any prologue statements
|
|
92659
92724
|
else {
|
|
92660
|
-
statements =
|
|
92725
|
+
statements = __spreadArray(__spreadArray(__spreadArray([], statements.slice(0, prologueStatementCount), true), parameterPropertyAssignments, true), statements.slice(prologueStatementCount), true);
|
|
92661
92726
|
}
|
|
92662
|
-
// Add remaining statements from the body, skipping the super() call if it was found
|
|
92663
|
-
ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, superStatementIndex + 1));
|
|
92727
|
+
// Add remaining statements from the body, skipping the super() call if it was found and any (already added) prologue statements
|
|
92728
|
+
ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, superStatementIndex + 1 + prologueStatementCount));
|
|
92664
92729
|
// End the lexical environment.
|
|
92665
92730
|
statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment());
|
|
92666
92731
|
var block = factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), body.statements), /*multiLine*/ true);
|
|
@@ -109559,7 +109624,7 @@ var ts;
|
|
|
109559
109624
|
addOutput(buildInfoPath);
|
|
109560
109625
|
}
|
|
109561
109626
|
function getOwnOutputFileNames(configFile, inputFileName, ignoreCase, addOutput, getCommonSourceDirectory) {
|
|
109562
|
-
if (ts.
|
|
109627
|
+
if (ts.isDeclarationFileName(inputFileName))
|
|
109563
109628
|
return;
|
|
109564
109629
|
var js = getOutputJSFileName(inputFileName, configFile, ignoreCase, getCommonSourceDirectory);
|
|
109565
109630
|
addOutput(js);
|
|
@@ -109604,7 +109669,7 @@ var ts;
|
|
|
109604
109669
|
/*@internal*/
|
|
109605
109670
|
function getCommonSourceDirectoryOfConfig(_a, ignoreCase) {
|
|
109606
109671
|
var options = _a.options, fileNames = _a.fileNames;
|
|
109607
|
-
return getCommonSourceDirectory(options, function () { return ts.filter(fileNames, function (file) { return !(options.noEmitForJsFiles && ts.fileExtensionIsOneOf(file, ts.supportedJSExtensionsFlat)) && !ts.
|
|
109672
|
+
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));
|
|
109608
109673
|
}
|
|
109609
109674
|
ts.getCommonSourceDirectoryOfConfig = getCommonSourceDirectoryOfConfig;
|
|
109610
109675
|
/*@internal*/
|
|
@@ -109646,7 +109711,7 @@ var ts;
|
|
|
109646
109711
|
var getCommonSourceDirectory = ts.memoize(function () { return getCommonSourceDirectoryOfConfig(configFile, ignoreCase); });
|
|
109647
109712
|
for (var _a = 0, _b = configFile.fileNames; _a < _b.length; _a++) {
|
|
109648
109713
|
var inputFileName = _b[_a];
|
|
109649
|
-
if (ts.
|
|
109714
|
+
if (ts.isDeclarationFileName(inputFileName))
|
|
109650
109715
|
continue;
|
|
109651
109716
|
var jsFilePath = getOutputJSFileName(inputFileName, configFile, ignoreCase, getCommonSourceDirectory);
|
|
109652
109717
|
if (jsFilePath)
|
|
@@ -114996,7 +115061,7 @@ var ts;
|
|
|
114996
115061
|
if (ts.outFile(options) || options.outDir)
|
|
114997
115062
|
return false;
|
|
114998
115063
|
// File if emitted next to input needs to be ignored
|
|
114999
|
-
if (ts.
|
|
115064
|
+
if (ts.isDeclarationFileName(fileOrDirectoryPath)) {
|
|
115000
115065
|
// If its declaration directory: its not ignored if not excluded by config
|
|
115001
115066
|
if (options.declarationDir)
|
|
115002
115067
|
return false;
|
|
@@ -116169,7 +116234,7 @@ var ts;
|
|
|
116169
116234
|
var getCommonSourceDirectory_2 = ts.memoize(function () { return ts.getCommonSourceDirectoryOfConfig(parsedRef.commandLine, !host.useCaseSensitiveFileNames()); });
|
|
116170
116235
|
for (var _b = 0, _c = parsedRef.commandLine.fileNames; _b < _c.length; _b++) {
|
|
116171
116236
|
var fileName = _c[_b];
|
|
116172
|
-
if (!ts.
|
|
116237
|
+
if (!ts.isDeclarationFileName(fileName) && !ts.fileExtensionIs(fileName, ".json" /* Json */)) {
|
|
116173
116238
|
processProjectReferenceFile(ts.getOutputDeclarationFileName(fileName, parsedRef.commandLine, !host.useCaseSensitiveFileNames(), getCommonSourceDirectory_2), { kind: ts.FileIncludeKind.OutputFromProjectReference, index: index });
|
|
116174
116239
|
}
|
|
116175
116240
|
}
|
|
@@ -116360,7 +116425,7 @@ var ts;
|
|
|
116360
116425
|
}
|
|
116361
116426
|
function getRedirectReferenceForResolution(file) {
|
|
116362
116427
|
var redirect = getResolvedProjectReferenceToRedirect(file.originalFileName);
|
|
116363
|
-
if (redirect || !ts.
|
|
116428
|
+
if (redirect || !ts.isDeclarationFileName(file.originalFileName))
|
|
116364
116429
|
return redirect;
|
|
116365
116430
|
// The originalFileName could not be actual source file name if file found was d.ts from referecned project
|
|
116366
116431
|
// 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
|
|
@@ -117751,7 +117816,7 @@ var ts;
|
|
|
117751
117816
|
}
|
|
117752
117817
|
function getProjectReferenceRedirectProject(fileName) {
|
|
117753
117818
|
// Ignore dts or any json files
|
|
117754
|
-
if (!resolvedProjectReferences || !resolvedProjectReferences.length || ts.
|
|
117819
|
+
if (!resolvedProjectReferences || !resolvedProjectReferences.length || ts.isDeclarationFileName(fileName) || ts.fileExtensionIs(fileName, ".json" /* Json */)) {
|
|
117755
117820
|
return undefined;
|
|
117756
117821
|
}
|
|
117757
117822
|
// If this file is produced by a referenced project, we need to rewrite it to
|
|
@@ -117800,7 +117865,7 @@ var ts;
|
|
|
117800
117865
|
else {
|
|
117801
117866
|
var getCommonSourceDirectory_3 = ts.memoize(function () { return ts.getCommonSourceDirectoryOfConfig(resolvedRef.commandLine, !host.useCaseSensitiveFileNames()); });
|
|
117802
117867
|
ts.forEach(resolvedRef.commandLine.fileNames, function (fileName) {
|
|
117803
|
-
if (!ts.
|
|
117868
|
+
if (!ts.isDeclarationFileName(fileName) && !ts.fileExtensionIs(fileName, ".json" /* Json */)) {
|
|
117804
117869
|
var outputDts = ts.getOutputDeclarationFileName(fileName, resolvedRef.commandLine, !host.useCaseSensitiveFileNames(), getCommonSourceDirectory_3);
|
|
117805
117870
|
mapFromToProjectReferenceRedirectSource.set(toPath(outputDts), fileName);
|
|
117806
117871
|
}
|
|
@@ -118601,7 +118666,7 @@ var ts;
|
|
|
118601
118666
|
if (options.outDir) {
|
|
118602
118667
|
return ts.containsPath(options.outDir, filePath, currentDirectory, !host.useCaseSensitiveFileNames());
|
|
118603
118668
|
}
|
|
118604
|
-
if (ts.fileExtensionIsOneOf(filePath, ts.supportedJSExtensionsFlat) || ts.
|
|
118669
|
+
if (ts.fileExtensionIsOneOf(filePath, ts.supportedJSExtensionsFlat) || ts.isDeclarationFileName(filePath)) {
|
|
118605
118670
|
// Otherwise just check if sourceFile with the name exists
|
|
118606
118671
|
var filePathWithoutExtension = ts.removeFileExtension(filePath);
|
|
118607
118672
|
return !!getSourceFileByPath((filePathWithoutExtension + ".ts" /* Ts */)) ||
|
|
@@ -119227,7 +119292,7 @@ var ts;
|
|
|
119227
119292
|
/*forceDtsEmit*/ true);
|
|
119228
119293
|
var firstDts_1 = ts.firstOrUndefined(emitOutput_1.outputFiles);
|
|
119229
119294
|
if (firstDts_1) {
|
|
119230
|
-
ts.Debug.assert(ts.
|
|
119295
|
+
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; })); });
|
|
119231
119296
|
latestSignature = (computeHash || ts.generateDjb2Hash)(firstDts_1.text);
|
|
119232
119297
|
if (exportedModulesMapCache && latestSignature !== prevSignature) {
|
|
119233
119298
|
updateExportedModules(sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit, exportedModulesMapCache);
|
|
@@ -119632,7 +119697,7 @@ var ts;
|
|
|
119632
119697
|
* This is to allow the callers to be able to actually remove affected file only when the operation is complete
|
|
119633
119698
|
* eg. if during diagnostics check cancellation token ends up cancelling the request, the affected file should be retained
|
|
119634
119699
|
*/
|
|
119635
|
-
function getNextAffectedFile(state, cancellationToken, computeHash) {
|
|
119700
|
+
function getNextAffectedFile(state, cancellationToken, computeHash, host) {
|
|
119636
119701
|
while (true) {
|
|
119637
119702
|
var affectedFiles = state.affectedFiles;
|
|
119638
119703
|
if (affectedFiles) {
|
|
@@ -119643,7 +119708,7 @@ var ts;
|
|
|
119643
119708
|
if (!seenAffectedFiles.has(affectedFile.resolvedPath)) {
|
|
119644
119709
|
// Set the next affected file as seen and remove the cached semantic diagnostics
|
|
119645
119710
|
state.affectedFilesIndex = affectedFilesIndex;
|
|
119646
|
-
handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash);
|
|
119711
|
+
handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host);
|
|
119647
119712
|
return affectedFile;
|
|
119648
119713
|
}
|
|
119649
119714
|
affectedFilesIndex++;
|
|
@@ -119684,6 +119749,11 @@ var ts;
|
|
|
119684
119749
|
state.seenAffectedFiles = new ts.Set();
|
|
119685
119750
|
}
|
|
119686
119751
|
}
|
|
119752
|
+
function clearAffectedFilesPendingEmit(state) {
|
|
119753
|
+
state.affectedFilesPendingEmit = undefined;
|
|
119754
|
+
state.affectedFilesPendingEmitKind = undefined;
|
|
119755
|
+
state.affectedFilesPendingEmitIndex = undefined;
|
|
119756
|
+
}
|
|
119687
119757
|
/**
|
|
119688
119758
|
* Returns next file to be emitted from files that retrieved semantic diagnostics but did not emit yet
|
|
119689
119759
|
*/
|
|
@@ -119703,9 +119773,7 @@ var ts;
|
|
|
119703
119773
|
}
|
|
119704
119774
|
}
|
|
119705
119775
|
}
|
|
119706
|
-
state
|
|
119707
|
-
state.affectedFilesPendingEmitKind = undefined;
|
|
119708
|
-
state.affectedFilesPendingEmitIndex = undefined;
|
|
119776
|
+
clearAffectedFilesPendingEmit(state);
|
|
119709
119777
|
}
|
|
119710
119778
|
return undefined;
|
|
119711
119779
|
}
|
|
@@ -119713,7 +119781,7 @@ var ts;
|
|
|
119713
119781
|
* Handles semantic diagnostics and dts emit for affectedFile and files, that are referencing modules that export entities from affected file
|
|
119714
119782
|
* This is because even though js emit doesnt change, dts emit / type used can change resulting in need for dts emit and js change
|
|
119715
119783
|
*/
|
|
119716
|
-
function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash) {
|
|
119784
|
+
function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
|
|
119717
119785
|
var _a;
|
|
119718
119786
|
removeSemanticDiagnosticsOf(state, affectedFile.resolvedPath);
|
|
119719
119787
|
// If affected files is everything except default library, then nothing more to do
|
|
@@ -119738,14 +119806,14 @@ var ts;
|
|
|
119738
119806
|
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);
|
|
119739
119807
|
}
|
|
119740
119808
|
if (!state.compilerOptions.assumeChangesOnlyAffectDirectDependencies) {
|
|
119741
|
-
forEachReferencingModulesOfExportOfAffectedFile(state, affectedFile, function (state, path) { return handleDtsMayChangeOf(state, path, cancellationToken, computeHash); });
|
|
119809
|
+
forEachReferencingModulesOfExportOfAffectedFile(state, affectedFile, function (state, path) { return handleDtsMayChangeOf(state, path, cancellationToken, computeHash, host); });
|
|
119742
119810
|
}
|
|
119743
119811
|
}
|
|
119744
119812
|
/**
|
|
119745
119813
|
* Handle the dts may change, so they need to be added to pending emit if dts emit is enabled,
|
|
119746
119814
|
* Also we need to make sure signature is updated for these files
|
|
119747
119815
|
*/
|
|
119748
|
-
function handleDtsMayChangeOf(state, path, cancellationToken, computeHash) {
|
|
119816
|
+
function handleDtsMayChangeOf(state, path, cancellationToken, computeHash, host) {
|
|
119749
119817
|
removeSemanticDiagnosticsOf(state, path);
|
|
119750
119818
|
if (!state.changedFilesSet.has(path)) {
|
|
119751
119819
|
var program = ts.Debug.checkDefined(state.program);
|
|
@@ -119756,8 +119824,7 @@ var ts;
|
|
|
119756
119824
|
// This ensures that we dont later during incremental builds considering wrong signature.
|
|
119757
119825
|
// Eg where this also is needed to ensure that .tsbuildinfo generated by incremental build should be same as if it was first fresh build
|
|
119758
119826
|
// But we avoid expensive full shape computation, as using file version as shape is enough for correctness.
|
|
119759
|
-
ts.BuilderState.updateShapeSignature(state, program, sourceFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap,
|
|
119760
|
-
/* useFileVersionAsSignature */ true);
|
|
119827
|
+
ts.BuilderState.updateShapeSignature(state, program, sourceFile, ts.Debug.checkDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap, !host.disableUseFileVersionAsSignature);
|
|
119761
119828
|
// If not dts emit, nothing more to do
|
|
119762
119829
|
if (ts.getEmitDeclarations(state.compilerOptions)) {
|
|
119763
119830
|
addToAffectedFilesPendingEmit(state, path, 0 /* DtsOnly */);
|
|
@@ -119954,13 +120021,18 @@ var ts;
|
|
|
119954
120021
|
var signature = state.currentAffectedFilesSignatures && state.currentAffectedFilesSignatures.get(key);
|
|
119955
120022
|
var actualSignature = signature !== null && signature !== void 0 ? signature : value.signature;
|
|
119956
120023
|
return value.version === actualSignature ?
|
|
119957
|
-
value.affectsGlobalScope ?
|
|
119958
|
-
|
|
120024
|
+
value.affectsGlobalScope || value.impliedFormat ?
|
|
120025
|
+
// If file version is same as signature, dont serialize signature
|
|
120026
|
+
{ version: value.version, signature: undefined, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
|
|
120027
|
+
// If file info only contains version and signature and both are same we can just write string
|
|
119959
120028
|
value.version :
|
|
119960
|
-
actualSignature !== undefined ?
|
|
120029
|
+
actualSignature !== undefined ? // If signature is not same as version, encode signature in the fileInfo
|
|
119961
120030
|
signature === undefined ?
|
|
120031
|
+
// If we havent computed signature, use fileInfo as is
|
|
119962
120032
|
value :
|
|
120033
|
+
// Serialize fileInfo with new updated signature
|
|
119963
120034
|
{ version: value.version, signature: signature, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat } :
|
|
120035
|
+
// Signature of the FileInfo is undefined, serialize it as false
|
|
119964
120036
|
{ version: value.version, signature: false, affectsGlobalScope: value.affectsGlobalScope, impliedFormat: value.impliedFormat };
|
|
119965
120037
|
});
|
|
119966
120038
|
var referencedMap;
|
|
@@ -120205,7 +120277,7 @@ var ts;
|
|
|
120205
120277
|
* in that order would be used to write the files
|
|
120206
120278
|
*/
|
|
120207
120279
|
function emitNextAffectedFile(writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) {
|
|
120208
|
-
var affected = getNextAffectedFile(state, cancellationToken, computeHash);
|
|
120280
|
+
var affected = getNextAffectedFile(state, cancellationToken, computeHash, host);
|
|
120209
120281
|
var emitKind = 1 /* Full */;
|
|
120210
120282
|
var isPendingEmitFile = false;
|
|
120211
120283
|
if (!affected) {
|
|
@@ -120250,54 +120322,48 @@ var ts;
|
|
|
120250
120322
|
* in that order would be used to write the files
|
|
120251
120323
|
*/
|
|
120252
120324
|
function emit(targetSourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) {
|
|
120253
|
-
var
|
|
120254
|
-
var savedAffectedFilesPendingEmit;
|
|
120255
|
-
var savedAffectedFilesPendingEmitKind;
|
|
120256
|
-
var savedAffectedFilesPendingEmitIndex;
|
|
120257
|
-
// 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
|
|
120258
|
-
// This ensures pending files to emit is updated in tsbuildinfo
|
|
120259
|
-
// 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)
|
|
120260
|
-
if (kind !== BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram &&
|
|
120261
|
-
!targetSourceFile &&
|
|
120262
|
-
!ts.outFile(state.compilerOptions) &&
|
|
120263
|
-
!state.compilerOptions.noEmit &&
|
|
120264
|
-
state.compilerOptions.noEmitOnError) {
|
|
120265
|
-
restorePendingEmitOnHandlingNoEmitSuccess = true;
|
|
120266
|
-
savedAffectedFilesPendingEmit = state.affectedFilesPendingEmit && state.affectedFilesPendingEmit.slice();
|
|
120267
|
-
savedAffectedFilesPendingEmitKind = state.affectedFilesPendingEmitKind && new ts.Map(state.affectedFilesPendingEmitKind);
|
|
120268
|
-
savedAffectedFilesPendingEmitIndex = state.affectedFilesPendingEmitIndex;
|
|
120269
|
-
}
|
|
120325
|
+
var _a;
|
|
120270
120326
|
if (kind === BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram) {
|
|
120271
120327
|
assertSourceFileOkWithoutNextAffectedCall(state, targetSourceFile);
|
|
120272
120328
|
}
|
|
120273
120329
|
var result = ts.handleNoEmitOptions(builderProgram, targetSourceFile, writeFile, cancellationToken);
|
|
120274
120330
|
if (result)
|
|
120275
120331
|
return result;
|
|
120276
|
-
if (restorePendingEmitOnHandlingNoEmitSuccess) {
|
|
120277
|
-
state.affectedFilesPendingEmit = savedAffectedFilesPendingEmit;
|
|
120278
|
-
state.affectedFilesPendingEmitKind = savedAffectedFilesPendingEmitKind;
|
|
120279
|
-
state.affectedFilesPendingEmitIndex = savedAffectedFilesPendingEmitIndex;
|
|
120280
|
-
}
|
|
120281
120332
|
// Emit only affected files if using builder for emit
|
|
120282
|
-
if (!targetSourceFile
|
|
120283
|
-
|
|
120284
|
-
|
|
120285
|
-
|
|
120286
|
-
|
|
120287
|
-
|
|
120288
|
-
|
|
120289
|
-
|
|
120290
|
-
|
|
120291
|
-
|
|
120292
|
-
|
|
120293
|
-
|
|
120333
|
+
if (!targetSourceFile) {
|
|
120334
|
+
if (kind === BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram) {
|
|
120335
|
+
// Emit and report any errors we ran into.
|
|
120336
|
+
var sourceMaps = [];
|
|
120337
|
+
var emitSkipped = false;
|
|
120338
|
+
var diagnostics = void 0;
|
|
120339
|
+
var emittedFiles = [];
|
|
120340
|
+
var affectedEmitResult = void 0;
|
|
120341
|
+
while (affectedEmitResult = emitNextAffectedFile(writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers)) {
|
|
120342
|
+
emitSkipped = emitSkipped || affectedEmitResult.result.emitSkipped;
|
|
120343
|
+
diagnostics = ts.addRange(diagnostics, affectedEmitResult.result.diagnostics);
|
|
120344
|
+
emittedFiles = ts.addRange(emittedFiles, affectedEmitResult.result.emittedFiles);
|
|
120345
|
+
sourceMaps = ts.addRange(sourceMaps, affectedEmitResult.result.sourceMaps);
|
|
120346
|
+
}
|
|
120347
|
+
return {
|
|
120348
|
+
emitSkipped: emitSkipped,
|
|
120349
|
+
diagnostics: diagnostics || ts.emptyArray,
|
|
120350
|
+
emittedFiles: emittedFiles,
|
|
120351
|
+
sourceMaps: sourceMaps
|
|
120352
|
+
};
|
|
120353
|
+
}
|
|
120354
|
+
// In non Emit builder, clear affected files pending emit
|
|
120355
|
+
else if ((_a = state.affectedFilesPendingEmitKind) === null || _a === void 0 ? void 0 : _a.size) {
|
|
120356
|
+
ts.Debug.assert(kind === BuilderProgramKind.SemanticDiagnosticsBuilderProgram);
|
|
120357
|
+
// State can clear affected files pending emit if
|
|
120358
|
+
if (!emitOnlyDtsFiles // If we are doing complete emit, affected files pending emit can be cleared
|
|
120359
|
+
// If every file pending emit is pending on only dts emit
|
|
120360
|
+
|| ts.every(state.affectedFilesPendingEmit, function (path, index) {
|
|
120361
|
+
return index < state.affectedFilesPendingEmitIndex ||
|
|
120362
|
+
state.affectedFilesPendingEmitKind.get(path) === 0 /* DtsOnly */;
|
|
120363
|
+
})) {
|
|
120364
|
+
clearAffectedFilesPendingEmit(state);
|
|
120365
|
+
}
|
|
120294
120366
|
}
|
|
120295
|
-
return {
|
|
120296
|
-
emitSkipped: emitSkipped,
|
|
120297
|
-
diagnostics: diagnostics || ts.emptyArray,
|
|
120298
|
-
emittedFiles: emittedFiles,
|
|
120299
|
-
sourceMaps: sourceMaps
|
|
120300
|
-
};
|
|
120301
120367
|
}
|
|
120302
120368
|
return ts.Debug.checkDefined(state.program).emit(targetSourceFile, writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers);
|
|
120303
120369
|
}
|
|
@@ -120307,7 +120373,7 @@ var ts;
|
|
|
120307
120373
|
*/
|
|
120308
120374
|
function getSemanticDiagnosticsOfNextAffectedFile(cancellationToken, ignoreSourceFile) {
|
|
120309
120375
|
while (true) {
|
|
120310
|
-
var affected = getNextAffectedFile(state, cancellationToken, computeHash);
|
|
120376
|
+
var affected = getNextAffectedFile(state, cancellationToken, computeHash, host);
|
|
120311
120377
|
if (!affected) {
|
|
120312
120378
|
// Done
|
|
120313
120379
|
return undefined;
|
|
@@ -123427,9 +123493,6 @@ var ts;
|
|
|
123427
123493
|
function newer(date1, date2) {
|
|
123428
123494
|
return date2 > date1 ? date2 : date1;
|
|
123429
123495
|
}
|
|
123430
|
-
function isDeclarationFile(fileName) {
|
|
123431
|
-
return ts.fileExtensionIs(fileName, ".d.ts" /* Dts */);
|
|
123432
|
-
}
|
|
123433
123496
|
/*@internal*/
|
|
123434
123497
|
function isCircularBuildOrder(buildOrder) {
|
|
123435
123498
|
return !!buildOrder && !!buildOrder.buildOrder;
|
|
@@ -123992,7 +124055,7 @@ var ts;
|
|
|
123992
124055
|
outputFiles.forEach(function (_a) {
|
|
123993
124056
|
var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
|
|
123994
124057
|
var priorChangeTime;
|
|
123995
|
-
if (!anyDtsChanged &&
|
|
124058
|
+
if (!anyDtsChanged && ts.isDeclarationFileName(name)) {
|
|
123996
124059
|
// Check for unchanged .d.ts files
|
|
123997
124060
|
if (host.fileExists(name) && state.readFileWithCache(name) === text) {
|
|
123998
124061
|
priorChangeTime = host.getModifiedTime(name);
|
|
@@ -124333,7 +124396,7 @@ var ts;
|
|
|
124333
124396
|
// In addition to file timestamps, we also keep track of when a .d.ts file
|
|
124334
124397
|
// had its file touched but not had its contents changed - this allows us
|
|
124335
124398
|
// to skip a downstream typecheck
|
|
124336
|
-
if (
|
|
124399
|
+
if (ts.isDeclarationFileName(output)) {
|
|
124337
124400
|
var outputModifiedTime = ts.getModifiedTime(host, output);
|
|
124338
124401
|
newestDeclarationFileContentChangedTime = newer(newestDeclarationFileContentChangedTime, outputModifiedTime);
|
|
124339
124402
|
}
|
|
@@ -124487,7 +124550,7 @@ var ts;
|
|
|
124487
124550
|
reportVerbose = false;
|
|
124488
124551
|
reportStatus(state, verboseMessage, proj.options.configFilePath);
|
|
124489
124552
|
}
|
|
124490
|
-
if (
|
|
124553
|
+
if (ts.isDeclarationFileName(file)) {
|
|
124491
124554
|
priorNewestUpdateTime = newer(priorNewestUpdateTime, ts.getModifiedTime(host, file));
|
|
124492
124555
|
}
|
|
124493
124556
|
host.setModifiedTime(file, now);
|