@angular/core 17.0.5 → 17.0.7
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/primitives/signals/src/signal.mjs +2 -9
- package/esm2022/src/application/application_config.mjs +21 -0
- package/esm2022/src/application/application_init.mjs +188 -0
- package/esm2022/src/application/application_module.mjs +29 -0
- package/esm2022/src/application/application_ref.mjs +509 -0
- package/esm2022/src/application/application_tokens.mjs +121 -0
- package/esm2022/src/application/create_application.mjs +102 -0
- package/esm2022/src/change_detection/scheduling.mjs +103 -0
- package/esm2022/src/core.mjs +10 -7
- package/esm2022/src/core_private_export.mjs +5 -3
- package/esm2022/src/core_reactivity_export_internal.mjs +2 -2
- package/esm2022/src/core_render3_private_export.mjs +2 -2
- package/esm2022/src/error_handler.mjs +15 -1
- package/esm2022/src/hydration/annotate.mjs +30 -20
- package/esm2022/src/hydration/api.mjs +2 -2
- package/esm2022/src/hydration/cleanup.mjs +1 -1
- package/esm2022/src/hydration/interfaces.mjs +1 -1
- package/esm2022/src/hydration/node_lookup_utils.mjs +23 -2
- package/esm2022/src/image_performance_warning.mjs +2 -2
- package/esm2022/src/linker/query_list.mjs +8 -6
- package/esm2022/src/metadata/do_bootstrap.mjs +1 -1
- package/esm2022/src/platform/platform.mjs +135 -0
- package/esm2022/src/platform/platform_core_providers.mjs +15 -0
- package/esm2022/src/platform/platform_ref.mjs +179 -0
- package/esm2022/src/render3/instructions/change_detection.mjs +2 -4
- package/esm2022/src/render3/list_reconciliation.mjs +58 -24
- package/esm2022/src/render3/node_manipulation.mjs +2 -2
- package/esm2022/src/render3/util/change_detection_utils.mjs +3 -1
- package/esm2022/src/render3/util/misc_utils.mjs +2 -2
- package/esm2022/src/render3/view_manipulation.mjs +13 -5
- package/esm2022/src/render3/view_ref.mjs +7 -1
- package/esm2022/src/transfer_state.mjs +2 -2
- package/esm2022/src/util/performance.mjs +2 -2
- package/esm2022/src/version.mjs +1 -1
- package/esm2022/src/zone/ng_zone.mjs +10 -1
- package/esm2022/testing/src/component_fixture.mjs +20 -36
- package/esm2022/testing/src/logger.mjs +3 -3
- package/esm2022/testing/src/test_bed.mjs +5 -6
- package/fesm2022/core.mjs +1263 -1191
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/primitives/signals.mjs +2 -9
- package/fesm2022/primitives/signals.mjs.map +1 -1
- package/fesm2022/rxjs-interop.mjs +1 -1
- package/fesm2022/testing.mjs +46 -64
- package/fesm2022/testing.mjs.map +1 -1
- package/index.d.ts +18 -14
- 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 +958 -457
- package/schematics/migrations/block-template-entities/bundle.js.map +4 -4
- package/schematics/ng-generate/control-flow-migration/bundle.js +1221 -525
- package/schematics/ng-generate/control-flow-migration/bundle.js.map +4 -4
- package/schematics/ng-generate/standalone-migration/bundle.js +1143 -509
- package/schematics/ng-generate/standalone-migration/bundle.js.map +4 -4
- package/testing/index.d.ts +6 -10
- package/esm2022/src/application_config.mjs +0 -21
- package/esm2022/src/application_init.mjs +0 -188
- package/esm2022/src/application_module.mjs +0 -29
- package/esm2022/src/application_ref.mjs +0 -997
- package/esm2022/src/application_tokens.mjs +0 -121
- package/esm2022/src/platform_core_providers.mjs +0 -15
|
@@ -3997,6 +3997,39 @@ function getInjectFn(target) {
|
|
|
3997
3997
|
}
|
|
3998
3998
|
}
|
|
3999
3999
|
|
|
4000
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/ml_parser/tags.mjs
|
|
4001
|
+
var TagContentType;
|
|
4002
|
+
(function(TagContentType2) {
|
|
4003
|
+
TagContentType2[TagContentType2["RAW_TEXT"] = 0] = "RAW_TEXT";
|
|
4004
|
+
TagContentType2[TagContentType2["ESCAPABLE_RAW_TEXT"] = 1] = "ESCAPABLE_RAW_TEXT";
|
|
4005
|
+
TagContentType2[TagContentType2["PARSABLE_DATA"] = 2] = "PARSABLE_DATA";
|
|
4006
|
+
})(TagContentType || (TagContentType = {}));
|
|
4007
|
+
function splitNsName(elementName) {
|
|
4008
|
+
if (elementName[0] != ":") {
|
|
4009
|
+
return [null, elementName];
|
|
4010
|
+
}
|
|
4011
|
+
const colonIndex = elementName.indexOf(":", 1);
|
|
4012
|
+
if (colonIndex === -1) {
|
|
4013
|
+
throw new Error(`Unsupported format "${elementName}" expecting ":namespace:name"`);
|
|
4014
|
+
}
|
|
4015
|
+
return [elementName.slice(1, colonIndex), elementName.slice(colonIndex + 1)];
|
|
4016
|
+
}
|
|
4017
|
+
function isNgContainer(tagName) {
|
|
4018
|
+
return splitNsName(tagName)[1] === "ng-container";
|
|
4019
|
+
}
|
|
4020
|
+
function isNgContent(tagName) {
|
|
4021
|
+
return splitNsName(tagName)[1] === "ng-content";
|
|
4022
|
+
}
|
|
4023
|
+
function isNgTemplate(tagName) {
|
|
4024
|
+
return splitNsName(tagName)[1] === "ng-template";
|
|
4025
|
+
}
|
|
4026
|
+
function getNsPrefix(fullName) {
|
|
4027
|
+
return fullName === null ? null : splitNsName(fullName)[0];
|
|
4028
|
+
}
|
|
4029
|
+
function mergeNsAndName(prefix, localName) {
|
|
4030
|
+
return prefix ? `:${prefix}:${localName}` : localName;
|
|
4031
|
+
}
|
|
4032
|
+
|
|
4000
4033
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/render3/r3_ast.mjs
|
|
4001
4034
|
var Comment = class {
|
|
4002
4035
|
constructor(value, sourceSpan) {
|
|
@@ -5206,6 +5239,23 @@ var DefinitionMap = class {
|
|
|
5206
5239
|
return literalMap(this.values);
|
|
5207
5240
|
}
|
|
5208
5241
|
};
|
|
5242
|
+
function createCssSelectorFromNode(node) {
|
|
5243
|
+
const elementName = node instanceof Element ? node.name : "ng-template";
|
|
5244
|
+
const attributes = getAttrsForDirectiveMatching(node);
|
|
5245
|
+
const cssSelector = new CssSelector();
|
|
5246
|
+
const elementNameNoNs = splitNsName(elementName)[1];
|
|
5247
|
+
cssSelector.setElement(elementNameNoNs);
|
|
5248
|
+
Object.getOwnPropertyNames(attributes).forEach((name) => {
|
|
5249
|
+
const nameNoNs = splitNsName(name)[1];
|
|
5250
|
+
const value = attributes[name];
|
|
5251
|
+
cssSelector.addAttribute(nameNoNs, value);
|
|
5252
|
+
if (name.toLowerCase() === "class") {
|
|
5253
|
+
const classes = value.trim().split(/\s+/);
|
|
5254
|
+
classes.forEach((className) => cssSelector.addClassName(className));
|
|
5255
|
+
}
|
|
5256
|
+
});
|
|
5257
|
+
return cssSelector;
|
|
5258
|
+
}
|
|
5209
5259
|
function getAttrsForDirectiveMatching(elOrTpl) {
|
|
5210
5260
|
const attributesMap = {};
|
|
5211
5261
|
if (elOrTpl instanceof Template && elOrTpl.tagName !== "ng-template") {
|
|
@@ -7923,6 +7973,7 @@ var OpKind;
|
|
|
7923
7973
|
OpKind2[OpKind2["IcuStart"] = 41] = "IcuStart";
|
|
7924
7974
|
OpKind2[OpKind2["IcuEnd"] = 42] = "IcuEnd";
|
|
7925
7975
|
OpKind2[OpKind2["I18nContext"] = 43] = "I18nContext";
|
|
7976
|
+
OpKind2[OpKind2["I18nAttributes"] = 44] = "I18nAttributes";
|
|
7926
7977
|
})(OpKind || (OpKind = {}));
|
|
7927
7978
|
var ExpressionKind;
|
|
7928
7979
|
(function(ExpressionKind2) {
|
|
@@ -7947,10 +7998,11 @@ var ExpressionKind;
|
|
|
7947
7998
|
ExpressionKind2[ExpressionKind2["AssignTemporaryExpr"] = 18] = "AssignTemporaryExpr";
|
|
7948
7999
|
ExpressionKind2[ExpressionKind2["ReadTemporaryExpr"] = 19] = "ReadTemporaryExpr";
|
|
7949
8000
|
ExpressionKind2[ExpressionKind2["SanitizerExpr"] = 20] = "SanitizerExpr";
|
|
7950
|
-
ExpressionKind2[ExpressionKind2["
|
|
7951
|
-
ExpressionKind2[ExpressionKind2["
|
|
7952
|
-
ExpressionKind2[ExpressionKind2["
|
|
7953
|
-
ExpressionKind2[ExpressionKind2["
|
|
8001
|
+
ExpressionKind2[ExpressionKind2["TrustedValueFnExpr"] = 21] = "TrustedValueFnExpr";
|
|
8002
|
+
ExpressionKind2[ExpressionKind2["SlotLiteralExpr"] = 22] = "SlotLiteralExpr";
|
|
8003
|
+
ExpressionKind2[ExpressionKind2["ConditionalCase"] = 23] = "ConditionalCase";
|
|
8004
|
+
ExpressionKind2[ExpressionKind2["DerivedRepeaterVar"] = 24] = "DerivedRepeaterVar";
|
|
8005
|
+
ExpressionKind2[ExpressionKind2["ConstCollected"] = 25] = "ConstCollected";
|
|
7954
8006
|
})(ExpressionKind || (ExpressionKind = {}));
|
|
7955
8007
|
var VariableFlags;
|
|
7956
8008
|
(function(VariableFlags2) {
|
|
@@ -7969,15 +8021,6 @@ var CompatibilityMode;
|
|
|
7969
8021
|
CompatibilityMode2[CompatibilityMode2["Normal"] = 0] = "Normal";
|
|
7970
8022
|
CompatibilityMode2[CompatibilityMode2["TemplateDefinitionBuilder"] = 1] = "TemplateDefinitionBuilder";
|
|
7971
8023
|
})(CompatibilityMode || (CompatibilityMode = {}));
|
|
7972
|
-
var SanitizerFn;
|
|
7973
|
-
(function(SanitizerFn2) {
|
|
7974
|
-
SanitizerFn2[SanitizerFn2["Html"] = 0] = "Html";
|
|
7975
|
-
SanitizerFn2[SanitizerFn2["Script"] = 1] = "Script";
|
|
7976
|
-
SanitizerFn2[SanitizerFn2["Style"] = 2] = "Style";
|
|
7977
|
-
SanitizerFn2[SanitizerFn2["Url"] = 3] = "Url";
|
|
7978
|
-
SanitizerFn2[SanitizerFn2["ResourceUrl"] = 4] = "ResourceUrl";
|
|
7979
|
-
SanitizerFn2[SanitizerFn2["IframeAttribute"] = 5] = "IframeAttribute";
|
|
7980
|
-
})(SanitizerFn || (SanitizerFn = {}));
|
|
7981
8024
|
var DeferSecondaryKind;
|
|
7982
8025
|
(function(DeferSecondaryKind2) {
|
|
7983
8026
|
DeferSecondaryKind2[DeferSecondaryKind2["Loading"] = 0] = "Loading";
|
|
@@ -7999,6 +8042,11 @@ var I18nParamResolutionTime;
|
|
|
7999
8042
|
I18nParamResolutionTime2[I18nParamResolutionTime2["Creation"] = 0] = "Creation";
|
|
8000
8043
|
I18nParamResolutionTime2[I18nParamResolutionTime2["Postproccessing"] = 1] = "Postproccessing";
|
|
8001
8044
|
})(I18nParamResolutionTime || (I18nParamResolutionTime = {}));
|
|
8045
|
+
var I18nExpressionFor;
|
|
8046
|
+
(function(I18nExpressionFor2) {
|
|
8047
|
+
I18nExpressionFor2[I18nExpressionFor2["I18nText"] = 0] = "I18nText";
|
|
8048
|
+
I18nExpressionFor2[I18nExpressionFor2["I18nAttribute"] = 1] = "I18nAttribute";
|
|
8049
|
+
})(I18nExpressionFor || (I18nExpressionFor = {}));
|
|
8002
8050
|
var I18nParamValueFlags;
|
|
8003
8051
|
(function(I18nParamValueFlags2) {
|
|
8004
8052
|
I18nParamValueFlags2[I18nParamValueFlags2["None"] = 0] = "None";
|
|
@@ -8034,7 +8082,14 @@ var I18nContextKind;
|
|
|
8034
8082
|
(function(I18nContextKind2) {
|
|
8035
8083
|
I18nContextKind2[I18nContextKind2["RootI18n"] = 0] = "RootI18n";
|
|
8036
8084
|
I18nContextKind2[I18nContextKind2["Icu"] = 1] = "Icu";
|
|
8085
|
+
I18nContextKind2[I18nContextKind2["Attr"] = 2] = "Attr";
|
|
8037
8086
|
})(I18nContextKind || (I18nContextKind = {}));
|
|
8087
|
+
var TemplateKind;
|
|
8088
|
+
(function(TemplateKind2) {
|
|
8089
|
+
TemplateKind2[TemplateKind2["NgTemplate"] = 0] = "NgTemplate";
|
|
8090
|
+
TemplateKind2[TemplateKind2["Structural"] = 1] = "Structural";
|
|
8091
|
+
TemplateKind2[TemplateKind2["Block"] = 2] = "Block";
|
|
8092
|
+
})(TemplateKind || (TemplateKind = {}));
|
|
8038
8093
|
|
|
8039
8094
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/traits.mjs
|
|
8040
8095
|
var ConsumesSlot = Symbol("ConsumesSlot");
|
|
@@ -8091,22 +8146,25 @@ var NEW_OP = {
|
|
|
8091
8146
|
};
|
|
8092
8147
|
|
|
8093
8148
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/ops/update.mjs
|
|
8094
|
-
function createInterpolateTextOp(xref, interpolation,
|
|
8149
|
+
function createInterpolateTextOp(xref, interpolation, sourceSpan) {
|
|
8095
8150
|
return __spreadValues(__spreadValues(__spreadValues({
|
|
8096
8151
|
kind: OpKind.InterpolateText,
|
|
8097
8152
|
target: xref,
|
|
8098
8153
|
interpolation,
|
|
8099
|
-
i18nPlaceholders,
|
|
8100
8154
|
sourceSpan
|
|
8101
8155
|
}, TRAIT_DEPENDS_ON_SLOT_CONTEXT), TRAIT_CONSUMES_VARS), NEW_OP);
|
|
8102
8156
|
}
|
|
8103
8157
|
var Interpolation2 = class {
|
|
8104
|
-
constructor(strings, expressions) {
|
|
8158
|
+
constructor(strings, expressions, i18nPlaceholders) {
|
|
8105
8159
|
this.strings = strings;
|
|
8106
8160
|
this.expressions = expressions;
|
|
8161
|
+
this.i18nPlaceholders = i18nPlaceholders;
|
|
8162
|
+
if (i18nPlaceholders.length !== 0 && i18nPlaceholders.length !== expressions.length) {
|
|
8163
|
+
throw new Error(`Expected ${expressions.length} placeholders to match interpolation expression count, but got ${i18nPlaceholders.length}`);
|
|
8164
|
+
}
|
|
8107
8165
|
}
|
|
8108
8166
|
};
|
|
8109
|
-
function createBindingOp(target, kind, name, expression, unit, securityContext, isTextAttribute,
|
|
8167
|
+
function createBindingOp(target, kind, name, expression, unit, securityContext, isTextAttribute, isStructuralTemplateAttribute, templateKind, i18nMessage, sourceSpan) {
|
|
8110
8168
|
return __spreadValues({
|
|
8111
8169
|
kind: OpKind.Binding,
|
|
8112
8170
|
bindingKind: kind,
|
|
@@ -8116,11 +8174,14 @@ function createBindingOp(target, kind, name, expression, unit, securityContext,
|
|
|
8116
8174
|
unit,
|
|
8117
8175
|
securityContext,
|
|
8118
8176
|
isTextAttribute,
|
|
8119
|
-
|
|
8177
|
+
isStructuralTemplateAttribute,
|
|
8178
|
+
templateKind,
|
|
8179
|
+
i18nContext: null,
|
|
8180
|
+
i18nMessage,
|
|
8120
8181
|
sourceSpan
|
|
8121
8182
|
}, NEW_OP);
|
|
8122
8183
|
}
|
|
8123
|
-
function createPropertyOp(target, name, expression, isAnimationTrigger, securityContext,
|
|
8184
|
+
function createPropertyOp(target, name, expression, isAnimationTrigger, securityContext, isStructuralTemplateAttribute, templateKind, i18nContext, i18nMessage, sourceSpan) {
|
|
8124
8185
|
return __spreadValues(__spreadValues(__spreadValues({
|
|
8125
8186
|
kind: OpKind.Property,
|
|
8126
8187
|
target,
|
|
@@ -8129,7 +8190,10 @@ function createPropertyOp(target, name, expression, isAnimationTrigger, security
|
|
|
8129
8190
|
isAnimationTrigger,
|
|
8130
8191
|
securityContext,
|
|
8131
8192
|
sanitizer: null,
|
|
8132
|
-
|
|
8193
|
+
isStructuralTemplateAttribute,
|
|
8194
|
+
templateKind,
|
|
8195
|
+
i18nContext,
|
|
8196
|
+
i18nMessage,
|
|
8133
8197
|
sourceSpan
|
|
8134
8198
|
}, TRAIT_DEPENDS_ON_SLOT_CONTEXT), TRAIT_CONSUMES_VARS), NEW_OP);
|
|
8135
8199
|
}
|
|
@@ -8168,7 +8232,7 @@ function createClassMapOp(xref, expression, sourceSpan) {
|
|
|
8168
8232
|
sourceSpan
|
|
8169
8233
|
}, TRAIT_DEPENDS_ON_SLOT_CONTEXT), TRAIT_CONSUMES_VARS), NEW_OP);
|
|
8170
8234
|
}
|
|
8171
|
-
function createAttributeOp(target, name, expression, securityContext, isTextAttribute,
|
|
8235
|
+
function createAttributeOp(target, name, expression, securityContext, isTextAttribute, isStructuralTemplateAttribute, templateKind, i18nMessage, sourceSpan) {
|
|
8172
8236
|
return __spreadValues(__spreadValues(__spreadValues({
|
|
8173
8237
|
kind: OpKind.Attribute,
|
|
8174
8238
|
target,
|
|
@@ -8177,7 +8241,10 @@ function createAttributeOp(target, name, expression, securityContext, isTextAttr
|
|
|
8177
8241
|
securityContext,
|
|
8178
8242
|
sanitizer: null,
|
|
8179
8243
|
isTextAttribute,
|
|
8180
|
-
|
|
8244
|
+
isStructuralTemplateAttribute,
|
|
8245
|
+
templateKind,
|
|
8246
|
+
i18nContext: null,
|
|
8247
|
+
i18nMessage,
|
|
8181
8248
|
sourceSpan
|
|
8182
8249
|
}, TRAIT_DEPENDS_ON_SLOT_CONTEXT), TRAIT_CONSUMES_VARS), NEW_OP);
|
|
8183
8250
|
}
|
|
@@ -8218,22 +8285,25 @@ function createDeferWhenOp(target, expr, prefetch, sourceSpan) {
|
|
|
8218
8285
|
sourceSpan
|
|
8219
8286
|
}, NEW_OP), TRAIT_DEPENDS_ON_SLOT_CONTEXT);
|
|
8220
8287
|
}
|
|
8221
|
-
function createI18nExpressionOp(context, target, handle, expression, i18nPlaceholder, resolutionTime, sourceSpan) {
|
|
8288
|
+
function createI18nExpressionOp(context, target, i18nOwner, handle, expression, i18nPlaceholder, resolutionTime, usage, name, sourceSpan) {
|
|
8222
8289
|
return __spreadValues(__spreadValues(__spreadValues({
|
|
8223
8290
|
kind: OpKind.I18nExpression,
|
|
8224
8291
|
context,
|
|
8225
8292
|
target,
|
|
8293
|
+
i18nOwner,
|
|
8226
8294
|
handle,
|
|
8227
8295
|
expression,
|
|
8228
8296
|
i18nPlaceholder,
|
|
8229
8297
|
resolutionTime,
|
|
8298
|
+
usage,
|
|
8299
|
+
name,
|
|
8230
8300
|
sourceSpan
|
|
8231
8301
|
}, NEW_OP), TRAIT_CONSUMES_VARS), TRAIT_DEPENDS_ON_SLOT_CONTEXT);
|
|
8232
8302
|
}
|
|
8233
|
-
function createI18nApplyOp(
|
|
8303
|
+
function createI18nApplyOp(owner, handle, sourceSpan) {
|
|
8234
8304
|
return __spreadValues({
|
|
8235
8305
|
kind: OpKind.I18nApply,
|
|
8236
|
-
|
|
8306
|
+
owner,
|
|
8237
8307
|
handle,
|
|
8238
8308
|
sourceSpan
|
|
8239
8309
|
}, NEW_OP);
|
|
@@ -8770,26 +8840,6 @@ var ReadTemporaryExpr = class extends ExpressionBase {
|
|
|
8770
8840
|
return r;
|
|
8771
8841
|
}
|
|
8772
8842
|
};
|
|
8773
|
-
var SanitizerExpr = class extends ExpressionBase {
|
|
8774
|
-
constructor(fn2) {
|
|
8775
|
-
super();
|
|
8776
|
-
this.fn = fn2;
|
|
8777
|
-
this.kind = ExpressionKind.SanitizerExpr;
|
|
8778
|
-
}
|
|
8779
|
-
visitExpression(visitor, context) {
|
|
8780
|
-
}
|
|
8781
|
-
isEquivalent(e) {
|
|
8782
|
-
return e instanceof SanitizerExpr && e.fn === this.fn;
|
|
8783
|
-
}
|
|
8784
|
-
isConstant() {
|
|
8785
|
-
return true;
|
|
8786
|
-
}
|
|
8787
|
-
clone() {
|
|
8788
|
-
return new SanitizerExpr(this.fn);
|
|
8789
|
-
}
|
|
8790
|
-
transformInternalExpressions() {
|
|
8791
|
-
}
|
|
8792
|
-
};
|
|
8793
8843
|
var SlotLiteralExpr = class extends ExpressionBase {
|
|
8794
8844
|
constructor(slot) {
|
|
8795
8845
|
super();
|
|
@@ -8908,7 +8958,6 @@ function transformExpressionsInOp(op, transform2, flags) {
|
|
|
8908
8958
|
case OpKind.ClassProp:
|
|
8909
8959
|
case OpKind.ClassMap:
|
|
8910
8960
|
case OpKind.Binding:
|
|
8911
|
-
case OpKind.HostProperty:
|
|
8912
8961
|
if (op.expression instanceof Interpolation2) {
|
|
8913
8962
|
transformExpressionsInInterpolation(op.expression, transform2, flags);
|
|
8914
8963
|
} else {
|
|
@@ -8916,6 +8965,7 @@ function transformExpressionsInOp(op, transform2, flags) {
|
|
|
8916
8965
|
}
|
|
8917
8966
|
break;
|
|
8918
8967
|
case OpKind.Property:
|
|
8968
|
+
case OpKind.HostProperty:
|
|
8919
8969
|
case OpKind.Attribute:
|
|
8920
8970
|
if (op.expression instanceof Interpolation2) {
|
|
8921
8971
|
transformExpressionsInInterpolation(op.expression, transform2, flags);
|
|
@@ -8957,6 +9007,7 @@ function transformExpressionsInOp(op, transform2, flags) {
|
|
|
8957
9007
|
break;
|
|
8958
9008
|
case OpKind.ExtractedAttribute:
|
|
8959
9009
|
op.expression = op.expression && transformExpressionsInExpression(op.expression, transform2, flags);
|
|
9010
|
+
op.trustedValueFn = op.trustedValueFn && transformExpressionsInExpression(op.trustedValueFn, transform2, flags);
|
|
8960
9011
|
break;
|
|
8961
9012
|
case OpKind.RepeaterCreate:
|
|
8962
9013
|
op.track = transformExpressionsInExpression(op.track, transform2, flags);
|
|
@@ -9009,6 +9060,7 @@ function transformExpressionsInOp(op, transform2, flags) {
|
|
|
9009
9060
|
case OpKind.ProjectionDef:
|
|
9010
9061
|
case OpKind.Template:
|
|
9011
9062
|
case OpKind.Text:
|
|
9063
|
+
case OpKind.I18nAttributes:
|
|
9012
9064
|
break;
|
|
9013
9065
|
default:
|
|
9014
9066
|
throw new Error(`AssertionError: transformExpressionsInOp doesn't handle ${OpKind[op.kind]}`);
|
|
@@ -9020,6 +9072,8 @@ function transformExpressionsInExpression(expr, transform2, flags) {
|
|
|
9020
9072
|
} else if (expr instanceof BinaryOperatorExpr) {
|
|
9021
9073
|
expr.lhs = transformExpressionsInExpression(expr.lhs, transform2, flags);
|
|
9022
9074
|
expr.rhs = transformExpressionsInExpression(expr.rhs, transform2, flags);
|
|
9075
|
+
} else if (expr instanceof UnaryOperatorExpr) {
|
|
9076
|
+
expr.expr = transformExpressionsInExpression(expr.expr, transform2, flags);
|
|
9023
9077
|
} else if (expr instanceof ReadPropExpr) {
|
|
9024
9078
|
expr.receiver = transformExpressionsInExpression(expr.receiver, transform2, flags);
|
|
9025
9079
|
} else if (expr instanceof ReadKeyExpr) {
|
|
@@ -9059,6 +9113,12 @@ function transformExpressionsInExpression(expr, transform2, flags) {
|
|
|
9059
9113
|
for (let i = 0; i < expr.expressions.length; i++) {
|
|
9060
9114
|
expr.expressions[i] = transformExpressionsInExpression(expr.expressions[i], transform2, flags);
|
|
9061
9115
|
}
|
|
9116
|
+
} else if (expr instanceof NotExpr) {
|
|
9117
|
+
expr.condition = transformExpressionsInExpression(expr.condition, transform2, flags);
|
|
9118
|
+
} else if (expr instanceof TaggedTemplateExpr) {
|
|
9119
|
+
expr.tag = transformExpressionsInExpression(expr.tag, transform2, flags);
|
|
9120
|
+
expr.template.expressions = expr.template.expressions.map((e) => transformExpressionsInExpression(e, transform2, flags));
|
|
9121
|
+
} else if (expr instanceof WrappedNodeExpr) {
|
|
9062
9122
|
} else if (expr instanceof ReadVarExpr || expr instanceof ExternalExpr || expr instanceof LiteralExpr) {
|
|
9063
9123
|
} else {
|
|
9064
9124
|
throw new Error(`Unhandled expression kind: ${expr.constructor.name}`);
|
|
@@ -9314,10 +9374,11 @@ function createElementStartOp(tag, xref, namespace, i18nPlaceholder, sourceSpan)
|
|
|
9314
9374
|
sourceSpan
|
|
9315
9375
|
}, TRAIT_CONSUMES_SLOT), NEW_OP);
|
|
9316
9376
|
}
|
|
9317
|
-
function createTemplateOp(xref, tag, functionNameSuffix, namespace, i18nPlaceholder, sourceSpan) {
|
|
9377
|
+
function createTemplateOp(xref, templateKind, tag, functionNameSuffix, namespace, i18nPlaceholder, sourceSpan) {
|
|
9318
9378
|
return __spreadValues(__spreadValues({
|
|
9319
9379
|
kind: OpKind.Template,
|
|
9320
9380
|
xref,
|
|
9381
|
+
templateKind,
|
|
9321
9382
|
attributes: null,
|
|
9322
9383
|
tag,
|
|
9323
9384
|
handle: new SlotHandle(),
|
|
@@ -9331,7 +9392,7 @@ function createTemplateOp(xref, tag, functionNameSuffix, namespace, i18nPlacehol
|
|
|
9331
9392
|
sourceSpan
|
|
9332
9393
|
}, TRAIT_CONSUMES_SLOT), NEW_OP);
|
|
9333
9394
|
}
|
|
9334
|
-
function createRepeaterCreateOp(primaryView, emptyView, tag, track, varNames, sourceSpan) {
|
|
9395
|
+
function createRepeaterCreateOp(primaryView, emptyView, tag, track, varNames, i18nPlaceholder, emptyI18nPlaceholder, sourceSpan) {
|
|
9335
9396
|
return __spreadProps(__spreadValues(__spreadValues({
|
|
9336
9397
|
kind: OpKind.RepeaterCreate,
|
|
9337
9398
|
attributes: null,
|
|
@@ -9349,6 +9410,8 @@ function createRepeaterCreateOp(primaryView, emptyView, tag, track, varNames, so
|
|
|
9349
9410
|
vars: null,
|
|
9350
9411
|
varNames,
|
|
9351
9412
|
usesComponentInstance: false,
|
|
9413
|
+
i18nPlaceholder,
|
|
9414
|
+
emptyI18nPlaceholder,
|
|
9352
9415
|
sourceSpan
|
|
9353
9416
|
}, TRAIT_CONSUMES_SLOT), NEW_OP), {
|
|
9354
9417
|
numSlotsUsed: emptyView === null ? 2 : 3
|
|
@@ -9382,7 +9445,9 @@ function createTextOp(xref, initialValue, sourceSpan) {
|
|
|
9382
9445
|
sourceSpan
|
|
9383
9446
|
}, TRAIT_CONSUMES_SLOT), NEW_OP);
|
|
9384
9447
|
}
|
|
9385
|
-
function createListenerOp(target, targetSlot, name, tag, animationPhase, hostListener, sourceSpan) {
|
|
9448
|
+
function createListenerOp(target, targetSlot, name, tag, handlerOps, animationPhase, eventTarget, hostListener, sourceSpan) {
|
|
9449
|
+
const handlerList = new OpList();
|
|
9450
|
+
handlerList.push(handlerOps);
|
|
9386
9451
|
return __spreadValues({
|
|
9387
9452
|
kind: OpKind.Listener,
|
|
9388
9453
|
target,
|
|
@@ -9390,11 +9455,12 @@ function createListenerOp(target, targetSlot, name, tag, animationPhase, hostLis
|
|
|
9390
9455
|
tag,
|
|
9391
9456
|
hostListener,
|
|
9392
9457
|
name,
|
|
9393
|
-
handlerOps:
|
|
9458
|
+
handlerOps: handlerList,
|
|
9394
9459
|
handlerFnName: null,
|
|
9395
9460
|
consumesDollarEvent: false,
|
|
9396
9461
|
isAnimationListener: animationPhase !== null,
|
|
9397
9462
|
animationPhase,
|
|
9463
|
+
eventTarget,
|
|
9398
9464
|
sourceSpan
|
|
9399
9465
|
}, NEW_OP);
|
|
9400
9466
|
}
|
|
@@ -9418,25 +9484,30 @@ function createProjectionDefOp(def) {
|
|
|
9418
9484
|
def
|
|
9419
9485
|
}, NEW_OP);
|
|
9420
9486
|
}
|
|
9421
|
-
function createProjectionOp(xref, selector, sourceSpan) {
|
|
9487
|
+
function createProjectionOp(xref, selector, i18nPlaceholder, attributes, sourceSpan) {
|
|
9422
9488
|
return __spreadValues(__spreadValues({
|
|
9423
9489
|
kind: OpKind.Projection,
|
|
9424
9490
|
xref,
|
|
9425
9491
|
handle: new SlotHandle(),
|
|
9426
9492
|
selector,
|
|
9493
|
+
i18nPlaceholder,
|
|
9427
9494
|
projectionSlotIndex: 0,
|
|
9428
|
-
attributes
|
|
9495
|
+
attributes,
|
|
9429
9496
|
localRefs: [],
|
|
9430
9497
|
sourceSpan
|
|
9431
9498
|
}, NEW_OP), TRAIT_CONSUMES_SLOT);
|
|
9432
9499
|
}
|
|
9433
|
-
function createExtractedAttributeOp(target, bindingKind, name, expression) {
|
|
9500
|
+
function createExtractedAttributeOp(target, bindingKind, name, expression, i18nContext, i18nMessage, securityContext) {
|
|
9434
9501
|
return __spreadValues({
|
|
9435
9502
|
kind: OpKind.ExtractedAttribute,
|
|
9436
9503
|
target,
|
|
9437
9504
|
bindingKind,
|
|
9438
9505
|
name,
|
|
9439
|
-
expression
|
|
9506
|
+
expression,
|
|
9507
|
+
i18nContext,
|
|
9508
|
+
i18nMessage,
|
|
9509
|
+
securityContext,
|
|
9510
|
+
trustedValueFn: null
|
|
9440
9511
|
}, NEW_OP);
|
|
9441
9512
|
}
|
|
9442
9513
|
function createDeferOp(xref, main, mainSlot, metadata, sourceSpan) {
|
|
@@ -9473,10 +9544,11 @@ function createDeferOnOp(defer2, trigger, prefetch, sourceSpan) {
|
|
|
9473
9544
|
sourceSpan
|
|
9474
9545
|
}, NEW_OP);
|
|
9475
9546
|
}
|
|
9476
|
-
function createI18nMessageOp(xref, i18nBlock, message, messagePlaceholder, params, postprocessingParams, needsPostprocessing) {
|
|
9547
|
+
function createI18nMessageOp(xref, i18nContext, i18nBlock, message, messagePlaceholder, params, postprocessingParams, needsPostprocessing) {
|
|
9477
9548
|
return __spreadValues({
|
|
9478
9549
|
kind: OpKind.I18nMessage,
|
|
9479
9550
|
xref,
|
|
9551
|
+
i18nContext,
|
|
9480
9552
|
i18nBlock,
|
|
9481
9553
|
message,
|
|
9482
9554
|
messagePlaceholder,
|
|
@@ -9521,6 +9593,9 @@ function createIcuEndOp(xref) {
|
|
|
9521
9593
|
}, NEW_OP);
|
|
9522
9594
|
}
|
|
9523
9595
|
function createI18nContextOp(contextKind, xref, i18nBlock, message, sourceSpan) {
|
|
9596
|
+
if (i18nBlock === null && contextKind !== I18nContextKind.Attr) {
|
|
9597
|
+
throw new Error("AssertionError: i18nBlock must be provided for non-attribute contexts.");
|
|
9598
|
+
}
|
|
9524
9599
|
return __spreadValues({
|
|
9525
9600
|
kind: OpKind.I18nContext,
|
|
9526
9601
|
contextKind,
|
|
@@ -9532,14 +9607,26 @@ function createI18nContextOp(contextKind, xref, i18nBlock, message, sourceSpan)
|
|
|
9532
9607
|
postprocessingParams: /* @__PURE__ */ new Map()
|
|
9533
9608
|
}, NEW_OP);
|
|
9534
9609
|
}
|
|
9610
|
+
function createI18nAttributesOp(xref, handle, target) {
|
|
9611
|
+
return __spreadValues(__spreadValues({
|
|
9612
|
+
kind: OpKind.I18nAttributes,
|
|
9613
|
+
xref,
|
|
9614
|
+
handle,
|
|
9615
|
+
target,
|
|
9616
|
+
i18nAttributesConfig: null
|
|
9617
|
+
}, NEW_OP), TRAIT_CONSUMES_SLOT);
|
|
9618
|
+
}
|
|
9535
9619
|
|
|
9536
9620
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/ops/host.mjs
|
|
9537
|
-
function createHostPropertyOp(name, expression, isAnimationTrigger, sourceSpan) {
|
|
9621
|
+
function createHostPropertyOp(name, expression, isAnimationTrigger, i18nContext, securityContext, sourceSpan) {
|
|
9538
9622
|
return __spreadValues(__spreadValues({
|
|
9539
9623
|
kind: OpKind.HostProperty,
|
|
9540
9624
|
name,
|
|
9541
9625
|
expression,
|
|
9542
9626
|
isAnimationTrigger,
|
|
9627
|
+
i18nContext,
|
|
9628
|
+
securityContext,
|
|
9629
|
+
sanitizer: null,
|
|
9543
9630
|
sourceSpan
|
|
9544
9631
|
}, TRAIT_CONSUMES_VARS), NEW_OP);
|
|
9545
9632
|
}
|
|
@@ -9685,7 +9772,7 @@ function applyI18nExpressions(job) {
|
|
|
9685
9772
|
for (const unit of job.units) {
|
|
9686
9773
|
for (const op of unit.update) {
|
|
9687
9774
|
if (op.kind === OpKind.I18nExpression && needsApplication(i18nContexts, op)) {
|
|
9688
|
-
OpList.insertAfter(createI18nApplyOp(op.
|
|
9775
|
+
OpList.insertAfter(createI18nApplyOp(op.i18nOwner, op.handle, null), op);
|
|
9689
9776
|
}
|
|
9690
9777
|
}
|
|
9691
9778
|
}
|
|
@@ -9697,7 +9784,19 @@ function needsApplication(i18nContexts, op) {
|
|
|
9697
9784
|
}
|
|
9698
9785
|
const context = i18nContexts.get(op.context);
|
|
9699
9786
|
const nextContext2 = i18nContexts.get(op.next.context);
|
|
9700
|
-
if (context
|
|
9787
|
+
if (context === void 0) {
|
|
9788
|
+
throw new Error("AssertionError: expected an I18nContextOp to exist for the I18nExpressionOp's context");
|
|
9789
|
+
}
|
|
9790
|
+
if (nextContext2 === void 0) {
|
|
9791
|
+
throw new Error("AssertionError: expected an I18nContextOp to exist for the next I18nExpressionOp's context");
|
|
9792
|
+
}
|
|
9793
|
+
if (context.i18nBlock !== null) {
|
|
9794
|
+
if (context.i18nBlock !== nextContext2.i18nBlock) {
|
|
9795
|
+
return true;
|
|
9796
|
+
}
|
|
9797
|
+
return false;
|
|
9798
|
+
}
|
|
9799
|
+
if (op.i18nOwner !== op.next.i18nOwner) {
|
|
9701
9800
|
return true;
|
|
9702
9801
|
}
|
|
9703
9802
|
return false;
|
|
@@ -9705,27 +9804,44 @@ function needsApplication(i18nContexts, op) {
|
|
|
9705
9804
|
|
|
9706
9805
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/assign_i18n_slot_dependencies.mjs
|
|
9707
9806
|
function assignI18nSlotDependencies(job) {
|
|
9708
|
-
const i18nLastSlotConsumers = /* @__PURE__ */ new Map();
|
|
9709
|
-
let lastSlotConsumer = null;
|
|
9710
|
-
let currentI18nOp = null;
|
|
9711
9807
|
for (const unit of job.units) {
|
|
9712
|
-
|
|
9713
|
-
|
|
9714
|
-
|
|
9715
|
-
|
|
9716
|
-
|
|
9717
|
-
|
|
9718
|
-
|
|
9719
|
-
|
|
9720
|
-
|
|
9721
|
-
|
|
9722
|
-
|
|
9723
|
-
|
|
9808
|
+
let updateOp = unit.update.head;
|
|
9809
|
+
let i18nExpressionsInProgress = [];
|
|
9810
|
+
let state = null;
|
|
9811
|
+
for (const createOp of unit.create) {
|
|
9812
|
+
if (createOp.kind === OpKind.I18nStart) {
|
|
9813
|
+
state = {
|
|
9814
|
+
blockXref: createOp.xref,
|
|
9815
|
+
lastSlotConsumer: createOp.xref
|
|
9816
|
+
};
|
|
9817
|
+
} else if (createOp.kind === OpKind.I18nEnd) {
|
|
9818
|
+
for (const op of i18nExpressionsInProgress) {
|
|
9819
|
+
op.target = state.lastSlotConsumer;
|
|
9820
|
+
OpList.insertBefore(op, updateOp);
|
|
9821
|
+
}
|
|
9822
|
+
i18nExpressionsInProgress.length = 0;
|
|
9823
|
+
state = null;
|
|
9724
9824
|
}
|
|
9725
|
-
|
|
9726
|
-
|
|
9727
|
-
|
|
9728
|
-
|
|
9825
|
+
if (hasConsumesSlotTrait(createOp)) {
|
|
9826
|
+
if (state !== null) {
|
|
9827
|
+
state.lastSlotConsumer = createOp.xref;
|
|
9828
|
+
}
|
|
9829
|
+
while (true) {
|
|
9830
|
+
if (updateOp.next === null) {
|
|
9831
|
+
break;
|
|
9832
|
+
}
|
|
9833
|
+
if (state !== null && updateOp.kind === OpKind.I18nExpression && updateOp.usage === I18nExpressionFor.I18nText && updateOp.i18nOwner === state.blockXref) {
|
|
9834
|
+
const opToRemove = updateOp;
|
|
9835
|
+
updateOp = updateOp.next;
|
|
9836
|
+
OpList.remove(opToRemove);
|
|
9837
|
+
i18nExpressionsInProgress.push(opToRemove);
|
|
9838
|
+
continue;
|
|
9839
|
+
}
|
|
9840
|
+
if (hasDependsOnSlotContextTrait(updateOp) && updateOp.target !== createOp.xref) {
|
|
9841
|
+
break;
|
|
9842
|
+
}
|
|
9843
|
+
updateOp = updateOp.next;
|
|
9844
|
+
}
|
|
9729
9845
|
}
|
|
9730
9846
|
}
|
|
9731
9847
|
}
|
|
@@ -9754,18 +9870,53 @@ function extractAttributes(job) {
|
|
|
9754
9870
|
break;
|
|
9755
9871
|
case OpKind.Property:
|
|
9756
9872
|
if (!op.isAnimationTrigger) {
|
|
9757
|
-
|
|
9873
|
+
let bindingKind;
|
|
9874
|
+
if (op.i18nMessage !== null && op.templateKind === null) {
|
|
9875
|
+
bindingKind = BindingKind.I18n;
|
|
9876
|
+
} else if (op.isStructuralTemplateAttribute) {
|
|
9877
|
+
bindingKind = BindingKind.Template;
|
|
9878
|
+
} else {
|
|
9879
|
+
bindingKind = BindingKind.Property;
|
|
9880
|
+
}
|
|
9881
|
+
OpList.insertBefore(
|
|
9882
|
+
createExtractedAttributeOp(
|
|
9883
|
+
op.target,
|
|
9884
|
+
bindingKind,
|
|
9885
|
+
op.name,
|
|
9886
|
+
null,
|
|
9887
|
+
null,
|
|
9888
|
+
null,
|
|
9889
|
+
op.securityContext
|
|
9890
|
+
),
|
|
9891
|
+
lookupElement(elements, op.target)
|
|
9892
|
+
);
|
|
9758
9893
|
}
|
|
9759
9894
|
break;
|
|
9760
9895
|
case OpKind.StyleProp:
|
|
9761
9896
|
case OpKind.ClassProp:
|
|
9762
9897
|
if (unit.job.compatibility === CompatibilityMode.TemplateDefinitionBuilder && op.expression instanceof EmptyExpr2) {
|
|
9763
|
-
OpList.insertBefore(createExtractedAttributeOp(
|
|
9898
|
+
OpList.insertBefore(createExtractedAttributeOp(
|
|
9899
|
+
op.target,
|
|
9900
|
+
BindingKind.Property,
|
|
9901
|
+
op.name,
|
|
9902
|
+
null,
|
|
9903
|
+
null,
|
|
9904
|
+
null,
|
|
9905
|
+
SecurityContext.STYLE
|
|
9906
|
+
), lookupElement(elements, op.target));
|
|
9764
9907
|
}
|
|
9765
9908
|
break;
|
|
9766
9909
|
case OpKind.Listener:
|
|
9767
9910
|
if (!op.isAnimationListener) {
|
|
9768
|
-
const extractedAttributeOp = createExtractedAttributeOp(
|
|
9911
|
+
const extractedAttributeOp = createExtractedAttributeOp(
|
|
9912
|
+
op.target,
|
|
9913
|
+
BindingKind.Property,
|
|
9914
|
+
op.name,
|
|
9915
|
+
null,
|
|
9916
|
+
null,
|
|
9917
|
+
null,
|
|
9918
|
+
SecurityContext.NONE
|
|
9919
|
+
);
|
|
9769
9920
|
if (job.kind === CompilationJobKind.Host) {
|
|
9770
9921
|
unit.create.push(extractedAttributeOp);
|
|
9771
9922
|
} else {
|
|
@@ -9799,7 +9950,7 @@ function extractAttributeOp(unit, op, elements) {
|
|
|
9799
9950
|
}
|
|
9800
9951
|
}
|
|
9801
9952
|
if (extractable) {
|
|
9802
|
-
const extractedAttributeOp = createExtractedAttributeOp(op.target, op.
|
|
9953
|
+
const extractedAttributeOp = createExtractedAttributeOp(op.target, op.isStructuralTemplateAttribute ? BindingKind.Template : BindingKind.Attribute, op.name, op.expression, op.i18nContext, op.i18nMessage, op.securityContext);
|
|
9803
9954
|
if (unit.job.kind === CompilationJobKind.Host) {
|
|
9804
9955
|
unit.create.push(extractedAttributeOp);
|
|
9805
9956
|
} else {
|
|
@@ -9840,15 +9991,15 @@ function specializeBindings(job) {
|
|
|
9840
9991
|
const target = lookupElement2(elements, op.target);
|
|
9841
9992
|
target.nonBindable = true;
|
|
9842
9993
|
} else {
|
|
9843
|
-
OpList.replace(op, createAttributeOp(op.target, op.name, op.expression, op.securityContext, op.isTextAttribute, op.
|
|
9994
|
+
OpList.replace(op, createAttributeOp(op.target, op.name, op.expression, op.securityContext, op.isTextAttribute, op.isStructuralTemplateAttribute, op.templateKind, op.i18nMessage, op.sourceSpan));
|
|
9844
9995
|
}
|
|
9845
9996
|
break;
|
|
9846
9997
|
case BindingKind.Property:
|
|
9847
9998
|
case BindingKind.Animation:
|
|
9848
9999
|
if (job.kind === CompilationJobKind.Host) {
|
|
9849
|
-
OpList.replace(op, createHostPropertyOp(op.name, op.expression, op.bindingKind === BindingKind.Animation, op.sourceSpan));
|
|
10000
|
+
OpList.replace(op, createHostPropertyOp(op.name, op.expression, op.bindingKind === BindingKind.Animation, op.i18nContext, op.securityContext, op.sourceSpan));
|
|
9850
10001
|
} else {
|
|
9851
|
-
OpList.replace(op, createPropertyOp(op.target, op.name, op.expression, op.bindingKind === BindingKind.Animation, op.securityContext, op.
|
|
10002
|
+
OpList.replace(op, createPropertyOp(op.target, op.name, op.expression, op.bindingKind === BindingKind.Animation, op.securityContext, op.isStructuralTemplateAttribute, op.templateKind, op.i18nContext, op.i18nMessage, op.sourceSpan));
|
|
9852
10003
|
}
|
|
9853
10004
|
break;
|
|
9854
10005
|
case BindingKind.I18n:
|
|
@@ -9975,39 +10126,6 @@ function generateConditionalExpressions(job) {
|
|
|
9975
10126
|
}
|
|
9976
10127
|
}
|
|
9977
10128
|
|
|
9978
|
-
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/ml_parser/tags.mjs
|
|
9979
|
-
var TagContentType;
|
|
9980
|
-
(function(TagContentType2) {
|
|
9981
|
-
TagContentType2[TagContentType2["RAW_TEXT"] = 0] = "RAW_TEXT";
|
|
9982
|
-
TagContentType2[TagContentType2["ESCAPABLE_RAW_TEXT"] = 1] = "ESCAPABLE_RAW_TEXT";
|
|
9983
|
-
TagContentType2[TagContentType2["PARSABLE_DATA"] = 2] = "PARSABLE_DATA";
|
|
9984
|
-
})(TagContentType || (TagContentType = {}));
|
|
9985
|
-
function splitNsName(elementName) {
|
|
9986
|
-
if (elementName[0] != ":") {
|
|
9987
|
-
return [null, elementName];
|
|
9988
|
-
}
|
|
9989
|
-
const colonIndex = elementName.indexOf(":", 1);
|
|
9990
|
-
if (colonIndex === -1) {
|
|
9991
|
-
throw new Error(`Unsupported format "${elementName}" expecting ":namespace:name"`);
|
|
9992
|
-
}
|
|
9993
|
-
return [elementName.slice(1, colonIndex), elementName.slice(colonIndex + 1)];
|
|
9994
|
-
}
|
|
9995
|
-
function isNgContainer(tagName) {
|
|
9996
|
-
return splitNsName(tagName)[1] === "ng-container";
|
|
9997
|
-
}
|
|
9998
|
-
function isNgContent(tagName) {
|
|
9999
|
-
return splitNsName(tagName)[1] === "ng-content";
|
|
10000
|
-
}
|
|
10001
|
-
function isNgTemplate(tagName) {
|
|
10002
|
-
return splitNsName(tagName)[1] === "ng-template";
|
|
10003
|
-
}
|
|
10004
|
-
function getNsPrefix(fullName) {
|
|
10005
|
-
return fullName === null ? null : splitNsName(fullName)[0];
|
|
10006
|
-
}
|
|
10007
|
-
function mergeNsAndName(prefix, localName) {
|
|
10008
|
-
return prefix ? `:${prefix}:${localName}` : localName;
|
|
10009
|
-
}
|
|
10010
|
-
|
|
10011
10129
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/conversion.mjs
|
|
10012
10130
|
var BINARY_OPERATORS = /* @__PURE__ */ new Map([
|
|
10013
10131
|
["&&", BinaryOperator.And],
|
|
@@ -10066,7 +10184,7 @@ function collectElementConsts(job) {
|
|
|
10066
10184
|
if (op.kind === OpKind.ExtractedAttribute) {
|
|
10067
10185
|
const attributes = allElementAttributes.get(op.target) || new ElementAttributes();
|
|
10068
10186
|
allElementAttributes.set(op.target, attributes);
|
|
10069
|
-
attributes.add(op.bindingKind, op.name, op.expression);
|
|
10187
|
+
attributes.add(op.bindingKind, op.name, op.expression, op.trustedValueFn);
|
|
10070
10188
|
OpList.remove(op);
|
|
10071
10189
|
}
|
|
10072
10190
|
}
|
|
@@ -10128,7 +10246,7 @@ var ElementAttributes = class {
|
|
|
10128
10246
|
var _a2;
|
|
10129
10247
|
return (_a2 = this.byKind.get(BindingKind.I18n)) != null ? _a2 : FLYWEIGHT_ARRAY;
|
|
10130
10248
|
}
|
|
10131
|
-
add(kind, name, value) {
|
|
10249
|
+
add(kind, name, value, trustedValueFn) {
|
|
10132
10250
|
var _a2;
|
|
10133
10251
|
if (this.known.has(name)) {
|
|
10134
10252
|
return;
|
|
@@ -10144,9 +10262,16 @@ var ElementAttributes = class {
|
|
|
10144
10262
|
array.push(...getAttributeNameLiterals(name));
|
|
10145
10263
|
if (kind === BindingKind.Attribute || kind === BindingKind.StyleProperty) {
|
|
10146
10264
|
if (value === null) {
|
|
10147
|
-
throw Error("Attribute & style element attributes must have a value");
|
|
10265
|
+
throw Error("Attribute, i18n attribute, & style element attributes must have a value");
|
|
10266
|
+
}
|
|
10267
|
+
if (trustedValueFn !== null) {
|
|
10268
|
+
if (!isStringLiteral(value)) {
|
|
10269
|
+
throw Error("AssertionError: extracted attribute value should be string literal");
|
|
10270
|
+
}
|
|
10271
|
+
array.push(taggedTemplate(trustedValueFn, new TemplateLiteral([new TemplateLiteralElement(value.value)], []), void 0, value.sourceSpan));
|
|
10272
|
+
} else {
|
|
10273
|
+
array.push(value);
|
|
10148
10274
|
}
|
|
10149
|
-
array.push(value);
|
|
10150
10275
|
}
|
|
10151
10276
|
}
|
|
10152
10277
|
arrayFor(kind) {
|
|
@@ -10192,6 +10317,47 @@ function serializeAttributes({ attributes, bindings, classes, i18n: i18n2, proje
|
|
|
10192
10317
|
return literalArr(attrArray);
|
|
10193
10318
|
}
|
|
10194
10319
|
|
|
10320
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/convert_i18n_bindings.mjs
|
|
10321
|
+
function convertI18nBindings(job) {
|
|
10322
|
+
const i18nAttributesByElem = /* @__PURE__ */ new Map();
|
|
10323
|
+
for (const unit of job.units) {
|
|
10324
|
+
for (const op of unit.create) {
|
|
10325
|
+
if (op.kind === OpKind.I18nAttributes) {
|
|
10326
|
+
i18nAttributesByElem.set(op.target, op);
|
|
10327
|
+
}
|
|
10328
|
+
}
|
|
10329
|
+
for (const op of unit.update) {
|
|
10330
|
+
switch (op.kind) {
|
|
10331
|
+
case OpKind.Property:
|
|
10332
|
+
case OpKind.Attribute:
|
|
10333
|
+
if (op.i18nContext === null) {
|
|
10334
|
+
continue;
|
|
10335
|
+
}
|
|
10336
|
+
if (!(op.expression instanceof Interpolation2)) {
|
|
10337
|
+
continue;
|
|
10338
|
+
}
|
|
10339
|
+
const i18nAttributesForElem = i18nAttributesByElem.get(op.target);
|
|
10340
|
+
if (i18nAttributesForElem === void 0) {
|
|
10341
|
+
throw new Error("AssertionError: An i18n attribute binding instruction requires the owning element to have an I18nAttributes create instruction");
|
|
10342
|
+
}
|
|
10343
|
+
if (i18nAttributesForElem.target !== op.target) {
|
|
10344
|
+
throw new Error("AssertionError: Expected i18nAttributes target element to match binding target element");
|
|
10345
|
+
}
|
|
10346
|
+
const ops = [];
|
|
10347
|
+
for (let i = 0; i < op.expression.expressions.length; i++) {
|
|
10348
|
+
const expr = op.expression.expressions[i];
|
|
10349
|
+
if (op.expression.i18nPlaceholders.length !== op.expression.expressions.length) {
|
|
10350
|
+
throw new Error(`AssertionError: An i18n attribute binding instruction requires the same number of expressions and placeholders, but found ${op.expression.i18nPlaceholders.length} placeholders and ${op.expression.expressions.length} expressions`);
|
|
10351
|
+
}
|
|
10352
|
+
ops.push(createI18nExpressionOp(op.i18nContext, i18nAttributesForElem.target, i18nAttributesForElem.xref, i18nAttributesForElem.handle, expr, op.expression.i18nPlaceholders[i], I18nParamResolutionTime.Creation, I18nExpressionFor.I18nAttribute, op.name, op.sourceSpan));
|
|
10353
|
+
}
|
|
10354
|
+
OpList.replaceWithMany(op, ops);
|
|
10355
|
+
break;
|
|
10356
|
+
}
|
|
10357
|
+
}
|
|
10358
|
+
}
|
|
10359
|
+
}
|
|
10360
|
+
|
|
10195
10361
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/create_defer_deps_fns.mjs
|
|
10196
10362
|
function createDeferDepsFns(job) {
|
|
10197
10363
|
for (const unit of job.units) {
|
|
@@ -10225,6 +10391,7 @@ function createI18nContexts(job) {
|
|
|
10225
10391
|
const rootContexts = /* @__PURE__ */ new Map();
|
|
10226
10392
|
let currentI18nOp = null;
|
|
10227
10393
|
let xref;
|
|
10394
|
+
const messageToContext = /* @__PURE__ */ new Map();
|
|
10228
10395
|
for (const unit of job.units) {
|
|
10229
10396
|
for (const op of unit.create) {
|
|
10230
10397
|
switch (op.kind) {
|
|
@@ -10254,6 +10421,24 @@ function createI18nContexts(job) {
|
|
|
10254
10421
|
break;
|
|
10255
10422
|
}
|
|
10256
10423
|
}
|
|
10424
|
+
for (const op of unit.ops()) {
|
|
10425
|
+
switch (op.kind) {
|
|
10426
|
+
case OpKind.Binding:
|
|
10427
|
+
case OpKind.Property:
|
|
10428
|
+
case OpKind.Attribute:
|
|
10429
|
+
case OpKind.ExtractedAttribute:
|
|
10430
|
+
if (!op.i18nMessage) {
|
|
10431
|
+
continue;
|
|
10432
|
+
}
|
|
10433
|
+
if (!messageToContext.has(op.i18nMessage)) {
|
|
10434
|
+
const i18nContext = job.allocateXrefId();
|
|
10435
|
+
unit.create.push(createI18nContextOp(I18nContextKind.Attr, i18nContext, null, op.i18nMessage, null));
|
|
10436
|
+
messageToContext.set(op.i18nMessage, i18nContext);
|
|
10437
|
+
}
|
|
10438
|
+
op.i18nContext = messageToContext.get(op.i18nMessage);
|
|
10439
|
+
break;
|
|
10440
|
+
}
|
|
10441
|
+
}
|
|
10257
10442
|
}
|
|
10258
10443
|
for (const unit of job.units) {
|
|
10259
10444
|
for (const op of unit.create) {
|
|
@@ -10562,6 +10747,15 @@ function extractI18nMessages(job) {
|
|
|
10562
10747
|
}
|
|
10563
10748
|
}
|
|
10564
10749
|
}
|
|
10750
|
+
for (const unit of job.units) {
|
|
10751
|
+
for (const op of unit.create) {
|
|
10752
|
+
if (op.kind !== OpKind.I18nContext || op.contextKind !== I18nContextKind.Attr) {
|
|
10753
|
+
continue;
|
|
10754
|
+
}
|
|
10755
|
+
const i18nMessageOp = createI18nMessage(job, op);
|
|
10756
|
+
unit.create.push(i18nMessageOp);
|
|
10757
|
+
}
|
|
10758
|
+
}
|
|
10565
10759
|
const i18nBlockMessages = /* @__PURE__ */ new Map();
|
|
10566
10760
|
for (const unit of job.units) {
|
|
10567
10761
|
for (const op of unit.create) {
|
|
@@ -10584,6 +10778,9 @@ function extractI18nMessages(job) {
|
|
|
10584
10778
|
}
|
|
10585
10779
|
const i18nContext = i18nContexts.get(op.context);
|
|
10586
10780
|
if (i18nContext.contextKind === I18nContextKind.Icu) {
|
|
10781
|
+
if (i18nContext.i18nBlock === null) {
|
|
10782
|
+
throw Error("ICU context should have its i18n block set.");
|
|
10783
|
+
}
|
|
10587
10784
|
const subMessage = createI18nMessage(job, i18nContext, op.messagePlaceholder);
|
|
10588
10785
|
unit.create.push(subMessage);
|
|
10589
10786
|
const rootI18nId = i18nBlocks.get(i18nContext.i18nBlock).root;
|
|
@@ -10600,69 +10797,54 @@ function extractI18nMessages(job) {
|
|
|
10600
10797
|
}
|
|
10601
10798
|
}
|
|
10602
10799
|
function createI18nMessage(job, context, messagePlaceholder) {
|
|
10603
|
-
let
|
|
10604
|
-
const
|
|
10605
|
-
|
|
10606
|
-
|
|
10800
|
+
let formattedParams = formatParams(context.params);
|
|
10801
|
+
const formattedPostprocessingParams = formatParams(context.postprocessingParams);
|
|
10802
|
+
let needsPostprocessing = formattedPostprocessingParams.size > 0;
|
|
10803
|
+
for (const values of context.params.values()) {
|
|
10804
|
+
if (values.length > 1) {
|
|
10805
|
+
needsPostprocessing = true;
|
|
10806
|
+
}
|
|
10807
|
+
}
|
|
10808
|
+
return createI18nMessageOp(job.allocateXrefId(), context.xref, context.i18nBlock, context.message, messagePlaceholder != null ? messagePlaceholder : null, formattedParams, formattedPostprocessingParams, needsPostprocessing);
|
|
10607
10809
|
}
|
|
10608
10810
|
function formatParams(params) {
|
|
10609
10811
|
const formattedParams = /* @__PURE__ */ new Map();
|
|
10610
|
-
let needsPostprocessing = false;
|
|
10611
10812
|
for (const [placeholder, placeholderValues] of params) {
|
|
10612
|
-
const
|
|
10613
|
-
needsPostprocessing || (needsPostprocessing = paramNeedsPostprocessing);
|
|
10813
|
+
const serializedValues = formatParamValues(placeholderValues);
|
|
10614
10814
|
if (serializedValues !== null) {
|
|
10615
10815
|
formattedParams.set(placeholder, literal(serializedValues));
|
|
10616
10816
|
}
|
|
10617
10817
|
}
|
|
10618
|
-
return
|
|
10818
|
+
return formattedParams;
|
|
10619
10819
|
}
|
|
10620
10820
|
function formatParamValues(values) {
|
|
10621
10821
|
if (values.length === 0) {
|
|
10622
|
-
return
|
|
10822
|
+
return null;
|
|
10623
10823
|
}
|
|
10624
|
-
collapseElementTemplatePairs(values);
|
|
10625
10824
|
const serializedValues = values.map((value) => formatValue(value));
|
|
10626
|
-
return serializedValues.length === 1 ?
|
|
10825
|
+
return serializedValues.length === 1 ? serializedValues[0] : `${LIST_START_MARKER}${serializedValues.join(LIST_DELIMITER)}${LIST_END_MARKER}`;
|
|
10627
10826
|
}
|
|
10628
|
-
function
|
|
10629
|
-
|
|
10630
|
-
|
|
10631
|
-
|
|
10632
|
-
const value = values[i];
|
|
10633
|
-
if (value.subTemplateIndex !== null && value.flags & (I18nParamValueFlags.ElementTag | I18nParamValueFlags.TemplateTag)) {
|
|
10634
|
-
const valueIndicies = (_a2 = valueIndiciesBySubTemplateIndex.get(value.subTemplateIndex)) != null ? _a2 : [];
|
|
10635
|
-
valueIndicies.push(i);
|
|
10636
|
-
valueIndiciesBySubTemplateIndex.set(value.subTemplateIndex, valueIndicies);
|
|
10637
|
-
}
|
|
10638
|
-
}
|
|
10639
|
-
for (const [subTemplateIndex, valueIndicies] of valueIndiciesBySubTemplateIndex) {
|
|
10640
|
-
if (valueIndicies.length > 1) {
|
|
10641
|
-
const elementIndex = valueIndicies.find((index) => values[index].flags & I18nParamValueFlags.ElementTag);
|
|
10642
|
-
const templateIndex = valueIndicies.find((index) => values[index].flags & I18nParamValueFlags.TemplateTag);
|
|
10643
|
-
if (elementIndex !== void 0 && templateIndex !== void 0) {
|
|
10644
|
-
const elementValue = values[elementIndex];
|
|
10645
|
-
const templateValue = values[templateIndex];
|
|
10646
|
-
let compundValue;
|
|
10647
|
-
if (elementValue.flags & I18nParamValueFlags.OpenTag && elementValue.flags & I18nParamValueFlags.CloseTag) {
|
|
10648
|
-
compundValue = `${formatValue(templateValue)}${formatValue(elementValue)}${formatValue(templateValue)}`;
|
|
10649
|
-
} else if (elementValue.flags & I18nParamValueFlags.OpenTag) {
|
|
10650
|
-
compundValue = `${formatValue(templateValue)}${formatValue(elementValue)}`;
|
|
10651
|
-
} else {
|
|
10652
|
-
compundValue = `${formatValue(elementValue)}${formatValue(templateValue)}`;
|
|
10653
|
-
}
|
|
10654
|
-
values.splice(elementIndex, 1, { value: compundValue, subTemplateIndex, flags: I18nParamValueFlags.None });
|
|
10655
|
-
values.splice(templateIndex, 1, null);
|
|
10656
|
-
}
|
|
10827
|
+
function formatValue(value) {
|
|
10828
|
+
if (value.flags & I18nParamValueFlags.ElementTag && value.flags & I18nParamValueFlags.TemplateTag) {
|
|
10829
|
+
if (typeof value.value !== "object") {
|
|
10830
|
+
throw Error("AssertionError: Expected i18n param value to have an element and template slot");
|
|
10657
10831
|
}
|
|
10658
|
-
|
|
10659
|
-
|
|
10660
|
-
|
|
10661
|
-
|
|
10832
|
+
const elementValue = formatValue(__spreadProps(__spreadValues({}, value), {
|
|
10833
|
+
value: value.value.element,
|
|
10834
|
+
flags: value.flags & ~I18nParamValueFlags.TemplateTag
|
|
10835
|
+
}));
|
|
10836
|
+
const templateValue = formatValue(__spreadProps(__spreadValues({}, value), {
|
|
10837
|
+
value: value.value.template,
|
|
10838
|
+
flags: value.flags & ~I18nParamValueFlags.ElementTag
|
|
10839
|
+
}));
|
|
10840
|
+
if (value.flags & I18nParamValueFlags.OpenTag && value.flags & I18nParamValueFlags.CloseTag) {
|
|
10841
|
+
return `${templateValue}${elementValue}${templateValue}`;
|
|
10662
10842
|
}
|
|
10843
|
+
return value.flags & I18nParamValueFlags.CloseTag ? `${elementValue}${templateValue}` : `${templateValue}${elementValue}`;
|
|
10844
|
+
}
|
|
10845
|
+
if (value.flags & I18nParamValueFlags.OpenTag && value.flags & I18nParamValueFlags.CloseTag) {
|
|
10846
|
+
return `${formatValue(__spreadProps(__spreadValues({}, value), { flags: value.flags & ~I18nParamValueFlags.CloseTag }))}${formatValue(__spreadProps(__spreadValues({}, value), { flags: value.flags & ~I18nParamValueFlags.OpenTag }))}`;
|
|
10663
10847
|
}
|
|
10664
|
-
}
|
|
10665
|
-
function formatValue(value) {
|
|
10666
10848
|
if (value.flags === I18nParamValueFlags.None) {
|
|
10667
10849
|
return `${value.value}`;
|
|
10668
10850
|
}
|
|
@@ -10677,9 +10859,6 @@ function formatValue(value) {
|
|
|
10677
10859
|
closeMarker = value.flags & I18nParamValueFlags.CloseTag ? TAG_CLOSE_MARKER : "";
|
|
10678
10860
|
}
|
|
10679
10861
|
const context = value.subTemplateIndex === null ? "" : `${CONTEXT_MARKER}${value.subTemplateIndex}`;
|
|
10680
|
-
if (value.flags & I18nParamValueFlags.OpenTag && value.flags & I18nParamValueFlags.CloseTag) {
|
|
10681
|
-
return `${ESCAPE}${tagMarker}${value.value}${context}${ESCAPE}${ESCAPE}${closeMarker}${tagMarker}${value.value}${context}${ESCAPE}`;
|
|
10682
|
-
}
|
|
10683
10862
|
return `${ESCAPE}${closeMarker}${tagMarker}${value.value}${context}${ESCAPE}`;
|
|
10684
10863
|
}
|
|
10685
10864
|
|
|
@@ -10700,7 +10879,7 @@ function generateAdvance(job) {
|
|
|
10700
10879
|
if (!hasDependsOnSlotContextTrait(op)) {
|
|
10701
10880
|
continue;
|
|
10702
10881
|
} else if (!slotMap.has(op.target)) {
|
|
10703
|
-
throw new Error(`AssertionError: reference to unknown slot for
|
|
10882
|
+
throw new Error(`AssertionError: reference to unknown slot for target ${op.target}`);
|
|
10704
10883
|
}
|
|
10705
10884
|
const slot = slotMap.get(op.target);
|
|
10706
10885
|
if (slotContext !== slot) {
|
|
@@ -10748,8 +10927,13 @@ function recursivelyProcessView(view, parentScope) {
|
|
|
10748
10927
|
for (const op of view.create) {
|
|
10749
10928
|
switch (op.kind) {
|
|
10750
10929
|
case OpKind.Template:
|
|
10930
|
+
recursivelyProcessView(view.job.views.get(op.xref), scope);
|
|
10931
|
+
break;
|
|
10751
10932
|
case OpKind.RepeaterCreate:
|
|
10752
10933
|
recursivelyProcessView(view.job.views.get(op.xref), scope);
|
|
10934
|
+
if (op.emptyView) {
|
|
10935
|
+
recursivelyProcessView(view.job.views.get(op.emptyView), scope);
|
|
10936
|
+
}
|
|
10753
10937
|
break;
|
|
10754
10938
|
case OpKind.Listener:
|
|
10755
10939
|
op.handlerOps.prepend(generateVariablesInScopeForView(view, scope));
|
|
@@ -16842,56 +17026,137 @@ function createEmptyMessagePart(location) {
|
|
|
16842
17026
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/i18n_const_collection.mjs
|
|
16843
17027
|
var NG_I18N_CLOSURE_MODE = "ngI18nClosureMode";
|
|
16844
17028
|
var TRANSLATION_VAR_PREFIX2 = "i18n_";
|
|
17029
|
+
var I18N_ICU_MAPPING_PREFIX2 = "I18N_EXP_";
|
|
17030
|
+
var ESCAPE2 = "\uFFFD";
|
|
16845
17031
|
function collectI18nConsts(job) {
|
|
17032
|
+
var _a2, _b2;
|
|
16846
17033
|
const fileBasedI18nSuffix = job.relativeContextFilePath.replace(/[^A-Za-z0-9]/g, "_").toUpperCase() + "_";
|
|
16847
|
-
const
|
|
17034
|
+
const extractedAttributesByI18nContext = /* @__PURE__ */ new Map();
|
|
17035
|
+
const i18nAttributesByElement = /* @__PURE__ */ new Map();
|
|
17036
|
+
const i18nExpressionsByElement = /* @__PURE__ */ new Map();
|
|
16848
17037
|
const messages = /* @__PURE__ */ new Map();
|
|
17038
|
+
for (const unit of job.units) {
|
|
17039
|
+
for (const op of unit.ops()) {
|
|
17040
|
+
if (op.kind === OpKind.ExtractedAttribute && op.i18nContext !== null) {
|
|
17041
|
+
const attributes = (_a2 = extractedAttributesByI18nContext.get(op.i18nContext)) != null ? _a2 : [];
|
|
17042
|
+
attributes.push(op);
|
|
17043
|
+
extractedAttributesByI18nContext.set(op.i18nContext, attributes);
|
|
17044
|
+
} else if (op.kind === OpKind.I18nAttributes) {
|
|
17045
|
+
i18nAttributesByElement.set(op.target, op);
|
|
17046
|
+
} else if (op.kind === OpKind.I18nExpression && op.usage === I18nExpressionFor.I18nAttribute) {
|
|
17047
|
+
const expressions = (_b2 = i18nExpressionsByElement.get(op.target)) != null ? _b2 : [];
|
|
17048
|
+
expressions.push(op);
|
|
17049
|
+
i18nExpressionsByElement.set(op.target, expressions);
|
|
17050
|
+
} else if (op.kind === OpKind.I18nMessage) {
|
|
17051
|
+
messages.set(op.xref, op);
|
|
17052
|
+
}
|
|
17053
|
+
}
|
|
17054
|
+
}
|
|
17055
|
+
const i18nValuesByContext = /* @__PURE__ */ new Map();
|
|
17056
|
+
const messageConstIndices = /* @__PURE__ */ new Map();
|
|
16849
17057
|
for (const unit of job.units) {
|
|
16850
17058
|
for (const op of unit.create) {
|
|
16851
17059
|
if (op.kind === OpKind.I18nMessage) {
|
|
16852
|
-
|
|
17060
|
+
if (op.messagePlaceholder === null) {
|
|
17061
|
+
const { mainVar, statements } = collectMessage(job, fileBasedI18nSuffix, messages, op);
|
|
17062
|
+
if (op.i18nBlock !== null) {
|
|
17063
|
+
const i18nConst = job.addConst(mainVar, statements);
|
|
17064
|
+
messageConstIndices.set(op.i18nBlock, i18nConst);
|
|
17065
|
+
} else {
|
|
17066
|
+
job.constsInitializers.push(...statements);
|
|
17067
|
+
i18nValuesByContext.set(op.i18nContext, mainVar);
|
|
17068
|
+
const attributesForMessage = extractedAttributesByI18nContext.get(op.i18nContext);
|
|
17069
|
+
if (attributesForMessage !== void 0) {
|
|
17070
|
+
for (const attr of attributesForMessage) {
|
|
17071
|
+
attr.expression = mainVar.clone();
|
|
17072
|
+
}
|
|
17073
|
+
}
|
|
17074
|
+
}
|
|
17075
|
+
}
|
|
16853
17076
|
OpList.remove(op);
|
|
16854
17077
|
}
|
|
16855
17078
|
}
|
|
16856
17079
|
}
|
|
16857
|
-
for (const
|
|
16858
|
-
|
|
16859
|
-
|
|
16860
|
-
|
|
17080
|
+
for (const unit of job.units) {
|
|
17081
|
+
for (const elem of unit.create) {
|
|
17082
|
+
if (isElementOrContainerOp(elem)) {
|
|
17083
|
+
const i18nAttributes2 = i18nAttributesByElement.get(elem.xref);
|
|
17084
|
+
if (i18nAttributes2 === void 0) {
|
|
17085
|
+
continue;
|
|
17086
|
+
}
|
|
17087
|
+
let i18nExpressions = i18nExpressionsByElement.get(elem.xref);
|
|
17088
|
+
if (i18nExpressions === void 0) {
|
|
17089
|
+
throw new Error("AssertionError: Could not find any i18n expressions associated with an I18nAttributes instruction");
|
|
17090
|
+
}
|
|
17091
|
+
const seenPropertyNames = /* @__PURE__ */ new Set();
|
|
17092
|
+
i18nExpressions = i18nExpressions.filter((i18nExpr) => {
|
|
17093
|
+
const seen = seenPropertyNames.has(i18nExpr.name);
|
|
17094
|
+
seenPropertyNames.add(i18nExpr.name);
|
|
17095
|
+
return !seen;
|
|
17096
|
+
});
|
|
17097
|
+
const i18nAttributeConfig = i18nExpressions.flatMap((i18nExpr) => {
|
|
17098
|
+
const i18nExprValue = i18nValuesByContext.get(i18nExpr.context);
|
|
17099
|
+
if (i18nExprValue === void 0) {
|
|
17100
|
+
throw new Error("AssertionError: Could not find i18n expression's value");
|
|
17101
|
+
}
|
|
17102
|
+
return [literal(i18nExpr.name), i18nExprValue];
|
|
17103
|
+
});
|
|
17104
|
+
i18nAttributes2.i18nAttributesConfig = job.addConst(new LiteralArrayExpr(i18nAttributeConfig));
|
|
17105
|
+
}
|
|
16861
17106
|
}
|
|
16862
17107
|
}
|
|
16863
17108
|
for (const unit of job.units) {
|
|
16864
17109
|
for (const op of unit.create) {
|
|
16865
17110
|
if (op.kind === OpKind.I18nStart) {
|
|
16866
|
-
|
|
17111
|
+
const msgIndex = messageConstIndices.get(op.root);
|
|
17112
|
+
if (msgIndex === void 0) {
|
|
17113
|
+
throw new Error("AssertionError: Could not find corresponding i18n block index for an i18n message op; was an i18n message incorrectly assumed to correspond to an attribute?");
|
|
17114
|
+
}
|
|
17115
|
+
op.messageIndex = msgIndex;
|
|
16867
17116
|
}
|
|
16868
17117
|
}
|
|
16869
17118
|
}
|
|
16870
17119
|
}
|
|
16871
17120
|
function collectMessage(job, fileBasedI18nSuffix, messages, messageOp) {
|
|
17121
|
+
var _a2;
|
|
16872
17122
|
const statements = [];
|
|
17123
|
+
const subMessagePlaceholders = /* @__PURE__ */ new Map();
|
|
16873
17124
|
for (const subMessageId of messageOp.subMessages) {
|
|
16874
17125
|
const subMessage = messages.get(subMessageId);
|
|
16875
17126
|
const { mainVar: subMessageVar, statements: subMessageStatements } = collectMessage(job, fileBasedI18nSuffix, messages, subMessage);
|
|
16876
17127
|
statements.push(...subMessageStatements);
|
|
16877
|
-
|
|
17128
|
+
const subMessages = (_a2 = subMessagePlaceholders.get(subMessage.messagePlaceholder)) != null ? _a2 : [];
|
|
17129
|
+
subMessages.push(subMessageVar);
|
|
17130
|
+
subMessagePlaceholders.set(subMessage.messagePlaceholder, subMessages);
|
|
16878
17131
|
}
|
|
17132
|
+
addSubMessageParams(messageOp, subMessagePlaceholders);
|
|
16879
17133
|
messageOp.params = new Map([...messageOp.params.entries()].sort());
|
|
16880
|
-
assertAllParamsResolved(messageOp);
|
|
16881
17134
|
const mainVar = variable(job.pool.uniqueName(TRANSLATION_VAR_PREFIX2));
|
|
16882
17135
|
const closureVar = i18nGenerateClosureVar(job.pool, messageOp.message.id, fileBasedI18nSuffix, job.i18nUseExternalIds);
|
|
16883
17136
|
let transformFn = void 0;
|
|
16884
17137
|
if (messageOp.needsPostprocessing) {
|
|
16885
|
-
|
|
17138
|
+
const postprocessingParams = Object.fromEntries([...messageOp.postprocessingParams.entries()].sort());
|
|
17139
|
+
const formattedPostprocessingParams = formatI18nPlaceholderNamesInMap(postprocessingParams, false);
|
|
16886
17140
|
const extraTransformFnParams = [];
|
|
16887
17141
|
if (messageOp.postprocessingParams.size > 0) {
|
|
16888
|
-
extraTransformFnParams.push(
|
|
17142
|
+
extraTransformFnParams.push(mapLiteral(formattedPostprocessingParams, true));
|
|
16889
17143
|
}
|
|
16890
17144
|
transformFn = (expr) => importExpr(Identifiers.i18nPostprocess).callFn([expr, ...extraTransformFnParams]);
|
|
16891
17145
|
}
|
|
16892
17146
|
statements.push(...getTranslationDeclStmts(messageOp.message, mainVar, closureVar, messageOp.params, transformFn));
|
|
16893
17147
|
return { mainVar, statements };
|
|
16894
17148
|
}
|
|
17149
|
+
function addSubMessageParams(messageOp, subMessagePlaceholders) {
|
|
17150
|
+
for (const [placeholder, subMessages] of subMessagePlaceholders) {
|
|
17151
|
+
if (subMessages.length === 1) {
|
|
17152
|
+
messageOp.params.set(placeholder, subMessages[0]);
|
|
17153
|
+
} else {
|
|
17154
|
+
messageOp.params.set(placeholder, literal(`${ESCAPE2}${I18N_ICU_MAPPING_PREFIX2}${placeholder}${ESCAPE2}`));
|
|
17155
|
+
messageOp.postprocessingParams.set(placeholder, literalArr(subMessages));
|
|
17156
|
+
messageOp.needsPostprocessing = true;
|
|
17157
|
+
}
|
|
17158
|
+
}
|
|
17159
|
+
}
|
|
16895
17160
|
function getTranslationDeclStmts(message, variable2, closureVar, params, transformFn) {
|
|
16896
17161
|
const paramsObject = Object.fromEntries(params);
|
|
16897
17162
|
const statements = [
|
|
@@ -16919,23 +17184,9 @@ function i18nGenerateClosureVar(pool, messageId, fileBasedI18nSuffix, useExterna
|
|
|
16919
17184
|
}
|
|
16920
17185
|
return variable(name);
|
|
16921
17186
|
}
|
|
16922
|
-
function assertAllParamsResolved(op) {
|
|
16923
|
-
for (let placeholder in op.message.placeholders) {
|
|
16924
|
-
placeholder = placeholder.trimEnd();
|
|
16925
|
-
if (!op.params.has(placeholder) && !op.postprocessingParams.has(placeholder)) {
|
|
16926
|
-
throw Error(`Failed to resolve i18n placeholder: ${placeholder}`);
|
|
16927
|
-
}
|
|
16928
|
-
}
|
|
16929
|
-
for (let placeholder in op.message.placeholderToMessage) {
|
|
16930
|
-
placeholder = placeholder.trimEnd();
|
|
16931
|
-
if (!op.params.has(placeholder) && !op.postprocessingParams.has(placeholder)) {
|
|
16932
|
-
throw Error(`Failed to resolve i18n message placeholder: ${placeholder}`);
|
|
16933
|
-
}
|
|
16934
|
-
}
|
|
16935
|
-
}
|
|
16936
17187
|
|
|
16937
17188
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/i18n_text_extraction.mjs
|
|
16938
|
-
function
|
|
17189
|
+
function convertI18nText(job) {
|
|
16939
17190
|
var _a2;
|
|
16940
17191
|
for (const unit of job.units) {
|
|
16941
17192
|
let currentI18n = null;
|
|
@@ -16984,7 +17235,7 @@ function extractI18nText(job) {
|
|
|
16984
17235
|
const ops = [];
|
|
16985
17236
|
for (let i = 0; i < op.interpolation.expressions.length; i++) {
|
|
16986
17237
|
const expr = op.interpolation.expressions[i];
|
|
16987
|
-
ops.push(createI18nExpressionOp(contextId, i18nOp.xref, i18nOp.handle, expr, op.i18nPlaceholders[i], resolutionTime, (_a2 = expr.sourceSpan) != null ? _a2 : op.sourceSpan));
|
|
17238
|
+
ops.push(createI18nExpressionOp(contextId, i18nOp.xref, i18nOp.xref, i18nOp.handle, expr, op.interpolation.i18nPlaceholders[i], resolutionTime, I18nExpressionFor.I18nText, "", (_a2 = expr.sourceSpan) != null ? _a2 : op.sourceSpan));
|
|
16988
17239
|
}
|
|
16989
17240
|
OpList.replaceWithMany(op, ops);
|
|
16990
17241
|
break;
|
|
@@ -17406,13 +17657,13 @@ function parseExtractedStyles(job) {
|
|
|
17406
17657
|
if (op.name === "style") {
|
|
17407
17658
|
const parsedStyles = parse(op.expression.value);
|
|
17408
17659
|
for (let i = 0; i < parsedStyles.length - 1; i += 2) {
|
|
17409
|
-
OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.StyleProperty, parsedStyles[i], literal(parsedStyles[i + 1])), op);
|
|
17660
|
+
OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.StyleProperty, parsedStyles[i], literal(parsedStyles[i + 1]), null, null, SecurityContext.STYLE), op);
|
|
17410
17661
|
}
|
|
17411
17662
|
OpList.remove(op);
|
|
17412
17663
|
} else if (op.name === "class") {
|
|
17413
17664
|
const parsedClasses = op.expression.value.trim().split(/\s+/g);
|
|
17414
17665
|
for (const parsedClass of parsedClasses) {
|
|
17415
|
-
OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.ClassName, parsedClass, null), op);
|
|
17666
|
+
OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.ClassName, parsedClass, null, null, null, SecurityContext.NONE), op);
|
|
17416
17667
|
}
|
|
17417
17668
|
OpList.remove(op);
|
|
17418
17669
|
}
|
|
@@ -17425,18 +17676,28 @@ function parseExtractedStyles(job) {
|
|
|
17425
17676
|
function removeContentSelectors(job) {
|
|
17426
17677
|
for (const unit of job.units) {
|
|
17427
17678
|
const elements = createOpXrefMap(unit);
|
|
17428
|
-
for (const op of unit.
|
|
17679
|
+
for (const op of unit.ops()) {
|
|
17429
17680
|
switch (op.kind) {
|
|
17430
17681
|
case OpKind.Binding:
|
|
17431
17682
|
const target = lookupInXrefMap(elements, op.target);
|
|
17432
|
-
if (op.name
|
|
17683
|
+
if (isSelectAttribute(op.name) && target.kind === OpKind.Projection) {
|
|
17433
17684
|
OpList.remove(op);
|
|
17434
17685
|
}
|
|
17435
17686
|
break;
|
|
17687
|
+
case OpKind.Projection:
|
|
17688
|
+
for (let i = op.attributes.length - 2; i >= 0; i -= 2) {
|
|
17689
|
+
if (isSelectAttribute(op.attributes[i])) {
|
|
17690
|
+
op.attributes.splice(i, 2);
|
|
17691
|
+
}
|
|
17692
|
+
}
|
|
17693
|
+
break;
|
|
17436
17694
|
}
|
|
17437
17695
|
}
|
|
17438
17696
|
}
|
|
17439
17697
|
}
|
|
17698
|
+
function isSelectAttribute(name) {
|
|
17699
|
+
return name.toLowerCase() === "select";
|
|
17700
|
+
}
|
|
17440
17701
|
function lookupInXrefMap(map, xref) {
|
|
17441
17702
|
const el = map.get(xref);
|
|
17442
17703
|
if (el === void 0) {
|
|
@@ -17523,22 +17784,35 @@ function propagateI18nBlocksToTemplates(unit, subTemplateIndex) {
|
|
|
17523
17784
|
i18nBlock = op;
|
|
17524
17785
|
break;
|
|
17525
17786
|
case OpKind.I18nEnd:
|
|
17787
|
+
if (i18nBlock.subTemplateIndex === null) {
|
|
17788
|
+
subTemplateIndex = 0;
|
|
17789
|
+
}
|
|
17526
17790
|
i18nBlock = null;
|
|
17527
17791
|
break;
|
|
17528
17792
|
case OpKind.Template:
|
|
17529
|
-
|
|
17530
|
-
|
|
17531
|
-
|
|
17532
|
-
|
|
17533
|
-
|
|
17534
|
-
|
|
17535
|
-
|
|
17793
|
+
subTemplateIndex = propagateI18nBlocksForView(unit.job.views.get(op.xref), i18nBlock, op.i18nPlaceholder, subTemplateIndex);
|
|
17794
|
+
break;
|
|
17795
|
+
case OpKind.RepeaterCreate:
|
|
17796
|
+
const forView = unit.job.views.get(op.xref);
|
|
17797
|
+
subTemplateIndex = propagateI18nBlocksForView(unit.job.views.get(op.xref), i18nBlock, op.i18nPlaceholder, subTemplateIndex);
|
|
17798
|
+
if (op.emptyView !== null) {
|
|
17799
|
+
subTemplateIndex = propagateI18nBlocksForView(unit.job.views.get(op.emptyView), i18nBlock, op.emptyI18nPlaceholder, subTemplateIndex);
|
|
17536
17800
|
}
|
|
17537
|
-
|
|
17801
|
+
break;
|
|
17538
17802
|
}
|
|
17539
17803
|
}
|
|
17540
17804
|
return subTemplateIndex;
|
|
17541
17805
|
}
|
|
17806
|
+
function propagateI18nBlocksForView(view, i18nBlock, i18nPlaceholder, subTemplateIndex) {
|
|
17807
|
+
if (i18nPlaceholder !== void 0) {
|
|
17808
|
+
if (i18nBlock === null) {
|
|
17809
|
+
throw Error("Expected template with i18n placeholder to be in an i18n block.");
|
|
17810
|
+
}
|
|
17811
|
+
subTemplateIndex++;
|
|
17812
|
+
wrapTemplateWithI18n(view, i18nBlock);
|
|
17813
|
+
}
|
|
17814
|
+
return propagateI18nBlocksToTemplates(view, subTemplateIndex);
|
|
17815
|
+
}
|
|
17542
17816
|
function wrapTemplateWithI18n(unit, parentI18n) {
|
|
17543
17817
|
var _a2;
|
|
17544
17818
|
if (((_a2 = unit.create.head.next) == null ? void 0 : _a2.kind) !== OpKind.I18nStart) {
|
|
@@ -17695,17 +17969,13 @@ function disableBindings2() {
|
|
|
17695
17969
|
function enableBindings() {
|
|
17696
17970
|
return call(Identifiers.enableBindings, [], null);
|
|
17697
17971
|
}
|
|
17698
|
-
function listener(name, handlerFn, sourceSpan) {
|
|
17699
|
-
|
|
17700
|
-
|
|
17701
|
-
|
|
17702
|
-
|
|
17703
|
-
}
|
|
17704
|
-
|
|
17705
|
-
return call(Identifiers.syntheticHostListener, [
|
|
17706
|
-
literal(name),
|
|
17707
|
-
handlerFn
|
|
17708
|
-
], sourceSpan);
|
|
17972
|
+
function listener(name, handlerFn, eventTargetResolver, syntheticHost, sourceSpan) {
|
|
17973
|
+
const args = [literal(name), handlerFn];
|
|
17974
|
+
if (eventTargetResolver !== null) {
|
|
17975
|
+
args.push(literal(false));
|
|
17976
|
+
args.push(importExpr(eventTargetResolver));
|
|
17977
|
+
}
|
|
17978
|
+
return call(syntheticHost ? Identifiers.syntheticHostListener : Identifiers.listener, args, sourceSpan);
|
|
17709
17979
|
}
|
|
17710
17980
|
function pipe(slot, name) {
|
|
17711
17981
|
return call(Identifiers.pipe, [
|
|
@@ -17852,6 +18122,10 @@ function i18n(slot, constIndex, subTemplateIndex) {
|
|
|
17852
18122
|
function i18nEnd() {
|
|
17853
18123
|
return call(Identifiers.i18nEnd, [], null);
|
|
17854
18124
|
}
|
|
18125
|
+
function i18nAttributes(slot, i18nAttributesConfig) {
|
|
18126
|
+
const args = [literal(slot), literal(i18nAttributesConfig)];
|
|
18127
|
+
return call(Identifiers.i18nAttributes, args, null);
|
|
18128
|
+
}
|
|
17855
18129
|
function property(name, expression, sanitizer, sourceSpan) {
|
|
17856
18130
|
const args = [literal(name), expression];
|
|
17857
18131
|
if (sanitizer !== null) {
|
|
@@ -17960,8 +18234,12 @@ function classMapInterpolate(strings, expressions, sourceSpan) {
|
|
|
17960
18234
|
const interpolationArgs = collateInterpolationArgs(strings, expressions);
|
|
17961
18235
|
return callVariadicInstruction(CLASS_MAP_INTERPOLATE_CONFIG, [], interpolationArgs, [], sourceSpan);
|
|
17962
18236
|
}
|
|
17963
|
-
function hostProperty(name, expression, sourceSpan) {
|
|
17964
|
-
|
|
18237
|
+
function hostProperty(name, expression, sanitizer, sourceSpan) {
|
|
18238
|
+
const args = [literal(name), expression];
|
|
18239
|
+
if (sanitizer !== null) {
|
|
18240
|
+
args.push(sanitizer);
|
|
18241
|
+
}
|
|
18242
|
+
return call(Identifiers.hostProperty, args, sourceSpan);
|
|
17965
18243
|
}
|
|
17966
18244
|
function syntheticHostProperty(name, expression, sourceSpan) {
|
|
17967
18245
|
return call(Identifiers.syntheticHostProperty, [literal(name), expression], sourceSpan);
|
|
@@ -18149,13 +18427,10 @@ function callVariadicInstruction(config, baseArgs, interpolationArgs, extraArgs,
|
|
|
18149
18427
|
}
|
|
18150
18428
|
|
|
18151
18429
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/reify.mjs
|
|
18152
|
-
var
|
|
18153
|
-
[
|
|
18154
|
-
[
|
|
18155
|
-
[
|
|
18156
|
-
[SanitizerFn.Script, Identifiers.sanitizeScript],
|
|
18157
|
-
[SanitizerFn.Style, Identifiers.sanitizeStyle],
|
|
18158
|
-
[SanitizerFn.Url, Identifiers.sanitizeUrl]
|
|
18430
|
+
var GLOBAL_TARGET_RESOLVERS = /* @__PURE__ */ new Map([
|
|
18431
|
+
["window", Identifiers.resolveWindow],
|
|
18432
|
+
["document", Identifiers.resolveDocument],
|
|
18433
|
+
["body", Identifiers.resolveBody]
|
|
18159
18434
|
]);
|
|
18160
18435
|
function reify(job) {
|
|
18161
18436
|
for (const unit of job.units) {
|
|
@@ -18198,6 +18473,12 @@ function reifyCreateOperations(unit, ops) {
|
|
|
18198
18473
|
case OpKind.I18n:
|
|
18199
18474
|
OpList.replace(op, i18n(op.handle.slot, op.messageIndex, op.subTemplateIndex));
|
|
18200
18475
|
break;
|
|
18476
|
+
case OpKind.I18nAttributes:
|
|
18477
|
+
if (op.i18nAttributesConfig === null) {
|
|
18478
|
+
throw new Error(`AssertionError: i18nAttributesConfig was not set`);
|
|
18479
|
+
}
|
|
18480
|
+
OpList.replace(op, i18nAttributes(op.handle.slot, op.i18nAttributesConfig));
|
|
18481
|
+
break;
|
|
18201
18482
|
case OpKind.Template:
|
|
18202
18483
|
if (!(unit instanceof ViewCompilationUnit)) {
|
|
18203
18484
|
throw new Error(`AssertionError: must be compiling a component`);
|
|
@@ -18219,8 +18500,11 @@ function reifyCreateOperations(unit, ops) {
|
|
|
18219
18500
|
break;
|
|
18220
18501
|
case OpKind.Listener:
|
|
18221
18502
|
const listenerFn = reifyListenerHandler(unit, op.handlerFnName, op.handlerOps, op.consumesDollarEvent);
|
|
18222
|
-
const
|
|
18223
|
-
|
|
18503
|
+
const eventTargetResolver = op.eventTarget ? GLOBAL_TARGET_RESOLVERS.get(op.eventTarget) : null;
|
|
18504
|
+
if (eventTargetResolver === void 0) {
|
|
18505
|
+
throw new Error(`AssertionError: unknown event target ${op.eventTarget}`);
|
|
18506
|
+
}
|
|
18507
|
+
OpList.replace(op, listener(op.name, listenerFn, eventTargetResolver, op.hostListener && op.isAnimationListener, op.sourceSpan));
|
|
18224
18508
|
break;
|
|
18225
18509
|
case OpKind.Variable:
|
|
18226
18510
|
if (op.variable.name === null) {
|
|
@@ -18375,7 +18659,7 @@ function reifyUpdateOperations(_unit, ops) {
|
|
|
18375
18659
|
if (op.isAnimationTrigger) {
|
|
18376
18660
|
OpList.replace(op, syntheticHostProperty(op.name, op.expression, op.sourceSpan));
|
|
18377
18661
|
} else {
|
|
18378
|
-
OpList.replace(op, hostProperty(op.name, op.expression, op.sourceSpan));
|
|
18662
|
+
OpList.replace(op, hostProperty(op.name, op.expression, op.sanitizer, op.sourceSpan));
|
|
18379
18663
|
}
|
|
18380
18664
|
}
|
|
18381
18665
|
break;
|
|
@@ -18453,8 +18737,6 @@ function reifyIrExpression(expr) {
|
|
|
18453
18737
|
return pipeBind(expr.targetSlot.slot, expr.varOffset, expr.args);
|
|
18454
18738
|
case ExpressionKind.PipeBindingVariadic:
|
|
18455
18739
|
return pipeBindV(expr.targetSlot.slot, expr.varOffset, expr.args);
|
|
18456
|
-
case ExpressionKind.SanitizerExpr:
|
|
18457
|
-
return importExpr(sanitizerIdentifierMap.get(expr.fn));
|
|
18458
18740
|
case ExpressionKind.SlotLiteralExpr:
|
|
18459
18741
|
return literal(expr.slot.slot);
|
|
18460
18742
|
default:
|
|
@@ -18514,6 +18796,28 @@ function removeI18nContexts(job) {
|
|
|
18514
18796
|
}
|
|
18515
18797
|
}
|
|
18516
18798
|
|
|
18799
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/remove_unused_i18n_attrs.mjs
|
|
18800
|
+
function removeUnusedI18nAttributesOps(job) {
|
|
18801
|
+
for (const unit of job.units) {
|
|
18802
|
+
const ownersWithI18nExpressions = /* @__PURE__ */ new Set();
|
|
18803
|
+
for (const op of unit.update) {
|
|
18804
|
+
switch (op.kind) {
|
|
18805
|
+
case OpKind.I18nExpression:
|
|
18806
|
+
ownersWithI18nExpressions.add(op.i18nOwner);
|
|
18807
|
+
}
|
|
18808
|
+
}
|
|
18809
|
+
for (const op of unit.create) {
|
|
18810
|
+
switch (op.kind) {
|
|
18811
|
+
case OpKind.I18nAttributes:
|
|
18812
|
+
if (ownersWithI18nExpressions.has(op.xref)) {
|
|
18813
|
+
continue;
|
|
18814
|
+
}
|
|
18815
|
+
OpList.remove(op);
|
|
18816
|
+
}
|
|
18817
|
+
}
|
|
18818
|
+
}
|
|
18819
|
+
}
|
|
18820
|
+
|
|
18517
18821
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/repeater_derived_vars.mjs
|
|
18518
18822
|
function generateRepeaterDerivedVars(job) {
|
|
18519
18823
|
const repeaters = /* @__PURE__ */ new Map();
|
|
@@ -18626,8 +18930,9 @@ function resolveI18nElementPlaceholders(job) {
|
|
|
18626
18930
|
}
|
|
18627
18931
|
resolvePlaceholdersForView(job, job.root, i18nContexts, elements);
|
|
18628
18932
|
}
|
|
18629
|
-
function resolvePlaceholdersForView(job, unit, i18nContexts, elements) {
|
|
18933
|
+
function resolvePlaceholdersForView(job, unit, i18nContexts, elements, pendingStructuralDirective) {
|
|
18630
18934
|
let currentOps = null;
|
|
18935
|
+
let pendingStructuralDirectiveCloses = /* @__PURE__ */ new Map();
|
|
18631
18936
|
for (const op of unit.create) {
|
|
18632
18937
|
switch (op.kind) {
|
|
18633
18938
|
case OpKind.I18nStart:
|
|
@@ -18644,52 +18949,135 @@ function resolvePlaceholdersForView(job, unit, i18nContexts, elements) {
|
|
|
18644
18949
|
if (currentOps === null) {
|
|
18645
18950
|
throw Error("i18n tag placeholder should only occur inside an i18n block");
|
|
18646
18951
|
}
|
|
18647
|
-
|
|
18648
|
-
|
|
18649
|
-
|
|
18650
|
-
flags |= I18nParamValueFlags.CloseTag;
|
|
18952
|
+
recordElementStart(op, currentOps.i18nContext, currentOps.i18nBlock, pendingStructuralDirective);
|
|
18953
|
+
if (pendingStructuralDirective && op.i18nPlaceholder.closeName) {
|
|
18954
|
+
pendingStructuralDirectiveCloses.set(op.xref, pendingStructuralDirective);
|
|
18651
18955
|
}
|
|
18652
|
-
|
|
18956
|
+
pendingStructuralDirective = void 0;
|
|
18653
18957
|
}
|
|
18654
18958
|
break;
|
|
18655
18959
|
case OpKind.ElementEnd:
|
|
18656
18960
|
const startOp = elements.get(op.xref);
|
|
18657
18961
|
if (startOp && startOp.i18nPlaceholder !== void 0) {
|
|
18658
18962
|
if (currentOps === null) {
|
|
18659
|
-
throw Error("i18n tag placeholder should only occur inside an i18n block");
|
|
18660
|
-
}
|
|
18661
|
-
const { closeName } = startOp.i18nPlaceholder;
|
|
18662
|
-
if (closeName !== "") {
|
|
18663
|
-
addParam(currentOps.i18nContext.params, closeName, startOp.handle.slot, currentOps.i18nBlock.subTemplateIndex, I18nParamValueFlags.ElementTag | I18nParamValueFlags.CloseTag);
|
|
18963
|
+
throw Error("AssertionError: i18n tag placeholder should only occur inside an i18n block");
|
|
18664
18964
|
}
|
|
18965
|
+
recordElementClose(startOp, currentOps.i18nContext, currentOps.i18nBlock, pendingStructuralDirectiveCloses.get(op.xref));
|
|
18966
|
+
pendingStructuralDirectiveCloses.delete(op.xref);
|
|
18665
18967
|
}
|
|
18666
18968
|
break;
|
|
18667
|
-
case OpKind.
|
|
18969
|
+
case OpKind.Projection:
|
|
18668
18970
|
if (op.i18nPlaceholder !== void 0) {
|
|
18669
18971
|
if (currentOps === null) {
|
|
18670
18972
|
throw Error("i18n tag placeholder should only occur inside an i18n block");
|
|
18671
18973
|
}
|
|
18672
|
-
|
|
18673
|
-
|
|
18674
|
-
|
|
18675
|
-
|
|
18676
|
-
|
|
18677
|
-
|
|
18974
|
+
recordElementStart(op, currentOps.i18nContext, currentOps.i18nBlock, pendingStructuralDirective);
|
|
18975
|
+
recordElementClose(op, currentOps.i18nContext, currentOps.i18nBlock, pendingStructuralDirective);
|
|
18976
|
+
pendingStructuralDirective = void 0;
|
|
18977
|
+
}
|
|
18978
|
+
break;
|
|
18979
|
+
case OpKind.Template:
|
|
18980
|
+
const view = job.views.get(op.xref);
|
|
18981
|
+
if (op.i18nPlaceholder === void 0) {
|
|
18982
|
+
resolvePlaceholdersForView(job, view, i18nContexts, elements);
|
|
18983
|
+
} else {
|
|
18984
|
+
if (currentOps === null) {
|
|
18985
|
+
throw Error("i18n tag placeholder should only occur inside an i18n block");
|
|
18678
18986
|
}
|
|
18679
|
-
|
|
18680
|
-
|
|
18681
|
-
|
|
18682
|
-
|
|
18987
|
+
if (op.templateKind === TemplateKind.Structural) {
|
|
18988
|
+
resolvePlaceholdersForView(job, view, i18nContexts, elements, op);
|
|
18989
|
+
} else {
|
|
18990
|
+
recordTemplateStart(job, view, op.handle.slot, op.i18nPlaceholder, currentOps.i18nContext, currentOps.i18nBlock, pendingStructuralDirective);
|
|
18991
|
+
resolvePlaceholdersForView(job, view, i18nContexts, elements);
|
|
18992
|
+
recordTemplateClose(job, view, op.handle.slot, op.i18nPlaceholder, currentOps.i18nContext, currentOps.i18nBlock, pendingStructuralDirective);
|
|
18993
|
+
pendingStructuralDirective = void 0;
|
|
18683
18994
|
}
|
|
18995
|
+
}
|
|
18996
|
+
break;
|
|
18997
|
+
case OpKind.RepeaterCreate:
|
|
18998
|
+
if (pendingStructuralDirective !== void 0) {
|
|
18999
|
+
throw Error("AssertionError: Unexpected structural directive associated with @for block");
|
|
19000
|
+
}
|
|
19001
|
+
const forSlot = op.handle.slot + 1;
|
|
19002
|
+
const forView = job.views.get(op.xref);
|
|
19003
|
+
if (op.i18nPlaceholder === void 0) {
|
|
19004
|
+
resolvePlaceholdersForView(job, forView, i18nContexts, elements);
|
|
18684
19005
|
} else {
|
|
18685
|
-
|
|
19006
|
+
if (currentOps === null) {
|
|
19007
|
+
throw Error("i18n tag placeholder should only occur inside an i18n block");
|
|
19008
|
+
}
|
|
19009
|
+
recordTemplateStart(job, forView, forSlot, op.i18nPlaceholder, currentOps.i18nContext, currentOps.i18nBlock, pendingStructuralDirective);
|
|
19010
|
+
resolvePlaceholdersForView(job, forView, i18nContexts, elements);
|
|
19011
|
+
recordTemplateClose(job, forView, forSlot, op.i18nPlaceholder, currentOps.i18nContext, currentOps.i18nBlock, pendingStructuralDirective);
|
|
19012
|
+
pendingStructuralDirective = void 0;
|
|
19013
|
+
}
|
|
19014
|
+
if (op.emptyView !== null) {
|
|
19015
|
+
const emptySlot = op.handle.slot + 2;
|
|
19016
|
+
const emptyView = job.views.get(op.emptyView);
|
|
19017
|
+
if (op.emptyI18nPlaceholder === void 0) {
|
|
19018
|
+
resolvePlaceholdersForView(job, emptyView, i18nContexts, elements);
|
|
19019
|
+
} else {
|
|
19020
|
+
if (currentOps === null) {
|
|
19021
|
+
throw Error("i18n tag placeholder should only occur inside an i18n block");
|
|
19022
|
+
}
|
|
19023
|
+
recordTemplateStart(job, emptyView, emptySlot, op.emptyI18nPlaceholder, currentOps.i18nContext, currentOps.i18nBlock, pendingStructuralDirective);
|
|
19024
|
+
resolvePlaceholdersForView(job, emptyView, i18nContexts, elements);
|
|
19025
|
+
recordTemplateClose(job, emptyView, emptySlot, op.emptyI18nPlaceholder, currentOps.i18nContext, currentOps.i18nBlock, pendingStructuralDirective);
|
|
19026
|
+
pendingStructuralDirective = void 0;
|
|
19027
|
+
}
|
|
18686
19028
|
}
|
|
18687
19029
|
break;
|
|
18688
19030
|
}
|
|
18689
19031
|
}
|
|
18690
19032
|
}
|
|
18691
|
-
function
|
|
18692
|
-
|
|
19033
|
+
function recordElementStart(op, i18nContext, i18nBlock, structuralDirective) {
|
|
19034
|
+
const { startName, closeName } = op.i18nPlaceholder;
|
|
19035
|
+
let flags = I18nParamValueFlags.ElementTag | I18nParamValueFlags.OpenTag;
|
|
19036
|
+
let value = op.handle.slot;
|
|
19037
|
+
if (structuralDirective !== void 0) {
|
|
19038
|
+
flags |= I18nParamValueFlags.TemplateTag;
|
|
19039
|
+
value = { element: value, template: structuralDirective.handle.slot };
|
|
19040
|
+
}
|
|
19041
|
+
if (!closeName) {
|
|
19042
|
+
flags |= I18nParamValueFlags.CloseTag;
|
|
19043
|
+
}
|
|
19044
|
+
addParam(i18nContext.params, startName, value, i18nBlock.subTemplateIndex, flags);
|
|
19045
|
+
}
|
|
19046
|
+
function recordElementClose(op, i18nContext, i18nBlock, structuralDirective) {
|
|
19047
|
+
const { closeName } = op.i18nPlaceholder;
|
|
19048
|
+
if (closeName) {
|
|
19049
|
+
let flags = I18nParamValueFlags.ElementTag | I18nParamValueFlags.CloseTag;
|
|
19050
|
+
let value = op.handle.slot;
|
|
19051
|
+
if (structuralDirective !== void 0) {
|
|
19052
|
+
flags |= I18nParamValueFlags.TemplateTag;
|
|
19053
|
+
value = { element: value, template: structuralDirective.handle.slot };
|
|
19054
|
+
}
|
|
19055
|
+
addParam(i18nContext.params, closeName, value, i18nBlock.subTemplateIndex, flags);
|
|
19056
|
+
}
|
|
19057
|
+
}
|
|
19058
|
+
function recordTemplateStart(job, view, slot, i18nPlaceholder, i18nContext, i18nBlock, structuralDirective) {
|
|
19059
|
+
let { startName, closeName } = i18nPlaceholder;
|
|
19060
|
+
let flags = I18nParamValueFlags.TemplateTag | I18nParamValueFlags.OpenTag;
|
|
19061
|
+
if (!closeName) {
|
|
19062
|
+
flags |= I18nParamValueFlags.CloseTag;
|
|
19063
|
+
}
|
|
19064
|
+
if (structuralDirective !== void 0) {
|
|
19065
|
+
addParam(i18nContext.params, startName, structuralDirective.handle.slot, i18nBlock.subTemplateIndex, flags);
|
|
19066
|
+
}
|
|
19067
|
+
addParam(i18nContext.params, startName, slot, getSubTemplateIndexForTemplateTag(job, i18nBlock, view), flags);
|
|
19068
|
+
}
|
|
19069
|
+
function recordTemplateClose(job, view, slot, i18nPlaceholder, i18nContext, i18nBlock, structuralDirective) {
|
|
19070
|
+
const { startName, closeName } = i18nPlaceholder;
|
|
19071
|
+
const flags = I18nParamValueFlags.TemplateTag | I18nParamValueFlags.CloseTag;
|
|
19072
|
+
if (closeName) {
|
|
19073
|
+
addParam(i18nContext.params, closeName, slot, getSubTemplateIndexForTemplateTag(job, i18nBlock, view), flags);
|
|
19074
|
+
if (structuralDirective !== void 0) {
|
|
19075
|
+
addParam(i18nContext.params, closeName, structuralDirective.handle.slot, i18nBlock.subTemplateIndex, flags);
|
|
19076
|
+
}
|
|
19077
|
+
}
|
|
19078
|
+
}
|
|
19079
|
+
function getSubTemplateIndexForTemplateTag(job, i18nOp, view) {
|
|
19080
|
+
for (const childOp of view.create) {
|
|
18693
19081
|
if (childOp.kind === OpKind.I18nStart) {
|
|
18694
19082
|
return childOp.subTemplateIndex;
|
|
18695
19083
|
}
|
|
@@ -18705,6 +19093,7 @@ function addParam(params, placeholder, value, subTemplateIndex, flags) {
|
|
|
18705
19093
|
|
|
18706
19094
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_i18n_expression_placeholders.mjs
|
|
18707
19095
|
function resolveI18nExpressionPlaceholders(job) {
|
|
19096
|
+
var _a2;
|
|
18708
19097
|
const subTemplateIndicies = /* @__PURE__ */ new Map();
|
|
18709
19098
|
const i18nContexts = /* @__PURE__ */ new Map();
|
|
18710
19099
|
for (const unit of job.units) {
|
|
@@ -18720,12 +19109,13 @@ function resolveI18nExpressionPlaceholders(job) {
|
|
|
18720
19109
|
}
|
|
18721
19110
|
}
|
|
18722
19111
|
const expressionIndices = /* @__PURE__ */ new Map();
|
|
19112
|
+
const referenceIndex = (op) => op.usage === I18nExpressionFor.I18nText ? op.i18nOwner : op.context;
|
|
18723
19113
|
for (const unit of job.units) {
|
|
18724
19114
|
for (const op of unit.update) {
|
|
18725
19115
|
if (op.kind === OpKind.I18nExpression) {
|
|
18726
19116
|
const i18nContext = i18nContexts.get(op.context);
|
|
18727
|
-
const index = expressionIndices.get(op
|
|
18728
|
-
const subTemplateIndex = subTemplateIndicies.get(op.
|
|
19117
|
+
const index = expressionIndices.get(referenceIndex(op)) || 0;
|
|
19118
|
+
const subTemplateIndex = (_a2 = subTemplateIndicies.get(op.i18nOwner)) != null ? _a2 : null;
|
|
18729
19119
|
const params = op.resolutionTime === I18nParamResolutionTime.Creation ? i18nContext.params : i18nContext.postprocessingParams;
|
|
18730
19120
|
const values = params.get(op.i18nPlaceholder) || [];
|
|
18731
19121
|
values.push({
|
|
@@ -18734,7 +19124,7 @@ function resolveI18nExpressionPlaceholders(job) {
|
|
|
18734
19124
|
flags: I18nParamValueFlags.ExpressionIndex
|
|
18735
19125
|
});
|
|
18736
19126
|
params.set(op.i18nPlaceholder, values);
|
|
18737
|
-
expressionIndices.set(op
|
|
19127
|
+
expressionIndices.set(referenceIndex(op), index + 1);
|
|
18738
19128
|
}
|
|
18739
19129
|
}
|
|
18740
19130
|
}
|
|
@@ -18849,30 +19239,54 @@ function processLexicalScope2(unit, ops, savedView) {
|
|
|
18849
19239
|
}
|
|
18850
19240
|
|
|
18851
19241
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_sanitizers.mjs
|
|
18852
|
-
var
|
|
18853
|
-
[SecurityContext.HTML,
|
|
18854
|
-
[SecurityContext.
|
|
18855
|
-
[SecurityContext.
|
|
18856
|
-
[SecurityContext.
|
|
18857
|
-
[SecurityContext.
|
|
19242
|
+
var sanitizerFns = /* @__PURE__ */ new Map([
|
|
19243
|
+
[SecurityContext.HTML, Identifiers.sanitizeHtml],
|
|
19244
|
+
[SecurityContext.RESOURCE_URL, Identifiers.sanitizeResourceUrl],
|
|
19245
|
+
[SecurityContext.SCRIPT, Identifiers.sanitizeScript],
|
|
19246
|
+
[SecurityContext.STYLE, Identifiers.sanitizeStyle],
|
|
19247
|
+
[SecurityContext.URL, Identifiers.sanitizeUrl]
|
|
19248
|
+
]);
|
|
19249
|
+
var trustedValueFns = /* @__PURE__ */ new Map([
|
|
19250
|
+
[SecurityContext.HTML, Identifiers.trustConstantHtml],
|
|
19251
|
+
[SecurityContext.RESOURCE_URL, Identifiers.trustConstantResourceUrl]
|
|
18858
19252
|
]);
|
|
18859
19253
|
function resolveSanitizers(job) {
|
|
19254
|
+
var _a2, _b2;
|
|
18860
19255
|
for (const unit of job.units) {
|
|
18861
19256
|
const elements = createOpXrefMap(unit);
|
|
18862
|
-
|
|
19257
|
+
if (job.kind !== CompilationJobKind.Host) {
|
|
19258
|
+
for (const op of unit.create) {
|
|
19259
|
+
if (op.kind === OpKind.ExtractedAttribute) {
|
|
19260
|
+
const trustedValueFn = (_a2 = trustedValueFns.get(getOnlySecurityContext(op.securityContext))) != null ? _a2 : null;
|
|
19261
|
+
op.trustedValueFn = trustedValueFn !== null ? importExpr(trustedValueFn) : null;
|
|
19262
|
+
}
|
|
19263
|
+
}
|
|
19264
|
+
}
|
|
18863
19265
|
for (const op of unit.update) {
|
|
18864
19266
|
switch (op.kind) {
|
|
18865
19267
|
case OpKind.Property:
|
|
18866
19268
|
case OpKind.Attribute:
|
|
18867
|
-
|
|
18868
|
-
|
|
19269
|
+
case OpKind.HostProperty:
|
|
19270
|
+
let sanitizerFn = null;
|
|
19271
|
+
if (Array.isArray(op.securityContext) && op.securityContext.length === 2 && op.securityContext.indexOf(SecurityContext.URL) > -1 && op.securityContext.indexOf(SecurityContext.RESOURCE_URL) > -1) {
|
|
19272
|
+
sanitizerFn = Identifiers.sanitizeUrlOrResourceUrl;
|
|
19273
|
+
} else {
|
|
19274
|
+
sanitizerFn = (_b2 = sanitizerFns.get(getOnlySecurityContext(op.securityContext))) != null ? _b2 : null;
|
|
19275
|
+
}
|
|
19276
|
+
op.sanitizer = sanitizerFn !== null ? importExpr(sanitizerFn) : null;
|
|
18869
19277
|
if (op.sanitizer === null) {
|
|
18870
|
-
|
|
18871
|
-
if (
|
|
18872
|
-
|
|
19278
|
+
let isIframe = false;
|
|
19279
|
+
if (job.kind === CompilationJobKind.Host || op.kind === OpKind.HostProperty) {
|
|
19280
|
+
isIframe = true;
|
|
19281
|
+
} else {
|
|
19282
|
+
const ownerOp = elements.get(op.target);
|
|
19283
|
+
if (ownerOp === void 0 || !isElementOrContainerOp(ownerOp)) {
|
|
19284
|
+
throw Error("Property should have an element-like owner");
|
|
19285
|
+
}
|
|
19286
|
+
isIframe = isIframeElement(ownerOp);
|
|
18873
19287
|
}
|
|
18874
|
-
if (
|
|
18875
|
-
op.sanitizer =
|
|
19288
|
+
if (isIframe && isIframeSecuritySensitiveAttr(op.name)) {
|
|
19289
|
+
op.sanitizer = importExpr(Identifiers.validateIframeAttribute);
|
|
18876
19290
|
}
|
|
18877
19291
|
}
|
|
18878
19292
|
break;
|
|
@@ -18884,6 +19298,15 @@ function isIframeElement(op) {
|
|
|
18884
19298
|
var _a2;
|
|
18885
19299
|
return op.kind === OpKind.ElementStart && ((_a2 = op.tag) == null ? void 0 : _a2.toLowerCase()) === "iframe";
|
|
18886
19300
|
}
|
|
19301
|
+
function getOnlySecurityContext(securityContext) {
|
|
19302
|
+
if (Array.isArray(securityContext)) {
|
|
19303
|
+
if (securityContext.length > 1) {
|
|
19304
|
+
throw Error(`AssertionError: Ambiguous security context`);
|
|
19305
|
+
}
|
|
19306
|
+
return securityContext[0] || SecurityContext.NONE;
|
|
19307
|
+
}
|
|
19308
|
+
return securityContext;
|
|
19309
|
+
}
|
|
18887
19310
|
|
|
18888
19311
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/save_restore_view.mjs
|
|
18889
19312
|
function saveAndRestoreView(job) {
|
|
@@ -19531,12 +19954,12 @@ var phases = [
|
|
|
19531
19954
|
{ kind: CompilationJobKind.Tmpl, fn: removeContentSelectors },
|
|
19532
19955
|
{ kind: CompilationJobKind.Host, fn: parseHostStyleProperties },
|
|
19533
19956
|
{ kind: CompilationJobKind.Tmpl, fn: emitNamespaceChanges },
|
|
19534
|
-
{ kind: CompilationJobKind.Both, fn: specializeStyleBindings },
|
|
19535
|
-
{ kind: CompilationJobKind.Both, fn: specializeBindings },
|
|
19536
19957
|
{ kind: CompilationJobKind.Tmpl, fn: propagateI18nBlocks },
|
|
19537
19958
|
{ kind: CompilationJobKind.Tmpl, fn: wrapI18nIcus },
|
|
19538
|
-
{ kind: CompilationJobKind.
|
|
19959
|
+
{ kind: CompilationJobKind.Both, fn: specializeStyleBindings },
|
|
19960
|
+
{ kind: CompilationJobKind.Both, fn: specializeBindings },
|
|
19539
19961
|
{ kind: CompilationJobKind.Both, fn: extractAttributes },
|
|
19962
|
+
{ kind: CompilationJobKind.Tmpl, fn: createI18nContexts },
|
|
19540
19963
|
{ kind: CompilationJobKind.Both, fn: parseExtractedStyles },
|
|
19541
19964
|
{ kind: CompilationJobKind.Tmpl, fn: removeEmptyBindings },
|
|
19542
19965
|
{ kind: CompilationJobKind.Both, fn: collapseSingletonInterpolations },
|
|
@@ -19544,14 +19967,17 @@ var phases = [
|
|
|
19544
19967
|
{ kind: CompilationJobKind.Tmpl, fn: generateConditionalExpressions },
|
|
19545
19968
|
{ kind: CompilationJobKind.Tmpl, fn: createPipes },
|
|
19546
19969
|
{ kind: CompilationJobKind.Tmpl, fn: configureDeferInstructions },
|
|
19547
|
-
{ kind: CompilationJobKind.Tmpl, fn:
|
|
19970
|
+
{ kind: CompilationJobKind.Tmpl, fn: convertI18nText },
|
|
19971
|
+
{ kind: CompilationJobKind.Tmpl, fn: convertI18nBindings },
|
|
19972
|
+
{ kind: CompilationJobKind.Tmpl, fn: removeUnusedI18nAttributesOps },
|
|
19973
|
+
{ kind: CompilationJobKind.Tmpl, fn: assignI18nSlotDependencies },
|
|
19548
19974
|
{ kind: CompilationJobKind.Tmpl, fn: applyI18nExpressions },
|
|
19549
19975
|
{ kind: CompilationJobKind.Tmpl, fn: createVariadicPipes },
|
|
19550
19976
|
{ kind: CompilationJobKind.Both, fn: generatePureLiteralStructures },
|
|
19551
19977
|
{ kind: CompilationJobKind.Tmpl, fn: generateProjectionDefs },
|
|
19552
19978
|
{ kind: CompilationJobKind.Tmpl, fn: generateVariables },
|
|
19553
19979
|
{ kind: CompilationJobKind.Tmpl, fn: saveAndRestoreView },
|
|
19554
|
-
{ kind: CompilationJobKind.
|
|
19980
|
+
{ kind: CompilationJobKind.Both, fn: deleteAnyCasts },
|
|
19555
19981
|
{ kind: CompilationJobKind.Both, fn: resolveDollarEvent },
|
|
19556
19982
|
{ kind: CompilationJobKind.Tmpl, fn: generateRepeaterDerivedVars },
|
|
19557
19983
|
{ kind: CompilationJobKind.Tmpl, fn: generateTrackVariables },
|
|
@@ -19559,7 +19985,7 @@ var phases = [
|
|
|
19559
19985
|
{ kind: CompilationJobKind.Tmpl, fn: resolveDeferTargetNames },
|
|
19560
19986
|
{ kind: CompilationJobKind.Tmpl, fn: optimizeTrackFns },
|
|
19561
19987
|
{ kind: CompilationJobKind.Both, fn: resolveContexts },
|
|
19562
|
-
{ kind: CompilationJobKind.
|
|
19988
|
+
{ kind: CompilationJobKind.Both, fn: resolveSanitizers },
|
|
19563
19989
|
{ kind: CompilationJobKind.Tmpl, fn: liftLocalRefs },
|
|
19564
19990
|
{ kind: CompilationJobKind.Both, fn: generateNullishCoalesceExpressions },
|
|
19565
19991
|
{ kind: CompilationJobKind.Both, fn: expandSafeReads },
|
|
@@ -19574,7 +20000,6 @@ var phases = [
|
|
|
19574
20000
|
{ kind: CompilationJobKind.Tmpl, fn: collectI18nConsts },
|
|
19575
20001
|
{ kind: CompilationJobKind.Tmpl, fn: collectConstExpressions },
|
|
19576
20002
|
{ kind: CompilationJobKind.Both, fn: collectElementConsts },
|
|
19577
|
-
{ kind: CompilationJobKind.Tmpl, fn: assignI18nSlotDependencies },
|
|
19578
20003
|
{ kind: CompilationJobKind.Tmpl, fn: removeI18nContexts },
|
|
19579
20004
|
{ kind: CompilationJobKind.Both, fn: countVariables },
|
|
19580
20005
|
{ kind: CompilationJobKind.Tmpl, fn: generateAdvance },
|
|
@@ -19692,6 +20117,8 @@ function emitHostBindingFunction(job) {
|
|
|
19692
20117
|
|
|
19693
20118
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/ingest.mjs
|
|
19694
20119
|
var compatibilityMode = CompatibilityMode.TemplateDefinitionBuilder;
|
|
20120
|
+
var domSchema = new DomElementSchemaRegistry();
|
|
20121
|
+
var NG_TEMPLATE_TAG_NAME = "ng-template";
|
|
19695
20122
|
function ingestComponent(componentName, template2, constantPool, relativeContextFilePath, i18nUseExternalIds, deferBlocksMeta) {
|
|
19696
20123
|
const job = new ComponentCompilationJob(componentName, constantPool, compatibilityMode, relativeContextFilePath, i18nUseExternalIds, deferBlocksMeta);
|
|
19697
20124
|
ingestNodes(job.root, template2);
|
|
@@ -19701,50 +20128,55 @@ function ingestHostBinding(input, bindingParser, constantPool) {
|
|
|
19701
20128
|
var _a2, _b2, _c2;
|
|
19702
20129
|
const job = new HostBindingCompilationJob(input.componentName, constantPool, compatibilityMode);
|
|
19703
20130
|
for (const property2 of (_a2 = input.properties) != null ? _a2 : []) {
|
|
19704
|
-
|
|
20131
|
+
let bindingKind = BindingKind.Property;
|
|
20132
|
+
if (property2.name.startsWith("attr.")) {
|
|
20133
|
+
property2.name = property2.name.substring("attr.".length);
|
|
20134
|
+
bindingKind = BindingKind.Attribute;
|
|
20135
|
+
}
|
|
20136
|
+
if (property2.isAnimation) {
|
|
20137
|
+
bindingKind = BindingKind.Animation;
|
|
20138
|
+
}
|
|
20139
|
+
const securityContexts = bindingParser.calcPossibleSecurityContexts(input.componentSelector, property2.name, bindingKind === BindingKind.Attribute).filter((context) => context !== SecurityContext.NONE);
|
|
20140
|
+
ingestHostProperty(job, property2, bindingKind, false, securityContexts);
|
|
19705
20141
|
}
|
|
19706
20142
|
for (const [name, expr] of (_b2 = Object.entries(input.attributes)) != null ? _b2 : []) {
|
|
19707
|
-
|
|
20143
|
+
const securityContexts = bindingParser.calcPossibleSecurityContexts(input.componentSelector, name, true).filter((context) => context !== SecurityContext.NONE);
|
|
20144
|
+
ingestHostAttribute(job, name, expr, securityContexts);
|
|
19708
20145
|
}
|
|
19709
20146
|
for (const event of (_c2 = input.events) != null ? _c2 : []) {
|
|
19710
20147
|
ingestHostEvent(job, event);
|
|
19711
20148
|
}
|
|
19712
20149
|
return job;
|
|
19713
20150
|
}
|
|
19714
|
-
function ingestHostProperty(job, property2, isTextAttribute) {
|
|
20151
|
+
function ingestHostProperty(job, property2, bindingKind, isTextAttribute, securityContexts) {
|
|
19715
20152
|
let expression;
|
|
19716
20153
|
const ast = property2.expression.ast;
|
|
19717
20154
|
if (ast instanceof Interpolation) {
|
|
19718
|
-
expression = new Interpolation2(ast.strings, ast.expressions.map((expr) => convertAst(expr, job, property2.sourceSpan)));
|
|
20155
|
+
expression = new Interpolation2(ast.strings, ast.expressions.map((expr) => convertAst(expr, job, property2.sourceSpan)), []);
|
|
19719
20156
|
} else {
|
|
19720
20157
|
expression = convertAst(ast, job, property2.sourceSpan);
|
|
19721
20158
|
}
|
|
19722
|
-
|
|
19723
|
-
if (property2.name.startsWith("attr.")) {
|
|
19724
|
-
property2.name = property2.name.substring("attr.".length);
|
|
19725
|
-
bindingKind = BindingKind.Attribute;
|
|
19726
|
-
}
|
|
19727
|
-
if (property2.isAnimation) {
|
|
19728
|
-
bindingKind = BindingKind.Animation;
|
|
19729
|
-
}
|
|
19730
|
-
job.root.update.push(createBindingOp(job.root.xref, bindingKind, property2.name, expression, null, SecurityContext.NONE, isTextAttribute, false, property2.sourceSpan));
|
|
20159
|
+
job.root.update.push(createBindingOp(job.root.xref, bindingKind, property2.name, expression, null, securityContexts, isTextAttribute, false, null, null, property2.sourceSpan));
|
|
19731
20160
|
}
|
|
19732
|
-
function ingestHostAttribute(job, name, value) {
|
|
20161
|
+
function ingestHostAttribute(job, name, value, securityContexts) {
|
|
19733
20162
|
const attrBinding = createBindingOp(
|
|
19734
20163
|
job.root.xref,
|
|
19735
20164
|
BindingKind.Attribute,
|
|
19736
20165
|
name,
|
|
19737
20166
|
value,
|
|
19738
20167
|
null,
|
|
19739
|
-
|
|
20168
|
+
securityContexts,
|
|
19740
20169
|
true,
|
|
19741
20170
|
false,
|
|
20171
|
+
null,
|
|
20172
|
+
null,
|
|
19742
20173
|
null
|
|
19743
20174
|
);
|
|
19744
20175
|
job.root.update.push(attrBinding);
|
|
19745
20176
|
}
|
|
19746
20177
|
function ingestHostEvent(job, event) {
|
|
19747
|
-
const
|
|
20178
|
+
const [phase, target] = event.type === 0 ? [null, event.targetOrPhase] : [event.targetOrPhase, null];
|
|
20179
|
+
const eventBinding = createListenerOp(job.root.xref, new SlotHandle(), event.name, null, [], phase, target, true, event.sourceSpan);
|
|
19748
20180
|
eventBinding.handlerOps.push(createStatementOp(new ReturnStatement(convertAst(event.handler.ast, job, event.sourceSpan), event.handlerSpan)));
|
|
19749
20181
|
job.root.create.push(eventBinding);
|
|
19750
20182
|
}
|
|
@@ -19784,14 +20216,17 @@ function ingestElement(unit, element2) {
|
|
|
19784
20216
|
const [namespaceKey, elementName] = splitNsName(element2.name);
|
|
19785
20217
|
const startOp = createElementStartOp(elementName, id, namespaceForKey(namespaceKey), element2.i18n instanceof TagPlaceholder ? element2.i18n : void 0, element2.startSourceSpan);
|
|
19786
20218
|
unit.create.push(startOp);
|
|
19787
|
-
|
|
20219
|
+
ingestElementBindings(unit, startOp, element2);
|
|
19788
20220
|
ingestReferences(startOp, element2);
|
|
20221
|
+
let i18nBlockId = null;
|
|
20222
|
+
if (element2.i18n instanceof Message) {
|
|
20223
|
+
i18nBlockId = unit.job.allocateXrefId();
|
|
20224
|
+
unit.create.push(createI18nStartOp(i18nBlockId, element2.i18n));
|
|
20225
|
+
}
|
|
19789
20226
|
ingestNodes(unit, element2.children);
|
|
19790
20227
|
const endOp = createElementEndOp(id, (_a2 = element2.endSourceSpan) != null ? _a2 : element2.startSourceSpan);
|
|
19791
20228
|
unit.create.push(endOp);
|
|
19792
|
-
if (
|
|
19793
|
-
const i18nBlockId = unit.job.allocateXrefId();
|
|
19794
|
-
OpList.insertAfter(createI18nStartOp(i18nBlockId, element2.i18n), startOp);
|
|
20229
|
+
if (i18nBlockId !== null) {
|
|
19795
20230
|
OpList.insertBefore(createI18nEndOp(i18nBlockId), endOp);
|
|
19796
20231
|
}
|
|
19797
20232
|
}
|
|
@@ -19808,24 +20243,30 @@ function ingestTemplate(unit, tmpl) {
|
|
|
19808
20243
|
const i18nPlaceholder = tmpl.i18n instanceof TagPlaceholder ? tmpl.i18n : void 0;
|
|
19809
20244
|
const namespace = namespaceForKey(namespacePrefix);
|
|
19810
20245
|
const functionNameSuffix = tagNameWithoutNamespace === null ? "" : prefixWithNamespace(tagNameWithoutNamespace, namespace);
|
|
19811
|
-
const
|
|
19812
|
-
|
|
19813
|
-
|
|
19814
|
-
|
|
20246
|
+
const templateKind = isPlainTemplate(tmpl) ? TemplateKind.NgTemplate : TemplateKind.Structural;
|
|
20247
|
+
const templateOp = createTemplateOp(childView.xref, templateKind, tagNameWithoutNamespace, functionNameSuffix, namespace, i18nPlaceholder, tmpl.startSourceSpan);
|
|
20248
|
+
unit.create.push(templateOp);
|
|
20249
|
+
ingestTemplateBindings(unit, templateOp, tmpl, templateKind);
|
|
20250
|
+
ingestReferences(templateOp, tmpl);
|
|
19815
20251
|
ingestNodes(childView, tmpl.children);
|
|
19816
20252
|
for (const { name, value } of tmpl.variables) {
|
|
19817
20253
|
childView.contextVariables.set(name, value !== "" ? value : "$implicit");
|
|
19818
20254
|
}
|
|
19819
|
-
if (
|
|
20255
|
+
if (templateKind === TemplateKind.NgTemplate && tmpl.i18n instanceof Message) {
|
|
19820
20256
|
const id = unit.job.allocateXrefId();
|
|
19821
20257
|
OpList.insertAfter(createI18nStartOp(id, tmpl.i18n), childView.create.head);
|
|
19822
20258
|
OpList.insertBefore(createI18nEndOp(id), childView.create.tail);
|
|
19823
20259
|
}
|
|
19824
20260
|
}
|
|
19825
20261
|
function ingestContent(unit, content) {
|
|
19826
|
-
|
|
20262
|
+
if (content.i18n !== void 0 && !(content.i18n instanceof TagPlaceholder)) {
|
|
20263
|
+
throw Error(`Unhandled i18n metadata type for element: ${content.i18n.constructor.name}`);
|
|
20264
|
+
}
|
|
20265
|
+
const attrs = content.attributes.flatMap((a) => [a.name, a.value]);
|
|
20266
|
+
const op = createProjectionOp(unit.job.allocateXrefId(), content.selector, content.i18n, attrs, content.sourceSpan);
|
|
19827
20267
|
for (const attr of content.attributes) {
|
|
19828
|
-
|
|
20268
|
+
const securityContext = domSchema.securityContext(content.name, attr.name, true);
|
|
20269
|
+
unit.update.push(createBindingOp(op.xref, BindingKind.Attribute, attr.name, literal(attr.value), null, securityContext, true, false, null, asMessage(attr.i18n), attr.sourceSpan));
|
|
19829
20270
|
}
|
|
19830
20271
|
unit.create.push(op);
|
|
19831
20272
|
}
|
|
@@ -19853,9 +20294,10 @@ function ingestBoundText(unit, text2, i18nPlaceholders) {
|
|
|
19853
20294
|
const textXref = unit.job.allocateXrefId();
|
|
19854
20295
|
unit.create.push(createTextOp(textXref, "", text2.sourceSpan));
|
|
19855
20296
|
const baseSourceSpan = unit.job.compatibility ? null : text2.sourceSpan;
|
|
19856
|
-
unit.update.push(createInterpolateTextOp(textXref, new Interpolation2(value.strings, value.expressions.map((expr) => convertAst(expr, unit.job, baseSourceSpan))
|
|
20297
|
+
unit.update.push(createInterpolateTextOp(textXref, new Interpolation2(value.strings, value.expressions.map((expr) => convertAst(expr, unit.job, baseSourceSpan)), i18nPlaceholders), text2.sourceSpan));
|
|
19857
20298
|
}
|
|
19858
20299
|
function ingestIfBlock(unit, ifBlock) {
|
|
20300
|
+
var _a2;
|
|
19859
20301
|
let firstXref = null;
|
|
19860
20302
|
let firstSlotHandle = null;
|
|
19861
20303
|
let conditions = [];
|
|
@@ -19869,14 +20311,21 @@ function ingestIfBlock(unit, ifBlock) {
|
|
|
19869
20311
|
if (ifCase.expressionAlias !== null) {
|
|
19870
20312
|
cView.contextVariables.set(ifCase.expressionAlias.name, CTX_REF);
|
|
19871
20313
|
}
|
|
19872
|
-
|
|
19873
|
-
|
|
20314
|
+
let ifCaseI18nMeta = void 0;
|
|
20315
|
+
if (ifCase.i18n !== void 0) {
|
|
20316
|
+
if (!(ifCase.i18n instanceof BlockPlaceholder)) {
|
|
20317
|
+
throw Error(`Unhandled i18n metadata type for if block: ${(_a2 = ifCase.i18n) == null ? void 0 : _a2.constructor.name}`);
|
|
20318
|
+
}
|
|
20319
|
+
ifCaseI18nMeta = ifCase.i18n;
|
|
20320
|
+
}
|
|
20321
|
+
const templateOp = createTemplateOp(cView.xref, TemplateKind.Block, tagName, "Conditional", Namespace.HTML, ifCaseI18nMeta, ifCase.sourceSpan);
|
|
20322
|
+
unit.create.push(templateOp);
|
|
19874
20323
|
if (firstXref === null) {
|
|
19875
20324
|
firstXref = cView.xref;
|
|
19876
|
-
firstSlotHandle =
|
|
20325
|
+
firstSlotHandle = templateOp.handle;
|
|
19877
20326
|
}
|
|
19878
20327
|
const caseExpr = ifCase.expression ? convertAst(ifCase.expression, unit.job, null) : null;
|
|
19879
|
-
const conditionalCaseExpr = new ConditionalCaseExpr(caseExpr,
|
|
20328
|
+
const conditionalCaseExpr = new ConditionalCaseExpr(caseExpr, templateOp.xref, templateOp.handle, ifCase.expressionAlias);
|
|
19880
20329
|
conditions.push(conditionalCaseExpr);
|
|
19881
20330
|
ingestNodes(cView, ifCase.children);
|
|
19882
20331
|
}
|
|
@@ -19884,54 +20333,65 @@ function ingestIfBlock(unit, ifBlock) {
|
|
|
19884
20333
|
unit.update.push(conditional2);
|
|
19885
20334
|
}
|
|
19886
20335
|
function ingestSwitchBlock(unit, switchBlock) {
|
|
20336
|
+
var _a2;
|
|
19887
20337
|
let firstXref = null;
|
|
19888
20338
|
let firstSlotHandle = null;
|
|
19889
20339
|
let conditions = [];
|
|
19890
20340
|
for (const switchCase of switchBlock.cases) {
|
|
19891
20341
|
const cView = unit.job.allocateView(unit.xref);
|
|
19892
|
-
|
|
19893
|
-
|
|
20342
|
+
let switchCaseI18nMeta = void 0;
|
|
20343
|
+
if (switchCase.i18n !== void 0) {
|
|
20344
|
+
if (!(switchCase.i18n instanceof BlockPlaceholder)) {
|
|
20345
|
+
throw Error(`Unhandled i18n metadata type for switch block: ${(_a2 = switchCase.i18n) == null ? void 0 : _a2.constructor.name}`);
|
|
20346
|
+
}
|
|
20347
|
+
switchCaseI18nMeta = switchCase.i18n;
|
|
20348
|
+
}
|
|
20349
|
+
const templateOp = createTemplateOp(cView.xref, TemplateKind.Block, null, "Case", Namespace.HTML, switchCaseI18nMeta, switchCase.sourceSpan);
|
|
20350
|
+
unit.create.push(templateOp);
|
|
19894
20351
|
if (firstXref === null) {
|
|
19895
20352
|
firstXref = cView.xref;
|
|
19896
|
-
firstSlotHandle =
|
|
20353
|
+
firstSlotHandle = templateOp.handle;
|
|
19897
20354
|
}
|
|
19898
20355
|
const caseExpr = switchCase.expression ? convertAst(switchCase.expression, unit.job, switchBlock.startSourceSpan) : null;
|
|
19899
|
-
const conditionalCaseExpr = new ConditionalCaseExpr(caseExpr,
|
|
20356
|
+
const conditionalCaseExpr = new ConditionalCaseExpr(caseExpr, templateOp.xref, templateOp.handle);
|
|
19900
20357
|
conditions.push(conditionalCaseExpr);
|
|
19901
20358
|
ingestNodes(cView, switchCase.children);
|
|
19902
20359
|
}
|
|
19903
20360
|
const conditional2 = createConditionalOp(firstXref, firstSlotHandle, convertAst(switchBlock.expression, unit.job, null), conditions, switchBlock.sourceSpan);
|
|
19904
20361
|
unit.update.push(conditional2);
|
|
19905
20362
|
}
|
|
19906
|
-
function ingestDeferView(unit, suffix, children, sourceSpan) {
|
|
20363
|
+
function ingestDeferView(unit, suffix, i18nMeta, children, sourceSpan) {
|
|
20364
|
+
if (i18nMeta !== void 0 && !(i18nMeta instanceof BlockPlaceholder)) {
|
|
20365
|
+
throw Error("Unhandled i18n metadata type for defer block");
|
|
20366
|
+
}
|
|
19907
20367
|
if (children === void 0) {
|
|
19908
20368
|
return null;
|
|
19909
20369
|
}
|
|
19910
20370
|
const secondaryView = unit.job.allocateView(unit.xref);
|
|
19911
20371
|
ingestNodes(secondaryView, children);
|
|
19912
|
-
const templateOp = createTemplateOp(secondaryView.xref, null, `Defer${suffix}`, Namespace.HTML,
|
|
20372
|
+
const templateOp = createTemplateOp(secondaryView.xref, TemplateKind.Block, null, `Defer${suffix}`, Namespace.HTML, i18nMeta, sourceSpan);
|
|
19913
20373
|
unit.create.push(templateOp);
|
|
19914
20374
|
return templateOp;
|
|
19915
20375
|
}
|
|
19916
20376
|
function ingestDeferBlock(unit, deferBlock) {
|
|
19917
|
-
var _a2, _b2, _c2, _d2, _e2, _f2, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
20377
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s;
|
|
19918
20378
|
const blockMeta = unit.job.deferBlocksMeta.get(deferBlock);
|
|
19919
20379
|
if (blockMeta === void 0) {
|
|
19920
20380
|
throw new Error(`AssertionError: unable to find metadata for deferred block`);
|
|
19921
20381
|
}
|
|
19922
|
-
const main = ingestDeferView(unit, "", deferBlock.children, deferBlock.sourceSpan);
|
|
19923
|
-
const loading = ingestDeferView(unit, "Loading", (_a2 = deferBlock.loading) == null ? void 0 : _a2.
|
|
19924
|
-
const placeholder = ingestDeferView(unit, "Placeholder", (
|
|
19925
|
-
const error2 = ingestDeferView(unit, "Error", (
|
|
20382
|
+
const main = ingestDeferView(unit, "", deferBlock.i18n, deferBlock.children, deferBlock.sourceSpan);
|
|
20383
|
+
const loading = ingestDeferView(unit, "Loading", (_a2 = deferBlock.loading) == null ? void 0 : _a2.i18n, (_b2 = deferBlock.loading) == null ? void 0 : _b2.children, (_c2 = deferBlock.loading) == null ? void 0 : _c2.sourceSpan);
|
|
20384
|
+
const placeholder = ingestDeferView(unit, "Placeholder", (_d2 = deferBlock.placeholder) == null ? void 0 : _d2.i18n, (_e2 = deferBlock.placeholder) == null ? void 0 : _e2.children, (_f2 = deferBlock.placeholder) == null ? void 0 : _f2.sourceSpan);
|
|
20385
|
+
const error2 = ingestDeferView(unit, "Error", (_g = deferBlock.error) == null ? void 0 : _g.i18n, (_h = deferBlock.error) == null ? void 0 : _h.children, (_i = deferBlock.error) == null ? void 0 : _i.sourceSpan);
|
|
19926
20386
|
const deferXref = unit.job.allocateXrefId();
|
|
19927
20387
|
const deferOp = createDeferOp(deferXref, main.xref, main.handle, blockMeta, deferBlock.sourceSpan);
|
|
19928
|
-
deferOp.placeholderView = (
|
|
19929
|
-
deferOp.placeholderSlot = (
|
|
19930
|
-
deferOp.loadingSlot = (
|
|
19931
|
-
deferOp.errorSlot = (
|
|
19932
|
-
deferOp.placeholderMinimumTime = (
|
|
19933
|
-
deferOp.loadingMinimumTime = (
|
|
19934
|
-
deferOp.loadingAfterTime = (
|
|
20388
|
+
deferOp.placeholderView = (_j = placeholder == null ? void 0 : placeholder.xref) != null ? _j : null;
|
|
20389
|
+
deferOp.placeholderSlot = (_k = placeholder == null ? void 0 : placeholder.handle) != null ? _k : null;
|
|
20390
|
+
deferOp.loadingSlot = (_l = loading == null ? void 0 : loading.handle) != null ? _l : null;
|
|
20391
|
+
deferOp.errorSlot = (_m = error2 == null ? void 0 : error2.handle) != null ? _m : null;
|
|
20392
|
+
deferOp.placeholderMinimumTime = (_o = (_n = deferBlock.placeholder) == null ? void 0 : _n.minimumTime) != null ? _o : null;
|
|
20393
|
+
deferOp.loadingMinimumTime = (_q = (_p = deferBlock.loading) == null ? void 0 : _p.minimumTime) != null ? _q : null;
|
|
20394
|
+
deferOp.loadingAfterTime = (_s = (_r = deferBlock.loading) == null ? void 0 : _r.afterTime) != null ? _s : null;
|
|
19935
20395
|
unit.create.push(deferOp);
|
|
19936
20396
|
let prefetch = false;
|
|
19937
20397
|
let deferOnOps = [];
|
|
@@ -19995,17 +20455,12 @@ function ingestDeferBlock(unit, deferBlock) {
|
|
|
19995
20455
|
unit.update.push(deferWhenOps);
|
|
19996
20456
|
}
|
|
19997
20457
|
function ingestIcu(unit, icu) {
|
|
19998
|
-
var _a2
|
|
20458
|
+
var _a2;
|
|
19999
20459
|
if (icu.i18n instanceof Message && isSingleI18nIcu(icu.i18n)) {
|
|
20000
20460
|
const xref = unit.job.allocateXrefId();
|
|
20001
20461
|
const icuNode = icu.i18n.nodes[0];
|
|
20002
20462
|
unit.create.push(createIcuStartOp(xref, icu.i18n, icuFromI18nMessage(icu.i18n).name, null));
|
|
20003
|
-
const
|
|
20004
|
-
if (expressionPlaceholder === void 0 || icu.vars[expressionPlaceholder] === void 0) {
|
|
20005
|
-
throw Error("ICU should have a text binding");
|
|
20006
|
-
}
|
|
20007
|
-
ingestBoundText(unit, icu.vars[expressionPlaceholder], [expressionPlaceholder]);
|
|
20008
|
-
for (const [placeholder, text2] of Object.entries(icu.placeholders)) {
|
|
20463
|
+
for (const [placeholder, text2] of Object.entries(__spreadValues(__spreadValues({}, icu.vars), icu.placeholders))) {
|
|
20009
20464
|
if (text2 instanceof BoundText) {
|
|
20010
20465
|
ingestBoundText(unit, text2, [placeholder]);
|
|
20011
20466
|
} else {
|
|
@@ -20014,11 +20469,11 @@ function ingestIcu(unit, icu) {
|
|
|
20014
20469
|
}
|
|
20015
20470
|
unit.create.push(createIcuEndOp(xref));
|
|
20016
20471
|
} else {
|
|
20017
|
-
throw Error(`Unhandled i18n metadata type for ICU: ${(
|
|
20472
|
+
throw Error(`Unhandled i18n metadata type for ICU: ${(_a2 = icu.i18n) == null ? void 0 : _a2.constructor.name}`);
|
|
20018
20473
|
}
|
|
20019
20474
|
}
|
|
20020
20475
|
function ingestForBlock(unit, forBlock) {
|
|
20021
|
-
var _a2;
|
|
20476
|
+
var _a2, _b2, _c2;
|
|
20022
20477
|
const repeaterView = unit.job.allocateView(unit.xref);
|
|
20023
20478
|
const createRepeaterAlias = (ident, repeaterVar) => {
|
|
20024
20479
|
repeaterView.aliases.add({
|
|
@@ -20052,8 +20507,16 @@ function ingestForBlock(unit, forBlock) {
|
|
|
20052
20507
|
$odd: forBlock.contextVariables.$odd.name,
|
|
20053
20508
|
$implicit: forBlock.item.name
|
|
20054
20509
|
};
|
|
20510
|
+
if (forBlock.i18n !== void 0 && !(forBlock.i18n instanceof BlockPlaceholder)) {
|
|
20511
|
+
throw Error("AssertionError: Unhandled i18n metadata type or @for");
|
|
20512
|
+
}
|
|
20513
|
+
if (((_a2 = forBlock.empty) == null ? void 0 : _a2.i18n) !== void 0 && !(forBlock.empty.i18n instanceof BlockPlaceholder)) {
|
|
20514
|
+
throw Error("AssertionError: Unhandled i18n metadata type or @empty");
|
|
20515
|
+
}
|
|
20516
|
+
const i18nPlaceholder = forBlock.i18n;
|
|
20517
|
+
const emptyI18nPlaceholder = (_b2 = forBlock.empty) == null ? void 0 : _b2.i18n;
|
|
20055
20518
|
const tagName = ingestControlFlowInsertionPoint(unit, repeaterView.xref, forBlock);
|
|
20056
|
-
const repeaterCreate2 = createRepeaterCreateOp(repeaterView.xref, (
|
|
20519
|
+
const repeaterCreate2 = createRepeaterCreateOp(repeaterView.xref, (_c2 = emptyView == null ? void 0 : emptyView.xref) != null ? _c2 : null, tagName, track, varNames, i18nPlaceholder, emptyI18nPlaceholder, forBlock.sourceSpan);
|
|
20057
20520
|
unit.create.push(repeaterCreate2);
|
|
20058
20521
|
const expression = convertAst(forBlock.expression, unit.job, convertSourceSpan(forBlock.expression.span, forBlock.sourceSpan));
|
|
20059
20522
|
const repeater2 = createRepeaterOp(repeaterCreate2.xref, repeaterCreate2.handle, expression, forBlock.sourceSpan);
|
|
@@ -20089,6 +20552,15 @@ function convertAst(ast, job, baseSourceSpan) {
|
|
|
20089
20552
|
}
|
|
20090
20553
|
} else if (ast instanceof LiteralPrimitive) {
|
|
20091
20554
|
return literal(ast.value, void 0, convertSourceSpan(ast.span, baseSourceSpan));
|
|
20555
|
+
} else if (ast instanceof Unary) {
|
|
20556
|
+
switch (ast.operator) {
|
|
20557
|
+
case "+":
|
|
20558
|
+
return new UnaryOperatorExpr(UnaryOperator.Plus, convertAst(ast.expr, job, baseSourceSpan), void 0, convertSourceSpan(ast.span, baseSourceSpan));
|
|
20559
|
+
case "-":
|
|
20560
|
+
return new UnaryOperatorExpr(UnaryOperator.Minus, convertAst(ast.expr, job, baseSourceSpan), void 0, convertSourceSpan(ast.span, baseSourceSpan));
|
|
20561
|
+
default:
|
|
20562
|
+
throw new Error(`AssertionError: unknown unary operator ${ast.operator}`);
|
|
20563
|
+
}
|
|
20092
20564
|
} else if (ast instanceof Binary) {
|
|
20093
20565
|
const operator = BINARY_OPERATORS.get(ast.operation);
|
|
20094
20566
|
if (operator === void 0) {
|
|
@@ -20126,104 +20598,134 @@ function convertAst(ast, job, baseSourceSpan) {
|
|
|
20126
20598
|
return new SafeInvokeFunctionExpr(convertAst(ast.receiver, job, baseSourceSpan), ast.args.map((a) => convertAst(a, job, baseSourceSpan)));
|
|
20127
20599
|
} else if (ast instanceof EmptyExpr) {
|
|
20128
20600
|
return new EmptyExpr2(convertSourceSpan(ast.span, baseSourceSpan));
|
|
20601
|
+
} else if (ast instanceof PrefixNot) {
|
|
20602
|
+
return not(convertAst(ast.expression, job, baseSourceSpan), convertSourceSpan(ast.span, baseSourceSpan));
|
|
20129
20603
|
} else {
|
|
20130
20604
|
throw new Error(`Unhandled expression type "${ast.constructor.name}" in file "${baseSourceSpan == null ? void 0 : baseSourceSpan.start.file.url}"`);
|
|
20131
20605
|
}
|
|
20132
20606
|
}
|
|
20607
|
+
function convertAstWithInterpolation(job, value, i18nMeta) {
|
|
20608
|
+
var _a2, _b2;
|
|
20609
|
+
let expression;
|
|
20610
|
+
if (value instanceof Interpolation) {
|
|
20611
|
+
expression = new Interpolation2(value.strings, value.expressions.map((e) => convertAst(e, job, null)), Object.keys((_b2 = (_a2 = asMessage(i18nMeta)) == null ? void 0 : _a2.placeholders) != null ? _b2 : {}));
|
|
20612
|
+
} else if (value instanceof AST) {
|
|
20613
|
+
expression = convertAst(value, job, null);
|
|
20614
|
+
} else {
|
|
20615
|
+
expression = literal(value);
|
|
20616
|
+
}
|
|
20617
|
+
return expression;
|
|
20618
|
+
}
|
|
20619
|
+
var BINDING_KINDS = /* @__PURE__ */ new Map([
|
|
20620
|
+
[0, BindingKind.Property],
|
|
20621
|
+
[1, BindingKind.Attribute],
|
|
20622
|
+
[2, BindingKind.ClassName],
|
|
20623
|
+
[3, BindingKind.StyleProperty],
|
|
20624
|
+
[4, BindingKind.Animation]
|
|
20625
|
+
]);
|
|
20133
20626
|
function isPlainTemplate(tmpl) {
|
|
20134
20627
|
var _a2;
|
|
20135
|
-
return splitNsName((_a2 = tmpl.tagName) != null ? _a2 : "")[1] ===
|
|
20136
|
-
}
|
|
20137
|
-
function
|
|
20138
|
-
|
|
20139
|
-
|
|
20140
|
-
flags |= BindingFlags.OnNgTemplateElement;
|
|
20141
|
-
if (element2 instanceof Template && isPlainTemplate(element2)) {
|
|
20142
|
-
flags |= BindingFlags.BindingTargetsTemplate;
|
|
20143
|
-
}
|
|
20144
|
-
const templateAttrFlags = flags | BindingFlags.BindingTargetsTemplate | BindingFlags.IsStructuralTemplateAttribute;
|
|
20145
|
-
for (const attr of element2.templateAttrs) {
|
|
20146
|
-
if (attr instanceof TextAttribute) {
|
|
20147
|
-
ingestBinding(unit, op.xref, attr.name, literal(attr.value), 1, null, SecurityContext.NONE, attr.sourceSpan, templateAttrFlags | BindingFlags.TextValue);
|
|
20148
|
-
} else {
|
|
20149
|
-
ingestBinding(unit, op.xref, attr.name, attr.value, attr.type, attr.unit, attr.securityContext, attr.sourceSpan, templateAttrFlags);
|
|
20150
|
-
}
|
|
20151
|
-
}
|
|
20628
|
+
return splitNsName((_a2 = tmpl.tagName) != null ? _a2 : "")[1] === NG_TEMPLATE_TAG_NAME;
|
|
20629
|
+
}
|
|
20630
|
+
function asMessage(i18nMeta) {
|
|
20631
|
+
if (i18nMeta == null) {
|
|
20632
|
+
return null;
|
|
20152
20633
|
}
|
|
20634
|
+
if (!(i18nMeta instanceof Message)) {
|
|
20635
|
+
throw Error(`Expected i18n meta to be a Message, but got: ${i18nMeta.constructor.name}`);
|
|
20636
|
+
}
|
|
20637
|
+
return i18nMeta;
|
|
20638
|
+
}
|
|
20639
|
+
function ingestElementBindings(unit, op, element2) {
|
|
20640
|
+
var _a2;
|
|
20641
|
+
let bindings = new Array();
|
|
20153
20642
|
for (const attr of element2.attributes) {
|
|
20154
|
-
|
|
20643
|
+
const securityContext = domSchema.securityContext(element2.name, attr.name, true);
|
|
20644
|
+
bindings.push(createBindingOp(op.xref, BindingKind.Attribute, attr.name, convertAstWithInterpolation(unit.job, attr.value, attr.i18n), null, securityContext, true, false, null, asMessage(attr.i18n), attr.sourceSpan));
|
|
20155
20645
|
}
|
|
20156
20646
|
for (const input of element2.inputs) {
|
|
20157
|
-
|
|
20647
|
+
bindings.push(createBindingOp(op.xref, BINDING_KINDS.get(input.type), input.name, convertAstWithInterpolation(unit.job, astOf(input.value), input.i18n), input.unit, input.securityContext, false, false, null, (_a2 = asMessage(input.i18n)) != null ? _a2 : null, input.sourceSpan));
|
|
20158
20648
|
}
|
|
20649
|
+
unit.create.push(bindings.filter((b) => (b == null ? void 0 : b.kind) === OpKind.ExtractedAttribute));
|
|
20650
|
+
unit.update.push(bindings.filter((b) => (b == null ? void 0 : b.kind) === OpKind.Binding));
|
|
20159
20651
|
for (const output of element2.outputs) {
|
|
20160
|
-
|
|
20161
|
-
|
|
20162
|
-
if (output.phase === null) {
|
|
20163
|
-
throw Error("Animation listener should have a phase");
|
|
20164
|
-
}
|
|
20652
|
+
if (output.type === 1 && output.phase === null) {
|
|
20653
|
+
throw Error("Animation listener should have a phase");
|
|
20165
20654
|
}
|
|
20166
|
-
|
|
20167
|
-
|
|
20168
|
-
|
|
20169
|
-
|
|
20170
|
-
|
|
20171
|
-
|
|
20172
|
-
|
|
20173
|
-
|
|
20174
|
-
|
|
20175
|
-
|
|
20176
|
-
|
|
20177
|
-
|
|
20655
|
+
unit.create.push(createListenerOp(op.xref, op.handle, output.name, op.tag, makeListenerHandlerOps(unit, output.handler, output.handlerSpan), output.phase, output.target, false, output.sourceSpan));
|
|
20656
|
+
}
|
|
20657
|
+
if (bindings.some((b) => b == null ? void 0 : b.i18nMessage) !== null) {
|
|
20658
|
+
unit.create.push(createI18nAttributesOp(unit.job.allocateXrefId(), new SlotHandle(), op.xref));
|
|
20659
|
+
}
|
|
20660
|
+
}
|
|
20661
|
+
function ingestTemplateBindings(unit, op, template2, templateKind) {
|
|
20662
|
+
let bindings = new Array();
|
|
20663
|
+
for (const attr of template2.templateAttrs) {
|
|
20664
|
+
if (attr instanceof TextAttribute) {
|
|
20665
|
+
const securityContext = domSchema.securityContext(NG_TEMPLATE_TAG_NAME, attr.name, true);
|
|
20666
|
+
bindings.push(createTemplateBinding(unit, op.xref, 1, attr.name, attr.value, null, securityContext, true, templateKind, asMessage(attr.i18n), attr.sourceSpan));
|
|
20178
20667
|
} else {
|
|
20179
|
-
|
|
20668
|
+
bindings.push(createTemplateBinding(unit, op.xref, attr.type, attr.name, astOf(attr.value), attr.unit, attr.securityContext, true, templateKind, asMessage(attr.i18n), attr.sourceSpan));
|
|
20669
|
+
}
|
|
20670
|
+
}
|
|
20671
|
+
for (const attr of template2.attributes) {
|
|
20672
|
+
const securityContext = domSchema.securityContext(NG_TEMPLATE_TAG_NAME, attr.name, true);
|
|
20673
|
+
bindings.push(createTemplateBinding(unit, op.xref, 1, attr.name, attr.value, null, securityContext, false, templateKind, asMessage(attr.i18n), attr.sourceSpan));
|
|
20674
|
+
}
|
|
20675
|
+
for (const input of template2.inputs) {
|
|
20676
|
+
bindings.push(createTemplateBinding(unit, op.xref, input.type, input.name, astOf(input.value), input.unit, input.securityContext, false, templateKind, asMessage(input.i18n), input.sourceSpan));
|
|
20677
|
+
}
|
|
20678
|
+
unit.create.push(bindings.filter((b) => (b == null ? void 0 : b.kind) === OpKind.ExtractedAttribute));
|
|
20679
|
+
unit.update.push(bindings.filter((b) => (b == null ? void 0 : b.kind) === OpKind.Binding));
|
|
20680
|
+
for (const output of template2.outputs) {
|
|
20681
|
+
if (output.type === 1 && output.phase === null) {
|
|
20682
|
+
throw Error("Animation listener should have a phase");
|
|
20180
20683
|
}
|
|
20181
|
-
if (
|
|
20182
|
-
|
|
20684
|
+
if (templateKind === TemplateKind.NgTemplate) {
|
|
20685
|
+
unit.create.push(createListenerOp(op.xref, op.handle, output.name, op.tag, makeListenerHandlerOps(unit, output.handler, output.handlerSpan), output.phase, output.target, false, output.sourceSpan));
|
|
20183
20686
|
}
|
|
20184
|
-
|
|
20185
|
-
|
|
20186
|
-
|
|
20187
|
-
const stmtOp = createStatementOp(new ExpressionStatement(expr, expr.sourceSpan));
|
|
20188
|
-
listenerOp.handlerOps.push(stmtOp);
|
|
20687
|
+
if (templateKind === TemplateKind.Structural && output.type !== 1) {
|
|
20688
|
+
const securityContext = domSchema.securityContext(NG_TEMPLATE_TAG_NAME, output.name, false);
|
|
20689
|
+
unit.create.push(createExtractedAttributeOp(op.xref, BindingKind.Property, output.name, null, null, null, securityContext));
|
|
20189
20690
|
}
|
|
20190
|
-
|
|
20191
|
-
|
|
20691
|
+
}
|
|
20692
|
+
if (bindings.some((b) => b == null ? void 0 : b.i18nMessage) !== null) {
|
|
20693
|
+
unit.create.push(createI18nAttributesOp(unit.job.allocateXrefId(), new SlotHandle(), op.xref));
|
|
20192
20694
|
}
|
|
20193
20695
|
}
|
|
20194
|
-
|
|
20195
|
-
|
|
20196
|
-
|
|
20197
|
-
|
|
20198
|
-
|
|
20199
|
-
|
|
20200
|
-
|
|
20201
|
-
|
|
20202
|
-
|
|
20203
|
-
BindingFlags2[BindingFlags2["None"] = 0] = "None";
|
|
20204
|
-
BindingFlags2[BindingFlags2["TextValue"] = 1] = "TextValue";
|
|
20205
|
-
BindingFlags2[BindingFlags2["BindingTargetsTemplate"] = 2] = "BindingTargetsTemplate";
|
|
20206
|
-
BindingFlags2[BindingFlags2["IsStructuralTemplateAttribute"] = 4] = "IsStructuralTemplateAttribute";
|
|
20207
|
-
BindingFlags2[BindingFlags2["OnNgTemplateElement"] = 8] = "OnNgTemplateElement";
|
|
20208
|
-
})(BindingFlags || (BindingFlags = {}));
|
|
20209
|
-
function ingestBinding(view, xref, name, value, type, unit, securityContext, sourceSpan, flags) {
|
|
20210
|
-
if (value instanceof ASTWithSource) {
|
|
20211
|
-
value = value.ast;
|
|
20696
|
+
function createTemplateBinding(view, xref, type, name, value, unit, securityContext, isStructuralTemplateAttribute, templateKind, i18nMessage, sourceSpan) {
|
|
20697
|
+
const isTextBinding = typeof value === "string";
|
|
20698
|
+
if (templateKind === TemplateKind.Structural) {
|
|
20699
|
+
if (!isStructuralTemplateAttribute && (type === 0 || type === 2 || type === 3)) {
|
|
20700
|
+
return createExtractedAttributeOp(xref, BindingKind.Property, name, null, null, i18nMessage, securityContext);
|
|
20701
|
+
}
|
|
20702
|
+
if (!isTextBinding && (type === 1 || type === 4)) {
|
|
20703
|
+
return null;
|
|
20704
|
+
}
|
|
20212
20705
|
}
|
|
20213
|
-
|
|
20214
|
-
|
|
20215
|
-
|
|
20706
|
+
let bindingType = BINDING_KINDS.get(type);
|
|
20707
|
+
if (templateKind === TemplateKind.NgTemplate) {
|
|
20708
|
+
if (type === 2 || type === 3 || type === 1 && !isTextBinding) {
|
|
20709
|
+
bindingType = BindingKind.Property;
|
|
20710
|
+
}
|
|
20216
20711
|
}
|
|
20217
|
-
|
|
20218
|
-
|
|
20219
|
-
|
|
20220
|
-
|
|
20221
|
-
|
|
20222
|
-
|
|
20223
|
-
|
|
20712
|
+
return createBindingOp(xref, bindingType, name, convertAstWithInterpolation(view.job, value, i18nMessage), unit, securityContext, isTextBinding, isStructuralTemplateAttribute, templateKind, i18nMessage, sourceSpan);
|
|
20713
|
+
}
|
|
20714
|
+
function makeListenerHandlerOps(unit, handler, handlerSpan) {
|
|
20715
|
+
handler = astOf(handler);
|
|
20716
|
+
const handlerOps = new Array();
|
|
20717
|
+
let handlerExprs = handler instanceof Chain ? handler.expressions : [handler];
|
|
20718
|
+
if (handlerExprs.length === 0) {
|
|
20719
|
+
throw new Error("Expected listener to have non-empty expression list.");
|
|
20224
20720
|
}
|
|
20225
|
-
const
|
|
20226
|
-
|
|
20721
|
+
const expressions = handlerExprs.map((expr) => convertAst(expr, unit.job, handlerSpan));
|
|
20722
|
+
const returnExpr = expressions.pop();
|
|
20723
|
+
handlerOps.push(...expressions.map((e) => createStatementOp(new ExpressionStatement(e, e.sourceSpan))));
|
|
20724
|
+
handlerOps.push(createStatementOp(new ReturnStatement(returnExpr, returnExpr.sourceSpan)));
|
|
20725
|
+
return handlerOps;
|
|
20726
|
+
}
|
|
20727
|
+
function astOf(ast) {
|
|
20728
|
+
return ast instanceof ASTWithSource ? ast.ast : ast;
|
|
20227
20729
|
}
|
|
20228
20730
|
function ingestReferences(op, element2) {
|
|
20229
20731
|
assertIsArray(op.localRefs);
|
|
@@ -20263,10 +20765,11 @@ function ingestControlFlowInsertionPoint(unit, xref, node) {
|
|
|
20263
20765
|
}
|
|
20264
20766
|
if (root !== null) {
|
|
20265
20767
|
for (const attr of root.attributes) {
|
|
20266
|
-
|
|
20768
|
+
const securityContext = domSchema.securityContext(NG_TEMPLATE_TAG_NAME, attr.name, true);
|
|
20769
|
+
unit.update.push(createBindingOp(xref, BindingKind.Attribute, attr.name, literal(attr.value), null, securityContext, true, false, null, asMessage(attr.i18n), attr.sourceSpan));
|
|
20267
20770
|
}
|
|
20268
20771
|
const tagName = root instanceof Element ? root.name : root.tagName;
|
|
20269
|
-
return tagName ===
|
|
20772
|
+
return tagName === NG_TEMPLATE_TAG_NAME ? null : tagName;
|
|
20270
20773
|
}
|
|
20271
20774
|
return null;
|
|
20272
20775
|
}
|
|
@@ -22352,17 +22855,17 @@ function serializePlaceholderValue(value) {
|
|
|
22352
22855
|
var NG_CONTENT_SELECT_ATTR2 = "select";
|
|
22353
22856
|
var NG_PROJECT_AS_ATTR_NAME = "ngProjectAs";
|
|
22354
22857
|
var EVENT_BINDING_SCOPE_GLOBALS = /* @__PURE__ */ new Set(["$event"]);
|
|
22355
|
-
var
|
|
22356
|
-
var
|
|
22858
|
+
var NG_TEMPLATE_TAG_NAME2 = "ng-template";
|
|
22859
|
+
var GLOBAL_TARGET_RESOLVERS2 = /* @__PURE__ */ new Map([["window", Identifiers.resolveWindow], ["document", Identifiers.resolveDocument], ["body", Identifiers.resolveBody]]);
|
|
22357
22860
|
var LEADING_TRIVIA_CHARS = [" ", "\n", "\r", " "];
|
|
22358
22861
|
function renderFlagCheckIfStmt(flags, statements) {
|
|
22359
22862
|
return ifStmt(variable(RENDER_FLAGS).bitwiseAnd(literal(flags), null, false), statements);
|
|
22360
22863
|
}
|
|
22361
22864
|
function prepareEventListenerParameters(eventAst, handlerName = null, scope = null) {
|
|
22362
22865
|
const { type, name, target, phase, handler } = eventAst;
|
|
22363
|
-
if (target && !
|
|
22866
|
+
if (target && !GLOBAL_TARGET_RESOLVERS2.has(target)) {
|
|
22364
22867
|
throw new Error(`Unexpected global target '${target}' defined for '${name}' event.
|
|
22365
|
-
Supported list of global targets: ${Array.from(
|
|
22868
|
+
Supported list of global targets: ${Array.from(GLOBAL_TARGET_RESOLVERS2.keys())}.`);
|
|
22366
22869
|
}
|
|
22367
22870
|
const eventArgumentName = "$event";
|
|
22368
22871
|
const implicitReceiverAccesses = /* @__PURE__ */ new Set();
|
|
@@ -22395,7 +22898,7 @@ function prepareEventListenerParameters(eventAst, handlerName = null, scope = nu
|
|
|
22395
22898
|
if (target) {
|
|
22396
22899
|
params.push(
|
|
22397
22900
|
literal(false),
|
|
22398
|
-
importExpr(
|
|
22901
|
+
importExpr(GLOBAL_TARGET_RESOLVERS2.get(target))
|
|
22399
22902
|
);
|
|
22400
22903
|
}
|
|
22401
22904
|
return params;
|
|
@@ -22941,10 +23444,10 @@ var TemplateDefinitionBuilder = class {
|
|
|
22941
23444
|
var _a2;
|
|
22942
23445
|
const tagNameWithoutNamespace = template2.tagName ? splitNsName(template2.tagName)[1] : template2.tagName;
|
|
22943
23446
|
const contextNameSuffix = template2.tagName ? "_" + sanitizeIdentifier(template2.tagName) : "";
|
|
22944
|
-
const attrsExprs = this.getAttributeExpressions(
|
|
23447
|
+
const attrsExprs = this.getAttributeExpressions(NG_TEMPLATE_TAG_NAME2, template2.attributes, template2.inputs, template2.outputs, void 0, template2.templateAttrs);
|
|
22945
23448
|
const templateIndex = this.createEmbeddedTemplateFn(tagNameWithoutNamespace, template2.children, contextNameSuffix, template2.sourceSpan, template2.variables, attrsExprs, template2.references, template2.i18n);
|
|
22946
23449
|
this.templatePropertyBindings(templateIndex, template2.templateAttrs);
|
|
22947
|
-
if (tagNameWithoutNamespace ===
|
|
23450
|
+
if (tagNameWithoutNamespace === NG_TEMPLATE_TAG_NAME2) {
|
|
22948
23451
|
const [i18nInputs, inputs] = partitionArray(template2.inputs, hasI18nMeta);
|
|
22949
23452
|
if (i18nInputs.length > 0) {
|
|
22950
23453
|
this.i18nAttributesInstruction(templateIndex, i18nInputs, (_a2 = template2.startSourceSpan) != null ? _a2 : template2.sourceSpan);
|
|
@@ -23185,8 +23688,8 @@ var TemplateDefinitionBuilder = class {
|
|
|
23185
23688
|
}
|
|
23186
23689
|
if (root !== null) {
|
|
23187
23690
|
const name = root instanceof Element ? root.name : root.tagName;
|
|
23188
|
-
tagName = name ===
|
|
23189
|
-
attrsExprs = this.getAttributeExpressions(
|
|
23691
|
+
tagName = name === NG_TEMPLATE_TAG_NAME2 ? null : name;
|
|
23692
|
+
attrsExprs = this.getAttributeExpressions(NG_TEMPLATE_TAG_NAME2, root.attributes, root.inputs, []);
|
|
23190
23693
|
}
|
|
23191
23694
|
return { tagName, attrsExprs };
|
|
23192
23695
|
}
|
|
@@ -23808,21 +24311,6 @@ var TrackByBindingScope = class extends BindingScope {
|
|
|
23808
24311
|
return this.componentAccessCount;
|
|
23809
24312
|
}
|
|
23810
24313
|
};
|
|
23811
|
-
function createCssSelector(elementName, attributes) {
|
|
23812
|
-
const cssSelector = new CssSelector();
|
|
23813
|
-
const elementNameNoNs = splitNsName(elementName)[1];
|
|
23814
|
-
cssSelector.setElement(elementNameNoNs);
|
|
23815
|
-
Object.getOwnPropertyNames(attributes).forEach((name) => {
|
|
23816
|
-
const nameNoNs = splitNsName(name)[1];
|
|
23817
|
-
const value = attributes[name];
|
|
23818
|
-
cssSelector.addAttribute(nameNoNs, value);
|
|
23819
|
-
if (name.toLowerCase() === "class") {
|
|
23820
|
-
const classes = value.trim().split(/\s+/);
|
|
23821
|
-
classes.forEach((className) => cssSelector.addClassName(className));
|
|
23822
|
-
}
|
|
23823
|
-
});
|
|
23824
|
-
return cssSelector;
|
|
23825
|
-
}
|
|
23826
24314
|
function getNgProjectAsLiteral(attribute2) {
|
|
23827
24315
|
const parsedR3Selector = parseSelectorToR3Selector(attribute2.value)[0];
|
|
23828
24316
|
return [literal(5), asLiteral(parsedR3Selector)];
|
|
@@ -24361,6 +24849,7 @@ function createHostBindingsFunction(hostBindingsMetadata, typeSourceSpan, bindin
|
|
|
24361
24849
|
}
|
|
24362
24850
|
const hostJob = ingestHostBinding({
|
|
24363
24851
|
componentName: name,
|
|
24852
|
+
componentSelector: selector,
|
|
24364
24853
|
properties: bindings,
|
|
24365
24854
|
events: eventBindings,
|
|
24366
24855
|
attributes: hostBindingsMetadata.attributes
|
|
@@ -24373,6 +24862,8 @@ function createHostBindingsFunction(hostBindingsMetadata, typeSourceSpan, bindin
|
|
|
24373
24862
|
}
|
|
24374
24863
|
return emitHostBindingFunction(hostJob);
|
|
24375
24864
|
}
|
|
24865
|
+
let bindingId = 0;
|
|
24866
|
+
const getNextBindingId = () => `${bindingId++}`;
|
|
24376
24867
|
const bindingContext = variable(CONTEXT_NAME);
|
|
24377
24868
|
const styleBuilder = new StylingBuilder(bindingContext);
|
|
24378
24869
|
const { styleAttr, classAttr } = hostBindingsMetadata.specialAttributes;
|
|
@@ -24422,7 +24913,7 @@ function createHostBindingsFunction(hostBindingsMetadata, typeSourceSpan, bindin
|
|
|
24422
24913
|
const syntheticHostBindings = [];
|
|
24423
24914
|
for (const binding of allOtherBindings) {
|
|
24424
24915
|
const value = binding.expression.visit(getValueConverter());
|
|
24425
|
-
const bindingExpr = bindingFn(bindingContext, value);
|
|
24916
|
+
const bindingExpr = bindingFn(bindingContext, value, getNextBindingId);
|
|
24426
24917
|
const { bindingName, instruction, isAttribute } = getBindingNameAndInstruction(binding);
|
|
24427
24918
|
const securityContexts = bindingParser.calcPossibleSecurityContexts(selector, bindingName, isAttribute).filter((context) => context !== SecurityContext.NONE);
|
|
24428
24919
|
let sanitizerFn = null;
|
|
@@ -24467,9 +24958,11 @@ function createHostBindingsFunction(hostBindingsMetadata, typeSourceSpan, bindin
|
|
|
24467
24958
|
styleBuilder.buildUpdateLevelInstructions(getValueConverter()).forEach((instruction) => {
|
|
24468
24959
|
for (const call2 of instruction.calls) {
|
|
24469
24960
|
totalHostVarsCount += Math.max(call2.allocateBindingSlots - MIN_STYLING_BINDING_SLOTS_REQUIRED, 0);
|
|
24961
|
+
const { params, stmts } = convertStylingCall(call2, bindingContext, bindingFn, getNextBindingId);
|
|
24962
|
+
updateVariables.push(...stmts);
|
|
24470
24963
|
updateInstructions.push({
|
|
24471
24964
|
reference: instruction.reference,
|
|
24472
|
-
paramsOrFn:
|
|
24965
|
+
paramsOrFn: params,
|
|
24473
24966
|
span: null
|
|
24474
24967
|
});
|
|
24475
24968
|
}
|
|
@@ -24491,11 +24984,19 @@ function createHostBindingsFunction(hostBindingsMetadata, typeSourceSpan, bindin
|
|
|
24491
24984
|
}
|
|
24492
24985
|
return null;
|
|
24493
24986
|
}
|
|
24494
|
-
function bindingFn(implicit, value) {
|
|
24495
|
-
return convertPropertyBinding(null, implicit, value,
|
|
24987
|
+
function bindingFn(implicit, value, getNextBindingIdFn) {
|
|
24988
|
+
return convertPropertyBinding(null, implicit, value, getNextBindingIdFn());
|
|
24496
24989
|
}
|
|
24497
|
-
function convertStylingCall(call2, bindingContext, bindingFn2) {
|
|
24498
|
-
|
|
24990
|
+
function convertStylingCall(call2, bindingContext, bindingFn2, getNextBindingIdFn) {
|
|
24991
|
+
const stmts = [];
|
|
24992
|
+
const params = call2.params((value) => {
|
|
24993
|
+
const result = bindingFn2(bindingContext, value, getNextBindingIdFn);
|
|
24994
|
+
if (Array.isArray(result.stmts) && result.stmts.length > 0) {
|
|
24995
|
+
stmts.push(...result.stmts);
|
|
24996
|
+
}
|
|
24997
|
+
return result.currValExpr;
|
|
24998
|
+
});
|
|
24999
|
+
return { params, stmts };
|
|
24499
25000
|
}
|
|
24500
25001
|
function getBindingNameAndInstruction(binding) {
|
|
24501
25002
|
let bindingName = binding.name;
|
|
@@ -24810,13 +25311,13 @@ var DirectiveBinder = class {
|
|
|
24810
25311
|
template2.forEach((node) => node.visit(this));
|
|
24811
25312
|
}
|
|
24812
25313
|
visitElement(element2) {
|
|
24813
|
-
this.visitElementOrTemplate(element2
|
|
25314
|
+
this.visitElementOrTemplate(element2);
|
|
24814
25315
|
}
|
|
24815
25316
|
visitTemplate(template2) {
|
|
24816
|
-
this.visitElementOrTemplate(
|
|
25317
|
+
this.visitElementOrTemplate(template2);
|
|
24817
25318
|
}
|
|
24818
|
-
visitElementOrTemplate(
|
|
24819
|
-
const cssSelector =
|
|
25319
|
+
visitElementOrTemplate(node) {
|
|
25320
|
+
const cssSelector = createCssSelectorFromNode(node);
|
|
24820
25321
|
const directives = [];
|
|
24821
25322
|
this.matcher.match(cssSelector, (_selector, results) => directives.push(...results));
|
|
24822
25323
|
if (directives.length > 0) {
|
|
@@ -25804,7 +26305,7 @@ function publishFacade(global) {
|
|
|
25804
26305
|
}
|
|
25805
26306
|
|
|
25806
26307
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/version.mjs
|
|
25807
|
-
var VERSION2 = new Version("17.0.
|
|
26308
|
+
var VERSION2 = new Version("17.0.7");
|
|
25808
26309
|
|
|
25809
26310
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/i18n/extractor_merger.mjs
|
|
25810
26311
|
var _I18N_ATTR = "i18n";
|
|
@@ -26870,7 +27371,7 @@ var MINIMUM_PARTIAL_LINKER_VERSION = "12.0.0";
|
|
|
26870
27371
|
function compileDeclareClassMetadata(metadata) {
|
|
26871
27372
|
const definitionMap = new DefinitionMap();
|
|
26872
27373
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION));
|
|
26873
|
-
definitionMap.set("version", literal("17.0.
|
|
27374
|
+
definitionMap.set("version", literal("17.0.7"));
|
|
26874
27375
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
26875
27376
|
definitionMap.set("type", metadata.type);
|
|
26876
27377
|
definitionMap.set("decorators", metadata.decorators);
|
|
@@ -26941,7 +27442,7 @@ function createDirectiveDefinitionMap(meta) {
|
|
|
26941
27442
|
const hasTransformFunctions = Object.values(meta.inputs).some((input) => input.transformFunction !== null);
|
|
26942
27443
|
const minVersion = hasTransformFunctions ? MINIMUM_PARTIAL_LINKER_VERSION2 : "14.0.0";
|
|
26943
27444
|
definitionMap.set("minVersion", literal(minVersion));
|
|
26944
|
-
definitionMap.set("version", literal("17.0.
|
|
27445
|
+
definitionMap.set("version", literal("17.0.7"));
|
|
26945
27446
|
definitionMap.set("type", meta.type.value);
|
|
26946
27447
|
if (meta.isStandalone) {
|
|
26947
27448
|
definitionMap.set("isStandalone", literal(meta.isStandalone));
|
|
@@ -27173,7 +27674,7 @@ var MINIMUM_PARTIAL_LINKER_VERSION3 = "12.0.0";
|
|
|
27173
27674
|
function compileDeclareFactoryFunction(meta) {
|
|
27174
27675
|
const definitionMap = new DefinitionMap();
|
|
27175
27676
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION3));
|
|
27176
|
-
definitionMap.set("version", literal("17.0.
|
|
27677
|
+
definitionMap.set("version", literal("17.0.7"));
|
|
27177
27678
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
27178
27679
|
definitionMap.set("type", meta.type.value);
|
|
27179
27680
|
definitionMap.set("deps", compileDependencies(meta.deps));
|
|
@@ -27196,7 +27697,7 @@ function compileDeclareInjectableFromMetadata(meta) {
|
|
|
27196
27697
|
function createInjectableDefinitionMap(meta) {
|
|
27197
27698
|
const definitionMap = new DefinitionMap();
|
|
27198
27699
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION4));
|
|
27199
|
-
definitionMap.set("version", literal("17.0.
|
|
27700
|
+
definitionMap.set("version", literal("17.0.7"));
|
|
27200
27701
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
27201
27702
|
definitionMap.set("type", meta.type.value);
|
|
27202
27703
|
if (meta.providedIn !== void 0) {
|
|
@@ -27234,7 +27735,7 @@ function compileDeclareInjectorFromMetadata(meta) {
|
|
|
27234
27735
|
function createInjectorDefinitionMap(meta) {
|
|
27235
27736
|
const definitionMap = new DefinitionMap();
|
|
27236
27737
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION5));
|
|
27237
|
-
definitionMap.set("version", literal("17.0.
|
|
27738
|
+
definitionMap.set("version", literal("17.0.7"));
|
|
27238
27739
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
27239
27740
|
definitionMap.set("type", meta.type.value);
|
|
27240
27741
|
definitionMap.set("providers", meta.providers);
|
|
@@ -27258,7 +27759,7 @@ function createNgModuleDefinitionMap(meta) {
|
|
|
27258
27759
|
throw new Error("Invalid path! Local compilation mode should not get into the partial compilation path");
|
|
27259
27760
|
}
|
|
27260
27761
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION6));
|
|
27261
|
-
definitionMap.set("version", literal("17.0.
|
|
27762
|
+
definitionMap.set("version", literal("17.0.7"));
|
|
27262
27763
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
27263
27764
|
definitionMap.set("type", meta.type.value);
|
|
27264
27765
|
if (meta.bootstrap.length > 0) {
|
|
@@ -27293,7 +27794,7 @@ function compileDeclarePipeFromMetadata(meta) {
|
|
|
27293
27794
|
function createPipeDefinitionMap(meta) {
|
|
27294
27795
|
const definitionMap = new DefinitionMap();
|
|
27295
27796
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION7));
|
|
27296
|
-
definitionMap.set("version", literal("17.0.
|
|
27797
|
+
definitionMap.set("version", literal("17.0.7"));
|
|
27297
27798
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
27298
27799
|
definitionMap.set("type", meta.type.value);
|
|
27299
27800
|
if (meta.isStandalone) {
|
|
@@ -27310,7 +27811,7 @@ function createPipeDefinitionMap(meta) {
|
|
|
27310
27811
|
publishFacade(_global);
|
|
27311
27812
|
|
|
27312
27813
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/version.mjs
|
|
27313
|
-
var VERSION3 = new Version("17.0.
|
|
27814
|
+
var VERSION3 = new Version("17.0.7");
|
|
27314
27815
|
|
|
27315
27816
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/transformers/api.mjs
|
|
27316
27817
|
var EmitFlags;
|
|
@@ -27498,6 +27999,7 @@ var ErrorCode;
|
|
|
27498
27999
|
ErrorCode2[ErrorCode2["MISSING_REQUIRED_INPUTS"] = 8008] = "MISSING_REQUIRED_INPUTS";
|
|
27499
28000
|
ErrorCode2[ErrorCode2["ILLEGAL_FOR_LOOP_TRACK_ACCESS"] = 8009] = "ILLEGAL_FOR_LOOP_TRACK_ACCESS";
|
|
27500
28001
|
ErrorCode2[ErrorCode2["INACCESSIBLE_DEFERRED_TRIGGER_ELEMENT"] = 8010] = "INACCESSIBLE_DEFERRED_TRIGGER_ELEMENT";
|
|
28002
|
+
ErrorCode2[ErrorCode2["CONTROL_FLOW_PREVENTING_CONTENT_PROJECTION"] = 8011] = "CONTROL_FLOW_PREVENTING_CONTENT_PROJECTION";
|
|
27501
28003
|
ErrorCode2[ErrorCode2["INVALID_BANANA_IN_BOX"] = 8101] = "INVALID_BANANA_IN_BOX";
|
|
27502
28004
|
ErrorCode2[ErrorCode2["NULLISH_COALESCING_NOT_NULLABLE"] = 8102] = "NULLISH_COALESCING_NOT_NULLABLE";
|
|
27503
28005
|
ErrorCode2[ErrorCode2["MISSING_CONTROL_FLOW_DIRECTIVE"] = 8103] = "MISSING_CONTROL_FLOW_DIRECTIVE";
|
|
@@ -27607,6 +28109,7 @@ var ExtendedTemplateDiagnosticName;
|
|
|
27607
28109
|
ExtendedTemplateDiagnosticName2["SUFFIX_NOT_SUPPORTED"] = "suffixNotSupported";
|
|
27608
28110
|
ExtendedTemplateDiagnosticName2["SKIP_HYDRATION_NOT_STATIC"] = "skipHydrationNotStatic";
|
|
27609
28111
|
ExtendedTemplateDiagnosticName2["INTERPOLATED_SIGNAL_NOT_INVOKED"] = "interpolatedSignalNotInvoked";
|
|
28112
|
+
ExtendedTemplateDiagnosticName2["CONTROL_FLOW_PREVENTING_CONTENT_PROJECTION"] = "controlFlowPreventingContentProjection";
|
|
27610
28113
|
})(ExtendedTemplateDiagnosticName || (ExtendedTemplateDiagnosticName = {}));
|
|
27611
28114
|
|
|
27612
28115
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/transform/src/api.mjs
|
|
@@ -27850,6 +28353,7 @@ var ClassMemberKind;
|
|
|
27850
28353
|
ClassMemberKind2[ClassMemberKind2["Property"] = 3] = "Property";
|
|
27851
28354
|
ClassMemberKind2[ClassMemberKind2["Method"] = 4] = "Method";
|
|
27852
28355
|
})(ClassMemberKind || (ClassMemberKind = {}));
|
|
28356
|
+
var AmbientImport = {};
|
|
27853
28357
|
|
|
27854
28358
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/reflection/src/type_to_value.mjs
|
|
27855
28359
|
var import_typescript7 = __toESM(require("typescript"), 1);
|
|
@@ -28238,19 +28742,18 @@ var TypeScriptReflectionHost = class {
|
|
|
28238
28742
|
return this.getDeclarationOfSymbol(targetSymbol, originalId);
|
|
28239
28743
|
}
|
|
28240
28744
|
const importInfo = originalId && this.getImportOfIdentifier(originalId);
|
|
28241
|
-
const viaModule = importInfo !== null && importInfo.from !== null && !importInfo.from.startsWith(".") ? importInfo.from : null;
|
|
28242
28745
|
while (symbol.flags & import_typescript9.default.SymbolFlags.Alias) {
|
|
28243
28746
|
symbol = this.checker.getAliasedSymbol(symbol);
|
|
28244
28747
|
}
|
|
28245
28748
|
if (symbol.valueDeclaration !== void 0) {
|
|
28246
28749
|
return {
|
|
28247
28750
|
node: symbol.valueDeclaration,
|
|
28248
|
-
viaModule
|
|
28751
|
+
viaModule: this._viaModule(symbol.valueDeclaration, originalId, importInfo)
|
|
28249
28752
|
};
|
|
28250
28753
|
} else if (symbol.declarations !== void 0 && symbol.declarations.length > 0) {
|
|
28251
28754
|
return {
|
|
28252
28755
|
node: symbol.declarations[0],
|
|
28253
|
-
viaModule
|
|
28756
|
+
viaModule: this._viaModule(symbol.declarations[0], originalId, importInfo)
|
|
28254
28757
|
};
|
|
28255
28758
|
} else {
|
|
28256
28759
|
return null;
|
|
@@ -28346,6 +28849,12 @@ var TypeScriptReflectionHost = class {
|
|
|
28346
28849
|
}
|
|
28347
28850
|
return exportSet;
|
|
28348
28851
|
}
|
|
28852
|
+
_viaModule(declaration, originalId, importInfo) {
|
|
28853
|
+
if (importInfo === null && originalId !== null && declaration.getSourceFile() !== originalId.getSourceFile()) {
|
|
28854
|
+
return AmbientImport;
|
|
28855
|
+
}
|
|
28856
|
+
return importInfo !== null && importInfo.from !== null && !importInfo.from.startsWith(".") ? importInfo.from : null;
|
|
28857
|
+
}
|
|
28349
28858
|
};
|
|
28350
28859
|
function reflectTypeEntityToDeclaration(type, checker) {
|
|
28351
28860
|
let realSymbol = checker.getSymbolAtLocation(type);
|
|
@@ -29119,6 +29628,7 @@ var ImportFlags;
|
|
|
29119
29628
|
ImportFlags2[ImportFlags2["NoAliasing"] = 2] = "NoAliasing";
|
|
29120
29629
|
ImportFlags2[ImportFlags2["AllowTypeImports"] = 4] = "AllowTypeImports";
|
|
29121
29630
|
ImportFlags2[ImportFlags2["AllowRelativeDtsImports"] = 8] = "AllowRelativeDtsImports";
|
|
29631
|
+
ImportFlags2[ImportFlags2["AllowAmbientReferences"] = 16] = "AllowAmbientReferences";
|
|
29122
29632
|
})(ImportFlags || (ImportFlags = {}));
|
|
29123
29633
|
function assertSuccessfulReferenceEmit(result, origin, typeKind) {
|
|
29124
29634
|
if (result.kind === 0) {
|
|
@@ -29159,6 +29669,18 @@ var LocalIdentifierStrategy = class {
|
|
|
29159
29669
|
importedFile: null
|
|
29160
29670
|
};
|
|
29161
29671
|
}
|
|
29672
|
+
if (ref.isAmbient && importFlags & ImportFlags.AllowAmbientReferences) {
|
|
29673
|
+
const identifier2 = identifierOfNode(ref.node);
|
|
29674
|
+
if (identifier2 !== null) {
|
|
29675
|
+
return {
|
|
29676
|
+
kind: 0,
|
|
29677
|
+
expression: new WrappedNodeExpr(identifier2),
|
|
29678
|
+
importedFile: null
|
|
29679
|
+
};
|
|
29680
|
+
} else {
|
|
29681
|
+
return null;
|
|
29682
|
+
}
|
|
29683
|
+
}
|
|
29162
29684
|
const identifier = ref.getIdentityIn(context);
|
|
29163
29685
|
if (identifier !== null) {
|
|
29164
29686
|
return {
|
|
@@ -29643,7 +30165,13 @@ var Reference2 = class {
|
|
|
29643
30165
|
this.identifiers = [];
|
|
29644
30166
|
this.synthetic = false;
|
|
29645
30167
|
this._alias = null;
|
|
29646
|
-
|
|
30168
|
+
if (bestGuessOwningModule === AmbientImport) {
|
|
30169
|
+
this.isAmbient = true;
|
|
30170
|
+
this.bestGuessOwningModule = null;
|
|
30171
|
+
} else {
|
|
30172
|
+
this.isAmbient = false;
|
|
30173
|
+
this.bestGuessOwningModule = bestGuessOwningModule;
|
|
30174
|
+
}
|
|
29647
30175
|
const id = identifierOfNode(node);
|
|
29648
30176
|
if (id !== null) {
|
|
29649
30177
|
this.identifiers.push(id);
|
|
@@ -29686,13 +30214,13 @@ var Reference2 = class {
|
|
|
29686
30214
|
return id !== null ? id : fallback;
|
|
29687
30215
|
}
|
|
29688
30216
|
cloneWithAlias(alias) {
|
|
29689
|
-
const ref = new Reference2(this.node, this.bestGuessOwningModule);
|
|
30217
|
+
const ref = new Reference2(this.node, this.isAmbient ? AmbientImport : this.bestGuessOwningModule);
|
|
29690
30218
|
ref.identifiers = [...this.identifiers];
|
|
29691
30219
|
ref._alias = alias;
|
|
29692
30220
|
return ref;
|
|
29693
30221
|
}
|
|
29694
30222
|
cloneWithNoIdentifiers() {
|
|
29695
|
-
const ref = new Reference2(this.node, this.bestGuessOwningModule);
|
|
30223
|
+
const ref = new Reference2(this.node, this.isAmbient ? AmbientImport : this.bestGuessOwningModule);
|
|
29696
30224
|
ref._alias = this._alias;
|
|
29697
30225
|
ref.identifiers = [];
|
|
29698
30226
|
return ref;
|
|
@@ -30261,14 +30789,14 @@ var TypeTranslatorVisitor = class {
|
|
|
30261
30789
|
throw new Error(`Unable to statically determine the declaration file of type node ${target.text}`);
|
|
30262
30790
|
}
|
|
30263
30791
|
let owningModule2 = viaModule;
|
|
30264
|
-
if (declaration.viaModule
|
|
30792
|
+
if (typeof declaration.viaModule === "string") {
|
|
30265
30793
|
owningModule2 = {
|
|
30266
30794
|
specifier: declaration.viaModule,
|
|
30267
30795
|
resolutionContext: type.getSourceFile().fileName
|
|
30268
30796
|
};
|
|
30269
30797
|
}
|
|
30270
|
-
const reference2 = new Reference2(declaration.node, owningModule2);
|
|
30271
|
-
const emittedType = this.refEmitter.emit(reference2, this.contextFile, ImportFlags.NoAliasing | ImportFlags.AllowTypeImports);
|
|
30798
|
+
const reference2 = new Reference2(declaration.node, declaration.viaModule === AmbientImport ? AmbientImport : owningModule2);
|
|
30799
|
+
const emittedType = this.refEmitter.emit(reference2, this.contextFile, ImportFlags.NoAliasing | ImportFlags.AllowTypeImports | ImportFlags.AllowAmbientReferences);
|
|
30272
30800
|
assertSuccessfulReferenceEmit(emittedType, target, "type");
|
|
30273
30801
|
const typeNode = this.translateExpression(emittedType.expression, context);
|
|
30274
30802
|
if (!import_typescript25.default.isTypeReferenceNode(typeNode)) {
|
|
@@ -31677,6 +32205,7 @@ var DtsMetadataReader = class {
|
|
|
31677
32205
|
const isStructural = !isComponent && ctorParams !== null && ctorParams.some((param) => {
|
|
31678
32206
|
return param.typeValueReference.kind === 1 && param.typeValueReference.moduleName === "@angular/core" && param.typeValueReference.importedName === "TemplateRef";
|
|
31679
32207
|
});
|
|
32208
|
+
const ngContentSelectors = def.type.typeArguments.length > 6 ? readStringArrayType(def.type.typeArguments[6]) : null;
|
|
31680
32209
|
const isStandalone = def.type.typeArguments.length > 7 && ((_a2 = readBooleanType(def.type.typeArguments[7])) != null ? _a2 : false);
|
|
31681
32210
|
const inputs = ClassPropertyMapping.fromMappedObject(readInputsType(def.type.typeArguments[3]));
|
|
31682
32211
|
const outputs = ClassPropertyMapping.fromMappedObject(readMapType(def.type.typeArguments[4], readStringType));
|
|
@@ -31699,12 +32228,14 @@ var DtsMetadataReader = class {
|
|
|
31699
32228
|
isPoisoned: false,
|
|
31700
32229
|
isStructural,
|
|
31701
32230
|
animationTriggerNames: null,
|
|
32231
|
+
ngContentSelectors,
|
|
31702
32232
|
isStandalone,
|
|
31703
32233
|
isSignal,
|
|
31704
32234
|
imports: null,
|
|
31705
32235
|
schemas: null,
|
|
31706
32236
|
decorator: null,
|
|
31707
|
-
assumedToExportProviders: isComponent && isStandalone
|
|
32237
|
+
assumedToExportProviders: isComponent && isStandalone,
|
|
32238
|
+
preserveWhitespaces: false
|
|
31708
32239
|
});
|
|
31709
32240
|
}
|
|
31710
32241
|
getPipeMetadata(ref) {
|
|
@@ -32964,7 +33495,7 @@ function isVariableDeclarationDeclared(node) {
|
|
|
32964
33495
|
}
|
|
32965
33496
|
var EMPTY = {};
|
|
32966
33497
|
function joinModuleContext(existing, node, decl) {
|
|
32967
|
-
if (decl.viaModule
|
|
33498
|
+
if (typeof decl.viaModule === "string" && decl.viaModule !== existing.absoluteModuleName) {
|
|
32968
33499
|
return {
|
|
32969
33500
|
absoluteModuleName: decl.viaModule,
|
|
32970
33501
|
resolutionContext: node.getSourceFile().fileName
|
|
@@ -34725,7 +35256,7 @@ function assertEmittableInputType(type, contextFile, reflector, refEmitter) {
|
|
|
34725
35256
|
const declaration = reflector.getDeclarationOfIdentifier(node.typeName);
|
|
34726
35257
|
if (declaration !== null) {
|
|
34727
35258
|
if (declaration.node.getSourceFile() !== contextFile) {
|
|
34728
|
-
const emittedType = refEmitter.emit(new Reference2(declaration.node), contextFile, ImportFlags.NoAliasing | ImportFlags.AllowTypeImports | ImportFlags.AllowRelativeDtsImports);
|
|
35259
|
+
const emittedType = refEmitter.emit(new Reference2(declaration.node, declaration.viaModule === AmbientImport ? AmbientImport : null), contextFile, ImportFlags.NoAliasing | ImportFlags.AllowTypeImports | ImportFlags.AllowRelativeDtsImports | ImportFlags.AllowAmbientReferences);
|
|
34729
35260
|
assertSuccessfulReferenceEmit(emittedType, node, "type");
|
|
34730
35261
|
} else if (!reflector.isStaticallyExported(declaration.node)) {
|
|
34731
35262
|
throw new FatalDiagnosticError(ErrorCode.SYMBOL_NOT_EXPORTED, type, `Symbol must be exported in order to be used as the type of an Input transform function`, [makeRelatedInformation(declaration.node, `The symbol is declared here.`)]);
|
|
@@ -35022,7 +35553,9 @@ var DirectiveDecoratorHandler = class {
|
|
|
35022
35553
|
isSignal: analysis.meta.isSignal,
|
|
35023
35554
|
imports: null,
|
|
35024
35555
|
schemas: null,
|
|
35556
|
+
ngContentSelectors: null,
|
|
35025
35557
|
decorator: analysis.decorator,
|
|
35558
|
+
preserveWhitespaces: false,
|
|
35026
35559
|
assumedToExportProviders: false
|
|
35027
35560
|
}));
|
|
35028
35561
|
this.injectableRegistry.registerInjectable(node, {
|
|
@@ -36481,10 +37014,7 @@ var ComponentDecoratorHandler = class {
|
|
|
36481
37014
|
hostDirectives,
|
|
36482
37015
|
rawHostDirectives,
|
|
36483
37016
|
meta: __spreadProps(__spreadValues({}, metadata), {
|
|
36484
|
-
template:
|
|
36485
|
-
nodes: template2.nodes,
|
|
36486
|
-
ngContentSelectors: template2.ngContentSelectors
|
|
36487
|
-
},
|
|
37017
|
+
template: template2,
|
|
36488
37018
|
encapsulation,
|
|
36489
37019
|
changeDetection,
|
|
36490
37020
|
interpolation: (_c2 = template2.interpolationConfig) != null ? _c2 : DEFAULT_INTERPOLATION_CONFIG,
|
|
@@ -36528,6 +37058,7 @@ var ComponentDecoratorHandler = class {
|
|
|
36528
37058
|
return new ComponentSymbol(node, analysis.meta.selector, analysis.inputs, analysis.outputs, analysis.meta.exportAs, analysis.typeCheckMeta, typeParameters);
|
|
36529
37059
|
}
|
|
36530
37060
|
register(node, analysis) {
|
|
37061
|
+
var _a2;
|
|
36531
37062
|
const ref = new Reference2(node);
|
|
36532
37063
|
this.metaRegistry.registerDirectiveMetadata(__spreadProps(__spreadValues({
|
|
36533
37064
|
kind: MetaKind.Directive,
|
|
@@ -36551,7 +37082,9 @@ var ComponentDecoratorHandler = class {
|
|
|
36551
37082
|
animationTriggerNames: analysis.animationTriggerNames,
|
|
36552
37083
|
schemas: analysis.schemas,
|
|
36553
37084
|
decorator: analysis.decorator,
|
|
36554
|
-
assumedToExportProviders: false
|
|
37085
|
+
assumedToExportProviders: false,
|
|
37086
|
+
ngContentSelectors: analysis.template.ngContentSelectors,
|
|
37087
|
+
preserveWhitespaces: (_a2 = analysis.template.preserveWhitespaces) != null ? _a2 : false
|
|
36555
37088
|
}));
|
|
36556
37089
|
this.resourceRegistry.registerResources(analysis.resources, node);
|
|
36557
37090
|
this.injectableRegistry.registerInjectable(node, {
|
|
@@ -36590,6 +37123,7 @@ var ComponentDecoratorHandler = class {
|
|
|
36590
37123
|
return null;
|
|
36591
37124
|
}
|
|
36592
37125
|
typeCheck(ctx, node, meta) {
|
|
37126
|
+
var _a2;
|
|
36593
37127
|
if (this.typeCheckScopeRegistry === null || !import_typescript54.default.isClassDeclaration(node)) {
|
|
36594
37128
|
return;
|
|
36595
37129
|
}
|
|
@@ -36601,7 +37135,7 @@ var ComponentDecoratorHandler = class {
|
|
|
36601
37135
|
return;
|
|
36602
37136
|
}
|
|
36603
37137
|
const binder = new R3TargetBinder(scope.matcher);
|
|
36604
|
-
ctx.addTemplate(new Reference2(node), binder, meta.template.diagNodes, scope.pipes, scope.schemas, meta.template.sourceMapping, meta.template.file, meta.template.errors, meta.meta.isStandalone);
|
|
37138
|
+
ctx.addTemplate(new Reference2(node), binder, meta.template.diagNodes, scope.pipes, scope.schemas, meta.template.sourceMapping, meta.template.file, meta.template.errors, meta.meta.isStandalone, (_a2 = meta.meta.template.preserveWhitespaces) != null ? _a2 : false);
|
|
36605
37139
|
}
|
|
36606
37140
|
extendedTemplateCheck(component, extendedTemplateChecker) {
|
|
36607
37141
|
return extendedTemplateChecker.getDiagnosticsForComponent(component);
|
|
@@ -40253,13 +40787,13 @@ var TypeParameterEmitter = class {
|
|
|
40253
40787
|
return type;
|
|
40254
40788
|
}
|
|
40255
40789
|
let owningModule2 = null;
|
|
40256
|
-
if (declaration.viaModule
|
|
40790
|
+
if (typeof declaration.viaModule === "string") {
|
|
40257
40791
|
owningModule2 = {
|
|
40258
40792
|
specifier: declaration.viaModule,
|
|
40259
40793
|
resolutionContext: type.getSourceFile().fileName
|
|
40260
40794
|
};
|
|
40261
40795
|
}
|
|
40262
|
-
return new Reference2(declaration.node, owningModule2);
|
|
40796
|
+
return new Reference2(declaration.node, declaration.viaModule === AmbientImport ? AmbientImport : owningModule2);
|
|
40263
40797
|
}
|
|
40264
40798
|
translateTypeReference(type, emitReference) {
|
|
40265
40799
|
const reference2 = this.resolveTypeReference(type);
|
|
@@ -40537,12 +41071,12 @@ var Environment = class {
|
|
|
40537
41071
|
assertSuccessfulReferenceEmit(ngExpr, this.contextFile, "class");
|
|
40538
41072
|
return translateExpression(ngExpr.expression, this.importManager);
|
|
40539
41073
|
}
|
|
40540
|
-
canReferenceType(ref) {
|
|
40541
|
-
const result = this.refEmitter.emit(ref, this.contextFile,
|
|
41074
|
+
canReferenceType(ref, flags = ImportFlags.NoAliasing | ImportFlags.AllowTypeImports | ImportFlags.AllowRelativeDtsImports) {
|
|
41075
|
+
const result = this.refEmitter.emit(ref, this.contextFile, flags);
|
|
40542
41076
|
return result.kind === 0;
|
|
40543
41077
|
}
|
|
40544
|
-
referenceType(ref) {
|
|
40545
|
-
const ngExpr = this.refEmitter.emit(ref, this.contextFile,
|
|
41078
|
+
referenceType(ref, flags = ImportFlags.NoAliasing | ImportFlags.AllowTypeImports | ImportFlags.AllowRelativeDtsImports) {
|
|
41079
|
+
const ngExpr = this.refEmitter.emit(ref, this.contextFile, flags);
|
|
40546
41080
|
assertSuccessfulReferenceEmit(ngExpr, this.contextFile, "symbol");
|
|
40547
41081
|
return translateType(new ExpressionType(ngExpr.expression), this.contextFile, this.reflector, this.refEmitter, this.importManager);
|
|
40548
41082
|
}
|
|
@@ -40711,6 +41245,21 @@ Deferred blocks can only access triggers in same view, a parent embedded view or
|
|
|
40711
41245
|
}
|
|
40712
41246
|
this._diagnostics.push(makeTemplateDiagnostic(templateId, this.resolver.getSourceMapping(templateId), trigger.sourceSpan, import_typescript85.default.DiagnosticCategory.Error, ngErrorCode(ErrorCode.INACCESSIBLE_DEFERRED_TRIGGER_ELEMENT), message));
|
|
40713
41247
|
}
|
|
41248
|
+
controlFlowPreventingContentProjection(templateId, category, projectionNode, componentName, slotSelector, controlFlowNode, preservesWhitespaces) {
|
|
41249
|
+
const blockName = controlFlowNode instanceof IfBlockBranch ? "@if" : "@for";
|
|
41250
|
+
const lines = [
|
|
41251
|
+
`Node matches the "${slotSelector}" slot of the "${componentName}" component, but will not be projected into the specific slot because the surrounding ${blockName} has more than one node at its root. To project the node in the right slot, you can:
|
|
41252
|
+
`,
|
|
41253
|
+
`1. Wrap the content of the ${blockName} block in an <ng-container/> that matches the "${slotSelector}" selector.`,
|
|
41254
|
+
`2. Split the content of the ${blockName} block across multiple ${blockName} blocks such that each one only has a single projectable node at its root.`,
|
|
41255
|
+
`3. Remove all content from the ${blockName} block, except for the node being projected.`
|
|
41256
|
+
];
|
|
41257
|
+
if (preservesWhitespaces) {
|
|
41258
|
+
lines.push("Note: the host component has `preserveWhitespaces: true` which may cause whitespace to affect content projection.");
|
|
41259
|
+
}
|
|
41260
|
+
lines.push("", 'This check can be disabled using the `extendedDiagnostics.checks.controlFlowPreventingContentProjection = "suppress" compiler option.`');
|
|
41261
|
+
this._diagnostics.push(makeTemplateDiagnostic(templateId, this.resolver.getSourceMapping(templateId), projectionNode.startSourceSpan, category, ngErrorCode(ErrorCode.CONTROL_FLOW_PREVENTING_CONTENT_PROJECTION), lines.join("\n")));
|
|
41262
|
+
}
|
|
40714
41263
|
};
|
|
40715
41264
|
function makeInlineDiagnostic(templateId, code, node, messageText, relatedInformation) {
|
|
40716
41265
|
return __spreadProps(__spreadValues({}, makeDiagnostic(code, node, messageText, relatedInformation)), {
|
|
@@ -41148,7 +41697,7 @@ var TcbGenericContextBehavior;
|
|
|
41148
41697
|
TcbGenericContextBehavior2[TcbGenericContextBehavior2["FallbackToAny"] = 2] = "FallbackToAny";
|
|
41149
41698
|
})(TcbGenericContextBehavior || (TcbGenericContextBehavior = {}));
|
|
41150
41699
|
function generateTypeCheckBlock(env, ref, name, meta, domSchemaChecker, oobRecorder, genericContextBehavior) {
|
|
41151
|
-
const tcb = new Context2(env, domSchemaChecker, oobRecorder, meta.id, meta.boundTarget, meta.pipes, meta.schemas, meta.isStandalone);
|
|
41700
|
+
const tcb = new Context2(env, domSchemaChecker, oobRecorder, meta.id, meta.boundTarget, meta.pipes, meta.schemas, meta.isStandalone, meta.preserveWhitespaces);
|
|
41152
41701
|
const scope = Scope3.forNodes(tcb, null, null, tcb.boundTarget.target.template, null);
|
|
41153
41702
|
const ctxRawType = env.referenceType(ref);
|
|
41154
41703
|
if (!import_typescript89.default.isTypeReferenceNode(ctxRawType)) {
|
|
@@ -41604,6 +42153,62 @@ var TcbDomSchemaCheckerOp = class extends TcbOp {
|
|
|
41604
42153
|
return null;
|
|
41605
42154
|
}
|
|
41606
42155
|
};
|
|
42156
|
+
var TcbControlFlowContentProjectionOp = class extends TcbOp {
|
|
42157
|
+
constructor(tcb, element2, ngContentSelectors, componentName) {
|
|
42158
|
+
super();
|
|
42159
|
+
this.tcb = tcb;
|
|
42160
|
+
this.element = element2;
|
|
42161
|
+
this.ngContentSelectors = ngContentSelectors;
|
|
42162
|
+
this.componentName = componentName;
|
|
42163
|
+
this.optional = false;
|
|
42164
|
+
this.category = tcb.env.config.controlFlowPreventingContentProjection === "error" ? import_typescript89.default.DiagnosticCategory.Error : import_typescript89.default.DiagnosticCategory.Warning;
|
|
42165
|
+
}
|
|
42166
|
+
execute() {
|
|
42167
|
+
const controlFlowToCheck = this.findPotentialControlFlowNodes();
|
|
42168
|
+
if (controlFlowToCheck.length > 0) {
|
|
42169
|
+
const matcher = new SelectorMatcher();
|
|
42170
|
+
for (const selector of this.ngContentSelectors) {
|
|
42171
|
+
if (selector !== "*") {
|
|
42172
|
+
matcher.addSelectables(CssSelector.parse(selector), selector);
|
|
42173
|
+
}
|
|
42174
|
+
}
|
|
42175
|
+
for (const root of controlFlowToCheck) {
|
|
42176
|
+
for (const child of root.children) {
|
|
42177
|
+
if (child instanceof Element || child instanceof Template) {
|
|
42178
|
+
matcher.match(createCssSelectorFromNode(child), (_, originalSelector) => {
|
|
42179
|
+
this.tcb.oobRecorder.controlFlowPreventingContentProjection(this.tcb.id, this.category, child, this.componentName, originalSelector, root, this.tcb.hostPreserveWhitespaces);
|
|
42180
|
+
});
|
|
42181
|
+
}
|
|
42182
|
+
}
|
|
42183
|
+
}
|
|
42184
|
+
}
|
|
42185
|
+
return null;
|
|
42186
|
+
}
|
|
42187
|
+
findPotentialControlFlowNodes() {
|
|
42188
|
+
const result = [];
|
|
42189
|
+
for (const child of this.element.children) {
|
|
42190
|
+
let eligibleNode = null;
|
|
42191
|
+
if (child instanceof ForLoopBlock) {
|
|
42192
|
+
eligibleNode = child;
|
|
42193
|
+
} else if (child instanceof IfBlock) {
|
|
42194
|
+
eligibleNode = child.branches[0];
|
|
42195
|
+
}
|
|
42196
|
+
if (eligibleNode === null || eligibleNode.children.length < 2) {
|
|
42197
|
+
continue;
|
|
42198
|
+
}
|
|
42199
|
+
const rootNodeCount = eligibleNode.children.reduce((count, node) => {
|
|
42200
|
+
if (!(node instanceof Text) || this.tcb.hostPreserveWhitespaces || node.value.trim().length > 0) {
|
|
42201
|
+
count++;
|
|
42202
|
+
}
|
|
42203
|
+
return count;
|
|
42204
|
+
}, 0);
|
|
42205
|
+
if (rootNodeCount > 1) {
|
|
42206
|
+
result.push(eligibleNode);
|
|
42207
|
+
}
|
|
42208
|
+
}
|
|
42209
|
+
return result;
|
|
42210
|
+
}
|
|
42211
|
+
};
|
|
41607
42212
|
var ATTR_TO_PROP = new Map(Object.entries({
|
|
41608
42213
|
"class": "className",
|
|
41609
42214
|
"for": "htmlFor",
|
|
@@ -41785,9 +42390,7 @@ var TcbBlockImplicitVariableOp = class extends TcbOp {
|
|
|
41785
42390
|
this.scope = scope;
|
|
41786
42391
|
this.type = type;
|
|
41787
42392
|
this.variable = variable2;
|
|
41788
|
-
|
|
41789
|
-
get optional() {
|
|
41790
|
-
return false;
|
|
42393
|
+
this.optional = true;
|
|
41791
42394
|
}
|
|
41792
42395
|
execute() {
|
|
41793
42396
|
const id = this.tcb.allocateId();
|
|
@@ -41923,7 +42526,11 @@ var TcbForOfOp = class extends TcbOp {
|
|
|
41923
42526
|
}
|
|
41924
42527
|
execute() {
|
|
41925
42528
|
const loopScope = Scope3.forNodes(this.tcb, this.scope, this.block, this.block.children, null);
|
|
41926
|
-
const
|
|
42529
|
+
const initializerId = loopScope.resolve(this.block.item);
|
|
42530
|
+
if (!import_typescript89.default.isIdentifier(initializerId)) {
|
|
42531
|
+
throw new Error(`Could not resolve for loop variable ${this.block.item.name} to an identifier`);
|
|
42532
|
+
}
|
|
42533
|
+
const initializer = import_typescript89.default.factory.createVariableDeclarationList([import_typescript89.default.factory.createVariableDeclaration(initializerId)], import_typescript89.default.NodeFlags.Const);
|
|
41927
42534
|
const expression = import_typescript89.default.factory.createNonNullExpression(tcbExpression(this.block.expression, this.tcb, loopScope));
|
|
41928
42535
|
const trackTranslator = new TcbForLoopTrackTranslator(this.tcb, loopScope, this.block);
|
|
41929
42536
|
const trackExpression = trackTranslator.translate(this.block.trackBy);
|
|
@@ -41937,7 +42544,7 @@ var TcbForOfOp = class extends TcbOp {
|
|
|
41937
42544
|
};
|
|
41938
42545
|
var INFER_TYPE_FOR_CIRCULAR_OP_EXPR = import_typescript89.default.factory.createNonNullExpression(import_typescript89.default.factory.createNull());
|
|
41939
42546
|
var Context2 = class {
|
|
41940
|
-
constructor(env, domSchemaChecker, oobRecorder, id, boundTarget, pipes, schemas, hostIsStandalone) {
|
|
42547
|
+
constructor(env, domSchemaChecker, oobRecorder, id, boundTarget, pipes, schemas, hostIsStandalone, hostPreserveWhitespaces) {
|
|
41941
42548
|
this.env = env;
|
|
41942
42549
|
this.domSchemaChecker = domSchemaChecker;
|
|
41943
42550
|
this.oobRecorder = oobRecorder;
|
|
@@ -41946,6 +42553,7 @@ var Context2 = class {
|
|
|
41946
42553
|
this.pipes = pipes;
|
|
41947
42554
|
this.schemas = schemas;
|
|
41948
42555
|
this.hostIsStandalone = hostIsStandalone;
|
|
42556
|
+
this.hostPreserveWhitespaces = hostPreserveWhitespaces;
|
|
41949
42557
|
this.nextId = 1;
|
|
41950
42558
|
}
|
|
41951
42559
|
allocateId() {
|
|
@@ -41993,7 +42601,9 @@ var _Scope = class {
|
|
|
41993
42601
|
this.registerVariable(scope, expressionAlias, new TcbBlockVariableOp(tcb, scope, tcbExpression(expression, tcb, scope), expressionAlias));
|
|
41994
42602
|
}
|
|
41995
42603
|
} else if (scopedNode instanceof ForLoopBlock) {
|
|
41996
|
-
|
|
42604
|
+
const loopInitializer = tcb.allocateId();
|
|
42605
|
+
addParseSpanInfo(loopInitializer, scopedNode.item.sourceSpan);
|
|
42606
|
+
scope.varMap.set(scopedNode.item, loopInitializer);
|
|
41997
42607
|
for (const [name, variable2] of Object.entries(scopedNode.contextVariables)) {
|
|
41998
42608
|
if (!this.forLoopContextVariableTypes.has(name)) {
|
|
41999
42609
|
throw new Error(`Unrecognized for loop context variable ${name}`);
|
|
@@ -42058,7 +42668,8 @@ var _Scope = class {
|
|
|
42058
42668
|
if (ref instanceof Reference && this.referenceOpMap.has(ref)) {
|
|
42059
42669
|
return this.resolveOp(this.referenceOpMap.get(ref));
|
|
42060
42670
|
} else if (ref instanceof Variable && this.varMap.has(ref)) {
|
|
42061
|
-
|
|
42671
|
+
const opIndexOrNode = this.varMap.get(ref);
|
|
42672
|
+
return typeof opIndexOrNode === "number" ? this.resolveOp(opIndexOrNode) : opIndexOrNode;
|
|
42062
42673
|
} else if (ref instanceof Template && directive === void 0 && this.templateCtxOpMap.has(ref)) {
|
|
42063
42674
|
return this.resolveOp(this.templateCtxOpMap.get(ref));
|
|
42064
42675
|
} else if ((ref instanceof Element || ref instanceof Template) && directive !== void 0 && this.directiveOpMap.has(ref)) {
|
|
@@ -42098,6 +42709,9 @@ var _Scope = class {
|
|
|
42098
42709
|
if (node instanceof Element) {
|
|
42099
42710
|
const opIndex = this.opQueue.push(new TcbElementOp(this.tcb, this, node)) - 1;
|
|
42100
42711
|
this.elementOpMap.set(node, opIndex);
|
|
42712
|
+
if (this.tcb.env.config.controlFlowPreventingContentProjection !== "suppress") {
|
|
42713
|
+
this.appendContentProjectionCheckOp(node);
|
|
42714
|
+
}
|
|
42101
42715
|
this.appendDirectivesAndInputsOfNode(node);
|
|
42102
42716
|
this.appendOutputsOfNode(node);
|
|
42103
42717
|
this.appendChildren(node);
|
|
@@ -42241,6 +42855,16 @@ var _Scope = class {
|
|
|
42241
42855
|
}
|
|
42242
42856
|
}
|
|
42243
42857
|
}
|
|
42858
|
+
appendContentProjectionCheckOp(root) {
|
|
42859
|
+
var _a2;
|
|
42860
|
+
const meta = ((_a2 = this.tcb.boundTarget.getDirectivesOfNode(root)) == null ? void 0 : _a2.find((meta2) => meta2.isComponent)) || null;
|
|
42861
|
+
if (meta !== null && meta.ngContentSelectors !== null && meta.ngContentSelectors.length > 0) {
|
|
42862
|
+
const selectors = meta.ngContentSelectors;
|
|
42863
|
+
if (selectors.length > 1 || selectors.length === 1 && selectors[0] !== "*") {
|
|
42864
|
+
this.opQueue.push(new TcbControlFlowContentProjectionOp(this.tcb, root, selectors, meta.name));
|
|
42865
|
+
}
|
|
42866
|
+
}
|
|
42867
|
+
}
|
|
42244
42868
|
appendDeferredBlock(block) {
|
|
42245
42869
|
this.appendDeferredTriggers(block, block.triggers);
|
|
42246
42870
|
this.appendDeferredTriggers(block, block.prefetchTriggers);
|
|
@@ -42584,7 +43208,7 @@ var TypeCheckContextImpl = class {
|
|
|
42584
43208
|
throw new Error(`AssertionError: invalid inlining configuration.`);
|
|
42585
43209
|
}
|
|
42586
43210
|
}
|
|
42587
|
-
addTemplate(ref, binder, template2, pipes, schemas, sourceMapping, file, parseErrors, isStandalone) {
|
|
43211
|
+
addTemplate(ref, binder, template2, pipes, schemas, sourceMapping, file, parseErrors, isStandalone, preserveWhitespaces) {
|
|
42588
43212
|
if (!this.host.shouldCheckComponent(ref.node)) {
|
|
42589
43213
|
return;
|
|
42590
43214
|
}
|
|
@@ -42637,7 +43261,8 @@ var TypeCheckContextImpl = class {
|
|
|
42637
43261
|
boundTarget,
|
|
42638
43262
|
pipes,
|
|
42639
43263
|
schemas,
|
|
42640
|
-
isStandalone
|
|
43264
|
+
isStandalone,
|
|
43265
|
+
preserveWhitespaces
|
|
42641
43266
|
};
|
|
42642
43267
|
this.perf.eventCount(PerfEvent.GenerateTcb);
|
|
42643
43268
|
if (inliningRequirement !== TcbInliningRequirement.None && this.inlining === InliningMode.InlineOps) {
|
|
@@ -44547,6 +45172,10 @@ var ALL_DIAGNOSTIC_FACTORIES = [
|
|
|
44547
45172
|
factory7,
|
|
44548
45173
|
factory
|
|
44549
45174
|
];
|
|
45175
|
+
var SUPPORTED_DIAGNOSTIC_NAMES = /* @__PURE__ */ new Set([
|
|
45176
|
+
ExtendedTemplateDiagnosticName.CONTROL_FLOW_PREVENTING_CONTENT_PROJECTION,
|
|
45177
|
+
...ALL_DIAGNOSTIC_FACTORIES.map((factory9) => factory9.name)
|
|
45178
|
+
]);
|
|
44550
45179
|
|
|
44551
45180
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/core/src/compiler.mjs
|
|
44552
45181
|
var CompilationTicketKind;
|
|
@@ -44866,6 +45495,7 @@ var NgCompiler = class {
|
|
|
44866
45495
|
return strictTemplates || !!this.options.fullTemplateTypeCheck;
|
|
44867
45496
|
}
|
|
44868
45497
|
getTypeCheckingConfig() {
|
|
45498
|
+
var _a2, _b2, _c2, _d2;
|
|
44869
45499
|
const strictTemplates = !!this.options.strictTemplates;
|
|
44870
45500
|
const useInlineTypeConstructors = this.programDriver.supportsInlineOperations;
|
|
44871
45501
|
let typeCheckingConfig;
|
|
@@ -44891,7 +45521,8 @@ var NgCompiler = class {
|
|
|
44891
45521
|
strictLiteralTypes: true,
|
|
44892
45522
|
enableTemplateTypeChecker: this.enableTemplateTypeChecker,
|
|
44893
45523
|
useInlineTypeConstructors,
|
|
44894
|
-
suggestionsForSuboptimalTypeInference: this.enableTemplateTypeChecker && !strictTemplates
|
|
45524
|
+
suggestionsForSuboptimalTypeInference: this.enableTemplateTypeChecker && !strictTemplates,
|
|
45525
|
+
controlFlowPreventingContentProjection: ((_a2 = this.options.extendedDiagnostics) == null ? void 0 : _a2.defaultCategory) || DiagnosticCategoryLabel.Warning
|
|
44895
45526
|
};
|
|
44896
45527
|
} else {
|
|
44897
45528
|
typeCheckingConfig = {
|
|
@@ -44915,7 +45546,8 @@ var NgCompiler = class {
|
|
|
44915
45546
|
strictLiteralTypes: false,
|
|
44916
45547
|
enableTemplateTypeChecker: this.enableTemplateTypeChecker,
|
|
44917
45548
|
useInlineTypeConstructors,
|
|
44918
|
-
suggestionsForSuboptimalTypeInference: false
|
|
45549
|
+
suggestionsForSuboptimalTypeInference: false,
|
|
45550
|
+
controlFlowPreventingContentProjection: ((_b2 = this.options.extendedDiagnostics) == null ? void 0 : _b2.defaultCategory) || DiagnosticCategoryLabel.Warning
|
|
44919
45551
|
};
|
|
44920
45552
|
}
|
|
44921
45553
|
if (this.options.strictInputTypes !== void 0) {
|
|
@@ -44950,6 +45582,9 @@ var NgCompiler = class {
|
|
|
44950
45582
|
if (this.options.strictLiteralTypes !== void 0) {
|
|
44951
45583
|
typeCheckingConfig.strictLiteralTypes = this.options.strictLiteralTypes;
|
|
44952
45584
|
}
|
|
45585
|
+
if (((_d2 = (_c2 = this.options.extendedDiagnostics) == null ? void 0 : _c2.checks) == null ? void 0 : _d2.controlFlowPreventingContentProjection) !== void 0) {
|
|
45586
|
+
typeCheckingConfig.controlFlowPreventingContentProjection = this.options.extendedDiagnostics.checks.controlFlowPreventingContentProjection;
|
|
45587
|
+
}
|
|
44953
45588
|
return typeCheckingConfig;
|
|
44954
45589
|
}
|
|
44955
45590
|
getTemplateDiagnostics() {
|
|
@@ -45208,9 +45843,8 @@ ${allowedCategoryLabels.join("\n")}
|
|
|
45208
45843
|
`.trim()
|
|
45209
45844
|
});
|
|
45210
45845
|
}
|
|
45211
|
-
const allExtendedDiagnosticNames = ALL_DIAGNOSTIC_FACTORIES.map((factory9) => factory9.name);
|
|
45212
45846
|
for (const [checkName, category] of Object.entries((_c2 = (_b2 = options.extendedDiagnostics) == null ? void 0 : _b2.checks) != null ? _c2 : {})) {
|
|
45213
|
-
if (!
|
|
45847
|
+
if (!SUPPORTED_DIAGNOSTIC_NAMES.has(checkName)) {
|
|
45214
45848
|
yield makeConfigDiagnostic({
|
|
45215
45849
|
category: import_typescript98.default.DiagnosticCategory.Error,
|
|
45216
45850
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CHECK,
|
|
@@ -45218,7 +45852,7 @@ ${allowedCategoryLabels.join("\n")}
|
|
|
45218
45852
|
Angular compiler option "extendedDiagnostics.checks" has an unknown check: "${checkName}".
|
|
45219
45853
|
|
|
45220
45854
|
Allowed check names are:
|
|
45221
|
-
${
|
|
45855
|
+
${Array.from(SUPPORTED_DIAGNOSTIC_NAMES).join("\n")}
|
|
45222
45856
|
`.trim()
|
|
45223
45857
|
});
|
|
45224
45858
|
}
|
|
@@ -45948,7 +46582,7 @@ function normalizePath(path4) {
|
|
|
45948
46582
|
}
|
|
45949
46583
|
|
|
45950
46584
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/core/schematics/utils/project_tsconfig_paths.mjs
|
|
45951
|
-
var
|
|
46585
|
+
var import_core18 = require("@angular-devkit/core");
|
|
45952
46586
|
function getProjectTsConfigPaths(tree) {
|
|
45953
46587
|
return __async(this, null, function* () {
|
|
45954
46588
|
const buildPaths = /* @__PURE__ */ new Set();
|
|
@@ -45965,9 +46599,9 @@ function getProjectTsConfigPaths(tree) {
|
|
|
45965
46599
|
continue;
|
|
45966
46600
|
}
|
|
45967
46601
|
if (name === "build") {
|
|
45968
|
-
buildPaths.add((0,
|
|
46602
|
+
buildPaths.add((0, import_core18.normalize)(tsConfig));
|
|
45969
46603
|
} else {
|
|
45970
|
-
testPaths.add((0,
|
|
46604
|
+
testPaths.add((0, import_core18.normalize)(tsConfig));
|
|
45971
46605
|
}
|
|
45972
46606
|
}
|
|
45973
46607
|
}
|
|
@@ -45999,7 +46633,7 @@ function createHost(tree) {
|
|
|
45999
46633
|
if (!data) {
|
|
46000
46634
|
throw new Error("File not found.");
|
|
46001
46635
|
}
|
|
46002
|
-
return
|
|
46636
|
+
return import_core18.virtualFs.fileBufferToString(data);
|
|
46003
46637
|
});
|
|
46004
46638
|
},
|
|
46005
46639
|
writeFile(path4, data) {
|
|
@@ -46022,7 +46656,7 @@ function createHost(tree) {
|
|
|
46022
46656
|
function getWorkspace(tree) {
|
|
46023
46657
|
return __async(this, null, function* () {
|
|
46024
46658
|
const host = createHost(tree);
|
|
46025
|
-
const { workspace } = yield
|
|
46659
|
+
const { workspace } = yield import_core18.workspaces.readWorkspace("/", host);
|
|
46026
46660
|
return workspace;
|
|
46027
46661
|
});
|
|
46028
46662
|
}
|