@angular-eslint/bundled-angular-compiler 19.6.1-alpha.0 → 20.0.0-alpha.0
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 +2018 -804
- 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-rc.2/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",
|
|
@@ -3044,6 +3087,46 @@ var Identifiers = class {
|
|
|
3044
3087
|
name: "\u0275\u0275stylePropInterpolateV",
|
|
3045
3088
|
moduleName: CORE
|
|
3046
3089
|
};
|
|
3090
|
+
static interpolate = {
|
|
3091
|
+
name: "\u0275\u0275interpolate",
|
|
3092
|
+
moduleName: CORE
|
|
3093
|
+
};
|
|
3094
|
+
static interpolate1 = {
|
|
3095
|
+
name: "\u0275\u0275interpolate1",
|
|
3096
|
+
moduleName: CORE
|
|
3097
|
+
};
|
|
3098
|
+
static interpolate2 = {
|
|
3099
|
+
name: "\u0275\u0275interpolate2",
|
|
3100
|
+
moduleName: CORE
|
|
3101
|
+
};
|
|
3102
|
+
static interpolate3 = {
|
|
3103
|
+
name: "\u0275\u0275interpolate3",
|
|
3104
|
+
moduleName: CORE
|
|
3105
|
+
};
|
|
3106
|
+
static interpolate4 = {
|
|
3107
|
+
name: "\u0275\u0275interpolate4",
|
|
3108
|
+
moduleName: CORE
|
|
3109
|
+
};
|
|
3110
|
+
static interpolate5 = {
|
|
3111
|
+
name: "\u0275\u0275interpolate5",
|
|
3112
|
+
moduleName: CORE
|
|
3113
|
+
};
|
|
3114
|
+
static interpolate6 = {
|
|
3115
|
+
name: "\u0275\u0275interpolate6",
|
|
3116
|
+
moduleName: CORE
|
|
3117
|
+
};
|
|
3118
|
+
static interpolate7 = {
|
|
3119
|
+
name: "\u0275\u0275interpolate7",
|
|
3120
|
+
moduleName: CORE
|
|
3121
|
+
};
|
|
3122
|
+
static interpolate8 = {
|
|
3123
|
+
name: "\u0275\u0275interpolate8",
|
|
3124
|
+
moduleName: CORE
|
|
3125
|
+
};
|
|
3126
|
+
static interpolateV = {
|
|
3127
|
+
name: "\u0275\u0275interpolateV",
|
|
3128
|
+
moduleName: CORE
|
|
3129
|
+
};
|
|
3047
3130
|
static nextContext = { name: "\u0275\u0275nextContext", moduleName: CORE };
|
|
3048
3131
|
static resetView = { name: "\u0275\u0275resetView", moduleName: CORE };
|
|
3049
3132
|
static templateCreate = { name: "\u0275\u0275template", moduleName: CORE };
|
|
@@ -3110,6 +3193,11 @@ var Identifiers = class {
|
|
|
3110
3193
|
name: "\u0275\u0275deferEnableTimerScheduling",
|
|
3111
3194
|
moduleName: CORE
|
|
3112
3195
|
};
|
|
3196
|
+
static conditionalCreate = { name: "\u0275\u0275conditionalCreate", moduleName: CORE };
|
|
3197
|
+
static conditionalBranchCreate = {
|
|
3198
|
+
name: "\u0275\u0275conditionalBranchCreate",
|
|
3199
|
+
moduleName: CORE
|
|
3200
|
+
};
|
|
3113
3201
|
static conditional = { name: "\u0275\u0275conditional", moduleName: CORE };
|
|
3114
3202
|
static repeater = { name: "\u0275\u0275repeater", moduleName: CORE };
|
|
3115
3203
|
static repeaterCreate = { name: "\u0275\u0275repeaterCreate", moduleName: CORE };
|
|
@@ -3152,7 +3240,7 @@ var Identifiers = class {
|
|
|
3152
3240
|
static pipeBind3 = { name: "\u0275\u0275pipeBind3", moduleName: CORE };
|
|
3153
3241
|
static pipeBind4 = { name: "\u0275\u0275pipeBind4", moduleName: CORE };
|
|
3154
3242
|
static pipeBindV = { name: "\u0275\u0275pipeBindV", moduleName: CORE };
|
|
3155
|
-
static
|
|
3243
|
+
static domProperty = { name: "\u0275\u0275domProperty", moduleName: CORE };
|
|
3156
3244
|
static property = { name: "\u0275\u0275property", moduleName: CORE };
|
|
3157
3245
|
static propertyInterpolate = {
|
|
3158
3246
|
name: "\u0275\u0275propertyInterpolate",
|
|
@@ -3761,6 +3849,7 @@ var AbstractEmitterVisitor = class {
|
|
|
3761
3849
|
__name(this, "AbstractEmitterVisitor");
|
|
3762
3850
|
}
|
|
3763
3851
|
_escapeDollarInStrings;
|
|
3852
|
+
lastIfCondition = null;
|
|
3764
3853
|
constructor(_escapeDollarInStrings) {
|
|
3765
3854
|
this._escapeDollarInStrings = _escapeDollarInStrings;
|
|
3766
3855
|
}
|
|
@@ -3798,7 +3887,9 @@ var AbstractEmitterVisitor = class {
|
|
|
3798
3887
|
visitIfStmt(stmt, ctx) {
|
|
3799
3888
|
this.printLeadingComments(stmt, ctx);
|
|
3800
3889
|
ctx.print(stmt, `if (`);
|
|
3890
|
+
this.lastIfCondition = stmt.condition;
|
|
3801
3891
|
stmt.condition.visitExpression(this, ctx);
|
|
3892
|
+
this.lastIfCondition = null;
|
|
3802
3893
|
ctx.print(stmt, `) {`);
|
|
3803
3894
|
const hasElseCase = stmt.falseCase != null && stmt.falseCase.length > 0;
|
|
3804
3895
|
if (stmt.trueCase.length <= 1 && !hasElseCase) {
|
|
@@ -3903,6 +3994,10 @@ var AbstractEmitterVisitor = class {
|
|
|
3903
3994
|
ctx.print(expr, "typeof ");
|
|
3904
3995
|
expr.expr.visitExpression(this, ctx);
|
|
3905
3996
|
}
|
|
3997
|
+
visitVoidExpr(expr, ctx) {
|
|
3998
|
+
ctx.print(expr, "void ");
|
|
3999
|
+
expr.expr.visitExpression(this, ctx);
|
|
4000
|
+
}
|
|
3906
4001
|
visitReadVarExpr(ast, ctx) {
|
|
3907
4002
|
ctx.print(ast, ast.name);
|
|
3908
4003
|
return null;
|
|
@@ -3965,11 +4060,12 @@ var AbstractEmitterVisitor = class {
|
|
|
3965
4060
|
default:
|
|
3966
4061
|
throw new Error(`Unknown operator ${ast.operator}`);
|
|
3967
4062
|
}
|
|
3968
|
-
|
|
4063
|
+
const parens = ast !== this.lastIfCondition;
|
|
4064
|
+
if (parens)
|
|
3969
4065
|
ctx.print(ast, `(`);
|
|
3970
4066
|
ctx.print(ast, opStr);
|
|
3971
4067
|
ast.expr.visitExpression(this, ctx);
|
|
3972
|
-
if (
|
|
4068
|
+
if (parens)
|
|
3973
4069
|
ctx.print(ast, `)`);
|
|
3974
4070
|
return null;
|
|
3975
4071
|
}
|
|
@@ -4015,6 +4111,9 @@ var AbstractEmitterVisitor = class {
|
|
|
4015
4111
|
case BinaryOperator.Modulo:
|
|
4016
4112
|
opStr = "%";
|
|
4017
4113
|
break;
|
|
4114
|
+
case BinaryOperator.Exponentiation:
|
|
4115
|
+
opStr = "**";
|
|
4116
|
+
break;
|
|
4018
4117
|
case BinaryOperator.Lower:
|
|
4019
4118
|
opStr = "<";
|
|
4020
4119
|
break;
|
|
@@ -4030,15 +4129,19 @@ var AbstractEmitterVisitor = class {
|
|
|
4030
4129
|
case BinaryOperator.NullishCoalesce:
|
|
4031
4130
|
opStr = "??";
|
|
4032
4131
|
break;
|
|
4132
|
+
case BinaryOperator.In:
|
|
4133
|
+
opStr = "in";
|
|
4134
|
+
break;
|
|
4033
4135
|
default:
|
|
4034
4136
|
throw new Error(`Unknown operator ${ast.operator}`);
|
|
4035
4137
|
}
|
|
4036
|
-
|
|
4138
|
+
const parens = ast !== this.lastIfCondition;
|
|
4139
|
+
if (parens)
|
|
4037
4140
|
ctx.print(ast, `(`);
|
|
4038
4141
|
ast.lhs.visitExpression(this, ctx);
|
|
4039
4142
|
ctx.print(ast, ` ${opStr} `);
|
|
4040
4143
|
ast.rhs.visitExpression(this, ctx);
|
|
4041
|
-
if (
|
|
4144
|
+
if (parens)
|
|
4042
4145
|
ctx.print(ast, `)`);
|
|
4043
4146
|
return null;
|
|
4044
4147
|
}
|
|
@@ -4076,6 +4179,9 @@ var AbstractEmitterVisitor = class {
|
|
|
4076
4179
|
ctx.print(ast, ")");
|
|
4077
4180
|
return null;
|
|
4078
4181
|
}
|
|
4182
|
+
visitParenthesizedExpr(ast, ctx) {
|
|
4183
|
+
ast.expr.visitExpression(this, ctx);
|
|
4184
|
+
}
|
|
4079
4185
|
visitAllExpressions(expressions, ctx, separator) {
|
|
4080
4186
|
this.visitAllObjects((expr) => expr.visitExpression(this, ctx), expressions, ctx, separator);
|
|
4081
4187
|
}
|
|
@@ -4166,8 +4272,7 @@ function guardedExpression(guard, expr) {
|
|
|
4166
4272
|
/* type */
|
|
4167
4273
|
void 0,
|
|
4168
4274
|
/* sourceSpan */
|
|
4169
|
-
void 0
|
|
4170
|
-
true
|
|
4275
|
+
void 0
|
|
4171
4276
|
);
|
|
4172
4277
|
return new BinaryOperatorExpr(BinaryOperator.And, guardUndefinedOrTrue, expr);
|
|
4173
4278
|
}
|
|
@@ -4706,6 +4811,19 @@ var TypeofExpression = class extends AST {
|
|
|
4706
4811
|
return visitor.visitTypeofExpression(this, context);
|
|
4707
4812
|
}
|
|
4708
4813
|
};
|
|
4814
|
+
var VoidExpression = class extends AST {
|
|
4815
|
+
static {
|
|
4816
|
+
__name(this, "VoidExpression");
|
|
4817
|
+
}
|
|
4818
|
+
expression;
|
|
4819
|
+
constructor(span, sourceSpan, expression) {
|
|
4820
|
+
super(span, sourceSpan);
|
|
4821
|
+
this.expression = expression;
|
|
4822
|
+
}
|
|
4823
|
+
visit(visitor, context = null) {
|
|
4824
|
+
return visitor.visitVoidExpression(this, context);
|
|
4825
|
+
}
|
|
4826
|
+
};
|
|
4709
4827
|
var NonNullAssert = class extends AST {
|
|
4710
4828
|
static {
|
|
4711
4829
|
__name(this, "NonNullAssert");
|
|
@@ -4753,6 +4871,21 @@ var SafeCall = class extends AST {
|
|
|
4753
4871
|
return visitor.visitSafeCall(this, context);
|
|
4754
4872
|
}
|
|
4755
4873
|
};
|
|
4874
|
+
var TaggedTemplateLiteral = class extends AST {
|
|
4875
|
+
static {
|
|
4876
|
+
__name(this, "TaggedTemplateLiteral");
|
|
4877
|
+
}
|
|
4878
|
+
tag;
|
|
4879
|
+
template;
|
|
4880
|
+
constructor(span, sourceSpan, tag, template2) {
|
|
4881
|
+
super(span, sourceSpan);
|
|
4882
|
+
this.tag = tag;
|
|
4883
|
+
this.template = template2;
|
|
4884
|
+
}
|
|
4885
|
+
visit(visitor, context) {
|
|
4886
|
+
return visitor.visitTaggedTemplateLiteral(this, context);
|
|
4887
|
+
}
|
|
4888
|
+
};
|
|
4756
4889
|
var TemplateLiteral = class extends AST {
|
|
4757
4890
|
static {
|
|
4758
4891
|
__name(this, "TemplateLiteral");
|
|
@@ -4781,6 +4914,19 @@ var TemplateLiteralElement = class extends AST {
|
|
|
4781
4914
|
return visitor.visitTemplateLiteralElement(this, context);
|
|
4782
4915
|
}
|
|
4783
4916
|
};
|
|
4917
|
+
var ParenthesizedExpression = class extends AST {
|
|
4918
|
+
static {
|
|
4919
|
+
__name(this, "ParenthesizedExpression");
|
|
4920
|
+
}
|
|
4921
|
+
expression;
|
|
4922
|
+
constructor(span, sourceSpan, expression) {
|
|
4923
|
+
super(span, sourceSpan);
|
|
4924
|
+
this.expression = expression;
|
|
4925
|
+
}
|
|
4926
|
+
visit(visitor, context) {
|
|
4927
|
+
return visitor.visitParenthesizedExpression(this, context);
|
|
4928
|
+
}
|
|
4929
|
+
};
|
|
4784
4930
|
var AbsoluteSourceSpan = class {
|
|
4785
4931
|
static {
|
|
4786
4932
|
__name(this, "AbsoluteSourceSpan");
|
|
@@ -4914,6 +5060,9 @@ var RecursiveAstVisitor2 = class {
|
|
|
4914
5060
|
visitTypeofExpression(ast, context) {
|
|
4915
5061
|
this.visit(ast.expression, context);
|
|
4916
5062
|
}
|
|
5063
|
+
visitVoidExpression(ast, context) {
|
|
5064
|
+
this.visit(ast.expression, context);
|
|
5065
|
+
}
|
|
4917
5066
|
visitNonNullAssert(ast, context) {
|
|
4918
5067
|
this.visit(ast.expression, context);
|
|
4919
5068
|
}
|
|
@@ -4950,6 +5099,13 @@ var RecursiveAstVisitor2 = class {
|
|
|
4950
5099
|
}
|
|
4951
5100
|
visitTemplateLiteralElement(ast, context) {
|
|
4952
5101
|
}
|
|
5102
|
+
visitTaggedTemplateLiteral(ast, context) {
|
|
5103
|
+
this.visit(ast.tag, context);
|
|
5104
|
+
this.visit(ast.template, context);
|
|
5105
|
+
}
|
|
5106
|
+
visitParenthesizedExpression(ast, context) {
|
|
5107
|
+
this.visit(ast.expression, context);
|
|
5108
|
+
}
|
|
4953
5109
|
// This is not part of the AstVisitor interface, just a helper method
|
|
4954
5110
|
visitAll(asts, context) {
|
|
4955
5111
|
for (const ast of asts) {
|
|
@@ -5246,17 +5402,19 @@ var Element$1 = class Element {
|
|
|
5246
5402
|
attributes;
|
|
5247
5403
|
inputs;
|
|
5248
5404
|
outputs;
|
|
5405
|
+
directives;
|
|
5249
5406
|
children;
|
|
5250
5407
|
references;
|
|
5251
5408
|
sourceSpan;
|
|
5252
5409
|
startSourceSpan;
|
|
5253
5410
|
endSourceSpan;
|
|
5254
5411
|
i18n;
|
|
5255
|
-
constructor(name, attributes, inputs, outputs, children, references, sourceSpan, startSourceSpan, endSourceSpan, i18n2) {
|
|
5412
|
+
constructor(name, attributes, inputs, outputs, directives, children, references, sourceSpan, startSourceSpan, endSourceSpan, i18n2) {
|
|
5256
5413
|
this.name = name;
|
|
5257
5414
|
this.attributes = attributes;
|
|
5258
5415
|
this.inputs = inputs;
|
|
5259
5416
|
this.outputs = outputs;
|
|
5417
|
+
this.directives = directives;
|
|
5260
5418
|
this.children = children;
|
|
5261
5419
|
this.references = references;
|
|
5262
5420
|
this.sourceSpan = sourceSpan;
|
|
@@ -5618,6 +5776,70 @@ var LetDeclaration$1 = class LetDeclaration {
|
|
|
5618
5776
|
return visitor.visitLetDeclaration(this);
|
|
5619
5777
|
}
|
|
5620
5778
|
};
|
|
5779
|
+
var Component$1 = class Component {
|
|
5780
|
+
static {
|
|
5781
|
+
__name(this, "Component");
|
|
5782
|
+
}
|
|
5783
|
+
componentName;
|
|
5784
|
+
tagName;
|
|
5785
|
+
fullName;
|
|
5786
|
+
attributes;
|
|
5787
|
+
inputs;
|
|
5788
|
+
outputs;
|
|
5789
|
+
directives;
|
|
5790
|
+
children;
|
|
5791
|
+
references;
|
|
5792
|
+
sourceSpan;
|
|
5793
|
+
startSourceSpan;
|
|
5794
|
+
endSourceSpan;
|
|
5795
|
+
i18n;
|
|
5796
|
+
constructor(componentName, tagName, fullName, attributes, inputs, outputs, directives, children, references, sourceSpan, startSourceSpan, endSourceSpan, i18n2) {
|
|
5797
|
+
this.componentName = componentName;
|
|
5798
|
+
this.tagName = tagName;
|
|
5799
|
+
this.fullName = fullName;
|
|
5800
|
+
this.attributes = attributes;
|
|
5801
|
+
this.inputs = inputs;
|
|
5802
|
+
this.outputs = outputs;
|
|
5803
|
+
this.directives = directives;
|
|
5804
|
+
this.children = children;
|
|
5805
|
+
this.references = references;
|
|
5806
|
+
this.sourceSpan = sourceSpan;
|
|
5807
|
+
this.startSourceSpan = startSourceSpan;
|
|
5808
|
+
this.endSourceSpan = endSourceSpan;
|
|
5809
|
+
this.i18n = i18n2;
|
|
5810
|
+
}
|
|
5811
|
+
visit(visitor) {
|
|
5812
|
+
return visitor.visitComponent(this);
|
|
5813
|
+
}
|
|
5814
|
+
};
|
|
5815
|
+
var Directive$1 = class Directive {
|
|
5816
|
+
static {
|
|
5817
|
+
__name(this, "Directive");
|
|
5818
|
+
}
|
|
5819
|
+
name;
|
|
5820
|
+
attributes;
|
|
5821
|
+
inputs;
|
|
5822
|
+
outputs;
|
|
5823
|
+
references;
|
|
5824
|
+
sourceSpan;
|
|
5825
|
+
startSourceSpan;
|
|
5826
|
+
endSourceSpan;
|
|
5827
|
+
i18n;
|
|
5828
|
+
constructor(name, attributes, inputs, outputs, references, sourceSpan, startSourceSpan, endSourceSpan, i18n2) {
|
|
5829
|
+
this.name = name;
|
|
5830
|
+
this.attributes = attributes;
|
|
5831
|
+
this.inputs = inputs;
|
|
5832
|
+
this.outputs = outputs;
|
|
5833
|
+
this.references = references;
|
|
5834
|
+
this.sourceSpan = sourceSpan;
|
|
5835
|
+
this.startSourceSpan = startSourceSpan;
|
|
5836
|
+
this.endSourceSpan = endSourceSpan;
|
|
5837
|
+
this.i18n = i18n2;
|
|
5838
|
+
}
|
|
5839
|
+
visit(visitor) {
|
|
5840
|
+
return visitor.visitDirective(this);
|
|
5841
|
+
}
|
|
5842
|
+
};
|
|
5621
5843
|
var Template = class {
|
|
5622
5844
|
static {
|
|
5623
5845
|
__name(this, "Template");
|
|
@@ -5626,6 +5848,7 @@ var Template = class {
|
|
|
5626
5848
|
attributes;
|
|
5627
5849
|
inputs;
|
|
5628
5850
|
outputs;
|
|
5851
|
+
directives;
|
|
5629
5852
|
templateAttrs;
|
|
5630
5853
|
children;
|
|
5631
5854
|
references;
|
|
@@ -5634,11 +5857,12 @@ var Template = class {
|
|
|
5634
5857
|
startSourceSpan;
|
|
5635
5858
|
endSourceSpan;
|
|
5636
5859
|
i18n;
|
|
5637
|
-
constructor(tagName, attributes, inputs, outputs, templateAttrs, children, references, variables, sourceSpan, startSourceSpan, endSourceSpan, i18n2) {
|
|
5860
|
+
constructor(tagName, attributes, inputs, outputs, directives, templateAttrs, children, references, variables, sourceSpan, startSourceSpan, endSourceSpan, i18n2) {
|
|
5638
5861
|
this.tagName = tagName;
|
|
5639
5862
|
this.attributes = attributes;
|
|
5640
5863
|
this.inputs = inputs;
|
|
5641
5864
|
this.outputs = outputs;
|
|
5865
|
+
this.directives = directives;
|
|
5642
5866
|
this.templateAttrs = templateAttrs;
|
|
5643
5867
|
this.children = children;
|
|
5644
5868
|
this.references = references;
|
|
@@ -5660,13 +5884,17 @@ var Content = class {
|
|
|
5660
5884
|
attributes;
|
|
5661
5885
|
children;
|
|
5662
5886
|
sourceSpan;
|
|
5887
|
+
startSourceSpan;
|
|
5888
|
+
endSourceSpan;
|
|
5663
5889
|
i18n;
|
|
5664
5890
|
name = "ng-content";
|
|
5665
|
-
constructor(selector, attributes, children, sourceSpan, i18n2) {
|
|
5891
|
+
constructor(selector, attributes, children, sourceSpan, startSourceSpan, endSourceSpan, i18n2) {
|
|
5666
5892
|
this.selector = selector;
|
|
5667
5893
|
this.attributes = attributes;
|
|
5668
5894
|
this.children = children;
|
|
5669
5895
|
this.sourceSpan = sourceSpan;
|
|
5896
|
+
this.startSourceSpan = startSourceSpan;
|
|
5897
|
+
this.endSourceSpan = endSourceSpan;
|
|
5670
5898
|
this.i18n = i18n2;
|
|
5671
5899
|
}
|
|
5672
5900
|
visit(visitor) {
|
|
@@ -5731,6 +5959,27 @@ var Icu$1 = class Icu {
|
|
|
5731
5959
|
return visitor.visitIcu(this);
|
|
5732
5960
|
}
|
|
5733
5961
|
};
|
|
5962
|
+
var HostElement = class {
|
|
5963
|
+
static {
|
|
5964
|
+
__name(this, "HostElement");
|
|
5965
|
+
}
|
|
5966
|
+
tagNames;
|
|
5967
|
+
bindings;
|
|
5968
|
+
listeners;
|
|
5969
|
+
sourceSpan;
|
|
5970
|
+
constructor(tagNames, bindings, listeners, sourceSpan) {
|
|
5971
|
+
this.tagNames = tagNames;
|
|
5972
|
+
this.bindings = bindings;
|
|
5973
|
+
this.listeners = listeners;
|
|
5974
|
+
this.sourceSpan = sourceSpan;
|
|
5975
|
+
if (tagNames.length === 0) {
|
|
5976
|
+
throw new Error("HostElement must have at least one tag name.");
|
|
5977
|
+
}
|
|
5978
|
+
}
|
|
5979
|
+
visit() {
|
|
5980
|
+
throw new Error(`HostElement cannot be visited`);
|
|
5981
|
+
}
|
|
5982
|
+
};
|
|
5734
5983
|
var RecursiveVisitor$1 = class RecursiveVisitor {
|
|
5735
5984
|
static {
|
|
5736
5985
|
__name(this, "RecursiveVisitor");
|
|
@@ -5739,6 +5988,7 @@ var RecursiveVisitor$1 = class RecursiveVisitor {
|
|
|
5739
5988
|
visitAll$1(this, element2.attributes);
|
|
5740
5989
|
visitAll$1(this, element2.inputs);
|
|
5741
5990
|
visitAll$1(this, element2.outputs);
|
|
5991
|
+
visitAll$1(this, element2.directives);
|
|
5742
5992
|
visitAll$1(this, element2.children);
|
|
5743
5993
|
visitAll$1(this, element2.references);
|
|
5744
5994
|
}
|
|
@@ -5746,6 +5996,7 @@ var RecursiveVisitor$1 = class RecursiveVisitor {
|
|
|
5746
5996
|
visitAll$1(this, template2.attributes);
|
|
5747
5997
|
visitAll$1(this, template2.inputs);
|
|
5748
5998
|
visitAll$1(this, template2.outputs);
|
|
5999
|
+
visitAll$1(this, template2.directives);
|
|
5749
6000
|
visitAll$1(this, template2.children);
|
|
5750
6001
|
visitAll$1(this, template2.references);
|
|
5751
6002
|
visitAll$1(this, template2.variables);
|
|
@@ -5787,6 +6038,20 @@ var RecursiveVisitor$1 = class RecursiveVisitor {
|
|
|
5787
6038
|
visitContent(content) {
|
|
5788
6039
|
visitAll$1(this, content.children);
|
|
5789
6040
|
}
|
|
6041
|
+
visitComponent(component) {
|
|
6042
|
+
visitAll$1(this, component.attributes);
|
|
6043
|
+
visitAll$1(this, component.inputs);
|
|
6044
|
+
visitAll$1(this, component.outputs);
|
|
6045
|
+
visitAll$1(this, component.directives);
|
|
6046
|
+
visitAll$1(this, component.children);
|
|
6047
|
+
visitAll$1(this, component.references);
|
|
6048
|
+
}
|
|
6049
|
+
visitDirective(directive) {
|
|
6050
|
+
visitAll$1(this, directive.attributes);
|
|
6051
|
+
visitAll$1(this, directive.inputs);
|
|
6052
|
+
visitAll$1(this, directive.outputs);
|
|
6053
|
+
visitAll$1(this, directive.references);
|
|
6054
|
+
}
|
|
5790
6055
|
visitVariable(variable2) {
|
|
5791
6056
|
}
|
|
5792
6057
|
visitReference(reference2) {
|
|
@@ -6459,8 +6724,8 @@ function isI18nAttribute(name) {
|
|
|
6459
6724
|
return name === I18N_ATTR || name.startsWith(I18N_ATTR_PREFIX);
|
|
6460
6725
|
}
|
|
6461
6726
|
__name(isI18nAttribute, "isI18nAttribute");
|
|
6462
|
-
function hasI18nAttrs(
|
|
6463
|
-
return
|
|
6727
|
+
function hasI18nAttrs(node) {
|
|
6728
|
+
return node.attrs.some((attr) => isI18nAttribute(attr.name));
|
|
6464
6729
|
}
|
|
6465
6730
|
__name(hasI18nAttrs, "hasI18nAttrs");
|
|
6466
6731
|
function icuFromI18nMessage(message) {
|
|
@@ -8385,46 +8650,48 @@ var OpKind;
|
|
|
8385
8650
|
OpKind2[OpKind2["Container"] = 8] = "Container";
|
|
8386
8651
|
OpKind2[OpKind2["ContainerEnd"] = 9] = "ContainerEnd";
|
|
8387
8652
|
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["
|
|
8653
|
+
OpKind2[OpKind2["ConditionalCreate"] = 11] = "ConditionalCreate";
|
|
8654
|
+
OpKind2[OpKind2["ConditionalBranchCreate"] = 12] = "ConditionalBranchCreate";
|
|
8655
|
+
OpKind2[OpKind2["Conditional"] = 13] = "Conditional";
|
|
8656
|
+
OpKind2[OpKind2["EnableBindings"] = 14] = "EnableBindings";
|
|
8657
|
+
OpKind2[OpKind2["Text"] = 15] = "Text";
|
|
8658
|
+
OpKind2[OpKind2["Listener"] = 16] = "Listener";
|
|
8659
|
+
OpKind2[OpKind2["InterpolateText"] = 17] = "InterpolateText";
|
|
8660
|
+
OpKind2[OpKind2["Binding"] = 18] = "Binding";
|
|
8661
|
+
OpKind2[OpKind2["Property"] = 19] = "Property";
|
|
8662
|
+
OpKind2[OpKind2["StyleProp"] = 20] = "StyleProp";
|
|
8663
|
+
OpKind2[OpKind2["ClassProp"] = 21] = "ClassProp";
|
|
8664
|
+
OpKind2[OpKind2["StyleMap"] = 22] = "StyleMap";
|
|
8665
|
+
OpKind2[OpKind2["ClassMap"] = 23] = "ClassMap";
|
|
8666
|
+
OpKind2[OpKind2["Advance"] = 24] = "Advance";
|
|
8667
|
+
OpKind2[OpKind2["Pipe"] = 25] = "Pipe";
|
|
8668
|
+
OpKind2[OpKind2["Attribute"] = 26] = "Attribute";
|
|
8669
|
+
OpKind2[OpKind2["ExtractedAttribute"] = 27] = "ExtractedAttribute";
|
|
8670
|
+
OpKind2[OpKind2["Defer"] = 28] = "Defer";
|
|
8671
|
+
OpKind2[OpKind2["DeferOn"] = 29] = "DeferOn";
|
|
8672
|
+
OpKind2[OpKind2["DeferWhen"] = 30] = "DeferWhen";
|
|
8673
|
+
OpKind2[OpKind2["I18nMessage"] = 31] = "I18nMessage";
|
|
8674
|
+
OpKind2[OpKind2["DomProperty"] = 32] = "DomProperty";
|
|
8675
|
+
OpKind2[OpKind2["Namespace"] = 33] = "Namespace";
|
|
8676
|
+
OpKind2[OpKind2["ProjectionDef"] = 34] = "ProjectionDef";
|
|
8677
|
+
OpKind2[OpKind2["Projection"] = 35] = "Projection";
|
|
8678
|
+
OpKind2[OpKind2["RepeaterCreate"] = 36] = "RepeaterCreate";
|
|
8679
|
+
OpKind2[OpKind2["Repeater"] = 37] = "Repeater";
|
|
8680
|
+
OpKind2[OpKind2["TwoWayProperty"] = 38] = "TwoWayProperty";
|
|
8681
|
+
OpKind2[OpKind2["TwoWayListener"] = 39] = "TwoWayListener";
|
|
8682
|
+
OpKind2[OpKind2["DeclareLet"] = 40] = "DeclareLet";
|
|
8683
|
+
OpKind2[OpKind2["StoreLet"] = 41] = "StoreLet";
|
|
8684
|
+
OpKind2[OpKind2["I18nStart"] = 42] = "I18nStart";
|
|
8685
|
+
OpKind2[OpKind2["I18n"] = 43] = "I18n";
|
|
8686
|
+
OpKind2[OpKind2["I18nEnd"] = 44] = "I18nEnd";
|
|
8687
|
+
OpKind2[OpKind2["I18nExpression"] = 45] = "I18nExpression";
|
|
8688
|
+
OpKind2[OpKind2["I18nApply"] = 46] = "I18nApply";
|
|
8689
|
+
OpKind2[OpKind2["IcuStart"] = 47] = "IcuStart";
|
|
8690
|
+
OpKind2[OpKind2["IcuEnd"] = 48] = "IcuEnd";
|
|
8691
|
+
OpKind2[OpKind2["IcuPlaceholder"] = 49] = "IcuPlaceholder";
|
|
8692
|
+
OpKind2[OpKind2["I18nContext"] = 50] = "I18nContext";
|
|
8693
|
+
OpKind2[OpKind2["I18nAttributes"] = 51] = "I18nAttributes";
|
|
8694
|
+
OpKind2[OpKind2["SourceLocation"] = 52] = "SourceLocation";
|
|
8428
8695
|
})(OpKind || (OpKind = {}));
|
|
8429
8696
|
var ExpressionKind;
|
|
8430
8697
|
(function(ExpressionKind2) {
|
|
@@ -9665,7 +9932,7 @@ function transformExpressionsInOp(op, transform2, flags) {
|
|
|
9665
9932
|
}
|
|
9666
9933
|
break;
|
|
9667
9934
|
case OpKind.Property:
|
|
9668
|
-
case OpKind.
|
|
9935
|
+
case OpKind.DomProperty:
|
|
9669
9936
|
case OpKind.Attribute:
|
|
9670
9937
|
if (op.expression instanceof Interpolation2) {
|
|
9671
9938
|
transformExpressionsInInterpolation(op.expression, transform2, flags);
|
|
@@ -9781,6 +10048,8 @@ function transformExpressionsInOp(op, transform2, flags) {
|
|
|
9781
10048
|
case OpKind.IcuPlaceholder:
|
|
9782
10049
|
case OpKind.DeclareLet:
|
|
9783
10050
|
case OpKind.SourceLocation:
|
|
10051
|
+
case OpKind.ConditionalCreate:
|
|
10052
|
+
case OpKind.ConditionalBranchCreate:
|
|
9784
10053
|
break;
|
|
9785
10054
|
default:
|
|
9786
10055
|
throw new Error(`AssertionError: transformExpressionsInOp doesn't handle ${OpKind[op.kind]}`);
|
|
@@ -9828,6 +10097,8 @@ function transformExpressionsInExpression(expr, transform2, flags) {
|
|
|
9828
10097
|
}
|
|
9829
10098
|
} else if (expr instanceof TypeofExpr) {
|
|
9830
10099
|
expr.expr = transformExpressionsInExpression(expr.expr, transform2, flags);
|
|
10100
|
+
} else if (expr instanceof VoidExpr) {
|
|
10101
|
+
expr.expr = transformExpressionsInExpression(expr.expr, transform2, flags);
|
|
9831
10102
|
} else if (expr instanceof WriteVarExpr) {
|
|
9832
10103
|
expr.value = transformExpressionsInExpression(expr.value, transform2, flags);
|
|
9833
10104
|
} else if (expr instanceof LocalizedString) {
|
|
@@ -9852,6 +10123,8 @@ function transformExpressionsInExpression(expr, transform2, flags) {
|
|
|
9852
10123
|
for (let i = 0; i < expr.expressions.length; i++) {
|
|
9853
10124
|
expr.expressions[i] = transformExpressionsInExpression(expr.expressions[i], transform2, flags);
|
|
9854
10125
|
}
|
|
10126
|
+
} else if (expr instanceof ParenthesizedExpr) {
|
|
10127
|
+
expr.expr = transformExpressionsInExpression(expr.expr, transform2, flags);
|
|
9855
10128
|
} else if (expr instanceof ReadVarExpr || expr instanceof ExternalExpr || expr instanceof LiteralExpr) ;
|
|
9856
10129
|
else {
|
|
9857
10130
|
throw new Error(`Unhandled expression kind: ${expr.constructor.name}`);
|
|
@@ -10130,7 +10403,9 @@ var elementContainerOpKinds = /* @__PURE__ */ new Set([
|
|
|
10130
10403
|
OpKind.Container,
|
|
10131
10404
|
OpKind.ContainerStart,
|
|
10132
10405
|
OpKind.Template,
|
|
10133
|
-
OpKind.RepeaterCreate
|
|
10406
|
+
OpKind.RepeaterCreate,
|
|
10407
|
+
OpKind.ConditionalCreate,
|
|
10408
|
+
OpKind.ConditionalBranchCreate
|
|
10134
10409
|
]);
|
|
10135
10410
|
function isElementOrContainerOp(op) {
|
|
10136
10411
|
return elementContainerOpKinds.has(op.kind);
|
|
@@ -10176,6 +10451,50 @@ function createTemplateOp(xref, templateKind, tag, functionNameSuffix, namespace
|
|
|
10176
10451
|
};
|
|
10177
10452
|
}
|
|
10178
10453
|
__name(createTemplateOp, "createTemplateOp");
|
|
10454
|
+
function createConditionalCreateOp(xref, templateKind, tag, functionNameSuffix, namespace, i18nPlaceholder, startSourceSpan, wholeSourceSpan) {
|
|
10455
|
+
return {
|
|
10456
|
+
kind: OpKind.ConditionalCreate,
|
|
10457
|
+
xref,
|
|
10458
|
+
templateKind,
|
|
10459
|
+
attributes: null,
|
|
10460
|
+
tag,
|
|
10461
|
+
handle: new SlotHandle(),
|
|
10462
|
+
functionNameSuffix,
|
|
10463
|
+
decls: null,
|
|
10464
|
+
vars: null,
|
|
10465
|
+
localRefs: [],
|
|
10466
|
+
nonBindable: false,
|
|
10467
|
+
namespace,
|
|
10468
|
+
i18nPlaceholder,
|
|
10469
|
+
startSourceSpan,
|
|
10470
|
+
wholeSourceSpan,
|
|
10471
|
+
...TRAIT_CONSUMES_SLOT,
|
|
10472
|
+
...NEW_OP
|
|
10473
|
+
};
|
|
10474
|
+
}
|
|
10475
|
+
__name(createConditionalCreateOp, "createConditionalCreateOp");
|
|
10476
|
+
function createConditionalBranchCreateOp(xref, templateKind, tag, functionNameSuffix, namespace, i18nPlaceholder, startSourceSpan, wholeSourceSpan) {
|
|
10477
|
+
return {
|
|
10478
|
+
kind: OpKind.ConditionalBranchCreate,
|
|
10479
|
+
xref,
|
|
10480
|
+
templateKind,
|
|
10481
|
+
attributes: null,
|
|
10482
|
+
tag,
|
|
10483
|
+
handle: new SlotHandle(),
|
|
10484
|
+
functionNameSuffix,
|
|
10485
|
+
decls: null,
|
|
10486
|
+
vars: null,
|
|
10487
|
+
localRefs: [],
|
|
10488
|
+
nonBindable: false,
|
|
10489
|
+
namespace,
|
|
10490
|
+
i18nPlaceholder,
|
|
10491
|
+
startSourceSpan,
|
|
10492
|
+
wholeSourceSpan,
|
|
10493
|
+
...TRAIT_CONSUMES_SLOT,
|
|
10494
|
+
...NEW_OP
|
|
10495
|
+
};
|
|
10496
|
+
}
|
|
10497
|
+
__name(createConditionalBranchCreateOp, "createConditionalBranchCreateOp");
|
|
10179
10498
|
function createRepeaterCreateOp(primaryView, emptyView, tag, track, varNames, emptyTag, i18nPlaceholder, emptyI18nPlaceholder, startSourceSpan, wholeSourceSpan) {
|
|
10180
10499
|
return {
|
|
10181
10500
|
kind: OpKind.RepeaterCreate,
|
|
@@ -10505,9 +10824,9 @@ function createSourceLocationOp(templatePath, locations) {
|
|
|
10505
10824
|
};
|
|
10506
10825
|
}
|
|
10507
10826
|
__name(createSourceLocationOp, "createSourceLocationOp");
|
|
10508
|
-
function
|
|
10827
|
+
function createDomPropertyOp(name, expression, isAnimationTrigger, i18nContext, securityContext, sourceSpan) {
|
|
10509
10828
|
return {
|
|
10510
|
-
kind: OpKind.
|
|
10829
|
+
kind: OpKind.DomProperty,
|
|
10511
10830
|
name,
|
|
10512
10831
|
expression,
|
|
10513
10832
|
isAnimationTrigger,
|
|
@@ -10519,7 +10838,7 @@ function createHostPropertyOp(name, expression, isAnimationTrigger, i18nContext,
|
|
|
10519
10838
|
...NEW_OP
|
|
10520
10839
|
};
|
|
10521
10840
|
}
|
|
10522
|
-
__name(
|
|
10841
|
+
__name(createDomPropertyOp, "createDomPropertyOp");
|
|
10523
10842
|
var CTX_REF = "CTX_REF_MARKER";
|
|
10524
10843
|
var CompilationJobKind;
|
|
10525
10844
|
(function(CompilationJobKind2) {
|
|
@@ -10824,7 +11143,20 @@ function assignI18nSlotDependencies(job) {
|
|
|
10824
11143
|
i18nExpressionsInProgress.push(opToRemove);
|
|
10825
11144
|
continue;
|
|
10826
11145
|
}
|
|
11146
|
+
let hasDifferentTarget = false;
|
|
10827
11147
|
if (hasDependsOnSlotContextTrait(updateOp) && updateOp.target !== createOp.xref) {
|
|
11148
|
+
hasDifferentTarget = true;
|
|
11149
|
+
} else if (
|
|
11150
|
+
// Some expressions may consume slots as well (e.g. `storeLet`).
|
|
11151
|
+
updateOp.kind === OpKind.Statement || updateOp.kind === OpKind.Variable
|
|
11152
|
+
) {
|
|
11153
|
+
visitExpressionsInOp(updateOp, (expr) => {
|
|
11154
|
+
if (!hasDifferentTarget && hasDependsOnSlotContextTrait(expr) && expr.target !== createOp.xref) {
|
|
11155
|
+
hasDifferentTarget = true;
|
|
11156
|
+
}
|
|
11157
|
+
});
|
|
11158
|
+
}
|
|
11159
|
+
if (hasDifferentTarget) {
|
|
10828
11160
|
break;
|
|
10829
11161
|
}
|
|
10830
11162
|
updateOp = updateOp.next;
|
|
@@ -10834,8 +11166,31 @@ function assignI18nSlotDependencies(job) {
|
|
|
10834
11166
|
}
|
|
10835
11167
|
}
|
|
10836
11168
|
__name(assignI18nSlotDependencies, "assignI18nSlotDependencies");
|
|
10837
|
-
function
|
|
10838
|
-
|
|
11169
|
+
function attachSourceLocations(job) {
|
|
11170
|
+
if (!job.enableDebugLocations || job.relativeTemplatePath === null) {
|
|
11171
|
+
return;
|
|
11172
|
+
}
|
|
11173
|
+
for (const unit of job.units) {
|
|
11174
|
+
const locations = [];
|
|
11175
|
+
for (const op of unit.create) {
|
|
11176
|
+
if (op.kind === OpKind.ElementStart || op.kind === OpKind.Element) {
|
|
11177
|
+
const start = op.startSourceSpan.start;
|
|
11178
|
+
locations.push({
|
|
11179
|
+
targetSlot: op.handle,
|
|
11180
|
+
offset: start.offset,
|
|
11181
|
+
line: start.line,
|
|
11182
|
+
column: start.col
|
|
11183
|
+
});
|
|
11184
|
+
}
|
|
11185
|
+
}
|
|
11186
|
+
if (locations.length > 0) {
|
|
11187
|
+
unit.create.push(createSourceLocationOp(job.relativeTemplatePath, locations));
|
|
11188
|
+
}
|
|
11189
|
+
}
|
|
11190
|
+
}
|
|
11191
|
+
__name(attachSourceLocations, "attachSourceLocations");
|
|
11192
|
+
function createOpXrefMap(unit) {
|
|
11193
|
+
const map = /* @__PURE__ */ new Map();
|
|
10839
11194
|
for (const op of unit.create) {
|
|
10840
11195
|
if (!hasConsumesSlotTrait(op)) {
|
|
10841
11196
|
continue;
|
|
@@ -11031,7 +11386,7 @@ function specializeBindings(job) {
|
|
|
11031
11386
|
case BindingKind.Property:
|
|
11032
11387
|
case BindingKind.Animation:
|
|
11033
11388
|
if (job.kind === CompilationJobKind.Host) {
|
|
11034
|
-
OpList.replace(op,
|
|
11389
|
+
OpList.replace(op, createDomPropertyOp(op.name, op.expression, op.bindingKind === BindingKind.Animation, op.i18nContext, op.securityContext, op.sourceSpan));
|
|
11035
11390
|
} else {
|
|
11036
11391
|
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
11392
|
}
|
|
@@ -11051,36 +11406,38 @@ function specializeBindings(job) {
|
|
|
11051
11406
|
}
|
|
11052
11407
|
}
|
|
11053
11408
|
__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.stylePropInterpolate1,
|
|
11070
|
-
Identifiers.stylePropInterpolate2,
|
|
11071
|
-
Identifiers.stylePropInterpolate3,
|
|
11072
|
-
Identifiers.stylePropInterpolate4,
|
|
11073
|
-
Identifiers.stylePropInterpolate5,
|
|
11074
|
-
Identifiers.stylePropInterpolate6,
|
|
11075
|
-
Identifiers.stylePropInterpolate7,
|
|
11076
|
-
Identifiers.stylePropInterpolate8,
|
|
11077
|
-
Identifiers.stylePropInterpolateV,
|
|
11078
|
-
Identifiers.syntheticHostListener,
|
|
11079
|
-
Identifiers.syntheticHostProperty,
|
|
11080
|
-
Identifiers.templateCreate,
|
|
11081
|
-
Identifiers.twoWayProperty,
|
|
11082
|
-
Identifiers.twoWayListener,
|
|
11083
|
-
Identifiers.declareLet
|
|
11409
|
+
var CHAIN_COMPATIBILITY = /* @__PURE__ */ new Map([
|
|
11410
|
+
[Identifiers.attribute, Identifiers.attribute],
|
|
11411
|
+
[Identifiers.classProp, Identifiers.classProp],
|
|
11412
|
+
[Identifiers.element, Identifiers.element],
|
|
11413
|
+
[Identifiers.elementContainer, Identifiers.elementContainer],
|
|
11414
|
+
[Identifiers.elementContainerEnd, Identifiers.elementContainerEnd],
|
|
11415
|
+
[Identifiers.elementContainerStart, Identifiers.elementContainerStart],
|
|
11416
|
+
[Identifiers.elementEnd, Identifiers.elementEnd],
|
|
11417
|
+
[Identifiers.elementStart, Identifiers.elementStart],
|
|
11418
|
+
[Identifiers.domProperty, Identifiers.domProperty],
|
|
11419
|
+
[Identifiers.i18nExp, Identifiers.i18nExp],
|
|
11420
|
+
[Identifiers.listener, Identifiers.listener],
|
|
11421
|
+
[Identifiers.listener, Identifiers.listener],
|
|
11422
|
+
[Identifiers.property, Identifiers.property],
|
|
11423
|
+
[Identifiers.styleProp, Identifiers.styleProp],
|
|
11424
|
+
[Identifiers.stylePropInterpolate1, Identifiers.stylePropInterpolate1],
|
|
11425
|
+
[Identifiers.stylePropInterpolate2, Identifiers.stylePropInterpolate2],
|
|
11426
|
+
[Identifiers.stylePropInterpolate3, Identifiers.stylePropInterpolate3],
|
|
11427
|
+
[Identifiers.stylePropInterpolate4, Identifiers.stylePropInterpolate4],
|
|
11428
|
+
[Identifiers.stylePropInterpolate5, Identifiers.stylePropInterpolate5],
|
|
11429
|
+
[Identifiers.stylePropInterpolate6, Identifiers.stylePropInterpolate6],
|
|
11430
|
+
[Identifiers.stylePropInterpolate7, Identifiers.stylePropInterpolate7],
|
|
11431
|
+
[Identifiers.stylePropInterpolate8, Identifiers.stylePropInterpolate8],
|
|
11432
|
+
[Identifiers.stylePropInterpolateV, Identifiers.stylePropInterpolateV],
|
|
11433
|
+
[Identifiers.syntheticHostListener, Identifiers.syntheticHostListener],
|
|
11434
|
+
[Identifiers.syntheticHostProperty, Identifiers.syntheticHostProperty],
|
|
11435
|
+
[Identifiers.templateCreate, Identifiers.templateCreate],
|
|
11436
|
+
[Identifiers.twoWayProperty, Identifiers.twoWayProperty],
|
|
11437
|
+
[Identifiers.twoWayListener, Identifiers.twoWayListener],
|
|
11438
|
+
[Identifiers.declareLet, Identifiers.declareLet],
|
|
11439
|
+
[Identifiers.conditionalCreate, Identifiers.conditionalBranchCreate],
|
|
11440
|
+
[Identifiers.conditionalBranchCreate, Identifiers.conditionalBranchCreate]
|
|
11084
11441
|
]);
|
|
11085
11442
|
var MAX_CHAIN_LENGTH = 256;
|
|
11086
11443
|
function chain(job) {
|
|
@@ -11102,11 +11459,11 @@ function chainOperationsInList(opList) {
|
|
|
11102
11459
|
continue;
|
|
11103
11460
|
}
|
|
11104
11461
|
const instruction = op.statement.expr.fn.value;
|
|
11105
|
-
if (!
|
|
11462
|
+
if (!CHAIN_COMPATIBILITY.has(instruction)) {
|
|
11106
11463
|
chain2 = null;
|
|
11107
11464
|
continue;
|
|
11108
11465
|
}
|
|
11109
|
-
if (chain2 !== null && chain2.instruction === instruction && chain2.length < MAX_CHAIN_LENGTH) {
|
|
11466
|
+
if (chain2 !== null && CHAIN_COMPATIBILITY.get(chain2.instruction) === instruction && chain2.length < MAX_CHAIN_LENGTH) {
|
|
11110
11467
|
const expression = chain2.expression.callFn(op.statement.expr.args, op.statement.expr.sourceSpan, op.statement.expr.pure);
|
|
11111
11468
|
chain2.expression = expression;
|
|
11112
11469
|
chain2.op.statement = expression.toStmt();
|
|
@@ -11183,12 +11540,14 @@ var BINARY_OPERATORS = /* @__PURE__ */ new Map([
|
|
|
11183
11540
|
["<=", BinaryOperator.LowerEquals],
|
|
11184
11541
|
["-", BinaryOperator.Minus],
|
|
11185
11542
|
["%", BinaryOperator.Modulo],
|
|
11543
|
+
["**", BinaryOperator.Exponentiation],
|
|
11186
11544
|
["*", BinaryOperator.Multiply],
|
|
11187
11545
|
["!=", BinaryOperator.NotEquals],
|
|
11188
11546
|
["!==", BinaryOperator.NotIdentical],
|
|
11189
11547
|
["??", BinaryOperator.NullishCoalesce],
|
|
11190
11548
|
["||", BinaryOperator.Or],
|
|
11191
|
-
["+", BinaryOperator.Plus]
|
|
11549
|
+
["+", BinaryOperator.Plus],
|
|
11550
|
+
["in", BinaryOperator.In]
|
|
11192
11551
|
]);
|
|
11193
11552
|
function namespaceForKey(namespacePrefixKey) {
|
|
11194
11553
|
const NAMESPACES = /* @__PURE__ */ new Map([
|
|
@@ -11455,30 +11814,6 @@ function convertI18nBindings(job) {
|
|
|
11455
11814
|
}
|
|
11456
11815
|
}
|
|
11457
11816
|
__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
11817
|
function createI18nContexts(job) {
|
|
11483
11818
|
const attrContextByMessage = /* @__PURE__ */ new Map();
|
|
11484
11819
|
for (const unit of job.units) {
|
|
@@ -11741,6 +12076,8 @@ function needsTemporaryInSafeAccess(e) {
|
|
|
11741
12076
|
return needsTemporaryInSafeAccess(e.receiver);
|
|
11742
12077
|
} else if (e instanceof ReadKeyExpr) {
|
|
11743
12078
|
return needsTemporaryInSafeAccess(e.receiver) || needsTemporaryInSafeAccess(e.index);
|
|
12079
|
+
} else if (e instanceof ParenthesizedExpr) {
|
|
12080
|
+
return needsTemporaryInSafeAccess(e.expr);
|
|
11744
12081
|
}
|
|
11745
12082
|
return e instanceof InvokeFunctionExpr || e instanceof LiteralArrayExpr || e instanceof LiteralMapExpr || e instanceof SafeInvokeFunctionExpr || e instanceof PipeBindingExpr;
|
|
11746
12083
|
}
|
|
@@ -11850,7 +12187,7 @@ function ternaryTransform(e) {
|
|
|
11850
12187
|
if (!(e instanceof SafeTernaryExpr)) {
|
|
11851
12188
|
return e;
|
|
11852
12189
|
}
|
|
11853
|
-
return new ConditionalExpr(new BinaryOperatorExpr(BinaryOperator.Equals, e.guard, NULL_EXPR), NULL_EXPR, e.expr);
|
|
12190
|
+
return new ParenthesizedExpr(new ConditionalExpr(new BinaryOperatorExpr(BinaryOperator.Equals, e.guard, NULL_EXPR), NULL_EXPR, e.expr));
|
|
11854
12191
|
}
|
|
11855
12192
|
__name(ternaryTransform, "ternaryTransform");
|
|
11856
12193
|
var ESCAPE$1 = "\uFFFD";
|
|
@@ -12040,6 +12377,23 @@ function generateAdvance(job) {
|
|
|
12040
12377
|
}
|
|
12041
12378
|
}
|
|
12042
12379
|
__name(generateAdvance, "generateAdvance");
|
|
12380
|
+
function generateLocalLetReferences(job) {
|
|
12381
|
+
for (const unit of job.units) {
|
|
12382
|
+
for (const op of unit.update) {
|
|
12383
|
+
if (op.kind !== OpKind.StoreLet) {
|
|
12384
|
+
continue;
|
|
12385
|
+
}
|
|
12386
|
+
const variable2 = {
|
|
12387
|
+
kind: SemanticVariableKind.Identifier,
|
|
12388
|
+
name: null,
|
|
12389
|
+
identifier: op.declaredName,
|
|
12390
|
+
local: true
|
|
12391
|
+
};
|
|
12392
|
+
OpList.replace(op, createVariableOp(job.allocateXrefId(), variable2, new StoreLetExpr(op.target, op.value, op.sourceSpan), VariableFlags.None));
|
|
12393
|
+
}
|
|
12394
|
+
}
|
|
12395
|
+
}
|
|
12396
|
+
__name(generateLocalLetReferences, "generateLocalLetReferences");
|
|
12043
12397
|
function generateProjectionDefs(job) {
|
|
12044
12398
|
const share = job.compatibility === CompatibilityMode.TemplateDefinitionBuilder;
|
|
12045
12399
|
const selectors = [];
|
|
@@ -12075,6 +12429,8 @@ function recursivelyProcessView(view, parentScope) {
|
|
|
12075
12429
|
const scope = getScopeForView(view, parentScope);
|
|
12076
12430
|
for (const op of view.create) {
|
|
12077
12431
|
switch (op.kind) {
|
|
12432
|
+
case OpKind.ConditionalCreate:
|
|
12433
|
+
case OpKind.ConditionalBranchCreate:
|
|
12078
12434
|
case OpKind.Template:
|
|
12079
12435
|
recursivelyProcessView(view.job.views.get(op.xref), scope);
|
|
12080
12436
|
break;
|
|
@@ -12126,6 +12482,8 @@ function getScopeForView(view, parent) {
|
|
|
12126
12482
|
for (const op of view.create) {
|
|
12127
12483
|
switch (op.kind) {
|
|
12128
12484
|
case OpKind.ElementStart:
|
|
12485
|
+
case OpKind.ConditionalCreate:
|
|
12486
|
+
case OpKind.ConditionalBranchCreate:
|
|
12129
12487
|
case OpKind.Template:
|
|
12130
12488
|
if (!Array.isArray(op.localRefs)) {
|
|
12131
12489
|
throw new Error(`AssertionError: expected localRefs to be an array`);
|
|
@@ -12403,13 +12761,15 @@ var Element2 = class extends NodeWithI18n {
|
|
|
12403
12761
|
}
|
|
12404
12762
|
name;
|
|
12405
12763
|
attrs;
|
|
12764
|
+
directives;
|
|
12406
12765
|
children;
|
|
12407
12766
|
startSourceSpan;
|
|
12408
12767
|
endSourceSpan;
|
|
12409
|
-
constructor(name, attrs, children, sourceSpan, startSourceSpan, endSourceSpan = null, i18n2) {
|
|
12768
|
+
constructor(name, attrs, directives, children, sourceSpan, startSourceSpan, endSourceSpan = null, i18n2) {
|
|
12410
12769
|
super(sourceSpan, i18n2);
|
|
12411
12770
|
this.name = name;
|
|
12412
12771
|
this.attrs = attrs;
|
|
12772
|
+
this.directives = directives;
|
|
12413
12773
|
this.children = children;
|
|
12414
12774
|
this.startSourceSpan = startSourceSpan;
|
|
12415
12775
|
this.endSourceSpan = endSourceSpan;
|
|
@@ -12455,6 +12815,53 @@ var Block = class extends NodeWithI18n {
|
|
|
12455
12815
|
return visitor.visitBlock(this, context);
|
|
12456
12816
|
}
|
|
12457
12817
|
};
|
|
12818
|
+
var Component2 = class extends NodeWithI18n {
|
|
12819
|
+
static {
|
|
12820
|
+
__name(this, "Component");
|
|
12821
|
+
}
|
|
12822
|
+
componentName;
|
|
12823
|
+
tagName;
|
|
12824
|
+
fullName;
|
|
12825
|
+
attrs;
|
|
12826
|
+
directives;
|
|
12827
|
+
children;
|
|
12828
|
+
startSourceSpan;
|
|
12829
|
+
endSourceSpan;
|
|
12830
|
+
constructor(componentName, tagName, fullName, attrs, directives, children, sourceSpan, startSourceSpan, endSourceSpan = null, i18n2) {
|
|
12831
|
+
super(sourceSpan, i18n2);
|
|
12832
|
+
this.componentName = componentName;
|
|
12833
|
+
this.tagName = tagName;
|
|
12834
|
+
this.fullName = fullName;
|
|
12835
|
+
this.attrs = attrs;
|
|
12836
|
+
this.directives = directives;
|
|
12837
|
+
this.children = children;
|
|
12838
|
+
this.startSourceSpan = startSourceSpan;
|
|
12839
|
+
this.endSourceSpan = endSourceSpan;
|
|
12840
|
+
}
|
|
12841
|
+
visit(visitor, context) {
|
|
12842
|
+
return visitor.visitComponent(this, context);
|
|
12843
|
+
}
|
|
12844
|
+
};
|
|
12845
|
+
var Directive2 = class {
|
|
12846
|
+
static {
|
|
12847
|
+
__name(this, "Directive");
|
|
12848
|
+
}
|
|
12849
|
+
name;
|
|
12850
|
+
attrs;
|
|
12851
|
+
sourceSpan;
|
|
12852
|
+
startSourceSpan;
|
|
12853
|
+
endSourceSpan;
|
|
12854
|
+
constructor(name, attrs, sourceSpan, startSourceSpan, endSourceSpan = null) {
|
|
12855
|
+
this.name = name;
|
|
12856
|
+
this.attrs = attrs;
|
|
12857
|
+
this.sourceSpan = sourceSpan;
|
|
12858
|
+
this.startSourceSpan = startSourceSpan;
|
|
12859
|
+
this.endSourceSpan = endSourceSpan;
|
|
12860
|
+
}
|
|
12861
|
+
visit(visitor, context) {
|
|
12862
|
+
return visitor.visitDirective(this, context);
|
|
12863
|
+
}
|
|
12864
|
+
};
|
|
12458
12865
|
var BlockParameter = class {
|
|
12459
12866
|
static {
|
|
12460
12867
|
__name(this, "BlockParameter");
|
|
@@ -12510,6 +12917,7 @@ var RecursiveVisitor2 = class {
|
|
|
12510
12917
|
visitElement(ast, context) {
|
|
12511
12918
|
this.visitChildren(context, (visit) => {
|
|
12512
12919
|
visit(ast.attrs);
|
|
12920
|
+
visit(ast.directives);
|
|
12513
12921
|
visit(ast.children);
|
|
12514
12922
|
});
|
|
12515
12923
|
}
|
|
@@ -12536,6 +12944,17 @@ var RecursiveVisitor2 = class {
|
|
|
12536
12944
|
}
|
|
12537
12945
|
visitLetDeclaration(decl, context) {
|
|
12538
12946
|
}
|
|
12947
|
+
visitComponent(component, context) {
|
|
12948
|
+
this.visitChildren(context, (visit) => {
|
|
12949
|
+
visit(component.attrs);
|
|
12950
|
+
visit(component.children);
|
|
12951
|
+
});
|
|
12952
|
+
}
|
|
12953
|
+
visitDirective(directive, context) {
|
|
12954
|
+
this.visitChildren(context, (visit) => {
|
|
12955
|
+
visit(directive.attrs);
|
|
12956
|
+
});
|
|
12957
|
+
}
|
|
12539
12958
|
visitChildren(context, cb) {
|
|
12540
12959
|
let results = [];
|
|
12541
12960
|
let t = this;
|
|
@@ -14746,11 +15165,13 @@ var _Tokenizer = class {
|
|
|
14746
15165
|
_currentTokenStart = null;
|
|
14747
15166
|
_currentTokenType = null;
|
|
14748
15167
|
_expansionCaseStack = [];
|
|
15168
|
+
_openDirectiveCount = 0;
|
|
14749
15169
|
_inInterpolation = false;
|
|
14750
15170
|
_preserveLineEndings;
|
|
14751
15171
|
_i18nNormalizeLineEndingsInICUs;
|
|
14752
15172
|
_tokenizeBlocks;
|
|
14753
15173
|
_tokenizeLet;
|
|
15174
|
+
_selectorlessEnabled;
|
|
14754
15175
|
tokens = [];
|
|
14755
15176
|
errors = [];
|
|
14756
15177
|
nonNormalizedIcuExpressions = [];
|
|
@@ -14775,6 +15196,7 @@ var _Tokenizer = class {
|
|
|
14775
15196
|
this._i18nNormalizeLineEndingsInICUs = options.i18nNormalizeLineEndingsInICUs || false;
|
|
14776
15197
|
this._tokenizeBlocks = options.tokenizeBlocks ?? true;
|
|
14777
15198
|
this._tokenizeLet = options.tokenizeLet ?? true;
|
|
15199
|
+
this._selectorlessEnabled = options.selectorlessEnabled ?? false;
|
|
14778
15200
|
try {
|
|
14779
15201
|
this._cursor.init();
|
|
14780
15202
|
} catch (e) {
|
|
@@ -14821,7 +15243,7 @@ var _Tokenizer = class {
|
|
|
14821
15243
|
}
|
|
14822
15244
|
}
|
|
14823
15245
|
this._beginToken(
|
|
14824
|
-
|
|
15246
|
+
41
|
|
14825
15247
|
/* TokenType.EOF */
|
|
14826
15248
|
);
|
|
14827
15249
|
this._endToken([]);
|
|
@@ -15206,7 +15628,7 @@ var _Tokenizer = class {
|
|
|
15206
15628
|
this._cursor.advance();
|
|
15207
15629
|
this._endToken([content]);
|
|
15208
15630
|
}
|
|
15209
|
-
_consumePrefixAndName() {
|
|
15631
|
+
_consumePrefixAndName(endPredicate) {
|
|
15210
15632
|
const nameOrPrefixStart = this._cursor.clone();
|
|
15211
15633
|
let prefix = "";
|
|
15212
15634
|
while (this._cursor.peek() !== $COLON && !isPrefixEnd(this._cursor.peek())) {
|
|
@@ -15220,36 +15642,56 @@ var _Tokenizer = class {
|
|
|
15220
15642
|
} else {
|
|
15221
15643
|
nameStart = nameOrPrefixStart;
|
|
15222
15644
|
}
|
|
15223
|
-
this._requireCharCodeUntilFn(
|
|
15645
|
+
this._requireCharCodeUntilFn(endPredicate, prefix === "" ? 0 : 1);
|
|
15224
15646
|
const name = this._cursor.getChars(nameStart);
|
|
15225
15647
|
return [prefix, name];
|
|
15226
15648
|
}
|
|
15227
15649
|
_consumeTagOpen(start) {
|
|
15228
15650
|
let tagName;
|
|
15229
15651
|
let prefix;
|
|
15230
|
-
let
|
|
15652
|
+
let closingTagName;
|
|
15653
|
+
let openToken;
|
|
15231
15654
|
try {
|
|
15232
|
-
if (
|
|
15233
|
-
|
|
15234
|
-
|
|
15235
|
-
|
|
15236
|
-
|
|
15237
|
-
|
|
15238
|
-
|
|
15239
|
-
|
|
15240
|
-
|
|
15655
|
+
if (this._selectorlessEnabled && isSelectorlessNameStart(this._cursor.peek())) {
|
|
15656
|
+
openToken = this._consumeComponentOpenStart(start);
|
|
15657
|
+
[closingTagName, prefix, tagName] = openToken.parts;
|
|
15658
|
+
if (prefix) {
|
|
15659
|
+
closingTagName += `:${prefix}`;
|
|
15660
|
+
}
|
|
15661
|
+
if (tagName) {
|
|
15662
|
+
closingTagName += `:${tagName}`;
|
|
15663
|
+
}
|
|
15241
15664
|
this._attemptCharCodeUntilFn(isNotWhitespace);
|
|
15242
|
-
|
|
15243
|
-
|
|
15244
|
-
this.
|
|
15665
|
+
} else {
|
|
15666
|
+
if (!isAsciiLetter(this._cursor.peek())) {
|
|
15667
|
+
throw this._createError(_unexpectedCharacterErrorMsg(this._cursor.peek()), this._cursor.getSpan(start));
|
|
15245
15668
|
}
|
|
15669
|
+
openToken = this._consumeTagOpenStart(start);
|
|
15670
|
+
prefix = openToken.parts[0];
|
|
15671
|
+
tagName = closingTagName = openToken.parts[1];
|
|
15246
15672
|
this._attemptCharCodeUntilFn(isNotWhitespace);
|
|
15247
15673
|
}
|
|
15248
|
-
this.
|
|
15674
|
+
while (!isAttributeTerminator(this._cursor.peek())) {
|
|
15675
|
+
if (this._selectorlessEnabled && this._cursor.peek() === $AT) {
|
|
15676
|
+
const start2 = this._cursor.clone();
|
|
15677
|
+
const nameStart = start2.clone();
|
|
15678
|
+
nameStart.advance();
|
|
15679
|
+
if (isSelectorlessNameStart(nameStart.peek())) {
|
|
15680
|
+
this._consumeDirective(start2, nameStart);
|
|
15681
|
+
}
|
|
15682
|
+
} else {
|
|
15683
|
+
this._consumeAttribute();
|
|
15684
|
+
}
|
|
15685
|
+
}
|
|
15686
|
+
if (openToken.type === 33) {
|
|
15687
|
+
this._consumeComponentOpenEnd();
|
|
15688
|
+
} else {
|
|
15689
|
+
this._consumeTagOpenEnd();
|
|
15690
|
+
}
|
|
15249
15691
|
} catch (e) {
|
|
15250
15692
|
if (e instanceof _ControlFlowError) {
|
|
15251
|
-
if (
|
|
15252
|
-
|
|
15693
|
+
if (openToken) {
|
|
15694
|
+
openToken.type = openToken.type === 33 ? 37 : 4;
|
|
15253
15695
|
} else {
|
|
15254
15696
|
this._beginToken(5, start);
|
|
15255
15697
|
this._endToken(["<"]);
|
|
@@ -15260,12 +15702,12 @@ var _Tokenizer = class {
|
|
|
15260
15702
|
}
|
|
15261
15703
|
const contentTokenType = this._getTagDefinition(tagName).getContentType(prefix);
|
|
15262
15704
|
if (contentTokenType === TagContentType.RAW_TEXT) {
|
|
15263
|
-
this._consumeRawTextWithTagClose(
|
|
15705
|
+
this._consumeRawTextWithTagClose(openToken, closingTagName, false);
|
|
15264
15706
|
} else if (contentTokenType === TagContentType.ESCAPABLE_RAW_TEXT) {
|
|
15265
|
-
this._consumeRawTextWithTagClose(
|
|
15707
|
+
this._consumeRawTextWithTagClose(openToken, closingTagName, true);
|
|
15266
15708
|
}
|
|
15267
15709
|
}
|
|
15268
|
-
_consumeRawTextWithTagClose(
|
|
15710
|
+
_consumeRawTextWithTagClose(openToken, tagName, consumeEntities) {
|
|
15269
15711
|
this._consumeRawText(consumeEntities, () => {
|
|
15270
15712
|
if (!this._attemptCharCode($LT))
|
|
15271
15713
|
return false;
|
|
@@ -15278,18 +15720,46 @@ var _Tokenizer = class {
|
|
|
15278
15720
|
return this._attemptCharCode($GT);
|
|
15279
15721
|
});
|
|
15280
15722
|
this._beginToken(
|
|
15281
|
-
3
|
|
15723
|
+
openToken.type === 33 ? 36 : 3
|
|
15282
15724
|
/* TokenType.TAG_CLOSE */
|
|
15283
15725
|
);
|
|
15284
15726
|
this._requireCharCodeUntilFn((code) => code === $GT, 3);
|
|
15285
15727
|
this._cursor.advance();
|
|
15286
|
-
this._endToken(
|
|
15728
|
+
this._endToken(openToken.parts);
|
|
15287
15729
|
}
|
|
15288
15730
|
_consumeTagOpenStart(start) {
|
|
15289
15731
|
this._beginToken(0, start);
|
|
15290
|
-
const parts = this._consumePrefixAndName();
|
|
15732
|
+
const parts = this._consumePrefixAndName(isNameEnd);
|
|
15291
15733
|
return this._endToken(parts);
|
|
15292
15734
|
}
|
|
15735
|
+
_consumeComponentOpenStart(start) {
|
|
15736
|
+
this._beginToken(33, start);
|
|
15737
|
+
const parts = this._consumeComponentName();
|
|
15738
|
+
return this._endToken(parts);
|
|
15739
|
+
}
|
|
15740
|
+
_consumeComponentName() {
|
|
15741
|
+
const nameStart = this._cursor.clone();
|
|
15742
|
+
while (isSelectorlessNameChar(this._cursor.peek())) {
|
|
15743
|
+
this._cursor.advance();
|
|
15744
|
+
}
|
|
15745
|
+
const name = this._cursor.getChars(nameStart);
|
|
15746
|
+
let prefix = "";
|
|
15747
|
+
let tagName = "";
|
|
15748
|
+
if (this._cursor.peek() === $COLON) {
|
|
15749
|
+
this._cursor.advance();
|
|
15750
|
+
[prefix, tagName] = this._consumePrefixAndName(isNameEnd);
|
|
15751
|
+
}
|
|
15752
|
+
return [name, prefix, tagName];
|
|
15753
|
+
}
|
|
15754
|
+
_consumeAttribute() {
|
|
15755
|
+
this._consumeAttributeName();
|
|
15756
|
+
this._attemptCharCodeUntilFn(isNotWhitespace);
|
|
15757
|
+
if (this._attemptCharCode($EQ)) {
|
|
15758
|
+
this._attemptCharCodeUntilFn(isNotWhitespace);
|
|
15759
|
+
this._consumeAttributeValue();
|
|
15760
|
+
}
|
|
15761
|
+
this._attemptCharCodeUntilFn(isNotWhitespace);
|
|
15762
|
+
}
|
|
15293
15763
|
_consumeAttributeName() {
|
|
15294
15764
|
const attrNameStart = this._cursor.peek();
|
|
15295
15765
|
if (attrNameStart === $SQ || attrNameStart === $DQ) {
|
|
@@ -15299,7 +15769,26 @@ var _Tokenizer = class {
|
|
|
15299
15769
|
14
|
|
15300
15770
|
/* TokenType.ATTR_NAME */
|
|
15301
15771
|
);
|
|
15302
|
-
|
|
15772
|
+
let nameEndPredicate;
|
|
15773
|
+
if (this._openDirectiveCount > 0) {
|
|
15774
|
+
let openParens = 0;
|
|
15775
|
+
nameEndPredicate = /* @__PURE__ */ __name((code) => {
|
|
15776
|
+
if (this._openDirectiveCount > 0) {
|
|
15777
|
+
if (code === $LPAREN) {
|
|
15778
|
+
openParens++;
|
|
15779
|
+
} else if (code === $RPAREN) {
|
|
15780
|
+
if (openParens === 0) {
|
|
15781
|
+
return true;
|
|
15782
|
+
}
|
|
15783
|
+
openParens--;
|
|
15784
|
+
}
|
|
15785
|
+
}
|
|
15786
|
+
return isNameEnd(code);
|
|
15787
|
+
}, "nameEndPredicate");
|
|
15788
|
+
} else {
|
|
15789
|
+
nameEndPredicate = isNameEnd;
|
|
15790
|
+
}
|
|
15791
|
+
const prefixAndName = this._consumePrefixAndName(nameEndPredicate);
|
|
15303
15792
|
this._endToken(prefixAndName);
|
|
15304
15793
|
}
|
|
15305
15794
|
_consumeAttributeValue() {
|
|
@@ -15328,10 +15817,30 @@ var _Tokenizer = class {
|
|
|
15328
15817
|
this._requireCharCode($GT);
|
|
15329
15818
|
this._endToken([]);
|
|
15330
15819
|
}
|
|
15820
|
+
_consumeComponentOpenEnd() {
|
|
15821
|
+
const tokenType = this._attemptCharCode($SLASH) ? 35 : 34;
|
|
15822
|
+
this._beginToken(tokenType);
|
|
15823
|
+
this._requireCharCode($GT);
|
|
15824
|
+
this._endToken([]);
|
|
15825
|
+
}
|
|
15331
15826
|
_consumeTagClose(start) {
|
|
15827
|
+
if (this._selectorlessEnabled) {
|
|
15828
|
+
const clone = start.clone();
|
|
15829
|
+
while (clone.peek() !== $GT && !isSelectorlessNameStart(clone.peek())) {
|
|
15830
|
+
clone.advance();
|
|
15831
|
+
}
|
|
15832
|
+
if (isSelectorlessNameStart(clone.peek())) {
|
|
15833
|
+
this._beginToken(36, start);
|
|
15834
|
+
const parts = this._consumeComponentName();
|
|
15835
|
+
this._attemptCharCodeUntilFn(isNotWhitespace);
|
|
15836
|
+
this._requireCharCode($GT);
|
|
15837
|
+
this._endToken(parts);
|
|
15838
|
+
return;
|
|
15839
|
+
}
|
|
15840
|
+
}
|
|
15332
15841
|
this._beginToken(3, start);
|
|
15333
15842
|
this._attemptCharCodeUntilFn(isNotWhitespace);
|
|
15334
|
-
const prefixAndName = this._consumePrefixAndName();
|
|
15843
|
+
const prefixAndName = this._consumePrefixAndName(isNameEnd);
|
|
15335
15844
|
this._attemptCharCodeUntilFn(isNotWhitespace);
|
|
15336
15845
|
this._requireCharCode($GT);
|
|
15337
15846
|
this._endToken(prefixAndName);
|
|
@@ -15493,6 +16002,46 @@ var _Tokenizer = class {
|
|
|
15493
16002
|
parts.push(this._getProcessedChars(expressionStart, this._cursor));
|
|
15494
16003
|
this._endToken(parts);
|
|
15495
16004
|
}
|
|
16005
|
+
_consumeDirective(start, nameStart) {
|
|
16006
|
+
this._requireCharCode($AT);
|
|
16007
|
+
this._cursor.advance();
|
|
16008
|
+
while (isSelectorlessNameChar(this._cursor.peek())) {
|
|
16009
|
+
this._cursor.advance();
|
|
16010
|
+
}
|
|
16011
|
+
this._beginToken(38, start);
|
|
16012
|
+
const name = this._cursor.getChars(nameStart);
|
|
16013
|
+
this._endToken([name]);
|
|
16014
|
+
this._attemptCharCodeUntilFn(isNotWhitespace);
|
|
16015
|
+
if (this._cursor.peek() !== $LPAREN) {
|
|
16016
|
+
return;
|
|
16017
|
+
}
|
|
16018
|
+
this._openDirectiveCount++;
|
|
16019
|
+
this._beginToken(
|
|
16020
|
+
39
|
|
16021
|
+
/* TokenType.DIRECTIVE_OPEN */
|
|
16022
|
+
);
|
|
16023
|
+
this._cursor.advance();
|
|
16024
|
+
this._endToken([]);
|
|
16025
|
+
this._attemptCharCodeUntilFn(isNotWhitespace);
|
|
16026
|
+
while (!isAttributeTerminator(this._cursor.peek()) && this._cursor.peek() !== $RPAREN) {
|
|
16027
|
+
this._consumeAttribute();
|
|
16028
|
+
}
|
|
16029
|
+
this._attemptCharCodeUntilFn(isNotWhitespace);
|
|
16030
|
+
this._openDirectiveCount--;
|
|
16031
|
+
if (this._cursor.peek() !== $RPAREN) {
|
|
16032
|
+
if (this._cursor.peek() === $GT || this._cursor.peek() === $SLASH) {
|
|
16033
|
+
return;
|
|
16034
|
+
}
|
|
16035
|
+
throw this._createError(_unexpectedCharacterErrorMsg(this._cursor.peek()), this._cursor.getSpan(start));
|
|
16036
|
+
}
|
|
16037
|
+
this._beginToken(
|
|
16038
|
+
40
|
|
16039
|
+
/* TokenType.DIRECTIVE_CLOSE */
|
|
16040
|
+
);
|
|
16041
|
+
this._cursor.advance();
|
|
16042
|
+
this._endToken([]);
|
|
16043
|
+
this._attemptCharCodeUntilFn(isNotWhitespace);
|
|
16044
|
+
}
|
|
15496
16045
|
_getProcessedChars(start, end) {
|
|
15497
16046
|
return this._processCarriageReturns(end.getChars(start));
|
|
15498
16047
|
}
|
|
@@ -15595,6 +16144,18 @@ function isBlockParameterChar(code) {
|
|
|
15595
16144
|
return code !== $SEMICOLON && isNotWhitespace(code);
|
|
15596
16145
|
}
|
|
15597
16146
|
__name(isBlockParameterChar, "isBlockParameterChar");
|
|
16147
|
+
function isSelectorlessNameStart(code) {
|
|
16148
|
+
return code === $_ || code >= $A && code <= $Z;
|
|
16149
|
+
}
|
|
16150
|
+
__name(isSelectorlessNameStart, "isSelectorlessNameStart");
|
|
16151
|
+
function isSelectorlessNameChar(code) {
|
|
16152
|
+
return isAsciiLetter(code) || isDigit(code) || code === $_;
|
|
16153
|
+
}
|
|
16154
|
+
__name(isSelectorlessNameChar, "isSelectorlessNameChar");
|
|
16155
|
+
function isAttributeTerminator(code) {
|
|
16156
|
+
return code === $SLASH || code === $GT || code === $LT || code === $EOF;
|
|
16157
|
+
}
|
|
16158
|
+
__name(isAttributeTerminator, "isAttributeTerminator");
|
|
15598
16159
|
function mergeTextTokens(srcTokens) {
|
|
15599
16160
|
const dstTokens = [];
|
|
15600
16161
|
let lastDstToken = void 0;
|
|
@@ -15874,24 +16435,24 @@ var _TreeBuilder = class __TreeBuilder {
|
|
|
15874
16435
|
__name(this, "_TreeBuilder");
|
|
15875
16436
|
}
|
|
15876
16437
|
tokens;
|
|
15877
|
-
|
|
16438
|
+
tagDefinitionResolver;
|
|
15878
16439
|
_index = -1;
|
|
15879
16440
|
// `_peek` will be initialized by the call to `_advance()` in the constructor.
|
|
15880
16441
|
_peek;
|
|
15881
16442
|
_containerStack = [];
|
|
15882
16443
|
rootNodes = [];
|
|
15883
16444
|
errors = [];
|
|
15884
|
-
constructor(tokens,
|
|
16445
|
+
constructor(tokens, tagDefinitionResolver) {
|
|
15885
16446
|
this.tokens = tokens;
|
|
15886
|
-
this.
|
|
16447
|
+
this.tagDefinitionResolver = tagDefinitionResolver;
|
|
15887
16448
|
this._advance();
|
|
15888
16449
|
}
|
|
15889
16450
|
build() {
|
|
15890
|
-
while (this._peek.type !==
|
|
16451
|
+
while (this._peek.type !== 41) {
|
|
15891
16452
|
if (this._peek.type === 0 || this._peek.type === 4) {
|
|
15892
|
-
this.
|
|
16453
|
+
this._consumeElementStartTag(this._advance());
|
|
15893
16454
|
} else if (this._peek.type === 3) {
|
|
15894
|
-
this.
|
|
16455
|
+
this._consumeElementEndTag(this._advance());
|
|
15895
16456
|
} else if (this._peek.type === 12) {
|
|
15896
16457
|
this._closeVoidElement();
|
|
15897
16458
|
this._consumeCdata(this._advance());
|
|
@@ -15918,6 +16479,10 @@ var _TreeBuilder = class __TreeBuilder {
|
|
|
15918
16479
|
} else if (this._peek.type === 32) {
|
|
15919
16480
|
this._closeVoidElement();
|
|
15920
16481
|
this._consumeIncompleteLet(this._advance());
|
|
16482
|
+
} else if (this._peek.type === 33 || this._peek.type === 37) {
|
|
16483
|
+
this._consumeComponentStartTag(this._advance());
|
|
16484
|
+
} else if (this._peek.type === 36) {
|
|
16485
|
+
this._consumeComponentEndTag(this._advance());
|
|
15921
16486
|
} else {
|
|
15922
16487
|
this._advance();
|
|
15923
16488
|
}
|
|
@@ -15991,8 +16556,8 @@ var _TreeBuilder = class __TreeBuilder {
|
|
|
15991
16556
|
if (!exp)
|
|
15992
16557
|
return null;
|
|
15993
16558
|
const end = this._advance();
|
|
15994
|
-
exp.push({ type:
|
|
15995
|
-
const expansionCaseParser = new __TreeBuilder(exp, this.
|
|
16559
|
+
exp.push({ type: 41, parts: [], sourceSpan: end.sourceSpan });
|
|
16560
|
+
const expansionCaseParser = new __TreeBuilder(exp, this.tagDefinitionResolver);
|
|
15996
16561
|
expansionCaseParser.build();
|
|
15997
16562
|
if (expansionCaseParser.errors.length > 0) {
|
|
15998
16563
|
this.errors = this.errors.concat(expansionCaseParser.errors);
|
|
@@ -16038,7 +16603,7 @@ var _TreeBuilder = class __TreeBuilder {
|
|
|
16038
16603
|
return null;
|
|
16039
16604
|
}
|
|
16040
16605
|
}
|
|
16041
|
-
if (this._peek.type ===
|
|
16606
|
+
if (this._peek.type === 41) {
|
|
16042
16607
|
this.errors.push(TreeError.create(null, start.sourceSpan, `Invalid ICU message. Missing '}'.`));
|
|
16043
16608
|
return null;
|
|
16044
16609
|
}
|
|
@@ -16051,7 +16616,7 @@ var _TreeBuilder = class __TreeBuilder {
|
|
|
16051
16616
|
let text2 = token.parts[0];
|
|
16052
16617
|
if (text2.length > 0 && text2[0] === "\n") {
|
|
16053
16618
|
const parent = this._getContainer();
|
|
16054
|
-
if (parent != null && parent.children.length === 0 && this.
|
|
16619
|
+
if (parent != null && parent.children.length === 0 && this._getTagDefinition(parent)?.ignoreFirstLf) {
|
|
16055
16620
|
text2 = text2.substring(1);
|
|
16056
16621
|
tokens[0] = { type: token.type, sourceSpan: token.sourceSpan, parts: [text2] };
|
|
16057
16622
|
}
|
|
@@ -16074,23 +16639,21 @@ var _TreeBuilder = class __TreeBuilder {
|
|
|
16074
16639
|
}
|
|
16075
16640
|
_closeVoidElement() {
|
|
16076
16641
|
const el = this._getContainer();
|
|
16077
|
-
if (el
|
|
16642
|
+
if (el !== null && this._getTagDefinition(el)?.isVoid) {
|
|
16078
16643
|
this._containerStack.pop();
|
|
16079
16644
|
}
|
|
16080
16645
|
}
|
|
16081
|
-
|
|
16082
|
-
const [prefix, name] = startTagToken.parts;
|
|
16646
|
+
_consumeElementStartTag(startTagToken) {
|
|
16083
16647
|
const attrs = [];
|
|
16084
|
-
|
|
16085
|
-
|
|
16086
|
-
|
|
16087
|
-
const fullName = this._getElementFullName(prefix, name, this._getClosestParentElement());
|
|
16648
|
+
const directives = [];
|
|
16649
|
+
this._consumeAttributesAndDirectives(attrs, directives);
|
|
16650
|
+
const fullName = this._getElementFullName(startTagToken, this._getClosestElementLikeParent());
|
|
16088
16651
|
let selfClosing = false;
|
|
16089
16652
|
if (this._peek.type === 2) {
|
|
16090
16653
|
this._advance();
|
|
16091
16654
|
selfClosing = true;
|
|
16092
|
-
const tagDef = this.
|
|
16093
|
-
if (!(tagDef
|
|
16655
|
+
const tagDef = this._getTagDefinition(fullName);
|
|
16656
|
+
if (!(tagDef?.canSelfClose || getNsPrefix(fullName) !== null || tagDef?.isVoid)) {
|
|
16094
16657
|
this.errors.push(TreeError.create(fullName, startTagToken.sourceSpan, `Only void, custom and foreign elements can be self closed "${startTagToken.parts[1]}"`));
|
|
16095
16658
|
}
|
|
16096
16659
|
} else if (this._peek.type === 1) {
|
|
@@ -16100,9 +16663,10 @@ var _TreeBuilder = class __TreeBuilder {
|
|
|
16100
16663
|
const end = this._peek.sourceSpan.fullStart;
|
|
16101
16664
|
const span = new ParseSourceSpan(startTagToken.sourceSpan.start, end, startTagToken.sourceSpan.fullStart);
|
|
16102
16665
|
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
|
-
|
|
16666
|
+
const el = new Element2(fullName, attrs, directives, [], span, startSpan, void 0);
|
|
16667
|
+
const parent = this._getContainer();
|
|
16668
|
+
const isClosedByChild = parent !== null && !!this._getTagDefinition(parent)?.isClosedByChild(el.name);
|
|
16669
|
+
this._pushContainer(el, isClosedByChild);
|
|
16106
16670
|
if (selfClosing) {
|
|
16107
16671
|
this._popContainer(fullName, Element2, span);
|
|
16108
16672
|
} else if (startTagToken.type === 4) {
|
|
@@ -16110,6 +16674,64 @@ var _TreeBuilder = class __TreeBuilder {
|
|
|
16110
16674
|
this.errors.push(TreeError.create(fullName, span, `Opening tag "${fullName}" not terminated.`));
|
|
16111
16675
|
}
|
|
16112
16676
|
}
|
|
16677
|
+
_consumeComponentStartTag(startToken) {
|
|
16678
|
+
const componentName = startToken.parts[0];
|
|
16679
|
+
const attrs = [];
|
|
16680
|
+
const directives = [];
|
|
16681
|
+
this._consumeAttributesAndDirectives(attrs, directives);
|
|
16682
|
+
const closestElement = this._getClosestElementLikeParent();
|
|
16683
|
+
const tagName = this._getComponentTagName(startToken, closestElement);
|
|
16684
|
+
const fullName = this._getComponentFullName(startToken, closestElement);
|
|
16685
|
+
const selfClosing = this._peek.type === 35;
|
|
16686
|
+
this._advance();
|
|
16687
|
+
const end = this._peek.sourceSpan.fullStart;
|
|
16688
|
+
const span = new ParseSourceSpan(startToken.sourceSpan.start, end, startToken.sourceSpan.fullStart);
|
|
16689
|
+
const startSpan = new ParseSourceSpan(startToken.sourceSpan.start, end, startToken.sourceSpan.fullStart);
|
|
16690
|
+
const node = new Component2(componentName, tagName, fullName, attrs, directives, [], span, startSpan, void 0);
|
|
16691
|
+
const parent = this._getContainer();
|
|
16692
|
+
const isClosedByChild = parent !== null && node.tagName !== null && !!this._getTagDefinition(parent)?.isClosedByChild(node.tagName);
|
|
16693
|
+
this._pushContainer(node, isClosedByChild);
|
|
16694
|
+
if (selfClosing) {
|
|
16695
|
+
this._popContainer(fullName, Component2, span);
|
|
16696
|
+
} else if (startToken.type === 37) {
|
|
16697
|
+
this._popContainer(fullName, Component2, null);
|
|
16698
|
+
this.errors.push(TreeError.create(fullName, span, `Opening tag "${fullName}" not terminated.`));
|
|
16699
|
+
}
|
|
16700
|
+
}
|
|
16701
|
+
_consumeAttributesAndDirectives(attributesResult, directivesResult) {
|
|
16702
|
+
while (this._peek.type === 14 || this._peek.type === 38) {
|
|
16703
|
+
if (this._peek.type === 38) {
|
|
16704
|
+
directivesResult.push(this._consumeDirective(this._peek));
|
|
16705
|
+
} else {
|
|
16706
|
+
attributesResult.push(this._consumeAttr(this._advance()));
|
|
16707
|
+
}
|
|
16708
|
+
}
|
|
16709
|
+
}
|
|
16710
|
+
_consumeComponentEndTag(endToken) {
|
|
16711
|
+
const fullName = this._getComponentFullName(endToken, this._getClosestElementLikeParent());
|
|
16712
|
+
if (!this._popContainer(fullName, Component2, endToken.sourceSpan)) {
|
|
16713
|
+
const container = this._containerStack[this._containerStack.length - 1];
|
|
16714
|
+
let suffix;
|
|
16715
|
+
if (container instanceof Component2 && container.componentName === endToken.parts[0]) {
|
|
16716
|
+
suffix = `, did you mean "${container.fullName}"?`;
|
|
16717
|
+
} else {
|
|
16718
|
+
suffix = ". It may happen when the tag has already been closed by another tag.";
|
|
16719
|
+
}
|
|
16720
|
+
const errMsg = `Unexpected closing tag "${fullName}"${suffix}`;
|
|
16721
|
+
this.errors.push(TreeError.create(fullName, endToken.sourceSpan, errMsg));
|
|
16722
|
+
}
|
|
16723
|
+
}
|
|
16724
|
+
_getTagDefinition(nodeOrName) {
|
|
16725
|
+
if (typeof nodeOrName === "string") {
|
|
16726
|
+
return this.tagDefinitionResolver(nodeOrName);
|
|
16727
|
+
} else if (nodeOrName instanceof Element2) {
|
|
16728
|
+
return this.tagDefinitionResolver(nodeOrName.name);
|
|
16729
|
+
} else if (nodeOrName instanceof Component2 && nodeOrName.tagName !== null) {
|
|
16730
|
+
return this.tagDefinitionResolver(nodeOrName.tagName);
|
|
16731
|
+
} else {
|
|
16732
|
+
return null;
|
|
16733
|
+
}
|
|
16734
|
+
}
|
|
16113
16735
|
_pushContainer(node, isClosedByChild) {
|
|
16114
16736
|
if (isClosedByChild) {
|
|
16115
16737
|
this._containerStack.pop();
|
|
@@ -16117,9 +16739,9 @@ var _TreeBuilder = class __TreeBuilder {
|
|
|
16117
16739
|
this._addToParent(node);
|
|
16118
16740
|
this._containerStack.push(node);
|
|
16119
16741
|
}
|
|
16120
|
-
|
|
16121
|
-
const fullName = this._getElementFullName(endTagToken
|
|
16122
|
-
if (this.
|
|
16742
|
+
_consumeElementEndTag(endTagToken) {
|
|
16743
|
+
const fullName = this._getElementFullName(endTagToken, this._getClosestElementLikeParent());
|
|
16744
|
+
if (this._getTagDefinition(fullName)?.isVoid) {
|
|
16123
16745
|
this.errors.push(TreeError.create(fullName, endTagToken.sourceSpan, `Void elements do not have end tags "${endTagToken.parts[1]}"`));
|
|
16124
16746
|
} else if (!this._popContainer(fullName, Element2, endTagToken.sourceSpan)) {
|
|
16125
16747
|
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 +16758,14 @@ var _TreeBuilder = class __TreeBuilder {
|
|
|
16136
16758
|
let unexpectedCloseTagDetected = false;
|
|
16137
16759
|
for (let stackIndex = this._containerStack.length - 1; stackIndex >= 0; stackIndex--) {
|
|
16138
16760
|
const node = this._containerStack[stackIndex];
|
|
16139
|
-
|
|
16761
|
+
const nodeName = node instanceof Component2 ? node.fullName : node.name;
|
|
16762
|
+
if ((nodeName === expectedName || expectedName === null) && node instanceof expectedType) {
|
|
16140
16763
|
node.endSourceSpan = endSourceSpan;
|
|
16141
16764
|
node.sourceSpan.end = endSourceSpan !== null ? endSourceSpan.end : node.sourceSpan.end;
|
|
16142
16765
|
this._containerStack.splice(stackIndex, this._containerStack.length - stackIndex);
|
|
16143
16766
|
return !unexpectedCloseTagDetected;
|
|
16144
16767
|
}
|
|
16145
|
-
if (node instanceof Block ||
|
|
16768
|
+
if (node instanceof Block || !this._getTagDefinition(node)?.closedByParent) {
|
|
16146
16769
|
unexpectedCloseTagDetected = true;
|
|
16147
16770
|
}
|
|
16148
16771
|
}
|
|
@@ -16182,6 +16805,28 @@ var _TreeBuilder = class __TreeBuilder {
|
|
|
16182
16805
|
const valueSpan = valueStartSpan && valueEnd && new ParseSourceSpan(valueStartSpan.start, valueEnd, valueStartSpan.fullStart);
|
|
16183
16806
|
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
16807
|
}
|
|
16808
|
+
_consumeDirective(nameToken) {
|
|
16809
|
+
const attributes = [];
|
|
16810
|
+
let startSourceSpanEnd = nameToken.sourceSpan.end;
|
|
16811
|
+
let endSourceSpan = null;
|
|
16812
|
+
this._advance();
|
|
16813
|
+
if (this._peek.type === 39) {
|
|
16814
|
+
startSourceSpanEnd = this._peek.sourceSpan.end;
|
|
16815
|
+
this._advance();
|
|
16816
|
+
while (this._peek.type === 14) {
|
|
16817
|
+
attributes.push(this._consumeAttr(this._advance()));
|
|
16818
|
+
}
|
|
16819
|
+
if (this._peek.type === 40) {
|
|
16820
|
+
endSourceSpan = this._peek.sourceSpan;
|
|
16821
|
+
this._advance();
|
|
16822
|
+
} else {
|
|
16823
|
+
this.errors.push(TreeError.create(null, nameToken.sourceSpan, "Unterminated directive definition"));
|
|
16824
|
+
}
|
|
16825
|
+
}
|
|
16826
|
+
const startSourceSpan = new ParseSourceSpan(nameToken.sourceSpan.start, startSourceSpanEnd, nameToken.sourceSpan.fullStart);
|
|
16827
|
+
const sourceSpan = new ParseSourceSpan(startSourceSpan.start, endSourceSpan === null ? nameToken.sourceSpan.end : endSourceSpan.end, startSourceSpan.fullStart);
|
|
16828
|
+
return new Directive2(nameToken.parts[0], attributes, sourceSpan, startSourceSpan, endSourceSpan);
|
|
16829
|
+
}
|
|
16185
16830
|
_consumeBlockOpen(token) {
|
|
16186
16831
|
const parameters = [];
|
|
16187
16832
|
while (this._peek.type === 27) {
|
|
@@ -16256,10 +16901,11 @@ var _TreeBuilder = class __TreeBuilder {
|
|
|
16256
16901
|
_getContainer() {
|
|
16257
16902
|
return this._containerStack.length > 0 ? this._containerStack[this._containerStack.length - 1] : null;
|
|
16258
16903
|
}
|
|
16259
|
-
|
|
16904
|
+
_getClosestElementLikeParent() {
|
|
16260
16905
|
for (let i = this._containerStack.length - 1; i > -1; i--) {
|
|
16261
|
-
|
|
16262
|
-
|
|
16906
|
+
const current = this._containerStack[i];
|
|
16907
|
+
if (current instanceof Element2 || current instanceof Component2) {
|
|
16908
|
+
return current;
|
|
16263
16909
|
}
|
|
16264
16910
|
}
|
|
16265
16911
|
return null;
|
|
@@ -16272,18 +16918,51 @@ var _TreeBuilder = class __TreeBuilder {
|
|
|
16272
16918
|
parent.children.push(node);
|
|
16273
16919
|
}
|
|
16274
16920
|
}
|
|
16275
|
-
_getElementFullName(
|
|
16276
|
-
|
|
16277
|
-
|
|
16278
|
-
|
|
16279
|
-
|
|
16280
|
-
|
|
16281
|
-
|
|
16282
|
-
|
|
16921
|
+
_getElementFullName(token, parent) {
|
|
16922
|
+
const prefix = this._getPrefix(token, parent);
|
|
16923
|
+
return mergeNsAndName(prefix, token.parts[1]);
|
|
16924
|
+
}
|
|
16925
|
+
_getComponentFullName(token, parent) {
|
|
16926
|
+
const componentName = token.parts[0];
|
|
16927
|
+
const tagName = this._getComponentTagName(token, parent);
|
|
16928
|
+
if (tagName === null) {
|
|
16929
|
+
return componentName;
|
|
16930
|
+
}
|
|
16931
|
+
return tagName.startsWith(":") ? componentName + tagName : `${componentName}:${tagName}`;
|
|
16932
|
+
}
|
|
16933
|
+
_getComponentTagName(token, parent) {
|
|
16934
|
+
const prefix = this._getPrefix(token, parent);
|
|
16935
|
+
const tagName = token.parts[2];
|
|
16936
|
+
if (!prefix && !tagName) {
|
|
16937
|
+
return null;
|
|
16938
|
+
} else if (!prefix && tagName) {
|
|
16939
|
+
return tagName;
|
|
16940
|
+
} else {
|
|
16941
|
+
return mergeNsAndName(prefix, tagName || "ng-component");
|
|
16942
|
+
}
|
|
16943
|
+
}
|
|
16944
|
+
_getPrefix(token, parent) {
|
|
16945
|
+
let prefix;
|
|
16946
|
+
let tagName;
|
|
16947
|
+
if (token.type === 33 || token.type === 37 || token.type === 36) {
|
|
16948
|
+
prefix = token.parts[1];
|
|
16949
|
+
tagName = token.parts[2];
|
|
16950
|
+
} else {
|
|
16951
|
+
prefix = token.parts[0];
|
|
16952
|
+
tagName = token.parts[1];
|
|
16953
|
+
}
|
|
16954
|
+
prefix = prefix || this._getTagDefinition(tagName)?.implicitNamespacePrefix || "";
|
|
16955
|
+
if (!prefix && parent) {
|
|
16956
|
+
const parentName = parent instanceof Element2 ? parent.name : parent.tagName;
|
|
16957
|
+
if (parentName !== null) {
|
|
16958
|
+
const parentTagName = splitNsName(parentName)[1];
|
|
16959
|
+
const parentTagDefinition = this._getTagDefinition(parentTagName);
|
|
16960
|
+
if (parentTagDefinition !== null && !parentTagDefinition.preventNamespaceInheritance) {
|
|
16961
|
+
prefix = getNsPrefix(parentName);
|
|
16283
16962
|
}
|
|
16284
16963
|
}
|
|
16285
16964
|
}
|
|
16286
|
-
return
|
|
16965
|
+
return prefix;
|
|
16287
16966
|
}
|
|
16288
16967
|
};
|
|
16289
16968
|
function lastOnStack(stack, element2) {
|
|
@@ -16334,11 +17013,11 @@ var WhitespaceVisitor = class {
|
|
|
16334
17013
|
}
|
|
16335
17014
|
visitElement(element2, context) {
|
|
16336
17015
|
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);
|
|
17016
|
+
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
17017
|
this.originalNodeMap?.set(newElement2, element2);
|
|
16339
17018
|
return newElement2;
|
|
16340
17019
|
}
|
|
16341
|
-
const newElement = new Element2(element2.name, element2.attrs, visitAllWithSiblings(this, element2.children), element2.sourceSpan, element2.startSourceSpan, element2.endSourceSpan, element2.i18n);
|
|
17020
|
+
const newElement = new Element2(element2.name, element2.attrs, element2.directives, visitAllWithSiblings(this, element2.children), element2.sourceSpan, element2.startSourceSpan, element2.endSourceSpan, element2.i18n);
|
|
16342
17021
|
this.originalNodeMap?.set(newElement, element2);
|
|
16343
17022
|
return newElement;
|
|
16344
17023
|
}
|
|
@@ -16397,6 +17076,19 @@ var WhitespaceVisitor = class {
|
|
|
16397
17076
|
visitLetDeclaration(decl, context) {
|
|
16398
17077
|
return decl;
|
|
16399
17078
|
}
|
|
17079
|
+
visitComponent(node, context) {
|
|
17080
|
+
if (node.tagName && SKIP_WS_TRIM_TAGS.has(node.tagName) || hasPreserveWhitespacesAttr(node.attrs)) {
|
|
17081
|
+
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);
|
|
17082
|
+
this.originalNodeMap?.set(newElement2, node);
|
|
17083
|
+
return newElement2;
|
|
17084
|
+
}
|
|
17085
|
+
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);
|
|
17086
|
+
this.originalNodeMap?.set(newElement, node);
|
|
17087
|
+
return newElement;
|
|
17088
|
+
}
|
|
17089
|
+
visitDirective(directive, context) {
|
|
17090
|
+
return directive;
|
|
17091
|
+
}
|
|
16400
17092
|
visit(_node, context) {
|
|
16401
17093
|
if (this.requireContext && !context) {
|
|
16402
17094
|
throw new Error(`WhitespaceVisitor requires context. Visit via \`visitAllWithSiblings\` to get this context.`);
|
|
@@ -16482,7 +17174,9 @@ var KEYWORDS = [
|
|
|
16482
17174
|
"if",
|
|
16483
17175
|
"else",
|
|
16484
17176
|
"this",
|
|
16485
|
-
"typeof"
|
|
17177
|
+
"typeof",
|
|
17178
|
+
"void",
|
|
17179
|
+
"in"
|
|
16486
17180
|
];
|
|
16487
17181
|
var Lexer = class {
|
|
16488
17182
|
static {
|
|
@@ -16553,6 +17247,12 @@ var Token = class {
|
|
|
16553
17247
|
isKeywordTypeof() {
|
|
16554
17248
|
return this.type === TokenType.Keyword && this.strValue === "typeof";
|
|
16555
17249
|
}
|
|
17250
|
+
isKeywordVoid() {
|
|
17251
|
+
return this.type === TokenType.Keyword && this.strValue === "void";
|
|
17252
|
+
}
|
|
17253
|
+
isKeywordIn() {
|
|
17254
|
+
return this.type === TokenType.Keyword && this.strValue === "in";
|
|
17255
|
+
}
|
|
16556
17256
|
isError() {
|
|
16557
17257
|
return this.type === TokenType.Error;
|
|
16558
17258
|
}
|
|
@@ -16705,11 +17405,12 @@ var _Scanner = class {
|
|
|
16705
17405
|
return this.scanPrivateIdentifier();
|
|
16706
17406
|
case $PLUS:
|
|
16707
17407
|
case $MINUS:
|
|
16708
|
-
case $STAR:
|
|
16709
17408
|
case $SLASH:
|
|
16710
17409
|
case $PERCENT:
|
|
16711
17410
|
case $CARET:
|
|
16712
17411
|
return this.scanOperator(start, String.fromCharCode(peek));
|
|
17412
|
+
case $STAR:
|
|
17413
|
+
return this.scanComplexOperator(start, "*", $STAR, "*");
|
|
16713
17414
|
case $QUESTION:
|
|
16714
17415
|
return this.scanQuestion(start);
|
|
16715
17416
|
case $LT:
|
|
@@ -17544,13 +18245,14 @@ var _ParseAST = class {
|
|
|
17544
18245
|
parseRelational() {
|
|
17545
18246
|
const start = this.inputIndex;
|
|
17546
18247
|
let result = this.parseAdditive();
|
|
17547
|
-
while (this.next.type == TokenType.Operator) {
|
|
18248
|
+
while (this.next.type == TokenType.Operator || this.next.isKeywordIn) {
|
|
17548
18249
|
const operator = this.next.strValue;
|
|
17549
18250
|
switch (operator) {
|
|
17550
18251
|
case "<":
|
|
17551
18252
|
case ">":
|
|
17552
18253
|
case "<=":
|
|
17553
18254
|
case ">=":
|
|
18255
|
+
case "in":
|
|
17554
18256
|
this.advance();
|
|
17555
18257
|
const right = this.parseAdditive();
|
|
17556
18258
|
result = new Binary(this.span(start), this.sourceSpan(start), operator, result, right);
|
|
@@ -17579,7 +18281,7 @@ var _ParseAST = class {
|
|
|
17579
18281
|
}
|
|
17580
18282
|
parseMultiplicative() {
|
|
17581
18283
|
const start = this.inputIndex;
|
|
17582
|
-
let result = this.
|
|
18284
|
+
let result = this.parseExponentiation();
|
|
17583
18285
|
while (this.next.type == TokenType.Operator) {
|
|
17584
18286
|
const operator = this.next.strValue;
|
|
17585
18287
|
switch (operator) {
|
|
@@ -17587,7 +18289,7 @@ var _ParseAST = class {
|
|
|
17587
18289
|
case "%":
|
|
17588
18290
|
case "/":
|
|
17589
18291
|
this.advance();
|
|
17590
|
-
|
|
18292
|
+
const right = this.parseExponentiation();
|
|
17591
18293
|
result = new Binary(this.span(start), this.sourceSpan(start), operator, result, right);
|
|
17592
18294
|
continue;
|
|
17593
18295
|
}
|
|
@@ -17595,6 +18297,19 @@ var _ParseAST = class {
|
|
|
17595
18297
|
}
|
|
17596
18298
|
return result;
|
|
17597
18299
|
}
|
|
18300
|
+
parseExponentiation() {
|
|
18301
|
+
const start = this.inputIndex;
|
|
18302
|
+
let result = this.parsePrefix();
|
|
18303
|
+
while (this.next.type == TokenType.Operator && this.next.strValue === "**") {
|
|
18304
|
+
if (result instanceof Unary || result instanceof PrefixNot || result instanceof TypeofExpression || result instanceof VoidExpression) {
|
|
18305
|
+
this.error("Unary operator used immediately before exponentiation expression. Parenthesis must be used to disambiguate operator precedence");
|
|
18306
|
+
}
|
|
18307
|
+
this.advance();
|
|
18308
|
+
const right = this.parseExponentiation();
|
|
18309
|
+
result = new Binary(this.span(start), this.sourceSpan(start), "**", result, right);
|
|
18310
|
+
}
|
|
18311
|
+
return result;
|
|
18312
|
+
}
|
|
17598
18313
|
parsePrefix() {
|
|
17599
18314
|
if (this.next.type == TokenType.Operator) {
|
|
17600
18315
|
const start = this.inputIndex;
|
|
@@ -17619,6 +18334,11 @@ var _ParseAST = class {
|
|
|
17619
18334
|
const start = this.inputIndex;
|
|
17620
18335
|
let result = this.parsePrefix();
|
|
17621
18336
|
return new TypeofExpression(this.span(start), this.sourceSpan(start), result);
|
|
18337
|
+
} else if (this.next.isKeywordVoid()) {
|
|
18338
|
+
this.advance();
|
|
18339
|
+
const start = this.inputIndex;
|
|
18340
|
+
let result = this.parsePrefix();
|
|
18341
|
+
return new VoidExpression(this.span(start), this.sourceSpan(start), result);
|
|
17622
18342
|
}
|
|
17623
18343
|
return this.parseCallChain();
|
|
17624
18344
|
}
|
|
@@ -17640,6 +18360,10 @@ var _ParseAST = class {
|
|
|
17640
18360
|
result = this.parseCall(result, start, false);
|
|
17641
18361
|
} else if (this.consumeOptionalOperator("!")) {
|
|
17642
18362
|
result = new NonNullAssert(this.span(start), this.sourceSpan(start), result);
|
|
18363
|
+
} else if (this.next.isTemplateLiteralEnd()) {
|
|
18364
|
+
result = this.parseNoInterpolationTaggedTemplateLiteral(result, start);
|
|
18365
|
+
} else if (this.next.isTemplateLiteralPart()) {
|
|
18366
|
+
result = this.parseTaggedTemplateLiteral(result, start);
|
|
17643
18367
|
} else {
|
|
17644
18368
|
return result;
|
|
17645
18369
|
}
|
|
@@ -17652,7 +18376,7 @@ var _ParseAST = class {
|
|
|
17652
18376
|
const result = this.parsePipe();
|
|
17653
18377
|
this.rparensExpected--;
|
|
17654
18378
|
this.expectCharacter($RPAREN);
|
|
17655
|
-
return result;
|
|
18379
|
+
return new ParenthesizedExpression(this.span(start), this.sourceSpan(start), result);
|
|
17656
18380
|
} else if (this.next.isKeywordNull()) {
|
|
17657
18381
|
this.advance();
|
|
17658
18382
|
return new LiteralPrimitive(this.span(start), this.sourceSpan(start), null);
|
|
@@ -17665,6 +18389,9 @@ var _ParseAST = class {
|
|
|
17665
18389
|
} else if (this.next.isKeywordFalse()) {
|
|
17666
18390
|
this.advance();
|
|
17667
18391
|
return new LiteralPrimitive(this.span(start), this.sourceSpan(start), false);
|
|
18392
|
+
} else if (this.next.isKeywordIn()) {
|
|
18393
|
+
this.advance();
|
|
18394
|
+
return new LiteralPrimitive(this.span(start), this.sourceSpan(start), "in");
|
|
17668
18395
|
} else if (this.next.isKeywordThis()) {
|
|
17669
18396
|
this.advance();
|
|
17670
18397
|
return new ThisReceiver(this.span(start), this.sourceSpan(start));
|
|
@@ -17975,6 +18702,10 @@ var _ParseAST = class {
|
|
|
17975
18702
|
const sourceSpan = new AbsoluteSourceSpan(spanStart, this.currentAbsoluteOffset);
|
|
17976
18703
|
return new VariableBinding(sourceSpan, key, value);
|
|
17977
18704
|
}
|
|
18705
|
+
parseNoInterpolationTaggedTemplateLiteral(tag, start) {
|
|
18706
|
+
const template2 = this.parseNoInterpolationTemplateLiteral();
|
|
18707
|
+
return new TaggedTemplateLiteral(this.span(start), this.sourceSpan(start), tag, template2);
|
|
18708
|
+
}
|
|
17978
18709
|
parseNoInterpolationTemplateLiteral() {
|
|
17979
18710
|
const text2 = this.next.strValue;
|
|
17980
18711
|
const start = this.inputIndex;
|
|
@@ -17983,10 +18714,14 @@ var _ParseAST = class {
|
|
|
17983
18714
|
const sourceSpan = this.sourceSpan(start);
|
|
17984
18715
|
return new TemplateLiteral(span, sourceSpan, [new TemplateLiteralElement(span, sourceSpan, text2)], []);
|
|
17985
18716
|
}
|
|
18717
|
+
parseTaggedTemplateLiteral(tag, start) {
|
|
18718
|
+
const template2 = this.parseTemplateLiteral();
|
|
18719
|
+
return new TaggedTemplateLiteral(this.span(start), this.sourceSpan(start), tag, template2);
|
|
18720
|
+
}
|
|
17986
18721
|
parseTemplateLiteral() {
|
|
17987
|
-
const start = this.inputIndex;
|
|
17988
18722
|
const elements = [];
|
|
17989
18723
|
const expressions = [];
|
|
18724
|
+
const start = this.inputIndex;
|
|
17990
18725
|
while (this.next !== EOF) {
|
|
17991
18726
|
const token = this.next;
|
|
17992
18727
|
if (token.isTemplateLiteralPart() || token.isTemplateLiteralEnd()) {
|
|
@@ -18201,6 +18936,9 @@ var SerializeExpressionVisitor = class {
|
|
|
18201
18936
|
visitTypeofExpression(ast, context) {
|
|
18202
18937
|
return `typeof ${ast.expression.visit(this, context)}`;
|
|
18203
18938
|
}
|
|
18939
|
+
visitVoidExpression(ast, context) {
|
|
18940
|
+
return `void ${ast.expression.visit(this, context)}`;
|
|
18941
|
+
}
|
|
18204
18942
|
visitASTWithSource(ast, context) {
|
|
18205
18943
|
return ast.ast.visit(this, context);
|
|
18206
18944
|
}
|
|
@@ -18218,6 +18956,12 @@ var SerializeExpressionVisitor = class {
|
|
|
18218
18956
|
visitTemplateLiteralElement(ast, context) {
|
|
18219
18957
|
return ast.text;
|
|
18220
18958
|
}
|
|
18959
|
+
visitTaggedTemplateLiteral(ast, context) {
|
|
18960
|
+
return ast.tag.visit(this, context) + ast.template.visit(this, context);
|
|
18961
|
+
}
|
|
18962
|
+
visitParenthesizedExpression(ast, context) {
|
|
18963
|
+
return "(" + ast.expression.visit(this, context) + ")";
|
|
18964
|
+
}
|
|
18221
18965
|
};
|
|
18222
18966
|
function zip(left, right) {
|
|
18223
18967
|
if (left.length !== right.length)
|
|
@@ -18372,6 +19116,7 @@ var SCHEMA = [
|
|
|
18372
19116
|
"q,blockquote,cite^[HTMLElement]|",
|
|
18373
19117
|
"script^[HTMLElement]|!async,charset,%crossOrigin,!defer,event,htmlFor,integrity,!noModule,%referrerPolicy,src,text,type",
|
|
18374
19118
|
"select^[HTMLElement]|autocomplete,!disabled,#length,!multiple,name,!required,#selectedIndex,#size,value",
|
|
19119
|
+
"selectedcontent^[HTMLElement]|",
|
|
18375
19120
|
"slot^[HTMLElement]|name",
|
|
18376
19121
|
"source^[HTMLElement]|#height,media,sizes,src,srcset,type,#width",
|
|
18377
19122
|
"span^[HTMLElement]|",
|
|
@@ -19011,27 +19756,13 @@ var _I18nVisitor = class {
|
|
|
19011
19756
|
return new Message(i18nodes, context.placeholderToContent, context.placeholderToMessage, meaning, description, customId);
|
|
19012
19757
|
}
|
|
19013
19758
|
visitElement(el, context) {
|
|
19014
|
-
|
|
19015
|
-
|
|
19016
|
-
|
|
19017
|
-
|
|
19018
|
-
|
|
19019
|
-
|
|
19020
|
-
|
|
19021
|
-
context.placeholderToContent[startPhName] = {
|
|
19022
|
-
text: el.startSourceSpan.toString(),
|
|
19023
|
-
sourceSpan: el.startSourceSpan
|
|
19024
|
-
};
|
|
19025
|
-
let closePhName = "";
|
|
19026
|
-
if (!isVoid) {
|
|
19027
|
-
closePhName = context.placeholderRegistry.getCloseTagPlaceholderName(el.name);
|
|
19028
|
-
context.placeholderToContent[closePhName] = {
|
|
19029
|
-
text: `</${el.name}>`,
|
|
19030
|
-
sourceSpan: el.endSourceSpan ?? el.sourceSpan
|
|
19031
|
-
};
|
|
19032
|
-
}
|
|
19033
|
-
const node = new TagPlaceholder(el.name, attrs, startPhName, closePhName, children, isVoid, el.sourceSpan, el.startSourceSpan, el.endSourceSpan);
|
|
19034
|
-
return context.visitNodeFn(el, node);
|
|
19759
|
+
return this._visitElementLike(el, context);
|
|
19760
|
+
}
|
|
19761
|
+
visitComponent(component, context) {
|
|
19762
|
+
return this._visitElementLike(component, context);
|
|
19763
|
+
}
|
|
19764
|
+
visitDirective(directive, context) {
|
|
19765
|
+
throw new Error("Unreachable code");
|
|
19035
19766
|
}
|
|
19036
19767
|
visitAttribute(attribute2, context) {
|
|
19037
19768
|
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);
|
|
@@ -19094,6 +19825,39 @@ var _I18nVisitor = class {
|
|
|
19094
19825
|
visitLetDeclaration(decl, context) {
|
|
19095
19826
|
return null;
|
|
19096
19827
|
}
|
|
19828
|
+
_visitElementLike(node, context) {
|
|
19829
|
+
const children = visitAll(this, node.children, context);
|
|
19830
|
+
const attrs = {};
|
|
19831
|
+
const visitAttribute = /* @__PURE__ */ __name((attr) => {
|
|
19832
|
+
attrs[attr.name] = attr.value;
|
|
19833
|
+
}, "visitAttribute");
|
|
19834
|
+
let nodeName;
|
|
19835
|
+
let isVoid;
|
|
19836
|
+
if (node instanceof Element2) {
|
|
19837
|
+
nodeName = node.name;
|
|
19838
|
+
isVoid = getHtmlTagDefinition(node.name).isVoid;
|
|
19839
|
+
} else {
|
|
19840
|
+
nodeName = node.fullName;
|
|
19841
|
+
isVoid = node.tagName ? getHtmlTagDefinition(node.tagName).isVoid : false;
|
|
19842
|
+
}
|
|
19843
|
+
node.attrs.forEach(visitAttribute);
|
|
19844
|
+
node.directives.forEach((dir) => dir.attrs.forEach(visitAttribute));
|
|
19845
|
+
const startPhName = context.placeholderRegistry.getStartTagPlaceholderName(nodeName, attrs, isVoid);
|
|
19846
|
+
context.placeholderToContent[startPhName] = {
|
|
19847
|
+
text: node.startSourceSpan.toString(),
|
|
19848
|
+
sourceSpan: node.startSourceSpan
|
|
19849
|
+
};
|
|
19850
|
+
let closePhName = "";
|
|
19851
|
+
if (!isVoid) {
|
|
19852
|
+
closePhName = context.placeholderRegistry.getCloseTagPlaceholderName(nodeName);
|
|
19853
|
+
context.placeholderToContent[closePhName] = {
|
|
19854
|
+
text: `</${nodeName}>`,
|
|
19855
|
+
sourceSpan: node.endSourceSpan ?? node.sourceSpan
|
|
19856
|
+
};
|
|
19857
|
+
}
|
|
19858
|
+
const i18nNode = new TagPlaceholder(nodeName, attrs, startPhName, closePhName, children, isVoid, node.sourceSpan, node.startSourceSpan, node.endSourceSpan);
|
|
19859
|
+
return context.visitNodeFn(node, i18nNode);
|
|
19860
|
+
}
|
|
19097
19861
|
/**
|
|
19098
19862
|
* Convert, text and interpolated tokens up into text and placeholder pieces.
|
|
19099
19863
|
*
|
|
@@ -19287,47 +20051,13 @@ var I18nMetaVisitor = class {
|
|
|
19287
20051
|
return new ParseTreeResult(result, this._errors);
|
|
19288
20052
|
}
|
|
19289
20053
|
visitElement(element2) {
|
|
19290
|
-
|
|
19291
|
-
if (hasI18nAttrs(element2)) {
|
|
19292
|
-
this.hasI18nMeta = true;
|
|
19293
|
-
const attrs = [];
|
|
19294
|
-
const attrsMeta = {};
|
|
19295
|
-
for (const attr of element2.attrs) {
|
|
19296
|
-
if (attr.name === I18N_ATTR) {
|
|
19297
|
-
const i18n2 = element2.i18n || attr.value;
|
|
19298
|
-
const originalNodeMap = /* @__PURE__ */ new Map();
|
|
19299
|
-
const trimmedNodes = this.preserveSignificantWhitespace ? element2.children : visitAllWithSiblings(new WhitespaceVisitor(false, originalNodeMap), element2.children);
|
|
19300
|
-
message = this._generateI18nMessage(trimmedNodes, i18n2, setI18nRefs(originalNodeMap));
|
|
19301
|
-
if (message.nodes.length === 0) {
|
|
19302
|
-
message = void 0;
|
|
19303
|
-
}
|
|
19304
|
-
element2.i18n = message;
|
|
19305
|
-
} else if (attr.name.startsWith(I18N_ATTR_PREFIX)) {
|
|
19306
|
-
const name = attr.name.slice(I18N_ATTR_PREFIX.length);
|
|
19307
|
-
if (isTrustedTypesSink(element2.name, name)) {
|
|
19308
|
-
this._reportError(attr, `Translating attribute '${name}' is disallowed for security reasons.`);
|
|
19309
|
-
} else {
|
|
19310
|
-
attrsMeta[name] = attr.value;
|
|
19311
|
-
}
|
|
19312
|
-
} else {
|
|
19313
|
-
attrs.push(attr);
|
|
19314
|
-
}
|
|
19315
|
-
}
|
|
19316
|
-
if (Object.keys(attrsMeta).length) {
|
|
19317
|
-
for (const attr of attrs) {
|
|
19318
|
-
const meta = attrsMeta[attr.name];
|
|
19319
|
-
if (meta !== void 0 && attr.value) {
|
|
19320
|
-
attr.i18n = this._generateI18nMessage([attr], attr.i18n || meta);
|
|
19321
|
-
}
|
|
19322
|
-
}
|
|
19323
|
-
}
|
|
19324
|
-
if (!this.keepI18nAttrs) {
|
|
19325
|
-
element2.attrs = attrs;
|
|
19326
|
-
}
|
|
19327
|
-
}
|
|
19328
|
-
visitAll(this, element2.children, message);
|
|
20054
|
+
this._visitElementLike(element2);
|
|
19329
20055
|
return element2;
|
|
19330
20056
|
}
|
|
20057
|
+
visitComponent(component, context) {
|
|
20058
|
+
this._visitElementLike(component);
|
|
20059
|
+
return component;
|
|
20060
|
+
}
|
|
19331
20061
|
visitExpansion(expansion, currentMessage) {
|
|
19332
20062
|
let message;
|
|
19333
20063
|
const meta = expansion.i18n;
|
|
@@ -19368,6 +20098,56 @@ var I18nMetaVisitor = class {
|
|
|
19368
20098
|
visitLetDeclaration(decl, context) {
|
|
19369
20099
|
return decl;
|
|
19370
20100
|
}
|
|
20101
|
+
visitDirective(directive, context) {
|
|
20102
|
+
return directive;
|
|
20103
|
+
}
|
|
20104
|
+
_visitElementLike(node) {
|
|
20105
|
+
let message = void 0;
|
|
20106
|
+
if (hasI18nAttrs(node)) {
|
|
20107
|
+
this.hasI18nMeta = true;
|
|
20108
|
+
const attrs = [];
|
|
20109
|
+
const attrsMeta = {};
|
|
20110
|
+
for (const attr of node.attrs) {
|
|
20111
|
+
if (attr.name === I18N_ATTR) {
|
|
20112
|
+
const i18n2 = node.i18n || attr.value;
|
|
20113
|
+
const originalNodeMap = /* @__PURE__ */ new Map();
|
|
20114
|
+
const trimmedNodes = this.preserveSignificantWhitespace ? node.children : visitAllWithSiblings(new WhitespaceVisitor(false, originalNodeMap), node.children);
|
|
20115
|
+
message = this._generateI18nMessage(trimmedNodes, i18n2, setI18nRefs(originalNodeMap));
|
|
20116
|
+
if (message.nodes.length === 0) {
|
|
20117
|
+
message = void 0;
|
|
20118
|
+
}
|
|
20119
|
+
node.i18n = message;
|
|
20120
|
+
} else if (attr.name.startsWith(I18N_ATTR_PREFIX)) {
|
|
20121
|
+
const name = attr.name.slice(I18N_ATTR_PREFIX.length);
|
|
20122
|
+
let isTrustedType;
|
|
20123
|
+
if (node instanceof Component2) {
|
|
20124
|
+
isTrustedType = node.tagName === null ? false : isTrustedTypesSink(node.tagName, name);
|
|
20125
|
+
} else {
|
|
20126
|
+
isTrustedType = isTrustedTypesSink(node.name, name);
|
|
20127
|
+
}
|
|
20128
|
+
if (isTrustedType) {
|
|
20129
|
+
this._reportError(attr, `Translating attribute '${name}' is disallowed for security reasons.`);
|
|
20130
|
+
} else {
|
|
20131
|
+
attrsMeta[name] = attr.value;
|
|
20132
|
+
}
|
|
20133
|
+
} else {
|
|
20134
|
+
attrs.push(attr);
|
|
20135
|
+
}
|
|
20136
|
+
}
|
|
20137
|
+
if (Object.keys(attrsMeta).length) {
|
|
20138
|
+
for (const attr of attrs) {
|
|
20139
|
+
const meta = attrsMeta[attr.name];
|
|
20140
|
+
if (meta !== void 0 && attr.value) {
|
|
20141
|
+
attr.i18n = this._generateI18nMessage([attr], attr.i18n || meta);
|
|
20142
|
+
}
|
|
20143
|
+
}
|
|
20144
|
+
}
|
|
20145
|
+
if (!this.keepI18nAttrs) {
|
|
20146
|
+
node.attrs = attrs;
|
|
20147
|
+
}
|
|
20148
|
+
}
|
|
20149
|
+
visitAll(this, node.children, message);
|
|
20150
|
+
}
|
|
19371
20151
|
/**
|
|
19372
20152
|
* Parse the general form `meta` passed into extract the explicit metadata needed to create a
|
|
19373
20153
|
* `Message`.
|
|
@@ -19863,6 +20643,8 @@ function liftLocalRefs(job) {
|
|
|
19863
20643
|
for (const op of unit.create) {
|
|
19864
20644
|
switch (op.kind) {
|
|
19865
20645
|
case OpKind.ElementStart:
|
|
20646
|
+
case OpKind.ConditionalCreate:
|
|
20647
|
+
case OpKind.ConditionalBranchCreate:
|
|
19866
20648
|
case OpKind.Template:
|
|
19867
20649
|
if (!Array.isArray(op.localRefs)) {
|
|
19868
20650
|
throw new Error(`AssertionError: expected localRefs to be an array still`);
|
|
@@ -19977,7 +20759,7 @@ function parseExtractedStyles(job) {
|
|
|
19977
20759
|
for (const op of unit.create) {
|
|
19978
20760
|
if (op.kind === OpKind.ExtractedAttribute && op.bindingKind === BindingKind.Attribute && isStringLiteral(op.expression)) {
|
|
19979
20761
|
const target = elements.get(op.target);
|
|
19980
|
-
if (target !== void 0 && target.kind === OpKind.Template && target.templateKind === TemplateKind.Structural) {
|
|
20762
|
+
if (target !== void 0 && (target.kind === OpKind.Template || target.kind === OpKind.ConditionalCreate || target.kind === OpKind.ConditionalBranchCreate) && target.templateKind === TemplateKind.Structural) {
|
|
19981
20763
|
continue;
|
|
19982
20764
|
}
|
|
19983
20765
|
if (op.name === "style") {
|
|
@@ -20014,7 +20796,7 @@ function addNamesToView(unit, baseName, state, compatibility) {
|
|
|
20014
20796
|
for (const op of unit.ops()) {
|
|
20015
20797
|
switch (op.kind) {
|
|
20016
20798
|
case OpKind.Property:
|
|
20017
|
-
case OpKind.
|
|
20799
|
+
case OpKind.DomProperty:
|
|
20018
20800
|
if (op.isAnimationTrigger) {
|
|
20019
20801
|
op.name = "@" + op.name;
|
|
20020
20802
|
}
|
|
@@ -20075,6 +20857,8 @@ function addNamesToView(unit, baseName, state, compatibility) {
|
|
|
20075
20857
|
addNamesToView(fallbackView, `${baseName}_ProjectionFallback_${op.handle.slot}`, state, compatibility);
|
|
20076
20858
|
}
|
|
20077
20859
|
break;
|
|
20860
|
+
case OpKind.ConditionalCreate:
|
|
20861
|
+
case OpKind.ConditionalBranchCreate:
|
|
20078
20862
|
case OpKind.Template:
|
|
20079
20863
|
if (!(unit instanceof ViewCompilationUnit)) {
|
|
20080
20864
|
throw new Error(`AssertionError: must be compiling a component`);
|
|
@@ -20239,21 +21023,6 @@ function disableBindings$1(job) {
|
|
|
20239
21023
|
}
|
|
20240
21024
|
}
|
|
20241
21025
|
__name(disableBindings$1, "disableBindings$1");
|
|
20242
|
-
function generateNullishCoalesceExpressions(job) {
|
|
20243
|
-
for (const unit of job.units) {
|
|
20244
|
-
for (const op of unit.ops()) {
|
|
20245
|
-
transformExpressionsInOp(op, (expr) => {
|
|
20246
|
-
if (!(expr instanceof BinaryOperatorExpr) || expr.operator !== BinaryOperator.NullishCoalesce) {
|
|
20247
|
-
return expr;
|
|
20248
|
-
}
|
|
20249
|
-
const assignment = new AssignTemporaryExpr(expr.lhs.clone(), job.allocateXrefId());
|
|
20250
|
-
const read = new ReadTemporaryExpr(assignment.xref);
|
|
20251
|
-
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);
|
|
20252
|
-
}, VisitorContextFlag.None);
|
|
20253
|
-
}
|
|
20254
|
-
}
|
|
20255
|
-
}
|
|
20256
|
-
__name(generateNullishCoalesceExpressions, "generateNullishCoalesceExpressions");
|
|
20257
21026
|
function kindTest(kind) {
|
|
20258
21027
|
return (op) => op.kind === kind;
|
|
20259
21028
|
}
|
|
@@ -20287,8 +21056,8 @@ var UPDATE_ORDERING = [
|
|
|
20287
21056
|
{ test: kindWithInterpolationTest(OpKind.Attribute, false) }
|
|
20288
21057
|
];
|
|
20289
21058
|
var UPDATE_HOST_ORDERING = [
|
|
20290
|
-
{ test: kindWithInterpolationTest(OpKind.
|
|
20291
|
-
{ test: kindWithInterpolationTest(OpKind.
|
|
21059
|
+
{ test: kindWithInterpolationTest(OpKind.DomProperty, true) },
|
|
21060
|
+
{ test: kindWithInterpolationTest(OpKind.DomProperty, false) },
|
|
20292
21061
|
{ test: kindTest(OpKind.Attribute) },
|
|
20293
21062
|
{ test: kindTest(OpKind.StyleMap), transform: keepLast },
|
|
20294
21063
|
{ test: kindTest(OpKind.ClassMap), transform: keepLast },
|
|
@@ -20304,7 +21073,7 @@ var handledOpKinds = /* @__PURE__ */ new Set([
|
|
|
20304
21073
|
OpKind.ClassProp,
|
|
20305
21074
|
OpKind.Property,
|
|
20306
21075
|
OpKind.TwoWayProperty,
|
|
20307
|
-
OpKind.
|
|
21076
|
+
OpKind.DomProperty,
|
|
20308
21077
|
OpKind.Attribute
|
|
20309
21078
|
]);
|
|
20310
21079
|
function orderOps(job) {
|
|
@@ -20461,6 +21230,8 @@ function propagateI18nBlocksToTemplates(unit, subTemplateIndex) {
|
|
|
20461
21230
|
}
|
|
20462
21231
|
i18nBlock = null;
|
|
20463
21232
|
break;
|
|
21233
|
+
case OpKind.ConditionalCreate:
|
|
21234
|
+
case OpKind.ConditionalBranchCreate:
|
|
20464
21235
|
case OpKind.Template:
|
|
20465
21236
|
subTemplateIndex = propagateI18nBlocksForView(unit.job.views.get(op.xref), i18nBlock, op.i18nPlaceholder, subTemplateIndex);
|
|
20466
21237
|
break;
|
|
@@ -20680,7 +21451,6 @@ __name(enableBindings, "enableBindings");
|
|
|
20680
21451
|
function listener(name, handlerFn, eventTargetResolver, syntheticHost, sourceSpan) {
|
|
20681
21452
|
const args = [literal(name), handlerFn];
|
|
20682
21453
|
if (eventTargetResolver !== null) {
|
|
20683
|
-
args.push(literal(false));
|
|
20684
21454
|
args.push(importExpr(eventTargetResolver));
|
|
20685
21455
|
}
|
|
20686
21456
|
return call(syntheticHost ? Identifiers.syntheticHostListener : Identifiers.listener, args, sourceSpan);
|
|
@@ -20920,6 +21690,44 @@ function i18nStart(slot, constIndex, subTemplateIndex, sourceSpan) {
|
|
|
20920
21690
|
return call(Identifiers.i18nStart, args, sourceSpan);
|
|
20921
21691
|
}
|
|
20922
21692
|
__name(i18nStart, "i18nStart");
|
|
21693
|
+
function conditionalCreate(slot, templateFnRef, decls, vars, tag, constIndex, localRefs, sourceSpan) {
|
|
21694
|
+
const args = [
|
|
21695
|
+
literal(slot),
|
|
21696
|
+
templateFnRef,
|
|
21697
|
+
literal(decls),
|
|
21698
|
+
literal(vars),
|
|
21699
|
+
literal(tag),
|
|
21700
|
+
literal(constIndex)
|
|
21701
|
+
];
|
|
21702
|
+
if (localRefs !== null) {
|
|
21703
|
+
args.push(literal(localRefs));
|
|
21704
|
+
args.push(importExpr(Identifiers.templateRefExtractor));
|
|
21705
|
+
}
|
|
21706
|
+
while (args[args.length - 1].isEquivalent(NULL_EXPR)) {
|
|
21707
|
+
args.pop();
|
|
21708
|
+
}
|
|
21709
|
+
return call(Identifiers.conditionalCreate, args, sourceSpan);
|
|
21710
|
+
}
|
|
21711
|
+
__name(conditionalCreate, "conditionalCreate");
|
|
21712
|
+
function conditionalBranchCreate(slot, templateFnRef, decls, vars, tag, constIndex, localRefs, sourceSpan) {
|
|
21713
|
+
const args = [
|
|
21714
|
+
literal(slot),
|
|
21715
|
+
templateFnRef,
|
|
21716
|
+
literal(decls),
|
|
21717
|
+
literal(vars),
|
|
21718
|
+
literal(tag),
|
|
21719
|
+
literal(constIndex)
|
|
21720
|
+
];
|
|
21721
|
+
if (localRefs !== null) {
|
|
21722
|
+
args.push(literal(localRefs));
|
|
21723
|
+
args.push(importExpr(Identifiers.templateRefExtractor));
|
|
21724
|
+
}
|
|
21725
|
+
while (args[args.length - 1].isEquivalent(NULL_EXPR)) {
|
|
21726
|
+
args.pop();
|
|
21727
|
+
}
|
|
21728
|
+
return call(Identifiers.conditionalBranchCreate, args, sourceSpan);
|
|
21729
|
+
}
|
|
21730
|
+
__name(conditionalBranchCreate, "conditionalBranchCreate");
|
|
20923
21731
|
function repeaterCreate(slot, viewFnName, decls, vars, tag, constIndex, trackByFn, trackByUsesComponentInstance, emptyViewFnName, emptyDecls, emptyVars, emptyTag, emptyConstIndex, sourceSpan) {
|
|
20924
21732
|
const args = [
|
|
20925
21733
|
literal(slot),
|
|
@@ -21074,13 +21882,10 @@ function propertyInterpolate(name, strings, expressions, sanitizer, sourceSpan)
|
|
|
21074
21882
|
return callVariadicInstruction(PROPERTY_INTERPOLATE_CONFIG, [literal(name)], interpolationArgs, extraArgs, sourceSpan);
|
|
21075
21883
|
}
|
|
21076
21884
|
__name(propertyInterpolate, "propertyInterpolate");
|
|
21077
|
-
function attributeInterpolate(name, strings, expressions, sanitizer, sourceSpan) {
|
|
21885
|
+
function attributeInterpolate(name, strings, expressions, sanitizer, namespace, sourceSpan) {
|
|
21078
21886
|
const interpolationArgs = collateInterpolationArgs(strings, expressions);
|
|
21079
|
-
const
|
|
21080
|
-
|
|
21081
|
-
extraArgs.push(sanitizer);
|
|
21082
|
-
}
|
|
21083
|
-
return callVariadicInstruction(ATTRIBUTE_INTERPOLATE_CONFIG, [literal(name)], interpolationArgs, extraArgs, sourceSpan);
|
|
21887
|
+
const value = callVariadicInstructionExpr(VALUE_INTERPOLATE_CONFIG, [], interpolationArgs, [], sourceSpan);
|
|
21888
|
+
return attribute(name, value, sanitizer, namespace);
|
|
21084
21889
|
}
|
|
21085
21890
|
__name(attributeInterpolate, "attributeInterpolate");
|
|
21086
21891
|
function stylePropInterpolate(name, strings, expressions, unit, sourceSpan) {
|
|
@@ -21102,14 +21907,14 @@ function classMapInterpolate(strings, expressions, sourceSpan) {
|
|
|
21102
21907
|
return callVariadicInstruction(CLASS_MAP_INTERPOLATE_CONFIG, [], interpolationArgs, [], sourceSpan);
|
|
21103
21908
|
}
|
|
21104
21909
|
__name(classMapInterpolate, "classMapInterpolate");
|
|
21105
|
-
function
|
|
21910
|
+
function domProperty(name, expression, sanitizer, sourceSpan) {
|
|
21106
21911
|
const args = [literal(name), expression];
|
|
21107
21912
|
if (sanitizer !== null) {
|
|
21108
21913
|
args.push(sanitizer);
|
|
21109
21914
|
}
|
|
21110
|
-
return call(Identifiers.
|
|
21915
|
+
return call(Identifiers.domProperty, args, sourceSpan);
|
|
21111
21916
|
}
|
|
21112
|
-
__name(
|
|
21917
|
+
__name(domProperty, "domProperty");
|
|
21113
21918
|
function syntheticHostProperty(name, expression, sourceSpan) {
|
|
21114
21919
|
return call(Identifiers.syntheticHostProperty, [literal(name), expression], sourceSpan);
|
|
21115
21920
|
}
|
|
@@ -21192,6 +21997,26 @@ var PROPERTY_INTERPOLATE_CONFIG = {
|
|
|
21192
21997
|
return (n - 1) / 2;
|
|
21193
21998
|
}, "mapping")
|
|
21194
21999
|
};
|
|
22000
|
+
var VALUE_INTERPOLATE_CONFIG = {
|
|
22001
|
+
constant: [
|
|
22002
|
+
Identifiers.interpolate,
|
|
22003
|
+
Identifiers.interpolate1,
|
|
22004
|
+
Identifiers.interpolate2,
|
|
22005
|
+
Identifiers.interpolate3,
|
|
22006
|
+
Identifiers.interpolate4,
|
|
22007
|
+
Identifiers.interpolate5,
|
|
22008
|
+
Identifiers.interpolate6,
|
|
22009
|
+
Identifiers.interpolate7,
|
|
22010
|
+
Identifiers.interpolate8
|
|
22011
|
+
],
|
|
22012
|
+
variable: Identifiers.interpolateV,
|
|
22013
|
+
mapping: /* @__PURE__ */ __name((n) => {
|
|
22014
|
+
if (n % 2 === 0) {
|
|
22015
|
+
throw new Error(`Expected odd number of arguments`);
|
|
22016
|
+
}
|
|
22017
|
+
return (n - 1) / 2;
|
|
22018
|
+
}, "mapping")
|
|
22019
|
+
};
|
|
21195
22020
|
var STYLE_PROP_INTERPOLATE_CONFIG = {
|
|
21196
22021
|
constant: [
|
|
21197
22022
|
Identifiers.styleProp,
|
|
@@ -21212,26 +22037,6 @@ var STYLE_PROP_INTERPOLATE_CONFIG = {
|
|
|
21212
22037
|
return (n - 1) / 2;
|
|
21213
22038
|
}, "mapping")
|
|
21214
22039
|
};
|
|
21215
|
-
var ATTRIBUTE_INTERPOLATE_CONFIG = {
|
|
21216
|
-
constant: [
|
|
21217
|
-
Identifiers.attribute,
|
|
21218
|
-
Identifiers.attributeInterpolate1,
|
|
21219
|
-
Identifiers.attributeInterpolate2,
|
|
21220
|
-
Identifiers.attributeInterpolate3,
|
|
21221
|
-
Identifiers.attributeInterpolate4,
|
|
21222
|
-
Identifiers.attributeInterpolate5,
|
|
21223
|
-
Identifiers.attributeInterpolate6,
|
|
21224
|
-
Identifiers.attributeInterpolate7,
|
|
21225
|
-
Identifiers.attributeInterpolate8
|
|
21226
|
-
],
|
|
21227
|
-
variable: Identifiers.attributeInterpolateV,
|
|
21228
|
-
mapping: /* @__PURE__ */ __name((n) => {
|
|
21229
|
-
if (n % 2 === 0) {
|
|
21230
|
-
throw new Error(`Expected odd number of arguments`);
|
|
21231
|
-
}
|
|
21232
|
-
return (n - 1) / 2;
|
|
21233
|
-
}, "mapping")
|
|
21234
|
-
};
|
|
21235
22040
|
var STYLE_MAP_INTERPOLATE_CONFIG = {
|
|
21236
22041
|
constant: [
|
|
21237
22042
|
Identifiers.styleMap,
|
|
@@ -21289,6 +22094,10 @@ var PURE_FUNCTION_CONFIG = {
|
|
|
21289
22094
|
};
|
|
21290
22095
|
function callVariadicInstructionExpr(config, baseArgs, interpolationArgs, extraArgs, sourceSpan) {
|
|
21291
22096
|
const n = config.mapping(interpolationArgs.length);
|
|
22097
|
+
const lastInterpolationArg = interpolationArgs.at(-1);
|
|
22098
|
+
if (extraArgs.length === 0 && interpolationArgs.length > 1 && lastInterpolationArg instanceof LiteralExpr && lastInterpolationArg.value === "") {
|
|
22099
|
+
interpolationArgs.pop();
|
|
22100
|
+
}
|
|
21292
22101
|
if (n < config.constant.length) {
|
|
21293
22102
|
return importExpr(config.constant[n]).callFn([...baseArgs, ...interpolationArgs, ...extraArgs], sourceSpan);
|
|
21294
22103
|
} else if (config.variable !== null) {
|
|
@@ -21467,6 +22276,26 @@ function reifyCreateOperations(unit, ops) {
|
|
|
21467
22276
|
}
|
|
21468
22277
|
OpList.replace(op, projection(op.handle.slot, op.projectionSlotIndex, op.attributes, fallbackViewFnName, fallbackDecls, fallbackVars, op.sourceSpan));
|
|
21469
22278
|
break;
|
|
22279
|
+
case OpKind.ConditionalCreate:
|
|
22280
|
+
if (!(unit instanceof ViewCompilationUnit)) {
|
|
22281
|
+
throw new Error(`AssertionError: must be compiling a component`);
|
|
22282
|
+
}
|
|
22283
|
+
if (Array.isArray(op.localRefs)) {
|
|
22284
|
+
throw new Error(`AssertionError: local refs array should have been extracted into a constant`);
|
|
22285
|
+
}
|
|
22286
|
+
const conditionalCreateChildView = unit.job.views.get(op.xref);
|
|
22287
|
+
OpList.replace(op, conditionalCreate(op.handle.slot, variable(conditionalCreateChildView.fnName), conditionalCreateChildView.decls, conditionalCreateChildView.vars, op.tag, op.attributes, op.localRefs, op.startSourceSpan));
|
|
22288
|
+
break;
|
|
22289
|
+
case OpKind.ConditionalBranchCreate:
|
|
22290
|
+
if (!(unit instanceof ViewCompilationUnit)) {
|
|
22291
|
+
throw new Error(`AssertionError: must be compiling a component`);
|
|
22292
|
+
}
|
|
22293
|
+
if (Array.isArray(op.localRefs)) {
|
|
22294
|
+
throw new Error(`AssertionError: local refs array should have been extracted into a constant`);
|
|
22295
|
+
}
|
|
22296
|
+
const conditionalBranchCreateChildView = unit.job.views.get(op.xref);
|
|
22297
|
+
OpList.replace(op, conditionalBranchCreate(op.handle.slot, variable(conditionalBranchCreateChildView.fnName), conditionalBranchCreateChildView.decls, conditionalBranchCreateChildView.vars, op.tag, op.attributes, op.localRefs, op.startSourceSpan));
|
|
22298
|
+
break;
|
|
21470
22299
|
case OpKind.RepeaterCreate:
|
|
21471
22300
|
if (op.handle.slot === null) {
|
|
21472
22301
|
throw new Error("No slot was assigned for repeater instruction");
|
|
@@ -21569,19 +22398,19 @@ function reifyUpdateOperations(_unit, ops) {
|
|
|
21569
22398
|
break;
|
|
21570
22399
|
case OpKind.Attribute:
|
|
21571
22400
|
if (op.expression instanceof Interpolation2) {
|
|
21572
|
-
OpList.replace(op, attributeInterpolate(op.name, op.expression.strings, op.expression.expressions, op.sanitizer, op.sourceSpan));
|
|
22401
|
+
OpList.replace(op, attributeInterpolate(op.name, op.expression.strings, op.expression.expressions, op.sanitizer, op.namespace, op.sourceSpan));
|
|
21573
22402
|
} else {
|
|
21574
22403
|
OpList.replace(op, attribute(op.name, op.expression, op.sanitizer, op.namespace));
|
|
21575
22404
|
}
|
|
21576
22405
|
break;
|
|
21577
|
-
case OpKind.
|
|
22406
|
+
case OpKind.DomProperty:
|
|
21578
22407
|
if (op.expression instanceof Interpolation2) {
|
|
21579
22408
|
throw new Error("not yet handled");
|
|
21580
22409
|
} else {
|
|
21581
22410
|
if (op.isAnimationTrigger) {
|
|
21582
22411
|
OpList.replace(op, syntheticHostProperty(op.name, op.expression, op.sourceSpan));
|
|
21583
22412
|
} else {
|
|
21584
|
-
OpList.replace(op,
|
|
22413
|
+
OpList.replace(op, domProperty(op.name, op.expression, op.sanitizer, op.sourceSpan));
|
|
21585
22414
|
}
|
|
21586
22415
|
}
|
|
21587
22416
|
break;
|
|
@@ -21748,6 +22577,22 @@ function removeI18nContexts(job) {
|
|
|
21748
22577
|
}
|
|
21749
22578
|
}
|
|
21750
22579
|
__name(removeI18nContexts, "removeI18nContexts");
|
|
22580
|
+
function removeIllegalLetReferences(job) {
|
|
22581
|
+
for (const unit of job.units) {
|
|
22582
|
+
for (const op of unit.update) {
|
|
22583
|
+
if (op.kind !== OpKind.Variable || op.variable.kind !== SemanticVariableKind.Identifier || !(op.initializer instanceof StoreLetExpr)) {
|
|
22584
|
+
continue;
|
|
22585
|
+
}
|
|
22586
|
+
const name = op.variable.identifier;
|
|
22587
|
+
let current = op;
|
|
22588
|
+
while (current && current.kind !== OpKind.ListEnd) {
|
|
22589
|
+
transformExpressionsInOp(current, (expr) => expr instanceof LexicalReadExpr && expr.name === name ? literal(void 0) : expr, VisitorContextFlag.None);
|
|
22590
|
+
current = current.prev;
|
|
22591
|
+
}
|
|
22592
|
+
}
|
|
22593
|
+
}
|
|
22594
|
+
}
|
|
22595
|
+
__name(removeIllegalLetReferences, "removeIllegalLetReferences");
|
|
21751
22596
|
function removeUnusedI18nAttributesOps(job) {
|
|
21752
22597
|
for (const unit of job.units) {
|
|
21753
22598
|
const ownersWithI18nExpressions = /* @__PURE__ */ new Set();
|
|
@@ -21816,6 +22661,30 @@ function processLexicalScope$1(view, ops) {
|
|
|
21816
22661
|
}
|
|
21817
22662
|
}
|
|
21818
22663
|
__name(processLexicalScope$1, "processLexicalScope$1");
|
|
22664
|
+
function resolveDeferDepsFns(job) {
|
|
22665
|
+
for (const unit of job.units) {
|
|
22666
|
+
for (const op of unit.create) {
|
|
22667
|
+
if (op.kind === OpKind.Defer) {
|
|
22668
|
+
if (op.resolverFn !== null) {
|
|
22669
|
+
continue;
|
|
22670
|
+
}
|
|
22671
|
+
if (op.ownResolverFn !== null) {
|
|
22672
|
+
if (op.handle.slot === null) {
|
|
22673
|
+
throw new Error("AssertionError: slot must be assigned before extracting defer deps functions");
|
|
22674
|
+
}
|
|
22675
|
+
const fullPathName = unit.fnName?.replace("_Template", "");
|
|
22676
|
+
op.resolverFn = job.pool.getSharedFunctionReference(
|
|
22677
|
+
op.ownResolverFn,
|
|
22678
|
+
`${fullPathName}_Defer_${op.handle.slot}_DepsFn`,
|
|
22679
|
+
/* Don't use unique names for TDB compatibility */
|
|
22680
|
+
false
|
|
22681
|
+
);
|
|
22682
|
+
}
|
|
22683
|
+
}
|
|
22684
|
+
}
|
|
22685
|
+
}
|
|
22686
|
+
}
|
|
22687
|
+
__name(resolveDeferDepsFns, "resolveDeferDepsFns");
|
|
21819
22688
|
function resolveDollarEvent(job) {
|
|
21820
22689
|
for (const unit of job.units) {
|
|
21821
22690
|
transformDollarEvent(unit.create);
|
|
@@ -21903,6 +22772,8 @@ function resolvePlaceholdersForView(job, unit, i18nContexts, elements, pendingSt
|
|
|
21903
22772
|
pendingStructuralDirective = void 0;
|
|
21904
22773
|
}
|
|
21905
22774
|
break;
|
|
22775
|
+
case OpKind.ConditionalCreate:
|
|
22776
|
+
case OpKind.ConditionalBranchCreate:
|
|
21906
22777
|
case OpKind.Template:
|
|
21907
22778
|
const view = job.views.get(op.xref);
|
|
21908
22779
|
if (op.i18nPlaceholder === void 0) {
|
|
@@ -22184,7 +23055,7 @@ function resolveSanitizers(job) {
|
|
|
22184
23055
|
switch (op.kind) {
|
|
22185
23056
|
case OpKind.Property:
|
|
22186
23057
|
case OpKind.Attribute:
|
|
22187
|
-
case OpKind.
|
|
23058
|
+
case OpKind.DomProperty:
|
|
22188
23059
|
let sanitizerFn = null;
|
|
22189
23060
|
if (Array.isArray(op.securityContext) && op.securityContext.length === 2 && op.securityContext.indexOf(SecurityContext.URL) > -1 && op.securityContext.indexOf(SecurityContext.RESOURCE_URL) > -1) {
|
|
22190
23061
|
sanitizerFn = Identifiers.sanitizeUrlOrResourceUrl;
|
|
@@ -22194,7 +23065,7 @@ function resolveSanitizers(job) {
|
|
|
22194
23065
|
op.sanitizer = sanitizerFn !== null ? importExpr(sanitizerFn) : null;
|
|
22195
23066
|
if (op.sanitizer === null) {
|
|
22196
23067
|
let isIframe = false;
|
|
22197
|
-
if (job.kind === CompilationJobKind.Host || op.kind === OpKind.
|
|
23068
|
+
if (job.kind === CompilationJobKind.Host || op.kind === OpKind.DomProperty) {
|
|
22198
23069
|
isIframe = true;
|
|
22199
23070
|
} else {
|
|
22200
23071
|
const ownerOp = elements.get(op.target);
|
|
@@ -22227,28 +23098,6 @@ function getOnlySecurityContext(securityContext) {
|
|
|
22227
23098
|
return securityContext;
|
|
22228
23099
|
}
|
|
22229
23100
|
__name(getOnlySecurityContext, "getOnlySecurityContext");
|
|
22230
|
-
function transformTwoWayBindingSet(job) {
|
|
22231
|
-
for (const unit of job.units) {
|
|
22232
|
-
for (const op of unit.create) {
|
|
22233
|
-
if (op.kind === OpKind.TwoWayListener) {
|
|
22234
|
-
transformExpressionsInOp(op, (expr) => {
|
|
22235
|
-
if (!(expr instanceof TwoWayBindingSetExpr)) {
|
|
22236
|
-
return expr;
|
|
22237
|
-
}
|
|
22238
|
-
const { target, value } = expr;
|
|
22239
|
-
if (target instanceof ReadPropExpr || target instanceof ReadKeyExpr) {
|
|
22240
|
-
return twoWayBindingSet(target, value).or(target.set(value));
|
|
22241
|
-
}
|
|
22242
|
-
if (target instanceof ReadVariableExpr) {
|
|
22243
|
-
return twoWayBindingSet(target, value);
|
|
22244
|
-
}
|
|
22245
|
-
throw new Error(`Unsupported expression in two-way action binding.`);
|
|
22246
|
-
}, VisitorContextFlag.InChildOperation);
|
|
22247
|
-
}
|
|
22248
|
-
}
|
|
22249
|
-
}
|
|
22250
|
-
}
|
|
22251
|
-
__name(transformTwoWayBindingSet, "transformTwoWayBindingSet");
|
|
22252
23101
|
function saveAndRestoreView(job) {
|
|
22253
23102
|
for (const unit of job.units) {
|
|
22254
23103
|
unit.create.prepend([
|
|
@@ -22310,7 +23159,7 @@ function allocateSlots(job) {
|
|
|
22310
23159
|
}
|
|
22311
23160
|
for (const unit of job.units) {
|
|
22312
23161
|
for (const op of unit.ops()) {
|
|
22313
|
-
if (op.kind === OpKind.Template || op.kind === OpKind.RepeaterCreate) {
|
|
23162
|
+
if (op.kind === OpKind.Template || op.kind === OpKind.ConditionalCreate || op.kind === OpKind.ConditionalBranchCreate || op.kind === OpKind.RepeaterCreate) {
|
|
22314
23163
|
const childView = job.views.get(op.xref);
|
|
22315
23164
|
op.decls = childView.decls;
|
|
22316
23165
|
}
|
|
@@ -22318,25 +23167,115 @@ function allocateSlots(job) {
|
|
|
22318
23167
|
}
|
|
22319
23168
|
}
|
|
22320
23169
|
__name(allocateSlots, "allocateSlots");
|
|
22321
|
-
function
|
|
23170
|
+
function optimizeStoreLet(job) {
|
|
23171
|
+
const letUsedExternally = /* @__PURE__ */ new Set();
|
|
23172
|
+
const declareLetOps = /* @__PURE__ */ new Map();
|
|
22322
23173
|
for (const unit of job.units) {
|
|
22323
|
-
for (const op of unit.
|
|
22324
|
-
if (op.kind
|
|
22325
|
-
|
|
23174
|
+
for (const op of unit.ops()) {
|
|
23175
|
+
if (op.kind === OpKind.DeclareLet) {
|
|
23176
|
+
declareLetOps.set(op.xref, op);
|
|
22326
23177
|
}
|
|
22327
|
-
|
|
22328
|
-
|
|
22329
|
-
|
|
22330
|
-
|
|
22331
|
-
|
|
22332
|
-
|
|
22333
|
-
|
|
22334
|
-
|
|
22335
|
-
|
|
22336
|
-
|
|
22337
|
-
|
|
22338
|
-
|
|
22339
|
-
|
|
23178
|
+
visitExpressionsInOp(op, (expr) => {
|
|
23179
|
+
if (expr instanceof ContextLetReferenceExpr) {
|
|
23180
|
+
letUsedExternally.add(expr.target);
|
|
23181
|
+
}
|
|
23182
|
+
});
|
|
23183
|
+
}
|
|
23184
|
+
}
|
|
23185
|
+
for (const unit of job.units) {
|
|
23186
|
+
for (const op of unit.update) {
|
|
23187
|
+
transformExpressionsInOp(op, (expr) => {
|
|
23188
|
+
if (expr instanceof StoreLetExpr && !letUsedExternally.has(expr.target)) {
|
|
23189
|
+
if (!hasPipe(expr)) {
|
|
23190
|
+
OpList.remove(declareLetOps.get(expr.target));
|
|
23191
|
+
}
|
|
23192
|
+
return expr.value;
|
|
23193
|
+
}
|
|
23194
|
+
return expr;
|
|
23195
|
+
}, VisitorContextFlag.None);
|
|
23196
|
+
}
|
|
23197
|
+
}
|
|
23198
|
+
}
|
|
23199
|
+
__name(optimizeStoreLet, "optimizeStoreLet");
|
|
23200
|
+
function hasPipe(root) {
|
|
23201
|
+
let result = false;
|
|
23202
|
+
transformExpressionsInExpression(root, (expr) => {
|
|
23203
|
+
if (expr instanceof PipeBindingExpr || expr instanceof PipeBindingVariadicExpr) {
|
|
23204
|
+
result = true;
|
|
23205
|
+
}
|
|
23206
|
+
return expr;
|
|
23207
|
+
}, VisitorContextFlag.None);
|
|
23208
|
+
return result;
|
|
23209
|
+
}
|
|
23210
|
+
__name(hasPipe, "hasPipe");
|
|
23211
|
+
function stripNonrequiredParentheses(job) {
|
|
23212
|
+
const requiredParens = /* @__PURE__ */ new Set();
|
|
23213
|
+
for (const unit of job.units) {
|
|
23214
|
+
for (const op of unit.ops()) {
|
|
23215
|
+
visitExpressionsInOp(op, (expr) => {
|
|
23216
|
+
if (expr instanceof BinaryOperatorExpr) {
|
|
23217
|
+
switch (expr.operator) {
|
|
23218
|
+
case BinaryOperator.Exponentiation:
|
|
23219
|
+
checkExponentiationParens(expr, requiredParens);
|
|
23220
|
+
break;
|
|
23221
|
+
case BinaryOperator.NullishCoalesce:
|
|
23222
|
+
checkNullishCoalescingParens(expr, requiredParens);
|
|
23223
|
+
break;
|
|
23224
|
+
}
|
|
23225
|
+
}
|
|
23226
|
+
});
|
|
23227
|
+
}
|
|
23228
|
+
}
|
|
23229
|
+
for (const unit of job.units) {
|
|
23230
|
+
for (const op of unit.ops()) {
|
|
23231
|
+
transformExpressionsInOp(op, (expr) => {
|
|
23232
|
+
if (expr instanceof ParenthesizedExpr) {
|
|
23233
|
+
return requiredParens.has(expr) ? expr : expr.expr;
|
|
23234
|
+
}
|
|
23235
|
+
return expr;
|
|
23236
|
+
}, VisitorContextFlag.None);
|
|
23237
|
+
}
|
|
23238
|
+
}
|
|
23239
|
+
}
|
|
23240
|
+
__name(stripNonrequiredParentheses, "stripNonrequiredParentheses");
|
|
23241
|
+
function checkExponentiationParens(expr, requiredParens) {
|
|
23242
|
+
if (expr.lhs instanceof ParenthesizedExpr && expr.lhs.expr instanceof UnaryOperatorExpr) {
|
|
23243
|
+
requiredParens.add(expr.lhs);
|
|
23244
|
+
}
|
|
23245
|
+
}
|
|
23246
|
+
__name(checkExponentiationParens, "checkExponentiationParens");
|
|
23247
|
+
function checkNullishCoalescingParens(expr, requiredParens) {
|
|
23248
|
+
if (expr.lhs instanceof ParenthesizedExpr && (isLogicalAndOr(expr.lhs.expr) || expr.lhs.expr instanceof ConditionalExpr)) {
|
|
23249
|
+
requiredParens.add(expr.lhs);
|
|
23250
|
+
}
|
|
23251
|
+
if (expr.rhs instanceof ParenthesizedExpr && (isLogicalAndOr(expr.rhs.expr) || expr.rhs.expr instanceof ConditionalExpr)) {
|
|
23252
|
+
requiredParens.add(expr.rhs);
|
|
23253
|
+
}
|
|
23254
|
+
}
|
|
23255
|
+
__name(checkNullishCoalescingParens, "checkNullishCoalescingParens");
|
|
23256
|
+
function isLogicalAndOr(expr) {
|
|
23257
|
+
return expr instanceof BinaryOperatorExpr && (expr.operator === BinaryOperator.And || expr.operator === BinaryOperator.Or);
|
|
23258
|
+
}
|
|
23259
|
+
__name(isLogicalAndOr, "isLogicalAndOr");
|
|
23260
|
+
function specializeStyleBindings(job) {
|
|
23261
|
+
for (const unit of job.units) {
|
|
23262
|
+
for (const op of unit.update) {
|
|
23263
|
+
if (op.kind !== OpKind.Binding) {
|
|
23264
|
+
continue;
|
|
23265
|
+
}
|
|
23266
|
+
switch (op.bindingKind) {
|
|
23267
|
+
case BindingKind.ClassName:
|
|
23268
|
+
if (op.expression instanceof Interpolation2) {
|
|
23269
|
+
throw new Error(`Unexpected interpolation in ClassName binding`);
|
|
23270
|
+
}
|
|
23271
|
+
OpList.replace(op, createClassPropOp(op.target, op.name, op.expression, op.sourceSpan));
|
|
23272
|
+
break;
|
|
23273
|
+
case BindingKind.StyleProperty:
|
|
23274
|
+
OpList.replace(op, createStylePropOp(op.target, op.name, op.expression, op.unit, op.sourceSpan));
|
|
23275
|
+
break;
|
|
23276
|
+
case BindingKind.Property:
|
|
23277
|
+
case BindingKind.Template:
|
|
23278
|
+
if (op.name === "style") {
|
|
22340
23279
|
OpList.replace(op, createStyleMapOp(op.target, op.expression, op.sourceSpan));
|
|
22341
23280
|
} else if (op.name === "class") {
|
|
22342
23281
|
OpList.replace(op, createClassMapOp(op.target, op.expression, op.sourceSpan));
|
|
@@ -22483,6 +23422,28 @@ function generateTrackVariables(job) {
|
|
|
22483
23422
|
}
|
|
22484
23423
|
}
|
|
22485
23424
|
__name(generateTrackVariables, "generateTrackVariables");
|
|
23425
|
+
function transformTwoWayBindingSet(job) {
|
|
23426
|
+
for (const unit of job.units) {
|
|
23427
|
+
for (const op of unit.create) {
|
|
23428
|
+
if (op.kind === OpKind.TwoWayListener) {
|
|
23429
|
+
transformExpressionsInOp(op, (expr) => {
|
|
23430
|
+
if (!(expr instanceof TwoWayBindingSetExpr)) {
|
|
23431
|
+
return expr;
|
|
23432
|
+
}
|
|
23433
|
+
const { target, value } = expr;
|
|
23434
|
+
if (target instanceof ReadPropExpr || target instanceof ReadKeyExpr) {
|
|
23435
|
+
return twoWayBindingSet(target, value).or(target.set(value));
|
|
23436
|
+
}
|
|
23437
|
+
if (target instanceof ReadVariableExpr) {
|
|
23438
|
+
return twoWayBindingSet(target, value);
|
|
23439
|
+
}
|
|
23440
|
+
throw new Error(`Unsupported expression in two-way action binding.`);
|
|
23441
|
+
}, VisitorContextFlag.InChildOperation);
|
|
23442
|
+
}
|
|
23443
|
+
}
|
|
23444
|
+
}
|
|
23445
|
+
}
|
|
23446
|
+
__name(transformTwoWayBindingSet, "transformTwoWayBindingSet");
|
|
22486
23447
|
function countVariables(job) {
|
|
22487
23448
|
for (const unit of job.units) {
|
|
22488
23449
|
let varCount = 0;
|
|
@@ -22527,7 +23488,7 @@ function countVariables(job) {
|
|
|
22527
23488
|
if (job instanceof ComponentCompilationJob) {
|
|
22528
23489
|
for (const unit of job.units) {
|
|
22529
23490
|
for (const op of unit.create) {
|
|
22530
|
-
if (op.kind !== OpKind.Template && op.kind !== OpKind.RepeaterCreate) {
|
|
23491
|
+
if (op.kind !== OpKind.Template && op.kind !== OpKind.RepeaterCreate && op.kind !== OpKind.ConditionalCreate && op.kind !== OpKind.ConditionalBranchCreate) {
|
|
22531
23492
|
continue;
|
|
22532
23493
|
}
|
|
22533
23494
|
const childView = job.views.get(op.xref);
|
|
@@ -22541,7 +23502,7 @@ function varsUsedByOp(op) {
|
|
|
22541
23502
|
let slots;
|
|
22542
23503
|
switch (op.kind) {
|
|
22543
23504
|
case OpKind.Property:
|
|
22544
|
-
case OpKind.
|
|
23505
|
+
case OpKind.DomProperty:
|
|
22545
23506
|
case OpKind.Attribute:
|
|
22546
23507
|
slots = 1;
|
|
22547
23508
|
if (op.expression instanceof Interpolation2 && !isSingletonInterpolation(op.expression)) {
|
|
@@ -22891,80 +23852,6 @@ function wrapI18nIcus(job) {
|
|
|
22891
23852
|
}
|
|
22892
23853
|
}
|
|
22893
23854
|
__name(wrapI18nIcus, "wrapI18nIcus");
|
|
22894
|
-
function optimizeStoreLet(job) {
|
|
22895
|
-
const letUsedExternally = /* @__PURE__ */ new Set();
|
|
22896
|
-
for (const unit of job.units) {
|
|
22897
|
-
for (const op of unit.ops()) {
|
|
22898
|
-
visitExpressionsInOp(op, (expr) => {
|
|
22899
|
-
if (expr instanceof ContextLetReferenceExpr) {
|
|
22900
|
-
letUsedExternally.add(expr.target);
|
|
22901
|
-
}
|
|
22902
|
-
});
|
|
22903
|
-
}
|
|
22904
|
-
}
|
|
22905
|
-
for (const unit of job.units) {
|
|
22906
|
-
for (const op of unit.update) {
|
|
22907
|
-
transformExpressionsInOp(op, (expression) => expression instanceof StoreLetExpr && !letUsedExternally.has(expression.target) ? expression.value : expression, VisitorContextFlag.None);
|
|
22908
|
-
}
|
|
22909
|
-
}
|
|
22910
|
-
}
|
|
22911
|
-
__name(optimizeStoreLet, "optimizeStoreLet");
|
|
22912
|
-
function removeIllegalLetReferences(job) {
|
|
22913
|
-
for (const unit of job.units) {
|
|
22914
|
-
for (const op of unit.update) {
|
|
22915
|
-
if (op.kind !== OpKind.Variable || op.variable.kind !== SemanticVariableKind.Identifier || !(op.initializer instanceof StoreLetExpr)) {
|
|
22916
|
-
continue;
|
|
22917
|
-
}
|
|
22918
|
-
const name = op.variable.identifier;
|
|
22919
|
-
let current = op;
|
|
22920
|
-
while (current && current.kind !== OpKind.ListEnd) {
|
|
22921
|
-
transformExpressionsInOp(current, (expr) => expr instanceof LexicalReadExpr && expr.name === name ? literal(void 0) : expr, VisitorContextFlag.None);
|
|
22922
|
-
current = current.prev;
|
|
22923
|
-
}
|
|
22924
|
-
}
|
|
22925
|
-
}
|
|
22926
|
-
}
|
|
22927
|
-
__name(removeIllegalLetReferences, "removeIllegalLetReferences");
|
|
22928
|
-
function generateLocalLetReferences(job) {
|
|
22929
|
-
for (const unit of job.units) {
|
|
22930
|
-
for (const op of unit.update) {
|
|
22931
|
-
if (op.kind !== OpKind.StoreLet) {
|
|
22932
|
-
continue;
|
|
22933
|
-
}
|
|
22934
|
-
const variable2 = {
|
|
22935
|
-
kind: SemanticVariableKind.Identifier,
|
|
22936
|
-
name: null,
|
|
22937
|
-
identifier: op.declaredName,
|
|
22938
|
-
local: true
|
|
22939
|
-
};
|
|
22940
|
-
OpList.replace(op, createVariableOp(job.allocateXrefId(), variable2, new StoreLetExpr(op.target, op.value, op.sourceSpan), VariableFlags.None));
|
|
22941
|
-
}
|
|
22942
|
-
}
|
|
22943
|
-
}
|
|
22944
|
-
__name(generateLocalLetReferences, "generateLocalLetReferences");
|
|
22945
|
-
function attachSourceLocations(job) {
|
|
22946
|
-
if (!job.enableDebugLocations || job.relativeTemplatePath === null) {
|
|
22947
|
-
return;
|
|
22948
|
-
}
|
|
22949
|
-
for (const unit of job.units) {
|
|
22950
|
-
const locations = [];
|
|
22951
|
-
for (const op of unit.create) {
|
|
22952
|
-
if (op.kind === OpKind.ElementStart || op.kind === OpKind.Element) {
|
|
22953
|
-
const start = op.startSourceSpan.start;
|
|
22954
|
-
locations.push({
|
|
22955
|
-
targetSlot: op.handle,
|
|
22956
|
-
offset: start.offset,
|
|
22957
|
-
line: start.line,
|
|
22958
|
-
column: start.col
|
|
22959
|
-
});
|
|
22960
|
-
}
|
|
22961
|
-
}
|
|
22962
|
-
if (locations.length > 0) {
|
|
22963
|
-
unit.create.push(createSourceLocationOp(job.relativeTemplatePath, locations));
|
|
22964
|
-
}
|
|
22965
|
-
}
|
|
22966
|
-
}
|
|
22967
|
-
__name(attachSourceLocations, "attachSourceLocations");
|
|
22968
23855
|
var phases = [
|
|
22969
23856
|
{ kind: CompilationJobKind.Tmpl, fn: removeContentSelectors },
|
|
22970
23857
|
{ kind: CompilationJobKind.Host, fn: parseHostStyleProperties },
|
|
@@ -22983,11 +23870,6 @@ var phases = [
|
|
|
22983
23870
|
{ kind: CompilationJobKind.Tmpl, fn: generateConditionalExpressions },
|
|
22984
23871
|
{ kind: CompilationJobKind.Tmpl, fn: createPipes },
|
|
22985
23872
|
{ kind: CompilationJobKind.Tmpl, fn: configureDeferInstructions },
|
|
22986
|
-
{ kind: CompilationJobKind.Tmpl, fn: convertI18nText },
|
|
22987
|
-
{ kind: CompilationJobKind.Tmpl, fn: convertI18nBindings },
|
|
22988
|
-
{ kind: CompilationJobKind.Tmpl, fn: removeUnusedI18nAttributesOps },
|
|
22989
|
-
{ kind: CompilationJobKind.Tmpl, fn: assignI18nSlotDependencies },
|
|
22990
|
-
{ kind: CompilationJobKind.Tmpl, fn: applyI18nExpressions },
|
|
22991
23873
|
{ kind: CompilationJobKind.Tmpl, fn: createVariadicPipes },
|
|
22992
23874
|
{ kind: CompilationJobKind.Both, fn: generatePureLiteralStructures },
|
|
22993
23875
|
{ kind: CompilationJobKind.Tmpl, fn: generateProjectionDefs },
|
|
@@ -23005,11 +23887,16 @@ var phases = [
|
|
|
23005
23887
|
{ kind: CompilationJobKind.Both, fn: resolveContexts },
|
|
23006
23888
|
{ kind: CompilationJobKind.Both, fn: resolveSanitizers },
|
|
23007
23889
|
{ kind: CompilationJobKind.Tmpl, fn: liftLocalRefs },
|
|
23008
|
-
{ kind: CompilationJobKind.Both, fn: generateNullishCoalesceExpressions },
|
|
23009
23890
|
{ kind: CompilationJobKind.Both, fn: expandSafeReads },
|
|
23891
|
+
{ kind: CompilationJobKind.Both, fn: stripNonrequiredParentheses },
|
|
23010
23892
|
{ kind: CompilationJobKind.Both, fn: generateTemporaryVariables },
|
|
23011
23893
|
{ kind: CompilationJobKind.Both, fn: optimizeVariables },
|
|
23012
23894
|
{ kind: CompilationJobKind.Both, fn: optimizeStoreLet },
|
|
23895
|
+
{ kind: CompilationJobKind.Tmpl, fn: convertI18nText },
|
|
23896
|
+
{ kind: CompilationJobKind.Tmpl, fn: convertI18nBindings },
|
|
23897
|
+
{ kind: CompilationJobKind.Tmpl, fn: removeUnusedI18nAttributesOps },
|
|
23898
|
+
{ kind: CompilationJobKind.Tmpl, fn: assignI18nSlotDependencies },
|
|
23899
|
+
{ kind: CompilationJobKind.Tmpl, fn: applyI18nExpressions },
|
|
23013
23900
|
{ kind: CompilationJobKind.Tmpl, fn: allocateSlots },
|
|
23014
23901
|
{ kind: CompilationJobKind.Tmpl, fn: resolveI18nElementPlaceholders },
|
|
23015
23902
|
{ kind: CompilationJobKind.Tmpl, fn: resolveI18nExpressionPlaceholders },
|
|
@@ -23159,7 +24046,7 @@ function ingestHostBinding(input, bindingParser, constantPool) {
|
|
|
23159
24046
|
bindingKind = BindingKind.Animation;
|
|
23160
24047
|
}
|
|
23161
24048
|
const securityContexts = bindingParser.calcPossibleSecurityContexts(input.componentSelector, property2.name, bindingKind === BindingKind.Attribute).filter((context) => context !== SecurityContext.NONE);
|
|
23162
|
-
|
|
24049
|
+
ingestDomProperty(job, property2, bindingKind, securityContexts);
|
|
23163
24050
|
}
|
|
23164
24051
|
for (const [name, expr] of Object.entries(input.attributes) ?? []) {
|
|
23165
24052
|
const securityContexts = bindingParser.calcPossibleSecurityContexts(input.componentSelector, name, true).filter((context) => context !== SecurityContext.NONE);
|
|
@@ -23171,7 +24058,7 @@ function ingestHostBinding(input, bindingParser, constantPool) {
|
|
|
23171
24058
|
return job;
|
|
23172
24059
|
}
|
|
23173
24060
|
__name(ingestHostBinding, "ingestHostBinding");
|
|
23174
|
-
function
|
|
24061
|
+
function ingestDomProperty(job, property2, bindingKind, securityContexts) {
|
|
23175
24062
|
let expression;
|
|
23176
24063
|
const ast = property2.expression.ast;
|
|
23177
24064
|
if (ast instanceof Interpolation$1) {
|
|
@@ -23194,7 +24081,7 @@ function ingestHostProperty(job, property2, bindingKind, securityContexts) {
|
|
|
23194
24081
|
property2.sourceSpan
|
|
23195
24082
|
));
|
|
23196
24083
|
}
|
|
23197
|
-
__name(
|
|
24084
|
+
__name(ingestDomProperty, "ingestDomProperty");
|
|
23198
24085
|
function ingestHostAttribute(job, name, value, securityContexts) {
|
|
23199
24086
|
const attrBinding = createBindingOp(
|
|
23200
24087
|
job.root.xref,
|
|
@@ -23246,7 +24133,8 @@ function ingestNodes(unit, template2) {
|
|
|
23246
24133
|
ingestForBlock(unit, node);
|
|
23247
24134
|
} else if (node instanceof LetDeclaration$1) {
|
|
23248
24135
|
ingestLetDeclaration(unit, node);
|
|
23249
|
-
} else
|
|
24136
|
+
} else if (node instanceof Component$1) ;
|
|
24137
|
+
else {
|
|
23250
24138
|
throw new Error(`Unsupported template node: ${node.constructor.name}`);
|
|
23251
24139
|
}
|
|
23252
24140
|
}
|
|
@@ -23364,13 +24252,14 @@ function ingestIfBlock(unit, ifBlock) {
|
|
|
23364
24252
|
}
|
|
23365
24253
|
ifCaseI18nMeta = ifCase.i18n;
|
|
23366
24254
|
}
|
|
23367
|
-
const
|
|
23368
|
-
|
|
24255
|
+
const createOp = i === 0 ? createConditionalCreateOp : createConditionalBranchCreateOp;
|
|
24256
|
+
const conditionalCreateOp = createOp(cView.xref, TemplateKind.Block, tagName, "Conditional", Namespace.HTML, ifCaseI18nMeta, ifCase.startSourceSpan, ifCase.sourceSpan);
|
|
24257
|
+
unit.create.push(conditionalCreateOp);
|
|
23369
24258
|
if (firstXref === null) {
|
|
23370
24259
|
firstXref = cView.xref;
|
|
23371
24260
|
}
|
|
23372
24261
|
const caseExpr = ifCase.expression ? convertAst(ifCase.expression, unit.job, null) : null;
|
|
23373
|
-
const conditionalCaseExpr = new ConditionalCaseExpr(caseExpr,
|
|
24262
|
+
const conditionalCaseExpr = new ConditionalCaseExpr(caseExpr, conditionalCreateOp.xref, conditionalCreateOp.handle, ifCase.expressionAlias);
|
|
23374
24263
|
conditions.push(conditionalCaseExpr);
|
|
23375
24264
|
ingestNodes(cView, ifCase.children);
|
|
23376
24265
|
}
|
|
@@ -23383,7 +24272,8 @@ function ingestSwitchBlock(unit, switchBlock) {
|
|
|
23383
24272
|
}
|
|
23384
24273
|
let firstXref = null;
|
|
23385
24274
|
let conditions = [];
|
|
23386
|
-
for (
|
|
24275
|
+
for (let i = 0; i < switchBlock.cases.length; i++) {
|
|
24276
|
+
const switchCase = switchBlock.cases[i];
|
|
23387
24277
|
const cView = unit.job.allocateView(unit.xref);
|
|
23388
24278
|
const tagName = ingestControlFlowInsertionPoint(unit, cView.xref, switchCase);
|
|
23389
24279
|
let switchCaseI18nMeta = void 0;
|
|
@@ -23393,13 +24283,14 @@ function ingestSwitchBlock(unit, switchBlock) {
|
|
|
23393
24283
|
}
|
|
23394
24284
|
switchCaseI18nMeta = switchCase.i18n;
|
|
23395
24285
|
}
|
|
23396
|
-
const
|
|
23397
|
-
|
|
24286
|
+
const createOp = i === 0 ? createConditionalCreateOp : createConditionalBranchCreateOp;
|
|
24287
|
+
const conditionalCreateOp = createOp(cView.xref, TemplateKind.Block, tagName, "Case", Namespace.HTML, switchCaseI18nMeta, switchCase.startSourceSpan, switchCase.sourceSpan);
|
|
24288
|
+
unit.create.push(conditionalCreateOp);
|
|
23398
24289
|
if (firstXref === null) {
|
|
23399
24290
|
firstXref = cView.xref;
|
|
23400
24291
|
}
|
|
23401
24292
|
const caseExpr = switchCase.expression ? convertAst(switchCase.expression, unit.job, switchBlock.startSourceSpan) : null;
|
|
23402
|
-
const conditionalCaseExpr = new ConditionalCaseExpr(caseExpr,
|
|
24293
|
+
const conditionalCaseExpr = new ConditionalCaseExpr(caseExpr, conditionalCreateOp.xref, conditionalCreateOp.handle);
|
|
23403
24294
|
conditions.push(conditionalCaseExpr);
|
|
23404
24295
|
ingestNodes(cView, switchCase.children);
|
|
23405
24296
|
}
|
|
@@ -23705,15 +24596,25 @@ function convertAst(ast, job, baseSourceSpan) {
|
|
|
23705
24596
|
return not(convertAst(ast.expression, job, baseSourceSpan), convertSourceSpan(ast.span, baseSourceSpan));
|
|
23706
24597
|
} else if (ast instanceof TypeofExpression) {
|
|
23707
24598
|
return typeofExpr(convertAst(ast.expression, job, baseSourceSpan));
|
|
24599
|
+
} else if (ast instanceof VoidExpression) {
|
|
24600
|
+
return new VoidExpr(convertAst(ast.expression, job, baseSourceSpan), void 0, convertSourceSpan(ast.span, baseSourceSpan));
|
|
23708
24601
|
} else if (ast instanceof TemplateLiteral) {
|
|
23709
|
-
return
|
|
23710
|
-
|
|
23711
|
-
|
|
24602
|
+
return convertTemplateLiteral(ast, job, baseSourceSpan);
|
|
24603
|
+
} else if (ast instanceof TaggedTemplateLiteral) {
|
|
24604
|
+
return new TaggedTemplateLiteralExpr(convertAst(ast.tag, job, baseSourceSpan), convertTemplateLiteral(ast.template, job, baseSourceSpan), void 0, convertSourceSpan(ast.span, baseSourceSpan));
|
|
24605
|
+
} else if (ast instanceof ParenthesizedExpression) {
|
|
24606
|
+
return new ParenthesizedExpr(convertAst(ast.expression, job, baseSourceSpan), void 0, convertSourceSpan(ast.span, baseSourceSpan));
|
|
23712
24607
|
} else {
|
|
23713
24608
|
throw new Error(`Unhandled expression type "${ast.constructor.name}" in file "${baseSourceSpan?.start.file.url}"`);
|
|
23714
24609
|
}
|
|
23715
24610
|
}
|
|
23716
24611
|
__name(convertAst, "convertAst");
|
|
24612
|
+
function convertTemplateLiteral(ast, job, baseSourceSpan) {
|
|
24613
|
+
return new TemplateLiteralExpr(ast.elements.map((el) => {
|
|
24614
|
+
return new TemplateLiteralElementExpr(el.text, convertSourceSpan(el.span, baseSourceSpan));
|
|
24615
|
+
}), ast.expressions.map((expr) => convertAst(expr, job, baseSourceSpan)), convertSourceSpan(ast.span, baseSourceSpan));
|
|
24616
|
+
}
|
|
24617
|
+
__name(convertTemplateLiteral, "convertTemplateLiteral");
|
|
23717
24618
|
function convertAstWithInterpolation(job, value, i18nMeta, sourceSpan) {
|
|
23718
24619
|
let expression;
|
|
23719
24620
|
if (value instanceof Interpolation$1) {
|
|
@@ -23942,16 +24843,12 @@ function ingestControlFlowInsertionPoint(unit, xref, node) {
|
|
|
23942
24843
|
}
|
|
23943
24844
|
__name(ingestControlFlowInsertionPoint, "ingestControlFlowInsertionPoint");
|
|
23944
24845
|
var ENABLE_TEMPLATE_SOURCE_LOCATIONS = false;
|
|
23945
|
-
function setEnableTemplateSourceLocations(value) {
|
|
23946
|
-
ENABLE_TEMPLATE_SOURCE_LOCATIONS = value;
|
|
23947
|
-
}
|
|
23948
|
-
__name(setEnableTemplateSourceLocations, "setEnableTemplateSourceLocations");
|
|
23949
24846
|
function getTemplateSourceLocationsEnabled() {
|
|
23950
24847
|
return ENABLE_TEMPLATE_SOURCE_LOCATIONS;
|
|
23951
24848
|
}
|
|
23952
24849
|
__name(getTemplateSourceLocationsEnabled, "getTemplateSourceLocationsEnabled");
|
|
23953
24850
|
function renderFlagCheckIfStmt(flags, statements) {
|
|
23954
|
-
return ifStmt(variable(RENDER_FLAGS).bitwiseAnd(literal(flags), null
|
|
24851
|
+
return ifStmt(variable(RENDER_FLAGS).bitwiseAnd(literal(flags), null), statements);
|
|
23955
24852
|
}
|
|
23956
24853
|
__name(renderFlagCheckIfStmt, "renderFlagCheckIfStmt");
|
|
23957
24854
|
function toQueryFlags(query) {
|
|
@@ -24389,10 +25286,16 @@ var BindingParser = class {
|
|
|
24389
25286
|
const prop = this._schemaRegistry.getMappedPropName(propName);
|
|
24390
25287
|
return calcPossibleSecurityContexts(this._schemaRegistry, selector, prop, isAttribute);
|
|
24391
25288
|
}
|
|
25289
|
+
parseEventListenerName(rawName) {
|
|
25290
|
+
const [target, eventName] = splitAtColon(rawName, [null, rawName]);
|
|
25291
|
+
return { eventName, target };
|
|
25292
|
+
}
|
|
25293
|
+
parseAnimationEventName(rawName) {
|
|
25294
|
+
const matches = splitAtPeriod(rawName, [rawName, null]);
|
|
25295
|
+
return { eventName: matches[0], phase: matches[1] === null ? null : matches[1].toLowerCase() };
|
|
25296
|
+
}
|
|
24392
25297
|
_parseAnimationEvent(name, expression, sourceSpan, handlerSpan, targetEvents, keySpan) {
|
|
24393
|
-
const
|
|
24394
|
-
const eventName = matches[0];
|
|
24395
|
-
const phase = matches[1].toLowerCase();
|
|
25298
|
+
const { eventName, phase } = this.parseAnimationEventName(name);
|
|
24396
25299
|
const ast = this._parseAction(expression, handlerSpan);
|
|
24397
25300
|
targetEvents.push(new ParsedEvent(eventName, phase, ParsedEventType.Animation, ast, sourceSpan, handlerSpan, keySpan));
|
|
24398
25301
|
if (eventName.length === 0) {
|
|
@@ -24407,7 +25310,7 @@ var BindingParser = class {
|
|
|
24407
25310
|
}
|
|
24408
25311
|
}
|
|
24409
25312
|
_parseRegularEvent(name, expression, isAssignmentEvent, sourceSpan, handlerSpan, targetMatchableAttrs, targetEvents, keySpan) {
|
|
24410
|
-
const
|
|
25313
|
+
const { eventName, target } = this.parseEventListenerName(name);
|
|
24411
25314
|
const prevErrorCount = this.errors.length;
|
|
24412
25315
|
const ast = this._parseAction(expression, handlerSpan);
|
|
24413
25316
|
const isValid = this.errors.length === prevErrorCount;
|
|
@@ -24479,13 +25382,19 @@ function isAnimationLabel(name) {
|
|
|
24479
25382
|
}
|
|
24480
25383
|
__name(isAnimationLabel, "isAnimationLabel");
|
|
24481
25384
|
function calcPossibleSecurityContexts(registry, selector, propName, isAttribute) {
|
|
24482
|
-
|
|
24483
|
-
|
|
24484
|
-
|
|
24485
|
-
|
|
24486
|
-
|
|
24487
|
-
ctxs
|
|
24488
|
-
|
|
25385
|
+
let ctxs;
|
|
25386
|
+
const nameToContext = /* @__PURE__ */ __name((elName) => registry.securityContext(elName, propName, isAttribute), "nameToContext");
|
|
25387
|
+
if (selector === null) {
|
|
25388
|
+
ctxs = registry.allKnownElementNames().map(nameToContext);
|
|
25389
|
+
} else {
|
|
25390
|
+
ctxs = [];
|
|
25391
|
+
CssSelector.parse(selector).forEach((selector2) => {
|
|
25392
|
+
const elementNames = selector2.element ? [selector2.element] : registry.allKnownElementNames();
|
|
25393
|
+
const notElementNames = new Set(selector2.notSelectors.filter((selector3) => selector3.isElementSelector()).map((selector3) => selector3.element));
|
|
25394
|
+
const possibleElementNames = elementNames.filter((elName) => !notElementNames.has(elName));
|
|
25395
|
+
ctxs.push(...possibleElementNames.map(nameToContext));
|
|
25396
|
+
});
|
|
25397
|
+
}
|
|
24489
25398
|
return ctxs.length === 0 ? [SecurityContext.NONE] : Array.from(new Set(ctxs)).sort();
|
|
24490
25399
|
}
|
|
24491
25400
|
__name(calcPossibleSecurityContexts, "calcPossibleSecurityContexts");
|
|
@@ -25408,6 +26317,15 @@ var BINDING_DELIMS = {
|
|
|
25408
26317
|
EVENT: { start: "(", end: ")" }
|
|
25409
26318
|
};
|
|
25410
26319
|
var TEMPLATE_ATTR_PREFIX = "*";
|
|
26320
|
+
var UNSUPPORTED_SELECTORLESS_TAGS = /* @__PURE__ */ new Set([
|
|
26321
|
+
"link",
|
|
26322
|
+
"style",
|
|
26323
|
+
"script",
|
|
26324
|
+
"ng-template",
|
|
26325
|
+
"ng-container",
|
|
26326
|
+
"ng-content"
|
|
26327
|
+
]);
|
|
26328
|
+
var UNSUPPORTED_SELECTORLESS_DIRECTIVE_ATTRS = /* @__PURE__ */ new Set(["ngProjectAs", "ngNonBindable"]);
|
|
25411
26329
|
function htmlAstToRender3Ast(htmlNodes, bindingParser, options) {
|
|
25412
26330
|
const transformer = new HtmlAstToIvyAst(bindingParser, options);
|
|
25413
26331
|
const ivyNodes = visitAll(transformer, htmlNodes, htmlNodes);
|
|
@@ -25470,56 +26388,8 @@ var HtmlAstToIvyAst = class {
|
|
|
25470
26388
|
return null;
|
|
25471
26389
|
}
|
|
25472
26390
|
const isTemplateElement = isNgTemplate(element2.name);
|
|
25473
|
-
const parsedProperties =
|
|
25474
|
-
const
|
|
25475
|
-
const variables = [];
|
|
25476
|
-
const references = [];
|
|
25477
|
-
const attributes = [];
|
|
25478
|
-
const i18nAttrsMeta = {};
|
|
25479
|
-
const templateParsedProperties = [];
|
|
25480
|
-
const templateVariables = [];
|
|
25481
|
-
let elementHasInlineTemplate = false;
|
|
25482
|
-
for (const attribute2 of element2.attrs) {
|
|
25483
|
-
let hasBinding = false;
|
|
25484
|
-
const normalizedName = normalizeAttributeName(attribute2.name);
|
|
25485
|
-
let isTemplateBinding = false;
|
|
25486
|
-
if (attribute2.i18n) {
|
|
25487
|
-
i18nAttrsMeta[attribute2.name] = attribute2.i18n;
|
|
25488
|
-
}
|
|
25489
|
-
if (normalizedName.startsWith(TEMPLATE_ATTR_PREFIX)) {
|
|
25490
|
-
if (elementHasInlineTemplate) {
|
|
25491
|
-
this.reportError(`Can't have multiple template bindings on one element. Use only one attribute prefixed with *`, attribute2.sourceSpan);
|
|
25492
|
-
}
|
|
25493
|
-
isTemplateBinding = true;
|
|
25494
|
-
elementHasInlineTemplate = true;
|
|
25495
|
-
const templateValue = attribute2.value;
|
|
25496
|
-
const templateKey = normalizedName.substring(TEMPLATE_ATTR_PREFIX.length);
|
|
25497
|
-
const parsedVariables = [];
|
|
25498
|
-
const absoluteValueOffset = attribute2.valueSpan ? attribute2.valueSpan.start.offset : (
|
|
25499
|
-
// If there is no value span the attribute does not have a value, like `attr` in
|
|
25500
|
-
//`<div attr></div>`. In this case, point to one character beyond the last character of
|
|
25501
|
-
// the attribute name.
|
|
25502
|
-
attribute2.sourceSpan.start.offset + attribute2.name.length
|
|
25503
|
-
);
|
|
25504
|
-
this.bindingParser.parseInlineTemplateBinding(
|
|
25505
|
-
templateKey,
|
|
25506
|
-
templateValue,
|
|
25507
|
-
attribute2.sourceSpan,
|
|
25508
|
-
absoluteValueOffset,
|
|
25509
|
-
[],
|
|
25510
|
-
templateParsedProperties,
|
|
25511
|
-
parsedVariables,
|
|
25512
|
-
true
|
|
25513
|
-
/* isIvyAst */
|
|
25514
|
-
);
|
|
25515
|
-
templateVariables.push(...parsedVariables.map((v) => new Variable(v.name, v.value, v.sourceSpan, v.keySpan, v.valueSpan)));
|
|
25516
|
-
} else {
|
|
25517
|
-
hasBinding = this.parseAttribute(isTemplateElement, attribute2, [], parsedProperties, boundEvents, variables, references);
|
|
25518
|
-
}
|
|
25519
|
-
if (!hasBinding && !isTemplateBinding) {
|
|
25520
|
-
attributes.push(this.visitAttribute(attribute2));
|
|
25521
|
-
}
|
|
25522
|
-
}
|
|
26391
|
+
const { attributes, boundEvents, references, variables, templateVariables, elementHasInlineTemplate, parsedProperties, templateParsedProperties, i18nAttrsMeta } = this.prepareAttributes(element2.attrs, isTemplateElement);
|
|
26392
|
+
const directives = this.extractDirectives(element2);
|
|
25523
26393
|
let children;
|
|
25524
26394
|
if (preparsedElement.nonBindable) {
|
|
25525
26395
|
children = visitAll(NON_BINDABLE_VISITOR, element2.children).flat(Infinity);
|
|
@@ -25530,32 +26400,19 @@ var HtmlAstToIvyAst = class {
|
|
|
25530
26400
|
if (preparsedElement.type === PreparsedElementType.NG_CONTENT) {
|
|
25531
26401
|
const selector = preparsedElement.selectAttr;
|
|
25532
26402
|
const attrs = element2.attrs.map((attr) => this.visitAttribute(attr));
|
|
25533
|
-
parsedElement = new Content(selector, attrs, children, element2.sourceSpan, element2.i18n);
|
|
26403
|
+
parsedElement = new Content(selector, attrs, children, element2.sourceSpan, element2.startSourceSpan, element2.endSourceSpan, element2.i18n);
|
|
25534
26404
|
this.ngContentSelectors.push(selector);
|
|
25535
26405
|
} else if (isTemplateElement) {
|
|
25536
|
-
const attrs = this.
|
|
25537
|
-
parsedElement = new Template(element2.name, attributes, attrs.bound, boundEvents, [
|
|
26406
|
+
const attrs = this.categorizePropertyAttributes(element2.name, parsedProperties, i18nAttrsMeta);
|
|
26407
|
+
parsedElement = new Template(element2.name, attributes, attrs.bound, boundEvents, directives, [
|
|
25538
26408
|
/* no template attributes */
|
|
25539
26409
|
], children, references, variables, element2.sourceSpan, element2.startSourceSpan, element2.endSourceSpan, element2.i18n);
|
|
25540
26410
|
} else {
|
|
25541
|
-
const attrs = this.
|
|
25542
|
-
parsedElement = new Element$1(element2.name, attributes, attrs.bound, boundEvents, children, references, element2.sourceSpan, element2.startSourceSpan, element2.endSourceSpan, element2.i18n);
|
|
26411
|
+
const attrs = this.categorizePropertyAttributes(element2.name, parsedProperties, i18nAttrsMeta);
|
|
26412
|
+
parsedElement = new Element$1(element2.name, attributes, attrs.bound, boundEvents, directives, children, references, element2.sourceSpan, element2.startSourceSpan, element2.endSourceSpan, element2.i18n);
|
|
25543
26413
|
}
|
|
25544
26414
|
if (elementHasInlineTemplate) {
|
|
25545
|
-
|
|
25546
|
-
const templateAttrs = [];
|
|
25547
|
-
attrs.literal.forEach((attr) => templateAttrs.push(attr));
|
|
25548
|
-
attrs.bound.forEach((attr) => templateAttrs.push(attr));
|
|
25549
|
-
const hoistedAttrs = parsedElement instanceof Element$1 ? {
|
|
25550
|
-
attributes: parsedElement.attributes,
|
|
25551
|
-
inputs: parsedElement.inputs,
|
|
25552
|
-
outputs: parsedElement.outputs
|
|
25553
|
-
} : { attributes: [], inputs: [], outputs: [] };
|
|
25554
|
-
const i18n2 = isTemplateElement && isI18nRootElement ? void 0 : element2.i18n;
|
|
25555
|
-
const name = parsedElement instanceof Template ? null : parsedElement.name;
|
|
25556
|
-
parsedElement = new Template(name, hoistedAttrs.attributes, hoistedAttrs.inputs, hoistedAttrs.outputs, templateAttrs, [parsedElement], [
|
|
25557
|
-
/* no references */
|
|
25558
|
-
], templateVariables, element2.sourceSpan, element2.startSourceSpan, element2.endSourceSpan, i18n2);
|
|
26415
|
+
parsedElement = this.wrapInTemplate(parsedElement, templateParsedProperties, templateVariables, i18nAttrsMeta, isTemplateElement, isI18nRootElement);
|
|
25559
26416
|
}
|
|
25560
26417
|
if (isI18nRootElement) {
|
|
25561
26418
|
this.inI18nBlock = false;
|
|
@@ -25606,6 +26463,40 @@ var HtmlAstToIvyAst = class {
|
|
|
25606
26463
|
}
|
|
25607
26464
|
return new LetDeclaration$1(decl.name, value, decl.sourceSpan, decl.nameSpan, decl.valueSpan);
|
|
25608
26465
|
}
|
|
26466
|
+
visitComponent(component) {
|
|
26467
|
+
const isI18nRootElement = isI18nRootNode(component.i18n);
|
|
26468
|
+
if (isI18nRootElement) {
|
|
26469
|
+
if (this.inI18nBlock) {
|
|
26470
|
+
this.reportError("Cannot mark a component as translatable inside of a translatable section. Please remove the nested i18n marker.", component.sourceSpan);
|
|
26471
|
+
}
|
|
26472
|
+
this.inI18nBlock = true;
|
|
26473
|
+
}
|
|
26474
|
+
if (component.tagName !== null && UNSUPPORTED_SELECTORLESS_TAGS.has(component.tagName)) {
|
|
26475
|
+
this.reportError(`Tag name "${component.tagName}" cannot be used as a component tag`, component.startSourceSpan);
|
|
26476
|
+
return null;
|
|
26477
|
+
}
|
|
26478
|
+
const { attributes, boundEvents, references, templateVariables, elementHasInlineTemplate, parsedProperties, templateParsedProperties, i18nAttrsMeta } = this.prepareAttributes(component.attrs, false);
|
|
26479
|
+
this.validateSelectorlessReferences(references);
|
|
26480
|
+
const directives = this.extractDirectives(component);
|
|
26481
|
+
let children;
|
|
26482
|
+
if (component.attrs.find((attr) => attr.name === "ngNonBindable")) {
|
|
26483
|
+
children = visitAll(NON_BINDABLE_VISITOR, component.children).flat(Infinity);
|
|
26484
|
+
} else {
|
|
26485
|
+
children = visitAll(this, component.children, component.children);
|
|
26486
|
+
}
|
|
26487
|
+
const attrs = this.categorizePropertyAttributes(component.tagName, parsedProperties, i18nAttrsMeta);
|
|
26488
|
+
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);
|
|
26489
|
+
if (elementHasInlineTemplate) {
|
|
26490
|
+
node = this.wrapInTemplate(node, templateParsedProperties, templateVariables, i18nAttrsMeta, false, isI18nRootElement);
|
|
26491
|
+
}
|
|
26492
|
+
if (isI18nRootElement) {
|
|
26493
|
+
this.inI18nBlock = false;
|
|
26494
|
+
}
|
|
26495
|
+
return node;
|
|
26496
|
+
}
|
|
26497
|
+
visitDirective() {
|
|
26498
|
+
return null;
|
|
26499
|
+
}
|
|
25609
26500
|
visitBlockParameter() {
|
|
25610
26501
|
return null;
|
|
25611
26502
|
}
|
|
@@ -25673,8 +26564,8 @@ var HtmlAstToIvyAst = class {
|
|
|
25673
26564
|
}
|
|
25674
26565
|
return relatedBlocks;
|
|
25675
26566
|
}
|
|
25676
|
-
|
|
25677
|
-
|
|
26567
|
+
/** Splits up the property attributes depending on whether they're static or bound. */
|
|
26568
|
+
categorizePropertyAttributes(elementName, properties, i18nPropsMeta) {
|
|
25678
26569
|
const bound = [];
|
|
25679
26570
|
const literal2 = [];
|
|
25680
26571
|
properties.forEach((prop) => {
|
|
@@ -25695,12 +26586,75 @@ var HtmlAstToIvyAst = class {
|
|
|
25695
26586
|
});
|
|
25696
26587
|
return { bound, literal: literal2 };
|
|
25697
26588
|
}
|
|
25698
|
-
|
|
25699
|
-
const
|
|
25700
|
-
const
|
|
25701
|
-
const
|
|
25702
|
-
const
|
|
25703
|
-
|
|
26589
|
+
prepareAttributes(attrs, isTemplateElement) {
|
|
26590
|
+
const parsedProperties = [];
|
|
26591
|
+
const boundEvents = [];
|
|
26592
|
+
const variables = [];
|
|
26593
|
+
const references = [];
|
|
26594
|
+
const attributes = [];
|
|
26595
|
+
const i18nAttrsMeta = {};
|
|
26596
|
+
const templateParsedProperties = [];
|
|
26597
|
+
const templateVariables = [];
|
|
26598
|
+
let elementHasInlineTemplate = false;
|
|
26599
|
+
for (const attribute2 of attrs) {
|
|
26600
|
+
let hasBinding = false;
|
|
26601
|
+
const normalizedName = normalizeAttributeName(attribute2.name);
|
|
26602
|
+
let isTemplateBinding = false;
|
|
26603
|
+
if (attribute2.i18n) {
|
|
26604
|
+
i18nAttrsMeta[attribute2.name] = attribute2.i18n;
|
|
26605
|
+
}
|
|
26606
|
+
if (normalizedName.startsWith(TEMPLATE_ATTR_PREFIX)) {
|
|
26607
|
+
if (elementHasInlineTemplate) {
|
|
26608
|
+
this.reportError(`Can't have multiple template bindings on one element. Use only one attribute prefixed with *`, attribute2.sourceSpan);
|
|
26609
|
+
}
|
|
26610
|
+
isTemplateBinding = true;
|
|
26611
|
+
elementHasInlineTemplate = true;
|
|
26612
|
+
const templateValue = attribute2.value;
|
|
26613
|
+
const templateKey = normalizedName.substring(TEMPLATE_ATTR_PREFIX.length);
|
|
26614
|
+
const parsedVariables = [];
|
|
26615
|
+
const absoluteValueOffset = attribute2.valueSpan ? attribute2.valueSpan.start.offset : (
|
|
26616
|
+
// If there is no value span the attribute does not have a value, like `attr` in
|
|
26617
|
+
//`<div attr></div>`. In this case, point to one character beyond the last character of
|
|
26618
|
+
// the attribute name.
|
|
26619
|
+
attribute2.sourceSpan.start.offset + attribute2.name.length
|
|
26620
|
+
);
|
|
26621
|
+
this.bindingParser.parseInlineTemplateBinding(
|
|
26622
|
+
templateKey,
|
|
26623
|
+
templateValue,
|
|
26624
|
+
attribute2.sourceSpan,
|
|
26625
|
+
absoluteValueOffset,
|
|
26626
|
+
[],
|
|
26627
|
+
templateParsedProperties,
|
|
26628
|
+
parsedVariables,
|
|
26629
|
+
true
|
|
26630
|
+
/* isIvyAst */
|
|
26631
|
+
);
|
|
26632
|
+
templateVariables.push(...parsedVariables.map((v) => new Variable(v.name, v.value, v.sourceSpan, v.keySpan, v.valueSpan)));
|
|
26633
|
+
} else {
|
|
26634
|
+
hasBinding = this.parseAttribute(isTemplateElement, attribute2, [], parsedProperties, boundEvents, variables, references);
|
|
26635
|
+
}
|
|
26636
|
+
if (!hasBinding && !isTemplateBinding) {
|
|
26637
|
+
attributes.push(this.visitAttribute(attribute2));
|
|
26638
|
+
}
|
|
26639
|
+
}
|
|
26640
|
+
return {
|
|
26641
|
+
attributes,
|
|
26642
|
+
boundEvents,
|
|
26643
|
+
references,
|
|
26644
|
+
variables,
|
|
26645
|
+
templateVariables,
|
|
26646
|
+
elementHasInlineTemplate,
|
|
26647
|
+
parsedProperties,
|
|
26648
|
+
templateParsedProperties,
|
|
26649
|
+
i18nAttrsMeta
|
|
26650
|
+
};
|
|
26651
|
+
}
|
|
26652
|
+
parseAttribute(isTemplateElement, attribute2, matchableAttributes, parsedProperties, boundEvents, variables, references) {
|
|
26653
|
+
const name = normalizeAttributeName(attribute2.name);
|
|
26654
|
+
const value = attribute2.value;
|
|
26655
|
+
const srcSpan = attribute2.sourceSpan;
|
|
26656
|
+
const absoluteOffset = attribute2.valueSpan ? attribute2.valueSpan.start.offset : srcSpan.start.offset;
|
|
26657
|
+
function createKeySpan(srcSpan2, prefix, identifier) {
|
|
25704
26658
|
const normalizationAdjustment = attribute2.name.length - name.length;
|
|
25705
26659
|
const keySpanStart = srcSpan2.start.moveBy(prefix.length + normalizationAdjustment);
|
|
25706
26660
|
const keySpanEnd = keySpanStart.moveBy(identifier.length);
|
|
@@ -25793,6 +26747,75 @@ var HtmlAstToIvyAst = class {
|
|
|
25793
26747
|
const hasBinding = this.bindingParser.parsePropertyInterpolation(name, value, srcSpan, attribute2.valueSpan, matchableAttributes, parsedProperties, keySpan, attribute2.valueTokens ?? null);
|
|
25794
26748
|
return hasBinding;
|
|
25795
26749
|
}
|
|
26750
|
+
extractDirectives(node) {
|
|
26751
|
+
const elementName = node instanceof Component2 ? node.tagName : node.name;
|
|
26752
|
+
const directives = [];
|
|
26753
|
+
const seenDirectives = /* @__PURE__ */ new Set();
|
|
26754
|
+
for (const directive of node.directives) {
|
|
26755
|
+
let invalid = false;
|
|
26756
|
+
for (const attr of directive.attrs) {
|
|
26757
|
+
if (attr.name.startsWith(TEMPLATE_ATTR_PREFIX)) {
|
|
26758
|
+
invalid = true;
|
|
26759
|
+
this.reportError(`Shorthand template syntax "${attr.name}" is not supported inside a directive context`, attr.sourceSpan);
|
|
26760
|
+
} else if (UNSUPPORTED_SELECTORLESS_DIRECTIVE_ATTRS.has(attr.name)) {
|
|
26761
|
+
invalid = true;
|
|
26762
|
+
this.reportError(`Attribute "${attr.name}" is not supported in a directive context`, attr.sourceSpan);
|
|
26763
|
+
}
|
|
26764
|
+
}
|
|
26765
|
+
if (!invalid && seenDirectives.has(directive.name)) {
|
|
26766
|
+
invalid = true;
|
|
26767
|
+
this.reportError(`Cannot apply directive "${directive.name}" multiple times on the same element`, directive.sourceSpan);
|
|
26768
|
+
}
|
|
26769
|
+
if (invalid) {
|
|
26770
|
+
continue;
|
|
26771
|
+
}
|
|
26772
|
+
const { attributes, parsedProperties, boundEvents, references, i18nAttrsMeta } = this.prepareAttributes(directive.attrs, false);
|
|
26773
|
+
this.validateSelectorlessReferences(references);
|
|
26774
|
+
const { bound: inputs } = this.categorizePropertyAttributes(elementName, parsedProperties, i18nAttrsMeta);
|
|
26775
|
+
for (const input of inputs) {
|
|
26776
|
+
if (input.type !== BindingType.Property && input.type !== BindingType.TwoWay) {
|
|
26777
|
+
invalid = true;
|
|
26778
|
+
this.reportError("Binding is not supported in a directive context", input.sourceSpan);
|
|
26779
|
+
}
|
|
26780
|
+
}
|
|
26781
|
+
if (invalid) {
|
|
26782
|
+
continue;
|
|
26783
|
+
}
|
|
26784
|
+
seenDirectives.add(directive.name);
|
|
26785
|
+
directives.push(new Directive$1(directive.name, attributes, inputs, boundEvents, references, directive.sourceSpan, directive.startSourceSpan, directive.endSourceSpan, void 0));
|
|
26786
|
+
}
|
|
26787
|
+
return directives;
|
|
26788
|
+
}
|
|
26789
|
+
wrapInTemplate(node, templateProperties, templateVariables, i18nAttrsMeta, isTemplateElement, isI18nRootElement) {
|
|
26790
|
+
const attrs = this.categorizePropertyAttributes("ng-template", templateProperties, i18nAttrsMeta);
|
|
26791
|
+
const templateAttrs = [];
|
|
26792
|
+
attrs.literal.forEach((attr) => templateAttrs.push(attr));
|
|
26793
|
+
attrs.bound.forEach((attr) => templateAttrs.push(attr));
|
|
26794
|
+
const hoistedAttrs = {
|
|
26795
|
+
attributes: [],
|
|
26796
|
+
inputs: [],
|
|
26797
|
+
outputs: []
|
|
26798
|
+
};
|
|
26799
|
+
if (node instanceof Element$1 || node instanceof Component$1) {
|
|
26800
|
+
hoistedAttrs.attributes.push(...node.attributes);
|
|
26801
|
+
hoistedAttrs.inputs.push(...node.inputs);
|
|
26802
|
+
hoistedAttrs.outputs.push(...node.outputs);
|
|
26803
|
+
}
|
|
26804
|
+
const i18n2 = isTemplateElement && isI18nRootElement ? void 0 : node.i18n;
|
|
26805
|
+
let name;
|
|
26806
|
+
if (node instanceof Component$1) {
|
|
26807
|
+
name = node.tagName;
|
|
26808
|
+
} else if (node instanceof Template) {
|
|
26809
|
+
name = null;
|
|
26810
|
+
} else {
|
|
26811
|
+
name = node.name;
|
|
26812
|
+
}
|
|
26813
|
+
return new Template(name, hoistedAttrs.attributes, hoistedAttrs.inputs, hoistedAttrs.outputs, [
|
|
26814
|
+
// Do not copy over the directives.
|
|
26815
|
+
], templateAttrs, [node], [
|
|
26816
|
+
// Do not copy over the references.
|
|
26817
|
+
], templateVariables, node.sourceSpan, node.startSourceSpan, node.endSourceSpan, i18n2);
|
|
26818
|
+
}
|
|
25796
26819
|
_visitTextWithInterpolation(value, sourceSpan, interpolatedTokens, i18n2) {
|
|
25797
26820
|
const valueNoNgsp = replaceNgsp(value);
|
|
25798
26821
|
const expr = this.bindingParser.parseInterpolation(valueNoNgsp, sourceSpan, interpolatedTokens);
|
|
@@ -25831,6 +26854,21 @@ var HtmlAstToIvyAst = class {
|
|
|
25831
26854
|
);
|
|
25832
26855
|
addEvents(events, boundEvents);
|
|
25833
26856
|
}
|
|
26857
|
+
validateSelectorlessReferences(references) {
|
|
26858
|
+
if (references.length === 0) {
|
|
26859
|
+
return;
|
|
26860
|
+
}
|
|
26861
|
+
const seenNames = /* @__PURE__ */ new Set();
|
|
26862
|
+
for (const ref of references) {
|
|
26863
|
+
if (ref.value.length > 0) {
|
|
26864
|
+
this.reportError("Cannot specify a value for a local reference in this context", ref.valueSpan || ref.sourceSpan);
|
|
26865
|
+
} else if (seenNames.has(ref.name)) {
|
|
26866
|
+
this.reportError("Duplicate reference names are not allowed", ref.sourceSpan);
|
|
26867
|
+
} else {
|
|
26868
|
+
seenNames.add(ref.name);
|
|
26869
|
+
}
|
|
26870
|
+
}
|
|
26871
|
+
}
|
|
25834
26872
|
reportError(message, sourceSpan, level = ParseErrorLevel.ERROR) {
|
|
25835
26873
|
this.errors.push(new ParseError(sourceSpan, message, level));
|
|
25836
26874
|
}
|
|
@@ -25852,6 +26890,8 @@ var NonBindableVisitor = class {
|
|
|
25852
26890
|
[],
|
|
25853
26891
|
/* outputs */
|
|
25854
26892
|
[],
|
|
26893
|
+
/* directives */
|
|
26894
|
+
[],
|
|
25855
26895
|
children,
|
|
25856
26896
|
/* references */
|
|
25857
26897
|
[],
|
|
@@ -25893,6 +26933,28 @@ var NonBindableVisitor = class {
|
|
|
25893
26933
|
visitLetDeclaration(decl, context) {
|
|
25894
26934
|
return new Text$3(`@let ${decl.name} = ${decl.value};`, decl.sourceSpan);
|
|
25895
26935
|
}
|
|
26936
|
+
visitComponent(ast, context) {
|
|
26937
|
+
const children = visitAll(this, ast.children, null);
|
|
26938
|
+
return new Element$1(
|
|
26939
|
+
ast.fullName,
|
|
26940
|
+
visitAll(this, ast.attrs),
|
|
26941
|
+
/* inputs */
|
|
26942
|
+
[],
|
|
26943
|
+
/* outputs */
|
|
26944
|
+
[],
|
|
26945
|
+
/* directives */
|
|
26946
|
+
[],
|
|
26947
|
+
children,
|
|
26948
|
+
/* references */
|
|
26949
|
+
[],
|
|
26950
|
+
ast.sourceSpan,
|
|
26951
|
+
ast.startSourceSpan,
|
|
26952
|
+
ast.endSourceSpan
|
|
26953
|
+
);
|
|
26954
|
+
}
|
|
26955
|
+
visitDirective(directive, context) {
|
|
26956
|
+
return null;
|
|
26957
|
+
}
|
|
25896
26958
|
};
|
|
25897
26959
|
var NON_BINDABLE_VISITOR = new NonBindableVisitor();
|
|
25898
26960
|
function normalizeAttributeName(attrName) {
|
|
@@ -25921,7 +26983,8 @@ function parseTemplate(template2, templateUrl, options = {}) {
|
|
|
25921
26983
|
...options,
|
|
25922
26984
|
tokenizeExpansionForms: true,
|
|
25923
26985
|
tokenizeBlocks: options.enableBlockSyntax ?? true,
|
|
25924
|
-
tokenizeLet: options.enableLetSyntax ?? true
|
|
26986
|
+
tokenizeLet: options.enableLetSyntax ?? true,
|
|
26987
|
+
selectorlessEnabled: options.enableSelectorless ?? false
|
|
25925
26988
|
});
|
|
25926
26989
|
if (!options.alwaysAttemptHtmlToR3AstConversion && parseResult.errors && parseResult.errors.length > 0) {
|
|
25927
26990
|
const parsedTemplate2 = {
|
|
@@ -26497,11 +27560,12 @@ var R3TargetBinder = class {
|
|
|
26497
27560
|
* metadata about the types referenced in the template.
|
|
26498
27561
|
*/
|
|
26499
27562
|
bind(target) {
|
|
26500
|
-
if (!target.template) {
|
|
27563
|
+
if (!target.template && !target.host) {
|
|
26501
27564
|
throw new Error("Empty bound targets are not supported");
|
|
26502
27565
|
}
|
|
26503
27566
|
const directives = /* @__PURE__ */ new Map();
|
|
26504
27567
|
const eagerDirectives = [];
|
|
27568
|
+
const missingDirectives = /* @__PURE__ */ new Set();
|
|
26505
27569
|
const bindings = /* @__PURE__ */ new Map();
|
|
26506
27570
|
const references = /* @__PURE__ */ new Map();
|
|
26507
27571
|
const scopedNodeEntities = /* @__PURE__ */ new Map();
|
|
@@ -26514,10 +27578,15 @@ var R3TargetBinder = class {
|
|
|
26514
27578
|
if (target.template) {
|
|
26515
27579
|
const scope = Scope2.apply(target.template);
|
|
26516
27580
|
extractScopedNodeEntities(scope, scopedNodeEntities);
|
|
26517
|
-
|
|
27581
|
+
if (this.directiveMatcher !== null) {
|
|
27582
|
+
DirectiveBinder.apply(target.template, this.directiveMatcher, directives, eagerDirectives, missingDirectives, bindings, references);
|
|
27583
|
+
}
|
|
26518
27584
|
TemplateBinder.applyWithScope(target.template, scope, expressions, symbols, nestingLevel, usedPipes, eagerPipes, deferBlocks);
|
|
26519
27585
|
}
|
|
26520
|
-
|
|
27586
|
+
if (target.host) {
|
|
27587
|
+
TemplateBinder.applyWithScope(target.host, Scope2.apply(target.host), expressions, symbols, nestingLevel, usedPipes, eagerPipes, deferBlocks);
|
|
27588
|
+
}
|
|
27589
|
+
return new R3BoundTarget(target, directives, eagerDirectives, missingDirectives, bindings, references, expressions, symbols, nestingLevel, scopedNodeEntities, usedPipes, eagerPipes, deferBlocks);
|
|
26521
27590
|
}
|
|
26522
27591
|
};
|
|
26523
27592
|
var Scope2 = class _Scope {
|
|
@@ -26531,9 +27600,9 @@ var Scope2 = class _Scope {
|
|
|
26531
27600
|
*/
|
|
26532
27601
|
namedEntities = /* @__PURE__ */ new Map();
|
|
26533
27602
|
/**
|
|
26534
|
-
* Set of
|
|
27603
|
+
* Set of element-like nodes that belong to this scope.
|
|
26535
27604
|
*/
|
|
26536
|
-
|
|
27605
|
+
elementLikeInScope = /* @__PURE__ */ new Set();
|
|
26537
27606
|
/**
|
|
26538
27607
|
* Child `Scope`s for immediately nested `ScopedNode`s.
|
|
26539
27608
|
*/
|
|
@@ -26575,16 +27644,15 @@ var Scope2 = class _Scope {
|
|
|
26575
27644
|
nodeOrNodes.children.forEach((node) => node.visit(this));
|
|
26576
27645
|
} else if (nodeOrNodes instanceof SwitchBlockCase || nodeOrNodes instanceof ForLoopBlockEmpty || nodeOrNodes instanceof DeferredBlock || nodeOrNodes instanceof DeferredBlockError || nodeOrNodes instanceof DeferredBlockPlaceholder || nodeOrNodes instanceof DeferredBlockLoading || nodeOrNodes instanceof Content) {
|
|
26577
27646
|
nodeOrNodes.children.forEach((node) => node.visit(this));
|
|
26578
|
-
} else {
|
|
27647
|
+
} else if (!(nodeOrNodes instanceof HostElement)) {
|
|
26579
27648
|
nodeOrNodes.forEach((node) => node.visit(this));
|
|
26580
27649
|
}
|
|
26581
27650
|
}
|
|
26582
27651
|
visitElement(element2) {
|
|
26583
|
-
|
|
26584
|
-
element2.children.forEach((node) => node.visit(this));
|
|
26585
|
-
this.elementsInScope.add(element2);
|
|
27652
|
+
this.visitElementLike(element2);
|
|
26586
27653
|
}
|
|
26587
27654
|
visitTemplate(template2) {
|
|
27655
|
+
template2.directives.forEach((node) => node.visit(this));
|
|
26588
27656
|
template2.references.forEach((node) => this.visitReference(node));
|
|
26589
27657
|
this.ingestScopedNode(template2);
|
|
26590
27658
|
}
|
|
@@ -26634,6 +27702,12 @@ var Scope2 = class _Scope {
|
|
|
26634
27702
|
visitLetDeclaration(decl) {
|
|
26635
27703
|
this.maybeDeclare(decl);
|
|
26636
27704
|
}
|
|
27705
|
+
visitComponent(component) {
|
|
27706
|
+
this.visitElementLike(component);
|
|
27707
|
+
}
|
|
27708
|
+
visitDirective(directive) {
|
|
27709
|
+
directive.references.forEach((current) => this.visitReference(current));
|
|
27710
|
+
}
|
|
26637
27711
|
// Unused visitors.
|
|
26638
27712
|
visitBoundAttribute(attr) {
|
|
26639
27713
|
}
|
|
@@ -26651,6 +27725,12 @@ var Scope2 = class _Scope {
|
|
|
26651
27725
|
}
|
|
26652
27726
|
visitUnknownBlock(block) {
|
|
26653
27727
|
}
|
|
27728
|
+
visitElementLike(node) {
|
|
27729
|
+
node.directives.forEach((current) => current.visit(this));
|
|
27730
|
+
node.references.forEach((current) => this.visitReference(current));
|
|
27731
|
+
node.children.forEach((current) => current.visit(this));
|
|
27732
|
+
this.elementLikeInScope.add(node);
|
|
27733
|
+
}
|
|
26654
27734
|
maybeDeclare(thing) {
|
|
26655
27735
|
if (!this.namedEntities.has(thing.name)) {
|
|
26656
27736
|
this.namedEntities.set(thing.name, thing);
|
|
@@ -26692,17 +27772,19 @@ var DirectiveBinder = class _DirectiveBinder {
|
|
|
26692
27772
|
static {
|
|
26693
27773
|
__name(this, "DirectiveBinder");
|
|
26694
27774
|
}
|
|
26695
|
-
|
|
27775
|
+
directiveMatcher;
|
|
26696
27776
|
directives;
|
|
26697
27777
|
eagerDirectives;
|
|
27778
|
+
missingDirectives;
|
|
26698
27779
|
bindings;
|
|
26699
27780
|
references;
|
|
26700
27781
|
// Indicates whether we are visiting elements within a `defer` block
|
|
26701
27782
|
isInDeferBlock = false;
|
|
26702
|
-
constructor(
|
|
26703
|
-
this.
|
|
27783
|
+
constructor(directiveMatcher, directives, eagerDirectives, missingDirectives, bindings, references) {
|
|
27784
|
+
this.directiveMatcher = directiveMatcher;
|
|
26704
27785
|
this.directives = directives;
|
|
26705
27786
|
this.eagerDirectives = eagerDirectives;
|
|
27787
|
+
this.missingDirectives = missingDirectives;
|
|
26706
27788
|
this.bindings = bindings;
|
|
26707
27789
|
this.references = references;
|
|
26708
27790
|
}
|
|
@@ -26718,8 +27800,8 @@ var DirectiveBinder = class _DirectiveBinder {
|
|
|
26718
27800
|
* map which resolves #references (`Reference`s) within the template to the named directive or
|
|
26719
27801
|
* template node.
|
|
26720
27802
|
*/
|
|
26721
|
-
static apply(template2,
|
|
26722
|
-
const matcher = new _DirectiveBinder(
|
|
27803
|
+
static apply(template2, directiveMatcher, directives, eagerDirectives, missingDirectives, bindings, references) {
|
|
27804
|
+
const matcher = new _DirectiveBinder(directiveMatcher, directives, eagerDirectives, missingDirectives, bindings, references);
|
|
26723
27805
|
matcher.ingest(template2);
|
|
26724
27806
|
}
|
|
26725
27807
|
ingest(template2) {
|
|
@@ -26731,45 +27813,6 @@ var DirectiveBinder = class _DirectiveBinder {
|
|
|
26731
27813
|
visitTemplate(template2) {
|
|
26732
27814
|
this.visitElementOrTemplate(template2);
|
|
26733
27815
|
}
|
|
26734
|
-
visitElementOrTemplate(node) {
|
|
26735
|
-
const cssSelector = createCssSelectorFromNode(node);
|
|
26736
|
-
const directives = [];
|
|
26737
|
-
this.matcher.match(cssSelector, (_selector, results) => directives.push(...results));
|
|
26738
|
-
if (directives.length > 0) {
|
|
26739
|
-
this.directives.set(node, directives);
|
|
26740
|
-
if (!this.isInDeferBlock) {
|
|
26741
|
-
this.eagerDirectives.push(...directives);
|
|
26742
|
-
}
|
|
26743
|
-
}
|
|
26744
|
-
node.references.forEach((ref) => {
|
|
26745
|
-
let dirTarget = null;
|
|
26746
|
-
if (ref.value.trim() === "") {
|
|
26747
|
-
dirTarget = directives.find((dir) => dir.isComponent) || null;
|
|
26748
|
-
} else {
|
|
26749
|
-
dirTarget = directives.find((dir) => dir.exportAs !== null && dir.exportAs.some((value) => value === ref.value)) || null;
|
|
26750
|
-
if (dirTarget === null) {
|
|
26751
|
-
return;
|
|
26752
|
-
}
|
|
26753
|
-
}
|
|
26754
|
-
if (dirTarget !== null) {
|
|
26755
|
-
this.references.set(ref, { directive: dirTarget, node });
|
|
26756
|
-
} else {
|
|
26757
|
-
this.references.set(ref, node);
|
|
26758
|
-
}
|
|
26759
|
-
});
|
|
26760
|
-
const setAttributeBinding = /* @__PURE__ */ __name((attribute2, ioType) => {
|
|
26761
|
-
const dir = directives.find((dir2) => dir2[ioType].hasBindingPropertyName(attribute2.name));
|
|
26762
|
-
const binding = dir !== void 0 ? dir : node;
|
|
26763
|
-
this.bindings.set(attribute2, binding);
|
|
26764
|
-
}, "setAttributeBinding");
|
|
26765
|
-
node.inputs.forEach((input) => setAttributeBinding(input, "inputs"));
|
|
26766
|
-
node.attributes.forEach((attr) => setAttributeBinding(attr, "inputs"));
|
|
26767
|
-
if (node instanceof Template) {
|
|
26768
|
-
node.templateAttrs.forEach((attr) => setAttributeBinding(attr, "inputs"));
|
|
26769
|
-
}
|
|
26770
|
-
node.outputs.forEach((output) => setAttributeBinding(output, "outputs"));
|
|
26771
|
-
node.children.forEach((child) => child.visit(this));
|
|
26772
|
-
}
|
|
26773
27816
|
visitDeferredBlock(deferred) {
|
|
26774
27817
|
const wasInDeferBlock = this.isInDeferBlock;
|
|
26775
27818
|
this.isInDeferBlock = true;
|
|
@@ -26813,6 +27856,93 @@ var DirectiveBinder = class _DirectiveBinder {
|
|
|
26813
27856
|
visitContent(content) {
|
|
26814
27857
|
content.children.forEach((child) => child.visit(this));
|
|
26815
27858
|
}
|
|
27859
|
+
visitComponent(node) {
|
|
27860
|
+
if (this.directiveMatcher instanceof SelectorlessMatcher) {
|
|
27861
|
+
const componentMatches = this.directiveMatcher.match(node.componentName);
|
|
27862
|
+
if (componentMatches.length > 0) {
|
|
27863
|
+
this.trackSelectorlessMatchesAndDirectives(node, componentMatches);
|
|
27864
|
+
} else {
|
|
27865
|
+
this.missingDirectives.add(node.componentName);
|
|
27866
|
+
}
|
|
27867
|
+
}
|
|
27868
|
+
node.directives.forEach((directive) => directive.visit(this));
|
|
27869
|
+
node.children.forEach((child) => child.visit(this));
|
|
27870
|
+
}
|
|
27871
|
+
visitDirective(node) {
|
|
27872
|
+
if (this.directiveMatcher instanceof SelectorlessMatcher) {
|
|
27873
|
+
const directives = this.directiveMatcher.match(node.name);
|
|
27874
|
+
if (directives.length > 0) {
|
|
27875
|
+
this.trackSelectorlessMatchesAndDirectives(node, directives);
|
|
27876
|
+
} else {
|
|
27877
|
+
this.missingDirectives.add(node.name);
|
|
27878
|
+
}
|
|
27879
|
+
}
|
|
27880
|
+
}
|
|
27881
|
+
visitElementOrTemplate(node) {
|
|
27882
|
+
if (this.directiveMatcher instanceof SelectorMatcher) {
|
|
27883
|
+
const directives = [];
|
|
27884
|
+
const cssSelector = createCssSelectorFromNode(node);
|
|
27885
|
+
this.directiveMatcher.match(cssSelector, (_, results) => directives.push(...results));
|
|
27886
|
+
this.trackSelectorBasedBindingsAndDirectives(node, directives);
|
|
27887
|
+
}
|
|
27888
|
+
node.directives.forEach((directive) => directive.visit(this));
|
|
27889
|
+
node.children.forEach((child) => child.visit(this));
|
|
27890
|
+
}
|
|
27891
|
+
trackMatchedDirectives(node, directives) {
|
|
27892
|
+
if (directives.length > 0) {
|
|
27893
|
+
this.directives.set(node, directives);
|
|
27894
|
+
if (!this.isInDeferBlock) {
|
|
27895
|
+
this.eagerDirectives.push(...directives);
|
|
27896
|
+
}
|
|
27897
|
+
}
|
|
27898
|
+
}
|
|
27899
|
+
trackSelectorlessMatchesAndDirectives(node, directives) {
|
|
27900
|
+
if (directives.length === 0) {
|
|
27901
|
+
return;
|
|
27902
|
+
}
|
|
27903
|
+
this.trackMatchedDirectives(node, directives);
|
|
27904
|
+
const setBinding = /* @__PURE__ */ __name((meta, attribute2, ioType) => {
|
|
27905
|
+
if (meta[ioType].hasBindingPropertyName(attribute2.name)) {
|
|
27906
|
+
this.bindings.set(attribute2, meta);
|
|
27907
|
+
}
|
|
27908
|
+
}, "setBinding");
|
|
27909
|
+
for (const directive of directives) {
|
|
27910
|
+
node.inputs.forEach((input) => setBinding(directive, input, "inputs"));
|
|
27911
|
+
node.attributes.forEach((attr) => setBinding(directive, attr, "inputs"));
|
|
27912
|
+
node.outputs.forEach((output) => setBinding(directive, output, "outputs"));
|
|
27913
|
+
}
|
|
27914
|
+
node.references.forEach((ref) => this.references.set(ref, { directive: directives[0], node }));
|
|
27915
|
+
}
|
|
27916
|
+
trackSelectorBasedBindingsAndDirectives(node, directives) {
|
|
27917
|
+
this.trackMatchedDirectives(node, directives);
|
|
27918
|
+
node.references.forEach((ref) => {
|
|
27919
|
+
let dirTarget = null;
|
|
27920
|
+
if (ref.value.trim() === "") {
|
|
27921
|
+
dirTarget = directives.find((dir) => dir.isComponent) || null;
|
|
27922
|
+
} else {
|
|
27923
|
+
dirTarget = directives.find((dir) => dir.exportAs !== null && dir.exportAs.some((value) => value === ref.value)) || null;
|
|
27924
|
+
if (dirTarget === null) {
|
|
27925
|
+
return;
|
|
27926
|
+
}
|
|
27927
|
+
}
|
|
27928
|
+
if (dirTarget !== null) {
|
|
27929
|
+
this.references.set(ref, { directive: dirTarget, node });
|
|
27930
|
+
} else {
|
|
27931
|
+
this.references.set(ref, node);
|
|
27932
|
+
}
|
|
27933
|
+
});
|
|
27934
|
+
const setAttributeBinding = /* @__PURE__ */ __name((attribute2, ioType) => {
|
|
27935
|
+
const dir = directives.find((dir2) => dir2[ioType].hasBindingPropertyName(attribute2.name));
|
|
27936
|
+
const binding = dir !== void 0 ? dir : node;
|
|
27937
|
+
this.bindings.set(attribute2, binding);
|
|
27938
|
+
}, "setAttributeBinding");
|
|
27939
|
+
node.inputs.forEach((input) => setAttributeBinding(input, "inputs"));
|
|
27940
|
+
node.attributes.forEach((attr) => setAttributeBinding(attr, "inputs"));
|
|
27941
|
+
if (node instanceof Template) {
|
|
27942
|
+
node.templateAttrs.forEach((attr) => setAttributeBinding(attr, "inputs"));
|
|
27943
|
+
}
|
|
27944
|
+
node.outputs.forEach((output) => setAttributeBinding(output, "outputs"));
|
|
27945
|
+
}
|
|
26816
27946
|
// Unused visitors.
|
|
26817
27947
|
visitVariable(variable2) {
|
|
26818
27948
|
}
|
|
@@ -26879,7 +28009,7 @@ var TemplateBinder = class _TemplateBinder extends RecursiveAstVisitor2 {
|
|
|
26879
28009
|
/**
|
|
26880
28010
|
* Process a template and extract metadata about expressions and symbols within.
|
|
26881
28011
|
*
|
|
26882
|
-
* @param
|
|
28012
|
+
* @param nodeOrNodes the nodes of the template to process
|
|
26883
28013
|
* @param scope the `Scope` of the template being processed.
|
|
26884
28014
|
* @returns three maps which contain metadata about the template: `expressions` which interprets
|
|
26885
28015
|
* special `AST` nodes in expressions as pointing to references or variables declared within the
|
|
@@ -26888,10 +28018,10 @@ var TemplateBinder = class _TemplateBinder extends RecursiveAstVisitor2 {
|
|
|
26888
28018
|
* nesting level (how many levels deep within the template structure the `Template` is), starting
|
|
26889
28019
|
* at 1.
|
|
26890
28020
|
*/
|
|
26891
|
-
static applyWithScope(
|
|
26892
|
-
const template2 =
|
|
28021
|
+
static applyWithScope(nodeOrNodes, scope, expressions, symbols, nestingLevel, usedPipes, eagerPipes, deferBlocks) {
|
|
28022
|
+
const template2 = nodeOrNodes instanceof Template ? nodeOrNodes : null;
|
|
26893
28023
|
const binder = new _TemplateBinder(expressions, symbols, usedPipes, eagerPipes, deferBlocks, nestingLevel, scope, template2, 0);
|
|
26894
|
-
binder.ingest(
|
|
28024
|
+
binder.ingest(nodeOrNodes);
|
|
26895
28025
|
}
|
|
26896
28026
|
ingest(nodeOrNodes) {
|
|
26897
28027
|
if (nodeOrNodes instanceof Template) {
|
|
@@ -26920,6 +28050,8 @@ var TemplateBinder = class _TemplateBinder extends RecursiveAstVisitor2 {
|
|
|
26920
28050
|
} else if (nodeOrNodes instanceof SwitchBlockCase || nodeOrNodes instanceof ForLoopBlockEmpty || nodeOrNodes instanceof DeferredBlockError || nodeOrNodes instanceof DeferredBlockPlaceholder || nodeOrNodes instanceof DeferredBlockLoading || nodeOrNodes instanceof Content) {
|
|
26921
28051
|
nodeOrNodes.children.forEach((node) => node.visit(this));
|
|
26922
28052
|
this.nestingLevel.set(nodeOrNodes, this.level);
|
|
28053
|
+
} else if (nodeOrNodes instanceof HostElement) {
|
|
28054
|
+
this.nestingLevel.set(nodeOrNodes, 0);
|
|
26923
28055
|
} else {
|
|
26924
28056
|
nodeOrNodes.forEach(this.visitNode);
|
|
26925
28057
|
}
|
|
@@ -26927,12 +28059,14 @@ var TemplateBinder = class _TemplateBinder extends RecursiveAstVisitor2 {
|
|
|
26927
28059
|
visitElement(element2) {
|
|
26928
28060
|
element2.inputs.forEach(this.visitNode);
|
|
26929
28061
|
element2.outputs.forEach(this.visitNode);
|
|
28062
|
+
element2.directives.forEach(this.visitNode);
|
|
26930
28063
|
element2.children.forEach(this.visitNode);
|
|
26931
28064
|
element2.references.forEach(this.visitNode);
|
|
26932
28065
|
}
|
|
26933
28066
|
visitTemplate(template2) {
|
|
26934
28067
|
template2.inputs.forEach(this.visitNode);
|
|
26935
28068
|
template2.outputs.forEach(this.visitNode);
|
|
28069
|
+
template2.directives.forEach(this.visitNode);
|
|
26936
28070
|
template2.templateAttrs.forEach(this.visitNode);
|
|
26937
28071
|
template2.references.forEach(this.visitNode);
|
|
26938
28072
|
this.ingestScopedNode(template2);
|
|
@@ -26947,6 +28081,18 @@ var TemplateBinder = class _TemplateBinder extends RecursiveAstVisitor2 {
|
|
|
26947
28081
|
this.symbols.set(reference2, this.rootNode);
|
|
26948
28082
|
}
|
|
26949
28083
|
}
|
|
28084
|
+
visitComponent(component) {
|
|
28085
|
+
component.inputs.forEach(this.visitNode);
|
|
28086
|
+
component.outputs.forEach(this.visitNode);
|
|
28087
|
+
component.directives.forEach(this.visitNode);
|
|
28088
|
+
component.children.forEach(this.visitNode);
|
|
28089
|
+
component.references.forEach(this.visitNode);
|
|
28090
|
+
}
|
|
28091
|
+
visitDirective(directive) {
|
|
28092
|
+
directive.inputs.forEach(this.visitNode);
|
|
28093
|
+
directive.outputs.forEach(this.visitNode);
|
|
28094
|
+
directive.references.forEach(this.visitNode);
|
|
28095
|
+
}
|
|
26950
28096
|
// Unused template visitors
|
|
26951
28097
|
visitText(text2) {
|
|
26952
28098
|
}
|
|
@@ -27064,6 +28210,7 @@ var R3BoundTarget = class {
|
|
|
27064
28210
|
target;
|
|
27065
28211
|
directives;
|
|
27066
28212
|
eagerDirectives;
|
|
28213
|
+
missingDirectives;
|
|
27067
28214
|
bindings;
|
|
27068
28215
|
references;
|
|
27069
28216
|
exprTargets;
|
|
@@ -27076,10 +28223,11 @@ var R3BoundTarget = class {
|
|
|
27076
28223
|
deferredBlocks;
|
|
27077
28224
|
/** Map of deferred blocks to their scope. */
|
|
27078
28225
|
deferredScopes;
|
|
27079
|
-
constructor(target, directives, eagerDirectives, bindings, references, exprTargets, symbols, nestingLevel, scopedNodeEntities, usedPipes, eagerPipes, rawDeferred) {
|
|
28226
|
+
constructor(target, directives, eagerDirectives, missingDirectives, bindings, references, exprTargets, symbols, nestingLevel, scopedNodeEntities, usedPipes, eagerPipes, rawDeferred) {
|
|
27080
28227
|
this.target = target;
|
|
27081
28228
|
this.directives = directives;
|
|
27082
28229
|
this.eagerDirectives = eagerDirectives;
|
|
28230
|
+
this.missingDirectives = missingDirectives;
|
|
27083
28231
|
this.bindings = bindings;
|
|
27084
28232
|
this.references = references;
|
|
27085
28233
|
this.exprTargets = exprTargets;
|
|
@@ -27176,7 +28324,7 @@ var R3BoundTarget = class {
|
|
|
27176
28324
|
const stack = [this.deferredScopes.get(block)];
|
|
27177
28325
|
while (stack.length > 0) {
|
|
27178
28326
|
const current = stack.pop();
|
|
27179
|
-
if (current.
|
|
28327
|
+
if (current.elementLikeInScope.has(element2)) {
|
|
27180
28328
|
return true;
|
|
27181
28329
|
}
|
|
27182
28330
|
stack.push(...current.childScopes.values());
|
|
@@ -27184,6 +28332,9 @@ var R3BoundTarget = class {
|
|
|
27184
28332
|
}
|
|
27185
28333
|
return false;
|
|
27186
28334
|
}
|
|
28335
|
+
referencedDirectiveExists(name) {
|
|
28336
|
+
return !this.missingDirectives.has(name);
|
|
28337
|
+
}
|
|
27187
28338
|
/**
|
|
27188
28339
|
* Finds an entity with a specific name in a scope.
|
|
27189
28340
|
* @param rootNode Root node of the scope.
|
|
@@ -27203,7 +28354,7 @@ var R3BoundTarget = class {
|
|
|
27203
28354
|
if (target instanceof Element$1) {
|
|
27204
28355
|
return target;
|
|
27205
28356
|
}
|
|
27206
|
-
if (target instanceof Template) {
|
|
28357
|
+
if (target instanceof Template || target.node instanceof Component$1 || target.node instanceof Directive$1) {
|
|
27207
28358
|
return null;
|
|
27208
28359
|
}
|
|
27209
28360
|
return this.referenceTargetToElement(target.node);
|
|
@@ -27687,7 +28838,7 @@ function parseJitTemplate(template2, typeName, sourceMapUrl, preserveWhitespaces
|
|
|
27687
28838
|
const errors = parsed.errors.map((err) => err.toString()).join(", ");
|
|
27688
28839
|
throw new Error(`Errors during JIT compilation of template for ${typeName}: ${errors}`);
|
|
27689
28840
|
}
|
|
27690
|
-
const binder = new R3TargetBinder(
|
|
28841
|
+
const binder = new R3TargetBinder(null);
|
|
27691
28842
|
const boundTarget = binder.bind({ template: parsed.nodes });
|
|
27692
28843
|
return {
|
|
27693
28844
|
template: parsed,
|
|
@@ -27897,7 +29048,6 @@ function publishFacade(global) {
|
|
|
27897
29048
|
ng.\u0275compilerFacade = new CompilerFacadeImpl();
|
|
27898
29049
|
}
|
|
27899
29050
|
__name(publishFacade, "publishFacade");
|
|
27900
|
-
var VERSION = new Version("19.2.13");
|
|
27901
29051
|
var CompilerConfig = class {
|
|
27902
29052
|
static {
|
|
27903
29053
|
__name(this, "CompilerConfig");
|
|
@@ -27997,7 +29147,7 @@ var _Visitor3 = class {
|
|
|
27997
29147
|
merge(nodes, translations, interpolationConfig) {
|
|
27998
29148
|
this._init(_VisitorMode.Merge, interpolationConfig);
|
|
27999
29149
|
this._translations = translations;
|
|
28000
|
-
const wrapper = new Element2("wrapper", [], nodes, void 0, void 0, void 0);
|
|
29150
|
+
const wrapper = new Element2("wrapper", [], [], nodes, void 0, void 0, void 0);
|
|
28001
29151
|
const translatedNode = wrapper.visit(this, null);
|
|
28002
29152
|
if (this._inI18nBlock) {
|
|
28003
29153
|
this._reportError(nodes[nodes.length - 1], "Unclosed block");
|
|
@@ -28074,41 +29224,83 @@ var _Visitor3 = class {
|
|
|
28074
29224
|
return text2;
|
|
28075
29225
|
}
|
|
28076
29226
|
visitElement(el, context) {
|
|
28077
|
-
this.
|
|
29227
|
+
return this._visitElementLike(el, context);
|
|
29228
|
+
}
|
|
29229
|
+
visitAttribute(attribute2, context) {
|
|
29230
|
+
throw new Error("unreachable code");
|
|
29231
|
+
}
|
|
29232
|
+
visitBlock(block, context) {
|
|
29233
|
+
visitAll(this, block.children, context);
|
|
29234
|
+
}
|
|
29235
|
+
visitBlockParameter(parameter, context) {
|
|
29236
|
+
}
|
|
29237
|
+
visitLetDeclaration(decl, context) {
|
|
29238
|
+
}
|
|
29239
|
+
visitComponent(component, context) {
|
|
29240
|
+
return this._visitElementLike(component, context);
|
|
29241
|
+
}
|
|
29242
|
+
visitDirective(directive, context) {
|
|
29243
|
+
throw new Error("unreachable code");
|
|
29244
|
+
}
|
|
29245
|
+
_init(mode, interpolationConfig) {
|
|
29246
|
+
this._mode = mode;
|
|
29247
|
+
this._inI18nBlock = false;
|
|
29248
|
+
this._inI18nNode = false;
|
|
29249
|
+
this._depth = 0;
|
|
29250
|
+
this._inIcu = false;
|
|
29251
|
+
this._msgCountAtSectionStart = void 0;
|
|
29252
|
+
this._errors = [];
|
|
29253
|
+
this._messages = [];
|
|
29254
|
+
this._inImplicitNode = false;
|
|
29255
|
+
this._createI18nMessage = createI18nMessageFactory(
|
|
29256
|
+
interpolationConfig,
|
|
29257
|
+
DEFAULT_CONTAINER_BLOCKS,
|
|
29258
|
+
// When dropping significant whitespace we need to retain whitespace tokens or
|
|
29259
|
+
// else we won't be able to reuse source spans because empty tokens would be
|
|
29260
|
+
// removed and cause a mismatch.
|
|
29261
|
+
/* retainEmptyTokens */
|
|
29262
|
+
!this._preserveSignificantWhitespace,
|
|
29263
|
+
/* preserveExpressionWhitespace */
|
|
29264
|
+
this._preserveSignificantWhitespace
|
|
29265
|
+
);
|
|
29266
|
+
}
|
|
29267
|
+
_visitElementLike(node, context) {
|
|
29268
|
+
this._mayBeAddBlockChildren(node);
|
|
28078
29269
|
this._depth++;
|
|
28079
29270
|
const wasInI18nNode = this._inI18nNode;
|
|
28080
29271
|
const wasInImplicitNode = this._inImplicitNode;
|
|
28081
29272
|
let childNodes = [];
|
|
28082
29273
|
let translatedChildNodes = void 0;
|
|
28083
|
-
const
|
|
29274
|
+
const nodeName = node instanceof Component2 ? node.tagName : node.name;
|
|
29275
|
+
const i18nAttr = _getI18nAttr(node);
|
|
28084
29276
|
const i18nMeta = i18nAttr ? i18nAttr.value : "";
|
|
28085
|
-
const isImplicit = this._implicitTags.some((tag) =>
|
|
29277
|
+
const isImplicit = this._implicitTags.some((tag) => nodeName === tag) && !this._inIcu && !this._isInTranslatableSection;
|
|
28086
29278
|
const isTopLevelImplicit = !wasInImplicitNode && isImplicit;
|
|
28087
29279
|
this._inImplicitNode = wasInImplicitNode || isImplicit;
|
|
28088
29280
|
if (!this._isInTranslatableSection && !this._inIcu) {
|
|
28089
29281
|
if (i18nAttr || isTopLevelImplicit) {
|
|
28090
29282
|
this._inI18nNode = true;
|
|
28091
|
-
const message = this._addMessage(
|
|
28092
|
-
translatedChildNodes = this._translateMessage(
|
|
29283
|
+
const message = this._addMessage(node.children, i18nMeta);
|
|
29284
|
+
translatedChildNodes = this._translateMessage(node, message);
|
|
28093
29285
|
}
|
|
28094
29286
|
if (this._mode == _VisitorMode.Extract) {
|
|
28095
29287
|
const isTranslatable = i18nAttr || isTopLevelImplicit;
|
|
28096
29288
|
if (isTranslatable)
|
|
28097
|
-
this._openTranslatableSection(
|
|
28098
|
-
visitAll(this,
|
|
29289
|
+
this._openTranslatableSection(node);
|
|
29290
|
+
visitAll(this, node.children);
|
|
28099
29291
|
if (isTranslatable)
|
|
28100
|
-
this._closeTranslatableSection(
|
|
29292
|
+
this._closeTranslatableSection(node, node.children);
|
|
28101
29293
|
}
|
|
28102
29294
|
} else {
|
|
28103
29295
|
if (i18nAttr || isTopLevelImplicit) {
|
|
28104
|
-
this._reportError(
|
|
29296
|
+
this._reportError(node, "Could not mark an element as translatable inside a translatable section");
|
|
28105
29297
|
}
|
|
28106
29298
|
if (this._mode == _VisitorMode.Extract) {
|
|
28107
|
-
visitAll(this,
|
|
29299
|
+
visitAll(this, node.children);
|
|
28108
29300
|
}
|
|
28109
29301
|
}
|
|
28110
29302
|
if (this._mode === _VisitorMode.Merge) {
|
|
28111
|
-
const visitNodes = translatedChildNodes ||
|
|
29303
|
+
const visitNodes = translatedChildNodes || node.children;
|
|
28112
29304
|
visitNodes.forEach((child) => {
|
|
28113
29305
|
const visited = child.visit(this, context);
|
|
28114
29306
|
if (visited && !this._isInTranslatableSection) {
|
|
@@ -28116,53 +29308,26 @@ var _Visitor3 = class {
|
|
|
28116
29308
|
}
|
|
28117
29309
|
});
|
|
28118
29310
|
}
|
|
28119
|
-
this._visitAttributesOf(
|
|
29311
|
+
this._visitAttributesOf(node);
|
|
28120
29312
|
this._depth--;
|
|
28121
29313
|
this._inI18nNode = wasInI18nNode;
|
|
28122
29314
|
this._inImplicitNode = wasInImplicitNode;
|
|
28123
29315
|
if (this._mode === _VisitorMode.Merge) {
|
|
28124
|
-
|
|
28125
|
-
|
|
29316
|
+
if (node instanceof Element2) {
|
|
29317
|
+
return new Element2(node.name, this._translateAttributes(node), this._translateDirectives(node), childNodes, node.sourceSpan, node.startSourceSpan, node.endSourceSpan);
|
|
29318
|
+
} else {
|
|
29319
|
+
return new Component2(node.componentName, node.tagName, node.fullName, this._translateAttributes(node), this._translateDirectives(node), childNodes, node.sourceSpan, node.startSourceSpan, node.endSourceSpan);
|
|
29320
|
+
}
|
|
28126
29321
|
}
|
|
28127
29322
|
return null;
|
|
28128
29323
|
}
|
|
28129
|
-
visitAttribute(attribute2, context) {
|
|
28130
|
-
throw new Error("unreachable code");
|
|
28131
|
-
}
|
|
28132
|
-
visitBlock(block, context) {
|
|
28133
|
-
visitAll(this, block.children, context);
|
|
28134
|
-
}
|
|
28135
|
-
visitBlockParameter(parameter, context) {
|
|
28136
|
-
}
|
|
28137
|
-
visitLetDeclaration(decl, context) {
|
|
28138
|
-
}
|
|
28139
|
-
_init(mode, interpolationConfig) {
|
|
28140
|
-
this._mode = mode;
|
|
28141
|
-
this._inI18nBlock = false;
|
|
28142
|
-
this._inI18nNode = false;
|
|
28143
|
-
this._depth = 0;
|
|
28144
|
-
this._inIcu = false;
|
|
28145
|
-
this._msgCountAtSectionStart = void 0;
|
|
28146
|
-
this._errors = [];
|
|
28147
|
-
this._messages = [];
|
|
28148
|
-
this._inImplicitNode = false;
|
|
28149
|
-
this._createI18nMessage = createI18nMessageFactory(
|
|
28150
|
-
interpolationConfig,
|
|
28151
|
-
DEFAULT_CONTAINER_BLOCKS,
|
|
28152
|
-
// When dropping significant whitespace we need to retain whitespace tokens or
|
|
28153
|
-
// else we won't be able to reuse source spans because empty tokens would be
|
|
28154
|
-
// removed and cause a mismatch.
|
|
28155
|
-
/* retainEmptyTokens */
|
|
28156
|
-
!this._preserveSignificantWhitespace,
|
|
28157
|
-
/* preserveExpressionWhitespace */
|
|
28158
|
-
this._preserveSignificantWhitespace
|
|
28159
|
-
);
|
|
28160
|
-
}
|
|
28161
29324
|
// looks for translatable attributes
|
|
28162
29325
|
_visitAttributesOf(el) {
|
|
28163
29326
|
const explicitAttrNameToValue = {};
|
|
28164
|
-
const implicitAttrNames = this._implicitAttrs[el.name] || [];
|
|
28165
|
-
el.attrs.filter((attr) => attr.name.startsWith(_I18N_ATTR_PREFIX)).forEach((attr) =>
|
|
29327
|
+
const implicitAttrNames = this._implicitAttrs[el instanceof Component2 ? el.tagName || "" : el.name] || [];
|
|
29328
|
+
el.attrs.filter((attr) => attr instanceof Attribute && attr.name.startsWith(_I18N_ATTR_PREFIX)).forEach((attr) => {
|
|
29329
|
+
explicitAttrNameToValue[attr.name.slice(_I18N_ATTR_PREFIX.length)] = attr.value;
|
|
29330
|
+
});
|
|
28166
29331
|
el.attrs.forEach((attr) => {
|
|
28167
29332
|
if (attr.name in explicitAttrNameToValue) {
|
|
28168
29333
|
this._addMessage([attr], explicitAttrNameToValue[attr.name]);
|
|
@@ -28232,16 +29397,15 @@ var _Visitor3 = class {
|
|
|
28232
29397
|
return [];
|
|
28233
29398
|
}
|
|
28234
29399
|
// translate the attributes of an element and remove i18n specific attributes
|
|
28235
|
-
_translateAttributes(
|
|
28236
|
-
const attributes = el.attrs;
|
|
29400
|
+
_translateAttributes(node) {
|
|
28237
29401
|
const i18nParsedMessageMeta = {};
|
|
28238
|
-
|
|
29402
|
+
const translatedAttributes = [];
|
|
29403
|
+
node.attrs.forEach((attr) => {
|
|
28239
29404
|
if (attr.name.startsWith(_I18N_ATTR_PREFIX)) {
|
|
28240
29405
|
i18nParsedMessageMeta[attr.name.slice(_I18N_ATTR_PREFIX.length)] = _parseMessageMeta(attr.value);
|
|
28241
29406
|
}
|
|
28242
29407
|
});
|
|
28243
|
-
|
|
28244
|
-
attributes.forEach((attr) => {
|
|
29408
|
+
node.attrs.forEach((attr) => {
|
|
28245
29409
|
if (attr.name === _I18N_ATTR || attr.name.startsWith(_I18N_ATTR_PREFIX)) {
|
|
28246
29410
|
return;
|
|
28247
29411
|
}
|
|
@@ -28274,10 +29438,10 @@ var _Visitor3 = class {
|
|
|
28274
29438
|
/* i18n */
|
|
28275
29439
|
));
|
|
28276
29440
|
} else {
|
|
28277
|
-
this._reportError(
|
|
29441
|
+
this._reportError(node, `Unexpected translation for attribute "${attr.name}" (id="${id || this._translations.digest(message)}")`);
|
|
28278
29442
|
}
|
|
28279
29443
|
} else {
|
|
28280
|
-
this._reportError(
|
|
29444
|
+
this._reportError(node, `Translation unavailable for attribute "${attr.name}" (id="${id || this._translations.digest(message)}")`);
|
|
28281
29445
|
}
|
|
28282
29446
|
} else {
|
|
28283
29447
|
translatedAttributes.push(attr);
|
|
@@ -28285,6 +29449,9 @@ var _Visitor3 = class {
|
|
|
28285
29449
|
});
|
|
28286
29450
|
return translatedAttributes;
|
|
28287
29451
|
}
|
|
29452
|
+
_translateDirectives(node) {
|
|
29453
|
+
return node.directives.map((dir) => new Directive2(dir.name, this._translateAttributes(dir), dir.sourceSpan, dir.startSourceSpan, dir.endSourceSpan));
|
|
29454
|
+
}
|
|
28288
29455
|
/**
|
|
28289
29456
|
* Add the node as a child of the block when:
|
|
28290
29457
|
* - we are in a block,
|
|
@@ -28361,7 +29528,7 @@ function _isClosingComment(n) {
|
|
|
28361
29528
|
}
|
|
28362
29529
|
__name(_isClosingComment, "_isClosingComment");
|
|
28363
29530
|
function _getI18nAttr(p) {
|
|
28364
|
-
return p.attrs.find((attr) => attr.name === _I18N_ATTR) || null;
|
|
29531
|
+
return p.attrs.find((attr) => attr instanceof Attribute && attr.name === _I18N_ATTR) || null;
|
|
28365
29532
|
}
|
|
28366
29533
|
__name(_getI18nAttr, "_getI18nAttr");
|
|
28367
29534
|
function _parseMessageMeta(i18n2) {
|
|
@@ -28415,7 +29582,12 @@ var XmlParser = class extends Parser$1 {
|
|
|
28415
29582
|
super(getXmlTagDefinition);
|
|
28416
29583
|
}
|
|
28417
29584
|
parse(source, url, options = {}) {
|
|
28418
|
-
return super.parse(source, url, {
|
|
29585
|
+
return super.parse(source, url, {
|
|
29586
|
+
...options,
|
|
29587
|
+
tokenizeBlocks: false,
|
|
29588
|
+
tokenizeLet: false,
|
|
29589
|
+
selectorlessEnabled: false
|
|
29590
|
+
});
|
|
28419
29591
|
}
|
|
28420
29592
|
};
|
|
28421
29593
|
var _VERSION$1 = "1.2";
|
|
@@ -28641,6 +29813,10 @@ var XliffParser = class {
|
|
|
28641
29813
|
}
|
|
28642
29814
|
visitLetDeclaration(decl, context) {
|
|
28643
29815
|
}
|
|
29816
|
+
visitComponent(component, context) {
|
|
29817
|
+
}
|
|
29818
|
+
visitDirective(directive, context) {
|
|
29819
|
+
}
|
|
28644
29820
|
_addError(node, message) {
|
|
28645
29821
|
this._errors.push(new I18nError(node.sourceSpan, message));
|
|
28646
29822
|
}
|
|
@@ -28701,6 +29877,12 @@ var XmlToI18n$2 = class XmlToI18n {
|
|
|
28701
29877
|
}
|
|
28702
29878
|
visitLetDeclaration(decl, context) {
|
|
28703
29879
|
}
|
|
29880
|
+
visitComponent(component, context) {
|
|
29881
|
+
this._addError(component, "Unexpected node");
|
|
29882
|
+
}
|
|
29883
|
+
visitDirective(directive, context) {
|
|
29884
|
+
this._addError(directive, "Unexpected node");
|
|
29885
|
+
}
|
|
28704
29886
|
_addError(node, message) {
|
|
28705
29887
|
this._errors.push(new I18nError(node.sourceSpan, message));
|
|
28706
29888
|
}
|
|
@@ -28965,6 +30147,10 @@ var Xliff2Parser = class {
|
|
|
28965
30147
|
}
|
|
28966
30148
|
visitLetDeclaration(decl, context) {
|
|
28967
30149
|
}
|
|
30150
|
+
visitComponent(component, context) {
|
|
30151
|
+
}
|
|
30152
|
+
visitDirective(directive, context) {
|
|
30153
|
+
}
|
|
28968
30154
|
_addError(node, message) {
|
|
28969
30155
|
this._errors.push(new I18nError(node.sourceSpan, message));
|
|
28970
30156
|
}
|
|
@@ -29040,6 +30226,12 @@ var XmlToI18n$1 = class XmlToI18n2 {
|
|
|
29040
30226
|
}
|
|
29041
30227
|
visitLetDeclaration(decl, context) {
|
|
29042
30228
|
}
|
|
30229
|
+
visitComponent(component, context) {
|
|
30230
|
+
this._addError(component, "Unexpected node");
|
|
30231
|
+
}
|
|
30232
|
+
visitDirective(directive, context) {
|
|
30233
|
+
this._addError(directive, "Unexpected node");
|
|
30234
|
+
}
|
|
29043
30235
|
_addError(node, message) {
|
|
29044
30236
|
this._errors.push(new I18nError(node.sourceSpan, message));
|
|
29045
30237
|
}
|
|
@@ -29186,6 +30378,12 @@ var XtbParser = class {
|
|
|
29186
30378
|
}
|
|
29187
30379
|
visitLetDeclaration(decl, context) {
|
|
29188
30380
|
}
|
|
30381
|
+
visitComponent(component, context) {
|
|
30382
|
+
this._addError(component, "Unexpected node");
|
|
30383
|
+
}
|
|
30384
|
+
visitDirective(directive, context) {
|
|
30385
|
+
this._addError(directive, "Unexpected node");
|
|
30386
|
+
}
|
|
29189
30387
|
_addError(node, message) {
|
|
29190
30388
|
this._errors.push(new I18nError(node.sourceSpan, message));
|
|
29191
30389
|
}
|
|
@@ -29243,6 +30441,12 @@ var XmlToI18n3 = class {
|
|
|
29243
30441
|
}
|
|
29244
30442
|
visitLetDeclaration(decl, context) {
|
|
29245
30443
|
}
|
|
30444
|
+
visitComponent(component, context) {
|
|
30445
|
+
this._addError(component, "Unexpected node");
|
|
30446
|
+
}
|
|
30447
|
+
visitDirective(directive, context) {
|
|
30448
|
+
this._addError(directive, "Unexpected node");
|
|
30449
|
+
}
|
|
29246
30450
|
_addError(node, message) {
|
|
29247
30451
|
this._errors.push(new I18nError(node.sourceSpan, message));
|
|
29248
30452
|
}
|
|
@@ -29580,96 +30784,12 @@ function compileComponentMetadataAsyncResolver(dependencies) {
|
|
|
29580
30784
|
return arrowFn([], literalArr(dynamicImports));
|
|
29581
30785
|
}
|
|
29582
30786
|
__name(compileComponentMetadataAsyncResolver, "compileComponentMetadataAsyncResolver");
|
|
29583
|
-
function compileClassDebugInfo(debugInfo) {
|
|
29584
|
-
const debugInfoObject = {
|
|
29585
|
-
className: debugInfo.className
|
|
29586
|
-
};
|
|
29587
|
-
if (debugInfo.filePath) {
|
|
29588
|
-
debugInfoObject.filePath = debugInfo.filePath;
|
|
29589
|
-
debugInfoObject.lineNumber = debugInfo.lineNumber;
|
|
29590
|
-
}
|
|
29591
|
-
if (debugInfo.forbidOrphanRendering) {
|
|
29592
|
-
debugInfoObject.forbidOrphanRendering = literal(true);
|
|
29593
|
-
}
|
|
29594
|
-
const fnCall = importExpr(Identifiers.setClassDebugInfo).callFn([debugInfo.type, mapLiteral(debugInfoObject)]);
|
|
29595
|
-
const iife = arrowFn([], [devOnlyGuardedExpression(fnCall).toStmt()]);
|
|
29596
|
-
return iife.callFn([]);
|
|
29597
|
-
}
|
|
29598
|
-
__name(compileClassDebugInfo, "compileClassDebugInfo");
|
|
29599
|
-
function compileHmrInitializer(meta) {
|
|
29600
|
-
const moduleName = "m";
|
|
29601
|
-
const dataName = "d";
|
|
29602
|
-
const timestampName = "t";
|
|
29603
|
-
const idName = "id";
|
|
29604
|
-
const importCallbackName = `${meta.className}_HmrLoad`;
|
|
29605
|
-
const namespaces = meta.namespaceDependencies.map((dep) => {
|
|
29606
|
-
return new ExternalExpr({ moduleName: dep.moduleName, name: null });
|
|
29607
|
-
});
|
|
29608
|
-
const defaultRead = variable(moduleName).prop("default");
|
|
29609
|
-
const replaceCall = importExpr(Identifiers.replaceMetadata).callFn([
|
|
29610
|
-
meta.type,
|
|
29611
|
-
defaultRead,
|
|
29612
|
-
literalArr(namespaces),
|
|
29613
|
-
literalArr(meta.localDependencies.map((l) => l.runtimeRepresentation)),
|
|
29614
|
-
variable("import").prop("meta"),
|
|
29615
|
-
variable(idName)
|
|
29616
|
-
]);
|
|
29617
|
-
const replaceCallback = arrowFn([new FnParam(moduleName)], defaultRead.and(replaceCall));
|
|
29618
|
-
const url = importExpr(Identifiers.getReplaceMetadataURL).callFn([
|
|
29619
|
-
variable(idName),
|
|
29620
|
-
variable(timestampName),
|
|
29621
|
-
variable("import").prop("meta").prop("url")
|
|
29622
|
-
]);
|
|
29623
|
-
const importCallback = new DeclareFunctionStmt(importCallbackName, [new FnParam(timestampName)], [
|
|
29624
|
-
// The vite-ignore special comment is required to prevent Vite from generating a superfluous
|
|
29625
|
-
// warning for each usage within the development code. If Vite provides a method to
|
|
29626
|
-
// programmatically avoid this warning in the future, this added comment can be removed here.
|
|
29627
|
-
new DynamicImportExpr(url, null, "@vite-ignore").prop("then").callFn([replaceCallback]).toStmt()
|
|
29628
|
-
], null, StmtModifier.Final);
|
|
29629
|
-
const updateCallback = arrowFn([new FnParam(dataName)], variable(dataName).prop("id").identical(variable(idName)).and(variable(importCallbackName).callFn([variable(dataName).prop("timestamp")])));
|
|
29630
|
-
const initialCall = variable(importCallbackName).callFn([variable("Date").prop("now").callFn([])]);
|
|
29631
|
-
const hotRead = variable("import").prop("meta").prop("hot");
|
|
29632
|
-
const hotListener = hotRead.clone().prop("on").callFn([literal("angular:component-update"), updateCallback]);
|
|
29633
|
-
return arrowFn([], [
|
|
29634
|
-
// const id = <id>;
|
|
29635
|
-
new DeclareVarStmt(idName, literal(encodeURIComponent(`${meta.filePath}@${meta.className}`)), null, StmtModifier.Final),
|
|
29636
|
-
// function Cmp_HmrLoad() {...}.
|
|
29637
|
-
importCallback,
|
|
29638
|
-
// ngDevMode && Cmp_HmrLoad(Date.now());
|
|
29639
|
-
devOnlyGuardedExpression(initialCall).toStmt(),
|
|
29640
|
-
// ngDevMode && import.meta.hot && import.meta.hot.on(...)
|
|
29641
|
-
devOnlyGuardedExpression(hotRead.and(hotListener)).toStmt()
|
|
29642
|
-
]).callFn([]);
|
|
29643
|
-
}
|
|
29644
|
-
__name(compileHmrInitializer, "compileHmrInitializer");
|
|
29645
|
-
function compileHmrUpdateCallback(definitions, constantStatements, meta) {
|
|
29646
|
-
const namespaces = "\u0275\u0275namespaces";
|
|
29647
|
-
const params = [meta.className, namespaces].map((name) => new FnParam(name, DYNAMIC_TYPE));
|
|
29648
|
-
const body = [];
|
|
29649
|
-
for (const local of meta.localDependencies) {
|
|
29650
|
-
params.push(new FnParam(local.name));
|
|
29651
|
-
}
|
|
29652
|
-
for (let i = 0; i < meta.namespaceDependencies.length; i++) {
|
|
29653
|
-
body.push(new DeclareVarStmt(meta.namespaceDependencies[i].assignedName, variable(namespaces).key(literal(i)), DYNAMIC_TYPE, StmtModifier.Final));
|
|
29654
|
-
}
|
|
29655
|
-
body.push(...constantStatements);
|
|
29656
|
-
for (const field of definitions) {
|
|
29657
|
-
if (field.initializer !== null) {
|
|
29658
|
-
body.push(variable(meta.className).prop(field.name).set(field.initializer).toStmt());
|
|
29659
|
-
for (const stmt of field.statements) {
|
|
29660
|
-
body.push(stmt);
|
|
29661
|
-
}
|
|
29662
|
-
}
|
|
29663
|
-
}
|
|
29664
|
-
return new DeclareFunctionStmt(`${meta.className}_UpdateMetadata`, params, body, null, StmtModifier.Final);
|
|
29665
|
-
}
|
|
29666
|
-
__name(compileHmrUpdateCallback, "compileHmrUpdateCallback");
|
|
29667
30787
|
var MINIMUM_PARTIAL_LINKER_VERSION$5 = "12.0.0";
|
|
29668
30788
|
var MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION = "18.0.0";
|
|
29669
30789
|
function compileDeclareClassMetadata(metadata) {
|
|
29670
30790
|
const definitionMap = new DefinitionMap();
|
|
29671
30791
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
|
|
29672
|
-
definitionMap.set("version", literal("
|
|
30792
|
+
definitionMap.set("version", literal("20.0.0-rc.2"));
|
|
29673
30793
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
29674
30794
|
definitionMap.set("type", metadata.type);
|
|
29675
30795
|
definitionMap.set("decorators", metadata.decorators);
|
|
@@ -29688,7 +30808,7 @@ function compileComponentDeclareClassMetadata(metadata, dependencies) {
|
|
|
29688
30808
|
callbackReturnDefinitionMap.set("ctorParameters", metadata.ctorParameters ?? literal(null));
|
|
29689
30809
|
callbackReturnDefinitionMap.set("propDecorators", metadata.propDecorators ?? literal(null));
|
|
29690
30810
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION));
|
|
29691
|
-
definitionMap.set("version", literal("
|
|
30811
|
+
definitionMap.set("version", literal("20.0.0-rc.2"));
|
|
29692
30812
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
29693
30813
|
definitionMap.set("type", metadata.type);
|
|
29694
30814
|
definitionMap.set("resolveDeferredDeps", compileComponentMetadataAsyncResolver(dependencies));
|
|
@@ -29757,7 +30877,7 @@ function createDirectiveDefinitionMap(meta) {
|
|
|
29757
30877
|
const definitionMap = new DefinitionMap();
|
|
29758
30878
|
const minVersion = getMinimumVersionForPartialOutput(meta);
|
|
29759
30879
|
definitionMap.set("minVersion", literal(minVersion));
|
|
29760
|
-
definitionMap.set("version", literal("
|
|
30880
|
+
definitionMap.set("version", literal("20.0.0-rc.2"));
|
|
29761
30881
|
definitionMap.set("type", meta.type.value);
|
|
29762
30882
|
if (meta.isStandalone !== void 0) {
|
|
29763
30883
|
definitionMap.set("isStandalone", literal(meta.isStandalone));
|
|
@@ -30084,7 +31204,7 @@ var MINIMUM_PARTIAL_LINKER_VERSION$4 = "12.0.0";
|
|
|
30084
31204
|
function compileDeclareFactoryFunction(meta) {
|
|
30085
31205
|
const definitionMap = new DefinitionMap();
|
|
30086
31206
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
|
|
30087
|
-
definitionMap.set("version", literal("
|
|
31207
|
+
definitionMap.set("version", literal("20.0.0-rc.2"));
|
|
30088
31208
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
30089
31209
|
definitionMap.set("type", meta.type.value);
|
|
30090
31210
|
definitionMap.set("deps", compileDependencies(meta.deps));
|
|
@@ -30107,7 +31227,7 @@ __name(compileDeclareInjectableFromMetadata, "compileDeclareInjectableFromMetada
|
|
|
30107
31227
|
function createInjectableDefinitionMap(meta) {
|
|
30108
31228
|
const definitionMap = new DefinitionMap();
|
|
30109
31229
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
|
|
30110
|
-
definitionMap.set("version", literal("
|
|
31230
|
+
definitionMap.set("version", literal("20.0.0-rc.2"));
|
|
30111
31231
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
30112
31232
|
definitionMap.set("type", meta.type.value);
|
|
30113
31233
|
if (meta.providedIn !== void 0) {
|
|
@@ -30145,7 +31265,7 @@ __name(compileDeclareInjectorFromMetadata, "compileDeclareInjectorFromMetadata")
|
|
|
30145
31265
|
function createInjectorDefinitionMap(meta) {
|
|
30146
31266
|
const definitionMap = new DefinitionMap();
|
|
30147
31267
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
|
|
30148
|
-
definitionMap.set("version", literal("
|
|
31268
|
+
definitionMap.set("version", literal("20.0.0-rc.2"));
|
|
30149
31269
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
30150
31270
|
definitionMap.set("type", meta.type.value);
|
|
30151
31271
|
definitionMap.set("providers", meta.providers);
|
|
@@ -30169,7 +31289,7 @@ function createNgModuleDefinitionMap(meta) {
|
|
|
30169
31289
|
throw new Error("Invalid path! Local compilation mode should not get into the partial compilation path");
|
|
30170
31290
|
}
|
|
30171
31291
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
|
|
30172
|
-
definitionMap.set("version", literal("
|
|
31292
|
+
definitionMap.set("version", literal("20.0.0-rc.2"));
|
|
30173
31293
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
30174
31294
|
definitionMap.set("type", meta.type.value);
|
|
30175
31295
|
if (meta.bootstrap.length > 0) {
|
|
@@ -30204,7 +31324,7 @@ __name(compileDeclarePipeFromMetadata, "compileDeclarePipeFromMetadata");
|
|
|
30204
31324
|
function createPipeDefinitionMap(meta) {
|
|
30205
31325
|
const definitionMap = new DefinitionMap();
|
|
30206
31326
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION));
|
|
30207
|
-
definitionMap.set("version", literal("
|
|
31327
|
+
definitionMap.set("version", literal("20.0.0-rc.2"));
|
|
30208
31328
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
30209
31329
|
definitionMap.set("type", meta.type.value);
|
|
30210
31330
|
if (meta.isStandalone !== void 0) {
|
|
@@ -30217,6 +31337,91 @@ function createPipeDefinitionMap(meta) {
|
|
|
30217
31337
|
return definitionMap;
|
|
30218
31338
|
}
|
|
30219
31339
|
__name(createPipeDefinitionMap, "createPipeDefinitionMap");
|
|
31340
|
+
function compileClassDebugInfo(debugInfo) {
|
|
31341
|
+
const debugInfoObject = {
|
|
31342
|
+
className: debugInfo.className
|
|
31343
|
+
};
|
|
31344
|
+
if (debugInfo.filePath) {
|
|
31345
|
+
debugInfoObject.filePath = debugInfo.filePath;
|
|
31346
|
+
debugInfoObject.lineNumber = debugInfo.lineNumber;
|
|
31347
|
+
}
|
|
31348
|
+
if (debugInfo.forbidOrphanRendering) {
|
|
31349
|
+
debugInfoObject.forbidOrphanRendering = literal(true);
|
|
31350
|
+
}
|
|
31351
|
+
const fnCall = importExpr(Identifiers.setClassDebugInfo).callFn([debugInfo.type, mapLiteral(debugInfoObject)]);
|
|
31352
|
+
const iife = arrowFn([], [devOnlyGuardedExpression(fnCall).toStmt()]);
|
|
31353
|
+
return iife.callFn([]);
|
|
31354
|
+
}
|
|
31355
|
+
__name(compileClassDebugInfo, "compileClassDebugInfo");
|
|
31356
|
+
function compileHmrInitializer(meta) {
|
|
31357
|
+
const moduleName = "m";
|
|
31358
|
+
const dataName = "d";
|
|
31359
|
+
const timestampName = "t";
|
|
31360
|
+
const idName = "id";
|
|
31361
|
+
const importCallbackName = `${meta.className}_HmrLoad`;
|
|
31362
|
+
const namespaces = meta.namespaceDependencies.map((dep) => {
|
|
31363
|
+
return new ExternalExpr({ moduleName: dep.moduleName, name: null });
|
|
31364
|
+
});
|
|
31365
|
+
const defaultRead = variable(moduleName).prop("default");
|
|
31366
|
+
const replaceCall = importExpr(Identifiers.replaceMetadata).callFn([
|
|
31367
|
+
meta.type,
|
|
31368
|
+
defaultRead,
|
|
31369
|
+
literalArr(namespaces),
|
|
31370
|
+
literalArr(meta.localDependencies.map((l) => l.runtimeRepresentation)),
|
|
31371
|
+
variable("import").prop("meta"),
|
|
31372
|
+
variable(idName)
|
|
31373
|
+
]);
|
|
31374
|
+
const replaceCallback = arrowFn([new FnParam(moduleName)], defaultRead.and(replaceCall));
|
|
31375
|
+
const url = importExpr(Identifiers.getReplaceMetadataURL).callFn([
|
|
31376
|
+
variable(idName),
|
|
31377
|
+
variable(timestampName),
|
|
31378
|
+
variable("import").prop("meta").prop("url")
|
|
31379
|
+
]);
|
|
31380
|
+
const importCallback = new DeclareFunctionStmt(importCallbackName, [new FnParam(timestampName)], [
|
|
31381
|
+
// The vite-ignore special comment is required to prevent Vite from generating a superfluous
|
|
31382
|
+
// warning for each usage within the development code. If Vite provides a method to
|
|
31383
|
+
// programmatically avoid this warning in the future, this added comment can be removed here.
|
|
31384
|
+
new DynamicImportExpr(url, null, "@vite-ignore").prop("then").callFn([replaceCallback]).toStmt()
|
|
31385
|
+
], null, StmtModifier.Final);
|
|
31386
|
+
const updateCallback = arrowFn([new FnParam(dataName)], variable(dataName).prop("id").identical(variable(idName)).and(variable(importCallbackName).callFn([variable(dataName).prop("timestamp")])));
|
|
31387
|
+
const initialCall = variable(importCallbackName).callFn([variable("Date").prop("now").callFn([])]);
|
|
31388
|
+
const hotRead = variable("import").prop("meta").prop("hot");
|
|
31389
|
+
const hotListener = hotRead.clone().prop("on").callFn([literal("angular:component-update"), updateCallback]);
|
|
31390
|
+
return arrowFn([], [
|
|
31391
|
+
// const id = <id>;
|
|
31392
|
+
new DeclareVarStmt(idName, literal(encodeURIComponent(`${meta.filePath}@${meta.className}`)), null, StmtModifier.Final),
|
|
31393
|
+
// function Cmp_HmrLoad() {...}.
|
|
31394
|
+
importCallback,
|
|
31395
|
+
// ngDevMode && Cmp_HmrLoad(Date.now());
|
|
31396
|
+
devOnlyGuardedExpression(initialCall).toStmt(),
|
|
31397
|
+
// ngDevMode && import.meta.hot && import.meta.hot.on(...)
|
|
31398
|
+
devOnlyGuardedExpression(hotRead.and(hotListener)).toStmt()
|
|
31399
|
+
]).callFn([]);
|
|
31400
|
+
}
|
|
31401
|
+
__name(compileHmrInitializer, "compileHmrInitializer");
|
|
31402
|
+
function compileHmrUpdateCallback(definitions, constantStatements, meta) {
|
|
31403
|
+
const namespaces = "\u0275\u0275namespaces";
|
|
31404
|
+
const params = [meta.className, namespaces].map((name) => new FnParam(name, DYNAMIC_TYPE));
|
|
31405
|
+
const body = [];
|
|
31406
|
+
for (const local of meta.localDependencies) {
|
|
31407
|
+
params.push(new FnParam(local.name));
|
|
31408
|
+
}
|
|
31409
|
+
for (let i = 0; i < meta.namespaceDependencies.length; i++) {
|
|
31410
|
+
body.push(new DeclareVarStmt(meta.namespaceDependencies[i].assignedName, variable(namespaces).key(literal(i)), DYNAMIC_TYPE, StmtModifier.Final));
|
|
31411
|
+
}
|
|
31412
|
+
body.push(...constantStatements);
|
|
31413
|
+
for (const field of definitions) {
|
|
31414
|
+
if (field.initializer !== null) {
|
|
31415
|
+
body.push(variable(meta.className).prop(field.name).set(field.initializer).toStmt());
|
|
31416
|
+
for (const stmt of field.statements) {
|
|
31417
|
+
body.push(stmt);
|
|
31418
|
+
}
|
|
31419
|
+
}
|
|
31420
|
+
}
|
|
31421
|
+
return new DeclareFunctionStmt(`${meta.className}_UpdateMetadata`, params, body, null, StmtModifier.Final);
|
|
31422
|
+
}
|
|
31423
|
+
__name(compileHmrUpdateCallback, "compileHmrUpdateCallback");
|
|
31424
|
+
var VERSION = new Version("20.0.0-rc.2");
|
|
30220
31425
|
publishFacade(_global);
|
|
30221
31426
|
// Annotate the CommonJS export names for ESM import in node:
|
|
30222
31427
|
0 && (module.exports = {
|
|
@@ -30245,6 +31450,7 @@ publishFacade(_global);
|
|
|
30245
31450
|
Comment,
|
|
30246
31451
|
CompilerConfig,
|
|
30247
31452
|
CompilerFacadeImpl,
|
|
31453
|
+
Component,
|
|
30248
31454
|
Conditional,
|
|
30249
31455
|
ConditionalExpr,
|
|
30250
31456
|
ConstantPool,
|
|
@@ -30253,6 +31459,7 @@ publishFacade(_global);
|
|
|
30253
31459
|
DYNAMIC_TYPE,
|
|
30254
31460
|
DeclareFunctionStmt,
|
|
30255
31461
|
DeclareVarStmt,
|
|
31462
|
+
Directive,
|
|
30256
31463
|
DomElementSchemaRegistry,
|
|
30257
31464
|
DynamicImportExpr,
|
|
30258
31465
|
EOF,
|
|
@@ -30300,6 +31507,8 @@ publishFacade(_global);
|
|
|
30300
31507
|
NodeWithI18n,
|
|
30301
31508
|
NonNullAssert,
|
|
30302
31509
|
NotExpr,
|
|
31510
|
+
ParenthesizedExpr,
|
|
31511
|
+
ParenthesizedExpression,
|
|
30303
31512
|
ParseError,
|
|
30304
31513
|
ParseErrorLevel,
|
|
30305
31514
|
ParseLocation,
|
|
@@ -30317,7 +31526,6 @@ publishFacade(_global);
|
|
|
30317
31526
|
PrefixNot,
|
|
30318
31527
|
PropertyRead,
|
|
30319
31528
|
PropertyWrite,
|
|
30320
|
-
R3BoundTarget,
|
|
30321
31529
|
R3Identifiers,
|
|
30322
31530
|
R3NgModuleMetadataKind,
|
|
30323
31531
|
R3SelectorScopeMode,
|
|
@@ -30338,6 +31546,7 @@ publishFacade(_global);
|
|
|
30338
31546
|
SelectorContext,
|
|
30339
31547
|
SelectorListContext,
|
|
30340
31548
|
SelectorMatcher,
|
|
31549
|
+
SelectorlessMatcher,
|
|
30341
31550
|
Serializer,
|
|
30342
31551
|
SplitInterpolation,
|
|
30343
31552
|
Statement,
|
|
@@ -30345,6 +31554,7 @@ publishFacade(_global);
|
|
|
30345
31554
|
StringToken,
|
|
30346
31555
|
StringTokenKind,
|
|
30347
31556
|
TagContentType,
|
|
31557
|
+
TaggedTemplateLiteral,
|
|
30348
31558
|
TaggedTemplateLiteralExpr,
|
|
30349
31559
|
TemplateBindingParseResult,
|
|
30350
31560
|
TemplateLiteral,
|
|
@@ -30358,15 +31568,18 @@ publishFacade(_global);
|
|
|
30358
31568
|
TmplAstBoundDeferredTrigger,
|
|
30359
31569
|
TmplAstBoundEvent,
|
|
30360
31570
|
TmplAstBoundText,
|
|
31571
|
+
TmplAstComponent,
|
|
30361
31572
|
TmplAstContent,
|
|
30362
31573
|
TmplAstDeferredBlock,
|
|
30363
31574
|
TmplAstDeferredBlockError,
|
|
30364
31575
|
TmplAstDeferredBlockLoading,
|
|
30365
31576
|
TmplAstDeferredBlockPlaceholder,
|
|
30366
31577
|
TmplAstDeferredTrigger,
|
|
31578
|
+
TmplAstDirective,
|
|
30367
31579
|
TmplAstElement,
|
|
30368
31580
|
TmplAstForLoopBlock,
|
|
30369
31581
|
TmplAstForLoopBlockEmpty,
|
|
31582
|
+
TmplAstHostElement,
|
|
30370
31583
|
TmplAstHoverDeferredTrigger,
|
|
30371
31584
|
TmplAstIcu,
|
|
30372
31585
|
TmplAstIdleDeferredTrigger,
|
|
@@ -30402,6 +31615,8 @@ publishFacade(_global);
|
|
|
30402
31615
|
VariableBinding,
|
|
30403
31616
|
Version,
|
|
30404
31617
|
ViewEncapsulation,
|
|
31618
|
+
VoidExpr,
|
|
31619
|
+
VoidExpression,
|
|
30405
31620
|
WrappedNodeExpr,
|
|
30406
31621
|
WriteKeyExpr,
|
|
30407
31622
|
WritePropExpr,
|
|
@@ -30464,7 +31679,6 @@ publishFacade(_global);
|
|
|
30464
31679
|
publishFacade,
|
|
30465
31680
|
r3JitTypeSourceSpan,
|
|
30466
31681
|
sanitizeIdentifier,
|
|
30467
|
-
setEnableTemplateSourceLocations,
|
|
30468
31682
|
splitNsName,
|
|
30469
31683
|
tmplAstVisitAll,
|
|
30470
31684
|
verifyHostBindings,
|
|
@@ -30474,7 +31688,7 @@ publishFacade(_global);
|
|
|
30474
31688
|
|
|
30475
31689
|
@angular/compiler/fesm2022/compiler.mjs:
|
|
30476
31690
|
(**
|
|
30477
|
-
* @license Angular
|
|
31691
|
+
* @license Angular v20.0.0-rc.2
|
|
30478
31692
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
30479
31693
|
* License: MIT
|
|
30480
31694
|
*)
|