@angular/core 17.0.0-rc.2 → 17.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2022/primitives/signals/src/signal.mjs +8 -4
- package/esm2022/src/core_private_export.mjs +2 -1
- package/esm2022/src/core_reactivity_export_internal.mjs +1 -1
- package/esm2022/src/defer/instructions.mjs +3 -2
- package/esm2022/src/hydration/api.mjs +3 -2
- package/esm2022/src/render3/after_render_hooks.mjs +4 -3
- package/esm2022/src/render3/debug/framework_injector_profiler.mjs +13 -4
- package/esm2022/src/render3/features/standalone_feature.mjs +3 -2
- package/esm2022/src/render3/instructions/change_detection.mjs +2 -5
- package/esm2022/src/render3/instructions/control_flow.mjs +4 -3
- package/esm2022/src/render3/node_manipulation.mjs +2 -2
- package/esm2022/src/render3/reactivity/effect.mjs +3 -1
- package/esm2022/src/render3/util/injector_discovery_utils.mjs +2 -2
- package/esm2022/src/util/performance.mjs +19 -0
- package/esm2022/src/version.mjs +1 -1
- package/esm2022/testing/src/logger.mjs +3 -3
- package/fesm2022/core.mjs +46 -26
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/primitives/signals.mjs +8 -4
- package/fesm2022/primitives/signals.mjs.map +1 -1
- package/fesm2022/rxjs-interop.mjs +1 -1
- package/fesm2022/testing.mjs +1 -1
- package/index.d.ts +22 -2
- 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 +464 -251
- package/schematics/migrations/block-template-entities/bundle.js.map +4 -4
- package/schematics/ng-generate/control-flow-migration/bundle.js +509 -256
- package/schematics/ng-generate/control-flow-migration/bundle.js.map +4 -4
- package/schematics/ng-generate/standalone-migration/bundle.js +472 -259
- package/schematics/ng-generate/standalone-migration/bundle.js.map +4 -4
- package/testing/index.d.ts +1 -1
- package/esm2022/src/render3/instructions/change_detection_flags.mjs +0 -12
|
@@ -6990,20 +6990,22 @@ var OpKind;
|
|
|
6990
6990
|
OpKind2[OpKind2["ExtractedAttribute"] = 25] = "ExtractedAttribute";
|
|
6991
6991
|
OpKind2[OpKind2["Defer"] = 26] = "Defer";
|
|
6992
6992
|
OpKind2[OpKind2["DeferOn"] = 27] = "DeferOn";
|
|
6993
|
-
OpKind2[OpKind2["
|
|
6994
|
-
OpKind2[OpKind2["
|
|
6995
|
-
OpKind2[OpKind2["
|
|
6996
|
-
OpKind2[OpKind2["
|
|
6997
|
-
OpKind2[OpKind2["
|
|
6998
|
-
OpKind2[OpKind2["
|
|
6999
|
-
OpKind2[OpKind2["
|
|
7000
|
-
OpKind2[OpKind2["
|
|
7001
|
-
OpKind2[OpKind2["
|
|
7002
|
-
OpKind2[OpKind2["
|
|
7003
|
-
OpKind2[OpKind2["
|
|
7004
|
-
OpKind2[OpKind2["
|
|
7005
|
-
OpKind2[OpKind2["
|
|
7006
|
-
OpKind2[OpKind2["
|
|
6993
|
+
OpKind2[OpKind2["DeferWhen"] = 28] = "DeferWhen";
|
|
6994
|
+
OpKind2[OpKind2["I18nMessage"] = 29] = "I18nMessage";
|
|
6995
|
+
OpKind2[OpKind2["HostProperty"] = 30] = "HostProperty";
|
|
6996
|
+
OpKind2[OpKind2["Namespace"] = 31] = "Namespace";
|
|
6997
|
+
OpKind2[OpKind2["ProjectionDef"] = 32] = "ProjectionDef";
|
|
6998
|
+
OpKind2[OpKind2["Projection"] = 33] = "Projection";
|
|
6999
|
+
OpKind2[OpKind2["RepeaterCreate"] = 34] = "RepeaterCreate";
|
|
7000
|
+
OpKind2[OpKind2["Repeater"] = 35] = "Repeater";
|
|
7001
|
+
OpKind2[OpKind2["I18nStart"] = 36] = "I18nStart";
|
|
7002
|
+
OpKind2[OpKind2["I18n"] = 37] = "I18n";
|
|
7003
|
+
OpKind2[OpKind2["I18nEnd"] = 38] = "I18nEnd";
|
|
7004
|
+
OpKind2[OpKind2["I18nExpression"] = 39] = "I18nExpression";
|
|
7005
|
+
OpKind2[OpKind2["I18nApply"] = 40] = "I18nApply";
|
|
7006
|
+
OpKind2[OpKind2["Icu"] = 41] = "Icu";
|
|
7007
|
+
OpKind2[OpKind2["IcuUpdate"] = 42] = "IcuUpdate";
|
|
7008
|
+
OpKind2[OpKind2["I18nContext"] = 43] = "I18nContext";
|
|
7007
7009
|
})(OpKind || (OpKind = {}));
|
|
7008
7010
|
var ExpressionKind;
|
|
7009
7011
|
(function(ExpressionKind2) {
|
|
@@ -7284,23 +7286,32 @@ function createRepeaterOp(repeaterCreate2, targetSlot, collection, sourceSpan) {
|
|
|
7284
7286
|
sourceSpan
|
|
7285
7287
|
}, NEW_OP);
|
|
7286
7288
|
}
|
|
7287
|
-
function
|
|
7289
|
+
function createDeferWhenOp(target, expr, prefetch, sourceSpan) {
|
|
7290
|
+
return __spreadValues(__spreadValues({
|
|
7291
|
+
kind: OpKind.DeferWhen,
|
|
7292
|
+
target,
|
|
7293
|
+
expr,
|
|
7294
|
+
prefetch,
|
|
7295
|
+
sourceSpan
|
|
7296
|
+
}, NEW_OP), TRAIT_DEPENDS_ON_SLOT_CONTEXT);
|
|
7297
|
+
}
|
|
7298
|
+
function createI18nExpressionOp(context, target, handle, expression, i18nPlaceholder, resolutionTime, sourceSpan) {
|
|
7288
7299
|
return __spreadValues(__spreadValues(__spreadValues({
|
|
7289
7300
|
kind: OpKind.I18nExpression,
|
|
7290
|
-
|
|
7291
|
-
|
|
7292
|
-
|
|
7301
|
+
context,
|
|
7302
|
+
target,
|
|
7303
|
+
handle,
|
|
7293
7304
|
expression,
|
|
7294
7305
|
i18nPlaceholder,
|
|
7295
7306
|
resolutionTime,
|
|
7296
7307
|
sourceSpan
|
|
7297
7308
|
}, NEW_OP), TRAIT_CONSUMES_VARS), TRAIT_DEPENDS_ON_SLOT_CONTEXT);
|
|
7298
7309
|
}
|
|
7299
|
-
function createI18nApplyOp(target,
|
|
7310
|
+
function createI18nApplyOp(target, handle, sourceSpan) {
|
|
7300
7311
|
return __spreadValues({
|
|
7301
7312
|
kind: OpKind.I18nApply,
|
|
7302
7313
|
target,
|
|
7303
|
-
|
|
7314
|
+
handle,
|
|
7304
7315
|
sourceSpan
|
|
7305
7316
|
}, NEW_OP);
|
|
7306
7317
|
}
|
|
@@ -8048,6 +8059,17 @@ function transformExpressionsInOp(op, transform2, flags) {
|
|
|
8048
8059
|
op.placeholderConfig = transformExpressionsInExpression(op.placeholderConfig, transform2, flags);
|
|
8049
8060
|
}
|
|
8050
8061
|
break;
|
|
8062
|
+
case OpKind.I18nMessage:
|
|
8063
|
+
for (const [placeholder, expr] of op.params) {
|
|
8064
|
+
op.params.set(placeholder, transformExpressionsInExpression(expr, transform2, flags));
|
|
8065
|
+
}
|
|
8066
|
+
for (const [placeholder, expr] of op.postprocessingParams) {
|
|
8067
|
+
op.postprocessingParams.set(placeholder, transformExpressionsInExpression(expr, transform2, flags));
|
|
8068
|
+
}
|
|
8069
|
+
break;
|
|
8070
|
+
case OpKind.DeferWhen:
|
|
8071
|
+
op.expr = transformExpressionsInExpression(op.expr, transform2, flags);
|
|
8072
|
+
break;
|
|
8051
8073
|
case OpKind.Advance:
|
|
8052
8074
|
case OpKind.Container:
|
|
8053
8075
|
case OpKind.ContainerEnd:
|
|
@@ -8058,9 +8080,9 @@ function transformExpressionsInOp(op, transform2, flags) {
|
|
|
8058
8080
|
case OpKind.ElementEnd:
|
|
8059
8081
|
case OpKind.ElementStart:
|
|
8060
8082
|
case OpKind.EnableBindings:
|
|
8061
|
-
case OpKind.ExtractedMessage:
|
|
8062
8083
|
case OpKind.I18n:
|
|
8063
8084
|
case OpKind.I18nApply:
|
|
8085
|
+
case OpKind.I18nContext:
|
|
8064
8086
|
case OpKind.I18nEnd:
|
|
8065
8087
|
case OpKind.I18nStart:
|
|
8066
8088
|
case OpKind.Icu:
|
|
@@ -8501,7 +8523,7 @@ function createExtractedAttributeOp(target, bindingKind, name, expression) {
|
|
|
8501
8523
|
expression
|
|
8502
8524
|
}, NEW_OP);
|
|
8503
8525
|
}
|
|
8504
|
-
function createDeferOp(xref, main, mainSlot, sourceSpan) {
|
|
8526
|
+
function createDeferOp(xref, main, mainSlot, metadata, sourceSpan) {
|
|
8505
8527
|
return __spreadProps(__spreadValues(__spreadValues({
|
|
8506
8528
|
kind: OpKind.Defer,
|
|
8507
8529
|
xref,
|
|
@@ -8519,6 +8541,8 @@ function createDeferOp(xref, main, mainSlot, sourceSpan) {
|
|
|
8519
8541
|
placeholderMinimumTime: null,
|
|
8520
8542
|
errorView: null,
|
|
8521
8543
|
errorSlot: null,
|
|
8544
|
+
metadata,
|
|
8545
|
+
resolverFn: null,
|
|
8522
8546
|
sourceSpan
|
|
8523
8547
|
}, NEW_OP), TRAIT_CONSUMES_SLOT), {
|
|
8524
8548
|
numSlotsUsed: 2
|
|
@@ -8533,17 +8557,17 @@ function createDeferOnOp(defer2, trigger, prefetch, sourceSpan) {
|
|
|
8533
8557
|
sourceSpan
|
|
8534
8558
|
}, NEW_OP);
|
|
8535
8559
|
}
|
|
8536
|
-
function
|
|
8560
|
+
function createI18nMessageOp(xref, i18nBlock, message, messagePlaceholder, params, postprocessingParams, needsPostprocessing) {
|
|
8537
8561
|
return __spreadValues({
|
|
8538
|
-
kind: OpKind.
|
|
8539
|
-
|
|
8562
|
+
kind: OpKind.I18nMessage,
|
|
8563
|
+
xref,
|
|
8564
|
+
i18nBlock,
|
|
8540
8565
|
message,
|
|
8541
|
-
|
|
8542
|
-
params
|
|
8543
|
-
postprocessingParams
|
|
8544
|
-
needsPostprocessing
|
|
8545
|
-
|
|
8546
|
-
formattedPostprocessingParams: null
|
|
8566
|
+
messagePlaceholder,
|
|
8567
|
+
params,
|
|
8568
|
+
postprocessingParams,
|
|
8569
|
+
needsPostprocessing,
|
|
8570
|
+
subMessages: []
|
|
8547
8571
|
}, NEW_OP);
|
|
8548
8572
|
}
|
|
8549
8573
|
function createI18nStartOp(xref, message, root) {
|
|
@@ -8554,7 +8578,8 @@ function createI18nStartOp(xref, message, root) {
|
|
|
8554
8578
|
root: root != null ? root : xref,
|
|
8555
8579
|
message,
|
|
8556
8580
|
messageIndex: null,
|
|
8557
|
-
subTemplateIndex: null
|
|
8581
|
+
subTemplateIndex: null,
|
|
8582
|
+
context: null
|
|
8558
8583
|
}, NEW_OP), TRAIT_CONSUMES_SLOT);
|
|
8559
8584
|
}
|
|
8560
8585
|
function createI18nEndOp(xref) {
|
|
@@ -8563,14 +8588,28 @@ function createI18nEndOp(xref) {
|
|
|
8563
8588
|
xref
|
|
8564
8589
|
}, NEW_OP);
|
|
8565
8590
|
}
|
|
8566
|
-
function createIcuOp(xref, message, sourceSpan) {
|
|
8591
|
+
function createIcuOp(xref, message, icu, messagePlaceholder, sourceSpan) {
|
|
8567
8592
|
return __spreadValues({
|
|
8568
8593
|
kind: OpKind.Icu,
|
|
8569
8594
|
xref,
|
|
8570
8595
|
message,
|
|
8596
|
+
icu,
|
|
8597
|
+
messagePlaceholder,
|
|
8598
|
+
context: null,
|
|
8571
8599
|
sourceSpan
|
|
8572
8600
|
}, NEW_OP);
|
|
8573
8601
|
}
|
|
8602
|
+
function createI18nContextOp(xref, i18nBlock, message, sourceSpan) {
|
|
8603
|
+
return __spreadValues({
|
|
8604
|
+
kind: OpKind.I18nContext,
|
|
8605
|
+
xref,
|
|
8606
|
+
i18nBlock,
|
|
8607
|
+
message,
|
|
8608
|
+
sourceSpan,
|
|
8609
|
+
params: /* @__PURE__ */ new Map(),
|
|
8610
|
+
postprocessingParams: /* @__PURE__ */ new Map()
|
|
8611
|
+
}, NEW_OP);
|
|
8612
|
+
}
|
|
8574
8613
|
|
|
8575
8614
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/ops/host.mjs
|
|
8576
8615
|
function createHostPropertyOp(name, expression, isAnimationTrigger, sourceSpan) {
|
|
@@ -8606,10 +8645,11 @@ var CompilationJob = class {
|
|
|
8606
8645
|
}
|
|
8607
8646
|
};
|
|
8608
8647
|
var ComponentCompilationJob = class extends CompilationJob {
|
|
8609
|
-
constructor(componentName, pool, compatibility, relativeContextFilePath, i18nUseExternalIds) {
|
|
8648
|
+
constructor(componentName, pool, compatibility, relativeContextFilePath, i18nUseExternalIds, deferBlocksMeta) {
|
|
8610
8649
|
super(componentName, pool, compatibility);
|
|
8611
8650
|
this.relativeContextFilePath = relativeContextFilePath;
|
|
8612
8651
|
this.i18nUseExternalIds = i18nUseExternalIds;
|
|
8652
|
+
this.deferBlocksMeta = deferBlocksMeta;
|
|
8613
8653
|
this.kind = CompilationJobKind.Tmpl;
|
|
8614
8654
|
this.fnSuffix = "Template";
|
|
8615
8655
|
this.views = /* @__PURE__ */ new Map();
|
|
@@ -8715,7 +8755,7 @@ function applyI18nExpressions(job) {
|
|
|
8715
8755
|
for (const unit of job.units) {
|
|
8716
8756
|
for (const op of unit.update) {
|
|
8717
8757
|
if (op.kind === OpKind.I18nExpression && needsApplication(op)) {
|
|
8718
|
-
OpList.insertAfter(createI18nApplyOp(op.
|
|
8758
|
+
OpList.insertAfter(createI18nApplyOp(op.target, op.handle, null), op);
|
|
8719
8759
|
}
|
|
8720
8760
|
}
|
|
8721
8761
|
}
|
|
@@ -8725,7 +8765,7 @@ function needsApplication(op) {
|
|
|
8725
8765
|
if (((_a2 = op.next) == null ? void 0 : _a2.kind) !== OpKind.I18nExpression) {
|
|
8726
8766
|
return true;
|
|
8727
8767
|
}
|
|
8728
|
-
if (op.next.
|
|
8768
|
+
if (op.next.context !== op.context) {
|
|
8729
8769
|
return true;
|
|
8730
8770
|
}
|
|
8731
8771
|
return false;
|
|
@@ -8734,19 +8774,31 @@ function needsApplication(op) {
|
|
|
8734
8774
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/assign_i18n_slot_dependencies.mjs
|
|
8735
8775
|
function assignI18nSlotDependencies(job) {
|
|
8736
8776
|
const i18nLastSlotConsumers = /* @__PURE__ */ new Map();
|
|
8777
|
+
const i18nContexts = /* @__PURE__ */ new Map();
|
|
8737
8778
|
let lastSlotConsumer = null;
|
|
8779
|
+
let currentI18nOp = null;
|
|
8738
8780
|
for (const unit of job.units) {
|
|
8739
8781
|
for (const op of unit.create) {
|
|
8740
|
-
if (op.kind === OpKind.I18nEnd) {
|
|
8741
|
-
i18nLastSlotConsumers.set(op.xref, lastSlotConsumer);
|
|
8742
|
-
}
|
|
8743
8782
|
if (hasConsumesSlotTrait(op)) {
|
|
8744
8783
|
lastSlotConsumer = op.xref;
|
|
8745
8784
|
}
|
|
8785
|
+
switch (op.kind) {
|
|
8786
|
+
case OpKind.I18nStart:
|
|
8787
|
+
currentI18nOp = op;
|
|
8788
|
+
break;
|
|
8789
|
+
case OpKind.I18nEnd:
|
|
8790
|
+
i18nLastSlotConsumers.set(currentI18nOp.xref, lastSlotConsumer);
|
|
8791
|
+
currentI18nOp = null;
|
|
8792
|
+
break;
|
|
8793
|
+
case OpKind.I18nContext:
|
|
8794
|
+
i18nContexts.set(op.xref, op);
|
|
8795
|
+
break;
|
|
8796
|
+
}
|
|
8746
8797
|
}
|
|
8747
8798
|
for (const op of unit.update) {
|
|
8748
8799
|
if (op.kind === OpKind.I18nExpression) {
|
|
8749
|
-
|
|
8800
|
+
const i18nContext = i18nContexts.get(op.context);
|
|
8801
|
+
op.target = i18nLastSlotConsumers.get(i18nContext.i18nBlock);
|
|
8750
8802
|
}
|
|
8751
8803
|
}
|
|
8752
8804
|
}
|
|
@@ -9213,6 +9265,113 @@ function serializeAttributes({ attributes, bindings, classes, i18n: i18n2, proje
|
|
|
9213
9265
|
return literalArr(attrArray);
|
|
9214
9266
|
}
|
|
9215
9267
|
|
|
9268
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/create_defer_deps_fns.mjs
|
|
9269
|
+
function createDeferDepsFns(job) {
|
|
9270
|
+
for (const unit of job.units) {
|
|
9271
|
+
for (const op of unit.create) {
|
|
9272
|
+
if (op.kind === OpKind.Defer) {
|
|
9273
|
+
if (op.metadata.deps.length === 0) {
|
|
9274
|
+
continue;
|
|
9275
|
+
}
|
|
9276
|
+
const dependencies = [];
|
|
9277
|
+
for (const dep of op.metadata.deps) {
|
|
9278
|
+
if (dep.isDeferrable) {
|
|
9279
|
+
const innerFn = arrowFn([new FnParam("m", DYNAMIC_TYPE)], variable("m").prop(dep.symbolName));
|
|
9280
|
+
const importExpr2 = new DynamicImportExpr(dep.importPath).prop("then").callFn([innerFn]);
|
|
9281
|
+
dependencies.push(importExpr2);
|
|
9282
|
+
} else {
|
|
9283
|
+
dependencies.push(dep.type);
|
|
9284
|
+
}
|
|
9285
|
+
}
|
|
9286
|
+
const depsFnExpr = arrowFn([], literalArr(dependencies));
|
|
9287
|
+
if (op.handle.slot === null) {
|
|
9288
|
+
throw new Error("AssertionError: slot must be assigned bfore extracting defer deps functions");
|
|
9289
|
+
}
|
|
9290
|
+
op.resolverFn = job.pool.getSharedFunctionReference(depsFnExpr, `${job.componentName}_Defer_${op.handle.slot}_DepsFn`);
|
|
9291
|
+
}
|
|
9292
|
+
}
|
|
9293
|
+
}
|
|
9294
|
+
}
|
|
9295
|
+
|
|
9296
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/create_i18n_contexts.mjs
|
|
9297
|
+
function createI18nContexts(job) {
|
|
9298
|
+
let currentI18nOp = null;
|
|
9299
|
+
let xref;
|
|
9300
|
+
for (const unit of job.units) {
|
|
9301
|
+
for (const op of unit.create) {
|
|
9302
|
+
switch (op.kind) {
|
|
9303
|
+
case OpKind.I18nStart:
|
|
9304
|
+
xref = job.allocateXrefId();
|
|
9305
|
+
unit.create.push(createI18nContextOp(xref, op.xref, op.message, null));
|
|
9306
|
+
op.context = xref;
|
|
9307
|
+
currentI18nOp = op;
|
|
9308
|
+
break;
|
|
9309
|
+
case OpKind.I18nEnd:
|
|
9310
|
+
currentI18nOp = null;
|
|
9311
|
+
break;
|
|
9312
|
+
case OpKind.Icu:
|
|
9313
|
+
if (currentI18nOp === null) {
|
|
9314
|
+
throw Error("Unexpected ICU outside of an i18n block.");
|
|
9315
|
+
}
|
|
9316
|
+
if (op.message.id !== currentI18nOp.message.id) {
|
|
9317
|
+
xref = job.allocateXrefId();
|
|
9318
|
+
unit.create.push(createI18nContextOp(xref, currentI18nOp.xref, op.message, null));
|
|
9319
|
+
op.context = xref;
|
|
9320
|
+
} else {
|
|
9321
|
+
op.context = currentI18nOp.context;
|
|
9322
|
+
}
|
|
9323
|
+
break;
|
|
9324
|
+
}
|
|
9325
|
+
}
|
|
9326
|
+
}
|
|
9327
|
+
}
|
|
9328
|
+
|
|
9329
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/create_i18n_icu_expressions.mjs
|
|
9330
|
+
function createI18nIcuExpressions(job) {
|
|
9331
|
+
const icus = /* @__PURE__ */ new Map();
|
|
9332
|
+
const i18nContexts = /* @__PURE__ */ new Map();
|
|
9333
|
+
const i18nBlocks = /* @__PURE__ */ new Map();
|
|
9334
|
+
for (const unit of job.units) {
|
|
9335
|
+
for (const op of unit.create) {
|
|
9336
|
+
switch (op.kind) {
|
|
9337
|
+
case OpKind.Icu:
|
|
9338
|
+
icus.set(op.xref, op);
|
|
9339
|
+
break;
|
|
9340
|
+
case OpKind.I18nContext:
|
|
9341
|
+
i18nContexts.set(op.xref, op);
|
|
9342
|
+
break;
|
|
9343
|
+
case OpKind.I18nStart:
|
|
9344
|
+
i18nBlocks.set(op.xref, op);
|
|
9345
|
+
break;
|
|
9346
|
+
}
|
|
9347
|
+
}
|
|
9348
|
+
for (const op of unit.update) {
|
|
9349
|
+
switch (op.kind) {
|
|
9350
|
+
case OpKind.IcuUpdate:
|
|
9351
|
+
const icuOp = icus.get(op.xref);
|
|
9352
|
+
if ((icuOp == null ? void 0 : icuOp.icu.expressionPlaceholder) === void 0) {
|
|
9353
|
+
throw Error("ICU should have an i18n placeholder");
|
|
9354
|
+
}
|
|
9355
|
+
if (icuOp.context === null) {
|
|
9356
|
+
throw Error("ICU should have its i18n context set");
|
|
9357
|
+
}
|
|
9358
|
+
const i18nContext = i18nContexts.get(icuOp.context);
|
|
9359
|
+
const i18nBlock = i18nBlocks.get(i18nContext.i18nBlock);
|
|
9360
|
+
OpList.replace(op, createI18nExpressionOp(
|
|
9361
|
+
i18nContext.xref,
|
|
9362
|
+
i18nBlock.xref,
|
|
9363
|
+
i18nBlock.handle,
|
|
9364
|
+
new LexicalReadExpr(icuOp.icu.expression),
|
|
9365
|
+
icuOp.icu.expressionPlaceholder,
|
|
9366
|
+
I18nParamResolutionTime.Postproccessing,
|
|
9367
|
+
null
|
|
9368
|
+
));
|
|
9369
|
+
break;
|
|
9370
|
+
}
|
|
9371
|
+
}
|
|
9372
|
+
}
|
|
9373
|
+
}
|
|
9374
|
+
|
|
9216
9375
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/defer_configs.mjs
|
|
9217
9376
|
function configureDeferInstructions(job) {
|
|
9218
9377
|
for (const unit of job.units) {
|
|
@@ -9265,6 +9424,22 @@ function resolveDeferTargetNames(job) {
|
|
|
9265
9424
|
case DeferTriggerKind.Interaction:
|
|
9266
9425
|
case DeferTriggerKind.Viewport:
|
|
9267
9426
|
if (op.trigger.targetName === null) {
|
|
9427
|
+
if (placeholderView === null) {
|
|
9428
|
+
throw new Error("defer on trigger with no target name must have a placeholder block");
|
|
9429
|
+
}
|
|
9430
|
+
const placeholder = job.views.get(placeholderView);
|
|
9431
|
+
if (placeholder == void 0) {
|
|
9432
|
+
throw new Error("AssertionError: could not find placeholder view for defer on trigger");
|
|
9433
|
+
}
|
|
9434
|
+
for (const placeholderOp of placeholder.create) {
|
|
9435
|
+
if (hasConsumesSlotTrait(placeholderOp) && (isElementOrContainerOp(placeholderOp) || placeholderOp.kind === OpKind.Projection)) {
|
|
9436
|
+
op.trigger.targetXref = placeholderOp.xref;
|
|
9437
|
+
op.trigger.targetView = placeholderView;
|
|
9438
|
+
op.trigger.targetSlotViewSteps = -1;
|
|
9439
|
+
op.trigger.targetSlot = placeholderOp.handle;
|
|
9440
|
+
return;
|
|
9441
|
+
}
|
|
9442
|
+
}
|
|
9268
9443
|
return;
|
|
9269
9444
|
}
|
|
9270
9445
|
let view = placeholderView !== null ? job.views.get(placeholderView) : deferOwnerView;
|
|
@@ -9471,7 +9646,7 @@ function ternaryTransform(e) {
|
|
|
9471
9646
|
return new ConditionalExpr(new BinaryOperatorExpr(BinaryOperator.Equals, e.guard, NULL_EXPR), NULL_EXPR, e.expr);
|
|
9472
9647
|
}
|
|
9473
9648
|
|
|
9474
|
-
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/
|
|
9649
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/extract_i18n_messages.mjs
|
|
9475
9650
|
var ESCAPE = "\uFFFD";
|
|
9476
9651
|
var ELEMENT_MARKER = "#";
|
|
9477
9652
|
var TEMPLATE_MARKER = "*";
|
|
@@ -9480,24 +9655,61 @@ var CONTEXT_MARKER = ":";
|
|
|
9480
9655
|
var LIST_START_MARKER = "[";
|
|
9481
9656
|
var LIST_END_MARKER = "]";
|
|
9482
9657
|
var LIST_DELIMITER = "|";
|
|
9483
|
-
function
|
|
9658
|
+
function extractI18nMessages(job) {
|
|
9659
|
+
const i18nContexts = /* @__PURE__ */ new Map();
|
|
9660
|
+
const i18nBlockContexts = /* @__PURE__ */ new Set();
|
|
9484
9661
|
for (const unit of job.units) {
|
|
9485
9662
|
for (const op of unit.create) {
|
|
9486
|
-
|
|
9487
|
-
|
|
9488
|
-
op.
|
|
9489
|
-
|
|
9490
|
-
|
|
9491
|
-
|
|
9492
|
-
|
|
9493
|
-
|
|
9494
|
-
|
|
9495
|
-
|
|
9663
|
+
switch (op.kind) {
|
|
9664
|
+
case OpKind.I18nContext:
|
|
9665
|
+
i18nContexts.set(op.xref, op);
|
|
9666
|
+
break;
|
|
9667
|
+
case OpKind.I18nStart:
|
|
9668
|
+
i18nBlockContexts.add(op.context);
|
|
9669
|
+
break;
|
|
9670
|
+
}
|
|
9671
|
+
}
|
|
9672
|
+
}
|
|
9673
|
+
const i18nBlockMessages = /* @__PURE__ */ new Map();
|
|
9674
|
+
for (const unit of job.units) {
|
|
9675
|
+
for (const op of unit.create) {
|
|
9676
|
+
if (op.kind === OpKind.I18nStart && op.xref === op.root) {
|
|
9677
|
+
if (!op.context) {
|
|
9678
|
+
throw Error("I18n start op should have its context set.");
|
|
9496
9679
|
}
|
|
9680
|
+
const i18nMessageOp = createI18nMessage(job, i18nContexts.get(op.context));
|
|
9681
|
+
i18nBlockMessages.set(op.xref, i18nMessageOp);
|
|
9682
|
+
unit.create.push(i18nMessageOp);
|
|
9683
|
+
}
|
|
9684
|
+
}
|
|
9685
|
+
}
|
|
9686
|
+
for (const unit of job.units) {
|
|
9687
|
+
for (const op of unit.create) {
|
|
9688
|
+
if (op.kind === OpKind.Icu) {
|
|
9689
|
+
if (!op.context) {
|
|
9690
|
+
throw Error("ICU op should have its context set.");
|
|
9691
|
+
}
|
|
9692
|
+
if (!i18nBlockContexts.has(op.context)) {
|
|
9693
|
+
const i18nContext = i18nContexts.get(op.context);
|
|
9694
|
+
const subMessage = createI18nMessage(job, i18nContext, op.messagePlaceholder);
|
|
9695
|
+
unit.create.push(subMessage);
|
|
9696
|
+
const parentMessage = i18nBlockMessages.get(i18nContext.i18nBlock);
|
|
9697
|
+
parentMessage == null ? void 0 : parentMessage.subMessages.push(subMessage.xref);
|
|
9698
|
+
}
|
|
9699
|
+
OpList.remove(op);
|
|
9497
9700
|
}
|
|
9498
9701
|
}
|
|
9499
9702
|
}
|
|
9500
9703
|
}
|
|
9704
|
+
function createI18nMessage(job, context, messagePlaceholder) {
|
|
9705
|
+
let needsPostprocessing = context.postprocessingParams.size > 0;
|
|
9706
|
+
for (const values of context.params.values()) {
|
|
9707
|
+
if (values.length > 1) {
|
|
9708
|
+
needsPostprocessing = true;
|
|
9709
|
+
}
|
|
9710
|
+
}
|
|
9711
|
+
return createI18nMessageOp(job.allocateXrefId(), context.i18nBlock, context.message, messagePlaceholder != null ? messagePlaceholder : null, formatParams(context.params), formatParams(context.postprocessingParams), needsPostprocessing);
|
|
9712
|
+
}
|
|
9501
9713
|
function formatParams(params) {
|
|
9502
9714
|
const result = /* @__PURE__ */ new Map();
|
|
9503
9715
|
for (const [placeholder, placeholderValues] of [...params].sort()) {
|
|
@@ -15405,8 +15617,8 @@ var I18nMetaVisitor = class {
|
|
|
15405
15617
|
}
|
|
15406
15618
|
_generateI18nMessage(nodes, meta = "", visitNodeFn) {
|
|
15407
15619
|
const { meaning, description, customId } = this._parseMetadata(meta);
|
|
15408
|
-
const
|
|
15409
|
-
const message =
|
|
15620
|
+
const createI18nMessage2 = createI18nMessageFactory(this.interpolationConfig);
|
|
15621
|
+
const message = createI18nMessage2(nodes, meaning, description, customId, visitNodeFn);
|
|
15410
15622
|
this._setMessageId(message, meta);
|
|
15411
15623
|
this._setLegacyIds(message, meta);
|
|
15412
15624
|
return message;
|
|
@@ -15678,28 +15890,21 @@ var TRANSLATION_VAR_PREFIX2 = "i18n_";
|
|
|
15678
15890
|
function collectI18nConsts(job) {
|
|
15679
15891
|
const fileBasedI18nSuffix = job.relativeContextFilePath.replace(/[^A-Za-z0-9]/g, "_").toUpperCase() + "_";
|
|
15680
15892
|
const messageConstIndices = /* @__PURE__ */ new Map();
|
|
15893
|
+
const messages = /* @__PURE__ */ new Map();
|
|
15681
15894
|
for (const unit of job.units) {
|
|
15682
15895
|
for (const op of unit.create) {
|
|
15683
|
-
if (op.kind === OpKind.
|
|
15684
|
-
|
|
15685
|
-
assertAllParamsResolved(op);
|
|
15686
|
-
const mainVar = variable(job.pool.uniqueName(TRANSLATION_VAR_PREFIX2));
|
|
15687
|
-
const closureVar = i18nGenerateClosureVar(job.pool, op.message.id, fileBasedI18nSuffix, job.i18nUseExternalIds);
|
|
15688
|
-
let transformFn = void 0;
|
|
15689
|
-
if (op.needsPostprocessing) {
|
|
15690
|
-
const extraTransformFnParams = [];
|
|
15691
|
-
if (op.formattedPostprocessingParams.size > 0) {
|
|
15692
|
-
extraTransformFnParams.push(literalMap([...op.formattedPostprocessingParams].map(([key, value]) => ({ key, value, quoted: true }))));
|
|
15693
|
-
}
|
|
15694
|
-
transformFn = (expr) => importExpr(Identifiers.i18nPostprocess).callFn([expr, ...extraTransformFnParams]);
|
|
15695
|
-
}
|
|
15696
|
-
const statements = getTranslationDeclStmts(op.message, mainVar, closureVar, op.formattedParams, transformFn);
|
|
15697
|
-
messageConstIndices.set(op.owner, job.addConst(mainVar, statements));
|
|
15698
|
-
}
|
|
15896
|
+
if (op.kind === OpKind.I18nMessage) {
|
|
15897
|
+
messages.set(op.xref, op);
|
|
15699
15898
|
OpList.remove(op);
|
|
15700
15899
|
}
|
|
15701
15900
|
}
|
|
15702
15901
|
}
|
|
15902
|
+
for (const op of messages.values()) {
|
|
15903
|
+
if (op.kind === OpKind.I18nMessage && op.messagePlaceholder === null) {
|
|
15904
|
+
const { mainVar, statements } = collectMessage(job, fileBasedI18nSuffix, messages, op);
|
|
15905
|
+
messageConstIndices.set(op.i18nBlock, job.addConst(mainVar, statements));
|
|
15906
|
+
}
|
|
15907
|
+
}
|
|
15703
15908
|
for (const unit of job.units) {
|
|
15704
15909
|
for (const op of unit.create) {
|
|
15705
15910
|
if (op.kind === OpKind.I18nStart) {
|
|
@@ -15708,6 +15913,28 @@ function collectI18nConsts(job) {
|
|
|
15708
15913
|
}
|
|
15709
15914
|
}
|
|
15710
15915
|
}
|
|
15916
|
+
function collectMessage(job, fileBasedI18nSuffix, messages, messageOp) {
|
|
15917
|
+
const statements = [];
|
|
15918
|
+
for (const subMessageId of messageOp.subMessages) {
|
|
15919
|
+
const subMessage = messages.get(subMessageId);
|
|
15920
|
+
const { mainVar: subMessageVar, statements: subMessageStatements } = collectMessage(job, fileBasedI18nSuffix, messages, subMessage);
|
|
15921
|
+
statements.push(...subMessageStatements);
|
|
15922
|
+
messageOp.params.set(subMessage.messagePlaceholder, subMessageVar);
|
|
15923
|
+
}
|
|
15924
|
+
assertAllParamsResolved(messageOp);
|
|
15925
|
+
const mainVar = variable(job.pool.uniqueName(TRANSLATION_VAR_PREFIX2));
|
|
15926
|
+
const closureVar = i18nGenerateClosureVar(job.pool, messageOp.message.id, fileBasedI18nSuffix, job.i18nUseExternalIds);
|
|
15927
|
+
let transformFn = void 0;
|
|
15928
|
+
if (messageOp.needsPostprocessing) {
|
|
15929
|
+
const extraTransformFnParams = [];
|
|
15930
|
+
if (messageOp.postprocessingParams.size > 0) {
|
|
15931
|
+
extraTransformFnParams.push(literalMap([...messageOp.postprocessingParams].map(([key, value]) => ({ key, value, quoted: true }))));
|
|
15932
|
+
}
|
|
15933
|
+
transformFn = (expr) => importExpr(Identifiers.i18nPostprocess).callFn([expr, ...extraTransformFnParams]);
|
|
15934
|
+
}
|
|
15935
|
+
statements.push(...getTranslationDeclStmts(messageOp.message, mainVar, closureVar, messageOp.params, transformFn));
|
|
15936
|
+
return { mainVar, statements };
|
|
15937
|
+
}
|
|
15711
15938
|
function getTranslationDeclStmts(message, variable2, closureVar, params, transformFn) {
|
|
15712
15939
|
const paramsObject = Object.fromEntries(params);
|
|
15713
15940
|
const statements = [
|
|
@@ -15736,52 +15963,38 @@ function i18nGenerateClosureVar(pool, messageId, fileBasedI18nSuffix, useExterna
|
|
|
15736
15963
|
return variable(name);
|
|
15737
15964
|
}
|
|
15738
15965
|
function assertAllParamsResolved(op) {
|
|
15739
|
-
if (op.formattedParams === null || op.formattedPostprocessingParams === null) {
|
|
15740
|
-
throw Error("Params should have been formatted.");
|
|
15741
|
-
}
|
|
15742
15966
|
for (const placeholder in op.message.placeholders) {
|
|
15743
|
-
if (!op.
|
|
15967
|
+
if (!op.params.has(placeholder) && !op.postprocessingParams.has(placeholder)) {
|
|
15744
15968
|
throw Error(`Failed to resolve i18n placeholder: ${placeholder}`);
|
|
15745
15969
|
}
|
|
15746
15970
|
}
|
|
15747
15971
|
for (const placeholder in op.message.placeholderToMessage) {
|
|
15748
|
-
if (!op.
|
|
15972
|
+
if (!op.params.has(placeholder) && !op.postprocessingParams.has(placeholder)) {
|
|
15749
15973
|
throw Error(`Failed to resolve i18n message placeholder: ${placeholder}`);
|
|
15750
15974
|
}
|
|
15751
15975
|
}
|
|
15752
15976
|
}
|
|
15753
15977
|
|
|
15754
|
-
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/i18n_message_extraction.mjs
|
|
15755
|
-
function extractI18nMessages(job) {
|
|
15756
|
-
for (const unit of job.units) {
|
|
15757
|
-
for (const op of unit.create) {
|
|
15758
|
-
if (op.kind === OpKind.I18nStart) {
|
|
15759
|
-
unit.create.push(createExtractedMessageOp(op.xref, op.message, op.xref === op.root));
|
|
15760
|
-
}
|
|
15761
|
-
}
|
|
15762
|
-
}
|
|
15763
|
-
}
|
|
15764
|
-
|
|
15765
15978
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/i18n_text_extraction.mjs
|
|
15766
15979
|
function extractI18nText(job) {
|
|
15767
15980
|
var _a2;
|
|
15768
15981
|
for (const unit of job.units) {
|
|
15769
|
-
let
|
|
15770
|
-
|
|
15771
|
-
const textNodes = /* @__PURE__ */ new Map();
|
|
15982
|
+
let currentI18n = null;
|
|
15983
|
+
const textNodeI18nBlocks = /* @__PURE__ */ new Map();
|
|
15772
15984
|
for (const op of unit.create) {
|
|
15773
15985
|
switch (op.kind) {
|
|
15774
15986
|
case OpKind.I18nStart:
|
|
15775
|
-
|
|
15776
|
-
|
|
15987
|
+
if (op.context === null) {
|
|
15988
|
+
throw Error("I18n op should have its context set.");
|
|
15989
|
+
}
|
|
15990
|
+
currentI18n = op;
|
|
15777
15991
|
break;
|
|
15778
15992
|
case OpKind.I18nEnd:
|
|
15779
|
-
|
|
15780
|
-
currentI18nSlot = null;
|
|
15993
|
+
currentI18n = null;
|
|
15781
15994
|
break;
|
|
15782
15995
|
case OpKind.Text:
|
|
15783
|
-
if (
|
|
15784
|
-
|
|
15996
|
+
if (currentI18n !== null) {
|
|
15997
|
+
textNodeI18nBlocks.set(op.xref, currentI18n);
|
|
15785
15998
|
OpList.remove(op);
|
|
15786
15999
|
}
|
|
15787
16000
|
break;
|
|
@@ -15790,17 +16003,15 @@ function extractI18nText(job) {
|
|
|
15790
16003
|
for (const op of unit.update) {
|
|
15791
16004
|
switch (op.kind) {
|
|
15792
16005
|
case OpKind.InterpolateText:
|
|
15793
|
-
if (!
|
|
16006
|
+
if (!textNodeI18nBlocks.has(op.target)) {
|
|
15794
16007
|
continue;
|
|
15795
16008
|
}
|
|
15796
|
-
const
|
|
16009
|
+
const i18nOp = textNodeI18nBlocks.get(op.target);
|
|
15797
16010
|
const ops = [];
|
|
15798
16011
|
for (let i = 0; i < op.interpolation.expressions.length; i++) {
|
|
15799
16012
|
const expr = op.interpolation.expressions[i];
|
|
15800
16013
|
const placeholder = op.i18nPlaceholders[i];
|
|
15801
|
-
ops.push(createI18nExpressionOp(
|
|
15802
|
-
}
|
|
15803
|
-
if (ops.length > 0) {
|
|
16014
|
+
ops.push(createI18nExpressionOp(i18nOp.context, i18nOp.xref, i18nOp.handle, expr, placeholder.name, I18nParamResolutionTime.Creation, (_a2 = expr.sourceSpan) != null ? _a2 : op.sourceSpan));
|
|
15804
16015
|
}
|
|
15805
16016
|
OpList.replaceWithMany(op, ops);
|
|
15806
16017
|
break;
|
|
@@ -15809,49 +16020,6 @@ function extractI18nText(job) {
|
|
|
15809
16020
|
}
|
|
15810
16021
|
}
|
|
15811
16022
|
|
|
15812
|
-
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/icu_extraction.mjs
|
|
15813
|
-
function extractI18nICUs(job) {
|
|
15814
|
-
for (const unit of job.units) {
|
|
15815
|
-
const icus = /* @__PURE__ */ new Map();
|
|
15816
|
-
let currentI18nId = null;
|
|
15817
|
-
let currentI18nSlot = null;
|
|
15818
|
-
for (const op of unit.create) {
|
|
15819
|
-
switch (op.kind) {
|
|
15820
|
-
case OpKind.I18nStart:
|
|
15821
|
-
currentI18nId = op.xref;
|
|
15822
|
-
currentI18nSlot = op.handle;
|
|
15823
|
-
break;
|
|
15824
|
-
case OpKind.I18nEnd:
|
|
15825
|
-
currentI18nId = null;
|
|
15826
|
-
currentI18nSlot = null;
|
|
15827
|
-
break;
|
|
15828
|
-
case OpKind.Icu:
|
|
15829
|
-
if (currentI18nId === null) {
|
|
15830
|
-
throw Error("Unexpected ICU outside of an i18n block.");
|
|
15831
|
-
}
|
|
15832
|
-
icus.set(op.xref, { message: op.message, i18nBlockId: currentI18nId, i18nBlockSlot: currentI18nSlot });
|
|
15833
|
-
OpList.remove(op);
|
|
15834
|
-
break;
|
|
15835
|
-
}
|
|
15836
|
-
}
|
|
15837
|
-
for (const op of unit.update) {
|
|
15838
|
-
switch (op.kind) {
|
|
15839
|
-
case OpKind.IcuUpdate:
|
|
15840
|
-
const { message, i18nBlockId, i18nBlockSlot } = icus.get(op.xref);
|
|
15841
|
-
const icuNode = message.nodes.find((n) => n instanceof Icu2);
|
|
15842
|
-
if (icuNode === void 0) {
|
|
15843
|
-
throw Error("Could not find ICU in i18n AST");
|
|
15844
|
-
}
|
|
15845
|
-
if (icuNode.expressionPlaceholder === void 0) {
|
|
15846
|
-
throw Error("ICU is missing an i18n placeholder");
|
|
15847
|
-
}
|
|
15848
|
-
OpList.replace(op, createI18nExpressionOp(i18nBlockId, i18nBlockSlot, new LexicalReadExpr(icuNode.expression), icuNode.expressionPlaceholder, I18nParamResolutionTime.Postproccessing, null));
|
|
15849
|
-
break;
|
|
15850
|
-
}
|
|
15851
|
-
}
|
|
15852
|
-
}
|
|
15853
|
-
}
|
|
15854
|
-
|
|
15855
16023
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/local_refs.mjs
|
|
15856
16024
|
function liftLocalRefs(job) {
|
|
15857
16025
|
for (const unit of job.units) {
|
|
@@ -15882,6 +16050,47 @@ function serializeLocalRefs(refs) {
|
|
|
15882
16050
|
return literalArr(constRefs);
|
|
15883
16051
|
}
|
|
15884
16052
|
|
|
16053
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/merge_i18n_contexts.mjs
|
|
16054
|
+
function mergeI18nContexts(job) {
|
|
16055
|
+
const i18nOps = /* @__PURE__ */ new Map();
|
|
16056
|
+
const i18nContexts = /* @__PURE__ */ new Map();
|
|
16057
|
+
for (const unit of job.units) {
|
|
16058
|
+
for (const op of unit.create) {
|
|
16059
|
+
switch (op.kind) {
|
|
16060
|
+
case OpKind.I18nStart:
|
|
16061
|
+
if (!op.context) {
|
|
16062
|
+
throw Error("I18n op should have its context set.");
|
|
16063
|
+
}
|
|
16064
|
+
i18nOps.set(op.xref, op);
|
|
16065
|
+
break;
|
|
16066
|
+
case OpKind.I18nContext:
|
|
16067
|
+
i18nContexts.set(op.xref, op);
|
|
16068
|
+
break;
|
|
16069
|
+
}
|
|
16070
|
+
}
|
|
16071
|
+
}
|
|
16072
|
+
for (const childI18nOp of i18nOps.values()) {
|
|
16073
|
+
if (childI18nOp.xref !== childI18nOp.root) {
|
|
16074
|
+
const childContext = i18nContexts.get(childI18nOp.context);
|
|
16075
|
+
const rootI18nOp = i18nOps.get(childI18nOp.root);
|
|
16076
|
+
const rootContext = i18nContexts.get(rootI18nOp.context);
|
|
16077
|
+
mergeParams(rootContext.params, childContext.params);
|
|
16078
|
+
mergeParams(rootContext.postprocessingParams, childContext.postprocessingParams);
|
|
16079
|
+
}
|
|
16080
|
+
}
|
|
16081
|
+
}
|
|
16082
|
+
function mergeParams(to, from) {
|
|
16083
|
+
for (const [placeholder, fromValues] of from) {
|
|
16084
|
+
const toValues = to.get(placeholder) || [];
|
|
16085
|
+
const flags = fromValues[0].flags;
|
|
16086
|
+
if (flags & I18nParamValueFlags.CloseTag && !(flags & I18nParamValueFlags.OpenTag)) {
|
|
16087
|
+
to.set(placeholder, [...fromValues, ...toValues]);
|
|
16088
|
+
} else {
|
|
16089
|
+
to.set(placeholder, [...toValues, ...fromValues]);
|
|
16090
|
+
}
|
|
16091
|
+
}
|
|
16092
|
+
}
|
|
16093
|
+
|
|
15885
16094
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/namespace.mjs
|
|
15886
16095
|
function emitNamespaceChanges(job) {
|
|
15887
16096
|
for (const unit of job.units) {
|
|
@@ -16406,49 +16615,6 @@ function wrapTemplateWithI18n(unit, parentI18n) {
|
|
|
16406
16615
|
}
|
|
16407
16616
|
}
|
|
16408
16617
|
|
|
16409
|
-
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/propagate_i18n_placeholders.mjs
|
|
16410
|
-
function propogateI18nPlaceholders(job) {
|
|
16411
|
-
const i18nOps = /* @__PURE__ */ new Map();
|
|
16412
|
-
const extractedMessageOps = /* @__PURE__ */ new Map();
|
|
16413
|
-
for (const unit of job.units) {
|
|
16414
|
-
for (const op of unit.create) {
|
|
16415
|
-
switch (op.kind) {
|
|
16416
|
-
case OpKind.I18nStart:
|
|
16417
|
-
i18nOps.set(op.xref, op);
|
|
16418
|
-
break;
|
|
16419
|
-
case OpKind.ExtractedMessage:
|
|
16420
|
-
extractedMessageOps.set(op.owner, op);
|
|
16421
|
-
break;
|
|
16422
|
-
}
|
|
16423
|
-
}
|
|
16424
|
-
}
|
|
16425
|
-
for (const [xref, childExtractedMessageOp] of extractedMessageOps) {
|
|
16426
|
-
if (!childExtractedMessageOp.isRoot) {
|
|
16427
|
-
const i18nOp = i18nOps.get(xref);
|
|
16428
|
-
if (i18nOp === void 0) {
|
|
16429
|
-
throw Error("Could not find owner i18n block for extracted message.");
|
|
16430
|
-
}
|
|
16431
|
-
const rootExtractedMessageOp = extractedMessageOps.get(i18nOp.root);
|
|
16432
|
-
if (rootExtractedMessageOp === void 0) {
|
|
16433
|
-
throw Error("Could not find extracted message op for root i18n block.");
|
|
16434
|
-
}
|
|
16435
|
-
mergeParams(rootExtractedMessageOp.params, childExtractedMessageOp.params);
|
|
16436
|
-
mergeParams(rootExtractedMessageOp.postprocessingParams, childExtractedMessageOp.postprocessingParams);
|
|
16437
|
-
}
|
|
16438
|
-
}
|
|
16439
|
-
}
|
|
16440
|
-
function mergeParams(to, from) {
|
|
16441
|
-
for (const [placeholder, fromValues] of from) {
|
|
16442
|
-
const toValues = to.get(placeholder) || [];
|
|
16443
|
-
const flags = fromValues[0].flags;
|
|
16444
|
-
if (flags & I18nParamValueFlags.CloseTag && !(flags & I18nParamValueFlags.OpenTag)) {
|
|
16445
|
-
to.set(placeholder, [...fromValues, ...toValues]);
|
|
16446
|
-
} else {
|
|
16447
|
-
to.set(placeholder, [...toValues, ...fromValues]);
|
|
16448
|
-
}
|
|
16449
|
-
}
|
|
16450
|
-
}
|
|
16451
|
-
|
|
16452
16618
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/pure_function_extraction.mjs
|
|
16453
16619
|
function extractPureFunctions(job) {
|
|
16454
16620
|
for (const view of job.units) {
|
|
@@ -16572,13 +16738,21 @@ function elementContainer(slot, constIndex, localRefIndex, sourceSpan) {
|
|
|
16572
16738
|
function elementContainerEnd() {
|
|
16573
16739
|
return call(Identifiers.elementContainerEnd, [], null);
|
|
16574
16740
|
}
|
|
16575
|
-
function template(slot, templateFnRef, decls, vars, tag, constIndex, sourceSpan) {
|
|
16576
|
-
const args = [
|
|
16577
|
-
|
|
16578
|
-
|
|
16579
|
-
|
|
16580
|
-
|
|
16581
|
-
|
|
16741
|
+
function template(slot, templateFnRef, decls, vars, tag, constIndex, localRefs, sourceSpan) {
|
|
16742
|
+
const args = [
|
|
16743
|
+
literal(slot),
|
|
16744
|
+
templateFnRef,
|
|
16745
|
+
literal(decls),
|
|
16746
|
+
literal(vars),
|
|
16747
|
+
literal(tag),
|
|
16748
|
+
literal(constIndex)
|
|
16749
|
+
];
|
|
16750
|
+
if (localRefs !== null) {
|
|
16751
|
+
args.push(literal(localRefs));
|
|
16752
|
+
args.push(importExpr(Identifiers.templateRefExtractor));
|
|
16753
|
+
}
|
|
16754
|
+
while (args[args.length - 1].isEquivalent(NULL_EXPR)) {
|
|
16755
|
+
args.pop();
|
|
16582
16756
|
}
|
|
16583
16757
|
return call(Identifiers.templateCreate, args, sourceSpan);
|
|
16584
16758
|
}
|
|
@@ -16652,7 +16826,7 @@ function defer(selfSlot, primarySlot, dependencyResolverFn, loadingSlot, placeho
|
|
|
16652
16826
|
const args = [
|
|
16653
16827
|
literal(selfSlot),
|
|
16654
16828
|
literal(primarySlot),
|
|
16655
|
-
literal(
|
|
16829
|
+
dependencyResolverFn != null ? dependencyResolverFn : literal(null),
|
|
16656
16830
|
literal(loadingSlot),
|
|
16657
16831
|
literal(placeholderSlot),
|
|
16658
16832
|
literal(errorSlot),
|
|
@@ -16732,6 +16906,9 @@ function repeaterCreate(slot, viewFnName, decls, vars, tag, constIndex, trackByF
|
|
|
16732
16906
|
function repeater(metadataSlot, collection, sourceSpan) {
|
|
16733
16907
|
return call(Identifiers.repeater, [literal(metadataSlot), collection], sourceSpan);
|
|
16734
16908
|
}
|
|
16909
|
+
function deferWhen(prefetch, expr, sourceSpan) {
|
|
16910
|
+
return call(prefetch ? Identifiers.deferPrefetchWhen : Identifiers.deferWhen, [expr], sourceSpan);
|
|
16911
|
+
}
|
|
16735
16912
|
function i18n(slot, constIndex, subTemplateIndex) {
|
|
16736
16913
|
const args = [literal(slot), literal(constIndex)];
|
|
16737
16914
|
if (subTemplateIndex) {
|
|
@@ -17092,8 +17269,11 @@ function reifyCreateOperations(unit, ops) {
|
|
|
17092
17269
|
if (!(unit instanceof ViewCompilationUnit)) {
|
|
17093
17270
|
throw new Error(`AssertionError: must be compiling a component`);
|
|
17094
17271
|
}
|
|
17272
|
+
if (Array.isArray(op.localRefs)) {
|
|
17273
|
+
throw new Error(`AssertionError: local refs array should have been extracted into a constant`);
|
|
17274
|
+
}
|
|
17095
17275
|
const childView = unit.job.views.get(op.xref);
|
|
17096
|
-
OpList.replace(op, template(op.handle.slot, variable(childView.fnName), childView.decls, childView.vars, op.tag, op.attributes, op.sourceSpan));
|
|
17276
|
+
OpList.replace(op, template(op.handle.slot, variable(childView.fnName), childView.decls, childView.vars, op.tag, op.attributes, op.localRefs, op.sourceSpan));
|
|
17097
17277
|
break;
|
|
17098
17278
|
case OpKind.DisableBindings:
|
|
17099
17279
|
OpList.replace(op, disableBindings2());
|
|
@@ -17130,7 +17310,7 @@ function reifyCreateOperations(unit, ops) {
|
|
|
17130
17310
|
break;
|
|
17131
17311
|
case OpKind.Defer:
|
|
17132
17312
|
const timerScheduling = !!op.loadingMinimumTime || !!op.loadingAfterTime || !!op.placeholderMinimumTime;
|
|
17133
|
-
OpList.replace(op, defer(op.handle.slot, op.mainSlot.slot,
|
|
17313
|
+
OpList.replace(op, defer(op.handle.slot, op.mainSlot.slot, op.resolverFn, (_b2 = (_a2 = op.loadingSlot) == null ? void 0 : _a2.slot) != null ? _b2 : null, (_d2 = (_c2 = op.placeholderSlot) == null ? void 0 : _c2.slot) != null ? _d2 : null, (_f2 = (_e2 = op.errorSlot) == null ? void 0 : _e2.slot) != null ? _f2 : null, op.loadingConfig, op.placeholderConfig, timerScheduling, op.sourceSpan));
|
|
17134
17314
|
break;
|
|
17135
17315
|
case OpKind.DeferOn:
|
|
17136
17316
|
let args = [];
|
|
@@ -17243,7 +17423,7 @@ function reifyUpdateOperations(_unit, ops) {
|
|
|
17243
17423
|
OpList.replace(op, i18nExp(op.expression, op.sourceSpan));
|
|
17244
17424
|
break;
|
|
17245
17425
|
case OpKind.I18nApply:
|
|
17246
|
-
OpList.replace(op, i18nApply(op.
|
|
17426
|
+
OpList.replace(op, i18nApply(op.handle.slot, op.sourceSpan));
|
|
17247
17427
|
break;
|
|
17248
17428
|
case OpKind.InterpolateText:
|
|
17249
17429
|
OpList.replace(op, textInterpolate(op.interpolation.strings, op.interpolation.expressions, op.sourceSpan));
|
|
@@ -17284,6 +17464,9 @@ function reifyUpdateOperations(_unit, ops) {
|
|
|
17284
17464
|
case OpKind.Repeater:
|
|
17285
17465
|
OpList.replace(op, repeater(op.targetSlot.slot, op.collection, op.sourceSpan));
|
|
17286
17466
|
break;
|
|
17467
|
+
case OpKind.DeferWhen:
|
|
17468
|
+
OpList.replace(op, deferWhen(op.prefetch, op.expr, op.sourceSpan));
|
|
17469
|
+
break;
|
|
17287
17470
|
case OpKind.Statement:
|
|
17288
17471
|
break;
|
|
17289
17472
|
default:
|
|
@@ -17382,6 +17565,22 @@ function removeEmptyBindings(job) {
|
|
|
17382
17565
|
}
|
|
17383
17566
|
}
|
|
17384
17567
|
|
|
17568
|
+
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/remove_i18n_contexts.mjs
|
|
17569
|
+
function removeI18nContexts(job) {
|
|
17570
|
+
for (const unit of job.units) {
|
|
17571
|
+
for (const op of unit.create) {
|
|
17572
|
+
switch (op.kind) {
|
|
17573
|
+
case OpKind.I18nContext:
|
|
17574
|
+
OpList.remove(op);
|
|
17575
|
+
break;
|
|
17576
|
+
case OpKind.I18nStart:
|
|
17577
|
+
op.context = null;
|
|
17578
|
+
break;
|
|
17579
|
+
}
|
|
17580
|
+
}
|
|
17581
|
+
}
|
|
17582
|
+
}
|
|
17583
|
+
|
|
17385
17584
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/repeater_derived_vars.mjs
|
|
17386
17585
|
function generateRepeaterDerivedVars(job) {
|
|
17387
17586
|
const repeaters = /* @__PURE__ */ new Map();
|
|
@@ -17478,13 +17677,13 @@ function transformDollarEvent(unit, ops) {
|
|
|
17478
17677
|
|
|
17479
17678
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_i18n_element_placeholders.mjs
|
|
17480
17679
|
function resolveI18nElementPlaceholders(job) {
|
|
17481
|
-
const
|
|
17680
|
+
const i18nContexts = /* @__PURE__ */ new Map();
|
|
17482
17681
|
const elements = /* @__PURE__ */ new Map();
|
|
17483
17682
|
for (const unit of job.units) {
|
|
17484
17683
|
for (const op of unit.create) {
|
|
17485
17684
|
switch (op.kind) {
|
|
17486
|
-
case OpKind.
|
|
17487
|
-
|
|
17685
|
+
case OpKind.I18nContext:
|
|
17686
|
+
i18nContexts.set(op.xref, op);
|
|
17488
17687
|
break;
|
|
17489
17688
|
case OpKind.ElementStart:
|
|
17490
17689
|
elements.set(op.xref, op);
|
|
@@ -17497,10 +17696,10 @@ function resolveI18nElementPlaceholders(job) {
|
|
|
17497
17696
|
for (const op of unit.create) {
|
|
17498
17697
|
switch (op.kind) {
|
|
17499
17698
|
case OpKind.I18nStart:
|
|
17500
|
-
if (!
|
|
17501
|
-
throw Error("Could not find
|
|
17699
|
+
if (!op.context) {
|
|
17700
|
+
throw Error("Could not find i18n context for i18n op");
|
|
17502
17701
|
}
|
|
17503
|
-
currentOps = {
|
|
17702
|
+
currentOps = { i18nBlock: op, i18nContext: i18nContexts.get(op.context) };
|
|
17504
17703
|
break;
|
|
17505
17704
|
case OpKind.I18nEnd:
|
|
17506
17705
|
currentOps = null;
|
|
@@ -17515,7 +17714,7 @@ function resolveI18nElementPlaceholders(job) {
|
|
|
17515
17714
|
if (closeName === "") {
|
|
17516
17715
|
flags |= I18nParamValueFlags.CloseTag;
|
|
17517
17716
|
}
|
|
17518
|
-
addParam(currentOps.
|
|
17717
|
+
addParam(currentOps.i18nContext.params, startName, op.handle.slot, currentOps.i18nBlock.subTemplateIndex, flags);
|
|
17519
17718
|
}
|
|
17520
17719
|
break;
|
|
17521
17720
|
case OpKind.ElementEnd:
|
|
@@ -17526,7 +17725,7 @@ function resolveI18nElementPlaceholders(job) {
|
|
|
17526
17725
|
}
|
|
17527
17726
|
const { closeName } = startOp.i18nPlaceholder;
|
|
17528
17727
|
if (closeName !== "") {
|
|
17529
|
-
addParam(currentOps.
|
|
17728
|
+
addParam(currentOps.i18nContext.params, closeName, startOp.handle.slot, currentOps.i18nBlock.subTemplateIndex, I18nParamValueFlags.ElementTag | I18nParamValueFlags.CloseTag);
|
|
17530
17729
|
}
|
|
17531
17730
|
}
|
|
17532
17731
|
break;
|
|
@@ -17535,9 +17734,9 @@ function resolveI18nElementPlaceholders(job) {
|
|
|
17535
17734
|
if (currentOps === null) {
|
|
17536
17735
|
throw Error("i18n tag placeholder should only occur inside an i18n block");
|
|
17537
17736
|
}
|
|
17538
|
-
const subTemplateIndex = getSubTemplateIndexForTemplateTag(job, currentOps.
|
|
17539
|
-
addParam(currentOps.
|
|
17540
|
-
addParam(currentOps.
|
|
17737
|
+
const subTemplateIndex = getSubTemplateIndexForTemplateTag(job, currentOps.i18nBlock, op);
|
|
17738
|
+
addParam(currentOps.i18nContext.params, op.i18nPlaceholder.startName, op.handle.slot, subTemplateIndex, I18nParamValueFlags.TemplateTag);
|
|
17739
|
+
addParam(currentOps.i18nContext.params, op.i18nPlaceholder.closeName, op.handle.slot, subTemplateIndex, I18nParamValueFlags.TemplateTag | I18nParamValueFlags.CloseTag);
|
|
17541
17740
|
}
|
|
17542
17741
|
break;
|
|
17543
17742
|
}
|
|
@@ -17561,16 +17760,16 @@ function addParam(params, placeholder, value, subTemplateIndex, flags = I18nPara
|
|
|
17561
17760
|
|
|
17562
17761
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/resolve_i18n_expression_placeholders.mjs
|
|
17563
17762
|
function resolveI18nExpressionPlaceholders(job) {
|
|
17564
|
-
const
|
|
17565
|
-
const
|
|
17763
|
+
const subTemplateIndicies = /* @__PURE__ */ new Map();
|
|
17764
|
+
const i18nContexts = /* @__PURE__ */ new Map();
|
|
17566
17765
|
for (const unit of job.units) {
|
|
17567
17766
|
for (const op of unit.create) {
|
|
17568
17767
|
switch (op.kind) {
|
|
17569
17768
|
case OpKind.I18nStart:
|
|
17570
|
-
|
|
17769
|
+
subTemplateIndicies.set(op.xref, op.subTemplateIndex);
|
|
17571
17770
|
break;
|
|
17572
|
-
case OpKind.
|
|
17573
|
-
|
|
17771
|
+
case OpKind.I18nContext:
|
|
17772
|
+
i18nContexts.set(op.xref, op);
|
|
17574
17773
|
break;
|
|
17575
17774
|
}
|
|
17576
17775
|
}
|
|
@@ -17579,24 +17778,14 @@ function resolveI18nExpressionPlaceholders(job) {
|
|
|
17579
17778
|
for (const unit of job.units) {
|
|
17580
17779
|
for (const op of unit.update) {
|
|
17581
17780
|
if (op.kind === OpKind.I18nExpression) {
|
|
17582
|
-
const
|
|
17583
|
-
|
|
17584
|
-
|
|
17585
|
-
|
|
17586
|
-
}
|
|
17587
|
-
const extractedMessageOp = extractedMessageOps.get(i18nOp.xref);
|
|
17588
|
-
if (!extractedMessageOp) {
|
|
17589
|
-
throw Error("Cannot find extracted message for i18n block");
|
|
17590
|
-
}
|
|
17591
|
-
const params = op.resolutionTime === I18nParamResolutionTime.Creation ? extractedMessageOp.params : extractedMessageOp.postprocessingParams;
|
|
17781
|
+
const index = expressionIndices.get(op.context) || 0;
|
|
17782
|
+
const i18nContext = i18nContexts.get(op.context);
|
|
17783
|
+
const subTemplateIndex = subTemplateIndicies.get(i18nContext.i18nBlock);
|
|
17784
|
+
const params = op.resolutionTime === I18nParamResolutionTime.Creation ? i18nContext.params : i18nContext.postprocessingParams;
|
|
17592
17785
|
const values = params.get(op.i18nPlaceholder) || [];
|
|
17593
|
-
values.push({
|
|
17594
|
-
value: index,
|
|
17595
|
-
subTemplateIndex: i18nOp.subTemplateIndex,
|
|
17596
|
-
flags: I18nParamValueFlags.None
|
|
17597
|
-
});
|
|
17786
|
+
values.push({ value: index, subTemplateIndex, flags: I18nParamValueFlags.None });
|
|
17598
17787
|
params.set(op.i18nPlaceholder, values);
|
|
17599
|
-
expressionIndices.set(op.
|
|
17788
|
+
expressionIndices.set(op.context, index + 1);
|
|
17600
17789
|
}
|
|
17601
17790
|
}
|
|
17602
17791
|
}
|
|
@@ -18347,6 +18536,7 @@ var phases = [
|
|
|
18347
18536
|
{ kind: CompilationJobKind.Both, fn: specializeBindings },
|
|
18348
18537
|
{ kind: CompilationJobKind.Tmpl, fn: propagateI18nBlocks },
|
|
18349
18538
|
{ kind: CompilationJobKind.Tmpl, fn: wrapI18nIcus },
|
|
18539
|
+
{ kind: CompilationJobKind.Tmpl, fn: createI18nContexts },
|
|
18350
18540
|
{ kind: CompilationJobKind.Both, fn: extractAttributes },
|
|
18351
18541
|
{ kind: CompilationJobKind.Both, fn: parseExtractedStyles },
|
|
18352
18542
|
{ kind: CompilationJobKind.Tmpl, fn: removeEmptyBindings },
|
|
@@ -18356,7 +18546,7 @@ var phases = [
|
|
|
18356
18546
|
{ kind: CompilationJobKind.Tmpl, fn: createPipes },
|
|
18357
18547
|
{ kind: CompilationJobKind.Tmpl, fn: configureDeferInstructions },
|
|
18358
18548
|
{ kind: CompilationJobKind.Tmpl, fn: extractI18nText },
|
|
18359
|
-
{ kind: CompilationJobKind.Tmpl, fn:
|
|
18549
|
+
{ kind: CompilationJobKind.Tmpl, fn: createI18nIcuExpressions },
|
|
18360
18550
|
{ kind: CompilationJobKind.Tmpl, fn: applyI18nExpressions },
|
|
18361
18551
|
{ kind: CompilationJobKind.Tmpl, fn: createVariadicPipes },
|
|
18362
18552
|
{ kind: CompilationJobKind.Both, fn: generatePureLiteralStructures },
|
|
@@ -18377,16 +18567,17 @@ var phases = [
|
|
|
18377
18567
|
{ kind: CompilationJobKind.Both, fn: expandSafeReads },
|
|
18378
18568
|
{ kind: CompilationJobKind.Both, fn: generateTemporaryVariables },
|
|
18379
18569
|
{ kind: CompilationJobKind.Tmpl, fn: allocateSlots },
|
|
18380
|
-
{ kind: CompilationJobKind.Tmpl, fn:
|
|
18570
|
+
{ kind: CompilationJobKind.Tmpl, fn: createDeferDepsFns },
|
|
18381
18571
|
{ kind: CompilationJobKind.Tmpl, fn: resolveI18nElementPlaceholders },
|
|
18382
18572
|
{ kind: CompilationJobKind.Tmpl, fn: resolveI18nExpressionPlaceholders },
|
|
18383
|
-
{ kind: CompilationJobKind.Tmpl, fn:
|
|
18384
|
-
{ kind: CompilationJobKind.Tmpl, fn:
|
|
18573
|
+
{ kind: CompilationJobKind.Tmpl, fn: mergeI18nContexts },
|
|
18574
|
+
{ kind: CompilationJobKind.Tmpl, fn: extractI18nMessages },
|
|
18385
18575
|
{ kind: CompilationJobKind.Tmpl, fn: generateTrackFns },
|
|
18386
18576
|
{ kind: CompilationJobKind.Tmpl, fn: collectI18nConsts },
|
|
18387
18577
|
{ kind: CompilationJobKind.Tmpl, fn: collectConstExpressions },
|
|
18388
18578
|
{ kind: CompilationJobKind.Both, fn: collectElementConsts },
|
|
18389
18579
|
{ kind: CompilationJobKind.Tmpl, fn: assignI18nSlotDependencies },
|
|
18580
|
+
{ kind: CompilationJobKind.Tmpl, fn: removeI18nContexts },
|
|
18390
18581
|
{ kind: CompilationJobKind.Both, fn: countVariables },
|
|
18391
18582
|
{ kind: CompilationJobKind.Tmpl, fn: generateAdvance },
|
|
18392
18583
|
{ kind: CompilationJobKind.Both, fn: optimizeVariables },
|
|
@@ -18503,8 +18694,8 @@ function emitHostBindingFunction(job) {
|
|
|
18503
18694
|
|
|
18504
18695
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/template/pipeline/src/ingest.mjs
|
|
18505
18696
|
var compatibilityMode = CompatibilityMode.TemplateDefinitionBuilder;
|
|
18506
|
-
function ingestComponent(componentName, template2, constantPool, relativeContextFilePath, i18nUseExternalIds) {
|
|
18507
|
-
const job = new ComponentCompilationJob(componentName, constantPool, compatibilityMode, relativeContextFilePath, i18nUseExternalIds);
|
|
18697
|
+
function ingestComponent(componentName, template2, constantPool, relativeContextFilePath, i18nUseExternalIds, deferBlocksMeta) {
|
|
18698
|
+
const job = new ComponentCompilationJob(componentName, constantPool, compatibilityMode, relativeContextFilePath, i18nUseExternalIds, deferBlocksMeta);
|
|
18508
18699
|
ingestNodes(job.root, template2);
|
|
18509
18700
|
return job;
|
|
18510
18701
|
}
|
|
@@ -18587,6 +18778,7 @@ function ingestNodes(unit, template2) {
|
|
|
18587
18778
|
}
|
|
18588
18779
|
}
|
|
18589
18780
|
function ingestElement(unit, element2) {
|
|
18781
|
+
var _a2;
|
|
18590
18782
|
if (element2.i18n !== void 0 && !(element2.i18n instanceof Message || element2.i18n instanceof TagPlaceholder)) {
|
|
18591
18783
|
throw Error(`Unhandled i18n metadata type for element: ${element2.i18n.constructor.name}`);
|
|
18592
18784
|
}
|
|
@@ -18597,7 +18789,7 @@ function ingestElement(unit, element2) {
|
|
|
18597
18789
|
ingestBindings(unit, startOp, element2);
|
|
18598
18790
|
ingestReferences(startOp, element2);
|
|
18599
18791
|
ingestNodes(unit, element2.children);
|
|
18600
|
-
const endOp = createElementEndOp(id, element2.endSourceSpan);
|
|
18792
|
+
const endOp = createElementEndOp(id, (_a2 = element2.endSourceSpan) != null ? _a2 : element2.startSourceSpan);
|
|
18601
18793
|
unit.create.push(endOp);
|
|
18602
18794
|
if (element2.i18n instanceof Message) {
|
|
18603
18795
|
const i18nBlockId = unit.job.allocateXrefId();
|
|
@@ -18720,12 +18912,16 @@ function ingestDeferView(unit, suffix, children, sourceSpan) {
|
|
|
18720
18912
|
}
|
|
18721
18913
|
function ingestDeferBlock(unit, deferBlock) {
|
|
18722
18914
|
var _a2, _b2, _c2, _d2, _e2, _f2, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
18915
|
+
const blockMeta = unit.job.deferBlocksMeta.get(deferBlock);
|
|
18916
|
+
if (blockMeta === void 0) {
|
|
18917
|
+
throw new Error(`AssertionError: unable to find metadata for deferred block`);
|
|
18918
|
+
}
|
|
18723
18919
|
const main = ingestDeferView(unit, "", deferBlock.children, deferBlock.sourceSpan);
|
|
18724
18920
|
const loading = ingestDeferView(unit, "Loading", (_a2 = deferBlock.loading) == null ? void 0 : _a2.children, (_b2 = deferBlock.loading) == null ? void 0 : _b2.sourceSpan);
|
|
18725
18921
|
const placeholder = ingestDeferView(unit, "Placeholder", (_c2 = deferBlock.placeholder) == null ? void 0 : _c2.children, (_d2 = deferBlock.placeholder) == null ? void 0 : _d2.sourceSpan);
|
|
18726
18922
|
const error2 = ingestDeferView(unit, "Error", (_e2 = deferBlock.error) == null ? void 0 : _e2.children, (_f2 = deferBlock.error) == null ? void 0 : _f2.sourceSpan);
|
|
18727
18923
|
const deferXref = unit.job.allocateXrefId();
|
|
18728
|
-
const deferOp = createDeferOp(deferXref, main.xref, main.handle, deferBlock.sourceSpan);
|
|
18924
|
+
const deferOp = createDeferOp(deferXref, main.xref, main.handle, blockMeta, deferBlock.sourceSpan);
|
|
18729
18925
|
deferOp.placeholderView = (_g = placeholder == null ? void 0 : placeholder.xref) != null ? _g : null;
|
|
18730
18926
|
deferOp.placeholderSlot = (_h = placeholder == null ? void 0 : placeholder.handle) != null ? _h : null;
|
|
18731
18927
|
deferOp.loadingSlot = (_i = loading == null ? void 0 : loading.handle) != null ? _i : null;
|
|
@@ -18736,17 +18932,18 @@ function ingestDeferBlock(unit, deferBlock) {
|
|
|
18736
18932
|
unit.create.push(deferOp);
|
|
18737
18933
|
let prefetch = false;
|
|
18738
18934
|
let deferOnOps = [];
|
|
18935
|
+
let deferWhenOps = [];
|
|
18739
18936
|
for (const triggers of [deferBlock.triggers, deferBlock.prefetchTriggers]) {
|
|
18740
18937
|
if (triggers.idle !== void 0) {
|
|
18741
|
-
const deferOnOp = createDeferOnOp(deferXref, { kind: DeferTriggerKind.Idle }, prefetch,
|
|
18938
|
+
const deferOnOp = createDeferOnOp(deferXref, { kind: DeferTriggerKind.Idle }, prefetch, triggers.idle.sourceSpan);
|
|
18742
18939
|
deferOnOps.push(deferOnOp);
|
|
18743
18940
|
}
|
|
18744
18941
|
if (triggers.immediate !== void 0) {
|
|
18745
|
-
const deferOnOp = createDeferOnOp(deferXref, { kind: DeferTriggerKind.Immediate }, prefetch,
|
|
18942
|
+
const deferOnOp = createDeferOnOp(deferXref, { kind: DeferTriggerKind.Immediate }, prefetch, triggers.immediate.sourceSpan);
|
|
18746
18943
|
deferOnOps.push(deferOnOp);
|
|
18747
18944
|
}
|
|
18748
18945
|
if (triggers.timer !== void 0) {
|
|
18749
|
-
const deferOnOp = createDeferOnOp(deferXref, { kind: DeferTriggerKind.Timer, delay: triggers.timer.delay }, prefetch,
|
|
18946
|
+
const deferOnOp = createDeferOnOp(deferXref, { kind: DeferTriggerKind.Timer, delay: triggers.timer.delay }, prefetch, triggers.timer.sourceSpan);
|
|
18750
18947
|
deferOnOps.push(deferOnOp);
|
|
18751
18948
|
}
|
|
18752
18949
|
if (triggers.hover !== void 0) {
|
|
@@ -18757,7 +18954,7 @@ function ingestDeferBlock(unit, deferBlock) {
|
|
|
18757
18954
|
targetSlot: null,
|
|
18758
18955
|
targetView: null,
|
|
18759
18956
|
targetSlotViewSteps: null
|
|
18760
|
-
}, prefetch,
|
|
18957
|
+
}, prefetch, triggers.hover.sourceSpan);
|
|
18761
18958
|
deferOnOps.push(deferOnOp);
|
|
18762
18959
|
}
|
|
18763
18960
|
if (triggers.interaction !== void 0) {
|
|
@@ -18768,7 +18965,7 @@ function ingestDeferBlock(unit, deferBlock) {
|
|
|
18768
18965
|
targetSlot: null,
|
|
18769
18966
|
targetView: null,
|
|
18770
18967
|
targetSlotViewSteps: null
|
|
18771
|
-
}, prefetch,
|
|
18968
|
+
}, prefetch, triggers.interaction.sourceSpan);
|
|
18772
18969
|
deferOnOps.push(deferOnOp);
|
|
18773
18970
|
}
|
|
18774
18971
|
if (triggers.viewport !== void 0) {
|
|
@@ -18779,21 +18976,26 @@ function ingestDeferBlock(unit, deferBlock) {
|
|
|
18779
18976
|
targetSlot: null,
|
|
18780
18977
|
targetView: null,
|
|
18781
18978
|
targetSlotViewSteps: null
|
|
18782
|
-
}, prefetch,
|
|
18979
|
+
}, prefetch, triggers.viewport.sourceSpan);
|
|
18783
18980
|
deferOnOps.push(deferOnOp);
|
|
18784
18981
|
}
|
|
18785
|
-
if (
|
|
18982
|
+
if (triggers.when !== void 0) {
|
|
18983
|
+
const deferOnOp = createDeferWhenOp(deferXref, convertAst(triggers.when.value, unit.job, triggers.when.sourceSpan), prefetch, triggers.when.sourceSpan);
|
|
18984
|
+
deferWhenOps.push(deferOnOp);
|
|
18985
|
+
}
|
|
18986
|
+
if (deferOnOps.length === 0 && deferWhenOps.length === 0) {
|
|
18786
18987
|
deferOnOps.push(createDeferOnOp(deferXref, { kind: DeferTriggerKind.Idle }, false, null));
|
|
18787
18988
|
}
|
|
18788
18989
|
prefetch = true;
|
|
18789
18990
|
}
|
|
18790
18991
|
unit.create.push(deferOnOps);
|
|
18992
|
+
unit.update.push(deferWhenOps);
|
|
18791
18993
|
}
|
|
18792
18994
|
function ingestIcu(unit, icu) {
|
|
18793
18995
|
var _a2;
|
|
18794
|
-
if (icu.i18n instanceof Message) {
|
|
18996
|
+
if (icu.i18n instanceof Message && isSingleI18nIcu(icu.i18n)) {
|
|
18795
18997
|
const xref = unit.job.allocateXrefId();
|
|
18796
|
-
unit.create.push(createIcuOp(xref, icu.i18n, null));
|
|
18998
|
+
unit.create.push(createIcuOp(xref, icu.i18n, icu.i18n.nodes[0], icuFromI18nMessage(icu.i18n).name, null));
|
|
18797
18999
|
unit.update.push(createIcuUpdateOp(xref, null));
|
|
18798
19000
|
} else {
|
|
18799
19001
|
throw Error(`Unhandled i18n metadata type for ICU: ${(_a2 = icu.i18n) == null ? void 0 : _a2.constructor.name}`);
|
|
@@ -18851,6 +19053,15 @@ function convertAst(ast, job, baseSourceSpan) {
|
|
|
18851
19053
|
return new ReadPropExpr(convertAst(ast.receiver, job, baseSourceSpan), ast.name, null, convertSourceSpan(ast.span, baseSourceSpan));
|
|
18852
19054
|
}
|
|
18853
19055
|
} else if (ast instanceof PropertyWrite) {
|
|
19056
|
+
if (ast.receiver instanceof ImplicitReceiver) {
|
|
19057
|
+
return new WritePropExpr(
|
|
19058
|
+
new ContextExpr(job.root.xref),
|
|
19059
|
+
ast.name,
|
|
19060
|
+
convertAst(ast.value, job, baseSourceSpan),
|
|
19061
|
+
null,
|
|
19062
|
+
convertSourceSpan(ast.span, baseSourceSpan)
|
|
19063
|
+
);
|
|
19064
|
+
}
|
|
18854
19065
|
return new WritePropExpr(convertAst(ast.receiver, job, baseSourceSpan), ast.name, convertAst(ast.value, job, baseSourceSpan), void 0, convertSourceSpan(ast.span, baseSourceSpan));
|
|
18855
19066
|
} else if (ast instanceof KeyedWrite) {
|
|
18856
19067
|
return new WriteKeyExpr(convertAst(ast.receiver, job, baseSourceSpan), convertAst(ast.key, job, baseSourceSpan), convertAst(ast.value, job, baseSourceSpan), void 0, convertSourceSpan(ast.span, baseSourceSpan));
|
|
@@ -18900,7 +19111,7 @@ function convertAst(ast, job, baseSourceSpan) {
|
|
|
18900
19111
|
} else if (ast instanceof EmptyExpr) {
|
|
18901
19112
|
return new EmptyExpr2(convertSourceSpan(ast.span, baseSourceSpan));
|
|
18902
19113
|
} else {
|
|
18903
|
-
throw new Error(`Unhandled expression type
|
|
19114
|
+
throw new Error(`Unhandled expression type "${ast.constructor.name}" in file "${baseSourceSpan == null ? void 0 : baseSourceSpan.start.file.url}"`);
|
|
18904
19115
|
}
|
|
18905
19116
|
}
|
|
18906
19117
|
function isPlainTemplate(tmpl) {
|
|
@@ -19038,7 +19249,8 @@ function ingestControlFlowInsertionPoint(unit, xref, node) {
|
|
|
19038
19249
|
for (const attr of root.attributes) {
|
|
19039
19250
|
ingestBinding(unit, xref, attr.name, literal(attr.value), 1, null, SecurityContext.NONE, attr.sourceSpan, BindingFlags.TextValue);
|
|
19040
19251
|
}
|
|
19041
|
-
|
|
19252
|
+
const tagName = root instanceof Element ? root.name : root.tagName;
|
|
19253
|
+
return tagName === "ng-template" ? null : tagName;
|
|
19042
19254
|
}
|
|
19043
19255
|
return null;
|
|
19044
19256
|
}
|
|
@@ -21936,7 +22148,8 @@ var TemplateDefinitionBuilder = class {
|
|
|
21936
22148
|
}
|
|
21937
22149
|
}
|
|
21938
22150
|
if (root !== null) {
|
|
21939
|
-
|
|
22151
|
+
const name = root instanceof Element ? root.name : root.tagName;
|
|
22152
|
+
tagName = name === NG_TEMPLATE_TAG_NAME ? null : name;
|
|
21940
22153
|
attrsExprs = this.getAttributeExpressions(NG_TEMPLATE_TAG_NAME, root.attributes, root.inputs, []);
|
|
21941
22154
|
}
|
|
21942
22155
|
return { tagName, attrsExprs };
|
|
@@ -22886,7 +23099,7 @@ function compileComponentFromMetadata(meta, constantPool, bindingParser) {
|
|
|
22886
23099
|
}
|
|
22887
23100
|
definitionMap.set("template", templateFunctionExpression);
|
|
22888
23101
|
} else {
|
|
22889
|
-
const tpl = ingestComponent(meta.name, meta.template.nodes, constantPool, meta.relativeContextFilePath, meta.i18nUseExternalIds);
|
|
23102
|
+
const tpl = ingestComponent(meta.name, meta.template.nodes, constantPool, meta.relativeContextFilePath, meta.i18nUseExternalIds, meta.deferBlocks);
|
|
22890
23103
|
transform(tpl, CompilationJobKind.Tmpl);
|
|
22891
23104
|
const templateFn = emitTemplateFn(tpl, constantPool);
|
|
22892
23105
|
if (tpl.contentSelectors !== null) {
|
|
@@ -24537,7 +24750,7 @@ function publishFacade(global) {
|
|
|
24537
24750
|
}
|
|
24538
24751
|
|
|
24539
24752
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/version.mjs
|
|
24540
|
-
var VERSION2 = new Version("17.0.0
|
|
24753
|
+
var VERSION2 = new Version("17.0.0");
|
|
24541
24754
|
|
|
24542
24755
|
// bazel-out/darwin_arm64-fastbuild/bin/packages/compiler/src/i18n/extractor_merger.mjs
|
|
24543
24756
|
var _VisitorMode;
|