@wavemaker/angular-codegen 11.7.0-next.42251 → 11.7.0-rc.5525
Sign up to get free protection for your applications and to get access to all the features.
- angular-codegen/angular-app/angular.json +11 -1
- angular-codegen/angular-app/build-scripts/build.js +35 -0
- angular-codegen/angular-app/build-scripts/post-build.js +17 -11
- angular-codegen/angular-app/package-lock.json +4104 -2435
- angular-codegen/angular-app/package.json +27 -27
- angular-codegen/angular-app/src/app/lazy-load-scripts.resolve.ts +2 -4
- angular-codegen/angular-app/src/assets/print.css +32 -0
- angular-codegen/build-angular-app.js +5 -4
- angular-codegen/dependencies/expression-parser.cjs.js +2511 -592
- angular-codegen/dependencies/pipe-provider.cjs.js +30481 -17343
- angular-codegen/dependencies/transpilation-mobile.cjs.js +17422 -10709
- angular-codegen/dependencies/transpilation-web.cjs.js +17422 -10709
- angular-codegen/download-packages.js +8 -1
- angular-codegen/package-lock.json +3 -4367
- angular-codegen/package.json +1 -1
- angular-codegen/src/codegen.js +1 -1
- angular-codegen/src/handlebar-helpers.js +1 -1
- angular-codegen/templates/app-prefabs.module.ts.hbs +0 -1
- angular-codegen/templates/app-routes.ts.hbs +6 -5
- angular-codegen/templates/layout/layout.module.ts.hbs +1 -1
- angular-codegen/templates/page/page.module.ts.hbs +2 -2
- angular-codegen/templates/partial/partial.module.ts.hbs +0 -1
- angular-codegen/templates/prefab/prefab.module.ts.hbs +0 -1
@@ -1,7 +1,7 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
3
|
/**
|
4
|
-
* @license Angular
|
4
|
+
* @license Angular v16.2.12
|
5
5
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
6
6
|
* License: MIT
|
7
7
|
*/
|
@@ -500,7 +500,7 @@ class _SerializerIgnoreIcuExpVisitor extends _SerializerVisitor {
|
|
500
500
|
* DO NOT USE IT IN A SECURITY SENSITIVE CONTEXT.
|
501
501
|
*/
|
502
502
|
function sha1(str) {
|
503
|
-
textEncoder
|
503
|
+
textEncoder ??= new TextEncoder();
|
504
504
|
const utf8 = [...textEncoder.encode(str)];
|
505
505
|
const words32 = bytesToWords32(utf8, Endian.Big);
|
506
506
|
const len = utf8.length * 8;
|
@@ -566,7 +566,7 @@ function fk(index, b, c, d) {
|
|
566
566
|
* https://github.com/google/closure-compiler/blob/master/src/com/google/javascript/jscomp/GoogleJsMessageIdGenerator.java
|
567
567
|
*/
|
568
568
|
function fingerprint(str) {
|
569
|
-
textEncoder
|
569
|
+
textEncoder ??= new TextEncoder();
|
570
570
|
const utf8 = textEncoder.encode(str);
|
571
571
|
const view = new DataView(utf8.buffer, utf8.byteOffset, utf8.byteLength);
|
572
572
|
let hi = hash32(view, utf8.length, 0);
|
@@ -955,6 +955,9 @@ class ReadVarExpr extends Expression {
|
|
955
955
|
visitExpression(visitor, context) {
|
956
956
|
return visitor.visitReadVarExpr(this, context);
|
957
957
|
}
|
958
|
+
clone() {
|
959
|
+
return new ReadVarExpr(this.name, this.type, this.sourceSpan);
|
960
|
+
}
|
958
961
|
set(value) {
|
959
962
|
return new WriteVarExpr(this.name, value, null, this.sourceSpan);
|
960
963
|
}
|
@@ -973,6 +976,9 @@ class TypeofExpr extends Expression {
|
|
973
976
|
isConstant() {
|
974
977
|
return this.expr.isConstant();
|
975
978
|
}
|
979
|
+
clone() {
|
980
|
+
return new TypeofExpr(this.expr.clone());
|
981
|
+
}
|
976
982
|
}
|
977
983
|
class WrappedNodeExpr extends Expression {
|
978
984
|
constructor(node, type, sourceSpan) {
|
@@ -988,6 +994,9 @@ class WrappedNodeExpr extends Expression {
|
|
988
994
|
visitExpression(visitor, context) {
|
989
995
|
return visitor.visitWrappedNodeExpr(this, context);
|
990
996
|
}
|
997
|
+
clone() {
|
998
|
+
return new WrappedNodeExpr(this.node, this.type, this.sourceSpan);
|
999
|
+
}
|
991
1000
|
}
|
992
1001
|
class WriteVarExpr extends Expression {
|
993
1002
|
constructor(name, value, type, sourceSpan) {
|
@@ -1004,6 +1013,9 @@ class WriteVarExpr extends Expression {
|
|
1004
1013
|
visitExpression(visitor, context) {
|
1005
1014
|
return visitor.visitWriteVarExpr(this, context);
|
1006
1015
|
}
|
1016
|
+
clone() {
|
1017
|
+
return new WriteVarExpr(this.name, this.value.clone(), this.type, this.sourceSpan);
|
1018
|
+
}
|
1007
1019
|
toDeclStmt(type, modifiers) {
|
1008
1020
|
return new DeclareVarStmt(this.name, this.value, type, modifiers, this.sourceSpan);
|
1009
1021
|
}
|
@@ -1028,6 +1040,9 @@ class WriteKeyExpr extends Expression {
|
|
1028
1040
|
visitExpression(visitor, context) {
|
1029
1041
|
return visitor.visitWriteKeyExpr(this, context);
|
1030
1042
|
}
|
1043
|
+
clone() {
|
1044
|
+
return new WriteKeyExpr(this.receiver.clone(), this.index.clone(), this.value.clone(), this.type, this.sourceSpan);
|
1045
|
+
}
|
1031
1046
|
}
|
1032
1047
|
class WritePropExpr extends Expression {
|
1033
1048
|
constructor(receiver, name, value, type, sourceSpan) {
|
@@ -1046,6 +1061,9 @@ class WritePropExpr extends Expression {
|
|
1046
1061
|
visitExpression(visitor, context) {
|
1047
1062
|
return visitor.visitWritePropExpr(this, context);
|
1048
1063
|
}
|
1064
|
+
clone() {
|
1065
|
+
return new WritePropExpr(this.receiver.clone(), this.name, this.value.clone(), this.type, this.sourceSpan);
|
1066
|
+
}
|
1049
1067
|
}
|
1050
1068
|
class InvokeFunctionExpr extends Expression {
|
1051
1069
|
constructor(fn, args, type, sourceSpan, pure = false) {
|
@@ -1054,6 +1072,10 @@ class InvokeFunctionExpr extends Expression {
|
|
1054
1072
|
this.args = args;
|
1055
1073
|
this.pure = pure;
|
1056
1074
|
}
|
1075
|
+
// An alias for fn, which allows other logic to handle calls and property reads together.
|
1076
|
+
get receiver() {
|
1077
|
+
return this.fn;
|
1078
|
+
}
|
1057
1079
|
isEquivalent(e) {
|
1058
1080
|
return e instanceof InvokeFunctionExpr && this.fn.isEquivalent(e.fn) &&
|
1059
1081
|
areAllEquivalent(this.args, e.args) && this.pure === e.pure;
|
@@ -1064,6 +1086,9 @@ class InvokeFunctionExpr extends Expression {
|
|
1064
1086
|
visitExpression(visitor, context) {
|
1065
1087
|
return visitor.visitInvokeFunctionExpr(this, context);
|
1066
1088
|
}
|
1089
|
+
clone() {
|
1090
|
+
return new InvokeFunctionExpr(this.fn.clone(), this.args.map(arg => arg.clone()), this.type, this.sourceSpan, this.pure);
|
1091
|
+
}
|
1067
1092
|
}
|
1068
1093
|
class TaggedTemplateExpr extends Expression {
|
1069
1094
|
constructor(tag, template, type, sourceSpan) {
|
@@ -1082,6 +1107,9 @@ class TaggedTemplateExpr extends Expression {
|
|
1082
1107
|
visitExpression(visitor, context) {
|
1083
1108
|
return visitor.visitTaggedTemplateExpr(this, context);
|
1084
1109
|
}
|
1110
|
+
clone() {
|
1111
|
+
return new TaggedTemplateExpr(this.tag.clone(), this.template.clone(), this.type, this.sourceSpan);
|
1112
|
+
}
|
1085
1113
|
}
|
1086
1114
|
class InstantiateExpr extends Expression {
|
1087
1115
|
constructor(classExpr, args, type, sourceSpan) {
|
@@ -1099,6 +1127,9 @@ class InstantiateExpr extends Expression {
|
|
1099
1127
|
visitExpression(visitor, context) {
|
1100
1128
|
return visitor.visitInstantiateExpr(this, context);
|
1101
1129
|
}
|
1130
|
+
clone() {
|
1131
|
+
return new InstantiateExpr(this.classExpr.clone(), this.args.map(arg => arg.clone()), this.type, this.sourceSpan);
|
1132
|
+
}
|
1102
1133
|
}
|
1103
1134
|
class LiteralExpr extends Expression {
|
1104
1135
|
constructor(value, type, sourceSpan) {
|
@@ -1114,12 +1145,18 @@ class LiteralExpr extends Expression {
|
|
1114
1145
|
visitExpression(visitor, context) {
|
1115
1146
|
return visitor.visitLiteralExpr(this, context);
|
1116
1147
|
}
|
1148
|
+
clone() {
|
1149
|
+
return new LiteralExpr(this.value, this.type, this.sourceSpan);
|
1150
|
+
}
|
1117
1151
|
}
|
1118
1152
|
class TemplateLiteral {
|
1119
1153
|
constructor(elements, expressions) {
|
1120
1154
|
this.elements = elements;
|
1121
1155
|
this.expressions = expressions;
|
1122
1156
|
}
|
1157
|
+
clone() {
|
1158
|
+
return new TemplateLiteral(this.elements.map(el => el.clone()), this.expressions.map(expr => expr.clone()));
|
1159
|
+
}
|
1123
1160
|
}
|
1124
1161
|
class TemplateLiteralElement {
|
1125
1162
|
constructor(text, sourceSpan, rawText) {
|
@@ -1134,6 +1171,9 @@ class TemplateLiteralElement {
|
|
1134
1171
|
this.rawText =
|
1135
1172
|
rawText ?? sourceSpan?.toString() ?? escapeForTemplateLiteral(escapeSlashes(text));
|
1136
1173
|
}
|
1174
|
+
clone() {
|
1175
|
+
return new TemplateLiteralElement(this.text, this.sourceSpan, this.rawText);
|
1176
|
+
}
|
1137
1177
|
}
|
1138
1178
|
class LiteralPiece {
|
1139
1179
|
constructor(text, sourceSpan) {
|
@@ -1178,6 +1218,9 @@ class LocalizedString extends Expression {
|
|
1178
1218
|
visitExpression(visitor, context) {
|
1179
1219
|
return visitor.visitLocalizedString(this, context);
|
1180
1220
|
}
|
1221
|
+
clone() {
|
1222
|
+
return new LocalizedString(this.metaBlock, this.messageParts, this.placeHolderNames, this.expressions.map(expr => expr.clone()), this.sourceSpan);
|
1223
|
+
}
|
1181
1224
|
/**
|
1182
1225
|
* Serialize the given `meta` and `messagePart` into "cooked" and "raw" strings that can be used
|
1183
1226
|
* in a `$localize` tagged string. The format of the metadata is the same as that parsed by
|
@@ -1279,6 +1322,9 @@ class ExternalExpr extends Expression {
|
|
1279
1322
|
visitExpression(visitor, context) {
|
1280
1323
|
return visitor.visitExternalExpr(this, context);
|
1281
1324
|
}
|
1325
|
+
clone() {
|
1326
|
+
return new ExternalExpr(this.value, this.type, this.typeParams, this.sourceSpan);
|
1327
|
+
}
|
1282
1328
|
}
|
1283
1329
|
class ConditionalExpr extends Expression {
|
1284
1330
|
constructor(condition, trueCase, falseCase = null, type, sourceSpan) {
|
@@ -1297,6 +1343,27 @@ class ConditionalExpr extends Expression {
|
|
1297
1343
|
visitExpression(visitor, context) {
|
1298
1344
|
return visitor.visitConditionalExpr(this, context);
|
1299
1345
|
}
|
1346
|
+
clone() {
|
1347
|
+
return new ConditionalExpr(this.condition.clone(), this.trueCase.clone(), this.falseCase?.clone(), this.type, this.sourceSpan);
|
1348
|
+
}
|
1349
|
+
}
|
1350
|
+
class DynamicImportExpr extends Expression {
|
1351
|
+
constructor(url, sourceSpan) {
|
1352
|
+
super(null, sourceSpan);
|
1353
|
+
this.url = url;
|
1354
|
+
}
|
1355
|
+
isEquivalent(e) {
|
1356
|
+
return e instanceof DynamicImportExpr && this.url === e.url;
|
1357
|
+
}
|
1358
|
+
isConstant() {
|
1359
|
+
return false;
|
1360
|
+
}
|
1361
|
+
visitExpression(visitor, context) {
|
1362
|
+
return visitor.visitDynamicImportExpr(this, context);
|
1363
|
+
}
|
1364
|
+
clone() {
|
1365
|
+
return new DynamicImportExpr(this.url, this.sourceSpan);
|
1366
|
+
}
|
1300
1367
|
}
|
1301
1368
|
class NotExpr extends Expression {
|
1302
1369
|
constructor(condition, sourceSpan) {
|
@@ -1312,6 +1379,9 @@ class NotExpr extends Expression {
|
|
1312
1379
|
visitExpression(visitor, context) {
|
1313
1380
|
return visitor.visitNotExpr(this, context);
|
1314
1381
|
}
|
1382
|
+
clone() {
|
1383
|
+
return new NotExpr(this.condition.clone(), this.sourceSpan);
|
1384
|
+
}
|
1315
1385
|
}
|
1316
1386
|
class FnParam {
|
1317
1387
|
constructor(name, type = null) {
|
@@ -1321,6 +1391,9 @@ class FnParam {
|
|
1321
1391
|
isEquivalent(param) {
|
1322
1392
|
return this.name === param.name;
|
1323
1393
|
}
|
1394
|
+
clone() {
|
1395
|
+
return new FnParam(this.name, this.type);
|
1396
|
+
}
|
1324
1397
|
}
|
1325
1398
|
class FunctionExpr extends Expression {
|
1326
1399
|
constructor(params, statements, type, sourceSpan, name) {
|
@@ -1342,6 +1415,10 @@ class FunctionExpr extends Expression {
|
|
1342
1415
|
toDeclStmt(name, modifiers) {
|
1343
1416
|
return new DeclareFunctionStmt(name, this.params, this.statements, this.type, modifiers, this.sourceSpan);
|
1344
1417
|
}
|
1418
|
+
clone() {
|
1419
|
+
// TODO: Should we deep clone statements?
|
1420
|
+
return new FunctionExpr(this.params.map(p => p.clone()), this.statements, this.type, this.sourceSpan, this.name);
|
1421
|
+
}
|
1345
1422
|
}
|
1346
1423
|
class UnaryOperatorExpr extends Expression {
|
1347
1424
|
constructor(operator, expr, type, sourceSpan, parens = true) {
|
@@ -1360,6 +1437,9 @@ class UnaryOperatorExpr extends Expression {
|
|
1360
1437
|
visitExpression(visitor, context) {
|
1361
1438
|
return visitor.visitUnaryOperatorExpr(this, context);
|
1362
1439
|
}
|
1440
|
+
clone() {
|
1441
|
+
return new UnaryOperatorExpr(this.operator, this.expr.clone(), this.type, this.sourceSpan, this.parens);
|
1442
|
+
}
|
1363
1443
|
}
|
1364
1444
|
class BinaryOperatorExpr extends Expression {
|
1365
1445
|
constructor(operator, lhs, rhs, type, sourceSpan, parens = true) {
|
@@ -1379,6 +1459,9 @@ class BinaryOperatorExpr extends Expression {
|
|
1379
1459
|
visitExpression(visitor, context) {
|
1380
1460
|
return visitor.visitBinaryOperatorExpr(this, context);
|
1381
1461
|
}
|
1462
|
+
clone() {
|
1463
|
+
return new BinaryOperatorExpr(this.operator, this.lhs.clone(), this.rhs.clone(), this.type, this.sourceSpan, this.parens);
|
1464
|
+
}
|
1382
1465
|
}
|
1383
1466
|
class ReadPropExpr extends Expression {
|
1384
1467
|
constructor(receiver, name, type, sourceSpan) {
|
@@ -1386,6 +1469,10 @@ class ReadPropExpr extends Expression {
|
|
1386
1469
|
this.receiver = receiver;
|
1387
1470
|
this.name = name;
|
1388
1471
|
}
|
1472
|
+
// An alias for name, which allows other logic to handle property reads and keyed reads together.
|
1473
|
+
get index() {
|
1474
|
+
return this.name;
|
1475
|
+
}
|
1389
1476
|
isEquivalent(e) {
|
1390
1477
|
return e instanceof ReadPropExpr && this.receiver.isEquivalent(e.receiver) &&
|
1391
1478
|
this.name === e.name;
|
@@ -1399,6 +1486,9 @@ class ReadPropExpr extends Expression {
|
|
1399
1486
|
set(value) {
|
1400
1487
|
return new WritePropExpr(this.receiver, this.name, value, null, this.sourceSpan);
|
1401
1488
|
}
|
1489
|
+
clone() {
|
1490
|
+
return new ReadPropExpr(this.receiver.clone(), this.name, this.type, this.sourceSpan);
|
1491
|
+
}
|
1402
1492
|
}
|
1403
1493
|
class ReadKeyExpr extends Expression {
|
1404
1494
|
constructor(receiver, index, type, sourceSpan) {
|
@@ -1419,6 +1509,9 @@ class ReadKeyExpr extends Expression {
|
|
1419
1509
|
set(value) {
|
1420
1510
|
return new WriteKeyExpr(this.receiver, this.index, value, null, this.sourceSpan);
|
1421
1511
|
}
|
1512
|
+
clone() {
|
1513
|
+
return new ReadKeyExpr(this.receiver.clone(), this.index.clone(), this.type, this.sourceSpan);
|
1514
|
+
}
|
1422
1515
|
}
|
1423
1516
|
class LiteralArrayExpr extends Expression {
|
1424
1517
|
constructor(entries, type, sourceSpan) {
|
@@ -1434,6 +1527,9 @@ class LiteralArrayExpr extends Expression {
|
|
1434
1527
|
visitExpression(visitor, context) {
|
1435
1528
|
return visitor.visitLiteralArrayExpr(this, context);
|
1436
1529
|
}
|
1530
|
+
clone() {
|
1531
|
+
return new LiteralArrayExpr(this.entries.map(e => e.clone()), this.type, this.sourceSpan);
|
1532
|
+
}
|
1437
1533
|
}
|
1438
1534
|
class LiteralMapEntry {
|
1439
1535
|
constructor(key, value, quoted) {
|
@@ -1444,6 +1540,9 @@ class LiteralMapEntry {
|
|
1444
1540
|
isEquivalent(e) {
|
1445
1541
|
return this.key === e.key && this.value.isEquivalent(e.value);
|
1446
1542
|
}
|
1543
|
+
clone() {
|
1544
|
+
return new LiteralMapEntry(this.key, this.value.clone(), this.quoted);
|
1545
|
+
}
|
1447
1546
|
}
|
1448
1547
|
class LiteralMapExpr extends Expression {
|
1449
1548
|
constructor(entries, type, sourceSpan) {
|
@@ -1463,6 +1562,10 @@ class LiteralMapExpr extends Expression {
|
|
1463
1562
|
visitExpression(visitor, context) {
|
1464
1563
|
return visitor.visitLiteralMapExpr(this, context);
|
1465
1564
|
}
|
1565
|
+
clone() {
|
1566
|
+
const entriesClone = this.entries.map(entry => entry.clone());
|
1567
|
+
return new LiteralMapExpr(entriesClone, this.type, this.sourceSpan);
|
1568
|
+
}
|
1466
1569
|
}
|
1467
1570
|
const NULL_EXPR = new LiteralExpr(null, null, null);
|
1468
1571
|
const TYPED_NULL_EXPR = new LiteralExpr(null, INFERRED_TYPE, null);
|
@@ -1691,6 +1794,7 @@ class FixupExpression extends Expression {
|
|
1691
1794
|
constructor(resolved) {
|
1692
1795
|
super(resolved.type);
|
1693
1796
|
this.resolved = resolved;
|
1797
|
+
this.shared = false;
|
1694
1798
|
this.original = resolved;
|
1695
1799
|
}
|
1696
1800
|
visitExpression(visitor, context) {
|
@@ -1709,6 +1813,9 @@ class FixupExpression extends Expression {
|
|
1709
1813
|
isConstant() {
|
1710
1814
|
return true;
|
1711
1815
|
}
|
1816
|
+
clone() {
|
1817
|
+
throw new Error(`Not supported.`);
|
1818
|
+
}
|
1712
1819
|
fixup(expression) {
|
1713
1820
|
this.resolved = expression;
|
1714
1821
|
this.shared = true;
|
@@ -1725,6 +1832,7 @@ class ConstantPool {
|
|
1725
1832
|
this.statements = [];
|
1726
1833
|
this.literals = new Map();
|
1727
1834
|
this.literalFactories = new Map();
|
1835
|
+
this.sharedConstants = new Map();
|
1728
1836
|
this.nextNameIndex = 0;
|
1729
1837
|
}
|
1730
1838
|
getConstLiteral(literal, forceShared) {
|
@@ -1734,7 +1842,7 @@ class ConstantPool {
|
|
1734
1842
|
// reference to a constant.
|
1735
1843
|
return literal;
|
1736
1844
|
}
|
1737
|
-
const key =
|
1845
|
+
const key = GenericKeyFn.INSTANCE.keyOf(literal);
|
1738
1846
|
let fixup = this.literals.get(key);
|
1739
1847
|
let newValue = false;
|
1740
1848
|
if (!fixup) {
|
@@ -1779,11 +1887,20 @@ class ConstantPool {
|
|
1779
1887
|
}
|
1780
1888
|
return fixup;
|
1781
1889
|
}
|
1890
|
+
getSharedConstant(def, expr) {
|
1891
|
+
const key = def.keyOf(expr);
|
1892
|
+
if (!this.sharedConstants.has(key)) {
|
1893
|
+
const id = this.freshName();
|
1894
|
+
this.sharedConstants.set(key, variable(id));
|
1895
|
+
this.statements.push(def.toSharedConstantDeclaration(id, expr));
|
1896
|
+
}
|
1897
|
+
return this.sharedConstants.get(key);
|
1898
|
+
}
|
1782
1899
|
getLiteralFactory(literal) {
|
1783
1900
|
// Create a pure function that builds an array of a mix of constant and variable expressions
|
1784
1901
|
if (literal instanceof LiteralArrayExpr) {
|
1785
1902
|
const argumentsForKey = literal.entries.map(e => e.isConstant() ? e : UNKNOWN_VALUE_KEY);
|
1786
|
-
const key =
|
1903
|
+
const key = GenericKeyFn.INSTANCE.keyOf(literalArr(argumentsForKey));
|
1787
1904
|
return this._getLiteralFactory(key, literal.entries, entries => literalArr(entries));
|
1788
1905
|
}
|
1789
1906
|
else {
|
@@ -1792,7 +1909,7 @@ class ConstantPool {
|
|
1792
1909
|
value: e.value.isConstant() ? e.value : UNKNOWN_VALUE_KEY,
|
1793
1910
|
quoted: e.quoted
|
1794
1911
|
})));
|
1795
|
-
const key =
|
1912
|
+
const key = GenericKeyFn.INSTANCE.keyOf(expressionForKey);
|
1796
1913
|
return this._getLiteralFactory(key, literal.entries.map(e => e.value), entries => literalMap(entries.map((value, index) => ({
|
1797
1914
|
key: literal.entries[index].key,
|
1798
1915
|
value,
|
@@ -1829,65 +1946,48 @@ class ConstantPool {
|
|
1829
1946
|
freshName() {
|
1830
1947
|
return this.uniqueName(CONSTANT_PREFIX);
|
1831
1948
|
}
|
1832
|
-
keyOf(expression) {
|
1833
|
-
return expression.visitExpression(new KeyVisitor(), KEY_CONTEXT);
|
1834
|
-
}
|
1835
1949
|
}
|
1836
|
-
|
1837
|
-
|
1838
|
-
|
1839
|
-
|
1840
|
-
|
1841
|
-
|
1842
|
-
|
1843
|
-
|
1844
|
-
|
1845
|
-
|
1846
|
-
|
1847
|
-
|
1848
|
-
|
1849
|
-
|
1850
|
-
|
1851
|
-
|
1852
|
-
|
1853
|
-
|
1854
|
-
|
1855
|
-
|
1856
|
-
|
1857
|
-
|
1858
|
-
|
1859
|
-
|
1860
|
-
|
1861
|
-
|
1862
|
-
|
1863
|
-
|
1864
|
-
|
1865
|
-
|
1866
|
-
|
1867
|
-
|
1868
|
-
|
1869
|
-
|
1870
|
-
|
1871
|
-
|
1872
|
-
|
1873
|
-
|
1874
|
-
|
1875
|
-
return `{${ast.entries.map(mapEntry).join(',')}`;
|
1876
|
-
}
|
1877
|
-
visitExternalExpr(ast) {
|
1878
|
-
return ast.value.moduleName ? `EX:${ast.value.moduleName}:${ast.value.name}` :
|
1879
|
-
`EX:${ast.value.runtime.name}`;
|
1880
|
-
}
|
1881
|
-
visitReadVarExpr(node) {
|
1882
|
-
return `VAR:${node.name}`;
|
1883
|
-
}
|
1884
|
-
visitTypeofExpr(node, context) {
|
1885
|
-
return `TYPEOF:${node.expr.visitExpression(this, context)}`;
|
1950
|
+
class GenericKeyFn {
|
1951
|
+
static { this.INSTANCE = new GenericKeyFn(); }
|
1952
|
+
keyOf(expr) {
|
1953
|
+
if (expr instanceof LiteralExpr && typeof expr.value === 'string') {
|
1954
|
+
return `"${expr.value}"`;
|
1955
|
+
}
|
1956
|
+
else if (expr instanceof LiteralExpr) {
|
1957
|
+
return String(expr.value);
|
1958
|
+
}
|
1959
|
+
else if (expr instanceof LiteralArrayExpr) {
|
1960
|
+
const entries = [];
|
1961
|
+
for (const entry of expr.entries) {
|
1962
|
+
entries.push(this.keyOf(entry));
|
1963
|
+
}
|
1964
|
+
return `[${entries.join(',')}]`;
|
1965
|
+
}
|
1966
|
+
else if (expr instanceof LiteralMapExpr) {
|
1967
|
+
const entries = [];
|
1968
|
+
for (const entry of expr.entries) {
|
1969
|
+
let key = entry.key;
|
1970
|
+
if (entry.quoted) {
|
1971
|
+
key = `"${key}"`;
|
1972
|
+
}
|
1973
|
+
entries.push(key + ':' + this.keyOf(entry.value));
|
1974
|
+
}
|
1975
|
+
return `{${entries.join(',')}}`;
|
1976
|
+
}
|
1977
|
+
else if (expr instanceof ExternalExpr) {
|
1978
|
+
return `import("${expr.value.moduleName}", ${expr.value.name})`;
|
1979
|
+
}
|
1980
|
+
else if (expr instanceof ReadVarExpr) {
|
1981
|
+
return `read(${expr.name})`;
|
1982
|
+
}
|
1983
|
+
else if (expr instanceof TypeofExpr) {
|
1984
|
+
return `typeof(${this.keyOf(expr.expr)})`;
|
1985
|
+
}
|
1986
|
+
else {
|
1987
|
+
throw new Error(`${this.constructor.name} does not handle expressions of type ${expr.constructor.name}`);
|
1988
|
+
}
|
1886
1989
|
}
|
1887
1990
|
}
|
1888
|
-
function invalid$1(arg) {
|
1889
|
-
throw new Error(`Invalid state: Visitor ${this.constructor.name} doesn't handle ${arg.constructor.name}`);
|
1890
|
-
}
|
1891
1991
|
function isVariable(e) {
|
1892
1992
|
return e instanceof ReadVarExpr;
|
1893
1993
|
}
|
@@ -1898,209 +1998,211 @@ function isLongStringLiteral(expr) {
|
|
1898
1998
|
|
1899
1999
|
const CORE = '@angular/core';
|
1900
2000
|
class Identifiers {
|
2001
|
+
/* Methods */
|
2002
|
+
static { this.NEW_METHOD = 'factory'; }
|
2003
|
+
static { this.TRANSFORM_METHOD = 'transform'; }
|
2004
|
+
static { this.PATCH_DEPS = 'patchedDeps'; }
|
2005
|
+
static { this.core = { name: null, moduleName: CORE }; }
|
2006
|
+
/* Instructions */
|
2007
|
+
static { this.namespaceHTML = { name: 'ɵɵnamespaceHTML', moduleName: CORE }; }
|
2008
|
+
static { this.namespaceMathML = { name: 'ɵɵnamespaceMathML', moduleName: CORE }; }
|
2009
|
+
static { this.namespaceSVG = { name: 'ɵɵnamespaceSVG', moduleName: CORE }; }
|
2010
|
+
static { this.element = { name: 'ɵɵelement', moduleName: CORE }; }
|
2011
|
+
static { this.elementStart = { name: 'ɵɵelementStart', moduleName: CORE }; }
|
2012
|
+
static { this.elementEnd = { name: 'ɵɵelementEnd', moduleName: CORE }; }
|
2013
|
+
static { this.advance = { name: 'ɵɵadvance', moduleName: CORE }; }
|
2014
|
+
static { this.syntheticHostProperty = { name: 'ɵɵsyntheticHostProperty', moduleName: CORE }; }
|
2015
|
+
static { this.syntheticHostListener = { name: 'ɵɵsyntheticHostListener', moduleName: CORE }; }
|
2016
|
+
static { this.attribute = { name: 'ɵɵattribute', moduleName: CORE }; }
|
2017
|
+
static { this.attributeInterpolate1 = { name: 'ɵɵattributeInterpolate1', moduleName: CORE }; }
|
2018
|
+
static { this.attributeInterpolate2 = { name: 'ɵɵattributeInterpolate2', moduleName: CORE }; }
|
2019
|
+
static { this.attributeInterpolate3 = { name: 'ɵɵattributeInterpolate3', moduleName: CORE }; }
|
2020
|
+
static { this.attributeInterpolate4 = { name: 'ɵɵattributeInterpolate4', moduleName: CORE }; }
|
2021
|
+
static { this.attributeInterpolate5 = { name: 'ɵɵattributeInterpolate5', moduleName: CORE }; }
|
2022
|
+
static { this.attributeInterpolate6 = { name: 'ɵɵattributeInterpolate6', moduleName: CORE }; }
|
2023
|
+
static { this.attributeInterpolate7 = { name: 'ɵɵattributeInterpolate7', moduleName: CORE }; }
|
2024
|
+
static { this.attributeInterpolate8 = { name: 'ɵɵattributeInterpolate8', moduleName: CORE }; }
|
2025
|
+
static { this.attributeInterpolateV = { name: 'ɵɵattributeInterpolateV', moduleName: CORE }; }
|
2026
|
+
static { this.classProp = { name: 'ɵɵclassProp', moduleName: CORE }; }
|
2027
|
+
static { this.elementContainerStart = { name: 'ɵɵelementContainerStart', moduleName: CORE }; }
|
2028
|
+
static { this.elementContainerEnd = { name: 'ɵɵelementContainerEnd', moduleName: CORE }; }
|
2029
|
+
static { this.elementContainer = { name: 'ɵɵelementContainer', moduleName: CORE }; }
|
2030
|
+
static { this.styleMap = { name: 'ɵɵstyleMap', moduleName: CORE }; }
|
2031
|
+
static { this.styleMapInterpolate1 = { name: 'ɵɵstyleMapInterpolate1', moduleName: CORE }; }
|
2032
|
+
static { this.styleMapInterpolate2 = { name: 'ɵɵstyleMapInterpolate2', moduleName: CORE }; }
|
2033
|
+
static { this.styleMapInterpolate3 = { name: 'ɵɵstyleMapInterpolate3', moduleName: CORE }; }
|
2034
|
+
static { this.styleMapInterpolate4 = { name: 'ɵɵstyleMapInterpolate4', moduleName: CORE }; }
|
2035
|
+
static { this.styleMapInterpolate5 = { name: 'ɵɵstyleMapInterpolate5', moduleName: CORE }; }
|
2036
|
+
static { this.styleMapInterpolate6 = { name: 'ɵɵstyleMapInterpolate6', moduleName: CORE }; }
|
2037
|
+
static { this.styleMapInterpolate7 = { name: 'ɵɵstyleMapInterpolate7', moduleName: CORE }; }
|
2038
|
+
static { this.styleMapInterpolate8 = { name: 'ɵɵstyleMapInterpolate8', moduleName: CORE }; }
|
2039
|
+
static { this.styleMapInterpolateV = { name: 'ɵɵstyleMapInterpolateV', moduleName: CORE }; }
|
2040
|
+
static { this.classMap = { name: 'ɵɵclassMap', moduleName: CORE }; }
|
2041
|
+
static { this.classMapInterpolate1 = { name: 'ɵɵclassMapInterpolate1', moduleName: CORE }; }
|
2042
|
+
static { this.classMapInterpolate2 = { name: 'ɵɵclassMapInterpolate2', moduleName: CORE }; }
|
2043
|
+
static { this.classMapInterpolate3 = { name: 'ɵɵclassMapInterpolate3', moduleName: CORE }; }
|
2044
|
+
static { this.classMapInterpolate4 = { name: 'ɵɵclassMapInterpolate4', moduleName: CORE }; }
|
2045
|
+
static { this.classMapInterpolate5 = { name: 'ɵɵclassMapInterpolate5', moduleName: CORE }; }
|
2046
|
+
static { this.classMapInterpolate6 = { name: 'ɵɵclassMapInterpolate6', moduleName: CORE }; }
|
2047
|
+
static { this.classMapInterpolate7 = { name: 'ɵɵclassMapInterpolate7', moduleName: CORE }; }
|
2048
|
+
static { this.classMapInterpolate8 = { name: 'ɵɵclassMapInterpolate8', moduleName: CORE }; }
|
2049
|
+
static { this.classMapInterpolateV = { name: 'ɵɵclassMapInterpolateV', moduleName: CORE }; }
|
2050
|
+
static { this.styleProp = { name: 'ɵɵstyleProp', moduleName: CORE }; }
|
2051
|
+
static { this.stylePropInterpolate1 = { name: 'ɵɵstylePropInterpolate1', moduleName: CORE }; }
|
2052
|
+
static { this.stylePropInterpolate2 = { name: 'ɵɵstylePropInterpolate2', moduleName: CORE }; }
|
2053
|
+
static { this.stylePropInterpolate3 = { name: 'ɵɵstylePropInterpolate3', moduleName: CORE }; }
|
2054
|
+
static { this.stylePropInterpolate4 = { name: 'ɵɵstylePropInterpolate4', moduleName: CORE }; }
|
2055
|
+
static { this.stylePropInterpolate5 = { name: 'ɵɵstylePropInterpolate5', moduleName: CORE }; }
|
2056
|
+
static { this.stylePropInterpolate6 = { name: 'ɵɵstylePropInterpolate6', moduleName: CORE }; }
|
2057
|
+
static { this.stylePropInterpolate7 = { name: 'ɵɵstylePropInterpolate7', moduleName: CORE }; }
|
2058
|
+
static { this.stylePropInterpolate8 = { name: 'ɵɵstylePropInterpolate8', moduleName: CORE }; }
|
2059
|
+
static { this.stylePropInterpolateV = { name: 'ɵɵstylePropInterpolateV', moduleName: CORE }; }
|
2060
|
+
static { this.nextContext = { name: 'ɵɵnextContext', moduleName: CORE }; }
|
2061
|
+
static { this.resetView = { name: 'ɵɵresetView', moduleName: CORE }; }
|
2062
|
+
static { this.templateCreate = { name: 'ɵɵtemplate', moduleName: CORE }; }
|
2063
|
+
static { this.defer = { name: 'ɵɵdefer', moduleName: CORE }; }
|
2064
|
+
static { this.text = { name: 'ɵɵtext', moduleName: CORE }; }
|
2065
|
+
static { this.enableBindings = { name: 'ɵɵenableBindings', moduleName: CORE }; }
|
2066
|
+
static { this.disableBindings = { name: 'ɵɵdisableBindings', moduleName: CORE }; }
|
2067
|
+
static { this.getCurrentView = { name: 'ɵɵgetCurrentView', moduleName: CORE }; }
|
2068
|
+
static { this.textInterpolate = { name: 'ɵɵtextInterpolate', moduleName: CORE }; }
|
2069
|
+
static { this.textInterpolate1 = { name: 'ɵɵtextInterpolate1', moduleName: CORE }; }
|
2070
|
+
static { this.textInterpolate2 = { name: 'ɵɵtextInterpolate2', moduleName: CORE }; }
|
2071
|
+
static { this.textInterpolate3 = { name: 'ɵɵtextInterpolate3', moduleName: CORE }; }
|
2072
|
+
static { this.textInterpolate4 = { name: 'ɵɵtextInterpolate4', moduleName: CORE }; }
|
2073
|
+
static { this.textInterpolate5 = { name: 'ɵɵtextInterpolate5', moduleName: CORE }; }
|
2074
|
+
static { this.textInterpolate6 = { name: 'ɵɵtextInterpolate6', moduleName: CORE }; }
|
2075
|
+
static { this.textInterpolate7 = { name: 'ɵɵtextInterpolate7', moduleName: CORE }; }
|
2076
|
+
static { this.textInterpolate8 = { name: 'ɵɵtextInterpolate8', moduleName: CORE }; }
|
2077
|
+
static { this.textInterpolateV = { name: 'ɵɵtextInterpolateV', moduleName: CORE }; }
|
2078
|
+
static { this.restoreView = { name: 'ɵɵrestoreView', moduleName: CORE }; }
|
2079
|
+
static { this.pureFunction0 = { name: 'ɵɵpureFunction0', moduleName: CORE }; }
|
2080
|
+
static { this.pureFunction1 = { name: 'ɵɵpureFunction1', moduleName: CORE }; }
|
2081
|
+
static { this.pureFunction2 = { name: 'ɵɵpureFunction2', moduleName: CORE }; }
|
2082
|
+
static { this.pureFunction3 = { name: 'ɵɵpureFunction3', moduleName: CORE }; }
|
2083
|
+
static { this.pureFunction4 = { name: 'ɵɵpureFunction4', moduleName: CORE }; }
|
2084
|
+
static { this.pureFunction5 = { name: 'ɵɵpureFunction5', moduleName: CORE }; }
|
2085
|
+
static { this.pureFunction6 = { name: 'ɵɵpureFunction6', moduleName: CORE }; }
|
2086
|
+
static { this.pureFunction7 = { name: 'ɵɵpureFunction7', moduleName: CORE }; }
|
2087
|
+
static { this.pureFunction8 = { name: 'ɵɵpureFunction8', moduleName: CORE }; }
|
2088
|
+
static { this.pureFunctionV = { name: 'ɵɵpureFunctionV', moduleName: CORE }; }
|
2089
|
+
static { this.pipeBind1 = { name: 'ɵɵpipeBind1', moduleName: CORE }; }
|
2090
|
+
static { this.pipeBind2 = { name: 'ɵɵpipeBind2', moduleName: CORE }; }
|
2091
|
+
static { this.pipeBind3 = { name: 'ɵɵpipeBind3', moduleName: CORE }; }
|
2092
|
+
static { this.pipeBind4 = { name: 'ɵɵpipeBind4', moduleName: CORE }; }
|
2093
|
+
static { this.pipeBindV = { name: 'ɵɵpipeBindV', moduleName: CORE }; }
|
2094
|
+
static { this.hostProperty = { name: 'ɵɵhostProperty', moduleName: CORE }; }
|
2095
|
+
static { this.property = { name: 'ɵɵproperty', moduleName: CORE }; }
|
2096
|
+
static { this.propertyInterpolate = { name: 'ɵɵpropertyInterpolate', moduleName: CORE }; }
|
2097
|
+
static { this.propertyInterpolate1 = { name: 'ɵɵpropertyInterpolate1', moduleName: CORE }; }
|
2098
|
+
static { this.propertyInterpolate2 = { name: 'ɵɵpropertyInterpolate2', moduleName: CORE }; }
|
2099
|
+
static { this.propertyInterpolate3 = { name: 'ɵɵpropertyInterpolate3', moduleName: CORE }; }
|
2100
|
+
static { this.propertyInterpolate4 = { name: 'ɵɵpropertyInterpolate4', moduleName: CORE }; }
|
2101
|
+
static { this.propertyInterpolate5 = { name: 'ɵɵpropertyInterpolate5', moduleName: CORE }; }
|
2102
|
+
static { this.propertyInterpolate6 = { name: 'ɵɵpropertyInterpolate6', moduleName: CORE }; }
|
2103
|
+
static { this.propertyInterpolate7 = { name: 'ɵɵpropertyInterpolate7', moduleName: CORE }; }
|
2104
|
+
static { this.propertyInterpolate8 = { name: 'ɵɵpropertyInterpolate8', moduleName: CORE }; }
|
2105
|
+
static { this.propertyInterpolateV = { name: 'ɵɵpropertyInterpolateV', moduleName: CORE }; }
|
2106
|
+
static { this.i18n = { name: 'ɵɵi18n', moduleName: CORE }; }
|
2107
|
+
static { this.i18nAttributes = { name: 'ɵɵi18nAttributes', moduleName: CORE }; }
|
2108
|
+
static { this.i18nExp = { name: 'ɵɵi18nExp', moduleName: CORE }; }
|
2109
|
+
static { this.i18nStart = { name: 'ɵɵi18nStart', moduleName: CORE }; }
|
2110
|
+
static { this.i18nEnd = { name: 'ɵɵi18nEnd', moduleName: CORE }; }
|
2111
|
+
static { this.i18nApply = { name: 'ɵɵi18nApply', moduleName: CORE }; }
|
2112
|
+
static { this.i18nPostprocess = { name: 'ɵɵi18nPostprocess', moduleName: CORE }; }
|
2113
|
+
static { this.pipe = { name: 'ɵɵpipe', moduleName: CORE }; }
|
2114
|
+
static { this.projection = { name: 'ɵɵprojection', moduleName: CORE }; }
|
2115
|
+
static { this.projectionDef = { name: 'ɵɵprojectionDef', moduleName: CORE }; }
|
2116
|
+
static { this.reference = { name: 'ɵɵreference', moduleName: CORE }; }
|
2117
|
+
static { this.inject = { name: 'ɵɵinject', moduleName: CORE }; }
|
2118
|
+
static { this.injectAttribute = { name: 'ɵɵinjectAttribute', moduleName: CORE }; }
|
2119
|
+
static { this.directiveInject = { name: 'ɵɵdirectiveInject', moduleName: CORE }; }
|
2120
|
+
static { this.invalidFactory = { name: 'ɵɵinvalidFactory', moduleName: CORE }; }
|
2121
|
+
static { this.invalidFactoryDep = { name: 'ɵɵinvalidFactoryDep', moduleName: CORE }; }
|
2122
|
+
static { this.templateRefExtractor = { name: 'ɵɵtemplateRefExtractor', moduleName: CORE }; }
|
2123
|
+
static { this.forwardRef = { name: 'forwardRef', moduleName: CORE }; }
|
2124
|
+
static { this.resolveForwardRef = { name: 'resolveForwardRef', moduleName: CORE }; }
|
2125
|
+
static { this.ɵɵdefineInjectable = { name: 'ɵɵdefineInjectable', moduleName: CORE }; }
|
2126
|
+
static { this.declareInjectable = { name: 'ɵɵngDeclareInjectable', moduleName: CORE }; }
|
2127
|
+
static { this.InjectableDeclaration = { name: 'ɵɵInjectableDeclaration', moduleName: CORE }; }
|
2128
|
+
static { this.resolveWindow = { name: 'ɵɵresolveWindow', moduleName: CORE }; }
|
2129
|
+
static { this.resolveDocument = { name: 'ɵɵresolveDocument', moduleName: CORE }; }
|
2130
|
+
static { this.resolveBody = { name: 'ɵɵresolveBody', moduleName: CORE }; }
|
2131
|
+
static { this.defineComponent = { name: 'ɵɵdefineComponent', moduleName: CORE }; }
|
2132
|
+
static { this.declareComponent = { name: 'ɵɵngDeclareComponent', moduleName: CORE }; }
|
2133
|
+
static { this.setComponentScope = { name: 'ɵɵsetComponentScope', moduleName: CORE }; }
|
2134
|
+
static { this.ChangeDetectionStrategy = {
|
2135
|
+
name: 'ChangeDetectionStrategy',
|
2136
|
+
moduleName: CORE,
|
2137
|
+
}; }
|
2138
|
+
static { this.ViewEncapsulation = {
|
2139
|
+
name: 'ViewEncapsulation',
|
2140
|
+
moduleName: CORE,
|
2141
|
+
}; }
|
2142
|
+
static { this.ComponentDeclaration = {
|
2143
|
+
name: 'ɵɵComponentDeclaration',
|
2144
|
+
moduleName: CORE,
|
2145
|
+
}; }
|
2146
|
+
static { this.FactoryDeclaration = {
|
2147
|
+
name: 'ɵɵFactoryDeclaration',
|
2148
|
+
moduleName: CORE,
|
2149
|
+
}; }
|
2150
|
+
static { this.declareFactory = { name: 'ɵɵngDeclareFactory', moduleName: CORE }; }
|
2151
|
+
static { this.FactoryTarget = { name: 'ɵɵFactoryTarget', moduleName: CORE }; }
|
2152
|
+
static { this.defineDirective = { name: 'ɵɵdefineDirective', moduleName: CORE }; }
|
2153
|
+
static { this.declareDirective = { name: 'ɵɵngDeclareDirective', moduleName: CORE }; }
|
2154
|
+
static { this.DirectiveDeclaration = {
|
2155
|
+
name: 'ɵɵDirectiveDeclaration',
|
2156
|
+
moduleName: CORE,
|
2157
|
+
}; }
|
2158
|
+
static { this.InjectorDef = { name: 'ɵɵInjectorDef', moduleName: CORE }; }
|
2159
|
+
static { this.InjectorDeclaration = { name: 'ɵɵInjectorDeclaration', moduleName: CORE }; }
|
2160
|
+
static { this.defineInjector = { name: 'ɵɵdefineInjector', moduleName: CORE }; }
|
2161
|
+
static { this.declareInjector = { name: 'ɵɵngDeclareInjector', moduleName: CORE }; }
|
2162
|
+
static { this.NgModuleDeclaration = {
|
2163
|
+
name: 'ɵɵNgModuleDeclaration',
|
2164
|
+
moduleName: CORE,
|
2165
|
+
}; }
|
2166
|
+
static { this.ModuleWithProviders = {
|
2167
|
+
name: 'ModuleWithProviders',
|
2168
|
+
moduleName: CORE,
|
2169
|
+
}; }
|
2170
|
+
static { this.defineNgModule = { name: 'ɵɵdefineNgModule', moduleName: CORE }; }
|
2171
|
+
static { this.declareNgModule = { name: 'ɵɵngDeclareNgModule', moduleName: CORE }; }
|
2172
|
+
static { this.setNgModuleScope = { name: 'ɵɵsetNgModuleScope', moduleName: CORE }; }
|
2173
|
+
static { this.registerNgModuleType = { name: 'ɵɵregisterNgModuleType', moduleName: CORE }; }
|
2174
|
+
static { this.PipeDeclaration = { name: 'ɵɵPipeDeclaration', moduleName: CORE }; }
|
2175
|
+
static { this.definePipe = { name: 'ɵɵdefinePipe', moduleName: CORE }; }
|
2176
|
+
static { this.declarePipe = { name: 'ɵɵngDeclarePipe', moduleName: CORE }; }
|
2177
|
+
static { this.declareClassMetadata = { name: 'ɵɵngDeclareClassMetadata', moduleName: CORE }; }
|
2178
|
+
static { this.setClassMetadata = { name: 'ɵsetClassMetadata', moduleName: CORE }; }
|
2179
|
+
static { this.queryRefresh = { name: 'ɵɵqueryRefresh', moduleName: CORE }; }
|
2180
|
+
static { this.viewQuery = { name: 'ɵɵviewQuery', moduleName: CORE }; }
|
2181
|
+
static { this.loadQuery = { name: 'ɵɵloadQuery', moduleName: CORE }; }
|
2182
|
+
static { this.contentQuery = { name: 'ɵɵcontentQuery', moduleName: CORE }; }
|
2183
|
+
static { this.NgOnChangesFeature = { name: 'ɵɵNgOnChangesFeature', moduleName: CORE }; }
|
2184
|
+
static { this.InheritDefinitionFeature = { name: 'ɵɵInheritDefinitionFeature', moduleName: CORE }; }
|
2185
|
+
static { this.CopyDefinitionFeature = { name: 'ɵɵCopyDefinitionFeature', moduleName: CORE }; }
|
2186
|
+
static { this.StandaloneFeature = { name: 'ɵɵStandaloneFeature', moduleName: CORE }; }
|
2187
|
+
static { this.ProvidersFeature = { name: 'ɵɵProvidersFeature', moduleName: CORE }; }
|
2188
|
+
static { this.HostDirectivesFeature = { name: 'ɵɵHostDirectivesFeature', moduleName: CORE }; }
|
2189
|
+
static { this.InputTransformsFeatureFeature = { name: 'ɵɵInputTransformsFeature', moduleName: CORE }; }
|
2190
|
+
static { this.listener = { name: 'ɵɵlistener', moduleName: CORE }; }
|
2191
|
+
static { this.getInheritedFactory = {
|
2192
|
+
name: 'ɵɵgetInheritedFactory',
|
2193
|
+
moduleName: CORE,
|
2194
|
+
}; }
|
2195
|
+
// sanitization-related functions
|
2196
|
+
static { this.sanitizeHtml = { name: 'ɵɵsanitizeHtml', moduleName: CORE }; }
|
2197
|
+
static { this.sanitizeStyle = { name: 'ɵɵsanitizeStyle', moduleName: CORE }; }
|
2198
|
+
static { this.sanitizeResourceUrl = { name: 'ɵɵsanitizeResourceUrl', moduleName: CORE }; }
|
2199
|
+
static { this.sanitizeScript = { name: 'ɵɵsanitizeScript', moduleName: CORE }; }
|
2200
|
+
static { this.sanitizeUrl = { name: 'ɵɵsanitizeUrl', moduleName: CORE }; }
|
2201
|
+
static { this.sanitizeUrlOrResourceUrl = { name: 'ɵɵsanitizeUrlOrResourceUrl', moduleName: CORE }; }
|
2202
|
+
static { this.trustConstantHtml = { name: 'ɵɵtrustConstantHtml', moduleName: CORE }; }
|
2203
|
+
static { this.trustConstantResourceUrl = { name: 'ɵɵtrustConstantResourceUrl', moduleName: CORE }; }
|
2204
|
+
static { this.validateIframeAttribute = { name: 'ɵɵvalidateIframeAttribute', moduleName: CORE }; }
|
1901
2205
|
}
|
1902
|
-
/* Methods */
|
1903
|
-
Identifiers.NEW_METHOD = 'factory';
|
1904
|
-
Identifiers.TRANSFORM_METHOD = 'transform';
|
1905
|
-
Identifiers.PATCH_DEPS = 'patchedDeps';
|
1906
|
-
Identifiers.core = { name: null, moduleName: CORE };
|
1907
|
-
/* Instructions */
|
1908
|
-
Identifiers.namespaceHTML = { name: 'ɵɵnamespaceHTML', moduleName: CORE };
|
1909
|
-
Identifiers.namespaceMathML = { name: 'ɵɵnamespaceMathML', moduleName: CORE };
|
1910
|
-
Identifiers.namespaceSVG = { name: 'ɵɵnamespaceSVG', moduleName: CORE };
|
1911
|
-
Identifiers.element = { name: 'ɵɵelement', moduleName: CORE };
|
1912
|
-
Identifiers.elementStart = { name: 'ɵɵelementStart', moduleName: CORE };
|
1913
|
-
Identifiers.elementEnd = { name: 'ɵɵelementEnd', moduleName: CORE };
|
1914
|
-
Identifiers.advance = { name: 'ɵɵadvance', moduleName: CORE };
|
1915
|
-
Identifiers.syntheticHostProperty = { name: 'ɵɵsyntheticHostProperty', moduleName: CORE };
|
1916
|
-
Identifiers.syntheticHostListener = { name: 'ɵɵsyntheticHostListener', moduleName: CORE };
|
1917
|
-
Identifiers.attribute = { name: 'ɵɵattribute', moduleName: CORE };
|
1918
|
-
Identifiers.attributeInterpolate1 = { name: 'ɵɵattributeInterpolate1', moduleName: CORE };
|
1919
|
-
Identifiers.attributeInterpolate2 = { name: 'ɵɵattributeInterpolate2', moduleName: CORE };
|
1920
|
-
Identifiers.attributeInterpolate3 = { name: 'ɵɵattributeInterpolate3', moduleName: CORE };
|
1921
|
-
Identifiers.attributeInterpolate4 = { name: 'ɵɵattributeInterpolate4', moduleName: CORE };
|
1922
|
-
Identifiers.attributeInterpolate5 = { name: 'ɵɵattributeInterpolate5', moduleName: CORE };
|
1923
|
-
Identifiers.attributeInterpolate6 = { name: 'ɵɵattributeInterpolate6', moduleName: CORE };
|
1924
|
-
Identifiers.attributeInterpolate7 = { name: 'ɵɵattributeInterpolate7', moduleName: CORE };
|
1925
|
-
Identifiers.attributeInterpolate8 = { name: 'ɵɵattributeInterpolate8', moduleName: CORE };
|
1926
|
-
Identifiers.attributeInterpolateV = { name: 'ɵɵattributeInterpolateV', moduleName: CORE };
|
1927
|
-
Identifiers.classProp = { name: 'ɵɵclassProp', moduleName: CORE };
|
1928
|
-
Identifiers.elementContainerStart = { name: 'ɵɵelementContainerStart', moduleName: CORE };
|
1929
|
-
Identifiers.elementContainerEnd = { name: 'ɵɵelementContainerEnd', moduleName: CORE };
|
1930
|
-
Identifiers.elementContainer = { name: 'ɵɵelementContainer', moduleName: CORE };
|
1931
|
-
Identifiers.styleMap = { name: 'ɵɵstyleMap', moduleName: CORE };
|
1932
|
-
Identifiers.styleMapInterpolate1 = { name: 'ɵɵstyleMapInterpolate1', moduleName: CORE };
|
1933
|
-
Identifiers.styleMapInterpolate2 = { name: 'ɵɵstyleMapInterpolate2', moduleName: CORE };
|
1934
|
-
Identifiers.styleMapInterpolate3 = { name: 'ɵɵstyleMapInterpolate3', moduleName: CORE };
|
1935
|
-
Identifiers.styleMapInterpolate4 = { name: 'ɵɵstyleMapInterpolate4', moduleName: CORE };
|
1936
|
-
Identifiers.styleMapInterpolate5 = { name: 'ɵɵstyleMapInterpolate5', moduleName: CORE };
|
1937
|
-
Identifiers.styleMapInterpolate6 = { name: 'ɵɵstyleMapInterpolate6', moduleName: CORE };
|
1938
|
-
Identifiers.styleMapInterpolate7 = { name: 'ɵɵstyleMapInterpolate7', moduleName: CORE };
|
1939
|
-
Identifiers.styleMapInterpolate8 = { name: 'ɵɵstyleMapInterpolate8', moduleName: CORE };
|
1940
|
-
Identifiers.styleMapInterpolateV = { name: 'ɵɵstyleMapInterpolateV', moduleName: CORE };
|
1941
|
-
Identifiers.classMap = { name: 'ɵɵclassMap', moduleName: CORE };
|
1942
|
-
Identifiers.classMapInterpolate1 = { name: 'ɵɵclassMapInterpolate1', moduleName: CORE };
|
1943
|
-
Identifiers.classMapInterpolate2 = { name: 'ɵɵclassMapInterpolate2', moduleName: CORE };
|
1944
|
-
Identifiers.classMapInterpolate3 = { name: 'ɵɵclassMapInterpolate3', moduleName: CORE };
|
1945
|
-
Identifiers.classMapInterpolate4 = { name: 'ɵɵclassMapInterpolate4', moduleName: CORE };
|
1946
|
-
Identifiers.classMapInterpolate5 = { name: 'ɵɵclassMapInterpolate5', moduleName: CORE };
|
1947
|
-
Identifiers.classMapInterpolate6 = { name: 'ɵɵclassMapInterpolate6', moduleName: CORE };
|
1948
|
-
Identifiers.classMapInterpolate7 = { name: 'ɵɵclassMapInterpolate7', moduleName: CORE };
|
1949
|
-
Identifiers.classMapInterpolate8 = { name: 'ɵɵclassMapInterpolate8', moduleName: CORE };
|
1950
|
-
Identifiers.classMapInterpolateV = { name: 'ɵɵclassMapInterpolateV', moduleName: CORE };
|
1951
|
-
Identifiers.styleProp = { name: 'ɵɵstyleProp', moduleName: CORE };
|
1952
|
-
Identifiers.stylePropInterpolate1 = { name: 'ɵɵstylePropInterpolate1', moduleName: CORE };
|
1953
|
-
Identifiers.stylePropInterpolate2 = { name: 'ɵɵstylePropInterpolate2', moduleName: CORE };
|
1954
|
-
Identifiers.stylePropInterpolate3 = { name: 'ɵɵstylePropInterpolate3', moduleName: CORE };
|
1955
|
-
Identifiers.stylePropInterpolate4 = { name: 'ɵɵstylePropInterpolate4', moduleName: CORE };
|
1956
|
-
Identifiers.stylePropInterpolate5 = { name: 'ɵɵstylePropInterpolate5', moduleName: CORE };
|
1957
|
-
Identifiers.stylePropInterpolate6 = { name: 'ɵɵstylePropInterpolate6', moduleName: CORE };
|
1958
|
-
Identifiers.stylePropInterpolate7 = { name: 'ɵɵstylePropInterpolate7', moduleName: CORE };
|
1959
|
-
Identifiers.stylePropInterpolate8 = { name: 'ɵɵstylePropInterpolate8', moduleName: CORE };
|
1960
|
-
Identifiers.stylePropInterpolateV = { name: 'ɵɵstylePropInterpolateV', moduleName: CORE };
|
1961
|
-
Identifiers.nextContext = { name: 'ɵɵnextContext', moduleName: CORE };
|
1962
|
-
Identifiers.resetView = { name: 'ɵɵresetView', moduleName: CORE };
|
1963
|
-
Identifiers.templateCreate = { name: 'ɵɵtemplate', moduleName: CORE };
|
1964
|
-
Identifiers.text = { name: 'ɵɵtext', moduleName: CORE };
|
1965
|
-
Identifiers.enableBindings = { name: 'ɵɵenableBindings', moduleName: CORE };
|
1966
|
-
Identifiers.disableBindings = { name: 'ɵɵdisableBindings', moduleName: CORE };
|
1967
|
-
Identifiers.getCurrentView = { name: 'ɵɵgetCurrentView', moduleName: CORE };
|
1968
|
-
Identifiers.textInterpolate = { name: 'ɵɵtextInterpolate', moduleName: CORE };
|
1969
|
-
Identifiers.textInterpolate1 = { name: 'ɵɵtextInterpolate1', moduleName: CORE };
|
1970
|
-
Identifiers.textInterpolate2 = { name: 'ɵɵtextInterpolate2', moduleName: CORE };
|
1971
|
-
Identifiers.textInterpolate3 = { name: 'ɵɵtextInterpolate3', moduleName: CORE };
|
1972
|
-
Identifiers.textInterpolate4 = { name: 'ɵɵtextInterpolate4', moduleName: CORE };
|
1973
|
-
Identifiers.textInterpolate5 = { name: 'ɵɵtextInterpolate5', moduleName: CORE };
|
1974
|
-
Identifiers.textInterpolate6 = { name: 'ɵɵtextInterpolate6', moduleName: CORE };
|
1975
|
-
Identifiers.textInterpolate7 = { name: 'ɵɵtextInterpolate7', moduleName: CORE };
|
1976
|
-
Identifiers.textInterpolate8 = { name: 'ɵɵtextInterpolate8', moduleName: CORE };
|
1977
|
-
Identifiers.textInterpolateV = { name: 'ɵɵtextInterpolateV', moduleName: CORE };
|
1978
|
-
Identifiers.restoreView = { name: 'ɵɵrestoreView', moduleName: CORE };
|
1979
|
-
Identifiers.pureFunction0 = { name: 'ɵɵpureFunction0', moduleName: CORE };
|
1980
|
-
Identifiers.pureFunction1 = { name: 'ɵɵpureFunction1', moduleName: CORE };
|
1981
|
-
Identifiers.pureFunction2 = { name: 'ɵɵpureFunction2', moduleName: CORE };
|
1982
|
-
Identifiers.pureFunction3 = { name: 'ɵɵpureFunction3', moduleName: CORE };
|
1983
|
-
Identifiers.pureFunction4 = { name: 'ɵɵpureFunction4', moduleName: CORE };
|
1984
|
-
Identifiers.pureFunction5 = { name: 'ɵɵpureFunction5', moduleName: CORE };
|
1985
|
-
Identifiers.pureFunction6 = { name: 'ɵɵpureFunction6', moduleName: CORE };
|
1986
|
-
Identifiers.pureFunction7 = { name: 'ɵɵpureFunction7', moduleName: CORE };
|
1987
|
-
Identifiers.pureFunction8 = { name: 'ɵɵpureFunction8', moduleName: CORE };
|
1988
|
-
Identifiers.pureFunctionV = { name: 'ɵɵpureFunctionV', moduleName: CORE };
|
1989
|
-
Identifiers.pipeBind1 = { name: 'ɵɵpipeBind1', moduleName: CORE };
|
1990
|
-
Identifiers.pipeBind2 = { name: 'ɵɵpipeBind2', moduleName: CORE };
|
1991
|
-
Identifiers.pipeBind3 = { name: 'ɵɵpipeBind3', moduleName: CORE };
|
1992
|
-
Identifiers.pipeBind4 = { name: 'ɵɵpipeBind4', moduleName: CORE };
|
1993
|
-
Identifiers.pipeBindV = { name: 'ɵɵpipeBindV', moduleName: CORE };
|
1994
|
-
Identifiers.hostProperty = { name: 'ɵɵhostProperty', moduleName: CORE };
|
1995
|
-
Identifiers.property = { name: 'ɵɵproperty', moduleName: CORE };
|
1996
|
-
Identifiers.propertyInterpolate = { name: 'ɵɵpropertyInterpolate', moduleName: CORE };
|
1997
|
-
Identifiers.propertyInterpolate1 = { name: 'ɵɵpropertyInterpolate1', moduleName: CORE };
|
1998
|
-
Identifiers.propertyInterpolate2 = { name: 'ɵɵpropertyInterpolate2', moduleName: CORE };
|
1999
|
-
Identifiers.propertyInterpolate3 = { name: 'ɵɵpropertyInterpolate3', moduleName: CORE };
|
2000
|
-
Identifiers.propertyInterpolate4 = { name: 'ɵɵpropertyInterpolate4', moduleName: CORE };
|
2001
|
-
Identifiers.propertyInterpolate5 = { name: 'ɵɵpropertyInterpolate5', moduleName: CORE };
|
2002
|
-
Identifiers.propertyInterpolate6 = { name: 'ɵɵpropertyInterpolate6', moduleName: CORE };
|
2003
|
-
Identifiers.propertyInterpolate7 = { name: 'ɵɵpropertyInterpolate7', moduleName: CORE };
|
2004
|
-
Identifiers.propertyInterpolate8 = { name: 'ɵɵpropertyInterpolate8', moduleName: CORE };
|
2005
|
-
Identifiers.propertyInterpolateV = { name: 'ɵɵpropertyInterpolateV', moduleName: CORE };
|
2006
|
-
Identifiers.i18n = { name: 'ɵɵi18n', moduleName: CORE };
|
2007
|
-
Identifiers.i18nAttributes = { name: 'ɵɵi18nAttributes', moduleName: CORE };
|
2008
|
-
Identifiers.i18nExp = { name: 'ɵɵi18nExp', moduleName: CORE };
|
2009
|
-
Identifiers.i18nStart = { name: 'ɵɵi18nStart', moduleName: CORE };
|
2010
|
-
Identifiers.i18nEnd = { name: 'ɵɵi18nEnd', moduleName: CORE };
|
2011
|
-
Identifiers.i18nApply = { name: 'ɵɵi18nApply', moduleName: CORE };
|
2012
|
-
Identifiers.i18nPostprocess = { name: 'ɵɵi18nPostprocess', moduleName: CORE };
|
2013
|
-
Identifiers.pipe = { name: 'ɵɵpipe', moduleName: CORE };
|
2014
|
-
Identifiers.projection = { name: 'ɵɵprojection', moduleName: CORE };
|
2015
|
-
Identifiers.projectionDef = { name: 'ɵɵprojectionDef', moduleName: CORE };
|
2016
|
-
Identifiers.reference = { name: 'ɵɵreference', moduleName: CORE };
|
2017
|
-
Identifiers.inject = { name: 'ɵɵinject', moduleName: CORE };
|
2018
|
-
Identifiers.injectAttribute = { name: 'ɵɵinjectAttribute', moduleName: CORE };
|
2019
|
-
Identifiers.directiveInject = { name: 'ɵɵdirectiveInject', moduleName: CORE };
|
2020
|
-
Identifiers.invalidFactory = { name: 'ɵɵinvalidFactory', moduleName: CORE };
|
2021
|
-
Identifiers.invalidFactoryDep = { name: 'ɵɵinvalidFactoryDep', moduleName: CORE };
|
2022
|
-
Identifiers.templateRefExtractor = { name: 'ɵɵtemplateRefExtractor', moduleName: CORE };
|
2023
|
-
Identifiers.forwardRef = { name: 'forwardRef', moduleName: CORE };
|
2024
|
-
Identifiers.resolveForwardRef = { name: 'resolveForwardRef', moduleName: CORE };
|
2025
|
-
Identifiers.ɵɵdefineInjectable = { name: 'ɵɵdefineInjectable', moduleName: CORE };
|
2026
|
-
Identifiers.declareInjectable = { name: 'ɵɵngDeclareInjectable', moduleName: CORE };
|
2027
|
-
Identifiers.InjectableDeclaration = { name: 'ɵɵInjectableDeclaration', moduleName: CORE };
|
2028
|
-
Identifiers.resolveWindow = { name: 'ɵɵresolveWindow', moduleName: CORE };
|
2029
|
-
Identifiers.resolveDocument = { name: 'ɵɵresolveDocument', moduleName: CORE };
|
2030
|
-
Identifiers.resolveBody = { name: 'ɵɵresolveBody', moduleName: CORE };
|
2031
|
-
Identifiers.defineComponent = { name: 'ɵɵdefineComponent', moduleName: CORE };
|
2032
|
-
Identifiers.declareComponent = { name: 'ɵɵngDeclareComponent', moduleName: CORE };
|
2033
|
-
Identifiers.setComponentScope = { name: 'ɵɵsetComponentScope', moduleName: CORE };
|
2034
|
-
Identifiers.ChangeDetectionStrategy = {
|
2035
|
-
name: 'ChangeDetectionStrategy',
|
2036
|
-
moduleName: CORE,
|
2037
|
-
};
|
2038
|
-
Identifiers.ViewEncapsulation = {
|
2039
|
-
name: 'ViewEncapsulation',
|
2040
|
-
moduleName: CORE,
|
2041
|
-
};
|
2042
|
-
Identifiers.ComponentDeclaration = {
|
2043
|
-
name: 'ɵɵComponentDeclaration',
|
2044
|
-
moduleName: CORE,
|
2045
|
-
};
|
2046
|
-
Identifiers.FactoryDeclaration = {
|
2047
|
-
name: 'ɵɵFactoryDeclaration',
|
2048
|
-
moduleName: CORE,
|
2049
|
-
};
|
2050
|
-
Identifiers.declareFactory = { name: 'ɵɵngDeclareFactory', moduleName: CORE };
|
2051
|
-
Identifiers.FactoryTarget = { name: 'ɵɵFactoryTarget', moduleName: CORE };
|
2052
|
-
Identifiers.defineDirective = { name: 'ɵɵdefineDirective', moduleName: CORE };
|
2053
|
-
Identifiers.declareDirective = { name: 'ɵɵngDeclareDirective', moduleName: CORE };
|
2054
|
-
Identifiers.DirectiveDeclaration = {
|
2055
|
-
name: 'ɵɵDirectiveDeclaration',
|
2056
|
-
moduleName: CORE,
|
2057
|
-
};
|
2058
|
-
Identifiers.InjectorDef = { name: 'ɵɵInjectorDef', moduleName: CORE };
|
2059
|
-
Identifiers.InjectorDeclaration = { name: 'ɵɵInjectorDeclaration', moduleName: CORE };
|
2060
|
-
Identifiers.defineInjector = { name: 'ɵɵdefineInjector', moduleName: CORE };
|
2061
|
-
Identifiers.declareInjector = { name: 'ɵɵngDeclareInjector', moduleName: CORE };
|
2062
|
-
Identifiers.NgModuleDeclaration = {
|
2063
|
-
name: 'ɵɵNgModuleDeclaration',
|
2064
|
-
moduleName: CORE,
|
2065
|
-
};
|
2066
|
-
Identifiers.ModuleWithProviders = {
|
2067
|
-
name: 'ModuleWithProviders',
|
2068
|
-
moduleName: CORE,
|
2069
|
-
};
|
2070
|
-
Identifiers.defineNgModule = { name: 'ɵɵdefineNgModule', moduleName: CORE };
|
2071
|
-
Identifiers.declareNgModule = { name: 'ɵɵngDeclareNgModule', moduleName: CORE };
|
2072
|
-
Identifiers.setNgModuleScope = { name: 'ɵɵsetNgModuleScope', moduleName: CORE };
|
2073
|
-
Identifiers.registerNgModuleType = { name: 'ɵɵregisterNgModuleType', moduleName: CORE };
|
2074
|
-
Identifiers.PipeDeclaration = { name: 'ɵɵPipeDeclaration', moduleName: CORE };
|
2075
|
-
Identifiers.definePipe = { name: 'ɵɵdefinePipe', moduleName: CORE };
|
2076
|
-
Identifiers.declarePipe = { name: 'ɵɵngDeclarePipe', moduleName: CORE };
|
2077
|
-
Identifiers.declareClassMetadata = { name: 'ɵɵngDeclareClassMetadata', moduleName: CORE };
|
2078
|
-
Identifiers.setClassMetadata = { name: 'ɵsetClassMetadata', moduleName: CORE };
|
2079
|
-
Identifiers.queryRefresh = { name: 'ɵɵqueryRefresh', moduleName: CORE };
|
2080
|
-
Identifiers.viewQuery = { name: 'ɵɵviewQuery', moduleName: CORE };
|
2081
|
-
Identifiers.loadQuery = { name: 'ɵɵloadQuery', moduleName: CORE };
|
2082
|
-
Identifiers.contentQuery = { name: 'ɵɵcontentQuery', moduleName: CORE };
|
2083
|
-
Identifiers.NgOnChangesFeature = { name: 'ɵɵNgOnChangesFeature', moduleName: CORE };
|
2084
|
-
Identifiers.InheritDefinitionFeature = { name: 'ɵɵInheritDefinitionFeature', moduleName: CORE };
|
2085
|
-
Identifiers.CopyDefinitionFeature = { name: 'ɵɵCopyDefinitionFeature', moduleName: CORE };
|
2086
|
-
Identifiers.StandaloneFeature = { name: 'ɵɵStandaloneFeature', moduleName: CORE };
|
2087
|
-
Identifiers.ProvidersFeature = { name: 'ɵɵProvidersFeature', moduleName: CORE };
|
2088
|
-
Identifiers.HostDirectivesFeature = { name: 'ɵɵHostDirectivesFeature', moduleName: CORE };
|
2089
|
-
Identifiers.listener = { name: 'ɵɵlistener', moduleName: CORE };
|
2090
|
-
Identifiers.getInheritedFactory = {
|
2091
|
-
name: 'ɵɵgetInheritedFactory',
|
2092
|
-
moduleName: CORE,
|
2093
|
-
};
|
2094
|
-
// sanitization-related functions
|
2095
|
-
Identifiers.sanitizeHtml = { name: 'ɵɵsanitizeHtml', moduleName: CORE };
|
2096
|
-
Identifiers.sanitizeStyle = { name: 'ɵɵsanitizeStyle', moduleName: CORE };
|
2097
|
-
Identifiers.sanitizeResourceUrl = { name: 'ɵɵsanitizeResourceUrl', moduleName: CORE };
|
2098
|
-
Identifiers.sanitizeScript = { name: 'ɵɵsanitizeScript', moduleName: CORE };
|
2099
|
-
Identifiers.sanitizeUrl = { name: 'ɵɵsanitizeUrl', moduleName: CORE };
|
2100
|
-
Identifiers.sanitizeUrlOrResourceUrl = { name: 'ɵɵsanitizeUrlOrResourceUrl', moduleName: CORE };
|
2101
|
-
Identifiers.trustConstantHtml = { name: 'ɵɵtrustConstantHtml', moduleName: CORE };
|
2102
|
-
Identifiers.trustConstantResourceUrl = { name: 'ɵɵtrustConstantResourceUrl', moduleName: CORE };
|
2103
|
-
Identifiers.validateIframeAttribute = { name: 'ɵɵvalidateIframeAttribute', moduleName: CORE };
|
2104
2206
|
|
2105
2207
|
const DASH_CASE_REGEXP = /-+([a-z0-9])/g;
|
2106
2208
|
function dashCaseToCamelCase(input) {
|
@@ -2186,13 +2288,7 @@ class Version {
|
|
2186
2288
|
this.patch = splits.slice(2).join('.');
|
2187
2289
|
}
|
2188
2290
|
}
|
2189
|
-
|
2190
|
-
// `_global` variable should point to the NodeJS `global` in that case. Note: Typeof/Instanceof
|
2191
|
-
// checks are considered side-effects in Terser. We explicitly mark this as side-effect free:
|
2192
|
-
// https://github.com/terser/terser/issues/250.
|
2193
|
-
const _global = ( /* @__PURE__ */(() => (typeof global !== 'undefined' && global) || (typeof window !== 'undefined' && window) ||
|
2194
|
-
(typeof self !== 'undefined' && typeof WorkerGlobalScope !== 'undefined' &&
|
2195
|
-
self instanceof WorkerGlobalScope && self))());
|
2291
|
+
const _global = globalThis;
|
2196
2292
|
/**
|
2197
2293
|
* Partitions a given array into 2 arrays, based on a boolean value returned by the condition
|
2198
2294
|
* function.
|
@@ -2667,6 +2763,9 @@ class AbstractEmitterVisitor {
|
|
2667
2763
|
ctx.print(ast, `)`);
|
2668
2764
|
return null;
|
2669
2765
|
}
|
2766
|
+
visitDynamicImportExpr(ast, ctx) {
|
2767
|
+
ctx.print(ast, `import(${ast.url})`);
|
2768
|
+
}
|
2670
2769
|
visitNotExpr(ast, ctx) {
|
2671
2770
|
ctx.print(ast, '!');
|
2672
2771
|
ast.condition.visitExpression(this, ctx);
|
@@ -2954,7 +3053,7 @@ function compileFactoryFunction(meta) {
|
|
2954
3053
|
// delegated factory (which is used to create the current type) then this is only the type-to-
|
2955
3054
|
// create parameter (t).
|
2956
3055
|
const typeForCtor = !isDelegatedFactoryMetadata(meta) ?
|
2957
|
-
new BinaryOperatorExpr(BinaryOperator.Or, t, meta.
|
3056
|
+
new BinaryOperatorExpr(BinaryOperator.Or, t, meta.type.value) :
|
2958
3057
|
t;
|
2959
3058
|
let ctorExpr = null;
|
2960
3059
|
if (meta.deps !== null) {
|
@@ -3001,7 +3100,7 @@ function compileFactoryFunction(meta) {
|
|
3001
3100
|
}
|
3002
3101
|
else if (baseFactoryVar !== null) {
|
3003
3102
|
// This factory uses a base factory, so call `ɵɵgetInheritedFactory()` to compute it.
|
3004
|
-
const getInheritedFactoryCall = importExpr(Identifiers.getInheritedFactory).callFn([meta.
|
3103
|
+
const getInheritedFactoryCall = importExpr(Identifiers.getInheritedFactory).callFn([meta.type.value]);
|
3005
3104
|
// Memoize the base factoryFn: `baseFactory || (baseFactory = ɵɵgetInheritedFactory(...))`
|
3006
3105
|
const baseFactory = new BinaryOperatorExpr(BinaryOperator.Or, baseFactoryVar, baseFactoryVar.set(getInheritedFactoryCall));
|
3007
3106
|
body.push(new ReturnStatement(baseFactory.callFn([typeForCtor])));
|
@@ -3237,6 +3336,96 @@ class Element$1 {
|
|
3237
3336
|
return visitor.visitElement(this);
|
3238
3337
|
}
|
3239
3338
|
}
|
3339
|
+
class DeferredTrigger {
|
3340
|
+
constructor(sourceSpan) {
|
3341
|
+
this.sourceSpan = sourceSpan;
|
3342
|
+
}
|
3343
|
+
visit(visitor) {
|
3344
|
+
return visitor.visitDeferredTrigger(this);
|
3345
|
+
}
|
3346
|
+
}
|
3347
|
+
class BoundDeferredTrigger extends DeferredTrigger {
|
3348
|
+
constructor(value, sourceSpan) {
|
3349
|
+
super(sourceSpan);
|
3350
|
+
this.value = value;
|
3351
|
+
}
|
3352
|
+
}
|
3353
|
+
class IdleDeferredTrigger extends DeferredTrigger {
|
3354
|
+
}
|
3355
|
+
class ImmediateDeferredTrigger extends DeferredTrigger {
|
3356
|
+
}
|
3357
|
+
class HoverDeferredTrigger extends DeferredTrigger {
|
3358
|
+
}
|
3359
|
+
class TimerDeferredTrigger extends DeferredTrigger {
|
3360
|
+
constructor(delay, sourceSpan) {
|
3361
|
+
super(sourceSpan);
|
3362
|
+
this.delay = delay;
|
3363
|
+
}
|
3364
|
+
}
|
3365
|
+
class InteractionDeferredTrigger extends DeferredTrigger {
|
3366
|
+
constructor(reference, sourceSpan) {
|
3367
|
+
super(sourceSpan);
|
3368
|
+
this.reference = reference;
|
3369
|
+
}
|
3370
|
+
}
|
3371
|
+
class ViewportDeferredTrigger extends DeferredTrigger {
|
3372
|
+
constructor(reference, sourceSpan) {
|
3373
|
+
super(sourceSpan);
|
3374
|
+
this.reference = reference;
|
3375
|
+
}
|
3376
|
+
}
|
3377
|
+
class DeferredBlockPlaceholder {
|
3378
|
+
constructor(children, minimumTime, sourceSpan, startSourceSpan, endSourceSpan) {
|
3379
|
+
this.children = children;
|
3380
|
+
this.minimumTime = minimumTime;
|
3381
|
+
this.sourceSpan = sourceSpan;
|
3382
|
+
this.startSourceSpan = startSourceSpan;
|
3383
|
+
this.endSourceSpan = endSourceSpan;
|
3384
|
+
}
|
3385
|
+
visit(visitor) {
|
3386
|
+
return visitor.visitDeferredBlockPlaceholder(this);
|
3387
|
+
}
|
3388
|
+
}
|
3389
|
+
class DeferredBlockLoading {
|
3390
|
+
constructor(children, afterTime, minimumTime, sourceSpan, startSourceSpan, endSourceSpan) {
|
3391
|
+
this.children = children;
|
3392
|
+
this.afterTime = afterTime;
|
3393
|
+
this.minimumTime = minimumTime;
|
3394
|
+
this.sourceSpan = sourceSpan;
|
3395
|
+
this.startSourceSpan = startSourceSpan;
|
3396
|
+
this.endSourceSpan = endSourceSpan;
|
3397
|
+
}
|
3398
|
+
visit(visitor) {
|
3399
|
+
return visitor.visitDeferredBlockLoading(this);
|
3400
|
+
}
|
3401
|
+
}
|
3402
|
+
class DeferredBlockError {
|
3403
|
+
constructor(children, sourceSpan, startSourceSpan, endSourceSpan) {
|
3404
|
+
this.children = children;
|
3405
|
+
this.sourceSpan = sourceSpan;
|
3406
|
+
this.startSourceSpan = startSourceSpan;
|
3407
|
+
this.endSourceSpan = endSourceSpan;
|
3408
|
+
}
|
3409
|
+
visit(visitor) {
|
3410
|
+
return visitor.visitDeferredBlockError(this);
|
3411
|
+
}
|
3412
|
+
}
|
3413
|
+
class DeferredBlock {
|
3414
|
+
constructor(children, triggers, prefetchTriggers, placeholder, loading, error, sourceSpan, startSourceSpan, endSourceSpan) {
|
3415
|
+
this.children = children;
|
3416
|
+
this.triggers = triggers;
|
3417
|
+
this.prefetchTriggers = prefetchTriggers;
|
3418
|
+
this.placeholder = placeholder;
|
3419
|
+
this.loading = loading;
|
3420
|
+
this.error = error;
|
3421
|
+
this.sourceSpan = sourceSpan;
|
3422
|
+
this.startSourceSpan = startSourceSpan;
|
3423
|
+
this.endSourceSpan = endSourceSpan;
|
3424
|
+
}
|
3425
|
+
visit(visitor) {
|
3426
|
+
return visitor.visitDeferredBlock(this);
|
3427
|
+
}
|
3428
|
+
}
|
3240
3429
|
class Template {
|
3241
3430
|
constructor(
|
3242
3431
|
// tagName is the name of the container element, if applicable.
|
@@ -3342,9 +3531,9 @@ class Message {
|
|
3342
3531
|
this.meaning = meaning;
|
3343
3532
|
this.description = description;
|
3344
3533
|
this.customId = customId;
|
3345
|
-
this.id = this.customId;
|
3346
3534
|
/** The ids to use if there are no custom id and if `i18nLegacyMessageIdFormat` is not empty */
|
3347
3535
|
this.legacyIds = [];
|
3536
|
+
this.id = this.customId;
|
3348
3537
|
this.messageString = serializeMessage(this.nodes);
|
3349
3538
|
if (nodes.length) {
|
3350
3539
|
this.sources = [{
|
@@ -3380,11 +3569,12 @@ class Container {
|
|
3380
3569
|
}
|
3381
3570
|
}
|
3382
3571
|
class Icu {
|
3383
|
-
constructor(expression, type, cases, sourceSpan) {
|
3572
|
+
constructor(expression, type, cases, sourceSpan, expressionPlaceholder) {
|
3384
3573
|
this.expression = expression;
|
3385
3574
|
this.type = type;
|
3386
3575
|
this.cases = cases;
|
3387
3576
|
this.sourceSpan = sourceSpan;
|
3577
|
+
this.expressionPlaceholder = expressionPlaceholder;
|
3388
3578
|
}
|
3389
3579
|
visit(visitor, context) {
|
3390
3580
|
return visitor.visitIcu(this, context);
|
@@ -3719,37 +3909,44 @@ function asLiteral(value) {
|
|
3719
3909
|
}
|
3720
3910
|
return literal(value, INFERRED_TYPE);
|
3721
3911
|
}
|
3722
|
-
function
|
3723
|
-
|
3724
|
-
|
3912
|
+
function conditionallyCreateDirectiveBindingLiteral(map, keepDeclared) {
|
3913
|
+
const keys = Object.getOwnPropertyNames(map);
|
3914
|
+
if (keys.length === 0) {
|
3915
|
+
return null;
|
3725
3916
|
}
|
3726
|
-
return
|
3727
|
-
}
|
3728
|
-
function mapToExpression(map, keepDeclared) {
|
3729
|
-
return literalMap(Object.getOwnPropertyNames(map).map(key => {
|
3730
|
-
// canonical syntax: `dirProp: publicProp`
|
3917
|
+
return literalMap(keys.map(key => {
|
3731
3918
|
const value = map[key];
|
3732
3919
|
let declaredName;
|
3733
3920
|
let publicName;
|
3734
3921
|
let minifiedName;
|
3735
|
-
let
|
3736
|
-
if (
|
3737
|
-
|
3922
|
+
let expressionValue;
|
3923
|
+
if (typeof value === 'string') {
|
3924
|
+
// canonical syntax: `dirProp: publicProp`
|
3925
|
+
declaredName = key;
|
3738
3926
|
minifiedName = key;
|
3739
|
-
|
3927
|
+
publicName = value;
|
3928
|
+
expressionValue = asLiteral(publicName);
|
3740
3929
|
}
|
3741
3930
|
else {
|
3742
|
-
minifiedName =
|
3743
|
-
|
3744
|
-
|
3931
|
+
minifiedName = key;
|
3932
|
+
declaredName = value.classPropertyName;
|
3933
|
+
publicName = value.bindingPropertyName;
|
3934
|
+
if (keepDeclared && (publicName !== declaredName || value.transformFunction != null)) {
|
3935
|
+
const expressionKeys = [asLiteral(publicName), asLiteral(declaredName)];
|
3936
|
+
if (value.transformFunction != null) {
|
3937
|
+
expressionKeys.push(value.transformFunction);
|
3938
|
+
}
|
3939
|
+
expressionValue = literalArr(expressionKeys);
|
3940
|
+
}
|
3941
|
+
else {
|
3942
|
+
expressionValue = asLiteral(publicName);
|
3943
|
+
}
|
3745
3944
|
}
|
3746
3945
|
return {
|
3747
3946
|
key: minifiedName,
|
3748
3947
|
// put quotes around keys that contain potentially unsafe characters
|
3749
3948
|
quoted: UNSAFE_OBJECT_KEY_NAME_REGEXP.test(minifiedName),
|
3750
|
-
value:
|
3751
|
-
literalArr([asLiteral(publicName), asLiteral(declaredName)]) :
|
3752
|
-
asLiteral(publicName)
|
3949
|
+
value: expressionValue,
|
3753
3950
|
};
|
3754
3951
|
}));
|
3755
3952
|
}
|
@@ -3863,7 +4060,6 @@ function compileInjectable(meta, resolveForwardRefs) {
|
|
3863
4060
|
const factoryMeta = {
|
3864
4061
|
name: meta.name,
|
3865
4062
|
type: meta.type,
|
3866
|
-
internalType: meta.internalType,
|
3867
4063
|
typeArgumentCount: meta.typeArgumentCount,
|
3868
4064
|
deps: [],
|
3869
4065
|
target: FactoryTarget$1.Injectable,
|
@@ -3875,7 +4071,7 @@ function compileInjectable(meta, resolveForwardRefs) {
|
|
3875
4071
|
//
|
3876
4072
|
// A special case exists for useClass: Type where Type is the injectable type itself and no
|
3877
4073
|
// deps are specified, in which case 'useClass' is effectively ignored.
|
3878
|
-
const useClassOnSelf = meta.useClass.expression.isEquivalent(meta.
|
4074
|
+
const useClassOnSelf = meta.useClass.expression.isEquivalent(meta.type.value);
|
3879
4075
|
let deps = undefined;
|
3880
4076
|
if (meta.deps !== undefined) {
|
3881
4077
|
deps = meta.deps;
|
@@ -3934,10 +4130,10 @@ function compileInjectable(meta, resolveForwardRefs) {
|
|
3934
4130
|
else {
|
3935
4131
|
result = {
|
3936
4132
|
statements: [],
|
3937
|
-
expression: delegateToFactory(meta.type.value, meta.
|
4133
|
+
expression: delegateToFactory(meta.type.value, meta.type.value, resolveForwardRefs)
|
3938
4134
|
};
|
3939
4135
|
}
|
3940
|
-
const token = meta.
|
4136
|
+
const token = meta.type.value;
|
3941
4137
|
const injectableProps = new DefinitionMap();
|
3942
4138
|
injectableProps.set('token', token);
|
3943
4139
|
injectableProps.set('factory', result.expression);
|
@@ -3956,28 +4152,28 @@ function compileInjectable(meta, resolveForwardRefs) {
|
|
3956
4152
|
function createInjectableType(meta) {
|
3957
4153
|
return new ExpressionType$1(importExpr(Identifiers.InjectableDeclaration, [typeWithParameters(meta.type.type, meta.typeArgumentCount)]));
|
3958
4154
|
}
|
3959
|
-
function delegateToFactory(type,
|
3960
|
-
if (type.node ===
|
4155
|
+
function delegateToFactory(type, useType, unwrapForwardRefs) {
|
4156
|
+
if (type.node === useType.node) {
|
3961
4157
|
// The types are the same, so we can simply delegate directly to the type's factory.
|
3962
4158
|
// ```
|
3963
4159
|
// factory: type.ɵfac
|
3964
4160
|
// ```
|
3965
|
-
return
|
4161
|
+
return useType.prop('ɵfac');
|
3966
4162
|
}
|
3967
4163
|
if (!unwrapForwardRefs) {
|
3968
4164
|
// The type is not wrapped in a `forwardRef()`, so we create a simple factory function that
|
3969
4165
|
// accepts a sub-type as an argument.
|
3970
4166
|
// ```
|
3971
|
-
// factory: function(t) { return
|
4167
|
+
// factory: function(t) { return useType.ɵfac(t); }
|
3972
4168
|
// ```
|
3973
|
-
return createFactoryFunction(
|
4169
|
+
return createFactoryFunction(useType);
|
3974
4170
|
}
|
3975
|
-
// The
|
4171
|
+
// The useType is actually wrapped in a `forwardRef()` so we need to resolve that before
|
3976
4172
|
// calling its factory.
|
3977
4173
|
// ```
|
3978
4174
|
// factory: function(t) { return core.resolveForwardRef(type).ɵfac(t); }
|
3979
4175
|
// ```
|
3980
|
-
const unwrappedType = importExpr(Identifiers.resolveForwardRef).callFn([
|
4176
|
+
const unwrappedType = importExpr(Identifiers.resolveForwardRef).callFn([useType]);
|
3981
4177
|
return createFactoryFunction(unwrappedType);
|
3982
4178
|
}
|
3983
4179
|
function createFactoryFunction(type) {
|
@@ -4385,45 +4581,6 @@ class AbstractJsEmitterVisitor extends AbstractEmitterVisitor {
|
|
4385
4581
|
this.visitAllObjects(param => ctx.print(null, param.name), params, ctx, ',');
|
4386
4582
|
}
|
4387
4583
|
}
|
4388
|
-
|
4389
|
-
/**
|
4390
|
-
* @fileoverview
|
4391
|
-
* A module to facilitate use of a Trusted Types policy within the JIT
|
4392
|
-
* compiler. It lazily constructs the Trusted Types policy, providing helper
|
4393
|
-
* utilities for promoting strings to Trusted Types. When Trusted Types are not
|
4394
|
-
* available, strings are used as a fallback.
|
4395
|
-
* @security All use of this module is security-sensitive and should go through
|
4396
|
-
* security review.
|
4397
|
-
*/
|
4398
|
-
/**
|
4399
|
-
* The Trusted Types policy, or null if Trusted Types are not
|
4400
|
-
* enabled/supported, or undefined if the policy has not been created yet.
|
4401
|
-
*/
|
4402
|
-
let policy;
|
4403
|
-
/**
|
4404
|
-
* Returns the Trusted Types policy, or null if Trusted Types are not
|
4405
|
-
* enabled/supported. The first call to this function will create the policy.
|
4406
|
-
*/
|
4407
|
-
function getPolicy() {
|
4408
|
-
if (policy === undefined) {
|
4409
|
-
policy = null;
|
4410
|
-
if (_global.trustedTypes) {
|
4411
|
-
try {
|
4412
|
-
policy =
|
4413
|
-
_global.trustedTypes.createPolicy('angular#unsafe-jit', {
|
4414
|
-
createScript: (s) => s,
|
4415
|
-
});
|
4416
|
-
}
|
4417
|
-
catch {
|
4418
|
-
// trustedTypes.createPolicy throws if called with a name that is
|
4419
|
-
// already registered, even in report-only mode. Until the API changes,
|
4420
|
-
// catch the error not to break the applications functionally. In such
|
4421
|
-
// cases, the code will fall back to using strings.
|
4422
|
-
}
|
4423
|
-
}
|
4424
|
-
}
|
4425
|
-
return policy;
|
4426
|
-
}
|
4427
4584
|
/**
|
4428
4585
|
* Unsafely promote a string to a TrustedScript, falling back to strings when
|
4429
4586
|
* Trusted Types are not available.
|
@@ -4432,7 +4589,7 @@ function getPolicy() {
|
|
4432
4589
|
* interpreted and executed as a script by a browser, e.g. when calling eval.
|
4433
4590
|
*/
|
4434
4591
|
function trustedScriptFromString(script) {
|
4435
|
-
return
|
4592
|
+
return script;
|
4436
4593
|
}
|
4437
4594
|
/**
|
4438
4595
|
* Unsafely call the Function constructor with the given string arguments.
|
@@ -4674,31 +4831,49 @@ var R3SelectorScopeMode;
|
|
4674
4831
|
*/
|
4675
4832
|
R3SelectorScopeMode[R3SelectorScopeMode["Omit"] = 2] = "Omit";
|
4676
4833
|
})(R3SelectorScopeMode || (R3SelectorScopeMode = {}));
|
4834
|
+
/**
|
4835
|
+
* The type of the NgModule meta data.
|
4836
|
+
* - Global: Used for full and partial compilation modes which mainly includes R3References.
|
4837
|
+
* - Local: Used for the local compilation mode which mainly includes the raw expressions as appears
|
4838
|
+
* in the NgModule decorator.
|
4839
|
+
*/
|
4840
|
+
var R3NgModuleMetadataKind;
|
4841
|
+
(function (R3NgModuleMetadataKind) {
|
4842
|
+
R3NgModuleMetadataKind[R3NgModuleMetadataKind["Global"] = 0] = "Global";
|
4843
|
+
R3NgModuleMetadataKind[R3NgModuleMetadataKind["Local"] = 1] = "Local";
|
4844
|
+
})(R3NgModuleMetadataKind || (R3NgModuleMetadataKind = {}));
|
4677
4845
|
/**
|
4678
4846
|
* Construct an `R3NgModuleDef` for the given `R3NgModuleMetadata`.
|
4679
4847
|
*/
|
4680
4848
|
function compileNgModule(meta) {
|
4681
|
-
const { adjacentType, internalType, bootstrap, declarations, imports, exports, schemas, containsForwardDecls, selectorScopeMode, id } = meta;
|
4682
4849
|
const statements = [];
|
4683
4850
|
const definitionMap = new DefinitionMap();
|
4684
|
-
definitionMap.set('type',
|
4685
|
-
|
4686
|
-
|
4851
|
+
definitionMap.set('type', meta.type.value);
|
4852
|
+
// Assign bootstrap definition
|
4853
|
+
if (meta.kind === R3NgModuleMetadataKind.Global) {
|
4854
|
+
if (meta.bootstrap.length > 0) {
|
4855
|
+
definitionMap.set('bootstrap', refsToArray(meta.bootstrap, meta.containsForwardDecls));
|
4856
|
+
}
|
4857
|
+
}
|
4858
|
+
else {
|
4859
|
+
if (meta.bootstrapExpression) {
|
4860
|
+
definitionMap.set('bootstrap', meta.bootstrapExpression);
|
4861
|
+
}
|
4687
4862
|
}
|
4688
|
-
if (selectorScopeMode === R3SelectorScopeMode.Inline) {
|
4863
|
+
if (meta.selectorScopeMode === R3SelectorScopeMode.Inline) {
|
4689
4864
|
// If requested to emit scope information inline, pass the `declarations`, `imports` and
|
4690
4865
|
// `exports` to the `ɵɵdefineNgModule()` call directly.
|
4691
|
-
if (declarations.length > 0) {
|
4692
|
-
definitionMap.set('declarations', refsToArray(declarations, containsForwardDecls));
|
4866
|
+
if (meta.declarations.length > 0) {
|
4867
|
+
definitionMap.set('declarations', refsToArray(meta.declarations, meta.containsForwardDecls));
|
4693
4868
|
}
|
4694
|
-
if (imports.length > 0) {
|
4695
|
-
definitionMap.set('imports', refsToArray(imports, containsForwardDecls));
|
4869
|
+
if (meta.imports.length > 0) {
|
4870
|
+
definitionMap.set('imports', refsToArray(meta.imports, meta.containsForwardDecls));
|
4696
4871
|
}
|
4697
|
-
if (exports.length > 0) {
|
4698
|
-
definitionMap.set('exports', refsToArray(exports, containsForwardDecls));
|
4872
|
+
if (meta.exports.length > 0) {
|
4873
|
+
definitionMap.set('exports', refsToArray(meta.exports, meta.containsForwardDecls));
|
4699
4874
|
}
|
4700
4875
|
}
|
4701
|
-
else if (selectorScopeMode === R3SelectorScopeMode.SideEffect) {
|
4876
|
+
else if (meta.selectorScopeMode === R3SelectorScopeMode.SideEffect) {
|
4702
4877
|
// In this mode, scope information is not passed into `ɵɵdefineNgModule` as it
|
4703
4878
|
// would prevent tree-shaking of the declarations, imports and exports references. Instead, it's
|
4704
4879
|
// patched onto the NgModule definition with a `ɵɵsetNgModuleScope` call that's guarded by the
|
@@ -4709,14 +4884,14 @@ function compileNgModule(meta) {
|
|
4709
4884
|
}
|
4710
4885
|
}
|
4711
4886
|
else ;
|
4712
|
-
if (schemas !== null && schemas.length > 0) {
|
4713
|
-
definitionMap.set('schemas', literalArr(schemas.map(ref => ref.value)));
|
4887
|
+
if (meta.schemas !== null && meta.schemas.length > 0) {
|
4888
|
+
definitionMap.set('schemas', literalArr(meta.schemas.map(ref => ref.value)));
|
4714
4889
|
}
|
4715
|
-
if (id !== null) {
|
4716
|
-
definitionMap.set('id', id);
|
4890
|
+
if (meta.id !== null) {
|
4891
|
+
definitionMap.set('id', meta.id);
|
4717
4892
|
// Generate a side-effectful call to register this NgModule by its id, as per the semantics of
|
4718
4893
|
// NgModule ids.
|
4719
|
-
statements.push(importExpr(Identifiers.registerNgModuleType).callFn([
|
4894
|
+
statements.push(importExpr(Identifiers.registerNgModuleType).callFn([meta.type.value, meta.id]).toStmt());
|
4720
4895
|
}
|
4721
4896
|
const expression = importExpr(Identifiers.defineNgModule).callFn([definitionMap.toLiteralMap()], undefined, true);
|
4722
4897
|
const type = createNgModuleType(meta);
|
@@ -4749,7 +4924,11 @@ function compileNgModuleDeclarationExpression(meta) {
|
|
4749
4924
|
}
|
4750
4925
|
return importExpr(Identifiers.defineNgModule).callFn([definitionMap.toLiteralMap()]);
|
4751
4926
|
}
|
4752
|
-
function createNgModuleType(
|
4927
|
+
function createNgModuleType(meta) {
|
4928
|
+
if (meta.kind === R3NgModuleMetadataKind.Local) {
|
4929
|
+
return new ExpressionType$1(meta.type.value);
|
4930
|
+
}
|
4931
|
+
const { type: moduleType, declarations, exports, imports, includeImportTypes, publicDeclarationTypes } = meta;
|
4753
4932
|
return new ExpressionType$1(importExpr(Identifiers.NgModuleDeclaration, [
|
4754
4933
|
new ExpressionType$1(moduleType.type),
|
4755
4934
|
publicDeclarationTypes === null ? tupleTypeOf(declarations) :
|
@@ -4765,16 +4944,36 @@ function createNgModuleType({ type: moduleType, declarations, exports, imports,
|
|
4765
4944
|
* symbols to become tree-shakeable.
|
4766
4945
|
*/
|
4767
4946
|
function generateSetNgModuleScopeCall(meta) {
|
4768
|
-
const { adjacentType: moduleType, declarations, imports, exports, containsForwardDecls } = meta;
|
4769
4947
|
const scopeMap = new DefinitionMap();
|
4770
|
-
if (
|
4771
|
-
|
4948
|
+
if (meta.kind === R3NgModuleMetadataKind.Global) {
|
4949
|
+
if (meta.declarations.length > 0) {
|
4950
|
+
scopeMap.set('declarations', refsToArray(meta.declarations, meta.containsForwardDecls));
|
4951
|
+
}
|
4952
|
+
}
|
4953
|
+
else {
|
4954
|
+
if (meta.declarationsExpression) {
|
4955
|
+
scopeMap.set('declarations', meta.declarationsExpression);
|
4956
|
+
}
|
4957
|
+
}
|
4958
|
+
if (meta.kind === R3NgModuleMetadataKind.Global) {
|
4959
|
+
if (meta.imports.length > 0) {
|
4960
|
+
scopeMap.set('imports', refsToArray(meta.imports, meta.containsForwardDecls));
|
4961
|
+
}
|
4772
4962
|
}
|
4773
|
-
|
4774
|
-
|
4963
|
+
else {
|
4964
|
+
if (meta.importsExpression) {
|
4965
|
+
scopeMap.set('imports', meta.importsExpression);
|
4966
|
+
}
|
4967
|
+
}
|
4968
|
+
if (meta.kind === R3NgModuleMetadataKind.Global) {
|
4969
|
+
if (meta.exports.length > 0) {
|
4970
|
+
scopeMap.set('exports', refsToArray(meta.exports, meta.containsForwardDecls));
|
4971
|
+
}
|
4775
4972
|
}
|
4776
|
-
|
4777
|
-
|
4973
|
+
else {
|
4974
|
+
if (meta.exportsExpression) {
|
4975
|
+
scopeMap.set('exports', meta.exportsExpression);
|
4976
|
+
}
|
4778
4977
|
}
|
4779
4978
|
if (Object.keys(scopeMap.values).length === 0) {
|
4780
4979
|
return null;
|
@@ -4782,7 +4981,7 @@ function generateSetNgModuleScopeCall(meta) {
|
|
4782
4981
|
// setNgModuleScope(...)
|
4783
4982
|
const fnCall = new InvokeFunctionExpr(
|
4784
4983
|
/* fn */ importExpr(Identifiers.setNgModuleScope),
|
4785
|
-
/* args */ [
|
4984
|
+
/* args */ [meta.type.value, scopeMap.toLiteralMap()]);
|
4786
4985
|
// (ngJitMode guard) && setNgModuleScope(...)
|
4787
4986
|
const guardedCall = jitOnlyGuardedExpression(fnCall);
|
4788
4987
|
// function() { (ngJitMode guard) && setNgModuleScope(...); }
|
@@ -4870,7 +5069,7 @@ class ASTWithName extends AST {
|
|
4870
5069
|
this.nameSpan = nameSpan;
|
4871
5070
|
}
|
4872
5071
|
}
|
4873
|
-
class EmptyExpr extends AST {
|
5072
|
+
class EmptyExpr$1 extends AST {
|
4874
5073
|
visit(visitor, context = null) {
|
4875
5074
|
// do nothing
|
4876
5075
|
}
|
@@ -5017,7 +5216,7 @@ class LiteralMap extends AST {
|
|
5017
5216
|
return visitor.visitLiteralMap(this, context);
|
5018
5217
|
}
|
5019
5218
|
}
|
5020
|
-
class Interpolation extends AST {
|
5219
|
+
class Interpolation$1 extends AST {
|
5021
5220
|
constructor(span, sourceSpan, strings, expressions) {
|
5022
5221
|
super(span, sourceSpan);
|
5023
5222
|
this.strings = strings;
|
@@ -5264,7 +5463,7 @@ class AstTransformer {
|
|
5264
5463
|
return ast;
|
5265
5464
|
}
|
5266
5465
|
visitInterpolation(ast, context) {
|
5267
|
-
return new Interpolation(ast.span, ast.sourceSpan, ast.strings, this.visitAll(ast.expressions));
|
5466
|
+
return new Interpolation$1(ast.span, ast.sourceSpan, ast.strings, this.visitAll(ast.expressions));
|
5268
5467
|
}
|
5269
5468
|
visitLiteralPrimitive(ast, context) {
|
5270
5469
|
return new LiteralPrimitive(ast.span, ast.sourceSpan, ast.value);
|
@@ -5347,7 +5546,7 @@ class AstMemoryEfficientTransformer {
|
|
5347
5546
|
visitInterpolation(ast, context) {
|
5348
5547
|
const expressions = this.visitAll(ast.expressions);
|
5349
5548
|
if (expressions !== ast.expressions)
|
5350
|
-
return new Interpolation(ast.span, ast.sourceSpan, ast.strings, expressions);
|
5549
|
+
return new Interpolation$1(ast.span, ast.sourceSpan, ast.strings, expressions);
|
5351
5550
|
return ast;
|
5352
5551
|
}
|
5353
5552
|
visitLiteralPrimitive(ast, context) {
|
@@ -5560,8 +5759,8 @@ class BoundElementProperty {
|
|
5560
5759
|
}
|
5561
5760
|
|
5562
5761
|
class EventHandlerVars {
|
5762
|
+
static { this.event = variable('$event'); }
|
5563
5763
|
}
|
5564
|
-
EventHandlerVars.event = variable('$event');
|
5565
5764
|
/**
|
5566
5765
|
* Converts the given expression AST into an executable output AST, assuming the expression is
|
5567
5766
|
* used in an action binding (e.g. an event handler).
|
@@ -6285,6 +6484,7 @@ class InterpolationExpression extends Expression {
|
|
6285
6484
|
this.isConstant = unsupported;
|
6286
6485
|
this.isEquivalent = unsupported;
|
6287
6486
|
this.visitExpression = unsupported;
|
6487
|
+
this.clone = unsupported;
|
6288
6488
|
}
|
6289
6489
|
}
|
6290
6490
|
class DefaultLocalResolver {
|
@@ -6302,7 +6502,7 @@ class DefaultLocalResolver {
|
|
6302
6502
|
}
|
6303
6503
|
class BuiltinFunctionCall extends Call {
|
6304
6504
|
constructor(span, sourceSpan, args, converter) {
|
6305
|
-
super(span, sourceSpan, new EmptyExpr(span, sourceSpan), args, null);
|
6505
|
+
super(span, sourceSpan, new EmptyExpr$1(span, sourceSpan), args, null);
|
6306
6506
|
this.converter = converter;
|
6307
6507
|
}
|
6308
6508
|
}
|
@@ -6539,11 +6739,28 @@ class ShadowCss {
|
|
6539
6739
|
* The hostSelector is the attribute added to the host itself.
|
6540
6740
|
*/
|
6541
6741
|
shimCssText(cssText, selector, hostSelector = '') {
|
6542
|
-
|
6543
|
-
|
6742
|
+
// **NOTE**: Do not strip comments as this will cause component sourcemaps to break
|
6743
|
+
// due to shift in lines.
|
6744
|
+
// Collect comments and replace them with a placeholder, this is done to avoid complicating
|
6745
|
+
// the rule parsing RegExp and keep it safer.
|
6746
|
+
const comments = [];
|
6747
|
+
cssText = cssText.replace(_commentRe, (m) => {
|
6748
|
+
if (m.match(_commentWithHashRe)) {
|
6749
|
+
comments.push(m);
|
6750
|
+
}
|
6751
|
+
else {
|
6752
|
+
// Replace non hash comments with empty lines.
|
6753
|
+
// This is done so that we do not leak any senstive data in comments.
|
6754
|
+
const newLinesMatches = m.match(_newLinesRe);
|
6755
|
+
comments.push((newLinesMatches?.join('') ?? '') + '\n');
|
6756
|
+
}
|
6757
|
+
return COMMENT_PLACEHOLDER;
|
6758
|
+
});
|
6544
6759
|
cssText = this._insertDirectives(cssText);
|
6545
6760
|
const scopedCssText = this._scopeCssText(cssText, selector, hostSelector);
|
6546
|
-
|
6761
|
+
// Add back comments at the original position.
|
6762
|
+
let commentIdx = 0;
|
6763
|
+
return scopedCssText.replace(_commentWithHashPlaceHolderRe, () => comments[commentIdx++]);
|
6547
6764
|
}
|
6548
6765
|
_insertDirectives(cssText) {
|
6549
6766
|
cssText = this._insertPolyfillDirectivesInCssText(cssText);
|
@@ -6784,7 +7001,7 @@ class ShadowCss {
|
|
6784
7001
|
return cssText.replace(_cssColonHostRe, (_, hostSelectors, otherSelectors) => {
|
6785
7002
|
if (hostSelectors) {
|
6786
7003
|
const convertedSelectors = [];
|
6787
|
-
const hostSelectorArray = hostSelectors.split(',').map(p => p.trim());
|
7004
|
+
const hostSelectorArray = hostSelectors.split(',').map((p) => p.trim());
|
6788
7005
|
for (const hostSelector of hostSelectorArray) {
|
6789
7006
|
if (!hostSelector)
|
6790
7007
|
break;
|
@@ -6814,7 +7031,7 @@ class ShadowCss {
|
|
6814
7031
|
* .foo<scopeName> .bar { ... }
|
6815
7032
|
*/
|
6816
7033
|
_convertColonHostContext(cssText) {
|
6817
|
-
return cssText.replace(_cssColonHostContextReGlobal, selectorText => {
|
7034
|
+
return cssText.replace(_cssColonHostContextReGlobal, (selectorText) => {
|
6818
7035
|
// We have captured a selector that contains a `:host-context` rule.
|
6819
7036
|
// For backward compatibility `:host-context` may contain a comma separated list of selectors.
|
6820
7037
|
// Each context selector group will contain a list of host-context selectors that must match
|
@@ -6826,10 +7043,10 @@ class ShadowCss {
|
|
6826
7043
|
// Execute `_cssColonHostContextRe` over and over until we have extracted all the
|
6827
7044
|
// `:host-context` selectors from this selector.
|
6828
7045
|
let match;
|
6829
|
-
while (match = _cssColonHostContextRe.exec(selectorText)) {
|
7046
|
+
while ((match = _cssColonHostContextRe.exec(selectorText))) {
|
6830
7047
|
// `match` = [':host-context(<selectors>)<rest>', <selectors>, <rest>]
|
6831
7048
|
// The `<selectors>` could actually be a comma separated list: `:host-context(.one, .two)`.
|
6832
|
-
const newContextSelectors = (match[1] ?? '').trim().split(',').map(m => m.trim()).filter(m => m !== '');
|
7049
|
+
const newContextSelectors = (match[1] ?? '').trim().split(',').map((m) => m.trim()).filter((m) => m !== '');
|
6833
7050
|
// We must duplicate the current selector group for each of these new selectors.
|
6834
7051
|
// For example if the current groups are:
|
6835
7052
|
// ```
|
@@ -6852,7 +7069,7 @@ class ShadowCss {
|
|
6852
7069
|
repeatGroups(contextSelectorGroups, newContextSelectors.length);
|
6853
7070
|
for (let i = 0; i < newContextSelectors.length; i++) {
|
6854
7071
|
for (let j = 0; j < contextSelectorGroupsLength; j++) {
|
6855
|
-
contextSelectorGroups[j +
|
7072
|
+
contextSelectorGroups[j + i * contextSelectorGroupsLength].push(newContextSelectors[i]);
|
6856
7073
|
}
|
6857
7074
|
}
|
6858
7075
|
// Update the `selectorText` and see repeat to see if there are more `:host-context`s.
|
@@ -6862,7 +7079,7 @@ class ShadowCss {
|
|
6862
7079
|
// selectors that `:host-context` can match. See `combineHostContextSelectors()` for more
|
6863
7080
|
// info about how this is done.
|
6864
7081
|
return contextSelectorGroups
|
6865
|
-
.map(contextSelectors => combineHostContextSelectors(contextSelectors, selectorText))
|
7082
|
+
.map((contextSelectors) => combineHostContextSelectors(contextSelectors, selectorText))
|
6866
7083
|
.join(', ');
|
6867
7084
|
});
|
6868
7085
|
}
|
@@ -6883,7 +7100,7 @@ class ShadowCss {
|
|
6883
7100
|
}
|
6884
7101
|
else if (rule.selector.startsWith('@media') || rule.selector.startsWith('@supports') ||
|
6885
7102
|
rule.selector.startsWith('@document') || rule.selector.startsWith('@layer') ||
|
6886
|
-
rule.selector.startsWith('@container')) {
|
7103
|
+
rule.selector.startsWith('@container') || rule.selector.startsWith('@scope')) {
|
6887
7104
|
content = this._scopeSelectors(rule.content, scopeSelector, hostSelector);
|
6888
7105
|
}
|
6889
7106
|
else if (rule.selector.startsWith('@font-face') || rule.selector.startsWith('@page')) {
|
@@ -6914,7 +7131,7 @@ class ShadowCss {
|
|
6914
7131
|
* ```
|
6915
7132
|
*/
|
6916
7133
|
_stripScopingSelectors(cssText) {
|
6917
|
-
return processRules(cssText, rule => {
|
7134
|
+
return processRules(cssText, (rule) => {
|
6918
7135
|
const selector = rule.selector.replace(_shadowDeepSelectors, ' ')
|
6919
7136
|
.replace(_polyfillHostNoCombinatorRe, ' ');
|
6920
7137
|
return new CssRule(selector, rule.content);
|
@@ -6922,7 +7139,7 @@ class ShadowCss {
|
|
6922
7139
|
}
|
6923
7140
|
_scopeSelector(selector, scopeSelector, hostSelector) {
|
6924
7141
|
return selector.split(',')
|
6925
|
-
.map(part => part.trim().split(_shadowDeepSelectors))
|
7142
|
+
.map((part) => part.trim().split(_shadowDeepSelectors))
|
6926
7143
|
.map((deepParts) => {
|
6927
7144
|
const [shallowPart, ...otherParts] = deepParts;
|
6928
7145
|
const applyScope = (shallowPart) => {
|
@@ -7105,17 +7322,14 @@ const _selectorReSuffix = '([>\\s~+[.,{:][\\s\\S]*)?$';
|
|
7105
7322
|
const _polyfillHostRe = /-shadowcsshost/gim;
|
7106
7323
|
const _colonHostRe = /:host/gim;
|
7107
7324
|
const _colonHostContextRe = /:host-context/gim;
|
7325
|
+
const _newLinesRe = /\r?\n/g;
|
7108
7326
|
const _commentRe = /\/\*[\s\S]*?\*\//g;
|
7327
|
+
const _commentWithHashRe = /\/\*\s*#\s*source(Mapping)?URL=/g;
|
7328
|
+
const COMMENT_PLACEHOLDER = '%COMMENT%';
|
7329
|
+
const _commentWithHashPlaceHolderRe = new RegExp(COMMENT_PLACEHOLDER, 'g');
|
7109
7330
|
const _placeholderRe = /__ph-(\d+)__/g;
|
7110
|
-
function stripComments(input) {
|
7111
|
-
return input.replace(_commentRe, '');
|
7112
|
-
}
|
7113
|
-
const _commentWithHashRe = /\/\*\s*#\s*source(Mapping)?URL=[\s\S]+?\*\//g;
|
7114
|
-
function extractCommentsWithHash(input) {
|
7115
|
-
return input.match(_commentWithHashRe) || [];
|
7116
|
-
}
|
7117
7331
|
const BLOCK_PLACEHOLDER = '%BLOCK%';
|
7118
|
-
const _ruleRe =
|
7332
|
+
const _ruleRe = new RegExp(`(\\s*(?:${COMMENT_PLACEHOLDER}\\s*)*)([^;\\{\\}]+?)(\\s*)((?:{%BLOCK%}?\\s*;?)|(?:\\s*;))`, 'g');
|
7119
7333
|
const CONTENT_PAIRS = new Map([['{', '}']]);
|
7120
7334
|
const COMMA_IN_PLACEHOLDER = '%COMMA_IN_PLACEHOLDER%';
|
7121
7335
|
const SEMI_IN_PLACEHOLDER = '%SEMI_IN_PLACEHOLDER%';
|
@@ -7324,7 +7538,6 @@ function unescapeQuotes(str, isQuoted) {
|
|
7324
7538
|
*
|
7325
7539
|
* And so on...
|
7326
7540
|
*
|
7327
|
-
* @param hostMarker the string that selects the host element.
|
7328
7541
|
* @param contextSelectors an array of context selectors that will be combined.
|
7329
7542
|
* @param otherSelectors the rest of the selectors that are not context selectors.
|
7330
7543
|
*/
|
@@ -7378,24 +7591,754 @@ function repeatGroups(groups, multiples) {
|
|
7378
7591
|
}
|
7379
7592
|
}
|
7380
7593
|
|
7594
|
+
var TagContentType;
|
7595
|
+
(function (TagContentType) {
|
7596
|
+
TagContentType[TagContentType["RAW_TEXT"] = 0] = "RAW_TEXT";
|
7597
|
+
TagContentType[TagContentType["ESCAPABLE_RAW_TEXT"] = 1] = "ESCAPABLE_RAW_TEXT";
|
7598
|
+
TagContentType[TagContentType["PARSABLE_DATA"] = 2] = "PARSABLE_DATA";
|
7599
|
+
})(TagContentType || (TagContentType = {}));
|
7600
|
+
function splitNsName(elementName) {
|
7601
|
+
if (elementName[0] != ':') {
|
7602
|
+
return [null, elementName];
|
7603
|
+
}
|
7604
|
+
const colonIndex = elementName.indexOf(':', 1);
|
7605
|
+
if (colonIndex === -1) {
|
7606
|
+
throw new Error(`Unsupported format "${elementName}" expecting ":namespace:name"`);
|
7607
|
+
}
|
7608
|
+
return [elementName.slice(1, colonIndex), elementName.slice(colonIndex + 1)];
|
7609
|
+
}
|
7610
|
+
// `<ng-container>` tags work the same regardless the namespace
|
7611
|
+
function isNgContainer(tagName) {
|
7612
|
+
return splitNsName(tagName)[1] === 'ng-container';
|
7613
|
+
}
|
7614
|
+
// `<ng-content>` tags work the same regardless the namespace
|
7615
|
+
function isNgContent(tagName) {
|
7616
|
+
return splitNsName(tagName)[1] === 'ng-content';
|
7617
|
+
}
|
7618
|
+
// `<ng-template>` tags work the same regardless the namespace
|
7619
|
+
function isNgTemplate(tagName) {
|
7620
|
+
return splitNsName(tagName)[1] === 'ng-template';
|
7621
|
+
}
|
7622
|
+
function getNsPrefix(fullName) {
|
7623
|
+
return fullName === null ? null : splitNsName(fullName)[0];
|
7624
|
+
}
|
7625
|
+
function mergeNsAndName(prefix, localName) {
|
7626
|
+
return prefix ? `:${prefix}:${localName}` : localName;
|
7627
|
+
}
|
7628
|
+
|
7381
7629
|
/**
|
7382
|
-
*
|
7383
|
-
*
|
7384
|
-
* @param value string representation of style as used in the `style` attribute in HTML.
|
7385
|
-
* Example: `color: red; height: auto`.
|
7386
|
-
* @returns An array of style property name and value pairs, e.g. `['color', 'red', 'height',
|
7387
|
-
* 'auto']`
|
7630
|
+
* Enumeration of the types of attributes which can be applied to an element.
|
7388
7631
|
*/
|
7389
|
-
|
7390
|
-
|
7391
|
-
|
7392
|
-
|
7393
|
-
|
7394
|
-
|
7395
|
-
|
7396
|
-
|
7397
|
-
|
7398
|
-
|
7632
|
+
var BindingKind;
|
7633
|
+
(function (BindingKind) {
|
7634
|
+
/**
|
7635
|
+
* Static attributes.
|
7636
|
+
*/
|
7637
|
+
BindingKind[BindingKind["Attribute"] = 0] = "Attribute";
|
7638
|
+
/**
|
7639
|
+
* Class bindings.
|
7640
|
+
*/
|
7641
|
+
BindingKind[BindingKind["ClassName"] = 1] = "ClassName";
|
7642
|
+
/**
|
7643
|
+
* Style bindings.
|
7644
|
+
*/
|
7645
|
+
BindingKind[BindingKind["StyleProperty"] = 2] = "StyleProperty";
|
7646
|
+
/**
|
7647
|
+
* Dynamic property bindings.
|
7648
|
+
*/
|
7649
|
+
BindingKind[BindingKind["Property"] = 3] = "Property";
|
7650
|
+
/**
|
7651
|
+
* Property or attribute bindings on a template.
|
7652
|
+
*/
|
7653
|
+
BindingKind[BindingKind["Template"] = 4] = "Template";
|
7654
|
+
/**
|
7655
|
+
* Internationalized attributes.
|
7656
|
+
*/
|
7657
|
+
BindingKind[BindingKind["I18n"] = 5] = "I18n";
|
7658
|
+
/**
|
7659
|
+
* TODO: Consider how Animations are handled, and if they should be a distinct BindingKind.
|
7660
|
+
*/
|
7661
|
+
BindingKind[BindingKind["Animation"] = 6] = "Animation";
|
7662
|
+
})(BindingKind || (BindingKind = {}));
|
7663
|
+
|
7664
|
+
/**
|
7665
|
+
* Distinguishes different kinds of IR operations.
|
7666
|
+
*
|
7667
|
+
* Includes both creation and update operations.
|
7668
|
+
*/
|
7669
|
+
var OpKind;
|
7670
|
+
(function (OpKind) {
|
7671
|
+
/**
|
7672
|
+
* A special operation type which is used to represent the beginning and end nodes of a linked
|
7673
|
+
* list of operations.
|
7674
|
+
*/
|
7675
|
+
OpKind[OpKind["ListEnd"] = 0] = "ListEnd";
|
7676
|
+
/**
|
7677
|
+
* An operation which wraps an output AST statement.
|
7678
|
+
*/
|
7679
|
+
OpKind[OpKind["Statement"] = 1] = "Statement";
|
7680
|
+
/**
|
7681
|
+
* An operation which declares and initializes a `SemanticVariable`.
|
7682
|
+
*/
|
7683
|
+
OpKind[OpKind["Variable"] = 2] = "Variable";
|
7684
|
+
/**
|
7685
|
+
* An operation to begin rendering of an element.
|
7686
|
+
*/
|
7687
|
+
OpKind[OpKind["ElementStart"] = 3] = "ElementStart";
|
7688
|
+
/**
|
7689
|
+
* An operation to render an element with no children.
|
7690
|
+
*/
|
7691
|
+
OpKind[OpKind["Element"] = 4] = "Element";
|
7692
|
+
/**
|
7693
|
+
* An operation which declares an embedded view.
|
7694
|
+
*/
|
7695
|
+
OpKind[OpKind["Template"] = 5] = "Template";
|
7696
|
+
/**
|
7697
|
+
* An operation to end rendering of an element previously started with `ElementStart`.
|
7698
|
+
*/
|
7699
|
+
OpKind[OpKind["ElementEnd"] = 6] = "ElementEnd";
|
7700
|
+
/**
|
7701
|
+
* An operation to begin an `ng-container`.
|
7702
|
+
*/
|
7703
|
+
OpKind[OpKind["ContainerStart"] = 7] = "ContainerStart";
|
7704
|
+
/**
|
7705
|
+
* An operation for an `ng-container` with no children.
|
7706
|
+
*/
|
7707
|
+
OpKind[OpKind["Container"] = 8] = "Container";
|
7708
|
+
/**
|
7709
|
+
* An operation to end an `ng-container`.
|
7710
|
+
*/
|
7711
|
+
OpKind[OpKind["ContainerEnd"] = 9] = "ContainerEnd";
|
7712
|
+
/**
|
7713
|
+
* An operation disable binding for subsequent elements, which are descendants of a non-bindable
|
7714
|
+
* node.
|
7715
|
+
*/
|
7716
|
+
OpKind[OpKind["DisableBindings"] = 10] = "DisableBindings";
|
7717
|
+
/**
|
7718
|
+
* An operation to re-enable binding, after it was previously disabled.
|
7719
|
+
*/
|
7720
|
+
OpKind[OpKind["EnableBindings"] = 11] = "EnableBindings";
|
7721
|
+
/**
|
7722
|
+
* An operation to render a text node.
|
7723
|
+
*/
|
7724
|
+
OpKind[OpKind["Text"] = 12] = "Text";
|
7725
|
+
/**
|
7726
|
+
* An operation declaring an event listener for an element.
|
7727
|
+
*/
|
7728
|
+
OpKind[OpKind["Listener"] = 13] = "Listener";
|
7729
|
+
/**
|
7730
|
+
* An operation to interpolate text into a text node.
|
7731
|
+
*/
|
7732
|
+
OpKind[OpKind["InterpolateText"] = 14] = "InterpolateText";
|
7733
|
+
/**
|
7734
|
+
* An intermediate binding op, that has not yet been processed into an individual property,
|
7735
|
+
* attribute, style, etc.
|
7736
|
+
*/
|
7737
|
+
OpKind[OpKind["Binding"] = 15] = "Binding";
|
7738
|
+
/**
|
7739
|
+
* An operation to bind an expression to a property of an element.
|
7740
|
+
*/
|
7741
|
+
OpKind[OpKind["Property"] = 16] = "Property";
|
7742
|
+
/**
|
7743
|
+
* An operation to bind an expression to a style property of an element.
|
7744
|
+
*/
|
7745
|
+
OpKind[OpKind["StyleProp"] = 17] = "StyleProp";
|
7746
|
+
/**
|
7747
|
+
* An operation to bind an expression to a class property of an element.
|
7748
|
+
*/
|
7749
|
+
OpKind[OpKind["ClassProp"] = 18] = "ClassProp";
|
7750
|
+
/**
|
7751
|
+
* An operation to bind an expression to the styles of an element.
|
7752
|
+
*/
|
7753
|
+
OpKind[OpKind["StyleMap"] = 19] = "StyleMap";
|
7754
|
+
/**
|
7755
|
+
* An operation to bind an expression to the classes of an element.
|
7756
|
+
*/
|
7757
|
+
OpKind[OpKind["ClassMap"] = 20] = "ClassMap";
|
7758
|
+
/**
|
7759
|
+
* An operation to advance the runtime's implicit slot context during the update phase of a view.
|
7760
|
+
*/
|
7761
|
+
OpKind[OpKind["Advance"] = 21] = "Advance";
|
7762
|
+
/**
|
7763
|
+
* An operation to instantiate a pipe.
|
7764
|
+
*/
|
7765
|
+
OpKind[OpKind["Pipe"] = 22] = "Pipe";
|
7766
|
+
/**
|
7767
|
+
* An operation to associate an attribute with an element.
|
7768
|
+
*/
|
7769
|
+
OpKind[OpKind["Attribute"] = 23] = "Attribute";
|
7770
|
+
/**
|
7771
|
+
* A host binding property.
|
7772
|
+
*/
|
7773
|
+
OpKind[OpKind["HostProperty"] = 24] = "HostProperty";
|
7774
|
+
/**
|
7775
|
+
* A namespace change, which causes the subsequent elements to be processed as either HTML or SVG.
|
7776
|
+
*/
|
7777
|
+
OpKind[OpKind["Namespace"] = 25] = "Namespace";
|
7778
|
+
// TODO: Add Host Listeners, and possibly other host ops also.
|
7779
|
+
})(OpKind || (OpKind = {}));
|
7780
|
+
/**
|
7781
|
+
* Distinguishes different kinds of IR expressions.
|
7782
|
+
*/
|
7783
|
+
var ExpressionKind;
|
7784
|
+
(function (ExpressionKind) {
|
7785
|
+
/**
|
7786
|
+
* Read of a variable in a lexical scope.
|
7787
|
+
*/
|
7788
|
+
ExpressionKind[ExpressionKind["LexicalRead"] = 0] = "LexicalRead";
|
7789
|
+
/**
|
7790
|
+
* A reference to the current view context.
|
7791
|
+
*/
|
7792
|
+
ExpressionKind[ExpressionKind["Context"] = 1] = "Context";
|
7793
|
+
/**
|
7794
|
+
* Read of a variable declared in a `VariableOp`.
|
7795
|
+
*/
|
7796
|
+
ExpressionKind[ExpressionKind["ReadVariable"] = 2] = "ReadVariable";
|
7797
|
+
/**
|
7798
|
+
* Runtime operation to navigate to the next view context in the view hierarchy.
|
7799
|
+
*/
|
7800
|
+
ExpressionKind[ExpressionKind["NextContext"] = 3] = "NextContext";
|
7801
|
+
/**
|
7802
|
+
* Runtime operation to retrieve the value of a local reference.
|
7803
|
+
*/
|
7804
|
+
ExpressionKind[ExpressionKind["Reference"] = 4] = "Reference";
|
7805
|
+
/**
|
7806
|
+
* Runtime operation to snapshot the current view context.
|
7807
|
+
*/
|
7808
|
+
ExpressionKind[ExpressionKind["GetCurrentView"] = 5] = "GetCurrentView";
|
7809
|
+
/**
|
7810
|
+
* Runtime operation to restore a snapshotted view.
|
7811
|
+
*/
|
7812
|
+
ExpressionKind[ExpressionKind["RestoreView"] = 6] = "RestoreView";
|
7813
|
+
/**
|
7814
|
+
* Runtime operation to reset the current view context after `RestoreView`.
|
7815
|
+
*/
|
7816
|
+
ExpressionKind[ExpressionKind["ResetView"] = 7] = "ResetView";
|
7817
|
+
/**
|
7818
|
+
* Defines and calls a function with change-detected arguments.
|
7819
|
+
*/
|
7820
|
+
ExpressionKind[ExpressionKind["PureFunctionExpr"] = 8] = "PureFunctionExpr";
|
7821
|
+
/**
|
7822
|
+
* Indicates a positional parameter to a pure function definition.
|
7823
|
+
*/
|
7824
|
+
ExpressionKind[ExpressionKind["PureFunctionParameterExpr"] = 9] = "PureFunctionParameterExpr";
|
7825
|
+
/**
|
7826
|
+
* Binding to a pipe transformation.
|
7827
|
+
*/
|
7828
|
+
ExpressionKind[ExpressionKind["PipeBinding"] = 10] = "PipeBinding";
|
7829
|
+
/**
|
7830
|
+
* Binding to a pipe transformation with a variable number of arguments.
|
7831
|
+
*/
|
7832
|
+
ExpressionKind[ExpressionKind["PipeBindingVariadic"] = 11] = "PipeBindingVariadic";
|
7833
|
+
/*
|
7834
|
+
* A safe property read requiring expansion into a null check.
|
7835
|
+
*/
|
7836
|
+
ExpressionKind[ExpressionKind["SafePropertyRead"] = 12] = "SafePropertyRead";
|
7837
|
+
/**
|
7838
|
+
* A safe keyed read requiring expansion into a null check.
|
7839
|
+
*/
|
7840
|
+
ExpressionKind[ExpressionKind["SafeKeyedRead"] = 13] = "SafeKeyedRead";
|
7841
|
+
/**
|
7842
|
+
* A safe function call requiring expansion into a null check.
|
7843
|
+
*/
|
7844
|
+
ExpressionKind[ExpressionKind["SafeInvokeFunction"] = 14] = "SafeInvokeFunction";
|
7845
|
+
/**
|
7846
|
+
* An intermediate expression that will be expanded from a safe read into an explicit ternary.
|
7847
|
+
*/
|
7848
|
+
ExpressionKind[ExpressionKind["SafeTernaryExpr"] = 15] = "SafeTernaryExpr";
|
7849
|
+
/**
|
7850
|
+
* An empty expression that will be stipped before generating the final output.
|
7851
|
+
*/
|
7852
|
+
ExpressionKind[ExpressionKind["EmptyExpr"] = 16] = "EmptyExpr";
|
7853
|
+
/*
|
7854
|
+
* An assignment to a temporary variable.
|
7855
|
+
*/
|
7856
|
+
ExpressionKind[ExpressionKind["AssignTemporaryExpr"] = 17] = "AssignTemporaryExpr";
|
7857
|
+
/**
|
7858
|
+
* A reference to a temporary variable.
|
7859
|
+
*/
|
7860
|
+
ExpressionKind[ExpressionKind["ReadTemporaryExpr"] = 18] = "ReadTemporaryExpr";
|
7861
|
+
/**
|
7862
|
+
* An expression representing a sanitizer function.
|
7863
|
+
*/
|
7864
|
+
ExpressionKind[ExpressionKind["SanitizerExpr"] = 19] = "SanitizerExpr";
|
7865
|
+
})(ExpressionKind || (ExpressionKind = {}));
|
7866
|
+
/**
|
7867
|
+
* Distinguishes between different kinds of `SemanticVariable`s.
|
7868
|
+
*/
|
7869
|
+
var SemanticVariableKind;
|
7870
|
+
(function (SemanticVariableKind) {
|
7871
|
+
/**
|
7872
|
+
* Represents the context of a particular view.
|
7873
|
+
*/
|
7874
|
+
SemanticVariableKind[SemanticVariableKind["Context"] = 0] = "Context";
|
7875
|
+
/**
|
7876
|
+
* Represents an identifier declared in the lexical scope of a view.
|
7877
|
+
*/
|
7878
|
+
SemanticVariableKind[SemanticVariableKind["Identifier"] = 1] = "Identifier";
|
7879
|
+
/**
|
7880
|
+
* Represents a saved state that can be used to restore a view in a listener handler function.
|
7881
|
+
*/
|
7882
|
+
SemanticVariableKind[SemanticVariableKind["SavedView"] = 2] = "SavedView";
|
7883
|
+
})(SemanticVariableKind || (SemanticVariableKind = {}));
|
7884
|
+
/**
|
7885
|
+
* Whether to compile in compatibilty mode. In compatibility mode, the template pipeline will
|
7886
|
+
* attempt to match the output of `TemplateDefinitionBuilder` as exactly as possible, at the cost of
|
7887
|
+
* producing quirky or larger code in some cases.
|
7888
|
+
*/
|
7889
|
+
var CompatibilityMode;
|
7890
|
+
(function (CompatibilityMode) {
|
7891
|
+
CompatibilityMode[CompatibilityMode["Normal"] = 0] = "Normal";
|
7892
|
+
CompatibilityMode[CompatibilityMode["TemplateDefinitionBuilder"] = 1] = "TemplateDefinitionBuilder";
|
7893
|
+
})(CompatibilityMode || (CompatibilityMode = {}));
|
7894
|
+
/**
|
7895
|
+
* Represents functions used to sanitize different pieces of a template.
|
7896
|
+
*/
|
7897
|
+
var SanitizerFn;
|
7898
|
+
(function (SanitizerFn) {
|
7899
|
+
SanitizerFn[SanitizerFn["Html"] = 0] = "Html";
|
7900
|
+
SanitizerFn[SanitizerFn["Script"] = 1] = "Script";
|
7901
|
+
SanitizerFn[SanitizerFn["Style"] = 2] = "Style";
|
7902
|
+
SanitizerFn[SanitizerFn["Url"] = 3] = "Url";
|
7903
|
+
SanitizerFn[SanitizerFn["ResourceUrl"] = 4] = "ResourceUrl";
|
7904
|
+
SanitizerFn[SanitizerFn["IframeAttribute"] = 5] = "IframeAttribute";
|
7905
|
+
})(SanitizerFn || (SanitizerFn = {}));
|
7906
|
+
/**
|
7907
|
+
* Marker symbol for `UsesSlotIndex` trait.
|
7908
|
+
*/
|
7909
|
+
const UsesSlotIndex = Symbol('UsesSlotIndex');
|
7910
|
+
/**
|
7911
|
+
* Marker symbol for `ConsumesVars` trait.
|
7912
|
+
*/
|
7913
|
+
const ConsumesVarsTrait = Symbol('ConsumesVars');
|
7914
|
+
/**
|
7915
|
+
* Marker symbol for `UsesVarOffset` trait.
|
7916
|
+
*/
|
7917
|
+
const UsesVarOffset = Symbol('UsesVarOffset');
|
7918
|
+
class Interpolation {
|
7919
|
+
constructor(strings, expressions) {
|
7920
|
+
this.strings = strings;
|
7921
|
+
this.expressions = expressions;
|
7922
|
+
}
|
7923
|
+
}
|
7924
|
+
|
7925
|
+
var _d, _e, _f;
|
7926
|
+
/**
|
7927
|
+
* Base type used for all logical IR expressions.
|
7928
|
+
*/
|
7929
|
+
class ExpressionBase extends Expression {
|
7930
|
+
constructor(sourceSpan = null) {
|
7931
|
+
super(null, sourceSpan);
|
7932
|
+
}
|
7933
|
+
}
|
7934
|
+
class PipeBindingExpr extends ExpressionBase {
|
7935
|
+
static { _d = UsesSlotIndex, _e = ConsumesVarsTrait, _f = UsesVarOffset; }
|
7936
|
+
constructor(target, name, args) {
|
7937
|
+
super();
|
7938
|
+
this.target = target;
|
7939
|
+
this.name = name;
|
7940
|
+
this.args = args;
|
7941
|
+
this.kind = ExpressionKind.PipeBinding;
|
7942
|
+
this[_d] = true;
|
7943
|
+
this[_e] = true;
|
7944
|
+
this[_f] = true;
|
7945
|
+
this.slot = null;
|
7946
|
+
this.varOffset = null;
|
7947
|
+
}
|
7948
|
+
visitExpression(visitor, context) {
|
7949
|
+
for (const arg of this.args) {
|
7950
|
+
arg.visitExpression(visitor, context);
|
7951
|
+
}
|
7952
|
+
}
|
7953
|
+
isEquivalent() {
|
7954
|
+
return false;
|
7955
|
+
}
|
7956
|
+
isConstant() {
|
7957
|
+
return false;
|
7958
|
+
}
|
7959
|
+
transformInternalExpressions(transform, flags) {
|
7960
|
+
for (let idx = 0; idx < this.args.length; idx++) {
|
7961
|
+
this.args[idx] = transformExpressionsInExpression(this.args[idx], transform, flags);
|
7962
|
+
}
|
7963
|
+
}
|
7964
|
+
clone() {
|
7965
|
+
const r = new PipeBindingExpr(this.target, this.name, this.args.map(a => a.clone()));
|
7966
|
+
r.slot = this.slot;
|
7967
|
+
r.varOffset = this.varOffset;
|
7968
|
+
return r;
|
7969
|
+
}
|
7970
|
+
}
|
7971
|
+
class SafeInvokeFunctionExpr extends ExpressionBase {
|
7972
|
+
constructor(receiver, args) {
|
7973
|
+
super();
|
7974
|
+
this.receiver = receiver;
|
7975
|
+
this.args = args;
|
7976
|
+
this.kind = ExpressionKind.SafeInvokeFunction;
|
7977
|
+
}
|
7978
|
+
visitExpression(visitor, context) {
|
7979
|
+
this.receiver.visitExpression(visitor, context);
|
7980
|
+
for (const a of this.args) {
|
7981
|
+
a.visitExpression(visitor, context);
|
7982
|
+
}
|
7983
|
+
}
|
7984
|
+
isEquivalent() {
|
7985
|
+
return false;
|
7986
|
+
}
|
7987
|
+
isConstant() {
|
7988
|
+
return false;
|
7989
|
+
}
|
7990
|
+
transformInternalExpressions(transform, flags) {
|
7991
|
+
this.receiver = transformExpressionsInExpression(this.receiver, transform, flags);
|
7992
|
+
for (let i = 0; i < this.args.length; i++) {
|
7993
|
+
this.args[i] = transformExpressionsInExpression(this.args[i], transform, flags);
|
7994
|
+
}
|
7995
|
+
}
|
7996
|
+
clone() {
|
7997
|
+
return new SafeInvokeFunctionExpr(this.receiver.clone(), this.args.map(a => a.clone()));
|
7998
|
+
}
|
7999
|
+
}
|
8000
|
+
var VisitorContextFlag;
|
8001
|
+
(function (VisitorContextFlag) {
|
8002
|
+
VisitorContextFlag[VisitorContextFlag["None"] = 0] = "None";
|
8003
|
+
VisitorContextFlag[VisitorContextFlag["InChildOperation"] = 1] = "InChildOperation";
|
8004
|
+
})(VisitorContextFlag || (VisitorContextFlag = {}));
|
8005
|
+
/**
|
8006
|
+
* Transform all `Expression`s in the AST of `expr` with the `transform` function.
|
8007
|
+
*
|
8008
|
+
* All such operations will be replaced with the result of applying `transform`, which may be an
|
8009
|
+
* identity transformation.
|
8010
|
+
*/
|
8011
|
+
function transformExpressionsInExpression(expr, transform, flags) {
|
8012
|
+
if (expr instanceof ExpressionBase) {
|
8013
|
+
expr.transformInternalExpressions(transform, flags);
|
8014
|
+
}
|
8015
|
+
else if (expr instanceof BinaryOperatorExpr) {
|
8016
|
+
expr.lhs = transformExpressionsInExpression(expr.lhs, transform, flags);
|
8017
|
+
expr.rhs = transformExpressionsInExpression(expr.rhs, transform, flags);
|
8018
|
+
}
|
8019
|
+
else if (expr instanceof ReadPropExpr) {
|
8020
|
+
expr.receiver = transformExpressionsInExpression(expr.receiver, transform, flags);
|
8021
|
+
}
|
8022
|
+
else if (expr instanceof ReadKeyExpr) {
|
8023
|
+
expr.receiver = transformExpressionsInExpression(expr.receiver, transform, flags);
|
8024
|
+
expr.index = transformExpressionsInExpression(expr.index, transform, flags);
|
8025
|
+
}
|
8026
|
+
else if (expr instanceof WritePropExpr) {
|
8027
|
+
expr.receiver = transformExpressionsInExpression(expr.receiver, transform, flags);
|
8028
|
+
expr.value = transformExpressionsInExpression(expr.value, transform, flags);
|
8029
|
+
}
|
8030
|
+
else if (expr instanceof WriteKeyExpr) {
|
8031
|
+
expr.receiver = transformExpressionsInExpression(expr.receiver, transform, flags);
|
8032
|
+
expr.index = transformExpressionsInExpression(expr.index, transform, flags);
|
8033
|
+
expr.value = transformExpressionsInExpression(expr.value, transform, flags);
|
8034
|
+
}
|
8035
|
+
else if (expr instanceof InvokeFunctionExpr) {
|
8036
|
+
expr.fn = transformExpressionsInExpression(expr.fn, transform, flags);
|
8037
|
+
for (let i = 0; i < expr.args.length; i++) {
|
8038
|
+
expr.args[i] = transformExpressionsInExpression(expr.args[i], transform, flags);
|
8039
|
+
}
|
8040
|
+
}
|
8041
|
+
else if (expr instanceof LiteralArrayExpr) {
|
8042
|
+
for (let i = 0; i < expr.entries.length; i++) {
|
8043
|
+
expr.entries[i] = transformExpressionsInExpression(expr.entries[i], transform, flags);
|
8044
|
+
}
|
8045
|
+
}
|
8046
|
+
else if (expr instanceof LiteralMapExpr) {
|
8047
|
+
for (let i = 0; i < expr.entries.length; i++) {
|
8048
|
+
expr.entries[i].value =
|
8049
|
+
transformExpressionsInExpression(expr.entries[i].value, transform, flags);
|
8050
|
+
}
|
8051
|
+
}
|
8052
|
+
else if (expr instanceof ConditionalExpr) {
|
8053
|
+
expr.condition = transformExpressionsInExpression(expr.condition, transform, flags);
|
8054
|
+
expr.trueCase = transformExpressionsInExpression(expr.trueCase, transform, flags);
|
8055
|
+
if (expr.falseCase !== null) {
|
8056
|
+
expr.falseCase = transformExpressionsInExpression(expr.falseCase, transform, flags);
|
8057
|
+
}
|
8058
|
+
}
|
8059
|
+
else if (expr instanceof ReadVarExpr || expr instanceof ExternalExpr ||
|
8060
|
+
expr instanceof LiteralExpr) ;
|
8061
|
+
else {
|
8062
|
+
throw new Error(`Unhandled expression kind: ${expr.constructor.name}`);
|
8063
|
+
}
|
8064
|
+
return transform(expr, flags);
|
8065
|
+
}
|
8066
|
+
|
8067
|
+
/**
|
8068
|
+
* A linked list of `Op` nodes of a given subtype.
|
8069
|
+
*
|
8070
|
+
* @param OpT specific subtype of `Op` nodes which this list contains.
|
8071
|
+
*/
|
8072
|
+
class OpList {
|
8073
|
+
static { this.nextListId = 0; }
|
8074
|
+
constructor() {
|
8075
|
+
/**
|
8076
|
+
* Debug ID of this `OpList` instance.
|
8077
|
+
*/
|
8078
|
+
this.debugListId = OpList.nextListId++;
|
8079
|
+
// OpList uses static head/tail nodes of a special `ListEnd` type.
|
8080
|
+
// This avoids the need for special casing of the first and last list
|
8081
|
+
// elements in all list operations.
|
8082
|
+
this.head = {
|
8083
|
+
kind: OpKind.ListEnd,
|
8084
|
+
next: null,
|
8085
|
+
prev: null,
|
8086
|
+
debugListId: this.debugListId,
|
8087
|
+
};
|
8088
|
+
this.tail = {
|
8089
|
+
kind: OpKind.ListEnd,
|
8090
|
+
next: null,
|
8091
|
+
prev: null,
|
8092
|
+
debugListId: this.debugListId,
|
8093
|
+
};
|
8094
|
+
// Link `head` and `tail` together at the start (list is empty).
|
8095
|
+
this.head.next = this.tail;
|
8096
|
+
this.tail.prev = this.head;
|
8097
|
+
}
|
8098
|
+
/**
|
8099
|
+
* Push a new operation to the tail of the list.
|
8100
|
+
*/
|
8101
|
+
push(op) {
|
8102
|
+
OpList.assertIsNotEnd(op);
|
8103
|
+
OpList.assertIsUnowned(op);
|
8104
|
+
op.debugListId = this.debugListId;
|
8105
|
+
// The old "previous" node (which might be the head, if the list is empty).
|
8106
|
+
const oldLast = this.tail.prev;
|
8107
|
+
// Insert `op` following the old last node.
|
8108
|
+
op.prev = oldLast;
|
8109
|
+
oldLast.next = op;
|
8110
|
+
// Connect `op` with the list tail.
|
8111
|
+
op.next = this.tail;
|
8112
|
+
this.tail.prev = op;
|
8113
|
+
}
|
8114
|
+
/**
|
8115
|
+
* Prepend one or more nodes to the start of the list.
|
8116
|
+
*/
|
8117
|
+
prepend(ops) {
|
8118
|
+
if (ops.length === 0) {
|
8119
|
+
return;
|
8120
|
+
}
|
8121
|
+
for (const op of ops) {
|
8122
|
+
OpList.assertIsNotEnd(op);
|
8123
|
+
OpList.assertIsUnowned(op);
|
8124
|
+
op.debugListId = this.debugListId;
|
8125
|
+
}
|
8126
|
+
const first = this.head.next;
|
8127
|
+
let prev = this.head;
|
8128
|
+
for (const op of ops) {
|
8129
|
+
prev.next = op;
|
8130
|
+
op.prev = prev;
|
8131
|
+
prev = op;
|
8132
|
+
}
|
8133
|
+
prev.next = first;
|
8134
|
+
first.prev = prev;
|
8135
|
+
}
|
8136
|
+
/**
|
8137
|
+
* `OpList` is iterable via the iteration protocol.
|
8138
|
+
*
|
8139
|
+
* It's safe to mutate the part of the list that has already been returned by the iterator, up to
|
8140
|
+
* and including the last operation returned. Mutations beyond that point _may_ be safe, but may
|
8141
|
+
* also corrupt the iteration position and should be avoided.
|
8142
|
+
*/
|
8143
|
+
*[Symbol.iterator]() {
|
8144
|
+
let current = this.head.next;
|
8145
|
+
while (current !== this.tail) {
|
8146
|
+
// Guards against corruption of the iterator state by mutations to the tail of the list during
|
8147
|
+
// iteration.
|
8148
|
+
OpList.assertIsOwned(current, this.debugListId);
|
8149
|
+
const next = current.next;
|
8150
|
+
yield current;
|
8151
|
+
current = next;
|
8152
|
+
}
|
8153
|
+
}
|
8154
|
+
*reversed() {
|
8155
|
+
let current = this.tail.prev;
|
8156
|
+
while (current !== this.head) {
|
8157
|
+
OpList.assertIsOwned(current, this.debugListId);
|
8158
|
+
const prev = current.prev;
|
8159
|
+
yield current;
|
8160
|
+
current = prev;
|
8161
|
+
}
|
8162
|
+
}
|
8163
|
+
/**
|
8164
|
+
* Replace `oldOp` with `newOp` in the list.
|
8165
|
+
*/
|
8166
|
+
static replace(oldOp, newOp) {
|
8167
|
+
OpList.assertIsNotEnd(oldOp);
|
8168
|
+
OpList.assertIsNotEnd(newOp);
|
8169
|
+
OpList.assertIsOwned(oldOp);
|
8170
|
+
OpList.assertIsUnowned(newOp);
|
8171
|
+
newOp.debugListId = oldOp.debugListId;
|
8172
|
+
if (oldOp.prev !== null) {
|
8173
|
+
oldOp.prev.next = newOp;
|
8174
|
+
newOp.prev = oldOp.prev;
|
8175
|
+
}
|
8176
|
+
if (oldOp.next !== null) {
|
8177
|
+
oldOp.next.prev = newOp;
|
8178
|
+
newOp.next = oldOp.next;
|
8179
|
+
}
|
8180
|
+
oldOp.debugListId = null;
|
8181
|
+
oldOp.prev = null;
|
8182
|
+
oldOp.next = null;
|
8183
|
+
}
|
8184
|
+
/**
|
8185
|
+
* Replace `oldOp` with some number of new operations in the list (which may include `oldOp`).
|
8186
|
+
*/
|
8187
|
+
static replaceWithMany(oldOp, newOps) {
|
8188
|
+
if (newOps.length === 0) {
|
8189
|
+
// Replacing with an empty list -> pure removal.
|
8190
|
+
OpList.remove(oldOp);
|
8191
|
+
return;
|
8192
|
+
}
|
8193
|
+
OpList.assertIsNotEnd(oldOp);
|
8194
|
+
OpList.assertIsOwned(oldOp);
|
8195
|
+
const listId = oldOp.debugListId;
|
8196
|
+
oldOp.debugListId = null;
|
8197
|
+
for (const newOp of newOps) {
|
8198
|
+
OpList.assertIsNotEnd(newOp);
|
8199
|
+
// `newOp` might be `oldOp`, but at this point it's been marked as unowned.
|
8200
|
+
OpList.assertIsUnowned(newOp);
|
8201
|
+
}
|
8202
|
+
// It should be safe to reuse `oldOp` in the `newOps` list - maybe you want to sandwich an
|
8203
|
+
// operation between two new ops.
|
8204
|
+
const { prev: oldPrev, next: oldNext } = oldOp;
|
8205
|
+
oldOp.prev = null;
|
8206
|
+
oldOp.next = null;
|
8207
|
+
let prev = oldPrev;
|
8208
|
+
for (const newOp of newOps) {
|
8209
|
+
this.assertIsUnowned(newOp);
|
8210
|
+
newOp.debugListId = listId;
|
8211
|
+
prev.next = newOp;
|
8212
|
+
newOp.prev = prev;
|
8213
|
+
// This _should_ be the case, but set it just in case.
|
8214
|
+
newOp.next = null;
|
8215
|
+
prev = newOp;
|
8216
|
+
}
|
8217
|
+
// At the end of iteration, `prev` holds the last node in the list.
|
8218
|
+
const first = newOps[0];
|
8219
|
+
const last = prev;
|
8220
|
+
// Replace `oldOp` with the chain `first` -> `last`.
|
8221
|
+
if (oldPrev !== null) {
|
8222
|
+
oldPrev.next = first;
|
8223
|
+
first.prev = oldOp.prev;
|
8224
|
+
}
|
8225
|
+
if (oldNext !== null) {
|
8226
|
+
oldNext.prev = last;
|
8227
|
+
last.next = oldNext;
|
8228
|
+
}
|
8229
|
+
}
|
8230
|
+
/**
|
8231
|
+
* Remove the given node from the list which contains it.
|
8232
|
+
*/
|
8233
|
+
static remove(op) {
|
8234
|
+
OpList.assertIsNotEnd(op);
|
8235
|
+
OpList.assertIsOwned(op);
|
8236
|
+
op.prev.next = op.next;
|
8237
|
+
op.next.prev = op.prev;
|
8238
|
+
// Break any link between the node and this list to safeguard against its usage in future
|
8239
|
+
// operations.
|
8240
|
+
op.debugListId = null;
|
8241
|
+
op.prev = null;
|
8242
|
+
op.next = null;
|
8243
|
+
}
|
8244
|
+
/**
|
8245
|
+
* Insert `op` before `target`.
|
8246
|
+
*/
|
8247
|
+
static insertBefore(op, target) {
|
8248
|
+
OpList.assertIsOwned(target);
|
8249
|
+
if (target.prev === null) {
|
8250
|
+
throw new Error(`AssertionError: illegal operation on list start`);
|
8251
|
+
}
|
8252
|
+
OpList.assertIsNotEnd(op);
|
8253
|
+
OpList.assertIsUnowned(op);
|
8254
|
+
op.debugListId = target.debugListId;
|
8255
|
+
// Just in case.
|
8256
|
+
op.prev = null;
|
8257
|
+
target.prev.next = op;
|
8258
|
+
op.prev = target.prev;
|
8259
|
+
op.next = target;
|
8260
|
+
target.prev = op;
|
8261
|
+
}
|
8262
|
+
/**
|
8263
|
+
* Insert `op` after `target`.
|
8264
|
+
*/
|
8265
|
+
static insertAfter(op, target) {
|
8266
|
+
OpList.assertIsOwned(target);
|
8267
|
+
if (target.next === null) {
|
8268
|
+
throw new Error(`AssertionError: illegal operation on list end`);
|
8269
|
+
}
|
8270
|
+
OpList.assertIsNotEnd(op);
|
8271
|
+
OpList.assertIsUnowned(op);
|
8272
|
+
op.debugListId = target.debugListId;
|
8273
|
+
target.next.prev = op;
|
8274
|
+
op.next = target.next;
|
8275
|
+
op.prev = target;
|
8276
|
+
target.next = op;
|
8277
|
+
}
|
8278
|
+
/**
|
8279
|
+
* Asserts that `op` does not currently belong to a list.
|
8280
|
+
*/
|
8281
|
+
static assertIsUnowned(op) {
|
8282
|
+
if (op.debugListId !== null) {
|
8283
|
+
throw new Error(`AssertionError: illegal operation on owned node: ${OpKind[op.kind]}`);
|
8284
|
+
}
|
8285
|
+
}
|
8286
|
+
/**
|
8287
|
+
* Asserts that `op` currently belongs to a list. If `byList` is passed, `op` is asserted to
|
8288
|
+
* specifically belong to that list.
|
8289
|
+
*/
|
8290
|
+
static assertIsOwned(op, byList) {
|
8291
|
+
if (op.debugListId === null) {
|
8292
|
+
throw new Error(`AssertionError: illegal operation on unowned node: ${OpKind[op.kind]}`);
|
8293
|
+
}
|
8294
|
+
else if (byList !== undefined && op.debugListId !== byList) {
|
8295
|
+
throw new Error(`AssertionError: node belongs to the wrong list (expected ${byList}, actual ${op.debugListId})`);
|
8296
|
+
}
|
8297
|
+
}
|
8298
|
+
/**
|
8299
|
+
* Asserts that `op` is not a special `ListEnd` node.
|
8300
|
+
*/
|
8301
|
+
static assertIsNotEnd(op) {
|
8302
|
+
if (op.kind === OpKind.ListEnd) {
|
8303
|
+
throw new Error(`AssertionError: illegal operation on list head or tail`);
|
8304
|
+
}
|
8305
|
+
}
|
8306
|
+
}
|
8307
|
+
|
8308
|
+
/**
|
8309
|
+
* The set of OpKinds that represent the creation of an element or container
|
8310
|
+
*/
|
8311
|
+
new Set([
|
8312
|
+
OpKind.Element, OpKind.ElementStart, OpKind.Container, OpKind.ContainerStart, OpKind.Template
|
8313
|
+
]);
|
8314
|
+
/**
|
8315
|
+
* Whether the active namespace is HTML, MathML, or SVG mode.
|
8316
|
+
*/
|
8317
|
+
var Namespace;
|
8318
|
+
(function (Namespace) {
|
8319
|
+
Namespace[Namespace["HTML"] = 0] = "HTML";
|
8320
|
+
Namespace[Namespace["SVG"] = 1] = "SVG";
|
8321
|
+
Namespace[Namespace["Math"] = 2] = "Math";
|
8322
|
+
})(Namespace || (Namespace = {}));
|
8323
|
+
|
8324
|
+
/**
|
8325
|
+
* Parses string representation of a style and converts it into object literal.
|
8326
|
+
*
|
8327
|
+
* @param value string representation of style as used in the `style` attribute in HTML.
|
8328
|
+
* Example: `color: red; height: auto`.
|
8329
|
+
* @returns An array of style property name and value pairs, e.g. `['color', 'red', 'height',
|
8330
|
+
* 'auto']`
|
8331
|
+
*/
|
8332
|
+
function parse(value) {
|
8333
|
+
// we use a string array here instead of a string map
|
8334
|
+
// because a string-map is not guaranteed to retain the
|
8335
|
+
// order of the entries whereas a string array can be
|
8336
|
+
// constructed in a [key, value, key, value] format.
|
8337
|
+
const styles = [];
|
8338
|
+
let i = 0;
|
8339
|
+
let parenDepth = 0;
|
8340
|
+
let quote = 0 /* Char.QuoteNone */;
|
8341
|
+
let valueStart = 0;
|
7399
8342
|
let propStart = 0;
|
7400
8343
|
let currentProp = null;
|
7401
8344
|
while (i < value.length) {
|
@@ -7428,7 +8371,7 @@ function parse(value) {
|
|
7428
8371
|
break;
|
7429
8372
|
case 58 /* Char.Colon */:
|
7430
8373
|
if (!currentProp && parenDepth === 0 && quote === 0 /* Char.QuoteNone */) {
|
7431
|
-
currentProp = hyphenate(value.substring(propStart, i - 1).trim());
|
8374
|
+
currentProp = hyphenate$1(value.substring(propStart, i - 1).trim());
|
7432
8375
|
valueStart = i;
|
7433
8376
|
}
|
7434
8377
|
break;
|
@@ -7449,7 +8392,7 @@ function parse(value) {
|
|
7449
8392
|
}
|
7450
8393
|
return styles;
|
7451
8394
|
}
|
7452
|
-
function hyphenate(value) {
|
8395
|
+
function hyphenate$1(value) {
|
7453
8396
|
return value
|
7454
8397
|
.replace(/[a-z][A-Z]/g, v => {
|
7455
8398
|
return v.charAt(0) + '-' + v.charAt(1);
|
@@ -7457,6 +8400,140 @@ function hyphenate(value) {
|
|
7457
8400
|
.toLowerCase();
|
7458
8401
|
}
|
7459
8402
|
|
8403
|
+
new Map([
|
8404
|
+
[OpKind.ElementEnd, [OpKind.ElementStart, OpKind.Element]],
|
8405
|
+
[OpKind.ContainerEnd, [OpKind.ContainerStart, OpKind.Container]],
|
8406
|
+
]);
|
8407
|
+
// A lookup set of all the expression kinds that require a temporary variable to be generated.
|
8408
|
+
[
|
8409
|
+
InvokeFunctionExpr, LiteralArrayExpr, LiteralMapExpr, SafeInvokeFunctionExpr,
|
8410
|
+
PipeBindingExpr
|
8411
|
+
].map(e => e.constructor.name);
|
8412
|
+
|
8413
|
+
new Map([
|
8414
|
+
['&&', BinaryOperator.And],
|
8415
|
+
['>', BinaryOperator.Bigger],
|
8416
|
+
['>=', BinaryOperator.BiggerEquals],
|
8417
|
+
['&', BinaryOperator.BitwiseAnd],
|
8418
|
+
['/', BinaryOperator.Divide],
|
8419
|
+
['==', BinaryOperator.Equals],
|
8420
|
+
['===', BinaryOperator.Identical],
|
8421
|
+
['<', BinaryOperator.Lower],
|
8422
|
+
['<=', BinaryOperator.LowerEquals],
|
8423
|
+
['-', BinaryOperator.Minus],
|
8424
|
+
['%', BinaryOperator.Modulo],
|
8425
|
+
['*', BinaryOperator.Multiply],
|
8426
|
+
['!=', BinaryOperator.NotEquals],
|
8427
|
+
['!==', BinaryOperator.NotIdentical],
|
8428
|
+
['??', BinaryOperator.NullishCoalesce],
|
8429
|
+
['||', BinaryOperator.Or],
|
8430
|
+
['+', BinaryOperator.Plus],
|
8431
|
+
]);
|
8432
|
+
new Map([['svg', Namespace.SVG], ['math', Namespace.Math]]);
|
8433
|
+
|
8434
|
+
function kindTest(kind) {
|
8435
|
+
return (op) => op.kind === kind;
|
8436
|
+
}
|
8437
|
+
/**
|
8438
|
+
* Defines the groups based on `OpKind` that ops will be divided into. Ops will be collected into
|
8439
|
+
* groups, then optionally transformed, before recombining the groups in the order defined here.
|
8440
|
+
*/
|
8441
|
+
[
|
8442
|
+
{ test: kindTest(OpKind.StyleMap), transform: keepLast },
|
8443
|
+
{ test: kindTest(OpKind.ClassMap), transform: keepLast },
|
8444
|
+
{ test: kindTest(OpKind.StyleProp) },
|
8445
|
+
{ test: kindTest(OpKind.ClassProp) },
|
8446
|
+
{
|
8447
|
+
test: (op) => (op.kind === OpKind.Property || op.kind === OpKind.HostProperty) &&
|
8448
|
+
op.expression instanceof Interpolation
|
8449
|
+
},
|
8450
|
+
{
|
8451
|
+
test: (op) => (op.kind === OpKind.Property || op.kind === OpKind.HostProperty) &&
|
8452
|
+
!(op.expression instanceof Interpolation)
|
8453
|
+
},
|
8454
|
+
{ test: kindTest(OpKind.Attribute) },
|
8455
|
+
];
|
8456
|
+
/**
|
8457
|
+
* The set of all op kinds we handle in the reordering phase.
|
8458
|
+
*/
|
8459
|
+
new Set([
|
8460
|
+
OpKind.StyleMap,
|
8461
|
+
OpKind.ClassMap,
|
8462
|
+
OpKind.StyleProp,
|
8463
|
+
OpKind.ClassProp,
|
8464
|
+
OpKind.Property,
|
8465
|
+
OpKind.HostProperty,
|
8466
|
+
OpKind.Attribute,
|
8467
|
+
]);
|
8468
|
+
/**
|
8469
|
+
* Keeps only the last op in a list of ops.
|
8470
|
+
*/
|
8471
|
+
function keepLast(ops) {
|
8472
|
+
return ops.slice(ops.length - 1);
|
8473
|
+
}
|
8474
|
+
|
8475
|
+
/**
|
8476
|
+
* Map of sanitizers to their identifier.
|
8477
|
+
*/
|
8478
|
+
new Map([
|
8479
|
+
[SanitizerFn.Html, Identifiers.sanitizeHtml],
|
8480
|
+
[SanitizerFn.IframeAttribute, Identifiers.validateIframeAttribute],
|
8481
|
+
[SanitizerFn.ResourceUrl, Identifiers.sanitizeResourceUrl],
|
8482
|
+
[SanitizerFn.Script, Identifiers.sanitizeScript],
|
8483
|
+
[SanitizerFn.Style, Identifiers.sanitizeStyle], [SanitizerFn.Url, Identifiers.sanitizeUrl]
|
8484
|
+
]);
|
8485
|
+
|
8486
|
+
/**
|
8487
|
+
* Mapping of security contexts to sanitizer function for that context.
|
8488
|
+
*/
|
8489
|
+
new Map([
|
8490
|
+
[SecurityContext.HTML, SanitizerFn.Html], [SecurityContext.SCRIPT, SanitizerFn.Script],
|
8491
|
+
[SecurityContext.STYLE, SanitizerFn.Style], [SecurityContext.URL, SanitizerFn.Url],
|
8492
|
+
[SecurityContext.RESOURCE_URL, SanitizerFn.ResourceUrl]
|
8493
|
+
]);
|
8494
|
+
/**
|
8495
|
+
* A [fence](https://en.wikipedia.org/wiki/Memory_barrier) flag for an expression which indicates
|
8496
|
+
* how that expression can be optimized in relation to other expressions or instructions.
|
8497
|
+
*
|
8498
|
+
* `Fence`s are a bitfield, so multiple flags may be set on a single expression.
|
8499
|
+
*/
|
8500
|
+
var Fence;
|
8501
|
+
(function (Fence) {
|
8502
|
+
/**
|
8503
|
+
* Empty flag (no fence exists).
|
8504
|
+
*/
|
8505
|
+
Fence[Fence["None"] = 0] = "None";
|
8506
|
+
/**
|
8507
|
+
* A context read fence, meaning that the expression in question reads from the "current view"
|
8508
|
+
* context of the runtime.
|
8509
|
+
*/
|
8510
|
+
Fence[Fence["ViewContextRead"] = 1] = "ViewContextRead";
|
8511
|
+
/**
|
8512
|
+
* A context write fence, meaning that the expression in question writes to the "current view"
|
8513
|
+
* context of the runtime.
|
8514
|
+
*
|
8515
|
+
* Note that all `ContextWrite` fences are implicitly `ContextRead` fences as operations which
|
8516
|
+
* change the view context do so based on the current one.
|
8517
|
+
*/
|
8518
|
+
Fence[Fence["ViewContextWrite"] = 3] = "ViewContextWrite";
|
8519
|
+
/**
|
8520
|
+
* Indicates that a call is required for its side-effects, even if nothing reads its result.
|
8521
|
+
*
|
8522
|
+
* This is also true of `ViewContextWrite` operations **if** they are followed by a
|
8523
|
+
* `ViewContextRead`.
|
8524
|
+
*/
|
8525
|
+
Fence[Fence["SideEffectful"] = 4] = "SideEffectful";
|
8526
|
+
})(Fence || (Fence = {}));
|
8527
|
+
|
8528
|
+
CompatibilityMode.TemplateDefinitionBuilder;
|
8529
|
+
new Map([
|
8530
|
+
[0 /* e.BindingType.Property */, BindingKind.Property],
|
8531
|
+
[1 /* e.BindingType.Attribute */, BindingKind.Attribute],
|
8532
|
+
[2 /* e.BindingType.Class */, BindingKind.ClassName],
|
8533
|
+
[3 /* e.BindingType.Style */, BindingKind.StyleProperty],
|
8534
|
+
[4 /* e.BindingType.Animation */, BindingKind.Animation],
|
8535
|
+
]);
|
8536
|
+
|
7460
8537
|
const IMPORTANT_FLAG = '!important';
|
7461
8538
|
/**
|
7462
8539
|
* Minimum amount of binding slots required in the runtime for style/class bindings.
|
@@ -7626,7 +8703,7 @@ class StylingBuilder {
|
|
7626
8703
|
// CSS custom properties are case-sensitive so we shouldn't normalize them.
|
7627
8704
|
// See: https://www.w3.org/TR/css-variables-1/#defining-variables
|
7628
8705
|
if (!isCssCustomProperty(name)) {
|
7629
|
-
name = hyphenate(name);
|
8706
|
+
name = hyphenate$1(name);
|
7630
8707
|
}
|
7631
8708
|
const { property, hasOverrideFlag, suffix: bindingSuffix } = parseProperty(name);
|
7632
8709
|
suffix = typeof suffix === 'string' && suffix.length !== 0 ? suffix : bindingSuffix;
|
@@ -7756,7 +8833,7 @@ class StylingBuilder {
|
|
7756
8833
|
// pipes can be picked up in time before the template is built
|
7757
8834
|
const mapValue = stylingInput.value.visit(valueConverter);
|
7758
8835
|
let reference;
|
7759
|
-
if (mapValue instanceof Interpolation) {
|
8836
|
+
if (mapValue instanceof Interpolation$1) {
|
7760
8837
|
totalBindingSlotsRequired += mapValue.expressions.length;
|
7761
8838
|
reference = isClassBased ? getClassMapInterpolationExpression(mapValue) :
|
7762
8839
|
getStyleMapInterpolationExpression(mapValue);
|
@@ -7791,7 +8868,7 @@ class StylingBuilder {
|
|
7791
8868
|
// We need to store the intermediate value so that we don't allocate
|
7792
8869
|
// the strings on each CD.
|
7793
8870
|
let totalBindingSlotsRequired = MIN_STYLING_BINDING_SLOTS_REQUIRED;
|
7794
|
-
if (value instanceof Interpolation) {
|
8871
|
+
if (value instanceof Interpolation$1) {
|
7795
8872
|
totalBindingSlotsRequired += value.expressions.length;
|
7796
8873
|
if (getInterpolationExpressionFn) {
|
7797
8874
|
referenceForCall = getInterpolationExpressionFn(value);
|
@@ -7983,7 +9060,7 @@ function isEmptyExpression(ast) {
|
|
7983
9060
|
if (ast instanceof ASTWithSource) {
|
7984
9061
|
ast = ast.ast;
|
7985
9062
|
}
|
7986
|
-
return ast instanceof EmptyExpr;
|
9063
|
+
return ast instanceof EmptyExpr$1;
|
7987
9064
|
}
|
7988
9065
|
|
7989
9066
|
var TokenType;
|
@@ -8419,6 +9496,7 @@ class Parser$1 {
|
|
8419
9496
|
ast.visit(checker);
|
8420
9497
|
return checker.errors;
|
8421
9498
|
}
|
9499
|
+
// Host bindings parsed here
|
8422
9500
|
parseSimpleBinding(input, location, absoluteOffset, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {
|
8423
9501
|
const ast = this._parseBindingAst(input, location, absoluteOffset, interpolationConfig);
|
8424
9502
|
const errors = this.checkSimpleExpression(ast);
|
@@ -8501,7 +9579,7 @@ class Parser$1 {
|
|
8501
9579
|
}
|
8502
9580
|
createInterpolationAst(strings, expressions, input, location, absoluteOffset) {
|
8503
9581
|
const span = new ParseSpan(0, input.length);
|
8504
|
-
const interpolation = new Interpolation(span, span.toAbsolute(absoluteOffset), strings, expressions);
|
9582
|
+
const interpolation = new Interpolation$1(span, span.toAbsolute(absoluteOffset), strings, expressions);
|
8505
9583
|
return new ASTWithSource(interpolation, input, location, absoluteOffset, this.errors);
|
8506
9584
|
}
|
8507
9585
|
/**
|
@@ -8872,7 +9950,7 @@ class _ParseAST {
|
|
8872
9950
|
// We have no expressions so create an empty expression that spans the entire input length
|
8873
9951
|
const artificialStart = this.offset;
|
8874
9952
|
const artificialEnd = this.offset + this.input.length;
|
8875
|
-
return new EmptyExpr(this.span(artificialStart, artificialEnd), this.sourceSpan(artificialStart, artificialEnd));
|
9953
|
+
return new EmptyExpr$1(this.span(artificialStart, artificialEnd), this.sourceSpan(artificialStart, artificialEnd));
|
8876
9954
|
}
|
8877
9955
|
if (exprs.length == 1)
|
8878
9956
|
return exprs[0];
|
@@ -8933,7 +10011,7 @@ class _ParseAST {
|
|
8933
10011
|
const end = this.inputIndex;
|
8934
10012
|
const expression = this.input.substring(start, end);
|
8935
10013
|
this.error(`Conditional expression ${expression} requires all 3 expressions`);
|
8936
|
-
no = new EmptyExpr(this.span(start), this.sourceSpan(start));
|
10014
|
+
no = new EmptyExpr$1(this.span(start), this.sourceSpan(start));
|
8937
10015
|
}
|
8938
10016
|
else {
|
8939
10017
|
no = this.parsePipe();
|
@@ -9158,15 +10236,15 @@ class _ParseAST {
|
|
9158
10236
|
}
|
9159
10237
|
else if (this.next.isPrivateIdentifier()) {
|
9160
10238
|
this._reportErrorForPrivateIdentifier(this.next, null);
|
9161
|
-
return new EmptyExpr(this.span(start), this.sourceSpan(start));
|
10239
|
+
return new EmptyExpr$1(this.span(start), this.sourceSpan(start));
|
9162
10240
|
}
|
9163
10241
|
else if (this.index >= this.tokens.length) {
|
9164
10242
|
this.error(`Unexpected end of expression: ${this.input}`);
|
9165
|
-
return new EmptyExpr(this.span(start), this.sourceSpan(start));
|
10243
|
+
return new EmptyExpr$1(this.span(start), this.sourceSpan(start));
|
9166
10244
|
}
|
9167
10245
|
else {
|
9168
10246
|
this.error(`Unexpected token ${this.next}`);
|
9169
|
-
return new EmptyExpr(this.span(start), this.sourceSpan(start));
|
10247
|
+
return new EmptyExpr$1(this.span(start), this.sourceSpan(start));
|
9170
10248
|
}
|
9171
10249
|
}
|
9172
10250
|
parseExpressionList(terminator) {
|
@@ -9227,7 +10305,7 @@ class _ParseAST {
|
|
9227
10305
|
if (isSafe) {
|
9228
10306
|
if (this.consumeOptionalAssignment()) {
|
9229
10307
|
this.error('The \'?.\' operator cannot be used in the assignment');
|
9230
|
-
receiver = new EmptyExpr(this.span(start), this.sourceSpan(start));
|
10308
|
+
receiver = new EmptyExpr$1(this.span(start), this.sourceSpan(start));
|
9231
10309
|
}
|
9232
10310
|
else {
|
9233
10311
|
receiver = new SafePropertyRead(this.span(start), this.sourceSpan(start), nameSpan, readReceiver, id);
|
@@ -9237,7 +10315,7 @@ class _ParseAST {
|
|
9237
10315
|
if (this.consumeOptionalAssignment()) {
|
9238
10316
|
if (!(this.parseFlags & 1 /* ParseFlags.Action */)) {
|
9239
10317
|
this.error('Bindings cannot contain assignments');
|
9240
|
-
return new EmptyExpr(this.span(start), this.sourceSpan(start));
|
10318
|
+
return new EmptyExpr$1(this.span(start), this.sourceSpan(start));
|
9241
10319
|
}
|
9242
10320
|
const value = this.parseConditional();
|
9243
10321
|
receiver = new PropertyWrite(this.span(start), this.sourceSpan(start), nameSpan, readReceiver, id, value);
|
@@ -9367,7 +10445,7 @@ class _ParseAST {
|
|
9367
10445
|
return this.withContext(ParseContextFlags.Writable, () => {
|
9368
10446
|
this.rbracketsExpected++;
|
9369
10447
|
const key = this.parsePipe();
|
9370
|
-
if (key instanceof EmptyExpr) {
|
10448
|
+
if (key instanceof EmptyExpr$1) {
|
9371
10449
|
this.error(`Key access cannot be empty`);
|
9372
10450
|
}
|
9373
10451
|
this.rbracketsExpected--;
|
@@ -9385,7 +10463,7 @@ class _ParseAST {
|
|
9385
10463
|
return isSafe ? new SafeKeyedRead(this.span(start), this.sourceSpan(start), receiver, key) :
|
9386
10464
|
new KeyedRead(this.span(start), this.sourceSpan(start), receiver, key);
|
9387
10465
|
}
|
9388
|
-
return new EmptyExpr(this.span(start), this.sourceSpan(start));
|
10466
|
+
return new EmptyExpr$1(this.span(start), this.sourceSpan(start));
|
9389
10467
|
});
|
9390
10468
|
}
|
9391
10469
|
/**
|
@@ -9680,6 +10758,39 @@ class Comment {
|
|
9680
10758
|
return visitor.visitComment(this, context);
|
9681
10759
|
}
|
9682
10760
|
}
|
10761
|
+
class BlockGroup {
|
10762
|
+
constructor(blocks, sourceSpan, startSourceSpan, endSourceSpan = null) {
|
10763
|
+
this.blocks = blocks;
|
10764
|
+
this.sourceSpan = sourceSpan;
|
10765
|
+
this.startSourceSpan = startSourceSpan;
|
10766
|
+
this.endSourceSpan = endSourceSpan;
|
10767
|
+
}
|
10768
|
+
visit(visitor, context) {
|
10769
|
+
return visitor.visitBlockGroup(this, context);
|
10770
|
+
}
|
10771
|
+
}
|
10772
|
+
class Block {
|
10773
|
+
constructor(name, parameters, children, sourceSpan, startSourceSpan, endSourceSpan = null) {
|
10774
|
+
this.name = name;
|
10775
|
+
this.parameters = parameters;
|
10776
|
+
this.children = children;
|
10777
|
+
this.sourceSpan = sourceSpan;
|
10778
|
+
this.startSourceSpan = startSourceSpan;
|
10779
|
+
this.endSourceSpan = endSourceSpan;
|
10780
|
+
}
|
10781
|
+
visit(visitor, context) {
|
10782
|
+
return visitor.visitBlock(this, context);
|
10783
|
+
}
|
10784
|
+
}
|
10785
|
+
class BlockParameter {
|
10786
|
+
constructor(expression, sourceSpan) {
|
10787
|
+
this.expression = expression;
|
10788
|
+
this.sourceSpan = sourceSpan;
|
10789
|
+
}
|
10790
|
+
visit(visitor, context) {
|
10791
|
+
return visitor.visitBlockParameter(this, context);
|
10792
|
+
}
|
10793
|
+
}
|
9683
10794
|
function visitAll(visitor, nodes, context = null) {
|
9684
10795
|
const result = [];
|
9685
10796
|
const visit = visitor.visit ?
|
@@ -9694,41 +10805,6 @@ function visitAll(visitor, nodes, context = null) {
|
|
9694
10805
|
return result;
|
9695
10806
|
}
|
9696
10807
|
|
9697
|
-
var TagContentType;
|
9698
|
-
(function (TagContentType) {
|
9699
|
-
TagContentType[TagContentType["RAW_TEXT"] = 0] = "RAW_TEXT";
|
9700
|
-
TagContentType[TagContentType["ESCAPABLE_RAW_TEXT"] = 1] = "ESCAPABLE_RAW_TEXT";
|
9701
|
-
TagContentType[TagContentType["PARSABLE_DATA"] = 2] = "PARSABLE_DATA";
|
9702
|
-
})(TagContentType || (TagContentType = {}));
|
9703
|
-
function splitNsName(elementName) {
|
9704
|
-
if (elementName[0] != ':') {
|
9705
|
-
return [null, elementName];
|
9706
|
-
}
|
9707
|
-
const colonIndex = elementName.indexOf(':', 1);
|
9708
|
-
if (colonIndex === -1) {
|
9709
|
-
throw new Error(`Unsupported format "${elementName}" expecting ":namespace:name"`);
|
9710
|
-
}
|
9711
|
-
return [elementName.slice(1, colonIndex), elementName.slice(colonIndex + 1)];
|
9712
|
-
}
|
9713
|
-
// `<ng-container>` tags work the same regardless the namespace
|
9714
|
-
function isNgContainer(tagName) {
|
9715
|
-
return splitNsName(tagName)[1] === 'ng-container';
|
9716
|
-
}
|
9717
|
-
// `<ng-content>` tags work the same regardless the namespace
|
9718
|
-
function isNgContent(tagName) {
|
9719
|
-
return splitNsName(tagName)[1] === 'ng-content';
|
9720
|
-
}
|
9721
|
-
// `<ng-template>` tags work the same regardless the namespace
|
9722
|
-
function isNgTemplate(tagName) {
|
9723
|
-
return splitNsName(tagName)[1] === 'ng-template';
|
9724
|
-
}
|
9725
|
-
function getNsPrefix(fullName) {
|
9726
|
-
return fullName === null ? null : splitNsName(fullName)[0];
|
9727
|
-
}
|
9728
|
-
function mergeNsAndName(prefix, localName) {
|
9729
|
-
return prefix ? `:${prefix}:${localName}` : localName;
|
9730
|
-
}
|
9731
|
-
|
9732
10808
|
class ElementSchemaRegistry {
|
9733
10809
|
}
|
9734
10810
|
|
@@ -12400,8 +13476,9 @@ const NAMED_ENTITIES = {
|
|
12400
13476
|
'zwj': '\u200D',
|
12401
13477
|
'zwnj': '\u200C'
|
12402
13478
|
};
|
12403
|
-
// The &ngsp; pseudo-entity is denoting a space.
|
12404
|
-
//
|
13479
|
+
// The &ngsp; pseudo-entity is denoting a space.
|
13480
|
+
// 0xE500 is a PUA (Private Use Areas) unicode character
|
13481
|
+
// This is inspired by the Angular Dart implementation.
|
12405
13482
|
const NGSP_UNICODE = '\uE500';
|
12406
13483
|
NAMED_ENTITIES['ngsp'] = NGSP_UNICODE;
|
12407
13484
|
|
@@ -12468,8 +13545,8 @@ class _Tokenizer {
|
|
12468
13545
|
this._cursor = options.escapedString ? new EscapedCharacterCursor(_file, range) :
|
12469
13546
|
new PlainCharacterCursor(_file, range);
|
12470
13547
|
this._preserveLineEndings = options.preserveLineEndings || false;
|
12471
|
-
this._escapedString = options.escapedString || false;
|
12472
13548
|
this._i18nNormalizeLineEndingsInICUs = options.i18nNormalizeLineEndingsInICUs || false;
|
13549
|
+
this._tokenizeBlocks = options.tokenizeBlocks || false;
|
12473
13550
|
try {
|
12474
13551
|
this._cursor.init();
|
12475
13552
|
}
|
@@ -12510,18 +13587,96 @@ class _Tokenizer {
|
|
12510
13587
|
this._consumeTagOpen(start);
|
12511
13588
|
}
|
12512
13589
|
}
|
13590
|
+
else if (this._tokenizeBlocks && this._attemptStr('{#')) {
|
13591
|
+
this._consumeBlockGroupOpen(start);
|
13592
|
+
}
|
13593
|
+
else if (this._tokenizeBlocks && this._attemptStr('{/')) {
|
13594
|
+
this._consumeBlockGroupClose(start);
|
13595
|
+
}
|
13596
|
+
else if (this._tokenizeBlocks && this._attemptStr('{:')) {
|
13597
|
+
this._consumeBlock(start);
|
13598
|
+
}
|
12513
13599
|
else if (!(this._tokenizeIcu && this._tokenizeExpansionForm())) {
|
12514
13600
|
// In (possibly interpolated) text the end of the text is given by `isTextEnd()`, while
|
12515
13601
|
// the premature end of an interpolation is given by the start of a new HTML element.
|
12516
13602
|
this._consumeWithInterpolation(5 /* TokenType.TEXT */, 8 /* TokenType.INTERPOLATION */, () => this._isTextEnd(), () => this._isTagStart());
|
12517
13603
|
}
|
12518
13604
|
}
|
12519
|
-
catch (e) {
|
12520
|
-
this.handleError(e);
|
12521
|
-
}
|
13605
|
+
catch (e) {
|
13606
|
+
this.handleError(e);
|
13607
|
+
}
|
13608
|
+
}
|
13609
|
+
this._beginToken(24 /* TokenType.EOF */);
|
13610
|
+
this._endToken([]);
|
13611
|
+
}
|
13612
|
+
_consumeBlockGroupOpen(start) {
|
13613
|
+
this._beginToken(25 /* TokenType.BLOCK_GROUP_OPEN_START */, start);
|
13614
|
+
const nameCursor = this._cursor.clone();
|
13615
|
+
this._attemptCharCodeUntilFn(code => !isBlockNameChar(code));
|
13616
|
+
this._endToken([this._cursor.getChars(nameCursor)]);
|
13617
|
+
this._consumeBlockParameters();
|
13618
|
+
this._beginToken(26 /* TokenType.BLOCK_GROUP_OPEN_END */);
|
13619
|
+
this._requireCharCode($RBRACE);
|
13620
|
+
this._endToken([]);
|
13621
|
+
}
|
13622
|
+
_consumeBlockGroupClose(start) {
|
13623
|
+
this._beginToken(27 /* TokenType.BLOCK_GROUP_CLOSE */, start);
|
13624
|
+
const nameCursor = this._cursor.clone();
|
13625
|
+
this._attemptCharCodeUntilFn(code => !isBlockNameChar(code));
|
13626
|
+
const name = this._cursor.getChars(nameCursor);
|
13627
|
+
this._requireCharCode($RBRACE);
|
13628
|
+
this._endToken([name]);
|
13629
|
+
}
|
13630
|
+
_consumeBlock(start) {
|
13631
|
+
this._beginToken(29 /* TokenType.BLOCK_OPEN_START */, start);
|
13632
|
+
const nameCursor = this._cursor.clone();
|
13633
|
+
this._attemptCharCodeUntilFn(code => !isBlockNameChar(code));
|
13634
|
+
this._endToken([this._cursor.getChars(nameCursor)]);
|
13635
|
+
this._consumeBlockParameters();
|
13636
|
+
this._beginToken(30 /* TokenType.BLOCK_OPEN_END */);
|
13637
|
+
this._requireCharCode($RBRACE);
|
13638
|
+
this._endToken([]);
|
13639
|
+
}
|
13640
|
+
_consumeBlockParameters() {
|
13641
|
+
// Trim the whitespace until the first parameter.
|
13642
|
+
this._attemptCharCodeUntilFn(isBlockParameterChar);
|
13643
|
+
while (this._cursor.peek() !== $RBRACE && this._cursor.peek() !== $EOF) {
|
13644
|
+
this._beginToken(28 /* TokenType.BLOCK_PARAMETER */);
|
13645
|
+
const start = this._cursor.clone();
|
13646
|
+
let inQuote = null;
|
13647
|
+
let openBraces = 0;
|
13648
|
+
// Consume the parameter until the next semicolon or brace.
|
13649
|
+
// Note that we skip over semicolons/braces inside of strings.
|
13650
|
+
while ((this._cursor.peek() !== $SEMICOLON && this._cursor.peek() !== $EOF) ||
|
13651
|
+
inQuote !== null) {
|
13652
|
+
const char = this._cursor.peek();
|
13653
|
+
// Skip to the next character if it was escaped.
|
13654
|
+
if (char === $BACKSLASH) {
|
13655
|
+
this._cursor.advance();
|
13656
|
+
}
|
13657
|
+
else if (char === inQuote) {
|
13658
|
+
inQuote = null;
|
13659
|
+
}
|
13660
|
+
else if (inQuote === null && isQuote(char)) {
|
13661
|
+
inQuote = char;
|
13662
|
+
}
|
13663
|
+
else if (char === $LBRACE && inQuote === null) {
|
13664
|
+
openBraces++;
|
13665
|
+
}
|
13666
|
+
else if (char === $RBRACE && inQuote === null) {
|
13667
|
+
if (openBraces === 0) {
|
13668
|
+
break;
|
13669
|
+
}
|
13670
|
+
else if (openBraces > 0) {
|
13671
|
+
openBraces--;
|
13672
|
+
}
|
13673
|
+
}
|
13674
|
+
this._cursor.advance();
|
13675
|
+
}
|
13676
|
+
this._endToken([this._cursor.getChars(start)]);
|
13677
|
+
// Skip to the next parameter.
|
13678
|
+
this._attemptCharCodeUntilFn(isBlockParameterChar);
|
12522
13679
|
}
|
12523
|
-
this._beginToken(24 /* TokenType.EOF */);
|
12524
|
-
this._endToken([]);
|
12525
13680
|
}
|
12526
13681
|
/**
|
12527
13682
|
* @returns whether an ICU token has been created
|
@@ -13044,7 +14199,7 @@ class _Tokenizer {
|
|
13044
14199
|
return this._processCarriageReturns(end.getChars(start));
|
13045
14200
|
}
|
13046
14201
|
_isTextEnd() {
|
13047
|
-
if (this._isTagStart() || this._cursor.peek() === $EOF) {
|
14202
|
+
if (this._isTagStart() || this._isBlockStart() || this._cursor.peek() === $EOF) {
|
13048
14203
|
return true;
|
13049
14204
|
}
|
13050
14205
|
if (this._tokenizeIcu && !this._inInterpolation) {
|
@@ -13077,6 +14232,23 @@ class _Tokenizer {
|
|
13077
14232
|
}
|
13078
14233
|
return false;
|
13079
14234
|
}
|
14235
|
+
_isBlockStart() {
|
14236
|
+
if (this._tokenizeBlocks && this._cursor.peek() === $LBRACE) {
|
14237
|
+
const tmp = this._cursor.clone();
|
14238
|
+
// Check that the cursor is on a `{#`, `{/` or `{:`.
|
14239
|
+
tmp.advance();
|
14240
|
+
const next = tmp.peek();
|
14241
|
+
if (next !== $BANG && next !== $SLASH && next !== $COLON) {
|
14242
|
+
return false;
|
14243
|
+
}
|
14244
|
+
// If it is, also verify that the next character is a valid block identifier.
|
14245
|
+
tmp.advance();
|
14246
|
+
if (isBlockNameChar(tmp.peek())) {
|
14247
|
+
return true;
|
14248
|
+
}
|
14249
|
+
}
|
14250
|
+
return false;
|
14251
|
+
}
|
13080
14252
|
_readUntil(char) {
|
13081
14253
|
const start = this._cursor.clone();
|
13082
14254
|
this._attemptUntilChar(char);
|
@@ -13132,6 +14304,12 @@ function compareCharCodeCaseInsensitive(code1, code2) {
|
|
13132
14304
|
function toUpperCaseCharCode(code) {
|
13133
14305
|
return code >= $a && code <= $z ? code - $a + $A : code;
|
13134
14306
|
}
|
14307
|
+
function isBlockNameChar(code) {
|
14308
|
+
return isAsciiLetter(code) || isDigit(code) || code === $_;
|
14309
|
+
}
|
14310
|
+
function isBlockParameterChar(code) {
|
14311
|
+
return code !== $SEMICOLON && isNotWhitespace(code);
|
14312
|
+
}
|
13135
14313
|
function mergeTextTokens(srcTokens) {
|
13136
14314
|
const dstTokens = [];
|
13137
14315
|
let lastDstToken = undefined;
|
@@ -13419,7 +14597,7 @@ class _TreeBuilder {
|
|
13419
14597
|
this.tokens = tokens;
|
13420
14598
|
this.getTagDefinition = getTagDefinition;
|
13421
14599
|
this._index = -1;
|
13422
|
-
this.
|
14600
|
+
this._containerStack = [];
|
13423
14601
|
this.rootNodes = [];
|
13424
14602
|
this.errors = [];
|
13425
14603
|
this._advance();
|
@@ -13449,6 +14627,18 @@ class _TreeBuilder {
|
|
13449
14627
|
else if (this._peek.type === 19 /* TokenType.EXPANSION_FORM_START */) {
|
13450
14628
|
this._consumeExpansion(this._advance());
|
13451
14629
|
}
|
14630
|
+
else if (this._peek.type === 25 /* TokenType.BLOCK_GROUP_OPEN_START */) {
|
14631
|
+
this._closeVoidElement();
|
14632
|
+
this._consumeBlockGroupOpen(this._advance());
|
14633
|
+
}
|
14634
|
+
else if (this._peek.type === 29 /* TokenType.BLOCK_OPEN_START */) {
|
14635
|
+
this._closeVoidElement();
|
14636
|
+
this._consumeBlock(this._advance(), 30 /* TokenType.BLOCK_OPEN_END */);
|
14637
|
+
}
|
14638
|
+
else if (this._peek.type === 27 /* TokenType.BLOCK_GROUP_CLOSE */) {
|
14639
|
+
this._closeVoidElement();
|
14640
|
+
this._consumeBlockGroupClose(this._advance());
|
14641
|
+
}
|
13452
14642
|
else {
|
13453
14643
|
// Skip all other tokens...
|
13454
14644
|
this._advance();
|
@@ -13476,9 +14666,12 @@ class _TreeBuilder {
|
|
13476
14666
|
}
|
13477
14667
|
_consumeComment(token) {
|
13478
14668
|
const text = this._advanceIf(7 /* TokenType.RAW_TEXT */);
|
13479
|
-
this._advanceIf(11 /* TokenType.COMMENT_END */);
|
14669
|
+
const endToken = this._advanceIf(11 /* TokenType.COMMENT_END */);
|
13480
14670
|
const value = text != null ? text.parts[0].trim() : null;
|
13481
|
-
|
14671
|
+
const sourceSpan = endToken == null ?
|
14672
|
+
token.sourceSpan :
|
14673
|
+
new ParseSourceSpan(token.sourceSpan.start, endToken.sourceSpan.end, token.sourceSpan.fullStart);
|
14674
|
+
this._addToParent(new Comment(value, sourceSpan));
|
13482
14675
|
}
|
13483
14676
|
_consumeExpansion(token) {
|
13484
14677
|
const switchValue = this._advance();
|
@@ -13565,7 +14758,12 @@ class _TreeBuilder {
|
|
13565
14758
|
const startSpan = token.sourceSpan;
|
13566
14759
|
let text = token.parts[0];
|
13567
14760
|
if (text.length > 0 && text[0] === '\n') {
|
13568
|
-
const parent = this.
|
14761
|
+
const parent = this._getContainer();
|
14762
|
+
// This is unlikely to happen, but we have an assertion just in case.
|
14763
|
+
if (parent instanceof BlockGroup) {
|
14764
|
+
this.errors.push(TreeError.create(null, startSpan, 'Text cannot be placed directly inside of a block group.'));
|
14765
|
+
return null;
|
14766
|
+
}
|
13569
14767
|
if (parent != null && parent.children.length === 0 &&
|
13570
14768
|
this.getTagDefinition(parent.name).ignoreFirstLf) {
|
13571
14769
|
text = text.substring(1);
|
@@ -13596,9 +14794,9 @@ class _TreeBuilder {
|
|
13596
14794
|
}
|
13597
14795
|
}
|
13598
14796
|
_closeVoidElement() {
|
13599
|
-
const el = this.
|
13600
|
-
if (el && this.getTagDefinition(el.name).isVoid) {
|
13601
|
-
this.
|
14797
|
+
const el = this._getContainer();
|
14798
|
+
if (el instanceof Element && this.getTagDefinition(el.name).isVoid) {
|
14799
|
+
this._containerStack.pop();
|
13602
14800
|
}
|
13603
14801
|
}
|
13604
14802
|
_consumeStartTag(startTagToken) {
|
@@ -13607,7 +14805,7 @@ class _TreeBuilder {
|
|
13607
14805
|
while (this._peek.type === 14 /* TokenType.ATTR_NAME */) {
|
13608
14806
|
attrs.push(this._consumeAttr(this._advance()));
|
13609
14807
|
}
|
13610
|
-
const fullName = this._getElementFullName(prefix, name, this.
|
14808
|
+
const fullName = this._getElementFullName(prefix, name, this._getClosestParentElement());
|
13611
14809
|
let selfClosing = false;
|
13612
14810
|
// Note: There could have been a tokenizer error
|
13613
14811
|
// so that we don't get a token for the end tag...
|
@@ -13628,33 +14826,34 @@ class _TreeBuilder {
|
|
13628
14826
|
// Create a separate `startSpan` because `span` will be modified when there is an `end` span.
|
13629
14827
|
const startSpan = new ParseSourceSpan(startTagToken.sourceSpan.start, end, startTagToken.sourceSpan.fullStart);
|
13630
14828
|
const el = new Element(fullName, attrs, [], span, startSpan, undefined);
|
13631
|
-
this.
|
14829
|
+
const parentEl = this._getContainer();
|
14830
|
+
this._pushContainer(el, parentEl instanceof Element &&
|
14831
|
+
this.getTagDefinition(parentEl.name).isClosedByChild(el.name));
|
13632
14832
|
if (selfClosing) {
|
13633
14833
|
// Elements that are self-closed have their `endSourceSpan` set to the full span, as the
|
13634
14834
|
// element start tag also represents the end tag.
|
13635
|
-
this.
|
14835
|
+
this._popContainer(fullName, Element, span);
|
13636
14836
|
}
|
13637
14837
|
else if (startTagToken.type === 4 /* TokenType.INCOMPLETE_TAG_OPEN */) {
|
13638
14838
|
// We already know the opening tag is not complete, so it is unlikely it has a corresponding
|
13639
14839
|
// close tag. Let's optimistically parse it as a full element and emit an error.
|
13640
|
-
this.
|
14840
|
+
this._popContainer(fullName, Element, null);
|
13641
14841
|
this.errors.push(TreeError.create(fullName, span, `Opening tag "${fullName}" not terminated.`));
|
13642
14842
|
}
|
13643
14843
|
}
|
13644
|
-
|
13645
|
-
|
13646
|
-
|
13647
|
-
this._elementStack.pop();
|
14844
|
+
_pushContainer(node, isClosedByChild) {
|
14845
|
+
if (isClosedByChild) {
|
14846
|
+
this._containerStack.pop();
|
13648
14847
|
}
|
13649
|
-
this._addToParent(
|
13650
|
-
this.
|
14848
|
+
this._addToParent(node);
|
14849
|
+
this._containerStack.push(node);
|
13651
14850
|
}
|
13652
14851
|
_consumeEndTag(endTagToken) {
|
13653
|
-
const fullName = this._getElementFullName(endTagToken.parts[0], endTagToken.parts[1], this.
|
14852
|
+
const fullName = this._getElementFullName(endTagToken.parts[0], endTagToken.parts[1], this._getClosestParentElement());
|
13654
14853
|
if (this.getTagDefinition(fullName).isVoid) {
|
13655
14854
|
this.errors.push(TreeError.create(fullName, endTagToken.sourceSpan, `Void elements do not have end tags "${endTagToken.parts[1]}"`));
|
13656
14855
|
}
|
13657
|
-
else if (!this.
|
14856
|
+
else if (!this._popContainer(fullName, Element, endTagToken.sourceSpan)) {
|
13658
14857
|
const errMsg = `Unexpected closing tag "${fullName}". It may happen when the tag has already been closed by another tag. For more info see https://www.w3.org/TR/html5/syntax.html#closing-elements-that-have-implied-end-tags`;
|
13659
14858
|
this.errors.push(TreeError.create(fullName, endTagToken.sourceSpan, errMsg));
|
13660
14859
|
}
|
@@ -13665,20 +14864,23 @@ class _TreeBuilder {
|
|
13665
14864
|
* not have a closing tag (for example, this happens when an incomplete
|
13666
14865
|
* opening tag is recovered).
|
13667
14866
|
*/
|
13668
|
-
|
14867
|
+
_popContainer(fullName, expectedType, endSourceSpan) {
|
13669
14868
|
let unexpectedCloseTagDetected = false;
|
13670
|
-
for (let stackIndex = this.
|
13671
|
-
const
|
13672
|
-
|
14869
|
+
for (let stackIndex = this._containerStack.length - 1; stackIndex >= 0; stackIndex--) {
|
14870
|
+
const node = this._containerStack[stackIndex];
|
14871
|
+
const name = node instanceof BlockGroup ? node.blocks[0]?.name : node.name;
|
14872
|
+
if (name === fullName && node instanceof expectedType) {
|
13673
14873
|
// Record the parse span with the element that is being closed. Any elements that are
|
13674
14874
|
// removed from the element stack at this point are closed implicitly, so they won't get
|
13675
14875
|
// an end source span (as there is no explicit closing element).
|
13676
|
-
|
13677
|
-
|
13678
|
-
this.
|
14876
|
+
node.endSourceSpan = endSourceSpan;
|
14877
|
+
node.sourceSpan.end = endSourceSpan !== null ? endSourceSpan.end : node.sourceSpan.end;
|
14878
|
+
this._containerStack.splice(stackIndex, this._containerStack.length - stackIndex);
|
13679
14879
|
return !unexpectedCloseTagDetected;
|
13680
14880
|
}
|
13681
|
-
|
14881
|
+
// Blocks are self-closing while block groups and (most times) elements are not.
|
14882
|
+
if (node instanceof BlockGroup ||
|
14883
|
+
node instanceof Element && !this.getTagDefinition(node.name).closedByParent) {
|
13682
14884
|
// Note that we encountered an unexpected close tag but continue processing the element
|
13683
14885
|
// stack so we can assign an `endSourceSpan` if there is a corresponding start tag for this
|
13684
14886
|
// end tag in the stack.
|
@@ -13737,16 +14939,92 @@ class _TreeBuilder {
|
|
13737
14939
|
new ParseSourceSpan(valueStartSpan.start, valueEnd, valueStartSpan.fullStart);
|
13738
14940
|
return new Attribute(fullName, value, new ParseSourceSpan(attrName.sourceSpan.start, attrEnd, attrName.sourceSpan.fullStart), attrName.sourceSpan, valueSpan, valueTokens.length > 0 ? valueTokens : undefined, undefined);
|
13739
14941
|
}
|
13740
|
-
|
13741
|
-
|
14942
|
+
_consumeBlockGroupOpen(token) {
|
14943
|
+
const end = this._peek.sourceSpan.fullStart;
|
14944
|
+
const span = new ParseSourceSpan(token.sourceSpan.start, end, token.sourceSpan.fullStart);
|
14945
|
+
// Create a separate `startSpan` because `span` will be modified when there is an `end` span.
|
14946
|
+
const startSpan = new ParseSourceSpan(token.sourceSpan.start, end, token.sourceSpan.fullStart);
|
14947
|
+
const blockGroup = new BlockGroup([], span, startSpan, null);
|
14948
|
+
this._pushContainer(blockGroup, false);
|
14949
|
+
const implicitBlock = this._consumeBlock(token, 26 /* TokenType.BLOCK_GROUP_OPEN_END */);
|
14950
|
+
// Block parameters are consumed as a part of the implicit block so we need to expand the
|
14951
|
+
// start source span once the block is parsed to include the full opening tag.
|
14952
|
+
startSpan.end = implicitBlock.startSourceSpan.end;
|
14953
|
+
}
|
14954
|
+
_consumeBlock(token, closeToken) {
|
14955
|
+
// The start of a block implicitly closes the previous block.
|
14956
|
+
this._conditionallyClosePreviousBlock();
|
14957
|
+
const parameters = [];
|
14958
|
+
while (this._peek.type === 28 /* TokenType.BLOCK_PARAMETER */) {
|
14959
|
+
const paramToken = this._advance();
|
14960
|
+
parameters.push(new BlockParameter(paramToken.parts[0], paramToken.sourceSpan));
|
14961
|
+
}
|
14962
|
+
if (this._peek.type === closeToken) {
|
14963
|
+
this._advance();
|
14964
|
+
}
|
14965
|
+
const end = this._peek.sourceSpan.fullStart;
|
14966
|
+
const span = new ParseSourceSpan(token.sourceSpan.start, end, token.sourceSpan.fullStart);
|
14967
|
+
// Create a separate `startSpan` because `span` will be modified when there is an `end` span.
|
14968
|
+
const startSpan = new ParseSourceSpan(token.sourceSpan.start, end, token.sourceSpan.fullStart);
|
14969
|
+
const block = new Block(token.parts[0], parameters, [], span, startSpan);
|
14970
|
+
const parent = this._getContainer();
|
14971
|
+
if (!(parent instanceof BlockGroup)) {
|
14972
|
+
this.errors.push(TreeError.create(block.name, block.sourceSpan, 'Blocks can only be placed inside of block groups.'));
|
14973
|
+
}
|
14974
|
+
else {
|
14975
|
+
parent.blocks.push(block);
|
14976
|
+
this._containerStack.push(block);
|
14977
|
+
}
|
14978
|
+
return block;
|
14979
|
+
}
|
14980
|
+
_consumeBlockGroupClose(token) {
|
14981
|
+
const name = token.parts[0];
|
14982
|
+
const previousContainer = this._getContainer();
|
14983
|
+
// Blocks are implcitly closed by the block group.
|
14984
|
+
this._conditionallyClosePreviousBlock();
|
14985
|
+
if (!this._popContainer(name, BlockGroup, token.sourceSpan)) {
|
14986
|
+
const context = previousContainer instanceof Element ?
|
14987
|
+
`There is an unclosed "${previousContainer.name}" HTML tag named that may have to be closed first.` :
|
14988
|
+
`The block may have been closed earlier.`;
|
14989
|
+
this.errors.push(TreeError.create(name, token.sourceSpan, `Unexpected closing block "${name}". ${context}`));
|
14990
|
+
}
|
14991
|
+
}
|
14992
|
+
_conditionallyClosePreviousBlock() {
|
14993
|
+
const container = this._getContainer();
|
14994
|
+
if (container instanceof Block) {
|
14995
|
+
// Blocks don't have an explicit closing tag, they're closed either by the next block or
|
14996
|
+
// the end of the block group. Infer the end span from the last child node.
|
14997
|
+
const lastChild = container.children.length ? container.children[container.children.length - 1] : null;
|
14998
|
+
const endSpan = lastChild === null ?
|
14999
|
+
null :
|
15000
|
+
new ParseSourceSpan(lastChild.sourceSpan.end, lastChild.sourceSpan.end);
|
15001
|
+
this._popContainer(container.name, Block, endSpan);
|
15002
|
+
}
|
15003
|
+
}
|
15004
|
+
_getContainer() {
|
15005
|
+
return this._containerStack.length > 0 ? this._containerStack[this._containerStack.length - 1] :
|
15006
|
+
null;
|
15007
|
+
}
|
15008
|
+
_getClosestParentElement() {
|
15009
|
+
for (let i = this._containerStack.length - 1; i > -1; i--) {
|
15010
|
+
if (this._containerStack[i] instanceof Element) {
|
15011
|
+
return this._containerStack[i];
|
15012
|
+
}
|
15013
|
+
}
|
15014
|
+
return null;
|
13742
15015
|
}
|
13743
15016
|
_addToParent(node) {
|
13744
|
-
const parent = this.
|
13745
|
-
if (parent
|
13746
|
-
|
15017
|
+
const parent = this._getContainer();
|
15018
|
+
if (parent === null) {
|
15019
|
+
this.rootNodes.push(node);
|
15020
|
+
}
|
15021
|
+
else if (parent instanceof BlockGroup) {
|
15022
|
+
// Due to how parsing is set up, we're unlikely to hit this code path, but we
|
15023
|
+
// have the assertion here just in case and to satisfy the type checker.
|
15024
|
+
this.errors.push(TreeError.create(null, node.sourceSpan, 'Block groups can only contain blocks.'));
|
13747
15025
|
}
|
13748
15026
|
else {
|
13749
|
-
|
15027
|
+
parent.children.push(node);
|
13750
15028
|
}
|
13751
15029
|
}
|
13752
15030
|
_getElementFullName(prefix, localName, parentElement) {
|
@@ -13804,10 +15082,9 @@ function hasPreserveWhitespacesAttr(attrs) {
|
|
13804
15082
|
return attrs.some((attr) => attr.name === PRESERVE_WS_ATTR_NAME);
|
13805
15083
|
}
|
13806
15084
|
/**
|
13807
|
-
*
|
13808
|
-
*
|
13809
|
-
*
|
13810
|
-
* and later on replaced by a space. We are re-implementing the same idea here.
|
15085
|
+
* &ngsp; is a placeholder for non-removable space
|
15086
|
+
* &ngsp; is converted to the 0xE500 PUA (Private Use Areas) unicode character
|
15087
|
+
* and later on replaced by a space.
|
13811
15088
|
*/
|
13812
15089
|
function replaceNgsp(value) {
|
13813
15090
|
// lexer is replacing the &ngsp; pseudo-entity with NGSP_UNICODE
|
@@ -13861,6 +15138,15 @@ class WhitespaceVisitor {
|
|
13861
15138
|
visitExpansionCase(expansionCase, context) {
|
13862
15139
|
return expansionCase;
|
13863
15140
|
}
|
15141
|
+
visitBlockGroup(group, context) {
|
15142
|
+
return new BlockGroup(visitAllWithSiblings(this, group.blocks), group.sourceSpan, group.startSourceSpan, group.endSourceSpan);
|
15143
|
+
}
|
15144
|
+
visitBlock(block, context) {
|
15145
|
+
return new Block(block.name, block.parameters, visitAllWithSiblings(this, block.children), block.sourceSpan, block.startSourceSpan);
|
15146
|
+
}
|
15147
|
+
visitBlockParameter(parameter, context) {
|
15148
|
+
return parameter;
|
15149
|
+
}
|
13864
15150
|
}
|
13865
15151
|
function createWhitespaceProcessedTextToken({ type, parts, sourceSpan }) {
|
13866
15152
|
return { type, parts: [processWhitespace(parts[0])], sourceSpan };
|
@@ -14118,7 +15404,7 @@ class BindingParser {
|
|
14118
15404
|
this._parseAnimation(name, expression, sourceSpan, absoluteOffset, keySpan, valueSpan, targetMatchableAttrs, targetProps);
|
14119
15405
|
}
|
14120
15406
|
else {
|
14121
|
-
this._parsePropertyAst(name, this.
|
15407
|
+
this._parsePropertyAst(name, this.parseBinding(expression, isHost, valueSpan || sourceSpan, absoluteOffset), sourceSpan, keySpan, valueSpan, targetMatchableAttrs, targetProps);
|
14122
15408
|
}
|
14123
15409
|
}
|
14124
15410
|
parsePropertyInterpolation(name, value, sourceSpan, valueSpan, targetMatchableAttrs, targetProps, keySpan, interpolatedTokens) {
|
@@ -14140,11 +15426,11 @@ class BindingParser {
|
|
14140
15426
|
// This will occur when a @trigger is not paired with an expression.
|
14141
15427
|
// For animations it is valid to not have an expression since */void
|
14142
15428
|
// states will be applied by angular when the element is attached/detached
|
14143
|
-
const ast = this.
|
15429
|
+
const ast = this.parseBinding(expression || 'undefined', false, valueSpan || sourceSpan, absoluteOffset);
|
14144
15430
|
targetMatchableAttrs.push([name, ast.source]);
|
14145
15431
|
targetProps.push(new ParsedProperty(name, ast, ParsedPropertyType.ANIMATION, sourceSpan, keySpan, valueSpan));
|
14146
15432
|
}
|
14147
|
-
|
15433
|
+
parseBinding(value, isHostBinding, sourceSpan, absoluteOffset) {
|
14148
15434
|
const sourceInfo = (sourceSpan && sourceSpan.start || '(unknown)').toString();
|
14149
15435
|
try {
|
14150
15436
|
const ast = isHostBinding ?
|
@@ -14263,7 +15549,7 @@ class BindingParser {
|
|
14263
15549
|
if (ast) {
|
14264
15550
|
this._reportExpressionParserErrors(ast.errors, sourceSpan);
|
14265
15551
|
}
|
14266
|
-
if (!ast || ast.ast instanceof EmptyExpr) {
|
15552
|
+
if (!ast || ast.ast instanceof EmptyExpr$1) {
|
14267
15553
|
this._reportError(`Empty expressions are not allowed`, sourceSpan);
|
14268
15554
|
return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo, absoluteOffset);
|
14269
15555
|
}
|
@@ -14409,6 +15695,415 @@ function normalizeNgContentSelect(selectAttr) {
|
|
14409
15695
|
return selectAttr;
|
14410
15696
|
}
|
14411
15697
|
|
15698
|
+
/** Pattern for a timing value in a trigger. */
|
15699
|
+
const TIME_PATTERN = /^\d+(ms|s)?$/;
|
15700
|
+
/** Pattern for a separator between keywords in a trigger expression. */
|
15701
|
+
const SEPARATOR_PATTERN = /^\s$/;
|
15702
|
+
/** Pairs of characters that form syntax that is comma-delimited. */
|
15703
|
+
const COMMA_DELIMITED_SYNTAX = new Map([
|
15704
|
+
[$LBRACE, $RBRACE],
|
15705
|
+
[$LBRACKET, $RBRACKET],
|
15706
|
+
[$LPAREN, $RPAREN], // Function calls
|
15707
|
+
]);
|
15708
|
+
/** Possible types of `on` triggers. */
|
15709
|
+
var OnTriggerType;
|
15710
|
+
(function (OnTriggerType) {
|
15711
|
+
OnTriggerType["IDLE"] = "idle";
|
15712
|
+
OnTriggerType["TIMER"] = "timer";
|
15713
|
+
OnTriggerType["INTERACTION"] = "interaction";
|
15714
|
+
OnTriggerType["IMMEDIATE"] = "immediate";
|
15715
|
+
OnTriggerType["HOVER"] = "hover";
|
15716
|
+
OnTriggerType["VIEWPORT"] = "viewport";
|
15717
|
+
})(OnTriggerType || (OnTriggerType = {}));
|
15718
|
+
/** Parses a `when` deferred trigger. */
|
15719
|
+
function parseWhenTrigger({ expression, sourceSpan }, bindingParser, errors) {
|
15720
|
+
const whenIndex = expression.indexOf('when');
|
15721
|
+
// This is here just to be safe, we shouldn't enter this function
|
15722
|
+
// in the first place if a block doesn't have the "when" keyword.
|
15723
|
+
if (whenIndex === -1) {
|
15724
|
+
errors.push(new ParseError(sourceSpan, `Could not find "when" keyword in expression`));
|
15725
|
+
return null;
|
15726
|
+
}
|
15727
|
+
const start = getTriggerParametersStart(expression, whenIndex + 1);
|
15728
|
+
const parsed = bindingParser.parseBinding(expression.slice(start), false, sourceSpan, sourceSpan.start.offset + start);
|
15729
|
+
return new BoundDeferredTrigger(parsed, sourceSpan);
|
15730
|
+
}
|
15731
|
+
/** Parses an `on` trigger */
|
15732
|
+
function parseOnTrigger({ expression, sourceSpan }, errors) {
|
15733
|
+
const onIndex = expression.indexOf('on');
|
15734
|
+
// This is here just to be safe, we shouldn't enter this function
|
15735
|
+
// in the first place if a block doesn't have the "on" keyword.
|
15736
|
+
if (onIndex === -1) {
|
15737
|
+
errors.push(new ParseError(sourceSpan, `Could not find "on" keyword in expression`));
|
15738
|
+
return [];
|
15739
|
+
}
|
15740
|
+
const start = getTriggerParametersStart(expression, onIndex + 1);
|
15741
|
+
return new OnTriggerParser(expression, start, sourceSpan, errors).parse();
|
15742
|
+
}
|
15743
|
+
class OnTriggerParser {
|
15744
|
+
constructor(expression, start, span, errors) {
|
15745
|
+
this.expression = expression;
|
15746
|
+
this.start = start;
|
15747
|
+
this.span = span;
|
15748
|
+
this.errors = errors;
|
15749
|
+
this.index = 0;
|
15750
|
+
this.triggers = [];
|
15751
|
+
this.tokens = new Lexer().tokenize(expression.slice(start));
|
15752
|
+
}
|
15753
|
+
parse() {
|
15754
|
+
while (this.tokens.length > 0 && this.index < this.tokens.length) {
|
15755
|
+
const token = this.token();
|
15756
|
+
if (!token.isIdentifier()) {
|
15757
|
+
this.unexpectedToken(token);
|
15758
|
+
break;
|
15759
|
+
}
|
15760
|
+
// An identifier immediately followed by a comma or the end of
|
15761
|
+
// the expression cannot have parameters so we can exit early.
|
15762
|
+
if (this.isFollowedByOrLast($COMMA)) {
|
15763
|
+
this.consumeTrigger(token, []);
|
15764
|
+
this.advance();
|
15765
|
+
}
|
15766
|
+
else if (this.isFollowedByOrLast($LPAREN)) {
|
15767
|
+
this.advance(); // Advance to the opening paren.
|
15768
|
+
const prevErrors = this.errors.length;
|
15769
|
+
const parameters = this.consumeParameters();
|
15770
|
+
if (this.errors.length !== prevErrors) {
|
15771
|
+
break;
|
15772
|
+
}
|
15773
|
+
this.consumeTrigger(token, parameters);
|
15774
|
+
this.advance(); // Advance past the closing paren.
|
15775
|
+
}
|
15776
|
+
else if (this.index < this.tokens.length - 1) {
|
15777
|
+
this.unexpectedToken(this.tokens[this.index + 1]);
|
15778
|
+
}
|
15779
|
+
this.advance();
|
15780
|
+
}
|
15781
|
+
return this.triggers;
|
15782
|
+
}
|
15783
|
+
advance() {
|
15784
|
+
this.index++;
|
15785
|
+
}
|
15786
|
+
isFollowedByOrLast(char) {
|
15787
|
+
if (this.index === this.tokens.length - 1) {
|
15788
|
+
return true;
|
15789
|
+
}
|
15790
|
+
return this.tokens[this.index + 1].isCharacter(char);
|
15791
|
+
}
|
15792
|
+
token() {
|
15793
|
+
return this.tokens[Math.min(this.index, this.tokens.length - 1)];
|
15794
|
+
}
|
15795
|
+
consumeTrigger(identifier, parameters) {
|
15796
|
+
const startSpan = this.span.start.moveBy(this.start + identifier.index - this.tokens[0].index);
|
15797
|
+
const endSpan = startSpan.moveBy(this.token().end - identifier.index);
|
15798
|
+
const sourceSpan = new ParseSourceSpan(startSpan, endSpan);
|
15799
|
+
try {
|
15800
|
+
switch (identifier.toString()) {
|
15801
|
+
case OnTriggerType.IDLE:
|
15802
|
+
this.triggers.push(createIdleTrigger(parameters, sourceSpan));
|
15803
|
+
break;
|
15804
|
+
case OnTriggerType.TIMER:
|
15805
|
+
this.triggers.push(createTimerTrigger(parameters, sourceSpan));
|
15806
|
+
break;
|
15807
|
+
case OnTriggerType.INTERACTION:
|
15808
|
+
this.triggers.push(createInteractionTrigger(parameters, sourceSpan));
|
15809
|
+
break;
|
15810
|
+
case OnTriggerType.IMMEDIATE:
|
15811
|
+
this.triggers.push(createImmediateTrigger(parameters, sourceSpan));
|
15812
|
+
break;
|
15813
|
+
case OnTriggerType.HOVER:
|
15814
|
+
this.triggers.push(createHoverTrigger(parameters, sourceSpan));
|
15815
|
+
break;
|
15816
|
+
case OnTriggerType.VIEWPORT:
|
15817
|
+
this.triggers.push(createViewportTrigger(parameters, sourceSpan));
|
15818
|
+
break;
|
15819
|
+
default:
|
15820
|
+
throw new Error(`Unrecognized trigger type "${identifier}"`);
|
15821
|
+
}
|
15822
|
+
}
|
15823
|
+
catch (e) {
|
15824
|
+
this.error(identifier, e.message);
|
15825
|
+
}
|
15826
|
+
}
|
15827
|
+
consumeParameters() {
|
15828
|
+
const parameters = [];
|
15829
|
+
if (!this.token().isCharacter($LPAREN)) {
|
15830
|
+
this.unexpectedToken(this.token());
|
15831
|
+
return parameters;
|
15832
|
+
}
|
15833
|
+
this.advance();
|
15834
|
+
const commaDelimStack = [];
|
15835
|
+
let current = '';
|
15836
|
+
while (this.index < this.tokens.length) {
|
15837
|
+
const token = this.token();
|
15838
|
+
// Stop parsing if we've hit the end character and we're outside of a comma-delimited syntax.
|
15839
|
+
// Note that we don't need to account for strings here since the lexer already parsed them
|
15840
|
+
// into string tokens.
|
15841
|
+
if (token.isCharacter($RPAREN) && commaDelimStack.length === 0) {
|
15842
|
+
if (current.length) {
|
15843
|
+
parameters.push(current);
|
15844
|
+
}
|
15845
|
+
break;
|
15846
|
+
}
|
15847
|
+
// In the `on` microsyntax "top-level" commas (e.g. ones outside of an parameters) separate
|
15848
|
+
// the different triggers (e.g. `on idle,timer(500)`). This is problematic, because the
|
15849
|
+
// function-like syntax also implies that multiple parameters can be passed into the
|
15850
|
+
// individual trigger (e.g. `on foo(a, b)`). To avoid tripping up the parser with commas that
|
15851
|
+
// are part of other sorts of syntax (object literals, arrays), we treat anything inside
|
15852
|
+
// a comma-delimited syntax block as plain text.
|
15853
|
+
if (token.type === TokenType.Character && COMMA_DELIMITED_SYNTAX.has(token.numValue)) {
|
15854
|
+
commaDelimStack.push(COMMA_DELIMITED_SYNTAX.get(token.numValue));
|
15855
|
+
}
|
15856
|
+
if (commaDelimStack.length > 0 &&
|
15857
|
+
token.isCharacter(commaDelimStack[commaDelimStack.length - 1])) {
|
15858
|
+
commaDelimStack.pop();
|
15859
|
+
}
|
15860
|
+
// If we hit a comma outside of a comma-delimited syntax, it means
|
15861
|
+
// that we're at the top level and we're starting a new parameter.
|
15862
|
+
if (commaDelimStack.length === 0 && token.isCharacter($COMMA) && current.length > 0) {
|
15863
|
+
parameters.push(current);
|
15864
|
+
current = '';
|
15865
|
+
this.advance();
|
15866
|
+
continue;
|
15867
|
+
}
|
15868
|
+
// Otherwise treat the token as a plain text character in the current parameter.
|
15869
|
+
current += this.tokenText();
|
15870
|
+
this.advance();
|
15871
|
+
}
|
15872
|
+
if (!this.token().isCharacter($RPAREN) || commaDelimStack.length > 0) {
|
15873
|
+
this.error(this.token(), 'Unexpected end of expression');
|
15874
|
+
}
|
15875
|
+
if (this.index < this.tokens.length - 1 &&
|
15876
|
+
!this.tokens[this.index + 1].isCharacter($COMMA)) {
|
15877
|
+
this.unexpectedToken(this.tokens[this.index + 1]);
|
15878
|
+
}
|
15879
|
+
return parameters;
|
15880
|
+
}
|
15881
|
+
tokenText() {
|
15882
|
+
// Tokens have a toString already which we could use, but for string tokens it omits the quotes.
|
15883
|
+
// Eventually we could expose this information on the token directly.
|
15884
|
+
return this.expression.slice(this.start + this.token().index, this.start + this.token().end);
|
15885
|
+
}
|
15886
|
+
error(token, message) {
|
15887
|
+
const newStart = this.span.start.moveBy(this.start + token.index);
|
15888
|
+
const newEnd = newStart.moveBy(token.end - token.index);
|
15889
|
+
this.errors.push(new ParseError(new ParseSourceSpan(newStart, newEnd), message));
|
15890
|
+
}
|
15891
|
+
unexpectedToken(token) {
|
15892
|
+
this.error(token, `Unexpected token "${token}"`);
|
15893
|
+
}
|
15894
|
+
}
|
15895
|
+
function createIdleTrigger(parameters, sourceSpan) {
|
15896
|
+
if (parameters.length > 0) {
|
15897
|
+
throw new Error(`"${OnTriggerType.IDLE}" trigger cannot have parameters`);
|
15898
|
+
}
|
15899
|
+
return new IdleDeferredTrigger(sourceSpan);
|
15900
|
+
}
|
15901
|
+
function createTimerTrigger(parameters, sourceSpan) {
|
15902
|
+
if (parameters.length !== 1) {
|
15903
|
+
throw new Error(`"${OnTriggerType.TIMER}" trigger must have exactly one parameter`);
|
15904
|
+
}
|
15905
|
+
const delay = parseDeferredTime(parameters[0]);
|
15906
|
+
if (delay === null) {
|
15907
|
+
throw new Error(`Could not parse time value of trigger "${OnTriggerType.TIMER}"`);
|
15908
|
+
}
|
15909
|
+
return new TimerDeferredTrigger(delay, sourceSpan);
|
15910
|
+
}
|
15911
|
+
function createInteractionTrigger(parameters, sourceSpan) {
|
15912
|
+
if (parameters.length > 1) {
|
15913
|
+
throw new Error(`"${OnTriggerType.INTERACTION}" trigger can only have zero or one parameters`);
|
15914
|
+
}
|
15915
|
+
return new InteractionDeferredTrigger(parameters[0] ?? null, sourceSpan);
|
15916
|
+
}
|
15917
|
+
function createImmediateTrigger(parameters, sourceSpan) {
|
15918
|
+
if (parameters.length > 0) {
|
15919
|
+
throw new Error(`"${OnTriggerType.IMMEDIATE}" trigger cannot have parameters`);
|
15920
|
+
}
|
15921
|
+
return new ImmediateDeferredTrigger(sourceSpan);
|
15922
|
+
}
|
15923
|
+
function createHoverTrigger(parameters, sourceSpan) {
|
15924
|
+
if (parameters.length > 0) {
|
15925
|
+
throw new Error(`"${OnTriggerType.HOVER}" trigger cannot have parameters`);
|
15926
|
+
}
|
15927
|
+
return new HoverDeferredTrigger(sourceSpan);
|
15928
|
+
}
|
15929
|
+
function createViewportTrigger(parameters, sourceSpan) {
|
15930
|
+
// TODO: the RFC has some more potential parameters for `viewport`.
|
15931
|
+
if (parameters.length > 1) {
|
15932
|
+
throw new Error(`"${OnTriggerType.VIEWPORT}" trigger can only have zero or one parameters`);
|
15933
|
+
}
|
15934
|
+
return new ViewportDeferredTrigger(parameters[0] ?? null, sourceSpan);
|
15935
|
+
}
|
15936
|
+
/** Gets the index within an expression at which the trigger parameters start. */
|
15937
|
+
function getTriggerParametersStart(value, startPosition = 0) {
|
15938
|
+
let hasFoundSeparator = false;
|
15939
|
+
for (let i = startPosition; i < value.length; i++) {
|
15940
|
+
if (SEPARATOR_PATTERN.test(value[i])) {
|
15941
|
+
hasFoundSeparator = true;
|
15942
|
+
}
|
15943
|
+
else if (hasFoundSeparator) {
|
15944
|
+
return i;
|
15945
|
+
}
|
15946
|
+
}
|
15947
|
+
return -1;
|
15948
|
+
}
|
15949
|
+
/**
|
15950
|
+
* Parses a time expression from a deferred trigger to
|
15951
|
+
* milliseconds. Returns null if it cannot be parsed.
|
15952
|
+
*/
|
15953
|
+
function parseDeferredTime(value) {
|
15954
|
+
const match = value.match(TIME_PATTERN);
|
15955
|
+
if (!match) {
|
15956
|
+
return null;
|
15957
|
+
}
|
15958
|
+
const [time, units] = match;
|
15959
|
+
return parseInt(time) * (units === 's' ? 1000 : 1);
|
15960
|
+
}
|
15961
|
+
|
15962
|
+
/** Pattern to identify a `prefetch when` trigger. */
|
15963
|
+
const PREFETCH_WHEN_PATTERN = /^prefetch\s+when\s/;
|
15964
|
+
/** Pattern to identify a `prefetch on` trigger. */
|
15965
|
+
const PREFETCH_ON_PATTERN = /^prefetch\s+on\s/;
|
15966
|
+
/** Pattern to identify a `minimum` parameter in a block. */
|
15967
|
+
const MINIMUM_PARAMETER_PATTERN = /^minimum\s/;
|
15968
|
+
/** Pattern to identify a `after` parameter in a block. */
|
15969
|
+
const AFTER_PARAMETER_PATTERN = /^after\s/;
|
15970
|
+
/** Pattern to identify a `when` parameter in a block. */
|
15971
|
+
const WHEN_PARAMETER_PATTERN = /^when\s/;
|
15972
|
+
/** Pattern to identify a `on` parameter in a block. */
|
15973
|
+
const ON_PARAMETER_PATTERN = /^on\s/;
|
15974
|
+
/** Possible types of secondary deferred blocks. */
|
15975
|
+
var SecondaryDeferredBlockType;
|
15976
|
+
(function (SecondaryDeferredBlockType) {
|
15977
|
+
SecondaryDeferredBlockType["PLACEHOLDER"] = "placeholder";
|
15978
|
+
SecondaryDeferredBlockType["LOADING"] = "loading";
|
15979
|
+
SecondaryDeferredBlockType["ERROR"] = "error";
|
15980
|
+
})(SecondaryDeferredBlockType || (SecondaryDeferredBlockType = {}));
|
15981
|
+
/** Creates a deferred block from an HTML AST node. */
|
15982
|
+
function createDeferredBlock(ast, visitor, bindingParser) {
|
15983
|
+
const errors = [];
|
15984
|
+
const [primaryBlock, ...secondaryBlocks] = ast.blocks;
|
15985
|
+
const { triggers, prefetchTriggers } = parsePrimaryTriggers(primaryBlock.parameters, bindingParser, errors);
|
15986
|
+
const { placeholder, loading, error } = parseSecondaryBlocks(secondaryBlocks, errors, visitor);
|
15987
|
+
return {
|
15988
|
+
node: new DeferredBlock(visitAll(visitor, primaryBlock.children), triggers, prefetchTriggers, placeholder, loading, error, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan),
|
15989
|
+
errors,
|
15990
|
+
};
|
15991
|
+
}
|
15992
|
+
function parseSecondaryBlocks(blocks, errors, visitor) {
|
15993
|
+
let placeholder = null;
|
15994
|
+
let loading = null;
|
15995
|
+
let error = null;
|
15996
|
+
for (const block of blocks) {
|
15997
|
+
try {
|
15998
|
+
switch (block.name) {
|
15999
|
+
case SecondaryDeferredBlockType.PLACEHOLDER:
|
16000
|
+
if (placeholder !== null) {
|
16001
|
+
errors.push(new ParseError(block.startSourceSpan, `"defer" block can only have one "${SecondaryDeferredBlockType.PLACEHOLDER}" block`));
|
16002
|
+
}
|
16003
|
+
else {
|
16004
|
+
placeholder = parsePlaceholderBlock(block, visitor);
|
16005
|
+
}
|
16006
|
+
break;
|
16007
|
+
case SecondaryDeferredBlockType.LOADING:
|
16008
|
+
if (loading !== null) {
|
16009
|
+
errors.push(new ParseError(block.startSourceSpan, `"defer" block can only have one "${SecondaryDeferredBlockType.LOADING}" block`));
|
16010
|
+
}
|
16011
|
+
else {
|
16012
|
+
loading = parseLoadingBlock(block, visitor);
|
16013
|
+
}
|
16014
|
+
break;
|
16015
|
+
case SecondaryDeferredBlockType.ERROR:
|
16016
|
+
if (error !== null) {
|
16017
|
+
errors.push(new ParseError(block.startSourceSpan, `"defer" block can only have one "${SecondaryDeferredBlockType.ERROR}" block`));
|
16018
|
+
}
|
16019
|
+
else {
|
16020
|
+
error = parseErrorBlock(block, visitor);
|
16021
|
+
}
|
16022
|
+
break;
|
16023
|
+
default:
|
16024
|
+
errors.push(new ParseError(block.startSourceSpan, `Unrecognized block "${block.name}"`));
|
16025
|
+
break;
|
16026
|
+
}
|
16027
|
+
}
|
16028
|
+
catch (e) {
|
16029
|
+
errors.push(new ParseError(block.startSourceSpan, e.message));
|
16030
|
+
}
|
16031
|
+
}
|
16032
|
+
return { placeholder, loading, error };
|
16033
|
+
}
|
16034
|
+
function parsePlaceholderBlock(ast, visitor) {
|
16035
|
+
let minimumTime = null;
|
16036
|
+
for (const param of ast.parameters) {
|
16037
|
+
if (MINIMUM_PARAMETER_PATTERN.test(param.expression)) {
|
16038
|
+
const parsedTime = parseDeferredTime(param.expression.slice(getTriggerParametersStart(param.expression)));
|
16039
|
+
if (parsedTime === null) {
|
16040
|
+
throw new Error(`Could not parse time value of parameter "minimum"`);
|
16041
|
+
}
|
16042
|
+
minimumTime = parsedTime;
|
16043
|
+
}
|
16044
|
+
else {
|
16045
|
+
throw new Error(`Unrecognized parameter in "${SecondaryDeferredBlockType.PLACEHOLDER}" block: "${param.expression}"`);
|
16046
|
+
}
|
16047
|
+
}
|
16048
|
+
return new DeferredBlockPlaceholder(visitAll(visitor, ast.children), minimumTime, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan);
|
16049
|
+
}
|
16050
|
+
function parseLoadingBlock(ast, visitor) {
|
16051
|
+
let afterTime = null;
|
16052
|
+
let minimumTime = null;
|
16053
|
+
for (const param of ast.parameters) {
|
16054
|
+
if (AFTER_PARAMETER_PATTERN.test(param.expression)) {
|
16055
|
+
const parsedTime = parseDeferredTime(param.expression.slice(getTriggerParametersStart(param.expression)));
|
16056
|
+
if (parsedTime === null) {
|
16057
|
+
throw new Error(`Could not parse time value of parameter "after"`);
|
16058
|
+
}
|
16059
|
+
afterTime = parsedTime;
|
16060
|
+
}
|
16061
|
+
else if (MINIMUM_PARAMETER_PATTERN.test(param.expression)) {
|
16062
|
+
const parsedTime = parseDeferredTime(param.expression.slice(getTriggerParametersStart(param.expression)));
|
16063
|
+
if (parsedTime === null) {
|
16064
|
+
throw new Error(`Could not parse time value of parameter "minimum"`);
|
16065
|
+
}
|
16066
|
+
minimumTime = parsedTime;
|
16067
|
+
}
|
16068
|
+
else {
|
16069
|
+
throw new Error(`Unrecognized parameter in "${SecondaryDeferredBlockType.LOADING}" block: "${param.expression}"`);
|
16070
|
+
}
|
16071
|
+
}
|
16072
|
+
return new DeferredBlockLoading(visitAll(visitor, ast.children), afterTime, minimumTime, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan);
|
16073
|
+
}
|
16074
|
+
function parseErrorBlock(ast, visitor) {
|
16075
|
+
if (ast.parameters.length > 0) {
|
16076
|
+
throw new Error(`"${SecondaryDeferredBlockType.ERROR}" block cannot have parameters`);
|
16077
|
+
}
|
16078
|
+
return new DeferredBlockError(visitAll(visitor, ast.children), ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan);
|
16079
|
+
}
|
16080
|
+
function parsePrimaryTriggers(params, bindingParser, errors) {
|
16081
|
+
const triggers = [];
|
16082
|
+
const prefetchTriggers = [];
|
16083
|
+
for (const param of params) {
|
16084
|
+
// The lexer ignores the leading spaces so we can assume
|
16085
|
+
// that the expression starts with a keyword.
|
16086
|
+
if (WHEN_PARAMETER_PATTERN.test(param.expression)) {
|
16087
|
+
const result = parseWhenTrigger(param, bindingParser, errors);
|
16088
|
+
result !== null && triggers.push(result);
|
16089
|
+
}
|
16090
|
+
else if (ON_PARAMETER_PATTERN.test(param.expression)) {
|
16091
|
+
triggers.push(...parseOnTrigger(param, errors));
|
16092
|
+
}
|
16093
|
+
else if (PREFETCH_WHEN_PATTERN.test(param.expression)) {
|
16094
|
+
const result = parseWhenTrigger(param, bindingParser, errors);
|
16095
|
+
result !== null && prefetchTriggers.push(result);
|
16096
|
+
}
|
16097
|
+
else if (PREFETCH_ON_PATTERN.test(param.expression)) {
|
16098
|
+
prefetchTriggers.push(...parseOnTrigger(param, errors));
|
16099
|
+
}
|
16100
|
+
else {
|
16101
|
+
errors.push(new ParseError(param.sourceSpan, 'Unrecognized trigger'));
|
16102
|
+
}
|
16103
|
+
}
|
16104
|
+
return { triggers, prefetchTriggers };
|
16105
|
+
}
|
16106
|
+
|
14412
16107
|
const BIND_NAME_REGEXP = /^(?:(bind-)|(let-)|(ref-|#)|(on-)|(bindon-)|(@))(.*)$/;
|
14413
16108
|
// Group 1 = "bind-"
|
14414
16109
|
const KW_BIND_IDX = 1;
|
@@ -14532,7 +16227,16 @@ class HtmlAstToIvyAst {
|
|
14532
16227
|
attributes.push(this.visitAttribute(attribute));
|
14533
16228
|
}
|
14534
16229
|
}
|
14535
|
-
|
16230
|
+
let children;
|
16231
|
+
if (preparsedElement.nonBindable) {
|
16232
|
+
// The `NonBindableVisitor` may need to return an array of nodes for block groups so we need
|
16233
|
+
// to flatten the array here. Avoid doing this for the `HtmlAstToIvyAst` since `flat` creates
|
16234
|
+
// a new array.
|
16235
|
+
children = visitAll(NON_BINDABLE_VISITOR, element.children).flat(Infinity);
|
16236
|
+
}
|
16237
|
+
else {
|
16238
|
+
children = visitAll(this, element.children);
|
16239
|
+
}
|
14536
16240
|
let parsedElement;
|
14537
16241
|
if (preparsedElement.type === PreparsedElementType.NG_CONTENT) {
|
14538
16242
|
// `<ng-content>`
|
@@ -14630,6 +16334,23 @@ class HtmlAstToIvyAst {
|
|
14630
16334
|
}
|
14631
16335
|
return null;
|
14632
16336
|
}
|
16337
|
+
visitBlockGroup(group, context) {
|
16338
|
+
const primaryBlock = group.blocks[0];
|
16339
|
+
// The HTML parser ensures that we don't hit this case, but we have an assertion just in case.
|
16340
|
+
if (!primaryBlock) {
|
16341
|
+
this.reportError('Block group must have at least one block.', group.sourceSpan);
|
16342
|
+
return null;
|
16343
|
+
}
|
16344
|
+
if (primaryBlock.name === 'defer' && this.options.enabledBlockTypes.has(primaryBlock.name)) {
|
16345
|
+
const { node, errors } = createDeferredBlock(group, this, this.bindingParser);
|
16346
|
+
this.errors.push(...errors);
|
16347
|
+
return node;
|
16348
|
+
}
|
16349
|
+
this.reportError(`Unrecognized block "${primaryBlock.name}".`, primaryBlock.sourceSpan);
|
16350
|
+
return null;
|
16351
|
+
}
|
16352
|
+
visitBlock(block, context) { }
|
16353
|
+
visitBlockParameter(parameter, context) { }
|
14633
16354
|
// convert view engine `ParsedProperty` to a format suitable for IVY
|
14634
16355
|
extractAttributes(elementName, properties, i18nPropsMeta) {
|
14635
16356
|
const bound = [];
|
@@ -14807,6 +16528,25 @@ class NonBindableVisitor {
|
|
14807
16528
|
visitExpansionCase(expansionCase) {
|
14808
16529
|
return null;
|
14809
16530
|
}
|
16531
|
+
visitBlockGroup(group, context) {
|
16532
|
+
const nodes = visitAll(this, group.blocks);
|
16533
|
+
// We only need to do the end tag since the start will be added as a part of the primary block.
|
16534
|
+
if (group.endSourceSpan !== null) {
|
16535
|
+
nodes.push(new Text$3(group.endSourceSpan.toString(), group.endSourceSpan));
|
16536
|
+
}
|
16537
|
+
return nodes;
|
16538
|
+
}
|
16539
|
+
visitBlock(block, context) {
|
16540
|
+
return [
|
16541
|
+
// In an ngNonBindable context we treat the opening/closing tags of block as plain text.
|
16542
|
+
// This is the as if the `tokenizeBlocks` option was disabled.
|
16543
|
+
new Text$3(block.startSourceSpan.toString(), block.startSourceSpan),
|
16544
|
+
...visitAll(this, block.children)
|
16545
|
+
];
|
16546
|
+
}
|
16547
|
+
visitBlockParameter(parameter, context) {
|
16548
|
+
return null;
|
16549
|
+
}
|
14810
16550
|
}
|
14811
16551
|
const NON_BINDABLE_VISITOR = new NonBindableVisitor();
|
14812
16552
|
function normalizeAttributeName(attrName) {
|
@@ -15254,6 +16994,17 @@ class _I18nVisitor {
|
|
15254
16994
|
visitExpansionCase(_icuCase, _context) {
|
15255
16995
|
throw new Error('Unreachable code');
|
15256
16996
|
}
|
16997
|
+
visitBlockGroup(group, context) {
|
16998
|
+
const children = visitAll(this, group.blocks, context);
|
16999
|
+
const node = new Container(children, group.sourceSpan);
|
17000
|
+
return context.visitNodeFn(group, node);
|
17001
|
+
}
|
17002
|
+
visitBlock(block, context) {
|
17003
|
+
const children = visitAll(this, block.children, context);
|
17004
|
+
const node = new Container(children, block.sourceSpan);
|
17005
|
+
return context.visitNodeFn(block, node);
|
17006
|
+
}
|
17007
|
+
visitBlockParameter(_parameter, _context) { }
|
15257
17008
|
/**
|
15258
17009
|
* Convert, text and interpolated tokens up into text and placeholder pieces.
|
15259
17010
|
*
|
@@ -15397,12 +17148,11 @@ class I18nMetaVisitor {
|
|
15397
17148
|
// whether visited nodes contain i18n information
|
15398
17149
|
this.hasI18nMeta = false;
|
15399
17150
|
this._errors = [];
|
15400
|
-
// i18n message generation factory
|
15401
|
-
this._createI18nMessage = createI18nMessageFactory(this.interpolationConfig);
|
15402
17151
|
}
|
15403
17152
|
_generateI18nMessage(nodes, meta = '', visitNodeFn) {
|
15404
17153
|
const { meaning, description, customId } = this._parseMetadata(meta);
|
15405
|
-
const
|
17154
|
+
const createI18nMessage = createI18nMessageFactory(this.interpolationConfig);
|
17155
|
+
const message = createI18nMessage(nodes, meaning, description, customId, visitNodeFn);
|
15406
17156
|
this._setMessageId(message, meta);
|
15407
17157
|
this._setLegacyIds(message, meta);
|
15408
17158
|
return message;
|
@@ -15501,6 +17251,17 @@ class I18nMetaVisitor {
|
|
15501
17251
|
visitExpansionCase(expansionCase) {
|
15502
17252
|
return expansionCase;
|
15503
17253
|
}
|
17254
|
+
visitBlockGroup(group, context) {
|
17255
|
+
visitAll(this, group.blocks, context);
|
17256
|
+
return group;
|
17257
|
+
}
|
17258
|
+
visitBlock(block, context) {
|
17259
|
+
visitAll(this, block.children, context);
|
17260
|
+
return block;
|
17261
|
+
}
|
17262
|
+
visitBlockParameter(parameter, context) {
|
17263
|
+
return parameter;
|
17264
|
+
}
|
15504
17265
|
/**
|
15505
17266
|
* Parse the general form `meta` passed into extract the explicit metadata needed to create a
|
15506
17267
|
* `Message`.
|
@@ -15882,7 +17643,7 @@ function createComponentDefConsts() {
|
|
15882
17643
|
};
|
15883
17644
|
}
|
15884
17645
|
class TemplateDefinitionBuilder {
|
15885
|
-
constructor(constantPool, parentBindingScope, level = 0, contextName, i18nContext, templateIndex, templateName, _namespace, relativeContextFilePath, i18nUseExternalIds, _constants = createComponentDefConsts()) {
|
17646
|
+
constructor(constantPool, parentBindingScope, level = 0, contextName, i18nContext, templateIndex, templateName, _namespace, relativeContextFilePath, i18nUseExternalIds, deferBlocks, _constants = createComponentDefConsts()) {
|
15886
17647
|
this.constantPool = constantPool;
|
15887
17648
|
this.level = level;
|
15888
17649
|
this.contextName = contextName;
|
@@ -15891,6 +17652,7 @@ class TemplateDefinitionBuilder {
|
|
15891
17652
|
this.templateName = templateName;
|
15892
17653
|
this._namespace = _namespace;
|
15893
17654
|
this.i18nUseExternalIds = i18nUseExternalIds;
|
17655
|
+
this.deferBlocks = deferBlocks;
|
15894
17656
|
this._constants = _constants;
|
15895
17657
|
this._dataIndex = 0;
|
15896
17658
|
this._bindingContext = 0;
|
@@ -16093,7 +17855,7 @@ class TemplateDefinitionBuilder {
|
|
16093
17855
|
else {
|
16094
17856
|
const value = prop.value.visit(this._valueConverter);
|
16095
17857
|
this.allocateBindingSlots(value);
|
16096
|
-
if (value instanceof Interpolation) {
|
17858
|
+
if (value instanceof Interpolation$1) {
|
16097
17859
|
const { strings, expressions } = value;
|
16098
17860
|
const { id, bindings } = this.i18n;
|
16099
17861
|
const label = assembleI18nBoundString(strings, bindings.size, id);
|
@@ -16213,7 +17975,7 @@ class TemplateDefinitionBuilder {
|
|
16213
17975
|
const message = attr.i18n;
|
16214
17976
|
const converted = attr.value.visit(this._valueConverter);
|
16215
17977
|
this.allocateBindingSlots(converted);
|
16216
|
-
if (converted instanceof Interpolation) {
|
17978
|
+
if (converted instanceof Interpolation$1) {
|
16217
17979
|
const placeholders = assembleBoundTextPlaceholders(message);
|
16218
17980
|
const params = placeholdersToParams(placeholders);
|
16219
17981
|
i18nAttrArgs.push(literal(attr.name), this.i18nTranslate(message, params));
|
@@ -16433,7 +18195,7 @@ class TemplateDefinitionBuilder {
|
|
16433
18195
|
}
|
16434
18196
|
this.allocateBindingSlots(value);
|
16435
18197
|
if (inputType === 0 /* BindingType.Property */) {
|
16436
|
-
if (value instanceof Interpolation) {
|
18198
|
+
if (value instanceof Interpolation$1) {
|
16437
18199
|
// prop="{{value}}" and friends
|
16438
18200
|
this.interpolatedUpdateInstruction(getPropertyInterpolationExpression(value), elementIndex, attrName, input, value, params);
|
16439
18201
|
}
|
@@ -16447,12 +18209,12 @@ class TemplateDefinitionBuilder {
|
|
16447
18209
|
}
|
16448
18210
|
}
|
16449
18211
|
else if (inputType === 1 /* BindingType.Attribute */) {
|
16450
|
-
if (value instanceof Interpolation && getInterpolationArgsLength(value) > 1) {
|
18212
|
+
if (value instanceof Interpolation$1 && getInterpolationArgsLength(value) > 1) {
|
16451
18213
|
// attr.name="text{{value}}" and friends
|
16452
18214
|
this.interpolatedUpdateInstruction(getAttributeInterpolationExpression(value), elementIndex, attrName, input, value, params);
|
16453
18215
|
}
|
16454
18216
|
else {
|
16455
|
-
const boundValue = value instanceof Interpolation ? value.expressions[0] : value;
|
18217
|
+
const boundValue = value instanceof Interpolation$1 ? value.expressions[0] : value;
|
16456
18218
|
// [attr.name]="value" or attr.name="{{value}}"
|
16457
18219
|
// Collect the attribute bindings so that they can be chained at the end.
|
16458
18220
|
attributeBindings.push({
|
@@ -16522,7 +18284,7 @@ class TemplateDefinitionBuilder {
|
|
16522
18284
|
parameters.push(importExpr(Identifiers.templateRefExtractor));
|
16523
18285
|
}
|
16524
18286
|
// Create the template function
|
16525
|
-
const templateVisitor = new TemplateDefinitionBuilder(this.constantPool, this._bindingScope, this.level + 1, contextName, this.i18n, templateIndex, templateName, this._namespace, this.fileBasedI18nSuffix, this.i18nUseExternalIds, this._constants);
|
18287
|
+
const templateVisitor = new TemplateDefinitionBuilder(this.constantPool, this._bindingScope, this.level + 1, contextName, this.i18n, templateIndex, templateName, this._namespace, this.fileBasedI18nSuffix, this.i18nUseExternalIds, this.deferBlocks, this._constants);
|
16526
18288
|
// Nested templates must not be visited until after their parent templates have completed
|
16527
18289
|
// processing, so they are queued here until after the initial pass. Otherwise, we wouldn't
|
16528
18290
|
// be able to support bindings in nested templates to local refs that occur after the
|
@@ -16565,7 +18327,7 @@ class TemplateDefinitionBuilder {
|
|
16565
18327
|
if (this.i18n) {
|
16566
18328
|
const value = text.value.visit(this._valueConverter);
|
16567
18329
|
this.allocateBindingSlots(value);
|
16568
|
-
if (value instanceof Interpolation) {
|
18330
|
+
if (value instanceof Interpolation$1) {
|
16569
18331
|
this.i18n.appendBoundText(text.i18n);
|
16570
18332
|
this.i18nAppendBindings(value.expressions);
|
16571
18333
|
}
|
@@ -16575,7 +18337,7 @@ class TemplateDefinitionBuilder {
|
|
16575
18337
|
this.creationInstruction(text.sourceSpan, Identifiers.text, [literal(nodeIndex)]);
|
16576
18338
|
const value = text.value.visit(this._valueConverter);
|
16577
18339
|
this.allocateBindingSlots(value);
|
16578
|
-
if (value instanceof Interpolation) {
|
18340
|
+
if (value instanceof Interpolation$1) {
|
16579
18341
|
this.updateInstructionWithAdvance(nodeIndex, text.sourceSpan, getTextInterpolationExpression(value), () => this.getUpdateInstructionArguments(value));
|
16580
18342
|
}
|
16581
18343
|
else {
|
@@ -16632,6 +18394,47 @@ class TemplateDefinitionBuilder {
|
|
16632
18394
|
}
|
16633
18395
|
return null;
|
16634
18396
|
}
|
18397
|
+
visitDeferredBlock(deferred) {
|
18398
|
+
const templateIndex = this.allocateDataSlot();
|
18399
|
+
const deferredDeps = this.deferBlocks.get(deferred);
|
18400
|
+
const contextName = `${this.contextName}_Defer_${templateIndex}`;
|
18401
|
+
const depsFnName = `${contextName}_DepsFn`;
|
18402
|
+
const parameters = [
|
18403
|
+
literal(templateIndex),
|
18404
|
+
deferredDeps ? variable(depsFnName) : TYPED_NULL_EXPR,
|
18405
|
+
];
|
18406
|
+
if (deferredDeps) {
|
18407
|
+
// This defer block has deps for which we need to generate dynamic imports.
|
18408
|
+
const dependencyExp = [];
|
18409
|
+
for (const deferredDep of deferredDeps) {
|
18410
|
+
if (deferredDep.isDeferrable) {
|
18411
|
+
// Callback function, e.g. `function(m) { return m.MyCmp; }`.
|
18412
|
+
const innerFn = fn([new FnParam('m', DYNAMIC_TYPE)], [new ReturnStatement(variable('m').prop(deferredDep.symbolName))]);
|
18413
|
+
const fileName = deferredDep.importPath;
|
18414
|
+
// Dynamic import, e.g. `import('./a').then(...)`.
|
18415
|
+
const importExpr = (new DynamicImportExpr(fileName)).prop('then').callFn([innerFn]);
|
18416
|
+
dependencyExp.push(importExpr);
|
18417
|
+
}
|
18418
|
+
else {
|
18419
|
+
// Non-deferrable symbol, just use a reference to the type.
|
18420
|
+
dependencyExp.push(deferredDep.type);
|
18421
|
+
}
|
18422
|
+
}
|
18423
|
+
const depsFnBody = [];
|
18424
|
+
depsFnBody.push(new ReturnStatement(literalArr(dependencyExp)));
|
18425
|
+
const depsFnExpr = fn([] /* args */, depsFnBody, INFERRED_TYPE, null, depsFnName);
|
18426
|
+
this.constantPool.statements.push(depsFnExpr.toDeclStmt(depsFnName));
|
18427
|
+
}
|
18428
|
+
// e.g. `defer(1, MyComp_Defer_1_DepsFn, ...)`
|
18429
|
+
this.creationInstruction(deferred.sourceSpan, Identifiers.defer, () => {
|
18430
|
+
return trimTrailingNulls(parameters);
|
18431
|
+
});
|
18432
|
+
}
|
18433
|
+
// TODO: implement nested deferred block instructions.
|
18434
|
+
visitDeferredTrigger(trigger) { }
|
18435
|
+
visitDeferredBlockPlaceholder(block) { }
|
18436
|
+
visitDeferredBlockError(block) { }
|
18437
|
+
visitDeferredBlockLoading(block) { }
|
16635
18438
|
allocateDataSlot() {
|
16636
18439
|
return this._dataIndex++;
|
16637
18440
|
}
|
@@ -16663,7 +18466,7 @@ class TemplateDefinitionBuilder {
|
|
16663
18466
|
continue;
|
16664
18467
|
}
|
16665
18468
|
this.allocateBindingSlots(value);
|
16666
|
-
if (value instanceof Interpolation) {
|
18469
|
+
if (value instanceof Interpolation$1) {
|
16667
18470
|
// Params typically contain attribute namespace and value sanitizer, which is applicable
|
16668
18471
|
// for regular HTML elements, but not applicable for <ng-template> (since props act as
|
16669
18472
|
// inputs to directives), so keep params array empty.
|
@@ -16695,7 +18498,7 @@ class TemplateDefinitionBuilder {
|
|
16695
18498
|
if (instruction) {
|
16696
18499
|
for (const call of instruction.calls) {
|
16697
18500
|
allocateBindingSlots += call.allocateBindingSlots;
|
16698
|
-
this.updateInstructionWithAdvance(elementIndex, call.sourceSpan, instruction.reference, () => call.params(value => (call.supportsInterpolation && value instanceof Interpolation) ?
|
18501
|
+
this.updateInstructionWithAdvance(elementIndex, call.sourceSpan, instruction.reference, () => call.params(value => (call.supportsInterpolation && value instanceof Interpolation$1) ?
|
16699
18502
|
this.getUpdateInstructionArguments(value) :
|
16700
18503
|
this.convertPropertyBinding(value)));
|
16701
18504
|
}
|
@@ -16728,7 +18531,7 @@ class TemplateDefinitionBuilder {
|
|
16728
18531
|
return originalSlots;
|
16729
18532
|
}
|
16730
18533
|
allocateBindingSlots(value) {
|
16731
|
-
this._bindingSlots += value instanceof Interpolation ? value.expressions.length : 1;
|
18534
|
+
this._bindingSlots += value instanceof Interpolation$1 ? value.expressions.length : 1;
|
16732
18535
|
}
|
16733
18536
|
/**
|
16734
18537
|
* Gets an expression that refers to the implicit receiver. The implicit
|
@@ -17350,7 +19153,12 @@ function parseTemplate(template, templateUrl, options = {}) {
|
|
17350
19153
|
const { interpolationConfig, preserveWhitespaces, enableI18nLegacyMessageIdFormat } = options;
|
17351
19154
|
const bindingParser = makeBindingParser(interpolationConfig);
|
17352
19155
|
const htmlParser = new HtmlParser();
|
17353
|
-
const parseResult = htmlParser.parse(template, templateUrl, {
|
19156
|
+
const parseResult = htmlParser.parse(template, templateUrl, {
|
19157
|
+
leadingTriviaChars: LEADING_TRIVIA_CHARS,
|
19158
|
+
...options,
|
19159
|
+
tokenizeExpansionForms: true,
|
19160
|
+
tokenizeBlocks: options.enabledBlockTypes != null && options.enabledBlockTypes.size > 0,
|
19161
|
+
});
|
17354
19162
|
if (!options.alwaysAttemptHtmlToR3AstConversion && parseResult.errors &&
|
17355
19163
|
parseResult.errors.length > 0) {
|
17356
19164
|
const parsedTemplate = {
|
@@ -17401,7 +19209,10 @@ function parseTemplate(template, templateUrl, options = {}) {
|
|
17401
19209
|
rootNodes = visitAll(new I18nMetaVisitor(interpolationConfig, /* keepI18nAttrs */ false), rootNodes);
|
17402
19210
|
}
|
17403
19211
|
}
|
17404
|
-
const { nodes, errors, styleUrls, styles, ngContentSelectors, commentNodes } = htmlAstToRender3Ast(rootNodes, bindingParser, {
|
19212
|
+
const { nodes, errors, styleUrls, styles, ngContentSelectors, commentNodes } = htmlAstToRender3Ast(rootNodes, bindingParser, {
|
19213
|
+
collectCommentNodes: !!options.collectCommentNodes,
|
19214
|
+
enabledBlockTypes: options.enabledBlockTypes || new Set(),
|
19215
|
+
});
|
17405
19216
|
errors.push(...parseResult.errors, ...i18nMetaResult.errors);
|
17406
19217
|
const parsedTemplate = {
|
17407
19218
|
interpolationConfig,
|
@@ -17548,7 +19359,7 @@ function baseDirectiveFields(meta, constantPool, bindingParser) {
|
|
17548
19359
|
const definitionMap = new DefinitionMap();
|
17549
19360
|
const selectors = parseSelectorToR3Selector(meta.selector);
|
17550
19361
|
// e.g. `type: MyDirective`
|
17551
|
-
definitionMap.set('type', meta.
|
19362
|
+
definitionMap.set('type', meta.type.value);
|
17552
19363
|
// e.g. `selectors: [['', 'someDir', '']]`
|
17553
19364
|
if (selectors.length > 0) {
|
17554
19365
|
definitionMap.set('selectors', asLiteral(selectors));
|
@@ -17563,15 +19374,18 @@ function baseDirectiveFields(meta, constantPool, bindingParser) {
|
|
17563
19374
|
// e.g. `hostBindings: (rf, ctx) => { ... }
|
17564
19375
|
definitionMap.set('hostBindings', createHostBindingsFunction(meta.host, meta.typeSourceSpan, bindingParser, constantPool, meta.selector || '', meta.name, definitionMap));
|
17565
19376
|
// e.g 'inputs: {a: 'a'}`
|
17566
|
-
definitionMap.set('inputs',
|
19377
|
+
definitionMap.set('inputs', conditionallyCreateDirectiveBindingLiteral(meta.inputs, true));
|
17567
19378
|
// e.g 'outputs: {a: 'a'}`
|
17568
|
-
definitionMap.set('outputs',
|
19379
|
+
definitionMap.set('outputs', conditionallyCreateDirectiveBindingLiteral(meta.outputs));
|
17569
19380
|
if (meta.exportAs !== null) {
|
17570
19381
|
definitionMap.set('exportAs', literalArr(meta.exportAs.map(e => literal(e))));
|
17571
19382
|
}
|
17572
19383
|
if (meta.isStandalone) {
|
17573
19384
|
definitionMap.set('standalone', literal(true));
|
17574
19385
|
}
|
19386
|
+
if (meta.isSignal) {
|
19387
|
+
definitionMap.set('signals', literal(true));
|
19388
|
+
}
|
17575
19389
|
return definitionMap;
|
17576
19390
|
}
|
17577
19391
|
/**
|
@@ -17582,6 +19396,7 @@ function addFeatures(definitionMap, meta) {
|
|
17582
19396
|
const features = [];
|
17583
19397
|
const providers = meta.providers;
|
17584
19398
|
const viewProviders = meta.viewProviders;
|
19399
|
+
const inputKeys = Object.keys(meta.inputs);
|
17585
19400
|
if (providers || viewProviders) {
|
17586
19401
|
const args = [providers || new LiteralArrayExpr([])];
|
17587
19402
|
if (viewProviders) {
|
@@ -17589,6 +19404,12 @@ function addFeatures(definitionMap, meta) {
|
|
17589
19404
|
}
|
17590
19405
|
features.push(importExpr(Identifiers.ProvidersFeature).callFn(args));
|
17591
19406
|
}
|
19407
|
+
for (const key of inputKeys) {
|
19408
|
+
if (meta.inputs[key].transformFunction !== null) {
|
19409
|
+
features.push(importExpr(Identifiers.InputTransformsFeatureFeature));
|
19410
|
+
break;
|
19411
|
+
}
|
19412
|
+
}
|
17592
19413
|
if (meta.usesInheritance) {
|
17593
19414
|
features.push(importExpr(Identifiers.InheritDefinitionFeature));
|
17594
19415
|
}
|
@@ -17640,34 +19461,43 @@ function compileComponentFromMetadata(meta, constantPool, bindingParser) {
|
|
17640
19461
|
const templateTypeName = meta.name;
|
17641
19462
|
const templateName = templateTypeName ? `${templateTypeName}_Template` : null;
|
17642
19463
|
const changeDetection = meta.changeDetection;
|
17643
|
-
|
17644
|
-
|
17645
|
-
|
17646
|
-
|
17647
|
-
|
17648
|
-
|
17649
|
-
|
17650
|
-
|
17651
|
-
|
17652
|
-
|
17653
|
-
|
17654
|
-
|
17655
|
-
|
17656
|
-
|
17657
|
-
|
17658
|
-
|
17659
|
-
|
17660
|
-
|
17661
|
-
|
17662
|
-
|
17663
|
-
|
17664
|
-
//
|
17665
|
-
|
17666
|
-
|
17667
|
-
}
|
17668
|
-
|
17669
|
-
|
17670
|
-
|
19464
|
+
// Template compilation is currently conditional as we're in the process of rewriting it.
|
19465
|
+
{
|
19466
|
+
// This is the main path currently used in compilation, which compiles the template with the
|
19467
|
+
// legacy `TemplateDefinitionBuilder`.
|
19468
|
+
const template = meta.template;
|
19469
|
+
const templateBuilder = new TemplateDefinitionBuilder(constantPool, BindingScope.createRootScope(), 0, templateTypeName, null, null, templateName, Identifiers.namespaceHTML, meta.relativeContextFilePath, meta.i18nUseExternalIds, meta.deferBlocks);
|
19470
|
+
const templateFunctionExpression = templateBuilder.buildTemplateFunction(template.nodes, []);
|
19471
|
+
// We need to provide this so that dynamically generated components know what
|
19472
|
+
// projected content blocks to pass through to the component when it is
|
19473
|
+
// instantiated.
|
19474
|
+
const ngContentSelectors = templateBuilder.getNgContentSelectors();
|
19475
|
+
if (ngContentSelectors) {
|
19476
|
+
definitionMap.set('ngContentSelectors', ngContentSelectors);
|
19477
|
+
}
|
19478
|
+
// e.g. `decls: 2`
|
19479
|
+
// definitionMap.set('decls', o.literal(tpl.root.decls!));
|
19480
|
+
definitionMap.set('decls', literal(templateBuilder.getConstCount()));
|
19481
|
+
// e.g. `vars: 2`
|
19482
|
+
// definitionMap.set('vars', o.literal(tpl.root.vars!));
|
19483
|
+
definitionMap.set('vars', literal(templateBuilder.getVarCount()));
|
19484
|
+
// Generate `consts` section of ComponentDef:
|
19485
|
+
// - either as an array:
|
19486
|
+
// `consts: [['one', 'two'], ['three', 'four']]`
|
19487
|
+
// - or as a factory function in case additional statements are present (to support i18n):
|
19488
|
+
// `consts: function() { var i18n_0; if (ngI18nClosureMode) {...} else {...} return [i18n_0];
|
19489
|
+
// }`
|
19490
|
+
const { constExpressions, prepareStatements } = templateBuilder.getConsts();
|
19491
|
+
if (constExpressions.length > 0) {
|
19492
|
+
let constsExpr = literalArr(constExpressions);
|
19493
|
+
// Prepare statements are present - turn `consts` into a function.
|
19494
|
+
if (prepareStatements.length > 0) {
|
19495
|
+
constsExpr = fn([], [...prepareStatements, new ReturnStatement(constsExpr)]);
|
19496
|
+
}
|
19497
|
+
definitionMap.set('consts', constsExpr);
|
19498
|
+
}
|
19499
|
+
definitionMap.set('template', templateFunctionExpression);
|
19500
|
+
}
|
17671
19501
|
if (meta.declarations.length > 0) {
|
17672
19502
|
definitionMap.set('dependencies', compileDeclarationList(literalArr(meta.declarations.map(decl => decl.type)), meta.declarationListEmitMode));
|
17673
19503
|
}
|
@@ -17718,6 +19548,12 @@ function createComponentType(meta) {
|
|
17718
19548
|
typeParams.push(stringArrayAsType(meta.template.ngContentSelectors));
|
17719
19549
|
typeParams.push(expressionType(literal(meta.isStandalone)));
|
17720
19550
|
typeParams.push(createHostDirectivesType(meta));
|
19551
|
+
// TODO(signals): Always include this metadata starting with v17. Right
|
19552
|
+
// now Angular v16.0.x does not support this field and library distributions
|
19553
|
+
// would then be incompatible with v16.0.x framework users.
|
19554
|
+
if (meta.isSignal) {
|
19555
|
+
typeParams.push(expressionType(literal(meta.isSignal)));
|
19556
|
+
}
|
17721
19557
|
return expressionType(importExpr(Identifiers.ComponentDeclaration, typeParams));
|
17722
19558
|
}
|
17723
19559
|
/**
|
@@ -17816,11 +19652,24 @@ function createBaseDirectiveTypeParams(meta) {
|
|
17816
19652
|
typeWithParameters(meta.type.type, meta.typeArgumentCount),
|
17817
19653
|
selectorForType !== null ? stringAsType(selectorForType) : NONE_TYPE,
|
17818
19654
|
meta.exportAs !== null ? stringArrayAsType(meta.exportAs) : NONE_TYPE,
|
17819
|
-
expressionType(
|
19655
|
+
expressionType(getInputsTypeExpression(meta)),
|
17820
19656
|
expressionType(stringMapAsLiteralExpression(meta.outputs)),
|
17821
19657
|
stringArrayAsType(meta.queries.map(q => q.propertyName)),
|
17822
19658
|
];
|
17823
19659
|
}
|
19660
|
+
function getInputsTypeExpression(meta) {
|
19661
|
+
return literalMap(Object.keys(meta.inputs).map(key => {
|
19662
|
+
const value = meta.inputs[key];
|
19663
|
+
return {
|
19664
|
+
key,
|
19665
|
+
value: literalMap([
|
19666
|
+
{ key: 'alias', value: literal(value.bindingPropertyName), quoted: true },
|
19667
|
+
{ key: 'required', value: literal(value.required), quoted: true }
|
19668
|
+
]),
|
19669
|
+
quoted: true
|
19670
|
+
};
|
19671
|
+
}));
|
19672
|
+
}
|
17824
19673
|
/**
|
17825
19674
|
* Creates the type specification from the directive meta. This type is inserted into .d.ts files
|
17826
19675
|
* to be consumed by upstream compilations.
|
@@ -17832,6 +19681,12 @@ function createDirectiveType(meta) {
|
|
17832
19681
|
typeParams.push(NONE_TYPE);
|
17833
19682
|
typeParams.push(expressionType(literal(meta.isStandalone)));
|
17834
19683
|
typeParams.push(createHostDirectivesType(meta));
|
19684
|
+
// TODO(signals): Always include this metadata starting with v17. Right
|
19685
|
+
// now Angular v16.0.x does not support this field and library distributions
|
19686
|
+
// would then be incompatible with v16.0.x framework users.
|
19687
|
+
if (meta.isSignal) {
|
19688
|
+
typeParams.push(expressionType(literal(meta.isSignal)));
|
19689
|
+
}
|
17835
19690
|
return expressionType(importExpr(Identifiers.DirectiveDeclaration, typeParams));
|
17836
19691
|
}
|
17837
19692
|
// Define and update any view queries
|
@@ -17860,6 +19715,9 @@ function createViewQueriesFunction(viewQueries, constantPool, name) {
|
|
17860
19715
|
}
|
17861
19716
|
// Return a host binding function or null if one is not necessary.
|
17862
19717
|
function createHostBindingsFunction(hostBindingsMetadata, typeSourceSpan, bindingParser, constantPool, selector, name, definitionMap) {
|
19718
|
+
const bindings = bindingParser.createBoundHostProperties(hostBindingsMetadata.properties, typeSourceSpan);
|
19719
|
+
// Calculate host event bindings
|
19720
|
+
const eventBindings = bindingParser.createDirectiveHostEventAsts(hostBindingsMetadata.listeners, typeSourceSpan);
|
17863
19721
|
const bindingContext = variable(CONTEXT_NAME);
|
17864
19722
|
const styleBuilder = new StylingBuilder(bindingContext);
|
17865
19723
|
const { styleAttr, classAttr } = hostBindingsMetadata.specialAttributes;
|
@@ -17873,13 +19731,10 @@ function createHostBindingsFunction(hostBindingsMetadata, typeSourceSpan, bindin
|
|
17873
19731
|
const updateInstructions = [];
|
17874
19732
|
const updateVariables = [];
|
17875
19733
|
const hostBindingSourceSpan = typeSourceSpan;
|
17876
|
-
// Calculate host event bindings
|
17877
|
-
const eventBindings = bindingParser.createDirectiveHostEventAsts(hostBindingsMetadata.listeners, hostBindingSourceSpan);
|
17878
19734
|
if (eventBindings && eventBindings.length) {
|
17879
19735
|
createInstructions.push(...createHostListeners(eventBindings, name));
|
17880
19736
|
}
|
17881
19737
|
// Calculate the host property bindings
|
17882
|
-
const bindings = bindingParser.createBoundHostProperties(hostBindingsMetadata.properties, hostBindingSourceSpan);
|
17883
19738
|
const allOtherBindings = [];
|
17884
19739
|
// We need to calculate the total amount of binding slots required by
|
17885
19740
|
// all the instructions together before any value conversions happen.
|
@@ -18222,6 +20077,7 @@ function createHostDirectivesMappingArray(mapping) {
|
|
18222
20077
|
class ResourceLoader {
|
18223
20078
|
}
|
18224
20079
|
|
20080
|
+
let enabledBlockTypes;
|
18225
20081
|
class CompilerFacadeImpl {
|
18226
20082
|
constructor(jitEvaluator = new JitEvaluator()) {
|
18227
20083
|
this.jitEvaluator = jitEvaluator;
|
@@ -18233,7 +20089,6 @@ class CompilerFacadeImpl {
|
|
18233
20089
|
const metadata = {
|
18234
20090
|
name: facade.name,
|
18235
20091
|
type: wrapReference(facade.type),
|
18236
|
-
internalType: new WrappedNodeExpr(facade.type),
|
18237
20092
|
typeArgumentCount: 0,
|
18238
20093
|
deps: null,
|
18239
20094
|
pipeName: facade.pipeName,
|
@@ -18252,7 +20107,6 @@ class CompilerFacadeImpl {
|
|
18252
20107
|
const { expression, statements } = compileInjectable({
|
18253
20108
|
name: facade.name,
|
18254
20109
|
type: wrapReference(facade.type),
|
18255
|
-
internalType: new WrappedNodeExpr(facade.type),
|
18256
20110
|
typeArgumentCount: facade.typeArgumentCount,
|
18257
20111
|
providedIn: computeProvidedIn(facade.providedIn),
|
18258
20112
|
useClass: convertToProviderExpression(facade, 'useClass'),
|
@@ -18268,7 +20122,6 @@ class CompilerFacadeImpl {
|
|
18268
20122
|
const { expression, statements } = compileInjectable({
|
18269
20123
|
name: facade.type.name,
|
18270
20124
|
type: wrapReference(facade.type),
|
18271
|
-
internalType: new WrappedNodeExpr(facade.type),
|
18272
20125
|
typeArgumentCount: 0,
|
18273
20126
|
providedIn: computeProvidedIn(facade.providedIn),
|
18274
20127
|
useClass: convertToProviderExpression(facade, 'useClass'),
|
@@ -18284,7 +20137,6 @@ class CompilerFacadeImpl {
|
|
18284
20137
|
const meta = {
|
18285
20138
|
name: facade.name,
|
18286
20139
|
type: wrapReference(facade.type),
|
18287
|
-
internalType: new WrappedNodeExpr(facade.type),
|
18288
20140
|
providers: facade.providers && facade.providers.length > 0 ?
|
18289
20141
|
new WrappedNodeExpr(facade.providers) :
|
18290
20142
|
null,
|
@@ -18300,9 +20152,8 @@ class CompilerFacadeImpl {
|
|
18300
20152
|
}
|
18301
20153
|
compileNgModule(angularCoreEnv, sourceMapUrl, facade) {
|
18302
20154
|
const meta = {
|
20155
|
+
kind: R3NgModuleMetadataKind.Global,
|
18303
20156
|
type: wrapReference(facade.type),
|
18304
|
-
internalType: new WrappedNodeExpr(facade.type),
|
18305
|
-
adjacentType: new WrappedNodeExpr(facade.type),
|
18306
20157
|
bootstrap: facade.bootstrap.map(wrapReference),
|
18307
20158
|
declarations: facade.declarations.map(wrapReference),
|
18308
20159
|
publicDeclarationTypes: null,
|
@@ -18347,6 +20198,10 @@ class CompilerFacadeImpl {
|
|
18347
20198
|
template,
|
18348
20199
|
declarations: facade.declarations.map(convertDeclarationFacadeToMetadata),
|
18349
20200
|
declarationListEmitMode: 0 /* DeclarationListEmitMode.Direct */,
|
20201
|
+
// TODO: leaving empty in JIT mode for now,
|
20202
|
+
// to be implemented as one of the next steps.
|
20203
|
+
deferBlocks: new Map(),
|
20204
|
+
deferrableDeclToImportDecl: new Map(),
|
18350
20205
|
styles: [...facade.styles, ...template.styles],
|
18351
20206
|
encapsulation: facade.encapsulation,
|
18352
20207
|
interpolation,
|
@@ -18375,7 +20230,6 @@ class CompilerFacadeImpl {
|
|
18375
20230
|
const factoryRes = compileFactoryFunction({
|
18376
20231
|
name: meta.name,
|
18377
20232
|
type: wrapReference(meta.type),
|
18378
|
-
internalType: new WrappedNodeExpr(meta.type),
|
18379
20233
|
typeArgumentCount: meta.typeArgumentCount,
|
18380
20234
|
deps: convertR3DependencyMetadataArray(meta.deps),
|
18381
20235
|
target: meta.target,
|
@@ -18386,7 +20240,6 @@ class CompilerFacadeImpl {
|
|
18386
20240
|
const factoryRes = compileFactoryFunction({
|
18387
20241
|
name: meta.type.name,
|
18388
20242
|
type: wrapReference(meta.type),
|
18389
|
-
internalType: new WrappedNodeExpr(meta.type),
|
18390
20243
|
typeArgumentCount: 0,
|
18391
20244
|
deps: Array.isArray(meta.deps) ? meta.deps.map(convertR3DeclareDependencyMetadata) :
|
18392
20245
|
meta.deps,
|
@@ -18446,8 +20299,8 @@ function convertQueryPredicate(predicate) {
|
|
18446
20299
|
createMayBeForwardRefExpression(new WrappedNodeExpr(predicate), 1 /* ForwardRefHandling.Wrapped */);
|
18447
20300
|
}
|
18448
20301
|
function convertDirectiveFacadeToMetadata(facade) {
|
18449
|
-
const inputsFromMetadata =
|
18450
|
-
const outputsFromMetadata =
|
20302
|
+
const inputsFromMetadata = parseInputsArray(facade.inputs || []);
|
20303
|
+
const outputsFromMetadata = parseMappingStringArray(facade.outputs || []);
|
18451
20304
|
const propMetadata = facade.propMetadata;
|
18452
20305
|
const inputsFromType = {};
|
18453
20306
|
const outputsFromType = {};
|
@@ -18455,11 +20308,15 @@ function convertDirectiveFacadeToMetadata(facade) {
|
|
18455
20308
|
if (propMetadata.hasOwnProperty(field)) {
|
18456
20309
|
propMetadata[field].forEach(ann => {
|
18457
20310
|
if (isInput(ann)) {
|
18458
|
-
inputsFromType[field] =
|
18459
|
-
|
20311
|
+
inputsFromType[field] = {
|
20312
|
+
bindingPropertyName: ann.alias || field,
|
20313
|
+
classPropertyName: field,
|
20314
|
+
required: ann.required || false,
|
20315
|
+
transformFunction: ann.transform != null ? new WrappedNodeExpr(ann.transform) : null,
|
20316
|
+
};
|
18460
20317
|
}
|
18461
20318
|
else if (isOutput(ann)) {
|
18462
|
-
outputsFromType[field] = ann.
|
20319
|
+
outputsFromType[field] = ann.alias || field;
|
18463
20320
|
}
|
18464
20321
|
});
|
18465
20322
|
}
|
@@ -18469,7 +20326,6 @@ function convertDirectiveFacadeToMetadata(facade) {
|
|
18469
20326
|
typeArgumentCount: 0,
|
18470
20327
|
typeSourceSpan: facade.typeSourceSpan,
|
18471
20328
|
type: wrapReference(facade.type),
|
18472
|
-
internalType: new WrappedNodeExpr(facade.type),
|
18473
20329
|
deps: null,
|
18474
20330
|
host: extractHostBindings(facade.propMetadata, facade.typeSourceSpan, facade.host),
|
18475
20331
|
inputs: { ...inputsFromMetadata, ...inputsFromType },
|
@@ -18486,9 +20342,8 @@ function convertDeclareDirectiveFacadeToMetadata(declaration, typeSourceSpan) {
|
|
18486
20342
|
name: declaration.type.name,
|
18487
20343
|
type: wrapReference(declaration.type),
|
18488
20344
|
typeSourceSpan,
|
18489
|
-
internalType: new WrappedNodeExpr(declaration.type),
|
18490
20345
|
selector: declaration.selector ?? null,
|
18491
|
-
inputs: declaration.inputs
|
20346
|
+
inputs: declaration.inputs ? inputsMappingToInputMetadata(declaration.inputs) : {},
|
18492
20347
|
outputs: declaration.outputs ?? {},
|
18493
20348
|
host: convertHostDeclarationToMetadata(declaration.host),
|
18494
20349
|
queries: (declaration.queries ?? []).map(convertQueryDeclarationToMetadata),
|
@@ -18502,6 +20357,7 @@ function convertDeclareDirectiveFacadeToMetadata(declaration, typeSourceSpan) {
|
|
18502
20357
|
typeArgumentCount: 0,
|
18503
20358
|
fullInheritance: false,
|
18504
20359
|
isStandalone: declaration.isStandalone ?? false,
|
20360
|
+
isSignal: declaration.isSignal ?? false,
|
18505
20361
|
hostDirectives: convertHostDirectivesToMetadata(declaration),
|
18506
20362
|
};
|
18507
20363
|
}
|
@@ -18529,8 +20385,8 @@ function convertHostDirectivesToMetadata(metadata) {
|
|
18529
20385
|
{
|
18530
20386
|
directive: wrapReference(hostDirective.directive),
|
18531
20387
|
isForwardReference: false,
|
18532
|
-
inputs: hostDirective.inputs ?
|
18533
|
-
outputs: hostDirective.outputs ?
|
20388
|
+
inputs: hostDirective.inputs ? parseMappingStringArray(hostDirective.inputs) : null,
|
20389
|
+
outputs: hostDirective.outputs ? parseMappingStringArray(hostDirective.outputs) : null,
|
18534
20390
|
};
|
18535
20391
|
});
|
18536
20392
|
}
|
@@ -18576,6 +20432,10 @@ function convertDeclareComponentFacadeToMetadata(decl, typeSourceSpan, sourceMap
|
|
18576
20432
|
viewProviders: decl.viewProviders !== undefined ? new WrappedNodeExpr(decl.viewProviders) :
|
18577
20433
|
null,
|
18578
20434
|
animations: decl.animations !== undefined ? new WrappedNodeExpr(decl.animations) : null,
|
20435
|
+
// TODO: leaving empty in JIT mode for now,
|
20436
|
+
// to be implemented as one of the next steps.
|
20437
|
+
deferBlocks: new Map(),
|
20438
|
+
deferrableDeclToImportDecl: new Map(),
|
18579
20439
|
changeDetection: decl.changeDetection ?? ChangeDetectionStrategy.Default,
|
18580
20440
|
encapsulation: decl.encapsulation ?? ViewEncapsulation.Emulated,
|
18581
20441
|
interpolation,
|
@@ -18623,7 +20483,7 @@ function convertPipeDeclarationToMetadata(pipe) {
|
|
18623
20483
|
function parseJitTemplate(template, typeName, sourceMapUrl, preserveWhitespaces, interpolation) {
|
18624
20484
|
const interpolationConfig = interpolation ? InterpolationConfig.fromArray(interpolation) : DEFAULT_INTERPOLATION_CONFIG;
|
18625
20485
|
// Parse the template and check for errors.
|
18626
|
-
const parsed = parseTemplate(template, sourceMapUrl, { preserveWhitespaces, interpolationConfig });
|
20486
|
+
const parsed = parseTemplate(template, sourceMapUrl, { preserveWhitespaces, interpolationConfig, enabledBlockTypes });
|
18627
20487
|
if (parsed.errors !== null) {
|
18628
20488
|
const errors = parsed.errors.map(err => err.toString()).join(', ');
|
18629
20489
|
throw new Error(`Errors during JIT compilation of template for ${typeName}: ${errors}`);
|
@@ -18722,18 +20582,67 @@ function isInput(value) {
|
|
18722
20582
|
function isOutput(value) {
|
18723
20583
|
return value.ngMetadataName === 'Output';
|
18724
20584
|
}
|
18725
|
-
function
|
20585
|
+
function inputsMappingToInputMetadata(inputs) {
|
20586
|
+
return Object.keys(inputs).reduce((result, key) => {
|
20587
|
+
const value = inputs[key];
|
20588
|
+
if (typeof value === 'string') {
|
20589
|
+
result[key] = {
|
20590
|
+
bindingPropertyName: value,
|
20591
|
+
classPropertyName: value,
|
20592
|
+
transformFunction: null,
|
20593
|
+
required: false,
|
20594
|
+
};
|
20595
|
+
}
|
20596
|
+
else {
|
20597
|
+
result[key] = {
|
20598
|
+
bindingPropertyName: value[0],
|
20599
|
+
classPropertyName: value[1],
|
20600
|
+
transformFunction: value[2] ? new WrappedNodeExpr(value[2]) : null,
|
20601
|
+
required: false,
|
20602
|
+
};
|
20603
|
+
}
|
20604
|
+
return result;
|
20605
|
+
}, {});
|
20606
|
+
}
|
20607
|
+
function parseInputsArray(values) {
|
20608
|
+
return values.reduce((results, value) => {
|
20609
|
+
if (typeof value === 'string') {
|
20610
|
+
const [bindingPropertyName, classPropertyName] = parseMappingString(value);
|
20611
|
+
results[classPropertyName] = {
|
20612
|
+
bindingPropertyName,
|
20613
|
+
classPropertyName,
|
20614
|
+
required: false,
|
20615
|
+
transformFunction: null,
|
20616
|
+
};
|
20617
|
+
}
|
20618
|
+
else {
|
20619
|
+
results[value.name] = {
|
20620
|
+
bindingPropertyName: value.alias || value.name,
|
20621
|
+
classPropertyName: value.name,
|
20622
|
+
required: value.required || false,
|
20623
|
+
transformFunction: value.transform != null ? new WrappedNodeExpr(value.transform) : null,
|
20624
|
+
};
|
20625
|
+
}
|
20626
|
+
return results;
|
20627
|
+
}, {});
|
20628
|
+
}
|
20629
|
+
function parseMappingStringArray(values) {
|
18726
20630
|
return values.reduce((results, value) => {
|
18727
|
-
const [
|
18728
|
-
results[
|
20631
|
+
const [alias, fieldName] = parseMappingString(value);
|
20632
|
+
results[fieldName] = alias;
|
18729
20633
|
return results;
|
18730
20634
|
}, {});
|
18731
20635
|
}
|
20636
|
+
function parseMappingString(value) {
|
20637
|
+
// Either the value is 'field' or 'field: property'. In the first case, `property` will
|
20638
|
+
// be undefined, in which case the field name should also be used as the property name.
|
20639
|
+
const [fieldName, bindingPropertyName] = value.split(':', 2).map(str => str.trim());
|
20640
|
+
return [bindingPropertyName ?? fieldName, fieldName];
|
20641
|
+
}
|
18732
20642
|
function convertDeclarePipeFacadeToMetadata(declaration) {
|
18733
20643
|
return {
|
18734
20644
|
name: declaration.type.name,
|
18735
20645
|
type: wrapReference(declaration.type),
|
18736
|
-
internalType: new WrappedNodeExpr(declaration.type),
|
18737
20646
|
typeArgumentCount: 0,
|
18738
20647
|
pipeName: declaration.name,
|
18739
20648
|
deps: null,
|
@@ -18745,7 +20654,6 @@ function convertDeclareInjectorFacadeToMetadata(declaration) {
|
|
18745
20654
|
return {
|
18746
20655
|
name: declaration.type.name,
|
18747
20656
|
type: wrapReference(declaration.type),
|
18748
|
-
internalType: new WrappedNodeExpr(declaration.type),
|
18749
20657
|
providers: declaration.providers !== undefined && declaration.providers.length > 0 ?
|
18750
20658
|
new WrappedNodeExpr(declaration.providers) :
|
18751
20659
|
null,
|
@@ -18764,7 +20672,7 @@ function publishFacade(global) {
|
|
18764
20672
|
* @description
|
18765
20673
|
* Entry point for all public APIs of the compiler package.
|
18766
20674
|
*/
|
18767
|
-
new Version('
|
20675
|
+
new Version('16.2.12');
|
18768
20676
|
var _VisitorMode;
|
18769
20677
|
(function (_VisitorMode) {
|
18770
20678
|
_VisitorMode[_VisitorMode["Extract"] = 0] = "Extract";
|
@@ -18994,6 +20902,14 @@ class ASTCompiler {
|
|
18994
20902
|
}
|
18995
20903
|
return this.handleBinaryDefault();
|
18996
20904
|
}
|
20905
|
+
processUnary() {
|
20906
|
+
const ast = this.cAst;
|
20907
|
+
const stmts = this.cStmts;
|
20908
|
+
const e = this.build(ast.expr, stmts);
|
20909
|
+
const v = this.createVar();
|
20910
|
+
stmts.push(`${v}=${ast.operator}${e}`);
|
20911
|
+
return v;
|
20912
|
+
}
|
18997
20913
|
processConditional() {
|
18998
20914
|
const ast = this.cAst;
|
18999
20915
|
const stmts = this.cStmts;
|
@@ -19085,6 +21001,9 @@ class ASTCompiler {
|
|
19085
21001
|
else if (ast instanceof PrefixNot) {
|
19086
21002
|
return this.processPrefixNot();
|
19087
21003
|
}
|
21004
|
+
else if (ast instanceof Unary) {
|
21005
|
+
return this.processUnary();
|
21006
|
+
}
|
19088
21007
|
else if (ast instanceof Binary) {
|
19089
21008
|
return this.processBinary();
|
19090
21009
|
}
|