@angular-eslint/bundled-angular-compiler 19.8.0 → 19.8.1-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2008 -1058
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -46,6 +46,7 @@ __export(index_exports, {
|
|
|
46
46
|
Comment: () => Comment2,
|
|
47
47
|
CompilerConfig: () => CompilerConfig,
|
|
48
48
|
CompilerFacadeImpl: () => CompilerFacadeImpl,
|
|
49
|
+
Component: () => Component2,
|
|
49
50
|
Conditional: () => Conditional,
|
|
50
51
|
ConditionalExpr: () => ConditionalExpr,
|
|
51
52
|
ConstantPool: () => ConstantPool,
|
|
@@ -54,6 +55,7 @@ __export(index_exports, {
|
|
|
54
55
|
DYNAMIC_TYPE: () => DYNAMIC_TYPE,
|
|
55
56
|
DeclareFunctionStmt: () => DeclareFunctionStmt,
|
|
56
57
|
DeclareVarStmt: () => DeclareVarStmt,
|
|
58
|
+
Directive: () => Directive2,
|
|
57
59
|
DomElementSchemaRegistry: () => DomElementSchemaRegistry,
|
|
58
60
|
DynamicImportExpr: () => DynamicImportExpr,
|
|
59
61
|
EOF: () => EOF,
|
|
@@ -101,6 +103,8 @@ __export(index_exports, {
|
|
|
101
103
|
NodeWithI18n: () => NodeWithI18n,
|
|
102
104
|
NonNullAssert: () => NonNullAssert,
|
|
103
105
|
NotExpr: () => NotExpr,
|
|
106
|
+
ParenthesizedExpr: () => ParenthesizedExpr,
|
|
107
|
+
ParenthesizedExpression: () => ParenthesizedExpression,
|
|
104
108
|
ParseError: () => ParseError,
|
|
105
109
|
ParseErrorLevel: () => ParseErrorLevel,
|
|
106
110
|
ParseLocation: () => ParseLocation,
|
|
@@ -118,7 +122,6 @@ __export(index_exports, {
|
|
|
118
122
|
PrefixNot: () => PrefixNot,
|
|
119
123
|
PropertyRead: () => PropertyRead,
|
|
120
124
|
PropertyWrite: () => PropertyWrite,
|
|
121
|
-
R3BoundTarget: () => R3BoundTarget,
|
|
122
125
|
R3Identifiers: () => Identifiers,
|
|
123
126
|
R3NgModuleMetadataKind: () => R3NgModuleMetadataKind,
|
|
124
127
|
R3SelectorScopeMode: () => R3SelectorScopeMode,
|
|
@@ -139,6 +142,7 @@ __export(index_exports, {
|
|
|
139
142
|
SelectorContext: () => SelectorContext,
|
|
140
143
|
SelectorListContext: () => SelectorListContext,
|
|
141
144
|
SelectorMatcher: () => SelectorMatcher,
|
|
145
|
+
SelectorlessMatcher: () => SelectorlessMatcher,
|
|
142
146
|
Serializer: () => Serializer,
|
|
143
147
|
SplitInterpolation: () => SplitInterpolation,
|
|
144
148
|
Statement: () => Statement,
|
|
@@ -146,6 +150,7 @@ __export(index_exports, {
|
|
|
146
150
|
StringToken: () => StringToken,
|
|
147
151
|
StringTokenKind: () => StringTokenKind,
|
|
148
152
|
TagContentType: () => TagContentType,
|
|
153
|
+
TaggedTemplateLiteral: () => TaggedTemplateLiteral,
|
|
149
154
|
TaggedTemplateLiteralExpr: () => TaggedTemplateLiteralExpr,
|
|
150
155
|
TemplateBindingParseResult: () => TemplateBindingParseResult,
|
|
151
156
|
TemplateLiteral: () => TemplateLiteral,
|
|
@@ -159,15 +164,18 @@ __export(index_exports, {
|
|
|
159
164
|
TmplAstBoundDeferredTrigger: () => BoundDeferredTrigger,
|
|
160
165
|
TmplAstBoundEvent: () => BoundEvent,
|
|
161
166
|
TmplAstBoundText: () => BoundText,
|
|
167
|
+
TmplAstComponent: () => Component$1,
|
|
162
168
|
TmplAstContent: () => Content,
|
|
163
169
|
TmplAstDeferredBlock: () => DeferredBlock,
|
|
164
170
|
TmplAstDeferredBlockError: () => DeferredBlockError,
|
|
165
171
|
TmplAstDeferredBlockLoading: () => DeferredBlockLoading,
|
|
166
172
|
TmplAstDeferredBlockPlaceholder: () => DeferredBlockPlaceholder,
|
|
167
173
|
TmplAstDeferredTrigger: () => DeferredTrigger,
|
|
174
|
+
TmplAstDirective: () => Directive$1,
|
|
168
175
|
TmplAstElement: () => Element$1,
|
|
169
176
|
TmplAstForLoopBlock: () => ForLoopBlock,
|
|
170
177
|
TmplAstForLoopBlockEmpty: () => ForLoopBlockEmpty,
|
|
178
|
+
TmplAstHostElement: () => HostElement,
|
|
171
179
|
TmplAstHoverDeferredTrigger: () => HoverDeferredTrigger,
|
|
172
180
|
TmplAstIcu: () => Icu$1,
|
|
173
181
|
TmplAstIdleDeferredTrigger: () => IdleDeferredTrigger,
|
|
@@ -203,6 +211,8 @@ __export(index_exports, {
|
|
|
203
211
|
VariableBinding: () => VariableBinding,
|
|
204
212
|
Version: () => Version,
|
|
205
213
|
ViewEncapsulation: () => ViewEncapsulation$1,
|
|
214
|
+
VoidExpr: () => VoidExpr,
|
|
215
|
+
VoidExpression: () => VoidExpression,
|
|
206
216
|
WrappedNodeExpr: () => WrappedNodeExpr,
|
|
207
217
|
WriteKeyExpr: () => WriteKeyExpr,
|
|
208
218
|
WritePropExpr: () => WritePropExpr,
|
|
@@ -265,7 +275,6 @@ __export(index_exports, {
|
|
|
265
275
|
publishFacade: () => publishFacade,
|
|
266
276
|
r3JitTypeSourceSpan: () => r3JitTypeSourceSpan,
|
|
267
277
|
sanitizeIdentifier: () => sanitizeIdentifier,
|
|
268
|
-
setEnableTemplateSourceLocations: () => setEnableTemplateSourceLocations,
|
|
269
278
|
splitNsName: () => splitNsName,
|
|
270
279
|
tmplAstVisitAll: () => visitAll$1,
|
|
271
280
|
verifyHostBindings: () => verifyHostBindings,
|
|
@@ -273,7 +282,7 @@ __export(index_exports, {
|
|
|
273
282
|
});
|
|
274
283
|
module.exports = __toCommonJS(index_exports);
|
|
275
284
|
|
|
276
|
-
// ../../node_modules/.pnpm/@angular+compiler@
|
|
285
|
+
// ../../node_modules/.pnpm/@angular+compiler@20.0.0/node_modules/@angular/compiler/fesm2022/compiler.mjs
|
|
277
286
|
var _SELECTOR_REGEXP = new RegExp(
|
|
278
287
|
`(\\:not\\()|(([\\.\\#]?)[-\\w]+)|(?:\\[([-.\\w*\\\\$]+)(?:=(["']?)([^\\]"']*)\\5)?\\])|(\\))|(\\s*,\\s*)`,
|
|
279
288
|
// 8: ","
|
|
@@ -660,6 +669,18 @@ var SelectorContext = class {
|
|
|
660
669
|
return result;
|
|
661
670
|
}
|
|
662
671
|
};
|
|
672
|
+
var SelectorlessMatcher = class {
|
|
673
|
+
static {
|
|
674
|
+
__name(this, "SelectorlessMatcher");
|
|
675
|
+
}
|
|
676
|
+
registry;
|
|
677
|
+
constructor(registry) {
|
|
678
|
+
this.registry = registry;
|
|
679
|
+
}
|
|
680
|
+
match(name) {
|
|
681
|
+
return this.registry.has(name) ? this.registry.get(name) : [];
|
|
682
|
+
}
|
|
683
|
+
};
|
|
663
684
|
var emitDistinctChangesOnlyDefaultValue = true;
|
|
664
685
|
var ViewEncapsulation$1;
|
|
665
686
|
(function(ViewEncapsulation2) {
|
|
@@ -1168,6 +1189,8 @@ var BinaryOperator;
|
|
|
1168
1189
|
BinaryOperator2[BinaryOperator2["Bigger"] = 15] = "Bigger";
|
|
1169
1190
|
BinaryOperator2[BinaryOperator2["BiggerEquals"] = 16] = "BiggerEquals";
|
|
1170
1191
|
BinaryOperator2[BinaryOperator2["NullishCoalesce"] = 17] = "NullishCoalesce";
|
|
1192
|
+
BinaryOperator2[BinaryOperator2["Exponentiation"] = 18] = "Exponentiation";
|
|
1193
|
+
BinaryOperator2[BinaryOperator2["In"] = 19] = "In";
|
|
1171
1194
|
})(BinaryOperator || (BinaryOperator = {}));
|
|
1172
1195
|
function nullSafeIsEquivalent(base, other) {
|
|
1173
1196
|
if (base == null || other == null) {
|
|
@@ -1245,14 +1268,17 @@ var Expression = class {
|
|
|
1245
1268
|
modulo(rhs, sourceSpan) {
|
|
1246
1269
|
return new BinaryOperatorExpr(BinaryOperator.Modulo, this, rhs, null, sourceSpan);
|
|
1247
1270
|
}
|
|
1271
|
+
power(rhs, sourceSpan) {
|
|
1272
|
+
return new BinaryOperatorExpr(BinaryOperator.Exponentiation, this, rhs, null, sourceSpan);
|
|
1273
|
+
}
|
|
1248
1274
|
and(rhs, sourceSpan) {
|
|
1249
1275
|
return new BinaryOperatorExpr(BinaryOperator.And, this, rhs, null, sourceSpan);
|
|
1250
1276
|
}
|
|
1251
|
-
bitwiseOr(rhs, sourceSpan
|
|
1252
|
-
return new BinaryOperatorExpr(BinaryOperator.BitwiseOr, this, rhs, null, sourceSpan
|
|
1277
|
+
bitwiseOr(rhs, sourceSpan) {
|
|
1278
|
+
return new BinaryOperatorExpr(BinaryOperator.BitwiseOr, this, rhs, null, sourceSpan);
|
|
1253
1279
|
}
|
|
1254
|
-
bitwiseAnd(rhs, sourceSpan
|
|
1255
|
-
return new BinaryOperatorExpr(BinaryOperator.BitwiseAnd, this, rhs, null, sourceSpan
|
|
1280
|
+
bitwiseAnd(rhs, sourceSpan) {
|
|
1281
|
+
return new BinaryOperatorExpr(BinaryOperator.BitwiseAnd, this, rhs, null, sourceSpan);
|
|
1256
1282
|
}
|
|
1257
1283
|
or(rhs, sourceSpan) {
|
|
1258
1284
|
return new BinaryOperatorExpr(BinaryOperator.Or, this, rhs, null, sourceSpan);
|
|
@@ -1326,6 +1352,28 @@ var TypeofExpr = class _TypeofExpr extends Expression {
|
|
|
1326
1352
|
return new _TypeofExpr(this.expr.clone());
|
|
1327
1353
|
}
|
|
1328
1354
|
};
|
|
1355
|
+
var VoidExpr = class _VoidExpr extends Expression {
|
|
1356
|
+
static {
|
|
1357
|
+
__name(this, "VoidExpr");
|
|
1358
|
+
}
|
|
1359
|
+
expr;
|
|
1360
|
+
constructor(expr, type, sourceSpan) {
|
|
1361
|
+
super(type, sourceSpan);
|
|
1362
|
+
this.expr = expr;
|
|
1363
|
+
}
|
|
1364
|
+
visitExpression(visitor, context) {
|
|
1365
|
+
return visitor.visitVoidExpr(this, context);
|
|
1366
|
+
}
|
|
1367
|
+
isEquivalent(e) {
|
|
1368
|
+
return e instanceof _VoidExpr && e.expr.isEquivalent(this.expr);
|
|
1369
|
+
}
|
|
1370
|
+
isConstant() {
|
|
1371
|
+
return this.expr.isConstant();
|
|
1372
|
+
}
|
|
1373
|
+
clone() {
|
|
1374
|
+
return new _VoidExpr(this.expr.clone());
|
|
1375
|
+
}
|
|
1376
|
+
};
|
|
1329
1377
|
var WrappedNodeExpr = class _WrappedNodeExpr extends Expression {
|
|
1330
1378
|
static {
|
|
1331
1379
|
__name(this, "WrappedNodeExpr");
|
|
@@ -1928,19 +1976,39 @@ var UnaryOperatorExpr = class _UnaryOperatorExpr extends Expression {
|
|
|
1928
1976
|
return new _UnaryOperatorExpr(this.operator, this.expr.clone(), this.type, this.sourceSpan, this.parens);
|
|
1929
1977
|
}
|
|
1930
1978
|
};
|
|
1979
|
+
var ParenthesizedExpr = class _ParenthesizedExpr extends Expression {
|
|
1980
|
+
static {
|
|
1981
|
+
__name(this, "ParenthesizedExpr");
|
|
1982
|
+
}
|
|
1983
|
+
expr;
|
|
1984
|
+
constructor(expr, type, sourceSpan) {
|
|
1985
|
+
super(type, sourceSpan);
|
|
1986
|
+
this.expr = expr;
|
|
1987
|
+
}
|
|
1988
|
+
visitExpression(visitor, context) {
|
|
1989
|
+
return visitor.visitParenthesizedExpr(this, context);
|
|
1990
|
+
}
|
|
1991
|
+
isEquivalent(e) {
|
|
1992
|
+
return e instanceof _ParenthesizedExpr && e.expr.isEquivalent(this.expr);
|
|
1993
|
+
}
|
|
1994
|
+
isConstant() {
|
|
1995
|
+
return this.expr.isConstant();
|
|
1996
|
+
}
|
|
1997
|
+
clone() {
|
|
1998
|
+
return new _ParenthesizedExpr(this.expr.clone());
|
|
1999
|
+
}
|
|
2000
|
+
};
|
|
1931
2001
|
var BinaryOperatorExpr = class _BinaryOperatorExpr extends Expression {
|
|
1932
2002
|
static {
|
|
1933
2003
|
__name(this, "BinaryOperatorExpr");
|
|
1934
2004
|
}
|
|
1935
2005
|
operator;
|
|
1936
2006
|
rhs;
|
|
1937
|
-
parens;
|
|
1938
2007
|
lhs;
|
|
1939
|
-
constructor(operator, lhs, rhs, type, sourceSpan
|
|
2008
|
+
constructor(operator, lhs, rhs, type, sourceSpan) {
|
|
1940
2009
|
super(type || lhs.type, sourceSpan);
|
|
1941
2010
|
this.operator = operator;
|
|
1942
2011
|
this.rhs = rhs;
|
|
1943
|
-
this.parens = parens;
|
|
1944
2012
|
this.lhs = lhs;
|
|
1945
2013
|
}
|
|
1946
2014
|
isEquivalent(e) {
|
|
@@ -1953,7 +2021,7 @@ var BinaryOperatorExpr = class _BinaryOperatorExpr extends Expression {
|
|
|
1953
2021
|
return visitor.visitBinaryOperatorExpr(this, context);
|
|
1954
2022
|
}
|
|
1955
2023
|
clone() {
|
|
1956
|
-
return new _BinaryOperatorExpr(this.operator, this.lhs.clone(), this.rhs.clone(), this.type, this.sourceSpan
|
|
2024
|
+
return new _BinaryOperatorExpr(this.operator, this.lhs.clone(), this.rhs.clone(), this.type, this.sourceSpan);
|
|
1957
2025
|
}
|
|
1958
2026
|
};
|
|
1959
2027
|
var ReadPropExpr = class _ReadPropExpr extends Expression {
|
|
@@ -2298,9 +2366,6 @@ var RecursiveAstVisitor$1 = class RecursiveAstVisitor {
|
|
|
2298
2366
|
visitWrappedNodeExpr(ast, context) {
|
|
2299
2367
|
return ast;
|
|
2300
2368
|
}
|
|
2301
|
-
visitTypeofExpr(ast, context) {
|
|
2302
|
-
return this.visitExpression(ast, context);
|
|
2303
|
-
}
|
|
2304
2369
|
visitReadVarExpr(ast, context) {
|
|
2305
2370
|
return this.visitExpression(ast, context);
|
|
2306
2371
|
}
|
|
@@ -2375,6 +2440,14 @@ var RecursiveAstVisitor$1 = class RecursiveAstVisitor {
|
|
|
2375
2440
|
ast.expr.visitExpression(this, context);
|
|
2376
2441
|
return this.visitExpression(ast, context);
|
|
2377
2442
|
}
|
|
2443
|
+
visitTypeofExpr(ast, context) {
|
|
2444
|
+
ast.expr.visitExpression(this, context);
|
|
2445
|
+
return this.visitExpression(ast, context);
|
|
2446
|
+
}
|
|
2447
|
+
visitVoidExpr(ast, context) {
|
|
2448
|
+
ast.expr.visitExpression(this, context);
|
|
2449
|
+
return this.visitExpression(ast, context);
|
|
2450
|
+
}
|
|
2378
2451
|
visitBinaryOperatorExpr(ast, context) {
|
|
2379
2452
|
ast.lhs.visitExpression(this, context);
|
|
2380
2453
|
ast.rhs.visitExpression(this, context);
|
|
@@ -2409,6 +2482,10 @@ var RecursiveAstVisitor$1 = class RecursiveAstVisitor {
|
|
|
2409
2482
|
visitTemplateLiteralElementExpr(ast, context) {
|
|
2410
2483
|
return this.visitExpression(ast, context);
|
|
2411
2484
|
}
|
|
2485
|
+
visitParenthesizedExpr(ast, context) {
|
|
2486
|
+
ast.expr.visitExpression(this, context);
|
|
2487
|
+
return this.visitExpression(ast, context);
|
|
2488
|
+
}
|
|
2412
2489
|
visitAllExpressions(exprs, context) {
|
|
2413
2490
|
exprs.forEach((expr) => expr.visitExpression(this, context));
|
|
2414
2491
|
}
|
|
@@ -2597,6 +2674,7 @@ var output_ast = /* @__PURE__ */ Object.freeze({
|
|
|
2597
2674
|
NULL_EXPR,
|
|
2598
2675
|
NUMBER_TYPE,
|
|
2599
2676
|
NotExpr,
|
|
2677
|
+
ParenthesizedExpr,
|
|
2600
2678
|
PlaceholderPiece,
|
|
2601
2679
|
ReadKeyExpr,
|
|
2602
2680
|
ReadPropExpr,
|
|
@@ -2622,6 +2700,7 @@ var output_ast = /* @__PURE__ */ Object.freeze({
|
|
|
2622
2700
|
return UnaryOperator;
|
|
2623
2701
|
},
|
|
2624
2702
|
UnaryOperatorExpr,
|
|
2703
|
+
VoidExpr,
|
|
2625
2704
|
WrappedNodeExpr,
|
|
2626
2705
|
WriteKeyExpr,
|
|
2627
2706
|
WritePropExpr,
|
|
@@ -2887,42 +2966,6 @@ var Identifiers = class {
|
|
|
2887
2966
|
moduleName: CORE
|
|
2888
2967
|
};
|
|
2889
2968
|
static attribute = { name: "\u0275\u0275attribute", moduleName: CORE };
|
|
2890
|
-
static attributeInterpolate1 = {
|
|
2891
|
-
name: "\u0275\u0275attributeInterpolate1",
|
|
2892
|
-
moduleName: CORE
|
|
2893
|
-
};
|
|
2894
|
-
static attributeInterpolate2 = {
|
|
2895
|
-
name: "\u0275\u0275attributeInterpolate2",
|
|
2896
|
-
moduleName: CORE
|
|
2897
|
-
};
|
|
2898
|
-
static attributeInterpolate3 = {
|
|
2899
|
-
name: "\u0275\u0275attributeInterpolate3",
|
|
2900
|
-
moduleName: CORE
|
|
2901
|
-
};
|
|
2902
|
-
static attributeInterpolate4 = {
|
|
2903
|
-
name: "\u0275\u0275attributeInterpolate4",
|
|
2904
|
-
moduleName: CORE
|
|
2905
|
-
};
|
|
2906
|
-
static attributeInterpolate5 = {
|
|
2907
|
-
name: "\u0275\u0275attributeInterpolate5",
|
|
2908
|
-
moduleName: CORE
|
|
2909
|
-
};
|
|
2910
|
-
static attributeInterpolate6 = {
|
|
2911
|
-
name: "\u0275\u0275attributeInterpolate6",
|
|
2912
|
-
moduleName: CORE
|
|
2913
|
-
};
|
|
2914
|
-
static attributeInterpolate7 = {
|
|
2915
|
-
name: "\u0275\u0275attributeInterpolate7",
|
|
2916
|
-
moduleName: CORE
|
|
2917
|
-
};
|
|
2918
|
-
static attributeInterpolate8 = {
|
|
2919
|
-
name: "\u0275\u0275attributeInterpolate8",
|
|
2920
|
-
moduleName: CORE
|
|
2921
|
-
};
|
|
2922
|
-
static attributeInterpolateV = {
|
|
2923
|
-
name: "\u0275\u0275attributeInterpolateV",
|
|
2924
|
-
moduleName: CORE
|
|
2925
|
-
};
|
|
2926
2969
|
static classProp = { name: "\u0275\u0275classProp", moduleName: CORE };
|
|
2927
2970
|
static elementContainerStart = {
|
|
2928
2971
|
name: "\u0275\u0275elementContainerStart",
|
|
@@ -2934,114 +2977,46 @@ var Identifiers = class {
|
|
|
2934
2977
|
};
|
|
2935
2978
|
static elementContainer = { name: "\u0275\u0275elementContainer", moduleName: CORE };
|
|
2936
2979
|
static styleMap = { name: "\u0275\u0275styleMap", moduleName: CORE };
|
|
2937
|
-
static styleMapInterpolate1 = {
|
|
2938
|
-
name: "\u0275\u0275styleMapInterpolate1",
|
|
2939
|
-
moduleName: CORE
|
|
2940
|
-
};
|
|
2941
|
-
static styleMapInterpolate2 = {
|
|
2942
|
-
name: "\u0275\u0275styleMapInterpolate2",
|
|
2943
|
-
moduleName: CORE
|
|
2944
|
-
};
|
|
2945
|
-
static styleMapInterpolate3 = {
|
|
2946
|
-
name: "\u0275\u0275styleMapInterpolate3",
|
|
2947
|
-
moduleName: CORE
|
|
2948
|
-
};
|
|
2949
|
-
static styleMapInterpolate4 = {
|
|
2950
|
-
name: "\u0275\u0275styleMapInterpolate4",
|
|
2951
|
-
moduleName: CORE
|
|
2952
|
-
};
|
|
2953
|
-
static styleMapInterpolate5 = {
|
|
2954
|
-
name: "\u0275\u0275styleMapInterpolate5",
|
|
2955
|
-
moduleName: CORE
|
|
2956
|
-
};
|
|
2957
|
-
static styleMapInterpolate6 = {
|
|
2958
|
-
name: "\u0275\u0275styleMapInterpolate6",
|
|
2959
|
-
moduleName: CORE
|
|
2960
|
-
};
|
|
2961
|
-
static styleMapInterpolate7 = {
|
|
2962
|
-
name: "\u0275\u0275styleMapInterpolate7",
|
|
2963
|
-
moduleName: CORE
|
|
2964
|
-
};
|
|
2965
|
-
static styleMapInterpolate8 = {
|
|
2966
|
-
name: "\u0275\u0275styleMapInterpolate8",
|
|
2967
|
-
moduleName: CORE
|
|
2968
|
-
};
|
|
2969
|
-
static styleMapInterpolateV = {
|
|
2970
|
-
name: "\u0275\u0275styleMapInterpolateV",
|
|
2971
|
-
moduleName: CORE
|
|
2972
|
-
};
|
|
2973
2980
|
static classMap = { name: "\u0275\u0275classMap", moduleName: CORE };
|
|
2974
|
-
static
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
};
|
|
2978
|
-
static classMapInterpolate2 = {
|
|
2979
|
-
name: "\u0275\u0275classMapInterpolate2",
|
|
2980
|
-
moduleName: CORE
|
|
2981
|
-
};
|
|
2982
|
-
static classMapInterpolate3 = {
|
|
2983
|
-
name: "\u0275\u0275classMapInterpolate3",
|
|
2984
|
-
moduleName: CORE
|
|
2985
|
-
};
|
|
2986
|
-
static classMapInterpolate4 = {
|
|
2987
|
-
name: "\u0275\u0275classMapInterpolate4",
|
|
2988
|
-
moduleName: CORE
|
|
2989
|
-
};
|
|
2990
|
-
static classMapInterpolate5 = {
|
|
2991
|
-
name: "\u0275\u0275classMapInterpolate5",
|
|
2992
|
-
moduleName: CORE
|
|
2993
|
-
};
|
|
2994
|
-
static classMapInterpolate6 = {
|
|
2995
|
-
name: "\u0275\u0275classMapInterpolate6",
|
|
2996
|
-
moduleName: CORE
|
|
2997
|
-
};
|
|
2998
|
-
static classMapInterpolate7 = {
|
|
2999
|
-
name: "\u0275\u0275classMapInterpolate7",
|
|
3000
|
-
moduleName: CORE
|
|
3001
|
-
};
|
|
3002
|
-
static classMapInterpolate8 = {
|
|
3003
|
-
name: "\u0275\u0275classMapInterpolate8",
|
|
3004
|
-
moduleName: CORE
|
|
3005
|
-
};
|
|
3006
|
-
static classMapInterpolateV = {
|
|
3007
|
-
name: "\u0275\u0275classMapInterpolateV",
|
|
2981
|
+
static styleProp = { name: "\u0275\u0275styleProp", moduleName: CORE };
|
|
2982
|
+
static interpolate = {
|
|
2983
|
+
name: "\u0275\u0275interpolate",
|
|
3008
2984
|
moduleName: CORE
|
|
3009
2985
|
};
|
|
3010
|
-
static
|
|
3011
|
-
|
|
3012
|
-
name: "\u0275\u0275stylePropInterpolate1",
|
|
2986
|
+
static interpolate1 = {
|
|
2987
|
+
name: "\u0275\u0275interpolate1",
|
|
3013
2988
|
moduleName: CORE
|
|
3014
2989
|
};
|
|
3015
|
-
static
|
|
3016
|
-
name: "\u0275\
|
|
2990
|
+
static interpolate2 = {
|
|
2991
|
+
name: "\u0275\u0275interpolate2",
|
|
3017
2992
|
moduleName: CORE
|
|
3018
2993
|
};
|
|
3019
|
-
static
|
|
3020
|
-
name: "\u0275\
|
|
2994
|
+
static interpolate3 = {
|
|
2995
|
+
name: "\u0275\u0275interpolate3",
|
|
3021
2996
|
moduleName: CORE
|
|
3022
2997
|
};
|
|
3023
|
-
static
|
|
3024
|
-
name: "\u0275\
|
|
2998
|
+
static interpolate4 = {
|
|
2999
|
+
name: "\u0275\u0275interpolate4",
|
|
3025
3000
|
moduleName: CORE
|
|
3026
3001
|
};
|
|
3027
|
-
static
|
|
3028
|
-
name: "\u0275\
|
|
3002
|
+
static interpolate5 = {
|
|
3003
|
+
name: "\u0275\u0275interpolate5",
|
|
3029
3004
|
moduleName: CORE
|
|
3030
3005
|
};
|
|
3031
|
-
static
|
|
3032
|
-
name: "\u0275\
|
|
3006
|
+
static interpolate6 = {
|
|
3007
|
+
name: "\u0275\u0275interpolate6",
|
|
3033
3008
|
moduleName: CORE
|
|
3034
3009
|
};
|
|
3035
|
-
static
|
|
3036
|
-
name: "\u0275\
|
|
3010
|
+
static interpolate7 = {
|
|
3011
|
+
name: "\u0275\u0275interpolate7",
|
|
3037
3012
|
moduleName: CORE
|
|
3038
3013
|
};
|
|
3039
|
-
static
|
|
3040
|
-
name: "\u0275\
|
|
3014
|
+
static interpolate8 = {
|
|
3015
|
+
name: "\u0275\u0275interpolate8",
|
|
3041
3016
|
moduleName: CORE
|
|
3042
3017
|
};
|
|
3043
|
-
static
|
|
3044
|
-
name: "\u0275\
|
|
3018
|
+
static interpolateV = {
|
|
3019
|
+
name: "\u0275\u0275interpolateV",
|
|
3045
3020
|
moduleName: CORE
|
|
3046
3021
|
};
|
|
3047
3022
|
static nextContext = { name: "\u0275\u0275nextContext", moduleName: CORE };
|
|
@@ -3110,6 +3085,11 @@ var Identifiers = class {
|
|
|
3110
3085
|
name: "\u0275\u0275deferEnableTimerScheduling",
|
|
3111
3086
|
moduleName: CORE
|
|
3112
3087
|
};
|
|
3088
|
+
static conditionalCreate = { name: "\u0275\u0275conditionalCreate", moduleName: CORE };
|
|
3089
|
+
static conditionalBranchCreate = {
|
|
3090
|
+
name: "\u0275\u0275conditionalBranchCreate",
|
|
3091
|
+
moduleName: CORE
|
|
3092
|
+
};
|
|
3113
3093
|
static conditional = { name: "\u0275\u0275conditional", moduleName: CORE };
|
|
3114
3094
|
static repeater = { name: "\u0275\u0275repeater", moduleName: CORE };
|
|
3115
3095
|
static repeaterCreate = { name: "\u0275\u0275repeaterCreate", moduleName: CORE };
|
|
@@ -3152,48 +3132,8 @@ var Identifiers = class {
|
|
|
3152
3132
|
static pipeBind3 = { name: "\u0275\u0275pipeBind3", moduleName: CORE };
|
|
3153
3133
|
static pipeBind4 = { name: "\u0275\u0275pipeBind4", moduleName: CORE };
|
|
3154
3134
|
static pipeBindV = { name: "\u0275\u0275pipeBindV", moduleName: CORE };
|
|
3155
|
-
static
|
|
3135
|
+
static domProperty = { name: "\u0275\u0275domProperty", moduleName: CORE };
|
|
3156
3136
|
static property = { name: "\u0275\u0275property", moduleName: CORE };
|
|
3157
|
-
static propertyInterpolate = {
|
|
3158
|
-
name: "\u0275\u0275propertyInterpolate",
|
|
3159
|
-
moduleName: CORE
|
|
3160
|
-
};
|
|
3161
|
-
static propertyInterpolate1 = {
|
|
3162
|
-
name: "\u0275\u0275propertyInterpolate1",
|
|
3163
|
-
moduleName: CORE
|
|
3164
|
-
};
|
|
3165
|
-
static propertyInterpolate2 = {
|
|
3166
|
-
name: "\u0275\u0275propertyInterpolate2",
|
|
3167
|
-
moduleName: CORE
|
|
3168
|
-
};
|
|
3169
|
-
static propertyInterpolate3 = {
|
|
3170
|
-
name: "\u0275\u0275propertyInterpolate3",
|
|
3171
|
-
moduleName: CORE
|
|
3172
|
-
};
|
|
3173
|
-
static propertyInterpolate4 = {
|
|
3174
|
-
name: "\u0275\u0275propertyInterpolate4",
|
|
3175
|
-
moduleName: CORE
|
|
3176
|
-
};
|
|
3177
|
-
static propertyInterpolate5 = {
|
|
3178
|
-
name: "\u0275\u0275propertyInterpolate5",
|
|
3179
|
-
moduleName: CORE
|
|
3180
|
-
};
|
|
3181
|
-
static propertyInterpolate6 = {
|
|
3182
|
-
name: "\u0275\u0275propertyInterpolate6",
|
|
3183
|
-
moduleName: CORE
|
|
3184
|
-
};
|
|
3185
|
-
static propertyInterpolate7 = {
|
|
3186
|
-
name: "\u0275\u0275propertyInterpolate7",
|
|
3187
|
-
moduleName: CORE
|
|
3188
|
-
};
|
|
3189
|
-
static propertyInterpolate8 = {
|
|
3190
|
-
name: "\u0275\u0275propertyInterpolate8",
|
|
3191
|
-
moduleName: CORE
|
|
3192
|
-
};
|
|
3193
|
-
static propertyInterpolateV = {
|
|
3194
|
-
name: "\u0275\u0275propertyInterpolateV",
|
|
3195
|
-
moduleName: CORE
|
|
3196
|
-
};
|
|
3197
3137
|
static i18n = { name: "\u0275\u0275i18n", moduleName: CORE };
|
|
3198
3138
|
static i18nAttributes = { name: "\u0275\u0275i18nAttributes", moduleName: CORE };
|
|
3199
3139
|
static i18nExp = { name: "\u0275\u0275i18nExp", moduleName: CORE };
|
|
@@ -3761,6 +3701,7 @@ var AbstractEmitterVisitor = class {
|
|
|
3761
3701
|
__name(this, "AbstractEmitterVisitor");
|
|
3762
3702
|
}
|
|
3763
3703
|
_escapeDollarInStrings;
|
|
3704
|
+
lastIfCondition = null;
|
|
3764
3705
|
constructor(_escapeDollarInStrings) {
|
|
3765
3706
|
this._escapeDollarInStrings = _escapeDollarInStrings;
|
|
3766
3707
|
}
|
|
@@ -3798,7 +3739,9 @@ var AbstractEmitterVisitor = class {
|
|
|
3798
3739
|
visitIfStmt(stmt, ctx) {
|
|
3799
3740
|
this.printLeadingComments(stmt, ctx);
|
|
3800
3741
|
ctx.print(stmt, `if (`);
|
|
3742
|
+
this.lastIfCondition = stmt.condition;
|
|
3801
3743
|
stmt.condition.visitExpression(this, ctx);
|
|
3744
|
+
this.lastIfCondition = null;
|
|
3802
3745
|
ctx.print(stmt, `) {`);
|
|
3803
3746
|
const hasElseCase = stmt.falseCase != null && stmt.falseCase.length > 0;
|
|
3804
3747
|
if (stmt.trueCase.length <= 1 && !hasElseCase) {
|
|
@@ -3903,6 +3846,10 @@ var AbstractEmitterVisitor = class {
|
|
|
3903
3846
|
ctx.print(expr, "typeof ");
|
|
3904
3847
|
expr.expr.visitExpression(this, ctx);
|
|
3905
3848
|
}
|
|
3849
|
+
visitVoidExpr(expr, ctx) {
|
|
3850
|
+
ctx.print(expr, "void ");
|
|
3851
|
+
expr.expr.visitExpression(this, ctx);
|
|
3852
|
+
}
|
|
3906
3853
|
visitReadVarExpr(ast, ctx) {
|
|
3907
3854
|
ctx.print(ast, ast.name);
|
|
3908
3855
|
return null;
|
|
@@ -3965,11 +3912,12 @@ var AbstractEmitterVisitor = class {
|
|
|
3965
3912
|
default:
|
|
3966
3913
|
throw new Error(`Unknown operator ${ast.operator}`);
|
|
3967
3914
|
}
|
|
3968
|
-
|
|
3915
|
+
const parens = ast !== this.lastIfCondition;
|
|
3916
|
+
if (parens)
|
|
3969
3917
|
ctx.print(ast, `(`);
|
|
3970
3918
|
ctx.print(ast, opStr);
|
|
3971
3919
|
ast.expr.visitExpression(this, ctx);
|
|
3972
|
-
if (
|
|
3920
|
+
if (parens)
|
|
3973
3921
|
ctx.print(ast, `)`);
|
|
3974
3922
|
return null;
|
|
3975
3923
|
}
|
|
@@ -4015,6 +3963,9 @@ var AbstractEmitterVisitor = class {
|
|
|
4015
3963
|
case BinaryOperator.Modulo:
|
|
4016
3964
|
opStr = "%";
|
|
4017
3965
|
break;
|
|
3966
|
+
case BinaryOperator.Exponentiation:
|
|
3967
|
+
opStr = "**";
|
|
3968
|
+
break;
|
|
4018
3969
|
case BinaryOperator.Lower:
|
|
4019
3970
|
opStr = "<";
|
|
4020
3971
|
break;
|
|
@@ -4030,15 +3981,19 @@ var AbstractEmitterVisitor = class {
|
|
|
4030
3981
|
case BinaryOperator.NullishCoalesce:
|
|
4031
3982
|
opStr = "??";
|
|
4032
3983
|
break;
|
|
3984
|
+
case BinaryOperator.In:
|
|
3985
|
+
opStr = "in";
|
|
3986
|
+
break;
|
|
4033
3987
|
default:
|
|
4034
3988
|
throw new Error(`Unknown operator ${ast.operator}`);
|
|
4035
3989
|
}
|
|
4036
|
-
|
|
3990
|
+
const parens = ast !== this.lastIfCondition;
|
|
3991
|
+
if (parens)
|
|
4037
3992
|
ctx.print(ast, `(`);
|
|
4038
3993
|
ast.lhs.visitExpression(this, ctx);
|
|
4039
3994
|
ctx.print(ast, ` ${opStr} `);
|
|
4040
3995
|
ast.rhs.visitExpression(this, ctx);
|
|
4041
|
-
if (
|
|
3996
|
+
if (parens)
|
|
4042
3997
|
ctx.print(ast, `)`);
|
|
4043
3998
|
return null;
|
|
4044
3999
|
}
|
|
@@ -4076,6 +4031,9 @@ var AbstractEmitterVisitor = class {
|
|
|
4076
4031
|
ctx.print(ast, ")");
|
|
4077
4032
|
return null;
|
|
4078
4033
|
}
|
|
4034
|
+
visitParenthesizedExpr(ast, ctx) {
|
|
4035
|
+
ast.expr.visitExpression(this, ctx);
|
|
4036
|
+
}
|
|
4079
4037
|
visitAllExpressions(expressions, ctx, separator) {
|
|
4080
4038
|
this.visitAllObjects((expr) => expr.visitExpression(this, ctx), expressions, ctx, separator);
|
|
4081
4039
|
}
|
|
@@ -4166,8 +4124,7 @@ function guardedExpression(guard, expr) {
|
|
|
4166
4124
|
/* type */
|
|
4167
4125
|
void 0,
|
|
4168
4126
|
/* sourceSpan */
|
|
4169
|
-
void 0
|
|
4170
|
-
true
|
|
4127
|
+
void 0
|
|
4171
4128
|
);
|
|
4172
4129
|
return new BinaryOperatorExpr(BinaryOperator.And, guardUndefinedOrTrue, expr);
|
|
4173
4130
|
}
|
|
@@ -4706,6 +4663,19 @@ var TypeofExpression = class extends AST {
|
|
|
4706
4663
|
return visitor.visitTypeofExpression(this, context);
|
|
4707
4664
|
}
|
|
4708
4665
|
};
|
|
4666
|
+
var VoidExpression = class extends AST {
|
|
4667
|
+
static {
|
|
4668
|
+
__name(this, "VoidExpression");
|
|
4669
|
+
}
|
|
4670
|
+
expression;
|
|
4671
|
+
constructor(span, sourceSpan, expression) {
|
|
4672
|
+
super(span, sourceSpan);
|
|
4673
|
+
this.expression = expression;
|
|
4674
|
+
}
|
|
4675
|
+
visit(visitor, context = null) {
|
|
4676
|
+
return visitor.visitVoidExpression(this, context);
|
|
4677
|
+
}
|
|
4678
|
+
};
|
|
4709
4679
|
var NonNullAssert = class extends AST {
|
|
4710
4680
|
static {
|
|
4711
4681
|
__name(this, "NonNullAssert");
|
|
@@ -4753,6 +4723,21 @@ var SafeCall = class extends AST {
|
|
|
4753
4723
|
return visitor.visitSafeCall(this, context);
|
|
4754
4724
|
}
|
|
4755
4725
|
};
|
|
4726
|
+
var TaggedTemplateLiteral = class extends AST {
|
|
4727
|
+
static {
|
|
4728
|
+
__name(this, "TaggedTemplateLiteral");
|
|
4729
|
+
}
|
|
4730
|
+
tag;
|
|
4731
|
+
template;
|
|
4732
|
+
constructor(span, sourceSpan, tag, template2) {
|
|
4733
|
+
super(span, sourceSpan);
|
|
4734
|
+
this.tag = tag;
|
|
4735
|
+
this.template = template2;
|
|
4736
|
+
}
|
|
4737
|
+
visit(visitor, context) {
|
|
4738
|
+
return visitor.visitTaggedTemplateLiteral(this, context);
|
|
4739
|
+
}
|
|
4740
|
+
};
|
|
4756
4741
|
var TemplateLiteral = class extends AST {
|
|
4757
4742
|
static {
|
|
4758
4743
|
__name(this, "TemplateLiteral");
|
|
@@ -4781,6 +4766,19 @@ var TemplateLiteralElement = class extends AST {
|
|
|
4781
4766
|
return visitor.visitTemplateLiteralElement(this, context);
|
|
4782
4767
|
}
|
|
4783
4768
|
};
|
|
4769
|
+
var ParenthesizedExpression = class extends AST {
|
|
4770
|
+
static {
|
|
4771
|
+
__name(this, "ParenthesizedExpression");
|
|
4772
|
+
}
|
|
4773
|
+
expression;
|
|
4774
|
+
constructor(span, sourceSpan, expression) {
|
|
4775
|
+
super(span, sourceSpan);
|
|
4776
|
+
this.expression = expression;
|
|
4777
|
+
}
|
|
4778
|
+
visit(visitor, context) {
|
|
4779
|
+
return visitor.visitParenthesizedExpression(this, context);
|
|
4780
|
+
}
|
|
4781
|
+
};
|
|
4784
4782
|
var AbsoluteSourceSpan = class {
|
|
4785
4783
|
static {
|
|
4786
4784
|
__name(this, "AbsoluteSourceSpan");
|
|
@@ -4914,6 +4912,9 @@ var RecursiveAstVisitor2 = class {
|
|
|
4914
4912
|
visitTypeofExpression(ast, context) {
|
|
4915
4913
|
this.visit(ast.expression, context);
|
|
4916
4914
|
}
|
|
4915
|
+
visitVoidExpression(ast, context) {
|
|
4916
|
+
this.visit(ast.expression, context);
|
|
4917
|
+
}
|
|
4917
4918
|
visitNonNullAssert(ast, context) {
|
|
4918
4919
|
this.visit(ast.expression, context);
|
|
4919
4920
|
}
|
|
@@ -4950,6 +4951,13 @@ var RecursiveAstVisitor2 = class {
|
|
|
4950
4951
|
}
|
|
4951
4952
|
visitTemplateLiteralElement(ast, context) {
|
|
4952
4953
|
}
|
|
4954
|
+
visitTaggedTemplateLiteral(ast, context) {
|
|
4955
|
+
this.visit(ast.tag, context);
|
|
4956
|
+
this.visit(ast.template, context);
|
|
4957
|
+
}
|
|
4958
|
+
visitParenthesizedExpression(ast, context) {
|
|
4959
|
+
this.visit(ast.expression, context);
|
|
4960
|
+
}
|
|
4953
4961
|
// This is not part of the AstVisitor interface, just a helper method
|
|
4954
4962
|
visitAll(asts, context) {
|
|
4955
4963
|
for (const ast of asts) {
|
|
@@ -5246,17 +5254,19 @@ var Element$1 = class Element {
|
|
|
5246
5254
|
attributes;
|
|
5247
5255
|
inputs;
|
|
5248
5256
|
outputs;
|
|
5257
|
+
directives;
|
|
5249
5258
|
children;
|
|
5250
5259
|
references;
|
|
5251
5260
|
sourceSpan;
|
|
5252
5261
|
startSourceSpan;
|
|
5253
5262
|
endSourceSpan;
|
|
5254
5263
|
i18n;
|
|
5255
|
-
constructor(name, attributes, inputs, outputs, children, references, sourceSpan, startSourceSpan, endSourceSpan, i18n2) {
|
|
5264
|
+
constructor(name, attributes, inputs, outputs, directives, children, references, sourceSpan, startSourceSpan, endSourceSpan, i18n2) {
|
|
5256
5265
|
this.name = name;
|
|
5257
5266
|
this.attributes = attributes;
|
|
5258
5267
|
this.inputs = inputs;
|
|
5259
5268
|
this.outputs = outputs;
|
|
5269
|
+
this.directives = directives;
|
|
5260
5270
|
this.children = children;
|
|
5261
5271
|
this.references = references;
|
|
5262
5272
|
this.sourceSpan = sourceSpan;
|
|
@@ -5618,6 +5628,70 @@ var LetDeclaration$1 = class LetDeclaration {
|
|
|
5618
5628
|
return visitor.visitLetDeclaration(this);
|
|
5619
5629
|
}
|
|
5620
5630
|
};
|
|
5631
|
+
var Component$1 = class Component {
|
|
5632
|
+
static {
|
|
5633
|
+
__name(this, "Component");
|
|
5634
|
+
}
|
|
5635
|
+
componentName;
|
|
5636
|
+
tagName;
|
|
5637
|
+
fullName;
|
|
5638
|
+
attributes;
|
|
5639
|
+
inputs;
|
|
5640
|
+
outputs;
|
|
5641
|
+
directives;
|
|
5642
|
+
children;
|
|
5643
|
+
references;
|
|
5644
|
+
sourceSpan;
|
|
5645
|
+
startSourceSpan;
|
|
5646
|
+
endSourceSpan;
|
|
5647
|
+
i18n;
|
|
5648
|
+
constructor(componentName, tagName, fullName, attributes, inputs, outputs, directives, children, references, sourceSpan, startSourceSpan, endSourceSpan, i18n2) {
|
|
5649
|
+
this.componentName = componentName;
|
|
5650
|
+
this.tagName = tagName;
|
|
5651
|
+
this.fullName = fullName;
|
|
5652
|
+
this.attributes = attributes;
|
|
5653
|
+
this.inputs = inputs;
|
|
5654
|
+
this.outputs = outputs;
|
|
5655
|
+
this.directives = directives;
|
|
5656
|
+
this.children = children;
|
|
5657
|
+
this.references = references;
|
|
5658
|
+
this.sourceSpan = sourceSpan;
|
|
5659
|
+
this.startSourceSpan = startSourceSpan;
|
|
5660
|
+
this.endSourceSpan = endSourceSpan;
|
|
5661
|
+
this.i18n = i18n2;
|
|
5662
|
+
}
|
|
5663
|
+
visit(visitor) {
|
|
5664
|
+
return visitor.visitComponent(this);
|
|
5665
|
+
}
|
|
5666
|
+
};
|
|
5667
|
+
var Directive$1 = class Directive {
|
|
5668
|
+
static {
|
|
5669
|
+
__name(this, "Directive");
|
|
5670
|
+
}
|
|
5671
|
+
name;
|
|
5672
|
+
attributes;
|
|
5673
|
+
inputs;
|
|
5674
|
+
outputs;
|
|
5675
|
+
references;
|
|
5676
|
+
sourceSpan;
|
|
5677
|
+
startSourceSpan;
|
|
5678
|
+
endSourceSpan;
|
|
5679
|
+
i18n;
|
|
5680
|
+
constructor(name, attributes, inputs, outputs, references, sourceSpan, startSourceSpan, endSourceSpan, i18n2) {
|
|
5681
|
+
this.name = name;
|
|
5682
|
+
this.attributes = attributes;
|
|
5683
|
+
this.inputs = inputs;
|
|
5684
|
+
this.outputs = outputs;
|
|
5685
|
+
this.references = references;
|
|
5686
|
+
this.sourceSpan = sourceSpan;
|
|
5687
|
+
this.startSourceSpan = startSourceSpan;
|
|
5688
|
+
this.endSourceSpan = endSourceSpan;
|
|
5689
|
+
this.i18n = i18n2;
|
|
5690
|
+
}
|
|
5691
|
+
visit(visitor) {
|
|
5692
|
+
return visitor.visitDirective(this);
|
|
5693
|
+
}
|
|
5694
|
+
};
|
|
5621
5695
|
var Template = class {
|
|
5622
5696
|
static {
|
|
5623
5697
|
__name(this, "Template");
|
|
@@ -5626,6 +5700,7 @@ var Template = class {
|
|
|
5626
5700
|
attributes;
|
|
5627
5701
|
inputs;
|
|
5628
5702
|
outputs;
|
|
5703
|
+
directives;
|
|
5629
5704
|
templateAttrs;
|
|
5630
5705
|
children;
|
|
5631
5706
|
references;
|
|
@@ -5634,11 +5709,12 @@ var Template = class {
|
|
|
5634
5709
|
startSourceSpan;
|
|
5635
5710
|
endSourceSpan;
|
|
5636
5711
|
i18n;
|
|
5637
|
-
constructor(tagName, attributes, inputs, outputs, templateAttrs, children, references, variables, sourceSpan, startSourceSpan, endSourceSpan, i18n2) {
|
|
5712
|
+
constructor(tagName, attributes, inputs, outputs, directives, templateAttrs, children, references, variables, sourceSpan, startSourceSpan, endSourceSpan, i18n2) {
|
|
5638
5713
|
this.tagName = tagName;
|
|
5639
5714
|
this.attributes = attributes;
|
|
5640
5715
|
this.inputs = inputs;
|
|
5641
5716
|
this.outputs = outputs;
|
|
5717
|
+
this.directives = directives;
|
|
5642
5718
|
this.templateAttrs = templateAttrs;
|
|
5643
5719
|
this.children = children;
|
|
5644
5720
|
this.references = references;
|
|
@@ -5660,13 +5736,17 @@ var Content = class {
|
|
|
5660
5736
|
attributes;
|
|
5661
5737
|
children;
|
|
5662
5738
|
sourceSpan;
|
|
5739
|
+
startSourceSpan;
|
|
5740
|
+
endSourceSpan;
|
|
5663
5741
|
i18n;
|
|
5664
5742
|
name = "ng-content";
|
|
5665
|
-
constructor(selector, attributes, children, sourceSpan, i18n2) {
|
|
5743
|
+
constructor(selector, attributes, children, sourceSpan, startSourceSpan, endSourceSpan, i18n2) {
|
|
5666
5744
|
this.selector = selector;
|
|
5667
5745
|
this.attributes = attributes;
|
|
5668
5746
|
this.children = children;
|
|
5669
5747
|
this.sourceSpan = sourceSpan;
|
|
5748
|
+
this.startSourceSpan = startSourceSpan;
|
|
5749
|
+
this.endSourceSpan = endSourceSpan;
|
|
5670
5750
|
this.i18n = i18n2;
|
|
5671
5751
|
}
|
|
5672
5752
|
visit(visitor) {
|
|
@@ -5731,6 +5811,27 @@ var Icu$1 = class Icu {
|
|
|
5731
5811
|
return visitor.visitIcu(this);
|
|
5732
5812
|
}
|
|
5733
5813
|
};
|
|
5814
|
+
var HostElement = class {
|
|
5815
|
+
static {
|
|
5816
|
+
__name(this, "HostElement");
|
|
5817
|
+
}
|
|
5818
|
+
tagNames;
|
|
5819
|
+
bindings;
|
|
5820
|
+
listeners;
|
|
5821
|
+
sourceSpan;
|
|
5822
|
+
constructor(tagNames, bindings, listeners, sourceSpan) {
|
|
5823
|
+
this.tagNames = tagNames;
|
|
5824
|
+
this.bindings = bindings;
|
|
5825
|
+
this.listeners = listeners;
|
|
5826
|
+
this.sourceSpan = sourceSpan;
|
|
5827
|
+
if (tagNames.length === 0) {
|
|
5828
|
+
throw new Error("HostElement must have at least one tag name.");
|
|
5829
|
+
}
|
|
5830
|
+
}
|
|
5831
|
+
visit() {
|
|
5832
|
+
throw new Error(`HostElement cannot be visited`);
|
|
5833
|
+
}
|
|
5834
|
+
};
|
|
5734
5835
|
var RecursiveVisitor$1 = class RecursiveVisitor {
|
|
5735
5836
|
static {
|
|
5736
5837
|
__name(this, "RecursiveVisitor");
|
|
@@ -5739,6 +5840,7 @@ var RecursiveVisitor$1 = class RecursiveVisitor {
|
|
|
5739
5840
|
visitAll$1(this, element2.attributes);
|
|
5740
5841
|
visitAll$1(this, element2.inputs);
|
|
5741
5842
|
visitAll$1(this, element2.outputs);
|
|
5843
|
+
visitAll$1(this, element2.directives);
|
|
5742
5844
|
visitAll$1(this, element2.children);
|
|
5743
5845
|
visitAll$1(this, element2.references);
|
|
5744
5846
|
}
|
|
@@ -5746,6 +5848,7 @@ var RecursiveVisitor$1 = class RecursiveVisitor {
|
|
|
5746
5848
|
visitAll$1(this, template2.attributes);
|
|
5747
5849
|
visitAll$1(this, template2.inputs);
|
|
5748
5850
|
visitAll$1(this, template2.outputs);
|
|
5851
|
+
visitAll$1(this, template2.directives);
|
|
5749
5852
|
visitAll$1(this, template2.children);
|
|
5750
5853
|
visitAll$1(this, template2.references);
|
|
5751
5854
|
visitAll$1(this, template2.variables);
|
|
@@ -5787,6 +5890,20 @@ var RecursiveVisitor$1 = class RecursiveVisitor {
|
|
|
5787
5890
|
visitContent(content) {
|
|
5788
5891
|
visitAll$1(this, content.children);
|
|
5789
5892
|
}
|
|
5893
|
+
visitComponent(component) {
|
|
5894
|
+
visitAll$1(this, component.attributes);
|
|
5895
|
+
visitAll$1(this, component.inputs);
|
|
5896
|
+
visitAll$1(this, component.outputs);
|
|
5897
|
+
visitAll$1(this, component.directives);
|
|
5898
|
+
visitAll$1(this, component.children);
|
|
5899
|
+
visitAll$1(this, component.references);
|
|
5900
|
+
}
|
|
5901
|
+
visitDirective(directive) {
|
|
5902
|
+
visitAll$1(this, directive.attributes);
|
|
5903
|
+
visitAll$1(this, directive.inputs);
|
|
5904
|
+
visitAll$1(this, directive.outputs);
|
|
5905
|
+
visitAll$1(this, directive.references);
|
|
5906
|
+
}
|
|
5790
5907
|
visitVariable(variable2) {
|
|
5791
5908
|
}
|
|
5792
5909
|
visitReference(reference2) {
|
|
@@ -6459,8 +6576,8 @@ function isI18nAttribute(name) {
|
|
|
6459
6576
|
return name === I18N_ATTR || name.startsWith(I18N_ATTR_PREFIX);
|
|
6460
6577
|
}
|
|
6461
6578
|
__name(isI18nAttribute, "isI18nAttribute");
|
|
6462
|
-
function hasI18nAttrs(
|
|
6463
|
-
return
|
|
6579
|
+
function hasI18nAttrs(node) {
|
|
6580
|
+
return node.attrs.some((attr) => isI18nAttribute(attr.name));
|
|
6464
6581
|
}
|
|
6465
6582
|
__name(hasI18nAttrs, "hasI18nAttrs");
|
|
6466
6583
|
function icuFromI18nMessage(message) {
|
|
@@ -8385,46 +8502,48 @@ var OpKind;
|
|
|
8385
8502
|
OpKind2[OpKind2["Container"] = 8] = "Container";
|
|
8386
8503
|
OpKind2[OpKind2["ContainerEnd"] = 9] = "ContainerEnd";
|
|
8387
8504
|
OpKind2[OpKind2["DisableBindings"] = 10] = "DisableBindings";
|
|
8388
|
-
OpKind2[OpKind2["
|
|
8389
|
-
OpKind2[OpKind2["
|
|
8390
|
-
OpKind2[OpKind2["
|
|
8391
|
-
OpKind2[OpKind2["
|
|
8392
|
-
OpKind2[OpKind2["
|
|
8393
|
-
OpKind2[OpKind2["
|
|
8394
|
-
OpKind2[OpKind2["
|
|
8395
|
-
OpKind2[OpKind2["
|
|
8396
|
-
OpKind2[OpKind2["
|
|
8397
|
-
OpKind2[OpKind2["
|
|
8398
|
-
OpKind2[OpKind2["
|
|
8399
|
-
OpKind2[OpKind2["
|
|
8400
|
-
OpKind2[OpKind2["
|
|
8401
|
-
OpKind2[OpKind2["
|
|
8402
|
-
OpKind2[OpKind2["
|
|
8403
|
-
OpKind2[OpKind2["
|
|
8404
|
-
OpKind2[OpKind2["
|
|
8405
|
-
OpKind2[OpKind2["
|
|
8406
|
-
OpKind2[OpKind2["
|
|
8407
|
-
OpKind2[OpKind2["
|
|
8408
|
-
OpKind2[OpKind2["
|
|
8409
|
-
OpKind2[OpKind2["
|
|
8410
|
-
OpKind2[OpKind2["
|
|
8411
|
-
OpKind2[OpKind2["
|
|
8412
|
-
OpKind2[OpKind2["
|
|
8413
|
-
OpKind2[OpKind2["
|
|
8414
|
-
OpKind2[OpKind2["
|
|
8415
|
-
OpKind2[OpKind2["
|
|
8416
|
-
OpKind2[OpKind2["
|
|
8417
|
-
OpKind2[OpKind2["
|
|
8418
|
-
OpKind2[OpKind2["
|
|
8419
|
-
OpKind2[OpKind2["
|
|
8420
|
-
OpKind2[OpKind2["
|
|
8421
|
-
OpKind2[OpKind2["
|
|
8422
|
-
OpKind2[OpKind2["
|
|
8423
|
-
OpKind2[OpKind2["
|
|
8424
|
-
OpKind2[OpKind2["
|
|
8425
|
-
OpKind2[OpKind2["
|
|
8426
|
-
OpKind2[OpKind2["
|
|
8427
|
-
OpKind2[OpKind2["
|
|
8505
|
+
OpKind2[OpKind2["ConditionalCreate"] = 11] = "ConditionalCreate";
|
|
8506
|
+
OpKind2[OpKind2["ConditionalBranchCreate"] = 12] = "ConditionalBranchCreate";
|
|
8507
|
+
OpKind2[OpKind2["Conditional"] = 13] = "Conditional";
|
|
8508
|
+
OpKind2[OpKind2["EnableBindings"] = 14] = "EnableBindings";
|
|
8509
|
+
OpKind2[OpKind2["Text"] = 15] = "Text";
|
|
8510
|
+
OpKind2[OpKind2["Listener"] = 16] = "Listener";
|
|
8511
|
+
OpKind2[OpKind2["InterpolateText"] = 17] = "InterpolateText";
|
|
8512
|
+
OpKind2[OpKind2["Binding"] = 18] = "Binding";
|
|
8513
|
+
OpKind2[OpKind2["Property"] = 19] = "Property";
|
|
8514
|
+
OpKind2[OpKind2["StyleProp"] = 20] = "StyleProp";
|
|
8515
|
+
OpKind2[OpKind2["ClassProp"] = 21] = "ClassProp";
|
|
8516
|
+
OpKind2[OpKind2["StyleMap"] = 22] = "StyleMap";
|
|
8517
|
+
OpKind2[OpKind2["ClassMap"] = 23] = "ClassMap";
|
|
8518
|
+
OpKind2[OpKind2["Advance"] = 24] = "Advance";
|
|
8519
|
+
OpKind2[OpKind2["Pipe"] = 25] = "Pipe";
|
|
8520
|
+
OpKind2[OpKind2["Attribute"] = 26] = "Attribute";
|
|
8521
|
+
OpKind2[OpKind2["ExtractedAttribute"] = 27] = "ExtractedAttribute";
|
|
8522
|
+
OpKind2[OpKind2["Defer"] = 28] = "Defer";
|
|
8523
|
+
OpKind2[OpKind2["DeferOn"] = 29] = "DeferOn";
|
|
8524
|
+
OpKind2[OpKind2["DeferWhen"] = 30] = "DeferWhen";
|
|
8525
|
+
OpKind2[OpKind2["I18nMessage"] = 31] = "I18nMessage";
|
|
8526
|
+
OpKind2[OpKind2["DomProperty"] = 32] = "DomProperty";
|
|
8527
|
+
OpKind2[OpKind2["Namespace"] = 33] = "Namespace";
|
|
8528
|
+
OpKind2[OpKind2["ProjectionDef"] = 34] = "ProjectionDef";
|
|
8529
|
+
OpKind2[OpKind2["Projection"] = 35] = "Projection";
|
|
8530
|
+
OpKind2[OpKind2["RepeaterCreate"] = 36] = "RepeaterCreate";
|
|
8531
|
+
OpKind2[OpKind2["Repeater"] = 37] = "Repeater";
|
|
8532
|
+
OpKind2[OpKind2["TwoWayProperty"] = 38] = "TwoWayProperty";
|
|
8533
|
+
OpKind2[OpKind2["TwoWayListener"] = 39] = "TwoWayListener";
|
|
8534
|
+
OpKind2[OpKind2["DeclareLet"] = 40] = "DeclareLet";
|
|
8535
|
+
OpKind2[OpKind2["StoreLet"] = 41] = "StoreLet";
|
|
8536
|
+
OpKind2[OpKind2["I18nStart"] = 42] = "I18nStart";
|
|
8537
|
+
OpKind2[OpKind2["I18n"] = 43] = "I18n";
|
|
8538
|
+
OpKind2[OpKind2["I18nEnd"] = 44] = "I18nEnd";
|
|
8539
|
+
OpKind2[OpKind2["I18nExpression"] = 45] = "I18nExpression";
|
|
8540
|
+
OpKind2[OpKind2["I18nApply"] = 46] = "I18nApply";
|
|
8541
|
+
OpKind2[OpKind2["IcuStart"] = 47] = "IcuStart";
|
|
8542
|
+
OpKind2[OpKind2["IcuEnd"] = 48] = "IcuEnd";
|
|
8543
|
+
OpKind2[OpKind2["IcuPlaceholder"] = 49] = "IcuPlaceholder";
|
|
8544
|
+
OpKind2[OpKind2["I18nContext"] = 50] = "I18nContext";
|
|
8545
|
+
OpKind2[OpKind2["I18nAttributes"] = 51] = "I18nAttributes";
|
|
8546
|
+
OpKind2[OpKind2["SourceLocation"] = 52] = "SourceLocation";
|
|
8428
8547
|
})(OpKind || (OpKind = {}));
|
|
8429
8548
|
var ExpressionKind;
|
|
8430
8549
|
(function(ExpressionKind2) {
|
|
@@ -9665,7 +9784,7 @@ function transformExpressionsInOp(op, transform2, flags) {
|
|
|
9665
9784
|
}
|
|
9666
9785
|
break;
|
|
9667
9786
|
case OpKind.Property:
|
|
9668
|
-
case OpKind.
|
|
9787
|
+
case OpKind.DomProperty:
|
|
9669
9788
|
case OpKind.Attribute:
|
|
9670
9789
|
if (op.expression instanceof Interpolation2) {
|
|
9671
9790
|
transformExpressionsInInterpolation(op.expression, transform2, flags);
|
|
@@ -9781,6 +9900,8 @@ function transformExpressionsInOp(op, transform2, flags) {
|
|
|
9781
9900
|
case OpKind.IcuPlaceholder:
|
|
9782
9901
|
case OpKind.DeclareLet:
|
|
9783
9902
|
case OpKind.SourceLocation:
|
|
9903
|
+
case OpKind.ConditionalCreate:
|
|
9904
|
+
case OpKind.ConditionalBranchCreate:
|
|
9784
9905
|
break;
|
|
9785
9906
|
default:
|
|
9786
9907
|
throw new Error(`AssertionError: transformExpressionsInOp doesn't handle ${OpKind[op.kind]}`);
|
|
@@ -9828,6 +9949,8 @@ function transformExpressionsInExpression(expr, transform2, flags) {
|
|
|
9828
9949
|
}
|
|
9829
9950
|
} else if (expr instanceof TypeofExpr) {
|
|
9830
9951
|
expr.expr = transformExpressionsInExpression(expr.expr, transform2, flags);
|
|
9952
|
+
} else if (expr instanceof VoidExpr) {
|
|
9953
|
+
expr.expr = transformExpressionsInExpression(expr.expr, transform2, flags);
|
|
9831
9954
|
} else if (expr instanceof WriteVarExpr) {
|
|
9832
9955
|
expr.value = transformExpressionsInExpression(expr.value, transform2, flags);
|
|
9833
9956
|
} else if (expr instanceof LocalizedString) {
|
|
@@ -9852,6 +9975,8 @@ function transformExpressionsInExpression(expr, transform2, flags) {
|
|
|
9852
9975
|
for (let i = 0; i < expr.expressions.length; i++) {
|
|
9853
9976
|
expr.expressions[i] = transformExpressionsInExpression(expr.expressions[i], transform2, flags);
|
|
9854
9977
|
}
|
|
9978
|
+
} else if (expr instanceof ParenthesizedExpr) {
|
|
9979
|
+
expr.expr = transformExpressionsInExpression(expr.expr, transform2, flags);
|
|
9855
9980
|
} else if (expr instanceof ReadVarExpr || expr instanceof ExternalExpr || expr instanceof LiteralExpr) ;
|
|
9856
9981
|
else {
|
|
9857
9982
|
throw new Error(`Unhandled expression kind: ${expr.constructor.name}`);
|
|
@@ -10130,7 +10255,9 @@ var elementContainerOpKinds = /* @__PURE__ */ new Set([
|
|
|
10130
10255
|
OpKind.Container,
|
|
10131
10256
|
OpKind.ContainerStart,
|
|
10132
10257
|
OpKind.Template,
|
|
10133
|
-
OpKind.RepeaterCreate
|
|
10258
|
+
OpKind.RepeaterCreate,
|
|
10259
|
+
OpKind.ConditionalCreate,
|
|
10260
|
+
OpKind.ConditionalBranchCreate
|
|
10134
10261
|
]);
|
|
10135
10262
|
function isElementOrContainerOp(op) {
|
|
10136
10263
|
return elementContainerOpKinds.has(op.kind);
|
|
@@ -10176,11 +10303,55 @@ function createTemplateOp(xref, templateKind, tag, functionNameSuffix, namespace
|
|
|
10176
10303
|
};
|
|
10177
10304
|
}
|
|
10178
10305
|
__name(createTemplateOp, "createTemplateOp");
|
|
10179
|
-
function
|
|
10306
|
+
function createConditionalCreateOp(xref, templateKind, tag, functionNameSuffix, namespace, i18nPlaceholder, startSourceSpan, wholeSourceSpan) {
|
|
10180
10307
|
return {
|
|
10181
|
-
kind: OpKind.
|
|
10308
|
+
kind: OpKind.ConditionalCreate,
|
|
10309
|
+
xref,
|
|
10310
|
+
templateKind,
|
|
10182
10311
|
attributes: null,
|
|
10183
|
-
|
|
10312
|
+
tag,
|
|
10313
|
+
handle: new SlotHandle(),
|
|
10314
|
+
functionNameSuffix,
|
|
10315
|
+
decls: null,
|
|
10316
|
+
vars: null,
|
|
10317
|
+
localRefs: [],
|
|
10318
|
+
nonBindable: false,
|
|
10319
|
+
namespace,
|
|
10320
|
+
i18nPlaceholder,
|
|
10321
|
+
startSourceSpan,
|
|
10322
|
+
wholeSourceSpan,
|
|
10323
|
+
...TRAIT_CONSUMES_SLOT,
|
|
10324
|
+
...NEW_OP
|
|
10325
|
+
};
|
|
10326
|
+
}
|
|
10327
|
+
__name(createConditionalCreateOp, "createConditionalCreateOp");
|
|
10328
|
+
function createConditionalBranchCreateOp(xref, templateKind, tag, functionNameSuffix, namespace, i18nPlaceholder, startSourceSpan, wholeSourceSpan) {
|
|
10329
|
+
return {
|
|
10330
|
+
kind: OpKind.ConditionalBranchCreate,
|
|
10331
|
+
xref,
|
|
10332
|
+
templateKind,
|
|
10333
|
+
attributes: null,
|
|
10334
|
+
tag,
|
|
10335
|
+
handle: new SlotHandle(),
|
|
10336
|
+
functionNameSuffix,
|
|
10337
|
+
decls: null,
|
|
10338
|
+
vars: null,
|
|
10339
|
+
localRefs: [],
|
|
10340
|
+
nonBindable: false,
|
|
10341
|
+
namespace,
|
|
10342
|
+
i18nPlaceholder,
|
|
10343
|
+
startSourceSpan,
|
|
10344
|
+
wholeSourceSpan,
|
|
10345
|
+
...TRAIT_CONSUMES_SLOT,
|
|
10346
|
+
...NEW_OP
|
|
10347
|
+
};
|
|
10348
|
+
}
|
|
10349
|
+
__name(createConditionalBranchCreateOp, "createConditionalBranchCreateOp");
|
|
10350
|
+
function createRepeaterCreateOp(primaryView, emptyView, tag, track, varNames, emptyTag, i18nPlaceholder, emptyI18nPlaceholder, startSourceSpan, wholeSourceSpan) {
|
|
10351
|
+
return {
|
|
10352
|
+
kind: OpKind.RepeaterCreate,
|
|
10353
|
+
attributes: null,
|
|
10354
|
+
xref: primaryView,
|
|
10184
10355
|
handle: new SlotHandle(),
|
|
10185
10356
|
emptyView,
|
|
10186
10357
|
track,
|
|
@@ -10505,9 +10676,9 @@ function createSourceLocationOp(templatePath, locations) {
|
|
|
10505
10676
|
};
|
|
10506
10677
|
}
|
|
10507
10678
|
__name(createSourceLocationOp, "createSourceLocationOp");
|
|
10508
|
-
function
|
|
10679
|
+
function createDomPropertyOp(name, expression, isAnimationTrigger, i18nContext, securityContext, sourceSpan) {
|
|
10509
10680
|
return {
|
|
10510
|
-
kind: OpKind.
|
|
10681
|
+
kind: OpKind.DomProperty,
|
|
10511
10682
|
name,
|
|
10512
10683
|
expression,
|
|
10513
10684
|
isAnimationTrigger,
|
|
@@ -10519,7 +10690,7 @@ function createHostPropertyOp(name, expression, isAnimationTrigger, i18nContext,
|
|
|
10519
10690
|
...NEW_OP
|
|
10520
10691
|
};
|
|
10521
10692
|
}
|
|
10522
|
-
__name(
|
|
10693
|
+
__name(createDomPropertyOp, "createDomPropertyOp");
|
|
10523
10694
|
var CTX_REF = "CTX_REF_MARKER";
|
|
10524
10695
|
var CompilationJobKind;
|
|
10525
10696
|
(function(CompilationJobKind2) {
|
|
@@ -10824,7 +10995,20 @@ function assignI18nSlotDependencies(job) {
|
|
|
10824
10995
|
i18nExpressionsInProgress.push(opToRemove);
|
|
10825
10996
|
continue;
|
|
10826
10997
|
}
|
|
10998
|
+
let hasDifferentTarget = false;
|
|
10827
10999
|
if (hasDependsOnSlotContextTrait(updateOp) && updateOp.target !== createOp.xref) {
|
|
11000
|
+
hasDifferentTarget = true;
|
|
11001
|
+
} else if (
|
|
11002
|
+
// Some expressions may consume slots as well (e.g. `storeLet`).
|
|
11003
|
+
updateOp.kind === OpKind.Statement || updateOp.kind === OpKind.Variable
|
|
11004
|
+
) {
|
|
11005
|
+
visitExpressionsInOp(updateOp, (expr) => {
|
|
11006
|
+
if (!hasDifferentTarget && hasDependsOnSlotContextTrait(expr) && expr.target !== createOp.xref) {
|
|
11007
|
+
hasDifferentTarget = true;
|
|
11008
|
+
}
|
|
11009
|
+
});
|
|
11010
|
+
}
|
|
11011
|
+
if (hasDifferentTarget) {
|
|
10828
11012
|
break;
|
|
10829
11013
|
}
|
|
10830
11014
|
updateOp = updateOp.next;
|
|
@@ -10834,6 +11018,29 @@ function assignI18nSlotDependencies(job) {
|
|
|
10834
11018
|
}
|
|
10835
11019
|
}
|
|
10836
11020
|
__name(assignI18nSlotDependencies, "assignI18nSlotDependencies");
|
|
11021
|
+
function attachSourceLocations(job) {
|
|
11022
|
+
if (!job.enableDebugLocations || job.relativeTemplatePath === null) {
|
|
11023
|
+
return;
|
|
11024
|
+
}
|
|
11025
|
+
for (const unit of job.units) {
|
|
11026
|
+
const locations = [];
|
|
11027
|
+
for (const op of unit.create) {
|
|
11028
|
+
if (op.kind === OpKind.ElementStart || op.kind === OpKind.Element) {
|
|
11029
|
+
const start = op.startSourceSpan.start;
|
|
11030
|
+
locations.push({
|
|
11031
|
+
targetSlot: op.handle,
|
|
11032
|
+
offset: start.offset,
|
|
11033
|
+
line: start.line,
|
|
11034
|
+
column: start.col
|
|
11035
|
+
});
|
|
11036
|
+
}
|
|
11037
|
+
}
|
|
11038
|
+
if (locations.length > 0) {
|
|
11039
|
+
unit.create.push(createSourceLocationOp(job.relativeTemplatePath, locations));
|
|
11040
|
+
}
|
|
11041
|
+
}
|
|
11042
|
+
}
|
|
11043
|
+
__name(attachSourceLocations, "attachSourceLocations");
|
|
10837
11044
|
function createOpXrefMap(unit) {
|
|
10838
11045
|
const map = /* @__PURE__ */ new Map();
|
|
10839
11046
|
for (const op of unit.create) {
|
|
@@ -11031,7 +11238,7 @@ function specializeBindings(job) {
|
|
|
11031
11238
|
case BindingKind.Property:
|
|
11032
11239
|
case BindingKind.Animation:
|
|
11033
11240
|
if (job.kind === CompilationJobKind.Host) {
|
|
11034
|
-
OpList.replace(op,
|
|
11241
|
+
OpList.replace(op, createDomPropertyOp(op.name, op.expression, op.bindingKind === BindingKind.Animation, op.i18nContext, op.securityContext, op.sourceSpan));
|
|
11035
11242
|
} else {
|
|
11036
11243
|
OpList.replace(op, createPropertyOp(op.target, op.name, op.expression, op.bindingKind === BindingKind.Animation, op.securityContext, op.isStructuralTemplateAttribute, op.templateKind, op.i18nContext, op.i18nMessage, op.sourceSpan));
|
|
11037
11244
|
}
|
|
@@ -11051,36 +11258,29 @@ function specializeBindings(job) {
|
|
|
11051
11258
|
}
|
|
11052
11259
|
}
|
|
11053
11260
|
__name(specializeBindings, "specializeBindings");
|
|
11054
|
-
var
|
|
11055
|
-
Identifiers.attribute,
|
|
11056
|
-
Identifiers.classProp,
|
|
11057
|
-
Identifiers.element,
|
|
11058
|
-
Identifiers.elementContainer,
|
|
11059
|
-
Identifiers.elementContainerEnd,
|
|
11060
|
-
Identifiers.elementContainerStart,
|
|
11061
|
-
Identifiers.elementEnd,
|
|
11062
|
-
Identifiers.elementStart,
|
|
11063
|
-
Identifiers.
|
|
11064
|
-
Identifiers.i18nExp,
|
|
11065
|
-
Identifiers.listener,
|
|
11066
|
-
Identifiers.listener,
|
|
11067
|
-
Identifiers.property,
|
|
11068
|
-
Identifiers.styleProp,
|
|
11069
|
-
Identifiers.
|
|
11070
|
-
Identifiers.
|
|
11071
|
-
Identifiers.
|
|
11072
|
-
Identifiers.
|
|
11073
|
-
Identifiers.
|
|
11074
|
-
Identifiers.
|
|
11075
|
-
Identifiers.
|
|
11076
|
-
Identifiers.
|
|
11077
|
-
Identifiers.stylePropInterpolateV,
|
|
11078
|
-
Identifiers.syntheticHostListener,
|
|
11079
|
-
Identifiers.syntheticHostProperty,
|
|
11080
|
-
Identifiers.templateCreate,
|
|
11081
|
-
Identifiers.twoWayProperty,
|
|
11082
|
-
Identifiers.twoWayListener,
|
|
11083
|
-
Identifiers.declareLet
|
|
11261
|
+
var CHAIN_COMPATIBILITY = /* @__PURE__ */ new Map([
|
|
11262
|
+
[Identifiers.attribute, Identifiers.attribute],
|
|
11263
|
+
[Identifiers.classProp, Identifiers.classProp],
|
|
11264
|
+
[Identifiers.element, Identifiers.element],
|
|
11265
|
+
[Identifiers.elementContainer, Identifiers.elementContainer],
|
|
11266
|
+
[Identifiers.elementContainerEnd, Identifiers.elementContainerEnd],
|
|
11267
|
+
[Identifiers.elementContainerStart, Identifiers.elementContainerStart],
|
|
11268
|
+
[Identifiers.elementEnd, Identifiers.elementEnd],
|
|
11269
|
+
[Identifiers.elementStart, Identifiers.elementStart],
|
|
11270
|
+
[Identifiers.domProperty, Identifiers.domProperty],
|
|
11271
|
+
[Identifiers.i18nExp, Identifiers.i18nExp],
|
|
11272
|
+
[Identifiers.listener, Identifiers.listener],
|
|
11273
|
+
[Identifiers.listener, Identifiers.listener],
|
|
11274
|
+
[Identifiers.property, Identifiers.property],
|
|
11275
|
+
[Identifiers.styleProp, Identifiers.styleProp],
|
|
11276
|
+
[Identifiers.syntheticHostListener, Identifiers.syntheticHostListener],
|
|
11277
|
+
[Identifiers.syntheticHostProperty, Identifiers.syntheticHostProperty],
|
|
11278
|
+
[Identifiers.templateCreate, Identifiers.templateCreate],
|
|
11279
|
+
[Identifiers.twoWayProperty, Identifiers.twoWayProperty],
|
|
11280
|
+
[Identifiers.twoWayListener, Identifiers.twoWayListener],
|
|
11281
|
+
[Identifiers.declareLet, Identifiers.declareLet],
|
|
11282
|
+
[Identifiers.conditionalCreate, Identifiers.conditionalBranchCreate],
|
|
11283
|
+
[Identifiers.conditionalBranchCreate, Identifiers.conditionalBranchCreate]
|
|
11084
11284
|
]);
|
|
11085
11285
|
var MAX_CHAIN_LENGTH = 256;
|
|
11086
11286
|
function chain(job) {
|
|
@@ -11102,11 +11302,11 @@ function chainOperationsInList(opList) {
|
|
|
11102
11302
|
continue;
|
|
11103
11303
|
}
|
|
11104
11304
|
const instruction = op.statement.expr.fn.value;
|
|
11105
|
-
if (!
|
|
11305
|
+
if (!CHAIN_COMPATIBILITY.has(instruction)) {
|
|
11106
11306
|
chain2 = null;
|
|
11107
11307
|
continue;
|
|
11108
11308
|
}
|
|
11109
|
-
if (chain2 !== null && chain2.instruction === instruction && chain2.length < MAX_CHAIN_LENGTH) {
|
|
11309
|
+
if (chain2 !== null && CHAIN_COMPATIBILITY.get(chain2.instruction) === instruction && chain2.length < MAX_CHAIN_LENGTH) {
|
|
11110
11310
|
const expression = chain2.expression.callFn(op.statement.expr.args, op.statement.expr.sourceSpan, op.statement.expr.pure);
|
|
11111
11311
|
chain2.expression = expression;
|
|
11112
11312
|
chain2.op.statement = expression.toStmt();
|
|
@@ -11126,7 +11326,7 @@ __name(chainOperationsInList, "chainOperationsInList");
|
|
|
11126
11326
|
function collapseSingletonInterpolations(job) {
|
|
11127
11327
|
for (const unit of job.units) {
|
|
11128
11328
|
for (const op of unit.update) {
|
|
11129
|
-
const eligibleOpKind = op.kind === OpKind.Attribute;
|
|
11329
|
+
const eligibleOpKind = op.kind === OpKind.Attribute || op.kind === OpKind.StyleProp || op.kind == OpKind.StyleMap || op.kind === OpKind.ClassMap;
|
|
11130
11330
|
if (eligibleOpKind && op.expression instanceof Interpolation2 && op.expression.strings.length === 2 && op.expression.strings.every((s) => s === "")) {
|
|
11131
11331
|
op.expression = op.expression.expressions[0];
|
|
11132
11332
|
}
|
|
@@ -11183,12 +11383,14 @@ var BINARY_OPERATORS = /* @__PURE__ */ new Map([
|
|
|
11183
11383
|
["<=", BinaryOperator.LowerEquals],
|
|
11184
11384
|
["-", BinaryOperator.Minus],
|
|
11185
11385
|
["%", BinaryOperator.Modulo],
|
|
11386
|
+
["**", BinaryOperator.Exponentiation],
|
|
11186
11387
|
["*", BinaryOperator.Multiply],
|
|
11187
11388
|
["!=", BinaryOperator.NotEquals],
|
|
11188
11389
|
["!==", BinaryOperator.NotIdentical],
|
|
11189
11390
|
["??", BinaryOperator.NullishCoalesce],
|
|
11190
11391
|
["||", BinaryOperator.Or],
|
|
11191
|
-
["+", BinaryOperator.Plus]
|
|
11392
|
+
["+", BinaryOperator.Plus],
|
|
11393
|
+
["in", BinaryOperator.In]
|
|
11192
11394
|
]);
|
|
11193
11395
|
function namespaceForKey(namespacePrefixKey) {
|
|
11194
11396
|
const NAMESPACES = /* @__PURE__ */ new Map([
|
|
@@ -11455,30 +11657,6 @@ function convertI18nBindings(job) {
|
|
|
11455
11657
|
}
|
|
11456
11658
|
}
|
|
11457
11659
|
__name(convertI18nBindings, "convertI18nBindings");
|
|
11458
|
-
function resolveDeferDepsFns(job) {
|
|
11459
|
-
for (const unit of job.units) {
|
|
11460
|
-
for (const op of unit.create) {
|
|
11461
|
-
if (op.kind === OpKind.Defer) {
|
|
11462
|
-
if (op.resolverFn !== null) {
|
|
11463
|
-
continue;
|
|
11464
|
-
}
|
|
11465
|
-
if (op.ownResolverFn !== null) {
|
|
11466
|
-
if (op.handle.slot === null) {
|
|
11467
|
-
throw new Error("AssertionError: slot must be assigned before extracting defer deps functions");
|
|
11468
|
-
}
|
|
11469
|
-
const fullPathName = unit.fnName?.replace("_Template", "");
|
|
11470
|
-
op.resolverFn = job.pool.getSharedFunctionReference(
|
|
11471
|
-
op.ownResolverFn,
|
|
11472
|
-
`${fullPathName}_Defer_${op.handle.slot}_DepsFn`,
|
|
11473
|
-
/* Don't use unique names for TDB compatibility */
|
|
11474
|
-
false
|
|
11475
|
-
);
|
|
11476
|
-
}
|
|
11477
|
-
}
|
|
11478
|
-
}
|
|
11479
|
-
}
|
|
11480
|
-
}
|
|
11481
|
-
__name(resolveDeferDepsFns, "resolveDeferDepsFns");
|
|
11482
11660
|
function createI18nContexts(job) {
|
|
11483
11661
|
const attrContextByMessage = /* @__PURE__ */ new Map();
|
|
11484
11662
|
for (const unit of job.units) {
|
|
@@ -11741,6 +11919,8 @@ function needsTemporaryInSafeAccess(e) {
|
|
|
11741
11919
|
return needsTemporaryInSafeAccess(e.receiver);
|
|
11742
11920
|
} else if (e instanceof ReadKeyExpr) {
|
|
11743
11921
|
return needsTemporaryInSafeAccess(e.receiver) || needsTemporaryInSafeAccess(e.index);
|
|
11922
|
+
} else if (e instanceof ParenthesizedExpr) {
|
|
11923
|
+
return needsTemporaryInSafeAccess(e.expr);
|
|
11744
11924
|
}
|
|
11745
11925
|
return e instanceof InvokeFunctionExpr || e instanceof LiteralArrayExpr || e instanceof LiteralMapExpr || e instanceof SafeInvokeFunctionExpr || e instanceof PipeBindingExpr;
|
|
11746
11926
|
}
|
|
@@ -11850,7 +12030,7 @@ function ternaryTransform(e) {
|
|
|
11850
12030
|
if (!(e instanceof SafeTernaryExpr)) {
|
|
11851
12031
|
return e;
|
|
11852
12032
|
}
|
|
11853
|
-
return new ConditionalExpr(new BinaryOperatorExpr(BinaryOperator.Equals, e.guard, NULL_EXPR), NULL_EXPR, e.expr);
|
|
12033
|
+
return new ParenthesizedExpr(new ConditionalExpr(new BinaryOperatorExpr(BinaryOperator.Equals, e.guard, NULL_EXPR), NULL_EXPR, e.expr));
|
|
11854
12034
|
}
|
|
11855
12035
|
__name(ternaryTransform, "ternaryTransform");
|
|
11856
12036
|
var ESCAPE$1 = "\uFFFD";
|
|
@@ -12040,6 +12220,23 @@ function generateAdvance(job) {
|
|
|
12040
12220
|
}
|
|
12041
12221
|
}
|
|
12042
12222
|
__name(generateAdvance, "generateAdvance");
|
|
12223
|
+
function generateLocalLetReferences(job) {
|
|
12224
|
+
for (const unit of job.units) {
|
|
12225
|
+
for (const op of unit.update) {
|
|
12226
|
+
if (op.kind !== OpKind.StoreLet) {
|
|
12227
|
+
continue;
|
|
12228
|
+
}
|
|
12229
|
+
const variable2 = {
|
|
12230
|
+
kind: SemanticVariableKind.Identifier,
|
|
12231
|
+
name: null,
|
|
12232
|
+
identifier: op.declaredName,
|
|
12233
|
+
local: true
|
|
12234
|
+
};
|
|
12235
|
+
OpList.replace(op, createVariableOp(job.allocateXrefId(), variable2, new StoreLetExpr(op.target, op.value, op.sourceSpan), VariableFlags.None));
|
|
12236
|
+
}
|
|
12237
|
+
}
|
|
12238
|
+
}
|
|
12239
|
+
__name(generateLocalLetReferences, "generateLocalLetReferences");
|
|
12043
12240
|
function generateProjectionDefs(job) {
|
|
12044
12241
|
const share = job.compatibility === CompatibilityMode.TemplateDefinitionBuilder;
|
|
12045
12242
|
const selectors = [];
|
|
@@ -12075,6 +12272,8 @@ function recursivelyProcessView(view, parentScope) {
|
|
|
12075
12272
|
const scope = getScopeForView(view, parentScope);
|
|
12076
12273
|
for (const op of view.create) {
|
|
12077
12274
|
switch (op.kind) {
|
|
12275
|
+
case OpKind.ConditionalCreate:
|
|
12276
|
+
case OpKind.ConditionalBranchCreate:
|
|
12078
12277
|
case OpKind.Template:
|
|
12079
12278
|
recursivelyProcessView(view.job.views.get(op.xref), scope);
|
|
12080
12279
|
break;
|
|
@@ -12126,6 +12325,8 @@ function getScopeForView(view, parent) {
|
|
|
12126
12325
|
for (const op of view.create) {
|
|
12127
12326
|
switch (op.kind) {
|
|
12128
12327
|
case OpKind.ElementStart:
|
|
12328
|
+
case OpKind.ConditionalCreate:
|
|
12329
|
+
case OpKind.ConditionalBranchCreate:
|
|
12129
12330
|
case OpKind.Template:
|
|
12130
12331
|
if (!Array.isArray(op.localRefs)) {
|
|
12131
12332
|
throw new Error(`AssertionError: expected localRefs to be an array`);
|
|
@@ -12403,13 +12604,15 @@ var Element2 = class extends NodeWithI18n {
|
|
|
12403
12604
|
}
|
|
12404
12605
|
name;
|
|
12405
12606
|
attrs;
|
|
12607
|
+
directives;
|
|
12406
12608
|
children;
|
|
12407
12609
|
startSourceSpan;
|
|
12408
12610
|
endSourceSpan;
|
|
12409
|
-
constructor(name, attrs, children, sourceSpan, startSourceSpan, endSourceSpan = null, i18n2) {
|
|
12611
|
+
constructor(name, attrs, directives, children, sourceSpan, startSourceSpan, endSourceSpan = null, i18n2) {
|
|
12410
12612
|
super(sourceSpan, i18n2);
|
|
12411
12613
|
this.name = name;
|
|
12412
12614
|
this.attrs = attrs;
|
|
12615
|
+
this.directives = directives;
|
|
12413
12616
|
this.children = children;
|
|
12414
12617
|
this.startSourceSpan = startSourceSpan;
|
|
12415
12618
|
this.endSourceSpan = endSourceSpan;
|
|
@@ -12455,6 +12658,53 @@ var Block = class extends NodeWithI18n {
|
|
|
12455
12658
|
return visitor.visitBlock(this, context);
|
|
12456
12659
|
}
|
|
12457
12660
|
};
|
|
12661
|
+
var Component2 = class extends NodeWithI18n {
|
|
12662
|
+
static {
|
|
12663
|
+
__name(this, "Component");
|
|
12664
|
+
}
|
|
12665
|
+
componentName;
|
|
12666
|
+
tagName;
|
|
12667
|
+
fullName;
|
|
12668
|
+
attrs;
|
|
12669
|
+
directives;
|
|
12670
|
+
children;
|
|
12671
|
+
startSourceSpan;
|
|
12672
|
+
endSourceSpan;
|
|
12673
|
+
constructor(componentName, tagName, fullName, attrs, directives, children, sourceSpan, startSourceSpan, endSourceSpan = null, i18n2) {
|
|
12674
|
+
super(sourceSpan, i18n2);
|
|
12675
|
+
this.componentName = componentName;
|
|
12676
|
+
this.tagName = tagName;
|
|
12677
|
+
this.fullName = fullName;
|
|
12678
|
+
this.attrs = attrs;
|
|
12679
|
+
this.directives = directives;
|
|
12680
|
+
this.children = children;
|
|
12681
|
+
this.startSourceSpan = startSourceSpan;
|
|
12682
|
+
this.endSourceSpan = endSourceSpan;
|
|
12683
|
+
}
|
|
12684
|
+
visit(visitor, context) {
|
|
12685
|
+
return visitor.visitComponent(this, context);
|
|
12686
|
+
}
|
|
12687
|
+
};
|
|
12688
|
+
var Directive2 = class {
|
|
12689
|
+
static {
|
|
12690
|
+
__name(this, "Directive");
|
|
12691
|
+
}
|
|
12692
|
+
name;
|
|
12693
|
+
attrs;
|
|
12694
|
+
sourceSpan;
|
|
12695
|
+
startSourceSpan;
|
|
12696
|
+
endSourceSpan;
|
|
12697
|
+
constructor(name, attrs, sourceSpan, startSourceSpan, endSourceSpan = null) {
|
|
12698
|
+
this.name = name;
|
|
12699
|
+
this.attrs = attrs;
|
|
12700
|
+
this.sourceSpan = sourceSpan;
|
|
12701
|
+
this.startSourceSpan = startSourceSpan;
|
|
12702
|
+
this.endSourceSpan = endSourceSpan;
|
|
12703
|
+
}
|
|
12704
|
+
visit(visitor, context) {
|
|
12705
|
+
return visitor.visitDirective(this, context);
|
|
12706
|
+
}
|
|
12707
|
+
};
|
|
12458
12708
|
var BlockParameter = class {
|
|
12459
12709
|
static {
|
|
12460
12710
|
__name(this, "BlockParameter");
|
|
@@ -12510,6 +12760,7 @@ var RecursiveVisitor2 = class {
|
|
|
12510
12760
|
visitElement(ast, context) {
|
|
12511
12761
|
this.visitChildren(context, (visit) => {
|
|
12512
12762
|
visit(ast.attrs);
|
|
12763
|
+
visit(ast.directives);
|
|
12513
12764
|
visit(ast.children);
|
|
12514
12765
|
});
|
|
12515
12766
|
}
|
|
@@ -12536,6 +12787,17 @@ var RecursiveVisitor2 = class {
|
|
|
12536
12787
|
}
|
|
12537
12788
|
visitLetDeclaration(decl, context) {
|
|
12538
12789
|
}
|
|
12790
|
+
visitComponent(component, context) {
|
|
12791
|
+
this.visitChildren(context, (visit) => {
|
|
12792
|
+
visit(component.attrs);
|
|
12793
|
+
visit(component.children);
|
|
12794
|
+
});
|
|
12795
|
+
}
|
|
12796
|
+
visitDirective(directive, context) {
|
|
12797
|
+
this.visitChildren(context, (visit) => {
|
|
12798
|
+
visit(directive.attrs);
|
|
12799
|
+
});
|
|
12800
|
+
}
|
|
12539
12801
|
visitChildren(context, cb) {
|
|
12540
12802
|
let results = [];
|
|
12541
12803
|
let t = this;
|
|
@@ -14746,11 +15008,13 @@ var _Tokenizer = class {
|
|
|
14746
15008
|
_currentTokenStart = null;
|
|
14747
15009
|
_currentTokenType = null;
|
|
14748
15010
|
_expansionCaseStack = [];
|
|
15011
|
+
_openDirectiveCount = 0;
|
|
14749
15012
|
_inInterpolation = false;
|
|
14750
15013
|
_preserveLineEndings;
|
|
14751
15014
|
_i18nNormalizeLineEndingsInICUs;
|
|
14752
15015
|
_tokenizeBlocks;
|
|
14753
15016
|
_tokenizeLet;
|
|
15017
|
+
_selectorlessEnabled;
|
|
14754
15018
|
tokens = [];
|
|
14755
15019
|
errors = [];
|
|
14756
15020
|
nonNormalizedIcuExpressions = [];
|
|
@@ -14775,6 +15039,7 @@ var _Tokenizer = class {
|
|
|
14775
15039
|
this._i18nNormalizeLineEndingsInICUs = options.i18nNormalizeLineEndingsInICUs || false;
|
|
14776
15040
|
this._tokenizeBlocks = options.tokenizeBlocks ?? true;
|
|
14777
15041
|
this._tokenizeLet = options.tokenizeLet ?? true;
|
|
15042
|
+
this._selectorlessEnabled = options.selectorlessEnabled ?? false;
|
|
14778
15043
|
try {
|
|
14779
15044
|
this._cursor.init();
|
|
14780
15045
|
} catch (e) {
|
|
@@ -14821,7 +15086,7 @@ var _Tokenizer = class {
|
|
|
14821
15086
|
}
|
|
14822
15087
|
}
|
|
14823
15088
|
this._beginToken(
|
|
14824
|
-
|
|
15089
|
+
41
|
|
14825
15090
|
/* TokenType.EOF */
|
|
14826
15091
|
);
|
|
14827
15092
|
this._endToken([]);
|
|
@@ -15206,7 +15471,7 @@ var _Tokenizer = class {
|
|
|
15206
15471
|
this._cursor.advance();
|
|
15207
15472
|
this._endToken([content]);
|
|
15208
15473
|
}
|
|
15209
|
-
_consumePrefixAndName() {
|
|
15474
|
+
_consumePrefixAndName(endPredicate) {
|
|
15210
15475
|
const nameOrPrefixStart = this._cursor.clone();
|
|
15211
15476
|
let prefix = "";
|
|
15212
15477
|
while (this._cursor.peek() !== $COLON && !isPrefixEnd(this._cursor.peek())) {
|
|
@@ -15220,36 +15485,56 @@ var _Tokenizer = class {
|
|
|
15220
15485
|
} else {
|
|
15221
15486
|
nameStart = nameOrPrefixStart;
|
|
15222
15487
|
}
|
|
15223
|
-
this._requireCharCodeUntilFn(
|
|
15488
|
+
this._requireCharCodeUntilFn(endPredicate, prefix === "" ? 0 : 1);
|
|
15224
15489
|
const name = this._cursor.getChars(nameStart);
|
|
15225
15490
|
return [prefix, name];
|
|
15226
15491
|
}
|
|
15227
15492
|
_consumeTagOpen(start) {
|
|
15228
15493
|
let tagName;
|
|
15229
15494
|
let prefix;
|
|
15230
|
-
let
|
|
15495
|
+
let closingTagName;
|
|
15496
|
+
let openToken;
|
|
15231
15497
|
try {
|
|
15232
|
-
if (
|
|
15233
|
-
|
|
15234
|
-
|
|
15235
|
-
|
|
15236
|
-
|
|
15237
|
-
|
|
15238
|
-
|
|
15239
|
-
|
|
15240
|
-
|
|
15498
|
+
if (this._selectorlessEnabled && isSelectorlessNameStart(this._cursor.peek())) {
|
|
15499
|
+
openToken = this._consumeComponentOpenStart(start);
|
|
15500
|
+
[closingTagName, prefix, tagName] = openToken.parts;
|
|
15501
|
+
if (prefix) {
|
|
15502
|
+
closingTagName += `:${prefix}`;
|
|
15503
|
+
}
|
|
15504
|
+
if (tagName) {
|
|
15505
|
+
closingTagName += `:${tagName}`;
|
|
15506
|
+
}
|
|
15241
15507
|
this._attemptCharCodeUntilFn(isNotWhitespace);
|
|
15242
|
-
|
|
15243
|
-
|
|
15244
|
-
this.
|
|
15508
|
+
} else {
|
|
15509
|
+
if (!isAsciiLetter(this._cursor.peek())) {
|
|
15510
|
+
throw this._createError(_unexpectedCharacterErrorMsg(this._cursor.peek()), this._cursor.getSpan(start));
|
|
15245
15511
|
}
|
|
15512
|
+
openToken = this._consumeTagOpenStart(start);
|
|
15513
|
+
prefix = openToken.parts[0];
|
|
15514
|
+
tagName = closingTagName = openToken.parts[1];
|
|
15246
15515
|
this._attemptCharCodeUntilFn(isNotWhitespace);
|
|
15247
15516
|
}
|
|
15248
|
-
this.
|
|
15517
|
+
while (!isAttributeTerminator(this._cursor.peek())) {
|
|
15518
|
+
if (this._selectorlessEnabled && this._cursor.peek() === $AT) {
|
|
15519
|
+
const start2 = this._cursor.clone();
|
|
15520
|
+
const nameStart = start2.clone();
|
|
15521
|
+
nameStart.advance();
|
|
15522
|
+
if (isSelectorlessNameStart(nameStart.peek())) {
|
|
15523
|
+
this._consumeDirective(start2, nameStart);
|
|
15524
|
+
}
|
|
15525
|
+
} else {
|
|
15526
|
+
this._consumeAttribute();
|
|
15527
|
+
}
|
|
15528
|
+
}
|
|
15529
|
+
if (openToken.type === 33) {
|
|
15530
|
+
this._consumeComponentOpenEnd();
|
|
15531
|
+
} else {
|
|
15532
|
+
this._consumeTagOpenEnd();
|
|
15533
|
+
}
|
|
15249
15534
|
} catch (e) {
|
|
15250
15535
|
if (e instanceof _ControlFlowError) {
|
|
15251
|
-
if (
|
|
15252
|
-
|
|
15536
|
+
if (openToken) {
|
|
15537
|
+
openToken.type = openToken.type === 33 ? 37 : 4;
|
|
15253
15538
|
} else {
|
|
15254
15539
|
this._beginToken(5, start);
|
|
15255
15540
|
this._endToken(["<"]);
|
|
@@ -15260,12 +15545,12 @@ var _Tokenizer = class {
|
|
|
15260
15545
|
}
|
|
15261
15546
|
const contentTokenType = this._getTagDefinition(tagName).getContentType(prefix);
|
|
15262
15547
|
if (contentTokenType === TagContentType.RAW_TEXT) {
|
|
15263
|
-
this._consumeRawTextWithTagClose(
|
|
15548
|
+
this._consumeRawTextWithTagClose(openToken, closingTagName, false);
|
|
15264
15549
|
} else if (contentTokenType === TagContentType.ESCAPABLE_RAW_TEXT) {
|
|
15265
|
-
this._consumeRawTextWithTagClose(
|
|
15550
|
+
this._consumeRawTextWithTagClose(openToken, closingTagName, true);
|
|
15266
15551
|
}
|
|
15267
15552
|
}
|
|
15268
|
-
_consumeRawTextWithTagClose(
|
|
15553
|
+
_consumeRawTextWithTagClose(openToken, tagName, consumeEntities) {
|
|
15269
15554
|
this._consumeRawText(consumeEntities, () => {
|
|
15270
15555
|
if (!this._attemptCharCode($LT))
|
|
15271
15556
|
return false;
|
|
@@ -15278,18 +15563,46 @@ var _Tokenizer = class {
|
|
|
15278
15563
|
return this._attemptCharCode($GT);
|
|
15279
15564
|
});
|
|
15280
15565
|
this._beginToken(
|
|
15281
|
-
3
|
|
15566
|
+
openToken.type === 33 ? 36 : 3
|
|
15282
15567
|
/* TokenType.TAG_CLOSE */
|
|
15283
15568
|
);
|
|
15284
15569
|
this._requireCharCodeUntilFn((code) => code === $GT, 3);
|
|
15285
15570
|
this._cursor.advance();
|
|
15286
|
-
this._endToken(
|
|
15571
|
+
this._endToken(openToken.parts);
|
|
15287
15572
|
}
|
|
15288
15573
|
_consumeTagOpenStart(start) {
|
|
15289
15574
|
this._beginToken(0, start);
|
|
15290
|
-
const parts = this._consumePrefixAndName();
|
|
15575
|
+
const parts = this._consumePrefixAndName(isNameEnd);
|
|
15576
|
+
return this._endToken(parts);
|
|
15577
|
+
}
|
|
15578
|
+
_consumeComponentOpenStart(start) {
|
|
15579
|
+
this._beginToken(33, start);
|
|
15580
|
+
const parts = this._consumeComponentName();
|
|
15291
15581
|
return this._endToken(parts);
|
|
15292
15582
|
}
|
|
15583
|
+
_consumeComponentName() {
|
|
15584
|
+
const nameStart = this._cursor.clone();
|
|
15585
|
+
while (isSelectorlessNameChar(this._cursor.peek())) {
|
|
15586
|
+
this._cursor.advance();
|
|
15587
|
+
}
|
|
15588
|
+
const name = this._cursor.getChars(nameStart);
|
|
15589
|
+
let prefix = "";
|
|
15590
|
+
let tagName = "";
|
|
15591
|
+
if (this._cursor.peek() === $COLON) {
|
|
15592
|
+
this._cursor.advance();
|
|
15593
|
+
[prefix, tagName] = this._consumePrefixAndName(isNameEnd);
|
|
15594
|
+
}
|
|
15595
|
+
return [name, prefix, tagName];
|
|
15596
|
+
}
|
|
15597
|
+
_consumeAttribute() {
|
|
15598
|
+
this._consumeAttributeName();
|
|
15599
|
+
this._attemptCharCodeUntilFn(isNotWhitespace);
|
|
15600
|
+
if (this._attemptCharCode($EQ)) {
|
|
15601
|
+
this._attemptCharCodeUntilFn(isNotWhitespace);
|
|
15602
|
+
this._consumeAttributeValue();
|
|
15603
|
+
}
|
|
15604
|
+
this._attemptCharCodeUntilFn(isNotWhitespace);
|
|
15605
|
+
}
|
|
15293
15606
|
_consumeAttributeName() {
|
|
15294
15607
|
const attrNameStart = this._cursor.peek();
|
|
15295
15608
|
if (attrNameStart === $SQ || attrNameStart === $DQ) {
|
|
@@ -15299,7 +15612,26 @@ var _Tokenizer = class {
|
|
|
15299
15612
|
14
|
|
15300
15613
|
/* TokenType.ATTR_NAME */
|
|
15301
15614
|
);
|
|
15302
|
-
|
|
15615
|
+
let nameEndPredicate;
|
|
15616
|
+
if (this._openDirectiveCount > 0) {
|
|
15617
|
+
let openParens = 0;
|
|
15618
|
+
nameEndPredicate = /* @__PURE__ */ __name((code) => {
|
|
15619
|
+
if (this._openDirectiveCount > 0) {
|
|
15620
|
+
if (code === $LPAREN) {
|
|
15621
|
+
openParens++;
|
|
15622
|
+
} else if (code === $RPAREN) {
|
|
15623
|
+
if (openParens === 0) {
|
|
15624
|
+
return true;
|
|
15625
|
+
}
|
|
15626
|
+
openParens--;
|
|
15627
|
+
}
|
|
15628
|
+
}
|
|
15629
|
+
return isNameEnd(code);
|
|
15630
|
+
}, "nameEndPredicate");
|
|
15631
|
+
} else {
|
|
15632
|
+
nameEndPredicate = isNameEnd;
|
|
15633
|
+
}
|
|
15634
|
+
const prefixAndName = this._consumePrefixAndName(nameEndPredicate);
|
|
15303
15635
|
this._endToken(prefixAndName);
|
|
15304
15636
|
}
|
|
15305
15637
|
_consumeAttributeValue() {
|
|
@@ -15328,10 +15660,30 @@ var _Tokenizer = class {
|
|
|
15328
15660
|
this._requireCharCode($GT);
|
|
15329
15661
|
this._endToken([]);
|
|
15330
15662
|
}
|
|
15663
|
+
_consumeComponentOpenEnd() {
|
|
15664
|
+
const tokenType = this._attemptCharCode($SLASH) ? 35 : 34;
|
|
15665
|
+
this._beginToken(tokenType);
|
|
15666
|
+
this._requireCharCode($GT);
|
|
15667
|
+
this._endToken([]);
|
|
15668
|
+
}
|
|
15331
15669
|
_consumeTagClose(start) {
|
|
15670
|
+
if (this._selectorlessEnabled) {
|
|
15671
|
+
const clone = start.clone();
|
|
15672
|
+
while (clone.peek() !== $GT && !isSelectorlessNameStart(clone.peek())) {
|
|
15673
|
+
clone.advance();
|
|
15674
|
+
}
|
|
15675
|
+
if (isSelectorlessNameStart(clone.peek())) {
|
|
15676
|
+
this._beginToken(36, start);
|
|
15677
|
+
const parts = this._consumeComponentName();
|
|
15678
|
+
this._attemptCharCodeUntilFn(isNotWhitespace);
|
|
15679
|
+
this._requireCharCode($GT);
|
|
15680
|
+
this._endToken(parts);
|
|
15681
|
+
return;
|
|
15682
|
+
}
|
|
15683
|
+
}
|
|
15332
15684
|
this._beginToken(3, start);
|
|
15333
15685
|
this._attemptCharCodeUntilFn(isNotWhitespace);
|
|
15334
|
-
const prefixAndName = this._consumePrefixAndName();
|
|
15686
|
+
const prefixAndName = this._consumePrefixAndName(isNameEnd);
|
|
15335
15687
|
this._attemptCharCodeUntilFn(isNotWhitespace);
|
|
15336
15688
|
this._requireCharCode($GT);
|
|
15337
15689
|
this._endToken(prefixAndName);
|
|
@@ -15493,6 +15845,46 @@ var _Tokenizer = class {
|
|
|
15493
15845
|
parts.push(this._getProcessedChars(expressionStart, this._cursor));
|
|
15494
15846
|
this._endToken(parts);
|
|
15495
15847
|
}
|
|
15848
|
+
_consumeDirective(start, nameStart) {
|
|
15849
|
+
this._requireCharCode($AT);
|
|
15850
|
+
this._cursor.advance();
|
|
15851
|
+
while (isSelectorlessNameChar(this._cursor.peek())) {
|
|
15852
|
+
this._cursor.advance();
|
|
15853
|
+
}
|
|
15854
|
+
this._beginToken(38, start);
|
|
15855
|
+
const name = this._cursor.getChars(nameStart);
|
|
15856
|
+
this._endToken([name]);
|
|
15857
|
+
this._attemptCharCodeUntilFn(isNotWhitespace);
|
|
15858
|
+
if (this._cursor.peek() !== $LPAREN) {
|
|
15859
|
+
return;
|
|
15860
|
+
}
|
|
15861
|
+
this._openDirectiveCount++;
|
|
15862
|
+
this._beginToken(
|
|
15863
|
+
39
|
|
15864
|
+
/* TokenType.DIRECTIVE_OPEN */
|
|
15865
|
+
);
|
|
15866
|
+
this._cursor.advance();
|
|
15867
|
+
this._endToken([]);
|
|
15868
|
+
this._attemptCharCodeUntilFn(isNotWhitespace);
|
|
15869
|
+
while (!isAttributeTerminator(this._cursor.peek()) && this._cursor.peek() !== $RPAREN) {
|
|
15870
|
+
this._consumeAttribute();
|
|
15871
|
+
}
|
|
15872
|
+
this._attemptCharCodeUntilFn(isNotWhitespace);
|
|
15873
|
+
this._openDirectiveCount--;
|
|
15874
|
+
if (this._cursor.peek() !== $RPAREN) {
|
|
15875
|
+
if (this._cursor.peek() === $GT || this._cursor.peek() === $SLASH) {
|
|
15876
|
+
return;
|
|
15877
|
+
}
|
|
15878
|
+
throw this._createError(_unexpectedCharacterErrorMsg(this._cursor.peek()), this._cursor.getSpan(start));
|
|
15879
|
+
}
|
|
15880
|
+
this._beginToken(
|
|
15881
|
+
40
|
|
15882
|
+
/* TokenType.DIRECTIVE_CLOSE */
|
|
15883
|
+
);
|
|
15884
|
+
this._cursor.advance();
|
|
15885
|
+
this._endToken([]);
|
|
15886
|
+
this._attemptCharCodeUntilFn(isNotWhitespace);
|
|
15887
|
+
}
|
|
15496
15888
|
_getProcessedChars(start, end) {
|
|
15497
15889
|
return this._processCarriageReturns(end.getChars(start));
|
|
15498
15890
|
}
|
|
@@ -15595,6 +15987,18 @@ function isBlockParameterChar(code) {
|
|
|
15595
15987
|
return code !== $SEMICOLON && isNotWhitespace(code);
|
|
15596
15988
|
}
|
|
15597
15989
|
__name(isBlockParameterChar, "isBlockParameterChar");
|
|
15990
|
+
function isSelectorlessNameStart(code) {
|
|
15991
|
+
return code === $_ || code >= $A && code <= $Z;
|
|
15992
|
+
}
|
|
15993
|
+
__name(isSelectorlessNameStart, "isSelectorlessNameStart");
|
|
15994
|
+
function isSelectorlessNameChar(code) {
|
|
15995
|
+
return isAsciiLetter(code) || isDigit(code) || code === $_;
|
|
15996
|
+
}
|
|
15997
|
+
__name(isSelectorlessNameChar, "isSelectorlessNameChar");
|
|
15998
|
+
function isAttributeTerminator(code) {
|
|
15999
|
+
return code === $SLASH || code === $GT || code === $LT || code === $EOF;
|
|
16000
|
+
}
|
|
16001
|
+
__name(isAttributeTerminator, "isAttributeTerminator");
|
|
15598
16002
|
function mergeTextTokens(srcTokens) {
|
|
15599
16003
|
const dstTokens = [];
|
|
15600
16004
|
let lastDstToken = void 0;
|
|
@@ -15874,24 +16278,24 @@ var _TreeBuilder = class __TreeBuilder {
|
|
|
15874
16278
|
__name(this, "_TreeBuilder");
|
|
15875
16279
|
}
|
|
15876
16280
|
tokens;
|
|
15877
|
-
|
|
16281
|
+
tagDefinitionResolver;
|
|
15878
16282
|
_index = -1;
|
|
15879
16283
|
// `_peek` will be initialized by the call to `_advance()` in the constructor.
|
|
15880
16284
|
_peek;
|
|
15881
16285
|
_containerStack = [];
|
|
15882
16286
|
rootNodes = [];
|
|
15883
16287
|
errors = [];
|
|
15884
|
-
constructor(tokens,
|
|
16288
|
+
constructor(tokens, tagDefinitionResolver) {
|
|
15885
16289
|
this.tokens = tokens;
|
|
15886
|
-
this.
|
|
16290
|
+
this.tagDefinitionResolver = tagDefinitionResolver;
|
|
15887
16291
|
this._advance();
|
|
15888
16292
|
}
|
|
15889
16293
|
build() {
|
|
15890
|
-
while (this._peek.type !==
|
|
16294
|
+
while (this._peek.type !== 41) {
|
|
15891
16295
|
if (this._peek.type === 0 || this._peek.type === 4) {
|
|
15892
|
-
this.
|
|
16296
|
+
this._consumeElementStartTag(this._advance());
|
|
15893
16297
|
} else if (this._peek.type === 3) {
|
|
15894
|
-
this.
|
|
16298
|
+
this._consumeElementEndTag(this._advance());
|
|
15895
16299
|
} else if (this._peek.type === 12) {
|
|
15896
16300
|
this._closeVoidElement();
|
|
15897
16301
|
this._consumeCdata(this._advance());
|
|
@@ -15918,6 +16322,10 @@ var _TreeBuilder = class __TreeBuilder {
|
|
|
15918
16322
|
} else if (this._peek.type === 32) {
|
|
15919
16323
|
this._closeVoidElement();
|
|
15920
16324
|
this._consumeIncompleteLet(this._advance());
|
|
16325
|
+
} else if (this._peek.type === 33 || this._peek.type === 37) {
|
|
16326
|
+
this._consumeComponentStartTag(this._advance());
|
|
16327
|
+
} else if (this._peek.type === 36) {
|
|
16328
|
+
this._consumeComponentEndTag(this._advance());
|
|
15921
16329
|
} else {
|
|
15922
16330
|
this._advance();
|
|
15923
16331
|
}
|
|
@@ -15991,8 +16399,8 @@ var _TreeBuilder = class __TreeBuilder {
|
|
|
15991
16399
|
if (!exp)
|
|
15992
16400
|
return null;
|
|
15993
16401
|
const end = this._advance();
|
|
15994
|
-
exp.push({ type:
|
|
15995
|
-
const expansionCaseParser = new __TreeBuilder(exp, this.
|
|
16402
|
+
exp.push({ type: 41, parts: [], sourceSpan: end.sourceSpan });
|
|
16403
|
+
const expansionCaseParser = new __TreeBuilder(exp, this.tagDefinitionResolver);
|
|
15996
16404
|
expansionCaseParser.build();
|
|
15997
16405
|
if (expansionCaseParser.errors.length > 0) {
|
|
15998
16406
|
this.errors = this.errors.concat(expansionCaseParser.errors);
|
|
@@ -16038,7 +16446,7 @@ var _TreeBuilder = class __TreeBuilder {
|
|
|
16038
16446
|
return null;
|
|
16039
16447
|
}
|
|
16040
16448
|
}
|
|
16041
|
-
if (this._peek.type ===
|
|
16449
|
+
if (this._peek.type === 41) {
|
|
16042
16450
|
this.errors.push(TreeError.create(null, start.sourceSpan, `Invalid ICU message. Missing '}'.`));
|
|
16043
16451
|
return null;
|
|
16044
16452
|
}
|
|
@@ -16051,7 +16459,7 @@ var _TreeBuilder = class __TreeBuilder {
|
|
|
16051
16459
|
let text2 = token.parts[0];
|
|
16052
16460
|
if (text2.length > 0 && text2[0] === "\n") {
|
|
16053
16461
|
const parent = this._getContainer();
|
|
16054
|
-
if (parent != null && parent.children.length === 0 && this.
|
|
16462
|
+
if (parent != null && parent.children.length === 0 && this._getTagDefinition(parent)?.ignoreFirstLf) {
|
|
16055
16463
|
text2 = text2.substring(1);
|
|
16056
16464
|
tokens[0] = { type: token.type, sourceSpan: token.sourceSpan, parts: [text2] };
|
|
16057
16465
|
}
|
|
@@ -16074,23 +16482,21 @@ var _TreeBuilder = class __TreeBuilder {
|
|
|
16074
16482
|
}
|
|
16075
16483
|
_closeVoidElement() {
|
|
16076
16484
|
const el = this._getContainer();
|
|
16077
|
-
if (el
|
|
16485
|
+
if (el !== null && this._getTagDefinition(el)?.isVoid) {
|
|
16078
16486
|
this._containerStack.pop();
|
|
16079
16487
|
}
|
|
16080
16488
|
}
|
|
16081
|
-
|
|
16082
|
-
const [prefix, name] = startTagToken.parts;
|
|
16489
|
+
_consumeElementStartTag(startTagToken) {
|
|
16083
16490
|
const attrs = [];
|
|
16084
|
-
|
|
16085
|
-
|
|
16086
|
-
|
|
16087
|
-
const fullName = this._getElementFullName(prefix, name, this._getClosestParentElement());
|
|
16491
|
+
const directives = [];
|
|
16492
|
+
this._consumeAttributesAndDirectives(attrs, directives);
|
|
16493
|
+
const fullName = this._getElementFullName(startTagToken, this._getClosestElementLikeParent());
|
|
16088
16494
|
let selfClosing = false;
|
|
16089
16495
|
if (this._peek.type === 2) {
|
|
16090
16496
|
this._advance();
|
|
16091
16497
|
selfClosing = true;
|
|
16092
|
-
const tagDef = this.
|
|
16093
|
-
if (!(tagDef
|
|
16498
|
+
const tagDef = this._getTagDefinition(fullName);
|
|
16499
|
+
if (!(tagDef?.canSelfClose || getNsPrefix(fullName) !== null || tagDef?.isVoid)) {
|
|
16094
16500
|
this.errors.push(TreeError.create(fullName, startTagToken.sourceSpan, `Only void, custom and foreign elements can be self closed "${startTagToken.parts[1]}"`));
|
|
16095
16501
|
}
|
|
16096
16502
|
} else if (this._peek.type === 1) {
|
|
@@ -16100,9 +16506,10 @@ var _TreeBuilder = class __TreeBuilder {
|
|
|
16100
16506
|
const end = this._peek.sourceSpan.fullStart;
|
|
16101
16507
|
const span = new ParseSourceSpan(startTagToken.sourceSpan.start, end, startTagToken.sourceSpan.fullStart);
|
|
16102
16508
|
const startSpan = new ParseSourceSpan(startTagToken.sourceSpan.start, end, startTagToken.sourceSpan.fullStart);
|
|
16103
|
-
const el = new Element2(fullName, attrs, [], span, startSpan, void 0);
|
|
16104
|
-
const
|
|
16105
|
-
|
|
16509
|
+
const el = new Element2(fullName, attrs, directives, [], span, startSpan, void 0);
|
|
16510
|
+
const parent = this._getContainer();
|
|
16511
|
+
const isClosedByChild = parent !== null && !!this._getTagDefinition(parent)?.isClosedByChild(el.name);
|
|
16512
|
+
this._pushContainer(el, isClosedByChild);
|
|
16106
16513
|
if (selfClosing) {
|
|
16107
16514
|
this._popContainer(fullName, Element2, span);
|
|
16108
16515
|
} else if (startTagToken.type === 4) {
|
|
@@ -16110,6 +16517,64 @@ var _TreeBuilder = class __TreeBuilder {
|
|
|
16110
16517
|
this.errors.push(TreeError.create(fullName, span, `Opening tag "${fullName}" not terminated.`));
|
|
16111
16518
|
}
|
|
16112
16519
|
}
|
|
16520
|
+
_consumeComponentStartTag(startToken) {
|
|
16521
|
+
const componentName = startToken.parts[0];
|
|
16522
|
+
const attrs = [];
|
|
16523
|
+
const directives = [];
|
|
16524
|
+
this._consumeAttributesAndDirectives(attrs, directives);
|
|
16525
|
+
const closestElement = this._getClosestElementLikeParent();
|
|
16526
|
+
const tagName = this._getComponentTagName(startToken, closestElement);
|
|
16527
|
+
const fullName = this._getComponentFullName(startToken, closestElement);
|
|
16528
|
+
const selfClosing = this._peek.type === 35;
|
|
16529
|
+
this._advance();
|
|
16530
|
+
const end = this._peek.sourceSpan.fullStart;
|
|
16531
|
+
const span = new ParseSourceSpan(startToken.sourceSpan.start, end, startToken.sourceSpan.fullStart);
|
|
16532
|
+
const startSpan = new ParseSourceSpan(startToken.sourceSpan.start, end, startToken.sourceSpan.fullStart);
|
|
16533
|
+
const node = new Component2(componentName, tagName, fullName, attrs, directives, [], span, startSpan, void 0);
|
|
16534
|
+
const parent = this._getContainer();
|
|
16535
|
+
const isClosedByChild = parent !== null && node.tagName !== null && !!this._getTagDefinition(parent)?.isClosedByChild(node.tagName);
|
|
16536
|
+
this._pushContainer(node, isClosedByChild);
|
|
16537
|
+
if (selfClosing) {
|
|
16538
|
+
this._popContainer(fullName, Component2, span);
|
|
16539
|
+
} else if (startToken.type === 37) {
|
|
16540
|
+
this._popContainer(fullName, Component2, null);
|
|
16541
|
+
this.errors.push(TreeError.create(fullName, span, `Opening tag "${fullName}" not terminated.`));
|
|
16542
|
+
}
|
|
16543
|
+
}
|
|
16544
|
+
_consumeAttributesAndDirectives(attributesResult, directivesResult) {
|
|
16545
|
+
while (this._peek.type === 14 || this._peek.type === 38) {
|
|
16546
|
+
if (this._peek.type === 38) {
|
|
16547
|
+
directivesResult.push(this._consumeDirective(this._peek));
|
|
16548
|
+
} else {
|
|
16549
|
+
attributesResult.push(this._consumeAttr(this._advance()));
|
|
16550
|
+
}
|
|
16551
|
+
}
|
|
16552
|
+
}
|
|
16553
|
+
_consumeComponentEndTag(endToken) {
|
|
16554
|
+
const fullName = this._getComponentFullName(endToken, this._getClosestElementLikeParent());
|
|
16555
|
+
if (!this._popContainer(fullName, Component2, endToken.sourceSpan)) {
|
|
16556
|
+
const container = this._containerStack[this._containerStack.length - 1];
|
|
16557
|
+
let suffix;
|
|
16558
|
+
if (container instanceof Component2 && container.componentName === endToken.parts[0]) {
|
|
16559
|
+
suffix = `, did you mean "${container.fullName}"?`;
|
|
16560
|
+
} else {
|
|
16561
|
+
suffix = ". It may happen when the tag has already been closed by another tag.";
|
|
16562
|
+
}
|
|
16563
|
+
const errMsg = `Unexpected closing tag "${fullName}"${suffix}`;
|
|
16564
|
+
this.errors.push(TreeError.create(fullName, endToken.sourceSpan, errMsg));
|
|
16565
|
+
}
|
|
16566
|
+
}
|
|
16567
|
+
_getTagDefinition(nodeOrName) {
|
|
16568
|
+
if (typeof nodeOrName === "string") {
|
|
16569
|
+
return this.tagDefinitionResolver(nodeOrName);
|
|
16570
|
+
} else if (nodeOrName instanceof Element2) {
|
|
16571
|
+
return this.tagDefinitionResolver(nodeOrName.name);
|
|
16572
|
+
} else if (nodeOrName instanceof Component2 && nodeOrName.tagName !== null) {
|
|
16573
|
+
return this.tagDefinitionResolver(nodeOrName.tagName);
|
|
16574
|
+
} else {
|
|
16575
|
+
return null;
|
|
16576
|
+
}
|
|
16577
|
+
}
|
|
16113
16578
|
_pushContainer(node, isClosedByChild) {
|
|
16114
16579
|
if (isClosedByChild) {
|
|
16115
16580
|
this._containerStack.pop();
|
|
@@ -16117,9 +16582,9 @@ var _TreeBuilder = class __TreeBuilder {
|
|
|
16117
16582
|
this._addToParent(node);
|
|
16118
16583
|
this._containerStack.push(node);
|
|
16119
16584
|
}
|
|
16120
|
-
|
|
16121
|
-
const fullName = this._getElementFullName(endTagToken
|
|
16122
|
-
if (this.
|
|
16585
|
+
_consumeElementEndTag(endTagToken) {
|
|
16586
|
+
const fullName = this._getElementFullName(endTagToken, this._getClosestElementLikeParent());
|
|
16587
|
+
if (this._getTagDefinition(fullName)?.isVoid) {
|
|
16123
16588
|
this.errors.push(TreeError.create(fullName, endTagToken.sourceSpan, `Void elements do not have end tags "${endTagToken.parts[1]}"`));
|
|
16124
16589
|
} else if (!this._popContainer(fullName, Element2, endTagToken.sourceSpan)) {
|
|
16125
16590
|
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`;
|
|
@@ -16136,13 +16601,14 @@ var _TreeBuilder = class __TreeBuilder {
|
|
|
16136
16601
|
let unexpectedCloseTagDetected = false;
|
|
16137
16602
|
for (let stackIndex = this._containerStack.length - 1; stackIndex >= 0; stackIndex--) {
|
|
16138
16603
|
const node = this._containerStack[stackIndex];
|
|
16139
|
-
|
|
16604
|
+
const nodeName = node instanceof Component2 ? node.fullName : node.name;
|
|
16605
|
+
if ((nodeName === expectedName || expectedName === null) && node instanceof expectedType) {
|
|
16140
16606
|
node.endSourceSpan = endSourceSpan;
|
|
16141
16607
|
node.sourceSpan.end = endSourceSpan !== null ? endSourceSpan.end : node.sourceSpan.end;
|
|
16142
16608
|
this._containerStack.splice(stackIndex, this._containerStack.length - stackIndex);
|
|
16143
16609
|
return !unexpectedCloseTagDetected;
|
|
16144
16610
|
}
|
|
16145
|
-
if (node instanceof Block ||
|
|
16611
|
+
if (node instanceof Block || !this._getTagDefinition(node)?.closedByParent) {
|
|
16146
16612
|
unexpectedCloseTagDetected = true;
|
|
16147
16613
|
}
|
|
16148
16614
|
}
|
|
@@ -16182,14 +16648,36 @@ var _TreeBuilder = class __TreeBuilder {
|
|
|
16182
16648
|
const valueSpan = valueStartSpan && valueEnd && new ParseSourceSpan(valueStartSpan.start, valueEnd, valueStartSpan.fullStart);
|
|
16183
16649
|
return new Attribute(fullName, value, new ParseSourceSpan(attrName.sourceSpan.start, attrEnd, attrName.sourceSpan.fullStart), attrName.sourceSpan, valueSpan, valueTokens.length > 0 ? valueTokens : void 0, void 0);
|
|
16184
16650
|
}
|
|
16185
|
-
|
|
16186
|
-
const
|
|
16187
|
-
|
|
16188
|
-
|
|
16189
|
-
|
|
16190
|
-
|
|
16191
|
-
|
|
16192
|
-
this._advance();
|
|
16651
|
+
_consumeDirective(nameToken) {
|
|
16652
|
+
const attributes = [];
|
|
16653
|
+
let startSourceSpanEnd = nameToken.sourceSpan.end;
|
|
16654
|
+
let endSourceSpan = null;
|
|
16655
|
+
this._advance();
|
|
16656
|
+
if (this._peek.type === 39) {
|
|
16657
|
+
startSourceSpanEnd = this._peek.sourceSpan.end;
|
|
16658
|
+
this._advance();
|
|
16659
|
+
while (this._peek.type === 14) {
|
|
16660
|
+
attributes.push(this._consumeAttr(this._advance()));
|
|
16661
|
+
}
|
|
16662
|
+
if (this._peek.type === 40) {
|
|
16663
|
+
endSourceSpan = this._peek.sourceSpan;
|
|
16664
|
+
this._advance();
|
|
16665
|
+
} else {
|
|
16666
|
+
this.errors.push(TreeError.create(null, nameToken.sourceSpan, "Unterminated directive definition"));
|
|
16667
|
+
}
|
|
16668
|
+
}
|
|
16669
|
+
const startSourceSpan = new ParseSourceSpan(nameToken.sourceSpan.start, startSourceSpanEnd, nameToken.sourceSpan.fullStart);
|
|
16670
|
+
const sourceSpan = new ParseSourceSpan(startSourceSpan.start, endSourceSpan === null ? nameToken.sourceSpan.end : endSourceSpan.end, startSourceSpan.fullStart);
|
|
16671
|
+
return new Directive2(nameToken.parts[0], attributes, sourceSpan, startSourceSpan, endSourceSpan);
|
|
16672
|
+
}
|
|
16673
|
+
_consumeBlockOpen(token) {
|
|
16674
|
+
const parameters = [];
|
|
16675
|
+
while (this._peek.type === 27) {
|
|
16676
|
+
const paramToken = this._advance();
|
|
16677
|
+
parameters.push(new BlockParameter(paramToken.parts[0], paramToken.sourceSpan));
|
|
16678
|
+
}
|
|
16679
|
+
if (this._peek.type === 25) {
|
|
16680
|
+
this._advance();
|
|
16193
16681
|
}
|
|
16194
16682
|
const end = this._peek.sourceSpan.fullStart;
|
|
16195
16683
|
const span = new ParseSourceSpan(token.sourceSpan.start, end, token.sourceSpan.fullStart);
|
|
@@ -16256,10 +16744,11 @@ var _TreeBuilder = class __TreeBuilder {
|
|
|
16256
16744
|
_getContainer() {
|
|
16257
16745
|
return this._containerStack.length > 0 ? this._containerStack[this._containerStack.length - 1] : null;
|
|
16258
16746
|
}
|
|
16259
|
-
|
|
16747
|
+
_getClosestElementLikeParent() {
|
|
16260
16748
|
for (let i = this._containerStack.length - 1; i > -1; i--) {
|
|
16261
|
-
|
|
16262
|
-
|
|
16749
|
+
const current = this._containerStack[i];
|
|
16750
|
+
if (current instanceof Element2 || current instanceof Component2) {
|
|
16751
|
+
return current;
|
|
16263
16752
|
}
|
|
16264
16753
|
}
|
|
16265
16754
|
return null;
|
|
@@ -16272,18 +16761,51 @@ var _TreeBuilder = class __TreeBuilder {
|
|
|
16272
16761
|
parent.children.push(node);
|
|
16273
16762
|
}
|
|
16274
16763
|
}
|
|
16275
|
-
_getElementFullName(
|
|
16276
|
-
|
|
16277
|
-
|
|
16278
|
-
|
|
16279
|
-
|
|
16280
|
-
|
|
16281
|
-
|
|
16282
|
-
|
|
16764
|
+
_getElementFullName(token, parent) {
|
|
16765
|
+
const prefix = this._getPrefix(token, parent);
|
|
16766
|
+
return mergeNsAndName(prefix, token.parts[1]);
|
|
16767
|
+
}
|
|
16768
|
+
_getComponentFullName(token, parent) {
|
|
16769
|
+
const componentName = token.parts[0];
|
|
16770
|
+
const tagName = this._getComponentTagName(token, parent);
|
|
16771
|
+
if (tagName === null) {
|
|
16772
|
+
return componentName;
|
|
16773
|
+
}
|
|
16774
|
+
return tagName.startsWith(":") ? componentName + tagName : `${componentName}:${tagName}`;
|
|
16775
|
+
}
|
|
16776
|
+
_getComponentTagName(token, parent) {
|
|
16777
|
+
const prefix = this._getPrefix(token, parent);
|
|
16778
|
+
const tagName = token.parts[2];
|
|
16779
|
+
if (!prefix && !tagName) {
|
|
16780
|
+
return null;
|
|
16781
|
+
} else if (!prefix && tagName) {
|
|
16782
|
+
return tagName;
|
|
16783
|
+
} else {
|
|
16784
|
+
return mergeNsAndName(prefix, tagName || "ng-component");
|
|
16785
|
+
}
|
|
16786
|
+
}
|
|
16787
|
+
_getPrefix(token, parent) {
|
|
16788
|
+
let prefix;
|
|
16789
|
+
let tagName;
|
|
16790
|
+
if (token.type === 33 || token.type === 37 || token.type === 36) {
|
|
16791
|
+
prefix = token.parts[1];
|
|
16792
|
+
tagName = token.parts[2];
|
|
16793
|
+
} else {
|
|
16794
|
+
prefix = token.parts[0];
|
|
16795
|
+
tagName = token.parts[1];
|
|
16796
|
+
}
|
|
16797
|
+
prefix = prefix || this._getTagDefinition(tagName)?.implicitNamespacePrefix || "";
|
|
16798
|
+
if (!prefix && parent) {
|
|
16799
|
+
const parentName = parent instanceof Element2 ? parent.name : parent.tagName;
|
|
16800
|
+
if (parentName !== null) {
|
|
16801
|
+
const parentTagName = splitNsName(parentName)[1];
|
|
16802
|
+
const parentTagDefinition = this._getTagDefinition(parentTagName);
|
|
16803
|
+
if (parentTagDefinition !== null && !parentTagDefinition.preventNamespaceInheritance) {
|
|
16804
|
+
prefix = getNsPrefix(parentName);
|
|
16283
16805
|
}
|
|
16284
16806
|
}
|
|
16285
16807
|
}
|
|
16286
|
-
return
|
|
16808
|
+
return prefix;
|
|
16287
16809
|
}
|
|
16288
16810
|
};
|
|
16289
16811
|
function lastOnStack(stack, element2) {
|
|
@@ -16334,11 +16856,11 @@ var WhitespaceVisitor = class {
|
|
|
16334
16856
|
}
|
|
16335
16857
|
visitElement(element2, context) {
|
|
16336
16858
|
if (SKIP_WS_TRIM_TAGS.has(element2.name) || hasPreserveWhitespacesAttr(element2.attrs)) {
|
|
16337
|
-
const newElement2 = new Element2(element2.name, visitAllWithSiblings(this, element2.attrs), element2.children, element2.sourceSpan, element2.startSourceSpan, element2.endSourceSpan, element2.i18n);
|
|
16859
|
+
const newElement2 = new Element2(element2.name, visitAllWithSiblings(this, element2.attrs), visitAllWithSiblings(this, element2.directives), element2.children, element2.sourceSpan, element2.startSourceSpan, element2.endSourceSpan, element2.i18n);
|
|
16338
16860
|
this.originalNodeMap?.set(newElement2, element2);
|
|
16339
16861
|
return newElement2;
|
|
16340
16862
|
}
|
|
16341
|
-
const newElement = new Element2(element2.name, element2.attrs, visitAllWithSiblings(this, element2.children), element2.sourceSpan, element2.startSourceSpan, element2.endSourceSpan, element2.i18n);
|
|
16863
|
+
const newElement = new Element2(element2.name, element2.attrs, element2.directives, visitAllWithSiblings(this, element2.children), element2.sourceSpan, element2.startSourceSpan, element2.endSourceSpan, element2.i18n);
|
|
16342
16864
|
this.originalNodeMap?.set(newElement, element2);
|
|
16343
16865
|
return newElement;
|
|
16344
16866
|
}
|
|
@@ -16397,6 +16919,19 @@ var WhitespaceVisitor = class {
|
|
|
16397
16919
|
visitLetDeclaration(decl, context) {
|
|
16398
16920
|
return decl;
|
|
16399
16921
|
}
|
|
16922
|
+
visitComponent(node, context) {
|
|
16923
|
+
if (node.tagName && SKIP_WS_TRIM_TAGS.has(node.tagName) || hasPreserveWhitespacesAttr(node.attrs)) {
|
|
16924
|
+
const newElement2 = new Component2(node.componentName, node.tagName, node.fullName, visitAllWithSiblings(this, node.attrs), visitAllWithSiblings(this, node.directives), node.children, node.sourceSpan, node.startSourceSpan, node.endSourceSpan, node.i18n);
|
|
16925
|
+
this.originalNodeMap?.set(newElement2, node);
|
|
16926
|
+
return newElement2;
|
|
16927
|
+
}
|
|
16928
|
+
const newElement = new Component2(node.componentName, node.tagName, node.fullName, node.attrs, node.directives, visitAllWithSiblings(this, node.children), node.sourceSpan, node.startSourceSpan, node.endSourceSpan, node.i18n);
|
|
16929
|
+
this.originalNodeMap?.set(newElement, node);
|
|
16930
|
+
return newElement;
|
|
16931
|
+
}
|
|
16932
|
+
visitDirective(directive, context) {
|
|
16933
|
+
return directive;
|
|
16934
|
+
}
|
|
16400
16935
|
visit(_node, context) {
|
|
16401
16936
|
if (this.requireContext && !context) {
|
|
16402
16937
|
throw new Error(`WhitespaceVisitor requires context. Visit via \`visitAllWithSiblings\` to get this context.`);
|
|
@@ -16482,7 +17017,9 @@ var KEYWORDS = [
|
|
|
16482
17017
|
"if",
|
|
16483
17018
|
"else",
|
|
16484
17019
|
"this",
|
|
16485
|
-
"typeof"
|
|
17020
|
+
"typeof",
|
|
17021
|
+
"void",
|
|
17022
|
+
"in"
|
|
16486
17023
|
];
|
|
16487
17024
|
var Lexer = class {
|
|
16488
17025
|
static {
|
|
@@ -16553,6 +17090,12 @@ var Token = class {
|
|
|
16553
17090
|
isKeywordTypeof() {
|
|
16554
17091
|
return this.type === TokenType.Keyword && this.strValue === "typeof";
|
|
16555
17092
|
}
|
|
17093
|
+
isKeywordVoid() {
|
|
17094
|
+
return this.type === TokenType.Keyword && this.strValue === "void";
|
|
17095
|
+
}
|
|
17096
|
+
isKeywordIn() {
|
|
17097
|
+
return this.type === TokenType.Keyword && this.strValue === "in";
|
|
17098
|
+
}
|
|
16556
17099
|
isError() {
|
|
16557
17100
|
return this.type === TokenType.Error;
|
|
16558
17101
|
}
|
|
@@ -16704,11 +17247,12 @@ var _Scanner = class {
|
|
|
16704
17247
|
return this.scanPrivateIdentifier();
|
|
16705
17248
|
case $PLUS:
|
|
16706
17249
|
case $MINUS:
|
|
16707
|
-
case $STAR:
|
|
16708
17250
|
case $SLASH:
|
|
16709
17251
|
case $PERCENT:
|
|
16710
17252
|
case $CARET:
|
|
16711
17253
|
return this.scanOperator(start, String.fromCharCode(peek));
|
|
17254
|
+
case $STAR:
|
|
17255
|
+
return this.scanComplexOperator(start, "*", $STAR, "*");
|
|
16712
17256
|
case $QUESTION:
|
|
16713
17257
|
return this.scanQuestion(start);
|
|
16714
17258
|
case $LT:
|
|
@@ -17542,13 +18086,14 @@ var _ParseAST = class {
|
|
|
17542
18086
|
parseRelational() {
|
|
17543
18087
|
const start = this.inputIndex;
|
|
17544
18088
|
let result = this.parseAdditive();
|
|
17545
|
-
while (this.next.type == TokenType.Operator) {
|
|
18089
|
+
while (this.next.type == TokenType.Operator || this.next.isKeywordIn) {
|
|
17546
18090
|
const operator = this.next.strValue;
|
|
17547
18091
|
switch (operator) {
|
|
17548
18092
|
case "<":
|
|
17549
18093
|
case ">":
|
|
17550
18094
|
case "<=":
|
|
17551
18095
|
case ">=":
|
|
18096
|
+
case "in":
|
|
17552
18097
|
this.advance();
|
|
17553
18098
|
const right = this.parseAdditive();
|
|
17554
18099
|
result = new Binary(this.span(start), this.sourceSpan(start), operator, result, right);
|
|
@@ -17577,7 +18122,7 @@ var _ParseAST = class {
|
|
|
17577
18122
|
}
|
|
17578
18123
|
parseMultiplicative() {
|
|
17579
18124
|
const start = this.inputIndex;
|
|
17580
|
-
let result = this.
|
|
18125
|
+
let result = this.parseExponentiation();
|
|
17581
18126
|
while (this.next.type == TokenType.Operator) {
|
|
17582
18127
|
const operator = this.next.strValue;
|
|
17583
18128
|
switch (operator) {
|
|
@@ -17585,7 +18130,7 @@ var _ParseAST = class {
|
|
|
17585
18130
|
case "%":
|
|
17586
18131
|
case "/":
|
|
17587
18132
|
this.advance();
|
|
17588
|
-
|
|
18133
|
+
const right = this.parseExponentiation();
|
|
17589
18134
|
result = new Binary(this.span(start), this.sourceSpan(start), operator, result, right);
|
|
17590
18135
|
continue;
|
|
17591
18136
|
}
|
|
@@ -17593,6 +18138,19 @@ var _ParseAST = class {
|
|
|
17593
18138
|
}
|
|
17594
18139
|
return result;
|
|
17595
18140
|
}
|
|
18141
|
+
parseExponentiation() {
|
|
18142
|
+
const start = this.inputIndex;
|
|
18143
|
+
let result = this.parsePrefix();
|
|
18144
|
+
while (this.next.type == TokenType.Operator && this.next.strValue === "**") {
|
|
18145
|
+
if (result instanceof Unary || result instanceof PrefixNot || result instanceof TypeofExpression || result instanceof VoidExpression) {
|
|
18146
|
+
this.error("Unary operator used immediately before exponentiation expression. Parenthesis must be used to disambiguate operator precedence");
|
|
18147
|
+
}
|
|
18148
|
+
this.advance();
|
|
18149
|
+
const right = this.parseExponentiation();
|
|
18150
|
+
result = new Binary(this.span(start), this.sourceSpan(start), "**", result, right);
|
|
18151
|
+
}
|
|
18152
|
+
return result;
|
|
18153
|
+
}
|
|
17596
18154
|
parsePrefix() {
|
|
17597
18155
|
if (this.next.type == TokenType.Operator) {
|
|
17598
18156
|
const start = this.inputIndex;
|
|
@@ -17617,6 +18175,11 @@ var _ParseAST = class {
|
|
|
17617
18175
|
const start = this.inputIndex;
|
|
17618
18176
|
let result = this.parsePrefix();
|
|
17619
18177
|
return new TypeofExpression(this.span(start), this.sourceSpan(start), result);
|
|
18178
|
+
} else if (this.next.isKeywordVoid()) {
|
|
18179
|
+
this.advance();
|
|
18180
|
+
const start = this.inputIndex;
|
|
18181
|
+
let result = this.parsePrefix();
|
|
18182
|
+
return new VoidExpression(this.span(start), this.sourceSpan(start), result);
|
|
17620
18183
|
}
|
|
17621
18184
|
return this.parseCallChain();
|
|
17622
18185
|
}
|
|
@@ -17638,6 +18201,10 @@ var _ParseAST = class {
|
|
|
17638
18201
|
result = this.parseCall(result, start, false);
|
|
17639
18202
|
} else if (this.consumeOptionalOperator("!")) {
|
|
17640
18203
|
result = new NonNullAssert(this.span(start), this.sourceSpan(start), result);
|
|
18204
|
+
} else if (this.next.isTemplateLiteralEnd()) {
|
|
18205
|
+
result = this.parseNoInterpolationTaggedTemplateLiteral(result, start);
|
|
18206
|
+
} else if (this.next.isTemplateLiteralPart()) {
|
|
18207
|
+
result = this.parseTaggedTemplateLiteral(result, start);
|
|
17641
18208
|
} else {
|
|
17642
18209
|
return result;
|
|
17643
18210
|
}
|
|
@@ -17650,7 +18217,7 @@ var _ParseAST = class {
|
|
|
17650
18217
|
const result = this.parsePipe();
|
|
17651
18218
|
this.rparensExpected--;
|
|
17652
18219
|
this.expectCharacter($RPAREN);
|
|
17653
|
-
return result;
|
|
18220
|
+
return new ParenthesizedExpression(this.span(start), this.sourceSpan(start), result);
|
|
17654
18221
|
} else if (this.next.isKeywordNull()) {
|
|
17655
18222
|
this.advance();
|
|
17656
18223
|
return new LiteralPrimitive(this.span(start), this.sourceSpan(start), null);
|
|
@@ -17663,6 +18230,9 @@ var _ParseAST = class {
|
|
|
17663
18230
|
} else if (this.next.isKeywordFalse()) {
|
|
17664
18231
|
this.advance();
|
|
17665
18232
|
return new LiteralPrimitive(this.span(start), this.sourceSpan(start), false);
|
|
18233
|
+
} else if (this.next.isKeywordIn()) {
|
|
18234
|
+
this.advance();
|
|
18235
|
+
return new LiteralPrimitive(this.span(start), this.sourceSpan(start), "in");
|
|
17666
18236
|
} else if (this.next.isKeywordThis()) {
|
|
17667
18237
|
this.advance();
|
|
17668
18238
|
return new ThisReceiver(this.span(start), this.sourceSpan(start));
|
|
@@ -17973,6 +18543,10 @@ var _ParseAST = class {
|
|
|
17973
18543
|
const sourceSpan = new AbsoluteSourceSpan(spanStart, this.currentAbsoluteOffset);
|
|
17974
18544
|
return new VariableBinding(sourceSpan, key, value);
|
|
17975
18545
|
}
|
|
18546
|
+
parseNoInterpolationTaggedTemplateLiteral(tag, start) {
|
|
18547
|
+
const template2 = this.parseNoInterpolationTemplateLiteral();
|
|
18548
|
+
return new TaggedTemplateLiteral(this.span(start), this.sourceSpan(start), tag, template2);
|
|
18549
|
+
}
|
|
17976
18550
|
parseNoInterpolationTemplateLiteral() {
|
|
17977
18551
|
const text2 = this.next.strValue;
|
|
17978
18552
|
const start = this.inputIndex;
|
|
@@ -17981,10 +18555,14 @@ var _ParseAST = class {
|
|
|
17981
18555
|
const sourceSpan = this.sourceSpan(start);
|
|
17982
18556
|
return new TemplateLiteral(span, sourceSpan, [new TemplateLiteralElement(span, sourceSpan, text2)], []);
|
|
17983
18557
|
}
|
|
18558
|
+
parseTaggedTemplateLiteral(tag, start) {
|
|
18559
|
+
const template2 = this.parseTemplateLiteral();
|
|
18560
|
+
return new TaggedTemplateLiteral(this.span(start), this.sourceSpan(start), tag, template2);
|
|
18561
|
+
}
|
|
17984
18562
|
parseTemplateLiteral() {
|
|
17985
|
-
const start = this.inputIndex;
|
|
17986
18563
|
const elements = [];
|
|
17987
18564
|
const expressions = [];
|
|
18565
|
+
const start = this.inputIndex;
|
|
17988
18566
|
while (this.next !== EOF) {
|
|
17989
18567
|
const token = this.next;
|
|
17990
18568
|
if (token.isTemplateLiteralPart() || token.isTemplateLiteralEnd()) {
|
|
@@ -18199,6 +18777,9 @@ var SerializeExpressionVisitor = class {
|
|
|
18199
18777
|
visitTypeofExpression(ast, context) {
|
|
18200
18778
|
return `typeof ${ast.expression.visit(this, context)}`;
|
|
18201
18779
|
}
|
|
18780
|
+
visitVoidExpression(ast, context) {
|
|
18781
|
+
return `void ${ast.expression.visit(this, context)}`;
|
|
18782
|
+
}
|
|
18202
18783
|
visitASTWithSource(ast, context) {
|
|
18203
18784
|
return ast.ast.visit(this, context);
|
|
18204
18785
|
}
|
|
@@ -18216,6 +18797,12 @@ var SerializeExpressionVisitor = class {
|
|
|
18216
18797
|
visitTemplateLiteralElement(ast, context) {
|
|
18217
18798
|
return ast.text;
|
|
18218
18799
|
}
|
|
18800
|
+
visitTaggedTemplateLiteral(ast, context) {
|
|
18801
|
+
return ast.tag.visit(this, context) + ast.template.visit(this, context);
|
|
18802
|
+
}
|
|
18803
|
+
visitParenthesizedExpression(ast, context) {
|
|
18804
|
+
return "(" + ast.expression.visit(this, context) + ")";
|
|
18805
|
+
}
|
|
18219
18806
|
};
|
|
18220
18807
|
function zip(left, right) {
|
|
18221
18808
|
if (left.length !== right.length)
|
|
@@ -18370,6 +18957,7 @@ var SCHEMA = [
|
|
|
18370
18957
|
"q,blockquote,cite^[HTMLElement]|",
|
|
18371
18958
|
"script^[HTMLElement]|!async,charset,%crossOrigin,!defer,event,htmlFor,integrity,!noModule,%referrerPolicy,src,text,type",
|
|
18372
18959
|
"select^[HTMLElement]|autocomplete,!disabled,#length,!multiple,name,!required,#selectedIndex,#size,value",
|
|
18960
|
+
"selectedcontent^[HTMLElement]|",
|
|
18373
18961
|
"slot^[HTMLElement]|name",
|
|
18374
18962
|
"source^[HTMLElement]|#height,media,sizes,src,srcset,type,#width",
|
|
18375
18963
|
"span^[HTMLElement]|",
|
|
@@ -19009,27 +19597,13 @@ var _I18nVisitor = class {
|
|
|
19009
19597
|
return new Message(i18nodes, context.placeholderToContent, context.placeholderToMessage, meaning, description, customId);
|
|
19010
19598
|
}
|
|
19011
19599
|
visitElement(el, context) {
|
|
19012
|
-
|
|
19013
|
-
|
|
19014
|
-
|
|
19015
|
-
|
|
19016
|
-
|
|
19017
|
-
|
|
19018
|
-
|
|
19019
|
-
context.placeholderToContent[startPhName] = {
|
|
19020
|
-
text: el.startSourceSpan.toString(),
|
|
19021
|
-
sourceSpan: el.startSourceSpan
|
|
19022
|
-
};
|
|
19023
|
-
let closePhName = "";
|
|
19024
|
-
if (!isVoid) {
|
|
19025
|
-
closePhName = context.placeholderRegistry.getCloseTagPlaceholderName(el.name);
|
|
19026
|
-
context.placeholderToContent[closePhName] = {
|
|
19027
|
-
text: `</${el.name}>`,
|
|
19028
|
-
sourceSpan: el.endSourceSpan ?? el.sourceSpan
|
|
19029
|
-
};
|
|
19030
|
-
}
|
|
19031
|
-
const node = new TagPlaceholder(el.name, attrs, startPhName, closePhName, children, isVoid, el.sourceSpan, el.startSourceSpan, el.endSourceSpan);
|
|
19032
|
-
return context.visitNodeFn(el, node);
|
|
19600
|
+
return this._visitElementLike(el, context);
|
|
19601
|
+
}
|
|
19602
|
+
visitComponent(component, context) {
|
|
19603
|
+
return this._visitElementLike(component, context);
|
|
19604
|
+
}
|
|
19605
|
+
visitDirective(directive, context) {
|
|
19606
|
+
throw new Error("Unreachable code");
|
|
19033
19607
|
}
|
|
19034
19608
|
visitAttribute(attribute2, context) {
|
|
19035
19609
|
const node = attribute2.valueTokens === void 0 || attribute2.valueTokens.length === 1 ? new Text$2(attribute2.value, attribute2.valueSpan || attribute2.sourceSpan) : this._visitTextWithInterpolation(attribute2.valueTokens, attribute2.valueSpan || attribute2.sourceSpan, context, attribute2.i18n);
|
|
@@ -19092,6 +19666,39 @@ var _I18nVisitor = class {
|
|
|
19092
19666
|
visitLetDeclaration(decl, context) {
|
|
19093
19667
|
return null;
|
|
19094
19668
|
}
|
|
19669
|
+
_visitElementLike(node, context) {
|
|
19670
|
+
const children = visitAll(this, node.children, context);
|
|
19671
|
+
const attrs = {};
|
|
19672
|
+
const visitAttribute = /* @__PURE__ */ __name((attr) => {
|
|
19673
|
+
attrs[attr.name] = attr.value;
|
|
19674
|
+
}, "visitAttribute");
|
|
19675
|
+
let nodeName;
|
|
19676
|
+
let isVoid;
|
|
19677
|
+
if (node instanceof Element2) {
|
|
19678
|
+
nodeName = node.name;
|
|
19679
|
+
isVoid = getHtmlTagDefinition(node.name).isVoid;
|
|
19680
|
+
} else {
|
|
19681
|
+
nodeName = node.fullName;
|
|
19682
|
+
isVoid = node.tagName ? getHtmlTagDefinition(node.tagName).isVoid : false;
|
|
19683
|
+
}
|
|
19684
|
+
node.attrs.forEach(visitAttribute);
|
|
19685
|
+
node.directives.forEach((dir) => dir.attrs.forEach(visitAttribute));
|
|
19686
|
+
const startPhName = context.placeholderRegistry.getStartTagPlaceholderName(nodeName, attrs, isVoid);
|
|
19687
|
+
context.placeholderToContent[startPhName] = {
|
|
19688
|
+
text: node.startSourceSpan.toString(),
|
|
19689
|
+
sourceSpan: node.startSourceSpan
|
|
19690
|
+
};
|
|
19691
|
+
let closePhName = "";
|
|
19692
|
+
if (!isVoid) {
|
|
19693
|
+
closePhName = context.placeholderRegistry.getCloseTagPlaceholderName(nodeName);
|
|
19694
|
+
context.placeholderToContent[closePhName] = {
|
|
19695
|
+
text: `</${nodeName}>`,
|
|
19696
|
+
sourceSpan: node.endSourceSpan ?? node.sourceSpan
|
|
19697
|
+
};
|
|
19698
|
+
}
|
|
19699
|
+
const i18nNode = new TagPlaceholder(nodeName, attrs, startPhName, closePhName, children, isVoid, node.sourceSpan, node.startSourceSpan, node.endSourceSpan);
|
|
19700
|
+
return context.visitNodeFn(node, i18nNode);
|
|
19701
|
+
}
|
|
19095
19702
|
/**
|
|
19096
19703
|
* Convert, text and interpolated tokens up into text and placeholder pieces.
|
|
19097
19704
|
*
|
|
@@ -19285,47 +19892,13 @@ var I18nMetaVisitor = class {
|
|
|
19285
19892
|
return new ParseTreeResult(result, this._errors);
|
|
19286
19893
|
}
|
|
19287
19894
|
visitElement(element2) {
|
|
19288
|
-
|
|
19289
|
-
if (hasI18nAttrs(element2)) {
|
|
19290
|
-
this.hasI18nMeta = true;
|
|
19291
|
-
const attrs = [];
|
|
19292
|
-
const attrsMeta = {};
|
|
19293
|
-
for (const attr of element2.attrs) {
|
|
19294
|
-
if (attr.name === I18N_ATTR) {
|
|
19295
|
-
const i18n2 = element2.i18n || attr.value;
|
|
19296
|
-
const originalNodeMap = /* @__PURE__ */ new Map();
|
|
19297
|
-
const trimmedNodes = this.preserveSignificantWhitespace ? element2.children : visitAllWithSiblings(new WhitespaceVisitor(false, originalNodeMap), element2.children);
|
|
19298
|
-
message = this._generateI18nMessage(trimmedNodes, i18n2, setI18nRefs(originalNodeMap));
|
|
19299
|
-
if (message.nodes.length === 0) {
|
|
19300
|
-
message = void 0;
|
|
19301
|
-
}
|
|
19302
|
-
element2.i18n = message;
|
|
19303
|
-
} else if (attr.name.startsWith(I18N_ATTR_PREFIX)) {
|
|
19304
|
-
const name = attr.name.slice(I18N_ATTR_PREFIX.length);
|
|
19305
|
-
if (isTrustedTypesSink(element2.name, name)) {
|
|
19306
|
-
this._reportError(attr, `Translating attribute '${name}' is disallowed for security reasons.`);
|
|
19307
|
-
} else {
|
|
19308
|
-
attrsMeta[name] = attr.value;
|
|
19309
|
-
}
|
|
19310
|
-
} else {
|
|
19311
|
-
attrs.push(attr);
|
|
19312
|
-
}
|
|
19313
|
-
}
|
|
19314
|
-
if (Object.keys(attrsMeta).length) {
|
|
19315
|
-
for (const attr of attrs) {
|
|
19316
|
-
const meta = attrsMeta[attr.name];
|
|
19317
|
-
if (meta !== void 0 && attr.value) {
|
|
19318
|
-
attr.i18n = this._generateI18nMessage([attr], attr.i18n || meta);
|
|
19319
|
-
}
|
|
19320
|
-
}
|
|
19321
|
-
}
|
|
19322
|
-
if (!this.keepI18nAttrs) {
|
|
19323
|
-
element2.attrs = attrs;
|
|
19324
|
-
}
|
|
19325
|
-
}
|
|
19326
|
-
visitAll(this, element2.children, message);
|
|
19895
|
+
this._visitElementLike(element2);
|
|
19327
19896
|
return element2;
|
|
19328
19897
|
}
|
|
19898
|
+
visitComponent(component, context) {
|
|
19899
|
+
this._visitElementLike(component);
|
|
19900
|
+
return component;
|
|
19901
|
+
}
|
|
19329
19902
|
visitExpansion(expansion, currentMessage) {
|
|
19330
19903
|
let message;
|
|
19331
19904
|
const meta = expansion.i18n;
|
|
@@ -19366,6 +19939,56 @@ var I18nMetaVisitor = class {
|
|
|
19366
19939
|
visitLetDeclaration(decl, context) {
|
|
19367
19940
|
return decl;
|
|
19368
19941
|
}
|
|
19942
|
+
visitDirective(directive, context) {
|
|
19943
|
+
return directive;
|
|
19944
|
+
}
|
|
19945
|
+
_visitElementLike(node) {
|
|
19946
|
+
let message = void 0;
|
|
19947
|
+
if (hasI18nAttrs(node)) {
|
|
19948
|
+
this.hasI18nMeta = true;
|
|
19949
|
+
const attrs = [];
|
|
19950
|
+
const attrsMeta = {};
|
|
19951
|
+
for (const attr of node.attrs) {
|
|
19952
|
+
if (attr.name === I18N_ATTR) {
|
|
19953
|
+
const i18n2 = node.i18n || attr.value;
|
|
19954
|
+
const originalNodeMap = /* @__PURE__ */ new Map();
|
|
19955
|
+
const trimmedNodes = this.preserveSignificantWhitespace ? node.children : visitAllWithSiblings(new WhitespaceVisitor(false, originalNodeMap), node.children);
|
|
19956
|
+
message = this._generateI18nMessage(trimmedNodes, i18n2, setI18nRefs(originalNodeMap));
|
|
19957
|
+
if (message.nodes.length === 0) {
|
|
19958
|
+
message = void 0;
|
|
19959
|
+
}
|
|
19960
|
+
node.i18n = message;
|
|
19961
|
+
} else if (attr.name.startsWith(I18N_ATTR_PREFIX)) {
|
|
19962
|
+
const name = attr.name.slice(I18N_ATTR_PREFIX.length);
|
|
19963
|
+
let isTrustedType;
|
|
19964
|
+
if (node instanceof Component2) {
|
|
19965
|
+
isTrustedType = node.tagName === null ? false : isTrustedTypesSink(node.tagName, name);
|
|
19966
|
+
} else {
|
|
19967
|
+
isTrustedType = isTrustedTypesSink(node.name, name);
|
|
19968
|
+
}
|
|
19969
|
+
if (isTrustedType) {
|
|
19970
|
+
this._reportError(attr, `Translating attribute '${name}' is disallowed for security reasons.`);
|
|
19971
|
+
} else {
|
|
19972
|
+
attrsMeta[name] = attr.value;
|
|
19973
|
+
}
|
|
19974
|
+
} else {
|
|
19975
|
+
attrs.push(attr);
|
|
19976
|
+
}
|
|
19977
|
+
}
|
|
19978
|
+
if (Object.keys(attrsMeta).length) {
|
|
19979
|
+
for (const attr of attrs) {
|
|
19980
|
+
const meta = attrsMeta[attr.name];
|
|
19981
|
+
if (meta !== void 0 && attr.value) {
|
|
19982
|
+
attr.i18n = this._generateI18nMessage([attr], attr.i18n || meta);
|
|
19983
|
+
}
|
|
19984
|
+
}
|
|
19985
|
+
}
|
|
19986
|
+
if (!this.keepI18nAttrs) {
|
|
19987
|
+
node.attrs = attrs;
|
|
19988
|
+
}
|
|
19989
|
+
}
|
|
19990
|
+
visitAll(this, node.children, message);
|
|
19991
|
+
}
|
|
19369
19992
|
/**
|
|
19370
19993
|
* Parse the general form `meta` passed into extract the explicit metadata needed to create a
|
|
19371
19994
|
* `Message`.
|
|
@@ -19861,6 +20484,8 @@ function liftLocalRefs(job) {
|
|
|
19861
20484
|
for (const op of unit.create) {
|
|
19862
20485
|
switch (op.kind) {
|
|
19863
20486
|
case OpKind.ElementStart:
|
|
20487
|
+
case OpKind.ConditionalCreate:
|
|
20488
|
+
case OpKind.ConditionalBranchCreate:
|
|
19864
20489
|
case OpKind.Template:
|
|
19865
20490
|
if (!Array.isArray(op.localRefs)) {
|
|
19866
20491
|
throw new Error(`AssertionError: expected localRefs to be an array still`);
|
|
@@ -19975,7 +20600,7 @@ function parseExtractedStyles(job) {
|
|
|
19975
20600
|
for (const op of unit.create) {
|
|
19976
20601
|
if (op.kind === OpKind.ExtractedAttribute && op.bindingKind === BindingKind.Attribute && isStringLiteral(op.expression)) {
|
|
19977
20602
|
const target = elements.get(op.target);
|
|
19978
|
-
if (target !== void 0 && target.kind === OpKind.Template && target.templateKind === TemplateKind.Structural) {
|
|
20603
|
+
if (target !== void 0 && (target.kind === OpKind.Template || target.kind === OpKind.ConditionalCreate || target.kind === OpKind.ConditionalBranchCreate) && target.templateKind === TemplateKind.Structural) {
|
|
19979
20604
|
continue;
|
|
19980
20605
|
}
|
|
19981
20606
|
if (op.name === "style") {
|
|
@@ -20012,7 +20637,7 @@ function addNamesToView(unit, baseName, state, compatibility) {
|
|
|
20012
20637
|
for (const op of unit.ops()) {
|
|
20013
20638
|
switch (op.kind) {
|
|
20014
20639
|
case OpKind.Property:
|
|
20015
|
-
case OpKind.
|
|
20640
|
+
case OpKind.DomProperty:
|
|
20016
20641
|
if (op.isAnimationTrigger) {
|
|
20017
20642
|
op.name = "@" + op.name;
|
|
20018
20643
|
}
|
|
@@ -20073,6 +20698,8 @@ function addNamesToView(unit, baseName, state, compatibility) {
|
|
|
20073
20698
|
addNamesToView(fallbackView, `${baseName}_ProjectionFallback_${op.handle.slot}`, state, compatibility);
|
|
20074
20699
|
}
|
|
20075
20700
|
break;
|
|
20701
|
+
case OpKind.ConditionalCreate:
|
|
20702
|
+
case OpKind.ConditionalBranchCreate:
|
|
20076
20703
|
case OpKind.Template:
|
|
20077
20704
|
if (!(unit instanceof ViewCompilationUnit)) {
|
|
20078
20705
|
throw new Error(`AssertionError: must be compiling a component`);
|
|
@@ -20237,21 +20864,6 @@ function disableBindings$1(job) {
|
|
|
20237
20864
|
}
|
|
20238
20865
|
}
|
|
20239
20866
|
__name(disableBindings$1, "disableBindings$1");
|
|
20240
|
-
function generateNullishCoalesceExpressions(job) {
|
|
20241
|
-
for (const unit of job.units) {
|
|
20242
|
-
for (const op of unit.ops()) {
|
|
20243
|
-
transformExpressionsInOp(op, (expr) => {
|
|
20244
|
-
if (!(expr instanceof BinaryOperatorExpr) || expr.operator !== BinaryOperator.NullishCoalesce) {
|
|
20245
|
-
return expr;
|
|
20246
|
-
}
|
|
20247
|
-
const assignment = new AssignTemporaryExpr(expr.lhs.clone(), job.allocateXrefId());
|
|
20248
|
-
const read = new ReadTemporaryExpr(assignment.xref);
|
|
20249
|
-
return new ConditionalExpr(new BinaryOperatorExpr(BinaryOperator.And, new BinaryOperatorExpr(BinaryOperator.NotIdentical, assignment, NULL_EXPR), new BinaryOperatorExpr(BinaryOperator.NotIdentical, read, new LiteralExpr(void 0))), read.clone(), expr.rhs);
|
|
20250
|
-
}, VisitorContextFlag.None);
|
|
20251
|
-
}
|
|
20252
|
-
}
|
|
20253
|
-
}
|
|
20254
|
-
__name(generateNullishCoalesceExpressions, "generateNullishCoalesceExpressions");
|
|
20255
20867
|
function kindTest(kind) {
|
|
20256
20868
|
return (op) => op.kind === kind;
|
|
20257
20869
|
}
|
|
@@ -20285,8 +20897,8 @@ var UPDATE_ORDERING = [
|
|
|
20285
20897
|
{ test: kindWithInterpolationTest(OpKind.Attribute, false) }
|
|
20286
20898
|
];
|
|
20287
20899
|
var UPDATE_HOST_ORDERING = [
|
|
20288
|
-
{ test: kindWithInterpolationTest(OpKind.
|
|
20289
|
-
{ test: kindWithInterpolationTest(OpKind.
|
|
20900
|
+
{ test: kindWithInterpolationTest(OpKind.DomProperty, true) },
|
|
20901
|
+
{ test: kindWithInterpolationTest(OpKind.DomProperty, false) },
|
|
20290
20902
|
{ test: kindTest(OpKind.Attribute) },
|
|
20291
20903
|
{ test: kindTest(OpKind.StyleMap), transform: keepLast },
|
|
20292
20904
|
{ test: kindTest(OpKind.ClassMap), transform: keepLast },
|
|
@@ -20302,7 +20914,7 @@ var handledOpKinds = /* @__PURE__ */ new Set([
|
|
|
20302
20914
|
OpKind.ClassProp,
|
|
20303
20915
|
OpKind.Property,
|
|
20304
20916
|
OpKind.TwoWayProperty,
|
|
20305
|
-
OpKind.
|
|
20917
|
+
OpKind.DomProperty,
|
|
20306
20918
|
OpKind.Attribute
|
|
20307
20919
|
]);
|
|
20308
20920
|
function orderOps(job) {
|
|
@@ -20459,6 +21071,8 @@ function propagateI18nBlocksToTemplates(unit, subTemplateIndex) {
|
|
|
20459
21071
|
}
|
|
20460
21072
|
i18nBlock = null;
|
|
20461
21073
|
break;
|
|
21074
|
+
case OpKind.ConditionalCreate:
|
|
21075
|
+
case OpKind.ConditionalBranchCreate:
|
|
20462
21076
|
case OpKind.Template:
|
|
20463
21077
|
subTemplateIndex = propagateI18nBlocksForView(unit.job.views.get(op.xref), i18nBlock, op.i18nPlaceholder, subTemplateIndex);
|
|
20464
21078
|
break;
|
|
@@ -20678,7 +21292,6 @@ __name(enableBindings, "enableBindings");
|
|
|
20678
21292
|
function listener(name, handlerFn, eventTargetResolver, syntheticHost, sourceSpan) {
|
|
20679
21293
|
const args = [literal(name), handlerFn];
|
|
20680
21294
|
if (eventTargetResolver !== null) {
|
|
20681
|
-
args.push(literal(false));
|
|
20682
21295
|
args.push(importExpr(eventTargetResolver));
|
|
20683
21296
|
}
|
|
20684
21297
|
return call(syntheticHost ? Identifiers.syntheticHostListener : Identifiers.listener, args, sourceSpan);
|
|
@@ -20918,6 +21531,44 @@ function i18nStart(slot, constIndex, subTemplateIndex, sourceSpan) {
|
|
|
20918
21531
|
return call(Identifiers.i18nStart, args, sourceSpan);
|
|
20919
21532
|
}
|
|
20920
21533
|
__name(i18nStart, "i18nStart");
|
|
21534
|
+
function conditionalCreate(slot, templateFnRef, decls, vars, tag, constIndex, localRefs, sourceSpan) {
|
|
21535
|
+
const args = [
|
|
21536
|
+
literal(slot),
|
|
21537
|
+
templateFnRef,
|
|
21538
|
+
literal(decls),
|
|
21539
|
+
literal(vars),
|
|
21540
|
+
literal(tag),
|
|
21541
|
+
literal(constIndex)
|
|
21542
|
+
];
|
|
21543
|
+
if (localRefs !== null) {
|
|
21544
|
+
args.push(literal(localRefs));
|
|
21545
|
+
args.push(importExpr(Identifiers.templateRefExtractor));
|
|
21546
|
+
}
|
|
21547
|
+
while (args[args.length - 1].isEquivalent(NULL_EXPR)) {
|
|
21548
|
+
args.pop();
|
|
21549
|
+
}
|
|
21550
|
+
return call(Identifiers.conditionalCreate, args, sourceSpan);
|
|
21551
|
+
}
|
|
21552
|
+
__name(conditionalCreate, "conditionalCreate");
|
|
21553
|
+
function conditionalBranchCreate(slot, templateFnRef, decls, vars, tag, constIndex, localRefs, sourceSpan) {
|
|
21554
|
+
const args = [
|
|
21555
|
+
literal(slot),
|
|
21556
|
+
templateFnRef,
|
|
21557
|
+
literal(decls),
|
|
21558
|
+
literal(vars),
|
|
21559
|
+
literal(tag),
|
|
21560
|
+
literal(constIndex)
|
|
21561
|
+
];
|
|
21562
|
+
if (localRefs !== null) {
|
|
21563
|
+
args.push(literal(localRefs));
|
|
21564
|
+
args.push(importExpr(Identifiers.templateRefExtractor));
|
|
21565
|
+
}
|
|
21566
|
+
while (args[args.length - 1].isEquivalent(NULL_EXPR)) {
|
|
21567
|
+
args.pop();
|
|
21568
|
+
}
|
|
21569
|
+
return call(Identifiers.conditionalBranchCreate, args, sourceSpan);
|
|
21570
|
+
}
|
|
21571
|
+
__name(conditionalBranchCreate, "conditionalBranchCreate");
|
|
20921
21572
|
function repeaterCreate(slot, viewFnName, decls, vars, tag, constIndex, trackByFn, trackByUsesComponentInstance, emptyViewFnName, emptyDecls, emptyVars, emptyTag, emptyConstIndex, sourceSpan) {
|
|
20922
21573
|
const args = [
|
|
20923
21574
|
literal(slot),
|
|
@@ -20986,7 +21637,12 @@ function i18nAttributes(slot, i18nAttributesConfig) {
|
|
|
20986
21637
|
}
|
|
20987
21638
|
__name(i18nAttributes, "i18nAttributes");
|
|
20988
21639
|
function property(name, expression, sanitizer, sourceSpan) {
|
|
20989
|
-
const args = [literal(name)
|
|
21640
|
+
const args = [literal(name)];
|
|
21641
|
+
if (expression instanceof Interpolation2) {
|
|
21642
|
+
args.push(interpolationToExpression(expression, sourceSpan));
|
|
21643
|
+
} else {
|
|
21644
|
+
args.push(expression);
|
|
21645
|
+
}
|
|
20990
21646
|
if (sanitizer !== null) {
|
|
20991
21647
|
args.push(sanitizer);
|
|
20992
21648
|
}
|
|
@@ -21001,8 +21657,13 @@ function twoWayProperty(name, expression, sanitizer, sourceSpan) {
|
|
|
21001
21657
|
return call(Identifiers.twoWayProperty, args, sourceSpan);
|
|
21002
21658
|
}
|
|
21003
21659
|
__name(twoWayProperty, "twoWayProperty");
|
|
21004
|
-
function attribute(name, expression, sanitizer, namespace) {
|
|
21005
|
-
const args = [literal(name)
|
|
21660
|
+
function attribute(name, expression, sanitizer, namespace, sourceSpan) {
|
|
21661
|
+
const args = [literal(name)];
|
|
21662
|
+
if (expression instanceof Interpolation2) {
|
|
21663
|
+
args.push(interpolationToExpression(expression, sourceSpan));
|
|
21664
|
+
} else {
|
|
21665
|
+
args.push(expression);
|
|
21666
|
+
}
|
|
21006
21667
|
if (sanitizer !== null || namespace !== null) {
|
|
21007
21668
|
args.push(sanitizer ?? literal(null));
|
|
21008
21669
|
}
|
|
@@ -21013,7 +21674,12 @@ function attribute(name, expression, sanitizer, namespace) {
|
|
|
21013
21674
|
}
|
|
21014
21675
|
__name(attribute, "attribute");
|
|
21015
21676
|
function styleProp(name, expression, unit, sourceSpan) {
|
|
21016
|
-
const args = [literal(name)
|
|
21677
|
+
const args = [literal(name)];
|
|
21678
|
+
if (expression instanceof Interpolation2) {
|
|
21679
|
+
args.push(interpolationToExpression(expression, sourceSpan));
|
|
21680
|
+
} else {
|
|
21681
|
+
args.push(expression);
|
|
21682
|
+
}
|
|
21017
21683
|
if (unit !== null) {
|
|
21018
21684
|
args.push(literal(unit));
|
|
21019
21685
|
}
|
|
@@ -21025,11 +21691,13 @@ function classProp(name, expression, sourceSpan) {
|
|
|
21025
21691
|
}
|
|
21026
21692
|
__name(classProp, "classProp");
|
|
21027
21693
|
function styleMap(expression, sourceSpan) {
|
|
21028
|
-
|
|
21694
|
+
const value = expression instanceof Interpolation2 ? interpolationToExpression(expression, sourceSpan) : expression;
|
|
21695
|
+
return call(Identifiers.styleMap, [value], sourceSpan);
|
|
21029
21696
|
}
|
|
21030
21697
|
__name(styleMap, "styleMap");
|
|
21031
21698
|
function classMap(expression, sourceSpan) {
|
|
21032
|
-
|
|
21699
|
+
const value = expression instanceof Interpolation2 ? interpolationToExpression(expression, sourceSpan) : expression;
|
|
21700
|
+
return call(Identifiers.classMap, [value], sourceSpan);
|
|
21033
21701
|
}
|
|
21034
21702
|
__name(classMap, "classMap");
|
|
21035
21703
|
var PIPE_BINDINGS = [
|
|
@@ -21063,51 +21731,14 @@ function i18nApply(slot, sourceSpan) {
|
|
|
21063
21731
|
return call(Identifiers.i18nApply, [literal(slot)], sourceSpan);
|
|
21064
21732
|
}
|
|
21065
21733
|
__name(i18nApply, "i18nApply");
|
|
21066
|
-
function
|
|
21067
|
-
const interpolationArgs = collateInterpolationArgs(strings, expressions);
|
|
21068
|
-
const extraArgs = [];
|
|
21069
|
-
if (sanitizer !== null) {
|
|
21070
|
-
extraArgs.push(sanitizer);
|
|
21071
|
-
}
|
|
21072
|
-
return callVariadicInstruction(PROPERTY_INTERPOLATE_CONFIG, [literal(name)], interpolationArgs, extraArgs, sourceSpan);
|
|
21073
|
-
}
|
|
21074
|
-
__name(propertyInterpolate, "propertyInterpolate");
|
|
21075
|
-
function attributeInterpolate(name, strings, expressions, sanitizer, sourceSpan) {
|
|
21076
|
-
const interpolationArgs = collateInterpolationArgs(strings, expressions);
|
|
21077
|
-
const extraArgs = [];
|
|
21078
|
-
if (sanitizer !== null) {
|
|
21079
|
-
extraArgs.push(sanitizer);
|
|
21080
|
-
}
|
|
21081
|
-
return callVariadicInstruction(ATTRIBUTE_INTERPOLATE_CONFIG, [literal(name)], interpolationArgs, extraArgs, sourceSpan);
|
|
21082
|
-
}
|
|
21083
|
-
__name(attributeInterpolate, "attributeInterpolate");
|
|
21084
|
-
function stylePropInterpolate(name, strings, expressions, unit, sourceSpan) {
|
|
21085
|
-
const interpolationArgs = collateInterpolationArgs(strings, expressions);
|
|
21086
|
-
const extraArgs = [];
|
|
21087
|
-
if (unit !== null) {
|
|
21088
|
-
extraArgs.push(literal(unit));
|
|
21089
|
-
}
|
|
21090
|
-
return callVariadicInstruction(STYLE_PROP_INTERPOLATE_CONFIG, [literal(name)], interpolationArgs, extraArgs, sourceSpan);
|
|
21091
|
-
}
|
|
21092
|
-
__name(stylePropInterpolate, "stylePropInterpolate");
|
|
21093
|
-
function styleMapInterpolate(strings, expressions, sourceSpan) {
|
|
21094
|
-
const interpolationArgs = collateInterpolationArgs(strings, expressions);
|
|
21095
|
-
return callVariadicInstruction(STYLE_MAP_INTERPOLATE_CONFIG, [], interpolationArgs, [], sourceSpan);
|
|
21096
|
-
}
|
|
21097
|
-
__name(styleMapInterpolate, "styleMapInterpolate");
|
|
21098
|
-
function classMapInterpolate(strings, expressions, sourceSpan) {
|
|
21099
|
-
const interpolationArgs = collateInterpolationArgs(strings, expressions);
|
|
21100
|
-
return callVariadicInstruction(CLASS_MAP_INTERPOLATE_CONFIG, [], interpolationArgs, [], sourceSpan);
|
|
21101
|
-
}
|
|
21102
|
-
__name(classMapInterpolate, "classMapInterpolate");
|
|
21103
|
-
function hostProperty(name, expression, sanitizer, sourceSpan) {
|
|
21734
|
+
function domProperty(name, expression, sanitizer, sourceSpan) {
|
|
21104
21735
|
const args = [literal(name), expression];
|
|
21105
21736
|
if (sanitizer !== null) {
|
|
21106
21737
|
args.push(sanitizer);
|
|
21107
21738
|
}
|
|
21108
|
-
return call(Identifiers.
|
|
21739
|
+
return call(Identifiers.domProperty, args, sourceSpan);
|
|
21109
21740
|
}
|
|
21110
|
-
__name(
|
|
21741
|
+
__name(domProperty, "domProperty");
|
|
21111
21742
|
function syntheticHostProperty(name, expression, sourceSpan) {
|
|
21112
21743
|
return call(Identifiers.syntheticHostProperty, [literal(name), expression], sourceSpan);
|
|
21113
21744
|
}
|
|
@@ -21137,6 +21768,11 @@ function collateInterpolationArgs(strings, expressions) {
|
|
|
21137
21768
|
return interpolationArgs;
|
|
21138
21769
|
}
|
|
21139
21770
|
__name(collateInterpolationArgs, "collateInterpolationArgs");
|
|
21771
|
+
function interpolationToExpression(interpolation, sourceSpan) {
|
|
21772
|
+
const interpolationArgs = collateInterpolationArgs(interpolation.strings, interpolation.expressions);
|
|
21773
|
+
return callVariadicInstructionExpr(VALUE_INTERPOLATE_CONFIG, [], interpolationArgs, [], sourceSpan);
|
|
21774
|
+
}
|
|
21775
|
+
__name(interpolationToExpression, "interpolationToExpression");
|
|
21140
21776
|
function call(instruction, args, sourceSpan) {
|
|
21141
21777
|
const expr = importExpr(instruction).callFn(args, sourceSpan);
|
|
21142
21778
|
return createStatementOp(new ExpressionStatement(expr, sourceSpan));
|
|
@@ -21170,99 +21806,19 @@ var TEXT_INTERPOLATE_CONFIG = {
|
|
|
21170
21806
|
return (n - 1) / 2;
|
|
21171
21807
|
}, "mapping")
|
|
21172
21808
|
};
|
|
21173
|
-
var
|
|
21174
|
-
constant: [
|
|
21175
|
-
Identifiers.propertyInterpolate,
|
|
21176
|
-
Identifiers.propertyInterpolate1,
|
|
21177
|
-
Identifiers.propertyInterpolate2,
|
|
21178
|
-
Identifiers.propertyInterpolate3,
|
|
21179
|
-
Identifiers.propertyInterpolate4,
|
|
21180
|
-
Identifiers.propertyInterpolate5,
|
|
21181
|
-
Identifiers.propertyInterpolate6,
|
|
21182
|
-
Identifiers.propertyInterpolate7,
|
|
21183
|
-
Identifiers.propertyInterpolate8
|
|
21184
|
-
],
|
|
21185
|
-
variable: Identifiers.propertyInterpolateV,
|
|
21186
|
-
mapping: /* @__PURE__ */ __name((n) => {
|
|
21187
|
-
if (n % 2 === 0) {
|
|
21188
|
-
throw new Error(`Expected odd number of arguments`);
|
|
21189
|
-
}
|
|
21190
|
-
return (n - 1) / 2;
|
|
21191
|
-
}, "mapping")
|
|
21192
|
-
};
|
|
21193
|
-
var STYLE_PROP_INTERPOLATE_CONFIG = {
|
|
21194
|
-
constant: [
|
|
21195
|
-
Identifiers.styleProp,
|
|
21196
|
-
Identifiers.stylePropInterpolate1,
|
|
21197
|
-
Identifiers.stylePropInterpolate2,
|
|
21198
|
-
Identifiers.stylePropInterpolate3,
|
|
21199
|
-
Identifiers.stylePropInterpolate4,
|
|
21200
|
-
Identifiers.stylePropInterpolate5,
|
|
21201
|
-
Identifiers.stylePropInterpolate6,
|
|
21202
|
-
Identifiers.stylePropInterpolate7,
|
|
21203
|
-
Identifiers.stylePropInterpolate8
|
|
21204
|
-
],
|
|
21205
|
-
variable: Identifiers.stylePropInterpolateV,
|
|
21206
|
-
mapping: /* @__PURE__ */ __name((n) => {
|
|
21207
|
-
if (n % 2 === 0) {
|
|
21208
|
-
throw new Error(`Expected odd number of arguments`);
|
|
21209
|
-
}
|
|
21210
|
-
return (n - 1) / 2;
|
|
21211
|
-
}, "mapping")
|
|
21212
|
-
};
|
|
21213
|
-
var ATTRIBUTE_INTERPOLATE_CONFIG = {
|
|
21214
|
-
constant: [
|
|
21215
|
-
Identifiers.attribute,
|
|
21216
|
-
Identifiers.attributeInterpolate1,
|
|
21217
|
-
Identifiers.attributeInterpolate2,
|
|
21218
|
-
Identifiers.attributeInterpolate3,
|
|
21219
|
-
Identifiers.attributeInterpolate4,
|
|
21220
|
-
Identifiers.attributeInterpolate5,
|
|
21221
|
-
Identifiers.attributeInterpolate6,
|
|
21222
|
-
Identifiers.attributeInterpolate7,
|
|
21223
|
-
Identifiers.attributeInterpolate8
|
|
21224
|
-
],
|
|
21225
|
-
variable: Identifiers.attributeInterpolateV,
|
|
21226
|
-
mapping: /* @__PURE__ */ __name((n) => {
|
|
21227
|
-
if (n % 2 === 0) {
|
|
21228
|
-
throw new Error(`Expected odd number of arguments`);
|
|
21229
|
-
}
|
|
21230
|
-
return (n - 1) / 2;
|
|
21231
|
-
}, "mapping")
|
|
21232
|
-
};
|
|
21233
|
-
var STYLE_MAP_INTERPOLATE_CONFIG = {
|
|
21234
|
-
constant: [
|
|
21235
|
-
Identifiers.styleMap,
|
|
21236
|
-
Identifiers.styleMapInterpolate1,
|
|
21237
|
-
Identifiers.styleMapInterpolate2,
|
|
21238
|
-
Identifiers.styleMapInterpolate3,
|
|
21239
|
-
Identifiers.styleMapInterpolate4,
|
|
21240
|
-
Identifiers.styleMapInterpolate5,
|
|
21241
|
-
Identifiers.styleMapInterpolate6,
|
|
21242
|
-
Identifiers.styleMapInterpolate7,
|
|
21243
|
-
Identifiers.styleMapInterpolate8
|
|
21244
|
-
],
|
|
21245
|
-
variable: Identifiers.styleMapInterpolateV,
|
|
21246
|
-
mapping: /* @__PURE__ */ __name((n) => {
|
|
21247
|
-
if (n % 2 === 0) {
|
|
21248
|
-
throw new Error(`Expected odd number of arguments`);
|
|
21249
|
-
}
|
|
21250
|
-
return (n - 1) / 2;
|
|
21251
|
-
}, "mapping")
|
|
21252
|
-
};
|
|
21253
|
-
var CLASS_MAP_INTERPOLATE_CONFIG = {
|
|
21809
|
+
var VALUE_INTERPOLATE_CONFIG = {
|
|
21254
21810
|
constant: [
|
|
21255
|
-
Identifiers.
|
|
21256
|
-
Identifiers.
|
|
21257
|
-
Identifiers.
|
|
21258
|
-
Identifiers.
|
|
21259
|
-
Identifiers.
|
|
21260
|
-
Identifiers.
|
|
21261
|
-
Identifiers.
|
|
21262
|
-
Identifiers.
|
|
21263
|
-
Identifiers.
|
|
21811
|
+
Identifiers.interpolate,
|
|
21812
|
+
Identifiers.interpolate1,
|
|
21813
|
+
Identifiers.interpolate2,
|
|
21814
|
+
Identifiers.interpolate3,
|
|
21815
|
+
Identifiers.interpolate4,
|
|
21816
|
+
Identifiers.interpolate5,
|
|
21817
|
+
Identifiers.interpolate6,
|
|
21818
|
+
Identifiers.interpolate7,
|
|
21819
|
+
Identifiers.interpolate8
|
|
21264
21820
|
],
|
|
21265
|
-
variable: Identifiers.
|
|
21821
|
+
variable: Identifiers.interpolateV,
|
|
21266
21822
|
mapping: /* @__PURE__ */ __name((n) => {
|
|
21267
21823
|
if (n % 2 === 0) {
|
|
21268
21824
|
throw new Error(`Expected odd number of arguments`);
|
|
@@ -21287,6 +21843,10 @@ var PURE_FUNCTION_CONFIG = {
|
|
|
21287
21843
|
};
|
|
21288
21844
|
function callVariadicInstructionExpr(config, baseArgs, interpolationArgs, extraArgs, sourceSpan) {
|
|
21289
21845
|
const n = config.mapping(interpolationArgs.length);
|
|
21846
|
+
const lastInterpolationArg = interpolationArgs.at(-1);
|
|
21847
|
+
if (extraArgs.length === 0 && interpolationArgs.length > 1 && lastInterpolationArg instanceof LiteralExpr && lastInterpolationArg.value === "") {
|
|
21848
|
+
interpolationArgs.pop();
|
|
21849
|
+
}
|
|
21290
21850
|
if (n < config.constant.length) {
|
|
21291
21851
|
return importExpr(config.constant[n]).callFn([...baseArgs, ...interpolationArgs, ...extraArgs], sourceSpan);
|
|
21292
21852
|
} else if (config.variable !== null) {
|
|
@@ -21465,8 +22025,28 @@ function reifyCreateOperations(unit, ops) {
|
|
|
21465
22025
|
}
|
|
21466
22026
|
OpList.replace(op, projection(op.handle.slot, op.projectionSlotIndex, op.attributes, fallbackViewFnName, fallbackDecls, fallbackVars, op.sourceSpan));
|
|
21467
22027
|
break;
|
|
21468
|
-
case OpKind.
|
|
21469
|
-
if (
|
|
22028
|
+
case OpKind.ConditionalCreate:
|
|
22029
|
+
if (!(unit instanceof ViewCompilationUnit)) {
|
|
22030
|
+
throw new Error(`AssertionError: must be compiling a component`);
|
|
22031
|
+
}
|
|
22032
|
+
if (Array.isArray(op.localRefs)) {
|
|
22033
|
+
throw new Error(`AssertionError: local refs array should have been extracted into a constant`);
|
|
22034
|
+
}
|
|
22035
|
+
const conditionalCreateChildView = unit.job.views.get(op.xref);
|
|
22036
|
+
OpList.replace(op, conditionalCreate(op.handle.slot, variable(conditionalCreateChildView.fnName), conditionalCreateChildView.decls, conditionalCreateChildView.vars, op.tag, op.attributes, op.localRefs, op.startSourceSpan));
|
|
22037
|
+
break;
|
|
22038
|
+
case OpKind.ConditionalBranchCreate:
|
|
22039
|
+
if (!(unit instanceof ViewCompilationUnit)) {
|
|
22040
|
+
throw new Error(`AssertionError: must be compiling a component`);
|
|
22041
|
+
}
|
|
22042
|
+
if (Array.isArray(op.localRefs)) {
|
|
22043
|
+
throw new Error(`AssertionError: local refs array should have been extracted into a constant`);
|
|
22044
|
+
}
|
|
22045
|
+
const conditionalBranchCreateChildView = unit.job.views.get(op.xref);
|
|
22046
|
+
OpList.replace(op, conditionalBranchCreate(op.handle.slot, variable(conditionalBranchCreateChildView.fnName), conditionalBranchCreateChildView.decls, conditionalBranchCreateChildView.vars, op.tag, op.attributes, op.localRefs, op.startSourceSpan));
|
|
22047
|
+
break;
|
|
22048
|
+
case OpKind.RepeaterCreate:
|
|
22049
|
+
if (op.handle.slot === null) {
|
|
21470
22050
|
throw new Error("No slot was assigned for repeater instruction");
|
|
21471
22051
|
}
|
|
21472
22052
|
if (!(unit instanceof ViewCompilationUnit)) {
|
|
@@ -21523,38 +22103,22 @@ function reifyUpdateOperations(_unit, ops) {
|
|
|
21523
22103
|
OpList.replace(op, advance(op.delta, op.sourceSpan));
|
|
21524
22104
|
break;
|
|
21525
22105
|
case OpKind.Property:
|
|
21526
|
-
|
|
21527
|
-
OpList.replace(op, propertyInterpolate(op.name, op.expression.strings, op.expression.expressions, op.sanitizer, op.sourceSpan));
|
|
21528
|
-
} else {
|
|
21529
|
-
OpList.replace(op, property(op.name, op.expression, op.sanitizer, op.sourceSpan));
|
|
21530
|
-
}
|
|
22106
|
+
OpList.replace(op, property(op.name, op.expression, op.sanitizer, op.sourceSpan));
|
|
21531
22107
|
break;
|
|
21532
22108
|
case OpKind.TwoWayProperty:
|
|
21533
22109
|
OpList.replace(op, twoWayProperty(op.name, op.expression, op.sanitizer, op.sourceSpan));
|
|
21534
22110
|
break;
|
|
21535
22111
|
case OpKind.StyleProp:
|
|
21536
|
-
|
|
21537
|
-
OpList.replace(op, stylePropInterpolate(op.name, op.expression.strings, op.expression.expressions, op.unit, op.sourceSpan));
|
|
21538
|
-
} else {
|
|
21539
|
-
OpList.replace(op, styleProp(op.name, op.expression, op.unit, op.sourceSpan));
|
|
21540
|
-
}
|
|
22112
|
+
OpList.replace(op, styleProp(op.name, op.expression, op.unit, op.sourceSpan));
|
|
21541
22113
|
break;
|
|
21542
22114
|
case OpKind.ClassProp:
|
|
21543
22115
|
OpList.replace(op, classProp(op.name, op.expression, op.sourceSpan));
|
|
21544
22116
|
break;
|
|
21545
22117
|
case OpKind.StyleMap:
|
|
21546
|
-
|
|
21547
|
-
OpList.replace(op, styleMapInterpolate(op.expression.strings, op.expression.expressions, op.sourceSpan));
|
|
21548
|
-
} else {
|
|
21549
|
-
OpList.replace(op, styleMap(op.expression, op.sourceSpan));
|
|
21550
|
-
}
|
|
22118
|
+
OpList.replace(op, styleMap(op.expression, op.sourceSpan));
|
|
21551
22119
|
break;
|
|
21552
22120
|
case OpKind.ClassMap:
|
|
21553
|
-
|
|
21554
|
-
OpList.replace(op, classMapInterpolate(op.expression.strings, op.expression.expressions, op.sourceSpan));
|
|
21555
|
-
} else {
|
|
21556
|
-
OpList.replace(op, classMap(op.expression, op.sourceSpan));
|
|
21557
|
-
}
|
|
22121
|
+
OpList.replace(op, classMap(op.expression, op.sourceSpan));
|
|
21558
22122
|
break;
|
|
21559
22123
|
case OpKind.I18nExpression:
|
|
21560
22124
|
OpList.replace(op, i18nExp(op.expression, op.sourceSpan));
|
|
@@ -21566,20 +22130,16 @@ function reifyUpdateOperations(_unit, ops) {
|
|
|
21566
22130
|
OpList.replace(op, textInterpolate(op.interpolation.strings, op.interpolation.expressions, op.sourceSpan));
|
|
21567
22131
|
break;
|
|
21568
22132
|
case OpKind.Attribute:
|
|
21569
|
-
|
|
21570
|
-
OpList.replace(op, attributeInterpolate(op.name, op.expression.strings, op.expression.expressions, op.sanitizer, op.sourceSpan));
|
|
21571
|
-
} else {
|
|
21572
|
-
OpList.replace(op, attribute(op.name, op.expression, op.sanitizer, op.namespace));
|
|
21573
|
-
}
|
|
22133
|
+
OpList.replace(op, attribute(op.name, op.expression, op.sanitizer, op.namespace, op.sourceSpan));
|
|
21574
22134
|
break;
|
|
21575
|
-
case OpKind.
|
|
22135
|
+
case OpKind.DomProperty:
|
|
21576
22136
|
if (op.expression instanceof Interpolation2) {
|
|
21577
22137
|
throw new Error("not yet handled");
|
|
21578
22138
|
} else {
|
|
21579
22139
|
if (op.isAnimationTrigger) {
|
|
21580
22140
|
OpList.replace(op, syntheticHostProperty(op.name, op.expression, op.sourceSpan));
|
|
21581
22141
|
} else {
|
|
21582
|
-
OpList.replace(op,
|
|
22142
|
+
OpList.replace(op, domProperty(op.name, op.expression, op.sanitizer, op.sourceSpan));
|
|
21583
22143
|
}
|
|
21584
22144
|
}
|
|
21585
22145
|
break;
|
|
@@ -21746,6 +22306,22 @@ function removeI18nContexts(job) {
|
|
|
21746
22306
|
}
|
|
21747
22307
|
}
|
|
21748
22308
|
__name(removeI18nContexts, "removeI18nContexts");
|
|
22309
|
+
function removeIllegalLetReferences(job) {
|
|
22310
|
+
for (const unit of job.units) {
|
|
22311
|
+
for (const op of unit.update) {
|
|
22312
|
+
if (op.kind !== OpKind.Variable || op.variable.kind !== SemanticVariableKind.Identifier || !(op.initializer instanceof StoreLetExpr)) {
|
|
22313
|
+
continue;
|
|
22314
|
+
}
|
|
22315
|
+
const name = op.variable.identifier;
|
|
22316
|
+
let current = op;
|
|
22317
|
+
while (current && current.kind !== OpKind.ListEnd) {
|
|
22318
|
+
transformExpressionsInOp(current, (expr) => expr instanceof LexicalReadExpr && expr.name === name ? literal(void 0) : expr, VisitorContextFlag.None);
|
|
22319
|
+
current = current.prev;
|
|
22320
|
+
}
|
|
22321
|
+
}
|
|
22322
|
+
}
|
|
22323
|
+
}
|
|
22324
|
+
__name(removeIllegalLetReferences, "removeIllegalLetReferences");
|
|
21749
22325
|
function removeUnusedI18nAttributesOps(job) {
|
|
21750
22326
|
for (const unit of job.units) {
|
|
21751
22327
|
const ownersWithI18nExpressions = /* @__PURE__ */ new Set();
|
|
@@ -21814,6 +22390,30 @@ function processLexicalScope$1(view, ops) {
|
|
|
21814
22390
|
}
|
|
21815
22391
|
}
|
|
21816
22392
|
__name(processLexicalScope$1, "processLexicalScope$1");
|
|
22393
|
+
function resolveDeferDepsFns(job) {
|
|
22394
|
+
for (const unit of job.units) {
|
|
22395
|
+
for (const op of unit.create) {
|
|
22396
|
+
if (op.kind === OpKind.Defer) {
|
|
22397
|
+
if (op.resolverFn !== null) {
|
|
22398
|
+
continue;
|
|
22399
|
+
}
|
|
22400
|
+
if (op.ownResolverFn !== null) {
|
|
22401
|
+
if (op.handle.slot === null) {
|
|
22402
|
+
throw new Error("AssertionError: slot must be assigned before extracting defer deps functions");
|
|
22403
|
+
}
|
|
22404
|
+
const fullPathName = unit.fnName?.replace("_Template", "");
|
|
22405
|
+
op.resolverFn = job.pool.getSharedFunctionReference(
|
|
22406
|
+
op.ownResolverFn,
|
|
22407
|
+
`${fullPathName}_Defer_${op.handle.slot}_DepsFn`,
|
|
22408
|
+
/* Don't use unique names for TDB compatibility */
|
|
22409
|
+
false
|
|
22410
|
+
);
|
|
22411
|
+
}
|
|
22412
|
+
}
|
|
22413
|
+
}
|
|
22414
|
+
}
|
|
22415
|
+
}
|
|
22416
|
+
__name(resolveDeferDepsFns, "resolveDeferDepsFns");
|
|
21817
22417
|
function resolveDollarEvent(job) {
|
|
21818
22418
|
for (const unit of job.units) {
|
|
21819
22419
|
transformDollarEvent(unit.create);
|
|
@@ -21901,6 +22501,8 @@ function resolvePlaceholdersForView(job, unit, i18nContexts, elements, pendingSt
|
|
|
21901
22501
|
pendingStructuralDirective = void 0;
|
|
21902
22502
|
}
|
|
21903
22503
|
break;
|
|
22504
|
+
case OpKind.ConditionalCreate:
|
|
22505
|
+
case OpKind.ConditionalBranchCreate:
|
|
21904
22506
|
case OpKind.Template:
|
|
21905
22507
|
const view = job.views.get(op.xref);
|
|
21906
22508
|
if (op.i18nPlaceholder === void 0) {
|
|
@@ -22182,7 +22784,7 @@ function resolveSanitizers(job) {
|
|
|
22182
22784
|
switch (op.kind) {
|
|
22183
22785
|
case OpKind.Property:
|
|
22184
22786
|
case OpKind.Attribute:
|
|
22185
|
-
case OpKind.
|
|
22787
|
+
case OpKind.DomProperty:
|
|
22186
22788
|
let sanitizerFn = null;
|
|
22187
22789
|
if (Array.isArray(op.securityContext) && op.securityContext.length === 2 && op.securityContext.indexOf(SecurityContext.URL) > -1 && op.securityContext.indexOf(SecurityContext.RESOURCE_URL) > -1) {
|
|
22188
22790
|
sanitizerFn = Identifiers.sanitizeUrlOrResourceUrl;
|
|
@@ -22192,7 +22794,7 @@ function resolveSanitizers(job) {
|
|
|
22192
22794
|
op.sanitizer = sanitizerFn !== null ? importExpr(sanitizerFn) : null;
|
|
22193
22795
|
if (op.sanitizer === null) {
|
|
22194
22796
|
let isIframe = false;
|
|
22195
|
-
if (job.kind === CompilationJobKind.Host || op.kind === OpKind.
|
|
22797
|
+
if (job.kind === CompilationJobKind.Host || op.kind === OpKind.DomProperty) {
|
|
22196
22798
|
isIframe = true;
|
|
22197
22799
|
} else {
|
|
22198
22800
|
const ownerOp = elements.get(op.target);
|
|
@@ -22225,28 +22827,6 @@ function getOnlySecurityContext(securityContext) {
|
|
|
22225
22827
|
return securityContext;
|
|
22226
22828
|
}
|
|
22227
22829
|
__name(getOnlySecurityContext, "getOnlySecurityContext");
|
|
22228
|
-
function transformTwoWayBindingSet(job) {
|
|
22229
|
-
for (const unit of job.units) {
|
|
22230
|
-
for (const op of unit.create) {
|
|
22231
|
-
if (op.kind === OpKind.TwoWayListener) {
|
|
22232
|
-
transformExpressionsInOp(op, (expr) => {
|
|
22233
|
-
if (!(expr instanceof TwoWayBindingSetExpr)) {
|
|
22234
|
-
return expr;
|
|
22235
|
-
}
|
|
22236
|
-
const { target, value } = expr;
|
|
22237
|
-
if (target instanceof ReadPropExpr || target instanceof ReadKeyExpr) {
|
|
22238
|
-
return twoWayBindingSet(target, value).or(target.set(value));
|
|
22239
|
-
}
|
|
22240
|
-
if (target instanceof ReadVariableExpr) {
|
|
22241
|
-
return twoWayBindingSet(target, value);
|
|
22242
|
-
}
|
|
22243
|
-
throw new Error(`Unsupported expression in two-way action binding.`);
|
|
22244
|
-
}, VisitorContextFlag.InChildOperation);
|
|
22245
|
-
}
|
|
22246
|
-
}
|
|
22247
|
-
}
|
|
22248
|
-
}
|
|
22249
|
-
__name(transformTwoWayBindingSet, "transformTwoWayBindingSet");
|
|
22250
22830
|
function saveAndRestoreView(job) {
|
|
22251
22831
|
for (const unit of job.units) {
|
|
22252
22832
|
unit.create.prepend([
|
|
@@ -22308,7 +22888,7 @@ function allocateSlots(job) {
|
|
|
22308
22888
|
}
|
|
22309
22889
|
for (const unit of job.units) {
|
|
22310
22890
|
for (const op of unit.ops()) {
|
|
22311
|
-
if (op.kind === OpKind.Template || op.kind === OpKind.RepeaterCreate) {
|
|
22891
|
+
if (op.kind === OpKind.Template || op.kind === OpKind.ConditionalCreate || op.kind === OpKind.ConditionalBranchCreate || op.kind === OpKind.RepeaterCreate) {
|
|
22312
22892
|
const childView = job.views.get(op.xref);
|
|
22313
22893
|
op.decls = childView.decls;
|
|
22314
22894
|
}
|
|
@@ -22316,6 +22896,96 @@ function allocateSlots(job) {
|
|
|
22316
22896
|
}
|
|
22317
22897
|
}
|
|
22318
22898
|
__name(allocateSlots, "allocateSlots");
|
|
22899
|
+
function optimizeStoreLet(job) {
|
|
22900
|
+
const letUsedExternally = /* @__PURE__ */ new Set();
|
|
22901
|
+
const declareLetOps = /* @__PURE__ */ new Map();
|
|
22902
|
+
for (const unit of job.units) {
|
|
22903
|
+
for (const op of unit.ops()) {
|
|
22904
|
+
if (op.kind === OpKind.DeclareLet) {
|
|
22905
|
+
declareLetOps.set(op.xref, op);
|
|
22906
|
+
}
|
|
22907
|
+
visitExpressionsInOp(op, (expr) => {
|
|
22908
|
+
if (expr instanceof ContextLetReferenceExpr) {
|
|
22909
|
+
letUsedExternally.add(expr.target);
|
|
22910
|
+
}
|
|
22911
|
+
});
|
|
22912
|
+
}
|
|
22913
|
+
}
|
|
22914
|
+
for (const unit of job.units) {
|
|
22915
|
+
for (const op of unit.update) {
|
|
22916
|
+
transformExpressionsInOp(op, (expr) => {
|
|
22917
|
+
if (expr instanceof StoreLetExpr && !letUsedExternally.has(expr.target)) {
|
|
22918
|
+
if (!hasPipe(expr)) {
|
|
22919
|
+
OpList.remove(declareLetOps.get(expr.target));
|
|
22920
|
+
}
|
|
22921
|
+
return expr.value;
|
|
22922
|
+
}
|
|
22923
|
+
return expr;
|
|
22924
|
+
}, VisitorContextFlag.None);
|
|
22925
|
+
}
|
|
22926
|
+
}
|
|
22927
|
+
}
|
|
22928
|
+
__name(optimizeStoreLet, "optimizeStoreLet");
|
|
22929
|
+
function hasPipe(root) {
|
|
22930
|
+
let result = false;
|
|
22931
|
+
transformExpressionsInExpression(root, (expr) => {
|
|
22932
|
+
if (expr instanceof PipeBindingExpr || expr instanceof PipeBindingVariadicExpr) {
|
|
22933
|
+
result = true;
|
|
22934
|
+
}
|
|
22935
|
+
return expr;
|
|
22936
|
+
}, VisitorContextFlag.None);
|
|
22937
|
+
return result;
|
|
22938
|
+
}
|
|
22939
|
+
__name(hasPipe, "hasPipe");
|
|
22940
|
+
function stripNonrequiredParentheses(job) {
|
|
22941
|
+
const requiredParens = /* @__PURE__ */ new Set();
|
|
22942
|
+
for (const unit of job.units) {
|
|
22943
|
+
for (const op of unit.ops()) {
|
|
22944
|
+
visitExpressionsInOp(op, (expr) => {
|
|
22945
|
+
if (expr instanceof BinaryOperatorExpr) {
|
|
22946
|
+
switch (expr.operator) {
|
|
22947
|
+
case BinaryOperator.Exponentiation:
|
|
22948
|
+
checkExponentiationParens(expr, requiredParens);
|
|
22949
|
+
break;
|
|
22950
|
+
case BinaryOperator.NullishCoalesce:
|
|
22951
|
+
checkNullishCoalescingParens(expr, requiredParens);
|
|
22952
|
+
break;
|
|
22953
|
+
}
|
|
22954
|
+
}
|
|
22955
|
+
});
|
|
22956
|
+
}
|
|
22957
|
+
}
|
|
22958
|
+
for (const unit of job.units) {
|
|
22959
|
+
for (const op of unit.ops()) {
|
|
22960
|
+
transformExpressionsInOp(op, (expr) => {
|
|
22961
|
+
if (expr instanceof ParenthesizedExpr) {
|
|
22962
|
+
return requiredParens.has(expr) ? expr : expr.expr;
|
|
22963
|
+
}
|
|
22964
|
+
return expr;
|
|
22965
|
+
}, VisitorContextFlag.None);
|
|
22966
|
+
}
|
|
22967
|
+
}
|
|
22968
|
+
}
|
|
22969
|
+
__name(stripNonrequiredParentheses, "stripNonrequiredParentheses");
|
|
22970
|
+
function checkExponentiationParens(expr, requiredParens) {
|
|
22971
|
+
if (expr.lhs instanceof ParenthesizedExpr && expr.lhs.expr instanceof UnaryOperatorExpr) {
|
|
22972
|
+
requiredParens.add(expr.lhs);
|
|
22973
|
+
}
|
|
22974
|
+
}
|
|
22975
|
+
__name(checkExponentiationParens, "checkExponentiationParens");
|
|
22976
|
+
function checkNullishCoalescingParens(expr, requiredParens) {
|
|
22977
|
+
if (expr.lhs instanceof ParenthesizedExpr && (isLogicalAndOr(expr.lhs.expr) || expr.lhs.expr instanceof ConditionalExpr)) {
|
|
22978
|
+
requiredParens.add(expr.lhs);
|
|
22979
|
+
}
|
|
22980
|
+
if (expr.rhs instanceof ParenthesizedExpr && (isLogicalAndOr(expr.rhs.expr) || expr.rhs.expr instanceof ConditionalExpr)) {
|
|
22981
|
+
requiredParens.add(expr.rhs);
|
|
22982
|
+
}
|
|
22983
|
+
}
|
|
22984
|
+
__name(checkNullishCoalescingParens, "checkNullishCoalescingParens");
|
|
22985
|
+
function isLogicalAndOr(expr) {
|
|
22986
|
+
return expr instanceof BinaryOperatorExpr && (expr.operator === BinaryOperator.And || expr.operator === BinaryOperator.Or);
|
|
22987
|
+
}
|
|
22988
|
+
__name(isLogicalAndOr, "isLogicalAndOr");
|
|
22319
22989
|
function specializeStyleBindings(job) {
|
|
22320
22990
|
for (const unit of job.units) {
|
|
22321
22991
|
for (const op of unit.update) {
|
|
@@ -22481,6 +23151,28 @@ function generateTrackVariables(job) {
|
|
|
22481
23151
|
}
|
|
22482
23152
|
}
|
|
22483
23153
|
__name(generateTrackVariables, "generateTrackVariables");
|
|
23154
|
+
function transformTwoWayBindingSet(job) {
|
|
23155
|
+
for (const unit of job.units) {
|
|
23156
|
+
for (const op of unit.create) {
|
|
23157
|
+
if (op.kind === OpKind.TwoWayListener) {
|
|
23158
|
+
transformExpressionsInOp(op, (expr) => {
|
|
23159
|
+
if (!(expr instanceof TwoWayBindingSetExpr)) {
|
|
23160
|
+
return expr;
|
|
23161
|
+
}
|
|
23162
|
+
const { target, value } = expr;
|
|
23163
|
+
if (target instanceof ReadPropExpr || target instanceof ReadKeyExpr) {
|
|
23164
|
+
return twoWayBindingSet(target, value).or(target.set(value));
|
|
23165
|
+
}
|
|
23166
|
+
if (target instanceof ReadVariableExpr) {
|
|
23167
|
+
return twoWayBindingSet(target, value);
|
|
23168
|
+
}
|
|
23169
|
+
throw new Error(`Unsupported expression in two-way action binding.`);
|
|
23170
|
+
}, VisitorContextFlag.InChildOperation);
|
|
23171
|
+
}
|
|
23172
|
+
}
|
|
23173
|
+
}
|
|
23174
|
+
}
|
|
23175
|
+
__name(transformTwoWayBindingSet, "transformTwoWayBindingSet");
|
|
22484
23176
|
function countVariables(job) {
|
|
22485
23177
|
for (const unit of job.units) {
|
|
22486
23178
|
let varCount = 0;
|
|
@@ -22525,7 +23217,7 @@ function countVariables(job) {
|
|
|
22525
23217
|
if (job instanceof ComponentCompilationJob) {
|
|
22526
23218
|
for (const unit of job.units) {
|
|
22527
23219
|
for (const op of unit.create) {
|
|
22528
|
-
if (op.kind !== OpKind.Template && op.kind !== OpKind.RepeaterCreate) {
|
|
23220
|
+
if (op.kind !== OpKind.Template && op.kind !== OpKind.RepeaterCreate && op.kind !== OpKind.ConditionalCreate && op.kind !== OpKind.ConditionalBranchCreate) {
|
|
22529
23221
|
continue;
|
|
22530
23222
|
}
|
|
22531
23223
|
const childView = job.views.get(op.xref);
|
|
@@ -22538,14 +23230,19 @@ __name(countVariables, "countVariables");
|
|
|
22538
23230
|
function varsUsedByOp(op) {
|
|
22539
23231
|
let slots;
|
|
22540
23232
|
switch (op.kind) {
|
|
22541
|
-
case OpKind.Property:
|
|
22542
|
-
case OpKind.HostProperty:
|
|
22543
23233
|
case OpKind.Attribute:
|
|
22544
23234
|
slots = 1;
|
|
22545
23235
|
if (op.expression instanceof Interpolation2 && !isSingletonInterpolation(op.expression)) {
|
|
22546
23236
|
slots += op.expression.expressions.length;
|
|
22547
23237
|
}
|
|
22548
23238
|
return slots;
|
|
23239
|
+
case OpKind.Property:
|
|
23240
|
+
case OpKind.DomProperty:
|
|
23241
|
+
slots = 1;
|
|
23242
|
+
if (op.expression instanceof Interpolation2) {
|
|
23243
|
+
slots += op.expression.expressions.length;
|
|
23244
|
+
}
|
|
23245
|
+
return slots;
|
|
22549
23246
|
case OpKind.TwoWayProperty:
|
|
22550
23247
|
return 1;
|
|
22551
23248
|
case OpKind.StyleProp:
|
|
@@ -22889,80 +23586,6 @@ function wrapI18nIcus(job) {
|
|
|
22889
23586
|
}
|
|
22890
23587
|
}
|
|
22891
23588
|
__name(wrapI18nIcus, "wrapI18nIcus");
|
|
22892
|
-
function optimizeStoreLet(job) {
|
|
22893
|
-
const letUsedExternally = /* @__PURE__ */ new Set();
|
|
22894
|
-
for (const unit of job.units) {
|
|
22895
|
-
for (const op of unit.ops()) {
|
|
22896
|
-
visitExpressionsInOp(op, (expr) => {
|
|
22897
|
-
if (expr instanceof ContextLetReferenceExpr) {
|
|
22898
|
-
letUsedExternally.add(expr.target);
|
|
22899
|
-
}
|
|
22900
|
-
});
|
|
22901
|
-
}
|
|
22902
|
-
}
|
|
22903
|
-
for (const unit of job.units) {
|
|
22904
|
-
for (const op of unit.update) {
|
|
22905
|
-
transformExpressionsInOp(op, (expression) => expression instanceof StoreLetExpr && !letUsedExternally.has(expression.target) ? expression.value : expression, VisitorContextFlag.None);
|
|
22906
|
-
}
|
|
22907
|
-
}
|
|
22908
|
-
}
|
|
22909
|
-
__name(optimizeStoreLet, "optimizeStoreLet");
|
|
22910
|
-
function removeIllegalLetReferences(job) {
|
|
22911
|
-
for (const unit of job.units) {
|
|
22912
|
-
for (const op of unit.update) {
|
|
22913
|
-
if (op.kind !== OpKind.Variable || op.variable.kind !== SemanticVariableKind.Identifier || !(op.initializer instanceof StoreLetExpr)) {
|
|
22914
|
-
continue;
|
|
22915
|
-
}
|
|
22916
|
-
const name = op.variable.identifier;
|
|
22917
|
-
let current = op;
|
|
22918
|
-
while (current && current.kind !== OpKind.ListEnd) {
|
|
22919
|
-
transformExpressionsInOp(current, (expr) => expr instanceof LexicalReadExpr && expr.name === name ? literal(void 0) : expr, VisitorContextFlag.None);
|
|
22920
|
-
current = current.prev;
|
|
22921
|
-
}
|
|
22922
|
-
}
|
|
22923
|
-
}
|
|
22924
|
-
}
|
|
22925
|
-
__name(removeIllegalLetReferences, "removeIllegalLetReferences");
|
|
22926
|
-
function generateLocalLetReferences(job) {
|
|
22927
|
-
for (const unit of job.units) {
|
|
22928
|
-
for (const op of unit.update) {
|
|
22929
|
-
if (op.kind !== OpKind.StoreLet) {
|
|
22930
|
-
continue;
|
|
22931
|
-
}
|
|
22932
|
-
const variable2 = {
|
|
22933
|
-
kind: SemanticVariableKind.Identifier,
|
|
22934
|
-
name: null,
|
|
22935
|
-
identifier: op.declaredName,
|
|
22936
|
-
local: true
|
|
22937
|
-
};
|
|
22938
|
-
OpList.replace(op, createVariableOp(job.allocateXrefId(), variable2, new StoreLetExpr(op.target, op.value, op.sourceSpan), VariableFlags.None));
|
|
22939
|
-
}
|
|
22940
|
-
}
|
|
22941
|
-
}
|
|
22942
|
-
__name(generateLocalLetReferences, "generateLocalLetReferences");
|
|
22943
|
-
function attachSourceLocations(job) {
|
|
22944
|
-
if (!job.enableDebugLocations || job.relativeTemplatePath === null) {
|
|
22945
|
-
return;
|
|
22946
|
-
}
|
|
22947
|
-
for (const unit of job.units) {
|
|
22948
|
-
const locations = [];
|
|
22949
|
-
for (const op of unit.create) {
|
|
22950
|
-
if (op.kind === OpKind.ElementStart || op.kind === OpKind.Element) {
|
|
22951
|
-
const start = op.startSourceSpan.start;
|
|
22952
|
-
locations.push({
|
|
22953
|
-
targetSlot: op.handle,
|
|
22954
|
-
offset: start.offset,
|
|
22955
|
-
line: start.line,
|
|
22956
|
-
column: start.col
|
|
22957
|
-
});
|
|
22958
|
-
}
|
|
22959
|
-
}
|
|
22960
|
-
if (locations.length > 0) {
|
|
22961
|
-
unit.create.push(createSourceLocationOp(job.relativeTemplatePath, locations));
|
|
22962
|
-
}
|
|
22963
|
-
}
|
|
22964
|
-
}
|
|
22965
|
-
__name(attachSourceLocations, "attachSourceLocations");
|
|
22966
23589
|
var phases = [
|
|
22967
23590
|
{ kind: CompilationJobKind.Tmpl, fn: removeContentSelectors },
|
|
22968
23591
|
{ kind: CompilationJobKind.Host, fn: parseHostStyleProperties },
|
|
@@ -22981,11 +23604,6 @@ var phases = [
|
|
|
22981
23604
|
{ kind: CompilationJobKind.Tmpl, fn: generateConditionalExpressions },
|
|
22982
23605
|
{ kind: CompilationJobKind.Tmpl, fn: createPipes },
|
|
22983
23606
|
{ kind: CompilationJobKind.Tmpl, fn: configureDeferInstructions },
|
|
22984
|
-
{ kind: CompilationJobKind.Tmpl, fn: convertI18nText },
|
|
22985
|
-
{ kind: CompilationJobKind.Tmpl, fn: convertI18nBindings },
|
|
22986
|
-
{ kind: CompilationJobKind.Tmpl, fn: removeUnusedI18nAttributesOps },
|
|
22987
|
-
{ kind: CompilationJobKind.Tmpl, fn: assignI18nSlotDependencies },
|
|
22988
|
-
{ kind: CompilationJobKind.Tmpl, fn: applyI18nExpressions },
|
|
22989
23607
|
{ kind: CompilationJobKind.Tmpl, fn: createVariadicPipes },
|
|
22990
23608
|
{ kind: CompilationJobKind.Both, fn: generatePureLiteralStructures },
|
|
22991
23609
|
{ kind: CompilationJobKind.Tmpl, fn: generateProjectionDefs },
|
|
@@ -23003,14 +23621,19 @@ var phases = [
|
|
|
23003
23621
|
{ kind: CompilationJobKind.Both, fn: resolveContexts },
|
|
23004
23622
|
{ kind: CompilationJobKind.Both, fn: resolveSanitizers },
|
|
23005
23623
|
{ kind: CompilationJobKind.Tmpl, fn: liftLocalRefs },
|
|
23006
|
-
{ kind: CompilationJobKind.Both, fn: generateNullishCoalesceExpressions },
|
|
23007
23624
|
{ kind: CompilationJobKind.Both, fn: expandSafeReads },
|
|
23625
|
+
{ kind: CompilationJobKind.Both, fn: stripNonrequiredParentheses },
|
|
23008
23626
|
{ kind: CompilationJobKind.Both, fn: generateTemporaryVariables },
|
|
23009
23627
|
{ kind: CompilationJobKind.Both, fn: optimizeVariables },
|
|
23010
23628
|
{ kind: CompilationJobKind.Both, fn: optimizeStoreLet },
|
|
23011
|
-
{ kind: CompilationJobKind.Tmpl, fn:
|
|
23012
|
-
{ kind: CompilationJobKind.Tmpl, fn:
|
|
23013
|
-
{ kind: CompilationJobKind.Tmpl, fn:
|
|
23629
|
+
{ kind: CompilationJobKind.Tmpl, fn: convertI18nText },
|
|
23630
|
+
{ kind: CompilationJobKind.Tmpl, fn: convertI18nBindings },
|
|
23631
|
+
{ kind: CompilationJobKind.Tmpl, fn: removeUnusedI18nAttributesOps },
|
|
23632
|
+
{ kind: CompilationJobKind.Tmpl, fn: assignI18nSlotDependencies },
|
|
23633
|
+
{ kind: CompilationJobKind.Tmpl, fn: applyI18nExpressions },
|
|
23634
|
+
{ kind: CompilationJobKind.Tmpl, fn: allocateSlots },
|
|
23635
|
+
{ kind: CompilationJobKind.Tmpl, fn: resolveI18nElementPlaceholders },
|
|
23636
|
+
{ kind: CompilationJobKind.Tmpl, fn: resolveI18nExpressionPlaceholders },
|
|
23014
23637
|
{ kind: CompilationJobKind.Tmpl, fn: extractI18nMessages },
|
|
23015
23638
|
{ kind: CompilationJobKind.Tmpl, fn: collectI18nConsts },
|
|
23016
23639
|
{ kind: CompilationJobKind.Tmpl, fn: collectConstExpressions },
|
|
@@ -23157,7 +23780,7 @@ function ingestHostBinding(input, bindingParser, constantPool) {
|
|
|
23157
23780
|
bindingKind = BindingKind.Animation;
|
|
23158
23781
|
}
|
|
23159
23782
|
const securityContexts = bindingParser.calcPossibleSecurityContexts(input.componentSelector, property2.name, bindingKind === BindingKind.Attribute).filter((context) => context !== SecurityContext.NONE);
|
|
23160
|
-
|
|
23783
|
+
ingestDomProperty(job, property2, bindingKind, securityContexts);
|
|
23161
23784
|
}
|
|
23162
23785
|
for (const [name, expr] of Object.entries(input.attributes) ?? []) {
|
|
23163
23786
|
const securityContexts = bindingParser.calcPossibleSecurityContexts(input.componentSelector, name, true).filter((context) => context !== SecurityContext.NONE);
|
|
@@ -23169,7 +23792,7 @@ function ingestHostBinding(input, bindingParser, constantPool) {
|
|
|
23169
23792
|
return job;
|
|
23170
23793
|
}
|
|
23171
23794
|
__name(ingestHostBinding, "ingestHostBinding");
|
|
23172
|
-
function
|
|
23795
|
+
function ingestDomProperty(job, property2, bindingKind, securityContexts) {
|
|
23173
23796
|
let expression;
|
|
23174
23797
|
const ast = property2.expression.ast;
|
|
23175
23798
|
if (ast instanceof Interpolation$1) {
|
|
@@ -23192,7 +23815,7 @@ function ingestHostProperty(job, property2, bindingKind, securityContexts) {
|
|
|
23192
23815
|
property2.sourceSpan
|
|
23193
23816
|
));
|
|
23194
23817
|
}
|
|
23195
|
-
__name(
|
|
23818
|
+
__name(ingestDomProperty, "ingestDomProperty");
|
|
23196
23819
|
function ingestHostAttribute(job, name, value, securityContexts) {
|
|
23197
23820
|
const attrBinding = createBindingOp(
|
|
23198
23821
|
job.root.xref,
|
|
@@ -23244,7 +23867,8 @@ function ingestNodes(unit, template2) {
|
|
|
23244
23867
|
ingestForBlock(unit, node);
|
|
23245
23868
|
} else if (node instanceof LetDeclaration$1) {
|
|
23246
23869
|
ingestLetDeclaration(unit, node);
|
|
23247
|
-
} else
|
|
23870
|
+
} else if (node instanceof Component$1) ;
|
|
23871
|
+
else {
|
|
23248
23872
|
throw new Error(`Unsupported template node: ${node.constructor.name}`);
|
|
23249
23873
|
}
|
|
23250
23874
|
}
|
|
@@ -23362,13 +23986,14 @@ function ingestIfBlock(unit, ifBlock) {
|
|
|
23362
23986
|
}
|
|
23363
23987
|
ifCaseI18nMeta = ifCase.i18n;
|
|
23364
23988
|
}
|
|
23365
|
-
const
|
|
23366
|
-
|
|
23989
|
+
const createOp = i === 0 ? createConditionalCreateOp : createConditionalBranchCreateOp;
|
|
23990
|
+
const conditionalCreateOp = createOp(cView.xref, TemplateKind.Block, tagName, "Conditional", Namespace.HTML, ifCaseI18nMeta, ifCase.startSourceSpan, ifCase.sourceSpan);
|
|
23991
|
+
unit.create.push(conditionalCreateOp);
|
|
23367
23992
|
if (firstXref === null) {
|
|
23368
23993
|
firstXref = cView.xref;
|
|
23369
23994
|
}
|
|
23370
23995
|
const caseExpr = ifCase.expression ? convertAst(ifCase.expression, unit.job, null) : null;
|
|
23371
|
-
const conditionalCaseExpr = new ConditionalCaseExpr(caseExpr,
|
|
23996
|
+
const conditionalCaseExpr = new ConditionalCaseExpr(caseExpr, conditionalCreateOp.xref, conditionalCreateOp.handle, ifCase.expressionAlias);
|
|
23372
23997
|
conditions.push(conditionalCaseExpr);
|
|
23373
23998
|
ingestNodes(cView, ifCase.children);
|
|
23374
23999
|
}
|
|
@@ -23381,7 +24006,8 @@ function ingestSwitchBlock(unit, switchBlock) {
|
|
|
23381
24006
|
}
|
|
23382
24007
|
let firstXref = null;
|
|
23383
24008
|
let conditions = [];
|
|
23384
|
-
for (
|
|
24009
|
+
for (let i = 0; i < switchBlock.cases.length; i++) {
|
|
24010
|
+
const switchCase = switchBlock.cases[i];
|
|
23385
24011
|
const cView = unit.job.allocateView(unit.xref);
|
|
23386
24012
|
const tagName = ingestControlFlowInsertionPoint(unit, cView.xref, switchCase);
|
|
23387
24013
|
let switchCaseI18nMeta = void 0;
|
|
@@ -23391,13 +24017,14 @@ function ingestSwitchBlock(unit, switchBlock) {
|
|
|
23391
24017
|
}
|
|
23392
24018
|
switchCaseI18nMeta = switchCase.i18n;
|
|
23393
24019
|
}
|
|
23394
|
-
const
|
|
23395
|
-
|
|
24020
|
+
const createOp = i === 0 ? createConditionalCreateOp : createConditionalBranchCreateOp;
|
|
24021
|
+
const conditionalCreateOp = createOp(cView.xref, TemplateKind.Block, tagName, "Case", Namespace.HTML, switchCaseI18nMeta, switchCase.startSourceSpan, switchCase.sourceSpan);
|
|
24022
|
+
unit.create.push(conditionalCreateOp);
|
|
23396
24023
|
if (firstXref === null) {
|
|
23397
24024
|
firstXref = cView.xref;
|
|
23398
24025
|
}
|
|
23399
24026
|
const caseExpr = switchCase.expression ? convertAst(switchCase.expression, unit.job, switchBlock.startSourceSpan) : null;
|
|
23400
|
-
const conditionalCaseExpr = new ConditionalCaseExpr(caseExpr,
|
|
24027
|
+
const conditionalCaseExpr = new ConditionalCaseExpr(caseExpr, conditionalCreateOp.xref, conditionalCreateOp.handle);
|
|
23401
24028
|
conditions.push(conditionalCaseExpr);
|
|
23402
24029
|
ingestNodes(cView, switchCase.children);
|
|
23403
24030
|
}
|
|
@@ -23703,15 +24330,25 @@ function convertAst(ast, job, baseSourceSpan) {
|
|
|
23703
24330
|
return not(convertAst(ast.expression, job, baseSourceSpan), convertSourceSpan(ast.span, baseSourceSpan));
|
|
23704
24331
|
} else if (ast instanceof TypeofExpression) {
|
|
23705
24332
|
return typeofExpr(convertAst(ast.expression, job, baseSourceSpan));
|
|
24333
|
+
} else if (ast instanceof VoidExpression) {
|
|
24334
|
+
return new VoidExpr(convertAst(ast.expression, job, baseSourceSpan), void 0, convertSourceSpan(ast.span, baseSourceSpan));
|
|
23706
24335
|
} else if (ast instanceof TemplateLiteral) {
|
|
23707
|
-
return
|
|
23708
|
-
|
|
23709
|
-
|
|
24336
|
+
return convertTemplateLiteral(ast, job, baseSourceSpan);
|
|
24337
|
+
} else if (ast instanceof TaggedTemplateLiteral) {
|
|
24338
|
+
return new TaggedTemplateLiteralExpr(convertAst(ast.tag, job, baseSourceSpan), convertTemplateLiteral(ast.template, job, baseSourceSpan), void 0, convertSourceSpan(ast.span, baseSourceSpan));
|
|
24339
|
+
} else if (ast instanceof ParenthesizedExpression) {
|
|
24340
|
+
return new ParenthesizedExpr(convertAst(ast.expression, job, baseSourceSpan), void 0, convertSourceSpan(ast.span, baseSourceSpan));
|
|
23710
24341
|
} else {
|
|
23711
24342
|
throw new Error(`Unhandled expression type "${ast.constructor.name}" in file "${baseSourceSpan?.start.file.url}"`);
|
|
23712
24343
|
}
|
|
23713
24344
|
}
|
|
23714
24345
|
__name(convertAst, "convertAst");
|
|
24346
|
+
function convertTemplateLiteral(ast, job, baseSourceSpan) {
|
|
24347
|
+
return new TemplateLiteralExpr(ast.elements.map((el) => {
|
|
24348
|
+
return new TemplateLiteralElementExpr(el.text, convertSourceSpan(el.span, baseSourceSpan));
|
|
24349
|
+
}), ast.expressions.map((expr) => convertAst(expr, job, baseSourceSpan)), convertSourceSpan(ast.span, baseSourceSpan));
|
|
24350
|
+
}
|
|
24351
|
+
__name(convertTemplateLiteral, "convertTemplateLiteral");
|
|
23715
24352
|
function convertAstWithInterpolation(job, value, i18nMeta, sourceSpan) {
|
|
23716
24353
|
let expression;
|
|
23717
24354
|
if (value instanceof Interpolation$1) {
|
|
@@ -23940,16 +24577,12 @@ function ingestControlFlowInsertionPoint(unit, xref, node) {
|
|
|
23940
24577
|
}
|
|
23941
24578
|
__name(ingestControlFlowInsertionPoint, "ingestControlFlowInsertionPoint");
|
|
23942
24579
|
var ENABLE_TEMPLATE_SOURCE_LOCATIONS = false;
|
|
23943
|
-
function setEnableTemplateSourceLocations(value) {
|
|
23944
|
-
ENABLE_TEMPLATE_SOURCE_LOCATIONS = value;
|
|
23945
|
-
}
|
|
23946
|
-
__name(setEnableTemplateSourceLocations, "setEnableTemplateSourceLocations");
|
|
23947
24580
|
function getTemplateSourceLocationsEnabled() {
|
|
23948
24581
|
return ENABLE_TEMPLATE_SOURCE_LOCATIONS;
|
|
23949
24582
|
}
|
|
23950
24583
|
__name(getTemplateSourceLocationsEnabled, "getTemplateSourceLocationsEnabled");
|
|
23951
24584
|
function renderFlagCheckIfStmt(flags, statements) {
|
|
23952
|
-
return ifStmt(variable(RENDER_FLAGS).bitwiseAnd(literal(flags), null
|
|
24585
|
+
return ifStmt(variable(RENDER_FLAGS).bitwiseAnd(literal(flags), null), statements);
|
|
23953
24586
|
}
|
|
23954
24587
|
__name(renderFlagCheckIfStmt, "renderFlagCheckIfStmt");
|
|
23955
24588
|
function toQueryFlags(query) {
|
|
@@ -24387,10 +25020,16 @@ var BindingParser = class {
|
|
|
24387
25020
|
const prop = this._schemaRegistry.getMappedPropName(propName);
|
|
24388
25021
|
return calcPossibleSecurityContexts(this._schemaRegistry, selector, prop, isAttribute);
|
|
24389
25022
|
}
|
|
25023
|
+
parseEventListenerName(rawName) {
|
|
25024
|
+
const [target, eventName] = splitAtColon(rawName, [null, rawName]);
|
|
25025
|
+
return { eventName, target };
|
|
25026
|
+
}
|
|
25027
|
+
parseAnimationEventName(rawName) {
|
|
25028
|
+
const matches = splitAtPeriod(rawName, [rawName, null]);
|
|
25029
|
+
return { eventName: matches[0], phase: matches[1] === null ? null : matches[1].toLowerCase() };
|
|
25030
|
+
}
|
|
24390
25031
|
_parseAnimationEvent(name, expression, sourceSpan, handlerSpan, targetEvents, keySpan) {
|
|
24391
|
-
const
|
|
24392
|
-
const eventName = matches[0];
|
|
24393
|
-
const phase = matches[1].toLowerCase();
|
|
25032
|
+
const { eventName, phase } = this.parseAnimationEventName(name);
|
|
24394
25033
|
const ast = this._parseAction(expression, handlerSpan);
|
|
24395
25034
|
targetEvents.push(new ParsedEvent(eventName, phase, ParsedEventType.Animation, ast, sourceSpan, handlerSpan, keySpan));
|
|
24396
25035
|
if (eventName.length === 0) {
|
|
@@ -24405,7 +25044,7 @@ var BindingParser = class {
|
|
|
24405
25044
|
}
|
|
24406
25045
|
}
|
|
24407
25046
|
_parseRegularEvent(name, expression, isAssignmentEvent, sourceSpan, handlerSpan, targetMatchableAttrs, targetEvents, keySpan) {
|
|
24408
|
-
const
|
|
25047
|
+
const { eventName, target } = this.parseEventListenerName(name);
|
|
24409
25048
|
const prevErrorCount = this.errors.length;
|
|
24410
25049
|
const ast = this._parseAction(expression, handlerSpan);
|
|
24411
25050
|
const isValid = this.errors.length === prevErrorCount;
|
|
@@ -24477,13 +25116,19 @@ function isAnimationLabel(name) {
|
|
|
24477
25116
|
}
|
|
24478
25117
|
__name(isAnimationLabel, "isAnimationLabel");
|
|
24479
25118
|
function calcPossibleSecurityContexts(registry, selector, propName, isAttribute) {
|
|
24480
|
-
|
|
24481
|
-
|
|
24482
|
-
|
|
24483
|
-
|
|
24484
|
-
|
|
24485
|
-
ctxs
|
|
24486
|
-
|
|
25119
|
+
let ctxs;
|
|
25120
|
+
const nameToContext = /* @__PURE__ */ __name((elName) => registry.securityContext(elName, propName, isAttribute), "nameToContext");
|
|
25121
|
+
if (selector === null) {
|
|
25122
|
+
ctxs = registry.allKnownElementNames().map(nameToContext);
|
|
25123
|
+
} else {
|
|
25124
|
+
ctxs = [];
|
|
25125
|
+
CssSelector.parse(selector).forEach((selector2) => {
|
|
25126
|
+
const elementNames = selector2.element ? [selector2.element] : registry.allKnownElementNames();
|
|
25127
|
+
const notElementNames = new Set(selector2.notSelectors.filter((selector3) => selector3.isElementSelector()).map((selector3) => selector3.element));
|
|
25128
|
+
const possibleElementNames = elementNames.filter((elName) => !notElementNames.has(elName));
|
|
25129
|
+
ctxs.push(...possibleElementNames.map(nameToContext));
|
|
25130
|
+
});
|
|
25131
|
+
}
|
|
24487
25132
|
return ctxs.length === 0 ? [SecurityContext.NONE] : Array.from(new Set(ctxs)).sort();
|
|
24488
25133
|
}
|
|
24489
25134
|
__name(calcPossibleSecurityContexts, "calcPossibleSecurityContexts");
|
|
@@ -25406,6 +26051,15 @@ var BINDING_DELIMS = {
|
|
|
25406
26051
|
EVENT: { start: "(", end: ")" }
|
|
25407
26052
|
};
|
|
25408
26053
|
var TEMPLATE_ATTR_PREFIX = "*";
|
|
26054
|
+
var UNSUPPORTED_SELECTORLESS_TAGS = /* @__PURE__ */ new Set([
|
|
26055
|
+
"link",
|
|
26056
|
+
"style",
|
|
26057
|
+
"script",
|
|
26058
|
+
"ng-template",
|
|
26059
|
+
"ng-container",
|
|
26060
|
+
"ng-content"
|
|
26061
|
+
]);
|
|
26062
|
+
var UNSUPPORTED_SELECTORLESS_DIRECTIVE_ATTRS = /* @__PURE__ */ new Set(["ngProjectAs", "ngNonBindable"]);
|
|
25409
26063
|
function htmlAstToRender3Ast(htmlNodes, bindingParser, options) {
|
|
25410
26064
|
const transformer = new HtmlAstToIvyAst(bindingParser, options);
|
|
25411
26065
|
const ivyNodes = visitAll(transformer, htmlNodes, htmlNodes);
|
|
@@ -25468,56 +26122,8 @@ var HtmlAstToIvyAst = class {
|
|
|
25468
26122
|
return null;
|
|
25469
26123
|
}
|
|
25470
26124
|
const isTemplateElement = isNgTemplate(element2.name);
|
|
25471
|
-
const parsedProperties =
|
|
25472
|
-
const
|
|
25473
|
-
const variables = [];
|
|
25474
|
-
const references = [];
|
|
25475
|
-
const attributes = [];
|
|
25476
|
-
const i18nAttrsMeta = {};
|
|
25477
|
-
const templateParsedProperties = [];
|
|
25478
|
-
const templateVariables = [];
|
|
25479
|
-
let elementHasInlineTemplate = false;
|
|
25480
|
-
for (const attribute2 of element2.attrs) {
|
|
25481
|
-
let hasBinding = false;
|
|
25482
|
-
const normalizedName = normalizeAttributeName(attribute2.name);
|
|
25483
|
-
let isTemplateBinding = false;
|
|
25484
|
-
if (attribute2.i18n) {
|
|
25485
|
-
i18nAttrsMeta[attribute2.name] = attribute2.i18n;
|
|
25486
|
-
}
|
|
25487
|
-
if (normalizedName.startsWith(TEMPLATE_ATTR_PREFIX)) {
|
|
25488
|
-
if (elementHasInlineTemplate) {
|
|
25489
|
-
this.reportError(`Can't have multiple template bindings on one element. Use only one attribute prefixed with *`, attribute2.sourceSpan);
|
|
25490
|
-
}
|
|
25491
|
-
isTemplateBinding = true;
|
|
25492
|
-
elementHasInlineTemplate = true;
|
|
25493
|
-
const templateValue = attribute2.value;
|
|
25494
|
-
const templateKey = normalizedName.substring(TEMPLATE_ATTR_PREFIX.length);
|
|
25495
|
-
const parsedVariables = [];
|
|
25496
|
-
const absoluteValueOffset = attribute2.valueSpan ? attribute2.valueSpan.start.offset : (
|
|
25497
|
-
// If there is no value span the attribute does not have a value, like `attr` in
|
|
25498
|
-
//`<div attr></div>`. In this case, point to one character beyond the last character of
|
|
25499
|
-
// the attribute name.
|
|
25500
|
-
attribute2.sourceSpan.start.offset + attribute2.name.length
|
|
25501
|
-
);
|
|
25502
|
-
this.bindingParser.parseInlineTemplateBinding(
|
|
25503
|
-
templateKey,
|
|
25504
|
-
templateValue,
|
|
25505
|
-
attribute2.sourceSpan,
|
|
25506
|
-
absoluteValueOffset,
|
|
25507
|
-
[],
|
|
25508
|
-
templateParsedProperties,
|
|
25509
|
-
parsedVariables,
|
|
25510
|
-
true
|
|
25511
|
-
/* isIvyAst */
|
|
25512
|
-
);
|
|
25513
|
-
templateVariables.push(...parsedVariables.map((v) => new Variable(v.name, v.value, v.sourceSpan, v.keySpan, v.valueSpan)));
|
|
25514
|
-
} else {
|
|
25515
|
-
hasBinding = this.parseAttribute(isTemplateElement, attribute2, [], parsedProperties, boundEvents, variables, references);
|
|
25516
|
-
}
|
|
25517
|
-
if (!hasBinding && !isTemplateBinding) {
|
|
25518
|
-
attributes.push(this.visitAttribute(attribute2));
|
|
25519
|
-
}
|
|
25520
|
-
}
|
|
26125
|
+
const { attributes, boundEvents, references, variables, templateVariables, elementHasInlineTemplate, parsedProperties, templateParsedProperties, i18nAttrsMeta } = this.prepareAttributes(element2.attrs, isTemplateElement);
|
|
26126
|
+
const directives = this.extractDirectives(element2);
|
|
25521
26127
|
let children;
|
|
25522
26128
|
if (preparsedElement.nonBindable) {
|
|
25523
26129
|
children = visitAll(NON_BINDABLE_VISITOR, element2.children).flat(Infinity);
|
|
@@ -25528,32 +26134,19 @@ var HtmlAstToIvyAst = class {
|
|
|
25528
26134
|
if (preparsedElement.type === PreparsedElementType.NG_CONTENT) {
|
|
25529
26135
|
const selector = preparsedElement.selectAttr;
|
|
25530
26136
|
const attrs = element2.attrs.map((attr) => this.visitAttribute(attr));
|
|
25531
|
-
parsedElement = new Content(selector, attrs, children, element2.sourceSpan, element2.i18n);
|
|
26137
|
+
parsedElement = new Content(selector, attrs, children, element2.sourceSpan, element2.startSourceSpan, element2.endSourceSpan, element2.i18n);
|
|
25532
26138
|
this.ngContentSelectors.push(selector);
|
|
25533
26139
|
} else if (isTemplateElement) {
|
|
25534
|
-
const attrs = this.
|
|
25535
|
-
parsedElement = new Template(element2.name, attributes, attrs.bound, boundEvents, [
|
|
26140
|
+
const attrs = this.categorizePropertyAttributes(element2.name, parsedProperties, i18nAttrsMeta);
|
|
26141
|
+
parsedElement = new Template(element2.name, attributes, attrs.bound, boundEvents, directives, [
|
|
25536
26142
|
/* no template attributes */
|
|
25537
26143
|
], children, references, variables, element2.sourceSpan, element2.startSourceSpan, element2.endSourceSpan, element2.i18n);
|
|
25538
26144
|
} else {
|
|
25539
|
-
const attrs = this.
|
|
25540
|
-
parsedElement = new Element$1(element2.name, attributes, attrs.bound, boundEvents, children, references, element2.sourceSpan, element2.startSourceSpan, element2.endSourceSpan, element2.i18n);
|
|
26145
|
+
const attrs = this.categorizePropertyAttributes(element2.name, parsedProperties, i18nAttrsMeta);
|
|
26146
|
+
parsedElement = new Element$1(element2.name, attributes, attrs.bound, boundEvents, directives, children, references, element2.sourceSpan, element2.startSourceSpan, element2.endSourceSpan, element2.i18n);
|
|
25541
26147
|
}
|
|
25542
26148
|
if (elementHasInlineTemplate) {
|
|
25543
|
-
|
|
25544
|
-
const templateAttrs = [];
|
|
25545
|
-
attrs.literal.forEach((attr) => templateAttrs.push(attr));
|
|
25546
|
-
attrs.bound.forEach((attr) => templateAttrs.push(attr));
|
|
25547
|
-
const hoistedAttrs = parsedElement instanceof Element$1 ? {
|
|
25548
|
-
attributes: parsedElement.attributes,
|
|
25549
|
-
inputs: parsedElement.inputs,
|
|
25550
|
-
outputs: parsedElement.outputs
|
|
25551
|
-
} : { attributes: [], inputs: [], outputs: [] };
|
|
25552
|
-
const i18n2 = isTemplateElement && isI18nRootElement ? void 0 : element2.i18n;
|
|
25553
|
-
const name = parsedElement instanceof Template ? null : parsedElement.name;
|
|
25554
|
-
parsedElement = new Template(name, hoistedAttrs.attributes, hoistedAttrs.inputs, hoistedAttrs.outputs, templateAttrs, [parsedElement], [
|
|
25555
|
-
/* no references */
|
|
25556
|
-
], templateVariables, element2.sourceSpan, element2.startSourceSpan, element2.endSourceSpan, i18n2);
|
|
26149
|
+
parsedElement = this.wrapInTemplate(parsedElement, templateParsedProperties, templateVariables, i18nAttrsMeta, isTemplateElement, isI18nRootElement);
|
|
25557
26150
|
}
|
|
25558
26151
|
if (isI18nRootElement) {
|
|
25559
26152
|
this.inI18nBlock = false;
|
|
@@ -25604,6 +26197,40 @@ var HtmlAstToIvyAst = class {
|
|
|
25604
26197
|
}
|
|
25605
26198
|
return new LetDeclaration$1(decl.name, value, decl.sourceSpan, decl.nameSpan, decl.valueSpan);
|
|
25606
26199
|
}
|
|
26200
|
+
visitComponent(component) {
|
|
26201
|
+
const isI18nRootElement = isI18nRootNode(component.i18n);
|
|
26202
|
+
if (isI18nRootElement) {
|
|
26203
|
+
if (this.inI18nBlock) {
|
|
26204
|
+
this.reportError("Cannot mark a component as translatable inside of a translatable section. Please remove the nested i18n marker.", component.sourceSpan);
|
|
26205
|
+
}
|
|
26206
|
+
this.inI18nBlock = true;
|
|
26207
|
+
}
|
|
26208
|
+
if (component.tagName !== null && UNSUPPORTED_SELECTORLESS_TAGS.has(component.tagName)) {
|
|
26209
|
+
this.reportError(`Tag name "${component.tagName}" cannot be used as a component tag`, component.startSourceSpan);
|
|
26210
|
+
return null;
|
|
26211
|
+
}
|
|
26212
|
+
const { attributes, boundEvents, references, templateVariables, elementHasInlineTemplate, parsedProperties, templateParsedProperties, i18nAttrsMeta } = this.prepareAttributes(component.attrs, false);
|
|
26213
|
+
this.validateSelectorlessReferences(references);
|
|
26214
|
+
const directives = this.extractDirectives(component);
|
|
26215
|
+
let children;
|
|
26216
|
+
if (component.attrs.find((attr) => attr.name === "ngNonBindable")) {
|
|
26217
|
+
children = visitAll(NON_BINDABLE_VISITOR, component.children).flat(Infinity);
|
|
26218
|
+
} else {
|
|
26219
|
+
children = visitAll(this, component.children, component.children);
|
|
26220
|
+
}
|
|
26221
|
+
const attrs = this.categorizePropertyAttributes(component.tagName, parsedProperties, i18nAttrsMeta);
|
|
26222
|
+
let node = new Component$1(component.componentName, component.tagName, component.fullName, attributes, attrs.bound, boundEvents, directives, children, references, component.sourceSpan, component.startSourceSpan, component.endSourceSpan, component.i18n);
|
|
26223
|
+
if (elementHasInlineTemplate) {
|
|
26224
|
+
node = this.wrapInTemplate(node, templateParsedProperties, templateVariables, i18nAttrsMeta, false, isI18nRootElement);
|
|
26225
|
+
}
|
|
26226
|
+
if (isI18nRootElement) {
|
|
26227
|
+
this.inI18nBlock = false;
|
|
26228
|
+
}
|
|
26229
|
+
return node;
|
|
26230
|
+
}
|
|
26231
|
+
visitDirective() {
|
|
26232
|
+
return null;
|
|
26233
|
+
}
|
|
25607
26234
|
visitBlockParameter() {
|
|
25608
26235
|
return null;
|
|
25609
26236
|
}
|
|
@@ -25671,8 +26298,8 @@ var HtmlAstToIvyAst = class {
|
|
|
25671
26298
|
}
|
|
25672
26299
|
return relatedBlocks;
|
|
25673
26300
|
}
|
|
25674
|
-
|
|
25675
|
-
|
|
26301
|
+
/** Splits up the property attributes depending on whether they're static or bound. */
|
|
26302
|
+
categorizePropertyAttributes(elementName, properties, i18nPropsMeta) {
|
|
25676
26303
|
const bound = [];
|
|
25677
26304
|
const literal2 = [];
|
|
25678
26305
|
properties.forEach((prop) => {
|
|
@@ -25693,6 +26320,69 @@ var HtmlAstToIvyAst = class {
|
|
|
25693
26320
|
});
|
|
25694
26321
|
return { bound, literal: literal2 };
|
|
25695
26322
|
}
|
|
26323
|
+
prepareAttributes(attrs, isTemplateElement) {
|
|
26324
|
+
const parsedProperties = [];
|
|
26325
|
+
const boundEvents = [];
|
|
26326
|
+
const variables = [];
|
|
26327
|
+
const references = [];
|
|
26328
|
+
const attributes = [];
|
|
26329
|
+
const i18nAttrsMeta = {};
|
|
26330
|
+
const templateParsedProperties = [];
|
|
26331
|
+
const templateVariables = [];
|
|
26332
|
+
let elementHasInlineTemplate = false;
|
|
26333
|
+
for (const attribute2 of attrs) {
|
|
26334
|
+
let hasBinding = false;
|
|
26335
|
+
const normalizedName = normalizeAttributeName(attribute2.name);
|
|
26336
|
+
let isTemplateBinding = false;
|
|
26337
|
+
if (attribute2.i18n) {
|
|
26338
|
+
i18nAttrsMeta[attribute2.name] = attribute2.i18n;
|
|
26339
|
+
}
|
|
26340
|
+
if (normalizedName.startsWith(TEMPLATE_ATTR_PREFIX)) {
|
|
26341
|
+
if (elementHasInlineTemplate) {
|
|
26342
|
+
this.reportError(`Can't have multiple template bindings on one element. Use only one attribute prefixed with *`, attribute2.sourceSpan);
|
|
26343
|
+
}
|
|
26344
|
+
isTemplateBinding = true;
|
|
26345
|
+
elementHasInlineTemplate = true;
|
|
26346
|
+
const templateValue = attribute2.value;
|
|
26347
|
+
const templateKey = normalizedName.substring(TEMPLATE_ATTR_PREFIX.length);
|
|
26348
|
+
const parsedVariables = [];
|
|
26349
|
+
const absoluteValueOffset = attribute2.valueSpan ? attribute2.valueSpan.start.offset : (
|
|
26350
|
+
// If there is no value span the attribute does not have a value, like `attr` in
|
|
26351
|
+
//`<div attr></div>`. In this case, point to one character beyond the last character of
|
|
26352
|
+
// the attribute name.
|
|
26353
|
+
attribute2.sourceSpan.start.offset + attribute2.name.length
|
|
26354
|
+
);
|
|
26355
|
+
this.bindingParser.parseInlineTemplateBinding(
|
|
26356
|
+
templateKey,
|
|
26357
|
+
templateValue,
|
|
26358
|
+
attribute2.sourceSpan,
|
|
26359
|
+
absoluteValueOffset,
|
|
26360
|
+
[],
|
|
26361
|
+
templateParsedProperties,
|
|
26362
|
+
parsedVariables,
|
|
26363
|
+
true
|
|
26364
|
+
/* isIvyAst */
|
|
26365
|
+
);
|
|
26366
|
+
templateVariables.push(...parsedVariables.map((v) => new Variable(v.name, v.value, v.sourceSpan, v.keySpan, v.valueSpan)));
|
|
26367
|
+
} else {
|
|
26368
|
+
hasBinding = this.parseAttribute(isTemplateElement, attribute2, [], parsedProperties, boundEvents, variables, references);
|
|
26369
|
+
}
|
|
26370
|
+
if (!hasBinding && !isTemplateBinding) {
|
|
26371
|
+
attributes.push(this.visitAttribute(attribute2));
|
|
26372
|
+
}
|
|
26373
|
+
}
|
|
26374
|
+
return {
|
|
26375
|
+
attributes,
|
|
26376
|
+
boundEvents,
|
|
26377
|
+
references,
|
|
26378
|
+
variables,
|
|
26379
|
+
templateVariables,
|
|
26380
|
+
elementHasInlineTemplate,
|
|
26381
|
+
parsedProperties,
|
|
26382
|
+
templateParsedProperties,
|
|
26383
|
+
i18nAttrsMeta
|
|
26384
|
+
};
|
|
26385
|
+
}
|
|
25696
26386
|
parseAttribute(isTemplateElement, attribute2, matchableAttributes, parsedProperties, boundEvents, variables, references) {
|
|
25697
26387
|
const name = normalizeAttributeName(attribute2.name);
|
|
25698
26388
|
const value = attribute2.value;
|
|
@@ -25791,6 +26481,75 @@ var HtmlAstToIvyAst = class {
|
|
|
25791
26481
|
const hasBinding = this.bindingParser.parsePropertyInterpolation(name, value, srcSpan, attribute2.valueSpan, matchableAttributes, parsedProperties, keySpan, attribute2.valueTokens ?? null);
|
|
25792
26482
|
return hasBinding;
|
|
25793
26483
|
}
|
|
26484
|
+
extractDirectives(node) {
|
|
26485
|
+
const elementName = node instanceof Component2 ? node.tagName : node.name;
|
|
26486
|
+
const directives = [];
|
|
26487
|
+
const seenDirectives = /* @__PURE__ */ new Set();
|
|
26488
|
+
for (const directive of node.directives) {
|
|
26489
|
+
let invalid = false;
|
|
26490
|
+
for (const attr of directive.attrs) {
|
|
26491
|
+
if (attr.name.startsWith(TEMPLATE_ATTR_PREFIX)) {
|
|
26492
|
+
invalid = true;
|
|
26493
|
+
this.reportError(`Shorthand template syntax "${attr.name}" is not supported inside a directive context`, attr.sourceSpan);
|
|
26494
|
+
} else if (UNSUPPORTED_SELECTORLESS_DIRECTIVE_ATTRS.has(attr.name)) {
|
|
26495
|
+
invalid = true;
|
|
26496
|
+
this.reportError(`Attribute "${attr.name}" is not supported in a directive context`, attr.sourceSpan);
|
|
26497
|
+
}
|
|
26498
|
+
}
|
|
26499
|
+
if (!invalid && seenDirectives.has(directive.name)) {
|
|
26500
|
+
invalid = true;
|
|
26501
|
+
this.reportError(`Cannot apply directive "${directive.name}" multiple times on the same element`, directive.sourceSpan);
|
|
26502
|
+
}
|
|
26503
|
+
if (invalid) {
|
|
26504
|
+
continue;
|
|
26505
|
+
}
|
|
26506
|
+
const { attributes, parsedProperties, boundEvents, references, i18nAttrsMeta } = this.prepareAttributes(directive.attrs, false);
|
|
26507
|
+
this.validateSelectorlessReferences(references);
|
|
26508
|
+
const { bound: inputs } = this.categorizePropertyAttributes(elementName, parsedProperties, i18nAttrsMeta);
|
|
26509
|
+
for (const input of inputs) {
|
|
26510
|
+
if (input.type !== BindingType.Property && input.type !== BindingType.TwoWay) {
|
|
26511
|
+
invalid = true;
|
|
26512
|
+
this.reportError("Binding is not supported in a directive context", input.sourceSpan);
|
|
26513
|
+
}
|
|
26514
|
+
}
|
|
26515
|
+
if (invalid) {
|
|
26516
|
+
continue;
|
|
26517
|
+
}
|
|
26518
|
+
seenDirectives.add(directive.name);
|
|
26519
|
+
directives.push(new Directive$1(directive.name, attributes, inputs, boundEvents, references, directive.sourceSpan, directive.startSourceSpan, directive.endSourceSpan, void 0));
|
|
26520
|
+
}
|
|
26521
|
+
return directives;
|
|
26522
|
+
}
|
|
26523
|
+
wrapInTemplate(node, templateProperties, templateVariables, i18nAttrsMeta, isTemplateElement, isI18nRootElement) {
|
|
26524
|
+
const attrs = this.categorizePropertyAttributes("ng-template", templateProperties, i18nAttrsMeta);
|
|
26525
|
+
const templateAttrs = [];
|
|
26526
|
+
attrs.literal.forEach((attr) => templateAttrs.push(attr));
|
|
26527
|
+
attrs.bound.forEach((attr) => templateAttrs.push(attr));
|
|
26528
|
+
const hoistedAttrs = {
|
|
26529
|
+
attributes: [],
|
|
26530
|
+
inputs: [],
|
|
26531
|
+
outputs: []
|
|
26532
|
+
};
|
|
26533
|
+
if (node instanceof Element$1 || node instanceof Component$1) {
|
|
26534
|
+
hoistedAttrs.attributes.push(...node.attributes);
|
|
26535
|
+
hoistedAttrs.inputs.push(...node.inputs);
|
|
26536
|
+
hoistedAttrs.outputs.push(...node.outputs);
|
|
26537
|
+
}
|
|
26538
|
+
const i18n2 = isTemplateElement && isI18nRootElement ? void 0 : node.i18n;
|
|
26539
|
+
let name;
|
|
26540
|
+
if (node instanceof Component$1) {
|
|
26541
|
+
name = node.tagName;
|
|
26542
|
+
} else if (node instanceof Template) {
|
|
26543
|
+
name = null;
|
|
26544
|
+
} else {
|
|
26545
|
+
name = node.name;
|
|
26546
|
+
}
|
|
26547
|
+
return new Template(name, hoistedAttrs.attributes, hoistedAttrs.inputs, hoistedAttrs.outputs, [
|
|
26548
|
+
// Do not copy over the directives.
|
|
26549
|
+
], templateAttrs, [node], [
|
|
26550
|
+
// Do not copy over the references.
|
|
26551
|
+
], templateVariables, node.sourceSpan, node.startSourceSpan, node.endSourceSpan, i18n2);
|
|
26552
|
+
}
|
|
25794
26553
|
_visitTextWithInterpolation(value, sourceSpan, interpolatedTokens, i18n2) {
|
|
25795
26554
|
const valueNoNgsp = replaceNgsp(value);
|
|
25796
26555
|
const expr = this.bindingParser.parseInterpolation(valueNoNgsp, sourceSpan, interpolatedTokens);
|
|
@@ -25829,6 +26588,21 @@ var HtmlAstToIvyAst = class {
|
|
|
25829
26588
|
);
|
|
25830
26589
|
addEvents(events, boundEvents);
|
|
25831
26590
|
}
|
|
26591
|
+
validateSelectorlessReferences(references) {
|
|
26592
|
+
if (references.length === 0) {
|
|
26593
|
+
return;
|
|
26594
|
+
}
|
|
26595
|
+
const seenNames = /* @__PURE__ */ new Set();
|
|
26596
|
+
for (const ref of references) {
|
|
26597
|
+
if (ref.value.length > 0) {
|
|
26598
|
+
this.reportError("Cannot specify a value for a local reference in this context", ref.valueSpan || ref.sourceSpan);
|
|
26599
|
+
} else if (seenNames.has(ref.name)) {
|
|
26600
|
+
this.reportError("Duplicate reference names are not allowed", ref.sourceSpan);
|
|
26601
|
+
} else {
|
|
26602
|
+
seenNames.add(ref.name);
|
|
26603
|
+
}
|
|
26604
|
+
}
|
|
26605
|
+
}
|
|
25832
26606
|
reportError(message, sourceSpan, level = ParseErrorLevel.ERROR) {
|
|
25833
26607
|
this.errors.push(new ParseError(sourceSpan, message, level));
|
|
25834
26608
|
}
|
|
@@ -25850,6 +26624,8 @@ var NonBindableVisitor = class {
|
|
|
25850
26624
|
[],
|
|
25851
26625
|
/* outputs */
|
|
25852
26626
|
[],
|
|
26627
|
+
/* directives */
|
|
26628
|
+
[],
|
|
25853
26629
|
children,
|
|
25854
26630
|
/* references */
|
|
25855
26631
|
[],
|
|
@@ -25891,6 +26667,28 @@ var NonBindableVisitor = class {
|
|
|
25891
26667
|
visitLetDeclaration(decl, context) {
|
|
25892
26668
|
return new Text$3(`@let ${decl.name} = ${decl.value};`, decl.sourceSpan);
|
|
25893
26669
|
}
|
|
26670
|
+
visitComponent(ast, context) {
|
|
26671
|
+
const children = visitAll(this, ast.children, null);
|
|
26672
|
+
return new Element$1(
|
|
26673
|
+
ast.fullName,
|
|
26674
|
+
visitAll(this, ast.attrs),
|
|
26675
|
+
/* inputs */
|
|
26676
|
+
[],
|
|
26677
|
+
/* outputs */
|
|
26678
|
+
[],
|
|
26679
|
+
/* directives */
|
|
26680
|
+
[],
|
|
26681
|
+
children,
|
|
26682
|
+
/* references */
|
|
26683
|
+
[],
|
|
26684
|
+
ast.sourceSpan,
|
|
26685
|
+
ast.startSourceSpan,
|
|
26686
|
+
ast.endSourceSpan
|
|
26687
|
+
);
|
|
26688
|
+
}
|
|
26689
|
+
visitDirective(directive, context) {
|
|
26690
|
+
return null;
|
|
26691
|
+
}
|
|
25894
26692
|
};
|
|
25895
26693
|
var NON_BINDABLE_VISITOR = new NonBindableVisitor();
|
|
25896
26694
|
function normalizeAttributeName(attrName) {
|
|
@@ -25919,7 +26717,8 @@ function parseTemplate(template2, templateUrl, options = {}) {
|
|
|
25919
26717
|
...options,
|
|
25920
26718
|
tokenizeExpansionForms: true,
|
|
25921
26719
|
tokenizeBlocks: options.enableBlockSyntax ?? true,
|
|
25922
|
-
tokenizeLet: options.enableLetSyntax ?? true
|
|
26720
|
+
tokenizeLet: options.enableLetSyntax ?? true,
|
|
26721
|
+
selectorlessEnabled: options.enableSelectorless ?? false
|
|
25923
26722
|
});
|
|
25924
26723
|
if (!options.alwaysAttemptHtmlToR3AstConversion && parseResult.errors && parseResult.errors.length > 0) {
|
|
25925
26724
|
const parsedTemplate2 = {
|
|
@@ -26495,11 +27294,12 @@ var R3TargetBinder = class {
|
|
|
26495
27294
|
* metadata about the types referenced in the template.
|
|
26496
27295
|
*/
|
|
26497
27296
|
bind(target) {
|
|
26498
|
-
if (!target.template) {
|
|
27297
|
+
if (!target.template && !target.host) {
|
|
26499
27298
|
throw new Error("Empty bound targets are not supported");
|
|
26500
27299
|
}
|
|
26501
27300
|
const directives = /* @__PURE__ */ new Map();
|
|
26502
27301
|
const eagerDirectives = [];
|
|
27302
|
+
const missingDirectives = /* @__PURE__ */ new Set();
|
|
26503
27303
|
const bindings = /* @__PURE__ */ new Map();
|
|
26504
27304
|
const references = /* @__PURE__ */ new Map();
|
|
26505
27305
|
const scopedNodeEntities = /* @__PURE__ */ new Map();
|
|
@@ -26512,10 +27312,15 @@ var R3TargetBinder = class {
|
|
|
26512
27312
|
if (target.template) {
|
|
26513
27313
|
const scope = Scope2.apply(target.template);
|
|
26514
27314
|
extractScopedNodeEntities(scope, scopedNodeEntities);
|
|
26515
|
-
|
|
27315
|
+
if (this.directiveMatcher !== null) {
|
|
27316
|
+
DirectiveBinder.apply(target.template, this.directiveMatcher, directives, eagerDirectives, missingDirectives, bindings, references);
|
|
27317
|
+
}
|
|
26516
27318
|
TemplateBinder.applyWithScope(target.template, scope, expressions, symbols, nestingLevel, usedPipes, eagerPipes, deferBlocks);
|
|
26517
27319
|
}
|
|
26518
|
-
|
|
27320
|
+
if (target.host) {
|
|
27321
|
+
TemplateBinder.applyWithScope(target.host, Scope2.apply(target.host), expressions, symbols, nestingLevel, usedPipes, eagerPipes, deferBlocks);
|
|
27322
|
+
}
|
|
27323
|
+
return new R3BoundTarget(target, directives, eagerDirectives, missingDirectives, bindings, references, expressions, symbols, nestingLevel, scopedNodeEntities, usedPipes, eagerPipes, deferBlocks);
|
|
26519
27324
|
}
|
|
26520
27325
|
};
|
|
26521
27326
|
var Scope2 = class _Scope {
|
|
@@ -26529,9 +27334,9 @@ var Scope2 = class _Scope {
|
|
|
26529
27334
|
*/
|
|
26530
27335
|
namedEntities = /* @__PURE__ */ new Map();
|
|
26531
27336
|
/**
|
|
26532
|
-
* Set of
|
|
27337
|
+
* Set of element-like nodes that belong to this scope.
|
|
26533
27338
|
*/
|
|
26534
|
-
|
|
27339
|
+
elementLikeInScope = /* @__PURE__ */ new Set();
|
|
26535
27340
|
/**
|
|
26536
27341
|
* Child `Scope`s for immediately nested `ScopedNode`s.
|
|
26537
27342
|
*/
|
|
@@ -26573,16 +27378,15 @@ var Scope2 = class _Scope {
|
|
|
26573
27378
|
nodeOrNodes.children.forEach((node) => node.visit(this));
|
|
26574
27379
|
} else if (nodeOrNodes instanceof SwitchBlockCase || nodeOrNodes instanceof ForLoopBlockEmpty || nodeOrNodes instanceof DeferredBlock || nodeOrNodes instanceof DeferredBlockError || nodeOrNodes instanceof DeferredBlockPlaceholder || nodeOrNodes instanceof DeferredBlockLoading || nodeOrNodes instanceof Content) {
|
|
26575
27380
|
nodeOrNodes.children.forEach((node) => node.visit(this));
|
|
26576
|
-
} else {
|
|
27381
|
+
} else if (!(nodeOrNodes instanceof HostElement)) {
|
|
26577
27382
|
nodeOrNodes.forEach((node) => node.visit(this));
|
|
26578
27383
|
}
|
|
26579
27384
|
}
|
|
26580
27385
|
visitElement(element2) {
|
|
26581
|
-
|
|
26582
|
-
element2.children.forEach((node) => node.visit(this));
|
|
26583
|
-
this.elementsInScope.add(element2);
|
|
27386
|
+
this.visitElementLike(element2);
|
|
26584
27387
|
}
|
|
26585
27388
|
visitTemplate(template2) {
|
|
27389
|
+
template2.directives.forEach((node) => node.visit(this));
|
|
26586
27390
|
template2.references.forEach((node) => this.visitReference(node));
|
|
26587
27391
|
this.ingestScopedNode(template2);
|
|
26588
27392
|
}
|
|
@@ -26632,6 +27436,12 @@ var Scope2 = class _Scope {
|
|
|
26632
27436
|
visitLetDeclaration(decl) {
|
|
26633
27437
|
this.maybeDeclare(decl);
|
|
26634
27438
|
}
|
|
27439
|
+
visitComponent(component) {
|
|
27440
|
+
this.visitElementLike(component);
|
|
27441
|
+
}
|
|
27442
|
+
visitDirective(directive) {
|
|
27443
|
+
directive.references.forEach((current) => this.visitReference(current));
|
|
27444
|
+
}
|
|
26635
27445
|
// Unused visitors.
|
|
26636
27446
|
visitBoundAttribute(attr) {
|
|
26637
27447
|
}
|
|
@@ -26649,6 +27459,12 @@ var Scope2 = class _Scope {
|
|
|
26649
27459
|
}
|
|
26650
27460
|
visitUnknownBlock(block) {
|
|
26651
27461
|
}
|
|
27462
|
+
visitElementLike(node) {
|
|
27463
|
+
node.directives.forEach((current) => current.visit(this));
|
|
27464
|
+
node.references.forEach((current) => this.visitReference(current));
|
|
27465
|
+
node.children.forEach((current) => current.visit(this));
|
|
27466
|
+
this.elementLikeInScope.add(node);
|
|
27467
|
+
}
|
|
26652
27468
|
maybeDeclare(thing) {
|
|
26653
27469
|
if (!this.namedEntities.has(thing.name)) {
|
|
26654
27470
|
this.namedEntities.set(thing.name, thing);
|
|
@@ -26690,17 +27506,19 @@ var DirectiveBinder = class _DirectiveBinder {
|
|
|
26690
27506
|
static {
|
|
26691
27507
|
__name(this, "DirectiveBinder");
|
|
26692
27508
|
}
|
|
26693
|
-
|
|
27509
|
+
directiveMatcher;
|
|
26694
27510
|
directives;
|
|
26695
27511
|
eagerDirectives;
|
|
27512
|
+
missingDirectives;
|
|
26696
27513
|
bindings;
|
|
26697
27514
|
references;
|
|
26698
27515
|
// Indicates whether we are visiting elements within a `defer` block
|
|
26699
27516
|
isInDeferBlock = false;
|
|
26700
|
-
constructor(
|
|
26701
|
-
this.
|
|
27517
|
+
constructor(directiveMatcher, directives, eagerDirectives, missingDirectives, bindings, references) {
|
|
27518
|
+
this.directiveMatcher = directiveMatcher;
|
|
26702
27519
|
this.directives = directives;
|
|
26703
27520
|
this.eagerDirectives = eagerDirectives;
|
|
27521
|
+
this.missingDirectives = missingDirectives;
|
|
26704
27522
|
this.bindings = bindings;
|
|
26705
27523
|
this.references = references;
|
|
26706
27524
|
}
|
|
@@ -26716,8 +27534,8 @@ var DirectiveBinder = class _DirectiveBinder {
|
|
|
26716
27534
|
* map which resolves #references (`Reference`s) within the template to the named directive or
|
|
26717
27535
|
* template node.
|
|
26718
27536
|
*/
|
|
26719
|
-
static apply(template2,
|
|
26720
|
-
const matcher = new _DirectiveBinder(
|
|
27537
|
+
static apply(template2, directiveMatcher, directives, eagerDirectives, missingDirectives, bindings, references) {
|
|
27538
|
+
const matcher = new _DirectiveBinder(directiveMatcher, directives, eagerDirectives, missingDirectives, bindings, references);
|
|
26721
27539
|
matcher.ingest(template2);
|
|
26722
27540
|
}
|
|
26723
27541
|
ingest(template2) {
|
|
@@ -26729,45 +27547,6 @@ var DirectiveBinder = class _DirectiveBinder {
|
|
|
26729
27547
|
visitTemplate(template2) {
|
|
26730
27548
|
this.visitElementOrTemplate(template2);
|
|
26731
27549
|
}
|
|
26732
|
-
visitElementOrTemplate(node) {
|
|
26733
|
-
const cssSelector = createCssSelectorFromNode(node);
|
|
26734
|
-
const directives = [];
|
|
26735
|
-
this.matcher.match(cssSelector, (_selector, results) => directives.push(...results));
|
|
26736
|
-
if (directives.length > 0) {
|
|
26737
|
-
this.directives.set(node, directives);
|
|
26738
|
-
if (!this.isInDeferBlock) {
|
|
26739
|
-
this.eagerDirectives.push(...directives);
|
|
26740
|
-
}
|
|
26741
|
-
}
|
|
26742
|
-
node.references.forEach((ref) => {
|
|
26743
|
-
let dirTarget = null;
|
|
26744
|
-
if (ref.value.trim() === "") {
|
|
26745
|
-
dirTarget = directives.find((dir) => dir.isComponent) || null;
|
|
26746
|
-
} else {
|
|
26747
|
-
dirTarget = directives.find((dir) => dir.exportAs !== null && dir.exportAs.some((value) => value === ref.value)) || null;
|
|
26748
|
-
if (dirTarget === null) {
|
|
26749
|
-
return;
|
|
26750
|
-
}
|
|
26751
|
-
}
|
|
26752
|
-
if (dirTarget !== null) {
|
|
26753
|
-
this.references.set(ref, { directive: dirTarget, node });
|
|
26754
|
-
} else {
|
|
26755
|
-
this.references.set(ref, node);
|
|
26756
|
-
}
|
|
26757
|
-
});
|
|
26758
|
-
const setAttributeBinding = /* @__PURE__ */ __name((attribute2, ioType) => {
|
|
26759
|
-
const dir = directives.find((dir2) => dir2[ioType].hasBindingPropertyName(attribute2.name));
|
|
26760
|
-
const binding = dir !== void 0 ? dir : node;
|
|
26761
|
-
this.bindings.set(attribute2, binding);
|
|
26762
|
-
}, "setAttributeBinding");
|
|
26763
|
-
node.inputs.forEach((input) => setAttributeBinding(input, "inputs"));
|
|
26764
|
-
node.attributes.forEach((attr) => setAttributeBinding(attr, "inputs"));
|
|
26765
|
-
if (node instanceof Template) {
|
|
26766
|
-
node.templateAttrs.forEach((attr) => setAttributeBinding(attr, "inputs"));
|
|
26767
|
-
}
|
|
26768
|
-
node.outputs.forEach((output) => setAttributeBinding(output, "outputs"));
|
|
26769
|
-
node.children.forEach((child) => child.visit(this));
|
|
26770
|
-
}
|
|
26771
27550
|
visitDeferredBlock(deferred) {
|
|
26772
27551
|
const wasInDeferBlock = this.isInDeferBlock;
|
|
26773
27552
|
this.isInDeferBlock = true;
|
|
@@ -26811,6 +27590,93 @@ var DirectiveBinder = class _DirectiveBinder {
|
|
|
26811
27590
|
visitContent(content) {
|
|
26812
27591
|
content.children.forEach((child) => child.visit(this));
|
|
26813
27592
|
}
|
|
27593
|
+
visitComponent(node) {
|
|
27594
|
+
if (this.directiveMatcher instanceof SelectorlessMatcher) {
|
|
27595
|
+
const componentMatches = this.directiveMatcher.match(node.componentName);
|
|
27596
|
+
if (componentMatches.length > 0) {
|
|
27597
|
+
this.trackSelectorlessMatchesAndDirectives(node, componentMatches);
|
|
27598
|
+
} else {
|
|
27599
|
+
this.missingDirectives.add(node.componentName);
|
|
27600
|
+
}
|
|
27601
|
+
}
|
|
27602
|
+
node.directives.forEach((directive) => directive.visit(this));
|
|
27603
|
+
node.children.forEach((child) => child.visit(this));
|
|
27604
|
+
}
|
|
27605
|
+
visitDirective(node) {
|
|
27606
|
+
if (this.directiveMatcher instanceof SelectorlessMatcher) {
|
|
27607
|
+
const directives = this.directiveMatcher.match(node.name);
|
|
27608
|
+
if (directives.length > 0) {
|
|
27609
|
+
this.trackSelectorlessMatchesAndDirectives(node, directives);
|
|
27610
|
+
} else {
|
|
27611
|
+
this.missingDirectives.add(node.name);
|
|
27612
|
+
}
|
|
27613
|
+
}
|
|
27614
|
+
}
|
|
27615
|
+
visitElementOrTemplate(node) {
|
|
27616
|
+
if (this.directiveMatcher instanceof SelectorMatcher) {
|
|
27617
|
+
const directives = [];
|
|
27618
|
+
const cssSelector = createCssSelectorFromNode(node);
|
|
27619
|
+
this.directiveMatcher.match(cssSelector, (_, results) => directives.push(...results));
|
|
27620
|
+
this.trackSelectorBasedBindingsAndDirectives(node, directives);
|
|
27621
|
+
}
|
|
27622
|
+
node.directives.forEach((directive) => directive.visit(this));
|
|
27623
|
+
node.children.forEach((child) => child.visit(this));
|
|
27624
|
+
}
|
|
27625
|
+
trackMatchedDirectives(node, directives) {
|
|
27626
|
+
if (directives.length > 0) {
|
|
27627
|
+
this.directives.set(node, directives);
|
|
27628
|
+
if (!this.isInDeferBlock) {
|
|
27629
|
+
this.eagerDirectives.push(...directives);
|
|
27630
|
+
}
|
|
27631
|
+
}
|
|
27632
|
+
}
|
|
27633
|
+
trackSelectorlessMatchesAndDirectives(node, directives) {
|
|
27634
|
+
if (directives.length === 0) {
|
|
27635
|
+
return;
|
|
27636
|
+
}
|
|
27637
|
+
this.trackMatchedDirectives(node, directives);
|
|
27638
|
+
const setBinding = /* @__PURE__ */ __name((meta, attribute2, ioType) => {
|
|
27639
|
+
if (meta[ioType].hasBindingPropertyName(attribute2.name)) {
|
|
27640
|
+
this.bindings.set(attribute2, meta);
|
|
27641
|
+
}
|
|
27642
|
+
}, "setBinding");
|
|
27643
|
+
for (const directive of directives) {
|
|
27644
|
+
node.inputs.forEach((input) => setBinding(directive, input, "inputs"));
|
|
27645
|
+
node.attributes.forEach((attr) => setBinding(directive, attr, "inputs"));
|
|
27646
|
+
node.outputs.forEach((output) => setBinding(directive, output, "outputs"));
|
|
27647
|
+
}
|
|
27648
|
+
node.references.forEach((ref) => this.references.set(ref, { directive: directives[0], node }));
|
|
27649
|
+
}
|
|
27650
|
+
trackSelectorBasedBindingsAndDirectives(node, directives) {
|
|
27651
|
+
this.trackMatchedDirectives(node, directives);
|
|
27652
|
+
node.references.forEach((ref) => {
|
|
27653
|
+
let dirTarget = null;
|
|
27654
|
+
if (ref.value.trim() === "") {
|
|
27655
|
+
dirTarget = directives.find((dir) => dir.isComponent) || null;
|
|
27656
|
+
} else {
|
|
27657
|
+
dirTarget = directives.find((dir) => dir.exportAs !== null && dir.exportAs.some((value) => value === ref.value)) || null;
|
|
27658
|
+
if (dirTarget === null) {
|
|
27659
|
+
return;
|
|
27660
|
+
}
|
|
27661
|
+
}
|
|
27662
|
+
if (dirTarget !== null) {
|
|
27663
|
+
this.references.set(ref, { directive: dirTarget, node });
|
|
27664
|
+
} else {
|
|
27665
|
+
this.references.set(ref, node);
|
|
27666
|
+
}
|
|
27667
|
+
});
|
|
27668
|
+
const setAttributeBinding = /* @__PURE__ */ __name((attribute2, ioType) => {
|
|
27669
|
+
const dir = directives.find((dir2) => dir2[ioType].hasBindingPropertyName(attribute2.name));
|
|
27670
|
+
const binding = dir !== void 0 ? dir : node;
|
|
27671
|
+
this.bindings.set(attribute2, binding);
|
|
27672
|
+
}, "setAttributeBinding");
|
|
27673
|
+
node.inputs.forEach((input) => setAttributeBinding(input, "inputs"));
|
|
27674
|
+
node.attributes.forEach((attr) => setAttributeBinding(attr, "inputs"));
|
|
27675
|
+
if (node instanceof Template) {
|
|
27676
|
+
node.templateAttrs.forEach((attr) => setAttributeBinding(attr, "inputs"));
|
|
27677
|
+
}
|
|
27678
|
+
node.outputs.forEach((output) => setAttributeBinding(output, "outputs"));
|
|
27679
|
+
}
|
|
26814
27680
|
// Unused visitors.
|
|
26815
27681
|
visitVariable(variable2) {
|
|
26816
27682
|
}
|
|
@@ -26877,7 +27743,7 @@ var TemplateBinder = class _TemplateBinder extends RecursiveAstVisitor2 {
|
|
|
26877
27743
|
/**
|
|
26878
27744
|
* Process a template and extract metadata about expressions and symbols within.
|
|
26879
27745
|
*
|
|
26880
|
-
* @param
|
|
27746
|
+
* @param nodeOrNodes the nodes of the template to process
|
|
26881
27747
|
* @param scope the `Scope` of the template being processed.
|
|
26882
27748
|
* @returns three maps which contain metadata about the template: `expressions` which interprets
|
|
26883
27749
|
* special `AST` nodes in expressions as pointing to references or variables declared within the
|
|
@@ -26886,10 +27752,10 @@ var TemplateBinder = class _TemplateBinder extends RecursiveAstVisitor2 {
|
|
|
26886
27752
|
* nesting level (how many levels deep within the template structure the `Template` is), starting
|
|
26887
27753
|
* at 1.
|
|
26888
27754
|
*/
|
|
26889
|
-
static applyWithScope(
|
|
26890
|
-
const template2 =
|
|
27755
|
+
static applyWithScope(nodeOrNodes, scope, expressions, symbols, nestingLevel, usedPipes, eagerPipes, deferBlocks) {
|
|
27756
|
+
const template2 = nodeOrNodes instanceof Template ? nodeOrNodes : null;
|
|
26891
27757
|
const binder = new _TemplateBinder(expressions, symbols, usedPipes, eagerPipes, deferBlocks, nestingLevel, scope, template2, 0);
|
|
26892
|
-
binder.ingest(
|
|
27758
|
+
binder.ingest(nodeOrNodes);
|
|
26893
27759
|
}
|
|
26894
27760
|
ingest(nodeOrNodes) {
|
|
26895
27761
|
if (nodeOrNodes instanceof Template) {
|
|
@@ -26918,6 +27784,8 @@ var TemplateBinder = class _TemplateBinder extends RecursiveAstVisitor2 {
|
|
|
26918
27784
|
} else if (nodeOrNodes instanceof SwitchBlockCase || nodeOrNodes instanceof ForLoopBlockEmpty || nodeOrNodes instanceof DeferredBlockError || nodeOrNodes instanceof DeferredBlockPlaceholder || nodeOrNodes instanceof DeferredBlockLoading || nodeOrNodes instanceof Content) {
|
|
26919
27785
|
nodeOrNodes.children.forEach((node) => node.visit(this));
|
|
26920
27786
|
this.nestingLevel.set(nodeOrNodes, this.level);
|
|
27787
|
+
} else if (nodeOrNodes instanceof HostElement) {
|
|
27788
|
+
this.nestingLevel.set(nodeOrNodes, 0);
|
|
26921
27789
|
} else {
|
|
26922
27790
|
nodeOrNodes.forEach(this.visitNode);
|
|
26923
27791
|
}
|
|
@@ -26925,12 +27793,14 @@ var TemplateBinder = class _TemplateBinder extends RecursiveAstVisitor2 {
|
|
|
26925
27793
|
visitElement(element2) {
|
|
26926
27794
|
element2.inputs.forEach(this.visitNode);
|
|
26927
27795
|
element2.outputs.forEach(this.visitNode);
|
|
27796
|
+
element2.directives.forEach(this.visitNode);
|
|
26928
27797
|
element2.children.forEach(this.visitNode);
|
|
26929
27798
|
element2.references.forEach(this.visitNode);
|
|
26930
27799
|
}
|
|
26931
27800
|
visitTemplate(template2) {
|
|
26932
27801
|
template2.inputs.forEach(this.visitNode);
|
|
26933
27802
|
template2.outputs.forEach(this.visitNode);
|
|
27803
|
+
template2.directives.forEach(this.visitNode);
|
|
26934
27804
|
template2.templateAttrs.forEach(this.visitNode);
|
|
26935
27805
|
template2.references.forEach(this.visitNode);
|
|
26936
27806
|
this.ingestScopedNode(template2);
|
|
@@ -26945,6 +27815,18 @@ var TemplateBinder = class _TemplateBinder extends RecursiveAstVisitor2 {
|
|
|
26945
27815
|
this.symbols.set(reference2, this.rootNode);
|
|
26946
27816
|
}
|
|
26947
27817
|
}
|
|
27818
|
+
visitComponent(component) {
|
|
27819
|
+
component.inputs.forEach(this.visitNode);
|
|
27820
|
+
component.outputs.forEach(this.visitNode);
|
|
27821
|
+
component.directives.forEach(this.visitNode);
|
|
27822
|
+
component.children.forEach(this.visitNode);
|
|
27823
|
+
component.references.forEach(this.visitNode);
|
|
27824
|
+
}
|
|
27825
|
+
visitDirective(directive) {
|
|
27826
|
+
directive.inputs.forEach(this.visitNode);
|
|
27827
|
+
directive.outputs.forEach(this.visitNode);
|
|
27828
|
+
directive.references.forEach(this.visitNode);
|
|
27829
|
+
}
|
|
26948
27830
|
// Unused template visitors
|
|
26949
27831
|
visitText(text2) {
|
|
26950
27832
|
}
|
|
@@ -27062,6 +27944,7 @@ var R3BoundTarget = class {
|
|
|
27062
27944
|
target;
|
|
27063
27945
|
directives;
|
|
27064
27946
|
eagerDirectives;
|
|
27947
|
+
missingDirectives;
|
|
27065
27948
|
bindings;
|
|
27066
27949
|
references;
|
|
27067
27950
|
exprTargets;
|
|
@@ -27074,10 +27957,11 @@ var R3BoundTarget = class {
|
|
|
27074
27957
|
deferredBlocks;
|
|
27075
27958
|
/** Map of deferred blocks to their scope. */
|
|
27076
27959
|
deferredScopes;
|
|
27077
|
-
constructor(target, directives, eagerDirectives, bindings, references, exprTargets, symbols, nestingLevel, scopedNodeEntities, usedPipes, eagerPipes, rawDeferred) {
|
|
27960
|
+
constructor(target, directives, eagerDirectives, missingDirectives, bindings, references, exprTargets, symbols, nestingLevel, scopedNodeEntities, usedPipes, eagerPipes, rawDeferred) {
|
|
27078
27961
|
this.target = target;
|
|
27079
27962
|
this.directives = directives;
|
|
27080
27963
|
this.eagerDirectives = eagerDirectives;
|
|
27964
|
+
this.missingDirectives = missingDirectives;
|
|
27081
27965
|
this.bindings = bindings;
|
|
27082
27966
|
this.references = references;
|
|
27083
27967
|
this.exprTargets = exprTargets;
|
|
@@ -27174,7 +28058,7 @@ var R3BoundTarget = class {
|
|
|
27174
28058
|
const stack = [this.deferredScopes.get(block)];
|
|
27175
28059
|
while (stack.length > 0) {
|
|
27176
28060
|
const current = stack.pop();
|
|
27177
|
-
if (current.
|
|
28061
|
+
if (current.elementLikeInScope.has(element2)) {
|
|
27178
28062
|
return true;
|
|
27179
28063
|
}
|
|
27180
28064
|
stack.push(...current.childScopes.values());
|
|
@@ -27182,6 +28066,9 @@ var R3BoundTarget = class {
|
|
|
27182
28066
|
}
|
|
27183
28067
|
return false;
|
|
27184
28068
|
}
|
|
28069
|
+
referencedDirectiveExists(name) {
|
|
28070
|
+
return !this.missingDirectives.has(name);
|
|
28071
|
+
}
|
|
27185
28072
|
/**
|
|
27186
28073
|
* Finds an entity with a specific name in a scope.
|
|
27187
28074
|
* @param rootNode Root node of the scope.
|
|
@@ -27201,7 +28088,7 @@ var R3BoundTarget = class {
|
|
|
27201
28088
|
if (target instanceof Element$1) {
|
|
27202
28089
|
return target;
|
|
27203
28090
|
}
|
|
27204
|
-
if (target instanceof Template) {
|
|
28091
|
+
if (target instanceof Template || target.node instanceof Component$1 || target.node instanceof Directive$1) {
|
|
27205
28092
|
return null;
|
|
27206
28093
|
}
|
|
27207
28094
|
return this.referenceTargetToElement(target.node);
|
|
@@ -27685,7 +28572,7 @@ function parseJitTemplate(template2, typeName, sourceMapUrl, preserveWhitespaces
|
|
|
27685
28572
|
const errors = parsed.errors.map((err) => err.toString()).join(", ");
|
|
27686
28573
|
throw new Error(`Errors during JIT compilation of template for ${typeName}: ${errors}`);
|
|
27687
28574
|
}
|
|
27688
|
-
const binder = new R3TargetBinder(
|
|
28575
|
+
const binder = new R3TargetBinder(null);
|
|
27689
28576
|
const boundTarget = binder.bind({ template: parsed.nodes });
|
|
27690
28577
|
return {
|
|
27691
28578
|
template: parsed,
|
|
@@ -27895,7 +28782,6 @@ function publishFacade(global) {
|
|
|
27895
28782
|
ng.\u0275compilerFacade = new CompilerFacadeImpl();
|
|
27896
28783
|
}
|
|
27897
28784
|
__name(publishFacade, "publishFacade");
|
|
27898
|
-
var VERSION = new Version("19.2.14");
|
|
27899
28785
|
var CompilerConfig = class {
|
|
27900
28786
|
static {
|
|
27901
28787
|
__name(this, "CompilerConfig");
|
|
@@ -27995,7 +28881,7 @@ var _Visitor3 = class {
|
|
|
27995
28881
|
merge(nodes, translations, interpolationConfig) {
|
|
27996
28882
|
this._init(_VisitorMode.Merge, interpolationConfig);
|
|
27997
28883
|
this._translations = translations;
|
|
27998
|
-
const wrapper = new Element2("wrapper", [], nodes, void 0, void 0, void 0);
|
|
28884
|
+
const wrapper = new Element2("wrapper", [], [], nodes, void 0, void 0, void 0);
|
|
27999
28885
|
const translatedNode = wrapper.visit(this, null);
|
|
28000
28886
|
if (this._inI18nBlock) {
|
|
28001
28887
|
this._reportError(nodes[nodes.length - 1], "Unclosed block");
|
|
@@ -28072,41 +28958,83 @@ var _Visitor3 = class {
|
|
|
28072
28958
|
return text2;
|
|
28073
28959
|
}
|
|
28074
28960
|
visitElement(el, context) {
|
|
28075
|
-
this.
|
|
28961
|
+
return this._visitElementLike(el, context);
|
|
28962
|
+
}
|
|
28963
|
+
visitAttribute(attribute2, context) {
|
|
28964
|
+
throw new Error("unreachable code");
|
|
28965
|
+
}
|
|
28966
|
+
visitBlock(block, context) {
|
|
28967
|
+
visitAll(this, block.children, context);
|
|
28968
|
+
}
|
|
28969
|
+
visitBlockParameter(parameter, context) {
|
|
28970
|
+
}
|
|
28971
|
+
visitLetDeclaration(decl, context) {
|
|
28972
|
+
}
|
|
28973
|
+
visitComponent(component, context) {
|
|
28974
|
+
return this._visitElementLike(component, context);
|
|
28975
|
+
}
|
|
28976
|
+
visitDirective(directive, context) {
|
|
28977
|
+
throw new Error("unreachable code");
|
|
28978
|
+
}
|
|
28979
|
+
_init(mode, interpolationConfig) {
|
|
28980
|
+
this._mode = mode;
|
|
28981
|
+
this._inI18nBlock = false;
|
|
28982
|
+
this._inI18nNode = false;
|
|
28983
|
+
this._depth = 0;
|
|
28984
|
+
this._inIcu = false;
|
|
28985
|
+
this._msgCountAtSectionStart = void 0;
|
|
28986
|
+
this._errors = [];
|
|
28987
|
+
this._messages = [];
|
|
28988
|
+
this._inImplicitNode = false;
|
|
28989
|
+
this._createI18nMessage = createI18nMessageFactory(
|
|
28990
|
+
interpolationConfig,
|
|
28991
|
+
DEFAULT_CONTAINER_BLOCKS,
|
|
28992
|
+
// When dropping significant whitespace we need to retain whitespace tokens or
|
|
28993
|
+
// else we won't be able to reuse source spans because empty tokens would be
|
|
28994
|
+
// removed and cause a mismatch.
|
|
28995
|
+
/* retainEmptyTokens */
|
|
28996
|
+
!this._preserveSignificantWhitespace,
|
|
28997
|
+
/* preserveExpressionWhitespace */
|
|
28998
|
+
this._preserveSignificantWhitespace
|
|
28999
|
+
);
|
|
29000
|
+
}
|
|
29001
|
+
_visitElementLike(node, context) {
|
|
29002
|
+
this._mayBeAddBlockChildren(node);
|
|
28076
29003
|
this._depth++;
|
|
28077
29004
|
const wasInI18nNode = this._inI18nNode;
|
|
28078
29005
|
const wasInImplicitNode = this._inImplicitNode;
|
|
28079
29006
|
let childNodes = [];
|
|
28080
29007
|
let translatedChildNodes = void 0;
|
|
28081
|
-
const
|
|
29008
|
+
const nodeName = node instanceof Component2 ? node.tagName : node.name;
|
|
29009
|
+
const i18nAttr = _getI18nAttr(node);
|
|
28082
29010
|
const i18nMeta = i18nAttr ? i18nAttr.value : "";
|
|
28083
|
-
const isImplicit = this._implicitTags.some((tag) =>
|
|
29011
|
+
const isImplicit = this._implicitTags.some((tag) => nodeName === tag) && !this._inIcu && !this._isInTranslatableSection;
|
|
28084
29012
|
const isTopLevelImplicit = !wasInImplicitNode && isImplicit;
|
|
28085
29013
|
this._inImplicitNode = wasInImplicitNode || isImplicit;
|
|
28086
29014
|
if (!this._isInTranslatableSection && !this._inIcu) {
|
|
28087
29015
|
if (i18nAttr || isTopLevelImplicit) {
|
|
28088
29016
|
this._inI18nNode = true;
|
|
28089
|
-
const message = this._addMessage(
|
|
28090
|
-
translatedChildNodes = this._translateMessage(
|
|
29017
|
+
const message = this._addMessage(node.children, i18nMeta);
|
|
29018
|
+
translatedChildNodes = this._translateMessage(node, message);
|
|
28091
29019
|
}
|
|
28092
29020
|
if (this._mode == _VisitorMode.Extract) {
|
|
28093
29021
|
const isTranslatable = i18nAttr || isTopLevelImplicit;
|
|
28094
29022
|
if (isTranslatable)
|
|
28095
|
-
this._openTranslatableSection(
|
|
28096
|
-
visitAll(this,
|
|
29023
|
+
this._openTranslatableSection(node);
|
|
29024
|
+
visitAll(this, node.children);
|
|
28097
29025
|
if (isTranslatable)
|
|
28098
|
-
this._closeTranslatableSection(
|
|
29026
|
+
this._closeTranslatableSection(node, node.children);
|
|
28099
29027
|
}
|
|
28100
29028
|
} else {
|
|
28101
29029
|
if (i18nAttr || isTopLevelImplicit) {
|
|
28102
|
-
this._reportError(
|
|
29030
|
+
this._reportError(node, "Could not mark an element as translatable inside a translatable section");
|
|
28103
29031
|
}
|
|
28104
29032
|
if (this._mode == _VisitorMode.Extract) {
|
|
28105
|
-
visitAll(this,
|
|
29033
|
+
visitAll(this, node.children);
|
|
28106
29034
|
}
|
|
28107
29035
|
}
|
|
28108
29036
|
if (this._mode === _VisitorMode.Merge) {
|
|
28109
|
-
const visitNodes = translatedChildNodes ||
|
|
29037
|
+
const visitNodes = translatedChildNodes || node.children;
|
|
28110
29038
|
visitNodes.forEach((child) => {
|
|
28111
29039
|
const visited = child.visit(this, context);
|
|
28112
29040
|
if (visited && !this._isInTranslatableSection) {
|
|
@@ -28114,53 +29042,26 @@ var _Visitor3 = class {
|
|
|
28114
29042
|
}
|
|
28115
29043
|
});
|
|
28116
29044
|
}
|
|
28117
|
-
this._visitAttributesOf(
|
|
29045
|
+
this._visitAttributesOf(node);
|
|
28118
29046
|
this._depth--;
|
|
28119
29047
|
this._inI18nNode = wasInI18nNode;
|
|
28120
29048
|
this._inImplicitNode = wasInImplicitNode;
|
|
28121
29049
|
if (this._mode === _VisitorMode.Merge) {
|
|
28122
|
-
|
|
28123
|
-
|
|
29050
|
+
if (node instanceof Element2) {
|
|
29051
|
+
return new Element2(node.name, this._translateAttributes(node), this._translateDirectives(node), childNodes, node.sourceSpan, node.startSourceSpan, node.endSourceSpan);
|
|
29052
|
+
} else {
|
|
29053
|
+
return new Component2(node.componentName, node.tagName, node.fullName, this._translateAttributes(node), this._translateDirectives(node), childNodes, node.sourceSpan, node.startSourceSpan, node.endSourceSpan);
|
|
29054
|
+
}
|
|
28124
29055
|
}
|
|
28125
29056
|
return null;
|
|
28126
29057
|
}
|
|
28127
|
-
visitAttribute(attribute2, context) {
|
|
28128
|
-
throw new Error("unreachable code");
|
|
28129
|
-
}
|
|
28130
|
-
visitBlock(block, context) {
|
|
28131
|
-
visitAll(this, block.children, context);
|
|
28132
|
-
}
|
|
28133
|
-
visitBlockParameter(parameter, context) {
|
|
28134
|
-
}
|
|
28135
|
-
visitLetDeclaration(decl, context) {
|
|
28136
|
-
}
|
|
28137
|
-
_init(mode, interpolationConfig) {
|
|
28138
|
-
this._mode = mode;
|
|
28139
|
-
this._inI18nBlock = false;
|
|
28140
|
-
this._inI18nNode = false;
|
|
28141
|
-
this._depth = 0;
|
|
28142
|
-
this._inIcu = false;
|
|
28143
|
-
this._msgCountAtSectionStart = void 0;
|
|
28144
|
-
this._errors = [];
|
|
28145
|
-
this._messages = [];
|
|
28146
|
-
this._inImplicitNode = false;
|
|
28147
|
-
this._createI18nMessage = createI18nMessageFactory(
|
|
28148
|
-
interpolationConfig,
|
|
28149
|
-
DEFAULT_CONTAINER_BLOCKS,
|
|
28150
|
-
// When dropping significant whitespace we need to retain whitespace tokens or
|
|
28151
|
-
// else we won't be able to reuse source spans because empty tokens would be
|
|
28152
|
-
// removed and cause a mismatch.
|
|
28153
|
-
/* retainEmptyTokens */
|
|
28154
|
-
!this._preserveSignificantWhitespace,
|
|
28155
|
-
/* preserveExpressionWhitespace */
|
|
28156
|
-
this._preserveSignificantWhitespace
|
|
28157
|
-
);
|
|
28158
|
-
}
|
|
28159
29058
|
// looks for translatable attributes
|
|
28160
29059
|
_visitAttributesOf(el) {
|
|
28161
29060
|
const explicitAttrNameToValue = {};
|
|
28162
|
-
const implicitAttrNames = this._implicitAttrs[el.name] || [];
|
|
28163
|
-
el.attrs.filter((attr) => attr.name.startsWith(_I18N_ATTR_PREFIX)).forEach((attr) =>
|
|
29061
|
+
const implicitAttrNames = this._implicitAttrs[el instanceof Component2 ? el.tagName || "" : el.name] || [];
|
|
29062
|
+
el.attrs.filter((attr) => attr instanceof Attribute && attr.name.startsWith(_I18N_ATTR_PREFIX)).forEach((attr) => {
|
|
29063
|
+
explicitAttrNameToValue[attr.name.slice(_I18N_ATTR_PREFIX.length)] = attr.value;
|
|
29064
|
+
});
|
|
28164
29065
|
el.attrs.forEach((attr) => {
|
|
28165
29066
|
if (attr.name in explicitAttrNameToValue) {
|
|
28166
29067
|
this._addMessage([attr], explicitAttrNameToValue[attr.name]);
|
|
@@ -28230,16 +29131,15 @@ var _Visitor3 = class {
|
|
|
28230
29131
|
return [];
|
|
28231
29132
|
}
|
|
28232
29133
|
// translate the attributes of an element and remove i18n specific attributes
|
|
28233
|
-
_translateAttributes(
|
|
28234
|
-
const attributes = el.attrs;
|
|
29134
|
+
_translateAttributes(node) {
|
|
28235
29135
|
const i18nParsedMessageMeta = {};
|
|
28236
|
-
|
|
29136
|
+
const translatedAttributes = [];
|
|
29137
|
+
node.attrs.forEach((attr) => {
|
|
28237
29138
|
if (attr.name.startsWith(_I18N_ATTR_PREFIX)) {
|
|
28238
29139
|
i18nParsedMessageMeta[attr.name.slice(_I18N_ATTR_PREFIX.length)] = _parseMessageMeta(attr.value);
|
|
28239
29140
|
}
|
|
28240
29141
|
});
|
|
28241
|
-
|
|
28242
|
-
attributes.forEach((attr) => {
|
|
29142
|
+
node.attrs.forEach((attr) => {
|
|
28243
29143
|
if (attr.name === _I18N_ATTR || attr.name.startsWith(_I18N_ATTR_PREFIX)) {
|
|
28244
29144
|
return;
|
|
28245
29145
|
}
|
|
@@ -28272,10 +29172,10 @@ var _Visitor3 = class {
|
|
|
28272
29172
|
/* i18n */
|
|
28273
29173
|
));
|
|
28274
29174
|
} else {
|
|
28275
|
-
this._reportError(
|
|
29175
|
+
this._reportError(node, `Unexpected translation for attribute "${attr.name}" (id="${id || this._translations.digest(message)}")`);
|
|
28276
29176
|
}
|
|
28277
29177
|
} else {
|
|
28278
|
-
this._reportError(
|
|
29178
|
+
this._reportError(node, `Translation unavailable for attribute "${attr.name}" (id="${id || this._translations.digest(message)}")`);
|
|
28279
29179
|
}
|
|
28280
29180
|
} else {
|
|
28281
29181
|
translatedAttributes.push(attr);
|
|
@@ -28283,6 +29183,9 @@ var _Visitor3 = class {
|
|
|
28283
29183
|
});
|
|
28284
29184
|
return translatedAttributes;
|
|
28285
29185
|
}
|
|
29186
|
+
_translateDirectives(node) {
|
|
29187
|
+
return node.directives.map((dir) => new Directive2(dir.name, this._translateAttributes(dir), dir.sourceSpan, dir.startSourceSpan, dir.endSourceSpan));
|
|
29188
|
+
}
|
|
28286
29189
|
/**
|
|
28287
29190
|
* Add the node as a child of the block when:
|
|
28288
29191
|
* - we are in a block,
|
|
@@ -28359,7 +29262,7 @@ function _isClosingComment(n) {
|
|
|
28359
29262
|
}
|
|
28360
29263
|
__name(_isClosingComment, "_isClosingComment");
|
|
28361
29264
|
function _getI18nAttr(p) {
|
|
28362
|
-
return p.attrs.find((attr) => attr.name === _I18N_ATTR) || null;
|
|
29265
|
+
return p.attrs.find((attr) => attr instanceof Attribute && attr.name === _I18N_ATTR) || null;
|
|
28363
29266
|
}
|
|
28364
29267
|
__name(_getI18nAttr, "_getI18nAttr");
|
|
28365
29268
|
function _parseMessageMeta(i18n2) {
|
|
@@ -28413,7 +29316,12 @@ var XmlParser = class extends Parser$1 {
|
|
|
28413
29316
|
super(getXmlTagDefinition);
|
|
28414
29317
|
}
|
|
28415
29318
|
parse(source, url, options = {}) {
|
|
28416
|
-
return super.parse(source, url, {
|
|
29319
|
+
return super.parse(source, url, {
|
|
29320
|
+
...options,
|
|
29321
|
+
tokenizeBlocks: false,
|
|
29322
|
+
tokenizeLet: false,
|
|
29323
|
+
selectorlessEnabled: false
|
|
29324
|
+
});
|
|
28417
29325
|
}
|
|
28418
29326
|
};
|
|
28419
29327
|
var _VERSION$1 = "1.2";
|
|
@@ -28639,6 +29547,10 @@ var XliffParser = class {
|
|
|
28639
29547
|
}
|
|
28640
29548
|
visitLetDeclaration(decl, context) {
|
|
28641
29549
|
}
|
|
29550
|
+
visitComponent(component, context) {
|
|
29551
|
+
}
|
|
29552
|
+
visitDirective(directive, context) {
|
|
29553
|
+
}
|
|
28642
29554
|
_addError(node, message) {
|
|
28643
29555
|
this._errors.push(new I18nError(node.sourceSpan, message));
|
|
28644
29556
|
}
|
|
@@ -28699,6 +29611,12 @@ var XmlToI18n$2 = class XmlToI18n {
|
|
|
28699
29611
|
}
|
|
28700
29612
|
visitLetDeclaration(decl, context) {
|
|
28701
29613
|
}
|
|
29614
|
+
visitComponent(component, context) {
|
|
29615
|
+
this._addError(component, "Unexpected node");
|
|
29616
|
+
}
|
|
29617
|
+
visitDirective(directive, context) {
|
|
29618
|
+
this._addError(directive, "Unexpected node");
|
|
29619
|
+
}
|
|
28702
29620
|
_addError(node, message) {
|
|
28703
29621
|
this._errors.push(new I18nError(node.sourceSpan, message));
|
|
28704
29622
|
}
|
|
@@ -28963,6 +29881,10 @@ var Xliff2Parser = class {
|
|
|
28963
29881
|
}
|
|
28964
29882
|
visitLetDeclaration(decl, context) {
|
|
28965
29883
|
}
|
|
29884
|
+
visitComponent(component, context) {
|
|
29885
|
+
}
|
|
29886
|
+
visitDirective(directive, context) {
|
|
29887
|
+
}
|
|
28966
29888
|
_addError(node, message) {
|
|
28967
29889
|
this._errors.push(new I18nError(node.sourceSpan, message));
|
|
28968
29890
|
}
|
|
@@ -29038,6 +29960,12 @@ var XmlToI18n$1 = class XmlToI18n2 {
|
|
|
29038
29960
|
}
|
|
29039
29961
|
visitLetDeclaration(decl, context) {
|
|
29040
29962
|
}
|
|
29963
|
+
visitComponent(component, context) {
|
|
29964
|
+
this._addError(component, "Unexpected node");
|
|
29965
|
+
}
|
|
29966
|
+
visitDirective(directive, context) {
|
|
29967
|
+
this._addError(directive, "Unexpected node");
|
|
29968
|
+
}
|
|
29041
29969
|
_addError(node, message) {
|
|
29042
29970
|
this._errors.push(new I18nError(node.sourceSpan, message));
|
|
29043
29971
|
}
|
|
@@ -29184,6 +30112,12 @@ var XtbParser = class {
|
|
|
29184
30112
|
}
|
|
29185
30113
|
visitLetDeclaration(decl, context) {
|
|
29186
30114
|
}
|
|
30115
|
+
visitComponent(component, context) {
|
|
30116
|
+
this._addError(component, "Unexpected node");
|
|
30117
|
+
}
|
|
30118
|
+
visitDirective(directive, context) {
|
|
30119
|
+
this._addError(directive, "Unexpected node");
|
|
30120
|
+
}
|
|
29187
30121
|
_addError(node, message) {
|
|
29188
30122
|
this._errors.push(new I18nError(node.sourceSpan, message));
|
|
29189
30123
|
}
|
|
@@ -29241,6 +30175,12 @@ var XmlToI18n3 = class {
|
|
|
29241
30175
|
}
|
|
29242
30176
|
visitLetDeclaration(decl, context) {
|
|
29243
30177
|
}
|
|
30178
|
+
visitComponent(component, context) {
|
|
30179
|
+
this._addError(component, "Unexpected node");
|
|
30180
|
+
}
|
|
30181
|
+
visitDirective(directive, context) {
|
|
30182
|
+
this._addError(directive, "Unexpected node");
|
|
30183
|
+
}
|
|
29244
30184
|
_addError(node, message) {
|
|
29245
30185
|
this._errors.push(new I18nError(node.sourceSpan, message));
|
|
29246
30186
|
}
|
|
@@ -29578,96 +30518,12 @@ function compileComponentMetadataAsyncResolver(dependencies) {
|
|
|
29578
30518
|
return arrowFn([], literalArr(dynamicImports));
|
|
29579
30519
|
}
|
|
29580
30520
|
__name(compileComponentMetadataAsyncResolver, "compileComponentMetadataAsyncResolver");
|
|
29581
|
-
function compileClassDebugInfo(debugInfo) {
|
|
29582
|
-
const debugInfoObject = {
|
|
29583
|
-
className: debugInfo.className
|
|
29584
|
-
};
|
|
29585
|
-
if (debugInfo.filePath) {
|
|
29586
|
-
debugInfoObject.filePath = debugInfo.filePath;
|
|
29587
|
-
debugInfoObject.lineNumber = debugInfo.lineNumber;
|
|
29588
|
-
}
|
|
29589
|
-
if (debugInfo.forbidOrphanRendering) {
|
|
29590
|
-
debugInfoObject.forbidOrphanRendering = literal(true);
|
|
29591
|
-
}
|
|
29592
|
-
const fnCall = importExpr(Identifiers.setClassDebugInfo).callFn([debugInfo.type, mapLiteral(debugInfoObject)]);
|
|
29593
|
-
const iife = arrowFn([], [devOnlyGuardedExpression(fnCall).toStmt()]);
|
|
29594
|
-
return iife.callFn([]);
|
|
29595
|
-
}
|
|
29596
|
-
__name(compileClassDebugInfo, "compileClassDebugInfo");
|
|
29597
|
-
function compileHmrInitializer(meta) {
|
|
29598
|
-
const moduleName = "m";
|
|
29599
|
-
const dataName = "d";
|
|
29600
|
-
const timestampName = "t";
|
|
29601
|
-
const idName = "id";
|
|
29602
|
-
const importCallbackName = `${meta.className}_HmrLoad`;
|
|
29603
|
-
const namespaces = meta.namespaceDependencies.map((dep) => {
|
|
29604
|
-
return new ExternalExpr({ moduleName: dep.moduleName, name: null });
|
|
29605
|
-
});
|
|
29606
|
-
const defaultRead = variable(moduleName).prop("default");
|
|
29607
|
-
const replaceCall = importExpr(Identifiers.replaceMetadata).callFn([
|
|
29608
|
-
meta.type,
|
|
29609
|
-
defaultRead,
|
|
29610
|
-
literalArr(namespaces),
|
|
29611
|
-
literalArr(meta.localDependencies.map((l) => l.runtimeRepresentation)),
|
|
29612
|
-
variable("import").prop("meta"),
|
|
29613
|
-
variable(idName)
|
|
29614
|
-
]);
|
|
29615
|
-
const replaceCallback = arrowFn([new FnParam(moduleName)], defaultRead.and(replaceCall));
|
|
29616
|
-
const url = importExpr(Identifiers.getReplaceMetadataURL).callFn([
|
|
29617
|
-
variable(idName),
|
|
29618
|
-
variable(timestampName),
|
|
29619
|
-
variable("import").prop("meta").prop("url")
|
|
29620
|
-
]);
|
|
29621
|
-
const importCallback = new DeclareFunctionStmt(importCallbackName, [new FnParam(timestampName)], [
|
|
29622
|
-
// The vite-ignore special comment is required to prevent Vite from generating a superfluous
|
|
29623
|
-
// warning for each usage within the development code. If Vite provides a method to
|
|
29624
|
-
// programmatically avoid this warning in the future, this added comment can be removed here.
|
|
29625
|
-
new DynamicImportExpr(url, null, "@vite-ignore").prop("then").callFn([replaceCallback]).toStmt()
|
|
29626
|
-
], null, StmtModifier.Final);
|
|
29627
|
-
const updateCallback = arrowFn([new FnParam(dataName)], variable(dataName).prop("id").identical(variable(idName)).and(variable(importCallbackName).callFn([variable(dataName).prop("timestamp")])));
|
|
29628
|
-
const initialCall = variable(importCallbackName).callFn([variable("Date").prop("now").callFn([])]);
|
|
29629
|
-
const hotRead = variable("import").prop("meta").prop("hot");
|
|
29630
|
-
const hotListener = hotRead.clone().prop("on").callFn([literal("angular:component-update"), updateCallback]);
|
|
29631
|
-
return arrowFn([], [
|
|
29632
|
-
// const id = <id>;
|
|
29633
|
-
new DeclareVarStmt(idName, literal(encodeURIComponent(`${meta.filePath}@${meta.className}`)), null, StmtModifier.Final),
|
|
29634
|
-
// function Cmp_HmrLoad() {...}.
|
|
29635
|
-
importCallback,
|
|
29636
|
-
// ngDevMode && Cmp_HmrLoad(Date.now());
|
|
29637
|
-
devOnlyGuardedExpression(initialCall).toStmt(),
|
|
29638
|
-
// ngDevMode && import.meta.hot && import.meta.hot.on(...)
|
|
29639
|
-
devOnlyGuardedExpression(hotRead.and(hotListener)).toStmt()
|
|
29640
|
-
]).callFn([]);
|
|
29641
|
-
}
|
|
29642
|
-
__name(compileHmrInitializer, "compileHmrInitializer");
|
|
29643
|
-
function compileHmrUpdateCallback(definitions, constantStatements, meta) {
|
|
29644
|
-
const namespaces = "\u0275\u0275namespaces";
|
|
29645
|
-
const params = [meta.className, namespaces].map((name) => new FnParam(name, DYNAMIC_TYPE));
|
|
29646
|
-
const body = [];
|
|
29647
|
-
for (const local of meta.localDependencies) {
|
|
29648
|
-
params.push(new FnParam(local.name));
|
|
29649
|
-
}
|
|
29650
|
-
for (let i = 0; i < meta.namespaceDependencies.length; i++) {
|
|
29651
|
-
body.push(new DeclareVarStmt(meta.namespaceDependencies[i].assignedName, variable(namespaces).key(literal(i)), DYNAMIC_TYPE, StmtModifier.Final));
|
|
29652
|
-
}
|
|
29653
|
-
body.push(...constantStatements);
|
|
29654
|
-
for (const field of definitions) {
|
|
29655
|
-
if (field.initializer !== null) {
|
|
29656
|
-
body.push(variable(meta.className).prop(field.name).set(field.initializer).toStmt());
|
|
29657
|
-
for (const stmt of field.statements) {
|
|
29658
|
-
body.push(stmt);
|
|
29659
|
-
}
|
|
29660
|
-
}
|
|
29661
|
-
}
|
|
29662
|
-
return new DeclareFunctionStmt(`${meta.className}_UpdateMetadata`, params, body, null, StmtModifier.Final);
|
|
29663
|
-
}
|
|
29664
|
-
__name(compileHmrUpdateCallback, "compileHmrUpdateCallback");
|
|
29665
30521
|
var MINIMUM_PARTIAL_LINKER_VERSION$5 = "12.0.0";
|
|
29666
30522
|
var MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION = "18.0.0";
|
|
29667
30523
|
function compileDeclareClassMetadata(metadata) {
|
|
29668
30524
|
const definitionMap = new DefinitionMap();
|
|
29669
30525
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
|
|
29670
|
-
definitionMap.set("version", literal("
|
|
30526
|
+
definitionMap.set("version", literal("20.0.0"));
|
|
29671
30527
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
29672
30528
|
definitionMap.set("type", metadata.type);
|
|
29673
30529
|
definitionMap.set("decorators", metadata.decorators);
|
|
@@ -29686,7 +30542,7 @@ function compileComponentDeclareClassMetadata(metadata, dependencies) {
|
|
|
29686
30542
|
callbackReturnDefinitionMap.set("ctorParameters", metadata.ctorParameters ?? literal(null));
|
|
29687
30543
|
callbackReturnDefinitionMap.set("propDecorators", metadata.propDecorators ?? literal(null));
|
|
29688
30544
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION));
|
|
29689
|
-
definitionMap.set("version", literal("
|
|
30545
|
+
definitionMap.set("version", literal("20.0.0"));
|
|
29690
30546
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
29691
30547
|
definitionMap.set("type", metadata.type);
|
|
29692
30548
|
definitionMap.set("resolveDeferredDeps", compileComponentMetadataAsyncResolver(dependencies));
|
|
@@ -29755,7 +30611,7 @@ function createDirectiveDefinitionMap(meta) {
|
|
|
29755
30611
|
const definitionMap = new DefinitionMap();
|
|
29756
30612
|
const minVersion = getMinimumVersionForPartialOutput(meta);
|
|
29757
30613
|
definitionMap.set("minVersion", literal(minVersion));
|
|
29758
|
-
definitionMap.set("version", literal("
|
|
30614
|
+
definitionMap.set("version", literal("20.0.0"));
|
|
29759
30615
|
definitionMap.set("type", meta.type.value);
|
|
29760
30616
|
if (meta.isStandalone !== void 0) {
|
|
29761
30617
|
definitionMap.set("isStandalone", literal(meta.isStandalone));
|
|
@@ -30082,7 +30938,7 @@ var MINIMUM_PARTIAL_LINKER_VERSION$4 = "12.0.0";
|
|
|
30082
30938
|
function compileDeclareFactoryFunction(meta) {
|
|
30083
30939
|
const definitionMap = new DefinitionMap();
|
|
30084
30940
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
|
|
30085
|
-
definitionMap.set("version", literal("
|
|
30941
|
+
definitionMap.set("version", literal("20.0.0"));
|
|
30086
30942
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
30087
30943
|
definitionMap.set("type", meta.type.value);
|
|
30088
30944
|
definitionMap.set("deps", compileDependencies(meta.deps));
|
|
@@ -30105,7 +30961,7 @@ __name(compileDeclareInjectableFromMetadata, "compileDeclareInjectableFromMetada
|
|
|
30105
30961
|
function createInjectableDefinitionMap(meta) {
|
|
30106
30962
|
const definitionMap = new DefinitionMap();
|
|
30107
30963
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
|
|
30108
|
-
definitionMap.set("version", literal("
|
|
30964
|
+
definitionMap.set("version", literal("20.0.0"));
|
|
30109
30965
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
30110
30966
|
definitionMap.set("type", meta.type.value);
|
|
30111
30967
|
if (meta.providedIn !== void 0) {
|
|
@@ -30143,7 +30999,7 @@ __name(compileDeclareInjectorFromMetadata, "compileDeclareInjectorFromMetadata")
|
|
|
30143
30999
|
function createInjectorDefinitionMap(meta) {
|
|
30144
31000
|
const definitionMap = new DefinitionMap();
|
|
30145
31001
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
|
|
30146
|
-
definitionMap.set("version", literal("
|
|
31002
|
+
definitionMap.set("version", literal("20.0.0"));
|
|
30147
31003
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
30148
31004
|
definitionMap.set("type", meta.type.value);
|
|
30149
31005
|
definitionMap.set("providers", meta.providers);
|
|
@@ -30167,7 +31023,7 @@ function createNgModuleDefinitionMap(meta) {
|
|
|
30167
31023
|
throw new Error("Invalid path! Local compilation mode should not get into the partial compilation path");
|
|
30168
31024
|
}
|
|
30169
31025
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
|
|
30170
|
-
definitionMap.set("version", literal("
|
|
31026
|
+
definitionMap.set("version", literal("20.0.0"));
|
|
30171
31027
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
30172
31028
|
definitionMap.set("type", meta.type.value);
|
|
30173
31029
|
if (meta.bootstrap.length > 0) {
|
|
@@ -30202,7 +31058,7 @@ __name(compileDeclarePipeFromMetadata, "compileDeclarePipeFromMetadata");
|
|
|
30202
31058
|
function createPipeDefinitionMap(meta) {
|
|
30203
31059
|
const definitionMap = new DefinitionMap();
|
|
30204
31060
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION));
|
|
30205
|
-
definitionMap.set("version", literal("
|
|
31061
|
+
definitionMap.set("version", literal("20.0.0"));
|
|
30206
31062
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
30207
31063
|
definitionMap.set("type", meta.type.value);
|
|
30208
31064
|
if (meta.isStandalone !== void 0) {
|
|
@@ -30215,6 +31071,91 @@ function createPipeDefinitionMap(meta) {
|
|
|
30215
31071
|
return definitionMap;
|
|
30216
31072
|
}
|
|
30217
31073
|
__name(createPipeDefinitionMap, "createPipeDefinitionMap");
|
|
31074
|
+
function compileClassDebugInfo(debugInfo) {
|
|
31075
|
+
const debugInfoObject = {
|
|
31076
|
+
className: debugInfo.className
|
|
31077
|
+
};
|
|
31078
|
+
if (debugInfo.filePath) {
|
|
31079
|
+
debugInfoObject.filePath = debugInfo.filePath;
|
|
31080
|
+
debugInfoObject.lineNumber = debugInfo.lineNumber;
|
|
31081
|
+
}
|
|
31082
|
+
if (debugInfo.forbidOrphanRendering) {
|
|
31083
|
+
debugInfoObject.forbidOrphanRendering = literal(true);
|
|
31084
|
+
}
|
|
31085
|
+
const fnCall = importExpr(Identifiers.setClassDebugInfo).callFn([debugInfo.type, mapLiteral(debugInfoObject)]);
|
|
31086
|
+
const iife = arrowFn([], [devOnlyGuardedExpression(fnCall).toStmt()]);
|
|
31087
|
+
return iife.callFn([]);
|
|
31088
|
+
}
|
|
31089
|
+
__name(compileClassDebugInfo, "compileClassDebugInfo");
|
|
31090
|
+
function compileHmrInitializer(meta) {
|
|
31091
|
+
const moduleName = "m";
|
|
31092
|
+
const dataName = "d";
|
|
31093
|
+
const timestampName = "t";
|
|
31094
|
+
const idName = "id";
|
|
31095
|
+
const importCallbackName = `${meta.className}_HmrLoad`;
|
|
31096
|
+
const namespaces = meta.namespaceDependencies.map((dep) => {
|
|
31097
|
+
return new ExternalExpr({ moduleName: dep.moduleName, name: null });
|
|
31098
|
+
});
|
|
31099
|
+
const defaultRead = variable(moduleName).prop("default");
|
|
31100
|
+
const replaceCall = importExpr(Identifiers.replaceMetadata).callFn([
|
|
31101
|
+
meta.type,
|
|
31102
|
+
defaultRead,
|
|
31103
|
+
literalArr(namespaces),
|
|
31104
|
+
literalArr(meta.localDependencies.map((l) => l.runtimeRepresentation)),
|
|
31105
|
+
variable("import").prop("meta"),
|
|
31106
|
+
variable(idName)
|
|
31107
|
+
]);
|
|
31108
|
+
const replaceCallback = arrowFn([new FnParam(moduleName)], defaultRead.and(replaceCall));
|
|
31109
|
+
const url = importExpr(Identifiers.getReplaceMetadataURL).callFn([
|
|
31110
|
+
variable(idName),
|
|
31111
|
+
variable(timestampName),
|
|
31112
|
+
variable("import").prop("meta").prop("url")
|
|
31113
|
+
]);
|
|
31114
|
+
const importCallback = new DeclareFunctionStmt(importCallbackName, [new FnParam(timestampName)], [
|
|
31115
|
+
// The vite-ignore special comment is required to prevent Vite from generating a superfluous
|
|
31116
|
+
// warning for each usage within the development code. If Vite provides a method to
|
|
31117
|
+
// programmatically avoid this warning in the future, this added comment can be removed here.
|
|
31118
|
+
new DynamicImportExpr(url, null, "@vite-ignore").prop("then").callFn([replaceCallback]).toStmt()
|
|
31119
|
+
], null, StmtModifier.Final);
|
|
31120
|
+
const updateCallback = arrowFn([new FnParam(dataName)], variable(dataName).prop("id").identical(variable(idName)).and(variable(importCallbackName).callFn([variable(dataName).prop("timestamp")])));
|
|
31121
|
+
const initialCall = variable(importCallbackName).callFn([variable("Date").prop("now").callFn([])]);
|
|
31122
|
+
const hotRead = variable("import").prop("meta").prop("hot");
|
|
31123
|
+
const hotListener = hotRead.clone().prop("on").callFn([literal("angular:component-update"), updateCallback]);
|
|
31124
|
+
return arrowFn([], [
|
|
31125
|
+
// const id = <id>;
|
|
31126
|
+
new DeclareVarStmt(idName, literal(encodeURIComponent(`${meta.filePath}@${meta.className}`)), null, StmtModifier.Final),
|
|
31127
|
+
// function Cmp_HmrLoad() {...}.
|
|
31128
|
+
importCallback,
|
|
31129
|
+
// ngDevMode && Cmp_HmrLoad(Date.now());
|
|
31130
|
+
devOnlyGuardedExpression(initialCall).toStmt(),
|
|
31131
|
+
// ngDevMode && import.meta.hot && import.meta.hot.on(...)
|
|
31132
|
+
devOnlyGuardedExpression(hotRead.and(hotListener)).toStmt()
|
|
31133
|
+
]).callFn([]);
|
|
31134
|
+
}
|
|
31135
|
+
__name(compileHmrInitializer, "compileHmrInitializer");
|
|
31136
|
+
function compileHmrUpdateCallback(definitions, constantStatements, meta) {
|
|
31137
|
+
const namespaces = "\u0275\u0275namespaces";
|
|
31138
|
+
const params = [meta.className, namespaces].map((name) => new FnParam(name, DYNAMIC_TYPE));
|
|
31139
|
+
const body = [];
|
|
31140
|
+
for (const local of meta.localDependencies) {
|
|
31141
|
+
params.push(new FnParam(local.name));
|
|
31142
|
+
}
|
|
31143
|
+
for (let i = 0; i < meta.namespaceDependencies.length; i++) {
|
|
31144
|
+
body.push(new DeclareVarStmt(meta.namespaceDependencies[i].assignedName, variable(namespaces).key(literal(i)), DYNAMIC_TYPE, StmtModifier.Final));
|
|
31145
|
+
}
|
|
31146
|
+
body.push(...constantStatements);
|
|
31147
|
+
for (const field of definitions) {
|
|
31148
|
+
if (field.initializer !== null) {
|
|
31149
|
+
body.push(variable(meta.className).prop(field.name).set(field.initializer).toStmt());
|
|
31150
|
+
for (const stmt of field.statements) {
|
|
31151
|
+
body.push(stmt);
|
|
31152
|
+
}
|
|
31153
|
+
}
|
|
31154
|
+
}
|
|
31155
|
+
return new DeclareFunctionStmt(`${meta.className}_UpdateMetadata`, params, body, null, StmtModifier.Final);
|
|
31156
|
+
}
|
|
31157
|
+
__name(compileHmrUpdateCallback, "compileHmrUpdateCallback");
|
|
31158
|
+
var VERSION = new Version("20.0.0");
|
|
30218
31159
|
publishFacade(_global);
|
|
30219
31160
|
// Annotate the CommonJS export names for ESM import in node:
|
|
30220
31161
|
0 && (module.exports = {
|
|
@@ -30243,6 +31184,7 @@ publishFacade(_global);
|
|
|
30243
31184
|
Comment,
|
|
30244
31185
|
CompilerConfig,
|
|
30245
31186
|
CompilerFacadeImpl,
|
|
31187
|
+
Component,
|
|
30246
31188
|
Conditional,
|
|
30247
31189
|
ConditionalExpr,
|
|
30248
31190
|
ConstantPool,
|
|
@@ -30251,6 +31193,7 @@ publishFacade(_global);
|
|
|
30251
31193
|
DYNAMIC_TYPE,
|
|
30252
31194
|
DeclareFunctionStmt,
|
|
30253
31195
|
DeclareVarStmt,
|
|
31196
|
+
Directive,
|
|
30254
31197
|
DomElementSchemaRegistry,
|
|
30255
31198
|
DynamicImportExpr,
|
|
30256
31199
|
EOF,
|
|
@@ -30298,6 +31241,8 @@ publishFacade(_global);
|
|
|
30298
31241
|
NodeWithI18n,
|
|
30299
31242
|
NonNullAssert,
|
|
30300
31243
|
NotExpr,
|
|
31244
|
+
ParenthesizedExpr,
|
|
31245
|
+
ParenthesizedExpression,
|
|
30301
31246
|
ParseError,
|
|
30302
31247
|
ParseErrorLevel,
|
|
30303
31248
|
ParseLocation,
|
|
@@ -30315,7 +31260,6 @@ publishFacade(_global);
|
|
|
30315
31260
|
PrefixNot,
|
|
30316
31261
|
PropertyRead,
|
|
30317
31262
|
PropertyWrite,
|
|
30318
|
-
R3BoundTarget,
|
|
30319
31263
|
R3Identifiers,
|
|
30320
31264
|
R3NgModuleMetadataKind,
|
|
30321
31265
|
R3SelectorScopeMode,
|
|
@@ -30336,6 +31280,7 @@ publishFacade(_global);
|
|
|
30336
31280
|
SelectorContext,
|
|
30337
31281
|
SelectorListContext,
|
|
30338
31282
|
SelectorMatcher,
|
|
31283
|
+
SelectorlessMatcher,
|
|
30339
31284
|
Serializer,
|
|
30340
31285
|
SplitInterpolation,
|
|
30341
31286
|
Statement,
|
|
@@ -30343,6 +31288,7 @@ publishFacade(_global);
|
|
|
30343
31288
|
StringToken,
|
|
30344
31289
|
StringTokenKind,
|
|
30345
31290
|
TagContentType,
|
|
31291
|
+
TaggedTemplateLiteral,
|
|
30346
31292
|
TaggedTemplateLiteralExpr,
|
|
30347
31293
|
TemplateBindingParseResult,
|
|
30348
31294
|
TemplateLiteral,
|
|
@@ -30356,15 +31302,18 @@ publishFacade(_global);
|
|
|
30356
31302
|
TmplAstBoundDeferredTrigger,
|
|
30357
31303
|
TmplAstBoundEvent,
|
|
30358
31304
|
TmplAstBoundText,
|
|
31305
|
+
TmplAstComponent,
|
|
30359
31306
|
TmplAstContent,
|
|
30360
31307
|
TmplAstDeferredBlock,
|
|
30361
31308
|
TmplAstDeferredBlockError,
|
|
30362
31309
|
TmplAstDeferredBlockLoading,
|
|
30363
31310
|
TmplAstDeferredBlockPlaceholder,
|
|
30364
31311
|
TmplAstDeferredTrigger,
|
|
31312
|
+
TmplAstDirective,
|
|
30365
31313
|
TmplAstElement,
|
|
30366
31314
|
TmplAstForLoopBlock,
|
|
30367
31315
|
TmplAstForLoopBlockEmpty,
|
|
31316
|
+
TmplAstHostElement,
|
|
30368
31317
|
TmplAstHoverDeferredTrigger,
|
|
30369
31318
|
TmplAstIcu,
|
|
30370
31319
|
TmplAstIdleDeferredTrigger,
|
|
@@ -30400,6 +31349,8 @@ publishFacade(_global);
|
|
|
30400
31349
|
VariableBinding,
|
|
30401
31350
|
Version,
|
|
30402
31351
|
ViewEncapsulation,
|
|
31352
|
+
VoidExpr,
|
|
31353
|
+
VoidExpression,
|
|
30403
31354
|
WrappedNodeExpr,
|
|
30404
31355
|
WriteKeyExpr,
|
|
30405
31356
|
WritePropExpr,
|
|
@@ -30462,7 +31413,6 @@ publishFacade(_global);
|
|
|
30462
31413
|
publishFacade,
|
|
30463
31414
|
r3JitTypeSourceSpan,
|
|
30464
31415
|
sanitizeIdentifier,
|
|
30465
|
-
setEnableTemplateSourceLocations,
|
|
30466
31416
|
splitNsName,
|
|
30467
31417
|
tmplAstVisitAll,
|
|
30468
31418
|
verifyHostBindings,
|
|
@@ -30472,7 +31422,7 @@ publishFacade(_global);
|
|
|
30472
31422
|
|
|
30473
31423
|
@angular/compiler/fesm2022/compiler.mjs:
|
|
30474
31424
|
(**
|
|
30475
|
-
* @license Angular
|
|
31425
|
+
* @license Angular v20.0.0
|
|
30476
31426
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
30477
31427
|
* License: MIT
|
|
30478
31428
|
*)
|