@wavemaker/angular-codegen 11.6.0-next.140456 → 11.6.0-next.141106
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- angular-codegen/angular-app/package-lock.json +2303 -3942
- angular-codegen/angular-app/package.json +27 -27
- angular-codegen/angular-app/src/app/lazy-load-scripts.resolve.ts +4 -2
- angular-codegen/dependencies/expression-parser.cjs.js +590 -2498
- angular-codegen/dependencies/pipe-provider.cjs.js +15335 -28449
- angular-codegen/dependencies/transpilation-mobile.cjs.js +8031 -14730
- angular-codegen/dependencies/transpilation-web.cjs.js +8031 -14730
- angular-codegen/package-lock.json +4367 -3
- angular-codegen/package.json +1 -1
- angular-codegen/src/handlebar-helpers.js +1 -1
- angular-codegen/templates/app-prefabs.module.ts.hbs +1 -0
- angular-codegen/templates/app-routes.ts.hbs +5 -6
- angular-codegen/templates/page/page.module.ts.hbs +2 -2
- angular-codegen/templates/partial/partial.module.ts.hbs +1 -0
- angular-codegen/templates/prefab/prefab.module.ts.hbs +1 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* @license Angular
|
|
4
|
+
* @license Angular v15.2.9
|
|
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 ?? (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 ?? (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,9 +955,6 @@ 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
|
-
}
|
|
961
958
|
set(value) {
|
|
962
959
|
return new WriteVarExpr(this.name, value, null, this.sourceSpan);
|
|
963
960
|
}
|
|
@@ -976,9 +973,6 @@ class TypeofExpr extends Expression {
|
|
|
976
973
|
isConstant() {
|
|
977
974
|
return this.expr.isConstant();
|
|
978
975
|
}
|
|
979
|
-
clone() {
|
|
980
|
-
return new TypeofExpr(this.expr.clone());
|
|
981
|
-
}
|
|
982
976
|
}
|
|
983
977
|
class WrappedNodeExpr extends Expression {
|
|
984
978
|
constructor(node, type, sourceSpan) {
|
|
@@ -994,9 +988,6 @@ class WrappedNodeExpr extends Expression {
|
|
|
994
988
|
visitExpression(visitor, context) {
|
|
995
989
|
return visitor.visitWrappedNodeExpr(this, context);
|
|
996
990
|
}
|
|
997
|
-
clone() {
|
|
998
|
-
return new WrappedNodeExpr(this.node, this.type, this.sourceSpan);
|
|
999
|
-
}
|
|
1000
991
|
}
|
|
1001
992
|
class WriteVarExpr extends Expression {
|
|
1002
993
|
constructor(name, value, type, sourceSpan) {
|
|
@@ -1013,9 +1004,6 @@ class WriteVarExpr extends Expression {
|
|
|
1013
1004
|
visitExpression(visitor, context) {
|
|
1014
1005
|
return visitor.visitWriteVarExpr(this, context);
|
|
1015
1006
|
}
|
|
1016
|
-
clone() {
|
|
1017
|
-
return new WriteVarExpr(this.name, this.value.clone(), this.type, this.sourceSpan);
|
|
1018
|
-
}
|
|
1019
1007
|
toDeclStmt(type, modifiers) {
|
|
1020
1008
|
return new DeclareVarStmt(this.name, this.value, type, modifiers, this.sourceSpan);
|
|
1021
1009
|
}
|
|
@@ -1040,9 +1028,6 @@ class WriteKeyExpr extends Expression {
|
|
|
1040
1028
|
visitExpression(visitor, context) {
|
|
1041
1029
|
return visitor.visitWriteKeyExpr(this, context);
|
|
1042
1030
|
}
|
|
1043
|
-
clone() {
|
|
1044
|
-
return new WriteKeyExpr(this.receiver.clone(), this.index.clone(), this.value.clone(), this.type, this.sourceSpan);
|
|
1045
|
-
}
|
|
1046
1031
|
}
|
|
1047
1032
|
class WritePropExpr extends Expression {
|
|
1048
1033
|
constructor(receiver, name, value, type, sourceSpan) {
|
|
@@ -1061,9 +1046,6 @@ class WritePropExpr extends Expression {
|
|
|
1061
1046
|
visitExpression(visitor, context) {
|
|
1062
1047
|
return visitor.visitWritePropExpr(this, context);
|
|
1063
1048
|
}
|
|
1064
|
-
clone() {
|
|
1065
|
-
return new WritePropExpr(this.receiver.clone(), this.name, this.value.clone(), this.type, this.sourceSpan);
|
|
1066
|
-
}
|
|
1067
1049
|
}
|
|
1068
1050
|
class InvokeFunctionExpr extends Expression {
|
|
1069
1051
|
constructor(fn, args, type, sourceSpan, pure = false) {
|
|
@@ -1072,10 +1054,6 @@ class InvokeFunctionExpr extends Expression {
|
|
|
1072
1054
|
this.args = args;
|
|
1073
1055
|
this.pure = pure;
|
|
1074
1056
|
}
|
|
1075
|
-
// An alias for fn, which allows other logic to handle calls and property reads together.
|
|
1076
|
-
get receiver() {
|
|
1077
|
-
return this.fn;
|
|
1078
|
-
}
|
|
1079
1057
|
isEquivalent(e) {
|
|
1080
1058
|
return e instanceof InvokeFunctionExpr && this.fn.isEquivalent(e.fn) &&
|
|
1081
1059
|
areAllEquivalent(this.args, e.args) && this.pure === e.pure;
|
|
@@ -1086,9 +1064,6 @@ class InvokeFunctionExpr extends Expression {
|
|
|
1086
1064
|
visitExpression(visitor, context) {
|
|
1087
1065
|
return visitor.visitInvokeFunctionExpr(this, context);
|
|
1088
1066
|
}
|
|
1089
|
-
clone() {
|
|
1090
|
-
return new InvokeFunctionExpr(this.fn.clone(), this.args.map(arg => arg.clone()), this.type, this.sourceSpan, this.pure);
|
|
1091
|
-
}
|
|
1092
1067
|
}
|
|
1093
1068
|
class TaggedTemplateExpr extends Expression {
|
|
1094
1069
|
constructor(tag, template, type, sourceSpan) {
|
|
@@ -1107,9 +1082,6 @@ class TaggedTemplateExpr extends Expression {
|
|
|
1107
1082
|
visitExpression(visitor, context) {
|
|
1108
1083
|
return visitor.visitTaggedTemplateExpr(this, context);
|
|
1109
1084
|
}
|
|
1110
|
-
clone() {
|
|
1111
|
-
return new TaggedTemplateExpr(this.tag.clone(), this.template.clone(), this.type, this.sourceSpan);
|
|
1112
|
-
}
|
|
1113
1085
|
}
|
|
1114
1086
|
class InstantiateExpr extends Expression {
|
|
1115
1087
|
constructor(classExpr, args, type, sourceSpan) {
|
|
@@ -1127,9 +1099,6 @@ class InstantiateExpr extends Expression {
|
|
|
1127
1099
|
visitExpression(visitor, context) {
|
|
1128
1100
|
return visitor.visitInstantiateExpr(this, context);
|
|
1129
1101
|
}
|
|
1130
|
-
clone() {
|
|
1131
|
-
return new InstantiateExpr(this.classExpr.clone(), this.args.map(arg => arg.clone()), this.type, this.sourceSpan);
|
|
1132
|
-
}
|
|
1133
1102
|
}
|
|
1134
1103
|
class LiteralExpr extends Expression {
|
|
1135
1104
|
constructor(value, type, sourceSpan) {
|
|
@@ -1145,18 +1114,12 @@ class LiteralExpr extends Expression {
|
|
|
1145
1114
|
visitExpression(visitor, context) {
|
|
1146
1115
|
return visitor.visitLiteralExpr(this, context);
|
|
1147
1116
|
}
|
|
1148
|
-
clone() {
|
|
1149
|
-
return new LiteralExpr(this.value, this.type, this.sourceSpan);
|
|
1150
|
-
}
|
|
1151
1117
|
}
|
|
1152
1118
|
class TemplateLiteral {
|
|
1153
1119
|
constructor(elements, expressions) {
|
|
1154
1120
|
this.elements = elements;
|
|
1155
1121
|
this.expressions = expressions;
|
|
1156
1122
|
}
|
|
1157
|
-
clone() {
|
|
1158
|
-
return new TemplateLiteral(this.elements.map(el => el.clone()), this.expressions.map(expr => expr.clone()));
|
|
1159
|
-
}
|
|
1160
1123
|
}
|
|
1161
1124
|
class TemplateLiteralElement {
|
|
1162
1125
|
constructor(text, sourceSpan, rawText) {
|
|
@@ -1171,9 +1134,6 @@ class TemplateLiteralElement {
|
|
|
1171
1134
|
this.rawText =
|
|
1172
1135
|
rawText ?? sourceSpan?.toString() ?? escapeForTemplateLiteral(escapeSlashes(text));
|
|
1173
1136
|
}
|
|
1174
|
-
clone() {
|
|
1175
|
-
return new TemplateLiteralElement(this.text, this.sourceSpan, this.rawText);
|
|
1176
|
-
}
|
|
1177
1137
|
}
|
|
1178
1138
|
class LiteralPiece {
|
|
1179
1139
|
constructor(text, sourceSpan) {
|
|
@@ -1218,9 +1178,6 @@ class LocalizedString extends Expression {
|
|
|
1218
1178
|
visitExpression(visitor, context) {
|
|
1219
1179
|
return visitor.visitLocalizedString(this, context);
|
|
1220
1180
|
}
|
|
1221
|
-
clone() {
|
|
1222
|
-
return new LocalizedString(this.metaBlock, this.messageParts, this.placeHolderNames, this.expressions.map(expr => expr.clone()), this.sourceSpan);
|
|
1223
|
-
}
|
|
1224
1181
|
/**
|
|
1225
1182
|
* Serialize the given `meta` and `messagePart` into "cooked" and "raw" strings that can be used
|
|
1226
1183
|
* in a `$localize` tagged string. The format of the metadata is the same as that parsed by
|
|
@@ -1322,9 +1279,6 @@ class ExternalExpr extends Expression {
|
|
|
1322
1279
|
visitExpression(visitor, context) {
|
|
1323
1280
|
return visitor.visitExternalExpr(this, context);
|
|
1324
1281
|
}
|
|
1325
|
-
clone() {
|
|
1326
|
-
return new ExternalExpr(this.value, this.type, this.typeParams, this.sourceSpan);
|
|
1327
|
-
}
|
|
1328
1282
|
}
|
|
1329
1283
|
class ConditionalExpr extends Expression {
|
|
1330
1284
|
constructor(condition, trueCase, falseCase = null, type, sourceSpan) {
|
|
@@ -1343,27 +1297,6 @@ class ConditionalExpr extends Expression {
|
|
|
1343
1297
|
visitExpression(visitor, context) {
|
|
1344
1298
|
return visitor.visitConditionalExpr(this, context);
|
|
1345
1299
|
}
|
|
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
|
-
}
|
|
1367
1300
|
}
|
|
1368
1301
|
class NotExpr extends Expression {
|
|
1369
1302
|
constructor(condition, sourceSpan) {
|
|
@@ -1379,9 +1312,6 @@ class NotExpr extends Expression {
|
|
|
1379
1312
|
visitExpression(visitor, context) {
|
|
1380
1313
|
return visitor.visitNotExpr(this, context);
|
|
1381
1314
|
}
|
|
1382
|
-
clone() {
|
|
1383
|
-
return new NotExpr(this.condition.clone(), this.sourceSpan);
|
|
1384
|
-
}
|
|
1385
1315
|
}
|
|
1386
1316
|
class FnParam {
|
|
1387
1317
|
constructor(name, type = null) {
|
|
@@ -1391,9 +1321,6 @@ class FnParam {
|
|
|
1391
1321
|
isEquivalent(param) {
|
|
1392
1322
|
return this.name === param.name;
|
|
1393
1323
|
}
|
|
1394
|
-
clone() {
|
|
1395
|
-
return new FnParam(this.name, this.type);
|
|
1396
|
-
}
|
|
1397
1324
|
}
|
|
1398
1325
|
class FunctionExpr extends Expression {
|
|
1399
1326
|
constructor(params, statements, type, sourceSpan, name) {
|
|
@@ -1415,10 +1342,6 @@ class FunctionExpr extends Expression {
|
|
|
1415
1342
|
toDeclStmt(name, modifiers) {
|
|
1416
1343
|
return new DeclareFunctionStmt(name, this.params, this.statements, this.type, modifiers, this.sourceSpan);
|
|
1417
1344
|
}
|
|
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
|
-
}
|
|
1422
1345
|
}
|
|
1423
1346
|
class UnaryOperatorExpr extends Expression {
|
|
1424
1347
|
constructor(operator, expr, type, sourceSpan, parens = true) {
|
|
@@ -1437,9 +1360,6 @@ class UnaryOperatorExpr extends Expression {
|
|
|
1437
1360
|
visitExpression(visitor, context) {
|
|
1438
1361
|
return visitor.visitUnaryOperatorExpr(this, context);
|
|
1439
1362
|
}
|
|
1440
|
-
clone() {
|
|
1441
|
-
return new UnaryOperatorExpr(this.operator, this.expr.clone(), this.type, this.sourceSpan, this.parens);
|
|
1442
|
-
}
|
|
1443
1363
|
}
|
|
1444
1364
|
class BinaryOperatorExpr extends Expression {
|
|
1445
1365
|
constructor(operator, lhs, rhs, type, sourceSpan, parens = true) {
|
|
@@ -1459,9 +1379,6 @@ class BinaryOperatorExpr extends Expression {
|
|
|
1459
1379
|
visitExpression(visitor, context) {
|
|
1460
1380
|
return visitor.visitBinaryOperatorExpr(this, context);
|
|
1461
1381
|
}
|
|
1462
|
-
clone() {
|
|
1463
|
-
return new BinaryOperatorExpr(this.operator, this.lhs.clone(), this.rhs.clone(), this.type, this.sourceSpan, this.parens);
|
|
1464
|
-
}
|
|
1465
1382
|
}
|
|
1466
1383
|
class ReadPropExpr extends Expression {
|
|
1467
1384
|
constructor(receiver, name, type, sourceSpan) {
|
|
@@ -1469,10 +1386,6 @@ class ReadPropExpr extends Expression {
|
|
|
1469
1386
|
this.receiver = receiver;
|
|
1470
1387
|
this.name = name;
|
|
1471
1388
|
}
|
|
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
|
-
}
|
|
1476
1389
|
isEquivalent(e) {
|
|
1477
1390
|
return e instanceof ReadPropExpr && this.receiver.isEquivalent(e.receiver) &&
|
|
1478
1391
|
this.name === e.name;
|
|
@@ -1486,9 +1399,6 @@ class ReadPropExpr extends Expression {
|
|
|
1486
1399
|
set(value) {
|
|
1487
1400
|
return new WritePropExpr(this.receiver, this.name, value, null, this.sourceSpan);
|
|
1488
1401
|
}
|
|
1489
|
-
clone() {
|
|
1490
|
-
return new ReadPropExpr(this.receiver.clone(), this.name, this.type, this.sourceSpan);
|
|
1491
|
-
}
|
|
1492
1402
|
}
|
|
1493
1403
|
class ReadKeyExpr extends Expression {
|
|
1494
1404
|
constructor(receiver, index, type, sourceSpan) {
|
|
@@ -1509,9 +1419,6 @@ class ReadKeyExpr extends Expression {
|
|
|
1509
1419
|
set(value) {
|
|
1510
1420
|
return new WriteKeyExpr(this.receiver, this.index, value, null, this.sourceSpan);
|
|
1511
1421
|
}
|
|
1512
|
-
clone() {
|
|
1513
|
-
return new ReadKeyExpr(this.receiver.clone(), this.index.clone(), this.type, this.sourceSpan);
|
|
1514
|
-
}
|
|
1515
1422
|
}
|
|
1516
1423
|
class LiteralArrayExpr extends Expression {
|
|
1517
1424
|
constructor(entries, type, sourceSpan) {
|
|
@@ -1527,9 +1434,6 @@ class LiteralArrayExpr extends Expression {
|
|
|
1527
1434
|
visitExpression(visitor, context) {
|
|
1528
1435
|
return visitor.visitLiteralArrayExpr(this, context);
|
|
1529
1436
|
}
|
|
1530
|
-
clone() {
|
|
1531
|
-
return new LiteralArrayExpr(this.entries.map(e => e.clone()), this.type, this.sourceSpan);
|
|
1532
|
-
}
|
|
1533
1437
|
}
|
|
1534
1438
|
class LiteralMapEntry {
|
|
1535
1439
|
constructor(key, value, quoted) {
|
|
@@ -1540,9 +1444,6 @@ class LiteralMapEntry {
|
|
|
1540
1444
|
isEquivalent(e) {
|
|
1541
1445
|
return this.key === e.key && this.value.isEquivalent(e.value);
|
|
1542
1446
|
}
|
|
1543
|
-
clone() {
|
|
1544
|
-
return new LiteralMapEntry(this.key, this.value.clone(), this.quoted);
|
|
1545
|
-
}
|
|
1546
1447
|
}
|
|
1547
1448
|
class LiteralMapExpr extends Expression {
|
|
1548
1449
|
constructor(entries, type, sourceSpan) {
|
|
@@ -1562,10 +1463,6 @@ class LiteralMapExpr extends Expression {
|
|
|
1562
1463
|
visitExpression(visitor, context) {
|
|
1563
1464
|
return visitor.visitLiteralMapExpr(this, context);
|
|
1564
1465
|
}
|
|
1565
|
-
clone() {
|
|
1566
|
-
const entriesClone = this.entries.map(entry => entry.clone());
|
|
1567
|
-
return new LiteralMapExpr(entriesClone, this.type, this.sourceSpan);
|
|
1568
|
-
}
|
|
1569
1466
|
}
|
|
1570
1467
|
const NULL_EXPR = new LiteralExpr(null, null, null);
|
|
1571
1468
|
const TYPED_NULL_EXPR = new LiteralExpr(null, INFERRED_TYPE, null);
|
|
@@ -1794,7 +1691,6 @@ class FixupExpression extends Expression {
|
|
|
1794
1691
|
constructor(resolved) {
|
|
1795
1692
|
super(resolved.type);
|
|
1796
1693
|
this.resolved = resolved;
|
|
1797
|
-
this.shared = false;
|
|
1798
1694
|
this.original = resolved;
|
|
1799
1695
|
}
|
|
1800
1696
|
visitExpression(visitor, context) {
|
|
@@ -1813,9 +1709,6 @@ class FixupExpression extends Expression {
|
|
|
1813
1709
|
isConstant() {
|
|
1814
1710
|
return true;
|
|
1815
1711
|
}
|
|
1816
|
-
clone() {
|
|
1817
|
-
throw new Error(`Not supported.`);
|
|
1818
|
-
}
|
|
1819
1712
|
fixup(expression) {
|
|
1820
1713
|
this.resolved = expression;
|
|
1821
1714
|
this.shared = true;
|
|
@@ -1832,7 +1725,6 @@ class ConstantPool {
|
|
|
1832
1725
|
this.statements = [];
|
|
1833
1726
|
this.literals = new Map();
|
|
1834
1727
|
this.literalFactories = new Map();
|
|
1835
|
-
this.sharedConstants = new Map();
|
|
1836
1728
|
this.nextNameIndex = 0;
|
|
1837
1729
|
}
|
|
1838
1730
|
getConstLiteral(literal, forceShared) {
|
|
@@ -1842,7 +1734,7 @@ class ConstantPool {
|
|
|
1842
1734
|
// reference to a constant.
|
|
1843
1735
|
return literal;
|
|
1844
1736
|
}
|
|
1845
|
-
const key =
|
|
1737
|
+
const key = this.keyOf(literal);
|
|
1846
1738
|
let fixup = this.literals.get(key);
|
|
1847
1739
|
let newValue = false;
|
|
1848
1740
|
if (!fixup) {
|
|
@@ -1887,20 +1779,11 @@ class ConstantPool {
|
|
|
1887
1779
|
}
|
|
1888
1780
|
return fixup;
|
|
1889
1781
|
}
|
|
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
|
-
}
|
|
1899
1782
|
getLiteralFactory(literal) {
|
|
1900
1783
|
// Create a pure function that builds an array of a mix of constant and variable expressions
|
|
1901
1784
|
if (literal instanceof LiteralArrayExpr) {
|
|
1902
1785
|
const argumentsForKey = literal.entries.map(e => e.isConstant() ? e : UNKNOWN_VALUE_KEY);
|
|
1903
|
-
const key =
|
|
1786
|
+
const key = this.keyOf(literalArr(argumentsForKey));
|
|
1904
1787
|
return this._getLiteralFactory(key, literal.entries, entries => literalArr(entries));
|
|
1905
1788
|
}
|
|
1906
1789
|
else {
|
|
@@ -1909,7 +1792,7 @@ class ConstantPool {
|
|
|
1909
1792
|
value: e.value.isConstant() ? e.value : UNKNOWN_VALUE_KEY,
|
|
1910
1793
|
quoted: e.quoted
|
|
1911
1794
|
})));
|
|
1912
|
-
const key =
|
|
1795
|
+
const key = this.keyOf(expressionForKey);
|
|
1913
1796
|
return this._getLiteralFactory(key, literal.entries.map(e => e.value), entries => literalMap(entries.map((value, index) => ({
|
|
1914
1797
|
key: literal.entries[index].key,
|
|
1915
1798
|
value,
|
|
@@ -1946,47 +1829,64 @@ class ConstantPool {
|
|
|
1946
1829
|
freshName() {
|
|
1947
1830
|
return this.uniqueName(CONSTANT_PREFIX);
|
|
1948
1831
|
}
|
|
1832
|
+
keyOf(expression) {
|
|
1833
|
+
return expression.visitExpression(new KeyVisitor(), KEY_CONTEXT);
|
|
1834
|
+
}
|
|
1949
1835
|
}
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
}
|
|
1836
|
+
/**
|
|
1837
|
+
* Visitor used to determine if 2 expressions are equivalent and can be shared in the
|
|
1838
|
+
* `ConstantPool`.
|
|
1839
|
+
*
|
|
1840
|
+
* When the id (string) generated by the visitor is equal, expressions are considered equivalent.
|
|
1841
|
+
*/
|
|
1842
|
+
class KeyVisitor {
|
|
1843
|
+
constructor() {
|
|
1844
|
+
this.visitWrappedNodeExpr = invalid$1;
|
|
1845
|
+
this.visitWriteVarExpr = invalid$1;
|
|
1846
|
+
this.visitWriteKeyExpr = invalid$1;
|
|
1847
|
+
this.visitWritePropExpr = invalid$1;
|
|
1848
|
+
this.visitInvokeFunctionExpr = invalid$1;
|
|
1849
|
+
this.visitTaggedTemplateExpr = invalid$1;
|
|
1850
|
+
this.visitInstantiateExpr = invalid$1;
|
|
1851
|
+
this.visitConditionalExpr = invalid$1;
|
|
1852
|
+
this.visitNotExpr = invalid$1;
|
|
1853
|
+
this.visitAssertNotNullExpr = invalid$1;
|
|
1854
|
+
this.visitCastExpr = invalid$1;
|
|
1855
|
+
this.visitFunctionExpr = invalid$1;
|
|
1856
|
+
this.visitUnaryOperatorExpr = invalid$1;
|
|
1857
|
+
this.visitBinaryOperatorExpr = invalid$1;
|
|
1858
|
+
this.visitReadPropExpr = invalid$1;
|
|
1859
|
+
this.visitReadKeyExpr = invalid$1;
|
|
1860
|
+
this.visitCommaExpr = invalid$1;
|
|
1861
|
+
this.visitLocalizedString = invalid$1;
|
|
1862
|
+
}
|
|
1863
|
+
visitLiteralExpr(ast) {
|
|
1864
|
+
return `${typeof ast.value === 'string' ? '"' + ast.value + '"' : ast.value}`;
|
|
1865
|
+
}
|
|
1866
|
+
visitLiteralArrayExpr(ast, context) {
|
|
1867
|
+
return `[${ast.entries.map(entry => entry.visitExpression(this, context)).join(',')}]`;
|
|
1868
|
+
}
|
|
1869
|
+
visitLiteralMapExpr(ast, context) {
|
|
1870
|
+
const mapKey = (entry) => {
|
|
1871
|
+
const quote = entry.quoted ? '"' : '';
|
|
1872
|
+
return `${quote}${entry.key}${quote}`;
|
|
1873
|
+
};
|
|
1874
|
+
const mapEntry = (entry) => `${mapKey(entry)}:${entry.value.visitExpression(this, context)}`;
|
|
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}`;
|
|
1989
1883
|
}
|
|
1884
|
+
visitTypeofExpr(node, context) {
|
|
1885
|
+
return `TYPEOF:${node.expr.visitExpression(this, context)}`;
|
|
1886
|
+
}
|
|
1887
|
+
}
|
|
1888
|
+
function invalid$1(arg) {
|
|
1889
|
+
throw new Error(`Invalid state: Visitor ${this.constructor.name} doesn't handle ${arg.constructor.name}`);
|
|
1990
1890
|
}
|
|
1991
1891
|
function isVariable(e) {
|
|
1992
1892
|
return e instanceof ReadVarExpr;
|
|
@@ -1998,211 +1898,209 @@ function isLongStringLiteral(expr) {
|
|
|
1998
1898
|
|
|
1999
1899
|
const CORE = '@angular/core';
|
|
2000
1900
|
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 }; }
|
|
2205
1901
|
}
|
|
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 };
|
|
2206
2104
|
|
|
2207
2105
|
const DASH_CASE_REGEXP = /-+([a-z0-9])/g;
|
|
2208
2106
|
function dashCaseToCamelCase(input) {
|
|
@@ -2288,7 +2186,13 @@ class Version {
|
|
|
2288
2186
|
this.patch = splits.slice(2).join('.');
|
|
2289
2187
|
}
|
|
2290
2188
|
}
|
|
2291
|
-
|
|
2189
|
+
// Check `global` first, because in Node tests both `global` and `window` may be defined and our
|
|
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))());
|
|
2292
2196
|
/**
|
|
2293
2197
|
* Partitions a given array into 2 arrays, based on a boolean value returned by the condition
|
|
2294
2198
|
* function.
|
|
@@ -2763,9 +2667,6 @@ class AbstractEmitterVisitor {
|
|
|
2763
2667
|
ctx.print(ast, `)`);
|
|
2764
2668
|
return null;
|
|
2765
2669
|
}
|
|
2766
|
-
visitDynamicImportExpr(ast, ctx) {
|
|
2767
|
-
ctx.print(ast, `import(${ast.url})`);
|
|
2768
|
-
}
|
|
2769
2670
|
visitNotExpr(ast, ctx) {
|
|
2770
2671
|
ctx.print(ast, '!');
|
|
2771
2672
|
ast.condition.visitExpression(this, ctx);
|
|
@@ -3053,7 +2954,7 @@ function compileFactoryFunction(meta) {
|
|
|
3053
2954
|
// delegated factory (which is used to create the current type) then this is only the type-to-
|
|
3054
2955
|
// create parameter (t).
|
|
3055
2956
|
const typeForCtor = !isDelegatedFactoryMetadata(meta) ?
|
|
3056
|
-
new BinaryOperatorExpr(BinaryOperator.Or, t, meta.
|
|
2957
|
+
new BinaryOperatorExpr(BinaryOperator.Or, t, meta.internalType) :
|
|
3057
2958
|
t;
|
|
3058
2959
|
let ctorExpr = null;
|
|
3059
2960
|
if (meta.deps !== null) {
|
|
@@ -3100,7 +3001,7 @@ function compileFactoryFunction(meta) {
|
|
|
3100
3001
|
}
|
|
3101
3002
|
else if (baseFactoryVar !== null) {
|
|
3102
3003
|
// This factory uses a base factory, so call `ɵɵgetInheritedFactory()` to compute it.
|
|
3103
|
-
const getInheritedFactoryCall = importExpr(Identifiers.getInheritedFactory).callFn([meta.
|
|
3004
|
+
const getInheritedFactoryCall = importExpr(Identifiers.getInheritedFactory).callFn([meta.internalType]);
|
|
3104
3005
|
// Memoize the base factoryFn: `baseFactory || (baseFactory = ɵɵgetInheritedFactory(...))`
|
|
3105
3006
|
const baseFactory = new BinaryOperatorExpr(BinaryOperator.Or, baseFactoryVar, baseFactoryVar.set(getInheritedFactoryCall));
|
|
3106
3007
|
body.push(new ReturnStatement(baseFactory.callFn([typeForCtor])));
|
|
@@ -3336,96 +3237,6 @@ class Element$1 {
|
|
|
3336
3237
|
return visitor.visitElement(this);
|
|
3337
3238
|
}
|
|
3338
3239
|
}
|
|
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
|
-
}
|
|
3429
3240
|
class Template {
|
|
3430
3241
|
constructor(
|
|
3431
3242
|
// tagName is the name of the container element, if applicable.
|
|
@@ -3531,9 +3342,9 @@ class Message {
|
|
|
3531
3342
|
this.meaning = meaning;
|
|
3532
3343
|
this.description = description;
|
|
3533
3344
|
this.customId = customId;
|
|
3345
|
+
this.id = this.customId;
|
|
3534
3346
|
/** The ids to use if there are no custom id and if `i18nLegacyMessageIdFormat` is not empty */
|
|
3535
3347
|
this.legacyIds = [];
|
|
3536
|
-
this.id = this.customId;
|
|
3537
3348
|
this.messageString = serializeMessage(this.nodes);
|
|
3538
3349
|
if (nodes.length) {
|
|
3539
3350
|
this.sources = [{
|
|
@@ -3569,12 +3380,11 @@ class Container {
|
|
|
3569
3380
|
}
|
|
3570
3381
|
}
|
|
3571
3382
|
class Icu {
|
|
3572
|
-
constructor(expression, type, cases, sourceSpan
|
|
3383
|
+
constructor(expression, type, cases, sourceSpan) {
|
|
3573
3384
|
this.expression = expression;
|
|
3574
3385
|
this.type = type;
|
|
3575
3386
|
this.cases = cases;
|
|
3576
3387
|
this.sourceSpan = sourceSpan;
|
|
3577
|
-
this.expressionPlaceholder = expressionPlaceholder;
|
|
3578
3388
|
}
|
|
3579
3389
|
visit(visitor, context) {
|
|
3580
3390
|
return visitor.visitIcu(this, context);
|
|
@@ -3909,44 +3719,37 @@ function asLiteral(value) {
|
|
|
3909
3719
|
}
|
|
3910
3720
|
return literal(value, INFERRED_TYPE);
|
|
3911
3721
|
}
|
|
3912
|
-
function
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
return null;
|
|
3722
|
+
function conditionallyCreateMapObjectLiteral(keys, keepDeclared) {
|
|
3723
|
+
if (Object.getOwnPropertyNames(keys).length > 0) {
|
|
3724
|
+
return mapToExpression(keys, keepDeclared);
|
|
3916
3725
|
}
|
|
3917
|
-
return
|
|
3726
|
+
return null;
|
|
3727
|
+
}
|
|
3728
|
+
function mapToExpression(map, keepDeclared) {
|
|
3729
|
+
return literalMap(Object.getOwnPropertyNames(map).map(key => {
|
|
3730
|
+
// canonical syntax: `dirProp: publicProp`
|
|
3918
3731
|
const value = map[key];
|
|
3919
3732
|
let declaredName;
|
|
3920
3733
|
let publicName;
|
|
3921
3734
|
let minifiedName;
|
|
3922
|
-
let
|
|
3923
|
-
if (
|
|
3924
|
-
|
|
3925
|
-
declaredName = key;
|
|
3735
|
+
let needsDeclaredName;
|
|
3736
|
+
if (Array.isArray(value)) {
|
|
3737
|
+
[publicName, declaredName] = value;
|
|
3926
3738
|
minifiedName = key;
|
|
3927
|
-
|
|
3928
|
-
expressionValue = asLiteral(publicName);
|
|
3739
|
+
needsDeclaredName = publicName !== declaredName;
|
|
3929
3740
|
}
|
|
3930
3741
|
else {
|
|
3931
|
-
minifiedName = key;
|
|
3932
|
-
|
|
3933
|
-
|
|
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
|
-
}
|
|
3742
|
+
minifiedName = declaredName = key;
|
|
3743
|
+
publicName = value;
|
|
3744
|
+
needsDeclaredName = false;
|
|
3944
3745
|
}
|
|
3945
3746
|
return {
|
|
3946
3747
|
key: minifiedName,
|
|
3947
3748
|
// put quotes around keys that contain potentially unsafe characters
|
|
3948
3749
|
quoted: UNSAFE_OBJECT_KEY_NAME_REGEXP.test(minifiedName),
|
|
3949
|
-
value:
|
|
3750
|
+
value: (keepDeclared && needsDeclaredName) ?
|
|
3751
|
+
literalArr([asLiteral(publicName), asLiteral(declaredName)]) :
|
|
3752
|
+
asLiteral(publicName)
|
|
3950
3753
|
};
|
|
3951
3754
|
}));
|
|
3952
3755
|
}
|
|
@@ -4060,6 +3863,7 @@ function compileInjectable(meta, resolveForwardRefs) {
|
|
|
4060
3863
|
const factoryMeta = {
|
|
4061
3864
|
name: meta.name,
|
|
4062
3865
|
type: meta.type,
|
|
3866
|
+
internalType: meta.internalType,
|
|
4063
3867
|
typeArgumentCount: meta.typeArgumentCount,
|
|
4064
3868
|
deps: [],
|
|
4065
3869
|
target: FactoryTarget$1.Injectable,
|
|
@@ -4071,7 +3875,7 @@ function compileInjectable(meta, resolveForwardRefs) {
|
|
|
4071
3875
|
//
|
|
4072
3876
|
// A special case exists for useClass: Type where Type is the injectable type itself and no
|
|
4073
3877
|
// deps are specified, in which case 'useClass' is effectively ignored.
|
|
4074
|
-
const useClassOnSelf = meta.useClass.expression.isEquivalent(meta.
|
|
3878
|
+
const useClassOnSelf = meta.useClass.expression.isEquivalent(meta.internalType);
|
|
4075
3879
|
let deps = undefined;
|
|
4076
3880
|
if (meta.deps !== undefined) {
|
|
4077
3881
|
deps = meta.deps;
|
|
@@ -4130,10 +3934,10 @@ function compileInjectable(meta, resolveForwardRefs) {
|
|
|
4130
3934
|
else {
|
|
4131
3935
|
result = {
|
|
4132
3936
|
statements: [],
|
|
4133
|
-
expression: delegateToFactory(meta.type.value, meta.
|
|
3937
|
+
expression: delegateToFactory(meta.type.value, meta.internalType, resolveForwardRefs)
|
|
4134
3938
|
};
|
|
4135
3939
|
}
|
|
4136
|
-
const token = meta.
|
|
3940
|
+
const token = meta.internalType;
|
|
4137
3941
|
const injectableProps = new DefinitionMap();
|
|
4138
3942
|
injectableProps.set('token', token);
|
|
4139
3943
|
injectableProps.set('factory', result.expression);
|
|
@@ -4152,28 +3956,28 @@ function compileInjectable(meta, resolveForwardRefs) {
|
|
|
4152
3956
|
function createInjectableType(meta) {
|
|
4153
3957
|
return new ExpressionType$1(importExpr(Identifiers.InjectableDeclaration, [typeWithParameters(meta.type.type, meta.typeArgumentCount)]));
|
|
4154
3958
|
}
|
|
4155
|
-
function delegateToFactory(type,
|
|
4156
|
-
if (type.node ===
|
|
3959
|
+
function delegateToFactory(type, internalType, unwrapForwardRefs) {
|
|
3960
|
+
if (type.node === internalType.node) {
|
|
4157
3961
|
// The types are the same, so we can simply delegate directly to the type's factory.
|
|
4158
3962
|
// ```
|
|
4159
3963
|
// factory: type.ɵfac
|
|
4160
3964
|
// ```
|
|
4161
|
-
return
|
|
3965
|
+
return internalType.prop('ɵfac');
|
|
4162
3966
|
}
|
|
4163
3967
|
if (!unwrapForwardRefs) {
|
|
4164
3968
|
// The type is not wrapped in a `forwardRef()`, so we create a simple factory function that
|
|
4165
3969
|
// accepts a sub-type as an argument.
|
|
4166
3970
|
// ```
|
|
4167
|
-
// factory: function(t) { return
|
|
3971
|
+
// factory: function(t) { return internalType.ɵfac(t); }
|
|
4168
3972
|
// ```
|
|
4169
|
-
return createFactoryFunction(
|
|
3973
|
+
return createFactoryFunction(internalType);
|
|
4170
3974
|
}
|
|
4171
|
-
// The
|
|
3975
|
+
// The internalType is actually wrapped in a `forwardRef()` so we need to resolve that before
|
|
4172
3976
|
// calling its factory.
|
|
4173
3977
|
// ```
|
|
4174
3978
|
// factory: function(t) { return core.resolveForwardRef(type).ɵfac(t); }
|
|
4175
3979
|
// ```
|
|
4176
|
-
const unwrappedType = importExpr(Identifiers.resolveForwardRef).callFn([
|
|
3980
|
+
const unwrappedType = importExpr(Identifiers.resolveForwardRef).callFn([internalType]);
|
|
4177
3981
|
return createFactoryFunction(unwrappedType);
|
|
4178
3982
|
}
|
|
4179
3983
|
function createFactoryFunction(type) {
|
|
@@ -4581,6 +4385,45 @@ class AbstractJsEmitterVisitor extends AbstractEmitterVisitor {
|
|
|
4581
4385
|
this.visitAllObjects(param => ctx.print(null, param.name), params, ctx, ',');
|
|
4582
4386
|
}
|
|
4583
4387
|
}
|
|
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
|
+
}
|
|
4584
4427
|
/**
|
|
4585
4428
|
* Unsafely promote a string to a TrustedScript, falling back to strings when
|
|
4586
4429
|
* Trusted Types are not available.
|
|
@@ -4589,7 +4432,7 @@ class AbstractJsEmitterVisitor extends AbstractEmitterVisitor {
|
|
|
4589
4432
|
* interpreted and executed as a script by a browser, e.g. when calling eval.
|
|
4590
4433
|
*/
|
|
4591
4434
|
function trustedScriptFromString(script) {
|
|
4592
|
-
return script;
|
|
4435
|
+
return getPolicy()?.createScript(script) || script;
|
|
4593
4436
|
}
|
|
4594
4437
|
/**
|
|
4595
4438
|
* Unsafely call the Function constructor with the given string arguments.
|
|
@@ -4831,49 +4674,31 @@ var R3SelectorScopeMode;
|
|
|
4831
4674
|
*/
|
|
4832
4675
|
R3SelectorScopeMode[R3SelectorScopeMode["Omit"] = 2] = "Omit";
|
|
4833
4676
|
})(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 = {}));
|
|
4845
4677
|
/**
|
|
4846
4678
|
* Construct an `R3NgModuleDef` for the given `R3NgModuleMetadata`.
|
|
4847
4679
|
*/
|
|
4848
4680
|
function compileNgModule(meta) {
|
|
4681
|
+
const { adjacentType, internalType, bootstrap, declarations, imports, exports, schemas, containsForwardDecls, selectorScopeMode, id } = meta;
|
|
4849
4682
|
const statements = [];
|
|
4850
4683
|
const definitionMap = new DefinitionMap();
|
|
4851
|
-
definitionMap.set('type',
|
|
4852
|
-
|
|
4853
|
-
|
|
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
|
-
}
|
|
4684
|
+
definitionMap.set('type', internalType);
|
|
4685
|
+
if (bootstrap.length > 0) {
|
|
4686
|
+
definitionMap.set('bootstrap', refsToArray(bootstrap, containsForwardDecls));
|
|
4862
4687
|
}
|
|
4863
|
-
if (
|
|
4688
|
+
if (selectorScopeMode === R3SelectorScopeMode.Inline) {
|
|
4864
4689
|
// If requested to emit scope information inline, pass the `declarations`, `imports` and
|
|
4865
4690
|
// `exports` to the `ɵɵdefineNgModule()` call directly.
|
|
4866
|
-
if (
|
|
4867
|
-
definitionMap.set('declarations', refsToArray(
|
|
4691
|
+
if (declarations.length > 0) {
|
|
4692
|
+
definitionMap.set('declarations', refsToArray(declarations, containsForwardDecls));
|
|
4868
4693
|
}
|
|
4869
|
-
if (
|
|
4870
|
-
definitionMap.set('imports', refsToArray(
|
|
4694
|
+
if (imports.length > 0) {
|
|
4695
|
+
definitionMap.set('imports', refsToArray(imports, containsForwardDecls));
|
|
4871
4696
|
}
|
|
4872
|
-
if (
|
|
4873
|
-
definitionMap.set('exports', refsToArray(
|
|
4697
|
+
if (exports.length > 0) {
|
|
4698
|
+
definitionMap.set('exports', refsToArray(exports, containsForwardDecls));
|
|
4874
4699
|
}
|
|
4875
4700
|
}
|
|
4876
|
-
else if (
|
|
4701
|
+
else if (selectorScopeMode === R3SelectorScopeMode.SideEffect) {
|
|
4877
4702
|
// In this mode, scope information is not passed into `ɵɵdefineNgModule` as it
|
|
4878
4703
|
// would prevent tree-shaking of the declarations, imports and exports references. Instead, it's
|
|
4879
4704
|
// patched onto the NgModule definition with a `ɵɵsetNgModuleScope` call that's guarded by the
|
|
@@ -4884,14 +4709,14 @@ function compileNgModule(meta) {
|
|
|
4884
4709
|
}
|
|
4885
4710
|
}
|
|
4886
4711
|
else ;
|
|
4887
|
-
if (
|
|
4888
|
-
definitionMap.set('schemas', literalArr(
|
|
4712
|
+
if (schemas !== null && schemas.length > 0) {
|
|
4713
|
+
definitionMap.set('schemas', literalArr(schemas.map(ref => ref.value)));
|
|
4889
4714
|
}
|
|
4890
|
-
if (
|
|
4891
|
-
definitionMap.set('id',
|
|
4715
|
+
if (id !== null) {
|
|
4716
|
+
definitionMap.set('id', id);
|
|
4892
4717
|
// Generate a side-effectful call to register this NgModule by its id, as per the semantics of
|
|
4893
4718
|
// NgModule ids.
|
|
4894
|
-
statements.push(importExpr(Identifiers.registerNgModuleType).callFn([
|
|
4719
|
+
statements.push(importExpr(Identifiers.registerNgModuleType).callFn([adjacentType, id]).toStmt());
|
|
4895
4720
|
}
|
|
4896
4721
|
const expression = importExpr(Identifiers.defineNgModule).callFn([definitionMap.toLiteralMap()], undefined, true);
|
|
4897
4722
|
const type = createNgModuleType(meta);
|
|
@@ -4924,11 +4749,7 @@ function compileNgModuleDeclarationExpression(meta) {
|
|
|
4924
4749
|
}
|
|
4925
4750
|
return importExpr(Identifiers.defineNgModule).callFn([definitionMap.toLiteralMap()]);
|
|
4926
4751
|
}
|
|
4927
|
-
function createNgModuleType(
|
|
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;
|
|
4752
|
+
function createNgModuleType({ type: moduleType, declarations, exports, imports, includeImportTypes, publicDeclarationTypes }) {
|
|
4932
4753
|
return new ExpressionType$1(importExpr(Identifiers.NgModuleDeclaration, [
|
|
4933
4754
|
new ExpressionType$1(moduleType.type),
|
|
4934
4755
|
publicDeclarationTypes === null ? tupleTypeOf(declarations) :
|
|
@@ -4944,36 +4765,16 @@ function createNgModuleType(meta) {
|
|
|
4944
4765
|
* symbols to become tree-shakeable.
|
|
4945
4766
|
*/
|
|
4946
4767
|
function generateSetNgModuleScopeCall(meta) {
|
|
4768
|
+
const { adjacentType: moduleType, declarations, imports, exports, containsForwardDecls } = meta;
|
|
4947
4769
|
const scopeMap = new DefinitionMap();
|
|
4948
|
-
if (
|
|
4949
|
-
|
|
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
|
-
}
|
|
4770
|
+
if (declarations.length > 0) {
|
|
4771
|
+
scopeMap.set('declarations', refsToArray(declarations, containsForwardDecls));
|
|
4962
4772
|
}
|
|
4963
|
-
|
|
4964
|
-
|
|
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
|
-
}
|
|
4773
|
+
if (imports.length > 0) {
|
|
4774
|
+
scopeMap.set('imports', refsToArray(imports, containsForwardDecls));
|
|
4972
4775
|
}
|
|
4973
|
-
|
|
4974
|
-
|
|
4975
|
-
scopeMap.set('exports', meta.exportsExpression);
|
|
4976
|
-
}
|
|
4776
|
+
if (exports.length > 0) {
|
|
4777
|
+
scopeMap.set('exports', refsToArray(exports, containsForwardDecls));
|
|
4977
4778
|
}
|
|
4978
4779
|
if (Object.keys(scopeMap.values).length === 0) {
|
|
4979
4780
|
return null;
|
|
@@ -4981,7 +4782,7 @@ function generateSetNgModuleScopeCall(meta) {
|
|
|
4981
4782
|
// setNgModuleScope(...)
|
|
4982
4783
|
const fnCall = new InvokeFunctionExpr(
|
|
4983
4784
|
/* fn */ importExpr(Identifiers.setNgModuleScope),
|
|
4984
|
-
/* args */ [
|
|
4785
|
+
/* args */ [moduleType, scopeMap.toLiteralMap()]);
|
|
4985
4786
|
// (ngJitMode guard) && setNgModuleScope(...)
|
|
4986
4787
|
const guardedCall = jitOnlyGuardedExpression(fnCall);
|
|
4987
4788
|
// function() { (ngJitMode guard) && setNgModuleScope(...); }
|
|
@@ -5069,7 +4870,7 @@ class ASTWithName extends AST {
|
|
|
5069
4870
|
this.nameSpan = nameSpan;
|
|
5070
4871
|
}
|
|
5071
4872
|
}
|
|
5072
|
-
class EmptyExpr
|
|
4873
|
+
class EmptyExpr extends AST {
|
|
5073
4874
|
visit(visitor, context = null) {
|
|
5074
4875
|
// do nothing
|
|
5075
4876
|
}
|
|
@@ -5216,7 +5017,7 @@ class LiteralMap extends AST {
|
|
|
5216
5017
|
return visitor.visitLiteralMap(this, context);
|
|
5217
5018
|
}
|
|
5218
5019
|
}
|
|
5219
|
-
class Interpolation
|
|
5020
|
+
class Interpolation extends AST {
|
|
5220
5021
|
constructor(span, sourceSpan, strings, expressions) {
|
|
5221
5022
|
super(span, sourceSpan);
|
|
5222
5023
|
this.strings = strings;
|
|
@@ -5463,7 +5264,7 @@ class AstTransformer {
|
|
|
5463
5264
|
return ast;
|
|
5464
5265
|
}
|
|
5465
5266
|
visitInterpolation(ast, context) {
|
|
5466
|
-
return new Interpolation
|
|
5267
|
+
return new Interpolation(ast.span, ast.sourceSpan, ast.strings, this.visitAll(ast.expressions));
|
|
5467
5268
|
}
|
|
5468
5269
|
visitLiteralPrimitive(ast, context) {
|
|
5469
5270
|
return new LiteralPrimitive(ast.span, ast.sourceSpan, ast.value);
|
|
@@ -5546,7 +5347,7 @@ class AstMemoryEfficientTransformer {
|
|
|
5546
5347
|
visitInterpolation(ast, context) {
|
|
5547
5348
|
const expressions = this.visitAll(ast.expressions);
|
|
5548
5349
|
if (expressions !== ast.expressions)
|
|
5549
|
-
return new Interpolation
|
|
5350
|
+
return new Interpolation(ast.span, ast.sourceSpan, ast.strings, expressions);
|
|
5550
5351
|
return ast;
|
|
5551
5352
|
}
|
|
5552
5353
|
visitLiteralPrimitive(ast, context) {
|
|
@@ -5759,8 +5560,8 @@ class BoundElementProperty {
|
|
|
5759
5560
|
}
|
|
5760
5561
|
|
|
5761
5562
|
class EventHandlerVars {
|
|
5762
|
-
static { this.event = variable('$event'); }
|
|
5763
5563
|
}
|
|
5564
|
+
EventHandlerVars.event = variable('$event');
|
|
5764
5565
|
/**
|
|
5765
5566
|
* Converts the given expression AST into an executable output AST, assuming the expression is
|
|
5766
5567
|
* used in an action binding (e.g. an event handler).
|
|
@@ -6484,7 +6285,6 @@ class InterpolationExpression extends Expression {
|
|
|
6484
6285
|
this.isConstant = unsupported;
|
|
6485
6286
|
this.isEquivalent = unsupported;
|
|
6486
6287
|
this.visitExpression = unsupported;
|
|
6487
|
-
this.clone = unsupported;
|
|
6488
6288
|
}
|
|
6489
6289
|
}
|
|
6490
6290
|
class DefaultLocalResolver {
|
|
@@ -6502,7 +6302,7 @@ class DefaultLocalResolver {
|
|
|
6502
6302
|
}
|
|
6503
6303
|
class BuiltinFunctionCall extends Call {
|
|
6504
6304
|
constructor(span, sourceSpan, args, converter) {
|
|
6505
|
-
super(span, sourceSpan, new EmptyExpr
|
|
6305
|
+
super(span, sourceSpan, new EmptyExpr(span, sourceSpan), args, null);
|
|
6506
6306
|
this.converter = converter;
|
|
6507
6307
|
}
|
|
6508
6308
|
}
|
|
@@ -6739,28 +6539,11 @@ class ShadowCss {
|
|
|
6739
6539
|
* The hostSelector is the attribute added to the host itself.
|
|
6740
6540
|
*/
|
|
6741
6541
|
shimCssText(cssText, selector, hostSelector = '') {
|
|
6742
|
-
|
|
6743
|
-
|
|
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
|
-
});
|
|
6542
|
+
const commentsWithHash = extractCommentsWithHash(cssText);
|
|
6543
|
+
cssText = stripComments(cssText);
|
|
6759
6544
|
cssText = this._insertDirectives(cssText);
|
|
6760
6545
|
const scopedCssText = this._scopeCssText(cssText, selector, hostSelector);
|
|
6761
|
-
|
|
6762
|
-
let commentIdx = 0;
|
|
6763
|
-
return scopedCssText.replace(_commentWithHashPlaceHolderRe, () => comments[commentIdx++]);
|
|
6546
|
+
return [scopedCssText, ...commentsWithHash].join('\n');
|
|
6764
6547
|
}
|
|
6765
6548
|
_insertDirectives(cssText) {
|
|
6766
6549
|
cssText = this._insertPolyfillDirectivesInCssText(cssText);
|
|
@@ -7001,7 +6784,7 @@ class ShadowCss {
|
|
|
7001
6784
|
return cssText.replace(_cssColonHostRe, (_, hostSelectors, otherSelectors) => {
|
|
7002
6785
|
if (hostSelectors) {
|
|
7003
6786
|
const convertedSelectors = [];
|
|
7004
|
-
const hostSelectorArray = hostSelectors.split(',').map(
|
|
6787
|
+
const hostSelectorArray = hostSelectors.split(',').map(p => p.trim());
|
|
7005
6788
|
for (const hostSelector of hostSelectorArray) {
|
|
7006
6789
|
if (!hostSelector)
|
|
7007
6790
|
break;
|
|
@@ -7031,7 +6814,7 @@ class ShadowCss {
|
|
|
7031
6814
|
* .foo<scopeName> .bar { ... }
|
|
7032
6815
|
*/
|
|
7033
6816
|
_convertColonHostContext(cssText) {
|
|
7034
|
-
return cssText.replace(_cssColonHostContextReGlobal,
|
|
6817
|
+
return cssText.replace(_cssColonHostContextReGlobal, selectorText => {
|
|
7035
6818
|
// We have captured a selector that contains a `:host-context` rule.
|
|
7036
6819
|
// For backward compatibility `:host-context` may contain a comma separated list of selectors.
|
|
7037
6820
|
// Each context selector group will contain a list of host-context selectors that must match
|
|
@@ -7043,10 +6826,10 @@ class ShadowCss {
|
|
|
7043
6826
|
// Execute `_cssColonHostContextRe` over and over until we have extracted all the
|
|
7044
6827
|
// `:host-context` selectors from this selector.
|
|
7045
6828
|
let match;
|
|
7046
|
-
while (
|
|
6829
|
+
while (match = _cssColonHostContextRe.exec(selectorText)) {
|
|
7047
6830
|
// `match` = [':host-context(<selectors>)<rest>', <selectors>, <rest>]
|
|
7048
6831
|
// The `<selectors>` could actually be a comma separated list: `:host-context(.one, .two)`.
|
|
7049
|
-
const newContextSelectors = (match[1] ?? '').trim().split(',').map(
|
|
6832
|
+
const newContextSelectors = (match[1] ?? '').trim().split(',').map(m => m.trim()).filter(m => m !== '');
|
|
7050
6833
|
// We must duplicate the current selector group for each of these new selectors.
|
|
7051
6834
|
// For example if the current groups are:
|
|
7052
6835
|
// ```
|
|
@@ -7069,7 +6852,7 @@ class ShadowCss {
|
|
|
7069
6852
|
repeatGroups(contextSelectorGroups, newContextSelectors.length);
|
|
7070
6853
|
for (let i = 0; i < newContextSelectors.length; i++) {
|
|
7071
6854
|
for (let j = 0; j < contextSelectorGroupsLength; j++) {
|
|
7072
|
-
contextSelectorGroups[j + i * contextSelectorGroupsLength].push(newContextSelectors[i]);
|
|
6855
|
+
contextSelectorGroups[j + (i * contextSelectorGroupsLength)].push(newContextSelectors[i]);
|
|
7073
6856
|
}
|
|
7074
6857
|
}
|
|
7075
6858
|
// Update the `selectorText` and see repeat to see if there are more `:host-context`s.
|
|
@@ -7079,7 +6862,7 @@ class ShadowCss {
|
|
|
7079
6862
|
// selectors that `:host-context` can match. See `combineHostContextSelectors()` for more
|
|
7080
6863
|
// info about how this is done.
|
|
7081
6864
|
return contextSelectorGroups
|
|
7082
|
-
.map(
|
|
6865
|
+
.map(contextSelectors => combineHostContextSelectors(contextSelectors, selectorText))
|
|
7083
6866
|
.join(', ');
|
|
7084
6867
|
});
|
|
7085
6868
|
}
|
|
@@ -7100,7 +6883,7 @@ class ShadowCss {
|
|
|
7100
6883
|
}
|
|
7101
6884
|
else if (rule.selector.startsWith('@media') || rule.selector.startsWith('@supports') ||
|
|
7102
6885
|
rule.selector.startsWith('@document') || rule.selector.startsWith('@layer') ||
|
|
7103
|
-
rule.selector.startsWith('@container')
|
|
6886
|
+
rule.selector.startsWith('@container')) {
|
|
7104
6887
|
content = this._scopeSelectors(rule.content, scopeSelector, hostSelector);
|
|
7105
6888
|
}
|
|
7106
6889
|
else if (rule.selector.startsWith('@font-face') || rule.selector.startsWith('@page')) {
|
|
@@ -7131,7 +6914,7 @@ class ShadowCss {
|
|
|
7131
6914
|
* ```
|
|
7132
6915
|
*/
|
|
7133
6916
|
_stripScopingSelectors(cssText) {
|
|
7134
|
-
return processRules(cssText,
|
|
6917
|
+
return processRules(cssText, rule => {
|
|
7135
6918
|
const selector = rule.selector.replace(_shadowDeepSelectors, ' ')
|
|
7136
6919
|
.replace(_polyfillHostNoCombinatorRe, ' ');
|
|
7137
6920
|
return new CssRule(selector, rule.content);
|
|
@@ -7139,7 +6922,7 @@ class ShadowCss {
|
|
|
7139
6922
|
}
|
|
7140
6923
|
_scopeSelector(selector, scopeSelector, hostSelector) {
|
|
7141
6924
|
return selector.split(',')
|
|
7142
|
-
.map(
|
|
6925
|
+
.map(part => part.trim().split(_shadowDeepSelectors))
|
|
7143
6926
|
.map((deepParts) => {
|
|
7144
6927
|
const [shallowPart, ...otherParts] = deepParts;
|
|
7145
6928
|
const applyScope = (shallowPart) => {
|
|
@@ -7322,14 +7105,17 @@ const _selectorReSuffix = '([>\\s~+[.,{:][\\s\\S]*)?$';
|
|
|
7322
7105
|
const _polyfillHostRe = /-shadowcsshost/gim;
|
|
7323
7106
|
const _colonHostRe = /:host/gim;
|
|
7324
7107
|
const _colonHostContextRe = /:host-context/gim;
|
|
7325
|
-
const _newLinesRe = /\r?\n/g;
|
|
7326
7108
|
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');
|
|
7330
7109
|
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
|
+
}
|
|
7331
7117
|
const BLOCK_PLACEHOLDER = '%BLOCK%';
|
|
7332
|
-
const _ruleRe =
|
|
7118
|
+
const _ruleRe = /(\s*)([^;\{\}]+?)(\s*)((?:{%BLOCK%}?\s*;?)|(?:\s*;))/g;
|
|
7333
7119
|
const CONTENT_PAIRS = new Map([['{', '}']]);
|
|
7334
7120
|
const COMMA_IN_PLACEHOLDER = '%COMMA_IN_PLACEHOLDER%';
|
|
7335
7121
|
const SEMI_IN_PLACEHOLDER = '%SEMI_IN_PLACEHOLDER%';
|
|
@@ -7538,6 +7324,7 @@ function unescapeQuotes(str, isQuoted) {
|
|
|
7538
7324
|
*
|
|
7539
7325
|
* And so on...
|
|
7540
7326
|
*
|
|
7327
|
+
* @param hostMarker the string that selects the host element.
|
|
7541
7328
|
* @param contextSelectors an array of context selectors that will be combined.
|
|
7542
7329
|
* @param otherSelectors the rest of the selectors that are not context selectors.
|
|
7543
7330
|
*/
|
|
@@ -7591,743 +7378,13 @@ function repeatGroups(groups, multiples) {
|
|
|
7591
7378
|
}
|
|
7592
7379
|
}
|
|
7593
7380
|
|
|
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
|
-
|
|
7629
7381
|
/**
|
|
7630
|
-
*
|
|
7631
|
-
|
|
7632
|
-
|
|
7633
|
-
|
|
7634
|
-
|
|
7635
|
-
|
|
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']`
|
|
7382
|
+
* Parses string representation of a style and converts it into object literal.
|
|
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']`
|
|
8331
7388
|
*/
|
|
8332
7389
|
function parse(value) {
|
|
8333
7390
|
// we use a string array here instead of a string map
|
|
@@ -8371,7 +7428,7 @@ function parse(value) {
|
|
|
8371
7428
|
break;
|
|
8372
7429
|
case 58 /* Char.Colon */:
|
|
8373
7430
|
if (!currentProp && parenDepth === 0 && quote === 0 /* Char.QuoteNone */) {
|
|
8374
|
-
currentProp = hyphenate
|
|
7431
|
+
currentProp = hyphenate(value.substring(propStart, i - 1).trim());
|
|
8375
7432
|
valueStart = i;
|
|
8376
7433
|
}
|
|
8377
7434
|
break;
|
|
@@ -8392,7 +7449,7 @@ function parse(value) {
|
|
|
8392
7449
|
}
|
|
8393
7450
|
return styles;
|
|
8394
7451
|
}
|
|
8395
|
-
function hyphenate
|
|
7452
|
+
function hyphenate(value) {
|
|
8396
7453
|
return value
|
|
8397
7454
|
.replace(/[a-z][A-Z]/g, v => {
|
|
8398
7455
|
return v.charAt(0) + '-' + v.charAt(1);
|
|
@@ -8400,140 +7457,6 @@ function hyphenate$1(value) {
|
|
|
8400
7457
|
.toLowerCase();
|
|
8401
7458
|
}
|
|
8402
7459
|
|
|
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
|
-
|
|
8537
7460
|
const IMPORTANT_FLAG = '!important';
|
|
8538
7461
|
/**
|
|
8539
7462
|
* Minimum amount of binding slots required in the runtime for style/class bindings.
|
|
@@ -8703,7 +7626,7 @@ class StylingBuilder {
|
|
|
8703
7626
|
// CSS custom properties are case-sensitive so we shouldn't normalize them.
|
|
8704
7627
|
// See: https://www.w3.org/TR/css-variables-1/#defining-variables
|
|
8705
7628
|
if (!isCssCustomProperty(name)) {
|
|
8706
|
-
name = hyphenate
|
|
7629
|
+
name = hyphenate(name);
|
|
8707
7630
|
}
|
|
8708
7631
|
const { property, hasOverrideFlag, suffix: bindingSuffix } = parseProperty(name);
|
|
8709
7632
|
suffix = typeof suffix === 'string' && suffix.length !== 0 ? suffix : bindingSuffix;
|
|
@@ -8833,7 +7756,7 @@ class StylingBuilder {
|
|
|
8833
7756
|
// pipes can be picked up in time before the template is built
|
|
8834
7757
|
const mapValue = stylingInput.value.visit(valueConverter);
|
|
8835
7758
|
let reference;
|
|
8836
|
-
if (mapValue instanceof Interpolation
|
|
7759
|
+
if (mapValue instanceof Interpolation) {
|
|
8837
7760
|
totalBindingSlotsRequired += mapValue.expressions.length;
|
|
8838
7761
|
reference = isClassBased ? getClassMapInterpolationExpression(mapValue) :
|
|
8839
7762
|
getStyleMapInterpolationExpression(mapValue);
|
|
@@ -8868,7 +7791,7 @@ class StylingBuilder {
|
|
|
8868
7791
|
// We need to store the intermediate value so that we don't allocate
|
|
8869
7792
|
// the strings on each CD.
|
|
8870
7793
|
let totalBindingSlotsRequired = MIN_STYLING_BINDING_SLOTS_REQUIRED;
|
|
8871
|
-
if (value instanceof Interpolation
|
|
7794
|
+
if (value instanceof Interpolation) {
|
|
8872
7795
|
totalBindingSlotsRequired += value.expressions.length;
|
|
8873
7796
|
if (getInterpolationExpressionFn) {
|
|
8874
7797
|
referenceForCall = getInterpolationExpressionFn(value);
|
|
@@ -9060,7 +7983,7 @@ function isEmptyExpression(ast) {
|
|
|
9060
7983
|
if (ast instanceof ASTWithSource) {
|
|
9061
7984
|
ast = ast.ast;
|
|
9062
7985
|
}
|
|
9063
|
-
return ast instanceof EmptyExpr
|
|
7986
|
+
return ast instanceof EmptyExpr;
|
|
9064
7987
|
}
|
|
9065
7988
|
|
|
9066
7989
|
var TokenType;
|
|
@@ -9496,7 +8419,6 @@ class Parser$1 {
|
|
|
9496
8419
|
ast.visit(checker);
|
|
9497
8420
|
return checker.errors;
|
|
9498
8421
|
}
|
|
9499
|
-
// Host bindings parsed here
|
|
9500
8422
|
parseSimpleBinding(input, location, absoluteOffset, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {
|
|
9501
8423
|
const ast = this._parseBindingAst(input, location, absoluteOffset, interpolationConfig);
|
|
9502
8424
|
const errors = this.checkSimpleExpression(ast);
|
|
@@ -9579,7 +8501,7 @@ class Parser$1 {
|
|
|
9579
8501
|
}
|
|
9580
8502
|
createInterpolationAst(strings, expressions, input, location, absoluteOffset) {
|
|
9581
8503
|
const span = new ParseSpan(0, input.length);
|
|
9582
|
-
const interpolation = new Interpolation
|
|
8504
|
+
const interpolation = new Interpolation(span, span.toAbsolute(absoluteOffset), strings, expressions);
|
|
9583
8505
|
return new ASTWithSource(interpolation, input, location, absoluteOffset, this.errors);
|
|
9584
8506
|
}
|
|
9585
8507
|
/**
|
|
@@ -9950,7 +8872,7 @@ class _ParseAST {
|
|
|
9950
8872
|
// We have no expressions so create an empty expression that spans the entire input length
|
|
9951
8873
|
const artificialStart = this.offset;
|
|
9952
8874
|
const artificialEnd = this.offset + this.input.length;
|
|
9953
|
-
return new EmptyExpr
|
|
8875
|
+
return new EmptyExpr(this.span(artificialStart, artificialEnd), this.sourceSpan(artificialStart, artificialEnd));
|
|
9954
8876
|
}
|
|
9955
8877
|
if (exprs.length == 1)
|
|
9956
8878
|
return exprs[0];
|
|
@@ -10011,7 +8933,7 @@ class _ParseAST {
|
|
|
10011
8933
|
const end = this.inputIndex;
|
|
10012
8934
|
const expression = this.input.substring(start, end);
|
|
10013
8935
|
this.error(`Conditional expression ${expression} requires all 3 expressions`);
|
|
10014
|
-
no = new EmptyExpr
|
|
8936
|
+
no = new EmptyExpr(this.span(start), this.sourceSpan(start));
|
|
10015
8937
|
}
|
|
10016
8938
|
else {
|
|
10017
8939
|
no = this.parsePipe();
|
|
@@ -10236,15 +9158,15 @@ class _ParseAST {
|
|
|
10236
9158
|
}
|
|
10237
9159
|
else if (this.next.isPrivateIdentifier()) {
|
|
10238
9160
|
this._reportErrorForPrivateIdentifier(this.next, null);
|
|
10239
|
-
return new EmptyExpr
|
|
9161
|
+
return new EmptyExpr(this.span(start), this.sourceSpan(start));
|
|
10240
9162
|
}
|
|
10241
9163
|
else if (this.index >= this.tokens.length) {
|
|
10242
9164
|
this.error(`Unexpected end of expression: ${this.input}`);
|
|
10243
|
-
return new EmptyExpr
|
|
9165
|
+
return new EmptyExpr(this.span(start), this.sourceSpan(start));
|
|
10244
9166
|
}
|
|
10245
9167
|
else {
|
|
10246
9168
|
this.error(`Unexpected token ${this.next}`);
|
|
10247
|
-
return new EmptyExpr
|
|
9169
|
+
return new EmptyExpr(this.span(start), this.sourceSpan(start));
|
|
10248
9170
|
}
|
|
10249
9171
|
}
|
|
10250
9172
|
parseExpressionList(terminator) {
|
|
@@ -10305,7 +9227,7 @@ class _ParseAST {
|
|
|
10305
9227
|
if (isSafe) {
|
|
10306
9228
|
if (this.consumeOptionalAssignment()) {
|
|
10307
9229
|
this.error('The \'?.\' operator cannot be used in the assignment');
|
|
10308
|
-
receiver = new EmptyExpr
|
|
9230
|
+
receiver = new EmptyExpr(this.span(start), this.sourceSpan(start));
|
|
10309
9231
|
}
|
|
10310
9232
|
else {
|
|
10311
9233
|
receiver = new SafePropertyRead(this.span(start), this.sourceSpan(start), nameSpan, readReceiver, id);
|
|
@@ -10315,7 +9237,7 @@ class _ParseAST {
|
|
|
10315
9237
|
if (this.consumeOptionalAssignment()) {
|
|
10316
9238
|
if (!(this.parseFlags & 1 /* ParseFlags.Action */)) {
|
|
10317
9239
|
this.error('Bindings cannot contain assignments');
|
|
10318
|
-
return new EmptyExpr
|
|
9240
|
+
return new EmptyExpr(this.span(start), this.sourceSpan(start));
|
|
10319
9241
|
}
|
|
10320
9242
|
const value = this.parseConditional();
|
|
10321
9243
|
receiver = new PropertyWrite(this.span(start), this.sourceSpan(start), nameSpan, readReceiver, id, value);
|
|
@@ -10445,7 +9367,7 @@ class _ParseAST {
|
|
|
10445
9367
|
return this.withContext(ParseContextFlags.Writable, () => {
|
|
10446
9368
|
this.rbracketsExpected++;
|
|
10447
9369
|
const key = this.parsePipe();
|
|
10448
|
-
if (key instanceof EmptyExpr
|
|
9370
|
+
if (key instanceof EmptyExpr) {
|
|
10449
9371
|
this.error(`Key access cannot be empty`);
|
|
10450
9372
|
}
|
|
10451
9373
|
this.rbracketsExpected--;
|
|
@@ -10463,7 +9385,7 @@ class _ParseAST {
|
|
|
10463
9385
|
return isSafe ? new SafeKeyedRead(this.span(start), this.sourceSpan(start), receiver, key) :
|
|
10464
9386
|
new KeyedRead(this.span(start), this.sourceSpan(start), receiver, key);
|
|
10465
9387
|
}
|
|
10466
|
-
return new EmptyExpr
|
|
9388
|
+
return new EmptyExpr(this.span(start), this.sourceSpan(start));
|
|
10467
9389
|
});
|
|
10468
9390
|
}
|
|
10469
9391
|
/**
|
|
@@ -10758,39 +9680,6 @@ class Comment {
|
|
|
10758
9680
|
return visitor.visitComment(this, context);
|
|
10759
9681
|
}
|
|
10760
9682
|
}
|
|
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
|
-
}
|
|
10794
9683
|
function visitAll(visitor, nodes, context = null) {
|
|
10795
9684
|
const result = [];
|
|
10796
9685
|
const visit = visitor.visit ?
|
|
@@ -10805,6 +9694,41 @@ function visitAll(visitor, nodes, context = null) {
|
|
|
10805
9694
|
return result;
|
|
10806
9695
|
}
|
|
10807
9696
|
|
|
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
|
+
|
|
10808
9732
|
class ElementSchemaRegistry {
|
|
10809
9733
|
}
|
|
10810
9734
|
|
|
@@ -13476,9 +12400,8 @@ const NAMED_ENTITIES = {
|
|
|
13476
12400
|
'zwj': '\u200D',
|
|
13477
12401
|
'zwnj': '\u200C'
|
|
13478
12402
|
};
|
|
13479
|
-
// The &ngsp; pseudo-entity is denoting a space.
|
|
13480
|
-
//
|
|
13481
|
-
// This is inspired by the Angular Dart implementation.
|
|
12403
|
+
// The &ngsp; pseudo-entity is denoting a space. see:
|
|
12404
|
+
// https://github.com/dart-lang/angular/blob/0bb611387d29d65b5af7f9d2515ab571fd3fbee4/_tests/test/compiler/preserve_whitespace_test.dart
|
|
13482
12405
|
const NGSP_UNICODE = '\uE500';
|
|
13483
12406
|
NAMED_ENTITIES['ngsp'] = NGSP_UNICODE;
|
|
13484
12407
|
|
|
@@ -13545,8 +12468,8 @@ class _Tokenizer {
|
|
|
13545
12468
|
this._cursor = options.escapedString ? new EscapedCharacterCursor(_file, range) :
|
|
13546
12469
|
new PlainCharacterCursor(_file, range);
|
|
13547
12470
|
this._preserveLineEndings = options.preserveLineEndings || false;
|
|
12471
|
+
this._escapedString = options.escapedString || false;
|
|
13548
12472
|
this._i18nNormalizeLineEndingsInICUs = options.i18nNormalizeLineEndingsInICUs || false;
|
|
13549
|
-
this._tokenizeBlocks = options.tokenizeBlocks || false;
|
|
13550
12473
|
try {
|
|
13551
12474
|
this._cursor.init();
|
|
13552
12475
|
}
|
|
@@ -13581,102 +12504,24 @@ class _Tokenizer {
|
|
|
13581
12504
|
}
|
|
13582
12505
|
}
|
|
13583
12506
|
else if (this._attemptCharCode($SLASH)) {
|
|
13584
|
-
this._consumeTagClose(start);
|
|
13585
|
-
}
|
|
13586
|
-
else {
|
|
13587
|
-
this._consumeTagOpen(start);
|
|
13588
|
-
}
|
|
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
|
-
}
|
|
13599
|
-
else if (!(this._tokenizeIcu && this._tokenizeExpansionForm())) {
|
|
13600
|
-
// In (possibly interpolated) text the end of the text is given by `isTextEnd()`, while
|
|
13601
|
-
// the premature end of an interpolation is given by the start of a new HTML element.
|
|
13602
|
-
this._consumeWithInterpolation(5 /* TokenType.TEXT */, 8 /* TokenType.INTERPOLATION */, () => this._isTextEnd(), () => this._isTagStart());
|
|
13603
|
-
}
|
|
13604
|
-
}
|
|
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;
|
|
12507
|
+
this._consumeTagClose(start);
|
|
13669
12508
|
}
|
|
13670
|
-
else
|
|
13671
|
-
|
|
12509
|
+
else {
|
|
12510
|
+
this._consumeTagOpen(start);
|
|
13672
12511
|
}
|
|
13673
12512
|
}
|
|
13674
|
-
this.
|
|
12513
|
+
else if (!(this._tokenizeIcu && this._tokenizeExpansionForm())) {
|
|
12514
|
+
// In (possibly interpolated) text the end of the text is given by `isTextEnd()`, while
|
|
12515
|
+
// the premature end of an interpolation is given by the start of a new HTML element.
|
|
12516
|
+
this._consumeWithInterpolation(5 /* TokenType.TEXT */, 8 /* TokenType.INTERPOLATION */, () => this._isTextEnd(), () => this._isTagStart());
|
|
12517
|
+
}
|
|
12518
|
+
}
|
|
12519
|
+
catch (e) {
|
|
12520
|
+
this.handleError(e);
|
|
13675
12521
|
}
|
|
13676
|
-
this._endToken([this._cursor.getChars(start)]);
|
|
13677
|
-
// Skip to the next parameter.
|
|
13678
|
-
this._attemptCharCodeUntilFn(isBlockParameterChar);
|
|
13679
12522
|
}
|
|
12523
|
+
this._beginToken(24 /* TokenType.EOF */);
|
|
12524
|
+
this._endToken([]);
|
|
13680
12525
|
}
|
|
13681
12526
|
/**
|
|
13682
12527
|
* @returns whether an ICU token has been created
|
|
@@ -14199,7 +13044,7 @@ class _Tokenizer {
|
|
|
14199
13044
|
return this._processCarriageReturns(end.getChars(start));
|
|
14200
13045
|
}
|
|
14201
13046
|
_isTextEnd() {
|
|
14202
|
-
if (this._isTagStart() || this.
|
|
13047
|
+
if (this._isTagStart() || this._cursor.peek() === $EOF) {
|
|
14203
13048
|
return true;
|
|
14204
13049
|
}
|
|
14205
13050
|
if (this._tokenizeIcu && !this._inInterpolation) {
|
|
@@ -14232,23 +13077,6 @@ class _Tokenizer {
|
|
|
14232
13077
|
}
|
|
14233
13078
|
return false;
|
|
14234
13079
|
}
|
|
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
|
-
}
|
|
14252
13080
|
_readUntil(char) {
|
|
14253
13081
|
const start = this._cursor.clone();
|
|
14254
13082
|
this._attemptUntilChar(char);
|
|
@@ -14304,12 +13132,6 @@ function compareCharCodeCaseInsensitive(code1, code2) {
|
|
|
14304
13132
|
function toUpperCaseCharCode(code) {
|
|
14305
13133
|
return code >= $a && code <= $z ? code - $a + $A : code;
|
|
14306
13134
|
}
|
|
14307
|
-
function isBlockNameChar(code) {
|
|
14308
|
-
return isAsciiLetter(code) || isDigit(code) || code === $_;
|
|
14309
|
-
}
|
|
14310
|
-
function isBlockParameterChar(code) {
|
|
14311
|
-
return code !== $SEMICOLON && isNotWhitespace(code);
|
|
14312
|
-
}
|
|
14313
13135
|
function mergeTextTokens(srcTokens) {
|
|
14314
13136
|
const dstTokens = [];
|
|
14315
13137
|
let lastDstToken = undefined;
|
|
@@ -14597,7 +13419,7 @@ class _TreeBuilder {
|
|
|
14597
13419
|
this.tokens = tokens;
|
|
14598
13420
|
this.getTagDefinition = getTagDefinition;
|
|
14599
13421
|
this._index = -1;
|
|
14600
|
-
this.
|
|
13422
|
+
this._elementStack = [];
|
|
14601
13423
|
this.rootNodes = [];
|
|
14602
13424
|
this.errors = [];
|
|
14603
13425
|
this._advance();
|
|
@@ -14627,18 +13449,6 @@ class _TreeBuilder {
|
|
|
14627
13449
|
else if (this._peek.type === 19 /* TokenType.EXPANSION_FORM_START */) {
|
|
14628
13450
|
this._consumeExpansion(this._advance());
|
|
14629
13451
|
}
|
|
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
|
-
}
|
|
14642
13452
|
else {
|
|
14643
13453
|
// Skip all other tokens...
|
|
14644
13454
|
this._advance();
|
|
@@ -14666,12 +13476,9 @@ class _TreeBuilder {
|
|
|
14666
13476
|
}
|
|
14667
13477
|
_consumeComment(token) {
|
|
14668
13478
|
const text = this._advanceIf(7 /* TokenType.RAW_TEXT */);
|
|
14669
|
-
|
|
13479
|
+
this._advanceIf(11 /* TokenType.COMMENT_END */);
|
|
14670
13480
|
const value = text != null ? text.parts[0].trim() : null;
|
|
14671
|
-
|
|
14672
|
-
token.sourceSpan :
|
|
14673
|
-
new ParseSourceSpan(token.sourceSpan.start, endToken.sourceSpan.end, token.sourceSpan.fullStart);
|
|
14674
|
-
this._addToParent(new Comment(value, sourceSpan));
|
|
13481
|
+
this._addToParent(new Comment(value, token.sourceSpan));
|
|
14675
13482
|
}
|
|
14676
13483
|
_consumeExpansion(token) {
|
|
14677
13484
|
const switchValue = this._advance();
|
|
@@ -14758,12 +13565,7 @@ class _TreeBuilder {
|
|
|
14758
13565
|
const startSpan = token.sourceSpan;
|
|
14759
13566
|
let text = token.parts[0];
|
|
14760
13567
|
if (text.length > 0 && text[0] === '\n') {
|
|
14761
|
-
const parent = this.
|
|
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
|
-
}
|
|
13568
|
+
const parent = this._getParentElement();
|
|
14767
13569
|
if (parent != null && parent.children.length === 0 &&
|
|
14768
13570
|
this.getTagDefinition(parent.name).ignoreFirstLf) {
|
|
14769
13571
|
text = text.substring(1);
|
|
@@ -14794,9 +13596,9 @@ class _TreeBuilder {
|
|
|
14794
13596
|
}
|
|
14795
13597
|
}
|
|
14796
13598
|
_closeVoidElement() {
|
|
14797
|
-
const el = this.
|
|
14798
|
-
if (el
|
|
14799
|
-
this.
|
|
13599
|
+
const el = this._getParentElement();
|
|
13600
|
+
if (el && this.getTagDefinition(el.name).isVoid) {
|
|
13601
|
+
this._elementStack.pop();
|
|
14800
13602
|
}
|
|
14801
13603
|
}
|
|
14802
13604
|
_consumeStartTag(startTagToken) {
|
|
@@ -14805,7 +13607,7 @@ class _TreeBuilder {
|
|
|
14805
13607
|
while (this._peek.type === 14 /* TokenType.ATTR_NAME */) {
|
|
14806
13608
|
attrs.push(this._consumeAttr(this._advance()));
|
|
14807
13609
|
}
|
|
14808
|
-
const fullName = this._getElementFullName(prefix, name, this.
|
|
13610
|
+
const fullName = this._getElementFullName(prefix, name, this._getParentElement());
|
|
14809
13611
|
let selfClosing = false;
|
|
14810
13612
|
// Note: There could have been a tokenizer error
|
|
14811
13613
|
// so that we don't get a token for the end tag...
|
|
@@ -14826,34 +13628,33 @@ class _TreeBuilder {
|
|
|
14826
13628
|
// Create a separate `startSpan` because `span` will be modified when there is an `end` span.
|
|
14827
13629
|
const startSpan = new ParseSourceSpan(startTagToken.sourceSpan.start, end, startTagToken.sourceSpan.fullStart);
|
|
14828
13630
|
const el = new Element(fullName, attrs, [], span, startSpan, undefined);
|
|
14829
|
-
|
|
14830
|
-
this._pushContainer(el, parentEl instanceof Element &&
|
|
14831
|
-
this.getTagDefinition(parentEl.name).isClosedByChild(el.name));
|
|
13631
|
+
this._pushElement(el);
|
|
14832
13632
|
if (selfClosing) {
|
|
14833
13633
|
// Elements that are self-closed have their `endSourceSpan` set to the full span, as the
|
|
14834
13634
|
// element start tag also represents the end tag.
|
|
14835
|
-
this.
|
|
13635
|
+
this._popElement(fullName, span);
|
|
14836
13636
|
}
|
|
14837
13637
|
else if (startTagToken.type === 4 /* TokenType.INCOMPLETE_TAG_OPEN */) {
|
|
14838
13638
|
// We already know the opening tag is not complete, so it is unlikely it has a corresponding
|
|
14839
13639
|
// close tag. Let's optimistically parse it as a full element and emit an error.
|
|
14840
|
-
this.
|
|
13640
|
+
this._popElement(fullName, null);
|
|
14841
13641
|
this.errors.push(TreeError.create(fullName, span, `Opening tag "${fullName}" not terminated.`));
|
|
14842
13642
|
}
|
|
14843
13643
|
}
|
|
14844
|
-
|
|
14845
|
-
|
|
14846
|
-
|
|
13644
|
+
_pushElement(el) {
|
|
13645
|
+
const parentEl = this._getParentElement();
|
|
13646
|
+
if (parentEl && this.getTagDefinition(parentEl.name).isClosedByChild(el.name)) {
|
|
13647
|
+
this._elementStack.pop();
|
|
14847
13648
|
}
|
|
14848
|
-
this._addToParent(
|
|
14849
|
-
this.
|
|
13649
|
+
this._addToParent(el);
|
|
13650
|
+
this._elementStack.push(el);
|
|
14850
13651
|
}
|
|
14851
13652
|
_consumeEndTag(endTagToken) {
|
|
14852
|
-
const fullName = this._getElementFullName(endTagToken.parts[0], endTagToken.parts[1], this.
|
|
13653
|
+
const fullName = this._getElementFullName(endTagToken.parts[0], endTagToken.parts[1], this._getParentElement());
|
|
14853
13654
|
if (this.getTagDefinition(fullName).isVoid) {
|
|
14854
13655
|
this.errors.push(TreeError.create(fullName, endTagToken.sourceSpan, `Void elements do not have end tags "${endTagToken.parts[1]}"`));
|
|
14855
13656
|
}
|
|
14856
|
-
else if (!this.
|
|
13657
|
+
else if (!this._popElement(fullName, endTagToken.sourceSpan)) {
|
|
14857
13658
|
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`;
|
|
14858
13659
|
this.errors.push(TreeError.create(fullName, endTagToken.sourceSpan, errMsg));
|
|
14859
13660
|
}
|
|
@@ -14864,23 +13665,20 @@ class _TreeBuilder {
|
|
|
14864
13665
|
* not have a closing tag (for example, this happens when an incomplete
|
|
14865
13666
|
* opening tag is recovered).
|
|
14866
13667
|
*/
|
|
14867
|
-
|
|
13668
|
+
_popElement(fullName, endSourceSpan) {
|
|
14868
13669
|
let unexpectedCloseTagDetected = false;
|
|
14869
|
-
for (let stackIndex = this.
|
|
14870
|
-
const
|
|
14871
|
-
|
|
14872
|
-
if (name === fullName && node instanceof expectedType) {
|
|
13670
|
+
for (let stackIndex = this._elementStack.length - 1; stackIndex >= 0; stackIndex--) {
|
|
13671
|
+
const el = this._elementStack[stackIndex];
|
|
13672
|
+
if (el.name === fullName) {
|
|
14873
13673
|
// Record the parse span with the element that is being closed. Any elements that are
|
|
14874
13674
|
// removed from the element stack at this point are closed implicitly, so they won't get
|
|
14875
13675
|
// an end source span (as there is no explicit closing element).
|
|
14876
|
-
|
|
14877
|
-
|
|
14878
|
-
this.
|
|
13676
|
+
el.endSourceSpan = endSourceSpan;
|
|
13677
|
+
el.sourceSpan.end = endSourceSpan !== null ? endSourceSpan.end : el.sourceSpan.end;
|
|
13678
|
+
this._elementStack.splice(stackIndex, this._elementStack.length - stackIndex);
|
|
14879
13679
|
return !unexpectedCloseTagDetected;
|
|
14880
13680
|
}
|
|
14881
|
-
|
|
14882
|
-
if (node instanceof BlockGroup ||
|
|
14883
|
-
node instanceof Element && !this.getTagDefinition(node.name).closedByParent) {
|
|
13681
|
+
if (!this.getTagDefinition(el.name).closedByParent) {
|
|
14884
13682
|
// Note that we encountered an unexpected close tag but continue processing the element
|
|
14885
13683
|
// stack so we can assign an `endSourceSpan` if there is a corresponding start tag for this
|
|
14886
13684
|
// end tag in the stack.
|
|
@@ -14939,92 +13737,16 @@ class _TreeBuilder {
|
|
|
14939
13737
|
new ParseSourceSpan(valueStartSpan.start, valueEnd, valueStartSpan.fullStart);
|
|
14940
13738
|
return new Attribute(fullName, value, new ParseSourceSpan(attrName.sourceSpan.start, attrEnd, attrName.sourceSpan.fullStart), attrName.sourceSpan, valueSpan, valueTokens.length > 0 ? valueTokens : undefined, undefined);
|
|
14941
13739
|
}
|
|
14942
|
-
|
|
14943
|
-
|
|
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;
|
|
13740
|
+
_getParentElement() {
|
|
13741
|
+
return this._elementStack.length > 0 ? this._elementStack[this._elementStack.length - 1] : null;
|
|
15015
13742
|
}
|
|
15016
13743
|
_addToParent(node) {
|
|
15017
|
-
const parent = this.
|
|
15018
|
-
if (parent
|
|
15019
|
-
|
|
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.'));
|
|
13744
|
+
const parent = this._getParentElement();
|
|
13745
|
+
if (parent != null) {
|
|
13746
|
+
parent.children.push(node);
|
|
15025
13747
|
}
|
|
15026
13748
|
else {
|
|
15027
|
-
|
|
13749
|
+
this.rootNodes.push(node);
|
|
15028
13750
|
}
|
|
15029
13751
|
}
|
|
15030
13752
|
_getElementFullName(prefix, localName, parentElement) {
|
|
@@ -15082,9 +13804,10 @@ function hasPreserveWhitespacesAttr(attrs) {
|
|
|
15082
13804
|
return attrs.some((attr) => attr.name === PRESERVE_WS_ATTR_NAME);
|
|
15083
13805
|
}
|
|
15084
13806
|
/**
|
|
15085
|
-
* &ngsp;
|
|
15086
|
-
*
|
|
15087
|
-
*
|
|
13807
|
+
* Angular Dart introduced &ngsp; as a placeholder for non-removable space, see:
|
|
13808
|
+
* https://github.com/dart-lang/angular/blob/0bb611387d29d65b5af7f9d2515ab571fd3fbee4/_tests/test/compiler/preserve_whitespace_test.dart#L25-L32
|
|
13809
|
+
* In Angular Dart &ngsp; is converted to the 0xE500 PUA (Private Use Areas) unicode character
|
|
13810
|
+
* and later on replaced by a space. We are re-implementing the same idea here.
|
|
15088
13811
|
*/
|
|
15089
13812
|
function replaceNgsp(value) {
|
|
15090
13813
|
// lexer is replacing the &ngsp; pseudo-entity with NGSP_UNICODE
|
|
@@ -15138,15 +13861,6 @@ class WhitespaceVisitor {
|
|
|
15138
13861
|
visitExpansionCase(expansionCase, context) {
|
|
15139
13862
|
return expansionCase;
|
|
15140
13863
|
}
|
|
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
|
-
}
|
|
15150
13864
|
}
|
|
15151
13865
|
function createWhitespaceProcessedTextToken({ type, parts, sourceSpan }) {
|
|
15152
13866
|
return { type, parts: [processWhitespace(parts[0])], sourceSpan };
|
|
@@ -15404,7 +14118,7 @@ class BindingParser {
|
|
|
15404
14118
|
this._parseAnimation(name, expression, sourceSpan, absoluteOffset, keySpan, valueSpan, targetMatchableAttrs, targetProps);
|
|
15405
14119
|
}
|
|
15406
14120
|
else {
|
|
15407
|
-
this._parsePropertyAst(name, this.
|
|
14121
|
+
this._parsePropertyAst(name, this._parseBinding(expression, isHost, valueSpan || sourceSpan, absoluteOffset), sourceSpan, keySpan, valueSpan, targetMatchableAttrs, targetProps);
|
|
15408
14122
|
}
|
|
15409
14123
|
}
|
|
15410
14124
|
parsePropertyInterpolation(name, value, sourceSpan, valueSpan, targetMatchableAttrs, targetProps, keySpan, interpolatedTokens) {
|
|
@@ -15426,11 +14140,11 @@ class BindingParser {
|
|
|
15426
14140
|
// This will occur when a @trigger is not paired with an expression.
|
|
15427
14141
|
// For animations it is valid to not have an expression since */void
|
|
15428
14142
|
// states will be applied by angular when the element is attached/detached
|
|
15429
|
-
const ast = this.
|
|
14143
|
+
const ast = this._parseBinding(expression || 'undefined', false, valueSpan || sourceSpan, absoluteOffset);
|
|
15430
14144
|
targetMatchableAttrs.push([name, ast.source]);
|
|
15431
14145
|
targetProps.push(new ParsedProperty(name, ast, ParsedPropertyType.ANIMATION, sourceSpan, keySpan, valueSpan));
|
|
15432
14146
|
}
|
|
15433
|
-
|
|
14147
|
+
_parseBinding(value, isHostBinding, sourceSpan, absoluteOffset) {
|
|
15434
14148
|
const sourceInfo = (sourceSpan && sourceSpan.start || '(unknown)').toString();
|
|
15435
14149
|
try {
|
|
15436
14150
|
const ast = isHostBinding ?
|
|
@@ -15549,7 +14263,7 @@ class BindingParser {
|
|
|
15549
14263
|
if (ast) {
|
|
15550
14264
|
this._reportExpressionParserErrors(ast.errors, sourceSpan);
|
|
15551
14265
|
}
|
|
15552
|
-
if (!ast || ast.ast instanceof EmptyExpr
|
|
14266
|
+
if (!ast || ast.ast instanceof EmptyExpr) {
|
|
15553
14267
|
this._reportError(`Empty expressions are not allowed`, sourceSpan);
|
|
15554
14268
|
return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo, absoluteOffset);
|
|
15555
14269
|
}
|
|
@@ -15695,415 +14409,6 @@ function normalizeNgContentSelect(selectAttr) {
|
|
|
15695
14409
|
return selectAttr;
|
|
15696
14410
|
}
|
|
15697
14411
|
|
|
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
|
-
|
|
16107
14412
|
const BIND_NAME_REGEXP = /^(?:(bind-)|(let-)|(ref-|#)|(on-)|(bindon-)|(@))(.*)$/;
|
|
16108
14413
|
// Group 1 = "bind-"
|
|
16109
14414
|
const KW_BIND_IDX = 1;
|
|
@@ -16227,16 +14532,7 @@ class HtmlAstToIvyAst {
|
|
|
16227
14532
|
attributes.push(this.visitAttribute(attribute));
|
|
16228
14533
|
}
|
|
16229
14534
|
}
|
|
16230
|
-
|
|
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
|
-
}
|
|
14535
|
+
const children = visitAll(preparsedElement.nonBindable ? NON_BINDABLE_VISITOR : this, element.children);
|
|
16240
14536
|
let parsedElement;
|
|
16241
14537
|
if (preparsedElement.type === PreparsedElementType.NG_CONTENT) {
|
|
16242
14538
|
// `<ng-content>`
|
|
@@ -16334,23 +14630,6 @@ class HtmlAstToIvyAst {
|
|
|
16334
14630
|
}
|
|
16335
14631
|
return null;
|
|
16336
14632
|
}
|
|
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) { }
|
|
16354
14633
|
// convert view engine `ParsedProperty` to a format suitable for IVY
|
|
16355
14634
|
extractAttributes(elementName, properties, i18nPropsMeta) {
|
|
16356
14635
|
const bound = [];
|
|
@@ -16528,25 +14807,6 @@ class NonBindableVisitor {
|
|
|
16528
14807
|
visitExpansionCase(expansionCase) {
|
|
16529
14808
|
return null;
|
|
16530
14809
|
}
|
|
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
|
-
}
|
|
16550
14810
|
}
|
|
16551
14811
|
const NON_BINDABLE_VISITOR = new NonBindableVisitor();
|
|
16552
14812
|
function normalizeAttributeName(attrName) {
|
|
@@ -16994,17 +15254,6 @@ class _I18nVisitor {
|
|
|
16994
15254
|
visitExpansionCase(_icuCase, _context) {
|
|
16995
15255
|
throw new Error('Unreachable code');
|
|
16996
15256
|
}
|
|
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) { }
|
|
17008
15257
|
/**
|
|
17009
15258
|
* Convert, text and interpolated tokens up into text and placeholder pieces.
|
|
17010
15259
|
*
|
|
@@ -17148,11 +15397,12 @@ class I18nMetaVisitor {
|
|
|
17148
15397
|
// whether visited nodes contain i18n information
|
|
17149
15398
|
this.hasI18nMeta = false;
|
|
17150
15399
|
this._errors = [];
|
|
15400
|
+
// i18n message generation factory
|
|
15401
|
+
this._createI18nMessage = createI18nMessageFactory(this.interpolationConfig);
|
|
17151
15402
|
}
|
|
17152
15403
|
_generateI18nMessage(nodes, meta = '', visitNodeFn) {
|
|
17153
15404
|
const { meaning, description, customId } = this._parseMetadata(meta);
|
|
17154
|
-
const
|
|
17155
|
-
const message = createI18nMessage(nodes, meaning, description, customId, visitNodeFn);
|
|
15405
|
+
const message = this._createI18nMessage(nodes, meaning, description, customId, visitNodeFn);
|
|
17156
15406
|
this._setMessageId(message, meta);
|
|
17157
15407
|
this._setLegacyIds(message, meta);
|
|
17158
15408
|
return message;
|
|
@@ -17251,17 +15501,6 @@ class I18nMetaVisitor {
|
|
|
17251
15501
|
visitExpansionCase(expansionCase) {
|
|
17252
15502
|
return expansionCase;
|
|
17253
15503
|
}
|
|
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
|
-
}
|
|
17265
15504
|
/**
|
|
17266
15505
|
* Parse the general form `meta` passed into extract the explicit metadata needed to create a
|
|
17267
15506
|
* `Message`.
|
|
@@ -17643,7 +15882,7 @@ function createComponentDefConsts() {
|
|
|
17643
15882
|
};
|
|
17644
15883
|
}
|
|
17645
15884
|
class TemplateDefinitionBuilder {
|
|
17646
|
-
constructor(constantPool, parentBindingScope, level = 0, contextName, i18nContext, templateIndex, templateName, _namespace, relativeContextFilePath, i18nUseExternalIds,
|
|
15885
|
+
constructor(constantPool, parentBindingScope, level = 0, contextName, i18nContext, templateIndex, templateName, _namespace, relativeContextFilePath, i18nUseExternalIds, _constants = createComponentDefConsts()) {
|
|
17647
15886
|
this.constantPool = constantPool;
|
|
17648
15887
|
this.level = level;
|
|
17649
15888
|
this.contextName = contextName;
|
|
@@ -17652,7 +15891,6 @@ class TemplateDefinitionBuilder {
|
|
|
17652
15891
|
this.templateName = templateName;
|
|
17653
15892
|
this._namespace = _namespace;
|
|
17654
15893
|
this.i18nUseExternalIds = i18nUseExternalIds;
|
|
17655
|
-
this.deferBlocks = deferBlocks;
|
|
17656
15894
|
this._constants = _constants;
|
|
17657
15895
|
this._dataIndex = 0;
|
|
17658
15896
|
this._bindingContext = 0;
|
|
@@ -17855,7 +16093,7 @@ class TemplateDefinitionBuilder {
|
|
|
17855
16093
|
else {
|
|
17856
16094
|
const value = prop.value.visit(this._valueConverter);
|
|
17857
16095
|
this.allocateBindingSlots(value);
|
|
17858
|
-
if (value instanceof Interpolation
|
|
16096
|
+
if (value instanceof Interpolation) {
|
|
17859
16097
|
const { strings, expressions } = value;
|
|
17860
16098
|
const { id, bindings } = this.i18n;
|
|
17861
16099
|
const label = assembleI18nBoundString(strings, bindings.size, id);
|
|
@@ -17975,7 +16213,7 @@ class TemplateDefinitionBuilder {
|
|
|
17975
16213
|
const message = attr.i18n;
|
|
17976
16214
|
const converted = attr.value.visit(this._valueConverter);
|
|
17977
16215
|
this.allocateBindingSlots(converted);
|
|
17978
|
-
if (converted instanceof Interpolation
|
|
16216
|
+
if (converted instanceof Interpolation) {
|
|
17979
16217
|
const placeholders = assembleBoundTextPlaceholders(message);
|
|
17980
16218
|
const params = placeholdersToParams(placeholders);
|
|
17981
16219
|
i18nAttrArgs.push(literal(attr.name), this.i18nTranslate(message, params));
|
|
@@ -18195,7 +16433,7 @@ class TemplateDefinitionBuilder {
|
|
|
18195
16433
|
}
|
|
18196
16434
|
this.allocateBindingSlots(value);
|
|
18197
16435
|
if (inputType === 0 /* BindingType.Property */) {
|
|
18198
|
-
if (value instanceof Interpolation
|
|
16436
|
+
if (value instanceof Interpolation) {
|
|
18199
16437
|
// prop="{{value}}" and friends
|
|
18200
16438
|
this.interpolatedUpdateInstruction(getPropertyInterpolationExpression(value), elementIndex, attrName, input, value, params);
|
|
18201
16439
|
}
|
|
@@ -18209,12 +16447,12 @@ class TemplateDefinitionBuilder {
|
|
|
18209
16447
|
}
|
|
18210
16448
|
}
|
|
18211
16449
|
else if (inputType === 1 /* BindingType.Attribute */) {
|
|
18212
|
-
if (value instanceof Interpolation
|
|
16450
|
+
if (value instanceof Interpolation && getInterpolationArgsLength(value) > 1) {
|
|
18213
16451
|
// attr.name="text{{value}}" and friends
|
|
18214
16452
|
this.interpolatedUpdateInstruction(getAttributeInterpolationExpression(value), elementIndex, attrName, input, value, params);
|
|
18215
16453
|
}
|
|
18216
16454
|
else {
|
|
18217
|
-
const boundValue = value instanceof Interpolation
|
|
16455
|
+
const boundValue = value instanceof Interpolation ? value.expressions[0] : value;
|
|
18218
16456
|
// [attr.name]="value" or attr.name="{{value}}"
|
|
18219
16457
|
// Collect the attribute bindings so that they can be chained at the end.
|
|
18220
16458
|
attributeBindings.push({
|
|
@@ -18284,7 +16522,7 @@ class TemplateDefinitionBuilder {
|
|
|
18284
16522
|
parameters.push(importExpr(Identifiers.templateRefExtractor));
|
|
18285
16523
|
}
|
|
18286
16524
|
// Create the template function
|
|
18287
|
-
const templateVisitor = new TemplateDefinitionBuilder(this.constantPool, this._bindingScope, this.level + 1, contextName, this.i18n, templateIndex, templateName, this._namespace, this.fileBasedI18nSuffix, this.i18nUseExternalIds, this.
|
|
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);
|
|
18288
16526
|
// Nested templates must not be visited until after their parent templates have completed
|
|
18289
16527
|
// processing, so they are queued here until after the initial pass. Otherwise, we wouldn't
|
|
18290
16528
|
// be able to support bindings in nested templates to local refs that occur after the
|
|
@@ -18327,7 +16565,7 @@ class TemplateDefinitionBuilder {
|
|
|
18327
16565
|
if (this.i18n) {
|
|
18328
16566
|
const value = text.value.visit(this._valueConverter);
|
|
18329
16567
|
this.allocateBindingSlots(value);
|
|
18330
|
-
if (value instanceof Interpolation
|
|
16568
|
+
if (value instanceof Interpolation) {
|
|
18331
16569
|
this.i18n.appendBoundText(text.i18n);
|
|
18332
16570
|
this.i18nAppendBindings(value.expressions);
|
|
18333
16571
|
}
|
|
@@ -18337,7 +16575,7 @@ class TemplateDefinitionBuilder {
|
|
|
18337
16575
|
this.creationInstruction(text.sourceSpan, Identifiers.text, [literal(nodeIndex)]);
|
|
18338
16576
|
const value = text.value.visit(this._valueConverter);
|
|
18339
16577
|
this.allocateBindingSlots(value);
|
|
18340
|
-
if (value instanceof Interpolation
|
|
16578
|
+
if (value instanceof Interpolation) {
|
|
18341
16579
|
this.updateInstructionWithAdvance(nodeIndex, text.sourceSpan, getTextInterpolationExpression(value), () => this.getUpdateInstructionArguments(value));
|
|
18342
16580
|
}
|
|
18343
16581
|
else {
|
|
@@ -18394,47 +16632,6 @@ class TemplateDefinitionBuilder {
|
|
|
18394
16632
|
}
|
|
18395
16633
|
return null;
|
|
18396
16634
|
}
|
|
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) { }
|
|
18438
16635
|
allocateDataSlot() {
|
|
18439
16636
|
return this._dataIndex++;
|
|
18440
16637
|
}
|
|
@@ -18466,7 +16663,7 @@ class TemplateDefinitionBuilder {
|
|
|
18466
16663
|
continue;
|
|
18467
16664
|
}
|
|
18468
16665
|
this.allocateBindingSlots(value);
|
|
18469
|
-
if (value instanceof Interpolation
|
|
16666
|
+
if (value instanceof Interpolation) {
|
|
18470
16667
|
// Params typically contain attribute namespace and value sanitizer, which is applicable
|
|
18471
16668
|
// for regular HTML elements, but not applicable for <ng-template> (since props act as
|
|
18472
16669
|
// inputs to directives), so keep params array empty.
|
|
@@ -18498,7 +16695,7 @@ class TemplateDefinitionBuilder {
|
|
|
18498
16695
|
if (instruction) {
|
|
18499
16696
|
for (const call of instruction.calls) {
|
|
18500
16697
|
allocateBindingSlots += call.allocateBindingSlots;
|
|
18501
|
-
this.updateInstructionWithAdvance(elementIndex, call.sourceSpan, instruction.reference, () => call.params(value => (call.supportsInterpolation && value instanceof Interpolation
|
|
16698
|
+
this.updateInstructionWithAdvance(elementIndex, call.sourceSpan, instruction.reference, () => call.params(value => (call.supportsInterpolation && value instanceof Interpolation) ?
|
|
18502
16699
|
this.getUpdateInstructionArguments(value) :
|
|
18503
16700
|
this.convertPropertyBinding(value)));
|
|
18504
16701
|
}
|
|
@@ -18531,7 +16728,7 @@ class TemplateDefinitionBuilder {
|
|
|
18531
16728
|
return originalSlots;
|
|
18532
16729
|
}
|
|
18533
16730
|
allocateBindingSlots(value) {
|
|
18534
|
-
this._bindingSlots += value instanceof Interpolation
|
|
16731
|
+
this._bindingSlots += value instanceof Interpolation ? value.expressions.length : 1;
|
|
18535
16732
|
}
|
|
18536
16733
|
/**
|
|
18537
16734
|
* Gets an expression that refers to the implicit receiver. The implicit
|
|
@@ -19153,12 +17350,7 @@ function parseTemplate(template, templateUrl, options = {}) {
|
|
|
19153
17350
|
const { interpolationConfig, preserveWhitespaces, enableI18nLegacyMessageIdFormat } = options;
|
|
19154
17351
|
const bindingParser = makeBindingParser(interpolationConfig);
|
|
19155
17352
|
const htmlParser = new HtmlParser();
|
|
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
|
-
});
|
|
17353
|
+
const parseResult = htmlParser.parse(template, templateUrl, { leadingTriviaChars: LEADING_TRIVIA_CHARS, ...options, tokenizeExpansionForms: true });
|
|
19162
17354
|
if (!options.alwaysAttemptHtmlToR3AstConversion && parseResult.errors &&
|
|
19163
17355
|
parseResult.errors.length > 0) {
|
|
19164
17356
|
const parsedTemplate = {
|
|
@@ -19209,10 +17401,7 @@ function parseTemplate(template, templateUrl, options = {}) {
|
|
|
19209
17401
|
rootNodes = visitAll(new I18nMetaVisitor(interpolationConfig, /* keepI18nAttrs */ false), rootNodes);
|
|
19210
17402
|
}
|
|
19211
17403
|
}
|
|
19212
|
-
const { nodes, errors, styleUrls, styles, ngContentSelectors, commentNodes } = htmlAstToRender3Ast(rootNodes, bindingParser, {
|
|
19213
|
-
collectCommentNodes: !!options.collectCommentNodes,
|
|
19214
|
-
enabledBlockTypes: options.enabledBlockTypes || new Set(),
|
|
19215
|
-
});
|
|
17404
|
+
const { nodes, errors, styleUrls, styles, ngContentSelectors, commentNodes } = htmlAstToRender3Ast(rootNodes, bindingParser, { collectCommentNodes: !!options.collectCommentNodes });
|
|
19216
17405
|
errors.push(...parseResult.errors, ...i18nMetaResult.errors);
|
|
19217
17406
|
const parsedTemplate = {
|
|
19218
17407
|
interpolationConfig,
|
|
@@ -19359,7 +17548,7 @@ function baseDirectiveFields(meta, constantPool, bindingParser) {
|
|
|
19359
17548
|
const definitionMap = new DefinitionMap();
|
|
19360
17549
|
const selectors = parseSelectorToR3Selector(meta.selector);
|
|
19361
17550
|
// e.g. `type: MyDirective`
|
|
19362
|
-
definitionMap.set('type', meta.
|
|
17551
|
+
definitionMap.set('type', meta.internalType);
|
|
19363
17552
|
// e.g. `selectors: [['', 'someDir', '']]`
|
|
19364
17553
|
if (selectors.length > 0) {
|
|
19365
17554
|
definitionMap.set('selectors', asLiteral(selectors));
|
|
@@ -19374,18 +17563,15 @@ function baseDirectiveFields(meta, constantPool, bindingParser) {
|
|
|
19374
17563
|
// e.g. `hostBindings: (rf, ctx) => { ... }
|
|
19375
17564
|
definitionMap.set('hostBindings', createHostBindingsFunction(meta.host, meta.typeSourceSpan, bindingParser, constantPool, meta.selector || '', meta.name, definitionMap));
|
|
19376
17565
|
// e.g 'inputs: {a: 'a'}`
|
|
19377
|
-
definitionMap.set('inputs',
|
|
17566
|
+
definitionMap.set('inputs', conditionallyCreateMapObjectLiteral(meta.inputs, true));
|
|
19378
17567
|
// e.g 'outputs: {a: 'a'}`
|
|
19379
|
-
definitionMap.set('outputs',
|
|
17568
|
+
definitionMap.set('outputs', conditionallyCreateMapObjectLiteral(meta.outputs));
|
|
19380
17569
|
if (meta.exportAs !== null) {
|
|
19381
17570
|
definitionMap.set('exportAs', literalArr(meta.exportAs.map(e => literal(e))));
|
|
19382
17571
|
}
|
|
19383
17572
|
if (meta.isStandalone) {
|
|
19384
17573
|
definitionMap.set('standalone', literal(true));
|
|
19385
17574
|
}
|
|
19386
|
-
if (meta.isSignal) {
|
|
19387
|
-
definitionMap.set('signals', literal(true));
|
|
19388
|
-
}
|
|
19389
17575
|
return definitionMap;
|
|
19390
17576
|
}
|
|
19391
17577
|
/**
|
|
@@ -19396,7 +17582,6 @@ function addFeatures(definitionMap, meta) {
|
|
|
19396
17582
|
const features = [];
|
|
19397
17583
|
const providers = meta.providers;
|
|
19398
17584
|
const viewProviders = meta.viewProviders;
|
|
19399
|
-
const inputKeys = Object.keys(meta.inputs);
|
|
19400
17585
|
if (providers || viewProviders) {
|
|
19401
17586
|
const args = [providers || new LiteralArrayExpr([])];
|
|
19402
17587
|
if (viewProviders) {
|
|
@@ -19404,12 +17589,6 @@ function addFeatures(definitionMap, meta) {
|
|
|
19404
17589
|
}
|
|
19405
17590
|
features.push(importExpr(Identifiers.ProvidersFeature).callFn(args));
|
|
19406
17591
|
}
|
|
19407
|
-
for (const key of inputKeys) {
|
|
19408
|
-
if (meta.inputs[key].transformFunction !== null) {
|
|
19409
|
-
features.push(importExpr(Identifiers.InputTransformsFeatureFeature));
|
|
19410
|
-
break;
|
|
19411
|
-
}
|
|
19412
|
-
}
|
|
19413
17592
|
if (meta.usesInheritance) {
|
|
19414
17593
|
features.push(importExpr(Identifiers.InheritDefinitionFeature));
|
|
19415
17594
|
}
|
|
@@ -19461,43 +17640,34 @@ function compileComponentFromMetadata(meta, constantPool, bindingParser) {
|
|
|
19461
17640
|
const templateTypeName = meta.name;
|
|
19462
17641
|
const templateName = templateTypeName ? `${templateTypeName}_Template` : null;
|
|
19463
17642
|
const changeDetection = meta.changeDetection;
|
|
19464
|
-
|
|
19465
|
-
|
|
19466
|
-
|
|
19467
|
-
|
|
19468
|
-
|
|
19469
|
-
|
|
19470
|
-
|
|
19471
|
-
|
|
19472
|
-
|
|
19473
|
-
|
|
19474
|
-
|
|
19475
|
-
|
|
19476
|
-
|
|
19477
|
-
|
|
19478
|
-
|
|
19479
|
-
|
|
19480
|
-
|
|
19481
|
-
|
|
19482
|
-
|
|
19483
|
-
|
|
19484
|
-
|
|
19485
|
-
// -
|
|
19486
|
-
|
|
19487
|
-
|
|
19488
|
-
|
|
19489
|
-
|
|
19490
|
-
|
|
19491
|
-
|
|
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
|
-
}
|
|
17643
|
+
const template = meta.template;
|
|
17644
|
+
const templateBuilder = new TemplateDefinitionBuilder(constantPool, BindingScope.createRootScope(), 0, templateTypeName, null, null, templateName, Identifiers.namespaceHTML, meta.relativeContextFilePath, meta.i18nUseExternalIds);
|
|
17645
|
+
const templateFunctionExpression = templateBuilder.buildTemplateFunction(template.nodes, []);
|
|
17646
|
+
// We need to provide this so that dynamically generated components know what
|
|
17647
|
+
// projected content blocks to pass through to the component when it is instantiated.
|
|
17648
|
+
const ngContentSelectors = templateBuilder.getNgContentSelectors();
|
|
17649
|
+
if (ngContentSelectors) {
|
|
17650
|
+
definitionMap.set('ngContentSelectors', ngContentSelectors);
|
|
17651
|
+
}
|
|
17652
|
+
// e.g. `decls: 2`
|
|
17653
|
+
definitionMap.set('decls', literal(templateBuilder.getConstCount()));
|
|
17654
|
+
// e.g. `vars: 2`
|
|
17655
|
+
definitionMap.set('vars', literal(templateBuilder.getVarCount()));
|
|
17656
|
+
// Generate `consts` section of ComponentDef:
|
|
17657
|
+
// - either as an array:
|
|
17658
|
+
// `consts: [['one', 'two'], ['three', 'four']]`
|
|
17659
|
+
// - or as a factory function in case additional statements are present (to support i18n):
|
|
17660
|
+
// `consts: function() { var i18n_0; if (ngI18nClosureMode) {...} else {...} return [i18n_0]; }`
|
|
17661
|
+
const { constExpressions, prepareStatements } = templateBuilder.getConsts();
|
|
17662
|
+
if (constExpressions.length > 0) {
|
|
17663
|
+
let constsExpr = literalArr(constExpressions);
|
|
17664
|
+
// Prepare statements are present - turn `consts` into a function.
|
|
17665
|
+
if (prepareStatements.length > 0) {
|
|
17666
|
+
constsExpr = fn([], [...prepareStatements, new ReturnStatement(constsExpr)]);
|
|
17667
|
+
}
|
|
17668
|
+
definitionMap.set('consts', constsExpr);
|
|
17669
|
+
}
|
|
17670
|
+
definitionMap.set('template', templateFunctionExpression);
|
|
19501
17671
|
if (meta.declarations.length > 0) {
|
|
19502
17672
|
definitionMap.set('dependencies', compileDeclarationList(literalArr(meta.declarations.map(decl => decl.type)), meta.declarationListEmitMode));
|
|
19503
17673
|
}
|
|
@@ -19548,12 +17718,6 @@ function createComponentType(meta) {
|
|
|
19548
17718
|
typeParams.push(stringArrayAsType(meta.template.ngContentSelectors));
|
|
19549
17719
|
typeParams.push(expressionType(literal(meta.isStandalone)));
|
|
19550
17720
|
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
|
-
}
|
|
19557
17721
|
return expressionType(importExpr(Identifiers.ComponentDeclaration, typeParams));
|
|
19558
17722
|
}
|
|
19559
17723
|
/**
|
|
@@ -19652,24 +17816,11 @@ function createBaseDirectiveTypeParams(meta) {
|
|
|
19652
17816
|
typeWithParameters(meta.type.type, meta.typeArgumentCount),
|
|
19653
17817
|
selectorForType !== null ? stringAsType(selectorForType) : NONE_TYPE,
|
|
19654
17818
|
meta.exportAs !== null ? stringArrayAsType(meta.exportAs) : NONE_TYPE,
|
|
19655
|
-
expressionType(
|
|
17819
|
+
expressionType(stringMapAsLiteralExpression(meta.inputs)),
|
|
19656
17820
|
expressionType(stringMapAsLiteralExpression(meta.outputs)),
|
|
19657
17821
|
stringArrayAsType(meta.queries.map(q => q.propertyName)),
|
|
19658
17822
|
];
|
|
19659
17823
|
}
|
|
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
|
-
}
|
|
19673
17824
|
/**
|
|
19674
17825
|
* Creates the type specification from the directive meta. This type is inserted into .d.ts files
|
|
19675
17826
|
* to be consumed by upstream compilations.
|
|
@@ -19681,12 +17832,6 @@ function createDirectiveType(meta) {
|
|
|
19681
17832
|
typeParams.push(NONE_TYPE);
|
|
19682
17833
|
typeParams.push(expressionType(literal(meta.isStandalone)));
|
|
19683
17834
|
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
|
-
}
|
|
19690
17835
|
return expressionType(importExpr(Identifiers.DirectiveDeclaration, typeParams));
|
|
19691
17836
|
}
|
|
19692
17837
|
// Define and update any view queries
|
|
@@ -19715,9 +17860,6 @@ function createViewQueriesFunction(viewQueries, constantPool, name) {
|
|
|
19715
17860
|
}
|
|
19716
17861
|
// Return a host binding function or null if one is not necessary.
|
|
19717
17862
|
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);
|
|
19721
17863
|
const bindingContext = variable(CONTEXT_NAME);
|
|
19722
17864
|
const styleBuilder = new StylingBuilder(bindingContext);
|
|
19723
17865
|
const { styleAttr, classAttr } = hostBindingsMetadata.specialAttributes;
|
|
@@ -19731,10 +17873,13 @@ function createHostBindingsFunction(hostBindingsMetadata, typeSourceSpan, bindin
|
|
|
19731
17873
|
const updateInstructions = [];
|
|
19732
17874
|
const updateVariables = [];
|
|
19733
17875
|
const hostBindingSourceSpan = typeSourceSpan;
|
|
17876
|
+
// Calculate host event bindings
|
|
17877
|
+
const eventBindings = bindingParser.createDirectiveHostEventAsts(hostBindingsMetadata.listeners, hostBindingSourceSpan);
|
|
19734
17878
|
if (eventBindings && eventBindings.length) {
|
|
19735
17879
|
createInstructions.push(...createHostListeners(eventBindings, name));
|
|
19736
17880
|
}
|
|
19737
17881
|
// Calculate the host property bindings
|
|
17882
|
+
const bindings = bindingParser.createBoundHostProperties(hostBindingsMetadata.properties, hostBindingSourceSpan);
|
|
19738
17883
|
const allOtherBindings = [];
|
|
19739
17884
|
// We need to calculate the total amount of binding slots required by
|
|
19740
17885
|
// all the instructions together before any value conversions happen.
|
|
@@ -20077,7 +18222,6 @@ function createHostDirectivesMappingArray(mapping) {
|
|
|
20077
18222
|
class ResourceLoader {
|
|
20078
18223
|
}
|
|
20079
18224
|
|
|
20080
|
-
let enabledBlockTypes;
|
|
20081
18225
|
class CompilerFacadeImpl {
|
|
20082
18226
|
constructor(jitEvaluator = new JitEvaluator()) {
|
|
20083
18227
|
this.jitEvaluator = jitEvaluator;
|
|
@@ -20089,6 +18233,7 @@ class CompilerFacadeImpl {
|
|
|
20089
18233
|
const metadata = {
|
|
20090
18234
|
name: facade.name,
|
|
20091
18235
|
type: wrapReference(facade.type),
|
|
18236
|
+
internalType: new WrappedNodeExpr(facade.type),
|
|
20092
18237
|
typeArgumentCount: 0,
|
|
20093
18238
|
deps: null,
|
|
20094
18239
|
pipeName: facade.pipeName,
|
|
@@ -20107,6 +18252,7 @@ class CompilerFacadeImpl {
|
|
|
20107
18252
|
const { expression, statements } = compileInjectable({
|
|
20108
18253
|
name: facade.name,
|
|
20109
18254
|
type: wrapReference(facade.type),
|
|
18255
|
+
internalType: new WrappedNodeExpr(facade.type),
|
|
20110
18256
|
typeArgumentCount: facade.typeArgumentCount,
|
|
20111
18257
|
providedIn: computeProvidedIn(facade.providedIn),
|
|
20112
18258
|
useClass: convertToProviderExpression(facade, 'useClass'),
|
|
@@ -20122,6 +18268,7 @@ class CompilerFacadeImpl {
|
|
|
20122
18268
|
const { expression, statements } = compileInjectable({
|
|
20123
18269
|
name: facade.type.name,
|
|
20124
18270
|
type: wrapReference(facade.type),
|
|
18271
|
+
internalType: new WrappedNodeExpr(facade.type),
|
|
20125
18272
|
typeArgumentCount: 0,
|
|
20126
18273
|
providedIn: computeProvidedIn(facade.providedIn),
|
|
20127
18274
|
useClass: convertToProviderExpression(facade, 'useClass'),
|
|
@@ -20137,6 +18284,7 @@ class CompilerFacadeImpl {
|
|
|
20137
18284
|
const meta = {
|
|
20138
18285
|
name: facade.name,
|
|
20139
18286
|
type: wrapReference(facade.type),
|
|
18287
|
+
internalType: new WrappedNodeExpr(facade.type),
|
|
20140
18288
|
providers: facade.providers && facade.providers.length > 0 ?
|
|
20141
18289
|
new WrappedNodeExpr(facade.providers) :
|
|
20142
18290
|
null,
|
|
@@ -20152,8 +18300,9 @@ class CompilerFacadeImpl {
|
|
|
20152
18300
|
}
|
|
20153
18301
|
compileNgModule(angularCoreEnv, sourceMapUrl, facade) {
|
|
20154
18302
|
const meta = {
|
|
20155
|
-
kind: R3NgModuleMetadataKind.Global,
|
|
20156
18303
|
type: wrapReference(facade.type),
|
|
18304
|
+
internalType: new WrappedNodeExpr(facade.type),
|
|
18305
|
+
adjacentType: new WrappedNodeExpr(facade.type),
|
|
20157
18306
|
bootstrap: facade.bootstrap.map(wrapReference),
|
|
20158
18307
|
declarations: facade.declarations.map(wrapReference),
|
|
20159
18308
|
publicDeclarationTypes: null,
|
|
@@ -20198,10 +18347,6 @@ class CompilerFacadeImpl {
|
|
|
20198
18347
|
template,
|
|
20199
18348
|
declarations: facade.declarations.map(convertDeclarationFacadeToMetadata),
|
|
20200
18349
|
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(),
|
|
20205
18350
|
styles: [...facade.styles, ...template.styles],
|
|
20206
18351
|
encapsulation: facade.encapsulation,
|
|
20207
18352
|
interpolation,
|
|
@@ -20230,6 +18375,7 @@ class CompilerFacadeImpl {
|
|
|
20230
18375
|
const factoryRes = compileFactoryFunction({
|
|
20231
18376
|
name: meta.name,
|
|
20232
18377
|
type: wrapReference(meta.type),
|
|
18378
|
+
internalType: new WrappedNodeExpr(meta.type),
|
|
20233
18379
|
typeArgumentCount: meta.typeArgumentCount,
|
|
20234
18380
|
deps: convertR3DependencyMetadataArray(meta.deps),
|
|
20235
18381
|
target: meta.target,
|
|
@@ -20240,6 +18386,7 @@ class CompilerFacadeImpl {
|
|
|
20240
18386
|
const factoryRes = compileFactoryFunction({
|
|
20241
18387
|
name: meta.type.name,
|
|
20242
18388
|
type: wrapReference(meta.type),
|
|
18389
|
+
internalType: new WrappedNodeExpr(meta.type),
|
|
20243
18390
|
typeArgumentCount: 0,
|
|
20244
18391
|
deps: Array.isArray(meta.deps) ? meta.deps.map(convertR3DeclareDependencyMetadata) :
|
|
20245
18392
|
meta.deps,
|
|
@@ -20299,8 +18446,8 @@ function convertQueryPredicate(predicate) {
|
|
|
20299
18446
|
createMayBeForwardRefExpression(new WrappedNodeExpr(predicate), 1 /* ForwardRefHandling.Wrapped */);
|
|
20300
18447
|
}
|
|
20301
18448
|
function convertDirectiveFacadeToMetadata(facade) {
|
|
20302
|
-
const inputsFromMetadata =
|
|
20303
|
-
const outputsFromMetadata =
|
|
18449
|
+
const inputsFromMetadata = parseInputOutputs(facade.inputs || []);
|
|
18450
|
+
const outputsFromMetadata = parseInputOutputs(facade.outputs || []);
|
|
20304
18451
|
const propMetadata = facade.propMetadata;
|
|
20305
18452
|
const inputsFromType = {};
|
|
20306
18453
|
const outputsFromType = {};
|
|
@@ -20308,15 +18455,11 @@ function convertDirectiveFacadeToMetadata(facade) {
|
|
|
20308
18455
|
if (propMetadata.hasOwnProperty(field)) {
|
|
20309
18456
|
propMetadata[field].forEach(ann => {
|
|
20310
18457
|
if (isInput(ann)) {
|
|
20311
|
-
inputsFromType[field] =
|
|
20312
|
-
bindingPropertyName
|
|
20313
|
-
classPropertyName: field,
|
|
20314
|
-
required: ann.required || false,
|
|
20315
|
-
transformFunction: ann.transform != null ? new WrappedNodeExpr(ann.transform) : null,
|
|
20316
|
-
};
|
|
18458
|
+
inputsFromType[field] =
|
|
18459
|
+
ann.bindingPropertyName ? [ann.bindingPropertyName, field] : field;
|
|
20317
18460
|
}
|
|
20318
18461
|
else if (isOutput(ann)) {
|
|
20319
|
-
outputsFromType[field] = ann.
|
|
18462
|
+
outputsFromType[field] = ann.bindingPropertyName || field;
|
|
20320
18463
|
}
|
|
20321
18464
|
});
|
|
20322
18465
|
}
|
|
@@ -20326,6 +18469,7 @@ function convertDirectiveFacadeToMetadata(facade) {
|
|
|
20326
18469
|
typeArgumentCount: 0,
|
|
20327
18470
|
typeSourceSpan: facade.typeSourceSpan,
|
|
20328
18471
|
type: wrapReference(facade.type),
|
|
18472
|
+
internalType: new WrappedNodeExpr(facade.type),
|
|
20329
18473
|
deps: null,
|
|
20330
18474
|
host: extractHostBindings(facade.propMetadata, facade.typeSourceSpan, facade.host),
|
|
20331
18475
|
inputs: { ...inputsFromMetadata, ...inputsFromType },
|
|
@@ -20342,8 +18486,9 @@ function convertDeclareDirectiveFacadeToMetadata(declaration, typeSourceSpan) {
|
|
|
20342
18486
|
name: declaration.type.name,
|
|
20343
18487
|
type: wrapReference(declaration.type),
|
|
20344
18488
|
typeSourceSpan,
|
|
18489
|
+
internalType: new WrappedNodeExpr(declaration.type),
|
|
20345
18490
|
selector: declaration.selector ?? null,
|
|
20346
|
-
inputs: declaration.inputs
|
|
18491
|
+
inputs: declaration.inputs ?? {},
|
|
20347
18492
|
outputs: declaration.outputs ?? {},
|
|
20348
18493
|
host: convertHostDeclarationToMetadata(declaration.host),
|
|
20349
18494
|
queries: (declaration.queries ?? []).map(convertQueryDeclarationToMetadata),
|
|
@@ -20357,7 +18502,6 @@ function convertDeclareDirectiveFacadeToMetadata(declaration, typeSourceSpan) {
|
|
|
20357
18502
|
typeArgumentCount: 0,
|
|
20358
18503
|
fullInheritance: false,
|
|
20359
18504
|
isStandalone: declaration.isStandalone ?? false,
|
|
20360
|
-
isSignal: declaration.isSignal ?? false,
|
|
20361
18505
|
hostDirectives: convertHostDirectivesToMetadata(declaration),
|
|
20362
18506
|
};
|
|
20363
18507
|
}
|
|
@@ -20385,8 +18529,8 @@ function convertHostDirectivesToMetadata(metadata) {
|
|
|
20385
18529
|
{
|
|
20386
18530
|
directive: wrapReference(hostDirective.directive),
|
|
20387
18531
|
isForwardReference: false,
|
|
20388
|
-
inputs: hostDirective.inputs ?
|
|
20389
|
-
outputs: hostDirective.outputs ?
|
|
18532
|
+
inputs: hostDirective.inputs ? parseInputOutputs(hostDirective.inputs) : null,
|
|
18533
|
+
outputs: hostDirective.outputs ? parseInputOutputs(hostDirective.outputs) : null,
|
|
20390
18534
|
};
|
|
20391
18535
|
});
|
|
20392
18536
|
}
|
|
@@ -20432,10 +18576,6 @@ function convertDeclareComponentFacadeToMetadata(decl, typeSourceSpan, sourceMap
|
|
|
20432
18576
|
viewProviders: decl.viewProviders !== undefined ? new WrappedNodeExpr(decl.viewProviders) :
|
|
20433
18577
|
null,
|
|
20434
18578
|
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(),
|
|
20439
18579
|
changeDetection: decl.changeDetection ?? ChangeDetectionStrategy.Default,
|
|
20440
18580
|
encapsulation: decl.encapsulation ?? ViewEncapsulation.Emulated,
|
|
20441
18581
|
interpolation,
|
|
@@ -20483,7 +18623,7 @@ function convertPipeDeclarationToMetadata(pipe) {
|
|
|
20483
18623
|
function parseJitTemplate(template, typeName, sourceMapUrl, preserveWhitespaces, interpolation) {
|
|
20484
18624
|
const interpolationConfig = interpolation ? InterpolationConfig.fromArray(interpolation) : DEFAULT_INTERPOLATION_CONFIG;
|
|
20485
18625
|
// Parse the template and check for errors.
|
|
20486
|
-
const parsed = parseTemplate(template, sourceMapUrl, { preserveWhitespaces, interpolationConfig
|
|
18626
|
+
const parsed = parseTemplate(template, sourceMapUrl, { preserveWhitespaces, interpolationConfig });
|
|
20487
18627
|
if (parsed.errors !== null) {
|
|
20488
18628
|
const errors = parsed.errors.map(err => err.toString()).join(', ');
|
|
20489
18629
|
throw new Error(`Errors during JIT compilation of template for ${typeName}: ${errors}`);
|
|
@@ -20582,67 +18722,18 @@ function isInput(value) {
|
|
|
20582
18722
|
function isOutput(value) {
|
|
20583
18723
|
return value.ngMetadataName === 'Output';
|
|
20584
18724
|
}
|
|
20585
|
-
function
|
|
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) {
|
|
18725
|
+
function parseInputOutputs(values) {
|
|
20630
18726
|
return values.reduce((results, value) => {
|
|
20631
|
-
const [
|
|
20632
|
-
results[
|
|
18727
|
+
const [field, property] = value.split(':', 2).map(str => str.trim());
|
|
18728
|
+
results[field] = property || field;
|
|
20633
18729
|
return results;
|
|
20634
18730
|
}, {});
|
|
20635
18731
|
}
|
|
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
|
-
}
|
|
20642
18732
|
function convertDeclarePipeFacadeToMetadata(declaration) {
|
|
20643
18733
|
return {
|
|
20644
18734
|
name: declaration.type.name,
|
|
20645
18735
|
type: wrapReference(declaration.type),
|
|
18736
|
+
internalType: new WrappedNodeExpr(declaration.type),
|
|
20646
18737
|
typeArgumentCount: 0,
|
|
20647
18738
|
pipeName: declaration.name,
|
|
20648
18739
|
deps: null,
|
|
@@ -20654,6 +18745,7 @@ function convertDeclareInjectorFacadeToMetadata(declaration) {
|
|
|
20654
18745
|
return {
|
|
20655
18746
|
name: declaration.type.name,
|
|
20656
18747
|
type: wrapReference(declaration.type),
|
|
18748
|
+
internalType: new WrappedNodeExpr(declaration.type),
|
|
20657
18749
|
providers: declaration.providers !== undefined && declaration.providers.length > 0 ?
|
|
20658
18750
|
new WrappedNodeExpr(declaration.providers) :
|
|
20659
18751
|
null,
|
|
@@ -20672,7 +18764,7 @@ function publishFacade(global) {
|
|
|
20672
18764
|
* @description
|
|
20673
18765
|
* Entry point for all public APIs of the compiler package.
|
|
20674
18766
|
*/
|
|
20675
|
-
new Version('
|
|
18767
|
+
new Version('15.2.9');
|
|
20676
18768
|
var _VisitorMode;
|
|
20677
18769
|
(function (_VisitorMode) {
|
|
20678
18770
|
_VisitorMode[_VisitorMode["Extract"] = 0] = "Extract";
|