@angular/compiler 19.2.1 → 20.0.0-next.1
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/fesm2022/compiler.mjs +568 -376
- package/fesm2022/compiler.mjs.map +1 -1
- package/index.d.ts +50 -7
- package/package.json +2 -2
package/fesm2022/compiler.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular
|
|
2
|
+
* @license Angular v20.0.0-next.1
|
|
3
3
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -923,6 +923,7 @@ var BinaryOperator;
|
|
|
923
923
|
BinaryOperator[BinaryOperator["Bigger"] = 15] = "Bigger";
|
|
924
924
|
BinaryOperator[BinaryOperator["BiggerEquals"] = 16] = "BiggerEquals";
|
|
925
925
|
BinaryOperator[BinaryOperator["NullishCoalesce"] = 17] = "NullishCoalesce";
|
|
926
|
+
BinaryOperator[BinaryOperator["Exponentiation"] = 18] = "Exponentiation";
|
|
926
927
|
})(BinaryOperator || (BinaryOperator = {}));
|
|
927
928
|
function nullSafeIsEquivalent(base, other) {
|
|
928
929
|
if (base == null || other == null) {
|
|
@@ -994,14 +995,17 @@ class Expression {
|
|
|
994
995
|
modulo(rhs, sourceSpan) {
|
|
995
996
|
return new BinaryOperatorExpr(BinaryOperator.Modulo, this, rhs, null, sourceSpan);
|
|
996
997
|
}
|
|
998
|
+
power(rhs, sourceSpan) {
|
|
999
|
+
return new BinaryOperatorExpr(BinaryOperator.Exponentiation, this, rhs, null, sourceSpan);
|
|
1000
|
+
}
|
|
997
1001
|
and(rhs, sourceSpan) {
|
|
998
1002
|
return new BinaryOperatorExpr(BinaryOperator.And, this, rhs, null, sourceSpan);
|
|
999
1003
|
}
|
|
1000
|
-
bitwiseOr(rhs, sourceSpan
|
|
1001
|
-
return new BinaryOperatorExpr(BinaryOperator.BitwiseOr, this, rhs, null, sourceSpan
|
|
1004
|
+
bitwiseOr(rhs, sourceSpan) {
|
|
1005
|
+
return new BinaryOperatorExpr(BinaryOperator.BitwiseOr, this, rhs, null, sourceSpan);
|
|
1002
1006
|
}
|
|
1003
|
-
bitwiseAnd(rhs, sourceSpan
|
|
1004
|
-
return new BinaryOperatorExpr(BinaryOperator.BitwiseAnd, this, rhs, null, sourceSpan
|
|
1007
|
+
bitwiseAnd(rhs, sourceSpan) {
|
|
1008
|
+
return new BinaryOperatorExpr(BinaryOperator.BitwiseAnd, this, rhs, null, sourceSpan);
|
|
1005
1009
|
}
|
|
1006
1010
|
or(rhs, sourceSpan) {
|
|
1007
1011
|
return new BinaryOperatorExpr(BinaryOperator.Or, this, rhs, null, sourceSpan);
|
|
@@ -1071,6 +1075,25 @@ class TypeofExpr extends Expression {
|
|
|
1071
1075
|
return new TypeofExpr(this.expr.clone());
|
|
1072
1076
|
}
|
|
1073
1077
|
}
|
|
1078
|
+
class VoidExpr extends Expression {
|
|
1079
|
+
expr;
|
|
1080
|
+
constructor(expr, type, sourceSpan) {
|
|
1081
|
+
super(type, sourceSpan);
|
|
1082
|
+
this.expr = expr;
|
|
1083
|
+
}
|
|
1084
|
+
visitExpression(visitor, context) {
|
|
1085
|
+
return visitor.visitVoidExpr(this, context);
|
|
1086
|
+
}
|
|
1087
|
+
isEquivalent(e) {
|
|
1088
|
+
return e instanceof VoidExpr && e.expr.isEquivalent(this.expr);
|
|
1089
|
+
}
|
|
1090
|
+
isConstant() {
|
|
1091
|
+
return this.expr.isConstant();
|
|
1092
|
+
}
|
|
1093
|
+
clone() {
|
|
1094
|
+
return new VoidExpr(this.expr.clone());
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1074
1097
|
class WrappedNodeExpr extends Expression {
|
|
1075
1098
|
node;
|
|
1076
1099
|
constructor(node, type, sourceSpan) {
|
|
@@ -1655,16 +1678,34 @@ class UnaryOperatorExpr extends Expression {
|
|
|
1655
1678
|
return new UnaryOperatorExpr(this.operator, this.expr.clone(), this.type, this.sourceSpan, this.parens);
|
|
1656
1679
|
}
|
|
1657
1680
|
}
|
|
1681
|
+
class ParenthesizedExpr extends Expression {
|
|
1682
|
+
expr;
|
|
1683
|
+
constructor(expr, type, sourceSpan) {
|
|
1684
|
+
super(type, sourceSpan);
|
|
1685
|
+
this.expr = expr;
|
|
1686
|
+
}
|
|
1687
|
+
visitExpression(visitor, context) {
|
|
1688
|
+
return visitor.visitParenthesizedExpr(this, context);
|
|
1689
|
+
}
|
|
1690
|
+
isEquivalent(e) {
|
|
1691
|
+
// TODO: should this ignore paren depth? i.e. is `(1)` equivalent to `1`?
|
|
1692
|
+
return e instanceof ParenthesizedExpr && e.expr.isEquivalent(this.expr);
|
|
1693
|
+
}
|
|
1694
|
+
isConstant() {
|
|
1695
|
+
return this.expr.isConstant();
|
|
1696
|
+
}
|
|
1697
|
+
clone() {
|
|
1698
|
+
return new ParenthesizedExpr(this.expr.clone());
|
|
1699
|
+
}
|
|
1700
|
+
}
|
|
1658
1701
|
class BinaryOperatorExpr extends Expression {
|
|
1659
1702
|
operator;
|
|
1660
1703
|
rhs;
|
|
1661
|
-
parens;
|
|
1662
1704
|
lhs;
|
|
1663
|
-
constructor(operator, lhs, rhs, type, sourceSpan
|
|
1705
|
+
constructor(operator, lhs, rhs, type, sourceSpan) {
|
|
1664
1706
|
super(type || lhs.type, sourceSpan);
|
|
1665
1707
|
this.operator = operator;
|
|
1666
1708
|
this.rhs = rhs;
|
|
1667
|
-
this.parens = parens;
|
|
1668
1709
|
this.lhs = lhs;
|
|
1669
1710
|
}
|
|
1670
1711
|
isEquivalent(e) {
|
|
@@ -1680,7 +1721,7 @@ class BinaryOperatorExpr extends Expression {
|
|
|
1680
1721
|
return visitor.visitBinaryOperatorExpr(this, context);
|
|
1681
1722
|
}
|
|
1682
1723
|
clone() {
|
|
1683
|
-
return new BinaryOperatorExpr(this.operator, this.lhs.clone(), this.rhs.clone(), this.type, this.sourceSpan
|
|
1724
|
+
return new BinaryOperatorExpr(this.operator, this.lhs.clone(), this.rhs.clone(), this.type, this.sourceSpan);
|
|
1684
1725
|
}
|
|
1685
1726
|
}
|
|
1686
1727
|
class ReadPropExpr extends Expression {
|
|
@@ -1984,9 +2025,6 @@ class RecursiveAstVisitor$1 {
|
|
|
1984
2025
|
visitWrappedNodeExpr(ast, context) {
|
|
1985
2026
|
return ast;
|
|
1986
2027
|
}
|
|
1987
|
-
visitTypeofExpr(ast, context) {
|
|
1988
|
-
return this.visitExpression(ast, context);
|
|
1989
|
-
}
|
|
1990
2028
|
visitReadVarExpr(ast, context) {
|
|
1991
2029
|
return this.visitExpression(ast, context);
|
|
1992
2030
|
}
|
|
@@ -2064,6 +2102,14 @@ class RecursiveAstVisitor$1 {
|
|
|
2064
2102
|
ast.expr.visitExpression(this, context);
|
|
2065
2103
|
return this.visitExpression(ast, context);
|
|
2066
2104
|
}
|
|
2105
|
+
visitTypeofExpr(ast, context) {
|
|
2106
|
+
ast.expr.visitExpression(this, context);
|
|
2107
|
+
return this.visitExpression(ast, context);
|
|
2108
|
+
}
|
|
2109
|
+
visitVoidExpr(ast, context) {
|
|
2110
|
+
ast.expr.visitExpression(this, context);
|
|
2111
|
+
return this.visitExpression(ast, context);
|
|
2112
|
+
}
|
|
2067
2113
|
visitBinaryOperatorExpr(ast, context) {
|
|
2068
2114
|
ast.lhs.visitExpression(this, context);
|
|
2069
2115
|
ast.rhs.visitExpression(this, context);
|
|
@@ -2098,6 +2144,10 @@ class RecursiveAstVisitor$1 {
|
|
|
2098
2144
|
visitTemplateLiteralElementExpr(ast, context) {
|
|
2099
2145
|
return this.visitExpression(ast, context);
|
|
2100
2146
|
}
|
|
2147
|
+
visitParenthesizedExpr(ast, context) {
|
|
2148
|
+
ast.expr.visitExpression(this, context);
|
|
2149
|
+
return this.visitExpression(ast, context);
|
|
2150
|
+
}
|
|
2101
2151
|
visitAllExpressions(exprs, context) {
|
|
2102
2152
|
exprs.forEach((expr) => expr.visitExpression(this, context));
|
|
2103
2153
|
}
|
|
@@ -2252,6 +2302,7 @@ var output_ast = /*#__PURE__*/Object.freeze({
|
|
|
2252
2302
|
Expression: Expression,
|
|
2253
2303
|
ReadVarExpr: ReadVarExpr,
|
|
2254
2304
|
TypeofExpr: TypeofExpr,
|
|
2305
|
+
VoidExpr: VoidExpr,
|
|
2255
2306
|
WrappedNodeExpr: WrappedNodeExpr,
|
|
2256
2307
|
WriteVarExpr: WriteVarExpr,
|
|
2257
2308
|
WriteKeyExpr: WriteKeyExpr,
|
|
@@ -2274,6 +2325,7 @@ var output_ast = /*#__PURE__*/Object.freeze({
|
|
|
2274
2325
|
FunctionExpr: FunctionExpr,
|
|
2275
2326
|
ArrowFunctionExpr: ArrowFunctionExpr,
|
|
2276
2327
|
UnaryOperatorExpr: UnaryOperatorExpr,
|
|
2328
|
+
ParenthesizedExpr: ParenthesizedExpr,
|
|
2277
2329
|
BinaryOperatorExpr: BinaryOperatorExpr,
|
|
2278
2330
|
ReadPropExpr: ReadPropExpr,
|
|
2279
2331
|
ReadKeyExpr: ReadKeyExpr,
|
|
@@ -3521,6 +3573,7 @@ class EmitterVisitorContext {
|
|
|
3521
3573
|
}
|
|
3522
3574
|
class AbstractEmitterVisitor {
|
|
3523
3575
|
_escapeDollarInStrings;
|
|
3576
|
+
lastIfCondition = null;
|
|
3524
3577
|
constructor(_escapeDollarInStrings) {
|
|
3525
3578
|
this._escapeDollarInStrings = _escapeDollarInStrings;
|
|
3526
3579
|
}
|
|
@@ -3560,7 +3613,9 @@ class AbstractEmitterVisitor {
|
|
|
3560
3613
|
visitIfStmt(stmt, ctx) {
|
|
3561
3614
|
this.printLeadingComments(stmt, ctx);
|
|
3562
3615
|
ctx.print(stmt, `if (`);
|
|
3616
|
+
this.lastIfCondition = stmt.condition; // We can skip redundant parentheses for the condition.
|
|
3563
3617
|
stmt.condition.visitExpression(this, ctx);
|
|
3618
|
+
this.lastIfCondition = null;
|
|
3564
3619
|
ctx.print(stmt, `) {`);
|
|
3565
3620
|
const hasElseCase = stmt.falseCase != null && stmt.falseCase.length > 0;
|
|
3566
3621
|
if (stmt.trueCase.length <= 1 && !hasElseCase) {
|
|
@@ -3666,6 +3721,10 @@ class AbstractEmitterVisitor {
|
|
|
3666
3721
|
ctx.print(expr, 'typeof ');
|
|
3667
3722
|
expr.expr.visitExpression(this, ctx);
|
|
3668
3723
|
}
|
|
3724
|
+
visitVoidExpr(expr, ctx) {
|
|
3725
|
+
ctx.print(expr, 'void ');
|
|
3726
|
+
expr.expr.visitExpression(this, ctx);
|
|
3727
|
+
}
|
|
3669
3728
|
visitReadVarExpr(ast, ctx) {
|
|
3670
3729
|
ctx.print(ast, ast.name);
|
|
3671
3730
|
return null;
|
|
@@ -3729,11 +3788,12 @@ class AbstractEmitterVisitor {
|
|
|
3729
3788
|
default:
|
|
3730
3789
|
throw new Error(`Unknown operator ${ast.operator}`);
|
|
3731
3790
|
}
|
|
3732
|
-
|
|
3791
|
+
const parens = ast !== this.lastIfCondition;
|
|
3792
|
+
if (parens)
|
|
3733
3793
|
ctx.print(ast, `(`);
|
|
3734
3794
|
ctx.print(ast, opStr);
|
|
3735
3795
|
ast.expr.visitExpression(this, ctx);
|
|
3736
|
-
if (
|
|
3796
|
+
if (parens)
|
|
3737
3797
|
ctx.print(ast, `)`);
|
|
3738
3798
|
return null;
|
|
3739
3799
|
}
|
|
@@ -3779,6 +3839,9 @@ class AbstractEmitterVisitor {
|
|
|
3779
3839
|
case BinaryOperator.Modulo:
|
|
3780
3840
|
opStr = '%';
|
|
3781
3841
|
break;
|
|
3842
|
+
case BinaryOperator.Exponentiation:
|
|
3843
|
+
opStr = '**';
|
|
3844
|
+
break;
|
|
3782
3845
|
case BinaryOperator.Lower:
|
|
3783
3846
|
opStr = '<';
|
|
3784
3847
|
break;
|
|
@@ -3797,12 +3860,13 @@ class AbstractEmitterVisitor {
|
|
|
3797
3860
|
default:
|
|
3798
3861
|
throw new Error(`Unknown operator ${ast.operator}`);
|
|
3799
3862
|
}
|
|
3800
|
-
|
|
3863
|
+
const parens = ast !== this.lastIfCondition;
|
|
3864
|
+
if (parens)
|
|
3801
3865
|
ctx.print(ast, `(`);
|
|
3802
3866
|
ast.lhs.visitExpression(this, ctx);
|
|
3803
3867
|
ctx.print(ast, ` ${opStr} `);
|
|
3804
3868
|
ast.rhs.visitExpression(this, ctx);
|
|
3805
|
-
if (
|
|
3869
|
+
if (parens)
|
|
3806
3870
|
ctx.print(ast, `)`);
|
|
3807
3871
|
return null;
|
|
3808
3872
|
}
|
|
@@ -3840,6 +3904,12 @@ class AbstractEmitterVisitor {
|
|
|
3840
3904
|
ctx.print(ast, ')');
|
|
3841
3905
|
return null;
|
|
3842
3906
|
}
|
|
3907
|
+
visitParenthesizedExpr(ast, ctx) {
|
|
3908
|
+
// We parenthesize everything regardless of an explicit ParenthesizedExpr, so we can just visit
|
|
3909
|
+
// the inner expression.
|
|
3910
|
+
// TODO: Do we *need* to parenthesize everything?
|
|
3911
|
+
ast.expr.visitExpression(this, ctx);
|
|
3912
|
+
}
|
|
3843
3913
|
visitAllExpressions(expressions, ctx, separator) {
|
|
3844
3914
|
this.visitAllObjects((expr) => expr.visitExpression(this, ctx), expressions, ctx, separator);
|
|
3845
3915
|
}
|
|
@@ -3936,7 +4006,7 @@ function guardedExpression(guard, expr) {
|
|
|
3936
4006
|
const guardNotDefined = new BinaryOperatorExpr(BinaryOperator.Identical, new TypeofExpr(guardExpr), literal('undefined'));
|
|
3937
4007
|
const guardUndefinedOrTrue = new BinaryOperatorExpr(BinaryOperator.Or, guardNotDefined, guardExpr,
|
|
3938
4008
|
/* type */ undefined,
|
|
3939
|
-
/* sourceSpan */ undefined
|
|
4009
|
+
/* sourceSpan */ undefined);
|
|
3940
4010
|
return new BinaryOperatorExpr(BinaryOperator.And, guardUndefinedOrTrue, expr);
|
|
3941
4011
|
}
|
|
3942
4012
|
function wrapReference(value) {
|
|
@@ -4481,6 +4551,16 @@ class TypeofExpression extends AST {
|
|
|
4481
4551
|
return visitor.visitTypeofExpression(this, context);
|
|
4482
4552
|
}
|
|
4483
4553
|
}
|
|
4554
|
+
class VoidExpression extends AST {
|
|
4555
|
+
expression;
|
|
4556
|
+
constructor(span, sourceSpan, expression) {
|
|
4557
|
+
super(span, sourceSpan);
|
|
4558
|
+
this.expression = expression;
|
|
4559
|
+
}
|
|
4560
|
+
visit(visitor, context = null) {
|
|
4561
|
+
return visitor.visitVoidExpression(this, context);
|
|
4562
|
+
}
|
|
4563
|
+
}
|
|
4484
4564
|
class NonNullAssert extends AST {
|
|
4485
4565
|
expression;
|
|
4486
4566
|
constructor(span, sourceSpan, expression) {
|
|
@@ -4519,6 +4599,18 @@ class SafeCall extends AST {
|
|
|
4519
4599
|
return visitor.visitSafeCall(this, context);
|
|
4520
4600
|
}
|
|
4521
4601
|
}
|
|
4602
|
+
class TaggedTemplateLiteral extends AST {
|
|
4603
|
+
tag;
|
|
4604
|
+
template;
|
|
4605
|
+
constructor(span, sourceSpan, tag, template) {
|
|
4606
|
+
super(span, sourceSpan);
|
|
4607
|
+
this.tag = tag;
|
|
4608
|
+
this.template = template;
|
|
4609
|
+
}
|
|
4610
|
+
visit(visitor, context) {
|
|
4611
|
+
return visitor.visitTaggedTemplateLiteral(this, context);
|
|
4612
|
+
}
|
|
4613
|
+
}
|
|
4522
4614
|
class TemplateLiteral extends AST {
|
|
4523
4615
|
elements;
|
|
4524
4616
|
expressions;
|
|
@@ -4663,6 +4755,9 @@ class RecursiveAstVisitor {
|
|
|
4663
4755
|
visitTypeofExpression(ast, context) {
|
|
4664
4756
|
this.visit(ast.expression, context);
|
|
4665
4757
|
}
|
|
4758
|
+
visitVoidExpression(ast, context) {
|
|
4759
|
+
this.visit(ast.expression, context);
|
|
4760
|
+
}
|
|
4666
4761
|
visitNonNullAssert(ast, context) {
|
|
4667
4762
|
this.visit(ast.expression, context);
|
|
4668
4763
|
}
|
|
@@ -4700,6 +4795,10 @@ class RecursiveAstVisitor {
|
|
|
4700
4795
|
}
|
|
4701
4796
|
}
|
|
4702
4797
|
visitTemplateLiteralElement(ast, context) { }
|
|
4798
|
+
visitTaggedTemplateLiteral(ast, context) {
|
|
4799
|
+
this.visit(ast.tag, context);
|
|
4800
|
+
this.visit(ast.template, context);
|
|
4801
|
+
}
|
|
4703
4802
|
// This is not part of the AstVisitor interface, just a helper method
|
|
4704
4803
|
visitAll(asts, context) {
|
|
4705
4804
|
for (const ast of asts) {
|
|
@@ -10420,6 +10519,9 @@ function transformExpressionsInExpression(expr, transform, flags) {
|
|
|
10420
10519
|
else if (expr instanceof TypeofExpr) {
|
|
10421
10520
|
expr.expr = transformExpressionsInExpression(expr.expr, transform, flags);
|
|
10422
10521
|
}
|
|
10522
|
+
else if (expr instanceof VoidExpr) {
|
|
10523
|
+
expr.expr = transformExpressionsInExpression(expr.expr, transform, flags);
|
|
10524
|
+
}
|
|
10423
10525
|
else if (expr instanceof WriteVarExpr) {
|
|
10424
10526
|
expr.value = transformExpressionsInExpression(expr.value, transform, flags);
|
|
10425
10527
|
}
|
|
@@ -10453,6 +10555,9 @@ function transformExpressionsInExpression(expr, transform, flags) {
|
|
|
10453
10555
|
expr.expressions[i] = transformExpressionsInExpression(expr.expressions[i], transform, flags);
|
|
10454
10556
|
}
|
|
10455
10557
|
}
|
|
10558
|
+
else if (expr instanceof ParenthesizedExpr) {
|
|
10559
|
+
expr.expr = transformExpressionsInExpression(expr.expr, transform, flags);
|
|
10560
|
+
}
|
|
10456
10561
|
else if (expr instanceof ReadVarExpr ||
|
|
10457
10562
|
expr instanceof ExternalExpr ||
|
|
10458
10563
|
expr instanceof LiteralExpr) {
|
|
@@ -11527,6 +11632,33 @@ function assignI18nSlotDependencies(job) {
|
|
|
11527
11632
|
}
|
|
11528
11633
|
}
|
|
11529
11634
|
|
|
11635
|
+
/**
|
|
11636
|
+
* Locates all of the elements defined in a creation block and outputs an op
|
|
11637
|
+
* that will expose their definition location in the DOM.
|
|
11638
|
+
*/
|
|
11639
|
+
function attachSourceLocations(job) {
|
|
11640
|
+
if (!job.enableDebugLocations || job.relativeTemplatePath === null) {
|
|
11641
|
+
return;
|
|
11642
|
+
}
|
|
11643
|
+
for (const unit of job.units) {
|
|
11644
|
+
const locations = [];
|
|
11645
|
+
for (const op of unit.create) {
|
|
11646
|
+
if (op.kind === OpKind.ElementStart || op.kind === OpKind.Element) {
|
|
11647
|
+
const start = op.startSourceSpan.start;
|
|
11648
|
+
locations.push({
|
|
11649
|
+
targetSlot: op.handle,
|
|
11650
|
+
offset: start.offset,
|
|
11651
|
+
line: start.line,
|
|
11652
|
+
column: start.col,
|
|
11653
|
+
});
|
|
11654
|
+
}
|
|
11655
|
+
}
|
|
11656
|
+
if (locations.length > 0) {
|
|
11657
|
+
unit.create.push(createSourceLocationOp(job.relativeTemplatePath, locations));
|
|
11658
|
+
}
|
|
11659
|
+
}
|
|
11660
|
+
}
|
|
11661
|
+
|
|
11530
11662
|
/**
|
|
11531
11663
|
* Gets a map of all elements in the given view by their xref id.
|
|
11532
11664
|
*/
|
|
@@ -11927,6 +12059,7 @@ const BINARY_OPERATORS = new Map([
|
|
|
11927
12059
|
['<=', BinaryOperator.LowerEquals],
|
|
11928
12060
|
['-', BinaryOperator.Minus],
|
|
11929
12061
|
['%', BinaryOperator.Modulo],
|
|
12062
|
+
['**', BinaryOperator.Exponentiation],
|
|
11930
12063
|
['*', BinaryOperator.Multiply],
|
|
11931
12064
|
['!=', BinaryOperator.NotEquals],
|
|
11932
12065
|
['!==', BinaryOperator.NotIdentical],
|
|
@@ -12216,29 +12349,6 @@ function convertI18nBindings(job) {
|
|
|
12216
12349
|
}
|
|
12217
12350
|
}
|
|
12218
12351
|
|
|
12219
|
-
/**
|
|
12220
|
-
* Resolve the dependency function of a deferred block.
|
|
12221
|
-
*/
|
|
12222
|
-
function resolveDeferDepsFns(job) {
|
|
12223
|
-
for (const unit of job.units) {
|
|
12224
|
-
for (const op of unit.create) {
|
|
12225
|
-
if (op.kind === OpKind.Defer) {
|
|
12226
|
-
if (op.resolverFn !== null) {
|
|
12227
|
-
continue;
|
|
12228
|
-
}
|
|
12229
|
-
if (op.ownResolverFn !== null) {
|
|
12230
|
-
if (op.handle.slot === null) {
|
|
12231
|
-
throw new Error('AssertionError: slot must be assigned before extracting defer deps functions');
|
|
12232
|
-
}
|
|
12233
|
-
const fullPathName = unit.fnName?.replace('_Template', '');
|
|
12234
|
-
op.resolverFn = job.pool.getSharedFunctionReference(op.ownResolverFn, `${fullPathName}_Defer_${op.handle.slot}_DepsFn`,
|
|
12235
|
-
/* Don't use unique names for TDB compatibility */ false);
|
|
12236
|
-
}
|
|
12237
|
-
}
|
|
12238
|
-
}
|
|
12239
|
-
}
|
|
12240
|
-
}
|
|
12241
|
-
|
|
12242
12352
|
/**
|
|
12243
12353
|
* Create one helper context op per i18n block (including generate descending blocks).
|
|
12244
12354
|
*
|
|
@@ -12986,6 +13096,27 @@ function generateAdvance(job) {
|
|
|
12986
13096
|
}
|
|
12987
13097
|
}
|
|
12988
13098
|
|
|
13099
|
+
/**
|
|
13100
|
+
* Replaces the `storeLet` ops with variables that can be
|
|
13101
|
+
* used to reference the value within the same view.
|
|
13102
|
+
*/
|
|
13103
|
+
function generateLocalLetReferences(job) {
|
|
13104
|
+
for (const unit of job.units) {
|
|
13105
|
+
for (const op of unit.update) {
|
|
13106
|
+
if (op.kind !== OpKind.StoreLet) {
|
|
13107
|
+
continue;
|
|
13108
|
+
}
|
|
13109
|
+
const variable = {
|
|
13110
|
+
kind: SemanticVariableKind.Identifier,
|
|
13111
|
+
name: null,
|
|
13112
|
+
identifier: op.declaredName,
|
|
13113
|
+
local: true,
|
|
13114
|
+
};
|
|
13115
|
+
OpList.replace(op, createVariableOp(job.allocateXrefId(), variable, new StoreLetExpr(op.target, op.value, op.sourceSpan), VariableFlags.None));
|
|
13116
|
+
}
|
|
13117
|
+
}
|
|
13118
|
+
}
|
|
13119
|
+
|
|
12989
13120
|
/**
|
|
12990
13121
|
* Locate projection slots, populate the each component's `ngContentSelectors` literal field,
|
|
12991
13122
|
* populate `project` arguments, and generate the required `projectionDef` instruction for the job's
|
|
@@ -17636,6 +17767,7 @@ const KEYWORDS = [
|
|
|
17636
17767
|
'else',
|
|
17637
17768
|
'this',
|
|
17638
17769
|
'typeof',
|
|
17770
|
+
'void',
|
|
17639
17771
|
];
|
|
17640
17772
|
class Lexer {
|
|
17641
17773
|
tokenize(text) {
|
|
@@ -17700,6 +17832,9 @@ class Token {
|
|
|
17700
17832
|
isKeywordTypeof() {
|
|
17701
17833
|
return this.type === TokenType.Keyword && this.strValue === 'typeof';
|
|
17702
17834
|
}
|
|
17835
|
+
isKeywordVoid() {
|
|
17836
|
+
return this.type === TokenType.Keyword && this.strValue === 'void';
|
|
17837
|
+
}
|
|
17703
17838
|
isError() {
|
|
17704
17839
|
return this.type === TokenType.Error;
|
|
17705
17840
|
}
|
|
@@ -17844,11 +17979,12 @@ class _Scanner {
|
|
|
17844
17979
|
return this.scanPrivateIdentifier();
|
|
17845
17980
|
case $PLUS:
|
|
17846
17981
|
case $MINUS:
|
|
17847
|
-
case $STAR:
|
|
17848
17982
|
case $SLASH:
|
|
17849
17983
|
case $PERCENT:
|
|
17850
17984
|
case $CARET:
|
|
17851
17985
|
return this.scanOperator(start, String.fromCharCode(peek));
|
|
17986
|
+
case $STAR:
|
|
17987
|
+
return this.scanComplexOperator(start, '*', $STAR, '*');
|
|
17852
17988
|
case $QUESTION:
|
|
17853
17989
|
return this.scanQuestion(start);
|
|
17854
17990
|
case $LT:
|
|
@@ -18418,6 +18554,7 @@ class _ParseAST {
|
|
|
18418
18554
|
parseFlags;
|
|
18419
18555
|
errors;
|
|
18420
18556
|
offset;
|
|
18557
|
+
lastUnary = null;
|
|
18421
18558
|
rparensExpected = 0;
|
|
18422
18559
|
rbracketsExpected = 0;
|
|
18423
18560
|
rbracesExpected = 0;
|
|
@@ -18784,7 +18921,7 @@ class _ParseAST {
|
|
|
18784
18921
|
parseMultiplicative() {
|
|
18785
18922
|
// '*', '%', '/'
|
|
18786
18923
|
const start = this.inputIndex;
|
|
18787
|
-
let result = this.
|
|
18924
|
+
let result = this.parseExponentiation();
|
|
18788
18925
|
while (this.next.type == TokenType.Operator) {
|
|
18789
18926
|
const operator = this.next.strValue;
|
|
18790
18927
|
switch (operator) {
|
|
@@ -18792,7 +18929,7 @@ class _ParseAST {
|
|
|
18792
18929
|
case '%':
|
|
18793
18930
|
case '/':
|
|
18794
18931
|
this.advance();
|
|
18795
|
-
|
|
18932
|
+
const right = this.parseExponentiation();
|
|
18796
18933
|
result = new Binary(this.span(start), this.sourceSpan(start), operator, result, right);
|
|
18797
18934
|
continue;
|
|
18798
18935
|
}
|
|
@@ -18800,6 +18937,23 @@ class _ParseAST {
|
|
|
18800
18937
|
}
|
|
18801
18938
|
return result;
|
|
18802
18939
|
}
|
|
18940
|
+
parseExponentiation() {
|
|
18941
|
+
// '**'
|
|
18942
|
+
const start = this.inputIndex;
|
|
18943
|
+
let result = this.parsePrefix();
|
|
18944
|
+
while (this.next.type == TokenType.Operator && this.next.strValue === '**') {
|
|
18945
|
+
// This aligns with Javascript semantics which require any unary operator preceeding the
|
|
18946
|
+
// exponentiation operation to be explicitly grouped as either applying to the base or result
|
|
18947
|
+
// of the exponentiation operation.
|
|
18948
|
+
if (result === this.lastUnary) {
|
|
18949
|
+
this.error('Unary operator used immediately before exponentiation expression. Parenthesis must be used to disambiguate operator precedence');
|
|
18950
|
+
}
|
|
18951
|
+
this.advance();
|
|
18952
|
+
const right = this.parseExponentiation();
|
|
18953
|
+
result = new Binary(this.span(start), this.sourceSpan(start), '**', result, right);
|
|
18954
|
+
}
|
|
18955
|
+
return result;
|
|
18956
|
+
}
|
|
18803
18957
|
parsePrefix() {
|
|
18804
18958
|
if (this.next.type == TokenType.Operator) {
|
|
18805
18959
|
const start = this.inputIndex;
|
|
@@ -18809,22 +18963,28 @@ class _ParseAST {
|
|
|
18809
18963
|
case '+':
|
|
18810
18964
|
this.advance();
|
|
18811
18965
|
result = this.parsePrefix();
|
|
18812
|
-
return Unary.createPlus(this.span(start), this.sourceSpan(start), result);
|
|
18966
|
+
return (this.lastUnary = Unary.createPlus(this.span(start), this.sourceSpan(start), result));
|
|
18813
18967
|
case '-':
|
|
18814
18968
|
this.advance();
|
|
18815
18969
|
result = this.parsePrefix();
|
|
18816
|
-
return Unary.createMinus(this.span(start), this.sourceSpan(start), result);
|
|
18970
|
+
return (this.lastUnary = Unary.createMinus(this.span(start), this.sourceSpan(start), result));
|
|
18817
18971
|
case '!':
|
|
18818
18972
|
this.advance();
|
|
18819
18973
|
result = this.parsePrefix();
|
|
18820
|
-
return new PrefixNot(this.span(start), this.sourceSpan(start), result);
|
|
18974
|
+
return (this.lastUnary = new PrefixNot(this.span(start), this.sourceSpan(start), result));
|
|
18821
18975
|
}
|
|
18822
18976
|
}
|
|
18823
18977
|
else if (this.next.isKeywordTypeof()) {
|
|
18824
18978
|
this.advance();
|
|
18825
18979
|
const start = this.inputIndex;
|
|
18826
18980
|
let result = this.parsePrefix();
|
|
18827
|
-
return new TypeofExpression(this.span(start), this.sourceSpan(start), result);
|
|
18981
|
+
return (this.lastUnary = new TypeofExpression(this.span(start), this.sourceSpan(start), result));
|
|
18982
|
+
}
|
|
18983
|
+
else if (this.next.isKeywordVoid()) {
|
|
18984
|
+
this.advance();
|
|
18985
|
+
const start = this.inputIndex;
|
|
18986
|
+
let result = this.parsePrefix();
|
|
18987
|
+
return (this.lastUnary = new VoidExpression(this.span(start), this.sourceSpan(start), result));
|
|
18828
18988
|
}
|
|
18829
18989
|
return this.parseCallChain();
|
|
18830
18990
|
}
|
|
@@ -18854,6 +19014,12 @@ class _ParseAST {
|
|
|
18854
19014
|
else if (this.consumeOptionalOperator('!')) {
|
|
18855
19015
|
result = new NonNullAssert(this.span(start), this.sourceSpan(start), result);
|
|
18856
19016
|
}
|
|
19017
|
+
else if (this.next.isTemplateLiteralEnd()) {
|
|
19018
|
+
result = this.parseNoInterpolationTaggedTemplateLiteral(result, start);
|
|
19019
|
+
}
|
|
19020
|
+
else if (this.next.isTemplateLiteralPart()) {
|
|
19021
|
+
result = this.parseTaggedTemplateLiteral(result, start);
|
|
19022
|
+
}
|
|
18857
19023
|
else {
|
|
18858
19024
|
return result;
|
|
18859
19025
|
}
|
|
@@ -18865,6 +19031,7 @@ class _ParseAST {
|
|
|
18865
19031
|
this.rparensExpected++;
|
|
18866
19032
|
const result = this.parsePipe();
|
|
18867
19033
|
this.rparensExpected--;
|
|
19034
|
+
this.lastUnary = null;
|
|
18868
19035
|
this.expectCharacter($RPAREN);
|
|
18869
19036
|
return result;
|
|
18870
19037
|
}
|
|
@@ -18907,7 +19074,7 @@ class _ParseAST {
|
|
|
18907
19074
|
return new LiteralPrimitive(this.span(start), this.sourceSpan(start), value);
|
|
18908
19075
|
}
|
|
18909
19076
|
else if (this.next.isTemplateLiteralEnd()) {
|
|
18910
|
-
return this.parseNoInterpolationTemplateLiteral(
|
|
19077
|
+
return this.parseNoInterpolationTemplateLiteral();
|
|
18911
19078
|
}
|
|
18912
19079
|
else if (this.next.isTemplateLiteralPart()) {
|
|
18913
19080
|
return this.parseTemplateLiteral();
|
|
@@ -19237,17 +19404,25 @@ class _ParseAST {
|
|
|
19237
19404
|
const sourceSpan = new AbsoluteSourceSpan(spanStart, this.currentAbsoluteOffset);
|
|
19238
19405
|
return new VariableBinding(sourceSpan, key, value);
|
|
19239
19406
|
}
|
|
19240
|
-
|
|
19407
|
+
parseNoInterpolationTaggedTemplateLiteral(tag, start) {
|
|
19408
|
+
const template = this.parseNoInterpolationTemplateLiteral();
|
|
19409
|
+
return new TaggedTemplateLiteral(this.span(start), this.sourceSpan(start), tag, template);
|
|
19410
|
+
}
|
|
19411
|
+
parseNoInterpolationTemplateLiteral() {
|
|
19241
19412
|
const text = this.next.strValue;
|
|
19242
19413
|
this.advance();
|
|
19243
|
-
const span = this.span(
|
|
19244
|
-
const sourceSpan = this.sourceSpan(
|
|
19414
|
+
const span = this.span(this.inputIndex);
|
|
19415
|
+
const sourceSpan = this.sourceSpan(this.inputIndex);
|
|
19245
19416
|
return new TemplateLiteral(span, sourceSpan, [new TemplateLiteralElement(span, sourceSpan, text)], []);
|
|
19246
19417
|
}
|
|
19418
|
+
parseTaggedTemplateLiteral(tag, start) {
|
|
19419
|
+
const template = this.parseTemplateLiteral();
|
|
19420
|
+
return new TaggedTemplateLiteral(this.span(start), this.sourceSpan(start), tag, template);
|
|
19421
|
+
}
|
|
19247
19422
|
parseTemplateLiteral() {
|
|
19248
|
-
const start = this.inputIndex;
|
|
19249
19423
|
const elements = [];
|
|
19250
19424
|
const expressions = [];
|
|
19425
|
+
const start = this.inputIndex;
|
|
19251
19426
|
while (this.next !== EOF) {
|
|
19252
19427
|
const token = this.next;
|
|
19253
19428
|
if (token.isTemplateLiteralPart() || token.isTemplateLiteralEnd()) {
|
|
@@ -19488,6 +19663,9 @@ class SerializeExpressionVisitor {
|
|
|
19488
19663
|
visitTypeofExpression(ast, context) {
|
|
19489
19664
|
return `typeof ${ast.expression.visit(this, context)}`;
|
|
19490
19665
|
}
|
|
19666
|
+
visitVoidExpression(ast, context) {
|
|
19667
|
+
return `void ${ast.expression.visit(this, context)}`;
|
|
19668
|
+
}
|
|
19491
19669
|
visitASTWithSource(ast, context) {
|
|
19492
19670
|
return ast.ast.visit(this, context);
|
|
19493
19671
|
}
|
|
@@ -19505,6 +19683,9 @@ class SerializeExpressionVisitor {
|
|
|
19505
19683
|
visitTemplateLiteralElement(ast, context) {
|
|
19506
19684
|
return ast.text;
|
|
19507
19685
|
}
|
|
19686
|
+
visitTaggedTemplateLiteral(ast, context) {
|
|
19687
|
+
return ast.tag.visit(this, context) + ast.template.visit(this, context);
|
|
19688
|
+
}
|
|
19508
19689
|
}
|
|
19509
19690
|
/** Zips the two input arrays into a single array of pairs of elements at the same index. */
|
|
19510
19691
|
function zip(left, right) {
|
|
@@ -22054,30 +22235,6 @@ function disableBindings$1(job) {
|
|
|
22054
22235
|
}
|
|
22055
22236
|
}
|
|
22056
22237
|
|
|
22057
|
-
/**
|
|
22058
|
-
* Nullish coalescing expressions such as `a ?? b` have different semantics in Angular templates as
|
|
22059
|
-
* compared to JavaScript. In particular, they default to `null` instead of `undefined`. Therefore,
|
|
22060
|
-
* we replace them with ternary expressions, assigning temporaries as needed to avoid re-evaluating
|
|
22061
|
-
* the same sub-expression multiple times.
|
|
22062
|
-
*/
|
|
22063
|
-
function generateNullishCoalesceExpressions(job) {
|
|
22064
|
-
for (const unit of job.units) {
|
|
22065
|
-
for (const op of unit.ops()) {
|
|
22066
|
-
transformExpressionsInOp(op, (expr) => {
|
|
22067
|
-
if (!(expr instanceof BinaryOperatorExpr) ||
|
|
22068
|
-
expr.operator !== BinaryOperator.NullishCoalesce) {
|
|
22069
|
-
return expr;
|
|
22070
|
-
}
|
|
22071
|
-
const assignment = new AssignTemporaryExpr(expr.lhs.clone(), job.allocateXrefId());
|
|
22072
|
-
const read = new ReadTemporaryExpr(assignment.xref);
|
|
22073
|
-
// TODO: When not in compatibility mode for TemplateDefinitionBuilder, we can just emit
|
|
22074
|
-
// `t != null` instead of including an undefined check as well.
|
|
22075
|
-
return new ConditionalExpr(new BinaryOperatorExpr(BinaryOperator.And, new BinaryOperatorExpr(BinaryOperator.NotIdentical, assignment, NULL_EXPR), new BinaryOperatorExpr(BinaryOperator.NotIdentical, read, new LiteralExpr(undefined))), read.clone(), expr.rhs);
|
|
22076
|
-
}, VisitorContextFlag.None);
|
|
22077
|
-
}
|
|
22078
|
-
}
|
|
22079
|
-
}
|
|
22080
|
-
|
|
22081
22238
|
function kindTest(kind) {
|
|
22082
22239
|
return (op) => op.kind === kind;
|
|
22083
22240
|
}
|
|
@@ -23621,6 +23778,33 @@ function removeI18nContexts(job) {
|
|
|
23621
23778
|
}
|
|
23622
23779
|
}
|
|
23623
23780
|
|
|
23781
|
+
/**
|
|
23782
|
+
* It's not allowed to access a `@let` declaration before it has been defined. This is enforced
|
|
23783
|
+
* already via template type checking, however it can trip some of the assertions in the pipeline.
|
|
23784
|
+
* E.g. the naming phase can fail because we resolved the variable here, but the variable doesn't
|
|
23785
|
+
* exist anymore because the optimization phase removed it since it's invalid. To avoid surfacing
|
|
23786
|
+
* confusing errors to users in the case where template type checking isn't running (e.g. in JIT
|
|
23787
|
+
* mode) this phase detects illegal forward references and replaces them with `undefined`.
|
|
23788
|
+
* Eventually users will see the proper error from the template type checker.
|
|
23789
|
+
*/
|
|
23790
|
+
function removeIllegalLetReferences(job) {
|
|
23791
|
+
for (const unit of job.units) {
|
|
23792
|
+
for (const op of unit.update) {
|
|
23793
|
+
if (op.kind !== OpKind.Variable ||
|
|
23794
|
+
op.variable.kind !== SemanticVariableKind.Identifier ||
|
|
23795
|
+
!(op.initializer instanceof StoreLetExpr)) {
|
|
23796
|
+
continue;
|
|
23797
|
+
}
|
|
23798
|
+
const name = op.variable.identifier;
|
|
23799
|
+
let current = op;
|
|
23800
|
+
while (current && current.kind !== OpKind.ListEnd) {
|
|
23801
|
+
transformExpressionsInOp(current, (expr) => expr instanceof LexicalReadExpr && expr.name === name ? literal(undefined) : expr, VisitorContextFlag.None);
|
|
23802
|
+
current = current.prev;
|
|
23803
|
+
}
|
|
23804
|
+
}
|
|
23805
|
+
}
|
|
23806
|
+
}
|
|
23807
|
+
|
|
23624
23808
|
/**
|
|
23625
23809
|
* i18nAttributes ops will be generated for each i18n attribute. However, not all i18n attribues
|
|
23626
23810
|
* will contain dynamic content, and so some of these i18nAttributes ops may be unnecessary.
|
|
@@ -23646,6 +23830,57 @@ function removeUnusedI18nAttributesOps(job) {
|
|
|
23646
23830
|
}
|
|
23647
23831
|
}
|
|
23648
23832
|
|
|
23833
|
+
// TODO: create AST for parentheses when parsing, then we can remove the unnecessary ones instead of
|
|
23834
|
+
// adding them out of thin air. This should simplify the parsing and give us valid spans for the
|
|
23835
|
+
// parentheses.
|
|
23836
|
+
/**
|
|
23837
|
+
* In some cases we need to add parentheses to expressions for them to be considered valid
|
|
23838
|
+
* JavaScript. This phase adds parentheses to cover such cases. Currently these cases are:
|
|
23839
|
+
*
|
|
23840
|
+
* 1. Unary operators in the base of an exponentiation expression. For example, `-2 ** 3` is not
|
|
23841
|
+
* valid JavaScript, but `(-2) ** 3` is.
|
|
23842
|
+
* 2. When mixing nullish coalescing (`??`) and logical and/or operators (`&&`, `||`), we need to
|
|
23843
|
+
* add parentheses. For example, `a ?? b && c` is not valid JavaScript, but `a ?? (b && c)` is.
|
|
23844
|
+
* 3. Safe property access that has been down-leveled into a ternary expression needs parentheses
|
|
23845
|
+
* when used with nullish coalescing.
|
|
23846
|
+
*/
|
|
23847
|
+
function requiredParentheses(job) {
|
|
23848
|
+
for (const unit of job.units) {
|
|
23849
|
+
for (const op of unit.ops()) {
|
|
23850
|
+
transformExpressionsInOp(op, (expr) => {
|
|
23851
|
+
if (expr instanceof BinaryOperatorExpr) {
|
|
23852
|
+
switch (expr.operator) {
|
|
23853
|
+
case BinaryOperator.Exponentiation:
|
|
23854
|
+
parenthesizeExponentiation(expr);
|
|
23855
|
+
break;
|
|
23856
|
+
case BinaryOperator.NullishCoalesce:
|
|
23857
|
+
parenthesizeNullishCoalescing(expr);
|
|
23858
|
+
break;
|
|
23859
|
+
}
|
|
23860
|
+
}
|
|
23861
|
+
return expr;
|
|
23862
|
+
}, VisitorContextFlag.None);
|
|
23863
|
+
}
|
|
23864
|
+
}
|
|
23865
|
+
}
|
|
23866
|
+
function parenthesizeExponentiation(expr) {
|
|
23867
|
+
if (expr.lhs instanceof UnaryOperatorExpr) {
|
|
23868
|
+
expr.lhs = new ParenthesizedExpr(expr.lhs);
|
|
23869
|
+
}
|
|
23870
|
+
}
|
|
23871
|
+
function parenthesizeNullishCoalescing(expr) {
|
|
23872
|
+
if (isLogicalAndOr(expr.lhs) || expr.lhs instanceof ConditionalExpr) {
|
|
23873
|
+
expr.lhs = new ParenthesizedExpr(expr.lhs);
|
|
23874
|
+
}
|
|
23875
|
+
if (isLogicalAndOr(expr.rhs) || expr.rhs instanceof ConditionalExpr) {
|
|
23876
|
+
expr.rhs = new ParenthesizedExpr(expr.rhs);
|
|
23877
|
+
}
|
|
23878
|
+
}
|
|
23879
|
+
function isLogicalAndOr(expr) {
|
|
23880
|
+
return (expr instanceof BinaryOperatorExpr &&
|
|
23881
|
+
(expr.operator === BinaryOperator.And || expr.operator === BinaryOperator.Or));
|
|
23882
|
+
}
|
|
23883
|
+
|
|
23649
23884
|
/**
|
|
23650
23885
|
* Resolves `ir.ContextExpr` expressions (which represent embedded view or component contexts) to
|
|
23651
23886
|
* either the `ctx` parameter to component functions (for the current view context) or to variables
|
|
@@ -23702,6 +23937,29 @@ function processLexicalScope$1(view, ops) {
|
|
|
23702
23937
|
}
|
|
23703
23938
|
}
|
|
23704
23939
|
|
|
23940
|
+
/**
|
|
23941
|
+
* Resolve the dependency function of a deferred block.
|
|
23942
|
+
*/
|
|
23943
|
+
function resolveDeferDepsFns(job) {
|
|
23944
|
+
for (const unit of job.units) {
|
|
23945
|
+
for (const op of unit.create) {
|
|
23946
|
+
if (op.kind === OpKind.Defer) {
|
|
23947
|
+
if (op.resolverFn !== null) {
|
|
23948
|
+
continue;
|
|
23949
|
+
}
|
|
23950
|
+
if (op.ownResolverFn !== null) {
|
|
23951
|
+
if (op.handle.slot === null) {
|
|
23952
|
+
throw new Error('AssertionError: slot must be assigned before extracting defer deps functions');
|
|
23953
|
+
}
|
|
23954
|
+
const fullPathName = unit.fnName?.replace('_Template', '');
|
|
23955
|
+
op.resolverFn = job.pool.getSharedFunctionReference(op.ownResolverFn, `${fullPathName}_Defer_${op.handle.slot}_DepsFn`,
|
|
23956
|
+
/* Don't use unique names for TDB compatibility */ false);
|
|
23957
|
+
}
|
|
23958
|
+
}
|
|
23959
|
+
}
|
|
23960
|
+
}
|
|
23961
|
+
}
|
|
23962
|
+
|
|
23705
23963
|
/**
|
|
23706
23964
|
* Any variable inside a listener with the name `$event` will be transformed into a output lexical
|
|
23707
23965
|
* read immediately, and does not participate in any of the normal logic for handling variables.
|
|
@@ -24278,39 +24536,6 @@ function getOnlySecurityContext(securityContext) {
|
|
|
24278
24536
|
return securityContext;
|
|
24279
24537
|
}
|
|
24280
24538
|
|
|
24281
|
-
/**
|
|
24282
|
-
* Transforms a `TwoWayBindingSet` expression into an expression that either
|
|
24283
|
-
* sets a value through the `twoWayBindingSet` instruction or falls back to setting
|
|
24284
|
-
* the value directly. E.g. the expression `TwoWayBindingSet(target, value)` becomes:
|
|
24285
|
-
* `ng.twoWayBindingSet(target, value) || (target = value)`.
|
|
24286
|
-
*/
|
|
24287
|
-
function transformTwoWayBindingSet(job) {
|
|
24288
|
-
for (const unit of job.units) {
|
|
24289
|
-
for (const op of unit.create) {
|
|
24290
|
-
if (op.kind === OpKind.TwoWayListener) {
|
|
24291
|
-
transformExpressionsInOp(op, (expr) => {
|
|
24292
|
-
if (!(expr instanceof TwoWayBindingSetExpr)) {
|
|
24293
|
-
return expr;
|
|
24294
|
-
}
|
|
24295
|
-
const { target, value } = expr;
|
|
24296
|
-
if (target instanceof ReadPropExpr || target instanceof ReadKeyExpr) {
|
|
24297
|
-
return twoWayBindingSet(target, value).or(target.set(value));
|
|
24298
|
-
}
|
|
24299
|
-
// ASSUMPTION: here we're assuming that `ReadVariableExpr` will be a reference
|
|
24300
|
-
// to a local template variable. This appears to be the case at the time of writing.
|
|
24301
|
-
// If the expression is targeting a variable read, we only emit the `twoWayBindingSet`
|
|
24302
|
-
// since the fallback would be attempting to write into a constant. Invalid usages will be
|
|
24303
|
-
// flagged during template type checking.
|
|
24304
|
-
if (target instanceof ReadVariableExpr) {
|
|
24305
|
-
return twoWayBindingSet(target, value);
|
|
24306
|
-
}
|
|
24307
|
-
throw new Error(`Unsupported expression in two-way action binding.`);
|
|
24308
|
-
}, VisitorContextFlag.InChildOperation);
|
|
24309
|
-
}
|
|
24310
|
-
}
|
|
24311
|
-
}
|
|
24312
|
-
}
|
|
24313
|
-
|
|
24314
24539
|
/**
|
|
24315
24540
|
* When inside of a listener, we may need access to one or more enclosing views. Therefore, each
|
|
24316
24541
|
* view should save the current view, and each listener must have the ability to restore the
|
|
@@ -24420,6 +24645,40 @@ function allocateSlots(job) {
|
|
|
24420
24645
|
}
|
|
24421
24646
|
}
|
|
24422
24647
|
|
|
24648
|
+
/*!
|
|
24649
|
+
* @license
|
|
24650
|
+
* Copyright Google LLC All Rights Reserved.
|
|
24651
|
+
*
|
|
24652
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
24653
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
24654
|
+
*/
|
|
24655
|
+
/**
|
|
24656
|
+
* Removes any `storeLet` calls that aren't referenced outside of the current view.
|
|
24657
|
+
*/
|
|
24658
|
+
function optimizeStoreLet(job) {
|
|
24659
|
+
const letUsedExternally = new Set();
|
|
24660
|
+
// Since `@let` declarations can be referenced in child views, both in
|
|
24661
|
+
// the creation block (via listeners) and in the update block, we have
|
|
24662
|
+
// to look through all the ops to find the references.
|
|
24663
|
+
for (const unit of job.units) {
|
|
24664
|
+
for (const op of unit.ops()) {
|
|
24665
|
+
visitExpressionsInOp(op, (expr) => {
|
|
24666
|
+
if (expr instanceof ContextLetReferenceExpr) {
|
|
24667
|
+
letUsedExternally.add(expr.target);
|
|
24668
|
+
}
|
|
24669
|
+
});
|
|
24670
|
+
}
|
|
24671
|
+
}
|
|
24672
|
+
// TODO(crisbeto): potentially remove the unused calls completely, pending discussion.
|
|
24673
|
+
for (const unit of job.units) {
|
|
24674
|
+
for (const op of unit.update) {
|
|
24675
|
+
transformExpressionsInOp(op, (expression) => expression instanceof StoreLetExpr && !letUsedExternally.has(expression.target)
|
|
24676
|
+
? expression.value
|
|
24677
|
+
: expression, VisitorContextFlag.None);
|
|
24678
|
+
}
|
|
24679
|
+
}
|
|
24680
|
+
}
|
|
24681
|
+
|
|
24423
24682
|
/**
|
|
24424
24683
|
* Transforms special-case bindings with 'style' or 'class' in their names. Must run before the
|
|
24425
24684
|
* main binding specialization pass.
|
|
@@ -24647,6 +24906,39 @@ function generateTrackVariables(job) {
|
|
|
24647
24906
|
}
|
|
24648
24907
|
}
|
|
24649
24908
|
|
|
24909
|
+
/**
|
|
24910
|
+
* Transforms a `TwoWayBindingSet` expression into an expression that either
|
|
24911
|
+
* sets a value through the `twoWayBindingSet` instruction or falls back to setting
|
|
24912
|
+
* the value directly. E.g. the expression `TwoWayBindingSet(target, value)` becomes:
|
|
24913
|
+
* `ng.twoWayBindingSet(target, value) || (target = value)`.
|
|
24914
|
+
*/
|
|
24915
|
+
function transformTwoWayBindingSet(job) {
|
|
24916
|
+
for (const unit of job.units) {
|
|
24917
|
+
for (const op of unit.create) {
|
|
24918
|
+
if (op.kind === OpKind.TwoWayListener) {
|
|
24919
|
+
transformExpressionsInOp(op, (expr) => {
|
|
24920
|
+
if (!(expr instanceof TwoWayBindingSetExpr)) {
|
|
24921
|
+
return expr;
|
|
24922
|
+
}
|
|
24923
|
+
const { target, value } = expr;
|
|
24924
|
+
if (target instanceof ReadPropExpr || target instanceof ReadKeyExpr) {
|
|
24925
|
+
return twoWayBindingSet(target, value).or(target.set(value));
|
|
24926
|
+
}
|
|
24927
|
+
// ASSUMPTION: here we're assuming that `ReadVariableExpr` will be a reference
|
|
24928
|
+
// to a local template variable. This appears to be the case at the time of writing.
|
|
24929
|
+
// If the expression is targeting a variable read, we only emit the `twoWayBindingSet`
|
|
24930
|
+
// since the fallback would be attempting to write into a constant. Invalid usages will be
|
|
24931
|
+
// flagged during template type checking.
|
|
24932
|
+
if (target instanceof ReadVariableExpr) {
|
|
24933
|
+
return twoWayBindingSet(target, value);
|
|
24934
|
+
}
|
|
24935
|
+
throw new Error(`Unsupported expression in two-way action binding.`);
|
|
24936
|
+
}, VisitorContextFlag.InChildOperation);
|
|
24937
|
+
}
|
|
24938
|
+
}
|
|
24939
|
+
}
|
|
24940
|
+
}
|
|
24941
|
+
|
|
24650
24942
|
/**
|
|
24651
24943
|
* Counts the number of variable slots used within each view, and stores that on the view itself, as
|
|
24652
24944
|
* well as propagates it to the `ir.TemplateOp` for embedded views.
|
|
@@ -25246,115 +25538,6 @@ function wrapI18nIcus(job) {
|
|
|
25246
25538
|
}
|
|
25247
25539
|
}
|
|
25248
25540
|
|
|
25249
|
-
/*!
|
|
25250
|
-
* @license
|
|
25251
|
-
* Copyright Google LLC All Rights Reserved.
|
|
25252
|
-
*
|
|
25253
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
25254
|
-
* found in the LICENSE file at https://angular.dev/license
|
|
25255
|
-
*/
|
|
25256
|
-
/**
|
|
25257
|
-
* Removes any `storeLet` calls that aren't referenced outside of the current view.
|
|
25258
|
-
*/
|
|
25259
|
-
function optimizeStoreLet(job) {
|
|
25260
|
-
const letUsedExternally = new Set();
|
|
25261
|
-
// Since `@let` declarations can be referenced in child views, both in
|
|
25262
|
-
// the creation block (via listeners) and in the update block, we have
|
|
25263
|
-
// to look through all the ops to find the references.
|
|
25264
|
-
for (const unit of job.units) {
|
|
25265
|
-
for (const op of unit.ops()) {
|
|
25266
|
-
visitExpressionsInOp(op, (expr) => {
|
|
25267
|
-
if (expr instanceof ContextLetReferenceExpr) {
|
|
25268
|
-
letUsedExternally.add(expr.target);
|
|
25269
|
-
}
|
|
25270
|
-
});
|
|
25271
|
-
}
|
|
25272
|
-
}
|
|
25273
|
-
// TODO(crisbeto): potentially remove the unused calls completely, pending discussion.
|
|
25274
|
-
for (const unit of job.units) {
|
|
25275
|
-
for (const op of unit.update) {
|
|
25276
|
-
transformExpressionsInOp(op, (expression) => expression instanceof StoreLetExpr && !letUsedExternally.has(expression.target)
|
|
25277
|
-
? expression.value
|
|
25278
|
-
: expression, VisitorContextFlag.None);
|
|
25279
|
-
}
|
|
25280
|
-
}
|
|
25281
|
-
}
|
|
25282
|
-
|
|
25283
|
-
/**
|
|
25284
|
-
* It's not allowed to access a `@let` declaration before it has been defined. This is enforced
|
|
25285
|
-
* already via template type checking, however it can trip some of the assertions in the pipeline.
|
|
25286
|
-
* E.g. the naming phase can fail because we resolved the variable here, but the variable doesn't
|
|
25287
|
-
* exist anymore because the optimization phase removed it since it's invalid. To avoid surfacing
|
|
25288
|
-
* confusing errors to users in the case where template type checking isn't running (e.g. in JIT
|
|
25289
|
-
* mode) this phase detects illegal forward references and replaces them with `undefined`.
|
|
25290
|
-
* Eventually users will see the proper error from the template type checker.
|
|
25291
|
-
*/
|
|
25292
|
-
function removeIllegalLetReferences(job) {
|
|
25293
|
-
for (const unit of job.units) {
|
|
25294
|
-
for (const op of unit.update) {
|
|
25295
|
-
if (op.kind !== OpKind.Variable ||
|
|
25296
|
-
op.variable.kind !== SemanticVariableKind.Identifier ||
|
|
25297
|
-
!(op.initializer instanceof StoreLetExpr)) {
|
|
25298
|
-
continue;
|
|
25299
|
-
}
|
|
25300
|
-
const name = op.variable.identifier;
|
|
25301
|
-
let current = op;
|
|
25302
|
-
while (current && current.kind !== OpKind.ListEnd) {
|
|
25303
|
-
transformExpressionsInOp(current, (expr) => expr instanceof LexicalReadExpr && expr.name === name ? literal(undefined) : expr, VisitorContextFlag.None);
|
|
25304
|
-
current = current.prev;
|
|
25305
|
-
}
|
|
25306
|
-
}
|
|
25307
|
-
}
|
|
25308
|
-
}
|
|
25309
|
-
|
|
25310
|
-
/**
|
|
25311
|
-
* Replaces the `storeLet` ops with variables that can be
|
|
25312
|
-
* used to reference the value within the same view.
|
|
25313
|
-
*/
|
|
25314
|
-
function generateLocalLetReferences(job) {
|
|
25315
|
-
for (const unit of job.units) {
|
|
25316
|
-
for (const op of unit.update) {
|
|
25317
|
-
if (op.kind !== OpKind.StoreLet) {
|
|
25318
|
-
continue;
|
|
25319
|
-
}
|
|
25320
|
-
const variable = {
|
|
25321
|
-
kind: SemanticVariableKind.Identifier,
|
|
25322
|
-
name: null,
|
|
25323
|
-
identifier: op.declaredName,
|
|
25324
|
-
local: true,
|
|
25325
|
-
};
|
|
25326
|
-
OpList.replace(op, createVariableOp(job.allocateXrefId(), variable, new StoreLetExpr(op.target, op.value, op.sourceSpan), VariableFlags.None));
|
|
25327
|
-
}
|
|
25328
|
-
}
|
|
25329
|
-
}
|
|
25330
|
-
|
|
25331
|
-
/**
|
|
25332
|
-
* Locates all of the elements defined in a creation block and outputs an op
|
|
25333
|
-
* that will expose their definition location in the DOM.
|
|
25334
|
-
*/
|
|
25335
|
-
function attachSourceLocations(job) {
|
|
25336
|
-
if (!job.enableDebugLocations || job.relativeTemplatePath === null) {
|
|
25337
|
-
return;
|
|
25338
|
-
}
|
|
25339
|
-
for (const unit of job.units) {
|
|
25340
|
-
const locations = [];
|
|
25341
|
-
for (const op of unit.create) {
|
|
25342
|
-
if (op.kind === OpKind.ElementStart || op.kind === OpKind.Element) {
|
|
25343
|
-
const start = op.startSourceSpan.start;
|
|
25344
|
-
locations.push({
|
|
25345
|
-
targetSlot: op.handle,
|
|
25346
|
-
offset: start.offset,
|
|
25347
|
-
line: start.line,
|
|
25348
|
-
column: start.col,
|
|
25349
|
-
});
|
|
25350
|
-
}
|
|
25351
|
-
}
|
|
25352
|
-
if (locations.length > 0) {
|
|
25353
|
-
unit.create.push(createSourceLocationOp(job.relativeTemplatePath, locations));
|
|
25354
|
-
}
|
|
25355
|
-
}
|
|
25356
|
-
}
|
|
25357
|
-
|
|
25358
25541
|
/**
|
|
25359
25542
|
*
|
|
25360
25543
|
* @license
|
|
@@ -25403,8 +25586,8 @@ const phases = [
|
|
|
25403
25586
|
{ kind: CompilationJobKind.Both, fn: resolveContexts },
|
|
25404
25587
|
{ kind: CompilationJobKind.Both, fn: resolveSanitizers },
|
|
25405
25588
|
{ kind: CompilationJobKind.Tmpl, fn: liftLocalRefs },
|
|
25406
|
-
{ kind: CompilationJobKind.Both, fn: generateNullishCoalesceExpressions },
|
|
25407
25589
|
{ kind: CompilationJobKind.Both, fn: expandSafeReads },
|
|
25590
|
+
{ kind: CompilationJobKind.Both, fn: requiredParentheses },
|
|
25408
25591
|
{ kind: CompilationJobKind.Both, fn: generateTemporaryVariables },
|
|
25409
25592
|
{ kind: CompilationJobKind.Both, fn: optimizeVariables },
|
|
25410
25593
|
{ kind: CompilationJobKind.Both, fn: optimizeStoreLet },
|
|
@@ -26194,15 +26377,24 @@ function convertAst(ast, job, baseSourceSpan) {
|
|
|
26194
26377
|
else if (ast instanceof TypeofExpression) {
|
|
26195
26378
|
return typeofExpr(convertAst(ast.expression, job, baseSourceSpan));
|
|
26196
26379
|
}
|
|
26380
|
+
else if (ast instanceof VoidExpression) {
|
|
26381
|
+
return new VoidExpr(convertAst(ast.expression, job, baseSourceSpan), undefined, convertSourceSpan(ast.span, baseSourceSpan));
|
|
26382
|
+
}
|
|
26197
26383
|
else if (ast instanceof TemplateLiteral) {
|
|
26198
|
-
return
|
|
26199
|
-
|
|
26200
|
-
|
|
26384
|
+
return convertTemplateLiteral(ast, job, baseSourceSpan);
|
|
26385
|
+
}
|
|
26386
|
+
else if (ast instanceof TaggedTemplateLiteral) {
|
|
26387
|
+
return new TaggedTemplateLiteralExpr(convertAst(ast.tag, job, baseSourceSpan), convertTemplateLiteral(ast.template, job, baseSourceSpan), undefined, convertSourceSpan(ast.span, baseSourceSpan));
|
|
26201
26388
|
}
|
|
26202
26389
|
else {
|
|
26203
26390
|
throw new Error(`Unhandled expression type "${ast.constructor.name}" in file "${baseSourceSpan?.start.file.url}"`);
|
|
26204
26391
|
}
|
|
26205
26392
|
}
|
|
26393
|
+
function convertTemplateLiteral(ast, job, baseSourceSpan) {
|
|
26394
|
+
return new TemplateLiteralExpr(ast.elements.map((el) => {
|
|
26395
|
+
return new TemplateLiteralElementExpr(el.text, convertSourceSpan(el.span, baseSourceSpan));
|
|
26396
|
+
}), ast.expressions.map((expr) => convertAst(expr, job, baseSourceSpan)), convertSourceSpan(ast.span, baseSourceSpan));
|
|
26397
|
+
}
|
|
26206
26398
|
function convertAstWithInterpolation(job, value, i18nMeta, sourceSpan) {
|
|
26207
26399
|
let expression;
|
|
26208
26400
|
if (value instanceof Interpolation$1) {
|
|
@@ -26600,7 +26792,7 @@ function getTemplateSourceLocationsEnabled() {
|
|
|
26600
26792
|
|
|
26601
26793
|
// if (rf & flags) { .. }
|
|
26602
26794
|
function renderFlagCheckIfStmt(flags, statements) {
|
|
26603
|
-
return ifStmt(variable(RENDER_FLAGS).bitwiseAnd(literal(flags), null
|
|
26795
|
+
return ifStmt(variable(RENDER_FLAGS).bitwiseAnd(literal(flags), null), statements);
|
|
26604
26796
|
}
|
|
26605
26797
|
/**
|
|
26606
26798
|
* Translates query flags into `TQueryFlags` type in
|
|
@@ -31029,13 +31221,6 @@ function publishFacade(global) {
|
|
|
31029
31221
|
ng.ɵcompilerFacade = new CompilerFacadeImpl();
|
|
31030
31222
|
}
|
|
31031
31223
|
|
|
31032
|
-
/**
|
|
31033
|
-
* @module
|
|
31034
|
-
* @description
|
|
31035
|
-
* Entry point for all public APIs of the compiler package.
|
|
31036
|
-
*/
|
|
31037
|
-
const VERSION = new Version('19.2.1');
|
|
31038
|
-
|
|
31039
31224
|
class CompilerConfig {
|
|
31040
31225
|
defaultEncapsulation;
|
|
31041
31226
|
preserveWhitespaces;
|
|
@@ -32750,143 +32935,6 @@ function compileComponentMetadataAsyncResolver(dependencies) {
|
|
|
32750
32935
|
return arrowFn([], literalArr(dynamicImports));
|
|
32751
32936
|
}
|
|
32752
32937
|
|
|
32753
|
-
/**
|
|
32754
|
-
* Generate an ngDevMode guarded call to setClassDebugInfo with the debug info about the class
|
|
32755
|
-
* (e.g., the file name in which the class is defined)
|
|
32756
|
-
*/
|
|
32757
|
-
function compileClassDebugInfo(debugInfo) {
|
|
32758
|
-
const debugInfoObject = {
|
|
32759
|
-
className: debugInfo.className,
|
|
32760
|
-
};
|
|
32761
|
-
// Include file path and line number only if the file relative path is calculated successfully.
|
|
32762
|
-
if (debugInfo.filePath) {
|
|
32763
|
-
debugInfoObject.filePath = debugInfo.filePath;
|
|
32764
|
-
debugInfoObject.lineNumber = debugInfo.lineNumber;
|
|
32765
|
-
}
|
|
32766
|
-
// Include forbidOrphanRendering only if it's set to true (to reduce generated code)
|
|
32767
|
-
if (debugInfo.forbidOrphanRendering) {
|
|
32768
|
-
debugInfoObject.forbidOrphanRendering = literal(true);
|
|
32769
|
-
}
|
|
32770
|
-
const fnCall = importExpr(Identifiers.setClassDebugInfo)
|
|
32771
|
-
.callFn([debugInfo.type, mapLiteral(debugInfoObject)]);
|
|
32772
|
-
const iife = arrowFn([], [devOnlyGuardedExpression(fnCall).toStmt()]);
|
|
32773
|
-
return iife.callFn([]);
|
|
32774
|
-
}
|
|
32775
|
-
|
|
32776
|
-
/*!
|
|
32777
|
-
* @license
|
|
32778
|
-
* Copyright Google LLC All Rights Reserved.
|
|
32779
|
-
*
|
|
32780
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
32781
|
-
* found in the LICENSE file at https://angular.dev/license
|
|
32782
|
-
*/
|
|
32783
|
-
/**
|
|
32784
|
-
* Compiles the expression that initializes HMR for a class.
|
|
32785
|
-
* @param meta HMR metadata extracted from the class.
|
|
32786
|
-
*/
|
|
32787
|
-
function compileHmrInitializer(meta) {
|
|
32788
|
-
const moduleName = 'm';
|
|
32789
|
-
const dataName = 'd';
|
|
32790
|
-
const timestampName = 't';
|
|
32791
|
-
const idName = 'id';
|
|
32792
|
-
const importCallbackName = `${meta.className}_HmrLoad`;
|
|
32793
|
-
const namespaces = meta.namespaceDependencies.map((dep) => {
|
|
32794
|
-
return new ExternalExpr({ moduleName: dep.moduleName, name: null });
|
|
32795
|
-
});
|
|
32796
|
-
// m.default
|
|
32797
|
-
const defaultRead = variable(moduleName).prop('default');
|
|
32798
|
-
// ɵɵreplaceMetadata(Comp, m.default, [...namespaces], [...locals], import.meta, id);
|
|
32799
|
-
const replaceCall = importExpr(Identifiers.replaceMetadata)
|
|
32800
|
-
.callFn([
|
|
32801
|
-
meta.type,
|
|
32802
|
-
defaultRead,
|
|
32803
|
-
literalArr(namespaces),
|
|
32804
|
-
literalArr(meta.localDependencies.map((l) => l.runtimeRepresentation)),
|
|
32805
|
-
variable('import').prop('meta'),
|
|
32806
|
-
variable(idName),
|
|
32807
|
-
]);
|
|
32808
|
-
// (m) => m.default && ɵɵreplaceMetadata(...)
|
|
32809
|
-
const replaceCallback = arrowFn([new FnParam(moduleName)], defaultRead.and(replaceCall));
|
|
32810
|
-
// '<url>?c=' + id + '&t=' + encodeURIComponent(t)
|
|
32811
|
-
const urlValue = literal(`./@ng/component?c=`)
|
|
32812
|
-
.plus(variable(idName))
|
|
32813
|
-
.plus(literal('&t='))
|
|
32814
|
-
.plus(variable('encodeURIComponent').callFn([variable(timestampName)]));
|
|
32815
|
-
// import.meta.url
|
|
32816
|
-
const urlBase = variable('import').prop('meta').prop('url');
|
|
32817
|
-
// new URL(urlValue, urlBase).href
|
|
32818
|
-
const urlHref = new InstantiateExpr(variable('URL'), [urlValue, urlBase]).prop('href');
|
|
32819
|
-
// function Cmp_HmrLoad(t) {
|
|
32820
|
-
// import(/* @vite-ignore */ urlHref).then((m) => m.default && replaceMetadata(...));
|
|
32821
|
-
// }
|
|
32822
|
-
const importCallback = new DeclareFunctionStmt(importCallbackName, [new FnParam(timestampName)], [
|
|
32823
|
-
// The vite-ignore special comment is required to prevent Vite from generating a superfluous
|
|
32824
|
-
// warning for each usage within the development code. If Vite provides a method to
|
|
32825
|
-
// programmatically avoid this warning in the future, this added comment can be removed here.
|
|
32826
|
-
new DynamicImportExpr(urlHref, null, '@vite-ignore')
|
|
32827
|
-
.prop('then')
|
|
32828
|
-
.callFn([replaceCallback])
|
|
32829
|
-
.toStmt(),
|
|
32830
|
-
], null, StmtModifier.Final);
|
|
32831
|
-
// (d) => d.id === id && Cmp_HmrLoad(d.timestamp)
|
|
32832
|
-
const updateCallback = arrowFn([new FnParam(dataName)], variable(dataName)
|
|
32833
|
-
.prop('id')
|
|
32834
|
-
.identical(variable(idName))
|
|
32835
|
-
.and(variable(importCallbackName).callFn([variable(dataName).prop('timestamp')])));
|
|
32836
|
-
// Cmp_HmrLoad(Date.now());
|
|
32837
|
-
// Initial call to kick off the loading in order to avoid edge cases with components
|
|
32838
|
-
// coming from lazy chunks that change before the chunk has loaded.
|
|
32839
|
-
const initialCall = variable(importCallbackName)
|
|
32840
|
-
.callFn([variable('Date').prop('now').callFn([])]);
|
|
32841
|
-
// import.meta.hot
|
|
32842
|
-
const hotRead = variable('import').prop('meta').prop('hot');
|
|
32843
|
-
// import.meta.hot.on('angular:component-update', () => ...);
|
|
32844
|
-
const hotListener = hotRead
|
|
32845
|
-
.clone()
|
|
32846
|
-
.prop('on')
|
|
32847
|
-
.callFn([literal('angular:component-update'), updateCallback]);
|
|
32848
|
-
return arrowFn([], [
|
|
32849
|
-
// const id = <id>;
|
|
32850
|
-
new DeclareVarStmt(idName, literal(encodeURIComponent(`${meta.filePath}@${meta.className}`)), null, StmtModifier.Final),
|
|
32851
|
-
// function Cmp_HmrLoad() {...}.
|
|
32852
|
-
importCallback,
|
|
32853
|
-
// ngDevMode && Cmp_HmrLoad(Date.now());
|
|
32854
|
-
devOnlyGuardedExpression(initialCall).toStmt(),
|
|
32855
|
-
// ngDevMode && import.meta.hot && import.meta.hot.on(...)
|
|
32856
|
-
devOnlyGuardedExpression(hotRead.and(hotListener)).toStmt(),
|
|
32857
|
-
])
|
|
32858
|
-
.callFn([]);
|
|
32859
|
-
}
|
|
32860
|
-
/**
|
|
32861
|
-
* Compiles the HMR update callback for a class.
|
|
32862
|
-
* @param definitions Compiled definitions for the class (e.g. `defineComponent` calls).
|
|
32863
|
-
* @param constantStatements Supporting constants statements that were generated alongside
|
|
32864
|
-
* the definition.
|
|
32865
|
-
* @param meta HMR metadata extracted from the class.
|
|
32866
|
-
*/
|
|
32867
|
-
function compileHmrUpdateCallback(definitions, constantStatements, meta) {
|
|
32868
|
-
const namespaces = 'ɵɵnamespaces';
|
|
32869
|
-
const params = [meta.className, namespaces].map((name) => new FnParam(name, DYNAMIC_TYPE));
|
|
32870
|
-
const body = [];
|
|
32871
|
-
for (const local of meta.localDependencies) {
|
|
32872
|
-
params.push(new FnParam(local.name));
|
|
32873
|
-
}
|
|
32874
|
-
// Declare variables that read out the individual namespaces.
|
|
32875
|
-
for (let i = 0; i < meta.namespaceDependencies.length; i++) {
|
|
32876
|
-
body.push(new DeclareVarStmt(meta.namespaceDependencies[i].assignedName, variable(namespaces).key(literal(i)), DYNAMIC_TYPE, StmtModifier.Final));
|
|
32877
|
-
}
|
|
32878
|
-
body.push(...constantStatements);
|
|
32879
|
-
for (const field of definitions) {
|
|
32880
|
-
if (field.initializer !== null) {
|
|
32881
|
-
body.push(variable(meta.className).prop(field.name).set(field.initializer).toStmt());
|
|
32882
|
-
for (const stmt of field.statements) {
|
|
32883
|
-
body.push(stmt);
|
|
32884
|
-
}
|
|
32885
|
-
}
|
|
32886
|
-
}
|
|
32887
|
-
return new DeclareFunctionStmt(`${meta.className}_UpdateMetadata`, params, body, null, StmtModifier.Final);
|
|
32888
|
-
}
|
|
32889
|
-
|
|
32890
32938
|
/**
|
|
32891
32939
|
* Every time we make a breaking change to the declaration interface or partial-linker behavior, we
|
|
32892
32940
|
* must update this constant to prevent old partial-linkers from incorrectly processing the
|
|
@@ -32902,7 +32950,7 @@ const MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION = '18.0.0';
|
|
|
32902
32950
|
function compileDeclareClassMetadata(metadata) {
|
|
32903
32951
|
const definitionMap = new DefinitionMap();
|
|
32904
32952
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
|
|
32905
|
-
definitionMap.set('version', literal('
|
|
32953
|
+
definitionMap.set('version', literal('20.0.0-next.1'));
|
|
32906
32954
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
32907
32955
|
definitionMap.set('type', metadata.type);
|
|
32908
32956
|
definitionMap.set('decorators', metadata.decorators);
|
|
@@ -32920,7 +32968,7 @@ function compileComponentDeclareClassMetadata(metadata, dependencies) {
|
|
|
32920
32968
|
callbackReturnDefinitionMap.set('ctorParameters', metadata.ctorParameters ?? literal(null));
|
|
32921
32969
|
callbackReturnDefinitionMap.set('propDecorators', metadata.propDecorators ?? literal(null));
|
|
32922
32970
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION));
|
|
32923
|
-
definitionMap.set('version', literal('
|
|
32971
|
+
definitionMap.set('version', literal('20.0.0-next.1'));
|
|
32924
32972
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
32925
32973
|
definitionMap.set('type', metadata.type);
|
|
32926
32974
|
definitionMap.set('resolveDeferredDeps', compileComponentMetadataAsyncResolver(dependencies));
|
|
@@ -33015,7 +33063,7 @@ function createDirectiveDefinitionMap(meta) {
|
|
|
33015
33063
|
const definitionMap = new DefinitionMap();
|
|
33016
33064
|
const minVersion = getMinimumVersionForPartialOutput(meta);
|
|
33017
33065
|
definitionMap.set('minVersion', literal(minVersion));
|
|
33018
|
-
definitionMap.set('version', literal('
|
|
33066
|
+
definitionMap.set('version', literal('20.0.0-next.1'));
|
|
33019
33067
|
// e.g. `type: MyDirective`
|
|
33020
33068
|
definitionMap.set('type', meta.type.value);
|
|
33021
33069
|
if (meta.isStandalone !== undefined) {
|
|
@@ -33434,7 +33482,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
|
|
|
33434
33482
|
function compileDeclareFactoryFunction(meta) {
|
|
33435
33483
|
const definitionMap = new DefinitionMap();
|
|
33436
33484
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
|
|
33437
|
-
definitionMap.set('version', literal('
|
|
33485
|
+
definitionMap.set('version', literal('20.0.0-next.1'));
|
|
33438
33486
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33439
33487
|
definitionMap.set('type', meta.type.value);
|
|
33440
33488
|
definitionMap.set('deps', compileDependencies(meta.deps));
|
|
@@ -33469,7 +33517,7 @@ function compileDeclareInjectableFromMetadata(meta) {
|
|
|
33469
33517
|
function createInjectableDefinitionMap(meta) {
|
|
33470
33518
|
const definitionMap = new DefinitionMap();
|
|
33471
33519
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
|
|
33472
|
-
definitionMap.set('version', literal('
|
|
33520
|
+
definitionMap.set('version', literal('20.0.0-next.1'));
|
|
33473
33521
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33474
33522
|
definitionMap.set('type', meta.type.value);
|
|
33475
33523
|
// Only generate providedIn property if it has a non-null value
|
|
@@ -33520,7 +33568,7 @@ function compileDeclareInjectorFromMetadata(meta) {
|
|
|
33520
33568
|
function createInjectorDefinitionMap(meta) {
|
|
33521
33569
|
const definitionMap = new DefinitionMap();
|
|
33522
33570
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
|
|
33523
|
-
definitionMap.set('version', literal('
|
|
33571
|
+
definitionMap.set('version', literal('20.0.0-next.1'));
|
|
33524
33572
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33525
33573
|
definitionMap.set('type', meta.type.value);
|
|
33526
33574
|
definitionMap.set('providers', meta.providers);
|
|
@@ -33553,7 +33601,7 @@ function createNgModuleDefinitionMap(meta) {
|
|
|
33553
33601
|
throw new Error('Invalid path! Local compilation mode should not get into the partial compilation path');
|
|
33554
33602
|
}
|
|
33555
33603
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
|
|
33556
|
-
definitionMap.set('version', literal('
|
|
33604
|
+
definitionMap.set('version', literal('20.0.0-next.1'));
|
|
33557
33605
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33558
33606
|
definitionMap.set('type', meta.type.value);
|
|
33559
33607
|
// We only generate the keys in the metadata if the arrays contain values.
|
|
@@ -33604,7 +33652,7 @@ function compileDeclarePipeFromMetadata(meta) {
|
|
|
33604
33652
|
function createPipeDefinitionMap(meta) {
|
|
33605
33653
|
const definitionMap = new DefinitionMap();
|
|
33606
33654
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
|
|
33607
|
-
definitionMap.set('version', literal('
|
|
33655
|
+
definitionMap.set('version', literal('20.0.0-next.1'));
|
|
33608
33656
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33609
33657
|
// e.g. `type: MyPipe`
|
|
33610
33658
|
definitionMap.set('type', meta.type.value);
|
|
@@ -33620,6 +33668,150 @@ function createPipeDefinitionMap(meta) {
|
|
|
33620
33668
|
return definitionMap;
|
|
33621
33669
|
}
|
|
33622
33670
|
|
|
33671
|
+
/**
|
|
33672
|
+
* Generate an ngDevMode guarded call to setClassDebugInfo with the debug info about the class
|
|
33673
|
+
* (e.g., the file name in which the class is defined)
|
|
33674
|
+
*/
|
|
33675
|
+
function compileClassDebugInfo(debugInfo) {
|
|
33676
|
+
const debugInfoObject = {
|
|
33677
|
+
className: debugInfo.className,
|
|
33678
|
+
};
|
|
33679
|
+
// Include file path and line number only if the file relative path is calculated successfully.
|
|
33680
|
+
if (debugInfo.filePath) {
|
|
33681
|
+
debugInfoObject.filePath = debugInfo.filePath;
|
|
33682
|
+
debugInfoObject.lineNumber = debugInfo.lineNumber;
|
|
33683
|
+
}
|
|
33684
|
+
// Include forbidOrphanRendering only if it's set to true (to reduce generated code)
|
|
33685
|
+
if (debugInfo.forbidOrphanRendering) {
|
|
33686
|
+
debugInfoObject.forbidOrphanRendering = literal(true);
|
|
33687
|
+
}
|
|
33688
|
+
const fnCall = importExpr(Identifiers.setClassDebugInfo)
|
|
33689
|
+
.callFn([debugInfo.type, mapLiteral(debugInfoObject)]);
|
|
33690
|
+
const iife = arrowFn([], [devOnlyGuardedExpression(fnCall).toStmt()]);
|
|
33691
|
+
return iife.callFn([]);
|
|
33692
|
+
}
|
|
33693
|
+
|
|
33694
|
+
/*!
|
|
33695
|
+
* @license
|
|
33696
|
+
* Copyright Google LLC All Rights Reserved.
|
|
33697
|
+
*
|
|
33698
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
33699
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
33700
|
+
*/
|
|
33701
|
+
/**
|
|
33702
|
+
* Compiles the expression that initializes HMR for a class.
|
|
33703
|
+
* @param meta HMR metadata extracted from the class.
|
|
33704
|
+
*/
|
|
33705
|
+
function compileHmrInitializer(meta) {
|
|
33706
|
+
const moduleName = 'm';
|
|
33707
|
+
const dataName = 'd';
|
|
33708
|
+
const timestampName = 't';
|
|
33709
|
+
const idName = 'id';
|
|
33710
|
+
const importCallbackName = `${meta.className}_HmrLoad`;
|
|
33711
|
+
const namespaces = meta.namespaceDependencies.map((dep) => {
|
|
33712
|
+
return new ExternalExpr({ moduleName: dep.moduleName, name: null });
|
|
33713
|
+
});
|
|
33714
|
+
// m.default
|
|
33715
|
+
const defaultRead = variable(moduleName).prop('default');
|
|
33716
|
+
// ɵɵreplaceMetadata(Comp, m.default, [...namespaces], [...locals], import.meta, id);
|
|
33717
|
+
const replaceCall = importExpr(Identifiers.replaceMetadata)
|
|
33718
|
+
.callFn([
|
|
33719
|
+
meta.type,
|
|
33720
|
+
defaultRead,
|
|
33721
|
+
literalArr(namespaces),
|
|
33722
|
+
literalArr(meta.localDependencies.map((l) => l.runtimeRepresentation)),
|
|
33723
|
+
variable('import').prop('meta'),
|
|
33724
|
+
variable(idName),
|
|
33725
|
+
]);
|
|
33726
|
+
// (m) => m.default && ɵɵreplaceMetadata(...)
|
|
33727
|
+
const replaceCallback = arrowFn([new FnParam(moduleName)], defaultRead.and(replaceCall));
|
|
33728
|
+
// '<url>?c=' + id + '&t=' + encodeURIComponent(t)
|
|
33729
|
+
const urlValue = literal(`./@ng/component?c=`)
|
|
33730
|
+
.plus(variable(idName))
|
|
33731
|
+
.plus(literal('&t='))
|
|
33732
|
+
.plus(variable('encodeURIComponent').callFn([variable(timestampName)]));
|
|
33733
|
+
// import.meta.url
|
|
33734
|
+
const urlBase = variable('import').prop('meta').prop('url');
|
|
33735
|
+
// new URL(urlValue, urlBase).href
|
|
33736
|
+
const urlHref = new InstantiateExpr(variable('URL'), [urlValue, urlBase]).prop('href');
|
|
33737
|
+
// function Cmp_HmrLoad(t) {
|
|
33738
|
+
// import(/* @vite-ignore */ urlHref).then((m) => m.default && replaceMetadata(...));
|
|
33739
|
+
// }
|
|
33740
|
+
const importCallback = new DeclareFunctionStmt(importCallbackName, [new FnParam(timestampName)], [
|
|
33741
|
+
// The vite-ignore special comment is required to prevent Vite from generating a superfluous
|
|
33742
|
+
// warning for each usage within the development code. If Vite provides a method to
|
|
33743
|
+
// programmatically avoid this warning in the future, this added comment can be removed here.
|
|
33744
|
+
new DynamicImportExpr(urlHref, null, '@vite-ignore')
|
|
33745
|
+
.prop('then')
|
|
33746
|
+
.callFn([replaceCallback])
|
|
33747
|
+
.toStmt(),
|
|
33748
|
+
], null, StmtModifier.Final);
|
|
33749
|
+
// (d) => d.id === id && Cmp_HmrLoad(d.timestamp)
|
|
33750
|
+
const updateCallback = arrowFn([new FnParam(dataName)], variable(dataName)
|
|
33751
|
+
.prop('id')
|
|
33752
|
+
.identical(variable(idName))
|
|
33753
|
+
.and(variable(importCallbackName).callFn([variable(dataName).prop('timestamp')])));
|
|
33754
|
+
// Cmp_HmrLoad(Date.now());
|
|
33755
|
+
// Initial call to kick off the loading in order to avoid edge cases with components
|
|
33756
|
+
// coming from lazy chunks that change before the chunk has loaded.
|
|
33757
|
+
const initialCall = variable(importCallbackName)
|
|
33758
|
+
.callFn([variable('Date').prop('now').callFn([])]);
|
|
33759
|
+
// import.meta.hot
|
|
33760
|
+
const hotRead = variable('import').prop('meta').prop('hot');
|
|
33761
|
+
// import.meta.hot.on('angular:component-update', () => ...);
|
|
33762
|
+
const hotListener = hotRead
|
|
33763
|
+
.clone()
|
|
33764
|
+
.prop('on')
|
|
33765
|
+
.callFn([literal('angular:component-update'), updateCallback]);
|
|
33766
|
+
return arrowFn([], [
|
|
33767
|
+
// const id = <id>;
|
|
33768
|
+
new DeclareVarStmt(idName, literal(encodeURIComponent(`${meta.filePath}@${meta.className}`)), null, StmtModifier.Final),
|
|
33769
|
+
// function Cmp_HmrLoad() {...}.
|
|
33770
|
+
importCallback,
|
|
33771
|
+
// ngDevMode && Cmp_HmrLoad(Date.now());
|
|
33772
|
+
devOnlyGuardedExpression(initialCall).toStmt(),
|
|
33773
|
+
// ngDevMode && import.meta.hot && import.meta.hot.on(...)
|
|
33774
|
+
devOnlyGuardedExpression(hotRead.and(hotListener)).toStmt(),
|
|
33775
|
+
])
|
|
33776
|
+
.callFn([]);
|
|
33777
|
+
}
|
|
33778
|
+
/**
|
|
33779
|
+
* Compiles the HMR update callback for a class.
|
|
33780
|
+
* @param definitions Compiled definitions for the class (e.g. `defineComponent` calls).
|
|
33781
|
+
* @param constantStatements Supporting constants statements that were generated alongside
|
|
33782
|
+
* the definition.
|
|
33783
|
+
* @param meta HMR metadata extracted from the class.
|
|
33784
|
+
*/
|
|
33785
|
+
function compileHmrUpdateCallback(definitions, constantStatements, meta) {
|
|
33786
|
+
const namespaces = 'ɵɵnamespaces';
|
|
33787
|
+
const params = [meta.className, namespaces].map((name) => new FnParam(name, DYNAMIC_TYPE));
|
|
33788
|
+
const body = [];
|
|
33789
|
+
for (const local of meta.localDependencies) {
|
|
33790
|
+
params.push(new FnParam(local.name));
|
|
33791
|
+
}
|
|
33792
|
+
// Declare variables that read out the individual namespaces.
|
|
33793
|
+
for (let i = 0; i < meta.namespaceDependencies.length; i++) {
|
|
33794
|
+
body.push(new DeclareVarStmt(meta.namespaceDependencies[i].assignedName, variable(namespaces).key(literal(i)), DYNAMIC_TYPE, StmtModifier.Final));
|
|
33795
|
+
}
|
|
33796
|
+
body.push(...constantStatements);
|
|
33797
|
+
for (const field of definitions) {
|
|
33798
|
+
if (field.initializer !== null) {
|
|
33799
|
+
body.push(variable(meta.className).prop(field.name).set(field.initializer).toStmt());
|
|
33800
|
+
for (const stmt of field.statements) {
|
|
33801
|
+
body.push(stmt);
|
|
33802
|
+
}
|
|
33803
|
+
}
|
|
33804
|
+
}
|
|
33805
|
+
return new DeclareFunctionStmt(`${meta.className}_UpdateMetadata`, params, body, null, StmtModifier.Final);
|
|
33806
|
+
}
|
|
33807
|
+
|
|
33808
|
+
/**
|
|
33809
|
+
* @module
|
|
33810
|
+
* @description
|
|
33811
|
+
* Entry point for all public APIs of the compiler package.
|
|
33812
|
+
*/
|
|
33813
|
+
const VERSION = new Version('20.0.0-next.1');
|
|
33814
|
+
|
|
33623
33815
|
//////////////////////////////////////
|
|
33624
33816
|
// This file only reexports content of the `src` folder. Keep it that way.
|
|
33625
33817
|
// This function call has a global side effects and publishes the compiler into global namespace for
|
|
@@ -33637,5 +33829,5 @@ publishFacade(_global);
|
|
|
33637
33829
|
|
|
33638
33830
|
// This file is not used to build this module. It is only used during editing
|
|
33639
33831
|
|
|
33640
|
-
export { AST, ASTWithName, ASTWithSource, AbsoluteSourceSpan, ArrayType, ArrowFunctionExpr, Attribute, Binary, BinaryOperator, BinaryOperatorExpr, BindingPipe, BindingType, Block, BlockParameter, BoundElementProperty, BuiltinType, BuiltinTypeName, CUSTOM_ELEMENTS_SCHEMA, Call, Chain, ChangeDetectionStrategy, CommaExpr, Comment, CompilerConfig, Conditional, ConditionalExpr, ConstantPool, CssSelector, DEFAULT_INTERPOLATION_CONFIG, DYNAMIC_TYPE, DeclareFunctionStmt, DeclareVarStmt, DomElementSchemaRegistry, DynamicImportExpr, EOF, Element, ElementSchemaRegistry, EmitterVisitorContext, EmptyExpr$1 as EmptyExpr, Expansion, ExpansionCase, Expression, ExpressionBinding, ExpressionStatement, ExpressionType, ExternalExpr, ExternalReference, FactoryTarget$1 as FactoryTarget, FunctionExpr, HtmlParser, HtmlTagDefinition, I18NHtmlParser, IfStmt, ImplicitReceiver, InstantiateExpr, Interpolation$1 as Interpolation, InterpolationConfig, InvokeFunctionExpr, JSDocComment, JitEvaluator, KeyedRead, KeyedWrite, LeadingComment, LetDeclaration, Lexer, LiteralArray, LiteralArrayExpr, LiteralExpr, LiteralMap, LiteralMapExpr, LiteralPrimitive, LocalizedString, MapType, MessageBundle, NONE_TYPE, NO_ERRORS_SCHEMA, NodeWithI18n, NonNullAssert, NotExpr, ParseError, ParseErrorLevel, ParseLocation, ParseSourceFile, ParseSourceSpan, ParseSpan, ParseTreeResult, ParsedEvent, ParsedEventType, ParsedProperty, ParsedPropertyType, ParsedVariable, Parser, ParserError, PrefixNot, PropertyRead, PropertyWrite, R3BoundTarget, Identifiers as R3Identifiers, R3NgModuleMetadataKind, R3SelectorScopeMode, R3TargetBinder, R3TemplateDependencyKind, ReadKeyExpr, ReadPropExpr, ReadVarExpr, RecursiveAstVisitor, RecursiveVisitor, ResourceLoader, ReturnStatement, STRING_TYPE, SafeCall, SafeKeyedRead, SafePropertyRead, SelectorContext, SelectorListContext, SelectorMatcher, Serializer, SplitInterpolation, Statement, StmtModifier, StringToken, StringTokenKind, TagContentType, TaggedTemplateLiteralExpr, TemplateBindingParseResult, TemplateLiteral, TemplateLiteralElement, TemplateLiteralElementExpr, TemplateLiteralExpr, Text, ThisReceiver, BlockNode as TmplAstBlockNode, BoundAttribute as TmplAstBoundAttribute, BoundDeferredTrigger as TmplAstBoundDeferredTrigger, BoundEvent as TmplAstBoundEvent, BoundText as TmplAstBoundText, Content as TmplAstContent, DeferredBlock as TmplAstDeferredBlock, DeferredBlockError as TmplAstDeferredBlockError, DeferredBlockLoading as TmplAstDeferredBlockLoading, DeferredBlockPlaceholder as TmplAstDeferredBlockPlaceholder, DeferredTrigger as TmplAstDeferredTrigger, Element$1 as TmplAstElement, ForLoopBlock as TmplAstForLoopBlock, ForLoopBlockEmpty as TmplAstForLoopBlockEmpty, HoverDeferredTrigger as TmplAstHoverDeferredTrigger, Icu$1 as TmplAstIcu, IdleDeferredTrigger as TmplAstIdleDeferredTrigger, IfBlock as TmplAstIfBlock, IfBlockBranch as TmplAstIfBlockBranch, ImmediateDeferredTrigger as TmplAstImmediateDeferredTrigger, InteractionDeferredTrigger as TmplAstInteractionDeferredTrigger, LetDeclaration$1 as TmplAstLetDeclaration, NeverDeferredTrigger as TmplAstNeverDeferredTrigger, RecursiveVisitor$1 as TmplAstRecursiveVisitor, Reference as TmplAstReference, SwitchBlock as TmplAstSwitchBlock, SwitchBlockCase as TmplAstSwitchBlockCase, Template as TmplAstTemplate, Text$3 as TmplAstText, TextAttribute as TmplAstTextAttribute, TimerDeferredTrigger as TmplAstTimerDeferredTrigger, UnknownBlock as TmplAstUnknownBlock, Variable as TmplAstVariable, ViewportDeferredTrigger as TmplAstViewportDeferredTrigger, Token, TokenType, TransplantedType, TreeError, Type, TypeModifier, TypeofExpr, TypeofExpression, Unary, UnaryOperator, UnaryOperatorExpr, VERSION, VariableBinding, Version, ViewEncapsulation, WrappedNodeExpr, WriteKeyExpr, WritePropExpr, WriteVarExpr, Xliff, Xliff2, Xmb, XmlParser, Xtb, compileClassDebugInfo, compileClassMetadata, compileComponentClassMetadata, compileComponentDeclareClassMetadata, compileComponentFromMetadata, compileDeclareClassMetadata, compileDeclareComponentFromMetadata, compileDeclareDirectiveFromMetadata, compileDeclareFactoryFunction, compileDeclareInjectableFromMetadata, compileDeclareInjectorFromMetadata, compileDeclareNgModuleFromMetadata, compileDeclarePipeFromMetadata, compileDeferResolverFunction, compileDirectiveFromMetadata, compileFactoryFunction, compileHmrInitializer, compileHmrUpdateCallback, compileInjectable, compileInjector, compileNgModule, compileOpaqueAsyncClassMetadata, compilePipeFromMetadata, computeMsgId, core, createCssSelectorFromNode, createInjectableType, createMayBeForwardRefExpression, devOnlyGuardedExpression, emitDistinctChangesOnlyDefaultValue, encapsulateStyle, findMatchingDirectivesAndPipes, getHtmlTagDefinition, getNsPrefix, getSafePropertyAccessString, identifierName, isNgContainer, isNgContent, isNgTemplate, jsDocComment, leadingComment, literal, literalMap, makeBindingParser, mergeNsAndName, output_ast as outputAst, parseHostBindings, parseTemplate, preserveWhitespacesDefault, publishFacade, r3JitTypeSourceSpan, sanitizeIdentifier, splitNsName, visitAll$1 as tmplAstVisitAll, verifyHostBindings, visitAll };
|
|
33832
|
+
export { AST, ASTWithName, ASTWithSource, AbsoluteSourceSpan, ArrayType, ArrowFunctionExpr, Attribute, Binary, BinaryOperator, BinaryOperatorExpr, BindingPipe, BindingType, Block, BlockParameter, BoundElementProperty, BuiltinType, BuiltinTypeName, CUSTOM_ELEMENTS_SCHEMA, Call, Chain, ChangeDetectionStrategy, CommaExpr, Comment, CompilerConfig, Conditional, ConditionalExpr, ConstantPool, CssSelector, DEFAULT_INTERPOLATION_CONFIG, DYNAMIC_TYPE, DeclareFunctionStmt, DeclareVarStmt, DomElementSchemaRegistry, DynamicImportExpr, EOF, Element, ElementSchemaRegistry, EmitterVisitorContext, EmptyExpr$1 as EmptyExpr, Expansion, ExpansionCase, Expression, ExpressionBinding, ExpressionStatement, ExpressionType, ExternalExpr, ExternalReference, FactoryTarget$1 as FactoryTarget, FunctionExpr, HtmlParser, HtmlTagDefinition, I18NHtmlParser, IfStmt, ImplicitReceiver, InstantiateExpr, Interpolation$1 as Interpolation, InterpolationConfig, InvokeFunctionExpr, JSDocComment, JitEvaluator, KeyedRead, KeyedWrite, LeadingComment, LetDeclaration, Lexer, LiteralArray, LiteralArrayExpr, LiteralExpr, LiteralMap, LiteralMapExpr, LiteralPrimitive, LocalizedString, MapType, MessageBundle, NONE_TYPE, NO_ERRORS_SCHEMA, NodeWithI18n, NonNullAssert, NotExpr, ParenthesizedExpr, ParseError, ParseErrorLevel, ParseLocation, ParseSourceFile, ParseSourceSpan, ParseSpan, ParseTreeResult, ParsedEvent, ParsedEventType, ParsedProperty, ParsedPropertyType, ParsedVariable, Parser, ParserError, PrefixNot, PropertyRead, PropertyWrite, R3BoundTarget, Identifiers as R3Identifiers, R3NgModuleMetadataKind, R3SelectorScopeMode, R3TargetBinder, R3TemplateDependencyKind, ReadKeyExpr, ReadPropExpr, ReadVarExpr, RecursiveAstVisitor, RecursiveVisitor, ResourceLoader, ReturnStatement, STRING_TYPE, SafeCall, SafeKeyedRead, SafePropertyRead, SelectorContext, SelectorListContext, SelectorMatcher, Serializer, SplitInterpolation, Statement, StmtModifier, StringToken, StringTokenKind, TagContentType, TaggedTemplateLiteral, TaggedTemplateLiteralExpr, TemplateBindingParseResult, TemplateLiteral, TemplateLiteralElement, TemplateLiteralElementExpr, TemplateLiteralExpr, Text, ThisReceiver, BlockNode as TmplAstBlockNode, BoundAttribute as TmplAstBoundAttribute, BoundDeferredTrigger as TmplAstBoundDeferredTrigger, BoundEvent as TmplAstBoundEvent, BoundText as TmplAstBoundText, Content as TmplAstContent, DeferredBlock as TmplAstDeferredBlock, DeferredBlockError as TmplAstDeferredBlockError, DeferredBlockLoading as TmplAstDeferredBlockLoading, DeferredBlockPlaceholder as TmplAstDeferredBlockPlaceholder, DeferredTrigger as TmplAstDeferredTrigger, Element$1 as TmplAstElement, ForLoopBlock as TmplAstForLoopBlock, ForLoopBlockEmpty as TmplAstForLoopBlockEmpty, HoverDeferredTrigger as TmplAstHoverDeferredTrigger, Icu$1 as TmplAstIcu, IdleDeferredTrigger as TmplAstIdleDeferredTrigger, IfBlock as TmplAstIfBlock, IfBlockBranch as TmplAstIfBlockBranch, ImmediateDeferredTrigger as TmplAstImmediateDeferredTrigger, InteractionDeferredTrigger as TmplAstInteractionDeferredTrigger, LetDeclaration$1 as TmplAstLetDeclaration, NeverDeferredTrigger as TmplAstNeverDeferredTrigger, RecursiveVisitor$1 as TmplAstRecursiveVisitor, Reference as TmplAstReference, SwitchBlock as TmplAstSwitchBlock, SwitchBlockCase as TmplAstSwitchBlockCase, Template as TmplAstTemplate, Text$3 as TmplAstText, TextAttribute as TmplAstTextAttribute, TimerDeferredTrigger as TmplAstTimerDeferredTrigger, UnknownBlock as TmplAstUnknownBlock, Variable as TmplAstVariable, ViewportDeferredTrigger as TmplAstViewportDeferredTrigger, Token, TokenType, TransplantedType, TreeError, Type, TypeModifier, TypeofExpr, TypeofExpression, Unary, UnaryOperator, UnaryOperatorExpr, VERSION, VariableBinding, Version, ViewEncapsulation, VoidExpr, VoidExpression, WrappedNodeExpr, WriteKeyExpr, WritePropExpr, WriteVarExpr, Xliff, Xliff2, Xmb, XmlParser, Xtb, compileClassDebugInfo, compileClassMetadata, compileComponentClassMetadata, compileComponentDeclareClassMetadata, compileComponentFromMetadata, compileDeclareClassMetadata, compileDeclareComponentFromMetadata, compileDeclareDirectiveFromMetadata, compileDeclareFactoryFunction, compileDeclareInjectableFromMetadata, compileDeclareInjectorFromMetadata, compileDeclareNgModuleFromMetadata, compileDeclarePipeFromMetadata, compileDeferResolverFunction, compileDirectiveFromMetadata, compileFactoryFunction, compileHmrInitializer, compileHmrUpdateCallback, compileInjectable, compileInjector, compileNgModule, compileOpaqueAsyncClassMetadata, compilePipeFromMetadata, computeMsgId, core, createCssSelectorFromNode, createInjectableType, createMayBeForwardRefExpression, devOnlyGuardedExpression, emitDistinctChangesOnlyDefaultValue, encapsulateStyle, findMatchingDirectivesAndPipes, getHtmlTagDefinition, getNsPrefix, getSafePropertyAccessString, identifierName, isNgContainer, isNgContent, isNgTemplate, jsDocComment, leadingComment, literal, literalMap, makeBindingParser, mergeNsAndName, output_ast as outputAst, parseHostBindings, parseTemplate, preserveWhitespacesDefault, publishFacade, r3JitTypeSourceSpan, sanitizeIdentifier, splitNsName, visitAll$1 as tmplAstVisitAll, verifyHostBindings, visitAll };
|
|
33641
33833
|
//# sourceMappingURL=compiler.mjs.map
|