@angular/compiler 17.0.8 → 17.0.9
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/esm2022/src/render3/partial/class_metadata.mjs +1 -1
- package/esm2022/src/render3/partial/directive.mjs +1 -1
- package/esm2022/src/render3/partial/factory.mjs +1 -1
- package/esm2022/src/render3/partial/injectable.mjs +1 -1
- package/esm2022/src/render3/partial/injector.mjs +1 -1
- package/esm2022/src/render3/partial/ng_module.mjs +1 -1
- package/esm2022/src/render3/partial/pipe.mjs +1 -1
- package/esm2022/src/render3/view/style_parser.mjs +2 -1
- package/esm2022/src/render3/view/template.mjs +5 -2
- package/esm2022/src/template/pipeline/ir/src/enums.mjs +1 -11
- package/esm2022/src/template/pipeline/ir/src/expression.mjs +1 -21
- package/esm2022/src/template/pipeline/ir/src/ops/create.mjs +3 -2
- package/esm2022/src/template/pipeline/ir/src/ops/update.mjs +3 -2
- package/esm2022/src/template/pipeline/src/emit.mjs +1 -3
- package/esm2022/src/template/pipeline/src/ingest.mjs +40 -15
- package/esm2022/src/template/pipeline/src/instruction.mjs +8 -7
- package/esm2022/src/template/pipeline/src/phases/attribute_extraction.mjs +6 -5
- package/esm2022/src/template/pipeline/src/phases/binding_specialization.mjs +4 -2
- package/esm2022/src/template/pipeline/src/phases/const_collection.mjs +8 -12
- package/esm2022/src/template/pipeline/src/phases/host_style_property_parsing.mjs +2 -2
- package/esm2022/src/template/pipeline/src/phases/parse_extracted_styles.mjs +3 -3
- package/esm2022/src/template/pipeline/src/phases/reify.mjs +2 -2
- package/esm2022/src/version.mjs +1 -1
- package/fesm2022/compiler.mjs +82 -118
- package/fesm2022/compiler.mjs.map +1 -1
- package/index.d.ts +1 -1
- package/package.json +2 -2
- package/esm2022/src/template/pipeline/src/phases/repeater_derived_vars.mjs +0 -45
package/fesm2022/compiler.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v17.0.
|
|
2
|
+
* @license Angular v17.0.9
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -9261,16 +9261,6 @@ var DeferTriggerKind;
|
|
|
9261
9261
|
DeferTriggerKind[DeferTriggerKind["Interaction"] = 4] = "Interaction";
|
|
9262
9262
|
DeferTriggerKind[DeferTriggerKind["Viewport"] = 5] = "Viewport";
|
|
9263
9263
|
})(DeferTriggerKind || (DeferTriggerKind = {}));
|
|
9264
|
-
/**
|
|
9265
|
-
* Repeaters implicitly define these derived variables, and child nodes may read them.
|
|
9266
|
-
*/
|
|
9267
|
-
var DerivedRepeaterVarIdentity;
|
|
9268
|
-
(function (DerivedRepeaterVarIdentity) {
|
|
9269
|
-
DerivedRepeaterVarIdentity[DerivedRepeaterVarIdentity["First"] = 0] = "First";
|
|
9270
|
-
DerivedRepeaterVarIdentity[DerivedRepeaterVarIdentity["Last"] = 1] = "Last";
|
|
9271
|
-
DerivedRepeaterVarIdentity[DerivedRepeaterVarIdentity["Even"] = 2] = "Even";
|
|
9272
|
-
DerivedRepeaterVarIdentity[DerivedRepeaterVarIdentity["Odd"] = 3] = "Odd";
|
|
9273
|
-
})(DerivedRepeaterVarIdentity || (DerivedRepeaterVarIdentity = {}));
|
|
9274
9264
|
/**
|
|
9275
9265
|
* Kinds of i18n contexts. They can be created because of root i18n blocks, or ICUs.
|
|
9276
9266
|
*/
|
|
@@ -9515,10 +9505,11 @@ function createClassMapOp(xref, expression, sourceSpan) {
|
|
|
9515
9505
|
/**
|
|
9516
9506
|
* Create an `AttributeOp`.
|
|
9517
9507
|
*/
|
|
9518
|
-
function createAttributeOp(target, name, expression, securityContext, isTextAttribute, isStructuralTemplateAttribute, templateKind, i18nMessage, sourceSpan) {
|
|
9508
|
+
function createAttributeOp(target, namespace, name, expression, securityContext, isTextAttribute, isStructuralTemplateAttribute, templateKind, i18nMessage, sourceSpan) {
|
|
9519
9509
|
return {
|
|
9520
9510
|
kind: OpKind.Attribute,
|
|
9521
9511
|
target,
|
|
9512
|
+
namespace,
|
|
9522
9513
|
name,
|
|
9523
9514
|
expression,
|
|
9524
9515
|
securityContext,
|
|
@@ -10215,26 +10206,6 @@ class ConditionalCaseExpr extends ExpressionBase {
|
|
|
10215
10206
|
}
|
|
10216
10207
|
}
|
|
10217
10208
|
}
|
|
10218
|
-
class DerivedRepeaterVarExpr extends ExpressionBase {
|
|
10219
|
-
constructor(xref, identity) {
|
|
10220
|
-
super();
|
|
10221
|
-
this.xref = xref;
|
|
10222
|
-
this.identity = identity;
|
|
10223
|
-
this.kind = ExpressionKind.DerivedRepeaterVar;
|
|
10224
|
-
}
|
|
10225
|
-
transformInternalExpressions(transform, flags) { }
|
|
10226
|
-
visitExpression(visitor, context) { }
|
|
10227
|
-
isEquivalent(e) {
|
|
10228
|
-
return e instanceof DerivedRepeaterVarExpr && e.identity === this.identity &&
|
|
10229
|
-
e.xref === this.xref;
|
|
10230
|
-
}
|
|
10231
|
-
isConstant() {
|
|
10232
|
-
return false;
|
|
10233
|
-
}
|
|
10234
|
-
clone() {
|
|
10235
|
-
return new DerivedRepeaterVarExpr(this.xref, this.identity);
|
|
10236
|
-
}
|
|
10237
|
-
}
|
|
10238
10209
|
class ConstCollectedExpr extends ExpressionBase {
|
|
10239
10210
|
constructor(expr) {
|
|
10240
10211
|
super();
|
|
@@ -10988,11 +10959,12 @@ function createProjectionOp(xref, selector, i18nPlaceholder, attributes, sourceS
|
|
|
10988
10959
|
/**
|
|
10989
10960
|
* Create an `ExtractedAttributeOp`.
|
|
10990
10961
|
*/
|
|
10991
|
-
function createExtractedAttributeOp(target, bindingKind, name, expression, i18nContext, i18nMessage, securityContext) {
|
|
10962
|
+
function createExtractedAttributeOp(target, bindingKind, namespace, name, expression, i18nContext, i18nMessage, securityContext) {
|
|
10992
10963
|
return {
|
|
10993
10964
|
kind: OpKind.ExtractedAttribute,
|
|
10994
10965
|
target,
|
|
10995
10966
|
bindingKind,
|
|
10967
|
+
namespace,
|
|
10996
10968
|
name,
|
|
10997
10969
|
expression,
|
|
10998
10970
|
i18nContext,
|
|
@@ -11533,7 +11505,8 @@ function extractAttributes(job) {
|
|
|
11533
11505
|
}
|
|
11534
11506
|
OpList.insertBefore(
|
|
11535
11507
|
// Deliberaly null i18nMessage value
|
|
11536
|
-
createExtractedAttributeOp(op.target, bindingKind, op.name, /* expression */ null,
|
|
11508
|
+
createExtractedAttributeOp(op.target, bindingKind, null, op.name, /* expression */ null,
|
|
11509
|
+
/* i18nContext */ null,
|
|
11537
11510
|
/* i18nMessage */ null, op.securityContext), lookupElement$2(elements, op.target));
|
|
11538
11511
|
}
|
|
11539
11512
|
break;
|
|
@@ -11545,14 +11518,14 @@ function extractAttributes(job) {
|
|
|
11545
11518
|
// mode.
|
|
11546
11519
|
if (unit.job.compatibility === CompatibilityMode.TemplateDefinitionBuilder &&
|
|
11547
11520
|
op.expression instanceof EmptyExpr) {
|
|
11548
|
-
OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.Property, op.name, /* expression */ null,
|
|
11521
|
+
OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.Property, null, op.name, /* expression */ null,
|
|
11549
11522
|
/* i18nContext */ null,
|
|
11550
11523
|
/* i18nMessage */ null, SecurityContext.STYLE), lookupElement$2(elements, op.target));
|
|
11551
11524
|
}
|
|
11552
11525
|
break;
|
|
11553
11526
|
case OpKind.Listener:
|
|
11554
11527
|
if (!op.isAnimationListener) {
|
|
11555
|
-
const extractedAttributeOp = createExtractedAttributeOp(op.target, BindingKind.Property, op.name, /* expression */ null,
|
|
11528
|
+
const extractedAttributeOp = createExtractedAttributeOp(op.target, BindingKind.Property, null, op.name, /* expression */ null,
|
|
11556
11529
|
/* i18nContext */ null,
|
|
11557
11530
|
/* i18nMessage */ null, SecurityContext.NONE);
|
|
11558
11531
|
if (job.kind === CompilationJobKind.Host) {
|
|
@@ -11593,7 +11566,7 @@ function extractAttributeOp(unit, op, elements) {
|
|
|
11593
11566
|
extractable &&= op.isTextAttribute;
|
|
11594
11567
|
}
|
|
11595
11568
|
if (extractable) {
|
|
11596
|
-
const extractedAttributeOp = createExtractedAttributeOp(op.target, op.isStructuralTemplateAttribute ? BindingKind.Template : BindingKind.Attribute, op.name, op.expression, op.i18nContext, op.i18nMessage, op.securityContext);
|
|
11569
|
+
const extractedAttributeOp = createExtractedAttributeOp(op.target, op.isStructuralTemplateAttribute ? BindingKind.Template : BindingKind.Attribute, op.namespace, op.name, op.expression, op.i18nContext, op.i18nMessage, op.securityContext);
|
|
11597
11570
|
if (unit.job.kind === CompilationJobKind.Host) {
|
|
11598
11571
|
// This attribute will apply to the enclosing host binding compilation unit, so order doesn't
|
|
11599
11572
|
// matter.
|
|
@@ -11640,7 +11613,8 @@ function specializeBindings(job) {
|
|
|
11640
11613
|
target.nonBindable = true;
|
|
11641
11614
|
}
|
|
11642
11615
|
else {
|
|
11643
|
-
|
|
11616
|
+
const [namespace, name] = splitNsName(op.name);
|
|
11617
|
+
OpList.replace(op, createAttributeOp(op.target, namespace, name, op.expression, op.securityContext, op.isTextAttribute, op.isStructuralTemplateAttribute, op.templateKind, op.i18nMessage, op.sourceSpan));
|
|
11644
11618
|
}
|
|
11645
11619
|
break;
|
|
11646
11620
|
case BindingKind.Property:
|
|
@@ -11886,7 +11860,7 @@ function collectElementConsts(job) {
|
|
|
11886
11860
|
if (op.kind === OpKind.ExtractedAttribute) {
|
|
11887
11861
|
const attributes = allElementAttributes.get(op.target) || new ElementAttributes(job.compatibility);
|
|
11888
11862
|
allElementAttributes.set(op.target, attributes);
|
|
11889
|
-
attributes.add(op.bindingKind, op.name, op.expression, op.trustedValueFn);
|
|
11863
|
+
attributes.add(op.bindingKind, op.name, op.expression, op.namespace, op.trustedValueFn);
|
|
11890
11864
|
OpList.remove(op);
|
|
11891
11865
|
}
|
|
11892
11866
|
}
|
|
@@ -11962,7 +11936,7 @@ class ElementAttributes {
|
|
|
11962
11936
|
nameToValue.add(name);
|
|
11963
11937
|
return false;
|
|
11964
11938
|
}
|
|
11965
|
-
add(kind, name, value, trustedValueFn) {
|
|
11939
|
+
add(kind, name, value, namespace, trustedValueFn) {
|
|
11966
11940
|
// TemplateDefinitionBuilder puts duplicate attribute, class, and style values into the consts
|
|
11967
11941
|
// array. This seems inefficient, we can probably keep just the first one or the last value
|
|
11968
11942
|
// (whichever actually gets applied when multiple values are listed for the same attribute).
|
|
@@ -11983,7 +11957,7 @@ class ElementAttributes {
|
|
|
11983
11957
|
// attribute. Is this sane?
|
|
11984
11958
|
}
|
|
11985
11959
|
const array = this.arrayFor(kind);
|
|
11986
|
-
array.push(...getAttributeNameLiterals$1(name));
|
|
11960
|
+
array.push(...getAttributeNameLiterals$1(namespace, name));
|
|
11987
11961
|
if (kind === BindingKind.Attribute || kind === BindingKind.StyleProperty) {
|
|
11988
11962
|
if (value === null) {
|
|
11989
11963
|
throw Error('Attribute, i18n attribute, & style element attributes must have a value');
|
|
@@ -12009,13 +11983,10 @@ class ElementAttributes {
|
|
|
12009
11983
|
/**
|
|
12010
11984
|
* Gets an array of literal expressions representing the attribute's namespaced name.
|
|
12011
11985
|
*/
|
|
12012
|
-
function getAttributeNameLiterals$1(name) {
|
|
12013
|
-
const
|
|
12014
|
-
|
|
12015
|
-
|
|
12016
|
-
return [
|
|
12017
|
-
literal(0 /* core.AttributeMarker.NamespaceURI */), literal(attributeNamespace), nameLiteral
|
|
12018
|
-
];
|
|
11986
|
+
function getAttributeNameLiterals$1(namespace, name) {
|
|
11987
|
+
const nameLiteral = literal(name);
|
|
11988
|
+
if (namespace) {
|
|
11989
|
+
return [literal(0 /* core.AttributeMarker.NamespaceURI */), literal(namespace), nameLiteral];
|
|
12019
11990
|
}
|
|
12020
11991
|
return [nameLiteral];
|
|
12021
11992
|
}
|
|
@@ -13070,7 +13041,7 @@ function parseHostStyleProperties(job) {
|
|
|
13070
13041
|
if (op.name.startsWith(STYLE_DOT)) {
|
|
13071
13042
|
op.bindingKind = BindingKind.StyleProperty;
|
|
13072
13043
|
op.name = op.name.substring(STYLE_DOT.length);
|
|
13073
|
-
if (isCssCustomProperty$1(op.name)) {
|
|
13044
|
+
if (!isCssCustomProperty$1(op.name)) {
|
|
13074
13045
|
op.name = hyphenate$1(op.name);
|
|
13075
13046
|
}
|
|
13076
13047
|
const { property, suffix } = parseProperty$1(op.name);
|
|
@@ -20510,6 +20481,7 @@ function parse(value) {
|
|
|
20510
20481
|
break;
|
|
20511
20482
|
case 58 /* Char.Colon */:
|
|
20512
20483
|
if (!currentProp && parenDepth === 0 && quote === 0 /* Char.QuoteNone */) {
|
|
20484
|
+
// TODO: Do not hyphenate CSS custom property names like: `--intentionallyCamelCase`
|
|
20513
20485
|
currentProp = hyphenate(value.substring(propStart, i - 1).trim());
|
|
20514
20486
|
valueStart = i;
|
|
20515
20487
|
}
|
|
@@ -20955,14 +20927,14 @@ function parseExtractedStyles(job) {
|
|
|
20955
20927
|
if (op.name === 'style') {
|
|
20956
20928
|
const parsedStyles = parse(op.expression.value);
|
|
20957
20929
|
for (let i = 0; i < parsedStyles.length - 1; i += 2) {
|
|
20958
|
-
OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.StyleProperty, parsedStyles[i], literal(parsedStyles[i + 1]), null, null, SecurityContext.STYLE), op);
|
|
20930
|
+
OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.StyleProperty, null, parsedStyles[i], literal(parsedStyles[i + 1]), null, null, SecurityContext.STYLE), op);
|
|
20959
20931
|
}
|
|
20960
20932
|
OpList.remove(op);
|
|
20961
20933
|
}
|
|
20962
20934
|
else if (op.name === 'class') {
|
|
20963
20935
|
const parsedClasses = op.expression.value.trim().split(/\s+/g);
|
|
20964
20936
|
for (const parsedClass of parsedClasses) {
|
|
20965
|
-
OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.ClassName, parsedClass, null, null, null, SecurityContext.NONE), op);
|
|
20937
|
+
OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.ClassName, null, parsedClass, null, null, null, SecurityContext.NONE), op);
|
|
20966
20938
|
}
|
|
20967
20939
|
OpList.remove(op);
|
|
20968
20940
|
}
|
|
@@ -21348,9 +21320,7 @@ function namespaceMath() {
|
|
|
21348
21320
|
return call(Identifiers.namespaceMathML, [], null);
|
|
21349
21321
|
}
|
|
21350
21322
|
function advance(delta, sourceSpan) {
|
|
21351
|
-
return call(Identifiers.advance, [
|
|
21352
|
-
literal(delta),
|
|
21353
|
-
], sourceSpan);
|
|
21323
|
+
return call(Identifiers.advance, delta > 1 ? [literal(delta)] : [], sourceSpan);
|
|
21354
21324
|
}
|
|
21355
21325
|
function reference(slot) {
|
|
21356
21326
|
return importExpr(Identifiers.reference).callFn([
|
|
@@ -21488,10 +21458,13 @@ function property(name, expression, sanitizer, sourceSpan) {
|
|
|
21488
21458
|
}
|
|
21489
21459
|
return call(Identifiers.property, args, sourceSpan);
|
|
21490
21460
|
}
|
|
21491
|
-
function attribute(name, expression, sanitizer) {
|
|
21461
|
+
function attribute(name, expression, sanitizer, namespace) {
|
|
21492
21462
|
const args = [literal(name), expression];
|
|
21493
|
-
if (sanitizer !== null) {
|
|
21494
|
-
args.push(sanitizer);
|
|
21463
|
+
if (sanitizer !== null || namespace !== null) {
|
|
21464
|
+
args.push(sanitizer ?? literal(null));
|
|
21465
|
+
}
|
|
21466
|
+
if (namespace !== null) {
|
|
21467
|
+
args.push(literal(namespace));
|
|
21495
21468
|
}
|
|
21496
21469
|
return call(Identifiers.attribute, args, null);
|
|
21497
21470
|
}
|
|
@@ -22051,7 +22024,7 @@ function reifyUpdateOperations(_unit, ops) {
|
|
|
22051
22024
|
OpList.replace(op, attributeInterpolate(op.name, op.expression.strings, op.expression.expressions, op.sanitizer, op.sourceSpan));
|
|
22052
22025
|
}
|
|
22053
22026
|
else {
|
|
22054
|
-
OpList.replace(op, attribute(op.name, op.expression, op.sanitizer));
|
|
22027
|
+
OpList.replace(op, attribute(op.name, op.expression, op.sanitizer, op.namespace));
|
|
22055
22028
|
}
|
|
22056
22029
|
break;
|
|
22057
22030
|
case OpKind.HostProperty:
|
|
@@ -22240,42 +22213,6 @@ function removeUnusedI18nAttributesOps(job) {
|
|
|
22240
22213
|
}
|
|
22241
22214
|
}
|
|
22242
22215
|
|
|
22243
|
-
/**
|
|
22244
|
-
* Inside the body of a repeater, certain context variables (such as `$first`) are ambiently
|
|
22245
|
-
* available. This phase finds those variable usages, and replaces them with the appropriate
|
|
22246
|
-
* expression.
|
|
22247
|
-
*/
|
|
22248
|
-
function generateRepeaterDerivedVars(job) {
|
|
22249
|
-
const repeaters = new Map();
|
|
22250
|
-
for (const unit of job.units) {
|
|
22251
|
-
for (const op of unit.ops()) {
|
|
22252
|
-
if (op.kind === OpKind.RepeaterCreate) {
|
|
22253
|
-
repeaters.set(op.xref, op);
|
|
22254
|
-
}
|
|
22255
|
-
}
|
|
22256
|
-
}
|
|
22257
|
-
for (const unit of job.units) {
|
|
22258
|
-
for (const op of unit.ops()) {
|
|
22259
|
-
transformExpressionsInOp(op, expr => {
|
|
22260
|
-
if (!(expr instanceof DerivedRepeaterVarExpr)) {
|
|
22261
|
-
return expr;
|
|
22262
|
-
}
|
|
22263
|
-
const repeaterOp = repeaters.get(expr.xref);
|
|
22264
|
-
switch (expr.identity) {
|
|
22265
|
-
case DerivedRepeaterVarIdentity.First:
|
|
22266
|
-
return new BinaryOperatorExpr(BinaryOperator.Identical, new LexicalReadExpr(repeaterOp.varNames.$index), literal(0));
|
|
22267
|
-
case DerivedRepeaterVarIdentity.Last:
|
|
22268
|
-
return new BinaryOperatorExpr(BinaryOperator.Identical, new LexicalReadExpr(repeaterOp.varNames.$index), new BinaryOperatorExpr(BinaryOperator.Minus, new LexicalReadExpr(repeaterOp.varNames.$count), literal(1)));
|
|
22269
|
-
case DerivedRepeaterVarIdentity.Even:
|
|
22270
|
-
return new BinaryOperatorExpr(BinaryOperator.Identical, new BinaryOperatorExpr(BinaryOperator.Modulo, new LexicalReadExpr(repeaterOp.varNames.$index), literal(2)), literal(0));
|
|
22271
|
-
case DerivedRepeaterVarIdentity.Odd:
|
|
22272
|
-
return new BinaryOperatorExpr(BinaryOperator.NotIdentical, new BinaryOperatorExpr(BinaryOperator.Modulo, new LexicalReadExpr(repeaterOp.varNames.$index), literal(2)), literal(0));
|
|
22273
|
-
}
|
|
22274
|
-
}, VisitorContextFlag.None);
|
|
22275
|
-
}
|
|
22276
|
-
}
|
|
22277
|
-
}
|
|
22278
|
-
|
|
22279
22216
|
/**
|
|
22280
22217
|
* Resolves `ir.ContextExpr` expressions (which represent embedded view or component contexts) to
|
|
22281
22218
|
* either the `ctx` parameter to component functions (for the current view context) or to variables
|
|
@@ -23856,7 +23793,6 @@ const phases = [
|
|
|
23856
23793
|
{ kind: CompilationJobKind.Tmpl, fn: saveAndRestoreView },
|
|
23857
23794
|
{ kind: CompilationJobKind.Both, fn: deleteAnyCasts },
|
|
23858
23795
|
{ kind: CompilationJobKind.Both, fn: resolveDollarEvent },
|
|
23859
|
-
{ kind: CompilationJobKind.Tmpl, fn: generateRepeaterDerivedVars },
|
|
23860
23796
|
{ kind: CompilationJobKind.Tmpl, fn: generateTrackVariables },
|
|
23861
23797
|
{ kind: CompilationJobKind.Both, fn: resolveNames },
|
|
23862
23798
|
{ kind: CompilationJobKind.Tmpl, fn: resolveDeferTargetNames },
|
|
@@ -24275,6 +24211,10 @@ function ingestIfBlock(unit, ifBlock) {
|
|
|
24275
24211
|
* Ingest an `@switch` block into the given `ViewCompilation`.
|
|
24276
24212
|
*/
|
|
24277
24213
|
function ingestSwitchBlock(unit, switchBlock) {
|
|
24214
|
+
// Don't ingest empty switches since they won't render anything.
|
|
24215
|
+
if (switchBlock.cases.length === 0) {
|
|
24216
|
+
return;
|
|
24217
|
+
}
|
|
24278
24218
|
let firstXref = null;
|
|
24279
24219
|
let firstSlotHandle = null;
|
|
24280
24220
|
let conditions = [];
|
|
@@ -24431,22 +24371,43 @@ function ingestIcu(unit, icu) {
|
|
|
24431
24371
|
*/
|
|
24432
24372
|
function ingestForBlock(unit, forBlock) {
|
|
24433
24373
|
const repeaterView = unit.job.allocateView(unit.xref);
|
|
24434
|
-
const createRepeaterAlias = (ident, repeaterVar) => {
|
|
24435
|
-
repeaterView.aliases.add({
|
|
24436
|
-
kind: SemanticVariableKind.Alias,
|
|
24437
|
-
name: null,
|
|
24438
|
-
identifier: ident,
|
|
24439
|
-
expression: new DerivedRepeaterVarExpr(repeaterView.xref, repeaterVar),
|
|
24440
|
-
});
|
|
24441
|
-
};
|
|
24442
24374
|
// Set all the context variables and aliases available in the repeater.
|
|
24443
24375
|
repeaterView.contextVariables.set(forBlock.item.name, forBlock.item.value);
|
|
24444
24376
|
repeaterView.contextVariables.set(forBlock.contextVariables.$index.name, forBlock.contextVariables.$index.value);
|
|
24445
24377
|
repeaterView.contextVariables.set(forBlock.contextVariables.$count.name, forBlock.contextVariables.$count.value);
|
|
24446
|
-
|
|
24447
|
-
|
|
24448
|
-
|
|
24449
|
-
|
|
24378
|
+
// We copy TemplateDefinitionBuilder's scheme of creating names for `$count` and `$index` that are
|
|
24379
|
+
// suffixed with special information, to disambiguate which level of nested loop the below aliases
|
|
24380
|
+
// refer to.
|
|
24381
|
+
// TODO: We should refactor Template Pipeline's variable phases to gracefully handle shadowing,
|
|
24382
|
+
// and arbitrarily many levels of variables depending on each other.
|
|
24383
|
+
const indexName = `ɵ${forBlock.contextVariables.$index.name}_${repeaterView.xref}`;
|
|
24384
|
+
const countName = `ɵ${forBlock.contextVariables.$count.name}_${repeaterView.xref}`;
|
|
24385
|
+
repeaterView.contextVariables.set(indexName, forBlock.contextVariables.$index.value);
|
|
24386
|
+
repeaterView.contextVariables.set(countName, forBlock.contextVariables.$count.value);
|
|
24387
|
+
repeaterView.aliases.add({
|
|
24388
|
+
kind: SemanticVariableKind.Alias,
|
|
24389
|
+
name: null,
|
|
24390
|
+
identifier: forBlock.contextVariables.$first.name,
|
|
24391
|
+
expression: new LexicalReadExpr(indexName).identical(literal(0))
|
|
24392
|
+
});
|
|
24393
|
+
repeaterView.aliases.add({
|
|
24394
|
+
kind: SemanticVariableKind.Alias,
|
|
24395
|
+
name: null,
|
|
24396
|
+
identifier: forBlock.contextVariables.$last.name,
|
|
24397
|
+
expression: new LexicalReadExpr(indexName).identical(new LexicalReadExpr(countName).minus(literal(1)))
|
|
24398
|
+
});
|
|
24399
|
+
repeaterView.aliases.add({
|
|
24400
|
+
kind: SemanticVariableKind.Alias,
|
|
24401
|
+
name: null,
|
|
24402
|
+
identifier: forBlock.contextVariables.$even.name,
|
|
24403
|
+
expression: new LexicalReadExpr(indexName).modulo(literal(2)).identical(literal(0))
|
|
24404
|
+
});
|
|
24405
|
+
repeaterView.aliases.add({
|
|
24406
|
+
kind: SemanticVariableKind.Alias,
|
|
24407
|
+
name: null,
|
|
24408
|
+
identifier: forBlock.contextVariables.$odd.name,
|
|
24409
|
+
expression: new LexicalReadExpr(indexName).modulo(literal(2)).notIdentical(literal(0))
|
|
24410
|
+
});
|
|
24450
24411
|
const sourceSpan = convertSourceSpan(forBlock.trackBy.span, forBlock.sourceSpan);
|
|
24451
24412
|
const track = convertAst(forBlock.trackBy, unit.job, sourceSpan);
|
|
24452
24413
|
ingestNodes(repeaterView, forBlock.children);
|
|
@@ -24711,7 +24672,7 @@ function ingestTemplateBindings(unit, op, template, templateKind) {
|
|
|
24711
24672
|
output.type !== 1 /* e.ParsedEventType.Animation */) {
|
|
24712
24673
|
// Animation bindings are excluded from the structural template's const array.
|
|
24713
24674
|
const securityContext = domSchema.securityContext(NG_TEMPLATE_TAG_NAME$1, output.name, false);
|
|
24714
|
-
unit.create.push(createExtractedAttributeOp(op.xref, BindingKind.Property, output.name, null, null, null, securityContext));
|
|
24675
|
+
unit.create.push(createExtractedAttributeOp(op.xref, BindingKind.Property, null, output.name, null, null, null, securityContext));
|
|
24715
24676
|
}
|
|
24716
24677
|
}
|
|
24717
24678
|
// TODO: Perhaps we could do this in a phase? (It likely wouldn't change the slot indices.)
|
|
@@ -24759,7 +24720,7 @@ function createTemplateBinding(view, xref, type, name, value, unit, securityCont
|
|
|
24759
24720
|
// inner node of a structural template. We can't skip it entirely, because we still need it on
|
|
24760
24721
|
// the ng-template's consts (e.g. for the purposes of directive matching). However, we should
|
|
24761
24722
|
// not generate an update instruction for it.
|
|
24762
|
-
return createExtractedAttributeOp(xref, BindingKind.Property, name, null, null, i18nMessage, securityContext);
|
|
24723
|
+
return createExtractedAttributeOp(xref, BindingKind.Property, null, name, null, null, i18nMessage, securityContext);
|
|
24763
24724
|
}
|
|
24764
24725
|
if (!isTextBinding && (type === 1 /* e.BindingType.Attribute */ || type === 4 /* e.BindingType.Animation */)) {
|
|
24765
24726
|
// Again, this binding doesn't really target the ng-template; it actually targets the element
|
|
@@ -28561,6 +28522,9 @@ class TemplateDefinitionBuilder {
|
|
|
28561
28522
|
this.updateInstructionWithAdvance(containerIndex, block.branches[0].sourceSpan, Identifiers.conditional, paramsCallback);
|
|
28562
28523
|
}
|
|
28563
28524
|
visitSwitchBlock(block) {
|
|
28525
|
+
if (block.cases.length === 0) {
|
|
28526
|
+
return;
|
|
28527
|
+
}
|
|
28564
28528
|
// We have to process the block in two steps: once here and again in the update instruction
|
|
28565
28529
|
// callback in order to generate the correct expressions when pipes or pure functions are used.
|
|
28566
28530
|
const caseData = block.cases.map(currentCase => {
|
|
@@ -29019,7 +28983,7 @@ class TemplateDefinitionBuilder {
|
|
|
29019
28983
|
if (delta < 1) {
|
|
29020
28984
|
throw new Error('advance instruction can only go forwards');
|
|
29021
28985
|
}
|
|
29022
|
-
this.instructionFn(this._updateCodeFns, span, Identifiers.advance, [literal(delta)]);
|
|
28986
|
+
this.instructionFn(this._updateCodeFns, span, Identifiers.advance, delta > 1 ? [literal(delta)] : []);
|
|
29023
28987
|
this._currentIndex = nodeIndex;
|
|
29024
28988
|
}
|
|
29025
28989
|
}
|
|
@@ -32088,7 +32052,7 @@ function publishFacade(global) {
|
|
|
32088
32052
|
* @description
|
|
32089
32053
|
* Entry point for all public APIs of the compiler package.
|
|
32090
32054
|
*/
|
|
32091
|
-
const VERSION = new Version('17.0.
|
|
32055
|
+
const VERSION = new Version('17.0.9');
|
|
32092
32056
|
|
|
32093
32057
|
class CompilerConfig {
|
|
32094
32058
|
constructor({ defaultEncapsulation = ViewEncapsulation.Emulated, preserveWhitespaces, strictInjectionParameters } = {}) {
|
|
@@ -33654,7 +33618,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$6 = '12.0.0';
|
|
|
33654
33618
|
function compileDeclareClassMetadata(metadata) {
|
|
33655
33619
|
const definitionMap = new DefinitionMap();
|
|
33656
33620
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$6));
|
|
33657
|
-
definitionMap.set('version', literal('17.0.
|
|
33621
|
+
definitionMap.set('version', literal('17.0.9'));
|
|
33658
33622
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33659
33623
|
definitionMap.set('type', metadata.type);
|
|
33660
33624
|
definitionMap.set('decorators', metadata.decorators);
|
|
@@ -33762,7 +33726,7 @@ function createDirectiveDefinitionMap(meta) {
|
|
|
33762
33726
|
// in 16.1 is actually used.
|
|
33763
33727
|
const minVersion = hasTransformFunctions ? MINIMUM_PARTIAL_LINKER_VERSION$5 : '14.0.0';
|
|
33764
33728
|
definitionMap.set('minVersion', literal(minVersion));
|
|
33765
|
-
definitionMap.set('version', literal('17.0.
|
|
33729
|
+
definitionMap.set('version', literal('17.0.9'));
|
|
33766
33730
|
// e.g. `type: MyDirective`
|
|
33767
33731
|
definitionMap.set('type', meta.type.value);
|
|
33768
33732
|
if (meta.isStandalone) {
|
|
@@ -34039,7 +34003,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
|
|
|
34039
34003
|
function compileDeclareFactoryFunction(meta) {
|
|
34040
34004
|
const definitionMap = new DefinitionMap();
|
|
34041
34005
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
|
|
34042
|
-
definitionMap.set('version', literal('17.0.
|
|
34006
|
+
definitionMap.set('version', literal('17.0.9'));
|
|
34043
34007
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
34044
34008
|
definitionMap.set('type', meta.type.value);
|
|
34045
34009
|
definitionMap.set('deps', compileDependencies(meta.deps));
|
|
@@ -34074,7 +34038,7 @@ function compileDeclareInjectableFromMetadata(meta) {
|
|
|
34074
34038
|
function createInjectableDefinitionMap(meta) {
|
|
34075
34039
|
const definitionMap = new DefinitionMap();
|
|
34076
34040
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
|
|
34077
|
-
definitionMap.set('version', literal('17.0.
|
|
34041
|
+
definitionMap.set('version', literal('17.0.9'));
|
|
34078
34042
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
34079
34043
|
definitionMap.set('type', meta.type.value);
|
|
34080
34044
|
// Only generate providedIn property if it has a non-null value
|
|
@@ -34125,7 +34089,7 @@ function compileDeclareInjectorFromMetadata(meta) {
|
|
|
34125
34089
|
function createInjectorDefinitionMap(meta) {
|
|
34126
34090
|
const definitionMap = new DefinitionMap();
|
|
34127
34091
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
|
|
34128
|
-
definitionMap.set('version', literal('17.0.
|
|
34092
|
+
definitionMap.set('version', literal('17.0.9'));
|
|
34129
34093
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
34130
34094
|
definitionMap.set('type', meta.type.value);
|
|
34131
34095
|
definitionMap.set('providers', meta.providers);
|
|
@@ -34158,7 +34122,7 @@ function createNgModuleDefinitionMap(meta) {
|
|
|
34158
34122
|
throw new Error('Invalid path! Local compilation mode should not get into the partial compilation path');
|
|
34159
34123
|
}
|
|
34160
34124
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
|
|
34161
|
-
definitionMap.set('version', literal('17.0.
|
|
34125
|
+
definitionMap.set('version', literal('17.0.9'));
|
|
34162
34126
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
34163
34127
|
definitionMap.set('type', meta.type.value);
|
|
34164
34128
|
// We only generate the keys in the metadata if the arrays contain values.
|
|
@@ -34209,7 +34173,7 @@ function compileDeclarePipeFromMetadata(meta) {
|
|
|
34209
34173
|
function createPipeDefinitionMap(meta) {
|
|
34210
34174
|
const definitionMap = new DefinitionMap();
|
|
34211
34175
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
|
|
34212
|
-
definitionMap.set('version', literal('17.0.
|
|
34176
|
+
definitionMap.set('version', literal('17.0.9'));
|
|
34213
34177
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
34214
34178
|
// e.g. `type: MyPipe`
|
|
34215
34179
|
definitionMap.set('type', meta.type.value);
|