@angular/core 17.0.3 → 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/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/instructions/change_detection.mjs +2 -2
- package/esm2022/src/render3/instructions/control_flow.mjs +9 -11
- package/esm2022/src/version.mjs +1 -1
- package/esm2022/testing/src/logger.mjs +3 -3
- package/fesm2022/core.mjs +26 -16
- 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 +1 -1
- package/index.d.ts +2 -5
- 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 +201 -64
- package/schematics/migrations/block-template-entities/bundle.js.map +4 -4
- package/schematics/ng-generate/control-flow-migration/bundle.js +361 -151
- 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 +257 -73
- package/schematics/ng-generate/standalone-migration/bundle.js.map +4 -4
- package/testing/index.d.ts +1 -1
|
@@ -540,6 +540,9 @@ var _SerializerVisitor = class {
|
|
|
540
540
|
visitIcuPlaceholder(ph, context) {
|
|
541
541
|
return `<ph icu name="${ph.name}">${ph.value.visit(this)}</ph>`;
|
|
542
542
|
}
|
|
543
|
+
visitBlockPlaceholder(ph, context) {
|
|
544
|
+
return `<ph block name="${ph.startName}">${ph.children.map((child) => child.visit(this)).join(", ")}</ph name="${ph.closeName}">`;
|
|
545
|
+
}
|
|
543
546
|
};
|
|
544
547
|
var serializerVisitor = new _SerializerVisitor();
|
|
545
548
|
function serializeNodes(nodes) {
|
|
@@ -3585,43 +3588,47 @@ var BlockNode = class {
|
|
|
3585
3588
|
}
|
|
3586
3589
|
};
|
|
3587
3590
|
var DeferredBlockPlaceholder = class extends BlockNode {
|
|
3588
|
-
constructor(children, minimumTime, nameSpan, sourceSpan, startSourceSpan, endSourceSpan) {
|
|
3591
|
+
constructor(children, minimumTime, nameSpan, sourceSpan, startSourceSpan, endSourceSpan, i18n2) {
|
|
3589
3592
|
super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);
|
|
3590
3593
|
this.children = children;
|
|
3591
3594
|
this.minimumTime = minimumTime;
|
|
3595
|
+
this.i18n = i18n2;
|
|
3592
3596
|
}
|
|
3593
3597
|
visit(visitor) {
|
|
3594
3598
|
return visitor.visitDeferredBlockPlaceholder(this);
|
|
3595
3599
|
}
|
|
3596
3600
|
};
|
|
3597
3601
|
var DeferredBlockLoading = class extends BlockNode {
|
|
3598
|
-
constructor(children, afterTime, minimumTime, nameSpan, sourceSpan, startSourceSpan, endSourceSpan) {
|
|
3602
|
+
constructor(children, afterTime, minimumTime, nameSpan, sourceSpan, startSourceSpan, endSourceSpan, i18n2) {
|
|
3599
3603
|
super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);
|
|
3600
3604
|
this.children = children;
|
|
3601
3605
|
this.afterTime = afterTime;
|
|
3602
3606
|
this.minimumTime = minimumTime;
|
|
3607
|
+
this.i18n = i18n2;
|
|
3603
3608
|
}
|
|
3604
3609
|
visit(visitor) {
|
|
3605
3610
|
return visitor.visitDeferredBlockLoading(this);
|
|
3606
3611
|
}
|
|
3607
3612
|
};
|
|
3608
3613
|
var DeferredBlockError = class extends BlockNode {
|
|
3609
|
-
constructor(children, nameSpan, sourceSpan, startSourceSpan, endSourceSpan) {
|
|
3614
|
+
constructor(children, nameSpan, sourceSpan, startSourceSpan, endSourceSpan, i18n2) {
|
|
3610
3615
|
super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);
|
|
3611
3616
|
this.children = children;
|
|
3617
|
+
this.i18n = i18n2;
|
|
3612
3618
|
}
|
|
3613
3619
|
visit(visitor) {
|
|
3614
3620
|
return visitor.visitDeferredBlockError(this);
|
|
3615
3621
|
}
|
|
3616
3622
|
};
|
|
3617
3623
|
var DeferredBlock = class extends BlockNode {
|
|
3618
|
-
constructor(children, triggers, prefetchTriggers, placeholder, loading, error2, nameSpan, sourceSpan, mainBlockSpan, startSourceSpan, endSourceSpan) {
|
|
3624
|
+
constructor(children, triggers, prefetchTriggers, placeholder, loading, error2, nameSpan, sourceSpan, mainBlockSpan, startSourceSpan, endSourceSpan, i18n2) {
|
|
3619
3625
|
super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);
|
|
3620
3626
|
this.children = children;
|
|
3621
3627
|
this.placeholder = placeholder;
|
|
3622
3628
|
this.loading = loading;
|
|
3623
3629
|
this.error = error2;
|
|
3624
3630
|
this.mainBlockSpan = mainBlockSpan;
|
|
3631
|
+
this.i18n = i18n2;
|
|
3625
3632
|
this.triggers = triggers;
|
|
3626
3633
|
this.prefetchTriggers = prefetchTriggers;
|
|
3627
3634
|
this.definedTriggers = Object.keys(triggers);
|
|
@@ -3642,10 +3649,10 @@ var DeferredBlock = class extends BlockNode {
|
|
|
3642
3649
|
}
|
|
3643
3650
|
};
|
|
3644
3651
|
var SwitchBlock = class extends BlockNode {
|
|
3645
|
-
constructor(expression,
|
|
3652
|
+
constructor(expression, cases2, unknownBlocks, sourceSpan, startSourceSpan, endSourceSpan, nameSpan) {
|
|
3646
3653
|
super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);
|
|
3647
3654
|
this.expression = expression;
|
|
3648
|
-
this.cases =
|
|
3655
|
+
this.cases = cases2;
|
|
3649
3656
|
this.unknownBlocks = unknownBlocks;
|
|
3650
3657
|
}
|
|
3651
3658
|
visit(visitor) {
|
|
@@ -3653,17 +3660,18 @@ var SwitchBlock = class extends BlockNode {
|
|
|
3653
3660
|
}
|
|
3654
3661
|
};
|
|
3655
3662
|
var SwitchBlockCase = class extends BlockNode {
|
|
3656
|
-
constructor(expression, children, sourceSpan, startSourceSpan, endSourceSpan, nameSpan) {
|
|
3663
|
+
constructor(expression, children, sourceSpan, startSourceSpan, endSourceSpan, nameSpan, i18n2) {
|
|
3657
3664
|
super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);
|
|
3658
3665
|
this.expression = expression;
|
|
3659
3666
|
this.children = children;
|
|
3667
|
+
this.i18n = i18n2;
|
|
3660
3668
|
}
|
|
3661
3669
|
visit(visitor) {
|
|
3662
3670
|
return visitor.visitSwitchBlockCase(this);
|
|
3663
3671
|
}
|
|
3664
3672
|
};
|
|
3665
3673
|
var ForLoopBlock = class extends BlockNode {
|
|
3666
|
-
constructor(item, expression, trackBy, trackKeywordSpan, contextVariables, children, empty, sourceSpan, mainBlockSpan, startSourceSpan, endSourceSpan, nameSpan) {
|
|
3674
|
+
constructor(item, expression, trackBy, trackKeywordSpan, contextVariables, children, empty, sourceSpan, mainBlockSpan, startSourceSpan, endSourceSpan, nameSpan, i18n2) {
|
|
3667
3675
|
super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);
|
|
3668
3676
|
this.item = item;
|
|
3669
3677
|
this.expression = expression;
|
|
@@ -3673,15 +3681,17 @@ var ForLoopBlock = class extends BlockNode {
|
|
|
3673
3681
|
this.children = children;
|
|
3674
3682
|
this.empty = empty;
|
|
3675
3683
|
this.mainBlockSpan = mainBlockSpan;
|
|
3684
|
+
this.i18n = i18n2;
|
|
3676
3685
|
}
|
|
3677
3686
|
visit(visitor) {
|
|
3678
3687
|
return visitor.visitForLoopBlock(this);
|
|
3679
3688
|
}
|
|
3680
3689
|
};
|
|
3681
3690
|
var ForLoopBlockEmpty = class extends BlockNode {
|
|
3682
|
-
constructor(children, sourceSpan, startSourceSpan, endSourceSpan, nameSpan) {
|
|
3691
|
+
constructor(children, sourceSpan, startSourceSpan, endSourceSpan, nameSpan, i18n2) {
|
|
3683
3692
|
super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);
|
|
3684
3693
|
this.children = children;
|
|
3694
|
+
this.i18n = i18n2;
|
|
3685
3695
|
}
|
|
3686
3696
|
visit(visitor) {
|
|
3687
3697
|
return visitor.visitForLoopBlockEmpty(this);
|
|
@@ -3697,11 +3707,12 @@ var IfBlock = class extends BlockNode {
|
|
|
3697
3707
|
}
|
|
3698
3708
|
};
|
|
3699
3709
|
var IfBlockBranch = class extends BlockNode {
|
|
3700
|
-
constructor(expression, children, expressionAlias, sourceSpan, startSourceSpan, endSourceSpan, nameSpan) {
|
|
3710
|
+
constructor(expression, children, expressionAlias, sourceSpan, startSourceSpan, endSourceSpan, nameSpan, i18n2) {
|
|
3701
3711
|
super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);
|
|
3702
3712
|
this.expression = expression;
|
|
3703
3713
|
this.children = children;
|
|
3704
3714
|
this.expressionAlias = expressionAlias;
|
|
3715
|
+
this.i18n = i18n2;
|
|
3705
3716
|
}
|
|
3706
3717
|
visit(visitor) {
|
|
3707
3718
|
return visitor.visitIfBlockBranch(this);
|
|
@@ -3844,10 +3855,10 @@ var Container = class {
|
|
|
3844
3855
|
}
|
|
3845
3856
|
};
|
|
3846
3857
|
var Icu2 = class {
|
|
3847
|
-
constructor(expression, type,
|
|
3858
|
+
constructor(expression, type, cases2, sourceSpan, expressionPlaceholder) {
|
|
3848
3859
|
this.expression = expression;
|
|
3849
3860
|
this.type = type;
|
|
3850
|
-
this.cases =
|
|
3861
|
+
this.cases = cases2;
|
|
3851
3862
|
this.sourceSpan = sourceSpan;
|
|
3852
3863
|
this.expressionPlaceholder = expressionPlaceholder;
|
|
3853
3864
|
}
|
|
@@ -3891,6 +3902,21 @@ var IcuPlaceholder = class {
|
|
|
3891
3902
|
return visitor.visitIcuPlaceholder(this, context);
|
|
3892
3903
|
}
|
|
3893
3904
|
};
|
|
3905
|
+
var BlockPlaceholder = class {
|
|
3906
|
+
constructor(name, parameters, startName, closeName, children, sourceSpan, startSourceSpan, endSourceSpan) {
|
|
3907
|
+
this.name = name;
|
|
3908
|
+
this.parameters = parameters;
|
|
3909
|
+
this.startName = startName;
|
|
3910
|
+
this.closeName = closeName;
|
|
3911
|
+
this.children = children;
|
|
3912
|
+
this.sourceSpan = sourceSpan;
|
|
3913
|
+
this.startSourceSpan = startSourceSpan;
|
|
3914
|
+
this.endSourceSpan = endSourceSpan;
|
|
3915
|
+
}
|
|
3916
|
+
visit(visitor, context) {
|
|
3917
|
+
return visitor.visitBlockPlaceholder(this, context);
|
|
3918
|
+
}
|
|
3919
|
+
};
|
|
3894
3920
|
var RecurseVisitor = class {
|
|
3895
3921
|
visitText(text2, context) {
|
|
3896
3922
|
}
|
|
@@ -3909,6 +3935,9 @@ var RecurseVisitor = class {
|
|
|
3909
3935
|
}
|
|
3910
3936
|
visitIcuPlaceholder(ph, context) {
|
|
3911
3937
|
}
|
|
3938
|
+
visitBlockPlaceholder(ph, context) {
|
|
3939
|
+
ph.children.forEach((child) => child.visit(this));
|
|
3940
|
+
}
|
|
3912
3941
|
};
|
|
3913
3942
|
function serializeMessage(messageNodes) {
|
|
3914
3943
|
const visitor = new LocalizeMessageStringVisitor();
|
|
@@ -3936,6 +3965,10 @@ var LocalizeMessageStringVisitor = class {
|
|
|
3936
3965
|
visitIcuPlaceholder(ph) {
|
|
3937
3966
|
return `{$${ph.name}}`;
|
|
3938
3967
|
}
|
|
3968
|
+
visitBlockPlaceholder(ph) {
|
|
3969
|
+
const children = ph.children.map((child) => child.visit(this)).join("");
|
|
3970
|
+
return `{$${ph.startName}}${children}{$${ph.closeName}}`;
|
|
3971
|
+
}
|
|
3939
3972
|
};
|
|
3940
3973
|
|
|
3941
3974
|
// bazel-out/k8-fastbuild/bin/packages/compiler/src/i18n/serializers/xml_helper.mjs
|
|
@@ -4403,7 +4436,7 @@ function assertInterpolationSymbols(identifier, value) {
|
|
|
4403
4436
|
}
|
|
4404
4437
|
}
|
|
4405
4438
|
|
|
4406
|
-
// bazel-out/k8-fastbuild/bin/packages/compiler/src/ml_parser/
|
|
4439
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler/src/ml_parser/defaults.mjs
|
|
4407
4440
|
var InterpolationConfig = class {
|
|
4408
4441
|
static fromArray(markers) {
|
|
4409
4442
|
if (!markers) {
|
|
@@ -4418,6 +4451,7 @@ var InterpolationConfig = class {
|
|
|
4418
4451
|
}
|
|
4419
4452
|
};
|
|
4420
4453
|
var DEFAULT_INTERPOLATION_CONFIG = new InterpolationConfig("{{", "}}");
|
|
4454
|
+
var DEFAULT_CONTAINER_BLOCKS = /* @__PURE__ */ new Set(["switch"]);
|
|
4421
4455
|
|
|
4422
4456
|
// bazel-out/k8-fastbuild/bin/packages/compiler/src/chars.mjs
|
|
4423
4457
|
var $EOF = 0;
|
|
@@ -7229,13 +7263,13 @@ function createConditionalOp(target, targetSlot, test, conditions, sourceSpan) {
|
|
|
7229
7263
|
}, NEW_OP), TRAIT_DEPENDS_ON_SLOT_CONTEXT), TRAIT_CONSUMES_VARS);
|
|
7230
7264
|
}
|
|
7231
7265
|
function createRepeaterOp(repeaterCreate2, targetSlot, collection, sourceSpan) {
|
|
7232
|
-
return __spreadValues({
|
|
7266
|
+
return __spreadValues(__spreadValues({
|
|
7233
7267
|
kind: OpKind.Repeater,
|
|
7234
7268
|
target: repeaterCreate2,
|
|
7235
7269
|
targetSlot,
|
|
7236
7270
|
collection,
|
|
7237
7271
|
sourceSpan
|
|
7238
|
-
}, NEW_OP);
|
|
7272
|
+
}, NEW_OP), TRAIT_DEPENDS_ON_SLOT_CONTEXT);
|
|
7239
7273
|
}
|
|
7240
7274
|
function createDeferWhenOp(target, expr, prefetch, sourceSpan) {
|
|
7241
7275
|
return __spreadValues(__spreadValues({
|
|
@@ -9910,6 +9944,9 @@ var IcuSerializerVisitor = class {
|
|
|
9910
9944
|
visitPlaceholder(ph) {
|
|
9911
9945
|
return this.formatPh(ph.name);
|
|
9912
9946
|
}
|
|
9947
|
+
visitBlockPlaceholder(ph) {
|
|
9948
|
+
return `${this.formatPh(ph.startName)}${ph.children.map((child) => child.visit(this)).join("")}${this.formatPh(ph.closeName)}`;
|
|
9949
|
+
}
|
|
9913
9950
|
visitIcuPlaceholder(ph, context) {
|
|
9914
9951
|
return this.formatPh(ph.name);
|
|
9915
9952
|
}
|
|
@@ -11195,11 +11232,11 @@ var Text4 = class extends NodeWithI18n {
|
|
|
11195
11232
|
}
|
|
11196
11233
|
};
|
|
11197
11234
|
var Expansion = class extends NodeWithI18n {
|
|
11198
|
-
constructor(switchValue, type,
|
|
11235
|
+
constructor(switchValue, type, cases2, sourceSpan, switchValueSourceSpan, i18n2) {
|
|
11199
11236
|
super(sourceSpan, i18n2);
|
|
11200
11237
|
this.switchValue = switchValue;
|
|
11201
11238
|
this.type = type;
|
|
11202
|
-
this.cases =
|
|
11239
|
+
this.cases = cases2;
|
|
11203
11240
|
this.switchValueSourceSpan = switchValueSourceSpan;
|
|
11204
11241
|
}
|
|
11205
11242
|
visit(visitor, context) {
|
|
@@ -11253,12 +11290,12 @@ var Comment2 = class {
|
|
|
11253
11290
|
return visitor.visitComment(this, context);
|
|
11254
11291
|
}
|
|
11255
11292
|
};
|
|
11256
|
-
var Block = class {
|
|
11257
|
-
constructor(name, parameters, children, sourceSpan, nameSpan, startSourceSpan, endSourceSpan = null) {
|
|
11293
|
+
var Block = class extends NodeWithI18n {
|
|
11294
|
+
constructor(name, parameters, children, sourceSpan, nameSpan, startSourceSpan, endSourceSpan = null, i18n2) {
|
|
11295
|
+
super(sourceSpan, i18n2);
|
|
11258
11296
|
this.name = name;
|
|
11259
11297
|
this.parameters = parameters;
|
|
11260
11298
|
this.children = children;
|
|
11261
|
-
this.sourceSpan = sourceSpan;
|
|
11262
11299
|
this.nameSpan = nameSpan;
|
|
11263
11300
|
this.startSourceSpan = startSourceSpan;
|
|
11264
11301
|
this.endSourceSpan = endSourceSpan;
|
|
@@ -11877,6 +11914,24 @@ var PlaceholderRegistry = class {
|
|
|
11877
11914
|
getUniquePlaceholder(name) {
|
|
11878
11915
|
return this._generateUniqueName(name.toUpperCase());
|
|
11879
11916
|
}
|
|
11917
|
+
getStartBlockPlaceholderName(name, parameters) {
|
|
11918
|
+
const signature = this._hashBlock(name, parameters);
|
|
11919
|
+
if (this._signatureToName[signature]) {
|
|
11920
|
+
return this._signatureToName[signature];
|
|
11921
|
+
}
|
|
11922
|
+
const placeholder = this._generateUniqueName(`START_BLOCK_${this._toSnakeCase(name)}`);
|
|
11923
|
+
this._signatureToName[signature] = placeholder;
|
|
11924
|
+
return placeholder;
|
|
11925
|
+
}
|
|
11926
|
+
getCloseBlockPlaceholderName(name) {
|
|
11927
|
+
const signature = this._hashClosingBlock(name);
|
|
11928
|
+
if (this._signatureToName[signature]) {
|
|
11929
|
+
return this._signatureToName[signature];
|
|
11930
|
+
}
|
|
11931
|
+
const placeholder = this._generateUniqueName(`CLOSE_BLOCK_${this._toSnakeCase(name)}`);
|
|
11932
|
+
this._signatureToName[signature] = placeholder;
|
|
11933
|
+
return placeholder;
|
|
11934
|
+
}
|
|
11880
11935
|
_hashTag(tag, attrs, isVoid) {
|
|
11881
11936
|
const start = `<${tag}`;
|
|
11882
11937
|
const strAttrs = Object.keys(attrs).sort().map((name) => ` ${name}=${attrs[name]}`).join("");
|
|
@@ -11886,6 +11941,16 @@ var PlaceholderRegistry = class {
|
|
|
11886
11941
|
_hashClosingTag(tag) {
|
|
11887
11942
|
return this._hashTag(`/${tag}`, {}, false);
|
|
11888
11943
|
}
|
|
11944
|
+
_hashBlock(name, parameters) {
|
|
11945
|
+
const params = parameters.length === 0 ? "" : ` (${parameters.sort().join("; ")})`;
|
|
11946
|
+
return `@${name}${params} {}`;
|
|
11947
|
+
}
|
|
11948
|
+
_hashClosingBlock(name) {
|
|
11949
|
+
return this._hashBlock(`close_${name}`, []);
|
|
11950
|
+
}
|
|
11951
|
+
_toSnakeCase(name) {
|
|
11952
|
+
return name.toUpperCase().replace(/[^A-Z0-9]/g, "_");
|
|
11953
|
+
}
|
|
11889
11954
|
_generateUniqueName(base) {
|
|
11890
11955
|
const seen = this._placeHolderNameCounts.hasOwnProperty(base);
|
|
11891
11956
|
if (!seen) {
|
|
@@ -11900,17 +11965,18 @@ var PlaceholderRegistry = class {
|
|
|
11900
11965
|
|
|
11901
11966
|
// bazel-out/k8-fastbuild/bin/packages/compiler/src/i18n/i18n_parser.mjs
|
|
11902
11967
|
var _expParser = new Parser(new Lexer());
|
|
11903
|
-
function createI18nMessageFactory(interpolationConfig) {
|
|
11904
|
-
const visitor = new _I18nVisitor(_expParser, interpolationConfig);
|
|
11968
|
+
function createI18nMessageFactory(interpolationConfig, containerBlocks) {
|
|
11969
|
+
const visitor = new _I18nVisitor(_expParser, interpolationConfig, containerBlocks);
|
|
11905
11970
|
return (nodes, meaning, description, customId, visitNodeFn) => visitor.toI18nMessage(nodes, meaning, description, customId, visitNodeFn);
|
|
11906
11971
|
}
|
|
11907
11972
|
function noopVisitNodeFn(_html, i18n2) {
|
|
11908
11973
|
return i18n2;
|
|
11909
11974
|
}
|
|
11910
11975
|
var _I18nVisitor = class {
|
|
11911
|
-
constructor(_expressionParser, _interpolationConfig) {
|
|
11976
|
+
constructor(_expressionParser, _interpolationConfig, _containerBlocks) {
|
|
11912
11977
|
this._expressionParser = _expressionParser;
|
|
11913
11978
|
this._interpolationConfig = _interpolationConfig;
|
|
11979
|
+
this._containerBlocks = _containerBlocks;
|
|
11914
11980
|
}
|
|
11915
11981
|
toI18nMessage(nodes, meaning = "", description = "", customId = "", visitNodeFn) {
|
|
11916
11982
|
const context = {
|
|
@@ -11985,11 +12051,27 @@ var _I18nVisitor = class {
|
|
|
11985
12051
|
throw new Error("Unreachable code");
|
|
11986
12052
|
}
|
|
11987
12053
|
visitBlock(block, context) {
|
|
12054
|
+
var _a2;
|
|
11988
12055
|
const children = visitAll2(this, block.children, context);
|
|
11989
|
-
|
|
12056
|
+
if (this._containerBlocks.has(block.name)) {
|
|
12057
|
+
return new Container(children, block.sourceSpan);
|
|
12058
|
+
}
|
|
12059
|
+
const parameters = block.parameters.map((param) => param.expression);
|
|
12060
|
+
const startPhName = context.placeholderRegistry.getStartBlockPlaceholderName(block.name, parameters);
|
|
12061
|
+
const closePhName = context.placeholderRegistry.getCloseBlockPlaceholderName(block.name);
|
|
12062
|
+
context.placeholderToContent[startPhName] = {
|
|
12063
|
+
text: block.startSourceSpan.toString(),
|
|
12064
|
+
sourceSpan: block.startSourceSpan
|
|
12065
|
+
};
|
|
12066
|
+
context.placeholderToContent[closePhName] = {
|
|
12067
|
+
text: block.endSourceSpan ? block.endSourceSpan.toString() : "}",
|
|
12068
|
+
sourceSpan: (_a2 = block.endSourceSpan) != null ? _a2 : block.sourceSpan
|
|
12069
|
+
};
|
|
12070
|
+
const node = new BlockPlaceholder(block.name, parameters, startPhName, closePhName, children, block.sourceSpan, block.startSourceSpan, block.endSourceSpan);
|
|
11990
12071
|
return context.visitNodeFn(block, node);
|
|
11991
12072
|
}
|
|
11992
12073
|
visitBlockParameter(_parameter, _context) {
|
|
12074
|
+
throw new Error("Unreachable code");
|
|
11993
12075
|
}
|
|
11994
12076
|
_visitTextWithInterpolation(tokens, sourceSpan, context, previousI18n) {
|
|
11995
12077
|
const nodes = [];
|
|
@@ -15220,19 +15302,19 @@ var _TreeBuilder = class {
|
|
|
15220
15302
|
_consumeExpansion(token) {
|
|
15221
15303
|
const switchValue = this._advance();
|
|
15222
15304
|
const type = this._advance();
|
|
15223
|
-
const
|
|
15305
|
+
const cases2 = [];
|
|
15224
15306
|
while (this._peek.type === 20) {
|
|
15225
15307
|
const expCase = this._parseExpansionCase();
|
|
15226
15308
|
if (!expCase)
|
|
15227
15309
|
return;
|
|
15228
|
-
|
|
15310
|
+
cases2.push(expCase);
|
|
15229
15311
|
}
|
|
15230
15312
|
if (this._peek.type !== 23) {
|
|
15231
15313
|
this.errors.push(TreeError.create(null, this._peek.sourceSpan, `Invalid ICU message. Missing '}'.`));
|
|
15232
15314
|
return;
|
|
15233
15315
|
}
|
|
15234
15316
|
const sourceSpan = new ParseSourceSpan(token.sourceSpan.start, this._peek.sourceSpan.end, token.sourceSpan.fullStart);
|
|
15235
|
-
this._addToParent(new Expansion(switchValue.parts[0], type.parts[0],
|
|
15317
|
+
this._addToParent(new Expansion(switchValue.parts[0], type.parts[0], cases2, sourceSpan, switchValue.sourceSpan));
|
|
15236
15318
|
this._advance();
|
|
15237
15319
|
}
|
|
15238
15320
|
_parseExpansionCase() {
|
|
@@ -15529,16 +15611,17 @@ var setI18nRefs = (htmlNode, i18nNode) => {
|
|
|
15529
15611
|
return i18nNode;
|
|
15530
15612
|
};
|
|
15531
15613
|
var I18nMetaVisitor = class {
|
|
15532
|
-
constructor(interpolationConfig = DEFAULT_INTERPOLATION_CONFIG, keepI18nAttrs = false, enableI18nLegacyMessageIdFormat = false) {
|
|
15614
|
+
constructor(interpolationConfig = DEFAULT_INTERPOLATION_CONFIG, keepI18nAttrs = false, enableI18nLegacyMessageIdFormat = false, containerBlocks = DEFAULT_CONTAINER_BLOCKS) {
|
|
15533
15615
|
this.interpolationConfig = interpolationConfig;
|
|
15534
15616
|
this.keepI18nAttrs = keepI18nAttrs;
|
|
15535
15617
|
this.enableI18nLegacyMessageIdFormat = enableI18nLegacyMessageIdFormat;
|
|
15618
|
+
this.containerBlocks = containerBlocks;
|
|
15536
15619
|
this.hasI18nMeta = false;
|
|
15537
15620
|
this._errors = [];
|
|
15538
15621
|
}
|
|
15539
15622
|
_generateI18nMessage(nodes, meta = "", visitNodeFn) {
|
|
15540
15623
|
const { meaning, description, customId } = this._parseMetadata(meta);
|
|
15541
|
-
const createI18nMessage2 = createI18nMessageFactory(this.interpolationConfig);
|
|
15624
|
+
const createI18nMessage2 = createI18nMessageFactory(this.interpolationConfig, this.containerBlocks);
|
|
15542
15625
|
const message = createI18nMessage2(nodes, meaning, description, customId, visitNodeFn);
|
|
15543
15626
|
this._setMessageId(message, meta);
|
|
15544
15627
|
this._setLegacyIds(message, meta);
|
|
@@ -15713,6 +15796,9 @@ var GetMsgSerializerVisitor = class {
|
|
|
15713
15796
|
visitPlaceholder(ph) {
|
|
15714
15797
|
return this.formatPh(ph.name);
|
|
15715
15798
|
}
|
|
15799
|
+
visitBlockPlaceholder(ph) {
|
|
15800
|
+
return `${this.formatPh(ph.startName)}${ph.children.map((child) => child.visit(this)).join("")}${this.formatPh(ph.closeName)}`;
|
|
15801
|
+
}
|
|
15716
15802
|
visitIcuPlaceholder(ph, context) {
|
|
15717
15803
|
return this.formatPh(ph.name);
|
|
15718
15804
|
}
|
|
@@ -15761,6 +15847,12 @@ var LocalizeSerializerVisitor = class {
|
|
|
15761
15847
|
visitPlaceholder(ph) {
|
|
15762
15848
|
this.pieces.push(this.createPlaceholderPiece(ph.name, ph.sourceSpan));
|
|
15763
15849
|
}
|
|
15850
|
+
visitBlockPlaceholder(ph) {
|
|
15851
|
+
var _a2, _b2;
|
|
15852
|
+
this.pieces.push(this.createPlaceholderPiece(ph.startName, (_a2 = ph.startSourceSpan) != null ? _a2 : ph.sourceSpan));
|
|
15853
|
+
ph.children.forEach((child) => child.visit(this));
|
|
15854
|
+
this.pieces.push(this.createPlaceholderPiece(ph.closeName, (_b2 = ph.endSourceSpan) != null ? _b2 : ph.sourceSpan));
|
|
15855
|
+
}
|
|
15764
15856
|
visitIcuPlaceholder(ph) {
|
|
15765
15857
|
this.pieces.push(this.createPlaceholderPiece(ph.name, ph.sourceSpan, this.placeholderToMessage[ph.name]));
|
|
15766
15858
|
}
|
|
@@ -16842,8 +16934,8 @@ function repeaterCreate(slot, viewFnName, decls, vars, tag, constIndex, trackByF
|
|
|
16842
16934
|
}
|
|
16843
16935
|
return call(Identifiers.repeaterCreate, args, sourceSpan);
|
|
16844
16936
|
}
|
|
16845
|
-
function repeater(
|
|
16846
|
-
return call(Identifiers.repeater, [
|
|
16937
|
+
function repeater(collection, sourceSpan) {
|
|
16938
|
+
return call(Identifiers.repeater, [collection], sourceSpan);
|
|
16847
16939
|
}
|
|
16848
16940
|
function deferWhen(prefetch, expr, sourceSpan) {
|
|
16849
16941
|
return call(prefetch ? Identifiers.deferPrefetchWhen : Identifiers.deferWhen, [expr], sourceSpan);
|
|
@@ -17401,7 +17493,7 @@ function reifyUpdateOperations(_unit, ops) {
|
|
|
17401
17493
|
OpList.replace(op, conditional(op.targetSlot.slot, op.processed, op.contextValue, op.sourceSpan));
|
|
17402
17494
|
break;
|
|
17403
17495
|
case OpKind.Repeater:
|
|
17404
|
-
OpList.replace(op, repeater(op.
|
|
17496
|
+
OpList.replace(op, repeater(op.collection, op.sourceSpan));
|
|
17405
17497
|
break;
|
|
17406
17498
|
case OpKind.DeferWhen:
|
|
17407
17499
|
OpList.replace(op, deferWhen(op.prefetch, op.expr, op.sourceSpan));
|
|
@@ -17767,9 +17859,8 @@ var ResolveIcuPlaceholdersVisitor = class extends RecurseVisitor {
|
|
|
17767
17859
|
super();
|
|
17768
17860
|
this.params = params;
|
|
17769
17861
|
}
|
|
17770
|
-
|
|
17862
|
+
visitContainerPlaceholder(placeholder) {
|
|
17771
17863
|
var _a2, _b2;
|
|
17772
|
-
super.visitTagPlaceholder(placeholder);
|
|
17773
17864
|
if (placeholder.startName && placeholder.startSourceSpan && !this.params.has(placeholder.startName)) {
|
|
17774
17865
|
this.params.set(placeholder.startName, [{
|
|
17775
17866
|
value: (_a2 = placeholder.startSourceSpan) == null ? void 0 : _a2.toString(),
|
|
@@ -17785,6 +17876,14 @@ var ResolveIcuPlaceholdersVisitor = class extends RecurseVisitor {
|
|
|
17785
17876
|
}]);
|
|
17786
17877
|
}
|
|
17787
17878
|
}
|
|
17879
|
+
visitTagPlaceholder(placeholder) {
|
|
17880
|
+
super.visitTagPlaceholder(placeholder);
|
|
17881
|
+
this.visitContainerPlaceholder(placeholder);
|
|
17882
|
+
}
|
|
17883
|
+
visitBlockPlaceholder(placeholder) {
|
|
17884
|
+
super.visitBlockPlaceholder(placeholder);
|
|
17885
|
+
this.visitContainerPlaceholder(placeholder);
|
|
17886
|
+
}
|
|
17788
17887
|
};
|
|
17789
17888
|
|
|
17790
17889
|
// bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_names.mjs
|
|
@@ -20104,18 +20203,18 @@ function createIfBlock(ast, connectedBlocks, visitor, bindingParser) {
|
|
|
20104
20203
|
const branches = [];
|
|
20105
20204
|
const mainBlockParams = parseConditionalBlockParameters(ast, errors, bindingParser);
|
|
20106
20205
|
if (mainBlockParams !== null) {
|
|
20107
|
-
branches.push(new IfBlockBranch(mainBlockParams.expression, visitAll2(visitor, ast.children, ast.children), mainBlockParams.expressionAlias, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan, ast.nameSpan));
|
|
20206
|
+
branches.push(new IfBlockBranch(mainBlockParams.expression, visitAll2(visitor, ast.children, ast.children), mainBlockParams.expressionAlias, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan, ast.nameSpan, ast.i18n));
|
|
20108
20207
|
}
|
|
20109
20208
|
for (const block of connectedBlocks) {
|
|
20110
20209
|
if (ELSE_IF_PATTERN.test(block.name)) {
|
|
20111
20210
|
const params = parseConditionalBlockParameters(block, errors, bindingParser);
|
|
20112
20211
|
if (params !== null) {
|
|
20113
20212
|
const children = visitAll2(visitor, block.children, block.children);
|
|
20114
|
-
branches.push(new IfBlockBranch(params.expression, children, params.expressionAlias, block.sourceSpan, block.startSourceSpan, block.endSourceSpan, block.nameSpan));
|
|
20213
|
+
branches.push(new IfBlockBranch(params.expression, children, params.expressionAlias, block.sourceSpan, block.startSourceSpan, block.endSourceSpan, block.nameSpan, block.i18n));
|
|
20115
20214
|
}
|
|
20116
20215
|
} else if (block.name === "else") {
|
|
20117
20216
|
const children = visitAll2(visitor, block.children, block.children);
|
|
20118
|
-
branches.push(new IfBlockBranch(null, children, null, block.sourceSpan, block.startSourceSpan, block.endSourceSpan, block.nameSpan));
|
|
20217
|
+
branches.push(new IfBlockBranch(null, children, null, block.sourceSpan, block.startSourceSpan, block.endSourceSpan, block.nameSpan, block.i18n));
|
|
20119
20218
|
}
|
|
20120
20219
|
}
|
|
20121
20220
|
const ifBlockStartSourceSpan = branches.length > 0 ? branches[0].startSourceSpan : ast.startSourceSpan;
|
|
@@ -20143,7 +20242,7 @@ function createForLoop(ast, connectedBlocks, visitor, bindingParser) {
|
|
|
20143
20242
|
} else if (block.parameters.length > 0) {
|
|
20144
20243
|
errors.push(new ParseError(block.sourceSpan, "@empty block cannot have parameters"));
|
|
20145
20244
|
} else {
|
|
20146
|
-
empty = new ForLoopBlockEmpty(visitAll2(visitor, block.children, block.children), block.sourceSpan, block.startSourceSpan, block.endSourceSpan, block.nameSpan);
|
|
20245
|
+
empty = new ForLoopBlockEmpty(visitAll2(visitor, block.children, block.children), block.sourceSpan, block.startSourceSpan, block.endSourceSpan, block.nameSpan, block.i18n);
|
|
20147
20246
|
}
|
|
20148
20247
|
} else {
|
|
20149
20248
|
errors.push(new ParseError(block.sourceSpan, `Unrecognized @for loop block "${block.name}"`));
|
|
@@ -20155,7 +20254,7 @@ function createForLoop(ast, connectedBlocks, visitor, bindingParser) {
|
|
|
20155
20254
|
} else {
|
|
20156
20255
|
const endSpan = (_a2 = empty == null ? void 0 : empty.endSourceSpan) != null ? _a2 : ast.endSourceSpan;
|
|
20157
20256
|
const sourceSpan = new ParseSourceSpan(ast.sourceSpan.start, (_b2 = endSpan == null ? void 0 : endSpan.end) != null ? _b2 : ast.sourceSpan.end);
|
|
20158
|
-
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);
|
|
20257
|
+
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);
|
|
20159
20258
|
}
|
|
20160
20259
|
}
|
|
20161
20260
|
return { node, errors };
|
|
@@ -20163,7 +20262,7 @@ function createForLoop(ast, connectedBlocks, visitor, bindingParser) {
|
|
|
20163
20262
|
function createSwitchBlock(ast, visitor, bindingParser) {
|
|
20164
20263
|
const errors = validateSwitchBlock(ast);
|
|
20165
20264
|
const primaryExpression = ast.parameters.length > 0 ? parseBlockParameterToBinding(ast.parameters[0], bindingParser) : bindingParser.parseBinding("", false, ast.sourceSpan, 0);
|
|
20166
|
-
const
|
|
20265
|
+
const cases2 = [];
|
|
20167
20266
|
const unknownBlocks = [];
|
|
20168
20267
|
let defaultCase = null;
|
|
20169
20268
|
for (const node of ast.children) {
|
|
@@ -20175,18 +20274,18 @@ function createSwitchBlock(ast, visitor, bindingParser) {
|
|
|
20175
20274
|
continue;
|
|
20176
20275
|
}
|
|
20177
20276
|
const expression = node.name === "case" ? parseBlockParameterToBinding(node.parameters[0], bindingParser) : null;
|
|
20178
|
-
const ast2 = new SwitchBlockCase(expression, visitAll2(visitor, node.children, node.children), node.sourceSpan, node.startSourceSpan, node.endSourceSpan, node.nameSpan);
|
|
20277
|
+
const ast2 = new SwitchBlockCase(expression, visitAll2(visitor, node.children, node.children), node.sourceSpan, node.startSourceSpan, node.endSourceSpan, node.nameSpan, node.i18n);
|
|
20179
20278
|
if (expression === null) {
|
|
20180
20279
|
defaultCase = ast2;
|
|
20181
20280
|
} else {
|
|
20182
|
-
|
|
20281
|
+
cases2.push(ast2);
|
|
20183
20282
|
}
|
|
20184
20283
|
}
|
|
20185
20284
|
if (defaultCase !== null) {
|
|
20186
|
-
|
|
20285
|
+
cases2.push(defaultCase);
|
|
20187
20286
|
}
|
|
20188
20287
|
return {
|
|
20189
|
-
node: new SwitchBlock(primaryExpression,
|
|
20288
|
+
node: new SwitchBlock(primaryExpression, cases2, unknownBlocks, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan, ast.nameSpan),
|
|
20190
20289
|
errors
|
|
20191
20290
|
};
|
|
20192
20291
|
}
|
|
@@ -20663,7 +20762,7 @@ function createDeferredBlock(ast, connectedBlocks, visitor, bindingParser) {
|
|
|
20663
20762
|
endOfLastSourceSpan = lastConnectedBlock.sourceSpan.end;
|
|
20664
20763
|
}
|
|
20665
20764
|
const sourceSpanWithConnectedBlocks = new ParseSourceSpan(ast.sourceSpan.start, endOfLastSourceSpan);
|
|
20666
|
-
const node = new DeferredBlock(visitAll2(visitor, ast.children, ast.children), triggers, prefetchTriggers, placeholder, loading, error2, ast.nameSpan, sourceSpanWithConnectedBlocks, ast.sourceSpan, ast.startSourceSpan, lastEndSourceSpan);
|
|
20765
|
+
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);
|
|
20667
20766
|
return { node, errors };
|
|
20668
20767
|
}
|
|
20669
20768
|
function parseConnectedBlocks(connectedBlocks, errors, visitor) {
|
|
@@ -20721,7 +20820,7 @@ function parsePlaceholderBlock(ast, visitor) {
|
|
|
20721
20820
|
throw new Error(`Unrecognized parameter in @placeholder block: "${param.expression}"`);
|
|
20722
20821
|
}
|
|
20723
20822
|
}
|
|
20724
|
-
return new DeferredBlockPlaceholder(visitAll2(visitor, ast.children, ast.children), minimumTime, ast.nameSpan, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan);
|
|
20823
|
+
return new DeferredBlockPlaceholder(visitAll2(visitor, ast.children, ast.children), minimumTime, ast.nameSpan, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan, ast.i18n);
|
|
20725
20824
|
}
|
|
20726
20825
|
function parseLoadingBlock(ast, visitor) {
|
|
20727
20826
|
let afterTime = null;
|
|
@@ -20749,13 +20848,13 @@ function parseLoadingBlock(ast, visitor) {
|
|
|
20749
20848
|
throw new Error(`Unrecognized parameter in @loading block: "${param.expression}"`);
|
|
20750
20849
|
}
|
|
20751
20850
|
}
|
|
20752
|
-
return new DeferredBlockLoading(visitAll2(visitor, ast.children, ast.children), afterTime, minimumTime, ast.nameSpan, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan);
|
|
20851
|
+
return new DeferredBlockLoading(visitAll2(visitor, ast.children, ast.children), afterTime, minimumTime, ast.nameSpan, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan, ast.i18n);
|
|
20753
20852
|
}
|
|
20754
20853
|
function parseErrorBlock(ast, visitor) {
|
|
20755
20854
|
if (ast.parameters.length > 0) {
|
|
20756
20855
|
throw new Error(`@error block cannot have parameters`);
|
|
20757
20856
|
}
|
|
20758
|
-
return new DeferredBlockError(visitAll2(visitor, ast.children, ast.children), ast.nameSpan, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan);
|
|
20857
|
+
return new DeferredBlockError(visitAll2(visitor, ast.children, ast.children), ast.nameSpan, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan, ast.i18n);
|
|
20759
20858
|
}
|
|
20760
20859
|
function parsePrimaryTriggers(params, bindingParser, errors, placeholder) {
|
|
20761
20860
|
const triggers = {};
|
|
@@ -21239,6 +21338,11 @@ var I18nContext = class {
|
|
|
21239
21338
|
const content = { type, index, ctx: this.id, isVoid: node.isVoid, closed };
|
|
21240
21339
|
updatePlaceholderMap(this.placeholders, ph, content);
|
|
21241
21340
|
}
|
|
21341
|
+
appendBlockPart(node, index, closed) {
|
|
21342
|
+
const ph = closed ? node.closeName : node.startName;
|
|
21343
|
+
const content = { type: TagType.TEMPLATE, index, ctx: this.id, closed };
|
|
21344
|
+
updatePlaceholderMap(this.placeholders, ph, content);
|
|
21345
|
+
}
|
|
21242
21346
|
get icus() {
|
|
21243
21347
|
return this._registry.icus;
|
|
21244
21348
|
}
|
|
@@ -21268,6 +21372,11 @@ var I18nContext = class {
|
|
|
21268
21372
|
this.appendTag(TagType.TEMPLATE, node, index, true);
|
|
21269
21373
|
this._unresolvedCtxCount++;
|
|
21270
21374
|
}
|
|
21375
|
+
appendBlock(node, index) {
|
|
21376
|
+
this.appendBlockPart(node, index, false);
|
|
21377
|
+
this.appendBlockPart(node, index, true);
|
|
21378
|
+
this._unresolvedCtxCount++;
|
|
21379
|
+
}
|
|
21271
21380
|
appendElement(node, index, closed) {
|
|
21272
21381
|
this.appendTag(TagType.ELEMENT, node, index, closed);
|
|
21273
21382
|
}
|
|
@@ -21463,12 +21572,18 @@ var TemplateDefinitionBuilder = class {
|
|
|
21463
21572
|
this.creationInstruction(null, Identifiers.pipe, [literal(slot), literal(name)]);
|
|
21464
21573
|
});
|
|
21465
21574
|
}
|
|
21466
|
-
buildTemplateFunction(nodes, variables, ngContentSelectorsOffset = 0, i18n2) {
|
|
21575
|
+
buildTemplateFunction(nodes, variables, ngContentSelectorsOffset = 0, i18n2, variableAliases) {
|
|
21467
21576
|
this._ngContentSelectorsOffset = ngContentSelectorsOffset;
|
|
21468
21577
|
if (this._namespace !== Identifiers.namespaceHTML) {
|
|
21469
21578
|
this.creationInstruction(null, this._namespace);
|
|
21470
21579
|
}
|
|
21471
|
-
variables.forEach((v) =>
|
|
21580
|
+
variables.forEach((v) => {
|
|
21581
|
+
const alias = variableAliases == null ? void 0 : variableAliases[v.name];
|
|
21582
|
+
this.registerContextVariables(v.name, v.value);
|
|
21583
|
+
if (alias) {
|
|
21584
|
+
this.registerContextVariables(alias, v.value);
|
|
21585
|
+
}
|
|
21586
|
+
});
|
|
21472
21587
|
const initI18nContext = this.i18nContext || isI18nRootNode(i18n2) && !isSingleI18nIcu(i18n2) && !(isSingleElementTemplate(nodes) && nodes[0].i18n === i18n2);
|
|
21473
21588
|
const selfClosingI18nInstruction = hasTextChildrenOnly(nodes);
|
|
21474
21589
|
if (initI18nContext) {
|
|
@@ -21523,12 +21638,12 @@ var TemplateDefinitionBuilder = class {
|
|
|
21523
21638
|
this._constants.prepareStatements.push(...statements);
|
|
21524
21639
|
return _ref;
|
|
21525
21640
|
}
|
|
21526
|
-
registerContextVariables(
|
|
21641
|
+
registerContextVariables(name, value) {
|
|
21527
21642
|
const scopedName = this._bindingScope.freshReferenceName();
|
|
21528
21643
|
const retrievalLevel = this.level;
|
|
21529
|
-
const isDirect =
|
|
21530
|
-
const lhs = variable(
|
|
21531
|
-
this._bindingScope.set(retrievalLevel,
|
|
21644
|
+
const isDirect = value === DIRECT_CONTEXT_REFERENCE;
|
|
21645
|
+
const lhs = variable(name + scopedName);
|
|
21646
|
+
this._bindingScope.set(retrievalLevel, name, (scope) => {
|
|
21532
21647
|
return isDirect && scope.bindingLevel === retrievalLevel && !scope.isListenerScope() ? variable(CONTEXT_NAME) : lhs;
|
|
21533
21648
|
}, 1, (scope, relativeLevel) => {
|
|
21534
21649
|
let rhs;
|
|
@@ -21546,7 +21661,7 @@ var TemplateDefinitionBuilder = class {
|
|
|
21546
21661
|
rhs = sharedCtxVar ? sharedCtxVar : generateNextContextExpr(relativeLevel);
|
|
21547
21662
|
}
|
|
21548
21663
|
return [
|
|
21549
|
-
lhs.set(isDirect ? rhs : rhs.prop(
|
|
21664
|
+
lhs.set(isDirect ? rhs : rhs.prop(value || IMPLICIT_REFERENCE)).toConstDecl()
|
|
21550
21665
|
];
|
|
21551
21666
|
});
|
|
21552
21667
|
}
|
|
@@ -21885,16 +22000,20 @@ var TemplateDefinitionBuilder = class {
|
|
|
21885
22000
|
this.creationInstruction(span, isNgContainer2 ? Identifiers.elementContainerEnd : Identifiers.elementEnd);
|
|
21886
22001
|
}
|
|
21887
22002
|
}
|
|
21888
|
-
prepareEmbeddedTemplateFn(children, contextNameSuffix, variables = [],
|
|
22003
|
+
prepareEmbeddedTemplateFn(children, contextNameSuffix, variables = [], i18nMeta, variableAliases) {
|
|
21889
22004
|
const index = this.allocateDataSlot();
|
|
21890
|
-
if (this.i18n &&
|
|
21891
|
-
|
|
22005
|
+
if (this.i18n && i18nMeta) {
|
|
22006
|
+
if (i18nMeta instanceof BlockPlaceholder) {
|
|
22007
|
+
this.i18n.appendBlock(i18nMeta, index);
|
|
22008
|
+
} else {
|
|
22009
|
+
this.i18n.appendTemplate(i18nMeta, index);
|
|
22010
|
+
}
|
|
21892
22011
|
}
|
|
21893
22012
|
const contextName = `${this.contextName}${contextNameSuffix}_${index}`;
|
|
21894
22013
|
const name = `${contextName}_Template`;
|
|
21895
22014
|
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);
|
|
21896
22015
|
this._nestedTemplateFns.push(() => {
|
|
21897
|
-
const templateFunctionExpr = visitor.buildTemplateFunction(children, variables, this._ngContentReservedSlots.length + this._ngContentSelectorsOffset,
|
|
22016
|
+
const templateFunctionExpr = visitor.buildTemplateFunction(children, variables, this._ngContentReservedSlots.length + this._ngContentSelectorsOffset, i18nMeta, variableAliases);
|
|
21898
22017
|
this.constantPool.statements.push(templateFunctionExpr.toDeclStmt(name));
|
|
21899
22018
|
if (visitor._ngContentReservedSlots.length) {
|
|
21900
22019
|
this._ngContentReservedSlots.push(...visitor._ngContentReservedSlots);
|
|
@@ -22004,7 +22123,7 @@ var TemplateDefinitionBuilder = class {
|
|
|
22004
22123
|
tagName = inferredData.tagName;
|
|
22005
22124
|
attrsExprs = inferredData.attrsExprs;
|
|
22006
22125
|
}
|
|
22007
|
-
const templateIndex = this.createEmbeddedTemplateFn(tagName, children, "_Conditional", sourceSpan, variables, attrsExprs);
|
|
22126
|
+
const templateIndex = this.createEmbeddedTemplateFn(tagName, children, "_Conditional", sourceSpan, variables, attrsExprs, void 0, branch.i18n);
|
|
22008
22127
|
const processedExpression = expression === null ? null : expression.visit(this._valueConverter);
|
|
22009
22128
|
return { index: templateIndex, expression: processedExpression, alias: expressionAlias };
|
|
22010
22129
|
});
|
|
@@ -22038,7 +22157,7 @@ var TemplateDefinitionBuilder = class {
|
|
|
22038
22157
|
}
|
|
22039
22158
|
visitSwitchBlock(block) {
|
|
22040
22159
|
const caseData = block.cases.map((currentCase) => {
|
|
22041
|
-
const index = this.createEmbeddedTemplateFn(null, currentCase.children, "_Case", currentCase.sourceSpan);
|
|
22160
|
+
const index = this.createEmbeddedTemplateFn(null, currentCase.children, "_Case", currentCase.sourceSpan, void 0, void 0, void 0, currentCase.i18n);
|
|
22042
22161
|
const expression = currentCase.expression === null ? null : currentCase.expression.visit(this._valueConverter);
|
|
22043
22162
|
return { index, expression };
|
|
22044
22163
|
});
|
|
@@ -22066,12 +22185,12 @@ var TemplateDefinitionBuilder = class {
|
|
|
22066
22185
|
if (!metadata) {
|
|
22067
22186
|
throw new Error("Could not resolve `defer` block metadata. Block may need to be analyzed.");
|
|
22068
22187
|
}
|
|
22069
|
-
const primaryTemplateIndex = this.createEmbeddedTemplateFn(null, deferred.children, "_Defer", deferred.sourceSpan);
|
|
22070
|
-
const loadingIndex = loading ? this.createEmbeddedTemplateFn(null, loading.children, "_DeferLoading", loading.sourceSpan) : null;
|
|
22188
|
+
const primaryTemplateIndex = this.createEmbeddedTemplateFn(null, deferred.children, "_Defer", deferred.sourceSpan, void 0, void 0, void 0, deferred.i18n);
|
|
22189
|
+
const loadingIndex = loading ? this.createEmbeddedTemplateFn(null, loading.children, "_DeferLoading", loading.sourceSpan, void 0, void 0, void 0, loading.i18n) : null;
|
|
22071
22190
|
const loadingConsts = loading ? trimTrailingNulls([literal(loading.minimumTime), literal(loading.afterTime)]) : null;
|
|
22072
|
-
const placeholderIndex = placeholder ? this.createEmbeddedTemplateFn(null, placeholder.children, "_DeferPlaceholder", placeholder.sourceSpan) : null;
|
|
22191
|
+
const placeholderIndex = placeholder ? this.createEmbeddedTemplateFn(null, placeholder.children, "_DeferPlaceholder", placeholder.sourceSpan, void 0, void 0, void 0, placeholder.i18n) : null;
|
|
22073
22192
|
const placeholderConsts = placeholder && placeholder.minimumTime !== null ? literalArr([literal(placeholder.minimumTime)]) : null;
|
|
22074
|
-
const errorIndex = error2 ? this.createEmbeddedTemplateFn(null, error2.children, "_DeferError", error2.sourceSpan) : null;
|
|
22193
|
+
const errorIndex = error2 ? this.createEmbeddedTemplateFn(null, error2.children, "_DeferError", error2.sourceSpan, void 0, void 0, void 0, error2.i18n) : null;
|
|
22075
22194
|
const deferredIndex = this.allocateDataSlot();
|
|
22076
22195
|
const depsFnName = `${this.contextName}_Defer_${deferredIndex}_DepsFn`;
|
|
22077
22196
|
this.creationInstruction(deferred.sourceSpan, Identifiers.defer, trimTrailingNulls([
|
|
@@ -22180,11 +22299,14 @@ var TemplateDefinitionBuilder = class {
|
|
|
22180
22299
|
visitForLoopBlock(block) {
|
|
22181
22300
|
const blockIndex = this.allocateDataSlot();
|
|
22182
22301
|
const { tagName, attrsExprs } = this.inferProjectionDataFromInsertionPoint(block);
|
|
22183
|
-
const primaryData = this.prepareEmbeddedTemplateFn(block.children, "_For", [block.item, block.contextVariables.$index, block.contextVariables.$count]
|
|
22302
|
+
const primaryData = this.prepareEmbeddedTemplateFn(block.children, "_For", [block.item, block.contextVariables.$index, block.contextVariables.$count], block.i18n, {
|
|
22303
|
+
[block.contextVariables.$index.name]: this.getLevelSpecificVariableName("$index", this.level + 1),
|
|
22304
|
+
[block.contextVariables.$count.name]: this.getLevelSpecificVariableName("$count", this.level + 1)
|
|
22305
|
+
});
|
|
22184
22306
|
const { expression: trackByExpression, usesComponentInstance: trackByUsesComponentInstance } = this.createTrackByFunction(block);
|
|
22185
22307
|
let emptyData = null;
|
|
22186
22308
|
if (block.empty !== null) {
|
|
22187
|
-
emptyData = this.prepareEmbeddedTemplateFn(block.empty.children, "_ForEmpty");
|
|
22309
|
+
emptyData = this.prepareEmbeddedTemplateFn(block.empty.children, "_ForEmpty", void 0, block.empty.i18n);
|
|
22188
22310
|
this.allocateBindingSlots(null);
|
|
22189
22311
|
}
|
|
22190
22312
|
this.registerComputedLoopVariables(block, primaryData.scope);
|
|
@@ -22206,16 +22328,31 @@ var TemplateDefinitionBuilder = class {
|
|
|
22206
22328
|
return params;
|
|
22207
22329
|
});
|
|
22208
22330
|
const value = block.expression.visit(this._valueConverter);
|
|
22209
|
-
this.
|
|
22331
|
+
this.updateInstructionWithAdvance(blockIndex, block.sourceSpan, Identifiers.repeater, () => [this.convertPropertyBinding(value)]);
|
|
22210
22332
|
}
|
|
22211
22333
|
registerComputedLoopVariables(block, bindingScope) {
|
|
22212
|
-
const indexLocalName = block.contextVariables.$index.name;
|
|
22213
|
-
const countLocalName = block.contextVariables.$count.name;
|
|
22214
22334
|
const level = bindingScope.bindingLevel;
|
|
22215
|
-
bindingScope.set(level, block.contextVariables.$odd.name, (scope) =>
|
|
22216
|
-
|
|
22217
|
-
|
|
22218
|
-
bindingScope.set(level, block.contextVariables.$
|
|
22335
|
+
bindingScope.set(level, block.contextVariables.$odd.name, (scope, retrievalLevel) => {
|
|
22336
|
+
return this.getLevelSpecificForLoopVariable(block, scope, retrievalLevel, "$index").modulo(literal(2)).notIdentical(literal(0));
|
|
22337
|
+
});
|
|
22338
|
+
bindingScope.set(level, block.contextVariables.$even.name, (scope, retrievalLevel) => {
|
|
22339
|
+
return this.getLevelSpecificForLoopVariable(block, scope, retrievalLevel, "$index").modulo(literal(2)).identical(literal(0));
|
|
22340
|
+
});
|
|
22341
|
+
bindingScope.set(level, block.contextVariables.$first.name, (scope, retrievalLevel) => {
|
|
22342
|
+
return this.getLevelSpecificForLoopVariable(block, scope, retrievalLevel, "$index").identical(literal(0));
|
|
22343
|
+
});
|
|
22344
|
+
bindingScope.set(level, block.contextVariables.$last.name, (scope, retrievalLevel) => {
|
|
22345
|
+
const index = this.getLevelSpecificForLoopVariable(block, scope, retrievalLevel, "$index");
|
|
22346
|
+
const count = this.getLevelSpecificForLoopVariable(block, scope, retrievalLevel, "$count");
|
|
22347
|
+
return index.identical(count.minus(literal(1)));
|
|
22348
|
+
});
|
|
22349
|
+
}
|
|
22350
|
+
getLevelSpecificVariableName(name, level) {
|
|
22351
|
+
return `\u0275${name}_${level}`;
|
|
22352
|
+
}
|
|
22353
|
+
getLevelSpecificForLoopVariable(block, scope, retrievalLevel, name) {
|
|
22354
|
+
const scopeName = scope.bindingLevel === retrievalLevel ? block.contextVariables[name].name : this.getLevelSpecificVariableName(name, retrievalLevel);
|
|
22355
|
+
return scope.get(scopeName);
|
|
22219
22356
|
}
|
|
22220
22357
|
optimizeTrackByFunction(block) {
|
|
22221
22358
|
const indexLocalName = block.contextVariables.$index.name;
|
|
@@ -22625,7 +22762,7 @@ var BindingScope = class {
|
|
|
22625
22762
|
if (value.declareLocalCallback && !value.declare) {
|
|
22626
22763
|
value.declare = true;
|
|
22627
22764
|
}
|
|
22628
|
-
return typeof value.lhs === "function" ? value.lhs(this) : value.lhs;
|
|
22765
|
+
return typeof value.lhs === "function" ? value.lhs(this, value.retrievalLevel) : value.lhs;
|
|
22629
22766
|
}
|
|
22630
22767
|
current = current.parent;
|
|
22631
22768
|
}
|
|
@@ -22701,7 +22838,7 @@ var BindingScope = class {
|
|
|
22701
22838
|
const componentValue = this.map.get(SHARED_CONTEXT_KEY + 0);
|
|
22702
22839
|
componentValue.declare = true;
|
|
22703
22840
|
this.maybeRestoreView();
|
|
22704
|
-
const lhs = typeof componentValue.lhs === "function" ? componentValue.lhs(this) : componentValue.lhs;
|
|
22841
|
+
const lhs = typeof componentValue.lhs === "function" ? componentValue.lhs(this, componentValue.retrievalLevel) : componentValue.lhs;
|
|
22705
22842
|
return name === DIRECT_CONTEXT_REFERENCE ? lhs : lhs.prop(name);
|
|
22706
22843
|
}
|
|
22707
22844
|
maybeRestoreView() {
|
|
@@ -24770,7 +24907,7 @@ function publishFacade(global) {
|
|
|
24770
24907
|
}
|
|
24771
24908
|
|
|
24772
24909
|
// bazel-out/k8-fastbuild/bin/packages/compiler/src/version.mjs
|
|
24773
|
-
var VERSION2 = new Version("17.0.
|
|
24910
|
+
var VERSION2 = new Version("17.0.4");
|
|
24774
24911
|
|
|
24775
24912
|
// bazel-out/k8-fastbuild/bin/packages/compiler/src/i18n/extractor_merger.mjs
|
|
24776
24913
|
var _VisitorMode;
|
|
@@ -25060,13 +25197,19 @@ function analyze(sourceFile, analyzedFiles) {
|
|
|
25060
25197
|
}
|
|
25061
25198
|
});
|
|
25062
25199
|
}
|
|
25200
|
+
function checkIfShouldChange(decl, removeCommonModule) {
|
|
25201
|
+
const clause = decl.getChildAt(1);
|
|
25202
|
+
return !(!removeCommonModule && clause.namedBindings && import_typescript5.default.isNamedImports(clause.namedBindings) && clause.namedBindings.elements.length === 1 && clause.namedBindings.elements[0].getText() === "CommonModule");
|
|
25203
|
+
}
|
|
25063
25204
|
function updateImportDeclaration(decl, removeCommonModule) {
|
|
25064
25205
|
const clause = decl.getChildAt(1);
|
|
25065
25206
|
const updatedClause = updateImportClause(clause, removeCommonModule);
|
|
25066
25207
|
if (updatedClause === null) {
|
|
25067
25208
|
return "";
|
|
25068
25209
|
}
|
|
25069
|
-
const printer = import_typescript5.default.createPrinter(
|
|
25210
|
+
const printer = import_typescript5.default.createPrinter({
|
|
25211
|
+
removeComments: true
|
|
25212
|
+
});
|
|
25070
25213
|
const updated = import_typescript5.default.factory.updateImportDeclaration(decl, decl.modifiers, updatedClause, decl.moduleSpecifier, void 0);
|
|
25071
25214
|
return printer.printNode(import_typescript5.default.EmitHint.Unspecified, updated, clause.getSourceFile());
|
|
25072
25215
|
}
|
|
@@ -25254,19 +25397,22 @@ function canRemoveCommonModule(template2) {
|
|
|
25254
25397
|
function removeImports(template2, node, removeCommonModule) {
|
|
25255
25398
|
if (template2.startsWith("imports") && import_typescript5.default.isPropertyAssignment(node)) {
|
|
25256
25399
|
return updateClassImports(node, removeCommonModule);
|
|
25257
|
-
} else if (import_typescript5.default.isImportDeclaration(node)) {
|
|
25400
|
+
} else if (import_typescript5.default.isImportDeclaration(node) && checkIfShouldChange(node, removeCommonModule)) {
|
|
25258
25401
|
return updateImportDeclaration(node, removeCommonModule);
|
|
25259
25402
|
}
|
|
25260
25403
|
return template2;
|
|
25261
25404
|
}
|
|
25262
25405
|
function getOriginals(etm, tmpl, offset) {
|
|
25263
25406
|
if (etm.el.children.length > 0) {
|
|
25407
|
+
const childStart = etm.el.children[0].sourceSpan.start.offset - offset;
|
|
25408
|
+
const childEnd = etm.el.children[etm.el.children.length - 1].sourceSpan.end.offset - offset;
|
|
25264
25409
|
const start2 = tmpl.slice(etm.el.sourceSpan.start.offset - offset, etm.el.children[0].sourceSpan.start.offset - offset);
|
|
25265
25410
|
const end = tmpl.slice(etm.el.children[etm.el.children.length - 1].sourceSpan.end.offset - offset, etm.el.sourceSpan.end.offset - offset);
|
|
25266
|
-
|
|
25411
|
+
const childLength = childEnd - childStart;
|
|
25412
|
+
return { start: start2, end, childLength };
|
|
25267
25413
|
}
|
|
25268
25414
|
const start = tmpl.slice(etm.el.sourceSpan.start.offset - offset, etm.el.sourceSpan.end.offset - offset);
|
|
25269
|
-
return { start, end: "" };
|
|
25415
|
+
return { start, end: "", childLength: 0 };
|
|
25270
25416
|
}
|
|
25271
25417
|
function isI18nTemplate(etm, i18nAttr) {
|
|
25272
25418
|
return etm.el.name === "ng-template" && i18nAttr !== void 0 && (etm.el.attrs.length === 2 || etm.el.attrs.length === 3 && etm.elseAttr !== void 0);
|
|
@@ -25301,6 +25447,36 @@ function getMainBlock(etm, tmpl, offset) {
|
|
|
25301
25447
|
const end = tmpl.slice(childEnd, etm.end(offset));
|
|
25302
25448
|
return { start, middle, end };
|
|
25303
25449
|
}
|
|
25450
|
+
function formatTemplate(tmpl) {
|
|
25451
|
+
if (tmpl.indexOf("\n") > -1) {
|
|
25452
|
+
const openBlockRegex = /^\s*\@(if|switch|case|default|for)|^\s*\}\s\@else/;
|
|
25453
|
+
const openElRegex = /^\s*<([a-z0-9]+)(?![^>]*\/>)[^>]*>?/;
|
|
25454
|
+
const closeBlockRegex = /^\s*\}\s*$|^\s*\}\s\@else/;
|
|
25455
|
+
const closeElRegex = /\s*<\/([a-z0-9\-]+)*>/;
|
|
25456
|
+
const closeMultiLineElRegex = /^\s*([a-z0-9\-\[\]]+)?=?"?([^”<]+)?"?\s?\/>$/;
|
|
25457
|
+
const singleLineElRegex = /^\s*<([a-z0-9]+)(?![^>]*\/>)[^>]*>.*<\/([a-z0-9\-]+)*>/;
|
|
25458
|
+
const lines = tmpl.split("\n");
|
|
25459
|
+
const formatted = [];
|
|
25460
|
+
let indent = "";
|
|
25461
|
+
for (let [index, line] of lines.entries()) {
|
|
25462
|
+
if (line.trim() === "" && index !== 0 && index !== lines.length - 1) {
|
|
25463
|
+
continue;
|
|
25464
|
+
}
|
|
25465
|
+
if ((closeBlockRegex.test(line) || closeElRegex.test(line) && (!singleLineElRegex.test(line) && !closeMultiLineElRegex.test(line))) && indent !== "") {
|
|
25466
|
+
indent = indent.slice(2);
|
|
25467
|
+
}
|
|
25468
|
+
formatted.push(indent + line.trim());
|
|
25469
|
+
if (closeMultiLineElRegex.test(line)) {
|
|
25470
|
+
indent = indent.slice(2);
|
|
25471
|
+
}
|
|
25472
|
+
if ((openBlockRegex.test(line) || openElRegex.test(line)) && !singleLineElRegex.test(line)) {
|
|
25473
|
+
indent += " ";
|
|
25474
|
+
}
|
|
25475
|
+
}
|
|
25476
|
+
tmpl = formatted.join("\n");
|
|
25477
|
+
}
|
|
25478
|
+
return tmpl;
|
|
25479
|
+
}
|
|
25304
25480
|
function forEachClass(sourceFile, callback) {
|
|
25305
25481
|
sourceFile.forEachChild(function walk(node) {
|
|
25306
25482
|
if (import_typescript5.default.isClassDeclaration(node) || import_typescript5.default.isImportDeclaration(node)) {
|
|
@@ -25310,6 +25486,84 @@ function forEachClass(sourceFile, callback) {
|
|
|
25310
25486
|
});
|
|
25311
25487
|
}
|
|
25312
25488
|
|
|
25489
|
+
// bazel-out/k8-fastbuild/bin/packages/core/schematics/ng-generate/control-flow-migration/cases.mjs
|
|
25490
|
+
var boundcase = "[ngSwitchCase]";
|
|
25491
|
+
var switchcase = "*ngSwitchCase";
|
|
25492
|
+
var nakedcase = "ngSwitchCase";
|
|
25493
|
+
var switchdefault = "*ngSwitchDefault";
|
|
25494
|
+
var nakeddefault = "ngSwitchDefault";
|
|
25495
|
+
var cases = [
|
|
25496
|
+
boundcase,
|
|
25497
|
+
switchcase,
|
|
25498
|
+
nakedcase,
|
|
25499
|
+
switchdefault,
|
|
25500
|
+
nakeddefault
|
|
25501
|
+
];
|
|
25502
|
+
function migrateCase(template2) {
|
|
25503
|
+
let errors = [];
|
|
25504
|
+
let parsed = parseTemplate2(template2);
|
|
25505
|
+
if (parsed === null) {
|
|
25506
|
+
return { migrated: template2, errors, changed: false };
|
|
25507
|
+
}
|
|
25508
|
+
let result = template2;
|
|
25509
|
+
const visitor = new ElementCollector(cases);
|
|
25510
|
+
visitAll2(visitor, parsed.rootNodes);
|
|
25511
|
+
calculateNesting(visitor, hasLineBreaks(template2));
|
|
25512
|
+
let offset = 0;
|
|
25513
|
+
let nestLevel = -1;
|
|
25514
|
+
let postOffsets = [];
|
|
25515
|
+
for (const el of visitor.elements) {
|
|
25516
|
+
let migrateResult = { tmpl: result, offsets: { pre: 0, post: 0 } };
|
|
25517
|
+
offset = reduceNestingOffset(el, nestLevel, offset, postOffsets);
|
|
25518
|
+
if (el.attr.name === switchcase || el.attr.name === nakedcase || el.attr.name === boundcase) {
|
|
25519
|
+
try {
|
|
25520
|
+
migrateResult = migrateNgSwitchCase(el, result, offset);
|
|
25521
|
+
} catch (error2) {
|
|
25522
|
+
errors.push({ type: switchcase, error: error2 });
|
|
25523
|
+
}
|
|
25524
|
+
} else if (el.attr.name === switchdefault || el.attr.name === nakeddefault) {
|
|
25525
|
+
try {
|
|
25526
|
+
migrateResult = migrateNgSwitchDefault(el, result, offset);
|
|
25527
|
+
} catch (error2) {
|
|
25528
|
+
errors.push({ type: switchdefault, error: error2 });
|
|
25529
|
+
}
|
|
25530
|
+
}
|
|
25531
|
+
result = migrateResult.tmpl;
|
|
25532
|
+
offset += migrateResult.offsets.pre;
|
|
25533
|
+
postOffsets.push(migrateResult.offsets.post);
|
|
25534
|
+
nestLevel = el.nestCount;
|
|
25535
|
+
}
|
|
25536
|
+
const changed = visitor.elements.length > 0;
|
|
25537
|
+
return { migrated: result, errors, changed };
|
|
25538
|
+
}
|
|
25539
|
+
function migrateNgSwitchCase(etm, tmpl, offset) {
|
|
25540
|
+
const lbString = etm.hasLineBreaks ? "\n" : "";
|
|
25541
|
+
const leadingSpace = etm.hasLineBreaks ? "" : " ";
|
|
25542
|
+
const condition = etm.attr.value;
|
|
25543
|
+
const originals = getOriginals(etm, tmpl, offset);
|
|
25544
|
+
const { start, middle, end } = getMainBlock(etm, tmpl, offset);
|
|
25545
|
+
const startBlock = `${leadingSpace}@case (${condition}) {${leadingSpace}${lbString}${start}`;
|
|
25546
|
+
const endBlock = `${end}${lbString}${leadingSpace}}`;
|
|
25547
|
+
const defaultBlock = startBlock + middle + endBlock;
|
|
25548
|
+
const updatedTmpl = tmpl.slice(0, etm.start(offset)) + defaultBlock + tmpl.slice(etm.end(offset));
|
|
25549
|
+
const pre = originals.start.length - startBlock.length;
|
|
25550
|
+
const post = originals.end.length - endBlock.length;
|
|
25551
|
+
return { tmpl: updatedTmpl, offsets: { pre, post } };
|
|
25552
|
+
}
|
|
25553
|
+
function migrateNgSwitchDefault(etm, tmpl, offset) {
|
|
25554
|
+
const lbString = etm.hasLineBreaks ? "\n" : "";
|
|
25555
|
+
const leadingSpace = etm.hasLineBreaks ? "" : " ";
|
|
25556
|
+
const originals = getOriginals(etm, tmpl, offset);
|
|
25557
|
+
const { start, middle, end } = getMainBlock(etm, tmpl, offset);
|
|
25558
|
+
const startBlock = `${leadingSpace}@default {${leadingSpace}${lbString}${start}`;
|
|
25559
|
+
const endBlock = `${end}${lbString}${leadingSpace}}`;
|
|
25560
|
+
const defaultBlock = startBlock + middle + endBlock;
|
|
25561
|
+
const updatedTmpl = tmpl.slice(0, etm.start(offset)) + defaultBlock + tmpl.slice(etm.end(offset));
|
|
25562
|
+
const pre = originals.start.length - startBlock.length;
|
|
25563
|
+
const post = originals.end.length - endBlock.length;
|
|
25564
|
+
return { tmpl: updatedTmpl, offsets: { pre, post } };
|
|
25565
|
+
}
|
|
25566
|
+
|
|
25313
25567
|
// bazel-out/k8-fastbuild/bin/packages/core/schematics/ng-generate/control-flow-migration/fors.mjs
|
|
25314
25568
|
var ngfor = "*ngFor";
|
|
25315
25569
|
var nakedngfor2 = "ngFor";
|
|
@@ -25330,7 +25584,7 @@ function migrateFor(template2) {
|
|
|
25330
25584
|
let errors = [];
|
|
25331
25585
|
let parsed = parseTemplate2(template2);
|
|
25332
25586
|
if (parsed === null) {
|
|
25333
|
-
return { migrated: template2, errors };
|
|
25587
|
+
return { migrated: template2, errors, changed: false };
|
|
25334
25588
|
}
|
|
25335
25589
|
let result = template2;
|
|
25336
25590
|
const visitor = new ElementCollector(fors);
|
|
@@ -25352,7 +25606,8 @@ function migrateFor(template2) {
|
|
|
25352
25606
|
postOffsets.push(migrateResult.offsets.post);
|
|
25353
25607
|
nestLevel = el.nestCount;
|
|
25354
25608
|
}
|
|
25355
|
-
|
|
25609
|
+
const changed = visitor.elements.length > 0;
|
|
25610
|
+
return { migrated: result, errors, changed };
|
|
25356
25611
|
}
|
|
25357
25612
|
function migrateNgFor(etm, tmpl, offset) {
|
|
25358
25613
|
if (etm.forAttrs !== void 0) {
|
|
@@ -25365,8 +25620,6 @@ function migrateStandardNgFor(etm, tmpl, offset) {
|
|
|
25365
25620
|
const aliasWithAsRegexp = /(count|index|first|last|even|odd)\s+as/gm;
|
|
25366
25621
|
const aliases = [];
|
|
25367
25622
|
const lbString = etm.hasLineBreaks ? "\n" : "";
|
|
25368
|
-
const lbSpaces = etm.hasLineBreaks ? `
|
|
25369
|
-
` : "";
|
|
25370
25623
|
const parts = getNgForParts(etm.attr.value);
|
|
25371
25624
|
const originals = getOriginals(etm, tmpl, offset);
|
|
25372
25625
|
const condition = parts[0].replace("let ", "");
|
|
@@ -25399,7 +25652,7 @@ function migrateStandardNgFor(etm, tmpl, offset) {
|
|
|
25399
25652
|
}
|
|
25400
25653
|
const aliasStr = aliases.length > 0 ? `;${aliases.join(";")}` : "";
|
|
25401
25654
|
const { start, middle, end } = getMainBlock(etm, tmpl, offset);
|
|
25402
|
-
const startBlock = `@for (${condition}; track ${trackBy}${aliasStr}) {${
|
|
25655
|
+
const startBlock = `@for (${condition}; track ${trackBy}${aliasStr}) {${lbString}${start}`;
|
|
25403
25656
|
const endBlock = `${end}${lbString}}`;
|
|
25404
25657
|
const forBlock = startBlock + middle + endBlock;
|
|
25405
25658
|
const updatedTmpl = tmpl.slice(0, etm.start(offset)) + forBlock + tmpl.slice(etm.end(offset));
|
|
@@ -25427,7 +25680,7 @@ function migrateBoundNgFor(etm, tmpl, offset) {
|
|
|
25427
25680
|
}
|
|
25428
25681
|
const { start, middle, end } = getMainBlock(etm, tmpl, offset);
|
|
25429
25682
|
const startBlock = `@for (${condition}; track ${trackBy}${aliasStr}) {
|
|
25430
|
-
|
|
25683
|
+
${start}`;
|
|
25431
25684
|
const endBlock = `${end}
|
|
25432
25685
|
}`;
|
|
25433
25686
|
const forBlock = startBlock + middle + endBlock;
|
|
@@ -25481,7 +25734,7 @@ function migrateIf(template2) {
|
|
|
25481
25734
|
let errors = [];
|
|
25482
25735
|
let parsed = parseTemplate2(template2);
|
|
25483
25736
|
if (parsed === null) {
|
|
25484
|
-
return { migrated: template2, errors };
|
|
25737
|
+
return { migrated: template2, errors, changed: false };
|
|
25485
25738
|
}
|
|
25486
25739
|
let result = template2;
|
|
25487
25740
|
const visitor = new ElementCollector(ifs);
|
|
@@ -25503,7 +25756,8 @@ function migrateIf(template2) {
|
|
|
25503
25756
|
postOffsets.push(migrateResult.offsets.post);
|
|
25504
25757
|
nestLevel = el.nestCount;
|
|
25505
25758
|
}
|
|
25506
|
-
|
|
25759
|
+
const changed = visitor.elements.length > 0;
|
|
25760
|
+
return { migrated: result, errors, changed };
|
|
25507
25761
|
}
|
|
25508
25762
|
function migrateNgIf(etm, tmpl, offset) {
|
|
25509
25763
|
const matchThen = etm.attr.value.match(/;\s*then/gm);
|
|
@@ -25519,7 +25773,7 @@ function migrateNgIf(etm, tmpl, offset) {
|
|
|
25519
25773
|
}
|
|
25520
25774
|
function buildIfBlock(etm, tmpl, offset) {
|
|
25521
25775
|
const lbString = etm.hasLineBreaks ? "\n" : "";
|
|
25522
|
-
const condition = etm.attr.value.replace(" as ", "; as ");
|
|
25776
|
+
const condition = etm.attr.value.replace(" as ", "; as ").replace(/;\s*let/g, "; as");
|
|
25523
25777
|
const originals = getOriginals(etm, tmpl, offset);
|
|
25524
25778
|
const { start, middle, end } = getMainBlock(etm, tmpl, offset);
|
|
25525
25779
|
const startBlock = `@if (${condition}) {${lbString}${start}`;
|
|
@@ -25531,7 +25785,7 @@ function buildIfBlock(etm, tmpl, offset) {
|
|
|
25531
25785
|
return { tmpl: updatedTmpl, offsets: { pre, post } };
|
|
25532
25786
|
}
|
|
25533
25787
|
function buildStandardIfElseBlock(etm, tmpl, elseString, offset) {
|
|
25534
|
-
const condition = etm.getCondition(elseString).replace(" as ", "; as ");
|
|
25788
|
+
const condition = etm.getCondition(elseString).replace(" as ", "; as ").replace(/;\s*let/g, "; as");
|
|
25535
25789
|
const elsePlaceholder = `#${etm.getTemplateName(elseString)}|`;
|
|
25536
25790
|
return buildIfElseBlock(etm, tmpl, condition, elsePlaceholder, offset);
|
|
25537
25791
|
}
|
|
@@ -25560,7 +25814,7 @@ function buildIfElseBlock(etm, tmpl, condition, elsePlaceholder, offset) {
|
|
|
25560
25814
|
return { tmpl: updatedTmpl, offsets: { pre, post } };
|
|
25561
25815
|
}
|
|
25562
25816
|
function buildStandardIfThenElseBlock(etm, tmpl, thenString, elseString, offset) {
|
|
25563
|
-
const condition = etm.getCondition(thenString).replace(" as ", "; as ");
|
|
25817
|
+
const condition = etm.getCondition(thenString).replace(" as ", "; as ").replace(/;\s*let/g, "; as");
|
|
25564
25818
|
const thenPlaceholder = `#${etm.getTemplateName(thenString, elseString)}|`;
|
|
25565
25819
|
const elsePlaceholder = `#${etm.getTemplateName(elseString)}|`;
|
|
25566
25820
|
return buildIfThenElseBlock(etm, tmpl, condition, thenPlaceholder, elsePlaceholder, offset);
|
|
@@ -25575,31 +25829,21 @@ function buildIfThenElseBlock(etm, tmpl, condition, thenPlaceholder, elsePlaceho
|
|
|
25575
25829
|
const tmplStart = tmpl.slice(0, etm.start(offset));
|
|
25576
25830
|
const tmplEnd = tmpl.slice(etm.end(offset));
|
|
25577
25831
|
const updatedTmpl = tmplStart + ifThenElseBlock + tmplEnd;
|
|
25578
|
-
const pre = originals.start.length - startBlock.length;
|
|
25832
|
+
const pre = originals.start.length + originals.childLength - startBlock.length;
|
|
25579
25833
|
const post = originals.end.length - postBlock.length;
|
|
25580
25834
|
return { tmpl: updatedTmpl, offsets: { pre, post } };
|
|
25581
25835
|
}
|
|
25582
25836
|
|
|
25583
25837
|
// bazel-out/k8-fastbuild/bin/packages/core/schematics/ng-generate/control-flow-migration/switches.mjs
|
|
25584
25838
|
var ngswitch = "[ngSwitch]";
|
|
25585
|
-
var boundcase = "[ngSwitchCase]";
|
|
25586
|
-
var switchcase = "*ngSwitchCase";
|
|
25587
|
-
var nakedcase = "ngSwitchCase";
|
|
25588
|
-
var switchdefault = "*ngSwitchDefault";
|
|
25589
|
-
var nakeddefault = "ngSwitchDefault";
|
|
25590
25839
|
var switches = [
|
|
25591
|
-
ngswitch
|
|
25592
|
-
boundcase,
|
|
25593
|
-
switchcase,
|
|
25594
|
-
nakedcase,
|
|
25595
|
-
switchdefault,
|
|
25596
|
-
nakeddefault
|
|
25840
|
+
ngswitch
|
|
25597
25841
|
];
|
|
25598
25842
|
function migrateSwitch(template2) {
|
|
25599
25843
|
let errors = [];
|
|
25600
25844
|
let parsed = parseTemplate2(template2);
|
|
25601
25845
|
if (parsed === null) {
|
|
25602
|
-
return { migrated: template2, errors };
|
|
25846
|
+
return { migrated: template2, errors, changed: false };
|
|
25603
25847
|
}
|
|
25604
25848
|
let result = template2;
|
|
25605
25849
|
const visitor = new ElementCollector(switches);
|
|
@@ -25617,25 +25861,14 @@ function migrateSwitch(template2) {
|
|
|
25617
25861
|
} catch (error2) {
|
|
25618
25862
|
errors.push({ type: ngswitch, error: error2 });
|
|
25619
25863
|
}
|
|
25620
|
-
} else if (el.attr.name === switchcase || el.attr.name === nakedcase || el.attr.name === boundcase) {
|
|
25621
|
-
try {
|
|
25622
|
-
migrateResult = migrateNgSwitchCase(el, result, offset);
|
|
25623
|
-
} catch (error2) {
|
|
25624
|
-
errors.push({ type: ngswitch, error: error2 });
|
|
25625
|
-
}
|
|
25626
|
-
} else if (el.attr.name === switchdefault || el.attr.name === nakeddefault) {
|
|
25627
|
-
try {
|
|
25628
|
-
migrateResult = migrateNgSwitchDefault(el, result, offset);
|
|
25629
|
-
} catch (error2) {
|
|
25630
|
-
errors.push({ type: ngswitch, error: error2 });
|
|
25631
|
-
}
|
|
25632
25864
|
}
|
|
25633
25865
|
result = migrateResult.tmpl;
|
|
25634
25866
|
offset += migrateResult.offsets.pre;
|
|
25635
25867
|
postOffsets.push(migrateResult.offsets.post);
|
|
25636
25868
|
nestLevel = el.nestCount;
|
|
25637
25869
|
}
|
|
25638
|
-
|
|
25870
|
+
const changed = visitor.elements.length > 0;
|
|
25871
|
+
return { migrated: result, errors, changed };
|
|
25639
25872
|
}
|
|
25640
25873
|
function migrateNgSwitch(etm, tmpl, offset) {
|
|
25641
25874
|
const lbString = etm.hasLineBreaks ? "\n" : "";
|
|
@@ -25650,50 +25883,27 @@ function migrateNgSwitch(etm, tmpl, offset) {
|
|
|
25650
25883
|
const post = originals.end.length - endBlock.length;
|
|
25651
25884
|
return { tmpl: updatedTmpl, offsets: { pre, post } };
|
|
25652
25885
|
}
|
|
25653
|
-
function migrateNgSwitchCase(etm, tmpl, offset) {
|
|
25654
|
-
const lbString = etm.hasLineBreaks ? "\n" : "";
|
|
25655
|
-
const lbSpaces = etm.hasLineBreaks ? " " : "";
|
|
25656
|
-
const leadingSpace = etm.hasLineBreaks ? "" : " ";
|
|
25657
|
-
const condition = etm.attr.value;
|
|
25658
|
-
const originals = getOriginals(etm, tmpl, offset);
|
|
25659
|
-
const { start, middle, end } = getMainBlock(etm, tmpl, offset);
|
|
25660
|
-
const startBlock = `${leadingSpace}@case (${condition}) {${leadingSpace}${lbString}${lbSpaces}${start}`;
|
|
25661
|
-
const endBlock = `${end}${lbString}${leadingSpace}}`;
|
|
25662
|
-
const defaultBlock = startBlock + middle + endBlock;
|
|
25663
|
-
const updatedTmpl = tmpl.slice(0, etm.start(offset)) + defaultBlock + tmpl.slice(etm.end(offset));
|
|
25664
|
-
const pre = originals.start.length - startBlock.length;
|
|
25665
|
-
const post = originals.end.length - endBlock.length;
|
|
25666
|
-
return { tmpl: updatedTmpl, offsets: { pre, post } };
|
|
25667
|
-
}
|
|
25668
|
-
function migrateNgSwitchDefault(etm, tmpl, offset) {
|
|
25669
|
-
const lbString = etm.hasLineBreaks ? "\n" : "";
|
|
25670
|
-
const lbSpaces = etm.hasLineBreaks ? " " : "";
|
|
25671
|
-
const leadingSpace = etm.hasLineBreaks ? "" : " ";
|
|
25672
|
-
const originals = getOriginals(etm, tmpl, offset);
|
|
25673
|
-
const { start, middle, end } = getMainBlock(etm, tmpl, offset);
|
|
25674
|
-
const startBlock = `${leadingSpace}@default {${leadingSpace}${lbString}${lbSpaces}${start}`;
|
|
25675
|
-
const endBlock = `${end}${lbString}${leadingSpace}}`;
|
|
25676
|
-
const defaultBlock = startBlock + middle + endBlock;
|
|
25677
|
-
const updatedTmpl = tmpl.slice(0, etm.start(offset)) + defaultBlock + tmpl.slice(etm.end(offset));
|
|
25678
|
-
const pre = originals.start.length - startBlock.length;
|
|
25679
|
-
const post = originals.end.length - endBlock.length;
|
|
25680
|
-
return { tmpl: updatedTmpl, offsets: { pre, post } };
|
|
25681
|
-
}
|
|
25682
25886
|
|
|
25683
25887
|
// bazel-out/k8-fastbuild/bin/packages/core/schematics/ng-generate/control-flow-migration/migration.mjs
|
|
25684
|
-
function migrateTemplate(template2, templateType, node, file) {
|
|
25888
|
+
function migrateTemplate(template2, templateType, node, file, format = true) {
|
|
25685
25889
|
let errors = [];
|
|
25686
25890
|
let migrated = template2;
|
|
25687
25891
|
if (templateType === "template") {
|
|
25688
25892
|
const ifResult = migrateIf(template2);
|
|
25689
25893
|
const forResult = migrateFor(ifResult.migrated);
|
|
25690
25894
|
const switchResult = migrateSwitch(forResult.migrated);
|
|
25691
|
-
|
|
25895
|
+
const caseResult = migrateCase(switchResult.migrated);
|
|
25896
|
+
migrated = processNgTemplates(caseResult.migrated);
|
|
25897
|
+
const changed = ifResult.changed || forResult.changed || switchResult.changed || caseResult.changed;
|
|
25898
|
+
if (format && changed) {
|
|
25899
|
+
migrated = formatTemplate(migrated);
|
|
25900
|
+
}
|
|
25692
25901
|
file.removeCommonModule = canRemoveCommonModule(template2);
|
|
25693
25902
|
errors = [
|
|
25694
25903
|
...ifResult.errors,
|
|
25695
25904
|
...forResult.errors,
|
|
25696
|
-
...switchResult.errors
|
|
25905
|
+
...switchResult.errors,
|
|
25906
|
+
...caseResult.errors
|
|
25697
25907
|
];
|
|
25698
25908
|
} else {
|
|
25699
25909
|
migrated = removeImports(template2, node, file.removeCommonModule);
|
|
@@ -25750,7 +25960,7 @@ function runControlFlowMigration(tree, tsconfigPath, basePath, pathToMigrate, sc
|
|
|
25750
25960
|
for (const { start, end, node, type } of ranges) {
|
|
25751
25961
|
const template2 = content.slice(start, end);
|
|
25752
25962
|
const length = (end != null ? end : content.length) - start;
|
|
25753
|
-
const { migrated, errors } = migrateTemplate(template2, type, node, file);
|
|
25963
|
+
const { migrated, errors } = migrateTemplate(template2, type, node, file, schematicOptions.format);
|
|
25754
25964
|
if (migrated !== null) {
|
|
25755
25965
|
update.remove(start, length);
|
|
25756
25966
|
update.insertLeft(start, migrated);
|