@angular/core 17.0.2 → 17.0.4
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/core_render3_private_export.mjs +2 -2
- package/esm2022/src/defer/instructions.mjs +3 -2
- package/esm2022/src/defer/utils.mjs +2 -2
- package/esm2022/src/image_performance_warning.mjs +14 -3
- package/esm2022/src/render3/index.mjs +2 -2
- package/esm2022/src/render3/instructions/change_detection.mjs +10 -20
- package/esm2022/src/render3/instructions/control_flow.mjs +9 -11
- package/esm2022/src/render3/instructions/shared.mjs +4 -5
- package/esm2022/src/render3/interfaces/container.mjs +22 -17
- package/esm2022/src/render3/interfaces/view.mjs +2 -2
- package/esm2022/src/render3/node_manipulation.mjs +3 -3
- package/esm2022/src/render3/util/change_detection_utils.mjs +13 -2
- package/esm2022/src/render3/util/injector_discovery_utils.mjs +10 -13
- package/esm2022/src/render3/util/view_utils.mjs +4 -4
- package/esm2022/src/render3/view_ref.mjs +3 -3
- package/esm2022/src/version.mjs +1 -1
- package/esm2022/testing/src/logger.mjs +3 -3
- package/esm2022/testing/src/test_bed_compiler.mjs +4 -1
- package/fesm2022/core.mjs +83 -70
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/primitives/signals.mjs +1 -1
- package/fesm2022/rxjs-interop.mjs +1 -1
- package/fesm2022/testing.mjs +4 -1
- package/fesm2022/testing.mjs.map +1 -1
- package/index.d.ts +28 -40
- package/package.json +1 -1
- package/primitives/signals/index.d.ts +1 -1
- package/rxjs-interop/index.d.ts +1 -1
- package/schematics/migrations/block-template-entities/bundle.js +385 -159
- package/schematics/migrations/block-template-entities/bundle.js.map +4 -4
- package/schematics/ng-generate/control-flow-migration/bundle.js +867 -371
- package/schematics/ng-generate/control-flow-migration/bundle.js.map +4 -4
- package/schematics/ng-generate/control-flow-migration/schema.json +6 -0
- package/schematics/ng-generate/standalone-migration/bundle.js +422 -168
- package/schematics/ng-generate/standalone-migration/bundle.js.map +4 -4
- package/testing/index.d.ts +1 -1
|
@@ -609,6 +609,9 @@ var _SerializerVisitor = class {
|
|
|
609
609
|
visitIcuPlaceholder(ph, context) {
|
|
610
610
|
return `<ph icu name="${ph.name}">${ph.value.visit(this)}</ph>`;
|
|
611
611
|
}
|
|
612
|
+
visitBlockPlaceholder(ph, context) {
|
|
613
|
+
return `<ph block name="${ph.startName}">${ph.children.map((child) => child.visit(this)).join(", ")}</ph name="${ph.closeName}">`;
|
|
614
|
+
}
|
|
612
615
|
};
|
|
613
616
|
var serializerVisitor = new _SerializerVisitor();
|
|
614
617
|
function serializeNodes(nodes) {
|
|
@@ -3654,43 +3657,47 @@ var BlockNode = class {
|
|
|
3654
3657
|
}
|
|
3655
3658
|
};
|
|
3656
3659
|
var DeferredBlockPlaceholder = class extends BlockNode {
|
|
3657
|
-
constructor(children, minimumTime, nameSpan, sourceSpan, startSourceSpan, endSourceSpan) {
|
|
3660
|
+
constructor(children, minimumTime, nameSpan, sourceSpan, startSourceSpan, endSourceSpan, i18n2) {
|
|
3658
3661
|
super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);
|
|
3659
3662
|
this.children = children;
|
|
3660
3663
|
this.minimumTime = minimumTime;
|
|
3664
|
+
this.i18n = i18n2;
|
|
3661
3665
|
}
|
|
3662
3666
|
visit(visitor) {
|
|
3663
3667
|
return visitor.visitDeferredBlockPlaceholder(this);
|
|
3664
3668
|
}
|
|
3665
3669
|
};
|
|
3666
3670
|
var DeferredBlockLoading = class extends BlockNode {
|
|
3667
|
-
constructor(children, afterTime, minimumTime, nameSpan, sourceSpan, startSourceSpan, endSourceSpan) {
|
|
3671
|
+
constructor(children, afterTime, minimumTime, nameSpan, sourceSpan, startSourceSpan, endSourceSpan, i18n2) {
|
|
3668
3672
|
super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);
|
|
3669
3673
|
this.children = children;
|
|
3670
3674
|
this.afterTime = afterTime;
|
|
3671
3675
|
this.minimumTime = minimumTime;
|
|
3676
|
+
this.i18n = i18n2;
|
|
3672
3677
|
}
|
|
3673
3678
|
visit(visitor) {
|
|
3674
3679
|
return visitor.visitDeferredBlockLoading(this);
|
|
3675
3680
|
}
|
|
3676
3681
|
};
|
|
3677
3682
|
var DeferredBlockError = class extends BlockNode {
|
|
3678
|
-
constructor(children, nameSpan, sourceSpan, startSourceSpan, endSourceSpan) {
|
|
3683
|
+
constructor(children, nameSpan, sourceSpan, startSourceSpan, endSourceSpan, i18n2) {
|
|
3679
3684
|
super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);
|
|
3680
3685
|
this.children = children;
|
|
3686
|
+
this.i18n = i18n2;
|
|
3681
3687
|
}
|
|
3682
3688
|
visit(visitor) {
|
|
3683
3689
|
return visitor.visitDeferredBlockError(this);
|
|
3684
3690
|
}
|
|
3685
3691
|
};
|
|
3686
3692
|
var DeferredBlock = class extends BlockNode {
|
|
3687
|
-
constructor(children, triggers, prefetchTriggers, placeholder, loading, error2, nameSpan, sourceSpan, mainBlockSpan, startSourceSpan, endSourceSpan) {
|
|
3693
|
+
constructor(children, triggers, prefetchTriggers, placeholder, loading, error2, nameSpan, sourceSpan, mainBlockSpan, startSourceSpan, endSourceSpan, i18n2) {
|
|
3688
3694
|
super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);
|
|
3689
3695
|
this.children = children;
|
|
3690
3696
|
this.placeholder = placeholder;
|
|
3691
3697
|
this.loading = loading;
|
|
3692
3698
|
this.error = error2;
|
|
3693
3699
|
this.mainBlockSpan = mainBlockSpan;
|
|
3700
|
+
this.i18n = i18n2;
|
|
3694
3701
|
this.triggers = triggers;
|
|
3695
3702
|
this.prefetchTriggers = prefetchTriggers;
|
|
3696
3703
|
this.definedTriggers = Object.keys(triggers);
|
|
@@ -3722,17 +3729,18 @@ var SwitchBlock = class extends BlockNode {
|
|
|
3722
3729
|
}
|
|
3723
3730
|
};
|
|
3724
3731
|
var SwitchBlockCase = class extends BlockNode {
|
|
3725
|
-
constructor(expression, children, sourceSpan, startSourceSpan, endSourceSpan, nameSpan) {
|
|
3732
|
+
constructor(expression, children, sourceSpan, startSourceSpan, endSourceSpan, nameSpan, i18n2) {
|
|
3726
3733
|
super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);
|
|
3727
3734
|
this.expression = expression;
|
|
3728
3735
|
this.children = children;
|
|
3736
|
+
this.i18n = i18n2;
|
|
3729
3737
|
}
|
|
3730
3738
|
visit(visitor) {
|
|
3731
3739
|
return visitor.visitSwitchBlockCase(this);
|
|
3732
3740
|
}
|
|
3733
3741
|
};
|
|
3734
3742
|
var ForLoopBlock = class extends BlockNode {
|
|
3735
|
-
constructor(item, expression, trackBy, trackKeywordSpan, contextVariables, children, empty, sourceSpan, mainBlockSpan, startSourceSpan, endSourceSpan, nameSpan) {
|
|
3743
|
+
constructor(item, expression, trackBy, trackKeywordSpan, contextVariables, children, empty, sourceSpan, mainBlockSpan, startSourceSpan, endSourceSpan, nameSpan, i18n2) {
|
|
3736
3744
|
super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);
|
|
3737
3745
|
this.item = item;
|
|
3738
3746
|
this.expression = expression;
|
|
@@ -3742,15 +3750,17 @@ var ForLoopBlock = class extends BlockNode {
|
|
|
3742
3750
|
this.children = children;
|
|
3743
3751
|
this.empty = empty;
|
|
3744
3752
|
this.mainBlockSpan = mainBlockSpan;
|
|
3753
|
+
this.i18n = i18n2;
|
|
3745
3754
|
}
|
|
3746
3755
|
visit(visitor) {
|
|
3747
3756
|
return visitor.visitForLoopBlock(this);
|
|
3748
3757
|
}
|
|
3749
3758
|
};
|
|
3750
3759
|
var ForLoopBlockEmpty = class extends BlockNode {
|
|
3751
|
-
constructor(children, sourceSpan, startSourceSpan, endSourceSpan, nameSpan) {
|
|
3760
|
+
constructor(children, sourceSpan, startSourceSpan, endSourceSpan, nameSpan, i18n2) {
|
|
3752
3761
|
super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);
|
|
3753
3762
|
this.children = children;
|
|
3763
|
+
this.i18n = i18n2;
|
|
3754
3764
|
}
|
|
3755
3765
|
visit(visitor) {
|
|
3756
3766
|
return visitor.visitForLoopBlockEmpty(this);
|
|
@@ -3766,11 +3776,12 @@ var IfBlock = class extends BlockNode {
|
|
|
3766
3776
|
}
|
|
3767
3777
|
};
|
|
3768
3778
|
var IfBlockBranch = class extends BlockNode {
|
|
3769
|
-
constructor(expression, children, expressionAlias, sourceSpan, startSourceSpan, endSourceSpan, nameSpan) {
|
|
3779
|
+
constructor(expression, children, expressionAlias, sourceSpan, startSourceSpan, endSourceSpan, nameSpan, i18n2) {
|
|
3770
3780
|
super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);
|
|
3771
3781
|
this.expression = expression;
|
|
3772
3782
|
this.children = children;
|
|
3773
3783
|
this.expressionAlias = expressionAlias;
|
|
3784
|
+
this.i18n = i18n2;
|
|
3774
3785
|
}
|
|
3775
3786
|
visit(visitor) {
|
|
3776
3787
|
return visitor.visitIfBlockBranch(this);
|
|
@@ -3960,6 +3971,43 @@ var IcuPlaceholder = class {
|
|
|
3960
3971
|
return visitor.visitIcuPlaceholder(this, context);
|
|
3961
3972
|
}
|
|
3962
3973
|
};
|
|
3974
|
+
var BlockPlaceholder = class {
|
|
3975
|
+
constructor(name, parameters, startName, closeName, children, sourceSpan, startSourceSpan, endSourceSpan) {
|
|
3976
|
+
this.name = name;
|
|
3977
|
+
this.parameters = parameters;
|
|
3978
|
+
this.startName = startName;
|
|
3979
|
+
this.closeName = closeName;
|
|
3980
|
+
this.children = children;
|
|
3981
|
+
this.sourceSpan = sourceSpan;
|
|
3982
|
+
this.startSourceSpan = startSourceSpan;
|
|
3983
|
+
this.endSourceSpan = endSourceSpan;
|
|
3984
|
+
}
|
|
3985
|
+
visit(visitor, context) {
|
|
3986
|
+
return visitor.visitBlockPlaceholder(this, context);
|
|
3987
|
+
}
|
|
3988
|
+
};
|
|
3989
|
+
var RecurseVisitor = class {
|
|
3990
|
+
visitText(text2, context) {
|
|
3991
|
+
}
|
|
3992
|
+
visitContainer(container, context) {
|
|
3993
|
+
container.children.forEach((child) => child.visit(this));
|
|
3994
|
+
}
|
|
3995
|
+
visitIcu(icu, context) {
|
|
3996
|
+
Object.keys(icu.cases).forEach((k) => {
|
|
3997
|
+
icu.cases[k].visit(this);
|
|
3998
|
+
});
|
|
3999
|
+
}
|
|
4000
|
+
visitTagPlaceholder(ph, context) {
|
|
4001
|
+
ph.children.forEach((child) => child.visit(this));
|
|
4002
|
+
}
|
|
4003
|
+
visitPlaceholder(ph, context) {
|
|
4004
|
+
}
|
|
4005
|
+
visitIcuPlaceholder(ph, context) {
|
|
4006
|
+
}
|
|
4007
|
+
visitBlockPlaceholder(ph, context) {
|
|
4008
|
+
ph.children.forEach((child) => child.visit(this));
|
|
4009
|
+
}
|
|
4010
|
+
};
|
|
3963
4011
|
function serializeMessage(messageNodes) {
|
|
3964
4012
|
const visitor = new LocalizeMessageStringVisitor();
|
|
3965
4013
|
const str = messageNodes.map((n) => n.visit(visitor)).join("");
|
|
@@ -3986,6 +4034,10 @@ var LocalizeMessageStringVisitor = class {
|
|
|
3986
4034
|
visitIcuPlaceholder(ph) {
|
|
3987
4035
|
return `{$${ph.name}}`;
|
|
3988
4036
|
}
|
|
4037
|
+
visitBlockPlaceholder(ph) {
|
|
4038
|
+
const children = ph.children.map((child) => child.visit(this)).join("");
|
|
4039
|
+
return `{$${ph.startName}}${children}{$${ph.closeName}}`;
|
|
4040
|
+
}
|
|
3989
4041
|
};
|
|
3990
4042
|
|
|
3991
4043
|
// bazel-out/k8-fastbuild/bin/packages/compiler/src/i18n/serializers/xml_helper.mjs
|
|
@@ -4453,7 +4505,7 @@ function assertInterpolationSymbols(identifier, value) {
|
|
|
4453
4505
|
}
|
|
4454
4506
|
}
|
|
4455
4507
|
|
|
4456
|
-
// bazel-out/k8-fastbuild/bin/packages/compiler/src/ml_parser/
|
|
4508
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler/src/ml_parser/defaults.mjs
|
|
4457
4509
|
var InterpolationConfig = class {
|
|
4458
4510
|
static fromArray(markers) {
|
|
4459
4511
|
if (!markers) {
|
|
@@ -4468,6 +4520,7 @@ var InterpolationConfig = class {
|
|
|
4468
4520
|
}
|
|
4469
4521
|
};
|
|
4470
4522
|
var DEFAULT_INTERPOLATION_CONFIG = new InterpolationConfig("{{", "}}");
|
|
4523
|
+
var DEFAULT_CONTAINER_BLOCKS = /* @__PURE__ */ new Set(["switch"]);
|
|
4471
4524
|
|
|
4472
4525
|
// bazel-out/k8-fastbuild/bin/packages/compiler/src/chars.mjs
|
|
4473
4526
|
var $EOF = 0;
|
|
@@ -7003,8 +7056,8 @@ var OpKind;
|
|
|
7003
7056
|
OpKind2[OpKind2["I18nEnd"] = 38] = "I18nEnd";
|
|
7004
7057
|
OpKind2[OpKind2["I18nExpression"] = 39] = "I18nExpression";
|
|
7005
7058
|
OpKind2[OpKind2["I18nApply"] = 40] = "I18nApply";
|
|
7006
|
-
OpKind2[OpKind2["
|
|
7007
|
-
OpKind2[OpKind2["
|
|
7059
|
+
OpKind2[OpKind2["IcuStart"] = 41] = "IcuStart";
|
|
7060
|
+
OpKind2[OpKind2["IcuEnd"] = 42] = "IcuEnd";
|
|
7008
7061
|
OpKind2[OpKind2["I18nContext"] = 43] = "I18nContext";
|
|
7009
7062
|
})(OpKind || (OpKind = {}));
|
|
7010
7063
|
var ExpressionKind;
|
|
@@ -7089,6 +7142,7 @@ var I18nParamValueFlags;
|
|
|
7089
7142
|
I18nParamValueFlags2[I18nParamValueFlags2["TemplateTag"] = 2] = "TemplateTag";
|
|
7090
7143
|
I18nParamValueFlags2[I18nParamValueFlags2["OpenTag"] = 4] = "OpenTag";
|
|
7091
7144
|
I18nParamValueFlags2[I18nParamValueFlags2["CloseTag"] = 8] = "CloseTag";
|
|
7145
|
+
I18nParamValueFlags2[I18nParamValueFlags2["ExpressionIndex"] = 16] = "ExpressionIndex";
|
|
7092
7146
|
})(I18nParamValueFlags || (I18nParamValueFlags = {}));
|
|
7093
7147
|
var Namespace;
|
|
7094
7148
|
(function(Namespace2) {
|
|
@@ -7278,13 +7332,13 @@ function createConditionalOp(target, targetSlot, test, conditions, sourceSpan) {
|
|
|
7278
7332
|
}, NEW_OP), TRAIT_DEPENDS_ON_SLOT_CONTEXT), TRAIT_CONSUMES_VARS);
|
|
7279
7333
|
}
|
|
7280
7334
|
function createRepeaterOp(repeaterCreate2, targetSlot, collection, sourceSpan) {
|
|
7281
|
-
return __spreadValues({
|
|
7335
|
+
return __spreadValues(__spreadValues({
|
|
7282
7336
|
kind: OpKind.Repeater,
|
|
7283
7337
|
target: repeaterCreate2,
|
|
7284
7338
|
targetSlot,
|
|
7285
7339
|
collection,
|
|
7286
7340
|
sourceSpan
|
|
7287
|
-
}, NEW_OP);
|
|
7341
|
+
}, NEW_OP), TRAIT_DEPENDS_ON_SLOT_CONTEXT);
|
|
7288
7342
|
}
|
|
7289
7343
|
function createDeferWhenOp(target, expr, prefetch, sourceSpan) {
|
|
7290
7344
|
return __spreadValues(__spreadValues({
|
|
@@ -7315,13 +7369,6 @@ function createI18nApplyOp(target, handle, sourceSpan) {
|
|
|
7315
7369
|
sourceSpan
|
|
7316
7370
|
}, NEW_OP);
|
|
7317
7371
|
}
|
|
7318
|
-
function createIcuUpdateOp(xref, sourceSpan) {
|
|
7319
|
-
return __spreadValues({
|
|
7320
|
-
kind: OpKind.IcuUpdate,
|
|
7321
|
-
xref,
|
|
7322
|
-
sourceSpan
|
|
7323
|
-
}, NEW_OP);
|
|
7324
|
-
}
|
|
7325
7372
|
|
|
7326
7373
|
// bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/expression.mjs
|
|
7327
7374
|
var _a;
|
|
@@ -8085,8 +8132,8 @@ function transformExpressionsInOp(op, transform2, flags) {
|
|
|
8085
8132
|
case OpKind.I18nContext:
|
|
8086
8133
|
case OpKind.I18nEnd:
|
|
8087
8134
|
case OpKind.I18nStart:
|
|
8088
|
-
case OpKind.
|
|
8089
|
-
case OpKind.
|
|
8135
|
+
case OpKind.IcuEnd:
|
|
8136
|
+
case OpKind.IcuStart:
|
|
8090
8137
|
case OpKind.Namespace:
|
|
8091
8138
|
case OpKind.Pipe:
|
|
8092
8139
|
case OpKind.Projection:
|
|
@@ -8588,17 +8635,22 @@ function createI18nEndOp(xref) {
|
|
|
8588
8635
|
xref
|
|
8589
8636
|
}, NEW_OP);
|
|
8590
8637
|
}
|
|
8591
|
-
function
|
|
8638
|
+
function createIcuStartOp(xref, message, messagePlaceholder, sourceSpan) {
|
|
8592
8639
|
return __spreadValues({
|
|
8593
|
-
kind: OpKind.
|
|
8640
|
+
kind: OpKind.IcuStart,
|
|
8594
8641
|
xref,
|
|
8595
8642
|
message,
|
|
8596
|
-
icu,
|
|
8597
8643
|
messagePlaceholder,
|
|
8598
8644
|
context: null,
|
|
8599
8645
|
sourceSpan
|
|
8600
8646
|
}, NEW_OP);
|
|
8601
8647
|
}
|
|
8648
|
+
function createIcuEndOp(xref) {
|
|
8649
|
+
return __spreadValues({
|
|
8650
|
+
kind: OpKind.IcuEnd,
|
|
8651
|
+
xref
|
|
8652
|
+
}, NEW_OP);
|
|
8653
|
+
}
|
|
8602
8654
|
function createI18nContextOp(xref, i18nBlock, message, sourceSpan) {
|
|
8603
8655
|
return __spreadValues({
|
|
8604
8656
|
kind: OpKind.I18nContext,
|
|
@@ -8752,20 +8804,30 @@ function removeAnys(e) {
|
|
|
8752
8804
|
|
|
8753
8805
|
// bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/apply_i18n_expressions.mjs
|
|
8754
8806
|
function applyI18nExpressions(job) {
|
|
8807
|
+
const i18nContexts = /* @__PURE__ */ new Map();
|
|
8808
|
+
for (const unit of job.units) {
|
|
8809
|
+
for (const op of unit.create) {
|
|
8810
|
+
if (op.kind === OpKind.I18nContext) {
|
|
8811
|
+
i18nContexts.set(op.xref, op);
|
|
8812
|
+
}
|
|
8813
|
+
}
|
|
8814
|
+
}
|
|
8755
8815
|
for (const unit of job.units) {
|
|
8756
8816
|
for (const op of unit.update) {
|
|
8757
|
-
if (op.kind === OpKind.I18nExpression && needsApplication(op)) {
|
|
8817
|
+
if (op.kind === OpKind.I18nExpression && needsApplication(i18nContexts, op)) {
|
|
8758
8818
|
OpList.insertAfter(createI18nApplyOp(op.target, op.handle, null), op);
|
|
8759
8819
|
}
|
|
8760
8820
|
}
|
|
8761
8821
|
}
|
|
8762
8822
|
}
|
|
8763
|
-
function needsApplication(op) {
|
|
8823
|
+
function needsApplication(i18nContexts, op) {
|
|
8764
8824
|
var _a2;
|
|
8765
8825
|
if (((_a2 = op.next) == null ? void 0 : _a2.kind) !== OpKind.I18nExpression) {
|
|
8766
8826
|
return true;
|
|
8767
8827
|
}
|
|
8768
|
-
|
|
8828
|
+
const context = i18nContexts.get(op.context);
|
|
8829
|
+
const nextContext2 = i18nContexts.get(op.next.context);
|
|
8830
|
+
if (context.i18nBlock !== nextContext2.i18nBlock) {
|
|
8769
8831
|
return true;
|
|
8770
8832
|
}
|
|
8771
8833
|
return false;
|
|
@@ -9309,7 +9371,7 @@ function createI18nContexts(job) {
|
|
|
9309
9371
|
case OpKind.I18nEnd:
|
|
9310
9372
|
currentI18nOp = null;
|
|
9311
9373
|
break;
|
|
9312
|
-
case OpKind.
|
|
9374
|
+
case OpKind.IcuStart:
|
|
9313
9375
|
if (currentI18nOp === null) {
|
|
9314
9376
|
throw Error("Unexpected ICU outside of an i18n block.");
|
|
9315
9377
|
}
|
|
@@ -9326,52 +9388,6 @@ function createI18nContexts(job) {
|
|
|
9326
9388
|
}
|
|
9327
9389
|
}
|
|
9328
9390
|
|
|
9329
|
-
// bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/create_i18n_icu_expressions.mjs
|
|
9330
|
-
function createI18nIcuExpressions(job) {
|
|
9331
|
-
const icus = /* @__PURE__ */ new Map();
|
|
9332
|
-
const i18nContexts = /* @__PURE__ */ new Map();
|
|
9333
|
-
const i18nBlocks = /* @__PURE__ */ new Map();
|
|
9334
|
-
for (const unit of job.units) {
|
|
9335
|
-
for (const op of unit.create) {
|
|
9336
|
-
switch (op.kind) {
|
|
9337
|
-
case OpKind.Icu:
|
|
9338
|
-
icus.set(op.xref, op);
|
|
9339
|
-
break;
|
|
9340
|
-
case OpKind.I18nContext:
|
|
9341
|
-
i18nContexts.set(op.xref, op);
|
|
9342
|
-
break;
|
|
9343
|
-
case OpKind.I18nStart:
|
|
9344
|
-
i18nBlocks.set(op.xref, op);
|
|
9345
|
-
break;
|
|
9346
|
-
}
|
|
9347
|
-
}
|
|
9348
|
-
for (const op of unit.update) {
|
|
9349
|
-
switch (op.kind) {
|
|
9350
|
-
case OpKind.IcuUpdate:
|
|
9351
|
-
const icuOp = icus.get(op.xref);
|
|
9352
|
-
if ((icuOp == null ? void 0 : icuOp.icu.expressionPlaceholder) === void 0) {
|
|
9353
|
-
throw Error("ICU should have an i18n placeholder");
|
|
9354
|
-
}
|
|
9355
|
-
if (icuOp.context === null) {
|
|
9356
|
-
throw Error("ICU should have its i18n context set");
|
|
9357
|
-
}
|
|
9358
|
-
const i18nContext = i18nContexts.get(icuOp.context);
|
|
9359
|
-
const i18nBlock = i18nBlocks.get(i18nContext.i18nBlock);
|
|
9360
|
-
OpList.replace(op, createI18nExpressionOp(
|
|
9361
|
-
i18nContext.xref,
|
|
9362
|
-
i18nBlock.xref,
|
|
9363
|
-
i18nBlock.handle,
|
|
9364
|
-
new LexicalReadExpr(icuOp.icu.expression),
|
|
9365
|
-
icuOp.icu.expressionPlaceholder,
|
|
9366
|
-
I18nParamResolutionTime.Postproccessing,
|
|
9367
|
-
null
|
|
9368
|
-
));
|
|
9369
|
-
break;
|
|
9370
|
-
}
|
|
9371
|
-
}
|
|
9372
|
-
}
|
|
9373
|
-
}
|
|
9374
|
-
|
|
9375
9391
|
// bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/defer_configs.mjs
|
|
9376
9392
|
function configureDeferInstructions(job) {
|
|
9377
9393
|
for (const unit of job.units) {
|
|
@@ -9685,18 +9701,23 @@ function extractI18nMessages(job) {
|
|
|
9685
9701
|
}
|
|
9686
9702
|
for (const unit of job.units) {
|
|
9687
9703
|
for (const op of unit.create) {
|
|
9688
|
-
|
|
9689
|
-
|
|
9690
|
-
|
|
9691
|
-
|
|
9692
|
-
|
|
9693
|
-
|
|
9694
|
-
|
|
9695
|
-
|
|
9696
|
-
|
|
9697
|
-
|
|
9698
|
-
|
|
9699
|
-
|
|
9704
|
+
switch (op.kind) {
|
|
9705
|
+
case OpKind.IcuStart:
|
|
9706
|
+
if (!op.context) {
|
|
9707
|
+
throw Error("ICU op should have its context set.");
|
|
9708
|
+
}
|
|
9709
|
+
if (!i18nBlockContexts.has(op.context)) {
|
|
9710
|
+
const i18nContext = i18nContexts.get(op.context);
|
|
9711
|
+
const subMessage = createI18nMessage(job, i18nContext, op.messagePlaceholder);
|
|
9712
|
+
unit.create.push(subMessage);
|
|
9713
|
+
const parentMessage = i18nBlockMessages.get(i18nContext.i18nBlock);
|
|
9714
|
+
parentMessage == null ? void 0 : parentMessage.subMessages.push(subMessage.xref);
|
|
9715
|
+
}
|
|
9716
|
+
OpList.remove(op);
|
|
9717
|
+
break;
|
|
9718
|
+
case OpKind.IcuEnd:
|
|
9719
|
+
OpList.remove(op);
|
|
9720
|
+
break;
|
|
9700
9721
|
}
|
|
9701
9722
|
}
|
|
9702
9723
|
}
|
|
@@ -9712,7 +9733,7 @@ function createI18nMessage(job, context, messagePlaceholder) {
|
|
|
9712
9733
|
}
|
|
9713
9734
|
function formatParams(params) {
|
|
9714
9735
|
const result = /* @__PURE__ */ new Map();
|
|
9715
|
-
for (const [placeholder, placeholderValues] of
|
|
9736
|
+
for (const [placeholder, placeholderValues] of params) {
|
|
9716
9737
|
const serializedValues = formatParamValues(placeholderValues);
|
|
9717
9738
|
if (serializedValues !== null) {
|
|
9718
9739
|
result.set(placeholder, literal(formatParamValues(placeholderValues)));
|
|
@@ -9728,6 +9749,9 @@ function formatParamValues(values) {
|
|
|
9728
9749
|
return serializedValues.length === 1 ? serializedValues[0] : `${LIST_START_MARKER}${serializedValues.join(LIST_DELIMITER)}${LIST_END_MARKER}`;
|
|
9729
9750
|
}
|
|
9730
9751
|
function formatValue(value) {
|
|
9752
|
+
if (value.flags === I18nParamValueFlags.None) {
|
|
9753
|
+
return `${value.value}`;
|
|
9754
|
+
}
|
|
9731
9755
|
let tagMarker = "";
|
|
9732
9756
|
let closeMarker = "";
|
|
9733
9757
|
if (value.flags & I18nParamValueFlags.ElementTag) {
|
|
@@ -9989,6 +10013,9 @@ var IcuSerializerVisitor = class {
|
|
|
9989
10013
|
visitPlaceholder(ph) {
|
|
9990
10014
|
return this.formatPh(ph.name);
|
|
9991
10015
|
}
|
|
10016
|
+
visitBlockPlaceholder(ph) {
|
|
10017
|
+
return `${this.formatPh(ph.startName)}${ph.children.map((child) => child.visit(this)).join("")}${this.formatPh(ph.closeName)}`;
|
|
10018
|
+
}
|
|
9992
10019
|
visitIcuPlaceholder(ph, context) {
|
|
9993
10020
|
return this.formatPh(ph.name);
|
|
9994
10021
|
}
|
|
@@ -11332,12 +11359,12 @@ var Comment2 = class {
|
|
|
11332
11359
|
return visitor.visitComment(this, context);
|
|
11333
11360
|
}
|
|
11334
11361
|
};
|
|
11335
|
-
var Block = class {
|
|
11336
|
-
constructor(name, parameters, children, sourceSpan, nameSpan, startSourceSpan, endSourceSpan = null) {
|
|
11362
|
+
var Block = class extends NodeWithI18n {
|
|
11363
|
+
constructor(name, parameters, children, sourceSpan, nameSpan, startSourceSpan, endSourceSpan = null, i18n2) {
|
|
11364
|
+
super(sourceSpan, i18n2);
|
|
11337
11365
|
this.name = name;
|
|
11338
11366
|
this.parameters = parameters;
|
|
11339
11367
|
this.children = children;
|
|
11340
|
-
this.sourceSpan = sourceSpan;
|
|
11341
11368
|
this.nameSpan = nameSpan;
|
|
11342
11369
|
this.startSourceSpan = startSourceSpan;
|
|
11343
11370
|
this.endSourceSpan = endSourceSpan;
|
|
@@ -11956,6 +11983,24 @@ var PlaceholderRegistry = class {
|
|
|
11956
11983
|
getUniquePlaceholder(name) {
|
|
11957
11984
|
return this._generateUniqueName(name.toUpperCase());
|
|
11958
11985
|
}
|
|
11986
|
+
getStartBlockPlaceholderName(name, parameters) {
|
|
11987
|
+
const signature = this._hashBlock(name, parameters);
|
|
11988
|
+
if (this._signatureToName[signature]) {
|
|
11989
|
+
return this._signatureToName[signature];
|
|
11990
|
+
}
|
|
11991
|
+
const placeholder = this._generateUniqueName(`START_BLOCK_${this._toSnakeCase(name)}`);
|
|
11992
|
+
this._signatureToName[signature] = placeholder;
|
|
11993
|
+
return placeholder;
|
|
11994
|
+
}
|
|
11995
|
+
getCloseBlockPlaceholderName(name) {
|
|
11996
|
+
const signature = this._hashClosingBlock(name);
|
|
11997
|
+
if (this._signatureToName[signature]) {
|
|
11998
|
+
return this._signatureToName[signature];
|
|
11999
|
+
}
|
|
12000
|
+
const placeholder = this._generateUniqueName(`CLOSE_BLOCK_${this._toSnakeCase(name)}`);
|
|
12001
|
+
this._signatureToName[signature] = placeholder;
|
|
12002
|
+
return placeholder;
|
|
12003
|
+
}
|
|
11959
12004
|
_hashTag(tag, attrs, isVoid) {
|
|
11960
12005
|
const start = `<${tag}`;
|
|
11961
12006
|
const strAttrs = Object.keys(attrs).sort().map((name) => ` ${name}=${attrs[name]}`).join("");
|
|
@@ -11965,6 +12010,16 @@ var PlaceholderRegistry = class {
|
|
|
11965
12010
|
_hashClosingTag(tag) {
|
|
11966
12011
|
return this._hashTag(`/${tag}`, {}, false);
|
|
11967
12012
|
}
|
|
12013
|
+
_hashBlock(name, parameters) {
|
|
12014
|
+
const params = parameters.length === 0 ? "" : ` (${parameters.sort().join("; ")})`;
|
|
12015
|
+
return `@${name}${params} {}`;
|
|
12016
|
+
}
|
|
12017
|
+
_hashClosingBlock(name) {
|
|
12018
|
+
return this._hashBlock(`close_${name}`, []);
|
|
12019
|
+
}
|
|
12020
|
+
_toSnakeCase(name) {
|
|
12021
|
+
return name.toUpperCase().replace(/[^A-Z0-9]/g, "_");
|
|
12022
|
+
}
|
|
11968
12023
|
_generateUniqueName(base) {
|
|
11969
12024
|
const seen = this._placeHolderNameCounts.hasOwnProperty(base);
|
|
11970
12025
|
if (!seen) {
|
|
@@ -11979,17 +12034,18 @@ var PlaceholderRegistry = class {
|
|
|
11979
12034
|
|
|
11980
12035
|
// bazel-out/k8-fastbuild/bin/packages/compiler/src/i18n/i18n_parser.mjs
|
|
11981
12036
|
var _expParser = new Parser(new Lexer());
|
|
11982
|
-
function createI18nMessageFactory(interpolationConfig) {
|
|
11983
|
-
const visitor = new _I18nVisitor(_expParser, interpolationConfig);
|
|
12037
|
+
function createI18nMessageFactory(interpolationConfig, containerBlocks) {
|
|
12038
|
+
const visitor = new _I18nVisitor(_expParser, interpolationConfig, containerBlocks);
|
|
11984
12039
|
return (nodes, meaning, description, customId, visitNodeFn) => visitor.toI18nMessage(nodes, meaning, description, customId, visitNodeFn);
|
|
11985
12040
|
}
|
|
11986
12041
|
function noopVisitNodeFn(_html, i18n2) {
|
|
11987
12042
|
return i18n2;
|
|
11988
12043
|
}
|
|
11989
12044
|
var _I18nVisitor = class {
|
|
11990
|
-
constructor(_expressionParser, _interpolationConfig) {
|
|
12045
|
+
constructor(_expressionParser, _interpolationConfig, _containerBlocks) {
|
|
11991
12046
|
this._expressionParser = _expressionParser;
|
|
11992
12047
|
this._interpolationConfig = _interpolationConfig;
|
|
12048
|
+
this._containerBlocks = _containerBlocks;
|
|
11993
12049
|
}
|
|
11994
12050
|
toI18nMessage(nodes, meaning = "", description = "", customId = "", visitNodeFn) {
|
|
11995
12051
|
const context = {
|
|
@@ -12064,11 +12120,27 @@ var _I18nVisitor = class {
|
|
|
12064
12120
|
throw new Error("Unreachable code");
|
|
12065
12121
|
}
|
|
12066
12122
|
visitBlock(block, context) {
|
|
12123
|
+
var _a2;
|
|
12067
12124
|
const children = visitAll2(this, block.children, context);
|
|
12068
|
-
|
|
12125
|
+
if (this._containerBlocks.has(block.name)) {
|
|
12126
|
+
return new Container(children, block.sourceSpan);
|
|
12127
|
+
}
|
|
12128
|
+
const parameters = block.parameters.map((param) => param.expression);
|
|
12129
|
+
const startPhName = context.placeholderRegistry.getStartBlockPlaceholderName(block.name, parameters);
|
|
12130
|
+
const closePhName = context.placeholderRegistry.getCloseBlockPlaceholderName(block.name);
|
|
12131
|
+
context.placeholderToContent[startPhName] = {
|
|
12132
|
+
text: block.startSourceSpan.toString(),
|
|
12133
|
+
sourceSpan: block.startSourceSpan
|
|
12134
|
+
};
|
|
12135
|
+
context.placeholderToContent[closePhName] = {
|
|
12136
|
+
text: block.endSourceSpan ? block.endSourceSpan.toString() : "}",
|
|
12137
|
+
sourceSpan: (_a2 = block.endSourceSpan) != null ? _a2 : block.sourceSpan
|
|
12138
|
+
};
|
|
12139
|
+
const node = new BlockPlaceholder(block.name, parameters, startPhName, closePhName, children, block.sourceSpan, block.startSourceSpan, block.endSourceSpan);
|
|
12069
12140
|
return context.visitNodeFn(block, node);
|
|
12070
12141
|
}
|
|
12071
12142
|
visitBlockParameter(_parameter, _context) {
|
|
12143
|
+
throw new Error("Unreachable code");
|
|
12072
12144
|
}
|
|
12073
12145
|
_visitTextWithInterpolation(tokens, sourceSpan, context, previousI18n) {
|
|
12074
12146
|
const nodes = [];
|
|
@@ -15608,16 +15680,17 @@ var setI18nRefs = (htmlNode, i18nNode) => {
|
|
|
15608
15680
|
return i18nNode;
|
|
15609
15681
|
};
|
|
15610
15682
|
var I18nMetaVisitor = class {
|
|
15611
|
-
constructor(interpolationConfig = DEFAULT_INTERPOLATION_CONFIG, keepI18nAttrs = false, enableI18nLegacyMessageIdFormat = false) {
|
|
15683
|
+
constructor(interpolationConfig = DEFAULT_INTERPOLATION_CONFIG, keepI18nAttrs = false, enableI18nLegacyMessageIdFormat = false, containerBlocks = DEFAULT_CONTAINER_BLOCKS) {
|
|
15612
15684
|
this.interpolationConfig = interpolationConfig;
|
|
15613
15685
|
this.keepI18nAttrs = keepI18nAttrs;
|
|
15614
15686
|
this.enableI18nLegacyMessageIdFormat = enableI18nLegacyMessageIdFormat;
|
|
15687
|
+
this.containerBlocks = containerBlocks;
|
|
15615
15688
|
this.hasI18nMeta = false;
|
|
15616
15689
|
this._errors = [];
|
|
15617
15690
|
}
|
|
15618
15691
|
_generateI18nMessage(nodes, meta = "", visitNodeFn) {
|
|
15619
15692
|
const { meaning, description, customId } = this._parseMetadata(meta);
|
|
15620
|
-
const createI18nMessage2 = createI18nMessageFactory(this.interpolationConfig);
|
|
15693
|
+
const createI18nMessage2 = createI18nMessageFactory(this.interpolationConfig, this.containerBlocks);
|
|
15621
15694
|
const message = createI18nMessage2(nodes, meaning, description, customId, visitNodeFn);
|
|
15622
15695
|
this._setMessageId(message, meta);
|
|
15623
15696
|
this._setLegacyIds(message, meta);
|
|
@@ -15792,6 +15865,9 @@ var GetMsgSerializerVisitor = class {
|
|
|
15792
15865
|
visitPlaceholder(ph) {
|
|
15793
15866
|
return this.formatPh(ph.name);
|
|
15794
15867
|
}
|
|
15868
|
+
visitBlockPlaceholder(ph) {
|
|
15869
|
+
return `${this.formatPh(ph.startName)}${ph.children.map((child) => child.visit(this)).join("")}${this.formatPh(ph.closeName)}`;
|
|
15870
|
+
}
|
|
15795
15871
|
visitIcuPlaceholder(ph, context) {
|
|
15796
15872
|
return this.formatPh(ph.name);
|
|
15797
15873
|
}
|
|
@@ -15840,6 +15916,12 @@ var LocalizeSerializerVisitor = class {
|
|
|
15840
15916
|
visitPlaceholder(ph) {
|
|
15841
15917
|
this.pieces.push(this.createPlaceholderPiece(ph.name, ph.sourceSpan));
|
|
15842
15918
|
}
|
|
15919
|
+
visitBlockPlaceholder(ph) {
|
|
15920
|
+
var _a2, _b2;
|
|
15921
|
+
this.pieces.push(this.createPlaceholderPiece(ph.startName, (_a2 = ph.startSourceSpan) != null ? _a2 : ph.sourceSpan));
|
|
15922
|
+
ph.children.forEach((child) => child.visit(this));
|
|
15923
|
+
this.pieces.push(this.createPlaceholderPiece(ph.closeName, (_b2 = ph.endSourceSpan) != null ? _b2 : ph.sourceSpan));
|
|
15924
|
+
}
|
|
15843
15925
|
visitIcuPlaceholder(ph) {
|
|
15844
15926
|
this.pieces.push(this.createPlaceholderPiece(ph.name, ph.sourceSpan, this.placeholderToMessage[ph.name]));
|
|
15845
15927
|
}
|
|
@@ -15921,11 +16003,13 @@ function collectMessage(job, fileBasedI18nSuffix, messages, messageOp) {
|
|
|
15921
16003
|
statements.push(...subMessageStatements);
|
|
15922
16004
|
messageOp.params.set(subMessage.messagePlaceholder, subMessageVar);
|
|
15923
16005
|
}
|
|
16006
|
+
messageOp.params = new Map([...messageOp.params.entries()].sort());
|
|
15924
16007
|
assertAllParamsResolved(messageOp);
|
|
15925
16008
|
const mainVar = variable(job.pool.uniqueName(TRANSLATION_VAR_PREFIX2));
|
|
15926
16009
|
const closureVar = i18nGenerateClosureVar(job.pool, messageOp.message.id, fileBasedI18nSuffix, job.i18nUseExternalIds);
|
|
15927
16010
|
let transformFn = void 0;
|
|
15928
16011
|
if (messageOp.needsPostprocessing) {
|
|
16012
|
+
messageOp.postprocessingParams = new Map([...messageOp.postprocessingParams.entries()].sort());
|
|
15929
16013
|
const extraTransformFnParams = [];
|
|
15930
16014
|
if (messageOp.postprocessingParams.size > 0) {
|
|
15931
16015
|
extraTransformFnParams.push(literalMap([...messageOp.postprocessingParams].map(([key, value]) => ({ key, value, quoted: true }))));
|
|
@@ -15963,12 +16047,14 @@ function i18nGenerateClosureVar(pool, messageId, fileBasedI18nSuffix, useExterna
|
|
|
15963
16047
|
return variable(name);
|
|
15964
16048
|
}
|
|
15965
16049
|
function assertAllParamsResolved(op) {
|
|
15966
|
-
for (
|
|
16050
|
+
for (let placeholder in op.message.placeholders) {
|
|
16051
|
+
placeholder = placeholder.trimEnd();
|
|
15967
16052
|
if (!op.params.has(placeholder) && !op.postprocessingParams.has(placeholder)) {
|
|
15968
16053
|
throw Error(`Failed to resolve i18n placeholder: ${placeholder}`);
|
|
15969
16054
|
}
|
|
15970
16055
|
}
|
|
15971
|
-
for (
|
|
16056
|
+
for (let placeholder in op.message.placeholderToMessage) {
|
|
16057
|
+
placeholder = placeholder.trimEnd();
|
|
15972
16058
|
if (!op.params.has(placeholder) && !op.postprocessingParams.has(placeholder)) {
|
|
15973
16059
|
throw Error(`Failed to resolve i18n message placeholder: ${placeholder}`);
|
|
15974
16060
|
}
|
|
@@ -15980,7 +16066,9 @@ function extractI18nText(job) {
|
|
|
15980
16066
|
var _a2;
|
|
15981
16067
|
for (const unit of job.units) {
|
|
15982
16068
|
let currentI18n = null;
|
|
16069
|
+
let currentIcu = null;
|
|
15983
16070
|
const textNodeI18nBlocks = /* @__PURE__ */ new Map();
|
|
16071
|
+
const textNodeIcus = /* @__PURE__ */ new Map();
|
|
15984
16072
|
for (const op of unit.create) {
|
|
15985
16073
|
switch (op.kind) {
|
|
15986
16074
|
case OpKind.I18nStart:
|
|
@@ -15992,9 +16080,19 @@ function extractI18nText(job) {
|
|
|
15992
16080
|
case OpKind.I18nEnd:
|
|
15993
16081
|
currentI18n = null;
|
|
15994
16082
|
break;
|
|
16083
|
+
case OpKind.IcuStart:
|
|
16084
|
+
if (op.context === null) {
|
|
16085
|
+
throw Error("Icu op should have its context set.");
|
|
16086
|
+
}
|
|
16087
|
+
currentIcu = op;
|
|
16088
|
+
break;
|
|
16089
|
+
case OpKind.IcuEnd:
|
|
16090
|
+
currentIcu = null;
|
|
16091
|
+
break;
|
|
15995
16092
|
case OpKind.Text:
|
|
15996
16093
|
if (currentI18n !== null) {
|
|
15997
16094
|
textNodeI18nBlocks.set(op.xref, currentI18n);
|
|
16095
|
+
textNodeIcus.set(op.xref, currentIcu);
|
|
15998
16096
|
OpList.remove(op);
|
|
15999
16097
|
}
|
|
16000
16098
|
break;
|
|
@@ -16007,11 +16105,13 @@ function extractI18nText(job) {
|
|
|
16007
16105
|
continue;
|
|
16008
16106
|
}
|
|
16009
16107
|
const i18nOp = textNodeI18nBlocks.get(op.target);
|
|
16108
|
+
const icuOp = textNodeIcus.get(op.target);
|
|
16109
|
+
const contextId = icuOp ? icuOp.context : i18nOp.context;
|
|
16110
|
+
const resolutionTime = icuOp ? I18nParamResolutionTime.Postproccessing : I18nParamResolutionTime.Creation;
|
|
16010
16111
|
const ops = [];
|
|
16011
16112
|
for (let i = 0; i < op.interpolation.expressions.length; i++) {
|
|
16012
16113
|
const expr = op.interpolation.expressions[i];
|
|
16013
|
-
|
|
16014
|
-
ops.push(createI18nExpressionOp(i18nOp.context, i18nOp.xref, i18nOp.handle, expr, placeholder.name, I18nParamResolutionTime.Creation, (_a2 = expr.sourceSpan) != null ? _a2 : op.sourceSpan));
|
|
16114
|
+
ops.push(createI18nExpressionOp(contextId, i18nOp.xref, i18nOp.handle, expr, op.i18nPlaceholders[i], resolutionTime, (_a2 = expr.sourceSpan) != null ? _a2 : op.sourceSpan));
|
|
16015
16115
|
}
|
|
16016
16116
|
OpList.replaceWithMany(op, ops);
|
|
16017
16117
|
break;
|
|
@@ -16903,8 +17003,8 @@ function repeaterCreate(slot, viewFnName, decls, vars, tag, constIndex, trackByF
|
|
|
16903
17003
|
}
|
|
16904
17004
|
return call(Identifiers.repeaterCreate, args, sourceSpan);
|
|
16905
17005
|
}
|
|
16906
|
-
function repeater(
|
|
16907
|
-
return call(Identifiers.repeater, [
|
|
17006
|
+
function repeater(collection, sourceSpan) {
|
|
17007
|
+
return call(Identifiers.repeater, [collection], sourceSpan);
|
|
16908
17008
|
}
|
|
16909
17009
|
function deferWhen(prefetch, expr, sourceSpan) {
|
|
16910
17010
|
return call(prefetch ? Identifiers.deferPrefetchWhen : Identifiers.deferWhen, [expr], sourceSpan);
|
|
@@ -17462,7 +17562,7 @@ function reifyUpdateOperations(_unit, ops) {
|
|
|
17462
17562
|
OpList.replace(op, conditional(op.targetSlot.slot, op.processed, op.contextValue, op.sourceSpan));
|
|
17463
17563
|
break;
|
|
17464
17564
|
case OpKind.Repeater:
|
|
17465
|
-
OpList.replace(op, repeater(op.
|
|
17565
|
+
OpList.replace(op, repeater(op.collection, op.sourceSpan));
|
|
17466
17566
|
break;
|
|
17467
17567
|
case OpKind.DeferWhen:
|
|
17468
17568
|
OpList.replace(op, deferWhen(op.prefetch, op.expr, op.sourceSpan));
|
|
@@ -17751,7 +17851,7 @@ function getSubTemplateIndexForTemplateTag(job, i18nOp, op) {
|
|
|
17751
17851
|
}
|
|
17752
17852
|
return i18nOp.subTemplateIndex;
|
|
17753
17853
|
}
|
|
17754
|
-
function addParam(params, placeholder, value, subTemplateIndex, flags
|
|
17854
|
+
function addParam(params, placeholder, value, subTemplateIndex, flags) {
|
|
17755
17855
|
var _a2;
|
|
17756
17856
|
const values = (_a2 = params.get(placeholder)) != null ? _a2 : [];
|
|
17757
17857
|
values.push({ value, subTemplateIndex, flags });
|
|
@@ -17778,19 +17878,83 @@ function resolveI18nExpressionPlaceholders(job) {
|
|
|
17778
17878
|
for (const unit of job.units) {
|
|
17779
17879
|
for (const op of unit.update) {
|
|
17780
17880
|
if (op.kind === OpKind.I18nExpression) {
|
|
17781
|
-
const index = expressionIndices.get(op.context) || 0;
|
|
17782
17881
|
const i18nContext = i18nContexts.get(op.context);
|
|
17882
|
+
const index = expressionIndices.get(i18nContext.i18nBlock) || 0;
|
|
17783
17883
|
const subTemplateIndex = subTemplateIndicies.get(i18nContext.i18nBlock);
|
|
17784
17884
|
const params = op.resolutionTime === I18nParamResolutionTime.Creation ? i18nContext.params : i18nContext.postprocessingParams;
|
|
17785
17885
|
const values = params.get(op.i18nPlaceholder) || [];
|
|
17786
|
-
values.push({
|
|
17886
|
+
values.push({
|
|
17887
|
+
value: index,
|
|
17888
|
+
subTemplateIndex,
|
|
17889
|
+
flags: I18nParamValueFlags.ExpressionIndex
|
|
17890
|
+
});
|
|
17787
17891
|
params.set(op.i18nPlaceholder, values);
|
|
17788
|
-
expressionIndices.set(
|
|
17892
|
+
expressionIndices.set(i18nContext.i18nBlock, index + 1);
|
|
17789
17893
|
}
|
|
17790
17894
|
}
|
|
17791
17895
|
}
|
|
17792
17896
|
}
|
|
17793
17897
|
|
|
17898
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_i18n_icu_placeholders.mjs
|
|
17899
|
+
function resolveI18nIcuPlaceholders(job) {
|
|
17900
|
+
const contextOps = /* @__PURE__ */ new Map();
|
|
17901
|
+
for (const unit of job.units) {
|
|
17902
|
+
for (const op of unit.create) {
|
|
17903
|
+
switch (op.kind) {
|
|
17904
|
+
case OpKind.I18nContext:
|
|
17905
|
+
contextOps.set(op.xref, op);
|
|
17906
|
+
break;
|
|
17907
|
+
}
|
|
17908
|
+
}
|
|
17909
|
+
}
|
|
17910
|
+
for (const unit of job.units) {
|
|
17911
|
+
for (const op of unit.create) {
|
|
17912
|
+
switch (op.kind) {
|
|
17913
|
+
case OpKind.IcuStart:
|
|
17914
|
+
if (op.context === null) {
|
|
17915
|
+
throw Error("Icu should have its i18n context set.");
|
|
17916
|
+
}
|
|
17917
|
+
const i18nContext = contextOps.get(op.context);
|
|
17918
|
+
for (const node of op.message.nodes) {
|
|
17919
|
+
node.visit(new ResolveIcuPlaceholdersVisitor(i18nContext.postprocessingParams));
|
|
17920
|
+
}
|
|
17921
|
+
break;
|
|
17922
|
+
}
|
|
17923
|
+
}
|
|
17924
|
+
}
|
|
17925
|
+
}
|
|
17926
|
+
var ResolveIcuPlaceholdersVisitor = class extends RecurseVisitor {
|
|
17927
|
+
constructor(params) {
|
|
17928
|
+
super();
|
|
17929
|
+
this.params = params;
|
|
17930
|
+
}
|
|
17931
|
+
visitContainerPlaceholder(placeholder) {
|
|
17932
|
+
var _a2, _b2;
|
|
17933
|
+
if (placeholder.startName && placeholder.startSourceSpan && !this.params.has(placeholder.startName)) {
|
|
17934
|
+
this.params.set(placeholder.startName, [{
|
|
17935
|
+
value: (_a2 = placeholder.startSourceSpan) == null ? void 0 : _a2.toString(),
|
|
17936
|
+
subTemplateIndex: null,
|
|
17937
|
+
flags: I18nParamValueFlags.None
|
|
17938
|
+
}]);
|
|
17939
|
+
}
|
|
17940
|
+
if (placeholder.closeName && placeholder.endSourceSpan && !this.params.has(placeholder.closeName)) {
|
|
17941
|
+
this.params.set(placeholder.closeName, [{
|
|
17942
|
+
value: (_b2 = placeholder.endSourceSpan) == null ? void 0 : _b2.toString(),
|
|
17943
|
+
subTemplateIndex: null,
|
|
17944
|
+
flags: I18nParamValueFlags.None
|
|
17945
|
+
}]);
|
|
17946
|
+
}
|
|
17947
|
+
}
|
|
17948
|
+
visitTagPlaceholder(placeholder) {
|
|
17949
|
+
super.visitTagPlaceholder(placeholder);
|
|
17950
|
+
this.visitContainerPlaceholder(placeholder);
|
|
17951
|
+
}
|
|
17952
|
+
visitBlockPlaceholder(placeholder) {
|
|
17953
|
+
super.visitBlockPlaceholder(placeholder);
|
|
17954
|
+
this.visitContainerPlaceholder(placeholder);
|
|
17955
|
+
}
|
|
17956
|
+
};
|
|
17957
|
+
|
|
17794
17958
|
// bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_names.mjs
|
|
17795
17959
|
function resolveNames(job) {
|
|
17796
17960
|
for (const unit of job.units) {
|
|
@@ -18507,6 +18671,7 @@ function allowConservativeInlining(decl, target) {
|
|
|
18507
18671
|
function wrapI18nIcus(job) {
|
|
18508
18672
|
for (const unit of job.units) {
|
|
18509
18673
|
let currentI18nOp = null;
|
|
18674
|
+
let addedI18nId = null;
|
|
18510
18675
|
for (const op of unit.create) {
|
|
18511
18676
|
switch (op.kind) {
|
|
18512
18677
|
case OpKind.I18nStart:
|
|
@@ -18515,11 +18680,16 @@ function wrapI18nIcus(job) {
|
|
|
18515
18680
|
case OpKind.I18nEnd:
|
|
18516
18681
|
currentI18nOp = null;
|
|
18517
18682
|
break;
|
|
18518
|
-
case OpKind.
|
|
18683
|
+
case OpKind.IcuStart:
|
|
18519
18684
|
if (currentI18nOp === null) {
|
|
18520
|
-
|
|
18521
|
-
OpList.insertBefore(createI18nStartOp(
|
|
18522
|
-
|
|
18685
|
+
addedI18nId = job.allocateXrefId();
|
|
18686
|
+
OpList.insertBefore(createI18nStartOp(addedI18nId, op.message), op);
|
|
18687
|
+
}
|
|
18688
|
+
break;
|
|
18689
|
+
case OpKind.IcuEnd:
|
|
18690
|
+
if (addedI18nId !== null) {
|
|
18691
|
+
OpList.insertAfter(createI18nEndOp(addedI18nId), op);
|
|
18692
|
+
addedI18nId = null;
|
|
18523
18693
|
}
|
|
18524
18694
|
break;
|
|
18525
18695
|
}
|
|
@@ -18546,7 +18716,6 @@ var phases = [
|
|
|
18546
18716
|
{ kind: CompilationJobKind.Tmpl, fn: createPipes },
|
|
18547
18717
|
{ kind: CompilationJobKind.Tmpl, fn: configureDeferInstructions },
|
|
18548
18718
|
{ kind: CompilationJobKind.Tmpl, fn: extractI18nText },
|
|
18549
|
-
{ kind: CompilationJobKind.Tmpl, fn: createI18nIcuExpressions },
|
|
18550
18719
|
{ kind: CompilationJobKind.Tmpl, fn: applyI18nExpressions },
|
|
18551
18720
|
{ kind: CompilationJobKind.Tmpl, fn: createVariadicPipes },
|
|
18552
18721
|
{ kind: CompilationJobKind.Both, fn: generatePureLiteralStructures },
|
|
@@ -18570,6 +18739,7 @@ var phases = [
|
|
|
18570
18739
|
{ kind: CompilationJobKind.Tmpl, fn: createDeferDepsFns },
|
|
18571
18740
|
{ kind: CompilationJobKind.Tmpl, fn: resolveI18nElementPlaceholders },
|
|
18572
18741
|
{ kind: CompilationJobKind.Tmpl, fn: resolveI18nExpressionPlaceholders },
|
|
18742
|
+
{ kind: CompilationJobKind.Tmpl, fn: resolveI18nIcuPlaceholders },
|
|
18573
18743
|
{ kind: CompilationJobKind.Tmpl, fn: mergeI18nContexts },
|
|
18574
18744
|
{ kind: CompilationJobKind.Tmpl, fn: extractI18nMessages },
|
|
18575
18745
|
{ kind: CompilationJobKind.Tmpl, fn: generateTrackFns },
|
|
@@ -18834,7 +19004,7 @@ function ingestContent(unit, content) {
|
|
|
18834
19004
|
function ingestText(unit, text2) {
|
|
18835
19005
|
unit.create.push(createTextOp(unit.job.allocateXrefId(), text2.value, text2.sourceSpan));
|
|
18836
19006
|
}
|
|
18837
|
-
function ingestBoundText(unit, text2) {
|
|
19007
|
+
function ingestBoundText(unit, text2, i18nPlaceholders) {
|
|
18838
19008
|
var _a2;
|
|
18839
19009
|
let value = text2.value;
|
|
18840
19010
|
if (value instanceof ASTWithSource) {
|
|
@@ -18846,7 +19016,12 @@ function ingestBoundText(unit, text2) {
|
|
|
18846
19016
|
if (text2.i18n !== void 0 && !(text2.i18n instanceof Container)) {
|
|
18847
19017
|
throw Error(`Unhandled i18n metadata type for text interpolation: ${(_a2 = text2.i18n) == null ? void 0 : _a2.constructor.name}`);
|
|
18848
19018
|
}
|
|
18849
|
-
|
|
19019
|
+
if (i18nPlaceholders === void 0) {
|
|
19020
|
+
i18nPlaceholders = text2.i18n instanceof Container ? text2.i18n.children.filter((node) => node instanceof Placeholder).map((placeholder) => placeholder.name) : [];
|
|
19021
|
+
}
|
|
19022
|
+
if (i18nPlaceholders.length > 0 && i18nPlaceholders.length !== value.expressions.length) {
|
|
19023
|
+
throw Error(`Unexpected number of i18n placeholders (${value.expressions.length}) for BoundText with ${value.expressions.length} expressions`);
|
|
19024
|
+
}
|
|
18850
19025
|
const textXref = unit.job.allocateXrefId();
|
|
18851
19026
|
unit.create.push(createTextOp(textXref, "", text2.sourceSpan));
|
|
18852
19027
|
const baseSourceSpan = unit.job.compatibility ? null : text2.sourceSpan;
|
|
@@ -18992,13 +19167,26 @@ function ingestDeferBlock(unit, deferBlock) {
|
|
|
18992
19167
|
unit.update.push(deferWhenOps);
|
|
18993
19168
|
}
|
|
18994
19169
|
function ingestIcu(unit, icu) {
|
|
18995
|
-
var _a2;
|
|
19170
|
+
var _a2, _b2;
|
|
18996
19171
|
if (icu.i18n instanceof Message && isSingleI18nIcu(icu.i18n)) {
|
|
18997
19172
|
const xref = unit.job.allocateXrefId();
|
|
18998
|
-
|
|
18999
|
-
unit.
|
|
19173
|
+
const icuNode = icu.i18n.nodes[0];
|
|
19174
|
+
unit.create.push(createIcuStartOp(xref, icu.i18n, icuFromI18nMessage(icu.i18n).name, null));
|
|
19175
|
+
const expressionPlaceholder = (_a2 = icuNode.expressionPlaceholder) == null ? void 0 : _a2.trimEnd();
|
|
19176
|
+
if (expressionPlaceholder === void 0 || icu.vars[expressionPlaceholder] === void 0) {
|
|
19177
|
+
throw Error("ICU should have a text binding");
|
|
19178
|
+
}
|
|
19179
|
+
ingestBoundText(unit, icu.vars[expressionPlaceholder], [expressionPlaceholder]);
|
|
19180
|
+
for (const [placeholder, text2] of Object.entries(icu.placeholders)) {
|
|
19181
|
+
if (text2 instanceof BoundText) {
|
|
19182
|
+
ingestBoundText(unit, text2, [placeholder]);
|
|
19183
|
+
} else {
|
|
19184
|
+
ingestText(unit, text2);
|
|
19185
|
+
}
|
|
19186
|
+
}
|
|
19187
|
+
unit.create.push(createIcuEndOp(xref));
|
|
19000
19188
|
} else {
|
|
19001
|
-
throw Error(`Unhandled i18n metadata type for ICU: ${(
|
|
19189
|
+
throw Error(`Unhandled i18n metadata type for ICU: ${(_b2 = icu.i18n) == null ? void 0 : _b2.constructor.name}`);
|
|
19002
19190
|
}
|
|
19003
19191
|
}
|
|
19004
19192
|
function ingestForBlock(unit, forBlock) {
|
|
@@ -20084,18 +20272,18 @@ function createIfBlock(ast, connectedBlocks, visitor, bindingParser) {
|
|
|
20084
20272
|
const branches = [];
|
|
20085
20273
|
const mainBlockParams = parseConditionalBlockParameters(ast, errors, bindingParser);
|
|
20086
20274
|
if (mainBlockParams !== null) {
|
|
20087
|
-
branches.push(new IfBlockBranch(mainBlockParams.expression, visitAll2(visitor, ast.children, ast.children), mainBlockParams.expressionAlias, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan, ast.nameSpan));
|
|
20275
|
+
branches.push(new IfBlockBranch(mainBlockParams.expression, visitAll2(visitor, ast.children, ast.children), mainBlockParams.expressionAlias, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan, ast.nameSpan, ast.i18n));
|
|
20088
20276
|
}
|
|
20089
20277
|
for (const block of connectedBlocks) {
|
|
20090
20278
|
if (ELSE_IF_PATTERN.test(block.name)) {
|
|
20091
20279
|
const params = parseConditionalBlockParameters(block, errors, bindingParser);
|
|
20092
20280
|
if (params !== null) {
|
|
20093
20281
|
const children = visitAll2(visitor, block.children, block.children);
|
|
20094
|
-
branches.push(new IfBlockBranch(params.expression, children, params.expressionAlias, block.sourceSpan, block.startSourceSpan, block.endSourceSpan, block.nameSpan));
|
|
20282
|
+
branches.push(new IfBlockBranch(params.expression, children, params.expressionAlias, block.sourceSpan, block.startSourceSpan, block.endSourceSpan, block.nameSpan, block.i18n));
|
|
20095
20283
|
}
|
|
20096
20284
|
} else if (block.name === "else") {
|
|
20097
20285
|
const children = visitAll2(visitor, block.children, block.children);
|
|
20098
|
-
branches.push(new IfBlockBranch(null, children, null, block.sourceSpan, block.startSourceSpan, block.endSourceSpan, block.nameSpan));
|
|
20286
|
+
branches.push(new IfBlockBranch(null, children, null, block.sourceSpan, block.startSourceSpan, block.endSourceSpan, block.nameSpan, block.i18n));
|
|
20099
20287
|
}
|
|
20100
20288
|
}
|
|
20101
20289
|
const ifBlockStartSourceSpan = branches.length > 0 ? branches[0].startSourceSpan : ast.startSourceSpan;
|
|
@@ -20123,7 +20311,7 @@ function createForLoop(ast, connectedBlocks, visitor, bindingParser) {
|
|
|
20123
20311
|
} else if (block.parameters.length > 0) {
|
|
20124
20312
|
errors.push(new ParseError(block.sourceSpan, "@empty block cannot have parameters"));
|
|
20125
20313
|
} else {
|
|
20126
|
-
empty = new ForLoopBlockEmpty(visitAll2(visitor, block.children, block.children), block.sourceSpan, block.startSourceSpan, block.endSourceSpan, block.nameSpan);
|
|
20314
|
+
empty = new ForLoopBlockEmpty(visitAll2(visitor, block.children, block.children), block.sourceSpan, block.startSourceSpan, block.endSourceSpan, block.nameSpan, block.i18n);
|
|
20127
20315
|
}
|
|
20128
20316
|
} else {
|
|
20129
20317
|
errors.push(new ParseError(block.sourceSpan, `Unrecognized @for loop block "${block.name}"`));
|
|
@@ -20135,7 +20323,7 @@ function createForLoop(ast, connectedBlocks, visitor, bindingParser) {
|
|
|
20135
20323
|
} else {
|
|
20136
20324
|
const endSpan = (_a2 = empty == null ? void 0 : empty.endSourceSpan) != null ? _a2 : ast.endSourceSpan;
|
|
20137
20325
|
const sourceSpan = new ParseSourceSpan(ast.sourceSpan.start, (_b2 = endSpan == null ? void 0 : endSpan.end) != null ? _b2 : ast.sourceSpan.end);
|
|
20138
|
-
node = new ForLoopBlock(params.itemName, params.expression, params.trackBy.expression, params.trackBy.keywordSpan, params.context, visitAll2(visitor, ast.children, ast.children), empty, sourceSpan, ast.sourceSpan, ast.startSourceSpan, endSpan, ast.nameSpan);
|
|
20326
|
+
node = new ForLoopBlock(params.itemName, params.expression, params.trackBy.expression, params.trackBy.keywordSpan, params.context, visitAll2(visitor, ast.children, ast.children), empty, sourceSpan, ast.sourceSpan, ast.startSourceSpan, endSpan, ast.nameSpan, ast.i18n);
|
|
20139
20327
|
}
|
|
20140
20328
|
}
|
|
20141
20329
|
return { node, errors };
|
|
@@ -20155,7 +20343,7 @@ function createSwitchBlock(ast, visitor, bindingParser) {
|
|
|
20155
20343
|
continue;
|
|
20156
20344
|
}
|
|
20157
20345
|
const expression = node.name === "case" ? parseBlockParameterToBinding(node.parameters[0], bindingParser) : null;
|
|
20158
|
-
const ast2 = new SwitchBlockCase(expression, visitAll2(visitor, node.children, node.children), node.sourceSpan, node.startSourceSpan, node.endSourceSpan, node.nameSpan);
|
|
20346
|
+
const ast2 = new SwitchBlockCase(expression, visitAll2(visitor, node.children, node.children), node.sourceSpan, node.startSourceSpan, node.endSourceSpan, node.nameSpan, node.i18n);
|
|
20159
20347
|
if (expression === null) {
|
|
20160
20348
|
defaultCase = ast2;
|
|
20161
20349
|
} else {
|
|
@@ -20643,7 +20831,7 @@ function createDeferredBlock(ast, connectedBlocks, visitor, bindingParser) {
|
|
|
20643
20831
|
endOfLastSourceSpan = lastConnectedBlock.sourceSpan.end;
|
|
20644
20832
|
}
|
|
20645
20833
|
const sourceSpanWithConnectedBlocks = new ParseSourceSpan(ast.sourceSpan.start, endOfLastSourceSpan);
|
|
20646
|
-
const node = new DeferredBlock(visitAll2(visitor, ast.children, ast.children), triggers, prefetchTriggers, placeholder, loading, error2, ast.nameSpan, sourceSpanWithConnectedBlocks, ast.sourceSpan, ast.startSourceSpan, lastEndSourceSpan);
|
|
20834
|
+
const node = new DeferredBlock(visitAll2(visitor, ast.children, ast.children), triggers, prefetchTriggers, placeholder, loading, error2, ast.nameSpan, sourceSpanWithConnectedBlocks, ast.sourceSpan, ast.startSourceSpan, lastEndSourceSpan, ast.i18n);
|
|
20647
20835
|
return { node, errors };
|
|
20648
20836
|
}
|
|
20649
20837
|
function parseConnectedBlocks(connectedBlocks, errors, visitor) {
|
|
@@ -20701,7 +20889,7 @@ function parsePlaceholderBlock(ast, visitor) {
|
|
|
20701
20889
|
throw new Error(`Unrecognized parameter in @placeholder block: "${param.expression}"`);
|
|
20702
20890
|
}
|
|
20703
20891
|
}
|
|
20704
|
-
return new DeferredBlockPlaceholder(visitAll2(visitor, ast.children, ast.children), minimumTime, ast.nameSpan, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan);
|
|
20892
|
+
return new DeferredBlockPlaceholder(visitAll2(visitor, ast.children, ast.children), minimumTime, ast.nameSpan, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan, ast.i18n);
|
|
20705
20893
|
}
|
|
20706
20894
|
function parseLoadingBlock(ast, visitor) {
|
|
20707
20895
|
let afterTime = null;
|
|
@@ -20729,13 +20917,13 @@ function parseLoadingBlock(ast, visitor) {
|
|
|
20729
20917
|
throw new Error(`Unrecognized parameter in @loading block: "${param.expression}"`);
|
|
20730
20918
|
}
|
|
20731
20919
|
}
|
|
20732
|
-
return new DeferredBlockLoading(visitAll2(visitor, ast.children, ast.children), afterTime, minimumTime, ast.nameSpan, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan);
|
|
20920
|
+
return new DeferredBlockLoading(visitAll2(visitor, ast.children, ast.children), afterTime, minimumTime, ast.nameSpan, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan, ast.i18n);
|
|
20733
20921
|
}
|
|
20734
20922
|
function parseErrorBlock(ast, visitor) {
|
|
20735
20923
|
if (ast.parameters.length > 0) {
|
|
20736
20924
|
throw new Error(`@error block cannot have parameters`);
|
|
20737
20925
|
}
|
|
20738
|
-
return new DeferredBlockError(visitAll2(visitor, ast.children, ast.children), ast.nameSpan, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan);
|
|
20926
|
+
return new DeferredBlockError(visitAll2(visitor, ast.children, ast.children), ast.nameSpan, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan, ast.i18n);
|
|
20739
20927
|
}
|
|
20740
20928
|
function parsePrimaryTriggers(params, bindingParser, errors, placeholder) {
|
|
20741
20929
|
const triggers = {};
|
|
@@ -21219,6 +21407,11 @@ var I18nContext = class {
|
|
|
21219
21407
|
const content = { type, index, ctx: this.id, isVoid: node.isVoid, closed };
|
|
21220
21408
|
updatePlaceholderMap(this.placeholders, ph, content);
|
|
21221
21409
|
}
|
|
21410
|
+
appendBlockPart(node, index, closed) {
|
|
21411
|
+
const ph = closed ? node.closeName : node.startName;
|
|
21412
|
+
const content = { type: TagType.TEMPLATE, index, ctx: this.id, closed };
|
|
21413
|
+
updatePlaceholderMap(this.placeholders, ph, content);
|
|
21414
|
+
}
|
|
21222
21415
|
get icus() {
|
|
21223
21416
|
return this._registry.icus;
|
|
21224
21417
|
}
|
|
@@ -21248,6 +21441,11 @@ var I18nContext = class {
|
|
|
21248
21441
|
this.appendTag(TagType.TEMPLATE, node, index, true);
|
|
21249
21442
|
this._unresolvedCtxCount++;
|
|
21250
21443
|
}
|
|
21444
|
+
appendBlock(node, index) {
|
|
21445
|
+
this.appendBlockPart(node, index, false);
|
|
21446
|
+
this.appendBlockPart(node, index, true);
|
|
21447
|
+
this._unresolvedCtxCount++;
|
|
21448
|
+
}
|
|
21251
21449
|
appendElement(node, index, closed) {
|
|
21252
21450
|
this.appendTag(TagType.ELEMENT, node, index, closed);
|
|
21253
21451
|
}
|
|
@@ -21443,12 +21641,18 @@ var TemplateDefinitionBuilder = class {
|
|
|
21443
21641
|
this.creationInstruction(null, Identifiers.pipe, [literal(slot), literal(name)]);
|
|
21444
21642
|
});
|
|
21445
21643
|
}
|
|
21446
|
-
buildTemplateFunction(nodes, variables, ngContentSelectorsOffset = 0, i18n2) {
|
|
21644
|
+
buildTemplateFunction(nodes, variables, ngContentSelectorsOffset = 0, i18n2, variableAliases) {
|
|
21447
21645
|
this._ngContentSelectorsOffset = ngContentSelectorsOffset;
|
|
21448
21646
|
if (this._namespace !== Identifiers.namespaceHTML) {
|
|
21449
21647
|
this.creationInstruction(null, this._namespace);
|
|
21450
21648
|
}
|
|
21451
|
-
variables.forEach((v) =>
|
|
21649
|
+
variables.forEach((v) => {
|
|
21650
|
+
const alias = variableAliases == null ? void 0 : variableAliases[v.name];
|
|
21651
|
+
this.registerContextVariables(v.name, v.value);
|
|
21652
|
+
if (alias) {
|
|
21653
|
+
this.registerContextVariables(alias, v.value);
|
|
21654
|
+
}
|
|
21655
|
+
});
|
|
21452
21656
|
const initI18nContext = this.i18nContext || isI18nRootNode(i18n2) && !isSingleI18nIcu(i18n2) && !(isSingleElementTemplate(nodes) && nodes[0].i18n === i18n2);
|
|
21453
21657
|
const selfClosingI18nInstruction = hasTextChildrenOnly(nodes);
|
|
21454
21658
|
if (initI18nContext) {
|
|
@@ -21503,12 +21707,12 @@ var TemplateDefinitionBuilder = class {
|
|
|
21503
21707
|
this._constants.prepareStatements.push(...statements);
|
|
21504
21708
|
return _ref;
|
|
21505
21709
|
}
|
|
21506
|
-
registerContextVariables(
|
|
21710
|
+
registerContextVariables(name, value) {
|
|
21507
21711
|
const scopedName = this._bindingScope.freshReferenceName();
|
|
21508
21712
|
const retrievalLevel = this.level;
|
|
21509
|
-
const isDirect =
|
|
21510
|
-
const lhs = variable(
|
|
21511
|
-
this._bindingScope.set(retrievalLevel,
|
|
21713
|
+
const isDirect = value === DIRECT_CONTEXT_REFERENCE;
|
|
21714
|
+
const lhs = variable(name + scopedName);
|
|
21715
|
+
this._bindingScope.set(retrievalLevel, name, (scope) => {
|
|
21512
21716
|
return isDirect && scope.bindingLevel === retrievalLevel && !scope.isListenerScope() ? variable(CONTEXT_NAME) : lhs;
|
|
21513
21717
|
}, 1, (scope, relativeLevel) => {
|
|
21514
21718
|
let rhs;
|
|
@@ -21526,7 +21730,7 @@ var TemplateDefinitionBuilder = class {
|
|
|
21526
21730
|
rhs = sharedCtxVar ? sharedCtxVar : generateNextContextExpr(relativeLevel);
|
|
21527
21731
|
}
|
|
21528
21732
|
return [
|
|
21529
|
-
lhs.set(isDirect ? rhs : rhs.prop(
|
|
21733
|
+
lhs.set(isDirect ? rhs : rhs.prop(value || IMPLICIT_REFERENCE)).toConstDecl()
|
|
21530
21734
|
];
|
|
21531
21735
|
});
|
|
21532
21736
|
}
|
|
@@ -21865,16 +22069,20 @@ var TemplateDefinitionBuilder = class {
|
|
|
21865
22069
|
this.creationInstruction(span, isNgContainer2 ? Identifiers.elementContainerEnd : Identifiers.elementEnd);
|
|
21866
22070
|
}
|
|
21867
22071
|
}
|
|
21868
|
-
prepareEmbeddedTemplateFn(children, contextNameSuffix, variables = [],
|
|
22072
|
+
prepareEmbeddedTemplateFn(children, contextNameSuffix, variables = [], i18nMeta, variableAliases) {
|
|
21869
22073
|
const index = this.allocateDataSlot();
|
|
21870
|
-
if (this.i18n &&
|
|
21871
|
-
|
|
22074
|
+
if (this.i18n && i18nMeta) {
|
|
22075
|
+
if (i18nMeta instanceof BlockPlaceholder) {
|
|
22076
|
+
this.i18n.appendBlock(i18nMeta, index);
|
|
22077
|
+
} else {
|
|
22078
|
+
this.i18n.appendTemplate(i18nMeta, index);
|
|
22079
|
+
}
|
|
21872
22080
|
}
|
|
21873
22081
|
const contextName = `${this.contextName}${contextNameSuffix}_${index}`;
|
|
21874
22082
|
const name = `${contextName}_Template`;
|
|
21875
22083
|
const visitor = new TemplateDefinitionBuilder(this.constantPool, this._bindingScope, this.level + 1, contextName, this.i18n, index, name, this._namespace, this.fileBasedI18nSuffix, this.i18nUseExternalIds, this.deferBlocks, this.elementLocations, this._constants);
|
|
21876
22084
|
this._nestedTemplateFns.push(() => {
|
|
21877
|
-
const templateFunctionExpr = visitor.buildTemplateFunction(children, variables, this._ngContentReservedSlots.length + this._ngContentSelectorsOffset,
|
|
22085
|
+
const templateFunctionExpr = visitor.buildTemplateFunction(children, variables, this._ngContentReservedSlots.length + this._ngContentSelectorsOffset, i18nMeta, variableAliases);
|
|
21878
22086
|
this.constantPool.statements.push(templateFunctionExpr.toDeclStmt(name));
|
|
21879
22087
|
if (visitor._ngContentReservedSlots.length) {
|
|
21880
22088
|
this._ngContentReservedSlots.push(...visitor._ngContentReservedSlots);
|
|
@@ -21957,7 +22165,7 @@ var TemplateDefinitionBuilder = class {
|
|
|
21957
22165
|
const placeholders = this.i18nBindProps(icu.placeholders);
|
|
21958
22166
|
const message = icu.i18n;
|
|
21959
22167
|
const transformFn = (raw) => {
|
|
21960
|
-
const params = __spreadValues(__spreadValues({}, vars), placeholders);
|
|
22168
|
+
const params = Object.fromEntries(Object.entries(__spreadValues(__spreadValues({}, vars), placeholders)).sort());
|
|
21961
22169
|
const formatted = formatI18nPlaceholderNamesInMap(params, false);
|
|
21962
22170
|
return invokeInstruction(null, Identifiers.i18nPostprocess, [raw, mapLiteral(formatted, true)]);
|
|
21963
22171
|
};
|
|
@@ -21984,7 +22192,7 @@ var TemplateDefinitionBuilder = class {
|
|
|
21984
22192
|
tagName = inferredData.tagName;
|
|
21985
22193
|
attrsExprs = inferredData.attrsExprs;
|
|
21986
22194
|
}
|
|
21987
|
-
const templateIndex = this.createEmbeddedTemplateFn(tagName, children, "_Conditional", sourceSpan, variables, attrsExprs);
|
|
22195
|
+
const templateIndex = this.createEmbeddedTemplateFn(tagName, children, "_Conditional", sourceSpan, variables, attrsExprs, void 0, branch.i18n);
|
|
21988
22196
|
const processedExpression = expression === null ? null : expression.visit(this._valueConverter);
|
|
21989
22197
|
return { index: templateIndex, expression: processedExpression, alias: expressionAlias };
|
|
21990
22198
|
});
|
|
@@ -22018,7 +22226,7 @@ var TemplateDefinitionBuilder = class {
|
|
|
22018
22226
|
}
|
|
22019
22227
|
visitSwitchBlock(block) {
|
|
22020
22228
|
const caseData = block.cases.map((currentCase) => {
|
|
22021
|
-
const index = this.createEmbeddedTemplateFn(null, currentCase.children, "_Case", currentCase.sourceSpan);
|
|
22229
|
+
const index = this.createEmbeddedTemplateFn(null, currentCase.children, "_Case", currentCase.sourceSpan, void 0, void 0, void 0, currentCase.i18n);
|
|
22022
22230
|
const expression = currentCase.expression === null ? null : currentCase.expression.visit(this._valueConverter);
|
|
22023
22231
|
return { index, expression };
|
|
22024
22232
|
});
|
|
@@ -22046,12 +22254,12 @@ var TemplateDefinitionBuilder = class {
|
|
|
22046
22254
|
if (!metadata) {
|
|
22047
22255
|
throw new Error("Could not resolve `defer` block metadata. Block may need to be analyzed.");
|
|
22048
22256
|
}
|
|
22049
|
-
const primaryTemplateIndex = this.createEmbeddedTemplateFn(null, deferred.children, "_Defer", deferred.sourceSpan);
|
|
22050
|
-
const loadingIndex = loading ? this.createEmbeddedTemplateFn(null, loading.children, "_DeferLoading", loading.sourceSpan) : null;
|
|
22257
|
+
const primaryTemplateIndex = this.createEmbeddedTemplateFn(null, deferred.children, "_Defer", deferred.sourceSpan, void 0, void 0, void 0, deferred.i18n);
|
|
22258
|
+
const loadingIndex = loading ? this.createEmbeddedTemplateFn(null, loading.children, "_DeferLoading", loading.sourceSpan, void 0, void 0, void 0, loading.i18n) : null;
|
|
22051
22259
|
const loadingConsts = loading ? trimTrailingNulls([literal(loading.minimumTime), literal(loading.afterTime)]) : null;
|
|
22052
|
-
const placeholderIndex = placeholder ? this.createEmbeddedTemplateFn(null, placeholder.children, "_DeferPlaceholder", placeholder.sourceSpan) : null;
|
|
22260
|
+
const placeholderIndex = placeholder ? this.createEmbeddedTemplateFn(null, placeholder.children, "_DeferPlaceholder", placeholder.sourceSpan, void 0, void 0, void 0, placeholder.i18n) : null;
|
|
22053
22261
|
const placeholderConsts = placeholder && placeholder.minimumTime !== null ? literalArr([literal(placeholder.minimumTime)]) : null;
|
|
22054
|
-
const errorIndex = error2 ? this.createEmbeddedTemplateFn(null, error2.children, "_DeferError", error2.sourceSpan) : null;
|
|
22262
|
+
const errorIndex = error2 ? this.createEmbeddedTemplateFn(null, error2.children, "_DeferError", error2.sourceSpan, void 0, void 0, void 0, error2.i18n) : null;
|
|
22055
22263
|
const deferredIndex = this.allocateDataSlot();
|
|
22056
22264
|
const depsFnName = `${this.contextName}_Defer_${deferredIndex}_DepsFn`;
|
|
22057
22265
|
this.creationInstruction(deferred.sourceSpan, Identifiers.defer, trimTrailingNulls([
|
|
@@ -22160,11 +22368,14 @@ var TemplateDefinitionBuilder = class {
|
|
|
22160
22368
|
visitForLoopBlock(block) {
|
|
22161
22369
|
const blockIndex = this.allocateDataSlot();
|
|
22162
22370
|
const { tagName, attrsExprs } = this.inferProjectionDataFromInsertionPoint(block);
|
|
22163
|
-
const primaryData = this.prepareEmbeddedTemplateFn(block.children, "_For", [block.item, block.contextVariables.$index, block.contextVariables.$count]
|
|
22371
|
+
const primaryData = this.prepareEmbeddedTemplateFn(block.children, "_For", [block.item, block.contextVariables.$index, block.contextVariables.$count], block.i18n, {
|
|
22372
|
+
[block.contextVariables.$index.name]: this.getLevelSpecificVariableName("$index", this.level + 1),
|
|
22373
|
+
[block.contextVariables.$count.name]: this.getLevelSpecificVariableName("$count", this.level + 1)
|
|
22374
|
+
});
|
|
22164
22375
|
const { expression: trackByExpression, usesComponentInstance: trackByUsesComponentInstance } = this.createTrackByFunction(block);
|
|
22165
22376
|
let emptyData = null;
|
|
22166
22377
|
if (block.empty !== null) {
|
|
22167
|
-
emptyData = this.prepareEmbeddedTemplateFn(block.empty.children, "_ForEmpty");
|
|
22378
|
+
emptyData = this.prepareEmbeddedTemplateFn(block.empty.children, "_ForEmpty", void 0, block.empty.i18n);
|
|
22168
22379
|
this.allocateBindingSlots(null);
|
|
22169
22380
|
}
|
|
22170
22381
|
this.registerComputedLoopVariables(block, primaryData.scope);
|
|
@@ -22186,16 +22397,31 @@ var TemplateDefinitionBuilder = class {
|
|
|
22186
22397
|
return params;
|
|
22187
22398
|
});
|
|
22188
22399
|
const value = block.expression.visit(this._valueConverter);
|
|
22189
|
-
this.
|
|
22400
|
+
this.updateInstructionWithAdvance(blockIndex, block.sourceSpan, Identifiers.repeater, () => [this.convertPropertyBinding(value)]);
|
|
22190
22401
|
}
|
|
22191
22402
|
registerComputedLoopVariables(block, bindingScope) {
|
|
22192
|
-
const indexLocalName = block.contextVariables.$index.name;
|
|
22193
|
-
const countLocalName = block.contextVariables.$count.name;
|
|
22194
22403
|
const level = bindingScope.bindingLevel;
|
|
22195
|
-
bindingScope.set(level, block.contextVariables.$odd.name, (scope) =>
|
|
22196
|
-
|
|
22197
|
-
|
|
22198
|
-
bindingScope.set(level, block.contextVariables.$
|
|
22404
|
+
bindingScope.set(level, block.contextVariables.$odd.name, (scope, retrievalLevel) => {
|
|
22405
|
+
return this.getLevelSpecificForLoopVariable(block, scope, retrievalLevel, "$index").modulo(literal(2)).notIdentical(literal(0));
|
|
22406
|
+
});
|
|
22407
|
+
bindingScope.set(level, block.contextVariables.$even.name, (scope, retrievalLevel) => {
|
|
22408
|
+
return this.getLevelSpecificForLoopVariable(block, scope, retrievalLevel, "$index").modulo(literal(2)).identical(literal(0));
|
|
22409
|
+
});
|
|
22410
|
+
bindingScope.set(level, block.contextVariables.$first.name, (scope, retrievalLevel) => {
|
|
22411
|
+
return this.getLevelSpecificForLoopVariable(block, scope, retrievalLevel, "$index").identical(literal(0));
|
|
22412
|
+
});
|
|
22413
|
+
bindingScope.set(level, block.contextVariables.$last.name, (scope, retrievalLevel) => {
|
|
22414
|
+
const index = this.getLevelSpecificForLoopVariable(block, scope, retrievalLevel, "$index");
|
|
22415
|
+
const count = this.getLevelSpecificForLoopVariable(block, scope, retrievalLevel, "$count");
|
|
22416
|
+
return index.identical(count.minus(literal(1)));
|
|
22417
|
+
});
|
|
22418
|
+
}
|
|
22419
|
+
getLevelSpecificVariableName(name, level) {
|
|
22420
|
+
return `\u0275${name}_${level}`;
|
|
22421
|
+
}
|
|
22422
|
+
getLevelSpecificForLoopVariable(block, scope, retrievalLevel, name) {
|
|
22423
|
+
const scopeName = scope.bindingLevel === retrievalLevel ? block.contextVariables[name].name : this.getLevelSpecificVariableName(name, retrievalLevel);
|
|
22424
|
+
return scope.get(scopeName);
|
|
22199
22425
|
}
|
|
22200
22426
|
optimizeTrackByFunction(block) {
|
|
22201
22427
|
const indexLocalName = block.contextVariables.$index.name;
|
|
@@ -22605,7 +22831,7 @@ var BindingScope = class {
|
|
|
22605
22831
|
if (value.declareLocalCallback && !value.declare) {
|
|
22606
22832
|
value.declare = true;
|
|
22607
22833
|
}
|
|
22608
|
-
return typeof value.lhs === "function" ? value.lhs(this) : value.lhs;
|
|
22834
|
+
return typeof value.lhs === "function" ? value.lhs(this, value.retrievalLevel) : value.lhs;
|
|
22609
22835
|
}
|
|
22610
22836
|
current = current.parent;
|
|
22611
22837
|
}
|
|
@@ -22681,7 +22907,7 @@ var BindingScope = class {
|
|
|
22681
22907
|
const componentValue = this.map.get(SHARED_CONTEXT_KEY + 0);
|
|
22682
22908
|
componentValue.declare = true;
|
|
22683
22909
|
this.maybeRestoreView();
|
|
22684
|
-
const lhs = typeof componentValue.lhs === "function" ? componentValue.lhs(this) : componentValue.lhs;
|
|
22910
|
+
const lhs = typeof componentValue.lhs === "function" ? componentValue.lhs(this, componentValue.retrievalLevel) : componentValue.lhs;
|
|
22685
22911
|
return name === DIRECT_CONTEXT_REFERENCE ? lhs : lhs.prop(name);
|
|
22686
22912
|
}
|
|
22687
22913
|
maybeRestoreView() {
|
|
@@ -24750,7 +24976,7 @@ function publishFacade(global) {
|
|
|
24750
24976
|
}
|
|
24751
24977
|
|
|
24752
24978
|
// bazel-out/k8-fastbuild/bin/packages/compiler/src/version.mjs
|
|
24753
|
-
var VERSION2 = new Version("17.0.
|
|
24979
|
+
var VERSION2 = new Version("17.0.4");
|
|
24754
24980
|
|
|
24755
24981
|
// bazel-out/k8-fastbuild/bin/packages/compiler/src/i18n/extractor_merger.mjs
|
|
24756
24982
|
var _VisitorMode;
|