typescript 5.3.1-rc → 5.4.0-dev.20231104
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/lib.es2016.d.ts +1 -0
- package/lib/lib.es2016.intl.d.ts +31 -0
- package/lib/tsc.js +404 -202
- package/lib/tsserver.js +571 -310
- package/lib/typescript.d.ts +1 -1
- package/lib/typescript.js +580 -321
- package/lib/typingsInstaller.js +4 -2
- package/package.json +4 -3
package/lib/tsc.js
CHANGED
|
@@ -17,8 +17,8 @@ and limitations under the License.
|
|
|
17
17
|
"use strict";
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
|
-
var versionMajorMinor = "5.
|
|
21
|
-
var version =
|
|
20
|
+
var versionMajorMinor = "5.4";
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20231104`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -23404,7 +23404,7 @@ function createEmitHelperFactory(context) {
|
|
|
23404
23404
|
]
|
|
23405
23405
|
);
|
|
23406
23406
|
}
|
|
23407
|
-
function createAwaiterHelper(hasLexicalThis,
|
|
23407
|
+
function createAwaiterHelper(hasLexicalThis, argumentsExpression, promiseConstructor, parameters, body) {
|
|
23408
23408
|
context.requestEmitHelper(awaiterHelper);
|
|
23409
23409
|
const generatorFunc = factory2.createFunctionExpression(
|
|
23410
23410
|
/*modifiers*/
|
|
@@ -23414,8 +23414,7 @@ function createEmitHelperFactory(context) {
|
|
|
23414
23414
|
void 0,
|
|
23415
23415
|
/*typeParameters*/
|
|
23416
23416
|
void 0,
|
|
23417
|
-
|
|
23418
|
-
[],
|
|
23417
|
+
parameters ?? [],
|
|
23419
23418
|
/*type*/
|
|
23420
23419
|
void 0,
|
|
23421
23420
|
body
|
|
@@ -23427,7 +23426,7 @@ function createEmitHelperFactory(context) {
|
|
|
23427
23426
|
void 0,
|
|
23428
23427
|
[
|
|
23429
23428
|
hasLexicalThis ? factory2.createThis() : factory2.createVoidZero(),
|
|
23430
|
-
|
|
23429
|
+
argumentsExpression ?? factory2.createVoidZero(),
|
|
23431
23430
|
promiseConstructor ? createExpressionFromEntityName(factory2, promiseConstructor) : factory2.createVoidZero(),
|
|
23432
23431
|
generatorFunc
|
|
23433
23432
|
]
|
|
@@ -33842,6 +33841,7 @@ var libEntries = [
|
|
|
33842
33841
|
["es2015.symbol", "lib.es2015.symbol.d.ts"],
|
|
33843
33842
|
["es2015.symbol.wellknown", "lib.es2015.symbol.wellknown.d.ts"],
|
|
33844
33843
|
["es2016.array.include", "lib.es2016.array.include.d.ts"],
|
|
33844
|
+
["es2016.intl", "lib.es2016.intl.d.ts"],
|
|
33845
33845
|
["es2017.date", "lib.es2017.date.d.ts"],
|
|
33846
33846
|
["es2017.object", "lib.es2017.object.d.ts"],
|
|
33847
33847
|
["es2017.sharedmemory", "lib.es2017.sharedmemory.d.ts"],
|
|
@@ -34173,6 +34173,7 @@ var targetOptionDeclaration = {
|
|
|
34173
34173
|
affectsModuleResolution: true,
|
|
34174
34174
|
affectsEmit: true,
|
|
34175
34175
|
affectsBuildInfo: true,
|
|
34176
|
+
deprecatedKeys: /* @__PURE__ */ new Set(["es3"]),
|
|
34176
34177
|
paramType: Diagnostics.VERSION,
|
|
34177
34178
|
showInSimplifiedHelpView: true,
|
|
34178
34179
|
category: Diagnostics.Language_and_Environment,
|
|
@@ -40034,6 +40035,9 @@ function createBinder() {
|
|
|
40034
40035
|
case 213 /* CallExpression */:
|
|
40035
40036
|
return hasNarrowableArgument(expr);
|
|
40036
40037
|
case 217 /* ParenthesizedExpression */:
|
|
40038
|
+
if (isJSDocTypeAssertion(expr)) {
|
|
40039
|
+
return false;
|
|
40040
|
+
}
|
|
40037
40041
|
case 235 /* NonNullExpression */:
|
|
40038
40042
|
return isNarrowingExpression(expr.expression);
|
|
40039
40043
|
case 226 /* BinaryExpression */:
|
|
@@ -66866,15 +66870,23 @@ function createTypeChecker(host) {
|
|
|
66866
66870
|
error(node, Diagnostics.arguments_cannot_be_referenced_in_property_initializers);
|
|
66867
66871
|
return errorType;
|
|
66868
66872
|
}
|
|
66869
|
-
|
|
66870
|
-
if (
|
|
66871
|
-
if (
|
|
66872
|
-
|
|
66873
|
-
|
|
66874
|
-
|
|
66873
|
+
let container = getContainingFunction(node);
|
|
66874
|
+
if (container) {
|
|
66875
|
+
if (languageVersion < 2 /* ES2015 */) {
|
|
66876
|
+
if (container.kind === 219 /* ArrowFunction */) {
|
|
66877
|
+
error(node, Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression);
|
|
66878
|
+
} else if (hasSyntacticModifier(container, 1024 /* Async */)) {
|
|
66879
|
+
error(node, Diagnostics.The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method);
|
|
66880
|
+
}
|
|
66881
|
+
}
|
|
66882
|
+
getNodeLinks(container).flags |= 512 /* CaptureArguments */;
|
|
66883
|
+
while (container && isArrowFunction(container)) {
|
|
66884
|
+
container = getContainingFunction(container);
|
|
66885
|
+
if (container) {
|
|
66886
|
+
getNodeLinks(container).flags |= 512 /* CaptureArguments */;
|
|
66887
|
+
}
|
|
66875
66888
|
}
|
|
66876
66889
|
}
|
|
66877
|
-
getNodeLinks(container).flags |= 512 /* CaptureArguments */;
|
|
66878
66890
|
return getTypeOfSymbol(symbol);
|
|
66879
66891
|
}
|
|
66880
66892
|
if (shouldMarkIdentifierAliasReferenced(node)) {
|
|
@@ -86741,6 +86753,12 @@ function setPrivateIdentifier(privateEnv, name, entry) {
|
|
|
86741
86753
|
function accessPrivateIdentifier(env, name) {
|
|
86742
86754
|
return walkUpLexicalEnvironments(env, (env2) => getPrivateIdentifier(env2.privateEnv, name));
|
|
86743
86755
|
}
|
|
86756
|
+
function isSimpleParameter(node) {
|
|
86757
|
+
return !node.initializer && isIdentifier(node.name);
|
|
86758
|
+
}
|
|
86759
|
+
function isSimpleParameterList(nodes) {
|
|
86760
|
+
return every(nodes, isSimpleParameter);
|
|
86761
|
+
}
|
|
86744
86762
|
|
|
86745
86763
|
// src/compiler/transformers/destructuring.ts
|
|
86746
86764
|
function flattenDestructuringAssignment(node, visitor, context, level, needsValue, createAssignmentCallback) {
|
|
@@ -94217,6 +94235,7 @@ function transformES2017(context) {
|
|
|
94217
94235
|
let enclosingFunctionParameterNames;
|
|
94218
94236
|
let capturedSuperProperties;
|
|
94219
94237
|
let hasSuperElementAccess;
|
|
94238
|
+
let lexicalArgumentsBinding;
|
|
94220
94239
|
const substitutedSuperAccessors = [];
|
|
94221
94240
|
let contextFlags = 0 /* None */;
|
|
94222
94241
|
const previousOnEmitNode = context.onEmitNode;
|
|
@@ -94267,9 +94286,30 @@ function transformES2017(context) {
|
|
|
94267
94286
|
function visitDefault(node) {
|
|
94268
94287
|
return visitEachChild(node, visitor, context);
|
|
94269
94288
|
}
|
|
94289
|
+
function argumentsVisitor(node) {
|
|
94290
|
+
switch (node.kind) {
|
|
94291
|
+
case 218 /* FunctionExpression */:
|
|
94292
|
+
case 262 /* FunctionDeclaration */:
|
|
94293
|
+
case 174 /* MethodDeclaration */:
|
|
94294
|
+
case 177 /* GetAccessor */:
|
|
94295
|
+
case 178 /* SetAccessor */:
|
|
94296
|
+
case 176 /* Constructor */:
|
|
94297
|
+
return node;
|
|
94298
|
+
case 169 /* Parameter */:
|
|
94299
|
+
case 208 /* BindingElement */:
|
|
94300
|
+
case 260 /* VariableDeclaration */:
|
|
94301
|
+
break;
|
|
94302
|
+
case 80 /* Identifier */:
|
|
94303
|
+
if (lexicalArgumentsBinding && resolver.isArgumentsLocalBinding(node)) {
|
|
94304
|
+
return lexicalArgumentsBinding;
|
|
94305
|
+
}
|
|
94306
|
+
break;
|
|
94307
|
+
}
|
|
94308
|
+
return visitEachChild(node, argumentsVisitor, context);
|
|
94309
|
+
}
|
|
94270
94310
|
function visitor(node) {
|
|
94271
94311
|
if ((node.transformFlags & 256 /* ContainsES2017 */) === 0) {
|
|
94272
|
-
return node;
|
|
94312
|
+
return lexicalArgumentsBinding ? argumentsVisitor(node) : node;
|
|
94273
94313
|
}
|
|
94274
94314
|
switch (node.kind) {
|
|
94275
94315
|
case 134 /* AsyncKeyword */:
|
|
@@ -94427,15 +94467,23 @@ function transformES2017(context) {
|
|
|
94427
94467
|
);
|
|
94428
94468
|
}
|
|
94429
94469
|
function visitConstructorDeclaration(node) {
|
|
94430
|
-
|
|
94470
|
+
const savedLexicalArgumentsBinding = lexicalArgumentsBinding;
|
|
94471
|
+
lexicalArgumentsBinding = void 0;
|
|
94472
|
+
const updated = factory2.updateConstructorDeclaration(
|
|
94431
94473
|
node,
|
|
94432
94474
|
visitNodes2(node.modifiers, visitor, isModifier),
|
|
94433
94475
|
visitParameterList(node.parameters, visitor, context),
|
|
94434
94476
|
transformMethodBody(node)
|
|
94435
94477
|
);
|
|
94478
|
+
lexicalArgumentsBinding = savedLexicalArgumentsBinding;
|
|
94479
|
+
return updated;
|
|
94436
94480
|
}
|
|
94437
94481
|
function visitMethodDeclaration(node) {
|
|
94438
|
-
|
|
94482
|
+
let parameters;
|
|
94483
|
+
const functionFlags = getFunctionFlags(node);
|
|
94484
|
+
const savedLexicalArgumentsBinding = lexicalArgumentsBinding;
|
|
94485
|
+
lexicalArgumentsBinding = void 0;
|
|
94486
|
+
const updated = factory2.updateMethodDeclaration(
|
|
94439
94487
|
node,
|
|
94440
94488
|
visitNodes2(node.modifiers, visitor, isModifierLike),
|
|
94441
94489
|
node.asteriskToken,
|
|
@@ -94444,14 +94492,18 @@ function transformES2017(context) {
|
|
|
94444
94492
|
void 0,
|
|
94445
94493
|
/*typeParameters*/
|
|
94446
94494
|
void 0,
|
|
94447
|
-
visitParameterList(node.parameters, visitor, context),
|
|
94495
|
+
parameters = functionFlags & 2 /* Async */ ? transformAsyncFunctionParameterList(node) : visitParameterList(node.parameters, visitor, context),
|
|
94448
94496
|
/*type*/
|
|
94449
94497
|
void 0,
|
|
94450
|
-
|
|
94498
|
+
functionFlags & 2 /* Async */ ? transformAsyncFunctionBody(node, parameters) : transformMethodBody(node)
|
|
94451
94499
|
);
|
|
94500
|
+
lexicalArgumentsBinding = savedLexicalArgumentsBinding;
|
|
94501
|
+
return updated;
|
|
94452
94502
|
}
|
|
94453
94503
|
function visitGetAccessorDeclaration(node) {
|
|
94454
|
-
|
|
94504
|
+
const savedLexicalArgumentsBinding = lexicalArgumentsBinding;
|
|
94505
|
+
lexicalArgumentsBinding = void 0;
|
|
94506
|
+
const updated = factory2.updateGetAccessorDeclaration(
|
|
94455
94507
|
node,
|
|
94456
94508
|
visitNodes2(node.modifiers, visitor, isModifierLike),
|
|
94457
94509
|
node.name,
|
|
@@ -94460,55 +94512,75 @@ function transformES2017(context) {
|
|
|
94460
94512
|
void 0,
|
|
94461
94513
|
transformMethodBody(node)
|
|
94462
94514
|
);
|
|
94515
|
+
lexicalArgumentsBinding = savedLexicalArgumentsBinding;
|
|
94516
|
+
return updated;
|
|
94463
94517
|
}
|
|
94464
94518
|
function visitSetAccessorDeclaration(node) {
|
|
94465
|
-
|
|
94519
|
+
const savedLexicalArgumentsBinding = lexicalArgumentsBinding;
|
|
94520
|
+
lexicalArgumentsBinding = void 0;
|
|
94521
|
+
const updated = factory2.updateSetAccessorDeclaration(
|
|
94466
94522
|
node,
|
|
94467
94523
|
visitNodes2(node.modifiers, visitor, isModifierLike),
|
|
94468
94524
|
node.name,
|
|
94469
94525
|
visitParameterList(node.parameters, visitor, context),
|
|
94470
94526
|
transformMethodBody(node)
|
|
94471
94527
|
);
|
|
94528
|
+
lexicalArgumentsBinding = savedLexicalArgumentsBinding;
|
|
94529
|
+
return updated;
|
|
94472
94530
|
}
|
|
94473
94531
|
function visitFunctionDeclaration(node) {
|
|
94474
|
-
|
|
94532
|
+
let parameters;
|
|
94533
|
+
const savedLexicalArgumentsBinding = lexicalArgumentsBinding;
|
|
94534
|
+
lexicalArgumentsBinding = void 0;
|
|
94535
|
+
const functionFlags = getFunctionFlags(node);
|
|
94536
|
+
const updated = factory2.updateFunctionDeclaration(
|
|
94475
94537
|
node,
|
|
94476
94538
|
visitNodes2(node.modifiers, visitor, isModifierLike),
|
|
94477
94539
|
node.asteriskToken,
|
|
94478
94540
|
node.name,
|
|
94479
94541
|
/*typeParameters*/
|
|
94480
94542
|
void 0,
|
|
94481
|
-
visitParameterList(node.parameters, visitor, context),
|
|
94543
|
+
parameters = functionFlags & 2 /* Async */ ? transformAsyncFunctionParameterList(node) : visitParameterList(node.parameters, visitor, context),
|
|
94482
94544
|
/*type*/
|
|
94483
94545
|
void 0,
|
|
94484
|
-
|
|
94546
|
+
functionFlags & 2 /* Async */ ? transformAsyncFunctionBody(node, parameters) : visitFunctionBody(node.body, visitor, context)
|
|
94485
94547
|
);
|
|
94548
|
+
lexicalArgumentsBinding = savedLexicalArgumentsBinding;
|
|
94549
|
+
return updated;
|
|
94486
94550
|
}
|
|
94487
94551
|
function visitFunctionExpression(node) {
|
|
94488
|
-
|
|
94552
|
+
let parameters;
|
|
94553
|
+
const savedLexicalArgumentsBinding = lexicalArgumentsBinding;
|
|
94554
|
+
lexicalArgumentsBinding = void 0;
|
|
94555
|
+
const functionFlags = getFunctionFlags(node);
|
|
94556
|
+
const updated = factory2.updateFunctionExpression(
|
|
94489
94557
|
node,
|
|
94490
94558
|
visitNodes2(node.modifiers, visitor, isModifier),
|
|
94491
94559
|
node.asteriskToken,
|
|
94492
94560
|
node.name,
|
|
94493
94561
|
/*typeParameters*/
|
|
94494
94562
|
void 0,
|
|
94495
|
-
visitParameterList(node.parameters, visitor, context),
|
|
94563
|
+
parameters = functionFlags & 2 /* Async */ ? transformAsyncFunctionParameterList(node) : visitParameterList(node.parameters, visitor, context),
|
|
94496
94564
|
/*type*/
|
|
94497
94565
|
void 0,
|
|
94498
|
-
|
|
94566
|
+
functionFlags & 2 /* Async */ ? transformAsyncFunctionBody(node, parameters) : visitFunctionBody(node.body, visitor, context)
|
|
94499
94567
|
);
|
|
94568
|
+
lexicalArgumentsBinding = savedLexicalArgumentsBinding;
|
|
94569
|
+
return updated;
|
|
94500
94570
|
}
|
|
94501
94571
|
function visitArrowFunction(node) {
|
|
94572
|
+
let parameters;
|
|
94573
|
+
const functionFlags = getFunctionFlags(node);
|
|
94502
94574
|
return factory2.updateArrowFunction(
|
|
94503
94575
|
node,
|
|
94504
94576
|
visitNodes2(node.modifiers, visitor, isModifier),
|
|
94505
94577
|
/*typeParameters*/
|
|
94506
94578
|
void 0,
|
|
94507
|
-
visitParameterList(node.parameters, visitor, context),
|
|
94579
|
+
parameters = functionFlags & 2 /* Async */ ? transformAsyncFunctionParameterList(node) : visitParameterList(node.parameters, visitor, context),
|
|
94508
94580
|
/*type*/
|
|
94509
94581
|
void 0,
|
|
94510
94582
|
node.equalsGreaterThanToken,
|
|
94511
|
-
|
|
94583
|
+
functionFlags & 2 /* Async */ ? transformAsyncFunctionBody(node, parameters) : visitFunctionBody(node.body, visitor, context)
|
|
94512
94584
|
);
|
|
94513
94585
|
}
|
|
94514
94586
|
function recordDeclarationName({ name }, names) {
|
|
@@ -94602,13 +94674,91 @@ function transformES2017(context) {
|
|
|
94602
94674
|
hasSuperElementAccess = savedHasSuperElementAccess;
|
|
94603
94675
|
return updated;
|
|
94604
94676
|
}
|
|
94605
|
-
function
|
|
94677
|
+
function createCaptureArgumentsStatement() {
|
|
94678
|
+
Debug.assert(lexicalArgumentsBinding);
|
|
94679
|
+
const variable = factory2.createVariableDeclaration(
|
|
94680
|
+
lexicalArgumentsBinding,
|
|
94681
|
+
/*exclamationToken*/
|
|
94682
|
+
void 0,
|
|
94683
|
+
/*type*/
|
|
94684
|
+
void 0,
|
|
94685
|
+
factory2.createIdentifier("arguments")
|
|
94686
|
+
);
|
|
94687
|
+
const statement = factory2.createVariableStatement(
|
|
94688
|
+
/*modifiers*/
|
|
94689
|
+
void 0,
|
|
94690
|
+
[variable]
|
|
94691
|
+
);
|
|
94692
|
+
startOnNewLine(statement);
|
|
94693
|
+
addEmitFlags(statement, 2097152 /* CustomPrologue */);
|
|
94694
|
+
return statement;
|
|
94695
|
+
}
|
|
94696
|
+
function transformAsyncFunctionParameterList(node) {
|
|
94697
|
+
if (isSimpleParameterList(node.parameters)) {
|
|
94698
|
+
return visitParameterList(node.parameters, visitor, context);
|
|
94699
|
+
}
|
|
94700
|
+
const newParameters = [];
|
|
94701
|
+
for (const parameter of node.parameters) {
|
|
94702
|
+
if (parameter.initializer || parameter.dotDotDotToken) {
|
|
94703
|
+
if (node.kind === 219 /* ArrowFunction */) {
|
|
94704
|
+
const restParameter = factory2.createParameterDeclaration(
|
|
94705
|
+
/*modifiers*/
|
|
94706
|
+
void 0,
|
|
94707
|
+
factory2.createToken(26 /* DotDotDotToken */),
|
|
94708
|
+
factory2.createUniqueName("args", 8 /* ReservedInNestedScopes */)
|
|
94709
|
+
);
|
|
94710
|
+
newParameters.push(restParameter);
|
|
94711
|
+
}
|
|
94712
|
+
break;
|
|
94713
|
+
}
|
|
94714
|
+
const newParameter = factory2.createParameterDeclaration(
|
|
94715
|
+
/*modifiers*/
|
|
94716
|
+
void 0,
|
|
94717
|
+
/*dotDotDotToken*/
|
|
94718
|
+
void 0,
|
|
94719
|
+
factory2.getGeneratedNameForNode(parameter.name, 8 /* ReservedInNestedScopes */)
|
|
94720
|
+
);
|
|
94721
|
+
newParameters.push(newParameter);
|
|
94722
|
+
}
|
|
94723
|
+
const newParametersArray = factory2.createNodeArray(newParameters);
|
|
94724
|
+
setTextRange(newParametersArray, node.parameters);
|
|
94725
|
+
return newParametersArray;
|
|
94726
|
+
}
|
|
94727
|
+
function transformAsyncFunctionBody(node, outerParameters) {
|
|
94728
|
+
const innerParameters = !isSimpleParameterList(node.parameters) ? visitParameterList(node.parameters, visitor, context) : void 0;
|
|
94606
94729
|
resumeLexicalEnvironment();
|
|
94607
94730
|
const original = getOriginalNode(node, isFunctionLike);
|
|
94608
94731
|
const nodeType = original.type;
|
|
94609
94732
|
const promiseConstructor = languageVersion < 2 /* ES2015 */ ? getPromiseConstructor(nodeType) : void 0;
|
|
94610
94733
|
const isArrowFunction2 = node.kind === 219 /* ArrowFunction */;
|
|
94734
|
+
const savedLexicalArgumentsBinding = lexicalArgumentsBinding;
|
|
94611
94735
|
const hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 512 /* CaptureArguments */) !== 0;
|
|
94736
|
+
const captureLexicalArguments = hasLexicalArguments && !lexicalArgumentsBinding;
|
|
94737
|
+
if (captureLexicalArguments) {
|
|
94738
|
+
lexicalArgumentsBinding = factory2.createUniqueName("arguments");
|
|
94739
|
+
}
|
|
94740
|
+
let argumentsExpression;
|
|
94741
|
+
if (innerParameters) {
|
|
94742
|
+
if (isArrowFunction2) {
|
|
94743
|
+
const parameterBindings = [];
|
|
94744
|
+
Debug.assert(outerParameters.length <= node.parameters.length);
|
|
94745
|
+
for (let i = 0; i < node.parameters.length; i++) {
|
|
94746
|
+
Debug.assert(i < outerParameters.length);
|
|
94747
|
+
const originalParameter = node.parameters[i];
|
|
94748
|
+
const outerParameter = outerParameters[i];
|
|
94749
|
+
Debug.assertNode(outerParameter.name, isIdentifier);
|
|
94750
|
+
if (originalParameter.initializer || originalParameter.dotDotDotToken) {
|
|
94751
|
+
Debug.assert(i === outerParameters.length - 1);
|
|
94752
|
+
parameterBindings.push(factory2.createSpreadElement(outerParameter.name));
|
|
94753
|
+
break;
|
|
94754
|
+
}
|
|
94755
|
+
parameterBindings.push(outerParameter.name);
|
|
94756
|
+
}
|
|
94757
|
+
argumentsExpression = factory2.createArrayLiteralExpression(parameterBindings);
|
|
94758
|
+
} else {
|
|
94759
|
+
argumentsExpression = factory2.createIdentifier("arguments");
|
|
94760
|
+
}
|
|
94761
|
+
}
|
|
94612
94762
|
const savedEnclosingFunctionParameterNames = enclosingFunctionParameterNames;
|
|
94613
94763
|
enclosingFunctionParameterNames = /* @__PURE__ */ new Set();
|
|
94614
94764
|
for (const parameter of node.parameters) {
|
|
@@ -94620,27 +94770,23 @@ function transformES2017(context) {
|
|
|
94620
94770
|
capturedSuperProperties = /* @__PURE__ */ new Set();
|
|
94621
94771
|
hasSuperElementAccess = false;
|
|
94622
94772
|
}
|
|
94773
|
+
const hasLexicalThis = inHasLexicalThisContext();
|
|
94774
|
+
let asyncBody = transformAsyncFunctionBodyWorker(node.body);
|
|
94775
|
+
asyncBody = factory2.updateBlock(asyncBody, factory2.mergeLexicalEnvironment(asyncBody.statements, endLexicalEnvironment()));
|
|
94623
94776
|
let result;
|
|
94624
94777
|
if (!isArrowFunction2) {
|
|
94625
94778
|
const statements = [];
|
|
94626
|
-
const statementOffset = factory2.copyPrologue(
|
|
94627
|
-
node.body.statements,
|
|
94628
|
-
statements,
|
|
94629
|
-
/*ensureUseStrict*/
|
|
94630
|
-
false,
|
|
94631
|
-
visitor
|
|
94632
|
-
);
|
|
94633
94779
|
statements.push(
|
|
94634
94780
|
factory2.createReturnStatement(
|
|
94635
94781
|
emitHelpers().createAwaiterHelper(
|
|
94636
|
-
|
|
94637
|
-
|
|
94782
|
+
hasLexicalThis,
|
|
94783
|
+
argumentsExpression,
|
|
94638
94784
|
promiseConstructor,
|
|
94639
|
-
|
|
94785
|
+
innerParameters,
|
|
94786
|
+
asyncBody
|
|
94640
94787
|
)
|
|
94641
94788
|
)
|
|
94642
94789
|
);
|
|
94643
|
-
insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment());
|
|
94644
94790
|
const emitSuperHelpers = languageVersion >= 2 /* ES2015 */ && resolver.getNodeCheckFlags(node) & (256 /* MethodWithSuperPropertyAssignmentInAsync */ | 128 /* MethodWithSuperPropertyAccessInAsync */);
|
|
94645
94791
|
if (emitSuperHelpers) {
|
|
94646
94792
|
enableSubstitutionForAsyncMethodsWithSuper();
|
|
@@ -94650,6 +94796,9 @@ function transformES2017(context) {
|
|
|
94650
94796
|
insertStatementsAfterStandardPrologue(statements, [variableStatement]);
|
|
94651
94797
|
}
|
|
94652
94798
|
}
|
|
94799
|
+
if (captureLexicalArguments) {
|
|
94800
|
+
insertStatementsAfterStandardPrologue(statements, [createCaptureArgumentsStatement()]);
|
|
94801
|
+
}
|
|
94653
94802
|
const block = factory2.createBlock(
|
|
94654
94803
|
statements,
|
|
94655
94804
|
/*multiLine*/
|
|
@@ -94665,24 +94814,23 @@ function transformES2017(context) {
|
|
|
94665
94814
|
}
|
|
94666
94815
|
result = block;
|
|
94667
94816
|
} else {
|
|
94668
|
-
|
|
94669
|
-
|
|
94670
|
-
|
|
94817
|
+
result = emitHelpers().createAwaiterHelper(
|
|
94818
|
+
hasLexicalThis,
|
|
94819
|
+
argumentsExpression,
|
|
94671
94820
|
promiseConstructor,
|
|
94672
|
-
|
|
94821
|
+
innerParameters,
|
|
94822
|
+
asyncBody
|
|
94673
94823
|
);
|
|
94674
|
-
|
|
94675
|
-
|
|
94676
|
-
|
|
94677
|
-
result = factory2.updateBlock(block, setTextRange(factory2.createNodeArray(concatenate(declarations, block.statements)), block.statements));
|
|
94678
|
-
} else {
|
|
94679
|
-
result = expression;
|
|
94824
|
+
if (captureLexicalArguments) {
|
|
94825
|
+
const block = factory2.converters.convertToFunctionBlock(result);
|
|
94826
|
+
result = factory2.updateBlock(block, factory2.mergeLexicalEnvironment(block.statements, [createCaptureArgumentsStatement()]));
|
|
94680
94827
|
}
|
|
94681
94828
|
}
|
|
94682
94829
|
enclosingFunctionParameterNames = savedEnclosingFunctionParameterNames;
|
|
94683
94830
|
if (!isArrowFunction2) {
|
|
94684
94831
|
capturedSuperProperties = savedCapturedSuperProperties;
|
|
94685
94832
|
hasSuperElementAccess = savedHasSuperElementAccess;
|
|
94833
|
+
lexicalArgumentsBinding = savedLexicalArgumentsBinding;
|
|
94686
94834
|
}
|
|
94687
94835
|
return result;
|
|
94688
94836
|
}
|
|
@@ -95798,7 +95946,7 @@ function transformES2018(context) {
|
|
|
95798
95946
|
),
|
|
95799
95947
|
/*typeParameters*/
|
|
95800
95948
|
void 0,
|
|
95801
|
-
visitParameterList(node.parameters, parameterVisitor, context),
|
|
95949
|
+
enclosingFunctionFlags & 2 /* Async */ && enclosingFunctionFlags & 1 /* Generator */ ? transformAsyncGeneratorFunctionParameterList(node) : visitParameterList(node.parameters, parameterVisitor, context),
|
|
95802
95950
|
/*type*/
|
|
95803
95951
|
void 0,
|
|
95804
95952
|
enclosingFunctionFlags & 2 /* Async */ && enclosingFunctionFlags & 1 /* Generator */ ? transformAsyncGeneratorFunctionBody(node) : transformFunctionBody(node)
|
|
@@ -95819,7 +95967,7 @@ function transformES2018(context) {
|
|
|
95819
95967
|
node.name,
|
|
95820
95968
|
/*typeParameters*/
|
|
95821
95969
|
void 0,
|
|
95822
|
-
visitParameterList(node.parameters, parameterVisitor, context),
|
|
95970
|
+
enclosingFunctionFlags & 2 /* Async */ && enclosingFunctionFlags & 1 /* Generator */ ? transformAsyncGeneratorFunctionParameterList(node) : visitParameterList(node.parameters, parameterVisitor, context),
|
|
95823
95971
|
/*type*/
|
|
95824
95972
|
void 0,
|
|
95825
95973
|
enclosingFunctionFlags & 2 /* Async */ && enclosingFunctionFlags & 1 /* Generator */ ? transformAsyncGeneratorFunctionBody(node) : transformFunctionBody(node)
|
|
@@ -95860,7 +96008,7 @@ function transformES2018(context) {
|
|
|
95860
96008
|
node.name,
|
|
95861
96009
|
/*typeParameters*/
|
|
95862
96010
|
void 0,
|
|
95863
|
-
visitParameterList(node.parameters, parameterVisitor, context),
|
|
96011
|
+
enclosingFunctionFlags & 2 /* Async */ && enclosingFunctionFlags & 1 /* Generator */ ? transformAsyncGeneratorFunctionParameterList(node) : visitParameterList(node.parameters, parameterVisitor, context),
|
|
95864
96012
|
/*type*/
|
|
95865
96013
|
void 0,
|
|
95866
96014
|
enclosingFunctionFlags & 2 /* Async */ && enclosingFunctionFlags & 1 /* Generator */ ? transformAsyncGeneratorFunctionBody(node) : transformFunctionBody(node)
|
|
@@ -95869,21 +96017,38 @@ function transformES2018(context) {
|
|
|
95869
96017
|
parametersWithPrecedingObjectRestOrSpread = savedParametersWithPrecedingObjectRestOrSpread;
|
|
95870
96018
|
return updated;
|
|
95871
96019
|
}
|
|
96020
|
+
function transformAsyncGeneratorFunctionParameterList(node) {
|
|
96021
|
+
if (isSimpleParameterList(node.parameters)) {
|
|
96022
|
+
return visitParameterList(node.parameters, visitor, context);
|
|
96023
|
+
}
|
|
96024
|
+
const newParameters = [];
|
|
96025
|
+
for (const parameter of node.parameters) {
|
|
96026
|
+
if (parameter.initializer || parameter.dotDotDotToken) {
|
|
96027
|
+
break;
|
|
96028
|
+
}
|
|
96029
|
+
const newParameter = factory2.createParameterDeclaration(
|
|
96030
|
+
/*modifiers*/
|
|
96031
|
+
void 0,
|
|
96032
|
+
/*dotDotDotToken*/
|
|
96033
|
+
void 0,
|
|
96034
|
+
factory2.getGeneratedNameForNode(parameter.name, 8 /* ReservedInNestedScopes */)
|
|
96035
|
+
);
|
|
96036
|
+
newParameters.push(newParameter);
|
|
96037
|
+
}
|
|
96038
|
+
const newParametersArray = factory2.createNodeArray(newParameters);
|
|
96039
|
+
setTextRange(newParametersArray, node.parameters);
|
|
96040
|
+
return newParametersArray;
|
|
96041
|
+
}
|
|
95872
96042
|
function transformAsyncGeneratorFunctionBody(node) {
|
|
96043
|
+
const innerParameters = !isSimpleParameterList(node.parameters) ? visitParameterList(node.parameters, visitor, context) : void 0;
|
|
95873
96044
|
resumeLexicalEnvironment();
|
|
95874
|
-
const statements = [];
|
|
95875
|
-
const statementOffset = factory2.copyPrologue(
|
|
95876
|
-
node.body.statements,
|
|
95877
|
-
statements,
|
|
95878
|
-
/*ensureUseStrict*/
|
|
95879
|
-
false,
|
|
95880
|
-
visitor
|
|
95881
|
-
);
|
|
95882
|
-
appendObjectRestAssignmentsIfNeeded(statements, node);
|
|
95883
96045
|
const savedCapturedSuperProperties = capturedSuperProperties;
|
|
95884
96046
|
const savedHasSuperElementAccess = hasSuperElementAccess;
|
|
95885
96047
|
capturedSuperProperties = /* @__PURE__ */ new Set();
|
|
95886
96048
|
hasSuperElementAccess = false;
|
|
96049
|
+
const outerStatements = [];
|
|
96050
|
+
let asyncBody = factory2.updateBlock(node.body, visitNodes2(node.body.statements, visitor, isStatement));
|
|
96051
|
+
asyncBody = factory2.updateBlock(asyncBody, factory2.mergeLexicalEnvironment(asyncBody.statements, appendObjectRestAssignmentsIfNeeded(endLexicalEnvironment(), node)));
|
|
95887
96052
|
const returnStatement = factory2.createReturnStatement(
|
|
95888
96053
|
emitHelpers().createAsyncGeneratorHelper(
|
|
95889
96054
|
factory2.createFunctionExpression(
|
|
@@ -95893,14 +96058,10 @@ function transformES2018(context) {
|
|
|
95893
96058
|
node.name && factory2.getGeneratedNameForNode(node.name),
|
|
95894
96059
|
/*typeParameters*/
|
|
95895
96060
|
void 0,
|
|
95896
|
-
|
|
95897
|
-
[],
|
|
96061
|
+
innerParameters ?? [],
|
|
95898
96062
|
/*type*/
|
|
95899
96063
|
void 0,
|
|
95900
|
-
|
|
95901
|
-
node.body,
|
|
95902
|
-
visitLexicalEnvironment(node.body.statements, visitor, context, statementOffset)
|
|
95903
|
-
)
|
|
96064
|
+
asyncBody
|
|
95904
96065
|
),
|
|
95905
96066
|
!!(hierarchyFacts & 1 /* HasLexicalThis */)
|
|
95906
96067
|
)
|
|
@@ -95910,11 +96071,10 @@ function transformES2018(context) {
|
|
|
95910
96071
|
enableSubstitutionForAsyncMethodsWithSuper();
|
|
95911
96072
|
const variableStatement = createSuperAccessVariableStatement(factory2, resolver, node, capturedSuperProperties);
|
|
95912
96073
|
substitutedSuperAccessors[getNodeId(variableStatement)] = true;
|
|
95913
|
-
insertStatementsAfterStandardPrologue(
|
|
96074
|
+
insertStatementsAfterStandardPrologue(outerStatements, [variableStatement]);
|
|
95914
96075
|
}
|
|
95915
|
-
|
|
95916
|
-
|
|
95917
|
-
const block = factory2.updateBlock(node.body, statements);
|
|
96076
|
+
outerStatements.push(returnStatement);
|
|
96077
|
+
const block = factory2.updateBlock(node.body, outerStatements);
|
|
95918
96078
|
if (emitSuperHelpers && hasSuperElementAccess) {
|
|
95919
96079
|
if (resolver.getNodeCheckFlags(node) & 256 /* MethodWithSuperPropertyAssignmentInAsync */) {
|
|
95920
96080
|
addEmitHelper(block, advancedAsyncSuperHelper);
|
|
@@ -109748,27 +109908,6 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
|
|
|
109748
109908
|
(_e = tracing) == null ? void 0 : _e.push(tracing.Phase.Emit, "emitBuildInfo", { buildInfoPath });
|
|
109749
109909
|
emitBuildInfo(bundleBuildInfo, buildInfoPath);
|
|
109750
109910
|
(_f = tracing) == null ? void 0 : _f.pop();
|
|
109751
|
-
if (!emitSkipped && emittedFilesList) {
|
|
109752
|
-
if (!emitOnly) {
|
|
109753
|
-
if (jsFilePath) {
|
|
109754
|
-
emittedFilesList.push(jsFilePath);
|
|
109755
|
-
}
|
|
109756
|
-
if (sourceMapFilePath) {
|
|
109757
|
-
emittedFilesList.push(sourceMapFilePath);
|
|
109758
|
-
}
|
|
109759
|
-
if (buildInfoPath) {
|
|
109760
|
-
emittedFilesList.push(buildInfoPath);
|
|
109761
|
-
}
|
|
109762
|
-
}
|
|
109763
|
-
if (emitOnly !== 0 /* Js */) {
|
|
109764
|
-
if (declarationFilePath) {
|
|
109765
|
-
emittedFilesList.push(declarationFilePath);
|
|
109766
|
-
}
|
|
109767
|
-
if (declarationMapPath) {
|
|
109768
|
-
emittedFilesList.push(declarationMapPath);
|
|
109769
|
-
}
|
|
109770
|
-
}
|
|
109771
|
-
}
|
|
109772
109911
|
function relativeToBuildInfo(path) {
|
|
109773
109912
|
return ensurePathIsNonModuleName(getRelativePathFromDirectory(buildInfoDirectory, path, host.getCanonicalFileName));
|
|
109774
109913
|
}
|
|
@@ -109796,6 +109935,7 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
|
|
|
109796
109935
|
void 0,
|
|
109797
109936
|
{ buildInfo }
|
|
109798
109937
|
);
|
|
109938
|
+
emittedFilesList == null ? void 0 : emittedFilesList.push(buildInfoPath);
|
|
109799
109939
|
}
|
|
109800
109940
|
function emitJsFileOrBundle(sourceFileOrBundle, jsFilePath, sourceMapFilePath, relativeToBuildInfo) {
|
|
109801
109941
|
if (!sourceFileOrBundle || emitOnly || !jsFilePath) {
|
|
@@ -109841,6 +109981,12 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
|
|
|
109841
109981
|
transform.dispose();
|
|
109842
109982
|
if (bundleBuildInfo)
|
|
109843
109983
|
bundleBuildInfo.js = printer.bundleFileInfo;
|
|
109984
|
+
if (emittedFilesList) {
|
|
109985
|
+
emittedFilesList.push(jsFilePath);
|
|
109986
|
+
if (sourceMapFilePath) {
|
|
109987
|
+
emittedFilesList.push(sourceMapFilePath);
|
|
109988
|
+
}
|
|
109989
|
+
}
|
|
109844
109990
|
}
|
|
109845
109991
|
function emitDeclarationFileOrBundle(sourceFileOrBundle, declarationFilePath, declarationMapPath, relativeToBuildInfo) {
|
|
109846
109992
|
if (!sourceFileOrBundle || emitOnly === 0 /* Js */)
|
|
@@ -109871,33 +110017,33 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
|
|
|
109871
110017
|
emitterDiagnostics.add(diagnostic);
|
|
109872
110018
|
}
|
|
109873
110019
|
}
|
|
109874
|
-
const printerOptions = {
|
|
109875
|
-
removeComments: compilerOptions.removeComments,
|
|
109876
|
-
newLine: compilerOptions.newLine,
|
|
109877
|
-
noEmitHelpers: true,
|
|
109878
|
-
module: compilerOptions.module,
|
|
109879
|
-
target: compilerOptions.target,
|
|
109880
|
-
sourceMap: !forceDtsEmit && compilerOptions.declarationMap,
|
|
109881
|
-
inlineSourceMap: compilerOptions.inlineSourceMap,
|
|
109882
|
-
extendedDiagnostics: compilerOptions.extendedDiagnostics,
|
|
109883
|
-
onlyPrintJsDocStyle: true,
|
|
109884
|
-
omitBraceSourceMapPositions: true,
|
|
109885
|
-
writeBundleFileInfo: !!bundleBuildInfo,
|
|
109886
|
-
recordInternalSection: !!bundleBuildInfo,
|
|
109887
|
-
relativeToBuildInfo
|
|
109888
|
-
};
|
|
109889
|
-
const declarationPrinter = createPrinter(printerOptions, {
|
|
109890
|
-
// resolver hooks
|
|
109891
|
-
hasGlobalName: resolver.hasGlobalName,
|
|
109892
|
-
// transform hooks
|
|
109893
|
-
onEmitNode: declarationTransform.emitNodeWithNotification,
|
|
109894
|
-
isEmitNotificationEnabled: declarationTransform.isEmitNotificationEnabled,
|
|
109895
|
-
substituteNode: declarationTransform.substituteNode
|
|
109896
|
-
});
|
|
109897
110020
|
const declBlocked = !!declarationTransform.diagnostics && !!declarationTransform.diagnostics.length || !!host.isEmitBlocked(declarationFilePath) || !!compilerOptions.noEmit;
|
|
109898
110021
|
emitSkipped = emitSkipped || declBlocked;
|
|
109899
110022
|
if (!declBlocked || forceDtsEmit) {
|
|
109900
110023
|
Debug.assert(declarationTransform.transformed.length === 1, "Should only see one output from the decl transform");
|
|
110024
|
+
const printerOptions = {
|
|
110025
|
+
removeComments: compilerOptions.removeComments,
|
|
110026
|
+
newLine: compilerOptions.newLine,
|
|
110027
|
+
noEmitHelpers: true,
|
|
110028
|
+
module: compilerOptions.module,
|
|
110029
|
+
target: compilerOptions.target,
|
|
110030
|
+
sourceMap: !forceDtsEmit && compilerOptions.declarationMap,
|
|
110031
|
+
inlineSourceMap: compilerOptions.inlineSourceMap,
|
|
110032
|
+
extendedDiagnostics: compilerOptions.extendedDiagnostics,
|
|
110033
|
+
onlyPrintJsDocStyle: true,
|
|
110034
|
+
omitBraceSourceMapPositions: true,
|
|
110035
|
+
writeBundleFileInfo: !!bundleBuildInfo,
|
|
110036
|
+
recordInternalSection: !!bundleBuildInfo,
|
|
110037
|
+
relativeToBuildInfo
|
|
110038
|
+
};
|
|
110039
|
+
const declarationPrinter = createPrinter(printerOptions, {
|
|
110040
|
+
// resolver hooks
|
|
110041
|
+
hasGlobalName: resolver.hasGlobalName,
|
|
110042
|
+
// transform hooks
|
|
110043
|
+
onEmitNode: declarationTransform.emitNodeWithNotification,
|
|
110044
|
+
isEmitNotificationEnabled: declarationTransform.isEmitNotificationEnabled,
|
|
110045
|
+
substituteNode: declarationTransform.substituteNode
|
|
110046
|
+
});
|
|
109901
110047
|
printSourceFileOrBundle(
|
|
109902
110048
|
declarationFilePath,
|
|
109903
110049
|
declarationMapPath,
|
|
@@ -109911,10 +110057,16 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
|
|
|
109911
110057
|
// Explicitly do not passthru either `inline` option
|
|
109912
110058
|
}
|
|
109913
110059
|
);
|
|
110060
|
+
if (emittedFilesList) {
|
|
110061
|
+
emittedFilesList.push(declarationFilePath);
|
|
110062
|
+
if (declarationMapPath) {
|
|
110063
|
+
emittedFilesList.push(declarationMapPath);
|
|
110064
|
+
}
|
|
110065
|
+
}
|
|
110066
|
+
if (bundleBuildInfo)
|
|
110067
|
+
bundleBuildInfo.dts = declarationPrinter.bundleFileInfo;
|
|
109914
110068
|
}
|
|
109915
110069
|
declarationTransform.dispose();
|
|
109916
|
-
if (bundleBuildInfo)
|
|
109917
|
-
bundleBuildInfo.dts = declarationPrinter.bundleFileInfo;
|
|
109918
110070
|
}
|
|
109919
110071
|
function collectLinkedAliases(node) {
|
|
109920
110072
|
if (isExportAssignment(node)) {
|
|
@@ -119964,6 +120116,7 @@ function createBuilderProgramState(newProgram, oldState) {
|
|
|
119964
120116
|
const copyDeclarationFileDiagnostics = canCopySemanticDiagnostics && !compilerOptions.skipLibCheck === !oldCompilerOptions.skipLibCheck;
|
|
119965
120117
|
const copyLibFileDiagnostics = copyDeclarationFileDiagnostics && !compilerOptions.skipDefaultLibCheck === !oldCompilerOptions.skipDefaultLibCheck;
|
|
119966
120118
|
state.fileInfos.forEach((info, sourceFilePath) => {
|
|
120119
|
+
var _a2;
|
|
119967
120120
|
let oldInfo;
|
|
119968
120121
|
let newReferences;
|
|
119969
120122
|
if (!useOldState || // File wasn't present in old state
|
|
@@ -119973,22 +120126,28 @@ function createBuilderProgramState(newProgram, oldState) {
|
|
|
119973
120126
|
!hasSameKeys(newReferences = referencedMap && referencedMap.getValues(sourceFilePath), oldReferencedMap && oldReferencedMap.getValues(sourceFilePath)) || // Referenced file was deleted in the new program
|
|
119974
120127
|
newReferences && forEachKey(newReferences, (path) => !state.fileInfos.has(path) && oldState.fileInfos.has(path))) {
|
|
119975
120128
|
addFileToChangeSet(state, sourceFilePath);
|
|
119976
|
-
} else
|
|
120129
|
+
} else {
|
|
119977
120130
|
const sourceFile = newProgram.getSourceFileByPath(sourceFilePath);
|
|
119978
|
-
|
|
119979
|
-
|
|
119980
|
-
|
|
119981
|
-
return;
|
|
119982
|
-
const diagnostics = oldState.semanticDiagnosticsPerFile.get(sourceFilePath);
|
|
119983
|
-
if (diagnostics) {
|
|
119984
|
-
state.semanticDiagnosticsPerFile.set(
|
|
120131
|
+
const emitDiagnostics = (_a2 = oldState.emitDiagnosticsPerFile) == null ? void 0 : _a2.get(sourceFilePath);
|
|
120132
|
+
if (emitDiagnostics) {
|
|
120133
|
+
(state.emitDiagnosticsPerFile ?? (state.emitDiagnosticsPerFile = /* @__PURE__ */ new Map())).set(
|
|
119985
120134
|
sourceFilePath,
|
|
119986
|
-
oldState.hasReusableDiagnostic ? convertToDiagnostics(
|
|
120135
|
+
oldState.hasReusableDiagnostic ? convertToDiagnostics(emitDiagnostics, newProgram) : repopulateDiagnostics(emitDiagnostics, newProgram)
|
|
119987
120136
|
);
|
|
119988
|
-
|
|
119989
|
-
|
|
120137
|
+
}
|
|
120138
|
+
if (canCopySemanticDiagnostics) {
|
|
120139
|
+
if (sourceFile.isDeclarationFile && !copyDeclarationFileDiagnostics)
|
|
120140
|
+
return;
|
|
120141
|
+
if (sourceFile.hasNoDefaultLib && !copyLibFileDiagnostics)
|
|
120142
|
+
return;
|
|
120143
|
+
const diagnostics = oldState.semanticDiagnosticsPerFile.get(sourceFilePath);
|
|
120144
|
+
if (diagnostics) {
|
|
120145
|
+
state.semanticDiagnosticsPerFile.set(
|
|
120146
|
+
sourceFilePath,
|
|
120147
|
+
oldState.hasReusableDiagnostic ? convertToDiagnostics(diagnostics, newProgram) : repopulateDiagnostics(diagnostics, newProgram)
|
|
120148
|
+
);
|
|
120149
|
+
(state.semanticDiagnosticsFromOldState ?? (state.semanticDiagnosticsFromOldState = /* @__PURE__ */ new Set())).add(sourceFilePath);
|
|
119990
120150
|
}
|
|
119991
|
-
state.semanticDiagnosticsFromOldState.add(sourceFilePath);
|
|
119992
120151
|
}
|
|
119993
120152
|
}
|
|
119994
120153
|
if (canCopyEmitSignatures) {
|
|
@@ -120125,7 +120284,9 @@ function backupBuilderProgramEmitState(state) {
|
|
|
120125
120284
|
outSignature: state.outSignature,
|
|
120126
120285
|
latestChangedDtsFile: state.latestChangedDtsFile,
|
|
120127
120286
|
hasChangedEmitSignature: state.hasChangedEmitSignature,
|
|
120128
|
-
changedFilesSet: outFilePath ? new Set(state.changedFilesSet) : void 0
|
|
120287
|
+
changedFilesSet: outFilePath ? new Set(state.changedFilesSet) : void 0,
|
|
120288
|
+
buildInfoEmitPending: state.buildInfoEmitPending,
|
|
120289
|
+
emitDiagnosticsPerFile: state.emitDiagnosticsPerFile && new Map(state.emitDiagnosticsPerFile)
|
|
120129
120290
|
};
|
|
120130
120291
|
}
|
|
120131
120292
|
function restoreBuilderProgramEmitState(state, savedEmitState) {
|
|
@@ -120136,6 +120297,8 @@ function restoreBuilderProgramEmitState(state, savedEmitState) {
|
|
|
120136
120297
|
state.outSignature = savedEmitState.outSignature;
|
|
120137
120298
|
state.latestChangedDtsFile = savedEmitState.latestChangedDtsFile;
|
|
120138
120299
|
state.hasChangedEmitSignature = savedEmitState.hasChangedEmitSignature;
|
|
120300
|
+
state.buildInfoEmitPending = savedEmitState.buildInfoEmitPending;
|
|
120301
|
+
state.emitDiagnosticsPerFile = savedEmitState.emitDiagnosticsPerFile;
|
|
120139
120302
|
if (savedEmitState.changedFilesSet)
|
|
120140
120303
|
state.changedFilesSet = savedEmitState.changedFilesSet;
|
|
120141
120304
|
}
|
|
@@ -120226,6 +120389,22 @@ function getNextAffectedFilePendingEmit(state, emitOnlyDtsFiles) {
|
|
|
120226
120389
|
return { affectedFile, emitKind: pendingKind };
|
|
120227
120390
|
});
|
|
120228
120391
|
}
|
|
120392
|
+
function getNextPendingEmitDiagnosticsFile(state) {
|
|
120393
|
+
var _a;
|
|
120394
|
+
if (!((_a = state.emitDiagnosticsPerFile) == null ? void 0 : _a.size))
|
|
120395
|
+
return void 0;
|
|
120396
|
+
return forEachEntry(state.emitDiagnosticsPerFile, (diagnostics, path) => {
|
|
120397
|
+
var _a2;
|
|
120398
|
+
const affectedFile = state.program.getSourceFileByPath(path);
|
|
120399
|
+
if (!affectedFile || !sourceFileMayBeEmitted(affectedFile, state.program)) {
|
|
120400
|
+
state.emitDiagnosticsPerFile.delete(path);
|
|
120401
|
+
return void 0;
|
|
120402
|
+
}
|
|
120403
|
+
const seenKind = ((_a2 = state.seenEmittedFiles) == null ? void 0 : _a2.get(affectedFile.resolvedPath)) || 0 /* None */;
|
|
120404
|
+
if (!(seenKind & 24 /* AllDts */))
|
|
120405
|
+
return { affectedFile, diagnostics, seenKind };
|
|
120406
|
+
});
|
|
120407
|
+
}
|
|
120229
120408
|
function removeDiagnosticsOfLibraryFiles(state) {
|
|
120230
120409
|
if (!state.cleanedDiagnosticsOfLibFiles) {
|
|
120231
120410
|
state.cleanedDiagnosticsOfLibFiles = true;
|
|
@@ -120502,18 +120681,7 @@ function getBuildInfo2(state, bundle) {
|
|
|
120502
120681
|
return void 0;
|
|
120503
120682
|
});
|
|
120504
120683
|
}
|
|
120505
|
-
|
|
120506
|
-
if (state.semanticDiagnosticsPerFile) {
|
|
120507
|
-
for (const key of arrayFrom(state.semanticDiagnosticsPerFile.keys()).sort(compareStringsCaseSensitive)) {
|
|
120508
|
-
const value = state.semanticDiagnosticsPerFile.get(key);
|
|
120509
|
-
(semanticDiagnosticsPerFile || (semanticDiagnosticsPerFile = [])).push(
|
|
120510
|
-
value.length ? [
|
|
120511
|
-
toFileId(key),
|
|
120512
|
-
convertToReusableDiagnostics(value, relativeToBuildInfo)
|
|
120513
|
-
] : toFileId(key)
|
|
120514
|
-
);
|
|
120515
|
-
}
|
|
120516
|
-
}
|
|
120684
|
+
const semanticDiagnosticsPerFile = convertToProgramBuildInfoDiagnostics(state.semanticDiagnosticsPerFile);
|
|
120517
120685
|
let affectedFilesPendingEmit;
|
|
120518
120686
|
if ((_c = state.affectedFilesPendingEmit) == null ? void 0 : _c.size) {
|
|
120519
120687
|
const fullEmitForOptions = getBuilderFileEmit(state.compilerOptions);
|
|
@@ -120543,6 +120711,7 @@ function getBuildInfo2(state, bundle) {
|
|
|
120543
120711
|
(changeFileSet || (changeFileSet = [])).push(toFileId(path));
|
|
120544
120712
|
}
|
|
120545
120713
|
}
|
|
120714
|
+
const emitDiagnosticsPerFile = convertToProgramBuildInfoDiagnostics(state.emitDiagnosticsPerFile);
|
|
120546
120715
|
const program = {
|
|
120547
120716
|
fileNames,
|
|
120548
120717
|
fileInfos,
|
|
@@ -120552,6 +120721,7 @@ function getBuildInfo2(state, bundle) {
|
|
|
120552
120721
|
referencedMap,
|
|
120553
120722
|
exportedModulesMap,
|
|
120554
120723
|
semanticDiagnosticsPerFile,
|
|
120724
|
+
emitDiagnosticsPerFile,
|
|
120555
120725
|
affectedFilesPendingEmit,
|
|
120556
120726
|
changeFileSet,
|
|
120557
120727
|
emitSignatures,
|
|
@@ -120608,73 +120778,87 @@ function getBuildInfo2(state, bundle) {
|
|
|
120608
120778
|
if (optionInfo == null ? void 0 : optionInfo.affectsBuildInfo) {
|
|
120609
120779
|
(result || (result = {}))[name] = convertToReusableCompilerOptionValue(
|
|
120610
120780
|
optionInfo,
|
|
120611
|
-
options[name]
|
|
120612
|
-
relativeToBuildInfoEnsuringAbsolutePath
|
|
120781
|
+
options[name]
|
|
120613
120782
|
);
|
|
120614
120783
|
}
|
|
120615
120784
|
}
|
|
120616
120785
|
return result;
|
|
120617
120786
|
}
|
|
120618
|
-
|
|
120619
|
-
|
|
120620
|
-
|
|
120621
|
-
|
|
120622
|
-
|
|
120623
|
-
|
|
120624
|
-
|
|
120625
|
-
|
|
120787
|
+
function convertToReusableCompilerOptionValue(option, value) {
|
|
120788
|
+
if (option) {
|
|
120789
|
+
Debug.assert(option.type !== "listOrElement");
|
|
120790
|
+
if (option.type === "list") {
|
|
120791
|
+
const values = value;
|
|
120792
|
+
if (option.element.isFilePath && values.length) {
|
|
120793
|
+
return values.map(relativeToBuildInfoEnsuringAbsolutePath);
|
|
120794
|
+
}
|
|
120795
|
+
} else if (option.isFilePath) {
|
|
120796
|
+
return relativeToBuildInfoEnsuringAbsolutePath(value);
|
|
120626
120797
|
}
|
|
120627
|
-
} else if (option.isFilePath) {
|
|
120628
|
-
return relativeToBuildInfo(value);
|
|
120629
120798
|
}
|
|
120799
|
+
return value;
|
|
120630
120800
|
}
|
|
120631
|
-
|
|
120632
|
-
|
|
120633
|
-
|
|
120634
|
-
|
|
120635
|
-
|
|
120636
|
-
|
|
120637
|
-
|
|
120638
|
-
|
|
120639
|
-
|
|
120640
|
-
|
|
120641
|
-
|
|
120642
|
-
|
|
120801
|
+
function convertToProgramBuildInfoDiagnostics(diagnostics) {
|
|
120802
|
+
let result;
|
|
120803
|
+
if (diagnostics) {
|
|
120804
|
+
for (const key of arrayFrom(diagnostics.keys()).sort(compareStringsCaseSensitive)) {
|
|
120805
|
+
const value = diagnostics.get(key);
|
|
120806
|
+
(result || (result = [])).push(
|
|
120807
|
+
value.length ? [
|
|
120808
|
+
toFileId(key),
|
|
120809
|
+
convertToReusableDiagnostics(value)
|
|
120810
|
+
] : toFileId(key)
|
|
120811
|
+
);
|
|
120812
|
+
}
|
|
120813
|
+
}
|
|
120643
120814
|
return result;
|
|
120644
|
-
}
|
|
120645
|
-
|
|
120646
|
-
|
|
120647
|
-
|
|
120648
|
-
|
|
120649
|
-
|
|
120650
|
-
|
|
120651
|
-
|
|
120652
|
-
|
|
120653
|
-
}
|
|
120654
|
-
|
|
120655
|
-
|
|
120815
|
+
}
|
|
120816
|
+
function convertToReusableDiagnostics(diagnostics) {
|
|
120817
|
+
Debug.assert(!!diagnostics.length);
|
|
120818
|
+
return diagnostics.map((diagnostic) => {
|
|
120819
|
+
const result = convertToReusableDiagnosticRelatedInformation(diagnostic);
|
|
120820
|
+
result.reportsUnnecessary = diagnostic.reportsUnnecessary;
|
|
120821
|
+
result.reportDeprecated = diagnostic.reportsDeprecated;
|
|
120822
|
+
result.source = diagnostic.source;
|
|
120823
|
+
result.skippedOn = diagnostic.skippedOn;
|
|
120824
|
+
const { relatedInformation } = diagnostic;
|
|
120825
|
+
result.relatedInformation = relatedInformation ? relatedInformation.length ? relatedInformation.map((r) => convertToReusableDiagnosticRelatedInformation(r)) : [] : void 0;
|
|
120826
|
+
return result;
|
|
120827
|
+
});
|
|
120828
|
+
}
|
|
120829
|
+
function convertToReusableDiagnosticRelatedInformation(diagnostic) {
|
|
120830
|
+
const { file } = diagnostic;
|
|
120656
120831
|
return {
|
|
120657
|
-
|
|
120658
|
-
|
|
120832
|
+
...diagnostic,
|
|
120833
|
+
file: file ? relativeToBuildInfo(file.resolvedPath) : void 0,
|
|
120834
|
+
messageText: isString(diagnostic.messageText) ? diagnostic.messageText : convertToReusableDiagnosticMessageChain(diagnostic.messageText)
|
|
120659
120835
|
};
|
|
120660
120836
|
}
|
|
120661
|
-
|
|
120662
|
-
|
|
120663
|
-
|
|
120664
|
-
|
|
120665
|
-
|
|
120666
|
-
|
|
120667
|
-
return forEach(array, (chain, index) => {
|
|
120668
|
-
const reusable = convertToReusableDiagnosticMessageChain(chain);
|
|
120669
|
-
if (chain === reusable)
|
|
120670
|
-
return void 0;
|
|
120671
|
-
const result = index > 0 ? array.slice(0, index - 1) : [];
|
|
120672
|
-
result.push(reusable);
|
|
120673
|
-
for (let i = index + 1; i < array.length; i++) {
|
|
120674
|
-
result.push(convertToReusableDiagnosticMessageChain(array[i]));
|
|
120837
|
+
function convertToReusableDiagnosticMessageChain(chain) {
|
|
120838
|
+
if (chain.repopulateInfo) {
|
|
120839
|
+
return {
|
|
120840
|
+
info: chain.repopulateInfo(),
|
|
120841
|
+
next: convertToReusableDiagnosticMessageChainArray(chain.next)
|
|
120842
|
+
};
|
|
120675
120843
|
}
|
|
120676
|
-
|
|
120677
|
-
|
|
120844
|
+
const next = convertToReusableDiagnosticMessageChainArray(chain.next);
|
|
120845
|
+
return next === chain.next ? chain : { ...chain, next };
|
|
120846
|
+
}
|
|
120847
|
+
function convertToReusableDiagnosticMessageChainArray(array) {
|
|
120848
|
+
if (!array)
|
|
120849
|
+
return array;
|
|
120850
|
+
return forEach(array, (chain, index) => {
|
|
120851
|
+
const reusable = convertToReusableDiagnosticMessageChain(chain);
|
|
120852
|
+
if (chain === reusable)
|
|
120853
|
+
return void 0;
|
|
120854
|
+
const result = index > 0 ? array.slice(0, index - 1) : [];
|
|
120855
|
+
result.push(reusable);
|
|
120856
|
+
for (let i = index + 1; i < array.length; i++) {
|
|
120857
|
+
result.push(convertToReusableDiagnosticMessageChain(array[i]));
|
|
120858
|
+
}
|
|
120859
|
+
return result;
|
|
120860
|
+
}) || array;
|
|
120861
|
+
}
|
|
120678
120862
|
}
|
|
120679
120863
|
function getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics, projectReferences) {
|
|
120680
120864
|
let host;
|
|
@@ -120783,6 +120967,14 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
|
|
|
120783
120967
|
if (!outFile(state.compilerOptions)) {
|
|
120784
120968
|
const pendingAffectedFile = getNextAffectedFilePendingEmit(state, emitOnlyDtsFiles);
|
|
120785
120969
|
if (!pendingAffectedFile) {
|
|
120970
|
+
const pendingForDiagnostics = getNextPendingEmitDiagnosticsFile(state);
|
|
120971
|
+
if (pendingForDiagnostics) {
|
|
120972
|
+
(state.seenEmittedFiles ?? (state.seenEmittedFiles = /* @__PURE__ */ new Map())).set(pendingForDiagnostics.affectedFile.resolvedPath, pendingForDiagnostics.seenKind | 24 /* AllDts */);
|
|
120973
|
+
return {
|
|
120974
|
+
result: { emitSkipped: true, diagnostics: pendingForDiagnostics.diagnostics },
|
|
120975
|
+
affected: pendingForDiagnostics.affectedFile
|
|
120976
|
+
};
|
|
120977
|
+
}
|
|
120786
120978
|
if (!state.buildInfoEmitPending)
|
|
120787
120979
|
return void 0;
|
|
120788
120980
|
const affected2 = state.program;
|
|
@@ -120831,6 +121023,8 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
|
|
|
120831
121023
|
(state.affectedFilesPendingEmit ?? (state.affectedFilesPendingEmit = /* @__PURE__ */ new Map())).set(affectedSourceFile.resolvedPath, pendingKind);
|
|
120832
121024
|
else
|
|
120833
121025
|
(_c = state.affectedFilesPendingEmit) == null ? void 0 : _c.delete(affectedSourceFile.resolvedPath);
|
|
121026
|
+
if (result.diagnostics.length)
|
|
121027
|
+
(state.emitDiagnosticsPerFile ?? (state.emitDiagnosticsPerFile = /* @__PURE__ */ new Map())).set(affectedSourceFile.resolvedPath, result.diagnostics);
|
|
120834
121028
|
} else {
|
|
120835
121029
|
state.changedFilesSet.clear();
|
|
120836
121030
|
}
|
|
@@ -121003,9 +121197,10 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
|
|
|
121003
121197
|
}
|
|
121004
121198
|
}
|
|
121005
121199
|
function addToAffectedFilesPendingEmit(state, affectedFilePendingEmit, kind) {
|
|
121006
|
-
var _a;
|
|
121200
|
+
var _a, _b;
|
|
121007
121201
|
const existingKind = ((_a = state.affectedFilesPendingEmit) == null ? void 0 : _a.get(affectedFilePendingEmit)) || 0 /* None */;
|
|
121008
121202
|
(state.affectedFilesPendingEmit ?? (state.affectedFilesPendingEmit = /* @__PURE__ */ new Map())).set(affectedFilePendingEmit, existingKind | kind);
|
|
121203
|
+
(_b = state.emitDiagnosticsPerFile) == null ? void 0 : _b.delete(affectedFilePendingEmit);
|
|
121009
121204
|
}
|
|
121010
121205
|
function toBuilderStateFileInfoForMultiEmit(fileInfo) {
|
|
121011
121206
|
return isString(fileInfo) ? { version: fileInfo, signature: fileInfo, affectsGlobalScope: void 0, impliedFormat: void 0 } : isString(fileInfo.signature) ? fileInfo : { version: fileInfo.version, signature: fileInfo.signature === false ? void 0 : fileInfo.version, affectsGlobalScope: fileInfo.affectsGlobalScope, impliedFormat: fileInfo.impliedFormat };
|
|
@@ -121070,7 +121265,8 @@ function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, hos
|
|
|
121070
121265
|
compilerOptions: program.options ? convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
|
|
121071
121266
|
referencedMap: toManyToManyPathMap(program.referencedMap),
|
|
121072
121267
|
exportedModulesMap: toManyToManyPathMap(program.exportedModulesMap),
|
|
121073
|
-
semanticDiagnosticsPerFile:
|
|
121268
|
+
semanticDiagnosticsPerFile: toPerFileDiagnostics(program.semanticDiagnosticsPerFile),
|
|
121269
|
+
emitDiagnosticsPerFile: toPerFileDiagnostics(program.emitDiagnosticsPerFile),
|
|
121074
121270
|
hasReusableDiagnostic: true,
|
|
121075
121271
|
affectedFilesPendingEmit: program.affectedFilesPendingEmit && arrayToMap(program.affectedFilesPendingEmit, (value) => toFilePath(isNumber(value) ? value : value[0]), (value) => toBuilderFileEmit(value, fullEmitForOptions)),
|
|
121076
121272
|
changedFilesSet: new Set(map(program.changeFileSet, toFilePath)),
|
|
@@ -121123,6 +121319,9 @@ function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, hos
|
|
|
121123
121319
|
referenceMap.forEach(([fileId, fileIdListId]) => map2.set(toFilePath(fileId), toFilePathsSet(fileIdListId)));
|
|
121124
121320
|
return map2;
|
|
121125
121321
|
}
|
|
121322
|
+
function toPerFileDiagnostics(diagnostics) {
|
|
121323
|
+
return diagnostics && arrayToMap(diagnostics, (value) => toFilePath(isNumber(value) ? value : value[0]), (value) => isNumber(value) ? emptyArray : value[1]);
|
|
121324
|
+
}
|
|
121126
121325
|
}
|
|
121127
121326
|
function getBuildInfoFileVersionMap(program, buildInfoPath, host) {
|
|
121128
121327
|
const buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
|
|
@@ -124707,7 +124906,7 @@ function checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime,
|
|
|
124707
124906
|
}
|
|
124708
124907
|
}
|
|
124709
124908
|
function getUpToDateStatusWorker(state, project, resolvedPath) {
|
|
124710
|
-
var _a, _b;
|
|
124909
|
+
var _a, _b, _c;
|
|
124711
124910
|
if (!project.fileNames.length && !canJsonReportNoInputFiles(project.raw)) {
|
|
124712
124911
|
return {
|
|
124713
124912
|
type: 16 /* ContainerOnly */
|
|
@@ -124781,7 +124980,7 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
|
|
|
124781
124980
|
};
|
|
124782
124981
|
}
|
|
124783
124982
|
if (buildInfo.program) {
|
|
124784
|
-
if (((_a = buildInfo.program.changeFileSet) == null ? void 0 : _a.length) || (!project.options.noEmit ? (_b = buildInfo.program.affectedFilesPendingEmit) == null ? void 0 : _b.length : some(buildInfo.program.semanticDiagnosticsPerFile, isArray))) {
|
|
124983
|
+
if (((_a = buildInfo.program.changeFileSet) == null ? void 0 : _a.length) || (!project.options.noEmit ? ((_b = buildInfo.program.affectedFilesPendingEmit) == null ? void 0 : _b.length) || ((_c = buildInfo.program.emitDiagnosticsPerFile) == null ? void 0 : _c.length) : some(buildInfo.program.semanticDiagnosticsPerFile, isArray))) {
|
|
124785
124984
|
return {
|
|
124786
124985
|
type: 8 /* OutOfDateBuildInfo */,
|
|
124787
124986
|
buildInfoFile: buildInfoPath
|
|
@@ -125848,7 +126047,10 @@ function generateOptionOutput(sys2, option, rightAlignOfLeft, leftAlignOfRight)
|
|
|
125848
126047
|
default:
|
|
125849
126048
|
const inverted = {};
|
|
125850
126049
|
option3.type.forEach((value, name2) => {
|
|
125851
|
-
|
|
126050
|
+
var _a2;
|
|
126051
|
+
if (!((_a2 = option3.deprecatedKeys) == null ? void 0 : _a2.has(name2))) {
|
|
126052
|
+
(inverted[value] || (inverted[value] = [])).push(name2);
|
|
126053
|
+
}
|
|
125852
126054
|
});
|
|
125853
126055
|
return Object.entries(inverted).map(([, synonyms]) => synonyms.join("/")).join(", ");
|
|
125854
126056
|
}
|